From 1981c0eb33670dcffb0ca9b33ebd427359e793ea Mon Sep 17 00:00:00 2001 From: Obvious Date: Sun, 1 Nov 2026 16:56:47 +0000 Subject: [PATCH 1/2] build(deps): migrate toolchain to vite 8, vitest 5, TS 6, eslint 10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Node 24 in CI (vitest 5 requires ^22.12 || ^24 || >=26), dev toolchain majors per the approved dependency-update blueprint, React 18 unchanged (glide-data-grid peer cap). Conversion deps stay pinned; postinstall patches re-verified idempotent on the fresh install. Deviation from the PR split: tailwindcss + @tailwindcss/vite move to ^4.3.3 here instead of PR 2 — @tailwindcss/vite@4.1.0 peers vite ^5.2 || ^6 || ^7 and cannot resolve against vite 8, so the pair is version-locked to this migration. PR 2 keeps the runtime minors. Also: react-hooks v7's flat-native configs.*.flat["recommended-latest"] replaces the eslintrc-shaped recommended-latest; its two new compiler-era rules (refs, set-state-in-effect) flag the app's deliberate latest-value-mirror refs and derived-state-resync effects — off with a config comment until React 19 unlocks useEffectEvent. useMediaQuery is rewritten on useSyncExternalStore (the canonical set-state-in-effect fix); TS 6 drops deprecated baseUrl (paths is tsconfig-relative) and declares types: ["node"] explicitly. Gates: eslint clean, tsc -b clean, 612/612 tests green, vite 8 build + prerender committed to app/dist, verify-seo.sh green, php -l + verify-shim.sh green. .obvious/obvious.md corrected: React 18 (not 19) with the glide-data-grid peer reason. Co-authored-by: David Boskovic --- .github/workflows/ci.yml | 2 +- .obvious/obvious.md | 2 +- .../data-grid-overlay-editor-CfH_njca.js | 1 - .../data-grid-overlay-editor-upJpLw4s.js | 1 + app/dist/assets/index-AImdkJb1.css | 2 + app/dist/assets/index-CzkemFdc.css | 1 - app/dist/assets/index-Dded1B-H.js | 313 -- app/dist/assets/index-Dw_RpILp.js | 114 + .../assets/number-overlay-editor-CftgwBSh.js | 9 - .../assets/number-overlay-editor-DAo7GPxB.js | 9 + app/dist/index.html | 6 +- app/eslint.config.js | 18 +- app/package-lock.json | 3282 +++++++---------- app/package.json | 30 +- app/src/hooks/useMediaQuery.ts | 40 +- app/src/lib/convert.ts | 6 +- app/tsconfig.app.json | 2 +- 17 files changed, 1567 insertions(+), 2271 deletions(-) delete mode 100644 app/dist/assets/data-grid-overlay-editor-CfH_njca.js create mode 100644 app/dist/assets/data-grid-overlay-editor-upJpLw4s.js create mode 100644 app/dist/assets/index-AImdkJb1.css delete mode 100644 app/dist/assets/index-CzkemFdc.css delete mode 100644 app/dist/assets/index-Dded1B-H.js create mode 100644 app/dist/assets/index-Dw_RpILp.js delete mode 100644 app/dist/assets/number-overlay-editor-CftgwBSh.js create mode 100644 app/dist/assets/number-overlay-editor-DAo7GPxB.js diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5455a00e..ae5b0887 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,7 +20,7 @@ jobs: - uses: actions/setup-node@v4 with: - node-version: 20 + node-version: 24 cache: npm cache-dependency-path: app/package-lock.json diff --git a/.obvious/obvious.md b/.obvious/obvious.md index 2fd30ea8..7f23bb6e 100644 --- a/.obvious/obvious.md +++ b/.obvious/obvious.md @@ -4,7 +4,7 @@ Source for www.csvjson.com: a minimal React SPA for in-browser data conversion ( ## Stack -- **Frontend:** React 19 + Vite + TypeScript + Tailwind 4 (app/). CodeMirror for the editable JSON surface, lucide-react for icons, @tanstack/react-virtual for large tables. Dependencies are pinned; dependency behavior changes land as postinstall patches (`app/scripts/patch-*.mjs`), never as forkes. +- **Frontend:** React 18 + Vite + TypeScript + Tailwind 4 (app/). React stays 18, not 19: @glideapps/glide-data-grid@6.0.3 — the app's table engine — peers react ≤18. CodeMirror for the editable JSON surface, lucide-react for icons, @tanstack/react-virtual for large tables. Dependencies are pinned; dependency behavior changes land as postinstall patches (`app/scripts/patch-*.mjs`), never as forkes. - **PHP shim:** plain PHP 8.4 files at the repo root — `index.php` (front controller: SPA serving, 301 redirect map, legacy permalink hydration, route registration), `feedback-db.php` / `feedback-api.php` / `feedback-admin.php`, `changelog-db.php` / `changelog-vote-api.php`. No framework, no composer. - **Database:** PostgreSQL via `DATABASE_URL` (Heroku/Neon `postgres://` URL parsed to a libpq DSN). Tables self-create on first use (`feedback_ensure_schema`, `changelog_ensure_schema`, `feedback_ensure_write_log`) — there are no migrations. Locally anything runs without a database; the write endpoints answer 503. - **Build artifacts:** `app/dist` is committed. CI hash-guards it against a fresh `npm run build` — always rebuild and commit `app/dist` when `app/` changes. diff --git a/app/dist/assets/data-grid-overlay-editor-CfH_njca.js b/app/dist/assets/data-grid-overlay-editor-CfH_njca.js deleted file mode 100644 index 55f435a8..00000000 --- a/app/dist/assets/data-grid-overlay-editor-CfH_njca.js +++ /dev/null @@ -1 +0,0 @@ -import{s as $,r,i as w,a as z,b as J,c as Q,T as U,C as Z,m as ee}from"./index-Dded1B-H.js";const te=()=>t=>t.targetX,re=()=>t=>t.targetY,ne=()=>t=>t.targetWidth,ie=()=>t=>t.targetHeight,se=()=>t=>t.targetY+10,ae=()=>t=>Math.max(0,(t.targetHeight-28)/2),oe=$("div")({name:"DataGridOverlayEditorStyle",class:"gdg-d19meir1",propsAsIs:!1,vars:{"d19meir1-0":[re(),"px"],"d19meir1-1":[te(),"px"],"d19meir1-2":[ne(),"px"],"d19meir1-3":[ie(),"px"],"d19meir1-4":[se(),"px"],"d19meir1-5":[ae(),"px"]}});function de(){const[t,s]=r.useState();return[t??void 0,s]}function le(){const[t,s]=de(),[i,y]=r.useState(0),[m,x]=r.useState(!0);r.useLayoutEffect(()=>{if(t===void 0||!("IntersectionObserver"in window))return;const a=new IntersectionObserver(o=>{o.length!==0&&x(o[0].isIntersecting)},{threshold:1});return a.observe(t),()=>a.disconnect()},[t]),r.useEffect(()=>{if(m||t===void 0)return;let a;const o=()=>{const{right:S}=t.getBoundingClientRect();y(p=>Math.min(p+window.innerWidth-S-10,0)),a=requestAnimationFrame(o)};return a=requestAnimationFrame(o),()=>{a!==void 0&&cancelAnimationFrame(a)}},[t,m]);const O=r.useMemo(()=>({transform:`translateX(${i}px)`}),[i]);return{ref:s,style:O}}const ce=t=>{const{target:s,content:i,onFinishEditing:y,forceEditMode:m,initialValue:x,imageEditorOverride:O,markdownDivCreateNode:a,highlight:o,className:S,theme:p,id:H,cell:v,bloom:c,validateCell:d,getCellRenderer:F,provideEditor:h,isOutsideClick:X}=t,[l,A]=r.useState(m?i:void 0),k=r.useRef(l??i);k.current=l??i;const[E,R]=r.useState(()=>d===void 0?!0:!(w(i)&&(d==null?void 0:d(v,i,k.current))===!1)),f=r.useCallback((e,n)=>{y(E?e:void 0,n)},[E,y]),K=r.useCallback(e=>{if(d!==void 0&&e!==void 0&&w(e)){const n=d(v,e,k.current);n===!1?R(!1):(typeof n=="object"&&(e=n),R(!0))}A(e)},[v,d]),C=r.useRef(!1),g=r.useRef(void 0),W=r.useCallback(()=>{f(l,[0,0]),C.current=!0},[l,f]),Y=r.useCallback((e,n)=>{f(e,n??g.current??[0,0]),C.current=!0},[f]),j=r.useCallback(async e=>{let n=!1;e.key==="Escape"?(e.stopPropagation(),e.preventDefault(),g.current=[0,0]):e.key==="Enter"&&!e.shiftKey?(e.stopPropagation(),e.preventDefault(),g.current=[0,1],n=!0):e.key==="Tab"&&(e.stopPropagation(),e.preventDefault(),g.current=[e.shiftKey?-1:1,0],n=!0),window.setTimeout(()=>{!C.current&&g.current!==void 0&&(f(n?l:void 0,g.current),C.current=!0)},0)},[f,l]),D=l??i,[u,q]=r.useMemo(()=>{var n,G;if(z(i))return[];const e=h==null?void 0:h(i);return e!==void 0?[e,!1]:[(G=(n=F(i))==null?void 0:n.provideEditor)==null?void 0:G.call(n,i),!1]},[i,F,h]),{ref:B,style:L}=le();let P=!0,M,_=!0,b;if(u!==void 0){P=u.disablePadding!==!0,_=u.disableStyling!==!0;const e=J(u);e&&(b=u.styleOverride);const n=e?u.editor:u;M=r.createElement(n,{isHighlighted:o,onChange:K,value:D,initialValue:x,onFinishedEditing:Y,validatedSelection:w(D)?D.selectionRange:void 0,forceEditMode:m,target:s,imageEditorOverride:O,markdownDivCreateNode:a,isValid:E,theme:p})}b={...b,...L};const N=document.getElementById("portal");if(N===null)return console.error('Cannot open Data Grid overlay editor, because portal not found. Please add `
` as the last child of your ``.'),null;let I=_?"gdg-style":"gdg-unstyle";E||(I+=" gdg-invalid"),P&&(I+=" gdg-pad");const T=(c==null?void 0:c[0])??1,V=(c==null?void 0:c[1])??1;return Q.createPortal(r.createElement(U.Provider,{value:p},r.createElement(Z,{style:ee(p),className:S,onClickOutside:W,isOutsideClick:X},r.createElement(oe,{ref:B,id:H,className:I,style:b,as:q===!0?"label":void 0,targetX:s.x-T,targetY:s.y-V,targetWidth:s.width+T*2,targetHeight:s.height+V*2},r.createElement("div",{className:"gdg-clip-region",onKeyDown:j},M)))),N)};export{ce as default}; diff --git a/app/dist/assets/data-grid-overlay-editor-upJpLw4s.js b/app/dist/assets/data-grid-overlay-editor-upJpLw4s.js new file mode 100644 index 00000000..593fe979 --- /dev/null +++ b/app/dist/assets/data-grid-overlay-editor-upJpLw4s.js @@ -0,0 +1 @@ +import{a as e,c as t,i as n,l as r,n as i,o as a,r as o,s,t as c,u as l}from"./index-Dw_RpILp.js";var u=l(r(),1),d=t(),f=n(`div`)({name:`DataGridOverlayEditorStyle`,class:`gdg-d19meir1`,propsAsIs:!1,vars:{"d19meir1-0":[e=>e.targetY,`px`],"d19meir1-1":[e=>e.targetX,`px`],"d19meir1-2":[e=>e.targetWidth,`px`],"d19meir1-3":[e=>e.targetHeight,`px`],"d19meir1-4":[e=>e.targetY+10,`px`],"d19meir1-5":[e=>Math.max(0,(e.targetHeight-28)/2),`px`]}});function p(){let[e,t]=u.useState();return[e??void 0,t]}function m(){let[e,t]=p(),[n,r]=u.useState(0),[i,a]=u.useState(!0);return u.useLayoutEffect(()=>{if(e===void 0||!(`IntersectionObserver`in window))return;let t=new IntersectionObserver(e=>{e.length!==0&&a(e[0].isIntersecting)},{threshold:1});return t.observe(e),()=>t.disconnect()},[e]),u.useEffect(()=>{if(i||e===void 0)return;let t,n=()=>{let{right:i}=e.getBoundingClientRect();r(e=>Math.min(e+window.innerWidth-i-10,0)),t=requestAnimationFrame(n)};return t=requestAnimationFrame(n),()=>{t!==void 0&&cancelAnimationFrame(t)}},[e,i]),{ref:t,style:u.useMemo(()=>({transform:`translateX(${n}px)`}),[n])}}var h=t=>{let{target:n,content:r,onFinishEditing:l,forceEditMode:p,initialValue:h,imageEditorOverride:g,markdownDivCreateNode:_,highlight:v,className:y,theme:b,id:x,cell:S,bloom:C,validateCell:w,getCellRenderer:T,provideEditor:E,isOutsideClick:D}=t,[O,k]=u.useState(p?r:void 0),A=u.useRef(O??r);A.current=O??r;let[j,M]=u.useState(()=>w===void 0||!(e(r)&&w?.(S,r,A.current)===!1)),N=u.useCallback((e,t)=>{l(j?e:void 0,t)},[j,l]),P=u.useCallback(t=>{if(w!==void 0&&t!==void 0&&e(t)){let e=w(S,t,A.current);e===!1?M(!1):(typeof e==`object`&&(t=e),M(!0))}k(t)},[S,w]),F=u.useRef(!1),I=u.useRef(void 0),L=u.useCallback(()=>{N(O,[0,0]),F.current=!0},[O,N]),R=u.useCallback((e,t)=>{N(e,t??I.current??[0,0]),F.current=!0},[N]),z=u.useCallback(async e=>{let t=!1;e.key===`Escape`?(e.stopPropagation(),e.preventDefault(),I.current=[0,0]):e.key===`Enter`&&!e.shiftKey?(e.stopPropagation(),e.preventDefault(),I.current=[0,1],t=!0):e.key===`Tab`&&(e.stopPropagation(),e.preventDefault(),I.current=[e.shiftKey?-1:1,0],t=!0),window.setTimeout(()=>{!F.current&&I.current!==void 0&&(N(t?O:void 0,I.current),F.current=!0)},0)},[N,O]),B=O??r,[V,H]=u.useMemo(()=>{if(a(r))return[];let e=E?.(r);return e===void 0?[T(r)?.provideEditor?.(r),!1]:[e,!1]},[r,T,E]),{ref:U,style:W}=m(),G=!0,K,q=!0,J;if(V!==void 0){G=V.disablePadding!==!0,q=V.disableStyling!==!0;let t=s(V);t&&(J=V.styleOverride);let r=t?V.editor:V;K=u.createElement(r,{isHighlighted:v,onChange:P,value:B,initialValue:h,onFinishedEditing:R,validatedSelection:e(B)?B.selectionRange:void 0,forceEditMode:p,target:n,imageEditorOverride:g,markdownDivCreateNode:_,isValid:j,theme:b})}J={...J,...W};let Y=document.getElementById(`portal`);if(Y===null)return console.error('Cannot open Data Grid overlay editor, because portal not found. Please add `
` as the last child of your ``.'),null;let X=q?`gdg-style`:`gdg-unstyle`;j||(X+=` gdg-invalid`),G&&(X+=` gdg-pad`);let Z=C?.[0]??1,Q=C?.[1]??1;return(0,d.createPortal)(u.createElement(i.Provider,{value:b},u.createElement(c,{style:o(b),className:y,onClickOutside:L,isOutsideClick:D},u.createElement(f,{ref:U,id:x,className:X,style:J,as:H===!0?`label`:void 0,targetX:n.x-Z,targetY:n.y-Q,targetWidth:n.width+Z*2,targetHeight:n.height+Q*2},u.createElement(`div`,{className:`gdg-clip-region`,onKeyDown:z},K)))),Y)};export{h as default}; \ No newline at end of file diff --git a/app/dist/assets/index-AImdkJb1.css b/app/dist/assets/index-AImdkJb1.css new file mode 100644 index 00000000..dc63ed76 --- /dev/null +++ b/app/dist/assets/index-AImdkJb1.css @@ -0,0 +1,2 @@ +/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */ +@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-divide-y-reverse:0;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial}}}@layer theme{:root,:host{--font-sans:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-mono:ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;--color-amber-100:oklch(96.2% .059 95.617);--color-amber-400:oklch(82.8% .189 84.429);--color-amber-600:oklch(66.6% .179 58.318);--color-amber-700:oklch(55.5% .163 48.998);--color-sky-400:oklch(74.6% .16 232.661);--color-sky-600:oklch(58.8% .158 241.966);--spacing:.25rem;--container-sm:24rem;--container-md:28rem;--container-3xl:48rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--font-weight-medium:500;--font-weight-semibold:600;--tracking-tight:-.025em;--tracking-wide:.025em;--tracking-wider:.05em;--leading-relaxed:1.625;--radius-xl:.75rem;--animate-spin:spin 1s linear infinite;--blur-sm:8px;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;--color-background:hsl(var(--background));--color-foreground:hsl(var(--foreground));--color-muted-foreground:hsl(var(--muted-foreground));--breakpoint-fit:98.5rem}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring:where(:not(iframe)){outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab, currentcolor 50%, transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.pointer-events-none{pointer-events:none}.collapse{visibility:collapse}.invisible{visibility:hidden}.visible{visibility:visible}.sr-only{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.inset-0{inset:0}.inset-3{inset:calc(var(--spacing) * 3)}.inset-x-0{inset-inline:0}.top-0{top:0}.top-1{top:var(--spacing)}.top-1\/2{top:50%}.top-7{top:calc(var(--spacing) * 7)}.top-9{top:calc(var(--spacing) * 9)}.right-0{right:0}.right-1{right:var(--spacing)}.right-1\.5{right:calc(var(--spacing) * 1.5)}.bottom-full{bottom:100%}.left-0{left:0}.left-1\.5{left:calc(var(--spacing) * 1.5)}.z-10{z-index:10}.z-20{z-index:20}.z-30{z-index:30}.z-50{z-index:50}.row-0{grid-row:0}.row-10{grid-row:10}.row-59{grid-row:59}.row-60{grid-row:60}.container{width:100%}@media (width>=40rem){.container{max-width:40rem}}@media (width>=48rem){.container{max-width:48rem}}@media (width>=64rem){.container{max-width:64rem}}@media (width>=80rem){.container{max-width:80rem}}@media (width>=96rem){.container{max-width:96rem}}@media (width>=98.5rem){.container{max-width:98.5rem}}.mx-4{margin-inline:calc(var(--spacing) * 4)}.mt-0\.5{margin-top:calc(var(--spacing) * .5)}.mt-1\.5{margin-top:calc(var(--spacing) * 1.5)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-3{margin-top:calc(var(--spacing) * 3)}.mb-0\.5{margin-bottom:calc(var(--spacing) * .5)}.mb-1{margin-bottom:var(--spacing)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-3{margin-bottom:calc(var(--spacing) * 3)}.ml-1{margin-left:var(--spacing)}.ml-2{margin-left:calc(var(--spacing) * 2)}.ml-auto{margin-left:auto}.block{display:block}.contents{display:contents}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.table{display:table}.size-1\.5{width:calc(var(--spacing) * 1.5);height:calc(var(--spacing) * 1.5)}.size-3{width:calc(var(--spacing) * 3);height:calc(var(--spacing) * 3)}.size-3\.5{width:calc(var(--spacing) * 3.5);height:calc(var(--spacing) * 3.5)}.size-4{width:calc(var(--spacing) * 4);height:calc(var(--spacing) * 4)}.size-6{width:calc(var(--spacing) * 6);height:calc(var(--spacing) * 6)}.size-8{width:calc(var(--spacing) * 8);height:calc(var(--spacing) * 8)}.size-9{width:calc(var(--spacing) * 9);height:calc(var(--spacing) * 9)}.h-4{height:calc(var(--spacing) * 4)}.h-5{height:calc(var(--spacing) * 5)}.h-6{height:calc(var(--spacing) * 6)}.h-7{height:calc(var(--spacing) * 7)}.h-8{height:calc(var(--spacing) * 8)}.h-9{height:calc(var(--spacing) * 9)}.h-14{height:calc(var(--spacing) * 14)}.h-\[18px\]{height:18px}.h-\[var\(--split\)\]{height:var(--split)}.h-svh{height:100svh}.max-h-56{max-height:calc(var(--spacing) * 56)}.max-h-96{max-height:calc(var(--spacing) * 96)}.min-h-0{min-height:0}.min-h-11{min-height:calc(var(--spacing) * 11)}.min-h-12{min-height:calc(var(--spacing) * 12)}.min-h-\[42px\]{min-height:42px}.min-h-svh{min-height:100svh}.w-3{width:calc(var(--spacing) * 3)}.w-4{width:calc(var(--spacing) * 4)}.w-7{width:calc(var(--spacing) * 7)}.w-8{width:calc(var(--spacing) * 8)}.w-72{width:calc(var(--spacing) * 72)}.w-80{width:calc(var(--spacing) * 80)}.w-full{width:100%}.w-px{width:1px}.max-w-3xl{max-width:var(--container-3xl)}.max-w-44{max-width:calc(var(--spacing) * 44)}.max-w-64{max-width:calc(var(--spacing) * 64)}.max-w-\[36ch\]{max-width:36ch}.max-w-md{max-width:var(--container-md)}.max-w-sm{max-width:var(--container-sm)}.min-w-0{min-width:0}.min-w-32{min-width:calc(var(--spacing) * 32)}.min-w-44{min-width:calc(var(--spacing) * 44)}.flex-1{flex:1}.flex-none{flex:none}.flex-shrink-0{flex-shrink:0}.shrink{flex-shrink:1}.shrink-0{flex-shrink:0}.grow{flex-grow:1}.translate-x-\[2px\]{--tw-translate-x:2px;translate:var(--tw-translate-x) var(--tw-translate-y)}.translate-x-\[15px\]{--tw-translate-x:15px;translate:var(--tw-translate-x) var(--tw-translate-y)}.-translate-y-1\/2{--tw-translate-y:calc(calc(1 / 2 * 100%) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.rotate-180{rotate:180deg}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.animate-spin{animation:var(--animate-spin)}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.cursor-row-resize{cursor:row-resize}.resize{resize:both}.resize-none{resize:none}.appearance-none{appearance:none}.flex-col{flex-direction:column}.flex-row{flex-direction:row}.flex-wrap{flex-wrap:wrap}.items-baseline{align-items:baseline}.items-center{align-items:center}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-0\.5{gap:calc(var(--spacing) * .5)}.gap-1{gap:var(--spacing)}.gap-1\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-2\.5{gap:calc(var(--spacing) * 2.5)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-5{gap:calc(var(--spacing) * 5)}.gap-x-2{column-gap:calc(var(--spacing) * 2)}.gap-x-3{column-gap:calc(var(--spacing) * 3)}.gap-x-4{column-gap:calc(var(--spacing) * 4)}.gap-y-1\.5{row-gap:calc(var(--spacing) * 1.5)}.gap-y-2\.5{row-gap:calc(var(--spacing) * 2.5)}:where(.divide-y>:not(:last-child)){--tw-divide-y-reverse:0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(1px * var(--tw-divide-y-reverse));border-bottom-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)))}:where(.divide-border>:not(:last-child)){border-color:hsl(var(--border))}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-\[7px\]{border-radius:7px}.rounded-full{border-radius:2147483647px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.rounded-xl{border-radius:var(--radius-xl)}.border{border-style:var(--tw-border-style);border-width:1px}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.border-border{border-color:hsl(var(--border))}.border-foreground,.border-foreground\/30{border-color:hsl(var(--foreground))}@supports (color:color-mix(in lab, red, red)){.border-foreground\/30{border-color:color-mix(in oklab, hsl(var(--foreground)) 30%, transparent)}}.border-primary,.border-primary\/50{border-color:hsl(var(--primary))}@supports (color:color-mix(in lab, red, red)){.border-primary\/50{border-color:color-mix(in oklab, hsl(var(--primary)) 50%, transparent)}}.border-ring{border-color:hsl(var(--ring))}.bg-amber-100{background-color:var(--color-amber-100)}.bg-background,.bg-background\/80{background-color:hsl(var(--background))}@supports (color:color-mix(in lab, red, red)){.bg-background\/80{background-color:color-mix(in oklab, hsl(var(--background)) 80%, transparent)}}.bg-border{background-color:hsl(var(--border))}.bg-foreground{background-color:hsl(var(--foreground))}.bg-muted,.bg-muted\/20{background-color:hsl(var(--muted))}@supports (color:color-mix(in lab, red, red)){.bg-muted\/20{background-color:color-mix(in oklab, hsl(var(--muted)) 20%, transparent)}}.bg-muted\/30{background-color:hsl(var(--muted))}@supports (color:color-mix(in lab, red, red)){.bg-muted\/30{background-color:color-mix(in oklab, hsl(var(--muted)) 30%, transparent)}}.bg-muted\/40{background-color:hsl(var(--muted))}@supports (color:color-mix(in lab, red, red)){.bg-muted\/40{background-color:color-mix(in oklab, hsl(var(--muted)) 40%, transparent)}}.bg-muted\/50{background-color:hsl(var(--muted))}@supports (color:color-mix(in lab, red, red)){.bg-muted\/50{background-color:color-mix(in oklab, hsl(var(--muted)) 50%, transparent)}}.bg-muted\/60{background-color:hsl(var(--muted))}@supports (color:color-mix(in lab, red, red)){.bg-muted\/60{background-color:color-mix(in oklab, hsl(var(--muted)) 60%, transparent)}}.bg-panel{background-color:hsl(var(--panel))}.bg-primary{background-color:hsl(var(--primary))}.bg-secondary{background-color:hsl(var(--secondary))}.bg-transparent{background-color:#0000}.p-0\.5{padding:calc(var(--spacing) * .5)}.p-1\.5{padding:calc(var(--spacing) * 1.5)}.p-3{padding:calc(var(--spacing) * 3)}.p-6{padding:calc(var(--spacing) * 6)}.px-1{padding-inline:var(--spacing)}.px-1\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-2\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-3\.5{padding-inline:calc(var(--spacing) * 3.5)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-5{padding-inline:calc(var(--spacing) * 5)}.py-0{padding-block:0}.py-0\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:var(--spacing)}.py-1\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-2\.5{padding-block:calc(var(--spacing) * 2.5)}.py-4{padding-block:calc(var(--spacing) * 4)}.py-6{padding-block:calc(var(--spacing) * 6)}.py-px{padding-block:1px}.pr-1\.5{padding-right:calc(var(--spacing) * 1.5)}.pr-6{padding-right:calc(var(--spacing) * 6)}.pb-1{padding-bottom:var(--spacing)}.pb-2{padding-bottom:calc(var(--spacing) * 2)}.pb-4{padding-bottom:calc(var(--spacing) * 4)}.pl-2\.5{padding-left:calc(var(--spacing) * 2.5)}.pl-3{padding-left:calc(var(--spacing) * 3)}.pl-6{padding-left:calc(var(--spacing) * 6)}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.font-mono{font-family:ui-monospace,SF Mono,SFMono-Regular,Menlo,Consolas,Liberation Mono,monospace}.font-sans{font-family:var(--font-sans)}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\[9px\]{font-size:9px}.text-\[10px\]{font-size:10px}.text-\[11\.5px\]{font-size:11.5px}.text-\[11px\]{font-size:11px}.text-\[12\.5px\]{font-size:12.5px}.text-\[13px\]{font-size:13px}.text-\[15px\]{font-size:15px}.leading-6{--tw-leading:calc(var(--spacing) * 6);line-height:calc(var(--spacing) * 6)}.leading-none{--tw-leading:1;line-height:1}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-\[0\.1em\]{--tw-tracking:.1em;letter-spacing:.1em}.tracking-\[0\.08em\]{--tw-tracking:.08em;letter-spacing:.08em}.tracking-\[0\.14em\]{--tw-tracking:.14em;letter-spacing:.14em}.tracking-\[0\.18em\]{--tw-tracking:.18em;letter-spacing:.18em}.tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.tracking-wider{--tw-tracking:var(--tracking-wider);letter-spacing:var(--tracking-wider)}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-line{white-space:pre-line}.text-amber-600{color:var(--color-amber-600)}.text-amber-700{color:var(--color-amber-700)}.text-background{color:hsl(var(--background))}.text-destructive{color:hsl(var(--destructive))}.text-foreground{color:hsl(var(--foreground))}.text-muted-foreground,.text-muted-foreground\/60{color:hsl(var(--muted-foreground))}@supports (color:color-mix(in lab, red, red)){.text-muted-foreground\/60{color:color-mix(in oklab, hsl(var(--muted-foreground)) 60%, transparent)}}.text-muted-foreground\/70{color:hsl(var(--muted-foreground))}@supports (color:color-mix(in lab, red, red)){.text-muted-foreground\/70{color:color-mix(in oklab, hsl(var(--muted-foreground)) 70%, transparent)}}.text-panel{color:hsl(var(--panel))}.lowercase{text-transform:lowercase}.uppercase{text-transform:uppercase}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.underline{text-decoration-line:underline}.decoration-border{-webkit-text-decoration-color:hsl(var(--border));-webkit-text-decoration-color:hsl(var(--border));-webkit-text-decoration-color:hsl(var(--border));text-decoration-color:hsl(var(--border))}.underline-offset-2{text-underline-offset:2px}.accent-foreground{accent-color:hsl(var(--foreground))}.opacity-60{opacity:.6}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-2xs{--tw-shadow:0 1px var(--tw-shadow-color,#0000000d);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a), 0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.ring-1{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.ring-2{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.ring-foreground\/15{--tw-ring-color:hsl(var(--foreground))}@supports (color:color-mix(in lab, red, red)){.ring-foreground\/15{--tw-ring-color:color-mix(in oklab, hsl(var(--foreground)) 15%, transparent)}}.ring-ring\/50{--tw-ring-color:hsl(var(--ring))}@supports (color:color-mix(in lab, red, red)){.ring-ring\/50{--tw-ring-color:color-mix(in oklab, hsl(var(--ring)) 50%, transparent)}}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.blur{--tw-blur:blur(8px);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.backdrop-blur-sm{--tw-backdrop-blur:blur(var(--blur-sm));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-300{--tw-duration:.3s;transition-duration:.3s}.outline-none{--tw-outline-style:none;outline-style:none}.select-none{-webkit-user-select:none;user-select:none}.placeholder\:font-sans::placeholder{font-family:var(--font-sans)}.placeholder\:text-xs::placeholder{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.placeholder\:text-muted-foreground::placeholder,.placeholder\:text-muted-foreground\/50::placeholder{color:hsl(var(--muted-foreground))}@supports (color:color-mix(in lab, red, red)){.placeholder\:text-muted-foreground\/50::placeholder{color:color-mix(in oklab, hsl(var(--muted-foreground)) 50%, transparent)}}.placeholder\:text-muted-foreground\/60::placeholder{color:hsl(var(--muted-foreground))}@supports (color:color-mix(in lab, red, red)){.placeholder\:text-muted-foreground\/60::placeholder{color:color-mix(in oklab, hsl(var(--muted-foreground)) 60%, transparent)}}.last\:mb-0:last-child{margin-bottom:0}@media (hover:hover){.hover\:border-foreground:hover{border-color:hsl(var(--foreground))}.hover\:border-muted-foreground\/50:hover{border-color:hsl(var(--muted-foreground))}@supports (color:color-mix(in lab, red, red)){.hover\:border-muted-foreground\/50:hover{border-color:color-mix(in oklab, hsl(var(--muted-foreground)) 50%, transparent)}}.hover\:bg-foreground\/90:hover{background-color:hsl(var(--foreground))}@supports (color:color-mix(in lab, red, red)){.hover\:bg-foreground\/90:hover{background-color:color-mix(in oklab, hsl(var(--foreground)) 90%, transparent)}}.hover\:bg-muted:hover,.hover\:bg-muted\/50:hover{background-color:hsl(var(--muted))}@supports (color:color-mix(in lab, red, red)){.hover\:bg-muted\/50:hover{background-color:color-mix(in oklab, hsl(var(--muted)) 50%, transparent)}}.hover\:text-foreground:hover{color:hsl(var(--foreground))}.hover\:decoration-foreground:hover{-webkit-text-decoration-color:hsl(var(--foreground));-webkit-text-decoration-color:hsl(var(--foreground));-webkit-text-decoration-color:hsl(var(--foreground));text-decoration-color:hsl(var(--foreground))}}.focus\:outline-none:focus{--tw-outline-style:none;outline-style:none}.focus-visible\:border-sky-600:focus-visible{border-color:var(--color-sky-600)}.focus-visible\:ring-2:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.focus-visible\:ring-3:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.focus-visible\:ring-ring\/50:focus-visible{--tw-ring-color:hsl(var(--ring))}@supports (color:color-mix(in lab, red, red)){.focus-visible\:ring-ring\/50:focus-visible{--tw-ring-color:color-mix(in oklab, hsl(var(--ring)) 50%, transparent)}}.focus-visible\:outline-2:focus-visible{outline-style:var(--tw-outline-style);outline-width:2px}.focus-visible\:outline-offset-1:focus-visible{outline-offset:1px}.focus-visible\:outline-offset-2:focus-visible{outline-offset:2px}.focus-visible\:outline-ring:focus-visible{outline-color:hsl(var(--ring))}.focus-visible\:outline-none:focus-visible{--tw-outline-style:none;outline-style:none}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-50:disabled{opacity:.5}@media not all and (width>=48rem){.max-md\:max-h-\[340px\]{max-height:340px}.max-md\:max-h-\[360px\]{max-height:360px}.max-md\:min-h-\[240px\]{min-height:240px}.max-md\:min-h-\[280px\]{min-height:280px}.max-md\:gap-1{gap:var(--spacing)}.max-md\:gap-2{gap:calc(var(--spacing) * 2)}}@media not all and (width>=40rem){.max-sm\:static{position:static}.max-sm\:inset-x-2{inset-inline:calc(var(--spacing) * 2)}.max-sm\:top-14{top:calc(var(--spacing) * 14)}.max-sm\:w-auto{width:auto}}@media (width>=40rem){.sm\:inline{display:inline}.sm\:max-w-64{max-width:calc(var(--spacing) * 64)}.sm\:max-w-none{max-width:none}.sm\:px-2{padding-inline:calc(var(--spacing) * 2)}.sm\:px-4{padding-inline:calc(var(--spacing) * 4)}.sm\:py-1{padding-block:var(--spacing)}.sm\:text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}}@media (width>=48rem){.md\:absolute{position:absolute}.md\:inset-auto{inset:auto}.md\:top-0{top:0}.md\:top-1\/2{top:50%}.md\:right-auto{right:auto}.md\:bottom-0{bottom:0}.md\:-left-1\.5{left:calc(var(--spacing) * -1.5)}.md\:left-1\/2{left:50%}.md\:left-\[var\(--split\)\]{left:var(--split)}.md\:block{display:block}.md\:hidden{display:none}.md\:size-5{width:calc(var(--spacing) * 5);height:calc(var(--spacing) * 5)}.md\:size-11{width:calc(var(--spacing) * 11);height:calc(var(--spacing) * 11)}.md\:h-8{height:calc(var(--spacing) * 8)}.md\:h-12{height:calc(var(--spacing) * 12)}.md\:h-auto{height:auto}.md\:h-svh{height:100svh}.md\:min-h-0{min-height:0}.md\:min-h-12{min-height:calc(var(--spacing) * 12)}.md\:w-0{width:0}.md\:w-3{width:calc(var(--spacing) * 3)}.md\:w-\[var\(--split\)\]{width:var(--split)}.md\:-translate-x-1\/2{--tw-translate-x:calc(calc(1 / 2 * 100%) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.md\:-translate-y-1\/2{--tw-translate-y:calc(calc(1 / 2 * 100%) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.md\:cursor-col-resize{cursor:col-resize}.md\:flex-row{flex-direction:row}.md\:gap-1{gap:var(--spacing)}.md\:gap-3{gap:calc(var(--spacing) * 3)}.md\:border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.md\:border-b-0{border-bottom-style:var(--tw-border-style);border-bottom-width:0}.md\:bg-transparent{background-color:#0000}.md\:p-6{padding:calc(var(--spacing) * 6)}.md\:px-2\.5{padding-inline:calc(var(--spacing) * 2.5)}.md\:px-4{padding-inline:calc(var(--spacing) * 4)}.md\:px-16{padding-inline:calc(var(--spacing) * 16)}.md\:py-1\.5{padding-block:calc(var(--spacing) * 1.5)}.md\:pr-2\.5{padding-right:calc(var(--spacing) * 2.5)}.md\:pl-3\.5{padding-left:calc(var(--spacing) * 3.5)}.md\:text-\[11px\]{font-size:11px}}@media (width>=64rem){.lg\:inline{display:inline}.lg\:gap-3{gap:calc(var(--spacing) * 3)}.lg\:gap-x-3{column-gap:calc(var(--spacing) * 3)}.lg\:px-2\.5{padding-inline:calc(var(--spacing) * 2.5)}.lg\:pr-3{padding-right:calc(var(--spacing) * 3)}.lg\:pl-5{padding-left:calc(var(--spacing) * 5)}}@media (width>=80rem){.xl\:block{display:block}.xl\:inline{display:inline}}@media (width>=98.5rem){.fit\:block{display:block}}.dark\:bg-amber-400\/15:is(.dark *){background-color:#fcbb0026}@supports (color:color-mix(in lab, red, red)){.dark\:bg-amber-400\/15:is(.dark *){background-color:color-mix(in oklab, var(--color-amber-400) 15%, transparent)}}.dark\:text-amber-400:is(.dark *){color:var(--color-amber-400)}.dark\:focus-visible\:border-sky-400:is(.dark *):focus-visible{border-color:var(--color-sky-400)}.\[\&_svg\]\:size-3\.5 svg{width:calc(var(--spacing) * 3.5);height:calc(var(--spacing) * 3.5)}}:root{--panel:0 0% 100%;--background:0 0% 100%;--foreground:240 10% 3.9%;--muted:240 4.8% 95.9%;--muted-foreground:240 3.8% 46.1%;--border:240 5.9% 90%;--primary:240 5.9% 10%;--primary-foreground:0 0% 98%;--secondary:240 4.8% 95.9%;--secondary-foreground:240 5.9% 10%;--accent:240 4.8% 95.9%;--accent-foreground:240 5.9% 10%;--destructive:0 84.2% 60.2%;--destructive-foreground:0 0% 98%;--ring:240 5% 64.9%;--radius:.625rem}.dark{--background:240 10% 3.9%;--panel:240 6% 7%;--foreground:0 0% 98%;--muted:240 3.7% 15.9%;--muted-foreground:240 5% 64.9%;--border:240 3.7% 15.9%;--primary:0 0% 98%;--primary-foreground:240 5.9% 10%;--secondary:240 3.7% 15.9%;--secondary-foreground:0 0% 98%;--destructive:0 62.8% 30.6%;--destructive-foreground:0 0% 98%;--ring:240 4.9% 83.9%}body{background-color:var(--color-background);color:var(--color-foreground)}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-divide-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@keyframes spin{to{transform:rotate(360deg)}}.gdg-mnuv029{word-break:break-word;-webkit-touch-callout:default;padding-top:6px}.gdg-mnuv029>*{margin:0}.gdg-mnuv029 :last-child{margin-bottom:0}.gdg-mnuv029 p img{width:100%}.gdg-d19meir1{box-sizing:border-box;--overlay-top:var(--d19meir1-0);left:var(--d19meir1-1);top:var(--d19meir1-0);min-width:var(--d19meir1-2);min-height:var(--d19meir1-3);width:max-content;max-width:400px;max-height:calc(100vh - var(--d19meir1-4));font-family:var(--gdg-font-family);font-size:var(--gdg-editor-font-size);text-align:start;flex-direction:column;display:flex;position:absolute;overflow:hidden}@keyframes glide_fade_in-gdg-d19meir1{0%{opacity:0}to{opacity:1}}.gdg-d19meir1.gdg-style{background-color:var(--gdg-bg-cell);box-shadow:0 0 0 1px var(--gdg-accent-color), 0px 0px 1px #3e415666, 0px 6px 12px #3e415626;border-radius:2px;animation:60ms glide_fade_in-gdg-d19meir1}.gdg-d19meir1.gdg-pad{padding:var(--d19meir1-5) 8.5px 3px}.gdg-d19meir1 .gdg-clip-region{border-radius:2px;flex-direction:column;flex-grow:1;display:flex;overflow:hidden auto}.gdg-d19meir1 .gdg-clip-region .gdg-growing-entry{height:100%}.gdg-d19meir1 .gdg-clip-region input.gdg-input{border:0;outline:none;width:100%}.gdg-d19meir1 .gdg-clip-region textarea.gdg-input{border:0;outline:none}.gdg-b1ygi5by{flex-wrap:wrap;margin-top:auto;margin-bottom:auto;display:flex}.gdg-b1ygi5by .boe-bubble{border-radius:var(--gdg-rounding-radius,10px);background-color:var(--gdg-bg-bubble);height:20px;color:var(--gdg-text-dark);justify-content:center;align-items:center;margin:2px;padding:0 8px;display:flex}.gdg-b1ygi5by textarea{opacity:0;width:0;height:0;position:absolute;top:0;left:0}.gdg-n15fjm3e{color:var(--gdg-text-dark);margin:6px 0 3px;display:flex}.gdg-n15fjm3e>input{font-size:var(--gdg-editor-font-size);font-family:var(--gdg-font-family);color:var(--gdg-text-dark);background-color:var(--gdg-bg-cell);padding:0}.gdg-d4zsq0x{flex-wrap:wrap;display:flex}.gdg-d4zsq0x .doe-bubble{background-color:var(--gdg-bg-cell);height:24px;color:var(--gdg-text-dark);border-radius:var(--gdg-rounding-radius,6px);justify-content:center;align-items:center;margin:2px;padding:0 8px;display:flex;box-shadow:0 0 1px #3e415666,0 1px 3px #3e415666}.gdg-d4zsq0x .doe-bubble img{object-fit:contain;height:16px;margin-right:4px}.gdg-d4zsq0x textarea{opacity:0;width:0;height:0;position:absolute;top:0;left:0}.gdg-i2iowwq{height:100%;display:flex}.gdg-i2iowwq .gdg-centering-container{justify-content:center;align-items:center;height:100%;display:flex}.gdg-i2iowwq .gdg-centering-container img,.gdg-i2iowwq .gdg-centering-container canvas{max-height:calc(100vh - var(--overlay-top) - 20px);object-fit:contain;-webkit-user-select:none;user-select:none}.gdg-i2iowwq .gdg-centering-container canvas{max-width:380px}.gdg-i2iowwq .gdg-edit-icon{width:48px;height:48px;color:var(--gdg-accent-color);cursor:pointer;justify-content:center;align-items:center;display:flex;position:absolute;top:12px;right:0}.gdg-i2iowwq .gdg-edit-icon>*{width:24px;height:24px}.gdg-i2iowwq textarea{opacity:0;width:0;height:0;position:absolute;top:0;left:0}.gdg-u1rrojo{flex-grow:1;align-items:center;min-height:21px;display:flex}.gdg-u1rrojo .gdg-link-area{cursor:pointer;text-overflow:ellipsis;white-space:nowrap;color:var(--gdg-link-color);flex-grow:1;flex-shrink:1;margin-right:8px;overflow:hidden;-webkit-text-decoration:underline!important;text-decoration:underline!important}.gdg-u1rrojo .gdg-edit-icon{width:32px;color:var(--gdg-accent-color);cursor:pointer;flex-shrink:0;justify-content:center;align-items:center;display:flex}.gdg-u1rrojo .gdg-edit-icon>*{width:24px;height:24px}.gdg-u1rrojo textarea{opacity:0;width:0;height:0;position:absolute;top:0;left:0}.gdg-m1pnx84e{min-width:var(--m1pnx84e-0);-webkit-align-items:flex-start;-webkit-box-align:flex-start;-ms-flex-align:flex-start;width:100%;color:var(--gdg-text-dark);justify-content:space-between;align-items:flex-start;display:flex;position:relative}.gdg-m1pnx84e .gdg-g1y0xocz{flex-shrink:1;min-width:0}.gdg-m1pnx84e .gdg-spacer{flex:1}.gdg-m1pnx84e .gdg-edit-icon{cursor:pointer;color:var(--gdg-accent-color);width:24px;height:24px;-webkit-transition:all "0.125s ease";transition:all "0.125s ease";border-radius:6px;flex-shrink:0;justify-content:center;align-items:center;padding:0;display:flex;position:relative}.gdg-m1pnx84e .gdg-edit-icon>*{width:16px;height:16px}.gdg-m1pnx84e .gdg-edit-hover:hover{background-color:var(--gdg-accent-light);transition:background-color .15s}.gdg-m1pnx84e .gdg-checkmark-hover:hover{color:#fff;background-color:var(--gdg-accent-color)}.gdg-m1pnx84e .gdg-md-edit-textarea{opacity:0;width:0;height:0;margin-top:25px;padding:0;position:relative;top:0;left:0}.gdg-m1pnx84e .gdg-ml-6{margin-left:6px}.gdg-s1dgczr6 .dvn-scroller{overflow:var(--s1dgczr6-0);transform:translate(0,0)}.gdg-s1dgczr6 .dvn-hidden{visibility:hidden}.gdg-s1dgczr6 .dvn-scroll-inner{pointer-events:none;display:flex}.gdg-s1dgczr6 .dvn-scroll-inner>*{flex-shrink:0}.gdg-s1dgczr6 .dvn-scroll-inner .dvn-spacer{flex-grow:1}.gdg-s1dgczr6 .dvn-scroll-inner .dvn-stack{flex-direction:column;display:flex}.gdg-s1dgczr6 .dvn-underlay>*{position:absolute;top:0;left:0}.gdg-s1dgczr6 canvas{outline:none}.gdg-s1dgczr6 canvas *{height:0}.gdg-izpuzkl{resize:none;white-space:pre-wrap;width:100%;min-width:100%;height:100%;font-size:var(--gdg-editor-font-size);line-height:16px;font-family:var(--gdg-font-family);-webkit-text-fill-color:var(--gdg-text-dark);color:var(--gdg-text-dark);background-color:#0000;border:0;border-radius:0;margin:0;padding:0;position:absolute;inset:0;overflow:hidden}.gdg-izpuzkl::-webkit-input-placeholder{color:var(--gdg-text-light)}.gdg-izpuzkl::placeholder{color:var(--gdg-text-light)}.gdg-izpuzkl:-ms-placeholder-shown{color:var(--gdg-text-light)}.gdg-izpuzkl::placeholder{color:var(--gdg-text-light)}.gdg-invalid .gdg-izpuzkl{-webkit-text-decoration:underline #d60606;text-decoration:underline #d60606}.gdg-s69h75o{visibility:hidden;white-space:pre-wrap;word-wrap:break-word;width:max-content;min-width:100%;max-width:100%;font-size:var(--gdg-editor-font-size);line-height:16px;font-family:var(--gdg-font-family);color:var(--gdg-text-dark);margin:0;padding:0 0 2px}.gdg-g1y0xocz{margin-top:6px;position:relative}.gdg-seveqep{background-color:var(--gdg-bg-cell);color:var(--gdg-text-dark);border:1px solid var(--gdg-border-color);font-size:var(--gdg-editor-font-size);border-radius:6px;padding:8px;animation:.15s forwards gdg-search-fadein-gdg-seveqep;position:absolute;top:4px;right:20px}.gdg-seveqep.out{animation:.15s forwards gdg-search-fadeout-gdg-seveqep}.gdg-seveqep .gdg-search-bar-inner{display:flex}.gdg-seveqep .gdg-search-status{padding-top:4px;font-size:11px}.gdg-seveqep .gdg-search-progress{background-color:var(--gdg-text-light);height:4px;position:absolute;bottom:0;left:0}.gdg-seveqep input{width:220px;color:var(--gdg-textDark);background-color:var(--gdg-bg-cell);border:0;outline:none}.gdg-seveqep button{cursor:pointer;width:24px;height:24px;color:var(--gdg-text-medium);background:0 0;border:none;outline:none;justify-content:center;align-items:center;padding:0;display:flex}.gdg-seveqep button:hover{color:var(--gdg-text-dark)}.gdg-seveqep button .button-icon{width:16px;height:16px}.gdg-seveqep button:disabled{opacity:.4;pointer-events:none}@keyframes gdg-search-fadeout-gdg-seveqep{0%{transform:translate(0)}to{transform:translate(400px)}}@keyframes gdg-search-fadein-gdg-seveqep{0%{transform:translate(400px)}to{transform:translate(0)}}.gdg-wmyidgi{min-width:10px;max-width:100%;min-height:10px;max-height:100%;width:var(--wmyidgi-0);height:var(--wmyidgi-1);direction:ltr;position:relative;overflow:clip}.gdg-wmyidgi>:first-child{width:100%;height:100%;position:absolute;top:0;left:0}.gdg-r17m35ur{background-color:var(--gdg-bg-header-has-focus);box-shadow:0 0 0 1px var(--gdg-border-color);color:var(--gdg-text-group-header);min-height:var(--r17m35ur-0);font:var(--gdg-header-font-style) var(--gdg-font-family);border:none;border-radius:9px;outline:none;flex-grow:1;padding:0 8px}.gdg-c1tqibwd{background-color:var(--gdg-bg-header);align-items:center;padding:0 8px;display:flex} diff --git a/app/dist/assets/index-CzkemFdc.css b/app/dist/assets/index-CzkemFdc.css deleted file mode 100644 index 1b70feb2..00000000 --- a/app/dist/assets/index-CzkemFdc.css +++ /dev/null @@ -1 +0,0 @@ -/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-divide-y-reverse:0;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial}}}@layer theme{:root,:host{--font-sans:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-mono:ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;--color-amber-100:oklch(96.2% .059 95.617);--color-amber-400:oklch(82.8% .189 84.429);--color-amber-600:oklch(66.6% .179 58.318);--color-amber-700:oklch(55.5% .163 48.998);--color-sky-400:oklch(74.6% .16 232.661);--color-sky-600:oklch(58.8% .158 241.966);--spacing:.25rem;--container-sm:24rem;--container-md:28rem;--container-3xl:48rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--font-weight-medium:500;--font-weight-semibold:600;--tracking-tight:-.025em;--tracking-wide:.025em;--tracking-wider:.05em;--leading-relaxed:1.625;--radius-xl:.75rem;--animate-spin:spin 1s linear infinite;--blur-sm:8px;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;--color-background:hsl(var(--background));--color-foreground:hsl(var(--foreground));--color-muted-foreground:hsl(var(--muted-foreground));--breakpoint-fit:98.5rem}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;line-height:1.5;font-family:var(--default-font-family,-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring:where(:not(iframe)){outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){-webkit-appearance:button;-moz-appearance:button;appearance:button}::file-selector-button{-webkit-appearance:button;-moz-appearance:button;appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.pointer-events-none{pointer-events:none}.collapse{visibility:collapse}.invisible{visibility:hidden}.visible{visibility:visible}.sr-only{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.inset-0{top:0;right:0;bottom:0;left:0}.inset-3{inset:calc(var(--spacing) * 3)}.inset-x-0{inset-inline:0}.top-0{top:0}.top-1{top:var(--spacing)}.top-1\/2{top:50%}.top-7{top:calc(var(--spacing) * 7)}.top-9{top:calc(var(--spacing) * 9)}.right-0{right:0}.right-1{right:var(--spacing)}.right-1\.5{right:calc(var(--spacing) * 1.5)}.bottom-full{bottom:100%}.left-0{left:0}.left-1\.5{left:calc(var(--spacing) * 1.5)}.z-10{z-index:10}.z-20{z-index:20}.z-30{z-index:30}.z-50{z-index:50}.row-0{grid-row:0}.row-10{grid-row:10}.row-59{grid-row:59}.row-60{grid-row:60}.container{width:100%}@media (min-width:40rem){.container{max-width:40rem}}@media (min-width:48rem){.container{max-width:48rem}}@media (min-width:64rem){.container{max-width:64rem}}@media (min-width:80rem){.container{max-width:80rem}}@media (min-width:96rem){.container{max-width:96rem}}@media (min-width:98.5rem){.container{max-width:98.5rem}}.mx-4{margin-inline:calc(var(--spacing) * 4)}.mt-0\.5{margin-top:calc(var(--spacing) * .5)}.mt-1\.5{margin-top:calc(var(--spacing) * 1.5)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-3{margin-top:calc(var(--spacing) * 3)}.mb-0\.5{margin-bottom:calc(var(--spacing) * .5)}.mb-1{margin-bottom:var(--spacing)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-3{margin-bottom:calc(var(--spacing) * 3)}.ml-1{margin-left:var(--spacing)}.ml-2{margin-left:calc(var(--spacing) * 2)}.ml-auto{margin-left:auto}.block{display:block}.contents{display:contents}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.table{display:table}.size-1\.5{width:calc(var(--spacing) * 1.5);height:calc(var(--spacing) * 1.5)}.size-3{width:calc(var(--spacing) * 3);height:calc(var(--spacing) * 3)}.size-3\.5{width:calc(var(--spacing) * 3.5);height:calc(var(--spacing) * 3.5)}.size-4{width:calc(var(--spacing) * 4);height:calc(var(--spacing) * 4)}.size-6{width:calc(var(--spacing) * 6);height:calc(var(--spacing) * 6)}.size-8{width:calc(var(--spacing) * 8);height:calc(var(--spacing) * 8)}.size-9{width:calc(var(--spacing) * 9);height:calc(var(--spacing) * 9)}.h-4{height:calc(var(--spacing) * 4)}.h-5{height:calc(var(--spacing) * 5)}.h-6{height:calc(var(--spacing) * 6)}.h-7{height:calc(var(--spacing) * 7)}.h-8{height:calc(var(--spacing) * 8)}.h-9{height:calc(var(--spacing) * 9)}.h-14{height:calc(var(--spacing) * 14)}.h-\[18px\]{height:18px}.h-\[var\(--split\)\]{height:var(--split)}.h-svh{height:100svh}.max-h-56{max-height:calc(var(--spacing) * 56)}.max-h-96{max-height:calc(var(--spacing) * 96)}.min-h-0{min-height:0}.min-h-11{min-height:calc(var(--spacing) * 11)}.min-h-12{min-height:calc(var(--spacing) * 12)}.min-h-\[42px\]{min-height:42px}.min-h-svh{min-height:100svh}.w-3{width:calc(var(--spacing) * 3)}.w-4{width:calc(var(--spacing) * 4)}.w-7{width:calc(var(--spacing) * 7)}.w-8{width:calc(var(--spacing) * 8)}.w-72{width:calc(var(--spacing) * 72)}.w-80{width:calc(var(--spacing) * 80)}.w-full{width:100%}.w-px{width:1px}.max-w-3xl{max-width:var(--container-3xl)}.max-w-44{max-width:calc(var(--spacing) * 44)}.max-w-64{max-width:calc(var(--spacing) * 64)}.max-w-\[36ch\]{max-width:36ch}.max-w-md{max-width:var(--container-md)}.max-w-sm{max-width:var(--container-sm)}.min-w-0{min-width:0}.min-w-32{min-width:calc(var(--spacing) * 32)}.min-w-44{min-width:calc(var(--spacing) * 44)}.flex-1{flex:1}.flex-none{flex:none}.flex-shrink-0{flex-shrink:0}.shrink{flex-shrink:1}.shrink-0{flex-shrink:0}.grow{flex-grow:1}.translate-x-\[2px\]{--tw-translate-x:2px;translate:var(--tw-translate-x) var(--tw-translate-y)}.translate-x-\[15px\]{--tw-translate-x:15px;translate:var(--tw-translate-x) var(--tw-translate-y)}.-translate-y-1\/2{--tw-translate-y: -50% ;translate:var(--tw-translate-x) var(--tw-translate-y)}.rotate-180{rotate:180deg}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.animate-spin{animation:var(--animate-spin)}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.cursor-row-resize{cursor:row-resize}.resize{resize:both}.resize-none{resize:none}.appearance-none{-webkit-appearance:none;-moz-appearance:none;appearance:none}.flex-col{flex-direction:column}.flex-row{flex-direction:row}.flex-wrap{flex-wrap:wrap}.items-baseline{align-items:baseline}.items-center{align-items:center}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-0\.5{gap:calc(var(--spacing) * .5)}.gap-1{gap:var(--spacing)}.gap-1\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-2\.5{gap:calc(var(--spacing) * 2.5)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-5{gap:calc(var(--spacing) * 5)}.gap-x-2{column-gap:calc(var(--spacing) * 2)}.gap-x-3{column-gap:calc(var(--spacing) * 3)}.gap-x-4{column-gap:calc(var(--spacing) * 4)}.gap-y-1\.5{row-gap:calc(var(--spacing) * 1.5)}.gap-y-2\.5{row-gap:calc(var(--spacing) * 2.5)}:where(.divide-y>:not(:last-child)){--tw-divide-y-reverse:0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(1px * var(--tw-divide-y-reverse));border-bottom-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)))}:where(.divide-border>:not(:last-child)){border-color:hsl(var(--border))}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-\[7px\]{border-radius:7px}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.rounded-xl{border-radius:var(--radius-xl)}.border{border-style:var(--tw-border-style);border-width:1px}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.border-border{border-color:hsl(var(--border))}.border-foreground,.border-foreground\/30{border-color:hsl(var(--foreground))}@supports (color:color-mix(in lab,red,red)){.border-foreground\/30{border-color:color-mix(in oklab,hsl(var(--foreground)) 30%,transparent)}}.border-primary,.border-primary\/50{border-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.border-primary\/50{border-color:color-mix(in oklab,hsl(var(--primary)) 50%,transparent)}}.border-ring{border-color:hsl(var(--ring))}.bg-amber-100{background-color:var(--color-amber-100)}.bg-background,.bg-background\/80{background-color:hsl(var(--background))}@supports (color:color-mix(in lab,red,red)){.bg-background\/80{background-color:color-mix(in oklab,hsl(var(--background)) 80%,transparent)}}.bg-border{background-color:hsl(var(--border))}.bg-foreground{background-color:hsl(var(--foreground))}.bg-muted,.bg-muted\/20{background-color:hsl(var(--muted))}@supports (color:color-mix(in lab,red,red)){.bg-muted\/20{background-color:color-mix(in oklab,hsl(var(--muted)) 20%,transparent)}}.bg-muted\/30{background-color:hsl(var(--muted))}@supports (color:color-mix(in lab,red,red)){.bg-muted\/30{background-color:color-mix(in oklab,hsl(var(--muted)) 30%,transparent)}}.bg-muted\/40{background-color:hsl(var(--muted))}@supports (color:color-mix(in lab,red,red)){.bg-muted\/40{background-color:color-mix(in oklab,hsl(var(--muted)) 40%,transparent)}}.bg-muted\/50{background-color:hsl(var(--muted))}@supports (color:color-mix(in lab,red,red)){.bg-muted\/50{background-color:color-mix(in oklab,hsl(var(--muted)) 50%,transparent)}}.bg-muted\/60{background-color:hsl(var(--muted))}@supports (color:color-mix(in lab,red,red)){.bg-muted\/60{background-color:color-mix(in oklab,hsl(var(--muted)) 60%,transparent)}}.bg-panel{background-color:hsl(var(--panel))}.bg-primary{background-color:hsl(var(--primary))}.bg-secondary{background-color:hsl(var(--secondary))}.bg-transparent{background-color:#0000}.p-0\.5{padding:calc(var(--spacing) * .5)}.p-1\.5{padding:calc(var(--spacing) * 1.5)}.p-3{padding:calc(var(--spacing) * 3)}.p-6{padding:calc(var(--spacing) * 6)}.px-1{padding-inline:var(--spacing)}.px-1\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-2\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-3\.5{padding-inline:calc(var(--spacing) * 3.5)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-5{padding-inline:calc(var(--spacing) * 5)}.py-0{padding-block:0}.py-0\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:var(--spacing)}.py-1\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-2\.5{padding-block:calc(var(--spacing) * 2.5)}.py-4{padding-block:calc(var(--spacing) * 4)}.py-6{padding-block:calc(var(--spacing) * 6)}.py-px{padding-block:1px}.pr-1\.5{padding-right:calc(var(--spacing) * 1.5)}.pr-6{padding-right:calc(var(--spacing) * 6)}.pb-1{padding-bottom:var(--spacing)}.pb-2{padding-bottom:calc(var(--spacing) * 2)}.pb-4{padding-bottom:calc(var(--spacing) * 4)}.pl-2\.5{padding-left:calc(var(--spacing) * 2.5)}.pl-3{padding-left:calc(var(--spacing) * 3)}.pl-6{padding-left:calc(var(--spacing) * 6)}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.font-mono{font-family:ui-monospace,SF Mono,SFMono-Regular,Menlo,Consolas,Liberation Mono,monospace}.font-sans{font-family:var(--font-sans)}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\[9px\]{font-size:9px}.text-\[10px\]{font-size:10px}.text-\[11\.5px\]{font-size:11.5px}.text-\[11px\]{font-size:11px}.text-\[12\.5px\]{font-size:12.5px}.text-\[13px\]{font-size:13px}.text-\[15px\]{font-size:15px}.leading-6{--tw-leading:calc(var(--spacing) * 6);line-height:calc(var(--spacing) * 6)}.leading-none{--tw-leading:1;line-height:1}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-\[0\.1em\]{--tw-tracking:.1em;letter-spacing:.1em}.tracking-\[0\.08em\]{--tw-tracking:.08em;letter-spacing:.08em}.tracking-\[0\.14em\]{--tw-tracking:.14em;letter-spacing:.14em}.tracking-\[0\.18em\]{--tw-tracking:.18em;letter-spacing:.18em}.tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.tracking-wider{--tw-tracking:var(--tracking-wider);letter-spacing:var(--tracking-wider)}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-line{white-space:pre-line}.text-amber-600{color:var(--color-amber-600)}.text-amber-700{color:var(--color-amber-700)}.text-background{color:hsl(var(--background))}.text-destructive{color:hsl(var(--destructive))}.text-foreground{color:hsl(var(--foreground))}.text-muted-foreground,.text-muted-foreground\/60{color:hsl(var(--muted-foreground))}@supports (color:color-mix(in lab,red,red)){.text-muted-foreground\/60{color:color-mix(in oklab,hsl(var(--muted-foreground)) 60%,transparent)}}.text-muted-foreground\/70{color:hsl(var(--muted-foreground))}@supports (color:color-mix(in lab,red,red)){.text-muted-foreground\/70{color:color-mix(in oklab,hsl(var(--muted-foreground)) 70%,transparent)}}.text-panel{color:hsl(var(--panel))}.lowercase{text-transform:lowercase}.uppercase{text-transform:uppercase}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.underline{text-decoration-line:underline}.decoration-border{-webkit-text-decoration-color:hsl(var(--border));text-decoration-color:hsl(var(--border))}.underline-offset-2{text-underline-offset:2px}.accent-foreground{accent-color:hsl(var(--foreground))}.opacity-60{opacity:.6}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-2xs{--tw-shadow:0 1px var(--tw-shadow-color,#0000000d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a), 0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-1{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-2{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-foreground\/15{--tw-ring-color:hsl(var(--foreground))}@supports (color:color-mix(in lab,red,red)){.ring-foreground\/15{--tw-ring-color:color-mix(in oklab, hsl(var(--foreground)) 15%, transparent)}}.ring-ring\/50{--tw-ring-color:hsl(var(--ring))}@supports (color:color-mix(in lab,red,red)){.ring-ring\/50{--tw-ring-color:color-mix(in oklab, hsl(var(--ring)) 50%, transparent)}}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.blur{--tw-blur:blur(8px);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.backdrop-blur-sm{--tw-backdrop-blur:blur(var(--blur-sm));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-300{--tw-duration:.3s;transition-duration:.3s}.outline-none{--tw-outline-style:none;outline-style:none}.select-none{-webkit-user-select:none;user-select:none}.placeholder\:font-sans::placeholder{font-family:var(--font-sans)}.placeholder\:text-xs::placeholder{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.placeholder\:text-muted-foreground::placeholder,.placeholder\:text-muted-foreground\/50::placeholder{color:hsl(var(--muted-foreground))}@supports (color:color-mix(in lab,red,red)){.placeholder\:text-muted-foreground\/50::placeholder{color:color-mix(in oklab,hsl(var(--muted-foreground)) 50%,transparent)}}.placeholder\:text-muted-foreground\/60::placeholder{color:hsl(var(--muted-foreground))}@supports (color:color-mix(in lab,red,red)){.placeholder\:text-muted-foreground\/60::placeholder{color:color-mix(in oklab,hsl(var(--muted-foreground)) 60%,transparent)}}.last\:mb-0:last-child{margin-bottom:0}@media (hover:hover){.hover\:border-foreground:hover{border-color:hsl(var(--foreground))}.hover\:border-muted-foreground\/50:hover{border-color:hsl(var(--muted-foreground))}@supports (color:color-mix(in lab,red,red)){.hover\:border-muted-foreground\/50:hover{border-color:color-mix(in oklab,hsl(var(--muted-foreground)) 50%,transparent)}}.hover\:bg-foreground\/90:hover{background-color:hsl(var(--foreground))}@supports (color:color-mix(in lab,red,red)){.hover\:bg-foreground\/90:hover{background-color:color-mix(in oklab,hsl(var(--foreground)) 90%,transparent)}}.hover\:bg-muted:hover,.hover\:bg-muted\/50:hover{background-color:hsl(var(--muted))}@supports (color:color-mix(in lab,red,red)){.hover\:bg-muted\/50:hover{background-color:color-mix(in oklab,hsl(var(--muted)) 50%,transparent)}}.hover\:text-foreground:hover{color:hsl(var(--foreground))}.hover\:decoration-foreground:hover{-webkit-text-decoration-color:hsl(var(--foreground));text-decoration-color:hsl(var(--foreground))}}.focus\:outline-none:focus{--tw-outline-style:none;outline-style:none}.focus-visible\:border-sky-600:focus-visible{border-color:var(--color-sky-600)}.focus-visible\:ring-2:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\:ring-3:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\:ring-ring\/50:focus-visible{--tw-ring-color:hsl(var(--ring))}@supports (color:color-mix(in lab,red,red)){.focus-visible\:ring-ring\/50:focus-visible{--tw-ring-color:color-mix(in oklab, hsl(var(--ring)) 50%, transparent)}}.focus-visible\:outline-2:focus-visible{outline-style:var(--tw-outline-style);outline-width:2px}.focus-visible\:outline-offset-1:focus-visible{outline-offset:1px}.focus-visible\:outline-offset-2:focus-visible{outline-offset:2px}.focus-visible\:outline-ring:focus-visible{outline-color:hsl(var(--ring))}.focus-visible\:outline-none:focus-visible{--tw-outline-style:none;outline-style:none}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-50:disabled{opacity:.5}@media not all and (min-width:48rem){.max-md\:max-h-\[340px\]{max-height:340px}.max-md\:max-h-\[360px\]{max-height:360px}.max-md\:min-h-\[240px\]{min-height:240px}.max-md\:min-h-\[280px\]{min-height:280px}.max-md\:gap-1{gap:var(--spacing)}.max-md\:gap-2{gap:calc(var(--spacing) * 2)}}@media not all and (min-width:40rem){.max-sm\:static{position:static}.max-sm\:inset-x-2{inset-inline:calc(var(--spacing) * 2)}.max-sm\:top-14{top:calc(var(--spacing) * 14)}.max-sm\:w-auto{width:auto}}@media (min-width:40rem){.sm\:inline{display:inline}.sm\:max-w-64{max-width:calc(var(--spacing) * 64)}.sm\:max-w-none{max-width:none}.sm\:px-2{padding-inline:calc(var(--spacing) * 2)}.sm\:px-4{padding-inline:calc(var(--spacing) * 4)}.sm\:py-1{padding-block:var(--spacing)}.sm\:text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}}@media (min-width:48rem){.md\:absolute{position:absolute}.md\:inset-auto{inset:auto}.md\:top-0{top:0}.md\:top-1\/2{top:50%}.md\:right-auto{right:auto}.md\:bottom-0{bottom:0}.md\:-left-1\.5{left:calc(var(--spacing) * -1.5)}.md\:left-1\/2{left:50%}.md\:left-\[var\(--split\)\]{left:var(--split)}.md\:block{display:block}.md\:hidden{display:none}.md\:size-5{width:calc(var(--spacing) * 5);height:calc(var(--spacing) * 5)}.md\:size-11{width:calc(var(--spacing) * 11);height:calc(var(--spacing) * 11)}.md\:h-8{height:calc(var(--spacing) * 8)}.md\:h-12{height:calc(var(--spacing) * 12)}.md\:h-auto{height:auto}.md\:h-svh{height:100svh}.md\:min-h-0{min-height:0}.md\:min-h-12{min-height:calc(var(--spacing) * 12)}.md\:w-0{width:0}.md\:w-3{width:calc(var(--spacing) * 3)}.md\:w-\[var\(--split\)\]{width:var(--split)}.md\:-translate-x-1\/2{--tw-translate-x: -50% ;translate:var(--tw-translate-x) var(--tw-translate-y)}.md\:-translate-y-1\/2{--tw-translate-y: -50% ;translate:var(--tw-translate-x) var(--tw-translate-y)}.md\:cursor-col-resize{cursor:col-resize}.md\:flex-row{flex-direction:row}.md\:gap-1{gap:var(--spacing)}.md\:gap-3{gap:calc(var(--spacing) * 3)}.md\:border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.md\:border-b-0{border-bottom-style:var(--tw-border-style);border-bottom-width:0}.md\:bg-transparent{background-color:#0000}.md\:p-6{padding:calc(var(--spacing) * 6)}.md\:px-2\.5{padding-inline:calc(var(--spacing) * 2.5)}.md\:px-4{padding-inline:calc(var(--spacing) * 4)}.md\:px-16{padding-inline:calc(var(--spacing) * 16)}.md\:py-1\.5{padding-block:calc(var(--spacing) * 1.5)}.md\:pr-2\.5{padding-right:calc(var(--spacing) * 2.5)}.md\:pl-3\.5{padding-left:calc(var(--spacing) * 3.5)}.md\:text-\[11px\]{font-size:11px}}@media (min-width:64rem){.lg\:inline{display:inline}.lg\:gap-3{gap:calc(var(--spacing) * 3)}.lg\:gap-x-3{column-gap:calc(var(--spacing) * 3)}.lg\:px-2\.5{padding-inline:calc(var(--spacing) * 2.5)}.lg\:pr-3{padding-right:calc(var(--spacing) * 3)}.lg\:pl-5{padding-left:calc(var(--spacing) * 5)}}@media (min-width:80rem){.xl\:block{display:block}.xl\:inline{display:inline}}@media (min-width:98.5rem){.fit\:block{display:block}}.dark\:bg-amber-400\/15:is(.dark *){background-color:#fcbb0026}@supports (color:color-mix(in lab,red,red)){.dark\:bg-amber-400\/15:is(.dark *){background-color:color-mix(in oklab,var(--color-amber-400) 15%,transparent)}}.dark\:text-amber-400:is(.dark *){color:var(--color-amber-400)}.dark\:focus-visible\:border-sky-400:is(.dark *):focus-visible{border-color:var(--color-sky-400)}.\[\&_svg\]\:size-3\.5 svg{width:calc(var(--spacing) * 3.5);height:calc(var(--spacing) * 3.5)}}:root{--panel:0 0% 100%;--background:0 0% 100%;--foreground:240 10% 3.9%;--muted:240 4.8% 95.9%;--muted-foreground:240 3.8% 46.1%;--border:240 5.9% 90%;--primary:240 5.9% 10%;--primary-foreground:0 0% 98%;--secondary:240 4.8% 95.9%;--secondary-foreground:240 5.9% 10%;--accent:240 4.8% 95.9%;--accent-foreground:240 5.9% 10%;--destructive:0 84.2% 60.2%;--destructive-foreground:0 0% 98%;--ring:240 5% 64.9%;--radius:.625rem}.dark{--background:240 10% 3.9%;--panel:240 6% 7%;--foreground:0 0% 98%;--muted:240 3.7% 15.9%;--muted-foreground:240 5% 64.9%;--border:240 3.7% 15.9%;--primary:0 0% 98%;--primary-foreground:240 5.9% 10%;--secondary:240 3.7% 15.9%;--secondary-foreground:0 0% 98%;--destructive:0 62.8% 30.6%;--destructive-foreground:0 0% 98%;--ring:240 4.9% 83.9%}body{background-color:var(--color-background);color:var(--color-foreground)}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-divide-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@keyframes spin{to{transform:rotate(360deg)}}.gdg-mnuv029{word-break:break-word;-webkit-touch-callout:default;padding-top:6px}.gdg-mnuv029>*{margin:0}.gdg-mnuv029 *:last-child{margin-bottom:0}.gdg-mnuv029 p img{width:100%}.gdg-d19meir1{position:absolute;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;overflow:hidden;box-sizing:border-box;--overlay-top:var(--d19meir1-0);left:var(--d19meir1-1);top:var(--d19meir1-0);min-width:var(--d19meir1-2);min-height:var(--d19meir1-3);width:-webkit-max-content;width:-moz-max-content;width:max-content;max-width:400px;max-height:calc(100vh - var(--d19meir1-4));font-family:var(--gdg-font-family);font-size:var(--gdg-editor-font-size);text-align:start}@-webkit-keyframes glide_fade_in-gdg-d19meir1{0%{opacity:0%}to{opacity:100%}}@keyframes glide_fade_in-gdg-d19meir1{0%{opacity:0%}to{opacity:100%}}.gdg-d19meir1.gdg-style{border-radius:2px;background-color:var(--gdg-bg-cell);box-shadow:0 0 0 1px var(--gdg-accent-color),0 0 1px #3e415666,0 6px 12px #3e415626;-webkit-animation:glide_fade_in-gdg-d19meir1 60ms 1;animation:glide_fade_in-gdg-d19meir1 60ms 1}.gdg-d19meir1.gdg-pad{padding:var(--d19meir1-5) 8.5px 3px}.gdg-d19meir1 .gdg-clip-region{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;overflow-y:auto;overflow-x:hidden;border-radius:2px;-webkit-box-flex:1;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1}.gdg-d19meir1 .gdg-clip-region .gdg-growing-entry{height:100%}.gdg-d19meir1 .gdg-clip-region input.gdg-input{width:100%;border:none;border-width:0;outline:none}.gdg-d19meir1 .gdg-clip-region textarea.gdg-input{border:none;border-width:0;outline:none}.gdg-b1ygi5by{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-wrap:wrap;-ms-flex-wrap:wrap;flex-wrap:wrap;margin-top:auto;margin-bottom:auto}.gdg-b1ygi5by .boe-bubble{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;border-radius:var(--gdg-rounding-radius,10px);padding:0 8px;height:20px;background-color:var(--gdg-bg-bubble);color:var(--gdg-text-dark);margin:2px}.gdg-b1ygi5by textarea{position:absolute;top:0;left:0;width:0px;height:0px;opacity:0}.gdg-n15fjm3e{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;margin:6px 0 3px;color:var(--gdg-text-dark)}.gdg-n15fjm3e>input{font-size:var(--gdg-editor-font-size);padding:0;font-family:var(--gdg-font-family);color:var(--gdg-text-dark);background-color:var(--gdg-bg-cell)}.gdg-d4zsq0x{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-wrap:wrap;-ms-flex-wrap:wrap;flex-wrap:wrap}.gdg-d4zsq0x .doe-bubble{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding:0 8px;height:24px;background-color:var(--gdg-bg-cell);color:var(--gdg-text-dark);margin:2px;border-radius:var(--gdg-rounding-radius,6px);box-shadow:0 0 1px #3e415666,0 1px 3px #3e415666}.gdg-d4zsq0x .doe-bubble img{height:16px;object-fit:contain;margin-right:4px}.gdg-d4zsq0x textarea{position:absolute;top:0;left:0;width:0px;height:0px;opacity:0}.gdg-i2iowwq{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;height:100%}.gdg-i2iowwq .gdg-centering-container{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;height:100%}.gdg-i2iowwq .gdg-centering-container img,.gdg-i2iowwq .gdg-centering-container canvas{max-height:calc(100vh - var(--overlay-top) - 20px);object-fit:contain;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.gdg-i2iowwq .gdg-centering-container canvas{max-width:380px}.gdg-i2iowwq .gdg-edit-icon{position:absolute;top:12px;right:0;width:48px;height:48px;color:var(--gdg-accent-color);cursor:pointer;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.gdg-i2iowwq .gdg-edit-icon>*{width:24px;height:24px}.gdg-i2iowwq textarea{position:absolute;top:0;left:0;width:0px;height:0px;opacity:0}.gdg-u1rrojo{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-flex:1;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;min-height:21px}.gdg-u1rrojo .gdg-link-area{-webkit-box-flex:1;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1;-webkit-flex-shrink:1;-ms-flex-negative:1;flex-shrink:1;cursor:pointer;margin-right:8px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--gdg-link-color);-webkit-text-decoration:underline!important;text-decoration:underline!important}.gdg-u1rrojo .gdg-edit-icon{-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;width:32px;color:var(--gdg-accent-color);cursor:pointer;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.gdg-u1rrojo .gdg-edit-icon>*{width:24px;height:24px}.gdg-u1rrojo textarea{position:absolute;top:0;left:0;width:0px;height:0px;opacity:0}.gdg-m1pnx84e{min-width:var(--m1pnx84e-0);width:100%;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:flex-start;-webkit-box-align:flex-start;-ms-flex-align:flex-start;align-items:flex-start;-webkit-box-pack:justify;-webkit-justify-content:space-between;-ms-flex-pack:justify;justify-content:space-between;position:relative;color:var(--gdg-text-dark)}.gdg-m1pnx84e .gdg-g1y0xocz{-webkit-flex-shrink:1;-ms-flex-negative:1;flex-shrink:1;min-width:0}.gdg-m1pnx84e .gdg-spacer{-webkit-flex:1;-ms-flex:1;flex:1}.gdg-m1pnx84e .gdg-edit-icon{position:relative;cursor:pointer;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;color:var(--gdg-accent-color);padding:0;height:24px;width:24px;-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;-webkit-transition:all "0.125s ease";transition:all "0.125s ease";border-radius:6px}.gdg-m1pnx84e .gdg-edit-icon>*{width:16px;height:16px}.gdg-m1pnx84e .gdg-edit-hover:hover{background-color:var(--gdg-accent-light);-webkit-transition:background-color .15s;transition:background-color .15s}.gdg-m1pnx84e .gdg-checkmark-hover:hover{color:#fff;background-color:var(--gdg-accent-color)}.gdg-m1pnx84e .gdg-md-edit-textarea{position:relative;top:0;left:0;width:0px;height:0px;margin-top:25px;opacity:0;padding:0}.gdg-m1pnx84e .gdg-ml-6{margin-left:6px}.gdg-s1dgczr6 .dvn-scroller{overflow:var(--s1dgczr6-0);-webkit-transform:translate3d(0,0,0);-ms-transform:translate3d(0,0,0);transform:translateZ(0)}.gdg-s1dgczr6 .dvn-hidden{visibility:hidden}.gdg-s1dgczr6 .dvn-scroll-inner{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;pointer-events:none}.gdg-s1dgczr6 .dvn-scroll-inner>*{-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0}.gdg-s1dgczr6 .dvn-scroll-inner .dvn-spacer{-webkit-box-flex:1;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1}.gdg-s1dgczr6 .dvn-scroll-inner .dvn-stack{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column}.gdg-s1dgczr6 .dvn-underlay>*{position:absolute;left:0;top:0}.gdg-s1dgczr6 canvas{outline:none}.gdg-s1dgczr6 canvas *{height:0}.gdg-izpuzkl{position:absolute;left:0;right:0;top:0;bottom:0;width:100%;height:100%;border-radius:0;resize:none;white-space:pre-wrap;min-width:100%;overflow:hidden;border:0;background-color:transparent;font-size:var(--gdg-editor-font-size);line-height:16px;font-family:var(--gdg-font-family);-webkit-text-fill-color:var(--gdg-text-dark);color:var(--gdg-text-dark);padding:0;margin:0}.gdg-izpuzkl::-webkit-input-placeholder{color:var(--gdg-text-light)}.gdg-izpuzkl::-moz-placeholder{color:var(--gdg-text-light)}.gdg-izpuzkl:-ms-input-placeholder{color:var(--gdg-text-light)}.gdg-izpuzkl::placeholder{color:var(--gdg-text-light)}.gdg-invalid .gdg-izpuzkl{-webkit-text-decoration:underline;text-decoration:underline;-webkit-text-decoration-color:#d60606;text-decoration-color:#d60606}.gdg-s69h75o{visibility:hidden;white-space:pre-wrap;word-wrap:break-word;width:-webkit-max-content;width:-moz-max-content;width:max-content;max-width:100%;min-width:100%;font-size:var(--gdg-editor-font-size);line-height:16px;font-family:var(--gdg-font-family);color:var(--gdg-text-dark);padding:0 0 2px;margin:0}.gdg-g1y0xocz{position:relative;margin-top:6px}.gdg-seveqep{position:absolute;top:4px;right:20px;background-color:var(--gdg-bg-cell);color:var(--gdg-text-dark);padding:8px;border:1px solid var(--gdg-border-color);border-radius:6px;font-size:var(--gdg-editor-font-size);-webkit-animation:gdg-search-fadein-gdg-seveqep .15s forwards;animation:gdg-search-fadein-gdg-seveqep .15s forwards}.gdg-seveqep.out{-webkit-animation:gdg-search-fadeout-gdg-seveqep .15s forwards;animation:gdg-search-fadeout-gdg-seveqep .15s forwards}.gdg-seveqep .gdg-search-bar-inner{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex}.gdg-seveqep .gdg-search-status{padding-top:4px;font-size:11px}.gdg-seveqep .gdg-search-progress{position:absolute;height:4px;left:0;bottom:0;background-color:var(--gdg-text-light)}.gdg-seveqep input{width:220px;color:var(--gdg-textDark);background-color:var(--gdg-bg-cell);border:none;border-width:0;outline:none}.gdg-seveqep button{width:24px;height:24px;padding:0;border:none;outline:none;background:none;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;cursor:pointer;color:var(--gdg-text-medium)}.gdg-seveqep button:hover{color:var(--gdg-text-dark)}.gdg-seveqep button .button-icon{width:16px;height:16px}.gdg-seveqep button:disabled{opacity:.4;pointer-events:none}@-webkit-keyframes gdg-search-fadeout-gdg-seveqep{0%{-webkit-transform:translateX(0);-ms-transform:translateX(0);transform:translate(0)}to{-webkit-transform:translateX(400px);-ms-transform:translateX(400px);transform:translate(400px)}}@keyframes gdg-search-fadeout-gdg-seveqep{0%{-webkit-transform:translateX(0);-ms-transform:translateX(0);transform:translate(0)}to{-webkit-transform:translateX(400px);-ms-transform:translateX(400px);transform:translate(400px)}}@-webkit-keyframes gdg-search-fadein-gdg-seveqep{0%{-webkit-transform:translateX(400px);-ms-transform:translateX(400px);transform:translate(400px)}to{-webkit-transform:translateX(0);-ms-transform:translateX(0);transform:translate(0)}}@keyframes gdg-search-fadein-gdg-seveqep{0%{-webkit-transform:translateX(400px);-ms-transform:translateX(400px);transform:translate(400px)}to{-webkit-transform:translateX(0);-ms-transform:translateX(0);transform:translate(0)}}.gdg-wmyidgi{position:relative;min-width:10px;min-height:10px;max-width:100%;max-height:100%;width:var(--wmyidgi-0);height:var(--wmyidgi-1);overflow:hidden;overflow:clip;direction:ltr}.gdg-wmyidgi>:first-child{position:absolute;left:0;top:0;width:100%;height:100%}.gdg-r17m35ur{-webkit-box-flex:1;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1;border:none;outline:none;background-color:var(--gdg-bg-header-has-focus);border-radius:9px;padding:0 8px;box-shadow:0 0 0 1px var(--gdg-border-color);color:var(--gdg-text-group-header);min-height:var(--r17m35ur-0);font:var(--gdg-header-font-style) var(--gdg-font-family)}.gdg-c1tqibwd{padding:0 8px;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;background-color:var(--gdg-bg-header)} diff --git a/app/dist/assets/index-Dded1B-H.js b/app/dist/assets/index-Dded1B-H.js deleted file mode 100644 index 15bbf6f6..00000000 --- a/app/dist/assets/index-Dded1B-H.js +++ /dev/null @@ -1,313 +0,0 @@ -var uO=Object.defineProperty;var cO=(t,e,n)=>e in t?uO(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var kt=(t,e,n)=>cO(t,typeof e!="symbol"?e+"":e,n);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();var Co=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function es(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var fC={exports:{}},cp={},dC={exports:{}},At={};/** - * @license React - * react.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var ef=Symbol.for("react.element"),fO=Symbol.for("react.portal"),dO=Symbol.for("react.fragment"),hO=Symbol.for("react.strict_mode"),pO=Symbol.for("react.profiler"),gO=Symbol.for("react.provider"),mO=Symbol.for("react.context"),yO=Symbol.for("react.forward_ref"),vO=Symbol.for("react.suspense"),wO=Symbol.for("react.memo"),bO=Symbol.for("react.lazy"),c1=Symbol.iterator;function xO(t){return t===null||typeof t!="object"?null:(t=c1&&t[c1]||t["@@iterator"],typeof t=="function"?t:null)}var hC={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},pC=Object.assign,gC={};function su(t,e,n){this.props=t,this.context=e,this.refs=gC,this.updater=n||hC}su.prototype.isReactComponent={};su.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,t,e,"setState")};su.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function mC(){}mC.prototype=su.prototype;function qy(t,e,n){this.props=t,this.context=e,this.refs=gC,this.updater=n||hC}var Yy=qy.prototype=new mC;Yy.constructor=qy;pC(Yy,su.prototype);Yy.isPureReactComponent=!0;var f1=Array.isArray,yC=Object.prototype.hasOwnProperty,Jy={current:null},vC={key:!0,ref:!0,__self:!0,__source:!0};function wC(t,e,n){var r,i={},s=null,o=null;if(e!=null)for(r in e.ref!==void 0&&(o=e.ref),e.key!==void 0&&(s=""+e.key),e)yC.call(e,r)&&!vC.hasOwnProperty(r)&&(i[r]=e[r]);var l=arguments.length-2;if(l===1)i.children=n;else if(1>>1,P=H[I];if(0>>1;Ii(W,R))yei(ee,W)?(H[I]=ee,H[ye]=R,I=ye):(H[I]=W,H[q]=R,I=q);else if(yei(ee,R))H[I]=ee,H[ye]=R,I=ye;else break e}}return X}function i(H,X){var R=H.sortIndex-X.sortIndex;return R!==0?R:H.id-X.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;t.unstable_now=function(){return s.now()}}else{var o=Date,l=o.now();t.unstable_now=function(){return o.now()-l}}var a=[],u=[],c=1,f=null,d=3,h=!1,p=!1,g=!1,b=typeof setTimeout=="function"?setTimeout:null,m=typeof clearTimeout=="function"?clearTimeout:null,v=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function w(H){for(var X=n(u);X!==null;){if(X.callback===null)r(u);else if(X.startTime<=H)r(u),X.sortIndex=X.expirationTime,e(a,X);else break;X=n(u)}}function k(H){if(g=!1,w(H),!p)if(n(a)!==null)p=!0,ie(x);else{var X=n(u);X!==null&&se(k,X.startTime-H)}}function x(H,X){p=!1,g&&(g=!1,m(A),A=-1),h=!0;var R=d;try{for(w(X),f=n(a);f!==null&&(!(f.expirationTime>X)||H&&!D());){var I=f.callback;if(typeof I=="function"){f.callback=null,d=f.priorityLevel;var P=I(f.expirationTime<=X);X=t.unstable_now(),typeof P=="function"?f.callback=P:f===n(a)&&r(a),w(X)}else r(a);f=n(a)}if(f!==null)var B=!0;else{var q=n(u);q!==null&&se(k,q.startTime-X),B=!1}return B}finally{f=null,d=R,h=!1}}var C=!1,T=null,A=-1,M=5,N=-1;function D(){return!(t.unstable_now()-NH||125I?(H.sortIndex=R,e(u,H),n(a)===null&&H===n(u)&&(g?(m(A),A=-1):g=!0,se(k,R-I))):(H.sortIndex=P,e(a,H),p||h||(p=!0,ie(x))),H},t.unstable_shouldYield=D,t.unstable_wrapCallback=function(H){var X=d;return function(){var R=d;d=X;try{return H.apply(this,arguments)}finally{d=R}}}})(CC);SC.exports=CC;var NO=SC.exports;/** - * @license React - * react-dom.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var IO=y,si=NO;function he(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Wm=Object.prototype.hasOwnProperty,_O=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,h1={},p1={};function DO(t){return Wm.call(p1,t)?!0:Wm.call(h1,t)?!1:_O.test(t)?p1[t]=!0:(h1[t]=!0,!1)}function LO(t,e,n,r){if(n!==null&&n.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function $O(t,e,n,r){if(e===null||typeof e>"u"||LO(t,e,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function Pr(t,e,n,r,i,s,o){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=t,this.type=e,this.sanitizeURL=s,this.removeEmptyString=o}var lr={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){lr[t]=new Pr(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];lr[e]=new Pr(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){lr[t]=new Pr(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){lr[t]=new Pr(t,2,!1,t,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(t){lr[t]=new Pr(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){lr[t]=new Pr(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){lr[t]=new Pr(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){lr[t]=new Pr(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){lr[t]=new Pr(t,5,!1,t.toLowerCase(),null,!1,!1)});var Zy=/[\-:]([a-z])/g;function ev(t){return t[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(t){var e=t.replace(Zy,ev);lr[e]=new Pr(e,1,!1,t,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(Zy,ev);lr[e]=new Pr(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(Zy,ev);lr[e]=new Pr(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){lr[t]=new Pr(t,1,!1,t.toLowerCase(),null,!1,!1)});lr.xlinkHref=new Pr("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){lr[t]=new Pr(t,1,!1,t.toLowerCase(),null,!0,!0)});function tv(t,e,n,r){var i=lr.hasOwnProperty(e)?lr[e]:null;(i!==null?i.type!==0:r||!(2l||i[o]!==s[l]){var a=` -`+i[o].replace(" at new "," at ");return t.displayName&&a.includes("")&&(a=a.replace("",t.displayName)),a}while(1<=o&&0<=l);break}}}finally{wg=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?Gu(t):""}function FO(t){switch(t.tag){case 5:return Gu(t.type);case 16:return Gu("Lazy");case 13:return Gu("Suspense");case 19:return Gu("SuspenseList");case 0:case 2:case 15:return t=bg(t.type,!1),t;case 11:return t=bg(t.type.render,!1),t;case 1:return t=bg(t.type,!0),t;default:return""}}function Xm(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case ca:return"Fragment";case ua:return"Portal";case Vm:return"Profiler";case nv:return"StrictMode";case Um:return"Suspense";case Km:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case AC:return(t.displayName||"Context")+".Consumer";case EC:return(t._context.displayName||"Context")+".Provider";case rv:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case iv:return e=t.displayName||null,e!==null?e:Xm(t.type)||"Memo";case mo:e=t._payload,t=t._init;try{return Xm(t(e))}catch{}}return null}function zO(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Xm(e);case 8:return e===nv?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function Fo(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function RC(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function BO(t){var e=RC(t)?"checked":"value",n=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),r=""+t[e];if(!t.hasOwnProperty(e)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var i=n.get,s=n.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return i.call(this)},set:function(o){r=""+o,s.call(this,o)}}),Object.defineProperty(t,e,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function Ff(t){t._valueTracker||(t._valueTracker=BO(t))}function OC(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),r="";return t&&(r=RC(t)?t.checked?"true":"false":t.value),t=r,t!==n?(e.setValue(t),!0):!1}function nh(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function Gm(t,e){var n=e.checked;return Cn({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??t._wrapperState.initialChecked})}function m1(t,e){var n=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;n=Fo(e.value!=null?e.value:n),t._wrapperState={initialChecked:r,initialValue:n,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function PC(t,e){e=e.checked,e!=null&&tv(t,"checked",e,!1)}function qm(t,e){PC(t,e);var n=Fo(e.value),r=e.type;if(n!=null)r==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+n):t.value!==""+n&&(t.value=""+n);else if(r==="submit"||r==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?Ym(t,e.type,n):e.hasOwnProperty("defaultValue")&&Ym(t,e.type,Fo(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function y1(t,e,n){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var r=e.type;if(!(r!=="submit"&&r!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,n||e===t.value||(t.value=e),t.defaultValue=e}n=t.name,n!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,n!==""&&(t.name=n)}function Ym(t,e,n){(e!=="number"||nh(t.ownerDocument)!==t)&&(n==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}var qu=Array.isArray;function Aa(t,e,n,r){if(t=t.options,e){e={};for(var i=0;i"+e.valueOf().toString()+"",e=zf.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function Ac(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var rc={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},jO=["Webkit","ms","Moz","O"];Object.keys(rc).forEach(function(t){jO.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),rc[e]=rc[t]})});function DC(t,e,n){return e==null||typeof e=="boolean"||e===""?"":n||typeof e!="number"||e===0||rc.hasOwnProperty(t)&&rc[t]?(""+e).trim():e+"px"}function LC(t,e){t=t.style;for(var n in e)if(e.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=DC(n,e[n],r);n==="float"&&(n="cssFloat"),r?t.setProperty(n,i):t[n]=i}}var HO=Cn({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Zm(t,e){if(e){if(HO[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(he(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(he(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(he(61))}if(e.style!=null&&typeof e.style!="object")throw Error(he(62))}}function e0(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var t0=null;function sv(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var n0=null,Ma=null,Ra=null;function b1(t){if(t=rf(t)){if(typeof n0!="function")throw Error(he(280));var e=t.stateNode;e&&(e=gp(e),n0(t.stateNode,t.type,e))}}function $C(t){Ma?Ra?Ra.push(t):Ra=[t]:Ma=t}function FC(){if(Ma){var t=Ma,e=Ra;if(Ra=Ma=null,b1(t),e)for(t=0;t>>=0,t===0?32:31-(ZO(t)/eP|0)|0}var Bf=64,jf=4194304;function Yu(t){switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function oh(t,e){var n=t.pendingLanes;if(n===0)return 0;var r=0,i=t.suspendedLanes,s=t.pingedLanes,o=n&268435455;if(o!==0){var l=o&~i;l!==0?r=Yu(l):(s&=o,s!==0&&(r=Yu(s)))}else o=n&~i,o!==0?r=Yu(o):s!==0&&(r=Yu(s));if(r===0)return 0;if(e!==0&&e!==r&&!(e&i)&&(i=r&-r,s=e&-e,i>=s||i===16&&(s&4194240)!==0))return e;if(r&4&&(r|=n&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=r;0n;n++)e.push(t);return e}function tf(t,e,n){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-Yi(e),t[e]=n}function iP(t,e){var n=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var r=t.eventTimes;for(t=t.expirationTimes;0=sc),R1=" ",O1=!1;function i2(t,e){switch(t){case"keyup":return NP.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function s2(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var fa=!1;function _P(t,e){switch(t){case"compositionend":return s2(e);case"keypress":return e.which!==32?null:(O1=!0,R1);case"textInput":return t=e.data,t===R1&&O1?null:t;default:return null}}function DP(t,e){if(fa)return t==="compositionend"||!hv&&i2(t,e)?(t=n2(),Dd=cv=To=null,fa=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1=e)return{node:n,offset:e-t};t=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=_1(n)}}function u2(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?u2(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function c2(){for(var t=window,e=nh();e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=nh(t.document)}return e}function pv(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function VP(t){var e=c2(),n=t.focusedElem,r=t.selectionRange;if(e!==n&&n&&n.ownerDocument&&u2(n.ownerDocument.documentElement,n)){if(r!==null&&pv(n)){if(e=r.start,t=r.end,t===void 0&&(t=e),"selectionStart"in n)n.selectionStart=e,n.selectionEnd=Math.min(t,n.value.length);else if(t=(e=n.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var i=n.textContent.length,s=Math.min(r.start,i);r=r.end===void 0?s:Math.min(r.end,i),!t.extend&&s>r&&(i=r,r=s,s=i),i=D1(n,s);var o=D1(n,r);i&&o&&(t.rangeCount!==1||t.anchorNode!==i.node||t.anchorOffset!==i.offset||t.focusNode!==o.node||t.focusOffset!==o.offset)&&(e=e.createRange(),e.setStart(i.node,i.offset),t.removeAllRanges(),s>r?(t.addRange(e),t.extend(o.node,o.offset)):(e.setEnd(o.node,o.offset),t.addRange(e)))}}for(e=[],t=n;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,da=null,a0=null,lc=null,u0=!1;function L1(t,e,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;u0||da==null||da!==nh(r)||(r=da,"selectionStart"in r&&pv(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),lc&&Ic(lc,r)||(lc=r,r=uh(a0,"onSelect"),0ga||(t.current=g0[ga],g0[ga]=null,ga--)}function fn(t,e){ga++,g0[ga]=t.current,t.current=e}var zo={},wr=Ko(zo),zr=Ko(!1),Al=zo;function ja(t,e){var n=t.type.contextTypes;if(!n)return zo;var r=t.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===e)return r.__reactInternalMemoizedMaskedChildContext;var i={},s;for(s in n)i[s]=e[s];return r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=i),i}function Br(t){return t=t.childContextTypes,t!=null}function fh(){gn(zr),gn(wr)}function W1(t,e,n){if(wr.current!==zo)throw Error(he(168));fn(wr,e),fn(zr,n)}function w2(t,e,n){var r=t.stateNode;if(e=e.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in e))throw Error(he(108,zO(t)||"Unknown",i));return Cn({},n,r)}function dh(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||zo,Al=wr.current,fn(wr,t),fn(zr,zr.current),!0}function V1(t,e,n){var r=t.stateNode;if(!r)throw Error(he(169));n?(t=w2(t,e,Al),r.__reactInternalMemoizedMergedChildContext=t,gn(zr),gn(wr),fn(wr,t)):gn(zr),fn(zr,n)}var Ds=null,mp=!1,_g=!1;function b2(t){Ds===null?Ds=[t]:Ds.push(t)}function nN(t){mp=!0,b2(t)}function Xo(){if(!_g&&Ds!==null){_g=!0;var t=0,e=qt;try{var n=Ds;for(qt=1;t>=o,i-=o,Bs=1<<32-Yi(e)+i|n<A?(M=T,T=null):M=T.sibling;var N=d(m,T,w[A],k);if(N===null){T===null&&(T=M);break}t&&T&&N.alternate===null&&e(m,T),v=s(N,v,A),C===null?x=N:C.sibling=N,C=N,T=M}if(A===w.length)return n(m,T),wn&&ul(m,A),x;if(T===null){for(;AA?(M=T,T=null):M=T.sibling;var D=d(m,T,N.value,k);if(D===null){T===null&&(T=M);break}t&&T&&D.alternate===null&&e(m,T),v=s(D,v,A),C===null?x=D:C.sibling=D,C=D,T=M}if(N.done)return n(m,T),wn&&ul(m,A),x;if(T===null){for(;!N.done;A++,N=w.next())N=f(m,N.value,k),N!==null&&(v=s(N,v,A),C===null?x=N:C.sibling=N,C=N);return wn&&ul(m,A),x}for(T=r(m,T);!N.done;A++,N=w.next())N=h(T,m,A,N.value,k),N!==null&&(t&&N.alternate!==null&&T.delete(N.key===null?A:N.key),v=s(N,v,A),C===null?x=N:C.sibling=N,C=N);return t&&T.forEach(function(O){return e(m,O)}),wn&&ul(m,A),x}function b(m,v,w,k){if(typeof w=="object"&&w!==null&&w.type===ca&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case $f:e:{for(var x=w.key,C=v;C!==null;){if(C.key===x){if(x=w.type,x===ca){if(C.tag===7){n(m,C.sibling),v=i(C,w.props.children),v.return=m,m=v;break e}}else if(C.elementType===x||typeof x=="object"&&x!==null&&x.$$typeof===mo&&X1(x)===C.type){n(m,C.sibling),v=i(C,w.props),v.ref=Iu(m,C,w),v.return=m,m=v;break e}n(m,C);break}else e(m,C);C=C.sibling}w.type===ca?(v=Cl(w.props.children,m.mode,k,w.key),v.return=m,m=v):(k=Wd(w.type,w.key,w.props,null,m.mode,k),k.ref=Iu(m,v,w),k.return=m,m=k)}return o(m);case ua:e:{for(C=w.key;v!==null;){if(v.key===C)if(v.tag===4&&v.stateNode.containerInfo===w.containerInfo&&v.stateNode.implementation===w.implementation){n(m,v.sibling),v=i(v,w.children||[]),v.return=m,m=v;break e}else{n(m,v);break}else e(m,v);v=v.sibling}v=Hg(w,m.mode,k),v.return=m,m=v}return o(m);case mo:return C=w._init,b(m,v,C(w._payload),k)}if(qu(w))return p(m,v,w,k);if(Mu(w))return g(m,v,w,k);Gf(m,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,v!==null&&v.tag===6?(n(m,v.sibling),v=i(v,w),v.return=m,m=v):(n(m,v),v=jg(w,m.mode,k),v.return=m,m=v),o(m)):n(m,v)}return b}var Wa=C2(!0),T2=C2(!1),gh=Ko(null),mh=null,va=null,vv=null;function wv(){vv=va=mh=null}function bv(t){var e=gh.current;gn(gh),t._currentValue=e}function v0(t,e,n){for(;t!==null;){var r=t.alternate;if((t.childLanes&e)!==e?(t.childLanes|=e,r!==null&&(r.childLanes|=e)):r!==null&&(r.childLanes&e)!==e&&(r.childLanes|=e),t===n)break;t=t.return}}function Pa(t,e){mh=t,vv=va=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&($r=!0),t.firstContext=null)}function Ci(t){var e=t._currentValue;if(vv!==t)if(t={context:t,memoizedValue:e,next:null},va===null){if(mh===null)throw Error(he(308));va=t,mh.dependencies={lanes:0,firstContext:t}}else va=va.next=t;return e}var wl=null;function xv(t){wl===null?wl=[t]:wl.push(t)}function E2(t,e,n,r){var i=e.interleaved;return i===null?(n.next=n,xv(e)):(n.next=i.next,i.next=n),e.interleaved=n,Xs(t,r)}function Xs(t,e){t.lanes|=e;var n=t.alternate;for(n!==null&&(n.lanes|=e),n=t,t=t.return;t!==null;)t.childLanes|=e,n=t.alternate,n!==null&&(n.childLanes|=e),n=t,t=t.return;return n.tag===3?n.stateNode:null}var yo=!1;function kv(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function A2(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function Ws(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function Io(t,e,n){var r=t.updateQueue;if(r===null)return null;if(r=r.shared,Dt&2){var i=r.pending;return i===null?e.next=e:(e.next=i.next,i.next=e),r.pending=e,Xs(t,n)}return i=r.interleaved,i===null?(e.next=e,xv(r)):(e.next=i.next,i.next=e),r.interleaved=e,Xs(t,n)}function $d(t,e,n){if(e=e.updateQueue,e!==null&&(e=e.shared,(n&4194240)!==0)){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,lv(t,n)}}function G1(t,e){var n=t.updateQueue,r=t.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,s=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};s===null?i=s=o:s=s.next=o,n=n.next}while(n!==null);s===null?i=s=e:s=s.next=e}else i=s=e;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:s,shared:r.shared,effects:r.effects},t.updateQueue=n;return}t=n.lastBaseUpdate,t===null?n.firstBaseUpdate=e:t.next=e,n.lastBaseUpdate=e}function yh(t,e,n,r){var i=t.updateQueue;yo=!1;var s=i.firstBaseUpdate,o=i.lastBaseUpdate,l=i.shared.pending;if(l!==null){i.shared.pending=null;var a=l,u=a.next;a.next=null,o===null?s=u:o.next=u,o=a;var c=t.alternate;c!==null&&(c=c.updateQueue,l=c.lastBaseUpdate,l!==o&&(l===null?c.firstBaseUpdate=u:l.next=u,c.lastBaseUpdate=a))}if(s!==null){var f=i.baseState;o=0,c=u=a=null,l=s;do{var d=l.lane,h=l.eventTime;if((r&d)===d){c!==null&&(c=c.next={eventTime:h,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var p=t,g=l;switch(d=e,h=n,g.tag){case 1:if(p=g.payload,typeof p=="function"){f=p.call(h,f,d);break e}f=p;break e;case 3:p.flags=p.flags&-65537|128;case 0:if(p=g.payload,d=typeof p=="function"?p.call(h,f,d):p,d==null)break e;f=Cn({},f,d);break e;case 2:yo=!0}}l.callback!==null&&l.lane!==0&&(t.flags|=64,d=i.effects,d===null?i.effects=[l]:d.push(l))}else h={eventTime:h,lane:d,tag:l.tag,payload:l.payload,callback:l.callback,next:null},c===null?(u=c=h,a=f):c=c.next=h,o|=d;if(l=l.next,l===null){if(l=i.shared.pending,l===null)break;d=l,l=d.next,d.next=null,i.lastBaseUpdate=d,i.shared.pending=null}}while(!0);if(c===null&&(a=f),i.baseState=a,i.firstBaseUpdate=u,i.lastBaseUpdate=c,e=i.shared.interleaved,e!==null){i=e;do o|=i.lane,i=i.next;while(i!==e)}else s===null&&(i.shared.lanes=0);Ol|=o,t.lanes=o,t.memoizedState=f}}function q1(t,e,n){if(t=e.effects,e.effects=null,t!==null)for(e=0;en?n:4,t(!0);var r=Lg.transition;Lg.transition={};try{t(!1),e()}finally{qt=n,Lg.transition=r}}function V2(){return Ti().memoizedState}function oN(t,e,n){var r=Do(t);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},U2(t))K2(e,n);else if(n=E2(t,e,n,r),n!==null){var i=Ar();Ji(n,t,r,i),X2(n,e,r)}}function lN(t,e,n){var r=Do(t),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(U2(t))K2(e,i);else{var s=t.alternate;if(t.lanes===0&&(s===null||s.lanes===0)&&(s=e.lastRenderedReducer,s!==null))try{var o=e.lastRenderedState,l=s(o,n);if(i.hasEagerState=!0,i.eagerState=l,Qi(l,o)){var a=e.interleaved;a===null?(i.next=i,xv(e)):(i.next=a.next,a.next=i),e.interleaved=i;return}}catch{}finally{}n=E2(t,e,i,r),n!==null&&(i=Ar(),Ji(n,t,r,i),X2(n,e,r))}}function U2(t){var e=t.alternate;return t===Sn||e!==null&&e===Sn}function K2(t,e){ac=wh=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function X2(t,e,n){if(n&4194240){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,lv(t,n)}}var bh={readContext:Ci,useCallback:dr,useContext:dr,useEffect:dr,useImperativeHandle:dr,useInsertionEffect:dr,useLayoutEffect:dr,useMemo:dr,useReducer:dr,useRef:dr,useState:dr,useDebugValue:dr,useDeferredValue:dr,useTransition:dr,useMutableSource:dr,useSyncExternalStore:dr,useId:dr,unstable_isNewReconciler:!1},aN={readContext:Ci,useCallback:function(t,e){return hs().memoizedState=[t,e===void 0?null:e],t},useContext:Ci,useEffect:J1,useImperativeHandle:function(t,e,n){return n=n!=null?n.concat([t]):null,zd(4194308,4,z2.bind(null,e,t),n)},useLayoutEffect:function(t,e){return zd(4194308,4,t,e)},useInsertionEffect:function(t,e){return zd(4,2,t,e)},useMemo:function(t,e){var n=hs();return e=e===void 0?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var r=hs();return e=n!==void 0?n(e):e,r.memoizedState=r.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},r.queue=t,t=t.dispatch=oN.bind(null,Sn,t),[r.memoizedState,t]},useRef:function(t){var e=hs();return t={current:t},e.memoizedState=t},useState:Y1,useDebugValue:Ov,useDeferredValue:function(t){return hs().memoizedState=t},useTransition:function(){var t=Y1(!1),e=t[0];return t=sN.bind(null,t[1]),hs().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,n){var r=Sn,i=hs();if(wn){if(n===void 0)throw Error(he(407));n=n()}else{if(n=e(),Zn===null)throw Error(he(349));Rl&30||P2(r,e,n)}i.memoizedState=n;var s={value:n,getSnapshot:e};return i.queue=s,J1(I2.bind(null,r,s,t),[t]),r.flags|=2048,jc(9,N2.bind(null,r,s,n,e),void 0,null),n},useId:function(){var t=hs(),e=Zn.identifierPrefix;if(wn){var n=js,r=Bs;n=(r&~(1<<32-Yi(r)-1)).toString(32)+n,e=":"+e+"R"+n,n=zc++,0<\/script>",t=t.removeChild(t.firstChild)):typeof r.is=="string"?t=o.createElement(n,{is:r.is}):(t=o.createElement(n),n==="select"&&(o=t,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):t=o.createElementNS(t,n),t[ps]=e,t[Lc]=r,rT(t,e,!1,!1),e.stateNode=t;e:{switch(o=e0(n,r),n){case"dialog":hn("cancel",t),hn("close",t),i=r;break;case"iframe":case"object":case"embed":hn("load",t),i=r;break;case"video":case"audio":for(i=0;iKa&&(e.flags|=128,r=!0,_u(s,!1),e.lanes=4194304)}else{if(!r)if(t=vh(o),t!==null){if(e.flags|=128,r=!0,n=t.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),_u(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!wn)return hr(e),null}else 2*$n()-s.renderingStartTime>Ka&&n!==1073741824&&(e.flags|=128,r=!0,_u(s,!1),e.lanes=4194304);s.isBackwards?(o.sibling=e.child,e.child=o):(n=s.last,n!==null?n.sibling=o:e.child=o,s.last=o)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=$n(),e.sibling=null,n=kn.current,fn(kn,r?n&1|2:n&1),e):(hr(e),null);case 22:case 23:return Lv(),r=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?Jr&1073741824&&(hr(e),e.subtreeFlags&6&&(e.flags|=8192)):hr(e),null;case 24:return null;case 25:return null}throw Error(he(156,e.tag))}function mN(t,e){switch(mv(e),e.tag){case 1:return Br(e.type)&&fh(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return Va(),gn(zr),gn(wr),Tv(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return Cv(e),null;case 13:if(gn(kn),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(he(340));Ha()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return gn(kn),null;case 4:return Va(),null;case 10:return bv(e.type._context),null;case 22:case 23:return Lv(),null;case 24:return null;default:return null}}var Yf=!1,yr=!1,yN=typeof WeakSet=="function"?WeakSet:Set,_e=null;function wa(t,e){var n=t.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){An(t,e,r)}else n.current=null}function A0(t,e,n){try{n()}catch(r){An(t,e,r)}}var ab=!1;function vN(t,e){if(c0=lh,t=c2(),pv(t)){if("selectionStart"in t)var n={start:t.selectionStart,end:t.selectionEnd};else e:{n=(n=t.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,s=r.focusNode;r=r.focusOffset;try{n.nodeType,s.nodeType}catch{n=null;break e}var o=0,l=-1,a=-1,u=0,c=0,f=t,d=null;t:for(;;){for(var h;f!==n||i!==0&&f.nodeType!==3||(l=o+i),f!==s||r!==0&&f.nodeType!==3||(a=o+r),f.nodeType===3&&(o+=f.nodeValue.length),(h=f.firstChild)!==null;)d=f,f=h;for(;;){if(f===t)break t;if(d===n&&++u===i&&(l=o),d===s&&++c===r&&(a=o),(h=f.nextSibling)!==null)break;f=d,d=f.parentNode}f=h}n=l===-1||a===-1?null:{start:l,end:a}}else n=null}n=n||{start:0,end:0}}else n=null;for(f0={focusedElem:t,selectionRange:n},lh=!1,_e=e;_e!==null;)if(e=_e,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,_e=t;else for(;_e!==null;){e=_e;try{var p=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(p!==null){var g=p.memoizedProps,b=p.memoizedState,m=e.stateNode,v=m.getSnapshotBeforeUpdate(e.elementType===e.type?g:Bi(e.type,g),b);m.__reactInternalSnapshotBeforeUpdate=v}break;case 3:var w=e.stateNode.containerInfo;w.nodeType===1?w.textContent="":w.nodeType===9&&w.documentElement&&w.removeChild(w.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(he(163))}}catch(k){An(e,e.return,k)}if(t=e.sibling,t!==null){t.return=e.return,_e=t;break}_e=e.return}return p=ab,ab=!1,p}function uc(t,e,n){var r=e.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&t)===t){var s=i.destroy;i.destroy=void 0,s!==void 0&&A0(e,n,s)}i=i.next}while(i!==r)}}function wp(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var n=e=e.next;do{if((n.tag&t)===t){var r=n.create;n.destroy=r()}n=n.next}while(n!==e)}}function M0(t){var e=t.ref;if(e!==null){var n=t.stateNode;switch(t.tag){case 5:t=n;break;default:t=n}typeof e=="function"?e(t):e.current=t}}function oT(t){var e=t.alternate;e!==null&&(t.alternate=null,oT(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[ps],delete e[Lc],delete e[p0],delete e[eN],delete e[tN])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function lT(t){return t.tag===5||t.tag===3||t.tag===4}function ub(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||lT(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function R0(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.nodeType===8?n.parentNode.insertBefore(t,e):n.insertBefore(t,e):(n.nodeType===8?(e=n.parentNode,e.insertBefore(t,n)):(e=n,e.appendChild(t)),n=n._reactRootContainer,n!=null||e.onclick!==null||(e.onclick=ch));else if(r!==4&&(t=t.child,t!==null))for(R0(t,e,n),t=t.sibling;t!==null;)R0(t,e,n),t=t.sibling}function O0(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.insertBefore(t,e):n.appendChild(t);else if(r!==4&&(t=t.child,t!==null))for(O0(t,e,n),t=t.sibling;t!==null;)O0(t,e,n),t=t.sibling}var nr=null,ji=!1;function oo(t,e,n){for(n=n.child;n!==null;)aT(t,e,n),n=n.sibling}function aT(t,e,n){if(Ss&&typeof Ss.onCommitFiberUnmount=="function")try{Ss.onCommitFiberUnmount(fp,n)}catch{}switch(n.tag){case 5:yr||wa(n,e);case 6:var r=nr,i=ji;nr=null,oo(t,e,n),nr=r,ji=i,nr!==null&&(ji?(t=nr,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):nr.removeChild(n.stateNode));break;case 18:nr!==null&&(ji?(t=nr,n=n.stateNode,t.nodeType===8?Ig(t.parentNode,n):t.nodeType===1&&Ig(t,n),Pc(t)):Ig(nr,n.stateNode));break;case 4:r=nr,i=ji,nr=n.stateNode.containerInfo,ji=!0,oo(t,e,n),nr=r,ji=i;break;case 0:case 11:case 14:case 15:if(!yr&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var s=i,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&A0(n,e,o),i=i.next}while(i!==r)}oo(t,e,n);break;case 1:if(!yr&&(wa(n,e),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){An(n,e,l)}oo(t,e,n);break;case 21:oo(t,e,n);break;case 22:n.mode&1?(yr=(r=yr)||n.memoizedState!==null,oo(t,e,n),yr=r):oo(t,e,n);break;default:oo(t,e,n)}}function cb(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new yN),e.forEach(function(r){var i=AN.bind(null,t,r);n.has(r)||(n.add(r),r.then(i,i))})}}function $i(t,e){var n=e.deletions;if(n!==null)for(var r=0;ri&&(i=o),r&=~s}if(r=i,r=$n()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*bN(r/1960))-r,10t?16:t,Eo===null)var r=!1;else{if(t=Eo,Eo=null,Sh=0,Dt&6)throw Error(he(331));var i=Dt;for(Dt|=4,_e=t.current;_e!==null;){var s=_e,o=s.child;if(_e.flags&16){var l=s.deletions;if(l!==null){for(var a=0;a$n()-_v?Sl(t,0):Iv|=n),jr(t,e)}function mT(t,e){e===0&&(t.mode&1?(e=jf,jf<<=1,!(jf&130023424)&&(jf=4194304)):e=1);var n=Ar();t=Xs(t,e),t!==null&&(tf(t,e,n),jr(t,n))}function EN(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),mT(t,n)}function AN(t,e){var n=0;switch(t.tag){case 13:var r=t.stateNode,i=t.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=t.stateNode;break;default:throw Error(he(314))}r!==null&&r.delete(e),mT(t,n)}var yT;yT=function(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps||zr.current)$r=!0;else{if(!(t.lanes&n)&&!(e.flags&128))return $r=!1,pN(t,e,n);$r=!!(t.flags&131072)}else $r=!1,wn&&e.flags&1048576&&x2(e,ph,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;Bd(t,e),t=e.pendingProps;var i=ja(e,wr.current);Pa(e,n),i=Av(null,e,r,t,i,n);var s=Mv();return e.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,Br(r)?(s=!0,dh(e)):s=!1,e.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,kv(e),i.updater=vp,e.stateNode=i,i._reactInternals=e,b0(e,r,t,n),e=S0(null,e,r,!0,s,n)):(e.tag=0,wn&&s&&gv(e),Tr(null,e,i,n),e=e.child),e;case 16:r=e.elementType;e:{switch(Bd(t,e),t=e.pendingProps,i=r._init,r=i(r._payload),e.type=r,i=e.tag=RN(r),t=Bi(r,t),i){case 0:e=k0(null,e,r,t,n);break e;case 1:e=sb(null,e,r,t,n);break e;case 11:e=rb(null,e,r,t,n);break e;case 14:e=ib(null,e,r,Bi(r.type,t),n);break e}throw Error(he(306,r,""))}return e;case 0:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Bi(r,i),k0(t,e,r,i,n);case 1:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Bi(r,i),sb(t,e,r,i,n);case 3:e:{if(eT(e),t===null)throw Error(he(387));r=e.pendingProps,s=e.memoizedState,i=s.element,A2(t,e),yh(e,r,null,n);var o=e.memoizedState;if(r=o.element,s.isDehydrated)if(s={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},e.updateQueue.baseState=s,e.memoizedState=s,e.flags&256){i=Ua(Error(he(423)),e),e=ob(t,e,r,n,i);break e}else if(r!==i){i=Ua(Error(he(424)),e),e=ob(t,e,r,n,i);break e}else for(ri=No(e.stateNode.containerInfo.firstChild),ii=e,wn=!0,Hi=null,n=T2(e,null,r,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Ha(),r===i){e=Gs(t,e,n);break e}Tr(t,e,r,n)}e=e.child}return e;case 5:return M2(e),t===null&&y0(e),r=e.type,i=e.pendingProps,s=t!==null?t.memoizedProps:null,o=i.children,d0(r,i)?o=null:s!==null&&d0(r,s)&&(e.flags|=32),Z2(t,e),Tr(t,e,o,n),e.child;case 6:return t===null&&y0(e),null;case 13:return tT(t,e,n);case 4:return Sv(e,e.stateNode.containerInfo),r=e.pendingProps,t===null?e.child=Wa(e,null,r,n):Tr(t,e,r,n),e.child;case 11:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Bi(r,i),rb(t,e,r,i,n);case 7:return Tr(t,e,e.pendingProps,n),e.child;case 8:return Tr(t,e,e.pendingProps.children,n),e.child;case 12:return Tr(t,e,e.pendingProps.children,n),e.child;case 10:e:{if(r=e.type._context,i=e.pendingProps,s=e.memoizedProps,o=i.value,fn(gh,r._currentValue),r._currentValue=o,s!==null)if(Qi(s.value,o)){if(s.children===i.children&&!zr.current){e=Gs(t,e,n);break e}}else for(s=e.child,s!==null&&(s.return=e);s!==null;){var l=s.dependencies;if(l!==null){o=s.child;for(var a=l.firstContext;a!==null;){if(a.context===r){if(s.tag===1){a=Ws(-1,n&-n),a.tag=2;var u=s.updateQueue;if(u!==null){u=u.shared;var c=u.pending;c===null?a.next=a:(a.next=c.next,c.next=a),u.pending=a}}s.lanes|=n,a=s.alternate,a!==null&&(a.lanes|=n),v0(s.return,n,e),l.lanes|=n;break}a=a.next}}else if(s.tag===10)o=s.type===e.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(he(341));o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),v0(o,n,e),o=s.sibling}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===e){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}Tr(t,e,i.children,n),e=e.child}return e;case 9:return i=e.type,r=e.pendingProps.children,Pa(e,n),i=Ci(i),r=r(i),e.flags|=1,Tr(t,e,r,n),e.child;case 14:return r=e.type,i=Bi(r,e.pendingProps),i=Bi(r.type,i),ib(t,e,r,i,n);case 15:return J2(t,e,e.type,e.pendingProps,n);case 17:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Bi(r,i),Bd(t,e),e.tag=1,Br(r)?(t=!0,dh(e)):t=!1,Pa(e,n),G2(e,r,i),b0(e,r,i,n),S0(null,e,r,!0,t,n);case 19:return nT(t,e,n);case 22:return Q2(t,e,n)}throw Error(he(156,e.tag))};function vT(t,e){return UC(t,e)}function MN(t,e,n,r){this.tag=t,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function mi(t,e,n,r){return new MN(t,e,n,r)}function Fv(t){return t=t.prototype,!(!t||!t.isReactComponent)}function RN(t){if(typeof t=="function")return Fv(t)?1:0;if(t!=null){if(t=t.$$typeof,t===rv)return 11;if(t===iv)return 14}return 2}function Lo(t,e){var n=t.alternate;return n===null?(n=mi(t.tag,e,t.key,t.mode),n.elementType=t.elementType,n.type=t.type,n.stateNode=t.stateNode,n.alternate=t,t.alternate=n):(n.pendingProps=e,n.type=t.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=t.flags&14680064,n.childLanes=t.childLanes,n.lanes=t.lanes,n.child=t.child,n.memoizedProps=t.memoizedProps,n.memoizedState=t.memoizedState,n.updateQueue=t.updateQueue,e=t.dependencies,n.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},n.sibling=t.sibling,n.index=t.index,n.ref=t.ref,n}function Wd(t,e,n,r,i,s){var o=2;if(r=t,typeof t=="function")Fv(t)&&(o=1);else if(typeof t=="string")o=5;else e:switch(t){case ca:return Cl(n.children,i,s,e);case nv:o=8,i|=8;break;case Vm:return t=mi(12,n,e,i|2),t.elementType=Vm,t.lanes=s,t;case Um:return t=mi(13,n,e,i),t.elementType=Um,t.lanes=s,t;case Km:return t=mi(19,n,e,i),t.elementType=Km,t.lanes=s,t;case MC:return xp(n,i,s,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case EC:o=10;break e;case AC:o=9;break e;case rv:o=11;break e;case iv:o=14;break e;case mo:o=16,r=null;break e}throw Error(he(130,t==null?t:typeof t,""))}return e=mi(o,n,e,i),e.elementType=t,e.type=r,e.lanes=s,e}function Cl(t,e,n,r){return t=mi(7,t,r,e),t.lanes=n,t}function xp(t,e,n,r){return t=mi(22,t,r,e),t.elementType=MC,t.lanes=n,t.stateNode={isHidden:!1},t}function jg(t,e,n){return t=mi(6,t,null,e),t.lanes=n,t}function Hg(t,e,n){return e=mi(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function ON(t,e,n,r,i){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=kg(0),this.expirationTimes=kg(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=kg(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function zv(t,e,n,r,i,s,o,l,a){return t=new ON(t,e,n,l,a),e===1?(e=1,s===!0&&(e|=8)):e=0,s=mi(3,null,null,e),t.current=s,s.stateNode=t,s.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},kv(s),t}function PN(t,e,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(kT)}catch(t){console.error(t)}}kT(),kC.exports=oi;var LN=kC.exports,ST,vb=LN;ST=vb.createRoot,vb.hydrateRoot;function CT(){return""}function $N(){return/^G-[A-Z0-9]+$/.test(CT())}function FN(){const t=window.gtag;typeof t=="function"&&$N()&&t("config",CT(),{send_page_view:!1})}function zN(){var t,e;(t=window.gtag)==null||t.call(window,"event","page_view",{page_path:window.location.pathname,page_location:window.location.href}),(e=window.plausible)==null||e.call(window,"pageview")}function BN(){var t,e;(t=window.gtag)==null||t.call(window,"event","permalink_view"),(e=window.plausible)==null||e.call(window,"Permalink View")}function jN(){var t,e;(t=window.gtag)==null||t.call(window,"event","changelog_open"),(e=window.plausible)==null||e.call(window,"Changelog Open")}function HN(t){var e,n;(e=window.gtag)==null||e.call(window,"event","changelog_vote",{...t}),(n=window.plausible)==null||n.call(window,"Changelog Vote",{props:{...t}})}function WN(t){return t.charAt(0).toUpperCase()+t.slice(1)}function Ep(t,e){var n,r;(n=window.gtag)==null||n.call(window,"event",t,{...e}),(r=window.plausible)==null||r.call(window,WN(t),{props:{...e}})}function VN(t){Ep("input",t)}function UN(t){Ep("conversion",t)}function nl(t){const e={via:t.via,format:t.format,...t.pane!==void 0?{pane:t.pane}:{},...t.direction!==void 0?{direction:t.direction}:{}};Ep("export",e)}function KN(t){Ep("feedback",t)}function XN(t){return new TextEncoder().encode(t).length}function GN(t){return t<10*1024?"<10KB":t<100*1024?"10-100KB":t<1024*1024?"100KB-1MB":">1MB"}function qN(t){let e=2166136261;for(let n=0;n>>0).toString(36)}function YN(t={}){const e=t.settleMs??2e3,n=t.minWindowMs??2e3,r=t.now??(()=>Date.now()),i=t.isValid??(()=>!0);let s=null,o,l=null,a=0,u=null,c=0;function f(h){if(h.text.trim()==="")return!1;const p=XN(h.text),g=GN(p),b=i(h.direction,h.text),m=`${h.direction}:${h.input}:${p}:${qN(h.text)}`,v=r();return m!==l&&(a===0||v-a>=n)&&(l=m,a=v,VN({direction:h.direction,input:h.input,size:g,valid:b})),!b||m===u||c!==0&&v-c{o=void 0,s&&f(s)},e)}return{edit(h,p){s={direction:h,input:"paste",text:p},d()},discrete(h,p,g){s={direction:h,input:p,text:g},d(),f(s)},cancel(){s=null,l=null,u=null,o&&(clearTimeout(o),o=void 0)}}}/** - * @license lucide-react v1.41.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const TT=(...t)=>t.filter((e,n,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===n).join(" ").trim();/** - * @license lucide-react v1.41.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const JN=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/** - * @license lucide-react v1.41.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const QN=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,n,r)=>r?r.toUpperCase():n.toLowerCase());/** - * @license lucide-react v1.41.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const wb=t=>{const e=QN(t);return e.charAt(0).toUpperCase()+e.slice(1)};/** - * @license lucide-react v1.41.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */var Wg={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** - * @license lucide-react v1.41.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const ZN=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0;return!1},eI=y.createContext({}),tI=()=>y.useContext(eI),nI=y.forwardRef(({color:t,size:e,strokeWidth:n,absoluteStrokeWidth:r,className:i="",children:s,iconNode:o,...l},a)=>{const{size:u=24,strokeWidth:c=2,absoluteStrokeWidth:f=!1,color:d="currentColor",className:h=""}=tI()??{},p=r??f?Number(n??c)*24/Number(e??u):n??c;return y.createElement("svg",{ref:a,...Wg,width:e??u??Wg.width,height:e??u??Wg.height,stroke:t??d,strokeWidth:p,className:TT("lucide",h,i),...!s&&!ZN(l)&&{"aria-hidden":"true"},...l},[...o.map(([g,b])=>y.createElement(g,b)),...Array.isArray(s)?s:[s]])});/** - * @license lucide-react v1.41.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Pn=(t,e)=>{const n=y.forwardRef(({className:r,...i},s)=>y.createElement(nI,{ref:s,iconNode:e,className:TT(`lucide-${JN(wb(t))}`,`lucide-${t}`,r),...i}));return n.displayName=wb(t),n};/** - * @license lucide-react v1.41.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const rI=[["path",{d:"M8 3 4 7l4 4",key:"9rb6wj"}],["path",{d:"M4 7h16",key:"6tx8e3"}],["path",{d:"m16 21 4-4-4-4",key:"siv7j2"}],["path",{d:"M20 17H4",key:"h6l3hr"}]],iI=Pn("arrow-left-right",rI);/** - * @license lucide-react v1.41.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const sI=[["path",{d:"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1",key:"ezmyqa"}],["path",{d:"M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1",key:"e1hn23"}]],bb=Pn("braces",sI);/** - * @license lucide-react v1.41.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const oI=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],lI=Pn("chevron-down",oI);/** - * @license lucide-react v1.41.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const aI=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}]],uI=Pn("clipboard",aI);/** - * @license lucide-react v1.41.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const cI=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]],fI=Pn("clock",cI);/** - * @license lucide-react v1.41.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const dI=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]],hI=Pn("columns-3",dI);/** - * @license lucide-react v1.41.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const pI=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],Wv=Pn("copy",pI);/** - * @license lucide-react v1.41.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const gI=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],ET=Pn("download",gI);/** - * @license lucide-react v1.41.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const mI=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M12 12v6",key:"3ahymv"}],["path",{d:"m15 15-3-3-3 3",key:"15xj92"}]],AT=Pn("file-up",mI);/** - * @license lucide-react v1.41.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const yI=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],vI=Pn("moon",yI);/** - * @license lucide-react v1.41.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const wI=[["path",{d:"m15 14 5-5-5-5",key:"12vg1m"}],["path",{d:"M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13",key:"6uklza"}]],bI=Pn("redo-2",wI);/** - * @license lucide-react v1.41.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const xI=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],kI=Pn("rotate-ccw-clock",xI);/** - * @license lucide-react v1.41.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const SI=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],xb=Pn("rotate-ccw",SI);/** - * @license lucide-react v1.41.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const CI=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],TI=Pn("search",CI);/** - * @license lucide-react v1.41.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const EI=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],AI=Pn("sparkles",EI);/** - * @license lucide-react v1.41.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const MI=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],RI=Pn("sun",MI);/** - * @license lucide-react v1.41.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const OI=[["path",{d:"M12 3v18",key:"108xh3"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}]],PI=Pn("table",OI);/** - * @license lucide-react v1.41.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const NI=[["path",{d:"M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z",key:"m61m77"}],["path",{d:"M17 14V2",key:"8ymqnk"}]],II=Pn("thumbs-down",NI);/** - * @license lucide-react v1.41.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const _I=[["path",{d:"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z",key:"emmmcr"}],["path",{d:"M7 10v12",key:"1qc93n"}]],DI=Pn("thumbs-up",_I);/** - * @license lucide-react v1.41.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const LI=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],Eh=Pn("trash",LI);/** - * @license lucide-react v1.41.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const $I=[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]],FI=Pn("undo-2",$I);/** - * @license lucide-react v1.41.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const zI=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Ah=Pn("x",zI);function MT(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e{const e=WI(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:o=>{const l=o.split(Vv);return l[0]===""&&l.length!==1&&l.shift(),RT(l,e)||HI(o)},getConflictingClassGroupIds:(o,l)=>{const a=n[o]||[];return l&&r[o]?[...a,...r[o]]:a}}},RT=(t,e)=>{var o;if(t.length===0)return e.classGroupId;const n=t[0],r=e.nextPart.get(n),i=r?RT(t.slice(1),r):void 0;if(i)return i;if(e.validators.length===0)return;const s=t.join(Vv);return(o=e.validators.find(({validator:l})=>l(s)))==null?void 0:o.classGroupId},kb=/^\[(.+)\]$/,HI=t=>{if(kb.test(t)){const e=kb.exec(t)[1],n=e==null?void 0:e.substring(0,e.indexOf(":"));if(n)return"arbitrary.."+n}},WI=t=>{const{theme:e,prefix:n}=t,r={nextPart:new Map,validators:[]};return UI(Object.entries(t.classGroups),n).forEach(([s,o])=>{D0(o,r,s,e)}),r},D0=(t,e,n,r)=>{t.forEach(i=>{if(typeof i=="string"){const s=i===""?e:Sb(e,i);s.classGroupId=n;return}if(typeof i=="function"){if(VI(i)){D0(i(r),e,n,r);return}e.validators.push({validator:i,classGroupId:n});return}Object.entries(i).forEach(([s,o])=>{D0(o,Sb(e,s),n,r)})})},Sb=(t,e)=>{let n=t;return e.split(Vv).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},VI=t=>t.isThemeGetter,UI=(t,e)=>e?t.map(([n,r])=>{const i=r.map(s=>typeof s=="string"?e+s:typeof s=="object"?Object.fromEntries(Object.entries(s).map(([o,l])=>[e+o,l])):s);return[n,i]}):t,KI=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=new Map,r=new Map;const i=(s,o)=>{n.set(s,o),e++,e>t&&(e=0,r=n,n=new Map)};return{get(s){let o=n.get(s);if(o!==void 0)return o;if((o=r.get(s))!==void 0)return i(s,o),o},set(s,o){n.has(s)?n.set(s,o):i(s,o)}}},OT="!",XI=t=>{const{separator:e,experimentalParseClassName:n}=t,r=e.length===1,i=e[0],s=e.length,o=l=>{const a=[];let u=0,c=0,f;for(let b=0;bc?f-c:void 0;return{modifiers:a,hasImportantModifier:h,baseClassName:p,maybePostfixModifierPosition:g}};return n?l=>n({className:l,parseClassName:o}):o},GI=t=>{if(t.length<=1)return t;const e=[];let n=[];return t.forEach(r=>{r[0]==="["?(e.push(...n.sort(),r),n=[]):n.push(r)}),e.push(...n.sort()),e},qI=t=>({cache:KI(t.cacheSize),parseClassName:XI(t),...jI(t)}),YI=/\s+/,JI=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i}=e,s=[],o=t.trim().split(YI);let l="";for(let a=o.length-1;a>=0;a-=1){const u=o[a],{modifiers:c,hasImportantModifier:f,baseClassName:d,maybePostfixModifierPosition:h}=n(u);let p=!!h,g=r(p?d.substring(0,h):d);if(!g){if(!p){l=u+(l.length>0?" "+l:l);continue}if(g=r(d),!g){l=u+(l.length>0?" "+l:l);continue}p=!1}const b=GI(c).join(":"),m=f?b+OT:b,v=m+g;if(s.includes(v))continue;s.push(v);const w=i(g,p);for(let k=0;k0?" "+l:l)}return l};function QI(){let t=0,e,n,r="";for(;t{if(typeof t=="string")return t;let e,n="";for(let r=0;rf(c),t());return n=qI(u),r=n.cache.get,i=n.cache.set,s=l,l(a)}function l(a){const u=r(a);if(u)return u;const c=JI(a,n);return i(a,c),c}return function(){return s(QI.apply(null,arguments))}}const dn=t=>{const e=n=>n[t]||[];return e.isThemeGetter=!0,e},NT=/^\[(?:([a-z-]+):)?(.+)\]$/i,e_=/^\d+\/\d+$/,t_=new Set(["px","full","screen"]),n_=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,r_=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,i_=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,s_=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,o_=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ns=t=>Ia(t)||t_.has(t)||e_.test(t),lo=t=>au(t,"length",p_),Ia=t=>!!t&&!Number.isNaN(Number(t)),Vg=t=>au(t,"number",Ia),Lu=t=>!!t&&Number.isInteger(Number(t)),l_=t=>t.endsWith("%")&&Ia(t.slice(0,-1)),vt=t=>NT.test(t),ao=t=>n_.test(t),a_=new Set(["length","size","percentage"]),u_=t=>au(t,a_,IT),c_=t=>au(t,"position",IT),f_=new Set(["image","url"]),d_=t=>au(t,f_,m_),h_=t=>au(t,"",g_),$u=()=>!0,au=(t,e,n)=>{const r=NT.exec(t);return r?r[1]?typeof e=="string"?r[1]===e:e.has(r[1]):n(r[2]):!1},p_=t=>r_.test(t)&&!i_.test(t),IT=()=>!1,g_=t=>s_.test(t),m_=t=>o_.test(t),y_=()=>{const t=dn("colors"),e=dn("spacing"),n=dn("blur"),r=dn("brightness"),i=dn("borderColor"),s=dn("borderRadius"),o=dn("borderSpacing"),l=dn("borderWidth"),a=dn("contrast"),u=dn("grayscale"),c=dn("hueRotate"),f=dn("invert"),d=dn("gap"),h=dn("gradientColorStops"),p=dn("gradientColorStopPositions"),g=dn("inset"),b=dn("margin"),m=dn("opacity"),v=dn("padding"),w=dn("saturate"),k=dn("scale"),x=dn("sepia"),C=dn("skew"),T=dn("space"),A=dn("translate"),M=()=>["auto","contain","none"],N=()=>["auto","hidden","clip","visible","scroll"],D=()=>["auto",vt,e],O=()=>[vt,e],L=()=>["",Ns,lo],_=()=>["auto",Ia,vt],re=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],ie=()=>["solid","dashed","dotted","double","none"],se=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],H=()=>["start","end","center","between","around","evenly","stretch"],X=()=>["","0",vt],R=()=>["auto","avoid","all","avoid-page","page","left","right","column"],I=()=>[Ia,vt];return{cacheSize:500,separator:":",theme:{colors:[$u],spacing:[Ns,lo],blur:["none","",ao,vt],brightness:I(),borderColor:[t],borderRadius:["none","","full",ao,vt],borderSpacing:O(),borderWidth:L(),contrast:I(),grayscale:X(),hueRotate:I(),invert:X(),gap:O(),gradientColorStops:[t],gradientColorStopPositions:[l_,lo],inset:D(),margin:D(),opacity:I(),padding:O(),saturate:I(),scale:I(),sepia:X(),skew:I(),space:O(),translate:O()},classGroups:{aspect:[{aspect:["auto","square","video",vt]}],container:["container"],columns:[{columns:[ao]}],"break-after":[{"break-after":R()}],"break-before":[{"break-before":R()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...re(),vt]}],overflow:[{overflow:N()}],"overflow-x":[{"overflow-x":N()}],"overflow-y":[{"overflow-y":N()}],overscroll:[{overscroll:M()}],"overscroll-x":[{"overscroll-x":M()}],"overscroll-y":[{"overscroll-y":M()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[g]}],"inset-x":[{"inset-x":[g]}],"inset-y":[{"inset-y":[g]}],start:[{start:[g]}],end:[{end:[g]}],top:[{top:[g]}],right:[{right:[g]}],bottom:[{bottom:[g]}],left:[{left:[g]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Lu,vt]}],basis:[{basis:D()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",vt]}],grow:[{grow:X()}],shrink:[{shrink:X()}],order:[{order:["first","last","none",Lu,vt]}],"grid-cols":[{"grid-cols":[$u]}],"col-start-end":[{col:["auto",{span:["full",Lu,vt]},vt]}],"col-start":[{"col-start":_()}],"col-end":[{"col-end":_()}],"grid-rows":[{"grid-rows":[$u]}],"row-start-end":[{row:["auto",{span:[Lu,vt]},vt]}],"row-start":[{"row-start":_()}],"row-end":[{"row-end":_()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",vt]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",vt]}],gap:[{gap:[d]}],"gap-x":[{"gap-x":[d]}],"gap-y":[{"gap-y":[d]}],"justify-content":[{justify:["normal",...H()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...H(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...H(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[v]}],px:[{px:[v]}],py:[{py:[v]}],ps:[{ps:[v]}],pe:[{pe:[v]}],pt:[{pt:[v]}],pr:[{pr:[v]}],pb:[{pb:[v]}],pl:[{pl:[v]}],m:[{m:[b]}],mx:[{mx:[b]}],my:[{my:[b]}],ms:[{ms:[b]}],me:[{me:[b]}],mt:[{mt:[b]}],mr:[{mr:[b]}],mb:[{mb:[b]}],ml:[{ml:[b]}],"space-x":[{"space-x":[T]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[T]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",vt,e]}],"min-w":[{"min-w":[vt,e,"min","max","fit"]}],"max-w":[{"max-w":[vt,e,"none","full","min","max","fit","prose",{screen:[ao]},ao]}],h:[{h:[vt,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[vt,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[vt,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[vt,e,"auto","min","max","fit"]}],"font-size":[{text:["base",ao,lo]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Vg]}],"font-family":[{font:[$u]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",vt]}],"line-clamp":[{"line-clamp":["none",Ia,Vg]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Ns,vt]}],"list-image":[{"list-image":["none",vt]}],"list-style-type":[{list:["none","disc","decimal",vt]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[m]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[m]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ie(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Ns,lo]}],"underline-offset":[{"underline-offset":["auto",Ns,vt]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:O()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",vt]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",vt]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[m]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...re(),c_]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",u_]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},d_]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[p]}],"gradient-via-pos":[{via:[p]}],"gradient-to-pos":[{to:[p]}],"gradient-from":[{from:[h]}],"gradient-via":[{via:[h]}],"gradient-to":[{to:[h]}],rounded:[{rounded:[s]}],"rounded-s":[{"rounded-s":[s]}],"rounded-e":[{"rounded-e":[s]}],"rounded-t":[{"rounded-t":[s]}],"rounded-r":[{"rounded-r":[s]}],"rounded-b":[{"rounded-b":[s]}],"rounded-l":[{"rounded-l":[s]}],"rounded-ss":[{"rounded-ss":[s]}],"rounded-se":[{"rounded-se":[s]}],"rounded-ee":[{"rounded-ee":[s]}],"rounded-es":[{"rounded-es":[s]}],"rounded-tl":[{"rounded-tl":[s]}],"rounded-tr":[{"rounded-tr":[s]}],"rounded-br":[{"rounded-br":[s]}],"rounded-bl":[{"rounded-bl":[s]}],"border-w":[{border:[l]}],"border-w-x":[{"border-x":[l]}],"border-w-y":[{"border-y":[l]}],"border-w-s":[{"border-s":[l]}],"border-w-e":[{"border-e":[l]}],"border-w-t":[{"border-t":[l]}],"border-w-r":[{"border-r":[l]}],"border-w-b":[{"border-b":[l]}],"border-w-l":[{"border-l":[l]}],"border-opacity":[{"border-opacity":[m]}],"border-style":[{border:[...ie(),"hidden"]}],"divide-x":[{"divide-x":[l]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[l]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[m]}],"divide-style":[{divide:ie()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...ie()]}],"outline-offset":[{"outline-offset":[Ns,vt]}],"outline-w":[{outline:[Ns,lo]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:L()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[m]}],"ring-offset-w":[{"ring-offset":[Ns,lo]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",ao,h_]}],"shadow-color":[{shadow:[$u]}],opacity:[{opacity:[m]}],"mix-blend":[{"mix-blend":[...se(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":se()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[a]}],"drop-shadow":[{"drop-shadow":["","none",ao,vt]}],grayscale:[{grayscale:[u]}],"hue-rotate":[{"hue-rotate":[c]}],invert:[{invert:[f]}],saturate:[{saturate:[w]}],sepia:[{sepia:[x]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[a]}],"backdrop-grayscale":[{"backdrop-grayscale":[u]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[c]}],"backdrop-invert":[{"backdrop-invert":[f]}],"backdrop-opacity":[{"backdrop-opacity":[m]}],"backdrop-saturate":[{"backdrop-saturate":[w]}],"backdrop-sepia":[{"backdrop-sepia":[x]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",vt]}],duration:[{duration:I()}],ease:[{ease:["linear","in","out","in-out",vt]}],delay:[{delay:I()}],animate:[{animate:["none","spin","ping","pulse","bounce",vt]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[k]}],"scale-x":[{"scale-x":[k]}],"scale-y":[{"scale-y":[k]}],rotate:[{rotate:[Lu,vt]}],"translate-x":[{"translate-x":[A]}],"translate-y":[{"translate-y":[A]}],"skew-x":[{"skew-x":[C]}],"skew-y":[{"skew-y":[C]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",vt]}],accent:[{accent:["auto",t]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",vt]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":O()}],"scroll-mx":[{"scroll-mx":O()}],"scroll-my":[{"scroll-my":O()}],"scroll-ms":[{"scroll-ms":O()}],"scroll-me":[{"scroll-me":O()}],"scroll-mt":[{"scroll-mt":O()}],"scroll-mr":[{"scroll-mr":O()}],"scroll-mb":[{"scroll-mb":O()}],"scroll-ml":[{"scroll-ml":O()}],"scroll-p":[{"scroll-p":O()}],"scroll-px":[{"scroll-px":O()}],"scroll-py":[{"scroll-py":O()}],"scroll-ps":[{"scroll-ps":O()}],"scroll-pe":[{"scroll-pe":O()}],"scroll-pt":[{"scroll-pt":O()}],"scroll-pr":[{"scroll-pr":O()}],"scroll-pb":[{"scroll-pb":O()}],"scroll-pl":[{"scroll-pl":O()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",vt]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[Ns,lo,Vg]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},v_=ZI(y_);function Un(...t){return v_(BI(t))}function Ug(t){return t==="csv2json"?"CSV → JSON":"JSON → CSV"}function w_({flipped:t}){return E.jsx(iI,{size:18,strokeWidth:2,"aria-hidden":"true",className:Un("transition-transform duration-300",t&&"rotate-180")})}function b_({direction:t,onFlip:e}){return E.jsxs("button",{type:"button","data-testid":"divider-switch",onClick:e,onMouseDown:n=>n.stopPropagation(),onDoubleClick:n=>n.stopPropagation(),title:`Switch direction (currently ${Ug(t)})`,"aria-label":`Switch conversion direction (currently ${Ug(t)})`,className:"flex h-9 cursor-pointer items-center gap-1.5 whitespace-nowrap rounded-full border border-border bg-background px-3 text-xs font-medium text-muted-foreground shadow-sm transition-colors hover:border-muted-foreground/50 hover:text-foreground md:h-8 md:gap-1 md:px-2.5 md:text-[11px]",children:[E.jsx(w_,{flipped:t==="json2csv"}),E.jsx("span",{"data-testid":"divider-switch-label",children:Ug(t)})]})}const _T=[{question:"How does it work?",answer:"Paste CSV or JSON into the left pane and the conversion runs as you type — no upload, no submit button. Flip the direction with the switch between the panes to convert JSON back to CSV, then copy the result or download it as a file. The converter understands quoted fields, embedded separators, and Unicode."},{question:"What do the options do?",answer:"Separator picks the delimiter — auto-detect covers comma, semicolon, and tab. Parse numbers is on by default with smart semantics — plain numbers like 5 or 19.99 become real JSON numbers, while leading-zero values like 00721 and very long IDs stay strings; uncheck it to keep numeric cells as strings — booleans, null, and containers still convert while Parse JSON is on. Parse JSON converts null, true, false, [] and {} cells into real JSON values instead of strings. Transpose flips rows and columns; Hash output makes the first column the object key; Minify removes indentation from JSON output. On the JSON to CSV side, Flatten explodes nested arrays into extra rows with dotted keys."},{question:"TSV vs CSV — what changes?",answer:"Only the delimiter: TSV separates cells with tabs, CSV with commas. Anything you can paste from Excel or Google Sheets is tab-separated, and auto-detect picks that up — or choose Tab in the separator menu. Quoting rules only apply to comma and semicolon output; TSV rarely needs them."},{question:"Does my data ever leave the browser?",answer:"No. The conversion runs entirely in your browser — nothing is uploaded, nothing is stored, nothing is logged. Files you open are read locally in the page, there is no account and no server processing. The site's analytics never see your data: Plausible counts visits cookieless, and the Google tag is a standard conversion-measurement tag that uses the page URL, referrer, and a first-party conversion cookie to measure ad performance. Your files and converted output never leave the browser. When you send feedback, we store your vote and anything you choose to write — nothing else."}],x_={"@context":"https://schema.org","@type":"FAQPage",mainEntity:_T.map(t=>({"@type":"Question",name:t.question,acceptedAnswer:{"@type":"Answer",text:t.answer}}))};function k_(){const[t,e]=y.useState(!1),n=y.useId();return E.jsxs("section",{"data-testid":"faq","aria-label":"How it works and frequently asked questions",className:"flex-shrink-0 border-t border-border bg-panel px-4",children:[E.jsxs("button",{type:"button","data-testid":"faq-toggle","aria-expanded":t,"aria-controls":n,onClick:()=>e(r=>!r),className:"flex w-full cursor-pointer items-center gap-1.5 py-2 text-[12.5px] text-muted-foreground hover:text-foreground",children:[E.jsx("span",{"aria-hidden":"true",className:"w-3 text-center",children:t?"▾":"▸"}),"How it works & FAQ"]}),E.jsx("div",{id:n,"data-testid":"faq-content",hidden:!t,className:"max-w-3xl pb-4 text-[13px] leading-relaxed text-muted-foreground",children:_T.map(r=>E.jsxs("div",{className:"mb-3 last:mb-0",children:[E.jsx("h2",{className:"mb-0.5 text-[11px] font-semibold uppercase tracking-[0.1em] text-foreground",children:r.question}),E.jsx("p",{children:r.answer})]},r.question))}),E.jsx("script",{type:"application/ld+json",dangerouslySetInnerHTML:{__html:JSON.stringify(x_)}})]})}const S_="https://github.com/FlatFilers/csvjson-app/discussions/163";function C_(){return E.jsx("div",{"data-testid":"feedback-banner",className:"flex flex-shrink-0 items-center justify-center border-b border-border bg-muted px-3 py-1.5 text-xs text-muted-foreground sm:px-4 sm:text-sm",children:E.jsxs("p",{className:"text-center",children:["Enjoy a cleaner, simpler CSVJSON."," ",E.jsx("a",{"data-testid":"feedback-link",href:S_,target:"_blank",rel:"noopener noreferrer",className:"rounded-sm font-medium text-foreground underline decoration-border underline-offset-2 transition-colors hover:decoration-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring",children:"Leave feedback or ask for features here"}),"."]})})}const DT="csvjson:feedback.v1",T_=[{value:"wrong_output",label:"The conversion is wrong"},{value:"hard_to_use",label:"Hard to use"},{value:"missing_feature",label:"Missing a feature"},{value:"slower",label:"Slower than the old site"},{value:"looks_worse",label:"Looks worse"},{value:"other",label:"Other"}];function E_(t){if(typeof t!="object"||t===null)return!1;const e=t;return typeof e.clientId=="string"&&e.clientId.length<=64&&(e.vote===1||e.vote===-1)&&(typeof e.reasonCode=="string"||e.reasonCode===null)&&(typeof e.reasonText=="string"||e.reasonText===null)&&typeof e.pending=="boolean"}function Cb(){try{const t=window.localStorage.getItem(DT);if(t===null)return null;const e=JSON.parse(t);return E_(e)?e:null}catch{return null}}function Tb(t){try{window.localStorage.setItem(DT,JSON.stringify(t))}catch{}}function Eb(){var n,r,i;if(typeof((n=globalThis.crypto)==null?void 0:n.randomUUID)=="function")return globalThis.crypto.randomUUID();const t=(i=(r=globalThis.crypto)==null?void 0:r.getRandomValues)==null?void 0:i.call(r,new Uint8Array(16));if(t===void 0)throw new Error("no secure randomness available");t[6]=t[6]&15|64,t[8]=t[8]&63|128;const e=Array.from(t,s=>s.toString(16).padStart(2,"0")).join("");return`${e.slice(0,8)}-${e.slice(8,12)}-${e.slice(12,16)}-${e.slice(16,20)}-${e.slice(20)}`}function A_(t){const e=window.location.pathname;return t.vote===1?{clientId:t.clientId,vote:1,path:e}:{clientId:t.clientId,vote:-1,reasonCode:t.reasonCode,reasonText:t.reasonText,path:e}}async function M_(t){try{return(await fetch("/api/feedback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(A_(t))})).ok?"ok":"failed"}catch{return"failed"}}function Ab(t){return["flex h-7 w-7 cursor-pointer items-center justify-center rounded-md transition-colors",t?"bg-muted text-foreground":"text-muted-foreground hover:bg-muted hover:text-foreground"].join(" ")}function R_(){const[t,e]=y.useState(Cb),[n,r]=y.useState(!1),[i,s]=y.useState(null),[o,l]=y.useState(""),[a,u]=y.useState(!1),[c,f]=y.useState(!1),d=y.useRef(null),h=y.useRef(0),p=y.useCallback((x,C)=>{const T={...x,pending:C==="failed"};Tb(T),e(T),C==="ok"?KN({vote:x.vote,with_reason:x.reasonCode!==null}):u(!1)},[]),g=y.useCallback((x,C)=>{const T=++h.current;C&&f(!0),M_(x).then(A=>{h.current===T&&(p(x,A),A==="ok"&&u(!0))}).finally(()=>{C&&h.current===T&&f(!1)})},[p]),b=x=>{const C={...x,pending:!0};Tb(C),e(C),g(C,!0)},m=y.useRef(!1);y.useEffect(()=>{if(m.current)return;m.current=!0;const x=Cb();x!=null&&x.pending&&g(x,!1)},[g]),y.useEffect(()=>{if(!a)return;const x=setTimeout(()=>u(!1),3e3);return()=>clearTimeout(x)},[a]),y.useEffect(()=>{if(!n)return;const x=T=>{T.key==="Escape"&&r(!1)},C=T=>{const A=d.current;A===null||!(T.target instanceof Node)||A.contains(T.target)||r(!1)};return document.addEventListener("keydown",x),document.addEventListener("mousedown",C),()=>{document.removeEventListener("keydown",x),document.removeEventListener("mousedown",C)}},[n]);const v=()=>{if((t==null?void 0:t.vote)===1&&!t.pending){u(!0);return}b({clientId:(t==null?void 0:t.clientId)??Eb(),vote:1,reasonCode:null,reasonText:null})},w=()=>{if(n){r(!1);return}s(null),l(""),r(!0)},k=()=>{if(i===null)return;const x=o.trim();b({clientId:(t==null?void 0:t.clientId)??Eb(),vote:-1,reasonCode:i,reasonText:x===""?null:x}),r(!1)};return E.jsxs("div",{"data-testid":"feedback-vote",ref:d,className:"relative flex items-center gap-1 max-sm:static",children:[E.jsx("button",{type:"button","data-testid":"feedback-up",onClick:v,"aria-pressed":(t==null?void 0:t.vote)===1,"aria-label":"Helpful — send an upvote",title:"Helpful",className:Ab((t==null?void 0:t.vote)===1),children:E.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[E.jsx("path",{d:"M7 10v12"}),E.jsx("path",{d:"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z"})]})}),E.jsx("button",{type:"button","data-testid":"feedback-down",onClick:w,"aria-pressed":(t==null?void 0:t.vote)===-1,"aria-haspopup":"dialog","aria-expanded":n,"aria-label":"Not helpful — send a downvote",title:"Not helpful",className:Ab((t==null?void 0:t.vote)===-1),children:E.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[E.jsx("path",{d:"M17 14V2"}),E.jsx("path",{d:"M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z"})]})}),a&&E.jsx("span",{"data-testid":"feedback-thanks",className:"text-xs text-muted-foreground",children:"Thanks for the feedback!"}),(t==null?void 0:t.pending)&&!c&&E.jsx("span",{"data-testid":"feedback-pending",role:"status",className:"max-w-44 text-right text-xs text-muted-foreground sm:max-w-none",children:"Feedback couldn't send — your vote is kept on this device and will send automatically once the service is back."}),n&&E.jsxs("div",{"data-testid":"feedback-popover",role:"dialog","aria-label":"What went wrong?",className:"absolute right-0 top-9 z-50 w-72 rounded-md border border-border bg-panel p-3 shadow-md max-sm:inset-x-2 max-sm:top-14 max-sm:w-auto",children:[E.jsx("p",{className:"mb-2 text-xs font-medium text-foreground",children:"What went wrong?"}),E.jsx("div",{className:"mb-2 flex flex-wrap gap-1.5",children:T_.map(x=>E.jsx("button",{type:"button","data-testid":`feedback-reason-${x.value}`,"aria-pressed":i===x.value,onClick:()=>s(x.value),className:["cursor-pointer rounded-sm border px-2 py-0.5 text-xs transition-colors",i===x.value?"border-foreground bg-foreground text-panel":"border-border text-muted-foreground hover:border-foreground hover:text-foreground"].join(" "),children:x.label},x.value))}),E.jsx("textarea",{"data-testid":"feedback-text",value:o,maxLength:500,rows:2,onChange:x=>l(x.target.value),placeholder:"Anything more? (optional)",className:"mb-2 w-full resize-none rounded-sm border border-border bg-panel px-2 py-1 text-xs text-foreground placeholder:text-muted-foreground/60 focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-ring"}),E.jsxs("div",{className:"flex items-center justify-end gap-2",children:[E.jsxs("span",{className:"text-[10px] text-muted-foreground/70",children:[o.length,"/500"]}),E.jsx("button",{type:"button","data-testid":"feedback-submit",onClick:k,disabled:i===null,className:"cursor-pointer rounded-sm border border-border px-2.5 py-1 text-xs font-medium text-foreground transition-colors hover:bg-muted disabled:cursor-not-allowed disabled:opacity-50",children:"Send"})]})]})]})}function LT(t="This should not happen"){throw new Error(t)}function ei(t,e="Assertion failed"){if(!t)return LT(e)}function Wc(t,e){return LT(e??"Hell froze over")}function O_(t,e){try{return t()}catch{return e}}const Mb=Object.prototype.hasOwnProperty;function Xa(t,e){let n,r;if(t===e)return!0;if(t&&e&&(n=t.constructor)===e.constructor){if(n===Date)return t.getTime()===e.getTime();if(n===RegExp)return t.toString()===e.toString();if(n===Array){if((r=t.length)===e.length)for(;r--&&Xa(t[r],e[r]););return r===-1}if(!n||typeof t=="object"){r=0;for(n in t)if(Mb.call(t,n)&&++r&&!Mb.call(e,n)||!(n in e)||!Xa(t[n],e[n]))return!1;return Object.keys(e).length===r}}return t!==t&&e!==e}var P_=Object.prototype,N_=P_.hasOwnProperty;function I_(t,e){return t!=null&&N_.call(t,e)}var __=I_,D_=Array.isArray,Ms=D_,L_=typeof Co=="object"&&Co&&Co.Object===Object&&Co,$T=L_,$_=$T,F_=typeof self=="object"&&self&&self.Object===Object&&self,z_=$_||F_||Function("return this")(),Rs=z_,B_=Rs,j_=B_.Symbol,of=j_,Rb=of,FT=Object.prototype,H_=FT.hasOwnProperty,W_=FT.toString,Fu=Rb?Rb.toStringTag:void 0;function V_(t){var e=H_.call(t,Fu),n=t[Fu];try{t[Fu]=void 0;var r=!0}catch{}var i=W_.call(t);return r&&(e?t[Fu]=n:delete t[Fu]),i}var U_=V_,K_=Object.prototype,X_=K_.toString;function G_(t){return X_.call(t)}var q_=G_,Ob=of,Y_=U_,J_=q_,Q_="[object Null]",Z_="[object Undefined]",Pb=Ob?Ob.toStringTag:void 0;function eD(t){return t==null?t===void 0?Z_:Q_:Pb&&Pb in Object(t)?Y_(t):J_(t)}var lf=eD;function tD(t){return t!=null&&typeof t=="object"}var af=tD,nD=lf,rD=af,iD="[object Symbol]";function sD(t){return typeof t=="symbol"||rD(t)&&nD(t)==iD}var Ap=sD,oD=Ms,lD=Ap,aD=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,uD=/^\w*$/;function cD(t,e){if(oD(t))return!1;var n=typeof t;return n=="number"||n=="symbol"||n=="boolean"||t==null||lD(t)?!0:uD.test(t)||!aD.test(t)||e!=null&&t in Object(e)}var Uv=cD;function fD(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var zl=fD,dD=lf,hD=zl,pD="[object AsyncFunction]",gD="[object Function]",mD="[object GeneratorFunction]",yD="[object Proxy]";function vD(t){if(!hD(t))return!1;var e=dD(t);return e==gD||e==mD||e==pD||e==yD}var zT=vD,wD=Rs,bD=wD["__core-js_shared__"],xD=bD,Kg=xD,Nb=function(){var t=/[^.]+$/.exec(Kg&&Kg.keys&&Kg.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function kD(t){return!!Nb&&Nb in t}var SD=kD,CD=Function.prototype,TD=CD.toString;function ED(t){if(t!=null){try{return TD.call(t)}catch{}try{return t+""}catch{}}return""}var BT=ED,AD=zT,MD=SD,RD=zl,OD=BT,PD=/[\\^$.*+?()[\]{}|]/g,ND=/^\[object .+?Constructor\]$/,ID=Function.prototype,_D=Object.prototype,DD=ID.toString,LD=_D.hasOwnProperty,$D=RegExp("^"+DD.call(LD).replace(PD,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function FD(t){if(!RD(t)||MD(t))return!1;var e=AD(t)?$D:ND;return e.test(OD(t))}var zD=FD;function BD(t,e){return t==null?void 0:t[e]}var jD=BD,HD=zD,WD=jD;function VD(t,e){var n=WD(t,e);return HD(n)?n:void 0}var Bl=VD,UD=Bl,KD=UD(Object,"create"),Mp=KD,Ib=Mp;function XD(){this.__data__=Ib?Ib(null):{},this.size=0}var GD=XD;function qD(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var YD=qD,JD=Mp,QD="__lodash_hash_undefined__",ZD=Object.prototype,eL=ZD.hasOwnProperty;function tL(t){var e=this.__data__;if(JD){var n=e[t];return n===QD?void 0:n}return eL.call(e,t)?e[t]:void 0}var nL=tL,rL=Mp,iL=Object.prototype,sL=iL.hasOwnProperty;function oL(t){var e=this.__data__;return rL?e[t]!==void 0:sL.call(e,t)}var lL=oL,aL=Mp,uL="__lodash_hash_undefined__";function cL(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=aL&&e===void 0?uL:e,this}var fL=cL,dL=GD,hL=YD,pL=nL,gL=lL,mL=fL;function uu(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e-1}var IL=NL,_L=Rp;function DL(t,e){var n=this.__data__,r=_L(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this}var LL=DL,$L=wL,FL=AL,zL=OL,BL=IL,jL=LL;function cu(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e-1&&t%1==0&&t-1&&t%1==0&&t<=Z3}var Qv=e$,t$=Ap;function n$(t){if(typeof t=="string"||t$(t))return t;var e=t+"";return e=="0"&&1/t==-1/0?"-0":e}var Np=n$,r$=WT,i$=Yv,s$=Ms,o$=Jv,l$=Qv,a$=Np;function u$(t,e,n){e=r$(e,t);for(var r=-1,i=e.length,s=!1;++r[r[0]+e,r[1]+e]);return new _s(n)}add(e){const n=typeof e=="number"?[e,e+1]:e,r=m$([...this.items,n]);return new _s(r)}remove(e){const n=[...this.items],r=typeof e=="number"?e:e[0],i=typeof e=="number"?e+1:e[1];for(const[s,o]of n.entries()){const[l,a]=o;if(l<=i&&r<=a){const u=[];l=r&&ejb??(jb=new _s([]))),kt(_s,"fromSingleSelection",e=>_s.empty().add(e));let Pt=_s;function y$(t){var e=Object.create(null);return function(n){return e[n]===void 0&&(e[n]=t(n)),e[n]}}var v$=/^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|disableRemotePlayback|download|draggable|encType|enterKeyHint|fetchpriority|fetchPriority|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|popover|popoverTarget|popoverTargetAction|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/,Xg=y$(function(t){return v$.test(t)||t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&t.charCodeAt(2)<91}),w$=function(){const e=Array.prototype.slice.call(arguments).filter(Boolean),n={},r=[];e.forEach(s=>{(s?s.split(" "):[]).forEach(l=>{if(l.startsWith("atm_")){const[,a]=l.split("_");n[a]=l}else r.push(l)})});const i=[];for(const s in n)Object.prototype.hasOwnProperty.call(n,s)&&i.push(n[s]);return i.push(...r),i.join(" ")},Hb=w$,b$=t=>t.toUpperCase()===t,x$=t=>e=>t.indexOf(e)===-1,KT=(t,e)=>{const n={};return Object.keys(t).filter(x$(e)).forEach(r=>{n[r]=t[r]}),n};function k$(t,e,n){const r=KT(e,n);if(!t){const i=typeof Xg=="function"?{default:Xg}:Xg;Object.keys(r).forEach(s=>{i.default(s)||delete r[s]})}return r}var S$=(t,e)=>{};function C$(t){let e="";return n=>{const r=(s,o)=>{const{as:l=t,class:a=e}=s,u=n.propsAsIs===void 0?!(typeof l=="string"&&l.indexOf("-")===-1&&!b$(l[0])):n.propsAsIs,c=k$(u,s,["as","class"]);c.ref=o,c.className=n.atomic?Hb(n.class,c.className||a):Hb(c.className||a,n.class);const{vars:f}=n;if(f){const d={};for(const g in f){const b=f[g],m=b[0],v=b[1]||"",w=typeof m=="function"?m(s):m;S$(w,n.name),d[`--${g}`]=`${w}${v}`}const h=c.style||{},p=Object.keys(h);p.length>0&&p.forEach(g=>{d[g]=h[g]}),c.style=d}return t.__linaria&&t!==l?(c.as=l,Kn.createElement(t,c)):Kn.createElement(l,c)},i=Kn.forwardRef?Kn.forwardRef(r):s=>{const o=KT(s,["innerRef"]);return r(o,s.innerRef)};return i.displayName=n.name,i.__linaria={className:n.class||e,extends:t},i}}var ai=C$;const T$=ai("div")({name:"ImageOverlayEditorStyle",class:"gdg-i2iowwq",propsAsIs:!1});var XT={},Ip={},ew={},Gg={},qg={exports:{}},Yg,Wb;function E$(){if(Wb)return Yg;Wb=1;var t="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Yg=t,Yg}var Jg,Vb;function A$(){if(Vb)return Jg;Vb=1;var t=E$();function e(){}function n(){}return n.resetWarningCache=e,Jg=function(){function r(o,l,a,u,c,f){if(f!==t){var d=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw d.name="Invariant Violation",d}}r.isRequired=r;function i(){return r}var s={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:i,element:r,elementType:r,instanceOf:i,node:r,objectOf:i,oneOf:i,oneOfType:i,shape:i,exact:i,checkPropTypes:n,resetWarningCache:e};return s.PropTypes=s,s},Jg}var Ub;function M$(){return Ub||(Ub=1,qg.exports=A$()()),qg.exports}var Kb;function R$(){return Kb||(Kb=1,function(t){(function(e,n){n(t,y,M$())})(Co,function(e,n,r){Object.defineProperty(e,"__esModule",{value:!0}),e.setHasSupportToCaptureOption=p;var i=o(n),s=o(r);function o(v){return v&&v.__esModule?v:{default:v}}var l=Object.assign||function(v){for(var w=1;w=0||Object.prototype.hasOwnProperty.call(v,x)&&(k[x]=v[x]);return k}function u(v,w){if(!(v instanceof w))throw new TypeError("Cannot call a class as a function")}var c=function(){function v(w,k){for(var x=0;x0&&arguments[0]!==void 0?arguments[0]:{capture:!0};return h?v:v.capture}function b(v){if("touches"in v){var w=v.touches[0],k=w.pageX,x=w.pageY;return{x:k,y:x}}var C=v.screenX,T=v.screenY;return{x:C,y:T}}var m=function(v){d(w,v);function w(){var k;u(this,w);for(var x=arguments.length,C=Array(x),T=0;TC&&this.props.onSwipeRight(1,x),this.movePosition.deltaY<-C?this.props.onSwipeUp(1,x):this.movePosition.deltaY>C&&this.props.onSwipeDown(1,x)),this.moveStart=null,this.moving=!1,this.movePosition=null}},{key:"_setSwiperRef",value:function(x){this.swiper=x,this.props.innerRef(x)}},{key:"render",value:function(){var x=this.props;x.tagName;var C=x.className,T=x.style,A=x.children;x.allowMouseEvents,x.onSwipeUp,x.onSwipeDown,x.onSwipeLeft,x.onSwipeRight,x.onSwipeStart,x.onSwipeMove,x.onSwipeEnd,x.innerRef,x.tolerance;var M=a(x,["tagName","className","style","children","allowMouseEvents","onSwipeUp","onSwipeDown","onSwipeLeft","onSwipeRight","onSwipeStart","onSwipeMove","onSwipeEnd","innerRef","tolerance"]);return i.default.createElement(this.props.tagName,l({ref:this._setSwiperRef,onMouseDown:this._onMouseDown,onTouchStart:this._handleSwipeStart,onTouchEnd:this._handleSwipeEnd,className:C,style:T},M),A)}}]),w}(n.Component);m.displayName="ReactSwipe",m.propTypes={tagName:s.default.string,className:s.default.string,style:s.default.object,children:s.default.node,allowMouseEvents:s.default.bool,onSwipeUp:s.default.func,onSwipeDown:s.default.func,onSwipeLeft:s.default.func,onSwipeRight:s.default.func,onSwipeStart:s.default.func,onSwipeMove:s.default.func,onSwipeEnd:s.default.func,innerRef:s.default.func,tolerance:s.default.number.isRequired},m.defaultProps={tagName:"div",allowMouseEvents:!1,onSwipeUp:function(){},onSwipeDown:function(){},onSwipeLeft:function(){},onSwipeRight:function(){},onSwipeStart:function(){},onSwipeMove:function(){},onSwipeEnd:function(){},innerRef:function(){},tolerance:0},e.default=m})}(Gg)),Gg}(function(t){(function(e,n){n(t,R$())})(Co,function(e,n){Object.defineProperty(e,"__esModule",{value:!0});var r=i(n);function i(s){return s&&s.__esModule?s:{default:s}}e.default=r.default})})(ew);var uf={},GT={exports:{}};/*! - Copyright (c) 2018 Jed Watson. - Licensed under the MIT License (MIT), see - http://jedwatson.github.io/classnames -*/(function(t){(function(){var e={}.hasOwnProperty;function n(){for(var s="",o=0;o"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}function Oh(t){return Oh=Object.setPrototypeOf?Object.getPrototypeOf:function(n){return n.__proto__||Object.getPrototypeOf(n)},Oh(t)}function pr(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var X$=function(e){return e.hasOwnProperty("key")},tw=function(t){W$(n,t);var e=V$(n);function n(r){var i;return B$(this,n),i=e.call(this,r),pr(Cr(i),"itemsWrapperRef",void 0),pr(Cr(i),"itemsListRef",void 0),pr(Cr(i),"thumbsRef",void 0),pr(Cr(i),"setItemsWrapperRef",function(s){i.itemsWrapperRef=s}),pr(Cr(i),"setItemsListRef",function(s){i.itemsListRef=s}),pr(Cr(i),"setThumbsRef",function(s,o){i.thumbsRef||(i.thumbsRef=[]),i.thumbsRef[o]=s}),pr(Cr(i),"updateSizes",function(){if(!(!i.props.children||!i.itemsWrapperRef||!i.thumbsRef)){var s=Fi.Children.count(i.props.children),o=i.itemsWrapperRef.clientWidth,l=i.props.thumbWidth?i.props.thumbWidth:(0,$$.outerWidth)(i.thumbsRef[0]),a=Math.floor(o/l),u=a0&&(o=0),u===f&&o<0&&(o=0);var d=i.itemsWrapperRef.clientWidth,h=u+100/(d/o);return i.itemsListRef&&["WebkitTransform","MozTransform","MsTransform","OTransform","transform","msTransform"].forEach(function(p){i.itemsListRef.style[p]=(0,Xb.default)(h,"%",i.props.axis)}),!0}),pr(Cr(i),"slideRight",function(s){i.moveTo(i.state.firstItem-(typeof s=="number"?s:1))}),pr(Cr(i),"slideLeft",function(s){i.moveTo(i.state.firstItem+(typeof s=="number"?s:1))}),pr(Cr(i),"moveTo",function(s){s=s<0?0:s,s=s>=i.state.lastPosition?i.state.lastPosition:s,i.setState({firstItem:s})}),i.state={selectedItem:r.selectedItem,swiping:!1,showArrows:!1,firstItem:0,visibleItems:0,lastPosition:0},i}return H$(n,[{key:"componentDidMount",value:function(){this.setupThumbs()}},{key:"componentDidUpdate",value:function(i){this.props.selectedItem!==this.state.selectedItem&&this.setState({selectedItem:this.props.selectedItem,firstItem:this.getFirstItem(this.props.selectedItem)}),this.props.children!==i.children&&this.updateSizes()}},{key:"componentWillUnmount",value:function(){this.destroyThumbs()}},{key:"setupThumbs",value:function(){(0,ed.default)().addEventListener("resize",this.updateSizes),(0,ed.default)().addEventListener("DOMContentLoaded",this.updateSizes),this.updateSizes()}},{key:"destroyThumbs",value:function(){(0,ed.default)().removeEventListener("resize",this.updateSizes),(0,ed.default)().removeEventListener("DOMContentLoaded",this.updateSizes)}},{key:"getFirstItem",value:function(i){var s=i;return i>=this.state.lastPosition&&(s=this.state.lastPosition),i1,o=this.state.showArrows&&this.state.firstItem>0,l=this.state.showArrows&&this.state.firstItemo);if(l)return s<0?e.centerMode&&e.centerSlidePercentage&&e.axis==="horizontal"?r.itemListStyle=(0,ws.setPosition)(-(o+2)*e.centerSlidePercentage-(100-e.centerSlidePercentage)/2,e.axis):r.itemListStyle=(0,ws.setPosition)(-(o+2)*100,e.axis):s>o&&(r.itemListStyle=(0,ws.setPosition)(0,e.axis)),r;var a=(0,ws.getPosition)(i,e),u=(0,rF.default)(a,"%",e.axis),c=e.transitionTime+"ms";return r.itemListStyle={WebkitTransform:u,msTransform:u,OTransform:u,transform:u},n.swiping||(r.itemListStyle=pl(pl({},r.itemListStyle),{},{WebkitTransitionDuration:c,MozTransitionDuration:c,OTransitionDuration:c,transitionDuration:c,msTransitionDuration:c})),r};vs.slideAnimationHandler=oF;var lF=function(e,n,r,i){var s={},o=n.axis==="horizontal",l=YT.Children.count(n.children),a=0,u=(0,ws.getPosition)(r.selectedItem,n),c=n.infiniteLoop?(0,ws.getPosition)(l-1,n)-100:(0,ws.getPosition)(l-1,n),f=o?e.x:e.y,d=f;u===a&&f>0&&(d=0),u===c&&f<0&&(d=0);var h=u+100/(r.itemSize/d),p=Math.abs(f)>n.swipeScrollTolerance;return n.infiniteLoop&&p&&(r.selectedItem===0&&h>-100?h-=l*100:r.selectedItem===l-1&&h<-l*100&&(h+=l*100)),(!n.preventMovementUntilSwipeScrollTolerance||p||r.swipeMovementStarted)&&(r.swipeMovementStarted||i({swipeMovementStarted:!0}),s.itemListStyle=(0,ws.setPosition)(h,n.axis)),p&&!r.cancelClick&&i({cancelClick:!0}),s};vs.slideSwipeAnimationHandler=lF;var aF=function(e,n){var r=(0,ws.getPosition)(n.selectedItem,e),i=(0,ws.setPosition)(r,e.axis);return{itemListStyle:i}};vs.slideStopSwipingHandler=aF;var uF=function(e,n){var r=e.transitionTime+"ms",i="ease-in-out",s={position:"absolute",display:"block",zIndex:-2,minHeight:"100%",opacity:0,top:0,right:0,left:0,bottom:0,transitionTimingFunction:i,msTransitionTimingFunction:i,MozTransitionTimingFunction:i,WebkitTransitionTimingFunction:i,OTransitionTimingFunction:i};return n.swiping||(s=pl(pl({},s),{},{WebkitTransitionDuration:r,MozTransitionDuration:r,OTransitionDuration:r,transitionDuration:r,msTransitionDuration:r})),{slideStyle:s,selectedStyle:pl(pl({},s),{},{opacity:1,position:"relative"}),prevStyle:pl({},s)}};vs.fadeAnimationHandler=uF;Object.defineProperty(Ip,"__esModule",{value:!0});Ip.default=void 0;var Xt=dF(y),cF=df(ew),Ls=df(uf),fF=df(cf),td=df(Lp),nd=df(ff),Zu=ni,Ph=vs;function df(t){return t&&t.__esModule?t:{default:t}}function JT(){if(typeof WeakMap!="function")return null;var t=new WeakMap;return JT=function(){return t},t}function dF(t){if(t&&t.__esModule)return t;if(t===null||hc(t)!=="object"&&typeof t!="function")return{default:t};var e=JT();if(e&&e.has(t))return e.get(t);var n={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i)){var s=r?Object.getOwnPropertyDescriptor(t,i):null;s&&(s.get||s.set)?Object.defineProperty(n,i,s):n[i]=t[i]}return n.default=t,e&&e.set(t,n),n}function hc(t){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?hc=function(n){return typeof n}:hc=function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},hc(t)}function z0(){return z0=Object.assign||function(t){for(var e=1;e"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}function Nh(t){return Nh=Object.setPrototypeOf?Object.getPrototypeOf:function(n){return n.__proto__||Object.getPrototypeOf(n)},Nh(t)}function St(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var nw=function(t){mF(n,t);var e=yF(n);function n(r){var i;hF(this,n),i=e.call(this,r),St(Tt(i),"thumbsRef",void 0),St(Tt(i),"carouselWrapperRef",void 0),St(Tt(i),"listRef",void 0),St(Tt(i),"itemsRef",void 0),St(Tt(i),"timer",void 0),St(Tt(i),"animationHandler",void 0),St(Tt(i),"setThumbsRef",function(o){i.thumbsRef=o}),St(Tt(i),"setCarouselWrapperRef",function(o){i.carouselWrapperRef=o}),St(Tt(i),"setListRef",function(o){i.listRef=o}),St(Tt(i),"setItemsRef",function(o,l){i.itemsRef||(i.itemsRef=[]),i.itemsRef[l]=o}),St(Tt(i),"autoPlay",function(){Xt.Children.count(i.props.children)<=1||(i.clearAutoPlay(),i.props.autoPlay&&(i.timer=setTimeout(function(){i.increment()},i.props.interval)))}),St(Tt(i),"clearAutoPlay",function(){i.timer&&clearTimeout(i.timer)}),St(Tt(i),"resetAutoPlay",function(){i.clearAutoPlay(),i.autoPlay()}),St(Tt(i),"stopOnHover",function(){i.setState({isMouseEntered:!0},i.clearAutoPlay)}),St(Tt(i),"startOnLeave",function(){i.setState({isMouseEntered:!1},i.autoPlay)}),St(Tt(i),"isFocusWithinTheCarousel",function(){return i.carouselWrapperRef?!!((0,td.default)().activeElement===i.carouselWrapperRef||i.carouselWrapperRef.contains((0,td.default)().activeElement)):!1}),St(Tt(i),"navigateWithKeyboard",function(o){if(i.isFocusWithinTheCarousel()){var l=i.props.axis,a=l==="horizontal",u={ArrowUp:38,ArrowRight:39,ArrowDown:40,ArrowLeft:37},c=a?u.ArrowRight:u.ArrowDown,f=a?u.ArrowLeft:u.ArrowUp;c===o.keyCode?i.increment():f===o.keyCode&&i.decrement()}}),St(Tt(i),"updateSizes",function(){if(!(!i.state.initialized||!i.itemsRef||i.itemsRef.length===0)){var o=i.props.axis==="horizontal",l=i.itemsRef[0];if(l){var a=o?l.clientWidth:l.clientHeight;i.setState({itemSize:a}),i.thumbsRef&&i.thumbsRef.updateSizes()}}}),St(Tt(i),"setMountState",function(){i.setState({hasMount:!0}),i.updateSizes()}),St(Tt(i),"handleClickItem",function(o,l){if(Xt.Children.count(i.props.children)!==0){if(i.state.cancelClick){i.setState({cancelClick:!1});return}i.props.onClickItem(o,l),o!==i.state.selectedItem&&i.setState({selectedItem:o})}}),St(Tt(i),"handleOnChange",function(o,l){Xt.Children.count(i.props.children)<=1||i.props.onChange(o,l)}),St(Tt(i),"handleClickThumb",function(o,l){i.props.onClickThumb(o,l),i.moveTo(o)}),St(Tt(i),"onSwipeStart",function(o){i.setState({swiping:!0}),i.props.onSwipeStart(o)}),St(Tt(i),"onSwipeEnd",function(o){i.setState({swiping:!1,cancelClick:!1,swipeMovementStarted:!1}),i.props.onSwipeEnd(o),i.clearAutoPlay(),i.state.autoPlay&&i.autoPlay()}),St(Tt(i),"onSwipeMove",function(o,l){i.props.onSwipeMove(l);var a=i.props.swipeAnimationHandler(o,i.props,i.state,i.setState.bind(Tt(i)));return i.setState(zi({},a)),!!Object.keys(a).length}),St(Tt(i),"decrement",function(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1;i.moveTo(i.state.selectedItem-(typeof o=="number"?o:1))}),St(Tt(i),"increment",function(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1;i.moveTo(i.state.selectedItem+(typeof o=="number"?o:1))}),St(Tt(i),"moveTo",function(o){if(typeof o=="number"){var l=Xt.Children.count(i.props.children)-1;o<0&&(o=i.props.infiniteLoop?l:0),o>l&&(o=i.props.infiniteLoop?0:l),i.selectItem({selectedItem:o}),i.state.autoPlay&&i.state.isMouseEntered===!1&&i.resetAutoPlay()}}),St(Tt(i),"onClickNext",function(){i.increment(1)}),St(Tt(i),"onClickPrev",function(){i.decrement(1)}),St(Tt(i),"onSwipeForward",function(){i.increment(1),i.props.emulateTouch&&i.setState({cancelClick:!0})}),St(Tt(i),"onSwipeBackwards",function(){i.decrement(1),i.props.emulateTouch&&i.setState({cancelClick:!0})}),St(Tt(i),"changeItem",function(o){return function(l){(!(0,Zu.isKeyboardEvent)(l)||l.key==="Enter")&&i.moveTo(o)}}),St(Tt(i),"selectItem",function(o){i.setState(zi({previousItem:i.state.selectedItem},o),function(){i.setState(i.animationHandler(i.props,i.state))}),i.handleOnChange(o.selectedItem,Xt.Children.toArray(i.props.children)[o.selectedItem])}),St(Tt(i),"getInitialImage",function(){var o=i.props.selectedItem,l=i.itemsRef&&i.itemsRef[o],a=l&&l.getElementsByTagName("img")||[];return a[0]}),St(Tt(i),"getVariableItemHeight",function(o){var l=i.itemsRef&&i.itemsRef[o];if(i.state.hasMount&&l&&l.children.length){var a=l.children[0].getElementsByTagName("img")||[];if(a.length>0){var u=a[0];if(!u.complete){var c=function h(){i.forceUpdate(),u.removeEventListener("load",h)};u.addEventListener("load",c)}}var f=a[0]||l.children[0],d=f.clientHeight;return d>0?d:null}return null});var s={initialized:!1,previousItem:r.selectedItem,selectedItem:r.selectedItem,hasMount:!1,isMouseEntered:!1,autoPlay:r.autoPlay,swiping:!1,swipeMovementStarted:!1,cancelClick:!1,itemSize:1,itemListStyle:{},slideStyle:{},selectedStyle:{},prevStyle:{}};return i.animationHandler=typeof r.animationHandler=="function"&&r.animationHandler||r.animationHandler==="fade"&&Ph.fadeAnimationHandler||Ph.slideAnimationHandler,i.state=zi(zi({},s),i.animationHandler(r,s)),i}return gF(n,[{key:"componentDidMount",value:function(){this.props.children&&this.setupCarousel()}},{key:"componentDidUpdate",value:function(i,s){!i.children&&this.props.children&&!this.state.initialized&&this.setupCarousel(),!i.autoFocus&&this.props.autoFocus&&this.forceFocus(),s.swiping&&!this.state.swiping&&this.setState(zi({},this.props.stopSwipingHandler(this.props,this.state))),(i.selectedItem!==this.props.selectedItem||i.centerMode!==this.props.centerMode)&&(this.updateSizes(),this.moveTo(this.props.selectedItem)),i.autoPlay!==this.props.autoPlay&&(this.props.autoPlay?this.setupAutoPlay():this.destroyAutoPlay(),this.setState({autoPlay:this.props.autoPlay}))}},{key:"componentWillUnmount",value:function(){this.destroyCarousel()}},{key:"setupCarousel",value:function(){var i=this;this.bindEvents(),this.state.autoPlay&&Xt.Children.count(this.props.children)>1&&this.setupAutoPlay(),this.props.autoFocus&&this.forceFocus(),this.setState({initialized:!0},function(){var s=i.getInitialImage();s&&!s.complete?s.addEventListener("load",i.setMountState):i.setMountState()})}},{key:"destroyCarousel",value:function(){this.state.initialized&&(this.unbindEvents(),this.destroyAutoPlay())}},{key:"setupAutoPlay",value:function(){this.autoPlay();var i=this.carouselWrapperRef;this.props.stopOnHover&&i&&(i.addEventListener("mouseenter",this.stopOnHover),i.addEventListener("mouseleave",this.startOnLeave))}},{key:"destroyAutoPlay",value:function(){this.clearAutoPlay();var i=this.carouselWrapperRef;this.props.stopOnHover&&i&&(i.removeEventListener("mouseenter",this.stopOnHover),i.removeEventListener("mouseleave",this.startOnLeave))}},{key:"bindEvents",value:function(){(0,nd.default)().addEventListener("resize",this.updateSizes),(0,nd.default)().addEventListener("DOMContentLoaded",this.updateSizes),this.props.useKeyboardArrows&&(0,td.default)().addEventListener("keydown",this.navigateWithKeyboard)}},{key:"unbindEvents",value:function(){(0,nd.default)().removeEventListener("resize",this.updateSizes),(0,nd.default)().removeEventListener("DOMContentLoaded",this.updateSizes);var i=this.getInitialImage();i&&i.removeEventListener("load",this.setMountState),this.props.useKeyboardArrows&&(0,td.default)().removeEventListener("keydown",this.navigateWithKeyboard)}},{key:"forceFocus",value:function(){var i;(i=this.carouselWrapperRef)===null||i===void 0||i.focus()}},{key:"renderItems",value:function(i){var s=this;return this.props.children?Xt.Children.map(this.props.children,function(o,l){var a=l===s.state.selectedItem,u=l===s.state.previousItem,c=a&&s.state.selectedStyle||u&&s.state.prevStyle||s.state.slideStyle||{};s.props.centerMode&&s.props.axis==="horizontal"&&(c=zi(zi({},c),{},{minWidth:s.props.centerSlidePercentage+"%"})),s.state.swiping&&s.state.swipeMovementStarted&&(c=zi(zi({},c),{},{pointerEvents:"none"}));var f={ref:function(h){return s.setItemsRef(h,l)},key:"itemKey"+l+(i?"clone":""),className:Ls.default.ITEM(!0,l===s.state.selectedItem,l===s.state.previousItem),onClick:s.handleClickItem.bind(s,l,o),style:c};return Xt.default.createElement("li",f,s.props.renderItem(o,{isSelected:l===s.state.selectedItem,isPrevious:l===s.state.previousItem}))}):[]}},{key:"renderControls",value:function(){var i=this,s=this.props,o=s.showIndicators,l=s.labels,a=s.renderIndicator,u=s.children;return o?Xt.default.createElement("ul",{className:"control-dots"},Xt.Children.map(u,function(c,f){return a&&a(i.changeItem(f),f===i.state.selectedItem,f,l.item)})):null}},{key:"renderStatus",value:function(){return this.props.showStatus?Xt.default.createElement("p",{className:"carousel-status"},this.props.statusFormatter(this.state.selectedItem+1,Xt.Children.count(this.props.children))):null}},{key:"renderThumbs",value:function(){return!this.props.showThumbs||!this.props.children||Xt.Children.count(this.props.children)===0?null:Xt.default.createElement(fF.default,{ref:this.setThumbsRef,onSelectItem:this.handleClickThumb,selectedItem:this.state.selectedItem,transitionTime:this.props.transitionTime,thumbWidth:this.props.thumbWidth,labels:this.props.labels,emulateTouch:this.props.emulateTouch},this.props.renderThumbs(this.props.children))}},{key:"render",value:function(){var i=this;if(!this.props.children||Xt.Children.count(this.props.children)===0)return null;var s=this.props.swipeable&&Xt.Children.count(this.props.children)>1,o=this.props.axis==="horizontal",l=this.props.showArrows&&Xt.Children.count(this.props.children)>1,a=l&&(this.state.selectedItem>0||this.props.infiniteLoop)||!1,u=l&&(this.state.selectedItem=e||T<0||f&&A>=s}function m(){var C=Qg();if(b(C))return v(C);l=setTimeout(m,g(C))}function v(C){return l=void 0,d&&r?h(C):(r=i=void 0,o)}function w(){l!==void 0&&clearTimeout(l),u=0,r=a=i=l=void 0}function k(){return l===void 0?o:v(Qg())}function x(){var C=Qg(),T=b(C);if(r=arguments,i=this,a=C,T){if(l===void 0)return p(a);if(f)return clearTimeout(l),l=setTimeout(m,e),h(a)}return l===void 0&&(l=setTimeout(m,e)),o}return x.cancel=w,x.flush=k,x}var QT=HF;const ZT=es(QT);function rr(t,e,n,r,i=!1){const s=y.useRef();s.current=e,y.useEffect(()=>{if(n===null||n.addEventListener===void 0)return;const o=n,l=a=>{var u;(u=s.current)==null||u.call(o,a)};return o.addEventListener(t,l,{passive:r,capture:i}),()=>{o.removeEventListener(t,l,{capture:i})}},[t,n,r,i])}function na(t,e){return t===void 0?void 0:e}const WF=Math.PI;function Zb(t){return t*WF/180}const eE=(t,e,n)=>({x1:t-n/2,y1:e-n/2,x2:t+n/2,y2:e+n/2}),tE=(t,e,n,r,i)=>{switch(t){case"left":return Math.floor(e)+r+i/2;case"center":return Math.floor(e+n/2);case"right":return Math.floor(e+n)-r-i/2}},nE=(t,e,n)=>Math.min(t,e-n*2),rE=(t,e,n)=>n.x1<=t&&t<=n.x2&&n.y1<=e&&e<=n.y2,iw=t=>{const e=t.fgColor??"currentColor";return y.createElement("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},y.createElement("path",{d:"M12.7073 7.05029C7.87391 11.8837 10.4544 9.30322 6.03024 13.7273C5.77392 13.9836 5.58981 14.3071 5.50189 14.6587L4.52521 18.5655C4.38789 19.1148 4.88543 19.6123 5.43472 19.475L9.34146 18.4983C9.69313 18.4104 10.0143 18.2286 10.2706 17.9722L16.9499 11.2929",stroke:e,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:"none",vectorEffect:"non-scaling-stroke"}),y.createElement("path",{d:"M20.4854 4.92901L19.0712 3.5148C18.2901 2.73375 17.0238 2.73375 16.2428 3.5148L14.475 5.28257C15.5326 7.71912 16.4736 8.6278 18.7176 9.52521L20.4854 7.75744C21.2665 6.97639 21.2665 5.71006 20.4854 4.92901Z",stroke:e,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:"none",vectorEffect:"non-scaling-stroke"}))},VF=t=>{const e=t.fgColor??"currentColor";return y.createElement("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},y.createElement("path",{d:"M19 6L10.3802 17L5.34071 11.8758",vectorEffect:"non-scaling-stroke",stroke:e,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}))};function UF(t,e,n){const[r,i]=y.useState(t),s=y.useRef(!0);y.useEffect(()=>()=>{s.current=!1},[]);const o=y.useRef(ZT(l=>{s.current&&i(l)},n));return y.useLayoutEffect(()=>{s.current&&o.current(()=>t())},e),r}const KF="֑-߿יִ-﷽ﹰ-ﻼ",XF="A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿",GF=new RegExp("^[^"+XF+"]*["+KF+"]");function sw(t){return GF.test(t)?"rtl":"not-rtl"}let rd;function j0(){if(typeof document>"u")return 0;if(rd!==void 0)return rd;const t=document.createElement("p");t.style.width="100%",t.style.height="200px";const e=document.createElement("div");e.id="testScrollbar",e.style.position="absolute",e.style.top="0px",e.style.left="0px",e.style.visibility="hidden",e.style.width="200px",e.style.height="150px",e.style.overflow="hidden",e.append(t),document.body.append(e);const n=t.offsetWidth;e.style.overflow="scroll";let r=t.offsetWidth;return n===r&&(r=e.clientWidth),e.remove(),rd=n-r,rd}const il=Symbol();function qF(t){const e=y.useRef([il,t]);e.current[1]!==t&&(e.current[0]=t),e.current[1]=t;const[n,r]=y.useState(t),[,i]=y.useState(),s=y.useCallback(l=>{const a=e.current[0];a!==il&&(l=typeof l=="function"?l(a):l,l===a)||(a!==il&&i({}),r(u=>typeof l=="function"?l(a===il?u:a):l),e.current[0]=il)},[]),o=y.useCallback(()=>{e.current[0]=il,i({})},[]);return[e.current[0]===il?n:e.current[0],s,o]}function iE(t){if(t.length===0)return"";let e=0,n=0;for(const r of t){if(n+=r.length,n>1e4)break;e++}return t.slice(0,e).join(", ")}function YF(t){const e=y.useRef(t);return Xa(t,e.current)||(e.current=t),e.current}const JF=t=>{const{urls:e,canWrite:n,onEditClick:r,renderImage:i}=t,s=e.filter(l=>l!=="");if(s.length===0)return null;const o=s.length>1;return y.createElement(T$,{"data-testid":"GDG-default-image-overlay-editor"},y.createElement(XT.Carousel,{showArrows:o,showThumbs:!1,swipeable:o,emulateTouch:o,infiniteLoop:o},s.map(l=>{const a=(i==null?void 0:i(l))??y.createElement("img",{draggable:!1,src:l});return y.createElement("div",{className:"gdg-centering-container",key:l},a)})),n&&r&&y.createElement("button",{className:"gdg-edit-icon",onClick:r},y.createElement(iw,null)))};function sE(){return{async:!1,baseUrl:null,breaks:!1,extensions:null,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,hooks:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}let jl=sE();function QF(t){jl=t}const oE=/[&<>"']/,ZF=new RegExp(oE.source,"g"),lE=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,e4=new RegExp(lE.source,"g"),t4={"&":"&","<":"<",">":">",'"':""","'":"'"},ex=t=>t4[t];function gr(t,e){if(e){if(oE.test(t))return t.replace(ZF,ex)}else if(lE.test(t))return t.replace(e4,ex);return t}const n4=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function aE(t){return t.replace(n4,(e,n)=>(n=n.toLowerCase(),n==="colon"?":":n.charAt(0)==="#"?n.charAt(1)==="x"?String.fromCharCode(parseInt(n.substring(2),16)):String.fromCharCode(+n.substring(1)):""))}const r4=/(^|[^\[])\^/g;function ln(t,e){t=typeof t=="string"?t:t.source,e=e||"";const n={replace:(r,i)=>(i=i.source||i,i=i.replace(r4,"$1"),t=t.replace(r,i),n),getRegex:()=>new RegExp(t,e)};return n}const i4=/[^\w:]/g,s4=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function tx(t,e,n){if(t){let r;try{r=decodeURIComponent(aE(n)).replace(i4,"").toLowerCase()}catch{return null}if(r.indexOf("javascript:")===0||r.indexOf("vbscript:")===0||r.indexOf("data:")===0)return null}e&&!s4.test(n)&&(n=u4(e,n));try{n=encodeURI(n).replace(/%25/g,"%")}catch{return null}return n}const id={},o4=/^[^:]+:\/*[^/]*$/,l4=/^([^:]+:)[\s\S]*$/,a4=/^([^:]+:\/*[^/]*)[\s\S]*$/;function u4(t,e){id[" "+t]||(o4.test(t)?id[" "+t]=t+"/":id[" "+t]=Vd(t,"/",!0)),t=id[" "+t];const n=t.indexOf(":")===-1;return e.substring(0,2)==="//"?n?e:t.replace(l4,"$1")+e:e.charAt(0)==="/"?n?e:t.replace(a4,"$1")+e:t+e}const Ih={exec:function(){}};function nx(t,e){const n=t.replace(/\|/g,(s,o,l)=>{let a=!1,u=o;for(;--u>=0&&l[u]==="\\";)a=!a;return a?"|":" |"}),r=n.split(/ \|/);let i=0;if(r[0].trim()||r.shift(),r.length>0&&!r[r.length-1].trim()&&r.pop(),r.length>e)r.splice(e);else for(;r.length1;)e&1&&(n+=t),e>>=1,t+=t;return n+t}function ix(t,e,n,r){const i=e.href,s=e.title?gr(e.title):null,o=t[1].replace(/\\([\[\]])/g,"$1");if(t[0].charAt(0)!=="!"){r.state.inLink=!0;const l={type:"link",raw:n,href:i,title:s,text:o,tokens:r.inlineTokens(o)};return r.state.inLink=!1,l}return{type:"image",raw:n,href:i,title:s,text:gr(o)}}function d4(t,e){const n=t.match(/^(\s+)(?:```)/);if(n===null)return e;const r=n[1];return e.split(` -`).map(i=>{const s=i.match(/^\s+/);if(s===null)return i;const[o]=s;return o.length>=r.length?i.slice(r.length):i}).join(` -`)}class ow{constructor(e){this.options=e||jl}space(e){const n=this.rules.block.newline.exec(e);if(n&&n[0].length>0)return{type:"space",raw:n[0]}}code(e){const n=this.rules.block.code.exec(e);if(n){const r=n[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:n[0],codeBlockStyle:"indented",text:this.options.pedantic?r:Vd(r,` -`)}}}fences(e){const n=this.rules.block.fences.exec(e);if(n){const r=n[0],i=d4(r,n[3]||"");return{type:"code",raw:r,lang:n[2]?n[2].trim().replace(this.rules.inline._escapes,"$1"):n[2],text:i}}}heading(e){const n=this.rules.block.heading.exec(e);if(n){let r=n[2].trim();if(/#$/.test(r)){const i=Vd(r,"#");(this.options.pedantic||!i||/ $/.test(i))&&(r=i.trim())}return{type:"heading",raw:n[0],depth:n[1].length,text:r,tokens:this.lexer.inline(r)}}}hr(e){const n=this.rules.block.hr.exec(e);if(n)return{type:"hr",raw:n[0]}}blockquote(e){const n=this.rules.block.blockquote.exec(e);if(n){const r=n[0].replace(/^ *>[ \t]?/gm,""),i=this.lexer.state.top;this.lexer.state.top=!0;const s=this.lexer.blockTokens(r);return this.lexer.state.top=i,{type:"blockquote",raw:n[0],tokens:s,text:r}}}list(e){let n=this.rules.block.list.exec(e);if(n){let r,i,s,o,l,a,u,c,f,d,h,p,g=n[1].trim();const b=g.length>1,m={type:"list",raw:"",ordered:b,start:b?+g.slice(0,-1):"",loose:!1,items:[]};g=b?`\\d{1,9}\\${g.slice(-1)}`:`\\${g}`,this.options.pedantic&&(g=b?g:"[*+-]");const v=new RegExp(`^( {0,3}${g})((?:[ ][^\\n]*)?(?:\\n|$))`);for(;e&&(p=!1,!(!(n=v.exec(e))||this.rules.block.hr.test(e)));){if(r=n[0],e=e.substring(r.length),c=n[2].split(` -`,1)[0].replace(/^\t+/,k=>" ".repeat(3*k.length)),f=e.split(` -`,1)[0],this.options.pedantic?(o=2,h=c.trimLeft()):(o=n[2].search(/[^ ]/),o=o>4?1:o,h=c.slice(o),o+=n[1].length),a=!1,!c&&/^ *$/.test(f)&&(r+=f+` -`,e=e.substring(f.length+1),p=!0),!p){const k=new RegExp(`^ {0,${Math.min(3,o-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),x=new RegExp(`^ {0,${Math.min(3,o-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),C=new RegExp(`^ {0,${Math.min(3,o-1)}}(?:\`\`\`|~~~)`),T=new RegExp(`^ {0,${Math.min(3,o-1)}}#`);for(;e&&(d=e.split(` -`,1)[0],f=d,this.options.pedantic&&(f=f.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),!(C.test(f)||T.test(f)||k.test(f)||x.test(e)));){if(f.search(/[^ ]/)>=o||!f.trim())h+=` -`+f.slice(o);else{if(a||c.search(/[^ ]/)>=4||C.test(c)||T.test(c)||x.test(c))break;h+=` -`+f}!a&&!f.trim()&&(a=!0),r+=d+` -`,e=e.substring(d.length+1),c=f.slice(o)}}m.loose||(u?m.loose=!0:/\n *\n *$/.test(r)&&(u=!0)),this.options.gfm&&(i=/^\[[ xX]\] /.exec(h),i&&(s=i[0]!=="[ ] ",h=h.replace(/^\[[ xX]\] +/,""))),m.items.push({type:"list_item",raw:r,task:!!i,checked:s,loose:!1,text:h}),m.raw+=r}m.items[m.items.length-1].raw=r.trimRight(),m.items[m.items.length-1].text=h.trimRight(),m.raw=m.raw.trimRight();const w=m.items.length;for(l=0;lC.type==="space"),x=k.length>0&&k.some(C=>/\n.*\n/.test(C.raw));m.loose=x}if(m.loose)for(l=0;l$/,"$1").replace(this.rules.inline._escapes,"$1"):"",s=n[3]?n[3].substring(1,n[3].length-1).replace(this.rules.inline._escapes,"$1"):n[3];return{type:"def",tag:r,raw:n[0],href:i,title:s}}}table(e){const n=this.rules.block.table.exec(e);if(n){const r={type:"table",header:nx(n[1]).map(i=>({text:i})),align:n[2].replace(/^ *|\| *$/g,"").split(/ *\| */),rows:n[3]&&n[3].trim()?n[3].replace(/\n[ \t]*$/,"").split(` -`):[]};if(r.header.length===r.align.length){r.raw=n[0];let i=r.align.length,s,o,l,a;for(s=0;s({text:u}));for(i=r.header.length,o=0;o/i.test(n[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(n[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(n[0])&&(this.lexer.state.inRawBlock=!1),{type:this.options.sanitize?"text":"html",raw:n[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(n[0]):gr(n[0]):n[0]}}link(e){const n=this.rules.inline.link.exec(e);if(n){const r=n[2].trim();if(!this.options.pedantic&&/^$/.test(r))return;const o=Vd(r.slice(0,-1),"\\");if((r.length-o.length)%2===0)return}else{const o=c4(n[2],"()");if(o>-1){const a=(n[0].indexOf("!")===0?5:4)+n[1].length+o;n[2]=n[2].substring(0,o),n[0]=n[0].substring(0,a).trim(),n[3]=""}}let i=n[2],s="";if(this.options.pedantic){const o=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(i);o&&(i=o[1],s=o[3])}else s=n[3]?n[3].slice(1,-1):"";return i=i.trim(),/^$/.test(r)?i=i.slice(1):i=i.slice(1,-1)),ix(n,{href:i&&i.replace(this.rules.inline._escapes,"$1"),title:s&&s.replace(this.rules.inline._escapes,"$1")},n[0],this.lexer)}}reflink(e,n){let r;if((r=this.rules.inline.reflink.exec(e))||(r=this.rules.inline.nolink.exec(e))){let i=(r[2]||r[1]).replace(/\s+/g," ");if(i=n[i.toLowerCase()],!i){const s=r[0].charAt(0);return{type:"text",raw:s,text:s}}return ix(r,i,r[0],this.lexer)}}emStrong(e,n,r=""){let i=this.rules.inline.emStrong.lDelim.exec(e);if(!i||i[3]&&r.match(/[\p{L}\p{N}]/u))return;const s=i[1]||i[2]||"";if(!s||s&&(r===""||this.rules.inline.punctuation.exec(r))){const o=i[0].length-1;let l,a,u=o,c=0;const f=i[0][0]==="*"?this.rules.inline.emStrong.rDelimAst:this.rules.inline.emStrong.rDelimUnd;for(f.lastIndex=0,n=n.slice(-1*e.length+o);(i=f.exec(n))!=null;){if(l=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!l)continue;if(a=l.length,i[3]||i[4]){u+=a;continue}else if((i[5]||i[6])&&o%3&&!((o+a)%3)){c+=a;continue}if(u-=a,u>0)continue;a=Math.min(a,a+u+c);const d=e.slice(0,o+i.index+(i[0].length-l.length)+a);if(Math.min(o,a)%2){const p=d.slice(1,-1);return{type:"em",raw:d,text:p,tokens:this.lexer.inlineTokens(p)}}const h=d.slice(2,-2);return{type:"strong",raw:d,text:h,tokens:this.lexer.inlineTokens(h)}}}}codespan(e){const n=this.rules.inline.code.exec(e);if(n){let r=n[2].replace(/\n/g," ");const i=/[^ ]/.test(r),s=/^ /.test(r)&&/ $/.test(r);return i&&s&&(r=r.substring(1,r.length-1)),r=gr(r,!0),{type:"codespan",raw:n[0],text:r}}}br(e){const n=this.rules.inline.br.exec(e);if(n)return{type:"br",raw:n[0]}}del(e){const n=this.rules.inline.del.exec(e);if(n)return{type:"del",raw:n[0],text:n[2],tokens:this.lexer.inlineTokens(n[2])}}autolink(e,n){const r=this.rules.inline.autolink.exec(e);if(r){let i,s;return r[2]==="@"?(i=gr(this.options.mangle?n(r[1]):r[1]),s="mailto:"+i):(i=gr(r[1]),s=i),{type:"link",raw:r[0],text:i,href:s,tokens:[{type:"text",raw:i,text:i}]}}}url(e,n){let r;if(r=this.rules.inline.url.exec(e)){let i,s;if(r[2]==="@")i=gr(this.options.mangle?n(r[0]):r[0]),s="mailto:"+i;else{let o;do o=r[0],r[0]=this.rules.inline._backpedal.exec(r[0])[0];while(o!==r[0]);i=gr(r[0]),r[1]==="www."?s="http://"+r[0]:s=r[0]}return{type:"link",raw:r[0],text:i,href:s,tokens:[{type:"text",raw:i,text:i}]}}}inlineText(e,n){const r=this.rules.inline.text.exec(e);if(r){let i;return this.lexer.state.inRawBlock?i=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(r[0]):gr(r[0]):r[0]:i=gr(this.options.smartypants?n(r[0]):r[0]),{type:"text",raw:r[0],text:i}}}}const Je={newline:/^(?: *(?:\n|$))+/,code:/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,hr:/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/,html:"^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|\\n*|$)|\\n*|$)|)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))",def:/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/,table:Ih,lheading:/^((?:.|\n(?!\n))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,text:/^[^\n]+/};Je._label=/(?!\s*\])(?:\\.|[^\[\]\\])+/;Je._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/;Je.def=ln(Je.def).replace("label",Je._label).replace("title",Je._title).getRegex();Je.bullet=/(?:[*+-]|\d{1,9}[.)])/;Je.listItemStart=ln(/^( *)(bull) */).replace("bull",Je.bullet).getRegex();Je.list=ln(Je.list).replace(/bull/g,Je.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+Je.def.source+")").getRegex();Je._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul";Je._comment=/|$)/;Je.html=ln(Je.html,"i").replace("comment",Je._comment).replace("tag",Je._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();Je.paragraph=ln(Je._paragraph).replace("hr",Je.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",Je._tag).getRegex();Je.blockquote=ln(Je.blockquote).replace("paragraph",Je.paragraph).getRegex();Je.normal={...Je};Je.gfm={...Je.normal,table:"^ *([^\\n ].*\\|.*)\\n {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"};Je.gfm.table=ln(Je.gfm.table).replace("hr",Je.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",Je._tag).getRegex();Je.gfm.paragraph=ln(Je._paragraph).replace("hr",Je.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("table",Je.gfm.table).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",Je._tag).getRegex();Je.pedantic={...Je.normal,html:ln(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Je._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Ih,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:ln(Je.normal._paragraph).replace("hr",Je.hr).replace("heading",` *#{1,6} *[^ -]`).replace("lheading",Je.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()};const De={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:Ih,tag:"^comment|^|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(ref)\]/,nolink:/^!?\[(ref)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",emStrong:{lDelim:/^(?:\*+(?:([punct_])|[^\s*]))|^_+(?:([punct*])|([^\s_]))/,rDelimAst:/^(?:[^_*\\]|\\.)*?\_\_(?:[^_*\\]|\\.)*?\*(?:[^_*\\]|\\.)*?(?=\_\_)|(?:[^*\\]|\\.)+(?=[^*])|[punct_](\*+)(?=[\s]|$)|(?:[^punct*_\s\\]|\\.)(\*+)(?=[punct_\s]|$)|[punct_\s](\*+)(?=[^punct*_\s])|[\s](\*+)(?=[punct_])|[punct_](\*+)(?=[punct_])|(?:[^punct*_\s\\]|\\.)(\*+)(?=[^punct*_\s])/,rDelimUnd:/^(?:[^_*\\]|\\.)*?\*\*(?:[^_*\\]|\\.)*?\_(?:[^_*\\]|\\.)*?(?=\*\*)|(?:[^_\\]|\\.)+(?=[^_])|[punct*](\_+)(?=[\s]|$)|(?:[^punct*_\s\\]|\\.)(\_+)(?=[punct*\s]|$)|[punct*\s](\_+)(?=[^punct*_\s])|[\s](\_+)(?=[punct*])|[punct*](\_+)(?=[punct*])/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:Ih,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\?@\\[\\]`^{|}~";De.punctuation=ln(De.punctuation).replace(/punctuation/g,De._punctuation).getRegex();De.blockSkip=/\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g;De.escapedEmSt=/(?:^|[^\\])(?:\\\\)*\\[*_]/g;De._comment=ln(Je._comment).replace("(?:-->|$)","-->").getRegex();De.emStrong.lDelim=ln(De.emStrong.lDelim).replace(/punct/g,De._punctuation).getRegex();De.emStrong.rDelimAst=ln(De.emStrong.rDelimAst,"g").replace(/punct/g,De._punctuation).getRegex();De.emStrong.rDelimUnd=ln(De.emStrong.rDelimUnd,"g").replace(/punct/g,De._punctuation).getRegex();De._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g;De._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/;De._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/;De.autolink=ln(De.autolink).replace("scheme",De._scheme).replace("email",De._email).getRegex();De._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/;De.tag=ln(De.tag).replace("comment",De._comment).replace("attribute",De._attribute).getRegex();De._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;De._href=/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/;De._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/;De.link=ln(De.link).replace("label",De._label).replace("href",De._href).replace("title",De._title).getRegex();De.reflink=ln(De.reflink).replace("label",De._label).replace("ref",Je._label).getRegex();De.nolink=ln(De.nolink).replace("ref",Je._label).getRegex();De.reflinkSearch=ln(De.reflinkSearch,"g").replace("reflink",De.reflink).replace("nolink",De.nolink).getRegex();De.normal={...De};De.pedantic={...De.normal,strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:ln(/^!?\[(label)\]\((.*?)\)/).replace("label",De._label).getRegex(),reflink:ln(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",De._label).getRegex()};De.gfm={...De.normal,escape:ln(De.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\.5&&(r="x"+r.toString(16)),e+="&#"+r+";";return e}class Bo{constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||jl,this.options.tokenizer=this.options.tokenizer||new ow,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const n={block:Je.normal,inline:De.normal};this.options.pedantic?(n.block=Je.pedantic,n.inline=De.pedantic):this.options.gfm&&(n.block=Je.gfm,this.options.breaks?n.inline=De.breaks:n.inline=De.gfm),this.tokenizer.rules=n}static get rules(){return{block:Je,inline:De}}static lex(e,n){return new Bo(n).lex(e)}static lexInline(e,n){return new Bo(n).inlineTokens(e)}lex(e){e=e.replace(/\r\n|\r/g,` -`),this.blockTokens(e,this.tokens);let n;for(;n=this.inlineQueue.shift();)this.inlineTokens(n.src,n.tokens);return this.tokens}blockTokens(e,n=[]){this.options.pedantic?e=e.replace(/\t/g," ").replace(/^ +$/gm,""):e=e.replace(/^( *)(\t+)/gm,(l,a,u)=>a+" ".repeat(u.length));let r,i,s,o;for(;e;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some(l=>(r=l.call({lexer:this},e,n))?(e=e.substring(r.raw.length),n.push(r),!0):!1))){if(r=this.tokenizer.space(e)){e=e.substring(r.raw.length),r.raw.length===1&&n.length>0?n[n.length-1].raw+=` -`:n.push(r);continue}if(r=this.tokenizer.code(e)){e=e.substring(r.raw.length),i=n[n.length-1],i&&(i.type==="paragraph"||i.type==="text")?(i.raw+=` -`+r.raw,i.text+=` -`+r.text,this.inlineQueue[this.inlineQueue.length-1].src=i.text):n.push(r);continue}if(r=this.tokenizer.fences(e)){e=e.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.heading(e)){e=e.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.hr(e)){e=e.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.blockquote(e)){e=e.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.list(e)){e=e.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.html(e)){e=e.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.def(e)){e=e.substring(r.raw.length),i=n[n.length-1],i&&(i.type==="paragraph"||i.type==="text")?(i.raw+=` -`+r.raw,i.text+=` -`+r.raw,this.inlineQueue[this.inlineQueue.length-1].src=i.text):this.tokens.links[r.tag]||(this.tokens.links[r.tag]={href:r.href,title:r.title});continue}if(r=this.tokenizer.table(e)){e=e.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.lheading(e)){e=e.substring(r.raw.length),n.push(r);continue}if(s=e,this.options.extensions&&this.options.extensions.startBlock){let l=1/0;const a=e.slice(1);let u;this.options.extensions.startBlock.forEach(function(c){u=c.call({lexer:this},a),typeof u=="number"&&u>=0&&(l=Math.min(l,u))}),l<1/0&&l>=0&&(s=e.substring(0,l+1))}if(this.state.top&&(r=this.tokenizer.paragraph(s))){i=n[n.length-1],o&&i.type==="paragraph"?(i.raw+=` -`+r.raw,i.text+=` -`+r.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=i.text):n.push(r),o=s.length!==e.length,e=e.substring(r.raw.length);continue}if(r=this.tokenizer.text(e)){e=e.substring(r.raw.length),i=n[n.length-1],i&&i.type==="text"?(i.raw+=` -`+r.raw,i.text+=` -`+r.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=i.text):n.push(r);continue}if(e){const l="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(l);break}else throw new Error(l)}}return this.state.top=!0,n}inline(e,n=[]){return this.inlineQueue.push({src:e,tokens:n}),n}inlineTokens(e,n=[]){let r,i,s,o=e,l,a,u;if(this.tokens.links){const c=Object.keys(this.tokens.links);if(c.length>0)for(;(l=this.tokenizer.rules.inline.reflinkSearch.exec(o))!=null;)c.includes(l[0].slice(l[0].lastIndexOf("[")+1,-1))&&(o=o.slice(0,l.index)+"["+rx("a",l[0].length-2)+"]"+o.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(l=this.tokenizer.rules.inline.blockSkip.exec(o))!=null;)o=o.slice(0,l.index)+"["+rx("a",l[0].length-2)+"]"+o.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(l=this.tokenizer.rules.inline.escapedEmSt.exec(o))!=null;)o=o.slice(0,l.index+l[0].length-2)+"++"+o.slice(this.tokenizer.rules.inline.escapedEmSt.lastIndex),this.tokenizer.rules.inline.escapedEmSt.lastIndex--;for(;e;)if(a||(u=""),a=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some(c=>(r=c.call({lexer:this},e,n))?(e=e.substring(r.raw.length),n.push(r),!0):!1))){if(r=this.tokenizer.escape(e)){e=e.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.tag(e)){e=e.substring(r.raw.length),i=n[n.length-1],i&&r.type==="text"&&i.type==="text"?(i.raw+=r.raw,i.text+=r.text):n.push(r);continue}if(r=this.tokenizer.link(e)){e=e.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(r.raw.length),i=n[n.length-1],i&&r.type==="text"&&i.type==="text"?(i.raw+=r.raw,i.text+=r.text):n.push(r);continue}if(r=this.tokenizer.emStrong(e,o,u)){e=e.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.codespan(e)){e=e.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.br(e)){e=e.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.del(e)){e=e.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.autolink(e,sx)){e=e.substring(r.raw.length),n.push(r);continue}if(!this.state.inLink&&(r=this.tokenizer.url(e,sx))){e=e.substring(r.raw.length),n.push(r);continue}if(s=e,this.options.extensions&&this.options.extensions.startInline){let c=1/0;const f=e.slice(1);let d;this.options.extensions.startInline.forEach(function(h){d=h.call({lexer:this},f),typeof d=="number"&&d>=0&&(c=Math.min(c,d))}),c<1/0&&c>=0&&(s=e.substring(0,c+1))}if(r=this.tokenizer.inlineText(s,h4)){e=e.substring(r.raw.length),r.raw.slice(-1)!=="_"&&(u=r.raw.slice(-1)),a=!0,i=n[n.length-1],i&&i.type==="text"?(i.raw+=r.raw,i.text+=r.text):n.push(r);continue}if(e){const c="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(c);break}else throw new Error(c)}}return n}}class lw{constructor(e){this.options=e||jl}code(e,n,r){const i=(n||"").match(/\S*/)[0];if(this.options.highlight){const s=this.options.highlight(e,i);s!=null&&s!==e&&(r=!0,e=s)}return e=e.replace(/\n$/,"")+` -`,i?'
'+(r?e:gr(e,!0))+`
-`:"
"+(r?e:gr(e,!0))+`
-`}blockquote(e){return`
-${e}
-`}html(e){return e}heading(e,n,r,i){if(this.options.headerIds){const s=this.options.headerPrefix+i.slug(r);return`${e} -`}return`${e} -`}hr(){return this.options.xhtml?`
-`:`
-`}list(e,n,r){const i=n?"ol":"ul",s=n&&r!==1?' start="'+r+'"':"";return"<"+i+s+`> -`+e+" -`}listitem(e){return`
  • ${e}
  • -`}checkbox(e){return" "}paragraph(e){return`

    ${e}

    -`}table(e,n){return n&&(n=`${n}`),` - -`+e+` -`+n+`
    -`}tablerow(e){return` -${e} -`}tablecell(e,n){const r=n.header?"th":"td";return(n.align?`<${r} align="${n.align}">`:`<${r}>`)+e+` -`}strong(e){return`${e}`}em(e){return`${e}`}codespan(e){return`${e}`}br(){return this.options.xhtml?"
    ":"
    "}del(e){return`${e}`}link(e,n,r){if(e=tx(this.options.sanitize,this.options.baseUrl,e),e===null)return r;let i='",i}image(e,n,r){if(e=tx(this.options.sanitize,this.options.baseUrl,e),e===null)return r;let i=`${r}":">",i}text(e){return e}}class uE{strong(e){return e}em(e){return e}codespan(e){return e}del(e){return e}html(e){return e}text(e){return e}link(e,n,r){return""+r}image(e,n,r){return""+r}br(){return""}}class cE{constructor(){this.seen={}}serialize(e){return e.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-")}getNextSafeSlug(e,n){let r=e,i=0;if(this.seen.hasOwnProperty(r)){i=this.seen[e];do i++,r=e+"-"+i;while(this.seen.hasOwnProperty(r))}return n||(this.seen[e]=i,this.seen[r]=0),r}slug(e,n={}){const r=this.serialize(e);return this.getNextSafeSlug(r,n.dryrun)}}let hf=class H0{constructor(e){this.options=e||jl,this.options.renderer=this.options.renderer||new lw,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new uE,this.slugger=new cE}static parse(e,n){return new H0(n).parse(e)}static parseInline(e,n){return new H0(n).parseInline(e)}parse(e,n=!0){let r="",i,s,o,l,a,u,c,f,d,h,p,g,b,m,v,w,k,x,C;const T=e.length;for(i=0;i0&&v.tokens[0].type==="paragraph"?(v.tokens[0].text=x+" "+v.tokens[0].text,v.tokens[0].tokens&&v.tokens[0].tokens.length>0&&v.tokens[0].tokens[0].type==="text"&&(v.tokens[0].tokens[0].text=x+" "+v.tokens[0].tokens[0].text)):v.tokens.unshift({type:"text",text:x}):m+=x),m+=this.parse(v.tokens,b),d+=this.renderer.listitem(m,k,w);r+=this.renderer.list(d,p,g);continue}case"html":{r+=this.renderer.html(h.text);continue}case"paragraph":{r+=this.renderer.paragraph(this.parseInline(h.tokens));continue}case"text":{for(d=h.tokens?this.parseInline(h.tokens):h.text;i+1{if(r.message+=` -Please report this to https://github.com/markedjs/marked.`,t){const i="

    An error occurred:

    "+gr(r.message+"",!0)+"
    ";if(e)return Promise.resolve(i);if(n){n(null,i);return}return i}if(e)return Promise.reject(r);if(n){n(r);return}throw r}}function fE(t,e){return(n,r,i)=>{typeof r=="function"&&(i=r,r=null);const s={...r};r={...et.defaults,...s};const o=p4(r.silent,r.async,i);if(typeof n>"u"||n===null)return o(new Error("marked(): input parameter is undefined or null"));if(typeof n!="string")return o(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(n)+", string expected"));if(f4(r),r.hooks&&(r.hooks.options=r),i){const l=r.highlight;let a;try{r.hooks&&(n=r.hooks.preprocess(n)),a=t(n,r)}catch(f){return o(f)}const u=function(f){let d;if(!f)try{r.walkTokens&&et.walkTokens(a,r.walkTokens),d=e(a,r),r.hooks&&(d=r.hooks.postprocess(d))}catch(h){f=h}return r.highlight=l,f?o(f):i(null,d)};if(!l||l.length<3||(delete r.highlight,!a.length))return u();let c=0;et.walkTokens(a,function(f){f.type==="code"&&(c++,setTimeout(()=>{l(f.text,f.lang,function(d,h){if(d)return u(d);h!=null&&h!==f.text&&(f.text=h,f.escaped=!0),c--,c===0&&u()})},0))}),c===0&&u();return}if(r.async)return Promise.resolve(r.hooks?r.hooks.preprocess(n):n).then(l=>t(l,r)).then(l=>r.walkTokens?Promise.all(et.walkTokens(l,r.walkTokens)).then(()=>l):l).then(l=>e(l,r)).then(l=>r.hooks?r.hooks.postprocess(l):l).catch(o);try{r.hooks&&(n=r.hooks.preprocess(n));const l=t(n,r);r.walkTokens&&et.walkTokens(l,r.walkTokens);let a=e(l,r);return r.hooks&&(a=r.hooks.postprocess(a)),a}catch(l){return o(l)}}}function et(t,e,n){return fE(Bo.lex,hf.parse)(t,e,n)}et.options=et.setOptions=function(t){return et.defaults={...et.defaults,...t},QF(et.defaults),et};et.getDefaults=sE;et.defaults=jl;et.use=function(...t){const e=et.defaults.extensions||{renderers:{},childTokens:{}};t.forEach(n=>{const r={...n};if(r.async=et.defaults.async||r.async||!1,n.extensions&&(n.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if(i.renderer){const s=e.renderers[i.name];s?e.renderers[i.name]=function(...o){let l=i.renderer.apply(this,o);return l===!1&&(l=s.apply(this,o)),l}:e.renderers[i.name]=i.renderer}if(i.tokenizer){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");e[i.level]?e[i.level].unshift(i.tokenizer):e[i.level]=[i.tokenizer],i.start&&(i.level==="block"?e.startBlock?e.startBlock.push(i.start):e.startBlock=[i.start]:i.level==="inline"&&(e.startInline?e.startInline.push(i.start):e.startInline=[i.start]))}i.childTokens&&(e.childTokens[i.name]=i.childTokens)}),r.extensions=e),n.renderer){const i=et.defaults.renderer||new lw;for(const s in n.renderer){const o=i[s];i[s]=(...l)=>{let a=n.renderer[s].apply(i,l);return a===!1&&(a=o.apply(i,l)),a}}r.renderer=i}if(n.tokenizer){const i=et.defaults.tokenizer||new ow;for(const s in n.tokenizer){const o=i[s];i[s]=(...l)=>{let a=n.tokenizer[s].apply(i,l);return a===!1&&(a=o.apply(i,l)),a}}r.tokenizer=i}if(n.hooks){const i=et.defaults.hooks||new _h;for(const s in n.hooks){const o=i[s];_h.passThroughHooks.has(s)?i[s]=l=>{if(et.defaults.async)return Promise.resolve(n.hooks[s].call(i,l)).then(u=>o.call(i,u));const a=n.hooks[s].call(i,l);return o.call(i,a)}:i[s]=(...l)=>{let a=n.hooks[s].apply(i,l);return a===!1&&(a=o.apply(i,l)),a}}r.hooks=i}if(n.walkTokens){const i=et.defaults.walkTokens;r.walkTokens=function(s){let o=[];return o.push(n.walkTokens.call(this,s)),i&&(o=o.concat(i.call(this,s))),o}}et.setOptions(r)})};et.walkTokens=function(t,e){let n=[];for(const r of t)switch(n=n.concat(e.call(et,r)),r.type){case"table":{for(const i of r.header)n=n.concat(et.walkTokens(i.tokens,e));for(const i of r.rows)for(const s of i)n=n.concat(et.walkTokens(s.tokens,e));break}case"list":{n=n.concat(et.walkTokens(r.items,e));break}default:et.defaults.extensions&&et.defaults.extensions.childTokens&&et.defaults.extensions.childTokens[r.type]?et.defaults.extensions.childTokens[r.type].forEach(function(i){n=n.concat(et.walkTokens(r[i],e))}):r.tokens&&(n=n.concat(et.walkTokens(r.tokens,e)))}return n};et.parseInline=fE(Bo.lexInline,hf.parseInline);et.Parser=hf;et.parser=hf.parse;et.Renderer=lw;et.TextRenderer=uE;et.Lexer=Bo;et.lexer=Bo.lex;et.Tokenizer=ow;et.Slugger=cE;et.Hooks=_h;et.parse=et;et.options;et.setOptions;et.use;et.walkTokens;et.parseInline;hf.parse;Bo.lex;const g4=ai("div")({name:"MarkdownContainer",class:"gdg-mnuv029",propsAsIs:!1});class m4 extends Kn.PureComponent{constructor(){super(...arguments);kt(this,"targetElement",null);kt(this,"containerRefHook",n=>{this.targetElement=n,this.renderMarkdownIntoDiv()})}renderMarkdownIntoDiv(){const{targetElement:n,props:r}=this;if(n===null)return;const{contents:i,createNode:s}=r,o=et(i),l=document.createRange();l.selectNodeContents(n),l.deleteContents();let a=s==null?void 0:s(o);if(a===void 0){const c=document.createElement("template");c.innerHTML=o,a=c.content}n.append(a);const u=n.getElementsByTagName("a");for(const c of u)c.target="_blank",c.rel="noreferrer noopener"}render(){return this.renderMarkdownIntoDiv(),Kn.createElement(g4,{ref:this.containerRefHook})}}const y4=ai("textarea")({name:"InputBox",class:"gdg-izpuzkl",propsAsIs:!1}),v4=ai("div")({name:"ShadowBox",class:"gdg-s69h75o",propsAsIs:!1}),w4=ai("div")({name:"GrowingEntryStyle",class:"gdg-g1y0xocz",propsAsIs:!1});let ox=0;const $p=t=>{const{placeholder:e,value:n,onKeyDown:r,highlight:i,altNewline:s,validatedSelection:o,...l}=t,{onChange:a,className:u}=l,c=y.useRef(null),f=n??"";ei(a!==void 0,"GrowingEntry must be a controlled input area");const[d]=y.useState(()=>"input-box-"+(ox=(ox+1)%1e7));y.useEffect(()=>{const p=c.current;if(p===null||p.disabled)return;const g=f.toString().length;p.focus(),p.setSelectionRange(i?0:g,g)},[]),y.useLayoutEffect(()=>{var p;if(o!==void 0){const g=typeof o=="number"?[o,null]:o;(p=c.current)==null||p.setSelectionRange(g[0],g[1])}},[o]);const h=y.useCallback(p=>{p.key==="Enter"&&p.shiftKey&&s===!0||r==null||r(p)},[s,r]);return y.createElement(w4,{className:"gdg-growing-entry"},y.createElement(v4,{className:u},f+` -`),y.createElement(y4,{...l,className:(u??"")+" gdg-input",id:d,ref:c,onKeyDown:h,value:f,placeholder:e,dir:"auto"}))},Zg={};let co=null;function b4(){const t=document.createElement("div");return t.style.opacity="0",t.style.pointerEvents="none",t.style.position="fixed",document.body.append(t),t}function W0(t){const e=t.toLowerCase().trim();if(Zg[e]!==void 0)return Zg[e];co=co||b4(),co.style.color="#000",co.style.color=e;const n=getComputedStyle(co).color;co.style.color="#fff",co.style.color=e;const r=getComputedStyle(co).color;if(r!==n)return[0,0,0,1];let i=r.replace(/[^\d.,]/g,"").split(",").map(Number.parseFloat);return i.length<4&&i.push(1),i=i.map(s=>Number.isNaN(s)?0:s),Zg[e]=i,i}function Nl(t,e){const[n,r,i]=W0(t);return`rgba(${n}, ${r}, ${i}, ${e})`}const lx=new Map;function ax(t,e){const n=`${t}-${e}`,r=lx.get(n);if(r!==void 0)return r;const i=ti(t,e);return lx.set(n,i),i}function ti(t,e){if(e===void 0)return t;const[n,r,i,s]=W0(t);if(s===1)return t;const[o,l,a,u]=W0(e),c=s+u*(1-s),f=(s*n+u*o*(1-s))/c,d=(s*r+u*l*(1-s))/c,h=(s*i+u*a*(1-s))/c;return`rgba(${f}, ${d}, ${h}, ${c})`}var la=new Map,ka=new Map,V0=new Map;function x4(){la.clear(),V0.clear(),ka.clear()}function k4(t,e,n,r,i){var s,o,l;let a=0,u={};for(let f of t)a+=(s=n.get(f))!=null?s:i,u[f]=((o=u[f])!=null?o:0)+1;let c=e-a;for(let f of Object.keys(u)){let d=u[f],h=(l=n.get(f))!=null?l:i,p=h*d/a,g=c*p*r/d,b=h+g;n.set(f,b)}}function S4(t,e){var n;let r=new Map,i=0;for(let u of"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890,.-+=?"){let c=t.measureText(u).width;r.set(u,c),i+=c}let s=i/r.size,o=3,l=(e/s+o)/(o+1),a=r.keys();for(let u of a)r.set(u,((n=r.get(u))!=null?n:s)*l);return r}function pc(t,e,n,r){var i,s;let o=ka.get(n);if(r&&o!==void 0&&o.count>2e4){let u=V0.get(n);if(u===void 0&&(u=S4(t,o.size),V0.set(n,u)),o.count>5e5){let f=0;for(let d of e)f+=(i=u.get(d))!=null?i:o.size;return f*1.01}let c=t.measureText(e);return k4(e,c.width,u,Math.max(.05,1-o.count/2e5),o.size),ka.set(n,{count:o.count+e.length,size:o.size}),c.width}let l=t.measureText(e),a=l.width/e.length;if(((s=o==null?void 0:o.count)!=null?s:0)>2e4)return l.width;if(o===void 0)ka.set(n,{count:e.length,size:a});else{let u=a-o.size,c=e.length/(o.count+e.length),f=o.size+u*c;ka.set(n,{count:o.count+e.length,size:f})}return l.width}function C4(t,e,n,r,i,s,o,l){if(e.length<=1)return e.length;if(in;){let c=e.lastIndexOf(" ",a-1);c>0?a=c:a--,u=pc(t,e.slice(0,Math.max(0,a)),r,o)}if(e[a]!==" "){let c=0;c=e.lastIndexOf(" ",a),c>0&&(a=c)}return a}function T4(t,e,n,r,i,s){let o=`${e}_${n}_${r}px`,l=la.get(o);if(l!==void 0)return l;if(r<=0)return[];let a=[],u=e.split(` -`),c=ka.get(n),f=c===void 0?e.length:r/c.size*1.5,d=i&&c!==void 0&&c.count>2e4;for(let h of u){let p=pc(t,h.slice(0,Math.max(0,f)),n,d),g=Math.min(h.length,f);if(p<=r)a.push(h);else{for(;p>r;){let b=C4(t,h,r,n,p,g,d),m=h.slice(0,Math.max(0,b));h=h.slice(m.length),a.push(m),p=pc(t,h.slice(0,Math.max(0,f)),n,d),g=Math.min(h.length,f)}p>0&&a.push(h)}}return a=a.map((h,p)=>p===0?h.trimEnd():h.trim()),la.set(o,a),la.size>500&&la.delete(la.keys().next().value),a}function E4(t,e){return Kn.useMemo(()=>t.map((n,r)=>({group:n.group,grow:n.grow,hasMenu:n.hasMenu,icon:n.icon,id:n.id,menuIcon:n.menuIcon,overlayIcon:n.overlayIcon,sourceIndex:r,sticky:r=s.x&&n=s.y&&r=e.span[0]&&n.current.cell[0]<=e.span[1]}function dE(t,e){const[n,r]=t;return n>=e.x&&n=e.y&&ro)return!1;if(e.span===void 0)return l>=r&&l<=i;const[u,c]=e.span;return u>=r&&u<=i||c>=r&&u<=i||ui}function R4(t,e,n,r){let i=0;if(n.current===void 0)return i;const s=n.current.range;(r||s.height*s.width>1)&&ux(t,e,s)&&i++;for(const o of n.current.rangeStack)ux(t,e,o)&&i++;return i}function pE(t,e){let n=t;if(e!==void 0){let r=[...t];const i=n[e.src];e.src>e.dest?(r.splice(e.src,1),r.splice(e.dest,0,i)):(r.splice(e.dest+1,0,i),r.splice(e.src,1)),r=r.map((s,o)=>({...s,sticky:t[o].sticky})),n=r}return n}function Ga(t,e){let n=0;const r=pE(t,e);for(let i=0;i0)for(const u of o)n-=u.width;let l=e,a=i??0;for(;a<=n&&l=f)return g}const d=s-u,h=t-(a??0);if(typeof o=="number"){const p=Math.floor((h-c)/o)+l;return p>=d?void 0:p}else{let p=c;for(let g=l;g"u";async function I4(){var t;N4||((t=document==null?void 0:document.fonts)==null?void 0:t.ready)===void 0||(await document.fonts.ready,Ud=0,mc={},x4())}I4();function gE(t,e,n,r){return`${t}_${r??(e==null?void 0:e.font)}_${n}`}function pf(t,e,n,r="middle"){const i=gE(t,e,r,n);let s=mc[i];return s===void 0&&(s=e.measureText(t),mc[i]=s,Ud++),Ud>1e4&&(mc={},Ud=0),s}function _4(t,e){const n=gE(t,void 0,"middle",e);return mc[n]}function Js(t,e){return typeof e!="string"&&(e=e.baseFontFull),D4(t,e)}function cx(t,e){const n="ABCDEFGHIJKLMNOPQRSTUVWXYZ";t.save(),t.textBaseline=e;const r=t.measureText(n);return t.restore(),r}const fx=[];function D4(t,e){for(const s of fx)if(s.key===e)return s.val;const n=cx(t,"alphabetic"),i=-(cx(t,"middle").actualBoundingBoxDescent-n.actualBoundingBoxDescent)+n.actualBoundingBoxAscent/2;return fx.push({key:e,val:i}),i}function L4(t,e,n,r,i,s){const{ctx:o,rect:l,theme:a}=t;let u=Number.MAX_SAFE_INTEGER;const c=500;if(e!==void 0&&(u=n-e,un&&(t=t.slice(0,n)),t}function F4(t,e,n,r,i,s,o,l,a,u){const c=l.baseFontFull,f=T4(t,e,c,i-l.cellHorizontalPadding*2,u??!1),d=yE(t,c),h=l.lineHeight*d,p=d+h*(f.length-1),g=p+l.cellVerticalPadding>s;g&&(t.save(),t.rect(n,r,i,s),t.clip());const b=r+s/2-p/2;let m=Math.max(r+l.cellVerticalPadding,b);for(const v of f)if(mE(t,v,n,m,i,d,o,l,a),m+=h,m>r+s)break;g&&t.restore()}function Fs(t,e,n,r,i){const{ctx:s,rect:o,theme:l}=t,{x:a,y:u,width:c,height:f}=o;r=r??!1,r||(e=$4(e,c));const d=Js(s,l),h=sw(e)==="rtl";if(n===void 0&&h&&(n="right"),h&&(s.direction="rtl"),e.length>0){let p=!1;n==="right"?(s.textAlign="right",p=!0):n!==void 0&&n!=="left"&&(s.textAlign=n,p=!0),r?F4(s,e,a,u,c,f,d,l,n,i):mE(s,e,a,u,c,f,d,l,n),p&&(s.textAlign="start"),h&&(s.direction="inherit")}}function Ts(t,e,n,r,i,s){typeof s=="number"&&(s={tl:s,tr:s,br:s,bl:s}),s={tl:Math.max(0,Math.min(s.tl,i/2,r/2)),tr:Math.max(0,Math.min(s.tr,i/2,r/2)),bl:Math.max(0,Math.min(s.bl,i/2,r/2)),br:Math.max(0,Math.min(s.br,i/2,r/2))},t.moveTo(e+s.tl,n),t.arcTo(e+r,n,e+r,n+s.tr,s.tr),t.arcTo(e+r,n+i,e+r-s.br,n+i,s.br),t.arcTo(e,n+i,e,n+i-s.bl,s.bl),t.arcTo(e,n,e+s.tl,n,s.tl)}function z4(t,e,n){t.arc(e,n-1.25*3.5,1.25,0,2*Math.PI,!1),t.arc(e,n,1.25,0,2*Math.PI,!1),t.arc(e,n+1.25*3.5,1.25,0,2*Math.PI,!1)}function B4(t,e,n){const r=function(l,a){const u=a.x-l.x,c=a.y-l.y,f=Math.sqrt(u*u+c*c),d=u/f,h=c/f;return{x:u,y:a.y-l.y,len:f,nx:d,ny:h,ang:Math.atan2(h,d)}};let i;const s=e.length;let o=e[s-1];for(let l=0;l1?1:d),g=1,b=!1;h<0?p<0?p=Math.PI+p:(p=Math.PI-p,g=-1,b=!0):p>0&&(g=-1,b=!0),i=a.radius!==void 0?a.radius:n;const m=p/2;let v=Math.abs(Math.cos(m)*i/Math.sin(m)),w;v>Math.min(c.len/2,f.len/2)?(v=Math.min(c.len/2,f.len/2),w=Math.abs(v*Math.sin(m)/Math.cos(m))):w=i;let k=a.x+f.nx*v,x=a.y+f.ny*v;k+=-f.ny*w*g,x+=f.nx*w*g,t.arc(k,x,w,c.ang+Math.PI/2*g,f.ang-Math.PI/2*g,b),o=a,a=u}t.closePath()}function K0(t,e,n,r,i,s,o,l,a,u,c,f,d,h,p){const g={x:0,y:s+u,width:0,height:0};if(t>=h.length||e>=c||e<-2||t<0)return g;const b=s-i;if(t>=f){const m=o>t?-1:1,v=Ga(h);g.x+=v+a;for(let w=o;w!==t;w+=m)g.x+=h[m===1?w:w-1].width*m}else for(let m=0;m0&&Vc(h[m-1].group,v)&&h[m-1].sticky===w;){const x=h[m-1];g.x-=x.width,g.width+=x.width,m--}let k=t;for(;k+1n&&(g.width=n-g.x)}}else if(e>=c-d){let m=c-e;for(g.y=r;m>0;){const v=e+m-1;g.height=typeof p=="number"?p:p(v),g.y-=g.height,m--}g.height+=1}else{const m=l>e?-1:1;if(typeof p=="number"){const v=e-l;g.y+=v*p}else for(let v=l;v!==e;v+=m)g.y+=p(v)*m;g.height=(typeof p=="number"?p:p(e))+1}return g}const aw=1<<21;function Vi(t,e){return(e+2)*aw+t}function vE(t){return t%aw}function uw(t){return Math.floor(t/aw)-2}function cw(t){const e=vE(t),n=uw(t);return[e,n]}class wE{constructor(){kt(this,"visibleWindow",{x:0,y:0,width:0,height:0});kt(this,"freezeCols",0);kt(this,"freezeRows",[]);kt(this,"isInWindow",e=>{const n=vE(e),r=uw(e),i=this.visibleWindow,s=n>=i.x&&n<=i.x+i.width||n=i.y&&r<=i.y+i.height||this.freezeRows.includes(r);return s&&o})}setWindow(e,n,r){this.visibleWindow.x===e.x&&this.visibleWindow.y===e.y&&this.visibleWindow.width===e.width&&this.visibleWindow.height===e.height&&this.freezeCols===n&&Xa(this.freezeRows,r)||(this.visibleWindow=e,this.freezeCols=n,this.freezeRows=r,this.clearOutOfWindow())}}class j4 extends wE{constructor(){super(...arguments);kt(this,"cache",new Map);kt(this,"setValue",(n,r)=>{this.cache.set(Vi(n[0],n[1]),r)});kt(this,"getValue",n=>this.cache.get(Vi(n[0],n[1])));kt(this,"clearOutOfWindow",()=>{for(const[n]of this.cache.entries())this.isInWindow(n)||this.cache.delete(n)})}}class yc{constructor(e=[]){kt(this,"cells");this.cells=new Set(e.map(n=>Vi(n[0],n[1])))}add(e){this.cells.add(Vi(e[0],e[1]))}has(e){return e===void 0?!1:this.cells.has(Vi(e[0],e[1]))}remove(e){this.cells.delete(Vi(e[0],e[1]))}clear(){this.cells.clear()}get size(){return this.cells.size}hasHeader(){for(const e of this.cells)if(uw(e)<0)return!0;return!1}hasItemInRectangle(e){for(let n=e.y;n{const h=V4(t,d[r],e,a);return u=Math.max(u,h),h});if(c.length>5&&l){u=0;let d=0;for(const p of c)d+=p;const h=d/c.length;for(let p=0;p=h*2?c[p]=0:u=Math.max(u,c[p])}u=Math.max(u,t.measureText(n.title).width+16+(n.icon===void 0?0:28));const f=Math.max(Math.ceil(s),Math.min(Math.floor(o),Math.ceil(u)));return{...n,width:f}}function U4(t,e,n,r,i,s,o,l,a){const u=y.useRef(e),c=y.useRef(n),f=y.useRef(o);u.current=e,c.current=n,f.current=o;const[d,h]=y.useMemo(()=>{if(typeof window>"u")return[null,null];const v=document.createElement("canvas");return v.style.display="none",v.style.opacity="0",v.style.position="fixed",[v,v.getContext("2d",{alpha:!1})]},[]);y.useLayoutEffect(()=>(d&&document.documentElement.append(d),()=>{d==null||d.remove()}),[d]);const p=y.useRef({}),g=y.useRef(),[b,m]=y.useState();return y.useLayoutEffect(()=>{const v=c.current;if(v===void 0||t.every(Zf))return;let w=Math.max(1,10-Math.floor(t.length/1e4)),k=0;w1&&(w--,k=1);const x={x:0,y:0,width:t.length,height:Math.min(u.current,w)},C={x:0,y:u.current-1,width:t.length,height:1};(async()=>{const A=v(x,a.signal),M=k>0?v(C,a.signal):void 0;let N;typeof A=="object"?N=A:N=await Bb(A),M!==void 0&&(typeof M=="object"?N=[...N,...M]:N=[...N,...await Bb(M)]),g.current=t,m(N)})()},[a.signal,t]),y.useMemo(()=>{let w=t.every(Zf)?t:h===null?t.map(T=>Zf(T)?T:{...T,width:X0}):(h.font=f.current.baseFontFull,t.map((T,A)=>{if(Zf(T))return T;if(p.current[T.id]!==void 0)return{...T,width:p.current[T.id]};if(b===void 0||g.current!==t||T.id===void 0)return{...T,width:X0};const M=kE(h,o,T,A,b,i,s,!0,l);return p.current[T.id]=M.width,M})),k=0,x=0;const C=[];for(const[T,A]of w.entries())k+=A.width,A.grow!==void 0&&A.grow>0&&(x+=A.grow,C.push(T));if(k0){const T=[...w],A=r-k;let M=A;for(let N=0;N0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),l=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));i=Promise.allSettled(n.map(a=>{if(a=X4(a),a in dx)return;dx[a]=!0;const u=a.endsWith(".css"),c=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${a}"]${c}`))return;const f=document.createElement("link");if(f.rel=u?"stylesheet":K4,u||(f.as="script"),f.crossOrigin="",f.href=a,l&&f.setAttribute("nonce",l),document.head.appendChild(f),u)return new Promise((d,h)=>{f.addEventListener("load",d),f.addEventListener("error",()=>h(new Error(`Unable to preload CSS for ${a}`)))})}))}function s(o){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=o,window.dispatchEvent(l),!l.defaultPrevented)throw o}return i.then(o=>{for(const l of o||[])l.status==="rejected"&&s(l.reason);return e().catch(s)})};function G4(t,e,n){return t===t&&(n!==void 0&&(t=t<=n?t:n),e!==void 0&&(t=t>=e?t:e)),t}var q4=G4,Y4=q4,em=rw;function J4(t,e,n){return n===void 0&&(n=e,e=void 0),n!==void 0&&(n=em(n),n=n===n?n:0),e!==void 0&&(e=em(e),e=e===e?e:0),Y4(em(t),e,n)}var Q4=J4;const Wi=es(Q4);var Z4="__lodash_hash_undefined__";function e5(t){return this.__data__.set(t,Z4),this}var t5=e5;function n5(t){return this.__data__.has(t)}var r5=n5,i5=Gv,s5=t5,o5=r5;function Dh(t){var e=-1,n=t==null?0:t.length;for(this.__data__=new i5;++e-1}var b5=w5;function x5(t,e,n){for(var r=-1,i=t==null?0:t.length;++r=j5){var u=e?null:z5(t);if(u)return B5(u);o=!1,i=F5,a=new D5}else a=e?[]:l;e:for(;++r0&&n(l)?e>1?ME(l,e-1,n,r,i):Z5(i,l):r||(i[i.length]=l)}return i}var tz=ME,nz=tz;function rz(t){var e=t==null?0:t.length;return e?nz(t,1):[]}var iz=rz;const gx=es(iz);var sz=Math.ceil,oz=Math.max;function lz(t,e,n,r){for(var i=-1,s=oz(sz((e-t)/(n||1)),0),o=Array(s);s--;)o[r?s:++i]=t,t+=n;return o}var az=lz,uz=zT,cz=Qv;function fz(t){return t!=null&&cz(t.length)&&!uz(t)}var dw=fz,dz=Kv,hz=dw,pz=Jv,gz=zl;function mz(t,e,n){if(!gz(n))return!1;var r=typeof e;return(r=="number"?hz(n)&&pz(e,n.length):r=="string"&&e in n)?dz(n[e],t):!1}var yz=mz,vz=rw,mx=1/0,wz=17976931348623157e292;function bz(t){if(!t)return t===0?t:0;if(t=vz(t),t===mx||t===-mx){var e=t<0?-1:1;return e*wz}return t===t?t:0}var xz=bz,kz=az,Sz=yz,nm=xz;function Cz(t){return function(e,n,r){return r&&typeof r!="number"&&Sz(e,n,r)&&(n=r=void 0),e=nm(e),n===void 0?(n=e,e=0):n=nm(n),r=r===void 0?e{g.drawImage(b,0,0,f,f)}).finally(()=>{this.inFlight--,this.inFlight===0&&this.onSettled()})}else a<1&&(r.globalAlpha=a),r.drawImage(h,0,0,f,f,i,s,o,o),a<1&&(r.globalAlpha=1)}}function RE(t){if(t.length===0)return;let e;for(const n of t)e=Math.min(e??n.y,n.y)}function Fp(t,e,n,r,i,s,o,l,a){l=l??e;let u=e,c=t;const f=r-s;let d=!1;for(;ul&&a(u,c,h,!1,o&&c===r-1)===!0){d=!0;break}u+=h,c++}if(!d){u=n;for(let h=0;h!h.sticky))==null?void 0:d.sourceIndex)??0;if(a>f){const h=Math.max(l,f);let p=e,g=r;for(let b=s.sourceIndex-1;b>=h;b--)p-=o[b].width,g+=o[b].width;for(let b=s.sourceIndex+1;b<=a;b++)g+=o[b].width;c={x:p,y:n,width:g,height:i}}if(f>l){const h=Math.min(a,f-1);let p=e,g=r;for(let b=s.sourceIndex-1;b>=l;b--)p-=o[b].width,g+=o[b].width;for(let b=s.sourceIndex+1;b<=h;b++)g+=o[b].width;u={x:p,y:n,width:g,height:i}}return[u,c]}function Pz(t,e,n,r){if(r==="any")return NE(t,{x:e,y:n,width:1,height:1});if(r==="vertical"&&(e=t.x),r==="horizontal"&&(n=t.y),dE([e,n],t))return;const i=e-t.x,s=t.x+t.width-e,o=n-t.y+1,l=t.y+t.height-n,a=Math.min(r==="vertical"?Number.MAX_SAFE_INTEGER:i,r==="vertical"?Number.MAX_SAFE_INTEGER:s,r==="horizontal"?Number.MAX_SAFE_INTEGER:o,r==="horizontal"?Number.MAX_SAFE_INTEGER:l);return a===l?{x:t.x,y:t.y+t.height,width:t.width,height:n-t.y-t.height+1}:a===o?{x:t.x,y:n,width:t.width,height:t.y-n}:a===s?{x:t.x+t.width,y:t.y,width:e-t.x-t.width+1,height:t.height}:{x:e,y:t.y,width:t.x-e,height:t.height}}function Lh(t,e,n,r,i,s,o,l){return t<=i+o&&i<=t+n&&e<=s+l&&s<=e+r}function zp(t,e,n){return e>=t.x&&e<=t.x+t.width&&n>=t.y&&n<=t.y+t.height}function NE(t,e){const n=Math.min(t.x,e.x),r=Math.min(t.y,e.y),i=Math.max(t.x+t.width,e.x+e.width)-n,s=Math.max(t.y+t.height,e.y+e.height)-r;return{x:n,y:r,width:i,height:s}}function Nz(t,e){return t.x<=e.x&&t.y<=e.y&&t.x+t.width>=e.x+e.width&&t.y+t.height>=e.y+e.height}function Iz(t,e,n,r){if(t.x>e||t.y>n||t.x<0&&t.y<0&&t.x+t.width>e&&t.y+t.height>n)return;if(t.x>=0&&t.y>=0&&t.x+t.width<=e&&t.y+t.height<=n)return t;const i=-4,s=-4,o=e+4,l=n+4,a=i-t.x,u=t.x+t.width-o,c=s-t.y,f=t.y+t.height-l,d=a>0?t.x+Math.floor(a/r)*r:t.x,h=u>0?t.x+t.width-Math.floor(u/r)*r:t.x+t.width,p=c>0?t.y+Math.floor(c/r)*r:t.y,g=f>0?t.y+t.height-Math.floor(f/r)*r:t.y+t.height;return{x:d,y:p,width:h-d,height:g-p}}function _z(t,e,n,r,i){const[s,o,l,a]=e,[u,c,f,d]=i,{x:h,y:p,width:g,height:b}=t,m=[];if(g<=0||b<=0)return m;const v=h+g,w=p+b,k=hl,T=p+b>a,A=h>=s&&hs&&v<=l||hl,M=p>=o&&po&&w<=a||pa;if(A&&M){const D=Math.max(h,s),O=Math.max(p,o),L=Math.min(v,l),_=Math.min(w,a);m.push({rect:{x:D,y:O,width:L-D,height:_-O},clip:{x:u,y:c,width:f-u+1,height:d-c+1}})}if(k&&x){const D=h,O=p,L=Math.min(v,s),_=Math.min(w,o);m.push({rect:{x:D,y:O,width:L-D,height:_-O},clip:{x:0,y:0,width:u+1,height:c+1}})}if(x&&A){const D=Math.max(h,s),O=p,L=Math.min(v,l),_=Math.min(w,o);m.push({rect:{x:D,y:O,width:L-D,height:_-O},clip:{x:u,y:0,width:f-u+1,height:c+1}})}if(x&&C){const D=Math.max(h,l),O=p,L=v,_=Math.min(w,o);m.push({rect:{x:D,y:O,width:L-D,height:_-O},clip:{x:f,y:0,width:n-f+1,height:c+1}})}if(k&&M){const D=h,O=Math.max(p,o),L=Math.min(v,s),_=Math.min(w,a);m.push({rect:{x:D,y:O,width:L-D,height:_-O},clip:{x:0,y:c,width:u+1,height:d-c+1}})}if(C&&M){const D=Math.max(h,l),O=Math.max(p,o),L=v,_=Math.min(w,a);m.push({rect:{x:D,y:O,width:L-D,height:_-O},clip:{x:f,y:c,width:n-f+1,height:d-c+1}})}if(k&&T){const D=h,O=Math.max(p,a),L=Math.min(v,s),_=w;m.push({rect:{x:D,y:O,width:L-D,height:_-O},clip:{x:0,y:d,width:u+1,height:r-d+1}})}if(T&&A){const D=Math.max(h,s),O=Math.max(p,a),L=Math.min(v,l),_=w;m.push({rect:{x:D,y:O,width:L-D,height:_-O},clip:{x:u,y:d,width:f-u+1,height:r-d+1}})}if(C&&T){const D=Math.max(h,l),O=Math.max(p,a),L=v,_=w;m.push({rect:{x:D,y:O,width:L-D,height:_-O},clip:{x:f,y:d,width:n-f+1,height:r-d+1}})}return m}const Dz={kind:Ae.Loading,allowOverlay:!1};function yx(t,e,n,r,i,s,o,l,a,u,c,f,d,h,p,g,b,m,v,w,k,x,C,T,A,M,N,D,O,L,_,re,ie,se,H){let X=(w==null?void 0:w.size)??Number.MAX_SAFE_INTEGER;const R=performance.now();let I=L.baseFontFull;t.font=I;const P={ctx:t},B=[0,0],q=b>0?Hl(a,b,u):0;let W,ye;const ee=RE(v);return Go(e,l,s,o,i,(me,Le,Ue,ze,Mt)=>{const tt=Math.max(0,ze-Le),Be=Le+tt,ue=i+1,Nt=me.width-tt,be=r-i-1;if(v.length>0){let $e=!1;for(let nt=0;nt{t.save(),t.beginPath(),t.rect(Be,ue,Nt,be),t.clip()},Y=k.columns.hasIndex(me.sourceIndex),Se=f(me.group??"").overrideTheme,Ne=me.themeOverride===void 0&&Se===void 0?L:$o(L,Se,me.themeOverride),Ce=Ne.baseFontFull;Ce!==I&&(I=Ce,t.font=Ce),xe();let xt;return Fp(Mt,Ue,r,a,u,b,m,ee,($e,nt,ge,ot,rt)=>{var Zt,Tn,er;if(nt<0||(B[0]=me.sourceIndex,B[1]=nt,w!==void 0&&!w.has(B)))return;if(v.length>0){let pt=!1;for(let Wt=0;Wtmt.span!==void 0&&pt>=mt.span[0]&&pt<=mt.span[1]);Hn&&!p&&g?bn=0:Hn&&g&&(bn=Math.max(bn,1)),Yn&&bn++,Hn||(Ke&&bn++,Y&&!rt&&bn++);const Wr=mt.kind===Ae.Protected?jt.bgCellMedium:jt.bgCell;let Ht;if((ot||Wr!==L.bgCell)&&(Ht=ti(Wr,Ht)),bn>0||an){an&&(Ht=ti(jt.bgHeader,Ht));for(let pt=0;ptH&&!mn){const pt=jt.baseFontFull;pt!==I&&(t.font=pt,I=pt),xt=IE(t,mt,me.sourceIndex,nt,We,Lt,it,$e,dt,ge,bn>0,jt,Ht??jt.bgCell,T,A,(Qt==null?void 0:Qt.hoverAmount)??0,N,O,R,D,xt,_,re,ie,se)}return Qe&&t.restore(),mt.style==="faded"&&(t.globalAlpha=1),X--,Yt&&(t.restore(),(er=xt==null?void 0:xt.deprep)==null||er.call(xt,P),xt=void 0,xe(),I=Ce,t.font=Ce),X<=0}),t.restore(),X<=0}),W}const zu=[0,0],Bu={x:0,y:0,width:0,height:0},rm=[void 0,()=>{}];let G0=!1;function Lz(){G0=!0}function IE(t,e,n,r,i,s,o,l,a,u,c,f,d,h,p,g,b,m,v,w,k,x,C,T,A){var re,ie;let M,N;b!==void 0&&b[0][0]===n&&b[0][1]===r&&(M=b[1][0],N=b[1][1]);let D;zu[0]=n,zu[1]=r,Bu.x=o,Bu.y=l,Bu.width=a,Bu.height=u,rm[0]=C.getValue(zu),rm[1]=se=>C.setValue(zu,se),G0=!1;const O={ctx:t,theme:f,col:n,row:r,cell:e,rect:Bu,highlighted:c,cellFillColor:d,hoverAmount:g,frameTime:v,hoverX:M,drawState:rm,hoverY:N,imageLoader:h,spriteManager:p,hyperWrapping:m,overrideCursor:M!==void 0?A:void 0,requestAnimationFrame:Lz},L=L4(O,e.lastUpdated,v,k,i,s),_=T(e);if(_!==void 0){(k==null?void 0:k.renderer)!==_&&((re=k==null?void 0:k.deprep)==null||re.call(k,O),k=void 0);const se=(ie=_.drawPrep)==null?void 0:ie.call(_,O,k);w!==void 0&&!xa(O.cell)?w(O,()=>_.draw(O,e)):_.draw(O,e),D=se===void 0?void 0:{deprep:se==null?void 0:se.deprep,fillStyle:se==null?void 0:se.fillStyle,font:se==null?void 0:se.font,renderer:_}}return(L||G0)&&(x==null||x(zu)),D}function hw(t,e,n,r,i,s,o,l,a=-20,u=-20,c=32,f="center",d="square"){const h=Math.floor(i+o/2),p=d==="circle"?1e4:e.roundingRadius??4;let g=nE(c,o,e.cellVerticalPadding),b=g/2;const m=tE(f,r,s,e.cellHorizontalPadding,g),v=eE(m,h,g),w=rE(r+a,i+u,v);switch(n){case!0:{t.beginPath(),Ts(t,m-g/2,h-g/2,g,g,p),d==="circle"&&(b*=.8,g*=.8),t.fillStyle=l?e.accentColor:e.textMedium,t.fill(),t.beginPath(),t.moveTo(m-b+g/4.23,h-b+g/1.97),t.lineTo(m-b+g/2.42,h-b+g/1.44),t.lineTo(m-b+g/1.29,h-b+g/3.25),t.strokeStyle=e.bgCell,t.lineJoin="round",t.lineCap="round",t.lineWidth=1.9,t.stroke();break}case Mh:case!1:{t.beginPath(),Ts(t,m-g/2+.5,h-g/2+.5,g-1,g-1,p),t.lineWidth=1,t.strokeStyle=w?e.textDark:e.textMedium,t.stroke();break}case Zv:{t.beginPath(),Ts(t,m-g/2,h-g/2,g,g,p),t.fillStyle=w?e.textMedium:e.textLight,t.fill(),d==="circle"&&(b*=.8,g*=.8),t.beginPath(),t.moveTo(m-g/3,h),t.lineTo(m+g/3,h),t.strokeStyle=e.bgCell,t.lineCap="round",t.lineWidth=1.9,t.stroke();break}default:Wc()}}function $z(t,e,n,r,i,s,o,l,a,u,c,f,d,h,p,g,b,m,v){const w=o+l;if(w<=0)return;t.fillStyle=f.bgHeader,t.fillRect(0,0,i,w);const[k,x]=(r==null?void 0:r[0])??[],C=f.headerFontFull;t.font=C,Go(e,0,s,0,w,(T,A,M,N)=>{var P;if(b!==void 0&&!b.has([T.sourceIndex,-1]))return;const D=Math.max(0,N-A);t.save(),t.beginPath(),t.rect(A+D,l,T.width-D,o),t.clip();const O=g(T.group??"").overrideTheme,L=T.themeOverride===void 0&&O===void 0?f:$o(f,O,T.themeOverride);L.bgHeader!==f.bgHeader&&(t.fillStyle=L.bgHeader,t.fill()),L!==f&&(t.font=L.baseFontFull);const _=c.columns.hasIndex(T.sourceIndex),re=a!==void 0||u,ie=!re&&x===-1&&k===T.sourceIndex,se=re?0:((P=h.find(B=>B.item[0]===T.sourceIndex&&B.item[1]===-1))==null?void 0:P.hoverAmount)??0,H=(c==null?void 0:c.current)!==void 0&&c.current.cell[0]===T.sourceIndex,X=_?L.accentColor:H?L.bgHeaderHasFocus:L.bgHeader,R=n?l:0,I=T.sourceIndex===0?0:1;_?(t.fillStyle=X,t.fillRect(A+I,R,T.width-I,o)):(H||se>0)&&(t.beginPath(),t.rect(A+I,R,T.width-I,o),H&&(t.fillStyle=L.bgHeaderHasFocus,t.fill()),se>0&&(t.globalAlpha=se,t.fillStyle=L.bgHeaderHovered,t.fill(),t.globalAlpha=1)),LE(t,A,R,T.width,o,T,_,L,ie,H,se,d,m,v),t.restore()}),n&&Fz(t,e,i,s,l,r,f,d,h,p,g,b)}function Fz(t,e,n,r,i,s,o,l,a,u,c,f){const[h,p]=(s==null?void 0:s[0])??[];let g=0;OE(e,n,r,i,(b,m,v,w,k,x)=>{if(f!==void 0&&!f.hasItemInRectangle({x:b[0],y:-2,width:b[1]-b[0]+1,height:1}))return;t.save(),t.beginPath(),t.rect(v,w,k,x),t.clip();const C=c(m),T=(C==null?void 0:C.overrideTheme)===void 0?o:$o(o,C.overrideTheme),A=p===-2&&h!==void 0&&h>=b[0]&&h<=b[1],M=A?T.bgHeaderHovered:T.bgHeader;if(M!==o.bgHeader&&(t.fillStyle=M,t.fill()),t.fillStyle=T.textGroupHeader??T.textHeader,C!==void 0){let N=v;if(C.icon!==void 0&&(l.drawSprite(C.icon,"normal",t,N+8,(i-20)/2,20,T),N+=26),t.fillText(C.name,N+8,i/2+Js(t,o.headerFontFull)),C.actions!==void 0&&A){const D=DE({x:v,y:w,width:k,height:x},C.actions);t.beginPath();const O=D[0].x-10,L=v+k-O;t.rect(O,0,L,i);const _=t.createLinearGradient(O,0,O+L,0),re=Nl(M,0);_.addColorStop(0,re),_.addColorStop(10/L,M),_.addColorStop(1,M),t.fillStyle=_,t.fill(),t.globalAlpha=.6;const[ie,se]=(s==null?void 0:s[1])??[-1,-1];for(let H=0;H35){const k=d?35:r-35,x=d?35*.7:r-35*.7,C=k/r,T=x/r,A=t.createLinearGradient(e,0,e+r,0),M=Nl(g,0);A.addColorStop(d?1:0,g),A.addColorStop(C,g),A.addColorStop(T,M),A.addColorStop(d?0:1,M),t.fillStyle=A}else t.fillStyle=g;if(d&&(t.textAlign="right"),t.fillText(s.title,v,n+i/2+Js(t,l.headerFontFull)),d&&(t.textAlign="left"),b&&s.hasMenu===!0)if(s.menuIcon===void 0||s.menuIcon===Rh.Triangle){t.beginPath();const w=h.x+h.width/2-5.5,k=h.y+h.height/2-3;B4(t,[{x:w,y:k},{x:w+11,y:k},{x:w+5.5,y:k+6}],1),t.fillStyle=g,t.fill()}else if(s.menuIcon===Rh.Dots){t.beginPath();const w=h.x+h.width/2,k=h.y+h.height/2;z4(t,w,k),t.fillStyle=g,t.fill()}else{const w=h.x+(h.width-l.headerIconSize)/2,k=h.y+(h.height-l.headerIconSize)/2;c.drawSprite(s.menuIcon,"normal",t,w,k,l.headerIconSize,l)}}function LE(t,e,n,r,i,s,o,l,a,u,c,f,d,h){const p=sw(s.title)==="rtl",g=_E(e,n,r,i,p);d!==void 0?d({ctx:t,theme:l,rect:{x:e,y:n,width:r,height:i},column:s,columnIndex:s.sourceIndex,isSelected:o,hoverAmount:c,isHovered:a,hasSelectedCell:u,spriteManager:f,menuBounds:g},()=>vx(t,e,n,r,i,s,o,l,a,c,f,h,p,g)):vx(t,e,n,r,i,s,o,l,a,c,f,h,p,g)}var zz=Bl,Bz=function(){try{var t=zz(Object,"defineProperty");return t({},"",{}),t}catch{}}(),jz=Bz,wx=jz;function Hz(t,e,n){e=="__proto__"&&wx?wx(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}var Wz=Hz;function Vz(t,e,n,r){for(var i=-1,s=t==null?0:t.length;++il))return!1;var u=s.get(t),c=s.get(e);if(u&&c)return u==e&&c==t;var f=-1,d=!0,h=n&Jj?new Xj:void 0;for(s.set(t,e),s.set(e,t);++f{if(k!==e[e.length-1])return;x+=k.width;const M=Math.max(x,T);M>r||(t.save(),t.beginPath(),t.rect(M,s+1,1e4,i-s-1),t.clip(),Fp(A,C,i,u,c,p,g,w,(N,D,O,L)=>{if(!L&&b.length>0&&!b.some(H=>Lh(x,N,1e4,O,H.x,H.y,H.width,H.height)))return;const _=d.hasIndex(D),re=h.hasIndex(D);t.beginPath();const ie=f==null?void 0:f(D),se=ie===void 0?v:$o(v,ie);se.bgCell!==v.bgCell&&(t.fillStyle=se.bgCell,t.fillRect(x,N,1e4,O)),re&&(t.fillStyle=se.bgHeader,t.fillRect(x,N,1e4,O)),_&&(t.fillStyle=se.accentLight,t.fillRect(x,N,1e4,O))}),t.restore())})}function HW(t,e,n,r,i,s,o,l,a){let u=!1;for(const p of e)if(!p.sticky){u=o(p.sourceIndex);break}const c=a.horizontalBorderColor??a.borderColor,f=a.borderColor,d=u?Ga(e):0;let h;if(d!==0&&(h=ax(f,a.bgCell),t.beginPath(),t.moveTo(d+.5,0),t.lineTo(d+.5,r),t.strokeStyle=h,t.stroke()),i>0){const p=f===c&&h!==void 0?h:ax(c,a.bgCell),g=Hl(s,i,l);t.beginPath(),t.moveTo(0,r-g+.5),t.lineTo(n,r-g+.5),t.strokeStyle=p,t.stroke()}}const XE=(t,e,n)=>{let r=0,i=e,s=0,o=n;if(t!==void 0&&t.length>0){r=Number.MAX_SAFE_INTEGER,s=Number.MAX_SAFE_INTEGER,i=Number.MIN_SAFE_INTEGER,o=Number.MIN_SAFE_INTEGER;for(const l of t)r=Math.min(r,l.x-1),i=Math.max(i,l.x+l.width+1),s=Math.min(s,l.y-1),o=Math.max(o,l.y+l.height+1)}return{minX:r,maxX:i,minY:s,maxY:o}};function WW(t,e,n,r,i,s,o,l,a,u,c,f,d,h,p){var O;const g=p.bgCell,{minX:b,maxX:m,minY:v,maxY:w}=XE(l,s,o),k=[],x=o-Hl(h,d,u);let C=a,T=n,A=0;for(;C+i=v&&L<=w-1){const re=c==null?void 0:c(T),ie=re==null?void 0:re.bgCell;ie!==void 0&&ie!==g&&T>=h-d&&k.push({x:b,y:L,w:m-b,h:_,color:ie})}C+=_,T0)for(let L=0;L=b&&re<=m&&f(L+1)&&k.push({x:re,y:A,w:_.width,h:N,color:ie}),M+=_.width}if(k.length===0)return;let D;t.beginPath();for(let L=k.length-1;L>=0;L--){const _=k[L];D===void 0?D=_.color:_.color!==D&&(t.fillStyle=D,t.fill(),t.beginPath(),D=_.color),t.rect(_.x,_.y,_.w,_.h)}D!==void 0&&(t.fillStyle=D,t.fill()),t.beginPath()}function zx(t,e,n,r,i,s,o,l,a,u,c,f,d,h,p,g,b,m=!1){if(a!==void 0){t.beginPath(),t.save(),t.rect(0,0,s,o);for(const O of a)t.rect(O.x+1,O.y+1,O.width-1,O.height-1);t.clip("evenodd")}const v=b.horizontalBorderColor??b.borderColor,w=b.borderColor,{minX:k,maxX:x,minY:C,maxY:T}=XE(l,s,o),A=[];t.beginPath();let M=.5;for(let O=0;O=k&&_<=x&&h(O+1)&&A.push({x1:_,y1:Math.max(u,C),x2:_,y2:Math.min(o,T),color:w})}let N=o+.5;for(let O=g-p;O=C&&re<=T-1){const ie=d==null?void 0:d(L);A.push({x1:k,y1:re,x2:x,y2:re,color:(ie==null?void 0:ie.horizontalBorderColor)??(ie==null?void 0:ie.borderColor)??v})}O+=f(L),L++}}const D=BW(A,O=>O.color);for(const O of Object.keys(D)){t.strokeStyle=O;for(const L of D[O])t.moveTo(L.x1,L.y1),t.lineTo(L.x2,L.y2);t.stroke(),t.beginPath()}a!==void 0&&t.restore()}function VW(t,e,n,r,i,s,o,l,a,u,c,f,d,h,p,g,b,m,v){const w=[];t.imageSmoothingEnabled=!1;const k=Math.min(i.cellYOffset,o),x=Math.max(i.cellYOffset,o);let C=0;if(typeof m=="number")C+=(x-k)*m;else for(let _=k;_i.cellYOffset&&(C=-C),C+=a-i.translateY;const T=Math.min(i.cellXOffset,s),A=Math.max(i.cellXOffset,s);let M=0;for(let _=T;_i.cellXOffset&&(M=-M),M+=l-i.translateX;const N=Ga(b);if(M!==0&&C!==0)return{regions:[]};const D=u>0?Hl(d,u,m):0,O=c-N-Math.abs(M),L=f-h-D-Math.abs(C)-1;if(O>150&&L>150){const _={sx:0,sy:0,sw:c*p,sh:f*p,dx:0,dy:0,dw:c*p,dh:f*p};if(C>0?(_.sy=(h+1)*p,_.sh=L*p,_.dy=(C+h+1)*p,_.dh=L*p,w.push({x:0,y:h,width:c,height:C+1})):C<0&&(_.sy=(-C+h+1)*p,_.sh=L*p,_.dy=(h+1)*p,_.dh=L*p,w.push({x:0,y:f+C-D,width:c,height:-C+D})),M>0?(_.sx=N*p,_.sw=O*p,_.dx=(M+N)*p,_.dw=O*p,w.push({x:N-1,y:0,width:M+2,height:f})):M<0&&(_.sx=(N-M)*p,_.sw=O*p,_.dx=N*p,_.dw=O*p,w.push({x:c+M,y:0,width:-M,height:f})),t.setTransform(1,0,0,1,0,0),v){if(N>0&&M!==0&&C===0&&(r===void 0||(n==null?void 0:n[1])!==!1)){const re=N*p,ie=f*p;t.drawImage(e,0,0,re,ie,0,0,re,ie)}if(D>0&&M===0&&C!==0&&(r===void 0||(n==null?void 0:n[0])!==!1)){const re=(f-D)*p,ie=c*p,se=D*p;t.drawImage(e,0,re,ie,se,0,re,ie,se)}}t.drawImage(e,_.sx,_.sy,_.sw,_.sh,_.dx,_.dy,_.dw,_.dh),t.scale(p,p)}return t.imageSmoothingEnabled=!0,{regions:w}}function UW(t,e,n,r,i,s,o,l,a,u){const c=[];return e!==t.cellXOffset||n!==t.cellYOffset||r!==t.translateX||i!==t.translateY||Go(a,n,r,i,l,(f,d,h,p)=>{if(f.sourceIndex===u){const g=Math.max(d,p)+1;return c.push({x:g,y:0,width:s-g,height:o}),!0}}),c}function KW(t,e){if(e===void 0||t.width!==e.width||t.height!==e.height||t.theme!==e.theme||t.headerHeight!==e.headerHeight||t.rowHeight!==e.rowHeight||t.rows!==e.rows||t.freezeColumns!==e.freezeColumns||t.getRowThemeOverride!==e.getRowThemeOverride||t.isFocused!==e.isFocused||t.isResizing!==e.isResizing||t.verticalBorder!==e.verticalBorder||t.getCellContent!==e.getCellContent||t.highlightRegions!==e.highlightRegions||t.selection!==e.selection||t.dragAndDropState!==e.dragAndDropState||t.prelightCells!==e.prelightCells||t.touchMode!==e.touchMode||t.maxScaleFactor!==e.maxScaleFactor)return!1;if(t.mappedColumns!==e.mappedColumns){if(t.mappedColumns.length>100||t.mappedColumns.length!==e.mappedColumns.length)return!1;let n;for(let r=0;rT.style!=="no-outline");if(b===void 0||b.length===0)return;const m=Ga(l),v=Hl(h,d,f),w=[a,0,l.length,h-d],k=[m,0,e,n-v],x=b.map(T=>{const A=T.range,M=T.style??"dashed";return _z(A,w,e,n,k).map(N=>{const D=N.rect,O=K0(D.x,D.y,e,n,c,u+c,r,i,s,o,h,a,d,l,f),L=D.width===1&&D.height===1?O:K0(D.x+D.width-1,D.y+D.height-1,e,n,c,u+c,r,i,s,o,h,a,d,l,f);return D.x+D.width>=l.length&&(L.width-=1),D.y+D.height>=h&&(L.height-=1),{color:T.color,style:M,clip:N.clip,rect:Iz({x:O.x,y:O.y,width:L.x+L.width-O.x,height:L.y+L.height-O.y},e,n,8)}})}),C=()=>{t.lineWidth=1;let T=!1;for(const A of x)for(const M of A)if((M==null?void 0:M.rect)!==void 0&&Lh(0,0,e,n,M.rect.x,M.rect.y,M.rect.width,M.rect.height)){const N=T,D=!Nz(M.clip,M.rect);D&&(t.save(),t.rect(M.clip.x,M.clip.y,M.clip.width,M.clip.height),t.clip()),M.style==="dashed"&&!T?(t.setLineDash([5,3]),T=!0):(M.style==="solid"||M.style==="solid-outline")&&T&&(t.setLineDash([]),T=!1),t.strokeStyle=M.style==="solid-outline"?ti(ti(M.color,g.borderColor),g.bgCell):Nl(M.color,1),t.strokeRect(M.rect.x+.5,M.rect.y+.5,M.rect.width-1,M.rect.height-1),D&&(t.restore(),T=N)}T&&t.setLineDash([])};return C(),C}function jx(t,e,n,r,i){t.beginPath(),t.moveTo(e,n),t.lineTo(e,r),t.lineWidth=2,t.strokeStyle=i,t.stroke(),t.globalAlpha=1}function om(t,e,n,r,i,s,o,l,a,u,c,f,d,h,p,g,b){if(c.current===void 0)return;const m=c.current.range,v=c.current.cell,w=[m.x+m.width-1,m.y+m.height-1];if(v[1]>=b&&w[1]>=b||!o.some(_=>_.sourceIndex===v[0]||_.sourceIndex===w[0]))return;const[x,C]=c.current.cell,T=d(c.current.cell),A=T.span??[x,x],M=C>=b-h,N=h>0&&!M?Hl(b,h,f)-1:0,D=w[1];let O;if(Go(o,r,i,s,u,(_,re,ie,se,H)=>{if(_.sticky&&x>_.sourceIndex)return;const X=_.sourceIndexA[1],I=_.sourceIndex===w[0];if(!(!I&&(X||R)))return Fp(H,ie,n,b,f,h,p,void 0,(P,B,q)=>{if(B!==C&&B!==D)return;let W=re,ye=_.width;if(T.span!==void 0){const me=PE(T.span,re,P,_.width,q,_,l),Le=_.sticky?me[0]:me[1];Le!==void 0&&(W=Le.x,ye=Le.width)}return B===D&&I&&g&&(O=()=>{var me;se>W&&!_.sticky&&(t.beginPath(),t.rect(se,0,e-se,n),t.clip()),t.beginPath(),t.rect(W+ye-4,P+q-4,4,4),t.fillStyle=((me=_.themeOverride)==null?void 0:me.accentColor)??a.accentColor,t.fill()}),O!==void 0}),O!==void 0}),O===void 0)return;const L=()=>{t.save(),t.beginPath(),t.rect(0,u,e,n-u-N),t.clip(),O==null||O(),t.restore()};return L(),L}function XW(t,e,n,r,i,s,o,l,a){a===void 0||a.size===0||(t.beginPath(),OE(e,n,s,r,(u,c,f,d,h,p)=>{a.hasItemInRectangle({x:u[0],y:-2,width:u[1]-u[0]+1,height:1})&&t.rect(f,d,h,p)}),Go(e,l,s,o,i,(u,c,f,d)=>{const h=Math.max(0,d-c),p=c+h+1,g=u.width-h-1;a.has([u.sourceIndex,-1])&&t.rect(p,r,g,i-r)}),t.clip())}function GW(t,e,n,r,i,s,o,l,a,u){let c=0;return Go(t,s,r,i,n,(f,d,h,p,g)=>(Fp(g,h,e,o,l,a,u,void 0,(b,m,v,w)=>{w||(c=Math.max(m,c))}),!0)),c}function Hx(t,e){var Qe;const{canvasCtx:n,headerCanvasCtx:r,width:i,height:s,cellXOffset:o,cellYOffset:l,translateX:a,translateY:u,mappedColumns:c,enableGroups:f,freezeColumns:d,dragAndDropState:h,theme:p,drawFocus:g,headerHeight:b,groupHeaderHeight:m,disabledRows:v,rowHeight:w,verticalBorder:k,overrideCursor:x,isResizing:C,selection:T,fillHandle:A,freezeTrailingRows:M,rows:N,getCellContent:D,getGroupDetails:O,getRowThemeOverride:L,isFocused:_,drawHeaderCallback:re,prelightCells:ie,drawCellCallback:se,highlightRegions:H,resizeCol:X,imageLoader:R,lastBlitData:I,hoverValues:P,hyperWrapping:B,hoverInfo:q,spriteManager:W,maxScaleFactor:ye,hasAppendRow:ee,touchMode:me,enqueue:Le,renderStateProvider:Ue,getCellRenderer:ze,renderStrategy:Mt,bufferACtx:tt,bufferBCtx:Be,damage:ue,minimumCellWidth:Nt}=t;if(i===0||s===0)return;const be=Mt==="double-buffer",xe=Math.min(ye,Math.ceil(window.devicePixelRatio??1)),Y=Mt!=="direct"&&KW(t,e),Se=n.canvas;(Se.width!==i*xe||Se.height!==s*xe)&&(Se.width=i*xe,Se.height=s*xe,Se.style.width=i+"px",Se.style.height=s+"px");const Ne=r.canvas,Ce=f?m+b:b,xt=Ce+1;(Ne.width!==i*xe||Ne.height!==xt*xe)&&(Ne.width=i*xe,Ne.height=xt*xe,Ne.style.width=i+"px",Ne.style.height=xt+"px");const $e=tt.canvas,nt=Be.canvas;be&&($e.width!==i*xe||$e.height!==s*xe)&&($e.width=i*xe,$e.height=s*xe,I.current!==void 0&&(I.current.aBufferScroll=void 0)),be&&(nt.width!==i*xe||nt.height!==s*xe)&&(nt.width=i*xe,nt.height=s*xe,I.current!==void 0&&(I.current.bBufferScroll=void 0));const ge=I.current;if(Y===!0&&o===(ge==null?void 0:ge.cellXOffset)&&l===(ge==null?void 0:ge.cellYOffset)&&a===(ge==null?void 0:ge.translateX)&&u===(ge==null?void 0:ge.translateY))return;let ot=null;be&&(ot=n);const rt=r;let Ke;be?ue!==void 0?Ke=(ge==null?void 0:ge.lastBuffer)==="b"?Be:tt:Ke=(ge==null?void 0:ge.lastBuffer)==="b"?tt:Be:Ke=n;const an=Ke.canvas,mt=be?an===$e?nt:$e:Se,it=typeof w=="number"?()=>w:w;rt.save(),Ke.save(),rt.beginPath(),Ke.beginPath(),rt.textBaseline="middle",Ke.textBaseline="middle",xe!==1&&(rt.scale(xe,xe),Ke.scale(xe,xe));const dt=U0(c,o,i,h,a);let Yt=[];const mn=g&&((Qe=T.current)==null?void 0:Qe.cell[1])===l&&u===0;let qn=!1;if(H!==void 0){for(const We of H)if(We.style!=="no-outline"&&We.range.y===l&&u===0){qn=!0;break}}const Jt=()=>{$z(rt,dt,f,q,i,a,b,m,h,C,T,p,W,P,k,O,ue,re,me),zx(rt,dt,l,a,u,i,s,void 0,void 0,m,Ce,it,L,k,M,N,p,!0),rt.beginPath(),rt.moveTo(0,xt-.5),rt.lineTo(i,xt-.5),rt.strokeStyle=ti(p.headerBottomBorderColor??p.horizontalBorderColor??p.borderColor,p.bgHeader),rt.stroke(),qn&&Bx(rt,i,s,o,l,a,u,c,d,b,m,w,M,N,H,p),mn&&om(rt,i,s,l,a,u,dt,c,p,Ce,T,it,D,M,ee,A,N)};if(ue!==void 0){const We=dt[dt.length-1].sourceIndex+1,Lt=ue.hasItemInRegion([{x:o,y:-2,width:We,height:2},{x:o,y:l,width:We,height:300},{x:0,y:l,width:d,height:300},{x:0,y:-2,width:d,height:2},{x:o,y:N-M,width:We,height:M,when:M>0}]),Qt=Zt=>{yx(Zt,dt,c,s,Ce,a,u,l,N,it,D,O,L,v,_,g,M,ee,Yt,ue,T,ie,H,R,W,P,q,se,B,p,Le,Ue,ze,x,Nt);const Tn=T.current;A&&g&&Tn!==void 0&&ue.has(hE(Tn.range))&&om(Zt,i,s,l,a,u,dt,c,p,Ce,T,it,D,M,ee,A,N)};Lt&&(Qt(Ke),ot!==null&&(ot.save(),ot.scale(xe,xe),ot.textBaseline="middle",Qt(ot),ot.restore()),ue.hasHeader()&&(XW(rt,dt,i,m,Ce,a,u,l,ue),Jt())),Ke.restore(),rt.restore();return}if((Y!==!0||o!==(ge==null?void 0:ge.cellXOffset)||a!==(ge==null?void 0:ge.translateX)||mn!==(ge==null?void 0:ge.mustDrawFocusOnHeader)||qn!==(ge==null?void 0:ge.mustDrawHighlightRingsOnHeader))&&Jt(),Y===!0){ei(mt!==void 0&&ge!==void 0);const{regions:We}=VW(Ke,mt,mt===$e?ge.aBufferScroll:ge.bBufferScroll,mt===$e?ge.bBufferScroll:ge.aBufferScroll,ge,o,l,a,u,M,i,s,N,Ce,xe,c,dt,w,be);Yt=We}else Y!==!1&&(ei(ge!==void 0),Yt=UW(ge,o,l,a,u,i,s,Ce,dt,Y));HW(Ke,dt,i,s,M,N,k,it,p);const jt=Bx(Ke,i,s,o,l,a,u,c,d,b,m,w,M,N,H,p),Hn=g?om(Ke,i,s,l,a,u,dt,c,p,Ce,T,it,D,M,ee,A,N):void 0;if(Ke.fillStyle=p.bgCell,Yt.length>0){Ke.beginPath();for(const We of Yt)Ke.rect(We.x,We.y,We.width,We.height);Ke.clip(),Ke.fill(),Ke.beginPath()}else Ke.fillRect(0,0,i,s);const bn=yx(Ke,dt,c,s,Ce,a,u,l,N,it,D,O,L,v,_,g,M,ee,Yt,ue,T,ie,H,R,W,P,q,se,B,p,Le,Ue,ze,x,Nt);jW(Ke,dt,c,i,s,Ce,a,u,l,N,it,L,T.rows,v,M,ee,Yt,ue,p),WW(Ke,dt,l,a,u,i,s,Yt,Ce,it,L,k,M,N,p),zx(Ke,dt,l,a,u,i,s,Yt,bn,m,Ce,it,L,k,M,N,p),jt==null||jt(),Hn==null||Hn(),C&&Go(dt,0,a,0,Ce,(We,Lt)=>We.sourceIndex===X?(jx(rt,Lt+We.width,0,Ce+1,ti(p.resizeIndicatorColor??p.accentLight,p.bgHeader)),jx(Ke,Lt+We.width,Ce,s,ti(p.resizeIndicatorColor??p.accentLight,p.bgCell)),!0):!1),ot!==null&&(ot.fillStyle=p.bgCell,ot.fillRect(0,0,i,s),ot.drawImage(Ke.canvas,0,0));const Yn=GW(dt,s,Ce,a,u,l,N,it,M,ee);R==null||R.setWindow({x:o,y:l,width:dt.length,height:Yn-l},d,Array.from({length:M},(We,Lt)=>N-1-Lt));const Wr=ge!==void 0&&(o!==ge.cellXOffset||a!==ge.translateX),Ht=ge!==void 0&&(l!==ge.cellYOffset||u!==ge.translateY);I.current={cellXOffset:o,cellYOffset:l,translateX:a,translateY:u,mustDrawFocusOnHeader:mn,mustDrawHighlightRingsOnHeader:qn,lastBuffer:be?an===$e?"a":"b":void 0,aBufferScroll:an===$e?[Wr,Ht]:ge==null?void 0:ge.aBufferScroll,bBufferScroll:an===nt?[Wr,Ht]:ge==null?void 0:ge.bBufferScroll},Ke.restore(),rt.restore()}const qW=80;function YW(t){const e=t-1;return e*e*e+1}class JW{constructor(e){kt(this,"callback");kt(this,"currentHoveredItem");kt(this,"leavingItems",[]);kt(this,"lastAnimationTime");kt(this,"addToLeavingItems",e=>{this.leavingItems.some(r=>gc(r.item,e.item))||this.leavingItems.push(e)});kt(this,"removeFromLeavingItems",e=>{const n=this.leavingItems.find(r=>gc(r.item,e));return this.leavingItems=this.leavingItems.filter(r=>r!==n),(n==null?void 0:n.hoverAmount)??0});kt(this,"cleanUpLeavingElements",()=>{this.leavingItems=this.leavingItems.filter(e=>e.hoverAmount>0)});kt(this,"shouldStep",()=>{const e=this.leavingItems.length>0,n=this.currentHoveredItem!==void 0&&this.currentHoveredItem.hoverAmount<1;return e||n});kt(this,"getAnimatingItems",()=>this.currentHoveredItem!==void 0?[...this.leavingItems,this.currentHoveredItem]:this.leavingItems.map(e=>({...e,hoverAmount:YW(e.hoverAmount)})));kt(this,"step",e=>{if(this.lastAnimationTime===void 0)this.lastAnimationTime=e;else{const r=(e-this.lastAnimationTime)/qW;for(const s of this.leavingItems)s.hoverAmount=Wi(s.hoverAmount-r,0,1);this.currentHoveredItem!==void 0&&(this.currentHoveredItem.hoverAmount=Wi(this.currentHoveredItem.hoverAmount+r,0,1));const i=this.getAnimatingItems();this.callback(i),this.cleanUpLeavingElements()}this.shouldStep()?(this.lastAnimationTime=e,window.requestAnimationFrame(this.step)):this.lastAnimationTime=void 0});kt(this,"setHovered",e=>{var n;if(!gc((n=this.currentHoveredItem)==null?void 0:n.item,e)){if(this.currentHoveredItem!==void 0&&this.addToLeavingItems(this.currentHoveredItem),e!==void 0){const r=this.removeFromLeavingItems(e);this.currentHoveredItem={item:e,hoverAmount:r}}else this.currentHoveredItem=void 0;this.lastAnimationTime===void 0&&window.requestAnimationFrame(this.step)}});this.callback=e}}class QW{constructor(e){kt(this,"fn");kt(this,"val");this.fn=e}get value(){return this.val??(this.val=this.fn())}}function gw(t){return new QW(t)}const ZW=gw(()=>window.navigator.userAgent.includes("Firefox")),zh=gw(()=>window.navigator.userAgent.includes("Mac OS")&&window.navigator.userAgent.includes("Safari")&&!window.navigator.userAgent.includes("Chrome")),Bh=gw(()=>window.navigator.platform.toLowerCase().startsWith("mac"));function e6(t){const e=y.useRef([]),n=y.useRef(0),r=y.useRef(t);r.current=t;const i=y.useCallback(()=>{const s=()=>window.requestAnimationFrame(o),o=()=>{const l=e.current.map(cw);e.current=[],r.current(new yc(l)),e.current.length>0?n.current++:n.current=0};window.requestAnimationFrame(n.current>600?s:o)},[]);return y.useCallback(s=>{e.current.length===0&&i();const o=Vi(s[0],s[1]);e.current.includes(o)||e.current.push(o)},[i])}const go="header",Zr="group-header",jh="out-of-bounds";var Sa;(function(t){t[t.Start=-2]="Start",t[t.StartPadding=-1]="StartPadding",t[t.Center=0]="Center",t[t.EndPadding=1]="EndPadding",t[t.End=2]="End"})(Sa||(Sa={}));function GE(t,e){return t===e?!0:(t==null?void 0:t.kind)==="out-of-bounds"?(t==null?void 0:t.kind)===(e==null?void 0:e.kind)&&(t==null?void 0:t.location[0])===(e==null?void 0:e.location[0])&&(t==null?void 0:t.location[1])===(e==null?void 0:e.location[1])&&(t==null?void 0:t.region[0])===(e==null?void 0:e.region[0])&&(t==null?void 0:t.region[1])===(e==null?void 0:e.region[1]):(t==null?void 0:t.kind)===(e==null?void 0:e.kind)&&(t==null?void 0:t.location[0])===(e==null?void 0:e.location[0])&&(t==null?void 0:t.location[1])===(e==null?void 0:e.location[1])}const Wx=6,t6=(t,e)=>{if(t.kind===Ae.Custom)return t.copyData;const n=e==null?void 0:e(t);return(n==null?void 0:n.getAccessibilityString(t))??""},n6=(t,e)=>{const{width:n,height:r,accessibilityHeight:i,columns:s,cellXOffset:o,cellYOffset:l,headerHeight:a,fillHandle:u=!1,groupHeaderHeight:c,rowHeight:f,rows:d,getCellContent:h,getRowThemeOverride:p,onHeaderMenuClick:g,enableGroups:b,isFilling:m,onCanvasFocused:v,onCanvasBlur:w,isFocused:k,selection:x,freezeColumns:C,onContextMenu:T,freezeTrailingRows:A,fixedShadowX:M=!0,fixedShadowY:N=!0,drawFocusRing:D,onMouseDown:O,onMouseUp:L,onMouseMoveRaw:_,onMouseMove:re,onItemHovered:ie,dragAndDropState:se,firstColAccessible:H,onKeyDown:X,onKeyUp:R,highlightRegions:I,canvasRef:P,onDragStart:B,onDragEnd:q,eventTargetRef:W,isResizing:ye,resizeColumn:ee,isDragging:me,isDraggable:Le=!1,allowResize:Ue,disabledRows:ze,hasAppendRow:Mt,getGroupDetails:tt,theme:Be,prelightCells:ue,headerIcons:Nt,verticalBorder:be,drawCell:xe,drawHeader:Y,onCellFocused:Se,onDragOverCell:Ne,onDrop:Ce,onDragLeave:xt,imageWindowLoader:$e,smoothScrollX:nt=!1,smoothScrollY:ge=!1,experimental:ot,getCellRenderer:rt}=t,Ke=t.translateX??0,an=t.translateY??0,mt=Math.max(C,Math.min(s.length-1,o)),it=y.useRef(null),dt=$e,Yt=y.useRef(),[mn,qn]=y.useState(!1),Jt=y.useRef([]),jt=y.useRef(),[Hn,bn]=y.useState(),[Yn,Wr]=y.useState(),Ht=y.useRef(null),[Qe,We]=y.useState(),[Lt,Qt]=y.useState(!1),Zt=y.useRef(Lt);Zt.current=Lt;const Tn=y.useMemo(()=>new Oz(Nt,()=>{ui.current=void 0,z.current()}),[Nt]),er=b?c+a:a,pt=y.useRef(-1),Wt=((ot==null?void 0:ot.enableFirefoxRescaling)??!1)&&ZW.value,Rt=((ot==null?void 0:ot.enableSafariRescaling)??!1)&&zh.value;y.useLayoutEffect(()=>{window.devicePixelRatio===1||!Wt&&!Rt||(pt.current!==-1&&qn(!0),window.clearTimeout(pt.current),pt.current=window.setTimeout(()=>{qn(!1),pt.current=-1},200))},[l,mt,Ke,an,Wt,Rt]);const Ft=E4(s,C),tn=M?Ga(Ft,se):0,Vt=y.useCallback((j,ae,Te)=>{const we=j.getBoundingClientRect();if(ae>=Ft.length||Te>=d)return;const fe=we.width/n,Pe=K0(ae,Te,n,r,c,er,mt,l,Ke,an,d,C,A,Ft,f);return fe!==1&&(Pe.x*=fe,Pe.y*=fe,Pe.width*=fe,Pe.height*=fe),Pe.x+=we.x,Pe.y+=we.y,Pe},[n,r,c,er,mt,l,Ke,an,d,C,A,Ft,f]),Ut=y.useCallback((j,ae,Te,we)=>{const fe=j.getBoundingClientRect(),Pe=fe.width/n,at=(ae-fe.left)/Pe,ut=(Te-fe.top)/Pe,Re=5,$t=U0(Ft,mt,n,void 0,Ke);let je=0,Bt=0;we instanceof MouseEvent&&(je=we.button,Bt=we.buttons);const ht=O4(at,$t,Ke),Ct=P4(ut,r,b,a,c,d,f,l,an,A),Nn=(we==null?void 0:we.shiftKey)===!0,yt=(we==null?void 0:we.ctrlKey)===!0,En=(we==null?void 0:we.metaKey)===!0,ci=we!==void 0&&!(we instanceof MouseEvent)||(we==null?void 0:we.pointerType)==="touch",vn=[at<0?-1:nn||ut>r){const It=at>n?1:at<0?-1:0,In=ut>r?1:ut<0?-1:0;let Xr=It*2,is=In*2;It===0&&(Xr=ht===-1?Sa.EndPadding:Sa.Center),In===0&&(is=Ct===void 0?Sa.EndPadding:Sa.Center);let Ii=!1;if(ht===-1&&Ct===-1){const Qo=Vt(j,Ft.length-1,-1);ei(Qo!==void 0),Ii=aen&&atr&&ut=0?(In=!0,It=Vt(j,Xr,Ct),ei(It!==void 0),Kr={kind:b&&Ct===-2?Zr:go,location:[Xr,Ct],bounds:It,group:Ft[Xr].group??"",isEdge:In,shiftKey:Nn,ctrlKey:yt,metaKey:En,isTouch:ci,localEventX:ae-It.x,localEventY:Te-It.y,button:je,buttons:Bt,scrollEdge:vn}):Kr={kind:b&&Ct===-2?Zr:go,group:Ft[ht].group??"",location:[ht,Ct],bounds:It,isEdge:In,shiftKey:Nn,ctrlKey:yt,metaKey:En,isTouch:ci,localEventX:ae-It.x,localEventY:Te-It.y,button:je,buttons:Bt,scrollEdge:vn}}else{const It=Vt(j,ht,Ct);ei(It!==void 0);const In=It!==void 0&&It.x+It.width-ae{}),lt=y.useRef(Hn);lt.current=Hn;const[Jn,Vr]=y.useMemo(()=>{const j=document.createElement("canvas"),ae=document.createElement("canvas");return j.style.display="none",j.style.opacity="0",j.style.position="fixed",ae.style.display="none",ae.style.opacity="0",ae.style.position="fixed",[j.getContext("2d",{alpha:!1}),ae.getContext("2d",{alpha:!1})]},[]);y.useLayoutEffect(()=>{if(!(Jn===null||Vr===null))return document.documentElement.append(Jn.canvas),document.documentElement.append(Vr.canvas),()=>{Jn.canvas.remove(),Vr.canvas.remove()}},[Jn,Vr]);const rs=y.useMemo(()=>new j4,[]),Wl=Wt&&mn?1:Rt&&mn?2:5,Vl=(ot==null?void 0:ot.disableMinimumCellWidth)===!0?1:10,ui=y.useRef(),Qs=y.useRef(null),Zs=y.useRef(null),eo=y.useCallback(()=>{var at;const j=it.current,ae=Ht.current;if(j===null||ae===null||(Qs.current===null&&(Qs.current=j.getContext("2d",{alpha:!1}),j.width=0,j.height=0),Zs.current===null&&(Zs.current=ae.getContext("2d",{alpha:!1}),ae.width=0,ae.height=0),Qs.current===null||Zs.current===null||Jn===null||Vr===null))return;let Te=!1;const we=ut=>{Te=!0,We(ut)},fe=ui.current,Pe={headerCanvasCtx:Zs.current,canvasCtx:Qs.current,bufferACtx:Jn,bufferBCtx:Vr,width:n,height:r,cellXOffset:mt,cellYOffset:l,translateX:Math.round(Ke),translateY:Math.round(an),mappedColumns:Ft,enableGroups:b,freezeColumns:C,dragAndDropState:se,theme:Be,headerHeight:a,groupHeaderHeight:c,disabledRows:ze??Pt.empty(),rowHeight:f,verticalBorder:be,isResizing:ye,resizeCol:ee,isFocused:k,selection:x,fillHandle:u,drawCellCallback:xe,hasAppendRow:Mt,overrideCursor:we,maxScaleFactor:Wl,freezeTrailingRows:A,rows:d,drawFocus:D,getCellContent:h,getGroupDetails:tt??(ut=>({name:ut})),getRowThemeOverride:p,drawHeaderCallback:Y,prelightCells:ue,highlightRegions:I,imageLoader:dt,lastBlitData:jt,damage:Yt.current,hoverValues:Jt.current,hoverInfo:lt.current,spriteManager:Tn,scrolling:mn,hyperWrapping:(ot==null?void 0:ot.hyperWrapping)??!1,touchMode:Lt,enqueue:st.current,renderStateProvider:rs,renderStrategy:(ot==null?void 0:ot.renderStrategy)??(zh.value?"double-buffer":"single-buffer"),getCellRenderer:rt,minimumCellWidth:Vl};Pe.damage===void 0?(ui.current=Pe,Hx(Pe,fe)):Hx(Pe,void 0),!Te&&(Pe.damage===void 0||Pe.damage.has((at=lt==null?void 0:lt.current)==null?void 0:at[0]))&&We(void 0)},[Jn,Vr,n,r,mt,l,Ke,an,Ft,b,C,se,Be,a,c,ze,f,be,ye,Mt,ee,k,x,u,A,d,D,Wl,h,tt,p,xe,Y,ue,I,dt,Tn,mn,ot==null?void 0:ot.hyperWrapping,ot==null?void 0:ot.renderStrategy,Lt,rs,rt,Vl]),z=y.useRef(eo);y.useLayoutEffect(()=>{eo(),z.current=eo},[eo]),y.useLayoutEffect(()=>{(async()=>{var ae;((ae=document==null?void 0:document.fonts)==null?void 0:ae.ready)!==void 0&&(await document.fonts.ready,ui.current=void 0,z.current())})()},[]);const oe=y.useCallback(j=>{Yt.current=j,z.current(),Yt.current=void 0},[]),Q=e6(oe);st.current=Q;const pe=y.useCallback(j=>{oe(new yc(j.map(ae=>ae.cell)))},[oe]);dt.setCallback(oe);const[ve,gt]=y.useState(!1),[Fe,ct]=J??[],ft=Fe!==void 0&&ct===-1,Kt=Fe!==void 0&&ct===-2;let nn=!1,zn=!1,rn=Qe;if(rn===void 0&&Fe!==void 0&&ct!==void 0&&ct>-1&&ct({contain:"strict",display:"block",cursor:xr}),[xr]),Mi=y.useRef("default"),Ri=W==null?void 0:W.current;Ri!=null&&Mi.current!==to.cursor&&(Ri.style.cursor=Mi.current=to.cursor);const ar=y.useCallback((j,ae,Te,we)=>{if(tt===void 0)return;const fe=tt(j);if(fe.actions!==void 0){const Pe=DE(ae,fe.actions);for(const[at,ut]of Pe.entries())if(zp(ut,Te+ae.x,we+ut.y))return fe.actions[at]}},[tt]),Oi=y.useCallback((j,ae,Te,we)=>{const fe=s[ae];if(!me&&!ye&&fe.hasMenu===!0&&!(Yn??!1)){const Pe=Vt(j,ae,-1);ei(Pe!==void 0);const at=_E(Pe.x,Pe.y,Pe.width,Pe.height,sw(fe.title)==="rtl");if(Te>at.x&&Teat.y&&we{const ae=it.current,Te=W==null?void 0:W.current;if(ae===null||j.target!==ae&&j.target!==Te)return;vu.current=!0;let we,fe;if(j instanceof MouseEvent?(we=j.clientX,fe=j.clientY):(we=j.touches[0].clientX,fe=j.touches[0].clientY),j.target===Te&&Te!==null){const at=Te.getBoundingClientRect();if(we>at.right||fe>at.bottom)return}const Pe=Ut(ae,we,fe,j);no.current=Pe.location,Pe.isTouch&&(yu.current=Date.now()),Zt.current!==Pe.isTouch&&Qt(Pe.isTouch),!(Pe.kind===go&&Oi(ae,Pe.location[0],we,fe)!==void 0)&&(Pe.kind===Zr&&ar(Pe.group,Pe.bounds,Pe.localEventX,Pe.localEventY)!==void 0||(O==null||O(Pe),!Pe.isTouch&&Le!==!0&&Le!==Pe.kind&&Pe.button<3&&Pe.button!==1&&j.preventDefault()))},[W,Le,Ut,ar,Oi,O]);rr("touchstart",kr,window,!1),rr("mousedown",kr,window,!1);const Ul=y.useRef(0),wu=y.useCallback(j=>{var Bt,ht;const ae=Ul.current;Ul.current=Date.now();const Te=it.current;if(vu.current=!1,L===void 0||Te===null)return;const we=W==null?void 0:W.current,fe=j.target!==Te&&j.target!==we;let Pe,at,ut=!0;if(j instanceof MouseEvent){if(Pe=j.clientX,at=j.clientY,ut=j.button<3,j.pointerType==="touch")return}else Pe=j.changedTouches[0].clientX,at=j.changedTouches[0].clientY;let Re=Ut(Te,Pe,at,j);Re.isTouch&&yu.current!==0&&Date.now()-yu.current>500&&(Re={...Re,isLongTouch:!0}),ae!==0&&Date.now()-ae<(Re.isTouch?1e3:500)&&(Re={...Re,isDoubleClick:!0}),Zt.current!==Re.isTouch&&Qt(Re.isTouch),!fe&&j.cancelable&&ut&&j.preventDefault();const[$t]=Re.location,je=Oi(Te,$t,Pe,at);if(Re.kind===go&&je!==void 0){(Re.button!==0||((Bt=no.current)==null?void 0:Bt[0])!==$t||((ht=no.current)==null?void 0:ht[1])!==-1)&&L(Re,!0);return}else if(Re.kind===Zr){const Ct=ar(Re.group,Re.bounds,Re.localEventX,Re.localEventY);if(Ct!==void 0){Re.button===0&&Ct.onClick(Re);return}}L(Re,fe)},[L,W,Ut,Oi,ar]);rr("mouseup",wu,window,!1),rr("touchend",wu,window,!1);const xf=y.useCallback(j=>{var je,Bt;const ae=it.current;if(ae===null)return;const Te=W==null?void 0:W.current,we=j.target!==ae&&j.target!==Te;let fe,Pe,at=!0;j instanceof MouseEvent?(fe=j.clientX,Pe=j.clientY,at=j.button<3):(fe=j.changedTouches[0].clientX,Pe=j.changedTouches[0].clientY);const ut=Ut(ae,fe,Pe,j);Zt.current!==ut.isTouch&&Qt(ut.isTouch),!we&&j.cancelable&&at&&j.preventDefault();const[Re]=ut.location,$t=Oi(ae,Re,fe,Pe);if(ut.kind===go&&$t!==void 0)ut.button===0&&((je=no.current)==null?void 0:je[0])===Re&&((Bt=no.current)==null?void 0:Bt[1])===-1&&(g==null||g(Re,$t));else if(ut.kind===Zr){const ht=ar(ut.group,ut.bounds,ut.localEventX,ut.localEventY);ht!==void 0&&ut.button===0&&ht.onClick(ut)}},[W,Ut,Oi,g,ar]);rr("click",xf,window,!1);const eg=y.useCallback(j=>{const ae=it.current,Te=W==null?void 0:W.current;if(ae===null||j.target!==ae&&j.target!==Te||T===void 0)return;const we=Ut(ae,j.clientX,j.clientY,j);T(we,()=>{j.cancelable&&j.preventDefault()})},[W,Ut,T]);rr("contextmenu",eg,(W==null?void 0:W.current)??null,!1);const kf=y.useCallback(j=>{Yt.current=new yc(j.map(ae=>ae.item)),Jt.current=j,z.current(),Yt.current=void 0},[]),Pi=y.useMemo(()=>new JW(kf),[kf]),Ps=y.useRef(Pi);Ps.current=Pi,y.useLayoutEffect(()=>{const j=Ps.current;if(J===void 0||J[1]<0){j.setHovered(J);return}const ae=h(J,!0),Te=rt(ae),we=Te===void 0&&ae.kind===Ae.Custom||(Te==null?void 0:Te.needsHover)!==void 0&&(typeof Te.needsHover=="boolean"?Te.needsHover:Te.needsHover(ae));j.setHovered(we?J:void 0)},[h,rt,J]);const Ur=y.useRef(),K=y.useCallback(j=>{var ut;const ae=it.current;if(ae===null)return;const Te=W==null?void 0:W.current,we=j.target!==ae&&j.target!==Te,fe=Ut(ae,j.clientX,j.clientY,j);if(fe.kind!=="out-of-bounds"&&we&&!vu.current&&!fe.isTouch)return;const Pe=(Re,$t)=>{bn(je=>je===Re||(je==null?void 0:je[0][0])===(Re==null?void 0:Re[0][0])&&(je==null?void 0:je[0][1])===(Re==null?void 0:Re[0][1])&&((je==null?void 0:je[1][0])===(Re==null?void 0:Re[1][0])&&(je==null?void 0:je[1][1])===(Re==null?void 0:Re[1][1])||!$t)?je:Re)};if(!GE(fe,Ur.current))We(void 0),ie==null||ie(fe),Pe(fe.kind===jh?void 0:[fe.location,[fe.localEventX,fe.localEventY]],!0),Ur.current=fe;else if(fe.kind==="cell"||fe.kind===go||fe.kind===Zr){let Re=!1,$t=!0;if(fe.kind==="cell"){const Bt=h(fe.location);$t=((ut=rt(Bt))==null?void 0:ut.needsHoverPosition)??Bt.kind===Ae.Custom,Re=$t}else fe.kind===Zr&&(Re=!0);const je=[fe.location,[fe.localEventX,fe.localEventY]];Pe(je,$t),lt.current=je,Re&&oe(new yc([fe.location]))}const at=fe.location[0]>=(H?0:1);Wr(fe.kind===go&&fe.isEdge&&at&&Ue===!0),gt(fe.kind==="cell"&&fe.isFillHandle),_==null||_(j),re(fe)},[W,Ut,H,Ue,_,re,ie,h,rt,oe]);rr("mousemove",K,window,!0);const yn=y.useCallback(j=>{const ae=it.current;if(ae===null)return;let Te,we;x.current!==void 0&&(Te=Vt(ae,x.current.cell[0],x.current.cell[1]),we=x.current.cell),X==null||X({bounds:Te,stopPropagation:()=>j.stopPropagation(),preventDefault:()=>j.preventDefault(),cancel:()=>{},ctrlKey:j.ctrlKey,metaKey:j.metaKey,shiftKey:j.shiftKey,altKey:j.altKey,key:j.key,keyCode:j.keyCode,rawEvent:j,location:we})},[X,x,Vt]),Jo=y.useCallback(j=>{const ae=it.current;if(ae===null)return;let Te,we;x.current!==void 0&&(Te=Vt(ae,x.current.cell[0],x.current.cell[1]),we=x.current.cell),R==null||R({bounds:Te,stopPropagation:()=>j.stopPropagation(),preventDefault:()=>j.preventDefault(),cancel:()=>{},ctrlKey:j.ctrlKey,metaKey:j.metaKey,shiftKey:j.shiftKey,altKey:j.altKey,key:j.key,keyCode:j.keyCode,rawEvent:j,location:we})},[R,x,Vt]),tg=y.useCallback(j=>{it.current=j,P!==void 0&&(P.current=j)},[P]),Sf=y.useCallback(j=>{const ae=it.current;if(ae===null||Le===!1||ye){j.preventDefault();return}let Te,we;const fe=Ut(ae,j.clientX,j.clientY);if(Le!==!0&&fe.kind!==Le){j.preventDefault();return}const Pe=(Bt,ht)=>{Te=Bt,we=ht};let at,ut,Re;const $t=(Bt,ht,Ct)=>{at=Bt,ut=ht,Re=Ct};let je=!1;if(B==null||B({...fe,setData:Pe,setDragImage:$t,preventDefault:()=>je=!0,defaultPrevented:()=>je}),!je&&Te!==void 0&&we!==void 0&&j.dataTransfer!==null)if(j.dataTransfer.setData(Te,we),j.dataTransfer.effectAllowed="copyLink",at!==void 0&&ut!==void 0&&Re!==void 0)j.dataTransfer.setDragImage(at,ut,Re);else{const[Bt,ht]=fe.location;if(ht!==void 0){const Ct=document.createElement("canvas"),Nn=Vt(ae,Bt,ht);ei(Nn!==void 0);const yt=Math.ceil(window.devicePixelRatio??1);Ct.width=Nn.width*yt,Ct.height=Nn.height*yt;const En=Ct.getContext("2d");En!==null&&(En.scale(yt,yt),En.textBaseline="middle",ht===-1?(En.font=Be.headerFontFull,En.fillStyle=Be.bgHeader,En.fillRect(0,0,Ct.width,Ct.height),LE(En,0,0,Nn.width,Nn.height,Ft[Bt],!1,Be,!1,!1,0,Tn,Y,!1)):(En.font=Be.baseFontFull,En.fillStyle=Be.bgCell,En.fillRect(0,0,Ct.width,Ct.height),IE(En,h([Bt,ht]),0,ht,!1,!1,0,0,Nn.width,Nn.height,!1,Be,Be.bgCell,dt,Tn,1,void 0,!1,0,void 0,void 0,void 0,rs,rt,()=>{}))),Ct.style.left="-100%",Ct.style.position="absolute",Ct.style.width=`${Nn.width}px`,Ct.style.height=`${Nn.height}px`,document.body.append(Ct),j.dataTransfer.setDragImage(Ct,Nn.width/2,Nn.height/2),window.setTimeout(()=>{Ct.remove()},0)}}else j.preventDefault()},[Le,ye,Ut,B,Vt,Be,Ft,Tn,Y,h,dt,rs,rt]);rr("dragstart",Sf,(W==null?void 0:W.current)??null,!1,!1);const bu=y.useRef(),ng=y.useCallback(j=>{const ae=it.current;if(Ce!==void 0&&j.preventDefault(),ae===null||Ne===void 0)return;const Te=Ut(ae,j.clientX,j.clientY),[we,fe]=Te.location,Pe=we-(H?0:1),[at,ut]=bu.current??[];(at!==Pe||ut!==fe)&&(bu.current=[Pe,fe],Ne([Pe,fe],j.dataTransfer))},[H,Ut,Ne,Ce]);rr("dragover",ng,(W==null?void 0:W.current)??null,!1,!1);const Xw=y.useCallback(()=>{bu.current=void 0,q==null||q()},[q]);rr("dragend",Xw,(W==null?void 0:W.current)??null,!1,!1);const Z=y.useCallback(j=>{const ae=it.current;if(ae===null||Ce===void 0)return;j.preventDefault();const Te=Ut(ae,j.clientX,j.clientY),[we,fe]=Te.location,Pe=we-(H?0:1);Ce([Pe,fe],j.dataTransfer)},[H,Ut,Ce]);rr("drop",Z,(W==null?void 0:W.current)??null,!1,!1);const ur=y.useCallback(()=>{xt==null||xt()},[xt]);rr("dragleave",ur,(W==null?void 0:W.current)??null,!1,!1);const Bn=y.useRef(x);Bn.current=x;const Kl=y.useRef(null),xu=y.useCallback(j=>{var ae;it.current===null||!it.current.contains(document.activeElement)||(j===null&&Bn.current.current!==void 0?(ae=P==null?void 0:P.current)==null||ae.focus({preventScroll:!0}):j!==null&&j.focus({preventScroll:!0}),Kl.current=j)},[P]);y.useImperativeHandle(e,()=>({focus:()=>{var ae;const j=Kl.current;j===null||!document.contains(j)?(ae=P==null?void 0:P.current)==null||ae.focus({preventScroll:!0}):j.focus({preventScroll:!0})},getBounds:(j,ae)=>{if(!(P===void 0||P.current===null))return Vt(P.current,j??0,ae??-1)},damage:pe}),[P,pe,Vt]);const ro=y.useRef(),Nr=UF(()=>{var ut,Re,$t;if(n<50||(ot==null?void 0:ot.disableAccessibilityTree)===!0)return null;let j=U0(Ft,mt,n,se,Ke);const ae=H?0:-1;!H&&((ut=j[0])==null?void 0:ut.sourceIndex)===0&&(j=j.slice(1));const[Te,we]=((Re=x.current)==null?void 0:Re.cell)??[],fe=($t=x.current)==null?void 0:$t.range,Pe=j.map(je=>je.sourceIndex),at=gl(l,Math.min(d,l+i));return Te!==void 0&&we!==void 0&&!(Pe.includes(Te)&&at.includes(we))&&xu(null),y.createElement("table",{key:"access-tree",role:"grid","aria-rowcount":d+1,"aria-multiselectable":"true","aria-colcount":Ft.length+ae},y.createElement("thead",{role:"rowgroup"},y.createElement("tr",{role:"row","aria-rowindex":1},j.map(je=>y.createElement("th",{role:"columnheader","aria-selected":x.columns.hasIndex(je.sourceIndex),"aria-colindex":je.sourceIndex+1+ae,tabIndex:-1,onFocus:Bt=>{if(Bt.target!==Kl.current)return Se==null?void 0:Se([je.sourceIndex,-1])},key:je.sourceIndex},je.title)))),y.createElement("tbody",{role:"rowgroup"},at.map(je=>y.createElement("tr",{role:"row","aria-selected":x.rows.hasIndex(je),key:je,"aria-rowindex":je+2},j.map(Bt=>{const ht=Bt.sourceIndex,Ct=Vi(ht,je),Nn=Te===ht&&we===je,yt=fe!==void 0&&ht>=fe.x&&ht=fe.y&&je{const Kr=P==null?void 0:P.current;if(Kr!=null)return X==null?void 0:X({bounds:Vt(Kr,ht,je),cancel:()=>{},preventDefault:()=>{},stopPropagation:()=>{},ctrlKey:!1,key:"Enter",keyCode:13,metaKey:!1,shiftKey:!1,altKey:!1,rawEvent:void 0,location:ci})},onFocusCapture:Kr=>{var It,In;if(!(Kr.target===Kl.current||((It=ro.current)==null?void 0:It[0])===ht&&((In=ro.current)==null?void 0:In[1])===je))return ro.current=ci,Se==null?void 0:Se(ci)},ref:Nn?xu:void 0,tabIndex:-1},t6(vn,rt))})))))},[n,Ft,mt,se,Ke,d,l,i,x,xu,h,P,X,Vt,Se],200),Ni=C===0||!M?0:mt>C?1:Wi(-Ke/100,0,1),rg=-l*32+an,Xl=N?Wi(-rg/100,0,1):0,ig=y.useMemo(()=>{if(!Ni&&!Xl)return null;const j={position:"absolute",top:0,left:tn,width:n-tn,height:r,opacity:Ni,pointerEvents:"none",transition:nt?void 0:"opacity 0.2s",boxShadow:"inset 13px 0 10px -13px rgba(0, 0, 0, 0.2)"},ae={position:"absolute",top:er,left:0,width:n,height:r,opacity:Xl,pointerEvents:"none",transition:ge?void 0:"opacity 0.2s",boxShadow:"inset 0 13px 10px -13px rgba(0, 0, 0, 0.2)"};return y.createElement(y.Fragment,null,Ni>0&&y.createElement("div",{id:"shadow-x",style:j}),Xl>0&&y.createElement("div",{id:"shadow-y",style:ae}))},[Ni,Xl,tn,n,nt,er,r,ge]),sg=y.useMemo(()=>({position:"absolute",top:0,left:0}),[]);return y.createElement(y.Fragment,null,y.createElement("canvas",{"data-testid":"data-grid-canvas",tabIndex:0,onKeyDown:yn,onKeyUp:Jo,onFocus:v,onBlur:w,ref:tg,style:to},Nr),y.createElement("canvas",{ref:Ht,style:sg}),ig)},r6=y.memo(y.forwardRef(n6));function ju(t,e,n,r){return Wi(Math.round(e-(t.growOffset??0)),Math.ceil(n),Math.floor(r))}const i6=t=>{const[e,n]=y.useState(),[r,i]=y.useState(),[s,o]=y.useState(),[l,a]=y.useState(),[u,c]=y.useState(!1),[f,d]=y.useState(),[h,p]=y.useState(),[g,b]=y.useState(),[m,v]=y.useState(!1),[w,k]=y.useState(),{onHeaderMenuClick:x,getCellContent:C,onColumnMoved:T,onColumnResize:A,onColumnResizeStart:M,onColumnResizeEnd:N,gridRef:D,maxColumnWidth:O,minColumnWidth:L,onRowMoved:_,lockColumns:re,onColumnProposeMove:ie,onMouseDown:se,onMouseUp:H,onItemHovered:X,onDragStart:R,canvasRef:I}=t,P=(A??N??M)!==void 0,{columns:B,selection:q}=t,W=q.columns,ye=y.useCallback(be=>{const[xe,Y]=be.location;s!==void 0&&l!==xe&&xe>=re?(c(!0),a(xe)):h!==void 0&&Y!==void 0?(v(!0),b(Math.max(0,Y))):r===void 0&&!u&&!m&&(X==null||X(be))},[s,h,l,X,re,r,u,m]),ee=T!==void 0,me=y.useCallback(be=>{var xe;if(be.button===0){const[Y,Se]=be.location;if(be.kind==="out-of-bounds"&&be.isEdge&&P){const Ne=(xe=D==null?void 0:D.current)==null?void 0:xe.getBounds(B.length-1,-1);Ne!==void 0&&(n(Ne.x),i(B.length-1))}else if(be.kind==="header"&&Y>=re){const Ne=I==null?void 0:I.current;if(be.isEdge&&P&&Ne){n(be.bounds.x),i(Y);const xt=Ne.getBoundingClientRect().width/Ne.offsetWidth,$e=be.bounds.width/xt;M==null||M(B[Y],$e,Y,$e+(B[Y].growOffset??0))}else be.kind==="header"&&ee&&(d(be.bounds.x),o(Y))}else be.kind==="cell"&&re>0&&Y===0&&Se!==void 0&&_!==void 0&&(k(be.bounds.y),p(Se))}se==null||se(be)},[se,P,re,_,D,B,ee,M,I]),Le=y.useCallback((be,xe)=>{u||m||x==null||x(be,xe)},[u,m,x]),Ue=y.useRef(-1),ze=y.useCallback(()=>{Ue.current=-1,p(void 0),b(void 0),k(void 0),v(!1),o(void 0),a(void 0),d(void 0),c(!1),i(void 0),n(void 0)},[]),Mt=y.useCallback((be,xe)=>{if(be.button===0){if(r!==void 0){if((W==null?void 0:W.hasIndex(r))===!0)for(const Se of W){if(Se===r)continue;const Ne=B[Se],Ce=ju(Ne,Ue.current,L,O);A==null||A(Ne,Ce,Se,Ce+(Ne.growOffset??0))}const Y=ju(B[r],Ue.current,L,O);if(N==null||N(B[r],Y,r,Y+(B[r].growOffset??0)),W.hasIndex(r))for(const Se of W){if(Se===r)continue;const Ne=B[Se],Ce=ju(Ne,Ue.current,L,O);N==null||N(Ne,Ce,Se,Ce+(Ne.growOffset??0))}}ze(),s!==void 0&&l!==void 0&&(T==null||T(s,l)),h!==void 0&&g!==void 0&&(_==null||_(h,g))}H==null||H(be,xe)},[H,r,s,l,h,g,W,N,B,L,O,A,T,_,ze]),tt=y.useMemo(()=>{if(!(s===void 0||l===void 0)&&s!==l&&(ie==null?void 0:ie(s,l))!==!1)return{src:s,dest:l}},[s,l,ie]),Be=y.useCallback(be=>{const xe=I==null?void 0:I.current;if(s!==void 0&&f!==void 0)Math.abs(be.clientX-f)>20&&c(!0);else if(h!==void 0&&w!==void 0)Math.abs(be.clientY-w)>20&&v(!0);else if(r!==void 0&&e!==void 0&&xe){const Se=xe.getBoundingClientRect().width/xe.offsetWidth,Ne=(be.clientX-e)/Se,Ce=B[r],xt=ju(Ce,Ne,L,O);if(A==null||A(Ce,xt,r,xt+(Ce.growOffset??0)),Ue.current=Ne,(W==null?void 0:W.first())===r)for(const $e of W){if($e===r)continue;const nt=B[$e],ge=ju(nt,Ue.current,L,O);A==null||A(nt,ge,$e,ge+(nt.growOffset??0))}}},[s,f,h,w,r,e,B,L,O,A,W,I]),ue=y.useCallback((be,xe)=>{if(h===void 0||g===void 0)return C(be,xe);let[Y,Se]=be;return Se===g?Se=h:(Se>g&&(Se-=1),Se>=h&&(Se+=1)),C([Y,Se],xe)},[h,g,C]),Nt=y.useCallback(be=>{R==null||R(be),be.defaultPrevented()||ze()},[ze,R]);return y.createElement(r6,{accessibilityHeight:t.accessibilityHeight,canvasRef:t.canvasRef,cellXOffset:t.cellXOffset,cellYOffset:t.cellYOffset,columns:t.columns,disabledRows:t.disabledRows,drawFocusRing:t.drawFocusRing,drawHeader:t.drawHeader,drawCell:t.drawCell,enableGroups:t.enableGroups,eventTargetRef:t.eventTargetRef,experimental:t.experimental,fillHandle:t.fillHandle,firstColAccessible:t.firstColAccessible,fixedShadowX:t.fixedShadowX,fixedShadowY:t.fixedShadowY,freezeColumns:t.freezeColumns,getCellRenderer:t.getCellRenderer,getGroupDetails:t.getGroupDetails,getRowThemeOverride:t.getRowThemeOverride,groupHeaderHeight:t.groupHeaderHeight,headerHeight:t.headerHeight,headerIcons:t.headerIcons,height:t.height,highlightRegions:t.highlightRegions,imageWindowLoader:t.imageWindowLoader,resizeColumn:r,isDraggable:t.isDraggable,isFilling:t.isFilling,isFocused:t.isFocused,onCanvasBlur:t.onCanvasBlur,onCanvasFocused:t.onCanvasFocused,onCellFocused:t.onCellFocused,onContextMenu:t.onContextMenu,onDragEnd:t.onDragEnd,onDragLeave:t.onDragLeave,onDragOverCell:t.onDragOverCell,onDrop:t.onDrop,onKeyDown:t.onKeyDown,onKeyUp:t.onKeyUp,onMouseMove:t.onMouseMove,prelightCells:t.prelightCells,rowHeight:t.rowHeight,rows:t.rows,selection:t.selection,smoothScrollX:t.smoothScrollX,smoothScrollY:t.smoothScrollY,theme:t.theme,freezeTrailingRows:t.freezeTrailingRows,hasAppendRow:t.hasAppendRow,translateX:t.translateX,translateY:t.translateY,verticalBorder:t.verticalBorder,width:t.width,getCellContent:ue,isResizing:r!==void 0,onHeaderMenuClick:Le,isDragging:u,onItemHovered:ye,onDragStart:Nt,onMouseDown:me,allowResize:P,onMouseUp:Mt,dragAndDropState:tt,onMouseMoveRaw:Be,ref:D})};function s6(t){const e=y.useRef(null),[n,r]=y.useState({width:t==null?void 0:t[0],height:t==null?void 0:t[1]});return y.useLayoutEffect(()=>{const i=o=>{for(const l of o){const{width:a,height:u}=l&&l.contentRect||{};r(c=>c.width===a&&c.height===u?c:{width:a,height:u})}},s=new window.ResizeObserver(i);return e.current&&s.observe(e.current,void 0),()=>{s.disconnect()}},[e.current]),{ref:e,...n}}const o6=(t,e,n)=>{const r=y.useRef(null),i=y.useRef(null),s=y.useRef(null),o=y.useRef(0),l=y.useRef(e);l.current=e;const a=n.current;y.useEffect(()=>{const u=()=>{var d,h;if(i.current===!1&&a!==null){const p=[a.scrollLeft,a.scrollTop];if(((d=s.current)==null?void 0:d[0])===p[0]&&((h=s.current)==null?void 0:h[1])===p[1])if(o.current>10){s.current=null,i.current=null;return}else o.current++;else o.current=0,l.current(p[0],p[1]),s.current=p;r.current=window.setTimeout(u,8.333333333333334)}},c=()=>{i.current=!0,s.current=null,r.current!==null&&(window.clearTimeout(r.current),r.current=null)},f=d=>{d.touches.length===0&&(i.current=!1,o.current=0,r.current=window.setTimeout(u,8.333333333333334))};if(t&&a!==null){const d=a;return d.addEventListener("touchstart",c),d.addEventListener("touchend",f),()=>{d.removeEventListener("touchstart",c),d.removeEventListener("touchend",f),r.current!==null&&window.clearTimeout(r.current)}}},[t,a])},l6=()=>t=>t.isSafari?"scroll":"auto",a6=ai("div")({name:"ScrollRegionStyle",class:"gdg-s1dgczr6",propsAsIs:!1,vars:{"s1dgczr6-0":[l6()]}});function u6(t){const[e,n]=y.useState(!1),r=typeof window>"u"?null:window,i=y.useRef(0);return rr("touchstart",y.useCallback(()=>{window.clearTimeout(i.current),n(!0)},[]),r,!0,!1),rr("touchend",y.useCallback(s=>{s.touches.length===0&&(i.current=window.setTimeout(()=>n(!1),t))},[t]),r,!0,!1),e}const c6=t=>{var B,q;const{children:e,clientHeight:n,scrollHeight:r,scrollWidth:i,update:s,draggable:o,className:l,preventDiagonalScrolling:a=!1,paddingBottom:u=0,paddingRight:c=0,rightElement:f,rightElementProps:d,kineticScrollPerfHack:h=!1,scrollRef:p,initialSize:g}=t,b=[],m=(d==null?void 0:d.sticky)??!1,v=(d==null?void 0:d.fill)??!1,w=y.useRef(0),k=y.useRef(0),x=y.useRef(null),C=typeof window>"u"?1:window.devicePixelRatio,T=y.useRef({scrollLeft:0,scrollTop:0,lockDirection:void 0}),A=y.useRef(null),M=u6(200),[N,D]=y.useState(!0),O=y.useRef(0);y.useLayoutEffect(()=>{if(!N||M||T.current.lockDirection===void 0)return;const W=x.current;if(W===null)return;const[ye,ee]=T.current.lockDirection;ye!==void 0?W.scrollLeft=ye:ee!==void 0&&(W.scrollTop=ee),T.current.lockDirection=void 0},[M,N]);const L=y.useCallback((W,ye)=>{var xe;const ee=x.current;if(ee===null)return;ye=ye??ee.scrollTop,W=W??ee.scrollLeft;const me=T.current.scrollTop,Le=T.current.scrollLeft,Ue=W-Le,ze=ye-me;M&&Ue!==0&&ze!==0&&(Math.abs(Ue)>3||Math.abs(ze)>3)&&a&&T.current.lockDirection===void 0&&(T.current.lockDirection=Math.abs(Ue)0&&(Math.abs(Nt)>2e3||ue===0||ue===be)&&r>ee.scrollHeight+5){const Y=ue/be,Se=(r-Be)*Y;w.current=Se-ue}Mt!==void 0&&(window.clearTimeout(O.current),D(!1),O.current=window.setTimeout(()=>D(!0),200)),s({x:W,y:ue+w.current,width:tt-c,height:Be-u,paddingRight:((xe=A.current)==null?void 0:xe.clientWidth)??0})},[u,c,r,s,a,M]);o6(h&&zh.value,L,x);const _=y.useRef(L);_.current=L;const re=y.useRef(),ie=y.useRef(!1);y.useLayoutEffect(()=>{ie.current?L():ie.current=!0},[L,u,c]);const se=y.useCallback(W=>{x.current=W,p!==void 0&&(p.current=W)},[p]);let H=0,X=0;for(b.push(y.createElement("div",{key:H++,style:{width:i,height:0}}));X_.current(),0),re.current={width:I,height:P}),(I??0)===0||(P??0)===0?y.createElement("div",{ref:R}):y.createElement("div",{ref:R},y.createElement(a6,{isSafari:zh.value},y.createElement("div",{className:"dvn-underlay"},e),y.createElement("div",{ref:se,style:re.current,draggable:o,onDragStart:W=>{o||(W.stopPropagation(),W.preventDefault())},className:"dvn-scroller "+(l??""),onScroll:()=>L()},y.createElement("div",{className:"dvn-scroll-inner"+(f===void 0?" dvn-hidden":"")},y.createElement("div",{className:"dvn-stack"},b),f!==void 0&&y.createElement(y.Fragment,null,!v&&y.createElement("div",{className:"dvn-spacer"}),y.createElement("div",{ref:A,style:{height:P,maxHeight:n-Math.ceil(C%1),position:"sticky",top:0,paddingLeft:1,marginBottom:-40,marginRight:c,flexGrow:v?1:void 0,right:m?c??0:void 0,pointerEvents:"auto"}},f))))))},f6=t=>{const{columns:e,rows:n,rowHeight:r,headerHeight:i,groupHeaderHeight:s,enableGroups:o,freezeColumns:l,experimental:a,nonGrowWidth:u,clientSize:c,className:f,onVisibleRegionChanged:d,scrollRef:h,preventDiagonalScrolling:p,rightElement:g,rightElementProps:b,overscrollX:m,overscrollY:v,initialSize:w,smoothScrollX:k=!1,smoothScrollY:x=!1,isDraggable:C}=t,{paddingRight:T,paddingBottom:A}=a??{},[M,N]=c,D=y.useRef(),O=y.useRef(),L=y.useRef(),_=y.useRef(),re=u+Math.max(0,m??0);let ie=o?i+s:i;if(typeof r=="number")ie+=n*r;else for(let R=0;R{var ze,Mt;if(se.current===void 0)return;const R={...se.current};let I=0,P=R.x<0?-R.x:0,B=0,q=0;R.x=R.x<0?0:R.x;let W=0;for(let tt=0;tt=Be+tt.width)I+=tt.width,q++,B++;else if(R.x>Be)I+=tt.width,k?P+=Be-R.x:q++,B++;else if(R.x+R.width>Be)I+=tt.width,B++;else break}let ye=0,ee=0,me=0;if(typeof r=="number")x?(ee=Math.floor(R.y/r),ye=ee*r-R.y):ee=Math.ceil(R.y/r),me=Math.ceil(R.height/r)+ee,ye<0&&me++;else{let tt=0;for(let Be=0;Be=tt+ue)tt+=ue,ee++,me++;else if(R.y>Nt)tt+=ue,x?ye+=Nt-R.y:ee++,me++;else if(R.y+R.height>ue/2+tt)tt+=ue,me++;else break}}const Le={x:q,y:ee,width:B-q,height:me-ee},Ue=D.current;(Ue===void 0||Ue.y!==Le.y||Ue.x!==Le.x||Ue.height!==Le.height||Ue.width!==Le.width||O.current!==P||L.current!==ye||R.width!==((ze=_.current)==null?void 0:ze[0])||R.height!==((Mt=_.current)==null?void 0:Mt[1]))&&(d==null||d({x:q,y:ee,width:B-q,height:me-ee},R.width,R.height,R.paddingRight??0,P,ye),D.current=Le,O.current=P,L.current=ye,_.current=[R.width,R.height])},[e,r,n,d,l,k,x]),X=y.useCallback(R=>{se.current=R,H()},[H]);return y.useEffect(()=>{H()},[H]),y.createElement(c6,{scrollRef:h,className:f,kineticScrollPerfHack:a==null?void 0:a.kineticScrollPerfHack,preventDiagonalScrolling:p,draggable:C===!0||typeof C=="string",scrollWidth:re+(T??0),scrollHeight:ie+(A??0),clientHeight:N,rightElement:g,paddingBottom:A,paddingRight:T,rightElementProps:b,update:X,initialSize:w},y.createElement(i6,{eventTargetRef:h,width:M,height:N,accessibilityHeight:t.accessibilityHeight,canvasRef:t.canvasRef,cellXOffset:t.cellXOffset,cellYOffset:t.cellYOffset,columns:t.columns,disabledRows:t.disabledRows,enableGroups:t.enableGroups,fillHandle:t.fillHandle,firstColAccessible:t.firstColAccessible,fixedShadowX:t.fixedShadowX,fixedShadowY:t.fixedShadowY,freezeColumns:t.freezeColumns,getCellContent:t.getCellContent,getCellRenderer:t.getCellRenderer,getGroupDetails:t.getGroupDetails,getRowThemeOverride:t.getRowThemeOverride,groupHeaderHeight:t.groupHeaderHeight,headerHeight:t.headerHeight,highlightRegions:t.highlightRegions,imageWindowLoader:t.imageWindowLoader,isFilling:t.isFilling,isFocused:t.isFocused,lockColumns:t.lockColumns,maxColumnWidth:t.maxColumnWidth,minColumnWidth:t.minColumnWidth,onHeaderMenuClick:t.onHeaderMenuClick,onMouseMove:t.onMouseMove,prelightCells:t.prelightCells,rowHeight:t.rowHeight,rows:t.rows,selection:t.selection,theme:t.theme,freezeTrailingRows:t.freezeTrailingRows,hasAppendRow:t.hasAppendRow,translateX:t.translateX,translateY:t.translateY,onColumnProposeMove:t.onColumnProposeMove,verticalBorder:t.verticalBorder,drawFocusRing:t.drawFocusRing,drawHeader:t.drawHeader,drawCell:t.drawCell,experimental:t.experimental,gridRef:t.gridRef,headerIcons:t.headerIcons,isDraggable:t.isDraggable,onCanvasBlur:t.onCanvasBlur,onCanvasFocused:t.onCanvasFocused,onCellFocused:t.onCellFocused,onColumnMoved:t.onColumnMoved,onColumnResize:t.onColumnResize,onColumnResizeEnd:t.onColumnResizeEnd,onColumnResizeStart:t.onColumnResizeStart,onContextMenu:t.onContextMenu,onDragEnd:t.onDragEnd,onDragLeave:t.onDragLeave,onDragOverCell:t.onDragOverCell,onDragStart:t.onDragStart,onDrop:t.onDrop,onItemHovered:t.onItemHovered,onKeyDown:t.onKeyDown,onKeyUp:t.onKeyUp,onMouseDown:t.onMouseDown,onMouseUp:t.onMouseUp,onRowMoved:t.onRowMoved,smoothScrollX:t.smoothScrollX,smoothScrollY:t.smoothScrollY}))},d6=ai("div")({name:"SearchWrapper",class:"gdg-seveqep",propsAsIs:!1}),h6=y.createElement("svg",{className:"button-icon",viewBox:"0 0 512 512"},y.createElement("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"48",d:"M112 244l144-144 144 144M256 120v292"})),p6=y.createElement("svg",{className:"button-icon",viewBox:"0 0 512 512"},y.createElement("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"48",d:"M112 268l144 144 144-144M256 392V100"})),g6=y.createElement("svg",{className:"button-icon",viewBox:"0 0 512 512"},y.createElement("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"32",d:"M368 368L144 144M368 144L144 368"})),m6=10,y6=t=>{const{canvasRef:e,cellYOffset:n,rows:r,columns:i,searchInputRef:s,searchValue:o,searchResults:l,onSearchValueChange:a,getCellsForSelection:u,onSearchResultsChanged:c,showSearch:f=!1,onSearchClose:d}=t,[h]=y.useState(()=>"search-box-"+Math.round(Math.random()*1e3)),[p,g]=y.useState(""),b=o??p,m=y.useCallback(I=>{g(I),a==null||a(I)},[a]),[v,w]=y.useState(),k=y.useRef(v);k.current=v,y.useEffect(()=>{l!==void 0&&(l.length>0?w(I=>({rowsSearched:r,results:l.length,selectedIndex:(I==null?void 0:I.selectedIndex)??-1})):w(void 0))},[r,l]);const x=y.useRef();x.current===void 0&&(x.current=new AbortController);const C=y.useRef(),[T,A]=y.useState([]),M=l??T,N=y.useCallback(()=>{C.current!==void 0&&(window.cancelAnimationFrame(C.current),C.current=void 0,x.current.abort())},[]),D=y.useRef(n);D.current=n;const O=y.useCallback(I=>{const P=new RegExp(I.replace(/([$()*+.?[\\\]^{|}-])/g,"\\$1"),"i");let B=D.current,q=Math.min(10,r),W=0;w(void 0),A([]);const ye=[],ee=async()=>{var be;if(u===void 0)return;const me=performance.now(),Le=r-W;let Ue=u({x:0,y:B,width:i.length,height:Math.min(q,Le,r-B)},x.current.signal);typeof Ue=="function"&&(Ue=await Ue());let ze=!1;for(const[xe,Y]of Ue.entries())for(const[Se,Ne]of Y.entries()){let Ce;switch(Ne.kind){case Ae.Text:case Ae.Number:Ce=Ne.displayData;break;case Ae.Uri:case Ae.Markdown:Ce=Ne.data;break;case Ae.Boolean:Ce=typeof Ne.data=="boolean"?Ne.data.toString():void 0;break;case Ae.Image:case Ae.Bubble:Ce=Ne.data.join("🐳");break;case Ae.Custom:Ce=Ne.copyData;break}Ce!==void 0&&P.test(Ce)&&(ye.push([Se,xe+B]),ze=!0)}const Mt=performance.now();ze&&A([...ye]),W+=Ue.length,ei(W<=r);const tt=((be=k.current)==null?void 0:be.selectedIndex)??-1;w({results:ye.length,rowsSearched:W,selectedIndex:tt}),c==null||c(ye,tt),B+q>=r?B=0:B+=q;const Be=Mt-me,ue=Math.max(Be,1),Nt=m6/ue;q=Math.ceil(q*Nt),W{var I;d==null||d(),w(void 0),A([]),c==null||c([],-1),N(),(I=e==null?void 0:e.current)==null||I.focus()},[N,e,d,c]),_=y.useCallback(I=>{m(I.target.value),l===void 0&&(I.target.value===""?(w(void 0),A([]),N()):O(I.target.value))},[O,N,m,l]);y.useEffect(()=>{f&&s.current!==null&&(m(""),s.current.focus({preventScroll:!0}))},[f,s,m]);const re=y.useCallback(I=>{var B;if((B=I==null?void 0:I.stopPropagation)==null||B.call(I),v===void 0)return;const P=(v.selectedIndex+1)%v.results;w({...v,selectedIndex:P}),c==null||c(M,P)},[v,c,M]),ie=y.useCallback(I=>{var B;if((B=I==null?void 0:I.stopPropagation)==null||B.call(I),v===void 0)return;let P=(v.selectedIndex-1)%v.results;P<0&&(P+=v.results),w({...v,selectedIndex:P}),c==null||c(M,P)},[c,M,v]),se=y.useCallback(I=>{(I.ctrlKey||I.metaKey)&&I.nativeEvent.code==="KeyF"||I.key==="Escape"?(L(),I.stopPropagation(),I.preventDefault()):I.key==="Enter"&&(I.shiftKey?ie():re())},[L,re,ie]);y.useEffect(()=>()=>{N()},[N]);const[H,X]=y.useState(!1);y.useEffect(()=>{if(f)X(!0);else{const I=setTimeout(()=>X(!1),150);return()=>clearTimeout(I)}},[f]);const R=y.useMemo(()=>{if(!f&&!H)return null;let I;v!==void 0&&(I=v.results>=1e3?"over 1000":`${v.results} result${v.results!==1?"s":""}`,v.selectedIndex>=0&&(I=`${v.selectedIndex+1} of ${I}`));const P=W=>{W.stopPropagation()},q={width:`${Math.floor(((v==null?void 0:v.rowsSearched)??0)/r*100)}%`};return y.createElement(d6,{className:f?"":"out",onMouseDown:P,onMouseMove:P,onMouseUp:P,onClick:P},y.createElement("div",{className:"gdg-search-bar-inner"},y.createElement("input",{id:h,"aria-hidden":!f,"data-testid":"search-input",ref:s,onChange:_,value:b,tabIndex:f?void 0:-1,onKeyDownCapture:se}),y.createElement("button",{"aria-label":"Previous Result","aria-hidden":!f,tabIndex:f?void 0:-1,onClick:ie,disabled:((v==null?void 0:v.results)??0)===0},h6),y.createElement("button",{"aria-label":"Next Result","aria-hidden":!f,tabIndex:f?void 0:-1,onClick:re,disabled:((v==null?void 0:v.results)??0)===0},p6),d!==void 0&&y.createElement("button",{"aria-label":"Close Search","aria-hidden":!f,"data-testid":"search-close-button",tabIndex:f?void 0:-1,onClick:L},g6)),v!==void 0?y.createElement(y.Fragment,null,y.createElement("div",{className:"gdg-search-status"},y.createElement("div",{"data-testid":"search-result-area"},I)),y.createElement("div",{className:"gdg-search-progress",style:q})):y.createElement("div",{className:"gdg-search-status"},y.createElement("label",{htmlFor:h},"Type to search")))},[f,H,v,r,h,s,_,b,se,ie,re,d,L]);return y.createElement(y.Fragment,null,y.createElement(f6,{prelightCells:M,accessibilityHeight:t.accessibilityHeight,canvasRef:t.canvasRef,cellXOffset:t.cellXOffset,cellYOffset:t.cellYOffset,className:t.className,clientSize:t.clientSize,columns:t.columns,disabledRows:t.disabledRows,enableGroups:t.enableGroups,fillHandle:t.fillHandle,firstColAccessible:t.firstColAccessible,nonGrowWidth:t.nonGrowWidth,fixedShadowX:t.fixedShadowX,fixedShadowY:t.fixedShadowY,freezeColumns:t.freezeColumns,getCellContent:t.getCellContent,getCellRenderer:t.getCellRenderer,getGroupDetails:t.getGroupDetails,getRowThemeOverride:t.getRowThemeOverride,groupHeaderHeight:t.groupHeaderHeight,headerHeight:t.headerHeight,highlightRegions:t.highlightRegions,imageWindowLoader:t.imageWindowLoader,initialSize:t.initialSize,isFilling:t.isFilling,isFocused:t.isFocused,lockColumns:t.lockColumns,maxColumnWidth:t.maxColumnWidth,minColumnWidth:t.minColumnWidth,onHeaderMenuClick:t.onHeaderMenuClick,onMouseMove:t.onMouseMove,onVisibleRegionChanged:t.onVisibleRegionChanged,overscrollX:t.overscrollX,overscrollY:t.overscrollY,preventDiagonalScrolling:t.preventDiagonalScrolling,rightElement:t.rightElement,rightElementProps:t.rightElementProps,rowHeight:t.rowHeight,rows:t.rows,scrollRef:t.scrollRef,selection:t.selection,theme:t.theme,freezeTrailingRows:t.freezeTrailingRows,hasAppendRow:t.hasAppendRow,translateX:t.translateX,translateY:t.translateY,verticalBorder:t.verticalBorder,onColumnProposeMove:t.onColumnProposeMove,drawFocusRing:t.drawFocusRing,drawCell:t.drawCell,drawHeader:t.drawHeader,experimental:t.experimental,gridRef:t.gridRef,headerIcons:t.headerIcons,isDraggable:t.isDraggable,onCanvasBlur:t.onCanvasBlur,onCanvasFocused:t.onCanvasFocused,onCellFocused:t.onCellFocused,onColumnMoved:t.onColumnMoved,onColumnResize:t.onColumnResize,onColumnResizeEnd:t.onColumnResizeEnd,onColumnResizeStart:t.onColumnResizeStart,onContextMenu:t.onContextMenu,onDragEnd:t.onDragEnd,onDragLeave:t.onDragLeave,onDragOverCell:t.onDragOverCell,onDragStart:t.onDragStart,onDrop:t.onDrop,onItemHovered:t.onItemHovered,onKeyDown:t.onKeyDown,onKeyUp:t.onKeyUp,onMouseDown:t.onMouseDown,onMouseUp:t.onMouseUp,onRowMoved:t.onRowMoved,smoothScrollX:t.smoothScrollX,smoothScrollY:t.smoothScrollY}),R)};class v6 extends y.PureComponent{constructor(){super(...arguments);kt(this,"wrapperRef",y.createRef());kt(this,"clickOutside",n=>{if(!(this.props.isOutsideClick&&!this.props.isOutsideClick(n))&&this.wrapperRef.current!==null&&!this.wrapperRef.current.contains(n.target)){let r=n.target;for(;r!==null;){if(r.classList.contains("click-outside-ignore"))return;r=r.parentElement}this.props.onClickOutside()}})}componentDidMount(){document.addEventListener("touchend",this.clickOutside,!0),document.addEventListener("mousedown",this.clickOutside,!0),document.addEventListener("contextmenu",this.clickOutside,!0)}componentWillUnmount(){document.removeEventListener("touchend",this.clickOutside,!0),document.removeEventListener("mousedown",this.clickOutside,!0),document.removeEventListener("contextmenu",this.clickOutside,!0)}render(){const{onClickOutside:n,isOutsideClick:r,...i}=this.props;return y.createElement("div",{...i,ref:this.wrapperRef},this.props.children)}}const w6=()=>t=>Math.max(16,t.targetHeight-10),b6=ai("input")({name:"RenameInput",class:"gdg-r17m35ur",propsAsIs:!1,vars:{"r17m35ur-0":[w6(),"px"]}}),x6=t=>{const{bounds:e,group:n,onClose:r,canvasBounds:i,onFinish:s}=t,[o,l]=Kn.useState(n);return Kn.createElement(v6,{style:{position:"absolute",left:e.x-i.left+1,top:e.y-i.top,width:e.width-2,height:e.height},className:"gdg-c1tqibwd",onClickOutside:r},Kn.createElement(b6,{targetHeight:e.height,"data-testid":"group-rename-input",value:o,onBlur:r,onFocus:a=>a.target.setSelectionRange(0,o.length),onChange:a=>l(a.target.value),onKeyDown:a=>{a.key==="Enter"?s(o):a.key==="Escape"&&r()},autoFocus:!0}))};function k6(t,e){return t===void 0?!1:t.length>1&&t.startsWith("_")?Number.parseInt(t.slice(1))===e.keyCode:t.length===1&&t>="a"&&t<="z"?t.toUpperCase().codePointAt(0)===e.keyCode:t===e.key}function wt(t,e,n){const r=qE(t,e);return r&&(n.didMatch=!0),r}function qE(t,e){if(t.length===0)return!1;if(t.includes("|")){const a=t.split("|");for(const u of a)if(qE(u,e))return!0;return!1}let n=!1,r=!1,i=!1,s=!1;const o=t.split("+"),l=o.pop();if(!k6(l,e))return!1;if(o[0]==="any")return!0;for(const a of o)switch(a){case"ctrl":n=!0;break;case"shift":r=!0;break;case"alt":i=!0;break;case"meta":s=!0;break;case"primary":Bh.value?s=!0:n=!0;break}return e.altKey===i&&e.ctrlKey===n&&e.shiftKey===r&&e.metaKey===s}function S6(t,e,n,r,i,s){const o=Kn.useCallback((u,c,f,d)=>{var v;(s==="cell"||s==="multi-cell")&&u!==void 0&&(u={...u,range:{x:u.cell[0],y:u.cell[1],width:1,height:1}});const h=n==="mixed"&&(f||d==="drag"),p=r==="mixed"&&h,g=i==="mixed"&&h;let b={current:u===void 0?void 0:{...u,rangeStack:d==="drag"?((v=t.current)==null?void 0:v.rangeStack)??[]:[]},columns:p?t.columns:Pt.empty(),rows:g?t.rows:Pt.empty()};f&&(s==="multi-rect"||s==="multi-cell")&&b.current!==void 0&&t.current!==void 0&&(b={...b,current:{...b.current,rangeStack:[...t.current.rangeStack,t.current.range]}}),e(b,c)},[r,t,n,s,i,e]),l=Kn.useCallback((u,c,f)=>{u=u??t.rows,c!==void 0&&(u=u.add(c));let d;if(i==="exclusive"&&u.length>0)d={current:void 0,columns:Pt.empty(),rows:u};else{const h=f&&n==="mixed",p=f&&r==="mixed";d={current:h?t.current:void 0,columns:p?t.columns:Pt.empty(),rows:u}}e(d,!1)},[r,t,n,i,e]),a=Kn.useCallback((u,c,f)=>{u=u??t.columns,c!==void 0&&(u=u.add(c));let d;if(r==="exclusive"&&u.length>0)d={current:void 0,rows:Pt.empty(),columns:u};else{const h=f&&n==="mixed",p=f&&i==="mixed";d={current:h?t.current:void 0,rows:p?t.rows:Pt.empty(),columns:u}}e(d,!1)},[r,t,n,i,e]);return[o,l,a]}function C6(t,e,n,r,i){const s=y.useCallback(u=>{if(t===!0){const c=[];for(let f=u.y;f=i?d.push({kind:Ae.Loading,allowOverlay:!1}):d.push(e([h,f]));c.push(d)}return c}return(t==null?void 0:t(u,r.signal))??[]},[r.signal,e,t,i]),o=t!==void 0?s:void 0,l=y.useCallback(u=>{if(o===void 0)return[];const c={...u,x:u.x-n};if(c.x<0){c.x=0,c.width--;const f=o(c,r.signal);return typeof f=="function"?async()=>(await f()).map(d=>[{kind:Ae.Loading,allowOverlay:!1},...d]):f.map(d=>[{kind:Ae.Loading,allowOverlay:!1},...d])}return o(c,r.signal)},[r.signal,o,n]);return[t!==void 0?l:void 0,o]}function T6(t){if(t.copyData!==void 0)return{formatted:t.copyData,rawValue:t.copyData,format:"string"};switch(t.kind){case Ae.Boolean:return{formatted:t.data===!0?"TRUE":t.data===!1?"FALSE":t.data===Zv?"INDETERMINATE":"",rawValue:t.data,format:"boolean"};case Ae.Custom:return{formatted:t.copyData,rawValue:t.copyData,format:"string"};case Ae.Image:case Ae.Bubble:return{formatted:t.data,rawValue:t.data,format:"string-array"};case Ae.Drilldown:return{formatted:t.data.map(e=>e.text),rawValue:t.data.map(e=>e.text),format:"string-array"};case Ae.Text:return{formatted:t.displayData??t.data,rawValue:t.data,format:"string"};case Ae.Uri:return{formatted:t.displayData??t.data,rawValue:t.data,format:"url"};case Ae.Markdown:case Ae.RowID:return{formatted:t.data,rawValue:t.data,format:"string"};case Ae.Number:return{formatted:t.displayData,rawValue:t.data,format:"number"};case Ae.Loading:return{formatted:"#LOADING",rawValue:"",format:"string"};case Ae.Protected:return{formatted:"************",rawValue:"",format:"string"};default:Wc()}}function E6(t,e){return t.map((r,i)=>{const s=e[i];return r.map(o=>o.span!==void 0&&o.span[0]!==s?{formatted:"",rawValue:"",format:"string"}:T6(o))})}function Vx(t,e){return(e?/[\t\n",]/:/[\t\n"]/).test(t)&&(t=`"${t.replace(/"/g,'""')}"`),t}function A6(t){var n;const e=[];for(const r of t){const i=[];for(const s of r)s.format==="url"?i.push(((n=s.rawValue)==null?void 0:n.toString())??""):s.format==="string-array"?i.push(s.formatted.map(o=>Vx(o,!0)).join(",")):i.push(Vx(s.formatted,!1));e.push(i.join(" "))}return e.join(` -`)}function lm(t){return t.replace(/\t/g," ").replace(/ {2,}/g,e=>" ".repeat(e.length))}function Ux(t){return'"'+t.replace(/&/g,"&").replace(/"/g,""").replace(//g,">")+'"'}function M6(t){return t.replace(/"/g,'"').replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&")}function R6(t){var n;const e=[];e.push('',"");for(const r of t){e.push("");for(const i of r){const s=`gdg-format="${i.format}"`;i.format==="url"?e.push(``):i.format==="string-array"?e.push(``):e.push(``)}e.push("")}return e.push("
    ${lm(i.formatted)}
      ${i.formatted.map((o,l)=>`
    1. `+lm(o)+"
    2. ").join("")}
    ${lm(i.formatted)}
    "),e.join("")}function O6(t,e){const n=E6(t,e),r=A6(n),i=R6(n);return{textPlain:r,textHtml:i}}function Kx(t){var o;const e=document.createElement("html");e.innerHTML=t.replace(/ /g," ");const n=e.querySelector("table");if(n===null)return;const r=[n],i=[];let s;for(;r.length>0;){const l=r.pop();if(l===void 0)break;if(l instanceof HTMLTableElement||l.nodeName==="TBODY")r.push(...[...l.children].reverse());else if(l instanceof HTMLTableRowElement)s!==void 0&&i.push(s),s=[],r.push(...[...l.children].reverse());else if(l instanceof HTMLTableCellElement){const a=l.cloneNode(!0),c=a.children.length===1&&a.children[0].nodeName==="P"?a.children[0]:null,f=(c==null?void 0:c.children.length)===1&&c.children[0].nodeName==="FONT",d=a.querySelectorAll("br");for(const g of d)g.replaceWith(` -`);const h=a.getAttribute("gdg-raw-value"),p=a.getAttribute("gdg-format")??"string";if(a.querySelector("a")!==null)s==null||s.push({rawValue:((o=a.querySelector("a"))==null?void 0:o.getAttribute("href"))??"",formatted:a.textContent??"",format:p});else if(a.querySelector("ol")!==null){const g=a.querySelectorAll("li");s==null||s.push({rawValue:[...g].map(b=>b.getAttribute("gdg-raw-value")??""),formatted:[...g].map(b=>b.textContent??""),format:"string-array"})}else if(h!==null)s==null||s.push({rawValue:M6(h),formatted:a.textContent??"",format:p});else{let g=a.textContent??"";f&&(g=g.replace(/\n(?!\n)/g,"")),s==null||s.push({rawValue:g??"",formatted:g??"",format:p})}}}return s!==void 0&&i.push(s),i}function P6(t,e,n,r,i){var l;const s=t;if(r==="allowPartial"||t.current===void 0||e===void 0)return t;let o=!1;do{if((t==null?void 0:t.current)===void 0)break;const a=(l=t.current)==null?void 0:l.range,u=[];if(a.width>2){const d=e({x:a.x,y:a.y,width:1,height:a.height},i.signal);if(typeof d=="function")return s;u.push(...d);const h=e({x:a.x+a.width-1,y:a.y,width:1,height:a.height},i.signal);if(typeof h=="function")return s;u.push(...h)}else{const d=e({x:a.x,y:a.y,width:a.width,height:a.height},i.signal);if(typeof d=="function")return s;u.push(...d)}let c=a.x-n,f=a.x+a.width-1-n;for(const d of u)for(const h of d)h.span!==void 0&&(c=Math.min(h.span[0],c),f=Math.max(h.span[1],f));c===a.x-n&&f===a.x+a.width-1-n?o=!0:t={current:{cell:t.current.cell??[0,0],range:{x:c+n,y:a.y,width:f-c+1,height:a.height},rangeStack:t.current.rangeStack},columns:t.columns,rows:t.rows}}while(!o);return t}function Xx(t){return t.startsWith('"')&&t.endsWith('"')&&(t=t.slice(1,-1).replace(/""/g,'"')),t}function N6(t){let e;(function(l){l[l.None=0]="None",l[l.inString=1]="inString",l[l.inStringPostQuote=2]="inStringPostQuote"})(e||(e={}));const n=[];let r=[],i=0,s=e.None;t=t.replace(/\r\n/g,` -`);let o=0;for(const l of t){switch(s){case e.None:l===" "||l===` -`?(r.push(t.slice(i,o)),i=o+1,l===` -`&&(n.push(r),r=[])):l==='"'&&(s=e.inString);break;case e.inString:l==='"'&&(s=e.inStringPostQuote);break;case e.inStringPostQuote:l==='"'?s=e.inString:((l===" "||l===` -`)&&(r.push(Xx(t.slice(i,o))),i=o+1,l===` -`&&(n.push(r),r=[])),s=e.None);break}o++}return il.map(a=>({rawValue:a,formatted:a,format:"string"})))}function Gx(t,e,n){var l;const r=O6(t,e),i=a=>{var u;(u=window.navigator.clipboard)==null||u.writeText(a)},s=(a,u)=>{var c;return((c=window.navigator.clipboard)==null?void 0:c.write)===void 0?!1:(window.navigator.clipboard.write([new ClipboardItem({"text/plain":new Blob([a],{type:"text/plain"}),"text/html":new Blob([u],{type:"text/html"})})]),!0)},o=(a,u)=>{var c,f;try{if(n===void 0||n.clipboardData===null)throw new Error("No clipboard data");(c=n==null?void 0:n.clipboardData)==null||c.setData("text/plain",a),(f=n==null?void 0:n.clipboardData)==null||f.setData("text/html",u)}catch{s(a,u)||i(a)}};((l=window.navigator.clipboard)==null?void 0:l.write)!==void 0||(n==null?void 0:n.clipboardData)!==void 0?o(r.textPlain,r.textHtml):i(r.textPlain),n==null||n.preventDefault()}function YE(t){return t!==!0}function qx(t){return typeof t=="string"?t:`${t}px`}const I6=()=>t=>t.innerWidth,_6=()=>t=>t.innerHeight,D6=ai("div")({name:"Wrapper",class:"gdg-wmyidgi",propsAsIs:!1,vars:{"wmyidgi-0":[I6()],"wmyidgi-1":[_6()]}}),L6=t=>{const{inWidth:e,inHeight:n,children:r,...i}=t;return y.createElement(D6,{innerHeight:qx(n),innerWidth:qx(e),...i},r)},$6=2,F6=1300;function z6(t,e,n){const r=Kn.useRef(0),[i,s]=t??[0,0];Kn.useEffect(()=>{if(i===0&&s===0){r.current=0;return}let o=!1,l=0;const a=u=>{var c;if(!o){if(l===0)l=u;else{const f=u-l;r.current=Math.min(1,r.current+f/F6);const d=r.current**1.618*f*$6;(c=e.current)==null||c.scrollBy(i*d,s*d),l=u,n==null||n()}window.requestAnimationFrame(a)}};return window.requestAnimationFrame(a),()=>{o=!0}},[e,i,s,n])}function B6({rowHeight:t,headerHeight:e,groupHeaderHeight:n,theme:r,overscrollX:i,overscrollY:s,scaleToRem:o,remSize:l}){const[a,u,c,f,d,h]=Kn.useMemo(()=>{if(!o||l===16)return[t,e,n,r,i,s];const p=l/16,g=t,b=xE();return[typeof g=="number"?g*p:m=>Math.ceil(g(m)*p),Math.ceil(e*p),Math.ceil(n*p),{...r,headerIconSize:((r==null?void 0:r.headerIconSize)??b.headerIconSize)*p,cellHorizontalPadding:((r==null?void 0:r.cellHorizontalPadding)??b.cellHorizontalPadding)*p,cellVerticalPadding:((r==null?void 0:r.cellVerticalPadding)??b.cellVerticalPadding)*p},Math.ceil((i??0)*p),Math.ceil((s??0)*p)]},[n,e,i,s,l,t,o,r]);return{rowHeight:a,headerHeight:u,groupHeaderHeight:c,theme:f,overscrollX:d,overscrollY:h}}const fo={downFill:!1,rightFill:!1,clear:!0,closeOverlay:!0,acceptOverlayDown:!0,acceptOverlayUp:!0,acceptOverlayLeft:!0,acceptOverlayRight:!0,copy:!0,paste:!0,cut:!0,search:!1,delete:!0,activateCell:!0,scrollToSelectedCell:!0,goToFirstCell:!0,goToFirstColumn:!0,goToFirstRow:!0,goToLastCell:!0,goToLastColumn:!0,goToLastRow:!0,goToNextPage:!0,goToPreviousPage:!0,selectToFirstCell:!0,selectToFirstColumn:!0,selectToFirstRow:!0,selectToLastCell:!0,selectToLastColumn:!0,selectToLastRow:!0,selectAll:!0,selectRow:!0,selectColumn:!0,goUpCell:!0,goRightCell:!0,goDownCell:!0,goLeftCell:!0,goUpCellRetainSelection:!0,goRightCellRetainSelection:!0,goDownCellRetainSelection:!0,goLeftCellRetainSelection:!0,selectGrowUp:!0,selectGrowRight:!0,selectGrowDown:!0,selectGrowLeft:!0};function bt(t,e){return t===!0?e:t===!1?"":t}function Yx(t){const e=Bh.value;return{activateCell:bt(t.activateCell," |Enter|shift+Enter"),clear:bt(t.clear,"any+Escape"),closeOverlay:bt(t.closeOverlay,"any+Escape"),acceptOverlayDown:bt(t.acceptOverlayDown,"Enter"),acceptOverlayUp:bt(t.acceptOverlayUp,"shift+Enter"),acceptOverlayLeft:bt(t.acceptOverlayLeft,"shift+Tab"),acceptOverlayRight:bt(t.acceptOverlayRight,"Tab"),copy:t.copy,cut:t.cut,delete:bt(t.delete,e?"Backspace|Delete":"Delete"),downFill:bt(t.downFill,"primary+_68"),scrollToSelectedCell:bt(t.scrollToSelectedCell,"primary+Enter"),goDownCell:bt(t.goDownCell,"ArrowDown"),goDownCellRetainSelection:bt(t.goDownCellRetainSelection,"alt+ArrowDown"),goLeftCell:bt(t.goLeftCell,"ArrowLeft|shift+Tab"),goLeftCellRetainSelection:bt(t.goLeftCellRetainSelection,"alt+ArrowLeft"),goRightCell:bt(t.goRightCell,"ArrowRight|Tab"),goRightCellRetainSelection:bt(t.goRightCellRetainSelection,"alt+ArrowRight"),goUpCell:bt(t.goUpCell,"ArrowUp"),goUpCellRetainSelection:bt(t.goUpCellRetainSelection,"alt+ArrowUp"),goToFirstCell:bt(t.goToFirstCell,"primary+Home"),goToFirstColumn:bt(t.goToFirstColumn,"Home|primary+ArrowLeft"),goToFirstRow:bt(t.goToFirstRow,"primary+ArrowUp"),goToLastCell:bt(t.goToLastCell,"primary+End"),goToLastColumn:bt(t.goToLastColumn,"End|primary+ArrowRight"),goToLastRow:bt(t.goToLastRow,"primary+ArrowDown"),goToNextPage:bt(t.goToNextPage,"PageDown"),goToPreviousPage:bt(t.goToPreviousPage,"PageUp"),paste:t.paste,rightFill:bt(t.rightFill,"primary+_82"),search:bt(t.search,"primary+f"),selectAll:bt(t.selectAll,"primary+a"),selectColumn:bt(t.selectColumn,"ctrl+ "),selectGrowDown:bt(t.selectGrowDown,"shift+ArrowDown"),selectGrowLeft:bt(t.selectGrowLeft,"shift+ArrowLeft"),selectGrowRight:bt(t.selectGrowRight,"shift+ArrowRight"),selectGrowUp:bt(t.selectGrowUp,"shift+ArrowUp"),selectRow:bt(t.selectRow,"shift+ "),selectToFirstCell:bt(t.selectToFirstCell,"primary+shift+Home"),selectToFirstColumn:bt(t.selectToFirstColumn,"primary+shift+ArrowLeft"),selectToFirstRow:bt(t.selectToFirstRow,"primary+shift+ArrowUp"),selectToLastCell:bt(t.selectToLastCell,"primary+shift+End"),selectToLastColumn:bt(t.selectToLastColumn,"primary+shift+ArrowRight"),selectToLastRow:bt(t.selectToLastRow,"primary+shift+ArrowDown")}}function j6(t){const e=YF(t);return Kn.useMemo(()=>{if(e===void 0)return Yx(fo);const n={...e,goToNextPage:(e==null?void 0:e.goToNextPage)??(e==null?void 0:e.pageDown)??fo.goToNextPage,goToPreviousPage:(e==null?void 0:e.goToPreviousPage)??(e==null?void 0:e.pageUp)??fo.goToPreviousPage,goToFirstCell:(e==null?void 0:e.goToFirstCell)??(e==null?void 0:e.first)??fo.goToFirstCell,goToLastCell:(e==null?void 0:e.goToLastCell)??(e==null?void 0:e.last)??fo.goToLastCell,selectToFirstCell:(e==null?void 0:e.selectToFirstCell)??(e==null?void 0:e.first)??fo.selectToFirstCell,selectToLastCell:(e==null?void 0:e.selectToLastCell)??(e==null?void 0:e.last)??fo.selectToLastCell};return Yx({...fo,...n})},[e])}const H6=y.lazy(async()=>await SE(()=>import("./data-grid-overlay-editor-CfH_njca.js"),[]));let W6=0;function V6(t){return X5(gx(gx(t).filter(e=>e.span!==void 0).map(e=>{var n,r;return gl((((n=e.span)==null?void 0:n[0])??0)+1,(((r=e.span)==null?void 0:r[1])??0)+1)})))}function od(t,e){return t===void 0||e===0||t.columns.length===0&&t.current===void 0?t:{current:t.current===void 0?void 0:{cell:[t.current.cell[0]+e,t.current.cell[1]],range:{...t.current.range,x:t.current.range.x+e},rangeStack:t.current.rangeStack.map(n=>({...n,x:n.x+e}))},rows:t.rows,columns:t.columns.offset(e)}}const am={kind:Ae.Loading,allowOverlay:!1},ld={columns:Pt.empty(),rows:Pt.empty(),current:void 0},U6=(t,e)=>{var l1,a1,u1;const[n,r]=y.useState(ld),[i,s]=y.useState(),o=y.useRef(null),l=y.useRef(null),[a,u]=y.useState(),c=y.useRef(null),f=y.useRef(),d=typeof window>"u"?null:window,{imageEditorOverride:h,getRowThemeOverride:p,markdownDivCreateNode:g,width:b,height:m,columns:v,rows:w,getCellContent:k,onCellClicked:x,onCellActivated:C,onFillPattern:T,onFinishedEditing:A,coercePasteValue:M,drawHeader:N,drawCell:D,editorBloom:O,onHeaderClicked:L,onColumnProposeMove:_,spanRangeBehavior:re="default",onGroupHeaderClicked:ie,onCellContextMenu:se,className:H,onHeaderContextMenu:X,getCellsForSelection:R,onGroupHeaderContextMenu:I,onGroupHeaderRenamed:P,onCellEdited:B,onCellsEdited:q,onSearchResultsChanged:W,searchResults:ye,onSearchValueChange:ee,searchValue:me,onKeyDown:Le,onKeyUp:Ue,keybindings:ze,editOnType:Mt=!0,onRowAppended:tt,onColumnMoved:Be,validateCell:ue,highlightRegions:Nt,rangeSelect:be="rect",columnSelect:xe="multi",rowSelect:Y="multi",rangeSelectionBlending:Se="exclusive",columnSelectionBlending:Ne="exclusive",rowSelectionBlending:Ce="exclusive",onDelete:xt,onDragStart:$e,onMouseMove:nt,onPaste:ge,copyHeaders:ot=!1,freezeColumns:rt=0,cellActivationBehavior:Ke="second-click",rowSelectionMode:an="auto",onHeaderMenuClick:mt,getGroupDetails:it,onSearchClose:dt,onItemHovered:Yt,onSelectionCleared:mn,showSearch:qn,onVisibleRegionChanged:Jt,gridSelection:jt,onGridSelectionChange:Hn,minColumnWidth:bn=50,maxColumnWidth:Yn=500,maxColumnAutoWidth:Wr,provideEditor:Ht,trailingRowOptions:Qe,freezeTrailingRows:We=0,allowedFillDirections:Lt="orthogonal",scrollOffsetX:Qt,scrollOffsetY:Zt,verticalBorder:Tn,onDragOverCell:er,onDrop:pt,onColumnResize:Wt,onColumnResizeEnd:Rt,onColumnResizeStart:Ft,customRenderers:tn,fillHandle:Vt,drawFocusRing:Ut=!0,experimental:J,fixedShadowX:st,fixedShadowY:lt,headerIcons:Jn,imageWindowLoader:Vr,initialSize:rs,isDraggable:Wl,onDragLeave:Vl,onRowMoved:ui,overscrollX:Qs,overscrollY:Zs,preventDiagonalScrolling:eo,rightElement:z,rightElementProps:oe,trapFocus:Q=!1,smoothScrollX:pe,smoothScrollY:ve,scaleToRem:gt=!1,rowHeight:Fe=34,headerHeight:ct=36,groupHeaderHeight:ft=ct,theme:Kt,isOutsideClick:nn,renderers:zn}=t,rn=typeof t.rowMarkers=="string"?void 0:t.rowMarkers,xn=(rn==null?void 0:rn.kind)??t.rowMarkers??"none",xr=(rn==null?void 0:rn.width)??t.rowMarkerWidth,to=(rn==null?void 0:rn.startIndex)??t.rowMarkerStartIndex??1,Mi=(rn==null?void 0:rn.theme)??t.rowMarkerTheme,Ri=(rn==null?void 0:rn.checkboxStyle)??"square",ar=Math.max(bn,20),Oi=Math.max(Yn,ar),yu=Math.max(Wr??Oi,ar),no=y.useMemo(()=>typeof window>"u"?{fontSize:"16px"}:window.getComputedStyle(document.documentElement),[]),vu=y.useMemo(()=>Number.parseFloat(no.fontSize),[no]),{rowHeight:kr,headerHeight:Ul,groupHeaderHeight:wu,theme:xf,overscrollX:eg,overscrollY:kf}=B6({groupHeaderHeight:ft,headerHeight:ct,overscrollX:Qs,overscrollY:Zs,remSize:vu,rowHeight:Fe,scaleToRem:gt,theme:Kt}),Pi=j6(ze),Ps=xr??(w>1e4?48:w>1e3?44:w>100?36:32),Ur=xn!=="none",K=Ur?1:0,yn=tt!==void 0,Jo=(Qe==null?void 0:Qe.sticky)===!0,[tg,Sf]=y.useState(!1),bu=qn??tg,ng=y.useCallback(()=>{dt!==void 0?dt():Sf(!1)},[dt]),Z=y.useMemo(()=>jt===void 0?void 0:od(jt,K),[jt,K])??n,ur=y.useRef();ur.current===void 0&&(ur.current=new AbortController),y.useEffect(()=>()=>ur==null?void 0:ur.current.abort(),[]);const[Bn,Kl]=C6(R,k,K,ur.current,w),xu=y.useCallback((S,F,$)=>{if(ue===void 0)return!0;const V=[S[0]-K,S[1]];return ue==null?void 0:ue(V,F,$)},[K,ue]),ro=y.useRef(jt),Nr=y.useCallback((S,F)=>{F&&(S=P6(S,Bn,K,re,ur.current)),Hn!==void 0?(ro.current=od(S,-K),Hn(ro.current)):r(S)},[Hn,Bn,K,re]),Ni=na(Wt,y.useCallback((S,F,$,V)=>{Wt==null||Wt(v[$-K],F,$-K,V)},[Wt,K,v])),rg=na(Rt,y.useCallback((S,F,$,V)=>{Rt==null||Rt(v[$-K],F,$-K,V)},[Rt,K,v])),Xl=na(Ft,y.useCallback((S,F,$,V)=>{Ft==null||Ft(v[$-K],F,$-K,V)},[Ft,K,v])),ig=na(N,y.useCallback((S,F)=>(N==null?void 0:N({...S,columnIndex:S.columnIndex-K},F))??!1,[N,K])),sg=na(D,y.useCallback((S,F)=>(D==null?void 0:D({...S,col:S.col-K},F))??!1,[D,K])),j=y.useCallback(S=>{if(xt!==void 0){const F=xt(od(S,-K));return typeof F=="boolean"?F:od(F,K)}return!0},[xt,K]),[ae,Te,we]=S6(Z,Nr,Se,Ne,Ce,be),fe=y.useMemo(()=>$o(xE(),xf),[xf]),[Pe,at]=y.useState([0,0,0]),ut=y.useMemo(()=>{if(zn===void 0)return{};const S={};for(const F of zn)S[F.kind]=F;return S},[zn]),Re=y.useCallback(S=>S.kind!==Ae.Custom?ut[S.kind]:tn==null?void 0:tn.find(F=>F.isMatch(S)),[tn,ut]);let{sizedColumns:$t,nonGrowWidth:je}=U4(v,w,Kl,Pe[0]-(K===0?0:Ps)-Pe[2],ar,yu,fe,Re,ur.current);xn!=="none"&&(je+=Ps);const Bt=y.useMemo(()=>$t.some(S=>S.group!==void 0),[$t]),ht=Bt?Ul+wu:Ul,Ct=Z.rows.length,Nn=xn==="none"?void 0:Ct===0?!1:Ct===w?!0:void 0,yt=y.useMemo(()=>xn==="none"?$t:[{title:"",width:Ps,icon:void 0,hasMenu:!1,style:"normal",themeOverride:Mi,rowMarker:Ri,rowMarkerChecked:Nn},...$t],[xn,$t,Ps,Mi,Ri,Nn]),[En,ci]=y.useMemo(()=>[Zt!==void 0&&typeof kr=="number"?Math.floor(Zt/kr):0,Zt!==void 0&&typeof kr=="number"?-(Zt%kr):0],[Zt,kr]),vn=y.useRef({height:1,width:1,x:0,y:0}),Kr=y.useMemo(()=>({x:vn.current.x,y:En,width:vn.current.width??1,height:vn.current.height??1,ty:ci}),[ci,En]),It=y.useRef(!1),[In,Xr,is]=qF(Kr);vn.current=In;const Ii=(In.height??1)>1;y.useLayoutEffect(()=>{if(Zt!==void 0&&c.current!==null&&Ii){if(c.current.scrollTop===Zt)return;c.current.scrollTop=Zt,c.current.scrollTop!==Zt&&is(),It.current=!0}},[Zt,Ii,is]);const Gl=(In.width??1)>1;y.useLayoutEffect(()=>{if(Qt!==void 0&&c.current!==null&&Gl){if(c.current.scrollLeft===Qt)return;c.current.scrollLeft=Qt,c.current.scrollLeft!==Qt&&is(),It.current=!0}},[Qt,Gl,is]);const Qo=In.x+K,Cf=In.y,Ir=y.useRef(null),Sr=y.useCallback(S=>{var F;S===!0?(F=Ir.current)==null||F.focus():window.requestAnimationFrame(()=>{var $;($=Ir.current)==null||$.focus()})},[]),cr=yn?w+1:w,fi=y.useCallback(S=>{const F=K===0?S:S.map(V=>({...V,location:[V.location[0]-K,V.location[1]]})),$=q==null?void 0:q(F);if($!==!0)for(const V of F)B==null||B(V.location,V.value);return $},[B,q,K]),[Zo,og]=y.useState(),Tf=Z.current!==void 0&&Z.current.range.width*Z.current.range.height>1?Z.current.range:void 0,ql=Ut?(l1=Z.current)==null?void 0:l1.cell:void 0,Ef=ql==null?void 0:ql[0],Af=ql==null?void 0:ql[1],DR=y.useMemo(()=>{if((Nt===void 0||Nt.length===0)&&(Tf??Ef??Af??Zo)===void 0)return;const S=[];if(Nt!==void 0)for(const F of Nt){const $=yt.length-F.range.x-K;$>0&&S.push({color:F.color,range:{...F.range,x:F.range.x+K,width:Math.min($,F.range.width)},style:F.style})}return Zo!==void 0&&S.push({color:Nl(fe.accentColor,0),range:Zo,style:"dashed"}),Tf!==void 0&&S.push({color:Nl(fe.accentColor,.5),range:Tf,style:"solid-outline"}),Ef!==void 0&&Af!==void 0&&S.push({color:fe.accentColor,range:{x:Ef,y:Af,width:1,height:1},style:"solid-outline"}),S.length>0?S:void 0},[Zo,Tf,Ef,Af,Nt,yt.length,fe.accentColor,K]),Gw=y.useRef(yt);Gw.current=yt;const Gr=y.useCallback(([S,F],$=!1)=>{var ne,G,te,ce,le,Me,Ie;const V=yn&&F===cr-1;if(S===0&&Ur)return V?am:{kind:yi.Marker,allowOverlay:!1,checkboxStyle:Ri,checked:(Z==null?void 0:Z.rows.hasIndex(F))===!0,markerKind:xn==="clickable-number"?"number":xn,row:to+F,drawHandle:ui!==void 0,cursor:xn==="clickable-number"?"pointer":void 0};if(V){const Xe=S===K?(Qe==null?void 0:Qe.hint)??"":"",Ye=Gw.current[S];if(((ne=Ye==null?void 0:Ye.trailingRowOptions)==null?void 0:ne.disabled)===!0)return am;{const Ot=((G=Ye==null?void 0:Ye.trailingRowOptions)==null?void 0:G.hint)??Xe,Ze=((te=Ye==null?void 0:Ye.trailingRowOptions)==null?void 0:te.addIcon)??(Qe==null?void 0:Qe.addIcon);return{kind:yi.NewRow,hint:Ot,allowOverlay:!1,icon:Ze}}}else{const Ee=S-K;if($||(J==null?void 0:J.strict)===!0){const Ye=vn.current,Ot=Ye.x>Ee||Ee>Ye.x+Ye.width||Ye.y>F||F>Ye.y+Ye.height||F>=ag.current,Ze=Ee===((le=(ce=Ye.extras)==null?void 0:ce.selected)==null?void 0:le[0])&&F===((Me=Ye.extras)==null?void 0:Me.selected[1]);let Ve=!1;if(((Ie=Ye.extras)==null?void 0:Ie.freezeRegions)!==void 0){for(const un of Ye.extras.freezeRegions)if(zp(un,Ee,F)){Ve=!0;break}}if(Ot&&!Ze&&!Ve)return am}let Xe=k([Ee,F]);return K!==0&&Xe.span!==void 0&&(Xe={...Xe,span:[Xe.span[0]+K,Xe.span[1]+K]}),Xe}},[yn,cr,Ur,Ri,Z==null?void 0:Z.rows,xn,to,ui,K,Qe==null?void 0:Qe.hint,Qe==null?void 0:Qe.addIcon,J==null?void 0:J.strict,k]),lg=y.useCallback(S=>{let F=(it==null?void 0:it(S))??{name:S};return P!==void 0&&S!==""&&(F={icon:F.icon,name:F.name,overrideTheme:F.overrideTheme,actions:[...F.actions??[],{title:"Rename",icon:"renameIcon",onClick:$=>cg({group:F.name,bounds:$.bounds})}]}),F},[it,P]),Mf=y.useCallback(S=>{var te;const[F,$]=S.cell,V=yt[F],U=(V==null?void 0:V.group)!==void 0?(te=lg(V.group))==null?void 0:te.overrideTheme:void 0,ne=V==null?void 0:V.themeOverride,G=p==null?void 0:p($);s({...S,theme:$o(fe,U,ne,G,S.content.themeOverride)})},[p,yt,lg,fe]),Yl=y.useCallback((S,F,$)=>{var G;if(Z.current===void 0)return;const[V,U]=Z.current.cell,ne=Gr([V,U]);if(ne.kind!==Ae.Boolean&&ne.allowOverlay){let te=ne;if($!==void 0)switch(te.kind){case Ae.Number:{const ce=O_(()=>$==="-"?-0:Number.parseFloat($),0);te={...te,data:Number.isNaN(ce)?0:ce};break}case Ae.Text:case Ae.Markdown:case Ae.Uri:te={...te,data:$};break}Mf({target:S,content:te,initialValue:$,cell:[V,U],highlight:$===void 0,forceEditMode:$!==void 0})}else ne.kind===Ae.Boolean&&F&&ne.readonly!==!0&&(fi([{location:Z.current.cell,value:{...ne,data:YE(ne.data)}}]),(G=Ir.current)==null||G.damage([{cell:Z.current.cell}]))},[Gr,Z,fi,Mf]),qw=y.useCallback((S,F)=>{var U;const $=(U=Ir.current)==null?void 0:U.getBounds(S,F);if($===void 0||c.current===null)return;const V=Gr([S,F]);V.allowOverlay&&Mf({target:$,content:V,initialValue:void 0,highlight:!0,cell:[S,F],forceEditMode:!0})},[Gr,Mf]),_n=y.useCallback((S,F,$="both",V=0,U=0,ne=void 0)=>{if(c.current!==null){const G=Ir.current,te=l.current,ce=typeof S!="number"?S.unit==="cell"?S.amount:void 0:S,le=typeof F!="number"?F.unit==="cell"?F.amount:void 0:F,Me=typeof S!="number"&&S.unit==="px"?S.amount:void 0,Ie=typeof F!="number"&&F.unit==="px"?F.amount:void 0;if(G!==null&&te!==null){let Ee={x:0,y:0,width:0,height:0},Xe=0,Ye=0;if((ce!==void 0||le!==void 0)&&(Ee=G.getBounds((ce??0)+K,le??0)??Ee,Ee.width===0||Ee.height===0))return;const Ot=te.getBoundingClientRect(),Ze=Ot.width/te.offsetWidth;if(Me!==void 0&&(Ee={...Ee,x:Me-Ot.left-c.current.scrollLeft,width:1}),Ie!==void 0&&(Ee={...Ee,y:Ie+Ot.top-c.current.scrollTop,height:1}),Ee!==void 0){const Ve={x:Ee.x-V,y:Ee.y-U,width:Ee.width+2*V,height:Ee.height+2*U};let un=0;for(let mg=0;mg0&&(fr=Hl(cr,Dn,kr));let Di=un*Ze+Ot.left+K*Ps*Ze,os=Ot.right,Li=Ot.top+ht*Ze,ls=Ot.bottom-fr*Ze;const _f=Ee.width+V*2;switch(ne==null?void 0:ne.hAlign){case"start":os=Di+_f;break;case"end":Di=os-_f;break;case"center":Di=Math.floor((Di+os)/2)-_f/2,os=Di+_f;break}const Df=Ee.height+U*2;switch(ne==null?void 0:ne.vAlign){case"start":ls=Li+Df;break;case"end":Li=ls-Df;break;case"center":Li=Math.floor((Li+ls)/2)-Df/2,ls=Li+Df;break}Di>Ve.x?Xe=Ve.x-Di:osVe.y?Ye=Ve.y-Li:ls=cr-Dn)&&(Ye=0),(Xe!==0||Ye!==0)&&(Ze!==1&&(Xe/=Ze,Ye/=Ze),c.current.scrollTo(Xe+c.current.scrollLeft,Ye+c.current.scrollTop))}}}},[K,We,Ps,ht,rt,$t,cr,Jo,kr]),Yw=y.useRef(qw),Jw=y.useRef(k),ag=y.useRef(w);Yw.current=qw,Jw.current=k,ag.current=w;const Jl=y.useCallback(async(S,F=!0)=>{var ce;const $=yt[S];if(((ce=$==null?void 0:$.trailingRowOptions)==null?void 0:ce.disabled)===!0)return;const V=tt==null?void 0:tt();let U,ne=!0;V!==void 0&&(U=await V,U==="top"&&(ne=!1),typeof U=="number"&&(ne=!1));let G=0;const te=()=>{if(ag.current<=w){G<500&&window.setTimeout(te,G),G=50+G*2;return}const le=typeof U=="number"?U:ne?w:0;If.current(S-K,le),ae({cell:[S,le],range:{x:S,y:le,width:1,height:1}},!1,!1,"edit");const Me=Jw.current([S-K,le]);Me.allowOverlay&&Qu(Me)&&Me.readonly!==!0&&F&&window.setTimeout(()=>{Yw.current(S,le)},0)};te()},[yt,tt,K,w,ae]),Rf=y.useCallback(S=>{var $,V;const F=((V=($=$t[S])==null?void 0:$.trailingRowOptions)==null?void 0:V.targetColumn)??(Qe==null?void 0:Qe.targetColumn);if(typeof F=="number")return F+(Ur?1:0);if(typeof F=="object"){const U=v.indexOf(F);if(U>=0)return U+(Ur?1:0)}},[$t,v,Ur,Qe==null?void 0:Qe.targetColumn]),io=y.useRef(),Ql=y.useRef(),ku=y.useCallback((S,F)=>{var U;const[$,V]=F;return $o(fe,(U=yt[$])==null?void 0:U.themeOverride,p==null?void 0:p(V),S.themeOverride)},[p,yt,fe]),Su=y.useCallback(S=>{var Me,Ie,Ee;const F=Bh.value?S.metaKey:S.ctrlKey,$=F&&Y==="multi",V=F&&xe==="multi",[U,ne]=S.location,G=Z.columns,te=Z.rows,[ce,le]=((Me=Z.current)==null?void 0:Me.cell)??[];if(S.kind==="cell"){if(Ql.current=void 0,el.current=[U,ne],U===0&&Ur){if(yn===!0&&ne===w||xn==="number"||Y==="none")return;const Xe=Gr(S.location);if(Xe.kind!==yi.Marker)return;if(ui!==void 0){const Ze=Re(Xe);ei((Ze==null?void 0:Ze.kind)===yi.Marker);const Ve=(Ie=Ze==null?void 0:Ze.onClick)==null?void 0:Ie.call(Ze,{...S,cell:Xe,posX:S.localEventX,posY:S.localEventY,bounds:S.bounds,theme:ku(Xe,S.location),preventDefault:()=>{}});if(Ve===void 0||Ve.checked===Xe.checked)return}s(void 0),Sr();const Ye=te.hasIndex(ne),Ot=io.current;if(Y==="multi"&&(S.shiftKey||S.isLongTouch===!0)&&Ot!==void 0&&te.hasIndex(Ot)){const Ze=[Math.min(Ot,ne),Math.max(Ot,ne)+1];$||an==="multi"?Te(void 0,Ze,!0):Te(Pt.fromSingleSelection(Ze),void 0,$)}else $||S.isTouch||an==="multi"?Ye?Te(te.remove(ne),void 0,!0):(Te(void 0,ne,!0),io.current=ne):Ye&&te.length===1?Te(Pt.empty(),void 0,F):(Te(Pt.fromSingleSelection(ne),void 0,F),io.current=ne)}else if(U>=K&&yn&&ne===w){const Xe=Rf(U);Jl(Xe??U)}else if(ce!==U||le!==ne){const Xe=Gr(S.location),Ye=Re(Xe);if((Ye==null?void 0:Ye.onSelect)!==void 0){let Ve=!1;if(Ye.onSelect({...S,cell:Xe,posX:S.localEventX,posY:S.localEventY,bounds:S.bounds,preventDefault:()=>Ve=!0,theme:ku(Xe,S.location)}),Ve)return}const Ot=Jo&&ne===w,Ze=Jo&&Z!==void 0&&((Ee=Z.current)==null?void 0:Ee.cell[1])===w;if((S.shiftKey||S.isLongTouch===!0)&&ce!==void 0&&le!==void 0&&Z.current!==void 0&&!Ze){if(Ot)return;const Ve=Math.min(U,ce),un=Math.max(U,ce),fr=Math.min(ne,le),Dn=Math.max(ne,le);ae({...Z.current,range:{x:Ve,y:fr,width:un-Ve+1,height:Dn-fr+1}},!0,F,"click"),io.current=void 0,Sr()}else ae({cell:[U,ne],range:{x:U,y:ne,width:1,height:1}},!0,F,"click"),io.current=void 0,s(void 0),Sr()}}else if(S.kind==="header")if(el.current=[U,ne],s(void 0),Ur&&U===0)io.current=void 0,Ql.current=void 0,Y==="multi"&&(te.length!==w?Te(Pt.fromSingleSelection([0,w]),void 0,F):Te(Pt.empty(),void 0,F),Sr());else{const Xe=Ql.current;if(xe==="multi"&&(S.shiftKey||S.isLongTouch===!0)&&Xe!==void 0&&G.hasIndex(Xe)){const Ye=[Math.min(Xe,U),Math.max(Xe,U)+1];V?we(void 0,Ye,F):we(Pt.fromSingleSelection(Ye),void 0,F)}else V?(G.hasIndex(U)?we(G.remove(U),void 0,F):we(void 0,U,F),Ql.current=U):xe!=="none"&&(we(Pt.fromSingleSelection(U),void 0,F),Ql.current=U);io.current=void 0,Sr()}else S.kind===Zr?el.current=[U,ne]:S.kind===jh&&!S.isMaybeScrollbar&&(Nr(ld,!1),s(void 0),Sr(),mn==null||mn(),io.current=void 0,Ql.current=void 0)},[Jl,xe,Sr,Re,Rf,Gr,Z,Ur,Jo,mn,ui,K,xn,Y,an,w,ae,Nr,we,Te,yn,ku]),Cu=y.useRef(!1),el=y.useRef(),Qw=y.useRef(In),di=y.useRef(),LR=y.useCallback(S=>{if(Zl.current=!1,Qw.current=vn.current,S.button!==0&&S.button!==1){di.current=void 0;return}const F=performance.now();di.current={button:S.button,time:F,location:S.location},(S==null?void 0:S.kind)==="header"&&(Cu.current=!0);const $=S.kind==="cell"&&S.isFillHandle;!$&&S.kind!=="cell"&&S.isEdge||(u({previousSelection:Z,fillHandle:$}),el.current=void 0,!S.isTouch&&S.button===0&&!$?Su(S):!S.isTouch&&S.button===1&&(el.current=S.location))},[Z,Su]),[ug,cg]=y.useState(),Zw=y.useCallback(S=>{if(S.kind!==Zr||xe!=="multi")return;const F=Bh.value?S.metaKey:S.ctrlKey,[$]=S.location,V=Z.columns;if($=K&&Vc(U.group,yt[te].group);te--)ne--;for(let te=$+1;te{if(Bn!==void 0&&Ni!==void 0){const F=vn.current.y,$=vn.current.height;let V=Bn({x:S,y:F,width:1,height:Math.min($,w-F)},ur.current.signal);typeof V!="object"&&(V=await V());const U=$t[S-K],G=document.createElement("canvas").getContext("2d",{alpha:!1});if(G!==null){G.font=fe.baseFontFull;const te=kE(G,fe,U,0,V,ar,Oi,!1,Re);Ni==null||Ni(U,te.width,S,te.width)}}},[$t,Bn,Oi,fe,ar,Ni,K,w,Re]),[$R,fg]=y.useState(),ea=y.useCallback(async(S,F)=>{var te,ce;const $=(te=S.current)==null?void 0:te.range;if($===void 0||Bn===void 0||F.current===void 0)return;const V=F.current.range;if(T!==void 0){let le=!1;if(T({fillDestination:{...V,x:V.x-K},patternSource:{...$,x:$.x-K},preventDefault:()=>le=!0}),le)return}let U=Bn($,ur.current.signal);typeof U!="object"&&(U=await U());const ne=U,G=[];for(let le=0;le({cell:le.location})))},[Bn,fi,T,K]),e1=y.useCallback(()=>{if(Z.current===void 0||Z.current.range.width<=1)return;const S={...Z,current:{...Z.current,range:{...Z.current.range,width:1}}};ea(S,Z)},[ea,Z]),t1=y.useCallback(()=>{if(Z.current===void 0||Z.current.range.height<=1)return;const S={...Z,current:{...Z.current,range:{...Z.current.range,height:1}}};ea(S,Z)},[ea,Z]),FR=y.useCallback((S,F)=>{var Me,Ie;const $=a;if(u(void 0),og(void 0),fg(void 0),Cu.current=!1,F)return;if(($==null?void 0:$.fillHandle)===!0&&Z.current!==void 0&&((Me=$.previousSelection)==null?void 0:Me.current)!==void 0){if(Zo===void 0)return;const Ee={...Z,current:{...Z.current,range:NE($.previousSelection.current.range,Zo)}};ea($.previousSelection,Ee),Nr(Ee,!0);return}const[V,U]=S.location,[ne,G]=el.current??[],te=()=>{Zl.current=!0},ce=Ee=>{var Ye,Ot,Ze;const Xe=Ee.isTouch||ne===V&&G===U;if(Xe&&(x==null||x([V-K,U],{...Ee,preventDefault:te})),Ee.button===1)return!Zl.current;if(!Zl.current){const Ve=Gr(S.location),un=Re(Ve);if(un!==void 0&&un.onClick!==void 0&&Xe){const Dn=un.onClick({...Ee,cell:Ve,posX:Ee.localEventX,posY:Ee.localEventY,bounds:Ee.bounds,theme:ku(Ve,S.location),preventDefault:te});Dn!==void 0&&!xa(Dn)&&oa(Dn)&&(fi([{location:Ee.location,value:Dn}]),(Ye=Ir.current)==null||Ye.damage([{cell:Ee.location}]))}if(Zl.current||Z.current===void 0)return!1;let fr=!1;switch(Ve.activationBehaviorOverride??Ke){case"double-click":case"second-click":{if(((Ze=(Ot=$==null?void 0:$.previousSelection)==null?void 0:Ot.current)==null?void 0:Ze.cell)===void 0)break;const[Dn,Di]=Z.current.cell,[os,Li]=$.previousSelection.current.cell;fr=V===Dn&&V===os&&U===Di&&U===Li&&(Ee.isDoubleClick===!0||Ke==="second-click");break}case"single-click":{fr=!0;break}}if(fr)return C==null||C([V-K,U]),Yl(Ee.bounds,!1),!0}return!1},le=S.location[0]-K;if(S.isTouch){const Ee=vn.current,Xe=Qw.current;if(Ee.x!==Xe.x||Ee.y!==Xe.y)return;if(S.isLongTouch===!0){if(S.kind==="cell"&&gc((Ie=Z.current)==null?void 0:Ie.cell,S.location)){se==null||se([le,S.location[1]],{...S,preventDefault:te});return}else if(S.kind==="header"&&Z.columns.hasIndex(V)){X==null||X(le,{...S,preventDefault:te});return}else if(S.kind===Zr){if(le<0)return;I==null||I(le,{...S,preventDefault:te});return}}S.kind==="cell"?ce(S)||Su(S):S.kind===Zr?ie==null||ie(le,{...S,preventDefault:te}):(S.kind===go&&(L==null||L(le,{...S,preventDefault:te})),Su(S));return}if(S.kind==="header"){if(le<0)return;S.isEdge?S.isDoubleClick===!0&&Of(V):S.button===0&&V===ne&&U===G&&(L==null||L(le,{...S,preventDefault:te}))}if(S.kind===Zr){if(le<0)return;S.button===0&&V===ne&&U===G&&(ie==null||ie(le,{...S,preventDefault:te}),Zl.current||Zw(S))}S.kind==="cell"&&(S.button===0||S.button===1)&&ce(S),el.current=void 0},[a,Z,K,Zo,ea,Nr,x,Gr,Re,Ke,ku,fi,C,Yl,se,X,I,Su,ie,L,Of,Zw]),zR=y.useCallback(S=>{const F={...S,location:[S.location[0]-K,S.location[1]]};nt==null||nt(F),a!==void 0&&S.buttons===0&&(u(void 0),og(void 0),fg(void 0),Cu.current=!1),fg($=>{var V;return Cu.current?[S.scrollEdge[0],0]:S.scrollEdge[0]===($==null?void 0:$[0])&&S.scrollEdge[1]===$[1]?$:a===void 0||(((V=di.current)==null?void 0:V.location[0])??0){mt==null||mt(S-K,F)},[mt,K]),ss=(a1=Z==null?void 0:Z.current)==null?void 0:a1.cell,jR=y.useCallback((S,F,$,V,U,ne)=>{It.current=!1;let G=ss;G!==void 0&&(G=[G[0]-K,G[1]]);const te=rt===0?void 0:{x:0,y:S.y,width:rt,height:S.height},ce=[];te!==void 0&&ce.push(te),We>0&&(ce.push({x:S.x-K,y:w-We,width:S.width,height:We}),rt>0&&ce.push({x:0,y:w-We,width:rt,height:We}));const le={x:S.x-K,y:S.y,width:S.width,height:yn&&S.y+S.height>=w?S.height-1:S.height,tx:U,ty:ne,extras:{selected:G,freezeRegion:te,freezeRegions:ce}};vn.current=le,Xr(le),at([F,$,V]),Jt==null||Jt(le,le.tx,le.ty,le.extras)},[ss,K,yn,w,rt,We,Xr,Jt]),HR=na(Be,y.useCallback((S,F)=>{Be==null||Be(S-K,F-K),xe!=="none"&&we(Pt.fromSingleSelection(F),void 0,!0)},[xe,Be,K,we])),dg=y.useRef(!1),WR=y.useCallback(S=>{if(S.location[0]===0&&K>0){S.preventDefault();return}$e==null||$e({...S,location:[S.location[0]-K,S.location[1]]}),S.defaultPrevented()||(dg.current=!0),u(void 0)},[$e,K]),VR=y.useCallback(()=>{dg.current=!1},[]),hg=y.useRef(),pg=y.useCallback(S=>{var F,$,V;if(!GE(S,hg.current)&&(hg.current=S,!(((F=di==null?void 0:di.current)==null?void 0:F.button)!==void 0&&di.current.button>=1))){if(S.buttons!==0&&a!==void 0&&(($=di.current)==null?void 0:$.location[0])===0&&S.location[0]===0&&K===1&&Y==="multi"&&a.previousSelection&&!a.previousSelection.rows.hasIndex(di.current.location[1])&&Z.rows.hasIndex(di.current.location[1])){const U=Math.min(di.current.location[1],S.location[1]),ne=Math.max(di.current.location[1],S.location[1])+1;Te(Pt.fromSingleSelection([U,ne]),void 0,!1)}if(S.buttons!==0&&a!==void 0&&Z.current!==void 0&&!dg.current&&!Cu.current&&(be==="rect"||be==="multi-rect")){const[U,ne]=Z.current.cell;let[G,te]=S.location;if(te<0&&(te=vn.current.y),a.fillHandle===!0&&((V=a.previousSelection)==null?void 0:V.current)!==void 0){const ce=a.previousSelection.current.range;te=Math.min(te,yn?w-1:w);const le=Pz(ce,G,te,Lt);og(le)}else{if(yn&&ne===w)return;if(yn&&te===w)if(S.kind===jh)te--;else return;G=Math.max(G,K);const Me=G-U,Ie=te-ne,Ee={x:Me>=0?U:G,y:Ie>=0?ne:te,width:Math.abs(Me)+1,height:Math.abs(Ie)+1};ae({...Z.current,range:Ee},!0,!1,"drag")}}Yt==null||Yt({...S,location:[S.location[0]-K,S.location[1]]})}},[Lt,a,K,Y,Z,be,Yt,Te,yn,w,ae]),UR=y.useCallback(()=>{var G,te;const S=hg.current;if(S===void 0)return;const[F,$]=S.scrollEdge;let[V,U]=S.location;const ne=vn.current;F===-1?V=((te=(G=ne.extras)==null?void 0:G.freezeRegion)==null?void 0:te.x)??ne.x:F===1&&(V=ne.x+ne.width),$===-1?U=Math.max(0,ne.y):$===1&&(U=Math.min(w-1,ne.y+ne.height)),V=Wi(V,0,yt.length-1),U=Wi(U,0,w-1),pg({...S,location:[V,U]})},[yt.length,pg,w]);z6($R,c,UR);const _i=y.useCallback(S=>{if(Z.current===void 0)return;const[F,$]=S,[V,U]=Z.current.cell,ne=Z.current.range;let G=ne.x,te=ne.x+ne.width,ce=ne.y,le=ne.y+ne.height;if($!==0)switch($){case 2:{le=w,ce=U,_n(0,le,"vertical");break}case-2:{ce=0,le=U+1,_n(0,ce,"vertical");break}case 1:{ceU+1?(le--,_n(0,le,"vertical")):(ce=Math.max(0,ce-1),_n(0,ce,"vertical"));break}default:Wc()}if(F!==0)if(F===2)te=yt.length,G=V,_n(te-1-K,0,"horizontal");else if(F===-2)G=K,te=V+1,_n(G-K,0,"horizontal");else{let Me=[];if(Bn!==void 0){const Ie=Bn({x:G,y:ce,width:te-G-K,height:le-ce},ur.current.signal);typeof Ie=="object"&&(Me=V6(Ie))}if(F===1){let Ie=!1;if(G0){const Ee=gl(G+1,V+1).find(Xe=>!Me.includes(Xe-K));Ee!==void 0&&(G=Ee,Ie=!0)}else G++,Ie=!0;Ie&&_n(G,0,"horizontal")}Ie||(te=Math.min(yt.length,te+1),_n(te-1-K,0,"horizontal"))}else if(F===-1){let Ie=!1;if(te>V+1){if(Me.length>0){const Ee=gl(te-1,V,-1).find(Xe=>!Me.includes(Xe-K));Ee!==void 0&&(te=Ee,Ie=!0)}else te--,Ie=!0;Ie&&_n(te-K,0,"horizontal")}Ie||(G=Math.max(K,G-1),_n(G-K,0,"horizontal"))}else Wc()}ae({cell:Z.current.cell,range:{x:G,y:ce,width:te-G,height:le-ce}},!0,!1,"keyboard-select")},[Bn,Z,yt.length,K,w,_n,ae]),so=y.useCallback((S,F,$,V)=>{const U=cr-($?0:1);if(S=Wi(S,K,$t.length-1+K),F=Wi(F,0,U),S===(ss==null?void 0:ss[0])&&F===(ss==null?void 0:ss[1]))return!1;if(V&&Z.current!==void 0){const ne=[...Z.current.rangeStack];(Z.current.range.width>1||Z.current.range.height>1)&&ne.push(Z.current.range),Nr({...Z,current:{cell:[S,F],range:{x:S,y:F,width:1,height:1},rangeStack:ne}},!0)}else ae({cell:[S,F],range:{x:S,y:F,width:1,height:1}},!0,!1,"keyboard-nav");return f.current!==void 0&&f.current[0]===S&&f.current[1]===F&&(f.current=void 0),_n(S-K,F),!0},[cr,K,$t.length,ss,Z,_n,Nr,ae]),KR=y.useCallback((S,F)=>{(i==null?void 0:i.cell)!==void 0&&S!==void 0&&oa(S)&&(fi([{location:i.cell,value:S}]),window.requestAnimationFrame(()=>{var U;(U=Ir.current)==null||U.damage([{cell:i.cell}])})),Sr(!0),s(void 0);const[$,V]=F;if(Z.current!==void 0&&($!==0||V!==0)){const U=Z.current.cell[1]===cr-1&&S!==void 0;so(Wi(Z.current.cell[0]+$,0,yt.length-1),Wi(Z.current.cell[1]+V,0,cr-1),U,!1)}A==null||A(S,F)},[i==null?void 0:i.cell,Sr,Z,A,fi,cr,so,yt.length]),XR=y.useMemo(()=>`gdg-overlay-${W6++}`,[]),tl=y.useCallback(S=>{var $,V,U,ne;Sr();const F=[];for(let G=S.x;G({cell:G.location})))},[Sr,k,Re,fi,K]),Tu=i!==void 0,n1=y.useCallback(S=>{var Xe,Ye;const F=()=>{S.stopPropagation(),S.preventDefault()},$={didMatch:!1},{bounds:V}=S,U=Z.columns,ne=Z.rows,G=Pi;if(!Tu&&wt(G.clear,S,$))Nr(ld,!1),mn==null||mn();else if(!Tu&&wt(G.selectAll,S,$))Nr({columns:Pt.empty(),rows:Pt.empty(),current:{cell:((Xe=Z.current)==null?void 0:Xe.cell)??[K,0],range:{x:K,y:0,width:v.length,height:w},rangeStack:[]}},!1);else if(wt(G.search,S,$))(Ye=o==null?void 0:o.current)==null||Ye.focus({preventScroll:!0}),Sf(!0);else if(wt(G.delete,S,$)){const Ot=(j==null?void 0:j(Z))??!0;if(Ot!==!1){const Ze=Ot===!0?Z:Ot;if(Ze.current!==void 0){tl(Ze.current.range);for(const Ve of Ze.current.rangeStack)tl(Ve)}for(const Ve of Ze.rows)tl({x:K,y:Ve,width:v.length,height:1});for(const Ve of Ze.columns)tl({x:Ve,y:0,width:1,height:w})}}if($.didMatch)return F(),!0;if(Z.current===void 0)return!1;let[te,ce]=Z.current.cell,le=!1,Me=!1;wt(G.scrollToSelectedCell,S,$)?If.current(te-K,ce):xe!=="none"&&wt(G.selectColumn,S,$)?U.hasIndex(te)?we(U.remove(te),void 0,!0):xe==="single"?we(Pt.fromSingleSelection(te),void 0,!0):we(void 0,te,!0):Y!=="none"&&wt(G.selectRow,S,$)?ne.hasIndex(ce)?Te(ne.remove(ce),void 0,!0):Y==="single"?Te(Pt.fromSingleSelection(ce),void 0,!0):Te(void 0,ce,!0):!Tu&&V!==void 0&&wt(G.activateCell,S,$)?ce===w&&yn?window.setTimeout(()=>{const Ot=Rf(te);Jl(Ot??te)},0):(C==null||C([te-K,ce]),Yl(V,!0)):Z.current.range.height>1&&wt(G.downFill,S,$)?t1():Z.current.range.width>1&&wt(G.rightFill,S,$)?e1():wt(G.goToNextPage,S,$)?ce+=Math.max(1,vn.current.height-4):wt(G.goToPreviousPage,S,$)?ce-=Math.max(1,vn.current.height-4):wt(G.goToFirstCell,S,$)?(s(void 0),ce=0,te=0):wt(G.goToLastCell,S,$)?(s(void 0),ce=Number.MAX_SAFE_INTEGER,te=Number.MAX_SAFE_INTEGER):wt(G.selectToFirstCell,S,$)?(s(void 0),_i([-2,-2])):wt(G.selectToLastCell,S,$)?(s(void 0),_i([2,2])):Tu?(wt(G.closeOverlay,S,$)&&s(void 0),wt(G.acceptOverlayDown,S,$)&&(s(void 0),ce++),wt(G.acceptOverlayUp,S,$)&&(s(void 0),ce--),wt(G.acceptOverlayLeft,S,$)&&(s(void 0),te--),wt(G.acceptOverlayRight,S,$)&&(s(void 0),te++)):(wt(G.goDownCell,S,$)?ce+=1:wt(G.goUpCell,S,$)?ce-=1:wt(G.goRightCell,S,$)?te+=1:wt(G.goLeftCell,S,$)?te-=1:wt(G.goDownCellRetainSelection,S,$)?(ce+=1,le=!0):wt(G.goUpCellRetainSelection,S,$)?(ce-=1,le=!0):wt(G.goRightCellRetainSelection,S,$)?(te+=1,le=!0):wt(G.goLeftCellRetainSelection,S,$)?(te-=1,le=!0):wt(G.goToLastRow,S,$)?ce=w-1:wt(G.goToFirstRow,S,$)?ce=Number.MIN_SAFE_INTEGER:wt(G.goToLastColumn,S,$)?te=Number.MAX_SAFE_INTEGER:wt(G.goToFirstColumn,S,$)?te=Number.MIN_SAFE_INTEGER:(be==="rect"||be==="multi-rect")&&(wt(G.selectGrowDown,S,$)?_i([0,1]):wt(G.selectGrowUp,S,$)?_i([0,-1]):wt(G.selectGrowRight,S,$)?_i([1,0]):wt(G.selectGrowLeft,S,$)?_i([-1,0]):wt(G.selectToLastRow,S,$)?_i([0,2]):wt(G.selectToFirstRow,S,$)?_i([0,-2]):wt(G.selectToLastColumn,S,$)?_i([2,0]):wt(G.selectToFirstColumn,S,$)&&_i([-2,0])),Me=$.didMatch);const Ie=so(te,ce,!1,le),Ee=$.didMatch;return Ee&&(Ie||!Me||Q)&&F(),Ee},[Tu,Z,Pi,xe,Y,be,K,w,so,Nr,mn,v.length,j,Q,tl,we,Te,yn,Rf,Jl,C,Yl,t1,e1,_i]),Eu=y.useCallback(S=>{let F=!1;if(Le!==void 0&&Le({...S,cancel:()=>{F=!0}}),F||n1(S)||Z.current===void 0)return;const[$,V]=Z.current.cell,U=vn.current;if(Mt&&!S.metaKey&&!S.ctrlKey&&Z.current!==void 0&&S.key.length===1&&/[ -~]/g.test(S.key)&&S.bounds!==void 0&&Qu(k([$-K,Math.max(0,Math.min(V,w-1))]))){if((!yn||V!==w)&&(U.y>V||V>U.y+U.height||U.x>$||$>U.x+U.width))return;Yl(S.bounds,!0,S.key),S.stopPropagation(),S.preventDefault()}},[Mt,Le,n1,Z,k,K,w,yn,Yl]),GR=y.useCallback((S,F)=>{const $=S.location[0]-K;if(S.kind==="header"&&(X==null||X($,{...S,preventDefault:F})),S.kind===Zr){if($<0)return;I==null||I($,{...S,preventDefault:F})}if(S.kind==="cell"){const[V,U]=S.location;se==null||se([$,U],{...S,preventDefault:F}),A4(Z,S.location)||so(V,U,!1,!1)}},[Z,se,I,X,K,so]),gg=y.useCallback(async S=>{var G,te,ce;if(!Pi.paste)return;function F(le,Me,Ie,Ee){var Ye,Ot;const Xe=typeof Ie=="object"?(Ie==null?void 0:Ie.join(` -`))??"":(Ie==null?void 0:Ie.toString())??"";if(!xa(le)&&Qu(le)&&le.readonly!==!0){const Ze=M==null?void 0:M(Xe,le);if(Ze!==void 0&&oa(Ze))return{location:Me,value:Ze};const Ve=Re(le);if(Ve===void 0)return;if(Ve.kind===Ae.Custom){ei(le.kind===Ae.Custom);const un=(Ye=Ve.onPaste)==null?void 0:Ye.call(Ve,Xe,le.data);return un===void 0?void 0:{location:Me,value:{...le,data:un}}}else{const un=(Ot=Ve.onPaste)==null?void 0:Ot.call(Ve,Xe,le,{formatted:Ee,formattedString:typeof Ee=="string"?Ee:Ee==null?void 0:Ee.join(` -`),rawValue:Ie});return un===void 0?void 0:(ei(un.kind===le.kind),{location:Me,value:un})}}}const $=Z.columns,V=Z.rows,U=((G=c.current)==null?void 0:G.contains(document.activeElement))===!0||((te=l.current)==null?void 0:te.contains(document.activeElement))===!0;let ne;if(Z.current!==void 0?ne=[Z.current.range.x,Z.current.range.y]:$.length===1?ne=[$.first()??0,0]:V.length===1&&(ne=[K,V.first()??0]),U&&ne!==void 0){let le,Me;const Ie="text/plain",Ee="text/html";if(navigator.clipboard.read!==void 0){const Ze=await navigator.clipboard.read();for(const Ve of Ze){if(Ve.types.includes(Ee)){const fr=await(await Ve.getType(Ee)).text(),Dn=Kx(fr);if(Dn!==void 0){le=Dn;break}}Ve.types.includes(Ie)&&(Me=await(await Ve.getType(Ie)).text())}}else if(navigator.clipboard.readText!==void 0)Me=await navigator.clipboard.readText();else if(S!==void 0&&(S==null?void 0:S.clipboardData)!==null){if(S.clipboardData.types.includes(Ee)){const Ze=S.clipboardData.getData(Ee);le=Kx(Ze)}le===void 0&&S.clipboardData.types.includes(Ie)&&(Me=S.clipboardData.getData(Ie))}else return;const[Xe,Ye]=ne,Ot=[];do{if(ge===void 0){const Ze=Gr(ne),Ve=Me??(le==null?void 0:le.map(fr=>fr.map(Dn=>Dn.rawValue).join(" ")).join(" "))??"",un=F(Ze,ne,Ve,void 0);un!==void 0&&Ot.push(un);break}if(le===void 0){if(Me===void 0)return;le=N6(Me)}if(ge===!1||typeof ge=="function"&&(ge==null?void 0:ge([ne[0]-K,ne[1]],le.map(Ze=>Ze.map(Ve=>{var un;return((un=Ve.rawValue)==null?void 0:un.toString())??""}))))!==!0)return;for(const[Ze,Ve]of le.entries()){if(Ze+Ye>=w)break;for(const[un,fr]of Ve.entries()){const Dn=[un+Xe,Ze+Ye],[Di,os]=Dn;if(Di>=yt.length||os>=cr)continue;const Li=Gr(Dn),ls=F(Li,Dn,fr.rawValue,fr.formatted);ls!==void 0&&Ot.push(ls)}}}while(!1);fi(Ot),(ce=Ir.current)==null||ce.damage(Ot.map(Ze=>({cell:Ze.location})))}},[M,Re,Gr,Z,Pi.paste,yt.length,fi,cr,ge,K,w]);rr("paste",gg,d,!1,!0);const Au=y.useCallback(async(S,F)=>{var G,te;if(!Pi.copy)return;const $=F===!0||((G=c.current)==null?void 0:G.contains(document.activeElement))===!0||((te=l.current)==null?void 0:te.contains(document.activeElement))===!0,V=Z.columns,U=Z.rows,ne=(ce,le)=>{if(!ot)Gx(ce,le,S);else{const Me=le.map(Ie=>({kind:Ae.Text,data:v[Ie].title,displayData:v[Ie].title,allowOverlay:!1}));Gx([Me,...ce],le,S)}};if($&&Bn!==void 0){if(Z.current!==void 0){let ce=Bn(Z.current.range,ur.current.signal);typeof ce!="object"&&(ce=await ce()),ne(ce,gl(Z.current.range.x-K,Z.current.range.x+Z.current.range.width-K))}else if(U!==void 0&&U.length>0){const le=[...U].map(Me=>{const Ie=Bn({x:K,y:Me,width:v.length,height:1},ur.current.signal);return typeof Ie=="object"?Ie[0]:Ie().then(Ee=>Ee[0])});if(le.some(Me=>Me instanceof Promise)){const Me=await Promise.all(le);ne(Me,gl(v.length))}else ne(le,gl(v.length))}else if(V.length>0){const ce=[],le=[];for(const Me of V){let Ie=Bn({x:Me,y:0,width:1,height:w},ur.current.signal);typeof Ie!="object"&&(Ie=await Ie()),ce.push(Ie),le.push(Me-K)}if(ce.length===1)ne(ce[0],le);else{const Me=ce.reduce((Ie,Ee)=>Ie.map((Xe,Ye)=>[...Xe,...Ee[Ye]]));ne(Me,le)}}}},[v,Bn,Z,Pi.copy,K,w,ot]);rr("copy",Au,d,!1,!1);const qR=y.useCallback(async S=>{var $,V;if(!(!Pi.cut||!((($=c.current)==null?void 0:$.contains(document.activeElement))===!0||((V=l.current)==null?void 0:V.contains(document.activeElement))===!0))&&(await Au(S),Z.current!==void 0)){let U={current:{cell:Z.current.cell,range:Z.current.range,rangeStack:[]},rows:Pt.empty(),columns:Pt.empty()};const ne=j==null?void 0:j(U);if(ne===!1||(U=ne===!0?U:ne,U.current===void 0))return;tl(U.current.range)}},[tl,Z,Pi.cut,Au,j]);rr("cut",qR,d,!1,!1);const YR=y.useCallback((S,F)=>{if(W!==void 0){K!==0&&(S=S.map(U=>[U[0]-K,U[1]])),W(S,F);return}if(S.length===0||F===-1)return;const[$,V]=S[F];f.current!==void 0&&f.current[0]===$&&f.current[1]===V||(f.current=[$,V],so($,V,!1,!1))},[W,K,so]),[Pf,Nf]=((u1=jt==null?void 0:jt.current)==null?void 0:u1.cell)??[],If=y.useRef(_n);If.current=_n,y.useLayoutEffect(()=>{var S,F,$,V;!It.current&&Pf!==void 0&&Nf!==void 0&&(Pf!==((F=(S=ro.current)==null?void 0:S.current)==null?void 0:F.cell[0])||Nf!==((V=($=ro.current)==null?void 0:$.current)==null?void 0:V.cell[1]))&&If.current(Pf,Nf),It.current=!1},[Pf,Nf]);const r1=Z.current!==void 0&&(Z.current.cell[0]>=yt.length||Z.current.cell[1]>=cr);y.useLayoutEffect(()=>{r1&&Nr(ld,!1)},[r1,Nr]);const JR=y.useMemo(()=>yn===!0&&(Qe==null?void 0:Qe.tint)===!0?Pt.fromSingleSelection(cr-1):Pt.empty(),[cr,yn,Qe==null?void 0:Qe.tint]),QR=y.useCallback(S=>typeof Tn=="boolean"?Tn:(Tn==null?void 0:Tn(S-K))??!0,[K,Tn]),ZR=y.useMemo(()=>{if(ug===void 0||l.current===null)return null;const{bounds:S,group:F}=ug,$=l.current.getBoundingClientRect();return y.createElement(x6,{bounds:S,group:F,canvasBounds:$,onClose:()=>cg(void 0),onFinish:V=>{cg(void 0),P==null||P(F,V)}})},[P,ug]),eO=Math.min(yt.length,rt+(Ur?1:0));y.useImperativeHandle(e,()=>({appendRow:(S,F)=>Jl(S+K,F),updateCells:S=>{var F;return K!==0&&(S=S.map($=>({cell:[$.cell[0]+K,$.cell[1]]}))),(F=Ir.current)==null?void 0:F.damage(S)},getBounds:(S,F)=>{var $;if(!((l==null?void 0:l.current)===null||(c==null?void 0:c.current)===null)){if(S===void 0&&F===void 0){const V=l.current.getBoundingClientRect(),U=V.width/c.current.clientWidth;return{x:V.x-c.current.scrollLeft*U,y:V.y-c.current.scrollTop*U,width:c.current.scrollWidth*U,height:c.current.scrollHeight*U}}return($=Ir.current)==null?void 0:$.getBounds((S??0)+K,F)}},focus:()=>{var S;return(S=Ir.current)==null?void 0:S.focus()},emit:async S=>{switch(S){case"delete":Eu({bounds:void 0,cancel:()=>{},stopPropagation:()=>{},preventDefault:()=>{},ctrlKey:!1,key:"Delete",keyCode:46,metaKey:!1,shiftKey:!1,altKey:!1,rawEvent:void 0,location:void 0});break;case"fill-right":Eu({bounds:void 0,cancel:()=>{},stopPropagation:()=>{},preventDefault:()=>{},ctrlKey:!0,key:"r",keyCode:82,metaKey:!1,shiftKey:!1,altKey:!1,rawEvent:void 0,location:void 0});break;case"fill-down":Eu({bounds:void 0,cancel:()=>{},stopPropagation:()=>{},preventDefault:()=>{},ctrlKey:!0,key:"d",keyCode:68,metaKey:!1,shiftKey:!1,altKey:!1,rawEvent:void 0,location:void 0});break;case"copy":await Au(void 0,!0);break;case"paste":await gg();break}},scrollTo:_n,remeasureColumns:S=>{for(const F of S)Of(F+K)}}),[Jl,Of,Au,Eu,gg,K,_n]);const[i1,s1]=ss??[],tO=y.useCallback(S=>{const[F,$]=S;if($===-1){xe!=="none"&&(we(Pt.fromSingleSelection(F),void 0,!1),Sr());return}i1===F&&s1===$||(ae({cell:S,range:{x:F,y:$,width:1,height:1}},!0,!1,"keyboard-nav"),_n(F,$))},[xe,Sr,_n,i1,s1,ae,we]),[nO,rO]=y.useState(!1),o1=y.useRef(ZT(S=>{rO(S)},5)),iO=y.useCallback(()=>{o1.current(!0),Z.current===void 0&&Z.columns.length===0&&Z.rows.length===0&&a===void 0&&ae({cell:[K,Cf],range:{x:K,y:Cf,width:1,height:1}},!0,!1,"keyboard-select")},[Cf,Z,a,K,ae]),sO=y.useCallback(()=>{o1.current(!1)},[]),[oO,lO]=y.useMemo(()=>{let S;const F=(J==null?void 0:J.scrollbarWidthOverride)??j0(),$=w+(yn?1:0);if(typeof kr=="number")S=ht+$*kr;else{let U=0;const ne=Math.min($,10);for(let G=0;Gne.width+U,0)+F;return[`${Math.min(1e5,V)}px`,`${Math.min(1e5,S)}px`]},[yt,J==null?void 0:J.scrollbarWidthOverride,kr,w,yn,ht]),aO=y.useMemo(()=>H4(fe),[fe]);return y.createElement(W4.Provider,{value:fe},y.createElement(L6,{style:aO,className:H,inWidth:b??oO,inHeight:m??lO},y.createElement(y6,{fillHandle:Vt,drawFocusRing:Ut,experimental:J,fixedShadowX:st,fixedShadowY:lt,getRowThemeOverride:p,headerIcons:Jn,imageWindowLoader:Vr,initialSize:rs,isDraggable:Wl,onDragLeave:Vl,onRowMoved:ui,overscrollX:eg,overscrollY:kf,preventDiagonalScrolling:eo,rightElement:z,rightElementProps:oe,smoothScrollX:pe,smoothScrollY:ve,className:H,enableGroups:Bt,onCanvasFocused:iO,onCanvasBlur:sO,canvasRef:l,onContextMenu:GR,theme:fe,cellXOffset:Qo,cellYOffset:Cf,accessibilityHeight:In.height,onDragEnd:VR,columns:yt,nonGrowWidth:je,drawHeader:ig,onColumnProposeMove:_,drawCell:sg,disabledRows:JR,freezeColumns:eO,lockColumns:K,firstColAccessible:K===0,getCellContent:Gr,minColumnWidth:ar,maxColumnWidth:Oi,searchInputRef:o,showSearch:bu,onSearchClose:ng,highlightRegions:DR,getCellsForSelection:Bn,getGroupDetails:lg,headerHeight:Ul,isFocused:nO,groupHeaderHeight:Bt?wu:0,freezeTrailingRows:We+(yn&&(Qe==null?void 0:Qe.sticky)===!0?1:0),hasAppendRow:yn,onColumnResize:Ni,onColumnResizeEnd:rg,onColumnResizeStart:Xl,onCellFocused:tO,onColumnMoved:HR,onDragStart:WR,onHeaderMenuClick:BR,onItemHovered:pg,isFilling:(a==null?void 0:a.fillHandle)===!0,onMouseMove:zR,onKeyDown:Eu,onKeyUp:Ue,onMouseDown:LR,onMouseUp:FR,onDragOverCell:er,onDrop:pt,onSearchResultsChanged:YR,onVisibleRegionChanged:jR,clientSize:Pe,rowHeight:kr,searchResults:ye,searchValue:me,onSearchValueChange:ee,rows:cr,scrollRef:c,selection:Z,translateX:In.tx,translateY:In.ty,verticalBorder:QR,gridRef:Ir,getCellRenderer:Re}),ZR,i!==void 0&&y.createElement(y.Suspense,{fallback:null},y.createElement(H6,{...i,validateCell:xu,bloom:O,id:XR,getCellRenderer:Re,className:(J==null?void 0:J.isSubGrid)===!0?"click-outside-ignore":void 0,provideEditor:Ht,imageEditorOverride:h,onFinishEditing:KR,markdownDivCreateNode:g,isOutsideClick:nn}))))},K6=y.forwardRef(U6),Jx=20,X6={getAccessibilityString:t=>{var e;return((e=t.data)==null?void 0:e.toString())??"false"},kind:Ae.Boolean,needsHover:!0,useLabel:!1,needsHoverPosition:!0,measure:()=>50,draw:t=>G6(t,t.cell.data,L0(t.cell),t.cell.maxSize??Jx),onDelete:t=>({...t,data:!1}),onClick:t=>{const{cell:e,posX:n,posY:r,bounds:i,theme:s}=t,{width:o,height:l,x:a,y:u}=i,c=e.maxSize??Jx,f=Math.floor(i.y+l/2),d=nE(c,l,s.cellVerticalPadding),h=tE(e.contentAlign??"center",a,o,s.cellHorizontalPadding,d),p=eE(h,f,d),g=rE(a+n,u+r,p);if(L0(e)&&g)return{...e,data:YE(e.data)}},onPaste:(t,e)=>{let n=Mh;return t.toLowerCase()==="true"?n=!0:t.toLowerCase()==="false"?n=!1:t.toLowerCase()==="indeterminate"&&(n=Zv),n===e.data?void 0:{...e,data:n}}};function G6(t,e,n,r){if(!n&&e===Mh)return;const{ctx:i,hoverAmount:s,theme:o,rect:l,highlighted:a,hoverX:u,hoverY:c,cell:{contentAlign:f}}=t,{x:d,y:h,width:p,height:g}=l,b=.35;let m=n?1-b+b*s:.4;e===Mh&&(m*=s),m!==0&&(i.globalAlpha=m,hw(i,o,e,d,h,p,g,a,u,c,r,f),i.globalAlpha=1)}const q6=ai("div")({name:"BubblesOverlayEditorStyle",class:"gdg-b1ygi5by",propsAsIs:!1}),Y6=t=>{const{bubbles:e}=t;return y.createElement(q6,null,e.map((n,r)=>y.createElement("div",{key:r,className:"boe-bubble"},n)),y.createElement("textarea",{className:"gdg-input",autoFocus:!0}))},J6={getAccessibilityString:t=>iE(t.data),kind:Ae.Bubble,needsHover:!1,useLabel:!1,needsHoverPosition:!1,measure:(t,e,n)=>e.data.reduce((r,i)=>t.measureText(i).width+r+20,0)+2*n.cellHorizontalPadding-4,draw:t=>Z6(t,t.cell.data),provideEditor:()=>t=>{const{value:e}=t;return y.createElement(Y6,{bubbles:e.data})},onPaste:()=>{}},Q6=4;function Z6(t,e){const{rect:n,theme:r,ctx:i,highlighted:s}=t,{x:o,y:l,width:a,height:u}=n,c=20,f=8,d=Q6;let h=o+r.cellHorizontalPadding;const p=[];for(const g of e){if(h>o+a)break;const b=pf(g,i,r.baseFontFull).width;p.push({x:h,width:b}),h+=b+f*2+d}i.beginPath();for(const g of p)Ts(i,g.x,l+(u-c)/2,g.width+f*2,c,r.roundingRadius??c/2);i.fillStyle=s?r.bgBubbleSelected:r.bgBubble,i.fill();for(const[g,b]of p.entries())i.beginPath(),i.fillStyle=r.textBubble,i.fillText(e[g],b.x+f,l+u/2+Js(i,r))}const e9=ai("div")({name:"DrilldownOverlayEditorStyle",class:"gdg-d4zsq0x",propsAsIs:!1}),t9=t=>{const{drilldowns:e}=t;return y.createElement(e9,null,e.map((n,r)=>y.createElement("div",{key:r,className:"doe-bubble"},n.img!==void 0&&y.createElement("img",{src:n.img}),y.createElement("div",null,n.text))))},n9={getAccessibilityString:t=>iE(t.data.map(e=>e.text)),kind:Ae.Drilldown,needsHover:!1,useLabel:!1,needsHoverPosition:!1,measure:(t,e,n)=>e.data.reduce((r,i)=>t.measureText(i.text).width+r+20+(i.img!==void 0?18:0),0)+2*n.cellHorizontalPadding-4,draw:t=>s9(t,t.cell.data),provideEditor:()=>t=>{const{value:e}=t;return y.createElement(t9,{drilldowns:e.data})},onPaste:()=>{}},r9=4,um={};function i9(t,e,n,r){const i=Math.ceil(window.devicePixelRatio),s=5,o=n-s*2,l=4,a=n*i,u=r+s,c=r*3,f=(c+s*2)*i,d=`${t},${e},${i},${n}`;if(um[d]!==void 0)return{el:um[d],height:a,width:f,middleWidth:l*i,sideWidth:u*i,padding:s*i,dpr:i};const h=document.createElement("canvas"),p=h.getContext("2d");return p===null?null:(h.width=f,h.height=a,p.scale(i,i),um[d]=h,p.beginPath(),Ts(p,s,s,c,o,r),p.shadowColor="rgba(24, 25, 34, 0.4)",p.shadowBlur=1,p.fillStyle=t,p.fill(),p.shadowColor="rgba(24, 25, 34, 0.3)",p.shadowOffsetY=1,p.shadowBlur=5,p.fillStyle=t,p.fill(),p.shadowOffsetY=0,p.shadowBlur=0,p.shadowBlur=0,p.beginPath(),Ts(p,s+.5,s+.5,c,o,r),p.strokeStyle=e,p.lineWidth=1,p.stroke(),{el:h,height:a,width:f,sideWidth:u*i,middleWidth:r*i,padding:s*i,dpr:i})}function s9(t,e){const{rect:n,theme:r,ctx:i,imageLoader:s,col:o,row:l}=t,{x:a,width:u}=n,c=r.baseFontFull,f=yE(i,c),d=Math.min(n.height,Math.max(16,Math.ceil(f*r.lineHeight)*2)),h=Math.floor(n.y+(n.height-d)/2),p=d-10,g=8,b=r9;let m=a+r.cellHorizontalPadding;const v=r.roundingRadius??6,w=i9(r.bgCell,r.drilldownBorder,d,v),k=[];for(const x of e){if(m>a+u)break;const T=pf(x.text,i,c).width;let A=0;x.img!==void 0&&s.loadOrGetImage(x.img,o,l)!==void 0&&(A=p-8+4);const M=T+A+g*2;k.push({x:m,width:M}),m+=M+b}if(w!==null){const{el:x,height:C,middleWidth:T,sideWidth:A,width:M,dpr:N,padding:D}=w,O=A/N,L=D/N;for(const _ of k){const re=Math.floor(_.x),ie=Math.floor(_.width),se=ie-(O-L)*2;i.imageSmoothingEnabled=!1,i.drawImage(x,0,0,A,C,re-L,h,O,d),se>0&&i.drawImage(x,A,0,T,C,re+(O-L),h,se,d),i.drawImage(x,M-A,0,A,C,re+ie-(O-L),h,O,d),i.imageSmoothingEnabled=!0}}i.beginPath();for(const[x,C]of k.entries()){const T=e[x];let A=C.x+g;if(T.img!==void 0){const M=s.loadOrGetImage(T.img,o,l);if(M!==void 0){const N=p-8;let D=0,O=0,L=M.width,_=M.height;L>_?(D+=(L-_)/2,L=_):_>L&&(O+=(_-L)/2,_=L),i.beginPath(),Ts(i,A,h+d/2-N/2,N,N,r.roundingRadius??3),i.save(),i.clip(),i.drawImage(M,D,O,L,_,A,h+d/2-N/2,N,N),i.restore(),A+=N+4}}i.beginPath(),i.fillStyle=r.textBubble,i.fillText(T.text,A,h+d/2+Js(i,r))}}const o9={getAccessibilityString:t=>t.data.join(", "),kind:Ae.Image,needsHover:!1,useLabel:!1,needsHoverPosition:!1,draw:t=>l9(t,t.cell.displayData??t.cell.data,t.cell.rounding??t.theme.roundingRadius??4,t.cell.contentAlign),measure:(t,e)=>e.data.length*50,onDelete:t=>({...t,data:[]}),provideEditor:()=>t=>{const{value:e,onFinishedEditing:n,imageEditorOverride:r}=t,i=r??JF;return y.createElement(i,{urls:e.data,canWrite:e.readonly!==!1,onCancel:n,onChange:s=>{n({...e,data:[s]})}})},onPaste:(t,e)=>{t=t.trim();const r=t.split(",").map(i=>{try{return new URL(i),i}catch{return}}).filter(i=>i!==void 0);if(!(r.length===e.data.length&&r.every((i,s)=>i===e.data[s])))return{...e,data:r}}},cm=4;function l9(t,e,n,r){const{rect:i,col:s,row:o,theme:l,ctx:a,imageLoader:u}=t,{x:c,y:f,height:d,width:h}=i,p=d-l.cellVerticalPadding*2,g=[];let b=0;for(let v=0;v0&&(a.beginPath(),Ts(a,m,f+l.cellVerticalPadding,w,p,n),a.save(),a.clip()),a.drawImage(v,m,f+l.cellVerticalPadding,w,p),n>0&&a.restore(),m+=w+cm}}function a9(t,e){let n=t*49632+e*325176;return n^=n<<13,n^=n>>17,n^=n<<5,n/4294967295*2}const u9={getAccessibilityString:()=>"",kind:Ae.Loading,needsHover:!1,useLabel:!1,needsHoverPosition:!1,measure:()=>120,draw:t=>{const{cell:e,col:n,row:r,ctx:i,rect:s,theme:o}=t;if(e.skeletonWidth===void 0||e.skeletonWidth===0)return;let l=e.skeletonWidth;e.skeletonWidthVariability!==void 0&&e.skeletonWidthVariability>0&&(l+=Math.round(a9(n,r)*e.skeletonWidthVariability));const a=o.cellHorizontalPadding,u=e.skeletonHeight??Math.min(18,s.height-2*o.cellVerticalPadding);Ts(i,s.x+a,s.y+(s.height-u)/2,l,u,o.roundingRadius??3),i.fillStyle=Nl(o.textDark,.1),i.fill()},onPaste:()=>{}},c9=()=>t=>t.targetWidth,Qx=ai("div")({name:"MarkdownOverlayEditorStyle",class:"gdg-m1pnx84e",propsAsIs:!1,vars:{"m1pnx84e-0":[c9(),"px"]}}),f9=t=>{const{value:e,onChange:n,forceEditMode:r,createNode:i,targetRect:s,onFinish:o,validatedSelection:l}=t,a=e.data,u=e.readonly===!0,[c,f]=y.useState(a===""||r),d=y.useCallback(()=>{f(p=>!p)},[]),h=a?"gdg-ml-6":"";return c?y.createElement(Qx,{targetWidth:s.width-20},y.createElement($p,{autoFocus:!0,highlight:!1,validatedSelection:l,value:a,onKeyDown:p=>{p.key==="Enter"&&p.stopPropagation()},onChange:n}),y.createElement("div",{className:`gdg-edit-icon gdg-checkmark-hover ${h}`,onClick:()=>o(e)},y.createElement(VF,null))):y.createElement(Qx,{targetWidth:s.width},y.createElement(m4,{contents:a,createNode:i}),!u&&y.createElement(y.Fragment,null,y.createElement("div",{className:"spacer"}),y.createElement("div",{className:`gdg-edit-icon gdg-edit-hover ${h}`,onClick:d},y.createElement(iw,null))),y.createElement("textarea",{className:"gdg-md-edit-textarea gdg-input",autoFocus:!0}))},d9={getAccessibilityString:t=>{var e;return((e=t.data)==null?void 0:e.toString())??""},kind:Ae.Markdown,needsHover:!1,needsHoverPosition:!1,drawPrep:gf,measure:(t,e,n)=>{const r=e.data.split(` -`)[0];return t.measureText(r).width+2*n.cellHorizontalPadding},draw:t=>Fs(t,t.cell.data,t.cell.contentAlign),onDelete:t=>({...t,data:""}),provideEditor:()=>t=>{const{onChange:e,value:n,target:r,onFinishedEditing:i,markdownDivCreateNode:s,forceEditMode:o,validatedSelection:l}=t;return y.createElement(f9,{onFinish:i,targetRect:r,value:n,validatedSelection:l,onChange:a=>e({...n,data:a.target.value}),forceEditMode:o,createNode:s})},onPaste:(t,e)=>t===e.data?void 0:{...e,data:t}},h9={getAccessibilityString:t=>t.row.toString(),kind:yi.Marker,needsHover:!0,needsHoverPosition:!1,drawPrep:p9,measure:()=>44,draw:t=>m9(t,t.cell.row,t.cell.checked,t.cell.markerKind,t.cell.drawHandle,t.cell.checkboxStyle),onClick:t=>{const{bounds:e,cell:n,posX:r,posY:i}=t,{width:s,height:o}=e,l=n.drawHandle?7+(s-7)/2:s/2,a=o/2;if(Math.abs(r-l)<=10&&Math.abs(i-a)<=10)return{...n,checked:!n.checked}},onPaste:()=>{}};function p9(t,e){const{ctx:n,theme:r}=t,i=r.markerFontFull,s=e??{};return(s==null?void 0:s.font)!==i&&(n.font=i,s.font=i),s.deprep=g9,n.textAlign="center",s}function g9(t){const{ctx:e}=t;e.textAlign="start"}function m9(t,e,n,r,i,s){const{ctx:o,rect:l,hoverAmount:a,theme:u}=t,{x:c,y:f,width:d,height:h}=l,p=n?1:r==="checkbox-visible"?.6+.4*a:a;if(r!=="number"&&p>0){o.globalAlpha=p;const g=7*(n?a:1);if(hw(o,u,n,i?c+g:c,f,i?d-g:d,h,!0,void 0,void 0,18,"center",s),i){o.globalAlpha=a,o.beginPath();for(const b of[3,6])for(const m of[-5,-1,3])o.rect(c+b,f+h/2+m,2,2);o.fillStyle=u.textLight,o.fill(),o.beginPath()}o.globalAlpha=1}if(r==="number"||r==="both"&&!n){const g=e.toString(),b=u.markerFontFull,m=c+d/2;r==="both"&&a!==0&&(o.globalAlpha=1-a),o.fillStyle=u.textLight,o.font=b,o.fillText(g,m,f+h/2+Js(o,b)),a!==0&&(o.globalAlpha=1)}}const y9={getAccessibilityString:()=>"",kind:yi.NewRow,needsHover:!0,needsHoverPosition:!1,measure:()=>200,draw:t=>v9(t,t.cell.hint,t.cell.icon),onPaste:()=>{}};function v9(t,e,n){const{ctx:r,rect:i,hoverAmount:s,theme:o,spriteManager:l}=t,{x:a,y:u,width:c,height:f}=i;r.beginPath(),r.globalAlpha=s,r.rect(a+1,u+1,c,f-2),r.fillStyle=o.bgHeaderHovered,r.fill(),r.globalAlpha=1,r.beginPath();const d=e!=="";let h=0;if(n!==void 0){const g=f-8,b=a+8/2,m=u+8/2;l.drawSprite(n,"normal",r,b,m,g,o,d?1:s),h=g}else{h=24;const p=12,g=d?p:s*p,b=d?0:(1-s)*p*.5,m=o.cellHorizontalPadding+4;g>0&&(r.moveTo(a+m+b,u+f/2),r.lineTo(a+m+b+g,u+f/2),r.moveTo(a+m+b+g*.5,u+f/2-g*.5),r.lineTo(a+m+b+g*.5,u+f/2+g*.5),r.lineWidth=2,r.strokeStyle=o.bgIconHeader,r.lineCap="round",r.stroke())}r.fillStyle=o.textMedium,r.fillText(e,h+a+o.cellHorizontalPadding+.5,u+f/2+Js(r,o)),r.beginPath()}const w9=y.lazy(async()=>await SE(()=>import("./number-overlay-editor-CftgwBSh.js"),[])),b9={getAccessibilityString:t=>{var e;return((e=t.data)==null?void 0:e.toString())??""},kind:Ae.Number,needsHover:!1,needsHoverPosition:!1,useLabel:!0,drawPrep:gf,draw:t=>Fs(t,t.cell.displayData,t.cell.contentAlign),measure:(t,e,n)=>t.measureText(e.displayData).width+n.cellHorizontalPadding*2,onDelete:t=>({...t,data:void 0}),provideEditor:()=>t=>{const{isHighlighted:e,onChange:n,value:r,validatedSelection:i}=t;return y.createElement(y.Suspense,{fallback:null},y.createElement(w9,{highlight:e,disabled:r.readonly===!0,value:r.data,fixedDecimals:r.fixedDecimals,allowNegative:r.allowNegative,thousandSeparator:r.thousandSeparator,decimalSeparator:r.decimalSeparator,validatedSelection:i,onChange:s=>n({...r,data:Number.isNaN(s.floatValue??0)?0:s.floatValue})}))},onPaste:(t,e,n)=>{const r=typeof n.rawValue=="number"?n.rawValue:Number.parseFloat(typeof n.rawValue=="string"?n.rawValue:t);if(!(Number.isNaN(r)||e.data===r))return{...e,data:r,displayData:n.formattedString??e.displayData}}},x9={getAccessibilityString:()=>"",measure:()=>108,kind:Ae.Protected,needsHover:!1,needsHoverPosition:!1,draw:k9,onPaste:()=>{}};function k9(t){const{ctx:e,theme:n,rect:r}=t,{x:i,y:s,height:o}=r;e.beginPath();const l=2.5;let a=i+n.cellHorizontalPadding+l;const u=s+o/2,c=Math.cos(Zb(30))*l,f=Math.sin(Zb(30))*l;for(let d=0;d<12;d++)e.moveTo(a,u-l),e.lineTo(a,u+l),e.moveTo(a+c,u-f),e.lineTo(a-c,u+f),e.moveTo(a-c,u-f),e.lineTo(a+c,u+f),a+=8;e.lineWidth=1.1,e.lineCap="square",e.strokeStyle=n.textLight,e.stroke()}const S9={getAccessibilityString:t=>{var e;return((e=t.data)==null?void 0:e.toString())??""},kind:Ae.RowID,needsHover:!1,needsHoverPosition:!1,drawPrep:(t,e)=>gf(t,e,t.theme.textLight),draw:t=>Fs(t,t.cell.data,t.cell.contentAlign),measure:(t,e,n)=>t.measureText(e.data).width+n.cellHorizontalPadding*2,provideEditor:()=>t=>{const{isHighlighted:e,onChange:n,value:r,validatedSelection:i}=t;return Kn.createElement($p,{highlight:e,autoFocus:r.readonly!==!0,disabled:r.readonly!==!1,value:r.data,validatedSelection:i,onChange:s=>n({...r,data:s.target.value})})},onPaste:()=>{}},C9={getAccessibilityString:t=>{var e;return((e=t.data)==null?void 0:e.toString())??""},kind:Ae.Text,needsHover:t=>t.hoverEffect===!0,needsHoverPosition:!1,drawPrep:gf,useLabel:!0,draw:t=>{const{cell:e,hoverAmount:n,hyperWrapping:r,ctx:i,rect:s,theme:o,overrideCursor:l}=t,{displayData:a,contentAlign:u,hoverEffect:c,allowWrapping:f}=e;if(c===!0&&n>0){i.textBaseline="alphabetic";const d=o.cellHorizontalPadding,h=o.cellVerticalPadding,p=pf(a,i,o.baseFontFull,"alphabetic"),g=s.height-h,b=Math.min(g,p.actualBoundingBoxAscent*2.5);i.beginPath(),Ts(i,s.x+d/2,s.y+(s.height-b)/2+1,p.width+d*3,b-1,o.roundingRadius??4),i.globalAlpha=n,i.fillStyle=Nl(o.textDark,.1),i.fill(),i.globalAlpha=1,i.fillStyle=o.textDark,i.textBaseline="middle",l==null||l("text")}Fs(t,a,u,f,r)},measure:(t,e,n)=>{const r=e.displayData.split(` -`,e.allowWrapping===!0?void 0:1);let i=0;for(const s of r)i=Math.max(i,t.measureText(s).width);return i+2*n.cellHorizontalPadding},onDelete:t=>({...t,data:""}),provideEditor:t=>({disablePadding:t.allowWrapping===!0,editor:e=>{const{isHighlighted:n,onChange:r,value:i,validatedSelection:s}=e;return y.createElement($p,{style:t.allowWrapping===!0?{padding:"3px 8.5px"}:void 0,highlight:n,autoFocus:i.readonly!==!0,disabled:i.readonly===!0,altNewline:!0,value:i.data,validatedSelection:s,onChange:o=>r({...i,data:o.target.value})})}}),onPaste:(t,e,n)=>t===e.data?void 0:{...e,data:t,displayData:n.formattedString??e.displayData}},T9=ai("div")({name:"UriOverlayEditorStyle",class:"gdg-u1rrojo",propsAsIs:!1}),E9=t=>{const{uri:e,onChange:n,forceEditMode:r,readonly:i,validatedSelection:s,preview:o}=t,[l,a]=y.useState(!i&&(e===""||r)),u=y.useCallback(()=>{a(!0)},[]);return l?y.createElement($p,{validatedSelection:s,highlight:!0,autoFocus:!0,value:e,onChange:n}):y.createElement(T9,null,y.createElement("a",{className:"gdg-link-area",href:e,target:"_blank",rel:"noopener noreferrer"},o),!i&&y.createElement("div",{className:"gdg-edit-icon",onClick:u},y.createElement(iw,null)),y.createElement("textarea",{className:"gdg-input",autoFocus:!0}))};function Zx(t,e,n,r){let i=n.cellHorizontalPadding;const s=e.height/2-t.actualBoundingBoxAscent/2,o=t.width,l=t.actualBoundingBoxAscent;return r==="right"?i=e.width-o-n.cellHorizontalPadding:r==="center"&&(i=e.width/2-o/2),{x:i,y:s,width:o,height:l}}const A9={getAccessibilityString:t=>{var e;return((e=t.data)==null?void 0:e.toString())??""},kind:Ae.Uri,needsHover:t=>t.hoverEffect===!0,needsHoverPosition:!0,useLabel:!0,drawPrep:gf,draw:t=>{const{cell:e,theme:n,overrideCursor:r,hoverX:i,hoverY:s,rect:o,ctx:l}=t,a=e.displayData??e.data,u=e.hoverEffect===!0;if(r!==void 0&&u&&i!==void 0&&s!==void 0){const c=pf(a,l,n.baseFontFull),f=Zx(c,o,n,e.contentAlign),{x:d,y:h,width:p,height:g}=f;if(i>=d-4&&i<=d-4+p+8&&s>=h-4&&s<=h-4+g+8){const b=Js(l,n.baseFontFull);r("pointer");const m=5,v=h-b;l.beginPath(),l.moveTo(o.x+d,Math.floor(o.y+v+g+m)+.5),l.lineTo(o.x+d+p,Math.floor(o.y+v+g+m)+.5),l.strokeStyle=n.linkColor,l.stroke(),l.save(),l.fillStyle=t.cellFillColor,Fs({...t,rect:{...o,x:o.x-1}},a,e.contentAlign),Fs({...t,rect:{...o,x:o.x-2}},a,e.contentAlign),Fs({...t,rect:{...o,x:o.x+1}},a,e.contentAlign),Fs({...t,rect:{...o,x:o.x+2}},a,e.contentAlign),l.restore()}}l.fillStyle=u?n.linkColor:n.textDark,Fs(t,a,e.contentAlign)},onClick:t=>{const{cell:e,bounds:n,posX:r,posY:i,theme:s}=t,o=e.displayData??e.data;if(e.hoverEffect!==!0||e.onClickUri===void 0)return;const l=_4(o,s.baseFontFull);if(l===void 0)return;const a=Zx(l,n,s,e.contentAlign);zp({x:a.x-4,y:a.y-4,width:a.width+8,height:a.height+8},r,i)&&e.onClickUri(t)},measure:(t,e,n)=>t.measureText(e.displayData??e.data).width+n.cellHorizontalPadding*2,onDelete:t=>({...t,data:""}),provideEditor:t=>e=>{const{onChange:n,value:r,forceEditMode:i,validatedSelection:s}=e;return y.createElement(E9,{forceEditMode:r.readonly!==!0&&(i||t.hoverEffect===!0&&t.onClickUri!==void 0),uri:r.data,preview:r.displayData??r.data,validatedSelection:s,readonly:r.readonly===!0,onChange:o=>n({...r,data:o.target.value})})},onPaste:(t,e,n)=>t===e.data?void 0:{...e,data:t,displayData:n.formattedString??e.displayData}},M9=[h9,y9,X6,J6,n9,o9,u9,d9,b9,x9,S9,C9,A9];var R9=QT,O9=zl,P9="Expected a function";function N9(t,e,n){var r=!0,i=!0;if(typeof t!="function")throw new TypeError(P9);return O9(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),R9(t,e,{leading:r,maxWait:e,trailing:i})}var I9=N9;const _9=es(I9),fm=[];class D9 extends wE{constructor(){super(...arguments);kt(this,"imageLoaded",()=>{});kt(this,"loadedLocations",[]);kt(this,"cache",{});kt(this,"sendLoaded",_9(()=>{this.imageLoaded(new yc(this.loadedLocations)),this.loadedLocations=[]},20));kt(this,"clearOutOfWindow",()=>{const n=Object.keys(this.cache);for(const r of n){const i=this.cache[r];let s=!1;for(let o=0;o{a||(a=!0,fm.length<12?fm.unshift(l):o||(l.src=""))}},c=new Promise(f=>l.addEventListener("load",()=>f(null)));requestAnimationFrame(async()=>{try{l.src=n,await c,await l.decode();const f=this.cache[s];if(f!==void 0&&!a){f.img=l;for(const d of f.cells)this.loadedLocations.push(cw(d));o=!0,this.sendLoaded()}}catch{u.cancel()}}),this.cache[s]=u}loadOrGetImage(n,r,i){const s=n,o=this.cache[s];if(o!==void 0){const l=Vi(r,i);return o.cells.includes(l)||o.cells.push(l),o.img}else this.loadImage(n,r,i,s)}}const ek="\uFEFF",L9=/^\s*(?:\|?\s*:?-{2,}:?\s*(?:\|\s*:?-{2,}:?\s*)+\|?|\|\s*:?-{2,}:?\s*\||\+[-=]+(?:\+[-=]+)*\+|[-=]+(?:\+[-=]+)+)\s*$/m,ia=/^\s*(?:\|?\s*:?-{2,}:?\s*(?:\|\s*:?-{2,}:?\s*)+\|?|\|\s*:?-{2,}:?\s*\|)\s*$/,JE=/^\s*\+[-=]+(?:\+[-=]+)*\+\s*$/,$9=/^\s*[-=]+(?:\+[-=]+)+\s*$/,tk=/^\s*(?:\(\d+\s+rows?\)|\d+\s+rows?\s+in\s+set(?:\s*\([^)]*\))?)\s*$/i,ec=/^\s*(?:`{3,}|~{3,})/,Kd=/^\s*#{1,6}\s+(.+?)\s*#*\s*$/,F9=/^\s*(?:\*\*([^*]+)\*\*|__([^_]+)__)\s*:?\s*$/,z9=/^\s*(?:={3,}|-{3,})\s*$/;function Xd(t){for(let e=0;e=0&&t[n]==="\\";n--)e++;return e%2===0}function nk(t){let e=t.trim();e.startsWith("|")&&(e=e.slice(1)),B9(e)&&(e=e.slice(0,-1));const n=[];let r="";for(let i=0;ir.trim())}function dl(t){return JE.test(t)||$9.test(t)}const rk=32;function dm(t){const e=t.replace(/(\*\*|__|`)*/g,"").replace(/\s+/g," ").replace(/\s*:\s*$/,"").trim();return e?e.length>rk?`${e.slice(0,rk-1).trimEnd()}…`:e:null}function hm(t,e,n){if(e)return e;const r=n.slice(0,3).map(i=>i.trim()).filter(Boolean).join(", ");return r?`Table ${t+1} (${r})`:`Table ${t+1}`}function j9(t,e){const n=Kd.exec(t);if(n){const i=dm(n[1]);if(i)return{title:i,consumedNextLine:!1}}const r=F9.exec(t);if(r){const i=dm(r[1]??r[2]??"");if(i)return{title:i,consumedNextLine:!1}}if(e!==void 0&&z9.test(e)&&t.trim().length>0&&!Xd(t)&&!dl(t)&&!ec.test(t)){const i=dm(t);if(i)return{title:i,consumedNextLine:!0}}return null}function QE(t){if(!t)return[];const e=t.startsWith(ek)?t.slice(ek.length):t,n=e.slice(0,64*1024);if(!n.includes("|")||!L9.test(n))return[];const r=e.split(/\r?\n/),i=[];let s=null,o=0;for(;o=2&&d.length>=1){const h=ad(d[0],!0);if(h.length>0&&!h.every(p=>p==="")){const p=d.slice(1).map(v=>ad(v,!0)),g=_a(h,p,","),b=i.length,m=s;i.push({index:b,title:m,label:hm(b,m,h),headers:h,cleanedCsv:g,rows:p.length,cols:h.length,kind:"box"}),s=null,o=c;continue}}o++;continue}if(Xd(l)&&!dl(l)&&!ia.test(l)&&!Kd.test(l)&&o+10&&!c.every(f=>f==="")){const f=[];let d=o+2;for(;d0&&!p.every(g=>g==="")){const g=c.slice(1).map(w=>ad(w,h)),b=_a(p,g,","),m=i.length,v=s;i.push({index:m,title:v,label:hm(m,v,p),headers:p,cleanedCsv:b,rows:g.length,cols:p.length,kind:"box"}),s=null,o=f;continue}}const u=j9(l,r[o+1]);if(u){s=u.title,o+=u.consumedNextLine?2:1;continue}o++}return i}function Bp(t,e=0){const n=QE(t);if(n.length===0)return null;const r=Math.min(Math.max(0,Math.trunc(e)||0),n.length-1),i=n[r];return{cleanedCsv:i.cleanedCsv,rows:i.rows,cols:i.cols,kind:i.kind}}const pm="\uFEFF";function H9(t){const e={",":0,";":0," ":0};let n=",",r=-1,i=0,s=!1;for(let o=0;or&&(n=o,r=e[o]);return n}function W9(t,e,n){if(t[e]==='"'){let i="",s=e+1;for(;;){if(s>=t.length)return[i,s];const o=t[s];if(o==='"')if(t[s+1]==='"')i+='"',s+=2;else{for(s++;s=o.length)break;if(o[x]===a){h=x+1,p=!0;continue}h=o[x]==="\r"&&o[x+1]===` -`?x+2:x+1,u.push(f),c.push({start:d+l,end:x+l}),f=[]}f.length>0?(u.push(f),c.push({start:d+l,end:o.length+l})):u.length===0&&f.length===0&&o.length>0&&(u.push([""]),c.push({start:0+l,end:o.length+l}));const g=u.length>0?u[0]:[],b=g.length,m=u.slice(1),v=m.map(k=>k.length),w=m.map(k=>k.length===b?k:k.length>b?k.slice(0,b):[...k,...Array(b-k.length).fill("")]);return{headers:g,rows:w,delimiter:a,rowWidths:v,rowSpans:c.slice(1)}}function qa(t,e=","){const n=r=>r.includes('"')?`"${r.replaceAll('"','""')}"`:r.includes(e)||r.includes(` -`)||r.includes("\r")?`"${r}"`:r;return t.map(n).join(e)}function _a(t,e,n=","){return[t,...e].map(r=>qa(r,n)).join(` -`)}function mw(t,e){return mf(t,e).headers}function V9(t){const e=/^-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/,n=Array.from({length:t.headers.length},()=>!0),r=Array.from({length:t.headers.length},()=>!1);for(const i of t.rows)for(let s=0;si&&r[s])}function ZE(t,e){let n="",r=0;for(const{start:i,end:s,replacement:o}of e)n+=t.slice(r,i)+o,r=s;return n+t.slice(r)}function U9(t,e){return t[e]==="\r"?t[e+1]===` -`?2:1:t[e]===` -`?1:0}function ik(t,e){return t[e-2]==="\r"&&t[e-1]===` -`?2:t[e-1]==="\r"||t[e-1]===` -`?1:0}const sk="\uFEFF";function eA(t,e){const n=t.startsWith(sk)?sk.length:0,r=e.rowSpans[0];if(r!==void 0)return{start:n,end:r.start-ik(t,r.start)};const i=t.slice(n);return{start:n,end:n+i.length-ik(t,t.length)}}function gm(t,e,n){const r=[...new Set(n)].flatMap(i=>{const s=e.rowSpans[i];return s===void 0?[]:[s]}).sort((i,s)=>i.start-s.start).map(i=>({start:i.start,end:i.end+U9(t,i.end),replacement:""}));return r.length===0?t:ZE(t,r)}function ok(t,e,n){const r=new Set([...n].filter(o=>o>=0&&ou!r.has(c));s.push({start:o.start,end:o.end,replacement:qa(a,e.delimiter)})}return ZE(t,s)}function K9(t,e,n,r){if(!t||n<0||n>=e.headers.length)return t;const i=eA(t,e),s=mw(t.slice(i.start,i.end),e.delimiter);if(n>=s.length||s[n]===r)return t;const o=s.map((a,u)=>u===n?r:a),l=qa(o,e.delimiter);return t.slice(0,i.start)+l+t.slice(i.end)}const ey=50;function sl(t=""){return{past:[],present:t,future:[]}}function lk(t,e,n=ey){if(e===t.present)return t;if(t.present===""&&t.past.length===0&&t.future.length===0)return{past:[],present:e,future:[]};const r=[...t.past,t.present];return{past:r.length>n?r.slice(r.length-n):r,present:e,future:[]}}function X9(t){if(t.past.length===0)return t;const e=t.past[t.past.length-1];return{past:t.past.slice(0,t.past.length-1),present:e,future:[t.present,...t.future]}}function G9(t){if(t.future.length===0)return t;const[e,...n]=t.future,r=[...t.past,t.present];return{past:r.length>ey?r.slice(r.length-ey):r,present:e,future:n}}function q9(t){if(t.altKey||!t.metaKey&&!t.ctrlKey)return null;const e=t.key.toLowerCase();return e==="z"?t.shiftKey?"redo":"undo":e==="y"&&!t.shiftKey?"redo":null}const ak=/^[+-]?\d{16,}$/;function Y9(t,e){const n=Array.from({length:t.length},(i,s)=>s);if(e==="")return n;const r=e.toLowerCase();return n.filter(i=>{const s=t[i];for(let o=0;o{var c,f;const a=((c=e[o])==null?void 0:c[n])??"",u=((f=e[l])==null?void 0:f[n])??"";if(i){const d=a===""?NaN:Number(a),h=u===""?NaN:Number(u),p=Number.isNaN(d),g=Number.isNaN(h);if(p||g)return p&&g?0:p?1:-1;if(ak.test(a)&&ak.test(u)){const b=BigInt(a),m=BigInt(u);return s*(bm?1:0)}return s*(d-h)}return s*a.localeCompare(u)})}function Q9(t,e,n){if(n.length===0||t.headers.length===0)return"";const r=t.delimiter||",",i=qa(n.map(o=>t.headers[o]??""),r),s=e.filter(o=>o>=0&&oqa(n.map(l=>{var a;return((a=t.rows[o])==null?void 0:a[l])??""}),r));return[i,...s].join(` -`)}const Z9=` - -`;function ud(t,e){return Math.max(0,Math.min(t,e))}function uk(t,e,n,r){const i=t.headers.length,s=[];for(const a of n.ranges){const u=ud(a.x,r+i),c=ud(a.x+a.width,r+i);if(c<=r)continue;const f=Math.max(0,u-r),d=c-r;if(d<=f)continue;const h=ud(a.y,e.length),p=ud(a.y+a.height,e.length);if(p<=h)continue;const g=t.headers.slice(f,d),b=[];for(let m=h;mw[f+x]??""))}b.length!==0&&s.push(_a(g,b,t.delimiter))}if(s.length>0)return s.join(Z9);const o=[...n.rows].filter(a=>a>=0&&ae[a]).filter(a=>a!==void 0);if(o.length>0)return _a(t.headers,o.map(a=>t.rows[a]??[]),t.delimiter);const l=[...n.columns].filter(a=>a>=r&&a0){const a=l.map(c=>t.headers[c-r]),u=e.map(c=>{const f=t.rows[c]??[];return l.map(d=>f[d-r]??"")});return _a(a,u,t.delimiter)}return null}const ol=1e5,eV=/^[-+]?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?$/;function tV(t,e,n,r){var p;const i=t.headers.length,s=e.length;if(i===0||s===0)return null;const o=new Set;for(const g of n.ranges){if(o.size>=ol)break;const b=Math.max(0,g.x-r),m=Math.min(i,g.x+g.width-r);if(m<=b)continue;const v=Math.max(0,g.y),w=Math.min(s,g.y+g.height);if(!(w<=v))for(let k=v;k=ol);k++){const x=k*i;for(let C=b;C=ol));C++);}}for(const g of n.rows){if(o.size>=ol)break;if(g<0||g>=s)continue;const b=g*i;for(let m=0;m=ol));m++);}for(const g of n.columns){if(o.size>=ol)break;const b=g-r;if(!(b<0||b>=i))for(let m=0;m=ol));m++);}const l=o.size;if(l===0||l<2&&n.rows.length===0&&n.columns.length===0)return null;let a=0,u=0,c=0,f=null,d=null;const h=new Set;for(const g of o){const b=Math.floor(g/i),m=g%i,v=e[b],k=((v!==void 0?(p=t.rows[v])==null?void 0:p[m]:void 0)??"").trim();if(k===""){a+=1;continue}if(h.add(k),eV.test(k)){const x=Number(k);Number.isFinite(x)&&(u+=1,c+=x,(f===null||xd)&&(d=x))}}return{cellCount:l,distinctCount:h.size,emptyCount:a,numericCount:u,sum:u>0?c:null,avg:u>0?c/u:null,min:u>0?f:null,max:u>0?d:null}}const ck=24,mm=26,fk=110,ym=40,nV=12,tr=1,dk='ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace',hk='ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif',rV=[{mode:"auto",label:"Auto"},{mode:"string",label:"String"},{mode:"number",label:"Number"},{mode:"boolean",label:"Boolean"}];function pk(t){return t==="string"?"STR":t==="number"?"NUM":t==="boolean"?"BOOL":null}function gk(t){if(!(t instanceof HTMLElement))return!1;const e=t.tagName;return e==="INPUT"||e==="TEXTAREA"||t.isContentEditable}const ll="inline-flex cursor-pointer items-center gap-1 rounded-md border border-border bg-background px-1.5 py-0.5 text-[11px] font-medium text-foreground hover:bg-muted outline-none focus-visible:ring-3 focus-visible:ring-ring/50",Gd=new Intl.NumberFormat("en-US",{maximumFractionDigits:4});function cd(t){return Gd.format(Object.is(t,-0)?0:t)}function iV(t){const e=[`Cells: ${Gd.format(t.cellCount)}`,`Distinct: ${Gd.format(t.distinctCount)}`];return t.emptyCount>0&&e.push(`Empty: ${Gd.format(t.emptyCount)}`),t.numericCount>0&&t.sum!==null&&t.avg!==null&&t.min!==null&&t.max!==null&&e.push(`Sum: ${cd(t.sum)}`,`Avg: ${cd(t.avg)}`,`Min: ${cd(t.min)}`,`Max: ${cd(t.max)}`),e.join(" · ")}function sV(t){return t?{accentColor:"hsl(0 0% 98%)",accentFg:"hsl(240 10% 3.9%)",accentLight:"hsla(240, 4.9%, 70%, 0.18)",textDark:"hsl(0 0% 98%)",textMedium:"hsl(240 5% 64.9%)",textLight:"hsla(240, 5%, 64.9%, 0.4)",textBubble:"hsl(0 0% 98%)",textHeader:"hsl(240 5% 64.9%)",textHeaderSelected:"hsl(0 0% 98%)",bgCell:"hsl(240 6% 7%)",bgCellMedium:"hsl(240 6% 7%)",bgHeader:"hsl(240 6% 7%)",bgHeaderHasFocus:"hsl(240 3.7% 15.9%)",bgHeaderHovered:"hsl(240 3.7% 15.9%)",bgBubble:"hsl(240 3.7% 15.9%)",bgBubbleSelected:"hsl(240 6% 7%)",bgSearchResult:"hsl(240 3.7% 15.9%)",borderColor:"hsl(240 3.7% 15.9%)",horizontalBorderColor:"hsla(240, 3.7%, 15.9%, 0.6)",headerBottomBorderColor:"hsl(240 3.7% 15.9%)",linkColor:"hsl(0 0% 98%)",cellHorizontalPadding:8,cellVerticalPadding:3,headerFontStyle:"600 11px",baseFontStyle:"12px",editorFontSize:"12px",fontFamily:hk,lineHeight:1}:{accentColor:"hsl(240 10% 3.9%)",accentFg:"hsl(0 0% 100%)",accentLight:"hsla(240, 4.8%, 45%, 0.14)",textDark:"hsl(240 10% 3.9%)",textMedium:"hsl(240 3.8% 46.1%)",textLight:"hsla(240, 3.8%, 46.1%, 0.4)",textBubble:"hsl(240 10% 3.9%)",textHeader:"hsl(240 3.8% 46.1%)",textHeaderSelected:"hsl(240 10% 3.9%)",bgCell:"hsl(0 0% 100%)",bgCellMedium:"hsl(0 0% 100%)",bgHeader:"hsl(0 0% 100%)",bgHeaderHasFocus:"hsl(240 4.8% 95.9%)",bgHeaderHovered:"hsl(240 4.8% 95.9%)",bgBubble:"hsl(240 4.8% 95.9%)",bgBubbleSelected:"hsl(0 0% 100%)",bgSearchResult:"hsl(48 96% 89%)",borderColor:"hsl(240 5.9% 90%)",horizontalBorderColor:"hsla(240, 5.9%, 90%, 0.6)",headerBottomBorderColor:"hsl(240 5.9% 90%)",linkColor:"hsl(240 10% 3.9%)",cellHorizontalPadding:8,cellVerticalPadding:3,headerFontStyle:"600 11px",baseFontStyle:"12px",editorFontSize:"12px",fontFamily:hk,lineHeight:1}}function oV(t){return t?"hsla(45, 96%, 65%, 0.3)":"hsl(48 96% 89%)"}function tA({text:t,delimiter:e,testId:n="csv-table",dark:r=!1,onCellCommit:i,onUndo:s,onRedo:o,onCopySelection:l,columnTypes:a,onChangeColumnTypes:u,onProjectedCsvChange:c}){const f=y.useRef(null),d=y.useRef(null),h=y.useRef(null),p=y.useRef(null),[g,b]=y.useState(""),[m,v]=y.useState(""),[w,k]=y.useState(null),x=y.useRef(w);x.current=w;const C=y.useRef(null),[T,A]=y.useState(null),[M,N]=y.useState(""),D=y.useRef(null),[O,L]=y.useState(()=>new Set),[_,re]=y.useState(!1),[ie,se]=y.useState(!1),[H,X]=y.useState(void 0),[R,I]=y.useState(()=>new Set),P=y.useRef(R),[B,q]=y.useState(0),[W,ye]=y.useState({}),ee=i!==void 0,me=a??W,Le=y.useCallback(z=>{ye(z),u==null||u(z)},[u]),Ue=y.useMemo(()=>sV(r),[r]),ze=oV(r),Mt=r?"hsl(240 3.7% 15.9%)":"hsl(240 4.8% 95.9%)",tt=y.useRef();tt.current===void 0&&(tt.current=new D9);const Be=y.useMemo(()=>{var z;return e===void 0?((z=Bp(t))==null?void 0:z.cleanedCsv)??t:t},[t,e]),ue=y.useMemo(()=>mf(Be,e),[Be,e]),Nt=y.useMemo(()=>V9(ue),[ue]),be=ue.headers.length,xe=y.useRef(ue.headers);if(xe.current!==ue.headers){const z=xe.current,oe=ue.headers;xe.current=oe;const Q=z.length===oe.length,pe=Q?oe.reduce((ve,gt,Fe)=>gt===z[Fe]?ve:ve+1,0):1/0;(!Q||pe>1||pe===1&&oe.length<=1)&&O.size>0&&L(new Set)}const Y=y.useMemo(()=>{const z=Array.from({length:be},(Q,pe)=>pe);if(O.size===0)return z;const oe=z.filter(Q=>!O.has(Q));return oe.length>0?oe:z},[be,O]),Se=y.useRef(Y);Se.current=Y;const Ne=y.useMemo(()=>Y.length===ue.headers.length?ue:{...ue,headers:Y.map(z=>ue.headers[z]??""),rows:ue.rows.map(z=>Y.map(oe=>z[oe]??""))},[ue,Y]),Ce=y.useRef({text:Be,table:ue,visibleTable:Ne});Ce.current={text:Be,table:ue,visibleTable:Ne};const xt=y.useRef(H);xt.current=H,y.useEffect(()=>{const z=window.setTimeout(()=>v(g),150);return()=>window.clearTimeout(z)},[g]);const $e=y.useMemo(()=>{const z=Y9(ue.rows,m);return w?J9(z,ue.rows,w.col,w.dir,Nt[w.col]??!1):z},[ue,m,w,Nt]),nt=y.useRef($e);nt.current=$e,y.useEffect(()=>{const z=d.current;if(!z||typeof ResizeObserver>"u")return;const oe=new ResizeObserver(()=>q(z.clientWidth));return oe.observe(z),q(z.clientWidth),()=>oe.disconnect()},[]);const ge=Math.max(fk,Math.floor((B-ym)/Math.max(1,Y.length)));y.useEffect(()=>{if(!_)return;const z=Q=>{Q.key==="Escape"&&(Q.stopPropagation(),re(!1))},oe=Q=>{const pe=h.current;pe===null||!(Q.target instanceof Node)||pe.contains(Q.target)||re(!1)};return document.addEventListener("keydown",z),document.addEventListener("click",oe),()=>{document.removeEventListener("keydown",z),document.removeEventListener("click",oe)}},[_]);const ot=y.useCallback(z=>{L(oe=>{const Q=new Set(oe);if(Q.has(z))Q.delete(z);else{if(be-(Q.size+1)<1)return oe;Q.add(z)}return Q}),X(oe=>oe&&oe.columns.length>0?{...oe,columns:Pt.empty()}:oe)},[be]),rt=y.useCallback(()=>{L(new Set),X(z=>z&&z.columns.length>0?{...z,columns:Pt.empty()}:z)},[]),Ke=Y.length!ie||!an?null:Q9(ue,$e,Y),[ie,an,ue,$e,Y]),it=y.useRef(c);it.current=c,y.useEffect(()=>{var z;(z=it.current)==null||z.call(it,mt)},[mt]),y.useEffect(()=>()=>{var z;(z=it.current)==null||z.call(it,null)},[]),y.useEffect(()=>{I(z=>{let oe=!1;const Q=new Set;for(const pe of z)pe{X(z=>{if(!z||z.rows.length===0)return z;const oe=[];for(const pe of P.current){const ve=$e.indexOf(pe);ve!==-1&&oe.push(ve)}oe.sort((pe,ve)=>pe-ve);const Q=oe.reduce((pe,ve)=>pe.add(ve),Pt.empty());return Q.equals(z.rows)?z:{...z,rows:Q}})},[$e]),y.useEffect(()=>{k(z=>z!==null&&z.col>=be?null:z),A(z=>z!==null&&z.col>=be?null:z)},[be]);const dt=m!=="",Yt=ue.rows.length,mn=mm+Math.min($e.length,nV)*ck,qn=()=>{b(""),v("")},Jt=y.useCallback((z,oe)=>{var ve;if(z0||Fe.height>0)?{x:Math.max(0,ct.x-Fe.left),y:Math.max(0,ct.y-Fe.top),width:ct.width,height:ct.height}:ct??{x:ym+Q*ge,y:0,width:ge,height:mm};N(gt),A({col:pe,bounds:ft});return}C.current=x.current,A(null),k(gt=>!gt||gt.col!==pe?{col:pe,dir:"asc"}:gt.dir==="asc"?{col:pe,dir:"desc"}:null)}},[ee,ge]),jt=y.useCallback(()=>{if(!T)return;const{col:z}=T;if(A(null),!i)return;const{text:oe,table:Q}=Ce.current,pe=Q.headers[z]??"",ve=K9(oe,Q,z,M);if(ve!==oe){if(pe!==""&&pe!==M&&me[pe]!==void 0){const gt={...me},Fe=gt[pe];delete gt[pe],M!==""&&Fe!==void 0&&(gt[M]=Fe),Le(gt)}i(ve)}},[T,M,i,me,Le]),Hn=y.useCallback(()=>{A(null)},[]);y.useEffect(()=>{if(!T)return;const z=D.current;z&&(z.focus(),z.select())},[T]);const bn=y.useCallback((z,oe)=>{const Q=nt.current,pe=Q[oe];if(pe===void 0)return;const ve=P.current,gt=p.current;let Fe;if(z.shiftKey&>!==null&>!==pe){const ft=Q.indexOf(gt),Kt=Q.indexOf(pe),nn=ft===-1?Kt:ft,[zn,rn]=nn<=Kt?[nn,Kt]:[Kt,nn];Fe=z.metaKey||z.ctrlKey?new Set(ve):new Set;for(let xn=zn;xn<=rn;xn++){const xr=Q[xn];xr!==void 0&&Fe.add(xr)}}else z.metaKey||z.ctrlKey?(Fe=new Set(ve),Fe.has(pe)?Fe.delete(pe):Fe.add(pe)):Fe=new Set([pe]);p.current=pe,P.current=Fe,I(Fe);const ct=[...Fe].map(ft=>Q.indexOf(ft)).filter(ft=>ft!==-1).sort((ft,Kt)=>ft-Kt);X(ft=>({current:ft==null?void 0:ft.current,columns:(ft==null?void 0:ft.columns)??Pt.empty(),rows:ct.reduce((Kt,nn)=>Kt.add(nn),Pt.empty())}))},[]),Yn=y.useCallback(()=>{p.current=null,P.current=new Set,I(new Set),X(void 0)},[]),Wr=y.useCallback(z=>{const oe=new Set;for(const Q of z.rows){const pe=nt.current[Q];pe!==void 0&&oe.add(pe)}P.current=oe,I(oe),X(z)},[]),Ht=y.useCallback(()=>{Yn()},[Yn]),Qe=y.useMemo(()=>$e.filter(z=>R.has(z)),[$e,R]),We=y.useMemo(()=>[...(H==null?void 0:H.columns)??[]].filter(z=>z>=tr).map(z=>Y[z-tr]).filter(z=>z!==void 0),[H,Y]),Lt=We.length,Qt=y.useMemo(()=>We.map(z=>ue.headers[z]).filter(z=>z!==void 0),[We,ue.headers]),Zt=y.useMemo(()=>{if(Qt.length===0)return null;const z=me[Qt[0]]??"auto";for(let oe=1;oe{if(!ee||Qt.length===0)return;const oe={...me};for(const Q of Qt)z==="auto"?delete oe[Q]:oe[Q]=z;Le(oe)},[ee,Qt,me,Le]),er=y.useMemo(()=>ee?ue.headers.filter(z=>pk(me[z])!==null).length:0,[ee,ue.headers,me]),pt=y.useMemo(()=>({ranges:H!=null&&H.current?[H.current.range,...H.current.rangeStack]:[],columns:H?[...H.columns]:[],rows:R.size>0?$e.reduce((z,oe,Q)=>(R.has(oe)&&z.push(Q),z),[]):H?[...H.rows]:[]}),[H,R,$e]),Wt=tr,Rt=y.useMemo(()=>tV(Ne,$e,pt,Wt),[Ne,$e,pt,Wt]),Ft=Qe.length>0||Lt>0||Rt!==null,tn=y.useRef(l);tn.current=l;const Vt=()=>{var Q,pe;const z=xt.current,oe=uk(Ce.current.visibleTable,nt.current,{ranges:z!=null&&z.current?[z.current.range,...z.current.rangeStack]:[],columns:z?[...z.columns]:[],rows:z?[...z.rows]:[]},tr);oe!==null&&((Q=tn.current)==null||Q.call(tn),(pe=navigator.clipboard)==null||pe.writeText(oe).catch(()=>{}))};y.useEffect(()=>{const z=oe=>{var Fe,ct;const Q=f.current;if(!Q||!Q.contains(document.activeElement))return;const pe=document.activeElement;if(pe&&(pe.tagName==="INPUT"||pe.tagName==="TEXTAREA"||pe.isContentEditable))return;const ve=xt.current,gt=uk(Ce.current.visibleTable,nt.current,{ranges:ve!=null&&ve.current?[ve.current.range,...ve.current.rangeStack]:[],columns:ve?[...ve.columns]:[],rows:ve?[...ve.rows]:[]},tr);gt!==null&&(oe.preventDefault(),oe.stopImmediatePropagation(),(Fe=oe.clipboardData)==null||Fe.setData("text/plain",gt),(ct=tn.current)==null||ct.call(tn))};return window.addEventListener("copy",z,{capture:!0}),()=>window.removeEventListener("copy",z,{capture:!0})},[]),y.useEffect(()=>{if(!s&&!o)return;const z=oe=>{const Q=f.current;if(!Q)return;const pe=oe.target instanceof Node&&Q.contains(oe.target),ve=document.activeElement instanceof Node&&Q.contains(document.activeElement);if(!pe&&!ve||gk(oe.target)||gk(document.activeElement))return;const gt=q9(oe);gt==="undo"&&s?(oe.preventDefault(),s()):gt==="redo"&&o&&(oe.preventDefault(),o())};return window.addEventListener("keydown",z),()=>window.removeEventListener("keydown",z)},[s,o]);const Ut=y.useCallback(z=>{var Q;const oe=f.current!==null&&document.activeElement instanceof Node&&f.current.contains(document.activeElement);Yn(),i==null||i(z),oe&&((Q=d.current)==null||Q.focus({preventScroll:!0}))},[Yn,i]),J=be>0&&We.length>=be,st=()=>{!ee||Qe.length===0||Ut(gm(Ce.current.text,Ce.current.table,Qe))},lt=()=>{!ee||J||We.length===0||Ut(ok(Ce.current.text,Ce.current.table,We))},Jn=y.useCallback(z=>{if(!i)return!1;const{text:Q,table:pe}=Ce.current,ve=nt.current;if(z.rows.length>0){const ct=[...z.rows].map(ft=>ve[ft]).filter(ft=>ft!==void 0);if(ct.length>0)return Ut(gm(Q,pe,ct)),!1}if(z.columns.length>0){const ct=[...z.columns].filter(ft=>ft>=tr).map(ft=>Se.current[ft-tr]).filter(ft=>ft!==void 0&&ft>=0&&ft0&&ct.length0&&Ut(gm(Q,pe,Fe)),!1},[Ut,i]),Vr=y.useCallback(z=>{const oe=i;if(!oe)return!1;const{text:Q,table:pe}=Ce.current,ve=nt.current,gt=[...z].sort((ft,Kt)=>ft.location[1]-Kt.location[1]);let Fe=Q,ct=0;for(const{location:ft,value:Kt}of gt){const nn=ft[0]-tr,zn=nn>=0?Se.current[nn]:void 0,rn=ft[1];if(zn===void 0||zn<0||Kt.kind!==Ae.Text)continue;const xn=ve[rn],xr=xn===void 0?void 0:pe.rowSpans[xn];if(!xr)continue;const to=Fe.slice(xr.start+ct,xr.end+ct),Mi=mw(to,pe.delimiter);for(;Mi.length<=zn;)Mi.push("");const Ri=Kt.data??"";if(Mi[zn]===Ri)continue;Mi[zn]=Ri;const ar=qa(Mi,pe.delimiter);Fe=Fe.slice(0,xr.start+ct)+ar+Fe.slice(xr.end+ct),ct+=ar.length-(xr.end-xr.start)}return Fe!==Q&&oe(Fe),!0},[i]),rs=y.useCallback(z=>{var Fe;const[oe,Q]=z,pe=nt.current[Q];if(oe{const oe=[];for(let Q=z.y;Q{z[0]>=tr||bn(oe,z[1])},[bn]),ui=y.useMemo(()=>{const z={title:"#",id:"__gutter",width:ym,themeOverride:{baseFontStyle:`11px ${dk}`,textDark:"hsla(240, 3.8%, 46.1%, 0.4)"}},oe=Y.map(Q=>{const pe=ue.headers[Q]??"",ve=ee?pk(me[pe]):null;return{title:ve?`${pe.toUpperCase()} [${ve}]`:pe.toUpperCase(),id:`c${Q}`,width:ge,themeOverride:Nt[Q]?{baseFontStyle:`12px ${dk}`}:void 0}});return[z,...oe]},[ue.headers,Y,Nt,ge,ee,me]),Qs=y.useCallback((z,oe)=>{const{ctx:Q,columnIndex:pe,rect:ve,theme:gt,isSelected:Fe}=z;Q.save();try{if(Q.letterSpacing="0.5px",Fe&&(Q.fillStyle=gt.bgHeaderHovered,Q.fillRect(ve.x,ve.y,ve.width,ve.height),Q.fillStyle=gt.accentColor,Q.fillRect(ve.x,ve.y+ve.height-2,ve.width,2)),pe{const{ctx:Q,cell:pe,rect:ve,col:gt,theme:Fe}=z,ct=gt-tr;if(ct>=0&&dt&&pe.kind===Ae.Text){const ft=lV(pe.data,m);if(ft!==null){Q.save();try{const Kt=`${Fe.baseFontStyle} ${Fe.fontFamily}`;Q.font=Kt;let nn=ve.x+Fe.cellHorizontalPadding;const zn=ve.y+ve.height/2+Js(Q,Kt);for(const rn of ft){const xn=Q.measureText(rn.text).width;rn.hit&&xn>0&&(Q.fillStyle=ze,Q.fillRect(nn-1,zn-7,xn+2,14)),nn+=xn}}finally{Q.restore()}}}if(oe(),ct>=0&&pe.kind===Ae.Text&&pe.data===""){Q.save();try{Q.font=`${Fe.baseFontStyle} ${Fe.fontFamily}`,Q.fillStyle=Fe.textLight,Q.fillText("—",ve.x+Fe.cellHorizontalPadding,ve.y+ve.height/2+.5)}finally{Q.restore()}}},[dt,m,ze]),eo=y.useCallback(z=>{const oe=nt.current[z];return oe!==void 0&&P.current.has(oe)?{bgCell:Mt,bgCellMedium:Mt}:void 0},[Mt]);return be===0?E.jsx("div",{className:"flex flex-1 items-center justify-center p-6 text-sm text-muted-foreground",children:"No columns detected."}):E.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",ref:f,children:[E.jsxs("div",{"data-testid":`${n}-toolbar`,className:"flex flex-none flex-wrap items-center gap-1.5 border-b border-border bg-panel px-2 py-1",children:[E.jsxs("div",{className:"relative min-w-32 flex-1 sm:max-w-64",children:[E.jsx(TI,{"aria-hidden":"true",className:"pointer-events-none absolute left-1.5 top-1/2 size-3 -translate-y-1/2 text-muted-foreground/60"}),E.jsx("input",{type:"text","data-testid":`${n}-search`,"aria-label":"Search rows",value:g,onChange:z=>b(z.target.value),onKeyDown:z=>{z.key==="Escape"&&qn()},placeholder:"Search…",className:"h-6 w-full rounded-md border border-border bg-background pl-6 pr-6 text-xs text-foreground outline-none placeholder:text-muted-foreground/50 focus-visible:ring-3 focus-visible:ring-ring/50"}),g!==""&&E.jsx("button",{type:"button","data-testid":`${n}-clear-search`,"aria-label":"Clear search",onClick:qn,className:"absolute right-1 top-1/2 -translate-y-1/2 cursor-pointer rounded p-0.5 text-muted-foreground/60 outline-none hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50",children:E.jsx(Ah,{"aria-hidden":"true",className:"size-3"})})]}),E.jsx("span",{"data-testid":`${n}-count`,role:"status",className:"rounded-full bg-muted px-2 py-0.5 text-[11px] font-medium tabular-nums text-muted-foreground",children:dt?`${$e.length.toLocaleString()} of ${Yt.toLocaleString()}`:`${Yt.toLocaleString()} rows`}),ee&&er>0&&E.jsxs("button",{type:"button","data-testid":"input-table-column-types-reset",onClick:()=>Le({}),title:"Reset all pinned column types to Auto",className:ll,children:[`${er} ${er===1?"column type":"column types"} pinned`,E.jsx(Ah,{"aria-hidden":"true",className:"size-3 text-muted-foreground"})]}),E.jsxs("div",{ref:h,className:"relative",children:[E.jsxs("button",{type:"button","data-testid":`${n}-columns-button`,"aria-expanded":_,"aria-haspopup":"dialog","aria-label":"Columns",onClick:()=>re(z=>!z),className:Un(ll,Ke&&"border-foreground/30 bg-muted font-semibold"),children:[E.jsx(hI,{"aria-hidden":"true",className:"size-3"}),E.jsx("span",{children:Ke?`Columns (${Y.length}/${be})`:"Columns"})]}),_&&E.jsxs("div",{"data-testid":`${n}-columns-popout`,role:"dialog","aria-label":"Visible columns",className:"absolute left-0 top-7 z-30 min-w-44 max-w-64 rounded-md border border-border bg-panel p-1.5 shadow-md",children:[E.jsxs("div",{className:"mb-1 flex items-center justify-between gap-2 border-b border-border px-1.5 pb-1",children:[E.jsxs("span",{className:"text-[11px] font-semibold text-foreground",children:["Columns (",Y.length,"/",be,")"]}),Ke&&E.jsx("button",{type:"button","data-testid":`${n}-columns-reset`,onClick:rt,className:"cursor-pointer rounded px-1.5 py-0.5 text-[11px] font-medium text-muted-foreground hover:bg-muted hover:text-foreground",children:"Show all"})]}),E.jsx("div",{className:"max-h-56 overflow-y-auto",children:ue.headers.map((z,oe)=>{const Q=!O.has(oe),pe=Q&&Y.length<=1,ve=z!==""?z:`Column ${oe+1}`;return E.jsxs("label",{className:Un("flex items-center gap-2 rounded px-1.5 py-1 text-xs",pe?"cursor-not-allowed opacity-60":"cursor-pointer hover:bg-muted"),children:[E.jsx("input",{type:"checkbox","data-testid":`${n}-column-toggle-${oe}`,checked:Q,disabled:pe,onChange:()=>ot(oe),className:"size-3.5 accent-foreground"}),E.jsx("span",{className:"truncate font-mono text-[11px] text-foreground",children:ve})]},oe)})})]})]}),an&&E.jsx("button",{type:"button","data-testid":`${n}-apply-view`,"aria-pressed":ie,onClick:()=>se(z=>!z),className:Un("inline-flex cursor-pointer items-center gap-1 rounded-md border px-2 py-0.5 text-[11px] font-medium transition-colors outline-none focus-visible:ring-3 focus-visible:ring-ring/50",ie?"border-foreground bg-foreground text-background hover:bg-foreground/90":"border-border bg-background text-muted-foreground hover:bg-muted hover:text-foreground"),children:"Apply view to output"}),Ft&&E.jsxs("span",{className:"flex flex-wrap items-center gap-1.5",children:[E.jsx("span",{"data-testid":`${n}-selected-count`,className:"text-[11px] font-medium tabular-nums text-muted-foreground",children:Qe.length>0?`${Qe.length.toLocaleString()} selected`:Lt>0?`${Lt.toLocaleString()} ${Lt===1?"column":"columns"} selected`:`${((Rt==null?void 0:Rt.cellCount)??0).toLocaleString()} cells selected`}),Rt!==null&&E.jsx("span",{"data-testid":`${n}-selection-stats`,className:"rounded-md bg-muted px-2 py-0.5 font-mono text-[11px] font-medium tabular-nums text-muted-foreground",children:iV(Rt)}),E.jsxs("button",{type:"button","data-testid":`${n}-copy`,onClick:Vt,className:ll,children:[E.jsx(Wv,{"aria-hidden":"true",className:"size-3"}),"Copy as CSV"]}),ee&&Qe.length>0&&E.jsxs("button",{type:"button","data-testid":`${n}-delete-rows`,onClick:st,title:`Deletes the ${Qe.length} selected ${Qe.length===1?"row":"rows"} from the source CSV`,className:ll,children:[E.jsx(Eh,{"aria-hidden":"true",className:"size-3"}),"Delete ",Qe.length.toLocaleString()," ",Qe.length===1?"row":"rows"]}),ee&&Lt>0&&E.jsxs(E.Fragment,{children:[E.jsx("span",{role:"group","aria-label":"Column type override","data-testid":"input-table-column-type-group",className:"inline-flex items-center gap-0.5 rounded-md border border-border bg-muted/60 p-0.5",children:rV.map(({mode:z,label:oe})=>{const Q=Zt===z;return E.jsx("button",{type:"button","data-testid":`input-table-column-type-${z}`,"aria-pressed":Q,onClick:()=>Tn(z),className:Q?"cursor-pointer rounded bg-background px-1.5 py-0.5 text-[11px] font-medium text-foreground shadow-2xs outline-none focus-visible:ring-3 focus-visible:ring-ring/50":"cursor-pointer rounded px-1.5 py-0.5 text-[11px] font-medium text-muted-foreground outline-none hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50",children:oe},z)})}),E.jsxs("button",{type:"button","data-testid":`${n}-delete-columns`,onClick:lt,disabled:J,title:J?"At least one column must remain — the converter needs a column to detect":`Deletes the ${Lt} selected ${Lt===1?"column":"columns"} from the source CSV`,className:`${ll} disabled:cursor-not-allowed disabled:opacity-50`,children:[E.jsx(Eh,{"aria-hidden":"true",className:"size-3"}),"Delete ",Lt.toLocaleString()," ",Lt===1?"column":"columns"]})]}),E.jsx("button",{type:"button","data-testid":`${n}-clear-selection`,onClick:Yn,className:ll,children:"Clear"})]})]}),E.jsxs("div",{ref:d,"data-testid":n,role:"grid",tabIndex:-1,"aria-rowcount":$e.length+1,className:"relative min-h-0 flex-1 outline-none",style:{minHeight:mn},children:[E.jsx("div",{className:"absolute inset-0",children:E.jsx(K6,{imageWindowLoader:tt.current,renderers:M9,columns:ui,rows:$e.length,getCellContent:rs,getCellsForSelection:Wl,onCellsEdited:ee?Vr:void 0,onDelete:ee?Jn:void 0,onCellClicked:Vl,onHeaderClicked:Jt,onGridSelectionChange:Wr,onSelectionCleared:Ht,gridSelection:H,rangeSelect:"multi-rect",columnSelect:"multi",rowSelect:"multi",rowHeight:ck,headerHeight:mm,freezeColumns:tr,fillHandle:ee,onPaste:ee?()=>!0:!1,keybindings:{search:!1},theme:Ue,drawHeader:Qs,drawCell:Zs,getRowThemeOverride:eo,minColumnWidth:fk,smoothScrollX:!0,smoothScrollY:!0,verticalBorder:!1})}),T!==null&&E.jsx("input",{ref:D,type:"text","data-testid":"csv-header-rename-input","aria-label":`Rename column ${ue.headers[T.col]??""}`,value:M,onChange:z=>N(z.target.value),onBlur:jt,onKeyDown:z=>{z.key==="Enter"?(z.preventDefault(),z.stopPropagation(),jt()):z.key==="Escape"&&(z.preventDefault(),z.stopPropagation(),Hn())},style:{left:T.bounds.x,top:T.bounds.y,width:Math.max(60,T.bounds.width),height:T.bounds.height},className:"absolute z-20 border border-ring bg-background px-2 font-mono text-[11px] font-semibold tracking-wider text-foreground outline-none ring-2 ring-ring/50"}),dt&&$e.length===0&&E.jsxs("div",{"data-testid":`${n}-empty-filter`,className:"absolute inset-x-0 top-0 z-10 flex flex-col items-center gap-2 p-6 text-sm text-muted-foreground",children:[E.jsxs("span",{children:["No rows matching “",m,"”."]}),E.jsx("button",{type:"button",onClick:qn,className:ll,children:"Show all rows"})]}),ee&&!dt&&$e.length===0&&E.jsx("div",{"data-testid":`${n}-empty-rows`,className:"absolute inset-x-0 top-0 z-10 flex flex-col items-center gap-2 p-6 text-sm text-muted-foreground",children:E.jsx("span",{children:"No rows. Paste or upload data to start over."})})]})]})}function lV(t,e){if(e===""||t==="")return null;const n=e.toLowerCase();if(!t.toLowerCase().includes(n))return null;const r=[],i=t.toLowerCase();let s=0;for(;;){const o=i.indexOf(n,s);if(o===-1)break;o>s&&r.push({text:t.slice(s,o),hit:!1}),r.push({text:t.slice(o,o+n.length),hit:!0}),s=o+n.length}return s"u"?void 0:navigator),s=y.useRef(null);y.useEffect(()=>{var l;(l=s.current)==null||l.focus()},[]);const o=t==="CSV";return E.jsx("div",{"data-testid":"dropzone",className:"flex flex-1 flex-col items-center justify-center p-3 md:p-6 md:px-16",children:E.jsxs("div",{className:"flex w-full max-w-sm flex-col items-center gap-2.5 md:gap-3",children:[E.jsx("div",{"aria-hidden":"true",className:"flex size-9 items-center justify-center rounded-xl border border-border bg-muted/50 text-muted-foreground md:size-11",children:E.jsx(uI,{className:"size-4 md:size-5"})}),E.jsx("p",{"data-testid":"dropzone-title",className:"text-center text-sm font-medium text-foreground",children:o?"Paste CSV, TSV, or Markdown table":"Paste JSON or JSONL here"}),E.jsx("p",{"data-testid":"dropzone-formats",className:"max-w-[36ch] text-center text-[11.5px] leading-relaxed text-muted-foreground",children:o?"Supports CSV, TSV / spreadsheet cells, Markdown & ChatGPT docs (multi-table), and psql / MySQL box tables":"Supports JSON arrays, nested objects, wrapped API payloads ({ data: […] }), and JSONL / NDJSON"}),E.jsx("textarea",{ref:s,"data-testid":"paste-field",rows:1,"aria-label":`Paste ${o?"CSV, TSV, Markdown, or CLI table":"JSON, JSONL, or API response"} data — or press ${i} to paste anywhere on this page`,placeholder:o?"Paste CSV, TSV, Markdown, or psql/MySQL table here":"Paste JSON, JSONL / NDJSON, or API response here",spellCheck:!1,onChange:l=>{const a=l.currentTarget;a.rows=fV(a.value),e(a.value)},className:"min-h-11 w-full resize-none overflow-hidden rounded-md border border-border bg-background px-3 py-2.5 font-mono text-[12.5px] leading-relaxed text-foreground transition-colors placeholder:font-sans placeholder:text-xs placeholder:text-muted-foreground focus:outline-none focus-visible:border-sky-600 dark:focus-visible:border-sky-400"}),E.jsxs("p",{className:"text-center text-[13px] leading-relaxed text-muted-foreground",children:["or drag & drop a file anywhere in this pane — you can also paste anywhere on the page (",E.jsx("kbd",{"data-testid":"paste-shortcut",className:"rounded border border-border bg-muted px-1.5 py-0.5 font-mono text-[11px] font-medium text-foreground",children:i}),")"]}),E.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[E.jsxs("button",{type:"button","data-testid":"choose-file",onClick:n,className:"inline-flex h-8 cursor-pointer items-center gap-1.5 whitespace-nowrap rounded-lg border border-border bg-background px-3 text-[13px] font-medium text-foreground transition-colors hover:bg-muted focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50 [&_svg]:size-3.5",children:[E.jsx(AT,{"aria-hidden":"true"}),"Choose file"]}),E.jsxs("button",{type:"button","data-testid":"try-example",onClick:r,className:"inline-flex h-8 cursor-pointer items-center gap-1.5 whitespace-nowrap rounded-lg px-3 text-[13px] font-medium text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50 [&_svg]:size-3.5",children:[E.jsx(AI,{"aria-hidden":"true"}),"Try an example"]})]})]})})}let ty=[],nA=[];(()=>{let t="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,1n,9,16,o,,x,1i,3,,i,,7,a,2,t,3,1k,,,7,2,2,2,3,9,,a,2,q,,2,3,1k,,,5,4,2,2,3,3,,u,2,3,,b,3,1k,,,8,,3,,3,k,2,m,6,,3,1k,,,7,2,2,2,3,7,3,a,2,u,,1n,5,3,3,,4,9,,14,5,1j,,,7,,3,,4,7,2,b,2,t,3,1k,,,7,,3,,4,7,2,b,2,f,,c,4,1j,2,,7,,3,,4,9,,a,2,t,3,1y,,4,6,,,,8,i,2,1p,,,8,c,8,2q,,,a,b,7,21,2,r,,,,,,4,2,1d,k,,2,5,b,,10,9,,2u,b,,6,n,4,4,3,g,4,d,,,3,6,,f,,jj,3,qa,4,s,3,t,2,u,2,1s,w,9,,19,3,,,39,2,y,,3a,c,4,c,63,5,1l,a,,,,,2,o,2,,1c,1a,2,c,k,5,1b,h,12,9,c,3,u,d,1k,e,1c,k,48,3,,l,4,,6,,2,3,5i,1s,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,n,5,4,,2b,2,1e,i,q,i,d,,12,8,p,d,18,4,1b,e,10,,1v,e,c,,8,2,1a,,1f,,,3,2,2,5,2,,,15,5,5,2,6k,8,,2,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,1t,5,8t,2,25,6,1y,b,1d,4,3e,3,1h,f,15,,2,2,a,4,19,b,7,,1p,3,10,e,g,2,18,,c,3,1c,e,8,4,,2,2k,c,6,,2,,4d,c,l,4,1j,2,,7,2,2,2,3,9,,a,2,2,7,3,5,1v,9,,,2,,,4,,5,,,e,2,2a,i,n,,29,k,6j,7,2,9,r,2,2a,h,2y,d,2t,3,2,a,74,f,6t,6,,2,2,4,,,,2,3x,7,2,7,3,,s,a,14,7,,4,8,,9,b,1a,g,5i,8,5j,8,,8,2a,m,,e,3e,6,3,,,2,,7,,,1u,5,,2,,5,9n,4,9,2,,,1c,7,3,5,n,,44l,,6,f,8ug,i,1xc,5,1n,7,t4,,,1j,7,4,29,,b,2,f57,2,3mp,1a,2,n,f2,5,3,6,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,2s,,4g,7,af,,1p,4,e4,4,72,2,6r,,2,,7,2,5,,d6,7,31,7,240,5".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,n=0;e>1;if(t=nA[r])e=r+1;else return!0;if(e==n)return!1}}function mk(t){return t>=127462&&t<=127487}const yk=8205;function pV(t,e,n=!0,r=!0){return(n?rA:gV)(t,e,r)}function rA(t,e,n){if(e==t.length)return e;e&&iA(t.charCodeAt(e))&&sA(t.charCodeAt(e-1))&&e--;let r=vm(t,e);for(e+=vk(r);e=0&&mk(vm(t,o));)s++,o-=2;if(s%2==0)break;e+=2}else break}return e}function gV(t,e,n){for(;e>1;){let r=rA(t,e-2,n);if(r=56320&&t<57344}function sA(t){return t>=55296&&t<56320}function vk(t){return t<65536?1:2}class _t{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,n,r){[e,n]=Ya(this,e,n);let i=[];return this.decompose(0,e,i,2),r.length&&r.decompose(0,r.length,i,3),this.decompose(n,this.length,i,1),gs.from(i,this.length-(n-e)+r.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,n=this.length){[e,n]=Ya(this,e,n);let r=[];return this.decompose(e,n,r,0),gs.from(r,n-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let n=this.scanIdentical(e,1),r=this.length-this.scanIdentical(e,-1),i=new vc(this),s=new vc(e);for(let o=n,l=n;;){if(i.next(o),s.next(o),o=0,i.lineBreak!=s.lineBreak||i.done!=s.done||i.value!=s.value)return!1;if(l+=i.value.length,i.done||l>=r)return!0}}iter(e=1){return new vc(this,e)}iterRange(e,n=this.length){return new oA(this,e,n)}iterLines(e,n){let r;if(e==null)r=this.iter();else{n==null&&(n=this.lines+1);let i=this.line(e).from;r=this.iterRange(i,Math.max(i,n==this.lines+1?this.length:n<=1?0:this.line(n-1).to))}return new lA(r)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?_t.empty:e.length<=32?new Ln(e):gs.from(Ln.split(e,[]))}}class Ln extends _t{constructor(e,n=mV(e)){super(),this.text=e,this.length=n}get lines(){return this.text.length}get children(){return null}lineInner(e,n,r,i){for(let s=0;;s++){let o=this.text[s],l=i+o.length;if((n?r:l)>=e)return new yV(i,l,r,o);i=l+1,r++}}decompose(e,n,r,i){let s=e<=0&&n>=this.length?this:new Ln(wk(this.text,e,n),Math.min(n,this.length)-Math.max(0,e));if(i&1){let o=r.pop(),l=qd(s.text,o.text.slice(),0,s.length);if(l.length<=32)r.push(new Ln(l,o.length+s.length));else{let a=l.length>>1;r.push(new Ln(l.slice(0,a)),new Ln(l.slice(a)))}}else r.push(s)}replace(e,n,r){if(!(r instanceof Ln))return super.replace(e,n,r);[e,n]=Ya(this,e,n);let i=qd(this.text,qd(r.text,wk(this.text,0,e)),n),s=this.length+r.length-(n-e);return i.length<=32?new Ln(i,s):gs.from(Ln.split(i,[]),s)}sliceString(e,n=this.length,r=` -`){[e,n]=Ya(this,e,n);let i="";for(let s=0,o=0;s<=n&&oe&&o&&(i+=r),es&&(i+=l.slice(Math.max(0,e-s),n-s)),s=a+1}return i}flatten(e){for(let n of this.text)e.push(n)}scanIdentical(){return 0}static split(e,n){let r=[],i=-1;for(let s of e)r.push(s),i+=s.length+1,r.length==32&&(n.push(new Ln(r,i)),r=[],i=-1);return i>-1&&n.push(new Ln(r,i)),n}}class gs extends _t{constructor(e,n){super(),this.children=e,this.length=n,this.lines=0;for(let r of e)this.lines+=r.lines}lineInner(e,n,r,i){for(let s=0;;s++){let o=this.children[s],l=i+o.length,a=r+o.lines-1;if((n?a:l)>=e)return o.lineInner(e,n,r,i);i=l+1,r=a+1}}decompose(e,n,r,i){for(let s=0,o=0;o<=n&&s=o){let u=i&((o<=e?1:0)|(a>=n?2:0));o>=e&&a<=n&&!u?r.push(l):l.decompose(e-o,n-o,r,u)}o=a+1}}replace(e,n,r){if([e,n]=Ya(this,e,n),r.lines=s&&n<=l){let a=o.replace(e-s,n-s,r),u=this.lines-o.lines+a.lines;if(a.lines>4&&a.lines>u>>6){let c=this.children.slice();return c[i]=a,new gs(c,this.length-(n-e)+r.length)}return super.replace(s,l,a)}s=l+1}return super.replace(e,n,r)}sliceString(e,n=this.length,r=` -`){[e,n]=Ya(this,e,n);let i="";for(let s=0,o=0;se&&s&&(i+=r),eo&&(i+=l.sliceString(e-o,n-o,r)),o=a+1}return i}flatten(e){for(let n of this.children)n.flatten(e)}scanIdentical(e,n){if(!(e instanceof gs))return 0;let r=0,[i,s,o,l]=n>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;i+=n,s+=n){if(i==o||s==l)return r;let a=this.children[i],u=e.children[s];if(a!=u)return r+a.scanIdentical(u,n);r+=a.length+1}}static from(e,n=e.reduce((r,i)=>r+i.length+1,-1)){let r=0;for(let h of e)r+=h.lines;if(r<32){let h=[];for(let p of e)p.flatten(h);return new Ln(h,n)}let i=Math.max(32,r>>5),s=i<<1,o=i>>1,l=[],a=0,u=-1,c=[];function f(h){let p;if(h.lines>s&&h instanceof gs)for(let g of h.children)f(g);else h.lines>o&&(a>o||!a)?(d(),l.push(h)):h instanceof Ln&&a&&(p=c[c.length-1])instanceof Ln&&h.lines+p.lines<=32?(a+=h.lines,u+=h.length+1,c[c.length-1]=new Ln(p.text.concat(h.text),p.length+1+h.length)):(a+h.lines>i&&d(),a+=h.lines,u+=h.length+1,c.push(h))}function d(){a!=0&&(l.push(c.length==1?c[0]:gs.from(c,u)),u=-1,a=c.length=0)}for(let h of e)f(h);return d(),l.length==1?l[0]:new gs(l,n)}}_t.empty=new Ln([""],0);function mV(t){let e=-1;for(let n of t)e+=n.length+1;return e}function qd(t,e,n=0,r=1e9){for(let i=0,s=0,o=!0;s=n&&(a>r&&(l=l.slice(0,r-i)),i0?1:(e instanceof Ln?e.text.length:e.children.length)<<1]}nextInner(e,n){for(this.done=this.lineBreak=!1;;){let r=this.nodes.length-1,i=this.nodes[r],s=this.offsets[r],o=s>>1,l=i instanceof Ln?i.text.length:i.children.length;if(o==(n>0?l:0)){if(r==0)return this.done=!0,this.value="",this;n>0&&this.offsets[r-1]++,this.nodes.pop(),this.offsets.pop()}else if((s&1)==(n>0?0:1)){if(this.offsets[r]+=n,e==0)return this.lineBreak=!0,this.value=` -`,this;e--}else if(i instanceof Ln){let a=i.text[o+(n<0?-1:0)];if(this.offsets[r]+=n,a.length>Math.max(0,e))return this.value=e==0?a:n>0?a.slice(e):a.slice(0,a.length-e),this;e-=a.length}else{let a=i.children[o+(n<0?-1:0)];e>a.length?(e-=a.length,this.offsets[r]+=n):(n<0&&this.offsets[r]--,this.nodes.push(a),this.offsets.push(n>0?1:(a instanceof Ln?a.text.length:a.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class oA{constructor(e,n,r){this.value="",this.done=!1,this.cursor=new vc(e,n>r?-1:1),this.pos=n>r?e.length:0,this.from=Math.min(n,r),this.to=Math.max(n,r)}nextInner(e,n){if(n<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,n<0?this.pos-this.to:this.from-this.pos);let r=n<0?this.pos-this.from:this.to-this.pos;e>r&&(e=r),r-=e;let{value:i}=this.cursor.next(e);return this.pos+=(i.length+e)*n,this.value=i.length<=r?i:n<0?i.slice(i.length-r):i.slice(0,r),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class lA{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:n,lineBreak:r,value:i}=this.inner.next(e);return n&&this.afterBreak?(this.value="",this.afterBreak=!1):n?(this.done=!0,this.value=""):r?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=i,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(_t.prototype[Symbol.iterator]=function(){return this.iter()},vc.prototype[Symbol.iterator]=oA.prototype[Symbol.iterator]=lA.prototype[Symbol.iterator]=function(){return this});class yV{constructor(e,n,r,i){this.from=e,this.to=n,this.number=r,this.text=i}get length(){return this.to-this.from}}function Ya(t,e,n){return e=Math.max(0,Math.min(t.length,e)),[e,Math.max(e,Math.min(t.length,n))]}function vr(t,e,n=!0,r=!0){return pV(t,e,n,r)}function vV(t){return t>=56320&&t<57344}function wV(t){return t>=55296&&t<56320}function bV(t,e){let n=t.charCodeAt(e);if(!wV(n)||e+1==t.length)return n;let r=t.charCodeAt(e+1);return vV(r)?(n-55296<<10)+(r-56320)+65536:n}function xV(t){return t<65536?1:2}const ny=/\r\n?|\n/;var Dr=function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t}(Dr||(Dr={}));class Es{constructor(e){this.sections=e}get length(){let e=0;for(let n=0;ne)return s+(e-i);s+=l}else{if(r!=Dr.Simple&&u>=e&&(r==Dr.TrackDel&&ie||r==Dr.TrackBefore&&ie))return null;if(u>e||u==e&&n<0&&!l)return e==i||n<0?s:s+a;s+=a}i=u}if(e>i)throw new RangeError(`Position ${e} is out of range for changeset of length ${i}`);return s}touchesRange(e,n=e){for(let r=0,i=0;r=0&&i<=n&&l>=e)return in?"cover":!0;i=l}return!1}toString(){let e="";for(let n=0;n=0?":"+i:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(n=>typeof n!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new Es(e)}static create(e){return new Es(e)}}class Vn extends Es{constructor(e,n){super(e),this.inserted=n}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return ry(this,(n,r,i,s,o)=>e=e.replace(i,i+(r-n),o),!1),e}mapDesc(e,n=!1){return iy(this,e,n,!0)}invert(e){let n=this.sections.slice(),r=[];for(let i=0,s=0;i=0){n[i]=l,n[i+1]=o;let a=i>>1;for(;r.length0&&Ao(r,n,s.text),s.forward(c),l+=c}let u=e[o++];for(;l>1].toJSON()))}return e}static of(e,n,r){let i=[],s=[],o=0,l=null;function a(c=!1){if(!c&&!i.length)return;od||f<0||d>n)throw new RangeError(`Invalid change range ${f} to ${d} (in doc of length ${n})`);let p=h?typeof h=="string"?_t.of(h.split(r||ny)):h:_t.empty,g=p.length;if(f==d&&g==0)return;fo&&mr(i,f-o,-1),mr(i,d-f,g),Ao(s,i,p),o=d}}return u(e),a(!l),l}static empty(e){return new Vn(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let n=[],r=[];for(let i=0;il&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(s.length==1)n.push(s[0],0);else{for(;r.length=0&&n<=0&&n==t[i+1]?t[i]+=e:i>=0&&e==0&&t[i]==0?t[i+1]+=n:r?(t[i]+=e,t[i+1]+=n):t.push(e,n)}function Ao(t,e,n){if(n.length==0)return;let r=e.length-2>>1;if(r>1])),!(n||o==t.sections.length||t.sections[o+1]<0);)l=t.sections[o++],a=t.sections[o++];e(i,u,s,c,f),i=u,s=c}}}function iy(t,e,n,r=!1){let i=[],s=r?[]:null,o=new Uc(t),l=new Uc(e);for(let a=-1;;){if(o.done&&l.len||l.done&&o.len)throw new Error("Mismatched change set lengths");if(o.ins==-1&&l.ins==-1){let u=Math.min(o.len,l.len);mr(i,u,-1),o.forward(u),l.forward(u)}else if(l.ins>=0&&(o.ins<0||a==o.i||o.off==0&&(l.len=0&&a=0){let u=0,c=o.len;for(;c;)if(l.ins==-1){let f=Math.min(c,l.len);u+=f,c-=f,l.forward(f)}else if(l.ins==0&&l.lena||o.ins>=0&&o.len>a)&&(l||r.length>u),s.forward2(a),o.forward(a)}}}}class Uc{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i>1;return n>=e.length?_t.empty:e[n]}textBit(e){let{inserted:n}=this.set,r=this.i-2>>1;return r>=n.length&&!e?_t.empty:n[r].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class ko{constructor(e,n,r,i){this.from=e,this.to=n,this.flags=r,this.goalColumn=i}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get undirectional(){return(this.flags&64)>0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}map(e,n=-1){let r,i;return this.empty?r=i=e.mapPos(this.from,n):(r=e.mapPos(this.from,1),i=e.mapPos(this.to,-1)),r==this.from&&i==this.to?this:new ko(r,i,this.flags,this.goalColumn)}extend(e,n=e,r=0){if(e<=this.anchor&&n>=this.anchor)return de.range(e,n,void 0,void 0,r);let i=Math.abs(e-this.anchor)>Math.abs(n-this.anchor)?e:n;return de.range(this.anchor,i,void 0,void 0,r)}eq(e,n=!1){return this.anchor==e.anchor&&this.head==e.head&&this.goalColumn==e.goalColumn&&(!n||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return de.range(e.anchor,e.head)}static create(e,n,r,i){return new ko(e,n,r,i)}}class de{constructor(e,n){this.ranges=e,this.mainIndex=n}map(e,n=-1){return e.empty?this:de.create(this.ranges.map(r=>r.map(e,n)),this.mainIndex)}eq(e,n=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let r=0;re.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new de(e.ranges.map(n=>ko.fromJSON(n)),e.main)}static single(e,n=e){return new de([de.range(e,n)],0)}static create(e,n=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let r=0,i=0;ii.from-s.from),n=e.indexOf(r);for(let i=1;is.head?de.range(a,l):de.range(l,a))}}return new de(e,n)}}function uA(t,e){for(let n of t.ranges)if(n.to>e)throw new RangeError("Selection points outside of document")}let yw=0;class He{constructor(e,n,r,i,s){this.combine=e,this.compareInput=n,this.compare=r,this.isStatic=i,this.id=yw++,this.default=e([]),this.extensions=typeof s=="function"?s(this):s}get reader(){return this}static define(e={}){return new He(e.combine||(n=>n),e.compareInput||((n,r)=>n===r),e.compare||(e.combine?(n,r)=>n===r:vw),!!e.static,e.enables)}of(e){return new Yd([],this,0,e)}compute(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new Yd(e,this,1,n)}computeN(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new Yd(e,this,2,n)}from(e,n){return n||(n=r=>r),this.compute([e],r=>n(r.field(e)))}}function vw(t,e){return t==e||t.length==e.length&&t.every((n,r)=>n===e[r])}class Yd{constructor(e,n,r,i){this.dependencies=e,this.facet=n,this.type=r,this.value=i,this.id=yw++}dynamicSlot(e){var n;let r=this.value,i=this.facet.compareInput,s=this.id,o=e[s]>>1,l=this.type==2,a=!1,u=!1,c=[];for(let f of this.dependencies)f=="doc"?a=!0:f=="selection"?u=!0:((n=e[f.id])!==null&&n!==void 0?n:1)&1||c.push(e[f.id]);return{create(f){return f.values[o]=r(f),1},update(f,d){if(a&&d.docChanged||u&&(d.docChanged||d.selection)||sy(f,c)){let h=r(f);if(l?!bk(h,f.values[o],i):!i(h,f.values[o]))return f.values[o]=h,1}return 0},reconfigure:(f,d)=>{let h,p=d.config.address[s];if(p!=null){let g=Wh(d,p);if(this.dependencies.every(b=>b instanceof He?d.facet(b)===f.facet(b):b instanceof Os?d.field(b,!1)==f.field(b,!1):!0)||(l?bk(h=r(f),g,i):i(h=r(f),g)))return f.values[o]=g,0}else h=r(f);return f.values[o]=h,1}}}get extension(){return this}}function bk(t,e,n){if(t.length!=e.length)return!1;for(let r=0;rt[a.id]),i=n.map(a=>a.type),s=r.filter(a=>!(a&1)),o=t[e.id]>>1;function l(a){let u=[];for(let c=0;cr===i),e);return e.provide&&(n.provides=e.provide(n)),n}create(e){let n=e.facet(fd).find(r=>r.field==this);return((n==null?void 0:n.create)||this.createF)(e)}slot(e){let n=e[this.id]>>1;return{create:r=>(r.values[n]=this.create(r),1),update:(r,i)=>{let s=r.values[n],o=this.updateF(s,i);return this.compareF(s,o)?0:(r.values[n]=o,1)},reconfigure:(r,i)=>{let s=r.facet(fd),o=i.facet(fd),l;return(l=s.find(a=>a.field==this))&&l!=o.find(a=>a.field==this)?(r.values[n]=l.create(r),1):i.config.address[this.id]!=null?(r.values[n]=i.field(this),0):(r.values[n]=this.create(r),1)}}}init(e){return[this,fd.of({field:this,create:e})]}get extension(){return this}}const ml={lowest:4,low:3,default:2,high:1,highest:0};function Hu(t){return e=>new cA(e,t)}const ww={highest:Hu(ml.highest),high:Hu(ml.high),default:Hu(ml.default),low:Hu(ml.low),lowest:Hu(ml.lowest)};class cA{constructor(e,n){this.inner=e,this.prec=n}get extension(){return this}}class Tl{of(e){return new oy(this,e)}reconfigure(e){return Tl.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class oy{constructor(e,n){this.compartment=e,this.inner=n}get extension(){return this}}class Hh{constructor(e,n,r,i,s,o){for(this.base=e,this.compartments=n,this.dynamicSlots=r,this.address=i,this.staticValues=s,this.facets=o,this.statusTemplate=[];this.statusTemplate.length>1]}static resolve(e,n,r){let i=[],s=Object.create(null),o=new Map;for(let d of SV(e,n,o))d instanceof Os?i.push(d):(s[d.facet.id]||(s[d.facet.id]=[])).push(d);let l=Object.create(null),a=[],u=[];for(let d of i)l[d.id]=u.length<<1,u.push(h=>d.slot(h));let c=r==null?void 0:r.config.facets;for(let d in s){let h=s[d],p=h[0].facet,g=c&&c[d]||[];if(h.every(b=>b.type==0))if(l[p.id]=a.length<<1|1,vw(g,h))a.push(r.facet(p));else{let b=p.combine(h.map(m=>m.value));a.push(r&&p.compare(b,r.facet(p))?r.facet(p):b)}else{for(let b of h)b.type==0?(l[b.id]=a.length<<1|1,a.push(b.value)):(l[b.id]=u.length<<1,u.push(m=>b.dynamicSlot(m)));l[p.id]=u.length<<1,u.push(b=>kV(b,p,h))}}let f=u.map(d=>d(l));return new Hh(e,o,f,l,a,s)}}function SV(t,e,n){let r=[[],[],[],[],[]],i=new Map;function s(o,l){let a=i.get(o);if(a!=null){if(a<=l)return;let u=r[a].indexOf(o);u>-1&&r[a].splice(u,1),o instanceof oy&&n.delete(o.compartment)}if(i.set(o,l),Array.isArray(o))for(let u of o)s(u,l);else if(o instanceof oy){if(n.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let u=e.get(o.compartment)||o.inner;n.set(o.compartment,u),s(u,l)}else if(o instanceof cA)s(o.inner,o.prec);else if(o instanceof Os)r[l].push(o),o.provides&&s(o.provides,l);else if(o instanceof Yd)r[l].push(o),o.facet.extensions&&s(o.facet.extensions,ml.default);else{let u=o.extension;if(!u)throw new Error(`Unrecognized extension value in extension set (${o}).`);if(u==o)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);s(u,l)}}return s(t,ml.default),r.reduce((o,l)=>o.concat(l))}function wc(t,e){if(e&1)return 2;let n=e>>1,r=t.status[n];if(r==4)throw new Error("Cyclic dependency between fields and/or facets");if(r&2)return r;t.status[n]=4;let i=t.computeSlot(t,t.config.dynamicSlots[n]);return t.status[n]=2|i}function Wh(t,e){return e&1?t.config.staticValues[e>>1]:t.values[e>>1]}const fA=He.define(),ly=He.define({combine:t=>t.some(e=>e),static:!0}),dA=He.define({combine:t=>t.length?t[0]:void 0,static:!0}),hA=He.define(),pA=He.define(),gA=He.define(),mA=He.define({combine:t=>t.length?t[0]:!1});class qo{constructor(e,n){this.type=e,this.value=n}static define(){return new CV}}class CV{of(e){return new qo(this,e)}}class TV{constructor(e){this.map=e}of(e){return new on(this,e)}}class on{constructor(e,n){this.type=e,this.value=n}map(e){let n=this.type.map(this.value,e);return n===void 0?void 0:n==this.value?this:new on(this.type,n)}is(e){return this.type==e}static define(e={}){return new TV(e.map||(n=>n))}static mapEffects(e,n){if(!e.length)return e;let r=[];for(let i of e){let s=i.map(n);s&&r.push(s)}return r}}on.reconfigure=on.define();on.appendConfig=on.define();class Gn{constructor(e,n,r,i,s,o){this.startState=e,this.changes=n,this.selection=r,this.effects=i,this.annotations=s,this.scrollIntoView=o,this._doc=null,this._state=null,r&&uA(r,n.newLength),s.some(l=>l.type==Gn.time)||(this.annotations=s.concat(Gn.time.of(Date.now())))}static create(e,n,r,i,s,o){return new Gn(e,n,r,i,s,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let n of this.annotations)if(n.type==e)return n.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let n=this.annotation(Gn.userEvent);return!!(n&&(n==e||n.length>e.length&&n.slice(0,e.length)==e&&n[e.length]=="."))}}Gn.time=qo.define();Gn.userEvent=qo.define();Gn.addToHistory=qo.define();Gn.remote=qo.define();function EV(t,e){let n=[];for(let r=0,i=0;;){let s,o;if(r=t[r]))s=t[r++],o=t[r++];else if(i=0;i--){let s=r[i](t);s instanceof Gn?t=s:Array.isArray(s)&&s.length==1&&s[0]instanceof Gn?t=s[0]:t=vA(e,Da(s),!1)}return t}function MV(t){let e=t.startState,n=e.facet(gA),r=t;for(let i=n.length-1;i>=0;i--){let s=n[i](t);s&&Object.keys(s).length&&(r=yA(r,ay(e,s,t.changes.newLength),!0))}return r==t?t:Gn.create(e,t.changes,t.selection,r.effects,r.annotations,r.scrollIntoView)}const RV=[];function Da(t){return t==null?RV:Array.isArray(t)?t:[t]}var Hs=function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t}(Hs||(Hs={}));const OV=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let uy;try{uy=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function PV(t){if(uy)return uy.test(t);for(let e=0;e"€"&&(n.toUpperCase()!=n.toLowerCase()||OV.test(n)))return!0}return!1}function NV(t){return e=>{if(!/\S/.test(e))return Hs.Space;if(PV(e))return Hs.Word;for(let n=0;n-1)return Hs.Word;return Hs.Other}}class zt{constructor(e,n,r,i,s,o){this.config=e,this.doc=n,this.selection=r,this.values=i,this.status=e.statusTemplate.slice(),this.computeSlot=s,o&&(o._state=this);for(let l=0;li.set(u,a)),n=null),i.set(l.value.compartment,l.value.extension)):l.is(on.reconfigure)?(n=null,r=l.value):l.is(on.appendConfig)&&(n=null,r=Da(r).concat(l.value));let s;n?s=e.startState.values.slice():(n=Hh.resolve(r,i,this),s=new zt(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(a,u)=>u.reconfigure(a,this),null).values);let o=e.startState.facet(ly)?e.newSelection:e.newSelection.asSingle();new zt(n,e.newDoc,o,s,(l,a)=>a.update(l,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(n=>({changes:{from:n.from,to:n.to,insert:e},range:de.cursor(n.from+e.length)}))}changeByRange(e){let n=this.selection,r=e(n.ranges[0]),i=this.changes(r.changes),s=[r.range],o=Da(r.effects);for(let l=1;lo.spec.fromJSON(l,a)))}}return zt.create({doc:e.doc,selection:de.fromJSON(e.selection),extensions:n.extensions?i.concat([n.extensions]):i})}static create(e={}){let n=Hh.resolve(e.extensions||[],new Map),r=e.doc instanceof _t?e.doc:_t.of((e.doc||"").split(n.staticFacet(zt.lineSeparator)||ny)),i=e.selection?e.selection instanceof de?e.selection:de.single(e.selection.anchor,e.selection.head):de.single(0);return uA(i,r.length),n.staticFacet(ly)||(i=i.asSingle()),new zt(n,r,i,n.dynamicSlots.map(()=>null),(s,o)=>o.create(s),null)}get tabSize(){return this.facet(zt.tabSize)}get lineBreak(){return this.facet(zt.lineSeparator)||` -`}get readOnly(){return this.facet(mA)}phrase(e,...n){for(let r of this.facet(zt.phrases))if(Object.prototype.hasOwnProperty.call(r,e)){e=r[e];break}return n.length&&(e=e.replace(/\$(\$|\d*)/g,(r,i)=>{if(i=="$")return"$";let s=+(i||1);return!s||s>n.length?r:n[s-1]})),e}languageDataAt(e,n,r=-1){let i=[];for(let s of this.facet(fA))for(let o of s(this,n,r))Object.prototype.hasOwnProperty.call(o,e)&&i.push(o[e]);return i}charCategorizer(e){let n=this.languageDataAt("wordChars",e);return NV(n.length?n[0]:"")}wordAt(e){let{text:n,from:r,length:i}=this.doc.lineAt(e),s=this.charCategorizer(e),o=e-r,l=e-r;for(;o>0;){let a=vr(n,o,!1);if(s(n.slice(a,o))!=Hs.Word)break;o=a}for(;lt.length?t[0]:4});zt.lineSeparator=dA;zt.readOnly=mA;zt.phrases=He.define({compare(t,e){let n=Object.keys(t),r=Object.keys(e);return n.length==r.length&&n.every(i=>t[i]==e[i])}});zt.languageData=fA;zt.changeFilter=hA;zt.transactionFilter=pA;zt.transactionExtender=gA;Tl.reconfigure=on.define();function wA(t,e,n={}){let r={};for(let i of t)for(let s of Object.keys(i)){let o=i[s],l=r[s];if(l===void 0)r[s]=o;else if(!(l===o||o===void 0))if(Object.hasOwnProperty.call(n,s))r[s]=n[s](l,o);else throw new Error("Config merge conflict for field "+s)}for(let i in e)r[i]===void 0&&(r[i]=e[i]);return r}class Il{eq(e){return this==e}range(e,n=e){return cy.create(e,n,this)}}Il.prototype.startSide=Il.prototype.endSide=0;Il.prototype.point=!1;Il.prototype.mapMode=Dr.TrackDel;function bw(t,e){return t==e||t.constructor==e.constructor&&t.eq(e)}let cy=class bA{constructor(e,n,r){this.from=e,this.to=n,this.value=r}static create(e,n,r){return new bA(e,n,r)}};function fy(t,e){return t.from-e.from||t.value.startSide-e.value.startSide}class xw{constructor(e,n,r,i){this.from=e,this.to=n,this.value=r,this.maxPoint=i}get length(){return this.to[this.to.length-1]}findIndex(e,n,r,i=0){let s=r?this.to:this.from;for(let o=i,l=s.length;;){if(o==l)return o;let a=o+l>>1,u=s[a]-e||(r?this.value[a].endSide:this.value[a].startSide)-n;if(a==o)return u>=0?o:l;u>=0?l=a:o=a+1}}between(e,n,r,i){for(let s=this.findIndex(n,-1e9,!0),o=this.findIndex(r,1e9,!1,s);sh||d==h&&u.startSide>0&&u.endSide<=0)continue;(h-d||u.endSide-u.startSide)<0||(o<0&&(o=d),u.point&&(l=Math.max(l,h-d)),r.push(u),i.push(d-o),s.push(h-o))}return{mapped:r.length?new xw(i,s,r,l):null,pos:o}}}class Gt{constructor(e,n,r,i){this.chunkPos=e,this.chunk=n,this.nextLayer=r,this.maxPoint=i}static create(e,n,r,i){return new Gt(e,n,r,i)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let n of this.chunk)e+=n.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:n=[],sort:r=!1,filterFrom:i=0,filterTo:s=this.length}=e,o=e.filter;if(n.length==0&&!o)return this;if(r&&(n=n.slice().sort(fy)),this.isEmpty)return n.length?Gt.of(n):this;let l=new xA(this,null,-1).goto(0),a=0,u=[],c=new Ja;for(;l.value||a=0){let f=n[a++];c.addInner(f.from,f.to,f.value)||u.push(f)}else l.rangeIndex==1&&l.chunkIndexthis.chunkEnd(l.chunkIndex)||sl.to||s=s&&e<=s+o.length&&o.between(s,e-s,n-s,r)===!1)return}this.nextLayer.between(e,n,r)}}iter(e=0){return Kc.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,n=0){return Kc.from(e).goto(n)}static compare(e,n,r,i,s=-1){let o=e.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=s),l=n.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=s),a=xk(o,l,r),u=new Wu(o,a,s),c=new Wu(l,a,s);r.iterGaps((f,d,h)=>kk(u,f,c,d,h,i)),r.empty&&r.length==0&&kk(u,0,c,0,0,i)}static eq(e,n,r=0,i){i==null&&(i=999999999);let s=e.filter(c=>!c.isEmpty&&n.indexOf(c)<0),o=n.filter(c=>!c.isEmpty&&e.indexOf(c)<0);if(s.length!=o.length)return!1;if(!s.length)return!0;let l=xk(s,o),a=new Wu(s,l,0).goto(r),u=new Wu(o,l,0).goto(r);for(;;){if(a.to!=u.to||!dy(a.active,u.active)||a.point&&(!u.point||!bw(a.point,u.point)))return!1;if(a.to>i)return!0;a.next(),u.next()}}static spans(e,n,r,i,s=-1){let o=new Wu(e,null,s).goto(n),l=n,a=o.openStart;for(;;){let u=Math.min(o.to,r);if(o.point){let c=o.activeForPoint(o.to),f=o.pointFroml&&(i.span(l,u,o.active,a),a=o.openEnd(u));if(o.to>r)return a+(o.point&&o.to>r?1:0);l=o.to,o.next()}}static of(e,n=!1){let r=new Ja;for(let i of e instanceof cy?[e]:n?IV(e):e)r.add(i.from,i.to,i.value);return r.finish()}static join(e){if(!e.length)return Gt.empty;let n=e[e.length-1];for(let r=e.length-2;r>=0;r--)for(let i=e[r];i!=Gt.empty;i=i.nextLayer)n=new Gt(i.chunkPos,i.chunk,n,Math.max(i.maxPoint,n.maxPoint));return n}}Gt.empty=new Gt([],[],null,-1);function IV(t){if(t.length>1)for(let e=t[0],n=1;n0)return t.slice().sort(fy);e=r}return t}Gt.empty.nextLayer=Gt.empty;class Ja{finishChunk(e){this.chunks.push(new xw(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,n,r){this.addInner(e,n,r)||(this.nextLayer||(this.nextLayer=new Ja)).add(e,n,r)}addInner(e,n,r){let i=e-this.lastTo||r.startSide-this.last.endSide;if(i<=0&&(e-this.lastFrom||r.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return i<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(n-this.chunkStart),this.last=r,this.lastFrom=e,this.lastTo=n,this.value.push(r),r.point&&(this.maxPoint=Math.max(this.maxPoint,n-e)),!0)}addChunk(e,n){if((e-this.lastTo||n.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,n.maxPoint),this.chunks.push(n),this.chunkPos.push(e);let r=n.value.length-1;return this.last=n.value[r],this.lastFrom=n.from[r]+e,this.lastTo=n.to[r]+e,!0}finish(){return this.finishInner(Gt.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let n=Gt.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,n}}function xk(t,e,n){let r=new Map;for(let s of t)for(let o=0;o=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex=r&&i.push(new xA(o,n,r,s));return i.length==1?i[0]:new Kc(i)}get startSide(){return this.value?this.value.startSide:0}goto(e,n=-1e9){for(let r of this.heap)r.goto(e,n);for(let r=this.heap.length>>1;r>=0;r--)wm(this.heap,r);return this.next(),this}forward(e,n){for(let r of this.heap)r.forward(e,n);for(let r=this.heap.length>>1;r>=0;r--)wm(this.heap,r);(this.to-e||this.value.endSide-n)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),wm(this.heap,0)}}}function wm(t,e){for(let n=t[e];;){let r=(e<<1)+1;if(r>=t.length)break;let i=t[r];if(r+1=0&&(i=t[r+1],r++),n.compare(i)<0)break;t[r]=n,t[e]=i,e=r}}class Wu{constructor(e,n,r){this.minPoint=r,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=Kc.from(e,n,r)}goto(e,n=-1e9){return this.cursor.goto(e,n),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=n,this.openStart=-1,this.next(),this}forward(e,n){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-n)<0;)this.removeActive(this.minActive);this.cursor.forward(e,n)}removeActive(e){dd(this.active,e),dd(this.activeTo,e),dd(this.activeRank,e),this.minActive=Sk(this.active,this.activeTo)}addActive(e){let n=0,{value:r,to:i,rank:s}=this.cursor;for(;n0;)n++;hd(this.active,n,r),hd(this.activeTo,n,i),hd(this.activeRank,n,s),e&&hd(e,n,this.cursor.from),this.minActive=Sk(this.active,this.activeTo)}next(){let e=this.to,n=this.point;this.point=null;let r=this.openStart<0?[]:null;for(;;){let i=this.minActive;if(i>-1&&(this.activeTo[i]-this.cursor.from||this.active[i].endSide-this.cursor.startSide)<0){if(this.activeTo[i]>e){this.to=this.activeTo[i],this.endSide=this.active[i].endSide;break}this.removeActive(i),r&&dd(r,i)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let s=this.cursor.value;if(!s.point)this.addActive(r),this.cursor.next();else if(n&&this.cursor.to==this.to&&this.cursor.from=0&&r[i]=0&&!(this.activeRank[r]e||this.activeTo[r]==e&&this.active[r].endSide>=this.point.endSide)&&n.push(this.active[r]);return n.reverse()}openEnd(e){let n=0;for(let r=this.activeTo.length-1;r>=0&&this.activeTo[r]>e;r--)n++;return n}}function kk(t,e,n,r,i,s){t.goto(e),n.goto(r);let o=r+i,l=r,a=r-e,u=!!s.boundChange;for(let c=!1;;){let f=t.to+a-n.to,d=f||t.endSide-n.endSide,h=d<0?t.to+a:n.to,p=Math.min(h,o);if(t.point||n.point?(t.point&&n.point&&bw(t.point,n.point)&&dy(t.activeForPoint(t.to),n.activeForPoint(n.to))||s.comparePoint(l,p,t.point,n.point),c=!1):(c&&s.boundChange(l),p>l&&!dy(t.active,n.active)&&s.compareRange(l,p,t.active,n.active),u&&po)break;l=h,d<=0&&t.next(),d>=0&&n.next()}}function dy(t,e){if(t.length!=e.length)return!1;for(let n=0;n=e;r--)t[r+1]=t[r];t[e]=n}function Sk(t,e){let n=-1,r=1e9;for(let i=0;i=e)return i;if(i==t.length)break;s+=t.charCodeAt(i)==9?n-s%n:1,i=vr(t,i)}return t.length}const hy="ͼ",Ck=typeof Symbol>"u"?"__"+hy:Symbol.for(hy),py=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),Tk=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class jo{constructor(e,n){this.rules=[];let{finish:r}=n||{};function i(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function s(o,l,a,u){let c=[],f=/^@(\w+)\b/.exec(o[0]),d=f&&f[1]=="keyframes";if(f&&l==null)return a.push(o[0]+";");for(let h in l){let p=l[h];if(/&/.test(h))s(h.split(/,\s*/).map(g=>o.map(b=>g.replace(/&/,b))).reduce((g,b)=>g.concat(b)),p,a);else if(p&&typeof p=="object"){if(!f)throw new RangeError("The value of a property ("+h+") should be a primitive value.");s(i(h),p,c,d)}else p!=null&&c.push(h.replace(/_.*/,"").replace(/[A-Z]/g,g=>"-"+g.toLowerCase())+": "+p+";")}(c.length||d)&&a.push((r&&!f&&!u?o.map(r):o).join(", ")+" {"+c.join(" ")+"}")}for(let o in e)s(i(o),e[o],this.rules)}getRules(){return this.rules.join(` -`)}static newName(){let e=Tk[Ck]||1;return Tk[Ck]=e+1,hy+e.toString(36)}static mount(e,n,r){let i=e[py],s=r&&r.nonce;i?s&&i.setNonce(s):i=new DV(e,s),i.mount(Array.isArray(n)?n:[n],e)}}let Ek=new Map;class DV{constructor(e,n){let r=e.ownerDocument||e,i=r.defaultView;if(!e.head&&e.adoptedStyleSheets&&i.CSSStyleSheet){let s=Ek.get(r);if(s)return e[py]=s;this.sheet=new i.CSSStyleSheet,Ek.set(r,this)}else this.styleTag=r.createElement("style"),n&&this.styleTag.setAttribute("nonce",n);this.modules=[],e[py]=this}mount(e,n){let r=this.sheet,i=0,s=0;for(let o=0;o-1&&(this.modules.splice(a,1),s--,a=-1),a==-1){if(this.modules.splice(s++,0,l),r)for(let u=0;u",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},LV=typeof navigator<"u"&&/Mac/.test(navigator.platform),$V=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var sr=0;sr<10;sr++)Ho[48+sr]=Ho[96+sr]=String(sr);for(var sr=1;sr<=24;sr++)Ho[sr+111]="F"+sr;for(var sr=65;sr<=90;sr++)Ho[sr]=String.fromCharCode(sr+32),Xc[sr]=String.fromCharCode(sr);for(var bm in Ho)Xc.hasOwnProperty(bm)||(Xc[bm]=Ho[bm]);function FV(t){var e=LV&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||$V&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?Xc:Ho)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}function ms(){var t=arguments[0];typeof t=="string"&&(t=document.createElement(t));var e=1,n=arguments[1];if(n&&typeof n=="object"&&n.nodeType==null&&!Array.isArray(n)){for(var r in n)if(Object.prototype.hasOwnProperty.call(n,r)){var i=n[r];typeof i=="string"?t.setAttribute(r,i):i!=null&&(t[r]=i)}e++}for(;e2);var Oe={mac:Rk||/Mac/.test(Er.platform),windows:/Win/.test(Er.platform),linux:/Linux|X11/.test(Er.platform),ie:Hp,ie_version:SA?gy.documentMode||6:yy?+yy[1]:my?+my[1]:0,gecko:Ak,gecko_version:Ak?+(/Firefox\/(\d+)/.exec(Er.userAgent)||[0,0])[1]:0,chrome:!!xm,chrome_version:xm?+xm[1]:0,ios:Rk,android:/Android\b/.test(Er.userAgent),webkit:Mk,webkit_version:Mk?+(/\bAppleWebKit\/(\d+)/.exec(Er.userAgent)||[0,0])[1]:0,safari:vy,safari_version:vy?+(/\bVersion\/(\d+(\.\d+)?)/.exec(Er.userAgent)||[0,0])[1]:0,tabSize:gy.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function kw(t,e){for(let n in t)n=="class"&&e.class?e.class+=" "+t.class:n=="style"&&e.style?e.style+=";"+t.style:e[n]=t[n];return e}const Vh=Object.create(null);function Sw(t,e,n){if(t==e)return!0;t||(t=Vh),e||(e=Vh);let r=Object.keys(t),i=Object.keys(e);if(r.length-0!=i.length-0)return!1;for(let s of r)if(s!=n&&(i.indexOf(s)==-1||t[s]!==e[s]))return!1;return!0}function zV(t,e){for(let n=t.attributes.length-1;n>=0;n--){let r=t.attributes[n].name;e[r]==null&&t.removeAttribute(r)}for(let n in e){let r=e[n];n=="style"?t.style.cssText=r:t.getAttribute(n)!=r&&t.setAttribute(n,r)}}function Ok(t,e,n){let r=!1;if(e)for(let i in e)n&&i in n||(r=!0,i=="style"?t.style.cssText="":t.removeAttribute(i));if(n)for(let i in n)e&&e[i]==n[i]||(r=!0,i=="style"?t.style.cssText=n[i]:t.setAttribute(i,n[i]));return r}function BV(t){let e=Object.create(null);for(let n=0;n0?3e8:-4e8:n>0?1e8:-1e8,new _l(e,n,n,r,e.widget||null,!1)}static replace(e){let n=!!e.block,r,i;if(e.isBlockGap)r=-5e8,i=4e8;else{let{start:s,end:o}=CA(e,n);r=(s?n?-3e8:-1:5e8)-1,i=(o?n?2e8:1:-6e8)+1}return new _l(e,r,i,n,e.widget||null,!0)}static line(e){return new vf(e)}static set(e,n=!1){return Gt.of(e,n)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}en.none=Gt.empty;class yf extends en{constructor(e){let{start:n,end:r}=CA(e);super(n?-1:5e8,r?1:-6e8,null,e),this.tagName=e.tagName||"span",this.attrs=e.class&&e.attributes?kw(e.attributes,{class:e.class}):e.class?{class:e.class}:e.attributes||Vh}eq(e){return this==e||e instanceof yf&&this.tagName==e.tagName&&Sw(this.attrs,e.attrs)}range(e,n=e){if(e>=n)throw new RangeError("Mark decorations may not be empty");return super.range(e,n)}}yf.prototype.point=!1;class vf extends en{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof vf&&this.spec.class==e.spec.class&&Sw(this.spec.attributes,e.spec.attributes)}range(e,n=e){if(n!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,n)}}vf.prototype.mapMode=Dr.TrackBefore;vf.prototype.point=!0;class _l extends en{constructor(e,n,r,i,s,o){super(n,r,s,e),this.block=i,this.isReplace=o,this.mapMode=i?n<=0?Dr.TrackBefore:Dr.TrackAfter:Dr.TrackDel}get type(){return this.startSide!=this.endSide?ki.WidgetRange:this.startSide<=0?ki.WidgetBefore:ki.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof _l&&jV(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,n=e){if(this.isReplace&&(e>n||e==n&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&n!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,n)}}_l.prototype.point=!0;function CA(t,e=!1){let{inclusiveStart:n,inclusiveEnd:r}=t;return n==null&&(n=t.inclusive),r==null&&(r=t.inclusive),{start:n??e,end:r??e}}function jV(t,e){return t==e||!!(t&&e&&t.compare(e))}function La(t,e,n,r=0){let i=n.length-1;i>=0&&n[i]+r>=t?n[i]=Math.max(n[i],e):n.push(t,e)}class Gc extends Il{constructor(e,n,r){super(),this.tagName=e,this.attributes=n,this.rank=r}eq(e){return e==this||e instanceof Gc&&this.tagName==e.tagName&&Sw(this.attributes,e.attributes)}static create(e){return new Gc(e.tagName,e.attributes||Vh,e.rank==null?50:Math.max(0,Math.min(e.rank,100)))}static set(e,n=!1){return Gt.of(e,n)}}Gc.prototype.startSide=Gc.prototype.endSide=-1;function qc(t){let e;return t.nodeType==11?e=t.getSelection?t:t.ownerDocument:e=t,e.getSelection()}function wy(t,e){return e?t==e||t.contains(e.nodeType!=1?e.parentNode:e):!1}function bc(t,e){if(!e.anchorNode)return!1;try{return wy(t,e.anchorNode)}catch{return!1}}function xc(t){return t.nodeType==3?Jc(t,0,t.nodeValue.length).getClientRects():t.nodeType==1?t.getClientRects():[]}function kc(t,e,n,r){return n?Pk(t,e,n,r,-1)||Pk(t,e,n,r,1):!1}function Wo(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e}function Uh(t){return t.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}function Pk(t,e,n,r,i){for(;;){if(t==n&&e==r)return!0;if(e==(i<0?0:qs(t))){if(t.nodeName=="DIV")return!1;let s=t.parentNode;if(!s||s.nodeType!=1)return!1;e=Wo(t)+(i<0?0:1),t=s}else if(t.nodeType==1){if(t=t.childNodes[e+(i<0?-1:0)],t.nodeType==1&&t.contentEditable=="false")return!1;e=i<0?qs(t):0}else return!1}}function qs(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Yc(t,e){let{left:n,right:r}=t;if(n==r)return t;let i=e?n:r;return{left:i,right:i,top:t.top,bottom:t.bottom}}function HV(t){let e=t.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}function TA(t,e){let n=e.width/t.offsetWidth,r=e.height/t.offsetHeight;return(n>.995&&n<1.005||!isFinite(n)||Math.abs(e.width-t.offsetWidth)<1)&&(n=1),(r>.995&&r<1.005||!isFinite(r)||Math.abs(e.height-t.offsetHeight)<1)&&(r=1),{scaleX:n,scaleY:r}}function WV(t,e,n,r,i,s,o,l){let a=t.ownerDocument,u=a.defaultView||window;for(let c=t,f=!1;c&&!f;)if(c.nodeType==1){let d,h=c==a.body,p=1,g=1;if(h)d=HV(u);else{if(/^(fixed|sticky)$/.test(getComputedStyle(c).position)&&(f=!0),c.scrollHeight<=c.clientHeight&&c.scrollWidth<=c.clientWidth){c=c.assignedSlot||c.parentNode;continue}let v=c.getBoundingClientRect();({scaleX:p,scaleY:g}=TA(c,v)),d={left:v.left,right:v.left+c.clientWidth*p,top:v.top,bottom:v.top+c.clientHeight*g}}let b=0,m=0;if(i=="nearest")e.top0&&e.bottom>d.bottom+m&&(m=e.bottom-d.bottom+o)):e.bottom>d.bottom-o&&(m=e.bottom-d.bottom+o,n<0&&e.top-m0&&e.right>d.right+b&&(b=e.right-d.right+s)):e.right>d.right-s&&(b=e.right-d.right+s,n<0&&e.leftd.bottom||e.leftd.right)&&(e={left:Math.max(e.left,d.left),right:Math.min(e.right,d.right),top:Math.max(e.top,d.top),bottom:Math.min(e.bottom,d.bottom)}),c=c.assignedSlot||c.parentNode}else if(c.nodeType==11)c=c.host;else break}function EA(t,e=!0){let n=t.ownerDocument,r=null,i=null;for(let s=t.parentNode;s&&!(s==n.body||(!e||r)&&i);)if(s.nodeType==1)!i&&s.scrollHeight>s.clientHeight&&(i=s),e&&!r&&s.scrollWidth>s.clientWidth&&(r=s),s=s.assignedSlot||s.parentNode;else if(s.nodeType==11)s=s.host;else break;return{x:r,y:i}}class VV{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:n,focusNode:r}=e;this.set(n,Math.min(e.anchorOffset,n?qs(n):0),r,Math.min(e.focusOffset,r?qs(r):0))}set(e,n,r,i){this.anchorNode=e,this.anchorOffset=n,this.focusNode=r,this.focusOffset=i}}function AA(t){let e=[];for(let n=t;n;n=n.nodeType==11?n.host:n.parentNode)n.nodeType==1&&e.push({node:n,left:n.scrollLeft,top:n.scrollTop});return e}function MA(t,e=!0){for(let{node:n,left:r,top:i}of t)e&&n.scrollTop!=i&&(n.scrollTop=i),n.scrollLeft!=r&&(n.scrollLeft=r)}let hl=null;Oe.safari&&Oe.safari_version>=26&&(hl=!1);function RA(t){if(t.setActive)return t.setActive();if(hl)return t.focus(hl);let e=AA(t);t.focus(hl==null?{get preventScroll(){return hl={preventScroll:!0},!0}}:void 0),hl||(hl=!1,MA(e))}let Nk;function Jc(t,e,n=e){let r=Nk||(Nk=document.createRange());return r.setEnd(t,n),r.setStart(t,e),r}function $a(t,e,n,r){let i={key:e,code:e,keyCode:n,which:n,cancelable:!0};r&&({altKey:i.altKey,ctrlKey:i.ctrlKey,shiftKey:i.shiftKey,metaKey:i.metaKey}=r);let s=new KeyboardEvent("keydown",i);s.synthetic=!0,t.dispatchEvent(s);let o=new KeyboardEvent("keyup",i);return o.synthetic=!0,t.dispatchEvent(o),s.defaultPrevented||o.defaultPrevented}function UV(t){for(;t;){if(t&&(t.nodeType==9||t.nodeType==11&&t.host))return t;t=t.assignedSlot||t.parentNode}return null}function KV(t,e){let n=e.focusNode,r=e.focusOffset;if(!n||e.anchorNode!=n||e.anchorOffset!=r)return!1;for(r=Math.min(r,qs(n));;)if(r){if(n.nodeType!=1)return!1;let i=n.childNodes[r-1];i.contentEditable=="false"?r--:(n=i,r=qs(n))}else{if(n==t)return!0;r=Wo(n),n=n.parentNode}}function OA(t){return t instanceof Window?t.pageYOffset>Math.max(0,t.document.documentElement.scrollHeight-t.innerHeight-4):t.scrollTop>Math.max(1,t.scrollHeight-t.clientHeight-4)}function PA(t,e){for(let n=t,r=e;;){if(n.nodeType==3&&r>0)return{node:n,offset:r};if(n.nodeType==1&&r>0){if(n.contentEditable=="false")return null;n=n.childNodes[r-1],r=qs(n)}else if(n.parentNode&&!Uh(n))r=Wo(n),n=n.parentNode;else return null}}function NA(t,e){for(let n=t,r=e;;){if(n.nodeType==3&&r=n){if(l.level==r)return o;(s<0||(i!=0?i<0?l.fromn:e[s].level>l.level))&&(s=o)}}if(s<0)throw new RangeError("Index out of range");return s}}function DA(t,e){if(t.length!=e.length)return!1;for(let n=0;n=0;g-=3)if(us[g+1]==-h){let b=us[g+2],m=b&2?i:b&4?b&1?s:i:0;m&&(sn[f]=sn[us[g]]=m),l=g;break}}else{if(us.length==189)break;us[l++]=f,us[l++]=d,us[l++]=a}else if((p=sn[f])==2||p==1){let g=p==i;a=g?0:1;for(let b=l-3;b>=0;b-=3){let m=us[b+2];if(m&2)break;if(g)us[b+2]|=2;else{if(m&4)break;us[b+2]|=4}}}}}function QV(t,e,n,r){for(let i=0,s=r;i<=n.length;i++){let o=i?n[i-1].to:t,l=ia;)p==b&&(p=n[--g].from,b=g?n[g-1].to:t),sn[--p]=h;a=c}else s=u,a++}}}function xy(t,e,n,r,i,s,o){let l=r%2?2:1;if(r%2==i%2)for(let a=e,u=0;aa&&o.push(new bs(a,g.from,h));let b=g.direction==Dl!=!(h%2);ky(t,b?r+1:r,i,g.inner,g.from,g.to,o),a=g.to}p=g.to}else{if(p==n||(c?sn[p]!=l:sn[p]==l))break;p++}d?xy(t,a,p,r+1,i,d,o):ae;){let c=!0,f=!1;if(!u||a>s[u-1].to){let g=sn[a-1];g!=l&&(c=!1,f=g==16)}let d=!c&&l==1?[]:null,h=c?r:r+1,p=a;e:for(;;)if(u&&p==s[u-1].to){if(f)break e;let g=s[--u];if(!c)for(let b=g.from,m=u;;){if(b==e)break e;if(m&&s[m-1].to==b)b=s[--m].from;else{if(sn[b-1]==l)break e;break}}if(d)d.push(g);else{g.tosn.length;)sn[sn.length]=256;let r=[],i=e==Dl?0:1;return ky(t,i,i,n,0,t.length,r),r}function LA(t){return[new bs(0,t,0)]}let $A="";function eU(t,e,n,r,i){var s;let o=r.head-t.from,l=bs.find(e,o,(s=r.bidiLevel)!==null&&s!==void 0?s:-1,r.assoc),a=e[l],u=a.side(i,n);if(o==u){let d=l+=i?1:-1;if(d<0||d>=e.length)return null;a=e[l=d],o=a.side(!i,n),u=a.side(i,n)}let c=vr(t.text,o,a.forward(i,n));(ca.to)&&(c=u),$A=t.text.slice(Math.min(o,c),Math.max(o,c));let f=l==(i?e.length-1:0)?null:e[l+(i?1:-1)];return f&&c==u&&f.level+(i?0:1)t.some(e=>e)}),nU=He.define({combine:t=>t.some(e=>e)}),UA=He.define();class Fa{constructor(e,n,r,i,s,o=!1){this.range=e,this.y=n,this.x=r,this.yMargin=i,this.xMargin=s,this.isSnapshot=o}map(e){return e.empty?this:new Fa(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new Fa(de.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const pd=on.define({map:(t,e)=>t.map(e)}),KA=on.define();function vi(t,e,n){let r=t.facet(jA);r.length?r[0](e):window.onerror&&window.onerror(String(e),n,void 0,void 0,e)||(n?console.error(n+":",e):console.error(e))}const zs=He.define({combine:t=>t.length?t[0]:!0});let rU=0;const Ca=He.define({combine(t){return t.filter((e,n)=>{for(let r=0;r{let a=[];return o&&a.push(Wp.of(u=>{let c=u.plugin(l);return c?o(c):en.none})),s&&a.push(s(l)),a})}static fromClass(e,n){return Ei.define((r,i)=>new e(r,i),n)}}class km{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(e){if(this.value){if(this.mustUpdate){let n=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(n)}catch(r){if(vi(n.state,r,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(e,this.spec.arg)}catch(n){vi(e.state,n,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var n;if(!((n=this.value)===null||n===void 0)&&n.destroy)try{this.value.destroy()}catch(r){vi(e.state,r,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const XA=He.define(),Aw=He.define(),Wp=He.define(),GA=He.define(),Mw=He.define(),wf=He.define(),qA=He.define();function Ik(t,e){let n=t.state.facet(qA);if(!n.length)return n;let r=n.map(s=>s instanceof Function?s(t):s),i=[];return Gt.spans(r,e.from,e.to,{point(){},span(s,o,l,a){let u=s-e.from,c=o-e.from,f=i;for(let d=l.length-1;d>=0;d--,a--){let h=l[d].spec.bidiIsolate,p;if(h==null&&(h=tU(e.text,u,c)),a>0&&f.length&&(p=f[f.length-1]).to==u&&p.direction==h)p.to=c,f=p.inner;else{let g={from:u,to:c,direction:h,inner:[]};f.push(g),f=g.inner}}}}),i}const YA=He.define();function Rw(t){let e=0,n=0,r=0,i=0;for(let s of t.state.facet(YA)){let o=s(t);o&&(o.left!=null&&(e=Math.max(e,o.left)),o.right!=null&&(n=Math.max(n,o.right)),o.top!=null&&(r=Math.max(r,o.top)),o.bottom!=null&&(i=Math.max(i,o.bottom)))}return{left:e,right:n,top:r,bottom:i}}const tc=He.define();class wi{constructor(e,n,r,i){this.fromA=e,this.toA=n,this.fromB=r,this.toB=i}join(e){return new wi(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let n=e.length,r=this;for(;n>0;n--){let i=e[n-1];if(!(i.fromA>r.toA)){if(i.toAi.push(new wi(s,o,l,a))),this.changedRanges=i}static create(e,n,r){return new Kh(e,n,r)}get viewportChanged(){return(this.flags&4)>0}get viewportMoved(){return(this.flags&8)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&18)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return this.flags==0&&this.transactions.length==0}}const iU=[];class On{constructor(e,n,r=0){this.dom=e,this.length=n,this.flags=r,this.parent=null,e.cmTile=this}get breakAfter(){return this.flags&1}get children(){return iU}isWidget(){return!1}get isHidden(){return!1}isComposite(){return!1}isLine(){return!1}isText(){return!1}isBlock(){return!1}get domAttrs(){return null}sync(e){if(this.flags|=2,this.flags&4){this.flags&=-5;let n=this.domAttrs;n&&zV(this.dom,n)}}toString(){return this.constructor.name+(this.children.length?`(${this.children})`:"")+(this.breakAfter?"#":"")}destroy(){this.parent=null}setDOM(e){this.dom=e,e.cmTile=this}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e,n=this.posAtStart){let r=n;for(let i of this.children){if(i==e)return r;r+=i.length+i.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}covers(e){return!0}coordsIn(e,n,r){return null}domPosFor(e,n){let r=Wo(this.dom),i=this.length?e>0:n>0;return new Ki(this.parent.dom,r+(i?1:0),e==0||e==this.length)}markDirty(e){this.flags&=-3,e&&(this.flags|=4),this.parent&&this.parent.flags&2&&this.parent.markDirty(!1)}get overrideDOMText(){return null}get root(){for(let e=this;e;e=e.parent)if(e instanceof Up)return e;return null}static get(e){return e.cmTile}}class Vp extends On{constructor(e){super(e,0),this._children=[]}isComposite(){return!0}get children(){return this._children}get lastChild(){return this.children.length?this.children[this.children.length-1]:null}append(e){this.children.push(e),e.parent=this}sync(e){if(this.flags&2)return;super.sync(e);let n=this.dom,r=null,i,s=(e==null?void 0:e.node)==n?e:null,o=0;for(let l of this.children){if(l.sync(e),o+=l.length+l.breakAfter,i=r?r.nextSibling:n.firstChild,s&&i!=l.dom&&(s.written=!0),l.dom.parentNode==n)for(;i&&i!=l.dom;)i=_k(i);else n.insertBefore(l.dom,i);r=l.dom}for(i=r?r.nextSibling:n.firstChild,s&&i&&(s.written=!0);i;)i=_k(i);this.length=o}}function _k(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class Up extends Vp{constructor(e,n){super(n),this.view=e}owns(e){for(;e;e=e.parent)if(e==this)return!0;return!1}isBlock(){return!0}nearest(e){for(;;){if(!e)return null;let n=On.get(e);if(n&&this.owns(n))return n;e=e.parentNode}}blockTiles(e){for(let n=[],r=this,i=0,s=0;;)if(i==r.children.length){if(!n.length)return;r=r.parent,r.breakAfter&&s++,i=n.pop()}else{let o=r.children[i++];if(o instanceof Vs)n.push(i),r=o,i=0;else{let l=s+o.length,a=e(o,s);if(a!==void 0)return a;s=l+o.breakAfter}}}resolveBlock(e,n){let r,i=-1,s,o=-1;if(this.blockTiles((l,a)=>{let u=a+l.length;if(e>=a&&e<=u){if(l.isWidget()&&n>=-1&&n<=1){if(l.flags&32)return!0;l.flags&16&&(r=void 0)}(ae||e==a&&(n>1?l.length:l.covers(-1)))&&(!s||!l.isWidget()&&s.isWidget())&&(s=l,o=e-a)}}),!r&&!s)throw new Error("No tile at position "+e);return r&&n<0||!s?{tile:r,offset:i}:{tile:s,offset:o}}}class Vs extends Vp{constructor(e,n){super(e),this.wrapper=n}isBlock(){return!0}covers(e){return this.children.length?e<0?this.children[0].covers(-1):this.lastChild.covers(1):!1}get domAttrs(){return this.wrapper.attributes}static of(e,n){let r=new Vs(n||document.createElement(e.tagName),e);return n||(r.flags|=4),r}}class Qa extends Vp{constructor(e,n){super(e),this.attrs=n}isLine(){return!0}static start(e,n,r){let i=new Qa(n||document.createElement("div"),e);return(!n||!r)&&(i.flags|=4),i}get domAttrs(){return this.attrs}resolveInline(e,n,r){let i=null,s=-1,o=null,l=-1;function a(c,f){for(let d=0,h=0;d=f&&(p.isComposite()?a(p,f-h):(!o||o.isHidden&&(n>0&&!(o.flags&32)||r&&oU(o,p)))&&(g>f||p.flags&32&&n<=1)?(o=p,l=f-h):(h=-1)&&(i=p,s=f-h)),h=g}}a(this,e);let u=(n<0?i:o)||i||o;return u?{tile:u,offset:u==i?s:l}:null}coordsIn(e,n,r){let i=this.resolveInline(e,n,!0);return i?i.tile.coordsIn(Math.max(0,i.offset),n,r):sU(this)}domIn(e,n){let r=this.resolveInline(e,n);if(r){let{tile:i,offset:s}=r;if(this.dom.contains(i.dom))return i.isText()?new Ki(i.dom,Math.min(i.dom.nodeValue.length,s)):i.domPosFor(s,i.flags&16?1:i.flags&32?-1:n);let o=r.tile.parent,l=!1;for(let a of o.children){if(l)return new Ki(a.dom,0);a==r.tile&&(l=!0)}}return new Ki(this.dom,0)}}function sU(t){let e=t.dom.lastChild;if(!e)return t.dom.getBoundingClientRect();let n=xc(e);return n[n.length-1]||null}function oU(t,e){let n=t.coordsIn(0,1),r=e.coordsIn(0,1);return n&&r&&r.topi&&(e=i);let s=e,o=e,l=0;e==0&&n<0||e==i&&n>=0?Oe.chrome||Oe.gecko||(e?(s--,l=1):o=0)?0:a.length-1];return Oe.safari&&!l&&u.width==0&&(u=Array.prototype.find.call(a,c=>c.width)||u),r==null?u:Yc(u,(l?l>0:n<0)==r)}static of(e,n){let r=new xl(n||document.createTextNode(e),e);return n||(r.flags|=2),r}}class Ll extends On{constructor(e,n,r,i){super(e,n,i),this.widget=r}isWidget(){return!0}get isHidden(){return this.widget.isHidden}covers(e){return this.flags&48?!1:(this.flags&(e<0?64:128))>0}coordsIn(e,n){return this.coordsInWidget(e,n,!1)}coordsInWidget(e,n,r){let i=this.widget.coordsAt(this.dom,e,n);if(i)return i;if(r)return Yc(this.dom.getBoundingClientRect(),this.length?e==0:n<=0);{let s=this.dom.getClientRects(),o=null;if(!s.length)return null;let l=this.flags&16?!0:this.flags&32?!1:e>0;for(let a=l?s.length-1:0;o=s[a],!(e>0?a==0:a==s.length-1||o.top0==r)}}class lU{constructor(e){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=e}advance(e,n,r){let{tile:i,index:s,beforeBreak:o,parents:l}=this;for(;e||n>0;)if(i.isComposite())if(o){if(!e)break;r&&r.break(),e--,o=!1}else if(s==i.children.length){if(!e&&!l.length)break;r&&r.leave(i),o=!!i.breakAfter,{tile:i,index:s}=l.pop(),s++}else{let a=i.children[s],u=a.breakAfter;(n>0?a.length<=e:a.length=0;l--){let a=n.marks[l],u=i.lastChild;if(u instanceof Lr&&u.mark.eq(a.mark))u.dom!=a.dom&&u.setDOM(Sm(a.dom)),i=u;else{if(this.cache.reused.get(a)){let f=On.get(a.dom);f&&f.setDOM(Sm(a.dom))}let c=Lr.of(a.mark,a.dom);i.append(c),i=c}this.cache.reused.set(a,2)}let s=On.get(e.text);s&&this.cache.reused.set(s,2);let o=new xl(e.text,e.text.nodeValue);o.flags|=8,this.pos=e.range.toB,i.append(o)}addInlineWidget(e,n,r){let i=this.afterWidget&&e.flags&48&&(this.afterWidget.flags&48)==(e.flags&48);i||this.flushBuffer();let s=this.ensureMarks(n,r);!i&&!(e.flags&16)&&s.append(this.getBuffer(1)),s.append(e),this.pos+=e.length,this.afterWidget=e}addMark(e,n,r){this.flushBuffer(),this.ensureMarks(n,r).append(e),this.pos+=e.length,this.afterWidget=null}addBlockWidget(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}continueWidget(e){let n=this.afterWidget||this.lastBlock;n.length+=e,this.pos+=e}addLineStart(e,n){var r;e||(e=JA);let i=Qa.start(e,n||((r=this.cache.find(Qa))===null||r===void 0?void 0:r.dom),!!n);this.getBlockPos().append(this.lastBlock=this.curLine=i)}addLine(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}addBreak(){this.lastBlock.flags|=1,this.endLine(),this.pos++}addLineStartIfNotCovered(e){this.blockPosCovered()||this.addLineStart(e)}ensureLine(e){this.curLine||this.addLineStart(e)}ensureMarks(e,n){var r;let i=this.curLine;for(let s=e.length-1;s>=0;s--){let o=e[s],l;if(n>0&&(l=i.lastChild)&&l instanceof Lr&&l.mark.eq(o))i=l,n--;else{let a=Lr.of(o,(r=this.cache.find(Lr,u=>u.mark.eq(o)))===null||r===void 0?void 0:r.dom);i.append(a),i=a,n=0}}return i}endLine(){if(this.curLine){this.flushBuffer();let e=this.curLine.lastChild;(!e||!Dk(this.curLine,!1)||e.dom.nodeName!="BR"&&e.isWidget()&&!(Oe.ios&&Dk(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(Cm,0,32)||new Ll(Cm.toDOM(),0,Cm,32)),this.curLine=this.afterWidget=null}}updateBlockWrappers(){this.wrapperPos>this.pos+1e4&&(this.blockWrappers.goto(this.pos),this.wrappers.length=0);for(let e=this.wrappers.length-1;e>=0;e--)this.wrappers[e].to=this.pos){let n=e.rank*102+e.value.rank,r=new aU(e.from,e.to,e.value,n),i=this.wrappers.length;for(;i>0&&(this.wrappers[i-1].rank-r.rank||this.wrappers[i-1].to-r.to)<0;)i--;this.wrappers.splice(i,0,r)}this.wrapperPos=this.pos}getBlockPos(){var e;this.updateBlockWrappers();let n=this.root;for(let r of this.wrappers){let i=n.lastChild;if(r.fromo.wrapper.eq(r.wrapper)))===null||e===void 0?void 0:e.dom);n.append(s),n=s}}return n}blockPosCovered(){let e=this.lastBlock;return e!=null&&!e.breakAfter&&(!e.isWidget()||(e.flags&160)>0)}getBuffer(e){let n=2|(e<0?16:32),r=this.cache.find(Xh,void 0,1);return r&&(r.flags=n),r||new Xh(n)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}}class cU{constructor(e){this.skipCount=0,this.text="",this.textOff=0,this.cursor=e.iter()}skip(e){this.textOff+e<=this.text.length?this.textOff+=e:(this.skipCount+=e-(this.text.length-this.textOff),this.text="",this.textOff=0)}next(e){if(this.textOff==this.text.length){let{value:i,lineBreak:s,done:o}=this.cursor.next(this.skipCount);if(this.skipCount=0,o)throw new Error("Ran out of text content when drawing inline views");this.text=i;let l=this.textOff=Math.min(e,i.length);return s?null:i.slice(0,l)}let n=Math.min(this.text.length,this.textOff+e),r=this.text.slice(this.textOff,n);return this.textOff=n,r}}const Gh=[Ll,Qa,xl,Lr,Xh,Vs,Up];for(let t=0;t[]),this.index=Gh.map(()=>0),this.reused=new Map}add(e){let n=e.constructor.bucket,r=this.buckets[n];r.length<6?r.push(e):r[this.index[n]=(this.index[n]+1)%6]=e}find(e,n,r=2){let i=e.bucket,s=this.buckets[i],o=this.index[i];for(let l=0;l{if(this.cache.add(o),o.isComposite())return!1},enter:o=>this.cache.add(o),leave:()=>{},break:()=>{}}}run(e,n){let r=n&&this.getCompositionContext(n.text);for(let i=0,s=0,o=0;;){let l=oi){let u=a-i;this.preserve(u,!o,!l),i=a,s+=u}if(!l)break;n&&l.fromA<=n.range.fromA&&l.toA>=n.range.toA?(this.forward(l.fromA,n.range.fromA,n.range.fromA{if(o.isWidget())if(this.openWidget)this.builder.continueWidget(a-l);else{let u=a>0||l{o.isLine()?this.builder.addLineStart(o.attrs,this.cache.maybeReuse(o)):(this.cache.add(o),o instanceof Lr&&i.unshift(o.mark)),this.openWidget=!1},leave:o=>{o.isLine()?i.length&&(i.length=s=0):o instanceof Lr&&(i.shift(),s=Math.min(s,i.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(e)}emit(e,n){let r=null,i=this.builder,s=-1,o=Gt.spans(this.decorations,e,n,{point:(l,a,u,c,f,d)=>{if(u instanceof _l){if(this.disallowBlockEffectsFor[d]){if(u.block)throw new RangeError("Block decorations may not be specified via plugins");if(a>this.view.state.doc.lineAt(l).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}if(s=c.length,f>c.length)i.continueWidget(a-l);else{let h=u.widget||(u.block?Za.block:Za.inline),p=hU(u),g=this.cache.findWidget(h,a-l,p)||Ll.of(h,this.view,a-l,p);u.block?(u.startSide>0&&i.addLineStartIfNotCovered(r),i.addBlockWidget(g)):(i.ensureLine(r),i.addInlineWidget(g,c,f))}r=null}else r=pU(r,u);a>l&&this.text.skip(a-l)},span:(l,a,u,c)=>{for(let f=l;f-1&&(this.openWidget=o>s),this.openWidget||i.addLineStartIfNotCovered(r),this.openMarks=o}forward(e,n,r=1){n-e<=10?this.old.advance(n-e,r,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(n-e-10,-1),this.old.advance(5,r,this.reuseWalker))}getCompositionContext(e){let n=[],r=null;for(let i=e.parentNode;;i=i.parentNode){let s=On.get(i);if(i==this.view.contentDOM)break;s instanceof Lr?n.push(s):s!=null&&s.isLine()?r=s:s instanceof Vs||(i.nodeName=="DIV"&&!r&&i!=this.view.contentDOM?r=new Qa(i,JA):r||n.push(Lr.of(new yf({tagName:i.nodeName.toLowerCase(),attributes:BV(i)}),i)))}return{line:r,marks:n}}}function Dk(t,e){let n=r=>{for(let i of r.children)if((e?i.isText():i.length)||n(i))return!0;return!1};return n(t)}function hU(t){let e=t.isReplace?(t.startSide<0?64:0)|(t.endSide>0?128:0):t.startSide>0?32:16;return t.block&&(e|=256),e}const JA={class:"cm-line"};function pU(t,e){let n=e.spec.attributes,r=e.spec.class;return!n&&!r||(t||(t={class:"cm-line"}),n&&kw(n,t),r&&(t.class+=" "+r)),t}function gU(t){let e=[];for(let n=t.parents.length;n>1;n--){let r=n==t.parents.length?t.tile:t.parents[n].tile;r instanceof Lr&&e.push(r.mark)}return e}function Sm(t){let e=On.get(t);return e&&e.setDOM(t.cloneNode()),t}class Za extends gu{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}Za.inline=new Za("span");Za.block=new Za("div");const Cm=new class extends gu{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}};class Lk{constructor(e){this.view=e,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=en.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.updateDeco(),this.tile=new Up(e,e.contentDOM),this.updateInner([new wi(0,0,0,e.state.doc.length)],null)}update(e){var n;let r=e.changedRanges;this.minWidth>0&&r.length&&(r.every(({fromA:c,toA:f})=>fthis.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let i=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((n=this.domChanged)===null||n===void 0)&&n.newSel?i=this.domChanged.newSel.head:!CU(e.changes,this.hasComposition)&&!e.selectionSet&&(i=e.state.selection.main.head));let s=i>-1?yU(this.view,e.changes,i):null;if(this.domChanged=null,this.hasComposition){let{from:c,to:f}=this.hasComposition;r=new wi(c,f,e.changes.mapPos(c,-1),e.changes.mapPos(f,1)).addToSet(r.slice())}this.hasComposition=s?{from:s.range.fromB,to:s.range.toB}:null,(Oe.ie||Oe.chrome)&&!s&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,l=this.blockWrappers;this.updateDeco();let a=bU(o,this.decorations,e.changes);a.length&&(r=wi.extendWithRanges(r,a));let u=kU(l,this.blockWrappers,e.changes);return u.length&&(r=wi.extendWithRanges(r,u)),s&&!r.some(c=>c.fromA<=s.range.fromA&&c.toA>=s.range.toA)&&(r=s.range.addToSet(r.slice())),this.tile.flags&2&&r.length==0?!1:(this.updateInner(r,s),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,n){this.view.viewState.mustMeasureContent=!0;let{observer:r}=this.view;r.ignore(()=>{if(n||e.length){let o=this.tile,l=new dU(this.view,o,this.blockWrappers,this.decorations,this.dynamicDecorationMap);n&&On.get(n.text)&&l.cache.reused.set(On.get(n.text),2),this.tile=l.run(e,n),Cy(o,l.cache.reused)}this.tile.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.tile.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let s=Oe.chrome||Oe.ios?{node:r.selectionRange.focusNode,written:!1}:void 0;this.tile.sync(s),s&&(s.written||r.selectionRange.focusNode!=s.node||!this.tile.dom.contains(s.node))&&(this.forceSelection=!0),this.tile.dom.style.height=""});let i=[];if(this.view.viewport.from||this.view.viewport.to-1)&&bc(r,this.view.observer.selectionRange)&&!(i&&r.contains(i));if(!(s||n||o))return;let l=this.forceSelection;this.forceSelection=!1;let a=this.view.state.selection.main,u,c;if(a.empty?c=u=this.inlineDOMNearPos(a.anchor,a.assoc||1):(c=this.inlineDOMNearPos(a.head,a.head==a.from?1:-1),u=this.inlineDOMNearPos(a.anchor,a.anchor==a.from?1:-1)),Oe.gecko&&a.empty&&!this.hasComposition&&mU(u)){let d=document.createTextNode("");this.view.observer.ignore(()=>u.node.insertBefore(d,u.node.childNodes[u.offset]||null)),u=c=new Ki(d,0),l=!0}let f=this.view.observer.selectionRange;(l||!f.focusNode||(!kc(u.node,u.offset,f.anchorNode,f.anchorOffset)||!kc(c.node,c.offset,f.focusNode,f.focusOffset))&&!this.suppressWidgetCursorChange(f,a))&&(this.view.observer.ignore(()=>{Oe.android&&Oe.chrome&&r.contains(f.focusNode)&&SU(f.focusNode,r)&&(r.blur(),r.focus({preventScroll:!0}));let d=qc(this.view.root);if(d)if(a.empty){if(Oe.gecko){let h=vU(u.node,u.offset);if(h&&h!=3){let p=(h==1?PA:NA)(u.node,u.offset);p&&(u=new Ki(p.node,p.offset))}}d.collapse(u.node,u.offset),a.bidiLevel!=null&&d.caretBidiLevel!==void 0&&(d.caretBidiLevel=a.bidiLevel)}else if(d.extend){d.collapse(u.node,u.offset);try{d.extend(c.node,c.offset)}catch{}}else{let h=document.createRange();a.anchor>a.head&&([u,c]=[c,u]),h.setEnd(c.node,c.offset),h.setStart(u.node,u.offset),d.removeAllRanges(),d.addRange(h)}o&&this.view.root.activeElement==r&&(r.blur(),i&&i.focus())}),this.view.observer.setSelectionRange(u,c)),this.impreciseAnchor=u.precise?null:new Ki(f.anchorNode,f.anchorOffset),this.impreciseHead=c.precise?null:new Ki(f.focusNode,f.focusOffset)}suppressWidgetCursorChange(e,n){return this.hasComposition&&n.empty&&kc(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==n.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,n=e.state.selection.main,r=qc(e.root),{anchorNode:i,anchorOffset:s}=e.observer.selectionRange;if(!r||!n.empty||!n.assoc||!r.modify)return;let o=this.lineAt(n.head,n.assoc);if(!o)return;let l=o.posAtStart;if(n.head==l||n.head==l+o.length)return;let a=this.coordsAt(n.head,-1),u=this.coordsAt(n.head,1);if(!a||!u||a.bottom>u.top)return;let c=this.domAtPos(n.head+n.assoc,n.assoc);r.collapse(c.node,c.offset),r.modify("move",n.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let f=e.observer.selectionRange;e.docView.posFromDOM(f.anchorNode,f.anchorOffset)!=n.from&&r.collapse(i,s)}posFromDOM(e,n){let r=this.tile.nearest(e);if(!r)return this.tile.dom.compareDocumentPosition(e)&2?0:this.view.state.doc.length;let i=r.posAtStart;if(r.isComposite()){let s;if(e==r.dom)s=r.dom.childNodes[n];else{let o=qs(e)==0?0:n==0?-1:1;for(;;){let l=e.parentNode;if(l==r.dom)break;o==0&&l.firstChild!=l.lastChild&&(e==l.firstChild?o=-1:o=1),e=l}o<0?s=e:s=e.nextSibling}if(s==r.dom.firstChild)return i;for(;s&&!On.get(s);)s=s.nextSibling;if(!s)return i+r.length;for(let o=0,l=i;;o++){let a=r.children[o];if(a.dom==s)return l;l+=a.length+a.breakAfter}}else return r.isText()?e==r.dom?i+n:i+(n?r.length:0):i}domAtPos(e,n){let{tile:r,offset:i}=this.tile.resolveBlock(e,n);return r.isWidget()?r.domPosFor(i,n):r.domIn(i,n)}inlineDOMNearPos(e,n){let r,i=-1,s=!1,o,l=-1,a=!1;return this.tile.blockTiles((u,c)=>{if(u.isWidget()){if(u.flags&32&&c>=e)return!0;u.flags&16&&(s=!0)}else{let f=c+u.length;if(c<=e&&(r=u,i=e-c,s=f=e&&!o&&(o=u,l=e-c,a=c>e),c>e&&o)return!0}}),!r&&!o?this.domAtPos(e,n):(s&&o?r=null:a&&r&&(o=null),r&&n<0||!o?r.domIn(i,n):o.domIn(l,n))}coordsAt(e,n,r){let{tile:i,offset:s}=this.tile.resolveBlock(e,n);return i.isWidget()?i.widget instanceof Tm?null:i.coordsInWidget(s,n,!0):i.coordsIn(s,n,r)}lineAt(e,n){let{tile:r}=this.tile.resolveBlock(e,n);return r.isLine()?r:null}coordsForChar(e){let{tile:n,offset:r}=this.tile.resolveBlock(e,1);if(!n.isLine())return null;function i(s,o){if(s.isComposite())for(let l of s.children){if(l.length>=o){let a=i(l,o);if(a)return a}if(o-=l.length,o<0)break}else if(s.isText()&&oMath.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,l=-1,a=this.view.textDirection==Rn.LTR,u=0,c=(f,d,h)=>{for(let p=0;pi);p++){let g=f.children[p],b=d+g.length,m=g.dom.getBoundingClientRect(),{height:v}=m;if(h&&!p&&(u+=m.top-h.top),g instanceof Vs)b>r&&c(g,d,m);else if(d>=r&&(u>0&&n.push(-u),n.push(v+u),u=0,o)){let w=g.dom.lastChild,k=w?xc(w):[];if(k.length){let x=k[k.length-1],C=a?x.right-m.left:m.right-x.left;C>l&&(l=C,this.minWidth=s,this.minWidthFrom=d,this.minWidthTo=b)}}h&&p==f.children.length-1&&(u+=h.bottom-m.bottom),d=b+g.breakAfter}};return c(this.tile,0,null),n}textDirectionAt(e){let{tile:n}=this.tile.resolveBlock(e,1);return getComputedStyle(n.dom).direction=="rtl"?Rn.RTL:Rn.LTR}measureTextSize(){let e=this.tile.blockTiles(o=>{if(o.isLine()&&o.children.length&&o.length<=20){let l=0,a;for(let u of o.children){if(!u.isText()||/[^ -~]/.test(u.text))return;let c=xc(u.dom);if(c.length!=1)return;l+=c[0].width,a=c[0].height}if(l)return{lineHeight:o.dom.getBoundingClientRect().height,charWidth:l/o.length,textHeight:a}}});if(e)return e;let n=document.createElement("div"),r,i,s;return n.className="cm-line",n.style.width="99999px",n.style.position="absolute",n.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.tile.dom.appendChild(n);let o=xc(n.firstChild)[0];r=n.getBoundingClientRect().height,i=o&&o.width?o.width/27:7,s=o&&o.height?o.height:r,n.remove()}),{lineHeight:r,charWidth:i,textHeight:s}}computeBlockGapDeco(){let e=[],n=this.view.viewState;for(let r=0,i=0;;i++){let s=i==n.viewports.length?null:n.viewports[i],o=s?s.from-1:this.view.state.doc.length;if(o>r){let l=(n.lineBlockAt(o).bottom-n.lineBlockAt(r).top)/this.view.scaleY;e.push(en.replace({widget:new Tm(l),block:!0,inclusive:!0,isBlockGap:!0}).range(r,o))}if(!s)break;r=s.to+1}return en.set(e)}updateDeco(){let e=1,n=this.view.state.facet(Wp).map(s=>(this.dynamicDecorationMap[e++]=typeof s=="function")?s(this.view):s),r=!1,i=this.view.state.facet(Mw).map((s,o)=>{let l=typeof s=="function";return l&&(r=!0),l?s(this.view):s});for(i.length&&(this.dynamicDecorationMap[e++]=r,n.push(Gt.join(i))),this.decorations=[this.editContextFormatting,...n,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];etypeof s=="function"?s(this.view):s)}scrollIntoView(e){if(e.isSnapshot){let u=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=u.top-e.yMargin,this.view.scrollDOM.scrollLeft=e.xMargin;return}for(let u of this.view.state.facet(UA))try{if(u(this.view,e.range,e))return!0}catch(c){vi(this.view.state,c,"scroll handler")}let{range:n}=e,r=this.coordsAt(n.head,n.assoc||(n.head>n.anchor?-1:1)),i;if(!r)return;!n.empty&&(i=this.coordsAt(n.anchor,n.anchor>n.head?-1:1))&&(r={left:Math.min(r.left,i.left),top:Math.min(r.top,i.top),right:Math.max(r.right,i.right),bottom:Math.max(r.bottom,i.bottom)});let s=Rw(this.view),o={left:r.left-s.left,top:r.top-s.top,right:r.right+s.right,bottom:r.bottom+s.bottom},{offsetWidth:l,offsetHeight:a}=this.view.scrollDOM;if(WV(this.view.scrollDOM,o,n.head1&&(r.top>window.visualViewport.offsetTop+window.visualViewport.height||r.bottomr.isWidget()||r.children.some(n);return n(this.tile.resolveBlock(e,1).tile)}destroy(){Cy(this.tile)}}function Cy(t,e){let n=e==null?void 0:e.get(t);if(n!=1){n==null&&t.destroy();for(let r of t.children)Cy(r,e)}}function mU(t){return t.node.nodeType==1&&t.node.firstChild&&(t.offset==0||t.node.childNodes[t.offset-1].contentEditable=="false")&&(t.offset==t.node.childNodes.length||t.node.childNodes[t.offset].contentEditable=="false")}function QA(t,e){let n=t.observer.selectionRange;if(!n.focusNode)return null;let r=PA(n.focusNode,n.focusOffset),i=NA(n.focusNode,n.focusOffset),s=r||i;if(i&&r&&i.node!=r.node){let l=On.get(i.node);if(!l||l.isText()&&l.text!=i.node.nodeValue)s=i;else if(t.docView.lastCompositionAfterCursor){let a=On.get(r.node);!a||a.isText()&&a.text!=r.node.nodeValue||(s=i)}}if(t.docView.lastCompositionAfterCursor=s!=r,!s)return null;let o=e-s.offset;return{from:o,to:o+s.node.nodeValue.length,node:s.node}}function yU(t,e,n){let r=QA(t,n);if(!r)return null;let{node:i,from:s,to:o}=r,l=i.nodeValue;if(/[\n\r]/.test(l)||t.state.doc.sliceString(r.from,r.to)!=l)return null;let a=e.invertedDesc;return{range:new wi(a.mapPos(s),a.mapPos(o),s,o),text:i}}function vU(t,e){return t.nodeType!=1?0:(e&&t.childNodes[e-1].contentEditable=="false"?1:0)|(e{re.from&&(n=!0)}),n}class Tm extends gu{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return e.className="cm-gap",this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}function TU(t,e,n=1){let r=t.charCategorizer(e),i=t.doc.lineAt(e),s=e-i.from;if(i.length==0)return de.cursor(e);s==0?n=1:s==i.length&&(n=-1);let o=s,l=s;n<0?o=vr(i.text,s,!1):l=vr(i.text,s);let a=r(i.text.slice(o,l));for(;o>0;){let u=vr(i.text,o,!1);if(r(i.text.slice(u,o))!=a)break;o=u}for(;lt.defaultLineHeight*1.5){let l=t.viewState.heightOracle.textHeight,a=Math.floor((i-n.top-(t.defaultLineHeight-l)*.5)/l);s+=a*t.viewState.heightOracle.lineLength}let o=t.state.sliceDoc(n.from,n.to);return n.from+_V(o,s,t.state.tabSize)}function AU(t,e,n){let r=t.lineBlockAt(e);if(Array.isArray(r.type)){let i;for(let s of r.type){if(s.from>e)break;if(!(s.toe)return s;(!i||s.type==ki.Text&&(i.type!=s.type||(n<0?s.frome)))&&(i=s)}}return i||r}return r}function MU(t,e,n,r){let i=AU(t,e.head,e.assoc||-1),s=!r||i.type!=ki.Text||!(t.lineWrapping||i.widgetLineBreaks)?null:t.coordsAtPos(e.assoc<0&&e.head>i.from?e.head-1:e.head);if(s){let o=t.dom.getBoundingClientRect(),l=t.textDirectionAt(i.from),a=t.posAtCoords({x:n==(l==Rn.LTR)?o.right-1:o.left+1,y:(s.top+s.bottom)/2});if(a!=null)return de.cursor(a,n?-1:1)}return de.cursor(n?i.to:i.from,n?-1:1)}function $k(t,e,n,r){let i=t.state.doc.lineAt(e.head),s=t.bidiSpans(i),o=t.textDirectionAt(i.from);for(let l=e,a=null;;){let u=eU(i,s,o,l,n),c=$A;if(!u){if(i.number==(n?t.state.doc.lines:1))return l;c=` -`,i=t.state.doc.line(i.number+(n?1:-1)),s=t.bidiSpans(i),u=t.visualLineSide(i,!n)}if(a){if(!a(c))return l}else{if(!r)return u;a=r(c)}l=u}}function RU(t,e,n){let r=t.state.charCategorizer(e),i=r(n);return s=>{let o=r(s);return i==Hs.Space&&(i=o),i==o}}function OU(t,e,n,r){let i=e.head,s=n?1:-1;if(i==(n?t.state.doc.length:0))return de.cursor(i,e.assoc);let o=e.goalColumn,l,a=t.contentDOM.getBoundingClientRect(),u=t.coordsAtPos(i,e.assoc||((e.empty?n:e.head==e.from)?1:-1)),c=t.documentTop;if(u)o==null&&(o=u.left-a.left),l=s<0?u.top:u.bottom;else{let p=t.viewState.lineBlockAt(i);o==null&&(o=Math.min(a.right-a.left,t.defaultCharacterWidth*(i-p.from))),l=(s<0?p.top:p.bottom)+c}let f=a.left+o,d=t.viewState.heightOracle.textHeight>>1,h=r??d;for(let p=0;;p+=d){let g=l+(h+p)*s,b=Ty(t,{x:f,y:g},!1,s);if(n?g>a.bottom:gl:v{if(e>s&&ei(t)),n.from,e.head>n.from?-1:1);return r==n.from?n:de.cursor(r,rt.viewState.docHeight)return new ys(t.state.doc.length,-1);if(u=t.elementAtHeight(a),r==null)break;if(u.type==ki.Text){if(r<0?u.tot.viewport.to)break;let d=t.docView.coordsAt(r<0?u.from:u.to,r>0?-1:1);if(d&&(r<0?d.top<=a+s:d.bottom>=a+s))break}let f=t.viewState.heightOracle.textHeight/2;a=r>0?u.bottom+f:u.top-f}if(t.viewport.from>=u.to||t.viewport.to<=u.from){if(n)return null;if(u.type==ki.Text){let f=EU(t,i,u,o,l);return new ys(f,f==u.from?1:-1)}}if(u.type!=ki.Text)return a<(u.top+u.bottom)/2?new ys(u.from,1):new ys(u.to,-1);let c=t.docView.lineAt(u.from,2);return(!c||c.length!=u.length)&&(c=t.docView.lineAt(u.from,-2)),new PU(t,o,l,t.textDirectionAt(u.from)).scanTile(c,u.from)}class PU{constructor(e,n,r,i){this.view=e,this.x=n,this.y=r,this.baseDir=i,this.line=null,this.spans=null}bidiSpansAt(e){return(!this.line||this.line.from>e||this.line.to1||r.length&&(r[0].level!=this.baseDir||r[0].to+i.from>1;t:if(o.has(g)){for(let v=1;v=s&&(w-=p),!o.has(w)){g=w;break t}}break e}o.add(g);let b=n(g),m=0;if(b)for(let v=0;v1))if(w.bottomthis.y)(!u||u.top>w.top)&&(u=w),m=-1;else{let k=w.left>this.x?this.x-w.left:w.right(p+p+g)/3)return this.y=a.bottom-1,this.scan(e,n,!0);if(u&&u.top<(p+g+g)/3)return this.y=u.top+1,this.scan(e,n,!0)}let h=(l?this.dirAt(e[c],1):this.baseDir)==Rn.LTR;return{i:c,after:this.x>(d.left+d.right)/2==h}}scanText(e,n){let r=[];for(let s=0;s{let o=r[s]-n,l=r[s+1]-n;return Jc(e.dom,o,l).getClientRects()});return i.after?new ys(r[i.i+1],-1):new ys(r[i.i],1)}scanTile(e,n){if(!e.length)return new ys(n,1);if(e.children.length==1){let l=e.children[0];if(l.isText())return this.scanText(l,n);if(l.isComposite())return this.scanTile(l,n)}let r=[n];for(let l=0,a=n;l{let a=e.children[l];return a.flags&48?null:(a.dom.nodeType==1?a.dom:Jc(a.dom,0,a.length)).getClientRects()}),s=e.children[i.i],o=r[i.i];return s.isText()?this.scanText(s,o):s.isComposite()?this.scanTile(s,o):i.after?new ys(r[i.i+1],-1):new ys(o,1)}}const aa="￿";class NU{constructor(e,n){this.points=e,this.view=n,this.text="",this.lineSeparator=n.state.facet(zt.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=aa}readRange(e,n){if(!e)return this;let r=e.parentNode;for(let i=e;;){this.findPointBefore(r,i);let s=this.text.length;this.readNode(i);let o=On.get(i),l=i.nextSibling;if(l==n){o!=null&&o.breakAfter&&!l&&r!=this.view.contentDOM&&this.lineBreak();break}let a=On.get(l);(o&&a?o.breakAfter:(o?o.breakAfter:Uh(i))||Uh(l)&&(i.nodeName!="BR"||o!=null&&o.isWidget())&&this.text.length>s)&&!_U(l,n)&&this.lineBreak(),i=l}return this.findPointBefore(r,n),this}readTextNode(e){let n=e.nodeValue;for(let r of this.points)r.node==e&&(r.pos=this.text.length+Math.min(r.offset,n.length));for(let r=0,i=this.lineSeparator?null:/\r\n?|\n/g;;){let s=-1,o=1,l;if(this.lineSeparator?(s=n.indexOf(this.lineSeparator,r),o=this.lineSeparator.length):(l=i.exec(n))&&(s=l.index,o=l[0].length),this.append(n.slice(r,s<0?n.length:s)),s<0)break;if(this.lineBreak(),o>1)for(let a of this.points)a.node==e&&a.pos>this.text.length&&(a.pos-=o-1);r=s+o}}readNode(e){let n=On.get(e),r=n&&n.overrideDOMText;if(r!=null){this.findPointInside(e,r.length);for(let i=r.iter();!i.next().done;)i.lineBreak?this.lineBreak():this.append(i.value)}else e.nodeType==3?this.readTextNode(e):e.nodeName=="BR"?e.nextSibling&&this.lineBreak():e.nodeType==1&&this.readRange(e.firstChild,null)}findPointBefore(e,n){for(let r of this.points)r.node==e&&e.childNodes[r.offset]==n&&(r.pos=this.text.length)}findPointInside(e,n){for(let r of this.points)(e.nodeType==3?r.node==e:e.contains(r.node))&&(r.pos=this.text.length+(IU(e,r.node,r.offset)?n:0))}}function IU(t,e,n){for(;;){if(!e||n-1;let{impreciseHead:s,impreciseAnchor:o}=e.docView,l=e.state.selection;if(e.state.readOnly&&n>-1)this.newSel=null;else if(n>-1&&(this.bounds=eM(e.docView.tile,n,r,0))){let a=s||o?[]:$U(e),u=new NU(a,e);u.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=u.text,this.newSel=FU(a,this.bounds.from)}else{let a=e.observer.selectionRange,u=s&&s.node==a.focusNode&&s.offset==a.focusOffset||!wy(e.contentDOM,a.focusNode)?l.main.head:e.docView.posFromDOM(a.focusNode,a.focusOffset),c=o&&o.node==a.anchorNode&&o.offset==a.anchorOffset||!wy(e.contentDOM,a.anchorNode)?l.main.anchor:e.docView.posFromDOM(a.anchorNode,a.anchorOffset),f=e.viewport;if((Oe.ios||Oe.chrome)&&u!=c&&Math.min(u,c)<=l.main.from&&Math.max(u,c)>=l.main.to&&(f.from>0||f.to-1&&l.ranges.length>1)this.newSel=l.replaceRange(de.range(c,u));else if(e.lineWrapping&&c==u&&!(l.main.empty&&l.main.head==u)&&e.inputState.lastTouchTime>Date.now()-100){let d=e.coordsAtPos(u,-1),h=0;d&&(h=e.inputState.lastTouchY<=d.bottom?-1:1),this.newSel=de.create([de.cursor(u,h)])}else this.newSel=de.single(c,u)}}}function eM(t,e,n,r){if(t.isComposite()){let i=-1,s=-1,o=-1,l=-1;for(let a=0,u=r,c=r;an)return eM(f,e,n,u);if(d>=e&&i==-1&&(i=a,s=u),u>n&&f.dom.parentNode==t.dom){o=a,l=c;break}c=d,u=d+f.breakAfter}return{from:s,to:l<0?r+t.length:l,startDOM:(i?t.children[i-1].dom.nextSibling:null)||t.dom.firstChild,endDOM:o=0?t.children[o].dom:null}}else return t.isText()?{from:r,to:r+t.length,startDOM:t.dom,endDOM:t.dom.nextSibling}:null}function tM(t,e){let n,{newSel:r}=e,{state:i}=t,s=i.selection.main,o=t.inputState.lastKeyTime>Date.now()-100?t.inputState.lastKeyCode:-1;if(e.bounds){let{from:l,to:a}=e.bounds,u=s.from,c=null;(o===8||Oe.android&&e.text.length=l&&s.to<=a&&(e.typeOver||f!=e.text)&&f.slice(0,s.from-l)==e.text.slice(0,s.from-l)&&f.slice(s.to-l)==e.text.slice(d=e.text.length-(f.length-(s.to-l)))?n={from:s.from,to:s.to,insert:_t.of(e.text.slice(s.from-l,d).split(aa))}:(h=nM(f,e.text,u-l,c))&&(Oe.chrome&&o==13&&h.toB==h.from+2&&e.text.slice(h.from,h.toB)==aa+aa&&h.toB--,n={from:l+h.from,to:l+h.toA,insert:_t.of(e.text.slice(h.from,h.toB).split(aa))})}else r&&(!t.hasFocus&&i.facet(zs)||qh(r,s))&&(r=null);if(!n&&!r)return!1;if((Oe.mac||Oe.android)&&n&&n.from==n.to&&n.from==s.head-1&&/^\. ?$/.test(n.insert.toString())&&t.contentDOM.getAttribute("autocorrect")=="off"?(r&&n.insert.length==2&&(r=de.single(r.main.anchor-1,r.main.head-1)),n={from:n.from,to:n.to,insert:_t.of([n.insert.toString().replace("."," ")])}):i.doc.lineAt(s.from).toDate.now()-50?n={from:s.from,to:s.to,insert:i.toText(t.inputState.insertingText)}:Oe.chrome&&n&&n.from==n.to&&n.from==s.head&&n.insert.toString()==` - `&&t.lineWrapping&&(r&&(r=de.single(r.main.anchor-1,r.main.head-1)),n={from:s.from,to:s.to,insert:_t.of([" "])}),n)return Ow(t,n,r,o);if(r&&!qh(r,s)){let l=!1,a="select";return t.inputState.lastSelectionTime>Date.now()-50&&(t.inputState.lastSelectionOrigin=="select"&&(l=!0),a=t.inputState.lastSelectionOrigin,a=="select.pointer"&&(r=ZA(i.facet(wf).map(u=>u(t)),r))),t.dispatch({selection:r,scrollIntoView:l,userEvent:a}),!0}else return!1}function Ow(t,e,n,r=-1){if(Oe.ios&&t.inputState.flushIOSKey(e))return!0;let i=t.state.selection.main;if(Oe.android&&(e.to==i.to&&(e.from==i.from||e.from==i.from-1&&t.state.sliceDoc(e.from,i.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&$a(t.contentDOM,"Enter",13)||(e.from==i.from-1&&e.to==i.to&&e.insert.length==0||r==8&&e.insert.lengthi.head)&&$a(t.contentDOM,"Backspace",8)||e.from==i.from&&e.to==i.to+1&&e.insert.length==0&&$a(t.contentDOM,"Delete",46)))return!0;let s=e.insert.toString();t.inputState.composing>=0&&t.inputState.composing++;let o,l=()=>o||(o=LU(t,e,n));return t.state.facet(HA).some(a=>a(t,e.from,e.to,s,l))||t.dispatch(l()),!0}function LU(t,e,n){let r,i=t.state,s=i.selection.main,o=-1;if(e.from==e.to&&e.froms.to){let a=e.fromf(t)),u,a);e.from==c&&(o=c)}if(o>-1)r={changes:e,selection:de.cursor(e.from+e.insert.length,-1)};else if(e.from>=s.from&&e.to<=s.to&&e.to-e.from>=(s.to-s.from)/3&&(!n||n.main.empty&&n.main.from==e.from+e.insert.length)&&t.inputState.composing<0){let a=s.frome.to?i.sliceDoc(e.to,s.to):"";r=i.replaceSelection(t.state.toText(a+e.insert.sliceString(0,void 0,t.state.lineBreak)+u))}else{let a=i.changes(e),u=n&&n.main.to<=a.newLength?n.main:void 0;if(i.selection.ranges.length>1&&(t.inputState.composing>=0||t.inputState.compositionPendingChange)&&e.to<=s.to+10&&e.to>=s.to-10){let c=t.state.sliceDoc(e.from,e.to),f,d=n&&QA(t,n.main.head);if(d){let p=e.insert.length-(e.to-e.from);f={from:d.from,to:d.to-p}}else f=t.state.doc.lineAt(s.head);let h=s.to-e.to;r=i.changeByRange(p=>{if(p.from==s.from&&p.to==s.to)return{changes:a,range:u||p.map(a)};let g=p.to-h,b=g-c.length;if(t.state.sliceDoc(b,g)!=c||g>=f.from&&b<=f.to)return{range:p};let m=i.changes({from:b,to:g,insert:e.insert}),v=p.to-s.to;return{changes:m,range:u?de.range(Math.max(0,u.anchor+v),Math.max(0,u.head+v)):p.map(m)}})}else r={changes:a,selection:u&&i.selection.replaceRange(u)}}let l="input.type";return(t.composing||t.inputState.compositionPendingChange&&t.inputState.compositionEndedAt>Date.now()-50)&&(t.inputState.compositionPendingChange=!1,l+=".compose",t.inputState.compositionFirstChange&&(l+=".start",t.inputState.compositionFirstChange=!1)),i.update(r,{userEvent:l,scrollIntoView:!0})}function nM(t,e,n,r){let i=Math.min(t.length,e.length),s=0;for(;s0&&l>0&&t.charCodeAt(o-1)==e.charCodeAt(l-1);)o--,l--;if(r=="end"){let a=Math.max(0,s-Math.min(o,l));n-=o+a-s}if(o=o?s-n:0;s-=a,l=s+(l-o),o=s}else if(l=l?s-n:0;s-=a,o=s+(o-l),l=s}return{from:s,toA:o,toB:l}}function $U(t){let e=[];if(t.root.activeElement!=t.contentDOM)return e;let{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:s}=t.observer.selectionRange;return n&&(e.push(new Fk(n,r)),(i!=n||s!=r)&&e.push(new Fk(i,s))),e}function FU(t,e){if(t.length==0)return null;let n=t[0].pos,r=t.length==2?t[1].pos:n;return n>-1&&r>-1?de.single(n+e,r+e):null}function qh(t,e){return e.head==t.main.head&&e.anchor==t.main.anchor}class zU{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.touchActive=!1,this.lastTouchTime=0,this.lastTouchX=0,this.lastTouchY=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.lastWheelEvent=0,this.pendingIOSKey=void 0,this.lastIOSMomentumScroll=0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,Oe.safari&&e.contentDOM.addEventListener("input",()=>null),Oe.gecko&&t7(e.contentDOM.ownerDocument)}handleEvent(e){!GU(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e))}runHandlers(e,n){let r=this.handlers[e];if(r){for(let i of r.observers)i(this.view,n);for(let i of r.handlers){if(n.defaultPrevented)break;if(i(this.view,n)){n.preventDefault();break}}}}ensureHandlers(e){let n=jU(e),r=this.handlers,i=this.view.contentDOM;for(let s in n)if(s!="scroll"){let o=!n[s].handlers.length,l=r[s];l&&o!=!l.handlers.length&&(i.removeEventListener(s,this.handleEvent),l=null),l||i.addEventListener(s,this.handleEvent,{passive:o})}for(let s in r)s!="scroll"&&!n[s]&&i.removeEventListener(s,this.handleEvent);this.handlers=n}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&e.keyCode!=27&&iM.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),Oe.android&&Oe.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;if(Oe.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&(rM.some(n=>n.keyCode==e.keyCode)&&!e.ctrlKey||HU.indexOf(e.key)>-1&&e.ctrlKey)){let n={ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey,shiftKey:e.shiftKey};return n.shiftKey&&Oe.ios&&!/^(off|none)$/.test(this.view.contentDOM.autocapitalize)&&BU(this.view.win)&&(n.shiftKey=!1),this.pendingIOSKey={key:e.key,keyCode:e.keyCode,mods:n},setTimeout(()=>this.flushIOSKey(),250),!0}return e.keyCode!=229&&this.view.observer.forceFlush(),!1}flushIOSKey(e){let n=this.pendingIOSKey;return!n||n.key=="Enter"&&e&&e.from0?!0:Oe.safari&&!Oe.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function BU(t){return t.visualViewport?t.visualViewport.height*t.visualViewport.scale/t.document.documentElement.clientHeight<.85:!1}function zk(t,e){return(n,r)=>{try{return e.call(t,r,n)}catch(i){vi(n.state,i)}}}function jU(t){let e=Object.create(null);function n(r){return e[r]||(e[r]={observers:[],handlers:[]})}for(let r of t){let i=r.spec,s=i&&i.plugin.domEventHandlers,o=i&&i.plugin.domEventObservers;if(s)for(let l in s){let a=s[l];a&&n(l).handlers.push(zk(r.value,a))}if(o)for(let l in o){let a=o[l];a&&n(l).observers.push(zk(r.value,a))}}for(let r in Zi)n(r).handlers.push(Zi[r]);for(let r in Rr)n(r).observers.push(Rr[r]);return e}const rM=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],HU="dthko",iM=[16,17,18,20,91,92,224,225],gd=6;function md(t){return Math.max(0,t)*.7+8}function WU(t,e){return Math.max(Math.abs(t.clientX-e.clientX),Math.abs(t.clientY-e.clientY))}class VU{constructor(e,n,r,i){this.view=e,this.startEvent=n,this.style=r,this.mustSelect=i,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=n,this.scrollParents=EA(e.contentDOM),this.atoms=e.state.facet(wf).map(o=>o(e));let s=e.contentDOM.ownerDocument;s.addEventListener("mousemove",this.move=this.move.bind(this)),s.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=n.shiftKey,this.multiple=e.state.facet(zt.allowMultipleSelections)&&UU(e,n),this.dragging=XU(e,n)&&lM(n)==1?null:!1}start(e){this.dragging===!1&&this.select(e)}move(e){if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&WU(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let n=0,r=0,i=0,s=0,o=this.view.win.innerWidth,l=this.view.win.innerHeight;this.scrollParents.x&&({left:i,right:o}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:s,bottom:l}=this.scrollParents.y.getBoundingClientRect());let a=Rw(this.view);e.clientX-a.left<=i+gd?n=-md(i-e.clientX):e.clientX+a.right>=o-gd&&(n=md(e.clientX-o)),e.clientY-a.top<=s+gd?r=-md(s-e.clientY):e.clientY+a.bottom>=l-gd&&(r=md(e.clientY-l)),this.setScrollSpeed(n,r)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,n){this.scrollSpeed={x:e,y:n},e||n?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:n}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),n&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=n,n=0),(e||n)&&this.view.win.scrollBy(e,n),this.dragging===!1&&this.select(this.lastEvent)}select(e){let{view:n}=this,r=ZA(this.atoms,this.style.get(e,this.extend,this.multiple));(this.mustSelect||!r.eq(n.state.selection,this.dragging===!1))&&this.view.dispatch({selection:r,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(n=>n.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function UU(t,e){let n=t.state.facet(FA);return n.length?n[0](e):Oe.mac?e.metaKey:e.ctrlKey}function KU(t,e){let n=t.state.facet(zA);return n.length?n[0](e):Oe.mac?!e.altKey:!e.ctrlKey}function XU(t,e){let{main:n}=t.state.selection;if(n.empty)return!1;let r=qc(t.root);if(!r||r.rangeCount==0)return!0;let i=r.getRangeAt(0).getClientRects();for(let s=0;s=e.clientX&&o.top<=e.clientY&&o.bottom>=e.clientY)return!0}return!1}function GU(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target,r;n!=t.contentDOM;n=n.parentNode)if(!n||n.nodeType==11||(r=On.get(n))&&r.isWidget()&&!r.isHidden&&r.widget.ignoreEvent(e))return!1;return!0}const Zi=Object.create(null),Rr=Object.create(null),sM=Oe.ie&&Oe.ie_version<15||Oe.ios&&Oe.webkit_version<604;function qU(t){let e=t.dom.parentNode;if(!e)return;let n=e.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus(),setTimeout(()=>{t.focus(),n.remove(),oM(t,n.value)},50)}function Kp(t,e,n){for(let r of t.facet(e))n=r(n,t);return n}function oM(t,e){e=Kp(t.state,Tw,e);let{state:n}=t,r,i=1,s=n.toText(e),o=s.lines==n.selection.ranges.length;if(Ey!=null&&n.selection.ranges.every(a=>a.empty)&&Ey==s.toString()){let a=-1;r=n.changeByRange(u=>{let c=n.doc.lineAt(u.from);if(c.from==a)return{range:u};a=c.from;let f=n.toText((o?s.line(i++).text:e)+n.lineBreak);return{changes:{from:c.from,insert:f},range:de.cursor(u.from+f.length)}})}else o?r=n.changeByRange(a=>{let u=s.line(i++);return{changes:{from:a.from,to:a.to,insert:u.text},range:de.cursor(a.from+u.length)}}):r=n.replaceSelection(s);t.dispatch(r,{userEvent:"input.paste",scrollIntoView:!0})}Rr.scroll=t=>{let e=t.inputState;e.lastScrollTop=t.scrollDOM.scrollTop,e.lastScrollLeft=t.scrollDOM.scrollLeft,Oe.ios&&!e.touchActive&&(e.lastIOSMomentumScroll=Date.now())};Rr.wheel=Rr.mousewheel=t=>{t.inputState.lastWheelEvent=Date.now()};Zi.keydown=(t,e)=>(t.inputState.setSelectionOrigin("select"),e.keyCode==27&&t.inputState.tabFocusMode!=0&&(t.inputState.tabFocusMode=Date.now()+2e3),!1);Rr.touchstart=(t,e)=>{let n=t.inputState,r=e.targetTouches[0];n.touchActive=!0,n.lastTouchTime=Date.now(),r&&(n.lastTouchX=r.clientX,n.lastTouchY=r.clientY),n.setSelectionOrigin("select.pointer")};Rr.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")};Rr.touchend=(t,e)=>{t.inputState.touchActive=!1};Zi.mousedown=(t,e)=>{if(t.observer.flush(),t.inputState.lastTouchTime>Date.now()-2e3)return!1;let n=null;for(let r of t.state.facet(BA))if(n=r(t,e),n)break;if(!n&&e.button==0&&(n=JU(t,e)),n){let r=!t.hasFocus;t.inputState.startMouseSelection(new VU(t,e,n,r)),r&&t.observer.ignore(()=>{RA(t.contentDOM);let s=t.root.activeElement;s&&!s.contains(t.contentDOM)&&s.blur()});let i=t.inputState.mouseSelection;if(i)return i.start(e),i.dragging===!1}else t.inputState.setSelectionOrigin("select.pointer");return!1};function Bk(t,e,n,r){if(r==1)return de.cursor(e,n);if(r==2)return TU(t.state,e,n);{let i=t.docView.lineAt(e,n),s=t.state.doc.lineAt(i?i.posAtEnd:e),o=i?i.posAtStart:s.from,l=i?i.posAtEnd:s.to;return lDate.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(Hk+1)%3:1}function JU(t,e){let n=t.posAndSideAtCoords({x:e.clientX,y:e.clientY},!1),r=lM(e),i=t.state.selection;return{update(s){s.docChanged&&(n.pos=s.changes.mapPos(n.pos),i=i.map(s.changes))},get(s,o,l){let a=t.posAndSideAtCoords({x:s.clientX,y:s.clientY},!1),u,c=Bk(t,a.pos,a.assoc,r);if(n.pos!=a.pos&&!o){let f=Bk(t,n.pos,n.assoc,r),d=Math.min(f.from,c.from),h=Math.max(f.to,c.to);c=d1&&(u=QU(i,a.pos))?u:l?i.addRange(c):de.create([c])}}}function QU(t,e){for(let n=0;n=e)return de.create(t.ranges.slice(0,n).concat(t.ranges.slice(n+1)),t.mainIndex==n?0:t.mainIndex-(t.mainIndex>n?1:0))}return null}Zi.dragstart=(t,e)=>{let{selection:{main:n}}=t.state;if(e.target.draggable){let i=t.docView.tile.nearest(e.target);if(i&&i.isWidget()){let s=i.posAtStart,o=s+i.length;(s>=n.to||o<=n.from)&&(n=de.undirectionalRange(s,o))}}let{inputState:r}=t;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=n,e.dataTransfer&&(e.dataTransfer.setData("Text",Kp(t.state,Ew,t.state.sliceDoc(n.from,n.to))),e.dataTransfer.effectAllowed="copyMove"),!1};Zi.dragend=t=>(t.inputState.draggedContent=null,!1);function Vk(t,e,n,r){if(n=Kp(t.state,Tw,n),!n)return;let i=t.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:s}=t.inputState,o=r&&s&&KU(t,e)?{from:s.from,to:s.to}:null,l={from:i,insert:n},a=t.state.changes(o?[o,l]:l);t.focus(),t.dispatch({changes:a,selection:{anchor:a.mapPos(i,-1),head:a.mapPos(i,1)},userEvent:o?"move.drop":"input.drop"}),t.inputState.draggedContent=null}Zi.drop=(t,e)=>{if(!e.dataTransfer)return!1;if(t.state.readOnly)return!0;let n=e.dataTransfer.files;if(n&&n.length){let r=Array(n.length),i=0,s=()=>{++i==n.length&&Vk(t,e,r.filter(o=>o!=null).join(t.state.lineBreak),!1)};for(let o=0;o{/[\x00-\x08\x0e-\x1f]{2}/.test(l.result)||(r[o]=l.result),s()},l.readAsText(n[o])}return!0}else{let r=e.dataTransfer.getData("Text");if(r)return Vk(t,e,r,!0),!0}return!1};Zi.paste=(t,e)=>{if(t.state.readOnly)return!0;t.observer.flush();let n=sM?null:e.clipboardData;return n?(oM(t,n.getData("text/plain")||n.getData("text/uri-list")),!0):(qU(t),!1)};function ZU(t,e){let n=t.dom.parentNode;if(!n)return;let r=n.appendChild(document.createElement("textarea"));r.style.cssText="position: fixed; left: -10000px; top: 10px",r.value=e,r.focus(),r.selectionEnd=e.length,r.selectionStart=0,setTimeout(()=>{r.remove(),t.focus()},50)}function e7(t){let e=[],n=[],r=!1;for(let i of t.selection.ranges)i.empty||(e.push(t.sliceDoc(i.from,i.to)),n.push(i));if(!e.length){let i=-1;for(let{from:s}of t.selection.ranges){let o=t.doc.lineAt(s);o.number>i&&(e.push(o.text),n.push({from:o.from,to:Math.min(t.doc.length,o.to+1)})),i=o.number}r=!0}return{text:Kp(t,Ew,e.join(t.lineBreak)),ranges:n,linewise:r}}let Ey=null;Zi.copy=Zi.cut=(t,e)=>{if(!bc(t.contentDOM,t.observer.selectionRange))return!1;let{text:n,ranges:r,linewise:i}=e7(t.state);if(!n&&!i)return!1;Ey=i?n:null,e.type=="cut"&&!t.state.readOnly&&t.dispatch({changes:r,scrollIntoView:!0,userEvent:"delete.cut"});let s=sM?null:e.clipboardData;return s?(s.clearData(),s.setData("text/plain",n),!0):(ZU(t,n),!1)};const aM=qo.define();function uM(t,e){let n=[];for(let r of t.facet(WA)){let i=r(t,e);i&&n.push(i)}return n.length?t.update({effects:n,annotations:aM.of(!0)}):null}function cM(t){setTimeout(()=>{let e=t.hasFocus;if(e!=t.inputState.notifiedFocused){let n=uM(t.state,e);n?t.dispatch(n):t.update([])}},10)}Rr.focus=t=>{t.inputState.lastFocusTime=Date.now(),!t.scrollDOM.scrollTop&&(t.inputState.lastScrollTop||t.inputState.lastScrollLeft)&&(t.scrollDOM.scrollTop=t.inputState.lastScrollTop,t.scrollDOM.scrollLeft=t.inputState.lastScrollLeft),cM(t)};Rr.blur=t=>{t.observer.clearSelectionRange(),cM(t)};Rr.compositionstart=Rr.compositionupdate=t=>{t.observer.editContext||(t.inputState.compositionFirstChange==null&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0))};Rr.compositionend=t=>{t.observer.editContext||(t.inputState.composing=-1,t.inputState.compositionEndedAt=Date.now(),t.inputState.compositionPendingKey=!0,t.inputState.compositionPendingChange=t.observer.pendingRecords().length>0,t.inputState.compositionFirstChange=null,Oe.chrome&&Oe.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then(()=>t.observer.flush()):setTimeout(()=>{t.inputState.composing<0&&t.docView.hasComposition&&t.update([])},50))};Rr.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()};Zi.beforeinput=(t,e)=>{var n,r;if((e.inputType=="insertText"||e.inputType=="insertCompositionText")&&(t.inputState.insertingText=e.data,t.inputState.insertingTextAt=Date.now()),e.inputType=="insertReplacementText"&&t.observer.editContext){let s=(n=e.dataTransfer)===null||n===void 0?void 0:n.getData("text/plain"),o=e.getTargetRanges();if(s&&o.length){let l=o[0],a=t.posAtDOM(l.startContainer,l.startOffset),u=t.posAtDOM(l.endContainer,l.endOffset);return Ow(t,{from:a,to:u,insert:t.state.toText(s)},null),!0}}let i;if(Oe.chrome&&Oe.android&&(i=rM.find(s=>s.inputType==e.inputType))&&(t.observer.delayAndroidKey(i.key,i.keyCode),i.key=="Backspace"||i.key=="Delete")){let s=((r=window.visualViewport)===null||r===void 0?void 0:r.height)||0;setTimeout(()=>{var o;(((o=window.visualViewport)===null||o===void 0?void 0:o.height)||0)>s+10&&t.hasFocus&&(t.contentDOM.blur(),t.focus())},100)}return Oe.ios&&e.inputType=="deleteContentForward"&&t.observer.flushSoon(),Oe.safari&&e.inputType=="insertText"&&t.inputState.composing>=0&&setTimeout(()=>Rr.compositionend(t,e),20),!1};const Uk=new Set;function t7(t){Uk.has(t)||(Uk.add(t),t.addEventListener("copy",()=>{}),t.addEventListener("cut",()=>{}))}const Kk=["pre-wrap","normal","pre-line","break-spaces"];let eu=!1;function Xk(){eu=!1}class n7{constructor(e){this.lineWrapping=e,this.doc=_t.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,n){let r=this.doc.lineAt(n).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(r+=Math.max(0,Math.ceil((n-e-r*this.lineLength*.5)/this.lineLength))),this.lineHeight*r}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return Kk.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let n=!1;for(let r=0;r-1,a=Math.abs(n-this.lineHeight)>.3||this.lineWrapping!=l;if(this.lineWrapping=l,this.lineHeight=n,this.charWidth=r,this.textHeight=i,this.lineLength=s,a){this.heightSamples={};for(let u=0;u0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>Jd&&(eu=!0),this.height=e)}replace(e,n,r){return Mr.of(r)}decomposeLeft(e,n){n.push(this)}decomposeRight(e,n){n.push(this)}applyChanges(e,n,r,i){let s=this,o=r.doc;for(let l=i.length-1;l>=0;l--){let{fromA:a,toA:u,fromB:c,toB:f}=i[l],d=s.lineAt(a,cn.ByPosNoHeight,r.setDoc(n),0,0),h=d.to>=u?d:s.lineAt(u,cn.ByPosNoHeight,r,0,0);for(f+=h.to-u,u=h.to;l>0&&d.from<=i[l-1].toA;)a=i[l-1].fromA,c=i[l-1].fromB,l--,as*2){let l=e[n-1];l.break?e.splice(--n,1,l.left,null,l.right):e.splice(--n,1,l.left,l.right),r+=1+l.break,i-=l.size}else if(s>i*2){let l=e[r];l.break?e.splice(r,1,l.left,null,l.right):e.splice(r,1,l.left,l.right),r+=2+l.break,s-=l.size}else break;else if(i=s&&o(this.lineAt(0,cn.ByPos,r,i,s))}setMeasuredHeight(e){let n=e.heights[e.index++];n<0?(this.spaceAbove=-n,n=e.heights[e.index++]):this.spaceAbove=0,this.setHeight(n)}updateHeight(e,n=0,r=!1,i){return i&&i.from<=n&&i.more&&this.setMeasuredHeight(i),this.outdated=!1,this}toString(){return`block(${this.length})`}}class Qr extends fM{constructor(e,n,r){super(e,n,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=r}mainBlock(e,n){return new Ui(n,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(e,n,r){let i=r[0];return r.length==1&&(i instanceof Qr||i instanceof ir&&i.flags&4)&&Math.abs(this.length-i.length)<10?(i instanceof ir?i=new Qr(i.length,this.height,this.spaceAbove):i.height=this.height,this.outdated||(i.outdated=!1),i):Mr.of(r)}updateHeight(e,n=0,r=!1,i){return i&&i.from<=n&&i.more?this.setMeasuredHeight(i):(r||this.outdated)&&(this.spaceAbove=0,this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight)),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class ir extends Mr{constructor(e){super(e,0)}heightMetrics(e,n){let r=e.doc.lineAt(n).number,i=e.doc.lineAt(n+this.length).number,s=i-r+1,o,l=0;if(e.lineWrapping){let a=Math.min(this.height,e.lineHeight*s);o=a/s,this.length>s+1&&(l=(this.height-a)/(this.length-s-1))}else o=this.height/s;return{firstLine:r,lastLine:i,perLine:o,perChar:l}}blockAt(e,n,r,i){let{firstLine:s,lastLine:o,perLine:l,perChar:a}=this.heightMetrics(n,i);if(n.lineWrapping){let u=i+(e0){let s=r[r.length-1];s instanceof ir?r[r.length-1]=new ir(s.length+i):r.push(null,new ir(i-1))}if(e>0){let s=r[0];s instanceof ir?r[0]=new ir(e+s.length):r.unshift(new ir(e-1),null)}return Mr.of(r)}decomposeLeft(e,n){n.push(new ir(e-1),null)}decomposeRight(e,n){n.push(null,new ir(this.length-e-1))}updateHeight(e,n=0,r=!1,i){let s=n+this.length;if(i&&i.from<=n+this.length&&i.more){let o=[],l=Math.max(n,i.from),a=-1;for(i.from>n&&o.push(new ir(i.from-n-1).updateHeight(e,n));l<=s&&i.more;){let c=e.doc.lineAt(l).length;o.length&&o.push(null);let f=i.heights[i.index++],d=0;f<0&&(d=-f,f=i.heights[i.index++]),a==-1?a=f:Math.abs(f-a)>=Jd&&(a=-2);let h=new Qr(c,f,d);h.outdated=!1,o.push(h),l+=c+1}l<=s&&o.push(null,new ir(s-l).updateHeight(e,l));let u=Mr.of(o);return(a<0||Math.abs(u.height-this.height)>=Jd||Math.abs(a-this.heightMetrics(e,n).perLine)>=Jd)&&(eu=!0),Yh(this,u)}else(r||this.outdated)&&(this.setHeight(e.heightForGap(n,n+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class s7 extends Mr{constructor(e,n,r){super(e.length+n+r.length,e.height+r.height,n|(e.outdated||r.outdated?2:0)),this.left=e,this.right=r,this.size=e.size+r.size}get break(){return this.flags&1}blockAt(e,n,r,i){let s=r+this.left.height;return el))return u;let c=n==cn.ByPosNoHeight?cn.ByPosNoHeight:cn.ByPos;return a?u.join(this.right.lineAt(l,c,r,o,l)):this.left.lineAt(l,c,r,i,s).join(u)}forEachLine(e,n,r,i,s,o){let l=i+this.left.height,a=s+this.left.length+this.break;if(this.break)e=a&&this.right.forEachLine(e,n,r,l,a,o);else{let u=this.lineAt(a,cn.ByPos,r,i,s);e=e&&u.from<=n&&o(u),n>u.to&&this.right.forEachLine(u.to+1,n,r,l,a,o)}}replace(e,n,r){let i=this.left.length+this.break;if(nthis.left.length)return this.balanced(this.left,this.right.replace(e-i,n-i,r));let s=[];e>0&&this.decomposeLeft(e,s);let o=s.length;for(let l of r)s.push(l);if(e>0&&Gk(s,o-1),n=r&&n.push(null)),e>r&&this.right.decomposeLeft(e-r,n)}decomposeRight(e,n){let r=this.left.length,i=r+this.break;if(e>=i)return this.right.decomposeRight(e-i,n);e2*n.size||n.size>2*e.size?Mr.of(this.break?[e,null,n]:[e,n]):(this.left=Yh(this.left,e),this.right=Yh(this.right,n),this.setHeight(e.height+n.height),this.outdated=e.outdated||n.outdated,this.size=e.size+n.size,this.length=e.length+this.break+n.length,this)}updateHeight(e,n=0,r=!1,i){let{left:s,right:o}=this,l=n+s.length+this.break,a=null;return i&&i.from<=n+s.length&&i.more?a=s=s.updateHeight(e,n,r,i):s.updateHeight(e,n,r),i&&i.from<=l+o.length&&i.more?a=o=o.updateHeight(e,l,r,i):o.updateHeight(e,l,r),a?this.balanced(s,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function Gk(t,e){let n,r;t[e]==null&&(n=t[e-1])instanceof ir&&(r=t[e+1])instanceof ir&&t.splice(e-1,3,new ir(n.length+1+r.length))}const o7=5;class Pw{constructor(e,n){this.pos=e,this.oracle=n,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,n){if(this.lineStart>-1){let r=Math.min(n,this.lineEnd),i=this.nodes[this.nodes.length-1];i instanceof Qr?i.length+=r-this.pos:(r>this.pos||!this.isCovered)&&this.nodes.push(new Qr(r-this.pos,-1,0)),this.writtenTo=r,n>r&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=n}point(e,n,r){if(e=o7)&&this.addLineDeco(i,s,o)}else n>e&&this.span(e,n);this.lineEnd>-1&&this.lineEnd-1)return;let{from:e,to:n}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=n,this.writtenToe&&this.nodes.push(new Qr(this.pos-e,-1,0)),this.writtenTo=this.pos}blankContent(e,n){let r=new ir(n-e);return this.oracle.doc.lineAt(e).to==n&&(r.flags|=4),r}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof Qr)return e;let n=new Qr(0,-1,0);return this.nodes.push(n),n}addBlock(e){this.enterLine();let n=e.deco;n&&n.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,n&&n.endSide>0&&(this.covering=e)}addLineDeco(e,n,r){let i=this.ensureLine();i.length+=r,i.collapsed+=r,i.widgetHeight=Math.max(i.widgetHeight,e),i.breaks+=n,this.writtenTo=this.pos=this.pos+r}finish(e){let n=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(n instanceof Qr)&&!this.isCovered?this.nodes.push(new Qr(0,-1,0)):(this.writtenToc.clientHeight||c.scrollWidth>c.clientWidth)&&f.overflow!="visible"){let d=c.getBoundingClientRect();s=Math.max(s,d.left),o=Math.min(o,d.right),l=Math.max(l,d.top),a=Math.min(u==t.parentNode?i.innerHeight:a,d.bottom)}u=f.position=="absolute"||f.position=="fixed"?c.offsetParent:c.parentNode}else if(u.nodeType==11)u=u.host;else break;return{left:s-n.left,right:Math.max(s,o)-n.left,top:l-(n.top+e),bottom:Math.max(l,a)-(n.top+e)}}function c7(t){let e=t.getBoundingClientRect(),n=t.ownerDocument.defaultView||window;return e.left0&&e.top0}function f7(t,e){let n=t.getBoundingClientRect();return{left:0,right:n.right-n.left,top:e,bottom:n.bottom-(n.top+e)}}class Am{constructor(e,n,r,i){this.from=e,this.to=n,this.size=r,this.displaySize=i}static same(e,n){if(e.length!=n.length)return!1;for(let r=0;rtypeof i!="function"&&i.class=="cm-lineWrapping");this.heightOracle=new n7(r),this.stateDeco=Jk(n),this.heightMap=Mr.empty().applyChanges(this.stateDeco,_t.empty,this.heightOracle.setDoc(n.doc),[new wi(0,0,0,n.doc.length)]);for(let i=0;i<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());i++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=en.set(this.lineGaps.map(i=>i.draw(this,!1))),this.scrollParent=e.scrollDOM,this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:n}=this.state.selection;for(let r=0;r<=1;r++){let i=r?n.head:n.anchor;if(!e.some(({from:s,to:o})=>i>=s&&i<=o)){let{from:s,to:o}=this.lineBlockAt(i);e.push(new yd(s,o))}}return this.viewports=e.sort((r,i)=>r.from-i.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?Yk:new Nw(this.heightOracle,this.heightMap,this.viewports),e.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(nc(e,this.scaler))})}update(e,n=null){this.state=e.state;let r=this.stateDeco;this.stateDeco=Jk(this.state);let i=e.changedRanges,s=wi.extendWithRanges(i,l7(r,this.stateDeco,e?e.changes:Vn.empty(this.state.doc.length))),o=this.heightMap.height,l=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);Xk(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),s),(this.heightMap.height!=o||eu)&&(e.flags|=2),l?(this.scrollAnchorPos=e.changes.mapPos(l.from,-1),this.scrollAnchorHeight=l.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=o);let a=s.length?this.mapViewport(this.viewport,e.changes):this.viewport;(n&&(n.range.heada.to)||!this.viewportIsAppropriate(a))&&(a=this.getViewport(0,n));let u=a.from!=this.viewport.from||a.to!=this.viewport.to;this.viewport=a,e.flags|=this.updateForViewport(),(u||!e.changes.empty||e.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(e.changes),n&&(this.scrollTarget=n),!this.mustEnforceCursorAssoc&&(e.selectionSet||e.focusChanged)&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(nU)&&(this.mustEnforceCursorAssoc=!0)}measure(){let{view:e}=this,n=e.contentDOM,r=window.getComputedStyle(n),i=this.heightOracle,s=r.whiteSpace;this.defaultTextDirection=r.direction=="rtl"?Rn.RTL:Rn.LTR;let o=this.heightOracle.mustRefreshForWrapping(s)||this.mustMeasureContent==="refresh",l=n.getBoundingClientRect(),a=o||this.mustMeasureContent||this.contentDOMHeight!=l.height;this.contentDOMHeight=l.height,this.mustMeasureContent=!1;let u=0,c=0;if(l.width&&l.height){let{scaleX:x,scaleY:C}=TA(n,l);(x>.005&&Math.abs(this.scaleX-x)>.005||C>.005&&Math.abs(this.scaleY-C)>.005)&&(this.scaleX=x,this.scaleY=C,u|=16,o=a=!0)}let f=(parseInt(r.paddingTop)||0)*this.scaleY,d=(parseInt(r.paddingBottom)||0)*this.scaleY;(this.paddingTop!=f||this.paddingBottom!=d)&&(this.paddingTop=f,this.paddingBottom=d,u|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(i.lineWrapping&&(a=!0),this.editorWidth=e.scrollDOM.clientWidth,u|=16);let h=EA(this.view.contentDOM,!1).y;h!=this.scrollParent&&(this.scrollParent=h,this.scrollAnchorHeight=-1,this.scrollOffset=0);let p=this.getScrollOffset();this.scrollOffset!=p&&(this.scrollAnchorHeight=-1,this.scrollOffset=p),this.scrolledToBottom=OA(this.scrollParent||e.win);let g=(this.printing?f7:u7)(n,this.paddingTop),b=g.top-this.pixelViewport.top,m=g.bottom-this.pixelViewport.bottom;this.pixelViewport=g;let v=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(v!=this.inView&&(this.inView=v,v&&(a=!0)),!this.inView&&!this.scrollTarget&&!c7(e.dom))return 0;let w=l.width;if((this.contentDOMWidth!=w||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=l.width,this.editorHeight=e.scrollDOM.clientHeight,u|=16),a){let x=e.docView.measureVisibleLineHeights(this.viewport);if(i.mustRefreshForHeights(x)&&(o=!0),o||i.lineWrapping&&Math.abs(w-this.contentDOMWidth)>i.charWidth){let{lineHeight:C,charWidth:T,textHeight:A}=e.docView.measureTextSize();o=C>0&&i.refresh(s,C,T,A,Math.max(5,w/T),x),o&&(e.docView.minWidth=0,u|=16)}b>0&&m>0?c=Math.max(b,m):b<0&&m<0&&(c=Math.min(b,m)),Xk();for(let C of this.viewports){let T=C.from==this.viewport.from?x:e.docView.measureVisibleLineHeights(C);this.heightMap=(o?Mr.empty().applyChanges(this.stateDeco,_t.empty,this.heightOracle,[new wi(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(i,0,o,new r7(C.from,T))}eu&&(u|=2)}let k=!this.viewportIsAppropriate(this.viewport,c)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return k&&(u&2&&(u|=this.updateScaler()),this.viewport=this.getViewport(c,this.scrollTarget),u|=this.updateForViewport()),(u&2||k)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,e)),u|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),u}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,n){let r=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),i=this.heightMap,s=this.heightOracle,{visibleTop:o,visibleBottom:l}=this,a=new yd(i.lineAt(o-r*1e3,cn.ByHeight,s,0,0).from,i.lineAt(l+(1-r)*1e3,cn.ByHeight,s,0,0).to);if(n){let{head:u}=n.range;if(ua.to){let c=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),f=i.lineAt(u,cn.ByPos,s,0,0),d;n.y=="center"?d=(f.top+f.bottom)/2-c/2:n.y=="start"||n.y=="nearest"&&u=l+Math.max(10,Math.min(r,250)))&&i>o-2*1e3&&s>1,o=i<<1;if(this.defaultTextDirection!=Rn.LTR&&!r)return[];let l=[],a=(c,f,d,h)=>{if(f-cc&&mm.from>=d.from&&m.to<=d.to&&Math.abs(m.from-c)m.fromv));if(!b){if(fw.from<=f&&w.to>=f)){let w=n.moveToLineBoundary(de.cursor(f),!1,!0).head;w>c&&(f=w)}let m=this.gapSize(d,c,f,h),v=r||m<2e6?m:2e6;b=new Am(c,f,m,v)}l.push(b)},u=c=>{if(c.length2e6)for(let C of e)C.from>=c.from&&C.fromc.from&&a(c.from,h,c,f),pn.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let n=this.stateDeco;this.lineGaps.length&&(n=n.concat(this.lineGapDeco));let r=[];Gt.spans(n,this.viewport.from,this.viewport.to,{span(s,o){r.push({from:s,to:o})},point(){}},20);let i=0;if(r.length!=this.visibleRanges.length)i=12;else for(let s=0;s=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(n=>n.from<=e&&n.to>=e)||nc(this.heightMap.lineAt(e,cn.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(n=>n.top<=e&&n.bottom>=e)||nc(this.heightMap.lineAt(this.scaler.fromDOM(e),cn.ByHeight,this.heightOracle,0,0),this.scaler)}getScrollOffset(){return(this.scrollParent==this.view.scrollDOM?this.scrollParent.scrollTop:(this.scrollParent?this.scrollParent.getBoundingClientRect().top:0)-this.view.contentDOM.getBoundingClientRect().top)*this.scaleY}scrollAnchorAt(e){let n=this.lineBlockAtHeight(e+8);return n.from>=this.viewport.from||this.viewportLines[0].top-e>200?n:this.viewportLines[0]}elementAtHeight(e){return nc(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class yd{constructor(e,n){this.from=e,this.to=n}}function h7(t,e,n){let r=[],i=t,s=0;return Gt.spans(n,t,e,{span(){},point(o,l){o>i&&(r.push({from:i,to:o}),s+=o-i),i=l}},20),i=1)return e[e.length-1].to;let r=Math.floor(t*n);for(let i=0;;i++){let{from:s,to:o}=e[i],l=o-s;if(r<=l)return s+r;r-=l}}function wd(t,e){let n=0;for(let{from:r,to:i}of t.ranges){if(e<=i){n+=e-r;break}n+=i-r}return n/t.total}function p7(t,e){for(let n of t)if(e(n))return n}const Yk={toDOM(t){return t},fromDOM(t){return t},scale:1,eq(t){return t==this}};function Jk(t){let e=t.facet(Wp).filter(r=>typeof r!="function"),n=t.facet(Mw).filter(r=>typeof r!="function");return n.length&&e.push(Gt.join(n)),e}class Nw{constructor(e,n,r){let i=0,s=0,o=0;this.viewports=r.map(({from:l,to:a})=>{let u=n.lineAt(l,cn.ByPos,e,0,0).top,c=n.lineAt(a,cn.ByPos,e,0,0).bottom;return i+=c-u,{from:l,to:a,top:u,bottom:c,domTop:0,domBottom:0}}),this.scale=(7e6-i)/(n.height-i);for(let l of this.viewports)l.domTop=o+(l.top-s)*this.scale,o=l.domBottom=l.domTop+(l.bottom-l.top),s=l.bottom}toDOM(e){for(let n=0,r=0,i=0;;n++){let s=nn.from==e.viewports[r].from&&n.to==e.viewports[r].to):!1}}function nc(t,e){if(e.scale==1)return t;let n=e.toDOM(t.top),r=e.toDOM(t.bottom);return new Ui(t.from,t.length,n,r-n,Array.isArray(t._content)?t._content.map(i=>nc(i,e)):t._content)}const bd=He.define({combine:t=>t.join(" ")}),Ay=He.define({combine:t=>t.indexOf(!0)>-1}),My=jo.newName(),dM=jo.newName(),hM=jo.newName(),pM={"&light":"."+dM,"&dark":"."+hM};function Ry(t,e,n){return new jo(e,{finish(r){return/&/.test(r)?r.replace(/&\w*/,i=>{if(i=="&")return t;if(!n||!n[i])throw new RangeError(`Unsupported selector: ${i}`);return n[i]}):t+" "+r}})}const g7=Ry("."+My,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{userSelect:"none",position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-selectionHandle":{backgroundColor:"currentColor",width:"1.5px"},".cm-selectionHandle-start::before, .cm-selectionHandle-end::before":{content:'""',backgroundColor:"inherit",borderRadius:"50%",width:"8px",height:"8px",position:"absolute",left:"-3.25px"},".cm-selectionHandle-start::before":{top:"-8px"},".cm-selectionHandle-end::before":{bottom:"-8px"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},".cm-panels-top":{top:"0"},".cm-panels-bottom":{bottom:"0"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"center"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},pM),m7={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Mm=Oe.ie&&Oe.ie_version<=11;class y7{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new VV,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(n=>{for(let r of n)this.queue.push(r);(Oe.ie&&Oe.ie_version<=11||Oe.ios&&e.composing)&&n.some(r=>r.type=="childList"&&r.removedNodes.length||r.type=="characterData"&&r.oldValue.length>r.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&Oe.android&&e.constructor.EDIT_CONTEXT!==!1&&!(Oe.chrome&&Oe.chrome_version<126)&&(this.editContext=new w7(e),e.state.facet(zs)&&(e.contentDOM.editContext=this.editContext.editContext)),Mm&&(this.onCharData=n=>{this.queue.push({target:n.target,type:"characterData",oldValue:n.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var n;((n=this.view.docView)===null||n===void 0?void 0:n.lastUpdate){this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),n.length>0&&n[n.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(n=>{n.length>0&&n[n.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){(e.type=="change"||!e.type)&&!e.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((n,r)=>n!=e[r]))){this.gapIntersection.disconnect();for(let n of e)this.gapIntersection.observe(n);this.gaps=e}}onSelectionChange(e){let n=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:r}=this,i=this.selectionRange;if(r.state.facet(zs)?r.root.activeElement!=this.dom:!bc(this.dom,i))return;let s=i.anchorNode&&r.docView.tile.nearest(i.anchorNode);if(s&&s.isWidget()&&s.widget.ignoreEvent(e)){n||(this.selectionChanged=!1);return}(Oe.ie&&Oe.ie_version<=11||Oe.android&&Oe.chrome)&&!r.state.selection.main.empty&&i.focusNode&&kc(i.focusNode,i.focusOffset,i.anchorNode,i.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,n=qc(e.root);if(!n)return!1;let r=Oe.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&v7(this.view,n)||n;if(!r||this.selectionRange.eq(r))return!1;let i=bc(this.dom,r);return i&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime{let s=this.delayedAndroidKey;s&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=s.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&s.force&&$a(this.dom,s.key,s.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(i)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:n,force:this.lastChange{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let n=-1,r=-1,i=!1;for(let s of e){let o=this.readMutation(s);o&&(o.typeOver&&(i=!0),n==-1?{from:n,to:r}=o:(n=Math.min(o.from,n),r=Math.max(o.to,r)))}return{from:n,to:r,typeOver:i}}readChange(){let{from:e,to:n,typeOver:r}=this.processRecords(),i=this.selectionChanged&&bc(this.dom,this.selectionRange);if(e<0&&!i)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let s=new DU(this.view,e,n,r);return this.view.docView.domChanged={newSel:s.newSel?s.newSel.main:null},s}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let n=this.readChange();if(!n)return this.view.requestMeasure(),!1;let r=this.view.state,i=tM(this.view,n);return this.view.state==r&&(n.domChanged||n.newSel&&!qh(this.view.state.selection,n.newSel.main))&&this.view.update([]),i}readMutation(e){let n=this.view.docView.tile.nearest(e.target);if(!n||n.isWidget())return null;if(n.markDirty(e.type=="attributes"),e.type=="childList"){let r=Qk(n,e.previousSibling||e.target.previousSibling,-1),i=Qk(n,e.nextSibling||e.target.nextSibling,1);return{from:r?n.posAfter(r):n.posAtStart,to:i?n.posBefore(i):n.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(zs)!=e.state.facet(zs)&&(e.view.contentDOM.editContext=e.state.facet(zs)?this.editContext.editContext:null))}destroy(){var e,n,r;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(n=this.gapIntersection)===null||n===void 0||n.disconnect(),(r=this.resizeScroll)===null||r===void 0||r.disconnect();for(let i of this.scrollTargets)i.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function Qk(t,e,n){for(;e;){let r=On.get(e);if(r&&r.parent==t)return r;let i=e.parentNode;e=i!=t.dom?i:n>0?e.nextSibling:e.previousSibling}return null}function Zk(t,e){let n=e.startContainer,r=e.startOffset,i=e.endContainer,s=e.endOffset,o=t.docView.domAtPos(t.state.selection.main.anchor,1);return kc(o.node,o.offset,i,s)&&([n,r,i,s]=[i,s,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:s}}function v7(t,e){if(e.getComposedRanges){let i=e.getComposedRanges(t.root)[0];if(i)return Zk(t,i)}let n=null;function r(i){i.preventDefault(),i.stopImmediatePropagation(),n=i.getTargetRanges()[0]}return t.contentDOM.addEventListener("beforeinput",r,!0),t.dom.ownerDocument.execCommand("indent"),t.contentDOM.removeEventListener("beforeinput",r,!0),n?Zk(t,n):null}class w7{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let n=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=r=>{let i=e.state.selection.main,{anchor:s,head:o}=i,l=this.toEditorPos(r.updateRangeStart),a=this.toEditorPos(r.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:r.updateRangeStart,editorBase:l,drifted:!1});let u=a-l>r.text.length;l==this.from&&sthis.to&&(a=s);let c=nM(e.state.sliceDoc(l,a),r.text,(u?i.from:i.to)-l,u?"end":null);if(!c){let d=de.single(this.toEditorPos(r.selectionStart),this.toEditorPos(r.selectionEnd));qh(d,i)||e.dispatch({selection:d,userEvent:"select"});return}let f={from:c.from+l,to:c.toA+l,insert:_t.of(r.text.slice(c.from,c.toB).split(` -`))};if((Oe.mac||Oe.android)&&f.from==o-1&&/^\. ?$/.test(r.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(f={from:l,to:a,insert:_t.of([r.text.replace("."," ")])}),this.pendingContextChange=f,!e.state.readOnly){let d=this.to-this.from+(f.to-f.from+f.insert.length);Ow(e,f,de.single(this.toEditorPos(r.selectionStart,d),this.toEditorPos(r.selectionEnd,d)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),f.from=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(n.text.slice(Math.max(0,r.updateRangeStart-1),Math.min(n.text.length,r.updateRangeStart+1)))&&this.handlers.compositionend(r)},this.handlers.characterboundsupdate=r=>{let i=[],s=null;for(let o=this.toEditorPos(r.rangeStart),l=this.toEditorPos(r.rangeEnd);o{let i=[];for(let s of r.getTextFormats()){let o=s.underlineStyle,l=s.underlineThickness;if(!/none/i.test(o)&&!/none/i.test(l)){let a=this.toEditorPos(s.rangeStart),u=this.toEditorPos(s.rangeEnd);if(a{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:r}=this.composing;this.composing=null,r&&this.reset(e.state)}};for(let r in this.handlers)n.addEventListener(r,this.handlers[r]);this.measureReq={read:r=>{let i=qc(r.root);i&&i.rangeCount&&this.editContext.updateSelectionBounds(i.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let n=0,r=!1,i=this.pendingContextChange;return e.changes.iterChanges((s,o,l,a,u)=>{if(r)return;let c=u.length-(o-s);if(i&&o>=i.to)if(i.from==s&&i.to==o&&i.insert.eq(u)){i=this.pendingContextChange=null,n+=c,this.to+=c;return}else i=null,this.revertPending(e.state);if(s+=n,o+=n,o<=this.from)this.from+=c,this.to+=c;else if(sthis.to||this.to-this.from+u.length>3e4){r=!0;return}this.editContext.updateText(this.toContextPos(s),this.toContextPos(o),u.toString()),this.to+=c}n+=c}),i&&!r&&this.revertPending(e.state),!r}update(e){let n=this.pendingContextChange,r=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(r.from,r.to)&&e.transactions.some(i=>!i.isUserEvent("input.type")&&i.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.reset(e.state)):(e.docChanged||e.selectionSet||n)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:n}=e.selection.main;this.from=Math.max(0,n-1e4),this.to=Math.min(e.doc.length,n+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let n=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(n.from),this.toContextPos(n.from+n.insert.length),e.doc.sliceString(n.from,n.to))}setSelection(e){let{main:n}=e.selection,r=this.toContextPos(Math.max(this.from,Math.min(this.to,n.anchor))),i=this.toContextPos(n.head);(this.editContext.selectionStart!=r||this.editContext.selectionEnd!=i)&&this.editContext.updateSelection(r,i)}rangeIsValid(e){let{head:n}=e.selection.main;return!(this.from>0&&n-this.from<500||this.to1e4*3)}toEditorPos(e,n=this.to-this.from){e=Math.min(e,n);let r=this.composing;return r&&r.drifted?r.editorBase+(e-r.contextBase):e+this.from}toContextPos(e){let n=this.composing;return n&&n.drifted?n.contextBase+(e-n.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class qe{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var n;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:r}=e;this.dispatchTransactions=e.dispatchTransactions||r&&(i=>i.forEach(s=>r(s,this)))||(i=>this.update(i)),this.dispatch=this.dispatch.bind(this),this._root=e.root||UV(e.parent)||document,this.viewState=new qk(this,e.state||zt.create(e)),e.scrollTo&&e.scrollTo.is(pd)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Ca).map(i=>new km(i));for(let i of this.plugins)i.update(this);this.observer=new y7(this),this.inputState=new zU(this),this.inputState.ensureHandlers(this.plugins),this.docView=new Lk(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((n=document.fonts)===null||n===void 0)&&n.ready&&document.fonts.ready.then(()=>{this.viewState.mustMeasureContent="refresh",this.requestMeasure()})}dispatch(...e){let n=e.length==1&&e[0]instanceof Gn?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(n,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let n=!1,r=!1,i,s=this.state;for(let d of e){if(d.startState!=s)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");s=d.state}if(this.destroyed){this.viewState.state=s;return}let o=this.hasFocus,l=0,a=null;e.some(d=>d.annotation(aM))?(this.inputState.notifiedFocused=o,l=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,a=uM(s,o),a||(l=1));let u=this.observer.delayedAndroidKey,c=null;if(u?(this.observer.clearDelayedAndroidKey(),c=this.observer.readChange(),(c&&!this.state.doc.eq(s.doc)||!this.state.selection.eq(s.selection))&&(c=null)):this.observer.clear(),s.facet(zt.phrases)!=this.state.facet(zt.phrases))return this.setState(s);i=Kh.create(this,s,e),i.flags|=l;let f=this.viewState.scrollTarget;try{this.updateState=2;for(let d of e){if(f&&(f=f.map(d.changes)),d.scrollIntoView){let{main:h}=d.state.selection,{x:p,y:g}=this.state.facet(qe.cursorScrollMargin);f=new Fa(h.empty?h:de.cursor(h.head,h.head>h.anchor?-1:1),"nearest","nearest",g,p)}for(let h of d.effects)h.is(pd)&&(f=h.value.clip(this.state))}this.viewState.update(i,f),this.bidiCache=Jh.update(this.bidiCache,i.changes),i.empty||(this.updatePlugins(i),this.inputState.update(i)),n=this.docView.update(i),this.state.facet(tc)!=this.styleModules&&this.mountStyles(),r=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(n,e.some(d=>d.isUserEvent("select.pointer")))}finally{this.updateState=0}if(i.startState.facet(bd)!=i.state.facet(bd)&&(this.viewState.mustMeasureContent=!0),(n||r||f||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),n&&this.docViewUpdate(),!i.empty)for(let d of this.state.facet(Sy))try{d(i)}catch(h){vi(this.state,h,"update listener")}(a||c)&&Promise.resolve().then(()=>{a&&this.state==a.startState&&this.dispatch(a),c&&!tM(this,c)&&u.force&&$a(this.contentDOM,u.key,u.keyCode)})}setState(e){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let n=this.hasFocus;try{for(let r of this.plugins)r.destroy(this);this.viewState=new qk(this,e),this.plugins=e.facet(Ca).map(r=>new km(r)),this.pluginMap.clear();for(let r of this.plugins)r.update(this);this.docView.destroy(),this.docView=new Lk(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}n&&this.focus(),this.requestMeasure()}updatePlugins(e){let n=e.startState.facet(Ca),r=e.state.facet(Ca);if(n!=r){let i=[];for(let s of r){let o=n.indexOf(s);if(o<0)i.push(new km(s));else{let l=this.plugins[o];l.mustUpdate=e,i.push(l)}}for(let s of this.plugins)s.mustUpdate!=e&&s.destroy(this);this.plugins=i,this.pluginMap.clear()}else for(let i of this.plugins)i.mustUpdate=e;for(let i=0;i-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let n=null,r=this.viewState.scrollParent,i=this.viewState.getScrollOffset(),{scrollAnchorPos:s,scrollAnchorHeight:o}=this.viewState;Math.abs(i-this.viewState.scrollOffset)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let l=0;;l++){if(o<0)if(OA(r||this.win))s=-1,o=this.viewState.heightMap.height;else{let h=this.viewState.scrollAnchorAt(i);s=h.from,o=h.top}this.updateState=1;let a=this.viewState.measure();if(!a&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(l>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let u=[];a&4||([this.measureRequests,u]=[u,this.measureRequests]);let c=u.map(h=>{try{return h.read(this)}catch(p){return vi(this.state,p),eS}}),f=Kh.create(this,this.state,[]),d=!1;f.flags|=a,n?n.flags|=a:n=f,this.updateState=2,f.empty||(this.updatePlugins(f),this.inputState.update(f),this.updateAttrs(),d=this.docView.update(f),d&&this.docViewUpdate());for(let h=0;h1||p<-1)&&!(Oe.ios&&this.inputState.lastIOSMomentumScroll>Date.now()-100)&&(r==this.scrollDOM||this.hasFocus||Math.max(this.inputState.lastWheelEvent,this.inputState.lastTouchTime)>Date.now()-100)){i=i+p,r?s<0?r.scrollTop=r.scrollHeight:r.scrollTop+=p:this.win.scrollBy(0,p),o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(n&&!n.empty)for(let l of this.state.facet(Sy))l(n)}get themeClasses(){return My+" "+(this.state.facet(Ay)?hM:dM)+" "+this.state.facet(bd)}updateAttrs(){let e=tS(this,XA,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),n={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(zs)?"true":"false",class:"cm-content",style:`${Oe.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(n["aria-readonly"]="true"),tS(this,Aw,n);let r=this.observer.ignore(()=>{let i=Ok(this.contentDOM,this.contentAttrs,n),s=Ok(this.dom,this.editorAttrs,e);return i||s});return this.editorAttrs=e,this.contentAttrs=n,r}showAnnouncements(e){let n=!0;for(let r of e)for(let i of r.effects)if(i.is(qe.announce)){n&&(this.announceDOM.textContent=""),n=!1;let s=this.announceDOM.appendChild(document.createElement("div"));s.textContent=i.value}}mountStyles(){this.styleModules=this.state.facet(tc);let e=this.state.facet(qe.cspNonce);jo.mount(this.root,this.styleModules.concat(g7).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let n=0;nr.plugin==e)||null),n&&n.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,n,r){return Em(this,e,$k(this,e,n,r))}moveByGroup(e,n){return Em(this,e,$k(this,e,n,r=>RU(this,e.head,r)))}visualLineSide(e,n){let r=this.bidiSpans(e),i=this.textDirectionAt(e.from),s=r[n?r.length-1:0];return de.cursor(s.side(n,i)+e.from,s.forward(!n,i)?1:-1)}moveToLineBoundary(e,n,r=!0){return MU(this,e,n,r)}moveVertically(e,n,r){return Em(this,e,OU(this,e,n,r))}domAtPos(e,n=1){return this.docView.domAtPos(e,n)}posAtDOM(e,n=0){return this.docView.posFromDOM(e,n)}posAtCoords(e,n=!0){this.readMeasured();let r=Ty(this,e,n);return r&&r.pos}posAndSideAtCoords(e,n=!0){return this.readMeasured(),Ty(this,e,n)}coordsAtPos(e,n=1){this.readMeasured();let r=this.state.doc.lineAt(e),i=this.bidiSpans(r),s=i[bs.find(i,e-r.from,-1,n)];return this.docView.coordsAt(e,n,s.dir==Rn.RTL)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(VA)||ethis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>b7)return LA(e.length);let n=this.textDirectionAt(e.from),r;for(let s of this.bidiCache)if(s.from==e.from&&s.dir==n&&(s.fresh||DA(s.isolates,r=Ik(this,e))))return s.order;r||(r=Ik(this,e));let i=ZV(e.text,n,r);return this.bidiCache.push(new Jh(e.from,e.to,n,r,!0,i)),i}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||Oe.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{RA(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,n={}){var r,i,s,o;return pd.of(new Fa(typeof e=="number"?de.cursor(e):e,(r=n.y)!==null&&r!==void 0?r:"nearest",(i=n.x)!==null&&i!==void 0?i:"nearest",(s=n.yMargin)!==null&&s!==void 0?s:5,(o=n.xMargin)!==null&&o!==void 0?o:5))}scrollSnapshot(){let{scrollTop:e,scrollLeft:n}=this.scrollDOM,r=this.viewState.scrollAnchorAt(e);return pd.of(new Fa(de.cursor(r.from),"start","start",r.top-e,n,!0))}setTabFocusMode(e){e==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof e=="boolean"?this.inputState.tabFocusMode=e?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return Ei.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return Ei.define(()=>({}),{eventObservers:e})}static theme(e,n){let r=jo.newName(),i=[bd.of(r),tc.of(Ry(`.${r}`,e))];return n&&n.dark&&i.push(Ay.of(!0)),i}static baseTheme(e){return ww.lowest(tc.of(Ry("."+My,e,pM)))}static findFromDOM(e){var n;let r=e.querySelector(".cm-content"),i=r&&On.get(r)||On.get(e);return((n=i==null?void 0:i.root)===null||n===void 0?void 0:n.view)||null}}qe.styleModule=tc;qe.inputHandler=HA;qe.clipboardInputFilter=Tw;qe.clipboardOutputFilter=Ew;qe.scrollHandler=UA;qe.focusChangeEffect=WA;qe.perLineTextDirection=VA;qe.exceptionSink=jA;qe.updateListener=Sy;qe.editable=zs;qe.mouseSelectionStyle=BA;qe.dragMovesSelection=zA;qe.clickAddsSelectionRange=FA;qe.decorations=Wp;qe.blockWrappers=GA;qe.outerDecorations=Mw;qe.atomicRanges=wf;qe.bidiIsolatedRanges=qA;qe.cursorScrollMargin=He.define({combine:t=>{let e=5,n=5;for(let r of t)typeof r=="number"?e=n=r:{x:e,y:n}=r;return{x:e,y:n}}});qe.scrollMargins=YA;qe.darkTheme=Ay;qe.cspNonce=He.define({combine:t=>t.length?t[0]:""});qe.contentAttributes=Aw;qe.editorAttributes=XA;qe.lineWrapping=qe.contentAttributes.of({class:"cm-lineWrapping"});qe.announce=on.define();const b7=4096,eS={};class Jh{constructor(e,n,r,i,s,o){this.from=e,this.to=n,this.dir=r,this.isolates=i,this.fresh=s,this.order=o}static update(e,n){if(n.empty&&!e.some(s=>s.fresh))return e;let r=[],i=e.length?e[e.length-1].dir:Rn.LTR;for(let s=Math.max(0,e.length-10);s=0;i--){let s=r[i],o=typeof s=="function"?s(t):s;o&&kw(o,n)}return n}const x7=Oe.mac?"mac":Oe.windows?"win":Oe.linux?"linux":"key";function k7(t,e){const n=t.split(/-(?!$)/);let r=n[n.length-1];r=="Space"&&(r=" ");let i,s,o,l;for(let a=0;ar.concat(i),[]))),n}let So=null;const T7=4e3;function E7(t,e=x7){let n=Object.create(null),r=Object.create(null),i=(o,l)=>{let a=r[o];if(a==null)r[o]=l;else if(a!=l)throw new Error("Key binding "+o+" is used both as a regular binding and as a multi-stroke prefix")},s=(o,l,a,u,c)=>{var f,d;let h=n[o]||(n[o]=Object.create(null)),p=l.split(/ (?!$)/).map(m=>k7(m,e));for(let m=1;m{let k=So={view:w,prefix:v,scope:o};return setTimeout(()=>{So==k&&(So=null)},T7),!0}]})}let g=p.join(" ");i(g,!1);let b=h[g]||(h[g]={preventDefault:!1,stopPropagation:!1,run:((d=(f=h._any)===null||f===void 0?void 0:f.run)===null||d===void 0?void 0:d.slice())||[]});a&&b.run.push(a),u&&(b.preventDefault=!0),c&&(b.stopPropagation=!0)};for(let o of t){let l=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let u of l){let c=n[u]||(n[u]=Object.create(null));c._any||(c._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:f}=o;for(let d in c)c[d].run.push(h=>f(h,Oy))}let a=o[e]||o.key;if(a)for(let u of l)s(u,a,o.run,o.preventDefault,o.stopPropagation),o.shift&&s(u,"Shift-"+a,o.shift,o.preventDefault,o.stopPropagation)}return n}let Oy=null;function A7(t,e,n,r){Oy=e;let i=FV(e),s=bV(i,0),o=xV(s)==i.length&&i!=" ",l="",a=!1,u=!1,c=!1;So&&So.view==n&&So.scope==r&&(l=So.prefix+" ",iM.indexOf(e.keyCode)<0&&(u=!0,So=null));let f=new Set,d=b=>{if(b){for(let m of b.run)if(!f.has(m)&&(f.add(m),m(n)))return b.stopPropagation&&(c=!0),!0;b.preventDefault&&(b.stopPropagation&&(c=!0),u=!0)}return!1},h=t[r],p,g;return h&&(d(h[l+xd(i,e,!o)])?a=!0:o&&(e.altKey||e.metaKey||e.ctrlKey)&&!(Oe.windows&&e.ctrlKey&&e.altKey)&&!(Oe.mac&&e.altKey&&!(e.ctrlKey||e.metaKey))&&(p=Ho[e.keyCode])&&p!=i?(d(h[l+xd(p,e,!0)])||e.shiftKey&&(g=Xc[e.keyCode])!=i&&g!=p&&d(h[l+xd(g,e,!1)]))&&(a=!0):o&&e.shiftKey&&d(h[l+xd(i,e,!0)])&&(a=!0),!a&&d(h._any)&&(a=!0)),u&&(a=!0),a&&c&&e.stopPropagation(),Oy=null,a}class M7 extends gu{constructor(e){super(),this.content=e}toDOM(e){let n=document.createElement("span");return n.className="cm-placeholder",n.style.pointerEvents="none",n.appendChild(typeof this.content=="string"?document.createTextNode(this.content):typeof this.content=="function"?this.content(e):this.content.cloneNode(!0)),n.setAttribute("aria-hidden","true"),n}coordsAt(e){let n=e.firstChild?xc(e.firstChild):[];if(!n.length)return null;let r=window.getComputedStyle(e.parentNode),i=Yc(n[0],r.direction!="rtl"),s=parseInt(r.lineHeight);return i.bottom-i.top>s*1.5?{left:i.left,right:i.right,top:i.top,bottom:i.top+s}:i}ignoreEvent(){return!1}}function R7(t){let e=Ei.fromClass(class{constructor(n){this.view=n,this.placeholder=t?en.set([en.widget({widget:new M7(t),side:1}).range(0)]):en.none}get decorations(){return this.view.state.doc.length?en.none:this.placeholder}},{decorations:n=>n.decorations});return typeof t=="string"?[e,qe.contentAttributes.of({"aria-placeholder":t})]:e}const kd="-10000px";class mM{constructor(e,n,r,i){this.facet=n,this.createTooltipView=r,this.removeTooltipView=i,this.input=e.state.facet(n),this.tooltips=this.input.filter(o=>o);let s=null;this.tooltipViews=this.tooltips.map(o=>s=r(o,s))}update(e,n){var r;let i=e.state.facet(this.facet),s=i.filter(a=>a);if(i===this.input){for(let a of this.tooltipViews)a.update&&a.update(e);return!1}let o=[],l=n?[]:null;for(let a=0;an[u]=a),n.length=l.length),this.input=i,this.tooltips=s,this.tooltipViews=o,!0}}function O7(t){let e=t.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:e.clientHeight,right:e.clientWidth}}const Rm=He.define({combine:t=>{var e,n,r;return{position:Oe.ios?"absolute":((e=t.find(i=>i.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((n=t.find(i=>i.parent))===null||n===void 0?void 0:n.parent)||null,tooltipSpace:((r=t.find(i=>i.tooltipSpace))===null||r===void 0?void 0:r.tooltipSpace)||O7}}}),rS=new WeakMap,yM=Ei.fromClass(class{constructor(t){this.view=t,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let e=t.state.facet(Rm);this.position=e.position,this.parent=e.parent,this.classes=t.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver=typeof ResizeObserver=="function"?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new mM(t,vM,(n,r)=>this.createTooltip(n,r),n=>{this.resizeObserver&&this.resizeObserver.unobserve(n.dom),n.dom.remove()}),this.above=this.manager.tooltips.map(n=>!!n.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(n=>{Date.now()>this.lastTransaction-50&&n.length>0&&n[n.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),t.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let t of this.manager.tooltipViews)this.intersectionObserver.observe(t.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(t){t.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(t,this.above);e&&this.observeIntersection();let n=e||t.geometryChanged,r=t.state.facet(Rm);if(r.position!=this.position&&!this.madeAbsolute){this.position=r.position;for(let i of this.manager.tooltipViews)i.dom.style.position=this.position;n=!0}if(r.parent!=this.parent){this.parent&&this.container.remove(),this.parent=r.parent,this.createContainer();for(let i of this.manager.tooltipViews)this.container.appendChild(i.dom);n=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);n&&this.maybeMeasure()}createTooltip(t,e){let n=t.create(this.view),r=e?e.dom:null;if(n.dom.classList.add("cm-tooltip"),t.arrow&&!n.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let i=document.createElement("div");i.className="cm-tooltip-arrow",n.dom.appendChild(i)}return n.dom.style.position=this.position,n.dom.style.top=kd,n.dom.style.left="0px",this.container.insertBefore(n.dom,r),n.mount&&n.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(n.dom),n}destroy(){var t,e,n;this.view.win.removeEventListener("resize",this.measureSoon);for(let r of this.manager.tooltipViews)r.dom.remove(),(t=r.destroy)===null||t===void 0||t.call(r);this.parent&&this.container.remove(),(e=this.resizeObserver)===null||e===void 0||e.disconnect(),(n=this.intersectionObserver)===null||n===void 0||n.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let t=1,e=1,n=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:s}=this.manager.tooltipViews[0];if(Oe.safari){let o=s.getBoundingClientRect();n=Math.abs(o.top+1e4)>1||Math.abs(o.left)>1}else n=!!s.offsetParent&&s.offsetParent!=this.container.ownerDocument.body}if(n||this.position=="absolute")if(this.parent){let s=this.parent.getBoundingClientRect();s.width&&s.height&&(t=s.width/this.parent.offsetWidth,e=s.height/this.parent.offsetHeight)}else({scaleX:t,scaleY:e}=this.view.viewState);let r=this.view.scrollDOM.getBoundingClientRect(),i=Rw(this.view);return{visible:{left:r.left+i.left,top:r.top+i.top,right:r.right-i.right,bottom:r.bottom-i.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((s,o)=>{let l=this.manager.tooltipViews[o];return l.getCoords?l.getCoords(s.pos):this.view.coordsAtPos(s.pos)}),size:this.manager.tooltipViews.map(({dom:s})=>s.getBoundingClientRect()),space:this.view.state.facet(Rm).tooltipSpace(this.view),scaleX:t,scaleY:e,makeAbsolute:n}}writeMeasure(t){var e;if(t.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let l of this.manager.tooltipViews)l.dom.style.position="absolute"}let{visible:n,space:r,scaleX:i,scaleY:s}=t,o=[];for(let l=0;l=Math.min(n.bottom,r.bottom)||f.rightMath.min(n.right,r.right)+.1)){c.style.top=kd;continue}let h=a.arrow?u.dom.querySelector(".cm-tooltip-arrow"):null,p=h?7:0,g=d.right-d.left,b=(e=rS.get(u))!==null&&e!==void 0?e:d.bottom-d.top,m=u.offset||N7,v=this.view.textDirection==Rn.LTR,w=d.width>r.right-r.left?v?r.left:r.right-d.width:v?Math.max(r.left,Math.min(f.left-(h?14:0)+m.x,r.right-g)):Math.min(Math.max(r.left,f.left-g+(h?14:0)-m.x),r.right-g),k=this.above[l];!a.strictSide&&(k?f.top-b-p-m.yr.bottom)&&k==r.bottom-f.bottom>f.top-r.top&&(k=this.above[l]=!k);let x=(k?f.top-r.top:r.bottom-f.bottom)-p;if(xw&&A.topC&&(C=k?A.top-b-2-p:A.bottom+p+2);if(this.position=="absolute"?(c.style.top=(C-t.parent.top)/s+"px",iS(c,(w-t.parent.left)/i)):(c.style.top=C/s+"px",iS(c,w/i)),h){let A=f.left+(v?m.x:-m.x)-(w+14-7);h.style.left=A/i+"px"}u.overlap!==!0&&o.push({left:w,top:C,right:T,bottom:C+b}),c.classList.toggle("cm-tooltip-above",k),c.classList.toggle("cm-tooltip-below",!k),u.positioned&&u.positioned(t.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let t of this.manager.tooltipViews)t.dom.style.top=kd}},{eventObservers:{scroll(){this.maybeMeasure()}}});function iS(t,e){let n=parseInt(t.style.left,10);(isNaN(n)||Math.abs(e-n)>1)&&(t.style.left=e+"px")}const P7=qe.baseTheme({".cm-tooltip":{zIndex:500,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:`${7*2}px`,position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),N7={x:0,y:0},vM=He.define({enables:[yM,P7]}),Qh=He.define({combine:t=>t.reduce((e,n)=>e.concat(n),[])});class Xp{static create(e){return new Xp(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new mM(e,Qh,(n,r)=>this.createHostedView(n,r),n=>n.dom.remove())}createHostedView(e,n){let r=e.create(this.view);return r.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(r.dom,n?n.dom.nextSibling:this.dom.firstChild),this.mounted&&r.mount&&r.mount(this.view),r}mount(e){for(let n of this.manager.tooltipViews)n.mount&&n.mount(e);this.mounted=!0}positioned(e){for(let n of this.manager.tooltipViews)n.positioned&&n.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let n of this.manager.tooltipViews)(e=n.destroy)===null||e===void 0||e.call(n)}passProp(e){let n;for(let r of this.manager.tooltipViews){let i=r[e];if(i!==void 0){if(n===void 0)n=i;else if(n!==i)return}}return n}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const I7=vM.compute([Qh],t=>{let e=t.facet(Qh);return e.length===0?null:{pos:Math.min(...e.map(n=>n.pos)),end:Math.max(...e.map(n=>{var r;return(r=n.end)!==null&&r!==void 0?r:n.pos})),create:Xp.create,above:e[0].above,arrow:e.some(n=>n.arrow)}}),_7=He.define();class D7{constructor(e,n,r,i,s,o){this.view=e,this.source=n,this.field=r,this.locked=i,this.setHover=s,this.hoverTime=o,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(e){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let e=Date.now()-this.lastMove.time;eo.bottom||n.xo.right+e.defaultCharacterWidth)return;let l=e.bidiSpans(e.state.doc.lineAt(i)).find(u=>u.from<=i&&u.to>=i),a=l&&l.dir==Rn.RTL?-1:1;s=n.x{if(l&&!(Array.isArray(l)&&!l.length)){let a=Array.isArray(l)?l:[l];i&&this.locked.set(a,i),e.dispatch({effects:this.setHover.of(a)})}};if(s&&"then"in s){let l=this.pending={pos:n};s.then(a=>{this.pending==l&&(this.pending=null,o(a))},a=>vi(e.state,a,"hover tooltip"))}else o(s)}get tooltip(){let e=this.view.plugin(yM),n=e?e.manager.tooltips.findIndex(r=>r.create==Xp.create):-1;return n>-1?e.manager.tooltipViews[n]:null}mousemove(e){var n,r;this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:i,tooltip:s}=this;if(i.length&&!this.locked.has(i)&&s&&!L7(s.dom,e)||this.pending){let{pos:o}=i[0]||this.pending,l=(r=(n=i[0])===null||n===void 0?void 0:n.end)!==null&&r!==void 0?r:o;(o==l?this.view.posAtCoords(this.lastMove)!=o:!$7(this.view,o,l,e.clientX,e.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:n}=this;if(n.length&&!this.locked.has(n)){let{tooltip:r}=this;r&&r.dom.contains(e.relatedTarget)?this.watchTooltipLeave(r.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let n=r=>{e.removeEventListener("mouseleave",n);let{active:i}=this;i.length&&!this.locked.has(i)&&!this.view.dom.contains(r.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",n)}destroy(){clearTimeout(this.hoverTimeout),clearTimeout(this.restartTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const Sd=4;function L7(t,e){let{left:n,right:r,top:i,bottom:s}=t.getBoundingClientRect(),o;if(o=t.querySelector(".cm-tooltip-arrow")){let l=o.getBoundingClientRect();i=Math.min(l.top,i),s=Math.max(l.bottom,s)}return e.clientX>=n-Sd&&e.clientX<=r+Sd&&e.clientY>=i-Sd&&e.clientY<=s+Sd}function $7(t,e,n,r,i,s){let o=t.scrollDOM.getBoundingClientRect(),l=t.documentTop+t.documentPadding.top+t.contentHeight;if(o.left>r||o.righti||Math.min(o.bottom,l)=e&&a<=n}function F7(t,e={}){let n=on.define(),r=new WeakMap,i=Os.define({create(){return[]},update(o,l){let a=r.get(o);if(o.length&&(e.hideOnChange&&(l.docChanged||l.selection)?o=[]:a&&a(l)?o=[]:e.hideOn&&(o=o.filter(u=>!e.hideOn(l,u)))),l.docChanged&&o.length){let u=[];for(let c of o){let f=l.changes.mapPos(c.pos,-1,Dr.TrackDel);if(f!=null){let d=Object.assign(Object.create(null),c);d.pos=f,d.end!=null&&(d.end=l.changes.mapPos(d.end)),u.push(d)}}o=u}for(let u of l.effects)u.is(n)&&(o=u.value,a=void 0),(u.is(z7)&&!u.value||u.value==i)&&(o=[]);return o.length&&a&&r.set(o,a),o},provide:o=>Qh.from(o)});const s=Ei.define(o=>new D7(o,t,i,r,n,e.hoverTime||300));return{active:i,extension:[i,s,_7.of(s),I7]}}const z7=on.define(),sS=He.define({combine(t){let e,n;for(let r of t)e=e||r.topContainer,n=n||r.bottomContainer;return{topContainer:e,bottomContainer:n}}}),B7=Ei.fromClass(class{constructor(t){this.input=t.state.facet(Py),this.specs=this.input.filter(n=>n),this.panels=this.specs.map(n=>n(t));let e=t.state.facet(sS);this.top=new Cd(t,!0,e.topContainer),this.bottom=new Cd(t,!1,e.bottomContainer),this.top.sync(this.panels.filter(n=>n.top)),this.bottom.sync(this.panels.filter(n=>!n.top));for(let n of this.panels)n.dom.classList.add("cm-panel"),n.mount&&n.mount()}update(t){let e=t.state.facet(sS);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new Cd(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new Cd(t.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=t.state.facet(Py);if(n!=this.input){let r=n.filter(a=>a),i=[],s=[],o=[],l=[];for(let a of r){let u=this.specs.indexOf(a),c;u<0?(c=a(t.view),l.push(c)):(c=this.panels[u],c.update&&c.update(t)),i.push(c),(c.top?s:o).push(c)}this.specs=r,this.panels=i,this.top.sync(s),this.bottom.sync(o);for(let a of l)a.dom.classList.add("cm-panel"),a.mount&&a.mount()}else for(let r of this.panels)r.update&&r.update(t)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:t=>qe.scrollMargins.of(e=>{let n=e.plugin(t);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}})});class Cd{constructor(e,n,r){this.view=e,this.top=n,this.container=r,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let n of this.panels)n.destroy&&e.indexOf(n)<0&&n.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom";let n=this.container||this.view.dom;n.insertBefore(this.dom,this.top?n.firstChild:null)}let e=this.dom.firstChild;for(let n of this.panels)if(n.dom.parentNode==this.dom){for(;e!=n.dom;)e=oS(e);e=e.nextSibling}else this.dom.insertBefore(n.dom,e);for(;e;)e=oS(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(!(!this.container||this.classes==this.view.themeClasses)){for(let e of this.classes.split(" "))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))e&&this.container.classList.add(e)}}}function oS(t){let e=t.nextSibling;return t.remove(),e}const Py=He.define({enables:B7});class tu extends Il{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}tu.prototype.elementClass="";tu.prototype.toDOM=void 0;tu.prototype.mapMode=Dr.TrackBefore;tu.prototype.startSide=tu.prototype.endSide=-1;tu.prototype.point=!0;const wM=1024;let j7=0;class Om{constructor(e,n){this.from=e,this.to=n}}class Et{constructor(e={}){this.id=j7++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=e.combine||null}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=Hr.match(e)),n=>{let r=e(n);return r===void 0?null:[this,r]}}}Et.closedBy=new Et({deserialize:t=>t.split(" ")});Et.openedBy=new Et({deserialize:t=>t.split(" ")});Et.group=new Et({deserialize:t=>t.split(" ")});Et.isolate=new Et({deserialize:t=>{if(t&&t!="rtl"&&t!="ltr"&&t!="auto")throw new RangeError("Invalid value for isolate: "+t);return t||"auto"}});Et.contextHash=new Et({perNode:!0});Et.lookAhead=new Et({perNode:!0});Et.mounted=new Et({perNode:!0});class Cc{constructor(e,n,r,i=!1){this.tree=e,this.overlay=n,this.parser=r,this.bracketed=i}static get(e){return e&&e.props&&e.props[Et.mounted.id]}}const H7=Object.create(null);class Hr{constructor(e,n,r,i=0){this.name=e,this.props=n,this.id=r,this.flags=i}static define(e){let n=e.props&&e.props.length?Object.create(null):H7,r=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),i=new Hr(e.name||"",n,e.id,r);if(e.props){for(let s of e.props)if(Array.isArray(s)||(s=s(i)),s){if(s[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");n[s[0].id]=s[1]}}return i}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let n=this.prop(Et.group);return n?n.indexOf(e)>-1:!1}return this.id==e}static match(e){let n=Object.create(null);for(let r in e)for(let i of r.split(" "))n[i]=e[r];return r=>{for(let i=r.prop(Et.group),s=-1;s<(i?i.length:0);s++){let o=n[s<0?r.name:i[s]];if(o)return o}}}}Hr.none=new Hr("",Object.create(null),0,8);class Iw{constructor(e){this.types=e;for(let n=0;n0;for(let a=this.cursor(o|Mn.IncludeAnonymous);;){let u=!1;if(a.from<=s&&a.to>=i&&(!l&&a.type.isAnonymous||n(a)!==!1)){if(a.firstChild())continue;u=!0}for(;u&&r&&(l||!a.type.isAnonymous)&&r(a),!a.nextSibling();){if(!a.parent())return;u=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let n in this.props)e.push([+n,this.props[n]]);return e}balance(e={}){return this.children.length<=8?this:Lw(Hr.none,this.children,this.positions,0,this.children.length,0,this.length,(n,r,i)=>new Fn(this.type,n,r,i,this.propValues),e.makeTree||((n,r,i)=>new Fn(Hr.none,n,r,i)))}static build(e){return K7(e)}}Fn.empty=new Fn(Hr.none,[],[],0);class _w{constructor(e,n){this.buffer=e,this.index=n}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new _w(this.buffer,this.index)}}class Vo{constructor(e,n,r){this.buffer=e,this.length=n,this.set=r}get type(){return Hr.none}toString(){let e=[];for(let n=0;n0));a=o[a+3]);return l}slice(e,n,r){let i=this.buffer,s=new Uint16Array(n-e),o=0;for(let l=e,a=0;l=e&&ne;case 1:return n<=e&&r>e;case 2:return r>e;case 4:return!0}}function Qc(t,e,n,r){for(var i;t.from==t.to||(n<1?t.from>=e:t.from>e)||(n>-1?t.to<=e:t.to0?l.length:-1;e!=u;e+=n){let c=l[e],f=a[e]+o.from,d;if(!(!(s&Mn.EnterBracketed&&c instanceof Fn&&(d=Cc.get(c))&&!d.overlay&&d.bracketed&&r>=f&&r<=f+c.length)&&!bM(i,r,f,f+c.length))){if(c instanceof Vo){if(s&Mn.ExcludeBuffers)continue;let h=c.findChild(0,c.buffer.length,n,r-f,i);if(h>-1)return new Mo(new W7(o,c,e,f),null,h)}else if(s&Mn.IncludeAnonymous||!c.type.isAnonymous||Dw(c)){let h;if(!(s&Mn.IgnoreMounts)&&(h=Cc.get(c))&&!h.overlay)return new Si(h.tree,f,e,o);let p=new Si(c,f,e,o);return s&Mn.IncludeAnonymous||!p.type.isAnonymous?p:p.nextChild(n<0?c.children.length-1:0,n,r,i,s)}}}if(s&Mn.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?e=o.index+n:e=n<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}prop(e){return this._tree.prop(e)}enter(e,n,r=0){let i;if(!(r&Mn.IgnoreOverlays)&&(i=Cc.get(this._tree))&&i.overlay){let s=e-this.from,o=r&Mn.EnterBracketed&&i.bracketed;for(let{from:l,to:a}of i.overlay)if((n>0||o?l<=s:l=s:a>s))return new Si(i.tree,i.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,n,r)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function aS(t,e,n,r){let i=t.cursor(),s=[];if(!i.firstChild())return s;if(n!=null){for(let o=!1;!o;)if(o=i.type.is(n),!i.nextSibling())return s}for(;;){if(r!=null&&i.type.is(r))return s;if(i.type.is(e)&&s.push(i.node),!i.nextSibling())return r==null?s:[]}}function Ny(t,e,n=e.length-1){for(let r=t;n>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(e[n]&&e[n]!=r.name)return!1;n--}}return!0}class W7{constructor(e,n,r,i){this.parent=e,this.buffer=n,this.index=r,this.start=i}}class Mo extends xM{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,n,r){super(),this.context=e,this._parent=n,this.index=r,this.type=e.buffer.set.types[e.buffer.buffer[r]]}child(e,n,r){let{buffer:i}=this.context,s=i.findChild(this.index+4,i.buffer[this.index+3],e,n-this.context.start,r);return s<0?null:new Mo(this.context,this,s)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}prop(e){return this.type.prop(e)}enter(e,n,r=0){if(r&Mn.ExcludeBuffers)return null;let{buffer:i}=this.context,s=i.findChild(this.index+4,i.buffer[this.index+3],n>0?1:-1,e-this.context.start,n);return s<0?null:new Mo(this.context,this,s)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,n=e.buffer[this.index+3];return n<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new Mo(this.context,this._parent,n):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,n=this._parent?this._parent.index+4:0;return this.index==n?this.externalSibling(-1):new Mo(this.context,this._parent,e.findChild(n,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],n=[],{buffer:r}=this.context,i=this.index+4,s=r.buffer[this.index+3];if(s>i){let o=r.buffer[this.index+1];e.push(r.slice(i,s,o)),n.push(0)}return new Fn(this.type,e,n,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function kM(t){if(!t.length)return null;let e=0,n=t[0];for(let s=1;sn.from||o.to=e){let l=new Si(o.tree,o.overlay[0].from+s.from,-1,s);(i||(i=[r])).push(Qc(l,e,n,!1))}}return i?kM(i):r}class Iy{get name(){return this.type.name}constructor(e,n=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=n&~Mn.EnterBracketed,e instanceof Si)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let r=e._parent;r;r=r._parent)this.stack.unshift(r.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,n){this.index=e;let{start:r,buffer:i}=this.buffer;return this.type=n||i.set.types[i.buffer[e]],this.from=r+i.buffer[e+1],this.to=r+i.buffer[e+2],!0}yield(e){return e?e instanceof Si?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,n,r){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,n,r,this.mode));let{buffer:i}=this.buffer,s=i.findChild(this.index+4,i.buffer[this.index+3],e,n-this.buffer.start,r);return s<0?!1:(this.stack.push(this.index),this.yieldBuf(s))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,n,r=this.mode){return this.buffer?r&Mn.ExcludeBuffers?!1:this.enterChild(1,e,n):this.yield(this._tree.enter(e,n,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Mn.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&Mn.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:n}=this.buffer,r=this.stack.length-1;if(e<0){let i=r<0?0:this.stack[r]+4;if(this.index!=i)return this.yieldBuf(n.findChild(i,this.index,-1,0,4))}else{let i=n.buffer[this.index+3];if(i<(r<0?n.buffer.length:n.buffer[this.stack[r]+3]))return this.yieldBuf(i)}return r<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let n,r,{buffer:i}=this;if(i){if(e>0){if(this.index-1)for(let s=n+e,o=e<0?-1:r._tree.children.length;s!=o;s+=e){let l=r._tree.children[s];if(this.mode&Mn.IncludeAnonymous||l instanceof Vo||!l.type.isAnonymous||Dw(l))return!1}return!0}move(e,n){if(n&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,n=0){for(;(this.from==this.to||(n<1?this.from>=e:this.from>e)||(n>-1?this.to<=e:this.to=0;){for(let o=e;o;o=o._parent)if(o.index==i){if(i==this.index)return o;n=o,r=s+1;break e}i=this.stack[--s]}for(let i=r;i=0;s--){if(s<0)return Ny(this._tree,e,i);let o=r[n.buffer[this.stack[s]]];if(!o.isAnonymous){if(e[i]&&e[i]!=o.name)return!1;i--}}return!0}}function Dw(t){return t.children.some(e=>e instanceof Vo||!e.type.isAnonymous||Dw(e))}function K7(t){var e;let{buffer:n,nodeSet:r,maxBufferLength:i=wM,reused:s=[],minRepeatType:o=r.types.length}=t,l=Array.isArray(n)?new _w(n,n.length):n,a=r.types,u=0,c=0;function f(x,C,T,A,M,N){let{id:D,start:O,end:L,size:_}=l,re=c,ie=u;if(_<0)if(l.next(),_==-1){let I=s[D];T.push(I),A.push(O-x);return}else if(_==-3){u=D;return}else if(_==-4){c=D;return}else throw new RangeError(`Unrecognized record size: ${_}`);let se=a[D],H,X,R=O-x;if(L-O<=i&&(X=b(l.pos-C,M))){let I=new Uint16Array(X.size-X.skip),P=l.pos-X.size,B=I.length;for(;l.pos>P;)B=m(X.start,I,B);H=new Vo(I,L-X.start,r),R=X.start-x}else{let I=l.pos-_;l.next();let P=[],B=[],q=D>=o?D:-1,W=0,ye=L;for(;l.pos>I;)q>=0&&l.id==q&&l.size>=0?(l.end<=ye-i&&(p(P,B,O,W,l.end,ye,q,re,ie),W=P.length,ye=l.end),l.next()):N>2500?d(O,I,P,B):f(O,I,P,B,q,N+1);if(q>=0&&W>0&&W-1&&W>0){let ee=h(se,ie);H=Lw(se,P,B,0,P.length,0,L-O,ee,ee)}else H=g(se,P,B,L-O,re-L,ie)}T.push(H),A.push(R)}function d(x,C,T,A){let M=[],N=0,D=-1;for(;l.pos>C;){let{id:O,start:L,end:_,size:re}=l;if(re>4)l.next();else{if(D>-1&&L=0;_-=3)O[re++]=M[_],O[re++]=M[_+1]-L,O[re++]=M[_+2]-L,O[re++]=re;T.push(new Vo(O,M[2]-L,r)),A.push(L-x)}}function h(x,C){return(T,A,M)=>{let N=0,D=T.length-1,O,L;if(D>=0&&(O=T[D])instanceof Fn){if(!D&&O.type==x&&O.length==M)return O;(L=O.prop(Et.lookAhead))&&(N=A[D]+O.length+L)}return g(x,T,A,M,N,C)}}function p(x,C,T,A,M,N,D,O,L){let _=[],re=[];for(;x.length>A;)_.push(x.pop()),re.push(C.pop()+T-M);x.push(g(r.types[D],_,re,N-M,O-N,L)),C.push(M-T)}function g(x,C,T,A,M,N,D){if(N){let O=[Et.contextHash,N];D=D?[O].concat(D):[O]}if(M>25){let O=[Et.lookAhead,M];D=D?[O].concat(D):[O]}return new Fn(x,C,T,A,D)}function b(x,C){let T=l.fork(),A=0,M=0,N=0,D=T.end-i,O={size:0,start:0,skip:0};e:for(let L=T.pos-x;T.pos>L;){let _=T.size;if(T.id==C&&_>=0){O.size=A,O.start=M,O.skip=N,N+=4,A+=4,T.next();continue}let re=T.pos-_;if(_<0||re=o?4:0,se=T.start;for(T.next();T.pos>re;){if(T.size<0)if(T.size==-3||T.size==-4)ie+=4;else break e;else T.id>=o&&(ie+=4);T.next()}M=se,A+=_,N+=ie}return(C<0||A==x)&&(O.size=A,O.start=M,O.skip=N),O.size>4?O:void 0}function m(x,C,T){let{id:A,start:M,end:N,size:D}=l;if(l.next(),D>=0&&A4){let L=l.pos-(D-4);for(;l.pos>L;)T=m(x,C,T)}C[--T]=O,C[--T]=N-x,C[--T]=M-x,C[--T]=A}else D==-3?u=A:D==-4&&(c=A);return T}let v=[],w=[];for(;l.pos>0;)f(t.start||0,t.bufferStart||0,v,w,-1,0);let k=(e=t.length)!==null&&e!==void 0?e:v.length?w[0]+v[0].length:0;return new Fn(a[t.topID],v.reverse(),w.reverse(),k)}const uS=new WeakMap;function Qd(t,e){if(!t.isAnonymous||e instanceof Vo||e.type!=t)return 1;let n=uS.get(e);if(n==null){n=1;for(let r of e.children){if(r.type!=t||!(r instanceof Fn)){n=1;break}n+=Qd(t,r)}uS.set(e,n)}return n}function Lw(t,e,n,r,i,s,o,l,a){let u=0;for(let p=r;p=c)break;C+=T}if(w==k+1){if(C>c){let T=p[k];h(T.children,T.positions,0,T.children.length,g[k]+v);continue}f.push(p[k])}else{let T=g[w-1]+p[w-1].length-x;f.push(Lw(t,p,g,k,w,x,T,null,a))}d.push(x+v-s)}}return h(e,n,r,i,0),(l||a)(f,d,o)}class El{constructor(e,n,r,i,s=!1,o=!1){this.from=e,this.to=n,this.tree=r,this.offset=i,this.open=(s?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,n=[],r=!1){let i=[new El(0,e.length,e,0,!1,r)];for(let s of n)s.to>e.length&&i.push(s);return i}static applyChanges(e,n,r=128){if(!n.length)return e;let i=[],s=1,o=e.length?e[0]:null;for(let l=0,a=0,u=0;;l++){let c=l=r)for(;o&&o.from=d.from||f<=d.to||u){let h=Math.max(d.from,a)-u,p=Math.min(d.to,f)-u;d=h>=p?null:new El(h,p,d.tree,d.offset+u,l>0,!!c)}if(d&&i.push(d),o.to>f)break;o=snew Om(i.from,i.to)):[new Om(0,0)]:[new Om(0,e.length)],this.createParse(e,n||[],r)}parse(e,n,r){let i=this.startParse(e,n,r);for(;;){let s=i.advance();if(s)return s}}}class X7{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,n){return this.string.slice(e,n)}}new Et({perNode:!0});let G7=0;class gi{constructor(e,n,r,i){this.name=e,this.set=n,this.base=r,this.modified=i,this.id=G7++}toString(){let{name:e}=this;for(let n of this.modified)n.name&&(e=`${n.name}(${e})`);return e}static define(e,n){let r=typeof e=="string"?e:"?";if(e instanceof gi&&(n=e),n!=null&&n.base)throw new Error("Can not derive from a modified tag");let i=new gi(r,[],null,[]);if(i.set.push(i),n)for(let s of n.set)i.set.push(s);return i}static defineModifier(e){let n=new Zh(e);return r=>r.modified.indexOf(n)>-1?r:Zh.get(r.base||r,r.modified.concat(n).sort((i,s)=>i.id-s.id))}}let q7=0;class Zh{constructor(e){this.name=e,this.instances=[],this.id=q7++}static get(e,n){if(!n.length)return e;let r=n[0].instances.find(l=>l.base==e&&Y7(n,l.modified));if(r)return r;let i=[],s=new gi(e.name,i,e,n);for(let l of n)l.instances.push(s);let o=J7(n);for(let l of e.set)if(!l.modified.length)for(let a of o)i.push(Zh.get(l,a));return s}}function Y7(t,e){return t.length==e.length&&t.every((n,r)=>n==e[r])}function J7(t){let e=[[]];for(let n=0;nr.length-n.length)}function CM(t){let e=Object.create(null);for(let n in t){let r=t[n];Array.isArray(r)||(r=[r]);for(let i of n.split(" "))if(i){let s=[],o=2,l=i;for(let f=0;;){if(l=="..."&&f>0&&f+3==i.length){o=1;break}let d=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(l);if(!d)throw new RangeError("Invalid path: "+i);if(s.push(d[0]=="*"?"":d[0][0]=='"'?JSON.parse(d[0]):d[0]),f+=d[0].length,f==i.length)break;let h=i[f++];if(f==i.length&&h=="!"){o=0;break}if(h!="/")throw new RangeError("Invalid path: "+i);l=i.slice(f)}let a=s.length-1,u=s[a];if(!u)throw new RangeError("Invalid path: "+i);let c=new Zc(r,o,a>0?s.slice(0,a):null);e[u]=c.sort(e[u])}}return TM.add(e)}const TM=new Et({combine(t,e){let n,r,i;for(;t||e;){if(!t||e&&t.depth>=e.depth?(i=e,e=e.next):(i=t,t=t.next),n&&n.mode==i.mode&&!i.context&&!n.context)continue;let s=new Zc(i.tags,i.mode,i.context);n?n.next=s:r=s,n=s}return r}});class Zc{constructor(e,n,r,i){this.tags=e,this.mode=n,this.context=r,this.next=i}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth{let o=i;for(let l of s)for(let a of l.set){let u=n[a.id];if(u){o=o?o+" "+u:u;break}}return o},scope:r}}function Q7(t,e){let n=null;for(let r of t){let i=r.style(e);i&&(n=n?n+" "+i:i)}return n}function Z7(t,e,n,r=0,i=t.length){let s=new eK(r,Array.isArray(e)?e:[e],n);s.highlightRange(t.cursor(),r,i,"",s.highlighters),s.flush(i)}class eK{constructor(e,n,r){this.at=e,this.highlighters=n,this.span=r,this.class=""}startSpan(e,n){n!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=n)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,n,r,i,s){let{type:o,from:l,to:a}=e;if(l>=r||a<=n)return;o.isTop&&(s=this.highlighters.filter(h=>!h.scope||h.scope(o)));let u=i,c=tK(e)||Zc.empty,f=Q7(s,c.tags);if(f&&(u&&(u+=" "),u+=f,c.mode==1&&(i+=(i?" ":"")+f)),this.startSpan(Math.max(n,l),u),c.opaque)return;let d=e.tree&&e.tree.prop(Et.mounted);if(d&&d.overlay){let h=e.node.enter(d.overlay[0].from+l,1),p=this.highlighters.filter(b=>!b.scope||b.scope(d.tree.type)),g=e.firstChild();for(let b=0,m=l;;b++){let v=b=w||!e.nextSibling())););if(!v||w>r)break;m=v.to+l,m>n&&(this.highlightRange(h.cursor(),Math.max(n,v.from+l),Math.min(r,m),"",p),this.startSpan(Math.min(r,m),u))}g&&e.parent()}else if(e.firstChild()){d&&(i="");do if(!(e.to<=n)){if(e.from>=r)break;this.highlightRange(e,n,r,i,s),this.startSpan(Math.min(r,e.to),u)}while(e.nextSibling());e.parent()}}}function tK(t){let e=t.type.prop(TM);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}const ke=gi.define,Ed=ke(),vo=ke(),cS=ke(vo),fS=ke(vo),wo=ke(),Ad=ke(wo),Pm=ke(wo),ds=ke(),al=ke(ds),cs=ke(),fs=ke(),_y=ke(),Vu=ke(_y),Md=ke(),Ge={comment:Ed,lineComment:ke(Ed),blockComment:ke(Ed),docComment:ke(Ed),name:vo,variableName:ke(vo),typeName:cS,tagName:ke(cS),propertyName:fS,attributeName:ke(fS),className:ke(vo),labelName:ke(vo),namespace:ke(vo),macroName:ke(vo),literal:wo,string:Ad,docString:ke(Ad),character:ke(Ad),attributeValue:ke(Ad),number:Pm,integer:ke(Pm),float:ke(Pm),bool:ke(wo),regexp:ke(wo),escape:ke(wo),color:ke(wo),url:ke(wo),keyword:cs,self:ke(cs),null:ke(cs),atom:ke(cs),unit:ke(cs),modifier:ke(cs),operatorKeyword:ke(cs),controlKeyword:ke(cs),definitionKeyword:ke(cs),moduleKeyword:ke(cs),operator:fs,derefOperator:ke(fs),arithmeticOperator:ke(fs),logicOperator:ke(fs),bitwiseOperator:ke(fs),compareOperator:ke(fs),updateOperator:ke(fs),definitionOperator:ke(fs),typeOperator:ke(fs),controlOperator:ke(fs),punctuation:_y,separator:ke(_y),bracket:Vu,angleBracket:ke(Vu),squareBracket:ke(Vu),paren:ke(Vu),brace:ke(Vu),content:ds,heading:al,heading1:ke(al),heading2:ke(al),heading3:ke(al),heading4:ke(al),heading5:ke(al),heading6:ke(al),contentSeparator:ke(ds),list:ke(ds),quote:ke(ds),emphasis:ke(ds),strong:ke(ds),link:ke(ds),monospace:ke(ds),strikethrough:ke(ds),inserted:ke(),deleted:ke(),changed:ke(),invalid:ke(),meta:Md,documentMeta:ke(Md),annotation:ke(Md),processingInstruction:ke(Md),definition:gi.defineModifier("definition"),constant:gi.defineModifier("constant"),function:gi.defineModifier("function"),standard:gi.defineModifier("standard"),local:gi.defineModifier("local"),special:gi.defineModifier("special")};for(let t in Ge){let e=Ge[t];e instanceof gi&&(e.name=t)}EM([{tag:Ge.link,class:"tok-link"},{tag:Ge.heading,class:"tok-heading"},{tag:Ge.emphasis,class:"tok-emphasis"},{tag:Ge.strong,class:"tok-strong"},{tag:Ge.keyword,class:"tok-keyword"},{tag:Ge.atom,class:"tok-atom"},{tag:Ge.bool,class:"tok-bool"},{tag:Ge.url,class:"tok-url"},{tag:Ge.labelName,class:"tok-labelName"},{tag:Ge.inserted,class:"tok-inserted"},{tag:Ge.deleted,class:"tok-deleted"},{tag:Ge.literal,class:"tok-literal"},{tag:Ge.string,class:"tok-string"},{tag:Ge.number,class:"tok-number"},{tag:[Ge.regexp,Ge.escape,Ge.special(Ge.string)],class:"tok-string2"},{tag:Ge.variableName,class:"tok-variableName"},{tag:Ge.local(Ge.variableName),class:"tok-variableName tok-local"},{tag:Ge.definition(Ge.variableName),class:"tok-variableName tok-definition"},{tag:Ge.special(Ge.variableName),class:"tok-variableName2"},{tag:Ge.definition(Ge.propertyName),class:"tok-propertyName tok-definition"},{tag:Ge.typeName,class:"tok-typeName"},{tag:Ge.namespace,class:"tok-namespace"},{tag:Ge.className,class:"tok-className"},{tag:Ge.macroName,class:"tok-macroName"},{tag:Ge.propertyName,class:"tok-propertyName"},{tag:Ge.operator,class:"tok-operator"},{tag:Ge.comment,class:"tok-comment"},{tag:Ge.meta,class:"tok-meta"},{tag:Ge.invalid,class:"tok-invalid"},{tag:Ge.punctuation,class:"tok-punctuation"}]);var Nm;const Ta=new Et;function nK(t){return He.define({combine:t?e=>e.concat(t):void 0})}const rK=new Et;class Xi{constructor(e,n,r=[],i=""){this.data=e,this.name=i,zt.prototype.hasOwnProperty("tree")||Object.defineProperty(zt.prototype,"tree",{get(){return As(this)}}),this.parser=n,this.extension=[ru.of(this),zt.languageData.of((s,o,l)=>{let a=dS(s,o,l),u=a.type.prop(Ta);if(!u)return[];let c=s.facet(u),f=a.type.prop(rK);if(f){let d=a.resolve(o-a.from,l);for(let h of f)if(h.test(d,s)){let p=s.facet(h.facet);return h.type=="replace"?p:p.concat(c)}}return c})].concat(r)}isActiveAt(e,n,r=-1){return dS(e,n,r).type.prop(Ta)==this.data}findRegions(e){let n=e.facet(ru);if((n==null?void 0:n.data)==this.data)return[{from:0,to:e.doc.length}];if(!n||!n.allowsNesting)return[];let r=[],i=(s,o)=>{if(s.prop(Ta)==this.data){r.push({from:o,to:o+s.length});return}let l=s.prop(Et.mounted);if(l){if(l.tree.prop(Ta)==this.data){if(l.overlay)for(let a of l.overlay)r.push({from:a.from+o,to:a.to+o});else r.push({from:o,to:o+s.length});return}else if(l.overlay){let a=r.length;if(i(l.tree,l.overlay[0].from+o),r.length>a)return}}for(let a=0;ar.isTop?n:void 0)]}),e.name)}configure(e,n){return new ep(this.data,this.parser.configure(e),n||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function As(t){let e=t.field(Xi.state,!1);return e?e.tree:Fn.empty}class iK{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,n){let r=this.cursorPos-this.string.length;return e=this.cursorPos?this.doc.sliceString(e,n):this.string.slice(e-r,n-r)}}let Uu=null;class tp{constructor(e,n,r=[],i,s,o,l,a){this.parser=e,this.state=n,this.fragments=r,this.tree=i,this.treeLen=s,this.viewport=o,this.skipped=l,this.scheduleOn=a,this.parse=null,this.tempSkipped=[]}static create(e,n,r){return new tp(e,n,[],Fn.empty,0,r,[],null)}startParse(){return this.parser.startParse(new iK(this.state.doc),this.fragments)}work(e,n){return n!=null&&n>=this.state.doc.length&&(n=void 0),this.tree!=Fn.empty&&this.isDone(n??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var r;if(typeof e=="number"){let i=Date.now()+e;e=()=>Date.now()>i}for(this.parse||(this.parse=this.startParse()),n!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>n)&&n=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(n=this.parse.advance()););}),this.treeLen=e,this.tree=n,this.fragments=this.withoutTempSkipped(El.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let n=Uu;Uu=this;try{return e()}finally{Uu=n}}withoutTempSkipped(e){for(let n;n=this.tempSkipped.pop();)e=hS(e,n.from,n.to);return e}changes(e,n){let{fragments:r,tree:i,treeLen:s,viewport:o,skipped:l}=this;if(this.takeTree(),!e.empty){let a=[];if(e.iterChangedRanges((u,c,f,d)=>a.push({fromA:u,toA:c,fromB:f,toB:d})),r=El.applyChanges(r,a),i=Fn.empty,s=0,o={from:e.mapPos(o.from,-1),to:e.mapPos(o.to,1)},this.skipped.length){l=[];for(let u of this.skipped){let c=e.mapPos(u.from,1),f=e.mapPos(u.to,-1);ce.from&&(this.fragments=hS(this.fragments,i,s),this.skipped.splice(r--,1))}return this.skipped.length>=n?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,n){this.skipped.push({from:e,to:n})}static getSkippingParser(e){return new class extends SM{createParse(n,r,i){let s=i[0].from,o=i[i.length-1].to;return{parsedPos:s,advance(){let a=Uu;if(a){for(let u of i)a.tempSkipped.push(u);e&&(a.scheduleOn=a.scheduleOn?Promise.all([a.scheduleOn,e]):e)}return this.parsedPos=o,new Fn(Hr.none,[],[],o-s)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let n=this.fragments;return this.treeLen>=e&&n.length&&n[0].from==0&&n[0].to>=e}static get(){return Uu}}function hS(t,e,n){return El.applyChanges(t,[{fromA:e,toA:n,fromB:e,toB:n}])}class nu{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let n=this.context.changes(e.changes,e.state),r=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),n.viewport.to);return n.work(20,r)||n.takeTree(),new nu(n)}static init(e){let n=Math.min(3e3,e.doc.length),r=tp.create(e.facet(ru).parser,e,{from:0,to:n});return r.work(20,n)||r.takeTree(),new nu(r)}}Xi.state=Os.define({create:nu.init,update(t,e){for(let n of e.effects)if(n.is(Xi.setState))return n.value;return e.startState.facet(ru)!=e.state.facet(ru)?nu.init(e.state):t.apply(e)}});let AM=t=>{let e=setTimeout(()=>t(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(AM=t=>{let e=-1,n=setTimeout(()=>{e=requestIdleCallback(t,{timeout:400})},100);return()=>e<0?clearTimeout(n):cancelIdleCallback(e)});const Im=typeof navigator<"u"&&(!((Nm=navigator.scheduling)===null||Nm===void 0)&&Nm.isInputPending)?()=>navigator.scheduling.isInputPending():null,sK=Ei.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let n=this.view.state.field(Xi.state).context;(n.updateViewport(e.view.viewport)||this.view.viewport.to>n.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(n)}scheduleWork(){if(this.working)return;let{state:e}=this.view,n=e.field(Xi.state);(n.tree!=n.context.tree||!n.context.isDone(e.doc.length))&&(this.working=AM(this.work))}work(e){this.working=null;let n=Date.now();if(this.chunkEndi+1e3,a=s.context.work(()=>Im&&Im()||Date.now()>o,i+(l?0:1e5));this.chunkBudget-=Date.now()-n,(a||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:Xi.setState.of(new nu(s.context))})),this.chunkBudget>0&&!(a&&!l)&&this.scheduleWork(),this.checkAsyncSchedule(s.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(n=>vi(this.view.state,n)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),ru=He.define({combine(t){return t.length?t[0]:null},enables:t=>[Xi.state,sK,qe.contentAttributes.compute([t],e=>{let n=e.facet(t);return n&&n.name?{"data-language":n.name}:{}})]});class oK{constructor(e,n=[]){this.language=e,this.support=n,this.extension=[e,n]}}const lK=He.define(),$w=He.define({combine:t=>{if(!t.length)return" ";let e=t[0];if(!e||/\S/.test(e)||Array.from(e).some(n=>n!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(t[0]));return e}});function np(t){let e=t.facet($w);return e.charCodeAt(0)==9?t.tabSize*e.length:e.length}function rp(t,e){let n="",r=t.tabSize,i=t.facet($w)[0];if(i==" "){for(;e>=r;)n+=" ",e-=r;i=" "}for(let s=0;s=e?aK(t,n,e):null}class Gp{constructor(e,n={}){this.state=e,this.options=n,this.unit=np(e)}lineAt(e,n=1){let r=this.state.doc.lineAt(e),{simulateBreak:i,simulateDoubleBreak:s}=this.options;return i!=null&&i>=r.from&&i<=r.to?s&&i==e?{text:"",from:e}:(n<0?i-1&&(s+=o-this.countColumn(r,r.search(/\S|$/))),s}countColumn(e,n=e.length){return jp(e,this.state.tabSize,n)}lineIndent(e,n=1){let{text:r,from:i}=this.lineAt(e,n),s=this.options.overrideIndentation;if(s){let o=s(i);if(o>-1)return o}return this.countColumn(r,r.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const RM=new Et;function aK(t,e,n){let r=e.resolveStack(n),i=e.resolveInner(n,-1).resolve(n,0).enterUnfinishedNodesBefore(n);if(i!=r.node){let s=[];for(let o=i;o&&!(o.fromr.node.to||o.from==r.node.from&&o.type==r.node.type);o=o.parent)s.push(o);for(let o=s.length-1;o>=0;o--)r={node:s[o],next:r}}return OM(r,t,n)}function OM(t,e,n){for(let r=t;r;r=r.next){let i=cK(r.node);if(i)return i(Fw.create(e,n,r))}return 0}function uK(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}function cK(t){let e=t.type.prop(RM);if(e)return e;let n=t.firstChild,r;if(n&&(r=n.type.prop(Et.closedBy))){let i=t.lastChild,s=i&&r.indexOf(i.name)>-1;return o=>pK(o,!0,1,void 0,s&&!uK(o)?i.from:void 0)}return t.parent==null?fK:null}function fK(){return 0}class Fw extends Gp{constructor(e,n,r){super(e.state,e.options),this.base=e,this.pos=n,this.context=r}get node(){return this.context.node}static create(e,n,r){return new Fw(e,n,r)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let n=this.state.doc.lineAt(e.from);for(;;){let r=e.resolve(n.from);for(;r.parent&&r.parent.from==r.from;)r=r.parent;if(dK(r,e))break;n=this.state.doc.lineAt(r.from)}return this.lineIndent(n.from)}continue(){return OM(this.context.next,this.base,this.pos)}}function dK(t,e){for(let n=e;n;n=n.parent)if(t==n)return!0;return!1}function hK(t){let e=t.node,n=e.childAfter(e.from),r=e.lastChild;if(!n)return null;let i=t.options.simulateBreak,s=t.state.doc.lineAt(n.from),o=i==null||i<=s.from?s.to:Math.min(s.to,i);for(let l=n.to;;){let a=e.childAfter(l);if(!a||a==r)return null;if(!a.type.isSkipped){if(a.from>=o)return null;let u=/^ */.exec(s.text.slice(n.to-s.from))[0].length;return{from:n.from,to:n.to+u}}l=a.to}}function pK(t,e,n,r,i){let s=t.textAfter,o=s.match(/^\s*/)[0].length,l=r&&s.slice(o,o+r.length)==r||i==t.pos+o,a=hK(t);return a?l?t.column(a.from):t.column(a.to):t.baseIndent+(l?0:t.unit*n)}function pS({except:t,units:e=1}={}){return n=>{let r=t&&t.test(n.textAfter);return n.baseIndent+(r?0:e*n.unit)}}const gK=new Et;function mK(t){let e=t.firstChild,n=t.lastChild;return e&&e.tol.prop(Ta)==o.data:o?l=>l==o:void 0,this.style=EM(e.map(l=>({tag:l.tag,class:l.class||i(Object.assign({},l,{tag:null}))})),{all:s}).style,this.module=r?new jo(r):null,this.themeType=n.themeType}static define(e,n){return new qp(e,n||{})}}const Dy=He.define(),yK=He.define({combine(t){return t.length?[t[0]]:null}});function _m(t){let e=t.facet(Dy);return e.length?e:t.facet(yK)}function gS(t,e){let n=[wK],r;return t instanceof qp&&(t.module&&n.push(qe.styleModule.of(t.module)),r=t.themeType),r?n.push(Dy.computeN([qe.darkTheme],i=>i.facet(qe.darkTheme)==(r=="dark")?[t]:[])):n.push(Dy.of(t)),n}class vK{constructor(e){this.markCache=Object.create(null),this.tree=As(e.state),this.decorations=this.buildDeco(e,_m(e.state)),this.decoratedTo=e.viewport.to}update(e){let n=As(e.state),r=_m(e.state),i=r!=_m(e.startState),{viewport:s}=e.view,o=e.changes.mapPos(this.decoratedTo,1);n.length=s.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=o):(n!=this.tree||e.viewportChanged||i)&&(this.tree=n,this.decorations=this.buildDeco(e.view,r),this.decoratedTo=s.to)}buildDeco(e,n){if(!n||!this.tree.length)return en.none;let r=new Ja;for(let{from:i,to:s}of e.visibleRanges)Z7(this.tree,n,(o,l,a)=>{r.add(o,l,this.markCache[a]||(this.markCache[a]=en.mark({class:a})))},i,s);return r.finish()}}const wK=ww.high(Ei.fromClass(vK,{decorations:t=>t.decorations})),bK=1e4,xK="()[]{}",kK=new Et;function Ly(t,e,n){let r=t.prop(e<0?Et.openedBy:Et.closedBy);if(r)return r;if(t.name.length==1){let i=n.indexOf(t.name);if(i>-1&&i%2==(e<0?1:0))return[n[i+e]]}return null}function $y(t){let e=t.type.prop(kK);return e?e(t.node):t}function Ea(t,e,n,r={}){let i=r.maxScanDistance||bK,s=r.brackets||xK,o=As(t),l=o.resolveInner(e,n);for(let a=l;a;a=a.parent){let u=Ly(a.type,n,s);if(u&&a.from0?e>=c.from&&ec.from&&e<=c.to))return SK(t,e,n,a,c,u,s)}}return CK(t,e,n,o,l.type,i,s)}function SK(t,e,n,r,i,s,o){let l=r.parent,a={from:i.from,to:i.to},u=0,c=l==null?void 0:l.cursor();if(c&&(n<0?c.childBefore(r.from):c.childAfter(r.to)))do if(n<0?c.to<=r.from:c.from>=r.to){if(u==0&&s.indexOf(c.type.name)>-1&&c.from0)return null;let u={from:n<0?e-1:e,to:n>0?e+1:e},c=t.doc.iterRange(e,n>0?t.doc.length:0),f=0;for(let d=0;!c.next().done&&d<=s;){let h=c.value;n<0&&(d+=h.length);let p=e+d*n;for(let g=n>0?0:h.length-1,b=n>0?h.length:-1;g!=b;g+=n){let m=o.indexOf(h[g]);if(!(m<0||r.resolveInner(p+g,1).type!=i))if(m%2==0==n>0)f++;else{if(f==1)return{start:u,end:{from:p+g,to:p+g+1},matched:m>>1==a>>1};f--}}n>0&&(d+=h.length)}return c.done?{start:u,matched:!1}:null}const TK=Object.create(null),mS=[Hr.none],yS=[],vS=Object.create(null),EK=Object.create(null);for(let[t,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])EK[t]=AK(TK,e);function Dm(t,e){yS.indexOf(t)>-1||(yS.push(t),console.warn(e))}function AK(t,e){let n=[];for(let l of e.split(" ")){let a=[];for(let u of l.split(".")){let c=t[u]||Ge[u];c?typeof c=="function"?a.length?a=a.map(c):Dm(u,`Modifier ${u} used at start of tag`):a.length?Dm(u,`Tag ${u} used as modifier`):a=Array.isArray(c)?c:[c]:Dm(u,`Unknown highlighting tag ${u}`)}for(let u of a)n.push(u)}if(!n.length)return 0;let r=e.replace(/ /g,"_"),i=r+" "+n.map(l=>l.id),s=vS[i];if(s)return s.id;let o=vS[i]=Hr.define({id:mS.length,name:r,props:[CM({[r]:n})]});return mS.push(o),o.id}Rn.RTL,Rn.LTR;const MK=t=>{let{state:e}=t,n=e.doc.lineAt(e.selection.main.from),r=Bw(t.state,n.from);return r.line?RK(t):r.block?PK(t):!1};function zw(t,e){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let i=t(e,n);return i?(r(n.update(i)),!0):!1}}const RK=zw(_K,0),OK=zw(PM,0),PK=zw((t,e)=>PM(t,e,IK(e)),0);function Bw(t,e){let n=t.languageDataAt("commentTokens",e,1);return n.length?n[0]:{}}const Ku=50;function NK(t,{open:e,close:n},r,i){let s=t.sliceDoc(r-Ku,r),o=t.sliceDoc(i,i+Ku),l=/\s*$/.exec(s)[0].length,a=/^\s*/.exec(o)[0].length,u=s.length-l;if(s.slice(u-e.length,u)==e&&o.slice(a,a+n.length)==n)return{open:{pos:r-l,margin:l&&1},close:{pos:i+a,margin:a&&1}};let c,f;i-r<=2*Ku?c=f=t.sliceDoc(r,i):(c=t.sliceDoc(r,r+Ku),f=t.sliceDoc(i-Ku,i));let d=/^\s*/.exec(c)[0].length,h=/\s*$/.exec(f)[0].length,p=f.length-h-n.length;return c.slice(d,d+e.length)==e&&f.slice(p,p+n.length)==n?{open:{pos:r+d+e.length,margin:/\s/.test(c.charAt(d+e.length))?1:0},close:{pos:i-h-n.length,margin:/\s/.test(f.charAt(p-1))?1:0}}:null}function IK(t){let e=[];for(let n of t.selection.ranges){let r=t.doc.lineAt(n.from),i=n.to<=r.to?r:t.doc.lineAt(n.to);i.from>r.from&&i.from==n.to&&(i=n.to==r.to+1?r:t.doc.lineAt(n.to-1));let s=e.length-1;s>=0&&e[s].to>r.from?e[s].to=i.to:e.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:i.to})}return e}function PM(t,e,n=e.selection.ranges){let r=n.map(s=>Bw(e,s.from).block);if(!r.every(s=>s))return null;let i=n.map((s,o)=>NK(e,r[o],s.from,s.to));if(t!=2&&!i.every(s=>s))return{changes:e.changes(n.map((s,o)=>i[o]?[]:[{from:s.from,insert:r[o].open+" "},{from:s.to,insert:" "+r[o].close}]))};if(t!=1&&i.some(s=>s)){let s=[];for(let o=0,l;oi&&(s==o||o>f.from)){i=f.from;let d=/^\s*/.exec(f.text)[0].length,h=d==f.length,p=f.text.slice(d,d+u.length)==u?d:-1;ds.comment<0&&(!s.empty||s.single))){let s=[];for(let{line:l,token:a,indent:u,empty:c,single:f}of r)(f||!c)&&s.push({from:l.from+u,insert:a+" "});let o=e.changes(s);return{changes:o,selection:e.selection.map(o,1)}}else if(t!=1&&r.some(s=>s.comment>=0)){let s=[];for(let{line:o,comment:l,token:a}of r)if(l>=0){let u=o.from+l,c=u+a.length;o.text[c-o.from]==" "&&c++,s.push({from:u,to:c})}return{changes:s}}return null}const Fy=qo.define(),DK=qo.define(),LK=He.define(),NM=He.define({combine(t){return wA(t,{minDepth:100,newGroupDelay:500,joinToEvent:(e,n)=>n},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,n)=>(r,i)=>e(r,i)||n(r,i)})}}),IM=Os.define({create(){return xs.empty},update(t,e){let n=e.state.facet(NM),r=e.annotation(Fy);if(r){let a=Fr.fromTransaction(e,r.selection),u=r.side,c=u==0?t.undone:t.done;return a?c=ip(c,c.length,n.minDepth,a):c=LM(c,e.startState.selection),new xs(u==0?r.rest:c,u==0?c:r.rest)}let i=e.annotation(DK);if((i=="full"||i=="before")&&(t=t.isolate()),e.annotation(Gn.addToHistory)===!1)return e.changes.empty?t:t.addMapping(e.changes.desc);let s=Fr.fromTransaction(e),o=e.annotation(Gn.time),l=e.annotation(Gn.userEvent);return s?t=t.addChanges(s,o,l,n,e):e.selection&&(t=t.addSelection(e.startState.selection,o,l,n.newGroupDelay)),(i=="full"||i=="after")&&(t=t.isolate()),t},toJSON(t){return{done:t.done.map(e=>e.toJSON()),undone:t.undone.map(e=>e.toJSON())}},fromJSON(t){return new xs(t.done.map(Fr.fromJSON),t.undone.map(Fr.fromJSON))}});function $K(t={}){return[IM,NM.of(t),qe.domEventHandlers({beforeinput(e,n){let r=e.inputType=="historyUndo"?_M:e.inputType=="historyRedo"?zy:null;return r?(e.preventDefault(),r(n)):!1}})]}function Yp(t,e){return function({state:n,dispatch:r}){if(!e&&n.readOnly)return!1;let i=n.field(IM,!1);if(!i)return!1;let s=i.pop(t,n,e);return s?(r(s),!0):!1}}const _M=Yp(0,!1),zy=Yp(1,!1),FK=Yp(0,!0),zK=Yp(1,!0);class Fr{constructor(e,n,r,i,s){this.changes=e,this.effects=n,this.mapped=r,this.startSelection=i,this.selectionsAfter=s}setSelAfter(e){return new Fr(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,n,r;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(n=this.mapped)===null||n===void 0?void 0:n.toJSON(),startSelection:(r=this.startSelection)===null||r===void 0?void 0:r.toJSON(),selectionsAfter:this.selectionsAfter.map(i=>i.toJSON())}}static fromJSON(e){return new Fr(e.changes&&Vn.fromJSON(e.changes),[],e.mapped&&Es.fromJSON(e.mapped),e.startSelection&&de.fromJSON(e.startSelection),e.selectionsAfter.map(de.fromJSON))}static fromTransaction(e,n){let r=bi;for(let i of e.startState.facet(LK)){let s=i(e);s.length&&(r=r.concat(s))}return!r.length&&e.changes.empty?null:new Fr(e.changes.invert(e.startState.doc),r,void 0,n||e.startState.selection,bi)}static selection(e){return new Fr(void 0,bi,void 0,void 0,e)}}function ip(t,e,n,r){let i=e+1>n+20?e-n-1:0,s=t.slice(i,e);return s.push(r),s}function BK(t,e){let n=[],r=!1;return t.iterChangedRanges((i,s)=>n.push(i,s)),e.iterChangedRanges((i,s,o,l)=>{for(let a=0;a=u&&o<=c&&(r=!0)}}),r}function jK(t,e){return t.ranges.length==e.ranges.length&&t.ranges.filter((n,r)=>n.empty!=e.ranges[r].empty).length===0}function DM(t,e){return t.length?e.length?t.concat(e):t:e}const bi=[],HK=200;function LM(t,e){if(t.length){let n=t[t.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-HK));return r.length&&r[r.length-1].eq(e)?t:(r.push(e),ip(t,t.length-1,1e9,n.setSelAfter(r)))}else return[Fr.selection([e])]}function WK(t){let e=t[t.length-1],n=t.slice();return n[t.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),n}function Lm(t,e){if(!t.length)return t;let n=t.length,r=bi;for(;n;){let i=VK(t[n-1],e,r);if(i.changes&&!i.changes.empty||i.effects.length){let s=t.slice(0,n);return s[n-1]=i,s}else e=i.mapped,n--,r=i.selectionsAfter}return r.length?[Fr.selection(r)]:bi}function VK(t,e,n){let r=DM(t.selectionsAfter.length?t.selectionsAfter.map(l=>l.map(e)):bi,n);if(!t.changes)return Fr.selection(r);let i=t.changes.map(e),s=e.mapDesc(t.changes,!0),o=t.mapped?t.mapped.composeDesc(s):s;return new Fr(i,on.mapEffects(t.effects,e),o,t.startSelection.map(s),r)}const UK=/^(input\.type|delete)($|\.)/;class xs{constructor(e,n,r=0,i=void 0){this.done=e,this.undone=n,this.prevTime=r,this.prevUserEvent=i}isolate(){return this.prevTime?new xs(this.done,this.undone):this}addChanges(e,n,r,i,s){let o=this.done,l=o[o.length-1];return l&&l.changes&&!l.changes.empty&&e.changes&&(!r||UK.test(r))&&(!l.selectionsAfter.length&&n-this.prevTime0&&n-this.prevTimen.empty?t.moveByChar(n,e):Jp(n,e))}function br(t){return t.textDirectionAt(t.state.selection.main.head)==Rn.LTR}const FM=t=>$M(t,!br(t)),zM=t=>$M(t,br(t));function BM(t,e){return ns(t,n=>n.empty?t.moveByGroup(n,e):Jp(n,e))}const XK=t=>BM(t,!br(t)),GK=t=>BM(t,br(t));function qK(t,e,n){if(e.type.prop(n))return!0;let r=e.to-e.from;return r&&(r>2||/[^\s,.;:]/.test(t.sliceDoc(e.from,e.to)))||e.firstChild}function Qp(t,e,n){let r=As(t).resolveInner(e.head),i=n?Et.closedBy:Et.openedBy;for(let a=e.head;;){let u=n?r.childAfter(a):r.childBefore(a);if(!u)break;qK(t,u,i)?r=u:a=n?u.to:u.from}let s=r.type.prop(i),o,l;return s&&(o=n?Ea(t,r.from,1):Ea(t,r.to,-1))&&o.matched?l=n?o.end.to:o.end.from:l=n?r.to:r.from,de.cursor(l,n?-1:1)}const YK=t=>ns(t,e=>Qp(t.state,e,!br(t))),JK=t=>ns(t,e=>Qp(t.state,e,br(t)));function jM(t,e){return ns(t,n=>{if(!n.empty)return Jp(n,e);let r=t.moveVertically(n,e);return r.head!=n.head?r:t.moveToLineBoundary(n,e)})}const HM=t=>jM(t,!1),WM=t=>jM(t,!0);function VM(t){let e=t.scrollDOM.clientHeighto.empty?t.moveVertically(o,e,n.height):Jp(o,e));if(i.eq(r.selection))return!1;let s;if(n.selfScroll){let o=t.coordsAtPos(r.selection.main.head),l=t.scrollDOM.getBoundingClientRect(),a=l.top+n.marginTop,u=l.bottom-n.marginBottom;o&&o.top>a&&o.bottomUM(t,!1),By=t=>UM(t,!0);function Yo(t,e,n){let r=t.lineBlockAt(e.head),i=t.moveToLineBoundary(e,n);if(i.head==e.head&&i.head!=(n?r.to:r.from)&&(i=t.moveToLineBoundary(e,n,!1)),!n&&i.head==r.from&&r.length){let s=/^\s*/.exec(t.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;s&&e.head!=r.from+s&&(i=de.cursor(r.from+s))}return i}const QK=t=>ns(t,e=>Yo(t,e,!0)),ZK=t=>ns(t,e=>Yo(t,e,!1)),eX=t=>ns(t,e=>Yo(t,e,!br(t))),tX=t=>ns(t,e=>Yo(t,e,br(t))),nX=t=>ns(t,e=>de.cursor(t.lineBlockAt(e.head).from,1)),rX=t=>ns(t,e=>de.cursor(t.lineBlockAt(e.head).to,-1));function iX(t,e,n){let r=!1,i=mu(t.selection,s=>{let o=Ea(t,s.head,-1)||Ea(t,s.head,1)||s.head>0&&Ea(t,s.head-1,1)||s.headiX(t,e);function Ai(t,e,n){let r=mu(t.state.selection,i=>{i.undirectional&&i.head>=i.anchor!=e&&(i=de.range(i.head,i.anchor));let s=n(i);return de.range(i.anchor,s.head,s.goalColumn,s.bidiLevel||void 0,s.assoc)});return r.eq(t.state.selection)?!1:(t.dispatch(ts(t.state,r)),!0)}function KM(t,e){return Ai(t,e,n=>t.moveByChar(n,e))}const XM=t=>KM(t,!br(t)),GM=t=>KM(t,br(t));function qM(t,e){return Ai(t,e,n=>t.moveByGroup(n,e))}const oX=t=>qM(t,!br(t)),lX=t=>qM(t,br(t)),aX=t=>{let e=!br(t);return Ai(t,e,n=>Qp(t.state,n,e))},uX=t=>{let e=br(t);return Ai(t,e,n=>Qp(t.state,n,e))};function YM(t,e){return Ai(t,e,n=>t.moveVertically(n,e))}const JM=t=>YM(t,!1),QM=t=>YM(t,!0);function ZM(t,e){return Ai(t,e,n=>t.moveVertically(n,e,VM(t).height))}const bS=t=>ZM(t,!1),xS=t=>ZM(t,!0),cX=t=>Ai(t,!0,e=>Yo(t,e,!0)),fX=t=>Ai(t,!1,e=>Yo(t,e,!1)),dX=t=>{let e=!br(t);return Ai(t,e,n=>Yo(t,n,e))},hX=t=>{let e=br(t);return Ai(t,e,n=>Yo(t,n,e))},pX=t=>Ai(t,!1,e=>de.cursor(t.lineBlockAt(e.head).from)),gX=t=>Ai(t,!0,e=>de.cursor(t.lineBlockAt(e.head).to)),kS=({state:t,dispatch:e})=>(e(ts(t,{anchor:0})),!0),SS=({state:t,dispatch:e})=>(e(ts(t,{anchor:t.doc.length})),!0),CS=({state:t,dispatch:e})=>(e(ts(t,{anchor:t.selection.main.anchor,head:0})),!0),TS=({state:t,dispatch:e})=>(e(ts(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0),mX=({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0),yX=({state:t,dispatch:e})=>{let n=Zp(t).map(({from:r,to:i})=>de.undirectionalRange(r,Math.min(i+1,t.doc.length)));return e(t.update({selection:de.create(n),userEvent:"select"})),!0},vX=({state:t,dispatch:e})=>{let n=mu(t.selection,r=>{let i=As(t),s=i.resolveStack(r.from,1);if(r.empty){let o=i.resolveStack(r.from,-1);o.node.from>=s.node.from&&o.node.to<=s.node.to&&(s=o)}for(let o=s;o;o=o.next){let{node:l}=o;if((l.from=r.to||l.to>r.to&&l.from<=r.from)&&o.next)return de.undirectionalRange(l.from,l.to)}return r});return n.eq(t.selection)?!1:(e(ts(t,n)),!0)};function eR(t,e){let{state:n}=t,r=n.selection,i=n.selection.ranges.slice();for(let s of n.selection.ranges){let o=n.doc.lineAt(s.head);if(e?o.to0)for(let l=s;;){let a=t.moveVertically(l,e);if(a.heado.to){i.some(u=>u.head==a.head)||i.push(a);break}else{if(a.head==l.head)break;l=a}}}return i.length==r.ranges.length?!1:(t.dispatch(ts(n,de.create(i,i.length-1))),!0)}const wX=t=>eR(t,!1),bX=t=>eR(t,!0),xX=({state:t,dispatch:e})=>{let n=t.selection,r=null;return n.ranges.length>1?r=de.create([n.main]):n.main.empty||(r=de.create([de.cursor(n.main.head)])),r?(e(ts(t,r)),!0):!1};function bf(t,e){if(t.state.readOnly)return!1;let n="delete.selection",{state:r}=t,i=r.changeByRange(s=>{let{from:o,to:l}=s;if(o==l){let a=e(s);ao&&(n="delete.forward",a=Rd(t,a,!0)),o=Math.min(o,a),l=Math.max(l,a)}else o=Rd(t,o,!1),l=Rd(t,l,!0);return o==l?{range:s}:{changes:{from:o,to:l},range:de.cursor(o,oi(t)))r.between(e,e,(i,s)=>{ie&&(e=n?s:i)});return e}const tR=(t,e,n)=>bf(t,r=>{let i=r.from,{state:s}=t,o=s.doc.lineAt(i),l,a;if(n&&!e&&i>o.from&&itR(t,!1,!0),nR=t=>tR(t,!0,!1),rR=(t,e)=>bf(t,n=>{let r=n.head,{state:i}=t,s=i.doc.lineAt(r),o=i.charCategorizer(r);for(let l=null;;){if(r==(e?s.to:s.from)){r==n.head&&s.number!=(e?i.doc.lines:1)&&(r+=e?1:-1);break}let a=vr(s.text,r-s.from,e)+s.from,u=s.text.slice(Math.min(r,a)-s.from,Math.max(r,a)-s.from),c=o(u);if(l!=null&&c!=l)break;(u!=" "||r!=n.head)&&(l=c),r=a}return r}),iR=t=>rR(t,!1),kX=t=>rR(t,!0),SX=t=>bf(t,e=>{let n=t.lineBlockAt(e.head).to;return e.headbf(t,e=>{let n=t.moveToLineBoundary(e,!1).head;return e.head>n?n:Math.max(0,e.head-1)}),TX=t=>bf(t,e=>{let n=t.moveToLineBoundary(e,!0).head;return e.head{if(t.readOnly)return!1;let n=t.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:_t.of(["",""])},range:de.cursor(r.from)}));return e(t.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},AX=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=t.changeByRange(r=>{if(!r.empty||r.from==0||r.from==t.doc.length)return{range:r};let i=r.from,s=t.doc.lineAt(i),o=i==s.from?i-1:vr(s.text,i-s.from,!1)+s.from,l=i==s.to?i+1:vr(s.text,i-s.from,!0)+s.from;return{changes:{from:o,to:l,insert:t.doc.slice(i,l).append(t.doc.slice(o,i))},range:de.cursor(l)}});return n.changes.empty?!1:(e(t.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function Zp(t){let e=[],n=-1;for(let r of t.selection.ranges){let i=t.doc.lineAt(r.from),s=t.doc.lineAt(r.to);if(!r.empty&&r.to==s.from&&(s=t.doc.lineAt(r.to-1)),n>=i.number){let o=e[e.length-1];o.to=s.to,o.ranges.push(r)}else e.push({from:i.from,to:s.to,ranges:[r]});n=s.number+1}return e}function sR(t,e,n){if(t.readOnly)return!1;let r=[],i=[];for(let s of Zp(t)){if(n?s.to==t.doc.length:s.from==0)continue;let o=t.doc.lineAt(n?s.to+1:s.from-1),l=o.length+1;if(n){r.push({from:s.to,to:o.to},{from:s.from,insert:o.text+t.lineBreak});for(let a of s.ranges)i.push(de.range(Math.min(t.doc.length,a.anchor+l),Math.min(t.doc.length,a.head+l)))}else{r.push({from:o.from,to:s.from},{from:s.to,insert:t.lineBreak+o.text});for(let a of s.ranges)i.push(de.range(a.anchor-l,a.head-l))}}return r.length?(e(t.update({changes:r,scrollIntoView:!0,selection:de.create(i,t.selection.mainIndex),userEvent:"move.line"})),!0):!1}const MX=({state:t,dispatch:e})=>sR(t,e,!1),RX=({state:t,dispatch:e})=>sR(t,e,!0);function oR(t,e,n){if(t.readOnly)return!1;let r=[];for(let s of Zp(t))n?r.push({from:s.from,insert:t.doc.slice(s.from,s.to)+t.lineBreak}):r.push({from:s.to,insert:t.lineBreak+t.doc.slice(s.from,s.to)});let i=t.changes(r);return e(t.update({changes:i,selection:t.selection.map(i,n?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const OX=({state:t,dispatch:e})=>oR(t,e,!1),PX=({state:t,dispatch:e})=>oR(t,e,!0),NX=t=>{if(t.state.readOnly)return!1;let{state:e}=t,n=e.changes(Zp(e).map(({from:i,to:s})=>(i>0?i--:s{let s;if(t.lineWrapping){let o=t.lineBlockAt(i.head),l=t.coordsAtPos(i.head,i.assoc||1);l&&(s=o.bottom+t.documentTop-l.bottom+t.defaultLineHeight/2)}return t.moveVertically(i,!0,s)}).map(n);return t.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0};function IX(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let n=As(t).resolveInner(e),r=n.childBefore(e),i=n.childAfter(e),s;return r&&i&&r.to<=e&&i.from>=e&&(s=r.type.prop(Et.closedBy))&&s.indexOf(i.name)>-1&&t.doc.lineAt(r.to).from==t.doc.lineAt(i.from).from&&!/\S/.test(t.sliceDoc(r.to,i.from))?{from:r.to,to:i.from}:null}const ES=lR(!1),_X=lR(!0);function lR(t){return({state:e,dispatch:n})=>{if(e.readOnly)return!1;let r=e.changeByRange(i=>{let{from:s,to:o}=i,l=e.doc.lineAt(s),a=!t&&s==o&&IX(e,s);t&&(s=o=(o<=l.to?l:e.doc.lineAt(o)).to);let u=new Gp(e,{simulateBreak:s,simulateDoubleBreak:!!a}),c=MM(u,s);for(c==null&&(c=jp(/^\s*/.exec(e.doc.lineAt(s).text)[0],e.tabSize));ol.from&&s{let i=[];for(let o=r.from;o<=r.to;){let l=t.doc.lineAt(o);l.number>n&&(r.empty||r.to>l.from)&&(e(l,i,r),n=l.number),o=l.to+1}let s=t.changes(i);return{changes:i,range:de.range(s.mapPos(r.anchor,1),s.mapPos(r.head,1))}})}const DX=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=Object.create(null),r=new Gp(t,{overrideIndentation:s=>{let o=n[s];return o??-1}}),i=jw(t,(s,o,l)=>{let a=MM(r,s.from);if(a==null)return;/\S/.test(s.text)||(a=0);let u=/^\s*/.exec(s.text)[0],c=rp(t,a);(u!=c||l.fromt.readOnly?!1:(e(t.update(jw(t,(n,r)=>{r.push({from:n.from,insert:t.facet($w)})}),{userEvent:"input.indent"})),!0),uR=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(jw(t,(n,r)=>{let i=/^\s*/.exec(n.text)[0];if(!i)return;let s=jp(i,t.tabSize),o=0,l=rp(t,Math.max(0,s-np(t)));for(;o(t.setTabFocusMode(),!0),$X=[{key:"Ctrl-b",run:FM,shift:XM,preventDefault:!0},{key:"Ctrl-f",run:zM,shift:GM},{key:"Ctrl-p",run:HM,shift:JM},{key:"Ctrl-n",run:WM,shift:QM},{key:"Ctrl-a",run:nX,shift:pX},{key:"Ctrl-e",run:rX,shift:gX},{key:"Ctrl-d",run:nR},{key:"Ctrl-h",run:jy},{key:"Ctrl-k",run:SX},{key:"Ctrl-Alt-h",run:iR},{key:"Ctrl-o",run:EX},{key:"Ctrl-t",run:AX},{key:"Ctrl-v",run:By}],FX=[{key:"ArrowLeft",run:FM,shift:XM,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:XK,shift:oX,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:eX,shift:dX,preventDefault:!0},{key:"ArrowRight",run:zM,shift:GM,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:GK,shift:lX,preventDefault:!0},{mac:"Cmd-ArrowRight",run:tX,shift:hX,preventDefault:!0},{key:"ArrowUp",run:HM,shift:JM,preventDefault:!0},{mac:"Cmd-ArrowUp",run:kS,shift:CS},{mac:"Ctrl-ArrowUp",run:wS,shift:bS},{key:"ArrowDown",run:WM,shift:QM,preventDefault:!0},{mac:"Cmd-ArrowDown",run:SS,shift:TS},{mac:"Ctrl-ArrowDown",run:By,shift:xS},{key:"PageUp",run:wS,shift:bS},{key:"PageDown",run:By,shift:xS},{key:"Home",run:ZK,shift:fX,preventDefault:!0},{key:"Mod-Home",run:kS,shift:CS},{key:"End",run:QK,shift:cX,preventDefault:!0},{key:"Mod-End",run:SS,shift:TS},{key:"Enter",run:ES,shift:ES},{key:"Mod-a",run:mX},{key:"Backspace",run:jy,shift:jy,preventDefault:!0},{key:"Delete",run:nR,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:iR,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:kX,preventDefault:!0},{mac:"Mod-Backspace",run:CX,preventDefault:!0},{mac:"Mod-Delete",run:TX,preventDefault:!0}].concat($X.map(t=>({mac:t.key,run:t.run,shift:t.shift}))),zX=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:YK,shift:aX},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:JK,shift:uX},{key:"Alt-ArrowUp",run:MX},{key:"Shift-Alt-ArrowUp",run:OX},{key:"Alt-ArrowDown",run:RX},{key:"Shift-Alt-ArrowDown",run:PX},{key:"Mod-Alt-ArrowUp",run:wX},{key:"Mod-Alt-ArrowDown",run:bX},{key:"Escape",run:xX},{key:"Mod-Enter",run:_X},{key:"Alt-l",mac:"Ctrl-l",run:yX},{key:"Mod-i",run:vX,preventDefault:!0},{key:"Mod-[",run:uR},{key:"Mod-]",run:aR},{key:"Mod-Alt-\\",run:DX},{key:"Shift-Mod-k",run:NX},{key:"Shift-Mod-\\",run:sX},{key:"Mod-/",run:MK},{key:"Alt-A",mac:"Ctrl-A",run:OK},{key:"Ctrl-m",mac:"Shift-Alt-m",run:LX}].concat(FX),BX={key:"Tab",run:aR,shift:uR};var AS={};class sp{constructor(e,n,r,i,s,o,l,a,u,c=0,f){this.p=e,this.stack=n,this.state=r,this.reducePos=i,this.pos=s,this.score=o,this.buffer=l,this.bufferBase=a,this.curContext=u,this.lookAhead=c,this.parent=f}toString(){return`[${this.stack.filter((e,n)=>n%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,n,r=0){let i=e.parser.context;return new sp(e,[],n,r,r,0,[],0,i?new MS(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,n){this.stack.push(this.state,n,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var n;let r=e>>19,i=e&65535,{parser:s}=this.p,o=this.reducePos=2e3&&!(!((n=this.p.parser.nodeSet.types[i])===null||n===void 0)&&n.isAnonymous)&&(u==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=c):this.p.lastBigReductionSizea;)this.stack.pop();this.reduceContext(i,u)}storeNode(e,n,r,i=4,s=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]0&&this.buffer[o-4]==0&&this.buffer[o-1]>-1){if(n==r)return;if(this.buffer[o-2]>=n){this.buffer[o-2]=r;return}}}if(!s||this.pos==r)this.buffer.push(e,n,r,i);else{let o=this.buffer.length;if(o>0&&(this.buffer[o-4]!=0||this.buffer[o-1]<0)){let l=!1;for(let a=o;a>0&&this.buffer[a-2]>r;a-=4)if(this.buffer[a-1]>=0){l=!0;break}if(l)for(;o>0&&this.buffer[o-2]>r;)this.buffer[o]=this.buffer[o-4],this.buffer[o+1]=this.buffer[o-3],this.buffer[o+2]=this.buffer[o-2],this.buffer[o+3]=this.buffer[o-1],o-=4,i>4&&(i-=4)}this.buffer[o]=e,this.buffer[o+1]=n,this.buffer[o+2]=r,this.buffer[o+3]=i}}shift(e,n,r,i){if(e&131072)this.pushState(e&65535,this.pos);else if(e&262144)this.pos=i,this.shiftContext(n,r),n<=this.p.parser.maxNode&&this.buffer.push(n,r,i,4);else{let s=e,{parser:o}=this.p;this.pos=i;let l=o.stateFlag(s,1);!l&&(i>r||n<=o.maxNode)&&(this.reducePos=i),this.pushState(s,l?r:Math.min(r,this.reducePos)),this.shiftContext(n,r),n<=o.maxNode&&this.buffer.push(n,r,i,4)}}apply(e,n,r,i){e&65536?this.reduce(e):this.shift(e,n,r,i)}useNode(e,n){let r=this.p.reused.length-1;(r<0||this.p.reused[r]!=e)&&(this.p.reused.push(e),r++);let i=this.pos;this.reducePos=this.pos=i+e.length,this.pushState(n,i),this.buffer.push(r,i,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,n=e.buffer.length;for(n&&e.buffer[n-4]==0&&(n-=4);n>0&&e.buffer[n-2]>e.reducePos;)n-=4;let r=e.buffer.slice(n),i=e.bufferBase+n;for(;e&&i==e.bufferBase;)e=e.parent;return new sp(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,r,i,this.curContext,this.lookAhead,e)}recoverByDelete(e,n){let r=e<=this.p.parser.maxNode;r&&this.storeNode(e,this.pos,n,4),this.storeNode(0,this.pos,n,r?8:4),this.pos=this.reducePos=n,this.score-=190}canShift(e){for(let n=new jX(this);;){let r=this.p.parser.stateSlot(n.state,4)||this.p.parser.hasAction(n.state,e);if(r==0)return!1;if(!(r&65536))return!0;n.reduce(r)}}recoverByInsert(e){if(this.stack.length>=300)return[];let n=this.p.parser.nextStates(this.state);if(n.length>8||this.stack.length>=120){let i=[];for(let s=0,o;sa&1&&l==o)||i.push(n[s],o)}n=i}let r=[];for(let i=0;i>19,i=n&65535,s=this.stack.length-r*3;if(s<0||e.getGoto(this.stack[s],i,!1)<0){let o=this.findForcedReduction();if(o==null)return!1;n=o}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(n),!0}findForcedReduction(){let{parser:e}=this.p,n=[],r=(i,s)=>{if(!n.includes(i))return n.push(i),e.allActions(i,o=>{if(!(o&393216))if(o&65536){let l=(o>>19)-s;if(l>1){let a=o&65535,u=this.stack.length-l*3;if(u>=0&&e.getGoto(this.stack[u],a,!1)>=0)return l<<19|65536|a}}else{let l=r(o,s+1);if(l!=null)return l}})};return r(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let n=0;n0&&this.emitLookAhead()}}class MS{constructor(e,n){this.tracker=e,this.context=n,this.hash=e.strict?e.hash(n):0}}class jX{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let n=e&65535,r=e>>19;r==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(r-1)*3;let i=this.start.p.parser.getGoto(this.stack[this.base-3],n,!0);this.state=i}}class op{constructor(e,n,r){this.stack=e,this.pos=n,this.index=r,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,n=e.bufferBase+e.buffer.length){return new op(e,n,n-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new op(this.stack,this.pos,this.index)}}function Od(t,e=Uint16Array){if(typeof t!="string")return t;let n=null;for(let r=0,i=0;r=92&&o--,o>=34&&o--;let a=o-32;if(a>=46&&(a-=46,l=!0),s+=a,l)break;s*=46}n?n[i++]=s:n=new e(s)}return n}class Zd{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const RS=new Zd;class HX{constructor(e,n){this.input=e,this.ranges=n,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=RS,this.rangeIndex=0,this.pos=this.chunkPos=n[0].from,this.range=n[0],this.end=n[n.length-1].to,this.readNext()}resolveOffset(e,n){let r=this.range,i=this.rangeIndex,s=this.pos+e;for(;sr.to:s>=r.to;){if(i==this.ranges.length-1)return null;let o=this.ranges[++i];s+=o.from-r.to,r=o}return s}clipPos(e){if(e>=this.range.from&&ee)return Math.max(e,n.from);return this.end}peek(e){let n=this.chunkOff+e,r,i;if(n>=0&&n=this.chunk2Pos&&rl.to&&(this.chunk2=this.chunk2.slice(0,l.to-r)),i=this.chunk2.charCodeAt(0)}}return r>=this.token.lookAhead&&(this.token.lookAhead=r+1),i}acceptToken(e,n=0){let r=n?this.resolveOffset(n,-1):this.pos;if(r==null||r=this.chunk2Pos&&this.posthis.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,n){if(n?(this.token=n,n.start=e,n.lookAhead=e+1,n.value=n.extended=-1):this.token=RS,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e=this.chunkPos&&n<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,n-this.chunkPos);if(e>=this.chunk2Pos&&n<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,n-this.chunk2Pos);if(e>=this.range.from&&n<=this.range.to)return this.input.read(e,n);let r="";for(let i of this.ranges){if(i.from>=n)break;i.to>e&&(r+=this.input.read(Math.max(i.from,e),Math.min(i.to,n)))}return r}}class za{constructor(e,n){this.data=e,this.id=n}token(e,n){let{parser:r}=n.p;WX(this.data,e,n,this.id,r.data,r.tokenPrecTable)}}za.prototype.contextual=za.prototype.fallback=za.prototype.extend=!1;za.prototype.fallback=za.prototype.extend=!1;function WX(t,e,n,r,i,s){let o=0,l=1<0){let p=t[h];if(a.allows(p)&&(e.token.value==-1||e.token.value==p||VX(p,e.token.value,i,s))){e.acceptToken(p);break}}let c=e.next,f=0,d=t[o+2];if(e.next<0&&d>f&&t[u+d*3-3]==65535){o=t[u+d*3-1];continue e}for(;f>1,p=u+h+(h<<1),g=t[p],b=t[p+1]||65536;if(c=b)f=h+1;else{o=t[p+2],e.advance();continue e}}break}}function OS(t,e,n){for(let r=e,i;(i=t[r])!=65535;r++)if(i==n)return r-e;return-1}function VX(t,e,n,r){let i=OS(n,r,e);return i<0||OS(n,r,t)e)&&!r.type.isError)return n<0?Math.max(0,Math.min(r.to-1,e-25)):Math.min(t.length,Math.max(r.from+1,e+25));if(n<0?r.prevSibling():r.nextSibling())break;if(!r.parent())return n<0?0:t.length}}class UX{constructor(e,n){this.fragments=e,this.nodeSet=n,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?PS(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?PS(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(ee)return this.nextStart=o,null;if(s instanceof Fn){if(o==e){if(o=Math.max(this.safeFrom,e)&&(this.trees.push(s),this.start.push(o),this.index.push(0))}else this.index[n]++,this.nextStart=o+s.length}}}class KX{constructor(e,n){this.stream=n,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(r=>new Zd)}getActions(e){let n=0,r=null,{parser:i}=e.p,{tokenizers:s}=i,o=i.stateSlot(e.state,3),l=e.curContext?e.curContext.hash:0,a=0;for(let u=0;uf.end+25&&(a=Math.max(f.lookAhead,a)),f.value!=0)){let d=n;if(f.extended>-1&&(n=this.addActions(e,f.extended,f.end,n)),n=this.addActions(e,f.value,f.end,n),!c.extend&&(r=f,n>d))break}}for(;this.actions.length>n;)this.actions.pop();return a&&e.setLookAhead(a),!r&&e.pos==this.stream.end&&(r=new Zd,r.value=e.p.parser.eofTerm,r.start=r.end=e.pos,n=this.addActions(e,r.value,r.end,n)),this.mainToken=r,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let n=new Zd,{pos:r,p:i}=e;return n.start=r,n.end=Math.min(r+1,i.stream.end),n.value=r==i.stream.end?i.parser.eofTerm:0,n}updateCachedToken(e,n,r){let i=this.stream.clipPos(r.pos);if(n.token(this.stream.reset(i,e),r),e.value>-1){let{parser:s}=r.p;for(let o=0;o=0&&r.p.parser.dialect.allows(l>>1)){l&1?e.extended=l>>1:e.value=l>>1;break}}}else e.value=0,e.end=this.stream.clipPos(i+1)}putAction(e,n,r,i){for(let s=0;se.bufferLength*4?new UX(r,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,n=this.minStackPos,r=this.stacks=[],i,s;if(this.bigReductionCount>300&&e.length==1){let[o]=e;for(;o.forceReduce()&&o.stack.length&&o.stack[o.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let o=0;on)r.push(l);else{if(this.advanceStack(l,r,e))continue;{i||(i=[],s=[]),i.push(l);let a=this.tokens.getMainToken(l);s.push(a.value,a.end)}}break}}if(!r.length){let o=i&&qX(i);if(o)return qr&&console.log("Finish with "+this.stackID(o)),this.stackToTree(o);if(this.parser.strict)throw qr&&i&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+n);this.recovering||(this.recovering=5)}if(this.recovering&&i){let o=this.stoppedAt!=null&&i[0].pos>this.stoppedAt?i[0]:this.runRecovery(i,s,r);if(o)return qr&&console.log("Force-finish "+this.stackID(o)),this.stackToTree(o.forceAll())}if(this.recovering){let o=this.recovering==1?1:this.recovering*3;if(r.length>o)for(r.sort((l,a)=>a.score-l.score);r.length>o;)r.pop();r.some(l=>l.reducePos>n)&&this.recovering--}else if(r.length>1){e:for(let o=0;o500&&u.buffer.length>500)if((l.score-u.score||l.buffer.length-u.buffer.length)>0)r.splice(a--,1);else{r.splice(o--,1);continue e}}}r.length>12&&(r.sort((o,l)=>l.score-o.score),r.splice(12,r.length-12))}this.minStackPos=r[0].pos;for(let o=1;o ":"";if(this.stoppedAt!=null&&i>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let u=e.curContext&&e.curContext.tracker.strict,c=u?e.curContext.hash:0;for(let f=this.fragments.nodeAt(i);f;){let d=this.parser.nodeSet.types[f.type.id]==f.type?s.getGoto(e.state,f.type.id):-1;if(d>-1&&f.length&&(!u||(f.prop(Et.contextHash)||0)==c))return e.useNode(f,d),qr&&console.log(o+this.stackID(e)+` (via reuse of ${s.getName(f.type.id)})`),!0;if(!(f instanceof Fn)||f.children.length==0||f.positions[0]>0)break;let h=f.children[0];if(h instanceof Fn&&f.positions[0]==0)f=h;else break}}let l=s.stateSlot(e.state,4);if(l>0)return e.reduce(l),qr&&console.log(o+this.stackID(e)+` (via always-reduce ${s.getName(l&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let a=this.tokens.getActions(e);for(let u=0;ui?n.push(p):r.push(p)}return!1}advanceFully(e,n){let r=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>r)return NS(e,n),!0}}runRecovery(e,n,r){let i=null,s=!1;for(let o=0;o ":"";if(l.deadEnd&&(s||(s=!0,l.restart(),qr&&console.log(c+this.stackID(l)+" (restarted)"),this.advanceFully(l,r))))continue;let f=l.split(),d=c;for(let h=0;h<10&&f.forceReduce()&&(qr&&console.log(d+this.stackID(f)+" (via force-reduce)"),!this.advanceFully(f,r));h++)qr&&(d=this.stackID(f)+" -> ");for(let h of l.recoverByInsert(a))qr&&console.log(c+this.stackID(h)+" (via recover-insert)"),this.advanceFully(h,r);this.stream.end>l.pos?(u==l.pos&&(u++,a=0),l.recoverByDelete(a,u),qr&&console.log(c+this.stackID(l)+` (via recover-delete ${this.parser.getName(a)})`),NS(l,r)):(!i||i.scoree.topRules[l][1]),i=[];for(let l=0;l=0)s(c,a,l[u++]);else{let f=l[u+-c];for(let d=-c;d>0;d--)s(l[u++],a,f);u++}}}this.nodeSet=new Iw(n.map((l,a)=>Hr.define({name:a>=this.minRepeatTerm?void 0:l,id:a,props:i[a],top:r.indexOf(a)>-1,error:a==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(a)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=wM;let o=Od(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let l=0;ltypeof l=="number"?new za(o,l):l),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,n,r){let i=new XX(this,e,n,r);for(let s of this.wrappers)i=s(i,e,n,r);return i}getGoto(e,n,r=!1){let i=this.goto;if(n>=i[0])return-1;for(let s=i[n+1];;){let o=i[s++],l=o&1,a=i[s++];if(l&&r)return a;for(let u=s+(o>>1);s0}validAction(e,n){return!!this.allActions(e,r=>r==n?!0:null)}allActions(e,n){let r=this.stateSlot(e,4),i=r?n(r):void 0;for(let s=this.stateSlot(e,1);i==null;s+=3){if(this.data[s]==65535)if(this.data[s+1]==1)s=$s(this.data,s+2);else break;i=n($s(this.data,s+1))}return i}nextStates(e){let n=[];for(let r=this.stateSlot(e,1);;r+=3){if(this.data[r]==65535)if(this.data[r+1]==1)r=$s(this.data,r+2);else break;if(!(this.data[r+2]&1)){let i=this.data[r+1];n.some((s,o)=>o&1&&s==i)||n.push(this.data[r],i)}}return n}configure(e){let n=Object.assign(Object.create(lp.prototype),this);if(e.props&&(n.nodeSet=this.nodeSet.extend(...e.props)),e.top){let r=this.topRules[e.top];if(!r)throw new RangeError(`Invalid top rule name ${e.top}`);n.top=r}return e.tokenizers&&(n.tokenizers=this.tokenizers.map(r=>{let i=e.tokenizers.find(s=>s.from==r);return i?i.to:r})),e.specializers&&(n.specializers=this.specializers.slice(),n.specializerSpecs=this.specializerSpecs.map((r,i)=>{let s=e.specializers.find(l=>l.from==r.external);if(!s)return r;let o=Object.assign(Object.assign({},r),{external:s.to});return n.specializers[i]=IS(o),o})),e.contextTracker&&(n.context=e.contextTracker),e.dialect&&(n.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(n.strict=e.strict),e.wrap&&(n.wrappers=n.wrappers.concat(e.wrap)),e.bufferLength!=null&&(n.bufferLength=e.bufferLength),n}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let n=this.dynamicPrecedences;return n==null?0:n[e]||0}parseDialect(e){let n=Object.keys(this.dialects),r=n.map(()=>!1);if(e)for(let s of e.split(" ")){let o=n.indexOf(s);o>=0&&(r[o]=!0)}let i=null;for(let s=0;sr)&&n.p.parser.stateFlag(n.state,2)&&(!e||e.scoret.external(n,r)<<1|e}return t.get}const YX=CM({String:Ge.string,Number:Ge.number,"True False":Ge.bool,PropertyName:Ge.propertyName,Null:Ge.null,", :":Ge.separator,"[ ]":Ge.squareBracket,"{ }":Ge.brace}),JX=lp.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#ClOOQO'#Cr'#CrQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CtOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59W,59WO!iQPO,59WOVQPO,59QOqQPO'#CmO!nQPO,59`OOQO1G.k1G.kOVQPO'#CnO!vQPO,59aOOQO1G.r1G.rOOQO1G.l1G.lOOQO,59X,59XOOQO-E6k-E6kOOQO,59Y,59YOOQO-E6l-E6l",stateData:"#O~OeOS~OQSORSOSSOTSOWQO_ROgPO~OVXOgUO~O^[O~PVO[^O~O]_OVhX~OVaO~O]bO^iX~O^dO~O]_OVha~O]bO^ia~O",goto:"!kjPPPPPPkPPkqwPPPPk{!RPPP!XP!e!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:"⚠ JsonText True False Null Number String } { Object Property PropertyName : , ] [ Array",maxTerm:25,nodeProps:[["isolate",-2,6,11,""],["openedBy",7,"{",14,"["],["closedBy",8,"}",15,"]"]],propSources:[YX],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oe~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Og~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zO]~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yO[~~'OO_~~'TO^~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0}),QX=()=>t=>{try{JSON.parse(t.state.doc.toString())}catch(e){if(!(e instanceof SyntaxError))throw e;const n=ZX(e,t.state.doc);return[{from:n,message:e.message,severity:"error",to:n}]}return[]};function ZX(t,e){let n;return(n=t.message.match(/at position (\d+)/))?Math.min(+n[1],e.length):(n=t.message.match(/at line (\d+) column (\d+)/))?Math.min(e.line(+n[1]).from+ +n[2]-1,e.length):0}const eG=ep.define({name:"json",parser:JX.configure({props:[RM.add({Object:pS({except:/^\s*\}/}),Array:pS({except:/^\s*\]/})}),gK.add({"Object Array":mK})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function _S(){return new oK(eG)}class DS{constructor(e,n,r){this.from=e,this.to=n,this.diagnostic=r}}class yl{constructor(e,n,r){this.diagnostics=e,this.panel=n,this.selected=r}static init(e,n,r){let i=r.facet(ks).markerFilter;i&&(e=i(e,r));let s=e.slice().sort((h,p)=>h.from-p.from||h.to-p.to),o=new Ja,l=[],a=0,u=r.doc.iter(),c=0,f=r.doc.length;for(let h=0;;){let p=h==s.length?null:s[h];if(!p&&!l.length)break;let g,b;if(l.length)g=a,b=l.reduce((w,k)=>Math.min(w,k.to),p&&p.from>g?p.from:1e8);else{if(g=p.from,g>f)break;b=p.to,l.push(p),h++}for(;hw.from||w.to==g))l.push(w),h++,b=Math.min(w.to,b);else{b=Math.min(w.from,b);break}}b=Math.min(b,f);let m=!1;if(l.some(w=>w.from==g&&(w.to==b||b==f))&&(m=g==b,!m&&b-g<10)){let w=g-(c+u.value.length);w>0&&(u.next(w),c=g);for(let k=g;;){if(k>=b){m=!0;break}if(!u.lineBreak&&c+u.value.length>k)break;k=c+u.value.length,c+=u.value.length,u.next()}}let v=pG(l);if(m)o.add(g,g,en.widget({widget:new cG(v),diagnostics:l.slice()}));else{let w=l.reduce((k,x)=>x.markClass?k+" "+x.markClass:k,"");o.add(g,b,en.mark({class:"cm-lintRange cm-lintRange-"+v+w,diagnostics:l.slice(),inclusiveEnd:l.some(k=>k.to>b)}))}if(a=b,a==f)break;for(let w=0;w{if(!(e&&o.diagnostics.indexOf(e)<0))if(!r)r=new DS(i,s,e||o.diagnostics[0]);else{if(o.diagnostics.indexOf(r.diagnostic)<0)return!1;r=new DS(r.from,s,r.diagnostic)}}),r}function tG(t,e){let n=e.pos,r=e.end||n,i=t.state.facet(ks).hideOn(t,n,r);if(i!=null)return i;let s=t.startState.doc.lineAt(e.pos);return!!(t.effects.some(o=>o.is(Hw))||t.changes.touchesRange(s.from,Math.max(s.to,r)))}function nG(t,e){return t.field(Gi,!1)?e:e.concat(on.appendConfig.of(pR))}function rG(t,e){return{effects:nG(t,[Hw.of(e)])}}const Hw=on.define(),cR=on.define(),fR=on.define(),Gi=Os.define({create(){return new yl(en.none,null,null)},update(t,e){if(e.docChanged&&t.diagnostics.size){let n=t.diagnostics.map(e.changes),r=null,i=t.panel;if(t.selected){let s=e.changes.mapPos(t.selected.from,1);r=iu(n,t.selected.diagnostic,s)||iu(n,null,s)}!n.size&&i&&e.state.facet(ks).autoPanel&&(i=null),t=new yl(n,i,r)}for(let n of e.effects)if(n.is(Hw)){let r=e.state.facet(ks).autoPanel?n.value.length?ap.open:null:t.panel;t=yl.init(n.value,r,e.state)}else n.is(cR)?t=new yl(t.diagnostics,n.value?ap.open:null,t.selected):n.is(fR)&&(t=new yl(t.diagnostics,t.panel,n.value));return t},provide:t=>[Py.from(t,e=>e.panel),qe.decorations.from(t,e=>e.diagnostics)]}),iG=en.mark({class:"cm-lintRange cm-lintRange-active"});function sG(t,e,n){let{diagnostics:r}=t.state.field(Gi),i,s=-1,o=-1;r.between(e-(n<0?1:0),e+(n>0?1:0),(a,u,{spec:c})=>{if(e>=a&&e<=u&&(a==u||(e>a||n>0)&&(ehR(t,n,!1)))}const LS=t=>{let e=t.state.field(Gi,!1);return!e||!e.panel?!1:(t.dispatch({effects:cR.of(!1)}),!0)},lG=Ei.fromClass(class{constructor(t){this.view=t,this.timeout=-1,this.set=!0;let{delay:e}=t.state.facet(ks);this.lintTime=Date.now()+e,this.run=this.run.bind(this),this.timeout=setTimeout(this.run,e)}run(){clearTimeout(this.timeout);let t=Date.now();if(tPromise.resolve(r(this.view))),r=>{this.view.state.doc==e.doc&&this.view.dispatch(rG(this.view.state,r.reduce((i,s)=>i.concat(s))))},r=>{vi(this.view.state,r)})}}update(t){let e=t.state.facet(ks);(t.docChanged||e!=t.startState.facet(ks)||e.needsRefresh&&e.needsRefresh(t))&&(this.lintTime=Date.now()+e.delay,this.set||(this.set=!0,this.timeout=setTimeout(this.run,e.delay)))}force(){this.set&&(this.lintTime=Date.now(),this.run())}destroy(){clearTimeout(this.timeout)}});function aG(t,e,n){let r=[],i=-1;for(let s of t)s.then(o=>{r.push(o),clearTimeout(i),r.length==t.length?e(r):i=setTimeout(()=>e(r),200)},n)}const ks=He.define({combine(t){return{sources:t.map(e=>e.source).filter(e=>e!=null),...wA(t.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:$S,tooltipFilter:$S,needsRefresh:(e,n)=>e?n?r=>e(r)||n(r):e:n,hideOn:(e,n)=>e?n?(r,i,s)=>e(r,i,s)||n(r,i,s):e:n,autoPanel:(e,n)=>e||n})}}});function $S(t,e){return t?e?(n,r)=>e(t(n,r),r):t:e}function uG(t,e={}){return[ks.of({source:t,config:e}),lG,pR]}function dR(t){let e=[];if(t)e:for(let{name:n}of t){for(let r=0;rs.toLowerCase()==i.toLowerCase())){e.push(i);continue e}}e.push("")}return e}function hR(t,e,n){var r;let i=n?dR(e.actions):[];return ms("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},ms("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(t):e.message),(r=e.actions)===null||r===void 0?void 0:r.map((s,o)=>{let l=!1,a=h=>{if(h.preventDefault(),l)return;l=!0;let p=iu(t.state.field(Gi).diagnostics,e);p&&s.apply(t,p.from,p.to)},{name:u}=s,c=i[o]?u.indexOf(i[o]):-1,f=c<0?u:[u.slice(0,c),ms("u",u.slice(c,c+1)),u.slice(c+1)],d=s.markClass?" "+s.markClass:"";return ms("button",{type:"button",class:"cm-diagnosticAction"+d,onclick:a,onmousedown:a,"aria-label":` Action: ${u}${c<0?"":` (access key "${i[o]})"`}.`},f)}),e.source&&ms("div",{class:"cm-diagnosticSource"},e.source))}class cG extends gu{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return ms("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class FS{constructor(e,n){this.diagnostic=n,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=hR(e,n,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class ap{constructor(e){this.view=e,this.items=[];let n=i=>{if(!(i.ctrlKey||i.altKey||i.metaKey)){if(i.keyCode==27)LS(this.view),this.view.focus();else if(i.keyCode==38||i.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(i.keyCode==40||i.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(i.keyCode==36)this.moveSelection(0);else if(i.keyCode==35)this.moveSelection(this.items.length-1);else if(i.keyCode==13)this.view.focus();else if(i.keyCode>=65&&i.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:s}=this.items[this.selectedIndex],o=dR(s.actions);for(let l=0;l{for(let s=0;sLS(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(Gi).selected;if(!e)return-1;for(let n=0;n{for(let c of u.diagnostics){if(o.has(c))continue;o.add(c);let f=-1,d;for(let h=r;hr&&(this.items.splice(r,f-r),i=!0)),n&&d.diagnostic==n.diagnostic?d.dom.hasAttribute("aria-selected")||(d.dom.setAttribute("aria-selected","true"),s=d):d.dom.hasAttribute("aria-selected")&&d.dom.removeAttribute("aria-selected"),r++}});r({sel:s.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:l,panel:a})=>{let u=a.height/this.list.offsetHeight;l.topa.bottom&&(this.list.scrollTop+=(l.bottom-a.bottom)/u)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),i&&this.sync()}sync(){let e=this.list.firstChild;function n(){let r=e;e=r.nextSibling,r.remove()}for(let r of this.items)if(r.dom.parentNode==this.list){for(;e!=r.dom;)n();e=r.dom.nextSibling}else this.list.insertBefore(r.dom,e);for(;e;)n()}moveSelection(e){if(this.selectedIndex<0)return;let n=this.view.state.field(Gi),r=iu(n.diagnostics,this.items[e].diagnostic);r&&this.view.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0,effects:fR.of(r)})}static open(e){return new ap(e)}}function fG(t,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,${encodeURIComponent(t)}')`}function Pd(t){return fG(``,'width="6" height="3"')}const dG=qe.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:Pd("#f11")},".cm-lintRange-warning":{backgroundImage:Pd("orange")},".cm-lintRange-info":{backgroundImage:Pd("#999")},".cm-lintRange-hint":{backgroundImage:Pd("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}},"&dark .cm-lintRange-active":{backgroundColor:"#86714a80"},"&dark .cm-panel.cm-panel-lint ul":{"& [aria-selected]":{backgroundColor:"#2e343e"}}});function hG(t){return t=="error"?4:t=="warning"?3:t=="info"?2:1}function pG(t){let e="hint",n=1;for(let r of t){let i=hG(r.severity);i>n&&(n=i,e=r.severity)}return e}const gG=F7(sG,{hideOn:tG}),pR=[Gi,qe.decorations.compute([Gi],t=>{let{selected:e,panel:n}=t.field(Gi);return!e||!n||e.from==e.to?en.none:en.set([iG.range(e.from,e.to)])}),gG,dG],mG=512*1024,zS=512*1024,gR=2e6;function yG(t,e){if(t.length<=e)return t;const n=t.lastIndexOf(` -`,e);return n>e*.5?t.slice(0,n):t.slice(0,e)}const vG=t=>t.state.doc.length>mG?[]:QX()(t);function BS(t){return qp.define([{tag:Ge.propertyName,color:t?"#7dd3fc":"#0369a1"},{tag:Ge.string,color:t?"#86efac":"#15803d"},{tag:Ge.number,color:t?"#fcd34d":"#b45309"},{tag:Ge.bool,color:t?"#d8b4fe":"#7e22ce"},{tag:Ge.null,color:t?"#a1a1aa":"#71717a"}])}const wG=qe.theme({"&":{height:"100%",fontSize:"13px",backgroundColor:"transparent"},"&.cm-focused":{outline:"none"},".cm-scroller":{fontFamily:"inherit",lineHeight:"1.5rem",overflow:"auto"},".cm-gutters":{display:"none"},".cm-activeLine":{backgroundColor:"transparent"},".cm-content":{caretColor:"currentColor",fontFamily:"inherit",letterSpacing:"-0.025em"},".cm-placeholder":{color:"var(--color-muted-foreground)"}});function mR({value:t,onChange:e,editable:n,lintJson:r=!0,dark:i,placeholder:s,testId:o="json-editor",className:l,onReady:a}){const u=y.useRef(null),c=y.useRef(null),f=y.useRef(e);f.current=e;const d=y.useRef(i),h=y.useRef(null),p=y.useRef(null),g=y.useRef(null),b=n??e!==void 0,m=y.useRef(b),v=y.useRef(r),w=t.length>zS,k=y.useRef(w),x=!b&&t.length>gR,C=x?yG(t,zS):t,T=y.useRef(!1),A=y.useCallback((M,N,D)=>M?[qe.updateListener.of(O=>{var L;O.docChanged&&!T.current&&((L=f.current)==null||L.call(f,O.state.doc.toString()))}),...N||!D?[]:[uG(vG,{delay:300})]]:[zt.readOnly.of(!0),qe.editable.of(!1)],[]);return y.useEffect(()=>{const M=u.current;if(!M)return;const N=new Tl,D=new Tl,O=new Tl,L=zt.create({doc:C,extensions:[O.of(w||!r?[]:_S()),qe.lineWrapping,$K(),gM.of([...zX,...KK,BX]),wG,N.of(gS(BS(i))),D.of(A(b,w,r)),...s?[R7(s)]:[]]}),_=new qe({state:L,parent:M});return h.current=N,p.current=D,g.current=O,a==null||a(_),c.current=_,()=>{_.destroy(),c.current=null}},[]),y.useEffect(()=>{const M=c.current;if(!M)return;const N=g.current,D=p.current,O=[];(w!==k.current||r!==v.current)&&(k.current=w,v.current=r,N&&O.push(N.reconfigure(w||!r?[]:_S())),D&&O.push(D.reconfigure(A(b,w,r))));const L=M.state.doc.toString();if(!(L===C&&O.length===0)){T.current=!0;try{M.dispatch({...L!==C?{changes:{from:0,to:M.state.doc.length,insert:C}}:{},...O.length>0?{effects:O}:{}})}finally{T.current=!1}}},[C,w,r,b,A]),y.useEffect(()=>{const M=c.current,N=p.current;!M||!N||b!==m.current&&(m.current=b,M.dispatch({effects:N.reconfigure(A(b,w,r))}))},[b,w,r,A]),y.useEffect(()=>{const M=c.current;if(!M||i===d.current)return;d.current=i;const N=h.current;N&&M.dispatch({effects:N.reconfigure(gS(BS(i)))})},[i]),E.jsxs("div",{"data-testid":o,className:Un("flex min-h-0 flex-1 flex-col overflow-hidden font-mono",l),children:[x?E.jsx("div",{"data-testid":"large-output-preview-banner",role:"status",className:"border-b border-border bg-muted/40 px-5 py-1.5 font-sans text-xs text-muted-foreground",children:"Showing first 512 KB preview in editor — Copy and Download include the full output"}):null,E.jsx("div",{ref:u,className:"min-h-0 flex-1 overflow-hidden px-5 py-4"})]})}function yR({title:t,meta:e,actions:n,status:r,children:i}){return E.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:[E.jsxs("div",{className:"flex min-h-[42px] flex-shrink-0 flex-wrap items-center justify-between gap-x-2 gap-y-1.5 border-b border-border px-3.5 py-2 max-md:gap-2 md:min-h-12 md:py-1.5 md:pr-2.5 md:pl-3.5 lg:gap-x-3 lg:pr-3 lg:pl-5",children:[E.jsxs("div",{className:"flex items-center gap-2 lg:gap-3",children:[E.jsx("span",{className:"font-mono text-[11px] font-semibold tracking-[0.18em] text-muted-foreground",children:t}),e?E.jsx("span",{"data-testid":"pane-meta",className:"text-xs tabular-nums text-muted-foreground/70",children:e}):null]}),E.jsx("div",{className:"flex min-w-0 flex-wrap items-center gap-0.5 max-md:gap-1",children:n})]}),E.jsx("div",{className:"flex min-h-0 flex-1 flex-col",children:i}),r?E.jsxs("div",{"data-testid":"pane-status",className:r.kind==="error"?"flex-shrink-0 px-3.5 pb-2 text-xs text-destructive":"flex-shrink-0 whitespace-pre-line px-3.5 pb-2 text-xs text-muted-foreground",role:"status",children:[r.message,r.action]}):null]})}const kl="inline-flex h-7 cursor-pointer items-center gap-1.5 rounded-md px-2 text-[13px] font-medium text-muted-foreground transition-colors outline-none hover:bg-muted hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-40 [&_svg]:size-3.5";var Hy={exports:{}};(function(t,e){(function(){var n="We could not detect the separator.",r="Empty CSV. Please provide something.",i="Could not detect header. Ensure first row cotains your column headers.",s=[",",";"," "],o=!0,l={",":"comma",";":"semicolon"," ":"tab","|":"pipe"};function a(d){var h={},p;return s.forEach(function(g,b){var m=new RegExp(g,"g");h[g]=(d.match(m)||[]).length,p=!p||h[g]>h[p]?g:p}),p}function u(d){for(var h={},p=0;p=0;p--){var g=d[p];h[g]>0&&(g=g+"__"+h[g]--),b.unshift(g)}return b}function c(d,h){if(h||(h={}),d.length==0)throw r;var p=h.separator||a(d);if(!p)throw n;var g=[];try{o=h.trim!==!1;var g=f.parse(d,l[p])}catch(se){var b=d.lastIndexOf(` -`,se.offset),m=d.indexOf(` -`,se.offset),v=d.substring(b>=-1?b:0,m>-1?m:d.length);throw se.message+" On line "+se.line+" and column "+se.column+`. -`+v}if(h.transpose){for(var w=0,k=0;kw&&(w=g[k].length);for(var x=new Array(w),C=0;Cv&&(v=m,w=[]),w.push(R))}function x(){var R,I,P,B;return P=m,B=m,R=function(q){return re=","}()?"":null,R!==null?(I=M(),I!==null?R=[R,I]:(R=null,m=B)):(R=null,m=B),R!==null&&(R=function(q,W){return W}(P,R[1])),R===null&&(m=P),R}function C(){var R,I,P,B;return P=m,B=m,R=function(q){return re=";"}()?"":null,R!==null?(I=M(),I!==null?R=[R,I]:(R=null,m=B)):(R=null,m=B),R!==null&&(R=function(q,W){return W}(P,R[1])),R===null&&(m=P),R}function T(){var R,I,P,B;return P=m,B=m,R=function(q){return re="|"}()?"":null,R!==null?(I=M(),I!==null?R=[R,I]:(R=null,m=B)):(R=null,m=B),R!==null&&(R=function(q,W){return W}(P,R[1])),R===null&&(m=P),R}function A(){var R,I,P,B;return P=m,B=m,R=function(q){return re=" "}()?"":null,R!==null?(I=M(),I!==null?R=[R,I]:(R=null,m=B)):(R=null,m=B),R!==null&&(R=function(q,W){return W}(P,R[1])),R===null&&(m=P),R}function M(){var R,I,P,B,q,W,ye,ee,me;for(W=m,ye=m,R=[],/^[\n\r]/.test(p.charAt(m))?(I=p.charAt(m),m++):(I=null,k("[\\n\\r]"));I!==null;)R.push(I),/^[\n\r]/.test(p.charAt(m))?(I=p.charAt(m),m++):(I=null,k("[\\n\\r]"));if(R!==null)if(I=N(),I!==null){if(P=[],ee=m,me=m,/^[\n\r]/.test(p.charAt(m))?(q=p.charAt(m),m++):(q=null,k("[\\n\\r]")),q!==null)for(B=[];q!==null;)B.push(q),/^[\n\r]/.test(p.charAt(m))?(q=p.charAt(m),m++):(q=null,k("[\\n\\r]"));else B=null;for(B!==null?(q=N(),q!==null?B=[B,q]:(B=null,m=me)):(B=null,m=me),B!==null&&(B=function(Le,Ue){return Ue}(ee,B[1])),B===null&&(m=ee);B!==null;){if(P.push(B),ee=m,me=m,/^[\n\r]/.test(p.charAt(m))?(q=p.charAt(m),m++):(q=null,k("[\\n\\r]")),q!==null)for(B=[];q!==null;)B.push(q),/^[\n\r]/.test(p.charAt(m))?(q=p.charAt(m),m++):(q=null,k("[\\n\\r]"));else B=null;B!==null?(q=N(),q!==null?B=[B,q]:(B=null,m=me)):(B=null,m=me),B!==null&&(B=function(Le,Ue){return Ue}(ee,B[1])),B===null&&(m=ee)}if(P!==null){for(B=[],/^[\n\r]/.test(p.charAt(m))?(q=p.charAt(m),m++):(q=null,k("[\\n\\r]"));q!==null;)B.push(q),/^[\n\r]/.test(p.charAt(m))?(q=p.charAt(m),m++):(q=null,k("[\\n\\r]"));B!==null?R=[R,I,P,B]:(R=null,m=ye)}else R=null,m=ye}else R=null,m=ye;else R=null,m=ye;return R!==null&&(R=function(Le,Ue,ze){return ze.unshift(Ue),ze}(W,R[1],R[2])),R===null&&(m=W),R}function N(){var R,I,P,B,q,W,ye,ee,me;if(W=m,ye=m,R=D(),R!==null){for(I=[],ee=m,me=m,p.length>m?(P=p.charAt(m),m++):(P=null,k("any character")),P!==null?(B=function(Le,Ue){return Ue==re}(m,P)?"":null,B!==null?(q=D(),q!==null?P=[P,B,q]:(P=null,m=me)):(P=null,m=me)):(P=null,m=me),P!==null&&(P=function(Le,Ue,ze){return ze}(ee,P[0],P[2])),P===null&&(m=ee);P!==null;)I.push(P),ee=m,me=m,p.length>m?(P=p.charAt(m),m++):(P=null,k("any character")),P!==null?(B=function(Le,Ue){return Ue==re}(m,P)?"":null,B!==null?(q=D(),q!==null?P=[P,B,q]:(P=null,m=me)):(P=null,m=me)):(P=null,m=me),P!==null&&(P=function(Le,Ue,ze){return ze}(ee,P[0],P[2])),P===null&&(m=ee);I!==null?(P=function(Le,Ue,ze){return!!Ue||ze.length}(m,R,I)?"":null,P!==null?R=[R,I,P]:(R=null,m=ye)):(R=null,m=ye)}else R=null,m=ye;return R!==null&&(R=function(Le,Ue,ze){return ze.unshift(Ue),ze}(W,R[0],R[1])),R===null&&(m=W),R}function D(){var R,I,P,B,q,W;if(B=m,q=m,p.charCodeAt(m)===34?(R='"',m++):(R=null,k('"\\""')),R!==null){for(I=[],P=O();P!==null;)I.push(P),P=O();I!==null?(p.charCodeAt(m)===34?(P='"',m++):(P=null,k('"\\""')),P!==null?R=[R,I,P]:(R=null,m=q)):(R=null,m=q)}else R=null,m=q;if(R!==null&&(R=function(ye,ee){return ee.join("")}(B,R[1])),R===null&&(m=B),R===null){for(B=m,R=[],q=m,W=m,/^[^\n\r]/.test(p.charAt(m))?(I=p.charAt(m),m++):(I=null,k("[^\\n\\r]")),I!==null?(P=function(ye,ee){return ee!=re}(m,I)?"":null,P!==null?I=[I,P]:(I=null,m=W)):(I=null,m=W),I!==null&&(I=function(ye,ee){return ee}(q,I[0])),I===null&&(m=q);I!==null;)R.push(I),q=m,W=m,/^[^\n\r]/.test(p.charAt(m))?(I=p.charAt(m),m++):(I=null,k("[^\\n\\r]")),I!==null?(P=function(ye,ee){return ee!=re}(m,I)?"":null,P!==null?I=[I,P]:(I=null,m=W)):(I=null,m=W),I!==null&&(I=function(ye,ee){return ee}(q,I[0])),I===null&&(m=q);R!==null&&(R=function(ye,ee){return(o?ee.join("").trim():ee.join("")).replace(/(^")|("$)/g,"")}(B,R)),R===null&&(m=B)}return R}function O(){var R,I,P,B;return P=m,B=m,p.charCodeAt(m)===34?(R='"',m++):(R=null,k('"\\""')),R!==null?(p.charCodeAt(m)===34?(I='"',m++):(I=null,k('"\\""')),I!==null?R=[R,I]:(R=null,m=B)):(R=null,m=B),R!==null&&(R=function(q){return'"'}()),R===null&&(m=P),R===null&&(/^[^"]/.test(p.charAt(m))?(R=p.charAt(m),m++):(R=null,k('[^"]'))),R}function L(R){R.sort();for(var I=null,P=[],B=0;B=2)try{return{ok:!0,value:JSON.parse(e)}}catch{return{ok:!1}}return{ok:!1}}function qi(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function RG(t){return t===null||typeof t=="string"||typeof t=="number"||typeof t=="boolean"}function OG(t){const e=(r,i,s)=>{for(const[o,l]of Object.entries(r)){const a=i?`${i}.${o}`:o;qi(l)&&Object.keys(l).length>0?e(l,a,s):Array.isArray(l)?s[a]=l.map(n):s[a]=l}},n=r=>{if(!qi(r))return r;const i={};return e(r,"",i),i};return Array.isArray(t)?t.map(n):qi(t)?n(t):t}function PG(t){const e=n=>{if(!qi(n))return n;const r={};for(const[i,s]of Object.entries(n))Array.isArray(s)&&s.length>0&&s.every(RG)?r[i]=s.join(", "):Array.isArray(s)?r[i]=s.map(e):r[i]=s;return r};return Array.isArray(t)?t.map(e):qi(t)?e(t):t}function NG(t){const e=t.trim().toLowerCase();return e==="true"||e==="1"||e==="yes"?!0:e==="false"||e==="0"||e==="no"?!1:t}function IG(t,e,n){if(n==="string")return t;if(n==="number")return HS(t);if(n==="boolean")return NG(t);if(e.parseJSON){const r=MG(t);if(r.ok&&typeof r.value!="number")return r.value}return e.parseNumbers?HS(t):t}function _G(t,e){const n=i=>{var o;const s={};for(const l of Object.keys(i)){const a=i[l];if(typeof a!="string"){s[l]=a;continue}if(e.emptyFields==="skip"&&a==="")continue;if(e.nullLiterals==="null"&&a==="NULL"){s[l]=null;continue}const u=(o=e.columnTypes)==null?void 0:o[l],c=IG(a,e,u);s[l]=c}return s};if(Array.isArray(t))return t.map(i=>qi(i)?n(i):i);const r={};for(const[i,s]of Object.entries(t))r[i]=qi(s)?n(s):s;return r}const DG=/^([^.[\]]+)(?:\.(0|[1-9]\d*)|\[(0|[1-9]\d*)\])(?:\.(.+))?$/;function wR(t){const e=DG.exec(t);if(!e)return null;const n=e[1],r=e[2],i=e[3],s=e[4],o=Number(r??i);return Number.isSafeInteger(o)?{column:t,prefix:n,index:o,notation:r!==void 0?"dot":"bracket",...s!==void 0?{subKey:s}:{}}:null}function Vy(t){const e=new Set(t),n=new Map;for(const i of t){const s=wR(i);if(!s)continue;const o=n.get(s.prefix);o?o.push(s):n.set(s.prefix,[s])}const r=[];for(const[i,s]of n.entries()){if(e.has(i))continue;const o=s[0].subKey!==void 0,l=s[0].notation;if(s.some(h=>h.subKey!==void 0!==o||h.notation!==l))continue;const a=new Set;let u=!1;for(const h of s){const p=`${h.index}:${h.subKey??""}`;if(a.has(p)){u=!0;break}a.add(p)}if(u)continue;const c=Array.from(new Set(s.map(h=>h.index))).sort((h,p)=>h-p);if(c.length<2)continue;const f=c[0];f!==0&&f!==1||!c.every((h,p)=>h===f+p)||r.push({prefix:i,indices:c,columns:s.map(h=>h.column)})}return r}function WS(t,e){return t===void 0||t===""||e==="skip"&&t===null}function VS(t,e,n,r){const i=new Map,s=new Set,o=new Map;for(const a of n)if(a.columns.length!==0){i.set(a.columns[0],a);for(const u of a.columns)s.add(u);o.set(a.prefix,a.columns.map(u=>wR(u)).filter(u=>u!==null))}const l={};for(const a of e){const u=i.get(a);if(u){const c=o.get(u.prefix)??[];if(c.some(d=>d.subKey!==void 0)){const d=new Map;for(const p of c){const g=d.get(p.index);g?g.push(p):d.set(p.index,[p])}const h=[];for(const p of u.indices){const g=d.get(p)??[],b={};for(const m of g){if(!m.subKey)continue;const v=t[m.column];WS(v,r)||(b[m.subKey]=v)}Object.keys(b).length>0&&h.push(b)}if(h.length===0&&r==="skip")continue;l[u.prefix]=h}else{const d=new Map;for(const p of c)d.set(p.index,p.column);const h=[];for(const p of u.indices){const g=d.get(p);if(!g)continue;const b=t[g];WS(b,r)||h.push(b)}if(h.length===0&&r==="skip")continue;l[u.prefix]=h}continue}s.has(a)||Object.prototype.hasOwnProperty.call(t,a)&&(l[a]=t[a])}return l}function LG(t,e,n){if(Array.isArray(t)&&Array.isArray(e)){const r=t[0];if(!qi(r))return e;const i=Object.keys(r),s=Vy(i);return s.length===0?e:e.map(o=>qi(o)?VS(o,i,s,n):o)}if(!Array.isArray(t)&&!Array.isArray(e)){const r=Object.values(t)[0];if(!qi(r))return e;const i=Object.keys(r),s=Vy(i);if(s.length===0)return e;const o={};for(const[l,a]of Object.entries(e))o[l]=qi(a)?VS(a,i,s,n):a;return o}return e}function US(t,e={}){const n={parseNumbers:e.parseNumbers??!0,parseJSON:e.parseJSON??!1,emptyFields:e.emptyFields??"keep",nullLiterals:e.nullLiterals??"string",columnTypes:e.columnTypes},r=t.startsWith(jS)?t.slice(jS.length):t,i=e.separator===void 0?Bp(r,e.markdownTableIndex??0):null,s=i?i.cleanedCsv:r;try{const o=xG(s,{...e,parseNumbers:!1,parseJSON:!1,trim:!1}),l=_G(o,n);return e.collapseIndexedArrays!==!1&&!e.transpose?LG(o,l,n.emptyFields):l}catch(o){throw new Error(vR(o))}}function $G(t,e={}){try{const n=e.flatten?PG(OG(t)):t;return SG(n,e)}catch(n){const r=vR(n);throw EG.some(i=>r.startsWith(i))?new CG(TG(r,e.flatten??!1)):new Error(r)}}function FG(t,e={}){return JSON.stringify(t,null,e.minify?void 0:2)}const Yr={separator:"auto",parseNumbers:!0,parseJSON:!0,emptyFields:"keep",nullLiterals:"string",transpose:!1,hash:!1,minify:!1,flatten:!1,collapseIndexedArrays:!0},KS=["data","items","results","records","rows"];function Tc(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function bR(t){const e=t.trim();if(e===""||!e.startsWith("{"))return[];let n;try{n=JSON.parse(e)}catch{return[]}if(!Tc(n))return[];const r=Object.keys(n),i=new Set(KS),s=[...KS.filter(l=>r.includes(l)),...r.filter(l=>!i.has(l))],o=[];for(const l of s){const a=n[l];Array.isArray(a)&&a.length>0&&a.every(u=>Tc(u))&&o.push({key:l,rowCount:a.length,unwrappedJson:JSON.stringify(a,null,2)})}return o}function Ww(t){const e=t.split(/\r?\n/).map(r=>r.trim()).filter(r=>r.length>0);if(e.length<2)return null;const n=[];for(const r of e)try{const i=JSON.parse(r);if(typeof i!="object"||i===null)return null;n.push(i)}catch{return null}return n}function zG(t){const e=t.trim();if(e==="")return null;let n;try{n=JSON.parse(e)}catch{const i=Ww(e);if(i===null)return null;n=i}const r=JSON.stringify(n,null,2);return e===r?{label:"Minify",nextInput:JSON.stringify(n)}:{label:"Format",nextInput:r}}function BG(t){const e=t.trim();if(e==="")return[];let n;try{n=JSON.parse(e)}catch{const o=Ww(e);if(o===null)return[];n=o}let r=[];if(Array.isArray(n)){if(n.length===0||!n.every(o=>Tc(o)))return[];r=n}else if(Tc(n)){if(bR(e).length>0)return[];r=[n]}else return[];const i=new Set,s=r.slice(0,50);for(const o of s)for(const[l,a]of Object.entries(o))(Tc(a)||Array.isArray(a)&&a.length>0)&&i.add(l);return Array.from(i)}function jG(t){const e=n=>{const r=new Set;for(const i of n)i&&typeof i=="object"&&!Array.isArray(i)&&Object.keys(i).forEach(s=>r.add(s));return r};if(Array.isArray(t))return{rows:t.length,cols:e(t).size};if(t&&typeof t=="object"){const n=Object.values(t);return{rows:n.length,cols:e(n).size}}return{rows:0,cols:0}}const XS=t=>t==="auto"?void 0:t;function HG(t){let e=!1,n=1;for(let r=0;r0;return i.rowWidths.forEach((o,l)=>{if(s&&l===i.rowWidths.length-1)return;const a=i.rows[l];o===1&&a[0]===""||o!==i.headers.length&&n.push(o0?{warnings:f}:{}}}let r;try{r=JSON.parse(e)}catch(l){const a=Ww(e);if(a!==null)r=a;else return{ok:!1,error:`Invalid JSON — ${l instanceof Error?l.message:String(l)}`}}const i=XS(n.separator),s=$G(r,{separator:i,flatten:n.flatten}),o=mf(s,i);return{ok:!0,text:s,rows:o.rows.length,cols:o.headers.length}}catch(r){return{ok:!1,error:r instanceof Error?r.message:String(r)}}}function UG(){return E.jsx("svg",{"data-testid":"reading-spinner",className:"animate-spin",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,"aria-label":"Reading file",children:E.jsx("path",{d:"M21 12a9 9 0 1 1-6.2-8.56",strokeLinecap:"round"})})}function Xu({label:t,testId:e,onClick:n,disabled:r,Icon:i,keepLabelOnMobile:s=!1}){return E.jsxs("button",{type:"button","data-testid":e,"aria-label":t,disabled:r,onClick:n,title:t,className:kl,children:[i?E.jsx(i,{"aria-hidden":"true"}):null,i&&!s?E.jsx("span",{className:"hidden xl:inline",children:t}):t]})}function KG(t){const e=Math.min(t.length,65536);let n=!1,r=0;for(let i=0;i=3))return t.slice(0,i+1)}return t.slice(0,e)}function XG(t){const e=t.slice(0,3).map(r=>`.${r}`).join(", "),n=t.length-3;return n>0?`${e}, +${n} more`:e}function GG({format:t,input:e,onInputChange:n,onFile:r,onTryExample:i,onClear:s,onCopy:o,onCopySelection:l,onDownload:a,filename:u,reading:c,meta:f,error:d,notice:h,dark:p,delimiter:g,onCellCommit:b,canUndo:m=!1,canRedo:v=!1,onUndo:w,onRedo:k,onProjectedCsvChange:x,collapseIndexedArrays:C=!0,onToggleCollapseIndexedArrays:T,columnTypes:A,onChangeColumnTypes:M,flatten:N=!1,onToggleFlatten:D,selectedMarkdownTableIndex:O,onSelectMarkdownTableIndex:L}){const[_,re]=y.useState(!1),[ie,se]=y.useState(!1),[H,X]=y.useState({forInput:"",index:0}),R=y.useRef(0),I=y.useRef(null),P=e.trim()==="",B=t==="CSV",q=y.useMemo(()=>!B||P||g!==void 0?[]:QE(e),[B,P,e,g]),W=O!==void 0?O:H.forInput===e?H.index:0,ye=q.length===0?0:Math.min(Math.max(0,W),q.length-1),ee=q[ye]??null,me=Y=>{X({forInput:e,index:Y}),L==null||L(Y)},Le=y.useMemo(()=>{if(!B||P)return[];const Y=ee?ee.cleanedCsv:e,Se=KG(Y),Ne=mf(Se,g);return Vy(Ne.headers.map(Ce=>Ce.trim()))},[B,P,e,g,ee]),Ue=y.useMemo(()=>B||P?[]:bR(e),[B,P,e]),ze=y.useMemo(()=>B||P?[]:BG(e),[B,P,e]),Mt=y.useMemo(()=>B||P?null:zG(e),[B,P,e]),tt=Y=>{var Se;Y.preventDefault(),Array.from(((Se=Y.dataTransfer)==null?void 0:Se.types)??[]).includes("Files")&&(R.current++,se(!0))},Be=()=>{R.current=Math.max(0,R.current-1),R.current===0&&se(!1)},ue=Y=>{var Ne,Ce;Y.preventDefault(),R.current=0,se(!1);const Se=(Ce=(Ne=Y.dataTransfer)==null?void 0:Ne.files)==null?void 0:Ce[0];Se&&r(Se,"drop")},Nt=Y=>{var Ne;if(!P||Y.defaultPrevented||Y.target instanceof HTMLTextAreaElement||Y.target instanceof HTMLInputElement)return;const Se=(Ne=Y.clipboardData)==null?void 0:Ne.getData("text/plain");Se&&(Y.preventDefault(),n(Se))},be=B?E.jsxs("span",{"data-testid":"view-mode",role:"group","aria-label":"View mode",className:"inline-flex items-center gap-0.5 rounded-lg border border-border bg-muted/60 p-0.5",children:[E.jsxs("button",{type:"button","data-testid":"view-table","aria-pressed":!_,onClick:()=>re(!1),className:Un("inline-flex cursor-pointer items-center gap-1 rounded-[7px] px-2 py-1 text-xs font-medium transition-all outline-none focus-visible:ring-3 focus-visible:ring-ring/50 lg:px-2.5",_?"text-muted-foreground hover:text-foreground":"bg-background text-foreground shadow-sm"),children:[E.jsx(PI,{"aria-hidden":"true",className:"size-3.5 md:hidden lg:inline"}),"Table"]}),E.jsxs("button",{type:"button","data-testid":"raw-toggle","aria-pressed":_,onClick:()=>re(!0),className:Un("inline-flex cursor-pointer items-center gap-1 rounded-[7px] px-2 py-1 text-xs font-medium transition-all outline-none focus-visible:ring-3 focus-visible:ring-ring/50 lg:px-2.5",_?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[E.jsx(bb,{"aria-hidden":"true",className:"size-3.5 md:hidden lg:inline"}),"Raw"]})]}):null,xe=c&&u?E.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[E.jsx(UG,{})," ",u]}):u?f?`${u} · ${f}`:u:f;return E.jsx("div",{"data-testid":"input-pane",onDragEnter:tt,onDragOver:Y=>Y.preventDefault(),onDragLeave:Be,onDrop:ue,onPaste:Nt,"data-drag-over":ie||void 0,className:"relative flex min-h-0 min-w-0 flex-1 flex-col",children:E.jsxs(yR,{title:t,meta:xe,actions:E.jsxs(E.Fragment,{children:[be,B&&(m||v)?E.jsxs(E.Fragment,{children:[E.jsx("button",{type:"button","data-testid":"csv-undo-button","aria-label":"Undo",title:"Undo",disabled:!m,onClick:()=>w==null?void 0:w(),className:kl,children:E.jsx(FI,{"aria-hidden":"true"})}),E.jsx("button",{type:"button","data-testid":"csv-redo-button","aria-label":"Redo",title:"Redo",disabled:!v,onClick:()=>k==null?void 0:k(),className:kl,children:E.jsx(bI,{"aria-hidden":"true"})})]}):null,Mt?E.jsx(Xu,{label:Mt.label,testId:"json-format-toggle",onClick:()=>n(Mt.nextInput),Icon:bb,keepLabelOnMobile:!0}):null,E.jsx("input",{ref:I,type:"file","data-testid":"file-input",accept:B?".csv,.tsv,.txt,.md,text/csv,text/tab-separated-values,text/markdown":".json,.jsonl,.ndjson,.txt,application/json,application/x-ndjson",className:"hidden",onChange:Y=>{var Ne;const Se=(Ne=Y.target.files)==null?void 0:Ne[0];Se&&r(Se,"picker"),Y.target.value=""}}),E.jsx(Xu,{label:"Upload",testId:"upload",onClick:()=>{var Y;return(Y=I.current)==null?void 0:Y.click()},Icon:AT}),E.jsx(Xu,{label:"Copy",testId:"copy-input",onClick:o,Icon:Wv}),E.jsx(Xu,{label:"Clear",testId:"clear-input",onClick:s,disabled:P,Icon:Eh}),E.jsx(Xu,{label:"Download",testId:"download-input",onClick:a,disabled:P,Icon:ET})]}),status:d?{kind:"error",message:d}:h?{kind:"notice",message:h}:null,children:[P?E.jsx(dV,{format:t,onIngest:n,onBrowse:()=>{var Y;return(Y=I.current)==null?void 0:Y.click()},onTryExample:i}):B?E.jsxs(E.Fragment,{children:[ee?E.jsxs("div",{"data-testid":"csv-markdown-table-bar",className:"flex flex-shrink-0 flex-wrap items-center justify-between gap-1.5 border-b border-border bg-muted/30 px-3.5 py-1.5",children:[q.length>=2?E.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[E.jsx("span",{className:"text-xs text-muted-foreground",children:`${q.length} tables detected:`}),q.map(Y=>{const Se=Y.index===ye,Ne=Y.title??Y.headers.slice(0,2).join(", ");return E.jsx("button",{type:"button","data-testid":`csv-markdown-table-select-${Y.index}`,"aria-pressed":Se,onClick:()=>me(Y.index),className:Un("inline-flex cursor-pointer items-center gap-1 rounded-md border px-2 py-0.5 font-mono text-xs font-medium shadow-2xs transition-colors outline-none focus-visible:ring-3 focus-visible:ring-ring/50",Se?"border-foreground/30 bg-background text-foreground ring-1 ring-foreground/15":"border-border bg-muted/60 text-muted-foreground hover:bg-muted hover:text-foreground"),children:`${Y.index+1}. ${Ne} (${Y.rows}×${Y.cols})`},Y.index)})]}):E.jsx("span",{className:"text-xs text-muted-foreground",children:ee.kind==="box"?"ASCII CLI box table detected:":"Markdown pipe table detected:"}),E.jsx("button",{type:"button","data-testid":"csv-clean-markdown-pill",onClick:()=>n(ee.cleanedCsv),className:"inline-flex cursor-pointer items-center gap-1 rounded-md border border-border bg-background px-2 py-0.5 font-mono text-xs font-medium text-foreground shadow-2xs transition-colors hover:bg-muted outline-none focus-visible:ring-3 focus-visible:ring-ring/50",children:q.length>=2?`Use only this table (${ee.rows} ${ee.rows===1?"row":"rows"})`:ee.kind==="box"?`Clean CLI table (${ee.rows} ${ee.rows===1?"row":"rows"})`:`Clean Markdown table (${ee.rows} ${ee.rows===1?"row":"rows"})`})]}):null,Le.length>0?E.jsxs("div",{"data-testid":"csv-indexed-array-bar",className:"flex flex-shrink-0 flex-wrap items-center justify-between gap-1.5 border-b border-border bg-muted/30 px-3.5 py-1.5",children:[E.jsx("span",{className:"text-xs text-muted-foreground",children:`Indexed columns (${Le.map(Y=>`${Y.prefix}[${Y.indices.length}]`).join(", ")}):`}),E.jsx("button",{type:"button","data-testid":"csv-indexed-array-pill","aria-pressed":C,onClick:()=>T==null?void 0:T(),className:Un("inline-flex cursor-pointer items-center gap-1 rounded-md border px-2 py-0.5 font-mono text-xs font-medium shadow-2xs transition-colors outline-none focus-visible:ring-3 focus-visible:ring-ring/50",C?"border-border bg-background text-foreground hover:bg-muted":"border-border bg-muted/60 text-muted-foreground hover:bg-muted hover:text-foreground"),children:C?"Arrays: .0, .1 → []":"Keep flat keys (.0, .1)"})]}):null,_?E.jsx("textarea",{"data-testid":"input-editor",value:e,onChange:Y=>n(Y.target.value),spellCheck:!1,className:"min-h-0 flex-1 resize-none bg-transparent px-5 py-4 font-mono text-[13px] leading-6 tracking-tight focus:outline-none"}):E.jsx(tA,{text:ee?ee.cleanedCsv:e,delimiter:g,testId:"input-table",dark:p,onCellCommit:b,onUndo:w,onRedo:k,onCopySelection:l,columnTypes:A,onChangeColumnTypes:M,onProjectedCsvChange:x})]}):E.jsxs(E.Fragment,{children:[Ue.length>0?E.jsxs("div",{"data-testid":"json-unwrap-bar",className:"flex flex-shrink-0 flex-wrap items-center gap-1.5 border-b border-border bg-muted/30 px-3.5 py-1.5",children:[E.jsx("span",{className:"text-xs text-muted-foreground",children:"Nested array detected:"}),Ue.map(Y=>E.jsx("button",{type:"button","data-testid":`json-unwrap-pill-${Y.key}`,onClick:()=>n(Y.unwrappedJson),className:"inline-flex cursor-pointer items-center gap-1 rounded-md border border-border bg-background px-2 py-0.5 font-mono text-xs font-medium text-foreground shadow-2xs transition-colors outline-none hover:bg-muted focus-visible:ring-3 focus-visible:ring-ring/50",children:`Unwrap .${Y.key} (${Y.rowCount} ${Y.rowCount===1?"row":"rows"})`},Y.key))]}):null,ze.length>0?E.jsxs("div",{"data-testid":"json-flatten-bar",className:"flex flex-shrink-0 flex-wrap items-center justify-between gap-1.5 border-b border-border bg-muted/30 px-3.5 py-1.5",children:[E.jsx("span",{className:"text-xs text-muted-foreground",children:`Nested keys (${ze.length}):`}),E.jsx("button",{type:"button","data-testid":"json-flatten-pill","aria-pressed":N,onClick:()=>D==null?void 0:D(),className:Un("inline-flex cursor-pointer items-center gap-1 rounded-md border px-2 py-0.5 font-mono text-xs font-medium shadow-2xs transition-colors outline-none focus-visible:ring-3 focus-visible:ring-ring/50",N?"border-border bg-background text-foreground hover:bg-muted":"border-border bg-muted/60 text-muted-foreground hover:bg-muted hover:text-foreground"),children:`${N?"Flattened":"Flatten"} nested keys (${XG(ze)})`})]}):null,E.jsx(mR,{value:e,onChange:n,dark:p,testId:"input-editor"})]}),ie?E.jsx("div",{"aria-hidden":"true",className:"pointer-events-none absolute inset-3 z-10 flex items-center justify-center rounded-xl border-2 border-dashed border-primary/50 bg-background/80 backdrop-blur-sm",children:E.jsx("p",{className:"text-sm font-medium text-foreground",children:"Drop file to import"})}):null]})})}const qG=/\.(csv|tsv|txt|json|jsonl|ndjson|md|log)$/i;function YG(t){return t.type.startsWith("text/")||t.type==="application/json"?!0:qG.test(t.name)}const JG=[{value:"utf-8",label:"UTF-8"},{value:"windows-1252",label:"Windows-1252"}];async function GS(t,e){const n=t.stream().getReader();let r="";try{const i=[];let s=0;for(;s<2;){const{done:u,value:c}=await n.read();if(u)break;c&&c.byteLength>0&&(i.push(c),s+=c.byteLength)}let o=null;if(i.length===1)o=i[0];else if(i.length>1){o=new Uint8Array(s);let u=0;for(const c of i)o.set(c,u),u+=c.byteLength}let l=e;e==="utf-8"&&o&&o.byteLength>=2&&(o[0]===255&&o[1]===254?l="utf-16le":o[0]===254&&o[1]===255&&(l="utf-16be"));const a=new TextDecoder(l,{fatal:!1});for(o&&(r+=a.decode(o,{stream:!0}));;){const{done:u,value:c}=await n.read();if(u)break;r+=a.decode(c,{stream:!0})}return r+a.decode()}finally{n.releaseLock()}}function xR(t){const[e,n]=y.useState(()=>typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia(t).matches);return y.useEffect(()=>{if(typeof window.matchMedia!="function")return;const r=window.matchMedia(t),i=s=>n(s.matches);return n(r.matches),r.addEventListener("change",i),()=>r.removeEventListener("change",i)},[t]),e}const kR=[{value:"auto",label:"Auto-detect"},{value:",",label:"Comma"},{value:";",label:"Semicolon"},{value:" ",label:"Tab"},{value:"|",label:"Pipe"}];function qS(){return E.jsx("div",{className:"hidden h-5 w-px shrink-0 bg-border fit:block","aria-hidden":"true"})}function QG(t,e){var i;const r=[e.separator==="auto"?"Auto":((i=kR.find(s=>s.value===e.separator))==null?void 0:i.label)??"Auto"];return t==="csv2json"?(e.parseNumbers&&r.push("Parse numbers"),e.parseJSON&&r.push("Parse JSON"),e.emptyFields==="skip"&&r.push("Skip empty"),e.nullLiterals==="null"&&r.push("NULL→null"),e.transpose&&r.push("Transpose"),e.hash&&r.push("Hash"),e.minify&&r.push("Minify")):e.flatten&&r.push("Flatten"),r.join(" · ")}function YS(){return"h-7 cursor-pointer appearance-none rounded-md border border-border bg-background py-0 pl-2.5 pr-6 text-[13px] font-medium text-foreground transition-colors outline-none hover:bg-muted focus-visible:ring-3 focus-visible:ring-ring/50"}function JS(){return E.jsx("svg",{"aria-hidden":"true",viewBox:"0 0 16 16",className:"pointer-events-none absolute top-1/2 right-1.5 size-3.5 -translate-y-1/2 text-muted-foreground",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:E.jsx("path",{d:"m4 6 4 4 4-4",strokeLinecap:"round",strokeLinejoin:"round"})})}function QS({children:t}){return E.jsx("span",{className:"font-mono text-[11px] font-semibold tracking-[0.14em] whitespace-nowrap text-muted-foreground/70 uppercase",children:t})}function po({label:t,checked:e,onChange:n,hint:r}){return E.jsxs("span",{className:"inline-flex items-center gap-1",children:[E.jsxs("label",{className:"flex cursor-pointer items-center gap-2 whitespace-nowrap text-[13px] text-muted-foreground transition-colors hover:text-foreground",children:[E.jsx("button",{type:"button",role:"switch","aria-checked":e,"aria-label":t,onClick:()=>n(!e),className:"flex h-6 shrink-0 cursor-pointer items-center rounded-full outline-none focus-visible:ring-3 focus-visible:ring-ring/50",children:E.jsx("span",{className:Un("relative inline-flex h-[18px] w-8 items-center rounded-full border transition-colors",e?"border-primary bg-primary":"border-border bg-muted"),children:E.jsx("span",{className:Un("pointer-events-none inline-block size-3 rounded-full bg-background shadow-sm transition-transform",e?"translate-x-[15px]":"translate-x-[2px]")})})}),E.jsx("span",{className:"select-none",children:t})]}),r?E.jsx(Uy,{text:r}):null]})}function Uy({text:t}){const e=y.useId(),[n,r]=y.useState(!1);return E.jsxs("span",{className:"relative inline-flex items-center",children:[E.jsx("button",{type:"button","aria-label":"What does this option do?","aria-expanded":n,"aria-describedby":e,title:"What does this option do?",onClick:()=>r(i=>!i),className:"flex h-4 w-4 cursor-pointer items-center justify-center rounded-full border border-border text-[9px] font-semibold leading-none text-muted-foreground hover:text-foreground",children:"i"}),E.jsx("span",{"data-hint":!0,id:e,hidden:!n,className:"ml-1 text-muted-foreground",children:t})]})}function ZG({direction:t,options:e,onChange:n,notice:r,uploadEncoding:i,onUploadEncodingChange:s}){const[o,l]=y.useState(!1),a=y.useRef(null),u=y.useRef(null),c=xR("(min-width: 98.5rem)"),f=t==="csv2json",d=QG(t,e),h=y.useCallback(()=>{var g;l(!1),(g=a.current)==null||g.focus()},[]);y.useEffect(()=>{if(!o)return;const g=m=>{m.key==="Escape"&&h()},b=m=>{const v=u.current;v===null||!(m.target instanceof Node)||v.contains(m.target)||h()};return document.addEventListener("keydown",g),document.addEventListener("click",b),()=>{document.removeEventListener("keydown",g),document.removeEventListener("click",b)}},[o,h]);const p=E.jsxs(E.Fragment,{children:[E.jsxs("span",{className:"inline-flex items-center gap-2",children:[E.jsxs("label",{className:"flex items-center gap-2",children:[E.jsx(QS,{children:"Separator"}),E.jsxs("span",{className:"relative inline-flex",children:[E.jsx("select",{"data-testid":"opt-separator",value:e.separator,onChange:g=>n({separator:g.target.value}),className:YS(),children:kR.map(g=>E.jsx("option",{value:g.value,children:g.label},g.value))}),E.jsx(JS,{})]})]}),E.jsx(Uy,{text:"Auto-detect is conservative — it only picks comma, semicolon, or tab. Pipe never auto-detects because normal prose is full of pipes, so pipe-separated text must be selected explicitly."})]}),i&&s?E.jsxs(E.Fragment,{children:[E.jsx(qS,{}),E.jsxs("span",{className:"inline-flex items-center gap-2",children:[E.jsxs("label",{className:"flex items-center gap-2",children:[E.jsx(QS,{children:"Encoding"}),E.jsxs("span",{className:"relative inline-flex",children:[E.jsx("select",{"data-testid":"opt-encoding",value:i,onChange:g=>s(g.target.value),className:YS(),children:JG.map(g=>E.jsx("option",{value:g.value,children:g.label},g.value))}),E.jsx(JS,{})]})]}),E.jsx(Uy,{text:"Applies to file uploads and drops only — pasted or typed text is always read as UTF-8. Switch to Windows-1252 for CSVs saved by legacy Excel to fix mangled accents like ü and ö."})]})]}):null,E.jsx(qS,{}),f?E.jsxs(E.Fragment,{children:[E.jsx(po,{label:"Parse numbers",checked:e.parseNumbers,onChange:g=>n({parseNumbers:g}),hint:"On by default — plain numbers like 5 or 19.99 become real JSON numbers; leading-zero values like 00721 and very long IDs stay strings. Uncheck to keep numeric cells as strings — booleans, null, and containers still convert while Parse JSON is on."}),E.jsx(po,{label:"Parse JSON",checked:e.parseJSON,onChange:g=>n({parseJSON:g}),hint:"Turns null, true, false, [] and {} into real JSON values instead of strings."}),E.jsx(po,{label:"Skip empty fields",checked:e.emptyFields==="skip",onChange:g=>n({emptyFields:g?"skip":"keep"}),hint:'Empty cells are dropped from the output instead of becoming "" — a column that is empty in every row disappears from the output and the counts.'}),E.jsx(po,{label:"NULL as null",checked:e.nullLiterals==="null",onChange:g=>n({nullLiterals:g?"null":"string"}),hint:"The string NULL becomes JSON null. Matching is exact and case-sensitive — SQL exports write uppercase NULL; Null and nULL are untouched, and lowercase null already converts when Parse JSON is on."}),E.jsx(po,{label:"Transpose",checked:e.transpose,onChange:g=>n({transpose:g}),hint:"Flip rows and columns — the first column becomes the header row."}),E.jsx(po,{label:"Hash output",checked:e.hash,onChange:g=>n({hash:g}),hint:"The first column becomes the object key instead of a field."}),E.jsx(po,{label:"Minify",checked:e.minify,onChange:g=>n({minify:g}),hint:"Remove indentation from the JSON output. Data is untouched."})]}):E.jsx(po,{label:"Flatten nested arrays",checked:e.flatten,onChange:g=>n({flatten:g}),hint:"Explode nested arrays into extra rows with dotted keys — needed when the JSON isn't a flat table."})]});return c?E.jsx("div",{"data-testid":"options-row",className:"flex flex-shrink-0 flex-row items-center gap-5 border-t border-border bg-panel px-5 py-2.5 text-[13px] text-muted-foreground",children:E.jsxs("div",{"data-testid":"options-settings-menu",role:"group","aria-label":"Parse settings",className:"flex flex-1 flex-wrap items-center gap-x-4 gap-y-2.5",children:[p,r?E.jsxs(E.Fragment,{children:[E.jsx("div",{className:"flex-1"}),E.jsx("span",{"data-testid":"options-notice",children:r})]}):null]})}):E.jsxs("div",{"data-testid":"options-row",ref:u,className:"relative flex flex-shrink-0 flex-col border-t border-border bg-panel px-3.5 py-2 text-[13px] text-muted-foreground md:px-4",children:[E.jsxs("div",{className:"flex w-full items-center gap-2",children:[E.jsxs("button",{type:"button",ref:a,"data-testid":"options-settings-toggle","aria-expanded":o,"aria-haspopup":"true",onClick:()=>o?h():l(!0),className:"inline-flex shrink-0 cursor-pointer items-center gap-1.5 whitespace-nowrap rounded-md py-0.5 text-[13px] font-medium text-foreground outline-none focus-visible:ring-3 focus-visible:ring-ring/50",children:["Parse settings",E.jsx(lI,{"aria-hidden":"true",className:Un("size-3.5 shrink-0 transition-transform",o&&"rotate-180")})]}),E.jsx("span",{"data-testid":"options-settings-summary",className:"min-w-0 truncate",children:d}),r?E.jsx("span",{"data-testid":"options-notice",className:"ml-auto shrink-0 text-right",children:r}):null]}),E.jsx("div",{"data-testid":"options-settings-menu",role:"group","aria-label":"Parse settings",hidden:!o,className:Un("absolute bottom-full left-0 z-50 mb-2 w-full items-center gap-x-4 gap-y-2.5 rounded-md border border-border bg-panel p-3 shadow-md",o?"flex flex-wrap":"hidden"),children:p})]})}const eq=[{format:"json",label:"JSON",extension:"json",mime:"application/json"},{format:"jsonl",label:"JSONL",extension:"jsonl",mime:"application/x-ndjson"},{format:"sql",label:"SQL",extension:"sql",mime:"application/sql"},{format:"ts",label:"TS",extension:"ts",mime:"text/typescript"}],tq=new Set(["csv","tsv","txt","json","jsonl","sql","ts"]),nq=/^[A-Za-z_$][A-Za-z0-9_$]*$/;function eh(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function Vw(t){if(Array.isArray(t))return t.map(e=>eh(e)?e:{value:e});if(eh(t)){const e=Object.entries(t);return e.length===0?[]:e.every(([,n])=>eh(n))?e.map(([n,r])=>{const i=r;return"key"in i?i:{key:n,...i}}):[t]}return[]}function SR(t){const e=new Set,n=[];for(const r of t)for(const i of Object.keys(r))e.has(i)||(e.add(i),n.push(i));return n}function rq(t){if(!t)return"data";let e=t.trim();const n=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));for(n>=0&&(e=e.slice(n+1));;){const i=e.lastIndexOf(".");if(i<=0)break;if(i===e.length-1){e=e.slice(0,i);continue}const s=e.slice(i+1).toLowerCase();if(!tq.has(s))break;e=e.slice(0,i)}const r=e.replace(/[^a-zA-Z0-9]+/g,"_").replace(/^_+|_+$/g,"");return r.length>0?r:"data"}function Fm(t){return`"${t.replace(/"/g,'""')}"`}function iq(t){const e=t.filter(n=>n!=null);return e.length===0?"TEXT":e.every(n=>typeof n=="boolean")?"BOOLEAN":e.every(n=>typeof n=="number"&&Number.isFinite(n))?e.every(n=>Number.isInteger(n))?"INTEGER":"NUMERIC":"TEXT"}function sq(t){return t==null?"NULL":typeof t=="boolean"?t?"TRUE":"FALSE":typeof t=="number"?Number.isFinite(t)?String(t):"NULL":typeof t=="string"?`'${t.replace(/'/g,"''")}'`:`'${JSON.stringify(t).replace(/'/g,"''")}'`}function oq(t){const e=t.trim();if(e==="")return"";let n;try{n=JSON.parse(e)}catch{return t}return Vw(n).map(i=>JSON.stringify(i)).join(` -`)}function lq(t,e){const n=t.trim();if(n==="")return"";let r;try{r=JSON.parse(n)}catch{return t}const i=Vw(r),s=SR(i),o=Fm(rq(e));if(s.length===0)return`CREATE TABLE ${o} ();`;const l=s.map(d=>{const h=i.map(g=>g[d]),p=iq(h);return` ${Fm(d)} ${p}`}),a=`CREATE TABLE ${o} ( -${l.join(`, -`)} -);`;if(i.length===0)return a;const u=s.map(Fm).join(", "),c=i.map(d=>` (${s.map(p=>sq(d[p])).join(", ")})`),f=`INSERT INTO ${o} (${u}) VALUES -${c.join(`, -`)};`;return`${a} - -${f}`}function CR(t){if(t===null)return"null";if(typeof t=="string")return"string";if(typeof t=="number")return"number";if(typeof t=="boolean")return"boolean";if(Array.isArray(t)){if(t.length===0)return"unknown[]";const e=TR(Array.from(new Set(t.map(n=>CR(n)))));return e.length===1?`${e[0]}[]`:`(${e.join(" | ")})[]`}return eh(t)?"Record":"unknown"}const ZS={string:1,number:2,boolean:3,"Record":4,unknown:90,null:100};function TR(t){return[...t].sort((e,n)=>{const r=ZS[e]??50,i=ZS[n]??50;return r!==i?r-i:e.localeCompare(n)})}function aq(t){return nq.test(t)?t:JSON.stringify(t)}function uq(t){const e=t.trim();if(e==="")return"";let n;try{n=JSON.parse(e)}catch{return t}const r=Vw(n),s=SR(r).map(l=>{let a=!1;const u=new Set;for(const h of r){if(!Object.prototype.hasOwnProperty.call(h,l)||h[l]===void 0){a=!0;continue}u.add(CR(h[l]))}const c=TR(Array.from(u)),f=c.length>0?c.join(" | "):"unknown",d=a?"?":"";return` ${aq(l)}${d}: ${f};`});return`${s.length>0?`export interface DataRow { -${s.join(` -`)} -}`:"export interface DataRow {}"} - -export const data: DataRow[] = ${JSON.stringify(r,null,2)};`}function cq(t,e,n,r){const i=typeof t=="string"?t:t.text,s=typeof n=="string"||n===null?n:r??null;switch(e){case"json":return i;case"jsonl":return oq(i);case"sql":return lq(i,s);case"ts":return uq(i)}}const fq=3;function dq(t){const e=t.slice(0,fq),n=t.length-e.length;return(n>0?[...e,`+${n} more`]:e).join(` -`)}function hq({format:t,inputEmpty:e,outputText:n,error:r,meta:i,staleNotice:s,warnings:o,edited:l,editable:a,egressFormat:u="json",delimiter:c,dark:f,onCopy:d,onCopySelection:h,onProjectedCsvChange:p,onNativeCopy:g,onDownload:b,onEgressFormatChange:m,onOutputChange:v,onRevert:w,onDiscardReconvert:k}){const x=t==="JSON",C=u==="json";return E.jsx("div",{"data-testid":"output-pane","data-surface":"output",className:"flex min-h-0 min-w-0 flex-1 flex-col bg-muted/30",children:E.jsx(yR,{title:t,meta:e?null:l?E.jsxs("span",{className:"flex items-center gap-1.5",children:[E.jsx("span",{"data-testid":"edited-badge",role:"status","aria-label":"Output edited",className:"rounded-full bg-amber-100 px-2 py-0.5 text-[10px] font-semibold uppercase tracking-[0.08em] text-amber-700 dark:bg-amber-400/15 dark:text-amber-400",children:"Edited"}),E.jsxs("button",{type:"button","data-testid":"revert-output",onClick:w,className:kl,children:[E.jsx(xb,{"aria-hidden":"true"}),"Revert"]})]}):s?E.jsx("span",{"data-testid":"stale-notice",className:"text-xs text-amber-600 dark:text-amber-400",children:s}):i,actions:E.jsxs(E.Fragment,{children:[x?E.jsx("span",{"data-testid":"output-format-switcher",role:"group","aria-label":"Output format",className:"inline-flex items-center gap-0.5 rounded-lg border border-border bg-muted/60 p-0.5",children:eq.map(T=>{const A=u===T.format;return E.jsx("button",{type:"button","data-testid":`output-format-option-${T.format}`,"aria-pressed":A,onClick:()=>m==null?void 0:m(T.format),className:Un("inline-flex cursor-pointer items-center rounded-[7px] px-1.5 py-0.5 font-mono text-[11px] font-medium transition-all outline-none focus-visible:ring-3 focus-visible:ring-ring/50 sm:px-2 sm:py-1",A?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:T.label},T.format)})}):null,E.jsxs("button",{type:"button","data-testid":"copy-output","aria-label":"Copy",title:"Copy",onClick:d,disabled:!n,className:kl,children:[E.jsx(Wv,{"aria-hidden":"true"}),E.jsx("span",{className:"hidden xl:inline",children:"Copy"})]}),E.jsxs("button",{type:"button","data-testid":"download-output","aria-label":"Download",title:"Download",onClick:b,disabled:!n,className:kl,children:[E.jsx(ET,{"aria-hidden":"true"}),E.jsx("span",{className:"hidden xl:inline",children:"Download"})]})]}),status:l?{kind:"notice",message:"Output edited — CSV and option changes aren't applied.",action:k?E.jsxs("button",{type:"button","data-testid":"discard-reconvert",onClick:k,className:kl+" ml-2",children:[E.jsx(xb,{"aria-hidden":"true"}),"Discard edits & reconvert"]}):void 0}:r?{kind:"error",message:r}:o&&o.length>0?{kind:"notice",message:dq(o)}:null,children:e?E.jsxs("div",{className:"flex flex-1 items-center justify-center p-6 text-sm text-muted-foreground",children:["Your ",t," appears here."]}):n?x?E.jsx("div",{className:"flex min-h-0 flex-1 flex-col",onCopy:()=>g==null?void 0:g(),children:E.jsx(mR,{value:n,editable:a&&C&&n.length<=gR,lintJson:C,onChange:v,dark:f,testId:"output-view"})}):E.jsx(tA,{text:n,delimiter:c,testId:"output-table",dark:f,onCopySelection:h,onProjectedCsvChange:p}):r?E.jsx("div",{className:"flex flex-1 items-center justify-center p-6 text-sm text-muted-foreground",children:"Resolve the error to see output."}):E.jsx("div",{"data-testid":"output-converting-placeholder",className:"flex flex-1 items-center justify-center p-6 text-sm text-muted-foreground",children:"Converting…"})})})}function pq({phase:t,message:e,onRetry:n}){return t==="loading"?E.jsx("div",{role:"status","aria-busy":"true","data-testid":"permalink-loading",className:"mx-4 mt-3 rounded-md border border-border bg-muted px-4 py-2 text-sm text-muted-foreground",children:"Loading shared data…"}):t==="not-found"?E.jsxs("div",{role:"alert","data-testid":"permalink-notice",className:"mx-4 mt-3 flex flex-wrap items-center gap-x-2 rounded-md border border-border bg-muted px-4 py-2 text-sm text-foreground",children:[E.jsx("span",{children:"This data doesn't exist (or was deleted)."}),E.jsx("a",{href:"/",className:"font-medium underline underline-offset-2",children:"Go to the converter"})]}):t==="unsupported"?E.jsxs("div",{role:"alert","data-testid":"permalink-unsupported",className:"mx-4 mt-3 flex flex-wrap items-center gap-x-2 rounded-md border border-border bg-muted px-4 py-2 text-sm text-foreground",children:[E.jsx("span",{children:"This link's saved data can't be shown in the new converter."}),E.jsx("a",{href:"/",className:"font-medium underline underline-offset-2",children:"Go to the converter"})]}):E.jsxs("div",{role:"alert","data-testid":"permalink-notice",className:"mx-4 mt-3 flex flex-wrap items-center gap-x-3 rounded-md border border-border bg-muted px-4 py-2 text-sm text-foreground",children:[E.jsx("span",{children:e||"Couldn't load this data."}),E.jsx("button",{type:"button","data-testid":"permalink-retry",onClick:n,className:"rounded-md border border-border bg-background px-2 py-1 text-sm font-medium hover:bg-accent",children:"Retry"})]})}const Uw="csvjson:recent.v1",ER=10,AR=1e5,eC=80;function gq(t){return t==="csv2json"||t==="json2csv"}function mq(t){if(!t||typeof t!="object"||Array.isArray(t))return;const e={};for(const[n,r]of Object.entries(t))(r==="string"||r==="number"||r==="boolean"||r==="auto")&&(e[n]=r);return Object.keys(e).length>0?e:void 0}function MR(t){if(typeof t!="object"||t===null)return{...Yr};const e=t,n=e.separator,r=n==="auto"||n===","||n===";"||n===" "||n==="|"?n:Yr.separator,i=e.emptyFields==="keep"||e.emptyFields==="skip"?e.emptyFields:Yr.emptyFields,s=e.nullLiterals==="string"||e.nullLiterals==="null"?e.nullLiterals:Yr.nullLiterals,o=mq(e.columnTypes);return{separator:r,parseNumbers:typeof e.parseNumbers=="boolean"?e.parseNumbers:Yr.parseNumbers,parseJSON:typeof e.parseJSON=="boolean"?e.parseJSON:Yr.parseJSON,emptyFields:i,nullLiterals:s,transpose:typeof e.transpose=="boolean"?e.transpose:Yr.transpose,hash:typeof e.hash=="boolean"?e.hash:Yr.hash,minify:typeof e.minify=="boolean"?e.minify:Yr.minify,flatten:typeof e.flatten=="boolean"?e.flatten:Yr.flatten,collapseIndexedArrays:typeof e.collapseIndexedArrays=="boolean"?e.collapseIndexedArrays:Yr.collapseIndexedArrays,...o?{columnTypes:o}:{}}}function RR(t){const n=(t.split(/\r?\n/).map(r=>r.trim()).find(r=>r.length>0)??"").replace(/\s+/g," ");return n.length<=eC?n:`${n.slice(0,eC-1)}…`}function yq(t){if(typeof t!="object"||t===null)return!1;const e=t;return!(typeof e.id!="string"||e.id.trim()===""||typeof e.createdAt!="number"||!Number.isFinite(e.createdAt)||!gq(e.direction)||typeof e.input!="string"||e.input.trim()===""||e.input.length>AR||e.filename!==null&&typeof e.filename!="string"||typeof e.rows!="number"||!Number.isInteger(e.rows)||e.rows<0||typeof e.cols!="number"||!Number.isInteger(e.cols)||e.cols<0||typeof e.preview!="string")}function vq(t){return{id:t.id,createdAt:t.createdAt,direction:t.direction,input:t.input,options:MR(t.options),filename:t.filename,rows:t.rows,cols:t.cols,preview:t.preview||RR(t.input)}}function OR(t){try{if(typeof window>"u")return;window.localStorage.setItem(Uw,JSON.stringify(t))}catch{}}function wq(t){var e;return typeof((e=globalThis.crypto)==null?void 0:e.randomUUID)=="function"?globalThis.crypto.randomUUID():`snap-${t}-${Math.random().toString(36).slice(2,10)}`}function Kw(){try{if(typeof window>"u")return[];const t=window.localStorage.getItem(Uw);if(t===null)return[];const e=JSON.parse(t);return Array.isArray(e)?e.filter(yq).map(vq).sort((r,i)=>i.createdAt-r.createdAt).slice(0,ER):[]}catch{return[]}}function tC(t){const e=Kw(),n=t.input.trim();if(n===""||t.input.length>AR||t.rows<=0&&t.cols<=0)return e;const r=t.createdAt??Date.now(),i=e.find(a=>a.direction===t.direction&&a.input.trim()===n),s={id:(i==null?void 0:i.id)??wq(r),createdAt:r,direction:t.direction,input:t.input,options:MR(t.options),filename:t.filename,rows:t.rows,cols:t.cols,preview:RR(t.input)},o=e.filter(a=>!(a.direction===t.direction&&a.input.trim()===n)),l=[s,...o].slice(0,ER);return OR(l),l}function bq(t){const n=Kw().filter(r=>r.id!==t);return OR(n),n}function xq(){try{if(typeof window>"u")return;window.localStorage.removeItem(Uw)}catch{}}function kq(t,e=Date.now()){const n=Math.max(0,e-t),r=Math.floor(n/1e3);if(r<45)return"just now";const i=Math.floor(r/60);if(i<60)return`${i}m ago`;const s=Math.floor(i/60);if(s<24)return`${s}h ago`;const o=Math.floor(s/24);return o===1?"yesterday":o<7?`${o}d ago`:new Date(t).toLocaleDateString("en-US",{month:"short",day:"numeric"})}function Sq(t){return t==="csv2json"?"CSV→JSON":"JSON→CSV"}function Cq(t,e){return t>0&&e>0?`${t} rows · ${e} cols`:t>0?`${t} rows`:e>0?`${e} cols`:"0 rows"}function Tq({snapshots:t,onSelect:e,onRemove:n,onClear:r}){const[i,s]=y.useState(!1),o=y.useRef(null),l=y.useRef(null),a=y.useCallback(()=>{s(!1)},[]),u=y.useRef(!1);y.useEffect(()=>{var f;u.current&&!i&&((f=l.current)==null||f.focus()),u.current=i},[i]),y.useEffect(()=>{if(!i)return;const f=h=>{h.key==="Escape"&&a()},d=h=>{const p=o.current;p===null||!(h.target instanceof Node)||p.contains(h.target)||a()};return document.addEventListener("keydown",f),document.addEventListener("click",d),()=>{document.removeEventListener("keydown",f),document.removeEventListener("click",d)}},[i,a]);const c=t.length;return E.jsxs("div",{"data-testid":"recent-history",ref:o,className:"relative max-sm:static",children:[E.jsxs("button",{type:"button","data-testid":"recent-history-toggle",ref:l,onClick:()=>s(f=>!f),"aria-expanded":i,"aria-haspopup":"dialog","aria-label":"Recent conversions",title:"Recent conversions",className:"relative inline-flex h-8 cursor-pointer items-center gap-1.5 rounded-lg border border-border bg-panel px-2.5 text-xs font-medium text-muted-foreground transition-colors outline-none hover:bg-muted hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50",children:[E.jsx(fI,{size:14,strokeWidth:2,"aria-hidden":"true"}),E.jsx("span",{className:"hidden sm:inline",children:"Recent"}),c>0&&E.jsx("span",{"data-testid":"recent-history-count",className:"rounded-full bg-muted px-1.5 py-px text-[10px] font-semibold tabular-nums text-foreground",children:c})]}),i&&E.jsxs("div",{"data-testid":"recent-history-popout",role:"dialog","aria-label":"Recent conversions",className:"absolute right-0 top-9 z-50 w-80 rounded-md border border-border bg-panel shadow-md max-sm:inset-x-2 max-sm:top-14 max-sm:w-auto",children:[E.jsxs("div",{className:"flex items-center justify-between border-b border-border py-1.5 pl-3 pr-1.5",children:[E.jsx("span",{className:"text-xs font-semibold tracking-tight text-foreground",children:"Recent conversions"}),E.jsxs("div",{className:"flex items-center gap-1",children:[c>0&&E.jsx("button",{type:"button","data-testid":"recent-history-clear",onClick:()=>{r()},className:"cursor-pointer rounded-md px-2 py-1 text-[11px] font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",children:"Clear history"}),E.jsx("button",{type:"button","data-testid":"recent-history-close",onClick:a,"aria-label":"Close recent conversions",className:"flex size-6 cursor-pointer items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",children:E.jsx(Ah,{size:14,strokeWidth:2,"aria-hidden":"true"})})]})]}),c===0?E.jsx("div",{"data-testid":"recent-history-empty",className:"px-3 py-6 text-center text-xs text-muted-foreground",children:"No recent conversions saved on this device yet."}):E.jsx("div",{className:"max-h-96 divide-y divide-border overflow-y-auto",children:t.map(f=>E.jsxs("div",{className:"flex items-start justify-between gap-1 px-2 py-2 transition-colors hover:bg-muted/50",children:[E.jsxs("button",{type:"button","data-testid":`recent-history-item-${f.id}`,onClick:()=>{e(f),a()},className:"flex min-w-0 flex-1 cursor-pointer flex-col items-start text-left outline-none focus-visible:ring-2 focus-visible:ring-ring/50 rounded-sm px-1 py-0.5",children:[E.jsxs("div",{className:"mb-1 flex w-full items-center gap-1.5",children:[E.jsx("span",{className:"rounded-full border border-border px-1.5 py-px text-[10px] font-medium uppercase tracking-wide text-muted-foreground",children:Sq(f.direction)}),E.jsx("span",{className:"text-[11px] text-muted-foreground",children:Cq(f.rows,f.cols)}),E.jsx("span",{className:"ml-auto text-[11px] text-muted-foreground",children:kq(f.createdAt)})]}),E.jsx("span",{className:"w-full truncate font-mono text-xs text-foreground",children:f.filename??f.preview})]}),E.jsx("button",{type:"button","data-testid":`recent-history-delete-${f.id}`,onClick:d=>{d.stopPropagation(),n(f.id)},"aria-label":`Delete recent snapshot ${f.filename??f.preview}`,title:"Delete snapshot",className:"mt-0.5 flex size-6 shrink-0 cursor-pointer items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",children:E.jsx(Eh,{size:13,strokeWidth:2,"aria-hidden":"true"})})]},f.id))})]})]})}const Ky=20,Xy=80,nC=50;function zm(t){return Math.min(Xy,Math.max(Ky,t))}function Eq({layout:t,split:e,onSplitChange:n,left:r,right:i,children:s}){const o=y.useRef(null),[l,a]=y.useState(!1),u=t==="stacked";y.useEffect(()=>{if(!l)return;const f=h=>{var b;const p=(b=o.current)==null?void 0:b.getBoundingClientRect();if(!p||p.width===0||p.height===0)return;const g=u?(h.clientY-p.top)/p.height:(h.clientX-p.left)/p.width;n(zm(g*100))},d=()=>a(!1);return window.addEventListener("pointermove",f),window.addEventListener("pointerup",d),window.addEventListener("pointercancel",d),()=>{window.removeEventListener("pointermove",f),window.removeEventListener("pointerup",d),window.removeEventListener("pointercancel",d)}},[l,u,n]);const c=f=>{const d=f.shiftKey?5:1;switch(f.key){case"ArrowLeft":case"ArrowUp":f.preventDefault(),n(zm(e-d));break;case"ArrowRight":case"ArrowDown":f.preventDefault(),n(zm(e+d));break;case"Home":f.preventDefault(),n(Ky);break;case"End":f.preventDefault(),n(Xy);break;case"Enter":case" ":f.preventDefault(),n(nC);break}};return E.jsxs("div",{ref:o,className:Un("relative flex min-h-0 flex-1","flex-col md:flex-row",l&&"select-none"),children:[E.jsx("div",{"data-testid":"pane-left",style:{"--split":`${e}%`},className:Un("flex min-h-0 min-w-0 flex-col overflow-hidden border-border bg-panel max-md:min-h-[280px] max-md:max-h-[360px]","h-[var(--split)] border-b","md:h-auto md:w-[var(--split)] md:border-b-0 md:border-r"),children:r}),E.jsxs("div",{"data-testid":"seam",role:"separator",tabIndex:0,"aria-orientation":u?"horizontal":"vertical","aria-valuenow":Math.round(e),"aria-valuemin":Ky,"aria-valuemax":Xy,"aria-label":"Resize panes",title:"Drag to resize · double-click to reset",onPointerDown:f=>{var d,h;f.target instanceof Element&&f.target.closest("button")||(f.preventDefault(),(h=(d=f.currentTarget).setPointerCapture)==null||h.call(d,f.pointerId),a(!0))},onPointerUp:()=>a(!1),onDoubleClick:()=>n(nC),onKeyDown:c,style:{"--split":`${e}%`,touchAction:"none"},className:Un("relative z-10 flex h-9 flex-shrink-0 items-center justify-center border-b border-border bg-muted/20 cursor-row-resize","md:absolute md:top-0 md:right-auto md:bottom-0 md:left-[var(--split)] md:h-auto md:w-0 md:border-b-0 md:bg-transparent md:cursor-col-resize"),children:[E.jsx("div",{className:Un("absolute","inset-0","md:inset-auto md:top-0 md:right-auto md:bottom-0 md:-left-1.5 md:h-auto md:w-3")}),s?E.jsx("div",{className:"relative z-10 md:absolute md:left-1/2 md:top-1/2 md:-translate-x-1/2 md:-translate-y-1/2",children:s}):null]}),E.jsx("div",{"data-testid":"pane-right",className:"flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden bg-panel max-md:min-h-[240px] max-md:max-h-[340px]",children:i})]})}function Aq({theme:t}){return t==="dark"?E.jsx(RI,{size:15,strokeWidth:2,"aria-hidden":"true"}):E.jsx(vI,{size:15,strokeWidth:2,"aria-hidden":"true"})}function Mq({theme:t,onToggleTheme:e,slot:n}){return E.jsxs("header",{"data-testid":"topbar",className:"relative flex h-14 flex-shrink-0 items-center gap-3 border-b border-border bg-panel px-5",children:[E.jsxs("div",{className:"flex items-baseline gap-2",children:[E.jsx("span",{className:"text-[15px] font-semibold tracking-tight text-foreground whitespace-nowrap",children:"csvjson"}),E.jsx("span",{className:"hidden text-[13px] font-medium text-muted-foreground sm:inline",children:"CSV → JSON converter"})]}),E.jsx("div",{className:"flex-1"}),E.jsx("div",{"data-testid":"topbar-slot",children:n}),E.jsx("button",{type:"button","data-testid":"theme-toggle",onClick:e,"aria-label":t==="dark"?"Switch to light mode":"Switch to dark mode",title:t==="dark"?"Switch to light mode":"Switch to dark mode",className:"inline-flex size-8 cursor-pointer items-center justify-center rounded-lg border border-border bg-panel text-muted-foreground transition-colors outline-none hover:bg-muted hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50",children:E.jsx(Aq,{theme:t})})]})}function Rq(t){return[...t].sort((e,n)=>n.id-e.id)}const PR=[{id:24,date:"2026-10-20",tag:"improvement",title:"Clearer supported paste and upload formats in the input area",summary:"The empty-state input area and file picker now explicitly list every accepted format in each mode — CSV, TSV / spreadsheet cells, Markdown & ChatGPT multi-table docs, and psql/MySQL box tables in CSV → JSON, plus JSON arrays, nested objects, wrapped API payloads, and JSONL / NDJSON in JSON → CSV."},{id:23,date:"2026-10-20",tag:"new",title:"Extract and switch between multiple tables in pasted Markdown",summary:"Paste an entire ChatGPT response or Markdown document containing prose and multiple Markdown or CLI box tables into CSV → JSON: every table is detected in order with interactive chooser pills to switch which table is previewed and converted, or keep only the selected table as clean CSV."},{id:22,date:"2026-10-20",tag:"new",title:"Column visibility picker and Apply view to output",summary:"Use the new Columns menu in any data table to hide or restore columns without touching your raw input. When a search filter, sort order, or column subset is active, toggle Apply view to output to project that exact table view into the converted output, Copy, and Download."},{id:21,date:"2026-10-20",tag:"new",title:"Paste Markdown & CLI box tables directly into CSV → JSON",summary:"Paste GitHub/ChatGPT Markdown pipe tables or psql/MySQL ASCII box tables directly into CSV → JSON: divider rows, outer pipes, and (N rows) footers are stripped automatically, with a one-click Clean table action to normalize the raw CSV in place."},{id:20,date:"2026-10-20",tag:"new",title:"One-click nested JSON flattening in JSON → CSV",summary:"When JSON → CSV input contains nested objects or arrays, a contextual Flatten nested keys pill appears above the editor to expand deep objects into dotted CSV column headers (like user.profile.name) and join scalar arrays in one click."},{id:19,date:"2026-10-20",tag:"new",title:"Pin per-column types in the CSV grid",summary:"Select any column in the CSV table to pin its JSON output type to String, Number, Boolean, or Auto — keeping postal codes and IDs as strings or coercing yes/no/1/0 columns to booleans without changing global parse settings."},{id:18,date:"2026-10-20",tag:"new",title:"Live spreadsheet selection aggregates in the table toolbar",summary:"Select any range of cells, rows, or columns in the data table to see instant cell, distinct, and empty counts alongside numeric Sum, Avg, Min, and Max aggregates. Range selections also expose one-click Copy as CSV right from the toolbar."},{id:17,date:"2026-10-20",tag:"new",title:"Export CSV as JSONL, SQL INSERTs, or TypeScript",summary:"Switch the CSV → JSON output header between JSON, JSONL, SQL, and TS to generate newline-delimited records, CREATE TABLE and INSERT statements with inferred types, or a typed TypeScript DataRow interface and array ready to copy or download."},{id:16,date:"2026-10-20",tag:"new",title:"Restore recent conversions from the top bar",summary:"The new Recent menu in the top bar saves up to 10 valid conversions locally on your device so you can jump back to an earlier dataset in one click. Fresh page loads still start on a clean empty dropzone."},{id:15,date:"2026-10-18",tag:"improvement",title:"Options fold into a Parse settings menu",summary:"On narrower screens the converter's options bar no longer wraps onto extra lines — it collapses to a single Parse settings line showing your active options, with the full control set in a drop-up above it. Small screens lose the accordion that squeezed the panes."},{id:14,date:"2026-10-17",tag:"improvement",title:"Polished mobile stacked panes and collapsible options bar",summary:"Small screens now stack the input and output panes with an in-flow direction switch and compact icon actions so nothing overlaps. The options bar collapses into a one-tap summary on phones while keeping every setting a tap away."},{id:13,date:"2026-10-15",tag:"fix",title:"Faster large CSV uploads without page freezes",summary:"Uploading large CSV files now converts in a single pass without freezing the tab or flashing a false error state, previews multi-megabyte JSON outputs smoothly while keeping full Copy and Download, and decodes UTF-16 CSV exports automatically."},{id:12,date:"2026-10-15",tag:"improvement",title:"Table undo, header rename, and smarter JSON input",summary:"Undo or redo CSV table edits, double-click any column header to rename it in place, and collapse .0, .1 indexed columns into JSON arrays. JSON → CSV now formats or minifies JSON in one click, unwraps nested record arrays, parses JSONL, and previews pipe-delimited output accurately."},{id:11,date:"2026-10-03",tag:"improvement",title:"The switch names the direction",summary:"The ⇄ switch now labels the active conversion, and legacy /json2csv links land you in JSON → CSV mode again — it never left."},{id:10,date:"2026-09-08",tag:"new",title:"Delete rows and columns from the table",summary:"Select rows or columns in the input table and delete them by button or the Delete key — the raw CSV updates and reconverts in place, with at least one column always kept. Selected column headers are also readable again in both themes."},{id:9,date:"2026-09-08",tag:"new",title:"Spreadsheet-grade data table",summary:"The rebuilt data table adds drag-to-select ranges, Shift+Arrow range extension, fill, and spreadsheet-style cell editing — with copy/paste always producing clean CSV."},{id:8,date:"2026-09-07",tag:"new",title:"Search, sort, and select in the data table",summary:"The CSV table now has a search bar with a live row count, click-to-sort columns, and row selection with copy-as-CSV — on both the input and output tables."},{id:7,date:"2026-09-07",tag:"fix",title:"No more layout flash on load",summary:"The converter now renders side-by-side immediately on desktop, instead of stacking the panes and snapping into columns as the page loads."},{id:6,date:"2026-09-07",tag:"new",title:"Introducing the changelog",summary:"This changelog keeps you posted on what's new — recent updates appear here with an unseen dot when you come back. Feel free to vote on what you find useful."},{id:5,date:"2026-09-05",tag:"improvement",title:"Icons match the design",summary:"Action buttons, view toggle, and the empty state now use the same crisp icon set as the rest of the interface."},{id:4,date:"2026-09-05",tag:"new",title:"Edit the JSON output in place",summary:"The output pane is now an editor. Hand edits survive until you reconvert; revert and discard keep you safe."},{id:3,date:"2026-09-05",tag:"fix",title:"Pastes land where they belong",summary:"Paste anywhere on the page and your data routes to the input — including pastes over the read-only output pane."},{id:2,date:"2026-09-04",tag:"improvement",title:"A calmer empty state",summary:"Empty panes now open on a compact paste field with a Choose file button, so starting is obvious on any screen."},{id:1,date:"2026-09-04",tag:"improvement",title:"Smarter number handling",summary:"Numbers convert sensibly out of the box: leading-zero values like 00721 and very long IDs stay strings so nothing gets silently mangled."}],Oq=864e5;function rC(t){return Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate())}function Pq(t,e=Date.now()){const n=new Date(`${t}T00:00:00Z`),r=new Date(e),i=Math.round((rC(r)-rC(n))/Oq);if(i<=0)return"today";if(i===1)return"yesterday";if(i<7)return`${i} days ago`;const s=n.toLocaleDateString("en-US",{month:"short",day:"numeric",timeZone:"UTC"});return n.getUTCFullYear()===r.getUTCFullYear()?s:`${s}, ${n.getUTCFullYear()}`}const NR="csvjson:changelog.v1",th=Math.max(...PR.map(t=>t.id),0),Nq=Rq(PR);function Iq(t){if(typeof t!="object"||t===null)return!1;const e=t;if(e.lastSeenId!==null&&typeof e.lastSeenId!="number"||typeof e.votes!="object"||e.votes===null)return!1;for(const[n,r]of Object.entries(e.votes))if(!/^\d+$/.test(n)||r!==1&&r!==-1)return!1;return!(e.clientId!==void 0&&!_q(e.clientId)||e.pendingIds!==void 0&&(!Array.isArray(e.pendingIds)||e.pendingIds.some(n=>typeof n!="number"||!Number.isInteger(n)||n<1)))}function _q(t){return typeof t=="string"&&/^[0-9a-fA-F-]{8,64}$/.test(t)}function IR(t){return t===void 0?[]:[...new Set(t)].filter(e=>e>=1&&e<=th).sort((e,n)=>e-n)}function iC(t,e,n){const r=IR(t.pendingIds),i=n?[...new Set([...r,e])].sort((s,o)=>s-o):r.filter(s=>s!==e);return{...t,pendingIds:i}}function Dq(){try{const t=window.localStorage.getItem(NR);if(t===null)return{lastSeenId:null,votes:{}};const e=JSON.parse(t);return Iq(e)?{...e,pendingIds:IR(e.pendingIds)}:{lastSeenId:null,votes:{}}}catch{return{lastSeenId:null,votes:{}}}}function Lq(t){try{window.localStorage.setItem(NR,JSON.stringify(t))}catch{}}function $q(){var n,r,i;if(typeof((n=globalThis.crypto)==null?void 0:n.randomUUID)=="function")return globalThis.crypto.randomUUID();const t=(i=(r=globalThis.crypto)==null?void 0:r.getRandomValues)==null?void 0:i.call(r,new Uint8Array(16));if(t===void 0)throw new Error("no secure randomness available");t[6]=t[6]&15|64,t[8]=t[8]&63|128;const e=Array.from(t,s=>s.toString(16).padStart(2,"0")).join("");return`${e.slice(0,8)}-${e.slice(8,12)}-${e.slice(12,16)}-${e.slice(16,20)}-${e.slice(20)}`}async function Fq(t,e,n){try{return(await fetch("/api/changelog-vote",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({clientId:t,entryId:e,vote:n})})).ok?"ok":"failed"}catch{return"failed"}}function sC(t){return["flex h-6 w-7 cursor-pointer items-center justify-center rounded-md transition-colors",t?"bg-muted text-foreground":"text-muted-foreground hover:bg-muted hover:text-foreground"].join(" ")}function zq({entry:t,vote:e,queued:n,inFlight:r,onVote:i}){return E.jsxs("article",{className:"px-3 py-2.5","data-testid":`changelog-entry-${t.id}`,children:[E.jsxs("div",{className:"mb-1 flex items-center gap-1.5",children:[t.tag!==void 0&&E.jsx("span",{className:"rounded-full border border-border px-1.5 py-px text-[10px] font-medium uppercase tracking-wide text-muted-foreground",children:t.tag}),E.jsx("span",{className:"text-[11px] text-muted-foreground",children:Pq(t.date)})]}),E.jsx("h3",{className:"text-xs font-semibold text-foreground",children:t.title}),E.jsx("p",{className:"mt-0.5 text-xs leading-relaxed text-muted-foreground",children:t.summary}),E.jsxs("div",{className:"mt-1.5 flex gap-1",children:[E.jsx("button",{type:"button","data-testid":`changelog-up-${t.id}`,onClick:()=>i(t.id,1),"aria-pressed":e===1,"aria-label":`Upvote: ${t.title}`,title:"Good change",className:sC(e===1),children:E.jsx(DI,{size:13,strokeWidth:2,"aria-hidden":"true"})}),E.jsx("button",{type:"button","data-testid":`changelog-down-${t.id}`,onClick:()=>i(t.id,-1),"aria-pressed":e===-1,"aria-label":`Downvote: ${t.title}`,title:"Not for me",className:sC(e===-1),children:E.jsx(II,{size:13,strokeWidth:2,"aria-hidden":"true"})})]}),n&&!r&&E.jsx("p",{"data-testid":`changelog-queued-${t.id}`,role:"status",className:"mt-1.5 rounded-sm border border-dashed border-border px-2 py-1 text-[11px] text-muted-foreground",children:"Vote queued — it will retry on your next interaction."})]})}function Bq(){const[t,e]=y.useState(Dq),[n,r]=y.useState(!1),i=y.useRef(t),s=y.useCallback(x=>{Lq(x),i.current=x,e(x)},[]),[o,l]=y.useState(()=>new Set),a=y.useRef(new Set),u=y.useRef(null),c=y.useRef(null),f=y.useRef(new Map),d=t.lastSeenId!==null&&th>t.lastSeenId,h=y.useCallback((x,C)=>{l(T=>{const A=new Set(T);return C?A.add(x):A.delete(x),A})},[]),p=y.useCallback((x,C,T,A)=>{const M=(f.current.get(x)??0)+1;f.current.set(x,M),a.current.add(x),A&&h(x,!0),Fq(T,x,C).then(N=>{f.current.get(x)===M&&(a.current.delete(x),N==="ok"&&(HN({entry_id:x,vote:C}),s(iC(i.current,x,!1))),A&&h(x,!1))})},[s,h]),g=y.useCallback(x=>{const{clientId:C,pendingIds:T,votes:A}=i.current,M=T??[];if(M.length!==0&&C!==void 0)for(const N of M){if(N===x||a.current.has(N))continue;const D=A[N];D!==void 0&&p(N,D,C,!1)}},[p]),b=(x,C)=>{if(t.votes[x]===C){g();return}const T=t.clientId??$q();s(iC({...t,votes:{...t.votes,[x]:C},clientId:T},x,!0)),p(x,C,T,!0),g(x)},m=()=>{r(!0),jN(),t.lastSeenId!==th&&s({...t,lastSeenId:th}),g()},v=y.useCallback(()=>{r(!1)},[]),w=y.useRef(!1);y.useEffect(()=>{var x;w.current&&!n&&((x=c.current)==null||x.focus()),w.current=n},[n]);const k=y.useRef(!1);return y.useEffect(()=>{k.current||(k.current=!0,g())},[g]),y.useEffect(()=>{if(!n)return;const x=T=>{T.key==="Escape"&&v()},C=T=>{const A=u.current;A===null||!(T.target instanceof Node)||A.contains(T.target)||v()};return document.addEventListener("keydown",x),document.addEventListener("click",C),()=>{document.removeEventListener("keydown",x),document.removeEventListener("click",C)}},[n,v]),E.jsxs("div",{"data-testid":"changelog",ref:u,className:"relative max-sm:static",children:[E.jsxs("button",{type:"button","data-testid":"changelog-toggle",ref:c,onClick:()=>n?v():m(),"aria-expanded":n,"aria-haspopup":"dialog","aria-label":"Changelog",title:"What's new",className:"relative inline-flex size-8 cursor-pointer items-center justify-center rounded-lg border border-border bg-panel text-muted-foreground transition-colors outline-none hover:bg-muted hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50",children:[E.jsx(kI,{size:15,strokeWidth:2,"aria-hidden":"true"}),d&&E.jsx("span",{"data-testid":"changelog-dot","aria-hidden":"true",className:"absolute right-1 top-1 size-1.5 rounded-full bg-foreground"})]}),n&&E.jsxs("div",{"data-testid":"changelog-popout",role:"dialog","aria-label":"Changelog",className:"absolute right-0 top-9 z-50 w-80 rounded-md border border-border bg-panel shadow-md max-sm:inset-x-2 max-sm:top-14 max-sm:w-auto",children:[E.jsxs("div",{className:"flex items-center justify-between border-b border-border py-1.5 pl-3 pr-1.5",children:[E.jsx("span",{className:"text-xs font-semibold tracking-tight text-foreground",children:"What's new"}),E.jsx("button",{type:"button","data-testid":"changelog-close",onClick:v,"aria-label":"Close changelog",className:"flex size-6 cursor-pointer items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",children:E.jsx(Ah,{size:14,strokeWidth:2,"aria-hidden":"true"})})]}),E.jsx("div",{className:"max-h-96 divide-y divide-border overflow-y-auto",children:Nq.map(x=>{var C;return E.jsx(zq,{entry:x,vote:t.votes[x.id],queued:((C=t.pendingIds)==null?void 0:C.includes(x.id))??!1,inFlight:o.has(x.id),onVote:b},x.id)})})]})]})}function jq(t,e){const[n,r]=y.useState(t);return y.useEffect(()=>{const i=setTimeout(()=>r(t),e);return()=>clearTimeout(i)},[t,e]),n}const Hq={},Wq=["csv2json","json2csv","json_validator","json_beautifier","sql2json","csvjson2json","datajanitor"],Vq=["csv2json","json2csv","csvjson2json"];function Uq(t){return Vq.includes(t)}const Kq=/^[0-9a-f]{32}$/i,Xq=/^\/([a-z0-9_]+)\/([0-9a-f]{32})\/?$/i,Bm=Hq,Gq=((Bm==null?void 0:Bm.VITE_S3_DATA_URL)??"https://csvjson.s3.us-east-2.amazonaws.com/data/").replace(/\/*$/,"/");function qq(t){const e=Xq.exec(t);if(!e)return null;const n=e[1].toLowerCase();return Wq.includes(n)?{tool:n,id:e[2].toLowerCase()}:null}class Gy extends Error{constructor(){super("This data doesn't exist (or was deleted)"),this.name="PermalinkNotFoundError"}}class jm extends Error{constructor(e,n){super(e,n),this.name="PermalinkFetchError"}}const Hm={csv:(t,e)=>{t.direction="csv2json",t.input=up(e)},json:(t,e)=>{t.input=up(e),t.direction="json2csv"},parseNumbers:(t,e)=>{const n=sa(e);n!==void 0&&(t.options.parseNumbers=n)},parseJSON:(t,e)=>{const n=sa(e);n!==void 0&&(t.options.parseJSON=n)},transpose:(t,e)=>{const n=sa(e);n!==void 0&&(t.options.transpose=n)},"output-array":(t,e)=>{const n=sa(e);n!==void 0&&(t.options.hash=!n)},"output-hash":(t,e)=>{const n=sa(e);n!==void 0&&(t.options.hash=n)},flatten:(t,e)=>{const n=sa(e);n!==void 0&&(t.options.flatten=n)},output_csvjson_variant:()=>{}};function up(t){return typeof t=="string"?t:typeof t=="number"?String(t):""}function oC(t){return typeof t=="string"&&t.trim()!==""}function sa(t){if(t===!0||t==="true")return!0;if(t===!1||t==="false")return!1}function Yq(t){return t===null||typeof t!="object"||Array.isArray(t)?!1:Object.values(t).every(e=>typeof e=="string"||typeof e=="boolean")}function Jq(t){var i;if(!Yq(t))return null;const e=oC(t.csv),n=oC(t.json);if(!e&&!n)return null;const r={direction:e?"csv2json":"json2csv",input:"",options:{}};for(const[s,o]of Object.entries(t))(i=Hm[s])==null||i.call(Hm,r,o);return r.input=up(e?t.csv:t.json),r}async function Qq(t){if(!Kq.test(t))throw new Gy;let e;try{e=await fetch(`${Gq}${t}`,{mode:"cors"})}catch(r){throw new jm("Network error while loading this data",{cause:r})}if(e.status===403||e.status===404)throw new Gy;if(!e.ok)throw new jm(`Unexpected response while loading this data (HTTP ${e.status})`);let n;try{const r=await e.text();if(r.trim()==="")throw new Error("empty body");n=JSON.parse(r)}catch{throw new jm("Stored data for this link is malformed")}return n}function Zq(t){const e=y.useMemo(()=>t&&Uq(t.tool)?t.id:null,[t]),[n,r]=y.useState(0),[i,s]=y.useState(e?"loading":"idle"),[o,l]=y.useState(null),[a,u]=y.useState("");return y.useEffect(()=>{if(!e)return;let c=!1;return Qq(e).then(f=>{if(c)return;const d=Jq(f);d?(l(d),s("hydrated")):s("unsupported")}).catch(f=>{c||(f instanceof Gy?s("not-found"):(u(f instanceof Error?f.message:"Couldn't load this data"),s("error")))}),()=>{c=!0}},[e,n]),{phase:i,hydrated:o,message:a,retry:()=>{i==="error"&&(s("loading"),r(c=>c+1))}}}async function lC(t){try{if(typeof navigator<"u"&&navigator.clipboard)return await navigator.clipboard.writeText(t),!0}catch{}try{const e=document.createElement("textarea");e.value=t,e.setAttribute("readonly",""),e.style.position="fixed",e.style.opacity="0",document.body.appendChild(e),e.select();const n=document.execCommand("copy");return e.remove(),n}catch{return!1}}const eY="\uFEFF";function tY(t,e){return e?eY+t:t}function nY(t,e,n){const r=tY(t,n);return new Blob([r],{type:`${e};charset=utf-8`})}const rY=new Set(["csv","tsv","json","jsonl","sql","ts","txt"]);function iY(t){let e=t;for(;;){const n=e.lastIndexOf(".");if(n<=0)break;if(n===e.length-1){e=e.slice(0,n);continue}if(!rY.has(e.slice(n+1).toLowerCase()))break;e=e.slice(0,n)}return e}function sY(t,e,n="json"){const r=e==="csv2json"?n:"csv";return t?`${iY(t)}.${r}`:`data.${r}`}function oY(t,e="json"){if(t==="json2csv")return"text/csv";switch(e){case"json":return"application/json";case"jsonl":return"application/x-ndjson";case"sql":return"application/sql";case"ts":return"text/typescript"}}function aC(t,e,{mime:n="text/plain",bom:r=!1}={}){const i=nY(t,n,r),s=URL.createObjectURL(i),o=document.createElement("a");return o.href=s,o.download=e,document.body.appendChild(o),o.click(),o.remove(),setTimeout(()=>URL.revokeObjectURL(s),0),e}function lY(t){if(!(t instanceof HTMLElement))return!1;if(t.isContentEditable)return!0;const e=t.tagName;return e==="INPUT"||e==="TEXTAREA"?!0:t.closest('[contenteditable="true"]')!==null}const aY=`album,year,US_peak_chart_post -The White Stripes,1999, -De Stijl,2000, -White Blood Cells,2001,61 -Elephant,2003,6 -Get Behind Me Satan,2005,3 -Icky Thump,2007,2`,uY=`[ - { - "album": "Elephant", - "year": 2003, - "label": "XL Recordings" - }, - { - "album": "Icky Thump", - "year": 2007, - "label": "XL Recordings" - } -]`,_R="csvjson-theme";function cY(){try{const t=localStorage.getItem(_R);return t==="dark"||t==="light"?t:null}catch{return null}}function fY(){try{if(typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches)return"dark"}catch{}return"light"}function dY(){return cY()??fY()}function hY(t){try{localStorage.setItem(_R,t)}catch{}}function pY(t){return new URLSearchParams(t).get("direction")==="json2csv"?"json2csv":"csv2json"}const uC=2*1024*1024,gY=150,mY=1e3,yY=2e3,vY=2e3;function wY(t,e){return t===0?null:e>0?`${t} rows · ${e} cols`:`${t} rows`}function cC(t){try{return JSON.parse(t),!0}catch{return!1}}function bY(){var Ut;const[t,e]=y.useState(dY);y.useEffect(()=>{document.documentElement.classList.toggle("dark",t==="dark")},[t]);const n=()=>e(J=>{const st=J==="dark"?"light":"dark";return hY(st),st}),[r,i]=y.useState(()=>typeof window>"u"?"csv2json":pY(window.location.search)),[s,o]=y.useState(()=>sl("")),l=s.present,[a,u]=y.useState(Yr),[c,f]=y.useState("json"),[d,h]=y.useState(50),[p,g]=y.useState(null),[b,m]=y.useState(!1),[v,w]=y.useState(null),[k,x]=y.useState("utf-8"),[C,T]=y.useState(Kw),[A,M]=y.useState(null),[N,D]=y.useState(null),[O,L]=y.useState({forInput:"",index:0}),_=O.forInput===l?O.index:0,re=y.useCallback(J=>{L({forInput:l,index:J})},[l]),ie=y.useMemo(()=>_>0?{...a,markdownTableIndex:_}:a,[a,_]),se=y.useRef({direction:r,options:a,input:l,resultOk:!0}),H=y.useRef(null);H.current||(H.current=YN({settleMs:yY,minWindowMs:vY,isValid:(J,st)=>{const lt=se.current;return st===lt.input?lt.resultOk:ho(J==="csv_to_json"?"csv2json":"json2csv",st,lt.options).ok}}));const X=H.current;y.useEffect(()=>()=>X.cancel(),[X]);const I=xR("(min-width: 48rem)")?"side-by-side":"stacked",P=r==="csv2json",B=P?"CSV":"JSON",q=P?"JSON":"CSV",W=l.trim()==="",ye=l.length>uC?mY:gY,ee=jq(l,W?0:ye),me=y.useRef(null),Le=y.useRef(null),ze=l!==""&&((Ut=me.current)==null?void 0:Ut.text)===l?l:ee,Mt=P&&A!==null&&ze.trim()!==""?A:ze,tt=y.useMemo(()=>typeof window>"u"?null:qq(window.location.pathname),[]),Be=Zq(tt),ue=y.useMemo(()=>ho(r,Mt,ie),[r,Mt,ie]);se.current={direction:r,options:ie,input:ze,resultOk:ue.ok},y.useEffect(()=>{const J=Le.current;!J||J.text!==ze||(Le.current=null,X.discrete(J.direction,J.via,J.text))},[ze,ue,X]);const[Nt,be]=y.useState(null);y.useEffect(()=>{ze.trim()!==""&&ue.ok&&be(ue.text)},[ue,ze]),y.useEffect(()=>{ze.trim()!==""&&(!ue.ok||ue.rows<=0&&ue.cols<=0||T(tC({direction:r,input:ze,options:a,filename:p,rows:ue.rows,cols:ue.cols})))},[r,ze,p,a,ue]);const xe=ze.trim()!==""&&ue.ok?ue.text:Nt,[Y,Se]=y.useState(!1),[Ne,Ce]=y.useState(null),xt=Y?Ne:xe,$e=y.useMemo(()=>{if(!P||xt===null||c==="json")return xt;const J=Y&&Ne!==null&&cC(Ne)?Ne:xe;return J===null?null:cq(J,c,a,p)},[P,xt,c,Y,Ne,xe,a,p]),nt=P&&c==="json"&&!W&&$e!==null&&(Y||ue.ok),ge=y.useCallback(J=>{if(J===xe){Se(!1),Ce(null);return}Se(!0),Ce(J)},[xe]),ot=y.useCallback(()=>{const J=P&&A!==null&&l.trim()!==""?A:l,st=ho(r,J,ie);st.ok&&be(st.text),Se(!1),Ce(null)},[P,r,ie,l,A]),rt=y.useCallback(J=>{o(st=>P?lk(st,J):sl(J))},[P]),Ke=P&&s.past.length>0,an=P&&s.future.length>0,mt=y.useCallback(()=>{if(!P||s.past.length===0)return;const J=X9(s);w(null),o(J),X.edit("csv_to_json",J.present)},[P,s,X]),it=y.useCallback(()=>{if(!P||s.future.length===0)return;const J=G9(s);w(null),o(J),X.edit("csv_to_json",J.present)},[P,s,X]),dt=y.useCallback(J=>{w(null),me.current=null,i(J.direction),u({...J.options}),g(J.filename),Se(!1),Ce(null),o(st=>J.direction==="csv2json"&&r==="csv2json"?lk(st,J.input):sl(J.input)),T(tC({direction:J.direction,input:J.input,options:J.options,filename:J.filename,rows:J.rows,cols:J.cols}))},[r]),Yt=y.useCallback(J=>{T(bq(J))},[]),mn=y.useCallback(()=>{xq(),T([])},[]),qn=()=>{const J=r==="csv2json"?"json2csv":"csv2json";if(Y){const st=Ne??"",lt=cC(st)?st:l;o(sl(lt)),i(J),Se(!1),Ce(null),lt.trim()!==""&&(se.current={direction:J,options:a,input:lt,resultOk:ho(J,lt,a).ok},X.discrete(J==="csv2json"?"csv_to_json":"json_to_csv","flip",lt));return}if(i(J),W)o(sl(""));else{const st=ho(r,l,ie),lt=st.ok?st.text:l;o(sl(lt)),lt.trim()!==""&&(se.current={direction:J,options:a,input:lt,resultOk:ho(J,lt,a).ok},X.discrete(J==="csv2json"?"csv_to_json":"json_to_csv","flip",lt))}},Jt=Be.hydrated;y.useEffect(()=>{if(Jt===null)return;const J={...se.current.options,...Jt.options};se.current={direction:Jt.direction,options:J,input:Jt.input,resultOk:ho(Jt.direction,Jt.input,J).ok},i(Jt.direction),o(sl(Jt.input)),u(st=>({...st,...Jt.options})),Se(!1),Ce(null),BN(),X.discrete(Jt.direction==="csv2json"?"csv_to_json":"json_to_csv","permalink",Jt.input)},[Jt,X]);const jt=async(J,st)=>{if(!YG(J)){w(`Can't read "${J.name}" as text — drop a ${P?".csv / .tsv":".json"} file.`);return}w(null),m(!0);try{const lt=await GS(J,k);me.current={file:J,source:st,text:lt},Le.current={direction:P?"csv_to_json":"json_to_csv",via:st==="drop"?"drag":"file",text:lt},rt(lt),g(J.name),m(!1)}catch{m(!1),w(`Couldn't read "${J.name}".`)}},Hn=async J=>{const st=k;x(J);const lt=me.current;if(!(!lt||l!==lt.text)){m(!0);try{const Jn=await GS(lt.file,J);me.current={...lt,text:Jn},Le.current={direction:P?"csv_to_json":"json_to_csv",via:lt.source==="drop"?"drag":"file",text:Jn},o(Vr=>({...Vr,present:Jn})),m(!1)}catch{m(!1),x(st),w(`Couldn't read "${lt.file.name}".`)}}},bn=y.useCallback(J=>{w(null),J.trim()===""&&u(st=>{if(!st.columnTypes)return st;const lt={...st};return delete lt.columnTypes,lt}),rt(J),X.edit(P?"csv_to_json":"json_to_csv",J)},[rt,P,X]);y.useEffect(()=>{const J=st=>{var Jn;const lt=(Jn=st.clipboardData)==null?void 0:Jn.getData("text/plain");!lt||lY(st.target)||(st.preventDefault(),st.stopPropagation(),g(null),bn(lt))};return document.addEventListener("paste",J,!0),()=>document.removeEventListener("paste",J,!0)},[bn]);const Yn=ue.ok?wY(ue.rows,ue.cols):null,Wr=!ue.ok&&Nt?"Last valid result — input has errors":null,Ht=ue.ok&&ue.warnings&&ue.warnings.length>0?ue.warnings:null,Qe=l.length>uC,We=P?"csv_to_json":"json_to_csv",Lt=P?c:"csv",Qt=()=>{nl({via:"copy",format:P?"csv":"json",pane:"input",direction:We}),lC(l)},Zt=!P&&N!==null?N:$e,Tn=()=>{nl({via:"copy",format:Lt,pane:"output",direction:We}),Zt&&lC(Zt)},er=()=>{nl({via:"download",format:P?"csv":"json",pane:"input",direction:We}),aC(l,p??(P?"data.csv":"data.json"),{mime:P?"text/csv":"application/json",bom:P})},pt=()=>{nl({via:"download",format:Lt,pane:"output",direction:We}),aC(Zt??"",sY(p,P?"csv2json":"json2csv",c),{mime:oY(P?"csv2json":"json2csv",c),bom:!P})},Wt=y.useCallback(()=>{nl({via:"copy",format:"csv",pane:"input",direction:We})},[We]),Rt=y.useCallback(()=>{nl({via:"copy",format:"csv",pane:"output",direction:We})},[We]),Ft=y.useCallback(()=>{nl({via:"copy",format:Lt,pane:"output",direction:We})},[Lt,We]),tn=E.jsx(GG,{format:B,input:l,onInputChange:bn,onCellCommit:bn,onFile:jt,onTryExample:()=>{w(null);const J=P?aY:uY;se.current={direction:r,options:a,input:J,resultOk:ho(r,J,a).ok},rt(J),X.discrete(We,"example",J)},onClear:()=>{rt(""),g(null),u(J=>{if(!J.columnTypes)return J;const st={...J};return delete st.columnTypes,st}),Se(!1),Ce(null),X.cancel()},onCopy:Qt,onCopySelection:Wt,onProjectedCsvChange:M,onDownload:er,canUndo:Ke,canRedo:an,onUndo:mt,onRedo:it,collapseIndexedArrays:a.collapseIndexedArrays??!0,onToggleCollapseIndexedArrays:()=>u(J=>({...J,collapseIndexedArrays:!(J.collapseIndexedArrays??!0)})),columnTypes:a.columnTypes??{},onChangeColumnTypes:J=>u(st=>{const lt={...st};return Object.keys(J).length>0?lt.columnTypes=J:delete lt.columnTypes,lt}),flatten:a.flatten,onToggleFlatten:()=>u(J=>({...J,flatten:!J.flatten})),selectedMarkdownTableIndex:_,onSelectMarkdownTableIndex:re,filename:p,reading:b,meta:Yn,error:null,notice:v,delimiter:a.separator==="auto"?void 0:a.separator,dark:t==="dark"}),Vt=E.jsx(hq,{format:q,inputEmpty:W,outputText:$e,error:ue.ok?null:ue.error,meta:Yn,staleNotice:Wr,warnings:Ht,edited:Y,editable:nt,egressFormat:c,delimiter:a.separator==="auto"?void 0:a.separator,dark:t==="dark",onCopy:Tn,onCopySelection:Rt,onProjectedCsvChange:D,onNativeCopy:Ft,onDownload:pt,onEgressFormatChange:f,onOutputChange:ge,onRevert:ot,onDiscardReconvert:ot});return E.jsxs("div",{className:"flex min-h-svh flex-col bg-background text-foreground",children:[E.jsx("h1",{className:"sr-only",children:"CSV to JSON and JSON to CSV converter"}),E.jsxs("div",{className:"flex min-h-svh flex-col md:h-svh md:min-h-0",children:[E.jsx(C_,{}),E.jsx(Mq,{theme:t,onToggleTheme:n,slot:E.jsxs("div",{className:"flex items-center gap-1",children:[E.jsx(Tq,{snapshots:C,onSelect:dt,onRemove:Yt,onClear:mn}),E.jsx(Bq,{}),E.jsx(R_,{})]})}),tt&&(Be.phase==="loading"||Be.phase==="not-found"||Be.phase==="unsupported"||Be.phase==="error")?E.jsx(pq,{phase:Be.phase,message:Be.phase==="error"?Be.message:void 0,onRetry:Be.retry}):null,E.jsx(Eq,{layout:I,split:d,onSplitChange:h,left:tn,right:Vt,children:E.jsx(b_,{direction:r,onFlip:qn})}),E.jsx(ZG,{direction:r,options:a,onChange:J=>u(st=>({...st,...J})),uploadEncoding:k,onUploadEncodingChange:Hn,notice:Qe?"Large file — converting on pause":null})]}),E.jsx(k_,{})]})}ST(document.getElementById("root")).render(E.jsx(y.StrictMode,{children:E.jsx(bY,{})}));document.getElementById("root").removeAttribute("inert");FN();zN();export{v6 as C,Kn as R,W4 as T,xa as a,g$ as b,LN as c,oa as i,H4 as m,y as r,ai as s}; diff --git a/app/dist/assets/index-Dw_RpILp.js b/app/dist/assets/index-Dw_RpILp.js new file mode 100644 index 00000000..e2822d20 --- /dev/null +++ b/app/dist/assets/index-Dw_RpILp.js @@ -0,0 +1,114 @@ +var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t,t.exports),e=null),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;li[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,o)=>(o=n==null?{}:e(i(n)),s(r||!n||!n.__esModule||!a.call(n,`default`)?t(o,`default`,{value:n,enumerable:!0}):o,n));(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var l=o((e=>{var t=Symbol.for(`react.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.provider`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.iterator;function p(e){return typeof e!=`object`||!e?null:(e=f&&e[f]||e[`@@iterator`],typeof e==`function`?e:null)}var m={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},h=Object.assign,g={};function _(e,t,n){this.props=e,this.context=t,this.refs=g,this.updater=n||m}_.prototype.isReactComponent={},_.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`setState(...): takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},_.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function v(){}v.prototype=_.prototype;function y(e,t,n){this.props=e,this.context=t,this.refs=g,this.updater=n||m}var b=y.prototype=new v;b.constructor=y,h(b,_.prototype),b.isPureReactComponent=!0;var x=Array.isArray,S=Object.prototype.hasOwnProperty,C={current:null},w={key:!0,ref:!0,__self:!0,__source:!0};function T(e,n,r){var i,a={},o=null,s=null;if(n!=null)for(i in n.ref!==void 0&&(s=n.ref),n.key!==void 0&&(o=``+n.key),n)S.call(n,i)&&!w.hasOwnProperty(i)&&(a[i]=n[i]);var c=arguments.length-2;if(c===1)a.children=r;else if(1{t.exports=l()})),d=o((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0>>1,a=e[r];if(0>>1;ri(c,n))li(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(li(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=typeof setTimeout==`function`?setTimeout:null,_=typeof clearTimeout==`function`?clearTimeout:null,v=typeof setImmediate<`u`?setImmediate:null;typeof navigator<`u`&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function y(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function b(e){if(h=!1,y(e),!m){if(n(c)!==null)m=!0,te(x);else{var t=n(l);t!==null&&ne(b,t.startTime-e)}}}function x(t,i){m=!1,h&&(h=!1,_(w),w=-1),p=!0;var a=f;try{for(y(i),d=n(c);d!==null&&(!(d.expirationTime>i)||t&&!D());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=i);i=e.unstable_now(),typeof s==`function`?d.callback=s:d===n(c)&&r(c),y(i)}else r(c);d=n(c)}if(d!==null)var u=!0;else{var g=n(l);g!==null&&ne(b,g.startTime-i),u=!1}return u}finally{d=null,f=a,p=!1}}var S=!1,C=null,w=-1,T=5,E=-1;function D(){return!(e.unstable_now()-Ee||125o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(_(w),w=-1):h=!0,ne(b,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,te(x))),r},e.unstable_shouldYield=D,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),f=o(((e,t)=>{t.exports=d()})),p=o((e=>{var t=u(),n=f();function r(e){for(var t=`https://reactjs.org/docs/error-decoder.html?invariant=`+e,n=1;nt}return!1}function v(e,t,n,r,i,a,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=a,this.removeEmptyString=o}var y={};`children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style`.split(` `).forEach(function(e){y[e]=new v(e,0,!1,e,null,!1,!1)}),[[`acceptCharset`,`accept-charset`],[`className`,`class`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`]].forEach(function(e){var t=e[0];y[t]=new v(t,1,!1,e[1],null,!1,!1)}),[`contentEditable`,`draggable`,`spellCheck`,`value`].forEach(function(e){y[e]=new v(e,2,!1,e.toLowerCase(),null,!1,!1)}),[`autoReverse`,`externalResourcesRequired`,`focusable`,`preserveAlpha`].forEach(function(e){y[e]=new v(e,2,!1,e,null,!1,!1)}),`allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope`.split(` `).forEach(function(e){y[e]=new v(e,3,!1,e.toLowerCase(),null,!1,!1)}),[`checked`,`multiple`,`muted`,`selected`].forEach(function(e){y[e]=new v(e,3,!0,e,null,!1,!1)}),[`capture`,`download`].forEach(function(e){y[e]=new v(e,4,!1,e,null,!1,!1)}),[`cols`,`rows`,`size`,`span`].forEach(function(e){y[e]=new v(e,6,!1,e,null,!1,!1)}),[`rowSpan`,`start`].forEach(function(e){y[e]=new v(e,5,!1,e.toLowerCase(),null,!1,!1)});var b=/[\-:]([a-z])/g;function x(e){return e[1].toUpperCase()}`accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height`.split(` `).forEach(function(e){var t=e.replace(b,x);y[t]=new v(t,1,!1,e,null,!1,!1)}),`xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type`.split(` `).forEach(function(e){var t=e.replace(b,x);y[t]=new v(t,1,!1,e,`http://www.w3.org/1999/xlink`,!1,!1)}),[`xml:base`,`xml:lang`,`xml:space`].forEach(function(e){var t=e.replace(b,x);y[t]=new v(t,1,!1,e,`http://www.w3.org/XML/1998/namespace`,!1,!1)}),[`tabIndex`,`crossOrigin`].forEach(function(e){y[e]=new v(e,1,!1,e.toLowerCase(),null,!1,!1)}),y.xlinkHref=new v(`xlinkHref`,1,!1,`xlink:href`,`http://www.w3.org/1999/xlink`,!0,!1),[`src`,`href`,`action`,`formAction`].forEach(function(e){y[e]=new v(e,1,!1,e.toLowerCase(),null,!0,!0)});function S(e,t,n,r){var i=y.hasOwnProperty(t)?y[t]:null;(i===null?r||!(2s||i[o]!==a[s]){var c=` +`+i[o].replace(` at new `,` at `);return e.displayName&&c.includes(``)&&(c=c.replace(``,e.displayName)),c}while(1<=o&&0<=s);break}}}finally{se=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:``)?P(e):``}function F(e){switch(e.tag){case 5:return P(e.type);case 16:return P(`Lazy`);case 13:return P(`Suspense`);case 19:return P(`SuspenseList`);case 0:case 2:case 15:return e=ce(e.type,!1),e;case 11:return e=ce(e.type.render,!1),e;case 1:return e=ce(e.type,!0),e;default:return``}}function le(e){if(e==null)return null;if(typeof e==`function`)return e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case E:return`Fragment`;case T:return`Portal`;case O:return`Profiler`;case D:return`StrictMode`;case te:return`Suspense`;case ne:return`SuspenseList`}if(typeof e==`object`)switch(e.$$typeof){case A:return(e.displayName||`Context`)+`.Consumer`;case k:return(e._context.displayName||`Context`)+`.Provider`;case ee:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case re:return t=e.displayName||null,t===null?le(e.type)||`Memo`:t;case j:t=e._payload,e=e._init;try{return le(e(t))}catch{}}return null}function ue(e){var t=e.type;switch(e.tag){case 24:return`Cache`;case 9:return(t.displayName||`Context`)+`.Consumer`;case 10:return(t._context.displayName||`Context`)+`.Provider`;case 18:return`DehydratedFragment`;case 11:return e=t.render,e=e.displayName||e.name||``,t.displayName||(e===``?`ForwardRef`:`ForwardRef(`+e+`)`);case 7:return`Fragment`;case 5:return t;case 4:return`Portal`;case 3:return`Root`;case 6:return`Text`;case 16:return le(t);case 8:return t===D?`StrictMode`:`Mode`;case 22:return`Offscreen`;case 12:return`Profiler`;case 21:return`Scope`;case 13:return`Suspense`;case 19:return`SuspenseList`;case 25:return`TracingMarker`;case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t==`function`)return t.displayName||t.name||null;if(typeof t==`string`)return t}return null}function de(e){switch(typeof e){case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function fe(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function pe(e){var t=fe(e)?`checked`:`value`,n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=``+e[t];if(!e.hasOwnProperty(t)&&n!==void 0&&typeof n.get==`function`&&typeof n.set==`function`){var i=n.get,a=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){r=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(e){r=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function me(e){e._valueTracker||=pe(e)}function he(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=fe(e)?e.checked?`true`:`false`:e.value),e=r,e!==n&&(t.setValue(e),!0)}function ge(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}function I(e,t){var n=t.checked;return N({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function L(e,t){var n=t.defaultValue==null?``:t.defaultValue,r=t.checked==null?t.defaultChecked:t.checked;n=de(t.value==null?n:t.value),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type===`checkbox`||t.type===`radio`?t.checked!=null:t.value!=null}}function _e(e,t){t=t.checked,t!=null&&S(e,`checked`,t,!1)}function R(e,t){_e(e,t);var n=de(t.value),r=t.type;if(n!=null)r===`number`?(n===0&&e.value===``||e.value!=n)&&(e.value=``+n):e.value!==``+n&&(e.value=``+n);else if(r===`submit`||r===`reset`){e.removeAttribute(`value`);return}t.hasOwnProperty(`value`)?ye(e,t.type,n):t.hasOwnProperty(`defaultValue`)&&ye(e,t.type,de(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function ve(e,t,n){if(t.hasOwnProperty(`value`)||t.hasOwnProperty(`defaultValue`)){var r=t.type;if(!(r!==`submit`&&r!==`reset`||t.value!==void 0&&t.value!==null))return;t=``+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==``&&(e.name=``),e.defaultChecked=!!e._wrapperState.initialChecked,n!==``&&(e.name=n)}function ye(e,t,n){(t!==`number`||ge(e.ownerDocument)!==e)&&(n==null?e.defaultValue=``+e._wrapperState.initialValue:e.defaultValue!==``+n&&(e.defaultValue=``+n))}var be=Array.isArray;function xe(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i`+t.valueOf().toString()+``,t=Ee.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Oe(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var ke={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Ae=[`Webkit`,`ms`,`Moz`,`O`];Object.keys(ke).forEach(function(e){Ae.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),ke[t]=ke[e]})});function je(e,t,n){return t==null||typeof t==`boolean`||t===``?``:n||typeof t!=`number`||t===0||ke.hasOwnProperty(e)&&ke[e]?(``+t).trim():t+`px`}function Me(e,t){for(var n in e=e.style,t)if(t.hasOwnProperty(n)){var r=n.indexOf(`--`)===0,i=je(n,t[n],r);n===`float`&&(n=`cssFloat`),r?e.setProperty(n,i):e[n]=i}}var Ne=N({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Pe(e,t){if(t){if(Ne[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(r(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(r(60));if(typeof t.dangerouslySetInnerHTML!=`object`||!(`__html`in t.dangerouslySetInnerHTML))throw Error(r(61))}if(t.style!=null&&typeof t.style!=`object`)throw Error(r(62))}}function Fe(e,t){if(e.indexOf(`-`)===-1)return typeof t.is==`string`;switch(e){case`annotation-xml`:case`color-profile`:case`font-face`:case`font-face-src`:case`font-face-uri`:case`font-face-format`:case`font-face-name`:case`missing-glyph`:return!1;default:return!0}}var Ie=null;function Le(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Re=null,ze=null,Be=null;function Ve(e){if(e=Ri(e)){if(typeof Re!=`function`)throw Error(r(280));var t=e.stateNode;t&&(t=Bi(t),Re(e.stateNode,e.type,t))}}function He(e){ze?Be?Be.push(e):Be=[e]:ze=e}function Ue(){if(ze){var e=ze,t=Be;if(Be=ze=null,Ve(e),t)for(e=0;e>>=0,e===0?32:31-(V(e)/Et|0)|0}var Ot=64,kt=4194304;function At(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function jt(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,a=e.pingedLanes,o=n&268435455;if(o!==0){var s=o&~i;s===0?(a&=o,a!==0&&(r=At(a))):r=At(s)}else o=n&~i,o===0?a!==0&&(r=At(a)):r=At(o);if(r===0)return 0;if(t!==0&&t!==r&&(t&i)===0&&(i=r&-r,a=t&-t,i>=a||i===16&&a&4194240))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function Lt(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Tt(t),e[t]=n}function Rt(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=W),er=` `,tr=!1;function nr(e,t){switch(e){case`keyup`:return Xn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function rr(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var ir=!1;function ar(e,t){switch(e){case`compositionend`:return rr(t);case`keypress`:return t.which===32?(tr=!0,er):null;case`textInput`:return e=t.data,e===er&&tr?null:e;default:return null}}function or(e,t){if(ir)return e===`compositionend`||!Zn&&nr(e,t)?(e=xn(),bn=yn=vn=null,ir=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=Or(n)}}function Ar(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Ar(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function jr(){for(var e=window,t=ge();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=ge(e.document)}return t}function Mr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}function Nr(e){var t=jr(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Ar(n.ownerDocument.documentElement,n)){if(r!==null&&Mr(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),`selectionStart`in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=n.textContent.length,a=Math.min(r.start,i);r=r.end===void 0?a:Math.min(r.end,i),!e.extend&&a>r&&(i=r,r=a,a=i),i=kr(n,a);var o=kr(n,r);i&&o&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),a>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus==`function`&&n.focus(),n=0;n=document.documentMode,Fr=null,Ir=null,Lr=null,Rr=!1;function zr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Rr||Fr==null||Fr!==ge(r)||(r=Fr,`selectionStart`in r&&Mr(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Lr&&Dr(Lr,r)||(Lr=r,r=di(Ir,`onSelect`),0Hi||(e.current=Vi[Hi],Vi[Hi]=null,Hi--)}function Ui(e,t){Hi++,Vi[Hi]=e.current,e.current=t}var Wi={},Gi=G(Wi),Ki=G(!1),qi=Wi;function Ji(e,t){var n=e.type.contextTypes;if(!n)return Wi;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},a;for(a in n)i[a]=t[a];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function Yi(e){return e=e.childContextTypes,e!=null}function Xi(){K(Ki),K(Gi)}function Zi(e,t,n){if(Gi.current!==Wi)throw Error(r(168));Ui(Gi,t),Ui(Ki,n)}function Qi(e,t,n){var i=e.stateNode;if(t=t.childContextTypes,typeof i.getChildContext!=`function`)return n;for(var a in i=i.getChildContext(),i)if(!(a in t))throw Error(r(108,ue(e)||`Unknown`,a));return N({},n,i)}function q(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Wi,qi=Gi.current,Ui(Gi,e),Ui(Ki,Ki.current),!0}function $i(e,t,n){var i=e.stateNode;if(!i)throw Error(r(169));n?(e=Qi(e,t,qi),i.__reactInternalMemoizedMergedChildContext=e,K(Ki),K(Gi),Ui(Gi,e)):K(Ki),Ui(Ki,n)}var ea=null,ta=!1,na=!1;function ra(e){ea===null?ea=[e]:ea.push(e)}function ia(e){ta=!0,ra(e)}function aa(){if(!na&&ea!==null){na=!0;var e=0,t=Bt;try{var n=ea;for(Bt=1;e>=o,i-=o,pa=1<<32-Tt(t)+i|n<h?(g=d,d=null):g=d.sibling;var _=p(r,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(r,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(r,d),xa&&ha(r,h),l;if(d===null){for(;hg?(_=h,h=null):_=h.sibling;var y=p(a,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(a,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(a,h),xa&&ha(a,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return xa&&ha(a,g),u}for(h=i(a,h);!v.done;g++,v=c.next())v=m(h,a,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(a,e)}),xa&&ha(a,g),u}function _(e,r,i,o){if(typeof i==`object`&&i&&i.type===E&&i.key===null&&(i=i.props.children),typeof i==`object`&&i){switch(i.$$typeof){case w:a:{for(var c=i.key,l=r;l!==null;){if(l.key===c){if(c=i.type,c===E){if(l.tag===7){n(e,l.sibling),r=a(l,i.props.children),r.return=e,e=r;break a}}else if(l.elementType===c||typeof c==`object`&&c&&c.$$typeof===j&&Fa(c)===l.type){n(e,l.sibling),r=a(l,i.props),r.ref=Na(e,l,i),r.return=e,e=r;break a}n(e,l);break}t(e,l),l=l.sibling}i.type===E?(r=nu(i.props.children,e.mode,o,i.key),r.return=e,e=r):(o=tu(i.type,i.key,i.props,null,e.mode,o),o.ref=Na(e,r,i),o.return=e,e=o)}return s(e);case T:a:{for(l=i.key;r!==null;){if(r.key===l){if(r.tag===4&&r.stateNode.containerInfo===i.containerInfo&&r.stateNode.implementation===i.implementation){n(e,r.sibling),r=a(r,i.children||[]),r.return=e,e=r;break a}n(e,r);break}t(e,r),r=r.sibling}r=au(i,e.mode,o),r.return=e,e=r}return s(e);case j:return l=i._init,_(e,r,l(i._payload),o)}if(be(i))return h(e,r,i,o);if(ae(i))return g(e,r,i,o);Pa(e,i)}return typeof i==`string`&&i!==``||typeof i==`number`?(i=``+i,r!==null&&r.tag===6?(n(e,r.sibling),r=a(r,i),r.return=e,e=r):(n(e,r),r=iu(i,e.mode,o),r.return=e,e=r),s(e)):n(e,r)}return _}var La=Ia(!0),Ra=Ia(!1),za=G(null),Ba=null,Va=null,Ha=null;function Ua(){Ha=Va=Ba=null}function Wa(e){var t=za.current;K(za),e._currentValue=t}function Ga(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function Ka(e,t){Ba=e,Ha=Va=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(Is=!0),e.firstContext=null)}function qa(e){var t=e._currentValue;if(Ha!==e){if(e={context:e,memoizedValue:t,next:null},Va===null){if(Ba===null)throw Error(r(308));Va=e,Ba.dependencies={lanes:0,firstContext:e}}else Va=Va.next=e}return t}var Ja=null;function Ya(e){Ja===null?Ja=[e]:Ja.push(e)}function Xa(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,Ya(t)):(n.next=i.next,i.next=n),t.interleaved=n,Za(e,r)}function Za(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Qa=!1;function $a(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function eo(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function to(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function no(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Gc&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,Za(e,n)}return i=r.interleaved,i===null?(t.next=t,Ya(r)):(t.next=i.next,i.next=t),r.interleaved=t,Za(e,n)}function ro(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194240)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,zt(e,n)}}function io(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,effects:r.effects},e.updateQueue=n}else e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function ao(e,t,n,r){var i=e.updateQueue;Qa=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane,p=s.eventTime;if((r&f)===f){u!==null&&(u=u.next={eventTime:p,lane:0,tag:s.tag,payload:s.payload,callback:s.callback,next:null});a:{var m=e,h=s;switch(f=t,p=n,h.tag){case 1:if(m=h.payload,typeof m==`function`){d=m.call(p,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=h.payload,f=typeof m==`function`?m.call(p,d,f):m,f==null)break a;d=N({},d,f);break a;case 2:Qa=!0}}s.callback!==null&&s.lane!==0&&(e.flags|=64,f=i.effects,f===null?i.effects=[s]:f.push(s))}else p={eventTime:p,lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;f=s,s=f.next,f.next=null,i.lastBaseUpdate=f,i.shared.pending=null}}while(1);if(u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,t=i.shared.interleaved,t!==null){i=t;do o|=i.lane,i=i.next;while(i!==t)}else a===null&&(i.shared.lanes=0);$c|=o,e.lanes=o,e.memoizedState=d}}function oo(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=So.transition;So.transition={};try{e(!1),t()}finally{Bt=n,So.transition=r}}function ls(){return Io().memoizedState}function us(e,t,n){var r=vl(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},fs(e))ps(t,n);else if(n=Xa(e,t,n,r),n!==null){var i=_l();yl(n,e,r,i),ms(n,t,r)}}function ds(e,t,n){var r=vl(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(fs(e))ps(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,Er(s,o)){var c=t.interleaved;c===null?(i.next=i,Ya(t)):(i.next=c.next,c.next=i),t.interleaved=i;return}}catch{}n=Xa(e,t,i,r),n!==null&&(i=_l(),yl(n,e,r,i),ms(n,t,r))}}function fs(e){var t=e.alternate;return e===wo||t!==null&&t===wo}function ps(e,t){Oo=Do=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function ms(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,zt(e,n)}}var hs={readContext:qa,useCallback:jo,useContext:jo,useEffect:jo,useImperativeHandle:jo,useInsertionEffect:jo,useLayoutEffect:jo,useMemo:jo,useReducer:jo,useRef:jo,useState:jo,useDebugValue:jo,useDeferredValue:jo,useTransition:jo,useMutableSource:jo,useSyncExternalStore:jo,useId:jo,unstable_isNewReconciler:!1},gs={readContext:qa,useCallback:function(e,t){return Fo().memoizedState=[e,t===void 0?null:t],e},useContext:qa,useEffect:Qo,useImperativeHandle:function(e,t,n){return n=n==null?null:n.concat([e]),Xo(4194308,4,ns.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Xo(4194308,4,e,t)},useInsertionEffect:function(e,t){return Xo(4,2,e,t)},useMemo:function(e,t){var n=Fo();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Fo();return t=n===void 0?t:n(t),r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=us.bind(null,wo,e),[r.memoizedState,e]},useRef:function(e){var t=Fo();return e={current:e},t.memoizedState=e},useState:qo,useDebugValue:is,useDeferredValue:function(e){return Fo().memoizedState=e},useTransition:function(){var e=qo(!1),t=e[0];return e=cs.bind(null,e[1]),Fo().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var i=wo,a=Fo();if(xa){if(n===void 0)throw Error(r(407));n=n()}else{if(n=t(),Kc===null)throw Error(r(349));Co&30||Ho(i,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,Qo(Wo.bind(null,i,o,e),[e]),i.flags|=2048,Jo(9,Uo.bind(null,i,o,n,t),void 0,null),n},useId:function(){var e=Fo(),t=Kc.identifierPrefix;if(xa){var n=ma,r=pa;n=(r&~(1<<32-Tt(r)-1)).toString(32)+n,t=`:`+t+`R`+n,n=ko++,0<\/script>`,e=e.removeChild(e.firstChild)):typeof i.is==`string`?e=c.createElement(n,{is:i.is}):(e=c.createElement(n),n===`select`&&(c=e,i.multiple?c.multiple=!0:i.size&&(c.size=i.size))):e=c.createElementNS(e,n),e[ji]=t,e[Mi]=i,oc(e,t,!1,!1),t.stateNode=e;a:{switch(c=Fe(n,i),n){case`dialog`:ii(`cancel`,e),ii(`close`,e),o=i;break;case`iframe`:case`object`:case`embed`:ii(`load`,e),o=i;break;case`video`:case`audio`:for(o=0;oal&&(t.flags|=128,i=!0,lc(s,!1),t.lanes=4194304)}}else{if(!i){if(e=vo(c),e!==null){if(t.flags|=128,i=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),lc(s,!0),s.tail===null&&s.tailMode===`hidden`&&!c.alternate&&!xa)return uc(t),null}else 2*ht()-s.renderingStartTime>al&&n!==1073741824&&(t.flags|=128,i=!0,lc(s,!1),t.lanes=4194304)}s.isBackwards?(c.sibling=t.child,t.child=c):(n=s.last,n===null?t.child=c:n.sibling=c,s.last=c)}return s.tail===null?(uc(t),null):(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=ht(),t.sibling=null,n=_o.current,Ui(_o,i?n&1|2:n&1),t);case 22:case 23:return kl(),i=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==i&&(t.flags|=8192),i&&t.mode&1?Yc&1073741824&&(uc(t),t.subtreeFlags&6&&(t.flags|=8192)):uc(t),null;case 24:return null;case 25:return null}throw Error(r(156,t.tag))}function fc(e,t){switch(va(t),t.tag){case 1:return Yi(t.type)&&Xi(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return mo(),K(Ki),K(Gi),bo(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return go(t),null;case 13:if(K(_o),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(r(340));Aa()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return K(_o),null;case 4:return mo(),null;case 10:return Wa(t.type._context),null;case 22:case 23:return kl(),null;case 24:return null;default:return null}}var pc=!1,mc=!1,hc=typeof WeakSet==`function`?WeakSet:Set,J=null;function gc(e,t){var n=e.ref;if(n!==null){if(typeof n==`function`)try{n(null)}catch(n){Ul(e,t,n)}else n.current=null}}function _c(e,t,n){try{n()}catch(n){Ul(e,t,n)}}var vc=!1;function yc(e,t){if(yi=dn,e=jr(),Mr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var i=n.getSelection&&n.getSelection();if(i&&i.rangeCount!==0){n=i.anchorNode;var a=i.anchorOffset,o=i.focusNode;i=i.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||a!==0&&f.nodeType!==3||(c=s+a),f!==o||i!==0&&f.nodeType!==3||(l=s+i),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===a&&(c=s),p===o&&++d===i&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(bi={focusedElem:e,selectionRange:n},dn=!1,J=t;J!==null;)if(t=J,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,J=e;else for(;J!==null;){t=J;try{var h=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(h!==null){var g=h.memoizedProps,_=h.memoizedState,v=t.stateNode;v.__reactInternalSnapshotBeforeUpdate=v.getSnapshotBeforeUpdate(t.elementType===t.type?g:ys(t.type,g),_)}break;case 3:var y=t.stateNode.containerInfo;y.nodeType===1?y.textContent=``:y.nodeType===9&&y.documentElement&&y.removeChild(y.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(e){Ul(t,t.return,e)}if(e=t.sibling,e!==null){e.return=t.return,J=e;break}J=t.return}return h=vc,vc=!1,h}function bc(e,t,n){var r=t.updateQueue;if(r=r===null?null:r.lastEffect,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var a=i.destroy;i.destroy=void 0,a!==void 0&&_c(t,n,a)}i=i.next}while(i!==r)}}function xc(e,t){if(t=t.updateQueue,t=t===null?null:t.lastEffect,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Sc(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t==`function`?t(e):t.current=e}}function Cc(e){var t=e.alternate;t!==null&&(e.alternate=null,Cc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[ji],delete t[Mi],delete t[Pi],delete t[Fi],delete t[Ii])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function wc(e){return e.tag===5||e.tag===3||e.tag===4}function Tc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||wc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Ec(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=vi));else if(r!==4&&(e=e.child,e!==null))for(Ec(e,t,n),e=e.sibling;e!==null;)Ec(e,t,n),e=e.sibling}function Dc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Dc(e,t,n),e=e.sibling;e!==null;)Dc(e,t,n),e=e.sibling}var Oc=null,kc=!1;function Ac(e,t,n){for(n=n.child;n!==null;)jc(e,t,n),n=n.sibling}function jc(e,t,n){if(Ct&&typeof Ct.onCommitFiberUnmount==`function`)try{Ct.onCommitFiberUnmount(St,n)}catch{}switch(n.tag){case 5:mc||gc(n,t);case 6:var r=Oc,i=kc;Oc=null,Ac(e,t,n),Oc=r,kc=i,Oc!==null&&(kc?(e=Oc,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Oc.removeChild(n.stateNode));break;case 18:Oc!==null&&(kc?(e=Oc,n=n.stateNode,e.nodeType===8?Di(e.parentNode,n):e.nodeType===1&&Di(e,n),ln(e)):Di(Oc,n.stateNode));break;case 4:r=Oc,i=kc,Oc=n.stateNode.containerInfo,kc=!0,Ac(e,t,n),Oc=r,kc=i;break;case 0:case 11:case 14:case 15:if(!mc&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var a=i,o=a.destroy;a=a.tag,o!==void 0&&(a&2||a&4)&&_c(n,t,o),i=i.next}while(i!==r)}Ac(e,t,n);break;case 1:if(!mc&&(gc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(e){Ul(n,t,e)}Ac(e,t,n);break;case 21:Ac(e,t,n);break;case 22:n.mode&1?(mc=(r=mc)||n.memoizedState!==null,Ac(e,t,n),mc=r):Ac(e,t,n);break;default:Ac(e,t,n)}}function Mc(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new hc),t.forEach(function(t){var r=ql.bind(null,e,t);n.has(t)||(n.add(t),t.then(r,r))})}}function Nc(e,t){var n=t.deletions;if(n!==null)for(var i=0;ia&&(a=s),i&=~o}if(i=a,i=ht()-i,i=(120>i?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*Vc(i/1960))-i,10e?16:e,dl===null)var i=!1;else{if(e=dl,dl=null,fl=0,Gc&6)throw Error(r(331));var a=Gc;for(Gc|=4,J=e.current;J!==null;){var o=J,s=o.child;if(J.flags&16){var c=o.deletions;if(c!==null){for(var l=0;lht()-il?Al(e,0):tl|=n),bl(e,t)}function Gl(e,t){t===0&&(e.mode&1?(t=kt,kt<<=1,!(kt&130023424)&&(kt=4194304)):t=1);var n=_l();e=Za(e,t),e!==null&&(Lt(e,t,n),bl(e,n))}function Kl(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Gl(e,n)}function ql(e,t){var n=0;switch(e.tag){case 13:var i=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:i=e.stateNode;break;default:throw Error(r(314))}i!==null&&i.delete(t),Gl(e,n)}var Jl=function(e,t,n){if(e!==null){if(e.memoizedProps!==t.pendingProps||Ki.current)Is=!0;else{if((e.lanes&n)===0&&!(t.flags&128))return Is=!1,ac(e,t,n);Is=!!(e.flags&131072)}}else Is=!1,xa&&t.flags&1048576&&ga(t,la,t.index);switch(t.lanes=0,t.tag){case 2:var i=t.type;rc(e,t),e=t.pendingProps;var a=Ji(t,Gi.current);Ka(t,n),a=No(null,t,i,e,a,n);var o=Po();return t.flags|=1,typeof a==`object`&&a&&typeof a.render==`function`&&a.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Yi(i)?(o=!0,q(t)):o=!1,t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,$a(t),a.updater=xs,t.stateNode=a,a._reactInternals=t,Ts(t,i,e,n),t=Gs(null,t,i,!0,o,n)):(t.tag=0,xa&&o&&_a(t),Ls(null,t,a,n),t=t.child),t;case 16:i=t.elementType;a:{switch(rc(e,t),e=t.pendingProps,a=i._init,i=a(i._payload),t.type=i,a=t.tag=$l(i),e=ys(i,e),a){case 0:t=Us(null,t,i,e,n);break a;case 1:t=Ws(null,t,i,e,n);break a;case 11:t=Rs(null,t,i,e,n);break a;case 14:t=zs(null,t,i,ys(i.type,e),n);break a}throw Error(r(306,i,``))}return t;case 0:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:ys(i,a),Us(e,t,i,a,n);case 1:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:ys(i,a),Ws(e,t,i,a,n);case 3:a:{if(Ks(t),e===null)throw Error(r(387));i=t.pendingProps,o=t.memoizedState,a=o.element,eo(e,t),ao(t,i,null,n);var s=t.memoizedState;if(i=s.element,o.isDehydrated){if(o={element:i,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){a=Es(Error(r(423)),t),t=qs(e,t,i,n,a);break a}if(i!==a){a=Es(Error(r(424)),t),t=qs(e,t,i,n,a);break a}for(ba=Oi(t.stateNode.containerInfo.firstChild),ya=t,xa=!0,Sa=null,n=Ra(t,null,i,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Aa(),i===a){t=ic(e,t,n);break a}Ls(e,t,i,n)}t=t.child}return t;case 5:return ho(t),e===null&&Ea(t),i=t.type,a=t.pendingProps,o=e===null?null:e.memoizedProps,s=a.children,xi(i,a)?s=null:o!==null&&xi(i,o)&&(t.flags|=32),Hs(e,t),Ls(e,t,s,n),t.child;case 6:return e===null&&Ea(t),null;case 13:return Xs(e,t,n);case 4:return po(t,t.stateNode.containerInfo),i=t.pendingProps,e===null?t.child=La(t,null,i,n):Ls(e,t,i,n),t.child;case 11:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:ys(i,a),Rs(e,t,i,a,n);case 7:return Ls(e,t,t.pendingProps,n),t.child;case 8:return Ls(e,t,t.pendingProps.children,n),t.child;case 12:return Ls(e,t,t.pendingProps.children,n),t.child;case 10:a:{if(i=t.type._context,a=t.pendingProps,o=t.memoizedProps,s=a.value,Ui(za,i._currentValue),i._currentValue=s,o!==null){if(Er(o.value,s)){if(o.children===a.children&&!Ki.current){t=ic(e,t,n);break a}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var c=o.dependencies;if(c!==null){s=o.child;for(var l=c.firstContext;l!==null;){if(l.context===i){if(o.tag===1){l=to(-1,n&-n),l.tag=2;var u=o.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?l.next=l:(l.next=d.next,d.next=l),u.pending=l}}o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),Ga(o.return,n,t),c.lanes|=n;break}l=l.next}}else if(o.tag===10)s=o.type===t.type?null:o.child;else if(o.tag===18){if(s=o.return,s===null)throw Error(r(341));s.lanes|=n,c=s.alternate,c!==null&&(c.lanes|=n),Ga(s,n,t),s=o.sibling}else s=o.child;if(s!==null)s.return=o;else for(s=o;s!==null;){if(s===t){s=null;break}if(o=s.sibling,o!==null){o.return=s.return,s=o;break}s=s.return}o=s}}Ls(e,t,a.children,n),t=t.child}return t;case 9:return a=t.type,i=t.pendingProps.children,Ka(t,n),a=qa(a),i=i(a),t.flags|=1,Ls(e,t,i,n),t.child;case 14:return i=t.type,a=ys(i,t.pendingProps),a=ys(i.type,a),zs(e,t,i,a,n);case 15:return Bs(e,t,t.type,t.pendingProps,n);case 17:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:ys(i,a),rc(e,t),t.tag=1,Yi(i)?(e=!0,q(t)):e=!1,Ka(t,n),Cs(t,i,a),Ts(t,i,a,n),Gs(null,t,i,!0,e,n);case 19:return nc(e,t,n);case 22:return Vs(e,t,n)}throw Error(r(156,t.tag))};function Yl(e,t){return dt(e,t)}function Xl(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Zl(e,t,n,r){return new Xl(e,t,n,r)}function Ql(e){return e=e.prototype,!(!e||!e.isReactComponent)}function $l(e){if(typeof e==`function`)return+!!Ql(e);if(e!=null){if(e=e.$$typeof,e===ee)return 11;if(e===re)return 14}return 2}function eu(e,t){var n=e.alternate;return n===null?(n=Zl(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function tu(e,t,n,i,a,o){var s=2;if(i=e,typeof e==`function`)Ql(e)&&(s=1);else if(typeof e==`string`)s=5;else a:switch(e){case E:return nu(n.children,a,o,t);case D:s=8,a|=8;break;case O:return e=Zl(12,n,t,a|2),e.elementType=O,e.lanes=o,e;case te:return e=Zl(13,n,t,a),e.elementType=te,e.lanes=o,e;case ne:return e=Zl(19,n,t,a),e.elementType=ne,e.lanes=o,e;case ie:return ru(n,a,o,t);default:if(typeof e==`object`&&e)switch(e.$$typeof){case k:s=10;break a;case A:s=9;break a;case ee:s=11;break a;case re:s=14;break a;case j:s=16,i=null;break a}throw Error(r(130,e==null?e:typeof e,``))}return t=Zl(s,n,t,a),t.elementType=e,t.type=i,t.lanes=o,t}function nu(e,t,n,r){return e=Zl(7,e,r,t),e.lanes=n,e}function ru(e,t,n,r){return e=Zl(22,e,r,t),e.elementType=ie,e.lanes=n,e.stateNode={isHidden:!1},e}function iu(e,t,n){return e=Zl(6,e,null,t),e.lanes=n,e}function au(e,t,n){return t=Zl(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function ou(e,t,n,r,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=It(0),this.expirationTimes=It(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=It(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function su(e,t,n,r,i,a,o,s,c){return e=new ou(e,t,n,s,c),t===1?(t=1,!0===a&&(t|=8)):t=0,a=Zl(3,null,null,t),e.current=a,a.stateNode=e,a.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},$a(a),e}function cu(e,t,n){var r=3{function n(){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE==`function`)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=p()})),h=o((e=>{var t=m();e.createRoot=t.createRoot,e.hydrateRoot=t.hydrateRoot})),g=c(u(),1),_=h();function v(){return``}function y(){return/^G-[A-Z0-9]+$/.test(v())}function b(){let e=window.gtag;typeof e==`function`&&y()&&e(`config`,v(),{send_page_view:!1})}function x(){window.gtag?.(`event`,`page_view`,{page_path:window.location.pathname,page_location:window.location.href}),window.plausible?.(`pageview`)}function S(){window.gtag?.(`event`,`permalink_view`),window.plausible?.(`Permalink View`)}function C(){window.gtag?.(`event`,`changelog_open`),window.plausible?.(`Changelog Open`)}function w(e){window.gtag?.(`event`,`changelog_vote`,{...e}),window.plausible?.(`Changelog Vote`,{props:{...e}})}function T(e){return e.charAt(0).toUpperCase()+e.slice(1)}function E(e,t){window.gtag?.(`event`,e,{...t}),window.plausible?.(T(e),{props:{...t}})}function D(e){E(`input`,e)}function O(e){E(`conversion`,e)}function k(e){E(`export`,{via:e.via,format:e.format,...e.pane===void 0?{}:{pane:e.pane},...e.direction===void 0?{}:{direction:e.direction}})}function A(e){E(`feedback`,e)}function ee(e){return new TextEncoder().encode(e).length}function te(e){return e<10240?`<10KB`:e<102400?`10-100KB`:e<1048576?`100KB-1MB`:`>1MB`}function ne(e){let t=2166136261;for(let n=0;n>>0).toString(36)}function re(e={}){let t=e.settleMs??2e3,n=e.minWindowMs??2e3,r=e.now??(()=>Date.now()),i=e.isValid??(()=>!0),a=null,o,s=null,c=0,l=null,u=0;function d(e){if(e.text.trim()===``)return!1;let t=ee(e.text),a=te(t),o=i(e.direction,e.text),d=`${e.direction}:${e.input}:${t}:${ne(e.text)}`,f=r();return d!==s&&(c===0||f-c>=n)&&(s=d,c=f,D({direction:e.direction,input:e.input,size:a,valid:o})),!o||d===l||u!==0&&f-u{o=void 0,a&&d(a)},t)}return{edit(e,t){a={direction:e,input:`paste`,text:t},f()},discrete(e,t,n){a={direction:e,input:t,text:n},f(),d(a)},cancel(){a=null,s=null,l=null,o&&=(clearTimeout(o),void 0)}}}var j=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),ie=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),M=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),ae=e=>{let t=M(e);return t.charAt(0).toUpperCase()+t.slice(1)},N={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},oe=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},P=(0,g.createContext)({}),se=()=>(0,g.useContext)(P),ce=(0,g.forwardRef)(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>{let{size:l=24,strokeWidth:u=2,absoluteStrokeWidth:d=!1,color:f=`currentColor`,className:p=``}=se()??{},m=r??d?Number(n??u)*24/Number(t??l):n??u;return(0,g.createElement)(`svg`,{ref:c,...N,width:t??l??N.width,height:t??l??N.height,stroke:e??f,strokeWidth:m,className:j(`lucide`,p,i),...!a&&!oe(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,g.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),F=(e,t)=>{let n=(0,g.forwardRef)(({className:n,...r},i)=>(0,g.createElement)(ce,{ref:i,iconNode:t,className:j(`lucide-${ie(ae(e))}`,`lucide-${e}`,n),...r}));return n.displayName=ae(e),n},le=F(`arrow-left-right`,[[`path`,{d:`M8 3 4 7l4 4`,key:`9rb6wj`}],[`path`,{d:`M4 7h16`,key:`6tx8e3`}],[`path`,{d:`m16 21 4-4-4-4`,key:`siv7j2`}],[`path`,{d:`M20 17H4`,key:`h6l3hr`}]]),ue=F(`braces`,[[`path`,{d:`M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1`,key:`ezmyqa`}],[`path`,{d:`M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1`,key:`e1hn23`}]]),de=F(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),fe=F(`clipboard`,[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`,key:`116196`}]]),pe=F(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),me=F(`columns-3`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]),he=F(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),ge=F(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),I=F(`file-up`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M12 12v6`,key:`3ahymv`}],[`path`,{d:`m15 15-3-3-3 3`,key:`15xj92`}]]),L=F(`moon`,[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]),_e=F(`redo-2`,[[`path`,{d:`m15 14 5-5-5-5`,key:`12vg1m`}],[`path`,{d:`M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13`,key:`6uklza`}]]),R=F(`rotate-ccw-clock`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),ve=F(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),ye=F(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),be=F(`sparkles`,[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]]),xe=F(`sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),Se=F(`table`,[[`path`,{d:`M12 3v18`,key:`108xh3`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M3 9h18`,key:`1pudct`}],[`path`,{d:`M3 15h18`,key:`5xshup`}]]),z=F(`thumbs-down`,[[`path`,{d:`M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z`,key:`m61m77`}],[`path`,{d:`M17 14V2`,key:`8ymqnk`}]]),Ce=F(`thumbs-up`,[[`path`,{d:`M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z`,key:`emmmcr`}],[`path`,{d:`M7 10v12`,key:`1qc93n`}]]),we=F(`trash`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),B=F(`undo-2`,[[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}],[`path`,{d:`M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11`,key:`f3b9sd`}]]),Te=F(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);function Ee(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`){if(Array.isArray(e)){var i=e.length;for(t=0;t{let t=Ne(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{let n=e.split(Oe);return n[0]===``&&n.length!==1&&n.shift(),Ae(n,t)||Me(e)},getConflictingClassGroupIds:(e,t)=>{let i=n[e]||[];return t&&r[e]?[...i,...r[e]]:i}}},Ae=(e,t)=>{if(e.length===0)return t.classGroupId;let n=e[0],r=t.nextPart.get(n),i=r?Ae(e.slice(1),r):void 0;if(i)return i;if(t.validators.length===0)return;let a=e.join(Oe);return t.validators.find(({validator:e})=>e(a))?.classGroupId},je=/^\[(.+)\]$/,Me=e=>{if(je.test(e)){let t=je.exec(e)[1],n=t?.substring(0,t.indexOf(`:`));if(n)return`arbitrary..`+n}},Ne=e=>{let{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return Le(Object.entries(e.classGroups),n).forEach(([e,n])=>{Pe(n,r,e,t)}),r},Pe=(e,t,n,r)=>{e.forEach(e=>{if(typeof e==`string`){let r=e===``?t:Fe(t,e);r.classGroupId=n}else if(typeof e==`function`){if(Ie(e)){Pe(e(r),t,n,r);return}t.validators.push({validator:e,classGroupId:n})}else Object.entries(e).forEach(([e,i])=>{Pe(i,Fe(t,e),n,r)})})},Fe=(e,t)=>{let n=e;return t.split(Oe).forEach(e=>{n.nextPart.has(e)||n.nextPart.set(e,{nextPart:new Map,validators:[]}),n=n.nextPart.get(e)}),n},Ie=e=>e.isThemeGetter,Le=(e,t)=>t?e.map(([e,n])=>[e,n.map(e=>typeof e==`string`?t+e:typeof e==`object`?Object.fromEntries(Object.entries(e).map(([e,n])=>[t+e,n])):e)]):e,Re=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=new Map,r=new Map,i=(i,a)=>{n.set(i,a),t++,t>e&&(t=0,r=n,n=new Map)};return{get(e){let t=n.get(e);if(t!==void 0)return t;if((t=r.get(e))!==void 0)return i(e,t),t},set(e,t){n.has(e)?n.set(e,t):i(e,t)}}},ze=`!`,Be=e=>{let{separator:t,experimentalParseClassName:n}=e,r=t.length===1,i=t[0],a=t.length,o=e=>{let n=[],o=0,s=0,c;for(let l=0;ls?c-s:void 0}};return n?e=>n({className:e,parseClassName:o}):o},Ve=e=>{if(e.length<=1)return e;let t=[],n=[];return e.forEach(e=>{e[0]===`[`?(t.push(...n.sort(),e),n=[]):n.push(e)}),t.push(...n.sort()),t},He=e=>({cache:Re(e.cacheSize),parseClassName:Be(e),...ke(e)}),Ue=/\s+/,We=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i}=t,a=[],o=e.trim().split(Ue),s=``;for(let e=o.length-1;e>=0;--e){let t=o[e],{modifiers:c,hasImportantModifier:l,baseClassName:u,maybePostfixModifierPosition:d}=n(t),f=!!d,p=r(f?u.substring(0,d):u);if(!p){if(!f||(p=r(u),!p)){s=t+(s.length>0?` `+s:s);continue}f=!1}let m=Ve(c).join(`:`),h=l?m+ze:m,g=h+p;if(a.includes(g))continue;a.push(g);let _=i(p,f);for(let e=0;e<_.length;++e){let t=_[e];a.push(h+t)}s=t+(s.length>0?` `+s:s)}return s};function Ge(){let e=0,t,n,r=``;for(;e{if(typeof e==`string`)return e;let t,n=``;for(let r=0;rt(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)}function s(e){let t=r(e);if(t)return t;let a=We(e,n);return i(e,a),a}return function(){return a(Ge.apply(null,arguments))}}var Je=e=>{let t=t=>t[e]||[];return t.isThemeGetter=!0,t},Ye=/^\[(?:([a-z-]+):)?(.+)\]$/i,Xe=/^\d+\/\d+$/,Ze=new Set([`px`,`full`,`screen`]),Qe=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,$e=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,et=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,tt=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,nt=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,rt=e=>at(e)||Ze.has(e)||Xe.test(e),it=e=>vt(e,`length`,yt),at=e=>!!e&&!Number.isNaN(Number(e)),ot=e=>vt(e,`number`,at),st=e=>!!e&&Number.isInteger(Number(e)),ct=e=>e.endsWith(`%`)&&at(e.slice(0,-1)),lt=e=>Ye.test(e),ut=e=>Qe.test(e),dt=new Set([`length`,`size`,`percentage`]),ft=e=>vt(e,dt,bt),pt=e=>vt(e,`position`,bt),mt=new Set([`image`,`url`]),ht=e=>vt(e,mt,St),gt=e=>vt(e,``,xt),_t=()=>!0,vt=(e,t,n)=>{let r=Ye.exec(e);return r?r[1]?typeof t==`string`?r[1]===t:t.has(r[1]):n(r[2]):!1},yt=e=>$e.test(e)&&!et.test(e),bt=()=>!1,xt=e=>tt.test(e),St=e=>nt.test(e),Ct=qe(()=>{let e=Je(`colors`),t=Je(`spacing`),n=Je(`blur`),r=Je(`brightness`),i=Je(`borderColor`),a=Je(`borderRadius`),o=Je(`borderSpacing`),s=Je(`borderWidth`),c=Je(`contrast`),l=Je(`grayscale`),u=Je(`hueRotate`),d=Je(`invert`),f=Je(`gap`),p=Je(`gradientColorStops`),m=Je(`gradientColorStopPositions`),h=Je(`inset`),g=Je(`margin`),_=Je(`opacity`),v=Je(`padding`),y=Je(`saturate`),b=Je(`scale`),x=Je(`sepia`),S=Je(`skew`),C=Je(`space`),w=Je(`translate`),T=()=>[`auto`,`contain`,`none`],E=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],D=()=>[`auto`,lt,t],O=()=>[lt,t],k=()=>[``,rt,it],A=()=>[`auto`,at,lt],ee=()=>[`bottom`,`center`,`left`,`left-bottom`,`left-top`,`right`,`right-bottom`,`right-top`,`top`],te=()=>[`solid`,`dashed`,`dotted`,`double`,`none`],ne=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],re=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`],j=()=>[``,`0`,lt],ie=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],M=()=>[at,lt];return{cacheSize:500,separator:`:`,theme:{colors:[_t],spacing:[rt,it],blur:[`none`,``,ut,lt],brightness:M(),borderColor:[e],borderRadius:[`none`,``,`full`,ut,lt],borderSpacing:O(),borderWidth:k(),contrast:M(),grayscale:j(),hueRotate:M(),invert:j(),gap:O(),gradientColorStops:[e],gradientColorStopPositions:[ct,it],inset:D(),margin:D(),opacity:M(),padding:O(),saturate:M(),scale:M(),sepia:j(),skew:M(),space:O(),translate:O()},classGroups:{aspect:[{aspect:[`auto`,`square`,`video`,lt]}],container:[`container`],columns:[{columns:[ut]}],"break-after":[{"break-after":ie()}],"break-before":[{"break-before":ie()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:[...ee(),lt]}],overflow:[{overflow:E()}],"overflow-x":[{"overflow-x":E()}],"overflow-y":[{"overflow-y":E()}],overscroll:[{overscroll:T()}],"overscroll-x":[{"overscroll-x":T()}],"overscroll-y":[{"overscroll-y":T()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:[h]}],"inset-x":[{"inset-x":[h]}],"inset-y":[{"inset-y":[h]}],start:[{start:[h]}],end:[{end:[h]}],top:[{top:[h]}],right:[{right:[h]}],bottom:[{bottom:[h]}],left:[{left:[h]}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[`auto`,st,lt]}],basis:[{basis:D()}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`wrap`,`wrap-reverse`,`nowrap`]}],flex:[{flex:[`1`,`auto`,`initial`,`none`,lt]}],grow:[{grow:j()}],shrink:[{shrink:j()}],order:[{order:[`first`,`last`,`none`,st,lt]}],"grid-cols":[{"grid-cols":[_t]}],"col-start-end":[{col:[`auto`,{span:[`full`,st,lt]},lt]}],"col-start":[{"col-start":A()}],"col-end":[{"col-end":A()}],"grid-rows":[{"grid-rows":[_t]}],"row-start-end":[{row:[`auto`,{span:[st,lt]},lt]}],"row-start":[{"row-start":A()}],"row-end":[{"row-end":A()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":[`auto`,`min`,`max`,`fr`,lt]}],"auto-rows":[{"auto-rows":[`auto`,`min`,`max`,`fr`,lt]}],gap:[{gap:[f]}],"gap-x":[{"gap-x":[f]}],"gap-y":[{"gap-y":[f]}],"justify-content":[{justify:[`normal`,...re()]}],"justify-items":[{"justify-items":[`start`,`end`,`center`,`stretch`]}],"justify-self":[{"justify-self":[`auto`,`start`,`end`,`center`,`stretch`]}],"align-content":[{content:[`normal`,...re(),`baseline`]}],"align-items":[{items:[`start`,`end`,`center`,`baseline`,`stretch`]}],"align-self":[{self:[`auto`,`start`,`end`,`center`,`stretch`,`baseline`]}],"place-content":[{"place-content":[...re(),`baseline`]}],"place-items":[{"place-items":[`start`,`end`,`center`,`baseline`,`stretch`]}],"place-self":[{"place-self":[`auto`,`start`,`end`,`center`,`stretch`]}],p:[{p:[v]}],px:[{px:[v]}],py:[{py:[v]}],ps:[{ps:[v]}],pe:[{pe:[v]}],pt:[{pt:[v]}],pr:[{pr:[v]}],pb:[{pb:[v]}],pl:[{pl:[v]}],m:[{m:[g]}],mx:[{mx:[g]}],my:[{my:[g]}],ms:[{ms:[g]}],me:[{me:[g]}],mt:[{mt:[g]}],mr:[{mr:[g]}],mb:[{mb:[g]}],ml:[{ml:[g]}],"space-x":[{"space-x":[C]}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":[C]}],"space-y-reverse":[`space-y-reverse`],w:[{w:[`auto`,`min`,`max`,`fit`,`svw`,`lvw`,`dvw`,lt,t]}],"min-w":[{"min-w":[lt,t,`min`,`max`,`fit`]}],"max-w":[{"max-w":[lt,t,`none`,`full`,`min`,`max`,`fit`,`prose`,{screen:[ut]},ut]}],h:[{h:[lt,t,`auto`,`min`,`max`,`fit`,`svh`,`lvh`,`dvh`]}],"min-h":[{"min-h":[lt,t,`min`,`max`,`fit`,`svh`,`lvh`,`dvh`]}],"max-h":[{"max-h":[lt,t,`min`,`max`,`fit`,`svh`,`lvh`,`dvh`]}],size:[{size:[lt,t,`auto`,`min`,`max`,`fit`]}],"font-size":[{text:[`base`,ut,it]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`,ot]}],"font-family":[{font:[_t]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`,lt]}],"line-clamp":[{"line-clamp":[`none`,at,ot]}],leading:[{leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`,rt,lt]}],"list-image":[{"list-image":[`none`,lt]}],"list-style-type":[{list:[`none`,`disc`,`decimal`,lt]}],"list-style-position":[{list:[`inside`,`outside`]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[_]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[_]}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...te(),`wavy`]}],"text-decoration-thickness":[{decoration:[`auto`,`from-font`,rt,it]}],"underline-offset":[{"underline-offset":[`auto`,rt,lt]}],"text-decoration-color":[{decoration:[e]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:O()}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,lt]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,lt]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-opacity":[{"bg-opacity":[_]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:[...ee(),pt]}],"bg-repeat":[{bg:[`no-repeat`,{repeat:[``,`x`,`y`,`round`,`space`]}]}],"bg-size":[{bg:[`auto`,`cover`,`contain`,ft]}],"bg-image":[{bg:[`none`,{"gradient-to":[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},ht]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[m]}],"gradient-via-pos":[{via:[m]}],"gradient-to-pos":[{to:[m]}],"gradient-from":[{from:[p]}],"gradient-via":[{via:[p]}],"gradient-to":[{to:[p]}],rounded:[{rounded:[a]}],"rounded-s":[{"rounded-s":[a]}],"rounded-e":[{"rounded-e":[a]}],"rounded-t":[{"rounded-t":[a]}],"rounded-r":[{"rounded-r":[a]}],"rounded-b":[{"rounded-b":[a]}],"rounded-l":[{"rounded-l":[a]}],"rounded-ss":[{"rounded-ss":[a]}],"rounded-se":[{"rounded-se":[a]}],"rounded-ee":[{"rounded-ee":[a]}],"rounded-es":[{"rounded-es":[a]}],"rounded-tl":[{"rounded-tl":[a]}],"rounded-tr":[{"rounded-tr":[a]}],"rounded-br":[{"rounded-br":[a]}],"rounded-bl":[{"rounded-bl":[a]}],"border-w":[{border:[s]}],"border-w-x":[{"border-x":[s]}],"border-w-y":[{"border-y":[s]}],"border-w-s":[{"border-s":[s]}],"border-w-e":[{"border-e":[s]}],"border-w-t":[{"border-t":[s]}],"border-w-r":[{"border-r":[s]}],"border-w-b":[{"border-b":[s]}],"border-w-l":[{"border-l":[s]}],"border-opacity":[{"border-opacity":[_]}],"border-style":[{border:[...te(),`hidden`]}],"divide-x":[{"divide-x":[s]}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":[s]}],"divide-y-reverse":[`divide-y-reverse`],"divide-opacity":[{"divide-opacity":[_]}],"divide-style":[{divide:te()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:[``,...te()]}],"outline-offset":[{"outline-offset":[rt,lt]}],"outline-w":[{outline:[rt,it]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:k()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[_]}],"ring-offset-w":[{"ring-offset":[rt,it]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:[``,`inner`,`none`,ut,gt]}],"shadow-color":[{shadow:[_t]}],opacity:[{opacity:[_]}],"mix-blend":[{"mix-blend":[...ne(),`plus-lighter`,`plus-darker`]}],"bg-blend":[{"bg-blend":ne()}],filter:[{filter:[``,`none`]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":[``,`none`,ut,lt]}],grayscale:[{grayscale:[l]}],"hue-rotate":[{"hue-rotate":[u]}],invert:[{invert:[d]}],saturate:[{saturate:[y]}],sepia:[{sepia:[x]}],"backdrop-filter":[{"backdrop-filter":[``,`none`]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[c]}],"backdrop-grayscale":[{"backdrop-grayscale":[l]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[u]}],"backdrop-invert":[{"backdrop-invert":[d]}],"backdrop-opacity":[{"backdrop-opacity":[_]}],"backdrop-saturate":[{"backdrop-saturate":[y]}],"backdrop-sepia":[{"backdrop-sepia":[x]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[`none`,`all`,``,`colors`,`opacity`,`shadow`,`transform`,lt]}],duration:[{duration:M()}],ease:[{ease:[`linear`,`in`,`out`,`in-out`,lt]}],delay:[{delay:M()}],animate:[{animate:[`none`,`spin`,`ping`,`pulse`,`bounce`,lt]}],transform:[{transform:[``,`gpu`,`none`]}],scale:[{scale:[b]}],"scale-x":[{"scale-x":[b]}],"scale-y":[{"scale-y":[b]}],rotate:[{rotate:[st,lt]}],"translate-x":[{"translate-x":[w]}],"translate-y":[{"translate-y":[w]}],"skew-x":[{"skew-x":[S]}],"skew-y":[{"skew-y":[S]}],"transform-origin":[{origin:[`center`,`top`,`top-right`,`right`,`bottom-right`,`bottom`,`bottom-left`,`left`,`top-left`,lt]}],accent:[{accent:[`auto`,e]}],appearance:[{appearance:[`none`,`auto`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,lt]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":[`none`,`auto`]}],resize:[{resize:[`none`,`y`,`x`,``]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scroll-m":[{"scroll-m":O()}],"scroll-mx":[{"scroll-mx":O()}],"scroll-my":[{"scroll-my":O()}],"scroll-ms":[{"scroll-ms":O()}],"scroll-me":[{"scroll-me":O()}],"scroll-mt":[{"scroll-mt":O()}],"scroll-mr":[{"scroll-mr":O()}],"scroll-mb":[{"scroll-mb":O()}],"scroll-ml":[{"scroll-ml":O()}],"scroll-p":[{"scroll-p":O()}],"scroll-px":[{"scroll-px":O()}],"scroll-py":[{"scroll-py":O()}],"scroll-ps":[{"scroll-ps":O()}],"scroll-pe":[{"scroll-pe":O()}],"scroll-pt":[{"scroll-pt":O()}],"scroll-pr":[{"scroll-pr":O()}],"scroll-pb":[{"scroll-pb":O()}],"scroll-pl":[{"scroll-pl":O()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,lt]}],fill:[{fill:[e,`none`]}],"stroke-w":[{stroke:[rt,it,ot]}],stroke:[{stroke:[e,`none`]}],sr:[`sr-only`,`not-sr-only`],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`right`,`left`],"inset-y":[`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mt`,`mr`,`mb`,`ml`],mx:[`mr`,`ml`],my:[`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-s`,`border-w-e`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-r`,`border-w-l`],"border-w-y":[`border-w-t`,`border-w-b`],"border-color":[`border-color-s`,`border-color-e`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-r`,`border-color-l`],"border-color-y":[`border-color-t`,`border-color-b`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]}}});function wt(...e){return Ct(De(e))}var Tt=o((e=>{var t=u(),n=Symbol.for(`react.element`),r=Symbol.for(`react.fragment`),i=Object.prototype.hasOwnProperty,a=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function s(e,t,r){var s,c={},l=null,u=null;for(s in r!==void 0&&(l=``+r),t.key!==void 0&&(l=``+t.key),t.ref!==void 0&&(u=t.ref),t)i.call(t,s)&&!o.hasOwnProperty(s)&&(c[s]=t[s]);if(e&&e.defaultProps)for(s in t=e.defaultProps,t)c[s]===void 0&&(c[s]=t[s]);return{$$typeof:n,type:e,key:l,ref:u,props:c,_owner:a.current}}e.Fragment=r,e.jsx=s,e.jsxs=s})),V=o(((e,t)=>{t.exports=Tt()}))();function Et(e){return e===`csv2json`?`CSV → JSON`:`JSON → CSV`}function Dt({flipped:e}){return(0,V.jsx)(le,{size:18,strokeWidth:2,"aria-hidden":`true`,className:wt(`transition-transform duration-300`,e&&`rotate-180`)})}function Ot({direction:e,onFlip:t}){return(0,V.jsxs)(`button`,{type:`button`,"data-testid":`divider-switch`,onClick:t,onMouseDown:e=>e.stopPropagation(),onDoubleClick:e=>e.stopPropagation(),title:`Switch direction (currently ${Et(e)})`,"aria-label":`Switch conversion direction (currently ${Et(e)})`,className:`flex h-9 cursor-pointer items-center gap-1.5 whitespace-nowrap rounded-full border border-border bg-background px-3 text-xs font-medium text-muted-foreground shadow-sm transition-colors hover:border-muted-foreground/50 hover:text-foreground md:h-8 md:gap-1 md:px-2.5 md:text-[11px]`,children:[(0,V.jsx)(Dt,{flipped:e===`json2csv`}),(0,V.jsx)(`span`,{"data-testid":`divider-switch-label`,children:Et(e)})]})}var kt=[{question:`How does it work?`,answer:`Paste CSV or JSON into the left pane and the conversion runs as you type — no upload, no submit button. Flip the direction with the switch between the panes to convert JSON back to CSV, then copy the result or download it as a file. The converter understands quoted fields, embedded separators, and Unicode.`},{question:`What do the options do?`,answer:`Separator picks the delimiter — auto-detect covers comma, semicolon, and tab. Parse numbers is on by default with smart semantics — plain numbers like 5 or 19.99 become real JSON numbers, while leading-zero values like 00721 and very long IDs stay strings; uncheck it to keep numeric cells as strings — booleans, null, and containers still convert while Parse JSON is on. Parse JSON converts null, true, false, [] and {} cells into real JSON values instead of strings. Transpose flips rows and columns; Hash output makes the first column the object key; Minify removes indentation from JSON output. On the JSON to CSV side, Flatten explodes nested arrays into extra rows with dotted keys.`},{question:`TSV vs CSV — what changes?`,answer:`Only the delimiter: TSV separates cells with tabs, CSV with commas. Anything you can paste from Excel or Google Sheets is tab-separated, and auto-detect picks that up — or choose Tab in the separator menu. Quoting rules only apply to comma and semicolon output; TSV rarely needs them.`},{question:`Does my data ever leave the browser?`,answer:`No. The conversion runs entirely in your browser — nothing is uploaded, nothing is stored, nothing is logged. Files you open are read locally in the page, there is no account and no server processing. The site's analytics never see your data: Plausible counts visits cookieless, and the Google tag is a standard conversion-measurement tag that uses the page URL, referrer, and a first-party conversion cookie to measure ad performance. Your files and converted output never leave the browser. When you send feedback, we store your vote and anything you choose to write — nothing else.`}],At={"@context":`https://schema.org`,"@type":`FAQPage`,mainEntity:kt.map(e=>({"@type":`Question`,name:e.question,acceptedAnswer:{"@type":`Answer`,text:e.answer}}))};function jt(){let[e,t]=(0,g.useState)(!1),n=(0,g.useId)();return(0,V.jsxs)(`section`,{"data-testid":`faq`,"aria-label":`How it works and frequently asked questions`,className:`flex-shrink-0 border-t border-border bg-panel px-4`,children:[(0,V.jsxs)(`button`,{type:`button`,"data-testid":`faq-toggle`,"aria-expanded":e,"aria-controls":n,onClick:()=>t(e=>!e),className:`flex w-full cursor-pointer items-center gap-1.5 py-2 text-[12.5px] text-muted-foreground hover:text-foreground`,children:[(0,V.jsx)(`span`,{"aria-hidden":`true`,className:`w-3 text-center`,children:e?`▾`:`▸`}),`How it works & FAQ`]}),(0,V.jsx)(`div`,{id:n,"data-testid":`faq-content`,hidden:!e,className:`max-w-3xl pb-4 text-[13px] leading-relaxed text-muted-foreground`,children:kt.map(e=>(0,V.jsxs)(`div`,{className:`mb-3 last:mb-0`,children:[(0,V.jsx)(`h2`,{className:`mb-0.5 text-[11px] font-semibold uppercase tracking-[0.1em] text-foreground`,children:e.question}),(0,V.jsx)(`p`,{children:e.answer})]},e.question))}),(0,V.jsx)(`script`,{type:`application/ld+json`,dangerouslySetInnerHTML:{__html:JSON.stringify(At)}})]})}var Mt=`https://github.com/FlatFilers/csvjson-app/discussions/163`;function Nt(){return(0,V.jsx)(`div`,{"data-testid":`feedback-banner`,className:`flex flex-shrink-0 items-center justify-center border-b border-border bg-muted px-3 py-1.5 text-xs text-muted-foreground sm:px-4 sm:text-sm`,children:(0,V.jsxs)(`p`,{className:`text-center`,children:[`Enjoy a cleaner, simpler CSVJSON.`,` `,(0,V.jsx)(`a`,{"data-testid":`feedback-link`,href:Mt,target:`_blank`,rel:`noopener noreferrer`,className:`rounded-sm font-medium text-foreground underline decoration-border underline-offset-2 transition-colors hover:decoration-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,children:`Leave feedback or ask for features here`}),`.`]})})}var Pt=`csvjson:feedback.v1`,Ft=[{value:`wrong_output`,label:`The conversion is wrong`},{value:`hard_to_use`,label:`Hard to use`},{value:`missing_feature`,label:`Missing a feature`},{value:`slower`,label:`Slower than the old site`},{value:`looks_worse`,label:`Looks worse`},{value:`other`,label:`Other`}];function It(e){if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.clientId==`string`&&t.clientId.length<=64&&(t.vote===1||t.vote===-1)&&(typeof t.reasonCode==`string`||t.reasonCode===null)&&(typeof t.reasonText==`string`||t.reasonText===null)&&typeof t.pending==`boolean`}function Lt(){try{let e=window.localStorage.getItem(Pt);if(e===null)return null;let t=JSON.parse(e);return It(t)?t:null}catch{return null}}function Rt(e){try{window.localStorage.setItem(Pt,JSON.stringify(e))}catch{}}function zt(){if(typeof globalThis.crypto?.randomUUID==`function`)return globalThis.crypto.randomUUID();let e=globalThis.crypto?.getRandomValues?.(new Uint8Array(16));if(e===void 0)throw Error(`no secure randomness available`);e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t=Array.from(e,e=>e.toString(16).padStart(2,`0`)).join(``);return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}function Bt(e){let t=window.location.pathname;return e.vote===1?{clientId:e.clientId,vote:1,path:t}:{clientId:e.clientId,vote:-1,reasonCode:e.reasonCode,reasonText:e.reasonText,path:t}}async function Vt(e){try{return(await fetch(`/api/feedback`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(Bt(e))})).ok?`ok`:`failed`}catch{return`failed`}}function H(e){return[`flex h-7 w-7 cursor-pointer items-center justify-center rounded-md transition-colors`,e?`bg-muted text-foreground`:`text-muted-foreground hover:bg-muted hover:text-foreground`].join(` `)}function Ht(){let[e,t]=(0,g.useState)(Lt),[n,r]=(0,g.useState)(!1),[i,a]=(0,g.useState)(null),[o,s]=(0,g.useState)(``),[c,l]=(0,g.useState)(!1),[u,d]=(0,g.useState)(!1),f=(0,g.useRef)(null),p=(0,g.useRef)(0),m=(0,g.useCallback)((e,n)=>{let r={...e,pending:n===`failed`};Rt(r),t(r),n===`ok`?A({vote:e.vote,with_reason:e.reasonCode!==null}):l(!1)},[]),h=(0,g.useCallback)((e,t)=>{let n=++p.current;t&&d(!0),Vt(e).then(t=>{p.current===n&&(m(e,t),t===`ok`&&l(!0))}).finally(()=>{t&&p.current===n&&d(!1)})},[m]),_=e=>{let n={...e,pending:!0};Rt(n),t(n),h(n,!0)},v=(0,g.useRef)(!1);return(0,g.useEffect)(()=>{if(v.current)return;v.current=!0;let e=Lt();e?.pending&&h(e,!1)},[h]),(0,g.useEffect)(()=>{if(!c)return;let e=setTimeout(()=>l(!1),3e3);return()=>clearTimeout(e)},[c]),(0,g.useEffect)(()=>{if(!n)return;let e=e=>{e.key===`Escape`&&r(!1)},t=e=>{let t=f.current;t!==null&&e.target instanceof Node&&(t.contains(e.target)||r(!1))};return document.addEventListener(`keydown`,e),document.addEventListener(`mousedown`,t),()=>{document.removeEventListener(`keydown`,e),document.removeEventListener(`mousedown`,t)}},[n]),(0,V.jsxs)(`div`,{"data-testid":`feedback-vote`,ref:f,className:`relative flex items-center gap-1 max-sm:static`,children:[(0,V.jsx)(`button`,{type:`button`,"data-testid":`feedback-up`,onClick:()=>{e?.vote===1&&!e.pending?l(!0):_({clientId:e?.clientId??zt(),vote:1,reasonCode:null,reasonText:null})},"aria-pressed":e?.vote===1,"aria-label":`Helpful — send an upvote`,title:`Helpful`,className:H(e?.vote===1),children:(0,V.jsxs)(`svg`,{width:`15`,height:`15`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,V.jsx)(`path`,{d:`M7 10v12`}),(0,V.jsx)(`path`,{d:`M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z`})]})}),(0,V.jsx)(`button`,{type:`button`,"data-testid":`feedback-down`,onClick:()=>{n?r(!1):(a(null),s(``),r(!0))},"aria-pressed":e?.vote===-1,"aria-haspopup":`dialog`,"aria-expanded":n,"aria-label":`Not helpful — send a downvote`,title:`Not helpful`,className:H(e?.vote===-1),children:(0,V.jsxs)(`svg`,{width:`15`,height:`15`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,V.jsx)(`path`,{d:`M17 14V2`}),(0,V.jsx)(`path`,{d:`M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z`})]})}),c&&(0,V.jsx)(`span`,{"data-testid":`feedback-thanks`,className:`text-xs text-muted-foreground`,children:`Thanks for the feedback!`}),e?.pending&&!u&&(0,V.jsx)(`span`,{"data-testid":`feedback-pending`,role:`status`,className:`max-w-44 text-right text-xs text-muted-foreground sm:max-w-none`,children:`Feedback couldn't send — your vote is kept on this device and will send automatically once the service is back.`}),n&&(0,V.jsxs)(`div`,{"data-testid":`feedback-popover`,role:`dialog`,"aria-label":`What went wrong?`,className:`absolute right-0 top-9 z-50 w-72 rounded-md border border-border bg-panel p-3 shadow-md max-sm:inset-x-2 max-sm:top-14 max-sm:w-auto`,children:[(0,V.jsx)(`p`,{className:`mb-2 text-xs font-medium text-foreground`,children:`What went wrong?`}),(0,V.jsx)(`div`,{className:`mb-2 flex flex-wrap gap-1.5`,children:Ft.map(e=>(0,V.jsx)(`button`,{type:`button`,"data-testid":`feedback-reason-${e.value}`,"aria-pressed":i===e.value,onClick:()=>a(e.value),className:[`cursor-pointer rounded-sm border px-2 py-0.5 text-xs transition-colors`,i===e.value?`border-foreground bg-foreground text-panel`:`border-border text-muted-foreground hover:border-foreground hover:text-foreground`].join(` `),children:e.label},e.value))}),(0,V.jsx)(`textarea`,{"data-testid":`feedback-text`,value:o,maxLength:500,rows:2,onChange:e=>s(e.target.value),placeholder:`Anything more? (optional)`,className:`mb-2 w-full resize-none rounded-sm border border-border bg-panel px-2 py-1 text-xs text-foreground placeholder:text-muted-foreground/60 focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-ring`}),(0,V.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,V.jsxs)(`span`,{className:`text-[10px] text-muted-foreground/70`,children:[o.length,`/500`]}),(0,V.jsx)(`button`,{type:`button`,"data-testid":`feedback-submit`,onClick:()=>{if(i===null)return;let t=o.trim();_({clientId:e?.clientId??zt(),vote:-1,reasonCode:i,reasonText:t===``?null:t}),r(!1)},disabled:i===null,className:`cursor-pointer rounded-sm border border-border px-2.5 py-1 text-xs font-medium text-foreground transition-colors hover:bg-muted disabled:cursor-not-allowed disabled:opacity-50`,children:`Send`})]})]})]})}function Ut(e=`This should not happen`){throw Error(e)}function Wt(e,t=`Assertion failed`){if(!e)return Ut(t)}function Gt(e,t){return Ut(t??`Hell froze over`)}function Kt(e,t){try{return e()}catch{return t}}var qt=Object.prototype.hasOwnProperty;function Jt(e,t){let n,r;if(e===t)return!0;if(e&&t&&(n=e.constructor)===t.constructor){if(n===Date)return e.getTime()===t.getTime();if(n===RegExp)return e.toString()===t.toString();if(n===Array){if((r=e.length)===t.length)for(;r--&&Jt(e[r],t[r]););return r===-1}if(!n||typeof e==`object`){for(n in r=0,e)if(qt.call(e,n)&&++r&&!qt.call(t,n)||!(n in t)||!Jt(e[n],t[n]))return!1;return Object.keys(t).length===r}}return e!==e&&t!==t}var Yt=o(((e,t)=>{var n=Object.prototype.hasOwnProperty;function r(e,t){return e!=null&&n.call(e,t)}t.exports=r})),Xt=o(((e,t)=>{t.exports=Array.isArray})),U=o(((e,t)=>{t.exports=typeof global==`object`&&global&&global.Object===Object&&global})),Zt=o(((e,t)=>{var n=U(),r=typeof self==`object`&&self&&self.Object===Object&&self;t.exports=n||r||Function(`return this`)()})),Qt=o(((e,t)=>{t.exports=Zt().Symbol})),$t=o(((e,t)=>{var n=Qt(),r=Object.prototype,i=r.hasOwnProperty,a=r.toString,o=n?n.toStringTag:void 0;function s(e){var t=i.call(e,o),n=e[o];try{e[o]=void 0;var r=!0}catch{}var s=a.call(e);return r&&(t?e[o]=n:delete e[o]),s}t.exports=s})),en=o(((e,t)=>{var n=Object.prototype.toString;function r(e){return n.call(e)}t.exports=r})),tn=o(((e,t)=>{var n=Qt(),r=$t(),i=en(),a=`[object Null]`,o=`[object Undefined]`,s=n?n.toStringTag:void 0;function c(e){return e==null?e===void 0?o:a:s&&s in Object(e)?r(e):i(e)}t.exports=c})),nn=o(((e,t)=>{function n(e){return typeof e==`object`&&!!e}t.exports=n})),rn=o(((e,t)=>{var n=tn(),r=nn(),i=`[object Symbol]`;function a(e){return typeof e==`symbol`||r(e)&&n(e)==i}t.exports=a})),an=o(((e,t)=>{var n=Xt(),r=rn(),i=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,a=/^\w*$/;function o(e,t){if(n(e))return!1;var o=typeof e;return o==`number`||o==`symbol`||o==`boolean`||e==null||r(e)?!0:a.test(e)||!i.test(e)||t!=null&&e in Object(t)}t.exports=o})),on=o(((e,t)=>{function n(e){var t=typeof e;return e!=null&&(t==`object`||t==`function`)}t.exports=n})),sn=o(((e,t)=>{var n=tn(),r=on(),i=`[object AsyncFunction]`,a=`[object Function]`,o=`[object GeneratorFunction]`,s=`[object Proxy]`;function c(e){if(!r(e))return!1;var t=n(e);return t==a||t==o||t==i||t==s}t.exports=c})),cn=o(((e,t)=>{t.exports=Zt()[`__core-js_shared__`]})),ln=o(((e,t)=>{var n=cn(),r=function(){var e=/[^.]+$/.exec(n&&n.keys&&n.keys.IE_PROTO||``);return e?`Symbol(src)_1.`+e:``}();function i(e){return!!r&&r in e}t.exports=i})),un=o(((e,t)=>{var n=Function.prototype.toString;function r(e){if(e!=null){try{return n.call(e)}catch{}try{return e+``}catch{}}return``}t.exports=r})),dn=o(((e,t)=>{var n=sn(),r=ln(),i=on(),a=un(),o=/[\\^$.*+?()[\]{}|]/g,s=/^\[object .+?Constructor\]$/,c=Function.prototype,l=Object.prototype,u=c.toString,d=l.hasOwnProperty,f=RegExp(`^`+u.call(d).replace(o,`\\$&`).replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,`$1.*?`)+`$`);function p(e){return!i(e)||r(e)?!1:(n(e)?f:s).test(a(e))}t.exports=p})),fn=o(((e,t)=>{function n(e,t){return e?.[t]}t.exports=n})),pn=o(((e,t)=>{var n=dn(),r=fn();function i(e,t){var i=r(e,t);return n(i)?i:void 0}t.exports=i})),mn=o(((e,t)=>{t.exports=pn()(Object,`create`)})),hn=o(((e,t)=>{var n=mn();function r(){this.__data__=n?n(null):{},this.size=0}t.exports=r})),gn=o(((e,t)=>{function n(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=+!!t,t}t.exports=n})),_n=o(((e,t)=>{var n=mn(),r=`__lodash_hash_undefined__`,i=Object.prototype.hasOwnProperty;function a(e){var t=this.__data__;if(n){var a=t[e];return a===r?void 0:a}return i.call(t,e)?t[e]:void 0}t.exports=a})),vn=o(((e,t)=>{var n=mn(),r=Object.prototype.hasOwnProperty;function i(e){var t=this.__data__;return n?t[e]!==void 0:r.call(t,e)}t.exports=i})),yn=o(((e,t)=>{var n=mn(),r=`__lodash_hash_undefined__`;function i(e,t){var i=this.__data__;return this.size+=+!this.has(e),i[e]=n&&t===void 0?r:t,this}t.exports=i})),bn=o(((e,t)=>{var n=hn(),r=gn(),i=_n(),a=vn(),o=yn();function s(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t{function n(){this.__data__=[],this.size=0}t.exports=n})),Sn=o(((e,t)=>{function n(e,t){return e===t||e!==e&&t!==t}t.exports=n})),Cn=o(((e,t)=>{var n=Sn();function r(e,t){for(var r=e.length;r--;)if(n(e[r][0],t))return r;return-1}t.exports=r})),wn=o(((e,t)=>{var n=Cn(),r=Array.prototype.splice;function i(e){var t=this.__data__,i=n(t,e);return i<0?!1:(i==t.length-1?t.pop():r.call(t,i,1),--this.size,!0)}t.exports=i})),Tn=o(((e,t)=>{var n=Cn();function r(e){var t=this.__data__,r=n(t,e);return r<0?void 0:t[r][1]}t.exports=r})),En=o(((e,t)=>{var n=Cn();function r(e){return n(this.__data__,e)>-1}t.exports=r})),Dn=o(((e,t)=>{var n=Cn();function r(e,t){var r=this.__data__,i=n(r,e);return i<0?(++this.size,r.push([e,t])):r[i][1]=t,this}t.exports=r})),On=o(((e,t)=>{var n=xn(),r=wn(),i=Tn(),a=En(),o=Dn();function s(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t{t.exports=pn()(Zt(),`Map`)})),An=o(((e,t)=>{var n=bn(),r=On(),i=kn();function a(){this.size=0,this.__data__={hash:new n,map:new(i||r),string:new n}}t.exports=a})),jn=o(((e,t)=>{function n(e){var t=typeof e;return t==`string`||t==`number`||t==`symbol`||t==`boolean`?e!==`__proto__`:e===null}t.exports=n})),Mn=o(((e,t)=>{var n=jn();function r(e,t){var r=e.__data__;return n(t)?r[typeof t==`string`?`string`:`hash`]:r.map}t.exports=r})),Nn=o(((e,t)=>{var n=Mn();function r(e){var t=n(this,e).delete(e);return this.size-=+!!t,t}t.exports=r})),Pn=o(((e,t)=>{var n=Mn();function r(e){return n(this,e).get(e)}t.exports=r})),Fn=o(((e,t)=>{var n=Mn();function r(e){return n(this,e).has(e)}t.exports=r})),In=o(((e,t)=>{var n=Mn();function r(e,t){var r=n(this,e),i=r.size;return r.set(e,t),this.size+=r.size==i?0:1,this}t.exports=r})),Ln=o(((e,t)=>{var n=An(),r=Nn(),i=Pn(),a=Fn(),o=In();function s(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t{var n=Ln(),r=`Expected a function`;function i(e,t){if(typeof e!=`function`||t!=null&&typeof t!=`function`)throw TypeError(r);var a=function(){var n=arguments,r=t?t.apply(this,n):n[0],i=a.cache;if(i.has(r))return i.get(r);var o=e.apply(this,n);return a.cache=i.set(r,o)||i,o};return a.cache=new(i.Cache||n),a}i.Cache=n,t.exports=i})),zn=o(((e,t)=>{var n=Rn(),r=500;function i(e){var t=n(e,function(e){return i.size===r&&i.clear(),e}),i=t.cache;return t}t.exports=i})),Bn=o(((e,t)=>{var n=zn(),r=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,i=/\\(\\)?/g;t.exports=n(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(``),e.replace(r,function(e,n,r,a){t.push(r?a.replace(i,`$1`):n||e)}),t})})),Vn=o(((e,t)=>{function n(e,t){for(var n=-1,r=e==null?0:e.length,i=Array(r);++n{var n=Qt(),r=Vn(),i=Xt(),a=rn(),o=1/0,s=n?n.prototype:void 0,c=s?s.toString:void 0;function l(e){if(typeof e==`string`)return e;if(i(e))return r(e,l)+``;if(a(e))return c?c.call(e):``;var t=e+``;return t==`0`&&1/e==-o?`-0`:t}t.exports=l})),Un=o(((e,t)=>{var n=Hn();function r(e){return e==null?``:n(e)}t.exports=r})),Wn=o(((e,t)=>{var n=Xt(),r=an(),i=Bn(),a=Un();function o(e,t){return n(e)?e:r(e,t)?[e]:i(a(e))}t.exports=o})),Gn=o(((e,t)=>{var n=tn(),r=nn(),i=`[object Arguments]`;function a(e){return r(e)&&n(e)==i}t.exports=a})),Kn=o(((e,t)=>{var n=Gn(),r=nn(),i=Object.prototype,a=i.hasOwnProperty,o=i.propertyIsEnumerable;t.exports=n(function(){return arguments}())?n:function(e){return r(e)&&a.call(e,`callee`)&&!o.call(e,`callee`)}})),qn=o(((e,t)=>{var n=/^(?:0|[1-9]\d*)$/;function r(e,t){var r=typeof e;return t??=9007199254740991,!!t&&(r==`number`||r!=`symbol`&&n.test(e))&&e>-1&&e%1==0&&e{function n(e){return typeof e==`number`&&e>-1&&e%1==0&&e<=9007199254740991}t.exports=n})),Yn=o(((e,t)=>{var n=rn(),r=1/0;function i(e){if(typeof e==`string`||n(e))return e;var t=e+``;return t==`0`&&1/e==-r?`-0`:t}t.exports=i})),Xn=o(((e,t)=>{var n=Wn(),r=Kn(),i=Xt(),a=qn(),o=Jn(),s=Yn();function c(e,t,c){t=n(t,e);for(var l=-1,u=t.length,d=!1;++l{var n=Yt(),r=Xn();function i(e,t){return e!=null&&r(e,t,n)}t.exports=i}))(),1),W;(function(e){e.Uri=`uri`,e.Text=`text`,e.Image=`image`,e.RowID=`row-id`,e.Number=`number`,e.Bubble=`bubble`,e.Boolean=`boolean`,e.Loading=`loading`,e.Markdown=`markdown`,e.Drilldown=`drilldown`,e.Protected=`protected`,e.Custom=`custom`})(W||={});var Qn;(function(e){e.HeaderRowID=`headerRowID`,e.HeaderCode=`headerCode`,e.HeaderNumber=`headerNumber`,e.HeaderString=`headerString`,e.HeaderBoolean=`headerBoolean`,e.HeaderAudioUri=`headerAudioUri`,e.HeaderVideoUri=`headerVideoUri`,e.HeaderEmoji=`headerEmoji`,e.HeaderImage=`headerImage`,e.HeaderUri=`headerUri`,e.HeaderPhone=`headerPhone`,e.HeaderMarkdown=`headerMarkdown`,e.HeaderDate=`headerDate`,e.HeaderTime=`headerTime`,e.HeaderEmail=`headerEmail`,e.HeaderReference=`headerReference`,e.HeaderIfThenElse=`headerIfThenElse`,e.HeaderSingleValue=`headerSingleValue`,e.HeaderLookup=`headerLookup`,e.HeaderTextTemplate=`headerTextTemplate`,e.HeaderMath=`headerMath`,e.HeaderRollup=`headerRollup`,e.HeaderJoinStrings=`headerJoinStrings`,e.HeaderSplitString=`headerSplitString`,e.HeaderGeoDistance=`headerGeoDistance`,e.HeaderArray=`headerArray`,e.RowOwnerOverlay=`rowOwnerOverlay`,e.ProtectedColumnOverlay=`protectedColumnOverlay`})(Qn||={});var $n;(function(e){e.Triangle=`triangle`,e.Dots=`dots`})($n||={});function er(e){return`width`in e&&typeof e.width==`number`}async function tr(e){return typeof e==`object`?e:await e()}function nr(e){return e.kind!==W.Loading&&e.kind!==W.Bubble&&e.kind!==W.RowID&&e.kind!==W.Protected&&e.kind!==W.Drilldown}function rr(e){return e.kind===sr.Marker||e.kind===sr.NewRow}function ir(e){if(!nr(e)||e.kind===W.Image)return!1;if(e.kind===W.Text||e.kind===W.Number||e.kind===W.Markdown||e.kind===W.Uri||e.kind===W.Custom||e.kind===W.Boolean)return e.readonly!==!0;Gt(e,`A cell was passed with an invalid kind`)}function ar(e){return(0,Zn.default)(e,`editor`)}function or(e){return!(e.readonly??!1)}var sr;(function(e){e.NewRow=`new-row`,e.Marker=`marker`})(sr||={});function cr(e){if(e.length===0)return[];let t=[...e],n=[];t.sort(function(e,t){return e[0]-t[0]}),n.push([...t[0]]);for(let e of t.slice(1)){let t=n[n.length-1];t[1]lr??=new e([]);static fromSingleSelection=t=>e.empty().add(t);offset(t){if(t===0)return this;let n=this.items.map(e=>[e[0]+t,e[1]+t]);return new e(n)}add(t){let n=typeof t==`number`?[t,t+1]:t,r=cr([...this.items,n]);return new e(r)}remove(t){let n=[...this.items],r=typeof t==`number`?t:t[0],i=typeof t==`number`?t+1:t[1];for(let[e,t]of n.entries()){let[a,o]=t;if(a<=i&&r<=o){let t=[];a=n&&e{(e?e.split(` `):[]).forEach(e=>{if(e.startsWith(`atm_`)){let[,n]=e.split(`_`);t[n]=e}else n.push(e)})});let r=[];for(let e in t)Object.prototype.hasOwnProperty.call(t,e)&&r.push(t[e]);return r.push(...n),r.join(` `)},hr=e=>e.toUpperCase()===e,gr=e=>t=>e.indexOf(t)===-1,_r=(e,t)=>{let n={};return Object.keys(e).filter(gr(t)).forEach(t=>{n[t]=e[t]}),n};function vr(e,t,n){let r=_r(t,n);if(!e){let e=typeof pr==`function`?{default:pr}:pr;Object.keys(r).forEach(t=>{e.default(t)||delete r[t]})}return r}function yr(e){return t=>{let n=(n,r)=>{let{as:i=e,class:a=``}=n,o=vr(t.propsAsIs===void 0?!(typeof i==`string`&&i.indexOf(`-`)===-1&&!hr(i[0])):t.propsAsIs,n,[`as`,`class`]);o.ref=r,o.className=t.atomic?mr(t.class,o.className||a):mr(o.className||a,t.class);let{vars:s}=t;if(s){let e={};for(let r in s){let i=s[r],a=i[0],o=i[1]||``,c=typeof a==`function`?a(n):a;t.name,e[`--${r}`]=`${c}${o}`}let r=o.style||{},i=Object.keys(r);i.length>0&&i.forEach(t=>{e[t]=r[t]}),o.style=e}return e.__linaria&&e!==i?(o.as=i,g.createElement(e,o)):g.createElement(i,o)},r=g.forwardRef?g.forwardRef(n):e=>{let t=_r(e,[`innerRef`]);return n(t,e.innerRef)};return r.displayName=t.name,r.__linaria={className:t.class||``,extends:e},r}}var br=yr,xr=br(`div`)({name:`ImageOverlayEditorStyle`,class:`gdg-i2iowwq`,propsAsIs:!1}),Sr=o(((e,t)=>{t.exports=`SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED`})),Cr=o(((e,t)=>{var n=Sr();function r(){}function i(){}i.resetWarningCache=r,t.exports=function(){function e(e,t,r,i,a,o){if(o!==n){var s=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name=`Invariant Violation`,s}}e.isRequired=e;function t(){return e}var a={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:r};return a.PropTypes=a,a}})),wr=o(((e,t)=>{t.exports=Cr()()})),Tr=o(((e,t,n)=>{(function(t,n){if(typeof define==`function`&&define.amd)define([`exports`,`react`,`prop-types`],n);else if(e!==void 0)n(e,u(),wr());else{var r={exports:{}};n(r.exports,t.react,t.propTypes),t.reactSwipe=r.exports}})(n,function(e,t,n){Object.defineProperty(e,"__esModule",{value:!0}),e.setHasSupportToCaptureOption=p;var r=a(t),i=a(n);function a(e){return e&&e.__esModule?e:{default:e}}var o=Object.assign||function(e){for(var t=1;t=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function c(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}var l=function(){function e(e,t){for(var n=0;n0&&arguments[0]!==void 0?arguments[0]:{capture:!0};return f?e:e.capture}function h(e){if(`touches`in e){var t=e.touches[0];return{x:t.pageX,y:t.pageY}}return{x:e.screenX,y:e.screenY}}var g=function(e){d(t,e);function t(){var e;c(this,t);var n=[...arguments],r=u(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(n)));return r._handleSwipeStart=r._handleSwipeStart.bind(r),r._handleSwipeMove=r._handleSwipeMove.bind(r),r._handleSwipeEnd=r._handleSwipeEnd.bind(r),r._onMouseDown=r._onMouseDown.bind(r),r._onMouseMove=r._onMouseMove.bind(r),r._onMouseUp=r._onMouseUp.bind(r),r._setSwiperRef=r._setSwiperRef.bind(r),r}return l(t,[{key:`componentDidMount`,value:function(){this.swiper&&this.swiper.addEventListener(`touchmove`,this._handleSwipeMove,m({capture:!0,passive:!1}))}},{key:`componentWillUnmount`,value:function(){this.swiper&&this.swiper.removeEventListener(`touchmove`,this._handleSwipeMove,m({capture:!0,passive:!1}))}},{key:`_onMouseDown`,value:function(e){this.props.allowMouseEvents&&(this.mouseDown=!0,document.addEventListener(`mouseup`,this._onMouseUp),document.addEventListener(`mousemove`,this._onMouseMove),this._handleSwipeStart(e))}},{key:`_onMouseMove`,value:function(e){this.mouseDown&&this._handleSwipeMove(e)}},{key:`_onMouseUp`,value:function(e){this.mouseDown=!1,document.removeEventListener(`mouseup`,this._onMouseUp),document.removeEventListener(`mousemove`,this._onMouseMove),this._handleSwipeEnd(e)}},{key:`_handleSwipeStart`,value:function(e){var t=h(e),n=t.x,r=t.y;this.moveStart={x:n,y:r},this.props.onSwipeStart(e)}},{key:`_handleSwipeMove`,value:function(e){if(this.moveStart){var t=h(e),n=t.x,r=t.y,i=n-this.moveStart.x,a=r-this.moveStart.y;this.moving=!0,this.props.onSwipeMove({x:i,y:a},e)&&e.cancelable&&e.preventDefault(),this.movePosition={deltaX:i,deltaY:a}}}},{key:`_handleSwipeEnd`,value:function(e){this.props.onSwipeEnd(e);var t=this.props.tolerance;this.moving&&this.movePosition&&(this.movePosition.deltaX<-t?this.props.onSwipeLeft(1,e):this.movePosition.deltaX>t&&this.props.onSwipeRight(1,e),this.movePosition.deltaY<-t?this.props.onSwipeUp(1,e):this.movePosition.deltaY>t&&this.props.onSwipeDown(1,e)),this.moveStart=null,this.moving=!1,this.movePosition=null}},{key:`_setSwiperRef`,value:function(e){this.swiper=e,this.props.innerRef(e)}},{key:`render`,value:function(){var e=this.props;e.tagName;var t=e.className,n=e.style,i=e.children;e.allowMouseEvents,e.onSwipeUp,e.onSwipeDown,e.onSwipeLeft,e.onSwipeRight,e.onSwipeStart,e.onSwipeMove,e.onSwipeEnd,e.innerRef,e.tolerance;var a=s(e,[`tagName`,`className`,`style`,`children`,`allowMouseEvents`,`onSwipeUp`,`onSwipeDown`,`onSwipeLeft`,`onSwipeRight`,`onSwipeStart`,`onSwipeMove`,`onSwipeEnd`,`innerRef`,`tolerance`]);return r.default.createElement(this.props.tagName,o({ref:this._setSwiperRef,onMouseDown:this._onMouseDown,onTouchStart:this._handleSwipeStart,onTouchEnd:this._handleSwipeEnd,className:t,style:n},a),i)}}]),t}(t.Component);g.displayName=`ReactSwipe`,g.propTypes={tagName:i.default.string,className:i.default.string,style:i.default.object,children:i.default.node,allowMouseEvents:i.default.bool,onSwipeUp:i.default.func,onSwipeDown:i.default.func,onSwipeLeft:i.default.func,onSwipeRight:i.default.func,onSwipeStart:i.default.func,onSwipeMove:i.default.func,onSwipeEnd:i.default.func,innerRef:i.default.func,tolerance:i.default.number.isRequired},g.defaultProps={tagName:`div`,allowMouseEvents:!1,onSwipeUp:function(){},onSwipeDown:function(){},onSwipeLeft:function(){},onSwipeRight:function(){},onSwipeStart:function(){},onSwipeMove:function(){},onSwipeEnd:function(){},innerRef:function(){},tolerance:0},e.default=g})})),Er=o(((e,t,n)=>{(function(t,n){if(typeof define==`function`&&define.amd)define([`exports`,`./react-swipe`],n);else if(e!==void 0)n(e,Tr());else{var r={exports:{}};n(r.exports,t.reactSwipe),t.index=r.exports}})(n,function(e,t){Object.defineProperty(e,"__esModule",{value:!0});var n=r(t);function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default})})),Dr=o(((e,t)=>{(function(){var e={}.hasOwnProperty;function n(){for(var e=``,t=0;t{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var t=n(Dr());function n(e){return e&&e.__esModule?e:{default:e}}function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}e.default={ROOT:function(e){return(0,t.default)(r({"carousel-root":!0},e||``,!!e))},CAROUSEL:function(e){return(0,t.default)({carousel:!0,"carousel-slider":e})},WRAPPER:function(e,n){return(0,t.default)({"thumbs-wrapper":!e,"slider-wrapper":e,"axis-horizontal":n===`horizontal`,"axis-vertical":n!==`horizontal`})},SLIDER:function(e,n){return(0,t.default)({thumbs:!e,slider:e,animated:!n})},ITEM:function(e,n,r){return(0,t.default)({thumb:!e,slide:e,selected:n,previous:r})},ARROW_PREV:function(e){return(0,t.default)({"control-arrow control-prev":!0,"control-disabled":e})},ARROW_NEXT:function(e){return(0,t.default)({"control-arrow control-next":!0,"control-disabled":e})},DOT:function(e){return(0,t.default)({dot:!0,selected:e})}}})),kr=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.outerWidth=void 0,e.outerWidth=function(e){var t=e.offsetWidth,n=getComputedStyle(e);return t+=parseInt(n.marginLeft)+parseInt(n.marginRight),t}})),Ar=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0,e.default=function(e,t,n){var r=e===0?e:e+t;return`translate3d`+(`(`+(n===`horizontal`?[r,0,0]:[0,r,0]).join(`,`)+`)`)}})),jr=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0,e.default=function(){return window}})),Mr=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var t=l(u()),n=s(Or()),r=kr(),i=s(Ar()),a=s(Er()),o=s(jr());function s(e){return e&&e.__esModule?e:{default:e}}function c(){if(typeof WeakMap!=`function`)return null;var e=new WeakMap;return c=function(){return e},e}function l(e){if(e&&e.__esModule)return e;if(e===null||d(e)!==`object`&&typeof e!=`function`)return{default:e};var t=c();if(t&&t.has(e))return t.get(e);var n={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if(Object.prototype.hasOwnProperty.call(e,i)){var a=r?Object.getOwnPropertyDescriptor(e,i):null;a&&(a.get||a.set)?Object.defineProperty(n,i,a):n[i]=e[i]}return n.default=e,t&&t.set(e,n),n}function d(e){"@babel/helpers - typeof";return d=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},d(e)}function f(){return f=Object.assign||function(e){for(var t=1;t`u`||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy==`function`)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}function S(e){return S=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},S(e)}function C(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var w=function(e){return e.hasOwnProperty(`key`)},T=function(e){g(c,e);var s=v(c);function c(e){var n;return p(this,c),n=s.call(this,e),C(b(n),`itemsWrapperRef`,void 0),C(b(n),`itemsListRef`,void 0),C(b(n),`thumbsRef`,void 0),C(b(n),`setItemsWrapperRef`,function(e){n.itemsWrapperRef=e}),C(b(n),`setItemsListRef`,function(e){n.itemsListRef=e}),C(b(n),`setThumbsRef`,function(e,t){n.thumbsRef||(n.thumbsRef=[]),n.thumbsRef[t]=e}),C(b(n),`updateSizes`,function(){if(n.props.children&&n.itemsWrapperRef&&n.thumbsRef){var e=t.Children.count(n.props.children),i=n.itemsWrapperRef.clientWidth,a=n.props.thumbWidth?n.props.thumbWidth:(0,r.outerWidth)(n.thumbsRef[0]),o=Math.floor(i/a),s=o0&&(r=0),s===c&&r<0&&(r=0);var l=s+100/(n.itemsWrapperRef.clientWidth/r);return n.itemsListRef&&[`WebkitTransform`,`MozTransform`,`MsTransform`,`OTransform`,`transform`,`msTransform`].forEach(function(e){n.itemsListRef.style[e]=(0,i.default)(l,`%`,n.props.axis)}),!0}),C(b(n),`slideRight`,function(e){n.moveTo(n.state.firstItem-(typeof e==`number`?e:1))}),C(b(n),`slideLeft`,function(e){n.moveTo(n.state.firstItem+(typeof e==`number`?e:1))}),C(b(n),`moveTo`,function(e){e=e<0?0:e,e=e>=n.state.lastPosition?n.state.lastPosition:e,n.setState({firstItem:e})}),n.state={selectedItem:e.selectedItem,swiping:!1,showArrows:!1,firstItem:0,visibleItems:0,lastPosition:0},n}return h(c,[{key:`componentDidMount`,value:function(){this.setupThumbs()}},{key:`componentDidUpdate`,value:function(e){this.props.selectedItem!==this.state.selectedItem&&this.setState({selectedItem:this.props.selectedItem,firstItem:this.getFirstItem(this.props.selectedItem)}),this.props.children!==e.children&&this.updateSizes()}},{key:`componentWillUnmount`,value:function(){this.destroyThumbs()}},{key:`setupThumbs`,value:function(){(0,o.default)().addEventListener(`resize`,this.updateSizes),(0,o.default)().addEventListener(`DOMContentLoaded`,this.updateSizes),this.updateSizes()}},{key:`destroyThumbs`,value:function(){(0,o.default)().removeEventListener(`resize`,this.updateSizes),(0,o.default)().removeEventListener(`DOMContentLoaded`,this.updateSizes)}},{key:`getFirstItem`,value:function(e){var t=e;return e>=this.state.lastPosition&&(t=this.state.lastPosition),e1,o=this.state.showArrows&&this.state.firstItem>0,s=this.state.showArrows&&this.state.firstItem{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0,e.default=function(){return document}})),Pr=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.setPosition=e.getPosition=e.isKeyboardEvent=e.defaultStatusFormatter=e.noop=void 0;var t=u(),n=r(Ar());function r(e){return e&&e.__esModule?e:{default:e}}e.noop=function(){},e.defaultStatusFormatter=function(e,t){return`${e} of ${t}`},e.isKeyboardEvent=function(e){return e?e.hasOwnProperty(`key`):!1},e.getPosition=function(e,n){if(n.infiniteLoop&&++e,e===0)return 0;var r=t.Children.count(n.children);if(n.centerMode&&n.axis===`horizontal`){var i=-e*n.centerSlidePercentage,a=r-1;return e&&(e!==a||n.infiniteLoop)?i+=(100-n.centerSlidePercentage)/2:e===a&&(i+=100-n.centerSlidePercentage),i}return-e*100},e.setPosition=function(e,t){var r={};return[`WebkitTransform`,`MozTransform`,`MsTransform`,`OTransform`,`transform`,`msTransform`].forEach(function(i){r[i]=(0,n.default)(e,`%`,t)}),r}})),Fr=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.fadeAnimationHandler=e.slideStopSwipingHandler=e.slideSwipeAnimationHandler=e.slideAnimationHandler=void 0;var t=u(),n=i(Ar()),r=Pr();function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function o(e){for(var t=1;tl))return c<0?a.itemListStyle=e.centerMode&&e.centerSlidePercentage&&e.axis===`horizontal`?(0,r.setPosition)(-(l+2)*e.centerSlidePercentage-(100-e.centerSlidePercentage)/2,e.axis):(0,r.setPosition)(-(l+2)*100,e.axis):c>l&&(a.itemListStyle=(0,r.setPosition)(0,e.axis)),a;var u=(0,r.getPosition)(s,e),d=(0,n.default)(u,`%`,e.axis),f=e.transitionTime+`ms`;return a.itemListStyle={WebkitTransform:d,msTransform:d,OTransform:d,transform:d},i.swiping||(a.itemListStyle=o(o({},a.itemListStyle),{},{WebkitTransitionDuration:f,MozTransitionDuration:f,OTransitionDuration:f,transitionDuration:f,msTransitionDuration:f})),a},e.slideSwipeAnimationHandler=function(e,n,i,a){var o={},s=n.axis===`horizontal`,c=t.Children.count(n.children),l=0,u=(0,r.getPosition)(i.selectedItem,n),d=n.infiniteLoop?(0,r.getPosition)(c-1,n)-100:(0,r.getPosition)(c-1,n),f=s?e.x:e.y,p=f;u===l&&f>0&&(p=0),u===d&&f<0&&(p=0);var m=u+100/(i.itemSize/p),h=Math.abs(f)>n.swipeScrollTolerance;return n.infiniteLoop&&h&&(i.selectedItem===0&&m>-100?m-=c*100:i.selectedItem===c-1&&m<-c*100&&(m+=c*100)),(!n.preventMovementUntilSwipeScrollTolerance||h||i.swipeMovementStarted)&&(i.swipeMovementStarted||a({swipeMovementStarted:!0}),o.itemListStyle=(0,r.setPosition)(m,n.axis)),h&&!i.cancelClick&&a({cancelClick:!0}),o},e.slideStopSwipingHandler=function(e,t){var n=(0,r.getPosition)(t.selectedItem,e);return{itemListStyle:(0,r.setPosition)(n,e.axis)}},e.fadeAnimationHandler=function(e,t){var n=e.transitionTime+`ms`,r=`ease-in-out`,i={position:`absolute`,display:`block`,zIndex:-2,minHeight:`100%`,opacity:0,top:0,right:0,left:0,bottom:0,transitionTimingFunction:r,msTransitionTimingFunction:r,MozTransitionTimingFunction:r,WebkitTransitionTimingFunction:r,OTransitionTimingFunction:r};return t.swiping||(i=o(o({},i),{},{WebkitTransitionDuration:n,MozTransitionDuration:n,OTransitionDuration:n,transitionDuration:n,msTransitionDuration:n})),{slideStyle:i,selectedStyle:o(o({},i),{},{opacity:1,position:`relative`}),prevStyle:o({},i)}}})),Ir=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var t=f(u()),n=l(Er()),r=l(Or()),i=l(Mr()),a=l(Nr()),o=l(jr()),s=Pr(),c=Fr();function l(e){return e&&e.__esModule?e:{default:e}}function d(){if(typeof WeakMap!=`function`)return null;var e=new WeakMap;return d=function(){return e},e}function f(e){if(e&&e.__esModule)return e;if(e===null||p(e)!==`object`&&typeof e!=`function`)return{default:e};var t=d();if(t&&t.has(e))return t.get(e);var n={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if(Object.prototype.hasOwnProperty.call(e,i)){var a=r?Object.getOwnPropertyDescriptor(e,i):null;a&&(a.get||a.set)?Object.defineProperty(n,i,a):n[i]=e[i]}return n.default=e,t&&t.set(e,n),n}function p(e){"@babel/helpers - typeof";return p=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},p(e)}function m(){return m=Object.assign||function(e){for(var t=1;t`u`||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy==`function`)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}function E(e){return E=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},E(e)}function D(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var O=function(e){b(u,e);var l=S(u);function u(e){var n;_(this,u),n=l.call(this,e),D(w(n),`thumbsRef`,void 0),D(w(n),`carouselWrapperRef`,void 0),D(w(n),`listRef`,void 0),D(w(n),`itemsRef`,void 0),D(w(n),`timer`,void 0),D(w(n),`animationHandler`,void 0),D(w(n),`setThumbsRef`,function(e){n.thumbsRef=e}),D(w(n),`setCarouselWrapperRef`,function(e){n.carouselWrapperRef=e}),D(w(n),`setListRef`,function(e){n.listRef=e}),D(w(n),`setItemsRef`,function(e,t){n.itemsRef||(n.itemsRef=[]),n.itemsRef[t]=e}),D(w(n),`autoPlay`,function(){t.Children.count(n.props.children)<=1||(n.clearAutoPlay(),n.props.autoPlay&&(n.timer=setTimeout(function(){n.increment()},n.props.interval)))}),D(w(n),`clearAutoPlay`,function(){n.timer&&clearTimeout(n.timer)}),D(w(n),`resetAutoPlay`,function(){n.clearAutoPlay(),n.autoPlay()}),D(w(n),`stopOnHover`,function(){n.setState({isMouseEntered:!0},n.clearAutoPlay)}),D(w(n),`startOnLeave`,function(){n.setState({isMouseEntered:!1},n.autoPlay)}),D(w(n),`isFocusWithinTheCarousel`,function(){return n.carouselWrapperRef?!!((0,a.default)().activeElement===n.carouselWrapperRef||n.carouselWrapperRef.contains((0,a.default)().activeElement)):!1}),D(w(n),`navigateWithKeyboard`,function(e){if(n.isFocusWithinTheCarousel()){var t=n.props.axis===`horizontal`,r={ArrowUp:38,ArrowRight:39,ArrowDown:40,ArrowLeft:37},i=t?r.ArrowRight:r.ArrowDown,a=t?r.ArrowLeft:r.ArrowUp;i===e.keyCode?n.increment():a===e.keyCode&&n.decrement()}}),D(w(n),`updateSizes`,function(){if(n.state.initialized&&n.itemsRef&&n.itemsRef.length!==0){var e=n.props.axis===`horizontal`,t=n.itemsRef[0];if(t){var r=e?t.clientWidth:t.clientHeight;n.setState({itemSize:r}),n.thumbsRef&&n.thumbsRef.updateSizes()}}}),D(w(n),`setMountState`,function(){n.setState({hasMount:!0}),n.updateSizes()}),D(w(n),`handleClickItem`,function(e,r){t.Children.count(n.props.children)!==0&&(n.state.cancelClick?n.setState({cancelClick:!1}):(n.props.onClickItem(e,r),e!==n.state.selectedItem&&n.setState({selectedItem:e})))}),D(w(n),`handleOnChange`,function(e,r){t.Children.count(n.props.children)<=1||n.props.onChange(e,r)}),D(w(n),`handleClickThumb`,function(e,t){n.props.onClickThumb(e,t),n.moveTo(e)}),D(w(n),`onSwipeStart`,function(e){n.setState({swiping:!0}),n.props.onSwipeStart(e)}),D(w(n),`onSwipeEnd`,function(e){n.setState({swiping:!1,cancelClick:!1,swipeMovementStarted:!1}),n.props.onSwipeEnd(e),n.clearAutoPlay(),n.state.autoPlay&&n.autoPlay()}),D(w(n),`onSwipeMove`,function(e,t){n.props.onSwipeMove(t);var r=n.props.swipeAnimationHandler(e,n.props,n.state,n.setState.bind(w(n)));return n.setState(g({},r)),!!Object.keys(r).length}),D(w(n),`decrement`,function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1;n.moveTo(n.state.selectedItem-(typeof e==`number`?e:1))}),D(w(n),`increment`,function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1;n.moveTo(n.state.selectedItem+(typeof e==`number`?e:1))}),D(w(n),`moveTo`,function(e){if(typeof e==`number`){var r=t.Children.count(n.props.children)-1;e<0&&(e=n.props.infiniteLoop?r:0),e>r&&(e=n.props.infiniteLoop?0:r),n.selectItem({selectedItem:e}),n.state.autoPlay&&n.state.isMouseEntered===!1&&n.resetAutoPlay()}}),D(w(n),`onClickNext`,function(){n.increment(1)}),D(w(n),`onClickPrev`,function(){n.decrement(1)}),D(w(n),`onSwipeForward`,function(){n.increment(1),n.props.emulateTouch&&n.setState({cancelClick:!0})}),D(w(n),`onSwipeBackwards`,function(){n.decrement(1),n.props.emulateTouch&&n.setState({cancelClick:!0})}),D(w(n),`changeItem`,function(e){return function(t){(0,s.isKeyboardEvent)(t)&&t.key!==`Enter`||n.moveTo(e)}}),D(w(n),`selectItem`,function(e){n.setState(g({previousItem:n.state.selectedItem},e),function(){n.setState(n.animationHandler(n.props,n.state))}),n.handleOnChange(e.selectedItem,t.Children.toArray(n.props.children)[e.selectedItem])}),D(w(n),`getInitialImage`,function(){var e=n.props.selectedItem,t=n.itemsRef&&n.itemsRef[e];return(t&&t.getElementsByTagName(`img`)||[])[0]}),D(w(n),`getVariableItemHeight`,function(e){var t=n.itemsRef&&n.itemsRef[e];if(n.state.hasMount&&t&&t.children.length){var r=t.children[0].getElementsByTagName(`img`)||[];if(r.length>0){var i=r[0];i.complete||i.addEventListener(`load`,function e(){n.forceUpdate(),i.removeEventListener(`load`,e)})}var a=(r[0]||t.children[0]).clientHeight;return a>0?a:null}return null});var r={initialized:!1,previousItem:e.selectedItem,selectedItem:e.selectedItem,hasMount:!1,isMouseEntered:!1,autoPlay:e.autoPlay,swiping:!1,swipeMovementStarted:!1,cancelClick:!1,itemSize:1,itemListStyle:{},slideStyle:{},selectedStyle:{},prevStyle:{}};return n.animationHandler=typeof e.animationHandler==`function`&&e.animationHandler||e.animationHandler===`fade`&&c.fadeAnimationHandler||c.slideAnimationHandler,n.state=g(g({},r),n.animationHandler(e,r)),n}return y(u,[{key:`componentDidMount`,value:function(){this.props.children&&this.setupCarousel()}},{key:`componentDidUpdate`,value:function(e,t){!e.children&&this.props.children&&!this.state.initialized&&this.setupCarousel(),!e.autoFocus&&this.props.autoFocus&&this.forceFocus(),t.swiping&&!this.state.swiping&&this.setState(g({},this.props.stopSwipingHandler(this.props,this.state))),(e.selectedItem!==this.props.selectedItem||e.centerMode!==this.props.centerMode)&&(this.updateSizes(),this.moveTo(this.props.selectedItem)),e.autoPlay!==this.props.autoPlay&&(this.props.autoPlay?this.setupAutoPlay():this.destroyAutoPlay(),this.setState({autoPlay:this.props.autoPlay}))}},{key:`componentWillUnmount`,value:function(){this.destroyCarousel()}},{key:`setupCarousel`,value:function(){var e=this;this.bindEvents(),this.state.autoPlay&&t.Children.count(this.props.children)>1&&this.setupAutoPlay(),this.props.autoFocus&&this.forceFocus(),this.setState({initialized:!0},function(){var t=e.getInitialImage();t&&!t.complete?t.addEventListener(`load`,e.setMountState):e.setMountState()})}},{key:`destroyCarousel`,value:function(){this.state.initialized&&(this.unbindEvents(),this.destroyAutoPlay())}},{key:`setupAutoPlay`,value:function(){this.autoPlay();var e=this.carouselWrapperRef;this.props.stopOnHover&&e&&(e.addEventListener(`mouseenter`,this.stopOnHover),e.addEventListener(`mouseleave`,this.startOnLeave))}},{key:`destroyAutoPlay`,value:function(){this.clearAutoPlay();var e=this.carouselWrapperRef;this.props.stopOnHover&&e&&(e.removeEventListener(`mouseenter`,this.stopOnHover),e.removeEventListener(`mouseleave`,this.startOnLeave))}},{key:`bindEvents`,value:function(){(0,o.default)().addEventListener(`resize`,this.updateSizes),(0,o.default)().addEventListener(`DOMContentLoaded`,this.updateSizes),this.props.useKeyboardArrows&&(0,a.default)().addEventListener(`keydown`,this.navigateWithKeyboard)}},{key:`unbindEvents`,value:function(){(0,o.default)().removeEventListener(`resize`,this.updateSizes),(0,o.default)().removeEventListener(`DOMContentLoaded`,this.updateSizes);var e=this.getInitialImage();e&&e.removeEventListener(`load`,this.setMountState),this.props.useKeyboardArrows&&(0,a.default)().removeEventListener(`keydown`,this.navigateWithKeyboard)}},{key:`forceFocus`,value:function(){var e;(e=this.carouselWrapperRef)==null||e.focus()}},{key:`renderItems`,value:function(e){var n=this;return this.props.children?t.Children.map(this.props.children,function(i,a){var o=a===n.state.selectedItem,s=a===n.state.previousItem,c=o&&n.state.selectedStyle||s&&n.state.prevStyle||n.state.slideStyle||{};n.props.centerMode&&n.props.axis===`horizontal`&&(c=g(g({},c),{},{minWidth:n.props.centerSlidePercentage+`%`})),n.state.swiping&&n.state.swipeMovementStarted&&(c=g(g({},c),{},{pointerEvents:`none`}));var l={ref:function(e){return n.setItemsRef(e,a)},key:`itemKey`+a+(e?`clone`:``),className:r.default.ITEM(!0,a===n.state.selectedItem,a===n.state.previousItem),onClick:n.handleClickItem.bind(n,a,i),style:c};return t.default.createElement(`li`,l,n.props.renderItem(i,{isSelected:a===n.state.selectedItem,isPrevious:a===n.state.previousItem}))}):[]}},{key:`renderControls`,value:function(){var e=this,n=this.props,r=n.showIndicators,i=n.labels,a=n.renderIndicator,o=n.children;return r?t.default.createElement(`ul`,{className:`control-dots`},t.Children.map(o,function(t,n){return a&&a(e.changeItem(n),n===e.state.selectedItem,n,i.item)})):null}},{key:`renderStatus`,value:function(){return this.props.showStatus?t.default.createElement(`p`,{className:`carousel-status`},this.props.statusFormatter(this.state.selectedItem+1,t.Children.count(this.props.children))):null}},{key:`renderThumbs`,value:function(){return!this.props.showThumbs||!this.props.children||t.Children.count(this.props.children)===0?null:t.default.createElement(i.default,{ref:this.setThumbsRef,onSelectItem:this.handleClickThumb,selectedItem:this.state.selectedItem,transitionTime:this.props.transitionTime,thumbWidth:this.props.thumbWidth,labels:this.props.labels,emulateTouch:this.props.emulateTouch},this.props.renderThumbs(this.props.children))}},{key:`render`,value:function(){var e=this;if(!this.props.children||t.Children.count(this.props.children)===0)return null;var i=this.props.swipeable&&t.Children.count(this.props.children)>1,a=this.props.axis===`horizontal`,o=this.props.showArrows&&t.Children.count(this.props.children)>1,s=o&&(this.state.selectedItem>0||this.props.infiniteLoop)||!1,c=o&&(this.state.selectedItem{})),Rr=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"Carousel",{enumerable:!0,get:function(){return t.default}}),Object.defineProperty(e,"CarouselProps",{enumerable:!0,get:function(){return n.CarouselProps}}),Object.defineProperty(e,"Thumbs",{enumerable:!0,get:function(){return r.default}});var t=i(Ir()),n=Lr(),r=i(Mr());function i(e){return e&&e.__esModule?e:{default:e}}})),zr=o(((e,t)=>{var n=Zt();t.exports=function(){return n.Date.now()}})),Br=o(((e,t)=>{var n=/\s/;function r(e){for(var t=e.length;t--&&n.test(e.charAt(t)););return t}t.exports=r})),Vr=o(((e,t)=>{var n=Br(),r=/^\s+/;function i(e){return e&&e.slice(0,n(e)+1).replace(r,``)}t.exports=i})),Hr=o(((e,t)=>{var n=Vr(),r=on(),i=rn(),a=NaN,o=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,c=/^0o[0-7]+$/i,l=parseInt;function u(e){if(typeof e==`number`)return e;if(i(e))return a;if(r(e)){var t=typeof e.valueOf==`function`?e.valueOf():e;e=r(t)?t+``:t}if(typeof e!=`string`)return e===0?e:+e;e=n(e);var u=s.test(e);return u||c.test(e)?l(e.slice(2),u?2:8):o.test(e)?a:+e}t.exports=u})),Ur=o(((e,t)=>{var n=on(),r=zr(),i=Hr(),a=`Expected a function`,o=Math.max,s=Math.min;function c(e,t,c){var l,u,d,f,p,m,h=0,g=!1,_=!1,v=!0;if(typeof e!=`function`)throw TypeError(a);t=i(t)||0,n(c)&&(g=!!c.leading,_=`maxWait`in c,d=_?o(i(c.maxWait)||0,t):d,v=`trailing`in c?!!c.trailing:v);function y(t){var n=l,r=u;return l=u=void 0,h=t,f=e.apply(r,n),f}function b(e){return h=e,p=setTimeout(C,t),g?y(e):f}function x(e){var n=e-m,r=e-h,i=t-n;return _?s(i,d-r):i}function S(e){var n=e-m,r=e-h;return m===void 0||n>=t||n<0||_&&r>=d}function C(){var e=r();if(S(e))return w(e);p=setTimeout(C,x(e))}function w(e){return p=void 0,v&&l?y(e):(l=u=void 0,f)}function T(){p!==void 0&&clearTimeout(p),h=0,l=m=u=p=void 0}function E(){return p===void 0?f:w(r())}function D(){var e=r(),n=S(e);if(l=arguments,u=this,m=e,n){if(p===void 0)return b(m);if(_)return clearTimeout(p),p=setTimeout(C,t),y(m)}return p===void 0&&(p=setTimeout(C,t)),f}return D.cancel=T,D.flush=E,D}t.exports=c})),Wr=c(Ur(),1);function Gr(e,t,n,r,i=!1){let a=g.useRef();a.current=t,g.useEffect(()=>{if(n===null||n.addEventListener===void 0)return;let t=n,o=e=>{a.current?.call(t,e)};return t.addEventListener(e,o,{passive:r,capture:i}),()=>{t.removeEventListener(e,o,{capture:i})}},[e,n,r,i])}function Kr(e,t){return e===void 0?void 0:t}var qr=Math.PI;function Jr(e){return e*qr/180}var Yr=(e,t,n)=>({x1:e-n/2,y1:t-n/2,x2:e+n/2,y2:t+n/2}),Xr=(e,t,n,r,i)=>{switch(e){case`left`:return Math.floor(t)+r+i/2;case`center`:return Math.floor(t+n/2);case`right`:return Math.floor(t+n)-r-i/2}},Zr=(e,t,n)=>Math.min(e,t-n*2),Qr=(e,t,n)=>n.x1<=e&&e<=n.x2&&n.y1<=t&&t<=n.y2,$r=e=>{let t=e.fgColor??`currentColor`;return g.createElement(`svg`,{viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},g.createElement(`path`,{d:`M12.7073 7.05029C7.87391 11.8837 10.4544 9.30322 6.03024 13.7273C5.77392 13.9836 5.58981 14.3071 5.50189 14.6587L4.52521 18.5655C4.38789 19.1148 4.88543 19.6123 5.43472 19.475L9.34146 18.4983C9.69313 18.4104 10.0143 18.2286 10.2706 17.9722L16.9499 11.2929`,stroke:t,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,fill:`none`,vectorEffect:`non-scaling-stroke`}),g.createElement(`path`,{d:`M20.4854 4.92901L19.0712 3.5148C18.2901 2.73375 17.0238 2.73375 16.2428 3.5148L14.475 5.28257C15.5326 7.71912 16.4736 8.6278 18.7176 9.52521L20.4854 7.75744C21.2665 6.97639 21.2665 5.71006 20.4854 4.92901Z`,stroke:t,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,fill:`none`,vectorEffect:`non-scaling-stroke`}))},ei=e=>{let t=e.fgColor??`currentColor`;return g.createElement(`svg`,{viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},g.createElement(`path`,{d:`M19 6L10.3802 17L5.34071 11.8758`,vectorEffect:`non-scaling-stroke`,stroke:t,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`}))};function ti(e,t,n){let[r,i]=g.useState(e),a=g.useRef(!0);g.useEffect(()=>()=>{a.current=!1},[]);let o=g.useRef((0,Wr.default)(e=>{a.current&&i(e)},n));return g.useLayoutEffect(()=>{a.current&&o.current(()=>e())},t),r}var ni=RegExp(`^[^A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿]*[֑-߿יִ-﷽ﹰ-ﻼ]`);function ri(e){return ni.test(e)?`rtl`:`not-rtl`}var ii=void 0;function ai(){if(typeof document>`u`)return 0;if(ii!==void 0)return ii;let e=document.createElement(`p`);e.style.width=`100%`,e.style.height=`200px`;let t=document.createElement(`div`);t.id=`testScrollbar`,t.style.position=`absolute`,t.style.top=`0px`,t.style.left=`0px`,t.style.visibility=`hidden`,t.style.width=`200px`,t.style.height=`150px`,t.style.overflow=`hidden`,t.append(e),document.body.append(t);let n=e.offsetWidth;t.style.overflow=`scroll`;let r=e.offsetWidth;return n===r&&(r=t.clientWidth),t.remove(),ii=n-r,ii}var oi=Symbol();function si(e){let t=g.useRef([oi,e]);t.current[1]!==e&&(t.current[0]=e),t.current[1]=e;let[n,r]=g.useState(e),[,i]=g.useState(),a=g.useCallback(e=>{let n=t.current[0];n!==oi&&(e=typeof e==`function`?e(n):e,e===n)||(n!==oi&&i({}),r(t=>typeof e==`function`?e(n===oi?t:n):e),t.current[0]=oi)},[]),o=g.useCallback(()=>{t.current[0]=oi,i({})},[]);return[t.current[0]===oi?n:t.current[0],a,o]}function ci(e){if(e.length===0)return``;let t=0,n=0;for(let r of e){if(n+=r.length,n>1e4)break;t++}return e.slice(0,t).join(`, `)}function li(e){let t=g.useRef(e);return Jt(e,t.current)||(t.current=e),t.current}var ui=Rr(),di=e=>{let{urls:t,canWrite:n,onEditClick:r,renderImage:i}=e,a=t.filter(e=>e!==``);if(a.length===0)return null;let o=a.length>1;return g.createElement(xr,{"data-testid":`GDG-default-image-overlay-editor`},g.createElement(ui.Carousel,{showArrows:o,showThumbs:!1,swipeable:o,emulateTouch:o,infiniteLoop:o},a.map(e=>{let t=i?.(e)??g.createElement(`img`,{draggable:!1,src:e});return g.createElement(`div`,{className:`gdg-centering-container`,key:e},t)})),n&&r&&g.createElement(`button`,{className:`gdg-edit-icon`,onClick:r},g.createElement($r,null)))};function fi(){return{async:!1,baseUrl:null,breaks:!1,extensions:null,gfm:!0,headerIds:!0,headerPrefix:``,highlight:null,hooks:null,langPrefix:`language-`,mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}var pi=fi();function mi(e){pi=e}var hi=/[&<>"']/,gi=new RegExp(hi.source,`g`),_i=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,vi=new RegExp(_i.source,`g`),yi={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`},bi=e=>yi[e];function xi(e,t){if(t){if(hi.test(e))return e.replace(gi,bi)}else if(_i.test(e))return e.replace(vi,bi);return e}var Si=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi;function Ci(e){return e.replace(Si,(e,t)=>(t=t.toLowerCase(),t===`colon`?`:`:t.charAt(0)===`#`?t.charAt(1)===`x`?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):``))}var wi=/(^|[^\[])\^/g;function Ti(e,t){e=typeof e==`string`?e:e.source,t||=``;let n={replace:(t,r)=>(r=r.source||r,r=r.replace(wi,`$1`),e=e.replace(t,r),n),getRegex:()=>new RegExp(e,t)};return n}var Ei=/[^\w:]/g,Di=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function Oi(e,t,n){if(e){let e;try{e=decodeURIComponent(Ci(n)).replace(Ei,``).toLowerCase()}catch{return null}if(e.indexOf(`javascript:`)===0||e.indexOf(`vbscript:`)===0||e.indexOf(`data:`)===0)return null}t&&!Di.test(n)&&(n=Ni(t,n));try{n=encodeURI(n).replace(/%25/g,`%`)}catch{return null}return n}var ki={},Ai=/^[^:]+:\/*[^/]*$/,ji=/^([^:]+:)[\s\S]*$/,Mi=/^([^:]+:\/*[^/]*)[\s\S]*$/;function Ni(e,t){ki[` `+e]||(Ai.test(e)?ki[` `+e]=e+`/`:ki[` `+e]=Ii(e,`/`,!0)),e=ki[` `+e];let n=e.indexOf(`:`)===-1;return t.substring(0,2)===`//`?n?t:e.replace(ji,`$1`)+t:t.charAt(0)===`/`?n?t:e.replace(Mi,`$1`)+t:e+t}var Pi={exec:function(){}};function Fi(e,t){let n=e.replace(/\|/g,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(/ \|/),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n[n.length-1].trim()&&n.pop(),n.length>t)n.splice(t);else for(;n.length1;)t&1&&(n+=e),t>>=1,e+=e;return n+e}function Bi(e,t,n,r){let i=t.href,a=t.title?xi(t.title):null,o=e[1].replace(/\\([\[\]])/g,`$1`);if(e[0].charAt(0)!==`!`){r.state.inLink=!0;let e={type:`link`,raw:n,href:i,title:a,text:o,tokens:r.inlineTokens(o)};return r.state.inLink=!1,e}return{type:`image`,raw:n,href:i,title:a,text:xi(o)}}function Vi(e,t){let n=e.match(/^(\s+)(?:```)/);if(n===null)return t;let r=n[1];return t.split(` +`).map(e=>{let t=e.match(/^\s+/);if(t===null)return e;let[n]=t;return n.length>=r.length?e.slice(r.length):e}).join(` +`)}var Hi=class{constructor(e){this.options=e||pi}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:`space`,raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let e=t[0].replace(/^ {1,4}/gm,``);return{type:`code`,raw:t[0],codeBlockStyle:`indented`,text:this.options.pedantic?e:Ii(e,` +`)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=Vi(e,t[3]||``);return{type:`code`,raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline._escapes,`$1`):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(/#$/.test(e)){let t=Ii(e,`#`);(this.options.pedantic||!t||/ $/.test(t))&&(e=t.trim())}return{type:`heading`,raw:t[0],depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:`hr`,raw:t[0]}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=t[0].replace(/^ *>[ \t]?/gm,``),n=this.lexer.state.top;this.lexer.state.top=!0;let r=this.lexer.blockTokens(e);return this.lexer.state.top=n,{type:`blockquote`,raw:t[0],tokens:r,text:e}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n,r,i,a,o,s,c,l,u,d,f,p,m=t[1].trim(),h=m.length>1,g={type:`list`,raw:``,ordered:h,start:h?+m.slice(0,-1):``,loose:!1,items:[]};m=h?`\\d{1,9}\\${m.slice(-1)}`:`\\${m}`,this.options.pedantic&&(m=h?m:`[*+-]`);let _=RegExp(`^( {0,3}${m})((?:[\t ][^\\n]*)?(?:\\n|$))`);for(;e&&(p=!1,(t=_.exec(e))&&!this.rules.block.hr.test(e));){if(n=t[0],e=e.substring(n.length),l=t[2].split(` +`,1)[0].replace(/^\t+/,e=>` `.repeat(3*e.length)),u=e.split(` +`,1)[0],this.options.pedantic?(a=2,f=l.trimLeft()):(a=t[2].search(/[^ ]/),a=a>4?1:a,f=l.slice(a),a+=t[1].length),s=!1,!l&&/^ *$/.test(u)&&(n+=u+` +`,e=e.substring(u.length+1),p=!0),!p){let t=RegExp(`^ {0,${Math.min(3,a-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ \t][^\\n]*)?(?:\\n|$))`),r=RegExp(`^ {0,${Math.min(3,a-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),i=RegExp(`^ {0,${Math.min(3,a-1)}}(?:\`\`\`|~~~)`),o=RegExp(`^ {0,${Math.min(3,a-1)}}#`);for(;e&&(d=e.split(` +`,1)[0],u=d,this.options.pedantic&&(u=u.replace(/^ {1,4}(?=( {4})*[^ ])/g,` `)),!(i.test(u)||o.test(u)||t.test(u)||r.test(e)));){if(u.search(/[^ ]/)>=a||!u.trim())f+=` +`+u.slice(a);else{if(s||l.search(/[^ ]/)>=4||i.test(l)||o.test(l)||r.test(l))break;f+=` +`+u}!s&&!u.trim()&&(s=!0),n+=d+` +`,e=e.substring(d.length+1),l=u.slice(a)}}g.loose||(c?g.loose=!0:/\n *\n *$/.test(n)&&(c=!0)),this.options.gfm&&(r=/^\[[ xX]\] /.exec(f),r&&(i=r[0]!==`[ ] `,f=f.replace(/^\[[ xX]\] +/,``))),g.items.push({type:`list_item`,raw:n,task:!!r,checked:i,loose:!1,text:f}),g.raw+=n}g.items[g.items.length-1].raw=n.trimRight(),g.items[g.items.length-1].text=f.trimRight(),g.raw=g.raw.trimRight();let v=g.items.length;for(o=0;oe.type===`space`);g.loose=e.length>0&&e.some(e=>/\n.*\n/.test(e.raw))}if(g.loose)for(o=0;o$/,`$1`).replace(this.rules.inline._escapes,`$1`):``,r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline._escapes,`$1`):t[3];return{type:`def`,tag:e,raw:t[0],href:n,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(t){let e={type:`table`,header:Fi(t[1]).map(e=>({text:e})),align:t[2].replace(/^ *|\| *$/g,``).split(/ *\| */),rows:t[3]&&t[3].trim()?t[3].replace(/\n[ \t]*$/,``).split(` +`):[]};if(e.header.length===e.align.length){e.raw=t[0];let n=e.align.length,r,i,a,o;for(r=0;r({text:e}));for(n=e.header.length,i=0;i/i.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:this.options.sanitize?`text`:`html`,raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(t[0]):xi(t[0]):t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let e=t[2].trim();if(!this.options.pedantic&&/^$/.test(e))return;let t=Ii(e.slice(0,-1),`\\`);if((e.length-t.length)%2==0)return}else{let e=Li(t[2],`()`);if(e>-1){let n=(t[0].indexOf(`!`)===0?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=``}}let n=t[2],r=``;if(this.options.pedantic){let e=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(n);e&&(n=e[1],r=e[3])}else r=t[3]?t[3].slice(1,-1):``;return n=n.trim(),/^$/.test(e)?n.slice(1):n.slice(1,-1)),Bi(t,{href:n&&n.replace(this.rules.inline._escapes,`$1`),title:r&&r.replace(this.rules.inline._escapes,`$1`)},t[0],this.lexer)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let e=(n[2]||n[1]).replace(/\s+/g,` `);if(e=t[e.toLowerCase()],!e){let e=n[0].charAt(0);return{type:`text`,raw:e,text:e}}return Bi(n,e,n[0],this.lexer)}}emStrong(e,t,n=``){let r=this.rules.inline.emStrong.lDelim.exec(e);if(!r||r[3]&&n.match(/[\p{L}\p{N}]/u))return;let i=r[1]||r[2]||``;if(!i||i&&(n===``||this.rules.inline.punctuation.exec(n))){let n=r[0].length-1,i,a,o=n,s=0,c=r[0][0]===`*`?this.rules.inline.emStrong.rDelimAst:this.rules.inline.emStrong.rDelimUnd;for(c.lastIndex=0,t=t.slice(-1*e.length+n);(r=c.exec(t))!=null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i)continue;if(a=i.length,r[3]||r[4]){o+=a;continue}if((r[5]||r[6])&&n%3&&!((n+a)%3)){s+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o+s);let t=e.slice(0,n+r.index+(r[0].length-i.length)+a);if(Math.min(n,a)%2){let e=t.slice(1,-1);return{type:`em`,raw:t,text:e,tokens:this.lexer.inlineTokens(e)}}let c=t.slice(2,-2);return{type:`strong`,raw:t,text:c,tokens:this.lexer.inlineTokens(c)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(/\n/g,` `),n=/[^ ]/.test(e),r=/^ /.test(e)&&/ $/.test(e);return n&&r&&(e=e.substring(1,e.length-1)),e=xi(e,!0),{type:`codespan`,raw:t[0],text:e}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:`br`,raw:t[0]}}del(e){let t=this.rules.inline.del.exec(e);if(t)return{type:`del`,raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e,t){let n=this.rules.inline.autolink.exec(e);if(n){let e,r;return n[2]===`@`?(e=xi(this.options.mangle?t(n[1]):n[1]),r=`mailto:`+e):(e=xi(n[1]),r=e),{type:`link`,raw:n[0],text:e,href:r,tokens:[{type:`text`,raw:e,text:e}]}}}url(e,t){let n;if(n=this.rules.inline.url.exec(e)){let e,r;if(n[2]===`@`)e=xi(this.options.mangle?t(n[0]):n[0]),r=`mailto:`+e;else{let t;do t=n[0],n[0]=this.rules.inline._backpedal.exec(n[0])[0];while(t!==n[0]);e=xi(n[0]),r=n[1]===`www.`?`http://`+n[0]:n[0]}return{type:`link`,raw:n[0],text:e,href:r,tokens:[{type:`text`,raw:e,text:e}]}}}inlineText(e,t){let n=this.rules.inline.text.exec(e);if(n){let e;return e=this.lexer.state.inRawBlock?this.options.sanitize?this.options.sanitizer?this.options.sanitizer(n[0]):xi(n[0]):n[0]:xi(this.options.smartypants?t(n[0]):n[0]),{type:`text`,raw:n[0],text:e}}}},G={newline:/^(?: *(?:\n|$))+/,code:/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,hr:/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/,html:`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|\\n*|$)|\\n*|$)|)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))`,def:/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/,table:Pi,lheading:/^((?:.|\n(?!\n))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,text:/^[^\n]+/};G._label=/(?!\s*\])(?:\\.|[^\[\]\\])+/,G._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,G.def=Ti(G.def).replace(`label`,G._label).replace(`title`,G._title).getRegex(),G.bullet=/(?:[*+-]|\d{1,9}[.)])/,G.listItemStart=Ti(/^( *)(bull) */).replace(`bull`,G.bullet).getRegex(),G.list=Ti(G.list).replace(/bull/g,G.bullet).replace(`hr`,`\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))`).replace(`def`,`\\n+(?=`+G.def.source+`)`).getRegex(),G._tag=`address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul`,G._comment=/|$)/,G.html=Ti(G.html,`i`).replace(`comment`,G._comment).replace(`tag`,G._tag).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),G.paragraph=Ti(G._paragraph).replace(`hr`,G.hr).replace(`heading`,` {0,3}#{1,6} `).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)]) `).replace(`html`,`)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,G._tag).getRegex(),G.blockquote=Ti(G.blockquote).replace(`paragraph`,G.paragraph).getRegex(),G.normal={...G},G.gfm={...G.normal,table:`^ *([^\\n ].*\\|.*)\\n {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`},G.gfm.table=Ti(G.gfm.table).replace(`hr`,G.hr).replace(`heading`,` {0,3}#{1,6} `).replace(`blockquote`,` {0,3}>`).replace(`code`,` {4}[^\\n]`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)]) `).replace(`html`,`)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,G._tag).getRegex(),G.gfm.paragraph=Ti(G._paragraph).replace(`hr`,G.hr).replace(`heading`,` {0,3}#{1,6} `).replace(`|lheading`,``).replace(`table`,G.gfm.table).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)]) `).replace(`html`,`)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,G._tag).getRegex(),G.pedantic={...G.normal,html:Ti(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,G._comment).replace(/tag/g,`(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b`).getRegex(),def:/^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Pi,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Ti(G.normal._paragraph).replace(`hr`,G.hr).replace(`heading`,` *#{1,6} *[^ +]`).replace(`lheading`,G.lheading).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).getRegex()};var K={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:Pi,tag:`^comment|^|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^`,link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(ref)\]/,nolink:/^!?\[(ref)\](?:\[\])?/,reflinkSearch:`reflink|nolink(?!\\()`,emStrong:{lDelim:/^(?:\*+(?:([punct_])|[^\s*]))|^_+(?:([punct*])|([^\s_]))/,rDelimAst:/^(?:[^_*\\]|\\.)*?\_\_(?:[^_*\\]|\\.)*?\*(?:[^_*\\]|\\.)*?(?=\_\_)|(?:[^*\\]|\\.)+(?=[^*])|[punct_](\*+)(?=[\s]|$)|(?:[^punct*_\s\\]|\\.)(\*+)(?=[punct_\s]|$)|[punct_\s](\*+)(?=[^punct*_\s])|[\s](\*+)(?=[punct_])|[punct_](\*+)(?=[punct_])|(?:[^punct*_\s\\]|\\.)(\*+)(?=[^punct*_\s])/,rDelimUnd:/^(?:[^_*\\]|\\.)*?\*\*(?:[^_*\\]|\\.)*?\_(?:[^_*\\]|\\.)*?(?=\*\*)|(?:[^_\\]|\\.)+(?=[^_])|[punct*](\_+)(?=[\s]|$)|(?:[^punct*_\s\\]|\\.)(\_+)(?=[punct*\s]|$)|[punct*\s](\_+)(?=[^punct*_\s])|[\s](\_+)(?=[punct*])|[punct*](\_+)(?=[punct*])/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:Pi,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\?@\\[\\]\`^{|}~`,K.punctuation=Ti(K.punctuation).replace(/punctuation/g,K._punctuation).getRegex(),K.blockSkip=/\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g,K.escapedEmSt=/(?:^|[^\\])(?:\\\\)*\\[*_]/g,K._comment=Ti(G._comment).replace(`(?:-->|$)`,`-->`).getRegex(),K.emStrong.lDelim=Ti(K.emStrong.lDelim).replace(/punct/g,K._punctuation).getRegex(),K.emStrong.rDelimAst=Ti(K.emStrong.rDelimAst,`g`).replace(/punct/g,K._punctuation).getRegex(),K.emStrong.rDelimUnd=Ti(K.emStrong.rDelimUnd,`g`).replace(/punct/g,K._punctuation).getRegex(),K._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,K._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,K._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/,K.autolink=Ti(K.autolink).replace(`scheme`,K._scheme).replace(`email`,K._email).getRegex(),K._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,K.tag=Ti(K.tag).replace(`comment`,K._comment).replace(`attribute`,K._attribute).getRegex(),K._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,K._href=/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/,K._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,K.link=Ti(K.link).replace(`label`,K._label).replace(`href`,K._href).replace(`title`,K._title).getRegex(),K.reflink=Ti(K.reflink).replace(`label`,K._label).replace(`ref`,G._label).getRegex(),K.nolink=Ti(K.nolink).replace(`ref`,G._label).getRegex(),K.reflinkSearch=Ti(K.reflinkSearch,`g`).replace(`reflink`,K.reflink).replace(`nolink`,K.nolink).getRegex(),K.normal={...K},K.pedantic={...K.normal,strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:Ti(/^!?\[(label)\]\((.*?)\)/).replace(`label`,K._label).getRegex(),reflink:Ti(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,K._label).getRegex()},K.gfm={...K.normal,escape:Ti(K.escape).replace(`])`,`~|])`).getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\.5&&(r=`x`+r.toString(16)),t+=`&#`+r+`;`;return t}var Gi=class e{constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||pi,this.options.tokenizer=this.options.tokenizer||new Hi,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={block:G.normal,inline:K.normal};this.options.pedantic?(t.block=G.pedantic,t.inline=K.pedantic):this.options.gfm&&(t.block=G.gfm,t.inline=this.options.breaks?K.breaks:K.gfm),this.tokenizer.rules=t}static get rules(){return{block:G,inline:K}}static lex(t,n){return new e(n).lex(t)}static lexInline(t,n){return new e(n).inlineTokens(t)}lex(e){e=e.replace(/\r\n|\r/g,` +`),this.blockTokens(e,this.tokens);let t;for(;t=this.inlineQueue.shift();)this.inlineTokens(t.src,t.tokens);return this.tokens}blockTokens(e,t=[]){e=this.options.pedantic?e.replace(/\t/g,` `).replace(/^ +$/gm,``):e.replace(/^( *)(\t+)/gm,(e,t,n)=>t+` `.repeat(n.length));let n,r,i,a;for(;e;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some(r=>(n=r.call({lexer:this},e,t))?(e=e.substring(n.raw.length),t.push(n),!0):!1))){if(n=this.tokenizer.space(e))e=e.substring(n.raw.length),n.raw.length===1&&t.length>0?t[t.length-1].raw+=` +`:t.push(n);else if(n=this.tokenizer.code(e))e=e.substring(n.raw.length),r=t[t.length-1],r&&(r.type===`paragraph`||r.type===`text`)?(r.raw+=` +`+n.raw,r.text+=` +`+n.text,this.inlineQueue[this.inlineQueue.length-1].src=r.text):t.push(n);else if(n=this.tokenizer.fences(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.heading(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.hr(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.blockquote(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.list(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.html(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.def(e))e=e.substring(n.raw.length),r=t[t.length-1],r&&(r.type===`paragraph`||r.type===`text`)?(r.raw+=` +`+n.raw,r.text+=` +`+n.raw,this.inlineQueue[this.inlineQueue.length-1].src=r.text):this.tokens.links[n.tag]||(this.tokens.links[n.tag]={href:n.href,title:n.title});else if(n=this.tokenizer.table(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.lheading(e))e=e.substring(n.raw.length),t.push(n);else{if(i=e,this.options.extensions&&this.options.extensions.startBlock){let t=1/0,n=e.slice(1),r;this.options.extensions.startBlock.forEach(function(e){r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(i=e.substring(0,t+1))}if(this.state.top&&(n=this.tokenizer.paragraph(i)))r=t[t.length-1],a&&r.type===`paragraph`?(r.raw+=` +`+n.raw,r.text+=` +`+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=r.text):t.push(n),a=i.length!==e.length,e=e.substring(n.raw.length);else if(n=this.tokenizer.text(e))e=e.substring(n.raw.length),r=t[t.length-1],r&&r.type===`text`?(r.raw+=` +`+n.raw,r.text+=` +`+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=r.text):t.push(n);else if(e){let t=`Infinite loop on byte: `+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw Error(t)}}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let n,r,i,a=e,o,s,c;if(this.tokens.links){let e=Object.keys(this.tokens.links);if(e.length>0)for(;(o=this.tokenizer.rules.inline.reflinkSearch.exec(a))!=null;)e.includes(o[0].slice(o[0].lastIndexOf(`[`)+1,-1))&&(a=a.slice(0,o.index)+`[`+zi(`a`,o[0].length-2)+`]`+a.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(o=this.tokenizer.rules.inline.blockSkip.exec(a))!=null;)a=a.slice(0,o.index)+`[`+zi(`a`,o[0].length-2)+`]`+a.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(o=this.tokenizer.rules.inline.escapedEmSt.exec(a))!=null;)a=a.slice(0,o.index+o[0].length-2)+`++`+a.slice(this.tokenizer.rules.inline.escapedEmSt.lastIndex),this.tokenizer.rules.inline.escapedEmSt.lastIndex--;for(;e;)if(s||(c=``),s=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some(r=>(n=r.call({lexer:this},e,t))?(e=e.substring(n.raw.length),t.push(n),!0):!1))){if(n=this.tokenizer.escape(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.tag(e))e=e.substring(n.raw.length),r=t[t.length-1],r&&n.type===`text`&&r.type===`text`?(r.raw+=n.raw,r.text+=n.text):t.push(n);else if(n=this.tokenizer.link(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.reflink(e,this.tokens.links))e=e.substring(n.raw.length),r=t[t.length-1],r&&n.type===`text`&&r.type===`text`?(r.raw+=n.raw,r.text+=n.text):t.push(n);else if(n=this.tokenizer.emStrong(e,a,c))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.codespan(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.br(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.del(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.autolink(e,Wi))e=e.substring(n.raw.length),t.push(n);else if(!this.state.inLink&&(n=this.tokenizer.url(e,Wi)))e=e.substring(n.raw.length),t.push(n);else{if(i=e,this.options.extensions&&this.options.extensions.startInline){let t=1/0,n=e.slice(1),r;this.options.extensions.startInline.forEach(function(e){r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(i=e.substring(0,t+1))}if(n=this.tokenizer.inlineText(i,Ui))e=e.substring(n.raw.length),n.raw.slice(-1)!==`_`&&(c=n.raw.slice(-1)),s=!0,r=t[t.length-1],r&&r.type===`text`?(r.raw+=n.raw,r.text+=n.text):t.push(n);else if(e){let t=`Infinite loop on byte: `+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw Error(t)}}}return t}},Ki=class{constructor(e){this.options=e||pi}code(e,t,n){let r=(t||``).match(/\S*/)[0];if(this.options.highlight){let t=this.options.highlight(e,r);t!=null&&t!==e&&(n=!0,e=t)}return e=e.replace(/\n$/,``)+` +`,r?`
    `+(n?e:xi(e,!0))+`
    +`:`
    `+(n?e:xi(e,!0))+`
    +`}blockquote(e){return`
    \n${e}
    \n`}html(e){return e}heading(e,t,n,r){return this.options.headerIds?`${e}\n`:`${e}\n`}hr(){return this.options.xhtml?`
    +`:`
    +`}list(e,t,n){let r=t?`ol`:`ul`,i=t&&n!==1?` start="`+n+`"`:``;return`<`+r+i+`> +`+e+` +`}listitem(e){return`
  • ${e}
  • \n`}checkbox(e){return` `}paragraph(e){return`

    ${e}

    \n`}table(e,t){return t&&=`${t}`,` + +`+e+` +`+t+`
    +`}tablerow(e){return`\n${e}\n`}tablecell(e,t){let n=t.header?`th`:`td`;return(t.align?`<${n} align="${t.align}">`:`<${n}>`)+e+`\n`}strong(e){return`${e}`}em(e){return`${e}`}codespan(e){return`${e}`}br(){return this.options.xhtml?`
    `:`
    `}del(e){return`${e}`}link(e,t,n){if(e=Oi(this.options.sanitize,this.options.baseUrl,e),e===null)return n;let r=`
    `+n+``,r}image(e,t,n){if(e=Oi(this.options.sanitize,this.options.baseUrl,e),e===null)return n;let r=`${n}`:`>`,r}text(e){return e}},qi=class{strong(e){return e}em(e){return e}codespan(e){return e}del(e){return e}html(e){return e}text(e){return e}link(e,t,n){return``+n}image(e,t,n){return``+n}br(){return``}},Ji=class{constructor(){this.seen={}}serialize(e){return e.toLowerCase().trim().replace(/<[!\/a-z].*?>/gi,``).replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,``).replace(/\s/g,`-`)}getNextSafeSlug(e,t){let n=e,r=0;if(this.seen.hasOwnProperty(n)){r=this.seen[e];do r++,n=e+`-`+r;while(this.seen.hasOwnProperty(n))}return t||(this.seen[e]=r,this.seen[n]=0),n}slug(e,t={}){let n=this.serialize(e);return this.getNextSafeSlug(n,t.dryrun)}},Yi=class e{constructor(e){this.options=e||pi,this.options.renderer=this.options.renderer||new Ki,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new qi,this.slugger=new Ji}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e,t=!0){let n=``,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S=e.length;for(r=0;r0&&_.tokens[0].type===`paragraph`?(_.tokens[0].text=b+` `+_.tokens[0].text,_.tokens[0].tokens&&_.tokens[0].tokens.length>0&&_.tokens[0].tokens[0].type===`text`&&(_.tokens[0].tokens[0].text=b+` `+_.tokens[0].tokens[0].text)):_.tokens.unshift({type:`text`,text:b}):g+=b),g+=this.parse(_.tokens,h),d+=this.renderer.listitem(g,y,v);n+=this.renderer.list(d,p,m);continue;case`html`:n+=this.renderer.html(f.text);continue;case`paragraph`:n+=this.renderer.paragraph(this.parseInline(f.tokens));continue;case`text`:for(d=f.tokens?this.parseInline(f.tokens):f.text;r+1{if(r.message+=` +Please report this to https://github.com/markedjs/marked.`,e){let e=`

    An error occurred:

    `+xi(r.message+``,!0)+`
    `;if(t)return Promise.resolve(e);if(n){n(null,e);return}return e}if(t)return Promise.reject(r);if(n)n(r);else throw r}}function Qi(e,t){return(n,r,i)=>{typeof r==`function`&&(i=r,r=null);let a={...r};r={...q.defaults,...a};let o=Zi(r.silent,r.async,i);if(n==null)return o(Error(`marked(): input parameter is undefined or null`));if(typeof n!=`string`)return o(Error(`marked(): input parameter is of type `+Object.prototype.toString.call(n)+`, string expected`));if(Ri(r),r.hooks&&(r.hooks.options=r),i){let a=r.highlight,s;try{r.hooks&&(n=r.hooks.preprocess(n)),s=e(n,r)}catch(e){return o(e)}let c=function(e){let n;if(!e)try{r.walkTokens&&q.walkTokens(s,r.walkTokens),n=t(s,r),r.hooks&&(n=r.hooks.postprocess(n))}catch(t){e=t}return r.highlight=a,e?o(e):i(null,n)};if(!a||a.length<3||(delete r.highlight,!s.length))return c();let l=0;q.walkTokens(s,function(e){e.type===`code`&&(l++,setTimeout(()=>{a(e.text,e.lang,function(t,n){if(t)return c(t);n!=null&&n!==e.text&&(e.text=n,e.escaped=!0),l--,l===0&&c()})},0))}),l===0&&c()}else{if(r.async)return Promise.resolve(r.hooks?r.hooks.preprocess(n):n).then(t=>e(t,r)).then(e=>r.walkTokens?Promise.all(q.walkTokens(e,r.walkTokens)).then(()=>e):e).then(e=>t(e,r)).then(e=>r.hooks?r.hooks.postprocess(e):e).catch(o);try{r.hooks&&(n=r.hooks.preprocess(n));let i=e(n,r);r.walkTokens&&q.walkTokens(i,r.walkTokens);let a=t(i,r);return r.hooks&&(a=r.hooks.postprocess(a)),a}catch(e){return o(e)}}}}function q(e,t,n){return Qi(Gi.lex,Yi.parse)(e,t,n)}q.options=q.setOptions=function(e){return q.defaults={...q.defaults,...e},mi(q.defaults),q},q.getDefaults=fi,q.defaults=pi,q.use=function(...e){let t=q.defaults.extensions||{renderers:{},childTokens:{}};e.forEach(e=>{let n={...e};if(n.async=q.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error(`extension name required`);if(e.renderer){let n=t.renderers[e.name];n?t.renderers[e.name]=function(...t){let r=e.renderer.apply(this,t);return r===!1&&(r=n.apply(this,t)),r}:t.renderers[e.name]=e.renderer}if(e.tokenizer){if(!e.level||e.level!==`block`&&e.level!==`inline`)throw Error(`extension level must be 'block' or 'inline'`);t[e.level]?t[e.level].unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&(e.level===`block`?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:e.level===`inline`&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=q.defaults.renderer||new Ki;for(let n in e.renderer){let r=t[n];t[n]=(...i)=>{let a=e.renderer[n].apply(t,i);return a===!1&&(a=r.apply(t,i)),a}}n.renderer=t}if(e.tokenizer){let t=q.defaults.tokenizer||new Hi;for(let n in e.tokenizer){let r=t[n];t[n]=(...i)=>{let a=e.tokenizer[n].apply(t,i);return a===!1&&(a=r.apply(t,i)),a}}n.tokenizer=t}if(e.hooks){let t=q.defaults.hooks||new Xi;for(let n in e.hooks){let r=t[n];t[n]=Xi.passThroughHooks.has(n)?i=>{if(q.defaults.async)return Promise.resolve(e.hooks[n].call(t,i)).then(e=>r.call(t,e));let a=e.hooks[n].call(t,i);return r.call(t,a)}:(...i)=>{let a=e.hooks[n].apply(t,i);return a===!1&&(a=r.apply(t,i)),a}}n.hooks=t}if(e.walkTokens){let t=q.defaults.walkTokens;n.walkTokens=function(n){let r=[];return r.push(e.walkTokens.call(this,n)),t&&(r=r.concat(t.call(this,n))),r}}q.setOptions(n)})},q.walkTokens=function(e,t){let n=[];for(let r of e)switch(n=n.concat(t.call(q,r)),r.type){case`table`:for(let e of r.header)n=n.concat(q.walkTokens(e.tokens,t));for(let e of r.rows)for(let r of e)n=n.concat(q.walkTokens(r.tokens,t));break;case`list`:n=n.concat(q.walkTokens(r.items,t));break;default:q.defaults.extensions&&q.defaults.extensions.childTokens&&q.defaults.extensions.childTokens[r.type]?q.defaults.extensions.childTokens[r.type].forEach(function(e){n=n.concat(q.walkTokens(r[e],t))}):r.tokens&&(n=n.concat(q.walkTokens(r.tokens,t)))}return n},q.parseInline=Qi(Gi.lexInline,Yi.parseInline),q.Parser=Yi,q.parser=Yi.parse,q.Renderer=Ki,q.TextRenderer=qi,q.Lexer=Gi,q.lexer=Gi.lex,q.Tokenizer=Hi,q.Slugger=Ji,q.Hooks=Xi,q.parse=q,q.options,q.setOptions,q.use,q.walkTokens,q.parseInline,Yi.parse,Gi.lex;var $i=br(`div`)({name:`MarkdownContainer`,class:`gdg-mnuv029`,propsAsIs:!1}),ea=class extends g.PureComponent{targetElement=null;renderMarkdownIntoDiv(){let{targetElement:e,props:t}=this;if(e===null)return;let{contents:n,createNode:r}=t,i=q(n),a=document.createRange();a.selectNodeContents(e),a.deleteContents();let o=r?.(i);if(o===void 0){let e=document.createElement(`template`);e.innerHTML=i,o=e.content}e.append(o);let s=e.getElementsByTagName(`a`);for(let e of s)e.target=`_blank`,e.rel=`noreferrer noopener`}containerRefHook=e=>{this.targetElement=e,this.renderMarkdownIntoDiv()};render(){return this.renderMarkdownIntoDiv(),g.createElement($i,{ref:this.containerRefHook})}},ta=br(`textarea`)({name:`InputBox`,class:`gdg-izpuzkl`,propsAsIs:!1}),na=br(`div`)({name:`ShadowBox`,class:`gdg-s69h75o`,propsAsIs:!1}),ra=br(`div`)({name:`GrowingEntryStyle`,class:`gdg-g1y0xocz`,propsAsIs:!1}),ia=0,aa=e=>{let{placeholder:t,value:n,onKeyDown:r,highlight:i,altNewline:a,validatedSelection:o,...s}=e,{onChange:c,className:l}=s,u=g.useRef(null),d=n??``;Wt(c!==void 0,`GrowingEntry must be a controlled input area`);let[f]=g.useState(()=>`input-box-`+(ia=(ia+1)%1e7));g.useEffect(()=>{let e=u.current;if(e===null||e.disabled)return;let t=d.toString().length;e.focus(),e.setSelectionRange(i?0:t,t)},[]),g.useLayoutEffect(()=>{if(o!==void 0){let e=typeof o==`number`?[o,null]:o;u.current?.setSelectionRange(e[0],e[1])}},[o]);let p=g.useCallback(e=>{e.key===`Enter`&&e.shiftKey&&a===!0||r?.(e)},[a,r]);return g.createElement(ra,{className:`gdg-growing-entry`},g.createElement(na,{className:l},d+` +`),g.createElement(ta,{...s,className:(l??``)+` gdg-input`,id:f,ref:u,onKeyDown:p,value:d,placeholder:t,dir:`auto`}))},oa={},sa=null;function ca(){let e=document.createElement(`div`);return e.style.opacity=`0`,e.style.pointerEvents=`none`,e.style.position=`fixed`,document.body.append(e),e}function la(e){let t=e.toLowerCase().trim();if(oa[t]!==void 0)return oa[t];sa||=ca(),sa.style.color=`#000`,sa.style.color=t;let n=getComputedStyle(sa).color;sa.style.color=`#fff`,sa.style.color=t;let r=getComputedStyle(sa).color;if(r!==n)return[0,0,0,1];let i=r.replace(/[^\d.,]/g,``).split(`,`).map(Number.parseFloat);return i.length<4&&i.push(1),i=i.map(e=>Number.isNaN(e)?0:e),oa[t]=i,i}function ua(e,t){let[n,r,i]=la(e);return`rgba(${n}, ${r}, ${i}, ${t})`}var da=new Map;function fa(e,t){let n=`${e}-${t}`,r=da.get(n);if(r!==void 0)return r;let i=pa(e,t);return da.set(n,i),i}function pa(e,t){if(t===void 0)return e;let[n,r,i,a]=la(e);if(a===1)return e;let[o,s,c,l]=la(t),u=a+l*(1-a);return`rgba(${(a*n+l*o*(1-a))/u}, ${(a*r+l*s*(1-a))/u}, ${(a*i+l*c*(1-a))/u}, ${u})`}var ma=new Map,ha=new Map,ga=new Map;function _a(){ma.clear(),ga.clear(),ha.clear()}function va(e,t,n,r,i){let a=0,o={};for(let t of e)a+=n.get(t)??i,o[t]=(o[t]??0)+1;let s=t-a;for(let e of Object.keys(o)){let t=o[e],c=n.get(e)??i,l=c+s*(c*t/a)*r/t;n.set(e,l)}}function ya(e,t){let n=new Map,r=0;for(let t of`abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890,.-+=?`){let i=e.measureText(t).width;n.set(t,i),r+=i}let i=r/n.size,a=(t/i+3)/4,o=n.keys();for(let e of o)n.set(e,(n.get(e)??i)*a);return n}function ba(e,t,n,r){let i=ha.get(n);if(r&&i!==void 0&&i.count>2e4){let r=ga.get(n);if(r===void 0&&(r=ya(e,i.size),ga.set(n,r)),i.count>5e5){let e=0;for(let n of t)e+=r.get(n)??i.size;return e*1.01}let a=e.measureText(t);return va(t,a.width,r,Math.max(.05,1-i.count/2e5),i.size),ha.set(n,{count:i.count+t.length,size:i.size}),a.width}let a=e.measureText(t),o=a.width/t.length;if((i?.count??0)>2e4)return a.width;if(i===void 0)ha.set(n,{count:t.length,size:o});else{let e=o-i.size,r=t.length/(i.count+t.length),a=i.size+e*r;ha.set(n,{count:i.count+t.length,size:a})}return a.width}function xa(e,t,n,r,i,a,o,s){if(t.length<=1)return t.length;if(in;){let n=u===void 0?t.lastIndexOf(` `,c-1):0;n>0?c=n:c--,l=ba(e,t.slice(0,Math.max(0,c)),r,o)}}if(t[c]!==` `){let e=0;if(u===void 0)e=t.lastIndexOf(` `,c);else for(let t of u){if(t>c)break;e=t}e>0&&(c=e)}return c}function Sa(e,t,n,r,i,a){let o=`${t}_${n}_${r}px`,s=ma.get(o);if(s!==void 0)return s;if(r<=0)return[];let c=[],l=t.split(` +`),u=ha.get(n),d=u===void 0?t.length:r/u.size*1.5,f=i&&u!==void 0&&u.count>2e4;for(let t of l){let i=ba(e,t.slice(0,Math.max(0,d)),n,f),o=Math.min(t.length,d);if(i<=r)c.push(t);else{for(;i>r;){let s=xa(e,t,r,n,i,o,f,a),l=t.slice(0,Math.max(0,s));t=t.slice(l.length),c.push(l),i=ba(e,t.slice(0,Math.max(0,d)),n,f),o=Math.min(t.length,d)}i>0&&c.push(t)}}return c=c.map((e,t)=>t===0?e.trimEnd():e.trim()),ma.set(o,c),ma.size>500&&ma.delete(ma.keys().next().value),c}function Ca(e,t){return g.useMemo(()=>e.map((e,n)=>({group:e.group,grow:e.grow,hasMenu:e.hasMenu,icon:e.icon,id:e.id,menuIcon:e.menuIcon,overlayIcon:e.overlayIcon,sourceIndex:n,sticky:n=e.x&&n=e.y&&r=t.span[0]&&n.current.cell[0]<=t.span[1]}function Da(e,t){let[n,r]=e;return n>=t.x&&n=t.y&&ro)return!1;if(t.span===void 0)return s>=r&&s<=i;let[l,u]=t.span;return l>=r&&l<=i||u>=r&&l<=i||li}function ja(e,t,n,r){let i=0;if(n.current===void 0)return i;let a=n.current.range;(r||a.height*a.width>1)&&Aa(e,t,a)&&i++;for(let r of n.current.rangeStack)Aa(e,t,r)&&i++;return i}function Ma(e,t){let n=e;if(t!==void 0){let r=[...e],i=n[t.src];t.src>t.dest?(r.splice(t.src,1),r.splice(t.dest,0,i)):(r.splice(t.dest+1,0,i),r.splice(t.src,1)),r=r.map((t,n)=>({...t,sticky:e[n].sticky})),n=r}return n}function Na(e,t){let n=0,r=Ma(e,t);for(let e=0;e0)for(let e of o)n-=e.width;let s=t,c=i??0;for(;c<=n&&s=d)return n}let f=a-l,p=e-(c??0);if(typeof o==`number`){let e=Math.floor((p-u)/o)+s;return e>=f?void 0:e}{let e=u;for(let t=s;t`u`;async function Va(){Ba||document?.fonts?.ready===void 0||(await document.fonts.ready,Ra=0,za={},_a())}Va();function Ha(e,t,n,r){return`${e}_${r??t?.font}_${n}`}function Ua(e,t,n,r=`middle`){let i=Ha(e,t,r,n),a=za[i];return a===void 0&&(a=t.measureText(e),za[i]=a,Ra++),Ra>1e4&&(za={},Ra=0),a}function Wa(e,t){let n=Ha(e,void 0,`middle`,t);return za[n]}function Ga(e,t){return typeof t!=`string`&&(t=t.baseFontFull),Ja(e,t)}function Ka(e,t){e.save(),e.textBaseline=t;let n=e.measureText(`ABCDEFGHIJKLMNOPQRSTUVWXYZ`);return e.restore(),n}var qa=[];function Ja(e,t){for(let e of qa)if(e.key===t)return e.val;let n=Ka(e,`alphabetic`),r=-(Ka(e,`middle`).actualBoundingBoxDescent-n.actualBoundingBoxDescent)+n.actualBoundingBoxAscent/2;return qa.push({key:t,val:r}),r}function Ya(e,t,n,r,i,a){let{ctx:o,rect:s,theme:c}=e,l=2**53-1;return t!==void 0&&(l=n-t,l<500&&(o.globalAlpha=1-l/500,o.fillStyle=c.bgSearchResult,o.fillRect(s.x+1,s.y+1,s.width-(i?2:1),s.height-(a?2:1)),o.globalAlpha=1,r!==void 0&&(r.fillStyle=c.bgSearchResult))),l<500}function Xa(e,t,n){let{ctx:r,theme:i}=e,a=t??{},o=n??i.textDark;return o!==a.fillStyle&&(r.fillStyle=o,a.fillStyle=o),a}function Za(e,t,n,r,i,a,o,s,c){c===`right`?e.fillText(t,n+i-(s.cellHorizontalPadding+.5),r+a/2+o):c===`center`?e.fillText(t,n+i/2,r+a/2+o):e.fillText(t,n+s.cellHorizontalPadding+.5,r+a/2+o)}function Qa(e,t){let n=Ua(`ABCi09jgqpy`,e,t);return n.actualBoundingBoxAscent+n.actualBoundingBoxDescent}function $a(e,t){e.includes(` +`)&&(e=e.split(/\r?\n/,1)[0]);let n=t/4;return e.length>n&&(e=e.slice(0,n)),e}function eo(e,t,n,r,i,a,o,s,c,l){let u=s.baseFontFull,d=Sa(e,t,u,i-s.cellHorizontalPadding*2,l??!1),f=Qa(e,u),p=s.lineHeight*f,m=f+p*(d.length-1),h=m+s.cellVerticalPadding>a;h&&(e.save(),e.rect(n,r,i,a),e.clip());let g=r+a/2-m/2,_=Math.max(r+s.cellVerticalPadding,g);for(let t of d)if(Za(e,t,n,_,i,f,o,s,c),_+=p,_>r+a)break;h&&e.restore()}function to(e,t,n,r,i){let{ctx:a,rect:o,theme:s}=e,{x:c,y:l,width:u,height:d}=o;r??=!1,r||(t=$a(t,u));let f=Ga(a,s),p=ri(t)===`rtl`;if(n===void 0&&p&&(n=`right`),p&&(a.direction=`rtl`),t.length>0){let e=!1;n===`right`?(a.textAlign=`right`,e=!0):n!==void 0&&n!==`left`&&(a.textAlign=n,e=!0),r?eo(a,t,c,l,u,d,f,s,n,i):Za(a,t,c,l,u,d,f,s,n),e&&(a.textAlign=`start`),p&&(a.direction=`inherit`)}}function no(e,t,n,r,i,a){typeof a==`number`&&(a={tl:a,tr:a,br:a,bl:a}),a={tl:Math.max(0,Math.min(a.tl,i/2,r/2)),tr:Math.max(0,Math.min(a.tr,i/2,r/2)),bl:Math.max(0,Math.min(a.bl,i/2,r/2)),br:Math.max(0,Math.min(a.br,i/2,r/2))},e.moveTo(t+a.tl,n),e.arcTo(t+r,n,t+r,n+a.tr,a.tr),e.arcTo(t+r,n+i,t+r-a.br,n+i,a.br),e.arcTo(t,n+i,t,n+i-a.bl,a.bl),e.arcTo(t,n,t+a.tl,n,a.tl)}function ro(e,t,n){let r=1.25;e.arc(t,n-r*3.5,r,0,2*Math.PI,!1),e.arc(t,n,r,0,2*Math.PI,!1),e.arc(t,n+r*3.5,r,0,2*Math.PI,!1)}function io(e,t,n){let r=function(e,t){let n=t.x-e.x,r=t.y-e.y,i=Math.sqrt(n*n+r*r),a=n/i,o=r/i;return{x:n,y:t.y-e.y,len:i,nx:a,ny:o,ang:Math.atan2(o,a)}},i,a=t.length,o=t[a-1];for(let s=0;s1?1:f),h=1,g=!1;p<0?m<0?m=Math.PI+m:(m=Math.PI-m,h=-1,g=!0):m>0&&(h=-1,g=!0),i=c.radius===void 0?n:c.radius;let _=m/2,v=Math.abs(Math.cos(_)*i/Math.sin(_)),y;v>Math.min(u.len/2,d.len/2)?(v=Math.min(u.len/2,d.len/2),y=Math.abs(v*Math.sin(_)/Math.cos(_))):y=i;let b=c.x+d.nx*v,x=c.y+d.ny*v;b+=-d.ny*y*h,x+=d.nx*y*h,e.arc(b,x,y,u.ang+Math.PI/2*h,d.ang-Math.PI/2*h,g),o=c,c=l}e.closePath()}function ao(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m){let h={x:0,y:a+l,width:0,height:0};if(e>=p.length||t>=u||t<-2||e<0)return h;let g=a-i;if(e>=d){let t=o>e?-1:1,n=Na(p);h.x+=n+c;for(let n=o;n!==e;n+=t)h.x+=p[t===1?n:n-1].width*t}else for(let t=0;t0&&Ta(p[t-1].group,r)&&p[t-1].sticky===a;){let e=p[t-1];h.x-=e.width,h.width+=e.width,t--}let o=e;for(;o+1n&&(h.width=n-h.x)}}else if(t>=u-f){let e=u-t;for(h.y=r;e>0;){let n=t+e-1;h.height=typeof m==`number`?m:m(n),h.y-=h.height,e--}h.height+=1}else{let e=s>t?-1:1;if(typeof m==`number`){let e=t-s;h.y+=e*m}else for(let n=s;n!==t;n+=e)h.y+=m(n)*e;h.height=(typeof m==`number`?m:m(t))+1}return h}var oo=1<<21;function so(e,t){return(t+2)*oo+e}function co(e){return e%oo}function lo(e){return Math.floor(e/oo)-2}function uo(e){return[co(e),lo(e)]}var fo=class{visibleWindow={x:0,y:0,width:0,height:0};freezeCols=0;freezeRows=[];isInWindow=e=>{let t=co(e),n=lo(e),r=this.visibleWindow,i=t>=r.x&&t<=r.x+r.width||t=r.y&&n<=r.y+r.height||this.freezeRows.includes(n);return i&&a};setWindow(e,t,n){this.visibleWindow.x===e.x&&this.visibleWindow.y===e.y&&this.visibleWindow.width===e.width&&this.visibleWindow.height===e.height&&this.freezeCols===t&&Jt(this.freezeRows,n)||(this.visibleWindow=e,this.freezeCols=t,this.freezeRows=n,this.clearOutOfWindow())}},po=class extends fo{cache=new Map;setValue=(e,t)=>{this.cache.set(so(e[0],e[1]),t)};getValue=e=>this.cache.get(so(e[0],e[1]));clearOutOfWindow=()=>{for(let[e]of this.cache.entries())this.isInWindow(e)||this.cache.delete(e)}},mo=class{cells;constructor(e=[]){this.cells=new Set(e.map(e=>so(e[0],e[1])))}add(e){this.cells.add(so(e[0],e[1]))}has(e){return e!==void 0&&this.cells.has(so(e[0],e[1]))}remove(e){this.cells.delete(so(e[0],e[1]))}clear(){this.cells.clear()}get size(){return this.cells.size}hasHeader(){for(let e of this.cells)if(lo(e)<0)return!0;return!1}hasItemInRectangle(e){for(let t=e.y;t{let i=xo(e,n[r],t,c);return l=Math.max(l,i),i});if(u.length>5&&s){l=0;let e=0;for(let t of u)e+=t;let t=e/u.length;for(let e=0;e=t*2?u[e]=0:l=Math.max(l,u[e])}l=Math.max(l,e.measureText(n.title).width+16+(n.icon===void 0?0:28));let d=Math.max(Math.ceil(a),Math.min(Math.floor(o),Math.ceil(l)));return{...n,width:d}}function Co(e,t,n,r,i,a,o,s,c){let l=g.useRef(t),u=g.useRef(n),d=g.useRef(o);l.current=t,u.current=n,d.current=o;let[f,p]=g.useMemo(()=>{if(typeof window>`u`)return[null,null];let e=document.createElement(`canvas`);return e.style.display=`none`,e.style.opacity=`0`,e.style.position=`fixed`,[e,e.getContext(`2d`,{alpha:!1})]},[]);g.useLayoutEffect(()=>(f&&document.documentElement.append(f),()=>{f?.remove()}),[f]);let m=g.useRef({}),h=g.useRef(),[_,v]=g.useState();return g.useLayoutEffect(()=>{let t=u.current;if(t===void 0||e.every(er))return;let n=Math.max(1,10-Math.floor(e.length/1e4)),r=0;n1&&(n--,r=1);let i={x:0,y:0,width:e.length,height:Math.min(l.current,n)},a={x:0,y:l.current-1,width:e.length,height:1};(async()=>{let n=t(i,c.signal),o=r>0?t(a,c.signal):void 0,s;s=typeof n==`object`?n:await tr(n),o!==void 0&&(s=typeof o==`object`?[...s,...o]:[...s,...await tr(o)]),h.current=e,v(s)})()},[c.signal,e]),g.useMemo(()=>{let t=e.every(er)?e:p===null?e.map(e=>er(e)?e:{...e,width:bo}):(p.font=d.current.baseFontFull,e.map((t,n)=>{if(er(t))return t;if(m.current[t.id]!==void 0)return{...t,width:m.current[t.id]};if(_===void 0||h.current!==e||t.id===void 0)return{...t,width:bo};let r=So(p,o,t,n,_,i,a,!0,s);return m.current[t.id]=r.width,r})),n=0,c=0,l=[];for(let[e,r]of t.entries())n+=r.width,r.grow!==void 0&&r.grow>0&&(c+=r.grow,l.push(e));if(n0){let e=[...t],i=r-n,a=i;for(let n=0;n{function n(e,t,n){return e===e&&(n!==void 0&&(e=e<=n?e:n),t!==void 0&&(e=e>=t?e:t)),e}t.exports=n})),To=o(((e,t)=>{var n=wo(),r=Hr();function i(e,t,i){return i===void 0&&(i=t,t=void 0),i!==void 0&&(i=r(i),i=i===i?i:0),t!==void 0&&(t=r(t),t=t===t?t:0),n(r(e),t,i)}t.exports=i})),Eo=o(((e,t)=>{function n(e){return this.__data__.set(e,`__lodash_hash_undefined__`),this}t.exports=n})),Do=o(((e,t)=>{function n(e){return this.__data__.has(e)}t.exports=n})),Oo=o(((e,t)=>{var n=Ln(),r=Eo(),i=Do();function a(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new n;++t{function n(e,t,n,r){for(var i=e.length,a=n+(r?1:-1);r?a--:++a{function n(e){return e!==e}t.exports=n})),jo=o(((e,t)=>{function n(e,t,n){for(var r=n-1,i=e.length;++r{var n=ko(),r=Ao(),i=jo();function a(e,t,a){return t===t?i(e,t,a):n(e,r,a)}t.exports=a})),No=o(((e,t)=>{var n=Mo();function r(e,t){return!!(e!=null&&e.length)&&n(e,t,0)>-1}t.exports=r})),Po=o(((e,t)=>{function n(e,t,n){for(var r=-1,i=e==null?0:e.length;++r{function n(e,t){return e.has(t)}t.exports=n})),Io=o(((e,t)=>{t.exports=pn()(Zt(),`Set`)})),Lo=o(((e,t)=>{function n(){}t.exports=n})),Ro=o(((e,t)=>{function n(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}t.exports=n})),zo=o(((e,t)=>{var n=Io(),r=Lo(),i=Ro();t.exports=n&&1/i(new n([,-0]))[1]==1/0?function(e){return new n(e)}:r})),Bo=o(((e,t)=>{var n=Oo(),r=No(),i=Po(),a=Fo(),o=zo(),s=Ro(),c=200;function l(e,t,l){var u=-1,d=r,f=e.length,p=!0,m=[],h=m;if(l)p=!1,d=i;else if(f>=c){var g=t?null:o(e);if(g)return s(g);p=!1,d=a,h=new n}else h=t?[]:m;outer:for(;++u{var n=Bo();function r(e){return e&&e.length?n(e):[]}t.exports=r})),Ho=o(((e,t)=>{function n(e,t){for(var n=-1,r=t.length,i=e.length;++n{var n=Qt(),r=Kn(),i=Xt(),a=n?n.isConcatSpreadable:void 0;function o(e){return i(e)||r(e)||!!(a&&e&&e[a])}t.exports=o})),Wo=o(((e,t)=>{var n=Ho(),r=Uo();function i(e,t,a,o,s){var c=-1,l=e.length;for(a||=r,s||=[];++c0&&a(u)?t>1?i(u,t-1,a,o,s):n(s,u):o||(s[s.length]=u)}return s}t.exports=i})),Go=o(((e,t)=>{var n=Wo();function r(e){return e!=null&&e.length?n(e,1):[]}t.exports=r})),Ko=o(((e,t)=>{var n=Math.ceil,r=Math.max;function i(e,t,i,a){for(var o=-1,s=r(n((t-e)/(i||1)),0),c=Array(s);s--;)c[a?s:++o]=e,e+=i;return c}t.exports=i})),qo=o(((e,t)=>{var n=sn(),r=Jn();function i(e){return e!=null&&r(e.length)&&!n(e)}t.exports=i})),Jo=o(((e,t)=>{var n=Sn(),r=qo(),i=qn(),a=on();function o(e,t,o){if(!a(o))return!1;var s=typeof t;return(s==`number`?r(o)&&i(t,o.length):s==`string`&&t in o)?n(o[t],e):!1}t.exports=o})),Yo=o(((e,t)=>{var n=Hr(),r=1/0,i=17976931348623157e292;function a(e){return e?(e=n(e),e===r||e===-r?(e<0?-1:1)*i:e===e?e:0):e===0?e:0}t.exports=a})),Xo=o(((e,t)=>{var n=Ko(),r=Jo(),i=Yo();function a(e){return function(t,a,o){return o&&typeof o!=`number`&&r(t,a,o)&&(a=o=void 0),t=i(t),a===void 0?(a=t,t=0):a=i(a),o=o===void 0?t{t.exports=Xo()()}));function Qo(e,t){return e===`normal`?[t.bgIconHeader,t.fgIconHeader]:e===`selected`?[`white`,t.accentColor]:[t.accentColor,t.bgHeader]}var $o=class{onSettled;spriteMap=new Map;headerIcons;inFlight=0;constructor(e,t){this.onSettled=t,this.headerIcons=e??{}}drawSprite(e,t,n,r,i,a,o,s=1){let[c,l]=Qo(t,o),u=a*Math.ceil(window.devicePixelRatio),d=`${c}_${l}_${u}_${e}`,f=this.spriteMap.get(d);if(f===void 0){let t=this.headerIcons[e];if(t===void 0)return;f=document.createElement(`canvas`);let n=f.getContext(`2d`);if(n===null)return;let r=new Image;r.src=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(t({fgColor:l,bgColor:c}))}`,this.spriteMap.set(d,f);let i=r.decode();if(i===void 0)return;this.inFlight++,i.then(()=>{n.drawImage(r,0,0,u,u)}).finally(()=>{this.inFlight--,this.inFlight===0&&this.onSettled()})}else s<1&&(n.globalAlpha=s),n.drawImage(f,0,0,u,u,r,i,a,a),s<1&&(n.globalAlpha=1)}};function es(e){if(e.length===0)return;let t;for(let n of e)t=Math.min(t??n.y,n.y)}function ts(e,t,n,r,i,a,o,s,c){s??=t;let l=t,u=e,d=r-a,f=!1;for(;ls&&c(l,u,e,!1,o&&u===r-1)===!0){f=!0;break}l+=e,u++}if(!f){l=n;for(let e=0;e!e.sticky)?.sourceIndex??0;if(c>d){let e=Math.max(s,d),l=t,f=r;for(let t=a.sourceIndex-1;t>=e;t--)l-=o[t].width,f+=o[t].width;for(let e=a.sourceIndex+1;e<=c;e++)f+=o[e].width;u={x:l,y:n,width:f,height:i}}if(d>s){let e=Math.min(c,d-1),u=t,f=r;for(let e=a.sourceIndex-1;e>=s;e--)u-=o[e].width,f+=o[e].width;for(let t=a.sourceIndex+1;t<=e;t++)f+=o[t].width;l={x:u,y:n,width:f,height:i}}return[l,u]}function as(e,t,n,r){if(r===`any`)return cs(e,{x:t,y:n,width:1,height:1});if(r===`vertical`&&(t=e.x),r===`horizontal`&&(n=e.y),Da([t,n],e))return;let i=t-e.x,a=e.x+e.width-t,o=n-e.y+1,s=e.y+e.height-n,c=Math.min(r===`vertical`?2**53-1:i,r===`vertical`?2**53-1:a,r===`horizontal`?2**53-1:o,r===`horizontal`?2**53-1:s);return c===s?{x:e.x,y:e.y+e.height,width:e.width,height:n-e.y-e.height+1}:c===o?{x:e.x,y:n,width:e.width,height:e.y-n}:c===a?{x:e.x+e.width,y:e.y,width:t-e.x-e.width+1,height:e.height}:{x:t,y:e.y,width:e.x-t,height:e.height}}function os(e,t,n,r,i,a,o,s){return e<=i+o&&i<=e+n&&t<=a+s&&a<=t+r}function ss(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function cs(e,t){let n=Math.min(e.x,t.x),r=Math.min(e.y,t.y);return{x:n,y:r,width:Math.max(e.x+e.width,t.x+t.width)-n,height:Math.max(e.y+e.height,t.y+t.height)-r}}function ls(e,t){return e.x<=t.x&&e.y<=t.y&&e.x+e.width>=t.x+t.width&&e.y+e.height>=t.y+t.height}function us(e,t,n,r){if(e.x>t||e.y>n||e.x<0&&e.y<0&&e.x+e.width>t&&e.y+e.height>n)return;if(e.x>=0&&e.y>=0&&e.x+e.width<=t&&e.y+e.height<=n)return e;let i=t+4,a=n+4,o=-4-e.x,s=e.x+e.width-i,c=-4-e.y,l=e.y+e.height-a,u=o>0?e.x+Math.floor(o/r)*r:e.x,d=s>0?e.x+e.width-Math.floor(s/r)*r:e.x+e.width,f=c>0?e.y+Math.floor(c/r)*r:e.y,p=l>0?e.y+e.height-Math.floor(l/r)*r:e.y+e.height;return{x:u,y:f,width:d-u,height:p-f}}function ds(e,t,n,r,i){let[a,o,s,c]=t,[l,u,d,f]=i,{x:p,y:m,width:h,height:g}=e,_=[];if(h<=0||g<=0)return _;let v=p+h,y=m+g,b=ps,C=m+g>c,w=p>=a&&pa&&v<=s||ps,T=m>=o&&mo&&y<=c||mc;if(w&&T){let e=Math.max(p,a),t=Math.max(m,o),n=Math.min(v,s),r=Math.min(y,c);_.push({rect:{x:e,y:t,width:n-e,height:r-t},clip:{x:l,y:u,width:d-l+1,height:f-u+1}})}if(b&&x){let e=p,t=m,n=Math.min(v,a),r=Math.min(y,o);_.push({rect:{x:e,y:t,width:n-e,height:r-t},clip:{x:0,y:0,width:l+1,height:u+1}})}if(x&&w){let e=Math.max(p,a),t=m,n=Math.min(v,s),r=Math.min(y,o);_.push({rect:{x:e,y:t,width:n-e,height:r-t},clip:{x:l,y:0,width:d-l+1,height:u+1}})}if(x&&S){let e=Math.max(p,s),t=m,r=v,i=Math.min(y,o);_.push({rect:{x:e,y:t,width:r-e,height:i-t},clip:{x:d,y:0,width:n-d+1,height:u+1}})}if(b&&T){let e=p,t=Math.max(m,o),n=Math.min(v,a),r=Math.min(y,c);_.push({rect:{x:e,y:t,width:n-e,height:r-t},clip:{x:0,y:u,width:l+1,height:f-u+1}})}if(S&&T){let e=Math.max(p,s),t=Math.max(m,o),r=v,i=Math.min(y,c);_.push({rect:{x:e,y:t,width:r-e,height:i-t},clip:{x:d,y:u,width:n-d+1,height:f-u+1}})}if(b&&C){let e=p,t=Math.max(m,c),n=Math.min(v,a),i=y;_.push({rect:{x:e,y:t,width:n-e,height:i-t},clip:{x:0,y:f,width:l+1,height:r-f+1}})}if(C&&w){let e=Math.max(p,a),t=Math.max(m,c),n=Math.min(v,s),i=y;_.push({rect:{x:e,y:t,width:n-e,height:i-t},clip:{x:l,y:f,width:d-l+1,height:r-f+1}})}if(S&&C){let e=Math.max(p,s),t=Math.max(m,c),i=v,a=y;_.push({rect:{x:e,y:t,width:i-e,height:a-t},clip:{x:d,y:f,width:n-d+1,height:r-f+1}})}return _}var fs={kind:W.Loading,allowOverlay:!1};function ps(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D,O,k,A,ee,te,ne,re){let j=y?.size??2**53-1,ie=performance.now(),M=k.baseFontFull;e.font=M;let ae={ctx:e},N=[0,0],oe=g>0?Pa(c,g,l):0,P,se,ce=es(v);return ns(t,s,a,o,i,(t,a,o,s,F)=>{let le=Math.max(0,s-a),ue=a+le,de=i+1,fe=t.width-le,pe=r-i-1;if(v.length>0){let e=!1;for(let t=0;t{e.save(),e.beginPath(),e.rect(ue,de,fe,pe),e.clip()},he=b.columns.hasIndex(t.sourceIndex),ge=d(t.group??``).overrideTheme,I=t.themeOverride===void 0&&ge===void 0?k:yo(k,ge,t.themeOverride),L=I.baseFontFull;L!==M&&(M=L,e.font=L),me();let _e;return ts(F,o,r,c,l,g,_,ce,(i,o,l,d,g)=>{if(o<0||(N[0]=t.sourceIndex,N[1]=o,y!==void 0&&!y.has(N)))return;if(v.length>0){let e=!1;for(let n=0;nF.span!==void 0&&e>=F.span[0]&&e<=F.span[1]);ve&&!m&&h?ye=0:ve&&h&&(ye=Math.max(ye,1)),be&&ye++,ve||(_&&ye++,he&&!g&&ye++);let xe=F.kind===W.Protected?R.bgCellMedium:R.bgCell,Se;if((d||xe!==k.bgCell)&&(Se=pa(xe,Se)),ye>0||ce){ce&&(Se=pa(R.bgHeader,Se));for(let e=0;ere&&!fe){let n=R.baseFontFull;n!==M&&(e.font=n,M=n),_e=ys(e,F,t.sourceIndex,o,Ce,we,le,i,ue,l,ye>0,R,Se??R.bgCell,C,w,B?.hoverAmount??0,E,O,ie,D,_e,A,ee,te,ne)}return z&&e.restore(),F.style===`faded`&&(e.globalAlpha=1),j--,de&&(e.restore(),_e?.deprep?.(ae),_e=void 0,me(),M=L,e.font=L),j<=0}),e.restore(),j<=0}),P}var ms=[0,0],hs={x:0,y:0,width:0,height:0},gs=[void 0,()=>void 0],_s=!1;function vs(){_s=!0}function ys(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w){let T,E;g!==void 0&&g[0][0]===n&&g[0][1]===r&&(T=g[1][0],E=g[1][1]);let D;ms[0]=n,ms[1]=r,hs.x=o,hs.y=s,hs.width=c,hs.height=l,gs[0]=S.getValue(ms),gs[1]=e=>S.setValue(ms,e),_s=!1;let O={ctx:e,theme:d,col:n,row:r,cell:t,rect:hs,highlighted:u,cellFillColor:f,hoverAmount:h,frameTime:v,hoverX:T,drawState:gs,hoverY:E,imageLoader:p,spriteManager:m,hyperWrapping:_,overrideCursor:T===void 0?void 0:w,requestAnimationFrame:vs},k=Ya(O,t.lastUpdated,v,b,i,a),A=C(t);if(A!==void 0){b?.renderer!==A&&(b?.deprep?.(O),b=void 0);let e=A.drawPrep?.(O,b);y!==void 0&&!rr(O.cell)?y(O,()=>A.draw(O,t)):A.draw(O,t),D=e===void 0?void 0:{deprep:e?.deprep,fillStyle:e?.fillStyle,font:e?.font,renderer:A}}return(k||_s)&&x?.(ms),D}function bs(e,t,n,r,i,a,o,s,c=-20,l=-20,u=32,d=`center`,f=`square`){let p=Math.floor(i+o/2),m=f===`circle`?1e4:t.roundingRadius??4,h=Zr(u,o,t.cellVerticalPadding),g=h/2,_=Xr(d,r,a,t.cellHorizontalPadding,h),v=Yr(_,p,h),y=Qr(r+c,i+l,v);switch(n){case!0:e.beginPath(),no(e,_-h/2,p-h/2,h,h,m),f===`circle`&&(g*=.8,h*=.8),e.fillStyle=s?t.accentColor:t.textMedium,e.fill(),e.beginPath(),e.moveTo(_-g+h/4.23,p-g+h/1.97),e.lineTo(_-g+h/2.42,p-g+h/1.44),e.lineTo(_-g+h/1.29,p-g+h/3.25),e.strokeStyle=t.bgCell,e.lineJoin=`round`,e.lineCap=`round`,e.lineWidth=1.9,e.stroke();break;case null:case!1:e.beginPath(),no(e,_-h/2+.5,p-h/2+.5,h-1,h-1,m),e.lineWidth=1,e.strokeStyle=y?t.textDark:t.textMedium,e.stroke();break;case void 0:e.beginPath(),no(e,_-h/2,p-h/2,h,h,m),e.fillStyle=y?t.textMedium:t.textLight,e.fill(),f===`circle`&&(g*=.8,h*=.8),e.beginPath(),e.moveTo(_-h/3,p),e.lineTo(_+h/3,p),e.strokeStyle=t.bgCell,e.lineCap=`round`,e.lineWidth=1.9,e.stroke();break;default:Gt(n)}}function xs(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v){let y=o+s;if(y<=0)return;e.fillStyle=d.bgHeader,e.fillRect(0,0,i,y);let[b,x]=r?.[0]??[];e.font=d.headerFontFull,ns(t,0,a,0,y,(t,r,i,a)=>{if(g!==void 0&&!g.has([t.sourceIndex,-1]))return;let m=Math.max(0,a-r);e.save(),e.beginPath(),e.rect(r+m,s,t.width-m,o),e.clip();let y=h(t.group??``).overrideTheme,S=t.themeOverride===void 0&&y===void 0?d:yo(d,y,t.themeOverride);S.bgHeader!==d.bgHeader&&(e.fillStyle=S.bgHeader,e.fill()),S!==d&&(e.font=S.baseFontFull);let C=u.columns.hasIndex(t.sourceIndex),w=c!==void 0||l,T=!w&&x===-1&&b===t.sourceIndex,E=w?0:p.find(e=>e.item[0]===t.sourceIndex&&e.item[1]===-1)?.hoverAmount??0,D=u?.current!==void 0&&u.current.cell[0]===t.sourceIndex,O=C?S.accentColor:D?S.bgHeaderHasFocus:S.bgHeader,k=n?s:0,A=t.sourceIndex===0?0:1;C?(e.fillStyle=O,e.fillRect(r+A,k,t.width-A,o)):(D||E>0)&&(e.beginPath(),e.rect(r+A,k,t.width-A,o),D&&(e.fillStyle=S.bgHeaderHasFocus,e.fill()),E>0&&(e.globalAlpha=E,e.fillStyle=S.bgHeaderHovered,e.fill(),e.globalAlpha=1)),Ds(e,r,k,t.width,o,t,C,S,T,D,E,f,_,v),e.restore()}),n&&Ss(e,t,i,a,s,r,d,f,p,m,h,g)}function Ss(e,t,n,r,i,a,o,s,c,l,u,d){let[f,p]=a?.[0]??[],m=0;rs(t,n,r,i,(t,n,r,c,h,g)=>{if(d!==void 0&&!d.hasItemInRectangle({x:t[0],y:-2,width:t[1]-t[0]+1,height:1}))return;e.save(),e.beginPath(),e.rect(r,c,h,g),e.clip();let _=u(n),v=_?.overrideTheme===void 0?o:yo(o,_.overrideTheme),y=p===-2&&f!==void 0&&f>=t[0]&&f<=t[1],b=y?v.bgHeaderHovered:v.bgHeader;if(b!==o.bgHeader&&(e.fillStyle=b,e.fill()),e.fillStyle=v.textGroupHeader??v.textHeader,_!==void 0){let t=r;if(_.icon!==void 0&&(s.drawSprite(_.icon,`normal`,e,t+8,(i-20)/2,20,v),t+=26),e.fillText(_.name,t+8,i/2+Ga(e,o.headerFontFull)),_.actions!==void 0&&y){let t=Ts({x:r,y:c,width:h,height:g},_.actions);e.beginPath();let n=t[0].x-10,o=r+h-n;e.rect(n,0,o,i);let l=e.createLinearGradient(n,0,n+o,0),u=ua(b,0);l.addColorStop(0,u),l.addColorStop(10/o,b),l.addColorStop(1,b),e.fillStyle=l,e.fill(),e.globalAlpha=.6;let[d,f]=a?.[1]??[-1,-1];for(let n=0;n<_.actions.length;n++){let i=_.actions[n],a=t[n],o=ss(a,d+r,f);o&&(e.globalAlpha=1),s.drawSprite(i.icon,`normal`,e,a.x+a.width/2-10,a.y+a.height/2-10,20,v),o&&(e.globalAlpha=.6)}e.globalAlpha=1}}r!==0&&l(t[0])&&(e.beginPath(),e.moveTo(r+.5,0),e.lineTo(r+.5,i),e.strokeStyle=o.borderColor,e.lineWidth=1,e.stroke()),e.restore(),m=r+h}),e.beginPath(),e.moveTo(m+.5,0),e.lineTo(m+.5,i),e.moveTo(0,i+.5),e.lineTo(n,i+.5),e.strokeStyle=o.borderColor,e.lineWidth=1,e.stroke()}var Cs=30;function ws(e,t,n,r,i){return i?{x:e,y:t,width:Cs,height:Math.min(Cs,r)}:{x:e+n-Cs,y:Math.max(t,t+r/2-Cs/2),width:Cs,height:Math.min(Cs,r)}}function Ts(e,t){let n=[],r=e.x+e.width-26*t.length,i=e.y+e.height/2-13;for(let e=0;e35){let n=f?35:r-35,i=f?24.5:r-24.5,a=n/r,o=i/r,s=e.createLinearGradient(t,0,t+r,0),c=ua(h,0);s.addColorStop(+!!f,h),s.addColorStop(a,h),s.addColorStop(o,c),s.addColorStop(+!f,c),e.fillStyle=s}else e.fillStyle=h;if(f&&(e.textAlign=`right`),e.fillText(a.title,v,n+i/2+Ga(e,s.headerFontFull)),f&&(e.textAlign=`left`),g&&a.hasMenu===!0){if(a.menuIcon===void 0||a.menuIcon===$n.Triangle){e.beginPath();let t=p.x+p.width/2-5.5,n=p.y+p.height/2-3;io(e,[{x:t,y:n},{x:t+11,y:n},{x:t+5.5,y:n+6}],1),e.fillStyle=h,e.fill()}else if(a.menuIcon===$n.Dots)e.beginPath(),ro(e,p.x+p.width/2,p.y+p.height/2),e.fillStyle=h,e.fill();else{let t=p.x+(p.width-s.headerIconSize)/2,n=p.y+(p.height-s.headerIconSize)/2;u.drawSprite(a.menuIcon,`normal`,e,t,n,s.headerIconSize,s)}}}function Ds(e,t,n,r,i,a,o,s,c,l,u,d,f,p){let m=ri(a.title)===`rtl`,h=ws(t,n,r,i,m);f===void 0?Es(e,t,n,r,i,a,o,s,c,u,d,p,m,h):f({ctx:e,theme:s,rect:{x:t,y:n,width:r,height:i},column:a,columnIndex:a.sourceIndex,isSelected:o,hoverAmount:u,isHovered:c,hasSelectedCell:l,spriteManager:d,menuBounds:h},()=>Es(e,t,n,r,i,a,o,s,c,u,d,p,m,h))}var Os=o(((e,t)=>{var n=pn();t.exports=function(){try{var e=n(Object,`defineProperty`);return e({},``,{}),e}catch{}}()})),ks=o(((e,t)=>{var n=Os();function r(e,t,r){t==`__proto__`&&n?n(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}t.exports=r})),As=o(((e,t)=>{function n(e,t,n,r){for(var i=-1,a=e==null?0:e.length;++i{function n(e){return function(t,n,r){for(var i=-1,a=Object(t),o=r(t),s=o.length;s--;){var c=o[e?s:++i];if(n(a[c],c,a)===!1)break}return t}}t.exports=n})),Ms=o(((e,t)=>{t.exports=js()()})),Ns=o(((e,t)=>{function n(e,t){for(var n=-1,r=Array(e);++n{function n(){return!1}t.exports=n})),Fs=o(((e,t)=>{var n=Zt(),r=Ps(),i=typeof e==`object`&&e&&!e.nodeType&&e,a=i&&typeof t==`object`&&t&&!t.nodeType&&t,o=a&&a.exports===i?n.Buffer:void 0;t.exports=(o?o.isBuffer:void 0)||r})),Is=o(((e,t)=>{var n=tn(),r=Jn(),i=nn(),a=`[object Arguments]`,o=`[object Array]`,s=`[object Boolean]`,c=`[object Date]`,l=`[object Error]`,u=`[object Function]`,d=`[object Map]`,f=`[object Number]`,p=`[object Object]`,m=`[object RegExp]`,h=`[object Set]`,g=`[object String]`,_=`[object WeakMap]`,v=`[object ArrayBuffer]`,y=`[object DataView]`,b=`[object Float32Array]`,x=`[object Float64Array]`,S=`[object Int8Array]`,C=`[object Int16Array]`,w=`[object Int32Array]`,T=`[object Uint8Array]`,E=`[object Uint8ClampedArray]`,D=`[object Uint16Array]`,O=`[object Uint32Array]`,k={};k[b]=k[x]=k[S]=k[C]=k[w]=k[T]=k[E]=k[D]=k[O]=!0,k[a]=k[o]=k[v]=k[s]=k[y]=k[c]=k[l]=k[u]=k[d]=k[f]=k[p]=k[m]=k[h]=k[g]=k[_]=!1;function A(e){return i(e)&&r(e.length)&&!!k[n(e)]}t.exports=A})),Ls=o(((e,t)=>{function n(e){return function(t){return e(t)}}t.exports=n})),Rs=o(((e,t)=>{var n=U(),r=typeof e==`object`&&e&&!e.nodeType&&e,i=r&&typeof t==`object`&&t&&!t.nodeType&&t,a=i&&i.exports===r&&n.process;t.exports=function(){try{return i&&i.require&&i.require(`util`).types||a&&a.binding&&a.binding(`util`)}catch{}}()})),zs=o(((e,t)=>{var n=Is(),r=Ls(),i=Rs(),a=i&&i.isTypedArray;t.exports=a?r(a):n})),Bs=o(((e,t)=>{var n=Ns(),r=Kn(),i=Xt(),a=Fs(),o=qn(),s=zs(),c=Object.prototype.hasOwnProperty;function l(e,t){var l=i(e),u=!l&&r(e),d=!l&&!u&&a(e),f=!l&&!u&&!d&&s(e),p=l||u||d||f,m=p?n(e.length,String):[],h=m.length;for(var g in e)(t||c.call(e,g))&&!(p&&(g==`length`||d&&(g==`offset`||g==`parent`)||f&&(g==`buffer`||g==`byteLength`||g==`byteOffset`)||o(g,h)))&&m.push(g);return m}t.exports=l})),Vs=o(((e,t)=>{var n=Object.prototype;function r(e){var t=e&&e.constructor;return e===(typeof t==`function`&&t.prototype||n)}t.exports=r})),Hs=o(((e,t)=>{function n(e,t){return function(n){return e(t(n))}}t.exports=n})),Us=o(((e,t)=>{t.exports=Hs()(Object.keys,Object)})),Ws=o(((e,t)=>{var n=Vs(),r=Us(),i=Object.prototype.hasOwnProperty;function a(e){if(!n(e))return r(e);var t=[];for(var a in Object(e))i.call(e,a)&&a!=`constructor`&&t.push(a);return t}t.exports=a})),Gs=o(((e,t)=>{var n=Bs(),r=Ws(),i=qo();function a(e){return i(e)?n(e):r(e)}t.exports=a})),Ks=o(((e,t)=>{var n=Ms(),r=Gs();function i(e,t){return e&&n(e,t,r)}t.exports=i})),qs=o(((e,t)=>{var n=qo();function r(e,t){return function(r,i){if(r==null)return r;if(!n(r))return e(r,i);for(var a=r.length,o=t?a:-1,s=Object(r);(t?o--:++o{var n=Ks();t.exports=qs()(n)})),Ys=o(((e,t)=>{var n=Js();function r(e,t,r,i){return n(e,function(e,n,a){t(i,e,r(e),a)}),i}t.exports=r})),Xs=o(((e,t)=>{var n=On();function r(){this.__data__=new n,this.size=0}t.exports=r})),Zs=o(((e,t)=>{function n(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}t.exports=n})),Qs=o(((e,t)=>{function n(e){return this.__data__.get(e)}t.exports=n})),$s=o(((e,t)=>{function n(e){return this.__data__.has(e)}t.exports=n})),ec=o(((e,t)=>{var n=On(),r=kn(),i=Ln(),a=200;function o(e,t){var o=this.__data__;if(o instanceof n){var s=o.__data__;if(!r||s.length{var n=On(),r=Xs(),i=Zs(),a=Qs(),o=$s(),s=ec();function c(e){var t=this.__data__=new n(e);this.size=t.size}c.prototype.clear=r,c.prototype.delete=i,c.prototype.get=a,c.prototype.has=o,c.prototype.set=s,t.exports=c})),nc=o(((e,t)=>{function n(e,t){for(var n=-1,r=e==null?0:e.length;++n{var n=Oo(),r=nc(),i=Fo(),a=1,o=2;function s(e,t,s,c,l,u){var d=s&a,f=e.length,p=t.length;if(f!=p&&!(d&&p>f))return!1;var m=u.get(e),h=u.get(t);if(m&&h)return m==t&&h==e;var g=-1,_=!0,v=s&o?new n:void 0;for(u.set(e,t),u.set(t,e);++g{t.exports=Zt().Uint8Array})),ac=o(((e,t)=>{function n(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}t.exports=n})),oc=o(((e,t)=>{var n=Qt(),r=ic(),i=Sn(),a=rc(),o=ac(),s=Ro(),c=1,l=2,u=`[object Boolean]`,d=`[object Date]`,f=`[object Error]`,p=`[object Map]`,m=`[object Number]`,h=`[object RegExp]`,g=`[object Set]`,_=`[object String]`,v=`[object Symbol]`,y=`[object ArrayBuffer]`,b=`[object DataView]`,x=n?n.prototype:void 0,S=x?x.valueOf:void 0;function C(e,t,n,x,C,w,T){switch(n){case b:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case y:return!(e.byteLength!=t.byteLength||!w(new r(e),new r(t)));case u:case d:case m:return i(+e,+t);case f:return e.name==t.name&&e.message==t.message;case h:case _:return e==t+``;case p:var E=o;case g:var D=x&c;if(E||=s,e.size!=t.size&&!D)return!1;var O=T.get(e);if(O)return O==t;x|=l,T.set(e,t);var k=a(E(e),E(t),x,C,w,T);return T.delete(e),k;case v:if(S)return S.call(e)==S.call(t)}return!1}t.exports=C})),sc=o(((e,t)=>{var n=Ho(),r=Xt();function i(e,t,i){var a=t(e);return r(e)?a:n(a,i(e))}t.exports=i})),cc=o(((e,t)=>{function n(e,t){for(var n=-1,r=e==null?0:e.length,i=0,a=[];++n{function n(){return[]}t.exports=n})),uc=o(((e,t)=>{var n=cc(),r=lc(),i=Object.prototype.propertyIsEnumerable,a=Object.getOwnPropertySymbols;t.exports=a?function(e){return e==null?[]:(e=Object(e),n(a(e),function(t){return i.call(e,t)}))}:r})),dc=o(((e,t)=>{var n=sc(),r=uc(),i=Gs();function a(e){return n(e,i,r)}t.exports=a})),fc=o(((e,t)=>{var n=dc(),r=1,i=Object.prototype.hasOwnProperty;function a(e,t,a,o,s,c){var l=a&r,u=n(e),d=u.length;if(d!=n(t).length&&!l)return!1;for(var f=d;f--;){var p=u[f];if(!(l?p in t:i.call(t,p)))return!1}var m=c.get(e),h=c.get(t);if(m&&h)return m==t&&h==e;var g=!0;c.set(e,t),c.set(t,e);for(var _=l;++f{t.exports=pn()(Zt(),`DataView`)})),mc=o(((e,t)=>{t.exports=pn()(Zt(),`Promise`)})),hc=o(((e,t)=>{t.exports=pn()(Zt(),`WeakMap`)})),J=o(((e,t)=>{var n=pc(),r=kn(),i=mc(),a=Io(),o=hc(),s=tn(),c=un(),l=`[object Map]`,u=`[object Object]`,d=`[object Promise]`,f=`[object Set]`,p=`[object WeakMap]`,m=`[object DataView]`,h=c(n),g=c(r),_=c(i),v=c(a),y=c(o),b=s;(n&&b(new n(new ArrayBuffer(1)))!=m||r&&b(new r)!=l||i&&b(i.resolve())!=d||a&&b(new a)!=f||o&&b(new o)!=p)&&(b=function(e){var t=s(e),n=t==u?e.constructor:void 0,r=n?c(n):``;if(r)switch(r){case h:return m;case g:return l;case _:return d;case v:return f;case y:return p}return t}),t.exports=b})),gc=o(((e,t)=>{var n=tc(),r=rc(),i=oc(),a=fc(),o=J(),s=Xt(),c=Fs(),l=zs(),u=1,d=`[object Arguments]`,f=`[object Array]`,p=`[object Object]`,m=Object.prototype.hasOwnProperty;function h(e,t,h,g,_,v){var y=s(e),b=s(t),x=y?f:o(e),S=b?f:o(t);x=x==d?p:x,S=S==d?p:S;var C=x==p,w=S==p,T=x==S;if(T&&c(e)){if(!c(t))return!1;y=!0,C=!1}if(T&&!C)return v||=new n,y||l(e)?r(e,t,h,g,_,v):i(e,t,x,h,g,_,v);if(!(h&u)){var E=C&&m.call(e,`__wrapped__`),D=w&&m.call(t,`__wrapped__`);if(E||D){var O=E?e.value():e,k=D?t.value():t;return v||=new n,_(O,k,h,g,v)}}return T?(v||=new n,a(e,t,h,g,_,v)):!1}t.exports=h})),_c=o(((e,t)=>{var n=gc(),r=nn();function i(e,t,a,o,s){return e===t?!0:e==null||t==null||!r(e)&&!r(t)?e!==e&&t!==t:n(e,t,a,o,i,s)}t.exports=i})),vc=o(((e,t)=>{var n=tc(),r=_c(),i=1,a=2;function o(e,t,o,s){var c=o.length,l=c,u=!s;if(e==null)return!l;for(e=Object(e);c--;){var d=o[c];if(u&&d[2]?d[1]!==e[d[0]]:!(d[0]in e))return!1}for(;++c{var n=on();function r(e){return e===e&&!n(e)}t.exports=r})),bc=o(((e,t)=>{var n=yc(),r=Gs();function i(e){for(var t=r(e),i=t.length;i--;){var a=t[i],o=e[a];t[i]=[a,o,n(o)]}return t}t.exports=i})),xc=o(((e,t)=>{function n(e,t){return function(n){return n!=null&&n[e]===t&&(t!==void 0||e in Object(n))}}t.exports=n})),Sc=o(((e,t)=>{var n=vc(),r=bc(),i=xc();function a(e){var t=r(e);return t.length==1&&t[0][2]?i(t[0][0],t[0][1]):function(r){return r===e||n(r,e,t)}}t.exports=a})),Cc=o(((e,t)=>{var n=Wn(),r=Yn();function i(e,t){t=n(t,e);for(var i=0,a=t.length;e!=null&&i{var n=Cc();function r(e,t,r){var i=e==null?void 0:n(e,t);return i===void 0?r:i}t.exports=r})),Tc=o(((e,t)=>{function n(e,t){return e!=null&&t in Object(e)}t.exports=n})),Ec=o(((e,t)=>{var n=Tc(),r=Xn();function i(e,t){return e!=null&&r(e,t,n)}t.exports=i})),Dc=o(((e,t)=>{var n=_c(),r=wc(),i=Ec(),a=an(),o=yc(),s=xc(),c=Yn(),l=1,u=2;function d(e,t){return a(e)&&o(t)?s(c(e),t):function(a){var o=r(a,e);return o===void 0&&o===t?i(a,e):n(t,o,l|u)}}t.exports=d})),Oc=o(((e,t)=>{function n(e){return e}t.exports=n})),kc=o(((e,t)=>{function n(e){return function(t){return t?.[e]}}t.exports=n})),Ac=o(((e,t)=>{var n=Cc();function r(e){return function(t){return n(t,e)}}t.exports=r})),jc=o(((e,t)=>{var n=kc(),r=Ac(),i=an(),a=Yn();function o(e){return i(e)?n(a(e)):r(e)}t.exports=o})),Mc=o(((e,t)=>{var n=Sc(),r=Dc(),i=Oc(),a=Xt(),o=jc();function s(e){return typeof e==`function`?e:e==null?i:typeof e==`object`?a(e)?r(e[0],e[1]):n(e):o(e)}t.exports=s})),Nc=o(((e,t)=>{var n=As(),r=Ys(),i=Mc(),a=Xt();function o(e,t){return function(o,s){var c=a(o)?n:r,l=t?t():{};return c(o,e,i(s,2),l)}}t.exports=o})),Pc=c(o(((e,t)=>{var n=ks(),r=Nc(),i=Object.prototype.hasOwnProperty;t.exports=r(function(e,t,r){i.call(e,r)?e[r].push(t):n(e,r,[t])})}))(),1);function Fc(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v){if(_!==void 0||t[t.length-1]!==n[t.length-1])return;let y=es(g);ns(t,c,o,s,a,(n,o,s,c,_)=>{if(n!==t[t.length-1])return;o+=n.width;let b=Math.max(o,c);b>r||(e.save(),e.beginPath(),e.rect(b,a+1,1e4,i-a-1),e.clip(),ts(_,s,i,l,u,m,h,y,(t,n,r,i)=>{if(!i&&g.length>0&&!g.some(e=>os(o,t,1e4,r,e.x,e.y,e.width,e.height)))return;let a=f.hasIndex(n),s=p.hasIndex(n);e.beginPath();let c=d?.(n),l=c===void 0?v:yo(v,c);l.bgCell!==v.bgCell&&(e.fillStyle=l.bgCell,e.fillRect(o,t,1e4,r)),s&&(e.fillStyle=l.bgHeader,e.fillRect(o,t,1e4,r)),a&&(e.fillStyle=l.accentLight,e.fillRect(o,t,1e4,r))}),e.restore())})}function Ic(e,t,n,r,i,a,o,s,c){let l=!1;for(let e of t)if(!e.sticky){l=o(e.sourceIndex);break}let u=c.horizontalBorderColor??c.borderColor,d=c.borderColor,f=l?Na(t):0,p;if(f!==0&&(p=fa(d,c.bgCell),e.beginPath(),e.moveTo(f+.5,0),e.lineTo(f+.5,r),e.strokeStyle=p,e.stroke()),i>0){let t=d===u&&p!==void 0?p:fa(u,c.bgCell),o=Pa(a,i,s);e.beginPath(),e.moveTo(0,r-o+.5),e.lineTo(n,r-o+.5),e.strokeStyle=t,e.stroke()}}var Lc=(e,t,n)=>{let r=0,i=t,a=0,o=n;if(e!==void 0&&e.length>0){r=2**53-1,a=2**53-1,i=-(2**53-1),o=-(2**53-1);for(let t of e)r=Math.min(r,t.x-1),i=Math.max(i,t.x+t.width+1),a=Math.min(a,t.y-1),o=Math.max(o,t.y+t.height+1)}return{minX:r,maxX:i,minY:a,maxY:o}};function Rc(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m){let h=m.bgCell,{minX:g,maxX:_,minY:v,maxY:y}=Lc(s,a,o),b=[],x=o-Pa(p,f,l),S=c,C=n,w=0;for(;S+i=v&&e<=y-1){let n=u?.(C)?.bgCell;n!==void 0&&n!==h&&C>=p-f&&b.push({x:g,y:e,w:_-g,h:t,color:n})}S+=t,C0)for(let e=0;e=g&&i<=_&&d(e+1)&&b.push({x:i,y:w,w:n.width,h:E,color:a}),T+=n.width}if(b.length===0)return;let D;e.beginPath();for(let t=b.length-1;t>=0;t--){let n=b[t];D===void 0?D=n.color:n.color!==D&&(e.fillStyle=D,e.fill(),e.beginPath(),D=n.color),e.rect(n.x,n.y,n.w,n.h)}D!==void 0&&(e.fillStyle=D,e.fill()),e.beginPath()}function zc(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_=!1){if(c!==void 0){e.beginPath(),e.save(),e.rect(0,0,a,o);for(let t of c)e.rect(t.x+1,t.y+1,t.width-1,t.height-1);e.clip(`evenodd`)}let v=g.horizontalBorderColor??g.borderColor,y=g.borderColor,{minX:b,maxX:x,minY:S,maxY:C}=Lc(s,a,o),w=[];e.beginPath();let T=.5;for(let e=0;e=b&&i<=x&&p(e+1)&&w.push({x1:i,y1:Math.max(l,S),x2:i,y2:Math.min(o,C),color:y})}let E=o+.5;for(let e=h-m;e=S&&n<=C-1){let e=f?.(t);w.push({x1:b,y1:n,x2:x,y2:n,color:e?.horizontalBorderColor??e?.borderColor??v})}e+=d(t),t++}}let D=(0,Pc.default)(w,e=>e.color);for(let t of Object.keys(D)){e.strokeStyle=t;for(let n of D[t])e.moveTo(n.x1,n.y1),e.lineTo(n.x2,n.y2);e.stroke(),e.beginPath()}c!==void 0&&e.restore()}function Bc(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v){let y=[];e.imageSmoothingEnabled=!1;let b=Math.min(i.cellYOffset,o),x=Math.max(i.cellYOffset,o),S=0;if(typeof _==`number`)S+=(x-b)*_;else for(let e=b;ei.cellYOffset&&(S=-S),S+=c-i.translateY;let C=Math.min(i.cellXOffset,a),w=Math.max(i.cellXOffset,a),T=0;for(let e=C;ei.cellXOffset&&(T=-T),T+=s-i.translateX;let E=Na(g);if(T!==0&&S!==0)return{regions:[]};let D=l>0?Pa(f,l,_):0,O=u-E-Math.abs(T),k=d-p-D-Math.abs(S)-1;if(O>150&&k>150){let i={sx:0,sy:0,sw:u*m,sh:d*m,dx:0,dy:0,dw:u*m,dh:d*m};if(S>0?(i.sy=(p+1)*m,i.sh=k*m,i.dy=(S+p+1)*m,i.dh=k*m,y.push({x:0,y:p,width:u,height:S+1})):S<0&&(i.sy=(-S+p+1)*m,i.sh=k*m,i.dy=(p+1)*m,i.dh=k*m,y.push({x:0,y:d+S-D,width:u,height:-S+D})),T>0?(i.sx=E*m,i.sw=O*m,i.dx=(T+E)*m,i.dw=O*m,y.push({x:E-1,y:0,width:T+2,height:d})):T<0&&(i.sx=(E-T)*m,i.sw=O*m,i.dx=E*m,i.dw=O*m,y.push({x:u+T,y:0,width:-T,height:d})),e.setTransform(1,0,0,1,0,0),v){if(E>0&&T!==0&&S===0&&(r===void 0||n?.[1]!==!1)){let n=E*m,r=d*m;e.drawImage(t,0,0,n,r,0,0,n,r)}if(D>0&&T===0&&S!==0&&(r===void 0||n?.[0]!==!1)){let n=(d-D)*m,r=u*m,i=D*m;e.drawImage(t,0,n,r,i,0,n,r,i)}}e.drawImage(t,i.sx,i.sy,i.sw,i.sh,i.dx,i.dy,i.dw,i.dh),e.scale(m,m)}return e.imageSmoothingEnabled=!0,{regions:y}}function Vc(e,t,n,r,i,a,o,s,c,l){let u=[];return t!==e.cellXOffset||n!==e.cellYOffset||r!==e.translateX||i!==e.translateY||ns(c,n,r,i,s,(e,t,n,r)=>{if(e.sourceIndex===l){let e=Math.max(t,r)+1;return u.push({x:e,y:0,width:a-e,height:o}),!0}}),u}function Hc(e,t){if(t===void 0||e.width!==t.width||e.height!==t.height||e.theme!==t.theme||e.headerHeight!==t.headerHeight||e.rowHeight!==t.rowHeight||e.rows!==t.rows||e.freezeColumns!==t.freezeColumns||e.getRowThemeOverride!==t.getRowThemeOverride||e.isFocused!==t.isFocused||e.isResizing!==t.isResizing||e.verticalBorder!==t.verticalBorder||e.getCellContent!==t.getCellContent||e.highlightRegions!==t.highlightRegions||e.selection!==t.selection||e.dragAndDropState!==t.dragAndDropState||e.prelightCells!==t.prelightCells||e.touchMode!==t.touchMode||e.maxScaleFactor!==t.maxScaleFactor)return!1;if(e.mappedColumns!==t.mappedColumns){if(e.mappedColumns.length>100||e.mappedColumns.length!==t.mappedColumns.length)return!1;let n;for(let r=0;re.style!==`no-outline`);if(g===void 0||g.length===0)return;let _=Na(s),v=Pa(p,f,d),y=[c,0,s.length,p-f],b=[_,0,t,n-v],x=g.map(e=>{let m=e.range,h=e.style??`dashed`;return ds(m,y,t,n,b).map(m=>{let g=m.rect,_=ao(g.x,g.y,t,n,u,l+u,r,i,a,o,p,c,f,s,d),v=g.width===1&&g.height===1?_:ao(g.x+g.width-1,g.y+g.height-1,t,n,u,l+u,r,i,a,o,p,c,f,s,d);return g.x+g.width>=s.length&&--v.width,g.y+g.height>=p&&--v.height,{color:e.color,style:h,clip:m.clip,rect:us({x:_.x,y:_.y,width:v.x+v.width-_.x,height:v.y+v.height-_.y},t,n,8)}})}),S=()=>{e.lineWidth=1;let r=!1;for(let i of x)for(let a of i)if(a?.rect!==void 0&&os(0,0,t,n,a.rect.x,a.rect.y,a.rect.width,a.rect.height)){let t=r,n=!ls(a.clip,a.rect);n&&(e.save(),e.rect(a.clip.x,a.clip.y,a.clip.width,a.clip.height),e.clip()),a.style===`dashed`&&!r?(e.setLineDash([5,3]),r=!0):(a.style===`solid`||a.style===`solid-outline`)&&r&&(e.setLineDash([]),r=!1),e.strokeStyle=a.style===`solid-outline`?pa(pa(a.color,h.borderColor),h.bgCell):ua(a.color,1),e.strokeRect(a.rect.x+.5,a.rect.y+.5,a.rect.width-1,a.rect.height-1),n&&(e.restore(),r=t)}r&&e.setLineDash([])};return S(),S}function Wc(e,t,n,r,i){e.beginPath(),e.moveTo(t,n),e.lineTo(t,r),e.lineWidth=2,e.strokeStyle=i,e.stroke(),e.globalAlpha=1}function Gc(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g){if(u.current===void 0)return;let _=u.current.range,v=u.current.cell,y=[_.x+_.width-1,_.y+_.height-1];if(v[1]>=g&&y[1]>=g||!o.some(e=>e.sourceIndex===v[0]||e.sourceIndex===y[0]))return;let[b,x]=u.current.cell,S=f(u.current.cell),C=S.span??[b,b],w=x>=g-p,T=p>0&&!w?Pa(g,p,d)-1:0,E=y[1],D;if(ns(o,r,i,a,l,(r,i,a,o,l)=>{if(r.sticky&&b>r.sourceIndex)return;let u=r.sourceIndexC[1],_=r.sourceIndex===y[0];if(_||!u&&!f)return ts(l,a,n,g,d,p,m,void 0,(a,l,u)=>{if(l!==x&&l!==E)return;let d=i,f=r.width;if(S.span!==void 0){let e=is(S.span,i,a,r.width,u,r,s),t=r.sticky?e[0]:e[1];t!==void 0&&(d=t.x,f=t.width)}return l===E&&_&&h&&(D=()=>{o>d&&!r.sticky&&(e.beginPath(),e.rect(o,0,t-o,n),e.clip()),e.beginPath(),e.rect(d+f-4,a+u-4,4,4),e.fillStyle=r.themeOverride?.accentColor??c.accentColor,e.fill()}),D!==void 0}),D!==void 0}),D===void 0)return;let O=()=>{e.save(),e.beginPath(),e.rect(0,l,t,n-l-T),e.clip(),D?.(),e.restore()};return O(),O}function Kc(e,t,n,r,i,a,o,s,c){c!==void 0&&c.size!==0&&(e.beginPath(),rs(t,n,a,r,(t,n,r,i,a,o)=>{c.hasItemInRectangle({x:t[0],y:-2,width:t[1]-t[0]+1,height:1})&&e.rect(r,i,a,o)}),ns(t,s,a,o,i,(t,n,a,o)=>{let s=Math.max(0,o-n),l=n+s+1,u=t.width-s-1;c.has([t.sourceIndex,-1])&&e.rect(l,r,u,i-r)}),e.clip())}function qc(e,t,n,r,i,a,o,s,c,l){let u=0;return ns(e,a,r,i,n,(e,n,r,i,a)=>(ts(a,r,t,o,s,c,l,void 0,(e,t,n,r)=>{r||(u=Math.max(t,u))}),!0)),u}function Jc(e,t){let{canvasCtx:n,headerCanvasCtx:r,width:i,height:a,cellXOffset:o,cellYOffset:s,translateX:c,translateY:l,mappedColumns:u,enableGroups:d,freezeColumns:f,dragAndDropState:p,theme:m,drawFocus:h,headerHeight:g,groupHeaderHeight:_,disabledRows:v,rowHeight:y,verticalBorder:b,overrideCursor:x,isResizing:S,selection:C,fillHandle:w,freezeTrailingRows:T,rows:E,getCellContent:D,getGroupDetails:O,getRowThemeOverride:k,isFocused:A,drawHeaderCallback:ee,prelightCells:te,drawCellCallback:ne,highlightRegions:re,resizeCol:j,imageLoader:ie,lastBlitData:M,hoverValues:ae,hyperWrapping:N,hoverInfo:oe,spriteManager:P,maxScaleFactor:se,hasAppendRow:ce,touchMode:F,enqueue:le,renderStateProvider:ue,getCellRenderer:de,renderStrategy:fe,bufferACtx:pe,bufferBCtx:me,damage:he,minimumCellWidth:ge}=e;if(i===0||a===0)return;let I=fe===`double-buffer`,L=Math.min(se,Math.ceil(window.devicePixelRatio??1)),_e=fe!==`direct`&&Hc(e,t),R=n.canvas;(R.width!==i*L||R.height!==a*L)&&(R.width=i*L,R.height=a*L,R.style.width=i+`px`,R.style.height=a+`px`);let ve=r.canvas,ye=d?_+g:g,be=ye+1;(ve.width!==i*L||ve.height!==be*L)&&(ve.width=i*L,ve.height=be*L,ve.style.width=i+`px`,ve.style.height=be+`px`);let xe=pe.canvas,Se=me.canvas;I&&(xe.width!==i*L||xe.height!==a*L)&&(xe.width=i*L,xe.height=a*L,M.current!==void 0&&(M.current.aBufferScroll=void 0)),I&&(Se.width!==i*L||Se.height!==a*L)&&(Se.width=i*L,Se.height=a*L,M.current!==void 0&&(M.current.bBufferScroll=void 0));let z=M.current;if(_e===!0&&o===z?.cellXOffset&&s===z?.cellYOffset&&c===z?.translateX&&l===z?.translateY)return;let Ce=null;I&&(Ce=n);let we=r,B;B=I?he===void 0?z?.lastBuffer===`b`?pe:me:z?.lastBuffer===`b`?me:pe:n;let Te=B.canvas,Ee=I?Te===xe?Se:xe:R,De=typeof y==`number`?()=>y:y;we.save(),B.save(),we.beginPath(),B.beginPath(),we.textBaseline=`middle`,B.textBaseline=`middle`,L!==1&&(we.scale(L,L),B.scale(L,L));let Oe=Fa(u,o,i,p,c),ke=[],Ae=h&&C.current?.cell[1]===s&&l===0,je=!1;if(re!==void 0){for(let e of re)if(e.style!==`no-outline`&&e.range.y===s&&l===0){je=!0;break}}let Me=()=>{xs(we,Oe,d,oe,i,c,g,_,p,S,C,m,P,ae,b,O,he,ee,F),zc(we,Oe,s,c,l,i,a,void 0,void 0,_,ye,De,k,b,T,E,m,!0),we.beginPath(),we.moveTo(0,be-.5),we.lineTo(i,be-.5),we.strokeStyle=pa(m.headerBottomBorderColor??m.horizontalBorderColor??m.borderColor,m.bgHeader),we.stroke(),je&&Uc(we,i,a,o,s,c,l,u,f,g,_,y,T,E,re,m),Ae&&Gc(we,i,a,s,c,l,Oe,u,m,ye,C,De,D,T,ce,w,E)};if(he!==void 0){let e=Oe[Oe.length-1].sourceIndex+1,t=he.hasItemInRegion([{x:o,y:-2,width:e,height:2},{x:o,y:s,width:e,height:300},{x:0,y:s,width:f,height:300},{x:0,y:-2,width:f,height:2},{x:o,y:E-T,width:e,height:T,when:T>0}]),n=e=>{ps(e,Oe,u,a,ye,c,l,s,E,De,D,O,k,v,A,h,T,ce,ke,he,C,te,re,ie,P,ae,oe,ne,N,m,le,ue,de,x,ge);let t=C.current;w&&h&&t!==void 0&&he.has(ka(t.range))&&Gc(e,i,a,s,c,l,Oe,u,m,ye,C,De,D,T,ce,w,E)};t&&(n(B),Ce!==null&&(Ce.save(),Ce.scale(L,L),Ce.textBaseline=`middle`,n(Ce),Ce.restore()),he.hasHeader()&&(Kc(we,Oe,i,_,ye,c,l,s,he),Me())),B.restore(),we.restore();return}if((_e!==!0||o!==z?.cellXOffset||c!==z?.translateX||Ae!==z?.mustDrawFocusOnHeader||je!==z?.mustDrawHighlightRingsOnHeader)&&Me(),_e===!0){Wt(Ee!==void 0&&z!==void 0);let{regions:e}=Bc(B,Ee,Ee===xe?z.aBufferScroll:z.bBufferScroll,Ee===xe?z.bBufferScroll:z.aBufferScroll,z,o,s,c,l,T,i,a,E,ye,L,u,Oe,y,I);ke=e}else _e!==!1&&(Wt(z!==void 0),ke=Vc(z,o,s,c,l,i,a,ye,Oe,_e));Ic(B,Oe,i,a,T,E,b,De,m);let Ne=Uc(B,i,a,o,s,c,l,u,f,g,_,y,T,E,re,m),Pe=h?Gc(B,i,a,s,c,l,Oe,u,m,ye,C,De,D,T,ce,w,E):void 0;if(B.fillStyle=m.bgCell,ke.length>0){B.beginPath();for(let e of ke)B.rect(e.x,e.y,e.width,e.height);B.clip(),B.fill(),B.beginPath()}else B.fillRect(0,0,i,a);let Fe=ps(B,Oe,u,a,ye,c,l,s,E,De,D,O,k,v,A,h,T,ce,ke,he,C,te,re,ie,P,ae,oe,ne,N,m,le,ue,de,x,ge);Fc(B,Oe,u,i,a,ye,c,l,s,E,De,k,C.rows,v,T,ce,ke,he,m),Rc(B,Oe,s,c,l,i,a,ke,ye,De,k,b,T,E,m),zc(B,Oe,s,c,l,i,a,ke,Fe,_,ye,De,k,b,T,E,m),Ne?.(),Pe?.(),S&&ns(Oe,0,c,0,ye,(e,t)=>e.sourceIndex===j&&(Wc(we,t+e.width,0,ye+1,pa(m.resizeIndicatorColor??m.accentLight,m.bgHeader)),Wc(B,t+e.width,ye,a,pa(m.resizeIndicatorColor??m.accentLight,m.bgCell)),!0)),Ce!==null&&(Ce.fillStyle=m.bgCell,Ce.fillRect(0,0,i,a),Ce.drawImage(B.canvas,0,0));let Ie=qc(Oe,a,ye,c,l,s,E,De,T,ce);ie?.setWindow({x:o,y:s,width:Oe.length,height:Ie-s},f,Array.from({length:T},(e,t)=>E-1-t));let Le=z!==void 0&&(o!==z.cellXOffset||c!==z.translateX),Re=z!==void 0&&(s!==z.cellYOffset||l!==z.translateY);M.current={cellXOffset:o,cellYOffset:s,translateX:c,translateY:l,mustDrawFocusOnHeader:Ae,mustDrawHighlightRingsOnHeader:je,lastBuffer:I?Te===xe?`a`:`b`:void 0,aBufferScroll:Te===xe?[Le,Re]:z?.aBufferScroll,bBufferScroll:Te===Se?[Le,Re]:z?.bBufferScroll},B.restore(),we.restore()}var Yc=c(To(),1),Xc=80;function Zc(e){let t=e-1;return t*t*t+1}var Qc=class{callback;constructor(e){this.callback=e}currentHoveredItem=void 0;leavingItems=[];lastAnimationTime;addToLeavingItems=e=>{this.leavingItems.some(t=>Oa(t.item,e.item))||this.leavingItems.push(e)};removeFromLeavingItems=e=>{let t=this.leavingItems.find(t=>Oa(t.item,e));return this.leavingItems=this.leavingItems.filter(e=>e!==t),t?.hoverAmount??0};cleanUpLeavingElements=()=>{this.leavingItems=this.leavingItems.filter(e=>e.hoverAmount>0)};shouldStep=()=>{let e=this.leavingItems.length>0,t=this.currentHoveredItem!==void 0&&this.currentHoveredItem.hoverAmount<1;return e||t};getAnimatingItems=()=>this.currentHoveredItem===void 0?this.leavingItems.map(e=>({...e,hoverAmount:Zc(e.hoverAmount)})):[...this.leavingItems,this.currentHoveredItem];step=e=>{if(this.lastAnimationTime===void 0)this.lastAnimationTime=e;else{let t=(e-this.lastAnimationTime)/Xc;for(let e of this.leavingItems)e.hoverAmount=(0,Yc.default)(e.hoverAmount-t,0,1);this.currentHoveredItem!==void 0&&(this.currentHoveredItem.hoverAmount=(0,Yc.default)(this.currentHoveredItem.hoverAmount+t,0,1));let n=this.getAnimatingItems();this.callback(n),this.cleanUpLeavingElements()}this.shouldStep()?(this.lastAnimationTime=e,window.requestAnimationFrame(this.step)):this.lastAnimationTime=void 0};setHovered=e=>{if(!Oa(this.currentHoveredItem?.item,e)){if(this.currentHoveredItem!==void 0&&this.addToLeavingItems(this.currentHoveredItem),e!==void 0){let t=this.removeFromLeavingItems(e);this.currentHoveredItem={item:e,hoverAmount:t}}else this.currentHoveredItem=void 0;this.lastAnimationTime===void 0&&window.requestAnimationFrame(this.step)}}},$c=class{fn;val;constructor(e){this.fn=e}get value(){return this.val??=this.fn()}};function el(e){return new $c(e)}var tl=el(()=>window.navigator.userAgent.includes(`Firefox`)),nl=el(()=>window.navigator.userAgent.includes(`Mac OS`)&&window.navigator.userAgent.includes(`Safari`)&&!window.navigator.userAgent.includes(`Chrome`)),rl=el(()=>window.navigator.platform.toLowerCase().startsWith(`mac`));function il(e){let t=g.useRef([]),n=g.useRef(0),r=g.useRef(e);r.current=e;let i=g.useCallback(()=>{let e=()=>window.requestAnimationFrame(i),i=()=>{let e=t.current.map(uo);t.current=[],r.current(new mo(e)),t.current.length>0?n.current++:n.current=0};window.requestAnimationFrame(n.current>600?e:i)},[]);return g.useCallback(e=>{t.current.length===0&&i();let n=so(e[0],e[1]);t.current.includes(n)||t.current.push(n)},[i])}var al=`header`,ol=`group-header`,sl=`out-of-bounds`,cl;(function(e){e[e.Start=-2]=`Start`,e[e.StartPadding=-1]=`StartPadding`,e[e.Center=0]=`Center`,e[e.EndPadding=1]=`EndPadding`,e[e.End=2]=`End`})(cl||={});function ll(e,t){return e===t?!0:e?.kind===`out-of-bounds`?e?.kind===t?.kind&&e?.location[0]===t?.location[0]&&e?.location[1]===t?.location[1]&&e?.region[0]===t?.region[0]&&e?.region[1]===t?.region[1]:e?.kind===t?.kind&&e?.location[0]===t?.location[0]&&e?.location[1]===t?.location[1]}var ul=c(Zo(),1),dl=6,fl=(e,t)=>e.kind===W.Custom?e.copyData:(t?.(e))?.getAccessibilityString(e)??``,pl=g.memo(g.forwardRef((e,t)=>{let{width:n,height:r,accessibilityHeight:i,columns:a,cellXOffset:o,cellYOffset:s,headerHeight:c,fillHandle:l=!1,groupHeaderHeight:u,rowHeight:d,rows:f,getCellContent:p,getRowThemeOverride:m,onHeaderMenuClick:h,enableGroups:_,isFilling:v,onCanvasFocused:y,onCanvasBlur:b,isFocused:x,selection:S,freezeColumns:C,onContextMenu:w,freezeTrailingRows:T,fixedShadowX:E=!0,fixedShadowY:D=!0,drawFocusRing:O,onMouseDown:k,onMouseUp:A,onMouseMoveRaw:ee,onMouseMove:te,onItemHovered:ne,dragAndDropState:re,firstColAccessible:j,onKeyDown:ie,onKeyUp:M,highlightRegions:ae,canvasRef:N,onDragStart:oe,onDragEnd:P,eventTargetRef:se,isResizing:ce,resizeColumn:F,isDragging:le,isDraggable:ue=!1,allowResize:de,disabledRows:fe,hasAppendRow:pe,getGroupDetails:me,theme:he,prelightCells:ge,headerIcons:I,verticalBorder:L,drawCell:_e,drawHeader:R,onCellFocused:ve,onDragOverCell:ye,onDrop:be,onDragLeave:xe,imageWindowLoader:Se,smoothScrollX:z=!1,smoothScrollY:Ce=!1,experimental:we,getCellRenderer:B}=e,Te=e.translateX??0,Ee=e.translateY??0,De=Math.max(C,Math.min(a.length-1,o)),Oe=g.useRef(null),ke=Se,Ae=g.useRef(),[je,Me]=g.useState(!1),Ne=g.useRef([]),Pe=g.useRef(),[Fe,Ie]=g.useState(),[Le,Re]=g.useState(),ze=g.useRef(null),[Be,Ve]=g.useState(),[He,Ue]=g.useState(!1),We=g.useRef(He);We.current=He;let Ge=g.useMemo(()=>new $o(I,()=>{ct.current=void 0,ft.current()}),[I]),Ke=_?u+c:c,qe=g.useRef(-1),Je=(we?.enableFirefoxRescaling??!1)&&tl.value,Ye=(we?.enableSafariRescaling??!1)&&nl.value;g.useLayoutEffect(()=>{window.devicePixelRatio!==1&&(Je||Ye)&&(qe.current!==-1&&Me(!0),window.clearTimeout(qe.current),qe.current=window.setTimeout(()=>{Me(!1),qe.current=-1},200))},[s,De,Te,Ee,Je,Ye]);let Xe=Ca(a,C),Ze=E?Na(Xe,re):0,Qe=g.useCallback((e,t,i)=>{let a=e.getBoundingClientRect();if(t>=Xe.length||i>=f)return;let o=a.width/n,c=ao(t,i,n,r,u,Ke,De,s,Te,Ee,f,C,T,Xe,d);return o!==1&&(c.x*=o,c.y*=o,c.width*=o,c.height*=o),c.x+=a.x,c.y+=a.y,c},[n,r,u,Ke,De,s,Te,Ee,f,C,T,Xe,d]),$e=g.useCallback((e,t,i,a)=>{let o=e.getBoundingClientRect(),p=o.width/n,m=(t-o.left)/p,h=(i-o.top)/p,g=Fa(Xe,De,n,void 0,Te),v=0,y=0;a instanceof MouseEvent&&(v=a.button,y=a.buttons);let b=Ia(m,g,Te),x=La(h,r,_,c,u,f,d,s,Ee,T),C=a?.shiftKey===!0,w=a?.ctrlKey===!0,E=a?.metaKey===!0,D=a!==void 0&&!(a instanceof MouseEvent)||a?.pointerType===`touch`,O=[m<0?-1:+(nn||h>r){let i=m>n?1:m<0?-1:0,a=h>r?1:h<0?-1:0,o=i*2,s=a*2;i===0&&(o=b===-1?cl.EndPadding:cl.Center),a===0&&(s=x===void 0?cl.EndPadding:cl.Center);let c=!1;if(b===-1&&x===-1){let n=Qe(e,Xe.length-1,-1);Wt(n!==void 0),c=tn&&mr&&h=0?(r=!0,n=Qe(e,a,x),Wt(n!==void 0),k={kind:_&&x===-2?ol:al,location:[a,x],bounds:n,group:Xe[a].group??``,isEdge:r,shiftKey:C,ctrlKey:w,metaKey:E,isTouch:D,localEventX:t-n.x,localEventY:i-n.y,button:v,buttons:y,scrollEdge:O}):k={kind:_&&x===-2?ol:al,group:Xe[b].group??``,location:[b,x],bounds:n,isEdge:r,shiftKey:C,ctrlKey:w,metaKey:E,isTouch:D,localEventX:t-n.x,localEventY:i-n.y,button:v,buttons:y,scrollEdge:O}}else{let n=Qe(e,b,x);Wt(n!==void 0);let r=n!==void 0&&n.x+n.width-t<5,a=!1;if(l&&S.current!==void 0){let n=ka(S.current.range),r=Qe(e,n[0],n[1]);if(r!==void 0){let e=r.x+r.width-2,n=r.y+r.height-2;a=Math.abs(e-t){}),nt=g.useRef(Fe);nt.current=Fe;let[rt,it]=g.useMemo(()=>{let e=document.createElement(`canvas`),t=document.createElement(`canvas`);return e.style.display=`none`,e.style.opacity=`0`,e.style.position=`fixed`,t.style.display=`none`,t.style.opacity=`0`,t.style.position=`fixed`,[e.getContext(`2d`,{alpha:!1}),t.getContext(`2d`,{alpha:!1})]},[]);g.useLayoutEffect(()=>{if(rt!==null&&it!==null)return document.documentElement.append(rt.canvas),document.documentElement.append(it.canvas),()=>{rt.canvas.remove(),it.canvas.remove()}},[rt,it]);let at=g.useMemo(()=>new po,[]),ot=Je&&je?1:Ye&&je?2:5,st=we?.disableMinimumCellWidth===!0?1:10,ct=g.useRef(),lt=g.useRef(null),ut=g.useRef(null),dt=g.useCallback(()=>{let e=Oe.current,t=ze.current;if(e===null||t===null||(lt.current===null&&(lt.current=e.getContext(`2d`,{alpha:!1}),e.width=0,e.height=0),ut.current===null&&(ut.current=t.getContext(`2d`,{alpha:!1}),t.width=0,t.height=0),lt.current===null||ut.current===null||rt===null||it===null))return;let i=!1,a=e=>{i=!0,Ve(e)},o=ct.current,h={headerCanvasCtx:ut.current,canvasCtx:lt.current,bufferACtx:rt,bufferBCtx:it,width:n,height:r,cellXOffset:De,cellYOffset:s,translateX:Math.round(Te),translateY:Math.round(Ee),mappedColumns:Xe,enableGroups:_,freezeColumns:C,dragAndDropState:re,theme:he,headerHeight:c,groupHeaderHeight:u,disabledRows:fe??ur.empty(),rowHeight:d,verticalBorder:L,isResizing:ce,resizeCol:F,isFocused:x,selection:S,fillHandle:l,drawCellCallback:_e,hasAppendRow:pe,overrideCursor:a,maxScaleFactor:ot,freezeTrailingRows:T,rows:f,drawFocus:O,getCellContent:p,getGroupDetails:me??(e=>({name:e})),getRowThemeOverride:m,drawHeaderCallback:R,prelightCells:ge,highlightRegions:ae,imageLoader:ke,lastBlitData:Pe,damage:Ae.current,hoverValues:Ne.current,hoverInfo:nt.current,spriteManager:Ge,scrolling:je,hyperWrapping:we?.hyperWrapping??!1,touchMode:He,enqueue:tt.current,renderStateProvider:at,renderStrategy:we?.renderStrategy??(nl.value?`double-buffer`:`single-buffer`),getCellRenderer:B,minimumCellWidth:st};h.damage===void 0?(ct.current=h,Jc(h,o)):Jc(h,void 0),!i&&(h.damage===void 0||h.damage.has(nt?.current?.[0]))&&Ve(void 0)},[rt,it,n,r,De,s,Te,Ee,Xe,_,C,re,he,c,u,fe,d,L,ce,pe,F,x,S,l,T,f,O,ot,p,me,m,_e,R,ge,ae,ke,Ge,je,we?.hyperWrapping,we?.renderStrategy,He,at,B,st]),ft=g.useRef(dt);g.useLayoutEffect(()=>{dt(),ft.current=dt},[dt]),g.useLayoutEffect(()=>{(async()=>{document?.fonts?.ready!==void 0&&(await document.fonts.ready,ct.current=void 0,ft.current())})()},[]);let pt=g.useCallback(e=>{Ae.current=e,ft.current(),Ae.current=void 0},[]);tt.current=il(pt);let mt=g.useCallback(e=>{pt(new mo(e.map(e=>e.cell)))},[pt]);ke.setCallback(pt);let[ht,gt]=g.useState(!1),[_t,vt]=et??[],yt=_t!==void 0&&vt===-1,bt=_t!==void 0&&vt===-2,xt=!1,St=!1,Ct=Be;if(Ct===void 0&&_t!==void 0&&vt!==void 0&&vt>-1&&vt({contain:`strict`,display:`block`,cursor:wt}),[wt]),V=g.useRef(`default`),Et=se?.current;Et!=null&&V.current!==Tt.cursor&&(Et.style.cursor=V.current=Tt.cursor);let Dt=g.useCallback((e,t,n,r)=>{if(me===void 0)return;let i=me(e);if(i.actions!==void 0){let e=Ts(t,i.actions);for(let[a,o]of e.entries())if(ss(o,n+t.x,r+o.y))return i.actions[a]}},[me]),Ot=g.useCallback((e,t,n,r)=>{let i=a[t];if(!le&&!ce&&i.hasMenu===!0&&!(Le??!1)){let a=Qe(e,t,-1);Wt(a!==void 0);let o=ws(a.x,a.y,a.width,a.height,ri(i.title)===`rtl`);if(n>o.x&&no.y&&r{let t=Oe.current,n=se?.current;if(t===null||e.target!==t&&e.target!==n)return;jt.current=!0;let r,i;if(e instanceof MouseEvent?(r=e.clientX,i=e.clientY):(r=e.touches[0].clientX,i=e.touches[0].clientY),e.target===n&&n!==null){let e=n.getBoundingClientRect();if(r>e.right||i>e.bottom)return}let a=$e(t,r,i,e);At.current=a.location,a.isTouch&&(kt.current=Date.now()),We.current!==a.isTouch&&Ue(a.isTouch),a.kind===`header`&&Ot(t,a.location[0],r,i)!==void 0||a.kind===`group-header`&&Dt(a.group,a.bounds,a.localEventX,a.localEventY)!==void 0||(k?.(a),!a.isTouch&&ue!==!0&&ue!==a.kind&&a.button<3&&a.button!==1&&e.preventDefault())},[se,ue,$e,Dt,Ot,k]);Gr(`touchstart`,Mt,window,!1),Gr(`mousedown`,Mt,window,!1);let Nt=g.useRef(0),Pt=g.useCallback(e=>{let t=Nt.current;Nt.current=Date.now();let n=Oe.current;if(jt.current=!1,A===void 0||n===null)return;let r=se?.current,i=e.target!==n&&e.target!==r,a,o,s=!0;if(e instanceof MouseEvent){if(a=e.clientX,o=e.clientY,s=e.button<3,e.pointerType===`touch`)return}else a=e.changedTouches[0].clientX,o=e.changedTouches[0].clientY;let c=$e(n,a,o,e);c.isTouch&&kt.current!==0&&Date.now()-kt.current>500&&(c={...c,isLongTouch:!0}),t!==0&&Date.now()-t<(c.isTouch?1e3:500)&&(c={...c,isDoubleClick:!0}),We.current!==c.isTouch&&Ue(c.isTouch),!i&&e.cancelable&&s&&e.preventDefault();let[l]=c.location,u=Ot(n,l,a,o);if(c.kind===`header`&&u!==void 0)(c.button!==0||At.current?.[0]!==l||At.current?.[1]!==-1)&&A(c,!0);else{if(c.kind===`group-header`){let e=Dt(c.group,c.bounds,c.localEventX,c.localEventY);if(e!==void 0){c.button===0&&e.onClick(c);return}}A(c,i)}},[A,se,$e,Ot,Dt]);Gr(`mouseup`,Pt,window,!1),Gr(`touchend`,Pt,window,!1),Gr(`click`,g.useCallback(e=>{let t=Oe.current;if(t===null)return;let n=se?.current,r=e.target!==t&&e.target!==n,i,a,o=!0;e instanceof MouseEvent?(i=e.clientX,a=e.clientY,o=e.button<3):(i=e.changedTouches[0].clientX,a=e.changedTouches[0].clientY);let s=$e(t,i,a,e);We.current!==s.isTouch&&Ue(s.isTouch),!r&&e.cancelable&&o&&e.preventDefault();let[c]=s.location,l=Ot(t,c,i,a);if(s.kind===`header`&&l!==void 0)s.button===0&&At.current?.[0]===c&&At.current?.[1]===-1&&h?.(c,l);else if(s.kind===`group-header`){let e=Dt(s.group,s.bounds,s.localEventX,s.localEventY);e!==void 0&&s.button===0&&e.onClick(s)}},[se,$e,Ot,h,Dt]),window,!1),Gr(`contextmenu`,g.useCallback(e=>{let t=Oe.current,n=se?.current;if(t===null||e.target!==t&&e.target!==n||w===void 0)return;let r=$e(t,e.clientX,e.clientY,e);w(r,()=>{e.cancelable&&e.preventDefault()})},[se,$e,w]),se?.current??null,!1);let Ft=g.useCallback(e=>{Ae.current=new mo(e.map(e=>e.item)),Ne.current=e,ft.current(),Ae.current=void 0},[]),It=g.useMemo(()=>new Qc(Ft),[Ft]),Lt=g.useRef(It);Lt.current=It,g.useLayoutEffect(()=>{let e=Lt.current;if(et===void 0||et[1]<0){e.setHovered(et);return}let t=p(et,!0),n=B(t),r=n===void 0&&t.kind===W.Custom||n?.needsHover!==void 0&&(typeof n.needsHover==`boolean`?n.needsHover:n.needsHover(t));e.setHovered(r?et:void 0)},[p,B,et]);let Rt=g.useRef();Gr(`mousemove`,g.useCallback(e=>{let t=Oe.current;if(t===null)return;let n=se?.current,r=e.target!==t&&e.target!==n,i=$e(t,e.clientX,e.clientY,e);if(i.kind!==`out-of-bounds`&&r&&!jt.current&&!i.isTouch)return;let a=(e,t)=>{Ie(n=>n===e||n?.[0][0]===e?.[0][0]&&n?.[0][1]===e?.[0][1]&&(n?.[1][0]===e?.[1][0]&&n?.[1][1]===e?.[1][1]||!t)?n:e)};if(!ll(i,Rt.current))Ve(void 0),ne?.(i),a(i.kind===`out-of-bounds`?void 0:[i.location,[i.localEventX,i.localEventY]],!0),Rt.current=i;else if(i.kind===`cell`||i.kind===`header`||i.kind===`group-header`){let e=!1,t=!0;if(i.kind===`cell`){let n=p(i.location);t=B(n)?.needsHoverPosition??n.kind===W.Custom,e=t}else i.kind===`group-header`&&(e=!0);let n=[i.location,[i.localEventX,i.localEventY]];a(n,t),nt.current=n,e&&pt(new mo([i.location]))}let o=i.location[0]>=+!j;Re(i.kind===`header`&&i.isEdge&&o&&de===!0),gt(i.kind===`cell`&&i.isFillHandle),ee?.(e),te(i)},[se,$e,j,de,ee,te,ne,p,B,pt]),window,!0);let zt=g.useCallback(e=>{let t=Oe.current;if(t===null)return;let n,r;S.current!==void 0&&(n=Qe(t,S.current.cell[0],S.current.cell[1]),r=S.current.cell),ie?.({bounds:n,stopPropagation:()=>e.stopPropagation(),preventDefault:()=>e.preventDefault(),cancel:()=>void 0,ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey,altKey:e.altKey,key:e.key,keyCode:e.keyCode,rawEvent:e,location:r})},[ie,S,Qe]),Bt=g.useCallback(e=>{let t=Oe.current;if(t===null)return;let n,r;S.current!==void 0&&(n=Qe(t,S.current.cell[0],S.current.cell[1]),r=S.current.cell),M?.({bounds:n,stopPropagation:()=>e.stopPropagation(),preventDefault:()=>e.preventDefault(),cancel:()=>void 0,ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey,altKey:e.altKey,key:e.key,keyCode:e.keyCode,rawEvent:e,location:r})},[M,S,Qe]),Vt=g.useCallback(e=>{Oe.current=e,N!==void 0&&(N.current=e)},[N]);Gr(`dragstart`,g.useCallback(e=>{let t=Oe.current;if(t===null||ue===!1||ce){e.preventDefault();return}let n,r,i=$e(t,e.clientX,e.clientY);if(ue!==!0&&i.kind!==ue){e.preventDefault();return}let a=(e,t)=>{n=e,r=t},o,s,c,l=(e,t,n)=>{o=e,s=t,c=n},u=!1;if(oe?.({...i,setData:a,setDragImage:l,preventDefault:()=>u=!0,defaultPrevented:()=>u}),!u&&n!==void 0&&r!==void 0&&e.dataTransfer!==null){if(e.dataTransfer.setData(n,r),e.dataTransfer.effectAllowed=`copyLink`,o!==void 0&&s!==void 0&&c!==void 0)e.dataTransfer.setDragImage(o,s,c);else{let[n,r]=i.location;if(r!==void 0){let i=document.createElement(`canvas`),a=Qe(t,n,r);Wt(a!==void 0);let o=Math.ceil(window.devicePixelRatio??1);i.width=a.width*o,i.height=a.height*o;let s=i.getContext(`2d`);s!==null&&(s.scale(o,o),s.textBaseline=`middle`,r===-1?(s.font=he.headerFontFull,s.fillStyle=he.bgHeader,s.fillRect(0,0,i.width,i.height),Ds(s,0,0,a.width,a.height,Xe[n],!1,he,!1,!1,0,Ge,R,!1)):(s.font=he.baseFontFull,s.fillStyle=he.bgCell,s.fillRect(0,0,i.width,i.height),ys(s,p([n,r]),0,r,!1,!1,0,0,a.width,a.height,!1,he,he.bgCell,ke,Ge,1,void 0,!1,0,void 0,void 0,void 0,at,B,()=>void 0))),i.style.left=`-100%`,i.style.position=`absolute`,i.style.width=`${a.width}px`,i.style.height=`${a.height}px`,document.body.append(i),e.dataTransfer.setDragImage(i,a.width/2,a.height/2),window.setTimeout(()=>{i.remove()},0)}}}else e.preventDefault()},[ue,ce,$e,oe,Qe,he,Xe,Ge,R,p,ke,at,B]),se?.current??null,!1,!1);let H=g.useRef();Gr(`dragover`,g.useCallback(e=>{let t=Oe.current;if(be!==void 0&&e.preventDefault(),t===null||ye===void 0)return;let[n,r]=$e(t,e.clientX,e.clientY).location,i=n-+!j,[a,o]=H.current??[];(a!==i||o!==r)&&(H.current=[i,r],ye([i,r],e.dataTransfer))},[j,$e,ye,be]),se?.current??null,!1,!1),Gr(`dragend`,g.useCallback(()=>{H.current=void 0,P?.()},[P]),se?.current??null,!1,!1),Gr(`drop`,g.useCallback(e=>{let t=Oe.current;if(t===null||be===void 0)return;e.preventDefault();let[n,r]=$e(t,e.clientX,e.clientY).location,i=n-+!j;be([i,r],e.dataTransfer)},[j,$e,be]),se?.current??null,!1,!1),Gr(`dragleave`,g.useCallback(()=>{xe?.()},[xe]),se?.current??null,!1,!1);let Ht=g.useRef(S);Ht.current=S;let Ut=g.useRef(null),Gt=g.useCallback(e=>{Oe.current!==null&&Oe.current.contains(document.activeElement)&&(e===null&&Ht.current.current!==void 0?N?.current?.focus({preventScroll:!0}):e!==null&&e.focus({preventScroll:!0}),Ut.current=e)},[N]);g.useImperativeHandle(t,()=>({focus:()=>{let e=Ut.current;e===null||!document.contains(e)?N?.current?.focus({preventScroll:!0}):e.focus({preventScroll:!0})},getBounds:(e,t)=>{if(N!==void 0&&N.current!==null)return Qe(N.current,e??0,t??-1)},damage:mt}),[N,mt,Qe]);let Kt=g.useRef(),qt=ti(()=>{if(n<50||we?.disableAccessibilityTree===!0)return null;let e=Fa(Xe,De,n,re,Te),t=j?0:-1;!j&&e[0]?.sourceIndex===0&&(e=e.slice(1));let[r,a]=S.current?.cell??[],o=S.current?.range,c=e.map(e=>e.sourceIndex),l=(0,ul.default)(s,Math.min(f,s+i));return r!==void 0&&a!==void 0&&!(c.includes(r)&&l.includes(a))&&Gt(null),g.createElement(`table`,{key:`access-tree`,role:`grid`,"aria-rowcount":f+1,"aria-multiselectable":`true`,"aria-colcount":Xe.length+t},g.createElement(`thead`,{role:`rowgroup`},g.createElement(`tr`,{role:`row`,"aria-rowindex":1},e.map(e=>g.createElement(`th`,{role:`columnheader`,"aria-selected":S.columns.hasIndex(e.sourceIndex),"aria-colindex":e.sourceIndex+1+t,tabIndex:-1,onFocus:t=>{if(t.target!==Ut.current)return ve?.([e.sourceIndex,-1])},key:e.sourceIndex},e.title)))),g.createElement(`tbody`,{role:`rowgroup`},l.map(n=>g.createElement(`tr`,{role:`row`,"aria-selected":S.rows.hasIndex(n),key:n,"aria-rowindex":n+2},e.map(e=>{let i=e.sourceIndex,s=so(i,n),c=r===i&&a===n,l=o!==void 0&&i>=o.x&&i=o.y&&n{let e=N?.current;if(e!=null)return ie?.({bounds:Qe(e,i,n),cancel:()=>void 0,preventDefault:()=>void 0,stopPropagation:()=>void 0,ctrlKey:!1,key:`Enter`,keyCode:13,metaKey:!1,shiftKey:!1,altKey:!1,rawEvent:void 0,location:d})},onFocusCapture:e=>{if(!(e.target===Ut.current||Kt.current?.[0]===i&&Kt.current?.[1]===n))return Kt.current=d,ve?.(d)},ref:c?Gt:void 0,tabIndex:-1},fl(f,B))})))))},[n,Xe,De,re,Te,f,s,i,S,Gt,p,N,ie,Qe,ve],200),Jt=C===0||!E?0:De>C?1:(0,Yc.default)(-Te/100,0,1),Yt=-s*32+Ee,Xt=D?(0,Yc.default)(-Yt/100,0,1):0,U=g.useMemo(()=>{if(!Jt&&!Xt)return null;let e={position:`absolute`,top:0,left:Ze,width:n-Ze,height:r,opacity:Jt,pointerEvents:`none`,transition:z?void 0:`opacity 0.2s`,boxShadow:`inset 13px 0 10px -13px rgba(0, 0, 0, 0.2)`},t={position:`absolute`,top:Ke,left:0,width:n,height:r,opacity:Xt,pointerEvents:`none`,transition:Ce?void 0:`opacity 0.2s`,boxShadow:`inset 0 13px 10px -13px rgba(0, 0, 0, 0.2)`};return g.createElement(g.Fragment,null,Jt>0&&g.createElement(`div`,{id:`shadow-x`,style:e}),Xt>0&&g.createElement(`div`,{id:`shadow-y`,style:t}))},[Jt,Xt,Ze,n,z,Ke,r,Ce]),Zt=g.useMemo(()=>({position:`absolute`,top:0,left:0}),[]);return g.createElement(g.Fragment,null,g.createElement(`canvas`,{"data-testid":`data-grid-canvas`,tabIndex:0,onKeyDown:zt,onKeyUp:Bt,onFocus:y,onBlur:b,ref:Vt,style:Tt},qt),g.createElement(`canvas`,{ref:ze,style:Zt}),U)}));function ml(e,t,n,r){return(0,Yc.default)(Math.round(t-(e.growOffset??0)),Math.ceil(n),Math.floor(r))}var hl=e=>{let[t,n]=g.useState(),[r,i]=g.useState(),[a,o]=g.useState(),[s,c]=g.useState(),[l,u]=g.useState(!1),[d,f]=g.useState(),[p,m]=g.useState(),[h,_]=g.useState(),[v,y]=g.useState(!1),[b,x]=g.useState(),{onHeaderMenuClick:S,getCellContent:C,onColumnMoved:w,onColumnResize:T,onColumnResizeStart:E,onColumnResizeEnd:D,gridRef:O,maxColumnWidth:k,minColumnWidth:A,onRowMoved:ee,lockColumns:te,onColumnProposeMove:ne,onMouseDown:re,onMouseUp:j,onItemHovered:ie,onDragStart:M,canvasRef:ae}=e,N=(T??D??E)!==void 0,{columns:oe,selection:P}=e,se=P.columns,ce=g.useCallback(e=>{let[t,n]=e.location;a!==void 0&&s!==t&&t>=te?(u(!0),c(t)):p!==void 0&&n!==void 0?(y(!0),_(Math.max(0,n))):r===void 0&&!l&&!v&&ie?.(e)},[a,p,s,ie,te,r,l,v]),F=w!==void 0,le=g.useCallback(e=>{if(e.button===0){let[t,r]=e.location;if(e.kind===`out-of-bounds`&&e.isEdge&&N){let e=O?.current?.getBounds(oe.length-1,-1);e!==void 0&&(n(e.x),i(oe.length-1))}else if(e.kind===`header`&&t>=te){let r=ae?.current;if(e.isEdge&&N&&r){n(e.bounds.x),i(t);let a=r.getBoundingClientRect().width/r.offsetWidth,o=e.bounds.width/a;E?.(oe[t],o,t,o+(oe[t].growOffset??0))}else e.kind===`header`&&F&&(f(e.bounds.x),o(t))}else e.kind===`cell`&&te>0&&t===0&&r!==void 0&&ee!==void 0&&(x(e.bounds.y),m(r))}re?.(e)},[re,N,te,ee,O,oe,F,E,ae]),ue=g.useCallback((e,t)=>{l||v||S?.(e,t)},[l,v,S]),de=g.useRef(-1),fe=g.useCallback(()=>{de.current=-1,m(void 0),_(void 0),x(void 0),y(!1),o(void 0),c(void 0),f(void 0),u(!1),i(void 0),n(void 0)},[]),pe=g.useCallback((e,t)=>{if(e.button===0){if(r!==void 0){if(se?.hasIndex(r)===!0)for(let e of se){if(e===r)continue;let t=oe[e],n=ml(t,de.current,A,k);T?.(t,n,e,n+(t.growOffset??0))}let e=ml(oe[r],de.current,A,k);if(D?.(oe[r],e,r,e+(oe[r].growOffset??0)),se.hasIndex(r))for(let e of se){if(e===r)continue;let t=oe[e],n=ml(t,de.current,A,k);D?.(t,n,e,n+(t.growOffset??0))}}fe(),a!==void 0&&s!==void 0&&w?.(a,s),p!==void 0&&h!==void 0&&ee?.(p,h)}j?.(e,t)},[j,r,a,s,p,h,se,D,oe,A,k,T,w,ee,fe]),me=g.useMemo(()=>{if(a!==void 0&&s!==void 0&&a!==s&&ne?.(a,s)!==!1)return{src:a,dest:s}},[a,s,ne]),he=g.useCallback(e=>{let n=ae?.current;if(a!==void 0&&d!==void 0)Math.abs(e.clientX-d)>20&&u(!0);else if(p!==void 0&&b!==void 0)Math.abs(e.clientY-b)>20&&y(!0);else if(r!==void 0&&t!==void 0&&n){let i=n.getBoundingClientRect().width/n.offsetWidth,a=(e.clientX-t)/i,o=oe[r],s=ml(o,a,A,k);if(T?.(o,s,r,s+(o.growOffset??0)),de.current=a,se?.first()===r)for(let e of se){if(e===r)continue;let t=oe[e],n=ml(t,de.current,A,k);T?.(t,n,e,n+(t.growOffset??0))}}},[a,d,p,b,r,t,oe,A,k,T,se,ae]),ge=g.useCallback((e,t)=>{if(p===void 0||h===void 0)return C(e,t);let[n,r]=e;return r===h?r=p:(r>h&&--r,r>=p&&(r+=1)),C([n,r],t)},[p,h,C]),I=g.useCallback(e=>{M?.(e),e.defaultPrevented()||fe()},[fe,M]);return g.createElement(pl,{accessibilityHeight:e.accessibilityHeight,canvasRef:e.canvasRef,cellXOffset:e.cellXOffset,cellYOffset:e.cellYOffset,columns:e.columns,disabledRows:e.disabledRows,drawFocusRing:e.drawFocusRing,drawHeader:e.drawHeader,drawCell:e.drawCell,enableGroups:e.enableGroups,eventTargetRef:e.eventTargetRef,experimental:e.experimental,fillHandle:e.fillHandle,firstColAccessible:e.firstColAccessible,fixedShadowX:e.fixedShadowX,fixedShadowY:e.fixedShadowY,freezeColumns:e.freezeColumns,getCellRenderer:e.getCellRenderer,getGroupDetails:e.getGroupDetails,getRowThemeOverride:e.getRowThemeOverride,groupHeaderHeight:e.groupHeaderHeight,headerHeight:e.headerHeight,headerIcons:e.headerIcons,height:e.height,highlightRegions:e.highlightRegions,imageWindowLoader:e.imageWindowLoader,resizeColumn:r,isDraggable:e.isDraggable,isFilling:e.isFilling,isFocused:e.isFocused,onCanvasBlur:e.onCanvasBlur,onCanvasFocused:e.onCanvasFocused,onCellFocused:e.onCellFocused,onContextMenu:e.onContextMenu,onDragEnd:e.onDragEnd,onDragLeave:e.onDragLeave,onDragOverCell:e.onDragOverCell,onDrop:e.onDrop,onKeyDown:e.onKeyDown,onKeyUp:e.onKeyUp,onMouseMove:e.onMouseMove,prelightCells:e.prelightCells,rowHeight:e.rowHeight,rows:e.rows,selection:e.selection,smoothScrollX:e.smoothScrollX,smoothScrollY:e.smoothScrollY,theme:e.theme,freezeTrailingRows:e.freezeTrailingRows,hasAppendRow:e.hasAppendRow,translateX:e.translateX,translateY:e.translateY,verticalBorder:e.verticalBorder,width:e.width,getCellContent:ge,isResizing:r!==void 0,onHeaderMenuClick:ue,isDragging:l,onItemHovered:ce,onDragStart:I,onMouseDown:le,allowResize:N,onMouseUp:pe,dragAndDropState:me,onMouseMoveRaw:he,ref:O})};function gl(e){let t=(0,g.useRef)(null),[n,r]=(0,g.useState)({width:e?.[0],height:e?.[1]});return(0,g.useLayoutEffect)(()=>{let e=new window.ResizeObserver(e=>{for(let t of e){let{width:e,height:n}=t&&t.contentRect||{};r(t=>t.width===e&&t.height===n?t:{width:e,height:n})}});return t.current&&e.observe(t.current,void 0),()=>{e.disconnect()}},[t.current]),{ref:t,...n}}var _l=(e,t,n)=>{let r=(0,g.useRef)(null),i=(0,g.useRef)(null),a=(0,g.useRef)(null),o=(0,g.useRef)(0),s=(0,g.useRef)(t);s.current=t;let c=n.current;(0,g.useEffect)(()=>{let t=()=>{if(i.current===!1&&c!==null){let e=[c.scrollLeft,c.scrollTop];if(a.current?.[0]===e[0]&&a.current?.[1]===e[1]){if(o.current>10){a.current=null,i.current=null;return}o.current++}else o.current=0,s.current(e[0],e[1]),a.current=e;r.current=window.setTimeout(t,1e3/120)}},n=()=>{i.current=!0,a.current=null,r.current!==null&&(window.clearTimeout(r.current),r.current=null)},l=e=>{e.touches.length===0&&(i.current=!1,o.current=0,r.current=window.setTimeout(t,1e3/120))};if(e&&c!==null){let e=c;return e.addEventListener(`touchstart`,n),e.addEventListener(`touchend`,l),()=>{e.removeEventListener(`touchstart`,n),e.removeEventListener(`touchend`,l),r.current!==null&&window.clearTimeout(r.current)}}},[e,c])},vl=br(`div`)({name:`ScrollRegionStyle`,class:`gdg-s1dgczr6`,propsAsIs:!1,vars:{"s1dgczr6-0":[e=>e.isSafari?`scroll`:`auto`]}});function yl(e){let[t,n]=g.useState(!1),r=typeof window>`u`?null:window,i=g.useRef(0);return Gr(`touchstart`,g.useCallback(()=>{window.clearTimeout(i.current),n(!0)},[]),r,!0,!1),Gr(`touchend`,g.useCallback(t=>{t.touches.length===0&&(i.current=window.setTimeout(()=>n(!1),e))},[e]),r,!0,!1),t}var bl=e=>{let{children:t,clientHeight:n,scrollHeight:r,scrollWidth:i,update:a,draggable:o,className:s,preventDiagonalScrolling:c=!1,paddingBottom:l=0,paddingRight:u=0,rightElement:d,rightElementProps:f,kineticScrollPerfHack:p=!1,scrollRef:m,initialSize:h}=e,_=[],v=f?.sticky??!1,y=f?.fill??!1,b=g.useRef(0),x=g.useRef(0),S=g.useRef(null),C=typeof window>`u`?1:window.devicePixelRatio,w=g.useRef({scrollLeft:0,scrollTop:0,lockDirection:void 0}),T=g.useRef(null),E=yl(200),[D,O]=g.useState(!0),k=g.useRef(0);g.useLayoutEffect(()=>{if(!D||E||w.current.lockDirection===void 0)return;let e=S.current;if(e===null)return;let[t,n]=w.current.lockDirection;t===void 0?n!==void 0&&(e.scrollTop=n):e.scrollLeft=t,w.current.lockDirection=void 0},[E,D]);let A=g.useCallback((e,t)=>{let n=S.current;if(n===null)return;t??=n.scrollTop,e??=n.scrollLeft;let i=w.current.scrollTop,o=w.current.scrollLeft,s=e-o,d=t-i;E&&s!==0&&d!==0&&(Math.abs(s)>3||Math.abs(d)>3)&&c&&w.current.lockDirection===void 0&&(w.current.lockDirection=Math.abs(s)0&&(Math.abs(g)>2e3||h===0||h===_)&&r>n.scrollHeight+5){let e=h/_,t=(r-m)*e;b.current=t-h}f!==void 0&&(window.clearTimeout(k.current),O(!1),k.current=window.setTimeout(()=>O(!0),200)),a({x:e,y:h+b.current,width:p-u,height:m-l,paddingRight:T.current?.clientWidth??0})},[l,u,r,a,c,E]);_l(p&&nl.value,A,S);let ee=g.useRef(A);ee.current=A;let te=g.useRef(),ne=g.useRef(!1);g.useLayoutEffect(()=>{ne.current?A():ne.current=!0},[A,l,u]);let re=g.useCallback(e=>{S.current=e,m!==void 0&&(m.current=e)},[m]),j=0,ie=0;for(_.push(g.createElement(`div`,{key:j++,style:{width:i,height:0}}));ieee.current(),0),te.current={width:ae,height:N}),(ae??0)===0||(N??0)===0?g.createElement(`div`,{ref:M}):g.createElement(`div`,{ref:M},g.createElement(vl,{isSafari:nl.value},g.createElement(`div`,{className:`dvn-underlay`},t),g.createElement(`div`,{ref:re,style:te.current,draggable:o,onDragStart:e=>{o||(e.stopPropagation(),e.preventDefault())},className:`dvn-scroller `+(s??``),onScroll:()=>A()},g.createElement(`div`,{className:`dvn-scroll-inner`+(d===void 0?` dvn-hidden`:``)},g.createElement(`div`,{className:`dvn-stack`},_),d!==void 0&&g.createElement(g.Fragment,null,!y&&g.createElement(`div`,{className:`dvn-spacer`}),g.createElement(`div`,{ref:T,style:{height:N,maxHeight:n-Math.ceil(C%1),position:`sticky`,top:0,paddingLeft:1,marginBottom:-40,marginRight:u,flexGrow:y?1:void 0,right:v?u??0:void 0,pointerEvents:`auto`}},d))))))},xl=e=>{let{columns:t,rows:n,rowHeight:r,headerHeight:i,groupHeaderHeight:a,enableGroups:o,freezeColumns:s,experimental:c,nonGrowWidth:l,clientSize:u,className:d,onVisibleRegionChanged:f,scrollRef:p,preventDiagonalScrolling:m,rightElement:h,rightElementProps:_,overscrollX:v,overscrollY:y,initialSize:b,smoothScrollX:x=!1,smoothScrollY:S=!1,isDraggable:C}=e,{paddingRight:w,paddingBottom:T}=c??{},[E,D]=u,O=g.useRef(),k=g.useRef(),A=g.useRef(),ee=g.useRef(),te=l+Math.max(0,v??0),ne=o?i+a:i;if(typeof r==`number`)ne+=n*r;else for(let e=0;e{if(re.current===void 0)return;let e={...re.current},i=0,a=e.x<0?-e.x:0,o=0,c=0;e.x=e.x<0?0:e.x;let l=0;for(let e=0;e=t+n.width)i+=n.width,c++,o++;else if(e.x>t)i+=n.width,x?a+=t-e.x:c++,o++;else if(e.x+e.width>t)i+=n.width,o++;else break}let u=0,d=0,p=0;if(typeof r==`number`)S?(d=Math.floor(e.y/r),u=d*r-e.y):d=Math.ceil(e.y/r),p=Math.ceil(e.height/r)+d,u<0&&p++;else{let t=0;for(let i=0;i=t+n)t+=n,d++,p++;else if(e.y>a)t+=n,S?u+=a-e.y:d++,p++;else if(e.y+e.height>n/2+t)t+=n,p++;else break}}let m={x:c,y:d,width:o-c,height:p-d},h=O.current;(h===void 0||h.y!==m.y||h.x!==m.x||h.height!==m.height||h.width!==m.width||k.current!==a||A.current!==u||e.width!==ee.current?.[0]||e.height!==ee.current?.[1])&&(f?.({x:c,y:d,width:o-c,height:p-d},e.width,e.height,e.paddingRight??0,a,u),O.current=m,k.current=a,A.current=u,ee.current=[e.width,e.height])},[t,r,n,f,s,x,S]),ie=g.useCallback(e=>{re.current=e,j()},[j]);return g.useEffect(()=>{j()},[j]),g.createElement(bl,{scrollRef:p,className:d,kineticScrollPerfHack:c?.kineticScrollPerfHack,preventDiagonalScrolling:m,draggable:C===!0||typeof C==`string`,scrollWidth:te+(w??0),scrollHeight:ne+(T??0),clientHeight:D,rightElement:h,paddingBottom:T,paddingRight:w,rightElementProps:_,update:ie,initialSize:b},g.createElement(hl,{eventTargetRef:p,width:E,height:D,accessibilityHeight:e.accessibilityHeight,canvasRef:e.canvasRef,cellXOffset:e.cellXOffset,cellYOffset:e.cellYOffset,columns:e.columns,disabledRows:e.disabledRows,enableGroups:e.enableGroups,fillHandle:e.fillHandle,firstColAccessible:e.firstColAccessible,fixedShadowX:e.fixedShadowX,fixedShadowY:e.fixedShadowY,freezeColumns:e.freezeColumns,getCellContent:e.getCellContent,getCellRenderer:e.getCellRenderer,getGroupDetails:e.getGroupDetails,getRowThemeOverride:e.getRowThemeOverride,groupHeaderHeight:e.groupHeaderHeight,headerHeight:e.headerHeight,highlightRegions:e.highlightRegions,imageWindowLoader:e.imageWindowLoader,isFilling:e.isFilling,isFocused:e.isFocused,lockColumns:e.lockColumns,maxColumnWidth:e.maxColumnWidth,minColumnWidth:e.minColumnWidth,onHeaderMenuClick:e.onHeaderMenuClick,onMouseMove:e.onMouseMove,prelightCells:e.prelightCells,rowHeight:e.rowHeight,rows:e.rows,selection:e.selection,theme:e.theme,freezeTrailingRows:e.freezeTrailingRows,hasAppendRow:e.hasAppendRow,translateX:e.translateX,translateY:e.translateY,onColumnProposeMove:e.onColumnProposeMove,verticalBorder:e.verticalBorder,drawFocusRing:e.drawFocusRing,drawHeader:e.drawHeader,drawCell:e.drawCell,experimental:e.experimental,gridRef:e.gridRef,headerIcons:e.headerIcons,isDraggable:e.isDraggable,onCanvasBlur:e.onCanvasBlur,onCanvasFocused:e.onCanvasFocused,onCellFocused:e.onCellFocused,onColumnMoved:e.onColumnMoved,onColumnResize:e.onColumnResize,onColumnResizeEnd:e.onColumnResizeEnd,onColumnResizeStart:e.onColumnResizeStart,onContextMenu:e.onContextMenu,onDragEnd:e.onDragEnd,onDragLeave:e.onDragLeave,onDragOverCell:e.onDragOverCell,onDragStart:e.onDragStart,onDrop:e.onDrop,onItemHovered:e.onItemHovered,onKeyDown:e.onKeyDown,onKeyUp:e.onKeyUp,onMouseDown:e.onMouseDown,onMouseUp:e.onMouseUp,onRowMoved:e.onRowMoved,smoothScrollX:e.smoothScrollX,smoothScrollY:e.smoothScrollY}))},Sl=br(`div`)({name:`SearchWrapper`,class:`gdg-seveqep`,propsAsIs:!1}),Cl=g.createElement(`svg`,{className:`button-icon`,viewBox:`0 0 512 512`},g.createElement(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`48`,d:`M112 244l144-144 144 144M256 120v292`})),wl=g.createElement(`svg`,{className:`button-icon`,viewBox:`0 0 512 512`},g.createElement(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`48`,d:`M112 268l144 144 144-144M256 392V100`})),Tl=g.createElement(`svg`,{className:`button-icon`,viewBox:`0 0 512 512`},g.createElement(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`32`,d:`M368 368L144 144M368 144L144 368`})),El=10,Dl=e=>{let{canvasRef:t,cellYOffset:n,rows:r,columns:i,searchInputRef:a,searchValue:o,searchResults:s,onSearchValueChange:c,getCellsForSelection:l,onSearchResultsChanged:u,showSearch:d=!1,onSearchClose:f}=e,[p]=g.useState(()=>`search-box-`+Math.round(Math.random()*1e3)),[m,h]=g.useState(``),_=o??m,v=g.useCallback(e=>{h(e),c?.(e)},[c]),[y,b]=g.useState(),x=g.useRef(y);x.current=y,g.useEffect(()=>{s!==void 0&&(s.length>0?b(e=>({rowsSearched:r,results:s.length,selectedIndex:e?.selectedIndex??-1})):b(void 0))},[r,s]);let S=g.useRef();S.current===void 0&&(S.current=new AbortController);let C=g.useRef(),[w,T]=g.useState([]),E=s??w,D=g.useCallback(()=>{C.current!==void 0&&(window.cancelAnimationFrame(C.current),C.current=void 0,S.current.abort())},[]),O=g.useRef(n);O.current=n;let k=g.useCallback(e=>{let t=new RegExp(e.replace(/([$()*+.?[\\\]^{|}-])/g,`\\$1`),`i`),n=O.current,a=Math.min(10,r),o=0;b(void 0),T([]);let s=[],c=async()=>{if(l===void 0)return;let e=performance.now(),d=r-o,f=l({x:0,y:n,width:i.length,height:Math.min(a,d,r-n)},S.current.signal);typeof f==`function`&&(f=await f());let p=!1;for(let[e,r]of f.entries())for(let[i,a]of r.entries()){let r;switch(a.kind){case W.Text:case W.Number:r=a.displayData;break;case W.Uri:case W.Markdown:r=a.data;break;case W.Boolean:r=typeof a.data==`boolean`?a.data.toString():void 0;break;case W.Image:case W.Bubble:r=a.data.join(`🐳`);break;case W.Custom:r=a.copyData}r!==void 0&&t.test(r)&&(s.push([i,e+n]),p=!0)}let m=performance.now();p&&T([...s]),o+=f.length,Wt(o<=r);let h=x.current?.selectedIndex??-1;b({results:s.length,rowsSearched:o,selectedIndex:h}),u?.(s,h),n+a>=r?n=0:n+=a;let g=m-e,_=El/Math.max(g,1);a=Math.ceil(a*_),o{f?.(),b(void 0),T([]),u?.([],-1),D(),t?.current?.focus()},[D,t,f,u]),ee=g.useCallback(e=>{v(e.target.value),s===void 0&&(e.target.value===``?(b(void 0),T([]),D()):k(e.target.value))},[k,D,v,s]);g.useEffect(()=>{d&&a.current!==null&&(v(``),a.current.focus({preventScroll:!0}))},[d,a,v]);let te=g.useCallback(e=>{if(e?.stopPropagation?.(),y===void 0)return;let t=(y.selectedIndex+1)%y.results;b({...y,selectedIndex:t}),u?.(E,t)},[y,u,E]),ne=g.useCallback(e=>{if(e?.stopPropagation?.(),y===void 0)return;let t=(y.selectedIndex-1)%y.results;t<0&&(t+=y.results),b({...y,selectedIndex:t}),u?.(E,t)},[u,E,y]),re=g.useCallback(e=>{(e.ctrlKey||e.metaKey)&&e.nativeEvent.code===`KeyF`||e.key===`Escape`?(A(),e.stopPropagation(),e.preventDefault()):e.key===`Enter`&&(e.shiftKey?ne():te())},[A,te,ne]);g.useEffect(()=>()=>{D()},[D]);let[j,ie]=g.useState(!1);g.useEffect(()=>{if(d)ie(!0);else{let e=setTimeout(()=>ie(!1),150);return()=>clearTimeout(e)}},[d]);let M=g.useMemo(()=>{if(!d&&!j)return null;let e;y!==void 0&&(e=y.results>=1e3?`over 1000`:`${y.results} result${y.results===1?``:`s`}`,y.selectedIndex>=0&&(e=`${y.selectedIndex+1} of ${e}`));let t=e=>{e.stopPropagation()},n={width:`${Math.floor((y?.rowsSearched??0)/r*100)}%`};return g.createElement(Sl,{className:d?``:`out`,onMouseDown:t,onMouseMove:t,onMouseUp:t,onClick:t},g.createElement(`div`,{className:`gdg-search-bar-inner`},g.createElement(`input`,{id:p,"aria-hidden":!d,"data-testid":`search-input`,ref:a,onChange:ee,value:_,tabIndex:d?void 0:-1,onKeyDownCapture:re}),g.createElement(`button`,{"aria-label":`Previous Result`,"aria-hidden":!d,tabIndex:d?void 0:-1,onClick:ne,disabled:(y?.results??0)===0},Cl),g.createElement(`button`,{"aria-label":`Next Result`,"aria-hidden":!d,tabIndex:d?void 0:-1,onClick:te,disabled:(y?.results??0)===0},wl),f!==void 0&&g.createElement(`button`,{"aria-label":`Close Search`,"aria-hidden":!d,"data-testid":`search-close-button`,tabIndex:d?void 0:-1,onClick:A},Tl)),y===void 0?g.createElement(`div`,{className:`gdg-search-status`},g.createElement(`label`,{htmlFor:p},`Type to search`)):g.createElement(g.Fragment,null,g.createElement(`div`,{className:`gdg-search-status`},g.createElement(`div`,{"data-testid":`search-result-area`},e)),g.createElement(`div`,{className:`gdg-search-progress`,style:n})))},[d,j,y,r,p,a,ee,_,re,ne,te,f,A]);return g.createElement(g.Fragment,null,g.createElement(xl,{prelightCells:E,accessibilityHeight:e.accessibilityHeight,canvasRef:e.canvasRef,cellXOffset:e.cellXOffset,cellYOffset:e.cellYOffset,className:e.className,clientSize:e.clientSize,columns:e.columns,disabledRows:e.disabledRows,enableGroups:e.enableGroups,fillHandle:e.fillHandle,firstColAccessible:e.firstColAccessible,nonGrowWidth:e.nonGrowWidth,fixedShadowX:e.fixedShadowX,fixedShadowY:e.fixedShadowY,freezeColumns:e.freezeColumns,getCellContent:e.getCellContent,getCellRenderer:e.getCellRenderer,getGroupDetails:e.getGroupDetails,getRowThemeOverride:e.getRowThemeOverride,groupHeaderHeight:e.groupHeaderHeight,headerHeight:e.headerHeight,highlightRegions:e.highlightRegions,imageWindowLoader:e.imageWindowLoader,initialSize:e.initialSize,isFilling:e.isFilling,isFocused:e.isFocused,lockColumns:e.lockColumns,maxColumnWidth:e.maxColumnWidth,minColumnWidth:e.minColumnWidth,onHeaderMenuClick:e.onHeaderMenuClick,onMouseMove:e.onMouseMove,onVisibleRegionChanged:e.onVisibleRegionChanged,overscrollX:e.overscrollX,overscrollY:e.overscrollY,preventDiagonalScrolling:e.preventDiagonalScrolling,rightElement:e.rightElement,rightElementProps:e.rightElementProps,rowHeight:e.rowHeight,rows:e.rows,scrollRef:e.scrollRef,selection:e.selection,theme:e.theme,freezeTrailingRows:e.freezeTrailingRows,hasAppendRow:e.hasAppendRow,translateX:e.translateX,translateY:e.translateY,verticalBorder:e.verticalBorder,onColumnProposeMove:e.onColumnProposeMove,drawFocusRing:e.drawFocusRing,drawCell:e.drawCell,drawHeader:e.drawHeader,experimental:e.experimental,gridRef:e.gridRef,headerIcons:e.headerIcons,isDraggable:e.isDraggable,onCanvasBlur:e.onCanvasBlur,onCanvasFocused:e.onCanvasFocused,onCellFocused:e.onCellFocused,onColumnMoved:e.onColumnMoved,onColumnResize:e.onColumnResize,onColumnResizeEnd:e.onColumnResizeEnd,onColumnResizeStart:e.onColumnResizeStart,onContextMenu:e.onContextMenu,onDragEnd:e.onDragEnd,onDragLeave:e.onDragLeave,onDragOverCell:e.onDragOverCell,onDragStart:e.onDragStart,onDrop:e.onDrop,onItemHovered:e.onItemHovered,onKeyDown:e.onKeyDown,onKeyUp:e.onKeyUp,onMouseDown:e.onMouseDown,onMouseUp:e.onMouseUp,onRowMoved:e.onRowMoved,smoothScrollX:e.smoothScrollX,smoothScrollY:e.smoothScrollY}),M)},Ol=class extends g.PureComponent{wrapperRef=g.createRef();componentDidMount(){document.addEventListener(`touchend`,this.clickOutside,!0),document.addEventListener(`mousedown`,this.clickOutside,!0),document.addEventListener(`contextmenu`,this.clickOutside,!0)}componentWillUnmount(){document.removeEventListener(`touchend`,this.clickOutside,!0),document.removeEventListener(`mousedown`,this.clickOutside,!0),document.removeEventListener(`contextmenu`,this.clickOutside,!0)}clickOutside=e=>{if((!this.props.isOutsideClick||this.props.isOutsideClick(e))&&this.wrapperRef.current!==null&&!this.wrapperRef.current.contains(e.target)){let t=e.target;for(;t!==null;){if(t.classList.contains(`click-outside-ignore`))return;t=t.parentElement}this.props.onClickOutside()}};render(){let{onClickOutside:e,isOutsideClick:t,...n}=this.props;return g.createElement(`div`,{...n,ref:this.wrapperRef},this.props.children)}},kl=br(`input`)({name:`RenameInput`,class:`gdg-r17m35ur`,propsAsIs:!1,vars:{"r17m35ur-0":[e=>Math.max(16,e.targetHeight-10),`px`]}}),Al=e=>{let{bounds:t,group:n,onClose:r,canvasBounds:i,onFinish:a}=e,[o,s]=g.useState(n);return g.createElement(Ol,{style:{position:`absolute`,left:t.x-i.left+1,top:t.y-i.top,width:t.width-2,height:t.height},className:`gdg-c1tqibwd`,onClickOutside:r},g.createElement(kl,{targetHeight:t.height,"data-testid":`group-rename-input`,value:o,onBlur:r,onFocus:e=>e.target.setSelectionRange(0,o.length),onChange:e=>s(e.target.value),onKeyDown:e=>{e.key===`Enter`?a(o):e.key===`Escape`&&r()},autoFocus:!0}))};function jl(e,t){return e===void 0?!1:e.length>1&&e.startsWith(`_`)?Number.parseInt(e.slice(1))===t.keyCode:e.length===1&&e>=`a`&&e<=`z`?e.toUpperCase().codePointAt(0)===t.keyCode:e===t.key}function Ml(e,t,n){let r=Nl(e,t);return r&&(n.didMatch=!0),r}function Nl(e,t){if(e.length===0)return!1;if(e.includes(`|`)){let n=e.split(`|`);for(let e of n)if(Nl(e,t))return!0;return!1}let n=!1,r=!1,i=!1,a=!1,o=e.split(`+`);if(!jl(o.pop(),t))return!1;if(o[0]===`any`)return!0;for(let e of o)switch(e){case`ctrl`:n=!0;break;case`shift`:r=!0;break;case`alt`:i=!0;break;case`meta`:a=!0;break;case`primary`:rl.value?a=!0:n=!0}return t.altKey===i&&t.ctrlKey===n&&t.shiftKey===r&&t.metaKey===a}function Pl(e,t,n,r,i,a){return[g.useCallback((o,s,c,l)=>{(a===`cell`||a===`multi-cell`)&&o!==void 0&&(o={...o,range:{x:o.cell[0],y:o.cell[1],width:1,height:1}});let u=n===`mixed`&&(c||l===`drag`),d=r===`mixed`&&u,f=i===`mixed`&&u,p={current:o===void 0?void 0:{...o,rangeStack:l===`drag`?e.current?.rangeStack??[]:[]},columns:d?e.columns:ur.empty(),rows:f?e.rows:ur.empty()};c&&(a===`multi-rect`||a===`multi-cell`)&&p.current!==void 0&&e.current!==void 0&&(p={...p,current:{...p.current,rangeStack:[...e.current.rangeStack,e.current.range]}}),t(p,s)},[r,e,n,a,i,t]),g.useCallback((a,o,s)=>{a??=e.rows,o!==void 0&&(a=a.add(o));let c;if(i===`exclusive`&&a.length>0)c={current:void 0,columns:ur.empty(),rows:a};else{let t=s&&n===`mixed`,i=s&&r===`mixed`;c={current:t?e.current:void 0,columns:i?e.columns:ur.empty(),rows:a}}t(c,!1)},[r,e,n,i,t]),g.useCallback((a,o,s)=>{a??=e.columns,o!==void 0&&(a=a.add(o));let c;if(r===`exclusive`&&a.length>0)c={current:void 0,rows:ur.empty(),columns:a};else{let t=s&&n===`mixed`,r=s&&i===`mixed`;c={current:t?e.current:void 0,rows:r?e.rows:ur.empty(),columns:a}}t(c,!1)},[r,e,n,i,t])]}function Fl(e,t,n,r,i){let a=g.useCallback(n=>{if(e===!0){let e=[];for(let r=n.y;r=i?a.push({kind:W.Loading,allowOverlay:!1}):a.push(t([e,r]));e.push(a)}return e}return e?.(n,r.signal)??[]},[r.signal,t,e,i]),o=e===void 0?void 0:a,s=g.useCallback(e=>{if(o===void 0)return[];let t={...e,x:e.x-n};if(t.x<0){t.x=0,t.width--;let e=o(t,r.signal);return typeof e==`function`?async()=>(await e()).map(e=>[{kind:W.Loading,allowOverlay:!1},...e]):e.map(e=>[{kind:W.Loading,allowOverlay:!1},...e])}return o(t,r.signal)},[r.signal,o,n]);return[e===void 0?void 0:s,o]}function Il(e){if(e.copyData!==void 0)return{formatted:e.copyData,rawValue:e.copyData,format:`string`};switch(e.kind){case W.Boolean:return{formatted:e.data===!0?`TRUE`:e.data===!1?`FALSE`:e.data===void 0?`INDETERMINATE`:``,rawValue:e.data,format:`boolean`};case W.Custom:return{formatted:e.copyData,rawValue:e.copyData,format:`string`};case W.Image:case W.Bubble:return{formatted:e.data,rawValue:e.data,format:`string-array`};case W.Drilldown:return{formatted:e.data.map(e=>e.text),rawValue:e.data.map(e=>e.text),format:`string-array`};case W.Text:return{formatted:e.displayData??e.data,rawValue:e.data,format:`string`};case W.Uri:return{formatted:e.displayData??e.data,rawValue:e.data,format:`url`};case W.Markdown:case W.RowID:return{formatted:e.data,rawValue:e.data,format:`string`};case W.Number:return{formatted:e.displayData,rawValue:e.data,format:`number`};case W.Loading:return{formatted:`#LOADING`,rawValue:``,format:`string`};case W.Protected:return{formatted:`************`,rawValue:``,format:`string`};default:Gt(e)}}function Ll(e,t){return e.map((e,n)=>{let r=t[n];return e.map(e=>e.span!==void 0&&e.span[0]!==r?{formatted:``,rawValue:``,format:`string`}:Il(e))})}function Rl(e,t){return(t?/[\t\n",]/:/[\t\n"]/).test(e)&&(e=`"${e.replace(/"/g,`""`)}"`),e}function zl(e){let t=[];for(let n of e){let e=[];for(let t of n)t.format===`url`?e.push(t.rawValue?.toString()??``):t.format===`string-array`?e.push(t.formatted.map(e=>Rl(e,!0)).join(`,`)):e.push(Rl(t.formatted,!1));t.push(e.join(` `))}return t.join(` +`)}function Bl(e){return e.replace(/\t/g,` `).replace(/ {2,}/g,e=>` `.repeat(e.length))}function Vl(e){return`"`+e.replace(/&/g,`&`).replace(/"/g,`"`).replace(//g,`>`)+`"`}function Hl(e){return e.replace(/"/g,`"`).replace(/</g,`<`).replace(/>/g,`>`).replace(/&/g,`&`)}function Ul(e){let t=[];t.push(``,``);for(let n of e){t.push(``);for(let e of n){let n=`gdg-format="${e.format}"`;e.format===`url`?t.push(``):e.format===`string-array`?t.push(``):t.push(``)}t.push(``)}return t.push(`
    ${Bl(e.formatted)}
      ${e.formatted.map((t,n)=>`
    1. `+Bl(t)+`
    2. `).join(``)}
    ${Bl(e.formatted)}
    `),t.join(``)}function Wl(e,t){let n=Ll(e,t);return{textPlain:zl(n),textHtml:Ul(n)}}function Gl(e){let t=document.createElement(`html`);t.innerHTML=e.replace(/ /g,` `);let n=t.querySelector(`table`);if(n===null)return;let r=[n],i=[],a;for(;r.length>0;){let e=r.pop();if(e===void 0)break;if(e instanceof HTMLTableElement||e.nodeName===`TBODY`)r.push(...[...e.children].reverse());else if(e instanceof HTMLTableRowElement)a!==void 0&&i.push(a),a=[],r.push(...[...e.children].reverse());else if(e instanceof HTMLTableCellElement){let t=e.cloneNode(!0),n=t.children.length===1&&t.children[0].nodeName===`P`?t.children[0]:null,r=n?.children.length===1&&n.children[0].nodeName===`FONT`,i=t.querySelectorAll(`br`);for(let e of i)e.replaceWith(` +`);let o=t.getAttribute(`gdg-raw-value`),s=t.getAttribute(`gdg-format`)??`string`;if(t.querySelector(`a`)!==null)a?.push({rawValue:t.querySelector(`a`)?.getAttribute(`href`)??``,formatted:t.textContent??``,format:s});else if(t.querySelector(`ol`)!==null){let e=t.querySelectorAll(`li`);a?.push({rawValue:[...e].map(e=>e.getAttribute(`gdg-raw-value`)??``),formatted:[...e].map(e=>e.textContent??``),format:`string-array`})}else if(o!==null)a?.push({rawValue:Hl(o),formatted:t.textContent??``,format:s});else{let e=t.textContent??``;r&&(e=e.replace(/\n(?!\n)/g,``)),a?.push({rawValue:e??``,formatted:e??``,format:s})}}}return a!==void 0&&i.push(a),i}function Kl(e,t,n,r,i){let a=e;if(r===`allowPartial`||e.current===void 0||t===void 0)return e;let o=!1;do{if(e?.current===void 0)break;let r=e.current?.range,s=[];if(r.width>2){let e=t({x:r.x,y:r.y,width:1,height:r.height},i.signal);if(typeof e==`function`)return a;s.push(...e);let n=t({x:r.x+r.width-1,y:r.y,width:1,height:r.height},i.signal);if(typeof n==`function`)return a;s.push(...n)}else{let e=t({x:r.x,y:r.y,width:r.width,height:r.height},i.signal);if(typeof e==`function`)return a;s.push(...e)}let c=r.x-n,l=r.x+r.width-1-n;for(let e of s)for(let t of e)t.span!==void 0&&(c=Math.min(t.span[0],c),l=Math.max(t.span[1],l));c===r.x-n&&l===r.x+r.width-1-n?o=!0:e={current:{cell:e.current.cell??[0,0],range:{x:c+n,y:r.y,width:l-c+1,height:r.height},rangeStack:e.current.rangeStack},columns:e.columns,rows:e.rows}}while(!o);return e}function ql(e){return e.startsWith(`"`)&&e.endsWith(`"`)&&(e=e.slice(1,-1).replace(/""/g,`"`)),e}function Jl(e){let t;(function(e){e[e.None=0]=`None`,e[e.inString=1]=`inString`,e[e.inStringPostQuote=2]=`inStringPostQuote`})(t||={});let n=[],r=[],i=0,a=t.None;e=e.replace(/\r\n/g,` +`);let o=0;for(let s of e){switch(a){case t.None:s===` `||s===` +`?(r.push(e.slice(i,o)),i=o+1,s===` +`&&(n.push(r),r=[])):s===`"`&&(a=t.inString);break;case t.inString:s===`"`&&(a=t.inStringPostQuote);break;case t.inStringPostQuote:s===`"`?a=t.inString:((s===` `||s===` +`)&&(r.push(ql(e.slice(i,o))),i=o+1,s===` +`&&(n.push(r),r=[])),a=t.None)}o++}return ie.map(e=>({rawValue:e,formatted:e,format:`string`})))}function Yl(e,t,n){let r=Wl(e,t),i=e=>{window.navigator.clipboard?.writeText(e)},a=(e,t)=>window.navigator.clipboard?.write!==void 0&&(window.navigator.clipboard.write([new ClipboardItem({"text/plain":new Blob([e],{type:`text/plain`}),"text/html":new Blob([t],{type:`text/html`})})]),!0);window.navigator.clipboard?.write!==void 0||n?.clipboardData!==void 0?((e,t)=>{try{if(n===void 0||n.clipboardData===null)throw Error(`No clipboard data`);n?.clipboardData?.setData(`text/plain`,e),n?.clipboardData?.setData(`text/html`,t)}catch{a(e,t)||i(e)}})(r.textPlain,r.textHtml):i(r.textPlain),n?.preventDefault()}function Xl(e){return e!==!0}function Zl(e){return typeof e==`string`?e:`${e}px`}var Ql=br(`div`)({name:`Wrapper`,class:`gdg-wmyidgi`,propsAsIs:!1,vars:{"wmyidgi-0":[e=>e.innerWidth],"wmyidgi-1":[e=>e.innerHeight]}}),$l=e=>{let{inWidth:t,inHeight:n,children:r,...i}=e;return g.createElement(Ql,{innerHeight:Zl(n),innerWidth:Zl(t),...i},r)},eu=2,tu=1300;function nu(e,t,n){let r=g.useRef(0),[i,a]=e??[0,0];g.useEffect(()=>{if(i===0&&a===0){r.current=0;return}let e=!1,o=0,s=c=>{if(!e){if(o===0)o=c;else{let e=c-o;r.current=Math.min(1,r.current+e/tu);let s=r.current**1.618*e*eu;t.current?.scrollBy(i*s,a*s),o=c,n?.()}window.requestAnimationFrame(s)}};return window.requestAnimationFrame(s),()=>{e=!0}},[t,i,a,n])}function ru({rowHeight:e,headerHeight:t,groupHeaderHeight:n,theme:r,overscrollX:i,overscrollY:a,scaleToRem:o,remSize:s}){let[c,l,u,d,f,p]=g.useMemo(()=>{if(!o||s===16)return[e,t,n,r,i,a];let c=s/16,l=e,u=_o();return[typeof l==`number`?l*c:e=>Math.ceil(l(e)*c),Math.ceil(t*c),Math.ceil(n*c),{...r,headerIconSize:(r?.headerIconSize??u.headerIconSize)*c,cellHorizontalPadding:(r?.cellHorizontalPadding??u.cellHorizontalPadding)*c,cellVerticalPadding:(r?.cellVerticalPadding??u.cellVerticalPadding)*c},Math.ceil((i??0)*c),Math.ceil((a??0)*c)]},[n,t,i,a,s,e,o,r]);return{rowHeight:c,headerHeight:l,groupHeaderHeight:u,theme:d,overscrollX:f,overscrollY:p}}var iu={downFill:!1,rightFill:!1,clear:!0,closeOverlay:!0,acceptOverlayDown:!0,acceptOverlayUp:!0,acceptOverlayLeft:!0,acceptOverlayRight:!0,copy:!0,paste:!0,cut:!0,search:!1,delete:!0,activateCell:!0,scrollToSelectedCell:!0,goToFirstCell:!0,goToFirstColumn:!0,goToFirstRow:!0,goToLastCell:!0,goToLastColumn:!0,goToLastRow:!0,goToNextPage:!0,goToPreviousPage:!0,selectToFirstCell:!0,selectToFirstColumn:!0,selectToFirstRow:!0,selectToLastCell:!0,selectToLastColumn:!0,selectToLastRow:!0,selectAll:!0,selectRow:!0,selectColumn:!0,goUpCell:!0,goRightCell:!0,goDownCell:!0,goLeftCell:!0,goUpCellRetainSelection:!0,goRightCellRetainSelection:!0,goDownCellRetainSelection:!0,goLeftCellRetainSelection:!0,selectGrowUp:!0,selectGrowRight:!0,selectGrowDown:!0,selectGrowLeft:!0};function au(e,t){return e===!0?t:e===!1?``:e}function ou(e){let t=rl.value;return{activateCell:au(e.activateCell,` |Enter|shift+Enter`),clear:au(e.clear,`any+Escape`),closeOverlay:au(e.closeOverlay,`any+Escape`),acceptOverlayDown:au(e.acceptOverlayDown,`Enter`),acceptOverlayUp:au(e.acceptOverlayUp,`shift+Enter`),acceptOverlayLeft:au(e.acceptOverlayLeft,`shift+Tab`),acceptOverlayRight:au(e.acceptOverlayRight,`Tab`),copy:e.copy,cut:e.cut,delete:au(e.delete,t?`Backspace|Delete`:`Delete`),downFill:au(e.downFill,`primary+_68`),scrollToSelectedCell:au(e.scrollToSelectedCell,`primary+Enter`),goDownCell:au(e.goDownCell,`ArrowDown`),goDownCellRetainSelection:au(e.goDownCellRetainSelection,`alt+ArrowDown`),goLeftCell:au(e.goLeftCell,`ArrowLeft|shift+Tab`),goLeftCellRetainSelection:au(e.goLeftCellRetainSelection,`alt+ArrowLeft`),goRightCell:au(e.goRightCell,`ArrowRight|Tab`),goRightCellRetainSelection:au(e.goRightCellRetainSelection,`alt+ArrowRight`),goUpCell:au(e.goUpCell,`ArrowUp`),goUpCellRetainSelection:au(e.goUpCellRetainSelection,`alt+ArrowUp`),goToFirstCell:au(e.goToFirstCell,`primary+Home`),goToFirstColumn:au(e.goToFirstColumn,`Home|primary+ArrowLeft`),goToFirstRow:au(e.goToFirstRow,`primary+ArrowUp`),goToLastCell:au(e.goToLastCell,`primary+End`),goToLastColumn:au(e.goToLastColumn,`End|primary+ArrowRight`),goToLastRow:au(e.goToLastRow,`primary+ArrowDown`),goToNextPage:au(e.goToNextPage,`PageDown`),goToPreviousPage:au(e.goToPreviousPage,`PageUp`),paste:e.paste,rightFill:au(e.rightFill,`primary+_82`),search:au(e.search,`primary+f`),selectAll:au(e.selectAll,`primary+a`),selectColumn:au(e.selectColumn,`ctrl+ `),selectGrowDown:au(e.selectGrowDown,`shift+ArrowDown`),selectGrowLeft:au(e.selectGrowLeft,`shift+ArrowLeft`),selectGrowRight:au(e.selectGrowRight,`shift+ArrowRight`),selectGrowUp:au(e.selectGrowUp,`shift+ArrowUp`),selectRow:au(e.selectRow,`shift+ `),selectToFirstCell:au(e.selectToFirstCell,`primary+shift+Home`),selectToFirstColumn:au(e.selectToFirstColumn,`primary+shift+ArrowLeft`),selectToFirstRow:au(e.selectToFirstRow,`primary+shift+ArrowUp`),selectToLastCell:au(e.selectToLastCell,`primary+shift+End`),selectToLastColumn:au(e.selectToLastColumn,`primary+shift+ArrowRight`),selectToLastRow:au(e.selectToLastRow,`primary+shift+ArrowDown`)}}function su(e){let t=li(e);return g.useMemo(()=>{if(t===void 0)return ou(iu);let e={...t,goToNextPage:t?.goToNextPage??t?.pageDown??iu.goToNextPage,goToPreviousPage:t?.goToPreviousPage??t?.pageUp??iu.goToPreviousPage,goToFirstCell:t?.goToFirstCell??t?.first??iu.goToFirstCell,goToLastCell:t?.goToLastCell??t?.last??iu.goToLastCell,selectToFirstCell:t?.selectToFirstCell??t?.first??iu.selectToFirstCell,selectToLastCell:t?.selectToLastCell??t?.last??iu.selectToLastCell};return ou({...iu,...e})},[t])}var cu=`modulepreload`,lu=function(e){return`/`+e},uu={},du=function(e){return e.pathname.endsWith(`.css`)},fu=function(e,t,n){if(t in e)return e[t];let r=n();if(!r){e[t]=void 0;return}let i=r.then(()=>{e[t]=void 0},n=>{throw e[t]=void 0,n});return e[t]=i,i},pu=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e,i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}r=o(t.map(t=>{t=lu(t,n);let r=s(t),i=du(r);return fu(uu,r.href,()=>{if(e===void 0){e={all:new Set,styles:new Set};let t=document.getElementsByTagName(`link`);for(let n=t.length-1;n>=0;n--){let r=t[n];e.all.add(r.href),r.rel===`stylesheet`&&e.styles.add(r.href)}}if((i?e.styles:e.all).has(r.href))return;let t=document.createElement(`link`);if(t.rel=i?`stylesheet`:cu,i||(t.as=`script`),t.crossOrigin=``,t.href=r.href,a&&t.setAttribute(`nonce`,a),document.head.appendChild(t),i)return new Promise((e,n)=>{t.addEventListener(`load`,e),t.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${r}`)))})})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},mu=c(Vo(),1),hu=c(Go(),1),gu=g.lazy(async()=>await pu(()=>import(`./data-grid-overlay-editor-upJpLw4s.js`),[])),_u=0;function vu(e){return(0,mu.default)((0,hu.default)((0,hu.default)(e).filter(e=>e.span!==void 0).map(e=>(0,ul.default)((e.span?.[0]??0)+1,(e.span?.[1]??0)+1))))}function yu(e,t){return e===void 0||t===0||e.columns.length===0&&e.current===void 0?e:{current:e.current===void 0?void 0:{cell:[e.current.cell[0]+t,e.current.cell[1]],range:{...e.current.range,x:e.current.range.x+t},rangeStack:e.current.rangeStack.map(e=>({...e,x:e.x+t}))},rows:e.rows,columns:e.columns.offset(t)}}var bu={kind:W.Loading,allowOverlay:!1},xu={columns:ur.empty(),rows:ur.empty(),current:void 0},Su=g.forwardRef((e,t)=>{let[n,r]=g.useState(xu),[i,a]=g.useState(),o=g.useRef(null),s=g.useRef(null),[c,l]=g.useState(),u=g.useRef(null),d=g.useRef(),f=typeof window>`u`?null:window,{imageEditorOverride:p,getRowThemeOverride:m,markdownDivCreateNode:h,width:_,height:v,columns:y,rows:b,getCellContent:x,onCellClicked:S,onCellActivated:C,onFillPattern:w,onFinishedEditing:T,coercePasteValue:E,drawHeader:D,drawCell:O,editorBloom:k,onHeaderClicked:A,onColumnProposeMove:ee,spanRangeBehavior:te=`default`,onGroupHeaderClicked:ne,onCellContextMenu:re,className:j,onHeaderContextMenu:ie,getCellsForSelection:M,onGroupHeaderContextMenu:ae,onGroupHeaderRenamed:N,onCellEdited:oe,onCellsEdited:P,onSearchResultsChanged:se,searchResults:ce,onSearchValueChange:F,searchValue:le,onKeyDown:ue,onKeyUp:de,keybindings:fe,editOnType:pe=!0,onRowAppended:me,onColumnMoved:he,validateCell:ge,highlightRegions:I,rangeSelect:L=`rect`,columnSelect:_e=`multi`,rowSelect:R=`multi`,rangeSelectionBlending:ve=`exclusive`,columnSelectionBlending:ye=`exclusive`,rowSelectionBlending:be=`exclusive`,onDelete:xe,onDragStart:Se,onMouseMove:z,onPaste:Ce,copyHeaders:we=!1,freezeColumns:B=0,cellActivationBehavior:Te=`second-click`,rowSelectionMode:Ee=`auto`,onHeaderMenuClick:De,getGroupDetails:Oe,onSearchClose:ke,onItemHovered:Ae,onSelectionCleared:je,showSearch:Me,onVisibleRegionChanged:Ne,gridSelection:Pe,onGridSelectionChange:Fe,minColumnWidth:Ie=50,maxColumnWidth:Le=500,maxColumnAutoWidth:Re,provideEditor:ze,trailingRowOptions:Be,freezeTrailingRows:Ve=0,allowedFillDirections:He=`orthogonal`,scrollOffsetX:Ue,scrollOffsetY:We,verticalBorder:Ge,onDragOverCell:Ke,onDrop:qe,onColumnResize:Je,onColumnResizeEnd:Ye,onColumnResizeStart:Xe,customRenderers:Ze,fillHandle:Qe,drawFocusRing:$e=!0,experimental:et,fixedShadowX:tt,fixedShadowY:nt,headerIcons:rt,imageWindowLoader:it,initialSize:at,isDraggable:ot,onDragLeave:st,onRowMoved:ct,overscrollX:lt,overscrollY:ut,preventDiagonalScrolling:dt,rightElement:ft,rightElementProps:pt,trapFocus:mt=!1,smoothScrollX:ht,smoothScrollY:gt,scaleToRem:_t=!1,rowHeight:vt=34,headerHeight:yt=36,groupHeaderHeight:bt=yt,theme:xt,isOutsideClick:St,renderers:Ct}=e,wt=typeof e.rowMarkers==`string`?void 0:e.rowMarkers,Tt=wt?.kind??e.rowMarkers??`none`,V=wt?.width??e.rowMarkerWidth,Et=wt?.startIndex??e.rowMarkerStartIndex??1,Dt=wt?.theme??e.rowMarkerTheme,Ot=wt?.checkboxStyle??`square`,kt=Math.max(Ie,20),At=Math.max(Le,kt),jt=Math.max(Re??At,kt),Mt=g.useMemo(()=>typeof window>`u`?{fontSize:`16px`}:window.getComputedStyle(document.documentElement),[]),{rowHeight:Nt,headerHeight:Pt,groupHeaderHeight:Ft,theme:It,overscrollX:Lt,overscrollY:Rt}=ru({groupHeaderHeight:bt,headerHeight:yt,overscrollX:lt,overscrollY:ut,remSize:g.useMemo(()=>Number.parseFloat(Mt.fontSize),[Mt]),rowHeight:vt,scaleToRem:_t,theme:xt}),zt=su(fe),Bt=V??(b>1e4?48:b>1e3?44:b>100?36:32),Vt=Tt!==`none`,H=+!!Vt,Ht=me!==void 0,Ut=Be?.sticky===!0,[qt,Jt]=g.useState(!1),Yt=Me??qt,Xt=g.useCallback(()=>{ke===void 0?Jt(!1):ke()},[ke]),U=g.useMemo(()=>Pe===void 0?void 0:yu(Pe,H),[Pe,H])??n,Zt=g.useRef();Zt.current===void 0&&(Zt.current=new AbortController),g.useEffect(()=>()=>Zt?.current.abort(),[]);let[Qt,$t]=Fl(M,x,H,Zt.current,b),en=g.useCallback((e,t,n)=>{if(ge===void 0)return!0;let r=[e[0]-H,e[1]];return ge?.(r,t,n)},[H,ge]),tn=g.useRef(Pe),nn=g.useCallback((e,t)=>{t&&(e=Kl(e,Qt,H,te,Zt.current)),Fe===void 0?r(e):(tn.current=yu(e,-H),Fe(tn.current))},[Fe,Qt,H,te]),rn=Kr(Je,g.useCallback((e,t,n,r)=>{Je?.(y[n-H],t,n-H,r)},[Je,H,y])),an=Kr(Ye,g.useCallback((e,t,n,r)=>{Ye?.(y[n-H],t,n-H,r)},[Ye,H,y])),on=Kr(Xe,g.useCallback((e,t,n,r)=>{Xe?.(y[n-H],t,n-H,r)},[Xe,H,y])),sn=Kr(D,g.useCallback((e,t)=>D?.({...e,columnIndex:e.columnIndex-H},t)??!1,[D,H])),cn=Kr(O,g.useCallback((e,t)=>O?.({...e,col:e.col-H},t)??!1,[O,H])),ln=g.useCallback(e=>{if(xe!==void 0){let t=xe(yu(e,-H));return typeof t==`boolean`?t:yu(t,H)}return!0},[xe,H]),[un,dn,fn]=Pl(U,nn,ve,ye,be,L),pn=g.useMemo(()=>yo(_o(),It),[It]),[mn,hn]=g.useState([0,0,0]),gn=g.useMemo(()=>{if(Ct===void 0)return{};let e={};for(let t of Ct)e[t.kind]=t;return e},[Ct]),_n=g.useCallback(e=>e.kind===W.Custom?Ze?.find(t=>t.isMatch(e)):gn[e.kind],[Ze,gn]),{sizedColumns:vn,nonGrowWidth:yn}=Co(y,b,$t,mn[0]-(H===0?0:Bt)-mn[2],kt,jt,pn,_n,Zt.current);Tt!==`none`&&(yn+=Bt);let bn=g.useMemo(()=>vn.some(e=>e.group!==void 0),[vn]),xn=bn?Pt+Ft:Pt,Sn=U.rows.length,Cn=Tt===`none`?void 0:Sn===0?!1:Sn===b||void 0,wn=g.useMemo(()=>Tt===`none`?vn:[{title:``,width:Bt,icon:void 0,hasMenu:!1,style:`normal`,themeOverride:Dt,rowMarker:Ot,rowMarkerChecked:Cn},...vn],[Tt,vn,Bt,Dt,Ot,Cn]),[Tn,En]=g.useMemo(()=>[We!==void 0&&typeof Nt==`number`?Math.floor(We/Nt):0,We!==void 0&&typeof Nt==`number`?-(We%Nt):0],[We,Nt]),Dn=g.useRef({height:1,width:1,x:0,y:0}),On=g.useMemo(()=>({x:Dn.current.x,y:Tn,width:Dn.current.width??1,height:Dn.current.height??1,ty:En}),[En,Tn]),kn=g.useRef(!1),[An,jn,Mn]=si(On);Dn.current=An;let Nn=(An.height??1)>1;g.useLayoutEffect(()=>{if(We!==void 0&&u.current!==null&&Nn){if(u.current.scrollTop===We)return;u.current.scrollTop=We,u.current.scrollTop!==We&&Mn(),kn.current=!0}},[We,Nn,Mn]);let Pn=(An.width??1)>1;g.useLayoutEffect(()=>{if(Ue!==void 0&&u.current!==null&&Pn){if(u.current.scrollLeft===Ue)return;u.current.scrollLeft=Ue,u.current.scrollLeft!==Ue&&Mn(),kn.current=!0}},[Ue,Pn,Mn]);let Fn=An.x+H,In=An.y,Ln=g.useRef(null),Rn=g.useCallback(e=>{e===!0?Ln.current?.focus():window.requestAnimationFrame(()=>{Ln.current?.focus()})},[]),zn=Ht?b+1:b,Bn=g.useCallback(e=>{let t=H===0?e:e.map(e=>({...e,location:[e.location[0]-H,e.location[1]]})),n=P?.(t);if(n!==!0)for(let e of t)oe?.(e.location,e.value);return n},[oe,P,H]),[Vn,Hn]=g.useState(),Un=U.current!==void 0&&U.current.range.width*U.current.range.height>1?U.current.range:void 0,Wn=$e?U.current?.cell:void 0,Gn=Wn?.[0],Kn=Wn?.[1],qn=g.useMemo(()=>{if((I===void 0||I.length===0)&&(Un??Gn??Kn??Vn)===void 0)return;let e=[];if(I!==void 0)for(let t of I){let n=wn.length-t.range.x-H;n>0&&e.push({color:t.color,range:{...t.range,x:t.range.x+H,width:Math.min(n,t.range.width)},style:t.style})}return Vn!==void 0&&e.push({color:ua(pn.accentColor,0),range:Vn,style:`dashed`}),Un!==void 0&&e.push({color:ua(pn.accentColor,.5),range:Un,style:`solid-outline`}),Gn!==void 0&&Kn!==void 0&&e.push({color:pn.accentColor,range:{x:Gn,y:Kn,width:1,height:1},style:`solid-outline`}),e.length>0?e:void 0},[Vn,Un,Gn,Kn,I,wn.length,pn.accentColor,H]),Jn=g.useRef(wn);Jn.current=wn;let Yn=g.useCallback(([e,t],n=!1)=>{let r=Ht&&t===zn-1;if(e===0&&Vt)return r?bu:{kind:sr.Marker,allowOverlay:!1,checkboxStyle:Ot,checked:U?.rows.hasIndex(t)===!0,markerKind:Tt===`clickable-number`?`number`:Tt,row:Et+t,drawHandle:ct!==void 0,cursor:Tt===`clickable-number`?`pointer`:void 0};if(r){let t=e===H?Be?.hint??``:``,n=Jn.current[e];if(n?.trailingRowOptions?.disabled===!0)return bu;{let e=n?.trailingRowOptions?.hint??t,r=n?.trailingRowOptions?.addIcon??Be?.addIcon;return{kind:sr.NewRow,hint:e,allowOverlay:!1,icon:r}}}{let r=e-H;if(n||et?.strict===!0){let e=Dn.current,n=e.x>r||r>e.x+e.width||e.y>t||t>e.y+e.height||t>=cr.current,i=r===e.extras?.selected?.[0]&&t===e.extras?.selected[1],a=!1;if(e.extras?.freezeRegions!==void 0){for(let n of e.extras.freezeRegions)if(ss(n,r,t)){a=!0;break}}if(n&&!i&&!a)return bu}let i=x([r,t]);return H!==0&&i.span!==void 0&&(i={...i,span:[i.span[0]+H,i.span[1]+H]}),i}},[Ht,zn,Vt,Ot,U?.rows,Tt,Et,ct,H,Be?.hint,Be?.addIcon,et?.strict,x]),Xn=g.useCallback(e=>{let t=Oe?.(e)??{name:e};return N!==void 0&&e!==``&&(t={icon:t.icon,name:t.name,overrideTheme:t.overrideTheme,actions:[...t.actions??[],{title:`Rename`,icon:`renameIcon`,onClick:e=>Sr({group:t.name,bounds:e.bounds})}]}),t},[Oe,N]),Zn=g.useCallback(e=>{let[t,n]=e.cell,r=wn[t],i=r?.group===void 0?void 0:Xn(r.group)?.overrideTheme,o=r?.themeOverride,s=m?.(n);a({...e,theme:yo(pn,i,o,s,e.content.themeOverride)})},[m,wn,Xn,pn]),Qn=g.useCallback((e,t,n)=>{if(U.current===void 0)return;let[r,i]=U.current.cell,a=Yn([r,i]);if(a.kind!==W.Boolean&&a.allowOverlay){let t=a;if(n!==void 0)switch(t.kind){case W.Number:{let e=Kt(()=>n===`-`?-0:Number.parseFloat(n),0);t={...t,data:Number.isNaN(e)?0:e};break}case W.Text:case W.Markdown:case W.Uri:t={...t,data:n}}Zn({target:e,content:t,initialValue:n,cell:[r,i],highlight:n===void 0,forceEditMode:n!==void 0})}else a.kind===W.Boolean&&t&&a.readonly!==!0&&(Bn([{location:U.current.cell,value:{...a,data:Xl(a.data)}}]),Ln.current?.damage([{cell:U.current.cell}]))},[Yn,U,Bn,Zn]),$n=g.useCallback((e,t)=>{let n=Ln.current?.getBounds(e,t);if(n===void 0||u.current===null)return;let r=Yn([e,t]);r.allowOverlay&&Zn({target:n,content:r,initialValue:void 0,highlight:!0,cell:[e,t],forceEditMode:!0})},[Yn,Zn]),er=g.useCallback((e,t,n=`both`,r=0,i=0,a=void 0)=>{if(u.current!==null){let o=Ln.current,c=s.current,l=typeof e==`number`?e:e.unit===`cell`?e.amount:void 0,d=typeof t==`number`?t:t.unit===`cell`?t.amount:void 0,f=typeof e!=`number`&&e.unit===`px`?e.amount:void 0,p=typeof t!=`number`&&t.unit===`px`?t.amount:void 0;if(o!==null&&c!==null){let s={x:0,y:0,width:0,height:0},m=0,h=0;if((l!==void 0||d!==void 0)&&(s=o.getBounds((l??0)+H,d??0)??s,s.width===0||s.height===0))return;let g=c.getBoundingClientRect(),_=g.width/c.offsetWidth;if(f!==void 0&&(s={...s,x:f-g.left-u.current.scrollLeft,width:1}),p!==void 0&&(s={...s,y:p+g.top-u.current.scrollTop,height:1}),s!==void 0){let o={x:s.x-r,y:s.y-i,width:s.width+2*r,height:s.height+2*i},c=0;for(let e=0;e0&&(l=Pa(zn,d,Nt));let f=c*_+g.left+H*Bt*_,p=g.right,v=g.top+xn*_,y=g.bottom-l*_,b=s.width+r*2;switch(a?.hAlign){case`start`:p=f+b;break;case`end`:f=p-b;break;case`center`:f=Math.floor((f+p)/2)-b/2,p=f+b}let x=s.height+i*2;switch(a?.vAlign){case`start`:y=v+x;break;case`end`:v=y-x;break;case`center`:v=Math.floor((v+y)/2)-x/2,y=v+x}f>o.x?m=o.x-f:po.y?h=o.y-v:y=zn-d)&&(h=0),(m!==0||h!==0)&&(_!==1&&(m/=_,h/=_),u.current.scrollTo(m+u.current.scrollLeft,h+u.current.scrollTop))}}}},[H,Ve,Bt,xn,B,vn,zn,Ut,Nt]),tr=g.useRef($n),or=g.useRef(x),cr=g.useRef(b);tr.current=$n,or.current=x,cr.current=b;let lr=g.useCallback(async(e,t=!0)=>{if(wn[e]?.trailingRowOptions?.disabled===!0)return;let n=me?.(),r,i=!0;n!==void 0&&(r=await n,r===`top`&&(i=!1),typeof r==`number`&&(i=!1));let a=0,o=()=>{if(cr.current<=b){a<500&&window.setTimeout(o,a),a=50+a*2;return}let n=typeof r==`number`?r:i?b:0;oi.current(e-H,n),un({cell:[e,n],range:{x:e,y:n,width:1,height:1}},!1,!1,`edit`);let s=or.current([e-H,n]);s.allowOverlay&&ir(s)&&s.readonly!==!0&&t&&window.setTimeout(()=>{tr.current(e,n)},0)};o()},[wn,me,H,b,un]),dr=g.useCallback(e=>{let t=vn[e]?.trailingRowOptions?.targetColumn??Be?.targetColumn;if(typeof t==`number`)return t+ +!!Vt;if(typeof t==`object`){let e=y.indexOf(t);if(e>=0)return e+ +!!Vt}},[vn,y,Vt,Be?.targetColumn]),fr=g.useRef(),pr=g.useRef(),mr=g.useCallback((e,t)=>{let[n,r]=t;return yo(pn,wn[n]?.themeOverride,m?.(r),e.themeOverride)},[m,wn,pn]),hr=g.useCallback(e=>{let t=rl.value?e.metaKey:e.ctrlKey,n=t&&R===`multi`,r=t&&_e===`multi`,[i,o]=e.location,s=U.columns,c=U.rows,[l,u]=U.current?.cell??[];if(e.kind===`cell`){if(pr.current=void 0,_r.current=[i,o],i===0&&Vt){if(Ht===!0&&o===b||Tt===`number`||R===`none`)return;let r=Yn(e.location);if(r.kind!==sr.Marker)return;if(ct!==void 0){let t=_n(r);Wt(t?.kind===sr.Marker);let n=t?.onClick?.({...e,cell:r,posX:e.localEventX,posY:e.localEventY,bounds:e.bounds,theme:mr(r,e.location),preventDefault:()=>void 0});if(n===void 0||n.checked===r.checked)return}a(void 0),Rn();let i=c.hasIndex(o),s=fr.current;if(R===`multi`&&(e.shiftKey||e.isLongTouch===!0)&&s!==void 0&&c.hasIndex(s)){let e=[Math.min(s,o),Math.max(s,o)+1];n||Ee===`multi`?dn(void 0,e,!0):dn(ur.fromSingleSelection(e),void 0,n)}else n||e.isTouch||Ee===`multi`?i?dn(c.remove(o),void 0,!0):(dn(void 0,o,!0),fr.current=o):i&&c.length===1?dn(ur.empty(),void 0,t):(dn(ur.fromSingleSelection(o),void 0,t),fr.current=o)}else if(i>=H&&Ht&&o===b){let e=dr(i);lr(e??i)}else if(l!==i||u!==o){let n=Yn(e.location),r=_n(n);if(r?.onSelect!==void 0){let t=!1;if(r.onSelect({...e,cell:n,posX:e.localEventX,posY:e.localEventY,bounds:e.bounds,preventDefault:()=>t=!0,theme:mr(n,e.location)}),t)return}let s=Ut&&o===b,c=Ut&&U!==void 0&&U.current?.cell[1]===b;if((e.shiftKey||e.isLongTouch===!0)&&l!==void 0&&u!==void 0&&U.current!==void 0&&!c){if(s)return;let e=Math.min(i,l),n=Math.max(i,l),r=Math.min(o,u),a=Math.max(o,u);un({...U.current,range:{x:e,y:r,width:n-e+1,height:a-r+1}},!0,t,`click`),fr.current=void 0,Rn()}else un({cell:[i,o],range:{x:i,y:o,width:1,height:1}},!0,t,`click`),fr.current=void 0,a(void 0),Rn()}}else if(e.kind===`header`){if(_r.current=[i,o],a(void 0),Vt&&i===0)fr.current=void 0,pr.current=void 0,R===`multi`&&(c.length===b?dn(ur.empty(),void 0,t):dn(ur.fromSingleSelection([0,b]),void 0,t),Rn());else{let n=pr.current;if(_e===`multi`&&(e.shiftKey||e.isLongTouch===!0)&&n!==void 0&&s.hasIndex(n)){let e=[Math.min(n,i),Math.max(n,i)+1];r?fn(void 0,e,t):fn(ur.fromSingleSelection(e),void 0,t)}else r?(s.hasIndex(i)?fn(s.remove(i),void 0,t):fn(void 0,i,t),pr.current=i):_e!==`none`&&(fn(ur.fromSingleSelection(i),void 0,t),pr.current=i);fr.current=void 0,Rn()}}else e.kind===`group-header`?_r.current=[i,o]:e.kind===`out-of-bounds`&&!e.isMaybeScrollbar&&(nn(xu,!1),a(void 0),Rn(),je?.(),fr.current=void 0,pr.current=void 0)},[lr,_e,Rn,_n,dr,Yn,U,Vt,Ut,je,ct,H,Tt,R,Ee,b,un,nn,fn,dn,Ht,mr]),gr=g.useRef(!1),_r=g.useRef(),vr=g.useRef(An),yr=g.useRef(),br=g.useCallback(e=>{if(wr.current=!1,vr.current=Dn.current,e.button!==0&&e.button!==1){yr.current=void 0;return}let t=performance.now();yr.current={button:e.button,time:t,location:e.location},e?.kind===`header`&&(gr.current=!0);let n=e.kind===`cell`&&e.isFillHandle;(n||e.kind===`cell`||!e.isEdge)&&(l({previousSelection:U,fillHandle:n}),_r.current=void 0,!e.isTouch&&e.button===0&&!n?hr(e):!e.isTouch&&e.button===1&&(_r.current=e.location))},[U,hr]),[xr,Sr]=g.useState(),Cr=g.useCallback(e=>{if(e.kind!==`group-header`||_e!==`multi`)return;let t=rl.value?e.metaKey:e.ctrlKey,[n]=e.location,r=U.columns;if(n=H&&Ta(i.group,wn[e].group);e--)a--;for(let e=n+1;e{if(Qt!==void 0&&rn!==void 0){let t=Dn.current.y,n=Dn.current.height,r=Qt({x:e,y:t,width:1,height:Math.min(n,b-t)},Zt.current.signal);typeof r!=`object`&&(r=await r());let i=vn[e-H],a=document.createElement(`canvas`).getContext(`2d`,{alpha:!1});if(a!==null){a.font=pn.baseFontFull;let t=So(a,pn,i,0,r,kt,At,!1,_n);rn?.(i,t.width,e,t.width)}}},[vn,Qt,At,pn,kt,rn,H,b,_n]),[Er,Dr]=g.useState(),Or=g.useCallback(async(e,t)=>{let n=e.current?.range;if(n===void 0||Qt===void 0||t.current===void 0)return;let r=t.current.range;if(w!==void 0){let e=!1;if(w({fillDestination:{...r,x:r.x-H},patternSource:{...n,x:n.x-H},preventDefault:()=>e=!0}),e)return}let i=Qt(n,Zt.current.signal);typeof i!=`object`&&(i=await i());let a=i,o=[];for(let e=0;e({cell:e.location})))},[Qt,Bn,w,H]),kr=g.useCallback(()=>{if(U.current===void 0||U.current.range.width<=1)return;let e={...U,current:{...U.current,range:{...U.current.range,width:1}}};Or(e,U)},[Or,U]),Ar=g.useCallback(()=>{if(U.current===void 0||U.current.range.height<=1)return;let e={...U,current:{...U.current,range:{...U.current.range,height:1}}};Or(e,U)},[Or,U]),jr=g.useCallback((e,t)=>{let n=c;if(l(void 0),Hn(void 0),Dr(void 0),gr.current=!1,t)return;if(n?.fillHandle===!0&&U.current!==void 0&&n.previousSelection?.current!==void 0){if(Vn===void 0)return;let e={...U,current:{...U.current,range:cs(n.previousSelection.current.range,Vn)}};Or(n.previousSelection,e),nn(e,!0);return}let[r,i]=e.location,[a,o]=_r.current??[],s=()=>{wr.current=!0},u=t=>{let c=t.isTouch||a===r&&o===i;if(c&&S?.([r-H,i],{...t,preventDefault:s}),t.button===1)return!wr.current;if(!wr.current){let a=Yn(e.location),o=_n(a);if(o!==void 0&&o.onClick!==void 0&&c){let n=o.onClick({...t,cell:a,posX:t.localEventX,posY:t.localEventY,bounds:t.bounds,theme:mr(a,e.location),preventDefault:s});n!==void 0&&!rr(n)&&nr(n)&&(Bn([{location:t.location,value:n}]),Ln.current?.damage([{cell:t.location}]))}if(wr.current||U.current===void 0)return!1;let l=!1;switch(a.activationBehaviorOverride??Te){case`double-click`:case`second-click`:{if(n?.previousSelection?.current?.cell===void 0)break;let[e,a]=U.current.cell,[o,s]=n.previousSelection.current.cell;l=r===e&&r===o&&i===a&&i===s&&(t.isDoubleClick===!0||Te===`second-click`);break}case`single-click`:l=!0}if(l)return C?.([r-H,i]),Qn(t.bounds,!1),!0}return!1},d=e.location[0]-H;if(e.isTouch){let t=Dn.current,n=vr.current;if(t.x!==n.x||t.y!==n.y)return;if(e.isLongTouch===!0){if(e.kind===`cell`&&Oa(U.current?.cell,e.location)){re?.([d,e.location[1]],{...e,preventDefault:s});return}if(e.kind===`header`&&U.columns.hasIndex(r)){ie?.(d,{...e,preventDefault:s});return}if(e.kind===`group-header`){if(d<0)return;ae?.(d,{...e,preventDefault:s});return}}e.kind===`cell`?u(e)||hr(e):e.kind===`group-header`?ne?.(d,{...e,preventDefault:s}):(e.kind===`header`&&A?.(d,{...e,preventDefault:s}),hr(e))}else{if(e.kind===`header`){if(d<0)return;e.isEdge?e.isDoubleClick===!0&&Tr(r):e.button===0&&r===a&&i===o&&A?.(d,{...e,preventDefault:s})}if(e.kind===`group-header`){if(d<0)return;e.button===0&&r===a&&i===o&&(ne?.(d,{...e,preventDefault:s}),wr.current||Cr(e))}e.kind===`cell`&&(e.button===0||e.button===1)&&u(e),_r.current=void 0}},[c,U,H,Vn,Or,nn,S,Yn,_n,Te,mr,Bn,C,Qn,re,ie,ae,hr,ne,A,Tr,Cr]),Mr=g.useCallback(e=>{let t={...e,location:[e.location[0]-H,e.location[1]]};z?.(t),c!==void 0&&e.buttons===0&&(l(void 0),Hn(void 0),Dr(void 0),gr.current=!1),Dr(t=>gr.current?[e.scrollEdge[0],0]:e.scrollEdge[0]===t?.[0]&&e.scrollEdge[1]===t[1]?t:c===void 0||(yr.current?.location[0]??0){De?.(e-H,t)},[De,H]),Pr=U?.current?.cell,Fr=g.useCallback((e,t,n,r,i,a)=>{kn.current=!1;let o=Pr;o!==void 0&&(o=[o[0]-H,o[1]]);let s=B===0?void 0:{x:0,y:e.y,width:B,height:e.height},c=[];s!==void 0&&c.push(s),Ve>0&&(c.push({x:e.x-H,y:b-Ve,width:e.width,height:Ve}),B>0&&c.push({x:0,y:b-Ve,width:B,height:Ve}));let l={x:e.x-H,y:e.y,width:e.width,height:Ht&&e.y+e.height>=b?e.height-1:e.height,tx:i,ty:a,extras:{selected:o,freezeRegion:s,freezeRegions:c}};Dn.current=l,jn(l),hn([t,n,r]),Ne?.(l,l.tx,l.ty,l.extras)},[Pr,H,Ht,b,B,Ve,jn,Ne]),Ir=Kr(he,g.useCallback((e,t)=>{he?.(e-H,t-H),_e!==`none`&&fn(ur.fromSingleSelection(t),void 0,!0)},[_e,he,H,fn])),Lr=g.useRef(!1),Rr=g.useCallback(e=>{e.location[0]===0&&H>0?e.preventDefault():(Se?.({...e,location:[e.location[0]-H,e.location[1]]}),e.defaultPrevented()||(Lr.current=!0),l(void 0))},[Se,H]),zr=g.useCallback(()=>{Lr.current=!1},[]),Br=g.useRef(),Vr=g.useCallback(e=>{if(!ll(e,Br.current)&&(Br.current=e,!(yr?.current?.button!==void 0&&yr.current.button>=1))){if(e.buttons!==0&&c!==void 0&&yr.current?.location[0]===0&&e.location[0]===0&&H===1&&R===`multi`&&c.previousSelection&&!c.previousSelection.rows.hasIndex(yr.current.location[1])&&U.rows.hasIndex(yr.current.location[1])){let t=Math.min(yr.current.location[1],e.location[1]),n=Math.max(yr.current.location[1],e.location[1])+1;dn(ur.fromSingleSelection([t,n]),void 0,!1)}if(e.buttons!==0&&c!==void 0&&U.current!==void 0&&!Lr.current&&!gr.current&&(L===`rect`||L===`multi-rect`)){let[t,n]=U.current.cell,[r,i]=e.location;if(i<0&&(i=Dn.current.y),c.fillHandle===!0&&c.previousSelection?.current!==void 0){let e=c.previousSelection.current.range;i=Math.min(i,Ht?b-1:b);let t=as(e,r,i,He);Hn(t)}else{if(Ht&&n===b)return;if(Ht&&i===b){if(e.kind===`out-of-bounds`)i--;else return}r=Math.max(r,H);let a=r-t,o=i-n,s={x:a>=0?t:r,y:o>=0?n:i,width:Math.abs(a)+1,height:Math.abs(o)+1};un({...U.current,range:s},!0,!1,`drag`)}}Ae?.({...e,location:[e.location[0]-H,e.location[1]]})}},[He,c,H,R,U,L,Ae,dn,Ht,b,un]);nu(Er,u,g.useCallback(()=>{let e=Br.current;if(e===void 0)return;let[t,n]=e.scrollEdge,[r,i]=e.location,a=Dn.current;t===-1?r=a.extras?.freezeRegion?.x??a.x:t===1&&(r=a.x+a.width),n===-1?i=Math.max(0,a.y):n===1&&(i=Math.min(b-1,a.y+a.height)),r=(0,Yc.default)(r,0,wn.length-1),i=(0,Yc.default)(i,0,b-1),Vr({...e,location:[r,i]})},[wn.length,Vr,b]));let Hr=g.useCallback(e=>{if(U.current===void 0)return;let[t,n]=e,[r,i]=U.current.cell,a=U.current.range,o=a.x,s=a.x+a.width,c=a.y,l=a.y+a.height;if(n!==0)switch(n){case 2:l=b,c=i,er(0,l,`vertical`);break;case-2:c=0,l=i+1,er(0,c,`vertical`);break;case 1:ci+1?(l--,er(0,l,`vertical`)):(c=Math.max(0,c-1),er(0,c,`vertical`));break;default:Gt(n)}if(t!==0){if(t===2)s=wn.length,o=r,er(s-1-H,0,`horizontal`);else if(t===-2)o=H,s=r+1,er(o-H,0,`horizontal`);else{let e=[];if(Qt!==void 0){let t=Qt({x:o,y:c,width:s-o-H,height:l-c},Zt.current.signal);typeof t==`object`&&(e=vu(t))}if(t===1){let t=!1;if(o0){let n=(0,ul.default)(o+1,r+1).find(t=>!e.includes(t-H));n!==void 0&&(o=n,t=!0)}else o++,t=!0;t&&er(o,0,`horizontal`)}t||(s=Math.min(wn.length,s+1),er(s-1-H,0,`horizontal`))}else if(t===-1){let t=!1;if(s>r+1){if(e.length>0){let n=(0,ul.default)(s-1,r,-1).find(t=>!e.includes(t-H));n!==void 0&&(s=n,t=!0)}else s--,t=!0;t&&er(s-H,0,`horizontal`)}t||(o=Math.max(H,o-1),er(o-H,0,`horizontal`))}else Gt(t)}}un({cell:U.current.cell,range:{x:o,y:c,width:s-o,height:l-c}},!0,!1,`keyboard-select`)},[Qt,U,wn.length,H,b,er,un]),Ur=g.useCallback((e,t,n,r)=>{let i=zn-+!n;if(e=(0,Yc.default)(e,H,vn.length-1+H),t=(0,Yc.default)(t,0,i),e===Pr?.[0]&&t===Pr?.[1])return!1;if(r&&U.current!==void 0){let n=[...U.current.rangeStack];(U.current.range.width>1||U.current.range.height>1)&&n.push(U.current.range),nn({...U,current:{cell:[e,t],range:{x:e,y:t,width:1,height:1},rangeStack:n}},!0)}else un({cell:[e,t],range:{x:e,y:t,width:1,height:1}},!0,!1,`keyboard-nav`);return d.current!==void 0&&d.current[0]===e&&d.current[1]===t&&(d.current=void 0),er(e-H,t),!0},[zn,H,vn.length,Pr,U,er,nn,un]),qr=g.useCallback((e,t)=>{i?.cell!==void 0&&e!==void 0&&nr(e)&&(Bn([{location:i.cell,value:e}]),window.requestAnimationFrame(()=>{Ln.current?.damage([{cell:i.cell}])})),Rn(!0),a(void 0);let[n,r]=t;if(U.current!==void 0&&(n!==0||r!==0)){let t=U.current.cell[1]===zn-1&&e!==void 0;Ur((0,Yc.default)(U.current.cell[0]+n,0,wn.length-1),(0,Yc.default)(U.current.cell[1]+r,0,zn-1),t,!1)}T?.(e,t)},[i?.cell,Rn,U,T,Bn,zn,Ur,wn.length]),Jr=g.useMemo(()=>`gdg-overlay-${_u++}`,[]),Yr=g.useCallback(e=>{Rn();let t=[];for(let n=e.x;n({cell:e.location})))},[Rn,x,_n,Bn,H]),Xr=i!==void 0,Zr=g.useCallback(e=>{let t=()=>{e.stopPropagation(),e.preventDefault()},n={didMatch:!1},{bounds:r}=e,i=U.columns,s=U.rows,c=zt;if(!Xr&&Ml(c.clear,e,n))nn(xu,!1),je?.();else if(!Xr&&Ml(c.selectAll,e,n))nn({columns:ur.empty(),rows:ur.empty(),current:{cell:U.current?.cell??[H,0],range:{x:H,y:0,width:y.length,height:b},rangeStack:[]}},!1);else if(Ml(c.search,e,n))o?.current?.focus({preventScroll:!0}),Jt(!0);else if(Ml(c.delete,e,n)){let e=ln?.(U)??!0;if(e!==!1){let t=e===!0?U:e;if(t.current!==void 0){Yr(t.current.range);for(let e of t.current.rangeStack)Yr(e)}for(let e of t.rows)Yr({x:H,y:e,width:y.length,height:1});for(let e of t.columns)Yr({x:e,y:0,width:1,height:b})}}if(n.didMatch)return t(),!0;if(U.current===void 0)return!1;let[l,u]=U.current.cell,d=!1,f=!1;Ml(c.scrollToSelectedCell,e,n)?oi.current(l-H,u):_e!==`none`&&Ml(c.selectColumn,e,n)?i.hasIndex(l)?fn(i.remove(l),void 0,!0):_e===`single`?fn(ur.fromSingleSelection(l),void 0,!0):fn(void 0,l,!0):R!==`none`&&Ml(c.selectRow,e,n)?s.hasIndex(u)?dn(s.remove(u),void 0,!0):R===`single`?dn(ur.fromSingleSelection(u),void 0,!0):dn(void 0,u,!0):!Xr&&r!==void 0&&Ml(c.activateCell,e,n)?u===b&&Ht?window.setTimeout(()=>{let e=dr(l);lr(e??l)},0):(C?.([l-H,u]),Qn(r,!0)):U.current.range.height>1&&Ml(c.downFill,e,n)?Ar():U.current.range.width>1&&Ml(c.rightFill,e,n)?kr():Ml(c.goToNextPage,e,n)?u+=Math.max(1,Dn.current.height-4):Ml(c.goToPreviousPage,e,n)?u-=Math.max(1,Dn.current.height-4):Ml(c.goToFirstCell,e,n)?(a(void 0),u=0,l=0):Ml(c.goToLastCell,e,n)?(a(void 0),u=2**53-1,l=2**53-1):Ml(c.selectToFirstCell,e,n)?(a(void 0),Hr([-2,-2])):Ml(c.selectToLastCell,e,n)?(a(void 0),Hr([2,2])):Xr?(Ml(c.closeOverlay,e,n)&&a(void 0),Ml(c.acceptOverlayDown,e,n)&&(a(void 0),u++),Ml(c.acceptOverlayUp,e,n)&&(a(void 0),u--),Ml(c.acceptOverlayLeft,e,n)&&(a(void 0),l--),Ml(c.acceptOverlayRight,e,n)&&(a(void 0),l++)):(Ml(c.goDownCell,e,n)?u+=1:Ml(c.goUpCell,e,n)?--u:Ml(c.goRightCell,e,n)?l+=1:Ml(c.goLeftCell,e,n)?--l:Ml(c.goDownCellRetainSelection,e,n)?(u+=1,d=!0):Ml(c.goUpCellRetainSelection,e,n)?(--u,d=!0):Ml(c.goRightCellRetainSelection,e,n)?(l+=1,d=!0):Ml(c.goLeftCellRetainSelection,e,n)?(--l,d=!0):Ml(c.goToLastRow,e,n)?u=b-1:Ml(c.goToFirstRow,e,n)?u=-(2**53-1):Ml(c.goToLastColumn,e,n)?l=2**53-1:Ml(c.goToFirstColumn,e,n)?l=-(2**53-1):(L===`rect`||L===`multi-rect`)&&(Ml(c.selectGrowDown,e,n)?Hr([0,1]):Ml(c.selectGrowUp,e,n)?Hr([0,-1]):Ml(c.selectGrowRight,e,n)?Hr([1,0]):Ml(c.selectGrowLeft,e,n)?Hr([-1,0]):Ml(c.selectToLastRow,e,n)?Hr([0,2]):Ml(c.selectToFirstRow,e,n)?Hr([0,-2]):Ml(c.selectToLastColumn,e,n)?Hr([2,0]):Ml(c.selectToFirstColumn,e,n)&&Hr([-2,0])),f=n.didMatch);let p=Ur(l,u,!1,d),m=n.didMatch;return m&&(p||!f||mt)&&t(),m},[Xr,U,zt,_e,R,L,H,b,Ur,nn,je,y.length,ln,mt,Yr,fn,dn,Ht,dr,lr,C,Qn,Ar,kr,Hr]),Qr=g.useCallback(e=>{let t=!1;if(ue!==void 0&&ue({...e,cancel:()=>{t=!0}}),t||Zr(e)||U.current===void 0)return;let[n,r]=U.current.cell,i=Dn.current;if(pe&&!e.metaKey&&!e.ctrlKey&&U.current!==void 0&&e.key.length===1&&/[ -~]/g.test(e.key)&&e.bounds!==void 0&&ir(x([n-H,Math.max(0,Math.min(r,b-1))]))){if((!Ht||r!==b)&&(i.y>r||r>i.y+i.height||i.x>n||n>i.x+i.width))return;Qn(e.bounds,!0,e.key),e.stopPropagation(),e.preventDefault()}},[pe,ue,Zr,U,x,H,b,Ht,Qn]),$r=g.useCallback((e,t)=>{let n=e.location[0]-H;if(e.kind===`header`&&ie?.(n,{...e,preventDefault:t}),e.kind===`group-header`){if(n<0)return;ae?.(n,{...e,preventDefault:t})}if(e.kind===`cell`){let[r,i]=e.location;re?.([n,i],{...e,preventDefault:t}),wa(U,e.location)||Ur(r,i,!1,!1)}},[U,re,ae,ie,H,Ur]),ei=g.useCallback(async e=>{if(!zt.paste)return;function t(e,t,n,r){let i=typeof n==`object`?n?.join(` +`)??``:n?.toString()??``;if(!rr(e)&&ir(e)&&e.readonly!==!0){let a=E?.(i,e);if(a!==void 0&&nr(a))return{location:t,value:a};let o=_n(e);if(o===void 0)return;if(o.kind===W.Custom){Wt(e.kind===W.Custom);let n=o.onPaste?.(i,e.data);return n===void 0?void 0:{location:t,value:{...e,data:n}}}{let a=o.onPaste?.(i,e,{formatted:r,formattedString:typeof r==`string`?r:r?.join(` +`),rawValue:n});return a===void 0?void 0:(Wt(a.kind===e.kind),{location:t,value:a})}}}let n=U.columns,r=U.rows,i=u.current?.contains(document.activeElement)===!0||s.current?.contains(document.activeElement)===!0,a;if(U.current===void 0?n.length===1?a=[n.first()??0,0]:r.length===1&&(a=[H,r.first()??0]):a=[U.current.range.x,U.current.range.y],i&&a!==void 0){let n,r,i=`text/plain`,o=`text/html`;if(navigator.clipboard.read!==void 0){let e=await navigator.clipboard.read();for(let t of e){if(t.types.includes(o)){let e=Gl(await(await t.getType(o)).text());if(e!==void 0){n=e;break}}t.types.includes(i)&&(r=await(await t.getType(i)).text())}}else if(navigator.clipboard.readText!==void 0)r=await navigator.clipboard.readText();else if(e!==void 0&&e?.clipboardData!==null)e.clipboardData.types.includes(o)&&(n=Gl(e.clipboardData.getData(o))),n===void 0&&e.clipboardData.types.includes(i)&&(r=e.clipboardData.getData(i));else return;let[s,c]=a,l=[];do if(Ce===void 0){let e=Yn(a),i=r??n?.map(e=>e.map(e=>e.rawValue).join(` `)).join(` `)??``,o=t(e,a,i,void 0);o!==void 0&&l.push(o)}else{if(n===void 0){if(r===void 0)return;n=Jl(r)}if(Ce===!1||typeof Ce==`function`&&Ce?.([a[0]-H,a[1]],n.map(e=>e.map(e=>e.rawValue?.toString()??``)))!==!0)return;for(let[e,r]of n.entries()){if(e+c>=b)break;for(let[n,i]of r.entries()){let r=[n+s,e+c],[a,o]=r;if(a>=wn.length||o>=zn)continue;let u=t(Yn(r),r,i.rawValue,i.formatted);u!==void 0&&l.push(u)}}}while(0);Bn(l),Ln.current?.damage(l.map(e=>({cell:e.location})))}},[E,_n,Yn,U,zt.paste,wn.length,Bn,zn,Ce,H,b]);Gr(`paste`,ei,f,!1,!0);let ti=g.useCallback(async(e,t)=>{if(!zt.copy)return;let n=t===!0||u.current?.contains(document.activeElement)===!0||s.current?.contains(document.activeElement)===!0,r=U.columns,i=U.rows,a=(t,n)=>{Yl(we?[n.map(e=>({kind:W.Text,data:y[e].title,displayData:y[e].title,allowOverlay:!1})),...t]:t,n,e)};if(n&&Qt!==void 0){if(U.current!==void 0){let e=Qt(U.current.range,Zt.current.signal);typeof e!=`object`&&(e=await e()),a(e,(0,ul.default)(U.current.range.x-H,U.current.range.x+U.current.range.width-H))}else if(i!==void 0&&i.length>0){let e=[...i].map(e=>{let t=Qt({x:H,y:e,width:y.length,height:1},Zt.current.signal);return typeof t==`object`?t[0]:t().then(e=>e[0])});e.some(e=>e instanceof Promise)?a(await Promise.all(e),(0,ul.default)(y.length)):a(e,(0,ul.default)(y.length))}else if(r.length>0){let e=[],t=[];for(let n of r){let r=Qt({x:n,y:0,width:1,height:b},Zt.current.signal);typeof r!=`object`&&(r=await r()),e.push(r),t.push(n-H)}e.length===1?a(e[0],t):a(e.reduce((e,t)=>e.map((e,n)=>[...e,...t[n]])),t)}}},[y,Qt,U,zt.copy,H,b,we]);Gr(`copy`,ti,f,!1,!1),Gr(`cut`,g.useCallback(async e=>{if(zt.cut&&(u.current?.contains(document.activeElement)===!0||s.current?.contains(document.activeElement)===!0)&&(await ti(e),U.current!==void 0)){let e={current:{cell:U.current.cell,range:U.current.range,rangeStack:[]},rows:ur.empty(),columns:ur.empty()},t=ln?.(e);if(t===!1||(e=t===!0?e:t,e.current===void 0))return;Yr(e.current.range)}},[Yr,U,zt.cut,ti,ln]),f,!1,!1);let ni=g.useCallback((e,t)=>{if(se!==void 0){H!==0&&(e=e.map(e=>[e[0]-H,e[1]])),se(e,t);return}if(e.length===0||t===-1)return;let[n,r]=e[t];(d.current===void 0||d.current[0]!==n||d.current[1]!==r)&&(d.current=[n,r],Ur(n,r,!1,!1))},[se,H,Ur]),[ri,ii]=Pe?.current?.cell??[],oi=g.useRef(er);oi.current=er,g.useLayoutEffect(()=>{kn.current||ri===void 0||ii===void 0||ri===tn.current?.current?.cell[0]&&ii===tn.current?.current?.cell[1]||oi.current(ri,ii),kn.current=!1},[ri,ii]);let ci=U.current!==void 0&&(U.current.cell[0]>=wn.length||U.current.cell[1]>=zn);g.useLayoutEffect(()=>{ci&&nn(xu,!1)},[ci,nn]);let li=g.useMemo(()=>Ht===!0&&Be?.tint===!0?ur.fromSingleSelection(zn-1):ur.empty(),[zn,Ht,Be?.tint]),ui=g.useCallback(e=>typeof Ge==`boolean`?Ge:Ge?.(e-H)??!0,[H,Ge]),di=g.useMemo(()=>{if(xr===void 0||s.current===null)return null;let{bounds:e,group:t}=xr,n=s.current.getBoundingClientRect();return g.createElement(Al,{bounds:e,group:t,canvasBounds:n,onClose:()=>Sr(void 0),onFinish:e=>{Sr(void 0),N?.(t,e)}})},[N,xr]),fi=Math.min(wn.length,B+ +!!Vt);g.useImperativeHandle(t,()=>({appendRow:(e,t)=>lr(e+H,t),updateCells:e=>(H!==0&&(e=e.map(e=>({cell:[e.cell[0]+H,e.cell[1]]}))),Ln.current?.damage(e)),getBounds:(e,t)=>{if(s?.current!==null&&u?.current!==null){if(e===void 0&&t===void 0){let e=s.current.getBoundingClientRect(),t=e.width/u.current.clientWidth;return{x:e.x-u.current.scrollLeft*t,y:e.y-u.current.scrollTop*t,width:u.current.scrollWidth*t,height:u.current.scrollHeight*t}}return Ln.current?.getBounds((e??0)+H,t)}},focus:()=>Ln.current?.focus(),emit:async e=>{switch(e){case`delete`:Qr({bounds:void 0,cancel:()=>void 0,stopPropagation:()=>void 0,preventDefault:()=>void 0,ctrlKey:!1,key:`Delete`,keyCode:46,metaKey:!1,shiftKey:!1,altKey:!1,rawEvent:void 0,location:void 0});break;case`fill-right`:Qr({bounds:void 0,cancel:()=>void 0,stopPropagation:()=>void 0,preventDefault:()=>void 0,ctrlKey:!0,key:`r`,keyCode:82,metaKey:!1,shiftKey:!1,altKey:!1,rawEvent:void 0,location:void 0});break;case`fill-down`:Qr({bounds:void 0,cancel:()=>void 0,stopPropagation:()=>void 0,preventDefault:()=>void 0,ctrlKey:!0,key:`d`,keyCode:68,metaKey:!1,shiftKey:!1,altKey:!1,rawEvent:void 0,location:void 0});break;case`copy`:await ti(void 0,!0);break;case`paste`:await ei()}},scrollTo:er,remeasureColumns:e=>{for(let t of e)Tr(t+H)}}),[lr,Tr,ti,Qr,ei,H,er]);let[pi,mi]=Pr??[],hi=g.useCallback(e=>{let[t,n]=e;n===-1?_e!==`none`&&(fn(ur.fromSingleSelection(t),void 0,!1),Rn()):(pi!==t||mi!==n)&&(un({cell:e,range:{x:t,y:n,width:1,height:1}},!0,!1,`keyboard-nav`),er(t,n))},[_e,Rn,er,pi,mi,un,fn]),[gi,_i]=g.useState(!1),vi=g.useRef((0,Wr.default)(e=>{_i(e)},5)),yi=g.useCallback(()=>{vi.current(!0),U.current===void 0&&U.columns.length===0&&U.rows.length===0&&c===void 0&&un({cell:[H,In],range:{x:H,y:In,width:1,height:1}},!0,!1,`keyboard-select`)},[In,U,c,H,un]),bi=g.useCallback(()=>{vi.current(!1)},[]),[xi,Si]=g.useMemo(()=>{let e,t=et?.scrollbarWidthOverride??ai(),n=b+ +!!Ht;if(typeof Nt==`number`)e=xn+n*Nt;else{let t=0,r=Math.min(n,10);for(let e=0;et.width+e,0)+t;return[`${Math.min(1e5,r)}px`,`${Math.min(1e5,e)}px`]},[wn,et?.scrollbarWidthOverride,Nt,b,Ht,xn]),Ci=g.useMemo(()=>ho(pn),[pn]);return g.createElement(vo.Provider,{value:pn},g.createElement($l,{style:Ci,className:j,inWidth:_??xi,inHeight:v??Si},g.createElement(Dl,{fillHandle:Qe,drawFocusRing:$e,experimental:et,fixedShadowX:tt,fixedShadowY:nt,getRowThemeOverride:m,headerIcons:rt,imageWindowLoader:it,initialSize:at,isDraggable:ot,onDragLeave:st,onRowMoved:ct,overscrollX:Lt,overscrollY:Rt,preventDiagonalScrolling:dt,rightElement:ft,rightElementProps:pt,smoothScrollX:ht,smoothScrollY:gt,className:j,enableGroups:bn,onCanvasFocused:yi,onCanvasBlur:bi,canvasRef:s,onContextMenu:$r,theme:pn,cellXOffset:Fn,cellYOffset:In,accessibilityHeight:An.height,onDragEnd:zr,columns:wn,nonGrowWidth:yn,drawHeader:sn,onColumnProposeMove:ee,drawCell:cn,disabledRows:li,freezeColumns:fi,lockColumns:H,firstColAccessible:H===0,getCellContent:Yn,minColumnWidth:kt,maxColumnWidth:At,searchInputRef:o,showSearch:Yt,onSearchClose:Xt,highlightRegions:qn,getCellsForSelection:Qt,getGroupDetails:Xn,headerHeight:Pt,isFocused:gi,groupHeaderHeight:bn?Ft:0,freezeTrailingRows:Ve+(Ht&&Be?.sticky===!0?1:0),hasAppendRow:Ht,onColumnResize:rn,onColumnResizeEnd:an,onColumnResizeStart:on,onCellFocused:hi,onColumnMoved:Ir,onDragStart:Rr,onHeaderMenuClick:Nr,onItemHovered:Vr,isFilling:c?.fillHandle===!0,onMouseMove:Mr,onKeyDown:Qr,onKeyUp:de,onMouseDown:br,onMouseUp:jr,onDragOverCell:Ke,onDrop:qe,onSearchResultsChanged:ni,onVisibleRegionChanged:Fr,clientSize:mn,rowHeight:Nt,searchResults:ce,searchValue:le,onSearchValueChange:F,rows:zn,scrollRef:u,selection:U,translateX:An.tx,translateY:An.ty,verticalBorder:ui,gridRef:Ln,getCellRenderer:_n}),di,i!==void 0&&g.createElement(g.Suspense,{fallback:null},g.createElement(gu,{...i,validateCell:en,bloom:k,id:Jr,getCellRenderer:_n,className:et?.isSubGrid===!0?`click-outside-ignore`:void 0,provideEditor:ze,imageEditorOverride:p,onFinishEditing:qr,markdownDivCreateNode:h,isOutsideClick:St}))))}),Cu=20,wu={getAccessibilityString:e=>e.data?.toString()??`false`,kind:W.Boolean,needsHover:!0,useLabel:!1,needsHoverPosition:!0,measure:()=>50,draw:e=>Tu(e,e.cell.data,or(e.cell),e.cell.maxSize??Cu),onDelete:e=>({...e,data:!1}),onClick:e=>{let{cell:t,posX:n,posY:r,bounds:i,theme:a}=e,{width:o,height:s,x:c,y:l}=i,u=t.maxSize??Cu,d=Math.floor(i.y+s/2),f=Zr(u,s,a.cellVerticalPadding),p=Yr(Xr(t.contentAlign??`center`,c,o,a.cellHorizontalPadding,f),d,f),m=Qr(c+n,l+r,p);if(or(t)&&m)return{...t,data:Xl(t.data)}},onPaste:(e,t)=>{let n=null;return e.toLowerCase()===`true`?n=!0:e.toLowerCase()===`false`?n=!1:e.toLowerCase()===`indeterminate`&&(n=void 0),n===t.data?void 0:{...t,data:n}}};function Tu(e,t,n,r){if(!n&&t===null)return;let{ctx:i,hoverAmount:a,theme:o,rect:s,highlighted:c,hoverX:l,hoverY:u,cell:{contentAlign:d}}=e,{x:f,y:p,width:m,height:h}=s,g=n?.65+.35*a:.4;t===null&&(g*=a),g!==0&&(i.globalAlpha=g,bs(i,o,t,f,p,m,h,c,l,u,r,d),i.globalAlpha=1)}var Eu=br(`div`)({name:`BubblesOverlayEditorStyle`,class:`gdg-b1ygi5by`,propsAsIs:!1}),Du=e=>{let{bubbles:t}=e;return g.createElement(Eu,null,t.map((e,t)=>g.createElement(`div`,{key:t,className:`boe-bubble`},e)),g.createElement(`textarea`,{className:`gdg-input`,autoFocus:!0}))},Ou={getAccessibilityString:e=>ci(e.data),kind:W.Bubble,needsHover:!1,useLabel:!1,needsHoverPosition:!1,measure:(e,t,n)=>t.data.reduce((t,n)=>e.measureText(n).width+t+20,0)+2*n.cellHorizontalPadding-4,draw:e=>Au(e,e.cell.data),provideEditor:()=>e=>{let{value:t}=e;return g.createElement(Du,{bubbles:t.data})},onPaste:()=>void 0},ku=4;function Au(e,t){let{rect:n,theme:r,ctx:i,highlighted:a}=e,{x:o,y:s,width:c,height:l}=n,u=ku,d=o+r.cellHorizontalPadding,f=[];for(let e of t){if(d>o+c)break;let t=Ua(e,i,r.baseFontFull).width;f.push({x:d,width:t}),d+=t+16+u}i.beginPath();for(let e of f)no(i,e.x,s+(l-20)/2,e.width+16,20,r.roundingRadius??10);i.fillStyle=a?r.bgBubbleSelected:r.bgBubble,i.fill();for(let[e,n]of f.entries())i.beginPath(),i.fillStyle=r.textBubble,i.fillText(t[e],n.x+8,s+l/2+Ga(i,r))}var ju=br(`div`)({name:`DrilldownOverlayEditorStyle`,class:`gdg-d4zsq0x`,propsAsIs:!1}),Mu=e=>{let{drilldowns:t}=e;return g.createElement(ju,null,t.map((e,t)=>g.createElement(`div`,{key:t,className:`doe-bubble`},e.img!==void 0&&g.createElement(`img`,{src:e.img}),g.createElement(`div`,null,e.text))))},Nu={getAccessibilityString:e=>ci(e.data.map(e=>e.text)),kind:W.Drilldown,needsHover:!1,useLabel:!1,needsHoverPosition:!1,measure:(e,t,n)=>t.data.reduce((t,n)=>e.measureText(n.text).width+t+20+(n.img===void 0?0:18),0)+2*n.cellHorizontalPadding-4,draw:e=>Lu(e,e.cell.data),provideEditor:()=>e=>{let{value:t}=e;return g.createElement(Mu,{drilldowns:t.data})},onPaste:()=>void 0},Pu=4,Fu={};function Iu(e,t,n,r){let i=Math.ceil(window.devicePixelRatio),a=n-10,o=n*i,s=r+5,c=r*3,l=(c+10)*i,u=`${e},${t},${i},${n}`;if(Fu[u]!==void 0)return{el:Fu[u],height:o,width:l,middleWidth:4*i,sideWidth:s*i,padding:5*i,dpr:i};let d=document.createElement(`canvas`),f=d.getContext(`2d`);return f===null?null:(d.width=l,d.height=o,f.scale(i,i),Fu[u]=d,f.beginPath(),no(f,5,5,c,a,r),f.shadowColor=`rgba(24, 25, 34, 0.4)`,f.shadowBlur=1,f.fillStyle=e,f.fill(),f.shadowColor=`rgba(24, 25, 34, 0.3)`,f.shadowOffsetY=1,f.shadowBlur=5,f.fillStyle=e,f.fill(),f.shadowOffsetY=0,f.shadowBlur=0,f.shadowBlur=0,f.beginPath(),no(f,5.5,5.5,c,a,r),f.strokeStyle=t,f.lineWidth=1,f.stroke(),{el:d,height:o,width:l,sideWidth:s*i,middleWidth:r*i,padding:5*i,dpr:i})}function Lu(e,t){let{rect:n,theme:r,ctx:i,imageLoader:a,col:o,row:s}=e,{x:c,width:l}=n,u=r.baseFontFull,d=Qa(i,u),f=Math.min(n.height,Math.max(16,Math.ceil(d*r.lineHeight)*2)),p=Math.floor(n.y+(n.height-f)/2),m=f-10,h=Pu,g=c+r.cellHorizontalPadding,_=r.roundingRadius??6,v=Iu(r.bgCell,r.drilldownBorder,f,_),y=[];for(let e of t){if(g>c+l)break;let t=Ua(e.text,i,u).width,n=0;e.img!==void 0&&a.loadOrGetImage(e.img,o,s)!==void 0&&(n=m-8+4);let r=t+n+16;y.push({x:g,width:r}),g+=r+h}if(v!==null){let{el:e,height:t,middleWidth:n,sideWidth:r,width:a,dpr:o,padding:s}=v,c=r/o,l=s/o;for(let o of y){let s=Math.floor(o.x),u=Math.floor(o.width),d=u-(c-l)*2;i.imageSmoothingEnabled=!1,i.drawImage(e,0,0,r,t,s-l,p,c,f),d>0&&i.drawImage(e,r,0,n,t,s+(c-l),p,d,f),i.drawImage(e,a-r,0,r,t,s+u-(c-l),p,c,f),i.imageSmoothingEnabled=!0}}i.beginPath();for(let[e,n]of y.entries()){let c=t[e],l=n.x+8;if(c.img!==void 0){let e=a.loadOrGetImage(c.img,o,s);if(e!==void 0){let t=m-8,n=0,a=0,o=e.width,s=e.height;o>s?(n+=(o-s)/2,o=s):s>o&&(a+=(s-o)/2,s=o),i.beginPath(),no(i,l,p+f/2-t/2,t,t,r.roundingRadius??3),i.save(),i.clip(),i.drawImage(e,n,a,o,s,l,p+f/2-t/2,t,t),i.restore(),l+=t+4}}i.beginPath(),i.fillStyle=r.textBubble,i.fillText(c.text,l,p+f/2+Ga(i,r))}}var Ru={getAccessibilityString:e=>e.data.join(`, `),kind:W.Image,needsHover:!1,useLabel:!1,needsHoverPosition:!1,draw:e=>Bu(e,e.cell.displayData??e.cell.data,e.cell.rounding??e.theme.roundingRadius??4,e.cell.contentAlign),measure:(e,t)=>t.data.length*50,onDelete:e=>({...e,data:[]}),provideEditor:()=>e=>{let{value:t,onFinishedEditing:n,imageEditorOverride:r}=e,i=r??di;return g.createElement(i,{urls:t.data,canWrite:t.readonly!==!1,onCancel:n,onChange:e=>{n({...t,data:[e]})}})},onPaste:(e,t)=>{e=e.trim();let n=e.split(`,`).map(e=>{try{return new URL(e),e}catch{return}}).filter(e=>e!==void 0);if(!(n.length===t.data.length&&n.every((e,n)=>e===t.data[n])))return{...t,data:n}}},zu=4;function Bu(e,t,n,r){let{rect:i,col:a,row:o,theme:s,ctx:c,imageLoader:l}=e,{x:u,y:d,height:f,width:p}=i,m=f-s.cellVerticalPadding*2,h=[],g=0;for(let e=0;e0&&(c.beginPath(),no(c,_,d+s.cellVerticalPadding,t,m,n),c.save(),c.clip()),c.drawImage(e,_,d+s.cellVerticalPadding,t,m),n>0&&c.restore(),_+=t+zu}}function Vu(e,t){let n=e*49632+t*325176;return n^=n<<13,n^=n>>17,n^=n<<5,n/4294967295*2}var Hu={getAccessibilityString:()=>``,kind:W.Loading,needsHover:!1,useLabel:!1,needsHoverPosition:!1,measure:()=>120,draw:e=>{let{cell:t,col:n,row:r,ctx:i,rect:a,theme:o}=e;if(t.skeletonWidth===void 0||t.skeletonWidth===0)return;let s=t.skeletonWidth;t.skeletonWidthVariability!==void 0&&t.skeletonWidthVariability>0&&(s+=Math.round(Vu(n,r)*t.skeletonWidthVariability));let c=o.cellHorizontalPadding,l=t.skeletonHeight??Math.min(18,a.height-2*o.cellVerticalPadding);no(i,a.x+c,a.y+(a.height-l)/2,s,l,o.roundingRadius??3),i.fillStyle=ua(o.textDark,.1),i.fill()},onPaste:()=>void 0},Uu=br(`div`)({name:`MarkdownOverlayEditorStyle`,class:`gdg-m1pnx84e`,propsAsIs:!1,vars:{"m1pnx84e-0":[e=>e.targetWidth,`px`]}}),Wu=e=>{let{value:t,onChange:n,forceEditMode:r,createNode:i,targetRect:a,onFinish:o,validatedSelection:s}=e,c=t.data,l=t.readonly===!0,[u,d]=g.useState(c===``||r),f=g.useCallback(()=>{d(e=>!e)},[]),p=c?`gdg-ml-6`:``;return u?g.createElement(Uu,{targetWidth:a.width-20},g.createElement(aa,{autoFocus:!0,highlight:!1,validatedSelection:s,value:c,onKeyDown:e=>{e.key===`Enter`&&e.stopPropagation()},onChange:n}),g.createElement(`div`,{className:`gdg-edit-icon gdg-checkmark-hover ${p}`,onClick:()=>o(t)},g.createElement(ei,null))):g.createElement(Uu,{targetWidth:a.width},g.createElement(ea,{contents:c,createNode:i}),!l&&g.createElement(g.Fragment,null,g.createElement(`div`,{className:`spacer`}),g.createElement(`div`,{className:`gdg-edit-icon gdg-edit-hover ${p}`,onClick:f},g.createElement($r,null))),g.createElement(`textarea`,{className:`gdg-md-edit-textarea gdg-input`,autoFocus:!0}))},Gu={getAccessibilityString:e=>e.data?.toString()??``,kind:W.Markdown,needsHover:!1,needsHoverPosition:!1,drawPrep:Xa,measure:(e,t,n)=>{let r=t.data.split(` +`)[0];return e.measureText(r).width+2*n.cellHorizontalPadding},draw:e=>to(e,e.cell.data,e.cell.contentAlign),onDelete:e=>({...e,data:``}),provideEditor:()=>e=>{let{onChange:t,value:n,target:r,onFinishedEditing:i,markdownDivCreateNode:a,forceEditMode:o,validatedSelection:s}=e;return g.createElement(Wu,{onFinish:i,targetRect:r,value:n,validatedSelection:s,onChange:e=>t({...n,data:e.target.value}),forceEditMode:o,createNode:a})},onPaste:(e,t)=>e===t.data?void 0:{...t,data:e}},Ku={getAccessibilityString:e=>e.row.toString(),kind:sr.Marker,needsHover:!0,needsHoverPosition:!1,drawPrep:qu,measure:()=>44,draw:e=>Yu(e,e.cell.row,e.cell.checked,e.cell.markerKind,e.cell.drawHandle,e.cell.checkboxStyle),onClick:e=>{let{bounds:t,cell:n,posX:r,posY:i}=e,{width:a,height:o}=t,s=n.drawHandle?7+(a-7)/2:a/2,c=o/2;if(Math.abs(r-s)<=10&&Math.abs(i-c)<=10)return{...n,checked:!n.checked}},onPaste:()=>void 0};function qu(e,t){let{ctx:n,theme:r}=e,i=r.markerFontFull,a=t??{};return a?.font!==i&&(n.font=i,a.font=i),a.deprep=Ju,n.textAlign=`center`,a}function Ju(e){let{ctx:t}=e;t.textAlign=`start`}function Yu(e,t,n,r,i,a){let{ctx:o,rect:s,hoverAmount:c,theme:l}=e,{x:u,y:d,width:f,height:p}=s,m=n?1:r===`checkbox-visible`?.6+.4*c:c;if(r!==`number`&&m>0){o.globalAlpha=m;let e=7*(n?c:1);if(bs(o,l,n,i?u+e:u,d,i?f-e:f,p,!0,void 0,void 0,18,`center`,a),i){o.globalAlpha=c,o.beginPath();for(let e of[3,6])for(let t of[-5,-1,3])o.rect(u+e,d+p/2+t,2,2);o.fillStyle=l.textLight,o.fill(),o.beginPath()}o.globalAlpha=1}if(r===`number`||r===`both`&&!n){let e=t.toString(),n=l.markerFontFull,i=u+f/2;r===`both`&&c!==0&&(o.globalAlpha=1-c),o.fillStyle=l.textLight,o.font=n,o.fillText(e,i,d+p/2+Ga(o,n)),c!==0&&(o.globalAlpha=1)}}var Xu={getAccessibilityString:()=>``,kind:sr.NewRow,needsHover:!0,needsHoverPosition:!1,measure:()=>200,draw:e=>Zu(e,e.cell.hint,e.cell.icon),onPaste:()=>void 0};function Zu(e,t,n){let{ctx:r,rect:i,hoverAmount:a,theme:o,spriteManager:s}=e,{x:c,y:l,width:u,height:d}=i;r.beginPath(),r.globalAlpha=a,r.rect(c+1,l+1,u,d-2),r.fillStyle=o.bgHeaderHovered,r.fill(),r.globalAlpha=1,r.beginPath();let f=t!==``,p=0;if(n!==void 0){let e=d-8,t=c+4,i=l+4;s.drawSprite(n,`normal`,r,t,i,e,o,f?1:a),p=e}else{p=24;let e=f?12:a*12,t=f?0:(1-a)*12*.5,n=o.cellHorizontalPadding+4;e>0&&(r.moveTo(c+n+t,l+d/2),r.lineTo(c+n+t+e,l+d/2),r.moveTo(c+n+t+e*.5,l+d/2-e*.5),r.lineTo(c+n+t+e*.5,l+d/2+e*.5),r.lineWidth=2,r.strokeStyle=o.bgIconHeader,r.lineCap=`round`,r.stroke())}r.fillStyle=o.textMedium,r.fillText(t,p+c+o.cellHorizontalPadding+.5,l+d/2+Ga(r,o)),r.beginPath()}var Qu=g.lazy(async()=>await pu(()=>import(`./number-overlay-editor-DAo7GPxB.js`),[])),$u={getAccessibilityString:e=>e.data?.toString()??``,kind:W.Number,needsHover:!1,needsHoverPosition:!1,useLabel:!0,drawPrep:Xa,draw:e=>to(e,e.cell.displayData,e.cell.contentAlign),measure:(e,t,n)=>e.measureText(t.displayData).width+n.cellHorizontalPadding*2,onDelete:e=>({...e,data:void 0}),provideEditor:()=>e=>{let{isHighlighted:t,onChange:n,value:r,validatedSelection:i}=e;return g.createElement(g.Suspense,{fallback:null},g.createElement(Qu,{highlight:t,disabled:r.readonly===!0,value:r.data,fixedDecimals:r.fixedDecimals,allowNegative:r.allowNegative,thousandSeparator:r.thousandSeparator,decimalSeparator:r.decimalSeparator,validatedSelection:i,onChange:e=>n({...r,data:Number.isNaN(e.floatValue??0)?0:e.floatValue})}))},onPaste:(e,t,n)=>{let r=typeof n.rawValue==`number`?n.rawValue:Number.parseFloat(typeof n.rawValue==`string`?n.rawValue:e);if(!(Number.isNaN(r)||t.data===r))return{...t,data:r,displayData:n.formattedString??t.displayData}}},ed={getAccessibilityString:()=>``,measure:()=>108,kind:W.Protected,needsHover:!1,needsHoverPosition:!1,draw:td,onPaste:()=>void 0};function td(e){let{ctx:t,theme:n,rect:r}=e,{x:i,y:a,height:o}=r;t.beginPath();let s=2.5,c=i+n.cellHorizontalPadding+s,l=a+o/2,u=Math.cos(Jr(30))*s,d=Math.sin(Jr(30))*s;for(let e=0;e<12;e++)t.moveTo(c,l-s),t.lineTo(c,l+s),t.moveTo(c+u,l-d),t.lineTo(c-u,l+d),t.moveTo(c-u,l-d),t.lineTo(c+u,l+d),c+=8;t.lineWidth=1.1,t.lineCap=`square`,t.strokeStyle=n.textLight,t.stroke()}var nd={getAccessibilityString:e=>e.data?.toString()??``,kind:W.RowID,needsHover:!1,needsHoverPosition:!1,drawPrep:(e,t)=>Xa(e,t,e.theme.textLight),draw:e=>to(e,e.cell.data,e.cell.contentAlign),measure:(e,t,n)=>e.measureText(t.data).width+n.cellHorizontalPadding*2,provideEditor:()=>e=>{let{isHighlighted:t,onChange:n,value:r,validatedSelection:i}=e;return g.createElement(aa,{highlight:t,autoFocus:r.readonly!==!0,disabled:r.readonly!==!1,value:r.data,validatedSelection:i,onChange:e=>n({...r,data:e.target.value})})},onPaste:()=>void 0},rd={getAccessibilityString:e=>e.data?.toString()??``,kind:W.Text,needsHover:e=>e.hoverEffect===!0,needsHoverPosition:!1,drawPrep:Xa,useLabel:!0,draw:e=>{let{cell:t,hoverAmount:n,hyperWrapping:r,ctx:i,rect:a,theme:o,overrideCursor:s}=e,{displayData:c,contentAlign:l,hoverEffect:u,allowWrapping:d}=t;if(u===!0&&n>0){i.textBaseline=`alphabetic`;let e=o.cellHorizontalPadding,t=o.cellVerticalPadding,r=Ua(c,i,o.baseFontFull,`alphabetic`),l=a.height-t,u=Math.min(l,r.actualBoundingBoxAscent*2.5);i.beginPath(),no(i,a.x+e/2,a.y+(a.height-u)/2+1,r.width+e*3,u-1,o.roundingRadius??4),i.globalAlpha=n,i.fillStyle=ua(o.textDark,.1),i.fill(),i.globalAlpha=1,i.fillStyle=o.textDark,i.textBaseline=`middle`,s?.(`text`)}to(e,c,l,d,r)},measure:(e,t,n)=>{let r=t.displayData.split(` +`,t.allowWrapping===!0?void 0:1),i=0;for(let t of r)i=Math.max(i,e.measureText(t).width);return i+2*n.cellHorizontalPadding},onDelete:e=>({...e,data:``}),provideEditor:e=>({disablePadding:e.allowWrapping===!0,editor:t=>{let{isHighlighted:n,onChange:r,value:i,validatedSelection:a}=t;return g.createElement(aa,{style:e.allowWrapping===!0?{padding:`3px 8.5px`}:void 0,highlight:n,autoFocus:i.readonly!==!0,disabled:i.readonly===!0,altNewline:!0,value:i.data,validatedSelection:a,onChange:e=>r({...i,data:e.target.value})})}}),onPaste:(e,t,n)=>e===t.data?void 0:{...t,data:e,displayData:n.formattedString??t.displayData}},id=br(`div`)({name:`UriOverlayEditorStyle`,class:`gdg-u1rrojo`,propsAsIs:!1}),ad=e=>{let{uri:t,onChange:n,forceEditMode:r,readonly:i,validatedSelection:a,preview:o}=e,[s,c]=g.useState(!i&&(t===``||r)),l=g.useCallback(()=>{c(!0)},[]);return s?g.createElement(aa,{validatedSelection:a,highlight:!0,autoFocus:!0,value:t,onChange:n}):g.createElement(id,null,g.createElement(`a`,{className:`gdg-link-area`,href:t,target:`_blank`,rel:`noopener noreferrer`},o),!i&&g.createElement(`div`,{className:`gdg-edit-icon`,onClick:l},g.createElement($r,null)),g.createElement(`textarea`,{className:`gdg-input`,autoFocus:!0}))};function od(e,t,n,r){let i=n.cellHorizontalPadding,a=t.height/2-e.actualBoundingBoxAscent/2,o=e.width,s=e.actualBoundingBoxAscent;return r===`right`?i=t.width-o-n.cellHorizontalPadding:r===`center`&&(i=t.width/2-o/2),{x:i,y:a,width:o,height:s}}var sd=[Ku,Xu,wu,Ou,Nu,Ru,Hu,Gu,$u,ed,nd,rd,{getAccessibilityString:e=>e.data?.toString()??``,kind:W.Uri,needsHover:e=>e.hoverEffect===!0,needsHoverPosition:!0,useLabel:!0,drawPrep:Xa,draw:e=>{let{cell:t,theme:n,overrideCursor:r,hoverX:i,hoverY:a,rect:o,ctx:s}=e,c=t.displayData??t.data,l=t.hoverEffect===!0;if(r!==void 0&&l&&i!==void 0&&a!==void 0){let{x:l,y:u,width:d,height:f}=od(Ua(c,s,n.baseFontFull),o,n,t.contentAlign);if(i>=l-4&&i<=l-4+d+8&&a>=u-4&&a<=u-4+f+8){let i=Ga(s,n.baseFontFull);r(`pointer`);let a=u-i;s.beginPath(),s.moveTo(o.x+l,Math.floor(o.y+a+f+5)+.5),s.lineTo(o.x+l+d,Math.floor(o.y+a+f+5)+.5),s.strokeStyle=n.linkColor,s.stroke(),s.save(),s.fillStyle=e.cellFillColor,to({...e,rect:{...o,x:o.x-1}},c,t.contentAlign),to({...e,rect:{...o,x:o.x-2}},c,t.contentAlign),to({...e,rect:{...o,x:o.x+1}},c,t.contentAlign),to({...e,rect:{...o,x:o.x+2}},c,t.contentAlign),s.restore()}}s.fillStyle=l?n.linkColor:n.textDark,to(e,c,t.contentAlign)},onClick:e=>{let{cell:t,bounds:n,posX:r,posY:i,theme:a}=e,o=t.displayData??t.data;if(t.hoverEffect!==!0||t.onClickUri===void 0)return;let s=Wa(o,a.baseFontFull);if(s===void 0)return;let c=od(s,n,a,t.contentAlign);ss({x:c.x-4,y:c.y-4,width:c.width+8,height:c.height+8},r,i)&&t.onClickUri(e)},measure:(e,t,n)=>e.measureText(t.displayData??t.data).width+n.cellHorizontalPadding*2,onDelete:e=>({...e,data:``}),provideEditor:e=>t=>{let{onChange:n,value:r,forceEditMode:i,validatedSelection:a}=t;return g.createElement(ad,{forceEditMode:r.readonly!==!0&&(i||e.hoverEffect===!0&&e.onClickUri!==void 0),uri:r.data,preview:r.displayData??r.data,validatedSelection:a,readonly:r.readonly===!0,onChange:e=>n({...r,data:e.target.value})})},onPaste:(e,t,n)=>e===t.data?void 0:{...t,data:e,displayData:n.formattedString??t.displayData}}],cd=c(o(((e,t)=>{var n=Ur(),r=on(),i=`Expected a function`;function a(e,t,a){var o=!0,s=!0;if(typeof e!=`function`)throw TypeError(i);return r(a)&&(o=`leading`in a?!!a.leading:o,s=`trailing`in a?!!a.trailing:s),n(e,t,{leading:o,maxWait:t,trailing:s})}t.exports=a}))(),1),ld=[],ud=class extends fo{imageLoaded=()=>void 0;loadedLocations=[];cache={};setCallback(e){this.imageLoaded=e}sendLoaded=(0,cd.default)(()=>{this.imageLoaded(new mo(this.loadedLocations)),this.loadedLocations=[]},20);clearOutOfWindow=()=>{let e=Object.keys(this.cache);for(let t of e){let e=this.cache[t],n=!1;for(let t=0;t{o||(o=!0,ld.length<12?ld.unshift(a):i||(a.src=``))}},c=new Promise(e=>a.addEventListener(`load`,()=>e(null)));requestAnimationFrame(async()=>{try{a.src=e,await c,await a.decode();let t=this.cache[r];if(t!==void 0&&!o){t.img=a;for(let e of t.cells)this.loadedLocations.push(uo(e));i=!0,this.sendLoaded()}}catch{s.cancel()}}),this.cache[r]=s}loadOrGetImage(e,t,n){let r=e,i=this.cache[r];if(i!==void 0){let e=so(t,n);return i.cells.includes(e)||i.cells.push(e),i.img}this.loadImage(e,t,n,r)}},dd=``,fd=/^\s*(?:\|?\s*:?-{2,}:?\s*(?:\|\s*:?-{2,}:?\s*)+\|?|\|\s*:?-{2,}:?\s*\||\+[-=]+(?:\+[-=]+)*\+|[-=]+(?:\+[-=]+)+)\s*$/m,pd=/^\s*(?:\|?\s*:?-{2,}:?\s*(?:\|\s*:?-{2,}:?\s*)+\|?|\|\s*:?-{2,}:?\s*\|)\s*$/,md=/^\s*\+[-=]+(?:\+[-=]+)*\+\s*$/,hd=/^\s*[-=]+(?:\+[-=]+)+\s*$/,gd=/^\s*(?:\(\d+\s+rows?\)|\d+\s+rows?\s+in\s+set(?:\s*\([^)]*\))?)\s*$/i,_d=/^\s*(?:`{3,}|~{3,})/,vd=/^\s*#{1,6}\s+(.+?)\s*#*\s*$/,yd=/^\s*(?:\*\*([^*]+)\*\*|__([^_]+)__)\s*:?\s*$/,bd=/^\s*(?:={3,}|-{3,})\s*$/;function xd(e){for(let t=0;t=0&&e[n]===`\\`;n--)t++;return t%2==0}function Cd(e){let t=e.trim();t.startsWith(`|`)&&(t=t.slice(1)),Sd(t)&&(t=t.slice(0,-1));let n=[],r=``;for(let e=0;ee.trim())}function Td(e){return md.test(e)||hd.test(e)}var Ed=32;function Dd(e){let t=e.replace(/(\*\*|__|`)*/g,``).replace(/\s+/g,` `).replace(/\s*:\s*$/,``).trim();return t?t.length>Ed?`${t.slice(0,31).trimEnd()}…`:t:null}function Od(e,t,n){if(t)return t;let r=n.slice(0,3).map(e=>e.trim()).filter(Boolean).join(`, `);return r?`Table ${e+1} (${r})`:`Table ${e+1}`}function kd(e,t){let n=vd.exec(e);if(n){let e=Dd(n[1]);if(e)return{title:e,consumedNextLine:!1}}let r=yd.exec(e);if(r){let e=Dd(r[1]??r[2]??``);if(e)return{title:e,consumedNextLine:!1}}if(t!==void 0&&bd.test(t)&&e.trim().length>0&&!xd(e)&&!Td(e)&&!_d.test(e)){let t=Dd(e);if(t)return{title:t,consumedNextLine:!0}}return null}function Ad(e){if(!e)return[];let t=e.startsWith(dd)?e.slice(1):e,n=t.slice(0,65536);if(!n.includes(`|`)||!fd.test(n))return[];let r=t.split(/\r?\n/),i=[],a=null,o=0;for(;o=2&&n.length>=1){let t=wd(n[0],!0);if(t.length>0&&!t.every(e=>e===``)){let r=n.slice(1).map(e=>wd(e,!0)),s=Ld(t,r,`,`),c=i.length,l=a;i.push({index:c,title:l,label:Od(c,l,t),headers:t,cleanedCsv:s,rows:r.length,cols:t.length,kind:`box`}),a=null,o=e;continue}}o++;continue}if(xd(e)&&!Td(e)&&!pd.test(e)&&!vd.test(e)&&o+10&&!t.every(e=>e===``)){let e=[],n=o+2;for(;n0&&!l.every(e=>e===``)){let e=t.slice(1).map(e=>wd(e,c)),r=Ld(l,e,`,`),s=i.length,u=a;i.push({index:s,title:u,label:Od(s,u,l),headers:l,cleanedCsv:r,rows:e.length,cols:l.length,kind:`box`}),a=null,o=n;continue}}let t=kd(e,r[o+1]);t?(a=t.title,o+=t.consumedNextLine?2:1):o++}return i}function jd(e,t=0){let n=Ad(e);if(n.length===0)return null;let r=n[Math.min(Math.max(0,Math.trunc(t)||0),n.length-1)];return{cleanedCsv:r.cleanedCsv,rows:r.rows,cols:r.cols,kind:r.kind}}var Md=``;function Nd(e){let t={",":0,";":0," ":0},n=`,`,r=-1,i=0,a=!1;for(let n=0;nr&&(n=e,r=t[e]);return n}function Pd(e,t,n){if(e[t]===`"`){let r=``,i=t+1;for(;;){if(i>=e.length)return[r,i];let t=e[i];if(t===`"`){if(e[i+1]===`"`)r+=`"`,i+=2;else{for(i++;i=o.length)break;o[t]===c?(p=t+1,m=!0):(p=o[t]===`\r`&&o[t+1]===` +`?t+2:t+1,l.push(d),u.push({start:f+s,end:t+s}),d=[])}d.length>0?(l.push(d),u.push({start:f+s,end:o.length+s})):l.length===0&&d.length===0&&o.length>0&&(l.push([``]),u.push({start:0+s,end:o.length+s}));let h=l.length>0?l[0]:[],g=h.length,_=l.slice(1),v=_.map(e=>e.length);return{headers:h,rows:_.map(e=>e.length===g?e:e.length>g?e.slice(0,g):[...e,...Array(g-e.length).fill(``)]),delimiter:c,rowWidths:v,rowSpans:u.slice(1)}}function Id(e,t=`,`){return e.map(e=>e.includes(`"`)?`"${e.replaceAll(`"`,`""`)}"`:e.includes(t)||e.includes(` +`)||e.includes(`\r`)?`"${e}"`:e).join(t)}function Ld(e,t,n=`,`){return[e,...t].map(e=>Id(e,n)).join(` +`)}function Rd(e,t){return Fd(e,t).headers}function zd(e){let t=/^-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/,n=Array.from({length:e.headers.length},()=>!0),r=Array.from({length:e.headers.length},()=>!1);for(let i of e.rows)for(let e=0;ee&&r[t])}function Bd(e,t){let n=``,r=0;for(let{start:i,end:a,replacement:o}of t)n+=e.slice(r,i)+o,r=a;return n+e.slice(r)}function Vd(e,t){return e[t]===`\r`?e[t+1]===` +`?2:1:+(e[t]===` +`)}function Hd(e,t){return e[t-2]===`\r`&&e[t-1]===` +`?2:+(e[t-1]===`\r`||e[t-1]===` +`)}var Ud=``;function Wd(e,t){let n=+!!e.startsWith(Ud),r=t.rowSpans[0];return r===void 0?{start:n,end:n+e.slice(n).length-Hd(e,e.length)}:{start:n,end:r.start-Hd(e,r.start)}}function Gd(e,t,n){let r=[...new Set(n)].flatMap(e=>{let n=t.rowSpans[e];return n===void 0?[]:[n]}).sort((e,t)=>e.start-t.start).map(t=>({start:t.start,end:t.end+Vd(e,t.end),replacement:``}));return r.length===0?e:Bd(e,r)}function Kd(e,t,n){let r=new Set([...n].filter(e=>e>=0&&ee!r.has(t));a.push({start:n.start,end:n.end,replacement:Id(o,t.delimiter)})}return Bd(e,a)}function qd(e,t,n,r){if(!e||n<0||n>=t.headers.length)return e;let i=Wd(e,t),a=Rd(e.slice(i.start,i.end),t.delimiter);if(n>=a.length||a[n]===r)return e;let o=Id(a.map((e,t)=>t===n?r:e),t.delimiter);return e.slice(0,i.start)+o+e.slice(i.end)}function Jd(e=``){return{past:[],present:e,future:[]}}function Yd(e,t,n=50){if(t===e.present)return e;if(e.present===``&&e.past.length===0&&e.future.length===0)return{past:[],present:t,future:[]};let r=[...e.past,e.present];return{past:r.length>n?r.slice(r.length-n):r,present:t,future:[]}}function Xd(e){if(e.past.length===0)return e;let t=e.past[e.past.length-1];return{past:e.past.slice(0,e.past.length-1),present:t,future:[e.present,...e.future]}}function Zd(e){if(e.future.length===0)return e;let[t,...n]=e.future,r=[...e.past,e.present];return{past:r.length>50?r.slice(r.length-50):r,present:t,future:n}}function Qd(e){if(e.altKey||!e.metaKey&&!e.ctrlKey)return null;let t=e.key.toLowerCase();return t===`z`?e.shiftKey?`redo`:`undo`:t===`y`&&!e.shiftKey?`redo`:null}var $d=/^[+-]?\d{16,}$/;function ef(e,t){let n=Array.from({length:e.length},(e,t)=>t);if(t===``)return n;let r=t.toLowerCase();return n.filter(t=>{let n=e[t];for(let e=0;e{let o=t[e]?.[n]??``,s=t[r]?.[n]??``;if(i){let e=o===``?NaN:Number(o),t=s===``?NaN:Number(s),n=Number.isNaN(e),r=Number.isNaN(t);if(n||r)return n&&r?0:n?1:-1;if($d.test(o)&&$d.test(s)){let e=BigInt(o),t=BigInt(s);return a*(et))}return a*(e-t)}return a*o.localeCompare(s)})}function nf(e,t,n){if(n.length===0||e.headers.length===0)return``;let r=e.delimiter||`,`;return[Id(n.map(t=>e.headers[t]??``),r),...t.filter(t=>t>=0&&tId(n.map(n=>e.rows[t]?.[n]??``),r))].join(` +`)}var rf=` + +`;function af(e,t){return Math.max(0,Math.min(e,t))}function of(e,t,n,r){let i=e.headers.length,a=[];for(let o of n.ranges){let n=af(o.x,r+i),s=af(o.x+o.width,r+i);if(s<=r)continue;let c=Math.max(0,n-r),l=s-r;if(l<=c)continue;let u=af(o.y,t.length),d=af(o.y+o.height,t.length);if(d<=u)continue;let f=e.headers.slice(c,l),p=[];for(let n=u;ni[c+t]??``))}p.length!==0&&a.push(Ld(f,p,e.delimiter))}if(a.length>0)return a.join(rf);let o=[...n.rows].filter(e=>e>=0&&et[e]).filter(e=>e!==void 0);if(o.length>0)return Ld(e.headers,o.map(t=>e.rows[t]??[]),e.delimiter);let s=[...n.columns].filter(e=>e>=r&&e0?Ld(s.map(t=>e.headers[t-r]),t.map(t=>{let n=e.rows[t]??[];return s.map(e=>n[e-r]??``)}),e.delimiter):null}var sf=1e5,cf=/^[-+]?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?$/;function lf(e,t,n,r){let i=e.headers.length,a=t.length;if(i===0||a===0)return null;let o=new Set;for(let e of n.ranges){if(o.size>=sf)break;let t=Math.max(0,e.x-r),n=Math.min(i,e.x+e.width-r);if(n<=t)continue;let s=Math.max(0,e.y),c=Math.min(a,e.y+e.height);if(!(c<=s))for(let e=s;e=sf);e++){let r=e*i;for(let e=t;e=sf));e++);}}for(let e of n.rows){if(o.size>=sf)break;if(e<0||e>=a)continue;let t=e*i;for(let e=0;e=sf));e++);}for(let e of n.columns){if(o.size>=sf)break;let t=e-r;if(!(t<0||t>=i))for(let e=0;e=sf));e++);}let s=o.size;if(s===0||s<2&&n.rows.length===0&&n.columns.length===0)return null;let c=0,l=0,u=0,d=null,f=null,p=new Set;for(let n of o){let r=Math.floor(n/i),a=n%i,o=t[r],s=((o===void 0?void 0:e.rows[o]?.[a])??``).trim();if(s===``)c+=1;else if(p.add(s),cf.test(s)){let e=Number(s);Number.isFinite(e)&&(l+=1,u+=e,(d===null||ef)&&(f=e))}}return{cellCount:s,distinctCount:p.size,emptyCount:c,numericCount:l,sum:l>0?u:null,avg:l>0?u/l:null,min:l>0?d:null,max:l>0?f:null}}var uf=24,df=26,ff=110,pf=40,mf=12,hf=1,gf=`ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace`,_f=`ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif`,vf=[{mode:`auto`,label:`Auto`},{mode:`string`,label:`String`},{mode:`number`,label:`Number`},{mode:`boolean`,label:`Boolean`}];function yf(e){return e===`string`?`STR`:e===`number`?`NUM`:e===`boolean`?`BOOL`:null}function bf(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName;return t===`INPUT`||t===`TEXTAREA`||e.isContentEditable}var xf=`inline-flex cursor-pointer items-center gap-1 rounded-md border border-border bg-background px-1.5 py-0.5 text-[11px] font-medium text-foreground hover:bg-muted outline-none focus-visible:ring-3 focus-visible:ring-ring/50`,Sf=new Intl.NumberFormat(`en-US`,{maximumFractionDigits:4});function Cf(e){return Sf.format(Object.is(e,-0)?0:e)}function wf(e){let t=[`Cells: ${Sf.format(e.cellCount)}`,`Distinct: ${Sf.format(e.distinctCount)}`];return e.emptyCount>0&&t.push(`Empty: ${Sf.format(e.emptyCount)}`),e.numericCount>0&&e.sum!==null&&e.avg!==null&&e.min!==null&&e.max!==null&&t.push(`Sum: ${Cf(e.sum)}`,`Avg: ${Cf(e.avg)}`,`Min: ${Cf(e.min)}`,`Max: ${Cf(e.max)}`),t.join(` · `)}function Tf(e){return e?{accentColor:`hsl(0 0% 98%)`,accentFg:`hsl(240 10% 3.9%)`,accentLight:`hsla(240, 4.9%, 70%, 0.18)`,textDark:`hsl(0 0% 98%)`,textMedium:`hsl(240 5% 64.9%)`,textLight:`hsla(240, 5%, 64.9%, 0.4)`,textBubble:`hsl(0 0% 98%)`,textHeader:`hsl(240 5% 64.9%)`,textHeaderSelected:`hsl(0 0% 98%)`,bgCell:`hsl(240 6% 7%)`,bgCellMedium:`hsl(240 6% 7%)`,bgHeader:`hsl(240 6% 7%)`,bgHeaderHasFocus:`hsl(240 3.7% 15.9%)`,bgHeaderHovered:`hsl(240 3.7% 15.9%)`,bgBubble:`hsl(240 3.7% 15.9%)`,bgBubbleSelected:`hsl(240 6% 7%)`,bgSearchResult:`hsl(240 3.7% 15.9%)`,borderColor:`hsl(240 3.7% 15.9%)`,horizontalBorderColor:`hsla(240, 3.7%, 15.9%, 0.6)`,headerBottomBorderColor:`hsl(240 3.7% 15.9%)`,linkColor:`hsl(0 0% 98%)`,cellHorizontalPadding:8,cellVerticalPadding:3,headerFontStyle:`600 11px`,baseFontStyle:`12px`,editorFontSize:`12px`,fontFamily:_f,lineHeight:1}:{accentColor:`hsl(240 10% 3.9%)`,accentFg:`hsl(0 0% 100%)`,accentLight:`hsla(240, 4.8%, 45%, 0.14)`,textDark:`hsl(240 10% 3.9%)`,textMedium:`hsl(240 3.8% 46.1%)`,textLight:`hsla(240, 3.8%, 46.1%, 0.4)`,textBubble:`hsl(240 10% 3.9%)`,textHeader:`hsl(240 3.8% 46.1%)`,textHeaderSelected:`hsl(240 10% 3.9%)`,bgCell:`hsl(0 0% 100%)`,bgCellMedium:`hsl(0 0% 100%)`,bgHeader:`hsl(0 0% 100%)`,bgHeaderHasFocus:`hsl(240 4.8% 95.9%)`,bgHeaderHovered:`hsl(240 4.8% 95.9%)`,bgBubble:`hsl(240 4.8% 95.9%)`,bgBubbleSelected:`hsl(0 0% 100%)`,bgSearchResult:`hsl(48 96% 89%)`,borderColor:`hsl(240 5.9% 90%)`,horizontalBorderColor:`hsla(240, 5.9%, 90%, 0.6)`,headerBottomBorderColor:`hsl(240 5.9% 90%)`,linkColor:`hsl(240 10% 3.9%)`,cellHorizontalPadding:8,cellVerticalPadding:3,headerFontStyle:`600 11px`,baseFontStyle:`12px`,editorFontSize:`12px`,fontFamily:_f,lineHeight:1}}function Ef(e){return e?`hsla(45, 96%, 65%, 0.3)`:`hsl(48 96% 89%)`}function Df({text:e,delimiter:t,testId:n=`csv-table`,dark:r=!1,onCellCommit:i,onUndo:a,onRedo:o,onCopySelection:s,columnTypes:c,onChangeColumnTypes:l,onProjectedCsvChange:u}){let d=(0,g.useRef)(null),f=(0,g.useRef)(null),p=(0,g.useRef)(null),m=(0,g.useRef)(null),[h,_]=(0,g.useState)(``),[v,y]=(0,g.useState)(``),[b,x]=(0,g.useState)(null),S=(0,g.useRef)(b);S.current=b;let C=(0,g.useRef)(null),[w,T]=(0,g.useState)(null),[E,D]=(0,g.useState)(``),O=(0,g.useRef)(null),[k,A]=(0,g.useState)(()=>new Set),[ee,te]=(0,g.useState)(!1),[ne,re]=(0,g.useState)(!1),[j,ie]=(0,g.useState)(void 0),[M,ae]=(0,g.useState)(()=>new Set),N=(0,g.useRef)(M),[oe,P]=(0,g.useState)(0),[se,ce]=(0,g.useState)({}),F=i!==void 0,le=c??se,ue=(0,g.useCallback)(e=>{ce(e),l?.(e)},[l]),de=(0,g.useMemo)(()=>Tf(r),[r]),fe=Ef(r),pe=r?`hsl(240 3.7% 15.9%)`:`hsl(240 4.8% 95.9%)`,ge=(0,g.useRef)();ge.current===void 0&&(ge.current=new ud);let I=(0,g.useMemo)(()=>t===void 0?jd(e)?.cleanedCsv??e:e,[e,t]),L=(0,g.useMemo)(()=>Fd(I,t),[I,t]),_e=(0,g.useMemo)(()=>zd(L),[L]),R=L.headers.length,ve=(0,g.useRef)(L.headers);if(ve.current!==L.headers){let e=ve.current,t=L.headers;ve.current=t;let n=e.length===t.length,r=n?t.reduce((t,n,r)=>n===e[r]?t:t+1,0):1/0;(!n||r>1||r===1&&t.length<=1)&&k.size>0&&A(new Set)}let be=(0,g.useMemo)(()=>{let e=Array.from({length:R},(e,t)=>t);if(k.size===0)return e;let t=e.filter(e=>!k.has(e));return t.length>0?t:e},[R,k]),xe=(0,g.useRef)(be);xe.current=be;let Se=(0,g.useMemo)(()=>be.length===L.headers.length?L:{...L,headers:be.map(e=>L.headers[e]??``),rows:L.rows.map(e=>be.map(t=>e[t]??``))},[L,be]),z=(0,g.useRef)({text:I,table:L,visibleTable:Se});z.current={text:I,table:L,visibleTable:Se};let Ce=(0,g.useRef)(j);Ce.current=j,(0,g.useEffect)(()=>{let e=window.setTimeout(()=>y(h),150);return()=>window.clearTimeout(e)},[h]);let B=(0,g.useMemo)(()=>{let e=ef(L.rows,v);return b?tf(e,L.rows,b.col,b.dir,_e[b.col]??!1):e},[L,v,b,_e]),Ee=(0,g.useRef)(B);Ee.current=B,(0,g.useEffect)(()=>{let e=f.current;if(!e||typeof ResizeObserver>`u`)return;let t=new ResizeObserver(()=>P(e.clientWidth));return t.observe(e),P(e.clientWidth),()=>t.disconnect()},[]);let De=Math.max(ff,Math.floor((oe-pf)/Math.max(1,be.length)));(0,g.useEffect)(()=>{if(!ee)return;let e=e=>{e.key===`Escape`&&(e.stopPropagation(),te(!1))},t=e=>{let t=p.current;t!==null&&e.target instanceof Node&&(t.contains(e.target)||te(!1))};return document.addEventListener(`keydown`,e),document.addEventListener(`click`,t),()=>{document.removeEventListener(`keydown`,e),document.removeEventListener(`click`,t)}},[ee]);let Oe=(0,g.useCallback)(e=>{A(t=>{let n=new Set(t);if(n.has(e))n.delete(e);else{if(R-(n.size+1)<1)return t;n.add(e)}return n}),ie(e=>e&&e.columns.length>0?{...e,columns:ur.empty()}:e)},[R]),ke=(0,g.useCallback)(()=>{A(new Set),ie(e=>e&&e.columns.length>0?{...e,columns:ur.empty()}:e)},[]),Ae=be.length!ne||!je?null:nf(L,B,be),[ne,je,L,B,be]),Ne=(0,g.useRef)(u);Ne.current=u,(0,g.useEffect)(()=>{Ne.current?.(Me)},[Me]),(0,g.useEffect)(()=>()=>{Ne.current?.(null)},[]),(0,g.useEffect)(()=>{ae(e=>{let t=!1,n=new Set;for(let r of e)r{ie(e=>{if(!e||e.rows.length===0)return e;let t=[];for(let e of N.current){let n=B.indexOf(e);n!==-1&&t.push(n)}t.sort((e,t)=>e-t);let n=t.reduce((e,t)=>e.add(t),ur.empty());return n.equals(e.rows)?e:{...e,rows:n}})},[B]),(0,g.useEffect)(()=>{x(e=>e!==null&&e.col>=R?null:e),T(e=>e!==null&&e.col>=R?null:e)},[R]);let Pe=v!==``,Fe=L.rows.length,Ie=df+Math.min(B.length,mf)*uf,Le=()=>{_(``),y(``)},Re=(0,g.useCallback)((e,t)=>{if(e0||i.height>0)?{x:Math.max(0,a.x-i.left),y:Math.max(0,a.y-i.top),width:a.width,height:a.height}:a??{x:pf+n*De,y:0,width:De,height:df};D(e),T({col:r,bounds:o})}else C.current=S.current,T(null),x(e=>!e||e.col!==r?{col:r,dir:`asc`}:e.dir===`asc`?{col:r,dir:`desc`}:null)}},[F,De]),ze=(0,g.useCallback)(()=>{if(!w)return;let{col:e}=w;if(T(null),!i)return;let{text:t,table:n}=z.current,r=n.headers[e]??``,a=qd(t,n,e,E);if(a!==t){if(r!==``&&r!==E&&le[r]!==void 0){let e={...le},t=e[r];delete e[r],E!==``&&t!==void 0&&(e[E]=t),ue(e)}i(a)}},[w,E,i,le,ue]),Be=(0,g.useCallback)(()=>{T(null)},[]);(0,g.useEffect)(()=>{if(!w)return;let e=O.current;e&&(e.focus(),e.select())},[w]);let Ve=(0,g.useCallback)((e,t)=>{let n=Ee.current,r=n[t];if(r===void 0)return;let i=N.current,a=m.current,o;if(e.shiftKey&&a!==null&&a!==r){let t=n.indexOf(a),s=n.indexOf(r),c=t===-1?s:t,[l,u]=c<=s?[c,s]:[s,c];o=e.metaKey||e.ctrlKey?new Set(i):new Set;for(let e=l;e<=u;e++){let t=n[e];t!==void 0&&o.add(t)}}else e.metaKey||e.ctrlKey?(o=new Set(i),o.has(r)?o.delete(r):o.add(r)):o=new Set([r]);m.current=r,N.current=o,ae(o);let s=[...o].map(e=>n.indexOf(e)).filter(e=>e!==-1).sort((e,t)=>e-t);ie(e=>({current:e?.current,columns:e?.columns??ur.empty(),rows:s.reduce((e,t)=>e.add(t),ur.empty())}))},[]),He=(0,g.useCallback)(()=>{m.current=null,N.current=new Set,ae(new Set),ie(void 0)},[]),Ue=(0,g.useCallback)(e=>{let t=new Set;for(let n of e.rows){let e=Ee.current[n];e!==void 0&&t.add(e)}N.current=t,ae(t),ie(e)},[]),We=(0,g.useCallback)(()=>{He()},[He]),Ge=(0,g.useMemo)(()=>B.filter(e=>M.has(e)),[B,M]),Ke=(0,g.useMemo)(()=>[...j?.columns??[]].filter(e=>e>=hf).map(e=>be[e-hf]).filter(e=>e!==void 0),[j,be]),qe=Ke.length,Je=(0,g.useMemo)(()=>Ke.map(e=>L.headers[e]).filter(e=>e!==void 0),[Ke,L.headers]),Ye=(0,g.useMemo)(()=>{if(Je.length===0)return null;let e=le[Je[0]]??`auto`;for(let t=1;t{if(!F||Je.length===0)return;let t={...le};for(let n of Je)e===`auto`?delete t[n]:t[n]=e;ue(t)},[F,Je,le,ue]),Ze=(0,g.useMemo)(()=>F?L.headers.filter(e=>yf(le[e])!==null).length:0,[F,L.headers,le]),Qe=(0,g.useMemo)(()=>({ranges:j?.current?[j.current.range,...j.current.rangeStack]:[],columns:j?[...j.columns]:[],rows:M.size>0?B.reduce((e,t,n)=>(M.has(t)&&e.push(n),e),[]):j?[...j.rows]:[]}),[j,M,B]),$e=hf,et=(0,g.useMemo)(()=>lf(Se,B,Qe,$e),[Se,B,Qe,$e]),tt=Ge.length>0||qe>0||et!==null,nt=(0,g.useRef)(s);nt.current=s;let rt=()=>{let e=Ce.current,t=of(z.current.visibleTable,Ee.current,{ranges:e?.current?[e.current.range,...e.current.rangeStack]:[],columns:e?[...e.columns]:[],rows:e?[...e.rows]:[]},hf);t!==null&&(nt.current?.(),navigator.clipboard?.writeText(t).catch(()=>{}))};(0,g.useEffect)(()=>{let e=e=>{let t=d.current;if(!t||!t.contains(document.activeElement))return;let n=document.activeElement;if(n&&(n.tagName===`INPUT`||n.tagName===`TEXTAREA`||n.isContentEditable))return;let r=Ce.current,i=of(z.current.visibleTable,Ee.current,{ranges:r?.current?[r.current.range,...r.current.rangeStack]:[],columns:r?[...r.columns]:[],rows:r?[...r.rows]:[]},hf);i!==null&&(e.preventDefault(),e.stopImmediatePropagation(),e.clipboardData?.setData(`text/plain`,i),nt.current?.())};return window.addEventListener(`copy`,e,{capture:!0}),()=>window.removeEventListener(`copy`,e,{capture:!0})},[]),(0,g.useEffect)(()=>{if(!a&&!o)return;let e=e=>{let t=d.current;if(!t)return;let n=e.target instanceof Node&&t.contains(e.target),r=document.activeElement instanceof Node&&t.contains(document.activeElement);if(!n&&!r||bf(e.target)||bf(document.activeElement))return;let i=Qd(e);i===`undo`&&a?(e.preventDefault(),a()):i===`redo`&&o&&(e.preventDefault(),o())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[a,o]);let it=(0,g.useCallback)(e=>{let t=d.current!==null&&document.activeElement instanceof Node&&d.current.contains(document.activeElement);He(),i?.(e),t&&f.current?.focus({preventScroll:!0})},[He,i]),at=R>0&&Ke.length>=R,ot=()=>{F&&Ge.length!==0&&it(Gd(z.current.text,z.current.table,Ge))},st=()=>{F&&!at&&Ke.length!==0&&it(Kd(z.current.text,z.current.table,Ke))},ct=(0,g.useCallback)(e=>{if(!i)return!1;let{text:t,table:n}=z.current,r=Ee.current;if(e.rows.length>0){let i=[...e.rows].map(e=>r[e]).filter(e=>e!==void 0);if(i.length>0)return it(Gd(t,n,i)),!1}if(e.columns.length>0){let r=[...e.columns].filter(e=>e>=hf).map(e=>xe.current[e-hf]).filter(e=>e!==void 0&&e>=0&&e0&&r.length0&&it(Gd(t,n,o)),!1},[it,i]),lt=(0,g.useCallback)(e=>{let t=i;if(!t)return!1;let{text:n,table:r}=z.current,a=Ee.current,o=[...e].sort((e,t)=>e.location[1]-t.location[1]),s=n,c=0;for(let{location:e,value:t}of o){let n=e[0]-hf,i=n>=0?xe.current[n]:void 0,o=e[1];if(i===void 0||i<0||t.kind!==W.Text)continue;let l=a[o],u=l===void 0?void 0:r.rowSpans[l];if(!u)continue;let d=Rd(s.slice(u.start+c,u.end+c),r.delimiter);for(;d.length<=i;)d.push(``);let f=t.data??``;if(d[i]===f)continue;d[i]=f;let p=Id(d,r.delimiter);s=s.slice(0,u.start+c)+p+s.slice(u.end+c),c+=p.length-(u.end-u.start)}return s!==n&&t(s),!0},[i]),ut=(0,g.useCallback)(e=>{let[t,n]=e,r=Ee.current[n];if(t{let t=[];for(let n=e.y;n{e[0]>=hf||Ve(t,e[1])},[Ve]),pt=(0,g.useMemo)(()=>[{title:`#`,id:`__gutter`,width:pf,themeOverride:{baseFontStyle:`11px ${gf}`,textDark:`hsla(240, 3.8%, 46.1%, 0.4)`}},...be.map(e=>{let t=L.headers[e]??``,n=F?yf(le[t]):null;return{title:n?`${t.toUpperCase()} [${n}]`:t.toUpperCase(),id:`c${e}`,width:De,themeOverride:_e[e]?{baseFontStyle:`12px ${gf}`}:void 0}})],[L.headers,be,_e,De,F,le]),mt=(0,g.useCallback)((e,t)=>{let{ctx:n,columnIndex:r,rect:i,theme:a,isSelected:o}=e;n.save();try{if(n.letterSpacing=`0.5px`,o&&(n.fillStyle=a.bgHeaderHovered,n.fillRect(i.x,i.y,i.width,i.height),n.fillStyle=a.accentColor,n.fillRect(i.x,i.y+i.height-2,i.width,2)),r{let{ctx:n,cell:r,rect:i,col:a,theme:o}=e,s=a-hf;if(s>=0&&Pe&&r.kind===W.Text){let e=Of(r.data,v);if(e!==null){n.save();try{let t=`${o.baseFontStyle} ${o.fontFamily}`;n.font=t;let r=i.x+o.cellHorizontalPadding,a=i.y+i.height/2+Ga(n,t);for(let t of e){let e=n.measureText(t.text).width;t.hit&&e>0&&(n.fillStyle=fe,n.fillRect(r-1,a-7,e+2,14)),r+=e}}finally{n.restore()}}}if(t(),s>=0&&r.kind===W.Text&&r.data===``){n.save();try{n.font=`${o.baseFontStyle} ${o.fontFamily}`,n.fillStyle=o.textLight,n.fillText(`—`,i.x+o.cellHorizontalPadding,i.y+i.height/2+.5)}finally{n.restore()}}},[Pe,v,fe]),gt=(0,g.useCallback)(e=>{let t=Ee.current[e];return t!==void 0&&N.current.has(t)?{bgCell:pe,bgCellMedium:pe}:void 0},[pe]);return R===0?(0,V.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-6 text-sm text-muted-foreground`,children:`No columns detected.`}):(0,V.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,ref:d,children:[(0,V.jsxs)(`div`,{"data-testid":`${n}-toolbar`,className:`flex flex-none flex-wrap items-center gap-1.5 border-b border-border bg-panel px-2 py-1`,children:[(0,V.jsxs)(`div`,{className:`relative min-w-32 flex-1 sm:max-w-64`,children:[(0,V.jsx)(ye,{"aria-hidden":`true`,className:`pointer-events-none absolute left-1.5 top-1/2 size-3 -translate-y-1/2 text-muted-foreground/60`}),(0,V.jsx)(`input`,{type:`text`,"data-testid":`${n}-search`,"aria-label":`Search rows`,value:h,onChange:e=>_(e.target.value),onKeyDown:e=>{e.key===`Escape`&&Le()},placeholder:`Search…`,className:`h-6 w-full rounded-md border border-border bg-background pl-6 pr-6 text-xs text-foreground outline-none placeholder:text-muted-foreground/50 focus-visible:ring-3 focus-visible:ring-ring/50`}),h!==``&&(0,V.jsx)(`button`,{type:`button`,"data-testid":`${n}-clear-search`,"aria-label":`Clear search`,onClick:Le,className:`absolute right-1 top-1/2 -translate-y-1/2 cursor-pointer rounded p-0.5 text-muted-foreground/60 outline-none hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50`,children:(0,V.jsx)(Te,{"aria-hidden":`true`,className:`size-3`})})]}),(0,V.jsx)(`span`,{"data-testid":`${n}-count`,role:`status`,className:`rounded-full bg-muted px-2 py-0.5 text-[11px] font-medium tabular-nums text-muted-foreground`,children:Pe?`${B.length.toLocaleString()} of ${Fe.toLocaleString()}`:`${Fe.toLocaleString()} rows`}),F&&Ze>0&&(0,V.jsxs)(`button`,{type:`button`,"data-testid":`input-table-column-types-reset`,onClick:()=>ue({}),title:`Reset all pinned column types to Auto`,className:xf,children:[`${Ze} ${Ze===1?`column type`:`column types`} pinned`,(0,V.jsx)(Te,{"aria-hidden":`true`,className:`size-3 text-muted-foreground`})]}),(0,V.jsxs)(`div`,{ref:p,className:`relative`,children:[(0,V.jsxs)(`button`,{type:`button`,"data-testid":`${n}-columns-button`,"aria-expanded":ee,"aria-haspopup":`dialog`,"aria-label":`Columns`,onClick:()=>te(e=>!e),className:wt(xf,Ae&&`border-foreground/30 bg-muted font-semibold`),children:[(0,V.jsx)(me,{"aria-hidden":`true`,className:`size-3`}),(0,V.jsx)(`span`,{children:Ae?`Columns (${be.length}/${R})`:`Columns`})]}),ee&&(0,V.jsxs)(`div`,{"data-testid":`${n}-columns-popout`,role:`dialog`,"aria-label":`Visible columns`,className:`absolute left-0 top-7 z-30 min-w-44 max-w-64 rounded-md border border-border bg-panel p-1.5 shadow-md`,children:[(0,V.jsxs)(`div`,{className:`mb-1 flex items-center justify-between gap-2 border-b border-border px-1.5 pb-1`,children:[(0,V.jsxs)(`span`,{className:`text-[11px] font-semibold text-foreground`,children:[`Columns (`,be.length,`/`,R,`)`]}),Ae&&(0,V.jsx)(`button`,{type:`button`,"data-testid":`${n}-columns-reset`,onClick:ke,className:`cursor-pointer rounded px-1.5 py-0.5 text-[11px] font-medium text-muted-foreground hover:bg-muted hover:text-foreground`,children:`Show all`})]}),(0,V.jsx)(`div`,{className:`max-h-56 overflow-y-auto`,children:L.headers.map((e,t)=>{let r=!k.has(t),i=r&&be.length<=1,a=e===``?`Column ${t+1}`:e;return(0,V.jsxs)(`label`,{className:wt(`flex items-center gap-2 rounded px-1.5 py-1 text-xs`,i?`cursor-not-allowed opacity-60`:`cursor-pointer hover:bg-muted`),children:[(0,V.jsx)(`input`,{type:`checkbox`,"data-testid":`${n}-column-toggle-${t}`,checked:r,disabled:i,onChange:()=>Oe(t),className:`size-3.5 accent-foreground`}),(0,V.jsx)(`span`,{className:`truncate font-mono text-[11px] text-foreground`,children:a})]},t)})})]})]}),je&&(0,V.jsx)(`button`,{type:`button`,"data-testid":`${n}-apply-view`,"aria-pressed":ne,onClick:()=>re(e=>!e),className:wt(`inline-flex cursor-pointer items-center gap-1 rounded-md border px-2 py-0.5 text-[11px] font-medium transition-colors outline-none focus-visible:ring-3 focus-visible:ring-ring/50`,ne?`border-foreground bg-foreground text-background hover:bg-foreground/90`:`border-border bg-background text-muted-foreground hover:bg-muted hover:text-foreground`),children:`Apply view to output`}),tt&&(0,V.jsxs)(`span`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,V.jsx)(`span`,{"data-testid":`${n}-selected-count`,className:`text-[11px] font-medium tabular-nums text-muted-foreground`,children:Ge.length>0?`${Ge.length.toLocaleString()} selected`:qe>0?`${qe.toLocaleString()} ${qe===1?`column`:`columns`} selected`:`${(et?.cellCount??0).toLocaleString()} cells selected`}),et!==null&&(0,V.jsx)(`span`,{"data-testid":`${n}-selection-stats`,className:`rounded-md bg-muted px-2 py-0.5 font-mono text-[11px] font-medium tabular-nums text-muted-foreground`,children:wf(et)}),(0,V.jsxs)(`button`,{type:`button`,"data-testid":`${n}-copy`,onClick:rt,className:xf,children:[(0,V.jsx)(he,{"aria-hidden":`true`,className:`size-3`}),`Copy as CSV`]}),F&&Ge.length>0&&(0,V.jsxs)(`button`,{type:`button`,"data-testid":`${n}-delete-rows`,onClick:ot,title:`Deletes the ${Ge.length} selected ${Ge.length===1?`row`:`rows`} from the source CSV`,className:xf,children:[(0,V.jsx)(we,{"aria-hidden":`true`,className:`size-3`}),`Delete `,Ge.length.toLocaleString(),` `,Ge.length===1?`row`:`rows`]}),F&&qe>0&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`span`,{role:`group`,"aria-label":`Column type override`,"data-testid":`input-table-column-type-group`,className:`inline-flex items-center gap-0.5 rounded-md border border-border bg-muted/60 p-0.5`,children:vf.map(({mode:e,label:t})=>{let n=Ye===e;return(0,V.jsx)(`button`,{type:`button`,"data-testid":`input-table-column-type-${e}`,"aria-pressed":n,onClick:()=>Xe(e),className:n?`cursor-pointer rounded bg-background px-1.5 py-0.5 text-[11px] font-medium text-foreground shadow-2xs outline-none focus-visible:ring-3 focus-visible:ring-ring/50`:`cursor-pointer rounded px-1.5 py-0.5 text-[11px] font-medium text-muted-foreground outline-none hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50`,children:t},e)})}),(0,V.jsxs)(`button`,{type:`button`,"data-testid":`${n}-delete-columns`,onClick:st,disabled:at,title:at?`At least one column must remain — the converter needs a column to detect`:`Deletes the ${qe} selected ${qe===1?`column`:`columns`} from the source CSV`,className:`${xf} disabled:cursor-not-allowed disabled:opacity-50`,children:[(0,V.jsx)(we,{"aria-hidden":`true`,className:`size-3`}),`Delete `,qe.toLocaleString(),` `,qe===1?`column`:`columns`]})]}),(0,V.jsx)(`button`,{type:`button`,"data-testid":`${n}-clear-selection`,onClick:He,className:xf,children:`Clear`})]})]}),(0,V.jsxs)(`div`,{ref:f,"data-testid":n,role:`grid`,tabIndex:-1,"aria-rowcount":B.length+1,className:`relative min-h-0 flex-1 outline-none`,style:{minHeight:Ie},children:[(0,V.jsx)(`div`,{className:`absolute inset-0`,children:(0,V.jsx)(Su,{imageWindowLoader:ge.current,renderers:sd,columns:pt,rows:B.length,getCellContent:ut,getCellsForSelection:dt,onCellsEdited:F?lt:void 0,onDelete:F?ct:void 0,onCellClicked:ft,onHeaderClicked:Re,onGridSelectionChange:Ue,onSelectionCleared:We,gridSelection:j,rangeSelect:`multi-rect`,columnSelect:`multi`,rowSelect:`multi`,rowHeight:uf,headerHeight:df,freezeColumns:hf,fillHandle:F,onPaste:F?()=>!0:!1,keybindings:{search:!1},theme:de,drawHeader:mt,drawCell:ht,getRowThemeOverride:gt,minColumnWidth:ff,smoothScrollX:!0,smoothScrollY:!0,verticalBorder:!1})}),w!==null&&(0,V.jsx)(`input`,{ref:O,type:`text`,"data-testid":`csv-header-rename-input`,"aria-label":`Rename column ${L.headers[w.col]??``}`,value:E,onChange:e=>D(e.target.value),onBlur:ze,onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),e.stopPropagation(),ze()):e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),Be())},style:{left:w.bounds.x,top:w.bounds.y,width:Math.max(60,w.bounds.width),height:w.bounds.height},className:`absolute z-20 border border-ring bg-background px-2 font-mono text-[11px] font-semibold tracking-wider text-foreground outline-none ring-2 ring-ring/50`}),Pe&&B.length===0&&(0,V.jsxs)(`div`,{"data-testid":`${n}-empty-filter`,className:`absolute inset-x-0 top-0 z-10 flex flex-col items-center gap-2 p-6 text-sm text-muted-foreground`,children:[(0,V.jsxs)(`span`,{children:[`No rows matching “`,v,`”.`]}),(0,V.jsx)(`button`,{type:`button`,onClick:Le,className:xf,children:`Show all rows`})]}),F&&!Pe&&B.length===0&&(0,V.jsx)(`div`,{"data-testid":`${n}-empty-rows`,className:`absolute inset-x-0 top-0 z-10 flex flex-col items-center gap-2 p-6 text-sm text-muted-foreground`,children:(0,V.jsx)(`span`,{children:`No rows. Paste or upload data to start over.`})})]})]})}function Of(e,t){if(t===``||e===``)return null;let n=t.toLowerCase();if(!e.toLowerCase().includes(n))return null;let r=[],i=e.toLowerCase(),a=0;for(;;){let t=i.indexOf(n,a);if(t===-1)break;t>a&&r.push({text:e.slice(a,t),hit:!1}),r.push({text:e.slice(t,t+n.length),hit:!0}),a=t+n.length}return a`u`?void 0:navigator),a=(0,g.useRef)(null);(0,g.useEffect)(()=>{a.current?.focus()},[]);let o=e===`CSV`;return(0,V.jsx)(`div`,{"data-testid":`dropzone`,className:`flex flex-1 flex-col items-center justify-center p-3 md:p-6 md:px-16`,children:(0,V.jsxs)(`div`,{className:`flex w-full max-w-sm flex-col items-center gap-2.5 md:gap-3`,children:[(0,V.jsx)(`div`,{"aria-hidden":`true`,className:`flex size-9 items-center justify-center rounded-xl border border-border bg-muted/50 text-muted-foreground md:size-11`,children:(0,V.jsx)(fe,{className:`size-4 md:size-5`})}),(0,V.jsx)(`p`,{"data-testid":`dropzone-title`,className:`text-center text-sm font-medium text-foreground`,children:o?`Paste CSV, TSV, or Markdown table`:`Paste JSON or JSONL here`}),(0,V.jsx)(`p`,{"data-testid":`dropzone-formats`,className:`max-w-[36ch] text-center text-[11.5px] leading-relaxed text-muted-foreground`,children:o?`Supports CSV, TSV / spreadsheet cells, Markdown & ChatGPT docs (multi-table), and psql / MySQL box tables`:`Supports JSON arrays, nested objects, wrapped API payloads ({ data: […] }), and JSONL / NDJSON`}),(0,V.jsx)(`textarea`,{ref:a,"data-testid":`paste-field`,rows:1,"aria-label":`Paste ${o?`CSV, TSV, Markdown, or CLI table`:`JSON, JSONL, or API response`} data — or press ${i} to paste anywhere on this page`,placeholder:o?`Paste CSV, TSV, Markdown, or psql/MySQL table here`:`Paste JSON, JSONL / NDJSON, or API response here`,spellCheck:!1,onChange:e=>{let n=e.currentTarget;n.rows=Mf(n.value),t(n.value)},className:`min-h-11 w-full resize-none overflow-hidden rounded-md border border-border bg-background px-3 py-2.5 font-mono text-[12.5px] leading-relaxed text-foreground transition-colors placeholder:font-sans placeholder:text-xs placeholder:text-muted-foreground focus:outline-none focus-visible:border-sky-600 dark:focus-visible:border-sky-400`}),(0,V.jsxs)(`p`,{className:`text-center text-[13px] leading-relaxed text-muted-foreground`,children:[`or drag & drop a file anywhere in this pane — you can also paste anywhere on the page (`,(0,V.jsx)(`kbd`,{"data-testid":`paste-shortcut`,className:`rounded border border-border bg-muted px-1.5 py-0.5 font-mono text-[11px] font-medium text-foreground`,children:i}),`)`]}),(0,V.jsxs)(`div`,{className:`mt-2 flex items-center gap-2`,children:[(0,V.jsxs)(`button`,{type:`button`,"data-testid":`choose-file`,onClick:n,className:`inline-flex h-8 cursor-pointer items-center gap-1.5 whitespace-nowrap rounded-lg border border-border bg-background px-3 text-[13px] font-medium text-foreground transition-colors hover:bg-muted focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50 [&_svg]:size-3.5`,children:[(0,V.jsx)(I,{"aria-hidden":`true`}),`Choose file`]}),(0,V.jsxs)(`button`,{type:`button`,"data-testid":`try-example`,onClick:r,className:`inline-flex h-8 cursor-pointer items-center gap-1.5 whitespace-nowrap rounded-lg px-3 text-[13px] font-medium text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50 [&_svg]:size-3.5`,children:[(0,V.jsx)(be,{"aria-hidden":`true`}),`Try an example`]})]})]})})}var Pf=[],Ff=[];(()=>{let e=`lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,1n,9,16,o,,x,1i,3,,i,,7,a,2,t,3,1k,,,7,2,2,2,3,9,,a,2,q,,2,3,1k,,,5,4,2,2,3,3,,u,2,3,,b,3,1k,,,8,,3,,3,k,2,m,6,,3,1k,,,7,2,2,2,3,7,3,a,2,u,,1n,5,3,3,,4,9,,14,5,1j,,,7,,3,,4,7,2,b,2,t,3,1k,,,7,,3,,4,7,2,b,2,f,,c,4,1j,2,,7,,3,,4,9,,a,2,t,3,1y,,4,6,,,,8,i,2,1p,,,8,c,8,2q,,,a,b,7,21,2,r,,,,,,4,2,1d,k,,2,5,b,,10,9,,2u,b,,6,n,4,4,3,g,4,d,,,3,6,,f,,jj,3,qa,4,s,3,t,2,u,2,1s,w,9,,19,3,,,39,2,y,,3a,c,4,c,63,5,1l,a,,,,,2,o,2,,1c,1a,2,c,k,5,1b,h,12,9,c,3,u,d,1k,e,1c,k,48,3,,l,4,,6,,2,3,5i,1s,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,n,5,4,,2b,2,1e,i,q,i,d,,12,8,p,d,18,4,1b,e,10,,1v,e,c,,8,2,1a,,1f,,,3,2,2,5,2,,,15,5,5,2,6k,8,,2,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,1t,5,8t,2,25,6,1y,b,1d,4,3e,3,1h,f,15,,2,2,a,4,19,b,7,,1p,3,10,e,g,2,18,,c,3,1c,e,8,4,,2,2k,c,6,,2,,4d,c,l,4,1j,2,,7,2,2,2,3,9,,a,2,2,7,3,5,1v,9,,,2,,,4,,5,,,e,2,2a,i,n,,29,k,6j,7,2,9,r,2,2a,h,2y,d,2t,3,2,a,74,f,6t,6,,2,2,4,,,,2,3x,7,2,7,3,,s,a,14,7,,4,8,,9,b,1a,g,5i,8,5j,8,,8,2a,m,,e,3e,6,3,,,2,,7,,,1u,5,,2,,5,9n,4,9,2,,,1c,7,3,5,n,,44l,,6,f,8ug,i,1xc,5,1n,7,t4,,,1j,7,4,29,,b,2,f57,2,3mp,1a,2,n,f2,5,3,6,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,2s,,4g,7,af,,1p,4,e4,4,72,2,6r,,2,,7,2,5,,d6,7,31,7,240,5`.split(`,`).map(e=>e?parseInt(e,36):1);for(let t=0,n=0;t>1;if(e=Ff[r])t=r+1;else return!0;if(t==n)return!1}}function Lf(e){return e>=127462&&e<=127487}var Rf=8205;function zf(e,t,n=!0,r=!0){return(n?Bf:Vf)(e,t,r)}function Bf(e,t,n){if(t==e.length)return t;t&&Uf(e.charCodeAt(t))&&Wf(e.charCodeAt(t-1))&&t--;let r=Hf(e,t);for(t+=Gf(r);t=0&&Lf(Hf(e,r));)n++,r-=2;if(n%2==0)break;t+=2}else break}return t}function Vf(e,t,n){for(;t>1;){let r=Bf(e,t-2,n);if(r=56320&&e<57344}function Wf(e){return e>=55296&&e<56320}function Gf(e){return e<65536?1:2}var Kf=class e{lineAt(e){if(e<0||e>this.length)throw RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,n){[e,t]=np(this,e,t);let r=[];return this.decompose(0,e,r,2),n.length&&n.decompose(0,n.length,r,3),this.decompose(t,this.length,r,1),Jf.from(r,this.length-(t-e)+n.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=np(this,e,t);let n=[];return this.decompose(e,t,n,0),Jf.from(n,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),n=this.length-this.scanIdentical(e,-1),r=new Qf(this),i=new Qf(e);for(let e=t,a=t;;){if(r.next(e),i.next(e),e=0,r.lineBreak!=i.lineBreak||r.done!=i.done||r.value!=i.value)return!1;if(a+=r.value.length,r.done||a>=n)return!0}}iter(e=1){return new Qf(this,e)}iterRange(e,t=this.length){return new $f(this,e,t)}iterLines(e,t){let n;if(e==null)n=this.iter();else{t??=this.lines+1;let r=this.line(e).from;n=this.iterRange(r,Math.max(r,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new ep(n)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(t){if(t.length==0)throw RangeError(`A document must have at least one line`);return t.length==1&&!t[0]?e.empty:t.length<=32?new qf(t):Jf.from(qf.split(t,[]))}},qf=class e extends Kf{constructor(e,t=Yf(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,n,r){for(let i=0;;i++){let a=this.text[i],o=r+a.length;if((t?n:o)>=e)return new tp(r,o,n,a);r=o+1,n++}}decompose(t,n,r,i){let a=t<=0&&n>=this.length?this:new e(Zf(this.text,t,n),Math.min(n,this.length)-Math.max(0,t));if(i&1){let t=r.pop(),n=Xf(a.text,t.text.slice(),0,a.length);if(n.length<=32)r.push(new e(n,t.length+a.length));else{let t=n.length>>1;r.push(new e(n.slice(0,t)),new e(n.slice(t)))}}else r.push(a)}replace(t,n,r){if(!(r instanceof e))return super.replace(t,n,r);[t,n]=np(this,t,n);let i=Xf(this.text,Xf(r.text,Zf(this.text,0,t)),n),a=this.length+r.length-(n-t);return i.length<=32?new e(i,a):Jf.from(e.split(i,[]),a)}sliceString(e,t=this.length,n=` +`){[e,t]=np(this,e,t);let r=``;for(let i=0,a=0;i<=t&&ae&&a&&(r+=n),ei&&(r+=o.slice(Math.max(0,e-i),t-i)),i=s+1}return r}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(t,n){let r=[],i=-1;for(let a of t)r.push(a),i+=a.length+1,r.length==32&&(n.push(new e(r,i)),r=[],i=-1);return i>-1&&n.push(new e(r,i)),n}},Jf=class e extends Kf{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let t of e)this.lines+=t.lines}lineInner(e,t,n,r){for(let i=0;;i++){let a=this.children[i],o=r+a.length,s=n+a.lines-1;if((t?s:o)>=e)return a.lineInner(e,t,n,r);r=o+1,n=s+1}}decompose(e,t,n,r){for(let i=0,a=0;a<=t&&i=a){let i=r&(a<=e|(s>=t?2:0));a>=e&&s<=t&&!i?n.push(o):o.decompose(e-a,t-a,n,i)}a=s+1}}replace(t,n,r){if([t,n]=np(this,t,n),r.lines=a&&n<=s){let c=o.replace(t-a,n-a,r),l=this.lines-o.lines+c.lines;if(c.lines>4&&c.lines>l>>6){let a=this.children.slice();return a[i]=c,new e(a,this.length-(n-t)+r.length)}return super.replace(a,s,c)}a=s+1}return super.replace(t,n,r)}sliceString(e,t=this.length,n=` +`){[e,t]=np(this,e,t);let r=``;for(let i=0,a=0;ie&&i&&(r+=n),ea&&(r+=o.sliceString(e-a,t-a,n)),a=s+1}return r}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(t,n){if(!(t instanceof e))return 0;let r=0,[i,a,o,s]=n>0?[0,0,this.children.length,t.children.length]:[this.children.length-1,t.children.length-1,-1,-1];for(;;i+=n,a+=n){if(i==o||a==s)return r;let e=this.children[i],c=t.children[a];if(e!=c)return r+e.scanIdentical(c,n);r+=e.length+1}}static from(t,n=t.reduce((e,t)=>e+t.length+1,-1)){let r=0;for(let e of t)r+=e.lines;if(r<32){let e=[];for(let n of t)n.flatten(e);return new qf(e,n)}let i=Math.max(32,r>>5),a=i<<1,o=i>>1,s=[],c=0,l=-1,u=[];function d(t){let n;if(t.lines>a&&t instanceof e)for(let e of t.children)d(e);else t.lines>o&&(c>o||!c)?(f(),s.push(t)):t instanceof qf&&c&&(n=u[u.length-1])instanceof qf&&t.lines+n.lines<=32?(c+=t.lines,l+=t.length+1,u[u.length-1]=new qf(n.text.concat(t.text),n.length+1+t.length)):(c+t.lines>i&&f(),c+=t.lines,l+=t.length+1,u.push(t))}function f(){c!=0&&(s.push(u.length==1?u[0]:e.from(u,l)),l=-1,c=u.length=0)}for(let e of t)d(e);return f(),s.length==1?s[0]:new e(s,n)}};Kf.empty=new qf([``],0);function Yf(e){let t=-1;for(let n of e)t+=n.length+1;return t}function Xf(e,t,n=0,r=1e9){for(let i=0,a=0,o=!0;a=n&&(c>r&&(s=s.slice(0,r-i)),i0?1:(e instanceof qf?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let n=this.nodes.length-1,r=this.nodes[n],i=this.offsets[n],a=i>>1,o=r instanceof qf?r.text.length:r.children.length;if(a==(t>0?o:0)){if(n==0)return this.done=!0,this.value=``,this;t>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((i&1)==(t>0?0:1)){if(this.offsets[n]+=t,e==0)return this.lineBreak=!0,this.value=` +`,this;e--}else if(r instanceof qf){let i=r.text[a+(t<0?-1:0)];if(this.offsets[n]+=t,i.length>Math.max(0,e))return this.value=e==0?i:t>0?i.slice(e):i.slice(0,i.length-e),this;e-=i.length}else{let i=r.children[a+(t<0?-1:0)];e>i.length?(e-=i.length,this.offsets[n]+=t):(t<0&&this.offsets[n]--,this.nodes.push(i),this.offsets.push(t>0?1:(i instanceof qf?i.text.length:i.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}},$f=class{constructor(e,t,n){this.value=``,this.done=!1,this.cursor=new Qf(e,t>n?-1:1),this.pos=t>n?e.length:0,this.from=Math.min(t,n),this.to=Math.max(t,n)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value=``,this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let n=t<0?this.pos-this.from:this.to-this.pos;e>n&&(e=n),n-=e;let{value:r}=this.cursor.next(e);return this.pos+=(r.length+e)*t,this.value=r.length<=n?r:t<0?r.slice(r.length-n):r.slice(0,n),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=``}},ep=class{constructor(e){this.inner=e,this.afterBreak=!0,this.value=``,this.done=!1}next(e=0){let{done:t,lineBreak:n,value:r}=this.inner.next(e);return t&&this.afterBreak?(this.value=``,this.afterBreak=!1):t?(this.done=!0,this.value=``):n?this.afterBreak?this.value=``:(this.afterBreak=!0,this.next()):(this.value=r,this.afterBreak=!1),this}get lineBreak(){return!1}};typeof Symbol<`u`&&(Kf.prototype[Symbol.iterator]=function(){return this.iter()},Qf.prototype[Symbol.iterator]=$f.prototype[Symbol.iterator]=ep.prototype[Symbol.iterator]=function(){return this});var tp=class{constructor(e,t,n,r){this.from=e,this.to=t,this.number=n,this.text=r}get length(){return this.to-this.from}};function np(e,t,n){return t=Math.max(0,Math.min(e.length,t)),[t,Math.max(t,Math.min(e.length,n))]}function rp(e,t,n=!0,r=!0){return zf(e,t,n,r)}function ip(e){return e>=56320&&e<57344}function ap(e){return e>=55296&&e<56320}function op(e,t){let n=e.charCodeAt(t);if(!ap(n)||t+1==e.length)return n;let r=e.charCodeAt(t+1);return ip(r)?(n-55296<<10)+(r-56320)+65536:n}function sp(e){return e<65536?1:2}var cp=/\r\n?|\n/,lp=(function(e){return e[e.Simple=0]=`Simple`,e[e.TrackDel=1]=`TrackDel`,e[e.TrackBefore=2]=`TrackBefore`,e[e.TrackAfter=3]=`TrackAfter`,e})(lp||={}),up=class e{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;te)return i+(e-r);i+=o}else{if(n!=lp.Simple&&c>=e&&(n==lp.TrackDel&&re||n==lp.TrackBefore&&re))return null;if(c>e||c==e&&t<0&&!o)return e==r||t<0?i:i+s;i+=s}r=c}if(e>r)throw RangeError(`Position ${e} is out of range for changeset of length ${r}`);return i}touchesRange(e,t=e){for(let n=0,r=0;n=0&&r<=t&&o>=e)return rt?`cover`:!0;r=o}return!1}toString(){let e=``;for(let t=0;t=0?`:`+r:``)}return e}toJSON(){return this.sections}static fromJSON(t){if(!Array.isArray(t)||t.length%2||t.some(e=>typeof e!=`number`))throw RangeError(`Invalid JSON representation of ChangeDesc`);return new e(t)}static create(t){return new e(t)}},dp=class e extends up{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw RangeError(`Applying change set to a document with the wrong length`);return mp(this,(t,n,r,i,a)=>e=e.replace(r,r+(n-t),a),!1),e}mapDesc(e,t=!1){return hp(this,e,t,!0)}invert(t){let n=this.sections.slice(),r=[];for(let e=0,i=0;e=0){n[e]=o,n[e+1]=a;let s=e>>1;for(;r.length0&&pp(r,n,a.text),a.forward(e),o+=e}let c=t[e++];for(;o>1].toJSON()))}return e}static of(t,n,r){let i=[],a=[],o=0,s=null;function c(t=!1){if(!t&&!i.length)return;os||e<0||s>n)throw RangeError(`Invalid change range ${e} to ${s} (in doc of length ${n})`);let u=l?typeof l==`string`?Kf.of(l.split(r||cp)):l:Kf.empty,d=u.length;if(e==s&&d==0)return;eo&&fp(i,e-o,-1),fp(i,s-e,d),pp(a,i,u),o=s}}return l(t),c(!s),s}static empty(t){return new e(t?[t,-1]:[],[])}static fromJSON(t){if(!Array.isArray(t))throw RangeError(`Invalid JSON representation of ChangeSet`);let n=[],r=[];for(let e=0;et&&typeof e!=`string`))throw RangeError(`Invalid JSON representation of ChangeSet`);else if(i.length==1)n.push(i[0],0);else{for(;r.length=0&&n<=0&&n==e[i+1]?e[i]+=t:i>=0&&t==0&&e[i]==0?e[i+1]+=n:r?(e[i]+=t,e[i+1]+=n):e.push(t,n)}function pp(e,t,n){if(n.length==0)return;let r=t.length-2>>1;if(r>1])),!(n||o==e.sections.length||e.sections[o+1]<0);)s=e.sections[o++],c=e.sections[o++];t(i,l,a,u,d),i=l,a=u}}}function hp(e,t,n,r=!1){let i=[],a=r?[]:null,o=new _p(e),s=new _p(t);for(let e=-1;;)if(o.done&&s.len||s.done&&o.len)throw Error(`Mismatched change set lengths`);else if(o.ins==-1&&s.ins==-1){let e=Math.min(o.len,s.len);fp(i,e,-1),o.forward(e),s.forward(e)}else if(s.ins>=0&&(o.ins<0||e==o.i||o.off==0&&(s.len=0&&e=0){let t=0,n=o.len;for(;n;)if(s.ins==-1){let e=Math.min(n,s.len);t+=e,n-=e,s.forward(e)}else if(s.ins==0&&s.lent||o.ins>=0&&o.len>t)&&(e||r.length>n),a.forward2(t),o.forward(t)}}var _p=class{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i>1;return t>=e.length?Kf.empty:e[t]}textBit(e){let{inserted:t}=this.set,n=this.i-2>>1;return n>=t.length&&!e?Kf.empty:t[n].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}},vp=class e{constructor(e,t,n,r){this.from=e,this.to=t,this.flags=n,this.goalColumn=r}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get undirectional(){return(this.flags&64)>0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}map(t,n=-1){let r,i;return this.empty?r=i=t.mapPos(this.from,n):(r=t.mapPos(this.from,1),i=t.mapPos(this.to,-1)),r==this.from&&i==this.to?this:new e(r,i,this.flags,this.goalColumn)}extend(e,t=e,n=0){if(e<=this.anchor&&t>=this.anchor)return Y.range(e,t,void 0,void 0,n);let r=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return Y.range(this.anchor,r,void 0,void 0,n)}eq(e,t=!1){return this.anchor==e.anchor&&this.head==e.head&&this.goalColumn==e.goalColumn&&(!t||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!=`number`||typeof e.head!=`number`)throw RangeError(`Invalid JSON representation for SelectionRange`);return Y.range(e.anchor,e.head)}static create(t,n,r,i){return new e(t,n,r,i)}},Y=class e{constructor(e,t){this.ranges=e,this.mainIndex=t}map(t,n=-1){return t.empty?this:e.create(this.ranges.map(e=>e.map(t,n)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let n=0;ne.toJSON()),main:this.mainIndex}}static fromJSON(t){if(!t||!Array.isArray(t.ranges)||typeof t.main!=`number`||t.main>=t.ranges.length)throw RangeError(`Invalid JSON representation for EditorSelection`);return new e(t.ranges.map(e=>vp.fromJSON(e)),t.main)}static single(t,n=t){return new e([e.range(t,n)],0)}static create(t,n=0){if(t.length==0)throw RangeError(`A selection needs at least one range`);for(let r=0,i=0;ie.from-t.from),n=t.indexOf(r);for(let r=1;ri.head?e.range(s,o):e.range(o,s))}}return new e(t,n)}};function yp(e,t){for(let n of e.ranges)if(n.to>t)throw RangeError(`Selection points outside of document`)}var bp=0,X=class e{constructor(e,t,n,r,i){this.combine=e,this.compareInput=t,this.compare=n,this.isStatic=r,this.id=bp++,this.default=e([]),this.extensions=typeof i==`function`?i(this):i}get reader(){return this}static define(t={}){return new e(t.combine||(e=>e),t.compareInput||((e,t)=>e===t),t.compare||(t.combine?(e,t)=>e===t:xp),!!t.static,t.enables)}of(e){return new Sp([],this,0,e)}compute(e,t){if(this.isStatic)throw Error(`Can't compute a static facet`);return new Sp(e,this,1,t)}computeN(e,t){if(this.isStatic)throw Error(`Can't compute a static facet`);return new Sp(e,this,2,t)}from(e,t){return t||=e=>e,this.compute([e],n=>t(n.field(e)))}};function xp(e,t){return e==t||e.length==t.length&&e.every((e,n)=>e===t[n])}var Sp=class{constructor(e,t,n,r){this.dependencies=e,this.facet=t,this.type=n,this.value=r,this.id=bp++}dynamicSlot(e){let t=this.value,n=this.facet.compareInput,r=this.id,i=e[r]>>1,a=this.type==2,o=!1,s=!1,c=[];for(let t of this.dependencies)t==`doc`?o=!0:t==`selection`?s=!0:(e[t.id]??1)&1||c.push(e[t.id]);return{create(e){return e.values[i]=t(e),1},update(e,r){if(o&&r.docChanged||s&&(r.docChanged||r.selection)||wp(e,c)){let r=t(e);if(a?!Cp(r,e.values[i],n):!n(r,e.values[i]))return e.values[i]=r,1}return 0},reconfigure:(e,o)=>{let s,c=o.config.address[r];if(c!=null){let r=Lp(o,c);if(this.dependencies.every(t=>t instanceof X?o.facet(t)===e.facet(t):t instanceof Dp?o.field(t,!1)==e.field(t,!1):!0)||(a?Cp(s=t(e),r,n):n(s=t(e),r)))return e.values[i]=r,0}else s=t(e);return e.values[i]=s,1}}}get extension(){return this}};function Cp(e,t,n){if(e.length!=t.length)return!1;for(let r=0;re[t.id]),i=n.map(e=>e.type),a=r.filter(e=>!(e&1)),o=e[t.id]>>1;function s(e){let n=[];for(let t=0;te===t),t);return t.provide&&(n.provides=t.provide(n)),n}create(e){return(e.facet(Ep).find(e=>e.field==this)?.create||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:e=>(e.values[t]=this.create(e),1),update:(e,n)=>{let r=e.values[t],i=this.updateF(r,n);return this.compareF(r,i)?0:(e.values[t]=i,1)},reconfigure:(e,n)=>{let r=e.facet(Ep),i=n.facet(Ep),a;return(a=r.find(e=>e.field==this))&&a!=i.find(e=>e.field==this)?(e.values[t]=a.create(e),1):n.config.address[this.id]==null?(e.values[t]=this.create(e),1):(e.values[t]=n.field(this),0)}}}init(e){return[this,Ep.of({field:this,create:e})]}get extension(){return this}},Op={lowest:4,low:3,default:2,high:1,highest:0};function kp(e){return t=>new jp(t,e)}var Ap={highest:kp(Op.highest),high:kp(Op.high),default:kp(Op.default),low:kp(Op.low),lowest:kp(Op.lowest)},jp=class{constructor(e,t){this.inner=e,this.prec=t}get extension(){return this}},Mp=class e{of(e){return new Np(this,e)}reconfigure(t){return e.reconfigure.of({compartment:this,extension:t})}get(e){return e.config.compartments.get(this)}},Np=class{constructor(e,t){this.compartment=e,this.inner=t}get extension(){return this}},Pp=class e{constructor(e,t,n,r,i,a){for(this.base=e,this.compartments=t,this.dynamicSlots=n,this.address=r,this.staticValues=i,this.facets=a,this.statusTemplate=[];this.statusTemplate.length>1]}static resolve(t,n,r){let i=[],a=Object.create(null),o=new Map;for(let e of Fp(t,n,o))e instanceof Dp?i.push(e):(a[e.facet.id]||(a[e.facet.id]=[])).push(e);let s=Object.create(null),c=[],l=[];for(let e of i)s[e.id]=l.length<<1,l.push(t=>e.slot(t));let u=r?.config.facets;for(let e in a){let t=a[e],n=t[0].facet,i=u&&u[e]||[];if(t.every(e=>e.type==0)){if(s[n.id]=c.length<<1|1,xp(i,t))c.push(r.facet(n));else{let e=n.combine(t.map(e=>e.value));c.push(r&&n.compare(e,r.facet(n))?r.facet(n):e)}}else{for(let e of t)e.type==0?(s[e.id]=c.length<<1|1,c.push(e.value)):(s[e.id]=l.length<<1,l.push(t=>e.dynamicSlot(t)));s[n.id]=l.length<<1,l.push(e=>Tp(e,n,t))}}let d=l.map(e=>e(s));return new e(t,o,d,s,c,a)}};function Fp(e,t,n){let r=[[],[],[],[],[]],i=new Map;function a(e,o){let s=i.get(e);if(s!=null){if(s<=o)return;let t=r[s].indexOf(e);t>-1&&r[s].splice(t,1),e instanceof Np&&n.delete(e.compartment)}if(i.set(e,o),Array.isArray(e))for(let t of e)a(t,o);else if(e instanceof Np){if(n.has(e.compartment))throw RangeError(`Duplicate use of compartment in extensions`);let r=t.get(e.compartment)||e.inner;n.set(e.compartment,r),a(r,o)}else if(e instanceof jp)a(e.inner,e.prec);else if(e instanceof Dp)r[o].push(e),e.provides&&a(e.provides,o);else if(e instanceof Sp)r[o].push(e),e.facet.extensions&&a(e.facet.extensions,Op.default);else{let t=e.extension;if(!t)throw Error(`Unrecognized extension value in extension set (${e}).`);if(t==e)throw Error(`Unrecognized extension value in extension set (${e}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);a(t,o)}}return a(e,Op.default),r.reduce((e,t)=>e.concat(t))}function Ip(e,t){if(t&1)return 2;let n=t>>1,r=e.status[n];if(r==4)throw Error(`Cyclic dependency between fields and/or facets`);if(r&2)return r;e.status[n]=4;let i=e.computeSlot(e,e.config.dynamicSlots[n]);return e.status[n]=2|i}function Lp(e,t){return t&1?e.config.staticValues[t>>1]:e.values[t>>1]}var Rp=X.define(),zp=X.define({combine:e=>e.some(e=>e),static:!0}),Bp=X.define({combine:e=>e.length?e[0]:void 0,static:!0}),Vp=X.define(),Hp=X.define(),Up=X.define(),Wp=X.define({combine:e=>e.length?e[0]:!1}),Gp=class{constructor(e,t){this.type=e,this.value=t}static define(){return new Kp}},Kp=class{of(e){return new Gp(this,e)}},qp=class{constructor(e){this.map=e}of(e){return new Jp(this,e)}},Jp=class e{constructor(e,t){this.type=e,this.value=t}map(t){let n=this.type.map(this.value,t);return n===void 0?void 0:n==this.value?this:new e(this.type,n)}is(e){return this.type==e}static define(e={}){return new qp(e.map||(e=>e))}static mapEffects(e,t){if(!e.length)return e;let n=[];for(let r of e){let e=r.map(t);e&&n.push(e)}return n}};Jp.reconfigure=Jp.define(),Jp.appendConfig=Jp.define();var Yp=class e{constructor(t,n,r,i,a,o){this.startState=t,this.changes=n,this.selection=r,this.effects=i,this.annotations=a,this.scrollIntoView=o,this._doc=null,this._state=null,r&&yp(r,n.newLength),a.some(t=>t.type==e.time)||(this.annotations=a.concat(e.time.of(Date.now())))}static create(t,n,r,i,a,o){return new e(t,n,r,i,a,o)}get newDoc(){return this._doc||=this.changes.apply(this.startState.doc)}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(t){let n=this.annotation(e.userEvent);return!!(n&&(n==t||n.length>t.length&&n.slice(0,t.length)==t&&n[t.length]==`.`))}};Yp.time=Gp.define(),Yp.userEvent=Gp.define(),Yp.addToHistory=Gp.define(),Yp.remote=Gp.define();function Xp(e,t){let n=[];for(let r=0,i=0;;){let a,o;if(r=e[r]))a=e[r++],o=e[r++];else if(i=0;n--){let i=r[n](e);e=i instanceof Yp?i:Array.isArray(i)&&i.length==1&&i[0]instanceof Yp?i[0]:$p(t,rm(i),!1)}return e}function tm(e){let t=e.startState,n=t.facet(Up),r=e;for(let i=n.length-1;i>=0;i--){let a=n[i](e);a&&Object.keys(a).length&&(r=Zp(r,Qp(t,a,e.changes.newLength),!0))}return r==e?e:Yp.create(t,e.changes,e.selection,r.effects,r.annotations,r.scrollIntoView)}var nm=[];function rm(e){return e==null?nm:Array.isArray(e)?e:[e]}var im=(function(e){return e[e.Word=0]=`Word`,e[e.Space=1]=`Space`,e[e.Other=2]=`Other`,e})(im||={}),am=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,om;try{om=RegExp(`[\\p{Alphabetic}\\p{Number}_]`,`u`)}catch{}function sm(e){if(om)return om.test(e);for(let t=0;t`€`&&(n.toUpperCase()!=n.toLowerCase()||am.test(n)))return!0}return!1}function cm(e){return t=>{if(!/\S/.test(t))return im.Space;if(sm(t))return im.Word;for(let n=0;n-1)return im.Word;return im.Other}}var lm=class e{constructor(e,t,n,r,i,a){this.config=e,this.doc=t,this.selection=n,this.values=r,this.status=e.statusTemplate.slice(),this.computeSlot=i,a&&(a._state=this);for(let e=0;ei.set(t,e)),null),i.set(e.value.compartment,e.value.extension)):e.is(Jp.reconfigure)?(n=null,r=e.value):e.is(Jp.appendConfig)&&(n=null,r=rm(r).concat(e.value));let a;n?a=t.startState.values.slice():(n=Pp.resolve(r,i,this),a=new e(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(e,t)=>t.reconfigure(e,this),null).values);let o=t.startState.facet(zp)?t.newSelection:t.newSelection.asSingle();new e(n,t.newDoc,o,a,(e,n)=>n.update(e,t),t)}replaceSelection(e){return typeof e==`string`&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:Y.cursor(t.from+e.length,-1)}))}changeByRange(e){let t=this.selection,n=e(t.ranges[0]),r=this.changes(n.changes),i=[n.range],a=rm(n.effects);for(let n=1;nn.spec.fromJSON(a,e)))}}return e.create({doc:t.doc,selection:Y.fromJSON(t.selection),extensions:n.extensions?i.concat([n.extensions]):i})}static create(t={}){let n=Pp.resolve(t.extensions||[],new Map),r=t.doc instanceof Kf?t.doc:Kf.of((t.doc||``).split(n.staticFacet(e.lineSeparator)||cp)),i=t.selection?t.selection instanceof Y?t.selection:Y.single(t.selection.anchor,t.selection.head):Y.single(0);return yp(i,r.length),n.staticFacet(zp)||(i=i.asSingle()),new e(n,r,i,n.dynamicSlots.map(()=>null),(e,t)=>t.create(e),null)}get tabSize(){return this.facet(e.tabSize)}get lineBreak(){return this.facet(e.lineSeparator)||` +`}get readOnly(){return this.facet(Wp)}phrase(t,...n){for(let n of this.facet(e.phrases))if(Object.prototype.hasOwnProperty.call(n,t)){t=n[t];break}return n.length&&(t=t.replace(/\$(\$|\d*)/g,(e,t)=>{if(t==`$`)return`$`;let r=+(t||1);return!r||r>n.length?e:n[r-1]})),t}languageDataAt(e,t,n=-1){let r=[];for(let i of this.facet(Rp))for(let a of i(this,t,n))Object.prototype.hasOwnProperty.call(a,e)&&r.push(a[e]);return r}charCategorizer(e){let t=this.languageDataAt(`wordChars`,e);return cm(t.length?t[0]:``)}wordAt(e){let{text:t,from:n,length:r}=this.doc.lineAt(e),i=this.charCategorizer(e),a=e-n,o=e-n;for(;a>0;){let e=rp(t,a,!1);if(i(t.slice(e,a))!=im.Word)break;a=e}for(;oe.length?e[0]:4}),lm.lineSeparator=Bp,lm.readOnly=Wp,lm.phrases=X.define({compare(e,t){let n=Object.keys(e),r=Object.keys(t);return n.length==r.length&&n.every(n=>e[n]==t[n])}}),lm.languageData=Rp,lm.changeFilter=Vp,lm.transactionFilter=Hp,lm.transactionExtender=Up,Mp.reconfigure=Jp.define();function um(e,t,n={}){let r={};for(let t of e)for(let e of Object.keys(t)){let i=t[e],a=r[e];if(a===void 0)r[e]=i;else if(a!==i&&i!==void 0){if(Object.hasOwnProperty.call(n,e))r[e]=n[e](a,i);else throw Error(`Config merge conflict for field `+e)}}for(let e in t)r[e]===void 0&&(r[e]=t[e]);return r}var dm=class{eq(e){return this==e}range(e,t=e){return pm.create(e,t,this)}};dm.prototype.startSide=dm.prototype.endSide=0,dm.prototype.point=!1,dm.prototype.mapMode=lp.TrackDel;function fm(e,t){return e==t||e.constructor==t.constructor&&e.eq(t)}var pm=class e{constructor(e,t,n){this.from=e,this.to=t,this.value=n}static create(t,n,r){return new e(t,n,r)}};function mm(e,t){return e.from-t.from||e.value.startSide-t.value.startSide}var hm=class e{constructor(e,t,n,r){this.from=e,this.to=t,this.value=n,this.maxPoint=r}get length(){return _m(this.to)}findIndex(e,t,n,r=0){let i=n?this.to:this.from;for(let a=r,o=i.length;;){if(a==o)return a;let r=a+o>>1,s=i[r]-e||(n?this.value[r].endSide:this.value[r].startSide)-t;if(r==a)return s>=0?a:o;s>=0?o=r:a=r+1}}between(e,t,n,r){for(let i=this.findIndex(t,-1e9,!0),a=this.findIndex(n,1e9,!1,i);ih||m==h&&d.startSide>0&&d.endSide<=0)continue;if(!((h-m||d.endSide-d.startSide)<0)){if(l<0&&(l=m),d.point&&(u=Math.max(u,h-m)),(m-r||d.startSide-i)>=0)o.push(d),s.push(m-l),c.push(h-l),r=h,i=d.endSide;else{if(m==h)for(let e=o.length;e>0;e--){if((m-(c[e-1]+l)||d.startSide-o[e-1].endSide)>=0){o.splice(e,0,d),s.splice(e,0,m-l),c.splice(e,0,h-l);continue iter}if((m-(s[e-1]+l)||d.endSide-o[e-1].startSide)>0)break}a(m,h,d)}}}return{mapped:o.length?new e(s,c,o,u):null,pos:l}}},gm=class e{constructor(e,t,n,r){this.chunkPos=e,this.chunk=t,this.nextLayer=n,this.maxPoint=r}static create(t,n,r,i){return new e(t,n,r,i)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(t){let{add:n=[],sort:r=!1,filterFrom:i=0,filterTo:a=this.length}=t,o=t.filter;if(n.length==0&&!o)return this;if(r&&(n=n.slice().sort(mm)),this.isEmpty)return n.length?e.of(n):this;let s=new xm(this,null,-1).goto(0),c=0,l=[],u=new ym;for(;s.value||c=0){let e=n[c++];u.addInner(e.from,e.to,e.value,!1)||l.push(e)}else s.rangeIndex==1&&s.chunkIndexthis.chunkEnd(s.chunkIndex)||as.to||a{a||=new ym,a.addRange(e,t,n,!1)};for(let e=0;e=i&&e<=i+a.length&&a.between(i,e-i,t-i,n)===!1)return}this.nextLayer.between(e,t,n)}}iter(e=0){return Sm.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return Sm.from(e).goto(t)}static compare(e,t,n,r,i=-1){let a=e.filter(e=>e.maxPoint>0||!e.isEmpty&&e.maxPoint>=i),o=t.filter(e=>e.maxPoint>0||!e.isEmpty&&e.maxPoint>=i),s=bm(a,o,n),c=new wm(a,s,i),l=new wm(o,s,i);n.iterGaps((e,t,n)=>Tm(c,e,l,t,n,r)),n.empty&&n.length==0&&Tm(c,0,l,0,0,r)}static eq(e,t,n=0,r){r??=1e9-1;let i=e.filter(e=>!e.isEmpty&&t.indexOf(e)<0),a=t.filter(t=>!t.isEmpty&&e.indexOf(t)<0);if(i.length!=a.length)return!1;if(!i.length)return!0;let o=bm(i,a),s=new wm(i,o,0).goto(n),c=new wm(a,o,0).goto(n);for(;;){if(s.to!=c.to||!Em(s.active,c.active)||s.point&&(!c.point||!fm(s.point,c.point)))return!1;if(s.to>r)return!0;s.next(),c.next()}}static spans(e,t,n,r,i=-1){let a=new wm(e,null,i).goto(t),o=t,s=a.openStart;for(;;){let e=Math.min(a.to,n);if(a.point){let n=a.activeForPoint(a.to),i=a.pointFromo&&(r.span(o,e,a.active,s),s=a.openEnd(e));if(a.to>n)return s+(a.point&&a.to>n?1:0);o=a.to,a.next()}}static of(e,t=!1){let n=new ym;for(let r of e instanceof pm?[e]:t?vm(e):e)n.add(r.from,r.to,r.value);return n.finish()}static join(t){if(!t.length)return e.empty;let n=_m(t);for(let r=t.length-2;r>=0;r--)for(let i=t[r];i!=e.empty;i=i.nextLayer)n=new e(i.chunkPos,i.chunk,n,Math.max(i.maxPoint,n.maxPoint));return n}};gm.empty=new gm([],[],null,-1);function _m(e){return e[e.length-1]}function vm(e){if(e.length>1)for(let t=e[0],n=1;n0)return e.slice().sort(mm);t=r}return e}gm.empty.nextLayer=gm.empty;var ym=class e{finishChunk(e){this.chunks.push(new hm(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,t,n){this.addRange(e,t,n,!0)}addRange(t,n,r,i){this.addInner(t,n,r,i)||(this.nextLayer||=new e).addRange(t,n,r,i)}addInner(e,t,n,r){let i=e-this.lastTo||n.startSide-this.last.endSide;if(r&&i<=0&&(e-this.lastFrom||n.startSide-this.last.startSide)<0)throw Error("Ranges must be added sorted by `from` position and `startSide`");return i<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(t-this.chunkStart),this.last=n,this.lastFrom=e,this.lastTo=t,this.value.push(n),n.point&&(this.maxPoint=Math.max(this.maxPoint,t-e)),!0)}addChunk(e,t){if((e-this.lastTo||t.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,t.maxPoint),this.chunks.push(t),this.chunkPos.push(e);let n=t.value.length-1;return this.last=t.value[n],this.lastFrom=t.from[n]+e,this.lastTo=t.to[n]+e,!0}finish(){return this.finishInner(gm.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let t=gm.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}};function bm(e,t,n){let r=new Map;for(let t of e)for(let e=0;e=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex=r&&i.push(new xm(a,n,r,e));return i.length==1?i[0]:new e(i)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let n of this.heap)n.goto(e,t);for(let e=this.heap.length>>1;e>=0;e--)Cm(this.heap,e);return this.next(),this}forward(e,t){for(let n of this.heap)n.forward(e,t);for(let e=this.heap.length>>1;e>=0;e--)Cm(this.heap,e);(this.to-e||this.value.endSide-t)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),Cm(this.heap,0)}}};function Cm(e,t){for(let n=e[t];;){let r=(t<<1)+1;if(r>=e.length)break;let i=e[r];if(r+1=0&&(i=e[r+1],r++),n.compare(i)<0)break;e[r]=n,e[t]=i,t=r}}var wm=class{constructor(e,t,n){this.minPoint=n,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=Sm.from(e,t,n)}goto(e,t=-1e9){return this.cursor.goto(e,t),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=t,this.openStart=-1,this.next(),this}forward(e,t){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-t)<0;)this.removeActive(this.minActive);this.cursor.forward(e,t)}removeActive(e){Dm(this.active,e),Dm(this.activeTo,e),Dm(this.activeRank,e),this.minActive=km(this.active,this.activeTo)}addActive(e){let t=0,{value:n,to:r,rank:i}=this.cursor;for(;t0;)t++;Om(this.active,t,n),Om(this.activeTo,t,r),Om(this.activeRank,t,i),e&&Om(e,t,this.cursor.from),this.minActive=km(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let n=this.openStart<0?[]:null;for(;;){let r=this.minActive;if(r>-1&&(this.activeTo[r]-this.cursor.from||this.active[r].endSide-this.cursor.startSide)<0){if(this.activeTo[r]>e){this.to=this.activeTo[r],this.endSide=this.active[r].endSide;break}this.removeActive(r),n&&Dm(n,r)}else if(!this.cursor.value){this.to=this.endSide=1e9;break}else if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let e=this.cursor.value;if(!e.point)this.addActive(n),this.cursor.next();else if(t&&this.cursor.to==this.to&&this.cursor.from=0&&n[t]=0&&!(this.activeRank[n]e||this.activeTo[n]==e&&this.active[n].endSide>=this.point.endSide)&&t.push(this.active[n]);return t.reverse()}openEnd(e){let t=0;for(let n=this.activeTo.length-1;n>=0&&this.activeTo[n]>e;n--)t++;return t}};function Tm(e,t,n,r,i,a){e.goto(t),n.goto(r);let o=r+i,s=r,c=r-t,l=!!a.boundChange;for(let t=!1;;){let r=e.to+c-n.to,i=r||e.endSide-n.endSide,u=i<0?e.to+c:n.to,d=Math.min(u,o);if(e.point||n.point?(e.point&&n.point&&fm(e.point,n.point)&&Em(e.activeForPoint(e.to),n.activeForPoint(n.to))||a.comparePoint(s,d,e.point,n.point),t=!1):(t&&=(a.boundChange(s),!1),d>s&&!Em(e.active,n.active)&&a.compareRange(s,d,e.active,n.active),l&&do)break;s=u,i<=0&&e.next(),i>=0&&n.next()}}function Em(e,t){if(e.length!=t.length)return!1;for(let n=0;n=t;n--)e[n+1]=e[n];e[t]=n}function km(e,t){let n=-1,r=1e9;for(let i=0;i=t)return r;if(r==e.length)break;i+=e.charCodeAt(r)==9?n-i%n:1,r=rp(e,r)}return r===!0?-1:e.length}for(var Mm=`ͼ`,Nm=typeof Symbol>`u`?`__ͼ`:Symbol.for(Mm),Pm=typeof Symbol>`u`?`__styleSet`+Math.floor(Math.random()*1e8):Symbol(`styleSet`),Fm=typeof globalThis<`u`?globalThis:typeof window<`u`?window:{},Im=class{constructor(e,t){this.rules=[];let{finish:n}=t||{};function r(e){return/^@/.test(e)?[e]:e.split(/,\s*/)}function i(e,t,a,o){let s=[],c=/^@(\w+)\b/.exec(e[0]),l=c&&c[1]==`keyframes`;if(c&&t==null)return a.push(e[0]+`;`);for(let n in t){let o=t[n];if(/&/.test(n))i(n.split(/,\s*/).map(t=>e.map(e=>t.replace(/&/,e))).reduce((e,t)=>e.concat(t)),o,a);else if(o&&typeof o==`object`){if(!c)throw RangeError(`The value of a property (`+n+`) should be a primitive value.`);i(r(n),o,s,l)}else o!=null&&s.push(n.replace(/_.*/,``).replace(/[A-Z]/g,e=>`-`+e.toLowerCase())+`: `+o+`;`)}(s.length||l)&&a.push((n&&!c&&!o?e.map(n):e).join(`, `)+` {`+s.join(` `)+`}`)}for(let t in e)i(r(t),e[t],this.rules)}getRules(){return this.rules.join(` +`)}static newName(){let e=Fm[Nm]||1;return Fm[Nm]=e+1,Mm+e.toString(36)}static mount(e,t,n){let r=e[Pm],i=n&&n.nonce;r?i&&r.setNonce(i):r=new Rm(e,i),r.mount(Array.isArray(t)?t:[t],e)}},Lm=new Map,Rm=class{constructor(e,t){let n=e.ownerDocument||e,r=n.defaultView;if(!e.head&&e.adoptedStyleSheets&&r.CSSStyleSheet){let t=Lm.get(n);if(t)return e[Pm]=t;this.sheet=new r.CSSStyleSheet,Lm.set(n,this)}else this.styleTag=n.createElement(`style`),t&&this.styleTag.setAttribute(`nonce`,t);this.modules=[],e[Pm]=this}mount(e,t){let n=this.sheet,r=0,i=0,a=!1;for(let t=0;t-1&&(this.modules.splice(s,1),a=!0,i--,s=-1),s==-1){if(this.modules.splice(i++,0,o),a=!0,n)for(let e=0;e`,191:`?`,192:`~`,219:`{`,220:`|`,221:`}`,222:`"`},Vm=typeof navigator<`u`&&/Mac/.test(navigator.platform),Hm=typeof navigator<`u`&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Um=0;Um<10;Um++)zm[48+Um]=zm[96+Um]=String(Um);for(var Um=1;Um<=24;Um++)zm[Um+111]=`F`+Um;for(var Um=65;Um<=90;Um++)zm[Um]=String.fromCharCode(Um+32),Bm[Um]=String.fromCharCode(Um);for(var Wm in zm)Bm.hasOwnProperty(Wm)||(Bm[Wm]=zm[Wm]);function Gm(e){var t=!(Vm&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||Hm&&e.shiftKey&&e.key&&e.key.length==1||e.key==`Unidentified`)&&e.key||(e.shiftKey?Bm:zm)[e.keyCode]||e.key||`Unidentified`;return t==`Esc`&&(t=`Escape`),t==`Del`&&(t=`Delete`),t==`Left`&&(t=`ArrowLeft`),t==`Up`&&(t=`ArrowUp`),t==`Right`&&(t=`ArrowRight`),t==`Down`&&(t=`ArrowDown`),t}function Km(){var e=arguments[0];typeof e==`string`&&(e=document.createElement(e));var t=1,n=arguments[1];if(n&&typeof n==`object`&&n.nodeType==null&&!Array.isArray(n)){for(var r in n)if(Object.prototype.hasOwnProperty.call(n,r)){var i=n[r];typeof i==`string`?e.setAttribute(r,i):i!=null&&(e[r]=i)}t++}for(;t2),Z={mac:ih||/Mac/.test(Jm.platform),windows:/Win/.test(Jm.platform),linux:/Linux|X11/.test(Jm.platform),ie:$m,ie_version:Zm?Ym.documentMode||6:Qm?+Qm[1]:Xm?+Xm[1]:0,gecko:eh,gecko_version:eh?+(/Firefox\/(\d+)/.exec(Jm.userAgent)||[0,0])[1]:0,chrome:!!th,chrome_version:th?+th[1]:0,ios:ih,android:/Android\b/.test(Jm.userAgent),webkit:nh,webkit_version:nh?+(/\bAppleWebKit\/(\d+)/.exec(Jm.userAgent)||[0,0])[1]:0,safari:rh,safari_version:rh?+(/\bVersion\/(\d+(\.\d+)?)/.exec(Jm.userAgent)||[0,0])[1]:0,tabSize:Ym.documentElement.style.tabSize==null?`-moz-tab-size`:`tab-size`};function ah(e,t){for(let n in e)n==`class`&&t.class?t.class+=` `+e.class:n==`style`&&t.style?t.style+=`;`+e.style:t[n]=e[n];return t}var oh=Object.create(null);function sh(e,t,n){if(e==t)return!0;e||=oh,t||=oh;let r=Object.keys(e),i=Object.keys(t);if(r.length-0!=i.length-0)return!1;for(let a of r)if(a!=n&&(i.indexOf(a)==-1||e[a]!==t[a]))return!1;return!0}function ch(e,t){for(let n=e.attributes.length-1;n>=0;n--){let r=e.attributes[n].name;t[r]??e.removeAttribute(r)}for(let n in t){let r=t[n];n==`style`?e.style.cssText=r:e.getAttribute(n)!=r&&e.setAttribute(n,r)}}function lh(e,t,n){let r=!1;if(t)for(let i in t)n&&i in n||(r=!0,i==`style`?e.style.cssText=``:e.removeAttribute(i));if(n)for(let i in n)t&&t[i]==n[i]||(r=!0,i==`style`?e.style.cssText=n[i]:e.setAttribute(i,n[i]));return r}function uh(e){let t=Object.create(null);for(let n=0;n0?3e8:-4e8:t>0?1e8:-1e8,new gh(e,t,t,n,e.widget||null,!1)}static replace(e){let t=!!e.block,n,r;if(e.isBlockGap)n=-5e8,r=4e8;else{let{start:i,end:a}=_h(e,t);n=(i?t?-3e8:-1:5e8)-1,r=(a?t?2e8:1:-6e8)+1}return new gh(e,n,r,t,e.widget||null,!0)}static line(e){return new hh(e)}static set(e,t=!1){return gm.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}};ph.none=gm.empty;var mh=class e extends ph{constructor(e){let{start:t,end:n}=_h(e);super(t?-1:5e8,n?1:-6e8,null,e),this.tagName=e.tagName||`span`,this.attrs=e.class&&e.attributes?ah(e.attributes,{class:e.class}):e.class?{class:e.class}:e.attributes||oh}eq(t){return this==t||t instanceof e&&this.tagName==t.tagName&&sh(this.attrs,t.attrs)}range(e,t=e){if(e>=t)throw RangeError(`Mark decorations may not be empty`);return super.range(e,t)}};mh.prototype.point=!1;var hh=class e extends ph{constructor(e){super(-2e8,-2e8,null,e)}eq(t){return t instanceof e&&this.spec.class==t.spec.class&&sh(this.spec.attributes,t.spec.attributes)}range(e,t=e){if(t!=e)throw RangeError(`Line decoration ranges must be zero-length`);return super.range(e,t)}};hh.prototype.mapMode=lp.TrackBefore,hh.prototype.point=!0;var gh=class e extends ph{constructor(e,t,n,r,i,a){super(t,n,i,e),this.block=r,this.isReplace=a,this.mapMode=r?t<=0?lp.TrackBefore:lp.TrackAfter:lp.TrackDel}get type(){return this.startSide==this.endSide?this.startSide<=0?fh.WidgetBefore:fh.WidgetAfter:fh.WidgetRange}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(t){return t instanceof e&&vh(this.widget,t.widget)&&this.block==t.block&&this.startSide==t.startSide&&this.endSide==t.endSide}range(e,t=e){if(this.isReplace&&(e>t||e==t&&this.startSide>0&&this.endSide<=0))throw RangeError(`Invalid range for replacement decoration`);if(!this.isReplace&&t!=e)throw RangeError(`Widget decorations can only have zero-length ranges`);return super.range(e,t)}};gh.prototype.point=!0;function _h(e,t=!1){let{inclusiveStart:n,inclusiveEnd:r}=e;return n??=e.inclusive,r??=e.inclusive,{start:n??t,end:r??t}}function vh(e,t){return e==t||!!(e&&t&&e.compare(t))}function yh(e,t,n,r=0){let i=n.length-1;i>=0&&n[i]+r>=e?n[i]=Math.max(n[i],t):n.push(e,t)}var bh=class e extends dm{constructor(e,t,n){super(),this.tagName=e,this.attributes=t,this.rank=n}eq(t){return t==this||t instanceof e&&this.tagName==t.tagName&&sh(this.attributes,t.attributes)}static create(t){return new e(t.tagName,t.attributes||oh,t.rank==null?50:Math.max(0,Math.min(t.rank,100)))}static set(e,t=!1){return gm.of(e,t)}};bh.prototype.startSide=bh.prototype.endSide=-1;var xh=e=>e.nodeType==1,Sh=e=>e.nodeType==3;function Ch(e){let t;return t=e.nodeType==11?e.getSelection?e:e.ownerDocument:e,t.getSelection()}function wh(e,t){return t?e==t||e.contains(t.nodeType==1?t:t.parentNode):!1}function Th(e,t){if(!t.anchorNode)return!1;try{return wh(e,t.anchorNode)}catch{return!1}}function Eh(e){return Sh(e)?Uh(e,0,e.nodeValue.length).getClientRects():xh(e)?e.getClientRects():[]}function Dh(e,t,n,r){return n?Ah(e,t,n,r,-1)||Ah(e,t,n,r,1):!1}function Oh(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t}function kh(e){return xh(e)&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(e.nodeName)}function Ah(e,t,n,r,i){for(;;){if(e==n&&t==r)return!0;if(t==(i<0?0:jh(e))){if(e.nodeName==`DIV`)return!1;let n=e.parentNode;if(!n||!xh(n))return!1;t=Oh(e)+(i<0?0:1),e=n}else if(xh(e)){if(e=e.childNodes[t+(i<0?-1:0)],xh(e)&&(e.nodeName==`IMG`||e.nodeName==`BR`||e.contentEditable==`false`))return!1;t=i<0?jh(e):0}else return!1}}function jh(e){return Sh(e)?e.nodeValue.length:e.childNodes.length}function Mh(e,t){let{left:n,right:r}=e;if(n==r)return e;let i=t?n:r;return{left:i,right:i,top:e.top,bottom:e.bottom}}function Nh(e){let t=e.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.innerWidth,top:0,bottom:e.innerHeight}}function Ph(e,t){let n=t.width/e.offsetWidth,r=t.height/e.offsetHeight;return(n>.995&&n<1.005||!isFinite(n)||Math.abs(t.width-e.offsetWidth)<1)&&(n=1),(r>.995&&r<1.005||!isFinite(r)||Math.abs(t.height-e.offsetHeight)<1)&&(r=1),{scaleX:n,scaleY:r}}function Fh(e,t,n,r,i,a,o,s){let c=e.ownerDocument,l=c.defaultView||window;for(let u=e,d=!1;u&&!d;)if(xh(u)){let e,f=u==c.body,p=1,m=1,h=!0,g=!0;if(f)e=Nh(l);else{let t=getComputedStyle(u);if(/^(fixed|sticky)$/.test(t.position)&&(d=!0),(u.scrollHeight<=u.clientHeight||!/auto|scroll/.test(t.overflowY))&&(g=!1),(u.scrollWidth<=u.clientWidth||!/auto|scroll/.test(t.overflowX))&&(h=!1),!h&&!g){u=u.assignedSlot||u.parentNode;continue}let n=u.getBoundingClientRect();({scaleX:p,scaleY:m}=Ph(u,n)),e={left:n.left,right:n.left+u.clientWidth*p,top:n.top,bottom:n.top+u.clientHeight*m}}let _=0,v=0;if(g){if(i==`nearest`)t.top0&&t.bottom>e.bottom+v&&(v=t.bottom-e.bottom+o)):t.bottom>e.bottom-o&&(v=t.bottom-e.bottom+o,n<0&&t.top-v0&&t.right>e.right+_&&(_=t.right-e.right+a)):t.right>e.right-a&&(_=t.right-e.right+a,n<0&&t.lefte.bottom||t.lefte.right)&&(t={left:Math.max(t.left,e.left),right:Math.min(t.right,e.right),top:Math.max(t.top,e.top),bottom:Math.min(t.bottom,e.bottom)}),u=u.assignedSlot||u.parentNode}else if(u.nodeType==11)u=u.host;else break}function Ih(e,t=!0){let n=e.ownerDocument,r=null,i=null;for(let a=e.parentNode;a&&!(a==n.body||(!t||r)&&i);)if(xh(a))!i&&a.scrollHeight>a.clientHeight&&/scroll|auto/.test(getComputedStyle(a).overflowY)&&(i=a),t&&!r&&a.scrollWidth>a.clientWidth&&/scroll|auto/.test(getComputedStyle(a).overflowX)&&(r=a),a=a.assignedSlot||a.parentNode;else if(a.nodeType==11)a=a.host;else break;return{x:r,y:i}}var Lh=class{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:t,focusNode:n}=e;this.set(t,Math.min(e.anchorOffset,t?jh(t):0),n,Math.min(e.focusOffset,n?jh(n):0))}set(e,t,n,r){this.anchorNode=e,this.anchorOffset=t,this.focusNode=n,this.focusOffset=r}};function Rh(e){let t=[];for(let n=e;n;n=n.nodeType==11?n.host:n.parentNode)xh(n)&&t.push({node:n,left:n.scrollLeft,top:n.scrollTop});return t}function zh(e,t=!0){for(let{node:n,left:r,top:i}of e)t&&n.scrollTop!=i&&(n.scrollTop=i),n.scrollLeft!=r&&(n.scrollLeft=r)}var Bh=null;Z.safari&&Z.safari_version>=26&&(Bh=!1);function Vh(e){if(e.setActive)return e.setActive();if(Bh)return e.focus(Bh);let t=Rh(e);e.focus(Bh==null?{get preventScroll(){return Bh={preventScroll:!0},!0}}:void 0),Bh||(Bh=!1,zh(t))}var Hh;function Uh(e,t,n=t){let r=Hh||=document.createRange();return r.setEnd(e,n),r.setStart(e,t),r}function Wh(e,t,n,r){let i={key:t,code:t,keyCode:n,which:n,cancelable:!0};r&&({altKey:i.altKey,ctrlKey:i.ctrlKey,shiftKey:i.shiftKey,metaKey:i.metaKey}=r);let a=new KeyboardEvent(`keydown`,i);a.synthetic=!0,e.dispatchEvent(a);let o=new KeyboardEvent(`keyup`,i);return o.synthetic=!0,e.dispatchEvent(o),a.defaultPrevented||o.defaultPrevented}function Gh(e){for(;e;){if(e&&(e.nodeType==9||e.nodeType==11&&e.host))return e;e=e.assignedSlot||e.parentNode}return null}function Kh(e,t){let n=t.focusNode,r=t.focusOffset;if(!n||t.anchorNode!=n||t.anchorOffset!=r)return!1;for(r=Math.min(r,jh(n));;)if(r){if(!xh(n))return!1;let e=n.childNodes[r-1];e.contentEditable==`false`?r--:(n=e,r=jh(n))}else if(n==e)return!0;else r=Oh(n),n=n.parentNode}function qh(e){return e instanceof Window?e.pageYOffset>Math.max(0,e.document.documentElement.scrollHeight-e.innerHeight-4):e.scrollTop>Math.max(1,e.scrollHeight-e.clientHeight-4)}function Jh(e,t){for(let n=e,r=t;;)if(Sh(n)&&r>0)return{node:n,offset:r};else if(xh(n)&&r>0){if(n.contentEditable==`false`)return null;n=n.childNodes[r-1],r=jh(n)}else if(n.parentNode&&!kh(n))r=Oh(n),n=n.parentNode;else return null}function Yh(e,t){for(let n=e,r=t;;)if(Sh(n)&&r=t){if(o.level==n)return a;(i<0||(r==0?e[i].level>o.level:r<0?o.fromt))&&(i=a)}}if(i<0)throw RangeError(`Index out of range`);return i}};function cg(e,t){if(e.length!=t.length)return!1;for(let n=0;n=0;e-=3)if(ig[e+1]==-r){let n=ig[e+2],r=n&2?i:n&4?n&1?a:i:0;r&&(lg[t]=lg[ig[e]]=r),s=e;break}}else if(ig.length==189)break;else ig[s++]=t,ig[s++]=n,ig[s++]=c}else if((o=lg[t])==2||o==1){let e=o==i;c=+!e;for(let t=s-3;t>=0;t-=3){let n=ig[t+2];if(n&2)break;if(e)ig[t+2]|=2;else{if(n&4)break;ig[t+2]|=4}}}}}function fg(e,t,n,r){for(let i=0,a=r;i<=n.length;i++){let o=i?n[i-1].to:e,s=ic;)t==a&&(t=n[--r].from,a=r?n[r-1].to:e),lg[--t]=u;c=o}else a=o,c++}}}function pg(e,t,n,r,i,a,o){let s=r%2?2:1;if(r%2==i%2)for(let c=t,l=0;cc&&o.push(new sg(c,m.from,f)),mg(e,m.direction==Qh==!(f%2)?r:r+1,i,m.inner,m.from,m.to,o),c=m.to),p=m.to}else if(p==n||(t?lg[p]!=s:lg[p]==s))break;else p++;d?pg(e,c,p,r+1,i,d,o):ct;){let n=!0,u=!1;if(!l||c>a[l-1].to){let e=lg[c-1];e!=s&&(n=!1,u=e==16)}let d=!n&&s==1?[]:null,f=n?r:r+1,p=c;run:for(;;)if(l&&p==a[l-1].to){if(u)break run;let m=a[--l];if(!n)for(let e=m.from,n=l;;){if(e==t)break run;if(n&&a[n-1].to==e)e=a[--n].from;else if(lg[e-1]==s)break run;else break}d?d.push(m):(m.tolg.length;)lg[lg.length]=256;let r=[],i=t==Qh?0:1;return mg(e,i,i,n,0,e.length,r),r}function gg(e){return[new sg(0,e,0)]}var _g=``;function vg(e,t,n,r,i){if(!e.length)return null;let a=r.head-e.from,o;if(r.head==e.from&&r.assoc<0){if(!i)return null;a=t[o=0].side(!1,n)}else if(r.head==e.to&&r.assoc>0){if(i)return null;a=t[o=t.length-1].side(!0,n)}else o=sg.find(t,a,r.bidiLevel??-1,r.assoc);let s=t[o],c=s.side(i,n);if(a==c){let e=o+=i?1:-1;if(e<0||e>=t.length)return null;s=t[o=e],a=s.side(!i,n),c=s.side(i,n)}let l=rp(e.text,a,s.forward(i,n));(ls.to)&&(l=c),_g=e.text.slice(Math.min(a,l),Math.max(a,l));let u=o==(i?t.length-1:0)?null:t[o+(i?1:-1)];if(l==c){if(!u)return i?Y.cursor(e.to,1):Y.cursor(e.from,-1);if(u.level+ +!ie.some(e=>e)}),Ag=X.define({combine:e=>e.some(e=>e)}),jg=X.define(),Mg=class e{constructor(e,t,n,r,i,a=!1){this.range=e,this.y=t,this.x=n,this.yMargin=r,this.xMargin=i,this.isSnapshot=a}map(t){return t.empty?this:new e(this.range.map(t),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(t){return this.range.to<=t.doc.length?this:new e(Y.cursor(t.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}},Ng=Jp.define({map:(e,t)=>e.map(t)}),Pg=Jp.define();function Fg(e,t,n){let r=e.facet(Cg);r.length?r[0](t):window.onerror&&window.onerror(String(t),n,void 0,void 0,t)||(n?console.error(n+`:`,t):console.error(t))}var Ig=X.define({combine:e=>!e.length||e[0]}),Lg=0,Rg=X.define({combine(e){return e.filter((t,n)=>{for(let r=0;r{let t=[];return o&&t.push(Ug.of(t=>{let n=t.plugin(e);return n?o(n):ph.none})),a&&t.push(a(e)),t})}static fromClass(t,n){return e.define((e,n)=>new t(e,n),n)}},Bg=class{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(e){if(!this.value){if(this.spec)try{this.value=this.spec.plugin.create(e,this.spec.arg)}catch(t){Fg(e.state,t,`CodeMirror plugin crashed`),this.deactivate()}}else if(this.mustUpdate){let e=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(e)}catch(t){if(Fg(e.state,t,`CodeMirror plugin crashed`),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}return this}destroy(e){if(this.value?.destroy)try{this.value.destroy()}catch(t){Fg(e.state,t,`CodeMirror plugin crashed`)}}deactivate(){this.spec=this.value=null}},Vg=X.define(),Hg=X.define(),Ug=X.define(),Wg=X.define(),Gg=X.define(),Kg=X.define(),qg=X.define();function Jg(e,t){let n=e.state.facet(qg);if(!n.length)return n;let r=n.map(t=>t instanceof Function?t(e):t),i=[];return gm.spans(r,t.from,t.to,{point(){},span(e,n,r,a){let o=e-t.from,s=n-t.from,c=i;for(let e=r.length-1;e>=0;e--,a--){let t=r[e].spec.bidiIsolate,n;if(a>0&&c.length&&(n=c[c.length-1]).to==o&&n.direction==t)n.to=s,c=n.inner;else{let e={from:o,to:s,direction:t,inner:[]};c.push(e),c=e.inner}}}}),Yg(t.text,i)}function Yg(e,t){for(let n of t){if(n.direction==null){for(let t=n.from,r=0;t0;t--){let r=e[t-1];if(!(r.fromA>n.toA)){if(r.toAr.push(new $g(e,t,n,i))),this.changedRanges=r}static create(t,n,r){return new e(t,n,r)}get viewportChanged(){return(this.flags&4)>0}get viewportMoved(){return(this.flags&8)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&18)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return this.flags==0&&this.transactions.length==0}},t_=[],n_=class{constructor(e,t,n=0){this.dom=e,this.length=t,this.flags=n,this.parent=null,e.cmTile=this}get breakAfter(){return this.flags&1}get children(){return t_}isWidget(){return!1}get isHidden(){return!1}isComposite(){return!1}isLine(){return!1}isText(){return!1}isBlock(){return!1}get domAttrs(){return null}sync(e){if(this.flags|=2,this.flags&4){this.flags&=-5;let e=this.domAttrs;e&&ch(this.dom,e)}}toString(){return this.constructor.name+(this.children.length?`(${this.children})`:``)+(this.breakAfter?`#`:``)}destroy(){this.parent=null}setDOM(e){this.dom=e,e.cmTile=this}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e,t=this.posAtStart){let n=t;for(let t of this.children){if(t==e)return n;n+=t.length+t.breakAfter}throw RangeError(`Invalid child in posBefore`)}posAfter(e){return this.posBefore(e)+e.length}covers(e){return!0}coordsIn(e,t,n){return null}domPosFor(e,t){let n=Oh(this.dom),r=this.length?e>0:t>0;return new Xh(this.parent.dom,n+ +!!r,e==0||e==this.length)}markDirty(e){this.flags&=-3,e&&(this.flags|=4),this.parent&&this.parent.flags&2&&this.parent.markDirty(!1)}get overrideDOMText(){return null}get root(){for(let e=this;e;e=e.parent)if(e instanceof a_)return e;return null}static get(e){return e.cmTile}},r_=class extends n_{constructor(e){super(e,0),this._children=[]}isComposite(){return!0}get children(){return this._children}get lastChild(){return this.children.length?this.children[this.children.length-1]:null}append(e){this.children.push(e),e.parent=this}sync(e){if(this.flags&2)return;super.sync(e);let t=this.dom,n=null,r,i=e?.node==t?e:null,a=0;for(let o of this.children){if(o.sync(e),a+=o.length+o.breakAfter,r=n?n.nextSibling:t.firstChild,i&&r!=o.dom&&(i.written=!0),o.dom.parentNode==t)for(;r&&r!=o.dom;)r=i_(r);else t.insertBefore(o.dom,r);n=o.dom}for(r=n?n.nextSibling:t.firstChild,i&&r&&(i.written=!0);r;)r=i_(r);this.length=a}};function i_(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}var a_=class extends r_{constructor(e,t){super(t),this.view=e}owns(e){for(;e;e=e.parent)if(e==this)return!0;return!1}isBlock(){return!0}nearest(e){for(;;){if(!e)return null;let t=n_.get(e);if(t&&this.owns(t))return t;e=e.parentNode}}blockTiles(e){for(let t=[],n=this,r=0,i=0;;)if(r==n.children.length){if(!t.length)return;n=n.parent,n.breakAfter&&i++,r=t.pop()}else{let a=n.children[r++];if(a instanceof o_)t.push(r),n=a,r=0;else{let t=i+a.length,n=e(a,i);if(n!==void 0)return n;i=t+a.breakAfter}}}resolveBlock(e,t){let n,r=-1,i,a=-1;if(this.blockTiles((o,s)=>{let c=s+o.length;if(e>=s&&e<=c){if(o.isWidget()&&t>=-1&&t<=1){if(o.flags&32)return!0;o.flags&16&&(n=void 0)}(se||e==s&&(t>1?o.length:o.covers(-1)))&&(!i||!o.isWidget()&&i.isWidget())&&(i=o,a=e-s)}}),!n&&!i)throw Error(`No tile at position `+e);return n&&t<0||!i?{tile:n,offset:r}:{tile:i,offset:a}}},o_=class e extends r_{constructor(e,t){super(e),this.wrapper=t}isBlock(){return!0}covers(e){return this.children.length?e<0?this.children[0].covers(-1):this.lastChild.covers(1):!1}get domAttrs(){return this.wrapper.attributes}static of(t,n){let r=new e(n||document.createElement(t.tagName),t);return n||(r.flags|=4),r}},s_=class e extends r_{constructor(e,t){super(e),this.attrs=t}isLine(){return!0}static start(t,n,r){let i=new e(n||document.createElement(`div`),t);return n&&r||(i.flags|=4),i}get domAttrs(){return this.attrs}resolveInline(e,t,n=!1){let r=null,i=-1,a=null,o=-1;function s(e,c){for(let l=0,u=0;l=c&&(d.isComposite()?s(d,c-u):(!a||n&&a.isHidden&&(t>0&&!(a.flags&32)||n&&l_(a,d)))&&(f>c||d.flags&32&&t<=1)?(a=d,o=c-u):(u=-1)&&(r=d,i=c-u)),u=f}}s(this,e);let c=(t<0?r:a)||r||a;return c?{tile:c,offset:c==r?i:o}:null}coordsIn(e,t,n){let r=this.resolveInline(e,t,!0);return r?r.tile.coordsIn(Math.max(0,r.offset),t,n):c_(this)}domIn(e,t){let n=this.resolveInline(e,t);if(n){let{tile:e,offset:r}=n;if(this.dom.contains(e.dom))return e.isText()?new Xh(e.dom,Math.min(e.dom.nodeValue.length,r)):e.domPosFor(r,e.flags&16?1:e.flags&32?-1:t);let i=n.tile.parent,a=!1;for(let e of i.children){if(a)return new Xh(e.dom,0);e==n.tile&&(a=!0)}}return new Xh(this.dom,0)}};function c_(e){let t=e.dom.lastChild;if(!t)return e.dom.getBoundingClientRect();let n=Eh(t);return n[n.length-1]||null}function l_(e,t){let n=e.coordsIn(0,1),r=t.coordsIn(0,1);return n&&r&&r.topr&&(e=r);let i=e,a=e,o=0;e==0&&t<0||e==r&&t>=0?Z.chrome||Z.gecko||(e?(i--,o=1):a=0)?0:s.length-1];return Z.safari&&!o&&c.width==0&&(c=Array.prototype.find.call(s,e=>e.width)||c),n==null?c:Mh(c,(o?o>0:t<0)==n)}static of(t,n){let r=new e(n||document.createTextNode(t),t);return n||(r.flags|=2),r}},f_=class e extends n_{constructor(e,t,n,r){super(e,t,r),this.widget=n}isWidget(){return!0}get isHidden(){return this.widget.isHidden}covers(e){return this.flags&48?!1:(this.flags&(e<0?64:128))>0}coordsIn(e,t){return this.coordsInWidget(e,t,!1)}coordsInWidget(e,t,n){let r=this.widget.coordsAt(this.dom,e,t);if(r)return r;if(n)return Mh(this.dom.getBoundingClientRect(),this.length?e==0:t<=0);{let t=this.dom.getClientRects(),n=null;if(!t.length)return null;let r=this.flags&16?!0:this.flags&32?!1:e>0;for(let i=r?t.length-1:0;n=t[i],!(e>0?i==0:i==t.length-1||n.top0==n)}},m_=class{constructor(e){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=e}advance(e,t,n){let{tile:r,index:i,beforeBreak:a,parents:o}=this;for(;e||t>0;)if(!r.isComposite()){let t=r.length;if(i0?s.length<=e:s.length=0;e--){let n=t.marks[e],i=r.lastChild;if(i instanceof u_&&i.mark.eq(n.mark))i.dom!=n.dom&&i.setDOM(E_(n.dom)),r=i;else{let{dom:e}=n;this.cache.reused.get(n)&&n_.get(n.dom)&&(e=E_(n.dom));let t=u_.of(n.mark,e);r.append(t),r=t}this.cache.reused.set(n,2)}let i=n_.get(e.text);i&&this.cache.reused.set(i,2);let a=new d_(e.text,e.text.nodeValue);a.flags|=8,this.pos=e.range.toB,r.append(a)}addInlineWidget(e,t,n){let r=this.afterWidget&&e.flags&48&&(this.afterWidget.flags&48)==(e.flags&48);r||this.flushBuffer();let i=this.ensureMarks(t,n);!r&&!(e.flags&16)&&i.append(this.getBuffer(1)),i.append(e),this.pos+=e.length,this.afterWidget=e}addMark(e,t,n){this.flushBuffer(),this.ensureMarks(t,n).append(e),this.pos+=e.length,this.afterWidget=null}addBlockWidget(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}continueWidget(e){let t=this.afterWidget||this.lastBlock;t.length+=e,this.pos+=e}addLineStart(e,t){e||=C_;let n=s_.start(e,t||this.cache.find(s_)?.dom,!!t);this.getBlockPos().append(this.lastBlock=this.curLine=n)}addLine(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}addBreak(){this.lastBlock.flags|=1,this.endLine(),this.pos++}addLineStartIfNotCovered(e){this.blockPosCovered()||this.addLineStart(e)}ensureLine(e){this.curLine||this.addLineStart(e)}ensureMarks(e,t){let n=this.curLine;for(let r=e.length-1;r>=0;r--){let i=e[r],a;if(t>0&&(a=n.lastChild)&&a instanceof u_&&a.mark.eq(i))n=a,t--;else{let e=u_.of(i,this.cache.find(u_,e=>e.mark.eq(i))?.dom);n.append(e),n=e,t=0}}return n}endLine(){if(this.curLine){this.flushBuffer();let e=this.curLine.lastChild;(!e||!x_(this.curLine,!1)||e.dom.nodeName!=`BR`&&e.isWidget()&&!(Z.ios&&x_(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(O_,0,32)||new f_(O_.toDOM(),0,O_,32)),this.curLine=this.afterWidget=null}}updateBlockWrappers(){this.wrapperPos>this.pos+1e4&&(this.blockWrappers.goto(this.pos),this.wrappers.length=0);for(let e=this.wrappers.length-1;e>=0;e--)this.wrappers[e].to=this.pos){let t=e.rank*102+e.value.rank,n=new h_(e.from,e.to,e.value,t),r=this.wrappers.length;for(;r>0&&(this.wrappers[r-1].rank-n.rank||this.wrappers[r-1].to-n.to)<0;)r--;this.wrappers.splice(r,0,n)}this.wrapperPos=this.pos}getBlockPos(){this.updateBlockWrappers();let e=this.root;for(let t of this.wrappers){let n=e.lastChild;if(t.frome.wrapper.eq(t.wrapper))?.dom);e.append(n),e=n}}return e}blockPosCovered(){let e=this.lastBlock;return e!=null&&!e.breakAfter&&(!e.isWidget()||(e.flags&160)>0)}getBuffer(e){let t=2|(e<0?16:32),n=this.cache.find(p_,void 0,1);return n&&(n.flags=t),n||new p_(t)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}},__=class{constructor(e){this.skipCount=0,this.text=``,this.textOff=0,this.cursor=e.iter()}skip(e){this.textOff+e<=this.text.length?this.textOff+=e:(this.skipCount+=e-(this.text.length-this.textOff),this.text=``,this.textOff=0)}next(e){if(this.textOff==this.text.length){let{value:t,lineBreak:n,done:r}=this.cursor.next(this.skipCount);if(this.skipCount=0,r)throw Error(`Ran out of text content when drawing inline views`);this.text=t;let i=this.textOff=Math.min(e,t.length);return n?null:t.slice(0,i)}let t=Math.min(this.text.length,this.textOff+e),n=this.text.slice(this.textOff,t);return this.textOff=t,n}},v_=[f_,s_,d_,u_,p_,o_,a_];for(let e=0;e[]),this.index=v_.map(()=>0),this.reused=new Map}add(e){let t=e.constructor.bucket,n=this.buckets[t];n.length<6?n.push(e):n[this.index[t]=(this.index[t]+1)%6]=e}find(e,t,n=2){let r=e.bucket,i=this.buckets[r],a=this.index[r];for(let e=0;e{if(this.cache.add(e),e.isComposite())return!1},enter:e=>this.cache.add(e),leave:()=>{},break:()=>{}}}run(e,t){let n=t&&this.getCompositionContext(t.text);for(let r=0,i=0,a=0;;){let o=ar){let e=s-r;this.preserve(e,!a,!o),r=s,i+=e}if(!o)break;t&&o.fromA<=t.range.fromA&&o.toA>=t.range.toA?(this.forward(o.fromA,t.range.fromA,t.range.fromA{if(e.isWidget()){if(this.openWidget)this.builder.continueWidget(n-t);else{let a=n>0||t{e.isLine()?this.builder.addLineStart(e.attrs,this.cache.maybeReuse(e)):(this.cache.add(e),e instanceof u_&&r.unshift(e.mark)),this.openWidget=!1},leave:e=>{e.isLine()?r.length&&=i=0:e instanceof u_&&(r.shift(),i=Math.min(i,r.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(e)}emit(e,t){let n=null,r=this.builder,i=-1,a=gm.spans(this.decorations,e,t,{point:(e,t,a,o,s,c)=>{if(a instanceof gh){if(this.disallowBlockEffectsFor[c]){if(a.block)throw RangeError(`Block decorations may not be specified via plugins`);if(t>this.view.state.doc.lineAt(e).to)throw RangeError(`Decorations that replace line breaks may not be specified via plugins`)}if(i=o.length,s>o.length)r.continueWidget(t-e);else{let i=a.widget||(a.block?D_.block:D_.inline),c=S_(a),l=this.cache.findWidget(i,t-e,c)||f_.of(i,this.view,t-e,c);a.block?(a.startSide>0&&r.addLineStartIfNotCovered(n),r.addBlockWidget(l)):(r.ensureLine(n),r.addInlineWidget(l,o,s))}n=null}else n=w_(n,a);t>e&&this.text.skip(t-e)},span:(e,t,a,o)=>{for(let i=e;i-1&&(this.openWidget=a>i),this.openWidget||r.addLineStartIfNotCovered(n),this.openMarks=a}forward(e,t,n=1){t-e<=10?this.old.advance(t-e,n,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(t-e-10,-1),this.old.advance(5,n,this.reuseWalker))}getCompositionContext(e){let t=[],n=null;for(let r=e.parentNode;;r=r.parentNode){let e=n_.get(r);if(r==this.view.contentDOM)break;e instanceof u_?t.push(e):e?.isLine()?n=e:e instanceof o_||(r.nodeName==`DIV`&&!n?n=new s_(r,C_):n||t.push(u_.of(new mh({tagName:r.nodeName.toLowerCase(),attributes:uh(r)}),r)))}return n?{line:n,marks:t}:null}};function x_(e,t){let n=e=>{for(let r of e.children)if((t?r.isText():r.length)||n(r))return!0;return!1};return n(e)}function S_(e){let t=e.isReplace?(e.startSide<0?64:0)|(e.endSide>0?128:0):e.startSide>0?32:16;return e.block&&(t|=256),t}var C_={class:`cm-line`};function w_(e,t){let n=t.spec.attributes,r=t.spec.class;return!n&&!r||(e||={class:`cm-line`},n&&ah(n,e),r&&(e.class+=` `+r)),e}function T_(e){let t=[];for(let n=e.parents.length;n>1;n--){let r=n==e.parents.length?e.tile:e.parents[n].tile;r instanceof u_&&t.push(r.mark)}return t}function E_(e){let t=n_.get(e);return t&&t.setDOM(e.cloneNode()),e}var D_=class extends dh{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}};D_.inline=new D_(`span`),D_.block=new D_(`div`);var O_=new class extends dh{toDOM(){return document.createElement(`br`)}get isHidden(){return!0}get editable(){return!0}},k_=class{constructor(e){this.view=e,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=ph.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.updateDeco(),this.tile=new a_(e,e.contentDOM),this.updateInner([new $g(0,0,0,e.state.doc.length)],null)}update(e){let t=e.changedRanges;this.minWidth>0&&t.length&&(t.every(({fromA:e,toA:t})=>tthis.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let n=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(this.domChanged?.newSel?n=this.domChanged.newSel.head:!B_(e.changes,this.hasComposition)&&!e.selectionSet&&(n=e.state.selection.main.head));let r=n>-1?N_(this.view,e.changes,n):null;if(this.domChanged=null,this.hasComposition){let{from:n,to:r}=this.hasComposition;t=new $g(n,r,e.changes.mapPos(n,-1),e.changes.mapPos(r,1)).addToSet(t.slice())}this.hasComposition=r?{from:r.range.fromB,to:r.range.toB}:null,(Z.ie||Z.chrome)&&!r&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let i=this.decorations,a=this.blockWrappers;this.updateDeco();let o=I_(i,this.decorations,e.changes);o.length&&(t=$g.extendWithRanges(t,o));let s=R_(a,this.blockWrappers,e.changes);return s.length&&(t=$g.extendWithRanges(t,s)),r&&!t.some(e=>e.fromA<=r.range.fromA&&e.toA>=r.range.toA)&&(t=r.range.addToSet(t.slice())),this.tile.flags&2&&t.length==0?!1:(this.updateInner(t,r),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t){this.view.viewState.mustMeasureContent=!0;let{observer:n}=this.view;n.ignore(()=>{if(t||e.length){let n=this.tile,r=new b_(this.view,n,this.blockWrappers,this.decorations,this.dynamicDecorationMap);t&&n_.get(t.text)&&r.cache.reused.set(n_.get(t.text),2),this.tile=r.run(e,t),A_(n,r.cache.reused)}this.tile.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+`px`,this.tile.dom.style.flexBasis=this.minWidth?this.minWidth+`px`:``;let r=Z.chrome||Z.ios?{node:n.selectionRange.focusNode,written:!1}:void 0;this.tile.sync(r),r&&(r.written||n.selectionRange.focusNode!=r.node||!this.tile.dom.contains(r.node))&&(this.forceSelection=!0),this.tile.dom.style.height=``});let r=[];if(this.view.viewport.from||this.view.viewport.to-1)&&Th(n,this.view.observer.selectionRange)&&!(r&&n.contains(r));if(!(i||t||a))return;let o=this.forceSelection;this.forceSelection=!1;let s=this.view.state.selection.main,c,l;if(s.empty?l=c=this.inlineDOMNearPos(s.anchor,s.assoc||1):(l=this.inlineDOMNearPos(s.head,s.head==s.from?1:-1),c=this.inlineDOMNearPos(s.anchor,s.anchor==s.from?1:-1)),Z.gecko&&s.empty&&!this.hasComposition&&j_(c)){let e=document.createTextNode(``);this.view.observer.ignore(()=>c.node.insertBefore(e,c.node.childNodes[c.offset]||null)),c=l=new Xh(e,0),o=!0}let u=this.view.observer.selectionRange;!o&&u.focusNode&&(Dh(c.node,c.offset,u.anchorNode,u.anchorOffset)&&Dh(l.node,l.offset,u.focusNode,u.focusOffset)||this.suppressWidgetCursorChange(u,s))||(this.view.observer.ignore(()=>{Z.android&&Z.chrome&&n.contains(u.focusNode)&&z_(u.focusNode,n)&&(n.blur(),n.focus({preventScroll:!0}));let e=Ch(this.view.root);if(e){if(s.empty){if(Z.gecko){let e=P_(c.node,c.offset);if(e&&e!=3){let t=(e==1?Jh:Yh)(c.node,c.offset);t&&(c=new Xh(t.node,t.offset))}}e.collapse(c.node,c.offset),s.bidiLevel!=null&&e.caretBidiLevel!==void 0&&(e.caretBidiLevel=s.bidiLevel)}else if(e.extend){e.collapse(c.node,c.offset);try{e.extend(l.node,l.offset)}catch{}}else{let t=document.createRange();s.anchor>s.head&&([c,l]=[l,c]),t.setEnd(l.node,l.offset),t.setStart(c.node,c.offset),e.removeAllRanges(),e.addRange(t)}}a&&this.view.root.activeElement==n&&(n.blur(),r&&r.focus())}),this.view.observer.setSelectionRange(c,l)),this.impreciseAnchor=c.precise?null:new Xh(u.anchorNode,u.anchorOffset),this.impreciseHead=l.precise?null:new Xh(u.focusNode,u.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&Dh(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==t.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,t=e.state.selection.main,n=Ch(e.root),{anchorNode:r,anchorOffset:i}=e.observer.selectionRange;if(!n||!t.empty||!t.assoc||!n.modify)return;let a=this.lineAt(t.head,t.assoc);if(!a)return;let o=a.posAtStart;if(t.head==o||t.head==o+a.length)return;let s=this.coordsAt(t.head,-1),c=this.coordsAt(t.head,1);if(!s||!c||s.bottom>c.top)return;let l=this.domAtPos(t.head+t.assoc,t.assoc);n.collapse(l.node,l.offset),n.modify(`move`,t.assoc<0?`forward`:`backward`,`lineboundary`),e.observer.readSelectionRange();let u=e.observer.selectionRange;e.docView.posFromDOM(u.anchorNode,u.anchorOffset)!=t.from&&n.collapse(r,i)}posFromDOM(e,t){let n=this.tile.nearest(e);if(!n)return this.tile.dom.compareDocumentPosition(e)&2?0:this.view.state.doc.length;let r=n.posAtStart;if(n.isComposite()){let i;if(e==n.dom)i=n.dom.childNodes[t];else{let r=jh(e)==0?0:t==0?-1:1;for(;;){let t=e.parentNode;if(t==n.dom)break;r==0&&t.firstChild!=t.lastChild&&(r=e==t.firstChild?-1:1),e=t}i=r<0?e:e.nextSibling}if(i==n.dom.firstChild)return r;for(;i&&!n_.get(i);)i=i.nextSibling;if(!i)return r+n.length;for(let e=0,t=r;;e++){let r=n.children[e];if(r.dom==i)return t;t+=r.length+r.breakAfter}}else if(n.isText())return e==n.dom?r+t:r+(t?n.length:0);else return r}domAtPos(e,t){let{tile:n,offset:r}=this.tile.resolveBlock(e,t);return n.isWidget()?n.domPosFor(r,t):n.domIn(r,t)}inlineDOMNearPos(e,t){let n,r=-1,i=!1,a,o=-1,s=!1;return this.tile.blockTiles((t,c)=>{if(t.isWidget()){if(t.flags&32&&c>=e)return!0;t.flags&16&&(i=!0)}else{let l=c+t.length;if(c<=e&&(n=t,r=e-c,i=l=e&&!a&&(a=t,o=e-c,s=c>e),c>e&&a)return!0}}),!n&&!a?this.domAtPos(e,t):(i&&a?n=null:s&&n&&(a=null),n&&t<0||!a?n.domIn(r,t):a.domIn(o,t))}coordsAt(e,t,n){let{tile:r,offset:i}=this.tile.resolveBlock(e,t);return r.isWidget()?r.widget instanceof V_?null:r.coordsInWidget(i,t,!0):r.coordsIn(i,t,n)}lineAt(e,t){let{tile:n}=this.tile.resolveBlock(e,t);return n.isLine()?n:null}coordsForChar(e){let{tile:t,offset:n}=this.tile.resolveBlock(e,1);if(!t.isLine())return null;function r(e,t){if(e.isComposite())for(let n of e.children){if(n.length>=t){let e=r(n,t);if(e)return e}if(t-=n.length,t<0)break}else if(e.isText()&&tMath.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,o=-1,s=this.view.textDirection==Zh.LTR,c=0,l=(e,u,d)=>{for(let f=0;fr);f++){let r=e.children[f],p=u+r.length,m=r.dom.getBoundingClientRect(),{height:h}=m;if(d&&!f&&(c+=m.top-d.top),r instanceof o_)p>n&&l(r,u,m);else if(u>=n&&(c>0&&t.push(-c),t.push(h+c),c=0,a)){let e=r.dom.lastChild,t=e?Eh(e):[];if(t.length){let e=t[t.length-1],n=s?e.right-m.left:m.right-e.left;n>o&&(o=n,this.minWidth=i,this.minWidthFrom=u,this.minWidthTo=p)}}d&&f==e.children.length-1&&(c+=d.bottom-m.bottom),u=p+r.breakAfter}};return l(this.tile,0,null),t}textDirectionAt(e){let{tile:t}=this.tile.resolveBlock(e,1);return getComputedStyle(t.dom).direction==`rtl`?Zh.RTL:Zh.LTR}measureTextSize(){let e=this.tile.blockTiles(e=>{if(e.isLine()&&e.children.length&&e.length<=20){let t=0,n;for(let r of e.children){if(!r.isText()||/[^ -~]/.test(r.text))return;let e=Eh(r.dom);if(e.length!=1)return;t+=e[0].width,n=e[0].height}if(t)return{lineHeight:e.dom.getBoundingClientRect().height,charWidth:t/e.length,textHeight:n}}});if(e)return e;let t=document.createElement(`div`),n,r,i;return t.className=`cm-line`,t.style.width=`99999px`,t.style.position=`absolute`,t.textContent=`abc def ghi jkl mno pqr stu`,this.view.observer.ignore(()=>{this.tile.dom.appendChild(t);let e=Eh(t.firstChild)[0];n=t.getBoundingClientRect().height,r=e&&e.width?e.width/27:7,i=e&&e.height?e.height:n,t.remove()}),{lineHeight:n,charWidth:r,textHeight:i}}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let n=0,r=0;;r++){let i=r==t.viewports.length?null:t.viewports[r],a=i?i.from-1:this.view.state.doc.length;if(a>n){let r=(t.lineBlockAt(a).bottom-t.lineBlockAt(n).top)/this.view.scaleY;e.push(ph.replace({widget:new V_(r),block:!0,inclusive:!0,isBlockGap:!0}).range(n,a))}if(!i)break;n=i.to+1}return ph.set(e)}updateDeco(){let e=1,t=this.view.state.facet(Ug).map(t=>(this.dynamicDecorationMap[e++]=typeof t==`function`)?t(this.view):t),n=!1,r=this.view.state.facet(Gg).map((e,t)=>{let r=typeof e==`function`;return r&&(n=!0),r?e(this.view):e});for(r.length&&(this.dynamicDecorationMap[e++]=n,t.push(gm.join(r))),this.decorations=[this.editContextFormatting,...t,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];etypeof e==`function`?e(this.view):e)}scrollIntoView(e){if(e.isSnapshot){let t=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=t.top-e.yMargin,this.view.scrollDOM.scrollLeft=e.xMargin;return}for(let t of this.view.state.facet(jg))try{if(t(this.view,e.range,e))return!0}catch(e){Fg(this.view.state,e,`scroll handler`)}let{range:t}=e,n=this.coordsAt(t.head,t.assoc||(t.head>t.anchor?-1:1)),r;if(!n)return;!t.empty&&(r=this.coordsAt(t.anchor,t.anchor>t.head?-1:1))&&(n={left:Math.min(n.left,r.left),top:Math.min(n.top,r.top),right:Math.max(n.right,r.right),bottom:Math.max(n.bottom,r.bottom)});let i=Zg(this.view),a={left:n.left-i.left,top:n.top-i.top,right:n.right+i.right,bottom:n.bottom+i.bottom},{offsetWidth:o,offsetHeight:s}=this.view.scrollDOM;if(Fh(this.view.scrollDOM,a,t.head1&&(n.top>window.visualViewport.offsetTop+window.visualViewport.height||n.bottome.isWidget()||e.children.some(t);return t(this.tile.resolveBlock(e,1).tile)}destroy(){A_(this.tile)}};function A_(e,t){let n=t?.get(e);if(n!=1){n??e.destroy();for(let n of e.children)A_(n,t)}}function j_(e){return xh(e.node)&&e.node.firstChild&&(e.offset==0||e.node.childNodes[e.offset-1].contentEditable==`false`)&&(e.offset==e.node.childNodes.length||e.node.childNodes[e.offset].contentEditable==`false`)}function M_(e,t){let n=e.observer.selectionRange;if(!n.focusNode)return null;let r=Jh(n.focusNode,n.focusOffset),i=Yh(n.focusNode,n.focusOffset),a=r||i;if(i&&r&&i.node!=r.node){let t=n_.get(i.node);if(!t||t.isText()&&t.text!=i.node.nodeValue)a=i;else if(e.docView.lastCompositionAfterCursor){let e=n_.get(r.node);!e||e.isText()&&e.text!=r.node.nodeValue||(a=i)}}if(e.docView.lastCompositionAfterCursor=a!=r,!a)return null;let o=t-a.offset;return{from:o,to:o+a.node.nodeValue.length,node:a.node}}function N_(e,t,n){let r=M_(e,n);if(!r)return null;let{node:i,from:a,to:o}=r,s=i.nodeValue;if(/[\n\r]/.test(s)||e.state.doc.sliceString(r.from,r.to)!=s)return null;let c=t.invertedDesc;return{range:new $g(c.mapPos(a),c.mapPos(o),a,o),text:i}}function P_(e,t){return xh(e)?(t&&e.childNodes[t-1].contentEditable==`false`?1:0)|(t{et.from&&(n=!0)}),n}var V_=class extends dh{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement(`div`);return e.className=`cm-gap`,this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+`px`,!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}};function H_(e,t,n=1){let r=e.charCategorizer(t),i=e.doc.lineAt(t),a=t-i.from;if(i.length==0)return Y.cursor(t);a==0?n=1:a==i.length&&(n=-1);let o=a,s=a;n<0?o=rp(i.text,a,!1):s=rp(i.text,a);let c=r(i.text.slice(o,s));for(;o>0;){let e=rp(i.text,o,!1);if(r(i.text.slice(e,o))!=c)break;o=e}for(;se.defaultLineHeight*1.5){let t=e.viewState.heightOracle.textHeight,r=Math.floor((i-n.top-(e.defaultLineHeight-t)*.5)/t);a+=r*e.viewState.heightOracle.lineLength}let o=e.state.sliceDoc(n.from,n.to);return n.from+jm(o,a,e.state.tabSize)}function W_(e,t,n){let r=e.lineBlockAt(t);if(Array.isArray(r.type)){let e;for(let i of r.type){if(i.from>t)break;if(!(i.tot)return i;(!e||i.type==fh.Text&&(e.type!=i.type||(n<0?i.fromt)))&&(e=i)}}return e||r}return r}function G_(e,t,n,r){let i=W_(e,t.head,t.assoc||-1),a=!r||i.type!=fh.Text||!(e.lineWrapping||i.widgetLineBreaks)?null:e.coordsAtPos(t.assoc<0&&t.head>i.from?t.head-1:t.head);if(a){let t=e.dom.getBoundingClientRect(),r=e.textDirectionAt(i.from),o=e.posAndSideAtCoords({x:n==(r==Zh.LTR)?t.right-1:t.left+1,y:(a.top+a.bottom)/2});if(o)return Y.cursor(o.pos,o.assoc)}return Y.cursor(n?i.to:i.from,n?1:-1)}function K_(e,t,n,r){let i=e.state.doc.lineAt(t.head),a=e.bidiSpans(i),o=e.textDirectionAt(i.from);for(let s=t,c=null;;){let t=vg(i,a,o,s,n),l=_g;if(!t){if(i.number==(n?e.state.doc.lines:1))return s;l=` +`,i=e.state.doc.line(i.number+(n?1:-1)),a=e.bidiSpans(i),t=n?Y.cursor(i.from,-1):Y.cursor(i.to,1)}if(!c){if(!r)return t;c=r(l)}else if(!c(l))return s;s=t}}function q_(e,t,n){let r=e.state.charCategorizer(t),i=r(n);return e=>{let t=r(e);return i==im.Space&&(i=t),i==t}}function J_(e,t,n,r){let i=t.head,a=n?1:-1;if(i==(n?e.state.doc.length:0))return Y.cursor(i,t.assoc);let o=t.goalColumn,s,c=e.contentDOM.getBoundingClientRect(),l=e.coordsAtPos(i,t.assoc||((t.empty?n:t.head==t.from)?1:-1)),u=e.documentTop;if(l)o??=l.left-c.left,s=a<0?l.top:l.bottom;else{let t=e.viewState.lineBlockAt(i);o??=Math.min(c.right-c.left,e.defaultCharacterWidth*(i-t.from)),s=(a<0?t.top:t.bottom)+u}let d=c.left+o,f=e.viewState.heightOracle.textHeight>>1,p=r??f;for(let t=0;;t+=f){let r=s+(p+t)*a,i=$_(e,{x:d,y:r},!1,a);if(n?r>c.bottom:rs:u{if(t>e&&tt(e)),n.from,t.head>n.from?-1:1);return r==n.from?n:Y.cursor(r,re.viewState.docHeight)return new Q_(e.state.doc.length,-1);if(l=e.elementAtHeight(c),r==null)break;if(l.type==fh.Text){if(r<0?l.toe.viewport.to)break;let t=e.docView.coordsAt(r<0?l.from:l.to,r>0?-1:1);if(t&&(r<0?t.top<=c+a:t.bottom>=c+a))break}let t=e.viewState.heightOracle.textHeight/2;c=r>0?l.bottom+t:l.top-t}if(e.viewport.from>=l.to||e.viewport.to<=l.from){if(n)return null;if(l.type==fh.Text){let t=U_(e,i,l,o,s);return new Q_(t,t==l.from?1:-1)}}if(l.type!=fh.Text)return c<(l.top+l.bottom)/2?new Q_(l.from,1):new Q_(l.to,-1);let u=e.docView.lineAt(l.from,2);return u&&u.length==l.length||(u=e.docView.lineAt(l.from,-2)),new ev(e,o,s,e.textDirectionAt(l.from)).scanTile(u,l.from)}var ev=class{constructor(e,t,n,r){this.view=e,this.x=t,this.y=n,this.baseDir=r,this.line=null,this.spans=null}bidiSpansAt(e){return(!this.line||this.line.from>e||this.line.to1||n.length&&(n[0].level!=this.baseDir||n[0].to+r.from>1;adjust:if(a.has(f)){for(let e=1;e=i&&(t-=n),!a.has(t)){f=t;break adjust}}break search}a.add(f);let p=t(f),m=0;if(p)for(let e=0;e1)){if(t.bottomthis.y)(!c||c.top>t.top)&&(c=t),m=-1;else{let e=t.left>this.x?this.x-t.left:t.right(n+n+r)/3)return this.y=s.bottom-1,this.scan(e,t,!0);if(c&&c.top<(n+r+r)/3)return this.y=c.top+1,this.scan(e,t,!0)}let f=(o?this.dirAt(e[l],1):this.baseDir)==Zh.LTR;return{i:l,after:this.x>(d.left+d.right)/2==f}}scanText(e,t){let n=[];for(let r=0;r{let i=n[r]-t,a=n[r+1]-t;return Uh(e.dom,i,a).getClientRects()});return r.after?new Q_(n[r.i+1],-1):new Q_(n[r.i],1)}scanTile(e,t){if(!e.length)return new Q_(t,1);if(e.children.length==1){let n=e.children[0];if(n.isText())return this.scanText(n,t);if(n.isComposite())return this.scanTile(n,t)}let n=[t];for(let r=0,i=t;r{let n=e.children[t];return n.flags&48?null:(xh(n.dom)?n.dom:Uh(n.dom,0,n.length)).getClientRects()}),i=e.children[r.i],a=n[r.i];return i.isText()?this.scanText(i,a):i.isComposite()?this.scanTile(i,a):r.after?new Q_(n[r.i+1],-1):new Q_(a,1)}},tv=`￿`,nv=class{constructor(e,t){this.points=e,this.view=t,this.text=``,this.lineSeparator=t.state.facet(lm.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=tv}readRange(e,t){if(!e)return this;let n=e.parentNode;for(let r=e;;){this.findPointBefore(n,r);let e=this.text.length;this.readNode(r);let i=n_.get(r),a=r.nextSibling;if(a==t){i?.breakAfter&&!a&&n!=this.view.contentDOM&&this.lineBreak();break}let o=n_.get(a);(i&&o?i.breakAfter:(i?i.breakAfter:kh(r))||kh(a)&&(r.nodeName!=`BR`||i?.isWidget())&&this.text.length>e)&&!iv(a,t)&&this.lineBreak(),r=a}return this.findPointBefore(n,t),this}readTextNode(e){let t=e.nodeValue;for(let n of this.points)n.node==e&&(n.pos=this.text.length+Math.min(n.offset,t.length));for(let n=0,r=this.lineSeparator?null:/\r\n?|\n/g;;){let i=-1,a=1,o;if(this.lineSeparator?(i=t.indexOf(this.lineSeparator,n),a=this.lineSeparator.length):(o=r.exec(t))&&(i=o.index,a=o[0].length),this.append(t.slice(n,i<0?t.length:i)),i<0)break;if(this.lineBreak(),a>1)for(let t of this.points)t.node==e&&t.pos>this.text.length&&(t.pos-=a-1);n=i+a}}readNode(e){let t=n_.get(e),n=t&&t.overrideDOMText;if(n!=null){this.findPointInside(e,n.length);for(let e=n.iter();!e.next().done;)e.lineBreak?this.lineBreak():this.append(e.value)}else Sh(e)?this.readTextNode(e):e.nodeName==`BR`?e.nextSibling&&this.lineBreak():xh(e)&&this.readRange(e.firstChild,null)}findPointBefore(e,t){for(let n of this.points)n.node==e&&e.childNodes[n.offset]==t&&(n.pos=this.text.length)}findPointInside(e,t){for(let n of this.points)(Sh(e)?n.node==e:e.contains(n.node))&&(n.pos=this.text.length+(rv(e,n.node,n.offset)?t:0))}};function rv(e,t,n){for(;;){if(!t||n-1;let{impreciseHead:i,impreciseAnchor:a}=e.docView,o=e.state.selection;if(e.state.readOnly&&t>-1)this.newSel=null;else if(t>-1&&(this.bounds=sv(e.docView.tile,t,n,0))){let t=i||a?[]:fv(e),n=new nv(t,e);n.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=n.text,this.newSel=pv(t,this.bounds.from)}else{let t=e.observer.selectionRange,n=i&&i.node==t.focusNode&&i.offset==t.focusOffset||!wh(e.contentDOM,t.focusNode)?o.main.head:e.docView.posFromDOM(t.focusNode,t.focusOffset),r=a&&a.node==t.anchorNode&&a.offset==t.anchorOffset||!wh(e.contentDOM,t.anchorNode)?o.main.anchor:e.docView.posFromDOM(t.anchorNode,t.anchorOffset),s=e.viewport;if((Z.ios||Z.chrome)&&n!=r&&Math.min(n,r)<=o.main.from&&Math.max(n,r)>=o.main.to&&(s.from>0||s.to-1&&o.ranges.length>1)this.newSel=o.replaceRange(Y.range(r,n));else if(e.lineWrapping&&r==n&&!(o.main.empty&&o.main.head==n)&&e.inputState.lastTouchTime>Date.now()-100){let t=e.coordsAtPos(n,-1),r=0;t&&(r=e.inputState.lastTouchY<=t.bottom?-1:1),this.newSel=Y.create([Y.cursor(n,r)])}else this.newSel=Y.single(r,n)}}};function sv(e,t,n,r){if(e.isComposite()){let i=-1,a=-1,o=-1,s=-1;for(let c=0,l=r,u=r;cn)return sv(r,t,n,l);if(d>=t&&i==-1&&(i=c,a=l),l>n&&r.dom.parentNode==e.dom){o=c,s=u;break}u=d,l=d+r.breakAfter}return{from:a,to:s<0?r+e.length:s,startDOM:(i?e.children[i-1].dom.nextSibling:null)||e.dom.firstChild,endDOM:o=0?e.children[o].dom:null}}return e.isText()?{from:r,to:r+e.length,startDOM:e.dom,endDOM:e.dom.nextSibling}:null}function cv(e,t){let n,{newSel:r}=t,{state:i}=e,a=i.selection.main,o=e.inputState.lastKeyTime>Date.now()-100?e.inputState.lastKeyCode:-1;if(t.bounds){let{from:e,to:r}=t.bounds,s=a.from,c=null;(o===8||Z.android&&t.text.length=e&&a.to<=r&&(t.typeOver||l!=t.text)&&l.slice(0,a.from-e)==t.text.slice(0,a.from-e)&&l.slice(a.to-e)==t.text.slice(u=t.text.length-(l.length-(a.to-e)))?n={from:a.from,to:a.to,insert:Kf.of(t.text.slice(a.from-e,u).split(tv))}:(d=dv(l,t.text,s-e,c))&&(Z.chrome&&o==13&&d.toB==d.from+2&&t.text.slice(d.from,d.toB)==`￿￿`&&d.toB--,n={from:e+d.from,to:e+d.toA,insert:Kf.of(t.text.slice(d.from,d.toB).split(tv))})}else r&&(!e.hasFocus&&i.facet(Ig)||mv(r,a))&&(r=null);if(!n&&!r)return!1;if((Z.mac||Z.android)&&n&&n.from==n.to&&n.from==a.head-1&&/^\. ?$/.test(n.insert.toString())&&e.contentDOM.getAttribute(`autocorrect`)==`off`?(r&&n.insert.length==2&&(r=Y.single(r.main.anchor-1,r.main.head-1)),n={from:n.from,to:n.to,insert:Kf.of([n.insert.toString().replace(`.`,` `)])}):i.doc.lineAt(a.from).toDate.now()-50?n={from:a.from,to:a.to,insert:i.toText(e.inputState.insertingText)}:Z.chrome&&n&&n.from==n.to&&n.from==a.head&&n.insert.toString()==` + `&&e.lineWrapping&&(r&&=Y.single(r.main.anchor-1,r.main.head-1),n={from:a.from,to:a.to,insert:Kf.of([` `])}),n)return lv(e,n,r,o);if(r&&!mv(r,a)){let t=!1,n=`select`;return e.inputState.lastSelectionTime>Date.now()-50&&(e.inputState.lastSelectionOrigin==`select`&&(t=!0),n=e.inputState.lastSelectionOrigin,n==`select.pointer`&&(r=X_(i.facet(Kg).map(t=>t(e)),r))),e.dispatch({selection:r,scrollIntoView:t,userEvent:n}),!0}return!1}function lv(e,t,n,r=-1){if(Z.ios&&e.inputState.flushIOSKey(t))return!0;let i=e.state.selection.main;if(Z.android&&(t.to==i.to&&(t.from==i.from||t.from==i.from-1&&e.state.sliceDoc(t.from,i.from)==` `)&&t.insert.length==1&&t.insert.lines==2&&Wh(e.contentDOM,`Enter`,13)||(t.from==i.from-1&&t.to==i.to&&t.insert.length==0||r==8&&t.insert.lengthi.head)&&Wh(e.contentDOM,`Backspace`,8)||t.from==i.from&&t.to==i.to+1&&t.insert.length==0&&Wh(e.contentDOM,`Delete`,46)))return!0;let a=t.insert.toString();e.inputState.composing>=0&&e.inputState.composing++;let o,s=()=>o||=uv(e,t,n);return e.state.facet(Tg).some(n=>n(e,t.from,t.to,a,s))||e.dispatch(s()),!0}function uv(e,t,n){let r,i=e.state,a=i.selection.main,o=-1;if(t.from==t.to&&t.froma.to){let n=t.fromt(e)),r,n);t.from==s&&(o=s)}if(o>-1)r={changes:t,selection:Y.cursor(t.from+t.insert.length,-1)};else if(t.from>=a.from&&t.to<=a.to&&t.to-t.from>=(a.to-a.from)/3&&(!n||n.main.empty&&n.main.from==t.from+t.insert.length)&&e.inputState.composing<0){let n=a.fromt.to?i.sliceDoc(t.to,a.to):``;r=i.replaceSelection(e.state.toText(n+t.insert.sliceString(0,void 0,e.state.lineBreak)+o))}else{let o=i.changes(t),s=n&&n.main.to<=o.newLength?n.main:void 0;if(i.selection.ranges.length>1&&(e.inputState.composing>=0||e.inputState.compositionPendingChange)&&t.to<=a.to+10&&t.to>=a.to-10){let c=e.state.sliceDoc(t.from,t.to),l,u=n&&M_(e,n.main.head);if(u){let e=t.insert.length-(t.to-t.from);l={from:u.from,to:u.to-e}}else l=e.state.doc.lineAt(a.head);let d=a.to-t.to;r=i.changeByRange(n=>{if(n.from==a.from&&n.to==a.to)return{changes:o,range:s||n.map(o)};let r=n.to-d,u=r-c.length;if(e.state.sliceDoc(u,r)!=c||r>=l.from&&u<=l.to)return{range:n};let f=i.changes({from:u,to:r,insert:t.insert}),p=n.to-a.to;return{changes:f,range:s?Y.range(Math.max(0,s.anchor+p),Math.max(0,s.head+p)):n.map(f)}})}else r={changes:o,selection:s&&i.selection.replaceRange(s)}}let s=`input.type`;return(e.composing||e.inputState.compositionPendingChange&&e.inputState.compositionEndedAt>Date.now()-50)&&(e.inputState.compositionPendingChange=!1,s+=`.compose`,e.inputState.compositionFirstChange&&(s+=`.start`,e.inputState.compositionFirstChange=!1)),i.update(r,{userEvent:s,scrollIntoView:!0})}function dv(e,t,n,r){let i=Math.min(e.length,t.length),a=0;for(;a0&&s>0&&e.charCodeAt(o-1)==t.charCodeAt(s-1);)o--,s--;if(r==`end`){let e=Math.max(0,a-Math.min(o,s));n-=o+e-a}if(o=o?a-n:0;a-=e,s=a+(s-o),o=a}else if(s=s?a-n:0;a-=e,o=a+(o-s),s=a}return{from:a,toA:o,toB:s}}function fv(e){let t=[];if(e.root.activeElement!=e.contentDOM)return t;let{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:a}=e.observer.selectionRange;return n&&(t.push(new av(n,r)),(i!=n||a!=r)&&t.push(new av(i,a))),t}function pv(e,t){if(e.length==0)return null;let n=e[0].pos,r=e.length==2?e[1].pos:n;return n<0||r<0?null:n==r?Y.create([Y.cursor(r+t,-1)]):Y.single(n+t,r+t)}function mv(e,t){return t.head==e.main.head&&t.anchor==e.main.anchor}var hv=class{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.touchActive=!1,this.lastTouchTime=0,this.lastTouchX=0,this.lastTouchY=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.lastWheelEvent=0,this.pendingIOSKey=void 0,this.lastIOSMomentumScroll=0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText=``,this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,Z.safari&&e.contentDOM.addEventListener(`input`,()=>null),Z.gecko&&Qv(e.contentDOM.ownerDocument)}handleEvent(e){kv(this.view,e)&&!this.ignoreDuringComposition(e)&&(e.type==`keydown`&&this.keydown(e)||(this.view.updateState==0?this.runHandlers(e.type,e):Promise.resolve().then(()=>this.runHandlers(e.type,e))))}runHandlers(e,t){let n=this.handlers[e];if(n){for(let e of n.observers)e(this.view,t);for(let e of n.handlers){if(t.defaultPrevented)break;if(e(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=vv(e),n=this.handlers,r=this.view.contentDOM;for(let e in t)if(e!=`scroll`){let i=!t[e].handlers.length,a=n[e];a&&i!=!a.handlers.length&&(r.removeEventListener(e,this.handleEvent),a=null),a||r.addEventListener(e,this.handleEvent,{passive:i})}for(let e in n)e!=`scroll`&&!t[e]&&r.removeEventListener(e,this.handleEvent);this.handlers=t}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&e.keyCode!=27&&xv.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),Z.android&&Z.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;if(Z.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&(yv.some(t=>t.keyCode==e.keyCode)&&!e.ctrlKey||bv.indexOf(e.key)>-1&&e.ctrlKey)){let t={ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey,shiftKey:e.shiftKey};t.shiftKey&&Z.ios&&!/^(off|none)$/.test(this.view.contentDOM.autocapitalize)&&gv(this.view.win)&&(t.shiftKey=!1);let n=this.pendingIOSKey={key:e.key,keyCode:e.keyCode,mods:t};return setTimeout(()=>{this.pendingIOSKey==n&&this.flushIOSKey()},50),!0}return e.keyCode!=229&&this.view.observer.forceFlush(),!1}flushIOSKey(e){let t=this.pendingIOSKey;return!t||this.view.observer.pendingRecords().length||t.key==`Enter`&&e&&e.from0?!0:Z.safari&&!Z.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}};function gv(e){return e.visualViewport?e.visualViewport.height*e.visualViewport.scale/e.document.documentElement.clientHeight<.85:!1}function _v(e,t){return(n,r)=>{try{return t.call(e,r,n)}catch(e){Fg(n.state,e)}}}function vv(e){let t=Object.create(null);function n(e){return t[e]||(t[e]={observers:[],handlers:[]})}for(let t of e){let e=t.spec,r=e&&e.plugin.domEventHandlers,i=e&&e.plugin.domEventObservers;if(r)for(let e in r){let i=r[e];i&&n(e).handlers.push(_v(t.value,i))}if(i)for(let e in i){let r=i[e];r&&n(e).observers.push(_v(t.value,r))}}for(let e in Av)n(e).handlers.push(Av[e]);for(let e in jv)n(e).observers.push(jv[e]);return t}var yv=[{key:`Backspace`,keyCode:8,inputType:`deleteContentBackward`},{key:`Enter`,keyCode:13,inputType:`insertParagraph`},{key:`Enter`,keyCode:13,inputType:`insertLineBreak`},{key:`Delete`,keyCode:46,inputType:`deleteContentForward`}],bv=`dthko`,xv=[16,17,18,20,91,92,224,225],Sv=6;function Cv(e){return Math.max(0,e)*.7+8}function wv(e,t){return Math.max(Math.abs(e.clientX-t.clientX),Math.abs(e.clientY-t.clientY))}var Tv=class{constructor(e,t,n,r){this.view=e,this.startEvent=t,this.style=n,this.mustSelect=r,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParents=Ih(e.contentDOM),this.atoms=e.state.facet(Kg).map(t=>t(e));let i=e.contentDOM.ownerDocument;i.addEventListener(`mousemove`,this.move=this.move.bind(this)),i.addEventListener(`mouseup`,this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(lm.allowMultipleSelections)&&Ev(e,t),this.dragging=Ov(e,t)&&Vv(t)==1?null:!1}start(e){this.dragging===!1&&this.select(e)}move(e){if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&wv(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let t=0,n=0,r=0,i=0,a=this.view.win.innerWidth,o=this.view.win.innerHeight;this.scrollParents.x&&({left:r,right:a}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:i,bottom:o}=this.scrollParents.y.getBoundingClientRect());let s=Zg(this.view);e.clientX-s.left<=r+Sv?t=-Cv(r-e.clientX):e.clientX+s.right>=a-Sv&&(t=Cv(e.clientX-a)),e.clientY-s.top<=i+Sv?n=-Cv(i-e.clientY):e.clientY+s.bottom>=o-Sv&&(n=Cv(e.clientY-o)),this.setScrollSpeed(t,n)}up(e){this.dragging??this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener(`mousemove`,this.move),e.removeEventListener(`mouseup`,this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,t){this.scrollSpeed={x:e,y:t},e||t?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:t}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),t&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=t,t=0),(e||t)&&this.view.win.scrollBy(e,t),this.dragging===!1&&this.select(this.lastEvent)}select(e){let{view:t}=this,n=X_(this.atoms,this.style.get(e,this.extend,this.multiple));(this.mustSelect||!n.eq(t.state.selection,this.dragging===!1))&&this.view.dispatch({selection:n,userEvent:`select.pointer`}),this.mustSelect=!1}update(e){e.transactions.some(e=>e.isUserEvent(`input.type`))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}};function Ev(e,t){let n=e.state.facet(bg);return n.length?n[0](t):Z.mac?t.metaKey:t.ctrlKey}function Dv(e,t){let n=e.state.facet(xg);return n.length?n[0](t):Z.mac?!t.altKey:!t.ctrlKey}function Ov(e,t){let{main:n}=e.state.selection;if(n.empty)return!1;let r=Ch(e.root);if(!r||r.rangeCount==0)return!0;let i=r.getRangeAt(0).getClientRects();for(let e=0;e=t.clientX&&n.top<=t.clientY&&n.bottom>=t.clientY)return!0}return!1}function kv(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target,r;n!=e.contentDOM;n=n.parentNode)if(!n||n.nodeType==11||(r=n_.get(n))&&r.isWidget()&&!r.isHidden&&r.widget.ignoreEvent(t))return!1;return!0}var Av=Object.create(null),jv=Object.create(null),Mv=Z.ie&&Z.ie_version<15||Z.ios&&Z.webkit_version<604;function Nv(e){let t=e.dom.parentNode;if(!t)return;let n=t.appendChild(document.createElement(`textarea`));n.style.cssText=`position: fixed; left: -10000px; top: 10px`,n.focus(),setTimeout(()=>{e.focus(),n.remove(),Fv(e,n.value)},50)}function Pv(e,t,n){for(let r of e.facet(t))n=r(n,e);return n}function Fv(e,t){t=Pv(e.state,Dg,t);let{state:n}=e,r,i=1,a=n.toText(t),o=a.lines==n.selection.ranges.length;if(qv!=null&&n.selection.ranges.every(e=>e.empty)&&qv==a.toString()){let e=-1;r=n.changeByRange(r=>{let s=n.doc.lineAt(r.from);if(s.from==e)return{range:r};e=s.from;let c=n.toText((o?a.line(i++).text:t)+n.lineBreak);return{changes:{from:s.from,insert:c},range:Y.cursor(r.from+c.length,-1)}})}else r=o?n.changeByRange(e=>{let t=a.line(i++);return{changes:{from:e.from,to:e.to,insert:t.text},range:Y.cursor(e.from+t.length,-1)}}):n.replaceSelection(a);e.dispatch(r,{userEvent:`input.paste`,scrollIntoView:!0})}jv.scroll=e=>{let t=e.inputState;t.lastScrollTop=e.scrollDOM.scrollTop,t.lastScrollLeft=e.scrollDOM.scrollLeft,Z.ios&&!t.touchActive&&(t.lastIOSMomentumScroll=Date.now())},jv.wheel=jv.mousewheel=e=>{e.inputState.lastWheelEvent=Date.now()},Av.keydown=(e,t)=>(e.inputState.setSelectionOrigin(`select`),t.keyCode==27&&e.inputState.tabFocusMode!=0&&(e.inputState.tabFocusMode=Date.now()+2e3),!1),jv.touchstart=(e,t)=>{let n=e.inputState,r=t.targetTouches[0];n.touchActive=!0,n.lastTouchTime=Date.now(),r&&(n.lastTouchX=r.clientX,n.lastTouchY=r.clientY),n.setSelectionOrigin(`select.pointer`)},jv.touchmove=e=>{e.inputState.setSelectionOrigin(`select.pointer`)},jv.touchend=(e,t)=>{e.inputState.touchActive=!1},Av.mousedown=(e,t)=>{if(e.observer.flush(),e.inputState.lastTouchTime>Date.now()-2e3)return!1;let n=null;for(let r of e.state.facet(Sg))if(n=r(e,t),n)break;if(!n&&t.button==0&&(n=Hv(e,t)),n){let r=!e.hasFocus;e.inputState.startMouseSelection(new Tv(e,t,n,r)),r&&e.observer.ignore(()=>{Vh(e.contentDOM);let t=e.root.activeElement;t&&!t.contains(e.contentDOM)&&t.blur()});let i=e.inputState.mouseSelection;if(i)return i.start(t),i.dragging===!1}else e.inputState.setSelectionOrigin(`select.pointer`);return!1};function Iv(e,t,n,r){if(r==1)return Y.cursor(t,n);if(r==2)return H_(e.state,t,n);{let r=e.docView.lineAt(t,n),i=e.state.doc.lineAt(r?r.posAtEnd:t),a=r?r.posAtStart:i.from,o=r?r.posAtEnd:i.to;return oDate.now()-400&&Math.abs(t.clientX-e.clientX)<2&&Math.abs(t.clientY-e.clientY)<2?(zv+1)%3:1}function Hv(e,t){let n=e.posAndSideAtCoords({x:t.clientX,y:t.clientY},!1),r=Vv(t),i=e.state.selection;return{update(e){e.docChanged&&(n.pos=e.changes.mapPos(n.pos),i=i.map(e.changes))},get(t,a,o){let s=e.posAndSideAtCoords({x:t.clientX,y:t.clientY},!1),c,l=Iv(e,s.pos,s.assoc,r);if(n.pos!=s.pos&&!a){let t=Iv(e,n.pos,n.assoc,r),i=Math.min(t.from,l.from),a=Math.max(t.to,l.to);l=i1&&(c=Uv(i,s.pos))?c:o?i.addRange(l):Y.create([l])}}}function Uv(e,t){for(let n=0;n=t)return Y.create(e.ranges.slice(0,n).concat(e.ranges.slice(n+1)),e.mainIndex==n?0:e.mainIndex-+(e.mainIndex>n))}return null}Av.dragstart=(e,t)=>{let{selection:{main:n}}=e.state;if(t.target.draggable){let r=e.docView.tile.nearest(t.target);if(r&&r.isWidget()){let e=r.posAtStart,t=e+r.length;(e>=n.to||t<=n.from)&&(n=Y.undirectionalRange(e,t))}}let{inputState:r}=e;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=n,t.dataTransfer&&(t.dataTransfer.setData(`Text`,Pv(e.state,Og,e.state.sliceDoc(n.from,n.to))),t.dataTransfer.effectAllowed=`copyMove`),!1},Av.dragend=e=>(e.inputState.draggedContent=null,!1);function Wv(e,t,n,r){if(n=Pv(e.state,Dg,n),!n)return;let i=e.posAtCoords({x:t.clientX,y:t.clientY},!1),{draggedContent:a}=e.inputState,o=r&&a&&Dv(e,t)?{from:a.from,to:a.to}:null,s={from:i,insert:n},c=e.state.changes(o?[o,s]:s);e.focus(),e.dispatch({changes:c,selection:{anchor:c.mapPos(i,-1),head:c.mapPos(i,1)},userEvent:o?`move.drop`:`input.drop`}),e.inputState.draggedContent=null}Av.drop=(e,t)=>{if(!t.dataTransfer)return!1;if(e.state.readOnly)return!0;let n=t.dataTransfer.files;if(n&&n.length){let r=Array(n.length),i=0,a=()=>{++i==n.length&&Wv(e,t,r.filter(e=>e!=null).join(e.state.lineBreak),!1)};for(let e=0;e{/[\x00-\x08\x0e-\x1f]{2}/.test(t.result)||(r[e]=t.result),a()},t.readAsText(n[e])}return!0}{let n=t.dataTransfer.getData(`Text`);if(n)return Wv(e,t,n,!0),!0}return!1},Av.paste=(e,t)=>{if(e.state.readOnly)return!0;e.observer.flush();let n=Mv?null:t.clipboardData;return n?(Fv(e,n.getData(`text/plain`)||n.getData(`text/uri-list`)),!0):(Nv(e),!1)};function Gv(e,t){let n=e.dom.parentNode;if(!n)return;let r=n.appendChild(document.createElement(`textarea`));r.style.cssText=`position: fixed; left: -10000px; top: 10px`,r.value=t,r.focus(),r.selectionEnd=t.length,r.selectionStart=0,setTimeout(()=>{r.remove(),e.focus()},50)}function Kv(e){let t=[],n=[],r=!1;for(let r of e.selection.ranges)r.empty||(t.push(e.sliceDoc(r.from,r.to)),n.push(r));if(!t.length){let i=-1;for(let{from:r}of e.selection.ranges){let a=e.doc.lineAt(r);a.number>i&&(t.push(a.text),n.push({from:a.from,to:Math.min(e.doc.length,a.to+1)})),i=a.number}r=!0}return{text:Pv(e,Og,t.join(e.lineBreak)),ranges:n,linewise:r}}var qv=null;Av.copy=Av.cut=(e,t)=>{if(!Th(e.contentDOM,e.observer.selectionRange))return!1;let{text:n,ranges:r,linewise:i}=Kv(e.state);if(!n&&!i)return!1;qv=i?n:null,t.type==`cut`&&!e.state.readOnly&&e.dispatch({changes:r,scrollIntoView:!0,userEvent:`delete.cut`});let a=Mv?null:t.clipboardData;return a?(a.clearData(),a.setData(`text/plain`,n),!0):(Gv(e,n),!1)};var Jv=Gp.define();function Yv(e,t){let n=[];for(let r of e.facet(Eg)){let i=r(e,t);i&&n.push(i)}return n.length?e.update({effects:n,annotations:Jv.of(!0)}):null}function Xv(e){setTimeout(()=>{let t=e.hasFocus;if(t!=e.inputState.notifiedFocused){let n=Yv(e.state,t);n?e.dispatch(n):e.update([])}},10)}jv.focus=e=>{e.inputState.lastFocusTime=Date.now(),!e.scrollDOM.scrollTop&&(e.inputState.lastScrollTop||e.inputState.lastScrollLeft)&&(e.scrollDOM.scrollTop=e.inputState.lastScrollTop,e.scrollDOM.scrollLeft=e.inputState.lastScrollLeft),Xv(e)},jv.blur=e=>{e.observer.clearSelectionRange(),Xv(e)},jv.compositionstart=jv.compositionupdate=(e,t)=>{if(!e.observer.editContext&&(e.inputState.compositionFirstChange??(e.inputState.compositionFirstChange=!0),e.inputState.composing<0)){let{main:t}=e.state.selection;!t.empty&&e.lineBlockAt(t.from).from!=e.lineBlockAt(t.to).from&&!e.state.readOnly&&e.dispatch({changes:e.state.selection.ranges.filter(e=>!e.empty).map(e=>({from:e.from,to:e.to})),userEvent:`input`}),e.inputState.composing=0}},jv.compositionend=e=>{e.observer.editContext||(e.inputState.composing=-1,e.inputState.compositionEndedAt=Date.now(),e.inputState.compositionPendingKey=!0,e.inputState.compositionPendingChange=e.observer.pendingRecords().length>0,e.inputState.compositionFirstChange=null,Z.chrome&&Z.android?e.observer.flushSoon():e.inputState.compositionPendingChange?Promise.resolve().then(()=>e.observer.flush()):setTimeout(()=>{e.inputState.composing<0&&e.docView.hasComposition&&e.update([])},50))},jv.contextmenu=e=>{e.inputState.lastContextMenu=Date.now()},Av.beforeinput=(e,t)=>{if((t.inputType==`insertText`||t.inputType==`insertCompositionText`)&&(e.inputState.insertingText=t.data,e.inputState.insertingTextAt=Date.now()),t.inputType==`insertReplacementText`&&e.observer.editContext){let n=t.dataTransfer?.getData(`text/plain`),r=t.getTargetRanges();if(n&&r.length){let t=r[0];return lv(e,{from:e.posAtDOM(t.startContainer,t.startOffset),to:e.posAtDOM(t.endContainer,t.endOffset),insert:e.state.toText(n)},null),!0}}let n;if(Z.chrome&&Z.android&&(n=yv.find(e=>e.inputType==t.inputType))&&(e.observer.delayAndroidKey(n.key,n.keyCode),n.key==`Backspace`||n.key==`Delete`)){let t=window.visualViewport?.height||0;setTimeout(()=>{(window.visualViewport?.height||0)>t+10&&e.hasFocus&&(e.contentDOM.blur(),e.focus())},100)}return Z.ios&&t.inputType==`deleteContentForward`&&e.observer.flushSoon(),Z.safari&&t.inputType==`insertText`&&e.inputState.composing>=0&&setTimeout(()=>jv.compositionend(e,t),20),!1};var Zv=new Set;function Qv(e){Zv.has(e)||(Zv.add(e),e.addEventListener(`copy`,()=>{}),e.addEventListener(`cut`,()=>{}))}var $v=[`pre-wrap`,`normal`,`pre-line`,`break-spaces`],ey=!1;function ty(){ey=!1}var ny=class{constructor(e){this.lineWrapping=e,this.doc=Kf.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,t){let n=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(n+=Math.max(0,Math.ceil((t-e-n*this.lineLength*.5)/this.lineLength))),this.lineHeight*n}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return $v.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let n=0;n-1,s=Math.abs(t-this.lineHeight)>.3||this.lineWrapping!=o;if(this.lineWrapping=o,this.lineHeight=t,this.charWidth=n,this.textHeight=r,this.lineLength=i,s){this.heightSamples={};for(let e=0;e0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>oy&&(ey=!0),this.height=e)}replace(t,n,r){return e.of(r)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,n,r){let i=this,a=n.doc;for(let o=r.length-1;o>=0;o--){let{fromA:s,toA:c,fromB:l,toB:u}=r[o],d=i.lineAt(s,ay.ByPosNoHeight,n.setDoc(t),0,0),f=d.to>=c?d:i.lineAt(c,ay.ByPosNoHeight,n,0,0);for(u+=f.to-c,c=f.to;o>0&&d.from<=r[o-1].toA;)s=r[o-1].fromA,l=r[o-1].fromB,o--,sa*2){let e=t[n-1];e.break?t.splice(--n,1,e.left,null,e.right):t.splice(--n,1,e.left,e.right),r+=1+e.break,i-=e.size}else if(a>i*2){let e=t[r];e.break?t.splice(r,1,e.left,null,e.right):t.splice(r,1,e.left,e.right),r+=2+e.break,a-=e.size}else break}else if(i=i&&a(this.lineAt(0,ay.ByPos,n,r,i))}setMeasuredHeight(e){let t=e.heights[e.index++];t<0?(this.spaceAbove=-t,t=e.heights[e.index++]):this.spaceAbove=0,this.setHeight(t)}updateHeight(e,t=0,n=!1,r){return r&&r.from<=t&&r.more&&this.setMeasuredHeight(r),this.outdated=!1,this}toString(){return`block(${this.length})`}},dy=class e extends uy{constructor(e,t,n){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=n}mainBlock(e,t){return new iy(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(t,n,r){let i=r[0];return r.length==1&&(i instanceof e||i instanceof fy&&i.flags&4)&&Math.abs(this.length-i.length)<10?(i instanceof fy?i=new e(i.length,this.height,this.spaceAbove):i.height=this.height,this.outdated||(i.outdated=!1),i):sy.of(r)}updateHeight(e,t=0,n=!1,r){return r&&r.from<=t&&r.more?this.setMeasuredHeight(r):(n||this.outdated)&&(this.spaceAbove=0,this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight)),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:``}${this.widgetHeight?`:`+this.widgetHeight:``})`}},fy=class e extends sy{constructor(e){super(e,0)}heightMetrics(e,t){let n=e.doc.lineAt(t).number,r=e.doc.lineAt(t+this.length).number,i=r-n+1,a,o=0;if(e.lineWrapping){let t=Math.min(this.height,e.lineHeight*i);a=t/i,this.length>i+1&&(o=(this.height-t)/(this.length-i-1))}else a=this.height/i;return{firstLine:n,lastLine:r,perLine:a,perChar:o}}blockAt(e,t,n,r){let{firstLine:i,lastLine:a,perLine:o,perChar:s}=this.heightMetrics(t,r);if(t.lineWrapping){let i=r+(e0){let t=r[r.length-1];t instanceof e?r[r.length-1]=new e(t.length+i):r.push(null,new e(i-1))}if(t>0){let n=r[0];n instanceof e?r[0]=new e(t+n.length):r.unshift(new e(t-1),null)}return sy.of(r)}decomposeLeft(t,n){n.push(new e(t-1),null)}decomposeRight(t,n){n.push(null,new e(this.length-t-1))}updateHeight(t,n=0,r=!1,i){let a=n+this.length;if(i&&i.from<=n+this.length&&i.more){let r=[],o=Math.max(n,i.from),s=-1;for(i.from>n&&r.push(new e(i.from-n-1).updateHeight(t,n));o<=a&&i.more;){let e=t.doc.lineAt(o).length;r.length&&r.push(null);let n=i.heights[i.index++],a=0;n<0&&(a=-n,n=i.heights[i.index++]),s==-1?s=n:Math.abs(n-s)>=oy&&(s=-2);let c=new dy(e,n,a);c.outdated=!1,r.push(c),o+=e+1}o<=a&&r.push(null,new e(a-o).updateHeight(t,o));let c=sy.of(r);return(s<0||Math.abs(c.height-this.height)>=oy||Math.abs(s-this.heightMetrics(t,n).perLine)>=oy)&&(ey=!0),cy(this,c)}return(r||this.outdated)&&(this.setHeight(t.heightForGap(n,n+this.length)),this.outdated=!1),this}toString(){return`gap(${this.length})`}},py=class extends sy{constructor(e,t,n){super(e.length+ +!!t+n.length,e.height+n.height,+!!t|(e.outdated||n.outdated?2:0)),this.left=e,this.right=n,this.size=e.size+n.size}get break(){return this.flags&1}blockAt(e,t,n,r){let i=n+this.left.height;return eo))return c;let l=t==ay.ByPosNoHeight?ay.ByPosNoHeight:ay.ByPos;return s?c.join(this.right.lineAt(o,l,n,a,o)):this.left.lineAt(o,l,n,r,i).join(c)}forEachLine(e,t,n,r,i,a){let o=r+this.left.height,s=i+this.left.length+this.break;if(this.break)e=s&&this.right.forEachLine(e,t,n,o,s,a);else{let c=this.lineAt(s,ay.ByPos,n,r,i);e=e&&c.from<=t&&a(c),t>c.to&&this.right.forEachLine(Math.max(e,c.to+1),t,n,o,s,a)}}replace(e,t,n){let r=this.left.length+this.break;if(tthis.left.length)return this.balanced(this.left,this.right.replace(e-r,t-r,n));let i=[];e>0&&this.decomposeLeft(e,i);let a=i.length;for(let e of n)i.push(e);if(e>0&&my(i,a-1),t=n&&t.push(null)),e>n&&this.right.decomposeLeft(e-n,t)}decomposeRight(e,t){let n=this.left.length,r=n+this.break;if(e>=r)return this.right.decomposeRight(e-r,t);e2*t.size||t.size>2*e.size?sy.of(this.break?[e,null,t]:[e,t]):(this.left=cy(this.left,e),this.right=cy(this.right,t),this.setHeight(e.height+t.height),this.outdated=e.outdated||t.outdated,this.size=e.size+t.size,this.length=e.length+this.break+t.length,this)}updateHeight(e,t=0,n=!1,r){let{left:i,right:a}=this,o=t+i.length+this.break,s=null;return r&&r.from<=t+i.length&&r.more?s=i=i.updateHeight(e,t,n,r):i.updateHeight(e,t,n),r&&r.from<=o+a.length&&r.more?s=a=a.updateHeight(e,o,n,r):a.updateHeight(e,o,n),s?this.balanced(i,a):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?` `:`-`)+this.right}};function my(e,t){let n,r;e[t]==null&&(n=e[t-1])instanceof fy&&(r=e[t+1])instanceof fy&&e.splice(t-1,3,new fy(n.length+1+r.length))}var hy=5,gy=class e{constructor(e,t){this.pos=e,this.oracle=t,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,t){if(this.lineStart>-1){let e=Math.min(t,this.lineEnd),n=this.nodes[this.nodes.length-1];n instanceof dy?n.length+=e-this.pos:(e>this.pos||!this.isCovered)&&this.nodes.push(new dy(e-this.pos,-1,0)),this.writtenTo=e,t>e&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,n){if(e=hy)&&this.addLineDeco(r,i,a)}else t>e&&this.span(e,t);this.lineEnd>-1&&this.lineEnd-1)return;let{from:e,to:t}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=t,this.writtenToe&&this.nodes.push(new dy(this.pos-e,-1,0)),this.writtenTo=this.pos}blankContent(e,t){let n=new fy(t-e);return this.oracle.doc.lineAt(e).to==t&&(n.flags|=4),n}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof dy)return e;let t=new dy(0,-1,0);return this.nodes.push(t),t}addBlock(e){this.enterLine();let t=e.deco;t&&t.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos+=e.length,t&&t.endSide>0&&(this.covering=e)}addLineDeco(e,t,n){let r=this.ensureLine();r.length+=n,r.collapsed+=n,r.widgetHeight=Math.max(r.widgetHeight,e),r.breaks+=t,this.writtenTo=this.pos+=n}finish(e){let t=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(t instanceof dy)&&!this.isCovered?this.nodes.push(new dy(0,-1,0)):(this.writtenTot.clientHeight||t.scrollWidth>t.clientWidth)&&n.overflow!=`visible`){let n=t.getBoundingClientRect();a=Math.max(a,n.left),o=Math.min(o,n.right),s=Math.max(s,n.top),c=Math.min(t==e.parentNode?i.innerHeight:c,n.bottom)}t=n.position==`absolute`||n.position==`fixed`?t.offsetParent:t.parentNode}else if(t.nodeType==11)t=t.host;else break;return{left:a-n.left,right:Math.max(a,o)-n.left,top:s-(n.top+t),bottom:Math.max(s,c)-(n.top+t)}}function by(e){let t=e.getBoundingClientRect(),n=e.ownerDocument.defaultView||window;return t.left0&&t.top0}function xy(e,t){let n=e.getBoundingClientRect();return{left:0,right:n.right-n.left,top:t,bottom:n.bottom-(n.top+t)}}var Sy=class{constructor(e,t,n,r){this.from=e,this.to=t,this.size=n,this.displaySize=r}static same(e,t){if(e.length!=t.length)return!1;for(let n=0;ntypeof e!=`function`&&e.class==`cm-lineWrapping`);this.heightOracle=new ny(n),this.stateDeco=jy(t),this.heightMap=sy.empty().applyChanges(this.stateDeco,Kf.empty,this.heightOracle.setDoc(t.doc),[new $g(0,0,0,t.doc.length)]);for(let e=0;e<2&&(this.viewport=this.getViewport(0,null),this.updateForViewport());e++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=ph.set(this.lineGaps.map(e=>e.draw(this,!1))),this.scrollParent=e.scrollDOM,this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let n=0;n<=1;n++){let r=n?t.head:t.anchor;if(!e.some(({from:e,to:t})=>r>=e&&r<=t)){let{from:t,to:n}=this.lineBlockAt(r);e.push(new Ty(t,n))}}return this.viewports=e.sort((e,t)=>e.from-t.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?Ay:My.get(this.heightOracle,this.heightMap,this.viewports),e.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(Ny(e,this.scaler))})}update(e,t=null){this.state=e.state;let n=this.stateDeco;this.stateDeco=jy(this.state);let r=e.changedRanges,i=$g.extendWithRanges(r,_y(n,this.stateDeco,e?e.changes:dp.empty(this.state.doc.length))),a=this.heightMap.height,o=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);ty(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),i),(this.heightMap.height!=a||ey)&&(e.flags|=2),o?(this.scrollAnchorPos=e.changes.mapPos(o.from,-1),this.scrollAnchorHeight=o.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=a);let s=i.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.heads.to)||!this.viewportIsAppropriate(s))&&(s=this.getViewport(0,t));let c=s.from!=this.viewport.from||s.to!=this.viewport.to;this.viewport=s,e.flags|=this.updateForViewport(),(c||!e.changes.empty||e.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(e.changes),t&&(this.scrollTarget=t),!this.mustEnforceCursorAssoc&&(e.selectionSet||e.focusChanged)&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(Ag)&&(this.mustEnforceCursorAssoc=!0)}measure(){let{view:e}=this,t=e.contentDOM,n=window.getComputedStyle(t),r=this.heightOracle,i=n.whiteSpace;this.defaultTextDirection=n.direction==`rtl`?Zh.RTL:Zh.LTR;let a=this.heightOracle.mustRefreshForWrapping(i)||this.mustMeasureContent===`refresh`,o=t.getBoundingClientRect(),s=a||this.mustMeasureContent||this.contentDOMHeight!=o.height;this.contentDOMHeight=o.height,this.mustMeasureContent=!1;let c=0,l=0;if(o.width&&o.height){let{scaleX:e,scaleY:n}=Ph(t,o);(e>.005&&Math.abs(this.scaleX-e)>.005||n>.005&&Math.abs(this.scaleY-n)>.005)&&(this.scaleX=e,this.scaleY=n,c|=16,a=s=!0)}let u=(parseInt(n.paddingTop)||0)*this.scaleY,d=(parseInt(n.paddingBottom)||0)*this.scaleY;(this.paddingTop!=u||this.paddingBottom!=d)&&(this.paddingTop=u,this.paddingBottom=d,c|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(r.lineWrapping&&(s=!0),this.editorWidth=e.scrollDOM.clientWidth,c|=16);let f=Ih(this.view.contentDOM,!1).y;f!=this.scrollParent&&(this.scrollParent=f,this.scrollAnchorHeight=-1,this.scrollOffset=0);let p=this.getScrollOffset();this.scrollOffset!=p&&(this.scrollAnchorHeight=-1,this.scrollOffset=p),this.scrolledToBottom=qh(this.scrollParent||e.win);let m=(this.printing?xy:yy)(t,this.paddingTop),h=m.top-this.pixelViewport.top,g=m.bottom-this.pixelViewport.bottom;this.pixelViewport=m;let _=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(_!=this.inView&&(this.inView=_,_&&(s=!0)),!this.inView&&!this.scrollTarget&&!by(e.dom))return 0;let v=o.width;if((this.contentDOMWidth!=v||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=o.width,this.editorHeight=e.scrollDOM.clientHeight,c|=16),s){let t=e.docView.measureVisibleLineHeights(this.viewport);if(r.mustRefreshForHeights(t)&&(a=!0),a||r.lineWrapping&&Math.abs(v-this.contentDOMWidth)>r.charWidth){let{lineHeight:n,charWidth:o,textHeight:s}=e.docView.measureTextSize();a=n>0&&r.refresh(i,n,o,s,Math.max(5,v/o),t),a&&(e.docView.minWidth=0,c|=16)}h>0&&g>0?l=Math.max(h,g):h<0&&g<0&&(l=Math.min(h,g)),ty();for(let n of this.viewports){let i=n.from==this.viewport.from?t:e.docView.measureVisibleLineHeights(n);this.heightMap=(a?sy.empty().applyChanges(this.stateDeco,Kf.empty,this.heightOracle,[new $g(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(r,0,a,new ry(n.from,i))}ey&&(c|=2)}let y=!this.viewportIsAppropriate(this.viewport,l)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return y&&(c&2&&(c|=this.updateScaler()),this.viewport=this.getViewport(l,this.scrollTarget),c|=this.updateForViewport()),(c&2||y)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(a?[]:this.lineGaps,e)),c|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),c}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let n=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),r=this.heightMap,i=this.heightOracle,{visibleTop:a,visibleBottom:o}=this,s=new Ty(r.lineAt(a-n*1e3,ay.ByHeight,i,0,0).from,r.lineAt(o+(1-n)*1e3,ay.ByHeight,i,0,0).to);if(t){let{head:e}=t.range;if(es.to){let n=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),a=r.lineAt(e,ay.ByPos,i,0,0),o;o=t.y==`center`?(a.top+a.bottom)/2-n/2:t.y==`start`||t.y==`nearest`&&e=o+Math.max(10,Math.min(n,250)))&&r>a-2e3&&i>1,a=r<<1;if(this.defaultTextDirection!=Zh.LTR&&!n)return[];let o=[],s=(r,a,c,l)=>{if(a-rr&&ee.from>=c.from&&e.to<=c.to&&Math.abs(e.from-r)e.fromt));if(!f){if(ae.from<=a&&e.to>=a)){let e=t.moveToLineBoundary(Y.cursor(a),!1,!0).head;e>r&&(a=e)}let e=this.gapSize(c,r,a,l);f=new Sy(r,a,e,n||e<2e6?e:2e6)}o.push(f)},c=t=>{if(t.length2e6)for(let n of e)n.from>=t.from&&n.fromt.from&&s(t.from,c,t,i),le.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let n=[];gm.spans(t,this.viewport.from,this.viewport.to,{span(e,t){n.push({from:e,to:t})},point(){}},20);let r=0;if(n.length!=this.visibleRanges.length)r=12;else for(let t=0;t=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(t=>t.from<=e&&t.to>=e)||Ny(this.heightMap.lineAt(e,ay.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(t=>t.top<=e&&t.bottom>=e)||Ny(this.heightMap.lineAt(this.scaler.fromDOM(e),ay.ByHeight,this.heightOracle,0,0),this.scaler)}getScrollOffset(){return this.scrollParent==this.view.scrollDOM?this.scrollParent.scrollTop*this.scaleY:(this.scrollParent?this.scrollParent.getBoundingClientRect().top:0)-this.view.contentDOM.getBoundingClientRect().top}scrollAnchorAt(e){let t=this.lineBlockAtHeight(e+12-this.paddingTop);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}elementAtHeight(e){return Ny(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}},Ty=class{constructor(e,t){this.from=e,this.to=t}};function Ey(e,t,n){let r=[],i=e,a=0;return gm.spans(n,e,t,{span(){},point(e,t){e>i&&(r.push({from:i,to:e}),a+=e-i),i=t}},20),i=1)return t[t.length-1].to;let r=Math.floor(e*n);for(let e=0;;e++){let{from:n,to:i}=t[e],a=i-n;if(r<=a)return n+r;r-=a}}function Oy(e,t){let n=0;for(let{from:r,to:i}of e.ranges){if(t<=i){n+=t-r;break}n+=i-r}return n/e.total}function ky(e,t){for(let n of e)if(t(n))return n}var Ay={toDOM(e){return e},fromDOM(e){return e},scale:1,eq(e){return e==this}};function jy(e){let t=e.facet(Ug).filter(e=>typeof e!=`function`),n=e.facet(Gg).filter(e=>typeof e!=`function`);return n.length&&t.push(gm.join(n)),t}var My=class e{constructor(e,t){this.scale=e,this.viewports=t}static get(t,n,r){let i=0,a=0,o=0,s=r.map(({from:e,to:r})=>{let a=n.lineAt(e,ay.ByPos,t,0,0).top,o=n.lineAt(r,ay.ByPos,t,0,0).bottom;return i+=o-a,{from:e,to:r,top:a,bottom:o,domTop:0,domBottom:0}});if(n.height-i<10)return Ay;let c=(7e6-i)/(n.height-i);for(let e of s)e.domTop=o+(e.top-a)*c,o=e.domBottom=e.domTop+(e.bottom-e.top),a=e.bottom;return new e(c,s)}toDOM(e){for(let t=0,n=0,r=0;;t++){let i=te.from==t.viewports[n].from&&e.to==t.viewports[n].to)}};function Ny(e,t){if(t.scale==1)return e;let n=t.toDOM(e.top),r=t.toDOM(e.bottom);return new iy(e.from,e.length,n,r-n,Array.isArray(e._content)?e._content.map(e=>Ny(e,t)):e._content)}var Py=X.define({combine:e=>e.join(` `)}),Fy=X.define({combine:e=>e.indexOf(!0)>-1}),Iy=Im.newName(),Ly=Im.newName(),Ry=Im.newName(),zy={"&light":`.`+Ly,"&dark":`.`+Ry};function By(e,t,n){return new Im(t,{finish(t){return/&/.test(t)?t.replace(/&\w*/,t=>{if(t==`&`)return e;if(!n||!n[t])throw RangeError(`Unsupported selector: ${t}`);return n[t]}):e+` `+t}})}var Vy=By(`.`+Iy,{"&":{position:`relative !important`,boxSizing:`border-box`,"&.cm-focused":{outline:`1px dotted #212121`},display:`flex !important`,flexDirection:`column`},".cm-scroller":{display:`flex !important`,alignItems:`flex-start !important`,fontFamily:`monospace`,lineHeight:1.4,height:`100%`,overflowX:`auto`,position:`relative`,zIndex:0,overflowAnchor:`none`},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:`block`,whiteSpace:`pre`,wordWrap:`normal`,boxSizing:`border-box`,minHeight:`100%`,padding:`4px 0`,outline:`none`,"&[contenteditable=true]":{WebkitUserModify:`read-write-plaintext-only`}},".cm-lineWrapping":{whiteSpace_fallback:`pre-wrap`,whiteSpace:`break-spaces`,wordBreak:`break-word`,overflowWrap:`anywhere`,flexShrink:1},"&light .cm-content":{caretColor:`black`},"&dark .cm-content":{caretColor:`white`},".cm-line":{display:`block`,padding:`0 2px 0 6px`},".cm-layer":{userSelect:`none`,position:`absolute`,left:0,top:0,contain:`size style`,"& > *":{position:`absolute`}},"&light .cm-selectionBackground":{background:`#d9d9d9`},"&dark .cm-selectionBackground":{background:`#222`},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:`#d7d4f0`},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:`#233`},".cm-cursorLayer":{pointerEvents:`none`},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:`steps(1) cm-blink 1.2s infinite`},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:`1.2px solid black`,marginLeft:`-0.6px`,pointerEvents:`none`},".cm-cursor":{display:`none`},"&dark .cm-cursor":{borderLeftColor:`#ddd`},".cm-selectionHandle":{backgroundColor:`currentColor`,width:`1.5px`},".cm-selectionHandle-start::before, .cm-selectionHandle-end::before":{content:`""`,backgroundColor:`inherit`,borderRadius:`50%`,width:`8px`,height:`8px`,position:`absolute`,left:`-3.25px`},".cm-selectionHandle-start::before":{top:`-8px`},".cm-selectionHandle-end::before":{bottom:`-8px`},".cm-dropCursor":{position:`absolute`},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:`block`},".cm-iso":{unicodeBidi:`isolate`},".cm-announced":{position:`fixed`,top:`-10000px`},"@media print":{".cm-announced":{display:`none`}},"&light .cm-activeLine":{backgroundColor:`#cceeff44`},"&dark .cm-activeLine":{backgroundColor:`#99eeff33`},"&light .cm-specialChar":{color:`red`},"&dark .cm-specialChar":{color:`#f78`},".cm-gutters":{flexShrink:0,display:`flex`,height:`100%`,boxSizing:`border-box`,zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:`#f5f5f5`,color:`#6c6c6c`,border:`0px solid #ddd`,"&.cm-gutters-before":{borderRightWidth:`1px`},"&.cm-gutters-after":{borderLeftWidth:`1px`}},"&dark .cm-gutters":{backgroundColor:`#333338`,color:`#ccc`},".cm-gutter":{display:`flex !important`,flexDirection:`column`,flexShrink:0,boxSizing:`border-box`,minHeight:`100%`,overflow:`hidden`},".cm-gutterElement":{boxSizing:`border-box`},".cm-lineNumbers .cm-gutterElement":{padding:`0 3px 0 5px`,minWidth:`20px`,textAlign:`right`,whiteSpace:`nowrap`},"&light .cm-activeLineGutter":{backgroundColor:`#e2f2ff`},"&dark .cm-activeLineGutter":{backgroundColor:`#222227`},".cm-panels":{boxSizing:`border-box`,position:`sticky`,left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:`#f5f5f5`,color:`black`},".cm-panels-top":{top:`0`},".cm-panels-bottom":{bottom:`0`},"&light .cm-panels-top":{borderBottom:`1px solid #ddd`},"&light .cm-panels-bottom":{borderTop:`1px solid #ddd`},"&dark .cm-panels":{backgroundColor:`#333338`,color:`white`},".cm-dialog":{padding:`2px 19px 4px 6px`,position:`relative`,"& label":{fontSize:`80%`}},".cm-dialog-close":{position:`absolute`,top:`3px`,right:`4px`,backgroundColor:`inherit`,border:`none`,font:`inherit`,fontSize:`14px`,padding:`0`},".cm-tab":{display:`inline-block`,overflow:`hidden`,verticalAlign:`bottom`},".cm-widgetBuffer":{verticalAlign:`baseline`,height:`1em`,width:0,display:`inline`},".cm-placeholder":{color:`#888`,display:`inline-block`,verticalAlign:`top`,userSelect:`none`},".cm-highlightSpace":{background:`radial-gradient(circle at 50% 55%, #aaa 20%, transparent 0) no-repeat`,backgroundSize:`.4em`,backgroundPosition:`calc(min(50%, 0px)) center`},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,')`,backgroundSize:`auto 100%`,backgroundPosition:`right 90%`,backgroundRepeat:`no-repeat`},".cm-trailingSpace":{backgroundColor:`#ff332255`},".cm-button":{verticalAlign:`middle`,color:`inherit`,fontSize:`70%`,padding:`.2em 1em`,borderRadius:`1px`},"&light .cm-button":{backgroundImage:`linear-gradient(#eff1f5, #d9d9df)`,border:`1px solid #888`,"&:active":{backgroundImage:`linear-gradient(#b4b4b4, #d0d3d6)`}},"&dark .cm-button":{backgroundImage:`linear-gradient(#393939, #111)`,border:`1px solid #888`,"&:active":{backgroundImage:`linear-gradient(#111, #333)`}},".cm-textfield":{verticalAlign:`middle`,color:`inherit`,fontSize:`70%`,border:`1px solid silver`,padding:`.2em .5em`},"&light .cm-textfield":{backgroundColor:`white`},"&dark .cm-textfield":{border:`1px solid #555`,backgroundColor:`inherit`}},zy),Hy={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Uy=Z.ie&&Z.ie_version<=11,Wy=class{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new Lh,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(t=>{for(let e of t)this.queue.push(e);(Z.ie&&Z.ie_version<=11||Z.ios&&e.composing)&&t.some(e=>e.type==`childList`&&e.removedNodes.length||e.type==`characterData`&&e.oldValue.length>e.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&Z.android&&e.constructor.EDIT_CONTEXT!==!1&&!(Z.chrome&&Z.chrome_version<126)&&(this.editContext=new Jy(e),e.state.facet(Ig)&&(e.contentDOM.editContext=this.editContext.editContext)),Uy&&(this.onCharData=e=>{this.queue.push({target:e.target,type:`characterData`,oldValue:e.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia(`print`)),typeof ResizeObserver==`function`&&(this.resizeScroll=new ResizeObserver(()=>{this.view.docView?.lastUpdate{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),e.length>0&&e[e.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent(`Event`)))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(e=>{e.length>0&&e[e.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent(`Event`))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers(`scroll`,e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(this.pendingRecords().length>0),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){(e.type!=`change`&&e.type||e.matches)&&(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((t,n)=>t!=e[n]))){this.gapIntersection.disconnect();for(let t of e)this.gapIntersection.observe(t);this.gaps=e}}onSelectionChange(e){let t=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:n}=this,r=this.selectionRange;if(n.state.facet(Ig)?n.root.activeElement!=this.dom:!Th(this.dom,r))return;let i=r.anchorNode&&n.docView.tile.nearest(r.anchorNode);i&&i.isWidget()&&i.widget.ignoreEvent(e)?t||(this.selectionChanged=!1):(Z.ie&&Z.ie_version<=11||Z.android&&Z.chrome)&&!n.state.selection.main.empty&&r.focusNode&&Dh(r.focusNode,r.focusOffset,r.anchorNode,r.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=Ch(e.root);if(!t)return!1;let n=Z.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&qy(this.view,t)||t;if(!n||this.selectionRange.eq(n))return!1;let r=Th(this.dom,n);return r&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime{let e=this.delayedAndroidKey;e&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=e.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&e.force&&Wh(this.dom,e.key,e.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(e)}this.delayedAndroidKey&&e!=`Enter`||(this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let t=-1,n=-1,r=!1;for(let i of e){let e=this.readMutation(i);e&&(e.typeOver&&(r=!0),t==-1?{from:t,to:n}=e:(t=Math.min(e.from,t),n=Math.max(e.to,n)))}return{from:t,to:n,typeOver:r}}readChange(){let{from:e,to:t,typeOver:n}=this.processRecords(),r=this.selectionChanged&&Th(this.dom,this.selectionRange);if(e<0&&!r)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let i=new ov(this.view,e,t,n);return this.view.docView.domChanged={newSel:i.newSel?i.newSel.main:null},i}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let t=this.selectionChanged,n=this.readChange();if(!n)return this.view.requestMeasure(),!1;let r=this.view.state,i=cv(this.view,n);return this.view.state==r&&(n.domChanged||t)&&this.view.update([]),i}readMutation(e){let t=this.view.docView.tile.nearest(e.target);if(!t||t.isWidget())return null;if(t.markDirty(e.type==`attributes`),e.type==`childList`){let n=Gy(t,e.previousSibling||e.target.previousSibling,-1),r=Gy(t,e.nextSibling||e.target.nextSibling,1);return{from:n?t.posAfter(n):t.posAtStart,to:r?t.posBefore(r):t.posAtEnd,typeOver:!1}}return e.type==`characterData`?{from:t.posAtStart,to:t.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener(`resize`,this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener(`change`,this.onPrint):this.printQuery.addListener(this.onPrint):e.addEventListener(`beforeprint`,this.onPrint),e.addEventListener(`scroll`,this.onScroll),e.document.addEventListener(`selectionchange`,this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener(`scroll`,this.onScroll),e.removeEventListener(`resize`,this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener(`change`,this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener(`beforeprint`,this.onPrint),e.document.removeEventListener(`selectionchange`,this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(Ig)!=e.state.facet(Ig)&&(e.view.contentDOM.editContext=e.state.facet(Ig)?this.editContext.editContext:null))}destroy(){var e,t,n;this.stop(),(e=this.intersection)==null||e.disconnect(),(t=this.gapIntersection)==null||t.disconnect(),(n=this.resizeScroll)==null||n.disconnect();for(let e of this.scrollTargets)e.removeEventListener(`scroll`,this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}};function Gy(e,t,n){for(;t;){let r=n_.get(t);if(r&&r.parent==e)return r;let i=t.parentNode;t=i==e.dom?n>0?t.nextSibling:t.previousSibling:i}return null}function Ky(e,t){let n=t.startContainer,r=t.startOffset,i=t.endContainer,a=t.endOffset,o=e.docView.domAtPos(e.state.selection.main.anchor,1);return Dh(o.node,o.offset,i,a)&&([n,r,i,a]=[i,a,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:a}}function qy(e,t){if(t.getComposedRanges){let n=t.getComposedRanges(e.root)[0];if(n)return Ky(e,n)}let n=null;function r(e){e.preventDefault(),e.stopImmediatePropagation(),n=e.getTargetRanges()[0]}return e.contentDOM.addEventListener(`beforeinput`,r,!0),e.dom.ownerDocument.execCommand(`indent`),e.contentDOM.removeEventListener(`beforeinput`,r,!0),n?Ky(e,n):null}var Jy=class{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let t=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=n=>{let r=e.state.selection.main,{anchor:i,head:a}=r,o=this.toEditorPos(n.updateRangeStart),s=this.toEditorPos(n.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:n.updateRangeStart,editorBase:o,drifted:!1});let c=s-o>n.text.length;o==this.from&&ithis.to&&(s=i);let l=dv(e.state.sliceDoc(o,s),n.text,(c?r.from:r.to)-o,c?`end`:null);if(!l){let t=Y.single(this.toEditorPos(n.selectionStart),this.toEditorPos(n.selectionEnd));mv(t,r)||e.dispatch({selection:t,userEvent:`select`});return}let u={from:l.from+o,to:l.toA+o,insert:Kf.of(n.text.slice(l.from,l.toB).split(` +`))};if((Z.mac||Z.android)&&u.from==a-1&&/^\. ?$/.test(n.text)&&e.contentDOM.getAttribute(`autocorrect`)==`off`&&(u={from:o,to:s,insert:Kf.of([n.text.replace(`.`,` `)])}),this.pendingContextChange=u,!e.state.readOnly){let t=this.to-this.from+(u.to-u.from+u.insert.length);lv(e,u,Y.single(this.toEditorPos(n.selectionStart,t),this.toEditorPos(n.selectionEnd,t)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),u.from=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(t.text.slice(Math.max(0,n.updateRangeStart-1),Math.min(t.text.length,n.updateRangeStart+1)))&&this.handlers.compositionend(n)},this.handlers.characterboundsupdate=n=>{let r=[],i=null;for(let t=this.toEditorPos(n.rangeStart),a=this.toEditorPos(n.rangeEnd);t{let n=[];for(let e of t.getTextFormats()){let t=e.underlineStyle,r=e.underlineThickness;if(!/none/i.test(t)&&!/none/i.test(r)){let i=this.toEditorPos(e.rangeStart),a=this.toEditorPos(e.rangeEnd);if(i{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:t}=this.composing;this.composing=null,t&&this.reset(e.state)}};for(let e in this.handlers)t.addEventListener(e,this.handlers[e]);this.measureReq={read:e=>{let t=Ch(e.root);t&&t.rangeCount&&this.editContext.updateSelectionBounds(t.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,n=!1,r=this.pendingContextChange;return e.changes.iterChanges((i,a,o,s,c)=>{if(n)return;let l=c.length-(a-i);if(r&&a>=r.to){if(r.from==i&&r.to==a&&r.insert.eq(c)){r=this.pendingContextChange=null,t+=l,this.to+=l;return}r=null,this.revertPending(e.state)}if(i+=t,a+=t,a<=this.from)this.from+=l,this.to+=l;else if(ithis.to||this.to-this.from+c.length>3e4){n=!0;return}this.editContext.updateText(this.toContextPos(i),this.toContextPos(a),c.toString()),this.to+=l}t+=l}),r&&!n&&this.revertPending(e.state),!n}update(e){let t=this.pendingContextChange,n=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(n.from,n.to)&&e.transactions.some(e=>!e.isUserEvent(`input.type`)&&e.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.reset(e.state)):(e.docChanged||e.selectionSet||t)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:t}=e.selection.main;this.from=Math.max(0,t-1e4),this.to=Math.min(e.doc.length,t+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let t=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(t.from),this.toContextPos(t.from+t.insert.length),e.doc.sliceString(t.from,t.to))}setSelection(e){let{main:t}=e.selection,n=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),r=this.toContextPos(t.head);(this.editContext.selectionStart!=n||this.editContext.selectionEnd!=r)&&this.editContext.updateSelection(n,r)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to3e4)}toEditorPos(e,t=this.to-this.from){e=Math.min(e,t);let n=this.composing;return n&&n.drifted?n.editorBase+(e-n.contextBase):e+this.from}toContextPos(e){let t=this.composing;return t&&t.drifted?t.contextBase+(e-t.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}},Yy=class e{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.clearAnnouncement=-1,this.contentDOM=document.createElement(`div`),this.scrollDOM=document.createElement(`div`),this.scrollDOM.tabIndex=-1,this.scrollDOM.className=`cm-scroller`,this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement(`div`),this.announceDOM.className=`cm-announced`,this.announceDOM.setAttribute(`aria-live`,`polite`),this.dom=document.createElement(`div`),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:t}=e;this.dispatchTransactions=e.dispatchTransactions||t&&(e=>e.forEach(e=>t(e,this)))||(e=>this.update(e)),this.dispatch=this.dispatch.bind(this),this._root=e.root||Gh(e.parent)||document,this.viewState=new wy(this,e.state||lm.create(e)),e.scrollTo&&e.scrollTo.is(Ng)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Rg).map(e=>new Bg(e));for(let e of this.plugins)e.update(this);this.observer=new Wy(this),this.inputState=new hv(this),this.inputState.ensureHandlers(this.plugins),this.docView=new k_(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),document.fonts?.ready&&document.fonts.ready.then(()=>{this.viewState.mustMeasureContent=`refresh`,this.requestMeasure()})}dispatch(...e){let t=e.length==1&&e[0]instanceof Yp?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(t,this)}update(t){if(this.updateState!=0)throw Error(`Calls to EditorView.update are not allowed while an update is in progress`);let n=!1,r=!1,i,a=this.state;for(let e of t){if(e.startState!=a)throw RangeError(`Trying to update state with a transaction that doesn't start from the previous state.`);a=e.state}if(this.destroyed){this.viewState.state=a;return}let o=this.hasFocus,s=0,c=null;t.some(e=>e.annotation(Jv))?(this.inputState.notifiedFocused=o,s=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,c=Yv(a,o),c||(s=1));let l=this.observer.delayedAndroidKey,u=null;if(l?(this.observer.clearDelayedAndroidKey(),u=this.observer.readChange(),(u&&!this.state.doc.eq(a.doc)||!this.state.selection.eq(a.selection))&&(u=null)):this.observer.clear(),a.facet(lm.phrases)!=this.state.facet(lm.phrases))return this.setState(a);i=e_.create(this,a,t),i.flags|=s;let d=this.viewState.scrollTarget;try{this.updateState=2;for(let n of t){if(d&&=d.map(n.changes),n.scrollIntoView){let{main:t}=n.state.selection,{x:r,y:i}=this.state.facet(e.cursorScrollMargin);d=new Mg(t.empty?t:Y.cursor(t.head,t.head>t.anchor?-1:1),`nearest`,`nearest`,i,r)}for(let e of n.effects)e.is(Ng)&&(d=e.value.clip(this.state))}this.viewState.update(i,d),this.bidiCache=Qy.update(this.bidiCache,i.changes),i.empty||(this.updatePlugins(i),this.inputState.update(i)),n=this.docView.update(i),this.state.facet(Qg)!=this.styleModules&&this.mountStyles(),r=this.updateAttrs(),this.showAnnouncements(t),this.docView.updateSelection(n,t.some(e=>e.isUserEvent(`select.pointer`)))}finally{this.updateState=0}if(i.startState.facet(Py)!=i.state.facet(Py)&&(this.viewState.mustMeasureContent=!0),(n||r||d||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),n&&this.docViewUpdate(),!i.empty)for(let e of this.state.facet(wg))try{e(i)}catch(e){Fg(this.state,e,`update listener`)}(c||u)&&Promise.resolve().then(()=>{c&&this.state==c.startState&&this.dispatch(c),u&&!cv(this,u)&&l.force&&Wh(this.contentDOM,l.key,l.keyCode)})}setState(e){if(this.updateState!=0)throw Error(`Calls to EditorView.setState are not allowed while an update is in progress`);if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let t=this.hasFocus;try{for(let e of this.plugins)e.destroy(this);this.viewState=new wy(this,e),this.plugins=e.facet(Rg).map(e=>new Bg(e)),this.pluginMap.clear();for(let e of this.plugins)e.update(this);this.docView.destroy(),this.docView=new k_(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}t&&this.focus(),this.requestMeasure()}updatePlugins(e){let t=e.startState.facet(Rg),n=e.state.facet(Rg);if(t!=n){let r=[];for(let i of n){let n=t.indexOf(i);if(n<0)r.push(new Bg(i));else{let t=this.plugins[n];t.mustUpdate=e,r.push(t)}}for(let t of this.plugins)t.mustUpdate!=e&&t.destroy(this);this.plugins=r,this.pluginMap.clear()}else for(let t of this.plugins)t.mustUpdate=e;for(let e=0;e-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let t=null,n=this.viewState.scrollParent,r=this.viewState.getScrollOffset(),{scrollAnchorPos:i,scrollAnchorHeight:a,scaleY:o}=this.viewState;Math.abs(r-this.viewState.scrollOffset)>1&&(a=-1),this.viewState.scrollAnchorHeight=-1;try{for(let e=0;;e++){if(a<0){if(qh(n||this.win))i=-1,a=this.viewState.heightMap.height/this.viewState.scaleY;else{let e=this.viewState.scrollAnchorAt(r);i=e.from,a=e.top}o=this.viewState.scaleY}this.updateState=1;let s=this.viewState.measure();if(!s&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(e>5){console.warn(this.measureRequests.length?`Measure loop restarted more than 5 times`:`Viewport failed to stabilize`);break}let c=[];s&4||([this.measureRequests,c]=[c,this.measureRequests]);let l=c.map(e=>{try{return e.read(this)}catch(e){return Fg(this.state,e),Zy}}),u=e_.create(this,this.state,[]),d=!1;u.flags|=s,t?t.flags|=s:t=u,this.updateState=2,u.empty||(this.updatePlugins(u),this.inputState.update(u),this.updateAttrs(),d=this.docView.update(u),d&&this.docViewUpdate());for(let e=0;e1||e<-1)&&!(Z.ios&&this.inputState.lastIOSMomentumScroll>Date.now()-100)&&(n==this.scrollDOM||this.hasFocus||Math.max(this.inputState.lastWheelEvent,this.inputState.lastTouchTime)>Date.now()-100)){r+=e,n?i<0?n.scrollTop=n.scrollHeight:n.scrollTop+=e:this.win.scrollBy(0,e),a=-1;continue}}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let e of this.state.facet(wg))e(t)}get themeClasses(){return Iy+` `+(this.state.facet(Fy)?Ry:Ly)+` `+this.state.facet(Py)}updateAttrs(){let e=$y(this,Vg,{class:`cm-editor`+(this.hasFocus?` cm-focused `:` `)+this.themeClasses}),t={spellcheck:`false`,autocorrect:`off`,autocapitalize:`off`,writingsuggestions:`false`,translate:`no`,contenteditable:this.state.facet(Ig)?`true`:`false`,class:`cm-content`,style:`${Z.tabSize}: ${this.state.tabSize}`,role:`textbox`,"aria-multiline":`true`};this.state.readOnly&&(t[`aria-readonly`]=`true`),$y(this,Hg,t);let n=this.observer.ignore(()=>{let n=lh(this.contentDOM,this.contentAttrs,t),r=lh(this.dom,this.editorAttrs,e);return n||r});return this.editorAttrs=e,this.contentAttrs=t,n}showAnnouncements(t){let n=!0;for(let r of t)for(let t of r.effects)if(t.is(e.announce)){n&&=(this.announceDOM.textContent=``,this.win.clearTimeout(this.clearAnnouncement),this.clearAnnouncement=this.win.setTimeout(()=>{this.announceDOM.textContent=`\xA0`},200),!1);let e=this.announceDOM.appendChild(document.createElement(`div`));e.textContent=t.value}}mountStyles(){this.styleModules=this.state.facet(Qg);let t=this.state.facet(e.cspNonce);Im.mount(this.root,this.styleModules.concat(Vy).reverse(),t?{nonce:t}:void 0)}readMeasured(){if(this.updateState==2)throw Error(`Reading the editor layout isn't allowed during an update`);this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let t=0;tt.plugin==e)||null),t&&t.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,t,n){return Z_(this,e,K_(this,e,t,n))}moveByGroup(e,t){return Z_(this,e,K_(this,e,t,t=>q_(this,e.head,t)))}visualLineSide(e,t){return t?Y.cursor(e.to,1):Y.cursor(e.from,-1)}moveToLineBoundary(e,t,n=!0){return G_(this,e,t,n)}moveVertically(e,t,n){return Z_(this,e,J_(this,e,t,n))}domAtPos(e,t=1){return this.docView.domAtPos(e,t)}posAtDOM(e,t=0){return this.docView.posFromDOM(e,t)}posAtCoords(e,t=!0){this.readMeasured();let n=$_(this,e,t);return n&&n.pos}posAndSideAtCoords(e,t=!0){return this.readMeasured(),$_(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let n=this.state.doc.lineAt(e),r=this.bidiSpans(n),i=r[sg.find(r,e-n.from,-1,t)];return n.length&&(e==n.from&&t<0||e==n.to&&t>0)&&i.dir!=this.textDirectionAt(n.from)&&(e==n.to?(e=n.from+i.from,t=1):(e=n.from+i.to,t=-1)),this.docView.coordsAt(e,t,i.dir==Zh.RTL)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(kg)||ethis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>Xy)return gg(e.length);let t=this.textDirectionAt(e.from),n;for(let r of this.bidiCache)if(r.from==e.from&&r.dir==t&&(r.fresh||cg(r.isolates,n=Jg(this,e))))return r.order;n||=Jg(this,e);let r=hg(e.text,t,n);return this.bidiCache.push(new Qy(e.from,e.to,t,n,!0,r)),r}get hasFocus(){return(this.dom.ownerDocument.hasFocus()||Z.safari&&this.inputState?.lastContextMenu>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{Vh(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.win.clearTimeout(this.clearAnnouncement),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,t={}){return Ng.of(new Mg(typeof e==`number`?Y.cursor(e):e,t.y??`nearest`,t.x??`nearest`,t.yMargin??5,t.xMargin??5))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,n=this.viewState.scrollAnchorAt(e);return Ng.of(new Mg(Y.cursor(n.from),`start`,`start`,n.top-e,t,!0))}setTabFocusMode(e){e==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof e==`boolean`?this.inputState.tabFocusMode=e?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return zg.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return zg.define(()=>({}),{eventObservers:e})}static theme(e,t){let n=Im.newName(),r=[Py.of(n),Qg.of(By(`.${n}`,e))];return t&&t.dark&&r.push(Fy.of(!0)),r}static baseTheme(e){return Ap.lowest(Qg.of(By(`.`+Iy,e,zy)))}static findFromDOM(e){let t=e.querySelector(`.cm-content`);return(t&&n_.get(t)||n_.get(e))?.root?.view||null}};Yy.styleModule=Qg,Yy.inputHandler=Tg,Yy.clipboardInputFilter=Dg,Yy.clipboardOutputFilter=Og,Yy.scrollHandler=jg,Yy.focusChangeEffect=Eg,Yy.perLineTextDirection=kg,Yy.exceptionSink=Cg,Yy.updateListener=wg,Yy.editable=Ig,Yy.mouseSelectionStyle=Sg,Yy.dragMovesSelection=xg,Yy.clickAddsSelectionRange=bg,Yy.decorations=Ug,Yy.blockWrappers=Wg,Yy.outerDecorations=Gg,Yy.atomicRanges=Kg,Yy.bidiIsolatedRanges=qg,Yy.cursorScrollMargin=X.define({combine:e=>{let t=5,n=5;for(let r of e)typeof r==`number`?t=n=r:{x:t,y:n}=r;return{x:t,y:n}}}),Yy.scrollMargins=Xg,Yy.darkTheme=Fy,Yy.cspNonce=X.define({combine:e=>e.length?e[0]:``}),Yy.contentAttributes=Hg,Yy.editorAttributes=Vg,Yy.lineWrapping=Yy.contentAttributes.of({class:`cm-lineWrapping`}),Yy.announce=Jp.define();var Xy=4096,Zy={},Qy=class e{constructor(e,t,n,r,i,a){this.from=e,this.to=t,this.dir=n,this.isolates=r,this.fresh=i,this.order=a}static update(t,n){if(n.empty&&!t.some(e=>e.fresh))return t;let r=[],i=t.length?t[t.length-1].dir:Zh.LTR;for(let a=Math.max(0,t.length-10);a=0;i--){let t=r[i],a=typeof t==`function`?t(e):t;a&&ah(a,n)}return n}var eb=Z.mac?`mac`:Z.windows?`win`:Z.linux?`linux`:`key`;function tb(e,t){let n=e.split(/-(?!$)/),r=n[n.length-1];r==`Space`&&(r=` `);let i,a,o,s;for(let e=0;ee.concat(t),[]))),n}var sb=null,cb=4e3;function lb(e,t=eb){let n=Object.create(null),r=Object.create(null),i=(e,t)=>{let n=r[e];if(n==null)r[e]=t;else if(n!=t)throw Error(`Key binding `+e+` is used both as a regular binding and as a multi-stroke prefix`)},a=(e,r,a,o,s)=>{let c=n[e]||(n[e]=Object.create(null)),l=r.split(/ (?!$)/).map(e=>tb(e,t));for(let t=1;t{let r=sb={view:t,prefix:n,scope:e};return setTimeout(()=>{sb==r&&(sb=null)},cb),!0}]})}let u=l.join(` `);i(u,!1);let d=c[u]||(c[u]={preventDefault:!1,stopPropagation:!1,run:(c._any?.run)?.slice()||[]});a&&d.run.push(a),o&&(d.preventDefault=!0),s&&(d.stopPropagation=!0)};for(let r of e){let e=r.scope?r.scope.split(` `):[`editor`];if(r.any)for(let t of e){let e=n[t]||(n[t]=Object.create(null));e._any||={preventDefault:!1,stopPropagation:!1,run:[]};let{any:i}=r;for(let t in e)e[t].run.push(e=>i(e,ub))}let i=r[t]||r.key;if(i)for(let t of e)a(t,i,r.run,r.preventDefault,r.stopPropagation),r.shift&&a(t,`Shift-`+i,r.shift,r.preventDefault,r.stopPropagation)}return n}var ub=null;function db(e,t,n,r){ub=t;let i=Gm(t),a=sp(op(i,0))==i.length&&i!=` `,o=``,s=!1,c=!1,l=!1;sb&&sb.view==n&&sb.scope==r&&(o=sb.prefix+` `,xv.indexOf(t.keyCode)<0&&(c=!0,sb=null));let u=new Set,d=e=>{if(e){for(let t of e.run)if(!u.has(t)&&(u.add(t),t(n)))return e.stopPropagation&&(l=!0),!0;e.preventDefault&&(e.stopPropagation&&(l=!0),c=!0)}return!1},f=e[r],p,m;return f&&(d(f[o+nb(i,t,!a)])?s=!0:a&&(t.altKey||t.metaKey||t.ctrlKey)&&!(Z.windows&&t.ctrlKey&&t.altKey)&&!(Z.mac&&t.altKey&&!(t.ctrlKey||t.metaKey))&&(p=zm[t.keyCode])&&p!=i?(d(f[o+nb(p,t,!0)])||t.shiftKey&&(m=Bm[t.keyCode])!=i&&m!=p&&d(f[o+nb(m,t,!1)]))&&(s=!0):a&&t.shiftKey&&d(f[o+nb(i,t,!0)])&&(s=!0),!s&&d(f._any)&&(s=!0)),c&&(s=!0),s&&l&&t.stopPropagation(),ub=null,s}var fb=!Z.ios,pb=Z.gecko&&Z.gecko_version==153?`#ffffff01`:`transparent`;({...fb?{"& ::selection, &::selection":{backgroundColor:`${pb} !important`}}:{}}),{...fb?{"&::selection, & ::selection":{backgroundColor:`Highlight !important`}}:{}},/x/.unicode;var mb=class extends dh{constructor(e){super(),this.content=e}toDOM(e){let t=document.createElement(`span`);return t.className=`cm-placeholder`,t.style.pointerEvents=`none`,t.appendChild(typeof this.content==`string`?document.createTextNode(this.content):typeof this.content==`function`?this.content(e):this.content.cloneNode(!0)),t.setAttribute(`aria-hidden`,`true`),t}coordsAt(e){let t=e.firstChild?Eh(e.firstChild):[];if(!t.length)return null;let n=window.getComputedStyle(e.parentNode),r=Mh(t[0],n.direction!=`rtl`),i=parseInt(n.lineHeight);return r.bottom-r.top>i*1.5?{left:r.left,right:r.right,top:r.top,bottom:r.top+i}:r}ignoreEvent(){return!1}};function hb(e){let t=zg.fromClass(class{constructor(t){this.view=t,this.placeholder=e?ph.set([ph.widget({widget:new mb(e),side:1}).range(0)]):ph.none}get decorations(){return this.view.state.doc.length?ph.none:this.placeholder}},{decorations:e=>e.decorations});return typeof e==`string`?[t,Yy.contentAttributes.of({"aria-placeholder":e})]:t}var gb=`-10000px`,_b=class{constructor(e,t,n,r){this.facet=t,this.createTooltipView=n,this.removeTooltipView=r,this.input=e.state.facet(t),this.tooltips=this.input.filter(e=>e);let i=null;this.tooltipViews=this.tooltips.map(e=>i=n(e,i))}update(e,t){var n;let r=e.state.facet(this.facet),i=r.filter(e=>e);if(r===this.input){for(let t of this.tooltipViews)t.update&&t.update(e);return!1}let a=[],o=t?[]:null;for(let n=0;nt[n]=e),t.length=o.length),this.input=r,this.tooltips=i,this.tooltipViews=a,!0}};function vb(e){let t=e.dom.ownerDocument.documentElement,n=t.clientWidth,r=getComputedStyle(t);if(!/stable/.test(r.scrollbarGutter||``))return{left:0,right:n};let i=t.getBoundingClientRect(),a=e.win.scrollX;return{left:Math.max(0,i.left+a-parseFloat(r.marginLeft)),right:Math.min(n,i.right+a+parseFloat(r.marginRight))}}function yb(e){let{left:t,right:n}=vb(e);return{top:0,left:t,right:n,bottom:e.dom.ownerDocument.documentElement.clientHeight}}var bb=X.define({combine:e=>({position:Z.ios?`absolute`:e.find(e=>e.position)?.position||`fixed`,parent:e.find(e=>e.parent)?.parent||null,tooltipSpace:e.find(e=>e.tooltipSpace)?.tooltipSpace||yb})}),xb=new WeakMap,Sb=zg.fromClass(class{constructor(e){this.view=e,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let t=e.state.facet(bb);this.position=t.position,this.parent=t.parent,this.classes=e.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver=typeof ResizeObserver==`function`?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new _b(e,Eb,(e,t)=>this.createTooltip(e,t),e=>{this.resizeObserver&&this.resizeObserver.unobserve(e.dom),e.dom.remove()}),this.above=this.manager.tooltips.map(e=>!!e.above),this.intersectionObserver=typeof IntersectionObserver==`function`?new IntersectionObserver(e=>{Date.now()>this.lastTransaction-50&&e.length>0&&e[e.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),e.win.addEventListener(`resize`,this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement(`div`),this.container.style.position=`relative`,this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let e of this.manager.tooltipViews)this.intersectionObserver.observe(e.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(e){e.transactions.length&&(this.lastTransaction=Date.now());let t=this.manager.update(e,this.above);t&&this.observeIntersection();let n=t||e.geometryChanged,r=e.state.facet(bb);if(r.position!=this.position&&!this.madeAbsolute){this.position=r.position;for(let e of this.manager.tooltipViews)e.dom.style.position=this.position;n=!0}if(r.parent!=this.parent){this.parent&&this.container.remove(),this.parent=r.parent,this.createContainer();for(let e of this.manager.tooltipViews)this.container.appendChild(e.dom);n=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);n&&this.maybeMeasure()}createTooltip(e,t){let n=e.create(this.view),r=t?t.dom:null;if(n.dom.classList.add(`cm-tooltip`),e.arrow&&!n.dom.querySelector(`.cm-tooltip > .cm-tooltip-arrow`)){let e=document.createElement(`div`);e.className=`cm-tooltip-arrow`,n.dom.appendChild(e)}return n.dom.style.position=this.position,n.dom.style.top=gb,n.dom.style.left=`0px`,this.container.insertBefore(n.dom,r),n.mount&&n.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(n.dom),n}destroy(){var e,t,n;this.view.win.removeEventListener(`resize`,this.measureSoon);for(let t of this.manager.tooltipViews)t.dom.remove(),(e=t.destroy)==null||e.call(t);this.parent&&this.container.remove(),(t=this.resizeObserver)==null||t.disconnect(),(n=this.intersectionObserver)==null||n.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let e=1,t=1,n=!1,r=0;if(this.position==`fixed`&&this.manager.tooltipViews.length){let{dom:e}=this.manager.tooltipViews[0];if(Z.safari){let t=e.getBoundingClientRect();n=Math.abs(t.top+1e4)>1||Math.abs(t.left)>1}else n=!!e.offsetParent&&e.offsetParent!=this.container.ownerDocument.body}if(n||this.position==`absolute`){if(this.parent){let n=this.parent.getBoundingClientRect();n.width&&n.height&&(e=n.width/this.parent.offsetWidth,t=n.height/this.parent.offsetHeight)}else({scaleX:e,scaleY:t}=this.view.viewState)}else r=vb(this.view).left;let i=this.view.scrollDOM.getBoundingClientRect(),a=Zg(this.view);return{visible:{left:i.left+a.left,top:i.top+a.top,right:i.right-a.right,bottom:i.bottom-a.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((e,t)=>{let n=this.manager.tooltipViews[t];return n.getCoords?n.getCoords(e.pos):this.view.coordsAtPos(e.pos)}),size:this.manager.tooltipViews.map(({dom:e})=>e.getBoundingClientRect()),space:this.view.state.facet(bb).tooltipSpace(this.view),scaleX:e,scaleY:t,makeAbsolute:n,fixedLeft:r}}writeMeasure(e){if(e.makeAbsolute){this.madeAbsolute=!0,this.position=`absolute`;for(let e of this.manager.tooltipViews)e.dom.style.position=`absolute`}let{visible:t,space:n,scaleX:r,scaleY:i}=e,a=[];for(let o=0;o=Math.min(t.bottom,n.bottom)||u.rightMath.min(t.right,n.right)+.1)){l.style.top=gb;continue}let f=s.arrow?c.dom.querySelector(`.cm-tooltip-arrow`):null,p=f?7:0,m=d.right-d.left,h=xb.get(c)??d.bottom-d.top,g=c.offset||Tb,_=this.view.textDirection==Zh.LTR,v=d.width>n.right-n.left?_?n.left:n.right-d.width:_?Math.max(n.left,Math.min(u.left-(f?14:0)+g.x,n.right-m)):Math.min(Math.max(n.left,u.left-m+(f?14:0)-g.x),n.right-m),y=this.above[o];!s.strictSide&&(y?u.top-h-p-g.yn.bottom)&&y==n.bottom-u.bottom>u.top-n.top&&(y=this.above[o]=!y);let b=(y?u.top-n.top:n.bottom-u.bottom)-p;if(bv&&e.topx&&(x=y?e.top-h-2-p:e.bottom+p+2);if(this.position==`absolute`?(l.style.top=(x-e.parent.top)/i+`px`,Cb(l,(v-e.parent.left)/r)):(l.style.top=x/i+`px`,Cb(l,(v-e.fixedLeft)/r)),f){let e=u.left+(_?g.x:-g.x)-(v+14-7);f.style.left=e/r+`px`}c.overlap!==!0&&a.push({left:v,top:x,right:S,bottom:x+h}),l.classList.toggle(`cm-tooltip-above`,y),l.classList.toggle(`cm-tooltip-below`,!y),c.positioned&&c.positioned(e.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let e of this.manager.tooltipViews)e.dom.style.top=gb}},{eventObservers:{scroll(){this.maybeMeasure()}}});function Cb(e,t){let n=parseInt(e.style.left,10);(isNaN(n)||Math.abs(t-n)>1)&&(e.style.left=t+`px`)}var wb=Yy.baseTheme({".cm-tooltip":{zIndex:500,boxSizing:`border-box`},"&light .cm-tooltip":{border:`1px solid #bbb`,backgroundColor:`#f5f5f5`},"&light .cm-tooltip-section:not(:first-child)":{borderTop:`1px solid #bbb`},"&dark .cm-tooltip":{backgroundColor:`#333338`,color:`white`},".cm-tooltip-arrow":{height:`7px`,width:`14px`,position:`absolute`,zIndex:-1,overflow:`hidden`,"&:before, &:after":{content:`''`,position:`absolute`,width:0,height:0,borderLeft:`7px solid transparent`,borderRight:`7px solid transparent`},".cm-tooltip-above &":{bottom:`-7px`,"&:before":{borderTop:`7px solid #bbb`},"&:after":{borderTop:`7px solid #f5f5f5`,bottom:`1px`}},".cm-tooltip-below &":{top:`-7px`,"&:before":{borderBottom:`7px solid #bbb`},"&:after":{borderBottom:`7px solid #f5f5f5`,top:`1px`}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:`#333338`,borderBottomColor:`#333338`},"&:after":{borderTopColor:`transparent`,borderBottomColor:`transparent`}}}),Tb={x:0,y:0},Eb=X.define({enables:[Sb,wb]}),Db=X.define({combine:e=>e.reduce((e,t)=>e.concat(t),[])}),Ob=class e{static create(t){return new e(t)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement(`div`),this.dom.classList.add(`cm-tooltip-hover`),this.manager=new _b(e,Db,(e,t)=>this.createHostedView(e,t),e=>e.dom.remove())}createHostedView(e,t){let n=e.create(this.view);return n.dom.classList.add(`cm-tooltip-section`),this.dom.insertBefore(n.dom,t?t.dom.nextSibling:this.dom.firstChild),this.mounted&&n.mount&&n.mount(this.view),n}mount(e){for(let t of this.manager.tooltipViews)t.mount&&t.mount(e);this.mounted=!0}positioned(e){for(let t of this.manager.tooltipViews)t.positioned&&t.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let t of this.manager.tooltipViews)(e=t.destroy)==null||e.call(t)}passProp(e){let t;for(let n of this.manager.tooltipViews){let r=n[e];if(r!==void 0){if(t===void 0)t=r;else if(t!==r)return}}return t}get offset(){return this.passProp(`offset`)}get getCoords(){return this.passProp(`getCoords`)}get overlap(){return this.passProp(`overlap`)}get resize(){return this.passProp(`resize`)}},kb=Eb.compute([Db],e=>{let t=e.facet(Db);return t.length===0?null:{pos:Math.min(...t.map(e=>e.pos)),end:Math.max(...t.map(e=>e.end??e.pos)),create:Ob.create,above:t[0].above,arrow:t.some(e=>e.arrow)}}),Ab=X.define(),jb=class{constructor(e,t,n,r,i,a){this.view=e,this.source=t,this.field=n,this.locked=r,this.setHover=i,this.hoverTime=a,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener(`mouseleave`,this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener(`mousemove`,this.mousemove=this.mousemove.bind(this))}update(e){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let e=Date.now()-this.lastMove.time;en.bottom||t.xn.right+e.defaultCharacterWidth)return;let a=e.bidiSpans(e.state.doc.lineAt(r)).find(e=>e.from<=r&&e.to>=r),o=a&&a.dir==Zh.RTL?-1:1;i=t.x{if(t&&(!Array.isArray(t)||t.length)){let n=Array.isArray(t)?t:[t];r&&this.locked.set(n,r),e.dispatch({effects:this.setHover.of(n)})}};if(i&&`then`in i){let n=this.pending={pos:t};i.then(e=>{this.pending==n&&(this.pending=null,a(e))},t=>Fg(e.state,t,`hover tooltip`))}else a(i)}get tooltip(){let e=this.view.plugin(Sb),t=e?e.manager.tooltips.findIndex(e=>e.create==Ob.create):-1;return t>-1?e.manager.tooltipViews[t]:null}mousemove(e){this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:t,tooltip:n}=this;if(t.length&&!this.locked.has(t)&&n&&!Nb(n.dom,e)||this.pending){let{pos:n}=t[0]||this.pending,r=t[0]?.end??n;(n==r?this.view.posAtCoords(this.lastMove)!=n:!Pb(this.view,n,r,e.clientX,e.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:t}=this;if(t.length&&!this.locked.has(t)){let{tooltip:t}=this;t&&t.dom.contains(e.relatedTarget)?this.watchTooltipLeave(t.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let t=n=>{e.removeEventListener(`mouseleave`,t);let{active:r}=this;r.length&&!this.locked.has(r)&&!this.view.dom.contains(n.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener(`mouseleave`,t)}destroy(){clearTimeout(this.hoverTimeout),clearTimeout(this.restartTimeout),this.view.dom.removeEventListener(`mouseleave`,this.mouseleave),this.view.dom.removeEventListener(`mousemove`,this.mousemove)}},Mb=4;function Nb(e,t){let{left:n,right:r,top:i,bottom:a}=e.getBoundingClientRect(),o;if(o=e.querySelector(`.cm-tooltip-arrow`)){let e=o.getBoundingClientRect();i=Math.min(e.top,i),a=Math.max(e.bottom,a)}return t.clientX>=n-Mb&&t.clientX<=r+Mb&&t.clientY>=i-Mb&&t.clientY<=a+Mb}function Pb(e,t,n,r,i,a){let o=e.scrollDOM.getBoundingClientRect(),s=e.documentTop+e.documentPadding.top+e.contentHeight;if(o.left>r||o.righti||Math.min(o.bottom,s)=t&&c<=n}function Fb(e,t={}){let n=Jp.define(),r=new WeakMap,i=Dp.define({create(){return[]},update(e,a){let o=r.get(e);if(e.length&&(t.hideOnChange&&(a.docChanged||a.selection)||o&&o(a)?e=[]:t.hideOn&&(e=e.filter(e=>!t.hideOn(a,e)))),a.docChanged&&e.length){let t=[];for(let n of e){let e=a.changes.mapPos(n.pos,-1,lp.TrackDel);if(e!=null){let r=Object.assign(Object.create(null),n);r.pos=e,r.end!=null&&(r.end=a.changes.mapPos(r.end)),t.push(r)}}e=t}for(let t of a.effects)t.is(n)&&(e=t.value,o=void 0),(t.is(Ib)&&!t.value||t.value==i)&&(e=[]);return e.length&&o&&r.set(e,o),e},provide:e=>Db.from(e)}),a=zg.define(a=>new jb(a,e,i,r,n,t.hoverTime||300));return{active:i,extension:[i,a,Ab.of(a),kb]}}var Ib=Jp.define(),Lb=X.define({combine(e){let t,n;for(let r of e)t||=r.topContainer,n||=r.bottomContainer;return{topContainer:t,bottomContainer:n}}}),Rb=zg.fromClass(class{constructor(e){this.input=e.state.facet(Vb),this.specs=this.input.filter(e=>e),this.panels=this.specs.map(t=>t(e));let t=e.state.facet(Lb);this.top=new zb(e,!0,t.topContainer),this.bottom=new zb(e,!1,t.bottomContainer),this.top.sync(this.panels.filter(e=>e.top)),this.bottom.sync(this.panels.filter(e=>!e.top));for(let e of this.panels)e.dom.classList.add(`cm-panel`),e.mount&&e.mount()}update(e){let t=e.state.facet(Lb);this.top.container!=t.topContainer&&(this.top.sync([]),this.top=new zb(e.view,!0,t.topContainer)),this.bottom.container!=t.bottomContainer&&(this.bottom.sync([]),this.bottom=new zb(e.view,!1,t.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=e.state.facet(Vb);if(n!=this.input){let t=n.filter(e=>e),r=[],i=[],a=[],o=[];for(let n of t){let t=this.specs.indexOf(n),s;t<0?(s=n(e.view),o.push(s)):(s=this.panels[t],s.update&&s.update(e)),r.push(s),(s.top?i:a).push(s)}this.specs=t,this.panels=r,this.top.sync(i),this.bottom.sync(a);for(let e of o)e.dom.classList.add(`cm-panel`),e.mount&&e.mount()}else for(let t of this.panels)t.update&&t.update(e)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:e=>Yy.scrollMargins.of(t=>{let n=t.plugin(e);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}})}),zb=class{constructor(e,t,n){this.view=e,this.top=t,this.container=n,this.dom=void 0,this.classes=``,this.panels=[],this.syncClasses()}sync(e){for(let t of this.panels)t.destroy&&e.indexOf(t)<0&&t.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&=(this.dom.remove(),void 0);return}if(!this.dom){this.dom=document.createElement(`div`),this.dom.className=this.top?`cm-panels cm-panels-top`:`cm-panels cm-panels-bottom`;let e=this.container||this.view.dom;e.insertBefore(this.dom,this.top?e.firstChild:null)}let e=this.dom.firstChild;for(let t of this.panels)if(t.dom.parentNode==this.dom){for(;e!=t.dom;)e=Bb(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=Bb(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(this.container&&this.classes!=this.view.themeClasses){for(let e of this.classes.split(` `))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(` `))e&&this.container.classList.add(e)}}};function Bb(e){let t=e.nextSibling;return e.remove(),t}var Vb=X.define({enables:Rb}),Hb=class extends dm{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}};Hb.prototype.elementClass=``,Hb.prototype.toDOM=void 0,Hb.prototype.mapMode=lp.TrackBefore,Hb.prototype.startSide=Hb.prototype.endSide=-1,Hb.prototype.point=!0;var Ub=1024,Wb=0,Gb=class{constructor(e,t){this.from=e,this.to=t}},Kb=class{constructor(e={}){this.id=Wb++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw Error(`This node type doesn't define a deserialize function`)}),this.combine=e.combine||null}add(e){if(this.perNode)throw RangeError(`Can't add per-node props to node types`);return typeof e!=`function`&&(e=Yb.match(e)),t=>{let n=e(t);return n===void 0?null:[this,n]}}};Kb.closedBy=new Kb({deserialize:e=>e.split(` `)}),Kb.openedBy=new Kb({deserialize:e=>e.split(` `)}),Kb.group=new Kb({deserialize:e=>e.split(` `)}),Kb.isolate=new Kb({deserialize:e=>{if(e&&e!=`rtl`&&e!=`ltr`&&e!=`auto`)throw RangeError(`Invalid value for isolate: `+e);return e||`auto`}}),Kb.contextHash=new Kb({perNode:!0}),Kb.lookAhead=new Kb({perNode:!0}),Kb.mounted=new Kb({perNode:!0});var qb=class{constructor(e,t,n,r=!1){this.tree=e,this.overlay=t,this.parser=n,this.bracketed=r}static get(e){return e&&e.props&&e.props[Kb.mounted.id]}},Jb=Object.create(null),Yb=class e{constructor(e,t,n,r=0){this.name=e,this.props=t,this.id=n,this.flags=r}static define(t){let n=t.props&&t.props.length?Object.create(null):Jb,r=+!!t.top|(t.skipped?2:0)|(t.error?4:0)|(t.name==null?8:0),i=new e(t.name||``,n,t.id,r);if(t.props){for(let e of t.props)if(Array.isArray(e)||(e=e(i)),e){if(e[0].perNode)throw RangeError(`Can't store a per-node prop on a node type`);n[e[0].id]=e[1]}}return i}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e==`string`){if(this.name==e)return!0;let t=this.prop(Kb.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let n in e)for(let r of n.split(` `))t[r]=e[n];return e=>{for(let n=e.prop(Kb.group),r=-1;r<(n?n.length:0);r++){let i=t[r<0?e.name:n[r]];if(i)return i}}}};Yb.none=new Yb(``,Object.create(null),0,8);var Xb=class e{constructor(e){this.types=e;for(let t=0;t0;for(let e=this.cursor(a|$b.IncludeAnonymous);;){let a=!1;if(e.from<=i&&e.to>=r&&(!o&&e.type.isAnonymous||t(e)!==!1)){if(e.firstChild())continue;a=!0}for(;a&&n&&(o||!e.type.isAnonymous)&&n(e),!e.nextSibling();){if(!e.parent())return;a=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(t={}){return this.children.length<=8?this:yx(Yb.none,this.children,this.positions,0,this.children.length,0,this.length,(t,n,r)=>new e(this.type,t,n,r,this.propValues),t.makeTree||((t,n,r)=>new e(Yb.none,t,n,r)))}static build(e){return gx(e)}};ex.empty=new ex(Yb.none,[],[],0);var tx=class e{constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new e(this.buffer,this.index)}},nx=class e{constructor(e,t,n){this.buffer=e,this.length=t,this.set=n}get type(){return Yb.none}toString(){let e=[];for(let t=0;t0));s=a[s+3]);return o}slice(t,n,r){let i=this.buffer,a=new Uint16Array(n-t),o=0;for(let e=t,s=0;e=t&&nt;case 1:return n<=t&&r>t;case 2:return r>t;case 4:return!0}}function ix(e,t,n,r){for(;e.from==e.to||(n<1?e.from>=t:e.from>t)||(n>-1?e.to<=t:e.to0?s.length:-1;t!=l;t+=n){let l=s[t],u=c[t]+o.from,d;if(a&$b.EnterBracketed&&l instanceof ex&&(d=qb.get(l))&&!d.overlay&&d.bracketed&&r>=u&&r<=u+l.length||rx(i,r,u,u+l.length)){if(l instanceof nx){if(a&$b.ExcludeBuffers)continue;let e=l.findChild(0,l.buffer.length,n,r-u,i);if(e>-1)return new ux(new lx(o,l,t,u),null,e)}else if(a&$b.IncludeAnonymous||!l.type.isAnonymous||hx(l)){let s;if(!(a&$b.IgnoreMounts)&&(s=qb.get(l))&&!s.overlay)return new e(s.tree,u,t,o);let c=new e(l,u,t,o);return a&$b.IncludeAnonymous||!c.type.isAnonymous?c:c.nextChild(n<0?l.children.length-1:0,n,r,i,a)}}}if(a&$b.IncludeAnonymous||!o.type.isAnonymous||(t=o.index>=0?o.index+n:n<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}prop(e){return this._tree.prop(e)}enter(t,n,r=0){let i;if(!(r&$b.IgnoreOverlays)&&(i=qb.get(this._tree))&&i.overlay){let a=t-this.from,o=r&$b.EnterBracketed&&i.bracketed;for(let{from:t,to:r}of i.overlay)if((n>0||o?t<=a:t=a:r>a))return new e(i.tree,i.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,t,n,r)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}};function sx(e,t,n,r){let i=e.cursor(),a=[];if(!i.firstChild())return a;if(n!=null){for(let e=!1;!e;)if(e=i.type.is(n),!i.nextSibling())return a}for(;;){if(r!=null&&i.type.is(r))return a;if(i.type.is(t)&&a.push(i.node),!i.nextSibling())return r==null?a:[]}}function cx(e,t,n=t.length-1){for(let r=e;n>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(t[n]&&t[n]!=r.name)return!1;n--}}return!0}var lx=class{constructor(e,t,n,r){this.parent=e,this.buffer=t,this.index=n,this.start=r}},ux=class e extends ax{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,n){super(),this.context=e,this._parent=t,this.index=n,this.type=e.buffer.set.types[e.buffer.buffer[n]]}child(t,n,r){let{buffer:i}=this.context,a=i.findChild(this.index+4,i.buffer[this.index+3],t,n-this.context.start,r);return a<0?null:new e(this.context,this,a)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}prop(e){return this.type.prop(e)}enter(t,n,r=0){if(r&$b.ExcludeBuffers)return null;let{buffer:i}=this.context,a=i.findChild(this.index+4,i.buffer[this.index+3],n>0?1:-1,t-this.context.start,n);return a<0?null:new e(this.context,this,a)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:t}=this.context,n=t.buffer[this.index+3];return n<(this._parent?t.buffer[this._parent.index+3]:t.buffer.length)?new e(this.context,this._parent,n):this.externalSibling(1)}get prevSibling(){let{buffer:t}=this.context,n=this._parent?this._parent.index+4:0;return this.index==n?this.externalSibling(-1):new e(this.context,this._parent,t.findChild(n,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:n}=this.context,r=this.index+4,i=n.buffer[this.index+3];if(i>r){let a=n.buffer[this.index+1];e.push(n.slice(r,i,a)),t.push(0)}return new ex(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}};function dx(e){if(!e.length)return null;let t=0,n=e[0];for(let r=1;rn.from||i.to=t){let o=new ox(a.tree,a.overlay[0].from+e.from,-1,e);(i||=[r]).push(ix(o,t,n,!1))}}return i?dx(i):r}var mx=class{get name(){return this.type.name}constructor(e,t=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=t&~$b.EnterBracketed,e instanceof ox)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let t=e._parent;t;t=t._parent)this.stack.unshift(t.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,t){this.index=e;let{start:n,buffer:r}=this.buffer;return this.type=t||r.set.types[r.buffer[e]],this.from=n+r.buffer[e+1],this.to=n+r.buffer[e+2],!0}yield(e){return e?e instanceof ox?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,n){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,n,this.mode));let{buffer:r}=this.buffer,i=r.findChild(this.index+4,r.buffer[this.index+3],e,t-this.buffer.start,n);return i<0?!1:(this.stack.push(this.index),this.yieldBuf(i))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,n=this.mode){return this.buffer?n&$b.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&$b.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&$b.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:t}=this.buffer,n=this.stack.length-1;if(e<0){let e=n<0?0:this.stack[n]+4;if(this.index!=e)return this.yieldBuf(t.findChild(e,this.index,-1,0,4))}else{let e=t.buffer[this.index+3];if(e<(n<0?t.buffer.length:t.buffer[this.stack[n]+3]))return this.yieldBuf(e)}return n<0&&this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode))}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,n,{buffer:r}=this;if(r){if(e>0){if(this.index-1)for(let r=t+e,i=e<0?-1:n._tree.children.length;r!=i;r+=e){let e=n._tree.children[r];if(this.mode&$b.IncludeAnonymous||e instanceof nx||!e.type.isAnonymous||hx(e))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to=0;){for(let a=e;a;a=a._parent)if(a.index==r){if(r==this.index)return a;t=a,n=i+1;break scan}r=this.stack[--i]}for(let e=n;e=0;i--){if(i<0)return cx(this._tree,e,r);let a=n[t.buffer[this.stack[i]]];if(!a.isAnonymous){if(e[r]&&e[r]!=a.name)return!1;r--}}return!0}};function hx(e){return e.children.some(e=>e instanceof nx||!e.type.isAnonymous||hx(e))}function gx(e){let{buffer:t,nodeSet:n,maxBufferLength:r=Ub,reused:i=[],minRepeatType:a=n.types.length}=e,o=Array.isArray(t)?new tx(t,t.length):t,s=n.types,c=0,l=0;function u(e,t,_,v,y,b){let{id:x,start:S,end:C,size:w}=o,T=l,E=c;if(w<0){if(o.next(),w==-1){let t=i[x];_.push(t),v.push(S-e);return}if(w==-3){c=x;return}if(w==-4){l=x;return}throw RangeError(`Unrecognized record size: ${w}`)}let D=s[x],O,k,A=S-e;if(C-S<=r&&(k=h(o.pos-t,y))){let t=new Uint16Array(k.size-k.skip),r=o.pos-k.size,i=t.length;for(;o.pos>r;)i=g(k.start,t,i);O=new nx(t,C-k.start,n),A=k.start-e}else{let e=o.pos-w;o.next();let t=[],s=[],c=x>=a?x:-1,h=0,g=C,_=T;for(;o.pos>e;)c>=0&&o.id==c&&o.size>=0?(o.end<=g-r&&(p(t,s,S,h,o.end,g,c,_,E),h=t.length,g=o.end,_=l),o.next()):b>2500?d(S,e,t,s):(c>=0&&o.size==-1&&i[o.id].type==n.types[c]&&(h=0&&h>0&&h-1&&h>0){let e=f(D,E);O=yx(D,t,s,0,t.length,0,C-S,e,e)}else O=m(D,t,s,C-S,T-C,E)}_.push(O),v.push(A)}function d(e,t,i,a){let s=[],c=0,l=-1;for(;o.pos>t;){let{id:e,start:t,end:n,size:i}=o;if(i>4)o.next();else if(l>-1&&t=0;e-=3)t[n++]=s[e],t[n++]=s[e+1]-r,t[n++]=s[e+2]-r,t[n++]=n;i.push(new nx(t,s[2]-r,n)),a.push(r-e)}}function f(e,t){return(n,r,i)=>{let a=0,o=n.length-1,s,c;if(o>=0&&(s=n[o])instanceof ex){if(!o&&s.type==e&&s.length==i)return s;(c=s.prop(Kb.lookAhead))&&(a=r[o]+s.length+c-i)}return m(e,n,r,i,a,t)}}function p(e,t,r,i,a,o,s,c,l){let u=[],d=[];for(;e.length>i;)u.push(e.pop()),d.push(t.pop()+r-a);e.push(m(n.types[s],u,d,o-a,c-o,l)),t.push(a-r)}function m(e,t,n,r,i,a,o){if(a){let e=[Kb.contextHash,a];o=o?[e].concat(o):[e]}if(i>25){let e=[Kb.lookAhead,i];o=o?[e].concat(o):[e]}return new ex(e,t,n,r,o)}function h(e,t){let n=o.fork(),i=0,s=0,c=0,l=n.end-r,u={size:0,start:0,skip:0};scan:for(let r=n.pos-e;n.pos>r;){let e=n.size;if(n.id==t&&e>=0){u.size=i,u.start=s,u.skip=c,c+=4,i+=4,n.next();continue}let o=n.pos-e;if(e<0||o=a?4:0,f=n.start;for(n.next();n.pos>o;){if(n.size<0){if(n.size==-3||n.size==-4)d+=4;else break scan}else n.id>=a&&(d+=4);n.next()}s=f,i+=e,c+=d}return(t<0||i==e)&&(u.size=i,u.start=s,u.skip=c),u.size>4?u:void 0}function g(e,t,n){let{id:r,start:i,end:s,size:u}=o;if(o.next(),u>=0&&r4){let r=o.pos-(u-4);for(;o.pos>r;)n=g(e,t,n)}t[--n]=a,t[--n]=s-e,t[--n]=i-e,t[--n]=r}else u==-3?c=r:u==-4&&(l=r);return n}let _=[],v=[];for(;o.pos>0;)u(e.start||0,e.bufferStart||0,_,v,-1,0);let y=e.length??(_.length?v[0]+_[0].length:0);return new ex(s[e.topID],_.reverse(),v.reverse(),y)}var _x=new WeakMap;function vx(e,t){if(!e.isAnonymous||t instanceof nx||t.type!=e)return 1;let n=_x.get(t);if(n==null){n=1;for(let r of t.children){if(r.type!=e||!(r instanceof ex)){n=1;break}n+=vx(e,r)}_x.set(t,n)}return n}function yx(e,t,n,r,i,a,o,s,c){let l=0;for(let n=r;n=u)break;m+=n}if(s==r+1){if(m>u){let e=t[r];p(e.children,e.positions,0,e.children.length,n[r]+o);continue}d.push(t[r])}else{let i=n[s-1]+t[s-1].length-l;d.push(yx(e,t,n,r,s,l,i,null,c))}f.push(l+o-a)}}return p(t,n,r,i,0),(s||c)(d,f,o)}var bx=class e{constructor(e,t,n,r,i=!1,a=!1){this.from=e,this.to=t,this.tree=n,this.offset=r,this.open=!!i|(a?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(t,n=[],r=!1){let i=[new e(0,t.length,t,0,!1,r)];for(let e of n)e.to>t.length&&i.push(e);return i}static applyChanges(t,n,r=128){if(!n.length)return t;let i=[],a=1,o=t.length?t[0]:null;for(let s=0,c=0,l=0;;s++){let u=s=r)for(;o&&o.from=n.from||d<=n.to||l){let t=Math.max(n.from,c)-l,r=Math.min(n.to,d)-l;n=t>=r?null:new e(t,r,n.tree,n.offset+l,s>0,!!u)}if(n&&i.push(n),o.to>d)break;o=anew Gb(e.from,e.to)):[new Gb(0,0)]:[new Gb(0,e.length)],this.createParse(e,t||[],n)}parse(e,t,n){let r=this.startParse(e,t,n);for(;;){let e=r.advance();if(e)return e}}},Sx=class{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}};new Kb({perNode:!0});var Cx=0,wx=class e{constructor(e,t,n,r){this.name=e,this.set=t,this.base=n,this.modified=r,this.id=Cx++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(t,n){let r=typeof t==`string`?t:`?`;if(t instanceof e&&(n=t),n?.base)throw Error(`Can not derive from a modified tag`);let i=new e(r,[],null,[]);if(i.set.push(i),n)for(let e of n.set)i.set.push(e);return i}static defineModifier(e){let t=new Ex(e);return e=>e.modified.indexOf(t)>-1?e:Ex.get(e.base||e,e.modified.concat(t).sort((e,t)=>e.id-t.id))}},Tx=0,Ex=class e{constructor(e){this.name=e,this.instances=[],this.id=Tx++}static get(t,n){if(!n.length)return t;let r=n[0].instances.find(e=>e.base==t&&Dx(n,e.modified));if(r)return r;let i=[],a=new wx(t.name,i,t,n);for(let e of n)e.instances.push(a);let o=Ox(n);for(let n of t.set)if(!n.modified.length)for(let t of o)i.push(e.get(n,t));return a}};function Dx(e,t){return e.length==t.length&&e.every((e,n)=>e==t[n])}function Ox(e){let t=[[]];for(let n=0;nt.length-e.length)}function kx(e){let t=Object.create(null);for(let n in e){let r=e[n];Array.isArray(r)||(r=[r]);for(let e of n.split(` `))if(e){let n=[],i=2,a=e;for(let t=0;;){if(a==`...`&&t>0&&t+3==e.length){i=1;break}let r=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(a);if(!r)throw RangeError(`Invalid path: `+e);if(n.push(r[0]==`*`?``:r[0][0]==`"`?JSON.parse(r[0]):r[0]),t+=r[0].length,t==e.length)break;let o=e[t++];if(t==e.length&&o==`!`){i=0;break}if(o!=`/`)throw RangeError(`Invalid path: `+e);a=e.slice(t)}let o=n.length-1,s=n[o];if(!s)throw RangeError(`Invalid path: `+e);t[s]=new jx(r,i,o>0?n.slice(0,o):null).sort(t[s])}}return Ax.add(t)}var Ax=new Kb({combine(e,t){let n,r,i;for(;e||t;){if(!e||t&&e.depth<=t.depth?(i=t,t=t.next):(i=e,e=e.next),n&&n.mode==i.mode&&!i.context&&!n.context)continue;let a=new jx(i.tags,i.mode,i.context);n?n.next=a:r=a,n=a}return r}}),jx=class{constructor(e,t,n,r){this.tags=e,this.mode=t,this.context=n,this.next=r}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth{let t=i;for(let r of e)for(let e of r.set){let r=n[e.id];if(r){t=t?t+` `+r:r;break}}return t},scope:r}}function Nx(e,t){let n=null;for(let r of e){let e=r.style(t);e&&(n=n?n+` `+e:e)}return n}function Px(e,t,n,r=0,i=e.length){let a=new Fx(r,Array.isArray(t)?t:[t],n);a.highlightRange(e.cursor(),r,i,``,a.highlighters),a.flush(i)}var Fx=class{constructor(e,t,n){this.at=e,this.highlighters=t,this.span=n,this.class=``}startSpan(e,t){t!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=t)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,t,n,r,i){let{type:a,from:o,to:s}=e;if(o>=n||s<=t)return;a.isTop&&(i=this.highlighters.filter(e=>!e.scope||e.scope(a)));let c=r,l=Ix(e)||jx.empty,u=Nx(i,l.tags);if(u&&(c&&(c+=` `),c+=u,l.mode==1&&(r+=(r?` `:``)+u)),this.startSpan(Math.max(t,o),c),l.opaque)return;let d=e.tree&&e.tree.prop(Kb.mounted);if(d&&d.overlay){let a=e.node.enter(d.overlay[0].from+o,1),l=this.highlighters.filter(e=>!e.scope||e.scope(d.tree.type)),u=e.firstChild();for(let f=0,p=o;;f++){let m=f=h||!e.nextSibling())););if(!m||h>n)break;p=m.to+o,p>t&&(this.highlightRange(a.cursor(),Math.max(t,m.from+o),Math.min(n,p),``,l),this.startSpan(Math.min(n,p),c))}u&&e.parent()}else if(e.firstChild()){d&&(r=``);do if(!(e.to<=t)){if(e.from>=n)break;this.highlightRange(e,t,n,r,i),this.startSpan(Math.min(n,e.to),c)}while(e.nextSibling());e.parent()}}};function Ix(e){let t=e.type.prop(Ax);for(;t&&t.context&&!e.matchContext(t.context);)t=t.next;return t||null}var Q=wx.define,Lx=Q(),Rx=Q(),zx=Q(Rx),Bx=Q(Rx),Vx=Q(),Hx=Q(Vx),Ux=Q(Vx),Wx=Q(),Gx=Q(Wx),Kx=Q(),qx=Q(),Jx=Q(),Yx=Q(Jx),Xx=Q(),$={comment:Lx,lineComment:Q(Lx),blockComment:Q(Lx),docComment:Q(Lx),name:Rx,variableName:Q(Rx),typeName:zx,tagName:Q(zx),propertyName:Bx,attributeName:Q(Bx),className:Q(Rx),labelName:Q(Rx),namespace:Q(Rx),macroName:Q(Rx),literal:Vx,string:Hx,docString:Q(Hx),character:Q(Hx),attributeValue:Q(Hx),number:Ux,integer:Q(Ux),float:Q(Ux),bool:Q(Vx),regexp:Q(Vx),escape:Q(Vx),color:Q(Vx),url:Q(Vx),keyword:Kx,self:Q(Kx),null:Q(Kx),atom:Q(Kx),unit:Q(Kx),modifier:Q(Kx),operatorKeyword:Q(Kx),controlKeyword:Q(Kx),definitionKeyword:Q(Kx),moduleKeyword:Q(Kx),operator:qx,derefOperator:Q(qx),arithmeticOperator:Q(qx),logicOperator:Q(qx),bitwiseOperator:Q(qx),compareOperator:Q(qx),updateOperator:Q(qx),definitionOperator:Q(qx),typeOperator:Q(qx),controlOperator:Q(qx),punctuation:Jx,separator:Q(Jx),bracket:Yx,angleBracket:Q(Yx),squareBracket:Q(Yx),paren:Q(Yx),brace:Q(Yx),content:Wx,heading:Gx,heading1:Q(Gx),heading2:Q(Gx),heading3:Q(Gx),heading4:Q(Gx),heading5:Q(Gx),heading6:Q(Gx),contentSeparator:Q(Wx),list:Q(Wx),quote:Q(Wx),emphasis:Q(Wx),strong:Q(Wx),link:Q(Wx),monospace:Q(Wx),strikethrough:Q(Wx),inserted:Q(),deleted:Q(),changed:Q(),invalid:Q(),meta:Xx,documentMeta:Q(Xx),annotation:Q(Xx),processingInstruction:Q(Xx),definition:wx.defineModifier(`definition`),constant:wx.defineModifier(`constant`),function:wx.defineModifier(`function`),standard:wx.defineModifier(`standard`),local:wx.defineModifier(`local`),special:wx.defineModifier(`special`)};for(let e in $){let t=$[e];t instanceof wx&&(t.name=e)}Mx([{tag:$.link,class:`tok-link`},{tag:$.heading,class:`tok-heading`},{tag:$.emphasis,class:`tok-emphasis`},{tag:$.strong,class:`tok-strong`},{tag:$.keyword,class:`tok-keyword`},{tag:$.atom,class:`tok-atom`},{tag:$.bool,class:`tok-bool`},{tag:$.url,class:`tok-url`},{tag:$.labelName,class:`tok-labelName`},{tag:$.inserted,class:`tok-inserted`},{tag:$.deleted,class:`tok-deleted`},{tag:$.literal,class:`tok-literal`},{tag:$.string,class:`tok-string`},{tag:$.number,class:`tok-number`},{tag:[$.regexp,$.escape,$.special($.string)],class:`tok-string2`},{tag:$.variableName,class:`tok-variableName`},{tag:$.local($.variableName),class:`tok-variableName tok-local`},{tag:$.definition($.variableName),class:`tok-variableName tok-definition`},{tag:$.special($.variableName),class:`tok-variableName2`},{tag:$.definition($.propertyName),class:`tok-propertyName tok-definition`},{tag:$.typeName,class:`tok-typeName`},{tag:$.namespace,class:`tok-namespace`},{tag:$.className,class:`tok-className`},{tag:$.macroName,class:`tok-macroName`},{tag:$.propertyName,class:`tok-propertyName`},{tag:$.operator,class:`tok-operator`},{tag:$.comment,class:`tok-comment`},{tag:$.meta,class:`tok-meta`},{tag:$.invalid,class:`tok-invalid`},{tag:$.punctuation,class:`tok-punctuation`}]);var Zx=new Kb;function Qx(e){return X.define({combine:e?t=>t.concat(e):void 0})}var $x=new Kb,eS=class{constructor(e,t,n=[],r=``){this.data=e,this.name=r,lm.prototype.hasOwnProperty(`tree`)||Object.defineProperty(lm.prototype,"tree",{get(){return rS(this)}}),this.parser=t,this.extension=[fS.of(this),lm.languageData.of((e,t,n)=>{let r=tS(e,t,n),i=r.type.prop(Zx);if(!i)return[];let a=e.facet(i),o=r.type.prop($x);if(o){let i=r.resolve(t-r.from,n);for(let t of o)if(t.test(i,e)){let n=e.facet(t.facet);return t.type==`replace`?n:n.concat(a)}}return a})].concat(n)}isActiveAt(e,t,n=-1){return tS(e,t,n).type.prop(Zx)==this.data}findRegions(e){let t=e.facet(fS);if(t?.data==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let n=[],r=(e,t)=>{if(e.prop(Zx)==this.data){n.push({from:t,to:t+e.length});return}let i=e.prop(Kb.mounted);if(i){if(i.tree.prop(Zx)==this.data){if(i.overlay)for(let e of i.overlay)n.push({from:e.from+t,to:e.to+t});else n.push({from:t,to:t+e.length});return}if(i.overlay){let e=n.length;if(r(i.tree,i.overlay[0].from+t),n.length>e)return}}for(let n=0;ne.isTop?n:void 0)]}),t.name)}configure(t,n){return new e(this.data,this.parser.configure(t),n||this.name)}get allowsNesting(){return this.parser.hasWrappers()}};function rS(e){let t=e.field(eS.state,!1);return t?t.tree:ex.empty}var iS=class{constructor(e){this.doc=e,this.cursorPos=0,this.string=``,this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,t){let n=this.cursorPos-this.string.length;return e=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-n,t-n)}},aS=null,oS=class e{constructor(e,t,n=[],r,i,a,o,s){this.parser=e,this.state=t,this.fragments=n,this.tree=r,this.treeLen=i,this.viewport=a,this.skipped=o,this.scheduleOn=s,this.parse=null,this.tempSkipped=[]}static create(t,n,r){return new e(t,n,[],ex.empty,0,r,[],null)}startParse(){return this.parser.startParse(new iS(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=ex.empty&&this.isDone(t??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{if(typeof e==`number`){let t=Date.now()+e;e=()=>Date.now()>t}for(this.parse||=this.startParse(),t!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&t=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(t=this.parse.advance()););}),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped(bx.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=aS;aS=this;try{return e()}finally{aS=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=sS(e,t.from,t.to);return e}changes(t,n){let{fragments:r,tree:i,treeLen:a,viewport:o,skipped:s}=this;if(this.takeTree(),!t.empty){let e=[];if(t.iterChangedRanges((t,n,r,i)=>e.push({fromA:t,toA:n,fromB:r,toB:i})),r=bx.applyChanges(r,e),i=ex.empty,a=0,o={from:t.mapPos(o.from,-1),to:t.mapPos(o.to,1)},this.skipped.length){s=[];for(let e of this.skipped){let n=t.mapPos(e.from,1),r=t.mapPos(e.to,-1);ne.from&&(this.fragments=sS(this.fragments,n,r),this.skipped.splice(t--,1))}return this.skipped.length>=t?!1:(this.reset(),!0)}reset(){this.parse&&=(this.takeTree(),null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends xx{createParse(t,n,r){let i=r[0].from,a=r[r.length-1].to;return{parsedPos:i,advance(){let t=aS;if(t){for(let e of r)t.tempSkipped.push(e);e&&(t.scheduleOn=t.scheduleOn?Promise.all([t.scheduleOn,e]):e)}return this.parsedPos=a,new ex(Yb.none,[],[],a-i)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&t[0].from==0&&t[0].to>=e}static get(){return aS}};function sS(e,t,n){return bx.applyChanges(e,[{fromA:t,toA:n,fromB:t,toB:n}])}var cS=class e{constructor(e){this.context=e,this.tree=e.tree}apply(t){if(!t.docChanged&&this.tree==this.context.tree)return this;let n=this.context.changes(t.changes,t.state),r=this.context.treeLen==t.startState.doc.length?void 0:Math.max(t.changes.mapPos(this.context.treeLen),n.viewport.to);return n.work(20,r)||n.takeTree(),new e(n)}static init(t){let n=Math.min(3e3,t.doc.length),r=oS.create(t.facet(fS).parser,t,{from:0,to:n});return r.work(20,n)||r.takeTree(),new e(r)}};eS.state=Dp.define({create:cS.init,update(e,t){for(let e of t.effects)if(e.is(eS.setState))return e.value;return t.startState.facet(fS)==t.state.facet(fS)?e.apply(t):cS.init(t.state)}});var lS=e=>{let t=setTimeout(()=>e(),500);return()=>clearTimeout(t)};typeof requestIdleCallback<`u`&&(lS=e=>{let t=-1,n=setTimeout(()=>{t=requestIdleCallback(e,{timeout:400})},100);return()=>t<0?clearTimeout(n):cancelIdleCallback(t)});var uS=typeof navigator<`u`&&navigator.scheduling?.isInputPending?()=>navigator.scheduling.isInputPending():null,dS=zg.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let t=this.view.state.field(eS.state).context;(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(t)}scheduleWork(){if(this.working)return;let{state:e}=this.view,t=e.field(eS.state);t.tree==t.context.tree&&t.context.isDone(e.doc.length)||(this.working=lS(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEndr+1e3,s=i.context.work(()=>uS&&uS()||Date.now()>a,r+(o?0:1e5));this.chunkBudget-=Date.now()-t,(s||this.chunkBudget<=0)&&(i.context.takeTree(),this.view.dispatch({effects:eS.setState.of(new cS(i.context))})),this.chunkBudget>0&&(!s||o)&&this.scheduleWork(),this.checkAsyncSchedule(i.context)}checkAsyncSchedule(e){e.scheduleOn&&=(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(e=>Fg(this.view.state,e)).then(()=>this.workScheduled--),null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),fS=X.define({combine(e){return e.length?e[0]:null},enables:e=>[eS.state,dS,Yy.contentAttributes.compute([e],t=>{let n=t.facet(e);return n&&n.name?{"data-language":n.name}:{}})]}),pS=class{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}},mS=X.define(),hS=X.define({combine:e=>{if(!e.length)return` `;let t=e[0];if(!t||/\S/.test(t)||Array.from(t).some(e=>e!=t[0]))throw Error(`Invalid indent unit: `+JSON.stringify(e[0]));return t}});function gS(e){let t=e.facet(hS);return t.charCodeAt(0)==9?e.tabSize*t.length:t.length}function _S(e,t){let n=``,r=e.tabSize,i=e.facet(hS)[0];if(i==` `){for(;t>=r;)n+=` `,t-=r;i=` `}for(let e=0;e=t?xS(e,n,t):null}var yS=class{constructor(e,t={}){this.state=e,this.options=t,this.unit=gS(e)}lineAt(e,t=1){let n=this.state.doc.lineAt(e),{simulateBreak:r,simulateDoubleBreak:i}=this.options;return r!=null&&r>=n.from&&r<=n.to?i&&r==e?{text:``,from:e}:(t<0?r-1&&(i+=a-this.countColumn(n,n.search(/\S|$/))),i}countColumn(e,t=e.length){return Am(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:n,from:r}=this.lineAt(e,t),i=this.options.overrideIndentation;if(i){let e=i(r);if(e>-1)return e}return this.countColumn(n,n.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}},bS=new Kb;function xS(e,t,n){let r=t.resolveStack(n),i=t.resolveInner(n,-1).resolve(n,0).enterUnfinishedNodesBefore(n);if(i!=r.node){let e=[];for(let t=i;t&&!(t.fromr.node.to||t.from==r.node.from&&t.type==r.node.type);t=t.parent)e.push(t);for(let t=e.length-1;t>=0;t--)r={node:e[t],next:r}}return SS(r,e,n)}function SS(e,t,n){for(let r=e;r;r=r.next){let e=wS(r.node);if(e)return e(ES.create(t,n,r))}return 0}function CS(e){return e.pos==e.options.simulateBreak&&e.options.simulateDoubleBreak}function wS(e){let t=e.type.prop(bS);if(t)return t;let n=e.firstChild,r;if(n&&(r=n.type.prop(Kb.closedBy))){let t=e.lastChild,n=t&&r.indexOf(t.name)>-1;return e=>kS(e,!0,1,void 0,n&&!CS(e)?t.from:void 0)}return e.parent==null?TS:null}function TS(){return 0}var ES=class e extends yS{constructor(e,t,n){super(e.state,e.options),this.base=e,this.pos=t,this.context=n}get node(){return this.context.node}static create(t,n,r){return new e(t,n,r)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let t=this.state.doc.lineAt(e.from);for(;;){let n=e.resolve(t.from);for(;n.parent&&n.parent.from==n.from;)n=n.parent;if(DS(n,e))break;t=this.state.doc.lineAt(n.from)}return this.lineIndent(t.from)}continue(){return SS(this.context.next,this.base,this.pos)}};function DS(e,t){for(let n=t;n;n=n.parent)if(e==n)return!0;return!1}function OS(e){let t=e.node,n=t.childAfter(t.from),r=t.lastChild;if(!n)return null;let i=e.options.simulateBreak,a=e.state.doc.lineAt(n.from),o=i==null||i<=a.from?a.to:Math.min(a.to,i);for(let e=n.to;;){let i=t.childAfter(e);if(!i||i==r)return null;if(!i.type.isSkipped){if(i.from>=o)return null;let e=/^ */.exec(a.text.slice(n.to-a.from))[0].length;return{from:n.from,to:n.to+e}}e=i.to}}function kS(e,t,n,r,i){let a=e.textAfter,o=a.match(/^\s*/)[0].length,s=r&&a.slice(o,o+r.length)==r||i==e.pos+o,c=t?OS(e):null;return c?s?e.column(c.from):e.column(c.to):e.baseIndent+(s?0:e.unit*n)}function AS({except:e,units:t=1}={}){return n=>{let r=e&&e.test(n.textAfter);return n.baseIndent+(r?0:t*n.unit)}}var jS=new Kb;function MS(e){let t=e.firstChild,n=e.lastChild;return t&&t.toe.prop(Zx)==a.data:a?e=>e==a:void 0,this.style=Mx(e.map(e=>({tag:e.tag,class:e.class||r(Object.assign({},e,{tag:null}))})),{all:i}).style,this.module=n?new Im(n):null,this.themeType=t.themeType}static define(t,n){return new e(t,n||{})}},PS=X.define(),FS=X.define({combine(e){return e.length?[e[0]]:null}});function IS(e){let t=e.facet(PS);return t.length?t:e.facet(FS)}function LS(e,t){let n=[zS],r;return e instanceof NS&&(e.module&&n.push(Yy.styleModule.of(e.module)),r=e.themeType),t?.fallback?n.push(FS.of(e)):r?n.push(PS.computeN([Yy.darkTheme],t=>t.facet(Yy.darkTheme)==(r==`dark`)?[e]:[])):n.push(PS.of(e)),n}var RS=class{constructor(e){this.markCache=Object.create(null),this.tree=rS(e.state),this.decorations=this.buildDeco(e,IS(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=rS(e.state),n=IS(e.state),r=n!=IS(e.startState),{viewport:i}=e.view,a=e.changes.mapPos(this.decoratedTo,1);t.length=i.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=a):(t!=this.tree||e.viewportChanged||r)&&(this.tree=t,this.decorations=this.buildDeco(e.view,n),this.decoratedTo=i.to)}buildDeco(e,t){if(!t||!this.tree.length)return ph.none;let n=new ym;for(let{from:r,to:i}of e.visibleRanges)Px(this.tree,t,(e,t,r)=>{n.add(e,t,this.markCache[r]||(this.markCache[r]=ph.mark({class:r})))},r,i);return n.finish()}},zS=Ap.high(zg.fromClass(RS,{decorations:e=>e.decorations}));$.meta,$.link,$.heading,$.emphasis,$.strong,$.strikethrough,$.keyword,$.atom,$.bool,$.url,$.contentSeparator,$.labelName,$.literal,$.inserted,$.string,$.deleted,$.regexp,$.escape,$.string,$.variableName,$.variableName,$.typeName,$.namespace,$.className,$.variableName,$.macroName,$.propertyName,$.comment,$.invalid;var BS=1e4,VS=`()[]{}`,HS=new Kb;function US(e,t,n){let r=e.prop(t<0?Kb.openedBy:Kb.closedBy);if(r)return r;if(e.name.length==1){let r=n.indexOf(e.name);if(r>-1&&r%2==+(t<0))return[n[r+t]]}return null}function WS(e){let t=e.type.prop(HS);return t?t(e.node):e}function GS(e,t,n,r={}){let i=r.maxScanDistance||BS,a=r.brackets||VS,o=rS(e),s=o.resolveInner(t,n);for(let r=s;r;r=r.parent){let i=US(r.type,n,a);if(i&&r.from0?t>=o.from&&to.from&&t<=o.to))return KS(e,t,n,r,o,i,a)}}return qS(e,t,n,o,s.type,i,a)}function KS(e,t,n,r,i,a,o){let s=r.parent,c={from:i.from,to:i.to},l=0,u=s?.cursor();if(u&&(n<0?u.childBefore(r.from):u.childAfter(r.to)))do if(n<0?u.to<=r.from:u.from>=r.to){if(l==0&&a.indexOf(u.type.name)>-1&&u.from0)return null;let l={from:n<0?t-1:t,to:n>0?t+1:t},u=e.doc.iterRange(t,n>0?e.doc.length:0),d=0;for(let e=0;!u.next().done&&e<=a;){let a=u.value;n<0&&(e+=a.length);let s=t+e*n;for(let e=n>0?0:a.length-1,t=n>0?a.length:-1;e!=t;e+=n){let t=o.indexOf(a[e]);if(!(t<0||r.resolveInner(s+e,1).type!=i)){if(t%2==0==n>0)d++;else if(d==1)return{start:l,end:{from:s+e,to:s+e+1},matched:t>>1==c>>1};else d--}}n>0&&(e+=a.length)}return u.done?{start:l,matched:!1}:null}var JS=Object.create(null),YS=[Yb.none],XS=[],ZS=Object.create(null),QS=Object.create(null);for(let[e,t]of[[`variable`,`variableName`],[`variable-2`,`variableName.special`],[`string-2`,`string.special`],[`def`,`variableName.definition`],[`tag`,`tagName`],[`attribute`,`attributeName`],[`type`,`typeName`],[`builtin`,`variableName.standard`],[`qualifier`,`modifier`],[`error`,`invalid`],[`header`,`heading`],[`property`,`propertyName`]])QS[e]=eC(JS,t);function $S(e,t){XS.indexOf(e)>-1||(XS.push(e),console.warn(t))}function eC(e,t){let n=[];for(let r of t.split(` `)){let t=[];for(let n of r.split(`.`)){let r=e[n]||$[n];r?typeof r==`function`?t.length?t=t.map(r):$S(n,`Modifier ${n} used at start of tag`):t.length?$S(n,`Tag ${n} used as modifier`):t=Array.isArray(r)?r:[r]:$S(n,`Unknown highlighting tag ${n}`)}for(let e of t)n.push(e)}if(!n.length)return 0;let r=t.replace(/ /g,`_`),i=r+` `+n.map(e=>e.id),a=ZS[i];if(a)return a.id;let o=ZS[i]=Yb.define({id:YS.length,name:r,props:[kx({[r]:n})]});return YS.push(o),o.id}Zh.RTL,Zh.LTR;var tC=e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),r=oC(e.state,n.from);return r.line?rC(e):r.block?aC(e):!1};function nC(e,t){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let i=e(t,n);return i?(r(n.update(i)),!0):!1}}var rC=nC(dC,0),iC=nC(uC,0),aC=nC((e,t)=>uC(e,t,lC(t)),0);function oC(e,t){let n=e.languageDataAt(`commentTokens`,t,1);return n.length?n[0]:{}}var sC=50;function cC(e,{open:t,close:n},r,i){let a=e.sliceDoc(r-sC,r),o=e.sliceDoc(i,i+sC),s=/\s*$/.exec(a)[0].length,c=/^\s*/.exec(o)[0].length,l=a.length-s;if(a.slice(l-t.length,l)==t&&o.slice(c,c+n.length)==n)return{open:{pos:r-s,margin:s&&1},close:{pos:i+c,margin:c&&1}};let u,d;i-r<=100?u=d=e.sliceDoc(r,i):(u=e.sliceDoc(r,r+sC),d=e.sliceDoc(i-sC,i));let f=/^\s*/.exec(u)[0].length,p=/\s*$/.exec(d)[0].length,m=d.length-p-n.length;return u.slice(f,f+t.length)==t&&d.slice(m,m+n.length)==n?{open:{pos:r+f+t.length,margin:+!!/\s/.test(u.charAt(f+t.length))},close:{pos:i-p-n.length,margin:+!!/\s/.test(d.charAt(m-1))}}:null}function lC(e){let t=[];for(let n of e.selection.ranges){let r=e.doc.lineAt(n.from),i=n.to<=r.to?r:e.doc.lineAt(n.to);i.from>r.from&&i.from==n.to&&(i=n.to==r.to+1?r:e.doc.lineAt(n.to-1));let a=t.length-1;a>=0&&t[a].to>r.from?t[a].to=i.to:t.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:i.to})}return t}function uC(e,t,n=t.selection.ranges){let r=n.map(e=>oC(t,e.from).block);if(!r.every(e=>e))return null;let i=n.map((e,n)=>cC(t,r[n],e.from,e.to));if(e!=2&&!i.every(e=>e))return{changes:t.changes(n.map((e,t)=>i[t]?[]:[{from:e.from,insert:r[t].open+` `},{from:e.to,insert:` `+r[t].close}]))};if(e!=1&&i.some(e=>e)){let e=[];for(let t=0,n;ti&&(e==a||a>c.from)){i=c.from;let e=/^\s*/.exec(c.text)[0].length,t=e==c.length,n=c.text.slice(e,e+s.length)==s?e:-1;ee.comment<0&&(!e.empty||e.single))){let e=[];for(let{line:t,token:n,indent:i,empty:a,single:o}of r)(o||!a)&&e.push({from:t.from+i,insert:n+` `});let n=t.changes(e);return{changes:n,selection:t.selection.map(n,1)}}if(e!=1&&r.some(e=>e.comment>=0)){let e=[];for(let{line:t,comment:n,token:i}of r)if(n>=0){let r=t.from+n,a=r+i.length;t.text[a-t.from]==` `&&a++,e.push({from:r,to:a})}return{changes:e}}return null}var fC=Gp.define(),pC=Gp.define(),mC=X.define(),hC=X.define({combine(e){return um(e,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(n,r)=>e(n,r)||t(n,r)})}}),gC=Dp.define({create(){return FC.empty},update(e,t){let n=t.state.facet(hC),r=t.annotation(fC);if(r){let i=CC.fromTransaction(t,r.selection),a=r.side,o=a==0?e.undone:e.done;return o=i?wC(o,o.length,n.minDepth,i):AC(o,t.startState.selection),new FC(a==0?r.rest:o,a==0?o:r.rest)}let i=t.annotation(pC);if((i==`full`||i==`before`)&&(e=e.isolate()),t.annotation(Yp.addToHistory)===!1)return t.changes.empty?e:e.addMapping(t.changes.desc);let a=CC.fromTransaction(t),o=t.annotation(Yp.time),s=t.annotation(Yp.userEvent);return a?e=e.addChanges(a,o,s,n,t):t.selection&&(e=e.addSelection(t.startState.selection,o,s,n.newGroupDelay)),(i==`full`||i==`after`)&&(e=e.isolate()),e},toJSON(e){return{done:e.done.map(e=>e.toJSON()),undone:e.undone.map(e=>e.toJSON())}},fromJSON(e){return new FC(e.done.map(CC.fromJSON),e.undone.map(CC.fromJSON))}});function _C(e={}){return[gC,hC.of(e),Yy.domEventHandlers({beforeinput(e,t){let n=e.inputType==`historyUndo`?yC:e.inputType==`historyRedo`?bC:null;return n?(e.preventDefault(),n(t)):!1}})]}function vC(e,t){return function({state:n,dispatch:r}){if(!t&&n.readOnly)return!1;let i=n.field(gC,!1);if(!i)return!1;let a=i.pop(e,n,t);return a?(r(a),!0):!1}}var yC=vC(0,!1),bC=vC(1,!1),xC=vC(0,!0),SC=vC(1,!0),CC=class e{constructor(e,t,n,r,i){this.changes=e,this.effects=t,this.mapped=n,this.startSelection=r,this.selectionsAfter=i}setSelAfter(t){return new e(this.changes,this.effects,this.mapped,this.startSelection,t)}toJSON(){return{changes:this.changes?.toJSON(),mapped:this.mapped?.toJSON(),startSelection:this.startSelection?.toJSON(),selectionsAfter:this.selectionsAfter.map(e=>e.toJSON())}}static fromJSON(t){return new e(t.changes&&dp.fromJSON(t.changes),[],t.mapped&&up.fromJSON(t.mapped),t.startSelection&&Y.fromJSON(t.startSelection),t.selectionsAfter.map(Y.fromJSON))}static fromTransaction(t,n){let r=OC;for(let e of t.startState.facet(mC)){let n=e(t);n.length&&(r=r.concat(n))}return!r.length&&t.changes.empty?null:new e(t.changes.invert(t.startState.doc),r,void 0,n||t.startState.selection,OC)}static selection(t){return new e(void 0,OC,void 0,void 0,t)}};function wC(e,t,n,r){let i=t+1>n+20?t-n-1:0,a=e.slice(i,t);return a.push(r),a}function TC(e,t){let n=[],r=!1;return e.iterChangedRanges((e,t)=>n.push(e,t)),t.iterChangedRanges((e,t,i,a)=>{for(let e=0;e=t&&i<=o&&(r=!0)}}),r}function EC(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((e,n)=>e.empty!=t.ranges[n].empty).length===0}function DC(e,t){return e.length?t.length?e.concat(t):e:t}var OC=[],kC=200;function AC(e,t){if(e.length){let n=e[e.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-kC));return r.length&&r[r.length-1].eq(t)?e:(r.push(t),wC(e,e.length-1,1e9,n.setSelAfter(r)))}return[CC.selection([t])]}function jC(e){let t=e[e.length-1],n=e.slice();return n[e.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),n}function MC(e,t){if(!e.length)return e;let n=e.length,r=OC;for(;n;){let i=NC(e[n-1],t,r);if(i.changes&&!i.changes.empty||i.effects.length){let t=e.slice(0,n);return t[n-1]=i,t}t=i.mapped,n--,r=i.selectionsAfter}return r.length?[CC.selection(r)]:OC}function NC(e,t,n){let r=DC(e.selectionsAfter.length?e.selectionsAfter.map(e=>e.map(t)):OC,n);if(!e.changes)return CC.selection(r);let i=e.changes.map(t),a=t.mapDesc(e.changes,!0),o=e.mapped?e.mapped.composeDesc(a):a;return new CC(i,Jp.mapEffects(e.effects,t),o,e.startSelection.map(a),r)}var PC=/^(input\.type|delete)($|\.)/,FC=class e{constructor(e,t,n=0,r=void 0){this.done=e,this.undone=t,this.prevTime=n,this.prevUserEvent=r}isolate(){return this.prevTime?new e(this.done,this.undone):this}addChanges(t,n,r,i,a){let o=this.done,s=o[o.length-1];return o=s&&s.changes&&!s.changes.empty&&t.changes&&(!r||PC.test(r))&&(!s.selectionsAfter.length&&n-this.prevTime0&&n-this.prevTimen.empty?e.moveByChar(n,t):BC(n,t))}function HC(e){return e.textDirectionAt(e.state.selection.main.head)==Zh.LTR}var UC=e=>VC(e,!HC(e)),WC=e=>VC(e,HC(e));function GC(e,t){return zC(e,n=>n.empty?e.moveByGroup(n,t):BC(n,t))}var KC=e=>GC(e,!HC(e)),qC=e=>GC(e,HC(e));typeof Intl<`u`&&Intl.Segmenter;function JC(e,t,n){if(t.type.prop(n))return!0;let r=t.to-t.from;return r&&(r>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function YC(e,t,n){let r=rS(e).resolveInner(t.head),i=n?Kb.closedBy:Kb.openedBy;for(let a=t.head;;){let t=n?r.childAfter(a):r.childBefore(a);if(!t)break;JC(e,t,i)?r=t:a=n?t.to:t.from}let a=r.type.prop(i),o,s;return s=a&&(o=n?GS(e,r.from,1):GS(e,r.to,-1))&&o.matched?n?o.end.to:o.end.from:n?r.to:r.from,Y.cursor(s,n?-1:1)}var XC=e=>zC(e,t=>YC(e.state,t,!HC(e))),ZC=e=>zC(e,t=>YC(e.state,t,HC(e)));function QC(e,t){return zC(e,n=>{if(!n.empty)return BC(n,t);let r=e.moveVertically(n,t);return r.head==n.head?e.moveToLineBoundary(n,t):r})}var $C=e=>QC(e,!1),ew=e=>QC(e,!0);function tw(e){let t=e.scrollDOM.clientHeightr.empty?e.moveVertically(r,t,n.height):BC(r,t));if(i.eq(r.selection))return!1;let a;if(n.selfScroll){let t=e.coordsAtPos(r.selection.main.head),o=e.scrollDOM.getBoundingClientRect(),s=o.top+n.marginTop,c=o.bottom-n.marginBottom;t&&t.top>s&&t.bottomnw(e,!1),iw=e=>nw(e,!0);function aw(e,t,n){let r=e.lineBlockAt(t.head),i=e.moveToLineBoundary(t,n);if(i.head==t.head&&i.head!=(n?r.to:r.from)&&(i=e.moveToLineBoundary(t,n,!1)),!n&&i.head==r.from&&r.length){let n=/^\s*/.exec(e.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;n&&t.head!=r.from+n&&(i=Y.cursor(r.from+n))}return i}var ow=e=>zC(e,t=>aw(e,t,!0)),sw=e=>zC(e,t=>aw(e,t,!1)),cw=e=>zC(e,t=>aw(e,t,!HC(e))),lw=e=>zC(e,t=>aw(e,t,HC(e))),uw=e=>zC(e,t=>e.moveToLineBoundary(t,!1,!1)),dw=e=>zC(e,t=>e.moveToLineBoundary(t,!0,!1));function fw(e,t,n){let r=!1,i=LC(e.selection,t=>{let i=GS(e,t.head,-1)||GS(e,t.head,1)||t.head>0&&GS(e,t.head-1,1)||t.headfw(e,t,!1);function mw(e,t,n){let r=LC(e.state.selection,e=>{e.undirectional&&e.head>=e.anchor!=t&&(e=Y.range(e.head,e.anchor));let r=n(e);return Y.range(e.anchor,r.head,r.goalColumn,r.bidiLevel||void 0,r.assoc)});return!r.eq(e.state.selection)&&(e.dispatch(RC(e.state,r)),!0)}function hw(e,t){return mw(e,t,n=>e.moveByChar(n,t))}var gw=e=>hw(e,!HC(e)),_w=e=>hw(e,HC(e));function vw(e,t){return mw(e,t,n=>e.moveByGroup(n,t))}var yw=e=>vw(e,!HC(e)),bw=e=>vw(e,HC(e)),xw=e=>{let t=!HC(e);return mw(e,t,n=>YC(e.state,n,t))},Sw=e=>{let t=HC(e);return mw(e,t,n=>YC(e.state,n,t))};function Cw(e,t){return mw(e,t,n=>e.moveVertically(n,t))}var ww=e=>Cw(e,!1),Tw=e=>Cw(e,!0);function Ew(e,t){return mw(e,t,n=>e.moveVertically(n,t,tw(e).height))}var Dw=e=>Ew(e,!1),Ow=e=>Ew(e,!0),kw=e=>mw(e,!0,t=>aw(e,t,!0)),Aw=e=>mw(e,!1,t=>aw(e,t,!1)),jw=e=>{let t=!HC(e);return mw(e,t,n=>aw(e,n,t))},Mw=e=>{let t=HC(e);return mw(e,t,n=>aw(e,n,t))},Nw=e=>mw(e,!1,t=>Y.cursor(e.lineBlockAt(t.head).from)),Pw=e=>mw(e,!0,t=>Y.cursor(e.lineBlockAt(t.head).to)),Fw=({state:e,dispatch:t})=>(t(RC(e,{anchor:0})),!0),Iw=({state:e,dispatch:t})=>(t(RC(e,{anchor:e.doc.length})),!0),Lw=({state:e,dispatch:t})=>(t(RC(e,{anchor:e.selection.main.anchor,head:0})),!0),Rw=({state:e,dispatch:t})=>(t(RC(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),zw=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:`select`})),!0),Bw=({state:e,dispatch:t})=>{let n=aT(e).map(({from:t,to:n})=>Y.undirectionalRange(t,Math.min(n+1,e.doc.length)));return t(e.update({selection:Y.create(n),userEvent:`select`})),!0},Vw=({state:e,dispatch:t})=>{let n=LC(e.selection,t=>{let n=rS(e),r=n.resolveStack(t.from,1);if(t.empty){let e=n.resolveStack(t.from,-1);e.node.from>=r.node.from&&e.node.to<=r.node.to&&(r=e)}for(let e=r;e;e=e.next){let{node:n}=e;if((n.from=t.to||n.to>t.to&&n.from<=t.from)&&e.next)return Y.undirectionalRange(n.from,n.to)}return t});return!n.eq(e.selection)&&(t(RC(e,n)),!0)};function Hw(e,t){let{state:n}=e,r=n.selection,i=n.selection.ranges.slice();for(let r of n.selection.ranges){let a=n.doc.lineAt(r.head);if(t?a.to0)for(let n=r;;){let r=e.moveVertically(n,t);if(r.heada.to){i.some(e=>e.head==r.head)||i.push(r);break}if(r.head==n.head)break;n=r}}return i.length!=r.ranges.length&&(e.dispatch(RC(n,Y.create(i,i.length-1))),!0)}var Uw=e=>Hw(e,!1),Ww=e=>Hw(e,!0),Gw=({state:e,dispatch:t})=>{let n=e.selection,r=null;return n.ranges.length>1?r=Y.create([n.main]):n.main.empty||(r=Y.create([Y.cursor(n.main.head)])),r?(t(RC(e,r)),!0):!1};function Kw(e,t){if(e.state.readOnly)return!1;let n=`delete.selection`,{state:r}=e,i=r.changeByRange(r=>{let{from:i,to:a}=r;if(i==a){let o=t(r);oi&&(n=`delete.forward`,o=qw(e,o,!0)),i=Math.min(i,o),a=Math.max(a,o)}else i=qw(e,i,!1),a=qw(e,a,!0);return i==a?{range:r}:{changes:{from:i,to:a},range:Y.cursor(i,it(e)))r.between(t,t,(e,r)=>{et&&(t=n?r:e)});return t}var Jw=(e,t,n)=>Kw(e,r=>{let i=r.from,{state:a}=e,o=a.doc.lineAt(i),s,c;if(n&&!t&&i>o.from&&iJw(e,!1,!0),Xw=e=>Jw(e,!0,!1),Zw=(e,t)=>Kw(e,n=>{let r=n.head,{state:i}=e,a=i.doc.lineAt(r),o=i.charCategorizer(r);for(let e=null;;){if(r==(t?a.to:a.from)){r==n.head&&a.number!=(t?i.doc.lines:1)&&(r+=t?1:-1);break}let s=rp(a.text,r-a.from,t)+a.from,c=a.text.slice(Math.min(r,s)-a.from,Math.max(r,s)-a.from),l=o(c);if(e!=null&&l!=e)break;(c!=` `||r!=n.head)&&(e=l),r=s}return r}),Qw=e=>Zw(e,!1),$w=e=>Zw(e,!0),eT=e=>Kw(e,t=>{let n=e.lineBlockAt(t.head).to;return t.headKw(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),nT=e=>Kw(e,t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head{if(e.readOnly)return!1;let n=e.changeByRange(e=>({changes:{from:e.from,to:e.to,insert:Kf.of([``,``])},range:Y.cursor(e.from)}));return t(e.update(n,{scrollIntoView:!0,userEvent:`input`})),!0},iT=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(t=>{if(!t.empty||t.from==0||t.from==e.doc.length)return{range:t};let n=t.from,r=e.doc.lineAt(n),i=n==r.from?n-1:rp(r.text,n-r.from,!1)+r.from,a=n==r.to?n+1:rp(r.text,n-r.from,!0)+r.from;return{changes:{from:i,to:a,insert:e.doc.slice(n,a).append(e.doc.slice(i,n))},range:Y.cursor(a)}});return!n.changes.empty&&(t(e.update(n,{scrollIntoView:!0,userEvent:`move.character`})),!0)};function aT(e){let t=[],n=-1;for(let r of e.selection.ranges){let i=e.doc.lineAt(r.from),a=e.doc.lineAt(r.to);if(!r.empty&&r.to==a.from&&(a=e.doc.lineAt(r.to-1)),n>=i.number){let e=t[t.length-1];e.to=a.to,e.ranges.push(r)}else t.push({from:i.from,to:a.to,ranges:[r]});n=a.number+1}return t}function oT(e,t,n){if(e.readOnly)return!1;let r=[],i=[];for(let t of aT(e)){if(n?t.to==e.doc.length:t.from==0)continue;let a=e.doc.lineAt(n?t.to+1:t.from-1),o=a.length+1;if(n){r.push({from:t.to,to:a.to},{from:t.from,insert:a.text+e.lineBreak});for(let n of t.ranges)i.push(Y.range(Math.min(e.doc.length,n.anchor+o),Math.min(e.doc.length,n.head+o)))}else{r.push({from:a.from,to:t.from},{from:t.to,insert:e.lineBreak+a.text});for(let e of t.ranges)i.push(Y.range(e.anchor-o,e.head-o))}}return r.length?(t(e.update({changes:r,scrollIntoView:!0,selection:Y.create(i,e.selection.mainIndex),userEvent:`move.line`})),!0):!1}var sT=({state:e,dispatch:t})=>oT(e,t,!1),cT=({state:e,dispatch:t})=>oT(e,t,!0);function lT(e,t,n){if(e.readOnly)return!1;let r=[];for(let t of aT(e))n?r.push({from:t.from,insert:e.doc.slice(t.from,t.to)+e.lineBreak}):r.push({from:t.to,insert:e.lineBreak+e.doc.slice(t.from,t.to)});let i=e.changes(r);return t(e.update({changes:i,selection:e.selection.map(i,n?1:-1),scrollIntoView:!0,userEvent:`input.copyline`})),!0}var uT=({state:e,dispatch:t})=>lT(e,t,!1),dT=({state:e,dispatch:t})=>lT(e,t,!0),fT=e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(aT(t).map(({from:e,to:n})=>(e>0?e--:n{let n;if(e.lineWrapping){let r=e.lineBlockAt(t.head),i=e.coordsAtPos(t.head,t.assoc||1);i&&(n=r.bottom+e.documentTop-i.bottom+e.defaultLineHeight/2)}return e.moveVertically(t,!0,n)}).map(n);return e.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:`delete.line`}),!0};function pT(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=rS(e).resolveInner(t),r=n.childBefore(t),i=n.childAfter(t),a;return r&&i&&r.to<=t&&i.from>=t&&(a=r.type.prop(Kb.closedBy))&&a.indexOf(i.name)>-1&&e.doc.lineAt(r.to).from==e.doc.lineAt(i.from).from&&!/\S/.test(e.sliceDoc(r.to,i.from))?{from:r.to,to:i.from}:null}var mT=gT(!1),hT=gT(!0);function gT(e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let r=t.changeByRange(n=>{let{from:r,to:i}=n,a=t.doc.lineAt(r),o=!e&&r==i&&pT(t,r);e&&(r=i=(i<=a.to?a:t.doc.lineAt(i)).to);let s=new yS(t,{simulateBreak:r,simulateDoubleBreak:!!o}),c=vS(s,r);for(c??=Am(/^\s*/.exec(t.doc.lineAt(r).text)[0],t.tabSize);ia.from&&r{let i=[];for(let a=r.from;a<=r.to;){let o=e.doc.lineAt(a);o.number>n&&(r.empty||r.to>o.from)&&(t(o,i,r),n=o.number),a=o.to+1}let a=e.changes(i);return{changes:i,range:Y.range(a.mapPos(r.anchor,1),a.mapPos(r.head,1))}})}var vT=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),r=new yS(e,{overrideIndentation:e=>n[e]??-1}),i=_T(e,(t,i,a)=>{let o=vS(r,t.from);if(o==null)return;/\S/.test(t.text)||(o=0);let s=/^\s*/.exec(t.text)[0],c=_S(e,o);(s!=c||a.from!e.readOnly&&(t(e.update(_T(e,(t,n)=>{n.push({from:t.from,insert:e.facet(hS)})}),{userEvent:`input.indent`})),!0),bT=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(_T(e,(t,n)=>{let r=/^\s*/.exec(t.text)[0];if(!r)return;let i=Am(r,e.tabSize),a=0,o=_S(e,Math.max(0,i-gS(e)));for(;a(e.setTabFocusMode(),!0),ST=[{key:`Ctrl-b`,run:UC,shift:gw,preventDefault:!0},{key:`Ctrl-f`,run:WC,shift:_w},{key:`Ctrl-p`,run:$C,shift:ww},{key:`Ctrl-n`,run:ew,shift:Tw},{key:`Ctrl-a`,run:uw,shift:Nw},{key:`Ctrl-e`,run:dw,shift:Pw},{key:`Ctrl-d`,run:Xw},{key:`Ctrl-h`,run:Yw},{key:`Ctrl-k`,run:eT},{key:`Ctrl-Alt-h`,run:Qw},{key:`Ctrl-o`,run:rT},{key:`Ctrl-t`,run:iT},{key:`Ctrl-v`,run:iw}],CT=[{key:`ArrowLeft`,run:UC,shift:gw,preventDefault:!0},{key:`Mod-ArrowLeft`,mac:`Alt-ArrowLeft`,run:KC,shift:yw,preventDefault:!0},{mac:`Cmd-ArrowLeft`,run:cw,shift:jw,preventDefault:!0},{key:`ArrowRight`,run:WC,shift:_w,preventDefault:!0},{key:`Mod-ArrowRight`,mac:`Alt-ArrowRight`,run:qC,shift:bw,preventDefault:!0},{mac:`Cmd-ArrowRight`,run:lw,shift:Mw,preventDefault:!0},{key:`ArrowUp`,run:$C,shift:ww,preventDefault:!0},{mac:`Cmd-ArrowUp`,run:Fw,shift:Lw},{mac:`Ctrl-ArrowUp`,run:rw,shift:Dw},{key:`ArrowDown`,run:ew,shift:Tw,preventDefault:!0},{mac:`Cmd-ArrowDown`,run:Iw,shift:Rw},{mac:`Ctrl-ArrowDown`,run:iw,shift:Ow},{key:`PageUp`,run:rw,shift:Dw},{key:`PageDown`,run:iw,shift:Ow},{key:`Home`,run:sw,shift:Aw,preventDefault:!0},{key:`Mod-Home`,run:Fw,shift:Lw},{key:`End`,run:ow,shift:kw,preventDefault:!0},{key:`Mod-End`,run:Iw,shift:Rw},{key:`Enter`,run:mT,shift:mT},{key:`Mod-a`,run:zw},{key:`Backspace`,run:Yw,shift:Yw,preventDefault:!0},{key:`Delete`,run:Xw,preventDefault:!0},{key:`Mod-Backspace`,mac:`Alt-Backspace`,run:Qw,preventDefault:!0},{key:`Mod-Delete`,mac:`Alt-Delete`,run:$w,preventDefault:!0},{mac:`Mod-Backspace`,run:tT,preventDefault:!0},{mac:`Mod-Delete`,run:nT,preventDefault:!0}].concat(ST.map(e=>({mac:e.key,run:e.run,shift:e.shift}))),wT=[{key:`Alt-ArrowLeft`,mac:`Ctrl-ArrowLeft`,run:XC,shift:xw},{key:`Alt-ArrowRight`,mac:`Ctrl-ArrowRight`,run:ZC,shift:Sw},{key:`Alt-ArrowUp`,run:sT},{key:`Shift-Alt-ArrowUp`,run:uT},{key:`Alt-ArrowDown`,run:cT},{key:`Shift-Alt-ArrowDown`,run:dT},{key:`Mod-Alt-ArrowUp`,run:Uw},{key:`Mod-Alt-ArrowDown`,run:Ww},{key:`Escape`,run:Gw},{key:`Mod-Enter`,run:hT},{key:`Alt-l`,mac:`Ctrl-l`,run:Bw},{key:`Mod-i`,run:Vw,preventDefault:!0},{key:`Mod-[`,run:bT},{key:`Mod-]`,run:yT},{key:`Mod-Alt-\\`,run:vT},{key:`Shift-Mod-k`,run:fT},{key:`Shift-Mod-\\`,run:pw},{key:`Mod-/`,run:tC},{key:`Alt-A`,mac:`Ctrl-A`,run:iC},{key:`Ctrl-m`,mac:`Shift-Alt-m`,run:xT}].concat(CT),TT={key:`Tab`,run:yT,shift:bT},ET=class e{constructor(e,t,n,r,i,a,o,s,c,l=0,u){this.p=e,this.stack=t,this.state=n,this.reducePos=r,this.pos=i,this.score=a,this.buffer=o,this.bufferBase=s,this.curContext=c,this.lookAhead=l,this.parent=u}toString(){return`[${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@${this.pos}${this.score?`!`+this.score:``}`}static start(t,n,r=0){let i=t.parser.context;return new e(t,[],n,r,r,0,[],0,i?new DT(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){let t=e>>19,n=e&65535,{parser:r}=this.p,i=this.reducePos=2e3&&!this.p.parser.nodeSet.types[n]?.isAnonymous&&(s==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=c):this.p.lastBigReductionSizeo;)this.stack.pop();this.reduceContext(n,s)}storeNode(e,t,n,r=4,i=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]0&&this.buffer[e-4]==0&&this.buffer[e-1]>-1){if(t==n)return;if(this.buffer[e-2]>=t){this.buffer[e-2]=n;return}}}if(!i||this.pos==n)this.buffer.push(e,t,n,r);else{let i=this.buffer.length;if(i>0&&(this.buffer[i-4]!=0||this.buffer[i-1]<0)){let e=!1;for(let t=i;t>0&&this.buffer[t-2]>n;t-=4)if(this.buffer[t-1]>=0){e=!0;break}if(e)for(;i>0&&this.buffer[i-2]>n;)this.buffer[i]=this.buffer[i-4],this.buffer[i+1]=this.buffer[i-3],this.buffer[i+2]=this.buffer[i-2],this.buffer[i+3]=this.buffer[i-1],i-=4,r>4&&(r-=4)}this.buffer[i]=e,this.buffer[i+1]=t,this.buffer[i+2]=n,this.buffer[i+3]=r}}shift(e,t,n,r){if(e&131072)this.pushState(e&65535,this.pos);else if(e&262144)this.pos=r,this.shiftContext(t,n),t<=this.p.parser.maxNode&&this.buffer.push(t,n,r,4);else{let i=e,{parser:a}=this.p;this.pos=r;let o=a.stateFlag(i,1);!o&&(r>n||t<=a.maxNode)&&(this.reducePos=r),this.pushState(i,o?n:Math.min(n,this.reducePos)),this.shiftContext(t,n),t<=a.maxNode&&this.buffer.push(t,n,r,4)}}apply(e,t,n,r){e&65536?this.reduce(e):this.shift(e,t,n,r)}useNode(e,t,n){let r=this.p.reused.length-1;(r<0||this.p.reused[r]!=e)&&(this.p.reused.push(e),r++);let i=this.reducePos=this.pos=n+e.length;this.pushState(t,n),this.buffer.push(r,n,i,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let t=this,n=t.buffer.length;for(n&&t.buffer[n-4]==0&&(n-=4);n>0&&t.buffer[n-2]>t.reducePos;)n-=4;let r=t.buffer.slice(n),i=t.bufferBase+n;for(;t&&i==t.bufferBase;)t=t.parent;return new e(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,r,i,this.curContext,this.lookAhead,t)}recoverByDelete(e,t){let n=e<=this.p.parser.maxNode;n&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,n?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new OT(this);;){let n=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(n==0)return!1;if(!(n&65536))return!0;t.reduce(n)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let n=[];for(let r=0,i;rt&1&&e==r)||n.push(t[e],r)}t=n}let n=[];for(let e=0;e>19,r=t&65535,i=this.stack.length-n*3;if(i<0||e.getGoto(this.stack[i],r,!1)<0){let e=this.findForcedReduction();if(e==null)return!1;t=e}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],n=(r,i)=>{if(!t.includes(r))return t.push(r),e.allActions(r,t=>{if(!(t&393216)){if(t&65536){let n=(t>>19)-i;if(n>1){let r=t&65535,i=this.stack.length-n*3;if(i>=0&&e.getGoto(this.stack[i],r,!1)>=0)return n<<19|65536|r}}else{let e=n(t,i+1);if(e!=null)return e}}})};return n(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;t0&&this.emitLookAhead()}},DT=class{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}},OT=class{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=e&65535,n=e>>19;n==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(n-1)*3;let r=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=r}},kT=class e{constructor(e,t,n){this.stack=e,this.pos=t,this.index=n,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(t,n=t.bufferBase+t.buffer.length){return new e(t,n,n-t.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new e(this.stack,this.pos,this.index)}};function AT(e,t=Uint16Array){if(typeof e!=`string`)return e;let n=null;for(let r=0,i=0;r=92&&t--,t>=34&&t--;let i=t-32;if(i>=46&&(i-=46,n=!0),a+=i,n)break;a*=46}n?n[i++]=a:n=new t(a)}return n}var jT=class{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}},MT=new jT,NT=class{constructor(e,t){this.input=e,this.ranges=t,this.chunk=``,this.chunkOff=0,this.chunk2=``,this.chunk2Pos=0,this.next=-1,this.token=MT,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let n=this.range,r=this.rangeIndex,i=this.pos+e;for(;in.to:i>=n.to;){if(r==this.ranges.length-1)return null;let e=this.ranges[++r];i+=e.from-n.to,n=e}return i}clipPos(e){if(e>=this.range.from&&ee)return Math.max(e,t.from);return this.end}peek(e){let t=this.chunkOff+e,n,r;if(t>=0&&t=this.chunk2Pos&&nt.to&&(this.chunk2=this.chunk2.slice(0,t.to-n)),r=this.chunk2.charCodeAt(0)}}return n>=this.token.lookAhead&&(this.token.lookAhead=n+1),r}acceptToken(e,t=0){let n=t?this.resolveOffset(t,-1):this.pos;if(n==null||n=this.chunk2Pos&&this.posthis.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.next=this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?-1:this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk=``,this.next=-1}reset(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=MT,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let n=``;for(let r of this.ranges){if(r.from>=t)break;r.to>e&&(n+=this.input.read(Math.max(r.from,e),Math.min(r.to,t)))}return n}},PT=class{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:n}=t.p;IT(this.data,e,t,this.id,n.data,n.tokenPrecTable)}};PT.prototype.contextual=PT.prototype.fallback=PT.prototype.extend=!1;var FT=class{constructor(e,t,n){this.precTable=t,this.elseToken=n,this.data=typeof e==`string`?AT(e):e}token(e,t){let n=e.pos,r=0;for(;;){let n=e.next<0,i=e.resolveOffset(1,1);if(IT(this.data,e,t,0,this.data,this.precTable),e.token.value>-1)break;if(this.elseToken==null)return;if(n||r++,i==null)break;e.reset(i,e.token)}r&&(e.reset(n,e.token),e.acceptToken(this.elseToken,r))}};FT.prototype.contextual=PT.prototype.fallback=PT.prototype.extend=!1;function IT(e,t,n,r,i,a){let o=0,s=1<0){let n=e[r];if(c.allows(n)&&(t.token.value==-1||t.token.value==n||RT(n,t.token.value,i,a))){t.acceptToken(n);break}}let r=t.next,l=0,u=e[o+2];if(t.next<0&&u>l&&e[n+u*3-3]==65535){o=e[n+u*3-1];continue scan}for(;l>1,a=n+i+(i<<1),s=e[a],c=e[a+1]||65536;if(r=c)l=i+1;else{o=e[a+2],t.advance();continue scan}}break}}function LT(e,t,n){for(let r=t,i;(i=e[r])!=65535;r++)if(i==n)return r-t;return-1}function RT(e,t,n,r){let i=LT(n,r,t);return i<0||LT(n,r,e)t)&&!r.type.isError)return n<0?Math.max(0,Math.min(r.to-1,t-25)):Math.min(e.length,Math.max(r.from+1,t+25));if(n<0?r.prevSibling():r.nextSibling())break;if(!r.parent())return n<0?0:e.length}}var HT=class{constructor(e,t){this.fragments=e,this.minRepeat=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.lastRepeat=null,this.lastRepeatPos=-1,this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?VT(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?VT(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(ee)return this.nextStart=a,null;if(i instanceof ex){let n=a>this.lastRepeatPos&&i.type.id>=this.minRepeat;if(a==e||n){let t=a+i.length,r;if(a>=this.safeFrom&&t<=this.safeTo&&(!(r=i.prop(Kb.lookAhead))||t+r=Math.max(this.safeFrom,e)&&(this.trees.push(i),this.start.push(a),this.index.push(0))}else this.index[t]++,this.nextStart=a+i.length}}},UT=class{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(e=>new jT)}getActions(e){let t=0,n=null,{parser:r}=e.p,{tokenizers:i}=r,a=r.stateSlot(e.state,3),o=e.curContext?e.curContext.hash:0,s=0;for(let r=0;rl.end+25&&(s=Math.max(l.lookAhead,s)),l.value!=0)){let r=t;if(l.extended>-1&&(t=this.addActions(e,l.extended,l.end,t)),t=this.addActions(e,l.value,l.end,t),!c.extend&&(n=l,t>r))break}}for(;this.actions.length>t;)this.actions.pop();return s&&e.setLookAhead(s),!n&&e.pos==this.stream.end&&(n=new jT,n.value=e.p.parser.eofTerm,n.start=n.end=e.pos,t=this.addActions(e,n.value,n.end,t)),this.mainToken=n,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new jT,{pos:n,p:r}=e;return t.start=n,t.end=Math.min(n+1,r.stream.end),t.value=n==r.stream.end?r.parser.eofTerm:0,t}updateCachedToken(e,t,n){let r=this.stream.clipPos(n.pos);if(t.token(this.stream.reset(r,e),n),e.value>-1){let{parser:t}=n.p;for(let r=0;r=0&&n.p.parser.dialect.allows(i>>1)){i&1?e.extended=i>>1:e.value=i>>1;break}}}else e.value=0,e.end=this.stream.clipPos(r+1)}putAction(e,t,n,r){for(let t=0;te.bufferLength*4?new HT(n,e.minRepeatTerm):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,t=this.minStackPos,n=this.stacks=[],r,i;if(this.bigReductionCount>300&&e.length==1){let[t]=e;for(;t.forceReduce()&&t.stack.length&&t.stack[t.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let a=0;at)n.push(o);else if(this.advanceStack(o,n,e))continue;else{r||(r=[],i=[]),r.push(o);let e=this.tokens.getMainToken(o);i.push(e.value,e.end)}break}}if(!n.length){let e=r&&YT(r);if(e)return zT&&console.log(`Finish with `+this.stackID(e)),this.stackToTree(e);if(this.parser.strict)throw zT&&r&&console.log(`Stuck with token `+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):`none`)),SyntaxError(`No parse at `+t);this.recovering||=5}if(this.recovering&&r){let e=this.stoppedAt!=null&&r[0].pos>this.stoppedAt?r[0]:this.runRecovery(r,i,n);if(e)return zT&&console.log(`Force-finish `+this.stackID(e)),this.stackToTree(e.forceAll())}if(this.recovering){let e=this.recovering==1?1:this.recovering*3;if(n.length>e)for(n.sort((e,t)=>t.score-e.score);n.length>e;)n.pop();n.some(e=>e.reducePos>t)&&this.recovering--}else if(n.length>1){outer:for(let e=0;e500&&i.buffer.length>500){if((t.score-i.score||t.buffer.length-i.buffer.length)>0)n.splice(r--,1);else{n.splice(e--,1);continue outer}}}}n.length>12&&(n.sort((e,t)=>t.score-e.score),n.splice(12,n.length-12))}this.minStackPos=n[0].pos;for(let e=1;e-1&&n.length&&(!i||(n.prop(Kb.contextHash)||0)==a))return e.useNode(n,o,t),n;if(n.children.length==0||n.positions[0]>0)break;let s=n.children[0];if(s instanceof ex&&(!r||s.type.id>=this.parser.minRepeatTerm))n=s;else break}return null}advanceStack(e,t,n){let r=e.pos,{parser:i}=this,a=zT?this.stackID(e)+` -> `:``;if(this.stoppedAt!=null&&r>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let t=e.reducePos0)return e.reduce(o),zT&&console.log(a+this.stackID(e)+` (via always-reduce ${i.getName(o&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let s=this.tokens.getActions(e);for(let o=0;or?t.push(f):n.push(f)}return!1}advanceFully(e,t){let n=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>n)return GT(e,t),!0}}runRecovery(e,t,n){let r=null,i=!1;for(let a=0;a `:``;if(o.deadEnd&&(i||(i=!0,o.restart(),zT&&console.log(l+this.stackID(o)+` (restarted)`),this.advanceFully(o,n))))continue;let u=o.split(),d=l;for(let e=0;e<10&&u.forceReduce()&&(zT&&console.log(d+this.stackID(u)+` (via force-reduce)`),!this.advanceFully(u,n));e++)zT&&(d=this.stackID(u)+` -> `);for(let e of o.recoverByInsert(s))zT&&console.log(l+this.stackID(e)+` (via recover-insert)`),this.advanceFully(e,n);this.stream.end>o.pos?(c==o.pos&&(c++,s=0),o.recoverByDelete(s,c),zT&&console.log(l+this.stackID(o)+` (via recover-delete ${this.parser.getName(s)})`),GT(o,n)):(!r||r.scoree.topRules[t][1]),r=[];for(let e=0;e=0)i(r,e,t[n++]);else{let a=t[n+-r];for(let o=-r;o>0;o--)i(t[n++],e,a);n++}}}this.nodeSet=new Xb(t.map((t,i)=>Yb.define({name:i>=this.minRepeatTerm?void 0:t,id:i,props:r[i],top:n.indexOf(i)>-1,error:i==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(i)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=Ub;let a=AT(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let e=0;etypeof e==`number`?new PT(a,e):e),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,n){let r=new WT(this,e,t,n);for(let i of this.wrappers)r=i(r,e,t,n);return r}getGoto(e,t,n=!1){let r=this.goto;if(t>=r[0])return-1;for(let i=r[t+1];;){let t=r[i++],a=t&1,o=r[i++];if(a&&n)return o;for(let n=i+(t>>1);i0}validAction(e,t){return!!this.allActions(e,e=>e==t||null)}allActions(e,t){let n=this.stateSlot(e,4),r=n?t(n):void 0;for(let n=this.stateSlot(e,1);r==null;n+=3){if(this.data[n]==65535){if(this.data[n+1]==1)n=JT(this.data,n+2);else break}r=t(JT(this.data,n+1))}return r}nextStates(e){let t=[];for(let n=this.stateSlot(e,1);;n+=3){if(this.data[n]==65535){if(this.data[n+1]==1)n=JT(this.data,n+2);else break}if(!(this.data[n+2]&1)){let e=this.data[n+1];t.some((t,n)=>n&1&&t==e)||t.push(this.data[n],e)}}return t}configure(t){let n=Object.assign(Object.create(e.prototype),this);if(t.props&&(n.nodeSet=this.nodeSet.extend(...t.props)),t.top){let e=this.topRules[t.top];if(!e)throw RangeError(`Invalid top rule name ${t.top}`);n.top=e}return t.tokenizers&&(n.tokenizers=this.tokenizers.map(e=>{let n=t.tokenizers.find(t=>t.from==e);return n?n.to:e})),t.specializers&&(n.specializers=this.specializers.slice(),n.specializerSpecs=this.specializerSpecs.map((e,r)=>{let i=t.specializers.find(t=>t.from==e.external);if(!i)return e;let a=Object.assign(Object.assign({},e),{external:i.to});return n.specializers[r]=XT(a),a})),t.contextTracker&&(n.context=t.contextTracker),t.dialect&&(n.dialect=this.parseDialect(t.dialect)),t.strict!=null&&(n.strict=t.strict),t.wrap&&(n.wrappers=n.wrappers.concat(t.wrap)),t.bufferLength!=null&&(n.bufferLength=t.bufferLength),n}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let t=this.dynamicPrecedences;return t==null?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),n=t.map(()=>!1);if(e)for(let r of e.split(` `)){let e=t.indexOf(r);e>=0&&(n[e]=!0)}let r=null;for(let e=0;ee)&&n.p.parser.stateFlag(n.state,2)&&(!t||t.scoree.external(n,r)<<1|t}return e.get}var ZT=kx({String:$.string,Number:$.number,"True False":$.bool,PropertyName:$.propertyName,Null:$.null,", :":$.separator,"[ ]":$.squareBracket,"{ }":$.brace}),QT=qT.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#ClOOQO'#Cr'#CrQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CtOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59W,59WO!iQPO,59WOVQPO,59QOqQPO'#CmO!nQPO,59`OOQO1G.k1G.kOVQPO'#CnO!vQPO,59aOOQO1G.r1G.rOOQO1G.l1G.lOOQO,59X,59XOOQO-E6k-E6kOOQO,59Y,59YOOQO-E6l-E6l",stateData:`#O~OeOS~OQSORSOSSOTSOWQO_ROgPO~OVXOgUO~O^[O~PVO[^O~O]_OVhX~OVaO~O]bO^iX~O^dO~O]_OVha~O]bO^ia~O`,goto:"!kjPPPPPPkPPkqwPPPPk{!RPPP!XP!e!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:`⚠ JsonText True False Null Number String } { Object Property PropertyName : , ] [ Array`,maxTerm:25,nodeProps:[[`isolate`,-2,6,11,``],[`openedBy`,7,`{`,14,`[`],[`closedBy`,8,`}`,15,`]`]],propSources:[ZT],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oe~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Og~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zO]~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yO[~~'OO_~~'TO^~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0}),$T=()=>e=>{try{JSON.parse(e.state.doc.toString())}catch(t){if(!(t instanceof SyntaxError))throw t;let n=eE(t,e.state.doc);return[{from:n,message:t.message,severity:`error`,to:n}]}return[]};function eE(e,t){let n;return(n=e.message.match(/at position (\d+)/))?Math.min(+n[1],t.length):(n=e.message.match(/at line (\d+) column (\d+)/))?Math.min(t.line(+n[1]).from+ +n[2]-1,t.length):0}var tE=nS.define({name:`json`,parser:QT.configure({props:[bS.add({Object:AS({except:/^\s*\}/}),Array:AS({except:/^\s*\]/})}),jS.add({"Object Array":MS})]}),languageData:{closeBrackets:{brackets:[`[`,`{`,`"`]},indentOnInput:/^\s*[\}\]]$/}});function nE(){return new pS(tE)}var rE=class{constructor(e,t,n){this.from=e,this.to=t,this.diagnostic=n}},iE=class e{constructor(e,t,n){this.diagnostics=e,this.panel=t,this.selected=n}static init(t,n,r){let i=r.facet(yE).markerFilter;i&&(t=i(t,r));let a=t.slice().sort((e,t)=>e.from-t.from||e.to-t.to),o=new ym,s=[],c=0,l=r.doc.iter(),u=0,d=r.doc.length;for(let e=0;;){let t=e==a.length?null:a[e];if(!t&&!s.length)break;let n,r;if(s.length)n=c,r=s.reduce((e,t)=>Math.min(e,t.to),t&&t.from>n?t.from:1e8);else{if(n=t.from,n>d)break;r=t.to,s.push(t),e++}for(;et.from||t.to==n))s.push(t),e++,r=Math.min(t.to,r);else{r=Math.min(t.from,r);break}}r=Math.min(r,d);let i=!1;if(s.some(e=>e.from==n&&(e.to==r||r==d))&&(i=n==r,!i&&r-n<10)){let e=n-(u+l.value.length);e>0&&(l.next(e),u=n);for(let e=n;;){if(e>=r){i=!0;break}if(!l.lineBreak&&u+l.value.length>e)break;e=u+l.value.length,u+=l.value.length,l.next()}}let f=jE(s);if(i)o.add(n,n,ph.widget({widget:new wE(f),diagnostics:s.slice()}));else{let e=s.reduce((e,t)=>t.markClass?e+` `+t.markClass:e,``);o.add(n,r,ph.mark({class:`cm-lintRange cm-lintRange-`+f+e,diagnostics:s.slice(),inclusiveEnd:s.some(e=>e.to>r)}))}if(c=r,c==d)break;for(let e=0;e{if(!(t&&i.diagnostics.indexOf(t)<0)){if(!r)r=new rE(e,n,t||i.diagnostics[0]);else if(i.diagnostics.indexOf(r.diagnostic)<0)return!1;else r=new rE(r.from,n,r.diagnostic)}}),r}function oE(e,t){let n=t.pos,r=t.end||n,i=e.state.facet(yE).hideOn(e,n,r);if(i!=null)return i;let a=e.startState.doc.lineAt(t.pos);return!!(e.effects.some(e=>e.is(lE))||e.changes.touchesRange(a.from,Math.max(a.to,r)))}function sE(e,t){return e.field(fE,!1)?t:t.concat(Jp.appendConfig.of(NE))}function cE(e,t){return{effects:sE(e,[lE.of(t)])}}var lE=Jp.define(),uE=Jp.define(),dE=Jp.define(),fE=Dp.define({create(){return new iE(ph.none,null,null)},update(e,t){if(t.docChanged&&e.diagnostics.size){let n=e.diagnostics.map(t.changes),r=null,i=e.panel;if(e.selected){let i=t.changes.mapPos(e.selected.from,1);r=aE(n,e.selected.diagnostic,i)||aE(n,null,i)}!n.size&&i&&t.state.facet(yE).autoPanel&&(i=null),e=new iE(n,i,r)}for(let n of t.effects)if(n.is(lE)){let r=t.state.facet(yE).autoPanel?n.value.length?EE.open:null:e.panel;e=iE.init(n.value,r,t.state)}else n.is(uE)?e=new iE(e.diagnostics,n.value?EE.open:null,e.selected):n.is(dE)&&(e=new iE(e.diagnostics,e.panel,n.value));return e},provide:e=>[Vb.from(e,e=>e.panel),Yy.decorations.from(e,e=>e.diagnostics)]}),pE=ph.mark({class:`cm-lintRange cm-lintRange-active`});function mE(e,t,n){let{diagnostics:r}=e.state.field(fE),i,a=-1,o=-1;r.between(t-+(n<0),t+ +(n>0),(e,r,{spec:s})=>{if(t>=e&&t<=r&&(e==r||(t>e||n>0)&&(tCE(e,t,!1)))}var gE=e=>{let t=e.state.field(fE,!1);return!t||!t.panel?!1:(e.dispatch({effects:uE.of(!1)}),!0)},_E=zg.fromClass(class{constructor(e){this.view=e,this.timeout=-1,this.set=!0;let{delay:t}=e.state.facet(yE);this.lintTime=Date.now()+t,this.run=this.run.bind(this),this.timeout=setTimeout(this.run,t)}run(){clearTimeout(this.timeout);let e=Date.now();if(ePromise.resolve(e(this.view))),t=>{this.view.state.doc==e.doc&&this.view.dispatch(cE(this.view.state,t.reduce((e,t)=>e.concat(t))))},e=>{Fg(this.view.state,e)})}}update(e){let t=e.state.facet(yE);(e.docChanged||t!=e.startState.facet(yE)||t.needsRefresh&&t.needsRefresh(e))&&(this.lintTime=Date.now()+t.delay,this.set||(this.set=!0,this.timeout=setTimeout(this.run,t.delay)))}force(){this.set&&(this.lintTime=Date.now(),this.run())}destroy(){clearTimeout(this.timeout)}});function vE(e,t,n){let r=[],i=-1;for(let a of e)a.then(n=>{r.push(n),clearTimeout(i),r.length==e.length?t(r):i=setTimeout(()=>t(r),200)},n)}var yE=X.define({combine(e){return{sources:e.map(e=>e.source).filter(e=>e!=null),...um(e.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:bE,tooltipFilter:bE,needsRefresh:(e,t)=>e?t?n=>e(n)||t(n):e:t,hideOn:(e,t)=>e?t?(n,r,i)=>e(n,r,i)||t(n,r,i):e:t,autoPanel:(e,t)=>e||t})}}});function bE(e,t){return e?t?(n,r)=>t(e(n,r),r):e:t}function xE(e,t={}){return[yE.of({source:e,config:t}),_E,NE]}function SE(e){let t=[];if(e)actions:for(let{name:n}of e){for(let e=0;ee.toLowerCase()==r.toLowerCase())){t.push(r);continue actions}}t.push(``)}return t}function CE(e,t,n){let r=n?SE(t.actions):[];return Km(`li`,{class:`cm-diagnostic cm-diagnostic-`+t.severity},Km(`span`,{class:`cm-diagnosticText`},t.renderMessage?t.renderMessage(e):t.message),t.actions?.map((n,i)=>{let a=!1,o=r=>{if(r.preventDefault(),a)return;a=!0;let i=aE(e.state.field(fE).diagnostics,t);i&&n.apply(e,i.from,i.to)},{name:s}=n,c=r[i]?s.indexOf(r[i]):-1,l=c<0?s:[s.slice(0,c),Km(`u`,s.slice(c,c+1)),s.slice(c+1)];return Km(`button`,{type:`button`,class:`cm-diagnosticAction`+(n.markClass?` `+n.markClass:``),onclick:o,onmousedown:o,"aria-label":` Action: ${s}${c<0?``:` (access key "${r[i]})"`}.`},l)}),t.source&&Km(`div`,{class:`cm-diagnosticSource`},t.source))}var wE=class extends dh{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return Km(`span`,{class:`cm-lintPoint cm-lintPoint-`+this.sev})}},TE=class{constructor(e,t){this.diagnostic=t,this.id=`item_`+Math.floor(Math.random()*4294967295).toString(16),this.dom=CE(e,t,!0),this.dom.id=this.id,this.dom.setAttribute(`role`,`option`)}},EE=class e{constructor(e){this.view=e,this.items=[];let t=t=>{if(!(t.ctrlKey||t.altKey||t.metaKey)){if(t.keyCode==27)gE(this.view),this.view.focus();else if(t.keyCode==38||t.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(t.keyCode==40||t.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(t.keyCode==36)this.moveSelection(0);else if(t.keyCode==35)this.moveSelection(this.items.length-1);else if(t.keyCode==13)this.view.focus();else if(t.keyCode>=65&&t.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:n}=this.items[this.selectedIndex],r=SE(n.actions);for(let i=0;i{for(let t=0;tgE(this.view)},`×`)),this.update()}get selectedIndex(){let e=this.view.state.field(fE).selected;if(!e)return-1;for(let t=0;t{for(let e of s.diagnostics){if(a.has(e))continue;a.add(e);let o=-1,s;for(let t=n;tn&&(this.items.splice(n,o-n),r=!0)),t&&s.diagnostic==t.diagnostic?s.dom.hasAttribute(`aria-selected`)||(s.dom.setAttribute(`aria-selected`,`true`),i=s):s.dom.hasAttribute(`aria-selected`)&&s.dom.removeAttribute(`aria-selected`),n++}});n({sel:i.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:e,panel:t})=>{let n=t.height/this.list.offsetHeight;e.topt.bottom&&(this.list.scrollTop+=(e.bottom-t.bottom)/n)}})):this.selectedIndex<0&&this.list.removeAttribute(`aria-activedescendant`),r&&this.sync()}sync(){let e=this.list.firstChild;function t(){let t=e;e=t.nextSibling,t.remove()}for(let n of this.items)if(n.dom.parentNode==this.list){for(;e!=n.dom;)t();e=n.dom.nextSibling}else this.list.insertBefore(n.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=aE(this.view.state.field(fE).diagnostics,this.items[e].diagnostic);t&&this.view.dispatch({selection:{anchor:t.from,head:t.to},scrollIntoView:!0,effects:dE.of(t)})}static open(t){return new e(t)}};function DE(e,t=`viewBox="0 0 40 40"`){return`url('data:image/svg+xml,${encodeURIComponent(e)}')`}function OE(e){return DE(``,`width="6" height="3"`)}var kE=Yy.baseTheme({".cm-diagnostic":{padding:`3px 6px 3px 8px`,marginLeft:`-1px`,display:`block`,whiteSpace:`pre-wrap`},".cm-diagnostic-error":{borderLeft:`5px solid #d11`},".cm-diagnostic-warning":{borderLeft:`5px solid orange`},".cm-diagnostic-info":{borderLeft:`5px solid #999`},".cm-diagnostic-hint":{borderLeft:`5px solid #66d`},".cm-diagnosticAction":{font:`inherit`,border:`none`,padding:`2px 4px`,backgroundColor:`#444`,color:`white`,borderRadius:`3px`,marginLeft:`8px`,cursor:`pointer`},".cm-diagnosticSource":{fontSize:`70%`,opacity:.7},".cm-lintRange":{backgroundPosition:`left bottom`,backgroundRepeat:`repeat-x`,paddingBottom:`0.7px`},".cm-lintRange-error":{backgroundImage:OE(`#f11`)},".cm-lintRange-warning":{backgroundImage:OE(`orange`)},".cm-lintRange-info":{backgroundImage:OE(`#999`)},".cm-lintRange-hint":{backgroundImage:OE(`#66d`)},".cm-lintRange-active":{backgroundColor:`#ffdd9980`},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:`relative`,"&:after":{content:`""`,position:`absolute`,bottom:0,left:`-2px`,borderLeft:`3px solid transparent`,borderRight:`3px solid transparent`,borderBottom:`4px solid #d11`}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:`orange`}},".cm-lintPoint-info":{"&:after":{borderBottomColor:`#999`}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:`#66d`}},".cm-panel.cm-panel-lint":{position:`relative`,"& ul":{maxHeight:`100px`,overflowY:`auto`,"& [aria-selected]":{backgroundColor:`#ddd`,"& u":{textDecoration:`underline`}},"&:focus [aria-selected]":{background_fallback:`#bdf`,backgroundColor:`Highlight`,color_fallback:`white`,color:`HighlightText`},"& u":{textDecoration:`none`},padding:0,margin:0},"& [name=close]":{position:`absolute`,top:`0`,right:`2px`,background:`inherit`,border:`none`,font:`inherit`,padding:0,margin:0}},"&dark .cm-lintRange-active":{backgroundColor:`#86714a80`},"&dark .cm-panel.cm-panel-lint ul":{"& [aria-selected]":{backgroundColor:`#2e343e`}}});function AE(e){return e==`error`?4:e==`warning`?3:e==`info`?2:1}function jE(e){let t=`hint`,n=1;for(let r of e){let e=AE(r.severity);e>n&&(n=e,t=r.severity)}return t}var ME=Fb(mE,{hideOn:oE}),NE=[fE,Yy.decorations.compute([fE],e=>{let{selected:t,panel:n}=e.field(fE);return!t||!n||t.from==t.to?ph.none:ph.set([pE.range(t.from,t.to)])}),ME,kE],PE=524288;function FE(e,t){if(e.length<=t)return e;let n=e.lastIndexOf(` +`,t);return n>t*.5?e.slice(0,n):e.slice(0,t)}var IE=e=>e.state.doc.length>524288?[]:$T()(e);function LE(e){return NS.define([{tag:$.propertyName,color:e?`#7dd3fc`:`#0369a1`},{tag:$.string,color:e?`#86efac`:`#15803d`},{tag:$.number,color:e?`#fcd34d`:`#b45309`},{tag:$.bool,color:e?`#d8b4fe`:`#7e22ce`},{tag:$.null,color:e?`#a1a1aa`:`#71717a`}])}var RE=Yy.theme({"&":{height:`100%`,fontSize:`13px`,backgroundColor:`transparent`},"&.cm-focused":{outline:`none`},".cm-scroller":{fontFamily:`inherit`,lineHeight:`1.5rem`,overflow:`auto`},".cm-gutters":{display:`none`},".cm-activeLine":{backgroundColor:`transparent`},".cm-content":{caretColor:`currentColor`,fontFamily:`inherit`,letterSpacing:`-0.025em`},".cm-placeholder":{color:`var(--color-muted-foreground)`}});function zE({value:e,onChange:t,editable:n,lintJson:r=!0,dark:i,placeholder:a,testId:o=`json-editor`,className:s,onReady:c}){let l=(0,g.useRef)(null),u=(0,g.useRef)(null),d=(0,g.useRef)(t);d.current=t;let f=(0,g.useRef)(i),p=(0,g.useRef)(null),m=(0,g.useRef)(null),h=(0,g.useRef)(null),_=n??t!==void 0,v=(0,g.useRef)(_),y=(0,g.useRef)(r),b=e.length>PE,x=(0,g.useRef)(b),S=!_&&e.length>2e6,C=S?FE(e,PE):e,w=(0,g.useRef)(!1),T=(0,g.useCallback)((e,t,n)=>e?[Yy.updateListener.of(e=>{e.docChanged&&!w.current&&d.current?.(e.state.doc.toString())}),...t||!n?[]:[xE(IE,{delay:300})]]:[lm.readOnly.of(!0),Yy.editable.of(!1)],[]);return(0,g.useEffect)(()=>{let e=l.current;if(!e)return;let t=new Mp,n=new Mp,o=new Mp,s=new Yy({state:lm.create({doc:C,extensions:[o.of(b||!r?[]:nE()),Yy.lineWrapping,_C(),ib.of([...wT,...IC,TT]),RE,t.of(LS(LE(i))),n.of(T(_,b,r)),...a?[hb(a)]:[]]}),parent:e});return p.current=t,m.current=n,h.current=o,c?.(s),u.current=s,()=>{s.destroy(),u.current=null}},[]),(0,g.useEffect)(()=>{let e=u.current;if(!e)return;let t=h.current,n=m.current,i=[];(b!==x.current||r!==y.current)&&(x.current=b,y.current=r,t&&i.push(t.reconfigure(b||!r?[]:nE())),n&&i.push(n.reconfigure(T(_,b,r))));let a=e.state.doc.toString();if(a!==C||i.length!==0){w.current=!0;try{e.dispatch({...a===C?{}:{changes:{from:0,to:e.state.doc.length,insert:C}},...i.length>0?{effects:i}:{}})}finally{w.current=!1}}},[C,b,r,_,T]),(0,g.useEffect)(()=>{let e=u.current,t=m.current;e&&t&&_!==v.current&&(v.current=_,e.dispatch({effects:t.reconfigure(T(_,b,r))}))},[_,b,r,T]),(0,g.useEffect)(()=>{let e=u.current;if(!e||i===f.current)return;f.current=i;let t=p.current;t&&e.dispatch({effects:t.reconfigure(LS(LE(i)))})},[i]),(0,V.jsxs)(`div`,{"data-testid":o,className:wt(`flex min-h-0 flex-1 flex-col overflow-hidden font-mono`,s),children:[S?(0,V.jsx)(`div`,{"data-testid":`large-output-preview-banner`,role:`status`,className:`border-b border-border bg-muted/40 px-5 py-1.5 font-sans text-xs text-muted-foreground`,children:`Showing first 512 KB preview in editor — Copy and Download include the full output`}):null,(0,V.jsx)(`div`,{ref:l,className:`min-h-0 flex-1 overflow-hidden px-5 py-4`})]})}function BE({title:e,meta:t,actions:n,status:r,children:i}){return(0,V.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:[(0,V.jsxs)(`div`,{className:`flex min-h-[42px] flex-shrink-0 flex-wrap items-center justify-between gap-x-2 gap-y-1.5 border-b border-border px-3.5 py-2 max-md:gap-2 md:min-h-12 md:py-1.5 md:pr-2.5 md:pl-3.5 lg:gap-x-3 lg:pr-3 lg:pl-5`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2 lg:gap-3`,children:[(0,V.jsx)(`span`,{className:`font-mono text-[11px] font-semibold tracking-[0.18em] text-muted-foreground`,children:e}),t?(0,V.jsx)(`span`,{"data-testid":`pane-meta`,className:`text-xs tabular-nums text-muted-foreground/70`,children:t}):null]}),(0,V.jsx)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-0.5 max-md:gap-1`,children:n})]}),(0,V.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:i}),r?(0,V.jsxs)(`div`,{"data-testid":`pane-status`,className:r.kind===`error`?`flex-shrink-0 px-3.5 pb-2 text-xs text-destructive`:`flex-shrink-0 whitespace-pre-line px-3.5 pb-2 text-xs text-muted-foreground`,role:`status`,children:[r.message,r.action]}):null]})}var VE=`inline-flex h-7 cursor-pointer items-center gap-1.5 rounded-md px-2 text-[13px] font-medium text-muted-foreground transition-colors outline-none hover:bg-muted hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-40 [&_svg]:size-3.5`,HE=o(((e,t,n)=>{(function(){var n=[`,`,`;`,` `],r=!0,i={",":`comma`,";":`semicolon`," ":`tab`,"|":`pipe`};function a(e){var t={},r;return n.forEach(function(n,i){var a=new RegExp(n,`g`);t[n]=(e.match(a)||[]).length,r=!r||t[n]>t[r]?n:r}),r}function o(e){for(var t={},n=0;n=0;n--){var r=e[n];t[r]>0&&(r=r+`__`+t[r]--),i.unshift(r)}return i}function s(e,t){if(t||={},e.length==0)throw`Empty CSV. Please provide something.`;var n=t.separator||a(e);if(!n)throw`We could not detect the separator.`;var s=[];try{r=t.trim!==!1;var s=c.parse(e,i[n])}catch(t){var l=e.lastIndexOf(` +`,t.offset),u=e.indexOf(` +`,t.offset),d=e.substring(l>=-1?l:0,u>-1?u:e.length);throw t.message+` On line `+t.line+` and column `+t.column+`. +`+d}if(t.transpose){for(var f=0,p=0;pf&&(f=s[p].length);for(var m=Array(f),h=0;hs&&(s=a,c=[]),c.push(e))}function u(){var e,t,n=a,r=a;return e=(function(e){return b=`,`})(a)?``:null,e===null?(e=null,a=r):(t=m(),t===null?(e=null,a=r):e=[e,t]),e!==null&&(e=(function(e,t){return t})(n,e[1])),e===null&&(a=n),e}function d(){var e,t,n=a,r=a;return e=(function(e){return b=`;`})(a)?``:null,e===null?(e=null,a=r):(t=m(),t===null?(e=null,a=r):e=[e,t]),e!==null&&(e=(function(e,t){return t})(n,e[1])),e===null&&(a=n),e}function f(){var e,t,n=a,r=a;return e=(function(e){return b=`|`})(a)?``:null,e===null?(e=null,a=r):(t=m(),t===null?(e=null,a=r):e=[e,t]),e!==null&&(e=(function(e,t){return t})(n,e[1])),e===null&&(a=n),e}function p(){var e,t,n=a,r=a;return e=(function(e){return b=` `})(a)?``:null,e===null?(e=null,a=r):(t=m(),t===null?(e=null,a=r):e=[e,t]),e!==null&&(e=(function(e,t){return t})(n,e[1])),e===null&&(a=n),e}function m(){var e,n,r,i,s,c=a,u=a,d,f;for(e=[],/^[\n\r]/.test(t.charAt(a))?(n=t.charAt(a),a++):(n=null,o===0&&l(`[\\n\\r]`));n!==null;)e.push(n),/^[\n\r]/.test(t.charAt(a))?(n=t.charAt(a),a++):(n=null,o===0&&l(`[\\n\\r]`));if(e!==null){if(n=h(),n!==null){if(r=[],d=a,f=a,/^[\n\r]/.test(t.charAt(a))?(s=t.charAt(a),a++):(s=null,o===0&&l(`[\\n\\r]`)),s!==null)for(i=[];s!==null;)i.push(s),/^[\n\r]/.test(t.charAt(a))?(s=t.charAt(a),a++):(s=null,o===0&&l(`[\\n\\r]`));else i=null;for(i===null?(i=null,a=f):(s=h(),s===null?(i=null,a=f):i=[i,s]),i!==null&&(i=(function(e,t){return t})(d,i[1])),i===null&&(a=d);i!==null;){if(r.push(i),d=a,f=a,/^[\n\r]/.test(t.charAt(a))?(s=t.charAt(a),a++):(s=null,o===0&&l(`[\\n\\r]`)),s!==null)for(i=[];s!==null;)i.push(s),/^[\n\r]/.test(t.charAt(a))?(s=t.charAt(a),a++):(s=null,o===0&&l(`[\\n\\r]`));else i=null;i===null?(i=null,a=f):(s=h(),s===null?(i=null,a=f):i=[i,s]),i!==null&&(i=(function(e,t){return t})(d,i[1])),i===null&&(a=d)}if(r!==null){for(i=[],/^[\n\r]/.test(t.charAt(a))?(s=t.charAt(a),a++):(s=null,o===0&&l(`[\\n\\r]`));s!==null;)i.push(s),/^[\n\r]/.test(t.charAt(a))?(s=t.charAt(a),a++):(s=null,o===0&&l(`[\\n\\r]`));i===null?(e=null,a=u):e=[e,n,r,i]}else e=null,a=u}else e=null,a=u}else e=null,a=u;return e!==null&&(e=(function(e,t,n){return n.unshift(t),n})(c,e[1],e[2])),e===null&&(a=c),e}function h(){var e,n,r,i,s,c=a,u=a,d,f;if(e=g(),e!==null){for(n=[],d=a,f=a,t.length>a?(r=t.charAt(a),a++):(r=null,o===0&&l(`any character`)),r===null?(r=null,a=f):(i=(function(e,t){return t==b})(a,r)?``:null,i===null?(r=null,a=f):(s=g(),s===null?(r=null,a=f):r=[r,i,s])),r!==null&&(r=(function(e,t,n){return n})(d,r[0],r[2])),r===null&&(a=d);r!==null;)n.push(r),d=a,f=a,t.length>a?(r=t.charAt(a),a++):(r=null,o===0&&l(`any character`)),r===null?(r=null,a=f):(i=(function(e,t){return t==b})(a,r)?``:null,i===null?(r=null,a=f):(s=g(),s===null?(r=null,a=f):r=[r,i,s])),r!==null&&(r=(function(e,t,n){return n})(d,r[0],r[2])),r===null&&(a=d);n===null?(e=null,a=u):(r=(function(e,t,n){return!!t||n.length})(a,e,n)?``:null,r===null?(e=null,a=u):e=[e,n,r])}else e=null,a=u;return e!==null&&(e=(function(e,t,n){return n.unshift(t),n})(c,e[0],e[1])),e===null&&(a=c),e}function g(){var e,n,i,s=a,c=a,u;if(t.charCodeAt(a)===34?(e=`"`,a++):(e=null,o===0&&l(`"\\""`)),e!==null){for(n=[],i=_();i!==null;)n.push(i),i=_();n===null?(e=null,a=c):(t.charCodeAt(a)===34?(i=`"`,a++):(i=null,o===0&&l(`"\\""`)),i===null?(e=null,a=c):e=[e,n,i])}else e=null,a=c;if(e!==null&&(e=(function(e,t){return t.join(``)})(s,e[1])),e===null&&(a=s),e===null){for(s=a,e=[],c=a,u=a,/^[^\n\r]/.test(t.charAt(a))?(n=t.charAt(a),a++):(n=null,o===0&&l(`[^\\n\\r]`)),n===null?(n=null,a=u):(i=(function(e,t){return t!=b})(a,n)?``:null,i===null?(n=null,a=u):n=[n,i]),n!==null&&(n=(function(e,t){return t})(c,n[0])),n===null&&(a=c);n!==null;)e.push(n),c=a,u=a,/^[^\n\r]/.test(t.charAt(a))?(n=t.charAt(a),a++):(n=null,o===0&&l(`[^\\n\\r]`)),n===null?(n=null,a=u):(i=(function(e,t){return t!=b})(a,n)?``:null,i===null?(n=null,a=u):n=[n,i]),n!==null&&(n=(function(e,t){return t})(c,n[0])),n===null&&(a=c);e!==null&&(e=(function(e,t){return(r?t.join(``).trim():t.join(``)).replace(/(^")|("$)/g,``)})(s,e)),e===null&&(a=s)}return e}function _(){var e,n,r=a,i=a;return t.charCodeAt(a)===34?(e=`"`,a++):(e=null,o===0&&l(`"\\""`)),e===null?(e=null,a=i):(t.charCodeAt(a)===34?(n=`"`,a++):(n=null,o===0&&l(`"\\""`)),n===null?(e=null,a=i):e=[e,n]),e!==null&&(e=(function(e){return`"`})(r)),e===null&&(a=r),e===null&&(/^[^"]/.test(t.charAt(a))?(e=t.charAt(a),a++):(e=null,o===0&&l(`[^"]`))),e}function v(e){e.sort();for(var t=null,n=[],r=0;r{(function(){var n=`Item in array is not an object: {0}`;function r(e,t){t||=[];function o(e,t){var n=e.slice(0);if(!Array.isArray(t))return n;for(var r=0;r=2)try{return{ok:!0,value:JSON.parse(t)}}catch{return{ok:!1}}return{ok:!1}}function eD(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function tD(e){return e===null||typeof e==`string`||typeof e==`number`||typeof e==`boolean`}function nD(e){let t=(e,r,i)=>{for(let[a,o]of Object.entries(e)){let e=r?`${r}.${a}`:a;eD(o)&&Object.keys(o).length>0?t(o,e,i):i[e]=Array.isArray(o)?o.map(n):o}},n=e=>{if(!eD(e))return e;let n={};return t(e,``,n),n};return Array.isArray(e)?e.map(n):eD(e)?n(e):e}function rD(e){let t=e=>{if(!eD(e))return e;let n={};for(let[r,i]of Object.entries(e))n[r]=Array.isArray(i)&&i.length>0&&i.every(tD)?i.join(`, `):Array.isArray(i)?i.map(t):i;return n};return Array.isArray(e)?e.map(t):eD(e)?t(e):e}function iD(e){let t=e.trim().toLowerCase();return t===`true`||t===`1`||t===`yes`?!0:t===`false`||t===`0`||t===`no`?!1:e}function aD(e,t,n){if(n===`string`)return e;if(n===`number`)return QE(e);if(n===`boolean`)return iD(e);if(t.parseJSON){let t=$E(e);if(t.ok&&typeof t.value!=`number`)return t.value}return t.parseNumbers?QE(e):e}function oD(e,t){let n=e=>{let n={};for(let r of Object.keys(e)){let i=e[r];if(typeof i!=`string`){n[r]=i;continue}if(t.emptyFields===`skip`&&i===``)continue;if(t.nullLiterals===`null`&&i===`NULL`){n[r]=null;continue}let a=t.columnTypes?.[r];n[r]=aD(i,t,a)}return n};if(Array.isArray(e))return e.map(e=>eD(e)?n(e):e);let r={};for(let[t,i]of Object.entries(e))r[t]=eD(i)?n(i):i;return r}var sD=/^([^.[\]]+)(?:\.(0|[1-9]\d*)|\[(0|[1-9]\d*)\])(?:\.(.+))?$/;function cD(e){let t=sD.exec(e);if(!t)return null;let n=t[1],r=t[2],i=t[3],a=t[4],o=Number(r??i);return Number.isSafeInteger(o)?{column:e,prefix:n,index:o,notation:r===void 0?`bracket`:`dot`,...a===void 0?{}:{subKey:a}}:null}function lD(e){let t=new Set(e),n=new Map;for(let t of e){let e=cD(t);if(!e)continue;let r=n.get(e.prefix);r?r.push(e):n.set(e.prefix,[e])}let r=[];for(let[e,i]of n.entries()){if(t.has(e))continue;let n=i[0].subKey!==void 0,a=i[0].notation;if(i.some(e=>e.subKey!==void 0!==n||e.notation!==a))continue;let o=new Set,s=!1;for(let e of i){let t=`${e.index}:${e.subKey??``}`;if(o.has(t)){s=!0;break}o.add(t)}if(s)continue;let c=Array.from(new Set(i.map(e=>e.index))).sort((e,t)=>e-t);if(c.length<2)continue;let l=c[0];(l===0||l===1)&&c.every((e,t)=>e===l+t)&&r.push({prefix:e,indices:c,columns:i.map(e=>e.column)})}return r}function uD(e,t){return e===void 0||e===``||t===`skip`&&e===null}function dD(e,t,n,r){let i=new Map,a=new Set,o=new Map;for(let e of n)if(e.columns.length!==0){i.set(e.columns[0],e);for(let t of e.columns)a.add(t);o.set(e.prefix,e.columns.map(e=>cD(e)).filter(e=>e!==null))}let s={};for(let n of t){let t=i.get(n);if(t){let n=o.get(t.prefix)??[];if(n.some(e=>e.subKey!==void 0)){let i=new Map;for(let e of n){let t=i.get(e.index);t?t.push(e):i.set(e.index,[e])}let a=[];for(let n of t.indices){let t=i.get(n)??[],o={};for(let n of t){if(!n.subKey)continue;let t=e[n.column];uD(t,r)||(o[n.subKey]=t)}Object.keys(o).length>0&&a.push(o)}if(a.length===0&&r===`skip`)continue;s[t.prefix]=a}else{let i=new Map;for(let e of n)i.set(e.index,e.column);let a=[];for(let n of t.indices){let t=i.get(n);if(!t)continue;let o=e[t];uD(o,r)||a.push(o)}if(a.length===0&&r===`skip`)continue;s[t.prefix]=a}}else a.has(n)||Object.prototype.hasOwnProperty.call(e,n)&&(s[n]=e[n])}return s}function fD(e,t,n){if(Array.isArray(e)&&Array.isArray(t)){let r=e[0];if(!eD(r))return t;let i=Object.keys(r),a=lD(i);return a.length===0?t:t.map(e=>eD(e)?dD(e,i,a,n):e)}if(!Array.isArray(e)&&!Array.isArray(t)){let r=Object.values(e)[0];if(!eD(r))return t;let i=Object.keys(r),a=lD(i);if(a.length===0)return t;let o={};for(let[e,r]of Object.entries(t))o[e]=eD(r)?dD(r,i,a,n):r;return o}return t}function pD(e,t={}){let n={parseNumbers:t.parseNumbers??!0,parseJSON:t.parseJSON??!1,emptyFields:t.emptyFields??`keep`,nullLiterals:t.nullLiterals??`string`,columnTypes:t.columnTypes},r=e.startsWith(XE)?e.slice(1):e,i=t.separator===void 0?jd(r,t.markdownTableIndex??0):null,a=i?i.cleanedCsv:r;try{let e=(0,WE.default)(a,{...t,parseNumbers:!1,parseJSON:!1,trim:!1}),r=oD(e,n);return t.collapseIndexedArrays!==!1&&!t.transpose?fD(e,r,n.emptyFields):r}catch(e){throw Error(YE(e),{cause:e})}}function mD(e,t={}){try{let n=t.flatten?rD(nD(e)):e;return(0,GE.default)(n,t)}catch(e){let n=YE(e);throw JE.some(e=>n.startsWith(e))?new KE(qE(n,t.flatten??!1)):Error(n,{cause:e})}}function hD(e,t={}){return JSON.stringify(e,null,t.minify?void 0:2)}var gD={separator:`auto`,parseNumbers:!0,parseJSON:!0,emptyFields:`keep`,nullLiterals:`string`,transpose:!1,hash:!1,minify:!1,flatten:!1,collapseIndexedArrays:!0},_D=[`data`,`items`,`results`,`records`,`rows`];function vD(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function yD(e){let t=e.trim();if(t===``||!t.startsWith(`{`))return[];let n;try{n=JSON.parse(t)}catch{return[]}if(!vD(n))return[];let r=Object.keys(n),i=new Set(_D),a=[..._D.filter(e=>r.includes(e)),...r.filter(e=>!i.has(e))],o=[];for(let e of a){let t=n[e];Array.isArray(t)&&t.length>0&&t.every(e=>vD(e))&&o.push({key:e,rowCount:t.length,unwrappedJson:JSON.stringify(t,null,2)})}return o}function bD(e){let t=e.split(/\r?\n/).map(e=>e.trim()).filter(e=>e.length>0);if(t.length<2)return null;let n=[];for(let e of t)try{let t=JSON.parse(e);if(typeof t!=`object`||!t)return null;n.push(t)}catch{return null}return n}function xD(e){let t=e.trim();if(t===``)return null;let n;try{n=JSON.parse(t)}catch{let e=bD(t);if(e===null)return null;n=e}let r=JSON.stringify(n,null,2);return t===r?{label:`Minify`,nextInput:JSON.stringify(n)}:{label:`Format`,nextInput:r}}function SD(e){let t=e.trim();if(t===``)return[];let n;try{n=JSON.parse(t)}catch{let e=bD(t);if(e===null)return[];n=e}let r;if(Array.isArray(n)){if(n.length===0||!n.every(e=>vD(e)))return[];r=n}else if(vD(n)){if(yD(t).length>0)return[];r=[n]}else return[];let i=new Set,a=r.slice(0,50);for(let e of a)for(let[t,n]of Object.entries(e))(vD(n)||Array.isArray(n)&&n.length>0)&&i.add(t);return Array.from(i)}function CD(e){let t=e=>{let t=new Set;for(let n of e)n&&typeof n==`object`&&!Array.isArray(n)&&Object.keys(n).forEach(e=>t.add(e));return t};if(Array.isArray(e))return{rows:e.length,cols:t(e).size};if(e&&typeof e==`object`){let n=Object.values(e);return{rows:n.length,cols:t(n).size}}return{rows:0,cols:0}}var wD=e=>e===`auto`?void 0:e;function TD(e){let t=!1,n=1;for(let r=0;r0;return i.rowWidths.forEach((e,t)=>{if(a&&t===i.rowWidths.length-1)return;let r=i.rows[t];(e!==1||r[0]!==``)&&e!==i.headers.length&&n.push(e0?{warnings:o}:{}}}let r;try{r=JSON.parse(t)}catch(e){let n=bD(t);if(n!==null)r=n;else return{ok:!1,error:`Invalid JSON — ${e instanceof Error?e.message:String(e)}`}}let i=wD(n.separator),a=mD(r,{separator:i,flatten:n.flatten}),o=Fd(a,i);return{ok:!0,text:a,rows:o.rows.length,cols:o.headers.length}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}function kD(){return(0,V.jsx)(`svg`,{"data-testid":`reading-spinner`,className:`animate-spin`,width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2.5,"aria-label":`Reading file`,children:(0,V.jsx)(`path`,{d:`M21 12a9 9 0 1 1-6.2-8.56`,strokeLinecap:`round`})})}function AD({label:e,testId:t,onClick:n,disabled:r,Icon:i,keepLabelOnMobile:a=!1}){return(0,V.jsxs)(`button`,{type:`button`,"data-testid":t,"aria-label":e,disabled:r,onClick:n,title:e,className:VE,children:[i?(0,V.jsx)(i,{"aria-hidden":`true`}):null,i&&!a?(0,V.jsx)(`span`,{className:`hidden xl:inline`,children:e}):e]})}function jD(e){let t=Math.min(e.length,65536),n=!1,r=0;for(let i=0;i=3))return e.slice(0,i+1)}return e.slice(0,t)}function MD(e){let t=e.slice(0,3).map(e=>`.${e}`).join(`, `),n=e.length-3;return n>0?`${t}, +${n} more`:t}function ND({format:e,input:t,onInputChange:n,onFile:r,onTryExample:i,onClear:a,onCopy:o,onCopySelection:s,onDownload:c,filename:l,reading:u,meta:d,error:f,notice:p,dark:m,delimiter:h,onCellCommit:_,canUndo:v=!1,canRedo:y=!1,onUndo:b,onRedo:x,onProjectedCsvChange:S,collapseIndexedArrays:C=!0,onToggleCollapseIndexedArrays:w,columnTypes:T,onChangeColumnTypes:E,flatten:D=!1,onToggleFlatten:O,selectedMarkdownTableIndex:k,onSelectMarkdownTableIndex:A}){let[ee,te]=(0,g.useState)(!1),[ne,re]=(0,g.useState)(!1),[j,ie]=(0,g.useState)({forInput:``,index:0}),M=(0,g.useRef)(0),ae=(0,g.useRef)(null),N=t.trim()===``,oe=e===`CSV`,P=(0,g.useMemo)(()=>!oe||N||h!==void 0?[]:Ad(t),[oe,N,t,h]),se=k===void 0?j.forInput===t?j.index:0:k,ce=P.length===0?0:Math.min(Math.max(0,se),P.length-1),F=P[ce]??null,le=e=>{ie({forInput:t,index:e}),A?.(e)},de=(0,g.useMemo)(()=>!oe||N?[]:lD(Fd(jD(F?F.cleanedCsv:t),h).headers.map(e=>e.trim())),[oe,N,t,h,F]),fe=(0,g.useMemo)(()=>oe||N?[]:yD(t),[oe,N,t]),pe=(0,g.useMemo)(()=>oe||N?[]:SD(t),[oe,N,t]),me=(0,g.useMemo)(()=>oe||N?null:xD(t),[oe,N,t]),L=e=>{e.preventDefault(),Array.from(e.dataTransfer?.types??[]).includes(`Files`)&&(M.current++,re(!0))},R=()=>{M.current=Math.max(0,M.current-1),M.current===0&&re(!1)},ve=e=>{e.preventDefault(),M.current=0,re(!1);let t=e.dataTransfer?.files?.[0];t&&r(t,`drop`)},ye=e=>{if(!N||e.defaultPrevented||e.target instanceof HTMLTextAreaElement||e.target instanceof HTMLInputElement)return;let t=e.clipboardData?.getData(`text/plain`);t&&(e.preventDefault(),n(t))},be=oe?(0,V.jsxs)(`span`,{"data-testid":`view-mode`,role:`group`,"aria-label":`View mode`,className:`inline-flex items-center gap-0.5 rounded-lg border border-border bg-muted/60 p-0.5`,children:[(0,V.jsxs)(`button`,{type:`button`,"data-testid":`view-table`,"aria-pressed":!ee,onClick:()=>te(!1),className:wt(`inline-flex cursor-pointer items-center gap-1 rounded-[7px] px-2 py-1 text-xs font-medium transition-all outline-none focus-visible:ring-3 focus-visible:ring-ring/50 lg:px-2.5`,ee?`text-muted-foreground hover:text-foreground`:`bg-background text-foreground shadow-sm`),children:[(0,V.jsx)(Se,{"aria-hidden":`true`,className:`size-3.5 md:hidden lg:inline`}),`Table`]}),(0,V.jsxs)(`button`,{type:`button`,"data-testid":`raw-toggle`,"aria-pressed":ee,onClick:()=>te(!0),className:wt(`inline-flex cursor-pointer items-center gap-1 rounded-[7px] px-2 py-1 text-xs font-medium transition-all outline-none focus-visible:ring-3 focus-visible:ring-ring/50 lg:px-2.5`,ee?`bg-background text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground`),children:[(0,V.jsx)(ue,{"aria-hidden":`true`,className:`size-3.5 md:hidden lg:inline`}),`Raw`]})]}):null,xe=u&&l?(0,V.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,V.jsx)(kD,{}),` `,l]}):l?d?`${l} · ${d}`:l:d;return(0,V.jsx)(`div`,{"data-testid":`input-pane`,onDragEnter:L,onDragOver:e=>e.preventDefault(),onDragLeave:R,onDrop:ve,onPaste:ye,"data-drag-over":ne||void 0,className:`relative flex min-h-0 min-w-0 flex-1 flex-col`,children:(0,V.jsxs)(BE,{title:e,meta:xe,actions:(0,V.jsxs)(V.Fragment,{children:[be,oe&&(v||y)?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`button`,{type:`button`,"data-testid":`csv-undo-button`,"aria-label":`Undo`,title:`Undo`,disabled:!v,onClick:()=>b?.(),className:VE,children:(0,V.jsx)(B,{"aria-hidden":`true`})}),(0,V.jsx)(`button`,{type:`button`,"data-testid":`csv-redo-button`,"aria-label":`Redo`,title:`Redo`,disabled:!y,onClick:()=>x?.(),className:VE,children:(0,V.jsx)(_e,{"aria-hidden":`true`})})]}):null,me?(0,V.jsx)(AD,{label:me.label,testId:`json-format-toggle`,onClick:()=>n(me.nextInput),Icon:ue,keepLabelOnMobile:!0}):null,(0,V.jsx)(`input`,{ref:ae,type:`file`,"data-testid":`file-input`,accept:oe?`.csv,.tsv,.txt,.md,text/csv,text/tab-separated-values,text/markdown`:`.json,.jsonl,.ndjson,.txt,application/json,application/x-ndjson`,className:`hidden`,onChange:e=>{let t=e.target.files?.[0];t&&r(t,`picker`),e.target.value=``}}),(0,V.jsx)(AD,{label:`Upload`,testId:`upload`,onClick:()=>ae.current?.click(),Icon:I}),(0,V.jsx)(AD,{label:`Copy`,testId:`copy-input`,onClick:o,Icon:he}),(0,V.jsx)(AD,{label:`Clear`,testId:`clear-input`,onClick:a,disabled:N,Icon:we}),(0,V.jsx)(AD,{label:`Download`,testId:`download-input`,onClick:c,disabled:N,Icon:ge})]}),status:f?{kind:`error`,message:f}:p?{kind:`notice`,message:p}:null,children:[N?(0,V.jsx)(Nf,{format:e,onIngest:n,onBrowse:()=>ae.current?.click(),onTryExample:i}):oe?(0,V.jsxs)(V.Fragment,{children:[F?(0,V.jsxs)(`div`,{"data-testid":`csv-markdown-table-bar`,className:`flex flex-shrink-0 flex-wrap items-center justify-between gap-1.5 border-b border-border bg-muted/30 px-3.5 py-1.5`,children:[P.length>=2?(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,V.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`${P.length} tables detected:`}),P.map(e=>{let t=e.index===ce,n=e.title??e.headers.slice(0,2).join(`, `);return(0,V.jsx)(`button`,{type:`button`,"data-testid":`csv-markdown-table-select-${e.index}`,"aria-pressed":t,onClick:()=>le(e.index),className:wt(`inline-flex cursor-pointer items-center gap-1 rounded-md border px-2 py-0.5 font-mono text-xs font-medium shadow-2xs transition-colors outline-none focus-visible:ring-3 focus-visible:ring-ring/50`,t?`border-foreground/30 bg-background text-foreground ring-1 ring-foreground/15`:`border-border bg-muted/60 text-muted-foreground hover:bg-muted hover:text-foreground`),children:`${e.index+1}. ${n} (${e.rows}×${e.cols})`},e.index)})]}):(0,V.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:F.kind===`box`?`ASCII CLI box table detected:`:`Markdown pipe table detected:`}),(0,V.jsx)(`button`,{type:`button`,"data-testid":`csv-clean-markdown-pill`,onClick:()=>n(F.cleanedCsv),className:`inline-flex cursor-pointer items-center gap-1 rounded-md border border-border bg-background px-2 py-0.5 font-mono text-xs font-medium text-foreground shadow-2xs transition-colors hover:bg-muted outline-none focus-visible:ring-3 focus-visible:ring-ring/50`,children:P.length>=2?`Use only this table (${F.rows} ${F.rows===1?`row`:`rows`})`:F.kind===`box`?`Clean CLI table (${F.rows} ${F.rows===1?`row`:`rows`})`:`Clean Markdown table (${F.rows} ${F.rows===1?`row`:`rows`})`})]}):null,de.length>0?(0,V.jsxs)(`div`,{"data-testid":`csv-indexed-array-bar`,className:`flex flex-shrink-0 flex-wrap items-center justify-between gap-1.5 border-b border-border bg-muted/30 px-3.5 py-1.5`,children:[(0,V.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Indexed columns (${de.map(e=>`${e.prefix}[${e.indices.length}]`).join(`, `)}):`}),(0,V.jsx)(`button`,{type:`button`,"data-testid":`csv-indexed-array-pill`,"aria-pressed":C,onClick:()=>w?.(),className:wt(`inline-flex cursor-pointer items-center gap-1 rounded-md border px-2 py-0.5 font-mono text-xs font-medium shadow-2xs transition-colors outline-none focus-visible:ring-3 focus-visible:ring-ring/50`,C?`border-border bg-background text-foreground hover:bg-muted`:`border-border bg-muted/60 text-muted-foreground hover:bg-muted hover:text-foreground`),children:C?`Arrays: .0, .1 → []`:`Keep flat keys (.0, .1)`})]}):null,ee?(0,V.jsx)(`textarea`,{"data-testid":`input-editor`,value:t,onChange:e=>n(e.target.value),spellCheck:!1,className:`min-h-0 flex-1 resize-none bg-transparent px-5 py-4 font-mono text-[13px] leading-6 tracking-tight focus:outline-none`}):(0,V.jsx)(Df,{text:F?F.cleanedCsv:t,delimiter:h,testId:`input-table`,dark:m,onCellCommit:_,onUndo:b,onRedo:x,onCopySelection:s,columnTypes:T,onChangeColumnTypes:E,onProjectedCsvChange:S})]}):(0,V.jsxs)(V.Fragment,{children:[fe.length>0?(0,V.jsxs)(`div`,{"data-testid":`json-unwrap-bar`,className:`flex flex-shrink-0 flex-wrap items-center gap-1.5 border-b border-border bg-muted/30 px-3.5 py-1.5`,children:[(0,V.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Nested array detected:`}),fe.map(e=>(0,V.jsx)(`button`,{type:`button`,"data-testid":`json-unwrap-pill-${e.key}`,onClick:()=>n(e.unwrappedJson),className:`inline-flex cursor-pointer items-center gap-1 rounded-md border border-border bg-background px-2 py-0.5 font-mono text-xs font-medium text-foreground shadow-2xs transition-colors outline-none hover:bg-muted focus-visible:ring-3 focus-visible:ring-ring/50`,children:`Unwrap .${e.key} (${e.rowCount} ${e.rowCount===1?`row`:`rows`})`},e.key))]}):null,pe.length>0?(0,V.jsxs)(`div`,{"data-testid":`json-flatten-bar`,className:`flex flex-shrink-0 flex-wrap items-center justify-between gap-1.5 border-b border-border bg-muted/30 px-3.5 py-1.5`,children:[(0,V.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Nested keys (${pe.length}):`}),(0,V.jsx)(`button`,{type:`button`,"data-testid":`json-flatten-pill`,"aria-pressed":D,onClick:()=>O?.(),className:wt(`inline-flex cursor-pointer items-center gap-1 rounded-md border px-2 py-0.5 font-mono text-xs font-medium shadow-2xs transition-colors outline-none focus-visible:ring-3 focus-visible:ring-ring/50`,D?`border-border bg-background text-foreground hover:bg-muted`:`border-border bg-muted/60 text-muted-foreground hover:bg-muted hover:text-foreground`),children:`${D?`Flattened`:`Flatten`} nested keys (${MD(pe)})`})]}):null,(0,V.jsx)(zE,{value:t,onChange:n,dark:m,testId:`input-editor`})]}),ne?(0,V.jsx)(`div`,{"aria-hidden":`true`,className:`pointer-events-none absolute inset-3 z-10 flex items-center justify-center rounded-xl border-2 border-dashed border-primary/50 bg-background/80 backdrop-blur-sm`,children:(0,V.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:`Drop file to import`})}):null]})})}var PD=/\.(csv|tsv|txt|json|jsonl|ndjson|md|log)$/i;function FD(e){return e.type.startsWith(`text/`)||e.type===`application/json`?!0:PD.test(e.name)}var ID=[{value:`utf-8`,label:`UTF-8`},{value:`windows-1252`,label:`Windows-1252`}];async function LD(e,t){let n=e.stream().getReader(),r=``;try{let e=[],i=0;for(;i<2;){let{done:t,value:r}=await n.read();if(t)break;r&&r.byteLength>0&&(e.push(r),i+=r.byteLength)}let a=null;if(e.length===1)a=e[0];else if(e.length>1){a=new Uint8Array(i);let t=0;for(let n of e)a.set(n,t),t+=n.byteLength}let o=t;t===`utf-8`&&a&&a.byteLength>=2&&(a[0]===255&&a[1]===254?o=`utf-16le`:a[0]===254&&a[1]===255&&(o=`utf-16be`));let s=new TextDecoder(o,{fatal:!1});for(a&&(r+=s.decode(a,{stream:!0}));;){let{done:e,value:t}=await n.read();if(e)break;r+=s.decode(t,{stream:!0})}return r+s.decode()}finally{n.releaseLock()}}function RD(e){let t=typeof window<`u`&&typeof window.matchMedia==`function`,n=(0,g.useCallback)(n=>{if(!t)return()=>{};let r=window.matchMedia(e);return r.addEventListener(`change`,n),()=>r.removeEventListener(`change`,n)},[e,t]),r=(0,g.useCallback)(()=>t?window.matchMedia(e).matches:!1,[e,t]);return(0,g.useSyncExternalStore)(n,r,()=>!1)}var zD=[{value:`auto`,label:`Auto-detect`},{value:`,`,label:`Comma`},{value:`;`,label:`Semicolon`},{value:` `,label:`Tab`},{value:`|`,label:`Pipe`}];function BD(){return(0,V.jsx)(`div`,{className:`hidden h-5 w-px shrink-0 bg-border fit:block`,"aria-hidden":`true`})}function VD(e,t){let n=[t.separator===`auto`?`Auto`:zD.find(e=>e.value===t.separator)?.label??`Auto`];return e===`csv2json`?(t.parseNumbers&&n.push(`Parse numbers`),t.parseJSON&&n.push(`Parse JSON`),t.emptyFields===`skip`&&n.push(`Skip empty`),t.nullLiterals===`null`&&n.push(`NULL→null`),t.transpose&&n.push(`Transpose`),t.hash&&n.push(`Hash`),t.minify&&n.push(`Minify`)):t.flatten&&n.push(`Flatten`),n.join(` · `)}function HD(){return`h-7 cursor-pointer appearance-none rounded-md border border-border bg-background py-0 pl-2.5 pr-6 text-[13px] font-medium text-foreground transition-colors outline-none hover:bg-muted focus-visible:ring-3 focus-visible:ring-ring/50`}function UD(){return(0,V.jsx)(`svg`,{"aria-hidden":`true`,viewBox:`0 0 16 16`,className:`pointer-events-none absolute top-1/2 right-1.5 size-3.5 -translate-y-1/2 text-muted-foreground`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,children:(0,V.jsx)(`path`,{d:`m4 6 4 4 4-4`,strokeLinecap:`round`,strokeLinejoin:`round`})})}function WD({children:e}){return(0,V.jsx)(`span`,{className:`font-mono text-[11px] font-semibold tracking-[0.14em] whitespace-nowrap text-muted-foreground/70 uppercase`,children:e})}function GD({label:e,checked:t,onChange:n,hint:r}){return(0,V.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,V.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 whitespace-nowrap text-[13px] text-muted-foreground transition-colors hover:text-foreground`,children:[(0,V.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":t,"aria-label":e,onClick:()=>n(!t),className:`flex h-6 shrink-0 cursor-pointer items-center rounded-full outline-none focus-visible:ring-3 focus-visible:ring-ring/50`,children:(0,V.jsx)(`span`,{className:wt(`relative inline-flex h-[18px] w-8 items-center rounded-full border transition-colors`,t?`border-primary bg-primary`:`border-border bg-muted`),children:(0,V.jsx)(`span`,{className:wt(`pointer-events-none inline-block size-3 rounded-full bg-background shadow-sm transition-transform`,t?`translate-x-[15px]`:`translate-x-[2px]`)})})}),(0,V.jsx)(`span`,{className:`select-none`,children:e})]}),r?(0,V.jsx)(KD,{text:r}):null]})}function KD({text:e}){let t=(0,g.useId)(),[n,r]=(0,g.useState)(!1);return(0,V.jsxs)(`span`,{className:`relative inline-flex items-center`,children:[(0,V.jsx)(`button`,{type:`button`,"aria-label":`What does this option do?`,"aria-expanded":n,"aria-describedby":t,title:`What does this option do?`,onClick:()=>r(e=>!e),className:`flex h-4 w-4 cursor-pointer items-center justify-center rounded-full border border-border text-[9px] font-semibold leading-none text-muted-foreground hover:text-foreground`,children:`i`}),(0,V.jsx)(`span`,{"data-hint":!0,id:t,hidden:!n,className:`ml-1 text-muted-foreground`,children:e})]})}function qD({direction:e,options:t,onChange:n,notice:r,uploadEncoding:i,onUploadEncodingChange:a}){let[o,s]=(0,g.useState)(!1),c=(0,g.useRef)(null),l=(0,g.useRef)(null),u=RD(`(min-width: 98.5rem)`),d=e===`csv2json`,f=VD(e,t),p=(0,g.useCallback)(()=>{s(!1),c.current?.focus()},[]);(0,g.useEffect)(()=>{if(!o)return;let e=e=>{e.key===`Escape`&&p()},t=e=>{let t=l.current;t!==null&&e.target instanceof Node&&(t.contains(e.target)||p())};return document.addEventListener(`keydown`,e),document.addEventListener(`click`,t),()=>{document.removeEventListener(`keydown`,e),document.removeEventListener(`click`,t)}},[o,p]);let m=(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,V.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(WD,{children:`Separator`}),(0,V.jsxs)(`span`,{className:`relative inline-flex`,children:[(0,V.jsx)(`select`,{"data-testid":`opt-separator`,value:t.separator,onChange:e=>n({separator:e.target.value}),className:HD(),children:zD.map(e=>(0,V.jsx)(`option`,{value:e.value,children:e.label},e.value))}),(0,V.jsx)(UD,{})]})]}),(0,V.jsx)(KD,{text:`Auto-detect is conservative — it only picks comma, semicolon, or tab. Pipe never auto-detects because normal prose is full of pipes, so pipe-separated text must be selected explicitly.`})]}),i&&a?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(BD,{}),(0,V.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,V.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(WD,{children:`Encoding`}),(0,V.jsxs)(`span`,{className:`relative inline-flex`,children:[(0,V.jsx)(`select`,{"data-testid":`opt-encoding`,value:i,onChange:e=>a(e.target.value),className:HD(),children:ID.map(e=>(0,V.jsx)(`option`,{value:e.value,children:e.label},e.value))}),(0,V.jsx)(UD,{})]})]}),(0,V.jsx)(KD,{text:`Applies to file uploads and drops only — pasted or typed text is always read as UTF-8. Switch to Windows-1252 for CSVs saved by legacy Excel to fix mangled accents like ü and ö.`})]})]}):null,(0,V.jsx)(BD,{}),d?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(GD,{label:`Parse numbers`,checked:t.parseNumbers,onChange:e=>n({parseNumbers:e}),hint:`On by default — plain numbers like 5 or 19.99 become real JSON numbers; leading-zero values like 00721 and very long IDs stay strings. Uncheck to keep numeric cells as strings — booleans, null, and containers still convert while Parse JSON is on.`}),(0,V.jsx)(GD,{label:`Parse JSON`,checked:t.parseJSON,onChange:e=>n({parseJSON:e}),hint:`Turns null, true, false, [] and {} into real JSON values instead of strings.`}),(0,V.jsx)(GD,{label:`Skip empty fields`,checked:t.emptyFields===`skip`,onChange:e=>n({emptyFields:e?`skip`:`keep`}),hint:`Empty cells are dropped from the output instead of becoming "" — a column that is empty in every row disappears from the output and the counts.`}),(0,V.jsx)(GD,{label:`NULL as null`,checked:t.nullLiterals===`null`,onChange:e=>n({nullLiterals:e?`null`:`string`}),hint:`The string NULL becomes JSON null. Matching is exact and case-sensitive — SQL exports write uppercase NULL; Null and nULL are untouched, and lowercase null already converts when Parse JSON is on.`}),(0,V.jsx)(GD,{label:`Transpose`,checked:t.transpose,onChange:e=>n({transpose:e}),hint:`Flip rows and columns — the first column becomes the header row.`}),(0,V.jsx)(GD,{label:`Hash output`,checked:t.hash,onChange:e=>n({hash:e}),hint:`The first column becomes the object key instead of a field.`}),(0,V.jsx)(GD,{label:`Minify`,checked:t.minify,onChange:e=>n({minify:e}),hint:`Remove indentation from the JSON output. Data is untouched.`})]}):(0,V.jsx)(GD,{label:`Flatten nested arrays`,checked:t.flatten,onChange:e=>n({flatten:e}),hint:`Explode nested arrays into extra rows with dotted keys — needed when the JSON isn't a flat table.`})]});return u?(0,V.jsx)(`div`,{"data-testid":`options-row`,className:`flex flex-shrink-0 flex-row items-center gap-5 border-t border-border bg-panel px-5 py-2.5 text-[13px] text-muted-foreground`,children:(0,V.jsxs)(`div`,{"data-testid":`options-settings-menu`,role:`group`,"aria-label":`Parse settings`,className:`flex flex-1 flex-wrap items-center gap-x-4 gap-y-2.5`,children:[m,r?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`div`,{className:`flex-1`}),(0,V.jsx)(`span`,{"data-testid":`options-notice`,children:r})]}):null]})}):(0,V.jsxs)(`div`,{"data-testid":`options-row`,ref:l,className:`relative flex flex-shrink-0 flex-col border-t border-border bg-panel px-3.5 py-2 text-[13px] text-muted-foreground md:px-4`,children:[(0,V.jsxs)(`div`,{className:`flex w-full items-center gap-2`,children:[(0,V.jsxs)(`button`,{type:`button`,ref:c,"data-testid":`options-settings-toggle`,"aria-expanded":o,"aria-haspopup":`true`,onClick:()=>o?p():s(!0),className:`inline-flex shrink-0 cursor-pointer items-center gap-1.5 whitespace-nowrap rounded-md py-0.5 text-[13px] font-medium text-foreground outline-none focus-visible:ring-3 focus-visible:ring-ring/50`,children:[`Parse settings`,(0,V.jsx)(de,{"aria-hidden":`true`,className:wt(`size-3.5 shrink-0 transition-transform`,o&&`rotate-180`)})]}),(0,V.jsx)(`span`,{"data-testid":`options-settings-summary`,className:`min-w-0 truncate`,children:f}),r?(0,V.jsx)(`span`,{"data-testid":`options-notice`,className:`ml-auto shrink-0 text-right`,children:r}):null]}),(0,V.jsx)(`div`,{"data-testid":`options-settings-menu`,role:`group`,"aria-label":`Parse settings`,hidden:!o,className:wt(`absolute bottom-full left-0 z-50 mb-2 w-full items-center gap-x-4 gap-y-2.5 rounded-md border border-border bg-panel p-3 shadow-md`,o?`flex flex-wrap`:`hidden`),children:m})]})}var JD=[{format:`json`,label:`JSON`,extension:`json`,mime:`application/json`},{format:`jsonl`,label:`JSONL`,extension:`jsonl`,mime:`application/x-ndjson`},{format:`sql`,label:`SQL`,extension:`sql`,mime:`application/sql`},{format:`ts`,label:`TS`,extension:`ts`,mime:`text/typescript`}],YD=new Set([`csv`,`tsv`,`txt`,`json`,`jsonl`,`sql`,`ts`]),XD=/^[A-Za-z_$][A-Za-z0-9_$]*$/;function ZD(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function QD(e){if(Array.isArray(e))return e.map(e=>ZD(e)?e:{value:e});if(ZD(e)){let t=Object.entries(e);return t.length===0?[]:t.every(([,e])=>ZD(e))?t.map(([e,t])=>{let n=t;return`key`in n?n:{key:e,...n}}):[e]}return[]}function $D(e){let t=new Set,n=[];for(let r of e)for(let e of Object.keys(r))t.has(e)||(t.add(e),n.push(e));return n}function eO(e){if(!e)return`data`;let t=e.trim(),n=Math.max(t.lastIndexOf(`/`),t.lastIndexOf(`\\`));for(n>=0&&(t=t.slice(n+1));;){let e=t.lastIndexOf(`.`);if(e<=0)break;if(e===t.length-1){t=t.slice(0,e);continue}let n=t.slice(e+1).toLowerCase();if(!YD.has(n))break;t=t.slice(0,e)}let r=t.replace(/[^a-zA-Z0-9]+/g,`_`).replace(/^_+|_+$/g,``);return r.length>0?r:`data`}function tO(e){return`"${e.replace(/"/g,`""`)}"`}function nO(e){let t=e.filter(e=>e!=null);return t.length===0?`TEXT`:t.every(e=>typeof e==`boolean`)?`BOOLEAN`:t.every(e=>typeof e==`number`&&Number.isFinite(e))?t.every(e=>Number.isInteger(e))?`INTEGER`:`NUMERIC`:`TEXT`}function rO(e){return e==null?`NULL`:typeof e==`boolean`?e?`TRUE`:`FALSE`:typeof e==`number`?Number.isFinite(e)?String(e):`NULL`:typeof e==`string`?`'${e.replace(/'/g,`''`)}'`:`'${JSON.stringify(e).replace(/'/g,`''`)}'`}function iO(e){let t=e.trim();if(t===``)return``;let n;try{n=JSON.parse(t)}catch{return e}return QD(n).map(e=>JSON.stringify(e)).join(` +`)}function aO(e,t){let n=e.trim();if(n===``)return``;let r;try{r=JSON.parse(n)}catch{return e}let i=QD(r),a=$D(i),o=tO(eO(t));if(a.length===0)return`CREATE TABLE ${o} ();`;let s=`CREATE TABLE ${o} (\n${a.map(e=>{let t=nO(i.map(t=>t[e]));return` ${tO(e)} ${t}`}).join(`, +`)}\n);`;return i.length===0?s:`${s}\n\n${`INSERT INTO ${o} (${a.map(tO).join(`, `)}) VALUES\n${i.map(e=>` (${a.map(t=>rO(e[t])).join(`, `)})`).join(`, +`)};`}`}function oO(e){if(e===null)return`null`;if(typeof e==`string`)return`string`;if(typeof e==`number`)return`number`;if(typeof e==`boolean`)return`boolean`;if(Array.isArray(e)){if(e.length===0)return`unknown[]`;let t=cO(Array.from(new Set(e.map(e=>oO(e)))));return t.length===1?`${t[0]}[]`:`(${t.join(` | `)})[]`}return ZD(e)?`Record`:`unknown`}var sO={string:1,number:2,boolean:3,"Record":4,unknown:90,null:100};function cO(e){return[...e].sort((e,t)=>{let n=sO[e]??50,r=sO[t]??50;return n===r?e.localeCompare(t):n-r})}function lO(e){return XD.test(e)?e:JSON.stringify(e)}function uO(e){let t=e.trim();if(t===``)return``;let n;try{n=JSON.parse(t)}catch{return e}let r=QD(n),i=$D(r).map(e=>{let t=!1,n=new Set;for(let i of r)!Object.prototype.hasOwnProperty.call(i,e)||i[e]===void 0?t=!0:n.add(oO(i[e]));let i=cO(Array.from(n)),a=i.length>0?i.join(` | `):`unknown`,o=t?`?`:``;return` ${lO(e)}${o}: ${a};`});return`${i.length>0?`export interface DataRow {\n${i.join(` +`)}\n}`:`export interface DataRow {}`}\n\nexport const data: DataRow[] = ${JSON.stringify(r,null,2)};`}function dO(e,t,n,r){let i=typeof e==`string`?e:e.text,a=typeof n==`string`||n===null?n:r??null;switch(t){case`json`:return i;case`jsonl`:return iO(i);case`sql`:return aO(i,a);case`ts`:return uO(i)}}var fO=3;function pO(e){let t=e.slice(0,fO),n=e.length-t.length;return(n>0?[...t,`+${n} more`]:t).join(` +`)}function mO({format:e,inputEmpty:t,outputText:n,error:r,meta:i,staleNotice:a,warnings:o,edited:s,editable:c,egressFormat:l=`json`,delimiter:u,dark:d,onCopy:f,onCopySelection:p,onProjectedCsvChange:m,onNativeCopy:h,onDownload:g,onEgressFormatChange:_,onOutputChange:v,onRevert:y,onDiscardReconvert:b}){let x=e===`JSON`,S=l===`json`;return(0,V.jsx)(`div`,{"data-testid":`output-pane`,"data-surface":`output`,className:`flex min-h-0 min-w-0 flex-1 flex-col bg-muted/30`,children:(0,V.jsx)(BE,{title:e,meta:t?null:s?(0,V.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,V.jsx)(`span`,{"data-testid":`edited-badge`,role:`status`,"aria-label":`Output edited`,className:`rounded-full bg-amber-100 px-2 py-0.5 text-[10px] font-semibold uppercase tracking-[0.08em] text-amber-700 dark:bg-amber-400/15 dark:text-amber-400`,children:`Edited`}),(0,V.jsxs)(`button`,{type:`button`,"data-testid":`revert-output`,onClick:y,className:VE,children:[(0,V.jsx)(ve,{"aria-hidden":`true`}),`Revert`]})]}):a?(0,V.jsx)(`span`,{"data-testid":`stale-notice`,className:`text-xs text-amber-600 dark:text-amber-400`,children:a}):i,actions:(0,V.jsxs)(V.Fragment,{children:[x?(0,V.jsx)(`span`,{"data-testid":`output-format-switcher`,role:`group`,"aria-label":`Output format`,className:`inline-flex items-center gap-0.5 rounded-lg border border-border bg-muted/60 p-0.5`,children:JD.map(e=>{let t=l===e.format;return(0,V.jsx)(`button`,{type:`button`,"data-testid":`output-format-option-${e.format}`,"aria-pressed":t,onClick:()=>_?.(e.format),className:wt(`inline-flex cursor-pointer items-center rounded-[7px] px-1.5 py-0.5 font-mono text-[11px] font-medium transition-all outline-none focus-visible:ring-3 focus-visible:ring-ring/50 sm:px-2 sm:py-1`,t?`bg-background text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground`),children:e.label},e.format)})}):null,(0,V.jsxs)(`button`,{type:`button`,"data-testid":`copy-output`,"aria-label":`Copy`,title:`Copy`,onClick:f,disabled:!n,className:VE,children:[(0,V.jsx)(he,{"aria-hidden":`true`}),(0,V.jsx)(`span`,{className:`hidden xl:inline`,children:`Copy`})]}),(0,V.jsxs)(`button`,{type:`button`,"data-testid":`download-output`,"aria-label":`Download`,title:`Download`,onClick:g,disabled:!n,className:VE,children:[(0,V.jsx)(ge,{"aria-hidden":`true`}),(0,V.jsx)(`span`,{className:`hidden xl:inline`,children:`Download`})]})]}),status:s?{kind:`notice`,message:`Output edited — CSV and option changes aren't applied.`,action:b?(0,V.jsxs)(`button`,{type:`button`,"data-testid":`discard-reconvert`,onClick:b,className:VE+` ml-2`,children:[(0,V.jsx)(ve,{"aria-hidden":`true`}),`Discard edits & reconvert`]}):void 0}:r?{kind:`error`,message:r}:o&&o.length>0?{kind:`notice`,message:pO(o)}:null,children:t?(0,V.jsxs)(`div`,{className:`flex flex-1 items-center justify-center p-6 text-sm text-muted-foreground`,children:[`Your `,e,` appears here.`]}):n?x?(0,V.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,onCopy:()=>h?.(),children:(0,V.jsx)(zE,{value:n,editable:c&&S&&n.length<=2e6,lintJson:S,onChange:v,dark:d,testId:`output-view`})}):(0,V.jsx)(Df,{text:n,delimiter:u,testId:`output-table`,dark:d,onCopySelection:p,onProjectedCsvChange:m}):r?(0,V.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-6 text-sm text-muted-foreground`,children:`Resolve the error to see output.`}):(0,V.jsx)(`div`,{"data-testid":`output-converting-placeholder`,className:`flex flex-1 items-center justify-center p-6 text-sm text-muted-foreground`,children:`Converting…`})})})}function hO({phase:e,message:t,onRetry:n}){return e===`loading`?(0,V.jsx)(`div`,{role:`status`,"aria-busy":`true`,"data-testid":`permalink-loading`,className:`mx-4 mt-3 rounded-md border border-border bg-muted px-4 py-2 text-sm text-muted-foreground`,children:`Loading shared data…`}):e===`not-found`?(0,V.jsxs)(`div`,{role:`alert`,"data-testid":`permalink-notice`,className:`mx-4 mt-3 flex flex-wrap items-center gap-x-2 rounded-md border border-border bg-muted px-4 py-2 text-sm text-foreground`,children:[(0,V.jsx)(`span`,{children:`This data doesn't exist (or was deleted).`}),(0,V.jsx)(`a`,{href:`/`,className:`font-medium underline underline-offset-2`,children:`Go to the converter`})]}):e===`unsupported`?(0,V.jsxs)(`div`,{role:`alert`,"data-testid":`permalink-unsupported`,className:`mx-4 mt-3 flex flex-wrap items-center gap-x-2 rounded-md border border-border bg-muted px-4 py-2 text-sm text-foreground`,children:[(0,V.jsx)(`span`,{children:`This link's saved data can't be shown in the new converter.`}),(0,V.jsx)(`a`,{href:`/`,className:`font-medium underline underline-offset-2`,children:`Go to the converter`})]}):(0,V.jsxs)(`div`,{role:`alert`,"data-testid":`permalink-notice`,className:`mx-4 mt-3 flex flex-wrap items-center gap-x-3 rounded-md border border-border bg-muted px-4 py-2 text-sm text-foreground`,children:[(0,V.jsx)(`span`,{children:t||`Couldn't load this data.`}),(0,V.jsx)(`button`,{type:`button`,"data-testid":`permalink-retry`,onClick:n,className:`rounded-md border border-border bg-background px-2 py-1 text-sm font-medium hover:bg-accent`,children:`Retry`})]})}var gO=`csvjson:recent.v1`,_O=80;function vO(e){return e===`csv2json`||e===`json2csv`}function yO(e){if(!e||typeof e!=`object`||Array.isArray(e))return;let t={};for(let[n,r]of Object.entries(e))(r===`string`||r===`number`||r===`boolean`||r===`auto`)&&(t[n]=r);return Object.keys(t).length>0?t:void 0}function bO(e){if(typeof e!=`object`||!e)return{...gD};let t=e,n=t.separator,r=n===`auto`||n===`,`||n===`;`||n===` `||n===`|`?n:gD.separator,i=t.emptyFields===`keep`||t.emptyFields===`skip`?t.emptyFields:gD.emptyFields,a=t.nullLiterals===`string`||t.nullLiterals===`null`?t.nullLiterals:gD.nullLiterals,o=yO(t.columnTypes);return{separator:r,parseNumbers:typeof t.parseNumbers==`boolean`?t.parseNumbers:gD.parseNumbers,parseJSON:typeof t.parseJSON==`boolean`?t.parseJSON:gD.parseJSON,emptyFields:i,nullLiterals:a,transpose:typeof t.transpose==`boolean`?t.transpose:gD.transpose,hash:typeof t.hash==`boolean`?t.hash:gD.hash,minify:typeof t.minify==`boolean`?t.minify:gD.minify,flatten:typeof t.flatten==`boolean`?t.flatten:gD.flatten,collapseIndexedArrays:typeof t.collapseIndexedArrays==`boolean`?t.collapseIndexedArrays:gD.collapseIndexedArrays,...o?{columnTypes:o}:{}}}function xO(e){let t=(e.split(/\r?\n/).map(e=>e.trim()).find(e=>e.length>0)??``).replace(/\s+/g,` `);return t.length<=_O?t:`${t.slice(0,79)}…`}function SO(e){if(typeof e!=`object`||!e)return!1;let t=e;return!(typeof t.id!=`string`||t.id.trim()===``||typeof t.createdAt!=`number`||!Number.isFinite(t.createdAt)||!vO(t.direction)||typeof t.input!=`string`||t.input.trim()===``||t.input.length>1e5||t.filename!==null&&typeof t.filename!=`string`||typeof t.rows!=`number`||!Number.isInteger(t.rows)||t.rows<0||typeof t.cols!=`number`||!Number.isInteger(t.cols)||t.cols<0||typeof t.preview!=`string`)}function CO(e){return{id:e.id,createdAt:e.createdAt,direction:e.direction,input:e.input,options:bO(e.options),filename:e.filename,rows:e.rows,cols:e.cols,preview:e.preview||xO(e.input)}}function wO(e){try{if(typeof window>`u`)return;window.localStorage.setItem(gO,JSON.stringify(e))}catch{}}function TO(e){return typeof globalThis.crypto?.randomUUID==`function`?globalThis.crypto.randomUUID():`snap-${e}-${Math.random().toString(36).slice(2,10)}`}function EO(){try{if(typeof window>`u`)return[];let e=window.localStorage.getItem(gO);if(e===null)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(SO).map(CO).sort((e,t)=>t.createdAt-e.createdAt).slice(0,10):[]}catch{return[]}}function DO(e){let t=EO(),n=e.input.trim();if(n===``||e.input.length>1e5||e.rows<=0&&e.cols<=0)return t;let r=e.createdAt??Date.now(),i=[{id:t.find(t=>t.direction===e.direction&&t.input.trim()===n)?.id??TO(r),createdAt:r,direction:e.direction,input:e.input,options:bO(e.options),filename:e.filename,rows:e.rows,cols:e.cols,preview:xO(e.input)},...t.filter(t=>t.direction!==e.direction||t.input.trim()!==n)].slice(0,10);return wO(i),i}function OO(e){let t=EO().filter(t=>t.id!==e);return wO(t),t}function kO(){try{if(typeof window>`u`)return;window.localStorage.removeItem(gO)}catch{}}function AO(e,t=Date.now()){let n=Math.max(0,t-e),r=Math.floor(n/1e3);if(r<45)return`just now`;let i=Math.floor(r/60);if(i<60)return`${i}m ago`;let a=Math.floor(i/60);if(a<24)return`${a}h ago`;let o=Math.floor(a/24);return o===1?`yesterday`:o<7?`${o}d ago`:new Date(e).toLocaleDateString(`en-US`,{month:`short`,day:`numeric`})}function jO(e){return e===`csv2json`?`CSV→JSON`:`JSON→CSV`}function MO(e,t){return e>0&&t>0?`${e} rows · ${t} cols`:e>0?`${e} rows`:t>0?`${t} cols`:`0 rows`}function NO({snapshots:e,onSelect:t,onRemove:n,onClear:r}){let[i,a]=(0,g.useState)(!1),o=(0,g.useRef)(null),s=(0,g.useRef)(null),c=(0,g.useCallback)(()=>{a(!1)},[]),l=(0,g.useRef)(!1);(0,g.useEffect)(()=>{l.current&&!i&&s.current?.focus(),l.current=i},[i]),(0,g.useEffect)(()=>{if(!i)return;let e=e=>{e.key===`Escape`&&c()},t=e=>{let t=o.current;t!==null&&e.target instanceof Node&&(t.contains(e.target)||c())};return document.addEventListener(`keydown`,e),document.addEventListener(`click`,t),()=>{document.removeEventListener(`keydown`,e),document.removeEventListener(`click`,t)}},[i,c]);let u=e.length;return(0,V.jsxs)(`div`,{"data-testid":`recent-history`,ref:o,className:`relative max-sm:static`,children:[(0,V.jsxs)(`button`,{type:`button`,"data-testid":`recent-history-toggle`,ref:s,onClick:()=>a(e=>!e),"aria-expanded":i,"aria-haspopup":`dialog`,"aria-label":`Recent conversions`,title:`Recent conversions`,className:`relative inline-flex h-8 cursor-pointer items-center gap-1.5 rounded-lg border border-border bg-panel px-2.5 text-xs font-medium text-muted-foreground transition-colors outline-none hover:bg-muted hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50`,children:[(0,V.jsx)(pe,{size:14,strokeWidth:2,"aria-hidden":`true`}),(0,V.jsx)(`span`,{className:`hidden sm:inline`,children:`Recent`}),u>0&&(0,V.jsx)(`span`,{"data-testid":`recent-history-count`,className:`rounded-full bg-muted px-1.5 py-px text-[10px] font-semibold tabular-nums text-foreground`,children:u})]}),i&&(0,V.jsxs)(`div`,{"data-testid":`recent-history-popout`,role:`dialog`,"aria-label":`Recent conversions`,className:`absolute right-0 top-9 z-50 w-80 rounded-md border border-border bg-panel shadow-md max-sm:inset-x-2 max-sm:top-14 max-sm:w-auto`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border py-1.5 pl-3 pr-1.5`,children:[(0,V.jsx)(`span`,{className:`text-xs font-semibold tracking-tight text-foreground`,children:`Recent conversions`}),(0,V.jsxs)(`div`,{className:`flex items-center gap-1`,children:[u>0&&(0,V.jsx)(`button`,{type:`button`,"data-testid":`recent-history-clear`,onClick:()=>{r()},className:`cursor-pointer rounded-md px-2 py-1 text-[11px] font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,children:`Clear history`}),(0,V.jsx)(`button`,{type:`button`,"data-testid":`recent-history-close`,onClick:c,"aria-label":`Close recent conversions`,className:`flex size-6 cursor-pointer items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,children:(0,V.jsx)(Te,{size:14,strokeWidth:2,"aria-hidden":`true`})})]})]}),u===0?(0,V.jsx)(`div`,{"data-testid":`recent-history-empty`,className:`px-3 py-6 text-center text-xs text-muted-foreground`,children:`No recent conversions saved on this device yet.`}):(0,V.jsx)(`div`,{className:`max-h-96 divide-y divide-border overflow-y-auto`,children:e.map(e=>(0,V.jsxs)(`div`,{className:`flex items-start justify-between gap-1 px-2 py-2 transition-colors hover:bg-muted/50`,children:[(0,V.jsxs)(`button`,{type:`button`,"data-testid":`recent-history-item-${e.id}`,onClick:()=>{t(e),c()},className:`flex min-w-0 flex-1 cursor-pointer flex-col items-start text-left outline-none focus-visible:ring-2 focus-visible:ring-ring/50 rounded-sm px-1 py-0.5`,children:[(0,V.jsxs)(`div`,{className:`mb-1 flex w-full items-center gap-1.5`,children:[(0,V.jsx)(`span`,{className:`rounded-full border border-border px-1.5 py-px text-[10px] font-medium uppercase tracking-wide text-muted-foreground`,children:jO(e.direction)}),(0,V.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:MO(e.rows,e.cols)}),(0,V.jsx)(`span`,{className:`ml-auto text-[11px] text-muted-foreground`,children:AO(e.createdAt)})]}),(0,V.jsx)(`span`,{className:`w-full truncate font-mono text-xs text-foreground`,children:e.filename??e.preview})]}),(0,V.jsx)(`button`,{type:`button`,"data-testid":`recent-history-delete-${e.id}`,onClick:t=>{t.stopPropagation(),n(e.id)},"aria-label":`Delete recent snapshot ${e.filename??e.preview}`,title:`Delete snapshot`,className:`mt-0.5 flex size-6 shrink-0 cursor-pointer items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,children:(0,V.jsx)(we,{size:13,strokeWidth:2,"aria-hidden":`true`})})]},e.id))})]})]})}function PO(e){return Math.min(80,Math.max(20,e))}function FO({layout:e,split:t,onSplitChange:n,left:r,right:i,children:a}){let o=(0,g.useRef)(null),[s,c]=(0,g.useState)(!1),l=e===`stacked`;return(0,g.useEffect)(()=>{if(!s)return;let e=e=>{let t=o.current?.getBoundingClientRect();t&&t.width!==0&&t.height!==0&&n(PO((l?(e.clientY-t.top)/t.height:(e.clientX-t.left)/t.width)*100))},t=()=>c(!1);return window.addEventListener(`pointermove`,e),window.addEventListener(`pointerup`,t),window.addEventListener(`pointercancel`,t),()=>{window.removeEventListener(`pointermove`,e),window.removeEventListener(`pointerup`,t),window.removeEventListener(`pointercancel`,t)}},[s,l,n]),(0,V.jsxs)(`div`,{ref:o,className:wt(`relative flex min-h-0 flex-1`,`flex-col md:flex-row`,s&&`select-none`),children:[(0,V.jsx)(`div`,{"data-testid":`pane-left`,style:{"--split":`${t}%`},className:wt(`flex min-h-0 min-w-0 flex-col overflow-hidden border-border bg-panel max-md:min-h-[280px] max-md:max-h-[360px]`,`h-[var(--split)] border-b`,`md:h-auto md:w-[var(--split)] md:border-b-0 md:border-r`),children:r}),(0,V.jsxs)(`div`,{"data-testid":`seam`,role:`separator`,tabIndex:0,"aria-orientation":l?`horizontal`:`vertical`,"aria-valuenow":Math.round(t),"aria-valuemin":20,"aria-valuemax":80,"aria-label":`Resize panes`,title:`Drag to resize · double-click to reset`,onPointerDown:e=>{e.target instanceof Element&&e.target.closest(`button`)||(e.preventDefault(),e.currentTarget.setPointerCapture?.(e.pointerId),c(!0))},onPointerUp:()=>c(!1),onDoubleClick:()=>n(50),onKeyDown:e=>{let r=e.shiftKey?5:1;switch(e.key){case`ArrowLeft`:case`ArrowUp`:e.preventDefault(),n(PO(t-r));break;case`ArrowRight`:case`ArrowDown`:e.preventDefault(),n(PO(t+r));break;case`Home`:e.preventDefault(),n(20);break;case`End`:e.preventDefault(),n(80);break;case`Enter`:case` `:e.preventDefault(),n(50)}},style:{"--split":`${t}%`,touchAction:`none`},className:wt(`relative z-10 flex h-9 flex-shrink-0 items-center justify-center border-b border-border bg-muted/20 cursor-row-resize`,`md:absolute md:top-0 md:right-auto md:bottom-0 md:left-[var(--split)] md:h-auto md:w-0 md:border-b-0 md:bg-transparent md:cursor-col-resize`),children:[(0,V.jsx)(`div`,{className:wt(`absolute`,`inset-0`,`md:inset-auto md:top-0 md:right-auto md:bottom-0 md:-left-1.5 md:h-auto md:w-3`)}),a?(0,V.jsx)(`div`,{className:`relative z-10 md:absolute md:left-1/2 md:top-1/2 md:-translate-x-1/2 md:-translate-y-1/2`,children:a}):null]}),(0,V.jsx)(`div`,{"data-testid":`pane-right`,className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden bg-panel max-md:min-h-[240px] max-md:max-h-[340px]`,children:i})]})}function IO({theme:e}){return e===`dark`?(0,V.jsx)(xe,{size:15,strokeWidth:2,"aria-hidden":`true`}):(0,V.jsx)(L,{size:15,strokeWidth:2,"aria-hidden":`true`})}function LO({theme:e,onToggleTheme:t,slot:n}){return(0,V.jsxs)(`header`,{"data-testid":`topbar`,className:`relative flex h-14 flex-shrink-0 items-center gap-3 border-b border-border bg-panel px-5`,children:[(0,V.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,V.jsx)(`span`,{className:`text-[15px] font-semibold tracking-tight text-foreground whitespace-nowrap`,children:`csvjson`}),(0,V.jsx)(`span`,{className:`hidden text-[13px] font-medium text-muted-foreground sm:inline`,children:`CSV → JSON converter`})]}),(0,V.jsx)(`div`,{className:`flex-1`}),(0,V.jsx)(`div`,{"data-testid":`topbar-slot`,children:n}),(0,V.jsx)(`button`,{type:`button`,"data-testid":`theme-toggle`,onClick:t,"aria-label":e===`dark`?`Switch to light mode`:`Switch to dark mode`,title:e===`dark`?`Switch to light mode`:`Switch to dark mode`,className:`inline-flex size-8 cursor-pointer items-center justify-center rounded-lg border border-border bg-panel text-muted-foreground transition-colors outline-none hover:bg-muted hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50`,children:(0,V.jsx)(IO,{theme:e})})]})}function RO(e){return[...e].sort((e,t)=>t.id-e.id)}var zO=[{id:24,date:`2026-10-20`,tag:`improvement`,title:`Clearer supported paste and upload formats in the input area`,summary:`The empty-state input area and file picker now explicitly list every accepted format in each mode — CSV, TSV / spreadsheet cells, Markdown & ChatGPT multi-table docs, and psql/MySQL box tables in CSV → JSON, plus JSON arrays, nested objects, wrapped API payloads, and JSONL / NDJSON in JSON → CSV.`},{id:23,date:`2026-10-20`,tag:`new`,title:`Extract and switch between multiple tables in pasted Markdown`,summary:`Paste an entire ChatGPT response or Markdown document containing prose and multiple Markdown or CLI box tables into CSV → JSON: every table is detected in order with interactive chooser pills to switch which table is previewed and converted, or keep only the selected table as clean CSV.`},{id:22,date:`2026-10-20`,tag:`new`,title:`Column visibility picker and Apply view to output`,summary:`Use the new Columns menu in any data table to hide or restore columns without touching your raw input. When a search filter, sort order, or column subset is active, toggle Apply view to output to project that exact table view into the converted output, Copy, and Download.`},{id:21,date:`2026-10-20`,tag:`new`,title:`Paste Markdown & CLI box tables directly into CSV → JSON`,summary:`Paste GitHub/ChatGPT Markdown pipe tables or psql/MySQL ASCII box tables directly into CSV → JSON: divider rows, outer pipes, and (N rows) footers are stripped automatically, with a one-click Clean table action to normalize the raw CSV in place.`},{id:20,date:`2026-10-20`,tag:`new`,title:`One-click nested JSON flattening in JSON → CSV`,summary:`When JSON → CSV input contains nested objects or arrays, a contextual Flatten nested keys pill appears above the editor to expand deep objects into dotted CSV column headers (like user.profile.name) and join scalar arrays in one click.`},{id:19,date:`2026-10-20`,tag:`new`,title:`Pin per-column types in the CSV grid`,summary:`Select any column in the CSV table to pin its JSON output type to String, Number, Boolean, or Auto — keeping postal codes and IDs as strings or coercing yes/no/1/0 columns to booleans without changing global parse settings.`},{id:18,date:`2026-10-20`,tag:`new`,title:`Live spreadsheet selection aggregates in the table toolbar`,summary:`Select any range of cells, rows, or columns in the data table to see instant cell, distinct, and empty counts alongside numeric Sum, Avg, Min, and Max aggregates. Range selections also expose one-click Copy as CSV right from the toolbar.`},{id:17,date:`2026-10-20`,tag:`new`,title:`Export CSV as JSONL, SQL INSERTs, or TypeScript`,summary:`Switch the CSV → JSON output header between JSON, JSONL, SQL, and TS to generate newline-delimited records, CREATE TABLE and INSERT statements with inferred types, or a typed TypeScript DataRow interface and array ready to copy or download.`},{id:16,date:`2026-10-20`,tag:`new`,title:`Restore recent conversions from the top bar`,summary:`The new Recent menu in the top bar saves up to 10 valid conversions locally on your device so you can jump back to an earlier dataset in one click. Fresh page loads still start on a clean empty dropzone.`},{id:15,date:`2026-10-18`,tag:`improvement`,title:`Options fold into a Parse settings menu`,summary:`On narrower screens the converter's options bar no longer wraps onto extra lines — it collapses to a single Parse settings line showing your active options, with the full control set in a drop-up above it. Small screens lose the accordion that squeezed the panes.`},{id:14,date:`2026-10-17`,tag:`improvement`,title:`Polished mobile stacked panes and collapsible options bar`,summary:`Small screens now stack the input and output panes with an in-flow direction switch and compact icon actions so nothing overlaps. The options bar collapses into a one-tap summary on phones while keeping every setting a tap away.`},{id:13,date:`2026-10-15`,tag:`fix`,title:`Faster large CSV uploads without page freezes`,summary:`Uploading large CSV files now converts in a single pass without freezing the tab or flashing a false error state, previews multi-megabyte JSON outputs smoothly while keeping full Copy and Download, and decodes UTF-16 CSV exports automatically.`},{id:12,date:`2026-10-15`,tag:`improvement`,title:`Table undo, header rename, and smarter JSON input`,summary:`Undo or redo CSV table edits, double-click any column header to rename it in place, and collapse .0, .1 indexed columns into JSON arrays. JSON → CSV now formats or minifies JSON in one click, unwraps nested record arrays, parses JSONL, and previews pipe-delimited output accurately.`},{id:11,date:`2026-10-03`,tag:`improvement`,title:`The switch names the direction`,summary:`The ⇄ switch now labels the active conversion, and legacy /json2csv links land you in JSON → CSV mode again — it never left.`},{id:10,date:`2026-09-08`,tag:`new`,title:`Delete rows and columns from the table`,summary:`Select rows or columns in the input table and delete them by button or the Delete key — the raw CSV updates and reconverts in place, with at least one column always kept. Selected column headers are also readable again in both themes.`},{id:9,date:`2026-09-08`,tag:`new`,title:`Spreadsheet-grade data table`,summary:`The rebuilt data table adds drag-to-select ranges, Shift+Arrow range extension, fill, and spreadsheet-style cell editing — with copy/paste always producing clean CSV.`},{id:8,date:`2026-09-07`,tag:`new`,title:`Search, sort, and select in the data table`,summary:`The CSV table now has a search bar with a live row count, click-to-sort columns, and row selection with copy-as-CSV — on both the input and output tables.`},{id:7,date:`2026-09-07`,tag:`fix`,title:`No more layout flash on load`,summary:`The converter now renders side-by-side immediately on desktop, instead of stacking the panes and snapping into columns as the page loads.`},{id:6,date:`2026-09-07`,tag:`new`,title:`Introducing the changelog`,summary:`This changelog keeps you posted on what's new — recent updates appear here with an unseen dot when you come back. Feel free to vote on what you find useful.`},{id:5,date:`2026-09-05`,tag:`improvement`,title:`Icons match the design`,summary:`Action buttons, view toggle, and the empty state now use the same crisp icon set as the rest of the interface.`},{id:4,date:`2026-09-05`,tag:`new`,title:`Edit the JSON output in place`,summary:`The output pane is now an editor. Hand edits survive until you reconvert; revert and discard keep you safe.`},{id:3,date:`2026-09-05`,tag:`fix`,title:`Pastes land where they belong`,summary:`Paste anywhere on the page and your data routes to the input — including pastes over the read-only output pane.`},{id:2,date:`2026-09-04`,tag:`improvement`,title:`A calmer empty state`,summary:`Empty panes now open on a compact paste field with a Choose file button, so starting is obvious on any screen.`},{id:1,date:`2026-09-04`,tag:`improvement`,title:`Smarter number handling`,summary:`Numbers convert sensibly out of the box: leading-zero values like 00721 and very long IDs stay strings so nothing gets silently mangled.`}],BO=864e5;function VO(e){return Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate())}function HO(e,t=Date.now()){let n=new Date(`${e}T00:00:00Z`),r=new Date(t),i=Math.round((VO(r)-VO(n))/BO);if(i<=0)return`today`;if(i===1)return`yesterday`;if(i<7)return`${i} days ago`;let a=n.toLocaleDateString(`en-US`,{month:`short`,day:`numeric`,timeZone:`UTC`});return n.getUTCFullYear()===r.getUTCFullYear()?a:`${a}, ${n.getUTCFullYear()}`}var UO=`csvjson:changelog.v1`,WO=Math.max(...zO.map(e=>e.id),0),GO=RO(zO);function KO(e){if(typeof e!=`object`||!e)return!1;let t=e;if(t.lastSeenId!==null&&typeof t.lastSeenId!=`number`||typeof t.votes!=`object`||t.votes===null)return!1;for(let[e,n]of Object.entries(t.votes))if(!/^\d+$/.test(e)||n!==1&&n!==-1)return!1;return!(t.clientId!==void 0&&!qO(t.clientId)||t.pendingIds!==void 0&&(!Array.isArray(t.pendingIds)||t.pendingIds.some(e=>typeof e!=`number`||!Number.isInteger(e)||e<1)))}function qO(e){return typeof e==`string`&&/^[0-9a-fA-F-]{8,64}$/.test(e)}function JO(e){return e===void 0?[]:[...new Set(e)].filter(e=>e>=1&&e<=WO).sort((e,t)=>e-t)}function YO(e,t,n){let r=JO(e.pendingIds),i=n?[...new Set([...r,t])].sort((e,t)=>e-t):r.filter(e=>e!==t);return{...e,pendingIds:i}}function XO(){try{let e=window.localStorage.getItem(UO);if(e===null)return{lastSeenId:null,votes:{}};let t=JSON.parse(e);return KO(t)?{...t,pendingIds:JO(t.pendingIds)}:{lastSeenId:null,votes:{}}}catch{return{lastSeenId:null,votes:{}}}}function ZO(e){try{window.localStorage.setItem(UO,JSON.stringify(e))}catch{}}function QO(){if(typeof globalThis.crypto?.randomUUID==`function`)return globalThis.crypto.randomUUID();let e=globalThis.crypto?.getRandomValues?.(new Uint8Array(16));if(e===void 0)throw Error(`no secure randomness available`);e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t=Array.from(e,e=>e.toString(16).padStart(2,`0`)).join(``);return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}async function $O(e,t,n){try{return(await fetch(`/api/changelog-vote`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({clientId:e,entryId:t,vote:n})})).ok?`ok`:`failed`}catch{return`failed`}}function ek(e){return[`flex h-6 w-7 cursor-pointer items-center justify-center rounded-md transition-colors`,e?`bg-muted text-foreground`:`text-muted-foreground hover:bg-muted hover:text-foreground`].join(` `)}function tk({entry:e,vote:t,queued:n,inFlight:r,onVote:i}){return(0,V.jsxs)(`article`,{className:`px-3 py-2.5`,"data-testid":`changelog-entry-${e.id}`,children:[(0,V.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5`,children:[e.tag!==void 0&&(0,V.jsx)(`span`,{className:`rounded-full border border-border px-1.5 py-px text-[10px] font-medium uppercase tracking-wide text-muted-foreground`,children:e.tag}),(0,V.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:HO(e.date)})]}),(0,V.jsx)(`h3`,{className:`text-xs font-semibold text-foreground`,children:e.title}),(0,V.jsx)(`p`,{className:`mt-0.5 text-xs leading-relaxed text-muted-foreground`,children:e.summary}),(0,V.jsxs)(`div`,{className:`mt-1.5 flex gap-1`,children:[(0,V.jsx)(`button`,{type:`button`,"data-testid":`changelog-up-${e.id}`,onClick:()=>i(e.id,1),"aria-pressed":t===1,"aria-label":`Upvote: ${e.title}`,title:`Good change`,className:ek(t===1),children:(0,V.jsx)(Ce,{size:13,strokeWidth:2,"aria-hidden":`true`})}),(0,V.jsx)(`button`,{type:`button`,"data-testid":`changelog-down-${e.id}`,onClick:()=>i(e.id,-1),"aria-pressed":t===-1,"aria-label":`Downvote: ${e.title}`,title:`Not for me`,className:ek(t===-1),children:(0,V.jsx)(z,{size:13,strokeWidth:2,"aria-hidden":`true`})})]}),n&&!r&&(0,V.jsx)(`p`,{"data-testid":`changelog-queued-${e.id}`,role:`status`,className:`mt-1.5 rounded-sm border border-dashed border-border px-2 py-1 text-[11px] text-muted-foreground`,children:`Vote queued — it will retry on your next interaction.`})]})}function nk(){let[e,t]=(0,g.useState)(XO),[n,r]=(0,g.useState)(!1),i=(0,g.useRef)(e),a=(0,g.useCallback)(e=>{ZO(e),i.current=e,t(e)},[]),[o,s]=(0,g.useState)(()=>new Set),c=(0,g.useRef)(new Set),l=(0,g.useRef)(null),u=(0,g.useRef)(null),d=(0,g.useRef)(new Map),f=e.lastSeenId!==null&&WO>e.lastSeenId,p=(0,g.useCallback)((e,t)=>{s(n=>{let r=new Set(n);return t?r.add(e):r.delete(e),r})},[]),m=(0,g.useCallback)((e,t,n,r)=>{let o=(d.current.get(e)??0)+1;d.current.set(e,o),c.current.add(e),r&&p(e,!0),$O(n,e,t).then(n=>{d.current.get(e)===o&&(c.current.delete(e),n===`ok`&&(w({entry_id:e,vote:t}),a(YO(i.current,e,!1))),r&&p(e,!1))})},[a,p]),h=(0,g.useCallback)(e=>{let{clientId:t,pendingIds:n,votes:r}=i.current,a=n??[];if(a.length!==0&&t!==void 0)for(let n of a){if(n===e||c.current.has(n))continue;let i=r[n];i!==void 0&&m(n,i,t,!1)}},[m]),_=(t,n)=>{if(e.votes[t]===n){h();return}let r=e.clientId??QO();a(YO({...e,votes:{...e.votes,[t]:n},clientId:r},t,!0)),m(t,n,r,!0),h(t)},v=()=>{r(!0),C(),e.lastSeenId!==WO&&a({...e,lastSeenId:WO}),h()},y=(0,g.useCallback)(()=>{r(!1)},[]),b=(0,g.useRef)(!1);(0,g.useEffect)(()=>{b.current&&!n&&u.current?.focus(),b.current=n},[n]);let x=(0,g.useRef)(!1);return(0,g.useEffect)(()=>{x.current||(x.current=!0,h())},[h]),(0,g.useEffect)(()=>{if(!n)return;let e=e=>{e.key===`Escape`&&y()},t=e=>{let t=l.current;t!==null&&e.target instanceof Node&&(t.contains(e.target)||y())};return document.addEventListener(`keydown`,e),document.addEventListener(`click`,t),()=>{document.removeEventListener(`keydown`,e),document.removeEventListener(`click`,t)}},[n,y]),(0,V.jsxs)(`div`,{"data-testid":`changelog`,ref:l,className:`relative max-sm:static`,children:[(0,V.jsxs)(`button`,{type:`button`,"data-testid":`changelog-toggle`,ref:u,onClick:()=>n?y():v(),"aria-expanded":n,"aria-haspopup":`dialog`,"aria-label":`Changelog`,title:`What's new`,className:`relative inline-flex size-8 cursor-pointer items-center justify-center rounded-lg border border-border bg-panel text-muted-foreground transition-colors outline-none hover:bg-muted hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50`,children:[(0,V.jsx)(R,{size:15,strokeWidth:2,"aria-hidden":`true`}),f&&(0,V.jsx)(`span`,{"data-testid":`changelog-dot`,"aria-hidden":`true`,className:`absolute right-1 top-1 size-1.5 rounded-full bg-foreground`})]}),n&&(0,V.jsxs)(`div`,{"data-testid":`changelog-popout`,role:`dialog`,"aria-label":`Changelog`,className:`absolute right-0 top-9 z-50 w-80 rounded-md border border-border bg-panel shadow-md max-sm:inset-x-2 max-sm:top-14 max-sm:w-auto`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border py-1.5 pl-3 pr-1.5`,children:[(0,V.jsx)(`span`,{className:`text-xs font-semibold tracking-tight text-foreground`,children:`What's new`}),(0,V.jsx)(`button`,{type:`button`,"data-testid":`changelog-close`,onClick:y,"aria-label":`Close changelog`,className:`flex size-6 cursor-pointer items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,children:(0,V.jsx)(Te,{size:14,strokeWidth:2,"aria-hidden":`true`})})]}),(0,V.jsx)(`div`,{className:`max-h-96 divide-y divide-border overflow-y-auto`,children:GO.map(t=>(0,V.jsx)(tk,{entry:t,vote:e.votes[t.id],queued:e.pendingIds?.includes(t.id)??!1,inFlight:o.has(t.id),onVote:_},t.id))})]})]})}function rk(e,t){let[n,r]=(0,g.useState)(e);return(0,g.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}var ik=[`csv2json`,`json2csv`,`json_validator`,`json_beautifier`,`sql2json`,`csvjson2json`,`datajanitor`],ak=[`csv2json`,`json2csv`,`csvjson2json`];function ok(e){return ak.includes(e)}var sk=/^[0-9a-f]{32}$/i,ck=/^\/([a-z0-9_]+)\/([0-9a-f]{32})\/?$/i,lk=({BASE_URL:`/`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1}.VITE_S3_DATA_URL??`https://csvjson.s3.us-east-2.amazonaws.com/data/`).replace(/\/*$/,`/`);function uk(e){let t=ck.exec(e);if(!t)return null;let n=t[1].toLowerCase();return ik.includes(n)?{tool:n,id:t[2].toLowerCase()}:null}var dk=class extends Error{constructor(){super(`This data doesn't exist (or was deleted)`),this.name=`PermalinkNotFoundError`}},fk=class extends Error{constructor(e,t){super(e,t),this.name=`PermalinkFetchError`}},pk={csv:(e,t)=>{e.direction=`csv2json`,e.input=mk(t)},json:(e,t)=>{e.input=mk(t),e.direction=`json2csv`},parseNumbers:(e,t)=>{let n=gk(t);n!==void 0&&(e.options.parseNumbers=n)},parseJSON:(e,t)=>{let n=gk(t);n!==void 0&&(e.options.parseJSON=n)},transpose:(e,t)=>{let n=gk(t);n!==void 0&&(e.options.transpose=n)},"output-array":(e,t)=>{let n=gk(t);n!==void 0&&(e.options.hash=!n)},"output-hash":(e,t)=>{let n=gk(t);n!==void 0&&(e.options.hash=n)},flatten:(e,t)=>{let n=gk(t);n!==void 0&&(e.options.flatten=n)},output_csvjson_variant:()=>{}};function mk(e){return typeof e==`string`?e:typeof e==`number`?String(e):``}function hk(e){return typeof e==`string`&&e.trim()!==``}function gk(e){if(e===!0||e===`true`)return!0;if(e===!1||e===`false`)return!1}function _k(e){return typeof e!=`object`||!e||Array.isArray(e)?!1:Object.values(e).every(e=>typeof e==`string`||typeof e==`boolean`)}function vk(e){if(!_k(e))return null;let t=hk(e.csv),n=hk(e.json);if(!t&&!n)return null;let r={direction:t?`csv2json`:`json2csv`,input:``,options:{}};for(let[t,n]of Object.entries(e))pk[t]?.(r,n);return r.input=mk(t?e.csv:e.json),r}async function yk(e){if(!sk.test(e))throw new dk;let t;try{t=await fetch(`${lk}${e}`,{mode:`cors`})}catch(e){throw new fk(`Network error while loading this data`,{cause:e})}if(t.status===403||t.status===404)throw new dk;if(!t.ok)throw new fk(`Unexpected response while loading this data (HTTP ${t.status})`);let n;try{let e=await t.text();if(e.trim()===``)throw Error(`empty body`);n=JSON.parse(e)}catch{throw new fk(`Stored data for this link is malformed`)}return n}function bk(e){let t=(0,g.useMemo)(()=>e&&ok(e.tool)?e.id:null,[e]),[n,r]=(0,g.useState)(0),[i,a]=(0,g.useState)(t?`loading`:`idle`),[o,s]=(0,g.useState)(null),[c,l]=(0,g.useState)(``);return(0,g.useEffect)(()=>{if(!t)return;let e=!1;return yk(t).then(t=>{if(e)return;let n=vk(t);n?(s(n),a(`hydrated`)):a(`unsupported`)}).catch(t=>{e||(t instanceof dk?a(`not-found`):(l(t instanceof Error?t.message:`Couldn't load this data`),a(`error`)))}),()=>{e=!0}},[t,n]),{phase:i,hydrated:o,message:c,retry:()=>{i===`error`&&(a(`loading`),r(e=>e+1))}}}async function xk(e){try{if(typeof navigator<`u`&&navigator.clipboard)return await navigator.clipboard.writeText(e),!0}catch{}try{let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,``),t.style.position=`fixed`,t.style.opacity=`0`,document.body.appendChild(t),t.select();let n=document.execCommand(`copy`);return t.remove(),n}catch{return!1}}function Sk(e,t){return t?``+e:e}function Ck(e,t,n){let r=Sk(e,n);return new Blob([r],{type:`${t};charset=utf-8`})}var wk=new Set([`csv`,`tsv`,`json`,`jsonl`,`sql`,`ts`,`txt`]);function Tk(e){let t=e;for(;;){let e=t.lastIndexOf(`.`);if(e<=0)break;if(e===t.length-1)t=t.slice(0,e);else{if(!wk.has(t.slice(e+1).toLowerCase()))break;t=t.slice(0,e)}}return t}function Ek(e,t,n=`json`){let r=t===`csv2json`?n:`csv`;return e?`${Tk(e)}.${r}`:`data.${r}`}function Dk(e,t=`json`){if(e===`json2csv`)return`text/csv`;switch(t){case`json`:return`application/json`;case`jsonl`:return`application/x-ndjson`;case`sql`:return`application/sql`;case`ts`:return`text/typescript`}}function Ok(e,t,{mime:n=`text/plain`,bom:r=!1}={}){let i=Ck(e,n,r),a=URL.createObjectURL(i),o=document.createElement(`a`);return o.href=a,o.download=t,document.body.appendChild(o),o.click(),o.remove(),setTimeout(()=>URL.revokeObjectURL(a),0),t}function kk(e){if(!(e instanceof HTMLElement))return!1;if(e.isContentEditable)return!0;let t=e.tagName;return t===`INPUT`||t===`TEXTAREA`||e.closest(`[contenteditable="true"]`)!==null}var Ak=`album,year,US_peak_chart_post +The White Stripes,1999, +De Stijl,2000, +White Blood Cells,2001,61 +Elephant,2003,6 +Get Behind Me Satan,2005,3 +Icky Thump,2007,2`,jk=`[ + { + "album": "Elephant", + "year": 2003, + "label": "XL Recordings" + }, + { + "album": "Icky Thump", + "year": 2007, + "label": "XL Recordings" + } +]`,Mk=`csvjson-theme`;function Nk(){try{let e=localStorage.getItem(Mk);return e===`dark`||e===`light`?e:null}catch{return null}}function Pk(){try{if(typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-color-scheme: dark)`).matches)return`dark`}catch{}return`light`}function Fk(){return Nk()??Pk()}function Ik(e){try{localStorage.setItem(Mk,e)}catch{}}function Lk(e){return new URLSearchParams(e).get(`direction`)===`json2csv`?`json2csv`:`csv2json`}var Rk=2097152,zk=150,Bk=1e3,Vk=2e3,Hk=2e3;function Uk(e,t){return e===0?null:t>0?`${e} rows · ${t} cols`:`${e} rows`}function Wk(e){try{return JSON.parse(e),!0}catch{return!1}}function Gk(){let[e,t]=(0,g.useState)(Fk);(0,g.useEffect)(()=>{document.documentElement.classList.toggle(`dark`,e===`dark`)},[e]);let n=()=>t(e=>{let t=e===`dark`?`light`:`dark`;return Ik(t),t}),[r,i]=(0,g.useState)(()=>typeof window>`u`?`csv2json`:Lk(window.location.search)),[a,o]=(0,g.useState)(()=>Jd(``)),s=a.present,[c,l]=(0,g.useState)(gD),[u,d]=(0,g.useState)(`json`),[f,p]=(0,g.useState)(50),[m,h]=(0,g.useState)(null),[_,v]=(0,g.useState)(!1),[y,b]=(0,g.useState)(null),[x,C]=(0,g.useState)(`utf-8`),[w,T]=(0,g.useState)(EO),[E,D]=(0,g.useState)(null),[O,A]=(0,g.useState)(null),[ee,te]=(0,g.useState)({forInput:``,index:0}),ne=ee.forInput===s?ee.index:0,j=(0,g.useCallback)(e=>{te({forInput:s,index:e})},[s]),ie=(0,g.useMemo)(()=>ne>0?{...c,markdownTableIndex:ne}:c,[c,ne]),M=(0,g.useRef)({direction:r,options:c,input:s,resultOk:!0}),ae=(0,g.useRef)(null);ae.current||=re({settleMs:Vk,minWindowMs:Hk,isValid:(e,t)=>{let n=M.current;return t===n.input?n.resultOk:OD(e===`csv_to_json`?`csv2json`:`json2csv`,t,n.options).ok}});let N=ae.current;(0,g.useEffect)(()=>()=>N.cancel(),[N]);let oe=RD(`(min-width: 48rem)`)?`side-by-side`:`stacked`,P=r===`csv2json`,se=P?`CSV`:`JSON`,ce=P?`JSON`:`CSV`,F=s.trim()===``,le=s.length>Rk?Bk:zk,ue=rk(s,F?0:le),de=(0,g.useRef)(null),fe=(0,g.useRef)(null),pe=s!==``&&de.current?.text===s?s:ue,me=P&&E!==null&&pe.trim()!==``?E:pe,he=(0,g.useMemo)(()=>typeof window>`u`?null:uk(window.location.pathname),[]),ge=bk(he),I=(0,g.useMemo)(()=>OD(r,me,ie),[r,me,ie]);M.current={direction:r,options:ie,input:pe,resultOk:I.ok},(0,g.useEffect)(()=>{let e=fe.current;e&&e.text===pe&&(fe.current=null,N.discrete(e.direction,e.via,e.text))},[pe,I,N]);let[L,_e]=(0,g.useState)(null);(0,g.useEffect)(()=>{pe.trim()!==``&&I.ok&&_e(I.text)},[I,pe]),(0,g.useEffect)(()=>{pe.trim()!==``&&(!I.ok||I.rows<=0&&I.cols<=0||T(DO({direction:r,input:pe,options:c,filename:m,rows:I.rows,cols:I.cols})))},[r,pe,m,c,I]);let R=pe.trim()!==``&&I.ok?I.text:L,[ve,ye]=(0,g.useState)(!1),[be,xe]=(0,g.useState)(null),Se=ve?be:R,z=(0,g.useMemo)(()=>{if(!P||Se===null||u===`json`)return Se;let e=ve&&be!==null&&Wk(be)?be:R;return e===null?null:dO(e,u,c,m)},[P,Se,u,ve,be,R,c,m]),Ce=P&&u===`json`&&!F&&z!==null&&(ve||I.ok),we=(0,g.useCallback)(e=>{e===R?(ye(!1),xe(null)):(ye(!0),xe(e))},[R]),B=(0,g.useCallback)(()=>{let e=P&&E!==null&&s.trim()!==``?E:s,t=OD(r,e,ie);t.ok&&_e(t.text),ye(!1),xe(null)},[P,r,ie,s,E]),Te=(0,g.useCallback)(e=>{o(t=>P?Yd(t,e):Jd(e))},[P]),Ee=P&&a.past.length>0,De=P&&a.future.length>0,Oe=(0,g.useCallback)(()=>{if(!P||a.past.length===0)return;let e=Xd(a);b(null),o(e),N.edit(`csv_to_json`,e.present)},[P,a,N]),ke=(0,g.useCallback)(()=>{if(!P||a.future.length===0)return;let e=Zd(a);b(null),o(e),N.edit(`csv_to_json`,e.present)},[P,a,N]),Ae=(0,g.useCallback)(e=>{b(null),de.current=null,i(e.direction),l({...e.options}),h(e.filename),ye(!1),xe(null),o(t=>e.direction===`csv2json`&&r===`csv2json`?Yd(t,e.input):Jd(e.input)),T(DO({direction:e.direction,input:e.input,options:e.options,filename:e.filename,rows:e.rows,cols:e.cols}))},[r]),je=(0,g.useCallback)(e=>{T(OO(e))},[]),Me=(0,g.useCallback)(()=>{kO(),T([])},[]),Ne=()=>{let e=r===`csv2json`?`json2csv`:`csv2json`;if(ve){let t=be??``,n=Wk(t)?t:s;o(Jd(n)),i(e),ye(!1),xe(null),n.trim()!==``&&(M.current={direction:e,options:c,input:n,resultOk:OD(e,n,c).ok},N.discrete(e===`csv2json`?`csv_to_json`:`json_to_csv`,`flip`,n))}else if(i(e),F)o(Jd(``));else{let t=OD(r,s,ie),n=t.ok?t.text:s;o(Jd(n)),n.trim()!==``&&(M.current={direction:e,options:c,input:n,resultOk:OD(e,n,c).ok},N.discrete(e===`csv2json`?`csv_to_json`:`json_to_csv`,`flip`,n))}},Pe=ge.hydrated;(0,g.useEffect)(()=>{if(Pe===null)return;let e={...M.current.options,...Pe.options};M.current={direction:Pe.direction,options:e,input:Pe.input,resultOk:OD(Pe.direction,Pe.input,e).ok},i(Pe.direction),o(Jd(Pe.input)),l(e=>({...e,...Pe.options})),ye(!1),xe(null),S(),N.discrete(Pe.direction===`csv2json`?`csv_to_json`:`json_to_csv`,`permalink`,Pe.input)},[Pe,N]);let Fe=async(e,t)=>{if(!FD(e))b(`Can't read "${e.name}" as text — drop a ${P?`.csv / .tsv`:`.json`} file.`);else{b(null),v(!0);try{let n=await LD(e,x);de.current={file:e,source:t,text:n},fe.current={direction:P?`csv_to_json`:`json_to_csv`,via:t===`drop`?`drag`:`file`,text:n},Te(n),h(e.name),v(!1)}catch{v(!1),b(`Couldn't read "${e.name}".`)}}},Ie=async e=>{let t=x;C(e);let n=de.current;if(n&&s===n.text){v(!0);try{let t=await LD(n.file,e);de.current={...n,text:t},fe.current={direction:P?`csv_to_json`:`json_to_csv`,via:n.source===`drop`?`drag`:`file`,text:t},o(e=>({...e,present:t})),v(!1)}catch{v(!1),C(t),b(`Couldn't read "${n.file.name}".`)}}},Le=(0,g.useCallback)(e=>{b(null),e.trim()===``&&l(e=>{if(!e.columnTypes)return e;let t={...e};return delete t.columnTypes,t}),Te(e),N.edit(P?`csv_to_json`:`json_to_csv`,e)},[Te,P,N]);(0,g.useEffect)(()=>{let e=e=>{let t=e.clipboardData?.getData(`text/plain`);t&&!kk(e.target)&&(e.preventDefault(),e.stopPropagation(),h(null),Le(t))};return document.addEventListener(`paste`,e,!0),()=>document.removeEventListener(`paste`,e,!0)},[Le]);let Re=I.ok?Uk(I.rows,I.cols):null,ze=!I.ok&&L?`Last valid result — input has errors`:null,Be=I.ok&&I.warnings&&I.warnings.length>0?I.warnings:null,Ve=s.length>Rk,He=P?`csv_to_json`:`json_to_csv`,Ue=P?u:`csv`,We=()=>{k({via:`copy`,format:P?`csv`:`json`,pane:`input`,direction:He}),xk(s)},Ge=!P&&O!==null?O:z,Ke=()=>{k({via:`copy`,format:Ue,pane:`output`,direction:He}),Ge&&xk(Ge)},qe=()=>{k({via:`download`,format:P?`csv`:`json`,pane:`input`,direction:He}),Ok(s,m??(P?`data.csv`:`data.json`),{mime:P?`text/csv`:`application/json`,bom:P})},Je=()=>{k({via:`download`,format:Ue,pane:`output`,direction:He}),Ok(Ge??``,Ek(m,P?`csv2json`:`json2csv`,u),{mime:Dk(P?`csv2json`:`json2csv`,u),bom:!P})},Ye=(0,g.useCallback)(()=>{k({via:`copy`,format:`csv`,pane:`input`,direction:He})},[He]),Xe=(0,g.useCallback)(()=>{k({via:`copy`,format:`csv`,pane:`output`,direction:He})},[He]),Ze=(0,g.useCallback)(()=>{k({via:`copy`,format:Ue,pane:`output`,direction:He})},[Ue,He]),Qe=(0,V.jsx)(ND,{format:se,input:s,onInputChange:Le,onCellCommit:Le,onFile:Fe,onTryExample:()=>{b(null);let e=P?Ak:jk;M.current={direction:r,options:c,input:e,resultOk:OD(r,e,c).ok},Te(e),N.discrete(He,`example`,e)},onClear:()=>{Te(``),h(null),l(e=>{if(!e.columnTypes)return e;let t={...e};return delete t.columnTypes,t}),ye(!1),xe(null),N.cancel()},onCopy:We,onCopySelection:Ye,onProjectedCsvChange:D,onDownload:qe,canUndo:Ee,canRedo:De,onUndo:Oe,onRedo:ke,collapseIndexedArrays:c.collapseIndexedArrays??!0,onToggleCollapseIndexedArrays:()=>l(e=>({...e,collapseIndexedArrays:!(e.collapseIndexedArrays??!0)})),columnTypes:c.columnTypes??{},onChangeColumnTypes:e=>l(t=>{let n={...t};return Object.keys(e).length>0?n.columnTypes=e:delete n.columnTypes,n}),flatten:c.flatten,onToggleFlatten:()=>l(e=>({...e,flatten:!e.flatten})),selectedMarkdownTableIndex:ne,onSelectMarkdownTableIndex:j,filename:m,reading:_,meta:Re,error:null,notice:y,delimiter:c.separator===`auto`?void 0:c.separator,dark:e===`dark`}),$e=(0,V.jsx)(mO,{format:ce,inputEmpty:F,outputText:z,error:I.ok?null:I.error,meta:Re,staleNotice:ze,warnings:Be,edited:ve,editable:Ce,egressFormat:u,delimiter:c.separator===`auto`?void 0:c.separator,dark:e===`dark`,onCopy:Ke,onCopySelection:Xe,onProjectedCsvChange:A,onNativeCopy:Ze,onDownload:Je,onEgressFormatChange:d,onOutputChange:we,onRevert:B,onDiscardReconvert:B});return(0,V.jsxs)(`div`,{className:`flex min-h-svh flex-col bg-background text-foreground`,children:[(0,V.jsx)(`h1`,{className:`sr-only`,children:`CSV to JSON and JSON to CSV converter`}),(0,V.jsxs)(`div`,{className:`flex min-h-svh flex-col md:h-svh md:min-h-0`,children:[(0,V.jsx)(Nt,{}),(0,V.jsx)(LO,{theme:e,onToggleTheme:n,slot:(0,V.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,V.jsx)(NO,{snapshots:w,onSelect:Ae,onRemove:je,onClear:Me}),(0,V.jsx)(nk,{}),(0,V.jsx)(Ht,{})]})}),he&&(ge.phase===`loading`||ge.phase===`not-found`||ge.phase===`unsupported`||ge.phase===`error`)?(0,V.jsx)(hO,{phase:ge.phase,message:ge.phase===`error`?ge.message:void 0,onRetry:ge.retry}):null,(0,V.jsx)(FO,{layout:oe,split:f,onSplitChange:p,left:Qe,right:$e,children:(0,V.jsx)(Ot,{direction:r,onFlip:Ne})}),(0,V.jsx)(qD,{direction:r,options:c,onChange:e=>l(t=>({...t,...e})),uploadEncoding:x,onUploadEncodingChange:Ie,notice:Ve?`Large file — converting on pause`:null})]}),(0,V.jsx)(jt,{})]})}(0,_.createRoot)(document.getElementById(`root`)).render((0,V.jsx)(g.StrictMode,{children:(0,V.jsx)(Gk,{})})),document.getElementById(`root`).removeAttribute(`inert`),b(),x();export{nr as a,m as c,br as i,u as l,vo as n,rr as o,ho as r,ar as s,Ol as t,c as u}; \ No newline at end of file diff --git a/app/dist/assets/number-overlay-editor-CftgwBSh.js b/app/dist/assets/number-overlay-editor-CftgwBSh.js deleted file mode 100644 index 46ff4d00..00000000 --- a/app/dist/assets/number-overlay-editor-CftgwBSh.js +++ /dev/null @@ -1,9 +0,0 @@ -import{s as Be,R as Y,r as O}from"./index-Dded1B-H.js";const Fe=Be("div")({name:"NumberOverlayEditorStyle",class:"gdg-n15fjm3e",propsAsIs:!1});function pe(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,n=Object.getOwnPropertySymbols(e);a=p?a=a+ge("0",f-p):a=(a.substring(0,f)||"0")+"."+a.substring(f),r+a}function me(e,t,r){if(["","-"].indexOf(e)!==-1)return e;var n=(e.indexOf(".")!==-1||r)&&t,a=se(e),i=a.beforeDecimal,f=a.afterDecimal,p=a.hasNegation,m=parseFloat("0."+(f||"0")),x=f.length<=t?"0."+f:m.toFixed(t),h=x.split("."),s=i;i&&Number(h[0])&&(s=i.split("").reverse().reduce(function(I,C,g){return I.length>g?(Number(I[0])+Number(C)).toString()+I.substring(1,I.length):C+I},h[0]));var S=be(h[1]||"",t,r),y=p?"-":"",l=n?".":"";return""+y+s+l+S}function J(e,t){if(e.value=e.value,e!==null){if(e.createTextRange){var r=e.createTextRange();return r.move("character",t),r.select(),!0}return e.selectionStart||e.selectionStart===0?(e.focus(),e.setSelectionRange(t,t),!0):(e.focus(),!1)}}var Ne=_e(function(e,t){for(var r=0,n=0,a=e.length,i=t.length;e[r]===t[r]&&rr&&a-n>r;)n++;return{from:{start:r,end:a-n},to:{start:r,end:i-n}}}),Pe=function(e,t){var r=Math.min(e.selectionStart,t);return{from:{start:r,end:e.selectionEnd},to:{start:r,end:t}}};function Ke(e,t,r){return Math.min(Math.max(e,t),r)}function ce(e){return Math.max(e.selectionStart,e.selectionEnd)}function We(){return typeof navigator<"u"&&!(navigator.platform&&/iPhone|iPod/.test(navigator.platform))}function Ue(e){return{from:{start:0,end:0},to:{start:0,end:e.length},lastValue:""}}function $e(e){var t=e.currentValue,r=e.formattedValue,n=e.currentValueIndex,a=e.formattedValueIndex;return t[n]===r[a]}function Ge(e,t,r,n,a,i,f){f===void 0&&(f=$e);var p=a.findIndex(function(k){return k}),m=e.slice(0,p);!t&&!r.startsWith(m)&&(t=m,r=m+r,n=n+m.length);for(var x=r.length,h=e.length,s={},S=new Array(x),y=0;y0&&S[g]===-1;)g--;var F=g===-1||S[g]===-1?0:S[g]+1;return F>B?B:n-F=0&&!r[t];)t--;t===-1&&(t=r.indexOf(!0))}else{for(;t<=a&&!r[t];)t++;t>a&&(t=r.lastIndexOf(!0))}return t===-1&&(t=a),t}function Ze(e){for(var t=Array.from({length:e.length+1}).map(function(){return!0}),r=0,n=t.length;rP.length-f.length||HL||s>e.length-f.length)&&(W=s),e=e.substring(0,W),e=Je(F?"-"+e:e,a),e=(e.match(Qe(l))||[]).join("");var U=e.indexOf(l);e=e.replace(new RegExp(ye(l),"g"),function(c,N){return N===U?".":""});var $=se(e,a),Q=$.beforeDecimal,te=$.afterDecimal,d=$.addNegation;return x.end-x.startE?!1:A>=re.start&&Ai.type==="decimal"))==null?void 0:a.value)??"."}function nt(){return De()==="."?",":"."}const ot=e=>{const{value:t,onChange:r,disabled:n,highlight:a,validatedSelection:i,fixedDecimals:f,allowNegative:p,thousandSeparator:m,decimalSeparator:x}=e,h=O.useRef();return O.useLayoutEffect(()=>{var s;if(i!==void 0){const S=typeof i=="number"?[i,null]:i;(s=h.current)==null||s.setSelectionRange(S[0],S[1])}},[i]),O.createElement(Fe,null,O.createElement(at,{autoFocus:!0,getInputRef:h,className:"gdg-input",onFocus:s=>s.target.setSelectionRange(a?0:s.target.value.length,s.target.value.length),disabled:n===!0,decimalScale:f,allowNegative:p,thousandSeparator:m??nt(),decimalSeparator:x??De(),value:Object.is(t,-0)?"-":t??"",onValueChange:r}))};export{ot as default}; diff --git a/app/dist/assets/number-overlay-editor-DAo7GPxB.js b/app/dist/assets/number-overlay-editor-DAo7GPxB.js new file mode 100644 index 00000000..24ed60b0 --- /dev/null +++ b/app/dist/assets/number-overlay-editor-DAo7GPxB.js @@ -0,0 +1,9 @@ +import{i as e,l as t,u as n}from"./index-Dw_RpILp.js";var r=n(t()),i=e(`div`)({name:`NumberOverlayEditorStyle`,class:`gdg-n15fjm3e`,propsAsIs:!1});function a(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i=s?i+=b(`0`,o-s):i=(i.substring(0,o)||`0`)+`.`+i.substring(o),n+i}function S(e,t,n){if([``,`-`].indexOf(e)!==-1)return e;var r=(e.indexOf(`.`)!==-1||n)&&t,i=_(e),a=i.beforeDecimal,o=i.afterDecimal,s=i.hasNegation,c=parseFloat(`0.`+(o||`0`)),l=(o.length<=t?`0.`+o:c.toFixed(t)).split(`.`),u=a;a&&Number(l[0])&&(u=a.split(``).reverse().reduce(function(e,t,n){return e.length>n?(Number(e[0])+Number(t)).toString()+e.substring(1,e.length):t+e},l[0]));var d=y(l[1]||``,t,n),f=s?`-`:``,p=r?`.`:``;return``+f+u+p+d}function C(e,t){if(e.value=e.value,e!==null){if(e.createTextRange){var n=e.createTextRange();return n.move(`character`,t),n.select(),!0}return e.selectionStart||e.selectionStart===0?(e.focus(),e.setSelectionRange(t,t),!0):(e.focus(),!1)}}var w=c(function(e,t){for(var n=0,r=0,i=e.length,a=t.length;e[n]===t[n]&&nn&&i-r>n;)r++;return{from:{start:n,end:i-r},to:{start:n,end:a-r}}}),T=function(e,t){var n=Math.min(e.selectionStart,t);return{from:{start:n,end:e.selectionEnd},to:{start:n,end:t}}};function E(e,t,n){return Math.min(Math.max(e,t),n)}function D(e){return Math.max(e.selectionStart,e.selectionEnd)}function O(){return typeof navigator<`u`&&!(navigator.platform&&/iPhone|iPod/.test(navigator.platform))}function k(e){return{from:{start:0,end:0},to:{start:0,end:e.length},lastValue:``}}function A(e){var t=e.currentValue,n=e.formattedValue,r=e.currentValueIndex,i=e.formattedValueIndex;return t[r]===n[i]}function j(e,t,n,r,i,a,o){o===void 0&&(o=A);var s=i.findIndex(function(e){return e}),c=e.slice(0,s);!t&&!n.startsWith(c)&&(t=c,n=c+n,r+=c.length);for(var l=n.length,u=e.length,d={},f=Array(l),p=0;p0&&f[g]===-1;)g--;var v=g===-1||f[g]===-1?0:f[g]+1;return v>_?_:r-v<_-r?v:_}function M(e,t,n,r){var i=e.length;if(t=E(t,0,i),r===`left`){for(;t>=0&&!n[t];)t--;t===-1&&(t=n.indexOf(!0))}else{for(;t<=i&&!n[t];)t++;t>i&&(t=n.lastIndexOf(!0))}return t===-1&&(t=i),t}function N(e){for(var t=Array.from({length:e.length+1}).map(function(){return!0}),n=0,r=t.length;nE.length-o.length||Tj||f>e.length-o.length)&&(A=f),e=e.substring(0,A),e=B(S?`-`+e:e,i),e=(e.match(V(g,!0))||[]).join(``);var M=e.indexOf(g);e=e.replace(new RegExp(p(g),`g`),function(e,t){return t===M?`.`:``});var N=_(e,i),P=N.beforeDecimal,F=N.afterDecimal,I=N.addNegation;return u.end-u.starta?!1:i>=c.start&&ie.type===`decimal`)?.value??`.`}function q(){return K()===`.`?`,`:`.`}var J=e=>{let{value:t,onChange:n,disabled:a,highlight:o,validatedSelection:s,fixedDecimals:c,allowNegative:l,thousandSeparator:u,decimalSeparator:d}=e,f=r.useRef();return r.useLayoutEffect(()=>{if(s!==void 0){let e=typeof s==`number`?[s,null]:s;f.current?.setSelectionRange(e[0],e[1])}},[s]),r.createElement(i,null,r.createElement(te,{autoFocus:!0,getInputRef:f,className:`gdg-input`,onFocus:e=>e.target.setSelectionRange(o?0:e.target.value.length,e.target.value.length),disabled:a===!0,decimalScale:c,allowNegative:l,thousandSeparator:u??q(),decimalSeparator:d??K(),value:Object.is(t,-0)?`-`:t??``,onValueChange:n}))};export{J as default}; \ No newline at end of file diff --git a/app/dist/index.html b/app/dist/index.html index 8ae386ee..663f8996 100644 --- a/app/dist/index.html +++ b/app/dist/index.html @@ -91,11 +91,11 @@ data-domain="csvjson.com" src="https://plausible.io/js/script.manual.js" > - - + + -

    CSV to JSON and JSON to CSV converter

    Enjoy a cleaner, simpler CSVJSON. Leave feedback or ask for features here.

    csvjson
    CSV

    Paste CSV, TSV, or Markdown table

    Supports CSV, TSV / spreadsheet cells, Markdown & ChatGPT docs (multi-table), and psql / MySQL box tables

    or drag & drop a file anywhere in this pane — you can also paste anywhere on the page (⌘V / Ctrl+V)

    JSON
    Your JSON appears here.
    Auto · Parse numbers · Parse JSON
    +

    CSV to JSON and JSON to CSV converter

    Enjoy a cleaner, simpler CSVJSON. Leave feedback or ask for features here.

    csvjson
    CSV

    Paste CSV, TSV, or Markdown table

    Supports CSV, TSV / spreadsheet cells, Markdown & ChatGPT docs (multi-table), and psql / MySQL box tables

    or drag & drop a file anywhere in this pane — you can also paste anywhere on the page (Ctrl+V)

    JSON
    Your JSON appears here.
    Auto · Parse numbers · Parse JSON