@nchappell/codex-web-ui 1.0.6 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.next/BUILD_ID +1 -1
- package/.next/build-manifest.json +3 -3
- package/.next/fallback-build-manifest.json +3 -3
- package/.next/server/app/_global-error.html +1 -1
- package/.next/server/app/_global-error.rsc +1 -1
- package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/_not-found.html +1 -1
- package/.next/server/app/_not-found.rsc +1 -1
- package/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/index.html +1 -1
- package/.next/server/app/index.rsc +1 -1
- package/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/index.segments/_full.segment.rsc +1 -1
- package/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/.next/server/app/index.segments/_index.segment.rsc +1 -1
- package/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/thread/[threadId]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/threads/page_client-reference-manifest.js +1 -1
- package/.next/server/app/threads.html +1 -1
- package/.next/server/app/threads.rsc +2 -2
- package/.next/server/app/threads.segments/_full.segment.rsc +2 -2
- package/.next/server/app/threads.segments/_head.segment.rsc +1 -1
- package/.next/server/app/threads.segments/_index.segment.rsc +1 -1
- package/.next/server/app/threads.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/threads.segments/threads/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/threads.segments/threads.segment.rsc +1 -1
- package/.next/server/chunks/[root-of-the-server]__0pym12l._.js +3 -3
- package/.next/server/chunks/[root-of-the-server]__0pym12l._.js.map +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__0h7ed3q._.js +6 -6
- package/.next/server/chunks/ssr/[root-of-the-server]__0h7ed3q._.js.map +1 -1
- package/.next/server/middleware-build-manifest.js +3 -3
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/500.html +1 -1
- package/.next/static/chunks/{0k4c4eedynfr0.js → 0g7lwnm9wxo3~.js} +7 -7
- package/README.md +17 -14
- package/bin/codex-web-ui.js +70 -33
- package/bin/docker-entrypoint.sh +5 -0
- package/client/src/App.tsx +1 -19
- package/client/src/api.ts +0 -5
- package/package.json +3 -2
- package/server/appApi.ts +0 -25
- /package/.next/static/{Kq7OCztahzPSRmlZKubC1 → QMdoD-vxQDoRuGNGiCAPJ}/_buildManifest.js +0 -0
- /package/.next/static/{Kq7OCztahzPSRmlZKubC1 → QMdoD-vxQDoRuGNGiCAPJ}/_clientMiddlewareManifest.js +0 -0
- /package/.next/static/{Kq7OCztahzPSRmlZKubC1 → QMdoD-vxQDoRuGNGiCAPJ}/_ssgManifest.js +0 -0
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
4
4
|
|
|
5
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return T.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},hj=({contentRef:e,descriptionId:t})=>{let n=hT("DialogDescriptionWarning"),r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${n.contentName}}.`;return T.useEffect(()=>{let n=e.current?.getAttribute("aria-describedby");t&&n&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null};e.s(["Close",0,hS,"Content",0,hm,"Description",0,hk,"Dialog",0,hr,"DialogClose",0,hS,"DialogContent",0,hm,"DialogDescription",0,hk,"DialogOverlay",0,hd,"DialogPortal",0,hu,"DialogTitle",0,hb,"DialogTrigger",0,ho,"Overlay",0,hd,"Portal",0,hu,"Root",0,hr,"Title",0,hb,"Trigger",0,ho,"WarningProvider",0,hA,"createDialogScope",0,he],326999);var hP=Symbol.for("react.lazy"),hM=T[" use ".trim().toString()];function hD(e){var t;return null!=e&&"object"==typeof e&&"$$typeof"in e&&e.$$typeof===hP&&"_payload"in e&&"object"==typeof(t=e._payload)&&null!==t&&"then"in t}var hR=Symbol("radix.slottable");function hL(e){return T.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===hR}var hO=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{var n,r;let i,o,s,a=(r=n=`Primitive.${t}`,(i=T.forwardRef((e,t)=>{let{children:n,...r}=e;if(hD(n)&&"function"==typeof hM&&(n=hM(n._payload)),T.isValidElement(n)){var i;let e,o,s=(i=n,(o=(e=Object.getOwnPropertyDescriptor(i.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.ref:(o=(e=Object.getOwnPropertyDescriptor(i,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.props.ref:i.props.ref||i.ref),a=function(e,t){let n={...t};for(let r in t){let i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...e)=>{let t=o(...e);return i(...e),t}:i&&(n[r]=i):"style"===r?n[r]={...i,...o}:"className"===r&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}(r,n.props);return n.type!==T.Fragment&&(a.ref=t?(0,o1.composeRefs)(t,s):s),T.cloneElement(n,a)}return T.Children.count(n)>1?T.Children.only(null):null})).displayName=`${r}.SlotClone`,o=i,(s=T.forwardRef((e,t)=>{let{children:n,...r}=e;hD(n)&&"function"==typeof hM&&(n=hM(n._payload));let i=T.Children.toArray(n),s=i.find(hL);if(s){let e=s.props.children,n=i.map(t=>t!==s?t:T.Children.count(e)>1?T.Children.only(null):T.isValidElement(e)?e.props.children:null);return(0,A.jsx)(o,{...r,ref:t,children:T.isValidElement(e)?T.cloneElement(e,void 0,n):null})}return(0,A.jsx)(o,{...r,ref:t,children:n})})).displayName=`${n}.Slot`,s),l=T.forwardRef((e,n)=>{let{asChild:r,...i}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,A.jsx)(r?a:t,{...i,ref:n})});return l.displayName=`Primitive.${t}`,{...e,[t]:l}},{}),hI='[cmdk-group=""]',hF='[cmdk-group-items=""]',hz='[cmdk-item=""]',hB=`${hz}:not([aria-disabled="true"])`,h$="cmdk-item-select",hU="data-value",hV=(e,t,n)=>{var r;return r=e,function e(t,n,r,i,o,s,a){if(s===n.length)return o===t.length?1:.99;var l=`${o},${s}`;if(void 0!==a[l])return a[l];for(var u,c,d,h,f=i.charAt(s),p=r.indexOf(f,o),m=0;p>=0;)(u=e(t,n,r,i,p+1,s+1,a))>m&&(p===o?u*=1:d0.test(t.charAt(p-1))?(u*=.8,(d=t.slice(o,p-1).match(d1))&&o>0&&(u*=Math.pow(.999,d.length))):d2.test(t.charAt(p-1))?(u*=.9,(h=t.slice(o,p-1).match(d5))&&o>0&&(u*=Math.pow(.999,h.length))):(u*=.17,o>0&&(u*=Math.pow(.999,p-o))),t.charAt(p)!==n.charAt(s)&&(u*=.9999)),(u<.1&&r.charAt(p-1)===i.charAt(s+1)||i.charAt(s+1)===i.charAt(s)&&r.charAt(p-1)!==i.charAt(s))&&.1*(c=e(t,n,r,i,p+1,s+2,a))>u&&(u=.1*c),u>m&&(m=u),p=r.indexOf(f,p+1);return a[l]=m,m}(r=n&&n.length>0?`${r+" "+n.join(" ")}`:r,t,d3(r),d3(t),0,0,{})},hW=T.createContext(void 0),hH=T.createContext(void 0),hK=T.createContext(void 0),hG=T.forwardRef((e,t)=>{let n=h2(()=>{var t,n;return{search:"",value:null!=(n=null!=(t=e.value)?t:e.defaultValue)?n:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=h2(()=>new Set),i=h2(()=>new Map),o=h2(()=>new Map),s=h2(()=>new Set),a=h0(e),{label:l,children:u,value:c,onValueChange:d,filter:h,shouldFilter:f,loop:p,disablePointerSelection:m=!1,vimBindings:g=!0,...y}=e,v=(0,sm.useId)(),x=(0,sm.useId)(),b=(0,sm.useId)(),w=T.useRef(null),k=h4();h1(()=>{if(void 0!==c){let e=c.trim();n.current.value=e,_.emit()}},[c]),h1(()=>{k(6,j)},[]);let _=T.useMemo(()=>({subscribe:e=>(s.current.add(e),()=>s.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var i,o,s,l;if(!Object.is(n.current[e],t)){if(n.current[e]=t,"search"===e)N(),E(),k(1,A);else if("value"===e){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let e=document.getElementById(b);e?e.focus():null==(i=document.getElementById(v))||i.focus()}if(k(7,()=>{var e;n.current.selectedItemId=null==(e=P())?void 0:e.id,_.emit()}),r||k(5,j),(null==(o=a.current)?void 0:o.value)!==void 0){null==(l=(s=a.current).onValueChange)||l.call(s,null!=t?t:"");return}}_.emit()}},emit:()=>{s.current.forEach(e=>e())}}),[]),S=T.useMemo(()=>({value:(e,t,r)=>{var i;t!==(null==(i=o.current.get(e))?void 0:i.value)&&(o.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,C(t,r)),k(2,()=>{E(),_.emit()}))},item:(e,t)=>(r.current.add(e),t&&(i.current.has(t)?i.current.get(t).add(e):i.current.set(t,new Set([e]))),k(3,()=>{N(),E(),n.current.value||A(),_.emit()}),()=>{o.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=P();k(4,()=>{N(),(null==t?void 0:t.getAttribute("id"))===e&&A(),_.emit()})}),group:e=>(i.current.has(e)||i.current.set(e,new Set),()=>{o.current.delete(e),i.current.delete(e)}),filter:()=>a.current.shouldFilter,label:l||e["aria-label"],getDisablePointerSelection:()=>a.current.disablePointerSelection,listId:v,inputId:b,labelId:x,listInnerRef:w}),[]);function C(e,t){var r,i;let o=null!=(i=null==(r=a.current)?void 0:r.filter)?i:hV;return e?o(e,n.current.search,t):0}function E(){if(!n.current.search||!1===a.current.shouldFilter)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=i.current.get(n),o=0;r.forEach(t=>{o=Math.max(e.get(t),o)}),t.push([n,o])});let r=w.current;M().sort((t,n)=>{var r,i;let o=t.getAttribute("id"),s=n.getAttribute("id");return(null!=(r=e.get(s))?r:0)-(null!=(i=e.get(o))?i:0)}).forEach(e=>{let t=e.closest(hF);t?t.appendChild(e.parentElement===t?e:e.closest(`${hF} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${hF} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{var t;let n=null==(t=w.current)?void 0:t.querySelector(`${hI}[${hU}="${encodeURIComponent(e[0])}"]`);null==n||n.parentElement.appendChild(n)})}function A(){let e=M().find(e=>"true"!==e.getAttribute("aria-disabled")),t=null==e?void 0:e.getAttribute(hU);_.setState("value",t||void 0)}function N(){var e,t,s,l;if(!n.current.search||!1===a.current.shouldFilter){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let u=0;for(let i of r.current){let r=C(null!=(t=null==(e=o.current.get(i))?void 0:e.value)?t:"",null!=(l=null==(s=o.current.get(i))?void 0:s.keywords)?l:[]);n.current.filtered.items.set(i,r),r>0&&u++}for(let[e,t]of i.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=u}function j(){var e,t,n;let r=P();r&&((null==(e=r.parentElement)?void 0:e.firstChild)===r&&(null==(n=null==(t=r.closest(hI))?void 0:t.querySelector('[cmdk-group-heading=""]'))||n.scrollIntoView({block:"nearest"})),r.scrollIntoView({block:"nearest"}))}function P(){var e;return null==(e=w.current)?void 0:e.querySelector(`${hz}[aria-selected="true"]`)}function M(){var e;return Array.from((null==(e=w.current)?void 0:e.querySelectorAll(hB))||[])}function D(e){let t=M()[e];t&&_.setState("value",t.getAttribute(hU))}function R(e){var t;let n=P(),r=M(),i=r.findIndex(e=>e===n),o=r[i+e];null!=(t=a.current)&&t.loop&&(o=i+e<0?r[r.length-1]:i+e===r.length?r[0]:r[i+e]),o&&_.setState("value",o.getAttribute(hU))}function L(e){let t=P(),n=null==t?void 0:t.closest(hI),r;for(;n&&!r;)r=null==(n=e>0?function(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}(n,hI):function(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}(n,hI))?void 0:n.querySelector(hB);r?_.setState("value",r.getAttribute(hU)):R(e)}let O=()=>D(M().length-1),I=e=>{e.preventDefault(),e.metaKey?O():e.altKey?L(1):R(1)},F=e=>{e.preventDefault(),e.metaKey?D(0):e.altKey?L(-1):R(-1)};return T.createElement(hO.div,{ref:t,tabIndex:-1,...y,"cmdk-root":"",onKeyDown:e=>{var t;null==(t=y.onKeyDown)||t.call(y,e);let n=e.nativeEvent.isComposing||229===e.keyCode;if(!(e.defaultPrevented||n))switch(e.key){case"n":case"j":g&&e.ctrlKey&&I(e);break;case"ArrowDown":I(e);break;case"p":case"k":g&&e.ctrlKey&&F(e);break;case"ArrowUp":F(e);break;case"Home":e.preventDefault(),D(0);break;case"End":e.preventDefault(),O();break;case"Enter":{e.preventDefault();let t=P();if(t){let e=new Event(h$);t.dispatchEvent(e)}}}}},T.createElement("label",{"cmdk-label":"",htmlFor:S.inputId,id:S.labelId,style:h8},l),h6(e,e=>T.createElement(hH.Provider,{value:_},T.createElement(hW.Provider,{value:S},e))))}),hq=T.forwardRef((e,t)=>{var n,r;let i=(0,sm.useId)(),o=T.useRef(null),s=T.useContext(hK),a=T.useContext(hW),l=h0(e),u=null!=(r=null==(n=l.current)?void 0:n.forceMount)?r:null==s?void 0:s.forceMount;h1(()=>{if(!u)return a.item(i,null==s?void 0:s.id)},[u]);let c=h3(i,o,[e.value,e.children,o],e.keywords),d=T.useContext(hH),h=h5(e=>e.value&&e.value===c.current),f=h5(e=>!!u||!1===a.filter()||!e.search||e.filtered.items.get(i)>0);function p(){var e,t;m(),null==(t=(e=l.current).onSelect)||t.call(e,c.current)}function m(){d.setState("value",c.current,!0)}if(T.useEffect(()=>{let t=o.current;if(!(!t||e.disabled))return t.addEventListener(h$,p),()=>t.removeEventListener(h$,p)},[f,e.onSelect,e.disabled]),!f)return null;let{disabled:g,value:y,onSelect:v,forceMount:x,keywords:b,...w}=e;return T.createElement(hO.div,{ref:(0,o1.composeRefs)(o,t),...w,id:i,"cmdk-item":"",role:"option","aria-disabled":!!g,"aria-selected":!!h,"data-disabled":!!g,"data-selected":!!h,onPointerMove:g||a.getDisablePointerSelection()?void 0:m,onClick:g?void 0:p},e.children)}),hJ=T.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...o}=e,s=(0,sm.useId)(),a=T.useRef(null),l=T.useRef(null),u=(0,sm.useId)(),c=T.useContext(hW),d=h5(e=>!!i||!1===c.filter()||!e.search||e.filtered.groups.has(s));h1(()=>c.group(s),[]),h3(s,a,[e.value,e.heading,l]);let h=T.useMemo(()=>({id:s,forceMount:i}),[i]);return T.createElement(hO.div,{ref:(0,o1.composeRefs)(a,t),...o,"cmdk-group":"",role:"presentation",hidden:!d||void 0},n&&T.createElement("div",{ref:l,"cmdk-group-heading":"","aria-hidden":!0,id:u},n),h6(e,e=>T.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?u:void 0},T.createElement(hK.Provider,{value:h},e))))}),hY=T.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=T.useRef(null),o=h5(e=>!e.search);return n||o?T.createElement(hO.div,{ref:(0,o1.composeRefs)(i,t),...r,"cmdk-separator":"",role:"separator"}):null}),hX=T.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=null!=e.value,o=T.useContext(hH),s=h5(e=>e.search),a=h5(e=>e.selectedItemId),l=T.useContext(hW);return T.useEffect(()=>{null!=e.value&&o.setState("search",e.value)},[e.value]),T.createElement(hO.input,{ref:t,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":l.listId,"aria-labelledby":l.labelId,"aria-activedescendant":a,id:l.inputId,type:"text",value:i?e.value:s,onChange:e=>{i||o.setState("search",e.target.value),null==n||n(e.target.value)}})}),hZ=T.forwardRef((e,t)=>{let{children:n,label:r="Suggestions",...i}=e,o=T.useRef(null),s=T.useRef(null),a=h5(e=>e.selectedItemId),l=T.useContext(hW);return T.useEffect(()=>{if(s.current&&o.current){let e=s.current,t=o.current,n,r=new ResizeObserver(()=>{n=requestAnimationFrame(()=>{let n=e.offsetHeight;t.style.setProperty("--cmdk-list-height",n.toFixed(1)+"px")})});return r.observe(e),()=>{cancelAnimationFrame(n),r.unobserve(e)}}},[]),T.createElement(hO.div,{ref:(0,o1.composeRefs)(o,t),...i,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":a,"aria-label":r,id:l.listId},h6(e,e=>T.createElement("div",{ref:(0,o1.composeRefs)(s,l.listInnerRef),"cmdk-list-sizer":""},e)))}),hQ=T.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:o,container:s,...a}=e;return T.createElement(hr,{open:n,onOpenChange:r},T.createElement(hu,{container:s},T.createElement(hd,{"cmdk-overlay":"",className:i}),T.createElement(hm,{"aria-label":e.label,"cmdk-dialog":"",className:o},T.createElement(hG,{ref:t,...a}))))});function h0(e){let t=T.useRef(e);return h1(()=>{t.current=e}),t}Object.assign(hG,{List:hZ,Item:hq,Input:hX,Group:hJ,Separator:hY,Dialog:hQ,Empty:T.forwardRef((e,t)=>h5(e=>0===e.filtered.count)?T.createElement(hO.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),Loading:T.forwardRef((e,t)=>{let{progress:n,children:r,label:i="Loading...",...o}=e;return T.createElement(hO.div,{ref:t,...o,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},h6(e,e=>T.createElement("div",{"aria-hidden":!0},e)))})});var h1="u"<typeof window?T.useEffect:T.useLayoutEffect;function h2(e){let t=T.useRef();return void 0===t.current&&(t.current=e()),t}function h5(e){let t=T.useContext(hH),n=()=>e(t.snapshot());return T.useSyncExternalStore(t.subscribe,n,n)}function h3(e,t,n,r=[]){let i=T.useRef(),o=T.useContext(hW);return h1(()=>{var s;let a=(()=>{var e;for(let t of n){if("string"==typeof t)return t.trim();if("object"==typeof t&&"current"in t)return t.current?null==(e=t.current.textContent)?void 0:e.trim():i.current}})(),l=r.map(e=>e.trim());o.value(e,a,l),null==(s=t.current)||s.setAttribute(hU,a),i.current=a}),i}var h4=()=>{let[e,t]=T.useState(),n=h2(()=>new Map);return h1(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function h6({asChild:e,children:t},n){let r;return e&&T.isValidElement(t)?T.cloneElement("function"==typeof(r=t.type)?r(t.props):"render"in r?r.render(t.props):t,{ref:t.ref},n(t.props.children)):n(t)}var h8={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};e.i(326999),D("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);let h9=D("circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);var h7=iH,fe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{let n=(0,h7.createSlot)(`Primitive.${t}`),r=T.forwardRef((e,r)=>{let{asChild:i,...o}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,A.jsx)(i?n:t,{...o,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),ft=iH,fn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{let n=(0,ft.createSlot)(`Primitive.${t}`),r=T.forwardRef((e,r)=>{let{asChild:i,...o}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,A.jsx)(i?n:t,{...o,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),fr=iH,fi=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{let n=(0,fr.createSlot)(`Primitive.${t}`),r=T.forwardRef((e,r)=>{let{asChild:i,...o}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,A.jsx)(i?n:t,{...o,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),fo="rovingFocusGroup.onEntryFocus",fs={bubbles:!1,cancelable:!0},fa="RovingFocusGroup",[fl,fu,fc]=o5(fa),[fd,fh]=(0,o0.createContextScope)(fa,[fc]),[ff,fp]=fd(fa),fm=T.forwardRef((e,t)=>(0,A.jsx)(fl.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,A.jsx)(fl.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,A.jsx)(fg,{...e,ref:t})})}));fm.displayName=fa;var fg=T.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:o,currentTabStopId:s,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:l,onEntryFocus:u,preventScrollOnEntryFocus:c=!1,...d}=e,h=T.useRef(null),f=(0,o1.useComposedRefs)(t,h),p=o9(o),[m,g]=(0,sw.useControllableState)({prop:s,defaultProp:a??null,onChange:l,caller:fa}),[y,v]=T.useState(!1),x=(0,so.useCallbackRef)(u),b=fu(n),w=T.useRef(!1),[k,_]=T.useState(0);return T.useEffect(()=>{let e=h.current;if(e)return e.addEventListener(fo,x),()=>e.removeEventListener(fo,x)},[x]),(0,A.jsx)(ff,{scope:n,orientation:r,dir:p,loop:i,currentTabStopId:m,onItemFocus:T.useCallback(e=>g(e),[g]),onItemShiftTab:T.useCallback(()=>v(!0),[]),onFocusableItemAdd:T.useCallback(()=>_(e=>e+1),[]),onFocusableItemRemove:T.useCallback(()=>_(e=>e-1),[]),children:(0,A.jsx)(fi.div,{tabIndex:y||0===k?-1:0,"data-orientation":r,...d,ref:f,style:{outline:"none",...e.style},onMouseDown:(0,oQ.composeEventHandlers)(e.onMouseDown,()=>{w.current=!0}),onFocus:(0,oQ.composeEventHandlers)(e.onFocus,e=>{let t=!w.current;if(e.target===e.currentTarget&&t&&!y){let t=new CustomEvent(fo,fs);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=b().filter(e=>e.focusable);fb([e.find(e=>e.active),e.find(e=>e.id===m),...e].filter(Boolean).map(e=>e.ref.current),c)}}w.current=!1}),onBlur:(0,oQ.composeEventHandlers)(e.onBlur,()=>v(!1))})})}),fy="RovingFocusGroupItem",fv=T.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:o,children:s,...a}=e,l=(0,sm.useId)(),u=o||l,c=fp(fy,n),d=c.currentTabStopId===u,h=fu(n),{onFocusableItemAdd:f,onFocusableItemRemove:p,currentTabStopId:m}=c;return T.useEffect(()=>{if(r)return f(),()=>p()},[r,f,p]),(0,A.jsx)(fl.ItemSlot,{scope:n,id:u,focusable:r,active:i,children:(0,A.jsx)(fi.span,{tabIndex:d?0:-1,"data-orientation":c.orientation,...a,ref:t,onMouseDown:(0,oQ.composeEventHandlers)(e.onMouseDown,e=>{r?c.onItemFocus(u):e.preventDefault()}),onFocus:(0,oQ.composeEventHandlers)(e.onFocus,()=>c.onItemFocus(u)),onKeyDown:(0,oQ.composeEventHandlers)(e.onKeyDown,e=>{if("Tab"===e.key&&e.shiftKey)return void c.onItemShiftTab();if(e.target!==e.currentTarget)return;let t=function(e,t,n){var r;let i=(r=e.key,"rtl"!==n?r:"ArrowLeft"===r?"ArrowRight":"ArrowRight"===r?"ArrowLeft":r);if(!("vertical"===t&&["ArrowLeft","ArrowRight"].includes(i))&&!("horizontal"===t&&["ArrowUp","ArrowDown"].includes(i)))return fx[i]}(e,c.orientation,c.dir);if(void 0!==t){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let i=h().filter(e=>e.focusable).map(e=>e.ref.current);if("last"===t)i.reverse();else if("prev"===t||"next"===t){var n,r;"prev"===t&&i.reverse();let o=i.indexOf(e.currentTarget);i=c.loop?(n=i,r=o+1,n.map((e,t)=>n[(r+t)%n.length])):i.slice(o+1)}setTimeout(()=>fb(i))}}),children:"function"==typeof s?s({isCurrentTabStop:d,hasTabStop:null!=m}):s})})});fv.displayName=fy;var fx={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function fb(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}var fw=iH,fk=["Enter"," "],f_=["ArrowUp","PageDown","End"],fS=["ArrowDown","PageUp","Home",...f_],fC={ltr:[...fk,"ArrowRight"],rtl:[...fk,"ArrowLeft"]},fE={ltr:["ArrowLeft"],rtl:["ArrowRight"]},fA="Menu",[fT,fN,fj]=o5(fA),[fP,fM]=(0,o0.createContextScope)(fA,[fj,sg.createPopperScope,fh]),fD=(0,sg.createPopperScope)(),fR=fh(),[fL,fO]=fP(fA),[fI,fF]=fP(fA),fz=e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:o,modal:s=!0}=e,a=fD(t),[l,u]=T.useState(null),c=T.useRef(!1),d=(0,so.useCallbackRef)(o),h=o9(i);return T.useEffect(()=>{let e=()=>{c.current=!0,document.addEventListener("pointerdown",t,{capture:!0,once:!0}),document.addEventListener("pointermove",t,{capture:!0,once:!0})},t=()=>c.current=!1;return document.addEventListener("keydown",e,{capture:!0}),()=>{document.removeEventListener("keydown",e,{capture:!0}),document.removeEventListener("pointerdown",t,{capture:!0}),document.removeEventListener("pointermove",t,{capture:!0})}},[]),(0,A.jsx)(sg.Root,{...a,children:(0,A.jsx)(fL,{scope:t,open:n,onOpenChange:d,content:l,onContentChange:u,children:(0,A.jsx)(fI,{scope:t,onClose:T.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:c,dir:h,modal:s,children:r})})})};fz.displayName=fA;var fB=T.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=fD(n);return(0,A.jsx)(sg.Anchor,{...i,...r,ref:t})});fB.displayName="MenuAnchor";var f$="MenuPortal",[fU,fV]=fP(f$,{forceMount:void 0}),fW=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,o=fO(f$,t);return(0,A.jsx)(fU,{scope:t,forceMount:n,children:(0,A.jsx)(di.Presence,{present:n||o.open,children:(0,A.jsx)(sy.Portal,{asChild:!0,container:i,children:r})})})};fW.displayName=f$;var fH="MenuContent",[fK,fG]=fP(fH),fq=T.forwardRef((e,t)=>{let n=fV(fH,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,o=fO(fH,e.__scopeMenu),s=fF(fH,e.__scopeMenu);return(0,A.jsx)(fT.Provider,{scope:e.__scopeMenu,children:(0,A.jsx)(di.Presence,{present:r||o.open,children:(0,A.jsx)(fT.Slot,{scope:e.__scopeMenu,children:s.modal?(0,A.jsx)(fJ,{...i,ref:t}):(0,A.jsx)(fY,{...i,ref:t})})})})}),fJ=T.forwardRef((e,t)=>{let n=fO(fH,e.__scopeMenu),r=T.useRef(null),i=(0,o1.useComposedRefs)(t,r);return T.useEffect(()=>{let e=r.current;if(e)return sj(e)},[]),(0,A.jsx)(fZ,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:(0,oQ.composeEventHandlers)(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),fY=T.forwardRef((e,t)=>{let n=fO(fH,e.__scopeMenu);return(0,A.jsx)(fZ,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),fX=(0,fw.createSlot)("MenuContent.ScrollLock"),fZ=T.forwardRef((e,t)=>{let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:o,onCloseAutoFocus:s,disableOutsidePointerEvents:a,onEntryFocus:l,onEscapeKeyDown:u,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:h,onDismiss:f,disableOutsideScroll:p,...m}=e,g=fO(fH,n),y=fF(fH,n),v=fD(n),x=fR(n),b=fN(n),[w,k]=T.useState(null),_=T.useRef(null),S=(0,o1.useComposedRefs)(t,_,g.onContentChange),C=T.useRef(0),E=T.useRef(""),N=T.useRef(0),j=T.useRef(null),P=T.useRef("right"),M=T.useRef(0),D=p?ao:T.Fragment;T.useEffect(()=>()=>window.clearTimeout(C.current),[]),st();let R=T.useCallback(e=>{var t,n;return P.current===j.current?.side&&(t=e,!!(n=j.current?.area)&&function(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,o=t.length-1;e<t.length;o=e++){let s=t[e],a=t[o],l=s.x,u=s.y,c=a.x,d=a.y;u>r!=d>r&&n<(c-l)*(r-u)/(d-u)+l&&(i=!i)}return i}({x:t.clientX,y:t.clientY},n))},[]);return(0,A.jsx)(fK,{scope:n,searchRef:E,onItemEnter:T.useCallback(e=>{R(e)&&e.preventDefault()},[R]),onItemLeave:T.useCallback(e=>{R(e)||(_.current?.focus(),k(null))},[R]),onTriggerLeave:T.useCallback(e=>{R(e)&&e.preventDefault()},[R]),pointerGraceTimerRef:N,onPointerGraceIntentChange:T.useCallback(e=>{j.current=e},[]),children:(0,A.jsx)(D,{...p?{as:fX,allowPinchZoom:!0}:void 0,children:(0,A.jsx)(su,{asChild:!0,trapped:i,onMountAutoFocus:(0,oQ.composeEventHandlers)(o,e=>{e.preventDefault(),_.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:s,children:(0,A.jsx)(o7.DismissableLayer,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:u,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:h,onDismiss:f,children:(0,A.jsx)(fm,{asChild:!0,...x,dir:y.dir,orientation:"vertical",loop:r,currentTabStopId:w,onCurrentTabStopIdChange:k,onEntryFocus:(0,oQ.composeEventHandlers)(l,e=>{y.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,A.jsx)(sg.Content,{role:"menu","aria-orientation":"vertical","data-state":pg(g.open),"data-radix-menu-content":"",dir:y.dir,...v,...m,ref:S,style:{outline:"none",...m.style},onKeyDown:(0,oQ.composeEventHandlers)(m.onKeyDown,e=>{let t=e.target.closest("[data-radix-menu-content]")===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=1===e.key.length;if(t){var i;let t,o,s,a,l,u;"Tab"===e.key&&e.preventDefault(),!n&&r&&(i=e.key,t=E.current+i,o=b().filter(e=>!e.disabled),s=document.activeElement,a=o.find(e=>e.ref.current===s)?.textValue,l=function(e,t,n){var r;let i=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,o=n?e.indexOf(n):-1,s=(r=Math.max(o,0),e.map((t,n)=>e[(r+n)%e.length]));1===i.length&&(s=s.filter(e=>e!==n));let a=s.find(e=>e.toLowerCase().startsWith(i.toLowerCase()));return a!==n?a:void 0}(o.map(e=>e.textValue),t,a),u=o.find(e=>e.textValue===l)?.ref.current,function e(t){E.current=t,window.clearTimeout(C.current),""!==t&&(C.current=window.setTimeout(()=>e(""),1e3))}(t),u&&setTimeout(()=>u.focus()))}let o=_.current;if(e.target!==o||!fS.includes(e.key))return;e.preventDefault();let s=b().filter(e=>!e.disabled).map(e=>e.ref.current);f_.includes(e.key)&&s.reverse(),function(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}(s)}),onBlur:(0,oQ.composeEventHandlers)(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(C.current),E.current="")}),onPointerMove:(0,oQ.composeEventHandlers)(e.onPointerMove,px(e=>{let t=e.target,n=M.current!==e.clientX;e.currentTarget.contains(t)&&n&&(P.current=e.clientX>M.current?"right":"left",M.current=e.clientX)}))})})})})})})});fq.displayName=fH;var fQ=T.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,A.jsx)(fn.div,{role:"group",...r,ref:t})});fQ.displayName="MenuGroup";var f0=T.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,A.jsx)(fn.div,{...r,ref:t})});f0.displayName="MenuLabel";var f1="MenuItem",f2="menu.itemSelect",f5=T.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:r,...i}=e,o=T.useRef(null),s=fF(f1,e.__scopeMenu),a=fG(f1,e.__scopeMenu),l=(0,o1.useComposedRefs)(t,o),u=T.useRef(!1);return(0,A.jsx)(f3,{...i,ref:l,disabled:n,onClick:(0,oQ.composeEventHandlers)(e.onClick,()=>{let e=o.current;if(!n&&e){let t=new CustomEvent(f2,{bubbles:!0,cancelable:!0});e.addEventListener(f2,e=>r?.(e),{once:!0}),e&&ec.flushSync(()=>e.dispatchEvent(t)),t.defaultPrevented?u.current=!1:s.onClose()}}),onPointerDown:t=>{e.onPointerDown?.(t),u.current=!0},onPointerUp:(0,oQ.composeEventHandlers)(e.onPointerUp,e=>{u.current||e.currentTarget?.click()}),onKeyDown:(0,oQ.composeEventHandlers)(e.onKeyDown,e=>{let t=""!==a.searchRef.current;n||t&&" "===e.key||fk.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});f5.displayName=f1;var f3=T.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:r=!1,textValue:i,...o}=e,s=fG(f1,n),a=fR(n),l=T.useRef(null),u=(0,o1.useComposedRefs)(t,l),[c,d]=T.useState(!1),[h,f]=T.useState("");return T.useEffect(()=>{let e=l.current;e&&f((e.textContent??"").trim())},[o.children]),(0,A.jsx)(fT.ItemSlot,{scope:n,disabled:r,textValue:i??h,children:(0,A.jsx)(fv,{asChild:!0,...a,focusable:!r,children:(0,A.jsx)(fn.div,{role:"menuitem","data-highlighted":c?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...o,ref:u,onPointerMove:(0,oQ.composeEventHandlers)(e.onPointerMove,px(e=>{r?s.onItemLeave(e):(s.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:(0,oQ.composeEventHandlers)(e.onPointerLeave,px(e=>s.onItemLeave(e))),onFocus:(0,oQ.composeEventHandlers)(e.onFocus,()=>d(!0)),onBlur:(0,oQ.composeEventHandlers)(e.onBlur,()=>d(!1))})})})}),f4=T.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,A.jsx)(pr,{scope:e.__scopeMenu,checked:n,children:(0,A.jsx)(f5,{role:"menuitemcheckbox","aria-checked":py(n)?"mixed":n,...i,ref:t,"data-state":pv(n),onSelect:(0,oQ.composeEventHandlers)(i.onSelect,()=>r?.(!!py(n)||!n),{checkForDefaultPrevented:!1})})})});f4.displayName="MenuCheckboxItem";var f6="MenuRadioGroup",[f8,f9]=fP(f6,{value:void 0,onValueChange:()=>{}}),f7=T.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,o=(0,so.useCallbackRef)(r);return(0,A.jsx)(f8,{scope:e.__scopeMenu,value:n,onValueChange:o,children:(0,A.jsx)(fQ,{...i,ref:t})})});f7.displayName=f6;var pe="MenuRadioItem",pt=T.forwardRef((e,t)=>{let{value:n,...r}=e,i=f9(pe,e.__scopeMenu),o=n===i.value;return(0,A.jsx)(pr,{scope:e.__scopeMenu,checked:o,children:(0,A.jsx)(f5,{role:"menuitemradio","aria-checked":o,...r,ref:t,"data-state":pv(o),onSelect:(0,oQ.composeEventHandlers)(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});pt.displayName=pe;var pn="MenuItemIndicator",[pr,pi]=fP(pn,{checked:!1}),po=T.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,o=pi(pn,n);return(0,A.jsx)(di.Presence,{present:r||py(o.checked)||!0===o.checked,children:(0,A.jsx)(fn.span,{...i,ref:t,"data-state":pv(o.checked)})})});po.displayName=pn;var ps=T.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,A.jsx)(fn.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});ps.displayName="MenuSeparator";var pa=T.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=fD(n);return(0,A.jsx)(sg.Arrow,{...i,...r,ref:t})});pa.displayName="MenuArrow";var pl="MenuSub",[pu,pc]=fP(pl),pd=e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,o=fO(pl,t),s=fD(t),[a,l]=T.useState(null),[u,c]=T.useState(null),d=(0,so.useCallbackRef)(i);return T.useEffect(()=>(!1===o.open&&d(!1),()=>d(!1)),[o.open,d]),(0,A.jsx)(sg.Root,{...s,children:(0,A.jsx)(fL,{scope:t,open:r,onOpenChange:d,content:u,onContentChange:c,children:(0,A.jsx)(pu,{scope:t,contentId:(0,sm.useId)(),triggerId:(0,sm.useId)(),trigger:a,onTriggerChange:l,children:n})})})};pd.displayName=pl;var ph="MenuSubTrigger",pf=T.forwardRef((e,t)=>{let n=fO(ph,e.__scopeMenu),r=fF(ph,e.__scopeMenu),i=pc(ph,e.__scopeMenu),o=fG(ph,e.__scopeMenu),s=T.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:l}=o,u={__scopeMenu:e.__scopeMenu},c=T.useCallback(()=>{s.current&&window.clearTimeout(s.current),s.current=null},[]);return T.useEffect(()=>c,[c]),T.useEffect(()=>{let e=a.current;return()=>{window.clearTimeout(e),l(null)}},[a,l]),(0,A.jsx)(fB,{asChild:!0,...u,children:(0,A.jsx)(f3,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":i.contentId,"data-state":pg(n.open),...e,ref:(0,o1.composeRefs)(t,i.onTriggerChange),onClick:t=>{e.onClick?.(t),e.disabled||t.defaultPrevented||(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:(0,oQ.composeEventHandlers)(e.onPointerMove,px(t=>{o.onItemEnter(t),!t.defaultPrevented&&(e.disabled||n.open||s.current||(o.onPointerGraceIntentChange(null),s.current=window.setTimeout(()=>{n.onOpenChange(!0),c()},100)))})),onPointerLeave:(0,oQ.composeEventHandlers)(e.onPointerLeave,px(e=>{c();let t=n.content?.getBoundingClientRect();if(t){let r=n.content?.dataset.side,i="right"===r,s=t[i?"left":"right"],l=t[i?"right":"left"];o.onPointerGraceIntentChange({area:[{x:e.clientX+(i?-5:5),y:e.clientY},{x:s,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:s,y:t.bottom}],side:r}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>o.onPointerGraceIntentChange(null),300)}else{if(o.onTriggerLeave(e),e.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:(0,oQ.composeEventHandlers)(e.onKeyDown,t=>{let i=""!==o.searchRef.current;e.disabled||i&&" "===t.key||fC[r.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})});pf.displayName=ph;var pp="MenuSubContent",pm=T.forwardRef((e,t)=>{let n=fV(fH,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,o=fO(fH,e.__scopeMenu),s=fF(fH,e.__scopeMenu),a=pc(pp,e.__scopeMenu),l=T.useRef(null),u=(0,o1.useComposedRefs)(t,l);return(0,A.jsx)(fT.Provider,{scope:e.__scopeMenu,children:(0,A.jsx)(di.Presence,{present:r||o.open,children:(0,A.jsx)(fT.Slot,{scope:e.__scopeMenu,children:(0,A.jsx)(fZ,{id:a.contentId,"aria-labelledby":a.triggerId,...i,ref:u,align:"start",side:"rtl"===s.dir?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{s.isUsingKeyboardRef.current&&l.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:(0,oQ.composeEventHandlers)(e.onFocusOutside,e=>{e.target!==a.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:(0,oQ.composeEventHandlers)(e.onEscapeKeyDown,e=>{s.onClose(),e.preventDefault()}),onKeyDown:(0,oQ.composeEventHandlers)(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=fE[s.dir].includes(e.key);t&&n&&(o.onOpenChange(!1),a.trigger?.focus(),e.preventDefault())})})})})})});function pg(e){return e?"open":"closed"}function py(e){return"indeterminate"===e}function pv(e){return py(e)?"indeterminate":e?"checked":"unchecked"}function px(e){return t=>"mouse"===t.pointerType?e(t):void 0}pm.displayName=pp;var pb="DropdownMenu",[pw,pk]=(0,o0.createContextScope)(pb,[fM]),p_=fM(),[pS,pC]=pw(pb),pE=e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:o,onOpenChange:s,modal:a=!0}=e,l=p_(t),u=T.useRef(null),[c,d]=(0,sw.useControllableState)({prop:i,defaultProp:o??!1,onChange:s,caller:pb});return(0,A.jsx)(pS,{scope:t,triggerId:(0,sm.useId)(),triggerRef:u,contentId:(0,sm.useId)(),open:c,onOpenChange:d,onOpenToggle:T.useCallback(()=>d(e=>!e),[d]),modal:a,children:(0,A.jsx)(fz,{...l,open:c,onOpenChange:d,dir:r,modal:a,children:n})})};pE.displayName=pb;var pA="DropdownMenuTrigger",pT=T.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,o=pC(pA,n),s=p_(n);return(0,A.jsx)(fB,{asChild:!0,...s,children:(0,A.jsx)(fe.button,{type:"button",id:o.triggerId,"aria-haspopup":"menu","aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":o.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...i,ref:(0,o1.composeRefs)(t,o.triggerRef),onPointerDown:(0,oQ.composeEventHandlers)(e.onPointerDown,e=>{!r&&0===e.button&&!1===e.ctrlKey&&(o.onOpenToggle(),o.open||e.preventDefault())}),onKeyDown:(0,oQ.composeEventHandlers)(e.onKeyDown,e=>{!r&&(["Enter"," "].includes(e.key)&&o.onOpenToggle(),"ArrowDown"===e.key&&o.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(e.key)&&e.preventDefault())})})})});pT.displayName=pA;var pN=e=>{let{__scopeDropdownMenu:t,...n}=e,r=p_(t);return(0,A.jsx)(fW,{...r,...n})};pN.displayName="DropdownMenuPortal";var pj="DropdownMenuContent",pP=T.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=pC(pj,n),o=p_(n),s=T.useRef(!1);return(0,A.jsx)(fq,{id:i.contentId,"aria-labelledby":i.triggerId,...o,...r,ref:t,onCloseAutoFocus:(0,oQ.composeEventHandlers)(e.onCloseAutoFocus,e=>{s.current||i.triggerRef.current?.focus(),s.current=!1,e.preventDefault()}),onInteractOutside:(0,oQ.composeEventHandlers)(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=0===t.button&&!0===t.ctrlKey,r=2===t.button||n;(!i.modal||r)&&(s.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});pP.displayName=pj;var pM=T.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=p_(n);return(0,A.jsx)(fQ,{...i,...r,ref:t})});pM.displayName="DropdownMenuGroup";var pD=T.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=p_(n);return(0,A.jsx)(f0,{...i,...r,ref:t})});pD.displayName="DropdownMenuLabel";var pR=T.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=p_(n);return(0,A.jsx)(f5,{...i,...r,ref:t})});pR.displayName="DropdownMenuItem";var pL=T.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=p_(n);return(0,A.jsx)(f4,{...i,...r,ref:t})});pL.displayName="DropdownMenuCheckboxItem";var pO=T.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=p_(n);return(0,A.jsx)(f7,{...i,...r,ref:t})});pO.displayName="DropdownMenuRadioGroup";var pI=T.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=p_(n);return(0,A.jsx)(pt,{...i,...r,ref:t})});pI.displayName="DropdownMenuRadioItem";var pF=T.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=p_(n);return(0,A.jsx)(po,{...i,...r,ref:t})});pF.displayName="DropdownMenuItemIndicator";var pz=T.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=p_(n);return(0,A.jsx)(ps,{...i,...r,ref:t})});pz.displayName="DropdownMenuSeparator";var pB=T.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=p_(n);return(0,A.jsx)(pa,{...i,...r,ref:t})});pB.displayName="DropdownMenuArrow";var p$=e=>{let{__scopeDropdownMenu:t,children:n,open:r,onOpenChange:i,defaultOpen:o}=e,s=p_(t),[a,l]=(0,sw.useControllableState)({prop:r,defaultProp:o??!1,onChange:i,caller:"DropdownMenuSub"});return(0,A.jsx)(pd,{...s,open:a,onOpenChange:l,children:n})},pU=T.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=p_(n);return(0,A.jsx)(pf,{...i,...r,ref:t})});pU.displayName="DropdownMenuSubTrigger";var pV=T.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=p_(n);return(0,A.jsx)(pm,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});function pW({className:e,...t}){return(0,A.jsx)("div",{"data-slot":"input-group",role:"group",className:oG("group/input-group relative flex w-full items-center rounded-md border border-input shadow-xs transition-[color,box-shadow] outline-none dark:bg-input/30","h-9 min-w-0 has-[>textarea]:h-auto","has-[>[data-align=inline-start]]:[&>input]:pl-2","has-[>[data-align=inline-end]]:[&>input]:pr-2","has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>[data-align=block-start]]:[&>input]:pb-3","has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-end]]:[&>input]:pt-3","has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-[3px] has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50","has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-destructive/20 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40",e),...t})}pV.displayName="DropdownMenuSubContent",e.s(["Arrow",0,pB,"CheckboxItem",0,pL,"Content",0,pP,"DropdownMenu",0,pE,"DropdownMenuArrow",0,pB,"DropdownMenuCheckboxItem",0,pL,"DropdownMenuContent",0,pP,"DropdownMenuGroup",0,pM,"DropdownMenuItem",0,pR,"DropdownMenuItemIndicator",0,pF,"DropdownMenuLabel",0,pD,"DropdownMenuPortal",0,pN,"DropdownMenuRadioGroup",0,pO,"DropdownMenuRadioItem",0,pI,"DropdownMenuSeparator",0,pz,"DropdownMenuSub",0,p$,"DropdownMenuSubContent",0,pV,"DropdownMenuSubTrigger",0,pU,"DropdownMenuTrigger",0,pT,"Group",0,pM,"Item",0,pR,"ItemIndicator",0,pF,"Label",0,pD,"Portal",0,pN,"RadioGroup",0,pO,"RadioItem",0,pI,"Root",0,pE,"Separator",0,pz,"Sub",0,p$,"SubContent",0,pV,"SubTrigger",0,pU,"Trigger",0,pT,"createDropdownMenuScope",0,pk],540666),e.i(540666);let pH=iW("flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4",{variants:{align:{"inline-start":"order-first pl-3 has-[>button]:ml-[-0.45rem] has-[>kbd]:ml-[-0.35rem]","inline-end":"order-last pr-3 has-[>button]:mr-[-0.45rem] has-[>kbd]:mr-[-0.35rem]","block-start":"order-first w-full justify-start px-3 pt-3 group-has-[>input]/input-group:pt-2.5 [.border-b]:pb-3","block-end":"order-last w-full justify-start px-3 pb-3 group-has-[>input]/input-group:pb-2.5 [.border-t]:pt-3"}},defaultVariants:{align:"inline-start"}});function pK({className:e,align:t="inline-start",...n}){return(0,A.jsx)("div",{role:"group","data-slot":"input-group-addon","data-align":t,className:oG(pH({align:t}),e),onClick:e=>{e.target.closest("button")||e.currentTarget.parentElement?.querySelector("input")?.focus()},...n})}let pG=iW("flex items-center gap-2 text-sm shadow-none",{variants:{size:{xs:"h-6 gap-1 rounded-[calc(var(--radius)-5px)] px-2 has-[>svg]:px-2 [&>svg:not([class*='size-'])]:size-3.5",sm:"h-8 gap-1.5 rounded-md px-2.5 has-[>svg]:px-2.5","icon-xs":"size-6 rounded-[calc(var(--radius)-5px)] p-0 has-[>svg]:p-0","icon-sm":"size-8 p-0 has-[>svg]:p-0"}},defaultVariants:{size:"xs"}});function pq({className:e,type:t="button",variant:n="ghost",size:r="xs",...i}){return(0,A.jsx)(oJ,{type:t,"data-size":r,variant:n,className:oG(pG({size:r}),e),...i})}D("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);var pJ=e.i(186336),pJ=pJ;function pY({...e}){return(0,A.jsx)(pJ.Root,{"data-slot":"tooltip",...e})}function pX({...e}){return(0,A.jsx)(pJ.Trigger,{"data-slot":"tooltip-trigger",...e})}function pZ({className:e,sideOffset:t=0,children:n,...r}){return(0,A.jsx)(pJ.Portal,{children:(0,A.jsxs)(pJ.Content,{"data-slot":"tooltip-content",sideOffset:t,className:oG("z-50 w-fit origin-(--radix-tooltip-content-transform-origin) animate-in rounded-md bg-foreground px-3 py-1.5 text-xs text-balance text-background fade-in-0 zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",e),...r,children:[n,(0,A.jsx)(pJ.Arrow,{className:"z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground"})]})})}D("corner-down-left",[["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}],["path",{d:"m9 10-5 5 5 5",key:"1kshq7"}]]),D("image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]),D("monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]),D("square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);let pQ=(e=21)=>{let t="",n=crypto.getRandomValues(new Uint8Array(e|=0));for(;e--;)t+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[63&n[e]];return t},p0=async e=>{try{let t=await fetch(e),n=await t.blob();return new Promise(e=>{let t=new FileReader;t.onloadend=()=>e(t.result),t.onerror=()=>e(null),t.readAsDataURL(n)})}catch{return null}},p1=(0,T.createContext)(null),p2=(0,T.createContext)(null),p5=(0,T.createContext)(null),p3=({className:e,accept:t,multiple:n,globalDrop:r,syncHiddenInput:i,maxFiles:o,maxFileSize:s,onError:a,onSubmit:l,children:u,...c})=>{let d=(0,T.useContext)(p1),h=!!d,f=(0,T.useRef)(null),p=(0,T.useRef)(null),[m,g]=(0,T.useState)([]),y=h?d.attachments.files:m,[v,x]=(0,T.useState)([]),b=(0,T.useRef)(y);(0,T.useEffect)(()=>{b.current=y},[y]);let w=(0,T.useCallback)(()=>{f.current?.click()},[]),k=(0,T.useCallback)(e=>!t||""===t.trim()||t.split(",").map(e=>e.trim()).filter(Boolean).some(t=>{if(t.endsWith("/*")){let n=t.slice(0,-1);return e.type.startsWith(n)}return e.type===t}),[t]),_=(0,T.useCallback)(e=>{let t=[...e],n=t.filter(e=>k(e));if(t.length&&0===n.length)return void a?.({code:"accept",message:"No files match the accepted types."});let r=n.filter(e=>!s||e.size<=s);n.length>0&&0===r.length?a?.({code:"max_file_size",message:"All files exceed the maximum size."}):g(e=>{let t="number"==typeof o?Math.max(0,o-e.length):void 0,n="number"==typeof t?r.slice(0,t):r;"number"==typeof t&&r.length>t&&a?.({code:"max_files",message:"Too many files. Some were not added."});let i=[];for(let e of n)i.push({filename:e.name,id:pQ(),mediaType:e.type,type:"file",url:URL.createObjectURL(e)});return[...e,...i]})},[k,o,s,a]),S=(0,T.useCallback)(e=>g(t=>{let n=t.find(t=>t.id===e);return n?.url&&URL.revokeObjectURL(n.url),t.filter(t=>t.id!==e)}),[]),C=(0,T.useCallback)(e=>{let t=[...e],n=t.filter(e=>k(e));if(t.length&&0===n.length)return void a?.({code:"accept",message:"No files match the accepted types."});let r=n.filter(e=>!s||e.size<=s);if(n.length>0&&0===r.length)return void a?.({code:"max_file_size",message:"All files exceed the maximum size."});let i=y.length,l="number"==typeof o?Math.max(0,o-i):void 0,u="number"==typeof l?r.slice(0,l):r;"number"==typeof l&&r.length>l&&a?.({code:"max_files",message:"Too many files. Some were not added."}),u.length>0&&d?.attachments.add(u)},[k,s,o,a,y.length,d]),E=(0,T.useCallback)(()=>h?d?.attachments.clear():g(e=>{for(let t of e)t.url&&URL.revokeObjectURL(t.url);return[]}),[h,d]),N=(0,T.useCallback)(()=>x([]),[]),j=h?C:_,P=h?d.attachments.remove:S,M=h?d.attachments.openFileDialog:w,D=(0,T.useCallback)(()=>{E(),N()},[E,N]);(0,T.useEffect)(()=>{h&&d.__registerFileInput(f,()=>f.current?.click())},[h,d]),(0,T.useEffect)(()=>{i&&f.current&&0===y.length&&(f.current.value="")},[y,i]),(0,T.useEffect)(()=>{let e=p.current;if(!e||r)return;let t=e=>{e.dataTransfer?.types?.includes("Files")&&e.preventDefault()},n=e=>{e.dataTransfer?.types?.includes("Files")&&e.preventDefault(),e.dataTransfer?.files&&e.dataTransfer.files.length>0&&j(e.dataTransfer.files)};return e.addEventListener("dragover",t),e.addEventListener("drop",n),()=>{e.removeEventListener("dragover",t),e.removeEventListener("drop",n)}},[j,r]),(0,T.useEffect)(()=>{if(!r)return;let e=e=>{e.dataTransfer?.types?.includes("Files")&&e.preventDefault()},t=e=>{e.dataTransfer?.types?.includes("Files")&&e.preventDefault(),e.dataTransfer?.files&&e.dataTransfer.files.length>0&&j(e.dataTransfer.files)};return document.addEventListener("dragover",e),document.addEventListener("drop",t),()=>{document.removeEventListener("dragover",e),document.removeEventListener("drop",t)}},[j,r]),(0,T.useEffect)(()=>()=>{if(!h)for(let e of b.current)e.url&&URL.revokeObjectURL(e.url)},[h]);let R=(0,T.useCallback)(e=>{e.currentTarget.files&&j(e.currentTarget.files),e.currentTarget.value=""},[j]),L=(0,T.useMemo)(()=>({add:j,clear:E,fileInputRef:f,files:y.map(e=>({...e,id:e.id})),openFileDialog:M,remove:P}),[y,j,P,E,M]),O=(0,T.useMemo)(()=>({add:e=>{let t=Array.isArray(e)?e:[e];x(e=>[...e,...t.map(e=>({...e,id:pQ()}))])},clear:N,remove:e=>{x(t=>t.filter(t=>t.id!==e))},sources:v}),[v,N]),I=(0,T.useCallback)(async e=>{e.preventDefault();let t=e.currentTarget,n=h?d.textInput.value:new FormData(t).get("message")||"";h||t.reset();try{let t=await Promise.all(y.map(async({id:e,...t})=>{if(t.url?.startsWith("blob:")){let e=await p0(t.url);return{...t,url:e??t.url}}return t})),r=l({files:t,text:n},e);if(r instanceof Promise)try{await r,D(),h&&d.textInput.clear()}catch{}else D(),h&&d.textInput.clear()}catch{}},[h,d,y,l,D]),F=(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)("input",{accept:t,"aria-label":"Upload files",className:"hidden",multiple:n,onChange:R,ref:f,title:"Upload files",type:"file"}),(0,A.jsx)("form",{className:oG("w-full",e),onSubmit:I,ref:p,...c,children:(0,A.jsx)(pW,{className:"overflow-hidden",children:u})})]}),z=(0,A.jsx)(p5.Provider,{value:O,children:F});return(0,A.jsx)(p2.Provider,{value:L,children:z})},p4=({className:e,...t})=>(0,A.jsx)("div",{className:oG("contents",e),...t}),p6=({className:e,...t})=>(0,A.jsx)(pK,{align:"block-end",className:oG("justify-between gap-1",e),...t}),p8=({className:e,...t})=>(0,A.jsx)("div",{className:oG("flex min-w-0 items-center gap-1",e),...t}),p9=({variant:e="ghost",className:t,size:n,tooltip:r,...i})=>{let o=n??(T.Children.count(i.children)>1?"sm":"icon-sm"),s=(0,A.jsx)(pq,{className:oG(t),size:o,type:"button",variant:e,...i});if(!r)return s;let a="string"==typeof r?r:r.content,l="string"==typeof r?void 0:r.shortcut,u="string"==typeof r?"top":r.side??"top";return(0,A.jsxs)(pY,{children:[(0,A.jsx)(pX,{asChild:!0,children:s}),(0,A.jsxs)(pZ,{side:u,children:[a,l&&(0,A.jsx)("span",{className:"ml-2 text-muted-foreground",children:l})]})]})},p7=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],me=new Set(p7),mt=(e,t,n)=>n>t?t:n<e?e:n,mn={test:e=>"number"==typeof e,parse:parseFloat,transform:e=>e},mr={...mn,transform:e=>mt(0,1,e)},mi={...mn,default:1},mo=e=>Math.round(1e5*e)/1e5,ms=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu,ma=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,ml=(e,t)=>n=>!!("string"==typeof n&&ma.test(n)&&n.startsWith(e)||t&&null!=n&&Object.prototype.hasOwnProperty.call(n,t)),mu=(e,t,n)=>r=>{if("string"!=typeof r)return r;let[i,o,s,a]=r.match(ms);return{[e]:parseFloat(i),[t]:parseFloat(o),[n]:parseFloat(s),alpha:void 0!==a?parseFloat(a):1}},mc={...mn,transform:e=>Math.round(mt(0,255,e))},md={test:ml("rgb","red"),parse:mu("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:r=1})=>"rgba("+mc.transform(e)+", "+mc.transform(t)+", "+mc.transform(n)+", "+mo(mr.transform(r))+")"},mh={test:ml("#"),parse:function(e){let t="",n="",r="",i="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),i=e.substring(4,5),t+=t,n+=n,r+=r,i+=i),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:i?parseInt(i,16)/255:1}},transform:md.transform},mf=e=>({test:t=>"string"==typeof t&&t.endsWith(e)&&1===t.split(" ").length,parse:parseFloat,transform:t=>`${t}${e}`}),mp=mf("deg"),mm=mf("%"),mg=mf("px"),my=mf("vh"),mv=mf("vw"),mx={...mm,parse:e=>mm.parse(e)/100,transform:e=>mm.transform(100*e)},mb={test:ml("hsl","hue"),parse:mu("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>"hsla("+Math.round(e)+", "+mm.transform(mo(t))+", "+mm.transform(mo(n))+", "+mo(mr.transform(r))+")"},mw={test:e=>md.test(e)||mh.test(e)||mb.test(e),parse:e=>md.test(e)?md.parse(e):mb.test(e)?mb.parse(e):mh.parse(e),transform:e=>"string"==typeof e?e:e.hasOwnProperty("red")?md.transform(e):mb.transform(e),getAnimatableNone:e=>{let t=mw.parse(e);return t.alpha=0,mw.transform(t)}},mk=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu,m_="number",mS="color",mC=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function mE(e){let t=e.toString(),n=[],r={color:[],number:[],var:[]},i=[],o=0,s=t.replace(mC,e=>(mw.test(e)?(r.color.push(o),i.push(mS),n.push(mw.parse(e))):e.startsWith("var(")?(r.var.push(o),i.push("var"),n.push(e)):(r.number.push(o),i.push(m_),n.push(parseFloat(e))),++o,"${}")).split("${}");return{values:n,split:s,indexes:r,types:i}}function mA({split:e,types:t}){let n=e.length;return r=>{let i="";for(let o=0;o<n;o++)if(i+=e[o],void 0!==r[o]){let e=t[o];e===m_?i+=mo(r[o]):e===mS?i+=mw.transform(r[o]):i+=r[o]}return i}}let mT={test:function(e){return isNaN(e)&&"string"==typeof e&&(e.match(ms)?.length||0)+(e.match(mk)?.length||0)>0},parse:function(e){return mE(e).values},createTransformer:function(e){return mA(mE(e))},getAnimatableNone:function(e){let t=mE(e);return mA(t)(t.values.map((e,n)=>((e,t)=>"number"==typeof e?t?.trim().endsWith("/")?e:0:"number"==typeof e?0:mw.test(e)?mw.getAnimatableNone(e):e)(e,t.split[n])))}},mN=new Set(["brightness","contrast","saturate","opacity"]);function mj(e){let[t,n]=e.slice(0,-1).split("(");if("drop-shadow"===t)return e;let[r]=n.match(ms)||[];if(!r)return e;let i=n.replace(r,""),o=+!!mN.has(t);return r!==n&&(o*=100),t+"("+o+i+")"}let mP=/\b([a-z-]*)\(.*?\)/gu,mM={...mT,getAnimatableNone:e=>{let t=e.match(mP);return t?t.map(mj).join(" "):e}},mD={...mT,getAnimatableNone:e=>{let t=mT.parse(e);return mT.createTransformer(e)(t.map(e=>"number"==typeof e?0:"object"==typeof e?{...e,alpha:1}:e))}},mR={...mn,transform:Math.round},mL={borderWidth:mg,borderTopWidth:mg,borderRightWidth:mg,borderBottomWidth:mg,borderLeftWidth:mg,borderRadius:mg,borderTopLeftRadius:mg,borderTopRightRadius:mg,borderBottomRightRadius:mg,borderBottomLeftRadius:mg,width:mg,maxWidth:mg,height:mg,maxHeight:mg,top:mg,right:mg,bottom:mg,left:mg,inset:mg,insetBlock:mg,insetBlockStart:mg,insetBlockEnd:mg,insetInline:mg,insetInlineStart:mg,insetInlineEnd:mg,padding:mg,paddingTop:mg,paddingRight:mg,paddingBottom:mg,paddingLeft:mg,paddingBlock:mg,paddingBlockStart:mg,paddingBlockEnd:mg,paddingInline:mg,paddingInlineStart:mg,paddingInlineEnd:mg,margin:mg,marginTop:mg,marginRight:mg,marginBottom:mg,marginLeft:mg,marginBlock:mg,marginBlockStart:mg,marginBlockEnd:mg,marginInline:mg,marginInlineStart:mg,marginInlineEnd:mg,fontSize:mg,backgroundPositionX:mg,backgroundPositionY:mg,rotate:mp,rotateX:mp,rotateY:mp,rotateZ:mp,scale:mi,scaleX:mi,scaleY:mi,scaleZ:mi,skew:mp,skewX:mp,skewY:mp,distance:mg,translateX:mg,translateY:mg,translateZ:mg,x:mg,y:mg,z:mg,perspective:mg,transformPerspective:mg,opacity:mr,originX:mx,originY:mx,originZ:mg,zIndex:mR,fillOpacity:mr,strokeOpacity:mr,numOctaves:mR},mO={...mL,color:mw,backgroundColor:mw,outlineColor:mw,fill:mw,stroke:mw,borderColor:mw,borderTopColor:mw,borderRightColor:mw,borderBottomColor:mw,borderLeftColor:mw,filter:mM,WebkitFilter:mM,mask:mD,WebkitMask:mD},mI=e=>mO[e],mF=()=>({translate:0,scale:1,origin:0,originPoint:0}),mz=()=>({x:mF(),y:mF()}),mB=()=>({min:0,max:0}),m$=()=>({x:mB(),y:mB()}),mU=e=>!!(e&&e.getVelocity),mV=new Set(["width","height","top","left","right","bottom",...p7]),mW=e=>t=>t.test(e),mH=[mn,mg,mm,mp,mv,my,{test:e=>"auto"===e,parse:e=>e}],mK=e=>mH.find(mW(e)),mG=()=>{},mq=()=>{};lT.default;let mJ=e=>t=>"string"==typeof t&&t.startsWith(e),mY=mJ("--"),mX=mJ("var(--"),mZ=e=>!!mX(e)&&mQ.test(e.split("/*")[0].trim()),mQ=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function m0(e){return"string"==typeof e&&e.split("/*")[0].includes("var(--")}let m1=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u,m2=e=>180*e/Math.PI,m5=e=>m4(m2(Math.atan2(e[1],e[0]))),m3={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:m5,rotateZ:m5,skewX:e=>m2(Math.atan(e[1])),skewY:e=>m2(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},m4=e=>((e%=360)<0&&(e+=360),e),m6=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),m8=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),m9={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:m6,scaleY:m8,scale:e=>(m6(e)+m8(e))/2,rotateX:e=>m4(m2(Math.atan2(e[6],e[5]))),rotateY:e=>m4(m2(Math.atan2(-e[2],e[0]))),rotateZ:m5,rotate:m5,skewX:e=>m2(Math.atan(e[4])),skewY:e=>m2(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function m7(e){return+!!e.includes("scale")}function ge(e,t){let n,r;if(!e||"none"===e)return m7(t);let i=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);if(i)n=m9,r=i;else{let t=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);n=m3,r=t}if(!r)return m7(t);let o=n[t],s=r[1].split(",").map(gt);return"function"==typeof o?o(s):s[o]}function gt(e){return parseFloat(e.trim())}let gn=e=>e===mn||e===mg,gr=new Set(["x","y","z"]),gi=p7.filter(e=>!gr.has(e)),go={width:({x:e},{paddingLeft:t="0",paddingRight:n="0",boxSizing:r})=>{let i=e.max-e.min;return"border-box"===r?i:i-parseFloat(t)-parseFloat(n)},height:({y:e},{paddingTop:t="0",paddingBottom:n="0",boxSizing:r})=>{let i=e.max-e.min;return"border-box"===r?i:i-parseFloat(t)-parseFloat(n)},top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>ge(t,"x"),y:(e,{transform:t})=>ge(t,"y")};go.translateX=go.x,go.translateY=go.y;let gs=e=>e,ga={},gl=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function gu(e,t){let n=!1,r=!0,i={delta:0,timestamp:0,isProcessing:!1},o=()=>n=!0,s=gl.reduce((e,n)=>(e[n]=function(e,t){let n=new Set,r=new Set,i=!1,o=!1,s=new WeakSet,a={delta:0,timestamp:0,isProcessing:!1},l=0;function u(t){s.has(t)&&(c.schedule(t),e()),l++,t(a)}let c={schedule:(e,t=!1,o=!1)=>{let a=o&&i?n:r;return t&&s.add(e),a.add(e),e},cancel:e=>{r.delete(e),s.delete(e)},process:e=>{if(a=e,i){o=!0;return}i=!0;let s=n;n=r,r=s,n.forEach(u),t,l=0,n.clear(),i=!1,o&&(o=!1,c.process(e))}};return c}(o,t?n:void 0),e),{}),{setup:a,read:l,resolveKeyframes:u,preUpdate:c,update:d,preRender:h,render:f,postRender:p}=s,m=()=>{let o=ga.useManualTiming,s=o?i.timestamp:performance.now();n=!1,o||(i.delta=r?1e3/60:Math.max(Math.min(s-i.timestamp,40),1)),i.timestamp=s,i.isProcessing=!0,a.process(i),l.process(i),u.process(i),c.process(i),d.process(i),h.process(i),f.process(i),p.process(i),i.isProcessing=!1,n&&t&&(r=!1,e(m))};return{schedule:gl.reduce((t,o)=>{let a=s[o];return t[o]=(t,o=!1,s=!1)=>(!n&&(n=!0,r=!0,i.isProcessing||e(m)),a.schedule(t,o,s)),t},{}),cancel:e=>{for(let t=0;t<gl.length;t++)s[gl[t]].cancel(e)},state:i,steps:s}}let{schedule:gc,cancel:gd,state:gh,steps:gf}=gu("u">typeof requestAnimationFrame?requestAnimationFrame:gs,!0),gp=new Set,gm=!1,gg=!1,gy=!1;function gv(){if(gg){let e=Array.from(gp).filter(e=>e.needsMeasurement),t=new Set(e.map(e=>e.element)),n=new Map;t.forEach(e=>{let t,r=(t=[],gi.forEach(n=>{let r=e.getValue(n);void 0!==r&&(t.push([n,r.get()]),r.set(+!!n.startsWith("scale")))}),t);r.length&&(n.set(e,r),e.render())}),e.forEach(e=>e.measureInitialState()),t.forEach(e=>{e.render();let t=n.get(e);t&&t.forEach(([t,n])=>{e.getValue(t)?.set(n)})}),e.forEach(e=>e.measureEndState()),e.forEach(e=>{void 0!==e.suspendedScrollY&&window.scrollTo(0,e.suspendedScrollY)})}gg=!1,gm=!1,gp.forEach(e=>e.complete(gy)),gp.clear()}function gx(){gp.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(gg=!0)})}class gb{constructor(e,t,n,r,i,o=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=t,this.name=n,this.motionValue=r,this.element=i,this.isAsync=o}scheduleResolve(){this.state="scheduled",this.isAsync?(gp.add(this),gm||(gm=!0,gc.read(gx),gc.resolveKeyframes(gv))):(this.readKeyframes(),this.complete())}readKeyframes(){let{unresolvedKeyframes:e,name:t,element:n,motionValue:r}=this;if(null===e[0]){let i=r?.get(),o=e[e.length-1];if(void 0!==i)e[0]=i;else if(n&&t){let r=n.readValue(t,o);null!=r&&(e[0]=r)}void 0===e[0]&&(e[0]=o),r&&void 0===i&&r.set(e[0])}for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),gp.delete(this)}cancel(){"scheduled"===this.state&&(gp.delete(this),this.state="pending")}resume(){"pending"===this.state&&this.scheduleResolve()}}let gw=new Set([mM,mD]);function gk(e,t){let n=mI(e);return gw.has(n)||(n=mT),n.getAnimatableNone?n.getAnimatableNone(t):void 0}let g_=new Set(["auto","none","0"]);class gS extends gb{constructor(e,t,n,r,i){super(e,t,n,r,i,!0)}readKeyframes(){let{unresolvedKeyframes:e,element:t,name:n}=this;if(!t||!t.current)return;super.readKeyframes();for(let n=0;n<e.length;n++){let r=e[n];if("string"==typeof r&&mZ(r=r.trim())){let i=function e(t,n,r=1){mq(r<=4,`Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`,"max-css-var-depth");let[i,o]=function(e){let t=m1.exec(e);if(!t)return[,];let[,n,r,i]=t;return[`--${n??r}`,i]}(t);if(!i)return;let s=window.getComputedStyle(n).getPropertyValue(i);if(s){let e=s.trim();return/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e)?parseFloat(e):e}return mZ(o)?e(o,n,r+1):o}(r,t.current);void 0!==i&&(e[n]=i),n===e.length-1&&(this.finalKeyframe=r)}}if(this.resolveNoneKeyframes(),!mV.has(n)||2!==e.length)return;let[r,i]=e,o=mK(r),s=mK(i);if(m0(r)!==m0(i)&&go[n]){this.needsMeasurement=!0;return}if(o!==s)if(gn(o)&&gn(s))for(let t=0;t<e.length;t++){let n=e[t];"string"==typeof n&&(e[t]=parseFloat(n))}else go[n]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){let{unresolvedKeyframes:e,name:t}=this,n=[];for(let t=0;t<e.length;t++)(null===e[t]||function(e){if("number"==typeof e)return 0===e;if(null===e)return!0;return"none"===e||"0"===e||/^0[^.\s]+$/u.test(e)}(e[t]))&&n.push(t);n.length&&function(e,t,n){let r,i=0;for(;i<e.length&&!r;){let t=e[i];"string"==typeof t&&!g_.has(t)&&mE(t).values.length&&(r=e[i]),i++}if(r&&n)for(let i of t)e[i]=gk(n,r)}(e,n,t)}measureInitialState(){let{element:e,unresolvedKeyframes:t,name:n}=this;if(!e||!e.current)return;"height"===n&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=go[n](e.measureViewportBox(),window.getComputedStyle(e.current)),t[0]=this.measuredOrigin;let r=t[t.length-1];void 0!==r&&e.getValue(n,r).jump(r,!1)}measureEndState(){let{element:e,name:t,unresolvedKeyframes:n}=this;if(!e||!e.current)return;let r=e.getValue(t);r&&r.jump(this.measuredOrigin,!1);let i=n.length-1,o=n[i];n[i]=go[t](e.measureViewportBox(),window.getComputedStyle(e.current)),null!==o&&void 0===this.finalKeyframe&&(this.finalKeyframe=o),this.removedTransforms?.length&&this.removedTransforms.forEach(([t,n])=>{e.getValue(t).set(n)}),this.resolveNoneKeyframes()}}let gC=e=>1e3*e;function gE(e,t){-1===e.indexOf(t)&&e.push(t)}function gA(e,t){let n=e.indexOf(t);n>-1&&e.splice(n,1)}class gT{constructor(){this.subscriptions=[]}add(e){return gE(this.subscriptions,e),()=>gA(this.subscriptions,e)}notify(e,t,n){let r=this.subscriptions.length;if(r)if(1===r)this.subscriptions[0](e,t,n);else for(let i=0;i<r;i++){let r=this.subscriptions[i];r&&r(e,t,n)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}function gN(e,t,n){t.startsWith("--")?e.style.setProperty(t,n):e.style[t]=n}function gj(e){let t;return()=>(void 0===t&&(t=e()),t)}let gP={};function gM(e,t){let n=gj(e);return()=>gP[t]??n()}let gD=gM(()=>void 0!==window.ScrollTimeline,"scrollTimeline"),gR=e=>null!==e;function gL(e,{repeat:t,repeatType:n="loop"},r,i=1){let o=e.filter(gR),s=i<0||t&&"loop"!==n&&t%2==1?0:o.length-1;return s&&void 0!==r?r:o[s]}class gO{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,t){return this.finished.then(e,t)}}let gI={layout:0,mainThread:0,waapi:0},gF=e=>Array.isArray(e)&&"number"==typeof e[0],gz=gM(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(e){return!1}return!0},"linearEasing"),gB=(e,t,n=10)=>{let r="",i=Math.max(Math.round(t/n),2);for(let t=0;t<i;t++)r+=Math.round(1e4*e(t/(i-1)))/1e4+", ";return`linear(${r.substring(0,r.length-2)})`},g$=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,gU={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:g$([0,.65,.55,1]),circOut:g$([.55,0,1,.45]),backIn:g$([.31,.01,.66,-.59]),backOut:g$([.33,1.53,.69,.99])};function gV(e){return"function"==typeof e&&"applyToOptions"in e}class gW extends gO{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;const{element:t,name:n,keyframes:r,pseudoElement:i,allowFlatten:o=!1,finalKeyframe:s,onComplete:a}=e;this.isPseudoElement=!!i,this.allowFlatten=o,this.options=e,mq("string"!=typeof e.type,'Mini animate() doesn\'t support "type" as a string.',"mini-spring");const l=function({type:e,...t}){return gV(e)&&gz()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}(e);this.animation=function(e,t,n,{delay:r=0,duration:i=300,repeat:o=0,repeatType:s="loop",ease:a="easeOut",times:l}={},u){let c={[t]:n};l&&(c.offset=l);let d=function e(t,n){if(t)return"function"==typeof t?gz()?gB(t,n):"ease-out":gF(t)?g$(t):Array.isArray(t)?t.map(t=>e(t,n)||gU.easeOut):gU[t]}(a,i);Array.isArray(d)&&(c.easing=d);let h={delay:r,duration:i,easing:Array.isArray(d)?"linear":d,fill:"both",iterations:o+1,direction:"reverse"===s?"alternate":"normal"};u&&(h.pseudoElement=u);let f=e.animate(c,h);return f}(t,n,r,l,i),!1===l.autoplay&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!i){let e=gL(r,this.options,s,this.speed);this.updateMotionValue&&this.updateMotionValue(e),gN(t,n,e),this.animation.cancel()}a?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),"finished"===this.state&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch(e){}}stop(){if(this.isStopped)return;this.isStopped=!0;let{state:e}=this;"idle"!==e&&"finished"!==e&&(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){let e=this.options?.element;!this.isPseudoElement&&e?.isConnected&&this.animation.commitStyles?.()}get duration(){return Number(this.animation.effect?.getComputedTiming?.().duration||0)/1e3}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+e/1e3}get time(){return(Number(this.animation.currentTime)||0)/1e3}set time(e){let t=null!==this.finishedTime;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=gC(e),t&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return null!==this.finishedTime?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,rangeStart:t,rangeEnd:n,observe:r}){return(this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,e&&gD())?(this.animation.timeline=e,t&&(this.animation.rangeStart=t),n&&(this.animation.rangeEnd=n),gs):r(this)}}let gH=new Set(["opacity","clipPath","filter","transform"]),{schedule:gK}=gu(queueMicrotask,!1);function gG(){i=void 0}let gq={now:()=>(void 0===i&&gq.set(gh.isProcessing||ga.useManualTiming?gh.timestamp:performance.now()),i),set:e=>{i=e,queueMicrotask(gG)}},gJ=(e,t)=>t?1e3/t*e:0,gY;class gX{constructor(e,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=e=>{let t=gq.now();if(this.updatedAt!==t&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(e),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(let e of this.dependents)e.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=t.owner}setCurrent(e){this.current=e,this.updatedAt=gq.now(),null===this.canTrackVelocity&&void 0!==e&&(this.canTrackVelocity=!isNaN(parseFloat(this.current)))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on("change",e)}on(e,t){this.events[e]||(this.events[e]=new gT);let n=this.events[e].add(t);return"change"===e?()=>{n(),gc.read(()=>{this.events.change.getSize()||this.stop()})}:n}clearListeners(){for(let e in this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,t,n){this.set(t),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-n}jump(e,t=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,t&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(e){this.dependents||(this.dependents=new Set),this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return gY&&gY.push(this),this.current}getPrevious(){return this.prev}getVelocity(){let e=gq.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||e-this.updatedAt>30)return 0;let t=Math.min(this.updatedAt-this.prevUpdatedAt,30);return gJ(parseFloat(this.current)-parseFloat(this.prevFrameValue),t)}start(e){return this.stop(),new Promise(t=>{this.hasAnimated=!0,this.animation=e(t),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function gZ(e,t){return new gX(e,t)}let gQ=[...mH,mw,mT],g0=new WeakMap;function g1(e){return null!==e&&"object"==typeof e&&"function"==typeof e.start}function g2(e){return"string"==typeof e||Array.isArray(e)}let g5=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],g3=["initial",...g5];function g4(e){return g1(e.animate)||g3.some(t=>g2(e[t]))}function g6(e){return!!(g4(e)||e.variants)}let g8={current:null},g9={current:!1},g7="u">typeof window;function ye(e){let t=[{},{}];return e?.values.forEach((e,n)=>{t[0][n]=e.get(),t[1][n]=e.getVelocity()}),t}function yt(e,t,n,r){if("function"==typeof t){let[i,o]=ye(r);t=t(void 0!==n?n:e.custom,i,o)}if("string"==typeof t&&(t=e.variants&&e.variants[t]),"function"==typeof t){let[i,o]=ye(r);t=t(void 0!==n?n:e.custom,i,o)}return t}let yn=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],yr={};class yi{scrapeMotionValuesFromProps(e,t,n){return{}}constructor({parent:e,props:t,presenceContext:n,reducedMotionConfig:r,skipAnimations:i,blockInitialAnimation:o,visualState:s},a={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=gb,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{let e=gq.now();this.renderScheduledAt<e&&(this.renderScheduledAt=e,gc.render(this.render,!1,!0))};const{latestValues:l,renderState:u}=s;this.latestValues=l,this.baseTarget={...l},this.initialValues=t.initial?{...l}:{},this.renderState=u,this.parent=e,this.props=t,this.presenceContext=n,this.depth=e?e.depth+1:0,this.reducedMotionConfig=r,this.skipAnimationsConfig=i,this.options=a,this.blockInitialAnimation=!!o,this.isControllingVariants=g4(t),this.isVariantNode=g6(t),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:c,...d}=this.scrapeMotionValuesFromProps(t,{},this);for(const e in d){const t=d[e];void 0!==l[e]&&mU(t)&&t.set(l[e])}}mount(e){if(this.hasBeenMounted)for(let e in this.initialValues)this.values.get(e)?.jump(this.initialValues[e]),this.latestValues[e]=this.initialValues[e];this.current=e,g0.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((e,t)=>this.bindToMotionValue(t,e)),"never"===this.reducedMotionConfig?this.shouldReduceMotion=!1:"always"===this.reducedMotionConfig?this.shouldReduceMotion=!0:(g9.current||function(){if(g9.current=!0,g7)if(window.matchMedia){let e=window.matchMedia("(prefers-reduced-motion)"),t=()=>g8.current=e.matches;e.addEventListener("change",t),t()}else g8.current=!1}(),this.shouldReduceMotion=g8.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,this.parent?.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){for(let e in this.projection&&this.projection.unmount(),gd(this.notifyUpdate),gd(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this),this.events)this.events[e].clear();for(let e in this.features){let t=this.features[e];t&&(t.unmount(),t.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,t){let n;if(this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)(),t.accelerate&&gH.has(e)&&this.current instanceof HTMLElement){let{factory:n,keyframes:r,times:i,ease:o,duration:s}=t.accelerate,a=new gW({element:this.current,name:e,keyframes:r,times:i,ease:o,duration:gC(s)}),l=n(a);this.valueSubscriptions.set(e,()=>{l(),a.cancel()});return}let r=me.has(e);r&&this.onBindTransform&&this.onBindTransform();let i=t.on("change",t=>{this.latestValues[e]=t,this.props.onUpdate&&gc.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});"u">typeof window&&window.MotionCheckAppearSync&&(n=window.MotionCheckAppearSync(this,e,t)),this.valueSubscriptions.set(e,()=>{i(),n&&n()})}sortNodePosition(e){return this.current&&this.sortInstanceNodePosition&&this.type===e.type?this.sortInstanceNodePosition(this.current,e.current):0}updateFeatures(){let e="animation";for(e in yr){let t=yr[e];if(!t)continue;let{isEnabled:n,Feature:r}=t;if(!this.features[e]&&r&&n(this.props)&&(this.features[e]=new r(this)),this.features[e]){let t=this.features[e];t.isMounted?t.update():(t.mount(),t.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):m$()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,t){this.latestValues[e]=t}update(e,t){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=t;for(let t=0;t<yn.length;t++){let n=yn[t];this.propEventSubscriptions[n]&&(this.propEventSubscriptions[n](),delete this.propEventSubscriptions[n]);let r=e["on"+n];r&&(this.propEventSubscriptions[n]=this.on(n,r))}this.prevMotionValues=function(e,t,n){for(let r in t){let i=t[r],o=n[r];if(mU(i))e.addValue(r,i);else if(mU(o))e.addValue(r,gZ(i,{owner:e}));else if(o!==i)if(e.hasValue(r)){let t=e.getValue(r);!0===t.liveStyle?t.jump(i):t.hasAnimated||t.set(i)}else{let t=e.getStaticValue(r);e.addValue(r,gZ(void 0!==t?t:i,{owner:e}))}}for(let r in n)void 0===t[r]&&e.removeValue(r);return t}(this,this.scrapeMotionValuesFromProps(e,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){let t=this.getClosestVariantNode();if(t)return t.variantChildren&&t.variantChildren.add(e),()=>t.variantChildren.delete(e)}addValue(e,t){let n=this.values.get(e);t!==n&&(n&&this.removeValue(e),this.bindToMotionValue(e,t),this.values.set(e,t),this.latestValues[e]=t.get())}removeValue(e){this.values.delete(e);let t=this.valueSubscriptions.get(e);t&&(t(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,t){if(this.props.values&&this.props.values[e])return this.props.values[e];let n=this.values.get(e);return void 0===n&&void 0!==t&&(n=gZ(null===t?void 0:t,{owner:this}),this.addValue(e,n)),n}readValue(e,t){let n=void 0===this.latestValues[e]&&this.current?this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options):this.latestValues[e];if(null!=n){let r,i;if("string"==typeof n&&(r=n,/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(r)||(i=n,/^0[^.\s]+$/u.test(i))))n=parseFloat(n);else{let r;r=n,!gQ.find(mW(r))&&mT.test(t)&&(n=gk(e,t))}this.setBaseTarget(e,mU(n)?n.get():n)}return mU(n)?n.get():n}setBaseTarget(e,t){this.baseTarget[e]=t}getBaseTarget(e){let t,{initial:n}=this.props;if("string"==typeof n||"object"==typeof n){let r=yt(this.props,n,this.presenceContext?.custom);r&&(t=r[e])}if(n&&void 0!==t)return t;let r=this.getBaseTargetFromProps(this.props,e);return void 0===r||mU(r)?void 0!==this.initialValues[e]&&void 0===t?void 0:this.baseTarget[e]:r}on(e,t){return this.events[e]||(this.events[e]=new gT),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}scheduleRenderMicrotask(){gK.render(this.render)}}class yo extends yi{constructor(){super(...arguments),this.KeyframeResolver=gS}sortInstanceNodePosition(e,t){return 2&e.compareDocumentPosition(t)?1:-1}getBaseTargetFromProps(e,t){let n=e.style;return n?n[t]:void 0}removeValueFromRenderState(e,{vars:t,style:n}){delete t[e],delete n[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);let{children:e}=this.props;mU(e)&&(this.childSubscription=e.on("change",e=>{this.current&&(this.current.textContent=`${e}`)}))}}function ys(e){return e.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}let ya=(e,t)=>t&&"number"==typeof e?t.transform(e):e,yl={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},yu=p7.length;function yc(e,t,n){let{style:r,vars:i,transformOrigin:o}=e,s=!1,a=!1;for(let e in t){let n=t[e];if(me.has(e)){s=!0;continue}if(mY(e)){i[e]=n;continue}{let t=ya(n,mL[e]);e.startsWith("origin")?(a=!0,o[e]=t):r[e]=t}}if(!t.transform&&(s||n?r.transform=function(e,t,n){let r="",i=!0;for(let o=0;o<yu;o++){let s=p7[o],a=e[s];if(void 0===a)continue;let l=!0;if("number"==typeof a)l=a===+!!s.startsWith("scale");else{let e=parseFloat(a);l=s.startsWith("scale")?1===e:0===e}if(!l||n){let e=ya(a,mL[s]);if(!l){i=!1;let t=yl[s]||s;r+=`${t}(${e}) `}n&&(t[s]=e)}}return r=r.trim(),n?r=n(t,i?"":r):i&&(r="none"),r}(t,e.transform,n):r.transform&&(r.transform="none")),a){let{originX:e="50%",originY:t="50%",originZ:n=0}=o;r.transformOrigin=`${e} ${t} ${n}`}}let yd={offset:"stroke-dashoffset",array:"stroke-dasharray"},yh={offset:"strokeDashoffset",array:"strokeDasharray"},yf=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function yp(e,{attrX:t,attrY:n,attrScale:r,pathLength:i,pathSpacing:o=1,pathOffset:s=0,...a},l,u,c){if(yc(e,a,u),l){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};let{attrs:d,style:h}=e;for(let e of(d.transform&&(h.transform=d.transform,delete d.transform),(h.transform||d.transformOrigin)&&(h.transformOrigin=d.transformOrigin??"50% 50%",delete d.transformOrigin),h.transform&&(h.transformBox=c?.transformBox??"fill-box",delete d.transformBox),yf))void 0!==d[e]&&(h[e]=d[e],delete d[e]);void 0!==t&&(d.x=t),void 0!==n&&(d.y=n),void 0!==r&&(d.scale=r),void 0!==i&&function(e,t,n=1,r=0,i=!0){e.pathLength=1;let o=i?yd:yh;e[o.offset]=`${-r}`,e[o.array]=`${t} ${n}`}(d,i,o,s,!1)}let ym=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),yg=e=>"string"==typeof e&&"svg"===e.toLowerCase();function yy(e,{style:t,vars:n},r,i){let o,s=e.style;for(o in t)s[o]=t[o];for(o in i?.applyProjectionStyles(s,r),n)s.setProperty(o,n[o])}function yv(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}let yx={correct:(e,t)=>{if(!t.target)return e;if("string"==typeof e)if(!mg.test(e))return e;else e=parseFloat(e);let n=yv(e,t.target.x),r=yv(e,t.target.y);return`${n}% ${r}%`}},yb=(e,t,n)=>e+(t-e)*n,yw={borderRadius:{...yx,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:yx,borderTopRightRadius:yx,borderBottomLeftRadius:yx,borderBottomRightRadius:yx,boxShadow:{correct:(e,{treeScale:t,projectionDelta:n})=>{let r=mT.parse(e);if(r.length>5)return e;let i=mT.createTransformer(e),o=+("number"!=typeof r[0]),s=n.x.scale*t.x,a=n.y.scale*t.y;r[0+o]/=s,r[1+o]/=a;let l=yb(s,a,.5);return"number"==typeof r[2+o]&&(r[2+o]/=l),"number"==typeof r[3+o]&&(r[3+o]/=l),i(r)}}};function yk(e,{layout:t,layoutId:n}){return me.has(e)||e.startsWith("origin")||(t||void 0!==n)&&(!!yw[e]||"opacity"===e)}function y_(e,t,n){let r=e.style,i=t?.style,o={};if(!r)return o;for(let t in r)(mU(r[t])||i&&mU(i[t])||yk(t,e)||n?.getValue(t)?.liveStyle!==void 0)&&(o[t]=r[t]);return o}function yS(e,t,n){let r=y_(e,t,n);for(let n in e)(mU(e[n])||mU(t[n]))&&(r[-1!==p7.indexOf(n)?"attr"+n.charAt(0).toUpperCase()+n.substring(1):n]=e[n]);return r}class yC extends yo{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=m$}getBaseTargetFromProps(e,t){return e[t]}readValueFromInstance(e,t){if(me.has(t)){let e=mI(t);return e&&e.default||0}return t=ym.has(t)?t:ys(t),e.getAttribute(t)}scrapeMotionValuesFromProps(e,t,n){return yS(e,t,n)}build(e,t,n){yp(e,t,this.isSVGTag,n.transformTemplate,n.style)}renderInstance(e,t,n,r){for(let n in yy(e,t,void 0,r),t.attrs)e.setAttribute(ym.has(n)?n:ys(n),t.attrs[n])}mount(e){this.isSVGTag=yg(e.tagName),super.mount(e)}}function yE({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function yA(e){return void 0===e||1===e}function yT({scale:e,scaleX:t,scaleY:n}){return!yA(e)||!yA(t)||!yA(n)}function yN(e){return yT(e)||yj(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function yj(e){var t,n;return(t=e.x)&&"0%"!==t||(n=e.y)&&"0%"!==n}function yP(e,t,n,r,i){return void 0!==i&&(e=r+i*(e-r)),r+n*(e-r)+t}function yM(e,t=0,n=1,r,i){e.min=yP(e.min,t,n,r,i),e.max=yP(e.max,t,n,r,i)}function yD(e,{x:t,y:n}){yM(e.x,t.translate,t.scale,t.originPoint),yM(e.y,n.translate,n.scale,n.originPoint)}function yR(e,t){e.min+=t,e.max+=t}function yL(e,t,n,r,i=.5){let o=yb(e.min,e.max,i);yM(e,t,n,o,r)}function yO(e,t){return"string"==typeof e?parseFloat(e)/100*(t.max-t.min):e}function yI(e,t,n){let r=n??e;yL(e.x,yO(t.x,r.x),t.scaleX,t.scale,t.originX),yL(e.y,yO(t.y,r.y),t.scaleY,t.scale,t.originY)}function yF(e,t){return yE(function(e,t){if(!t)return e;let n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}(e.getBoundingClientRect(),t))}class yz extends yo{constructor(){super(...arguments),this.type="html",this.renderInstance=yy}readValueFromInstance(e,t){if(me.has(t))return this.projection?.isProjecting?m7(t):((e,t)=>{let{transform:n="none"}=getComputedStyle(e);return ge(n,t)})(e,t);{let n=window.getComputedStyle(e),r=(mY(t)?n.getPropertyValue(t):n[t])||0;return"string"==typeof r?r.trim():r}}measureInstanceViewportBox(e,{transformPagePoint:t}){return yF(e,t)}build(e,t,n){yc(e,t,n.transformTemplate)}scrapeMotionValuesFromProps(e,t,n){return y_(e,t,n)}}let yB=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function y$(e){if("string"!=typeof e||e.includes("-"));else if(yB.indexOf(e)>-1||/[A-Z]/u.test(e))return!0;return!1}let yU=(0,T.createContext)({}),yV=(0,T.createContext)({strict:!1}),yW=(0,T.createContext)({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"}),yH=(0,T.createContext)({});function yK(e){return Array.isArray(e)?e.join(" "):e}let yG=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function yq(e,t,n){for(let r in t)mU(t[r])||yk(r,n)||(e[r]=t[r])}let yJ=()=>({...yG(),attrs:{}}),yY=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","propagate","ignoreStrict","viewport"]);function yX(e){return e.startsWith("while")||e.startsWith("drag")&&"draggable"!==e||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||yY.has(e)}let yZ=e=>!yX(e);try{S=(()=>{let e=Error("Cannot find module '@emotion/is-prop-valid'");throw e.code="MODULE_NOT_FOUND",e})().default,"function"==typeof S&&(yZ=e=>e.startsWith("on")?!yX(e):S(e))}catch{}function yQ(e){return mU(e)?e.get():e}let y0=(0,T.createContext)(null),y1=e=>(t,n)=>{let r,i=(0,T.useContext)(yH),o=(0,T.useContext)(y0),s=()=>(function({scrapeMotionValuesFromProps:e,createRenderState:t},n,r,i){return{latestValues:function(e,t,n,r){let i={},o=r(e,{});for(let e in o)i[e]=yQ(o[e]);let{initial:s,animate:a}=e,l=g4(e),u=g6(e);t&&u&&!l&&!1!==e.inherit&&(void 0===s&&(s=t.initial),void 0===a&&(a=t.animate));let c=!!n&&!1===n.initial,d=(c=c||!1===s)?a:s;if(d&&"boolean"!=typeof d&&!g1(d)){let t=Array.isArray(d)?d:[d];for(let n=0;n<t.length;n++){let r=yt(e,t[n]);if(r){let{transitionEnd:e,transition:t,...n}=r;for(let e in n){let t=n[e];if(Array.isArray(t)){let e=c?t.length-1:0;t=t[e]}null!==t&&(i[e]=t)}for(let t in e)i[t]=e[t]}}}return i}(n,r,i,e),renderState:t()}})(e,t,i,o);return n?s():(null===(r=(0,T.useRef)(null)).current&&(r.current=s()),r.current)},y2=y1({scrapeMotionValuesFromProps:y_,createRenderState:yG}),y5=y1({scrapeMotionValuesFromProps:yS,createRenderState:yJ}),y3={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},y4=!1;function y6(){return!function(){if(y4)return;let e={};for(let t in y3)e[t]={isEnabled:e=>y3[t].some(t=>!!e[t])};yr=e,y4=!0}(),yr}let y8=Symbol.for("motionComponentSymbol"),y9="data-"+ys("framerAppearId"),y7=(0,T.createContext)({});function ve(e){return e&&"object"==typeof e&&Object.prototype.hasOwnProperty.call(e,"current")}let vt="u">typeof window?T.useLayoutEffect:T.useEffect;function vn(e,{forwardMotionProps:t=!1,type:n}={},r,i){r&&function(e){let t=y6();for(let n in e)t[n]={...t[n],...e[n]};yr=t}(r);let o=n?"svg"===n:y$(e),s=o?y5:y2;function a(n,r){var a;let l,u,c,d={...(0,T.useContext)(yW),...n,layoutId:function({layoutId:e}){let t=(0,T.useContext)(yU).id;return t&&void 0!==e?t+"-"+e:e}(n)},{isStatic:h}=d,f=function(e){let{initial:t,animate:n}=function(e,t){if(g4(e)){let{initial:t,animate:n}=e;return{initial:!1===t||g2(t)?t:void 0,animate:g2(n)?n:void 0}}return!1!==e.inherit?t:{}}(e,(0,T.useContext)(yH));return(0,T.useMemo)(()=>({initial:t,animate:n}),[yK(t),yK(n)])}(n),p=s(n,h);if(!h&&"u">typeof window){(0,T.useContext)(yV).strict;let t=function(e){let{drag:t,layout:n}=y6();if(!t&&!n)return{};let r={...t,...n};return{MeasureLayout:t?.isEnabled(e)||n?.isEnabled(e)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}(d);l=t.MeasureLayout,f.visualElement=function(e,t,n,r,i,o){let{visualElement:s}=(0,T.useContext)(yH),a=(0,T.useContext)(yV),l=(0,T.useContext)(y0),u=(0,T.useContext)(yW),c=u.reducedMotion,d=u.skipAnimations,h=(0,T.useRef)(null),f=(0,T.useRef)(!1);r=r||a.renderer,!h.current&&r&&(h.current=r(e,{visualState:t,parent:s,props:n,presenceContext:l,blockInitialAnimation:!!l&&!1===l.initial,reducedMotionConfig:c,skipAnimations:d,isSVG:o}),f.current&&h.current&&(h.current.manuallyAnimateOnMount=!0));let p=h.current,m=(0,T.useContext)(y7);p&&!p.projection&&i&&("html"===p.type||"svg"===p.type)&&function(e,t,n,r){let{layoutId:i,layout:o,drag:s,dragConstraints:a,layoutScroll:l,layoutRoot:u,layoutAnchor:c,layoutCrossfade:d}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:function e(t){if(t)return!1!==t.options.allowProjection?t.projection:e(t.parent)}(e.parent)),e.projection.setOptions({layoutId:i,layout:o,alwaysMeasureLayout:!!s||a&&ve(a),visualElement:e,animationType:"string"==typeof o?o:"both",initialPromotionConfig:r,crossfade:d,layoutScroll:l,layoutRoot:u,layoutAnchor:c})}(h.current,n,i,m);let g=(0,T.useRef)(!1);(0,T.useInsertionEffect)(()=>{p&&g.current&&p.update(n,l)});let y=n[y9],v=(0,T.useRef)(!!y&&"u">typeof window&&!window.MotionHandoffIsComplete?.(y)&&window.MotionHasOptimisedAnimation?.(y));return vt(()=>{f.current=!0,p&&(g.current=!0,window.MotionIsMounted=!0,p.updateFeatures(),p.scheduleRenderMicrotask(),v.current&&p.animationState&&p.animationState.animateChanges())}),(0,T.useEffect)(()=>{p&&(!v.current&&p.animationState&&p.animationState.animateChanges(),v.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(y)}),v.current=!1),p.enteringChildren=void 0)}),p}(e,p,d,i,t.ProjectionNode,o)}return(0,A.jsxs)(yH.Provider,{value:f,children:[l&&f.visualElement?(0,A.jsx)(l,{visualElement:f.visualElement,...d}):null,function(e,t,n,{latestValues:r},i,o=!1,s){let a=(s??y$(e)?function(e,t,n,r){let i=(0,T.useMemo)(()=>{let n=yJ();return yp(n,t,yg(r),e.transformTemplate,e.style),{...n.attrs,style:{...n.style}}},[t]);if(e.style){let t={};yq(t,e.style,e),i.style={...t,...i.style}}return i}:function(e,t){let n,r,i={},o=(n=e.style||{},yq(r={},n,e),Object.assign(r,function({transformTemplate:e},t){return(0,T.useMemo)(()=>{let n=yG();return yc(n,t,e),Object.assign({},n.vars,n.style)},[t])}(e,t)),r);return e.drag&&!1!==e.dragListener&&(i.draggable=!1,o.userSelect=o.WebkitUserSelect=o.WebkitTouchCallout="none",o.touchAction=!0===e.drag?"none":`pan-${"x"===e.drag?"y":"x"}`),void 0===e.tabIndex&&(e.onTap||e.onTapStart||e.whileTap)&&(i.tabIndex=0),i.style=o,i})(t,r,i,e),l=function(e,t,n){let r={};for(let i in e)("values"!==i||"object"!=typeof e.values)&&!mU(e[i])&&(yZ(i)||!0===n&&yX(i)||!t&&!yX(i)||e.draggable&&i.startsWith("onDrag"))&&(r[i]=e[i]);return r}(t,"string"==typeof e,o),u=e!==T.Fragment?{...l,...a,ref:n}:{},{children:c}=t,d=(0,T.useMemo)(()=>mU(c)?c.get():c,[c]);return(0,T.createElement)(e,{...u,children:d})}(e,n,(a=f.visualElement,u=(0,T.useRef)(r),(0,T.useInsertionEffect)(()=>{u.current=r}),c=(0,T.useRef)(null),(0,T.useCallback)(e=>{e&&p.onMount?.(e),a&&(e?a.mount(e):a.unmount());let t=u.current;if("function"==typeof t)if(e){let n=t(e);"function"==typeof n&&(c.current=n)}else c.current?(c.current(),c.current=null):t(e);else t&&(t.current=e)},[a])),p,h,t,o)]})}a.displayName=`motion.${"string"==typeof e?e:`create(${e.displayName??e.name??""})`}`;let l=(0,T.forwardRef)(a);return l[y8]=e,l}class vr{constructor(e){this.isMounted=!1,this.node=e}update(){}}function vi(e,t,n){let r=e.getProps();return yt(r,t,void 0!==n?n:r.custom,e)}function vo(e,t){if(e?.inherit&&t){let{inherit:n,...r}=e;return{...t,...r}}return e}function vs(e,t){let n=e?.[t]??e?.default??e;return n!==e?vo(n,e):n}let va=e=>Array.isArray(e);function vl(e,t){let n=e.getValue("willChange");if(mU(n)&&n.add)return n.add(t);if(!n&&ga.WillChange){let n=new ga.WillChange("auto");e.addValue("willChange",n),n.add(t)}}let vu=(...e)=>e.reduce((e,t)=>n=>t(e(n)));function vc(e,t,n){return(n<0&&(n+=1),n>1&&(n-=1),n<1/6)?e+(t-e)*6*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function vd(e,t){return n=>n>0?t:e}let vh=(e,t,n)=>{let r=e*e,i=n*(t*t-r)+r;return i<0?0:Math.sqrt(i)},vf=[mh,md,mb];function vp(e){let t=vf.find(t=>t.test(e));if(mG(!!t,`'${e}' is not an animatable color. Use the equivalent color code instead.`,"color-not-animatable"),!t)return!1;let n=t.parse(e);return t===mb&&(n=function({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,n/=100;let i=0,o=0,s=0;if(t/=100){let r=n<.5?n*(1+t):n+t-n*t,a=2*n-r;i=vc(a,r,e+1/3),o=vc(a,r,e),s=vc(a,r,e-1/3)}else i=o=s=n;return{red:Math.round(255*i),green:Math.round(255*o),blue:Math.round(255*s),alpha:r}}(n)),n}let vm=(e,t)=>{let n=vp(e),r=vp(t);if(!n||!r)return vd(e,t);let i={...n};return e=>(i.red=vh(n.red,r.red,e),i.green=vh(n.green,r.green,e),i.blue=vh(n.blue,r.blue,e),i.alpha=yb(n.alpha,r.alpha,e),md.transform(i))},vg=new Set(["none","hidden"]);function vy(e,t){return n=>yb(e,t,n)}function vv(e){return"number"==typeof e?vy:"string"==typeof e?mZ(e)?vd:mw.test(e)?vm:vw:Array.isArray(e)?vx:"object"==typeof e?mw.test(e)?vm:vb:vd}function vx(e,t){let n=[...e],r=n.length,i=e.map((e,n)=>vv(e)(e,t[n]));return e=>{for(let t=0;t<r;t++)n[t]=i[t](e);return n}}function vb(e,t){let n={...e,...t},r={};for(let i in n)void 0!==e[i]&&void 0!==t[i]&&(r[i]=vv(e[i])(e[i],t[i]));return e=>{for(let t in r)n[t]=r[t](e);return n}}let vw=(e,t)=>{let n=mT.createTransformer(t),r=mE(e),i=mE(t);if(!(r.indexes.var.length===i.indexes.var.length&&r.indexes.color.length===i.indexes.color.length&&r.indexes.number.length>=i.indexes.number.length))return mG(!0,`Complex values '${e}' and '${t}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`,"complex-values-different"),vd(e,t);if(vg.has(e)&&!i.values.length||vg.has(t)&&!r.values.length)return vg.has(e)?n=>n<=0?e:t:n=>n>=1?t:e;return vu(vx(function(e,t){let n=[],r={color:0,var:0,number:0};for(let i=0;i<t.values.length;i++){let o=t.types[i],s=e.indexes[o][r[o]],a=e.values[s]??0;n[i]=a,r[o]++}return n}(r,i),i.values),n)};function vk(e,t,n){return"number"==typeof e&&"number"==typeof t&&"number"==typeof n?yb(e,t,n):vv(e)(e,t)}let v_=e=>{let t=({timestamp:t})=>e(t);return{start:(e=!0)=>gc.update(t,e),stop:()=>gd(t),now:()=>gh.isProcessing?gh.timestamp:gq.now()}};function vS(e){let t=0,n=e.next(t);for(;!n.done&&t<2e4;)t+=50,n=e.next(t);return t>=2e4?1/0:t}let vC=.01,vE=2,vA=.005,vT=.5;function vN(e,t){return e*Math.sqrt(1-t*t)}let vj=["duration","bounce"],vP=["stiffness","damping","mass"];function vM(e,t){return t.some(t=>void 0!==e[t])}function vD(e=.3,t=.3){let n,r,i,o,s,a,l="object"!=typeof e?{visualDuration:e,keyframes:[0,1],bounce:t}:e,{restSpeed:u,restDelta:c}=l,d=l.keyframes[0],h=l.keyframes[l.keyframes.length-1],f={done:!1,value:d},{stiffness:p,damping:m,mass:g,duration:y,velocity:v,isResolvedFromDuration:x}=function(e){let t={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...e};if(!vM(e,vP)&&vM(e,vj))if(t.velocity=0,e.visualDuration){let n=2*Math.PI/(1.2*e.visualDuration),r=n*n,i=2*mt(.05,1,1-(e.bounce||0))*Math.sqrt(r);t={...t,mass:1,stiffness:r,damping:i}}else{let n=function({duration:e=800,bounce:t=.3,velocity:n=0,mass:r=1}){let i,o;mG(e<=gC(10),"Spring duration must be 10 seconds or less","spring-duration-limit");let s=1-t;s=mt(.05,1,s),e=mt(.01,10,e/1e3),s<1?(i=t=>{let r=t*s,i=r*e;return .001-(r-n)/vN(t,s)*Math.exp(-i)},o=t=>{let r=t*s*e,o=Math.pow(s,2)*Math.pow(t,2)*e,a=Math.exp(-r),l=vN(Math.pow(t,2),s);return(r*n+n-o)*a*(-i(t)+.001>0?-1:1)/l}):(i=t=>-.001+Math.exp(-t*e)*((t-n)*e+1),o=t=>e*e*(n-t)*Math.exp(-t*e));let a=function(e,t,n){let r=n;for(let n=1;n<12;n++)r-=e(r)/t(r);return r}(i,o,5/e);if(e=gC(e),isNaN(a))return{stiffness:100,damping:10,duration:e};{let t=Math.pow(a,2)*r;return{stiffness:t,damping:2*s*Math.sqrt(r*t),duration:e}}}({...e,velocity:0});(t={...t,...n,mass:1}).isResolvedFromDuration=!0}return t}({...l,velocity:-((l.velocity||0)/1e3)}),b=v||0,w=m/(2*Math.sqrt(p*g)),k=h-d,_=Math.sqrt(p/g)/1e3,S=5>Math.abs(k);if(u||(u=S?vC:vE),c||(c=S?vA:vT),w<1)i=vN(_,w),o=(b+w*_*k)/i,n=e=>h-Math.exp(-w*_*e)*(o*Math.sin(i*e)+k*Math.cos(i*e)),s=w*_*o+k*i,a=w*_*k-o*i,r=e=>Math.exp(-w*_*e)*(s*Math.sin(i*e)+a*Math.cos(i*e));else if(1===w){n=e=>h-Math.exp(-_*e)*(k+(b+_*k)*e);let e=b+_*k;r=t=>Math.exp(-_*t)*(_*e*t-b)}else{let e=_*Math.sqrt(w*w-1);n=t=>{let n=Math.exp(-w*_*t),r=Math.min(e*t,300);return h-n*((b+w*_*k)*Math.sinh(r)+e*k*Math.cosh(r))/e};let t=(b+w*_*k)/e,i=w*_*t-k*e,o=w*_*k-t*e;r=t=>{let n=Math.exp(-w*_*t),r=Math.min(e*t,300);return n*(i*Math.sinh(r)+o*Math.cosh(r))}}let C={calculatedDuration:x&&y||null,velocity:e=>gC(r(e)),next:e=>{if(!x&&w<1){let t=Math.exp(-w*_*e),n=Math.sin(i*e),r=Math.cos(i*e),l=h-t*(o*n+k*r);return f.done=Math.abs(gC(t*(s*n+a*r)))<=u&&Math.abs(h-l)<=c,f.value=f.done?h:l,f}let t=n(e);return x?f.done=e>=y:f.done=Math.abs(gC(r(e)))<=u&&Math.abs(h-t)<=c,f.value=f.done?h:t,f},toString:()=>{let e=Math.min(vS(C),2e4),t=gB(t=>C.next(e*t).value,e,30);return e+"ms "+t},toTransition:()=>{}};return C}function vR(e,t,n){let r=Math.max(t-5,0);return gJ(n-e(r),t-r)}function vL({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:o=500,modifyTarget:s,min:a,max:l,restDelta:u=.5,restSpeed:c}){let d,h,f=e[0],p={done:!1,value:f},m=n*t,g=f+m,y=void 0===s?g:s(g);y!==g&&(m=y-f);let v=e=>-m*Math.exp(-e/r),x=e=>y+v(e),b=e=>{let t=v(e),n=x(e);p.done=Math.abs(t)<=u,p.value=p.done?y:n},w=e=>{let t;if(t=p.value,void 0!==a&&t<a||void 0!==l&&t>l){var n;d=e,h=vD({keyframes:[p.value,(n=p.value,void 0===a?l:void 0===l||Math.abs(a-n)<Math.abs(l-n)?a:l)],velocity:vR(x,e,p.value),damping:i,stiffness:o,restDelta:u,restSpeed:c})}};return w(0),{calculatedDuration:null,next:e=>{let t=!1;return(h||void 0!==d||(t=!0,b(e),w(e)),void 0!==d&&e>=d)?h.next(e-d):(t||b(e),p)}}}vD.applyToOptions=e=>{let t=function(e,t=100,n){let r=n({...e,keyframes:[0,t]}),i=Math.min(vS(r),2e4);return{type:"keyframes",ease:e=>r.next(i*e).value/t,duration:i/1e3}}(e,100,vD);return e.ease=t.ease,e.duration=gC(t.duration),e.type="keyframes",e};let vO=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e;function vI(e,t,n,r){return e===t&&n===r?gs:i=>0===i||1===i?i:vO(function(e,t,n,r,i){let o,s,a=0;do(o=vO(s=t+(n-t)/2,r,i)-e)>0?n=s:t=s;while(Math.abs(o)>1e-7&&++a<12)return s}(i,0,1,e,n),t,r)}let vF=vI(.42,0,1,1),vz=vI(0,0,.58,1),vB=vI(.42,0,.58,1),v$=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,vU=e=>t=>1-e(1-t),vV=vI(.33,1.53,.69,.99),vW=vU(vV),vH=v$(vW),vK=e=>e>=1?1:(e*=2)<1?.5*vW(e):.5*(2-Math.pow(2,-10*(e-1))),vG=e=>1-Math.sin(Math.acos(e)),vq=vU(vG),vJ=v$(vG),vY={linear:gs,easeIn:vF,easeInOut:vB,easeOut:vz,circIn:vG,circInOut:vJ,circOut:vq,backIn:vW,backInOut:vH,backOut:vV,anticipate:vK},vX=e=>{if(gF(e)){mq(4===e.length,"Cubic bezier arrays must contain four numerical values.","cubic-bezier-length");let[t,n,r,i]=e;return vI(t,n,r,i)}return"string"==typeof e?(mq(void 0!==vY[e],`Invalid easing type '${e}'`,"invalid-easing-type"),vY[e]):e},vZ=(e,t,n)=>{let r=t-e;return r?(n-e)/r:1};function vQ({duration:e=300,keyframes:t,times:n,ease:r="easeInOut"}){var i;let o,s=Array.isArray(r)&&"number"!=typeof r[0]?r.map(vX):vX(r),a={done:!1,value:t[0]},l=function(e,t,{clamp:n=!0,ease:r,mixer:i}={}){let o=e.length;if(mq(o===t.length,"Both input and output ranges must be the same length","range-length"),1===o)return()=>t[0];if(2===o&&t[0]===t[1])return()=>t[1];let s=e[0]===e[1];e[0]>e[o-1]&&(e=[...e].reverse(),t=[...t].reverse());let a=function(e,t,n){let r=[],i=n||ga.mix||vk,o=e.length-1;for(let n=0;n<o;n++){let o=i(e[n],e[n+1]);t&&(o=vu(Array.isArray(t)?t[n]||gs:t,o)),r.push(o)}return r}(t,r,i),l=a.length,u=n=>{if(s&&n<e[0])return t[0];let r=0;if(l>1)for(;r<e.length-2&&!(n<e[r+1]);r++);let i=vZ(e[r],e[r+1],n);return a[r](i)};return n?t=>u(mt(e[0],e[o-1],t)):u}((i=n&&n.length===t.length?n:(!function(e,t){let n=e[e.length-1];for(let r=1;r<=t;r++){let i=vZ(0,t,r);e.push(yb(n,1,i))}}(o=[0],t.length-1),o),i.map(t=>t*e)),t,{ease:Array.isArray(s)?s:t.map(()=>s||vB).splice(0,t.length-1)});return{calculatedDuration:e,next:t=>(a.value=l(t),a.done=t>=e,a)}}let v0={decay:vL,inertia:vL,tween:vQ,keyframes:vQ,spring:vD};function v1(e){"string"==typeof e.type&&(e.type=v0[e.type])}let v2=e=>e/100;class v5 extends gO{constructor(e){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{let{motionValue:e}=this.options;e&&e.updatedAt!==gq.now()&&this.tick(gq.now()),this.isStopped=!0,"idle"!==this.state&&(this.teardown(),this.options.onStop?.())},gI.mainThread++,this.options=e,this.initAnimation(),this.play(),!1===e.autoplay&&this.pause()}initAnimation(){let{options:e}=this;v1(e);let{type:t=vQ,repeat:n=0,repeatDelay:r=0,repeatType:i,velocity:o=0}=e,{keyframes:s}=e,a=t||vQ;a!==vQ&&"number"!=typeof s[0]&&(this.mixKeyframes=vu(v2,vk(s[0],s[1])),s=[0,100]);let l=a({...e,keyframes:s});"mirror"===i&&(this.mirroredGenerator=a({...e,keyframes:[...s].reverse(),velocity:-o})),null===l.calculatedDuration&&(l.calculatedDuration=vS(l));let{calculatedDuration:u}=l;this.calculatedDuration=u,this.resolvedDuration=u+r,this.totalDuration=this.resolvedDuration*(n+1)-r,this.generator=l}updateTime(e){let t=Math.round(e-this.startTime)*this.playbackSpeed;null!==this.holdTime?this.currentTime=this.holdTime:this.currentTime=t}tick(e,t=!1){let n,{generator:r,totalDuration:i,mixKeyframes:o,mirroredGenerator:s,resolvedDuration:a,calculatedDuration:l}=this;if(null===this.startTime)return r.next(0);let{delay:u=0,keyframes:c,repeat:d,repeatType:h,repeatDelay:f,type:p,onUpdate:m,finalKeyframe:g}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-i/this.speed,this.startTime)),t?this.currentTime=e:this.updateTime(e);let y=this.currentTime-u*(this.playbackSpeed>=0?1:-1),v=this.playbackSpeed>=0?y<0:y>i;this.currentTime=Math.max(y,0),"finished"===this.state&&null===this.holdTime&&(this.currentTime=i);let x=this.currentTime,b=r;if(d){let e=Math.min(this.currentTime,i)/a,t=Math.floor(e),n=e%1;!n&&e>=1&&(n=1),1===n&&t--,(t=Math.min(t,d+1))%2&&("reverse"===h?(n=1-n,f&&(n-=f/a)):"mirror"===h&&(b=s)),x=mt(0,1,n)*a}v?(this.delayState.value=c[0],n=this.delayState):n=b.next(x),o&&!v&&(n.value=o(n.value));let{done:w}=n;v||null===l||(w=this.playbackSpeed>=0?this.currentTime>=i:this.currentTime<=0);let k=null===this.holdTime&&("finished"===this.state||"running"===this.state&&w);return k&&p!==vL&&(n.value=gL(c,this.options,g,this.speed)),m&&m(n.value),k&&this.finish(),n}then(e,t){return this.finished.then(e,t)}get duration(){return this.calculatedDuration/1e3}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+e/1e3}get time(){return this.currentTime/1e3}set time(e){e=gC(e),this.currentTime=e,null===this.startTime||null!==this.holdTime||0===this.playbackSpeed?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state="paused",this.holdTime=e,this.tick(e))}getGeneratorVelocity(){let e=this.currentTime;if(e<=0)return this.options.velocity||0;if(this.generator.velocity)return this.generator.velocity(e);let t=this.generator.next(e).value;return vR(e=>this.generator.next(e).value,e,t)}get speed(){return this.playbackSpeed}set speed(e){let t=this.playbackSpeed!==e;t&&this.driver&&this.updateTime(gq.now()),this.playbackSpeed=e,t&&this.driver&&(this.time=this.currentTime/1e3)}play(){if(this.isStopped)return;let{driver:e=v_,startTime:t}=this.options;this.driver||(this.driver=e(e=>this.tick(e))),this.options.onPlay?.();let n=this.driver.now();"finished"===this.state?(this.updateFinished(),this.startTime=n):null!==this.holdTime?this.startTime=n-this.holdTime:this.startTime||(this.startTime=t??n),"finished"===this.state&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(gq.now()),this.holdTime=this.currentTime}complete(){"running"!==this.state&&this.play(),this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null,gI.mainThread--}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),e.observe(this)}}let v3={anticipate:vK,backInOut:vH,circInOut:vJ};class v4 extends gW{constructor(e){!function(e){"string"==typeof e.ease&&e.ease in v3&&(e.ease=v3[e.ease])}(e),v1(e),super(e),void 0!==e.startTime&&!1!==e.autoplay&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){let{motionValue:t,onUpdate:n,onComplete:r,element:i,...o}=this.options;if(!t)return;if(void 0!==e)return void t.set(e);let s=new v5({...o,autoplay:!1}),a=Math.max(10,gq.now()-this.startTime),l=mt(0,10,a-10),u=s.sample(a).value,{name:c}=this.options;i&&c&&gN(i,c,u),t.setWithVelocity(s.sample(Math.max(0,a-l)).value,u,l),s.stop()}}let v6=(e,t)=>"zIndex"!==t&&!!("number"==typeof e||Array.isArray(e)||"string"==typeof e&&(mT.test(e)||"0"===e)&&!e.startsWith("url("));function v8(e){e.duration=0,e.type="keyframes"}let v9=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/,v7=new Set(["color","backgroundColor","outlineColor","fill","stroke","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor"]),xe=gj(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));class xt extends gO{constructor({autoplay:e=!0,delay:t=0,type:n="keyframes",repeat:r=0,repeatDelay:i=0,repeatType:o="loop",keyframes:s,name:a,motionValue:l,element:u,...c}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=gq.now();const d={autoplay:e,delay:t,type:n,repeat:r,repeatDelay:i,repeatType:o,name:a,motionValue:l,element:u,...c},h=u?.KeyframeResolver||gb;this.keyframeResolver=new h(s,(e,t,n)=>this.onKeyframesResolved(e,t,d,!n),a,l,u),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,t,n,r){let i;this.keyframeResolver=void 0;let{name:o,type:s,velocity:a,delay:l,isHandoff:u,onUpdate:c}=n;this.resolvedAt=gq.now();let d=!0;!function(e,t,n,r){let i=e[0];if(null===i)return!1;if("display"===t||"visibility"===t)return!0;let o=e[e.length-1],s=v6(i,t),a=v6(o,t);return mG(s===a,`You are trying to animate ${t} from "${i}" to "${o}". "${s?o:i}" is not an animatable value.`,"value-not-animatable"),!!s&&!!a&&(function(e){let t=e[0];if(1===e.length)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t)return!0}(e)||("spring"===n||gV(n))&&r)}(e,o,s,a)&&(d=!1,(ga.instantAnimations||!l)&&c?.(gL(e,n,t)),e[0]=e[e.length-1],v8(n),n.repeat=0);let h={startTime:r?this.resolvedAt&&this.resolvedAt-this.createdAt>40?this.resolvedAt:this.createdAt:void 0,finalKeyframe:t,...n,keyframes:e},f=d&&!u&&function(e){let{motionValue:t,name:n,repeatDelay:r,repeatType:i,damping:o,type:s,keyframes:a}=e;if(!(t?.owner?.current instanceof HTMLElement))return!1;let{onUpdate:l,transformTemplate:u}=t.owner.getProps();return xe()&&n&&(gH.has(n)||v7.has(n)&&function(e){for(let t=0;t<e.length;t++)if("string"==typeof e[t]&&v9.test(e[t]))return!0;return!1}(a))&&("transform"!==n||!u)&&!l&&!r&&"mirror"!==i&&0!==o&&"inertia"!==s}(h),p=h.motionValue?.owner?.current;if(f)try{i=new v4({...h,element:p})}catch{i=new v5(h)}else i=new v5(h);i.finished.then(()=>{this.notifyFinished()}).catch(gs),this.pendingTimeline&&(this.stopTimeline=i.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=i}get finished(){return this._animation?this.animation.finished:this._finished}then(e,t){return this.finished.finally(e).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),gy=!0,gx(),gv(),gy=!1),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}}let xn={type:"spring",stiffness:500,damping:25,restSpeed:10},xr={type:"keyframes",duration:.8},xi={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},xo=new Set(["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed"]),xs=(e,t,n,r={},i,o)=>s=>{let a=vs(r,e)||{},l=a.delay||r.delay||0,{elapsed:u=0}=r;u-=gC(l);let c={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:t.getVelocity(),...a,delay:-u,onUpdate:e=>{t.set(e),a.onUpdate&&a.onUpdate(e)},onComplete:()=>{s(),a.onComplete&&a.onComplete()},name:e,motionValue:t,element:o?void 0:i};!function(e){for(let t in e)if(!xo.has(t))return!0;return!1}(a)&&Object.assign(c,((e,{keyframes:t})=>t.length>2?xr:me.has(e)?e.startsWith("scale")?{type:"spring",stiffness:550,damping:0===t[1]?2*Math.sqrt(550):30,restSpeed:10}:xn:xi)(e,c)),c.duration&&(c.duration=gC(c.duration)),c.repeatDelay&&(c.repeatDelay=gC(c.repeatDelay)),void 0!==c.from&&(c.keyframes[0]=c.from);let d=!1;if(!1!==c.type&&(0!==c.duration||c.repeatDelay)||(v8(c),0===c.delay&&(d=!0)),(ga.instantAnimations||ga.skipAnimations||i?.shouldSkipAnimations||a.skipAnimations)&&(d=!0,v8(c),c.delay=0),c.allowFlatten=!a.type&&!a.ease,d&&!o&&void 0!==t.get()){let e=gL(c.keyframes,a);if(void 0!==e)return void gc.update(()=>{c.onUpdate(e),c.onComplete()})}return a.isSync?new v5(c):new xt(c)};function xa(e,t,{delay:n=0,transitionOverride:r,type:i}={}){let{transition:o,transitionEnd:s,...a}=t,l=e.getDefaultTransition();o=o?vo(o,l):l;let u=o?.reduceMotion,c=o?.skipAnimations;r&&(o=r);let d=[],h=i&&e.animationState&&e.animationState.getState()[i];for(let t in a){let r=e.getValue(t,e.latestValues[t]??null),i=a[t];if(void 0===i||h&&function({protectedKeys:e,needsAnimating:t},n){let r=e.hasOwnProperty(n)&&!0!==t[n];return t[n]=!1,r}(h,t))continue;let s={delay:n,...vs(o||{},t)};c&&(s.skipAnimations=!0);let l=r.get();if(void 0!==l&&!r.isAnimating()&&!Array.isArray(i)&&i===l&&!s.velocity){gc.update(()=>r.set(i));continue}let f=!1;if(window.MotionHandoffAnimation){let n=e.props[y9];if(n){let e=window.MotionHandoffAnimation(n,t,gc);null!==e&&(s.startTime=e,f=!0)}}vl(e,t);let p=u??e.shouldReduceMotion;r.start(xs(t,r,i,p&&mV.has(t)?{type:!1}:s,e,f));let m=r.animation;m&&d.push(m)}if(s){let t=()=>gc.update(()=>{s&&function(e,t){let{transitionEnd:n={},transition:r={},...i}=vi(e,t)||{};for(let t in i={...i,...n}){var o;let n=va(o=i[t])?o[o.length-1]||0:o;e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,gZ(n))}}(e,s)});d.length?Promise.all(d).then(t):t()}return d}function xl(e,t,n,r=0,i=1){let o=Array.from(e).sort((e,t)=>e.sortNodePosition(t)).indexOf(t),s=e.size,a=(s-1)*r;return"function"==typeof n?n(o,s):1===i?o*r:a-o*r}function xu(e,t,n={}){let r=vi(e,t,"exit"===n.type?e.presenceContext?.custom:void 0),{transition:i=e.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(i=n.transitionOverride);let o=r?()=>Promise.all(xa(e,r,n)):()=>Promise.resolve(),s=e.variantChildren&&e.variantChildren.size?(r=0)=>{let{delayChildren:o=0,staggerChildren:s,staggerDirection:a}=i;return function(e,t,n=0,r=0,i=0,o=1,s){let a=[];for(let l of e.variantChildren)l.notify("AnimationStart",t),a.push(xu(l,t,{...s,delay:n+("function"==typeof r?0:r)+xl(e.variantChildren,l,r,i,o)}).then(()=>l.notify("AnimationComplete",t)));return Promise.all(a)}(e,t,r,o,s,a,n)}:()=>Promise.resolve(),{when:a}=i;if(!a)return Promise.all([o(),s(n.delay)]);{let[e,t]="beforeChildren"===a?[o,s]:[s,o];return e().then(()=>t())}}let xc=g3.length;function xd(e,t){if(!Array.isArray(t))return!1;let n=t.length;if(n!==e.length)return!1;for(let r=0;r<n;r++)if(t[r]!==e[r])return!1;return!0}let xh=[...g5].reverse(),xf=g5.length;function xp(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function xm(){return{animate:xp(!0),whileInView:xp(),whileHover:xp(),whileTap:xp(),whileDrag:xp(),whileFocus:xp(),exit:xp()}}let xg=0;function xy(e){return[e("x"),e("y")]}function xv(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}let xx={x:!1,y:!1};function xb(e){return e.max-e.min}function xw(e,t,n,r=.5){e.origin=r,e.originPoint=yb(t.min,t.max,e.origin),e.scale=xb(n)/xb(t),e.translate=yb(n.min,n.max,e.origin)-e.originPoint,(e.scale>=.9999&&e.scale<=1.0001||isNaN(e.scale))&&(e.scale=1),(e.translate>=-.01&&e.translate<=.01||isNaN(e.translate))&&(e.translate=0)}function xk(e,t,n,r){xw(e.x,t.x,n.x,r?r.originX:void 0),xw(e.y,t.y,n.y,r?r.originY:void 0)}function x_(e,t,n,r=0){e.min=(r?yb(n.min,n.max,r):n.min)+t.min,e.max=e.min+xb(t)}function xS(e,t,n,r=0){let i=r?yb(n.min,n.max,r):n.min;e.min=t.min-i,e.max=e.min+xb(t)}function xC(e,t,n,r){xS(e.x,t.x,n.x,r?.x),xS(e.y,t.y,n.y,r?.y)}let xE=e=>"object"==typeof e&&null!==e;function xA(e){return xE(e)&&"ownerSVGElement"in e}function xT(e,t,n){if(null==e)return[];if(e instanceof EventTarget)return[e];if("string"==typeof e){let r=document;t&&(r=t.current);let i=n?.[e]??r.querySelectorAll(e);return i?Array.from(i):[]}return Array.from(e).filter(e=>null!=e)}let xN=new WeakMap,xj=(e,t,n)=>(r,i)=>i&&i[0]?i[0][e+"Size"]:xA(r)&&"getBBox"in r?r.getBBox()[t]:r[n],xP=xj("inline","width","offsetWidth"),xM=xj("block","height","offsetHeight");function xD({target:e,borderBoxSize:t}){xN.get(e)?.forEach(n=>{n(e,{get width(){return xP(e,t)},get height(){return xM(e,t)}})})}function xR(e){e.forEach(xD)}let xL=new Set;function xO(e,t){let n;return"function"==typeof e?(xL.add(e),s||(s=()=>{let e={get width(){return window.innerWidth},get height(){return window.innerHeight}};xL.forEach(t=>t(e))},window.addEventListener("resize",s)),()=>{xL.delete(e),xL.size||"function"!=typeof s||(window.removeEventListener("resize",s),s=void 0)}):(!o&&"u">typeof ResizeObserver&&(o=new ResizeObserver(xR)),(n=xT(e)).forEach(e=>{let n=xN.get(e);n||(n=new Set,xN.set(e,n)),n.add(t),o?.observe(e)}),()=>{n.forEach(e=>{let n=xN.get(e);n?.delete(t),n?.size||o?.unobserve(e)})})}let xI=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]),xF=new Set(["INPUT","SELECT","TEXTAREA"]),xz=e=>"mouse"===e.pointerType?"number"!=typeof e.button||e.button<=0:!1!==e.isPrimary;function xB(e){return{point:{x:e.pageX,y:e.pageY}}}function x$(e,t,n,r){return xv(e,t,e=>xz(e)&&n(e,xB(e)),r)}let xU=({current:e})=>e?e.ownerDocument.defaultView:null,xV=(e,t)=>Math.abs(e-t),xW=new Set(["auto","scroll"]);class xH{constructor(e,t,{transformPagePoint:n,contextWindow:r=window,dragSnapToOrigin:i=!1,distanceThreshold:o=3,element:s}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.lastRawMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=e=>{this.handleScroll(e.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{var e,t;if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=xK(this.lastRawMoveEventInfo,this.transformPagePoint));let n=xq(this.lastMoveEventInfo,this.history),r=null!==this.startEvent,i=(e=n.offset,t={x:0,y:0},Math.sqrt(xV(e.x,t.x)**2+xV(e.y,t.y)**2)>=this.distanceThreshold);if(!r&&!i)return;let{point:o}=n,{timestamp:s}=gh;this.history.push({...o,timestamp:s});let{onStart:a,onMove:l}=this.handlers;r||(a&&a(this.lastMoveEvent,n),this.startEvent=this.lastMoveEvent),l&&l(this.lastMoveEvent,n)},this.handlePointerMove=(e,t)=>{this.lastMoveEvent=e,this.lastRawMoveEventInfo=t,this.lastMoveEventInfo=xK(t,this.transformPagePoint),gc.update(this.updatePoint,!0)},this.handlePointerUp=(e,t)=>{this.end();let{onEnd:n,onSessionEnd:r,resumeAnimation:i}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&i&&i(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;let o=xq("pointercancel"===e.type?this.lastMoveEventInfo:xK(t,this.transformPagePoint),this.history);this.startEvent&&n&&n(e,o),r&&r(e,o)},!xz(e))return;this.dragSnapToOrigin=i,this.handlers=t,this.transformPagePoint=n,this.distanceThreshold=o,this.contextWindow=r||window;const a=xK(xB(e),this.transformPagePoint),{point:l}=a,{timestamp:u}=gh;this.history=[{...l,timestamp:u}];const{onSessionStart:c}=t;c&&c(e,xq(a,this.history)),this.removeListeners=vu(x$(this.contextWindow,"pointermove",this.handlePointerMove),x$(this.contextWindow,"pointerup",this.handlePointerUp),x$(this.contextWindow,"pointercancel",this.handlePointerUp)),s&&this.startScrollTracking(s)}startScrollTracking(e){let t=e.parentElement;for(;t;){let e=getComputedStyle(t);(xW.has(e.overflowX)||xW.has(e.overflowY))&&this.scrollPositions.set(t,{x:t.scrollLeft,y:t.scrollTop}),t=t.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0}),window.addEventListener("scroll",this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(e){let t=this.scrollPositions.get(e);if(!t)return;let n=e===window,r=n?{x:window.scrollX,y:window.scrollY}:{x:e.scrollLeft,y:e.scrollTop},i={x:r.x-t.x,y:r.y-t.y};(0!==i.x||0!==i.y)&&(n?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=i.x,this.lastMoveEventInfo.point.y+=i.y):this.history.length>0&&(this.history[0].x-=i.x,this.history[0].y-=i.y),this.scrollPositions.set(e,r),gc.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),gd(this.updatePoint)}}function xK(e,t){return t?{point:t(e.point)}:e}function xG(e,t){return{x:e.x-t.x,y:e.y-t.y}}function xq({point:e},t){return{point:e,delta:xG(e,xJ(t)),offset:xG(e,t[0]),velocity:function(e){if(e.length<2)return{x:0,y:0};let t=e.length-1,n=null,r=xJ(e);for(;t>=0&&(n=e[t],!(r.timestamp-n.timestamp>gC(.1)));)t--;if(!n)return{x:0,y:0};n===e[0]&&e.length>2&&r.timestamp-n.timestamp>2*gC(.1)&&(n=e[1]);let i=(r.timestamp-n.timestamp)/1e3;if(0===i)return{x:0,y:0};let o={x:(r.x-n.x)/i,y:(r.y-n.y)/i};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}(t)}}function xJ(e){return e[e.length-1]}function xY(e,t,n){return{min:void 0!==t?e.min+t:void 0,max:void 0!==n?e.max+n-(e.max-e.min):void 0}}function xX(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.min<e.max-e.min&&([n,r]=[r,n]),{min:n,max:r}}function xZ(e,t,n){return{min:xQ(e,t),max:xQ(e,n)}}function xQ(e,t){return"number"==typeof e?e:e[t]||0}let x0=new WeakMap;class x1{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=m$(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:t=!1,distanceThreshold:n}={}){let{presenceContext:r}=this.visualElement;if(r&&!1===r.isPresent)return;let i=e=>{t&&this.snapToCursor(xB(e).point),this.stopAnimation()},o=(e,t)=>{let{drag:n,dragPropagation:r,onDragStart:i}=this.getProps();if(n&&!r&&(this.openDragLock&&this.openDragLock(),this.openDragLock=function(e){if("x"===e||"y"===e)if(xx[e])return null;else return xx[e]=!0,()=>{xx[e]=!1};return xx.x||xx.y?null:(xx.x=xx.y=!0,()=>{xx.x=xx.y=!1})}(n),!this.openDragLock))return;this.latestPointerEvent=e,this.latestPanInfo=t,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),xy(e=>{let t=this.getAxisMotionValue(e).get()||0;if(mm.test(t)){let{projection:n}=this.visualElement;if(n&&n.layout){let r=n.layout.layoutBox[e];r&&(t=xb(r)*(parseFloat(t)/100))}}this.originPoint[e]=t}),i&&gc.update(()=>i(e,t),!1,!0),vl(this.visualElement,"transform");let{animationState:o}=this.visualElement;o&&o.setActive("whileDrag",!0)},s=(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t;let{dragPropagation:n,dragDirectionLock:r,onDirectionLock:i,onDrag:o}=this.getProps();if(!n&&!this.openDragLock)return;let{offset:s}=t;if(r&&null===this.currentDirection){this.currentDirection=function(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}(s),null!==this.currentDirection&&i&&i(this.currentDirection);return}this.updateAxis("x",t.point,s),this.updateAxis("y",t.point,s),this.visualElement.render(),o&&gc.update(()=>o(e,t),!1,!0)},a=(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t,this.stop(e,t),this.latestPointerEvent=null,this.latestPanInfo=null},l=()=>{let{dragSnapToOrigin:e}=this.getProps();(e||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:u}=this.getProps();this.panSession=new xH(e,{onSessionStart:i,onStart:o,onMove:s,onSessionEnd:a,resumeAnimation:l},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:u,distanceThreshold:n,contextWindow:xU(this.visualElement),element:this.visualElement.current})}stop(e,t){let n=e||this.latestPointerEvent,r=t||this.latestPanInfo,i=this.isDragging;if(this.cancel(),!i||!r||!n)return;let{velocity:o}=r;this.startAnimation(o);let{onDragEnd:s}=this.getProps();s&&gc.postRender(()=>s(n,r))}cancel(){this.isDragging=!1;let{projection:e,animationState:t}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.endPanSession();let{dragPropagation:n}=this.getProps();!n&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),t&&t.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(e,t,n){let{drag:r}=this.getProps();if(!n||!x5(e,r,this.currentDirection))return;let i=this.getAxisMotionValue(e),o=this.originPoint[e]+n[e];this.constraints&&this.constraints[e]&&(o=function(e,{min:t,max:n},r){return void 0!==t&&e<t?e=r?yb(t,e,r.min):Math.max(e,t):void 0!==n&&e>n&&(e=r?yb(n,e,r.max):Math.min(e,n)),e}(o,this.constraints[e],this.elastic[e])),i.set(o)}resolveConstraints(){let{dragConstraints:e,dragElastic:t}=this.getProps(),n=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,r=this.constraints;e&&ve(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&n?this.constraints=function(e,{top:t,left:n,bottom:r,right:i}){return{x:xY(e.x,n,i),y:xY(e.y,t,r)}}(n.layoutBox,e):this.constraints=!1,this.elastic=function(e=.35){return!1===e?e=0:!0===e&&(e=.35),{x:xZ(e,"left","right"),y:xZ(e,"top","bottom")}}(t),r!==this.constraints&&!ve(e)&&n&&this.constraints&&!this.hasMutatedConstraints&&xy(e=>{var t,r;let i;!1!==this.constraints&&this.getAxisMotionValue(e)&&(this.constraints[e]=(t=n.layoutBox[e],r=this.constraints[e],i={},void 0!==r.min&&(i.min=r.min-t.min),void 0!==r.max&&(i.max=r.max-t.min),i))})}resolveRefConstraints(){var e;let{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!ve(t))return!1;let r=t.current;mq(null!==r,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.","drag-constraints-ref");let{projection:i}=this.visualElement;if(!i||!i.layout)return!1;i.root&&(i.root.scroll=void 0,i.root.updateScroll());let o=function(e,t,n){let r=yF(e,n),{scroll:i}=t;return i&&(yR(r.x,i.offset.x),yR(r.y,i.offset.y)),r}(r,i.root,this.visualElement.getTransformPagePoint()),s=(e=i.layout.layoutBox,{x:xX(e.x,o.x),y:xX(e.y,o.y)});if(n){let e=n(function({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}(s));this.hasMutatedConstraints=!!e,e&&(s=yE(e))}return s}startAnimation(e){let{drag:t,dragMomentum:n,dragElastic:r,dragTransition:i,dragSnapToOrigin:o,onDragTransitionEnd:s}=this.getProps(),a=this.constraints||{};return Promise.all(xy(s=>{if(!x5(s,t,this.currentDirection))return;let l=a&&a[s]||{};(!0===o||o===s)&&(l={min:0,max:0});let u={type:"inertia",velocity:n?e[s]:0,bounceStiffness:r?200:1e6,bounceDamping:r?40:1e7,timeConstant:750,restDelta:1,restSpeed:10,...i,...l};return this.startAxisValueAnimation(s,u)})).then(s)}startAxisValueAnimation(e,t){let n=this.getAxisMotionValue(e);return vl(this.visualElement,e),n.start(xs(e,n,0,t,this.visualElement,!1))}stopAnimation(){xy(e=>this.getAxisMotionValue(e).stop())}getAxisMotionValue(e){let t=`_drag${e.toUpperCase()}`;return this.visualElement.getProps()[t]||this.visualElement.getValue(e,this.visualElement.latestValues[e]??0)}snapToCursor(e){xy(t=>{let{drag:n}=this.getProps();if(!x5(t,n,this.currentDirection))return;let{projection:r}=this.visualElement,i=this.getAxisMotionValue(t);if(r&&r.layout){let{min:n,max:o}=r.layout.layoutBox[t],s=i.get()||0;i.set(e[t]-yb(n,o,.5)+s)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;let{drag:e,dragConstraints:t}=this.getProps(),{projection:n}=this.visualElement;if(!ve(t)||!n||!this.constraints)return;this.stopAnimation();let r={x:0,y:0};xy(e=>{let t=this.getAxisMotionValue(e);if(t&&!1!==this.constraints){var n,i;let o,s,a,l=t.get();r[e]=(n={min:l,max:l},i=this.constraints[e],o=.5,s=xb(n),(a=xb(i))>s?o=vZ(i.min,i.max-s,n.min):s>a&&(o=vZ(n.min,n.max-a,i.min)),mt(0,1,o))}});let{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},""):"none",n.root&&n.root.updateScroll(),n.updateLayout(),this.constraints=!1,this.resolveConstraints(),xy(t=>{if(!x5(t,e,null))return;let n=this.getAxisMotionValue(t),{min:i,max:o}=this.constraints[t];n.set(yb(i,o,r[t]))}),this.visualElement.render()}addListeners(){let e;if(!this.visualElement.current)return;x0.set(this.visualElement,this);let t=this.visualElement.current,n=x$(t,"pointerdown",e=>{let{drag:n,dragListener:r=!0}=this.getProps(),i=e.target,o=i!==t&&(xF.has(i.tagName)||!0===i.isContentEditable);n&&r&&!o&&this.start(e)}),r=()=>{var n,r,i;let o,s,{dragConstraints:a}=this.getProps();ve(a)&&a.current&&(this.constraints=this.resolveRefConstraints(),e||(n=t,r=a.current,o=xO(n,x2(i=()=>this.scalePositionWithinConstraints())),s=xO(r,x2(i)),e=()=>{o(),s()}))},{projection:i}=this.visualElement,o=i.addEventListener("measure",r);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),gc.read(r);let s=xv(window,"resize",()=>this.scalePositionWithinConstraints()),a=i.addEventListener("didUpdate",({delta:e,hasLayoutChanged:t})=>{this.isDragging&&t&&(xy(t=>{let n=this.getAxisMotionValue(t);n&&(this.originPoint[t]+=e[t].translate,n.set(n.get()+e[t].translate))}),this.visualElement.render())});return()=>{s(),n(),o(),a&&a(),e&&e()}}getProps(){let e=this.visualElement.getProps(),{drag:t=!1,dragDirectionLock:n=!1,dragPropagation:r=!1,dragConstraints:i=!1,dragElastic:o=.35,dragMomentum:s=!0}=e;return{...e,drag:t,dragDirectionLock:n,dragPropagation:r,dragConstraints:i,dragElastic:o,dragMomentum:s}}}function x2(e){let t=!0;return()=>{if(t){t=!1;return}e()}}function x5(e,t,n){return(!0===t||t===e)&&(null===n||n===e)}let x3=e=>(t,n)=>{e&&gc.update(()=>e(t,n),!1,!0)},x4={hasAnimatedSinceResize:!0,hasEverUpdated:!1};var x6=T;let x8=!1;class x9 extends x6.Component{componentDidMount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:n,layoutId:r}=this.props,{projection:i}=e;i&&(t.group&&t.group.add(i),n&&n.register&&r&&n.register(i),x8&&i.root.didUpdate(),i.addEventListener("animationComplete",()=>{this.safeToRemove()}),i.setOptions({...i.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),x4.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){let{layoutDependency:t,visualElement:n,drag:r,isPresent:i}=this.props,{projection:o}=n;return o&&(o.isPresent=i,e.layoutDependency!==t&&o.setOptions({...o.options,layoutDependency:t}),x8=!0,r||e.layoutDependency!==t||void 0===t||e.isPresent!==i?o.willUpdate():this.safeToRemove(),e.isPresent!==i&&(i?o.promote():o.relegate()||gc.postRender(()=>{let e=o.getStack();e&&e.members.length||this.safeToRemove()}))),null}componentDidUpdate(){let{visualElement:e,layoutAnchor:t}=this.props,{projection:n}=e;n&&(n.options.layoutAnchor=t,n.root.didUpdate(),gK.postRender(()=>{!n.currentAnimation&&n.isLead()&&this.safeToRemove()}))}componentWillUnmount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:n}=this.props,{projection:r}=e;x8=!0,r&&(r.scheduleCheckAfterUnmount(),t&&t.group&&t.group.remove(r),n&&n.deregister&&n.deregister(r))}safeToRemove(){let{safeToRemove:e}=this.props;e&&e()}render(){return null}}function x7(e){let[t,n]=function(e=!0){let t=(0,T.useContext)(y0);if(null===t)return[!0,null];let{isPresent:n,onExitComplete:r,register:i}=t,o=(0,T.useId)();(0,T.useEffect)(()=>{if(e)return i(o)},[e]);let s=(0,T.useCallback)(()=>e&&r&&r(o),[o,r,e]);return!n&&r?[!1,s]:[!0]}(),r=(0,x6.useContext)(yU);return(0,A.jsx)(x9,{...e,layoutGroup:r,switchLayoutGroup:(0,x6.useContext)(y7),isPresent:t,safeToRemove:n})}let be=["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"],bt=be.length,bn=e=>"string"==typeof e?parseFloat(e):e,br=e=>"number"==typeof e||mg.test(e);function bi(e,t){return void 0!==e[t]?e[t]:e.borderRadius}let bo=ba(0,.5,vq),bs=ba(.5,.95,gs);function ba(e,t,n){return r=>r<e?0:r>t?1:n(vZ(e,t,r))}function bl(e,t){e.min=t.min,e.max=t.max}function bu(e,t){bl(e.x,t.x),bl(e.y,t.y)}function bc(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function bd(e,t,n,r,i){return e-=t,e=r+1/n*(e-r),void 0!==i&&(e=r+1/i*(e-r)),e}function bh(e,t,[n,r,i],o,s){!function(e,t=0,n=1,r=.5,i,o=e,s=e){if(mm.test(t)&&(t=parseFloat(t),t=yb(s.min,s.max,t/100)-s.min),"number"!=typeof t)return;let a=yb(o.min,o.max,r);e===o&&(a-=t),e.min=bd(e.min,t,n,a,i),e.max=bd(e.max,t,n,a,i)}(e,t[n],t[r],t[i],t.scale,o,s)}let bf=["x","scaleX","originX"],bp=["y","scaleY","originY"];function bm(e,t,n,r){bh(e.x,t,bf,n?n.x:void 0,r?r.x:void 0),bh(e.y,t,bp,n?n.y:void 0,r?r.y:void 0)}function bg(e){return 0===e.translate&&1===e.scale}function by(e){return bg(e.x)&&bg(e.y)}function bv(e,t){return e.min===t.min&&e.max===t.max}function bx(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function bb(e,t){return bx(e.x,t.x)&&bx(e.y,t.y)}function bw(e){return xb(e.x)/xb(e.y)}function bk(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}class b_{constructor(){this.members=[]}add(e){gE(this.members,e);for(let t=this.members.length-1;t>=0;t--){let n=this.members[t];if(n===e||n===this.lead||n===this.prevLead)continue;let r=n.instance;r&&!1!==r.isConnected||n.snapshot||(gA(this.members,n),n.unmount())}e.scheduleRender()}remove(e){if(gA(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){let e=this.members[this.members.length-1];e&&this.promote(e)}}relegate(e){for(let t=this.members.indexOf(e)-1;t>=0;t--){let e=this.members[t];if(!1!==e.isPresent&&e.instance?.isConnected!==!1)return this.promote(e),!0}return!1}promote(e,t){let n=this.lead;if(e!==n&&(this.prevLead=n,this.lead=e,e.show(),n)){n.updateSnapshot(),e.scheduleRender();let{layoutDependency:r}=n.options,{layoutDependency:i}=e.options;(void 0===r||r!==i)&&(e.resumeFrom=n,t&&(n.preserveOpacity=!0),n.snapshot&&(e.snapshot=n.snapshot,e.snapshot.latestValues=n.animationValues||n.latestValues),e.root?.isUpdating&&(e.isLayoutDirty=!0)),!1===e.options.crossfade&&n.hide()}}exitAnimationComplete(){this.members.forEach(e=>{e.options.onExitComplete?.(),e.resumingFrom?.options.onExitComplete?.()})}scheduleRender(){this.members.forEach(e=>e.instance&&e.scheduleRender(!1))}removeLeadSnapshot(){this.lead?.snapshot&&(this.lead.snapshot=void 0)}}let bS=(e,t)=>e.depth-t.depth;class bC{constructor(){this.children=[],this.isDirty=!1}add(e){gE(this.children,e),this.isDirty=!0}remove(e){gA(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(bS),this.isDirty=!1,this.children.forEach(e)}}let bE=["","X","Y","Z"],bA=0;function bT(e,t,n,r){let{latestValues:i}=t;i[e]&&(n[e]=i[e],t.setStaticValue(e,0),r&&(r[e]=0))}function bN({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return class{constructor(e={},n=t?.()){this.id=bA++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(bM),this.nodes.forEach(b$),this.nodes.forEach(bU),this.nodes.forEach(bD)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=e,this.root=n?n.root||n:this,this.path=n?[...n.path,n]:[],this.parent=n,this.depth=n?n.depth+1:0;for(let e=0;e<this.path.length;e++)this.path[e].shouldResetTransform=!0;this.root===this&&(this.nodes=new bC)}addEventListener(e,t){return this.eventHandlers.has(e)||this.eventHandlers.set(e,new gT),this.eventHandlers.get(e).add(t)}notifyListeners(e,...t){let n=this.eventHandlers.get(e);n&&n.notify(...t)}hasListeners(e){return this.eventHandlers.has(e)}mount(t){if(this.instance)return;this.isSVG=xA(t)&&!(xA(t)&&"svg"===t.tagName),this.instance=t;let{layoutId:n,layout:r,visualElement:i}=this.options;if(i&&!i.current&&i.mount(t),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(r||n)&&(this.isLayoutDirty=!0),e){let n,r=0,i=()=>this.root.updateBlockedByResize=!1;gc.read(()=>{r=window.innerWidth}),e(t,()=>{let e=window.innerWidth;if(e!==r){let t,o;r=e,this.root.updateBlockedByResize=!0,n&&n(),t=gq.now(),o=({timestamp:e})=>{let n=e-t;n>=250&&(gd(o),i(n-250))},gc.setup(o,!0),n=()=>gd(o),x4.hasAnimatedSinceResize&&(x4.hasAnimatedSinceResize=!1,this.nodes.forEach(bB))}})}n&&this.root.registerSharedNode(n,this),!1!==this.options.animate&&i&&(n||r)&&this.addEventListener("didUpdate",({delta:e,hasLayoutChanged:t,hasRelativeLayoutChanged:n,layout:r})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}let o=this.options.transition||i.getDefaultTransition()||bq,{onLayoutAnimationStart:s,onLayoutAnimationComplete:a}=i.getProps(),l=!this.targetLayout||!bb(this.targetLayout,r),u=!t&&n;if(this.options.layoutRoot||this.resumeFrom||u||t&&(l||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);let t={...vs(o,"layout"),onPlay:s,onComplete:a};(i.shouldReduceMotion||this.options.layoutRoot)&&(t.delay=0,t.type=!1),this.startAnimation(t),this.setAnimationOrigin(e,u)}else t||bB(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=r})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);let e=this.getStack();e&&e.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),gd(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){!this.isUpdateBlocked()&&(this.isUpdating=!0,this.nodes&&this.nodes.forEach(bV),this.animationId++)}getTransformTemplate(){let{visualElement:e}=this.options;return e&&e.getProps().transformTemplate}willUpdate(e=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&function e(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;let{visualElement:n}=t.options;if(!n)return;let r=n.props[y9];if(window.MotionHasOptimisedAnimation(r,"transform")){let{layout:e,layoutId:n}=t.options;window.MotionCancelOptimisedAnimation(r,"transform",gc,!(e||n))}let{parent:i}=t;i&&!i.hasCheckedOptimisedAppear&&e(i)}(this),this.root.isUpdating||this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let e=0;e<this.path.length;e++){let t=this.path[e];t.shouldResetTransform=!0,("string"==typeof t.latestValues.x||"string"==typeof t.latestValues.y)&&(t.isLayoutDirty=!0),t.updateScroll("snapshot"),t.options.layoutRoot&&t.willUpdate(!1)}let{layoutId:t,layout:n}=this.options;if(void 0===t&&!n)return;let r=this.getTransformTemplate();this.prevTransformTemplateValue=r?r(this.latestValues,""):void 0,this.updateSnapshot(),e&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){let e=this.updateBlockedByResize;this.unblockUpdate(),this.updateBlockedByResize=!1,this.clearAllSnapshots(),e&&this.nodes.forEach(bO),this.nodes.forEach(bL);return}if(this.animationId<=this.animationCommitId)return void this.nodes.forEach(bI);this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(bF),this.nodes.forEach(bz),this.nodes.forEach(bj),this.nodes.forEach(bP)):this.nodes.forEach(bI),this.clearAllSnapshots();let e=gq.now();gh.delta=mt(0,1e3/60,e-gh.timestamp),gh.timestamp=e,gh.isProcessing=!0,gf.update.process(gh),gf.preRender.process(gh),gf.render.process(gh),gh.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,gK.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(bR),this.sharedNodes.forEach(bW)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,gc.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){gc.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){!this.snapshot&&this.instance&&(this.snapshot=this.measure(),!this.snapshot||xb(this.snapshot.measuredBox.x)||xb(this.snapshot.measuredBox.y)||(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let e=0;e<this.path.length;e++)this.path[e].updateScroll();let e=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected||(this.layoutCorrected=m$()),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);let{visualElement:t}=this.options;t&&t.notify("LayoutMeasure",this.layout.layoutBox,e?e.layoutBox:void 0)}updateScroll(e="measure"){let t=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===e&&(t=!1),t&&this.instance){let t=r(this.instance);this.scroll={animationId:this.root.animationId,phase:e,isRoot:t,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:t}}}resetTransform(){if(!i)return;let e=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,t=this.projectionDelta&&!by(this.projectionDelta),n=this.getTransformTemplate(),r=n?n(this.latestValues,""):void 0,o=r!==this.prevTransformTemplateValue;e&&this.instance&&(t||yN(this.latestValues)||o)&&(i(this.instance,r),this.shouldResetTransform=!1,this.scheduleRender())}measure(e=!0){var t;let n=this.measurePageBox(),r=this.removeElementScroll(n);return e&&(r=this.removeTransform(r)),bX((t=r).x),bX(t.y),{animationId:this.root.animationId,measuredBox:n,layoutBox:r,latestValues:{},source:this.id}}measurePageBox(){let{visualElement:e}=this.options;if(!e)return m$();let t=e.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(bQ))){let{scroll:e}=this.root;e&&(yR(t.x,e.offset.x),yR(t.y,e.offset.y))}return t}removeElementScroll(e){let t=m$();if(bu(t,e),this.scroll?.wasRoot)return t;for(let n=0;n<this.path.length;n++){let r=this.path[n],{scroll:i,options:o}=r;r!==this.root&&i&&o.layoutScroll&&(i.wasRoot&&bu(t,e),yR(t.x,i.offset.x),yR(t.y,i.offset.y))}return t}applyTransform(e,t=!1,n){let r=n||m$();bu(r,e);for(let e=0;e<this.path.length;e++){let n=this.path[e];!t&&n.options.layoutScroll&&n.scroll&&n!==n.root&&(yR(r.x,-n.scroll.offset.x),yR(r.y,-n.scroll.offset.y)),yN(n.latestValues)&&yI(r,n.latestValues,n.layout?.layoutBox)}return yN(this.latestValues)&&yI(r,this.latestValues,this.layout?.layoutBox),r}removeTransform(e){let t=m$();bu(t,e);for(let e=0;e<this.path.length;e++){let n,r=this.path[e];yN(r.latestValues)&&(r.instance&&(yT(r.latestValues)&&r.updateSnapshot(),bu(n=m$(),r.measurePageBox())),bm(t,r.latestValues,r.snapshot?.layoutBox,n))}return yN(this.latestValues)&&bm(t,this.latestValues),t}setTargetDelta(e){this.targetDelta=e,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(e){this.options={...this.options,...e,crossfade:void 0===e.crossfade||e.crossfade}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==gh.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(e=!1){let t=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=t.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=t.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=t.isSharedProjectionDirty);let n=!!this.resumingFrom||this!==t;if(!(e||n&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;let{layout:r,layoutId:i}=this.options;if(!this.layout||!(r||i))return;this.resolvedRelativeTargetAt=gh.timestamp;let o=this.getClosestProjectingParent();if(o&&this.linkedParentVersion!==o.layoutVersion&&!o.options.layoutRoot&&this.removeRelativeTarget(),this.targetDelta||this.relativeTarget||(!1!==this.options.layoutAnchor&&o&&o.layout?this.createRelativeTarget(o,this.layout.layoutBox,o.layout.layoutBox):this.removeRelativeTarget()),this.relativeTarget||this.targetDelta){if(this.target||(this.target=m$(),this.targetWithTransforms=m$()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target){var s,a,l,u;this.forceRelativeParentToResolveTarget(),s=this.target,a=this.relativeTarget,l=this.relativeParent.target,u=this.options.layoutAnchor||void 0,x_(s.x,a.x,l.x,u?.x),x_(s.y,a.y,l.y,u?.y)}else this.targetDelta?(this.resumingFrom?this.applyTransform(this.layout.layoutBox,!1,this.target):bu(this.target,this.layout.layoutBox),yD(this.target,this.targetDelta)):bu(this.target,this.layout.layoutBox);this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,!1!==this.options.layoutAnchor&&o&&!!o.resumingFrom==!!this.resumingFrom&&!o.options.layoutScroll&&o.target&&1!==this.animationProgress?this.createRelativeTarget(o,this.target,o.target):this.relativeParent=this.relativeTarget=void 0)}}getClosestProjectingParent(){if(!(!this.parent||yT(this.parent.latestValues)||yj(this.parent.latestValues)))if(this.parent.isProjecting())return this.parent;else return this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(e,t,n){this.relativeParent=e,this.linkedParentVersion=e.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=m$(),this.relativeTargetOrigin=m$(),xC(this.relativeTargetOrigin,t,n,this.options.layoutAnchor||void 0),bu(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){let e=this.getLead(),t=!!this.resumingFrom||this!==e,n=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(n=!1),t&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(n=!1),this.resolvedRelativeTargetAt===gh.timestamp&&(n=!1),n)return;let{layout:r,layoutId:i}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(r||i))return;bu(this.layoutCorrected,this.layout.layoutBox);let o=this.treeScale.x,s=this.treeScale.y;!function(e,t,n,r=!1){let i,o,s=n.length;if(s){t.x=t.y=1;for(let a=0;a<s;a++){o=(i=n[a]).projectionDelta;let{visualElement:s}=i.options;(!s||!s.props.style||"contents"!==s.props.style.display)&&(r&&i.options.layoutScroll&&i.scroll&&i!==i.root&&(yR(e.x,-i.scroll.offset.x),yR(e.y,-i.scroll.offset.y)),o&&(t.x*=o.x.scale,t.y*=o.y.scale,yD(e,o)),r&&yN(i.latestValues)&&yI(e,i.latestValues,i.layout?.layoutBox))}t.x<1.0000000000001&&t.x>.999999999999&&(t.x=1),t.y<1.0000000000001&&t.y>.999999999999&&(t.y=1)}}(this.layoutCorrected,this.treeScale,this.path,t),e.layout&&!e.target&&(1!==this.treeScale.x||1!==this.treeScale.y)&&(e.target=e.layout.layoutBox,e.targetWithTransforms=m$());let{target:a}=e;if(!a){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}this.projectionDelta&&this.prevProjectionDelta?(bc(this.prevProjectionDelta.x,this.projectionDelta.x),bc(this.prevProjectionDelta.y,this.projectionDelta.y)):this.createProjectionDeltas(),xk(this.projectionDelta,this.layoutCorrected,a,this.latestValues),this.treeScale.x===o&&this.treeScale.y===s&&bk(this.projectionDelta.x,this.prevProjectionDelta.x)&&bk(this.projectionDelta.y,this.prevProjectionDelta.y)||(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",a))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(e=!0){if(this.options.visualElement?.scheduleRender(),e){let e=this.getStack();e&&e.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=mz(),this.projectionDelta=mz(),this.projectionDeltaWithTransform=mz()}setAnimationOrigin(e,t=!1){let n,r=this.snapshot,i=r?r.latestValues:{},o={...this.latestValues},s=mz();this.relativeParent&&this.relativeParent.options.layoutRoot||(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!t;let a=m$(),l=(r?r.source:void 0)!==(this.layout?this.layout.source:void 0),u=this.getStack(),c=!u||u.members.length<=1,d=!!(l&&!c&&!0===this.options.crossfade&&!this.path.some(bG));this.animationProgress=0,this.mixTargetDelta=t=>{let r=t/1e3;if(bH(s.x,e.x,r),bH(s.y,e.y,r),this.setTargetDelta(s),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout){var u,h,f,p,m,g;xC(a,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),f=this.relativeTarget,p=this.relativeTargetOrigin,m=a,g=r,bK(f.x,p.x,m.x,g),bK(f.y,p.y,m.y,g),n&&(u=this.relativeTarget,h=n,bv(u.x,h.x)&&bv(u.y,h.y))&&(this.isProjectionDirty=!1),n||(n=m$()),bu(n,this.relativeTarget)}l&&(this.animationValues=o,function(e,t,n,r,i,o){i?(e.opacity=yb(0,n.opacity??1,bo(r)),e.opacityExit=yb(t.opacity??1,0,bs(r))):o&&(e.opacity=yb(t.opacity??1,n.opacity??1,r));for(let i=0;i<bt;i++){let o=be[i],s=bi(t,o),a=bi(n,o);(void 0!==s||void 0!==a)&&(s||(s=0),a||(a=0),0===s||0===a||br(s)===br(a)?(e[o]=Math.max(yb(bn(s),bn(a),r),0),(mm.test(a)||mm.test(s))&&(e[o]+="%")):e[o]=a)}(t.rotate||n.rotate)&&(e.rotate=yb(t.rotate||0,n.rotate||0,r))}(o,i,this.latestValues,r,d,c)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=r},this.mixTargetDelta(1e3*!!this.options.layoutRoot)}startAnimation(e){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(gd(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=gc.update(()=>{var t,n,r;let i;x4.hasAnimatedSinceResize=!0,gI.layout++,this.motionValue||(this.motionValue=gZ(0)),this.motionValue.jump(0,!1),this.currentAnimation=(t=this.motionValue,n=[0,1e3],r={...e,velocity:0,isSync:!0,onUpdate:t=>{this.mixTargetDelta(t),e.onUpdate&&e.onUpdate(t)},onStop:()=>{gI.layout--},onComplete:()=>{gI.layout--,e.onComplete&&e.onComplete(),this.completeAnimation()}},(i=mU(t)?t:gZ(t)).start(xs("",i,n,r)),i.animation),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);let e=this.getStack();e&&e.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(1e3),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){let e=this.getLead(),{targetWithTransforms:t,target:n,layout:r,latestValues:i}=e;if(t&&n&&r){if(this!==e&&this.layout&&r&&bZ(this.options.animationType,this.layout.layoutBox,r.layoutBox)){n=this.target||m$();let t=xb(this.layout.layoutBox.x);n.x.min=e.target.x.min,n.x.max=n.x.min+t;let r=xb(this.layout.layoutBox.y);n.y.min=e.target.y.min,n.y.max=n.y.min+r}bu(t,n),yI(t,i),xk(this.projectionDeltaWithTransform,this.layoutCorrected,t,i)}}registerSharedNode(e,t){this.sharedNodes.has(e)||this.sharedNodes.set(e,new b_),this.sharedNodes.get(e).add(t);let n=t.options.initialPromotionConfig;t.promote({transition:n?n.transition:void 0,preserveFollowOpacity:n&&n.shouldPreserveFollowOpacity?n.shouldPreserveFollowOpacity(t):void 0})}isLead(){let e=this.getStack();return!e||e.lead===this}getLead(){let{layoutId:e}=this.options;return e&&this.getStack()?.lead||this}getPrevLead(){let{layoutId:e}=this.options;return e?this.getStack()?.prevLead:void 0}getStack(){let{layoutId:e}=this.options;if(e)return this.root.sharedNodes.get(e)}promote({needsReset:e,transition:t,preserveFollowOpacity:n}={}){let r=this.getStack();r&&r.promote(this,n),e&&(this.projectionDelta=void 0,this.needsReset=!0),t&&this.setOptions({transition:t})}relegate(){let e=this.getStack();return!!e&&e.relegate(this)}resetSkewAndRotation(){let{visualElement:e}=this.options;if(!e)return;let t=!1,{latestValues:n}=e;if((n.z||n.rotate||n.rotateX||n.rotateY||n.rotateZ||n.skewX||n.skewY)&&(t=!0),!t)return;let r={};n.z&&bT("z",e,r,this.animationValues);for(let t=0;t<bE.length;t++)bT(`rotate${bE[t]}`,e,r,this.animationValues),bT(`skew${bE[t]}`,e,r,this.animationValues);for(let t in e.render(),r)e.setStaticValue(t,r[t]),this.animationValues&&(this.animationValues[t]=r[t]);e.scheduleRender()}applyProjectionStyles(e,t){if(!this.instance||this.isSVG)return;if(!this.isVisible){e.visibility="hidden";return}let n=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,e.visibility="",e.opacity="",e.pointerEvents=yQ(t?.pointerEvents)||"",e.transform=n?n(this.latestValues,""):"none";return}let r=this.getLead();if(!this.projectionDelta||!this.layout||!r.target){this.options.layoutId&&(e.opacity=void 0!==this.latestValues.opacity?this.latestValues.opacity:1,e.pointerEvents=yQ(t?.pointerEvents)||""),this.hasProjected&&!yN(this.latestValues)&&(e.transform=n?n({},""):"none",this.hasProjected=!1);return}e.visibility="";let i=r.animationValues||r.latestValues;this.applyTransformsToTarget();let o=function(e,t,n){let r="",i=e.x.translate/t.x,o=e.y.translate/t.y,s=n?.z||0;if((i||o||s)&&(r=`translate3d(${i}px, ${o}px, ${s}px) `),(1!==t.x||1!==t.y)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){let{transformPerspective:e,rotate:t,rotateX:i,rotateY:o,skewX:s,skewY:a}=n;e&&(r=`perspective(${e}px) ${r}`),t&&(r+=`rotate(${t}deg) `),i&&(r+=`rotateX(${i}deg) `),o&&(r+=`rotateY(${o}deg) `),s&&(r+=`skewX(${s}deg) `),a&&(r+=`skewY(${a}deg) `)}let a=e.x.scale*t.x,l=e.y.scale*t.y;return(1!==a||1!==l)&&(r+=`scale(${a}, ${l})`),r||"none"}(this.projectionDeltaWithTransform,this.treeScale,i);n&&(o=n(i,o)),e.transform=o;let{x:s,y:a}=this.projectionDelta;for(let t in e.transformOrigin=`${100*s.origin}% ${100*a.origin}% 0`,r.animationValues?e.opacity=r===this?i.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:i.opacityExit:e.opacity=r===this?void 0!==i.opacity?i.opacity:"":void 0!==i.opacityExit?i.opacityExit:0,yw){if(void 0===i[t])continue;let{correct:n,applyTo:s,isCSSVariable:a}=yw[t],l="none"===o?i[t]:n(i[t],r);if(s){let t=s.length;for(let n=0;n<t;n++)e[s[n]]=l}else a?this.options.visualElement.renderState.vars[t]=l:e[t]=l}this.options.layoutId&&(e.pointerEvents=r===this?yQ(t?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(e=>e.currentAnimation?.stop()),this.root.nodes.forEach(bL),this.root.sharedNodes.clear()}}}function bj(e){e.updateLayout()}function bP(e){let t=e.resumeFrom?.snapshot||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners("didUpdate")){let{layoutBox:n,measuredBox:r}=e.layout,{animationType:i}=e.options,o=t.source!==e.layout.source;if("size"===i)xy(e=>{let r=o?t.measuredBox[e]:t.layoutBox[e],i=xb(r);r.min=n[e].min,r.max=r.min+i});else if("x"===i||"y"===i){let e="x"===i?"y":"x";bl(o?t.measuredBox[e]:t.layoutBox[e],n[e])}else bZ(i,t.layoutBox,n)&&xy(r=>{let i=o?t.measuredBox[r]:t.layoutBox[r],s=xb(n[r]);i.max=i.min+s,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[r].max=e.relativeTarget[r].min+s)});let s=mz();xk(s,n,t.layoutBox);let a=mz();o?xk(a,e.applyTransform(r,!0),t.measuredBox):xk(a,n,t.layoutBox);let l=!by(s),u=!1;if(!e.resumeFrom){let r=e.getClosestProjectingParent();if(r&&!r.resumeFrom){let{snapshot:i,layout:o}=r;if(i&&o){let s=e.options.layoutAnchor||void 0,a=m$();xC(a,t.layoutBox,i.layoutBox,s);let l=m$();xC(l,n,o.layoutBox,s),bb(a,l)||(u=!0),r.options.layoutRoot&&(e.relativeTarget=l,e.relativeTargetOrigin=a,e.relativeParent=r)}}}e.notifyListeners("didUpdate",{layout:n,snapshot:t,delta:a,layoutDelta:s,hasLayoutChanged:l,hasRelativeLayoutChanged:u})}else if(e.isLead()){let{onExitComplete:t}=e.options;t&&t()}e.options.transition=void 0}function bM(e){e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function bD(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function bR(e){e.clearSnapshot()}function bL(e){e.clearMeasurements()}function bO(e){e.isLayoutDirty=!0,e.updateLayout()}function bI(e){e.isLayoutDirty=!1}function bF(e){e.isAnimationBlocked&&e.layout&&!e.isLayoutDirty&&(e.snapshot=e.layout,e.isLayoutDirty=!0)}function bz(e){let{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function bB(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function b$(e){e.resolveTargetDelta()}function bU(e){e.calcProjection()}function bV(e){e.resetSkewAndRotation()}function bW(e){e.removeLeadSnapshot()}function bH(e,t,n){e.translate=yb(t.translate,0,n),e.scale=yb(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function bK(e,t,n,r){e.min=yb(t.min,n.min,r),e.max=yb(t.max,n.max,r)}function bG(e){return e.animationValues&&void 0!==e.animationValues.opacityExit}let bq={duration:.45,ease:[.4,0,.1,1]},bJ=e=>"u">typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),bY=bJ("applewebkit/")&&!bJ("chrome/")?Math.round:gs;function bX(e){e.min=bY(e.min),e.max=bY(e.max)}function bZ(e,t,n){return"position"===e||"preserve-aspect"===e&&!(.2>=Math.abs(bw(t)-bw(n)))}function bQ(e){return e!==e.root&&e.scroll?.wasRoot}let b0=bN({attachResizeListener:(e,t)=>xv(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),b1={current:void 0},b2=bN({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!b1.current){let e=new b0({});e.mount(window),e.setOptions({layoutScroll:!0}),b1.current=e}return b1.current},resetTransform:(e,t)=>{e.style.transform=void 0!==t?t:"none"},checkIsScrollRoot:e=>"fixed"===window.getComputedStyle(e).position});function b5(e,t){let n=xT(e),r=new AbortController;return[n,{passive:!0,...t,signal:r.signal},()=>r.abort()]}function b3(e,t,n){let{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive("whileHover","Start"===n);let i=r["onHover"+n];i&&gc.postRender(()=>i(t,xB(t)))}let b4=(e,t)=>!!t&&(e===t||b4(e,t.parentElement)),b6=new WeakSet;function b8(e){return t=>{"Enter"===t.key&&e(t)}}function b9(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}function b7(e){return xz(e)&&!(xx.x||xx.y)}let we=new WeakSet;function wt(e,t,n){let{props:r}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&r.whileTap&&e.animationState.setActive("whileTap","Start"===n);let i=r["onTap"+("End"===n?"":n)];i&&gc.postRender(()=>i(t,xB(t)))}let wn=new WeakMap,wr=new WeakMap,wi=e=>{let t=wn.get(e.target);t&&t(e)},wo=e=>{e.forEach(wi)},ws={some:0,all:1},wa=function(e,t){if("u"<typeof Proxy)return vn;let n=new Map,r=(n,r)=>vn(n,r,e,t);return new Proxy((e,t)=>r(e,t),{get:(i,o)=>"create"===o?r:(n.has(o)||n.set(o,vn(o,void 0,e,t)),n.get(o))})}({animation:{Feature:class extends vr{constructor(e){super(e),e.animationState||(e.animationState=function(e){let t=t=>Promise.all(t.map(({animation:t,options:n})=>(function(e,t,n={}){let r;if(e.notify("AnimationStart",t),Array.isArray(t))r=Promise.all(t.map(t=>xu(e,t,n)));else if("string"==typeof t)r=xu(e,t,n);else{let i="function"==typeof t?vi(e,t,n.custom):t;r=Promise.all(xa(e,i,n))}return r.then(()=>{e.notify("AnimationComplete",t)})})(e,t,n))),n=xm(),r=!0,i=!1,o=t=>(n,r)=>{let i=vi(e,r,"exit"===t?e.presenceContext?.custom:void 0);if(i){let{transition:e,transitionEnd:t,...r}=i;n={...n,...r,...t}}return n};function s(s){let{props:a}=e,l=function e(t){if(!t)return;if(!t.isControllingVariants){let n=t.parent&&e(t.parent)||{};return void 0!==t.props.initial&&(n.initial=t.props.initial),n}let n={};for(let e=0;e<xc;e++){let r=g3[e],i=t.props[r];(g2(i)||!1===i)&&(n[r]=i)}return n}(e.parent)||{},u=[],c=new Set,d={},h=1/0;for(let t=0;t<xf;t++){var f,p;let m=xh[t],g=n[m],y=void 0!==a[m]?a[m]:l[m],v=g2(y),x=m===s?g.isActive:null;!1===x&&(h=t);let b=y===l[m]&&y!==a[m]&&v;if(b&&(r||i)&&e.manuallyAnimateOnMount&&(b=!1),g.protectedKeys={...d},!g.isActive&&null===x||!y&&!g.prevProp||g1(y)||"boolean"==typeof y)continue;if("exit"===m&&g.isActive&&!0!==x){g.prevResolvedValues&&(d={...d,...g.prevResolvedValues});continue}let w=(f=g.prevProp,"string"==typeof(p=y)?p!==f:!!Array.isArray(p)&&!xd(p,f)),k=w||m===s&&g.isActive&&!b&&v||t>h&&v,_=!1,S=Array.isArray(y)?y:[y],C=S.reduce(o(m),{});!1===x&&(C={});let{prevResolvedValues:E={}}=g,A={...E,...C},T=t=>{k=!0,c.has(t)&&(_=!0,c.delete(t)),g.needsAnimating[t]=!0;let n=e.getValue(t);n&&(n.liveStyle=!1)};for(let e in A){let t=C[e],n=E[e];if(!d.hasOwnProperty(e))(va(t)&&va(n)?!xd(t,n)||w:t!==n)?null!=t?T(e):c.add(e):void 0!==t&&c.has(e)?T(e):g.protectedKeys[e]=!0}g.prevProp=y,g.prevResolvedValues=C,g.isActive&&(d={...d,...C}),(r||i)&&e.blockInitialAnimation&&(k=!1);let N=b&&w,j=!N||_;k&&j&&u.push(...S.map(t=>{let n={type:m};if("string"==typeof t&&(r||i)&&!N&&e.manuallyAnimateOnMount&&e.parent){let{parent:r}=e,i=vi(r,t);if(r.enteringChildren&&i){let{delayChildren:t}=i.transition||{};n.delay=xl(r.enteringChildren,e,t)}}return{animation:t,options:n}}))}if(c.size){let t={};if("boolean"!=typeof a.initial){let n=vi(e,Array.isArray(a.initial)?a.initial[0]:a.initial);n&&n.transition&&(t.transition=n.transition)}c.forEach(n=>{let r=e.getBaseTarget(n),i=e.getValue(n);i&&(i.liveStyle=!0),t[n]=r??null}),u.push({animation:t})}let m=!!u.length;return r&&(!1===a.initial||a.initial===a.animate)&&!e.manuallyAnimateOnMount&&(m=!1),r=!1,i=!1,m?t(u):Promise.resolve()}return{animateChanges:s,setActive:function(t,r){if(n[t].isActive===r)return Promise.resolve();e.variantChildren?.forEach(e=>e.animationState?.setActive(t,r)),n[t].isActive=r;let i=s(t);for(let e in n)n[e].protectedKeys={};return i},setAnimateFunction:function(n){t=n(e)},getState:()=>n,reset:()=>{n=xm(),i=!0}}}(e))}updateAnimationControlsSubscription(){let{animate:e}=this.node.getProps();g1(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){let{animate:e}=this.node.getProps(),{animate:t}=this.node.prevProps||{};e!==t&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}}},exit:{Feature:class extends vr{constructor(){super(...arguments),this.id=xg++,this.isExitComplete=!1}update(){if(!this.node.presenceContext)return;let{isPresent:e,onExitComplete:t}=this.node.presenceContext,{isPresent:n}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===n)return;if(e&&!1===n){if(this.isExitComplete){let{initial:e,custom:t}=this.node.getProps();if("string"==typeof e||"object"==typeof e&&null!==e&&!Array.isArray(e)){let n=vi(this.node,e,t);if(n){let{transition:e,transitionEnd:t,...r}=n;for(let e in r)this.node.getValue(e)?.jump(r[e])}}this.node.animationState.reset(),this.node.animationState.animateChanges()}else this.node.animationState.setActive("exit",!1);this.isExitComplete=!1;return}let r=this.node.animationState.setActive("exit",!e);t&&!e&&r.then(()=>{this.isExitComplete=!0,t(this.id)})}mount(){let{register:e,onExitComplete:t}=this.node.presenceContext||{};t&&t(this.id),e&&(this.unmount=e(this.id))}unmount(){}}},inView:{Feature:class extends vr{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){var e;let t;this.stopObserver?.();let{viewport:n={}}=this.node.getProps(),{root:r,margin:i,amount:o="some",once:s}=n,a={root:r?r.current:void 0,rootMargin:i,threshold:"number"==typeof o?o:ws[o]},l=e=>{let{isIntersecting:t}=e;if(this.isInView===t||(this.isInView=t,s&&!t&&this.hasEnteredView))return;t&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",t);let{onViewportEnter:n,onViewportLeave:r}=this.node.getProps(),i=t?n:r;i&&i(e)};this.stopObserver=(e=this.node.current,t=function({root:e,...t}){let n=e||document;wr.has(n)||wr.set(n,{});let r=wr.get(n),i=JSON.stringify(t);return r[i]||(r[i]=new IntersectionObserver(wo,{root:e,...t})),r[i]}(a),wn.set(e,l),t.observe(e),()=>{wn.delete(e),t.unobserve(e)})}mount(){this.startObserver()}update(){if("u"<typeof IntersectionObserver)return;let{props:e,prevProps:t}=this.node;["amount","margin","root"].some(function({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}(e,t))&&this.startObserver()}unmount(){this.stopObserver?.(),this.hasEnteredView=!1,this.isInView=!1}}},tap:{Feature:class extends vr{mount(){let{current:e}=this.node;if(!e)return;let{globalTapTarget:t,propagate:n}=this.node.props;this.unmount=function(e,t,n={}){let[r,i,o]=b5(e,n),s=e=>{let r=e.currentTarget;if(!b7(e)||we.has(e))return;b6.add(r),n.stopPropagation&&we.add(e);let o=t(r,e),s=(e,t)=>{window.removeEventListener("pointerup",a),window.removeEventListener("pointercancel",l),b6.has(r)&&b6.delete(r),b7(e)&&"function"==typeof o&&o(e,{success:t})},a=e=>{s(e,r===window||r===document||n.useGlobalTarget||b4(r,e.target))},l=e=>{s(e,!1)};window.addEventListener("pointerup",a,i),window.addEventListener("pointercancel",l,i)};return r.forEach(e=>{(n.useGlobalTarget?window:e).addEventListener("pointerdown",s,i),xE(e)&&"offsetHeight"in e&&!("ownerSVGElement"in e)&&(e.addEventListener("focus",e=>((e,t)=>{let n=e.currentTarget;if(!n)return;let r=b8(()=>{if(b6.has(n))return;b9(n,"down");let e=b8(()=>{b9(n,"up")});n.addEventListener("keyup",e,t),n.addEventListener("blur",()=>b9(n,"cancel"),t)});n.addEventListener("keydown",r,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",r),t)})(e,i)),xI.has(e.tagName)||!0===e.isContentEditable||e.hasAttribute("tabindex")||(e.tabIndex=0))}),o}(e,(e,t)=>(wt(this.node,t,"Start"),(e,{success:t})=>wt(this.node,e,t?"End":"Cancel")),{useGlobalTarget:t,stopPropagation:n?.tap===!1})}unmount(){}}},focus:{Feature:class extends vr{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch(t){e=!0}e&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){this.isActive&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=vu(xv(this.node.current,"focus",()=>this.onFocus()),xv(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}},hover:{Feature:class extends vr{mount(){let{current:e}=this.node;e&&(this.unmount=function(e,t,n={}){let[r,i,o]=b5(e,n);return r.forEach(e=>{let n,r=!1,o=!1,s=t=>{n&&(n(t),n=void 0),e.removeEventListener("pointerleave",l)},a=e=>{r=!1,window.removeEventListener("pointerup",a),window.removeEventListener("pointercancel",a),o&&(o=!1,s(e))},l=e=>{if("touch"!==e.pointerType){if(r){o=!0;return}s(e)}};e.addEventListener("pointerenter",r=>{if("touch"===r.pointerType||xx.x||xx.y)return;o=!1;let s=t(e,r);"function"==typeof s&&(n=s,e.addEventListener("pointerleave",l,i))},i),e.addEventListener("pointerdown",()=>{r=!0,window.addEventListener("pointerup",a,i),window.addEventListener("pointercancel",a,i)},i)}),o}(e,(e,t)=>(b3(this.node,t,"Start"),e=>b3(this.node,e,"End"))))}unmount(){}}},pan:{Feature:class extends vr{constructor(){super(...arguments),this.removePointerDownListener=gs}onPointerDown(e){this.session=new xH(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:xU(this.node)})}createPanHandlers(){let{onPanSessionStart:e,onPanStart:t,onPan:n,onPanEnd:r}=this.node.getProps();return{onSessionStart:x3(e),onStart:x3(t),onMove:x3(n),onEnd:(e,t)=>{delete this.session,r&&gc.postRender(()=>r(e,t))}}}mount(){this.removePointerDownListener=x$(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}},drag:{Feature:class extends vr{constructor(e){super(e),this.removeGroupControls=gs,this.removeListeners=gs,this.controls=new x1(e)}mount(){let{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||gs}update(){let{dragControls:e}=this.node.getProps(),{dragControls:t}=this.node.prevProps||{};e!==t&&(this.removeGroupControls(),e&&(this.removeGroupControls=e.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}},ProjectionNode:b2,MeasureLayout:x7},layout:{ProjectionNode:b2,MeasureLayout:x7}},(e,t)=>t.isSVG??y$(e)?new yC(t):new yz(t,{allowProjection:e!==T.Fragment})),wl=new Map,wu=(0,T.memo)(({children:e,as:t="p",className:n,duration:r=2,spread:i=2})=>{let o,s=((o=wl.get(t))||(o=wa.create(t),wl.set(t,o)),o),a=(0,T.useMemo)(()=>(e?.length??0)*i,[e,i]);return(0,A.jsx)(s,{animate:{backgroundPosition:"0% center"},className:oG("relative inline-block bg-[length:250%_100%,auto] bg-clip-text text-transparent","[--bg:linear-gradient(90deg,#0000_calc(50%-var(--spread)),var(--color-background),#0000_calc(50%+var(--spread)))] [background-repeat:no-repeat,padding-box]",n),initial:{backgroundPosition:"100% center"},style:{"--spread":`${a}px`,backgroundImage:"var(--bg), linear-gradient(var(--color-muted-foreground), var(--color-muted-foreground))"},transition:{duration:r,ease:"linear",repeat:1/0},children:e})});var wc=e.i(83377);let wd=D("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]]),wh=(0,T.createContext)({autoScroll:!0,isStreaming:!1,output:""}),wf=({className:e,children:t,...n})=>(0,A.jsx)("div",{className:oG("flex items-center justify-between border-zinc-800 border-b px-4 py-2",e),...n,children:t}),wp=({className:e,children:t,...n})=>(0,A.jsxs)("div",{className:oG("flex items-center gap-2 text-sm text-zinc-400",e),...n,children:[(0,A.jsx)(wd,{className:"size-4"}),t??"Terminal"]}),wm=({className:e,children:t,...n})=>{let{isStreaming:r}=(0,T.useContext)(wh);return r?(0,A.jsx)("div",{className:oG("flex items-center gap-2 text-xs text-zinc-400",e),...n,children:t}):null},wg=({className:e,children:t,...n})=>(0,A.jsx)("div",{className:oG("flex items-center gap-1",e),...n,children:t}),wy=({onCopy:e,onError:t,timeout:n=2e3,children:r,className:i,...o})=>{let[s,a]=(0,T.useState)(!1),l=(0,T.useRef)(0),{output:u}=(0,T.useContext)(wh),c=(0,T.useCallback)(async()=>{if(!navigator?.clipboard?.writeText)return void t?.(Error("Clipboard API not available"));try{await navigator.clipboard.writeText(u),a(!0),e?.(),l.current=window.setTimeout(()=>a(!1),n)}catch(e){t?.(e)}},[u,e,t,n]);return(0,T.useEffect)(()=>()=>{window.clearTimeout(l.current)},[]),(0,A.jsx)(oJ,{className:oG("size-7 shrink-0 text-zinc-400 hover:bg-zinc-800 hover:text-zinc-100",i),onClick:c,size:"icon",variant:"ghost",...o,children:r??(0,A.jsx)(s?oY:le,{size:14})})},wv=({children:e,className:t,...n})=>{let{onClear:r}=(0,T.useContext)(wh);return r?(0,A.jsx)(oJ,{className:oG("size-7 shrink-0 text-zinc-400 hover:bg-zinc-800 hover:text-zinc-100",t),onClick:r,size:"icon",variant:"ghost",...n,children:e??(0,A.jsx)(el,{size:14})}):null},wx=({className:e,children:t,...n})=>{let{output:r,isStreaming:i,autoScroll:o}=(0,T.useContext)(wh),s=(0,T.useRef)(null);return(0,T.useEffect)(()=>{o&&s.current&&(s.current.scrollTop=s.current.scrollHeight)},[r,o]),(0,A.jsx)("div",{className:oG("max-h-96 overflow-auto p-4 font-mono text-sm leading-relaxed",e),ref:s,...n,children:t??(0,A.jsxs)("pre",{className:"whitespace-pre-wrap break-words",children:[(0,A.jsx)(wc.default,{children:r}),i&&(0,A.jsx)("span",{className:"ml-0.5 inline-block h-4 w-2 animate-pulse bg-zinc-100"})]})})},wb=({output:e,isStreaming:t=!1,autoScroll:n=!0,onClear:r,className:i,children:o,...s})=>{let a=(0,T.useMemo)(()=>({autoScroll:n,isStreaming:t,onClear:r,output:e}),[n,t,r,e]);return(0,A.jsx)(wh.Provider,{value:a,children:(0,A.jsx)("div",{className:oG("flex flex-col overflow-hidden rounded-lg border bg-zinc-950 text-zinc-100",i),...s,children:o??(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(wf,{children:[(0,A.jsx)(wp,{}),(0,A.jsxs)("div",{className:"flex items-center gap-1",children:[(0,A.jsx)(wm,{}),(0,A.jsxs)(wg,{children:[(0,A.jsx)(wy,{}),r&&(0,A.jsx)(wv,{})]})]})]}),(0,A.jsx)(wx,{})]})})})};var iH=iH;let ww=iW("inline-flex w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-full border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3",{variants:{variant:{default:"bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"bg-destructive text-white focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40 [a&]:hover:bg-destructive/90",outline:"border-border text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground",ghost:"[a&]:hover:bg-accent [a&]:hover:text-accent-foreground",link:"text-primary underline-offset-4 [a&]:hover:underline"}},defaultVariants:{variant:"default"}});function wk({className:e,variant:t="default",asChild:n=!1,...r}){let i=n?iH.Root:"span";return(0,A.jsx)(i,{"data-slot":"badge","data-variant":t,className:oG(ww({variant:t}),e),...r})}var w_=iH,wS=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{let n=(0,w_.createSlot)(`Primitive.${t}`),r=T.forwardRef((e,r)=>{let{asChild:i,...o}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,A.jsx)(i?n:t,{...o,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),wC="Collapsible",[wE,wA]=(0,o0.createContextScope)(wC),[wT,wN]=wE(wC),wj=T.forwardRef((e,t)=>{let{__scopeCollapsible:n,open:r,defaultOpen:i,disabled:o,onOpenChange:s,...a}=e,[l,u]=(0,sw.useControllableState)({prop:r,defaultProp:i??!1,onChange:s,caller:wC});return(0,A.jsx)(wT,{scope:n,disabled:o,contentId:(0,sm.useId)(),open:l,onOpenToggle:T.useCallback(()=>u(e=>!e),[u]),children:(0,A.jsx)(wS.div,{"data-state":wO(l),"data-disabled":o?"":void 0,...a,ref:t})})});wj.displayName=wC;var wP="CollapsibleTrigger",wM=T.forwardRef((e,t)=>{let{__scopeCollapsible:n,...r}=e,i=wN(wP,n);return(0,A.jsx)(wS.button,{type:"button","aria-controls":i.contentId,"aria-expanded":i.open||!1,"data-state":wO(i.open),"data-disabled":i.disabled?"":void 0,disabled:i.disabled,...r,ref:t,onClick:(0,oQ.composeEventHandlers)(e.onClick,i.onOpenToggle)})});wM.displayName=wP;var wD="CollapsibleContent",wR=T.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=wN(wD,e.__scopeCollapsible);return(0,A.jsx)(di.Presence,{present:n||i.open,children:({present:e})=>(0,A.jsx)(wL,{...r,ref:t,present:e})})});wR.displayName=wD;var wL=T.forwardRef((e,t)=>{let{__scopeCollapsible:n,present:r,children:i,...o}=e,s=wN(wD,n),[a,l]=T.useState(r),u=T.useRef(null),c=(0,o1.useComposedRefs)(t,u),d=T.useRef(0),h=d.current,f=T.useRef(0),p=f.current,m=s.open||a,g=T.useRef(m),y=T.useRef(void 0);return T.useEffect(()=>{let e=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,sk.useLayoutEffect)(()=>{let e=u.current;if(e){y.current=y.current||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration="0s",e.style.animationName="none";let t=e.getBoundingClientRect();d.current=t.height,f.current=t.width,g.current||(e.style.transitionDuration=y.current.transitionDuration,e.style.animationName=y.current.animationName),l(r)}},[s.open,r]),(0,A.jsx)(wS.div,{"data-state":wO(s.open),"data-disabled":s.disabled?"":void 0,id:s.contentId,hidden:!m,...o,ref:c,style:{"--radix-collapsible-content-height":h?`${h}px`:void 0,"--radix-collapsible-content-width":p?`${p}px`:void 0,...e.style},children:m&&i})});function wO(e){return e?"open":"closed"}e.s(["Collapsible",0,wj,"CollapsibleContent",0,wR,"CollapsibleTrigger",0,wM,"Content",0,wR,"Root",0,wj,"Trigger",0,wM,"createCollapsibleScope",0,wA],687607);var wI=e.i(687607),wI=wI;function wF({...e}){return(0,A.jsx)(wI.Root,{"data-slot":"collapsible",...e})}function wz({...e}){return(0,A.jsx)(wI.CollapsibleTrigger,{"data-slot":"collapsible-trigger",...e})}function wB({...e}){return(0,A.jsx)(wI.CollapsibleContent,{"data-slot":"collapsible-content",...e})}let w$=D("circle-check-big",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]),wU=D("clock",[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]),wV=D("wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]]),wW=D("circle-x",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]),wH=({className:e,...t})=>(0,A.jsx)(wF,{className:oG("group not-prose mb-4 w-full rounded-md border",e),...t}),wK={"approval-requested":"Awaiting Approval","approval-responded":"Responded","input-available":"Running","input-streaming":"Pending","output-available":"Completed","output-denied":"Denied","output-error":"Error"},wG={"approval-requested":(0,A.jsx)(wU,{className:"size-4 text-yellow-600"}),"approval-responded":(0,A.jsx)(w$,{className:"size-4 text-blue-600"}),"input-available":(0,A.jsx)(wU,{className:"size-4 animate-pulse"}),"input-streaming":(0,A.jsx)(h9,{className:"size-4"}),"output-available":(0,A.jsx)(w$,{className:"size-4 text-green-600"}),"output-denied":(0,A.jsx)(wW,{className:"size-4 text-orange-600"}),"output-error":(0,A.jsx)(wW,{className:"size-4 text-red-600"})},wq=({className:e,title:t,type:n,state:r,toolName:i,...o})=>{let s="dynamic-tool"===n?i:n.split("-").slice(1).join("-");return(0,A.jsxs)(wz,{className:oG("flex w-full items-center justify-between gap-4 p-3",e),...o,children:[(0,A.jsxs)("div",{className:"flex items-center gap-2",children:[(0,A.jsx)(wV,{className:"size-4 text-muted-foreground"}),(0,A.jsx)("span",{className:"font-medium text-sm",children:t??s}),(0,A.jsxs)(wk,{className:"gap-1.5 rounded-full text-xs",variant:"secondary",children:[wG[r],wK[r]]})]}),(0,A.jsx)(oX,{className:"size-4 text-muted-foreground transition-transform group-data-[state=open]:rotate-180"})]})},wJ=({className:e,...t})=>(0,A.jsx)(wB,{className:oG("data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 space-y-4 p-4 text-popover-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in",e),...t}),wY=({className:e,input:t,...n})=>(0,A.jsxs)("div",{className:oG("space-y-2 overflow-hidden",e),...n,children:[(0,A.jsx)("h4",{className:"font-medium text-muted-foreground text-xs uppercase tracking-wide",children:"Parameters"}),(0,A.jsx)("div",{className:"rounded-md bg-muted/50",children:(0,A.jsx)(dr,{code:JSON.stringify(t,null,2),language:"json"})})]}),wX=({className:e,output:t,errorText:n,...r})=>{if(!(t||n))return null;let i=(0,A.jsx)("div",{children:t});return"object"!=typeof t||(0,T.isValidElement)(t)?"string"==typeof t&&(i=(0,A.jsx)(dr,{code:t,language:"json"})):i=(0,A.jsx)(dr,{code:JSON.stringify(t,null,2),language:"json"}),(0,A.jsxs)("div",{className:oG("space-y-2",e),...r,children:[(0,A.jsx)("h4",{className:"font-medium text-muted-foreground text-xs uppercase tracking-wide",children:n?"Error":"Result"}),(0,A.jsxs)("div",{className:oG("overflow-x-auto rounded-md text-xs [&_table]:w-full",n?"bg-destructive/10 text-destructive":"bg-muted/50 text-foreground"),children:[n&&(0,A.jsx)("div",{children:n}),i]})]})},wZ="codex-web-ui-auth-token-v1",wQ="codex-web-ui-auth-unauthorized";async function w0(){return await kf("/api/auth")}async function w1(e){var t;let n=await kp("/api/login",{password:e},{skipAuth:!0});return t=n.token,window.localStorage.setItem(wZ,t),n}async function w2(){await kp("/api/logout",{}).catch(()=>void 0),kx()}async function w5(){return(await kf("/api/status")).status}async function w3(){return(await kp("/api/server/restart",{})).status}async function w4(){return await kp("/api/app-server/recover",{})}async function w6(e,t={}){return(await kp("/api/rpc",{method:e,params:t})).result}async function w8(){return(await kf("/api/client-requests")).requests}async function w9(){return(await kf("/api/mcp/servers")).mcp}async function w7(e){let t={name:e.name,url:e.url};return(await kp("/api/mcp/servers",t)).mcp}async function ke(e){return kp("/api/mcp/servers/oauth/login",{name:e})}async function kt(){return(await kp("/api/mcp/servers/reload",{})).mcp}async function kn(e,t){await kp("/api/client-requests/respond",{id:e,result:t})}async function kr(e){let t=e?`?path=${encodeURIComponent(e)}`:"";return(await kf(`/api/repositories/browse${t}`)).browser}async function ki(e={}){let t=new URLSearchParams;e.cwd&&t.set("cwd",e.cwd),e.path&&t.set("path",e.path);let n=t.toString()?`?${t.toString()}`:"";return(await kf(`/api/files/explore${n}`)).explorer}async function ko(){return(await kf("/api/skills")).skills}async function ks(e,t){return(await kp("/api/repositories/create",{parentPath:e,name:t})).browser}async function ka(e){let t=await fetch("/api/uploads",{method:"POST",headers:{...kv(),"Content-Type":e.type||"application/octet-stream","X-File-Name":encodeURIComponent(e.name)},body:e});return(await km(t)).attachment}async function kl(e){let t=await fetch("/api/transcribe",{method:"POST",headers:{...kv(),"Content-Type":e.type||"audio/webm","X-File-Name":encodeURIComponent(e.name)},body:e});return(await km(t)).transcript}async function ku(e){return(await kf(kh("/api/files/view",e))).file}async function kc(e,t=!1){let n=await fetch(kh(t?"/api/files/raw":"/api/files/download",e),{cache:"no-store",headers:kv()});return await kg(n),n.blob()}async function kd(e,t){let n=await kc(e),r=URL.createObjectURL(n),i=document.createElement("a");i.href=r,i.download=t,document.body.append(i),i.click(),i.remove(),URL.revokeObjectURL(r)}function kh(e,t){let n=new URLSearchParams({path:t.path});return t.cwd&&n.set("cwd",t.cwd),`${e}?${n.toString()}`}async function kf(e){return km(await fetch(e,{cache:"no-store",headers:kv()}))}async function kp(e,t,n={}){return km(await fetch(e,{method:"POST",headers:{...!n.skipAuth?kv():{},"Content-Type":"application/json"},body:JSON.stringify(t)}))}async function km(e){return await kg(e),e.json()}async function kg(e){if(401===e.status&&(kx(),window.dispatchEvent(new Event(wQ))),e.ok)return;let t=await e.json().catch(()=>({})),n=Error(t.error||`Request failed: ${e.status}`);throw n.data=t.data,n}async function ky(e,t,n,r){try{let t=await fetch("/api/events",{headers:kv(),signal:e.signal});if(await kg(t),!t.body)throw Error("Event stream response did not include a body.");let i=t.body.pipeThrough(new TextDecoderStream).getReader(),o="";for(;!e.signal.aborted;){let{done:e,value:t}=await i.read();if(e)break;let s=(o+=t).split(/\r?\n\r?\n/);for(let e of(o=s.pop()??"",s))!function(e,t,n){let r="message",i=[];for(let t of e.split(/\r?\n/))t.startsWith("event:")?r=t.slice(6).trim():t.startsWith("data:")&&i.push(t.slice(5).trimStart());if(!i.length)return;let o=i.join("\n");if("hello"===r)return n(JSON.parse(o).history??[]);t(JSON.parse(o))}(e,n,r)}}catch(n){e.signal.aborted||t.onerror?.()}}function kv(){let e=window.localStorage.getItem(wZ)||"";return e?{Authorization:`Bearer ${e}`}:{}}function kx(){window.localStorage.removeItem(wZ)}let kb=(0,T.createContext)(null);function kw(){let e=(0,T.useContext)(kb);return null==e&&function(...e){let t=new URL("https://lexical.dev/docs/error"),n=new URLSearchParams;for(let t of(n.append("code",8),e))n.append("v",t);throw t.search=n.toString(),Error(`Minified Lexical error #8; visit ${t.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(),e}function kk(e,...t){let n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;for(let n of(r.append("code",e),t))r.append("v",n);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function k_(e,...t){let n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;for(let n of(r.append("code",e),t))r.append("v",n);n.search=r.toString(),console.warn(`Minified Lexical warning #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}let kS="u">typeof window&&void 0!==window.document&&void 0!==window.document.createElement,kC=kS&&"documentMode"in document?document.documentMode:null,kE=kS&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),kA=kS&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),kT=!(!kS||!("InputEvent"in window)||kC)&&"getTargetRanges"in new window.InputEvent("input"),kN=kS&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,kj=kS&&/Android/.test(navigator.userAgent),kP=kS&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent)&&!kj,kM=kS&&/^(?=.*Chrome).*/i.test(navigator.userAgent),kD=kS&&kj&&kM,kR=kS&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&kE&&!kM,kL=kP||kN||kR?" ":"",kO=kA?" ":kL,kI="֑-߿יִ-﷽ﹰ-ﻼ",kF="A-Za-zÀ-ÖØ-öø-ʸ̀-ࠀ-Ⰰ-︀--",kz=(RegExp("^[^"+kF+"]*["+kI+"]"),RegExp("^[^"+kI+"]*["+kF+"]"),{bold:1,capitalize:1024,code:16,highlight:128,italic:2,lowercase:256,strikethrough:4,subscript:32,superscript:64,underline:8,uppercase:512}),kB={directionless:1,unmergeable:2},k$={center:2,end:6,justify:4,left:1,right:3,start:5},kU={2:"center",6:"end",4:"justify",1:"left",3:"right",5:"start"},kV={normal:0,segmented:2,token:1},kW={0:"normal",2:"segmented",1:"token"},kH="$config";class kK{_front=new Set;_back=new Set;_cache;get size(){return this._front.size+this._back.size}addBack(e){return delete this._cache,this._front.has(e)||this._back.add(e),this}addFront(e){return delete this._cache,this._back.has(e)||this._front.add(e),this}delete(e){return delete this._cache,this._front.delete(e)||this._back.delete(e)}toArray(){let e=Array.from(this._front).reverse();for(let t of this._back)e.push(t);return e}toReadonlyArray(){return this._cache=this._cache||this.toArray(),this._cache}[Symbol.iterator](){return this.toReadonlyArray()[Symbol.iterator]()}}let kG=!1,kq=0;function kJ(e){kq=e.timeStamp}function kY(e,t,n){let r="BR"===e.nodeName,i=t.__lexicalLineBreak;return i&&(e===i||r&&e.previousSibling===i)||r&&void 0!==An(e,n)}function kX(e,t,n){kG=!0;let r=performance.now()-kq>100;try{Ex(e,()=>{let i=CY()||e.getEditorState().read(()=>{let e=CY();return null!==e?e.clone():null}),o=new Map,s=e.getRootElement(),a=e._editorState,l=e._blockCursorElement,u=!1,c="";for(let n=0;n<t.length;n++){let d=t[n],h=d.type,f=d.target,p=function(e,t,n,r){var i;for(let o=e;o&&(i=o,!0!==i.__lexicalUnmanaged);o=AN(o)){let e=An(o,t);if(void 0!==e){let t=Ae(e,n);if(t)return EE(t)||!AU(o)?void 0:[o,t]}else if(o===r)return[r,Aa(n)]}}(f,e,a,s);if(!p)continue;let[m,g]=p;if("characterData"===h)r&&C_(g)&&E1(f)&&function(e,t,n){if(CD(e)){let t=e.anchor.getNode();if(t.is(n)&&e.format!==t.getFormat())return!1}return E1(t)&&n.isAttached()}(i,f,g)&&function(e,t,n){let r=A$(AR(n)),i=null,o=null;null!==r&&r.anchorNode===e&&(i=r.anchorOffset,o=r.focusOffset);let s=e.nodeValue;null!==s&&Am(t,s,i,o,!1)}(f,g,e);else if("childList"===h){u=!0;let t=d.addedNodes;for(let n=0;n<t.length;n++){let r=t[n],i=At(r),o=r.parentNode;if(null!=o&&r!==l&&null===i&&!kY(r,o,e)){if(kA){let e=(AU(r)?r.innerText:null)||r.nodeValue;e&&(c+=e)}o.removeChild(r)}}let n=d.removedNodes,r=n.length;if(r>0){let t=0;for(let i=0;i<r;i++){let r=n[i];(kY(r,f,e)||l===r)&&(f.appendChild(r),t++)}r!==t&&o.set(m,g)}}}if(o.size>0)for(let[t,n]of o)n.reconcileObservedMutation(t,e);let d=n.takeRecords();if(d.length>0){for(let t=0;t<d.length;t++){let n=d[t],r=n.addedNodes,i=n.target;for(let t=0;t<r.length;t++){let n=r[t],o=n.parentNode;null==o||"BR"!==n.nodeName||kY(n,i,e)||o.removeChild(n)}}n.takeRecords()}null!==i&&(u&&Al(i),kA&&AE(e)&&i.insertRawText(c))})}finally{kG=!1}}function kZ(e){let t=e._observer;null!==t&&kX(e,t.takeRecords(),t)}function kQ(e){0===kq&&AR(e).addEventListener("textInput",kJ,!0),e._observer=new MutationObserver((t,n)=>{kX(e,t,n)})}class k0{key;parse;unparse;isEqual;defaultValue;resetOnCopyNode;constructor(e,t){this.key=e,this.parse=t.parse.bind(t),this.unparse=(t.unparse||k4).bind(t),this.isEqual=(t.isEqual||Object.is).bind(t),this.defaultValue=this.parse(void 0),this.resetOnCopyNode=t.resetOnCopyNode||!1}}class k1{node;knownState;unknownState;sharedNodeState;size;constructor(e,t,n,r=new Map,i){this.node=e,this.sharedNodeState=t,this.unknownState=n,this.knownState=r;const{sharedConfigMap:o}=this.sharedNodeState,s=void 0!==i?i:function(e,t,n){let r=n.size;if(t)for(let i in t){let t=e.get(i);t&&n.has(t)||r++}return r}(o,n,r);this.size=s}getValue(e){let t=this.knownState.get(e);if(void 0!==t)return t;this.sharedNodeState.sharedConfigMap.set(e.key,e);let n=e.defaultValue;if(this.unknownState&&e.key in this.unknownState){let t=this.unknownState[e.key];void 0!==t&&(n=e.parse(t)),this.updateFromKnown(e,n)}return n}getInternalState(){return[this.unknownState,this.knownState]}toJSON(){let e={...this.unknownState},t={};for(let[t,n]of this.knownState)t.isEqual(n,t.defaultValue)?delete e[t.key]:e[t.key]=t.unparse(n);for(let n of this.sharedNodeState.flatKeys)n in e&&(t[n]=e[n],delete e[n]);return k3(e)&&(t.$=e),t}getWritable(e){if(this.node===e)return this;let{sharedNodeState:t,unknownState:n}=this,r=new Map(this.knownState);return new k1(e,t,function(e,t,n){let r;if(n)for(let[i,o]of Object.entries(n)){let n=e.get(i);n?t.has(n)||t.set(n,n.parse(o)):(r=r||{})[i]=o}return r}(t.sharedConfigMap,r,n),r,this.size)}resetOnCopyNode(){for(let e of this.knownState.keys())e.resetOnCopyNode&&this.knownState.set(e,e.defaultValue);return this}updateFromKnown(e,t){let n=e.key;this.sharedNodeState.sharedConfigMap.set(n,e);let{knownState:r,unknownState:i}=this;r.has(e)||i&&n in i||(i&&(delete i[n],this.unknownState=k3(i)),this.size++),r.set(e,t)}updateFromUnknown(e,t){let n=this.sharedNodeState.sharedConfigMap.get(e);n?this.updateFromKnown(n,n.parse(t)):(this.unknownState=this.unknownState||{},e in this.unknownState||this.size++,this.unknownState[e]=t)}updateFromJSON(e){let{knownState:t}=this;for(let e of t.keys())t.set(e,e.defaultValue);if(this.size=t.size,this.unknownState=void 0,e)for(let[t,n]of Object.entries(e))this.updateFromUnknown(t,n)}}function k2(e){let t=e.getWritable(),n=t.__state?t.__state.getWritable(t):new k1(t,k5(t));return t.__state=n,n}function k5(e){return e.__state?e.__state.sharedNodeState:EH(Aq(),e.getType()).sharedNodeState}function k3(e){if(e)for(let t in e)return e}function k4(e){return e}function k6(e,t,n){for(let[r,i]of t.knownState){if(e.has(r.key))continue;e.add(r.key);let t=n?n.getValue(r):r.defaultValue;if(t!==i&&!r.isEqual(t,i))return!0}return!1}function k8(e,t,n){let{unknownState:r}=t,i=n?n.unknownState:void 0;if(r){for(let[t,n]of Object.entries(r))if(!e.has(t)&&(e.add(t),n!==(i?i[t]:void 0)))return!0}return!1}function k9(e,t){let n=e.__state;return n&&n.node===e?n.getWritable(t):n}function k7(e,t){let n=e.__mode,r=e.__format,i=e.__style,o=t.__mode,s=t.__format,a=t.__style,l=e.__state,u=t.__state;return(null===n||n===o)&&(null===r||r===s)&&(null===i||i===a)&&(null===e.__state||l===u||function(e,t){if(e===t)return!0;let n=new Set;return!(e&&k6(n,e,t)||t&&k6(n,t,e)||e&&k8(n,e,t)||t&&k8(n,t,e))}(l,u))}function _e(e,t){let n=e.mergeWithSibling(t),r=Ea()._normalizedNodes;return r.add(e.__key),r.add(t.__key),n}function _t(e){let t,n,r=e;if(""!==r.__text||!r.isSimpleText()||r.isUnmergeable()){for(;null!==(t=r.getPreviousSibling())&&C_(t)&&t.isSimpleText()&&!t.isUnmergeable();){if(""!==t.__text){k7(t,r)&&(r=_e(t,r));break}t.remove()}for(;null!==(n=r.getNextSibling())&&C_(n)&&n.isSimpleText()&&!n.isUnmergeable();){if(""!==n.__text){k7(r,n)&&(r=_e(r,n));break}n.remove()}}else r.remove()}function _n(e){return _r(e.anchor),_r(e.focus),e}function _r(e){for(;"element"===e.type;){let t,n,r=e.getNode(),i=e.offset;if(i===r.getChildrenSize()?(t=r.getChildAtIndex(i-1),n=!0):(t=r.getChildAtIndex(i),n=!1),C_(t)){e.set(t.__key,n?t.getTextContentSize():0,"text",!0);break}if(!E_(t))break;e.set(t.__key,n?t.getChildrenSize():0,"element",!0)}}let _i,_o,_s,_a,_l,_u,_c,_d,_h,_f,_p,_m="",_g=null,_y=null,_v=!1,_x=!1;function _b(e,t){let n=_c.get(e);if(null!==t){let n=_D(e);n.parentNode===t&&t.removeChild(n)}if(_d.has(e)||_o._keyToDOMMap.delete(e),E_(n)){let e=A3(n,_c);_w(e,0,e.length-1,null)}void 0!==n&&A_(_f,_s,_a,n,"destroyed")}function _w(e,t,n,r){for(let i=t;i<=n;++i){let t=e[i];void 0!==t&&_b(t,r)}}function _k(e,t){e.setProperty("text-align",t)}function __(e,t){let n=_i.theme.indent;if("string"==typeof n){let r=e.classList.contains(n);t>0&&!r?e.classList.add(n):t<1&&r&&e.classList.remove(n)}if(0===t)return void e.style.setProperty("padding-inline-start","");let r=getComputedStyle(_o._rootElement||e).getPropertyValue("--lexical-indent-base-value")||"40px";e.style.setProperty("padding-inline-start",`calc(${t} * ${r})`)}function _S(e,t){let n=e.style;0===t?_k(n,""):1===t?_k(n,"left"):2===t?_k(n,"center"):3===t?_k(n,"right"):4===t?_k(n,"justify"):5===t?_k(n,"start"):6===t&&_k(n,"end")}function _C(e,t){let n=function(e){let t=e.__dir;if(null!==t)return t;if(ET(e))return null;let n=e.getParentOrThrow();return ET(n)&&null===n.__dir?"auto":null}(t);null!==n?e.dir=n:e.removeAttribute("dir")}function _E(e,t){var n;let r,i=_d.get(e);void 0===i&&kk(60);let o=_p.$createDOM(i,_o);if(r=(n=_o)._keyToDOMMap,o[`__lexicalKey_${n._key}`]=e,r.set(e,o),C_(i)?o.setAttribute("data-lexical-text","true"):EE(i)&&o.setAttribute("data-lexical-decorator","true"),E_(i)){let e=i.__indent,t=i.__size;_C(o,i),0!==e&&__(o,e),0!==t&&_A(A3(i,_d),i,0,t-1,_p.$getDOMSlot(i,o,_o));let n=i.__format;0!==n&&_S(o,n),i.isInline()||_N(null,i,o)}else{let t=i.getTextContent();if(EE(i)){let t=i.decorate(_o,_i);null!==t&&_j(e,t),o.contentEditable="false"}_m+=t}return null!==t&&t.insertChild(o),_p.$decorateDOM(i,null,o,_o),A_(_f,_s,_a,i,"created"),o}function _A(e,t,n,r,i){let o=_m;_m="";let s=n;for(;s<=r;++s){_E(e[s],i);let t=_d.get(e[s]);null!==t&&C_(t)?null===_g&&(_g=t.getFormat(),_y=t.getStyle()):E_(t)&&s<r&&!t.isInline()&&(_m+="\n\n")}i.element.__lexicalTextContent=_m,_m=o+_m}function _T(e,t){if(e){let n=e.__last;if(n){let e=t.get(n);if(e)return Cs(e)?"line-break":EE(e)&&e.isInline()?"decorator":null}return"empty"}return null}function _N(e,t,n){let r=_T(e,_c),i=_T(t,_d);r!==i&&_p.$getDOMSlot(t,n,_o).setManagedLineBreak(i)}function _j(e,t){let n=_o._pendingDecorators,r=_o._decorators;if(null===n){if(r[e]===t)return;n=Ai(_o)}n[e]=t}function _P(e){let t=e.nextSibling;return null!==t&&t===_o._blockCursorElement&&(t=t.nextSibling),t}function _M(e,t){let n=new Set;for(let r=t;r<e.length;r++)n.add(e[r]);return n}function _D(e){let t=_h.get(e);return void 0===t&&kk(75,e),t}function _R(e){return{type:e}}let _L=_R("SELECTION_CHANGE_COMMAND"),_O=_R("SELECTION_INSERT_CLIPBOARD_NODES_COMMAND"),_I=_R("CLICK_COMMAND"),_F=_R("BEFORE_INPUT_COMMAND"),_z=_R("INPUT_COMMAND"),_B=_R("COMPOSITION_START_COMMAND"),_$=_R("COMPOSITION_END_COMMAND"),_U=_R("DELETE_CHARACTER_COMMAND"),_V=_R("INSERT_LINE_BREAK_COMMAND"),_W=_R("INSERT_PARAGRAPH_COMMAND"),_H=_R("CONTROLLED_TEXT_INSERTION_COMMAND"),_K=_R("PASTE_COMMAND"),_G=_R("REMOVE_TEXT_COMMAND"),_q=_R("DELETE_WORD_COMMAND"),_J=_R("DELETE_LINE_COMMAND"),_Y=_R("FORMAT_TEXT_COMMAND"),_X=_R("UNDO_COMMAND"),_Z=_R("REDO_COMMAND"),_Q=_R("KEYDOWN_COMMAND"),_0=_R("KEY_ARROW_RIGHT_COMMAND"),_1=_R("MOVE_TO_END"),_2=_R("KEY_ARROW_LEFT_COMMAND"),_5=_R("MOVE_TO_START"),_3=_R("KEY_ARROW_UP_COMMAND"),_4=_R("KEY_ARROW_DOWN_COMMAND"),_6=_R("KEY_ENTER_COMMAND"),_8=_R("KEY_SPACE_COMMAND"),_9=_R("KEY_BACKSPACE_COMMAND"),_7=_R("KEY_ESCAPE_COMMAND"),Se=_R("KEY_DELETE_COMMAND"),St=_R("KEY_TAB_COMMAND"),Sn=_R("INSERT_TAB_COMMAND"),Sr=_R("INDENT_CONTENT_COMMAND"),Si=_R("OUTDENT_CONTENT_COMMAND"),So=_R("DROP_COMMAND"),Ss=_R("FORMAT_ELEMENT_COMMAND"),Sa=_R("DRAGSTART_COMMAND"),Sl=_R("DRAGOVER_COMMAND"),Su=_R("DRAGEND_COMMAND"),Sc=_R("COPY_COMMAND"),Sd=_R("CUT_COMMAND"),Sh=_R("SELECT_ALL_COMMAND"),Sf=_R("CLEAR_EDITOR_COMMAND"),Sp=_R("CLEAR_HISTORY_COMMAND"),Sm=_R("CAN_REDO_COMMAND"),Sg=_R("CAN_UNDO_COMMAND"),Sy=_R("FOCUS_COMMAND"),Sv=_R("BLUR_COMMAND"),Sx=_R("KEY_MODIFIER_COMMAND"),Sb=Object.freeze({}),Sw=[["keydown",function(e,t){Sk=e.timeStamp,S_=e.key,t.isComposing()||AA(t,_Q,e)}],["pointerdown",function(e,t){let n=e.target,r=e.pointerType;AV(n)&&"touch"!==r&&"pen"!==r&&0===e.button&&Ex(t,()=>{EE(Ar(n))||(SN=!0)})}],["compositionstart",function(e,t){AA(t,_B,e)}],["compositionend",function(e,t){kA?SP=!0:!kN&&(kP||kR)?(SM=!0,SD=e.data):AA(t,_$,e)}],["input",function(e,t){e.stopPropagation(),Ex(t,()=>{t.dispatchCommand(_z,e)},{event:e}),SC=null}],["click",function(e,t){Ex(t,()=>{let n=CY(),r=A$(AR(t)),i=CX();if(r){if(CD(n)){let t=n.anchor,o=t.getNode();if("element"===t.type&&0===t.offset&&n.isCollapsed()&&!ET(o)&&1===As().getChildrenSize()&&o.getTopLevelElementOrThrow().isEmpty()&&null!==i&&n.is(i))r.removeAllRanges(),n.dirty=!0;else if(3===e.detail&&!n.isCollapsed()&&o!==n.focus.getNode()){let e=A5(o,e=>E_(e)&&!e.isInline());E_(e)&&e.select(0)}}else if("touch"===e.pointerType||"pen"===e.pointerType){let n=r.anchorNode;(AU(n)||E1(n))&&Al(CJ(i,r,t,e))}}AA(t,_I,e)})}],["cut",Sb],["copy",Sb],["dragstart",Sb],["dragover",Sb],["dragend",Sb],["paste",Sb],["focus",Sb],["blur",Sb],["drop",Sb]];kT&&Sw.push(["beforeinput",(e,t)=>{let n;"deleteCompositionText"===(n=e.inputType)||kA&&AE(t)||"insertCompositionText"!==n&&AA(t,_F,e)}]);let Sk=0,S_=null,SS=0,SC=null,SE=new WeakMap,SA=new WeakMap,ST=!1,SN=!1,Sj=!1,SP=!1,SM=!1,SD="",SR=null,SL=[0,"",0,"root",0];function SO(e,t,n,r,i){let o=e.anchor,s=e.focus,a=o.getNode(),l=Ea(),u=A$(AR(l)),c=null!==u?u.anchorNode:null,d=o.key,h=l.getElementByKey(d),f=n.length;return d!==s.key||!C_(a)||(!i&&(!kT||SS<r+50)||a.isDirty()&&f<2||Ac(n))&&o.offset!==s.offset&&!a.isComposing()||E0(a)||a.isDirty()&&f>1||(i||!kT)&&null!==h&&!a.isComposing()&&c!==E5(h)||null!==u&&null!==t&&(!t.collapsed||t.startContainer!==u.anchorNode||t.startOffset!==u.anchorOffset)||!a.isComposing()&&(a.getFormat()!==e.format||a.getStyle()!==e.style)||function(e,t){let n;if(t.isSegmented())return!0;if(!e.isCollapsed())return!1;let r=e.anchor.offset,i=t.getParentOrThrow(),o=EQ(t);return 0===r?!t.canInsertTextBefore()||!i.canInsertTextBefore()&&!t.isComposing()||o||(C_(n=t.getPreviousSibling())||E_(n)&&n.isInline())&&!n.canInsertTextAfter():r===t.getTextContentSize()&&(!t.canInsertTextAfter()||!i.canInsertTextAfter()&&!t.isComposing()||o)}(e,a)}function SI(e,t){return E1(e)&&null!==e.nodeValue&&0!==t&&t!==e.nodeValue.length}function SF(e,t,n){let{anchorNode:r,anchorOffset:i,focusNode:o,focusOffset:s}=e;ST&&(ST=!1,SI(r,i)&&SI(o,s)&&!SR)||Ex(t,()=>{if(!n)return void Al(null);if(!EJ(t,r,o))return;let a=CY();if(SR&&CD(a)&&a.isCollapsed()){let e=a.anchor,t=SR.anchor;(e.key===t.key&&e.offset===t.offset+1||1===e.offset&&t.getNode().is(e.getNode().getPreviousSibling()))&&Al(a=SR.clone())}if(SR=null,CD(a)){let n=a.anchor,r=n.getNode();if(a.isCollapsed()){"Range"===e.type&&e.anchorNode===e.focusNode&&(a.dirty=!0);let i=AR(t).event,o=i?i.timeStamp:performance.now(),[s,l,u,c,d]=SL,h=As(),f=!1===t.isComposing()&&""===h.getTextContent();if(o<d+200&&n.offset===u&&n.key===c)Sz(a,s,l);else if("text"===n.type)C_(r)||kk(141),SB(a,r);else if("element"===n.type&&!f){E_(r)||kk(259);let e=n.getNode();e.isEmpty()?Sz(a,e.getTextFormat(),e.getTextStyle()):Sz(a,a.format,"")}}else{let e=n.key,t=a.focus.key,r=a.getNodes(),o=r.length,l=a.isBackward(),u=l?s:i,c=l?i:s,d=l?t:e,h=l?e:t,f=2047,p=!1;for(let e=0;e<o;e++){let t=r[e],n=t.getTextContentSize();if(C_(t)&&0!==n&&(0!==e||t.__key!==d||u!==n)&&(e!==o-1||t.__key!==h||0!==c)&&(p=!0,0==(f&=t.getFormat())))break}a.format=p?f:0}}AA(t,_L,void 0)})}function Sz(e,t,n){e.format===t&&e.style===n||(e.format=t,e.style=n,e.dirty=!0)}function SB(e,t){Sz(e,t.getFormat(),t.getStyle())}function S$(e){if(!e.getTargetRanges)return null;let t=e.getTargetRanges();return 0===t.length?null:t[0]}function SU(e){var t;let n=e.inputType,r=S$(e),i=Ea(),o=CY();if("deleteContentBackward"===n){if(null===o){let e=CX();if(!CD(e))return!0;Al(e.clone())}if(CD(o)){let n=o.anchor.key===o.focus.key;if(t=e.timeStamp,"MediaLast"===S_&&t<Sk+30&&i.isComposing()&&n){if(E9(null),Sk=0,setTimeout(()=>{Ex(i,()=>{E9(null)})},30),CD(o)){let e=o.anchor.getNode();e.markDirty(),C_(e)||kk(142),SB(o,e)}}else{E9(null),e.preventDefault();let t=o.anchor.getNode(),r=t.getTextContent(),s=t.canInsertTextAfter(),a=0===o.anchor.offset&&o.focus.offset===r.length,l=kD&&n&&!a&&s;if(l&&o.isCollapsed()&&(l=!EE(AC(o.anchor,!0))),!l){AA(i,_U,!0);let e=CY();kD&&CD(e)&&e.isCollapsed()&&(SR=e,setTimeout(()=>SR=null))}}return!0}}if(!CD(o))return!0;let s=e.data;null!==SC&&Ap(!1,i,SC),o.dirty&&null===SC||!o.isCollapsed()||ET(o.anchor.getNode())||null===r||o.applyDOMRange(r),SC=null;let a=o.anchor,l=o.focus,u=a.getNode(),c=l.getNode();if("insertText"===n||"insertTranspose"===n){if("\n"===s)e.preventDefault(),AA(i,_V,!1);else if("\n\n"===s)e.preventDefault(),AA(i,_W,void 0);else if(null==s&&e.dataTransfer){let t=e.dataTransfer.getData("text/plain");e.preventDefault(),o.insertRawText(t)}else null!=s&&SO(o,r,s,e.timeStamp,!0)?(e.preventDefault(),AA(i,_H,s)):SC=s;return SS=e.timeStamp,!0}switch(e.preventDefault(),n){case"insertFromYank":case"insertFromDrop":case"insertReplacementText":AA(i,_H,e);break;case"insertFromComposition":E9(null),AA(i,_H,e);break;case"insertLineBreak":E9(null),AA(i,_V,!1);break;case"insertParagraph":E9(null),Sj&&!kN?(Sj=!1,AA(i,_V,!1)):AA(i,_W,void 0);break;case"insertFromPaste":case"insertFromPasteAsQuotation":AA(i,_K,e);break;case"deleteByComposition":(u!==c||E_(u)||E_(c)||!EQ(u)||!EQ(c))&&AA(i,_G,e);break;case"deleteByDrag":AP(S8),AA(i,_G,e);break;case"deleteByCut":AA(i,_G,e);break;case"deleteContent":AA(i,_U,!1);break;case"deleteWordBackward":AA(i,_q,!0);break;case"deleteWordForward":AA(i,_q,!1);break;case"deleteHardLineBackward":case"deleteSoftLineBackward":AA(i,_J,!0);break;case"deleteContentForward":case"deleteHardLineForward":case"deleteSoftLineForward":AA(i,_J,!1);break;case"formatStrikeThrough":AA(i,_Y,"strikethrough");break;case"formatBold":AA(i,_Y,"bold");break;case"formatItalic":AA(i,_Y,"italic");break;case"formatUnderline":AA(i,_Y,"underline");break;case"historyUndo":AA(i,_X,void 0);break;case"historyRedo":AA(i,_Z,void 0)}return!0}function SV(e){if(AU(e.target)&&EE(Ar(e.target)))return!0;let t=Ea(),n=CY(),r=e.data,i=S$(e);if(null!=r&&CD(n)&&SO(n,i,r,e.timeStamp,!1)){SP&&(SK(t,r),SP=!1);let i=n.anchor.getNode(),o=A$(AR(t));if(null===o)return!0;let s=n.isBackward(),a=s?n.anchor.offset:n.focus.offset,l=s?n.focus.offset:n.anchor.offset;kT&&!n.isCollapsed()&&C_(i)&&null!==o.anchorNode&&i.getTextContent().slice(0,a)+r+i.getTextContent().slice(a+l)===Af(o.anchorNode)||AA(t,_H,r);let u=r.length;kA&&u>1&&"insertCompositionText"===e.inputType&&!t.isComposing()&&(n.anchor.offset-=u),kD&&t.isComposing()&&(Sk=0,E9(null))}else Ap(!1,t,null!==r?r:void 0),SP&&(SK(t,r||void 0),SP=!1);return Ei(),kZ(Ea()),!0}function SW(e){let t=Ea(),n=CY();if(CD(n)&&!t.isComposing()){let r=n.anchor,i=n.anchor.getNode();E9(r.key),AP(S9),(e.timeStamp<Sk+30||"element"===r.type||!n.isCollapsed()||i.getFormat()!==n.format||C_(i)&&i.getStyle()!==n.style)&&AA(t,_H,kO)}return!0}function SH(e){return SK(Ea(),e.data),AP(S7),!0}function SK(e,t){let n=e._compositionKey;if(E9(null),null!==n&&null!=t){if(""===t){let t=Ae(n),r=E5(e.getElementByKey(n));if(null!==r&&null!==r.nodeValue&&C_(t)){let n=A$(AR(e)),i=null,o=null;null!==n&&n.anchorNode===r&&(i=n.anchorOffset,o=n.focusOffset),Am(t,r.nodeValue,i,o,!0)}return}if("\n"===t[t.length-1]){let t=CY();if(CD(t)||CL(t)){if(CD(t)){let e=t.focus;t.anchor.set(e.key,e.offset,e.type)}return void AA(e,_6,null)}}}Ap(!0,e,t)}function SG(e){let t=Ea();if(null==e.key)return!0;if(SM){if(Aw(e))return Ex(t,()=>{SK(t,SD)}),SM=!1,SD="",!0;SM=!1,SD=""}if(Av(e,"ArrowRight",{shiftKey:"any"}))AA(t,_0,e);else if(Av(e,"ArrowRight",Ax))AA(t,_1,e);else if(Av(e,"ArrowLeft",{shiftKey:"any"}))AA(t,_2,e);else if(Av(e,"ArrowLeft",Ax))AA(t,_5,e);else if(Av(e,"ArrowUp",{altKey:"any",shiftKey:"any"}))AA(t,_3,e);else if(Av(e,"ArrowDown",{altKey:"any",shiftKey:"any"}))AA(t,_4,e);else if(Av(e,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any",shiftKey:!0}))Sj=!0,AA(t,_6,e);else if(" "===e.key)AA(t,_8,e);else if(kE&&Av(e,"o",{ctrlKey:!0}))e.preventDefault(),Sj=!0,AA(t,_V,!0);else if(Av(e,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any"}))Sj=!1,AA(t,_6,e);else if(Av(e,"Backspace",{shiftKey:"any"})||kE&&Av(e,"h",{ctrlKey:!0}))Aw(e)?AA(t,_9,e):(e.preventDefault(),AA(t,_U,!0));else if("Escape"===e.key)AA(t,_7,e);else if(Av(e,"Delete",{})||kE&&Av(e,"d",{ctrlKey:!0}))"Delete"!==e.key?(e.preventDefault(),AA(t,_U,!1)):AA(t,Se,e);else if(Av(e,"Backspace",Ab))e.preventDefault(),AA(t,_q,!0);else if(Av(e,"Delete",Ab))e.preventDefault(),AA(t,_q,!1);else if(kE&&Av(e,"Backspace",{metaKey:!0}))e.preventDefault(),AA(t,_J,!0);else if(kE&&(Av(e,"Delete",{metaKey:!0})||Av(e,"k",{ctrlKey:!0})))e.preventDefault(),AA(t,_J,!1);else if(Av(e,"b",Ax))e.preventDefault(),AA(t,_Y,"bold");else if(Av(e,"u",Ax))e.preventDefault(),AA(t,_Y,"underline");else if(Av(e,"i",Ax))e.preventDefault(),AA(t,_Y,"italic");else if(Av(e,"Tab",{shiftKey:"any"}))AA(t,St,e);else if(Av(e,"z",Ax))e.preventDefault(),AA(t,_X,void 0);else if(kE?Av(e,"z",{metaKey:!0,shiftKey:!0}):Av(e,"y",{ctrlKey:!0})||Av(e,"z",{ctrlKey:!0,shiftKey:!0}))e.preventDefault(),AA(t,_Z,void 0);else{let n=t._editorState._selection;null===n||CD(n)?Av(e,"a",Ax)&&(e.preventDefault(),AA(t,Sh,e)):Av(e,"c",Ax)?(e.preventDefault(),AA(t,Sc,e)):Av(e,"x",Ax)?(e.preventDefault(),AA(t,Sd,e)):Av(e,"a",Ax)&&(e.preventDefault(),AA(t,Sh,e))}return(e.ctrlKey||e.shiftKey||e.altKey||e.metaKey)&&t.dispatchCommand(Sx,e),!0}function Sq(e){let t=e.__lexicalEventHandles;return void 0===t&&(e.__lexicalEventHandles=t=[]),t}let SJ=new Map;function SY(e){let t,n=(t=AD(e.target))?t.getSelection():null;if(null===n)return;let r=EX(n.anchorNode);if(null===r)return;SN&&(SN=!1,Ex(r,()=>{let t=CX(),i=n.anchorNode;(AU(i)||E1(i))&&Al(CJ(t,n,r,e))}));let i=Ad(r),o=i[i.length-1],s=o._key,a=SJ.get(s),l=a||o;l!==r&&SF(n,l,!1),SF(n,r,!0),r!==o?SJ.set(s,r):a&&SJ.delete(s)}function SX(e){e._lexicalHandled=!0}function SZ(e){return!0===e._lexicalHandled}let SQ=()=>{};function S0(e,t,n){Ei();let r=e.__key,i=e.getParent();if(null===i)return;let o=function(e){let t=CY();if(!CD(t)||!E_(e))return t;let{anchor:n,focus:r}=t,i=n.getNode(),o=r.getNode();return AM(i,e)&&n.set(e.__key,0,"element"),AM(o,e)&&r.set(e.__key,0,"element"),t}(e),s=!1;if(CD(o)&&t){let t=o.anchor,n=o.focus;t.key===r&&(C0(t,e,i,e.getPreviousSibling(),e.getNextSibling()),s=!0),n.key===r&&(C0(n,e,i,e.getPreviousSibling(),e.getNextSibling()),s=!0)}else CL(o)&&t&&e.isSelected()&&e.selectPrevious();if(CD(o)&&t&&!s){let t=e.getIndexWithinParent();E6(e),CZ(o,i,t,-1)}else E6(e);n||AL(i)||i.canBeEmpty()||!i.isEmpty()||S0(i,t),t&&o&&ET(i)&&i.isEmpty()&&i.selectEnd()}let S1=Symbol.for("ephemeral");function S2(e){return e[S1]||!1}class S5{__type;__key;__parent;__prev;__next;__state;static getType(){let{ownNodeType:e}=A2(this);return void 0===e&&kk(64,this.name),e}static clone(e){kk(65,this.name)}$config(){return{}}config(e,t){let n=t.extends||Object.getPrototypeOf(this.constructor);return Object.assign(t,{extends:n,type:e}),{[e]:t}}afterCloneFrom(e){this.__key===e.__key?(this.__parent=e.__parent,this.__next=e.__next,this.__prev=e.__prev,this.__state=e.__state):e.__state&&(this.__state=e.__state.getWritable(this))}resetOnCopyNodeFrom(e){this.__state&&(this.__state=this.__state.getWritable(this).resetOnCopyNode())}static importDOM;constructor(e){this.__type=this.constructor.getType(),this.__parent=null,this.__prev=null,this.__next=null,Object.defineProperty(this,"__state",{configurable:!0,enumerable:!1,value:void 0,writable:!0}),E4(this,e)}getType(){return this.__type}isInline(){kk(137,this.constructor.name)}isAttached(){let e=this.__key;for(;null!==e;){if("root"===e)return!0;let t=Ae(e);if(null===t)break;e=t.__parent}return!1}isSelected(e){let t=e||CY();if(null==t)return!1;let n=t.getNodes().some(e=>e.__key===this.__key);if(C_(this))return n;if(CD(t)&&"element"===t.anchor.type&&"element"===t.focus.type){if(t.isCollapsed())return!1;let e=this.getParent();if(EE(this)&&this.isInline()&&e){let n=t.isBackward()?t.focus:t.anchor;if(e.is(n.getNode())&&n.offset===e.getChildrenSize()&&this.is(e.getLastChild()))return!1}}return n}getKey(){return this.__key}getIndexWithinParent(){let e=this.getParent();if(null===e)return -1;let t=e.getFirstChild(),n=0;for(;null!==t;){if(this.is(t))return n;n++,t=t.getNextSibling()}return -1}getParent(){let e=this.getLatest().__parent;return null===e?null:Ae(e)}getParentOrThrow(){let e=this.getParent();return null===e&&kk(66,this.__key),e}getTopLevelElement(){let e=this;for(;null!==e;){let t=e.getParent();if(AL(t))return E_(e)||e===this&&EE(e)||kk(194),e;e=t}return null}getTopLevelElementOrThrow(){let e=this.getTopLevelElement();return null===e&&kk(67,this.__key),e}getParents(){let e=[],t=this.getParent();for(;null!==t;)e.push(t),t=t.getParent();return e}getParentKeys(){let e=[],t=this.getParent();for(;null!==t;)e.push(t.__key),t=t.getParent();return e}getPreviousSibling(){let e=this.getLatest().__prev;return null===e?null:Ae(e)}getPreviousSiblings(){let e=[],t=this.getParent();if(null===t)return e;let n=t.getFirstChild();for(;null!==n&&!n.is(this);)e.push(n),n=n.getNextSibling();return e}getNextSibling(){let e=this.getLatest().__next;return null===e?null:Ae(e)}getNextSiblings(){let e=[],t=this.getNextSibling();for(;null!==t;)e.push(t),t=t.getNextSibling();return e}getCommonAncestor(e){let t=E_(this)?this:this.getParent(),n=E_(e)?e:e.getParent(),r=t&&n?Tw(t,n):null;return r?r.commonAncestor:null}is(e){return null!=e&&this.__key===e.__key}isBefore(e){let t=Tw(this,e);return null!==t&&("descendant"===t.type||("branch"===t.type?-1===Tx(t):("same"!==t.type&&"ancestor"!==t.type&&kk(279),!1)))}isParentOf(e){let t=Tw(this,e);return null!==t&&"ancestor"===t.type}getNodesBetween(e){let t=this.isBefore(e),n=[],r=new Set,i=this;for(;null!==i;){let o=i.__key;if(r.has(o)||(r.add(o),n.push(i)),i===e)break;let s=E_(i)?t?i.getFirstChild():i.getLastChild():null;if(null!==s){i=s;continue}let a=t?i.getNextSibling():i.getPreviousSibling();if(null!==a){i=a;continue}let l=i.getParentOrThrow();if(r.has(l.__key)||n.push(l),l===e)break;let u=null,c=l;do{if(null===c&&kk(68),u=t?c.getNextSibling():c.getPreviousSibling(),null===(c=c.getParent()))break;null!==u||r.has(c.__key)||n.push(c)}while(null===u)i=u}return t||n.reverse(),n}isDirty(){let e=Ea()._dirtyLeaves;return null!==e&&e.has(this.__key)}getLatest(){if(S2(this))return this;let e=Ae(this.__key);return null===e&&kk(113),e}getWritable(){if(S2(this))return this;Ei();let e=Es(),t=Ea(),n=e._nodeMap,r=this.__key,i=this.getLatest(),o=t._cloneNotNeeded,s=CY();if(null!==s&&s.setCachedNodes(null),o.has(r))return E8(i),i;let a=AQ(i);return o.add(r),E8(a),n.set(r,a),a}getTextContent(){return""}getTextContentSize(){return this.getTextContent().length}createDOM(e,t){kk(70)}updateDOM(e,t,n){kk(71)}exportDOM(e){return{element:this.createDOM(e._config,e)}}exportJSON(){let e=this.__state?this.__state.toJSON():void 0;return{type:this.__type,version:1,...e}}static importJSON(e){kk(18,this.name)}updateFromJSON(e){return function(e,t){let n=e.getWritable(),r=t.$,i=r;for(let e of k5(n).flatKeys)e in t&&(void 0!==i&&i!==r||(i={...r}),i[e]=t[e]);return(n.__state||i)&&k2(e).updateFromJSON(i),n}(this,e)}static transform(){return null}remove(e){S0(this,!0,e)}replace(e,t){Ei();let n=CY();null!==n&&(n=n.clone()),AF(this,e);let r=this.getLatest(),i=this.__key,o=e.__key,s=e.getWritable(),a=this.getParentOrThrow().getWritable(),l=a.__size;E6(s);let u=r.getPreviousSibling(),c=r.getNextSibling(),d=r.__prev,h=r.__next,f=r.__parent;if((S0(r,!1,!0),null===u)?a.__first=o:u.getWritable().__next=o,(s.__prev=d,null===c)?a.__last=o:c.getWritable().__prev=o,s.__next=h,s.__parent=f,a.__size=l,t&&(E_(this)&&E_(s)||kk(139),this.getChildren().forEach(e=>{s.append(e)})),CD(n)){Al(n);let e=n.anchor,t=n.focus;e.key===i&&CP(e,s),t.key===i&&CP(t,s)}return E7()===i&&E9(o),s}insertAfter(e,t=!0){Ei(),AF(this,e);let n=this.getWritable(),r=e.getWritable(),i=r.getParent(),o=CY(),s=!1,a=!1;if(null!==i){let t=e.getIndexWithinParent();if(E6(r),CD(o)){let e=i.__key,n=o.anchor,r=o.focus;s="element"===n.type&&n.key===e&&n.offset===t+1,a="element"===r.type&&r.key===e&&r.offset===t+1}}let l=this.getNextSibling(),u=this.getParentOrThrow().getWritable(),c=r.__key,d=n.__next;if(null===l?u.__last=c:l.getWritable().__prev=c,u.__size++,n.__next=c,r.__next=d,r.__prev=n.__key,r.__parent=n.__parent,t&&CD(o)){let e=this.getIndexWithinParent();CZ(o,u,e+1);let t=u.__key;s&&o.anchor.set(t,e+2,"element"),a&&o.focus.set(t,e+2,"element")}return e}insertBefore(e,t=!0){Ei(),AF(this,e);let n=this.getWritable(),r=e.getWritable(),i=r.__key;E6(r);let o=this.getPreviousSibling(),s=this.getParentOrThrow().getWritable(),a=n.__prev,l=this.getIndexWithinParent();null===o?s.__first=i:o.getWritable().__next=i,s.__size++,n.__prev=i,r.__prev=a,r.__next=n.__key,r.__parent=n.__parent;let u=CY();return t&&CD(u)&&CZ(u,this.getParentOrThrow(),l),e}isParentRequired(){return!1}createParentElementNode(){return EL()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(e,t){Ei();let n=this.getPreviousSibling(),r=this.getParentOrThrow();if(null===n)return r.select(0,0);if(E_(n))return n.select();if(!C_(n)){let e=n.getIndexWithinParent()+1;return r.select(e,e)}return n.select(e,t)}selectNext(e,t){Ei();let n=this.getNextSibling(),r=this.getParentOrThrow();if(null===n)return r.select();if(E_(n))return n.select(0,0);if(!C_(n)){let e=n.getIndexWithinParent();return r.select(e,e)}return n.select(e,t)}markDirty(){this.getWritable()}reconcileObservedMutation(e,t){this.markDirty()}}function S3(e){return e instanceof S5}let S4="historic",S6="history-merge",S8="skip-selection-focus",S9="composition-start",S7="composition-end",Ce=/\s*!important\s*$/i;function Ct(e){let t={};if(!e)return t;let n="",r="",i=null,o=!1,s=!1,a=!1,l=0;for(let u=0;u<e.length;u++){let c=e[u];if(o)"*"===c&&"/"===e[u+1]&&(o=!1,u++);else if(s)a?r+=c:n+=c,s=!1;else if(null===i)if("/"!==c||"*"!==e[u+1])if('"'!==c&&"'"!==c)if("("!==c)if(")"!==c)if(a||":"!==c||0!==l){if(";"===c&&0===l){let e=n.trim(),i=r.trim();""!==e&&""!==i&&(t[e]=i),n="",r="",a=!1;continue}a?r+=c:n+=c}else a=!0;else l=Math.max(0,l-1),a?r+=c:n+=c;else l++,a?r+=c:n+=c;else i=c,a?r+=c:n+=c;else o=!0,u++;else a?r+=c:n+=c,"\\"===c?s=!0:c===i&&(i=null)}let u=n.trim(),c=r.trim();return""!==u&&""!==c&&(t[u]=c),t}function Cn(e,t,n=""){if(t===n)return;let r=Ct(n),i=Ct(t);for(let t in i)delete r[t],function(e,t,n){let r=Ce.test(n)?"important":"",i=""===r?n:n.replace(Ce,"").trim();e.setProperty(t,i,r)}(e,t,i[t]);for(let t in r)e.removeProperty(t)}class Cr extends S5{static getType(){return"linebreak"}static clone(e){return new Cr(e.__key)}constructor(e){super(e)}getTextContent(){return"\n"}createDOM(){return document.createElement("br")}updateDOM(){return!1}isInline(){return!0}static importDOM(){return{br:e=>(function(e){let t=e.parentElement;if(null!==t&&AK(t)){let n=t.firstChild;if(n===e||n.nextSibling===e&&Ca(n)){let n=t.lastChild;if(n===e||n.previousSibling===e&&Ca(n))return!0}}return!1})(e)||function(e){let t=e.parentElement;if(null!==t&&AK(t)){let n=t.firstChild;if(n===e||n.nextSibling===e&&Ca(n))return!1;let r=t.lastChild;if(r===e||r.previousSibling===e&&Ca(r))return!0}return!1}(e)?null:{conversion:Ci,priority:0}}}static importJSON(e){return Co().updateFromJSON(e)}}function Ci(e){return{node:Co()}}function Co(){return AI(new Cr)}function Cs(e){return e instanceof Cr}function Ca(e){return E1(e)&&/^( |\t|\r?\n)+$/.test(e.textContent||"")}function Cl(e,t){return 16&t?"code":128&t?"mark":32&t?"sub":64&t?"sup":null}function Cu(e,t){return 1&t?"strong":2&t?"em":"span"}function Cc(e,t,n,r,i){let o=r.classList,s=Ak(i,"base");void 0!==s&&o.add(...s);let a=!1,l=8&t&&4&t;for(let e in void 0!==(s=Ak(i,"underlineStrikethrough"))&&(8&n&&4&n?(a=!0,l||o.add(...s)):l&&o.remove(...s)),kz){let r=kz[e];if(void 0!==(s=Ak(i,e)))if(n&r){if(a&&("underline"===e||"strikethrough"===e)){t&r&&o.remove(...s);continue}(0==(t&r)||l&&"underline"===e||"strikethrough"===e)&&o.add(...s)}else t&r&&o.remove(...s)}}function Cd(e,t,n){let r=t.firstChild,i=n.isComposing(),o=e+(i?kL:"");if(null==r)t.textContent=o;else{let e=r.nodeValue;if(e!==o)if(i||kA){let[t,n,i]=function(e,t){let n=e.length,r=t.length,i=0,o=0;for(;i<n&&i<r&&e[i]===t[i];)i++;for(;o+i<n&&o+i<r&&e[n-o-1]===t[r-o-1];)o++;return[i,n-i-o,t.slice(i,r-o)]}(e,o);0!==n&&r.deleteData(t,n),r.insertData(t,i)}else r.nodeValue=o}}function Ch(e,t,n,r,i,o){Cd(i,e,t);let s=o.theme.text;void 0!==s&&Cc(0,0,r,e,s)}function Cf(e,t){let n=document.createElement(t);return n.appendChild(e),n}class Cp extends S5{__text;__format;__style;__mode;__detail;static getType(){return"text"}static clone(e){return new Cp(e.__text,e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__text=e.__text,this.__format=e.__format,this.__style=e.__style,this.__mode=e.__mode,this.__detail=e.__detail}constructor(e="",t){super(t),this.__text=e,this.__format=0,this.__style="",this.__mode=0,this.__detail=0}getFormat(){return this.getLatest().__format}getDetail(){return this.getLatest().__detail}getMode(){return kW[this.getLatest().__mode]}getStyle(){return this.getLatest().__style}isToken(){return 1===this.getLatest().__mode}isComposing(){return this.__key===E7()}isSegmented(){return 2===this.getLatest().__mode}isDirectionless(){return!!(1&this.getLatest().__detail)}isUnmergeable(){return!!(2&this.getLatest().__detail)}hasFormat(e){let t=kz[e];return 0!=(this.getFormat()&t)}isSimpleText(){return"text"===this.__type&&0===this.__mode}getTextContent(){return this.getLatest().__text}getFormatFlags(e,t){return E3(this.getLatest().__format,e,t)}canHaveFormat(){return!0}isInline(){return!0}createDOM(e,t){let n=this.__format,r=Cl(0,n),i=Cu(0,n),o=null===r?i:r,s=document.createElement(o),a=s;this.hasFormat("code")&&s.setAttribute("spellcheck","false"),null!==r&&(a=document.createElement(i),s.appendChild(a)),Ch(a,this,0,n,this.__text,e);let l=this.__style;return""!==l&&Cn(s.style,l),s}updateDOM(e,t,n){let r=this.__text,i=e.__format,o=this.__format,s=Cl(0,i),a=Cl(0,o),l=Cu(0,i),u=Cu(0,o);if((null===s?l:s)!==(null===a?u:a))return!0;if(s===a&&l!==u){let e=t.firstChild;null==e&&kk(48);let i=document.createElement(u);return Ch(i,this,0,o,r,n),t.replaceChild(i,e),!1}let c=t;null!==a&&null!==s&&null==(c=t.firstChild)&&kk(49),Cd(r,c,this);let d=n.theme.text;void 0!==d&&i!==o&&Cc(0,i,o,c,d);let h=e.__style,f=this.__style;return h!==f&&Cn(t.style,f,h),!1}static importDOM(){return{"#text":()=>({conversion:Cv,priority:0}),b:()=>({conversion:Cg,priority:0}),code:()=>({conversion:Cw,priority:0}),em:()=>({conversion:Cw,priority:0}),i:()=>({conversion:Cw,priority:0}),mark:()=>({conversion:Cw,priority:0}),s:()=>({conversion:Cw,priority:0}),span:()=>({conversion:Cm,priority:0}),strong:()=>({conversion:Cw,priority:0}),sub:()=>({conversion:Cw,priority:0}),sup:()=>({conversion:Cw,priority:0}),u:()=>({conversion:Cw,priority:0})}}static importJSON(e){return Ck().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setTextContent(e.text).setFormat(e.format).setDetail(e.detail).setMode(e.mode).setStyle(e.style)}exportDOM(e){let{element:t}=super.exportDOM(e);return AU(t)||kk(132),t.style.whiteSpace="pre-wrap",this.hasFormat("lowercase")?t.style.textTransform="lowercase":this.hasFormat("uppercase")?t.style.textTransform="uppercase":this.hasFormat("capitalize")&&(t.style.textTransform="capitalize"),this.hasFormat("bold")&&(t=Cf(t,"b")),this.hasFormat("italic")&&(t=Cf(t,"i")),this.hasFormat("strikethrough")&&(t=Cf(t,"s")),this.hasFormat("underline")&&(t=Cf(t,"u")),{element:t}}exportJSON(){return{detail:this.getDetail(),format:this.getFormat(),mode:this.getMode(),style:this.getStyle(),text:this.getTextContent(),...super.exportJSON()}}selectionTransform(e,t){}setFormat(e){let t=this.getWritable();return t.__format="string"==typeof e?kz[e]:e,t}setDetail(e){let t=this.getWritable();return t.__detail="string"==typeof e?kB[e]:e,t}setStyle(e){let t=this.getWritable();return t.__style=e,t}toggleFormat(e){let t=E3(this.getFormat(),e,null);return this.setFormat(t)}toggleDirectionless(){let e=this.getWritable();return e.__detail^=1,e}toggleUnmergeable(){let e=this.getWritable();return e.__detail^=2,e}setMode(e){let t=kV[e];if(this.__mode===t)return this;let n=this.getWritable();return n.__mode=t,n}setTextContent(e){if(this.__text===e)return this;let t=this.getWritable();return t.__text=e,t}select(e,t){Ei();let n=e,r=t,i=CY(),o=this.getTextContent(),s=this.__key;if("string"==typeof o){let e=o.length;void 0===n&&(n=e),void 0===r&&(r=e)}else n=0,r=0;if(!CD(i))return CK(s,n,s,r,"text","text");{let e=E7();e!==i.anchor.key&&e!==i.focus.key||E9(s),i.setTextNodeRange(this,n,this,r)}return i}selectStart(){return this.select(0,0)}selectEnd(){let e=this.getTextContentSize();return this.select(e,e)}spliceText(e,t,n,r){let i=this.getWritable(),o=i.__text,s=n.length,a=e;a<0&&(a=s+a)<0&&(a=0);let l=CY();if(r&&CD(l)){let t=e+s;l.setTextNodeRange(i,t,i,t)}return i.__text=o.slice(0,a)+n+o.slice(a+t),i}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...e){let t;Ei();let n=this.getLatest(),r=n.getTextContent();if(""===r)return[];let i=n.__key,o=E7(),s=r.length;e.sort((e,t)=>e-t),e.push(s);let a=[],l=e.length;for(let t=0,n=0;t<s&&n<=l;n++){let i=e[n];i>t&&(a.push(r.slice(t,i)),t=i)}let u=a.length;if(1===u)return[n];let c=a[0],d=n.getParent(),h=n.getFormat(),f=n.getStyle(),p=n.__detail,m=!1,g=null,y=null,v=CY();if(CD(v)){let[e,t]=v.isBackward()?[v.focus,v.anchor]:[v.anchor,v.focus];"text"===e.type&&e.key===i&&(g=e),"text"===t.type&&t.key===i&&(y=t)}n.isSegmented()?((t=Ck(c)).__format=h,t.__style=f,t.__detail=p,t.__state=k9(n,t),m=!0):t=n.setTextContent(c);let x=[t];for(let e=1;e<u;e++){let t=Ck(a[e]);t.__format=h,t.__style=f,t.__detail=p,t.__state=k9(n,t);let r=t.__key;o===i&&E9(r),x.push(t)}let b=g?g.offset:null,w=y?y.offset:null,k=0;for(let e of x){if(!g&&!y)break;let t=k+e.getTextContentSize();if(null!==g&&null!==b&&b<=t&&b>=k&&(g.set(e.getKey(),b-k,"text"),b<t&&(g=null)),null!==y&&null!==w&&w<=t&&w>=k){y.set(e.getKey(),w-k,"text");break}k=t}if(null!==d){let e,t;e=this.getPreviousSibling(),t=this.getNextSibling(),null!==e&&E8(e),null!==t&&E8(t);let n=d.getWritable(),r=this.getIndexWithinParent();m?(n.splice(r,0,x),this.remove()):n.splice(r,1,x),CD(v)&&CZ(v,d,r,u-1)}return x}mergeWithSibling(e){let t=e===this.getPreviousSibling();t||e===this.getNextSibling()||kk(50);let n=this.__key,r=e.__key,i=this.__text,o=i.length;E7()===r&&E9(n);let s=CY();if(CD(s)){let i=s.anchor,a=s.focus;null!==i&&i.key===r&&C1(i,t,n,e,o),null!==a&&a.key===r&&C1(a,t,n,e,o)}let a=e.__text,l=t?a+i:i+a;this.setTextContent(l);let u=this.getWritable();return e.remove(),u}isTextEntity(){return!1}}function Cm(e){return{forChild:CS(e.style),node:null}}function Cg(e){let t="normal"===e.style.fontWeight;return{forChild:CS(e.style,t?void 0:"bold"),node:null}}let Cy=new WeakMap;function Cv(e){null===e.parentElement&&kk(129);let t=e.textContent||"";if(null!==function(e){let t,n=e.parentNode,r=[e];for(;null!==n&&void 0===(t=Cy.get(n))&&!function(e){if(!AU(e))return!1;if("PRE"===e.nodeName)return!0;let t=e.style.whiteSpace;return"string"==typeof t&&t.startsWith("pre")}(n);)r.push(n),n=n.parentNode;let i=void 0===t?n:t;for(let e=0;e<r.length;e++)Cy.set(r[e],i);return i}(e)){let e=t.split(/(\r?\n|\t)/),n=[],r=e.length;for(let t=0;t<r;t++){let r=e[t];"\n"===r||"\r\n"===r?n.push(Co()):" "===r?n.push(CE()):""!==r&&n.push(Ck(r))}return{node:n}}if(""===(t=t.replace(/\r/g,"").replace(/[ \t\n]+/g," ")))return{node:null};if(" "===t[0]){let n=e,r=!0;for(;null!==n&&null!==(n=Cx(n,!1));){let e=n.textContent||"";if(e.length>0){/[ \t\n]$/.test(e)&&(t=t.slice(1)),r=!1;break}}r&&(t=t.slice(1))}if(" "===t[t.length-1]){let n=e,r=!0;for(;null!==n&&null!==(n=Cx(n,!0));)if((n.textContent||"").replace(/^( |\t|\r?\n)+/,"").length>0){r=!1;break}r&&(t=t.slice(0,t.length-1))}return""===t?{node:null}:{node:Ck(t)}}function Cx(e,t){let n=e;for(;;){let e;for(;null===(e=t?n.nextSibling:n.previousSibling);){let e=n.parentElement;if(null===e)return null;n=e}if(AU(n=e)){let e=n.style.display;if(""===e&&!AH(n)||""!==e&&!e.startsWith("inline"))return null}let r=n;for(;null!==(r=t?n.firstChild:n.lastChild);)n=r;if(E1(n))return n;if("BR"===n.nodeName)return null}}let Cb={code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};function Cw(e){let t=Cb[e.nodeName.toLowerCase()];return void 0===t?{node:null}:{forChild:CS(e.style,t),node:null}}function Ck(e=""){return AI(new Cp(e))}function C_(e){return e instanceof Cp}function CS(e,t){let n=e.fontWeight,r=e.textDecoration.split(" "),i="700"===n||"bold"===n,o=r.includes("line-through"),s="italic"===e.fontStyle,a=r.includes("underline"),l=e.verticalAlign;return e=>(C_(e)&&(i&&!e.hasFormat("bold")&&e.toggleFormat("bold"),o&&!e.hasFormat("strikethrough")&&e.toggleFormat("strikethrough"),s&&!e.hasFormat("italic")&&e.toggleFormat("italic"),a&&!e.hasFormat("underline")&&e.toggleFormat("underline"),"sub"!==l||e.hasFormat("subscript")||e.toggleFormat("subscript"),"super"!==l||e.hasFormat("superscript")||e.toggleFormat("superscript"),t&&!e.hasFormat(t)&&e.toggleFormat(t)),e)}class CC extends Cp{static getType(){return"tab"}static clone(e){return new CC(e.__key)}constructor(e){super(" ",e),this.__detail=2}static importDOM(){return null}createDOM(e){let t=super.createDOM(e),n=Ak(e.theme,"tab");return void 0!==n&&t.classList.add(...n),t}static importJSON(e){return CE().updateFromJSON(e)}setTextContent(e){return" "!==e&&""!==e&&k_(126),super.setTextContent(" ")}spliceText(e,t,n,r){return""===n&&0===t||" "===n&&1===t||kk(286),this}setDetail(e){return 2!==e&&kk(127),this}setMode(e){return"normal"!==e&&kk(128),this}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}}function CE(){return AI(new CC)}function CA(e){return e instanceof CC}class CT{key;offset;type;_selection;constructor(e,t,n){this._selection=null,this.key=e,this.offset=t,this.type=n}is(e){return this.key===e.key&&this.offset===e.offset&&this.type===e.type}isBefore(e){return this.key===e.key?this.offset<e.offset:0>Tv(Tj(Tk(this,"next")),Tj(Tk(e,"next")))}getNode(){let e=Ae(this.key);return null===e&&kk(20),e}set(e,t,n,r){let i=this._selection,o=this.key;r&&this.key===e&&this.offset===t&&this.type===n||(this.key=e,this.offset=t,this.type=n,Er()||(E7()===o&&E9(e),null!==i&&(i.setCachedNodes(null),i.dirty=!0)))}}function CN(e,t,n){return new CT(e,t,n)}function Cj(e,t){let n=t.__key,r=e.offset,i="element";if(C_(t)){i="text";let e=t.getTextContentSize();r>e&&(r=e)}else if(!E_(t)){let e=t.getNextSibling();if(C_(e))n=e.__key,r=0,i="text";else{let e=t.getParent();e&&(n=e.__key,r=t.getIndexWithinParent()+1)}}e.set(n,r,i)}function CP(e,t){if(E_(t)){let n=t.getLastDescendant();E_(n)||C_(n)?Cj(e,n):Cj(e,t)}else Cj(e,t)}class CM{_nodes;_cachedNodes;dirty;constructor(e){this._cachedNodes=null,this._nodes=e,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){if(!CL(e))return!1;let t=this._nodes,n=e._nodes;return t.size===n.size&&Array.from(t).every(e=>n.has(e))}isCollapsed(){return!1}isBackward(){return!1}getStartEndPoints(){return null}add(e){this.dirty=!0,this._nodes.add(e),this._cachedNodes=null}delete(e){this.dirty=!0,this._nodes.delete(e),this._cachedNodes=null}clear(){this.dirty=!0,this._nodes.clear(),this._cachedNodes=null}has(e){return this._nodes.has(e)}clone(){return new CM(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(e){}insertText(){}insertNodes(e){let t,n=this.getNodes(),r=n.length,i=n[r-1];if(C_(i))t=i.select();else{let e=i.getIndexWithinParent()+1;t=i.getParentOrThrow().select(e,e)}t.insertNodes(e);for(let e=0;e<r;e++)n[e].remove()}getNodes(){let e=this._cachedNodes;if(null!==e)return e;let t=this._nodes,n=[];for(let e of t){let t=Ae(e);null!==t&&n.push(t)}return Er()||(this._cachedNodes=n),n}getTextContent(){let e=this.getNodes(),t="";for(let n=0;n<e.length;n++)t+=e[n].getTextContent();return t}deleteNodes(){let e=this.getNodes();if((CY()||CX())===this&&e[0]){let t=Tl(e[0],"next");TS(Tg(t,t))}for(let t of e)t.remove()}}function CD(e){return e instanceof CR}class CR{format;style;anchor;focus;_cachedNodes;dirty;constructor(e,t,n,r){this.anchor=e,this.focus=t,e._selection=this,t._selection=this,this._cachedNodes=null,this.format=n,this.style=r,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){return!!CD(e)&&this.anchor.is(e.anchor)&&this.focus.is(e.focus)&&this.format===e.format&&this.style===e.style}isCollapsed(){return this.anchor.is(this.focus)}getNodes(){let e=this._cachedNodes;if(null!==e)return e;let t=function(e){let t=[],[n,r]=e.getTextSlices();n&&t.push(n.caret.origin);let i=new Set,o=new Set;for(let n of e)if(Ti(n)){let{origin:e}=n;0===t.length?i.add(e):(o.add(e),t.push(e))}else{let{origin:e}=n;E_(e)&&o.has(e)||t.push(e)}if(r&&t.push(r.caret.origin),Tr(e.focus)&&E_(e.focus.origin)&&null===e.focus.getNodeAtCaret())for(let n=Td(e.focus.origin,"previous");Ti(n)&&i.has(n.origin)&&!n.origin.isEmpty()&&n.origin.is(t[t.length-1]);n=Th(n))i.delete(n.origin),t.pop();for(;t.length>1;){let e=t[t.length-1];if(!E_(e)||o.has(e)||e.isEmpty()||i.has(e))break;t.pop()}if(0===t.length&&e.isCollapsed()){let n=Tj(e.anchor),r=Tj(e.anchor.getFlipped()),i=e=>Tn(e)?e.origin:e.getNodeAtCaret(),o=i(n)||i(r)||(e.anchor.getNodeAtCaret()?n.origin:r.origin);t.push(o)}return t}(TD(TE(this),"next"));return Er()||(this._cachedNodes=t),t}setTextNodeRange(e,t,n,r){this.anchor.set(e.__key,t,"text"),this.focus.set(n.__key,r,"text")}getTextContent(){let e=this.getNodes();if(0===e.length)return"";let t=e[0],n=e[e.length-1],r=this.anchor,i=this.focus,o=r.isBefore(i),[s,a]=CI(this),l="",u=!0;for(let c=0;c<e.length;c++){let d=e[c];if(E_(d)&&!d.isInline())u||(l+="\n"),u=!d.isEmpty();else if(u=!1,C_(d)){let e=d.getTextContent();d===t?d===n?"element"===r.type&&"element"===i.type&&i.offset!==r.offset||(e=s<a?e.slice(s,a):e.slice(a,s)):e=o?e.slice(s):e.slice(a):d===n&&(e=o?e.slice(0,a):e.slice(0,s)),l+=e}else!EE(d)&&!Cs(d)||d===n&&this.isCollapsed()||(l+=d.getTextContent())}return l}applyDOMRange(e){let t=Ea(),n=t.getEditorState()._selection,r=CW(e.startContainer,e.startOffset,e.endContainer,e.endOffset,t,n);if(null===r)return;let[i,o]=r;this.anchor.set(i.key,i.offset,i.type,!0),this.focus.set(o.key,o.offset,o.type,!0),_n(this)}clone(){let e=this.anchor,t=this.focus;return new CR(CN(e.key,e.offset,e.type),CN(t.key,t.offset,t.type),this.format,this.style)}toggleFormat(e){this.format=E3(this.format,e,null),this.dirty=!0}setFormat(e){this.format=e,this.dirty=!0}setStyle(e){this.style=e,this.dirty=!0}hasFormat(e){let t=kz[e];return 0!=(this.format&t)}insertRawText(e){let t=e.split(/(\r?\n|\t)/),n=[],r=t.length;for(let e=0;e<r;e++){let r=t[e];"\n"===r||"\r\n"===r?n.push(Co()):" "===r?n.push(CE()):n.push(Ck(r))}this.insertNodes(n)}insertText(e){let t=this.anchor,n=this.focus,r=this.format,i=this.style,o=t,s=n;!this.isCollapsed()&&n.isBefore(t)&&(o=n,s=t),"element"===o.type&&function(e,t,n,r){let i=e.getNode(),o=i.getChildAtIndex(e.offset),s=Ck();if(s.setFormat(n),s.setStyle(r),EO(o))o.splice(0,0,[s]);else{let e=ET(i)?EL().append(s):s;null===o?i.append(e):o.insertBefore(e)}e.is(t)&&t.set(s.__key,0,"text"),e.set(s.__key,0,"text")}(o,s,r,i),"element"===s.type&&T_(s,Tj(Tk(s,"next")));let a=o.offset,l=s.offset,u=this.getNodes(),c=u.length,d=u[0];C_(d)||kk(26);let h=d.getTextContent().length,f=d.getParentOrThrow(),p=u[c-1];if(1===c&&"element"===s.type&&(l=h,s.set(o.key,l,"text")),this.isCollapsed()&&a===h&&(E0(d)||!d.canInsertTextAfter()||!f.canInsertTextAfter()&&null===d.getNextSibling())){let t=d.getNextSibling();if(C_(t)&&t.canInsertTextBefore()&&!E0(t)||((t=Ck()).setFormat(r),t.setStyle(i),f.canInsertTextAfter()?d.insertAfter(t):f.insertAfter(t)),t.select(0,0),d=t,""!==e)return void this.insertText(e)}else if(this.isCollapsed()&&0===a&&(E0(d)||!d.canInsertTextBefore()||!f.canInsertTextBefore()&&null===d.getPreviousSibling())){let t=d.getPreviousSibling();if(C_(t)&&!E0(t)||((t=Ck()).setFormat(r),f.canInsertTextBefore()?d.insertBefore(t):f.insertBefore(t)),t.select(),d=t,""!==e)return void this.insertText(e)}else if(d.isSegmented()&&a!==h){let e=Ck(d.getTextContent());e.setFormat(r),d.replace(e),d=e}else if(!this.isCollapsed()&&""!==e){let t=p.getParent();if(!f.canInsertTextBefore()||!f.canInsertTextAfter()||E_(t)&&(!t.canInsertTextBefore()||!t.canInsertTextAfter()))return this.insertText(""),CV(this.anchor,this.focus),void this.insertText(e)}if(1===c){if(EQ(d)){let t=Ck(e);return t.select(),void d.replace(t)}let t=d.getFormat(),n=d.getStyle();if(a!==l||t===r&&n===i){if(CA(d)){let t=Ck(e);return t.setFormat(r),t.setStyle(i),t.select(),void d.replace(t)}}else{if(""!==d.getTextContent()){let t=Ck(e);if(t.setFormat(r),t.setStyle(i),t.select(),0===a)d.insertBefore(t,!1);else{let[e]=d.splitText(a);e.insertAfter(t,!1)}return void(t.isComposing()&&"text"===this.anchor.type&&(this.anchor.offset-=e.length))}d.setFormat(r),d.setStyle(i)}let o=l-a;""===(d=d.spliceText(a,o,e,!0)).getTextContent()?d.remove():"text"===this.anchor.type&&(this.format=t,this.style=n,d.isComposing()&&(this.anchor.offset-=e.length))}else{let t=new Set([...d.getParentKeys(),...p.getParentKeys()]),n=E_(d)?d:d.getParentOrThrow(),r=E_(p)?p:p.getParentOrThrow(),i=p;if(!n.is(r)&&r.isInline())do i=r,r=r.getParentOrThrow();while(r.isInline())if("text"===s.type&&(0!==l||""===p.getTextContent())||"element"===s.type&&p.getIndexWithinParent()<l)if(C_(p)&&!EQ(p)&&l!==p.getTextContentSize()){if(p.isSegmented()){let e=Ck(p.getTextContent());p.replace(e),p=e}ET(s.getNode())||"text"!==s.type||(p=p.spliceText(0,l,"")),t.add(p.__key)}else{let e=p.getParentOrThrow();e.canBeEmpty()||1!==e.getChildrenSize()?p.remove():e.remove()}else t.add(p.__key);let o=r.getChildren(),f=new Set(u),m=n.is(r),g=n.isInline()&&null===d.getNextSibling()?n:d;for(let e=o.length-1;e>=0;e--){let t=o[e];if(t.is(d)||E_(t)&&t.isParentOf(d))break;t.isAttached()&&(!f.has(t)||t.is(i)?m||g.insertAfter(t,!1):t.remove())}if(!m){let e=r,n=null;for(;null!==e;){let r=e.getChildren(),i=r.length;(0===i||r[i-1].is(n))&&(t.delete(e.__key),n=e),e=e.getParent()}}if(EQ(d))if(a===h)d.select();else{let t=Ck(e);t.select(),d.replace(t)}else""===(d=d.spliceText(a,h-a,e,!0)).getTextContent()?d.remove():"text"===this.anchor.type&&(this.format=d.getFormat(),this.style=d.getStyle(),d.isComposing()&&(this.anchor.offset-=e.length));for(let e=1;e<c;e++){let n=u[e],r=n.__key;t.has(r)||n.remove()}}}removeText(){let e=CY()===this;TC(this,function(e,t="removeEmptySlices"){let n,r;if(e.isCollapsed())return e;let i="root",o="next",s=t,a=TD(e,o),l=TT(a.anchor,i),u=TT(a.focus.getFlipped(),i),c=new Set,d=[];for(let e of a.iterNodeCarets(i))if(Ti(e))c.add(e.origin.getKey());else if(Tr(e)){let{origin:t}=e;E_(t)&&!c.has(t.getKey())||d.push(t)}for(let e of d)e.remove();for(let e of a.getTextSlices()){if(!e)continue;let{origin:t}=e.caret,n=t.getTextContentSize(),r=TA(Tl(t,o)),i=t.getMode();if(Math.abs(e.distance)===n&&"removeEmptySlices"===s||"token"===i&&0!==e.distance)r.remove();else if(0!==e.distance){s="removeEmptySlices";let t=e.removeTextSlice(),n=e.caret.origin;if("segmented"===i){let e=t.origin,n=Ck(e.getTextContent()).setStyle(e.getStyle()).setFormat(e.getFormat());r.replaceOrInsert(n),t=Tu(n,o,t.offset)}n.is(l[0].origin)&&(l[0]=t),n.is(u[0].origin)&&(u[0]=t.getFlipped())}}for(let e of l)if(TN(e)){n=Tj(e);break}for(let e of u)if(TN(e)){r=Tj(e);break}let h=function(e,t,n){let r;if(!e||!t)return null;let i=e.getParentAtCaret(),o=t.getParentAtCaret();if(!i||!o)return null;let s=i.getParents().reverse();s.push(i);let a=o.getParents().reverse();a.push(o);let l=Math.min(s.length,a.length);for(r=0;r<l&&s[r]===a[r];r++);let u=(e,t)=>{let n;for(let i=r;i<e.length;i++){let r=e[i];if(AL(r))return;!n&&t(r)&&(n=r)}return n},c=u(s,AG),d=c&&u(a,e=>n.has(e.getKey())&&AG(e));return c&&d?[c,d]:null}(n,r,c);if(h){let[e,t]=h;Td(e,"previous").splice(0,t.getChildren());let n=t.getParent();for(t.remove(!0);n&&n.isEmpty();){let e=n;n=n.getParent(),e.remove(!0)}}let f=[n,r,...l,...u].find(TN);if(f){var p;return Tg(p=TM(Tj(f),e.direction),p)}kk(269,JSON.stringify(l.map(e=>e.origin.__key)))}(TE(this))),e&&CY()!==this&&Al(this)}formatText(e,t=null){if(this.isCollapsed())return this.toggleFormat(e),void E9(null);let n=this.getNodes(),r=[];for(let e of n)C_(e)&&r.push(e);let i=t=>{n.forEach(n=>{if(E_(n)){let r=n.getFormatFlags(e,t);n.setTextFormat(r)}})},o=r.length;if(0===o)return this.toggleFormat(e),E9(null),void i(t);let s=this.anchor,a=this.focus,l=this.isBackward(),u=l?a:s,c=l?s:a,d=0,h=r[0],f="element"===u.type?0:u.offset;if("text"===u.type&&f===h.getTextContentSize()&&(d=1,h=r[1],f=0),null==h)return;let p=h.getFormatFlags(e,t);i(p);let m=o-1,g=r[m],y="text"===c.type?c.offset:g.getTextContentSize();if(h.is(g)){if(f===y)return;if(E0(h)||0===f&&y===h.getTextContentSize())h.setFormat(p);else{let e=h.splitText(f,y),t=0===f?e[0]:e[1];t.setFormat(p),"text"===u.type&&u.set(t.__key,0,"text"),"text"===c.type&&c.set(t.__key,y-f,"text")}return void(this.format=p)}0===f||E0(h)||([,h]=h.splitText(f),f=0),h.setFormat(p);let v=g.getFormatFlags(e,p);y>0&&(y===g.getTextContentSize()||E0(g)||([g]=g.splitText(y)),g.setFormat(v));for(let t=d+1;t<m;t++){let n=r[t],i=n.getFormatFlags(e,v);n.setFormat(i)}"text"===u.type&&u.set(h.__key,f,"text"),"text"===c.type&&c.set(g.__key,y,"text"),this.format=p|v}insertNodes(e){var t;if(0===e.length)return;if(this.isCollapsed()||this.removeText(),"root"===this.anchor.key){this.insertParagraph();let t=CY();return CD(t)||kk(134),t.insertNodes(e)}let n=(this.isBackward()?this.focus:this.anchor).getNode(),r=A5(n,AG),i=e[e.length-1];if(E_(r)&&"__language"in r){if("__language"in e[0])this.insertText(e[0].getTextContent());else{let t=C4(this);r.splice(t,0,e),i.selectEnd()}return}if(!e.some(e=>(E_(e)||EE(e))&&!e.isInline())){E_(r)||kk(211,n.constructor.name,n.getType());let t=C4(this);return r.splice(t,0,e),void i.selectEnd()}let o=function(e){let t=EL(),n=null;for(let r=0;r<e.length;r++){let i=e[r],o=Cs(i);if(o||EE(i)&&i.isInline()||E_(i)&&i.isInline()||C_(i)||i.isParentRequired()){if(null===n&&(n=i.createParentElementNode(),t.append(n),o))continue;null!==n&&n.append(i)}else t.append(i),n=null}return t}(e),s=o.getLastDescendant(),a=o.getChildren(),l=E_(r)&&r.isEmpty()?null:this.insertParagraph(),u=a[a.length-1],c=a[0];E_(t=c)&&AG(t)&&!t.isEmpty()&&E_(r)&&(!r.isEmpty()||r.canMergeWhenEmpty())&&(E_(r)||kk(211,n.constructor.name,n.getType()),r.append(...c.getChildren()),c=a[1]),c&&(null===r&&kk(212,n.constructor.name,n.getType()),function(e,t){let n=t.getParentOrThrow().getLastChild(),r=t,i=[t];for(;r!==n;)r.getNextSibling()||kk(140),i.push(r=r.getNextSibling());let o=e;for(let e of i)o=o.insertAfter(e)}(r,c));let d=A5(s,AG);l&&E_(d)&&(l.canMergeWhenEmpty()||AG(u))&&(d.append(...l.getChildren()),l.remove()),E_(r)&&r.isEmpty()&&r.remove(),s.selectEnd();let h=E_(r)?r.getLastChild():null;Cs(h)&&d!==r&&h.remove()}insertParagraph(){if("root"===this.anchor.key){let e=EL();return As().splice(this.anchor.offset,0,[e]),e.select(),e}let e=C4(this),t=A5(this.anchor.getNode(),AG);E_(t)||kk(213);let n=t.getChildAtIndex(e),r=n?[n,...n.getNextSiblings()]:[],i=t.insertNewAfter(this,!1);return i?(i.append(...r),i.selectStart(),i):null}insertLineBreak(e){let t=Co();if(this.insertNodes([t]),e){let e=t.getParentOrThrow(),n=t.getIndexWithinParent();e.select(n,n)}}extract(){let e=[...this.getNodes()],t=e.length,n=e[0],r=e[t-1],[i,o]=CI(this),s=this.isBackward(),[a,l]=s?[this.focus,this.anchor]:[this.anchor,this.focus],[u,c]=s?[o,i]:[i,o];if(0===t)return[];if(1===t){if(C_(n)&&!this.isCollapsed()){let e=n.splitText(u,c),t=0===u?e[0]:e[1];return t?(a.set(t.getKey(),0,"text"),l.set(t.getKey(),t.getTextContentSize(),"text"),[t]):[]}return[n]}if(C_(n)&&(u===n.getTextContentSize()?e.shift():0!==u&&([,n]=n.splitText(u),e[0]=n,a.set(n.getKey(),0,"text"))),C_(r)){let t=r.getTextContent().length;0===c?e.pop():c!==t&&([r]=r.splitText(c),e[e.length-1]=r,l.set(r.getKey(),r.getTextContentSize(),"text"))}return e}modify(e,t,n){var r;if(C6(this,e,t,n))return;let i="move"===e,o=Ea(),s=A$(AR(o));if(!s)return;let a=o._blockCursorElement,l=o._rootElement,u=this.focus.getNode();if(null===l||null===a||!E_(u)||u.isInline()||u.canBeEmpty()||AB(a,o,l),this.dirty){let e=AT(o,this.anchor.key),t=AT(o,this.focus.key);"text"===this.anchor.type&&(e=E5(e)),"text"===this.focus.type&&(t=E5(t)),e&&t&&C2(s,e,this.anchor.offset,t,this.focus.offset)}if(r=t?"backward":"forward",s.modify(e,r,n),s.rangeCount>0){let e=s.getRangeAt(0),n=this.anchor.getNode(),r=ET(n)?n:function(e){let t=e.getParentOrThrow();for(;null!==t&&!AL(t);)t=t.getParentOrThrow();return t}(n);if(this.applyDOMRange(e),this.dirty=!0,!i){let n,i,o,a,l,u=this.getNodes(),c=[],d=!1;for(let e=0;e<u.length;e++){let t=u[e];AM(t,r)?c.push(t):d=!0}if(d&&c.length>0)if(t){let e=c[0];E_(e)?e.selectStart():e.getParentOrThrow().selectStart()}else{let e=c[c.length-1];E_(e)?e.selectEnd():e.getParentOrThrow().selectEnd()}s.anchorNode===e.startContainer&&s.anchorOffset===e.startOffset||(n=this.focus,o=(i=this.anchor).key,a=i.offset,l=i.type,i.set(n.key,n.offset,n.type,!0),n.set(o,a,l,!0))}}"lineboundary"===n&&C6(this,e,t,n,"decorators")}forwardDeletion(e,t,n){if(!n&&("element"===e.type&&E_(t)&&e.offset===t.getChildrenSize()||"text"===e.type&&e.offset===t.getTextContentSize())){let e=t.getParent(),n=t.getNextSibling()||(null===e?null:e.getNextSibling());if(E_(n)&&n.isShadowRoot())return!0}return!1}deleteCharacter(e){let t=this.isCollapsed();if(this.isCollapsed()){let t=this.anchor,n=t.getNode();if(this.forwardDeletion(t,n,e))return;let r=Tm(Tk(t,e?"previous":"next"));if(r.getTextSlices().every(e=>null===e||0===e.distance)){let e={type:"initial"};for(let t of r.iterNodeCarets("shadowRoot"))if(Ti(t))if(t.origin.isInline());else{if(t.origin.isShadowRoot()){if("merge-block"===e.type)break;if(E_(r.anchor.origin)&&r.anchor.origin.isEmpty()){let e=Tj(t);TC(this,Tg(e,e)),r.anchor.origin.remove()}return}"merge-next-block"!==e.type&&"merge-block"!==e.type||(e={block:e.block,caret:t,type:"merge-block"})}else{if("merge-block"===e.type)break;if(Tr(t)){if(E_(t.origin)){if(t.origin.isInline()){if(!t.origin.isParentOf(r.anchor.origin))break}else e={block:t.origin,type:"merge-next-block"};continue}if(EE(t.origin)){if(t.origin.isIsolated());else if("merge-next-block"===e.type&&(t.origin.isKeyboardSelectable()||!t.origin.isInline())&&E_(r.anchor.origin)&&r.anchor.origin.isEmpty()){r.anchor.origin.remove();let e=Cq();e.add(t.origin.getKey()),Al(e)}else t.origin.remove();return}break}}if("merge-block"===e.type){let{caret:t,block:n}=e;return TC(this,Tg(!t.origin.isEmpty()&&n.isEmpty()?TA(Tl(n,t.direction)):r.anchor,t)),this.removeText()}}let i=this.focus;if(this.modify("extend",e,"character"),this.isCollapsed()){if(e&&0===t.offset&&CF(this,t.getNode()))return}else{let r="text"===i.type?i.getNode():null;if(n="text"===t.type?t.getNode():null,null!==r&&r.isSegmented()){let t=i.offset,o=r.getTextContentSize();if(r.is(n)||e&&t!==o||!e&&0!==t)return void CB(r,e,t)}else if(null!==n&&n.isSegmented()){let i=t.offset,o=n.getTextContentSize();if(n.is(r)||e&&0!==i||!e&&i!==o)return void CB(n,e,i)}!function(e,t){let n=e.anchor,r=e.focus,i=n.getNode();if(i===r.getNode()&&"text"===n.type&&"text"===r.type){var o;let e=n.offset,s=r.offset,a=e<s,l=a?e:s,u=a?s:e,c=u-1;l===c||Ac(o=i.getTextContent().slice(l,u))||Cz(o)||(t?r.set(r.key,c,r.type):n.set(n.key,c,n.type))}}(this,e)}}if(this.removeText(),e&&!t&&this.isCollapsed()&&"element"===this.anchor.type&&0===this.anchor.offset){let e=this.anchor.getNode();e.isEmpty()&&ET(e.getParent())&&null===e.getPreviousSibling()&&CF(this,e)}}deleteLine(e){this.isCollapsed()&&this.modify("extend",e,"lineboundary"),this.isCollapsed()?this.deleteCharacter(e):this.removeText()}deleteWord(e){if(this.isCollapsed()){let t=this.anchor,n=t.getNode();if(this.forwardDeletion(t,n,e))return;this.modify("extend",e,"word")}this.isCollapsed()?this.deleteCharacter(e):this.removeText()}isBackward(){return this.focus.isBefore(this.anchor)}getStartEndPoints(){return[this.anchor,this.focus]}}function CL(e){return e instanceof CM}function CO(e){let t=e.offset;if("text"===e.type)return t;let n=e.getNode();return t===n.getChildrenSize()?n.getTextContent().length:0}function CI(e){let t=e.getStartEndPoints();if(null===t)return[0,0];let[n,r]=t;return"element"===n.type&&"element"===r.type&&n.key===r.key&&n.offset===r.offset?[0,0]:[CO(n),CO(r)]}function CF(e,t){for(let n=t;n;n=n.getParent()){if(E_(n)){if(n.collapseAtStart(e))return!0;if(AL(n))break}if(n.getPreviousSibling())break}return!1}let Cz=(()=>{try{let e=RegExp("\\p{Emoji}","u"),t=e.test.bind(e);if(t("❤️")&&t("#️⃣")&&t("👍"))return t}catch(e){}return()=>!1})();function CB(e,t,n){let r=e.getTextContent().split(/(?=\s)/g),i=r.length,o=0,s=0;for(let e=0;e<i;e++){let a=e===i-1;if(s=o,o+=r[e].length,t&&o===n||o>n||a){r.splice(e,1),a&&(s=void 0);break}}let a=r.join("").trim();""===a?e.remove():(e.setTextContent(a),e.select(s,s))}function C$(e,t,n,r){let i,o=t;if(AU(e)){let s=!1,a=e.childNodes,l=a.length,u=r._blockCursorElement;o===l&&(s=!0,o=l-1);let c=a[o],d=!1;if(c===u)c=a[o+1],d=!0;else if(null!==u){let n=u.parentNode;e===n&&t>Array.prototype.indexOf.call(n.children,u)&&o--}if(C_(i=Au(c)))o=Tc(i,s?"next":"previous");else{let a=Au(e);if(null===a)return null;if(E_(a)){let l,u=r.getElementByKey(a.getKey());null===u&&kk(214);let c=AJ(r).$getDOMSlot(a,u,r);[a,o]=c.resolveChildIndex(a,u,e,t),E_(a)||kk(215),s&&o>=a.getChildrenSize()&&(o=Math.max(0,a.getChildrenSize()-1));let h=a.getChildAtIndex(o);if(E_(h)&&(l=h.getParent(),null===n||null===l||!l.canBeEmpty()||l!==n.getNode())){let e=s?h.getLastDescendant():h.getFirstDescendant();a=null===e||E_(h=e)?h:h.getParentOrThrow(),o=0}C_(h)?(i=h,a=null,o=Tc(h,s?"next":"previous")):h!==a&&s&&!d&&(E_(a)||kk(216),o=Math.min(a.getChildrenSize(),o+1))}else{let n=a.getIndexWithinParent();o=0===t&&EE(a)&&Au(e)===a?n:n+1,a=a.getParentOrThrow()}if(E_(a))return CN(a.__key,o,"element")}}else i=Au(e);return C_(i)?CN(i.__key,Tc(i,o,"clamp"),"text"):null}function CU(e,t,n){let r=e.offset,i=e.getNode();if(0===r){let r=i.getPreviousSibling(),o=i.getParent();if(t){if((n||!t)&&null===r&&E_(o)&&o.isInline()){let t=o.getPreviousSibling();C_(t)&&e.set(t.__key,t.getTextContent().length,"text")}}else E_(r)&&!n&&r.isInline()?e.set(r.__key,r.getChildrenSize(),"element"):C_(r)&&e.set(r.__key,r.getTextContent().length,"text")}else if(r===i.getTextContent().length){let r=i.getNextSibling(),o=i.getParent();if(t&&E_(r)&&r.isInline())e.set(r.__key,0,"element");else if((n||t)&&null===r&&E_(o)&&o.isInline()&&!o.canInsertTextAfter()){let t=o.getNextSibling();C_(t)&&e.set(t.__key,0,"text")}}}function CV(e,t,n){if("text"===e.type&&"text"===t.type){let n=e.isBefore(t),r=e.is(t);CU(e,n,r),CU(t,!n,r),r&&t.set(e.key,e.offset,e.type)}}function CW(e,t,n,r,i,o){if(null===e||null===n||!EJ(i,e,n))return null;let s=C$(e,t,CD(o)?o.anchor:null,i);if(null===s)return null;let a=C$(n,r,CD(o)?o.focus:null,i);if(null===a)return null;if("element"===s.type&&"element"===a.type){let t=Au(e),r=Au(n);if(EE(t)&&EE(r))return null}return CV(s,a),[s,a]}function CH(e){return E_(e)&&!e.isInline()}function CK(e,t,n,r,i,o){let s=Es(),a=new CR(CN(e,t,i),CN(n,r,o),0,"");return a.dirty=!0,s._selection=a,a}function CG(){return new CR(CN("root",0,"element"),CN("root",0,"element"),0,"")}function Cq(){return new CM(new Set)}function CJ(e,t,n,r){let i,o,s,a,l=n._window;if(null===l)return null;let u=r||l.event,c=u?u.type:void 0,d="selectionchange"===c,h=!kG&&(d||"beforeinput"===c||"compositionstart"===c||"compositionend"===c||"click"===c&&u&&3===u.detail||"drop"===c||void 0===c);if(CD(e)&&!h)return e.clone();if(null===t)return null;if(i=t.anchorNode,o=t.focusNode,s=t.anchorOffset,a=t.focusOffset,(d||void 0===c)&&CD(e)&&!EJ(n,i,o))return e.clone();let f=CW(i,s,o,a,n,e);if(null===f)return null;let[p,m]=f,g=0,y="";if(CD(e)){let t=e.anchor;if(p.key===t.key)g=e.format,y=e.style;else{let e=p.getNode();C_(e)?(g=e.getFormat(),y=e.getStyle()):E_(e)&&(g=e.getTextFormat(),y=e.getTextStyle())}}return new CR(p,m,g,y)}function CY(){return Es()._selection}function CX(){return Ea()._editorState._selection}function CZ(e,t,n,r=1){let i=e.anchor,o=e.focus,s=i.getNode(),a=o.getNode();if(!t.is(s)&&!t.is(a))return;let l=t.__key;if(e.isCollapsed()){let t=i.offset;if(n<=t&&r>0||n<t&&r<0){let n=Math.max(0,t+r);i.set(l,n,"element"),o.set(l,n,"element"),CQ(e)}}else{let s=e.isBackward(),a=s?o:i,u=a.getNode(),c=s?i:o,d=c.getNode();if(t.is(u)){let e=a.offset;(n<=e&&r>0||n<e&&r<0)&&a.set(l,Math.max(0,e+r),"element")}if(t.is(d)){let e=c.offset;(n<=e&&r>0||n<e&&r<0)&&c.set(l,Math.max(0,e+r),"element")}}CQ(e)}function CQ(e){let t=e.anchor,n=t.offset,r=e.focus,i=r.offset,o=t.getNode(),s=r.getNode();if(e.isCollapsed()){if(!E_(o))return;let e=o.getChildrenSize(),i=n>=e,s=i?o.getChildAtIndex(e-1):o.getChildAtIndex(n);if(C_(s)){let e=0;i&&(e=s.getTextContentSize()),t.set(s.__key,e,"text"),r.set(s.__key,e,"text")}return}if(E_(o)){let e=o.getChildrenSize(),r=n>=e,i=r?o.getChildAtIndex(e-1):o.getChildAtIndex(n);if(C_(i)){let e=0;r&&(e=i.getTextContentSize()),t.set(i.__key,e,"text")}}if(E_(s)){let e=s.getChildrenSize(),t=i>=e,n=t?s.getChildAtIndex(e-1):s.getChildAtIndex(i);if(C_(n)){let e=0;t&&(e=n.getTextContentSize()),r.set(n.__key,e,"text")}}}function C0(e,t,n,r,i){let o=null,s=0,a=null;null!==r?(o=r.__key,C_(r)?(s=r.getTextContentSize(),a="text"):E_(r)&&(s=r.getChildrenSize(),a="element")):null!==i&&(o=i.__key,C_(i)?a="text":E_(i)&&(a="element")),null!==o&&null!==a?e.set(o,s,a):(-1===(s=t.getIndexWithinParent())&&(s=n.getChildrenSize()),e.set(n.__key,s,"element"))}function C1(e,t,n,r,i){"text"===e.type?e.set(n,e.offset+(t?0:i),"text"):e.offset>r.getIndexWithinParent()&&e.set(e.key,e.offset-1,"element")}function C2(e,t,n,r,i){try{e.setBaseAndExtent(t,n,r,i)}catch(e){}}function C5(e,t,n){let r=AT(e,t.getKey());if(E_(t)){let i=AJ(e).$getDOMSlot(t,r,e);return[i.element,n+i.getFirstChildOffset()]}return[r,n]}function C3(e){let t=CY()||CX();null===t&&(t=As().selectEnd()),t.insertNodes(e)}function C4(e){let t=e;e.isCollapsed()||t.removeText();let n=CY();CD(n)&&(t=n),CD(t)||kk(161);let r=t.anchor,i=r.getNode(),o=r.offset;for(;!AG(i);){let e=i;if([i,o]=function(e,t){let n=e.getParent();if(!n){let e=EL();return As().append(e),e.select(),[As(),0]}if(C_(e)){let r=e.splitText(t);if(0===r.length)return[n,e.getIndexWithinParent()];let i=+(0!==t);return[n,r[0].getIndexWithinParent()+i]}if(!E_(e)||0===t)return[n,e.getIndexWithinParent()];let r=e.getChildAtIndex(t);if(r){let n=new CR(CN(e.__key,t,"element"),CN(e.__key,t,"element"),0,""),i=e.insertNewAfter(n);i&&i.append(r,...r.getNextSiblings())}return[n,e.getIndexWithinParent()+1]}(i,o),e.is(i))break}return o}function C6(e,t,n,r,i="decorators-and-blocks"){if("move"===t&&"character"===r&&!e.isCollapsed()){let[t,r]=n===e.isBackward()?[e.focus,e.anchor]:[e.anchor,e.focus];return r.set(t.key,t.offset,t.type),!0}let o=Tk(e.focus,n?"previous":"next"),s="lineboundary"===r,a="move"===t,l=o,u="decorators-and-blocks"===i;if(!TP(l)){for(let e of l){u=!1;let{origin:t}=e;if(!EE(t)||t.isIsolated()||(l=e,!s||!t.isInline()))break}if(u)for(let e of Tm(o).iterNodeCarets("extend"===t?"shadowRoot":"root")){if(Ti(e))e.origin.isInline()||(l=e);else{if(E_(e.origin))continue;EE(e.origin)&&!e.origin.isInline()&&(l=e)}break}}if(l===o)return!1;if(a&&!s&&EE(l.origin)&&l.origin.isKeyboardSelectable()){let e=Cq();return e.add(l.origin.getKey()),Al(e),!0}return l=Tj(l),a&&T_(e.anchor,l),T_(e.focus,l),u||!s}let C8=null,C9=null,C7=!1,Ee=!1,Et=0,En={characterData:!0,childList:!0,subtree:!0};function Er(){return C7||null!==C8&&C8._readOnly}function Ei(){C7&&kk(13)}function Eo(){Et>99&&kk(14)}function Es(){return null===C8&&kk(195,El()),C8}function Ea(){return null===C9&&kk(337,El()),C9}function El(){let e=0,t=new Set,n=EU.version;if("u">typeof window)for(let r of document.querySelectorAll("[contenteditable]")){let i=EZ(r);if(EY(i))e++;else if(i){let e=String(i.constructor.version||"<0.17.1");e===n&&(e+=" (separately built, likely a bundler configuration issue)"),t.add(e)}}let r=` Detected on the page: ${e} compatible editor(s) with version ${n}`;return t.size&&(r+=` and incompatible editors with versions ${Array.from(t).join(", ")}`),r}function Eu(e,t,n){let r=t.__type,i=EH(e,r),o=n.get(r);void 0===o&&(o=Array.from(i.transforms),n.set(r,o));let s=o.length;for(let e=0;e<s&&(o[e](t),t.isAttached());e++);}function Ec(e,t){return void 0!==e&&e.__key!==t&&e.isAttached()}function Ed(e,t){if(!t)return;let n=e._updateTags,r=t;for(let e of(Array.isArray(t)||(r=[t]),r))n.add(e)}function Eh(e,t){let n=e.type,r=t.get(n);void 0===r&&kk(17,n);let i=r.klass;e.type!==i.getType()&&kk(18,i.name);let o=i.importJSON(e),s=e.children;if(E_(o)&&Array.isArray(s))for(let e=0;e<s.length;e++){let n=Eh(s[e],t);o.append(n)}return o}function Ef(e,t,n){let r=C8,i=C7,o=C9;C8=t,C7=!0,C9=e;try{return n()}finally{C8=r,C7=i,C9=o}}function Ep(e,t){let n,r,i=e._pendingEditorState,o=e._rootElement,s=e._headless||null===o;if(null===i)return void(e._deferred.length>0&&Eg(e,e._deferred));let a=e._editorState,l=a._selection,u=i._selection,c=0!==e._dirtyType,d=C8,h=C7,f=C9,p=e._updating,m=e._observer,g=null;if(e._pendingEditorState=null,e._editorState=i,!s&&c&&null!==m){C9=e,C8=i,C7=!1,e._updating=!0;try{let t,n=e._dirtyType,r=e._dirtyElements,o=e._dirtyLeaves;m.disconnect(),_m="",_v=2===n,_o=e,_i=e._config,_p=e._config.dom||EF,_s=e._nodes,_a=_o._listeners.mutation,_l=r,_u=o,_c=a._nodeMap,_d=i._nodeMap,_x=i._readOnly,_h=new Map(e._keyToDOMMap),_f=t=new Map,function e(t,n){let r=_c.get(t),i=_d.get(t);void 0!==r&&void 0!==i||kk(61);let o=_v||_u.has(t)||_l.has(t),s=AT(_o,t);if(r===i&&!o){let e;if(E_(r)){let t=s.__lexicalTextContent;"string"==typeof t?e=t:s.__lexicalTextContent=e=r.getTextContent()}else e=r.getTextContent();return _m+=e,s}if(r!==i&&o&&A_(_f,_s,_a,i,"updated"),_p.$updateDOM(i,r,s,_o)){let e=_E(t,null);return null===n&&kk(62),n.replaceChild(e,s),_b(t,null),e}if(E_(r)){E_(i)||kk(334,t);let n=i.__indent;(_v||n!==r.__indent)&&__(s,n);let a=i.__format;if((_v||a!==r.__format)&&_S(s,a),o)(function(t,n,r){_g=null,_y=null,function(t,n,r){let i=_m,o=t.__size,s=n.__size;_m="";let a=r.element;if(1===o&&1===s){let r=t.__first,i=n.__first;if(r===i)e(r,a);else{let e=_D(r),t=_E(i,null);try{a.replaceChild(t,e)}catch(n){if("object"==typeof n&&null!=n)throw Error(`${n.toString()} Parent: ${a.tagName}, new child: {tag: ${t.tagName} key: ${i}}, old child: {tag: ${e.tagName}, key: ${r}}.`);throw n}_b(r,null)}let o=_d.get(i);C_(o)&&null===_g&&(_g=o.getFormat(),_y=o.getStyle())}else{let i=A3(t,_c),l=A3(n,_d);if(i.length!==o&&kk(227),l.length!==s&&kk(228),0===o)0!==s&&_A(l,0,0,s-1,r);else if(0===s){if(0!==o){let e=null==r.after&&null==r.before&&null==r.element.__lexicalLineBreak;_w(i,0,o-1,e?null:a),e&&(a.textContent="")}}else!function(t,n,r,i,o){let s=r-1,a=i-1,l,u,c=o.getFirstChild(),d=0,h=0;for(;d<=s&&h<=a;){let r=t[d],i=n[h];if(r===i)c=_P(e(i,o.element)),d++,h++;else{if(void 0===u&&(u=_M(n,h)),void 0===l)l=_M(t,d);else if(!l.has(r)){d++;continue}if(!u.has(r)){c=_P(_D(r)),_b(r,o.element),d++,l.delete(r);continue}if(l.has(i)){let t=AT(_o,i);t!==c&&o.withBefore(c).insertChild(t),c=_P(e(i,o.element)),d++,h++}else _E(i,o.withBefore(c)),h++}let s=_d.get(i);null!==s&&C_(s)?null===_g&&(_g=s.getFormat(),_y=s.getStyle()):E_(s)&&h<=a&&!s.isInline()&&(_m+="\n\n")}let f=d>s,p=h>a;if(f&&!p){let e=n[a+1],t=void 0===e?null:_o.getElementByKey(e);_A(n,0,h,a,o.withBefore(t))}else p&&!f&&_w(t,d,s,o.element)}(i,l,o,s,r)}a.__lexicalTextContent=_m,_m=i+_m}(t,n,_p.$getDOMSlot(n,r,_o)),null==_g||_g===n.__textFormat||_x||n.setTextFormat(_g),null==_y||_y===n.__textStyle||_x||n.setTextStyle(_y)})(r,i,s),ET(i)||i.isInline()||_N(r,i,s);else{let e,t=s.__lexicalTextContent;"string"==typeof t?e=t:s.__lexicalTextContent=e=r.getTextContent(),_m+=e}if((_v||i.__dir!==r.__dir)&&(_C(s,i),ET(i)&&!_v))for(let e of i.getChildren())E_(e)&&_C(AT(_o,e.getKey()),e)}else{let e=i.getTextContent();if(EE(i)){let e=i.decorate(_o,_i);null!==e&&_j(t,e)}_m+=e}if(!_x&&ET(i)&&i.__cachedText!==_m){let e=i.getWritable();e.__cachedText=_m,i=e}return _p.$decorateDOM(i,r,s,_o),s}("root",null),_o=void 0,_s=void 0,_l=void 0,_u=void 0,_c=void 0,_d=void 0,_i=void 0,_h=void 0,_f=void 0,_p=EF,g=t}catch(t){if(t instanceof Error&&e._onError(t),Ee)throw t;return EI(e,null,o,i),kQ(e),e._dirtyType=2,Ee=!0,Ep(e,a),void(Ee=!1)}finally{m.observe(o,En),e._updating=p,C8=d,C7=h,C9=f}}i._readOnly||(i._readOnly=!0);let y=e._dirtyLeaves,v=e._dirtyElements,x=e._normalizedNodes,b=e._updateTags,w=e._deferred;c&&(e._dirtyType=0,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements=new Map,e._normalizedNodes=new Set,e._updateTags=new Set),function(e,t){let n,r=e._decorators,i=e._pendingDecorators||r,o=t._nodeMap;for(n in i)o.has(n)||(i===r&&(i=Ai(e)),delete i[n])}(e,i);let k=s?null:A$(AR(e));if(e._editable&&null!==k&&(c||null===u||u.dirty||!u.is(l))&&null!==o&&!b.has("skip-dom-selection")){C9=e,C8=i;try{if(null!==m&&m.disconnect(),c||null===u||u.dirty){let t=e._blockCursorElement;null!==t&&AB(t,e,o),function(e,t,n,r,i,o){var s;let a=r.anchorNode,l=r.focusNode,u=r.anchorOffset,c=r.focusOffset,d=document.activeElement;if(i.has("collaboration")&&d!==o||null!==d&&Eq(d))return;if(!CD(t))return null!==e&&EJ(n,a,l)&&r.removeAllRanges();let h=t.anchor,f=t.focus,p=h.getNode(),m=f.getNode(),[g,y]=C5(n,p,h.offset),[v,x]=C5(n,m,f.offset),b=t.format,w=t.style,k=t.isCollapsed(),_=g,S=v,C=!1;if("text"===h.type?(_=E5(g),C=p.getFormat()!==b||p.getStyle()!==w):CD(e)&&"text"===e.anchor.type&&(C=!0),"text"===f.type&&(S=E5(v)),null!==_&&null!==S&&(k&&(null===e||C||CD(e)&&(e.format!==b||e.style!==w))&&(s=h.key,SL=[b,w,y,s,performance.now()]),u!==y||c!==x||a!==_||l!==S||"Range"===r.type&&k||(null!==d&&o.contains(d)||i.has(S8)||o.focus({preventScroll:!0}),"element"===h.type))){if(C2(r,_,y,S,x),!kA||!t.isCollapsed()||null===o||i.has(S8)||null!==document.activeElement&&o.contains(document.activeElement)||o.focus({preventScroll:!0}),!i.has("skip-scroll-into-view")&&t.isCollapsed()&&null!==o&&o===document.activeElement){let e=CD(t)&&"element"===t.anchor.type?_.childNodes[y]||null:r.rangeCount>0?r.getRangeAt(0):null;if(null!==e){let t;if(e instanceof Text){let n=document.createRange();n.selectNode(e),t=n.getBoundingClientRect()}else t=e.getBoundingClientRect();!function(e,t,n){let r=Aj(n),i=AD(r);if(null===r||null===i)return;let{top:o,bottom:s}=t,a=0,l=0,u=n;for(;null!==u;){let t=u===r.body;if(t){a=0,l=AR(e).innerHeight;let t=i.getComputedStyle(r.documentElement),n=parseFloat(t.scrollPaddingTop),o=parseFloat(t.scrollPaddingBottom);isFinite(n)&&(a+=n),isFinite(o)&&(l-=o)}else{let e=u.getBoundingClientRect();a=e.top,l=e.bottom}let n=0;if(o<a?n=-(a-o):s>l&&(n=s-l),0!==n)if(t)i.scrollBy(0,n);else{let e=u.scrollTop;u.scrollTop+=n;let t=u.scrollTop-e;o-=t,s-=t}if(t)break;u=AN(u)}}(n,t,o)}}ST=!0}}(l,u,e,k,b,o)}!function(e,t,n){let r=e._blockCursorElement;if(CD(n)&&n.isCollapsed()&&"element"===n.anchor.type&&t.contains(document.activeElement)){let i=n.anchor,o=i.getNode(),s=i.offset,a=!1,l=null;if(s===o.getChildrenSize())Az(o.getChildAtIndex(s-1))&&(a=!0);else{let t=o.getChildAtIndex(s);if(null!==t&&Az(t)){let n=t.getPreviousSibling();(null===n||Az(n))&&(a=!0,l=e.getElementByKey(t.__key))}}if(a){let n,i,s,a=e.getElementByKey(o.__key);return null===r&&(n=e._config.theme,(i=document.createElement("div")).contentEditable="false",i.setAttribute("data-lexical-cursor","true"),s=n.blockCursor,void 0!==s&&("string"==typeof s&&(s=n.blockCursor=TF(s)),void 0!==s&&i.classList.add(...s)),e._blockCursorElement=r=i),t.style.caretColor="transparent",null===l?a.appendChild(r):a.insertBefore(r,l)}}null!==r&&AB(r,e,t)}(e,o,u)}finally{null!==m&&m.observe(o,En),C9=f,C8=d}}null!==g&&function(e,t,n,r,i){let o=Array.from(e._listeners.mutation),s=o.length;for(let e=0;e<s;e++){let[s,a]=o[e];for(let e of a){let o=t.get(e);void 0!==o&&s(o,{dirtyLeaves:r,prevEditorState:i,updateTags:n})}}}(e,g,b,y,a),CD(u)||null===u||null!==l&&l.is(u)||e.dispatchCommand(_L,void 0);let _=e._pendingDecorators;null!==_&&(e._decorators=_,e._pendingDecorators=null,Em("decorator",e,!0,_)),n=Ao(t||a),n!==(r=Ao(i))&&Em("textcontent",e,!0,r),Em("update",e,!0,{dirtyElements:v,dirtyLeaves:y,editorState:i,mutatedNodes:g,normalizedNodes:x,prevEditorState:t||a,tags:b}),Eg(e,w),function(e){let t=e._updates;if(0!==t.length){let n=t.shift();if(n){let[t,r]=n;Ev(e,t,r)}}}(e)}function Em(e,t,n,...r){let i=t._updating;t._updating=n;try{let n=t._listeners[e];for(let[e,t]of Array.from(n)){t&&t();let i=e(...r);n.has(e)?n.set(e,i):i&&i()}}finally{t._updating=i}}function Eg(e,t){if(e._deferred=[],0!==t.length){let n=e._updating;e._updating=!0;try{for(let e=0;e<t.length;e++)t[e]()}finally{e._updating=n}}}function Ey(e,t){let n=e._updates,r=t||!1;for(;0!==n.length;){let t=n.shift();if(t){let n,[i,o]=t,s=e._pendingEditorState;void 0!==o&&(n=o.onUpdate,o.skipTransforms&&(r=!0),o.discrete&&(null===s&&kk(191),s._flushSync=!0),n&&e._deferred.push(n),Ed(e,o.tag)),null==s?Ev(e,i,o):i()}}return r}function Ev(e,t,n){let r=e._updateTags,i,o=!1,s=!1;void 0!==n&&(i=n.onUpdate,Ed(e,n.tag),o=n.skipTransforms||!1,s=n.discrete||!1),i&&e._deferred.push(i);let a=e._editorState,l=e._pendingEditorState,u=!1;(null===l||l._readOnly)&&(l=e._pendingEditorState=EN(l||a),u=!0),l._flushSync=s;let c=C8,d=C7,h=C9,f=e._updating;C8=l,C7=!1,e._updating=!0,C9=e;let p=e._headless||null===e.getRootElement();EV=null;try{var m;let r,i;u&&(p?null!==a._selection&&(l._selection=a._selection.clone()):l._selection=(m=n&&n.event||null,r=e.getEditorState()._selection,i=A$(AR(e)),CD(r)||null==r?CJ(r,i,e,m):r.clone()));let s=e._compositionKey;t(),o=Ey(e,o),function(e,t){let n=t.getEditorState()._selection,r=e._selection;if(CD(r)){let e,t=r.anchor,i=r.focus;if("text"===t.type&&(e=t.getNode()).selectionTransform(n,r),"text"===i.type){let t=i.getNode();e!==t&&t.selectionTransform(n,r)}}}(l,e),0!==e._dirtyType&&(o?function(e,t){let n=t._dirtyLeaves,r=e._nodeMap;for(let e of n){let t=r.get(e);C_(t)&&t.isAttached()&&t.isSimpleText()&&!t.isUnmergeable()&&_t(t)}}(l,e):function(e,t){let n=t._dirtyLeaves,r=t._dirtyElements,i=e._nodeMap,o=E7(),s=new Map,a=n,l=a.size,u=r,c=u.size;for(;l>0||c>0;){if(l>0){for(let e of(t._dirtyLeaves=new Set,a)){let r=i.get(e);C_(r)&&r.isAttached()&&r.isSimpleText()&&!r.isUnmergeable()&&_t(r),void 0!==r&&Ec(r,o)&&Eu(t,r,s),n.add(e)}if((l=(a=t._dirtyLeaves).size)>0){Et++;continue}}for(let e of(t._dirtyLeaves=new Set,t._dirtyElements=new Map,u.delete("root")&&u.set("root",!0),u)){let n=e[0],a=e[1];if(r.set(n,a),!a)continue;let l=i.get(n);void 0!==l&&Ec(l,o)&&Eu(t,l,s)}l=(a=t._dirtyLeaves).size,c=(u=t._dirtyElements).size,Et++}t._dirtyLeaves=n,t._dirtyElements=r}(l,e),Ey(e),function(e,t,n,r){let i=e._nodeMap,o=t._nodeMap,s=[];for(let[e]of r){let t=o.get(e);void 0!==t&&(t.isAttached()||(E_(t)&&function e(t,n,r,i,o,s){let a=t.getFirstChild();for(;null!==a;){let t=a.__key;a.__parent===n&&(E_(a)&&e(a,t,r,i,o,s),r.has(t)||s.delete(t),o.push(t)),a=a.getNextSibling()}}(t,e,i,o,s,r),i.has(e)||r.delete(e),s.push(e)))}for(let e of s)o.delete(e);for(let e of n){let t=o.get(e);void 0===t||t.isAttached()||(i.has(e)||n.delete(e),o.delete(e))}}(a,l,e._dirtyLeaves,e._dirtyElements)),s!==e._compositionKey&&(l._flushSync=!0);let c=l._selection;if(CD(c)){let e=l._nodeMap,t=c.anchor.key,n=c.focus.key;void 0!==e.get(t)&&void 0!==e.get(n)||kk(19)}else CL(c)&&0===c._nodes.size&&(l._selection=null)}catch(t){return t instanceof Error&&e._onError(t),e._pendingEditorState=a,e._dirtyType=2,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements.clear(),void Ep(e)}finally{C8=c,C7=d,C9=h,e._updating=f,Et=0}0!==e._dirtyType||e._deferred.length>0||function(e,t){let n=t.getEditorState()._selection,r=e._selection;if(null!==r){if(r.dirty||!r.is(n))return!0}else if(null!==n)return!0;return!1}(l,e)?l._flushSync?(l._flushSync=!1,Ep(e)):u&&EG(()=>{Ep(e)}):(l._flushSync=!1,u&&(r.clear(),e._deferred=[],e._pendingEditorState=null))}function Ex(e,t,n){C9===e&&void 0===n?t():Ev(e,t,n)}class Eb{element;before;after;constructor(e,t,n){this.element=e,this.before=t||null,this.after=n||null}withBefore(e){return new Eb(this.element,e,this.after)}withAfter(e){return new Eb(this.element,this.before,e)}withElement(e){return this.element===e?this:new Eb(e,this.before,this.after)}insertChild(e){let t=this.before||this.getManagedLineBreak();return null!==t&&t.parentElement!==this.element&&kk(222),this.element.insertBefore(e,t),this}removeChild(e){return e.parentElement!==this.element&&kk(223),this.element.removeChild(e),this}replaceChild(e,t){return t.parentElement!==this.element&&kk(224),this.element.replaceChild(e,t),this}getFirstChild(){let e=this.after?this.after.nextSibling:this.element.firstChild;return e===this.before||e===this.getManagedLineBreak()?null:e}getManagedLineBreak(){return this.element.__lexicalLineBreak||null}setManagedLineBreak(e){null===e?this.removeManagedLineBreak():this.insertManagedLineBreak("decorator"===e&&(kR||kN||kP))}removeManagedLineBreak(){let e=this.getManagedLineBreak();if(e){let t=this.element,n="IMG"===e.nodeName?e.nextSibling:null;n&&t.removeChild(n),t.removeChild(e),t.__lexicalLineBreak=void 0}}insertManagedLineBreak(e){let t=this.getManagedLineBreak();if(t){if(e===("IMG"===t.nodeName))return;this.removeManagedLineBreak()}let n=this.element,r=this.before,i=document.createElement("br");if(n.insertBefore(i,r),e){let e=document.createElement("img");e.setAttribute("data-lexical-linebreak","true"),e.style.setProperty("display","inline","important"),e.style.setProperty("border","0px","important"),e.style.setProperty("margin","0px","important"),e.alt="",n.insertBefore(e,i),n.__lexicalLineBreak=e}else n.__lexicalLineBreak=i}getFirstChildOffset(){let e=0;for(let t=this.after;null!==t;t=t.previousSibling)e++;return e}resolveChildIndex(e,t,n,r){if(n===this.element){let t=this.getFirstChildOffset();return[e,Math.min(t+e.getChildrenSize(),Math.max(t,r))]}let i=Ew(t,n);i.push(r);let o=Ew(t,this.element),s=e.getIndexWithinParent();for(let e=0;e<o.length;e++){let t=i[e],n=o[e];if(void 0===t||t<n)break;if(t>n){s+=1;break}}return[e.getParentOrThrow(),s]}}function Ew(e,t){let n=[],r=t;for(;r!==e&&null!==r;r=r.parentNode){let e=0;for(let t=r.previousSibling;null!==t;t=t.previousSibling)e++;n.push(e)}return r!==e&&kk(225),n.reverse()}class Ek extends S5{__first;__last;__size;__format;__style;__indent;__dir;__textFormat;__textStyle;constructor(e){super(e),this.__first=null,this.__last=null,this.__size=0,this.__format=0,this.__style="",this.__indent=0,this.__dir=null,this.__textFormat=0,this.__textStyle=""}afterCloneFrom(e){super.afterCloneFrom(e),this.__key===e.__key&&(this.__first=e.__first,this.__last=e.__last,this.__size=e.__size),this.__indent=e.__indent,this.__format=e.__format,this.__style=e.__style,this.__dir=e.__dir,this.__textFormat=e.__textFormat,this.__textStyle=e.__textStyle}getFormat(){return this.getLatest().__format}getFormatType(){return kU[this.getFormat()]||""}getStyle(){return this.getLatest().__style}getIndent(){return this.getLatest().__indent}getChildren(){let e=[],t=this.getFirstChild();for(;null!==t;)e.push(t),t=t.getNextSibling();return e}getChildrenKeys(){let e=[],t=this.getFirstChild();for(;null!==t;)e.push(t.__key),t=t.getNextSibling();return e}getChildrenSize(){return this.getLatest().__size}isEmpty(){return 0===this.getChildrenSize()}isDirty(){let e=Ea()._dirtyElements;return null!==e&&e.has(this.__key)}isLastChild(){let e=this.getLatest(),t=this.getParentOrThrow().getLastChild();return null!==t&&t.is(e)}getAllTextNodes(){let e=[],t=this.getFirstChild();for(;null!==t;){if(C_(t)&&e.push(t),E_(t)){let n=t.getAllTextNodes();e.push(...n)}t=t.getNextSibling()}return e}getFirstDescendant(){let e=this.getFirstChild();for(;E_(e);){let t=e.getFirstChild();if(null===t)break;e=t}return e}getLastDescendant(){let e=this.getLastChild();for(;E_(e);){let t=e.getLastChild();if(null===t)break;e=t}return e}getDescendantByIndex(e){let t=this.getChildren(),n=t.length;if(e>=n){let e=t[n-1];return E_(e)&&e.getLastDescendant()||e||null}let r=t[e];return E_(r)&&r.getFirstDescendant()||r||null}getFirstChild(){let e=this.getLatest().__first;return null===e?null:Ae(e)}getFirstChildOrThrow(){let e=this.getFirstChild();return null===e&&kk(45,this.__key),e}getLastChild(){let e=this.getLatest().__last;return null===e?null:Ae(e)}getLastChildOrThrow(){let e=this.getLastChild();return null===e&&kk(96,this.__key),e}getChildAtIndex(e){let t,n,r=this.getChildrenSize();if(e<r/2){for(t=this.getFirstChild(),n=0;null!==t&&n<=e;){if(n===e)return t;t=t.getNextSibling(),n++}return null}for(t=this.getLastChild(),n=r-1;null!==t&&n>=e;){if(n===e)return t;t=t.getPreviousSibling(),n--}return null}getTextContent(){let e="",t=this.getChildren(),n=t.length;for(let r=0;r<n;r++){let i=t[r];e+=i.getTextContent(),E_(i)&&r!==n-1&&!i.isInline()&&(e+="\n\n")}return e}getTextContentSize(){let e=0,t=this.getChildren(),n=t.length;for(let r=0;r<n;r++){let i=t[r];e+=i.getTextContentSize(),E_(i)&&r!==n-1&&!i.isInline()&&(e+=2)}return e}getDirection(){return this.getLatest().__dir}getTextFormat(){return this.getLatest().__textFormat}hasFormat(e){if(""!==e){let t=k$[e];return 0!=(this.getFormat()&t)}return!1}hasTextFormat(e){let t=kz[e];return 0!=(this.getTextFormat()&t)}getFormatFlags(e,t){return E3(this.getLatest().__textFormat,e,t)}getTextStyle(){return this.getLatest().__textStyle}select(e,t){Ei();let n=CY(),r=e,i=t,o=this.getChildrenSize();if(!this.canBeEmpty()){if(0===e&&0===t){let e=this.getFirstChild();if(C_(e)||E_(e))return e.select(0,0)}else if((void 0===e||e===o)&&(void 0===t||t===o)){let e=this.getLastChild();if(C_(e)||E_(e))return e.select()}}void 0===r&&(r=o),void 0===i&&(i=o);let s=this.__key;return CD(n)?(n.anchor.set(s,r,"element"),n.focus.set(s,i,"element"),n.dirty=!0,n):CK(s,r,s,i,"element","element")}selectStart(){let e=this.getFirstDescendant();return e?e.selectStart():this.select()}selectEnd(){let e=this.getLastDescendant();return e?e.selectEnd():this.select()}clear(){let e=this.getWritable();return this.getChildren().forEach(e=>e.remove()),e}append(...e){return this.splice(this.getChildrenSize(),0,e)}setDirection(e){let t=this.getWritable();return t.__dir=e,t}setFormat(e){return this.getWritable().__format=""!==e&&k$[e]||0,this}setStyle(e){return this.getWritable().__style=e||"",this}setTextFormat(e){let t=this.getWritable();return t.__textFormat=e,t}setTextStyle(e){let t=this.getWritable();return t.__textStyle=e,t}setIndent(e){return this.getWritable().__indent=e,this}splice(e,t,n){S2(this)&&kk(324,this.__key,this.__type);let r=this.getChildrenSize(),i=this.getWritable();e+t<=r||kk(226,String(e),String(t),String(r));let o=i.__key,s=[],a=[],l=this.getChildAtIndex(e+t),u=null,c=r-t+n.length;if(0!==e)if(e===r)u=this.getLastChild();else{let t=this.getChildAtIndex(e);null!==t&&(u=t.getPreviousSibling())}if(t>0){let e=null===u?this.getFirstChild():u.getNextSibling();for(let n=0;n<t;n++){null===e&&kk(100);let t=e.getNextSibling(),n=e.__key;E6(e.getWritable()),a.push(n),e=t}}let d=u;for(let e of n){null!==d&&e.is(d)&&(u=d=d.getPreviousSibling());let t=e.getWritable();t.__parent===o&&c--,E6(t);let n=e.__key;if(null===d)i.__first=n,t.__prev=null;else{let e=d.getWritable();e.__next=n,t.__prev=e.__key}e.__key===o&&kk(76),t.__parent=o,s.push(n),d=e}if(e+t===r)null!==d&&(d.getWritable().__next=null,i.__last=d.__key);else if(null!==l){let e=l.getWritable();if(null!==d){let t=d.getWritable();e.__prev=d.__key,t.__next=l.__key}else e.__prev=null}if(i.__size=c,a.length){let e=CY();if(CD(e)){let t=new Set(a),n=new Set(s),{anchor:r,focus:i}=e;ES(r,t,n)&&C0(r,r.getNode(),this,u,l),ES(i,t,n)&&C0(i,i.getNode(),this,u,l),0!==c||this.canBeEmpty()||AL(this)||this.remove()}}return i}getDOMSlot(e){return new Eb(e)}exportDOM(e){let{element:t}=super.exportDOM(e);if(AU(t)){let e=this.getIndent();e>0&&(t.style.paddingInlineStart=40*e+"px");let n=this.getDirection();n&&(t.dir=n)}return{element:t}}exportJSON(){let e={children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),...super.exportJSON()},t=this.getTextFormat(),n=this.getTextStyle();return 0===t&&""===n||AL(this)||this.getChildren().some(C_)||(0!==t&&(e.textFormat=t),""!==n&&(e.textStyle=n)),e}updateFromJSON(e){return super.updateFromJSON(e).setFormat(e.format).setIndent(e.indent).setDirection(e.direction).setTextFormat(e.textFormat||0).setTextStyle(e.textStyle||"")}insertNewAfter(e,t){return null}canIndent(){return!0}collapseAtStart(e){return!1}excludeFromCopy(e){return!1}canReplaceWith(e){return!0}canInsertAfter(e){return!0}canBeEmpty(){return!0}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}isInline(){return!1}isShadowRoot(){return!1}canMergeWith(e){return!1}extractWithChild(e,t,n){return!1}canMergeWhenEmpty(){return!1}reconcileObservedMutation(e,t){let n=AJ(t).$getDOMSlot(this,e,t),r=n.getFirstChild();for(let e=this.getFirstChild();e;e=e.getNextSibling()){let i=t.getElementByKey(e.getKey());null!==i&&(null==r?(n.insertChild(i),r=i):r!==i&&n.replaceChild(i,r),r=r.nextSibling)}}}function E_(e){return e instanceof Ek}function ES(e,t,n){let r=e.getNode();for(;r;){let e=r.__key;if(t.has(e)&&!n.has(e))return!0;r=r.getParent()}return!1}class EC extends S5{decorate(e,t){return null}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}}function EE(e){return e instanceof EC}class EA extends Ek{__cachedText;static getType(){return"root"}static clone(){return new EA}constructor(){super("root"),this.__cachedText=null}getTopLevelElementOrThrow(){kk(51)}getTextContent(){let e=this.__cachedText;return(Er()||0===Ea()._dirtyType)&&null!==e?e:super.getTextContent()}remove(){kk(52)}replace(e){kk(53)}insertBefore(e){kk(54)}insertAfter(e){kk(55)}updateDOM(e,t){return!1}splice(e,t,n){for(let e of n)E_(e)||EE(e)||kk(282);return super.splice(e,t,n)}static importJSON(e){return As().updateFromJSON(e)}collapseAtStart(){return!0}}function ET(e){return e instanceof EA}function EN(e){return new EP(new Map(e._nodeMap))}function Ej(){return new EP(new Map([["root",new EA]]))}class EP{_nodeMap;_selection;_flushSync;_readOnly;constructor(e,t){this._nodeMap=e,this._selection=t||null,this._flushSync=!1,this._readOnly=!1}isEmpty(){return 1===this._nodeMap.size&&null===this._selection}read(e,t){return Ef(t&&t.editor||null,this,e)}clone(e){let t=new EP(this._nodeMap,void 0===e?this._selection:e);return t._readOnly=!0,t}toJSON(){return Ef(null,this,()=>({root:function e(t){let n=t.exportJSON(),r=t.constructor;if(n.type!==r.getType()&&kk(130,r.name),E_(t)){let i=n.children;Array.isArray(i)||kk(59,r.name);let o=t.getChildren();for(let t=0;t<o.length;t++){let n=e(o[t]);i.push(n)}}return n}(As())}))}}class EM extends Ek{static getType(){return"artificial"}createDOM(e){return document.createElement("div")}}class ED extends Ek{static getType(){return"paragraph"}static clone(e){return new ED(e.__key)}createDOM(e){let t=document.createElement("p"),n=Ak(e.theme,"paragraph");return void 0!==n&&t.classList.add(...n),t}updateDOM(e,t,n){return!1}static importDOM(){return{p:e=>({conversion:ER,priority:0})}}exportDOM(e){let{element:t}=super.exportDOM(e);if(AU(t)){this.isEmpty()&&t.append(document.createElement("br"));let e=this.getFormatType();e&&(t.style.textAlign=e)}return{element:t}}static importJSON(e){return EL().updateFromJSON(e)}exportJSON(){let e=super.exportJSON();if(void 0===e.textFormat||void 0===e.textStyle){let t=this.getChildren().find(C_);t?(e.textFormat=t.getFormat(),e.textStyle=t.getStyle()):(e.textFormat=this.getTextFormat(),e.textStyle=this.getTextStyle())}return e}insertNewAfter(e,t){let n=EL();n.setTextFormat(e.format),n.setTextStyle(e.style);let r=this.getDirection();return n.setDirection(r),n.setFormat(this.getFormatType()),n.setStyle(this.getStyle()),this.insertAfter(n,t),n}collapseAtStart(){let e=this.getChildren();if(0===e.length||C_(e[0])&&""===e[0].getTextContent().trim()){if(null!==this.getNextSibling())return this.selectNext(),this.remove(),!0;if(null!==this.getPreviousSibling())return this.selectPrevious(),this.remove(),!0}return!1}}function ER(e){let t=EL();if(e.style&&(t.setFormat(e.style.textAlign),A0(e,t)),""===t.getFormatType()){let n=e.getAttribute("align");n&&n&&n in k$&&t.setFormat(n)}return{node:t}}function EL(){return AI(new ED)}function EO(e){return e instanceof ED}function EI(e,t,n,r){let i=e._keyToDOMMap;i.clear(),e._editorState=Ej(),e._pendingEditorState=r,e._compositionKey=null,e._dirtyType=0,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements.clear(),e._normalizedNodes=new Set,e._updateTags=new Set,e._updates=[],e._blockCursorElement=null;let o=e._observer;null!==o&&(o.disconnect(),e._observer=null),null!==t&&(t.textContent=""),null!==n&&(n.textContent="",i.set("root",n))}let EF={$createDOM:(e,t)=>e.createDOM(t._config,t),$decorateDOM:(e,t,n,r)=>{},$exportDOM:(e,t)=>{let n=EK(t,e.getType());return n&&void 0!==n.exportDOM?n.exportDOM(t,e):e.exportDOM(t)},$extractWithChild:(e,t,n,r,i)=>E_(e)&&e.extractWithChild(t,n,r),$getDOMSlot:(e,t,n)=>(E_(e)||kk(336,e.getKey(),e.getType()),e.getDOMSlot(t)),$shouldExclude:(e,t,n)=>E_(e)&&e.excludeFromCopy("html"),$shouldInclude:(e,t,n)=>!t||e.isSelected(t),$updateDOM:(e,t,n,r)=>e.updateDOM(t,n,r._config)};function Ez(e){var t,n;let r,i,o,s,a=e||{},l=C9,u=a.theme||{},c=void 0===e?l:a.parentEditor||null,d=a.disableEvents||!1,h=Ej(),f=a.namespace||(null!==c?c._config.namespace:Ah()),p=a.editorState,m=[EA,Cp,Cr,CC,ED,EM,...a.nodes||[]],{onError:g,html:y}=a,v=void 0===a.editable||a.editable;if(void 0===e&&null!==l)r=l._nodes;else{r=new Map;for(let e=0;e<m.length;e++){let t=m[e],n=null,i=null;if("function"!=typeof t){let e=t;t=e.replace,n=e.with,i=e.withKlass||null}A2(t);let o=t.getType(),s=function(e){let t=new Set,n=new Set,r=e;for(;r;){let{ownNodeConfig:e}=A2(r),i=r.transform;if(!n.has(i)){n.add(i);let e=r.transform();e&&t.add(e)}if(e){let n=e.$transform;n&&t.add(n),r=e.extends}else{let e=Object.getPrototypeOf(r);r=e.prototype instanceof S5&&e!==S5?e:void 0}}return t}(t);r.set(o,{exportDOM:y&&y.export?y.export.get(t):void 0,klass:t,replace:n,replaceWithKlass:i,sharedNodeState:function(e){let t=new Map,n=new Set;for(let r="function"==typeof e?e:e.replace;r.prototype&&void 0!==r.prototype.getType;r=Object.getPrototypeOf(r)){let{ownNodeConfig:e}=A2(r);if(e&&e.stateConfigs)for(let r of e.stateConfigs){let e;"stateConfig"in r?(e=r.stateConfig,r.flat&&n.add(e.key)):e=r,t.set(e.key,e)}}return{flatKeys:n,sharedConfigMap:t}}(m[e]),transforms:s})}}let x=new EU(h,c,r,{disableEvents:d,dom:{...EF,...e&&e.dom},namespace:f,theme:u},g||console.error,(t=r,n=y?y.import:void 0,i=new Map,o=new Set,s=e=>{Object.keys(e).forEach(t=>{let n=i.get(t);void 0===n&&(n=[],i.set(t,n)),n.push(e[t])})},t.forEach(e=>{let t=e.klass.importDOM;if(null==t||o.has(t))return;o.add(t);let n=t.call(e.klass);null!==n&&s(n)}),n&&s(n),i),v,e);return void 0!==p&&(x._pendingEditorState=p,x._dirtyType=2),x.registerCommand(_F,SU,0),x.registerCommand(_z,SV,0),x.registerCommand(_B,SW,0),x.registerCommand(_$,SH,0),x.registerCommand(_Q,SG,0),x}function EB(e,t){let n=e.get(t);e.delete(t),n&&n()}function E$(e,t,n){return e.set(t,n),EB.bind(null,e,t)}class EU{static version;_headless;_parentEditor;_rootElement;_editorState;_pendingEditorState;_compositionKey;_deferred;_keyToDOMMap;_updates;_updating;_listeners;_commands;_nodes;_decorators;_pendingDecorators;_config;_dirtyType;_cloneNotNeeded;_dirtyLeaves;_dirtyElements;_normalizedNodes;_updateTags;_observer;_key;_onError;_htmlConversions;_window;_editable;_blockCursorElement;_createEditorArgs;constructor(e,t,n,r,i,o,s,a){this._createEditorArgs=a,this._parentEditor=t,this._rootElement=null,this._editorState=e,this._pendingEditorState=null,this._compositionKey=null,this._deferred=[],this._keyToDOMMap=new Map,this._updates=[],this._updating=!1,this._listeners={decorator:new Map,editable:new Map,mutation:new Map,root:new Map,textcontent:new Map,update:new Map},this._commands=new Map,this._config=r,this._nodes=n,this._decorators={},this._pendingDecorators=null,this._dirtyType=0,this._cloneNotNeeded=new Set,this._dirtyLeaves=new Set,this._dirtyElements=new Map,this._normalizedNodes=new Set,this._updateTags=new Set,this._observer=null,this._key=Ah(),this._onError=i,this._htmlConversions=o,this._editable=s,this._headless=null!==t&&t._headless,this._window=null,this._blockCursorElement=null}isComposing(){return null!=this._compositionKey}registerUpdateListener(e){return E$(this._listeners.update,e)}registerEditableListener(e){return E$(this._listeners.editable,e)}registerDecoratorListener(e){return E$(this._listeners.decorator,e)}registerTextContentListener(e){return E$(this._listeners.textcontent,e)}registerRootListener(e){let t=this._listeners.root;return Tz(E$(t,e,e(this._rootElement,null)||void 0),()=>{var n;let r;return n=[null,this._rootElement],void((r=t.get(e))&&r(),t.set(e,e(...n)||void 0))})}registerCommand(e,t,n){void 0===n&&kk(35);let r=this._commands;r.has(e)||r.set(e,[new kK,new kK,new kK,new kK,new kK]);let i=r.get(e);void 0===i&&kk(36,String(e));let o=7&n,s=i[o];return o!==n?s.addFront(t):s.addBack(t),()=>{s.delete(t),i.every(e=>0===e.size)&&r.delete(e)}}registerMutationListener(e,t,n){let r=this.resolveRegisteredNodeAfterReplacements(this.getRegisteredNode(e)).klass,i=this._listeners.mutation,o=i.get(t);void 0===o&&(o=new Set,i.set(t,o)),o.add(r);let s=n&&n.skipInitialization;return void 0!==s&&s||this.initializeMutationListener(t,r),()=>{o.delete(r),0===o.size&&i.delete(t)}}getRegisteredNode(e){let t=this._nodes.get(e.getType());return void 0===t&&kk(37,e.name),t}resolveRegisteredNodeAfterReplacements(e){for(;e.replaceWithKlass;)e=this.getRegisteredNode(e.replaceWithKlass);return e}initializeMutationListener(e,t){let n=this._editorState,r=AZ(n).get(t.getType());if(!r)return;let i=new Map;for(let e of r.keys())i.set(e,"created");i.size>0&&e(i,{dirtyLeaves:new Set,prevEditorState:n,updateTags:new Set(["registerMutationListener"])})}registerNodeTransformToKlass(e,t){let n=this.getRegisteredNode(e);return n.transforms.add(t),n}registerNodeTransform(e,t){let n=this.registerNodeTransformToKlass(e,t),r=[n],i=n.replaceWithKlass;if(null!=i){let e=this.registerNodeTransformToKlass(i,t);r.push(e)}return function(e,t){let n=AZ(e.getEditorState()),r=[];for(let e of t){let t=n.get(e);t&&r.push(t)}0!==r.length&&e.update(()=>{for(let e of r)for(let t of e.keys()){let e=Ae(t);e&&e.markDirty()}},null===e._pendingEditorState?{tag:S6}:void 0)}(this,r.map(e=>e.klass.getType())),()=>{r.forEach(e=>e.transforms.delete(t))}}hasNode(e){return this._nodes.has(e.getType())}hasNodes(e){return e.every(this.hasNode.bind(this))}dispatchCommand(e,t){return AA(this,e,t)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(e){let t=this._rootElement;if(e!==t){let n=Ak(this._config.theme,"root"),r=this._pendingEditorState||this._editorState;if(this._rootElement=e,EI(this,t,e,r),null!==t&&(this._config.disableEvents||function(e){let t=SE.get(e);if(void 0===t)return SQ();let n=SA.get(t);if(void 0===n)return SQ();let r=n-1;r>=0||kk(164),SE.delete(e),SA.set(t,r),0===r&&t.removeEventListener("selectionchange",SY);let i=EZ(e);EY(i)?(!function(e){if(null!==e._parentEditor){let t=Ad(e),n=t[t.length-1]._key;SJ.get(n)===e&&SJ.delete(n)}else SJ.delete(e._key)}(i),e.__lexicalEditor=null):i&&kk(198);let o=Sq(e);for(let e=0;e<o.length;e++)o[e]();e.__lexicalEventHandles=[]}(t),null!=n&&t.classList.remove(...n)),null!==e){let t=AD(e),r=e.style;r.userSelect="text",r.whiteSpace="pre-wrap",r.wordBreak="break-word",e.setAttribute("data-lexical-editor","true"),this._window=t,this._dirtyType=2,kQ(this),this._updateTags.add(S6),Ep(this),this._config.disableEvents||function(e,t){let n=e.ownerDocument;SE.set(e,n);let r=SA.get(n)??0;r<1&&n.addEventListener("selectionchange",SY),SA.set(n,r+1),e.__lexicalEditor=t;let i=Sq(e);for(let n=0;n<Sw.length;n++){let[r,o]=Sw[n],s="function"==typeof o?e=>{SZ(e)||(SX(e),(t.isEditable()||"click"===r)&&o(e,t))}:e=>{if(SZ(e))return;SX(e);let n=t.isEditable();switch(r){case"cut":return n&&AA(t,Sd,e);case"copy":return AA(t,Sc,e);case"paste":return n&&AA(t,_K,e);case"dragstart":return n&&AA(t,Sa,e);case"dragover":return n&&AA(t,Sl,e);case"dragend":return n&&AA(t,Su,e);case"focus":return n&&AA(t,Sy,e);case"blur":return n&&AA(t,Sv,e);case"drop":return n&&AA(t,So,e)}};e.addEventListener(r,s),i.push(()=>{e.removeEventListener(r,s)})}}(e,this),null!=n&&e.classList.add(...n)}else this._window=null,this._updateTags.add(S6),Ep(this);Em("root",this,!1,e,t)}}getElementByKey(e){return this._keyToDOMMap.get(e)||null}getEditorState(){return this._editorState}setEditorState(e,t){e.isEmpty()&&kk(38);let n=e;n._readOnly&&((n=EN(e))._selection=e._selection?e._selection.clone():null),kZ(this);let r=this._pendingEditorState,i=this._updateTags,o=void 0!==t?t.tag:null;null===r||r.isEmpty()||(null!=o&&i.add(o),Ep(this)),this._pendingEditorState=n,this._dirtyType=2,this._dirtyElements.set("root",!1),this._compositionKey=null,null!=o&&i.add(o),this._updating||Ep(this)}parseEditorState(e,t){return function(e,t,n){let r=Ej(),i=C8,o=C7,s=C9,a=t._dirtyElements,l=t._dirtyLeaves,u=t._cloneNotNeeded,c=t._dirtyType;t._dirtyElements=new Map,t._dirtyLeaves=new Set,t._cloneNotNeeded=new Set,t._dirtyType=0,C8=r,C7=!1,C9=t,EV=null;try{let i=t._nodes;Eh(e.root,i),n&&n(),r._readOnly=!0}catch(e){e instanceof Error&&t._onError(e)}finally{t._dirtyElements=a,t._dirtyLeaves=l,t._cloneNotNeeded=u,t._dirtyType=c,C8=i,C7=o,C9=s}return r}("string"==typeof e?JSON.parse(e):e,this,t)}read(e){return Ep(this),this.getEditorState().read(e,{editor:this})}update(e,t){this._updating?this._updates.push([e,t]):Ev(this,e,t)}focus(e,t={}){let n=this._rootElement;null!==n&&(n.setAttribute("autocapitalize","off"),Ex(this,()=>{var r;let i=CY(),o=As();null!==i?i.dirty||Al(i.clone()):0!==o.getChildrenSize()&&("rootStart"===t.defaultSelection?o.selectStart():o.selectEnd()),AP("focus"),r=()=>{n.removeAttribute("autocapitalize"),e&&e()},Ei(),Ea()._deferred.push(r)}),null===this._pendingEditorState&&n.removeAttribute("autocapitalize"))}blur(){let e=this._rootElement;null!==e&&e.blur();let t=A$(this._window);null!==t&&t.removeAllRanges()}isEditable(){return this._editable}setEditable(e){this._editable!==e&&(this._editable=e,Em("editable",this,!0,e))}toJSON(){return{editorState:this._editorState.toJSON()}}}EU.version="0.44.0+prod.esm";let EV=null,EW=1;function EH(e,t){let n=EK(e,t);return void 0===n&&kk(30,t),n}function EK(e,t){return e._nodes.get(t)}let EG="function"==typeof queueMicrotask?queueMicrotask:e=>{Promise.resolve().then(e)};function Eq(e){let t=document.activeElement;if(!AU(t))return!1;let n=t.nodeName;return EE(Ar(e))&&("INPUT"===n||"TEXTAREA"===n||"true"===t.contentEditable&&null==EZ(t))}function EJ(e,t,n){let r=e.getRootElement();try{return null!==r&&r.contains(t)&&r.contains(n)&&null!==t&&!Eq(t)&&EX(t)===e}catch(e){return!1}}function EY(e){return e instanceof EU}function EX(e){let t=e;for(;null!=t;){let e=EZ(t);if(EY(e))return e;t=AN(t)}return null}function EZ(e){return e?e.__lexicalEditor:null}function EQ(e){return CA(e)||e.isToken()}function E0(e){return EQ(e)||e.isSegmented()}function E1(e){return AV(e)&&3===e.nodeType}function E2(e){return AV(e)&&9===e.nodeType}function E5(e){let t=e;for(;null!=t;){if(E1(t))return t;t=t.firstChild}return null}function E3(e,t,n){let r=kz[t];if(null!==n&&(e&r)==(n&r))return e;let i=e^r;return"subscript"===t?i&=~kz.superscript:"superscript"===t?i&=~kz.subscript:"lowercase"===t?(i&=~kz.uppercase,i&=~kz.capitalize):"uppercase"===t?(i&=~kz.lowercase,i&=~kz.capitalize):"capitalize"===t&&(i&=~kz.lowercase,i&=~kz.uppercase),i}function E4(e,t){let n,r=(n=EV,EV=null,n);if(null!=(t=t||r&&r.__key))return void(e.__key=t);Ei(),Eo();let i=Ea(),o=Es(),s=""+EW++;o._nodeMap.set(s,e),E_(e)?i._dirtyElements.set(s,!0):i._dirtyLeaves.add(s),i._cloneNotNeeded.add(s),i._dirtyType=1,e.__key=s}function E6(e){let t=e.getParent();if(null!==t){let n=e.getWritable(),r=t.getWritable(),i=e.getPreviousSibling(),o=e.getNextSibling(),s=null!==o?o.__key:null,a=null!==i?i.__key:null,l=null!==i?i.getWritable():null,u=null!==o?o.getWritable():null;null===i&&(r.__first=s),null===o&&(r.__last=a),null!==l&&(l.__next=s),null!==u&&(u.__prev=a),n.__prev=null,n.__next=null,n.__parent=null,r.__size--}}function E8(e){Eo(),S2(e)&&kk(323,e.__key,e.__type);let t=e.getLatest(),n=t.__parent,r=Es(),i=Ea(),o=r._nodeMap,s=i._dirtyElements;null!==n&&function(e,t,n){let r=e;for(;null!==r;){if(n.has(r))return;let e=t.get(r);if(void 0===e)break;n.set(r,!1),r=e.__parent}}(n,o,s);let a=t.__key;i._dirtyType=1,E_(e)?s.set(a,!0):i._dirtyLeaves.add(a)}function E9(e){Ei();let t=Ea(),n=t._compositionKey;if(e!==n){if(t._compositionKey=e,null!==n){let e=Ae(n);null!==e&&e.getWritable()}if(null!==e){let t=Ae(e);null!==t&&t.getWritable()}}}function E7(){return Er()?null:Ea()._compositionKey}function Ae(e,t){let n=(t||Es())._nodeMap.get(e);return void 0===n?null:n}function At(e,t){let n=An(e,Ea());return void 0!==n?Ae(n,t):null}function An(e,t){return e[`__lexicalKey_${t._key}`]}function Ar(e,t){let n=e;for(;null!=n;){let e=At(n,t);if(null!==e)return e;n=AN(n)}return null}function Ai(e){let t=Object.assign({},e._decorators);return e._pendingDecorators=t,t}function Ao(e){return e.read(()=>As().getTextContent())}function As(){return Aa(Es())}function Aa(e){return e._nodeMap.get("root")}function Al(e){Ei();let t=Es();null!==e&&(e.dirty=!0,e.setCachedNodes(null)),t._selection=e}function Au(e){let t=Ea(),n=function(e,t){let n=e;for(;null!=n;){let e=An(n,t);if(void 0!==e)return e;n=AN(n)}return null}(e,t);return null===n?e===t.getRootElement()?Ae("root"):null:Ae(n)}function Ac(e){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(e)}function Ad(e){let t=[];for(let n=e;null!==n;n=n._parentEditor)t.push(n);return t}function Ah(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,5)}function Af(e){return E1(e)?e.nodeValue:null}function Ap(e,t,n){let r=A$(AR(t));if(null===r)return;let i=r.anchorNode,{anchorOffset:o,focusOffset:s}=r;if(null!==i){let t=Af(i),r=Ar(i);if(null!==t&&C_(r)){if((t===kL||t===kO)&&n){let e=n.length;t=n,o=e,s=e}null!==t&&Am(r,t,o,s,e)}}}function Am(e,t,n,r,i){let o=e;if(o.isAttached()&&(i||!o.isDirty())){let s=o.isComposing(),a=t;if((s||i)&&(t.endsWith(kL)&&(a=t.slice(0,-kL.length)),i)){let e;for(;-1!==(e=a.indexOf(kO));)a=a.slice(0,e)+a.slice(e+kO.length),null!==n&&n>e&&(n=Math.max(e,n-kO.length)),null!==r&&r>e&&(r=Math.max(e,r-kO.length))}let l=o.getTextContent();if(i||a!==l){if(""===a){if(E9(null),kP||kN||kR)o.remove();else{let e=Ea();setTimeout(()=>{e.update(()=>{o.isAttached()&&o.remove()})},20)}return}let t=o.getParent(),i=CX(),l=o.getTextContentSize(),u=E7(),c=o.getKey();if(o.isToken()||null!==u&&c===u&&!s||CD(i)&&(null!==t&&!t.canInsertTextBefore()&&0===i.anchor.offset||i.anchor.key===e.__key&&0===i.anchor.offset&&!o.canInsertTextBefore()&&!s||i.focus.key===e.__key&&i.focus.offset===l&&!o.canInsertTextAfter()&&!s))return void o.markDirty();let d=CY();if(!CD(d)||null===n||null===r)return void Ag(o,a,d);if(d.setTextNodeRange(o,n,o,r),o.isSegmented()){let e=Ck(o.getTextContent());o.replace(e),o=e}Ag(o,a,d)}}}function Ag(e,t,n){if(e.setTextContent(t),CD(n)){let t=e.getKey();for(let r of["anchor","focus"]){let i=n[r];"text"===i.type&&i.key===t&&(i.offset=Tc(e,i.offset,"clamp"))}}}function Ay(e,t,n){let r=t[n]||!1;return"any"===r||r===e[n]}function Av(e,t,n){if(!(Ay(e,n,"altKey")&&Ay(e,n,"ctrlKey")&&Ay(e,n,"shiftKey")&&Ay(e,n,"metaKey")))return!1;if(e.key.toLowerCase()===t.toLowerCase())return!0;if(t.length>1||1===e.key.length&&127>=e.key.charCodeAt(0))return!1;if(e.code.startsWith("Digit")&&/^\d$/.test(t))return e.code===`Digit${t}`;let r="Key"+t.toUpperCase();return e.code===r}let Ax={ctrlKey:!kE,metaKey:kE},Ab={altKey:kE,ctrlKey:!kE};function Aw(e){return"Backspace"===e.key}function Ak(e,t){void 0===e.__lexicalClassNameCache&&(e.__lexicalClassNameCache={});let n=e.__lexicalClassNameCache,r=n[t];if(void 0!==r)return r;let i=e[t];if("string"==typeof i){let e=TF(i);return n[t]=e,e}return i}function A_(e,t,n,r,i){if(0===n.size)return;let o=r.__type,s=r.__key,a=t.get(o);void 0===a&&kk(33,o);let l=a.klass,u=e.get(l);void 0===u&&(u=new Map,e.set(l,u));let c=u.get(s),d="destroyed"===c&&"created"===i;(void 0===c||d)&&u.set(s,d?"updated":i)}function AS(e,t,n){let r=e.getParent(),i=n,o=e;return null!==r&&(t&&0===n?(i=o.getIndexWithinParent(),o=r):t||n!==o.getChildrenSize()||(i=o.getIndexWithinParent()+1,o=r)),o.getChildAtIndex(t?i-1:i)}function AC(e,t){let n=e.offset;if("element"===e.type)return AS(e.getNode(),t,n);{let r=e.getNode();if(t&&0===n||!t&&n===r.getTextContentSize()){let e=t?r.getPreviousSibling():r.getNextSibling();return null===e?AS(r.getParentOrThrow(),t,r.getIndexWithinParent()+ +!t):e}}return null}function AE(e){let t=AR(e).event,n=t&&t.inputType;return"insertFromPaste"===n||"insertFromPasteAsQuotation"===n}function AA(e,t,n){return function e(t,n,r,i){let o,s=Ad(t);for(let e=4;e>=0;e--)for(let t=0;t<s.length;t++){let a=s[t];if(t>0&&a._updating){o=a;break}let l=a._commands.get(n);if(void 0!==l){let t=l[e];if(t.size>0){let e=!1;if(Ex(a,()=>{for(let n of t)if(n(r,i))return void(e=!0)}),e)return e}}}return o&&o.update(()=>{e(o,n,r,i)}),!1}(e,t,n,e)}function AT(e,t){let n=e._keyToDOMMap.get(t);return void 0===n&&kk(75,t),n}function AN(e){let t=e.assignedSlot||e.parentElement;return AW(t)?t.host:t}function Aj(e){return E2(e)?e:AU(e)?e.ownerDocument:null}function AP(e){Ei(),Ea()._updateTags.add(e)}function AM(e,t){let n=e.getParent();for(;null!==n;){if(n.is(t))return!0;n=n.getParent()}return!1}function AD(e){let t=Aj(e);return t?t.defaultView:null}function AR(e){let t=e._window;return null===t&&kk(78),t}function AL(e){return ET(e)||E_(e)&&e.isShadowRoot()}function AO(e,t=!1){let n=e.constructor.clone(e);return E4(n,null),n.afterCloneFrom(e),t||n.resetOnCopyNodeFrom(e),n}function AI(e){let t=Ea(),n=e.getType(),r=EK(t,n);void 0===r&&kk(200,e.constructor.name,n);let{replace:i,replaceWithKlass:o}=r;if(null!==i){let t=i(e),r=t.constructor;return null!==o?t instanceof o||kk(201,o.name,o.getType(),r.name,r.getType(),e.constructor.name,n):t instanceof e.constructor&&r!==e.constructor||kk(202,r.name,r.getType(),e.constructor.name,n),t.__key===e.__key&&kk(203,e.constructor.name,n,r.name,r.getType()),t}return e}function AF(e,t){!ET(e.getParent())||E_(t)||EE(t)||kk(99)}function Az(e){return(EE(e)||E_(e)&&!e.canBeEmpty())&&!e.isInline()}function AB(e,t,n){n.style.removeProperty("caret-color"),t._blockCursorElement=null;let r=e.parentElement;null!==r&&r.removeChild(e)}function A$(e){return kS?(e||window).getSelection():null}function AU(e){return AV(e)&&1===e.nodeType}function AV(e){return"object"==typeof e&&null!==e&&"nodeType"in e&&"number"==typeof e.nodeType}function AW(e){return AV(e)&&11===e.nodeType}function AH(e){let t=RegExp(/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|mark|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var|#text)$/,"i");return null!==e.nodeName.match(t)}function AK(e){let t=RegExp(/^(address|article|aside|blockquote|canvas|dd|div|dl|dt|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hr|li|main|nav|noscript|ol|p|pre|section|table|td|tfoot|ul|video)$/,"i");return null!==e.nodeName.match(t)}function AG(e){if(EE(e)&&!e.isInline())return!0;if(!E_(e)||AL(e))return!1;let t=e.getFirstChild(),n=null===t||Cs(t)||C_(t)||t.isInline();return!e.isInline()&&!1!==e.canBeEmpty()&&n}function Aq(){return Ea()}function AJ(e=Aq()){return e._config.dom||EF}let AY=new WeakMap,AX=new Map;function AZ(e){if(!e._readOnly&&e.isEmpty())return AX;e._readOnly||kk(192);let t=AY.get(e);return t||(t=function(e){let t=new Map;for(let[n,r]of e._nodeMap){let e=r.__type,i=t.get(e);i||(i=new Map,t.set(e,i)),i.set(n,r)}return t}(e),AY.set(e,t)),t}function AQ(e){let t=e.constructor.clone(e);return t.afterCloneFrom(e),t}function A0(e,t){let n=Math.round((parseInt(e.style.paddingInlineStart,10)||0)/40);t.setIndent(n)}function A1(e,t){return Object.prototype.hasOwnProperty.call(e,t)&&e[t]!==S5[t]}function A2(e){let t=kH in e.prototype?e.prototype[kH]():void 0,n=function(e){if(!(e===S5||e.prototype instanceof S5)){let t="<unknown>",n="<unknown>";try{t=e.getType()}catch(e){}try{EU.version&&(n=JSON.parse(EU.version))}catch(e){}kk(290,e.name,t,n)}return e===EC||e===Ek||e===S5}(e),r=!n&&A1(e,"getType")?e.getType():void 0,i,o=r;if(t)if(r)i=t[r];else for(let[e,n]of Object.entries(t))o=e,i=n;if(!n&&o&&(A1(e,"getType")||(e.getType=()=>o),A1(e,"clone")||(e.clone=t=>(EV=t,new e)),A1(e,"importJSON")||(e.importJSON=i&&i.$importJSON||(t=>(new e).updateFromJSON(t))),!A1(e,"importDOM")&&i)){let{importDOM:t}=i;t&&(e.importDOM=()=>t)}return{ownNodeConfig:i,ownNodeType:o}}let A5=(e,t)=>{let n=e;for(;null!=n&&!ET(n);){if(t(n))return n;n=n.getParent()}return null};function A3(e,t){let n=[],r=e.__first;for(;null!==r;){let e=null===t?Ae(r):t.get(r);null==e&&kk(174),n.push(r),r=e.__next}return n}let A4={next:"previous",previous:"next"};class A6{origin;constructor(e){this.origin=e}[Symbol.iterator](){return Ty({hasNext:Tr,initial:this.getAdjacentCaret(),map:e=>e,step:e=>e.getAdjacentCaret()})}getAdjacentCaret(){return Tl(this.getNodeAtCaret(),this.direction)}getSiblingCaret(){return Tl(this.origin,this.direction)}remove(){let e=this.getNodeAtCaret();return e&&e.remove(),this}replaceOrInsert(e,t){let n=this.getNodeAtCaret();return e.is(this.origin)||e.is(n)||(null===n?this.insert(e):n.replace(e,t)),this}splice(e,t,n="next"){let r=n===this.direction?t:Array.from(t).reverse(),i=this,o=this.getParentAtCaret(),s=new Map;for(let t=i.getAdjacentCaret();null!==t&&s.size<e;t=t.getAdjacentCaret()){let e=t.origin.getWritable();s.set(e.getKey(),e)}for(let e of r){if(s.size>0){let t=i.getNodeAtCaret();if(t)if(s.delete(t.getKey()),s.delete(e.getKey()),t.is(e)||i.origin.is(e));else{let n=e.getParent();n&&n.is(o)&&e.remove(),t.replace(e)}else null===t&&kk(263,Array.from(s).join(" "))}else i.insert(e);i=Tl(e,this.direction)}for(let e of s.values())e.remove();return this}}class A8 extends A6{type="child";getLatest(){let e=this.origin.getLatest();return e===this.origin?this:Td(e,this.direction)}getParentCaret(e="root"){return Tl(A7(this.getParentAtCaret(),e),this.direction)}getFlipped(){let e=A4[this.direction];return Tl(this.getNodeAtCaret(),e)||Td(this.origin,e)}getParentAtCaret(){return this.origin}getChildCaret(){return this}isSameNodeCaret(e){return e instanceof A8&&this.direction===e.direction&&this.origin.is(e.origin)}isSamePointCaret(e){return this.isSameNodeCaret(e)}}let A9={root:ET,shadowRoot:AL};function A7(e,t="root"){return A9[t](e)?null:e}class Te extends A6{type="sibling";getLatest(){let e=this.origin.getLatest();return e===this.origin?this:Tl(e,this.direction)}getSiblingCaret(){return this}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return E_(this.origin)?Td(this.origin,this.direction):null}getParentCaret(e="root"){return Tl(A7(this.getParentAtCaret(),e),this.direction)}getFlipped(){let e=A4[this.direction];return Tl(this.getNodeAtCaret(),e)||Td(this.origin.getParentOrThrow(),e)}isSamePointCaret(e){return e instanceof Te&&this.direction===e.direction&&this.origin.is(e.origin)}isSameNodeCaret(e){return(e instanceof Te||e instanceof Tt)&&this.direction===e.direction&&this.origin.is(e.origin)}}class Tt extends A6{type="text";offset;constructor(e,t){super(e),this.offset=t}getLatest(){let e=this.origin.getLatest();return e===this.origin?this:Tu(e,this.direction,this.offset)}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return null}getParentCaret(e="root"){return Tl(A7(this.getParentAtCaret(),e),this.direction)}getFlipped(){return Tu(this.origin,A4[this.direction],this.offset)}isSamePointCaret(e){return e instanceof Tt&&this.direction===e.direction&&this.origin.is(e.origin)&&this.offset===e.offset}isSameNodeCaret(e){return(e instanceof Te||e instanceof Tt)&&this.direction===e.direction&&this.origin.is(e.origin)}getSiblingCaret(){return Tl(this.origin,this.direction)}}function Tn(e){return e instanceof Tt}function Tr(e){return e instanceof Te}function Ti(e){return e instanceof A8}let To={next:class extends Tt{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends Tt{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},Ts={next:class extends Te{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends Te{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},Ta={next:class extends A8{direction="next";getNodeAtCaret(){return this.origin.getFirstChild()}insert(e){return this.origin.splice(0,0,[e]),this}},previous:class extends A8{direction="previous";getNodeAtCaret(){return this.origin.getLastChild()}insert(e){return this.origin.splice(this.origin.getChildrenSize(),0,[e]),this}}};function Tl(e,t){return e?new Ts[t](e):null}function Tu(e,t,n){return e?new To[t](e,Tc(e,n)):null}function Tc(e,t,n="error"){let r=e.getTextContentSize(),i="next"===t?r:"previous"===t?0:t;return(i<0||i>r)&&("clamp"!==n&&k_(284,String(t),String(r),e.getKey()),i=i<0?0:r),i}function Td(e,t){return E_(e)?new Ta[t](e):null}function Th(e){var t;return e&&((t=e.getAdjacentCaret())&&t.getChildCaret()||t)}class Tf{type="node-caret-range";direction;anchor;focus;constructor(e,t,n){this.anchor=e,this.focus=t,this.direction=n}getLatest(){let e=this.anchor.getLatest(),t=this.focus.getLatest();return e===this.anchor&&t===this.focus?this:new Tf(e,t,this.direction)}isCollapsed(){return this.anchor.isSamePointCaret(this.focus)}getTextSlices(){let e=e=>{let t=this[e].getLatest();return Tn(t)?function(e,t){let{direction:n,origin:r}=e;return new Tp(e,Tc(r,"focus"===t?A4[n]:n)-e.offset)}(t,e):null},t=e("anchor"),n=e("focus");if(t&&n){let{caret:e}=t,{caret:r}=n;if(e.isSameNodeCaret(r))return[new Tp(e,r.offset-e.offset),null]}return[t,n]}iterNodeCarets(e="root"){let t=Tn(this.anchor)?this.anchor.getSiblingCaret():this.anchor.getLatest(),n=this.focus.getLatest(),r=Tn(n),i=t=>t.isSameNodeCaret(n)?null:Th(t)||t.getParentCaret(e);return Ty({hasNext:e=>null!==e&&!(r&&n.isSameNodeCaret(e)),initial:t.isSameNodeCaret(n)?null:i(t),map:e=>e,step:i})}[Symbol.iterator](){return this.iterNodeCarets("root")}}class Tp{type="slice";caret;distance;constructor(e,t){this.caret=e,this.distance=t}getSliceIndices(){let{distance:e,caret:{offset:t}}=this,n=t+e;return n<t?[n,t]:[t,n]}getTextContent(){let[e,t]=this.getSliceIndices();return this.caret.origin.getTextContent().slice(e,t)}getTextContentSize(){return Math.abs(this.distance)}removeTextSlice(){let{caret:{origin:e,direction:t}}=this,[n,r]=this.getSliceIndices(),i=e.getTextContent();return Tu(e.setTextContent(i.slice(0,n)+i.slice(r)),t,n)}}function Tm(e){return Tg(e,Tl(As(),e.direction))}function Tg(e,t){return e.direction!==t.direction&&kk(265),new Tf(e,t,e.direction)}function Ty(e){let{initial:t,hasNext:n,step:r,map:i}=e,o=t;return{[Symbol.iterator](){return this},next(){if(!n(o))return{done:!0,value:void 0};let e={done:!1,value:i(o)};return o=r(o),e}}}function Tv(e,t){let n=Tw(e.origin,t.origin);switch(null===n&&kk(275,e.origin.getKey(),t.origin.getKey()),n.type){case"same":{let n="text"===e.type,r="text"===t.type;return n&&r?Math.sign(e.offset-t.offset):e.type===t.type?0:n?-1:r?1:"child"===e.type?-1:1}case"ancestor":return"child"===e.type?-1:1;case"descendant":return"child"===t.type?1:-1;case"branch":return Tx(n)}}function Tx(e){let{a:t,b:n}=e,r=t.__key,i=n.__key,o=t,s=n;for(;o&&s;o=o.getNextSibling(),s=s.getNextSibling()){if(o.__key===i)return -1;if(s.__key===r)return 1}return null===o?1:-1}function Tb(e){return E_(e)?[e.getLatest(),null]:[e.getParent(),e.getLatest()]}function Tw(e,t){if(e.is(t))return{commonAncestor:e,type:"same"};let n=new Map;for(let[t,r]=Tb(e);t;r=t,t=t.getParent())n.set(t,r);for(let[r,i]=Tb(t);r;i=r,r=r.getParent()){let o=n.get(r);if(void 0!==o)return null===o?(r.is(e)||kk(276),{commonAncestor:r,type:"ancestor"}):null===i?(r.is(t)||kk(277),{commonAncestor:r,type:"descendant"}):((E_(o)||o.is(e))&&(E_(i)||i.is(t))&&r.is(o.getParent())&&r.is(i.getParent())||kk(278),{a:o,b:i,commonAncestor:r,type:"branch"})}return null}function Tk(e,t){var n;let r,{type:i,key:o,offset:s}=e,a=(null===(r=Ae(n=e.key))&&kk(63,n),r);return"text"===i?(C_(a)||kk(266,a.getType(),o),Tu(a,t,s)):(E_(a)||kk(267,a.getType(),o),TR(a,e.offset,t))}function T_(e,t){let{origin:n,direction:r}=t,i="next"===r;Tn(t)?e.set(n.getKey(),t.offset,"text"):Tr(t)?C_(n)?e.set(n.getKey(),Tc(n,r),"text"):e.set(n.getParentOrThrow().getKey(),n.getIndexWithinParent()+ +!!i,"element"):(Ti(t)&&E_(n)||kk(268),e.set(n.getKey(),i?0:n.getChildrenSize(),"element"))}function TS(e){let t=CY(),n=CD(t)?t:CG();return TC(n,e),Al(n),n}function TC(e,t){T_(e.anchor,t.anchor),T_(e.focus,t.focus)}function TE(e){let{anchor:t,focus:n}=e,r=Tk(t,"next"),i=Tk(n,"next"),o=0>=Tv(r,i)?"next":"previous";return Tg(TM(r,o),TM(i,o))}function TA(e){let{direction:t,origin:n}=e,r=Tl(n,A4[t]).getNodeAtCaret();return r?Tl(r,t):Td(n.getParentOrThrow(),t)}function TT(e,t="root"){let n=[e];for(let r=Ti(e)?e.getParentCaret(t):e.getSiblingCaret();null!==r;r=r.getParentCaret(t))n.push(TA(r));return n}function TN(e){return!!e&&e.origin.isAttached()}function Tj(e){let t=function(e){let t=e;for(;Ti(t);){let e=Th(t);if(!Ti(e))break;t=e}return t}(e.getLatest()),{direction:n}=t;if(C_(t.origin))return Tn(t)?t:Tu(t.origin,n,n);let r=t.getAdjacentCaret();return Tr(r)&&C_(r.origin)?Tu(r.origin,n,A4[n]):t}function TP(e){return Tn(e)&&e.offset!==Tc(e.origin,e.direction)}function TM(e,t){return e.direction===t?e:e.getFlipped()}function TD(e,t){return e.direction===t?e:Tg(TM(e.focus,t),TM(e.anchor,t))}function TR(e,t,n){let r=Td(e,"next");for(let e=0;e<t;e++){let e=r.getAdjacentCaret();if(null===e)break;r=e}return TM(r,n)}function TL(e){let{origin:t,offset:n,direction:r}=e;if(n===Tc(t,r))return e.getSiblingCaret();if(n===Tc(t,A4[r]))return TA(e.getSiblingCaret());let[i]=t.splitText(n);return C_(i)||kk(281),TM(Tl(i,"next"),r)}function TO(e,t){return!0}function TI(e,t){if(!t||e===t)return e;for(let n in t)if(e[n]!==t[n])return{...e,...t};return e}function TF(...e){let t=[];for(let n of e)if(n&&"string"==typeof n)for(let[e]of n.matchAll(/\S+/g))t.push(e);return t}function Tz(...e){return()=>{for(let t=e.length-1;t>=0;t--)e[t]();e.length=0}}let TB="u">typeof window&&void 0!==window.document&&void 0!==window.document.createElement,T$=TB?T.useLayoutEffect:T.useEffect,TU={tag:S6};function TV({initialConfig:e,children:t}){let n=(0,T.useMemo)(()=>{let{theme:t,namespace:n,nodes:r,onError:i,editorState:o,html:s}=e,a={getTheme:function(){return null!=t?t:null}},l=Ez({editable:e.editable,html:s,namespace:n,nodes:r,onError:e=>i(e,l),theme:t});return function(e,t){if(null!==t){if(void 0===t)e.update(()=>{let t=As();if(t.isEmpty()){let n=EL();t.append(n);let r=TB?document.activeElement:null;(null!==CY()||null!==r&&r===e.getRootElement())&&n.select()}},TU);else if(null!==t)switch(typeof t){case"string":{let n=e.parseEditorState(t);e.setEditorState(n,TU);break}case"object":e.setEditorState(t,TU);break;case"function":e.update(()=>{As().isEmpty()&&t(e)},TU)}}}(l,o),[l,a]},[]);return T$(()=>{let t=e.editable,[r]=n;r.setEditable(void 0===t||t)},[]),(0,A.jsx)(kb.Provider,{value:n,children:t})}function TW(e){return()=>(function(e){if(!function(e,t=!0){if(e)return!1;let n=As().getTextContent();return t&&(n=n.trim()),""===n}(e,!1))return!1;let t=As().getChildren(),n=t.length;if(n>1)return!1;for(let e=0;e<n;e++){let n=t[e];if(EE(n))return!1;if(E_(n)){if(!EO(n)||0!==n.__indent)return!1;let t=n.getChildren(),r=t.length;for(let n=0;n<r;n++)if(!C_(t[e]))return!1}}return!0})(e)}let TH="u">typeof window&&void 0!==window.document&&void 0!==window.document.createElement?T.useLayoutEffect:T.useEffect,TK=(0,T.forwardRef)(function({editor:e,ariaActiveDescendant:t,ariaAutoComplete:n,ariaControls:r,ariaDescribedBy:i,ariaErrorMessage:o,ariaExpanded:s,ariaInvalid:a,ariaLabel:l,ariaLabelledBy:u,ariaMultiline:c,ariaOwns:d,ariaRequired:h,autoCapitalize:f,className:p,id:m,role:g="textbox",spellCheck:y=!0,style:v,tabIndex:x,"data-testid":b,...w},k){let[_,S]=(0,T.useState)(e.isEditable()),C=(0,T.useCallback)(t=>{t&&t.ownerDocument&&t.ownerDocument.defaultView?e.setRootElement(t):e.setRootElement(null)},[e]),E=(0,T.useMemo)(()=>(function(...e){return t=>{for(let n of e)"function"==typeof n?n(t):null!=n&&(n.current=t)}})(k,C),[C,k]);return TH(()=>(S(e.isEditable()),e.registerEditableListener(e=>{S(e)})),[e]),(0,A.jsx)("div",{"aria-activedescendant":_?t:void 0,"aria-autocomplete":_?n:"none","aria-controls":_?r:void 0,"aria-describedby":i,...null!=o?{"aria-errormessage":o}:{},"aria-expanded":_&&"combobox"===g?!!s:void 0,...null!=a?{"aria-invalid":a}:{},"aria-label":l,"aria-labelledby":u,"aria-multiline":c,"aria-owns":_?d:void 0,"aria-readonly":!_||void 0,"aria-required":h,autoCapitalize:f,className:p,contentEditable:_,"data-testid":b,id:m,ref:E,role:g,spellCheck:y,style:v,tabIndex:x,...w})});function TG(e){return e.getEditorState().read(TW(e.isComposing()))}let Tq=(0,T.forwardRef)(function(e,t){let{placeholder:n,...r}=e,[i]=kw();return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(TK,{editor:i,...r,ref:t}),null!=n&&(0,A.jsx)(TJ,{editor:i,content:n})]})});function TJ({content:e,editor:t}){let n=function(e){let[t,n]=(0,T.useState)(()=>TG(e));return TH(()=>{function t(){n(TG(e))}return t(),Tz(e.registerUpdateListener(()=>{t()}),e.registerEditableListener(()=>{t()}))},[e]),t}(t),[r,i]=(0,T.useState)(t.isEditable());if((0,T.useLayoutEffect)(()=>(i(t.isEditable()),t.registerEditableListener(e=>{i(e)})),[t]),!n)return null;let o=null;return"function"==typeof e?o=e(r):null!==e&&(o=e),null===o?null:(0,A.jsx)("div",{"aria-hidden":!0,children:o})}var TY=T;let TX=(0,TY.createContext)(null),TZ={didCatch:!1,error:null};class TQ extends TY.Component{constructor(e){super(e),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=TZ}static getDerivedStateFromError(e){return{didCatch:!0,error:e}}resetErrorBoundary(...e){let{error:t}=this.state;null!==t&&(this.props.onReset?.({args:e,reason:"imperative-api"}),this.setState(TZ))}componentDidCatch(e,t){this.props.onError?.(e,t)}componentDidUpdate(e,t){let{didCatch:n}=this.state,{resetKeys:r}=this.props;n&&null!==t.error&&function(e=[],t=[]){return e.length!==t.length||e.some((e,n)=>!Object.is(e,t[n]))}(e.resetKeys,r)&&(this.props.onReset?.({next:r,prev:e.resetKeys,reason:"keys"}),this.setState(TZ))}render(){let{children:e,fallbackRender:t,FallbackComponent:n,fallback:r}=this.props,{didCatch:i,error:o}=this.state,s=e;if(i){let e={error:o,resetErrorBoundary:this.resetErrorBoundary};if("function"==typeof t)s=t(e);else if(n)s=(0,TY.createElement)(n,e);else if(void 0!==r)s=r;else throw o}return(0,TY.createElement)(TX.Provider,{value:{didCatch:i,error:o,resetErrorBoundary:this.resetErrorBoundary}},s)}}function T0({children:e,onError:t}){return(0,A.jsx)(TQ,{fallback:(0,A.jsx)("div",{style:{border:"1px solid #f00",color:"#f00",padding:"8px"},children:"An error was thrown."}),onError:t,children:e})}function T1(e){let t=Aq().getElementByKey(e.getKey());if(null===t)return null;let n=t.ownerDocument.defaultView;return null===n?null:n.getComputedStyle(t)}function T2(e){return T1(ET(e)?e:e.getParentOrThrow())}function T5(e){let t=T2(e);return null!==t&&"rtl"===t.direction}function T3(e,t,n="self"){let r=e.getStartEndPoints();if(t.isSelected(e)&&!E0(t)&&null!==r){let[o,s]=r,a=e.isBackward(),l=o.getNode(),u=s.getNode(),c=t.is(l),d=t.is(u);if(c||d){var i;let[r,o]=CI(e),s=l.is(u),c=t.is(a?u:l),d=t.is(a?l:u),h,f=0;s?(f=r>o?o:r,h=r>o?r:o):c?(f=a?o:r,h=void 0):d&&(f=0,h=a?r:o);let p=t.__text.slice(f,h);p!==t.__text&&("clone"===n&&((i=AQ(t))[S1]=!0,t=i),t.__text=p)}}return t}let T4=()=>{};function T6(e){let t=T8(e);return null!==t&&"vertical-rl"===t.writingMode}function T8(e){let t=e.anchor.getNode();return E_(t)?T1(t):T2(t)}function T9(e,t){let n=T6(e)?!t:t;T7(e)&&(n=!n);let r=Tk(e.focus,n?"previous":"next");if(TP(r))return!1;for(let e of Tm(r)){if(Ti(e))return!e.origin.isInline();if(!E_(e.origin)){if(EE(e.origin))return!0;break}}return!1}function T7(e){let t=T8(e);return null!==t&&"rtl"===t.direction}function Ne(e,t,n){let r,i=T7(e);r=T6(e)||i?!n:n,e.modify(t?"extend":"move",r,"character")}let Nt="u">typeof window&&void 0!==window.document&&void 0!==window.document.createElement,Nn=Nt&&"documentMode"in document?document.documentMode:null;Nt&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Nt&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Nt&&"InputEvent"in window&&!Nn&&new window.InputEvent("input"),Nt&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&window.MSStream,Nt&&/Android/.test(navigator.userAgent),Nt&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),Nt&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Nt&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent);function Nr(e,t){return null!==e&&Object.getPrototypeOf(e).constructor.name===t.name}function Ni(e){let t=CY();if(!CD(t))return!1;let n=new Set,r=t.getNodes();for(let t=0;t<r.length;t++){let i=r[t],o=i.getKey();if(n.has(o))continue;let s=A5(i,e=>E_(e)&&!e.isInline());if(null===s)continue;let a=s.getKey();s.canIndent()&&!n.has(a)&&(n.add(a),e(s))}return n.size>0}let No=Symbol.for("preact-signals");function Ns(){if(Nu>1)return void Nu--;let e,t=!1;for(!function(){let e=Nl;for(Nl=void 0;void 0!==e;)e.S.v===e.v&&(e.S.i=e.i),e=e.o}();void 0!==l;){let n=l;for(l=void 0,Nc++;void 0!==n;){let r=n.u;if(n.u=void 0,n.f&=-3,!(8&n.f)&&Nm(n))try{n.c()}catch(n){t||(e=n,t=!0)}n=r}}if(Nc=0,Nu--,t)throw e}function Na(e){let t=a;a=void 0;try{return e()}finally{a=t}}let Nl,Nu=0,Nc=0,Nd=0,Nh=0;function Nf(e){if(void 0===a)return;let t=e.n;return void 0===t||t.t!==a?(t={i:0,S:e,p:a.s,n:void 0,t:a,e:void 0,x:void 0,r:t},void 0!==a.s&&(a.s.n=t),a.s=t,e.n=t,32&a.f&&e.S(t),t):-1===t.i?(t.i=0,void 0!==t.n&&(t.n.p=t.p,void 0!==t.p&&(t.p.n=t.n),t.p=a.s,t.n=void 0,a.s.n=t,a.s=t),t):void 0}function Np(e,t){this.v=e,this.i=0,this.n=void 0,this.t=void 0,this.l=0,this.W=null==t?void 0:t.watched,this.Z=null==t?void 0:t.unwatched,this.name=null==t?void 0:t.name}function Nm(e){for(let t=e.s;void 0!==t;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function Ng(e){for(let t=e.s;void 0!==t;t=t.n){let n=t.S.n;if(void 0!==n&&(t.r=n),t.S.n=t,t.i=-1,void 0===t.n){e.s=t;break}}}function Ny(e){let t,n=e.s;for(;void 0!==n;){let e=n.p;-1===n.i?(n.S.U(n),void 0!==e&&(e.n=n.n),void 0!==n.n&&(n.n.p=e)):t=n,n.S.n=n.r,void 0!==n.r&&(n.r=void 0),n=e}e.s=t}function Nv(e,t){Np.call(this,void 0),this.x=e,this.s=void 0,this.g=Nh-1,this.f=4,this.W=null==t?void 0:t.watched,this.Z=null==t?void 0:t.unwatched,this.name=null==t?void 0:t.name}function Nx(e){let t=e.m;if(e.m=void 0,"function"==typeof t){Nu++;let n=a;a=void 0;try{t()}catch(t){throw e.f&=-2,e.f|=8,Nb(e),t}finally{a=n,Ns()}}}function Nb(e){for(let t=e.s;void 0!==t;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,Nx(e)}function Nw(e){if(a!==this)throw Error("Out-of-order effect");Ny(this),a=e,this.f&=-2,8&this.f&&Nb(this),Ns()}function Nk(e,t){this.x=e,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=null==t?void 0:t.name}function N_(e,t){let n=new Nk(e,t);try{n.c()}catch(e){throw n.d(),e}let r=n.d.bind(n);return r[Symbol.dispose]=r,r}function NS(e,t={}){let n={};for(let r in e){let i=t[r],o=new Np(void 0===i?e[r]:i,void 0);n[r]=o}return n}function NC(e){return("function"==typeof e.nodes?e.nodes():e.nodes)||[]}Np.prototype.brand=No,Np.prototype.h=function(){return!0},Np.prototype.S=function(e){let t=this.t;t!==e&&void 0===e.e&&(e.x=t,this.t=e,void 0!==t?t.e=e:Na(()=>{var e;null==(e=this.W)||e.call(this)}))},Np.prototype.U=function(e){if(void 0!==this.t){let t=e.e,n=e.x;void 0!==t&&(t.x=n,e.e=void 0),void 0!==n&&(n.e=t,e.x=void 0),e===this.t&&(this.t=n,void 0===n&&Na(()=>{var e;null==(e=this.Z)||e.call(this)}))}},Np.prototype.subscribe=function(e){return N_(()=>{let t=this.value,n=a;a=void 0;try{e(t)}finally{a=n}},{name:"sub"})},Np.prototype.valueOf=function(){return this.value},Np.prototype.toString=function(){return this.value+""},Np.prototype.toJSON=function(){return this.value},Np.prototype.peek=function(){let e=a;a=void 0;try{return this.value}finally{a=e}},Object.defineProperty(Np.prototype,"value",{get(){let e=Nf(this);return void 0!==e&&(e.i=this.i),this.v},set(e){if(e!==this.v){if(Nc>100)throw Error("Cycle detected");0!==Nu&&0===Nc&&this.l!==Nd&&(this.l=Nd,Nl={S:this,v:this.v,i:this.i,o:Nl}),this.v=e,this.i++,Nh++,Nu++;try{for(let e=this.t;void 0!==e;e=e.x)e.t.N()}finally{Ns()}}}}),Nv.prototype=new Np,Nv.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if(32==(36&this.f)||(this.f&=-5,this.g===Nh))return!0;if(this.g=Nh,this.f|=1,this.i>0&&!Nm(this))return this.f&=-2,!0;let e=a;try{Ng(this),a=this;let e=this.x();(16&this.f||this.v!==e||0===this.i)&&(this.v=e,this.f&=-17,this.i++)}catch(e){this.v=e,this.f|=16,this.i++}return a=e,Ny(this),this.f&=-2,!0},Nv.prototype.S=function(e){if(void 0===this.t){this.f|=36;for(let e=this.s;void 0!==e;e=e.n)e.S.S(e)}Np.prototype.S.call(this,e)},Nv.prototype.U=function(e){if(void 0!==this.t&&(Np.prototype.U.call(this,e),void 0===this.t)){this.f&=-33;for(let e=this.s;void 0!==e;e=e.n)e.S.U(e)}},Nv.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(let e=this.t;void 0!==e;e=e.x)e.t.N()}},Object.defineProperty(Nv.prototype,"value",{get(){if(1&this.f)throw Error("Cycle detected");let e=Nf(this);if(this.h(),void 0!==e&&(e.i=this.i),16&this.f)throw this.v;return this.v}}),Nk.prototype.c=function(){let e=this.S();try{if(8&this.f||void 0===this.x)return;let e=this.x();"function"==typeof e&&(this.m=e)}finally{e()}},Nk.prototype.S=function(){if(1&this.f)throw Error("Cycle detected");this.f|=1,this.f&=-9,Nx(this),Ng(this),Nu++;let e=a;return a=this,Nw.bind(this,e)},Nk.prototype.N=function(){2&this.f||(this.f|=2,this.u=l,l=this)},Nk.prototype.d=function(){this.f|=8,1&this.f||Nb(this)},Nk.prototype.dispose=function(){this.d()};new k0("format",{parse:e=>"number"==typeof e?e:0});function NE(e,...t){let n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;for(let n of(r.append("code",e),t))r.append("v",n);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}let NA=new Set;class NT{builder;configs;_dependency;_peerNameSet;extension;state;_signal;constructor(e,t){this.builder=e,this.extension=t,this.configs=new Set,this.state={id:0}}mergeConfigs(){let e=this.extension.config||{},t=this.extension.mergeConfig?this.extension.mergeConfig.bind(this.extension):TI;for(let n of this.configs)e=t(e,n);return e}init(e){let t,n=this.state;2===n.id||NE(306,String(n.id));let r={getDependency:this.getInitDependency.bind(this),getDirectDependentNames:this.getDirectDependentNames.bind(this),getPeer:this.getInitPeer.bind(this),getPeerNameSet:this.getPeerNameSet.bind(this)},i={...r,getDependency:this.getDependency.bind(this),getInitResult:this.getInitResult.bind(this),getPeer:this.getPeer.bind(this)},o=Object.assign(n,{config:this.mergeConfigs(),id:3,registerState:r});this.state=o,this.extension.init&&(t=this.extension.init(e,o.config,r)),this.state=Object.assign(o,{id:4,initResult:t,registerState:i})}build(e){let t,n=this.state;4!==n.id&&NE(307,String(n.id),String(5)),this.extension.build&&(t=this.extension.build(e,n.config,n.registerState));let r={...n.registerState,getOutput:()=>t,getSignal:this.getSignal.bind(this)};this.state=Object.assign(n,{id:5,output:t,registerState:r})}register(e,t){this._signal=t;let n=this.state;5!==n.id&&NE(308,String(n.id),String(5));let r=this.extension.register&&this.extension.register(e,n.config,n.registerState);return this.state=Object.assign(n,{id:6}),()=>{let e=this.state;7!==e.id&&NE(309,String(n.id),String(7)),this.state=Object.assign(e,{id:5}),r&&r()}}afterRegistration(e){let t,n=this.state;return 6!==n.id&&NE(310,String(n.id),String(6)),this.extension.afterRegistration&&(t=this.extension.afterRegistration(e,n.config,n.registerState)),this.state=Object.assign(n,{id:7}),t}getSignal(){return void 0===this._signal&&NE(311),this._signal}getInitResult(){void 0===this.extension.init&&NE(312,this.extension.name);let e=this.state;return e.id>=4||NE(313,String(e.id),String(4)),e.initResult}getInitPeer(e){let t=this.builder.extensionNameMap.get(e);return t?t.getExtensionInitDependency():void 0}getExtensionInitDependency(){let e=this.state;return e.id>=3||NE(314,String(e.id),String(3)),{config:e.config}}getPeer(e){let t=this.builder.extensionNameMap.get(e);return t?t.getExtensionDependency():void 0}getInitDependency(e){let t=this.builder.getExtensionRep(e);return void 0===t&&NE(315,this.extension.name,e.name),t.getExtensionInitDependency()}getDependency(e){let t=this.builder.getExtensionRep(e);return void 0===t&&NE(315,this.extension.name,e.name),t.getExtensionDependency()}getState(){let e=this.state;return e.id>=7||NE(316,String(e.id),String(7)),e}getDirectDependentNames(){return this.builder.incomingEdges.get(this.extension.name)||NA}getPeerNameSet(){let e=this._peerNameSet;return e||(e=new Set((this.extension.peerDependencies||[]).map(([e])=>e)),this._peerNameSet=e),e}getExtensionDependency(){if(!this._dependency){let e=this.state;e.id>=5||NE(317,this.extension.name),this._dependency={config:e.config,init:e.initResult,output:e.output}}return this._dependency}}let NN={tag:S6};function Nj(){let e=As();e.isEmpty()&&e.append(EL())}let NP={config:{setOptions:NN,updateOptions:NN},init:({$initialEditorState:e=Nj})=>({$initialEditorState:e,initialized:!1}),afterRegistration(e,{updateOptions:t,setOptions:n},r){let i=r.getInitResult();if(!i.initialized){i.initialized=!0;let{$initialEditorState:r}=i;if(r instanceof EP)e.setEditorState(r,n);else if("function"==typeof r)e.update(()=>{r(e)},t);else if(r&&("string"==typeof r||"object"==typeof r)){let t=e.parseEditorState(r);e.setEditorState(t,n)}}return()=>{}},name:"@lexical/extension/InitialState",nodes:[EA,Cp,Cr,CC,ED]},NM=Symbol.for("@lexical/extension/LexicalBuilder");function ND(){}function NR(e){throw e}function NL(e){return Array.isArray(e)?e:[e]}let NO="0.44.0+prod.esm";class NI{roots;extensionNameMap;outgoingConfigEdges;incomingEdges;conflicts;_sortedExtensionReps;PACKAGE_VERSION;constructor(e){for(const t of(this.outgoingConfigEdges=new Map,this.incomingEdges=new Map,this.extensionNameMap=new Map,this.conflicts=new Map,this.PACKAGE_VERSION=NO,this.roots=e,e))this.addExtension(t)}static fromExtensions(e){let t=[NL(NP)];for(let n of e)t.push(NL(n));return new NI(t)}static maybeFromEditor(e){let t=e[NM];return t&&(t.PACKAGE_VERSION!==NO&&NE(292,t.PACKAGE_VERSION,NO),t instanceof NI||NE(293)),t}static fromEditor(e){let t=NI.maybeFromEditor(e);return void 0===t&&NE(294),t}constructEditor(){let{$initialEditorState:e,onError:t,...n}=this.buildCreateEditorArgs(),r=Object.assign(Ez({...n,...t?{onError:e=>{t(e,r)}}:{}}),{[NM]:this});for(let e of this.sortedExtensionReps())e.build(r);return r}buildEditor(){let e=ND;function t(){try{e()}finally{e=ND}}let n=Object.assign(this.constructEditor(),{dispose:t,[Symbol.dispose]:t});return e=Tz(this.registerEditor(n),()=>n.setRootElement(null)),n}hasExtensionByName(e){return this.extensionNameMap.has(e)}getExtensionRep(e){let t=this.extensionNameMap.get(e.name);if(t)return t.extension!==e&&NE(295,e.name),t}addEdge(e,t,n){let r=this.outgoingConfigEdges.get(e);r?r.set(t,n):this.outgoingConfigEdges.set(e,new Map([[t,n]]));let i=this.incomingEdges.get(t);i?i.add(e):this.incomingEdges.set(t,new Set([e]))}addExtension(e){void 0!==this._sortedExtensionReps&&NE(296);let[t]=NL(e);"string"!=typeof t.name&&NE(297,typeof t.name);let n=this.extensionNameMap.get(t.name);if(void 0!==n&&n.extension!==t&&NE(298,t.name),!n){n=new NT(this,t),this.extensionNameMap.set(t.name,n);let e=this.conflicts.get(t.name);for(let n of("string"==typeof e&&NE(299,t.name,e),t.conflictsWith||[]))this.extensionNameMap.has(n)&&NE(299,t.name,n),this.conflicts.set(n,t.name);for(let e of t.dependencies||[]){let n=NL(e);this.addEdge(t.name,n[0].name,n.slice(1)),this.addExtension(n)}for(let[e,n]of t.peerDependencies||[])this.addEdge(t.name,e,n?[n]:[])}}sortedExtensionReps(){if(this._sortedExtensionReps)return this._sortedExtensionReps;let e=[],t=(n,r)=>{var i,o;let s=n.state;if(2===s.id)return;let a=n.extension.name;0===s.id||NE(300,a,r||"[unknown]"),0===(i=s).id||NE(304,String(i.id),String(0)),n.state=s=Object.assign(i,{id:1});let l=this.outgoingConfigEdges.get(a);if(l)for(let e of l.keys()){let n=this.extensionNameMap.get(e);n&&t(n,a)}1===(o=s).id||NE(305,String(o.id),String(1)),n.state=s=Object.assign(o,{id:2}),e.push(n)};for(let e of this.extensionNameMap.values())0===e.state.id&&t(e);for(let t of e)for(let[e,n]of this.outgoingConfigEdges.get(t.extension.name)||[])if(n.length>0){let t=this.extensionNameMap.get(e);if(t)for(let e of n)t.configs.add(e)}for(let[e,...t]of this.roots)if(t.length>0){let n=this.extensionNameMap.get(e.name);for(let r of(void 0===n&&NE(301,e.name),t))n.configs.add(r)}return this._sortedExtensionReps=e,this._sortedExtensionReps}registerEditor(e){let t=this.sortedExtensionReps(),n=new AbortController,r=[()=>n.abort()],i=n.signal;for(let n of t){let t=n.register(e,i);t&&r.push(t)}for(let n of t){let t=n.afterRegistration(e);t&&r.push(t)}return Tz(...r)}buildCreateEditorArgs(){let e={},t=new Set,n=new Map,r=new Map,i={},o={},s=this.sortedExtensionReps();for(let a of s){let{extension:s}=a;if(void 0!==s.onError&&(e.onError=s.onError),void 0!==s.disableEvents&&(e.disableEvents=s.disableEvents),void 0!==s.parentEditor&&(e.parentEditor=s.parentEditor),void 0!==s.editable&&(e.editable=s.editable),void 0!==s.namespace&&(e.namespace=s.namespace),void 0!==s.$initialEditorState&&(e.$initialEditorState=s.$initialEditorState),s.nodes)for(let e of NC(s)){if("function"!=typeof e){let t=n.get(e.replace);t&&NE(302,s.name,e.replace.name,t.extension.name),n.set(e.replace,a)}t.add(e)}if(s.html){if(s.html.export)for(let[e,t]of s.html.export.entries())r.set(e,t);s.html.import&&Object.assign(i,s.html.import)}s.theme&&function e(t,n){if(t&&n&&!Array.isArray(n)&&"object"==typeof t&&"object"==typeof n){for(let r in n)t[r]=e(t[r],n[r]);return t}return n}(o,s.theme)}Object.keys(o).length>0&&(e.theme=o),t.size&&(e.nodes=[...t]);let a=Object.keys(i).length>0,l=r.size>0;for(let t of((a||l)&&(e.html={},a&&(e.html.import=i),l&&(e.html.export=r)),s))t.init(e);return e.onError||(e.onError=NR),e}}function NF(e,t){let n=NI.fromEditor(e).getExtensionRep(t);return void 0===n&&NE(303,t.name),n.getExtensionDependency()}_R("INSERT_HORIZONTAL_RULE_COMMAND");function Nz(e){e.undoStack=[],e.redoStack=[],e.current=null}function NB(e,t,n,r=Date.now){let i,o,s,a,l,u=(i=r(),o=0,s=i,a=0,l=null,(t,u,c,d,h,f)=>{let p=r();if(f.has(S9)&&(s=i,a=o,l=t),f.has(S4))return o=0,i=p,2;f.has(S7)&&l&&(i=s,o=a,t=l);let m=function(e,t,n,r,i){if(null===e||0===n.size&&0===r.size&&!i)return 0;let o=t._selection,s=e._selection;if(i)return 1;if(!(CD(o)&&CD(s)&&s.isCollapsed()&&o.isCollapsed()))return 0;let a=function(e,t,n){let r=e._nodeMap,i=[];for(let e of t){let t=r.get(e);void 0!==t&&i.push(t)}for(let[e,t]of n){if(!t)continue;let n=r.get(e);void 0===n||ET(n)||i.push(n)}return i}(t,n,r);if(0===a.length)return 0;if(a.length>1){let n=t._nodeMap,r=n.get(o.anchor.key),i=n.get(s.anchor.key);return r&&i&&!e._nodeMap.has(r.__key)&&C_(r)&&1===r.__text.length&&1===o.anchor.offset?2:0}let l=a[0],u=e._nodeMap.get(l.__key);if(!C_(u)||!C_(l)||u.__mode!==l.__mode)return 0;let c=u.__text,d=l.__text;if(c===d)return 0;let h=o.anchor,f=s.anchor;if(h.key!==f.key||"text"!==h.type)return 0;let p=h.offset,m=f.offset,g=d.length-c.length;return 1===g&&m===p-1?2:-1===g&&m===p+1?3:4*(-1===g&&m===p)}(t,u,d,h,e.isComposing()),g=(()=>{var r,s;let a,l,g,y,v=null===c||c.editor===e,x=f.has("history-push");if(!x&&v&&f.has(S6))return 0;if(1===m)return 2;if(null===t)return 1;let b=u._selection;if(!(d.size>0||h.size>0))return 2*(null===b);let w="number"==typeof n?n:n.peek();return!1===x&&0!==m&&m===o&&p<i+w&&v?0:1!==d.size||(r=Array.from(d)[0],a=(s=t)._nodeMap.get(r),l=u._nodeMap.get(r),g=s._selection,y=u._selection,CD(g)&&CD(y)&&"element"===g.anchor.type&&"element"===g.focus.type&&"text"===y.anchor.type&&"text"===y.focus.type||!C_(a)||!C_(l)||a.__parent!==l.__parent||JSON.stringify(s.read(()=>a.exportJSON()))!==JSON.stringify(u.read(()=>l.exportJSON())))?1:0})();return i=p,o=m,g});return Tz(e.registerCommand(_X,()=>((function(e,t){let n=t.redoStack,r=t.undoStack;if(0!==r.length){let i=t.current,o=r.pop();null!==i&&(n.push(i),e.dispatchCommand(Sm,!0)),0===r.length&&e.dispatchCommand(Sg,!1),t.current=o||null,o&&o.editor.setEditorState(o.editorState,{tag:S4})}})(e,t),!0),0),e.registerCommand(_Z,()=>((function(e,t){let n=t.redoStack,r=t.undoStack;if(0!==n.length){let i=t.current;null!==i&&(r.push(i),e.dispatchCommand(Sg,!0));let o=n.pop();0===n.length&&e.dispatchCommand(Sm,!1),t.current=o||null,o&&o.editor.setEditorState(o.editorState,{tag:S4})}})(e,t),!0),0),e.registerCommand(Sf,()=>(Nz(t),!1),0),e.registerCommand(Sp,()=>(Nz(t),e.dispatchCommand(Sm,!1),e.dispatchCommand(Sg,!1),!0),0),e.registerUpdateListener(({editorState:n,prevEditorState:r,dirtyLeaves:i,dirtyElements:o,tags:s})=>{let a=t.current,l=t.redoStack,c=t.undoStack,d=null===a?null:a.editorState;if(null!==a&&n===d)return;let h=u(r,n,a,i,o,s);if(1===h)0!==l.length&&(t.redoStack=[],e.dispatchCommand(Sm,!1)),null!==a&&(c.push({...a}),e.dispatchCommand(Sg,!0));else if(2===h)return;t.current={editor:e,editorState:n}}))}function N$(){return{current:null,redoStack:[],undoStack:[]}}function NU({delay:e,externalHistoryState:t}){let[n]=kw();return function(e,t,n=1e3){let r=(0,T.useMemo)(()=>t||N$(),[t]);(0,T.useEffect)(()=>NB(e,r,n),[n,e,r])}(n,t,e),null}let NV="u">typeof window&&void 0!==window.document&&void 0!==window.document.createElement?T.useLayoutEffect:T.useEffect;function NW({ignoreHistoryMergeTagChange:e=!0,ignoreSelectionChange:t=!1,onChange:n}){let[r]=kw();return NV(()=>{if(n)return r.registerUpdateListener(({editorState:i,dirtyElements:o,dirtyLeaves:s,prevEditorState:a,tags:l})=>{t&&0===o.size&&0===s.size||e&&l.has(S6)||a.isEmpty()||n(i,r,l)})},[r,e,t,n]),null}let NH="u">typeof window&&void 0!==window.document&&void 0!==window.document.createElement?T.useLayoutEffect:T.useEffect;function NK(e){return{initialValueFn:()=>e.isEditable(),subscribe:t=>e.registerEditableListener(t)}}function NG(e){let t=window.location.origin,n=n=>{if(n.origin!==t)return;let r=e.getRootElement();if(document.activeElement!==r)return;let i=n.data;if("string"==typeof i){let t;try{t=JSON.parse(i)}catch(e){return}if(t&&"nuanria_messaging"===t.protocol&&"request"===t.type){let r=t.payload;if(r&&"makeChanges"===r.functionId){let t=r.args;if(t){let[r,i,o,s,a]=t;e.update(()=>{let e=CY();if(CD(e)){let t=e.anchor,l=t.getNode(),u=0,c=0;if(C_(l)&&r>=0&&i>=0&&(u=r,c=r+i,e.setTextNodeRange(l,u,l,c)),u===c&&""===o||(e.insertRawText(o),l=t.getNode()),C_(l)){u=s,c=s+a;let t=l.getTextContentSize();u=u>t?t:u,c=c>t?t:c,e.setTextNodeRange(l,u,l,c)}n.stopImmediatePropagation()}})}}}}};return window.addEventListener("message",n,!0),()=>{window.removeEventListener("message",n,!0)}}function Nq(e,...t){let n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;for(let n of(r.append("code",e),t))r.append("v",n);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function NJ(e,t){let{key:n}=t;return e&&n in e?e[n]:t.defaultValue}function NY(e){return u&&u.editor===e?u:void 0}function NX(e,t){let n=t;for(let r of e){let[e,i]=function(e,t){if("cfg"in t){let{cfg:n,updater:r}=t;return[n,r(NJ(e,n))]}return t}(n,r),o=e.key;if(n===t&&NJ(n,e)===i)continue;let s=n||Object.create(t||null);s[o]=i,n=s}return n}let NZ="@lexical/html/DOM",NQ=Symbol.for("@lexical/html/DOMExportContext"),N0=()=>!0;function N1(e){return(t,n,r)=>e(t,r)}function N2(e){return(t,n,r,i)=>e(t,n,i)}function N5(e){return(t,n,r,i,o)=>e(t,n,r,o)}function N3(e){return(t,n,r,i,o,s)=>e(t,n,r,i,s)}function N4(e,t){return(n,r)=>{let i=()=>e(n,r),o=t(n);return o?o(n,i,r):i()}}function N6(e,t){return(n,r,i)=>{let o=()=>e(n,r,i),s=t(n);return s?s(n,r,o,i):o()}}function N8(e,t){return(n,r,i,o)=>{let s=()=>e(n,r,i,o),a=t(n);return a?a(n,r,i,s,o):s()}}function N9(e,t){return(n,r,i,o,s)=>{let a=()=>e(n,r,i,o,s),l=t(n);return l?l(n,r,i,o,a,s):a()}}function N7(e,t){return(n,r,i,o)=>{e(n,r,i,o);let s=t(n);s&&s(n,r,i,o)}}function je(e,t,n,r,i){let o=n[t];for(let n of e[t])if("function"==typeof n[0]){let[e,t]=n;o=r(o,n=>e(n)&&t||void 0)}else{let e=n[1],t={};for(let n in e){let i=e[n];i&&(t[n]=i.reduce((e,t)=>r(e,()=>t),o))}o=r(o,e=>{let n=t[e.getType()];return n&&i(n)})}n[t]=o}function jt(e){return e}let jn={build:(e,t,n)=>({defaults:NX(t.contextDefaults,void 0)}),config:{contextDefaults:[],overrides:[]},html:{export:new Map([[EA,()=>{let e=document.createElement("div");return e.role="textbox",{element:e}}]])},init(e,t){e.dom=function(e,{overrides:t}){let n=function(e,t){let n=function(e){let t={},{nodes:n}=function(e){let t=new Set,n=new Set;for(let r of NC(e)){let e="function"==typeof r?r:r.replace;A2(e),t.add(e.getType()),n.add(e)}return{nodes:n,types:t}}(e);for(let e of n)t[e.getType()]={klass:e,types:{}};for(let e of Object.values(t))if(e){let n=e.klass.getType();for(let{klass:r}=e;S3(r.prototype);r=Object.getPrototypeOf(r)){let{ownNodeType:e}=A2(r),i=e&&t[e];i&&(i.types[n]=!0)}}return t}(e),r={$createDOM:[],$decorateDOM:[],$exportDOM:[],$extractWithChild:[],$getDOMSlot:[],$shouldExclude:[],$shouldInclude:[],$updateDOM:[]};for(let e of function(e){let t=[],n=[],r=[];for(let i of e)if("*"===i.nodes)t.push(i);else if(Array.isArray(i.nodes))for(let e of i.nodes)S3(e.prototype)?r.push(1===i.nodes.length?i:{...i,nodes:[e]}):n.push(1===i.nodes.length?i:{...i,nodes:[e]});let i=new Map,o=e=>{let t=i.get(e);if(void 0===t){t=0;for(let n=e;S3(n.prototype);n=Object.getPrototypeOf(n))t++;i.set(e,t)}return t};return r.sort((e,t)=>o(e.nodes[0])-o(t.nodes[0])),[...r,...n,...t]}(t)){let t=function(e,{nodes:t}){if("*"===t)return N0;let n={},r=[];for(let i of t)if("getType"in i){let t=i.getType();if(n){let r=e[t];void 0===r&&Nq(339,i.name,t),n=Object.assign(n,r.types)}r.push(function(e){return t=>t instanceof e}(i))}else n=void 0,r.push(i);return n||(1===r.length?r[0]:e=>{for(let t of r)if(t(e))return!0;return!1})}(n,e);for(let n in r)!function(e,t,n,r){if(!r)return;let i=e[t];if("function"==typeof n)i.push([n,r]);else{let e,t=i[i.length-1];for(let o in t&&"types"===t[0]?e=t[1]:(e={},i.push(["types",e])),n){let t=e[o]||[];e[o]=t,t.push(r)}}}(r,n,t,e[n])}return r}(e,t),r={...EF,...e.dom};return je(n,"$createDOM",r,N4,N1),je(n,"$exportDOM",r,N4,N1),je(n,"$extractWithChild",r,N9,N3),je(n,"$getDOMSlot",r,N6,N2),je(n,"$shouldExclude",r,N6,N2),je(n,"$shouldInclude",r,N6,N2),je(n,"$updateDOM",r,N8,N5),je(n,"$decorateDOM",r,N7,jt),r}(e,t)},mergeConfig(e,t){let n=TI(e,t);for(let r of["overrides","contextDefaults"])t[r]&&(n[r]=[...e[r],...t[r]]);return n},name:NZ};function jr(e,t,n){return Object.assign(new k0(Symbol(e),{isEqual:n,parse:t}),{[NQ]:!0})}jr("root",Boolean);let ji=jr("isExport",Boolean),jo=function(e,t=()=>{}){return(n,r=Aq())=>i=>{let o=NY(r),s=o&&o[e],a=NX(n,s||t(r));return a&&a!==s?function(e,t,n,r=Aq()){let i=u,o=NY(r);try{return u={...o,editor:r,[e]:t},n()}finally{u=i}}(e,a,i,r):i()}}(NQ,function(e){let t=NI.maybeFromEditor(e);return t&&t.hasExtensionByName(NZ)?NF(e,jn).output.defaults:void 0}),js=new Set(["STYLE","SCRIPT"]);function ja(e,...t){let n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;for(let n of(r.append("code",e),t))r.append("v",n);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function jl(t,n=CY()){return null==n&&ja(166),CD(n)&&n.isCollapsed()||0===n.getNodes().length?"":function(t,n=null){return("u"<typeof document||"u"<typeof window&&void 0===e.g.window)&&Nq(338),function(e,t=null,n=Aq()){return jo([[ji,!0]],n)(()=>{let r=As(),i=AJ(n),o=e.append.bind(e);for(let e of r.getChildren())!function e(t,n,r,i=null,o=AJ(t)){let s=o.$shouldInclude(n,i,t),a=o.$shouldExclude(n,i,t),l=n;null!==i&&C_(n)&&(l=T3(i,n,"clone"));let{element:u,after:c,append:d,$getChildNodes:h}=o.$exportDOM(l,t);if(!u)return!1;let f=document.createDocumentFragment(),p=h?h():E_(l)?l.getChildren():[],m=f.append.bind(f);for(let r of p){let a=e(t,r,m,i,o);!s&&a&&o.$extractWithChild(n,r,i,"html",t)&&(s=!0)}if(s&&!a){if((AU(u)||AW(u))&&(d?d(f):u.append(f)),r(u),c){let e=c.call(l,u);e&&(AW(u)?u.replaceChildren(e):u.replaceWith(e))}}else r(f);return s}(n,e,o,t,i);return e})}(document.createElement("div"),n,t).innerHTML}(t,n)}function ju(e,t=CY()){return null==t&&ja(166),CD(t)&&t.isCollapsed()||0===t.getNodes().length?null:JSON.stringify(function(e,t){let n=[],r=As().getChildren();for(let i=0;i<r.length;i++)!function e(t,n,r,i=[]){var o;let s,a,l=null===n||r.isSelected(n),u=E_(r)&&r.excludeFromCopy("html"),c=r;null!==n&&C_(c)&&(c=T3(n,c,"clone"));let d=E_(c)?c.getChildren():[],h=(s=(o=c).exportJSON(),a=o.constructor,s.type!==a.getType()&&ja(58,a.name),E_(o)&&(Array.isArray(s.children)||ja(59,a.name)),s);C_(c)&&0===c.getTextContentSize()&&(l=!1);for(let i=0;i<d.length;i++){let o=d[i],s=e(t,n,o,h.children);!l&&E_(r)&&s&&r.extractWithChild(o,n,"clone")&&(l=!0)}if(l&&!u)i.push(h);else if(Array.isArray(h.children))for(let e=0;e<h.children.length;e++){let t=h.children[e];i.push(t)}return l}(e,t,r[i],n);return{namespace:e._config.namespace,nodes:n}}(e,t))}function jc(e,t,n){let r=e.getData("application/x-lexical-editor");if(r)try{let e=JSON.parse(r);if(e.namespace===n._config.namespace&&Array.isArray(e.nodes))return jh(n,function(e){let t=[];for(let n=0;n<e.length;n++){let r=Eh(e[n],Ea()._nodes);C_(r)&&T4(r),t.push(r)}return t}(e.nodes),t)}catch(e){console.error(e)}let i=e.getData("text/html"),o=e.getData("text/plain");if(i&&o!==i)try{let e=(new DOMParser).parseFromString(window.trustedTypes&&window.trustedTypes.createPolicy?window.trustedTypes.createPolicy("lexical",{createHTML:e=>e}).createHTML(i):i,"text/html");return jh(n,function(e,t){E2(t)&&function(e){if(null===e.querySelector("style"))return;let t=new Map;try{for(let n of Array.from(e.styleSheets)){let r;try{r=n.cssRules}catch(e){continue}for(let n of Array.from(r)){let r;if(n.constructor.name===CSSStyleRule.name){try{r=e.querySelectorAll(n.selectorText)}catch(e){continue}for(let e of Array.from(r)){if(!AU(e))continue;let r=function(e){let n=t.get(e);if(void 0===n){n=new Set;for(let t=0;t<e.style.length;t++)n.add(e.style[t]);t.set(e,n)}return n}(e);for(let t=0;t<n.style.length;t++){let i=n.style[t];r.has(i)||e.style.setProperty(i,n.style.getPropertyValue(i),n.style.getPropertyPriority(i))}}}}}}catch(e){}}(t);let n=E2(t)?t.body.childNodes:t.childNodes,r=[],i=[];for(let t of n)if(!js.has(t.nodeName)){let n=function e(t,n,r,i,o=new Map,s){let a=[];if(js.has(t.nodeName))return a;let l=null,u=function(e,t){let{nodeName:n}=e,r=t._htmlConversions.get(n.toLowerCase()),i=null;if(void 0!==r)for(let t of r){let n=t(e);null!==n&&(null===i||(i.priority||0)<=(n.priority||0))&&(i=n)}return null!==i?i.conversion:null}(t,n),c=u?u(t):null,d=null;if(null!==c){d=c.after;let e=c.node;if(null!==(l=Array.isArray(e)?e[e.length-1]:e)){for(let[,e]of o)if(!(l=e(l,s)))break;l&&a.push(...Array.isArray(e)?e:[l])}null!=c.forChild&&o.set(t.nodeName,c.forChild)}let h=t.childNodes,f=[],p=(null==l||!AL(l))&&(null!=l&&CH(l)||i);for(let t=0;t<h.length;t++)f.push(...e(h[t],n,r,p,new Map(o),l));if(null!=d&&(f=d(f)),AK(t)&&(f=function(e,t,n){let r=e.style.textAlign,i=[],o=[];for(let e=0;e<t.length;e++){let s=t[e];if(CH(s))r&&!s.getFormat()&&s.setFormat(r),i.push(s);else if(o.push(s),e===t.length-1||e<t.length-1&&CH(t[e+1])){let e=n();e.setFormat(r),e.append(...o),i.push(e),o=[]}}return i}(t,f,p?()=>{let e=new EM;return r.push(e),e}:EL)),null==l)if(f.length>0)for(let e of f)a.push(e);else AK(t)&&null!=t.nextSibling&&null!=t.previousSibling&&AH(t.nextSibling)&&AH(t.previousSibling)&&a.push(Co());else E_(l)&&l.append(...f);return a}(t,e,i,!1);if(null!==n)for(let e of n)r.push(e)}return function(e){for(let t of e)t.getParent()&&t.getNextSibling()instanceof EM&&t.insertAfter(Co());for(let t of e){let e=t.getParent();e&&e.splice(t.getIndexWithinParent(),1,t.getChildren())}}(i),r}(n,e),t)}catch(e){console.error(e)}let s=o||e.getData("text/uri-list");if(null!=s)if(CD(t)){let e=s.split(/(\r?\n|\t)/);""===e[e.length-1]&&e.pop();for(let t=0;t<e.length;t++){let n=CY();if(CD(n)){let r=e[t];"\n"===r||"\r\n"===r?n.insertParagraph():" "===r?n.insertNodes([CE()]):n.insertText(r)}}}else t.insertRawText(s)}let jd="application/x-lexical-drag";function jh(e,t,n){e.dispatchCommand(_O,{nodes:t,selection:n})||(n.insertNodes(t),function(e){if(CD(e)&&e.isCollapsed()){let t=e.anchor,n=null,r=Tk(t,"previous");if(r)if(Tn(r))n=r.origin;else for(let e of Tg(r,Td(As(),"next").getFlipped())){if(C_(e.origin)){n=e.origin;break}if(E_(e.origin)&&!e.origin.isInline())break}if(n&&C_(n)){let t=n.getFormat(),r=n.getStyle();e.format===t&&e.style===r||(e.format=t,e.style=r,e.dirty=!0)}}}(n))}let jf=null;async function jp(e,t,n){if(null!==jf)return!1;if(null!==t)return new Promise((r,i)=>{e.update(()=>{r(jm(e,t,n))})});let r=e.getRootElement(),i=e._window||window,o=i.document,s=A$(i);if(null===r||null===s)return!1;let a=o.createElement("span");a.style.position="fixed",a.style.top="-1000px",a.append(o.createTextNode("#")),r.append(a);let l=new Range;return l.setStart(a,0),l.setEnd(a,1),s.removeAllRanges(),s.addRange(l),new Promise((t,r)=>{let s=e.registerCommand(Sc,r=>(Nr(r,ClipboardEvent)&&(s(),null!==jf&&(i.clearTimeout(jf),jf=null),t(jm(e,r,n))),!0),4);jf=i.setTimeout(()=>{s(),jf=null,t(!1)},50),o.execCommand("copy"),a.remove()})}function jm(e,t,n){if(void 0===n){let t=A$(e._window),r=CY();if(!r||r.isCollapsed()||!t)return!1;let i=t.anchorNode,o=t.focusNode;if(null!==i&&null!==o&&!EJ(e,i,o))return!1;n=jy(r)}t.preventDefault();let r=t.clipboardData;return null!==r&&(jv(r,n),!0)}let jg=[["text/html",jl],["application/x-lexical-editor",ju]];function jy(e=CY()){let t,n;var r=(t=Aq(),(n=NI.maybeFromEditor(t))&&n.hasExtensionByName(jb.name)?NF(t,jb).output:jx);let i={"text/plain":""};for(let[t,n]of Object.entries(r)){let r=function(e,t){let n=r=>e[r]?e[r](t,n.bind(null,r-1)):null;return n(e.length-1)}(n,e);null!==r&&(i[t]=r)}return i}function jv(e,t){for(let[n]of jg)void 0===t[n]&&e.setData(n,"");for(let n in t){let r=t[n];void 0!==r&&e.setData(n,r)}}let jx={"application/x-lexical-editor":[(e,t)=>e?ju(Aq(),e):t()],"text/html":[(e,t)=>e?jl(Aq(),e):t()],"text/plain":[(e,t)=>e?e.getTextContent():t()]},jb={build:(e,t,n)=>t.$exportMimeType,config:{$exportMimeType:jx},mergeConfig(e,t){let n=TI(e,t);if(t.$exportMimeType){let r={...e.$exportMimeType};for(let[e,n]of Object.entries(t.$exportMimeType))r[e]=[...r[e],...n];n.$exportMimeType=r}return n},name:"@lexical/clipboard/GetClipboardData"};function jw(e,t){if(void 0!==document.caretRangeFromPoint){let n=document.caretRangeFromPoint(e,t);return null===n?null:{node:n.startContainer,offset:n.startOffset}}if("undefined"!==document.caretPositionFromPoint){let n=document.caretPositionFromPoint(e,t);return null===n?null:{node:n.offsetNode,offset:n.offset}}return null}let jk="u">typeof window&&void 0!==window.document&&void 0!==window.document.createElement,j_=jk&&"documentMode"in document?document.documentMode:null,jS=jk&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),jC=!(!jk||!("InputEvent"in window)||j_)&&"getTargetRanges"in new window.InputEvent("input"),jE=jk&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,jA=jk&&/Android/.test(navigator.userAgent),jT=jk&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent)&&!jA,jN=jk&&/^(?=.*Chrome).*/i.test(navigator.userAgent),jj=jk&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&jS&&!jN,jP=_R("DRAG_DROP_PASTE_FILE");function jM(e){let t=null;if(Nr(e,DragEvent)?t=e.dataTransfer:Nr(e,ClipboardEvent)&&(t=e.clipboardData),null===t)return[!1,[],!1];let n=t.types,r=n.includes("Files"),i=n.includes("text/html")||n.includes("text/plain");return[r,Array.from(t.files),i]}function jD(e){for(let t of["lowercase","uppercase","capitalize"])e.hasFormat(t)&&e.toggleFormat(t)}let jR="u">typeof window&&void 0!==window.document&&void 0!==window.document.createElement?T.useLayoutEffect:T.useEffect;function jL({editor:e,ErrorBoundary:t}){return function(e,t){let[n,r]=(0,T.useState)(()=>e.getDecorators());return jR(()=>e.registerDecoratorListener(e=>{(0,ec.flushSync)(()=>{r(e)})}),[e]),(0,T.useEffect)(()=>{r(e.getDecorators())},[e]),(0,T.useMemo)(()=>{let r=[],i=Object.keys(n);for(let o=0;o<i.length;o++){let s=i[o],a=(0,A.jsx)(t,{onError:t=>e._onError(t),children:(0,A.jsx)(T.Suspense,{fallback:null,children:n[s]})}),l=e.getElementByKey(s);null!==l&&r.push((0,ec.createPortal)(a,l,s))}return r},[t,n,e])}(e,t)}function jO({editor:e,ErrorBoundary:t}){return!function(e){let t=NI.maybeFromEditor(e);if(t&&t.hasExtensionByName("@lexical/react/ReactProvider")){for(let e of["@lexical/plain-text","@lexical/rich-text"])t.hasExtensionByName(e)&&function(...e){let t=new URL("https://lexical.dev/docs/error"),n=new URLSearchParams;for(let t of(n.append("code",320),e))n.append("v",t);throw t.search=n.toString(),Error(`Minified Lexical error #320; visit ${t.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(e);return!0}return!1}(e)?(0,A.jsx)(jL,{editor:e,ErrorBoundary:t}):null}function jI(e){return e.getEditorState().read(TW(e.isComposing()))}function jF({contentEditable:e,placeholder:t=null,ErrorBoundary:n}){var r;let[i]=kw();return jR(()=>{var e;return Tz(Tz((e=r).registerCommand(_I,e=>{let t=CY();return!!CL(t)&&(t.clear(),!0)},0),e.registerCommand(_U,e=>{let t=CY();return CD(t)?(t.deleteCharacter(e),!0):!!CL(t)&&(t.deleteNodes(),!0)},0),e.registerCommand(_q,e=>{let t=CY();return!!CD(t)&&(t.deleteWord(e),!0)},0),e.registerCommand(_J,e=>{let t=CY();return!!CD(t)&&(t.deleteLine(e),!0)},0),e.registerCommand(_H,t=>{let n=CY();if("string"==typeof t)null!==n&&n.insertText(t);else{if(null===n)return!1;let r=t.dataTransfer;if(null!=r)jc(r,n,e);else if(CD(n)){let e=t.data;return e&&n.insertText(e),!0}}return!0},0),e.registerCommand(_G,()=>{let e=CY();return!!CD(e)&&(e.removeText(),!0)},0),e.registerCommand(_Y,e=>{let t=CY();return!!CD(t)&&(t.formatText(e),!0)},0),e.registerCommand(Ss,e=>{let t=CY();if(!CD(t)&&!CL(t))return!1;for(let n of t.getNodes()){let t=A5(n,e=>E_(e)&&!e.isInline());null!==t&&t.setFormat(e)}return!0},0),e.registerCommand(_V,e=>{let t=CY();return!!CD(t)&&(t.insertLineBreak(e),!0)},0),e.registerCommand(_W,()=>{let e=CY();return!!CD(e)&&(e.insertParagraph(),!0)},0),e.registerCommand(Sn,()=>{let e=CE(),t=CY();return CD(t)&&(e.setFormat(t.format),e.setStyle(t.style)),C3([e]),!0},0),e.registerCommand(Sr,()=>Ni(e=>{let t=e.getIndent();e.setIndent(t+1)}),0),e.registerCommand(Si,()=>Ni(e=>{let t=e.getIndent();t>0&&e.setIndent(Math.max(0,t-1))}),0),e.registerCommand(_3,e=>{let t=CY();if(CL(t)){let n=t.getNodes();if(n.length>0)return e.preventDefault(),n[0].selectPrevious(),!0}else if(CD(t)){let n=AC(t.focus,!0);if(!e.shiftKey&&EE(n)&&!n.isIsolated()&&!n.isInline())return n.selectPrevious(),e.preventDefault(),!0}return!1},0),e.registerCommand(_4,e=>{let t=CY();if(CL(t)){let n=t.getNodes();if(n.length>0)return e.preventDefault(),n[0].selectNext(0,0),!0}else if(CD(t)){let n;if("root"===(n=t.focus).key&&n.offset===As().getChildrenSize())return e.preventDefault(),!0;let r=AC(t.focus,!1);if(!e.shiftKey&&EE(r)&&!r.isIsolated()&&!r.isInline())return r.selectNext(),e.preventDefault(),!0}return!1},0),e.registerCommand(_2,e=>{let t=CY();if(CL(t)){let n=t.getNodes();if(n.length>0)return e.preventDefault(),T5(n[0])?n[0].selectNext(0,0):n[0].selectPrevious(),!0}if(!CD(t))return!1;if(T9(t,!0)){let n=e.shiftKey;return e.preventDefault(),Ne(t,n,!0),!0}return!1},0),e.registerCommand(_0,e=>{let t=CY();if(CL(t)){let n=t.getNodes();if(n.length>0)return e.preventDefault(),T5(n[0])?n[0].selectPrevious():n[0].selectNext(0,0),!0}if(!CD(t))return!1;let n=e.shiftKey;return!!T9(t,!1)&&(e.preventDefault(),Ne(t,n,!1),!0)},0),e.registerCommand(_9,t=>{if(EE(Ar(t.target)))return!1;let n=CY();if(CD(n)){if(function(e){var t;let n;if(!e.isCollapsed())return!1;let{anchor:r}=e;if(0!==r.offset)return!1;let i=r.getNode();if(ET(i))return!1;let o=(n=A5(t=i,e=>E_(e)&&!e.isInline()),E_(n)||function(...e){let t=new URL("https://lexical.dev/docs/error"),n=new URLSearchParams;for(let t of(n.append("code",4),e))n.append("v",t);throw t.search=n.toString(),Error(`Minified Lexical error #${4}; visit ${t.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(t.__key),n);return o.getIndent()>0&&(o.is(i)||i.is(o.getFirstDescendant()))}(n))return t.preventDefault(),e.dispatchCommand(Si,void 0);if(jE&&"ko-KR"===navigator.language)return!1}else if(!CL(n))return!1;return t.preventDefault(),e.dispatchCommand(_U,!0)},0),e.registerCommand(Se,t=>{if(EE(Ar(t.target)))return!1;let n=CY();return!(!CD(n)&&!CL(n))&&(t.preventDefault(),e.dispatchCommand(_U,!1))},0),e.registerCommand(_6,t=>{let n=CY();if(!CD(n))return!1;if(jD(n),null!==t){if((jE||jT||jj)&&jC)return!1;if(t.preventDefault(),t.shiftKey)return e.dispatchCommand(_V,!1)}return e.dispatchCommand(_W,void 0)},0),e.registerCommand(_7,()=>!!CD(CY())&&(e.blur(),!0),0),e.registerCommand(So,t=>{let[,n]=jM(t);if(n.length>0){let r=jw(t.clientX,t.clientY);if(null!==r){let{offset:t,node:i}=r,o=Ar(i);if(null!==o){let e=CG();if(C_(o))e.anchor.set(o.getKey(),t,"text"),e.focus.set(o.getKey(),t,"text");else{let t=o.getParentOrThrow().getKey(),n=o.getIndexWithinParent()+1;e.anchor.set(t,n,"element"),e.focus.set(t,n,"element")}Al(_n(e))}e.dispatchCommand(jP,n)}return t.preventDefault(),!0}return function(e,t,n){let r=e.dataTransfer;if(null===r)return!1;let i=function(e){var t;let n,r=e.getData(jd);if(!r)return null;try{n=JSON.parse(r)}catch(e){return null}return null!==(t=n)&&"object"==typeof t&&"editorKey"in t&&"string"==typeof t.editorKey?n:null}(r);if(null===i)return!1;let o=function(e){let t=function(e,t){if(void 0!==document.caretRangeFromPoint){let n=document.caretRangeFromPoint(e,t);return null===n?null:{node:n.startContainer,offset:n.startOffset}}if("undefined"!==document.caretPositionFromPoint){let n=document.caretPositionFromPoint(e,t);return null===n?null:{node:n.offsetNode,offset:n.offset}}return null}(e.clientX,e.clientY);if(null===t)return null;let n=Ar(t.node);if(null===n)return null;if(C_(n))return Tu(n,"next",t.offset);if(E_(n))return TR(n,t.offset,"next");let r=n.getParent();return null===r?null:TR(r,n.getIndexWithinParent()+1,"next")}(e);if(null===o)return!1;let s=function(e,{$copyElementNode:t=AO,$splitTextPointCaretNext:n=TL,rootMode:r="shadowRoot",$shouldSplit:i=TO,removeEmptyDestination:o=!1}={}){if(Tn(e))return n(e);let s=e.getParentCaret(r);if(s){let{origin:n}=s;if(Ti(e)){let e=TA(s);if(o&&n.isEmpty())return n.remove(),e;if(!n.canBeEmpty()||!i(n,"first"))return e}let r=function(e){let t=[];for(let n=e.getAdjacentCaret();n;n=n.getAdjacentCaret())t.push(n.origin);return t}(e);(r.length>0||!o&&n.canBeEmpty()&&i(n,"last"))&&s.insert(t(n).splice(0,0,r))}return s}(o);if(null===s)return!1;let a=i.editorKey===t.getKey(),l=CY();if(a){if(!CD(l)||l.isCollapsed())return!1;if(function(e,t){let{anchor:n,focus:r}=TD(TE(t),"next");return 0>Tv(n,e)&&0>Tv(e,r)}(o,l))return e.preventDefault(),!0;l.removeText()}if(!s.origin.isAttached())return e.preventDefault(),!0;if(n(r,TS(Tg(s,s)),t),!a){let e=t.getRootElement(),n=e?e.ownerDocument:null,r=n?function(e,t){for(let n of Array.from(t.querySelectorAll('[data-lexical-editor="true"]'))){let t=n.__lexicalEditor;if(t&&t.getKey()===e)return n}return null}(i.editorKey,n):null;null!==r&&r.dispatchEvent(new InputEvent("beforeinput",{bubbles:!0,cancelable:!0,inputType:"deleteByDrag"}))}return e.preventDefault(),!0}(t,e,jc)},0),e.registerCommand(Sa,t=>{var n;let r,[i]=jM(t),o=CY();return!(i&&!CD(o))&&(CD(o)&&!o.isCollapsed()&&null!==t.dataTransfer&&(jv(t.dataTransfer,jy(o)),n=t.dataTransfer,r={editorKey:e.getKey()},n.setData(jd,JSON.stringify(r))),!0)},0),e.registerCommand(Sl,e=>{let[t]=jM(e),n=CY();if(t&&!CD(n))return!1;let r=jw(e.clientX,e.clientY);return null!==r&&EE(Ar(r.node))&&e.preventDefault(),!0},0),e.registerCommand(Sh,()=>((function(){let e=As();if(CD(void 0)){let e=(void 0).anchor,t=(void 0).focus,n=e.getNode().getTopLevelElementOrThrow().getParentOrThrow();return e.set(n.getKey(),0,"element"),t.set(n.getKey(),n.getChildrenSize(),"element"),_n(void 0)}Al(_n(e.select(0,e.getChildrenSize())))})(),!0),0),e.registerCommand(Sc,t=>(jp(e,Nr(t,ClipboardEvent)?t:null),!0),0),e.registerCommand(Sd,t=>((async function(e,t){await jp(t,Nr(e,ClipboardEvent)?e:null),t.update(()=>{let e=CY();CD(e)?e.removeText():CL(e)&&e.getNodes().forEach(e=>e.remove())})})(t,e),!0),0),e.registerCommand(_K,t=>{let[,n,r]=jM(t);return n.length>0&&!r?(e.dispatchCommand(jP,n),!0):!(AV(t.target)&&Eq(t.target))&&null!==CY()&&(t.preventDefault(),e.update(()=>{let n=CY(),r=Nr(t,InputEvent)||Nr(t,KeyboardEvent)?null:t.clipboardData;null!=r&&null!==n&&jc(r,n,e)},{tag:"paste"}),!0)},0),e.registerCommand(_8,e=>{let t=CY();return CD(t)&&jD(t),!1},0),e.registerCommand(St,e=>{let t=CY();return CD(t)&&jD(t),!1},0)),NG(r))},[r=i]),(0,A.jsxs)(A.Fragment,{children:[e,(0,A.jsx)(jz,{content:t}),(0,A.jsx)(jO,{editor:i,ErrorBoundary:n})]})}function jz({content:e}){let[t]=kw(),n=function(e){let[t,n]=(0,T.useState)(()=>jI(e));return jR(()=>{function t(){n(jI(e))}return t(),Tz(e.registerUpdateListener(()=>{t()}),e.registerEditableListener(()=>{t()}))},[e]),t}(t),r=function(e){let[t]=kw(),n=(0,T.useMemo)(()=>e(t),[t,e]),[r,i]=(0,T.useState)(()=>n.initialValueFn()),o=(0,T.useRef)(r);return NH(()=>{let{initialValueFn:e,subscribe:t}=n,r=e();return o.current!==r&&(o.current=r,i(r)),t(e=>{o.current=e,i(e)})},[n,e]),r}(NK);return n?"function"==typeof e?e(r):e:null}class jB extends EC{__href;__label;static getType(){return"file-reference"}static clone(e){return new jB(e.__label,e.__href,e.__key)}static importJSON(e){var t;return t=e.label,new jB(t,e.href)}constructor(e,t,n){super(n),this.__label=e,this.__href=t}createDOM(){let e=document.createElement("span");return e.className="composer-link-chip-shell",e}updateDOM(){return!1}decorate(){return(0,A.jsx)("span",{className:"composer-link-chip",title:this.__href,children:this.__label||jX(this.__href)})}exportJSON(){return{...super.exportJSON(),href:this.__href,label:this.__label,type:jB.getType(),version:1}}getTextContent(){return`[${(this.__label||jX(this.__href)).replace(/([\\[\]])/g,"\\$1")}](${encodeURI(this.__href)})`}isInline(){return!0}isKeyboardSelectable(){return!0}}let j$=(0,T.forwardRef)(function({className:e,onSubmit:t,onTrigger:n,placeholder:r},i){let o=(0,T.useRef)(null),s=(0,T.useRef)("");return(0,T.useImperativeHandle)(i,()=>({focus(){o.current?.focus()},getValue:()=>s.current,insertText(e,t={}){let n=o.current;n&&(n.update(()=>{jK(e,t),s.current=jJ()}),n.focus())},removeCurrentTriggerToken(e){let t=o.current;t&&e&&t.update(()=>{let t=CY();if(!CD(t)||!t.isCollapsed()||"text"!==t.anchor.type)return;let n=t.anchor.getNode();if(!C_(n))return;let r=t.anchor.offset;r<=0||n.getTextContent()[r-1]!==e||(n.spliceText(r-1,1,""),s.current=jJ())})},setValue(e){s.current=e;let t=o.current;t&&t.update(()=>{jH(e),s.current=jJ()})}}),[]),(0,A.jsxs)(TV,{initialConfig:{namespace:"codex-web-ui-composer",nodes:[jB],onError(e){throw e},theme:{paragraph:"composer-lexical-paragraph"}},children:[(0,A.jsx)(jU,{editorRef:o,valueRef:s}),(0,A.jsx)(jF,{contentEditable:(0,A.jsx)(Tq,{className:e,"aria-placeholder":r,placeholder:(0,A.jsx)("span",{className:"composer-lexical-placeholder",children:r})}),ErrorBoundary:T0}),(0,A.jsx)(NU,{}),(0,A.jsx)(NW,{ignoreHistoryMergeTagChange:!0,ignoreSelectionChange:!0,onChange:e=>{e.read(()=>{s.current=jJ(),n?.(function(){let e=CY();if(!CD(e)||!e.isCollapsed()||"text"!==e.anchor.type)return null;let t=e.anchor.getNode();if(!C_(t))return null;let n=t.getTextContent().slice(0,e.anchor.offset),r=/(?:^|\s)([@$])$/.exec(n),i=r?.[1];return"@"===i||"$"===i?i:null}())})}}),(0,A.jsx)(jV,{onSubmit:t}),(0,A.jsx)(jW,{})]})});function jU({editorRef:e,valueRef:t}){let[n]=kw();return(0,T.useEffect)(()=>(e.current=n,n.update(()=>{As().getFirstChild()||jH(t.current)}),()=>{e.current===n&&(e.current=null)}),[n,e,t]),null}function jV({onSubmit:e}){let[t]=kw();return(0,T.useEffect)(()=>{let n=t.getRootElement();if(n)return n.addEventListener("keydown",r),()=>n.removeEventListener("keydown",r);function r(t){"Enter"===t.key&&(t.ctrlKey||t.metaKey)&&!t.isComposing&&(t.preventDefault(),e?.())}},[t,e]),null}function jW(){let[e]=kw();return(0,T.useEffect)(()=>{let t=e.getRootElement();if(t)return t.addEventListener("paste",n),()=>t.removeEventListener("paste",n);function n(t){let n=t.clipboardData?.getData("text/plain");n&&jq().test(n)&&(t.preventDefault(),e.update(()=>jK(n,{block:!1})))}},[e]),null}function jH(e){let t=As();t.clear();let n=e.split("\n");for(let e of n.length?n:[""]){let n=EL();(function(e,t){for(let n of jG(t))e.append(n)})(n,e),t.append(n)}t.selectEnd()}function jK(e,t){if(!CD(CY()))return;let n=jJ(),r=!!(t.block&&n.trim()&&!n.endsWith("\n")),i=!!t.block,o=[];r&&o.push(Ck("\n")),o.push(...jG(e)),i&&o.push(Ck("\n")),C3(o)}function jG(e){let t=[],n=jq(),r=0;for(let i of e.matchAll(n))void 0!==i.index&&(i.index>r&&t.push(Ck(e.slice(r,i.index))),t.push(new jB((i[1]||"").replace(/\\([\\[\]])/g,"$1"),function(e){try{return decodeURIComponent(e)}catch{return e}}(i[2]||""))),r=i.index+i[0].length);return r<e.length&&t.push(Ck(e.slice(r))),t.length?t:[Ck("")]}function jq(){return/\[([^\]\n]{1,160})\]\(([^)\n]{1,700})\)/g}function jJ(){return As().getChildren().map(e=>EO(e)||E_(e)?e.getChildren().map(jY).join(""):jY(e)).join("\n")}function jY(e){return e instanceof jB||C_(e)?e.getTextContent():E_(e)?e.getChildren().map(jY).join(""):e.getTextContent()}function jX(e){let t=e.replace(/:\d+(?::\d+)?$/,"");return t.split(/[\\/]/).filter(Boolean).at(-1)||t}let jZ=D("file-text",[["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:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]),jQ=D("file",[["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"}]]);D("folder-open",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);let j0=(0,T.createContext)({expandedPaths:new Set,togglePath:()=>{}}),j1=({expanded:e,defaultExpanded:t=new Set,selectedPath:n,onSelect:r,onExpandedChange:i,className:o,children:s,...a})=>{let[l,u]=(0,T.useState)(t),c=e??l,d=(0,T.useCallback)(e=>{let t=new Set(c);t.has(e)?t.delete(e):t.add(e),u(t),i?.(t)},[c,i]),h=(0,T.useMemo)(()=>({expandedPaths:c,onSelect:r,selectedPath:n,togglePath:d}),[c,r,n,d]);return(0,A.jsx)(j0.Provider,{value:h,children:(0,A.jsx)("div",{className:oG("rounded-lg border bg-background font-mono text-sm",o),role:"tree",...a,children:(0,A.jsx)("div",{className:"p-2",children:s})})})},j2=({className:e,children:t,...n})=>(0,A.jsx)("span",{className:oG("shrink-0",e),...n,children:t}),j5=({className:e,children:t,...n})=>(0,A.jsx)("span",{className:oG("truncate",e),...n,children:t}),j3=(0,T.createContext)({name:"",path:""}),j4=({path:e,name:t,icon:n,className:r,children:i,...o})=>{let{selectedPath:s,onSelect:a}=(0,T.useContext)(j0),l=s===e,u=(0,T.useCallback)(()=>{a?.(e)},[a,e]),c=(0,T.useCallback)(t=>{("Enter"===t.key||" "===t.key)&&a?.(e)},[a,e]),d=(0,T.useMemo)(()=>({name:t,path:e}),[t,e]);return(0,A.jsx)(j3.Provider,{value:d,children:(0,A.jsx)("div",{className:oG("flex cursor-pointer items-center gap-1 rounded px-2 py-1 transition-colors hover:bg-muted/50",l&&"bg-muted",r),onClick:u,onKeyDown:c,role:"treeitem",tabIndex:0,...o,children:i??(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)("span",{className:"size-4 shrink-0"}),(0,A.jsx)(j2,{children:n??(0,A.jsx)(jQ,{className:"size-4 text-muted-foreground"})}),(0,A.jsx)(j5,{children:t})]})})})},j6=e=>e.stopPropagation(),j8=({className:e,children:t,...n})=>(0,A.jsx)("div",{className:oG("ml-auto flex items-center gap-1",e),onClick:j6,onKeyDown:j6,role:"group",...n,children:t});function j9({explorer:e,loading:t,onBrowse:n,onClose:r,onOpenFile:i,onRefresh:o,title:s="Files"}){let[a,l]=(0,T.useState)(""),u=(0,T.useMemo)(()=>{let t=a.trim().toLowerCase(),n=e?.entries??[];return t?n.filter(e=>`${e.name}
|
|
5
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return T.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},hj=({contentRef:e,descriptionId:t})=>{let n=hT("DialogDescriptionWarning"),r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${n.contentName}}.`;return T.useEffect(()=>{let n=e.current?.getAttribute("aria-describedby");t&&n&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null};e.s(["Close",0,hS,"Content",0,hm,"Description",0,hk,"Dialog",0,hr,"DialogClose",0,hS,"DialogContent",0,hm,"DialogDescription",0,hk,"DialogOverlay",0,hd,"DialogPortal",0,hu,"DialogTitle",0,hb,"DialogTrigger",0,ho,"Overlay",0,hd,"Portal",0,hu,"Root",0,hr,"Title",0,hb,"Trigger",0,ho,"WarningProvider",0,hA,"createDialogScope",0,he],326999);var hP=Symbol.for("react.lazy"),hM=T[" use ".trim().toString()];function hD(e){var t;return null!=e&&"object"==typeof e&&"$$typeof"in e&&e.$$typeof===hP&&"_payload"in e&&"object"==typeof(t=e._payload)&&null!==t&&"then"in t}var hR=Symbol("radix.slottable");function hL(e){return T.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===hR}var hO=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{var n,r;let i,o,s,a=(r=n=`Primitive.${t}`,(i=T.forwardRef((e,t)=>{let{children:n,...r}=e;if(hD(n)&&"function"==typeof hM&&(n=hM(n._payload)),T.isValidElement(n)){var i;let e,o,s=(i=n,(o=(e=Object.getOwnPropertyDescriptor(i.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.ref:(o=(e=Object.getOwnPropertyDescriptor(i,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.props.ref:i.props.ref||i.ref),a=function(e,t){let n={...t};for(let r in t){let i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...e)=>{let t=o(...e);return i(...e),t}:i&&(n[r]=i):"style"===r?n[r]={...i,...o}:"className"===r&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}(r,n.props);return n.type!==T.Fragment&&(a.ref=t?(0,o1.composeRefs)(t,s):s),T.cloneElement(n,a)}return T.Children.count(n)>1?T.Children.only(null):null})).displayName=`${r}.SlotClone`,o=i,(s=T.forwardRef((e,t)=>{let{children:n,...r}=e;hD(n)&&"function"==typeof hM&&(n=hM(n._payload));let i=T.Children.toArray(n),s=i.find(hL);if(s){let e=s.props.children,n=i.map(t=>t!==s?t:T.Children.count(e)>1?T.Children.only(null):T.isValidElement(e)?e.props.children:null);return(0,A.jsx)(o,{...r,ref:t,children:T.isValidElement(e)?T.cloneElement(e,void 0,n):null})}return(0,A.jsx)(o,{...r,ref:t,children:n})})).displayName=`${n}.Slot`,s),l=T.forwardRef((e,n)=>{let{asChild:r,...i}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,A.jsx)(r?a:t,{...i,ref:n})});return l.displayName=`Primitive.${t}`,{...e,[t]:l}},{}),hI='[cmdk-group=""]',hF='[cmdk-group-items=""]',hz='[cmdk-item=""]',hB=`${hz}:not([aria-disabled="true"])`,h$="cmdk-item-select",hU="data-value",hV=(e,t,n)=>{var r;return r=e,function e(t,n,r,i,o,s,a){if(s===n.length)return o===t.length?1:.99;var l=`${o},${s}`;if(void 0!==a[l])return a[l];for(var u,c,d,h,f=i.charAt(s),p=r.indexOf(f,o),m=0;p>=0;)(u=e(t,n,r,i,p+1,s+1,a))>m&&(p===o?u*=1:d0.test(t.charAt(p-1))?(u*=.8,(d=t.slice(o,p-1).match(d1))&&o>0&&(u*=Math.pow(.999,d.length))):d2.test(t.charAt(p-1))?(u*=.9,(h=t.slice(o,p-1).match(d5))&&o>0&&(u*=Math.pow(.999,h.length))):(u*=.17,o>0&&(u*=Math.pow(.999,p-o))),t.charAt(p)!==n.charAt(s)&&(u*=.9999)),(u<.1&&r.charAt(p-1)===i.charAt(s+1)||i.charAt(s+1)===i.charAt(s)&&r.charAt(p-1)!==i.charAt(s))&&.1*(c=e(t,n,r,i,p+1,s+2,a))>u&&(u=.1*c),u>m&&(m=u),p=r.indexOf(f,p+1);return a[l]=m,m}(r=n&&n.length>0?`${r+" "+n.join(" ")}`:r,t,d3(r),d3(t),0,0,{})},hW=T.createContext(void 0),hH=T.createContext(void 0),hK=T.createContext(void 0),hG=T.forwardRef((e,t)=>{let n=h2(()=>{var t,n;return{search:"",value:null!=(n=null!=(t=e.value)?t:e.defaultValue)?n:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=h2(()=>new Set),i=h2(()=>new Map),o=h2(()=>new Map),s=h2(()=>new Set),a=h0(e),{label:l,children:u,value:c,onValueChange:d,filter:h,shouldFilter:f,loop:p,disablePointerSelection:m=!1,vimBindings:g=!0,...y}=e,v=(0,sm.useId)(),x=(0,sm.useId)(),b=(0,sm.useId)(),w=T.useRef(null),k=h4();h1(()=>{if(void 0!==c){let e=c.trim();n.current.value=e,_.emit()}},[c]),h1(()=>{k(6,j)},[]);let _=T.useMemo(()=>({subscribe:e=>(s.current.add(e),()=>s.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var i,o,s,l;if(!Object.is(n.current[e],t)){if(n.current[e]=t,"search"===e)N(),E(),k(1,A);else if("value"===e){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let e=document.getElementById(b);e?e.focus():null==(i=document.getElementById(v))||i.focus()}if(k(7,()=>{var e;n.current.selectedItemId=null==(e=P())?void 0:e.id,_.emit()}),r||k(5,j),(null==(o=a.current)?void 0:o.value)!==void 0){null==(l=(s=a.current).onValueChange)||l.call(s,null!=t?t:"");return}}_.emit()}},emit:()=>{s.current.forEach(e=>e())}}),[]),S=T.useMemo(()=>({value:(e,t,r)=>{var i;t!==(null==(i=o.current.get(e))?void 0:i.value)&&(o.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,C(t,r)),k(2,()=>{E(),_.emit()}))},item:(e,t)=>(r.current.add(e),t&&(i.current.has(t)?i.current.get(t).add(e):i.current.set(t,new Set([e]))),k(3,()=>{N(),E(),n.current.value||A(),_.emit()}),()=>{o.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=P();k(4,()=>{N(),(null==t?void 0:t.getAttribute("id"))===e&&A(),_.emit()})}),group:e=>(i.current.has(e)||i.current.set(e,new Set),()=>{o.current.delete(e),i.current.delete(e)}),filter:()=>a.current.shouldFilter,label:l||e["aria-label"],getDisablePointerSelection:()=>a.current.disablePointerSelection,listId:v,inputId:b,labelId:x,listInnerRef:w}),[]);function C(e,t){var r,i;let o=null!=(i=null==(r=a.current)?void 0:r.filter)?i:hV;return e?o(e,n.current.search,t):0}function E(){if(!n.current.search||!1===a.current.shouldFilter)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=i.current.get(n),o=0;r.forEach(t=>{o=Math.max(e.get(t),o)}),t.push([n,o])});let r=w.current;M().sort((t,n)=>{var r,i;let o=t.getAttribute("id"),s=n.getAttribute("id");return(null!=(r=e.get(s))?r:0)-(null!=(i=e.get(o))?i:0)}).forEach(e=>{let t=e.closest(hF);t?t.appendChild(e.parentElement===t?e:e.closest(`${hF} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${hF} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{var t;let n=null==(t=w.current)?void 0:t.querySelector(`${hI}[${hU}="${encodeURIComponent(e[0])}"]`);null==n||n.parentElement.appendChild(n)})}function A(){let e=M().find(e=>"true"!==e.getAttribute("aria-disabled")),t=null==e?void 0:e.getAttribute(hU);_.setState("value",t||void 0)}function N(){var e,t,s,l;if(!n.current.search||!1===a.current.shouldFilter){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let u=0;for(let i of r.current){let r=C(null!=(t=null==(e=o.current.get(i))?void 0:e.value)?t:"",null!=(l=null==(s=o.current.get(i))?void 0:s.keywords)?l:[]);n.current.filtered.items.set(i,r),r>0&&u++}for(let[e,t]of i.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=u}function j(){var e,t,n;let r=P();r&&((null==(e=r.parentElement)?void 0:e.firstChild)===r&&(null==(n=null==(t=r.closest(hI))?void 0:t.querySelector('[cmdk-group-heading=""]'))||n.scrollIntoView({block:"nearest"})),r.scrollIntoView({block:"nearest"}))}function P(){var e;return null==(e=w.current)?void 0:e.querySelector(`${hz}[aria-selected="true"]`)}function M(){var e;return Array.from((null==(e=w.current)?void 0:e.querySelectorAll(hB))||[])}function D(e){let t=M()[e];t&&_.setState("value",t.getAttribute(hU))}function R(e){var t;let n=P(),r=M(),i=r.findIndex(e=>e===n),o=r[i+e];null!=(t=a.current)&&t.loop&&(o=i+e<0?r[r.length-1]:i+e===r.length?r[0]:r[i+e]),o&&_.setState("value",o.getAttribute(hU))}function L(e){let t=P(),n=null==t?void 0:t.closest(hI),r;for(;n&&!r;)r=null==(n=e>0?function(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}(n,hI):function(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}(n,hI))?void 0:n.querySelector(hB);r?_.setState("value",r.getAttribute(hU)):R(e)}let O=()=>D(M().length-1),I=e=>{e.preventDefault(),e.metaKey?O():e.altKey?L(1):R(1)},F=e=>{e.preventDefault(),e.metaKey?D(0):e.altKey?L(-1):R(-1)};return T.createElement(hO.div,{ref:t,tabIndex:-1,...y,"cmdk-root":"",onKeyDown:e=>{var t;null==(t=y.onKeyDown)||t.call(y,e);let n=e.nativeEvent.isComposing||229===e.keyCode;if(!(e.defaultPrevented||n))switch(e.key){case"n":case"j":g&&e.ctrlKey&&I(e);break;case"ArrowDown":I(e);break;case"p":case"k":g&&e.ctrlKey&&F(e);break;case"ArrowUp":F(e);break;case"Home":e.preventDefault(),D(0);break;case"End":e.preventDefault(),O();break;case"Enter":{e.preventDefault();let t=P();if(t){let e=new Event(h$);t.dispatchEvent(e)}}}}},T.createElement("label",{"cmdk-label":"",htmlFor:S.inputId,id:S.labelId,style:h8},l),h6(e,e=>T.createElement(hH.Provider,{value:_},T.createElement(hW.Provider,{value:S},e))))}),hq=T.forwardRef((e,t)=>{var n,r;let i=(0,sm.useId)(),o=T.useRef(null),s=T.useContext(hK),a=T.useContext(hW),l=h0(e),u=null!=(r=null==(n=l.current)?void 0:n.forceMount)?r:null==s?void 0:s.forceMount;h1(()=>{if(!u)return a.item(i,null==s?void 0:s.id)},[u]);let c=h3(i,o,[e.value,e.children,o],e.keywords),d=T.useContext(hH),h=h5(e=>e.value&&e.value===c.current),f=h5(e=>!!u||!1===a.filter()||!e.search||e.filtered.items.get(i)>0);function p(){var e,t;m(),null==(t=(e=l.current).onSelect)||t.call(e,c.current)}function m(){d.setState("value",c.current,!0)}if(T.useEffect(()=>{let t=o.current;if(!(!t||e.disabled))return t.addEventListener(h$,p),()=>t.removeEventListener(h$,p)},[f,e.onSelect,e.disabled]),!f)return null;let{disabled:g,value:y,onSelect:v,forceMount:x,keywords:b,...w}=e;return T.createElement(hO.div,{ref:(0,o1.composeRefs)(o,t),...w,id:i,"cmdk-item":"",role:"option","aria-disabled":!!g,"aria-selected":!!h,"data-disabled":!!g,"data-selected":!!h,onPointerMove:g||a.getDisablePointerSelection()?void 0:m,onClick:g?void 0:p},e.children)}),hJ=T.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...o}=e,s=(0,sm.useId)(),a=T.useRef(null),l=T.useRef(null),u=(0,sm.useId)(),c=T.useContext(hW),d=h5(e=>!!i||!1===c.filter()||!e.search||e.filtered.groups.has(s));h1(()=>c.group(s),[]),h3(s,a,[e.value,e.heading,l]);let h=T.useMemo(()=>({id:s,forceMount:i}),[i]);return T.createElement(hO.div,{ref:(0,o1.composeRefs)(a,t),...o,"cmdk-group":"",role:"presentation",hidden:!d||void 0},n&&T.createElement("div",{ref:l,"cmdk-group-heading":"","aria-hidden":!0,id:u},n),h6(e,e=>T.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?u:void 0},T.createElement(hK.Provider,{value:h},e))))}),hY=T.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=T.useRef(null),o=h5(e=>!e.search);return n||o?T.createElement(hO.div,{ref:(0,o1.composeRefs)(i,t),...r,"cmdk-separator":"",role:"separator"}):null}),hX=T.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=null!=e.value,o=T.useContext(hH),s=h5(e=>e.search),a=h5(e=>e.selectedItemId),l=T.useContext(hW);return T.useEffect(()=>{null!=e.value&&o.setState("search",e.value)},[e.value]),T.createElement(hO.input,{ref:t,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":l.listId,"aria-labelledby":l.labelId,"aria-activedescendant":a,id:l.inputId,type:"text",value:i?e.value:s,onChange:e=>{i||o.setState("search",e.target.value),null==n||n(e.target.value)}})}),hZ=T.forwardRef((e,t)=>{let{children:n,label:r="Suggestions",...i}=e,o=T.useRef(null),s=T.useRef(null),a=h5(e=>e.selectedItemId),l=T.useContext(hW);return T.useEffect(()=>{if(s.current&&o.current){let e=s.current,t=o.current,n,r=new ResizeObserver(()=>{n=requestAnimationFrame(()=>{let n=e.offsetHeight;t.style.setProperty("--cmdk-list-height",n.toFixed(1)+"px")})});return r.observe(e),()=>{cancelAnimationFrame(n),r.unobserve(e)}}},[]),T.createElement(hO.div,{ref:(0,o1.composeRefs)(o,t),...i,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":a,"aria-label":r,id:l.listId},h6(e,e=>T.createElement("div",{ref:(0,o1.composeRefs)(s,l.listInnerRef),"cmdk-list-sizer":""},e)))}),hQ=T.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:o,container:s,...a}=e;return T.createElement(hr,{open:n,onOpenChange:r},T.createElement(hu,{container:s},T.createElement(hd,{"cmdk-overlay":"",className:i}),T.createElement(hm,{"aria-label":e.label,"cmdk-dialog":"",className:o},T.createElement(hG,{ref:t,...a}))))});function h0(e){let t=T.useRef(e);return h1(()=>{t.current=e}),t}Object.assign(hG,{List:hZ,Item:hq,Input:hX,Group:hJ,Separator:hY,Dialog:hQ,Empty:T.forwardRef((e,t)=>h5(e=>0===e.filtered.count)?T.createElement(hO.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),Loading:T.forwardRef((e,t)=>{let{progress:n,children:r,label:i="Loading...",...o}=e;return T.createElement(hO.div,{ref:t,...o,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},h6(e,e=>T.createElement("div",{"aria-hidden":!0},e)))})});var h1="u"<typeof window?T.useEffect:T.useLayoutEffect;function h2(e){let t=T.useRef();return void 0===t.current&&(t.current=e()),t}function h5(e){let t=T.useContext(hH),n=()=>e(t.snapshot());return T.useSyncExternalStore(t.subscribe,n,n)}function h3(e,t,n,r=[]){let i=T.useRef(),o=T.useContext(hW);return h1(()=>{var s;let a=(()=>{var e;for(let t of n){if("string"==typeof t)return t.trim();if("object"==typeof t&&"current"in t)return t.current?null==(e=t.current.textContent)?void 0:e.trim():i.current}})(),l=r.map(e=>e.trim());o.value(e,a,l),null==(s=t.current)||s.setAttribute(hU,a),i.current=a}),i}var h4=()=>{let[e,t]=T.useState(),n=h2(()=>new Map);return h1(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function h6({asChild:e,children:t},n){let r;return e&&T.isValidElement(t)?T.cloneElement("function"==typeof(r=t.type)?r(t.props):"render"in r?r.render(t.props):t,{ref:t.ref},n(t.props.children)):n(t)}var h8={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};e.i(326999),D("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);let h9=D("circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);var h7=iH,fe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{let n=(0,h7.createSlot)(`Primitive.${t}`),r=T.forwardRef((e,r)=>{let{asChild:i,...o}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,A.jsx)(i?n:t,{...o,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),ft=iH,fn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{let n=(0,ft.createSlot)(`Primitive.${t}`),r=T.forwardRef((e,r)=>{let{asChild:i,...o}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,A.jsx)(i?n:t,{...o,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),fr=iH,fi=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{let n=(0,fr.createSlot)(`Primitive.${t}`),r=T.forwardRef((e,r)=>{let{asChild:i,...o}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,A.jsx)(i?n:t,{...o,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),fo="rovingFocusGroup.onEntryFocus",fs={bubbles:!1,cancelable:!0},fa="RovingFocusGroup",[fl,fu,fc]=o5(fa),[fd,fh]=(0,o0.createContextScope)(fa,[fc]),[ff,fp]=fd(fa),fm=T.forwardRef((e,t)=>(0,A.jsx)(fl.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,A.jsx)(fl.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,A.jsx)(fg,{...e,ref:t})})}));fm.displayName=fa;var fg=T.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:o,currentTabStopId:s,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:l,onEntryFocus:u,preventScrollOnEntryFocus:c=!1,...d}=e,h=T.useRef(null),f=(0,o1.useComposedRefs)(t,h),p=o9(o),[m,g]=(0,sw.useControllableState)({prop:s,defaultProp:a??null,onChange:l,caller:fa}),[y,v]=T.useState(!1),x=(0,so.useCallbackRef)(u),b=fu(n),w=T.useRef(!1),[k,_]=T.useState(0);return T.useEffect(()=>{let e=h.current;if(e)return e.addEventListener(fo,x),()=>e.removeEventListener(fo,x)},[x]),(0,A.jsx)(ff,{scope:n,orientation:r,dir:p,loop:i,currentTabStopId:m,onItemFocus:T.useCallback(e=>g(e),[g]),onItemShiftTab:T.useCallback(()=>v(!0),[]),onFocusableItemAdd:T.useCallback(()=>_(e=>e+1),[]),onFocusableItemRemove:T.useCallback(()=>_(e=>e-1),[]),children:(0,A.jsx)(fi.div,{tabIndex:y||0===k?-1:0,"data-orientation":r,...d,ref:f,style:{outline:"none",...e.style},onMouseDown:(0,oQ.composeEventHandlers)(e.onMouseDown,()=>{w.current=!0}),onFocus:(0,oQ.composeEventHandlers)(e.onFocus,e=>{let t=!w.current;if(e.target===e.currentTarget&&t&&!y){let t=new CustomEvent(fo,fs);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=b().filter(e=>e.focusable);fb([e.find(e=>e.active),e.find(e=>e.id===m),...e].filter(Boolean).map(e=>e.ref.current),c)}}w.current=!1}),onBlur:(0,oQ.composeEventHandlers)(e.onBlur,()=>v(!1))})})}),fy="RovingFocusGroupItem",fv=T.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:o,children:s,...a}=e,l=(0,sm.useId)(),u=o||l,c=fp(fy,n),d=c.currentTabStopId===u,h=fu(n),{onFocusableItemAdd:f,onFocusableItemRemove:p,currentTabStopId:m}=c;return T.useEffect(()=>{if(r)return f(),()=>p()},[r,f,p]),(0,A.jsx)(fl.ItemSlot,{scope:n,id:u,focusable:r,active:i,children:(0,A.jsx)(fi.span,{tabIndex:d?0:-1,"data-orientation":c.orientation,...a,ref:t,onMouseDown:(0,oQ.composeEventHandlers)(e.onMouseDown,e=>{r?c.onItemFocus(u):e.preventDefault()}),onFocus:(0,oQ.composeEventHandlers)(e.onFocus,()=>c.onItemFocus(u)),onKeyDown:(0,oQ.composeEventHandlers)(e.onKeyDown,e=>{if("Tab"===e.key&&e.shiftKey)return void c.onItemShiftTab();if(e.target!==e.currentTarget)return;let t=function(e,t,n){var r;let i=(r=e.key,"rtl"!==n?r:"ArrowLeft"===r?"ArrowRight":"ArrowRight"===r?"ArrowLeft":r);if(!("vertical"===t&&["ArrowLeft","ArrowRight"].includes(i))&&!("horizontal"===t&&["ArrowUp","ArrowDown"].includes(i)))return fx[i]}(e,c.orientation,c.dir);if(void 0!==t){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let i=h().filter(e=>e.focusable).map(e=>e.ref.current);if("last"===t)i.reverse();else if("prev"===t||"next"===t){var n,r;"prev"===t&&i.reverse();let o=i.indexOf(e.currentTarget);i=c.loop?(n=i,r=o+1,n.map((e,t)=>n[(r+t)%n.length])):i.slice(o+1)}setTimeout(()=>fb(i))}}),children:"function"==typeof s?s({isCurrentTabStop:d,hasTabStop:null!=m}):s})})});fv.displayName=fy;var fx={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function fb(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}var fw=iH,fk=["Enter"," "],f_=["ArrowUp","PageDown","End"],fS=["ArrowDown","PageUp","Home",...f_],fC={ltr:[...fk,"ArrowRight"],rtl:[...fk,"ArrowLeft"]},fE={ltr:["ArrowLeft"],rtl:["ArrowRight"]},fA="Menu",[fT,fN,fj]=o5(fA),[fP,fM]=(0,o0.createContextScope)(fA,[fj,sg.createPopperScope,fh]),fD=(0,sg.createPopperScope)(),fR=fh(),[fL,fO]=fP(fA),[fI,fF]=fP(fA),fz=e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:o,modal:s=!0}=e,a=fD(t),[l,u]=T.useState(null),c=T.useRef(!1),d=(0,so.useCallbackRef)(o),h=o9(i);return T.useEffect(()=>{let e=()=>{c.current=!0,document.addEventListener("pointerdown",t,{capture:!0,once:!0}),document.addEventListener("pointermove",t,{capture:!0,once:!0})},t=()=>c.current=!1;return document.addEventListener("keydown",e,{capture:!0}),()=>{document.removeEventListener("keydown",e,{capture:!0}),document.removeEventListener("pointerdown",t,{capture:!0}),document.removeEventListener("pointermove",t,{capture:!0})}},[]),(0,A.jsx)(sg.Root,{...a,children:(0,A.jsx)(fL,{scope:t,open:n,onOpenChange:d,content:l,onContentChange:u,children:(0,A.jsx)(fI,{scope:t,onClose:T.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:c,dir:h,modal:s,children:r})})})};fz.displayName=fA;var fB=T.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=fD(n);return(0,A.jsx)(sg.Anchor,{...i,...r,ref:t})});fB.displayName="MenuAnchor";var f$="MenuPortal",[fU,fV]=fP(f$,{forceMount:void 0}),fW=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,o=fO(f$,t);return(0,A.jsx)(fU,{scope:t,forceMount:n,children:(0,A.jsx)(di.Presence,{present:n||o.open,children:(0,A.jsx)(sy.Portal,{asChild:!0,container:i,children:r})})})};fW.displayName=f$;var fH="MenuContent",[fK,fG]=fP(fH),fq=T.forwardRef((e,t)=>{let n=fV(fH,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,o=fO(fH,e.__scopeMenu),s=fF(fH,e.__scopeMenu);return(0,A.jsx)(fT.Provider,{scope:e.__scopeMenu,children:(0,A.jsx)(di.Presence,{present:r||o.open,children:(0,A.jsx)(fT.Slot,{scope:e.__scopeMenu,children:s.modal?(0,A.jsx)(fJ,{...i,ref:t}):(0,A.jsx)(fY,{...i,ref:t})})})})}),fJ=T.forwardRef((e,t)=>{let n=fO(fH,e.__scopeMenu),r=T.useRef(null),i=(0,o1.useComposedRefs)(t,r);return T.useEffect(()=>{let e=r.current;if(e)return sj(e)},[]),(0,A.jsx)(fZ,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:(0,oQ.composeEventHandlers)(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),fY=T.forwardRef((e,t)=>{let n=fO(fH,e.__scopeMenu);return(0,A.jsx)(fZ,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),fX=(0,fw.createSlot)("MenuContent.ScrollLock"),fZ=T.forwardRef((e,t)=>{let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:o,onCloseAutoFocus:s,disableOutsidePointerEvents:a,onEntryFocus:l,onEscapeKeyDown:u,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:h,onDismiss:f,disableOutsideScroll:p,...m}=e,g=fO(fH,n),y=fF(fH,n),v=fD(n),x=fR(n),b=fN(n),[w,k]=T.useState(null),_=T.useRef(null),S=(0,o1.useComposedRefs)(t,_,g.onContentChange),C=T.useRef(0),E=T.useRef(""),N=T.useRef(0),j=T.useRef(null),P=T.useRef("right"),M=T.useRef(0),D=p?ao:T.Fragment;T.useEffect(()=>()=>window.clearTimeout(C.current),[]),st();let R=T.useCallback(e=>{var t,n;return P.current===j.current?.side&&(t=e,!!(n=j.current?.area)&&function(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,o=t.length-1;e<t.length;o=e++){let s=t[e],a=t[o],l=s.x,u=s.y,c=a.x,d=a.y;u>r!=d>r&&n<(c-l)*(r-u)/(d-u)+l&&(i=!i)}return i}({x:t.clientX,y:t.clientY},n))},[]);return(0,A.jsx)(fK,{scope:n,searchRef:E,onItemEnter:T.useCallback(e=>{R(e)&&e.preventDefault()},[R]),onItemLeave:T.useCallback(e=>{R(e)||(_.current?.focus(),k(null))},[R]),onTriggerLeave:T.useCallback(e=>{R(e)&&e.preventDefault()},[R]),pointerGraceTimerRef:N,onPointerGraceIntentChange:T.useCallback(e=>{j.current=e},[]),children:(0,A.jsx)(D,{...p?{as:fX,allowPinchZoom:!0}:void 0,children:(0,A.jsx)(su,{asChild:!0,trapped:i,onMountAutoFocus:(0,oQ.composeEventHandlers)(o,e=>{e.preventDefault(),_.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:s,children:(0,A.jsx)(o7.DismissableLayer,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:u,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:h,onDismiss:f,children:(0,A.jsx)(fm,{asChild:!0,...x,dir:y.dir,orientation:"vertical",loop:r,currentTabStopId:w,onCurrentTabStopIdChange:k,onEntryFocus:(0,oQ.composeEventHandlers)(l,e=>{y.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,A.jsx)(sg.Content,{role:"menu","aria-orientation":"vertical","data-state":pg(g.open),"data-radix-menu-content":"",dir:y.dir,...v,...m,ref:S,style:{outline:"none",...m.style},onKeyDown:(0,oQ.composeEventHandlers)(m.onKeyDown,e=>{let t=e.target.closest("[data-radix-menu-content]")===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=1===e.key.length;if(t){var i;let t,o,s,a,l,u;"Tab"===e.key&&e.preventDefault(),!n&&r&&(i=e.key,t=E.current+i,o=b().filter(e=>!e.disabled),s=document.activeElement,a=o.find(e=>e.ref.current===s)?.textValue,l=function(e,t,n){var r;let i=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,o=n?e.indexOf(n):-1,s=(r=Math.max(o,0),e.map((t,n)=>e[(r+n)%e.length]));1===i.length&&(s=s.filter(e=>e!==n));let a=s.find(e=>e.toLowerCase().startsWith(i.toLowerCase()));return a!==n?a:void 0}(o.map(e=>e.textValue),t,a),u=o.find(e=>e.textValue===l)?.ref.current,function e(t){E.current=t,window.clearTimeout(C.current),""!==t&&(C.current=window.setTimeout(()=>e(""),1e3))}(t),u&&setTimeout(()=>u.focus()))}let o=_.current;if(e.target!==o||!fS.includes(e.key))return;e.preventDefault();let s=b().filter(e=>!e.disabled).map(e=>e.ref.current);f_.includes(e.key)&&s.reverse(),function(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}(s)}),onBlur:(0,oQ.composeEventHandlers)(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(C.current),E.current="")}),onPointerMove:(0,oQ.composeEventHandlers)(e.onPointerMove,px(e=>{let t=e.target,n=M.current!==e.clientX;e.currentTarget.contains(t)&&n&&(P.current=e.clientX>M.current?"right":"left",M.current=e.clientX)}))})})})})})})});fq.displayName=fH;var fQ=T.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,A.jsx)(fn.div,{role:"group",...r,ref:t})});fQ.displayName="MenuGroup";var f0=T.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,A.jsx)(fn.div,{...r,ref:t})});f0.displayName="MenuLabel";var f1="MenuItem",f2="menu.itemSelect",f5=T.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:r,...i}=e,o=T.useRef(null),s=fF(f1,e.__scopeMenu),a=fG(f1,e.__scopeMenu),l=(0,o1.useComposedRefs)(t,o),u=T.useRef(!1);return(0,A.jsx)(f3,{...i,ref:l,disabled:n,onClick:(0,oQ.composeEventHandlers)(e.onClick,()=>{let e=o.current;if(!n&&e){let t=new CustomEvent(f2,{bubbles:!0,cancelable:!0});e.addEventListener(f2,e=>r?.(e),{once:!0}),e&&ec.flushSync(()=>e.dispatchEvent(t)),t.defaultPrevented?u.current=!1:s.onClose()}}),onPointerDown:t=>{e.onPointerDown?.(t),u.current=!0},onPointerUp:(0,oQ.composeEventHandlers)(e.onPointerUp,e=>{u.current||e.currentTarget?.click()}),onKeyDown:(0,oQ.composeEventHandlers)(e.onKeyDown,e=>{let t=""!==a.searchRef.current;n||t&&" "===e.key||fk.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});f5.displayName=f1;var f3=T.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:r=!1,textValue:i,...o}=e,s=fG(f1,n),a=fR(n),l=T.useRef(null),u=(0,o1.useComposedRefs)(t,l),[c,d]=T.useState(!1),[h,f]=T.useState("");return T.useEffect(()=>{let e=l.current;e&&f((e.textContent??"").trim())},[o.children]),(0,A.jsx)(fT.ItemSlot,{scope:n,disabled:r,textValue:i??h,children:(0,A.jsx)(fv,{asChild:!0,...a,focusable:!r,children:(0,A.jsx)(fn.div,{role:"menuitem","data-highlighted":c?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...o,ref:u,onPointerMove:(0,oQ.composeEventHandlers)(e.onPointerMove,px(e=>{r?s.onItemLeave(e):(s.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:(0,oQ.composeEventHandlers)(e.onPointerLeave,px(e=>s.onItemLeave(e))),onFocus:(0,oQ.composeEventHandlers)(e.onFocus,()=>d(!0)),onBlur:(0,oQ.composeEventHandlers)(e.onBlur,()=>d(!1))})})})}),f4=T.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,A.jsx)(pr,{scope:e.__scopeMenu,checked:n,children:(0,A.jsx)(f5,{role:"menuitemcheckbox","aria-checked":py(n)?"mixed":n,...i,ref:t,"data-state":pv(n),onSelect:(0,oQ.composeEventHandlers)(i.onSelect,()=>r?.(!!py(n)||!n),{checkForDefaultPrevented:!1})})})});f4.displayName="MenuCheckboxItem";var f6="MenuRadioGroup",[f8,f9]=fP(f6,{value:void 0,onValueChange:()=>{}}),f7=T.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,o=(0,so.useCallbackRef)(r);return(0,A.jsx)(f8,{scope:e.__scopeMenu,value:n,onValueChange:o,children:(0,A.jsx)(fQ,{...i,ref:t})})});f7.displayName=f6;var pe="MenuRadioItem",pt=T.forwardRef((e,t)=>{let{value:n,...r}=e,i=f9(pe,e.__scopeMenu),o=n===i.value;return(0,A.jsx)(pr,{scope:e.__scopeMenu,checked:o,children:(0,A.jsx)(f5,{role:"menuitemradio","aria-checked":o,...r,ref:t,"data-state":pv(o),onSelect:(0,oQ.composeEventHandlers)(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});pt.displayName=pe;var pn="MenuItemIndicator",[pr,pi]=fP(pn,{checked:!1}),po=T.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,o=pi(pn,n);return(0,A.jsx)(di.Presence,{present:r||py(o.checked)||!0===o.checked,children:(0,A.jsx)(fn.span,{...i,ref:t,"data-state":pv(o.checked)})})});po.displayName=pn;var ps=T.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,A.jsx)(fn.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});ps.displayName="MenuSeparator";var pa=T.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=fD(n);return(0,A.jsx)(sg.Arrow,{...i,...r,ref:t})});pa.displayName="MenuArrow";var pl="MenuSub",[pu,pc]=fP(pl),pd=e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,o=fO(pl,t),s=fD(t),[a,l]=T.useState(null),[u,c]=T.useState(null),d=(0,so.useCallbackRef)(i);return T.useEffect(()=>(!1===o.open&&d(!1),()=>d(!1)),[o.open,d]),(0,A.jsx)(sg.Root,{...s,children:(0,A.jsx)(fL,{scope:t,open:r,onOpenChange:d,content:u,onContentChange:c,children:(0,A.jsx)(pu,{scope:t,contentId:(0,sm.useId)(),triggerId:(0,sm.useId)(),trigger:a,onTriggerChange:l,children:n})})})};pd.displayName=pl;var ph="MenuSubTrigger",pf=T.forwardRef((e,t)=>{let n=fO(ph,e.__scopeMenu),r=fF(ph,e.__scopeMenu),i=pc(ph,e.__scopeMenu),o=fG(ph,e.__scopeMenu),s=T.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:l}=o,u={__scopeMenu:e.__scopeMenu},c=T.useCallback(()=>{s.current&&window.clearTimeout(s.current),s.current=null},[]);return T.useEffect(()=>c,[c]),T.useEffect(()=>{let e=a.current;return()=>{window.clearTimeout(e),l(null)}},[a,l]),(0,A.jsx)(fB,{asChild:!0,...u,children:(0,A.jsx)(f3,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":i.contentId,"data-state":pg(n.open),...e,ref:(0,o1.composeRefs)(t,i.onTriggerChange),onClick:t=>{e.onClick?.(t),e.disabled||t.defaultPrevented||(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:(0,oQ.composeEventHandlers)(e.onPointerMove,px(t=>{o.onItemEnter(t),!t.defaultPrevented&&(e.disabled||n.open||s.current||(o.onPointerGraceIntentChange(null),s.current=window.setTimeout(()=>{n.onOpenChange(!0),c()},100)))})),onPointerLeave:(0,oQ.composeEventHandlers)(e.onPointerLeave,px(e=>{c();let t=n.content?.getBoundingClientRect();if(t){let r=n.content?.dataset.side,i="right"===r,s=t[i?"left":"right"],l=t[i?"right":"left"];o.onPointerGraceIntentChange({area:[{x:e.clientX+(i?-5:5),y:e.clientY},{x:s,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:s,y:t.bottom}],side:r}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>o.onPointerGraceIntentChange(null),300)}else{if(o.onTriggerLeave(e),e.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:(0,oQ.composeEventHandlers)(e.onKeyDown,t=>{let i=""!==o.searchRef.current;e.disabled||i&&" "===t.key||fC[r.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})});pf.displayName=ph;var pp="MenuSubContent",pm=T.forwardRef((e,t)=>{let n=fV(fH,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,o=fO(fH,e.__scopeMenu),s=fF(fH,e.__scopeMenu),a=pc(pp,e.__scopeMenu),l=T.useRef(null),u=(0,o1.useComposedRefs)(t,l);return(0,A.jsx)(fT.Provider,{scope:e.__scopeMenu,children:(0,A.jsx)(di.Presence,{present:r||o.open,children:(0,A.jsx)(fT.Slot,{scope:e.__scopeMenu,children:(0,A.jsx)(fZ,{id:a.contentId,"aria-labelledby":a.triggerId,...i,ref:u,align:"start",side:"rtl"===s.dir?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{s.isUsingKeyboardRef.current&&l.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:(0,oQ.composeEventHandlers)(e.onFocusOutside,e=>{e.target!==a.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:(0,oQ.composeEventHandlers)(e.onEscapeKeyDown,e=>{s.onClose(),e.preventDefault()}),onKeyDown:(0,oQ.composeEventHandlers)(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=fE[s.dir].includes(e.key);t&&n&&(o.onOpenChange(!1),a.trigger?.focus(),e.preventDefault())})})})})})});function pg(e){return e?"open":"closed"}function py(e){return"indeterminate"===e}function pv(e){return py(e)?"indeterminate":e?"checked":"unchecked"}function px(e){return t=>"mouse"===t.pointerType?e(t):void 0}pm.displayName=pp;var pb="DropdownMenu",[pw,pk]=(0,o0.createContextScope)(pb,[fM]),p_=fM(),[pS,pC]=pw(pb),pE=e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:o,onOpenChange:s,modal:a=!0}=e,l=p_(t),u=T.useRef(null),[c,d]=(0,sw.useControllableState)({prop:i,defaultProp:o??!1,onChange:s,caller:pb});return(0,A.jsx)(pS,{scope:t,triggerId:(0,sm.useId)(),triggerRef:u,contentId:(0,sm.useId)(),open:c,onOpenChange:d,onOpenToggle:T.useCallback(()=>d(e=>!e),[d]),modal:a,children:(0,A.jsx)(fz,{...l,open:c,onOpenChange:d,dir:r,modal:a,children:n})})};pE.displayName=pb;var pA="DropdownMenuTrigger",pT=T.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,o=pC(pA,n),s=p_(n);return(0,A.jsx)(fB,{asChild:!0,...s,children:(0,A.jsx)(fe.button,{type:"button",id:o.triggerId,"aria-haspopup":"menu","aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":o.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...i,ref:(0,o1.composeRefs)(t,o.triggerRef),onPointerDown:(0,oQ.composeEventHandlers)(e.onPointerDown,e=>{!r&&0===e.button&&!1===e.ctrlKey&&(o.onOpenToggle(),o.open||e.preventDefault())}),onKeyDown:(0,oQ.composeEventHandlers)(e.onKeyDown,e=>{!r&&(["Enter"," "].includes(e.key)&&o.onOpenToggle(),"ArrowDown"===e.key&&o.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(e.key)&&e.preventDefault())})})})});pT.displayName=pA;var pN=e=>{let{__scopeDropdownMenu:t,...n}=e,r=p_(t);return(0,A.jsx)(fW,{...r,...n})};pN.displayName="DropdownMenuPortal";var pj="DropdownMenuContent",pP=T.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=pC(pj,n),o=p_(n),s=T.useRef(!1);return(0,A.jsx)(fq,{id:i.contentId,"aria-labelledby":i.triggerId,...o,...r,ref:t,onCloseAutoFocus:(0,oQ.composeEventHandlers)(e.onCloseAutoFocus,e=>{s.current||i.triggerRef.current?.focus(),s.current=!1,e.preventDefault()}),onInteractOutside:(0,oQ.composeEventHandlers)(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=0===t.button&&!0===t.ctrlKey,r=2===t.button||n;(!i.modal||r)&&(s.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});pP.displayName=pj;var pM=T.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=p_(n);return(0,A.jsx)(fQ,{...i,...r,ref:t})});pM.displayName="DropdownMenuGroup";var pD=T.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=p_(n);return(0,A.jsx)(f0,{...i,...r,ref:t})});pD.displayName="DropdownMenuLabel";var pR=T.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=p_(n);return(0,A.jsx)(f5,{...i,...r,ref:t})});pR.displayName="DropdownMenuItem";var pL=T.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=p_(n);return(0,A.jsx)(f4,{...i,...r,ref:t})});pL.displayName="DropdownMenuCheckboxItem";var pO=T.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=p_(n);return(0,A.jsx)(f7,{...i,...r,ref:t})});pO.displayName="DropdownMenuRadioGroup";var pI=T.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=p_(n);return(0,A.jsx)(pt,{...i,...r,ref:t})});pI.displayName="DropdownMenuRadioItem";var pF=T.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=p_(n);return(0,A.jsx)(po,{...i,...r,ref:t})});pF.displayName="DropdownMenuItemIndicator";var pz=T.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=p_(n);return(0,A.jsx)(ps,{...i,...r,ref:t})});pz.displayName="DropdownMenuSeparator";var pB=T.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=p_(n);return(0,A.jsx)(pa,{...i,...r,ref:t})});pB.displayName="DropdownMenuArrow";var p$=e=>{let{__scopeDropdownMenu:t,children:n,open:r,onOpenChange:i,defaultOpen:o}=e,s=p_(t),[a,l]=(0,sw.useControllableState)({prop:r,defaultProp:o??!1,onChange:i,caller:"DropdownMenuSub"});return(0,A.jsx)(pd,{...s,open:a,onOpenChange:l,children:n})},pU=T.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=p_(n);return(0,A.jsx)(pf,{...i,...r,ref:t})});pU.displayName="DropdownMenuSubTrigger";var pV=T.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=p_(n);return(0,A.jsx)(pm,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});function pW({className:e,...t}){return(0,A.jsx)("div",{"data-slot":"input-group",role:"group",className:oG("group/input-group relative flex w-full items-center rounded-md border border-input shadow-xs transition-[color,box-shadow] outline-none dark:bg-input/30","h-9 min-w-0 has-[>textarea]:h-auto","has-[>[data-align=inline-start]]:[&>input]:pl-2","has-[>[data-align=inline-end]]:[&>input]:pr-2","has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>[data-align=block-start]]:[&>input]:pb-3","has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-end]]:[&>input]:pt-3","has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-[3px] has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50","has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-destructive/20 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40",e),...t})}pV.displayName="DropdownMenuSubContent",e.s(["Arrow",0,pB,"CheckboxItem",0,pL,"Content",0,pP,"DropdownMenu",0,pE,"DropdownMenuArrow",0,pB,"DropdownMenuCheckboxItem",0,pL,"DropdownMenuContent",0,pP,"DropdownMenuGroup",0,pM,"DropdownMenuItem",0,pR,"DropdownMenuItemIndicator",0,pF,"DropdownMenuLabel",0,pD,"DropdownMenuPortal",0,pN,"DropdownMenuRadioGroup",0,pO,"DropdownMenuRadioItem",0,pI,"DropdownMenuSeparator",0,pz,"DropdownMenuSub",0,p$,"DropdownMenuSubContent",0,pV,"DropdownMenuSubTrigger",0,pU,"DropdownMenuTrigger",0,pT,"Group",0,pM,"Item",0,pR,"ItemIndicator",0,pF,"Label",0,pD,"Portal",0,pN,"RadioGroup",0,pO,"RadioItem",0,pI,"Root",0,pE,"Separator",0,pz,"Sub",0,p$,"SubContent",0,pV,"SubTrigger",0,pU,"Trigger",0,pT,"createDropdownMenuScope",0,pk],540666),e.i(540666);let pH=iW("flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4",{variants:{align:{"inline-start":"order-first pl-3 has-[>button]:ml-[-0.45rem] has-[>kbd]:ml-[-0.35rem]","inline-end":"order-last pr-3 has-[>button]:mr-[-0.45rem] has-[>kbd]:mr-[-0.35rem]","block-start":"order-first w-full justify-start px-3 pt-3 group-has-[>input]/input-group:pt-2.5 [.border-b]:pb-3","block-end":"order-last w-full justify-start px-3 pb-3 group-has-[>input]/input-group:pb-2.5 [.border-t]:pt-3"}},defaultVariants:{align:"inline-start"}});function pK({className:e,align:t="inline-start",...n}){return(0,A.jsx)("div",{role:"group","data-slot":"input-group-addon","data-align":t,className:oG(pH({align:t}),e),onClick:e=>{e.target.closest("button")||e.currentTarget.parentElement?.querySelector("input")?.focus()},...n})}let pG=iW("flex items-center gap-2 text-sm shadow-none",{variants:{size:{xs:"h-6 gap-1 rounded-[calc(var(--radius)-5px)] px-2 has-[>svg]:px-2 [&>svg:not([class*='size-'])]:size-3.5",sm:"h-8 gap-1.5 rounded-md px-2.5 has-[>svg]:px-2.5","icon-xs":"size-6 rounded-[calc(var(--radius)-5px)] p-0 has-[>svg]:p-0","icon-sm":"size-8 p-0 has-[>svg]:p-0"}},defaultVariants:{size:"xs"}});function pq({className:e,type:t="button",variant:n="ghost",size:r="xs",...i}){return(0,A.jsx)(oJ,{type:t,"data-size":r,variant:n,className:oG(pG({size:r}),e),...i})}D("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);var pJ=e.i(186336),pJ=pJ;function pY({...e}){return(0,A.jsx)(pJ.Root,{"data-slot":"tooltip",...e})}function pX({...e}){return(0,A.jsx)(pJ.Trigger,{"data-slot":"tooltip-trigger",...e})}function pZ({className:e,sideOffset:t=0,children:n,...r}){return(0,A.jsx)(pJ.Portal,{children:(0,A.jsxs)(pJ.Content,{"data-slot":"tooltip-content",sideOffset:t,className:oG("z-50 w-fit origin-(--radix-tooltip-content-transform-origin) animate-in rounded-md bg-foreground px-3 py-1.5 text-xs text-balance text-background fade-in-0 zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",e),...r,children:[n,(0,A.jsx)(pJ.Arrow,{className:"z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground"})]})})}D("corner-down-left",[["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}],["path",{d:"m9 10-5 5 5 5",key:"1kshq7"}]]),D("image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]),D("monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]),D("square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);let pQ=(e=21)=>{let t="",n=crypto.getRandomValues(new Uint8Array(e|=0));for(;e--;)t+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[63&n[e]];return t},p0=async e=>{try{let t=await fetch(e),n=await t.blob();return new Promise(e=>{let t=new FileReader;t.onloadend=()=>e(t.result),t.onerror=()=>e(null),t.readAsDataURL(n)})}catch{return null}},p1=(0,T.createContext)(null),p2=(0,T.createContext)(null),p5=(0,T.createContext)(null),p3=({className:e,accept:t,multiple:n,globalDrop:r,syncHiddenInput:i,maxFiles:o,maxFileSize:s,onError:a,onSubmit:l,children:u,...c})=>{let d=(0,T.useContext)(p1),h=!!d,f=(0,T.useRef)(null),p=(0,T.useRef)(null),[m,g]=(0,T.useState)([]),y=h?d.attachments.files:m,[v,x]=(0,T.useState)([]),b=(0,T.useRef)(y);(0,T.useEffect)(()=>{b.current=y},[y]);let w=(0,T.useCallback)(()=>{f.current?.click()},[]),k=(0,T.useCallback)(e=>!t||""===t.trim()||t.split(",").map(e=>e.trim()).filter(Boolean).some(t=>{if(t.endsWith("/*")){let n=t.slice(0,-1);return e.type.startsWith(n)}return e.type===t}),[t]),_=(0,T.useCallback)(e=>{let t=[...e],n=t.filter(e=>k(e));if(t.length&&0===n.length)return void a?.({code:"accept",message:"No files match the accepted types."});let r=n.filter(e=>!s||e.size<=s);n.length>0&&0===r.length?a?.({code:"max_file_size",message:"All files exceed the maximum size."}):g(e=>{let t="number"==typeof o?Math.max(0,o-e.length):void 0,n="number"==typeof t?r.slice(0,t):r;"number"==typeof t&&r.length>t&&a?.({code:"max_files",message:"Too many files. Some were not added."});let i=[];for(let e of n)i.push({filename:e.name,id:pQ(),mediaType:e.type,type:"file",url:URL.createObjectURL(e)});return[...e,...i]})},[k,o,s,a]),S=(0,T.useCallback)(e=>g(t=>{let n=t.find(t=>t.id===e);return n?.url&&URL.revokeObjectURL(n.url),t.filter(t=>t.id!==e)}),[]),C=(0,T.useCallback)(e=>{let t=[...e],n=t.filter(e=>k(e));if(t.length&&0===n.length)return void a?.({code:"accept",message:"No files match the accepted types."});let r=n.filter(e=>!s||e.size<=s);if(n.length>0&&0===r.length)return void a?.({code:"max_file_size",message:"All files exceed the maximum size."});let i=y.length,l="number"==typeof o?Math.max(0,o-i):void 0,u="number"==typeof l?r.slice(0,l):r;"number"==typeof l&&r.length>l&&a?.({code:"max_files",message:"Too many files. Some were not added."}),u.length>0&&d?.attachments.add(u)},[k,s,o,a,y.length,d]),E=(0,T.useCallback)(()=>h?d?.attachments.clear():g(e=>{for(let t of e)t.url&&URL.revokeObjectURL(t.url);return[]}),[h,d]),N=(0,T.useCallback)(()=>x([]),[]),j=h?C:_,P=h?d.attachments.remove:S,M=h?d.attachments.openFileDialog:w,D=(0,T.useCallback)(()=>{E(),N()},[E,N]);(0,T.useEffect)(()=>{h&&d.__registerFileInput(f,()=>f.current?.click())},[h,d]),(0,T.useEffect)(()=>{i&&f.current&&0===y.length&&(f.current.value="")},[y,i]),(0,T.useEffect)(()=>{let e=p.current;if(!e||r)return;let t=e=>{e.dataTransfer?.types?.includes("Files")&&e.preventDefault()},n=e=>{e.dataTransfer?.types?.includes("Files")&&e.preventDefault(),e.dataTransfer?.files&&e.dataTransfer.files.length>0&&j(e.dataTransfer.files)};return e.addEventListener("dragover",t),e.addEventListener("drop",n),()=>{e.removeEventListener("dragover",t),e.removeEventListener("drop",n)}},[j,r]),(0,T.useEffect)(()=>{if(!r)return;let e=e=>{e.dataTransfer?.types?.includes("Files")&&e.preventDefault()},t=e=>{e.dataTransfer?.types?.includes("Files")&&e.preventDefault(),e.dataTransfer?.files&&e.dataTransfer.files.length>0&&j(e.dataTransfer.files)};return document.addEventListener("dragover",e),document.addEventListener("drop",t),()=>{document.removeEventListener("dragover",e),document.removeEventListener("drop",t)}},[j,r]),(0,T.useEffect)(()=>()=>{if(!h)for(let e of b.current)e.url&&URL.revokeObjectURL(e.url)},[h]);let R=(0,T.useCallback)(e=>{e.currentTarget.files&&j(e.currentTarget.files),e.currentTarget.value=""},[j]),L=(0,T.useMemo)(()=>({add:j,clear:E,fileInputRef:f,files:y.map(e=>({...e,id:e.id})),openFileDialog:M,remove:P}),[y,j,P,E,M]),O=(0,T.useMemo)(()=>({add:e=>{let t=Array.isArray(e)?e:[e];x(e=>[...e,...t.map(e=>({...e,id:pQ()}))])},clear:N,remove:e=>{x(t=>t.filter(t=>t.id!==e))},sources:v}),[v,N]),I=(0,T.useCallback)(async e=>{e.preventDefault();let t=e.currentTarget,n=h?d.textInput.value:new FormData(t).get("message")||"";h||t.reset();try{let t=await Promise.all(y.map(async({id:e,...t})=>{if(t.url?.startsWith("blob:")){let e=await p0(t.url);return{...t,url:e??t.url}}return t})),r=l({files:t,text:n},e);if(r instanceof Promise)try{await r,D(),h&&d.textInput.clear()}catch{}else D(),h&&d.textInput.clear()}catch{}},[h,d,y,l,D]),F=(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)("input",{accept:t,"aria-label":"Upload files",className:"hidden",multiple:n,onChange:R,ref:f,title:"Upload files",type:"file"}),(0,A.jsx)("form",{className:oG("w-full",e),onSubmit:I,ref:p,...c,children:(0,A.jsx)(pW,{className:"overflow-hidden",children:u})})]}),z=(0,A.jsx)(p5.Provider,{value:O,children:F});return(0,A.jsx)(p2.Provider,{value:L,children:z})},p4=({className:e,...t})=>(0,A.jsx)("div",{className:oG("contents",e),...t}),p6=({className:e,...t})=>(0,A.jsx)(pK,{align:"block-end",className:oG("justify-between gap-1",e),...t}),p8=({className:e,...t})=>(0,A.jsx)("div",{className:oG("flex min-w-0 items-center gap-1",e),...t}),p9=({variant:e="ghost",className:t,size:n,tooltip:r,...i})=>{let o=n??(T.Children.count(i.children)>1?"sm":"icon-sm"),s=(0,A.jsx)(pq,{className:oG(t),size:o,type:"button",variant:e,...i});if(!r)return s;let a="string"==typeof r?r:r.content,l="string"==typeof r?void 0:r.shortcut,u="string"==typeof r?"top":r.side??"top";return(0,A.jsxs)(pY,{children:[(0,A.jsx)(pX,{asChild:!0,children:s}),(0,A.jsxs)(pZ,{side:u,children:[a,l&&(0,A.jsx)("span",{className:"ml-2 text-muted-foreground",children:l})]})]})},p7=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],me=new Set(p7),mt=(e,t,n)=>n>t?t:n<e?e:n,mn={test:e=>"number"==typeof e,parse:parseFloat,transform:e=>e},mr={...mn,transform:e=>mt(0,1,e)},mi={...mn,default:1},mo=e=>Math.round(1e5*e)/1e5,ms=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu,ma=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,ml=(e,t)=>n=>!!("string"==typeof n&&ma.test(n)&&n.startsWith(e)||t&&null!=n&&Object.prototype.hasOwnProperty.call(n,t)),mu=(e,t,n)=>r=>{if("string"!=typeof r)return r;let[i,o,s,a]=r.match(ms);return{[e]:parseFloat(i),[t]:parseFloat(o),[n]:parseFloat(s),alpha:void 0!==a?parseFloat(a):1}},mc={...mn,transform:e=>Math.round(mt(0,255,e))},md={test:ml("rgb","red"),parse:mu("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:r=1})=>"rgba("+mc.transform(e)+", "+mc.transform(t)+", "+mc.transform(n)+", "+mo(mr.transform(r))+")"},mh={test:ml("#"),parse:function(e){let t="",n="",r="",i="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),i=e.substring(4,5),t+=t,n+=n,r+=r,i+=i),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:i?parseInt(i,16)/255:1}},transform:md.transform},mf=e=>({test:t=>"string"==typeof t&&t.endsWith(e)&&1===t.split(" ").length,parse:parseFloat,transform:t=>`${t}${e}`}),mp=mf("deg"),mm=mf("%"),mg=mf("px"),my=mf("vh"),mv=mf("vw"),mx={...mm,parse:e=>mm.parse(e)/100,transform:e=>mm.transform(100*e)},mb={test:ml("hsl","hue"),parse:mu("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>"hsla("+Math.round(e)+", "+mm.transform(mo(t))+", "+mm.transform(mo(n))+", "+mo(mr.transform(r))+")"},mw={test:e=>md.test(e)||mh.test(e)||mb.test(e),parse:e=>md.test(e)?md.parse(e):mb.test(e)?mb.parse(e):mh.parse(e),transform:e=>"string"==typeof e?e:e.hasOwnProperty("red")?md.transform(e):mb.transform(e),getAnimatableNone:e=>{let t=mw.parse(e);return t.alpha=0,mw.transform(t)}},mk=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu,m_="number",mS="color",mC=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function mE(e){let t=e.toString(),n=[],r={color:[],number:[],var:[]},i=[],o=0,s=t.replace(mC,e=>(mw.test(e)?(r.color.push(o),i.push(mS),n.push(mw.parse(e))):e.startsWith("var(")?(r.var.push(o),i.push("var"),n.push(e)):(r.number.push(o),i.push(m_),n.push(parseFloat(e))),++o,"${}")).split("${}");return{values:n,split:s,indexes:r,types:i}}function mA({split:e,types:t}){let n=e.length;return r=>{let i="";for(let o=0;o<n;o++)if(i+=e[o],void 0!==r[o]){let e=t[o];e===m_?i+=mo(r[o]):e===mS?i+=mw.transform(r[o]):i+=r[o]}return i}}let mT={test:function(e){return isNaN(e)&&"string"==typeof e&&(e.match(ms)?.length||0)+(e.match(mk)?.length||0)>0},parse:function(e){return mE(e).values},createTransformer:function(e){return mA(mE(e))},getAnimatableNone:function(e){let t=mE(e);return mA(t)(t.values.map((e,n)=>((e,t)=>"number"==typeof e?t?.trim().endsWith("/")?e:0:"number"==typeof e?0:mw.test(e)?mw.getAnimatableNone(e):e)(e,t.split[n])))}},mN=new Set(["brightness","contrast","saturate","opacity"]);function mj(e){let[t,n]=e.slice(0,-1).split("(");if("drop-shadow"===t)return e;let[r]=n.match(ms)||[];if(!r)return e;let i=n.replace(r,""),o=+!!mN.has(t);return r!==n&&(o*=100),t+"("+o+i+")"}let mP=/\b([a-z-]*)\(.*?\)/gu,mM={...mT,getAnimatableNone:e=>{let t=e.match(mP);return t?t.map(mj).join(" "):e}},mD={...mT,getAnimatableNone:e=>{let t=mT.parse(e);return mT.createTransformer(e)(t.map(e=>"number"==typeof e?0:"object"==typeof e?{...e,alpha:1}:e))}},mR={...mn,transform:Math.round},mL={borderWidth:mg,borderTopWidth:mg,borderRightWidth:mg,borderBottomWidth:mg,borderLeftWidth:mg,borderRadius:mg,borderTopLeftRadius:mg,borderTopRightRadius:mg,borderBottomRightRadius:mg,borderBottomLeftRadius:mg,width:mg,maxWidth:mg,height:mg,maxHeight:mg,top:mg,right:mg,bottom:mg,left:mg,inset:mg,insetBlock:mg,insetBlockStart:mg,insetBlockEnd:mg,insetInline:mg,insetInlineStart:mg,insetInlineEnd:mg,padding:mg,paddingTop:mg,paddingRight:mg,paddingBottom:mg,paddingLeft:mg,paddingBlock:mg,paddingBlockStart:mg,paddingBlockEnd:mg,paddingInline:mg,paddingInlineStart:mg,paddingInlineEnd:mg,margin:mg,marginTop:mg,marginRight:mg,marginBottom:mg,marginLeft:mg,marginBlock:mg,marginBlockStart:mg,marginBlockEnd:mg,marginInline:mg,marginInlineStart:mg,marginInlineEnd:mg,fontSize:mg,backgroundPositionX:mg,backgroundPositionY:mg,rotate:mp,rotateX:mp,rotateY:mp,rotateZ:mp,scale:mi,scaleX:mi,scaleY:mi,scaleZ:mi,skew:mp,skewX:mp,skewY:mp,distance:mg,translateX:mg,translateY:mg,translateZ:mg,x:mg,y:mg,z:mg,perspective:mg,transformPerspective:mg,opacity:mr,originX:mx,originY:mx,originZ:mg,zIndex:mR,fillOpacity:mr,strokeOpacity:mr,numOctaves:mR},mO={...mL,color:mw,backgroundColor:mw,outlineColor:mw,fill:mw,stroke:mw,borderColor:mw,borderTopColor:mw,borderRightColor:mw,borderBottomColor:mw,borderLeftColor:mw,filter:mM,WebkitFilter:mM,mask:mD,WebkitMask:mD},mI=e=>mO[e],mF=()=>({translate:0,scale:1,origin:0,originPoint:0}),mz=()=>({x:mF(),y:mF()}),mB=()=>({min:0,max:0}),m$=()=>({x:mB(),y:mB()}),mU=e=>!!(e&&e.getVelocity),mV=new Set(["width","height","top","left","right","bottom",...p7]),mW=e=>t=>t.test(e),mH=[mn,mg,mm,mp,mv,my,{test:e=>"auto"===e,parse:e=>e}],mK=e=>mH.find(mW(e)),mG=()=>{},mq=()=>{};lT.default;let mJ=e=>t=>"string"==typeof t&&t.startsWith(e),mY=mJ("--"),mX=mJ("var(--"),mZ=e=>!!mX(e)&&mQ.test(e.split("/*")[0].trim()),mQ=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function m0(e){return"string"==typeof e&&e.split("/*")[0].includes("var(--")}let m1=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u,m2=e=>180*e/Math.PI,m5=e=>m4(m2(Math.atan2(e[1],e[0]))),m3={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:m5,rotateZ:m5,skewX:e=>m2(Math.atan(e[1])),skewY:e=>m2(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},m4=e=>((e%=360)<0&&(e+=360),e),m6=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),m8=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),m9={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:m6,scaleY:m8,scale:e=>(m6(e)+m8(e))/2,rotateX:e=>m4(m2(Math.atan2(e[6],e[5]))),rotateY:e=>m4(m2(Math.atan2(-e[2],e[0]))),rotateZ:m5,rotate:m5,skewX:e=>m2(Math.atan(e[4])),skewY:e=>m2(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function m7(e){return+!!e.includes("scale")}function ge(e,t){let n,r;if(!e||"none"===e)return m7(t);let i=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);if(i)n=m9,r=i;else{let t=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);n=m3,r=t}if(!r)return m7(t);let o=n[t],s=r[1].split(",").map(gt);return"function"==typeof o?o(s):s[o]}function gt(e){return parseFloat(e.trim())}let gn=e=>e===mn||e===mg,gr=new Set(["x","y","z"]),gi=p7.filter(e=>!gr.has(e)),go={width:({x:e},{paddingLeft:t="0",paddingRight:n="0",boxSizing:r})=>{let i=e.max-e.min;return"border-box"===r?i:i-parseFloat(t)-parseFloat(n)},height:({y:e},{paddingTop:t="0",paddingBottom:n="0",boxSizing:r})=>{let i=e.max-e.min;return"border-box"===r?i:i-parseFloat(t)-parseFloat(n)},top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>ge(t,"x"),y:(e,{transform:t})=>ge(t,"y")};go.translateX=go.x,go.translateY=go.y;let gs=e=>e,ga={},gl=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function gu(e,t){let n=!1,r=!0,i={delta:0,timestamp:0,isProcessing:!1},o=()=>n=!0,s=gl.reduce((e,n)=>(e[n]=function(e,t){let n=new Set,r=new Set,i=!1,o=!1,s=new WeakSet,a={delta:0,timestamp:0,isProcessing:!1},l=0;function u(t){s.has(t)&&(c.schedule(t),e()),l++,t(a)}let c={schedule:(e,t=!1,o=!1)=>{let a=o&&i?n:r;return t&&s.add(e),a.add(e),e},cancel:e=>{r.delete(e),s.delete(e)},process:e=>{if(a=e,i){o=!0;return}i=!0;let s=n;n=r,r=s,n.forEach(u),t,l=0,n.clear(),i=!1,o&&(o=!1,c.process(e))}};return c}(o,t?n:void 0),e),{}),{setup:a,read:l,resolveKeyframes:u,preUpdate:c,update:d,preRender:h,render:f,postRender:p}=s,m=()=>{let o=ga.useManualTiming,s=o?i.timestamp:performance.now();n=!1,o||(i.delta=r?1e3/60:Math.max(Math.min(s-i.timestamp,40),1)),i.timestamp=s,i.isProcessing=!0,a.process(i),l.process(i),u.process(i),c.process(i),d.process(i),h.process(i),f.process(i),p.process(i),i.isProcessing=!1,n&&t&&(r=!1,e(m))};return{schedule:gl.reduce((t,o)=>{let a=s[o];return t[o]=(t,o=!1,s=!1)=>(!n&&(n=!0,r=!0,i.isProcessing||e(m)),a.schedule(t,o,s)),t},{}),cancel:e=>{for(let t=0;t<gl.length;t++)s[gl[t]].cancel(e)},state:i,steps:s}}let{schedule:gc,cancel:gd,state:gh,steps:gf}=gu("u">typeof requestAnimationFrame?requestAnimationFrame:gs,!0),gp=new Set,gm=!1,gg=!1,gy=!1;function gv(){if(gg){let e=Array.from(gp).filter(e=>e.needsMeasurement),t=new Set(e.map(e=>e.element)),n=new Map;t.forEach(e=>{let t,r=(t=[],gi.forEach(n=>{let r=e.getValue(n);void 0!==r&&(t.push([n,r.get()]),r.set(+!!n.startsWith("scale")))}),t);r.length&&(n.set(e,r),e.render())}),e.forEach(e=>e.measureInitialState()),t.forEach(e=>{e.render();let t=n.get(e);t&&t.forEach(([t,n])=>{e.getValue(t)?.set(n)})}),e.forEach(e=>e.measureEndState()),e.forEach(e=>{void 0!==e.suspendedScrollY&&window.scrollTo(0,e.suspendedScrollY)})}gg=!1,gm=!1,gp.forEach(e=>e.complete(gy)),gp.clear()}function gx(){gp.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(gg=!0)})}class gb{constructor(e,t,n,r,i,o=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=t,this.name=n,this.motionValue=r,this.element=i,this.isAsync=o}scheduleResolve(){this.state="scheduled",this.isAsync?(gp.add(this),gm||(gm=!0,gc.read(gx),gc.resolveKeyframes(gv))):(this.readKeyframes(),this.complete())}readKeyframes(){let{unresolvedKeyframes:e,name:t,element:n,motionValue:r}=this;if(null===e[0]){let i=r?.get(),o=e[e.length-1];if(void 0!==i)e[0]=i;else if(n&&t){let r=n.readValue(t,o);null!=r&&(e[0]=r)}void 0===e[0]&&(e[0]=o),r&&void 0===i&&r.set(e[0])}for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),gp.delete(this)}cancel(){"scheduled"===this.state&&(gp.delete(this),this.state="pending")}resume(){"pending"===this.state&&this.scheduleResolve()}}let gw=new Set([mM,mD]);function gk(e,t){let n=mI(e);return gw.has(n)||(n=mT),n.getAnimatableNone?n.getAnimatableNone(t):void 0}let g_=new Set(["auto","none","0"]);class gS extends gb{constructor(e,t,n,r,i){super(e,t,n,r,i,!0)}readKeyframes(){let{unresolvedKeyframes:e,element:t,name:n}=this;if(!t||!t.current)return;super.readKeyframes();for(let n=0;n<e.length;n++){let r=e[n];if("string"==typeof r&&mZ(r=r.trim())){let i=function e(t,n,r=1){mq(r<=4,`Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`,"max-css-var-depth");let[i,o]=function(e){let t=m1.exec(e);if(!t)return[,];let[,n,r,i]=t;return[`--${n??r}`,i]}(t);if(!i)return;let s=window.getComputedStyle(n).getPropertyValue(i);if(s){let e=s.trim();return/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e)?parseFloat(e):e}return mZ(o)?e(o,n,r+1):o}(r,t.current);void 0!==i&&(e[n]=i),n===e.length-1&&(this.finalKeyframe=r)}}if(this.resolveNoneKeyframes(),!mV.has(n)||2!==e.length)return;let[r,i]=e,o=mK(r),s=mK(i);if(m0(r)!==m0(i)&&go[n]){this.needsMeasurement=!0;return}if(o!==s)if(gn(o)&&gn(s))for(let t=0;t<e.length;t++){let n=e[t];"string"==typeof n&&(e[t]=parseFloat(n))}else go[n]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){let{unresolvedKeyframes:e,name:t}=this,n=[];for(let t=0;t<e.length;t++)(null===e[t]||function(e){if("number"==typeof e)return 0===e;if(null===e)return!0;return"none"===e||"0"===e||/^0[^.\s]+$/u.test(e)}(e[t]))&&n.push(t);n.length&&function(e,t,n){let r,i=0;for(;i<e.length&&!r;){let t=e[i];"string"==typeof t&&!g_.has(t)&&mE(t).values.length&&(r=e[i]),i++}if(r&&n)for(let i of t)e[i]=gk(n,r)}(e,n,t)}measureInitialState(){let{element:e,unresolvedKeyframes:t,name:n}=this;if(!e||!e.current)return;"height"===n&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=go[n](e.measureViewportBox(),window.getComputedStyle(e.current)),t[0]=this.measuredOrigin;let r=t[t.length-1];void 0!==r&&e.getValue(n,r).jump(r,!1)}measureEndState(){let{element:e,name:t,unresolvedKeyframes:n}=this;if(!e||!e.current)return;let r=e.getValue(t);r&&r.jump(this.measuredOrigin,!1);let i=n.length-1,o=n[i];n[i]=go[t](e.measureViewportBox(),window.getComputedStyle(e.current)),null!==o&&void 0===this.finalKeyframe&&(this.finalKeyframe=o),this.removedTransforms?.length&&this.removedTransforms.forEach(([t,n])=>{e.getValue(t).set(n)}),this.resolveNoneKeyframes()}}let gC=e=>1e3*e;function gE(e,t){-1===e.indexOf(t)&&e.push(t)}function gA(e,t){let n=e.indexOf(t);n>-1&&e.splice(n,1)}class gT{constructor(){this.subscriptions=[]}add(e){return gE(this.subscriptions,e),()=>gA(this.subscriptions,e)}notify(e,t,n){let r=this.subscriptions.length;if(r)if(1===r)this.subscriptions[0](e,t,n);else for(let i=0;i<r;i++){let r=this.subscriptions[i];r&&r(e,t,n)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}function gN(e,t,n){t.startsWith("--")?e.style.setProperty(t,n):e.style[t]=n}function gj(e){let t;return()=>(void 0===t&&(t=e()),t)}let gP={};function gM(e,t){let n=gj(e);return()=>gP[t]??n()}let gD=gM(()=>void 0!==window.ScrollTimeline,"scrollTimeline"),gR=e=>null!==e;function gL(e,{repeat:t,repeatType:n="loop"},r,i=1){let o=e.filter(gR),s=i<0||t&&"loop"!==n&&t%2==1?0:o.length-1;return s&&void 0!==r?r:o[s]}class gO{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,t){return this.finished.then(e,t)}}let gI={layout:0,mainThread:0,waapi:0},gF=e=>Array.isArray(e)&&"number"==typeof e[0],gz=gM(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(e){return!1}return!0},"linearEasing"),gB=(e,t,n=10)=>{let r="",i=Math.max(Math.round(t/n),2);for(let t=0;t<i;t++)r+=Math.round(1e4*e(t/(i-1)))/1e4+", ";return`linear(${r.substring(0,r.length-2)})`},g$=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,gU={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:g$([0,.65,.55,1]),circOut:g$([.55,0,1,.45]),backIn:g$([.31,.01,.66,-.59]),backOut:g$([.33,1.53,.69,.99])};function gV(e){return"function"==typeof e&&"applyToOptions"in e}class gW extends gO{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;const{element:t,name:n,keyframes:r,pseudoElement:i,allowFlatten:o=!1,finalKeyframe:s,onComplete:a}=e;this.isPseudoElement=!!i,this.allowFlatten=o,this.options=e,mq("string"!=typeof e.type,'Mini animate() doesn\'t support "type" as a string.',"mini-spring");const l=function({type:e,...t}){return gV(e)&&gz()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}(e);this.animation=function(e,t,n,{delay:r=0,duration:i=300,repeat:o=0,repeatType:s="loop",ease:a="easeOut",times:l}={},u){let c={[t]:n};l&&(c.offset=l);let d=function e(t,n){if(t)return"function"==typeof t?gz()?gB(t,n):"ease-out":gF(t)?g$(t):Array.isArray(t)?t.map(t=>e(t,n)||gU.easeOut):gU[t]}(a,i);Array.isArray(d)&&(c.easing=d);let h={delay:r,duration:i,easing:Array.isArray(d)?"linear":d,fill:"both",iterations:o+1,direction:"reverse"===s?"alternate":"normal"};u&&(h.pseudoElement=u);let f=e.animate(c,h);return f}(t,n,r,l,i),!1===l.autoplay&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!i){let e=gL(r,this.options,s,this.speed);this.updateMotionValue&&this.updateMotionValue(e),gN(t,n,e),this.animation.cancel()}a?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),"finished"===this.state&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch(e){}}stop(){if(this.isStopped)return;this.isStopped=!0;let{state:e}=this;"idle"!==e&&"finished"!==e&&(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){let e=this.options?.element;!this.isPseudoElement&&e?.isConnected&&this.animation.commitStyles?.()}get duration(){return Number(this.animation.effect?.getComputedTiming?.().duration||0)/1e3}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+e/1e3}get time(){return(Number(this.animation.currentTime)||0)/1e3}set time(e){let t=null!==this.finishedTime;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=gC(e),t&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return null!==this.finishedTime?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,rangeStart:t,rangeEnd:n,observe:r}){return(this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,e&&gD())?(this.animation.timeline=e,t&&(this.animation.rangeStart=t),n&&(this.animation.rangeEnd=n),gs):r(this)}}let gH=new Set(["opacity","clipPath","filter","transform"]),{schedule:gK}=gu(queueMicrotask,!1);function gG(){i=void 0}let gq={now:()=>(void 0===i&&gq.set(gh.isProcessing||ga.useManualTiming?gh.timestamp:performance.now()),i),set:e=>{i=e,queueMicrotask(gG)}},gJ=(e,t)=>t?1e3/t*e:0,gY;class gX{constructor(e,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=e=>{let t=gq.now();if(this.updatedAt!==t&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(e),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(let e of this.dependents)e.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=t.owner}setCurrent(e){this.current=e,this.updatedAt=gq.now(),null===this.canTrackVelocity&&void 0!==e&&(this.canTrackVelocity=!isNaN(parseFloat(this.current)))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on("change",e)}on(e,t){this.events[e]||(this.events[e]=new gT);let n=this.events[e].add(t);return"change"===e?()=>{n(),gc.read(()=>{this.events.change.getSize()||this.stop()})}:n}clearListeners(){for(let e in this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,t,n){this.set(t),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-n}jump(e,t=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,t&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(e){this.dependents||(this.dependents=new Set),this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return gY&&gY.push(this),this.current}getPrevious(){return this.prev}getVelocity(){let e=gq.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||e-this.updatedAt>30)return 0;let t=Math.min(this.updatedAt-this.prevUpdatedAt,30);return gJ(parseFloat(this.current)-parseFloat(this.prevFrameValue),t)}start(e){return this.stop(),new Promise(t=>{this.hasAnimated=!0,this.animation=e(t),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function gZ(e,t){return new gX(e,t)}let gQ=[...mH,mw,mT],g0=new WeakMap;function g1(e){return null!==e&&"object"==typeof e&&"function"==typeof e.start}function g2(e){return"string"==typeof e||Array.isArray(e)}let g5=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],g3=["initial",...g5];function g4(e){return g1(e.animate)||g3.some(t=>g2(e[t]))}function g6(e){return!!(g4(e)||e.variants)}let g8={current:null},g9={current:!1},g7="u">typeof window;function ye(e){let t=[{},{}];return e?.values.forEach((e,n)=>{t[0][n]=e.get(),t[1][n]=e.getVelocity()}),t}function yt(e,t,n,r){if("function"==typeof t){let[i,o]=ye(r);t=t(void 0!==n?n:e.custom,i,o)}if("string"==typeof t&&(t=e.variants&&e.variants[t]),"function"==typeof t){let[i,o]=ye(r);t=t(void 0!==n?n:e.custom,i,o)}return t}let yn=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],yr={};class yi{scrapeMotionValuesFromProps(e,t,n){return{}}constructor({parent:e,props:t,presenceContext:n,reducedMotionConfig:r,skipAnimations:i,blockInitialAnimation:o,visualState:s},a={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=gb,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{let e=gq.now();this.renderScheduledAt<e&&(this.renderScheduledAt=e,gc.render(this.render,!1,!0))};const{latestValues:l,renderState:u}=s;this.latestValues=l,this.baseTarget={...l},this.initialValues=t.initial?{...l}:{},this.renderState=u,this.parent=e,this.props=t,this.presenceContext=n,this.depth=e?e.depth+1:0,this.reducedMotionConfig=r,this.skipAnimationsConfig=i,this.options=a,this.blockInitialAnimation=!!o,this.isControllingVariants=g4(t),this.isVariantNode=g6(t),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:c,...d}=this.scrapeMotionValuesFromProps(t,{},this);for(const e in d){const t=d[e];void 0!==l[e]&&mU(t)&&t.set(l[e])}}mount(e){if(this.hasBeenMounted)for(let e in this.initialValues)this.values.get(e)?.jump(this.initialValues[e]),this.latestValues[e]=this.initialValues[e];this.current=e,g0.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((e,t)=>this.bindToMotionValue(t,e)),"never"===this.reducedMotionConfig?this.shouldReduceMotion=!1:"always"===this.reducedMotionConfig?this.shouldReduceMotion=!0:(g9.current||function(){if(g9.current=!0,g7)if(window.matchMedia){let e=window.matchMedia("(prefers-reduced-motion)"),t=()=>g8.current=e.matches;e.addEventListener("change",t),t()}else g8.current=!1}(),this.shouldReduceMotion=g8.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,this.parent?.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){for(let e in this.projection&&this.projection.unmount(),gd(this.notifyUpdate),gd(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this),this.events)this.events[e].clear();for(let e in this.features){let t=this.features[e];t&&(t.unmount(),t.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,t){let n;if(this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)(),t.accelerate&&gH.has(e)&&this.current instanceof HTMLElement){let{factory:n,keyframes:r,times:i,ease:o,duration:s}=t.accelerate,a=new gW({element:this.current,name:e,keyframes:r,times:i,ease:o,duration:gC(s)}),l=n(a);this.valueSubscriptions.set(e,()=>{l(),a.cancel()});return}let r=me.has(e);r&&this.onBindTransform&&this.onBindTransform();let i=t.on("change",t=>{this.latestValues[e]=t,this.props.onUpdate&&gc.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});"u">typeof window&&window.MotionCheckAppearSync&&(n=window.MotionCheckAppearSync(this,e,t)),this.valueSubscriptions.set(e,()=>{i(),n&&n()})}sortNodePosition(e){return this.current&&this.sortInstanceNodePosition&&this.type===e.type?this.sortInstanceNodePosition(this.current,e.current):0}updateFeatures(){let e="animation";for(e in yr){let t=yr[e];if(!t)continue;let{isEnabled:n,Feature:r}=t;if(!this.features[e]&&r&&n(this.props)&&(this.features[e]=new r(this)),this.features[e]){let t=this.features[e];t.isMounted?t.update():(t.mount(),t.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):m$()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,t){this.latestValues[e]=t}update(e,t){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=t;for(let t=0;t<yn.length;t++){let n=yn[t];this.propEventSubscriptions[n]&&(this.propEventSubscriptions[n](),delete this.propEventSubscriptions[n]);let r=e["on"+n];r&&(this.propEventSubscriptions[n]=this.on(n,r))}this.prevMotionValues=function(e,t,n){for(let r in t){let i=t[r],o=n[r];if(mU(i))e.addValue(r,i);else if(mU(o))e.addValue(r,gZ(i,{owner:e}));else if(o!==i)if(e.hasValue(r)){let t=e.getValue(r);!0===t.liveStyle?t.jump(i):t.hasAnimated||t.set(i)}else{let t=e.getStaticValue(r);e.addValue(r,gZ(void 0!==t?t:i,{owner:e}))}}for(let r in n)void 0===t[r]&&e.removeValue(r);return t}(this,this.scrapeMotionValuesFromProps(e,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){let t=this.getClosestVariantNode();if(t)return t.variantChildren&&t.variantChildren.add(e),()=>t.variantChildren.delete(e)}addValue(e,t){let n=this.values.get(e);t!==n&&(n&&this.removeValue(e),this.bindToMotionValue(e,t),this.values.set(e,t),this.latestValues[e]=t.get())}removeValue(e){this.values.delete(e);let t=this.valueSubscriptions.get(e);t&&(t(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,t){if(this.props.values&&this.props.values[e])return this.props.values[e];let n=this.values.get(e);return void 0===n&&void 0!==t&&(n=gZ(null===t?void 0:t,{owner:this}),this.addValue(e,n)),n}readValue(e,t){let n=void 0===this.latestValues[e]&&this.current?this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options):this.latestValues[e];if(null!=n){let r,i;if("string"==typeof n&&(r=n,/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(r)||(i=n,/^0[^.\s]+$/u.test(i))))n=parseFloat(n);else{let r;r=n,!gQ.find(mW(r))&&mT.test(t)&&(n=gk(e,t))}this.setBaseTarget(e,mU(n)?n.get():n)}return mU(n)?n.get():n}setBaseTarget(e,t){this.baseTarget[e]=t}getBaseTarget(e){let t,{initial:n}=this.props;if("string"==typeof n||"object"==typeof n){let r=yt(this.props,n,this.presenceContext?.custom);r&&(t=r[e])}if(n&&void 0!==t)return t;let r=this.getBaseTargetFromProps(this.props,e);return void 0===r||mU(r)?void 0!==this.initialValues[e]&&void 0===t?void 0:this.baseTarget[e]:r}on(e,t){return this.events[e]||(this.events[e]=new gT),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}scheduleRenderMicrotask(){gK.render(this.render)}}class yo extends yi{constructor(){super(...arguments),this.KeyframeResolver=gS}sortInstanceNodePosition(e,t){return 2&e.compareDocumentPosition(t)?1:-1}getBaseTargetFromProps(e,t){let n=e.style;return n?n[t]:void 0}removeValueFromRenderState(e,{vars:t,style:n}){delete t[e],delete n[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);let{children:e}=this.props;mU(e)&&(this.childSubscription=e.on("change",e=>{this.current&&(this.current.textContent=`${e}`)}))}}function ys(e){return e.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}let ya=(e,t)=>t&&"number"==typeof e?t.transform(e):e,yl={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},yu=p7.length;function yc(e,t,n){let{style:r,vars:i,transformOrigin:o}=e,s=!1,a=!1;for(let e in t){let n=t[e];if(me.has(e)){s=!0;continue}if(mY(e)){i[e]=n;continue}{let t=ya(n,mL[e]);e.startsWith("origin")?(a=!0,o[e]=t):r[e]=t}}if(!t.transform&&(s||n?r.transform=function(e,t,n){let r="",i=!0;for(let o=0;o<yu;o++){let s=p7[o],a=e[s];if(void 0===a)continue;let l=!0;if("number"==typeof a)l=a===+!!s.startsWith("scale");else{let e=parseFloat(a);l=s.startsWith("scale")?1===e:0===e}if(!l||n){let e=ya(a,mL[s]);if(!l){i=!1;let t=yl[s]||s;r+=`${t}(${e}) `}n&&(t[s]=e)}}return r=r.trim(),n?r=n(t,i?"":r):i&&(r="none"),r}(t,e.transform,n):r.transform&&(r.transform="none")),a){let{originX:e="50%",originY:t="50%",originZ:n=0}=o;r.transformOrigin=`${e} ${t} ${n}`}}let yd={offset:"stroke-dashoffset",array:"stroke-dasharray"},yh={offset:"strokeDashoffset",array:"strokeDasharray"},yf=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function yp(e,{attrX:t,attrY:n,attrScale:r,pathLength:i,pathSpacing:o=1,pathOffset:s=0,...a},l,u,c){if(yc(e,a,u),l){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};let{attrs:d,style:h}=e;for(let e of(d.transform&&(h.transform=d.transform,delete d.transform),(h.transform||d.transformOrigin)&&(h.transformOrigin=d.transformOrigin??"50% 50%",delete d.transformOrigin),h.transform&&(h.transformBox=c?.transformBox??"fill-box",delete d.transformBox),yf))void 0!==d[e]&&(h[e]=d[e],delete d[e]);void 0!==t&&(d.x=t),void 0!==n&&(d.y=n),void 0!==r&&(d.scale=r),void 0!==i&&function(e,t,n=1,r=0,i=!0){e.pathLength=1;let o=i?yd:yh;e[o.offset]=`${-r}`,e[o.array]=`${t} ${n}`}(d,i,o,s,!1)}let ym=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),yg=e=>"string"==typeof e&&"svg"===e.toLowerCase();function yy(e,{style:t,vars:n},r,i){let o,s=e.style;for(o in t)s[o]=t[o];for(o in i?.applyProjectionStyles(s,r),n)s.setProperty(o,n[o])}function yv(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}let yx={correct:(e,t)=>{if(!t.target)return e;if("string"==typeof e)if(!mg.test(e))return e;else e=parseFloat(e);let n=yv(e,t.target.x),r=yv(e,t.target.y);return`${n}% ${r}%`}},yb=(e,t,n)=>e+(t-e)*n,yw={borderRadius:{...yx,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:yx,borderTopRightRadius:yx,borderBottomLeftRadius:yx,borderBottomRightRadius:yx,boxShadow:{correct:(e,{treeScale:t,projectionDelta:n})=>{let r=mT.parse(e);if(r.length>5)return e;let i=mT.createTransformer(e),o=+("number"!=typeof r[0]),s=n.x.scale*t.x,a=n.y.scale*t.y;r[0+o]/=s,r[1+o]/=a;let l=yb(s,a,.5);return"number"==typeof r[2+o]&&(r[2+o]/=l),"number"==typeof r[3+o]&&(r[3+o]/=l),i(r)}}};function yk(e,{layout:t,layoutId:n}){return me.has(e)||e.startsWith("origin")||(t||void 0!==n)&&(!!yw[e]||"opacity"===e)}function y_(e,t,n){let r=e.style,i=t?.style,o={};if(!r)return o;for(let t in r)(mU(r[t])||i&&mU(i[t])||yk(t,e)||n?.getValue(t)?.liveStyle!==void 0)&&(o[t]=r[t]);return o}function yS(e,t,n){let r=y_(e,t,n);for(let n in e)(mU(e[n])||mU(t[n]))&&(r[-1!==p7.indexOf(n)?"attr"+n.charAt(0).toUpperCase()+n.substring(1):n]=e[n]);return r}class yC extends yo{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=m$}getBaseTargetFromProps(e,t){return e[t]}readValueFromInstance(e,t){if(me.has(t)){let e=mI(t);return e&&e.default||0}return t=ym.has(t)?t:ys(t),e.getAttribute(t)}scrapeMotionValuesFromProps(e,t,n){return yS(e,t,n)}build(e,t,n){yp(e,t,this.isSVGTag,n.transformTemplate,n.style)}renderInstance(e,t,n,r){for(let n in yy(e,t,void 0,r),t.attrs)e.setAttribute(ym.has(n)?n:ys(n),t.attrs[n])}mount(e){this.isSVGTag=yg(e.tagName),super.mount(e)}}function yE({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function yA(e){return void 0===e||1===e}function yT({scale:e,scaleX:t,scaleY:n}){return!yA(e)||!yA(t)||!yA(n)}function yN(e){return yT(e)||yj(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function yj(e){var t,n;return(t=e.x)&&"0%"!==t||(n=e.y)&&"0%"!==n}function yP(e,t,n,r,i){return void 0!==i&&(e=r+i*(e-r)),r+n*(e-r)+t}function yM(e,t=0,n=1,r,i){e.min=yP(e.min,t,n,r,i),e.max=yP(e.max,t,n,r,i)}function yD(e,{x:t,y:n}){yM(e.x,t.translate,t.scale,t.originPoint),yM(e.y,n.translate,n.scale,n.originPoint)}function yR(e,t){e.min+=t,e.max+=t}function yL(e,t,n,r,i=.5){let o=yb(e.min,e.max,i);yM(e,t,n,o,r)}function yO(e,t){return"string"==typeof e?parseFloat(e)/100*(t.max-t.min):e}function yI(e,t,n){let r=n??e;yL(e.x,yO(t.x,r.x),t.scaleX,t.scale,t.originX),yL(e.y,yO(t.y,r.y),t.scaleY,t.scale,t.originY)}function yF(e,t){return yE(function(e,t){if(!t)return e;let n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}(e.getBoundingClientRect(),t))}class yz extends yo{constructor(){super(...arguments),this.type="html",this.renderInstance=yy}readValueFromInstance(e,t){if(me.has(t))return this.projection?.isProjecting?m7(t):((e,t)=>{let{transform:n="none"}=getComputedStyle(e);return ge(n,t)})(e,t);{let n=window.getComputedStyle(e),r=(mY(t)?n.getPropertyValue(t):n[t])||0;return"string"==typeof r?r.trim():r}}measureInstanceViewportBox(e,{transformPagePoint:t}){return yF(e,t)}build(e,t,n){yc(e,t,n.transformTemplate)}scrapeMotionValuesFromProps(e,t,n){return y_(e,t,n)}}let yB=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function y$(e){if("string"!=typeof e||e.includes("-"));else if(yB.indexOf(e)>-1||/[A-Z]/u.test(e))return!0;return!1}let yU=(0,T.createContext)({}),yV=(0,T.createContext)({strict:!1}),yW=(0,T.createContext)({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"}),yH=(0,T.createContext)({});function yK(e){return Array.isArray(e)?e.join(" "):e}let yG=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function yq(e,t,n){for(let r in t)mU(t[r])||yk(r,n)||(e[r]=t[r])}let yJ=()=>({...yG(),attrs:{}}),yY=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","propagate","ignoreStrict","viewport"]);function yX(e){return e.startsWith("while")||e.startsWith("drag")&&"draggable"!==e||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||yY.has(e)}let yZ=e=>!yX(e);try{S=(()=>{let e=Error("Cannot find module '@emotion/is-prop-valid'");throw e.code="MODULE_NOT_FOUND",e})().default,"function"==typeof S&&(yZ=e=>e.startsWith("on")?!yX(e):S(e))}catch{}function yQ(e){return mU(e)?e.get():e}let y0=(0,T.createContext)(null),y1=e=>(t,n)=>{let r,i=(0,T.useContext)(yH),o=(0,T.useContext)(y0),s=()=>(function({scrapeMotionValuesFromProps:e,createRenderState:t},n,r,i){return{latestValues:function(e,t,n,r){let i={},o=r(e,{});for(let e in o)i[e]=yQ(o[e]);let{initial:s,animate:a}=e,l=g4(e),u=g6(e);t&&u&&!l&&!1!==e.inherit&&(void 0===s&&(s=t.initial),void 0===a&&(a=t.animate));let c=!!n&&!1===n.initial,d=(c=c||!1===s)?a:s;if(d&&"boolean"!=typeof d&&!g1(d)){let t=Array.isArray(d)?d:[d];for(let n=0;n<t.length;n++){let r=yt(e,t[n]);if(r){let{transitionEnd:e,transition:t,...n}=r;for(let e in n){let t=n[e];if(Array.isArray(t)){let e=c?t.length-1:0;t=t[e]}null!==t&&(i[e]=t)}for(let t in e)i[t]=e[t]}}}return i}(n,r,i,e),renderState:t()}})(e,t,i,o);return n?s():(null===(r=(0,T.useRef)(null)).current&&(r.current=s()),r.current)},y2=y1({scrapeMotionValuesFromProps:y_,createRenderState:yG}),y5=y1({scrapeMotionValuesFromProps:yS,createRenderState:yJ}),y3={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},y4=!1;function y6(){return!function(){if(y4)return;let e={};for(let t in y3)e[t]={isEnabled:e=>y3[t].some(t=>!!e[t])};yr=e,y4=!0}(),yr}let y8=Symbol.for("motionComponentSymbol"),y9="data-"+ys("framerAppearId"),y7=(0,T.createContext)({});function ve(e){return e&&"object"==typeof e&&Object.prototype.hasOwnProperty.call(e,"current")}let vt="u">typeof window?T.useLayoutEffect:T.useEffect;function vn(e,{forwardMotionProps:t=!1,type:n}={},r,i){r&&function(e){let t=y6();for(let n in e)t[n]={...t[n],...e[n]};yr=t}(r);let o=n?"svg"===n:y$(e),s=o?y5:y2;function a(n,r){var a;let l,u,c,d={...(0,T.useContext)(yW),...n,layoutId:function({layoutId:e}){let t=(0,T.useContext)(yU).id;return t&&void 0!==e?t+"-"+e:e}(n)},{isStatic:h}=d,f=function(e){let{initial:t,animate:n}=function(e,t){if(g4(e)){let{initial:t,animate:n}=e;return{initial:!1===t||g2(t)?t:void 0,animate:g2(n)?n:void 0}}return!1!==e.inherit?t:{}}(e,(0,T.useContext)(yH));return(0,T.useMemo)(()=>({initial:t,animate:n}),[yK(t),yK(n)])}(n),p=s(n,h);if(!h&&"u">typeof window){(0,T.useContext)(yV).strict;let t=function(e){let{drag:t,layout:n}=y6();if(!t&&!n)return{};let r={...t,...n};return{MeasureLayout:t?.isEnabled(e)||n?.isEnabled(e)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}(d);l=t.MeasureLayout,f.visualElement=function(e,t,n,r,i,o){let{visualElement:s}=(0,T.useContext)(yH),a=(0,T.useContext)(yV),l=(0,T.useContext)(y0),u=(0,T.useContext)(yW),c=u.reducedMotion,d=u.skipAnimations,h=(0,T.useRef)(null),f=(0,T.useRef)(!1);r=r||a.renderer,!h.current&&r&&(h.current=r(e,{visualState:t,parent:s,props:n,presenceContext:l,blockInitialAnimation:!!l&&!1===l.initial,reducedMotionConfig:c,skipAnimations:d,isSVG:o}),f.current&&h.current&&(h.current.manuallyAnimateOnMount=!0));let p=h.current,m=(0,T.useContext)(y7);p&&!p.projection&&i&&("html"===p.type||"svg"===p.type)&&function(e,t,n,r){let{layoutId:i,layout:o,drag:s,dragConstraints:a,layoutScroll:l,layoutRoot:u,layoutAnchor:c,layoutCrossfade:d}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:function e(t){if(t)return!1!==t.options.allowProjection?t.projection:e(t.parent)}(e.parent)),e.projection.setOptions({layoutId:i,layout:o,alwaysMeasureLayout:!!s||a&&ve(a),visualElement:e,animationType:"string"==typeof o?o:"both",initialPromotionConfig:r,crossfade:d,layoutScroll:l,layoutRoot:u,layoutAnchor:c})}(h.current,n,i,m);let g=(0,T.useRef)(!1);(0,T.useInsertionEffect)(()=>{p&&g.current&&p.update(n,l)});let y=n[y9],v=(0,T.useRef)(!!y&&"u">typeof window&&!window.MotionHandoffIsComplete?.(y)&&window.MotionHasOptimisedAnimation?.(y));return vt(()=>{f.current=!0,p&&(g.current=!0,window.MotionIsMounted=!0,p.updateFeatures(),p.scheduleRenderMicrotask(),v.current&&p.animationState&&p.animationState.animateChanges())}),(0,T.useEffect)(()=>{p&&(!v.current&&p.animationState&&p.animationState.animateChanges(),v.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(y)}),v.current=!1),p.enteringChildren=void 0)}),p}(e,p,d,i,t.ProjectionNode,o)}return(0,A.jsxs)(yH.Provider,{value:f,children:[l&&f.visualElement?(0,A.jsx)(l,{visualElement:f.visualElement,...d}):null,function(e,t,n,{latestValues:r},i,o=!1,s){let a=(s??y$(e)?function(e,t,n,r){let i=(0,T.useMemo)(()=>{let n=yJ();return yp(n,t,yg(r),e.transformTemplate,e.style),{...n.attrs,style:{...n.style}}},[t]);if(e.style){let t={};yq(t,e.style,e),i.style={...t,...i.style}}return i}:function(e,t){let n,r,i={},o=(n=e.style||{},yq(r={},n,e),Object.assign(r,function({transformTemplate:e},t){return(0,T.useMemo)(()=>{let n=yG();return yc(n,t,e),Object.assign({},n.vars,n.style)},[t])}(e,t)),r);return e.drag&&!1!==e.dragListener&&(i.draggable=!1,o.userSelect=o.WebkitUserSelect=o.WebkitTouchCallout="none",o.touchAction=!0===e.drag?"none":`pan-${"x"===e.drag?"y":"x"}`),void 0===e.tabIndex&&(e.onTap||e.onTapStart||e.whileTap)&&(i.tabIndex=0),i.style=o,i})(t,r,i,e),l=function(e,t,n){let r={};for(let i in e)("values"!==i||"object"!=typeof e.values)&&!mU(e[i])&&(yZ(i)||!0===n&&yX(i)||!t&&!yX(i)||e.draggable&&i.startsWith("onDrag"))&&(r[i]=e[i]);return r}(t,"string"==typeof e,o),u=e!==T.Fragment?{...l,...a,ref:n}:{},{children:c}=t,d=(0,T.useMemo)(()=>mU(c)?c.get():c,[c]);return(0,T.createElement)(e,{...u,children:d})}(e,n,(a=f.visualElement,u=(0,T.useRef)(r),(0,T.useInsertionEffect)(()=>{u.current=r}),c=(0,T.useRef)(null),(0,T.useCallback)(e=>{e&&p.onMount?.(e),a&&(e?a.mount(e):a.unmount());let t=u.current;if("function"==typeof t)if(e){let n=t(e);"function"==typeof n&&(c.current=n)}else c.current?(c.current(),c.current=null):t(e);else t&&(t.current=e)},[a])),p,h,t,o)]})}a.displayName=`motion.${"string"==typeof e?e:`create(${e.displayName??e.name??""})`}`;let l=(0,T.forwardRef)(a);return l[y8]=e,l}class vr{constructor(e){this.isMounted=!1,this.node=e}update(){}}function vi(e,t,n){let r=e.getProps();return yt(r,t,void 0!==n?n:r.custom,e)}function vo(e,t){if(e?.inherit&&t){let{inherit:n,...r}=e;return{...t,...r}}return e}function vs(e,t){let n=e?.[t]??e?.default??e;return n!==e?vo(n,e):n}let va=e=>Array.isArray(e);function vl(e,t){let n=e.getValue("willChange");if(mU(n)&&n.add)return n.add(t);if(!n&&ga.WillChange){let n=new ga.WillChange("auto");e.addValue("willChange",n),n.add(t)}}let vu=(...e)=>e.reduce((e,t)=>n=>t(e(n)));function vc(e,t,n){return(n<0&&(n+=1),n>1&&(n-=1),n<1/6)?e+(t-e)*6*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function vd(e,t){return n=>n>0?t:e}let vh=(e,t,n)=>{let r=e*e,i=n*(t*t-r)+r;return i<0?0:Math.sqrt(i)},vf=[mh,md,mb];function vp(e){let t=vf.find(t=>t.test(e));if(mG(!!t,`'${e}' is not an animatable color. Use the equivalent color code instead.`,"color-not-animatable"),!t)return!1;let n=t.parse(e);return t===mb&&(n=function({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,n/=100;let i=0,o=0,s=0;if(t/=100){let r=n<.5?n*(1+t):n+t-n*t,a=2*n-r;i=vc(a,r,e+1/3),o=vc(a,r,e),s=vc(a,r,e-1/3)}else i=o=s=n;return{red:Math.round(255*i),green:Math.round(255*o),blue:Math.round(255*s),alpha:r}}(n)),n}let vm=(e,t)=>{let n=vp(e),r=vp(t);if(!n||!r)return vd(e,t);let i={...n};return e=>(i.red=vh(n.red,r.red,e),i.green=vh(n.green,r.green,e),i.blue=vh(n.blue,r.blue,e),i.alpha=yb(n.alpha,r.alpha,e),md.transform(i))},vg=new Set(["none","hidden"]);function vy(e,t){return n=>yb(e,t,n)}function vv(e){return"number"==typeof e?vy:"string"==typeof e?mZ(e)?vd:mw.test(e)?vm:vw:Array.isArray(e)?vx:"object"==typeof e?mw.test(e)?vm:vb:vd}function vx(e,t){let n=[...e],r=n.length,i=e.map((e,n)=>vv(e)(e,t[n]));return e=>{for(let t=0;t<r;t++)n[t]=i[t](e);return n}}function vb(e,t){let n={...e,...t},r={};for(let i in n)void 0!==e[i]&&void 0!==t[i]&&(r[i]=vv(e[i])(e[i],t[i]));return e=>{for(let t in r)n[t]=r[t](e);return n}}let vw=(e,t)=>{let n=mT.createTransformer(t),r=mE(e),i=mE(t);if(!(r.indexes.var.length===i.indexes.var.length&&r.indexes.color.length===i.indexes.color.length&&r.indexes.number.length>=i.indexes.number.length))return mG(!0,`Complex values '${e}' and '${t}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`,"complex-values-different"),vd(e,t);if(vg.has(e)&&!i.values.length||vg.has(t)&&!r.values.length)return vg.has(e)?n=>n<=0?e:t:n=>n>=1?t:e;return vu(vx(function(e,t){let n=[],r={color:0,var:0,number:0};for(let i=0;i<t.values.length;i++){let o=t.types[i],s=e.indexes[o][r[o]],a=e.values[s]??0;n[i]=a,r[o]++}return n}(r,i),i.values),n)};function vk(e,t,n){return"number"==typeof e&&"number"==typeof t&&"number"==typeof n?yb(e,t,n):vv(e)(e,t)}let v_=e=>{let t=({timestamp:t})=>e(t);return{start:(e=!0)=>gc.update(t,e),stop:()=>gd(t),now:()=>gh.isProcessing?gh.timestamp:gq.now()}};function vS(e){let t=0,n=e.next(t);for(;!n.done&&t<2e4;)t+=50,n=e.next(t);return t>=2e4?1/0:t}let vC=.01,vE=2,vA=.005,vT=.5;function vN(e,t){return e*Math.sqrt(1-t*t)}let vj=["duration","bounce"],vP=["stiffness","damping","mass"];function vM(e,t){return t.some(t=>void 0!==e[t])}function vD(e=.3,t=.3){let n,r,i,o,s,a,l="object"!=typeof e?{visualDuration:e,keyframes:[0,1],bounce:t}:e,{restSpeed:u,restDelta:c}=l,d=l.keyframes[0],h=l.keyframes[l.keyframes.length-1],f={done:!1,value:d},{stiffness:p,damping:m,mass:g,duration:y,velocity:v,isResolvedFromDuration:x}=function(e){let t={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...e};if(!vM(e,vP)&&vM(e,vj))if(t.velocity=0,e.visualDuration){let n=2*Math.PI/(1.2*e.visualDuration),r=n*n,i=2*mt(.05,1,1-(e.bounce||0))*Math.sqrt(r);t={...t,mass:1,stiffness:r,damping:i}}else{let n=function({duration:e=800,bounce:t=.3,velocity:n=0,mass:r=1}){let i,o;mG(e<=gC(10),"Spring duration must be 10 seconds or less","spring-duration-limit");let s=1-t;s=mt(.05,1,s),e=mt(.01,10,e/1e3),s<1?(i=t=>{let r=t*s,i=r*e;return .001-(r-n)/vN(t,s)*Math.exp(-i)},o=t=>{let r=t*s*e,o=Math.pow(s,2)*Math.pow(t,2)*e,a=Math.exp(-r),l=vN(Math.pow(t,2),s);return(r*n+n-o)*a*(-i(t)+.001>0?-1:1)/l}):(i=t=>-.001+Math.exp(-t*e)*((t-n)*e+1),o=t=>e*e*(n-t)*Math.exp(-t*e));let a=function(e,t,n){let r=n;for(let n=1;n<12;n++)r-=e(r)/t(r);return r}(i,o,5/e);if(e=gC(e),isNaN(a))return{stiffness:100,damping:10,duration:e};{let t=Math.pow(a,2)*r;return{stiffness:t,damping:2*s*Math.sqrt(r*t),duration:e}}}({...e,velocity:0});(t={...t,...n,mass:1}).isResolvedFromDuration=!0}return t}({...l,velocity:-((l.velocity||0)/1e3)}),b=v||0,w=m/(2*Math.sqrt(p*g)),k=h-d,_=Math.sqrt(p/g)/1e3,S=5>Math.abs(k);if(u||(u=S?vC:vE),c||(c=S?vA:vT),w<1)i=vN(_,w),o=(b+w*_*k)/i,n=e=>h-Math.exp(-w*_*e)*(o*Math.sin(i*e)+k*Math.cos(i*e)),s=w*_*o+k*i,a=w*_*k-o*i,r=e=>Math.exp(-w*_*e)*(s*Math.sin(i*e)+a*Math.cos(i*e));else if(1===w){n=e=>h-Math.exp(-_*e)*(k+(b+_*k)*e);let e=b+_*k;r=t=>Math.exp(-_*t)*(_*e*t-b)}else{let e=_*Math.sqrt(w*w-1);n=t=>{let n=Math.exp(-w*_*t),r=Math.min(e*t,300);return h-n*((b+w*_*k)*Math.sinh(r)+e*k*Math.cosh(r))/e};let t=(b+w*_*k)/e,i=w*_*t-k*e,o=w*_*k-t*e;r=t=>{let n=Math.exp(-w*_*t),r=Math.min(e*t,300);return n*(i*Math.sinh(r)+o*Math.cosh(r))}}let C={calculatedDuration:x&&y||null,velocity:e=>gC(r(e)),next:e=>{if(!x&&w<1){let t=Math.exp(-w*_*e),n=Math.sin(i*e),r=Math.cos(i*e),l=h-t*(o*n+k*r);return f.done=Math.abs(gC(t*(s*n+a*r)))<=u&&Math.abs(h-l)<=c,f.value=f.done?h:l,f}let t=n(e);return x?f.done=e>=y:f.done=Math.abs(gC(r(e)))<=u&&Math.abs(h-t)<=c,f.value=f.done?h:t,f},toString:()=>{let e=Math.min(vS(C),2e4),t=gB(t=>C.next(e*t).value,e,30);return e+"ms "+t},toTransition:()=>{}};return C}function vR(e,t,n){let r=Math.max(t-5,0);return gJ(n-e(r),t-r)}function vL({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:o=500,modifyTarget:s,min:a,max:l,restDelta:u=.5,restSpeed:c}){let d,h,f=e[0],p={done:!1,value:f},m=n*t,g=f+m,y=void 0===s?g:s(g);y!==g&&(m=y-f);let v=e=>-m*Math.exp(-e/r),x=e=>y+v(e),b=e=>{let t=v(e),n=x(e);p.done=Math.abs(t)<=u,p.value=p.done?y:n},w=e=>{let t;if(t=p.value,void 0!==a&&t<a||void 0!==l&&t>l){var n;d=e,h=vD({keyframes:[p.value,(n=p.value,void 0===a?l:void 0===l||Math.abs(a-n)<Math.abs(l-n)?a:l)],velocity:vR(x,e,p.value),damping:i,stiffness:o,restDelta:u,restSpeed:c})}};return w(0),{calculatedDuration:null,next:e=>{let t=!1;return(h||void 0!==d||(t=!0,b(e),w(e)),void 0!==d&&e>=d)?h.next(e-d):(t||b(e),p)}}}vD.applyToOptions=e=>{let t=function(e,t=100,n){let r=n({...e,keyframes:[0,t]}),i=Math.min(vS(r),2e4);return{type:"keyframes",ease:e=>r.next(i*e).value/t,duration:i/1e3}}(e,100,vD);return e.ease=t.ease,e.duration=gC(t.duration),e.type="keyframes",e};let vO=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e;function vI(e,t,n,r){return e===t&&n===r?gs:i=>0===i||1===i?i:vO(function(e,t,n,r,i){let o,s,a=0;do(o=vO(s=t+(n-t)/2,r,i)-e)>0?n=s:t=s;while(Math.abs(o)>1e-7&&++a<12)return s}(i,0,1,e,n),t,r)}let vF=vI(.42,0,1,1),vz=vI(0,0,.58,1),vB=vI(.42,0,.58,1),v$=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,vU=e=>t=>1-e(1-t),vV=vI(.33,1.53,.69,.99),vW=vU(vV),vH=v$(vW),vK=e=>e>=1?1:(e*=2)<1?.5*vW(e):.5*(2-Math.pow(2,-10*(e-1))),vG=e=>1-Math.sin(Math.acos(e)),vq=vU(vG),vJ=v$(vG),vY={linear:gs,easeIn:vF,easeInOut:vB,easeOut:vz,circIn:vG,circInOut:vJ,circOut:vq,backIn:vW,backInOut:vH,backOut:vV,anticipate:vK},vX=e=>{if(gF(e)){mq(4===e.length,"Cubic bezier arrays must contain four numerical values.","cubic-bezier-length");let[t,n,r,i]=e;return vI(t,n,r,i)}return"string"==typeof e?(mq(void 0!==vY[e],`Invalid easing type '${e}'`,"invalid-easing-type"),vY[e]):e},vZ=(e,t,n)=>{let r=t-e;return r?(n-e)/r:1};function vQ({duration:e=300,keyframes:t,times:n,ease:r="easeInOut"}){var i;let o,s=Array.isArray(r)&&"number"!=typeof r[0]?r.map(vX):vX(r),a={done:!1,value:t[0]},l=function(e,t,{clamp:n=!0,ease:r,mixer:i}={}){let o=e.length;if(mq(o===t.length,"Both input and output ranges must be the same length","range-length"),1===o)return()=>t[0];if(2===o&&t[0]===t[1])return()=>t[1];let s=e[0]===e[1];e[0]>e[o-1]&&(e=[...e].reverse(),t=[...t].reverse());let a=function(e,t,n){let r=[],i=n||ga.mix||vk,o=e.length-1;for(let n=0;n<o;n++){let o=i(e[n],e[n+1]);t&&(o=vu(Array.isArray(t)?t[n]||gs:t,o)),r.push(o)}return r}(t,r,i),l=a.length,u=n=>{if(s&&n<e[0])return t[0];let r=0;if(l>1)for(;r<e.length-2&&!(n<e[r+1]);r++);let i=vZ(e[r],e[r+1],n);return a[r](i)};return n?t=>u(mt(e[0],e[o-1],t)):u}((i=n&&n.length===t.length?n:(!function(e,t){let n=e[e.length-1];for(let r=1;r<=t;r++){let i=vZ(0,t,r);e.push(yb(n,1,i))}}(o=[0],t.length-1),o),i.map(t=>t*e)),t,{ease:Array.isArray(s)?s:t.map(()=>s||vB).splice(0,t.length-1)});return{calculatedDuration:e,next:t=>(a.value=l(t),a.done=t>=e,a)}}let v0={decay:vL,inertia:vL,tween:vQ,keyframes:vQ,spring:vD};function v1(e){"string"==typeof e.type&&(e.type=v0[e.type])}let v2=e=>e/100;class v5 extends gO{constructor(e){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{let{motionValue:e}=this.options;e&&e.updatedAt!==gq.now()&&this.tick(gq.now()),this.isStopped=!0,"idle"!==this.state&&(this.teardown(),this.options.onStop?.())},gI.mainThread++,this.options=e,this.initAnimation(),this.play(),!1===e.autoplay&&this.pause()}initAnimation(){let{options:e}=this;v1(e);let{type:t=vQ,repeat:n=0,repeatDelay:r=0,repeatType:i,velocity:o=0}=e,{keyframes:s}=e,a=t||vQ;a!==vQ&&"number"!=typeof s[0]&&(this.mixKeyframes=vu(v2,vk(s[0],s[1])),s=[0,100]);let l=a({...e,keyframes:s});"mirror"===i&&(this.mirroredGenerator=a({...e,keyframes:[...s].reverse(),velocity:-o})),null===l.calculatedDuration&&(l.calculatedDuration=vS(l));let{calculatedDuration:u}=l;this.calculatedDuration=u,this.resolvedDuration=u+r,this.totalDuration=this.resolvedDuration*(n+1)-r,this.generator=l}updateTime(e){let t=Math.round(e-this.startTime)*this.playbackSpeed;null!==this.holdTime?this.currentTime=this.holdTime:this.currentTime=t}tick(e,t=!1){let n,{generator:r,totalDuration:i,mixKeyframes:o,mirroredGenerator:s,resolvedDuration:a,calculatedDuration:l}=this;if(null===this.startTime)return r.next(0);let{delay:u=0,keyframes:c,repeat:d,repeatType:h,repeatDelay:f,type:p,onUpdate:m,finalKeyframe:g}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-i/this.speed,this.startTime)),t?this.currentTime=e:this.updateTime(e);let y=this.currentTime-u*(this.playbackSpeed>=0?1:-1),v=this.playbackSpeed>=0?y<0:y>i;this.currentTime=Math.max(y,0),"finished"===this.state&&null===this.holdTime&&(this.currentTime=i);let x=this.currentTime,b=r;if(d){let e=Math.min(this.currentTime,i)/a,t=Math.floor(e),n=e%1;!n&&e>=1&&(n=1),1===n&&t--,(t=Math.min(t,d+1))%2&&("reverse"===h?(n=1-n,f&&(n-=f/a)):"mirror"===h&&(b=s)),x=mt(0,1,n)*a}v?(this.delayState.value=c[0],n=this.delayState):n=b.next(x),o&&!v&&(n.value=o(n.value));let{done:w}=n;v||null===l||(w=this.playbackSpeed>=0?this.currentTime>=i:this.currentTime<=0);let k=null===this.holdTime&&("finished"===this.state||"running"===this.state&&w);return k&&p!==vL&&(n.value=gL(c,this.options,g,this.speed)),m&&m(n.value),k&&this.finish(),n}then(e,t){return this.finished.then(e,t)}get duration(){return this.calculatedDuration/1e3}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+e/1e3}get time(){return this.currentTime/1e3}set time(e){e=gC(e),this.currentTime=e,null===this.startTime||null!==this.holdTime||0===this.playbackSpeed?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state="paused",this.holdTime=e,this.tick(e))}getGeneratorVelocity(){let e=this.currentTime;if(e<=0)return this.options.velocity||0;if(this.generator.velocity)return this.generator.velocity(e);let t=this.generator.next(e).value;return vR(e=>this.generator.next(e).value,e,t)}get speed(){return this.playbackSpeed}set speed(e){let t=this.playbackSpeed!==e;t&&this.driver&&this.updateTime(gq.now()),this.playbackSpeed=e,t&&this.driver&&(this.time=this.currentTime/1e3)}play(){if(this.isStopped)return;let{driver:e=v_,startTime:t}=this.options;this.driver||(this.driver=e(e=>this.tick(e))),this.options.onPlay?.();let n=this.driver.now();"finished"===this.state?(this.updateFinished(),this.startTime=n):null!==this.holdTime?this.startTime=n-this.holdTime:this.startTime||(this.startTime=t??n),"finished"===this.state&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(gq.now()),this.holdTime=this.currentTime}complete(){"running"!==this.state&&this.play(),this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null,gI.mainThread--}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),e.observe(this)}}let v3={anticipate:vK,backInOut:vH,circInOut:vJ};class v4 extends gW{constructor(e){!function(e){"string"==typeof e.ease&&e.ease in v3&&(e.ease=v3[e.ease])}(e),v1(e),super(e),void 0!==e.startTime&&!1!==e.autoplay&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){let{motionValue:t,onUpdate:n,onComplete:r,element:i,...o}=this.options;if(!t)return;if(void 0!==e)return void t.set(e);let s=new v5({...o,autoplay:!1}),a=Math.max(10,gq.now()-this.startTime),l=mt(0,10,a-10),u=s.sample(a).value,{name:c}=this.options;i&&c&&gN(i,c,u),t.setWithVelocity(s.sample(Math.max(0,a-l)).value,u,l),s.stop()}}let v6=(e,t)=>"zIndex"!==t&&!!("number"==typeof e||Array.isArray(e)||"string"==typeof e&&(mT.test(e)||"0"===e)&&!e.startsWith("url("));function v8(e){e.duration=0,e.type="keyframes"}let v9=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/,v7=new Set(["color","backgroundColor","outlineColor","fill","stroke","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor"]),xe=gj(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));class xt extends gO{constructor({autoplay:e=!0,delay:t=0,type:n="keyframes",repeat:r=0,repeatDelay:i=0,repeatType:o="loop",keyframes:s,name:a,motionValue:l,element:u,...c}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=gq.now();const d={autoplay:e,delay:t,type:n,repeat:r,repeatDelay:i,repeatType:o,name:a,motionValue:l,element:u,...c},h=u?.KeyframeResolver||gb;this.keyframeResolver=new h(s,(e,t,n)=>this.onKeyframesResolved(e,t,d,!n),a,l,u),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,t,n,r){let i;this.keyframeResolver=void 0;let{name:o,type:s,velocity:a,delay:l,isHandoff:u,onUpdate:c}=n;this.resolvedAt=gq.now();let d=!0;!function(e,t,n,r){let i=e[0];if(null===i)return!1;if("display"===t||"visibility"===t)return!0;let o=e[e.length-1],s=v6(i,t),a=v6(o,t);return mG(s===a,`You are trying to animate ${t} from "${i}" to "${o}". "${s?o:i}" is not an animatable value.`,"value-not-animatable"),!!s&&!!a&&(function(e){let t=e[0];if(1===e.length)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t)return!0}(e)||("spring"===n||gV(n))&&r)}(e,o,s,a)&&(d=!1,(ga.instantAnimations||!l)&&c?.(gL(e,n,t)),e[0]=e[e.length-1],v8(n),n.repeat=0);let h={startTime:r?this.resolvedAt&&this.resolvedAt-this.createdAt>40?this.resolvedAt:this.createdAt:void 0,finalKeyframe:t,...n,keyframes:e},f=d&&!u&&function(e){let{motionValue:t,name:n,repeatDelay:r,repeatType:i,damping:o,type:s,keyframes:a}=e;if(!(t?.owner?.current instanceof HTMLElement))return!1;let{onUpdate:l,transformTemplate:u}=t.owner.getProps();return xe()&&n&&(gH.has(n)||v7.has(n)&&function(e){for(let t=0;t<e.length;t++)if("string"==typeof e[t]&&v9.test(e[t]))return!0;return!1}(a))&&("transform"!==n||!u)&&!l&&!r&&"mirror"!==i&&0!==o&&"inertia"!==s}(h),p=h.motionValue?.owner?.current;if(f)try{i=new v4({...h,element:p})}catch{i=new v5(h)}else i=new v5(h);i.finished.then(()=>{this.notifyFinished()}).catch(gs),this.pendingTimeline&&(this.stopTimeline=i.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=i}get finished(){return this._animation?this.animation.finished:this._finished}then(e,t){return this.finished.finally(e).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),gy=!0,gx(),gv(),gy=!1),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}}let xn={type:"spring",stiffness:500,damping:25,restSpeed:10},xr={type:"keyframes",duration:.8},xi={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},xo=new Set(["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed"]),xs=(e,t,n,r={},i,o)=>s=>{let a=vs(r,e)||{},l=a.delay||r.delay||0,{elapsed:u=0}=r;u-=gC(l);let c={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:t.getVelocity(),...a,delay:-u,onUpdate:e=>{t.set(e),a.onUpdate&&a.onUpdate(e)},onComplete:()=>{s(),a.onComplete&&a.onComplete()},name:e,motionValue:t,element:o?void 0:i};!function(e){for(let t in e)if(!xo.has(t))return!0;return!1}(a)&&Object.assign(c,((e,{keyframes:t})=>t.length>2?xr:me.has(e)?e.startsWith("scale")?{type:"spring",stiffness:550,damping:0===t[1]?2*Math.sqrt(550):30,restSpeed:10}:xn:xi)(e,c)),c.duration&&(c.duration=gC(c.duration)),c.repeatDelay&&(c.repeatDelay=gC(c.repeatDelay)),void 0!==c.from&&(c.keyframes[0]=c.from);let d=!1;if(!1!==c.type&&(0!==c.duration||c.repeatDelay)||(v8(c),0===c.delay&&(d=!0)),(ga.instantAnimations||ga.skipAnimations||i?.shouldSkipAnimations||a.skipAnimations)&&(d=!0,v8(c),c.delay=0),c.allowFlatten=!a.type&&!a.ease,d&&!o&&void 0!==t.get()){let e=gL(c.keyframes,a);if(void 0!==e)return void gc.update(()=>{c.onUpdate(e),c.onComplete()})}return a.isSync?new v5(c):new xt(c)};function xa(e,t,{delay:n=0,transitionOverride:r,type:i}={}){let{transition:o,transitionEnd:s,...a}=t,l=e.getDefaultTransition();o=o?vo(o,l):l;let u=o?.reduceMotion,c=o?.skipAnimations;r&&(o=r);let d=[],h=i&&e.animationState&&e.animationState.getState()[i];for(let t in a){let r=e.getValue(t,e.latestValues[t]??null),i=a[t];if(void 0===i||h&&function({protectedKeys:e,needsAnimating:t},n){let r=e.hasOwnProperty(n)&&!0!==t[n];return t[n]=!1,r}(h,t))continue;let s={delay:n,...vs(o||{},t)};c&&(s.skipAnimations=!0);let l=r.get();if(void 0!==l&&!r.isAnimating()&&!Array.isArray(i)&&i===l&&!s.velocity){gc.update(()=>r.set(i));continue}let f=!1;if(window.MotionHandoffAnimation){let n=e.props[y9];if(n){let e=window.MotionHandoffAnimation(n,t,gc);null!==e&&(s.startTime=e,f=!0)}}vl(e,t);let p=u??e.shouldReduceMotion;r.start(xs(t,r,i,p&&mV.has(t)?{type:!1}:s,e,f));let m=r.animation;m&&d.push(m)}if(s){let t=()=>gc.update(()=>{s&&function(e,t){let{transitionEnd:n={},transition:r={},...i}=vi(e,t)||{};for(let t in i={...i,...n}){var o;let n=va(o=i[t])?o[o.length-1]||0:o;e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,gZ(n))}}(e,s)});d.length?Promise.all(d).then(t):t()}return d}function xl(e,t,n,r=0,i=1){let o=Array.from(e).sort((e,t)=>e.sortNodePosition(t)).indexOf(t),s=e.size,a=(s-1)*r;return"function"==typeof n?n(o,s):1===i?o*r:a-o*r}function xu(e,t,n={}){let r=vi(e,t,"exit"===n.type?e.presenceContext?.custom:void 0),{transition:i=e.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(i=n.transitionOverride);let o=r?()=>Promise.all(xa(e,r,n)):()=>Promise.resolve(),s=e.variantChildren&&e.variantChildren.size?(r=0)=>{let{delayChildren:o=0,staggerChildren:s,staggerDirection:a}=i;return function(e,t,n=0,r=0,i=0,o=1,s){let a=[];for(let l of e.variantChildren)l.notify("AnimationStart",t),a.push(xu(l,t,{...s,delay:n+("function"==typeof r?0:r)+xl(e.variantChildren,l,r,i,o)}).then(()=>l.notify("AnimationComplete",t)));return Promise.all(a)}(e,t,r,o,s,a,n)}:()=>Promise.resolve(),{when:a}=i;if(!a)return Promise.all([o(),s(n.delay)]);{let[e,t]="beforeChildren"===a?[o,s]:[s,o];return e().then(()=>t())}}let xc=g3.length;function xd(e,t){if(!Array.isArray(t))return!1;let n=t.length;if(n!==e.length)return!1;for(let r=0;r<n;r++)if(t[r]!==e[r])return!1;return!0}let xh=[...g5].reverse(),xf=g5.length;function xp(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function xm(){return{animate:xp(!0),whileInView:xp(),whileHover:xp(),whileTap:xp(),whileDrag:xp(),whileFocus:xp(),exit:xp()}}let xg=0;function xy(e){return[e("x"),e("y")]}function xv(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}let xx={x:!1,y:!1};function xb(e){return e.max-e.min}function xw(e,t,n,r=.5){e.origin=r,e.originPoint=yb(t.min,t.max,e.origin),e.scale=xb(n)/xb(t),e.translate=yb(n.min,n.max,e.origin)-e.originPoint,(e.scale>=.9999&&e.scale<=1.0001||isNaN(e.scale))&&(e.scale=1),(e.translate>=-.01&&e.translate<=.01||isNaN(e.translate))&&(e.translate=0)}function xk(e,t,n,r){xw(e.x,t.x,n.x,r?r.originX:void 0),xw(e.y,t.y,n.y,r?r.originY:void 0)}function x_(e,t,n,r=0){e.min=(r?yb(n.min,n.max,r):n.min)+t.min,e.max=e.min+xb(t)}function xS(e,t,n,r=0){let i=r?yb(n.min,n.max,r):n.min;e.min=t.min-i,e.max=e.min+xb(t)}function xC(e,t,n,r){xS(e.x,t.x,n.x,r?.x),xS(e.y,t.y,n.y,r?.y)}let xE=e=>"object"==typeof e&&null!==e;function xA(e){return xE(e)&&"ownerSVGElement"in e}function xT(e,t,n){if(null==e)return[];if(e instanceof EventTarget)return[e];if("string"==typeof e){let r=document;t&&(r=t.current);let i=n?.[e]??r.querySelectorAll(e);return i?Array.from(i):[]}return Array.from(e).filter(e=>null!=e)}let xN=new WeakMap,xj=(e,t,n)=>(r,i)=>i&&i[0]?i[0][e+"Size"]:xA(r)&&"getBBox"in r?r.getBBox()[t]:r[n],xP=xj("inline","width","offsetWidth"),xM=xj("block","height","offsetHeight");function xD({target:e,borderBoxSize:t}){xN.get(e)?.forEach(n=>{n(e,{get width(){return xP(e,t)},get height(){return xM(e,t)}})})}function xR(e){e.forEach(xD)}let xL=new Set;function xO(e,t){let n;return"function"==typeof e?(xL.add(e),s||(s=()=>{let e={get width(){return window.innerWidth},get height(){return window.innerHeight}};xL.forEach(t=>t(e))},window.addEventListener("resize",s)),()=>{xL.delete(e),xL.size||"function"!=typeof s||(window.removeEventListener("resize",s),s=void 0)}):(!o&&"u">typeof ResizeObserver&&(o=new ResizeObserver(xR)),(n=xT(e)).forEach(e=>{let n=xN.get(e);n||(n=new Set,xN.set(e,n)),n.add(t),o?.observe(e)}),()=>{n.forEach(e=>{let n=xN.get(e);n?.delete(t),n?.size||o?.unobserve(e)})})}let xI=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]),xF=new Set(["INPUT","SELECT","TEXTAREA"]),xz=e=>"mouse"===e.pointerType?"number"!=typeof e.button||e.button<=0:!1!==e.isPrimary;function xB(e){return{point:{x:e.pageX,y:e.pageY}}}function x$(e,t,n,r){return xv(e,t,e=>xz(e)&&n(e,xB(e)),r)}let xU=({current:e})=>e?e.ownerDocument.defaultView:null,xV=(e,t)=>Math.abs(e-t),xW=new Set(["auto","scroll"]);class xH{constructor(e,t,{transformPagePoint:n,contextWindow:r=window,dragSnapToOrigin:i=!1,distanceThreshold:o=3,element:s}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.lastRawMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=e=>{this.handleScroll(e.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{var e,t;if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=xK(this.lastRawMoveEventInfo,this.transformPagePoint));let n=xq(this.lastMoveEventInfo,this.history),r=null!==this.startEvent,i=(e=n.offset,t={x:0,y:0},Math.sqrt(xV(e.x,t.x)**2+xV(e.y,t.y)**2)>=this.distanceThreshold);if(!r&&!i)return;let{point:o}=n,{timestamp:s}=gh;this.history.push({...o,timestamp:s});let{onStart:a,onMove:l}=this.handlers;r||(a&&a(this.lastMoveEvent,n),this.startEvent=this.lastMoveEvent),l&&l(this.lastMoveEvent,n)},this.handlePointerMove=(e,t)=>{this.lastMoveEvent=e,this.lastRawMoveEventInfo=t,this.lastMoveEventInfo=xK(t,this.transformPagePoint),gc.update(this.updatePoint,!0)},this.handlePointerUp=(e,t)=>{this.end();let{onEnd:n,onSessionEnd:r,resumeAnimation:i}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&i&&i(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;let o=xq("pointercancel"===e.type?this.lastMoveEventInfo:xK(t,this.transformPagePoint),this.history);this.startEvent&&n&&n(e,o),r&&r(e,o)},!xz(e))return;this.dragSnapToOrigin=i,this.handlers=t,this.transformPagePoint=n,this.distanceThreshold=o,this.contextWindow=r||window;const a=xK(xB(e),this.transformPagePoint),{point:l}=a,{timestamp:u}=gh;this.history=[{...l,timestamp:u}];const{onSessionStart:c}=t;c&&c(e,xq(a,this.history)),this.removeListeners=vu(x$(this.contextWindow,"pointermove",this.handlePointerMove),x$(this.contextWindow,"pointerup",this.handlePointerUp),x$(this.contextWindow,"pointercancel",this.handlePointerUp)),s&&this.startScrollTracking(s)}startScrollTracking(e){let t=e.parentElement;for(;t;){let e=getComputedStyle(t);(xW.has(e.overflowX)||xW.has(e.overflowY))&&this.scrollPositions.set(t,{x:t.scrollLeft,y:t.scrollTop}),t=t.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0}),window.addEventListener("scroll",this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(e){let t=this.scrollPositions.get(e);if(!t)return;let n=e===window,r=n?{x:window.scrollX,y:window.scrollY}:{x:e.scrollLeft,y:e.scrollTop},i={x:r.x-t.x,y:r.y-t.y};(0!==i.x||0!==i.y)&&(n?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=i.x,this.lastMoveEventInfo.point.y+=i.y):this.history.length>0&&(this.history[0].x-=i.x,this.history[0].y-=i.y),this.scrollPositions.set(e,r),gc.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),gd(this.updatePoint)}}function xK(e,t){return t?{point:t(e.point)}:e}function xG(e,t){return{x:e.x-t.x,y:e.y-t.y}}function xq({point:e},t){return{point:e,delta:xG(e,xJ(t)),offset:xG(e,t[0]),velocity:function(e){if(e.length<2)return{x:0,y:0};let t=e.length-1,n=null,r=xJ(e);for(;t>=0&&(n=e[t],!(r.timestamp-n.timestamp>gC(.1)));)t--;if(!n)return{x:0,y:0};n===e[0]&&e.length>2&&r.timestamp-n.timestamp>2*gC(.1)&&(n=e[1]);let i=(r.timestamp-n.timestamp)/1e3;if(0===i)return{x:0,y:0};let o={x:(r.x-n.x)/i,y:(r.y-n.y)/i};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}(t)}}function xJ(e){return e[e.length-1]}function xY(e,t,n){return{min:void 0!==t?e.min+t:void 0,max:void 0!==n?e.max+n-(e.max-e.min):void 0}}function xX(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.min<e.max-e.min&&([n,r]=[r,n]),{min:n,max:r}}function xZ(e,t,n){return{min:xQ(e,t),max:xQ(e,n)}}function xQ(e,t){return"number"==typeof e?e:e[t]||0}let x0=new WeakMap;class x1{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=m$(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:t=!1,distanceThreshold:n}={}){let{presenceContext:r}=this.visualElement;if(r&&!1===r.isPresent)return;let i=e=>{t&&this.snapToCursor(xB(e).point),this.stopAnimation()},o=(e,t)=>{let{drag:n,dragPropagation:r,onDragStart:i}=this.getProps();if(n&&!r&&(this.openDragLock&&this.openDragLock(),this.openDragLock=function(e){if("x"===e||"y"===e)if(xx[e])return null;else return xx[e]=!0,()=>{xx[e]=!1};return xx.x||xx.y?null:(xx.x=xx.y=!0,()=>{xx.x=xx.y=!1})}(n),!this.openDragLock))return;this.latestPointerEvent=e,this.latestPanInfo=t,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),xy(e=>{let t=this.getAxisMotionValue(e).get()||0;if(mm.test(t)){let{projection:n}=this.visualElement;if(n&&n.layout){let r=n.layout.layoutBox[e];r&&(t=xb(r)*(parseFloat(t)/100))}}this.originPoint[e]=t}),i&&gc.update(()=>i(e,t),!1,!0),vl(this.visualElement,"transform");let{animationState:o}=this.visualElement;o&&o.setActive("whileDrag",!0)},s=(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t;let{dragPropagation:n,dragDirectionLock:r,onDirectionLock:i,onDrag:o}=this.getProps();if(!n&&!this.openDragLock)return;let{offset:s}=t;if(r&&null===this.currentDirection){this.currentDirection=function(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}(s),null!==this.currentDirection&&i&&i(this.currentDirection);return}this.updateAxis("x",t.point,s),this.updateAxis("y",t.point,s),this.visualElement.render(),o&&gc.update(()=>o(e,t),!1,!0)},a=(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t,this.stop(e,t),this.latestPointerEvent=null,this.latestPanInfo=null},l=()=>{let{dragSnapToOrigin:e}=this.getProps();(e||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:u}=this.getProps();this.panSession=new xH(e,{onSessionStart:i,onStart:o,onMove:s,onSessionEnd:a,resumeAnimation:l},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:u,distanceThreshold:n,contextWindow:xU(this.visualElement),element:this.visualElement.current})}stop(e,t){let n=e||this.latestPointerEvent,r=t||this.latestPanInfo,i=this.isDragging;if(this.cancel(),!i||!r||!n)return;let{velocity:o}=r;this.startAnimation(o);let{onDragEnd:s}=this.getProps();s&&gc.postRender(()=>s(n,r))}cancel(){this.isDragging=!1;let{projection:e,animationState:t}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.endPanSession();let{dragPropagation:n}=this.getProps();!n&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),t&&t.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(e,t,n){let{drag:r}=this.getProps();if(!n||!x5(e,r,this.currentDirection))return;let i=this.getAxisMotionValue(e),o=this.originPoint[e]+n[e];this.constraints&&this.constraints[e]&&(o=function(e,{min:t,max:n},r){return void 0!==t&&e<t?e=r?yb(t,e,r.min):Math.max(e,t):void 0!==n&&e>n&&(e=r?yb(n,e,r.max):Math.min(e,n)),e}(o,this.constraints[e],this.elastic[e])),i.set(o)}resolveConstraints(){let{dragConstraints:e,dragElastic:t}=this.getProps(),n=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,r=this.constraints;e&&ve(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&n?this.constraints=function(e,{top:t,left:n,bottom:r,right:i}){return{x:xY(e.x,n,i),y:xY(e.y,t,r)}}(n.layoutBox,e):this.constraints=!1,this.elastic=function(e=.35){return!1===e?e=0:!0===e&&(e=.35),{x:xZ(e,"left","right"),y:xZ(e,"top","bottom")}}(t),r!==this.constraints&&!ve(e)&&n&&this.constraints&&!this.hasMutatedConstraints&&xy(e=>{var t,r;let i;!1!==this.constraints&&this.getAxisMotionValue(e)&&(this.constraints[e]=(t=n.layoutBox[e],r=this.constraints[e],i={},void 0!==r.min&&(i.min=r.min-t.min),void 0!==r.max&&(i.max=r.max-t.min),i))})}resolveRefConstraints(){var e;let{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!ve(t))return!1;let r=t.current;mq(null!==r,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.","drag-constraints-ref");let{projection:i}=this.visualElement;if(!i||!i.layout)return!1;i.root&&(i.root.scroll=void 0,i.root.updateScroll());let o=function(e,t,n){let r=yF(e,n),{scroll:i}=t;return i&&(yR(r.x,i.offset.x),yR(r.y,i.offset.y)),r}(r,i.root,this.visualElement.getTransformPagePoint()),s=(e=i.layout.layoutBox,{x:xX(e.x,o.x),y:xX(e.y,o.y)});if(n){let e=n(function({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}(s));this.hasMutatedConstraints=!!e,e&&(s=yE(e))}return s}startAnimation(e){let{drag:t,dragMomentum:n,dragElastic:r,dragTransition:i,dragSnapToOrigin:o,onDragTransitionEnd:s}=this.getProps(),a=this.constraints||{};return Promise.all(xy(s=>{if(!x5(s,t,this.currentDirection))return;let l=a&&a[s]||{};(!0===o||o===s)&&(l={min:0,max:0});let u={type:"inertia",velocity:n?e[s]:0,bounceStiffness:r?200:1e6,bounceDamping:r?40:1e7,timeConstant:750,restDelta:1,restSpeed:10,...i,...l};return this.startAxisValueAnimation(s,u)})).then(s)}startAxisValueAnimation(e,t){let n=this.getAxisMotionValue(e);return vl(this.visualElement,e),n.start(xs(e,n,0,t,this.visualElement,!1))}stopAnimation(){xy(e=>this.getAxisMotionValue(e).stop())}getAxisMotionValue(e){let t=`_drag${e.toUpperCase()}`;return this.visualElement.getProps()[t]||this.visualElement.getValue(e,this.visualElement.latestValues[e]??0)}snapToCursor(e){xy(t=>{let{drag:n}=this.getProps();if(!x5(t,n,this.currentDirection))return;let{projection:r}=this.visualElement,i=this.getAxisMotionValue(t);if(r&&r.layout){let{min:n,max:o}=r.layout.layoutBox[t],s=i.get()||0;i.set(e[t]-yb(n,o,.5)+s)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;let{drag:e,dragConstraints:t}=this.getProps(),{projection:n}=this.visualElement;if(!ve(t)||!n||!this.constraints)return;this.stopAnimation();let r={x:0,y:0};xy(e=>{let t=this.getAxisMotionValue(e);if(t&&!1!==this.constraints){var n,i;let o,s,a,l=t.get();r[e]=(n={min:l,max:l},i=this.constraints[e],o=.5,s=xb(n),(a=xb(i))>s?o=vZ(i.min,i.max-s,n.min):s>a&&(o=vZ(n.min,n.max-a,i.min)),mt(0,1,o))}});let{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},""):"none",n.root&&n.root.updateScroll(),n.updateLayout(),this.constraints=!1,this.resolveConstraints(),xy(t=>{if(!x5(t,e,null))return;let n=this.getAxisMotionValue(t),{min:i,max:o}=this.constraints[t];n.set(yb(i,o,r[t]))}),this.visualElement.render()}addListeners(){let e;if(!this.visualElement.current)return;x0.set(this.visualElement,this);let t=this.visualElement.current,n=x$(t,"pointerdown",e=>{let{drag:n,dragListener:r=!0}=this.getProps(),i=e.target,o=i!==t&&(xF.has(i.tagName)||!0===i.isContentEditable);n&&r&&!o&&this.start(e)}),r=()=>{var n,r,i;let o,s,{dragConstraints:a}=this.getProps();ve(a)&&a.current&&(this.constraints=this.resolveRefConstraints(),e||(n=t,r=a.current,o=xO(n,x2(i=()=>this.scalePositionWithinConstraints())),s=xO(r,x2(i)),e=()=>{o(),s()}))},{projection:i}=this.visualElement,o=i.addEventListener("measure",r);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),gc.read(r);let s=xv(window,"resize",()=>this.scalePositionWithinConstraints()),a=i.addEventListener("didUpdate",({delta:e,hasLayoutChanged:t})=>{this.isDragging&&t&&(xy(t=>{let n=this.getAxisMotionValue(t);n&&(this.originPoint[t]+=e[t].translate,n.set(n.get()+e[t].translate))}),this.visualElement.render())});return()=>{s(),n(),o(),a&&a(),e&&e()}}getProps(){let e=this.visualElement.getProps(),{drag:t=!1,dragDirectionLock:n=!1,dragPropagation:r=!1,dragConstraints:i=!1,dragElastic:o=.35,dragMomentum:s=!0}=e;return{...e,drag:t,dragDirectionLock:n,dragPropagation:r,dragConstraints:i,dragElastic:o,dragMomentum:s}}}function x2(e){let t=!0;return()=>{if(t){t=!1;return}e()}}function x5(e,t,n){return(!0===t||t===e)&&(null===n||n===e)}let x3=e=>(t,n)=>{e&&gc.update(()=>e(t,n),!1,!0)},x4={hasAnimatedSinceResize:!0,hasEverUpdated:!1};var x6=T;let x8=!1;class x9 extends x6.Component{componentDidMount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:n,layoutId:r}=this.props,{projection:i}=e;i&&(t.group&&t.group.add(i),n&&n.register&&r&&n.register(i),x8&&i.root.didUpdate(),i.addEventListener("animationComplete",()=>{this.safeToRemove()}),i.setOptions({...i.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),x4.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){let{layoutDependency:t,visualElement:n,drag:r,isPresent:i}=this.props,{projection:o}=n;return o&&(o.isPresent=i,e.layoutDependency!==t&&o.setOptions({...o.options,layoutDependency:t}),x8=!0,r||e.layoutDependency!==t||void 0===t||e.isPresent!==i?o.willUpdate():this.safeToRemove(),e.isPresent!==i&&(i?o.promote():o.relegate()||gc.postRender(()=>{let e=o.getStack();e&&e.members.length||this.safeToRemove()}))),null}componentDidUpdate(){let{visualElement:e,layoutAnchor:t}=this.props,{projection:n}=e;n&&(n.options.layoutAnchor=t,n.root.didUpdate(),gK.postRender(()=>{!n.currentAnimation&&n.isLead()&&this.safeToRemove()}))}componentWillUnmount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:n}=this.props,{projection:r}=e;x8=!0,r&&(r.scheduleCheckAfterUnmount(),t&&t.group&&t.group.remove(r),n&&n.deregister&&n.deregister(r))}safeToRemove(){let{safeToRemove:e}=this.props;e&&e()}render(){return null}}function x7(e){let[t,n]=function(e=!0){let t=(0,T.useContext)(y0);if(null===t)return[!0,null];let{isPresent:n,onExitComplete:r,register:i}=t,o=(0,T.useId)();(0,T.useEffect)(()=>{if(e)return i(o)},[e]);let s=(0,T.useCallback)(()=>e&&r&&r(o),[o,r,e]);return!n&&r?[!1,s]:[!0]}(),r=(0,x6.useContext)(yU);return(0,A.jsx)(x9,{...e,layoutGroup:r,switchLayoutGroup:(0,x6.useContext)(y7),isPresent:t,safeToRemove:n})}let be=["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"],bt=be.length,bn=e=>"string"==typeof e?parseFloat(e):e,br=e=>"number"==typeof e||mg.test(e);function bi(e,t){return void 0!==e[t]?e[t]:e.borderRadius}let bo=ba(0,.5,vq),bs=ba(.5,.95,gs);function ba(e,t,n){return r=>r<e?0:r>t?1:n(vZ(e,t,r))}function bl(e,t){e.min=t.min,e.max=t.max}function bu(e,t){bl(e.x,t.x),bl(e.y,t.y)}function bc(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function bd(e,t,n,r,i){return e-=t,e=r+1/n*(e-r),void 0!==i&&(e=r+1/i*(e-r)),e}function bh(e,t,[n,r,i],o,s){!function(e,t=0,n=1,r=.5,i,o=e,s=e){if(mm.test(t)&&(t=parseFloat(t),t=yb(s.min,s.max,t/100)-s.min),"number"!=typeof t)return;let a=yb(o.min,o.max,r);e===o&&(a-=t),e.min=bd(e.min,t,n,a,i),e.max=bd(e.max,t,n,a,i)}(e,t[n],t[r],t[i],t.scale,o,s)}let bf=["x","scaleX","originX"],bp=["y","scaleY","originY"];function bm(e,t,n,r){bh(e.x,t,bf,n?n.x:void 0,r?r.x:void 0),bh(e.y,t,bp,n?n.y:void 0,r?r.y:void 0)}function bg(e){return 0===e.translate&&1===e.scale}function by(e){return bg(e.x)&&bg(e.y)}function bv(e,t){return e.min===t.min&&e.max===t.max}function bx(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function bb(e,t){return bx(e.x,t.x)&&bx(e.y,t.y)}function bw(e){return xb(e.x)/xb(e.y)}function bk(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}class b_{constructor(){this.members=[]}add(e){gE(this.members,e);for(let t=this.members.length-1;t>=0;t--){let n=this.members[t];if(n===e||n===this.lead||n===this.prevLead)continue;let r=n.instance;r&&!1!==r.isConnected||n.snapshot||(gA(this.members,n),n.unmount())}e.scheduleRender()}remove(e){if(gA(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){let e=this.members[this.members.length-1];e&&this.promote(e)}}relegate(e){for(let t=this.members.indexOf(e)-1;t>=0;t--){let e=this.members[t];if(!1!==e.isPresent&&e.instance?.isConnected!==!1)return this.promote(e),!0}return!1}promote(e,t){let n=this.lead;if(e!==n&&(this.prevLead=n,this.lead=e,e.show(),n)){n.updateSnapshot(),e.scheduleRender();let{layoutDependency:r}=n.options,{layoutDependency:i}=e.options;(void 0===r||r!==i)&&(e.resumeFrom=n,t&&(n.preserveOpacity=!0),n.snapshot&&(e.snapshot=n.snapshot,e.snapshot.latestValues=n.animationValues||n.latestValues),e.root?.isUpdating&&(e.isLayoutDirty=!0)),!1===e.options.crossfade&&n.hide()}}exitAnimationComplete(){this.members.forEach(e=>{e.options.onExitComplete?.(),e.resumingFrom?.options.onExitComplete?.()})}scheduleRender(){this.members.forEach(e=>e.instance&&e.scheduleRender(!1))}removeLeadSnapshot(){this.lead?.snapshot&&(this.lead.snapshot=void 0)}}let bS=(e,t)=>e.depth-t.depth;class bC{constructor(){this.children=[],this.isDirty=!1}add(e){gE(this.children,e),this.isDirty=!0}remove(e){gA(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(bS),this.isDirty=!1,this.children.forEach(e)}}let bE=["","X","Y","Z"],bA=0;function bT(e,t,n,r){let{latestValues:i}=t;i[e]&&(n[e]=i[e],t.setStaticValue(e,0),r&&(r[e]=0))}function bN({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return class{constructor(e={},n=t?.()){this.id=bA++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(bM),this.nodes.forEach(b$),this.nodes.forEach(bU),this.nodes.forEach(bD)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=e,this.root=n?n.root||n:this,this.path=n?[...n.path,n]:[],this.parent=n,this.depth=n?n.depth+1:0;for(let e=0;e<this.path.length;e++)this.path[e].shouldResetTransform=!0;this.root===this&&(this.nodes=new bC)}addEventListener(e,t){return this.eventHandlers.has(e)||this.eventHandlers.set(e,new gT),this.eventHandlers.get(e).add(t)}notifyListeners(e,...t){let n=this.eventHandlers.get(e);n&&n.notify(...t)}hasListeners(e){return this.eventHandlers.has(e)}mount(t){if(this.instance)return;this.isSVG=xA(t)&&!(xA(t)&&"svg"===t.tagName),this.instance=t;let{layoutId:n,layout:r,visualElement:i}=this.options;if(i&&!i.current&&i.mount(t),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(r||n)&&(this.isLayoutDirty=!0),e){let n,r=0,i=()=>this.root.updateBlockedByResize=!1;gc.read(()=>{r=window.innerWidth}),e(t,()=>{let e=window.innerWidth;if(e!==r){let t,o;r=e,this.root.updateBlockedByResize=!0,n&&n(),t=gq.now(),o=({timestamp:e})=>{let n=e-t;n>=250&&(gd(o),i(n-250))},gc.setup(o,!0),n=()=>gd(o),x4.hasAnimatedSinceResize&&(x4.hasAnimatedSinceResize=!1,this.nodes.forEach(bB))}})}n&&this.root.registerSharedNode(n,this),!1!==this.options.animate&&i&&(n||r)&&this.addEventListener("didUpdate",({delta:e,hasLayoutChanged:t,hasRelativeLayoutChanged:n,layout:r})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}let o=this.options.transition||i.getDefaultTransition()||bq,{onLayoutAnimationStart:s,onLayoutAnimationComplete:a}=i.getProps(),l=!this.targetLayout||!bb(this.targetLayout,r),u=!t&&n;if(this.options.layoutRoot||this.resumeFrom||u||t&&(l||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);let t={...vs(o,"layout"),onPlay:s,onComplete:a};(i.shouldReduceMotion||this.options.layoutRoot)&&(t.delay=0,t.type=!1),this.startAnimation(t),this.setAnimationOrigin(e,u)}else t||bB(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=r})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);let e=this.getStack();e&&e.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),gd(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){!this.isUpdateBlocked()&&(this.isUpdating=!0,this.nodes&&this.nodes.forEach(bV),this.animationId++)}getTransformTemplate(){let{visualElement:e}=this.options;return e&&e.getProps().transformTemplate}willUpdate(e=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&function e(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;let{visualElement:n}=t.options;if(!n)return;let r=n.props[y9];if(window.MotionHasOptimisedAnimation(r,"transform")){let{layout:e,layoutId:n}=t.options;window.MotionCancelOptimisedAnimation(r,"transform",gc,!(e||n))}let{parent:i}=t;i&&!i.hasCheckedOptimisedAppear&&e(i)}(this),this.root.isUpdating||this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let e=0;e<this.path.length;e++){let t=this.path[e];t.shouldResetTransform=!0,("string"==typeof t.latestValues.x||"string"==typeof t.latestValues.y)&&(t.isLayoutDirty=!0),t.updateScroll("snapshot"),t.options.layoutRoot&&t.willUpdate(!1)}let{layoutId:t,layout:n}=this.options;if(void 0===t&&!n)return;let r=this.getTransformTemplate();this.prevTransformTemplateValue=r?r(this.latestValues,""):void 0,this.updateSnapshot(),e&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){let e=this.updateBlockedByResize;this.unblockUpdate(),this.updateBlockedByResize=!1,this.clearAllSnapshots(),e&&this.nodes.forEach(bO),this.nodes.forEach(bL);return}if(this.animationId<=this.animationCommitId)return void this.nodes.forEach(bI);this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(bF),this.nodes.forEach(bz),this.nodes.forEach(bj),this.nodes.forEach(bP)):this.nodes.forEach(bI),this.clearAllSnapshots();let e=gq.now();gh.delta=mt(0,1e3/60,e-gh.timestamp),gh.timestamp=e,gh.isProcessing=!0,gf.update.process(gh),gf.preRender.process(gh),gf.render.process(gh),gh.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,gK.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(bR),this.sharedNodes.forEach(bW)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,gc.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){gc.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){!this.snapshot&&this.instance&&(this.snapshot=this.measure(),!this.snapshot||xb(this.snapshot.measuredBox.x)||xb(this.snapshot.measuredBox.y)||(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let e=0;e<this.path.length;e++)this.path[e].updateScroll();let e=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected||(this.layoutCorrected=m$()),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);let{visualElement:t}=this.options;t&&t.notify("LayoutMeasure",this.layout.layoutBox,e?e.layoutBox:void 0)}updateScroll(e="measure"){let t=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===e&&(t=!1),t&&this.instance){let t=r(this.instance);this.scroll={animationId:this.root.animationId,phase:e,isRoot:t,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:t}}}resetTransform(){if(!i)return;let e=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,t=this.projectionDelta&&!by(this.projectionDelta),n=this.getTransformTemplate(),r=n?n(this.latestValues,""):void 0,o=r!==this.prevTransformTemplateValue;e&&this.instance&&(t||yN(this.latestValues)||o)&&(i(this.instance,r),this.shouldResetTransform=!1,this.scheduleRender())}measure(e=!0){var t;let n=this.measurePageBox(),r=this.removeElementScroll(n);return e&&(r=this.removeTransform(r)),bX((t=r).x),bX(t.y),{animationId:this.root.animationId,measuredBox:n,layoutBox:r,latestValues:{},source:this.id}}measurePageBox(){let{visualElement:e}=this.options;if(!e)return m$();let t=e.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(bQ))){let{scroll:e}=this.root;e&&(yR(t.x,e.offset.x),yR(t.y,e.offset.y))}return t}removeElementScroll(e){let t=m$();if(bu(t,e),this.scroll?.wasRoot)return t;for(let n=0;n<this.path.length;n++){let r=this.path[n],{scroll:i,options:o}=r;r!==this.root&&i&&o.layoutScroll&&(i.wasRoot&&bu(t,e),yR(t.x,i.offset.x),yR(t.y,i.offset.y))}return t}applyTransform(e,t=!1,n){let r=n||m$();bu(r,e);for(let e=0;e<this.path.length;e++){let n=this.path[e];!t&&n.options.layoutScroll&&n.scroll&&n!==n.root&&(yR(r.x,-n.scroll.offset.x),yR(r.y,-n.scroll.offset.y)),yN(n.latestValues)&&yI(r,n.latestValues,n.layout?.layoutBox)}return yN(this.latestValues)&&yI(r,this.latestValues,this.layout?.layoutBox),r}removeTransform(e){let t=m$();bu(t,e);for(let e=0;e<this.path.length;e++){let n,r=this.path[e];yN(r.latestValues)&&(r.instance&&(yT(r.latestValues)&&r.updateSnapshot(),bu(n=m$(),r.measurePageBox())),bm(t,r.latestValues,r.snapshot?.layoutBox,n))}return yN(this.latestValues)&&bm(t,this.latestValues),t}setTargetDelta(e){this.targetDelta=e,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(e){this.options={...this.options,...e,crossfade:void 0===e.crossfade||e.crossfade}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==gh.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(e=!1){let t=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=t.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=t.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=t.isSharedProjectionDirty);let n=!!this.resumingFrom||this!==t;if(!(e||n&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;let{layout:r,layoutId:i}=this.options;if(!this.layout||!(r||i))return;this.resolvedRelativeTargetAt=gh.timestamp;let o=this.getClosestProjectingParent();if(o&&this.linkedParentVersion!==o.layoutVersion&&!o.options.layoutRoot&&this.removeRelativeTarget(),this.targetDelta||this.relativeTarget||(!1!==this.options.layoutAnchor&&o&&o.layout?this.createRelativeTarget(o,this.layout.layoutBox,o.layout.layoutBox):this.removeRelativeTarget()),this.relativeTarget||this.targetDelta){if(this.target||(this.target=m$(),this.targetWithTransforms=m$()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target){var s,a,l,u;this.forceRelativeParentToResolveTarget(),s=this.target,a=this.relativeTarget,l=this.relativeParent.target,u=this.options.layoutAnchor||void 0,x_(s.x,a.x,l.x,u?.x),x_(s.y,a.y,l.y,u?.y)}else this.targetDelta?(this.resumingFrom?this.applyTransform(this.layout.layoutBox,!1,this.target):bu(this.target,this.layout.layoutBox),yD(this.target,this.targetDelta)):bu(this.target,this.layout.layoutBox);this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,!1!==this.options.layoutAnchor&&o&&!!o.resumingFrom==!!this.resumingFrom&&!o.options.layoutScroll&&o.target&&1!==this.animationProgress?this.createRelativeTarget(o,this.target,o.target):this.relativeParent=this.relativeTarget=void 0)}}getClosestProjectingParent(){if(!(!this.parent||yT(this.parent.latestValues)||yj(this.parent.latestValues)))if(this.parent.isProjecting())return this.parent;else return this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(e,t,n){this.relativeParent=e,this.linkedParentVersion=e.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=m$(),this.relativeTargetOrigin=m$(),xC(this.relativeTargetOrigin,t,n,this.options.layoutAnchor||void 0),bu(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){let e=this.getLead(),t=!!this.resumingFrom||this!==e,n=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(n=!1),t&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(n=!1),this.resolvedRelativeTargetAt===gh.timestamp&&(n=!1),n)return;let{layout:r,layoutId:i}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(r||i))return;bu(this.layoutCorrected,this.layout.layoutBox);let o=this.treeScale.x,s=this.treeScale.y;!function(e,t,n,r=!1){let i,o,s=n.length;if(s){t.x=t.y=1;for(let a=0;a<s;a++){o=(i=n[a]).projectionDelta;let{visualElement:s}=i.options;(!s||!s.props.style||"contents"!==s.props.style.display)&&(r&&i.options.layoutScroll&&i.scroll&&i!==i.root&&(yR(e.x,-i.scroll.offset.x),yR(e.y,-i.scroll.offset.y)),o&&(t.x*=o.x.scale,t.y*=o.y.scale,yD(e,o)),r&&yN(i.latestValues)&&yI(e,i.latestValues,i.layout?.layoutBox))}t.x<1.0000000000001&&t.x>.999999999999&&(t.x=1),t.y<1.0000000000001&&t.y>.999999999999&&(t.y=1)}}(this.layoutCorrected,this.treeScale,this.path,t),e.layout&&!e.target&&(1!==this.treeScale.x||1!==this.treeScale.y)&&(e.target=e.layout.layoutBox,e.targetWithTransforms=m$());let{target:a}=e;if(!a){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}this.projectionDelta&&this.prevProjectionDelta?(bc(this.prevProjectionDelta.x,this.projectionDelta.x),bc(this.prevProjectionDelta.y,this.projectionDelta.y)):this.createProjectionDeltas(),xk(this.projectionDelta,this.layoutCorrected,a,this.latestValues),this.treeScale.x===o&&this.treeScale.y===s&&bk(this.projectionDelta.x,this.prevProjectionDelta.x)&&bk(this.projectionDelta.y,this.prevProjectionDelta.y)||(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",a))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(e=!0){if(this.options.visualElement?.scheduleRender(),e){let e=this.getStack();e&&e.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=mz(),this.projectionDelta=mz(),this.projectionDeltaWithTransform=mz()}setAnimationOrigin(e,t=!1){let n,r=this.snapshot,i=r?r.latestValues:{},o={...this.latestValues},s=mz();this.relativeParent&&this.relativeParent.options.layoutRoot||(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!t;let a=m$(),l=(r?r.source:void 0)!==(this.layout?this.layout.source:void 0),u=this.getStack(),c=!u||u.members.length<=1,d=!!(l&&!c&&!0===this.options.crossfade&&!this.path.some(bG));this.animationProgress=0,this.mixTargetDelta=t=>{let r=t/1e3;if(bH(s.x,e.x,r),bH(s.y,e.y,r),this.setTargetDelta(s),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout){var u,h,f,p,m,g;xC(a,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),f=this.relativeTarget,p=this.relativeTargetOrigin,m=a,g=r,bK(f.x,p.x,m.x,g),bK(f.y,p.y,m.y,g),n&&(u=this.relativeTarget,h=n,bv(u.x,h.x)&&bv(u.y,h.y))&&(this.isProjectionDirty=!1),n||(n=m$()),bu(n,this.relativeTarget)}l&&(this.animationValues=o,function(e,t,n,r,i,o){i?(e.opacity=yb(0,n.opacity??1,bo(r)),e.opacityExit=yb(t.opacity??1,0,bs(r))):o&&(e.opacity=yb(t.opacity??1,n.opacity??1,r));for(let i=0;i<bt;i++){let o=be[i],s=bi(t,o),a=bi(n,o);(void 0!==s||void 0!==a)&&(s||(s=0),a||(a=0),0===s||0===a||br(s)===br(a)?(e[o]=Math.max(yb(bn(s),bn(a),r),0),(mm.test(a)||mm.test(s))&&(e[o]+="%")):e[o]=a)}(t.rotate||n.rotate)&&(e.rotate=yb(t.rotate||0,n.rotate||0,r))}(o,i,this.latestValues,r,d,c)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=r},this.mixTargetDelta(1e3*!!this.options.layoutRoot)}startAnimation(e){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(gd(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=gc.update(()=>{var t,n,r;let i;x4.hasAnimatedSinceResize=!0,gI.layout++,this.motionValue||(this.motionValue=gZ(0)),this.motionValue.jump(0,!1),this.currentAnimation=(t=this.motionValue,n=[0,1e3],r={...e,velocity:0,isSync:!0,onUpdate:t=>{this.mixTargetDelta(t),e.onUpdate&&e.onUpdate(t)},onStop:()=>{gI.layout--},onComplete:()=>{gI.layout--,e.onComplete&&e.onComplete(),this.completeAnimation()}},(i=mU(t)?t:gZ(t)).start(xs("",i,n,r)),i.animation),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);let e=this.getStack();e&&e.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(1e3),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){let e=this.getLead(),{targetWithTransforms:t,target:n,layout:r,latestValues:i}=e;if(t&&n&&r){if(this!==e&&this.layout&&r&&bZ(this.options.animationType,this.layout.layoutBox,r.layoutBox)){n=this.target||m$();let t=xb(this.layout.layoutBox.x);n.x.min=e.target.x.min,n.x.max=n.x.min+t;let r=xb(this.layout.layoutBox.y);n.y.min=e.target.y.min,n.y.max=n.y.min+r}bu(t,n),yI(t,i),xk(this.projectionDeltaWithTransform,this.layoutCorrected,t,i)}}registerSharedNode(e,t){this.sharedNodes.has(e)||this.sharedNodes.set(e,new b_),this.sharedNodes.get(e).add(t);let n=t.options.initialPromotionConfig;t.promote({transition:n?n.transition:void 0,preserveFollowOpacity:n&&n.shouldPreserveFollowOpacity?n.shouldPreserveFollowOpacity(t):void 0})}isLead(){let e=this.getStack();return!e||e.lead===this}getLead(){let{layoutId:e}=this.options;return e&&this.getStack()?.lead||this}getPrevLead(){let{layoutId:e}=this.options;return e?this.getStack()?.prevLead:void 0}getStack(){let{layoutId:e}=this.options;if(e)return this.root.sharedNodes.get(e)}promote({needsReset:e,transition:t,preserveFollowOpacity:n}={}){let r=this.getStack();r&&r.promote(this,n),e&&(this.projectionDelta=void 0,this.needsReset=!0),t&&this.setOptions({transition:t})}relegate(){let e=this.getStack();return!!e&&e.relegate(this)}resetSkewAndRotation(){let{visualElement:e}=this.options;if(!e)return;let t=!1,{latestValues:n}=e;if((n.z||n.rotate||n.rotateX||n.rotateY||n.rotateZ||n.skewX||n.skewY)&&(t=!0),!t)return;let r={};n.z&&bT("z",e,r,this.animationValues);for(let t=0;t<bE.length;t++)bT(`rotate${bE[t]}`,e,r,this.animationValues),bT(`skew${bE[t]}`,e,r,this.animationValues);for(let t in e.render(),r)e.setStaticValue(t,r[t]),this.animationValues&&(this.animationValues[t]=r[t]);e.scheduleRender()}applyProjectionStyles(e,t){if(!this.instance||this.isSVG)return;if(!this.isVisible){e.visibility="hidden";return}let n=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,e.visibility="",e.opacity="",e.pointerEvents=yQ(t?.pointerEvents)||"",e.transform=n?n(this.latestValues,""):"none";return}let r=this.getLead();if(!this.projectionDelta||!this.layout||!r.target){this.options.layoutId&&(e.opacity=void 0!==this.latestValues.opacity?this.latestValues.opacity:1,e.pointerEvents=yQ(t?.pointerEvents)||""),this.hasProjected&&!yN(this.latestValues)&&(e.transform=n?n({},""):"none",this.hasProjected=!1);return}e.visibility="";let i=r.animationValues||r.latestValues;this.applyTransformsToTarget();let o=function(e,t,n){let r="",i=e.x.translate/t.x,o=e.y.translate/t.y,s=n?.z||0;if((i||o||s)&&(r=`translate3d(${i}px, ${o}px, ${s}px) `),(1!==t.x||1!==t.y)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){let{transformPerspective:e,rotate:t,rotateX:i,rotateY:o,skewX:s,skewY:a}=n;e&&(r=`perspective(${e}px) ${r}`),t&&(r+=`rotate(${t}deg) `),i&&(r+=`rotateX(${i}deg) `),o&&(r+=`rotateY(${o}deg) `),s&&(r+=`skewX(${s}deg) `),a&&(r+=`skewY(${a}deg) `)}let a=e.x.scale*t.x,l=e.y.scale*t.y;return(1!==a||1!==l)&&(r+=`scale(${a}, ${l})`),r||"none"}(this.projectionDeltaWithTransform,this.treeScale,i);n&&(o=n(i,o)),e.transform=o;let{x:s,y:a}=this.projectionDelta;for(let t in e.transformOrigin=`${100*s.origin}% ${100*a.origin}% 0`,r.animationValues?e.opacity=r===this?i.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:i.opacityExit:e.opacity=r===this?void 0!==i.opacity?i.opacity:"":void 0!==i.opacityExit?i.opacityExit:0,yw){if(void 0===i[t])continue;let{correct:n,applyTo:s,isCSSVariable:a}=yw[t],l="none"===o?i[t]:n(i[t],r);if(s){let t=s.length;for(let n=0;n<t;n++)e[s[n]]=l}else a?this.options.visualElement.renderState.vars[t]=l:e[t]=l}this.options.layoutId&&(e.pointerEvents=r===this?yQ(t?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(e=>e.currentAnimation?.stop()),this.root.nodes.forEach(bL),this.root.sharedNodes.clear()}}}function bj(e){e.updateLayout()}function bP(e){let t=e.resumeFrom?.snapshot||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners("didUpdate")){let{layoutBox:n,measuredBox:r}=e.layout,{animationType:i}=e.options,o=t.source!==e.layout.source;if("size"===i)xy(e=>{let r=o?t.measuredBox[e]:t.layoutBox[e],i=xb(r);r.min=n[e].min,r.max=r.min+i});else if("x"===i||"y"===i){let e="x"===i?"y":"x";bl(o?t.measuredBox[e]:t.layoutBox[e],n[e])}else bZ(i,t.layoutBox,n)&&xy(r=>{let i=o?t.measuredBox[r]:t.layoutBox[r],s=xb(n[r]);i.max=i.min+s,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[r].max=e.relativeTarget[r].min+s)});let s=mz();xk(s,n,t.layoutBox);let a=mz();o?xk(a,e.applyTransform(r,!0),t.measuredBox):xk(a,n,t.layoutBox);let l=!by(s),u=!1;if(!e.resumeFrom){let r=e.getClosestProjectingParent();if(r&&!r.resumeFrom){let{snapshot:i,layout:o}=r;if(i&&o){let s=e.options.layoutAnchor||void 0,a=m$();xC(a,t.layoutBox,i.layoutBox,s);let l=m$();xC(l,n,o.layoutBox,s),bb(a,l)||(u=!0),r.options.layoutRoot&&(e.relativeTarget=l,e.relativeTargetOrigin=a,e.relativeParent=r)}}}e.notifyListeners("didUpdate",{layout:n,snapshot:t,delta:a,layoutDelta:s,hasLayoutChanged:l,hasRelativeLayoutChanged:u})}else if(e.isLead()){let{onExitComplete:t}=e.options;t&&t()}e.options.transition=void 0}function bM(e){e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function bD(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function bR(e){e.clearSnapshot()}function bL(e){e.clearMeasurements()}function bO(e){e.isLayoutDirty=!0,e.updateLayout()}function bI(e){e.isLayoutDirty=!1}function bF(e){e.isAnimationBlocked&&e.layout&&!e.isLayoutDirty&&(e.snapshot=e.layout,e.isLayoutDirty=!0)}function bz(e){let{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function bB(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function b$(e){e.resolveTargetDelta()}function bU(e){e.calcProjection()}function bV(e){e.resetSkewAndRotation()}function bW(e){e.removeLeadSnapshot()}function bH(e,t,n){e.translate=yb(t.translate,0,n),e.scale=yb(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function bK(e,t,n,r){e.min=yb(t.min,n.min,r),e.max=yb(t.max,n.max,r)}function bG(e){return e.animationValues&&void 0!==e.animationValues.opacityExit}let bq={duration:.45,ease:[.4,0,.1,1]},bJ=e=>"u">typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),bY=bJ("applewebkit/")&&!bJ("chrome/")?Math.round:gs;function bX(e){e.min=bY(e.min),e.max=bY(e.max)}function bZ(e,t,n){return"position"===e||"preserve-aspect"===e&&!(.2>=Math.abs(bw(t)-bw(n)))}function bQ(e){return e!==e.root&&e.scroll?.wasRoot}let b0=bN({attachResizeListener:(e,t)=>xv(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),b1={current:void 0},b2=bN({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!b1.current){let e=new b0({});e.mount(window),e.setOptions({layoutScroll:!0}),b1.current=e}return b1.current},resetTransform:(e,t)=>{e.style.transform=void 0!==t?t:"none"},checkIsScrollRoot:e=>"fixed"===window.getComputedStyle(e).position});function b5(e,t){let n=xT(e),r=new AbortController;return[n,{passive:!0,...t,signal:r.signal},()=>r.abort()]}function b3(e,t,n){let{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive("whileHover","Start"===n);let i=r["onHover"+n];i&&gc.postRender(()=>i(t,xB(t)))}let b4=(e,t)=>!!t&&(e===t||b4(e,t.parentElement)),b6=new WeakSet;function b8(e){return t=>{"Enter"===t.key&&e(t)}}function b9(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}function b7(e){return xz(e)&&!(xx.x||xx.y)}let we=new WeakSet;function wt(e,t,n){let{props:r}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&r.whileTap&&e.animationState.setActive("whileTap","Start"===n);let i=r["onTap"+("End"===n?"":n)];i&&gc.postRender(()=>i(t,xB(t)))}let wn=new WeakMap,wr=new WeakMap,wi=e=>{let t=wn.get(e.target);t&&t(e)},wo=e=>{e.forEach(wi)},ws={some:0,all:1},wa=function(e,t){if("u"<typeof Proxy)return vn;let n=new Map,r=(n,r)=>vn(n,r,e,t);return new Proxy((e,t)=>r(e,t),{get:(i,o)=>"create"===o?r:(n.has(o)||n.set(o,vn(o,void 0,e,t)),n.get(o))})}({animation:{Feature:class extends vr{constructor(e){super(e),e.animationState||(e.animationState=function(e){let t=t=>Promise.all(t.map(({animation:t,options:n})=>(function(e,t,n={}){let r;if(e.notify("AnimationStart",t),Array.isArray(t))r=Promise.all(t.map(t=>xu(e,t,n)));else if("string"==typeof t)r=xu(e,t,n);else{let i="function"==typeof t?vi(e,t,n.custom):t;r=Promise.all(xa(e,i,n))}return r.then(()=>{e.notify("AnimationComplete",t)})})(e,t,n))),n=xm(),r=!0,i=!1,o=t=>(n,r)=>{let i=vi(e,r,"exit"===t?e.presenceContext?.custom:void 0);if(i){let{transition:e,transitionEnd:t,...r}=i;n={...n,...r,...t}}return n};function s(s){let{props:a}=e,l=function e(t){if(!t)return;if(!t.isControllingVariants){let n=t.parent&&e(t.parent)||{};return void 0!==t.props.initial&&(n.initial=t.props.initial),n}let n={};for(let e=0;e<xc;e++){let r=g3[e],i=t.props[r];(g2(i)||!1===i)&&(n[r]=i)}return n}(e.parent)||{},u=[],c=new Set,d={},h=1/0;for(let t=0;t<xf;t++){var f,p;let m=xh[t],g=n[m],y=void 0!==a[m]?a[m]:l[m],v=g2(y),x=m===s?g.isActive:null;!1===x&&(h=t);let b=y===l[m]&&y!==a[m]&&v;if(b&&(r||i)&&e.manuallyAnimateOnMount&&(b=!1),g.protectedKeys={...d},!g.isActive&&null===x||!y&&!g.prevProp||g1(y)||"boolean"==typeof y)continue;if("exit"===m&&g.isActive&&!0!==x){g.prevResolvedValues&&(d={...d,...g.prevResolvedValues});continue}let w=(f=g.prevProp,"string"==typeof(p=y)?p!==f:!!Array.isArray(p)&&!xd(p,f)),k=w||m===s&&g.isActive&&!b&&v||t>h&&v,_=!1,S=Array.isArray(y)?y:[y],C=S.reduce(o(m),{});!1===x&&(C={});let{prevResolvedValues:E={}}=g,A={...E,...C},T=t=>{k=!0,c.has(t)&&(_=!0,c.delete(t)),g.needsAnimating[t]=!0;let n=e.getValue(t);n&&(n.liveStyle=!1)};for(let e in A){let t=C[e],n=E[e];if(!d.hasOwnProperty(e))(va(t)&&va(n)?!xd(t,n)||w:t!==n)?null!=t?T(e):c.add(e):void 0!==t&&c.has(e)?T(e):g.protectedKeys[e]=!0}g.prevProp=y,g.prevResolvedValues=C,g.isActive&&(d={...d,...C}),(r||i)&&e.blockInitialAnimation&&(k=!1);let N=b&&w,j=!N||_;k&&j&&u.push(...S.map(t=>{let n={type:m};if("string"==typeof t&&(r||i)&&!N&&e.manuallyAnimateOnMount&&e.parent){let{parent:r}=e,i=vi(r,t);if(r.enteringChildren&&i){let{delayChildren:t}=i.transition||{};n.delay=xl(r.enteringChildren,e,t)}}return{animation:t,options:n}}))}if(c.size){let t={};if("boolean"!=typeof a.initial){let n=vi(e,Array.isArray(a.initial)?a.initial[0]:a.initial);n&&n.transition&&(t.transition=n.transition)}c.forEach(n=>{let r=e.getBaseTarget(n),i=e.getValue(n);i&&(i.liveStyle=!0),t[n]=r??null}),u.push({animation:t})}let m=!!u.length;return r&&(!1===a.initial||a.initial===a.animate)&&!e.manuallyAnimateOnMount&&(m=!1),r=!1,i=!1,m?t(u):Promise.resolve()}return{animateChanges:s,setActive:function(t,r){if(n[t].isActive===r)return Promise.resolve();e.variantChildren?.forEach(e=>e.animationState?.setActive(t,r)),n[t].isActive=r;let i=s(t);for(let e in n)n[e].protectedKeys={};return i},setAnimateFunction:function(n){t=n(e)},getState:()=>n,reset:()=>{n=xm(),i=!0}}}(e))}updateAnimationControlsSubscription(){let{animate:e}=this.node.getProps();g1(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){let{animate:e}=this.node.getProps(),{animate:t}=this.node.prevProps||{};e!==t&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}}},exit:{Feature:class extends vr{constructor(){super(...arguments),this.id=xg++,this.isExitComplete=!1}update(){if(!this.node.presenceContext)return;let{isPresent:e,onExitComplete:t}=this.node.presenceContext,{isPresent:n}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===n)return;if(e&&!1===n){if(this.isExitComplete){let{initial:e,custom:t}=this.node.getProps();if("string"==typeof e||"object"==typeof e&&null!==e&&!Array.isArray(e)){let n=vi(this.node,e,t);if(n){let{transition:e,transitionEnd:t,...r}=n;for(let e in r)this.node.getValue(e)?.jump(r[e])}}this.node.animationState.reset(),this.node.animationState.animateChanges()}else this.node.animationState.setActive("exit",!1);this.isExitComplete=!1;return}let r=this.node.animationState.setActive("exit",!e);t&&!e&&r.then(()=>{this.isExitComplete=!0,t(this.id)})}mount(){let{register:e,onExitComplete:t}=this.node.presenceContext||{};t&&t(this.id),e&&(this.unmount=e(this.id))}unmount(){}}},inView:{Feature:class extends vr{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){var e;let t;this.stopObserver?.();let{viewport:n={}}=this.node.getProps(),{root:r,margin:i,amount:o="some",once:s}=n,a={root:r?r.current:void 0,rootMargin:i,threshold:"number"==typeof o?o:ws[o]},l=e=>{let{isIntersecting:t}=e;if(this.isInView===t||(this.isInView=t,s&&!t&&this.hasEnteredView))return;t&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",t);let{onViewportEnter:n,onViewportLeave:r}=this.node.getProps(),i=t?n:r;i&&i(e)};this.stopObserver=(e=this.node.current,t=function({root:e,...t}){let n=e||document;wr.has(n)||wr.set(n,{});let r=wr.get(n),i=JSON.stringify(t);return r[i]||(r[i]=new IntersectionObserver(wo,{root:e,...t})),r[i]}(a),wn.set(e,l),t.observe(e),()=>{wn.delete(e),t.unobserve(e)})}mount(){this.startObserver()}update(){if("u"<typeof IntersectionObserver)return;let{props:e,prevProps:t}=this.node;["amount","margin","root"].some(function({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}(e,t))&&this.startObserver()}unmount(){this.stopObserver?.(),this.hasEnteredView=!1,this.isInView=!1}}},tap:{Feature:class extends vr{mount(){let{current:e}=this.node;if(!e)return;let{globalTapTarget:t,propagate:n}=this.node.props;this.unmount=function(e,t,n={}){let[r,i,o]=b5(e,n),s=e=>{let r=e.currentTarget;if(!b7(e)||we.has(e))return;b6.add(r),n.stopPropagation&&we.add(e);let o=t(r,e),s=(e,t)=>{window.removeEventListener("pointerup",a),window.removeEventListener("pointercancel",l),b6.has(r)&&b6.delete(r),b7(e)&&"function"==typeof o&&o(e,{success:t})},a=e=>{s(e,r===window||r===document||n.useGlobalTarget||b4(r,e.target))},l=e=>{s(e,!1)};window.addEventListener("pointerup",a,i),window.addEventListener("pointercancel",l,i)};return r.forEach(e=>{(n.useGlobalTarget?window:e).addEventListener("pointerdown",s,i),xE(e)&&"offsetHeight"in e&&!("ownerSVGElement"in e)&&(e.addEventListener("focus",e=>((e,t)=>{let n=e.currentTarget;if(!n)return;let r=b8(()=>{if(b6.has(n))return;b9(n,"down");let e=b8(()=>{b9(n,"up")});n.addEventListener("keyup",e,t),n.addEventListener("blur",()=>b9(n,"cancel"),t)});n.addEventListener("keydown",r,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",r),t)})(e,i)),xI.has(e.tagName)||!0===e.isContentEditable||e.hasAttribute("tabindex")||(e.tabIndex=0))}),o}(e,(e,t)=>(wt(this.node,t,"Start"),(e,{success:t})=>wt(this.node,e,t?"End":"Cancel")),{useGlobalTarget:t,stopPropagation:n?.tap===!1})}unmount(){}}},focus:{Feature:class extends vr{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch(t){e=!0}e&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){this.isActive&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=vu(xv(this.node.current,"focus",()=>this.onFocus()),xv(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}},hover:{Feature:class extends vr{mount(){let{current:e}=this.node;e&&(this.unmount=function(e,t,n={}){let[r,i,o]=b5(e,n);return r.forEach(e=>{let n,r=!1,o=!1,s=t=>{n&&(n(t),n=void 0),e.removeEventListener("pointerleave",l)},a=e=>{r=!1,window.removeEventListener("pointerup",a),window.removeEventListener("pointercancel",a),o&&(o=!1,s(e))},l=e=>{if("touch"!==e.pointerType){if(r){o=!0;return}s(e)}};e.addEventListener("pointerenter",r=>{if("touch"===r.pointerType||xx.x||xx.y)return;o=!1;let s=t(e,r);"function"==typeof s&&(n=s,e.addEventListener("pointerleave",l,i))},i),e.addEventListener("pointerdown",()=>{r=!0,window.addEventListener("pointerup",a,i),window.addEventListener("pointercancel",a,i)},i)}),o}(e,(e,t)=>(b3(this.node,t,"Start"),e=>b3(this.node,e,"End"))))}unmount(){}}},pan:{Feature:class extends vr{constructor(){super(...arguments),this.removePointerDownListener=gs}onPointerDown(e){this.session=new xH(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:xU(this.node)})}createPanHandlers(){let{onPanSessionStart:e,onPanStart:t,onPan:n,onPanEnd:r}=this.node.getProps();return{onSessionStart:x3(e),onStart:x3(t),onMove:x3(n),onEnd:(e,t)=>{delete this.session,r&&gc.postRender(()=>r(e,t))}}}mount(){this.removePointerDownListener=x$(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}},drag:{Feature:class extends vr{constructor(e){super(e),this.removeGroupControls=gs,this.removeListeners=gs,this.controls=new x1(e)}mount(){let{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||gs}update(){let{dragControls:e}=this.node.getProps(),{dragControls:t}=this.node.prevProps||{};e!==t&&(this.removeGroupControls(),e&&(this.removeGroupControls=e.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}},ProjectionNode:b2,MeasureLayout:x7},layout:{ProjectionNode:b2,MeasureLayout:x7}},(e,t)=>t.isSVG??y$(e)?new yC(t):new yz(t,{allowProjection:e!==T.Fragment})),wl=new Map,wu=(0,T.memo)(({children:e,as:t="p",className:n,duration:r=2,spread:i=2})=>{let o,s=((o=wl.get(t))||(o=wa.create(t),wl.set(t,o)),o),a=(0,T.useMemo)(()=>(e?.length??0)*i,[e,i]);return(0,A.jsx)(s,{animate:{backgroundPosition:"0% center"},className:oG("relative inline-block bg-[length:250%_100%,auto] bg-clip-text text-transparent","[--bg:linear-gradient(90deg,#0000_calc(50%-var(--spread)),var(--color-background),#0000_calc(50%+var(--spread)))] [background-repeat:no-repeat,padding-box]",n),initial:{backgroundPosition:"100% center"},style:{"--spread":`${a}px`,backgroundImage:"var(--bg), linear-gradient(var(--color-muted-foreground), var(--color-muted-foreground))"},transition:{duration:r,ease:"linear",repeat:1/0},children:e})});var wc=e.i(83377);let wd=D("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]]),wh=(0,T.createContext)({autoScroll:!0,isStreaming:!1,output:""}),wf=({className:e,children:t,...n})=>(0,A.jsx)("div",{className:oG("flex items-center justify-between border-zinc-800 border-b px-4 py-2",e),...n,children:t}),wp=({className:e,children:t,...n})=>(0,A.jsxs)("div",{className:oG("flex items-center gap-2 text-sm text-zinc-400",e),...n,children:[(0,A.jsx)(wd,{className:"size-4"}),t??"Terminal"]}),wm=({className:e,children:t,...n})=>{let{isStreaming:r}=(0,T.useContext)(wh);return r?(0,A.jsx)("div",{className:oG("flex items-center gap-2 text-xs text-zinc-400",e),...n,children:t}):null},wg=({className:e,children:t,...n})=>(0,A.jsx)("div",{className:oG("flex items-center gap-1",e),...n,children:t}),wy=({onCopy:e,onError:t,timeout:n=2e3,children:r,className:i,...o})=>{let[s,a]=(0,T.useState)(!1),l=(0,T.useRef)(0),{output:u}=(0,T.useContext)(wh),c=(0,T.useCallback)(async()=>{if(!navigator?.clipboard?.writeText)return void t?.(Error("Clipboard API not available"));try{await navigator.clipboard.writeText(u),a(!0),e?.(),l.current=window.setTimeout(()=>a(!1),n)}catch(e){t?.(e)}},[u,e,t,n]);return(0,T.useEffect)(()=>()=>{window.clearTimeout(l.current)},[]),(0,A.jsx)(oJ,{className:oG("size-7 shrink-0 text-zinc-400 hover:bg-zinc-800 hover:text-zinc-100",i),onClick:c,size:"icon",variant:"ghost",...o,children:r??(0,A.jsx)(s?oY:le,{size:14})})},wv=({children:e,className:t,...n})=>{let{onClear:r}=(0,T.useContext)(wh);return r?(0,A.jsx)(oJ,{className:oG("size-7 shrink-0 text-zinc-400 hover:bg-zinc-800 hover:text-zinc-100",t),onClick:r,size:"icon",variant:"ghost",...n,children:e??(0,A.jsx)(el,{size:14})}):null},wx=({className:e,children:t,...n})=>{let{output:r,isStreaming:i,autoScroll:o}=(0,T.useContext)(wh),s=(0,T.useRef)(null);return(0,T.useEffect)(()=>{o&&s.current&&(s.current.scrollTop=s.current.scrollHeight)},[r,o]),(0,A.jsx)("div",{className:oG("max-h-96 overflow-auto p-4 font-mono text-sm leading-relaxed",e),ref:s,...n,children:t??(0,A.jsxs)("pre",{className:"whitespace-pre-wrap break-words",children:[(0,A.jsx)(wc.default,{children:r}),i&&(0,A.jsx)("span",{className:"ml-0.5 inline-block h-4 w-2 animate-pulse bg-zinc-100"})]})})},wb=({output:e,isStreaming:t=!1,autoScroll:n=!0,onClear:r,className:i,children:o,...s})=>{let a=(0,T.useMemo)(()=>({autoScroll:n,isStreaming:t,onClear:r,output:e}),[n,t,r,e]);return(0,A.jsx)(wh.Provider,{value:a,children:(0,A.jsx)("div",{className:oG("flex flex-col overflow-hidden rounded-lg border bg-zinc-950 text-zinc-100",i),...s,children:o??(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(wf,{children:[(0,A.jsx)(wp,{}),(0,A.jsxs)("div",{className:"flex items-center gap-1",children:[(0,A.jsx)(wm,{}),(0,A.jsxs)(wg,{children:[(0,A.jsx)(wy,{}),r&&(0,A.jsx)(wv,{})]})]})]}),(0,A.jsx)(wx,{})]})})})};var iH=iH;let ww=iW("inline-flex w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-full border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3",{variants:{variant:{default:"bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"bg-destructive text-white focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40 [a&]:hover:bg-destructive/90",outline:"border-border text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground",ghost:"[a&]:hover:bg-accent [a&]:hover:text-accent-foreground",link:"text-primary underline-offset-4 [a&]:hover:underline"}},defaultVariants:{variant:"default"}});function wk({className:e,variant:t="default",asChild:n=!1,...r}){let i=n?iH.Root:"span";return(0,A.jsx)(i,{"data-slot":"badge","data-variant":t,className:oG(ww({variant:t}),e),...r})}var w_=iH,wS=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{let n=(0,w_.createSlot)(`Primitive.${t}`),r=T.forwardRef((e,r)=>{let{asChild:i,...o}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,A.jsx)(i?n:t,{...o,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),wC="Collapsible",[wE,wA]=(0,o0.createContextScope)(wC),[wT,wN]=wE(wC),wj=T.forwardRef((e,t)=>{let{__scopeCollapsible:n,open:r,defaultOpen:i,disabled:o,onOpenChange:s,...a}=e,[l,u]=(0,sw.useControllableState)({prop:r,defaultProp:i??!1,onChange:s,caller:wC});return(0,A.jsx)(wT,{scope:n,disabled:o,contentId:(0,sm.useId)(),open:l,onOpenToggle:T.useCallback(()=>u(e=>!e),[u]),children:(0,A.jsx)(wS.div,{"data-state":wO(l),"data-disabled":o?"":void 0,...a,ref:t})})});wj.displayName=wC;var wP="CollapsibleTrigger",wM=T.forwardRef((e,t)=>{let{__scopeCollapsible:n,...r}=e,i=wN(wP,n);return(0,A.jsx)(wS.button,{type:"button","aria-controls":i.contentId,"aria-expanded":i.open||!1,"data-state":wO(i.open),"data-disabled":i.disabled?"":void 0,disabled:i.disabled,...r,ref:t,onClick:(0,oQ.composeEventHandlers)(e.onClick,i.onOpenToggle)})});wM.displayName=wP;var wD="CollapsibleContent",wR=T.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=wN(wD,e.__scopeCollapsible);return(0,A.jsx)(di.Presence,{present:n||i.open,children:({present:e})=>(0,A.jsx)(wL,{...r,ref:t,present:e})})});wR.displayName=wD;var wL=T.forwardRef((e,t)=>{let{__scopeCollapsible:n,present:r,children:i,...o}=e,s=wN(wD,n),[a,l]=T.useState(r),u=T.useRef(null),c=(0,o1.useComposedRefs)(t,u),d=T.useRef(0),h=d.current,f=T.useRef(0),p=f.current,m=s.open||a,g=T.useRef(m),y=T.useRef(void 0);return T.useEffect(()=>{let e=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,sk.useLayoutEffect)(()=>{let e=u.current;if(e){y.current=y.current||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration="0s",e.style.animationName="none";let t=e.getBoundingClientRect();d.current=t.height,f.current=t.width,g.current||(e.style.transitionDuration=y.current.transitionDuration,e.style.animationName=y.current.animationName),l(r)}},[s.open,r]),(0,A.jsx)(wS.div,{"data-state":wO(s.open),"data-disabled":s.disabled?"":void 0,id:s.contentId,hidden:!m,...o,ref:c,style:{"--radix-collapsible-content-height":h?`${h}px`:void 0,"--radix-collapsible-content-width":p?`${p}px`:void 0,...e.style},children:m&&i})});function wO(e){return e?"open":"closed"}e.s(["Collapsible",0,wj,"CollapsibleContent",0,wR,"CollapsibleTrigger",0,wM,"Content",0,wR,"Root",0,wj,"Trigger",0,wM,"createCollapsibleScope",0,wA],687607);var wI=e.i(687607),wI=wI;function wF({...e}){return(0,A.jsx)(wI.Root,{"data-slot":"collapsible",...e})}function wz({...e}){return(0,A.jsx)(wI.CollapsibleTrigger,{"data-slot":"collapsible-trigger",...e})}function wB({...e}){return(0,A.jsx)(wI.CollapsibleContent,{"data-slot":"collapsible-content",...e})}let w$=D("circle-check-big",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]),wU=D("clock",[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]),wV=D("wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]]),wW=D("circle-x",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]),wH=({className:e,...t})=>(0,A.jsx)(wF,{className:oG("group not-prose mb-4 w-full rounded-md border",e),...t}),wK={"approval-requested":"Awaiting Approval","approval-responded":"Responded","input-available":"Running","input-streaming":"Pending","output-available":"Completed","output-denied":"Denied","output-error":"Error"},wG={"approval-requested":(0,A.jsx)(wU,{className:"size-4 text-yellow-600"}),"approval-responded":(0,A.jsx)(w$,{className:"size-4 text-blue-600"}),"input-available":(0,A.jsx)(wU,{className:"size-4 animate-pulse"}),"input-streaming":(0,A.jsx)(h9,{className:"size-4"}),"output-available":(0,A.jsx)(w$,{className:"size-4 text-green-600"}),"output-denied":(0,A.jsx)(wW,{className:"size-4 text-orange-600"}),"output-error":(0,A.jsx)(wW,{className:"size-4 text-red-600"})},wq=({className:e,title:t,type:n,state:r,toolName:i,...o})=>{let s="dynamic-tool"===n?i:n.split("-").slice(1).join("-");return(0,A.jsxs)(wz,{className:oG("flex w-full items-center justify-between gap-4 p-3",e),...o,children:[(0,A.jsxs)("div",{className:"flex items-center gap-2",children:[(0,A.jsx)(wV,{className:"size-4 text-muted-foreground"}),(0,A.jsx)("span",{className:"font-medium text-sm",children:t??s}),(0,A.jsxs)(wk,{className:"gap-1.5 rounded-full text-xs",variant:"secondary",children:[wG[r],wK[r]]})]}),(0,A.jsx)(oX,{className:"size-4 text-muted-foreground transition-transform group-data-[state=open]:rotate-180"})]})},wJ=({className:e,...t})=>(0,A.jsx)(wB,{className:oG("data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 space-y-4 p-4 text-popover-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in",e),...t}),wY=({className:e,input:t,...n})=>(0,A.jsxs)("div",{className:oG("space-y-2 overflow-hidden",e),...n,children:[(0,A.jsx)("h4",{className:"font-medium text-muted-foreground text-xs uppercase tracking-wide",children:"Parameters"}),(0,A.jsx)("div",{className:"rounded-md bg-muted/50",children:(0,A.jsx)(dr,{code:JSON.stringify(t,null,2),language:"json"})})]}),wX=({className:e,output:t,errorText:n,...r})=>{if(!(t||n))return null;let i=(0,A.jsx)("div",{children:t});return"object"!=typeof t||(0,T.isValidElement)(t)?"string"==typeof t&&(i=(0,A.jsx)(dr,{code:t,language:"json"})):i=(0,A.jsx)(dr,{code:JSON.stringify(t,null,2),language:"json"}),(0,A.jsxs)("div",{className:oG("space-y-2",e),...r,children:[(0,A.jsx)("h4",{className:"font-medium text-muted-foreground text-xs uppercase tracking-wide",children:n?"Error":"Result"}),(0,A.jsxs)("div",{className:oG("overflow-x-auto rounded-md text-xs [&_table]:w-full",n?"bg-destructive/10 text-destructive":"bg-muted/50 text-foreground"),children:[n&&(0,A.jsx)("div",{children:n}),i]})]})},wZ="codex-web-ui-auth-token-v1",wQ="codex-web-ui-auth-unauthorized";async function w0(){return await kh("/api/auth")}async function w1(e){var t;let n=await kf("/api/login",{password:e},{skipAuth:!0});return t=n.token,window.localStorage.setItem(wZ,t),n}async function w2(){await kf("/api/logout",{}).catch(()=>void 0),kv()}async function w5(){return(await kh("/api/status")).status}async function w3(){return(await kf("/api/server/restart",{})).status}async function w4(e,t={}){return(await kf("/api/rpc",{method:e,params:t})).result}async function w6(){return(await kh("/api/client-requests")).requests}async function w8(){return(await kh("/api/mcp/servers")).mcp}async function w9(e){let t={name:e.name,url:e.url};return(await kf("/api/mcp/servers",t)).mcp}async function w7(e){return kf("/api/mcp/servers/oauth/login",{name:e})}async function ke(){return(await kf("/api/mcp/servers/reload",{})).mcp}async function kt(e,t){await kf("/api/client-requests/respond",{id:e,result:t})}async function kn(e){let t=e?`?path=${encodeURIComponent(e)}`:"";return(await kh(`/api/repositories/browse${t}`)).browser}async function kr(e={}){let t=new URLSearchParams;e.cwd&&t.set("cwd",e.cwd),e.path&&t.set("path",e.path);let n=t.toString()?`?${t.toString()}`:"";return(await kh(`/api/files/explore${n}`)).explorer}async function ki(){return(await kh("/api/skills")).skills}async function ko(e,t){return(await kf("/api/repositories/create",{parentPath:e,name:t})).browser}async function ks(e){let t=await fetch("/api/uploads",{method:"POST",headers:{...ky(),"Content-Type":e.type||"application/octet-stream","X-File-Name":encodeURIComponent(e.name)},body:e});return(await kp(t)).attachment}async function ka(e){let t=await fetch("/api/transcribe",{method:"POST",headers:{...ky(),"Content-Type":e.type||"audio/webm","X-File-Name":encodeURIComponent(e.name)},body:e});return(await kp(t)).transcript}async function kl(e){return(await kh(kd("/api/files/view",e))).file}async function ku(e,t=!1){let n=await fetch(kd(t?"/api/files/raw":"/api/files/download",e),{cache:"no-store",headers:ky()});return await km(n),n.blob()}async function kc(e,t){let n=await ku(e),r=URL.createObjectURL(n),i=document.createElement("a");i.href=r,i.download=t,document.body.append(i),i.click(),i.remove(),URL.revokeObjectURL(r)}function kd(e,t){let n=new URLSearchParams({path:t.path});return t.cwd&&n.set("cwd",t.cwd),`${e}?${n.toString()}`}async function kh(e){return kp(await fetch(e,{cache:"no-store",headers:ky()}))}async function kf(e,t,n={}){return kp(await fetch(e,{method:"POST",headers:{...!n.skipAuth?ky():{},"Content-Type":"application/json"},body:JSON.stringify(t)}))}async function kp(e){return await km(e),e.json()}async function km(e){if(401===e.status&&(kv(),window.dispatchEvent(new Event(wQ))),e.ok)return;let t=await e.json().catch(()=>({})),n=Error(t.error||`Request failed: ${e.status}`);throw n.data=t.data,n}async function kg(e,t,n,r){try{let t=await fetch("/api/events",{headers:ky(),signal:e.signal});if(await km(t),!t.body)throw Error("Event stream response did not include a body.");let i=t.body.pipeThrough(new TextDecoderStream).getReader(),o="";for(;!e.signal.aborted;){let{done:e,value:t}=await i.read();if(e)break;let s=(o+=t).split(/\r?\n\r?\n/);for(let e of(o=s.pop()??"",s))!function(e,t,n){let r="message",i=[];for(let t of e.split(/\r?\n/))t.startsWith("event:")?r=t.slice(6).trim():t.startsWith("data:")&&i.push(t.slice(5).trimStart());if(!i.length)return;let o=i.join("\n");if("hello"===r)return n(JSON.parse(o).history??[]);t(JSON.parse(o))}(e,n,r)}}catch(n){e.signal.aborted||t.onerror?.()}}function ky(){let e=window.localStorage.getItem(wZ)||"";return e?{Authorization:`Bearer ${e}`}:{}}function kv(){window.localStorage.removeItem(wZ)}let kx=(0,T.createContext)(null);function kb(){let e=(0,T.useContext)(kx);return null==e&&function(...e){let t=new URL("https://lexical.dev/docs/error"),n=new URLSearchParams;for(let t of(n.append("code",8),e))n.append("v",t);throw t.search=n.toString(),Error(`Minified Lexical error #8; visit ${t.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(),e}function kw(e,...t){let n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;for(let n of(r.append("code",e),t))r.append("v",n);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function kk(e,...t){let n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;for(let n of(r.append("code",e),t))r.append("v",n);n.search=r.toString(),console.warn(`Minified Lexical warning #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}let k_="u">typeof window&&void 0!==window.document&&void 0!==window.document.createElement,kS=k_&&"documentMode"in document?document.documentMode:null,kC=k_&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),kE=k_&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),kA=!(!k_||!("InputEvent"in window)||kS)&&"getTargetRanges"in new window.InputEvent("input"),kT=k_&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,kN=k_&&/Android/.test(navigator.userAgent),kj=k_&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent)&&!kN,kP=k_&&/^(?=.*Chrome).*/i.test(navigator.userAgent),kM=k_&&kN&&kP,kD=k_&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&kC&&!kP,kR=kj||kT||kD?" ":"",kL=kE?" ":kR,kO="֑-߿יִ-﷽ﹰ-ﻼ",kI="A-Za-zÀ-ÖØ-öø-ʸ̀-ࠀ-Ⰰ-︀--",kF=(RegExp("^[^"+kI+"]*["+kO+"]"),RegExp("^[^"+kO+"]*["+kI+"]"),{bold:1,capitalize:1024,code:16,highlight:128,italic:2,lowercase:256,strikethrough:4,subscript:32,superscript:64,underline:8,uppercase:512}),kz={directionless:1,unmergeable:2},kB={center:2,end:6,justify:4,left:1,right:3,start:5},k$={2:"center",6:"end",4:"justify",1:"left",3:"right",5:"start"},kU={normal:0,segmented:2,token:1},kV={0:"normal",2:"segmented",1:"token"},kW="$config";class kH{_front=new Set;_back=new Set;_cache;get size(){return this._front.size+this._back.size}addBack(e){return delete this._cache,this._front.has(e)||this._back.add(e),this}addFront(e){return delete this._cache,this._back.has(e)||this._front.add(e),this}delete(e){return delete this._cache,this._front.delete(e)||this._back.delete(e)}toArray(){let e=Array.from(this._front).reverse();for(let t of this._back)e.push(t);return e}toReadonlyArray(){return this._cache=this._cache||this.toArray(),this._cache}[Symbol.iterator](){return this.toReadonlyArray()[Symbol.iterator]()}}let kK=!1,kG=0;function kq(e){kG=e.timeStamp}function kJ(e,t,n){let r="BR"===e.nodeName,i=t.__lexicalLineBreak;return i&&(e===i||r&&e.previousSibling===i)||r&&void 0!==At(e,n)}function kY(e,t,n){kK=!0;let r=performance.now()-kG>100;try{Ev(e,()=>{let i=CJ()||e.getEditorState().read(()=>{let e=CJ();return null!==e?e.clone():null}),o=new Map,s=e.getRootElement(),a=e._editorState,l=e._blockCursorElement,u=!1,c="";for(let n=0;n<t.length;n++){let d=t[n],h=d.type,f=d.target,p=function(e,t,n,r){var i;for(let o=e;o&&(i=o,!0!==i.__lexicalUnmanaged);o=AT(o)){let e=At(o,t);if(void 0!==e){let t=E7(e,n);if(t)return EC(t)||!A$(o)?void 0:[o,t]}else if(o===r)return[r,As(n)]}}(f,e,a,s);if(!p)continue;let[m,g]=p;if("characterData"===h)r&&Ck(g)&&E0(f)&&function(e,t,n){if(CM(e)){let t=e.anchor.getNode();if(t.is(n)&&e.format!==t.getFormat())return!1}return E0(t)&&n.isAttached()}(i,f,g)&&function(e,t,n){let r=AB(AD(n)),i=null,o=null;null!==r&&r.anchorNode===e&&(i=r.anchorOffset,o=r.focusOffset);let s=e.nodeValue;null!==s&&Ap(t,s,i,o,!1)}(f,g,e);else if("childList"===h){u=!0;let t=d.addedNodes;for(let n=0;n<t.length;n++){let r=t[n],i=Ae(r),o=r.parentNode;if(null!=o&&r!==l&&null===i&&!kJ(r,o,e)){if(kE){let e=(A$(r)?r.innerText:null)||r.nodeValue;e&&(c+=e)}o.removeChild(r)}}let n=d.removedNodes,r=n.length;if(r>0){let t=0;for(let i=0;i<r;i++){let r=n[i];(kJ(r,f,e)||l===r)&&(f.appendChild(r),t++)}r!==t&&o.set(m,g)}}}if(o.size>0)for(let[t,n]of o)n.reconcileObservedMutation(t,e);let d=n.takeRecords();if(d.length>0){for(let t=0;t<d.length;t++){let n=d[t],r=n.addedNodes,i=n.target;for(let t=0;t<r.length;t++){let n=r[t],o=n.parentNode;null==o||"BR"!==n.nodeName||kJ(n,i,e)||o.removeChild(n)}}n.takeRecords()}null!==i&&(u&&Aa(i),kE&&AC(e)&&i.insertRawText(c))})}finally{kK=!1}}function kX(e){let t=e._observer;null!==t&&kY(e,t.takeRecords(),t)}function kZ(e){0===kG&&AD(e).addEventListener("textInput",kq,!0),e._observer=new MutationObserver((t,n)=>{kY(e,t,n)})}class kQ{key;parse;unparse;isEqual;defaultValue;resetOnCopyNode;constructor(e,t){this.key=e,this.parse=t.parse.bind(t),this.unparse=(t.unparse||k3).bind(t),this.isEqual=(t.isEqual||Object.is).bind(t),this.defaultValue=this.parse(void 0),this.resetOnCopyNode=t.resetOnCopyNode||!1}}class k0{node;knownState;unknownState;sharedNodeState;size;constructor(e,t,n,r=new Map,i){this.node=e,this.sharedNodeState=t,this.unknownState=n,this.knownState=r;const{sharedConfigMap:o}=this.sharedNodeState,s=void 0!==i?i:function(e,t,n){let r=n.size;if(t)for(let i in t){let t=e.get(i);t&&n.has(t)||r++}return r}(o,n,r);this.size=s}getValue(e){let t=this.knownState.get(e);if(void 0!==t)return t;this.sharedNodeState.sharedConfigMap.set(e.key,e);let n=e.defaultValue;if(this.unknownState&&e.key in this.unknownState){let t=this.unknownState[e.key];void 0!==t&&(n=e.parse(t)),this.updateFromKnown(e,n)}return n}getInternalState(){return[this.unknownState,this.knownState]}toJSON(){let e={...this.unknownState},t={};for(let[t,n]of this.knownState)t.isEqual(n,t.defaultValue)?delete e[t.key]:e[t.key]=t.unparse(n);for(let n of this.sharedNodeState.flatKeys)n in e&&(t[n]=e[n],delete e[n]);return k5(e)&&(t.$=e),t}getWritable(e){if(this.node===e)return this;let{sharedNodeState:t,unknownState:n}=this,r=new Map(this.knownState);return new k0(e,t,function(e,t,n){let r;if(n)for(let[i,o]of Object.entries(n)){let n=e.get(i);n?t.has(n)||t.set(n,n.parse(o)):(r=r||{})[i]=o}return r}(t.sharedConfigMap,r,n),r,this.size)}resetOnCopyNode(){for(let e of this.knownState.keys())e.resetOnCopyNode&&this.knownState.set(e,e.defaultValue);return this}updateFromKnown(e,t){let n=e.key;this.sharedNodeState.sharedConfigMap.set(n,e);let{knownState:r,unknownState:i}=this;r.has(e)||i&&n in i||(i&&(delete i[n],this.unknownState=k5(i)),this.size++),r.set(e,t)}updateFromUnknown(e,t){let n=this.sharedNodeState.sharedConfigMap.get(e);n?this.updateFromKnown(n,n.parse(t)):(this.unknownState=this.unknownState||{},e in this.unknownState||this.size++,this.unknownState[e]=t)}updateFromJSON(e){let{knownState:t}=this;for(let e of t.keys())t.set(e,e.defaultValue);if(this.size=t.size,this.unknownState=void 0,e)for(let[t,n]of Object.entries(e))this.updateFromUnknown(t,n)}}function k1(e){let t=e.getWritable(),n=t.__state?t.__state.getWritable(t):new k0(t,k2(t));return t.__state=n,n}function k2(e){return e.__state?e.__state.sharedNodeState:EW(AG(),e.getType()).sharedNodeState}function k5(e){if(e)for(let t in e)return e}function k3(e){return e}function k4(e,t,n){for(let[r,i]of t.knownState){if(e.has(r.key))continue;e.add(r.key);let t=n?n.getValue(r):r.defaultValue;if(t!==i&&!r.isEqual(t,i))return!0}return!1}function k6(e,t,n){let{unknownState:r}=t,i=n?n.unknownState:void 0;if(r){for(let[t,n]of Object.entries(r))if(!e.has(t)&&(e.add(t),n!==(i?i[t]:void 0)))return!0}return!1}function k8(e,t){let n=e.__state;return n&&n.node===e?n.getWritable(t):n}function k9(e,t){let n=e.__mode,r=e.__format,i=e.__style,o=t.__mode,s=t.__format,a=t.__style,l=e.__state,u=t.__state;return(null===n||n===o)&&(null===r||r===s)&&(null===i||i===a)&&(null===e.__state||l===u||function(e,t){if(e===t)return!0;let n=new Set;return!(e&&k4(n,e,t)||t&&k4(n,t,e)||e&&k6(n,e,t)||t&&k6(n,t,e))}(l,u))}function k7(e,t){let n=e.mergeWithSibling(t),r=Es()._normalizedNodes;return r.add(e.__key),r.add(t.__key),n}function _e(e){let t,n,r=e;if(""!==r.__text||!r.isSimpleText()||r.isUnmergeable()){for(;null!==(t=r.getPreviousSibling())&&Ck(t)&&t.isSimpleText()&&!t.isUnmergeable();){if(""!==t.__text){k9(t,r)&&(r=k7(t,r));break}t.remove()}for(;null!==(n=r.getNextSibling())&&Ck(n)&&n.isSimpleText()&&!n.isUnmergeable();){if(""!==n.__text){k9(r,n)&&(r=k7(r,n));break}n.remove()}}else r.remove()}function _t(e){return _n(e.anchor),_n(e.focus),e}function _n(e){for(;"element"===e.type;){let t,n,r=e.getNode(),i=e.offset;if(i===r.getChildrenSize()?(t=r.getChildAtIndex(i-1),n=!0):(t=r.getChildAtIndex(i),n=!1),Ck(t)){e.set(t.__key,n?t.getTextContentSize():0,"text",!0);break}if(!Ek(t))break;e.set(t.__key,n?t.getChildrenSize():0,"element",!0)}}let _r,_i,_o,_s,_a,_l,_u,_c,_d,_h,_f,_p="",_m=null,_g=null,_y=!1,_v=!1;function _x(e,t){let n=_u.get(e);if(null!==t){let n=_M(e);n.parentNode===t&&t.removeChild(n)}if(_c.has(e)||_i._keyToDOMMap.delete(e),Ek(n)){let e=A5(n,_u);_b(e,0,e.length-1,null)}void 0!==n&&Ak(_h,_o,_s,n,"destroyed")}function _b(e,t,n,r){for(let i=t;i<=n;++i){let t=e[i];void 0!==t&&_x(t,r)}}function _w(e,t){e.setProperty("text-align",t)}function _k(e,t){let n=_r.theme.indent;if("string"==typeof n){let r=e.classList.contains(n);t>0&&!r?e.classList.add(n):t<1&&r&&e.classList.remove(n)}if(0===t)return void e.style.setProperty("padding-inline-start","");let r=getComputedStyle(_i._rootElement||e).getPropertyValue("--lexical-indent-base-value")||"40px";e.style.setProperty("padding-inline-start",`calc(${t} * ${r})`)}function __(e,t){let n=e.style;0===t?_w(n,""):1===t?_w(n,"left"):2===t?_w(n,"center"):3===t?_w(n,"right"):4===t?_w(n,"justify"):5===t?_w(n,"start"):6===t&&_w(n,"end")}function _S(e,t){let n=function(e){let t=e.__dir;if(null!==t)return t;if(EA(e))return null;let n=e.getParentOrThrow();return EA(n)&&null===n.__dir?"auto":null}(t);null!==n?e.dir=n:e.removeAttribute("dir")}function _C(e,t){var n;let r,i=_c.get(e);void 0===i&&kw(60);let o=_f.$createDOM(i,_i);if(r=(n=_i)._keyToDOMMap,o[`__lexicalKey_${n._key}`]=e,r.set(e,o),Ck(i)?o.setAttribute("data-lexical-text","true"):EC(i)&&o.setAttribute("data-lexical-decorator","true"),Ek(i)){let e=i.__indent,t=i.__size;_S(o,i),0!==e&&_k(o,e),0!==t&&_E(A5(i,_c),i,0,t-1,_f.$getDOMSlot(i,o,_i));let n=i.__format;0!==n&&__(o,n),i.isInline()||_T(null,i,o)}else{let t=i.getTextContent();if(EC(i)){let t=i.decorate(_i,_r);null!==t&&_N(e,t),o.contentEditable="false"}_p+=t}return null!==t&&t.insertChild(o),_f.$decorateDOM(i,null,o,_i),Ak(_h,_o,_s,i,"created"),o}function _E(e,t,n,r,i){let o=_p;_p="";let s=n;for(;s<=r;++s){_C(e[s],i);let t=_c.get(e[s]);null!==t&&Ck(t)?null===_m&&(_m=t.getFormat(),_g=t.getStyle()):Ek(t)&&s<r&&!t.isInline()&&(_p+="\n\n")}i.element.__lexicalTextContent=_p,_p=o+_p}function _A(e,t){if(e){let n=e.__last;if(n){let e=t.get(n);if(e)return Co(e)?"line-break":EC(e)&&e.isInline()?"decorator":null}return"empty"}return null}function _T(e,t,n){let r=_A(e,_u),i=_A(t,_c);r!==i&&_f.$getDOMSlot(t,n,_i).setManagedLineBreak(i)}function _N(e,t){let n=_i._pendingDecorators,r=_i._decorators;if(null===n){if(r[e]===t)return;n=Ar(_i)}n[e]=t}function _j(e){let t=e.nextSibling;return null!==t&&t===_i._blockCursorElement&&(t=t.nextSibling),t}function _P(e,t){let n=new Set;for(let r=t;r<e.length;r++)n.add(e[r]);return n}function _M(e){let t=_d.get(e);return void 0===t&&kw(75,e),t}function _D(e){return{type:e}}let _R=_D("SELECTION_CHANGE_COMMAND"),_L=_D("SELECTION_INSERT_CLIPBOARD_NODES_COMMAND"),_O=_D("CLICK_COMMAND"),_I=_D("BEFORE_INPUT_COMMAND"),_F=_D("INPUT_COMMAND"),_z=_D("COMPOSITION_START_COMMAND"),_B=_D("COMPOSITION_END_COMMAND"),_$=_D("DELETE_CHARACTER_COMMAND"),_U=_D("INSERT_LINE_BREAK_COMMAND"),_V=_D("INSERT_PARAGRAPH_COMMAND"),_W=_D("CONTROLLED_TEXT_INSERTION_COMMAND"),_H=_D("PASTE_COMMAND"),_K=_D("REMOVE_TEXT_COMMAND"),_G=_D("DELETE_WORD_COMMAND"),_q=_D("DELETE_LINE_COMMAND"),_J=_D("FORMAT_TEXT_COMMAND"),_Y=_D("UNDO_COMMAND"),_X=_D("REDO_COMMAND"),_Z=_D("KEYDOWN_COMMAND"),_Q=_D("KEY_ARROW_RIGHT_COMMAND"),_0=_D("MOVE_TO_END"),_1=_D("KEY_ARROW_LEFT_COMMAND"),_2=_D("MOVE_TO_START"),_5=_D("KEY_ARROW_UP_COMMAND"),_3=_D("KEY_ARROW_DOWN_COMMAND"),_4=_D("KEY_ENTER_COMMAND"),_6=_D("KEY_SPACE_COMMAND"),_8=_D("KEY_BACKSPACE_COMMAND"),_9=_D("KEY_ESCAPE_COMMAND"),_7=_D("KEY_DELETE_COMMAND"),Se=_D("KEY_TAB_COMMAND"),St=_D("INSERT_TAB_COMMAND"),Sn=_D("INDENT_CONTENT_COMMAND"),Sr=_D("OUTDENT_CONTENT_COMMAND"),Si=_D("DROP_COMMAND"),So=_D("FORMAT_ELEMENT_COMMAND"),Ss=_D("DRAGSTART_COMMAND"),Sa=_D("DRAGOVER_COMMAND"),Sl=_D("DRAGEND_COMMAND"),Su=_D("COPY_COMMAND"),Sc=_D("CUT_COMMAND"),Sd=_D("SELECT_ALL_COMMAND"),Sh=_D("CLEAR_EDITOR_COMMAND"),Sf=_D("CLEAR_HISTORY_COMMAND"),Sp=_D("CAN_REDO_COMMAND"),Sm=_D("CAN_UNDO_COMMAND"),Sg=_D("FOCUS_COMMAND"),Sy=_D("BLUR_COMMAND"),Sv=_D("KEY_MODIFIER_COMMAND"),Sx=Object.freeze({}),Sb=[["keydown",function(e,t){Sw=e.timeStamp,Sk=e.key,t.isComposing()||AE(t,_Z,e)}],["pointerdown",function(e,t){let n=e.target,r=e.pointerType;AU(n)&&"touch"!==r&&"pen"!==r&&0===e.button&&Ev(t,()=>{EC(An(n))||(ST=!0)})}],["compositionstart",function(e,t){AE(t,_z,e)}],["compositionend",function(e,t){kE?Sj=!0:!kT&&(kj||kD)?(SP=!0,SM=e.data):AE(t,_B,e)}],["input",function(e,t){e.stopPropagation(),Ev(t,()=>{t.dispatchCommand(_F,e)},{event:e}),SS=null}],["click",function(e,t){Ev(t,()=>{let n=CJ(),r=AB(AD(t)),i=CY();if(r){if(CM(n)){let t=n.anchor,o=t.getNode();if("element"===t.type&&0===t.offset&&n.isCollapsed()&&!EA(o)&&1===Ao().getChildrenSize()&&o.getTopLevelElementOrThrow().isEmpty()&&null!==i&&n.is(i))r.removeAllRanges(),n.dirty=!0;else if(3===e.detail&&!n.isCollapsed()&&o!==n.focus.getNode()){let e=A2(o,e=>Ek(e)&&!e.isInline());Ek(e)&&e.select(0)}}else if("touch"===e.pointerType||"pen"===e.pointerType){let n=r.anchorNode;(A$(n)||E0(n))&&Aa(Cq(i,r,t,e))}}AE(t,_O,e)})}],["cut",Sx],["copy",Sx],["dragstart",Sx],["dragover",Sx],["dragend",Sx],["paste",Sx],["focus",Sx],["blur",Sx],["drop",Sx]];kA&&Sb.push(["beforeinput",(e,t)=>{let n;"deleteCompositionText"===(n=e.inputType)||kE&&AC(t)||"insertCompositionText"!==n&&AE(t,_I,e)}]);let Sw=0,Sk=null,S_=0,SS=null,SC=new WeakMap,SE=new WeakMap,SA=!1,ST=!1,SN=!1,Sj=!1,SP=!1,SM="",SD=null,SR=[0,"",0,"root",0];function SL(e,t,n,r,i){let o=e.anchor,s=e.focus,a=o.getNode(),l=Es(),u=AB(AD(l)),c=null!==u?u.anchorNode:null,d=o.key,h=l.getElementByKey(d),f=n.length;return d!==s.key||!Ck(a)||(!i&&(!kA||S_<r+50)||a.isDirty()&&f<2||Au(n))&&o.offset!==s.offset&&!a.isComposing()||EQ(a)||a.isDirty()&&f>1||(i||!kA)&&null!==h&&!a.isComposing()&&c!==E2(h)||null!==u&&null!==t&&(!t.collapsed||t.startContainer!==u.anchorNode||t.startOffset!==u.anchorOffset)||!a.isComposing()&&(a.getFormat()!==e.format||a.getStyle()!==e.style)||function(e,t){let n;if(t.isSegmented())return!0;if(!e.isCollapsed())return!1;let r=e.anchor.offset,i=t.getParentOrThrow(),o=EZ(t);return 0===r?!t.canInsertTextBefore()||!i.canInsertTextBefore()&&!t.isComposing()||o||(Ck(n=t.getPreviousSibling())||Ek(n)&&n.isInline())&&!n.canInsertTextAfter():r===t.getTextContentSize()&&(!t.canInsertTextAfter()||!i.canInsertTextAfter()&&!t.isComposing()||o)}(e,a)}function SO(e,t){return E0(e)&&null!==e.nodeValue&&0!==t&&t!==e.nodeValue.length}function SI(e,t,n){let{anchorNode:r,anchorOffset:i,focusNode:o,focusOffset:s}=e;SA&&(SA=!1,SO(r,i)&&SO(o,s)&&!SD)||Ev(t,()=>{if(!n)return void Aa(null);if(!Eq(t,r,o))return;let a=CJ();if(SD&&CM(a)&&a.isCollapsed()){let e=a.anchor,t=SD.anchor;(e.key===t.key&&e.offset===t.offset+1||1===e.offset&&t.getNode().is(e.getNode().getPreviousSibling()))&&Aa(a=SD.clone())}if(SD=null,CM(a)){let n=a.anchor,r=n.getNode();if(a.isCollapsed()){"Range"===e.type&&e.anchorNode===e.focusNode&&(a.dirty=!0);let i=AD(t).event,o=i?i.timeStamp:performance.now(),[s,l,u,c,d]=SR,h=Ao(),f=!1===t.isComposing()&&""===h.getTextContent();if(o<d+200&&n.offset===u&&n.key===c)SF(a,s,l);else if("text"===n.type)Ck(r)||kw(141),Sz(a,r);else if("element"===n.type&&!f){Ek(r)||kw(259);let e=n.getNode();e.isEmpty()?SF(a,e.getTextFormat(),e.getTextStyle()):SF(a,a.format,"")}}else{let e=n.key,t=a.focus.key,r=a.getNodes(),o=r.length,l=a.isBackward(),u=l?s:i,c=l?i:s,d=l?t:e,h=l?e:t,f=2047,p=!1;for(let e=0;e<o;e++){let t=r[e],n=t.getTextContentSize();if(Ck(t)&&0!==n&&(0!==e||t.__key!==d||u!==n)&&(e!==o-1||t.__key!==h||0!==c)&&(p=!0,0==(f&=t.getFormat())))break}a.format=p?f:0}}AE(t,_R,void 0)})}function SF(e,t,n){e.format===t&&e.style===n||(e.format=t,e.style=n,e.dirty=!0)}function Sz(e,t){SF(e,t.getFormat(),t.getStyle())}function SB(e){if(!e.getTargetRanges)return null;let t=e.getTargetRanges();return 0===t.length?null:t[0]}function S$(e){var t;let n=e.inputType,r=SB(e),i=Es(),o=CJ();if("deleteContentBackward"===n){if(null===o){let e=CY();if(!CM(e))return!0;Aa(e.clone())}if(CM(o)){let n=o.anchor.key===o.focus.key;if(t=e.timeStamp,"MediaLast"===Sk&&t<Sw+30&&i.isComposing()&&n){if(E8(null),Sw=0,setTimeout(()=>{Ev(i,()=>{E8(null)})},30),CM(o)){let e=o.anchor.getNode();e.markDirty(),Ck(e)||kw(142),Sz(o,e)}}else{E8(null),e.preventDefault();let t=o.anchor.getNode(),r=t.getTextContent(),s=t.canInsertTextAfter(),a=0===o.anchor.offset&&o.focus.offset===r.length,l=kM&&n&&!a&&s;if(l&&o.isCollapsed()&&(l=!EC(AS(o.anchor,!0))),!l){AE(i,_$,!0);let e=CJ();kM&&CM(e)&&e.isCollapsed()&&(SD=e,setTimeout(()=>SD=null))}}return!0}}if(!CM(o))return!0;let s=e.data;null!==SS&&Af(!1,i,SS),o.dirty&&null===SS||!o.isCollapsed()||EA(o.anchor.getNode())||null===r||o.applyDOMRange(r),SS=null;let a=o.anchor,l=o.focus,u=a.getNode(),c=l.getNode();if("insertText"===n||"insertTranspose"===n){if("\n"===s)e.preventDefault(),AE(i,_U,!1);else if("\n\n"===s)e.preventDefault(),AE(i,_V,void 0);else if(null==s&&e.dataTransfer){let t=e.dataTransfer.getData("text/plain");e.preventDefault(),o.insertRawText(t)}else null!=s&&SL(o,r,s,e.timeStamp,!0)?(e.preventDefault(),AE(i,_W,s)):SS=s;return S_=e.timeStamp,!0}switch(e.preventDefault(),n){case"insertFromYank":case"insertFromDrop":case"insertReplacementText":AE(i,_W,e);break;case"insertFromComposition":E8(null),AE(i,_W,e);break;case"insertLineBreak":E8(null),AE(i,_U,!1);break;case"insertParagraph":E8(null),SN&&!kT?(SN=!1,AE(i,_U,!1)):AE(i,_V,void 0);break;case"insertFromPaste":case"insertFromPasteAsQuotation":AE(i,_H,e);break;case"deleteByComposition":(u!==c||Ek(u)||Ek(c)||!EZ(u)||!EZ(c))&&AE(i,_K,e);break;case"deleteByDrag":Aj(S6),AE(i,_K,e);break;case"deleteByCut":AE(i,_K,e);break;case"deleteContent":AE(i,_$,!1);break;case"deleteWordBackward":AE(i,_G,!0);break;case"deleteWordForward":AE(i,_G,!1);break;case"deleteHardLineBackward":case"deleteSoftLineBackward":AE(i,_q,!0);break;case"deleteContentForward":case"deleteHardLineForward":case"deleteSoftLineForward":AE(i,_q,!1);break;case"formatStrikeThrough":AE(i,_J,"strikethrough");break;case"formatBold":AE(i,_J,"bold");break;case"formatItalic":AE(i,_J,"italic");break;case"formatUnderline":AE(i,_J,"underline");break;case"historyUndo":AE(i,_Y,void 0);break;case"historyRedo":AE(i,_X,void 0)}return!0}function SU(e){if(A$(e.target)&&EC(An(e.target)))return!0;let t=Es(),n=CJ(),r=e.data,i=SB(e);if(null!=r&&CM(n)&&SL(n,i,r,e.timeStamp,!1)){Sj&&(SH(t,r),Sj=!1);let i=n.anchor.getNode(),o=AB(AD(t));if(null===o)return!0;let s=n.isBackward(),a=s?n.anchor.offset:n.focus.offset,l=s?n.focus.offset:n.anchor.offset;kA&&!n.isCollapsed()&&Ck(i)&&null!==o.anchorNode&&i.getTextContent().slice(0,a)+r+i.getTextContent().slice(a+l)===Ah(o.anchorNode)||AE(t,_W,r);let u=r.length;kE&&u>1&&"insertCompositionText"===e.inputType&&!t.isComposing()&&(n.anchor.offset-=u),kM&&t.isComposing()&&(Sw=0,E8(null))}else Af(!1,t,null!==r?r:void 0),Sj&&(SH(t,r||void 0),Sj=!1);return Er(),kX(Es()),!0}function SV(e){let t=Es(),n=CJ();if(CM(n)&&!t.isComposing()){let r=n.anchor,i=n.anchor.getNode();E8(r.key),Aj(S8),(e.timeStamp<Sw+30||"element"===r.type||!n.isCollapsed()||i.getFormat()!==n.format||Ck(i)&&i.getStyle()!==n.style)&&AE(t,_W,kL)}return!0}function SW(e){return SH(Es(),e.data),Aj(S9),!0}function SH(e,t){let n=e._compositionKey;if(E8(null),null!==n&&null!=t){if(""===t){let t=E7(n),r=E2(e.getElementByKey(n));if(null!==r&&null!==r.nodeValue&&Ck(t)){let n=AB(AD(e)),i=null,o=null;null!==n&&n.anchorNode===r&&(i=n.anchorOffset,o=n.focusOffset),Ap(t,r.nodeValue,i,o,!0)}return}if("\n"===t[t.length-1]){let t=CJ();if(CM(t)||CR(t)){if(CM(t)){let e=t.focus;t.anchor.set(e.key,e.offset,e.type)}return void AE(e,_4,null)}}}Af(!0,e,t)}function SK(e){let t=Es();if(null==e.key)return!0;if(SP){if(Ab(e))return Ev(t,()=>{SH(t,SM)}),SP=!1,SM="",!0;SP=!1,SM=""}if(Ay(e,"ArrowRight",{shiftKey:"any"}))AE(t,_Q,e);else if(Ay(e,"ArrowRight",Av))AE(t,_0,e);else if(Ay(e,"ArrowLeft",{shiftKey:"any"}))AE(t,_1,e);else if(Ay(e,"ArrowLeft",Av))AE(t,_2,e);else if(Ay(e,"ArrowUp",{altKey:"any",shiftKey:"any"}))AE(t,_5,e);else if(Ay(e,"ArrowDown",{altKey:"any",shiftKey:"any"}))AE(t,_3,e);else if(Ay(e,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any",shiftKey:!0}))SN=!0,AE(t,_4,e);else if(" "===e.key)AE(t,_6,e);else if(kC&&Ay(e,"o",{ctrlKey:!0}))e.preventDefault(),SN=!0,AE(t,_U,!0);else if(Ay(e,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any"}))SN=!1,AE(t,_4,e);else if(Ay(e,"Backspace",{shiftKey:"any"})||kC&&Ay(e,"h",{ctrlKey:!0}))Ab(e)?AE(t,_8,e):(e.preventDefault(),AE(t,_$,!0));else if("Escape"===e.key)AE(t,_9,e);else if(Ay(e,"Delete",{})||kC&&Ay(e,"d",{ctrlKey:!0}))"Delete"!==e.key?(e.preventDefault(),AE(t,_$,!1)):AE(t,_7,e);else if(Ay(e,"Backspace",Ax))e.preventDefault(),AE(t,_G,!0);else if(Ay(e,"Delete",Ax))e.preventDefault(),AE(t,_G,!1);else if(kC&&Ay(e,"Backspace",{metaKey:!0}))e.preventDefault(),AE(t,_q,!0);else if(kC&&(Ay(e,"Delete",{metaKey:!0})||Ay(e,"k",{ctrlKey:!0})))e.preventDefault(),AE(t,_q,!1);else if(Ay(e,"b",Av))e.preventDefault(),AE(t,_J,"bold");else if(Ay(e,"u",Av))e.preventDefault(),AE(t,_J,"underline");else if(Ay(e,"i",Av))e.preventDefault(),AE(t,_J,"italic");else if(Ay(e,"Tab",{shiftKey:"any"}))AE(t,Se,e);else if(Ay(e,"z",Av))e.preventDefault(),AE(t,_Y,void 0);else if(kC?Ay(e,"z",{metaKey:!0,shiftKey:!0}):Ay(e,"y",{ctrlKey:!0})||Ay(e,"z",{ctrlKey:!0,shiftKey:!0}))e.preventDefault(),AE(t,_X,void 0);else{let n=t._editorState._selection;null===n||CM(n)?Ay(e,"a",Av)&&(e.preventDefault(),AE(t,Sd,e)):Ay(e,"c",Av)?(e.preventDefault(),AE(t,Su,e)):Ay(e,"x",Av)?(e.preventDefault(),AE(t,Sc,e)):Ay(e,"a",Av)&&(e.preventDefault(),AE(t,Sd,e))}return(e.ctrlKey||e.shiftKey||e.altKey||e.metaKey)&&t.dispatchCommand(Sv,e),!0}function SG(e){let t=e.__lexicalEventHandles;return void 0===t&&(e.__lexicalEventHandles=t=[]),t}let Sq=new Map;function SJ(e){let t,n=(t=AM(e.target))?t.getSelection():null;if(null===n)return;let r=EY(n.anchorNode);if(null===r)return;ST&&(ST=!1,Ev(r,()=>{let t=CY(),i=n.anchorNode;(A$(i)||E0(i))&&Aa(Cq(t,n,r,e))}));let i=Ac(r),o=i[i.length-1],s=o._key,a=Sq.get(s),l=a||o;l!==r&&SI(n,l,!1),SI(n,r,!0),r!==o?Sq.set(s,r):a&&Sq.delete(s)}function SY(e){e._lexicalHandled=!0}function SX(e){return!0===e._lexicalHandled}let SZ=()=>{};function SQ(e,t,n){Er();let r=e.__key,i=e.getParent();if(null===i)return;let o=function(e){let t=CJ();if(!CM(t)||!Ek(e))return t;let{anchor:n,focus:r}=t,i=n.getNode(),o=r.getNode();return AP(i,e)&&n.set(e.__key,0,"element"),AP(o,e)&&r.set(e.__key,0,"element"),t}(e),s=!1;if(CM(o)&&t){let t=o.anchor,n=o.focus;t.key===r&&(CQ(t,e,i,e.getPreviousSibling(),e.getNextSibling()),s=!0),n.key===r&&(CQ(n,e,i,e.getPreviousSibling(),e.getNextSibling()),s=!0)}else CR(o)&&t&&e.isSelected()&&e.selectPrevious();if(CM(o)&&t&&!s){let t=e.getIndexWithinParent();E4(e),CX(o,i,t,-1)}else E4(e);n||AR(i)||i.canBeEmpty()||!i.isEmpty()||SQ(i,t),t&&o&&EA(i)&&i.isEmpty()&&i.selectEnd()}let S0=Symbol.for("ephemeral");function S1(e){return e[S0]||!1}class S2{__type;__key;__parent;__prev;__next;__state;static getType(){let{ownNodeType:e}=A1(this);return void 0===e&&kw(64,this.name),e}static clone(e){kw(65,this.name)}$config(){return{}}config(e,t){let n=t.extends||Object.getPrototypeOf(this.constructor);return Object.assign(t,{extends:n,type:e}),{[e]:t}}afterCloneFrom(e){this.__key===e.__key?(this.__parent=e.__parent,this.__next=e.__next,this.__prev=e.__prev,this.__state=e.__state):e.__state&&(this.__state=e.__state.getWritable(this))}resetOnCopyNodeFrom(e){this.__state&&(this.__state=this.__state.getWritable(this).resetOnCopyNode())}static importDOM;constructor(e){this.__type=this.constructor.getType(),this.__parent=null,this.__prev=null,this.__next=null,Object.defineProperty(this,"__state",{configurable:!0,enumerable:!1,value:void 0,writable:!0}),E3(this,e)}getType(){return this.__type}isInline(){kw(137,this.constructor.name)}isAttached(){let e=this.__key;for(;null!==e;){if("root"===e)return!0;let t=E7(e);if(null===t)break;e=t.__parent}return!1}isSelected(e){let t=e||CJ();if(null==t)return!1;let n=t.getNodes().some(e=>e.__key===this.__key);if(Ck(this))return n;if(CM(t)&&"element"===t.anchor.type&&"element"===t.focus.type){if(t.isCollapsed())return!1;let e=this.getParent();if(EC(this)&&this.isInline()&&e){let n=t.isBackward()?t.focus:t.anchor;if(e.is(n.getNode())&&n.offset===e.getChildrenSize()&&this.is(e.getLastChild()))return!1}}return n}getKey(){return this.__key}getIndexWithinParent(){let e=this.getParent();if(null===e)return -1;let t=e.getFirstChild(),n=0;for(;null!==t;){if(this.is(t))return n;n++,t=t.getNextSibling()}return -1}getParent(){let e=this.getLatest().__parent;return null===e?null:E7(e)}getParentOrThrow(){let e=this.getParent();return null===e&&kw(66,this.__key),e}getTopLevelElement(){let e=this;for(;null!==e;){let t=e.getParent();if(AR(t))return Ek(e)||e===this&&EC(e)||kw(194),e;e=t}return null}getTopLevelElementOrThrow(){let e=this.getTopLevelElement();return null===e&&kw(67,this.__key),e}getParents(){let e=[],t=this.getParent();for(;null!==t;)e.push(t),t=t.getParent();return e}getParentKeys(){let e=[],t=this.getParent();for(;null!==t;)e.push(t.__key),t=t.getParent();return e}getPreviousSibling(){let e=this.getLatest().__prev;return null===e?null:E7(e)}getPreviousSiblings(){let e=[],t=this.getParent();if(null===t)return e;let n=t.getFirstChild();for(;null!==n&&!n.is(this);)e.push(n),n=n.getNextSibling();return e}getNextSibling(){let e=this.getLatest().__next;return null===e?null:E7(e)}getNextSiblings(){let e=[],t=this.getNextSibling();for(;null!==t;)e.push(t),t=t.getNextSibling();return e}getCommonAncestor(e){let t=Ek(this)?this:this.getParent(),n=Ek(e)?e:e.getParent(),r=t&&n?Tb(t,n):null;return r?r.commonAncestor:null}is(e){return null!=e&&this.__key===e.__key}isBefore(e){let t=Tb(this,e);return null!==t&&("descendant"===t.type||("branch"===t.type?-1===Tv(t):("same"!==t.type&&"ancestor"!==t.type&&kw(279),!1)))}isParentOf(e){let t=Tb(this,e);return null!==t&&"ancestor"===t.type}getNodesBetween(e){let t=this.isBefore(e),n=[],r=new Set,i=this;for(;null!==i;){let o=i.__key;if(r.has(o)||(r.add(o),n.push(i)),i===e)break;let s=Ek(i)?t?i.getFirstChild():i.getLastChild():null;if(null!==s){i=s;continue}let a=t?i.getNextSibling():i.getPreviousSibling();if(null!==a){i=a;continue}let l=i.getParentOrThrow();if(r.has(l.__key)||n.push(l),l===e)break;let u=null,c=l;do{if(null===c&&kw(68),u=t?c.getNextSibling():c.getPreviousSibling(),null===(c=c.getParent()))break;null!==u||r.has(c.__key)||n.push(c)}while(null===u)i=u}return t||n.reverse(),n}isDirty(){let e=Es()._dirtyLeaves;return null!==e&&e.has(this.__key)}getLatest(){if(S1(this))return this;let e=E7(this.__key);return null===e&&kw(113),e}getWritable(){if(S1(this))return this;Er();let e=Eo(),t=Es(),n=e._nodeMap,r=this.__key,i=this.getLatest(),o=t._cloneNotNeeded,s=CJ();if(null!==s&&s.setCachedNodes(null),o.has(r))return E6(i),i;let a=AZ(i);return o.add(r),E6(a),n.set(r,a),a}getTextContent(){return""}getTextContentSize(){return this.getTextContent().length}createDOM(e,t){kw(70)}updateDOM(e,t,n){kw(71)}exportDOM(e){return{element:this.createDOM(e._config,e)}}exportJSON(){let e=this.__state?this.__state.toJSON():void 0;return{type:this.__type,version:1,...e}}static importJSON(e){kw(18,this.name)}updateFromJSON(e){return function(e,t){let n=e.getWritable(),r=t.$,i=r;for(let e of k2(n).flatKeys)e in t&&(void 0!==i&&i!==r||(i={...r}),i[e]=t[e]);return(n.__state||i)&&k1(e).updateFromJSON(i),n}(this,e)}static transform(){return null}remove(e){SQ(this,!0,e)}replace(e,t){Er();let n=CJ();null!==n&&(n=n.clone()),AI(this,e);let r=this.getLatest(),i=this.__key,o=e.__key,s=e.getWritable(),a=this.getParentOrThrow().getWritable(),l=a.__size;E4(s);let u=r.getPreviousSibling(),c=r.getNextSibling(),d=r.__prev,h=r.__next,f=r.__parent;if((SQ(r,!1,!0),null===u)?a.__first=o:u.getWritable().__next=o,(s.__prev=d,null===c)?a.__last=o:c.getWritable().__prev=o,s.__next=h,s.__parent=f,a.__size=l,t&&(Ek(this)&&Ek(s)||kw(139),this.getChildren().forEach(e=>{s.append(e)})),CM(n)){Aa(n);let e=n.anchor,t=n.focus;e.key===i&&Cj(e,s),t.key===i&&Cj(t,s)}return E9()===i&&E8(o),s}insertAfter(e,t=!0){Er(),AI(this,e);let n=this.getWritable(),r=e.getWritable(),i=r.getParent(),o=CJ(),s=!1,a=!1;if(null!==i){let t=e.getIndexWithinParent();if(E4(r),CM(o)){let e=i.__key,n=o.anchor,r=o.focus;s="element"===n.type&&n.key===e&&n.offset===t+1,a="element"===r.type&&r.key===e&&r.offset===t+1}}let l=this.getNextSibling(),u=this.getParentOrThrow().getWritable(),c=r.__key,d=n.__next;if(null===l?u.__last=c:l.getWritable().__prev=c,u.__size++,n.__next=c,r.__next=d,r.__prev=n.__key,r.__parent=n.__parent,t&&CM(o)){let e=this.getIndexWithinParent();CX(o,u,e+1);let t=u.__key;s&&o.anchor.set(t,e+2,"element"),a&&o.focus.set(t,e+2,"element")}return e}insertBefore(e,t=!0){Er(),AI(this,e);let n=this.getWritable(),r=e.getWritable(),i=r.__key;E4(r);let o=this.getPreviousSibling(),s=this.getParentOrThrow().getWritable(),a=n.__prev,l=this.getIndexWithinParent();null===o?s.__first=i:o.getWritable().__next=i,s.__size++,n.__prev=i,r.__prev=a,r.__next=n.__key,r.__parent=n.__parent;let u=CJ();return t&&CM(u)&&CX(u,this.getParentOrThrow(),l),e}isParentRequired(){return!1}createParentElementNode(){return ER()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(e,t){Er();let n=this.getPreviousSibling(),r=this.getParentOrThrow();if(null===n)return r.select(0,0);if(Ek(n))return n.select();if(!Ck(n)){let e=n.getIndexWithinParent()+1;return r.select(e,e)}return n.select(e,t)}selectNext(e,t){Er();let n=this.getNextSibling(),r=this.getParentOrThrow();if(null===n)return r.select();if(Ek(n))return n.select(0,0);if(!Ck(n)){let e=n.getIndexWithinParent();return r.select(e,e)}return n.select(e,t)}markDirty(){this.getWritable()}reconcileObservedMutation(e,t){this.markDirty()}}function S5(e){return e instanceof S2}let S3="historic",S4="history-merge",S6="skip-selection-focus",S8="composition-start",S9="composition-end",S7=/\s*!important\s*$/i;function Ce(e){let t={};if(!e)return t;let n="",r="",i=null,o=!1,s=!1,a=!1,l=0;for(let u=0;u<e.length;u++){let c=e[u];if(o)"*"===c&&"/"===e[u+1]&&(o=!1,u++);else if(s)a?r+=c:n+=c,s=!1;else if(null===i)if("/"!==c||"*"!==e[u+1])if('"'!==c&&"'"!==c)if("("!==c)if(")"!==c)if(a||":"!==c||0!==l){if(";"===c&&0===l){let e=n.trim(),i=r.trim();""!==e&&""!==i&&(t[e]=i),n="",r="",a=!1;continue}a?r+=c:n+=c}else a=!0;else l=Math.max(0,l-1),a?r+=c:n+=c;else l++,a?r+=c:n+=c;else i=c,a?r+=c:n+=c;else o=!0,u++;else a?r+=c:n+=c,"\\"===c?s=!0:c===i&&(i=null)}let u=n.trim(),c=r.trim();return""!==u&&""!==c&&(t[u]=c),t}function Ct(e,t,n=""){if(t===n)return;let r=Ce(n),i=Ce(t);for(let t in i)delete r[t],function(e,t,n){let r=S7.test(n)?"important":"",i=""===r?n:n.replace(S7,"").trim();e.setProperty(t,i,r)}(e,t,i[t]);for(let t in r)e.removeProperty(t)}class Cn extends S2{static getType(){return"linebreak"}static clone(e){return new Cn(e.__key)}constructor(e){super(e)}getTextContent(){return"\n"}createDOM(){return document.createElement("br")}updateDOM(){return!1}isInline(){return!0}static importDOM(){return{br:e=>(function(e){let t=e.parentElement;if(null!==t&&AH(t)){let n=t.firstChild;if(n===e||n.nextSibling===e&&Cs(n)){let n=t.lastChild;if(n===e||n.previousSibling===e&&Cs(n))return!0}}return!1})(e)||function(e){let t=e.parentElement;if(null!==t&&AH(t)){let n=t.firstChild;if(n===e||n.nextSibling===e&&Cs(n))return!1;let r=t.lastChild;if(r===e||r.previousSibling===e&&Cs(r))return!0}return!1}(e)?null:{conversion:Cr,priority:0}}}static importJSON(e){return Ci().updateFromJSON(e)}}function Cr(e){return{node:Ci()}}function Ci(){return AO(new Cn)}function Co(e){return e instanceof Cn}function Cs(e){return E0(e)&&/^( |\t|\r?\n)+$/.test(e.textContent||"")}function Ca(e,t){return 16&t?"code":128&t?"mark":32&t?"sub":64&t?"sup":null}function Cl(e,t){return 1&t?"strong":2&t?"em":"span"}function Cu(e,t,n,r,i){let o=r.classList,s=Aw(i,"base");void 0!==s&&o.add(...s);let a=!1,l=8&t&&4&t;for(let e in void 0!==(s=Aw(i,"underlineStrikethrough"))&&(8&n&&4&n?(a=!0,l||o.add(...s)):l&&o.remove(...s)),kF){let r=kF[e];if(void 0!==(s=Aw(i,e)))if(n&r){if(a&&("underline"===e||"strikethrough"===e)){t&r&&o.remove(...s);continue}(0==(t&r)||l&&"underline"===e||"strikethrough"===e)&&o.add(...s)}else t&r&&o.remove(...s)}}function Cc(e,t,n){let r=t.firstChild,i=n.isComposing(),o=e+(i?kR:"");if(null==r)t.textContent=o;else{let e=r.nodeValue;if(e!==o)if(i||kE){let[t,n,i]=function(e,t){let n=e.length,r=t.length,i=0,o=0;for(;i<n&&i<r&&e[i]===t[i];)i++;for(;o+i<n&&o+i<r&&e[n-o-1]===t[r-o-1];)o++;return[i,n-i-o,t.slice(i,r-o)]}(e,o);0!==n&&r.deleteData(t,n),r.insertData(t,i)}else r.nodeValue=o}}function Cd(e,t,n,r,i,o){Cc(i,e,t);let s=o.theme.text;void 0!==s&&Cu(0,0,r,e,s)}function Ch(e,t){let n=document.createElement(t);return n.appendChild(e),n}class Cf extends S2{__text;__format;__style;__mode;__detail;static getType(){return"text"}static clone(e){return new Cf(e.__text,e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__text=e.__text,this.__format=e.__format,this.__style=e.__style,this.__mode=e.__mode,this.__detail=e.__detail}constructor(e="",t){super(t),this.__text=e,this.__format=0,this.__style="",this.__mode=0,this.__detail=0}getFormat(){return this.getLatest().__format}getDetail(){return this.getLatest().__detail}getMode(){return kV[this.getLatest().__mode]}getStyle(){return this.getLatest().__style}isToken(){return 1===this.getLatest().__mode}isComposing(){return this.__key===E9()}isSegmented(){return 2===this.getLatest().__mode}isDirectionless(){return!!(1&this.getLatest().__detail)}isUnmergeable(){return!!(2&this.getLatest().__detail)}hasFormat(e){let t=kF[e];return 0!=(this.getFormat()&t)}isSimpleText(){return"text"===this.__type&&0===this.__mode}getTextContent(){return this.getLatest().__text}getFormatFlags(e,t){return E5(this.getLatest().__format,e,t)}canHaveFormat(){return!0}isInline(){return!0}createDOM(e,t){let n=this.__format,r=Ca(0,n),i=Cl(0,n),o=null===r?i:r,s=document.createElement(o),a=s;this.hasFormat("code")&&s.setAttribute("spellcheck","false"),null!==r&&(a=document.createElement(i),s.appendChild(a)),Cd(a,this,0,n,this.__text,e);let l=this.__style;return""!==l&&Ct(s.style,l),s}updateDOM(e,t,n){let r=this.__text,i=e.__format,o=this.__format,s=Ca(0,i),a=Ca(0,o),l=Cl(0,i),u=Cl(0,o);if((null===s?l:s)!==(null===a?u:a))return!0;if(s===a&&l!==u){let e=t.firstChild;null==e&&kw(48);let i=document.createElement(u);return Cd(i,this,0,o,r,n),t.replaceChild(i,e),!1}let c=t;null!==a&&null!==s&&null==(c=t.firstChild)&&kw(49),Cc(r,c,this);let d=n.theme.text;void 0!==d&&i!==o&&Cu(0,i,o,c,d);let h=e.__style,f=this.__style;return h!==f&&Ct(t.style,f,h),!1}static importDOM(){return{"#text":()=>({conversion:Cy,priority:0}),b:()=>({conversion:Cm,priority:0}),code:()=>({conversion:Cb,priority:0}),em:()=>({conversion:Cb,priority:0}),i:()=>({conversion:Cb,priority:0}),mark:()=>({conversion:Cb,priority:0}),s:()=>({conversion:Cb,priority:0}),span:()=>({conversion:Cp,priority:0}),strong:()=>({conversion:Cb,priority:0}),sub:()=>({conversion:Cb,priority:0}),sup:()=>({conversion:Cb,priority:0}),u:()=>({conversion:Cb,priority:0})}}static importJSON(e){return Cw().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setTextContent(e.text).setFormat(e.format).setDetail(e.detail).setMode(e.mode).setStyle(e.style)}exportDOM(e){let{element:t}=super.exportDOM(e);return A$(t)||kw(132),t.style.whiteSpace="pre-wrap",this.hasFormat("lowercase")?t.style.textTransform="lowercase":this.hasFormat("uppercase")?t.style.textTransform="uppercase":this.hasFormat("capitalize")&&(t.style.textTransform="capitalize"),this.hasFormat("bold")&&(t=Ch(t,"b")),this.hasFormat("italic")&&(t=Ch(t,"i")),this.hasFormat("strikethrough")&&(t=Ch(t,"s")),this.hasFormat("underline")&&(t=Ch(t,"u")),{element:t}}exportJSON(){return{detail:this.getDetail(),format:this.getFormat(),mode:this.getMode(),style:this.getStyle(),text:this.getTextContent(),...super.exportJSON()}}selectionTransform(e,t){}setFormat(e){let t=this.getWritable();return t.__format="string"==typeof e?kF[e]:e,t}setDetail(e){let t=this.getWritable();return t.__detail="string"==typeof e?kz[e]:e,t}setStyle(e){let t=this.getWritable();return t.__style=e,t}toggleFormat(e){let t=E5(this.getFormat(),e,null);return this.setFormat(t)}toggleDirectionless(){let e=this.getWritable();return e.__detail^=1,e}toggleUnmergeable(){let e=this.getWritable();return e.__detail^=2,e}setMode(e){let t=kU[e];if(this.__mode===t)return this;let n=this.getWritable();return n.__mode=t,n}setTextContent(e){if(this.__text===e)return this;let t=this.getWritable();return t.__text=e,t}select(e,t){Er();let n=e,r=t,i=CJ(),o=this.getTextContent(),s=this.__key;if("string"==typeof o){let e=o.length;void 0===n&&(n=e),void 0===r&&(r=e)}else n=0,r=0;if(!CM(i))return CH(s,n,s,r,"text","text");{let e=E9();e!==i.anchor.key&&e!==i.focus.key||E8(s),i.setTextNodeRange(this,n,this,r)}return i}selectStart(){return this.select(0,0)}selectEnd(){let e=this.getTextContentSize();return this.select(e,e)}spliceText(e,t,n,r){let i=this.getWritable(),o=i.__text,s=n.length,a=e;a<0&&(a=s+a)<0&&(a=0);let l=CJ();if(r&&CM(l)){let t=e+s;l.setTextNodeRange(i,t,i,t)}return i.__text=o.slice(0,a)+n+o.slice(a+t),i}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...e){let t;Er();let n=this.getLatest(),r=n.getTextContent();if(""===r)return[];let i=n.__key,o=E9(),s=r.length;e.sort((e,t)=>e-t),e.push(s);let a=[],l=e.length;for(let t=0,n=0;t<s&&n<=l;n++){let i=e[n];i>t&&(a.push(r.slice(t,i)),t=i)}let u=a.length;if(1===u)return[n];let c=a[0],d=n.getParent(),h=n.getFormat(),f=n.getStyle(),p=n.__detail,m=!1,g=null,y=null,v=CJ();if(CM(v)){let[e,t]=v.isBackward()?[v.focus,v.anchor]:[v.anchor,v.focus];"text"===e.type&&e.key===i&&(g=e),"text"===t.type&&t.key===i&&(y=t)}n.isSegmented()?((t=Cw(c)).__format=h,t.__style=f,t.__detail=p,t.__state=k8(n,t),m=!0):t=n.setTextContent(c);let x=[t];for(let e=1;e<u;e++){let t=Cw(a[e]);t.__format=h,t.__style=f,t.__detail=p,t.__state=k8(n,t);let r=t.__key;o===i&&E8(r),x.push(t)}let b=g?g.offset:null,w=y?y.offset:null,k=0;for(let e of x){if(!g&&!y)break;let t=k+e.getTextContentSize();if(null!==g&&null!==b&&b<=t&&b>=k&&(g.set(e.getKey(),b-k,"text"),b<t&&(g=null)),null!==y&&null!==w&&w<=t&&w>=k){y.set(e.getKey(),w-k,"text");break}k=t}if(null!==d){let e,t;e=this.getPreviousSibling(),t=this.getNextSibling(),null!==e&&E6(e),null!==t&&E6(t);let n=d.getWritable(),r=this.getIndexWithinParent();m?(n.splice(r,0,x),this.remove()):n.splice(r,1,x),CM(v)&&CX(v,d,r,u-1)}return x}mergeWithSibling(e){let t=e===this.getPreviousSibling();t||e===this.getNextSibling()||kw(50);let n=this.__key,r=e.__key,i=this.__text,o=i.length;E9()===r&&E8(n);let s=CJ();if(CM(s)){let i=s.anchor,a=s.focus;null!==i&&i.key===r&&C0(i,t,n,e,o),null!==a&&a.key===r&&C0(a,t,n,e,o)}let a=e.__text,l=t?a+i:i+a;this.setTextContent(l);let u=this.getWritable();return e.remove(),u}isTextEntity(){return!1}}function Cp(e){return{forChild:C_(e.style),node:null}}function Cm(e){let t="normal"===e.style.fontWeight;return{forChild:C_(e.style,t?void 0:"bold"),node:null}}let Cg=new WeakMap;function Cy(e){null===e.parentElement&&kw(129);let t=e.textContent||"";if(null!==function(e){let t,n=e.parentNode,r=[e];for(;null!==n&&void 0===(t=Cg.get(n))&&!function(e){if(!A$(e))return!1;if("PRE"===e.nodeName)return!0;let t=e.style.whiteSpace;return"string"==typeof t&&t.startsWith("pre")}(n);)r.push(n),n=n.parentNode;let i=void 0===t?n:t;for(let e=0;e<r.length;e++)Cg.set(r[e],i);return i}(e)){let e=t.split(/(\r?\n|\t)/),n=[],r=e.length;for(let t=0;t<r;t++){let r=e[t];"\n"===r||"\r\n"===r?n.push(Ci()):" "===r?n.push(CC()):""!==r&&n.push(Cw(r))}return{node:n}}if(""===(t=t.replace(/\r/g,"").replace(/[ \t\n]+/g," ")))return{node:null};if(" "===t[0]){let n=e,r=!0;for(;null!==n&&null!==(n=Cv(n,!1));){let e=n.textContent||"";if(e.length>0){/[ \t\n]$/.test(e)&&(t=t.slice(1)),r=!1;break}}r&&(t=t.slice(1))}if(" "===t[t.length-1]){let n=e,r=!0;for(;null!==n&&null!==(n=Cv(n,!0));)if((n.textContent||"").replace(/^( |\t|\r?\n)+/,"").length>0){r=!1;break}r&&(t=t.slice(0,t.length-1))}return""===t?{node:null}:{node:Cw(t)}}function Cv(e,t){let n=e;for(;;){let e;for(;null===(e=t?n.nextSibling:n.previousSibling);){let e=n.parentElement;if(null===e)return null;n=e}if(A$(n=e)){let e=n.style.display;if(""===e&&!AW(n)||""!==e&&!e.startsWith("inline"))return null}let r=n;for(;null!==(r=t?n.firstChild:n.lastChild);)n=r;if(E0(n))return n;if("BR"===n.nodeName)return null}}let Cx={code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};function Cb(e){let t=Cx[e.nodeName.toLowerCase()];return void 0===t?{node:null}:{forChild:C_(e.style,t),node:null}}function Cw(e=""){return AO(new Cf(e))}function Ck(e){return e instanceof Cf}function C_(e,t){let n=e.fontWeight,r=e.textDecoration.split(" "),i="700"===n||"bold"===n,o=r.includes("line-through"),s="italic"===e.fontStyle,a=r.includes("underline"),l=e.verticalAlign;return e=>(Ck(e)&&(i&&!e.hasFormat("bold")&&e.toggleFormat("bold"),o&&!e.hasFormat("strikethrough")&&e.toggleFormat("strikethrough"),s&&!e.hasFormat("italic")&&e.toggleFormat("italic"),a&&!e.hasFormat("underline")&&e.toggleFormat("underline"),"sub"!==l||e.hasFormat("subscript")||e.toggleFormat("subscript"),"super"!==l||e.hasFormat("superscript")||e.toggleFormat("superscript"),t&&!e.hasFormat(t)&&e.toggleFormat(t)),e)}class CS extends Cf{static getType(){return"tab"}static clone(e){return new CS(e.__key)}constructor(e){super(" ",e),this.__detail=2}static importDOM(){return null}createDOM(e){let t=super.createDOM(e),n=Aw(e.theme,"tab");return void 0!==n&&t.classList.add(...n),t}static importJSON(e){return CC().updateFromJSON(e)}setTextContent(e){return" "!==e&&""!==e&&kk(126),super.setTextContent(" ")}spliceText(e,t,n,r){return""===n&&0===t||" "===n&&1===t||kw(286),this}setDetail(e){return 2!==e&&kw(127),this}setMode(e){return"normal"!==e&&kw(128),this}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}}function CC(){return AO(new CS)}function CE(e){return e instanceof CS}class CA{key;offset;type;_selection;constructor(e,t,n){this._selection=null,this.key=e,this.offset=t,this.type=n}is(e){return this.key===e.key&&this.offset===e.offset&&this.type===e.type}isBefore(e){return this.key===e.key?this.offset<e.offset:0>Ty(TN(Tw(this,"next")),TN(Tw(e,"next")))}getNode(){let e=E7(this.key);return null===e&&kw(20),e}set(e,t,n,r){let i=this._selection,o=this.key;r&&this.key===e&&this.offset===t&&this.type===n||(this.key=e,this.offset=t,this.type=n,En()||(E9()===o&&E8(e),null!==i&&(i.setCachedNodes(null),i.dirty=!0)))}}function CT(e,t,n){return new CA(e,t,n)}function CN(e,t){let n=t.__key,r=e.offset,i="element";if(Ck(t)){i="text";let e=t.getTextContentSize();r>e&&(r=e)}else if(!Ek(t)){let e=t.getNextSibling();if(Ck(e))n=e.__key,r=0,i="text";else{let e=t.getParent();e&&(n=e.__key,r=t.getIndexWithinParent()+1)}}e.set(n,r,i)}function Cj(e,t){if(Ek(t)){let n=t.getLastDescendant();Ek(n)||Ck(n)?CN(e,n):CN(e,t)}else CN(e,t)}class CP{_nodes;_cachedNodes;dirty;constructor(e){this._cachedNodes=null,this._nodes=e,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){if(!CR(e))return!1;let t=this._nodes,n=e._nodes;return t.size===n.size&&Array.from(t).every(e=>n.has(e))}isCollapsed(){return!1}isBackward(){return!1}getStartEndPoints(){return null}add(e){this.dirty=!0,this._nodes.add(e),this._cachedNodes=null}delete(e){this.dirty=!0,this._nodes.delete(e),this._cachedNodes=null}clear(){this.dirty=!0,this._nodes.clear(),this._cachedNodes=null}has(e){return this._nodes.has(e)}clone(){return new CP(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(e){}insertText(){}insertNodes(e){let t,n=this.getNodes(),r=n.length,i=n[r-1];if(Ck(i))t=i.select();else{let e=i.getIndexWithinParent()+1;t=i.getParentOrThrow().select(e,e)}t.insertNodes(e);for(let e=0;e<r;e++)n[e].remove()}getNodes(){let e=this._cachedNodes;if(null!==e)return e;let t=this._nodes,n=[];for(let e of t){let t=E7(e);null!==t&&n.push(t)}return En()||(this._cachedNodes=n),n}getTextContent(){let e=this.getNodes(),t="";for(let n=0;n<e.length;n++)t+=e[n].getTextContent();return t}deleteNodes(){let e=this.getNodes();if((CJ()||CY())===this&&e[0]){let t=Ta(e[0],"next");T_(Tm(t,t))}for(let t of e)t.remove()}}function CM(e){return e instanceof CD}class CD{format;style;anchor;focus;_cachedNodes;dirty;constructor(e,t,n,r){this.anchor=e,this.focus=t,e._selection=this,t._selection=this,this._cachedNodes=null,this.format=n,this.style=r,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){return!!CM(e)&&this.anchor.is(e.anchor)&&this.focus.is(e.focus)&&this.format===e.format&&this.style===e.style}isCollapsed(){return this.anchor.is(this.focus)}getNodes(){let e=this._cachedNodes;if(null!==e)return e;let t=function(e){let t=[],[n,r]=e.getTextSlices();n&&t.push(n.caret.origin);let i=new Set,o=new Set;for(let n of e)if(Tr(n)){let{origin:e}=n;0===t.length?i.add(e):(o.add(e),t.push(e))}else{let{origin:e}=n;Ek(e)&&o.has(e)||t.push(e)}if(r&&t.push(r.caret.origin),Tn(e.focus)&&Ek(e.focus.origin)&&null===e.focus.getNodeAtCaret())for(let n=Tc(e.focus.origin,"previous");Tr(n)&&i.has(n.origin)&&!n.origin.isEmpty()&&n.origin.is(t[t.length-1]);n=Td(n))i.delete(n.origin),t.pop();for(;t.length>1;){let e=t[t.length-1];if(!Ek(e)||o.has(e)||e.isEmpty()||i.has(e))break;t.pop()}if(0===t.length&&e.isCollapsed()){let n=TN(e.anchor),r=TN(e.anchor.getFlipped()),i=e=>Tt(e)?e.origin:e.getNodeAtCaret(),o=i(n)||i(r)||(e.anchor.getNodeAtCaret()?n.origin:r.origin);t.push(o)}return t}(TM(TC(this),"next"));return En()||(this._cachedNodes=t),t}setTextNodeRange(e,t,n,r){this.anchor.set(e.__key,t,"text"),this.focus.set(n.__key,r,"text")}getTextContent(){let e=this.getNodes();if(0===e.length)return"";let t=e[0],n=e[e.length-1],r=this.anchor,i=this.focus,o=r.isBefore(i),[s,a]=CO(this),l="",u=!0;for(let c=0;c<e.length;c++){let d=e[c];if(Ek(d)&&!d.isInline())u||(l+="\n"),u=!d.isEmpty();else if(u=!1,Ck(d)){let e=d.getTextContent();d===t?d===n?"element"===r.type&&"element"===i.type&&i.offset!==r.offset||(e=s<a?e.slice(s,a):e.slice(a,s)):e=o?e.slice(s):e.slice(a):d===n&&(e=o?e.slice(0,a):e.slice(0,s)),l+=e}else!EC(d)&&!Co(d)||d===n&&this.isCollapsed()||(l+=d.getTextContent())}return l}applyDOMRange(e){let t=Es(),n=t.getEditorState()._selection,r=CV(e.startContainer,e.startOffset,e.endContainer,e.endOffset,t,n);if(null===r)return;let[i,o]=r;this.anchor.set(i.key,i.offset,i.type,!0),this.focus.set(o.key,o.offset,o.type,!0),_t(this)}clone(){let e=this.anchor,t=this.focus;return new CD(CT(e.key,e.offset,e.type),CT(t.key,t.offset,t.type),this.format,this.style)}toggleFormat(e){this.format=E5(this.format,e,null),this.dirty=!0}setFormat(e){this.format=e,this.dirty=!0}setStyle(e){this.style=e,this.dirty=!0}hasFormat(e){let t=kF[e];return 0!=(this.format&t)}insertRawText(e){let t=e.split(/(\r?\n|\t)/),n=[],r=t.length;for(let e=0;e<r;e++){let r=t[e];"\n"===r||"\r\n"===r?n.push(Ci()):" "===r?n.push(CC()):n.push(Cw(r))}this.insertNodes(n)}insertText(e){let t=this.anchor,n=this.focus,r=this.format,i=this.style,o=t,s=n;!this.isCollapsed()&&n.isBefore(t)&&(o=n,s=t),"element"===o.type&&function(e,t,n,r){let i=e.getNode(),o=i.getChildAtIndex(e.offset),s=Cw();if(s.setFormat(n),s.setStyle(r),EL(o))o.splice(0,0,[s]);else{let e=EA(i)?ER().append(s):s;null===o?i.append(e):o.insertBefore(e)}e.is(t)&&t.set(s.__key,0,"text"),e.set(s.__key,0,"text")}(o,s,r,i),"element"===s.type&&Tk(s,TN(Tw(s,"next")));let a=o.offset,l=s.offset,u=this.getNodes(),c=u.length,d=u[0];Ck(d)||kw(26);let h=d.getTextContent().length,f=d.getParentOrThrow(),p=u[c-1];if(1===c&&"element"===s.type&&(l=h,s.set(o.key,l,"text")),this.isCollapsed()&&a===h&&(EQ(d)||!d.canInsertTextAfter()||!f.canInsertTextAfter()&&null===d.getNextSibling())){let t=d.getNextSibling();if(Ck(t)&&t.canInsertTextBefore()&&!EQ(t)||((t=Cw()).setFormat(r),t.setStyle(i),f.canInsertTextAfter()?d.insertAfter(t):f.insertAfter(t)),t.select(0,0),d=t,""!==e)return void this.insertText(e)}else if(this.isCollapsed()&&0===a&&(EQ(d)||!d.canInsertTextBefore()||!f.canInsertTextBefore()&&null===d.getPreviousSibling())){let t=d.getPreviousSibling();if(Ck(t)&&!EQ(t)||((t=Cw()).setFormat(r),f.canInsertTextBefore()?d.insertBefore(t):f.insertBefore(t)),t.select(),d=t,""!==e)return void this.insertText(e)}else if(d.isSegmented()&&a!==h){let e=Cw(d.getTextContent());e.setFormat(r),d.replace(e),d=e}else if(!this.isCollapsed()&&""!==e){let t=p.getParent();if(!f.canInsertTextBefore()||!f.canInsertTextAfter()||Ek(t)&&(!t.canInsertTextBefore()||!t.canInsertTextAfter()))return this.insertText(""),CU(this.anchor,this.focus),void this.insertText(e)}if(1===c){if(EZ(d)){let t=Cw(e);return t.select(),void d.replace(t)}let t=d.getFormat(),n=d.getStyle();if(a!==l||t===r&&n===i){if(CE(d)){let t=Cw(e);return t.setFormat(r),t.setStyle(i),t.select(),void d.replace(t)}}else{if(""!==d.getTextContent()){let t=Cw(e);if(t.setFormat(r),t.setStyle(i),t.select(),0===a)d.insertBefore(t,!1);else{let[e]=d.splitText(a);e.insertAfter(t,!1)}return void(t.isComposing()&&"text"===this.anchor.type&&(this.anchor.offset-=e.length))}d.setFormat(r),d.setStyle(i)}let o=l-a;""===(d=d.spliceText(a,o,e,!0)).getTextContent()?d.remove():"text"===this.anchor.type&&(this.format=t,this.style=n,d.isComposing()&&(this.anchor.offset-=e.length))}else{let t=new Set([...d.getParentKeys(),...p.getParentKeys()]),n=Ek(d)?d:d.getParentOrThrow(),r=Ek(p)?p:p.getParentOrThrow(),i=p;if(!n.is(r)&&r.isInline())do i=r,r=r.getParentOrThrow();while(r.isInline())if("text"===s.type&&(0!==l||""===p.getTextContent())||"element"===s.type&&p.getIndexWithinParent()<l)if(Ck(p)&&!EZ(p)&&l!==p.getTextContentSize()){if(p.isSegmented()){let e=Cw(p.getTextContent());p.replace(e),p=e}EA(s.getNode())||"text"!==s.type||(p=p.spliceText(0,l,"")),t.add(p.__key)}else{let e=p.getParentOrThrow();e.canBeEmpty()||1!==e.getChildrenSize()?p.remove():e.remove()}else t.add(p.__key);let o=r.getChildren(),f=new Set(u),m=n.is(r),g=n.isInline()&&null===d.getNextSibling()?n:d;for(let e=o.length-1;e>=0;e--){let t=o[e];if(t.is(d)||Ek(t)&&t.isParentOf(d))break;t.isAttached()&&(!f.has(t)||t.is(i)?m||g.insertAfter(t,!1):t.remove())}if(!m){let e=r,n=null;for(;null!==e;){let r=e.getChildren(),i=r.length;(0===i||r[i-1].is(n))&&(t.delete(e.__key),n=e),e=e.getParent()}}if(EZ(d))if(a===h)d.select();else{let t=Cw(e);t.select(),d.replace(t)}else""===(d=d.spliceText(a,h-a,e,!0)).getTextContent()?d.remove():"text"===this.anchor.type&&(this.format=d.getFormat(),this.style=d.getStyle(),d.isComposing()&&(this.anchor.offset-=e.length));for(let e=1;e<c;e++){let n=u[e],r=n.__key;t.has(r)||n.remove()}}}removeText(){let e=CJ()===this;TS(this,function(e,t="removeEmptySlices"){let n,r;if(e.isCollapsed())return e;let i="root",o="next",s=t,a=TM(e,o),l=TA(a.anchor,i),u=TA(a.focus.getFlipped(),i),c=new Set,d=[];for(let e of a.iterNodeCarets(i))if(Tr(e))c.add(e.origin.getKey());else if(Tn(e)){let{origin:t}=e;Ek(t)&&!c.has(t.getKey())||d.push(t)}for(let e of d)e.remove();for(let e of a.getTextSlices()){if(!e)continue;let{origin:t}=e.caret,n=t.getTextContentSize(),r=TE(Ta(t,o)),i=t.getMode();if(Math.abs(e.distance)===n&&"removeEmptySlices"===s||"token"===i&&0!==e.distance)r.remove();else if(0!==e.distance){s="removeEmptySlices";let t=e.removeTextSlice(),n=e.caret.origin;if("segmented"===i){let e=t.origin,n=Cw(e.getTextContent()).setStyle(e.getStyle()).setFormat(e.getFormat());r.replaceOrInsert(n),t=Tl(n,o,t.offset)}n.is(l[0].origin)&&(l[0]=t),n.is(u[0].origin)&&(u[0]=t.getFlipped())}}for(let e of l)if(TT(e)){n=TN(e);break}for(let e of u)if(TT(e)){r=TN(e);break}let h=function(e,t,n){let r;if(!e||!t)return null;let i=e.getParentAtCaret(),o=t.getParentAtCaret();if(!i||!o)return null;let s=i.getParents().reverse();s.push(i);let a=o.getParents().reverse();a.push(o);let l=Math.min(s.length,a.length);for(r=0;r<l&&s[r]===a[r];r++);let u=(e,t)=>{let n;for(let i=r;i<e.length;i++){let r=e[i];if(AR(r))return;!n&&t(r)&&(n=r)}return n},c=u(s,AK),d=c&&u(a,e=>n.has(e.getKey())&&AK(e));return c&&d?[c,d]:null}(n,r,c);if(h){let[e,t]=h;Tc(e,"previous").splice(0,t.getChildren());let n=t.getParent();for(t.remove(!0);n&&n.isEmpty();){let e=n;n=n.getParent(),e.remove(!0)}}let f=[n,r,...l,...u].find(TT);if(f){var p;return Tm(p=TP(TN(f),e.direction),p)}kw(269,JSON.stringify(l.map(e=>e.origin.__key)))}(TC(this))),e&&CJ()!==this&&Aa(this)}formatText(e,t=null){if(this.isCollapsed())return this.toggleFormat(e),void E8(null);let n=this.getNodes(),r=[];for(let e of n)Ck(e)&&r.push(e);let i=t=>{n.forEach(n=>{if(Ek(n)){let r=n.getFormatFlags(e,t);n.setTextFormat(r)}})},o=r.length;if(0===o)return this.toggleFormat(e),E8(null),void i(t);let s=this.anchor,a=this.focus,l=this.isBackward(),u=l?a:s,c=l?s:a,d=0,h=r[0],f="element"===u.type?0:u.offset;if("text"===u.type&&f===h.getTextContentSize()&&(d=1,h=r[1],f=0),null==h)return;let p=h.getFormatFlags(e,t);i(p);let m=o-1,g=r[m],y="text"===c.type?c.offset:g.getTextContentSize();if(h.is(g)){if(f===y)return;if(EQ(h)||0===f&&y===h.getTextContentSize())h.setFormat(p);else{let e=h.splitText(f,y),t=0===f?e[0]:e[1];t.setFormat(p),"text"===u.type&&u.set(t.__key,0,"text"),"text"===c.type&&c.set(t.__key,y-f,"text")}return void(this.format=p)}0===f||EQ(h)||([,h]=h.splitText(f),f=0),h.setFormat(p);let v=g.getFormatFlags(e,p);y>0&&(y===g.getTextContentSize()||EQ(g)||([g]=g.splitText(y)),g.setFormat(v));for(let t=d+1;t<m;t++){let n=r[t],i=n.getFormatFlags(e,v);n.setFormat(i)}"text"===u.type&&u.set(h.__key,f,"text"),"text"===c.type&&c.set(g.__key,y,"text"),this.format=p|v}insertNodes(e){var t;if(0===e.length)return;if(this.isCollapsed()||this.removeText(),"root"===this.anchor.key){this.insertParagraph();let t=CJ();return CM(t)||kw(134),t.insertNodes(e)}let n=(this.isBackward()?this.focus:this.anchor).getNode(),r=A2(n,AK),i=e[e.length-1];if(Ek(r)&&"__language"in r){if("__language"in e[0])this.insertText(e[0].getTextContent());else{let t=C3(this);r.splice(t,0,e),i.selectEnd()}return}if(!e.some(e=>(Ek(e)||EC(e))&&!e.isInline())){Ek(r)||kw(211,n.constructor.name,n.getType());let t=C3(this);return r.splice(t,0,e),void i.selectEnd()}let o=function(e){let t=ER(),n=null;for(let r=0;r<e.length;r++){let i=e[r],o=Co(i);if(o||EC(i)&&i.isInline()||Ek(i)&&i.isInline()||Ck(i)||i.isParentRequired()){if(null===n&&(n=i.createParentElementNode(),t.append(n),o))continue;null!==n&&n.append(i)}else t.append(i),n=null}return t}(e),s=o.getLastDescendant(),a=o.getChildren(),l=Ek(r)&&r.isEmpty()?null:this.insertParagraph(),u=a[a.length-1],c=a[0];Ek(t=c)&&AK(t)&&!t.isEmpty()&&Ek(r)&&(!r.isEmpty()||r.canMergeWhenEmpty())&&(Ek(r)||kw(211,n.constructor.name,n.getType()),r.append(...c.getChildren()),c=a[1]),c&&(null===r&&kw(212,n.constructor.name,n.getType()),function(e,t){let n=t.getParentOrThrow().getLastChild(),r=t,i=[t];for(;r!==n;)r.getNextSibling()||kw(140),i.push(r=r.getNextSibling());let o=e;for(let e of i)o=o.insertAfter(e)}(r,c));let d=A2(s,AK);l&&Ek(d)&&(l.canMergeWhenEmpty()||AK(u))&&(d.append(...l.getChildren()),l.remove()),Ek(r)&&r.isEmpty()&&r.remove(),s.selectEnd();let h=Ek(r)?r.getLastChild():null;Co(h)&&d!==r&&h.remove()}insertParagraph(){if("root"===this.anchor.key){let e=ER();return Ao().splice(this.anchor.offset,0,[e]),e.select(),e}let e=C3(this),t=A2(this.anchor.getNode(),AK);Ek(t)||kw(213);let n=t.getChildAtIndex(e),r=n?[n,...n.getNextSiblings()]:[],i=t.insertNewAfter(this,!1);return i?(i.append(...r),i.selectStart(),i):null}insertLineBreak(e){let t=Ci();if(this.insertNodes([t]),e){let e=t.getParentOrThrow(),n=t.getIndexWithinParent();e.select(n,n)}}extract(){let e=[...this.getNodes()],t=e.length,n=e[0],r=e[t-1],[i,o]=CO(this),s=this.isBackward(),[a,l]=s?[this.focus,this.anchor]:[this.anchor,this.focus],[u,c]=s?[o,i]:[i,o];if(0===t)return[];if(1===t){if(Ck(n)&&!this.isCollapsed()){let e=n.splitText(u,c),t=0===u?e[0]:e[1];return t?(a.set(t.getKey(),0,"text"),l.set(t.getKey(),t.getTextContentSize(),"text"),[t]):[]}return[n]}if(Ck(n)&&(u===n.getTextContentSize()?e.shift():0!==u&&([,n]=n.splitText(u),e[0]=n,a.set(n.getKey(),0,"text"))),Ck(r)){let t=r.getTextContent().length;0===c?e.pop():c!==t&&([r]=r.splitText(c),e[e.length-1]=r,l.set(r.getKey(),r.getTextContentSize(),"text"))}return e}modify(e,t,n){var r;if(C4(this,e,t,n))return;let i="move"===e,o=Es(),s=AB(AD(o));if(!s)return;let a=o._blockCursorElement,l=o._rootElement,u=this.focus.getNode();if(null===l||null===a||!Ek(u)||u.isInline()||u.canBeEmpty()||Az(a,o,l),this.dirty){let e=AA(o,this.anchor.key),t=AA(o,this.focus.key);"text"===this.anchor.type&&(e=E2(e)),"text"===this.focus.type&&(t=E2(t)),e&&t&&C1(s,e,this.anchor.offset,t,this.focus.offset)}if(r=t?"backward":"forward",s.modify(e,r,n),s.rangeCount>0){let e=s.getRangeAt(0),n=this.anchor.getNode(),r=EA(n)?n:function(e){let t=e.getParentOrThrow();for(;null!==t&&!AR(t);)t=t.getParentOrThrow();return t}(n);if(this.applyDOMRange(e),this.dirty=!0,!i){let n,i,o,a,l,u=this.getNodes(),c=[],d=!1;for(let e=0;e<u.length;e++){let t=u[e];AP(t,r)?c.push(t):d=!0}if(d&&c.length>0)if(t){let e=c[0];Ek(e)?e.selectStart():e.getParentOrThrow().selectStart()}else{let e=c[c.length-1];Ek(e)?e.selectEnd():e.getParentOrThrow().selectEnd()}s.anchorNode===e.startContainer&&s.anchorOffset===e.startOffset||(n=this.focus,o=(i=this.anchor).key,a=i.offset,l=i.type,i.set(n.key,n.offset,n.type,!0),n.set(o,a,l,!0))}}"lineboundary"===n&&C4(this,e,t,n,"decorators")}forwardDeletion(e,t,n){if(!n&&("element"===e.type&&Ek(t)&&e.offset===t.getChildrenSize()||"text"===e.type&&e.offset===t.getTextContentSize())){let e=t.getParent(),n=t.getNextSibling()||(null===e?null:e.getNextSibling());if(Ek(n)&&n.isShadowRoot())return!0}return!1}deleteCharacter(e){let t=this.isCollapsed();if(this.isCollapsed()){let t=this.anchor,n=t.getNode();if(this.forwardDeletion(t,n,e))return;let r=Tp(Tw(t,e?"previous":"next"));if(r.getTextSlices().every(e=>null===e||0===e.distance)){let e={type:"initial"};for(let t of r.iterNodeCarets("shadowRoot"))if(Tr(t))if(t.origin.isInline());else{if(t.origin.isShadowRoot()){if("merge-block"===e.type)break;if(Ek(r.anchor.origin)&&r.anchor.origin.isEmpty()){let e=TN(t);TS(this,Tm(e,e)),r.anchor.origin.remove()}return}"merge-next-block"!==e.type&&"merge-block"!==e.type||(e={block:e.block,caret:t,type:"merge-block"})}else{if("merge-block"===e.type)break;if(Tn(t)){if(Ek(t.origin)){if(t.origin.isInline()){if(!t.origin.isParentOf(r.anchor.origin))break}else e={block:t.origin,type:"merge-next-block"};continue}if(EC(t.origin)){if(t.origin.isIsolated());else if("merge-next-block"===e.type&&(t.origin.isKeyboardSelectable()||!t.origin.isInline())&&Ek(r.anchor.origin)&&r.anchor.origin.isEmpty()){r.anchor.origin.remove();let e=CG();e.add(t.origin.getKey()),Aa(e)}else t.origin.remove();return}break}}if("merge-block"===e.type){let{caret:t,block:n}=e;return TS(this,Tm(!t.origin.isEmpty()&&n.isEmpty()?TE(Ta(n,t.direction)):r.anchor,t)),this.removeText()}}let i=this.focus;if(this.modify("extend",e,"character"),this.isCollapsed()){if(e&&0===t.offset&&CI(this,t.getNode()))return}else{let r="text"===i.type?i.getNode():null;if(n="text"===t.type?t.getNode():null,null!==r&&r.isSegmented()){let t=i.offset,o=r.getTextContentSize();if(r.is(n)||e&&t!==o||!e&&0!==t)return void Cz(r,e,t)}else if(null!==n&&n.isSegmented()){let i=t.offset,o=n.getTextContentSize();if(n.is(r)||e&&0!==i||!e&&i!==o)return void Cz(n,e,i)}!function(e,t){let n=e.anchor,r=e.focus,i=n.getNode();if(i===r.getNode()&&"text"===n.type&&"text"===r.type){var o;let e=n.offset,s=r.offset,a=e<s,l=a?e:s,u=a?s:e,c=u-1;l===c||Au(o=i.getTextContent().slice(l,u))||CF(o)||(t?r.set(r.key,c,r.type):n.set(n.key,c,n.type))}}(this,e)}}if(this.removeText(),e&&!t&&this.isCollapsed()&&"element"===this.anchor.type&&0===this.anchor.offset){let e=this.anchor.getNode();e.isEmpty()&&EA(e.getParent())&&null===e.getPreviousSibling()&&CI(this,e)}}deleteLine(e){this.isCollapsed()&&this.modify("extend",e,"lineboundary"),this.isCollapsed()?this.deleteCharacter(e):this.removeText()}deleteWord(e){if(this.isCollapsed()){let t=this.anchor,n=t.getNode();if(this.forwardDeletion(t,n,e))return;this.modify("extend",e,"word")}this.isCollapsed()?this.deleteCharacter(e):this.removeText()}isBackward(){return this.focus.isBefore(this.anchor)}getStartEndPoints(){return[this.anchor,this.focus]}}function CR(e){return e instanceof CP}function CL(e){let t=e.offset;if("text"===e.type)return t;let n=e.getNode();return t===n.getChildrenSize()?n.getTextContent().length:0}function CO(e){let t=e.getStartEndPoints();if(null===t)return[0,0];let[n,r]=t;return"element"===n.type&&"element"===r.type&&n.key===r.key&&n.offset===r.offset?[0,0]:[CL(n),CL(r)]}function CI(e,t){for(let n=t;n;n=n.getParent()){if(Ek(n)){if(n.collapseAtStart(e))return!0;if(AR(n))break}if(n.getPreviousSibling())break}return!1}let CF=(()=>{try{let e=RegExp("\\p{Emoji}","u"),t=e.test.bind(e);if(t("❤️")&&t("#️⃣")&&t("👍"))return t}catch(e){}return()=>!1})();function Cz(e,t,n){let r=e.getTextContent().split(/(?=\s)/g),i=r.length,o=0,s=0;for(let e=0;e<i;e++){let a=e===i-1;if(s=o,o+=r[e].length,t&&o===n||o>n||a){r.splice(e,1),a&&(s=void 0);break}}let a=r.join("").trim();""===a?e.remove():(e.setTextContent(a),e.select(s,s))}function CB(e,t,n,r){let i,o=t;if(A$(e)){let s=!1,a=e.childNodes,l=a.length,u=r._blockCursorElement;o===l&&(s=!0,o=l-1);let c=a[o],d=!1;if(c===u)c=a[o+1],d=!0;else if(null!==u){let n=u.parentNode;e===n&&t>Array.prototype.indexOf.call(n.children,u)&&o--}if(Ck(i=Al(c)))o=Tu(i,s?"next":"previous");else{let a=Al(e);if(null===a)return null;if(Ek(a)){let l,u=r.getElementByKey(a.getKey());null===u&&kw(214);let c=Aq(r).$getDOMSlot(a,u,r);[a,o]=c.resolveChildIndex(a,u,e,t),Ek(a)||kw(215),s&&o>=a.getChildrenSize()&&(o=Math.max(0,a.getChildrenSize()-1));let h=a.getChildAtIndex(o);if(Ek(h)&&(l=h.getParent(),null===n||null===l||!l.canBeEmpty()||l!==n.getNode())){let e=s?h.getLastDescendant():h.getFirstDescendant();a=null===e||Ek(h=e)?h:h.getParentOrThrow(),o=0}Ck(h)?(i=h,a=null,o=Tu(h,s?"next":"previous")):h!==a&&s&&!d&&(Ek(a)||kw(216),o=Math.min(a.getChildrenSize(),o+1))}else{let n=a.getIndexWithinParent();o=0===t&&EC(a)&&Al(e)===a?n:n+1,a=a.getParentOrThrow()}if(Ek(a))return CT(a.__key,o,"element")}}else i=Al(e);return Ck(i)?CT(i.__key,Tu(i,o,"clamp"),"text"):null}function C$(e,t,n){let r=e.offset,i=e.getNode();if(0===r){let r=i.getPreviousSibling(),o=i.getParent();if(t){if((n||!t)&&null===r&&Ek(o)&&o.isInline()){let t=o.getPreviousSibling();Ck(t)&&e.set(t.__key,t.getTextContent().length,"text")}}else Ek(r)&&!n&&r.isInline()?e.set(r.__key,r.getChildrenSize(),"element"):Ck(r)&&e.set(r.__key,r.getTextContent().length,"text")}else if(r===i.getTextContent().length){let r=i.getNextSibling(),o=i.getParent();if(t&&Ek(r)&&r.isInline())e.set(r.__key,0,"element");else if((n||t)&&null===r&&Ek(o)&&o.isInline()&&!o.canInsertTextAfter()){let t=o.getNextSibling();Ck(t)&&e.set(t.__key,0,"text")}}}function CU(e,t,n){if("text"===e.type&&"text"===t.type){let n=e.isBefore(t),r=e.is(t);C$(e,n,r),C$(t,!n,r),r&&t.set(e.key,e.offset,e.type)}}function CV(e,t,n,r,i,o){if(null===e||null===n||!Eq(i,e,n))return null;let s=CB(e,t,CM(o)?o.anchor:null,i);if(null===s)return null;let a=CB(n,r,CM(o)?o.focus:null,i);if(null===a)return null;if("element"===s.type&&"element"===a.type){let t=Al(e),r=Al(n);if(EC(t)&&EC(r))return null}return CU(s,a),[s,a]}function CW(e){return Ek(e)&&!e.isInline()}function CH(e,t,n,r,i,o){let s=Eo(),a=new CD(CT(e,t,i),CT(n,r,o),0,"");return a.dirty=!0,s._selection=a,a}function CK(){return new CD(CT("root",0,"element"),CT("root",0,"element"),0,"")}function CG(){return new CP(new Set)}function Cq(e,t,n,r){let i,o,s,a,l=n._window;if(null===l)return null;let u=r||l.event,c=u?u.type:void 0,d="selectionchange"===c,h=!kK&&(d||"beforeinput"===c||"compositionstart"===c||"compositionend"===c||"click"===c&&u&&3===u.detail||"drop"===c||void 0===c);if(CM(e)&&!h)return e.clone();if(null===t)return null;if(i=t.anchorNode,o=t.focusNode,s=t.anchorOffset,a=t.focusOffset,(d||void 0===c)&&CM(e)&&!Eq(n,i,o))return e.clone();let f=CV(i,s,o,a,n,e);if(null===f)return null;let[p,m]=f,g=0,y="";if(CM(e)){let t=e.anchor;if(p.key===t.key)g=e.format,y=e.style;else{let e=p.getNode();Ck(e)?(g=e.getFormat(),y=e.getStyle()):Ek(e)&&(g=e.getTextFormat(),y=e.getTextStyle())}}return new CD(p,m,g,y)}function CJ(){return Eo()._selection}function CY(){return Es()._editorState._selection}function CX(e,t,n,r=1){let i=e.anchor,o=e.focus,s=i.getNode(),a=o.getNode();if(!t.is(s)&&!t.is(a))return;let l=t.__key;if(e.isCollapsed()){let t=i.offset;if(n<=t&&r>0||n<t&&r<0){let n=Math.max(0,t+r);i.set(l,n,"element"),o.set(l,n,"element"),CZ(e)}}else{let s=e.isBackward(),a=s?o:i,u=a.getNode(),c=s?i:o,d=c.getNode();if(t.is(u)){let e=a.offset;(n<=e&&r>0||n<e&&r<0)&&a.set(l,Math.max(0,e+r),"element")}if(t.is(d)){let e=c.offset;(n<=e&&r>0||n<e&&r<0)&&c.set(l,Math.max(0,e+r),"element")}}CZ(e)}function CZ(e){let t=e.anchor,n=t.offset,r=e.focus,i=r.offset,o=t.getNode(),s=r.getNode();if(e.isCollapsed()){if(!Ek(o))return;let e=o.getChildrenSize(),i=n>=e,s=i?o.getChildAtIndex(e-1):o.getChildAtIndex(n);if(Ck(s)){let e=0;i&&(e=s.getTextContentSize()),t.set(s.__key,e,"text"),r.set(s.__key,e,"text")}return}if(Ek(o)){let e=o.getChildrenSize(),r=n>=e,i=r?o.getChildAtIndex(e-1):o.getChildAtIndex(n);if(Ck(i)){let e=0;r&&(e=i.getTextContentSize()),t.set(i.__key,e,"text")}}if(Ek(s)){let e=s.getChildrenSize(),t=i>=e,n=t?s.getChildAtIndex(e-1):s.getChildAtIndex(i);if(Ck(n)){let e=0;t&&(e=n.getTextContentSize()),r.set(n.__key,e,"text")}}}function CQ(e,t,n,r,i){let o=null,s=0,a=null;null!==r?(o=r.__key,Ck(r)?(s=r.getTextContentSize(),a="text"):Ek(r)&&(s=r.getChildrenSize(),a="element")):null!==i&&(o=i.__key,Ck(i)?a="text":Ek(i)&&(a="element")),null!==o&&null!==a?e.set(o,s,a):(-1===(s=t.getIndexWithinParent())&&(s=n.getChildrenSize()),e.set(n.__key,s,"element"))}function C0(e,t,n,r,i){"text"===e.type?e.set(n,e.offset+(t?0:i),"text"):e.offset>r.getIndexWithinParent()&&e.set(e.key,e.offset-1,"element")}function C1(e,t,n,r,i){try{e.setBaseAndExtent(t,n,r,i)}catch(e){}}function C2(e,t,n){let r=AA(e,t.getKey());if(Ek(t)){let i=Aq(e).$getDOMSlot(t,r,e);return[i.element,n+i.getFirstChildOffset()]}return[r,n]}function C5(e){let t=CJ()||CY();null===t&&(t=Ao().selectEnd()),t.insertNodes(e)}function C3(e){let t=e;e.isCollapsed()||t.removeText();let n=CJ();CM(n)&&(t=n),CM(t)||kw(161);let r=t.anchor,i=r.getNode(),o=r.offset;for(;!AK(i);){let e=i;if([i,o]=function(e,t){let n=e.getParent();if(!n){let e=ER();return Ao().append(e),e.select(),[Ao(),0]}if(Ck(e)){let r=e.splitText(t);if(0===r.length)return[n,e.getIndexWithinParent()];let i=+(0!==t);return[n,r[0].getIndexWithinParent()+i]}if(!Ek(e)||0===t)return[n,e.getIndexWithinParent()];let r=e.getChildAtIndex(t);if(r){let n=new CD(CT(e.__key,t,"element"),CT(e.__key,t,"element"),0,""),i=e.insertNewAfter(n);i&&i.append(r,...r.getNextSiblings())}return[n,e.getIndexWithinParent()+1]}(i,o),e.is(i))break}return o}function C4(e,t,n,r,i="decorators-and-blocks"){if("move"===t&&"character"===r&&!e.isCollapsed()){let[t,r]=n===e.isBackward()?[e.focus,e.anchor]:[e.anchor,e.focus];return r.set(t.key,t.offset,t.type),!0}let o=Tw(e.focus,n?"previous":"next"),s="lineboundary"===r,a="move"===t,l=o,u="decorators-and-blocks"===i;if(!Tj(l)){for(let e of l){u=!1;let{origin:t}=e;if(!EC(t)||t.isIsolated()||(l=e,!s||!t.isInline()))break}if(u)for(let e of Tp(o).iterNodeCarets("extend"===t?"shadowRoot":"root")){if(Tr(e))e.origin.isInline()||(l=e);else{if(Ek(e.origin))continue;EC(e.origin)&&!e.origin.isInline()&&(l=e)}break}}if(l===o)return!1;if(a&&!s&&EC(l.origin)&&l.origin.isKeyboardSelectable()){let e=CG();return e.add(l.origin.getKey()),Aa(e),!0}return l=TN(l),a&&Tk(e.anchor,l),Tk(e.focus,l),u||!s}let C6=null,C8=null,C9=!1,C7=!1,Ee=0,Et={characterData:!0,childList:!0,subtree:!0};function En(){return C9||null!==C6&&C6._readOnly}function Er(){C9&&kw(13)}function Ei(){Ee>99&&kw(14)}function Eo(){return null===C6&&kw(195,Ea()),C6}function Es(){return null===C8&&kw(337,Ea()),C8}function Ea(){let e=0,t=new Set,n=E$.version;if("u">typeof window)for(let r of document.querySelectorAll("[contenteditable]")){let i=EX(r);if(EJ(i))e++;else if(i){let e=String(i.constructor.version||"<0.17.1");e===n&&(e+=" (separately built, likely a bundler configuration issue)"),t.add(e)}}let r=` Detected on the page: ${e} compatible editor(s) with version ${n}`;return t.size&&(r+=` and incompatible editors with versions ${Array.from(t).join(", ")}`),r}function El(e,t,n){let r=t.__type,i=EW(e,r),o=n.get(r);void 0===o&&(o=Array.from(i.transforms),n.set(r,o));let s=o.length;for(let e=0;e<s&&(o[e](t),t.isAttached());e++);}function Eu(e,t){return void 0!==e&&e.__key!==t&&e.isAttached()}function Ec(e,t){if(!t)return;let n=e._updateTags,r=t;for(let e of(Array.isArray(t)||(r=[t]),r))n.add(e)}function Ed(e,t){let n=e.type,r=t.get(n);void 0===r&&kw(17,n);let i=r.klass;e.type!==i.getType()&&kw(18,i.name);let o=i.importJSON(e),s=e.children;if(Ek(o)&&Array.isArray(s))for(let e=0;e<s.length;e++){let n=Ed(s[e],t);o.append(n)}return o}function Eh(e,t,n){let r=C6,i=C9,o=C8;C6=t,C9=!0,C8=e;try{return n()}finally{C6=r,C9=i,C8=o}}function Ef(e,t){let n,r,i=e._pendingEditorState,o=e._rootElement,s=e._headless||null===o;if(null===i)return void(e._deferred.length>0&&Em(e,e._deferred));let a=e._editorState,l=a._selection,u=i._selection,c=0!==e._dirtyType,d=C6,h=C9,f=C8,p=e._updating,m=e._observer,g=null;if(e._pendingEditorState=null,e._editorState=i,!s&&c&&null!==m){C8=e,C6=i,C9=!1,e._updating=!0;try{let t,n=e._dirtyType,r=e._dirtyElements,o=e._dirtyLeaves;m.disconnect(),_p="",_y=2===n,_i=e,_r=e._config,_f=e._config.dom||EI,_o=e._nodes,_s=_i._listeners.mutation,_a=r,_l=o,_u=a._nodeMap,_c=i._nodeMap,_v=i._readOnly,_d=new Map(e._keyToDOMMap),_h=t=new Map,function e(t,n){let r=_u.get(t),i=_c.get(t);void 0!==r&&void 0!==i||kw(61);let o=_y||_l.has(t)||_a.has(t),s=AA(_i,t);if(r===i&&!o){let e;if(Ek(r)){let t=s.__lexicalTextContent;"string"==typeof t?e=t:s.__lexicalTextContent=e=r.getTextContent()}else e=r.getTextContent();return _p+=e,s}if(r!==i&&o&&Ak(_h,_o,_s,i,"updated"),_f.$updateDOM(i,r,s,_i)){let e=_C(t,null);return null===n&&kw(62),n.replaceChild(e,s),_x(t,null),e}if(Ek(r)){Ek(i)||kw(334,t);let n=i.__indent;(_y||n!==r.__indent)&&_k(s,n);let a=i.__format;if((_y||a!==r.__format)&&__(s,a),o)(function(t,n,r){_m=null,_g=null,function(t,n,r){let i=_p,o=t.__size,s=n.__size;_p="";let a=r.element;if(1===o&&1===s){let r=t.__first,i=n.__first;if(r===i)e(r,a);else{let e=_M(r),t=_C(i,null);try{a.replaceChild(t,e)}catch(n){if("object"==typeof n&&null!=n)throw Error(`${n.toString()} Parent: ${a.tagName}, new child: {tag: ${t.tagName} key: ${i}}, old child: {tag: ${e.tagName}, key: ${r}}.`);throw n}_x(r,null)}let o=_c.get(i);Ck(o)&&null===_m&&(_m=o.getFormat(),_g=o.getStyle())}else{let i=A5(t,_u),l=A5(n,_c);if(i.length!==o&&kw(227),l.length!==s&&kw(228),0===o)0!==s&&_E(l,0,0,s-1,r);else if(0===s){if(0!==o){let e=null==r.after&&null==r.before&&null==r.element.__lexicalLineBreak;_b(i,0,o-1,e?null:a),e&&(a.textContent="")}}else!function(t,n,r,i,o){let s=r-1,a=i-1,l,u,c=o.getFirstChild(),d=0,h=0;for(;d<=s&&h<=a;){let r=t[d],i=n[h];if(r===i)c=_j(e(i,o.element)),d++,h++;else{if(void 0===u&&(u=_P(n,h)),void 0===l)l=_P(t,d);else if(!l.has(r)){d++;continue}if(!u.has(r)){c=_j(_M(r)),_x(r,o.element),d++,l.delete(r);continue}if(l.has(i)){let t=AA(_i,i);t!==c&&o.withBefore(c).insertChild(t),c=_j(e(i,o.element)),d++,h++}else _C(i,o.withBefore(c)),h++}let s=_c.get(i);null!==s&&Ck(s)?null===_m&&(_m=s.getFormat(),_g=s.getStyle()):Ek(s)&&h<=a&&!s.isInline()&&(_p+="\n\n")}let f=d>s,p=h>a;if(f&&!p){let e=n[a+1],t=void 0===e?null:_i.getElementByKey(e);_E(n,0,h,a,o.withBefore(t))}else p&&!f&&_b(t,d,s,o.element)}(i,l,o,s,r)}a.__lexicalTextContent=_p,_p=i+_p}(t,n,_f.$getDOMSlot(n,r,_i)),null==_m||_m===n.__textFormat||_v||n.setTextFormat(_m),null==_g||_g===n.__textStyle||_v||n.setTextStyle(_g)})(r,i,s),EA(i)||i.isInline()||_T(r,i,s);else{let e,t=s.__lexicalTextContent;"string"==typeof t?e=t:s.__lexicalTextContent=e=r.getTextContent(),_p+=e}if((_y||i.__dir!==r.__dir)&&(_S(s,i),EA(i)&&!_y))for(let e of i.getChildren())Ek(e)&&_S(AA(_i,e.getKey()),e)}else{let e=i.getTextContent();if(EC(i)){let e=i.decorate(_i,_r);null!==e&&_N(t,e)}_p+=e}if(!_v&&EA(i)&&i.__cachedText!==_p){let e=i.getWritable();e.__cachedText=_p,i=e}return _f.$decorateDOM(i,r,s,_i),s}("root",null),_i=void 0,_o=void 0,_a=void 0,_l=void 0,_u=void 0,_c=void 0,_r=void 0,_d=void 0,_h=void 0,_f=EI,g=t}catch(t){if(t instanceof Error&&e._onError(t),C7)throw t;return EO(e,null,o,i),kZ(e),e._dirtyType=2,C7=!0,Ef(e,a),void(C7=!1)}finally{m.observe(o,Et),e._updating=p,C6=d,C9=h,C8=f}}i._readOnly||(i._readOnly=!0);let y=e._dirtyLeaves,v=e._dirtyElements,x=e._normalizedNodes,b=e._updateTags,w=e._deferred;c&&(e._dirtyType=0,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements=new Map,e._normalizedNodes=new Set,e._updateTags=new Set),function(e,t){let n,r=e._decorators,i=e._pendingDecorators||r,o=t._nodeMap;for(n in i)o.has(n)||(i===r&&(i=Ar(e)),delete i[n])}(e,i);let k=s?null:AB(AD(e));if(e._editable&&null!==k&&(c||null===u||u.dirty||!u.is(l))&&null!==o&&!b.has("skip-dom-selection")){C8=e,C6=i;try{if(null!==m&&m.disconnect(),c||null===u||u.dirty){let t=e._blockCursorElement;null!==t&&Az(t,e,o),function(e,t,n,r,i,o){var s;let a=r.anchorNode,l=r.focusNode,u=r.anchorOffset,c=r.focusOffset,d=document.activeElement;if(i.has("collaboration")&&d!==o||null!==d&&EG(d))return;if(!CM(t))return null!==e&&Eq(n,a,l)&&r.removeAllRanges();let h=t.anchor,f=t.focus,p=h.getNode(),m=f.getNode(),[g,y]=C2(n,p,h.offset),[v,x]=C2(n,m,f.offset),b=t.format,w=t.style,k=t.isCollapsed(),_=g,S=v,C=!1;if("text"===h.type?(_=E2(g),C=p.getFormat()!==b||p.getStyle()!==w):CM(e)&&"text"===e.anchor.type&&(C=!0),"text"===f.type&&(S=E2(v)),null!==_&&null!==S&&(k&&(null===e||C||CM(e)&&(e.format!==b||e.style!==w))&&(s=h.key,SR=[b,w,y,s,performance.now()]),u!==y||c!==x||a!==_||l!==S||"Range"===r.type&&k||(null!==d&&o.contains(d)||i.has(S6)||o.focus({preventScroll:!0}),"element"===h.type))){if(C1(r,_,y,S,x),!kE||!t.isCollapsed()||null===o||i.has(S6)||null!==document.activeElement&&o.contains(document.activeElement)||o.focus({preventScroll:!0}),!i.has("skip-scroll-into-view")&&t.isCollapsed()&&null!==o&&o===document.activeElement){let e=CM(t)&&"element"===t.anchor.type?_.childNodes[y]||null:r.rangeCount>0?r.getRangeAt(0):null;if(null!==e){let t;if(e instanceof Text){let n=document.createRange();n.selectNode(e),t=n.getBoundingClientRect()}else t=e.getBoundingClientRect();!function(e,t,n){let r=AN(n),i=AM(r);if(null===r||null===i)return;let{top:o,bottom:s}=t,a=0,l=0,u=n;for(;null!==u;){let t=u===r.body;if(t){a=0,l=AD(e).innerHeight;let t=i.getComputedStyle(r.documentElement),n=parseFloat(t.scrollPaddingTop),o=parseFloat(t.scrollPaddingBottom);isFinite(n)&&(a+=n),isFinite(o)&&(l-=o)}else{let e=u.getBoundingClientRect();a=e.top,l=e.bottom}let n=0;if(o<a?n=-(a-o):s>l&&(n=s-l),0!==n)if(t)i.scrollBy(0,n);else{let e=u.scrollTop;u.scrollTop+=n;let t=u.scrollTop-e;o-=t,s-=t}if(t)break;u=AT(u)}}(n,t,o)}}SA=!0}}(l,u,e,k,b,o)}!function(e,t,n){let r=e._blockCursorElement;if(CM(n)&&n.isCollapsed()&&"element"===n.anchor.type&&t.contains(document.activeElement)){let i=n.anchor,o=i.getNode(),s=i.offset,a=!1,l=null;if(s===o.getChildrenSize())AF(o.getChildAtIndex(s-1))&&(a=!0);else{let t=o.getChildAtIndex(s);if(null!==t&&AF(t)){let n=t.getPreviousSibling();(null===n||AF(n))&&(a=!0,l=e.getElementByKey(t.__key))}}if(a){let n,i,s,a=e.getElementByKey(o.__key);return null===r&&(n=e._config.theme,(i=document.createElement("div")).contentEditable="false",i.setAttribute("data-lexical-cursor","true"),s=n.blockCursor,void 0!==s&&("string"==typeof s&&(s=n.blockCursor=TI(s)),void 0!==s&&i.classList.add(...s)),e._blockCursorElement=r=i),t.style.caretColor="transparent",null===l?a.appendChild(r):a.insertBefore(r,l)}}null!==r&&Az(r,e,t)}(e,o,u)}finally{null!==m&&m.observe(o,Et),C8=f,C6=d}}null!==g&&function(e,t,n,r,i){let o=Array.from(e._listeners.mutation),s=o.length;for(let e=0;e<s;e++){let[s,a]=o[e];for(let e of a){let o=t.get(e);void 0!==o&&s(o,{dirtyLeaves:r,prevEditorState:i,updateTags:n})}}}(e,g,b,y,a),CM(u)||null===u||null!==l&&l.is(u)||e.dispatchCommand(_R,void 0);let _=e._pendingDecorators;null!==_&&(e._decorators=_,e._pendingDecorators=null,Ep("decorator",e,!0,_)),n=Ai(t||a),n!==(r=Ai(i))&&Ep("textcontent",e,!0,r),Ep("update",e,!0,{dirtyElements:v,dirtyLeaves:y,editorState:i,mutatedNodes:g,normalizedNodes:x,prevEditorState:t||a,tags:b}),Em(e,w),function(e){let t=e._updates;if(0!==t.length){let n=t.shift();if(n){let[t,r]=n;Ey(e,t,r)}}}(e)}function Ep(e,t,n,...r){let i=t._updating;t._updating=n;try{let n=t._listeners[e];for(let[e,t]of Array.from(n)){t&&t();let i=e(...r);n.has(e)?n.set(e,i):i&&i()}}finally{t._updating=i}}function Em(e,t){if(e._deferred=[],0!==t.length){let n=e._updating;e._updating=!0;try{for(let e=0;e<t.length;e++)t[e]()}finally{e._updating=n}}}function Eg(e,t){let n=e._updates,r=t||!1;for(;0!==n.length;){let t=n.shift();if(t){let n,[i,o]=t,s=e._pendingEditorState;void 0!==o&&(n=o.onUpdate,o.skipTransforms&&(r=!0),o.discrete&&(null===s&&kw(191),s._flushSync=!0),n&&e._deferred.push(n),Ec(e,o.tag)),null==s?Ey(e,i,o):i()}}return r}function Ey(e,t,n){let r=e._updateTags,i,o=!1,s=!1;void 0!==n&&(i=n.onUpdate,Ec(e,n.tag),o=n.skipTransforms||!1,s=n.discrete||!1),i&&e._deferred.push(i);let a=e._editorState,l=e._pendingEditorState,u=!1;(null===l||l._readOnly)&&(l=e._pendingEditorState=ET(l||a),u=!0),l._flushSync=s;let c=C6,d=C9,h=C8,f=e._updating;C6=l,C9=!1,e._updating=!0,C8=e;let p=e._headless||null===e.getRootElement();EU=null;try{var m;let r,i;u&&(p?null!==a._selection&&(l._selection=a._selection.clone()):l._selection=(m=n&&n.event||null,r=e.getEditorState()._selection,i=AB(AD(e)),CM(r)||null==r?Cq(r,i,e,m):r.clone()));let s=e._compositionKey;t(),o=Eg(e,o),function(e,t){let n=t.getEditorState()._selection,r=e._selection;if(CM(r)){let e,t=r.anchor,i=r.focus;if("text"===t.type&&(e=t.getNode()).selectionTransform(n,r),"text"===i.type){let t=i.getNode();e!==t&&t.selectionTransform(n,r)}}}(l,e),0!==e._dirtyType&&(o?function(e,t){let n=t._dirtyLeaves,r=e._nodeMap;for(let e of n){let t=r.get(e);Ck(t)&&t.isAttached()&&t.isSimpleText()&&!t.isUnmergeable()&&_e(t)}}(l,e):function(e,t){let n=t._dirtyLeaves,r=t._dirtyElements,i=e._nodeMap,o=E9(),s=new Map,a=n,l=a.size,u=r,c=u.size;for(;l>0||c>0;){if(l>0){for(let e of(t._dirtyLeaves=new Set,a)){let r=i.get(e);Ck(r)&&r.isAttached()&&r.isSimpleText()&&!r.isUnmergeable()&&_e(r),void 0!==r&&Eu(r,o)&&El(t,r,s),n.add(e)}if((l=(a=t._dirtyLeaves).size)>0){Ee++;continue}}for(let e of(t._dirtyLeaves=new Set,t._dirtyElements=new Map,u.delete("root")&&u.set("root",!0),u)){let n=e[0],a=e[1];if(r.set(n,a),!a)continue;let l=i.get(n);void 0!==l&&Eu(l,o)&&El(t,l,s)}l=(a=t._dirtyLeaves).size,c=(u=t._dirtyElements).size,Ee++}t._dirtyLeaves=n,t._dirtyElements=r}(l,e),Eg(e),function(e,t,n,r){let i=e._nodeMap,o=t._nodeMap,s=[];for(let[e]of r){let t=o.get(e);void 0!==t&&(t.isAttached()||(Ek(t)&&function e(t,n,r,i,o,s){let a=t.getFirstChild();for(;null!==a;){let t=a.__key;a.__parent===n&&(Ek(a)&&e(a,t,r,i,o,s),r.has(t)||s.delete(t),o.push(t)),a=a.getNextSibling()}}(t,e,i,o,s,r),i.has(e)||r.delete(e),s.push(e)))}for(let e of s)o.delete(e);for(let e of n){let t=o.get(e);void 0===t||t.isAttached()||(i.has(e)||n.delete(e),o.delete(e))}}(a,l,e._dirtyLeaves,e._dirtyElements)),s!==e._compositionKey&&(l._flushSync=!0);let c=l._selection;if(CM(c)){let e=l._nodeMap,t=c.anchor.key,n=c.focus.key;void 0!==e.get(t)&&void 0!==e.get(n)||kw(19)}else CR(c)&&0===c._nodes.size&&(l._selection=null)}catch(t){return t instanceof Error&&e._onError(t),e._pendingEditorState=a,e._dirtyType=2,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements.clear(),void Ef(e)}finally{C6=c,C9=d,C8=h,e._updating=f,Ee=0}0!==e._dirtyType||e._deferred.length>0||function(e,t){let n=t.getEditorState()._selection,r=e._selection;if(null!==r){if(r.dirty||!r.is(n))return!0}else if(null!==n)return!0;return!1}(l,e)?l._flushSync?(l._flushSync=!1,Ef(e)):u&&EK(()=>{Ef(e)}):(l._flushSync=!1,u&&(r.clear(),e._deferred=[],e._pendingEditorState=null))}function Ev(e,t,n){C8===e&&void 0===n?t():Ey(e,t,n)}class Ex{element;before;after;constructor(e,t,n){this.element=e,this.before=t||null,this.after=n||null}withBefore(e){return new Ex(this.element,e,this.after)}withAfter(e){return new Ex(this.element,this.before,e)}withElement(e){return this.element===e?this:new Ex(e,this.before,this.after)}insertChild(e){let t=this.before||this.getManagedLineBreak();return null!==t&&t.parentElement!==this.element&&kw(222),this.element.insertBefore(e,t),this}removeChild(e){return e.parentElement!==this.element&&kw(223),this.element.removeChild(e),this}replaceChild(e,t){return t.parentElement!==this.element&&kw(224),this.element.replaceChild(e,t),this}getFirstChild(){let e=this.after?this.after.nextSibling:this.element.firstChild;return e===this.before||e===this.getManagedLineBreak()?null:e}getManagedLineBreak(){return this.element.__lexicalLineBreak||null}setManagedLineBreak(e){null===e?this.removeManagedLineBreak():this.insertManagedLineBreak("decorator"===e&&(kD||kT||kj))}removeManagedLineBreak(){let e=this.getManagedLineBreak();if(e){let t=this.element,n="IMG"===e.nodeName?e.nextSibling:null;n&&t.removeChild(n),t.removeChild(e),t.__lexicalLineBreak=void 0}}insertManagedLineBreak(e){let t=this.getManagedLineBreak();if(t){if(e===("IMG"===t.nodeName))return;this.removeManagedLineBreak()}let n=this.element,r=this.before,i=document.createElement("br");if(n.insertBefore(i,r),e){let e=document.createElement("img");e.setAttribute("data-lexical-linebreak","true"),e.style.setProperty("display","inline","important"),e.style.setProperty("border","0px","important"),e.style.setProperty("margin","0px","important"),e.alt="",n.insertBefore(e,i),n.__lexicalLineBreak=e}else n.__lexicalLineBreak=i}getFirstChildOffset(){let e=0;for(let t=this.after;null!==t;t=t.previousSibling)e++;return e}resolveChildIndex(e,t,n,r){if(n===this.element){let t=this.getFirstChildOffset();return[e,Math.min(t+e.getChildrenSize(),Math.max(t,r))]}let i=Eb(t,n);i.push(r);let o=Eb(t,this.element),s=e.getIndexWithinParent();for(let e=0;e<o.length;e++){let t=i[e],n=o[e];if(void 0===t||t<n)break;if(t>n){s+=1;break}}return[e.getParentOrThrow(),s]}}function Eb(e,t){let n=[],r=t;for(;r!==e&&null!==r;r=r.parentNode){let e=0;for(let t=r.previousSibling;null!==t;t=t.previousSibling)e++;n.push(e)}return r!==e&&kw(225),n.reverse()}class Ew extends S2{__first;__last;__size;__format;__style;__indent;__dir;__textFormat;__textStyle;constructor(e){super(e),this.__first=null,this.__last=null,this.__size=0,this.__format=0,this.__style="",this.__indent=0,this.__dir=null,this.__textFormat=0,this.__textStyle=""}afterCloneFrom(e){super.afterCloneFrom(e),this.__key===e.__key&&(this.__first=e.__first,this.__last=e.__last,this.__size=e.__size),this.__indent=e.__indent,this.__format=e.__format,this.__style=e.__style,this.__dir=e.__dir,this.__textFormat=e.__textFormat,this.__textStyle=e.__textStyle}getFormat(){return this.getLatest().__format}getFormatType(){return k$[this.getFormat()]||""}getStyle(){return this.getLatest().__style}getIndent(){return this.getLatest().__indent}getChildren(){let e=[],t=this.getFirstChild();for(;null!==t;)e.push(t),t=t.getNextSibling();return e}getChildrenKeys(){let e=[],t=this.getFirstChild();for(;null!==t;)e.push(t.__key),t=t.getNextSibling();return e}getChildrenSize(){return this.getLatest().__size}isEmpty(){return 0===this.getChildrenSize()}isDirty(){let e=Es()._dirtyElements;return null!==e&&e.has(this.__key)}isLastChild(){let e=this.getLatest(),t=this.getParentOrThrow().getLastChild();return null!==t&&t.is(e)}getAllTextNodes(){let e=[],t=this.getFirstChild();for(;null!==t;){if(Ck(t)&&e.push(t),Ek(t)){let n=t.getAllTextNodes();e.push(...n)}t=t.getNextSibling()}return e}getFirstDescendant(){let e=this.getFirstChild();for(;Ek(e);){let t=e.getFirstChild();if(null===t)break;e=t}return e}getLastDescendant(){let e=this.getLastChild();for(;Ek(e);){let t=e.getLastChild();if(null===t)break;e=t}return e}getDescendantByIndex(e){let t=this.getChildren(),n=t.length;if(e>=n){let e=t[n-1];return Ek(e)&&e.getLastDescendant()||e||null}let r=t[e];return Ek(r)&&r.getFirstDescendant()||r||null}getFirstChild(){let e=this.getLatest().__first;return null===e?null:E7(e)}getFirstChildOrThrow(){let e=this.getFirstChild();return null===e&&kw(45,this.__key),e}getLastChild(){let e=this.getLatest().__last;return null===e?null:E7(e)}getLastChildOrThrow(){let e=this.getLastChild();return null===e&&kw(96,this.__key),e}getChildAtIndex(e){let t,n,r=this.getChildrenSize();if(e<r/2){for(t=this.getFirstChild(),n=0;null!==t&&n<=e;){if(n===e)return t;t=t.getNextSibling(),n++}return null}for(t=this.getLastChild(),n=r-1;null!==t&&n>=e;){if(n===e)return t;t=t.getPreviousSibling(),n--}return null}getTextContent(){let e="",t=this.getChildren(),n=t.length;for(let r=0;r<n;r++){let i=t[r];e+=i.getTextContent(),Ek(i)&&r!==n-1&&!i.isInline()&&(e+="\n\n")}return e}getTextContentSize(){let e=0,t=this.getChildren(),n=t.length;for(let r=0;r<n;r++){let i=t[r];e+=i.getTextContentSize(),Ek(i)&&r!==n-1&&!i.isInline()&&(e+=2)}return e}getDirection(){return this.getLatest().__dir}getTextFormat(){return this.getLatest().__textFormat}hasFormat(e){if(""!==e){let t=kB[e];return 0!=(this.getFormat()&t)}return!1}hasTextFormat(e){let t=kF[e];return 0!=(this.getTextFormat()&t)}getFormatFlags(e,t){return E5(this.getLatest().__textFormat,e,t)}getTextStyle(){return this.getLatest().__textStyle}select(e,t){Er();let n=CJ(),r=e,i=t,o=this.getChildrenSize();if(!this.canBeEmpty()){if(0===e&&0===t){let e=this.getFirstChild();if(Ck(e)||Ek(e))return e.select(0,0)}else if((void 0===e||e===o)&&(void 0===t||t===o)){let e=this.getLastChild();if(Ck(e)||Ek(e))return e.select()}}void 0===r&&(r=o),void 0===i&&(i=o);let s=this.__key;return CM(n)?(n.anchor.set(s,r,"element"),n.focus.set(s,i,"element"),n.dirty=!0,n):CH(s,r,s,i,"element","element")}selectStart(){let e=this.getFirstDescendant();return e?e.selectStart():this.select()}selectEnd(){let e=this.getLastDescendant();return e?e.selectEnd():this.select()}clear(){let e=this.getWritable();return this.getChildren().forEach(e=>e.remove()),e}append(...e){return this.splice(this.getChildrenSize(),0,e)}setDirection(e){let t=this.getWritable();return t.__dir=e,t}setFormat(e){return this.getWritable().__format=""!==e&&kB[e]||0,this}setStyle(e){return this.getWritable().__style=e||"",this}setTextFormat(e){let t=this.getWritable();return t.__textFormat=e,t}setTextStyle(e){let t=this.getWritable();return t.__textStyle=e,t}setIndent(e){return this.getWritable().__indent=e,this}splice(e,t,n){S1(this)&&kw(324,this.__key,this.__type);let r=this.getChildrenSize(),i=this.getWritable();e+t<=r||kw(226,String(e),String(t),String(r));let o=i.__key,s=[],a=[],l=this.getChildAtIndex(e+t),u=null,c=r-t+n.length;if(0!==e)if(e===r)u=this.getLastChild();else{let t=this.getChildAtIndex(e);null!==t&&(u=t.getPreviousSibling())}if(t>0){let e=null===u?this.getFirstChild():u.getNextSibling();for(let n=0;n<t;n++){null===e&&kw(100);let t=e.getNextSibling(),n=e.__key;E4(e.getWritable()),a.push(n),e=t}}let d=u;for(let e of n){null!==d&&e.is(d)&&(u=d=d.getPreviousSibling());let t=e.getWritable();t.__parent===o&&c--,E4(t);let n=e.__key;if(null===d)i.__first=n,t.__prev=null;else{let e=d.getWritable();e.__next=n,t.__prev=e.__key}e.__key===o&&kw(76),t.__parent=o,s.push(n),d=e}if(e+t===r)null!==d&&(d.getWritable().__next=null,i.__last=d.__key);else if(null!==l){let e=l.getWritable();if(null!==d){let t=d.getWritable();e.__prev=d.__key,t.__next=l.__key}else e.__prev=null}if(i.__size=c,a.length){let e=CJ();if(CM(e)){let t=new Set(a),n=new Set(s),{anchor:r,focus:i}=e;E_(r,t,n)&&CQ(r,r.getNode(),this,u,l),E_(i,t,n)&&CQ(i,i.getNode(),this,u,l),0!==c||this.canBeEmpty()||AR(this)||this.remove()}}return i}getDOMSlot(e){return new Ex(e)}exportDOM(e){let{element:t}=super.exportDOM(e);if(A$(t)){let e=this.getIndent();e>0&&(t.style.paddingInlineStart=40*e+"px");let n=this.getDirection();n&&(t.dir=n)}return{element:t}}exportJSON(){let e={children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),...super.exportJSON()},t=this.getTextFormat(),n=this.getTextStyle();return 0===t&&""===n||AR(this)||this.getChildren().some(Ck)||(0!==t&&(e.textFormat=t),""!==n&&(e.textStyle=n)),e}updateFromJSON(e){return super.updateFromJSON(e).setFormat(e.format).setIndent(e.indent).setDirection(e.direction).setTextFormat(e.textFormat||0).setTextStyle(e.textStyle||"")}insertNewAfter(e,t){return null}canIndent(){return!0}collapseAtStart(e){return!1}excludeFromCopy(e){return!1}canReplaceWith(e){return!0}canInsertAfter(e){return!0}canBeEmpty(){return!0}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}isInline(){return!1}isShadowRoot(){return!1}canMergeWith(e){return!1}extractWithChild(e,t,n){return!1}canMergeWhenEmpty(){return!1}reconcileObservedMutation(e,t){let n=Aq(t).$getDOMSlot(this,e,t),r=n.getFirstChild();for(let e=this.getFirstChild();e;e=e.getNextSibling()){let i=t.getElementByKey(e.getKey());null!==i&&(null==r?(n.insertChild(i),r=i):r!==i&&n.replaceChild(i,r),r=r.nextSibling)}}}function Ek(e){return e instanceof Ew}function E_(e,t,n){let r=e.getNode();for(;r;){let e=r.__key;if(t.has(e)&&!n.has(e))return!0;r=r.getParent()}return!1}class ES extends S2{decorate(e,t){return null}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}}function EC(e){return e instanceof ES}class EE extends Ew{__cachedText;static getType(){return"root"}static clone(){return new EE}constructor(){super("root"),this.__cachedText=null}getTopLevelElementOrThrow(){kw(51)}getTextContent(){let e=this.__cachedText;return(En()||0===Es()._dirtyType)&&null!==e?e:super.getTextContent()}remove(){kw(52)}replace(e){kw(53)}insertBefore(e){kw(54)}insertAfter(e){kw(55)}updateDOM(e,t){return!1}splice(e,t,n){for(let e of n)Ek(e)||EC(e)||kw(282);return super.splice(e,t,n)}static importJSON(e){return Ao().updateFromJSON(e)}collapseAtStart(){return!0}}function EA(e){return e instanceof EE}function ET(e){return new Ej(new Map(e._nodeMap))}function EN(){return new Ej(new Map([["root",new EE]]))}class Ej{_nodeMap;_selection;_flushSync;_readOnly;constructor(e,t){this._nodeMap=e,this._selection=t||null,this._flushSync=!1,this._readOnly=!1}isEmpty(){return 1===this._nodeMap.size&&null===this._selection}read(e,t){return Eh(t&&t.editor||null,this,e)}clone(e){let t=new Ej(this._nodeMap,void 0===e?this._selection:e);return t._readOnly=!0,t}toJSON(){return Eh(null,this,()=>({root:function e(t){let n=t.exportJSON(),r=t.constructor;if(n.type!==r.getType()&&kw(130,r.name),Ek(t)){let i=n.children;Array.isArray(i)||kw(59,r.name);let o=t.getChildren();for(let t=0;t<o.length;t++){let n=e(o[t]);i.push(n)}}return n}(Ao())}))}}class EP extends Ew{static getType(){return"artificial"}createDOM(e){return document.createElement("div")}}class EM extends Ew{static getType(){return"paragraph"}static clone(e){return new EM(e.__key)}createDOM(e){let t=document.createElement("p"),n=Aw(e.theme,"paragraph");return void 0!==n&&t.classList.add(...n),t}updateDOM(e,t,n){return!1}static importDOM(){return{p:e=>({conversion:ED,priority:0})}}exportDOM(e){let{element:t}=super.exportDOM(e);if(A$(t)){this.isEmpty()&&t.append(document.createElement("br"));let e=this.getFormatType();e&&(t.style.textAlign=e)}return{element:t}}static importJSON(e){return ER().updateFromJSON(e)}exportJSON(){let e=super.exportJSON();if(void 0===e.textFormat||void 0===e.textStyle){let t=this.getChildren().find(Ck);t?(e.textFormat=t.getFormat(),e.textStyle=t.getStyle()):(e.textFormat=this.getTextFormat(),e.textStyle=this.getTextStyle())}return e}insertNewAfter(e,t){let n=ER();n.setTextFormat(e.format),n.setTextStyle(e.style);let r=this.getDirection();return n.setDirection(r),n.setFormat(this.getFormatType()),n.setStyle(this.getStyle()),this.insertAfter(n,t),n}collapseAtStart(){let e=this.getChildren();if(0===e.length||Ck(e[0])&&""===e[0].getTextContent().trim()){if(null!==this.getNextSibling())return this.selectNext(),this.remove(),!0;if(null!==this.getPreviousSibling())return this.selectPrevious(),this.remove(),!0}return!1}}function ED(e){let t=ER();if(e.style&&(t.setFormat(e.style.textAlign),AQ(e,t)),""===t.getFormatType()){let n=e.getAttribute("align");n&&n&&n in kB&&t.setFormat(n)}return{node:t}}function ER(){return AO(new EM)}function EL(e){return e instanceof EM}function EO(e,t,n,r){let i=e._keyToDOMMap;i.clear(),e._editorState=EN(),e._pendingEditorState=r,e._compositionKey=null,e._dirtyType=0,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements.clear(),e._normalizedNodes=new Set,e._updateTags=new Set,e._updates=[],e._blockCursorElement=null;let o=e._observer;null!==o&&(o.disconnect(),e._observer=null),null!==t&&(t.textContent=""),null!==n&&(n.textContent="",i.set("root",n))}let EI={$createDOM:(e,t)=>e.createDOM(t._config,t),$decorateDOM:(e,t,n,r)=>{},$exportDOM:(e,t)=>{let n=EH(t,e.getType());return n&&void 0!==n.exportDOM?n.exportDOM(t,e):e.exportDOM(t)},$extractWithChild:(e,t,n,r,i)=>Ek(e)&&e.extractWithChild(t,n,r),$getDOMSlot:(e,t,n)=>(Ek(e)||kw(336,e.getKey(),e.getType()),e.getDOMSlot(t)),$shouldExclude:(e,t,n)=>Ek(e)&&e.excludeFromCopy("html"),$shouldInclude:(e,t,n)=>!t||e.isSelected(t),$updateDOM:(e,t,n,r)=>e.updateDOM(t,n,r._config)};function EF(e){var t,n;let r,i,o,s,a=e||{},l=C8,u=a.theme||{},c=void 0===e?l:a.parentEditor||null,d=a.disableEvents||!1,h=EN(),f=a.namespace||(null!==c?c._config.namespace:Ad()),p=a.editorState,m=[EE,Cf,Cn,CS,EM,EP,...a.nodes||[]],{onError:g,html:y}=a,v=void 0===a.editable||a.editable;if(void 0===e&&null!==l)r=l._nodes;else{r=new Map;for(let e=0;e<m.length;e++){let t=m[e],n=null,i=null;if("function"!=typeof t){let e=t;t=e.replace,n=e.with,i=e.withKlass||null}A1(t);let o=t.getType(),s=function(e){let t=new Set,n=new Set,r=e;for(;r;){let{ownNodeConfig:e}=A1(r),i=r.transform;if(!n.has(i)){n.add(i);let e=r.transform();e&&t.add(e)}if(e){let n=e.$transform;n&&t.add(n),r=e.extends}else{let e=Object.getPrototypeOf(r);r=e.prototype instanceof S2&&e!==S2?e:void 0}}return t}(t);r.set(o,{exportDOM:y&&y.export?y.export.get(t):void 0,klass:t,replace:n,replaceWithKlass:i,sharedNodeState:function(e){let t=new Map,n=new Set;for(let r="function"==typeof e?e:e.replace;r.prototype&&void 0!==r.prototype.getType;r=Object.getPrototypeOf(r)){let{ownNodeConfig:e}=A1(r);if(e&&e.stateConfigs)for(let r of e.stateConfigs){let e;"stateConfig"in r?(e=r.stateConfig,r.flat&&n.add(e.key)):e=r,t.set(e.key,e)}}return{flatKeys:n,sharedConfigMap:t}}(m[e]),transforms:s})}}let x=new E$(h,c,r,{disableEvents:d,dom:{...EI,...e&&e.dom},namespace:f,theme:u},g||console.error,(t=r,n=y?y.import:void 0,i=new Map,o=new Set,s=e=>{Object.keys(e).forEach(t=>{let n=i.get(t);void 0===n&&(n=[],i.set(t,n)),n.push(e[t])})},t.forEach(e=>{let t=e.klass.importDOM;if(null==t||o.has(t))return;o.add(t);let n=t.call(e.klass);null!==n&&s(n)}),n&&s(n),i),v,e);return void 0!==p&&(x._pendingEditorState=p,x._dirtyType=2),x.registerCommand(_I,S$,0),x.registerCommand(_F,SU,0),x.registerCommand(_z,SV,0),x.registerCommand(_B,SW,0),x.registerCommand(_Z,SK,0),x}function Ez(e,t){let n=e.get(t);e.delete(t),n&&n()}function EB(e,t,n){return e.set(t,n),Ez.bind(null,e,t)}class E${static version;_headless;_parentEditor;_rootElement;_editorState;_pendingEditorState;_compositionKey;_deferred;_keyToDOMMap;_updates;_updating;_listeners;_commands;_nodes;_decorators;_pendingDecorators;_config;_dirtyType;_cloneNotNeeded;_dirtyLeaves;_dirtyElements;_normalizedNodes;_updateTags;_observer;_key;_onError;_htmlConversions;_window;_editable;_blockCursorElement;_createEditorArgs;constructor(e,t,n,r,i,o,s,a){this._createEditorArgs=a,this._parentEditor=t,this._rootElement=null,this._editorState=e,this._pendingEditorState=null,this._compositionKey=null,this._deferred=[],this._keyToDOMMap=new Map,this._updates=[],this._updating=!1,this._listeners={decorator:new Map,editable:new Map,mutation:new Map,root:new Map,textcontent:new Map,update:new Map},this._commands=new Map,this._config=r,this._nodes=n,this._decorators={},this._pendingDecorators=null,this._dirtyType=0,this._cloneNotNeeded=new Set,this._dirtyLeaves=new Set,this._dirtyElements=new Map,this._normalizedNodes=new Set,this._updateTags=new Set,this._observer=null,this._key=Ad(),this._onError=i,this._htmlConversions=o,this._editable=s,this._headless=null!==t&&t._headless,this._window=null,this._blockCursorElement=null}isComposing(){return null!=this._compositionKey}registerUpdateListener(e){return EB(this._listeners.update,e)}registerEditableListener(e){return EB(this._listeners.editable,e)}registerDecoratorListener(e){return EB(this._listeners.decorator,e)}registerTextContentListener(e){return EB(this._listeners.textcontent,e)}registerRootListener(e){let t=this._listeners.root;return TF(EB(t,e,e(this._rootElement,null)||void 0),()=>{var n;let r;return n=[null,this._rootElement],void((r=t.get(e))&&r(),t.set(e,e(...n)||void 0))})}registerCommand(e,t,n){void 0===n&&kw(35);let r=this._commands;r.has(e)||r.set(e,[new kH,new kH,new kH,new kH,new kH]);let i=r.get(e);void 0===i&&kw(36,String(e));let o=7&n,s=i[o];return o!==n?s.addFront(t):s.addBack(t),()=>{s.delete(t),i.every(e=>0===e.size)&&r.delete(e)}}registerMutationListener(e,t,n){let r=this.resolveRegisteredNodeAfterReplacements(this.getRegisteredNode(e)).klass,i=this._listeners.mutation,o=i.get(t);void 0===o&&(o=new Set,i.set(t,o)),o.add(r);let s=n&&n.skipInitialization;return void 0!==s&&s||this.initializeMutationListener(t,r),()=>{o.delete(r),0===o.size&&i.delete(t)}}getRegisteredNode(e){let t=this._nodes.get(e.getType());return void 0===t&&kw(37,e.name),t}resolveRegisteredNodeAfterReplacements(e){for(;e.replaceWithKlass;)e=this.getRegisteredNode(e.replaceWithKlass);return e}initializeMutationListener(e,t){let n=this._editorState,r=AX(n).get(t.getType());if(!r)return;let i=new Map;for(let e of r.keys())i.set(e,"created");i.size>0&&e(i,{dirtyLeaves:new Set,prevEditorState:n,updateTags:new Set(["registerMutationListener"])})}registerNodeTransformToKlass(e,t){let n=this.getRegisteredNode(e);return n.transforms.add(t),n}registerNodeTransform(e,t){let n=this.registerNodeTransformToKlass(e,t),r=[n],i=n.replaceWithKlass;if(null!=i){let e=this.registerNodeTransformToKlass(i,t);r.push(e)}return function(e,t){let n=AX(e.getEditorState()),r=[];for(let e of t){let t=n.get(e);t&&r.push(t)}0!==r.length&&e.update(()=>{for(let e of r)for(let t of e.keys()){let e=E7(t);e&&e.markDirty()}},null===e._pendingEditorState?{tag:S4}:void 0)}(this,r.map(e=>e.klass.getType())),()=>{r.forEach(e=>e.transforms.delete(t))}}hasNode(e){return this._nodes.has(e.getType())}hasNodes(e){return e.every(this.hasNode.bind(this))}dispatchCommand(e,t){return AE(this,e,t)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(e){let t=this._rootElement;if(e!==t){let n=Aw(this._config.theme,"root"),r=this._pendingEditorState||this._editorState;if(this._rootElement=e,EO(this,t,e,r),null!==t&&(this._config.disableEvents||function(e){let t=SC.get(e);if(void 0===t)return SZ();let n=SE.get(t);if(void 0===n)return SZ();let r=n-1;r>=0||kw(164),SC.delete(e),SE.set(t,r),0===r&&t.removeEventListener("selectionchange",SJ);let i=EX(e);EJ(i)?(!function(e){if(null!==e._parentEditor){let t=Ac(e),n=t[t.length-1]._key;Sq.get(n)===e&&Sq.delete(n)}else Sq.delete(e._key)}(i),e.__lexicalEditor=null):i&&kw(198);let o=SG(e);for(let e=0;e<o.length;e++)o[e]();e.__lexicalEventHandles=[]}(t),null!=n&&t.classList.remove(...n)),null!==e){let t=AM(e),r=e.style;r.userSelect="text",r.whiteSpace="pre-wrap",r.wordBreak="break-word",e.setAttribute("data-lexical-editor","true"),this._window=t,this._dirtyType=2,kZ(this),this._updateTags.add(S4),Ef(this),this._config.disableEvents||function(e,t){let n=e.ownerDocument;SC.set(e,n);let r=SE.get(n)??0;r<1&&n.addEventListener("selectionchange",SJ),SE.set(n,r+1),e.__lexicalEditor=t;let i=SG(e);for(let n=0;n<Sb.length;n++){let[r,o]=Sb[n],s="function"==typeof o?e=>{SX(e)||(SY(e),(t.isEditable()||"click"===r)&&o(e,t))}:e=>{if(SX(e))return;SY(e);let n=t.isEditable();switch(r){case"cut":return n&&AE(t,Sc,e);case"copy":return AE(t,Su,e);case"paste":return n&&AE(t,_H,e);case"dragstart":return n&&AE(t,Ss,e);case"dragover":return n&&AE(t,Sa,e);case"dragend":return n&&AE(t,Sl,e);case"focus":return n&&AE(t,Sg,e);case"blur":return n&&AE(t,Sy,e);case"drop":return n&&AE(t,Si,e)}};e.addEventListener(r,s),i.push(()=>{e.removeEventListener(r,s)})}}(e,this),null!=n&&e.classList.add(...n)}else this._window=null,this._updateTags.add(S4),Ef(this);Ep("root",this,!1,e,t)}}getElementByKey(e){return this._keyToDOMMap.get(e)||null}getEditorState(){return this._editorState}setEditorState(e,t){e.isEmpty()&&kw(38);let n=e;n._readOnly&&((n=ET(e))._selection=e._selection?e._selection.clone():null),kX(this);let r=this._pendingEditorState,i=this._updateTags,o=void 0!==t?t.tag:null;null===r||r.isEmpty()||(null!=o&&i.add(o),Ef(this)),this._pendingEditorState=n,this._dirtyType=2,this._dirtyElements.set("root",!1),this._compositionKey=null,null!=o&&i.add(o),this._updating||Ef(this)}parseEditorState(e,t){return function(e,t,n){let r=EN(),i=C6,o=C9,s=C8,a=t._dirtyElements,l=t._dirtyLeaves,u=t._cloneNotNeeded,c=t._dirtyType;t._dirtyElements=new Map,t._dirtyLeaves=new Set,t._cloneNotNeeded=new Set,t._dirtyType=0,C6=r,C9=!1,C8=t,EU=null;try{let i=t._nodes;Ed(e.root,i),n&&n(),r._readOnly=!0}catch(e){e instanceof Error&&t._onError(e)}finally{t._dirtyElements=a,t._dirtyLeaves=l,t._cloneNotNeeded=u,t._dirtyType=c,C6=i,C9=o,C8=s}return r}("string"==typeof e?JSON.parse(e):e,this,t)}read(e){return Ef(this),this.getEditorState().read(e,{editor:this})}update(e,t){this._updating?this._updates.push([e,t]):Ey(this,e,t)}focus(e,t={}){let n=this._rootElement;null!==n&&(n.setAttribute("autocapitalize","off"),Ev(this,()=>{var r;let i=CJ(),o=Ao();null!==i?i.dirty||Aa(i.clone()):0!==o.getChildrenSize()&&("rootStart"===t.defaultSelection?o.selectStart():o.selectEnd()),Aj("focus"),r=()=>{n.removeAttribute("autocapitalize"),e&&e()},Er(),Es()._deferred.push(r)}),null===this._pendingEditorState&&n.removeAttribute("autocapitalize"))}blur(){let e=this._rootElement;null!==e&&e.blur();let t=AB(this._window);null!==t&&t.removeAllRanges()}isEditable(){return this._editable}setEditable(e){this._editable!==e&&(this._editable=e,Ep("editable",this,!0,e))}toJSON(){return{editorState:this._editorState.toJSON()}}}E$.version="0.44.0+prod.esm";let EU=null,EV=1;function EW(e,t){let n=EH(e,t);return void 0===n&&kw(30,t),n}function EH(e,t){return e._nodes.get(t)}let EK="function"==typeof queueMicrotask?queueMicrotask:e=>{Promise.resolve().then(e)};function EG(e){let t=document.activeElement;if(!A$(t))return!1;let n=t.nodeName;return EC(An(e))&&("INPUT"===n||"TEXTAREA"===n||"true"===t.contentEditable&&null==EX(t))}function Eq(e,t,n){let r=e.getRootElement();try{return null!==r&&r.contains(t)&&r.contains(n)&&null!==t&&!EG(t)&&EY(t)===e}catch(e){return!1}}function EJ(e){return e instanceof E$}function EY(e){let t=e;for(;null!=t;){let e=EX(t);if(EJ(e))return e;t=AT(t)}return null}function EX(e){return e?e.__lexicalEditor:null}function EZ(e){return CE(e)||e.isToken()}function EQ(e){return EZ(e)||e.isSegmented()}function E0(e){return AU(e)&&3===e.nodeType}function E1(e){return AU(e)&&9===e.nodeType}function E2(e){let t=e;for(;null!=t;){if(E0(t))return t;t=t.firstChild}return null}function E5(e,t,n){let r=kF[t];if(null!==n&&(e&r)==(n&r))return e;let i=e^r;return"subscript"===t?i&=~kF.superscript:"superscript"===t?i&=~kF.subscript:"lowercase"===t?(i&=~kF.uppercase,i&=~kF.capitalize):"uppercase"===t?(i&=~kF.lowercase,i&=~kF.capitalize):"capitalize"===t&&(i&=~kF.lowercase,i&=~kF.uppercase),i}function E3(e,t){let n,r=(n=EU,EU=null,n);if(null!=(t=t||r&&r.__key))return void(e.__key=t);Er(),Ei();let i=Es(),o=Eo(),s=""+EV++;o._nodeMap.set(s,e),Ek(e)?i._dirtyElements.set(s,!0):i._dirtyLeaves.add(s),i._cloneNotNeeded.add(s),i._dirtyType=1,e.__key=s}function E4(e){let t=e.getParent();if(null!==t){let n=e.getWritable(),r=t.getWritable(),i=e.getPreviousSibling(),o=e.getNextSibling(),s=null!==o?o.__key:null,a=null!==i?i.__key:null,l=null!==i?i.getWritable():null,u=null!==o?o.getWritable():null;null===i&&(r.__first=s),null===o&&(r.__last=a),null!==l&&(l.__next=s),null!==u&&(u.__prev=a),n.__prev=null,n.__next=null,n.__parent=null,r.__size--}}function E6(e){Ei(),S1(e)&&kw(323,e.__key,e.__type);let t=e.getLatest(),n=t.__parent,r=Eo(),i=Es(),o=r._nodeMap,s=i._dirtyElements;null!==n&&function(e,t,n){let r=e;for(;null!==r;){if(n.has(r))return;let e=t.get(r);if(void 0===e)break;n.set(r,!1),r=e.__parent}}(n,o,s);let a=t.__key;i._dirtyType=1,Ek(e)?s.set(a,!0):i._dirtyLeaves.add(a)}function E8(e){Er();let t=Es(),n=t._compositionKey;if(e!==n){if(t._compositionKey=e,null!==n){let e=E7(n);null!==e&&e.getWritable()}if(null!==e){let t=E7(e);null!==t&&t.getWritable()}}}function E9(){return En()?null:Es()._compositionKey}function E7(e,t){let n=(t||Eo())._nodeMap.get(e);return void 0===n?null:n}function Ae(e,t){let n=At(e,Es());return void 0!==n?E7(n,t):null}function At(e,t){return e[`__lexicalKey_${t._key}`]}function An(e,t){let n=e;for(;null!=n;){let e=Ae(n,t);if(null!==e)return e;n=AT(n)}return null}function Ar(e){let t=Object.assign({},e._decorators);return e._pendingDecorators=t,t}function Ai(e){return e.read(()=>Ao().getTextContent())}function Ao(){return As(Eo())}function As(e){return e._nodeMap.get("root")}function Aa(e){Er();let t=Eo();null!==e&&(e.dirty=!0,e.setCachedNodes(null)),t._selection=e}function Al(e){let t=Es(),n=function(e,t){let n=e;for(;null!=n;){let e=At(n,t);if(void 0!==e)return e;n=AT(n)}return null}(e,t);return null===n?e===t.getRootElement()?E7("root"):null:E7(n)}function Au(e){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(e)}function Ac(e){let t=[];for(let n=e;null!==n;n=n._parentEditor)t.push(n);return t}function Ad(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,5)}function Ah(e){return E0(e)?e.nodeValue:null}function Af(e,t,n){let r=AB(AD(t));if(null===r)return;let i=r.anchorNode,{anchorOffset:o,focusOffset:s}=r;if(null!==i){let t=Ah(i),r=An(i);if(null!==t&&Ck(r)){if((t===kR||t===kL)&&n){let e=n.length;t=n,o=e,s=e}null!==t&&Ap(r,t,o,s,e)}}}function Ap(e,t,n,r,i){let o=e;if(o.isAttached()&&(i||!o.isDirty())){let s=o.isComposing(),a=t;if((s||i)&&(t.endsWith(kR)&&(a=t.slice(0,-kR.length)),i)){let e;for(;-1!==(e=a.indexOf(kL));)a=a.slice(0,e)+a.slice(e+kL.length),null!==n&&n>e&&(n=Math.max(e,n-kL.length)),null!==r&&r>e&&(r=Math.max(e,r-kL.length))}let l=o.getTextContent();if(i||a!==l){if(""===a){if(E8(null),kj||kT||kD)o.remove();else{let e=Es();setTimeout(()=>{e.update(()=>{o.isAttached()&&o.remove()})},20)}return}let t=o.getParent(),i=CY(),l=o.getTextContentSize(),u=E9(),c=o.getKey();if(o.isToken()||null!==u&&c===u&&!s||CM(i)&&(null!==t&&!t.canInsertTextBefore()&&0===i.anchor.offset||i.anchor.key===e.__key&&0===i.anchor.offset&&!o.canInsertTextBefore()&&!s||i.focus.key===e.__key&&i.focus.offset===l&&!o.canInsertTextAfter()&&!s))return void o.markDirty();let d=CJ();if(!CM(d)||null===n||null===r)return void Am(o,a,d);if(d.setTextNodeRange(o,n,o,r),o.isSegmented()){let e=Cw(o.getTextContent());o.replace(e),o=e}Am(o,a,d)}}}function Am(e,t,n){if(e.setTextContent(t),CM(n)){let t=e.getKey();for(let r of["anchor","focus"]){let i=n[r];"text"===i.type&&i.key===t&&(i.offset=Tu(e,i.offset,"clamp"))}}}function Ag(e,t,n){let r=t[n]||!1;return"any"===r||r===e[n]}function Ay(e,t,n){if(!(Ag(e,n,"altKey")&&Ag(e,n,"ctrlKey")&&Ag(e,n,"shiftKey")&&Ag(e,n,"metaKey")))return!1;if(e.key.toLowerCase()===t.toLowerCase())return!0;if(t.length>1||1===e.key.length&&127>=e.key.charCodeAt(0))return!1;if(e.code.startsWith("Digit")&&/^\d$/.test(t))return e.code===`Digit${t}`;let r="Key"+t.toUpperCase();return e.code===r}let Av={ctrlKey:!kC,metaKey:kC},Ax={altKey:kC,ctrlKey:!kC};function Ab(e){return"Backspace"===e.key}function Aw(e,t){void 0===e.__lexicalClassNameCache&&(e.__lexicalClassNameCache={});let n=e.__lexicalClassNameCache,r=n[t];if(void 0!==r)return r;let i=e[t];if("string"==typeof i){let e=TI(i);return n[t]=e,e}return i}function Ak(e,t,n,r,i){if(0===n.size)return;let o=r.__type,s=r.__key,a=t.get(o);void 0===a&&kw(33,o);let l=a.klass,u=e.get(l);void 0===u&&(u=new Map,e.set(l,u));let c=u.get(s),d="destroyed"===c&&"created"===i;(void 0===c||d)&&u.set(s,d?"updated":i)}function A_(e,t,n){let r=e.getParent(),i=n,o=e;return null!==r&&(t&&0===n?(i=o.getIndexWithinParent(),o=r):t||n!==o.getChildrenSize()||(i=o.getIndexWithinParent()+1,o=r)),o.getChildAtIndex(t?i-1:i)}function AS(e,t){let n=e.offset;if("element"===e.type)return A_(e.getNode(),t,n);{let r=e.getNode();if(t&&0===n||!t&&n===r.getTextContentSize()){let e=t?r.getPreviousSibling():r.getNextSibling();return null===e?A_(r.getParentOrThrow(),t,r.getIndexWithinParent()+ +!t):e}}return null}function AC(e){let t=AD(e).event,n=t&&t.inputType;return"insertFromPaste"===n||"insertFromPasteAsQuotation"===n}function AE(e,t,n){return function e(t,n,r,i){let o,s=Ac(t);for(let e=4;e>=0;e--)for(let t=0;t<s.length;t++){let a=s[t];if(t>0&&a._updating){o=a;break}let l=a._commands.get(n);if(void 0!==l){let t=l[e];if(t.size>0){let e=!1;if(Ev(a,()=>{for(let n of t)if(n(r,i))return void(e=!0)}),e)return e}}}return o&&o.update(()=>{e(o,n,r,i)}),!1}(e,t,n,e)}function AA(e,t){let n=e._keyToDOMMap.get(t);return void 0===n&&kw(75,t),n}function AT(e){let t=e.assignedSlot||e.parentElement;return AV(t)?t.host:t}function AN(e){return E1(e)?e:A$(e)?e.ownerDocument:null}function Aj(e){Er(),Es()._updateTags.add(e)}function AP(e,t){let n=e.getParent();for(;null!==n;){if(n.is(t))return!0;n=n.getParent()}return!1}function AM(e){let t=AN(e);return t?t.defaultView:null}function AD(e){let t=e._window;return null===t&&kw(78),t}function AR(e){return EA(e)||Ek(e)&&e.isShadowRoot()}function AL(e,t=!1){let n=e.constructor.clone(e);return E3(n,null),n.afterCloneFrom(e),t||n.resetOnCopyNodeFrom(e),n}function AO(e){let t=Es(),n=e.getType(),r=EH(t,n);void 0===r&&kw(200,e.constructor.name,n);let{replace:i,replaceWithKlass:o}=r;if(null!==i){let t=i(e),r=t.constructor;return null!==o?t instanceof o||kw(201,o.name,o.getType(),r.name,r.getType(),e.constructor.name,n):t instanceof e.constructor&&r!==e.constructor||kw(202,r.name,r.getType(),e.constructor.name,n),t.__key===e.__key&&kw(203,e.constructor.name,n,r.name,r.getType()),t}return e}function AI(e,t){!EA(e.getParent())||Ek(t)||EC(t)||kw(99)}function AF(e){return(EC(e)||Ek(e)&&!e.canBeEmpty())&&!e.isInline()}function Az(e,t,n){n.style.removeProperty("caret-color"),t._blockCursorElement=null;let r=e.parentElement;null!==r&&r.removeChild(e)}function AB(e){return k_?(e||window).getSelection():null}function A$(e){return AU(e)&&1===e.nodeType}function AU(e){return"object"==typeof e&&null!==e&&"nodeType"in e&&"number"==typeof e.nodeType}function AV(e){return AU(e)&&11===e.nodeType}function AW(e){let t=RegExp(/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|mark|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var|#text)$/,"i");return null!==e.nodeName.match(t)}function AH(e){let t=RegExp(/^(address|article|aside|blockquote|canvas|dd|div|dl|dt|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hr|li|main|nav|noscript|ol|p|pre|section|table|td|tfoot|ul|video)$/,"i");return null!==e.nodeName.match(t)}function AK(e){if(EC(e)&&!e.isInline())return!0;if(!Ek(e)||AR(e))return!1;let t=e.getFirstChild(),n=null===t||Co(t)||Ck(t)||t.isInline();return!e.isInline()&&!1!==e.canBeEmpty()&&n}function AG(){return Es()}function Aq(e=AG()){return e._config.dom||EI}let AJ=new WeakMap,AY=new Map;function AX(e){if(!e._readOnly&&e.isEmpty())return AY;e._readOnly||kw(192);let t=AJ.get(e);return t||(t=function(e){let t=new Map;for(let[n,r]of e._nodeMap){let e=r.__type,i=t.get(e);i||(i=new Map,t.set(e,i)),i.set(n,r)}return t}(e),AJ.set(e,t)),t}function AZ(e){let t=e.constructor.clone(e);return t.afterCloneFrom(e),t}function AQ(e,t){let n=Math.round((parseInt(e.style.paddingInlineStart,10)||0)/40);t.setIndent(n)}function A0(e,t){return Object.prototype.hasOwnProperty.call(e,t)&&e[t]!==S2[t]}function A1(e){let t=kW in e.prototype?e.prototype[kW]():void 0,n=function(e){if(!(e===S2||e.prototype instanceof S2)){let t="<unknown>",n="<unknown>";try{t=e.getType()}catch(e){}try{E$.version&&(n=JSON.parse(E$.version))}catch(e){}kw(290,e.name,t,n)}return e===ES||e===Ew||e===S2}(e),r=!n&&A0(e,"getType")?e.getType():void 0,i,o=r;if(t)if(r)i=t[r];else for(let[e,n]of Object.entries(t))o=e,i=n;if(!n&&o&&(A0(e,"getType")||(e.getType=()=>o),A0(e,"clone")||(e.clone=t=>(EU=t,new e)),A0(e,"importJSON")||(e.importJSON=i&&i.$importJSON||(t=>(new e).updateFromJSON(t))),!A0(e,"importDOM")&&i)){let{importDOM:t}=i;t&&(e.importDOM=()=>t)}return{ownNodeConfig:i,ownNodeType:o}}let A2=(e,t)=>{let n=e;for(;null!=n&&!EA(n);){if(t(n))return n;n=n.getParent()}return null};function A5(e,t){let n=[],r=e.__first;for(;null!==r;){let e=null===t?E7(r):t.get(r);null==e&&kw(174),n.push(r),r=e.__next}return n}let A3={next:"previous",previous:"next"};class A4{origin;constructor(e){this.origin=e}[Symbol.iterator](){return Tg({hasNext:Tn,initial:this.getAdjacentCaret(),map:e=>e,step:e=>e.getAdjacentCaret()})}getAdjacentCaret(){return Ta(this.getNodeAtCaret(),this.direction)}getSiblingCaret(){return Ta(this.origin,this.direction)}remove(){let e=this.getNodeAtCaret();return e&&e.remove(),this}replaceOrInsert(e,t){let n=this.getNodeAtCaret();return e.is(this.origin)||e.is(n)||(null===n?this.insert(e):n.replace(e,t)),this}splice(e,t,n="next"){let r=n===this.direction?t:Array.from(t).reverse(),i=this,o=this.getParentAtCaret(),s=new Map;for(let t=i.getAdjacentCaret();null!==t&&s.size<e;t=t.getAdjacentCaret()){let e=t.origin.getWritable();s.set(e.getKey(),e)}for(let e of r){if(s.size>0){let t=i.getNodeAtCaret();if(t)if(s.delete(t.getKey()),s.delete(e.getKey()),t.is(e)||i.origin.is(e));else{let n=e.getParent();n&&n.is(o)&&e.remove(),t.replace(e)}else null===t&&kw(263,Array.from(s).join(" "))}else i.insert(e);i=Ta(e,this.direction)}for(let e of s.values())e.remove();return this}}class A6 extends A4{type="child";getLatest(){let e=this.origin.getLatest();return e===this.origin?this:Tc(e,this.direction)}getParentCaret(e="root"){return Ta(A9(this.getParentAtCaret(),e),this.direction)}getFlipped(){let e=A3[this.direction];return Ta(this.getNodeAtCaret(),e)||Tc(this.origin,e)}getParentAtCaret(){return this.origin}getChildCaret(){return this}isSameNodeCaret(e){return e instanceof A6&&this.direction===e.direction&&this.origin.is(e.origin)}isSamePointCaret(e){return this.isSameNodeCaret(e)}}let A8={root:EA,shadowRoot:AR};function A9(e,t="root"){return A8[t](e)?null:e}class A7 extends A4{type="sibling";getLatest(){let e=this.origin.getLatest();return e===this.origin?this:Ta(e,this.direction)}getSiblingCaret(){return this}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return Ek(this.origin)?Tc(this.origin,this.direction):null}getParentCaret(e="root"){return Ta(A9(this.getParentAtCaret(),e),this.direction)}getFlipped(){let e=A3[this.direction];return Ta(this.getNodeAtCaret(),e)||Tc(this.origin.getParentOrThrow(),e)}isSamePointCaret(e){return e instanceof A7&&this.direction===e.direction&&this.origin.is(e.origin)}isSameNodeCaret(e){return(e instanceof A7||e instanceof Te)&&this.direction===e.direction&&this.origin.is(e.origin)}}class Te extends A4{type="text";offset;constructor(e,t){super(e),this.offset=t}getLatest(){let e=this.origin.getLatest();return e===this.origin?this:Tl(e,this.direction,this.offset)}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return null}getParentCaret(e="root"){return Ta(A9(this.getParentAtCaret(),e),this.direction)}getFlipped(){return Tl(this.origin,A3[this.direction],this.offset)}isSamePointCaret(e){return e instanceof Te&&this.direction===e.direction&&this.origin.is(e.origin)&&this.offset===e.offset}isSameNodeCaret(e){return(e instanceof A7||e instanceof Te)&&this.direction===e.direction&&this.origin.is(e.origin)}getSiblingCaret(){return Ta(this.origin,this.direction)}}function Tt(e){return e instanceof Te}function Tn(e){return e instanceof A7}function Tr(e){return e instanceof A6}let Ti={next:class extends Te{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends Te{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},To={next:class extends A7{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends A7{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},Ts={next:class extends A6{direction="next";getNodeAtCaret(){return this.origin.getFirstChild()}insert(e){return this.origin.splice(0,0,[e]),this}},previous:class extends A6{direction="previous";getNodeAtCaret(){return this.origin.getLastChild()}insert(e){return this.origin.splice(this.origin.getChildrenSize(),0,[e]),this}}};function Ta(e,t){return e?new To[t](e):null}function Tl(e,t,n){return e?new Ti[t](e,Tu(e,n)):null}function Tu(e,t,n="error"){let r=e.getTextContentSize(),i="next"===t?r:"previous"===t?0:t;return(i<0||i>r)&&("clamp"!==n&&kk(284,String(t),String(r),e.getKey()),i=i<0?0:r),i}function Tc(e,t){return Ek(e)?new Ts[t](e):null}function Td(e){var t;return e&&((t=e.getAdjacentCaret())&&t.getChildCaret()||t)}class Th{type="node-caret-range";direction;anchor;focus;constructor(e,t,n){this.anchor=e,this.focus=t,this.direction=n}getLatest(){let e=this.anchor.getLatest(),t=this.focus.getLatest();return e===this.anchor&&t===this.focus?this:new Th(e,t,this.direction)}isCollapsed(){return this.anchor.isSamePointCaret(this.focus)}getTextSlices(){let e=e=>{let t=this[e].getLatest();return Tt(t)?function(e,t){let{direction:n,origin:r}=e;return new Tf(e,Tu(r,"focus"===t?A3[n]:n)-e.offset)}(t,e):null},t=e("anchor"),n=e("focus");if(t&&n){let{caret:e}=t,{caret:r}=n;if(e.isSameNodeCaret(r))return[new Tf(e,r.offset-e.offset),null]}return[t,n]}iterNodeCarets(e="root"){let t=Tt(this.anchor)?this.anchor.getSiblingCaret():this.anchor.getLatest(),n=this.focus.getLatest(),r=Tt(n),i=t=>t.isSameNodeCaret(n)?null:Td(t)||t.getParentCaret(e);return Tg({hasNext:e=>null!==e&&!(r&&n.isSameNodeCaret(e)),initial:t.isSameNodeCaret(n)?null:i(t),map:e=>e,step:i})}[Symbol.iterator](){return this.iterNodeCarets("root")}}class Tf{type="slice";caret;distance;constructor(e,t){this.caret=e,this.distance=t}getSliceIndices(){let{distance:e,caret:{offset:t}}=this,n=t+e;return n<t?[n,t]:[t,n]}getTextContent(){let[e,t]=this.getSliceIndices();return this.caret.origin.getTextContent().slice(e,t)}getTextContentSize(){return Math.abs(this.distance)}removeTextSlice(){let{caret:{origin:e,direction:t}}=this,[n,r]=this.getSliceIndices(),i=e.getTextContent();return Tl(e.setTextContent(i.slice(0,n)+i.slice(r)),t,n)}}function Tp(e){return Tm(e,Ta(Ao(),e.direction))}function Tm(e,t){return e.direction!==t.direction&&kw(265),new Th(e,t,e.direction)}function Tg(e){let{initial:t,hasNext:n,step:r,map:i}=e,o=t;return{[Symbol.iterator](){return this},next(){if(!n(o))return{done:!0,value:void 0};let e={done:!1,value:i(o)};return o=r(o),e}}}function Ty(e,t){let n=Tb(e.origin,t.origin);switch(null===n&&kw(275,e.origin.getKey(),t.origin.getKey()),n.type){case"same":{let n="text"===e.type,r="text"===t.type;return n&&r?Math.sign(e.offset-t.offset):e.type===t.type?0:n?-1:r?1:"child"===e.type?-1:1}case"ancestor":return"child"===e.type?-1:1;case"descendant":return"child"===t.type?1:-1;case"branch":return Tv(n)}}function Tv(e){let{a:t,b:n}=e,r=t.__key,i=n.__key,o=t,s=n;for(;o&&s;o=o.getNextSibling(),s=s.getNextSibling()){if(o.__key===i)return -1;if(s.__key===r)return 1}return null===o?1:-1}function Tx(e){return Ek(e)?[e.getLatest(),null]:[e.getParent(),e.getLatest()]}function Tb(e,t){if(e.is(t))return{commonAncestor:e,type:"same"};let n=new Map;for(let[t,r]=Tx(e);t;r=t,t=t.getParent())n.set(t,r);for(let[r,i]=Tx(t);r;i=r,r=r.getParent()){let o=n.get(r);if(void 0!==o)return null===o?(r.is(e)||kw(276),{commonAncestor:r,type:"ancestor"}):null===i?(r.is(t)||kw(277),{commonAncestor:r,type:"descendant"}):((Ek(o)||o.is(e))&&(Ek(i)||i.is(t))&&r.is(o.getParent())&&r.is(i.getParent())||kw(278),{a:o,b:i,commonAncestor:r,type:"branch"})}return null}function Tw(e,t){var n;let r,{type:i,key:o,offset:s}=e,a=(null===(r=E7(n=e.key))&&kw(63,n),r);return"text"===i?(Ck(a)||kw(266,a.getType(),o),Tl(a,t,s)):(Ek(a)||kw(267,a.getType(),o),TD(a,e.offset,t))}function Tk(e,t){let{origin:n,direction:r}=t,i="next"===r;Tt(t)?e.set(n.getKey(),t.offset,"text"):Tn(t)?Ck(n)?e.set(n.getKey(),Tu(n,r),"text"):e.set(n.getParentOrThrow().getKey(),n.getIndexWithinParent()+ +!!i,"element"):(Tr(t)&&Ek(n)||kw(268),e.set(n.getKey(),i?0:n.getChildrenSize(),"element"))}function T_(e){let t=CJ(),n=CM(t)?t:CK();return TS(n,e),Aa(n),n}function TS(e,t){Tk(e.anchor,t.anchor),Tk(e.focus,t.focus)}function TC(e){let{anchor:t,focus:n}=e,r=Tw(t,"next"),i=Tw(n,"next"),o=0>=Ty(r,i)?"next":"previous";return Tm(TP(r,o),TP(i,o))}function TE(e){let{direction:t,origin:n}=e,r=Ta(n,A3[t]).getNodeAtCaret();return r?Ta(r,t):Tc(n.getParentOrThrow(),t)}function TA(e,t="root"){let n=[e];for(let r=Tr(e)?e.getParentCaret(t):e.getSiblingCaret();null!==r;r=r.getParentCaret(t))n.push(TE(r));return n}function TT(e){return!!e&&e.origin.isAttached()}function TN(e){let t=function(e){let t=e;for(;Tr(t);){let e=Td(t);if(!Tr(e))break;t=e}return t}(e.getLatest()),{direction:n}=t;if(Ck(t.origin))return Tt(t)?t:Tl(t.origin,n,n);let r=t.getAdjacentCaret();return Tn(r)&&Ck(r.origin)?Tl(r.origin,n,A3[n]):t}function Tj(e){return Tt(e)&&e.offset!==Tu(e.origin,e.direction)}function TP(e,t){return e.direction===t?e:e.getFlipped()}function TM(e,t){return e.direction===t?e:Tm(TP(e.focus,t),TP(e.anchor,t))}function TD(e,t,n){let r=Tc(e,"next");for(let e=0;e<t;e++){let e=r.getAdjacentCaret();if(null===e)break;r=e}return TP(r,n)}function TR(e){let{origin:t,offset:n,direction:r}=e;if(n===Tu(t,r))return e.getSiblingCaret();if(n===Tu(t,A3[r]))return TE(e.getSiblingCaret());let[i]=t.splitText(n);return Ck(i)||kw(281),TP(Ta(i,"next"),r)}function TL(e,t){return!0}function TO(e,t){if(!t||e===t)return e;for(let n in t)if(e[n]!==t[n])return{...e,...t};return e}function TI(...e){let t=[];for(let n of e)if(n&&"string"==typeof n)for(let[e]of n.matchAll(/\S+/g))t.push(e);return t}function TF(...e){return()=>{for(let t=e.length-1;t>=0;t--)e[t]();e.length=0}}let Tz="u">typeof window&&void 0!==window.document&&void 0!==window.document.createElement,TB=Tz?T.useLayoutEffect:T.useEffect,T$={tag:S4};function TU({initialConfig:e,children:t}){let n=(0,T.useMemo)(()=>{let{theme:t,namespace:n,nodes:r,onError:i,editorState:o,html:s}=e,a={getTheme:function(){return null!=t?t:null}},l=EF({editable:e.editable,html:s,namespace:n,nodes:r,onError:e=>i(e,l),theme:t});return function(e,t){if(null!==t){if(void 0===t)e.update(()=>{let t=Ao();if(t.isEmpty()){let n=ER();t.append(n);let r=Tz?document.activeElement:null;(null!==CJ()||null!==r&&r===e.getRootElement())&&n.select()}},T$);else if(null!==t)switch(typeof t){case"string":{let n=e.parseEditorState(t);e.setEditorState(n,T$);break}case"object":e.setEditorState(t,T$);break;case"function":e.update(()=>{Ao().isEmpty()&&t(e)},T$)}}}(l,o),[l,a]},[]);return TB(()=>{let t=e.editable,[r]=n;r.setEditable(void 0===t||t)},[]),(0,A.jsx)(kx.Provider,{value:n,children:t})}function TV(e){return()=>(function(e){if(!function(e,t=!0){if(e)return!1;let n=Ao().getTextContent();return t&&(n=n.trim()),""===n}(e,!1))return!1;let t=Ao().getChildren(),n=t.length;if(n>1)return!1;for(let e=0;e<n;e++){let n=t[e];if(EC(n))return!1;if(Ek(n)){if(!EL(n)||0!==n.__indent)return!1;let t=n.getChildren(),r=t.length;for(let n=0;n<r;n++)if(!Ck(t[e]))return!1}}return!0})(e)}let TW="u">typeof window&&void 0!==window.document&&void 0!==window.document.createElement?T.useLayoutEffect:T.useEffect,TH=(0,T.forwardRef)(function({editor:e,ariaActiveDescendant:t,ariaAutoComplete:n,ariaControls:r,ariaDescribedBy:i,ariaErrorMessage:o,ariaExpanded:s,ariaInvalid:a,ariaLabel:l,ariaLabelledBy:u,ariaMultiline:c,ariaOwns:d,ariaRequired:h,autoCapitalize:f,className:p,id:m,role:g="textbox",spellCheck:y=!0,style:v,tabIndex:x,"data-testid":b,...w},k){let[_,S]=(0,T.useState)(e.isEditable()),C=(0,T.useCallback)(t=>{t&&t.ownerDocument&&t.ownerDocument.defaultView?e.setRootElement(t):e.setRootElement(null)},[e]),E=(0,T.useMemo)(()=>(function(...e){return t=>{for(let n of e)"function"==typeof n?n(t):null!=n&&(n.current=t)}})(k,C),[C,k]);return TW(()=>(S(e.isEditable()),e.registerEditableListener(e=>{S(e)})),[e]),(0,A.jsx)("div",{"aria-activedescendant":_?t:void 0,"aria-autocomplete":_?n:"none","aria-controls":_?r:void 0,"aria-describedby":i,...null!=o?{"aria-errormessage":o}:{},"aria-expanded":_&&"combobox"===g?!!s:void 0,...null!=a?{"aria-invalid":a}:{},"aria-label":l,"aria-labelledby":u,"aria-multiline":c,"aria-owns":_?d:void 0,"aria-readonly":!_||void 0,"aria-required":h,autoCapitalize:f,className:p,contentEditable:_,"data-testid":b,id:m,ref:E,role:g,spellCheck:y,style:v,tabIndex:x,...w})});function TK(e){return e.getEditorState().read(TV(e.isComposing()))}let TG=(0,T.forwardRef)(function(e,t){let{placeholder:n,...r}=e,[i]=kb();return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(TH,{editor:i,...r,ref:t}),null!=n&&(0,A.jsx)(Tq,{editor:i,content:n})]})});function Tq({content:e,editor:t}){let n=function(e){let[t,n]=(0,T.useState)(()=>TK(e));return TW(()=>{function t(){n(TK(e))}return t(),TF(e.registerUpdateListener(()=>{t()}),e.registerEditableListener(()=>{t()}))},[e]),t}(t),[r,i]=(0,T.useState)(t.isEditable());if((0,T.useLayoutEffect)(()=>(i(t.isEditable()),t.registerEditableListener(e=>{i(e)})),[t]),!n)return null;let o=null;return"function"==typeof e?o=e(r):null!==e&&(o=e),null===o?null:(0,A.jsx)("div",{"aria-hidden":!0,children:o})}var TJ=T;let TY=(0,TJ.createContext)(null),TX={didCatch:!1,error:null};class TZ extends TJ.Component{constructor(e){super(e),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=TX}static getDerivedStateFromError(e){return{didCatch:!0,error:e}}resetErrorBoundary(...e){let{error:t}=this.state;null!==t&&(this.props.onReset?.({args:e,reason:"imperative-api"}),this.setState(TX))}componentDidCatch(e,t){this.props.onError?.(e,t)}componentDidUpdate(e,t){let{didCatch:n}=this.state,{resetKeys:r}=this.props;n&&null!==t.error&&function(e=[],t=[]){return e.length!==t.length||e.some((e,n)=>!Object.is(e,t[n]))}(e.resetKeys,r)&&(this.props.onReset?.({next:r,prev:e.resetKeys,reason:"keys"}),this.setState(TX))}render(){let{children:e,fallbackRender:t,FallbackComponent:n,fallback:r}=this.props,{didCatch:i,error:o}=this.state,s=e;if(i){let e={error:o,resetErrorBoundary:this.resetErrorBoundary};if("function"==typeof t)s=t(e);else if(n)s=(0,TJ.createElement)(n,e);else if(void 0!==r)s=r;else throw o}return(0,TJ.createElement)(TY.Provider,{value:{didCatch:i,error:o,resetErrorBoundary:this.resetErrorBoundary}},s)}}function TQ({children:e,onError:t}){return(0,A.jsx)(TZ,{fallback:(0,A.jsx)("div",{style:{border:"1px solid #f00",color:"#f00",padding:"8px"},children:"An error was thrown."}),onError:t,children:e})}function T0(e){let t=AG().getElementByKey(e.getKey());if(null===t)return null;let n=t.ownerDocument.defaultView;return null===n?null:n.getComputedStyle(t)}function T1(e){return T0(EA(e)?e:e.getParentOrThrow())}function T2(e){let t=T1(e);return null!==t&&"rtl"===t.direction}function T5(e,t,n="self"){let r=e.getStartEndPoints();if(t.isSelected(e)&&!EQ(t)&&null!==r){let[o,s]=r,a=e.isBackward(),l=o.getNode(),u=s.getNode(),c=t.is(l),d=t.is(u);if(c||d){var i;let[r,o]=CO(e),s=l.is(u),c=t.is(a?u:l),d=t.is(a?l:u),h,f=0;s?(f=r>o?o:r,h=r>o?r:o):c?(f=a?o:r,h=void 0):d&&(f=0,h=a?r:o);let p=t.__text.slice(f,h);p!==t.__text&&("clone"===n&&((i=AZ(t))[S0]=!0,t=i),t.__text=p)}}return t}let T3=()=>{};function T4(e){let t=T6(e);return null!==t&&"vertical-rl"===t.writingMode}function T6(e){let t=e.anchor.getNode();return Ek(t)?T0(t):T1(t)}function T8(e,t){let n=T4(e)?!t:t;T9(e)&&(n=!n);let r=Tw(e.focus,n?"previous":"next");if(Tj(r))return!1;for(let e of Tp(r)){if(Tr(e))return!e.origin.isInline();if(!Ek(e.origin)){if(EC(e.origin))return!0;break}}return!1}function T9(e){let t=T6(e);return null!==t&&"rtl"===t.direction}function T7(e,t,n){let r,i=T9(e);r=T4(e)||i?!n:n,e.modify(t?"extend":"move",r,"character")}let Ne="u">typeof window&&void 0!==window.document&&void 0!==window.document.createElement,Nt=Ne&&"documentMode"in document?document.documentMode:null;Ne&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Ne&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Ne&&"InputEvent"in window&&!Nt&&new window.InputEvent("input"),Ne&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&window.MSStream,Ne&&/Android/.test(navigator.userAgent),Ne&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),Ne&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Ne&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent);function Nn(e,t){return null!==e&&Object.getPrototypeOf(e).constructor.name===t.name}function Nr(e){let t=CJ();if(!CM(t))return!1;let n=new Set,r=t.getNodes();for(let t=0;t<r.length;t++){let i=r[t],o=i.getKey();if(n.has(o))continue;let s=A2(i,e=>Ek(e)&&!e.isInline());if(null===s)continue;let a=s.getKey();s.canIndent()&&!n.has(a)&&(n.add(a),e(s))}return n.size>0}let Ni=Symbol.for("preact-signals");function No(){if(Nl>1)return void Nl--;let e,t=!1;for(!function(){let e=Na;for(Na=void 0;void 0!==e;)e.S.v===e.v&&(e.S.i=e.i),e=e.o}();void 0!==l;){let n=l;for(l=void 0,Nu++;void 0!==n;){let r=n.u;if(n.u=void 0,n.f&=-3,!(8&n.f)&&Np(n))try{n.c()}catch(n){t||(e=n,t=!0)}n=r}}if(Nu=0,Nl--,t)throw e}function Ns(e){let t=a;a=void 0;try{return e()}finally{a=t}}let Na,Nl=0,Nu=0,Nc=0,Nd=0;function Nh(e){if(void 0===a)return;let t=e.n;return void 0===t||t.t!==a?(t={i:0,S:e,p:a.s,n:void 0,t:a,e:void 0,x:void 0,r:t},void 0!==a.s&&(a.s.n=t),a.s=t,e.n=t,32&a.f&&e.S(t),t):-1===t.i?(t.i=0,void 0!==t.n&&(t.n.p=t.p,void 0!==t.p&&(t.p.n=t.n),t.p=a.s,t.n=void 0,a.s.n=t,a.s=t),t):void 0}function Nf(e,t){this.v=e,this.i=0,this.n=void 0,this.t=void 0,this.l=0,this.W=null==t?void 0:t.watched,this.Z=null==t?void 0:t.unwatched,this.name=null==t?void 0:t.name}function Np(e){for(let t=e.s;void 0!==t;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function Nm(e){for(let t=e.s;void 0!==t;t=t.n){let n=t.S.n;if(void 0!==n&&(t.r=n),t.S.n=t,t.i=-1,void 0===t.n){e.s=t;break}}}function Ng(e){let t,n=e.s;for(;void 0!==n;){let e=n.p;-1===n.i?(n.S.U(n),void 0!==e&&(e.n=n.n),void 0!==n.n&&(n.n.p=e)):t=n,n.S.n=n.r,void 0!==n.r&&(n.r=void 0),n=e}e.s=t}function Ny(e,t){Nf.call(this,void 0),this.x=e,this.s=void 0,this.g=Nd-1,this.f=4,this.W=null==t?void 0:t.watched,this.Z=null==t?void 0:t.unwatched,this.name=null==t?void 0:t.name}function Nv(e){let t=e.m;if(e.m=void 0,"function"==typeof t){Nl++;let n=a;a=void 0;try{t()}catch(t){throw e.f&=-2,e.f|=8,Nx(e),t}finally{a=n,No()}}}function Nx(e){for(let t=e.s;void 0!==t;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,Nv(e)}function Nb(e){if(a!==this)throw Error("Out-of-order effect");Ng(this),a=e,this.f&=-2,8&this.f&&Nx(this),No()}function Nw(e,t){this.x=e,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=null==t?void 0:t.name}function Nk(e,t){let n=new Nw(e,t);try{n.c()}catch(e){throw n.d(),e}let r=n.d.bind(n);return r[Symbol.dispose]=r,r}function N_(e,t={}){let n={};for(let r in e){let i=t[r],o=new Nf(void 0===i?e[r]:i,void 0);n[r]=o}return n}function NS(e){return("function"==typeof e.nodes?e.nodes():e.nodes)||[]}Nf.prototype.brand=Ni,Nf.prototype.h=function(){return!0},Nf.prototype.S=function(e){let t=this.t;t!==e&&void 0===e.e&&(e.x=t,this.t=e,void 0!==t?t.e=e:Ns(()=>{var e;null==(e=this.W)||e.call(this)}))},Nf.prototype.U=function(e){if(void 0!==this.t){let t=e.e,n=e.x;void 0!==t&&(t.x=n,e.e=void 0),void 0!==n&&(n.e=t,e.x=void 0),e===this.t&&(this.t=n,void 0===n&&Ns(()=>{var e;null==(e=this.Z)||e.call(this)}))}},Nf.prototype.subscribe=function(e){return Nk(()=>{let t=this.value,n=a;a=void 0;try{e(t)}finally{a=n}},{name:"sub"})},Nf.prototype.valueOf=function(){return this.value},Nf.prototype.toString=function(){return this.value+""},Nf.prototype.toJSON=function(){return this.value},Nf.prototype.peek=function(){let e=a;a=void 0;try{return this.value}finally{a=e}},Object.defineProperty(Nf.prototype,"value",{get(){let e=Nh(this);return void 0!==e&&(e.i=this.i),this.v},set(e){if(e!==this.v){if(Nu>100)throw Error("Cycle detected");0!==Nl&&0===Nu&&this.l!==Nc&&(this.l=Nc,Na={S:this,v:this.v,i:this.i,o:Na}),this.v=e,this.i++,Nd++,Nl++;try{for(let e=this.t;void 0!==e;e=e.x)e.t.N()}finally{No()}}}}),Ny.prototype=new Nf,Ny.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if(32==(36&this.f)||(this.f&=-5,this.g===Nd))return!0;if(this.g=Nd,this.f|=1,this.i>0&&!Np(this))return this.f&=-2,!0;let e=a;try{Nm(this),a=this;let e=this.x();(16&this.f||this.v!==e||0===this.i)&&(this.v=e,this.f&=-17,this.i++)}catch(e){this.v=e,this.f|=16,this.i++}return a=e,Ng(this),this.f&=-2,!0},Ny.prototype.S=function(e){if(void 0===this.t){this.f|=36;for(let e=this.s;void 0!==e;e=e.n)e.S.S(e)}Nf.prototype.S.call(this,e)},Ny.prototype.U=function(e){if(void 0!==this.t&&(Nf.prototype.U.call(this,e),void 0===this.t)){this.f&=-33;for(let e=this.s;void 0!==e;e=e.n)e.S.U(e)}},Ny.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(let e=this.t;void 0!==e;e=e.x)e.t.N()}},Object.defineProperty(Ny.prototype,"value",{get(){if(1&this.f)throw Error("Cycle detected");let e=Nh(this);if(this.h(),void 0!==e&&(e.i=this.i),16&this.f)throw this.v;return this.v}}),Nw.prototype.c=function(){let e=this.S();try{if(8&this.f||void 0===this.x)return;let e=this.x();"function"==typeof e&&(this.m=e)}finally{e()}},Nw.prototype.S=function(){if(1&this.f)throw Error("Cycle detected");this.f|=1,this.f&=-9,Nv(this),Nm(this),Nl++;let e=a;return a=this,Nb.bind(this,e)},Nw.prototype.N=function(){2&this.f||(this.f|=2,this.u=l,l=this)},Nw.prototype.d=function(){this.f|=8,1&this.f||Nx(this)},Nw.prototype.dispose=function(){this.d()};new kQ("format",{parse:e=>"number"==typeof e?e:0});function NC(e,...t){let n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;for(let n of(r.append("code",e),t))r.append("v",n);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}let NE=new Set;class NA{builder;configs;_dependency;_peerNameSet;extension;state;_signal;constructor(e,t){this.builder=e,this.extension=t,this.configs=new Set,this.state={id:0}}mergeConfigs(){let e=this.extension.config||{},t=this.extension.mergeConfig?this.extension.mergeConfig.bind(this.extension):TO;for(let n of this.configs)e=t(e,n);return e}init(e){let t,n=this.state;2===n.id||NC(306,String(n.id));let r={getDependency:this.getInitDependency.bind(this),getDirectDependentNames:this.getDirectDependentNames.bind(this),getPeer:this.getInitPeer.bind(this),getPeerNameSet:this.getPeerNameSet.bind(this)},i={...r,getDependency:this.getDependency.bind(this),getInitResult:this.getInitResult.bind(this),getPeer:this.getPeer.bind(this)},o=Object.assign(n,{config:this.mergeConfigs(),id:3,registerState:r});this.state=o,this.extension.init&&(t=this.extension.init(e,o.config,r)),this.state=Object.assign(o,{id:4,initResult:t,registerState:i})}build(e){let t,n=this.state;4!==n.id&&NC(307,String(n.id),String(5)),this.extension.build&&(t=this.extension.build(e,n.config,n.registerState));let r={...n.registerState,getOutput:()=>t,getSignal:this.getSignal.bind(this)};this.state=Object.assign(n,{id:5,output:t,registerState:r})}register(e,t){this._signal=t;let n=this.state;5!==n.id&&NC(308,String(n.id),String(5));let r=this.extension.register&&this.extension.register(e,n.config,n.registerState);return this.state=Object.assign(n,{id:6}),()=>{let e=this.state;7!==e.id&&NC(309,String(n.id),String(7)),this.state=Object.assign(e,{id:5}),r&&r()}}afterRegistration(e){let t,n=this.state;return 6!==n.id&&NC(310,String(n.id),String(6)),this.extension.afterRegistration&&(t=this.extension.afterRegistration(e,n.config,n.registerState)),this.state=Object.assign(n,{id:7}),t}getSignal(){return void 0===this._signal&&NC(311),this._signal}getInitResult(){void 0===this.extension.init&&NC(312,this.extension.name);let e=this.state;return e.id>=4||NC(313,String(e.id),String(4)),e.initResult}getInitPeer(e){let t=this.builder.extensionNameMap.get(e);return t?t.getExtensionInitDependency():void 0}getExtensionInitDependency(){let e=this.state;return e.id>=3||NC(314,String(e.id),String(3)),{config:e.config}}getPeer(e){let t=this.builder.extensionNameMap.get(e);return t?t.getExtensionDependency():void 0}getInitDependency(e){let t=this.builder.getExtensionRep(e);return void 0===t&&NC(315,this.extension.name,e.name),t.getExtensionInitDependency()}getDependency(e){let t=this.builder.getExtensionRep(e);return void 0===t&&NC(315,this.extension.name,e.name),t.getExtensionDependency()}getState(){let e=this.state;return e.id>=7||NC(316,String(e.id),String(7)),e}getDirectDependentNames(){return this.builder.incomingEdges.get(this.extension.name)||NE}getPeerNameSet(){let e=this._peerNameSet;return e||(e=new Set((this.extension.peerDependencies||[]).map(([e])=>e)),this._peerNameSet=e),e}getExtensionDependency(){if(!this._dependency){let e=this.state;e.id>=5||NC(317,this.extension.name),this._dependency={config:e.config,init:e.initResult,output:e.output}}return this._dependency}}let NT={tag:S4};function NN(){let e=Ao();e.isEmpty()&&e.append(ER())}let Nj={config:{setOptions:NT,updateOptions:NT},init:({$initialEditorState:e=NN})=>({$initialEditorState:e,initialized:!1}),afterRegistration(e,{updateOptions:t,setOptions:n},r){let i=r.getInitResult();if(!i.initialized){i.initialized=!0;let{$initialEditorState:r}=i;if(r instanceof Ej)e.setEditorState(r,n);else if("function"==typeof r)e.update(()=>{r(e)},t);else if(r&&("string"==typeof r||"object"==typeof r)){let t=e.parseEditorState(r);e.setEditorState(t,n)}}return()=>{}},name:"@lexical/extension/InitialState",nodes:[EE,Cf,Cn,CS,EM]},NP=Symbol.for("@lexical/extension/LexicalBuilder");function NM(){}function ND(e){throw e}function NR(e){return Array.isArray(e)?e:[e]}let NL="0.44.0+prod.esm";class NO{roots;extensionNameMap;outgoingConfigEdges;incomingEdges;conflicts;_sortedExtensionReps;PACKAGE_VERSION;constructor(e){for(const t of(this.outgoingConfigEdges=new Map,this.incomingEdges=new Map,this.extensionNameMap=new Map,this.conflicts=new Map,this.PACKAGE_VERSION=NL,this.roots=e,e))this.addExtension(t)}static fromExtensions(e){let t=[NR(Nj)];for(let n of e)t.push(NR(n));return new NO(t)}static maybeFromEditor(e){let t=e[NP];return t&&(t.PACKAGE_VERSION!==NL&&NC(292,t.PACKAGE_VERSION,NL),t instanceof NO||NC(293)),t}static fromEditor(e){let t=NO.maybeFromEditor(e);return void 0===t&&NC(294),t}constructEditor(){let{$initialEditorState:e,onError:t,...n}=this.buildCreateEditorArgs(),r=Object.assign(EF({...n,...t?{onError:e=>{t(e,r)}}:{}}),{[NP]:this});for(let e of this.sortedExtensionReps())e.build(r);return r}buildEditor(){let e=NM;function t(){try{e()}finally{e=NM}}let n=Object.assign(this.constructEditor(),{dispose:t,[Symbol.dispose]:t});return e=TF(this.registerEditor(n),()=>n.setRootElement(null)),n}hasExtensionByName(e){return this.extensionNameMap.has(e)}getExtensionRep(e){let t=this.extensionNameMap.get(e.name);if(t)return t.extension!==e&&NC(295,e.name),t}addEdge(e,t,n){let r=this.outgoingConfigEdges.get(e);r?r.set(t,n):this.outgoingConfigEdges.set(e,new Map([[t,n]]));let i=this.incomingEdges.get(t);i?i.add(e):this.incomingEdges.set(t,new Set([e]))}addExtension(e){void 0!==this._sortedExtensionReps&&NC(296);let[t]=NR(e);"string"!=typeof t.name&&NC(297,typeof t.name);let n=this.extensionNameMap.get(t.name);if(void 0!==n&&n.extension!==t&&NC(298,t.name),!n){n=new NA(this,t),this.extensionNameMap.set(t.name,n);let e=this.conflicts.get(t.name);for(let n of("string"==typeof e&&NC(299,t.name,e),t.conflictsWith||[]))this.extensionNameMap.has(n)&&NC(299,t.name,n),this.conflicts.set(n,t.name);for(let e of t.dependencies||[]){let n=NR(e);this.addEdge(t.name,n[0].name,n.slice(1)),this.addExtension(n)}for(let[e,n]of t.peerDependencies||[])this.addEdge(t.name,e,n?[n]:[])}}sortedExtensionReps(){if(this._sortedExtensionReps)return this._sortedExtensionReps;let e=[],t=(n,r)=>{var i,o;let s=n.state;if(2===s.id)return;let a=n.extension.name;0===s.id||NC(300,a,r||"[unknown]"),0===(i=s).id||NC(304,String(i.id),String(0)),n.state=s=Object.assign(i,{id:1});let l=this.outgoingConfigEdges.get(a);if(l)for(let e of l.keys()){let n=this.extensionNameMap.get(e);n&&t(n,a)}1===(o=s).id||NC(305,String(o.id),String(1)),n.state=s=Object.assign(o,{id:2}),e.push(n)};for(let e of this.extensionNameMap.values())0===e.state.id&&t(e);for(let t of e)for(let[e,n]of this.outgoingConfigEdges.get(t.extension.name)||[])if(n.length>0){let t=this.extensionNameMap.get(e);if(t)for(let e of n)t.configs.add(e)}for(let[e,...t]of this.roots)if(t.length>0){let n=this.extensionNameMap.get(e.name);for(let r of(void 0===n&&NC(301,e.name),t))n.configs.add(r)}return this._sortedExtensionReps=e,this._sortedExtensionReps}registerEditor(e){let t=this.sortedExtensionReps(),n=new AbortController,r=[()=>n.abort()],i=n.signal;for(let n of t){let t=n.register(e,i);t&&r.push(t)}for(let n of t){let t=n.afterRegistration(e);t&&r.push(t)}return TF(...r)}buildCreateEditorArgs(){let e={},t=new Set,n=new Map,r=new Map,i={},o={},s=this.sortedExtensionReps();for(let a of s){let{extension:s}=a;if(void 0!==s.onError&&(e.onError=s.onError),void 0!==s.disableEvents&&(e.disableEvents=s.disableEvents),void 0!==s.parentEditor&&(e.parentEditor=s.parentEditor),void 0!==s.editable&&(e.editable=s.editable),void 0!==s.namespace&&(e.namespace=s.namespace),void 0!==s.$initialEditorState&&(e.$initialEditorState=s.$initialEditorState),s.nodes)for(let e of NS(s)){if("function"!=typeof e){let t=n.get(e.replace);t&&NC(302,s.name,e.replace.name,t.extension.name),n.set(e.replace,a)}t.add(e)}if(s.html){if(s.html.export)for(let[e,t]of s.html.export.entries())r.set(e,t);s.html.import&&Object.assign(i,s.html.import)}s.theme&&function e(t,n){if(t&&n&&!Array.isArray(n)&&"object"==typeof t&&"object"==typeof n){for(let r in n)t[r]=e(t[r],n[r]);return t}return n}(o,s.theme)}Object.keys(o).length>0&&(e.theme=o),t.size&&(e.nodes=[...t]);let a=Object.keys(i).length>0,l=r.size>0;for(let t of((a||l)&&(e.html={},a&&(e.html.import=i),l&&(e.html.export=r)),s))t.init(e);return e.onError||(e.onError=ND),e}}function NI(e,t){let n=NO.fromEditor(e).getExtensionRep(t);return void 0===n&&NC(303,t.name),n.getExtensionDependency()}_D("INSERT_HORIZONTAL_RULE_COMMAND");function NF(e){e.undoStack=[],e.redoStack=[],e.current=null}function Nz(e,t,n,r=Date.now){let i,o,s,a,l,u=(i=r(),o=0,s=i,a=0,l=null,(t,u,c,d,h,f)=>{let p=r();if(f.has(S8)&&(s=i,a=o,l=t),f.has(S3))return o=0,i=p,2;f.has(S9)&&l&&(i=s,o=a,t=l);let m=function(e,t,n,r,i){if(null===e||0===n.size&&0===r.size&&!i)return 0;let o=t._selection,s=e._selection;if(i)return 1;if(!(CM(o)&&CM(s)&&s.isCollapsed()&&o.isCollapsed()))return 0;let a=function(e,t,n){let r=e._nodeMap,i=[];for(let e of t){let t=r.get(e);void 0!==t&&i.push(t)}for(let[e,t]of n){if(!t)continue;let n=r.get(e);void 0===n||EA(n)||i.push(n)}return i}(t,n,r);if(0===a.length)return 0;if(a.length>1){let n=t._nodeMap,r=n.get(o.anchor.key),i=n.get(s.anchor.key);return r&&i&&!e._nodeMap.has(r.__key)&&Ck(r)&&1===r.__text.length&&1===o.anchor.offset?2:0}let l=a[0],u=e._nodeMap.get(l.__key);if(!Ck(u)||!Ck(l)||u.__mode!==l.__mode)return 0;let c=u.__text,d=l.__text;if(c===d)return 0;let h=o.anchor,f=s.anchor;if(h.key!==f.key||"text"!==h.type)return 0;let p=h.offset,m=f.offset,g=d.length-c.length;return 1===g&&m===p-1?2:-1===g&&m===p+1?3:4*(-1===g&&m===p)}(t,u,d,h,e.isComposing()),g=(()=>{var r,s;let a,l,g,y,v=null===c||c.editor===e,x=f.has("history-push");if(!x&&v&&f.has(S4))return 0;if(1===m)return 2;if(null===t)return 1;let b=u._selection;if(!(d.size>0||h.size>0))return 2*(null===b);let w="number"==typeof n?n:n.peek();return!1===x&&0!==m&&m===o&&p<i+w&&v?0:1!==d.size||(r=Array.from(d)[0],a=(s=t)._nodeMap.get(r),l=u._nodeMap.get(r),g=s._selection,y=u._selection,CM(g)&&CM(y)&&"element"===g.anchor.type&&"element"===g.focus.type&&"text"===y.anchor.type&&"text"===y.focus.type||!Ck(a)||!Ck(l)||a.__parent!==l.__parent||JSON.stringify(s.read(()=>a.exportJSON()))!==JSON.stringify(u.read(()=>l.exportJSON())))?1:0})();return i=p,o=m,g});return TF(e.registerCommand(_Y,()=>((function(e,t){let n=t.redoStack,r=t.undoStack;if(0!==r.length){let i=t.current,o=r.pop();null!==i&&(n.push(i),e.dispatchCommand(Sp,!0)),0===r.length&&e.dispatchCommand(Sm,!1),t.current=o||null,o&&o.editor.setEditorState(o.editorState,{tag:S3})}})(e,t),!0),0),e.registerCommand(_X,()=>((function(e,t){let n=t.redoStack,r=t.undoStack;if(0!==n.length){let i=t.current;null!==i&&(r.push(i),e.dispatchCommand(Sm,!0));let o=n.pop();0===n.length&&e.dispatchCommand(Sp,!1),t.current=o||null,o&&o.editor.setEditorState(o.editorState,{tag:S3})}})(e,t),!0),0),e.registerCommand(Sh,()=>(NF(t),!1),0),e.registerCommand(Sf,()=>(NF(t),e.dispatchCommand(Sp,!1),e.dispatchCommand(Sm,!1),!0),0),e.registerUpdateListener(({editorState:n,prevEditorState:r,dirtyLeaves:i,dirtyElements:o,tags:s})=>{let a=t.current,l=t.redoStack,c=t.undoStack,d=null===a?null:a.editorState;if(null!==a&&n===d)return;let h=u(r,n,a,i,o,s);if(1===h)0!==l.length&&(t.redoStack=[],e.dispatchCommand(Sp,!1)),null!==a&&(c.push({...a}),e.dispatchCommand(Sm,!0));else if(2===h)return;t.current={editor:e,editorState:n}}))}function NB(){return{current:null,redoStack:[],undoStack:[]}}function N$({delay:e,externalHistoryState:t}){let[n]=kb();return function(e,t,n=1e3){let r=(0,T.useMemo)(()=>t||NB(),[t]);(0,T.useEffect)(()=>Nz(e,r,n),[n,e,r])}(n,t,e),null}let NU="u">typeof window&&void 0!==window.document&&void 0!==window.document.createElement?T.useLayoutEffect:T.useEffect;function NV({ignoreHistoryMergeTagChange:e=!0,ignoreSelectionChange:t=!1,onChange:n}){let[r]=kb();return NU(()=>{if(n)return r.registerUpdateListener(({editorState:i,dirtyElements:o,dirtyLeaves:s,prevEditorState:a,tags:l})=>{t&&0===o.size&&0===s.size||e&&l.has(S4)||a.isEmpty()||n(i,r,l)})},[r,e,t,n]),null}let NW="u">typeof window&&void 0!==window.document&&void 0!==window.document.createElement?T.useLayoutEffect:T.useEffect;function NH(e){return{initialValueFn:()=>e.isEditable(),subscribe:t=>e.registerEditableListener(t)}}function NK(e){let t=window.location.origin,n=n=>{if(n.origin!==t)return;let r=e.getRootElement();if(document.activeElement!==r)return;let i=n.data;if("string"==typeof i){let t;try{t=JSON.parse(i)}catch(e){return}if(t&&"nuanria_messaging"===t.protocol&&"request"===t.type){let r=t.payload;if(r&&"makeChanges"===r.functionId){let t=r.args;if(t){let[r,i,o,s,a]=t;e.update(()=>{let e=CJ();if(CM(e)){let t=e.anchor,l=t.getNode(),u=0,c=0;if(Ck(l)&&r>=0&&i>=0&&(u=r,c=r+i,e.setTextNodeRange(l,u,l,c)),u===c&&""===o||(e.insertRawText(o),l=t.getNode()),Ck(l)){u=s,c=s+a;let t=l.getTextContentSize();u=u>t?t:u,c=c>t?t:c,e.setTextNodeRange(l,u,l,c)}n.stopImmediatePropagation()}})}}}}};return window.addEventListener("message",n,!0),()=>{window.removeEventListener("message",n,!0)}}function NG(e,...t){let n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;for(let n of(r.append("code",e),t))r.append("v",n);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function Nq(e,t){let{key:n}=t;return e&&n in e?e[n]:t.defaultValue}function NJ(e){return u&&u.editor===e?u:void 0}function NY(e,t){let n=t;for(let r of e){let[e,i]=function(e,t){if("cfg"in t){let{cfg:n,updater:r}=t;return[n,r(Nq(e,n))]}return t}(n,r),o=e.key;if(n===t&&Nq(n,e)===i)continue;let s=n||Object.create(t||null);s[o]=i,n=s}return n}let NX="@lexical/html/DOM",NZ=Symbol.for("@lexical/html/DOMExportContext"),NQ=()=>!0;function N0(e){return(t,n,r)=>e(t,r)}function N1(e){return(t,n,r,i)=>e(t,n,i)}function N2(e){return(t,n,r,i,o)=>e(t,n,r,o)}function N5(e){return(t,n,r,i,o,s)=>e(t,n,r,i,s)}function N3(e,t){return(n,r)=>{let i=()=>e(n,r),o=t(n);return o?o(n,i,r):i()}}function N4(e,t){return(n,r,i)=>{let o=()=>e(n,r,i),s=t(n);return s?s(n,r,o,i):o()}}function N6(e,t){return(n,r,i,o)=>{let s=()=>e(n,r,i,o),a=t(n);return a?a(n,r,i,s,o):s()}}function N8(e,t){return(n,r,i,o,s)=>{let a=()=>e(n,r,i,o,s),l=t(n);return l?l(n,r,i,o,a,s):a()}}function N9(e,t){return(n,r,i,o)=>{e(n,r,i,o);let s=t(n);s&&s(n,r,i,o)}}function N7(e,t,n,r,i){let o=n[t];for(let n of e[t])if("function"==typeof n[0]){let[e,t]=n;o=r(o,n=>e(n)&&t||void 0)}else{let e=n[1],t={};for(let n in e){let i=e[n];i&&(t[n]=i.reduce((e,t)=>r(e,()=>t),o))}o=r(o,e=>{let n=t[e.getType()];return n&&i(n)})}n[t]=o}function je(e){return e}let jt={build:(e,t,n)=>({defaults:NY(t.contextDefaults,void 0)}),config:{contextDefaults:[],overrides:[]},html:{export:new Map([[EE,()=>{let e=document.createElement("div");return e.role="textbox",{element:e}}]])},init(e,t){e.dom=function(e,{overrides:t}){let n=function(e,t){let n=function(e){let t={},{nodes:n}=function(e){let t=new Set,n=new Set;for(let r of NS(e)){let e="function"==typeof r?r:r.replace;A1(e),t.add(e.getType()),n.add(e)}return{nodes:n,types:t}}(e);for(let e of n)t[e.getType()]={klass:e,types:{}};for(let e of Object.values(t))if(e){let n=e.klass.getType();for(let{klass:r}=e;S5(r.prototype);r=Object.getPrototypeOf(r)){let{ownNodeType:e}=A1(r),i=e&&t[e];i&&(i.types[n]=!0)}}return t}(e),r={$createDOM:[],$decorateDOM:[],$exportDOM:[],$extractWithChild:[],$getDOMSlot:[],$shouldExclude:[],$shouldInclude:[],$updateDOM:[]};for(let e of function(e){let t=[],n=[],r=[];for(let i of e)if("*"===i.nodes)t.push(i);else if(Array.isArray(i.nodes))for(let e of i.nodes)S5(e.prototype)?r.push(1===i.nodes.length?i:{...i,nodes:[e]}):n.push(1===i.nodes.length?i:{...i,nodes:[e]});let i=new Map,o=e=>{let t=i.get(e);if(void 0===t){t=0;for(let n=e;S5(n.prototype);n=Object.getPrototypeOf(n))t++;i.set(e,t)}return t};return r.sort((e,t)=>o(e.nodes[0])-o(t.nodes[0])),[...r,...n,...t]}(t)){let t=function(e,{nodes:t}){if("*"===t)return NQ;let n={},r=[];for(let i of t)if("getType"in i){let t=i.getType();if(n){let r=e[t];void 0===r&&NG(339,i.name,t),n=Object.assign(n,r.types)}r.push(function(e){return t=>t instanceof e}(i))}else n=void 0,r.push(i);return n||(1===r.length?r[0]:e=>{for(let t of r)if(t(e))return!0;return!1})}(n,e);for(let n in r)!function(e,t,n,r){if(!r)return;let i=e[t];if("function"==typeof n)i.push([n,r]);else{let e,t=i[i.length-1];for(let o in t&&"types"===t[0]?e=t[1]:(e={},i.push(["types",e])),n){let t=e[o]||[];e[o]=t,t.push(r)}}}(r,n,t,e[n])}return r}(e,t),r={...EI,...e.dom};return N7(n,"$createDOM",r,N3,N0),N7(n,"$exportDOM",r,N3,N0),N7(n,"$extractWithChild",r,N8,N5),N7(n,"$getDOMSlot",r,N4,N1),N7(n,"$shouldExclude",r,N4,N1),N7(n,"$shouldInclude",r,N4,N1),N7(n,"$updateDOM",r,N6,N2),N7(n,"$decorateDOM",r,N9,je),r}(e,t)},mergeConfig(e,t){let n=TO(e,t);for(let r of["overrides","contextDefaults"])t[r]&&(n[r]=[...e[r],...t[r]]);return n},name:NX};function jn(e,t,n){return Object.assign(new kQ(Symbol(e),{isEqual:n,parse:t}),{[NZ]:!0})}jn("root",Boolean);let jr=jn("isExport",Boolean),ji=function(e,t=()=>{}){return(n,r=AG())=>i=>{let o=NJ(r),s=o&&o[e],a=NY(n,s||t(r));return a&&a!==s?function(e,t,n,r=AG()){let i=u,o=NJ(r);try{return u={...o,editor:r,[e]:t},n()}finally{u=i}}(e,a,i,r):i()}}(NZ,function(e){let t=NO.maybeFromEditor(e);return t&&t.hasExtensionByName(NX)?NI(e,jt).output.defaults:void 0}),jo=new Set(["STYLE","SCRIPT"]);function js(e,...t){let n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;for(let n of(r.append("code",e),t))r.append("v",n);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function ja(t,n=CJ()){return null==n&&js(166),CM(n)&&n.isCollapsed()||0===n.getNodes().length?"":function(t,n=null){return("u"<typeof document||"u"<typeof window&&void 0===e.g.window)&&NG(338),function(e,t=null,n=AG()){return ji([[jr,!0]],n)(()=>{let r=Ao(),i=Aq(n),o=e.append.bind(e);for(let e of r.getChildren())!function e(t,n,r,i=null,o=Aq(t)){let s=o.$shouldInclude(n,i,t),a=o.$shouldExclude(n,i,t),l=n;null!==i&&Ck(n)&&(l=T5(i,n,"clone"));let{element:u,after:c,append:d,$getChildNodes:h}=o.$exportDOM(l,t);if(!u)return!1;let f=document.createDocumentFragment(),p=h?h():Ek(l)?l.getChildren():[],m=f.append.bind(f);for(let r of p){let a=e(t,r,m,i,o);!s&&a&&o.$extractWithChild(n,r,i,"html",t)&&(s=!0)}if(s&&!a){if((A$(u)||AV(u))&&(d?d(f):u.append(f)),r(u),c){let e=c.call(l,u);e&&(AV(u)?u.replaceChildren(e):u.replaceWith(e))}}else r(f);return s}(n,e,o,t,i);return e})}(document.createElement("div"),n,t).innerHTML}(t,n)}function jl(e,t=CJ()){return null==t&&js(166),CM(t)&&t.isCollapsed()||0===t.getNodes().length?null:JSON.stringify(function(e,t){let n=[],r=Ao().getChildren();for(let i=0;i<r.length;i++)!function e(t,n,r,i=[]){var o;let s,a,l=null===n||r.isSelected(n),u=Ek(r)&&r.excludeFromCopy("html"),c=r;null!==n&&Ck(c)&&(c=T5(n,c,"clone"));let d=Ek(c)?c.getChildren():[],h=(s=(o=c).exportJSON(),a=o.constructor,s.type!==a.getType()&&js(58,a.name),Ek(o)&&(Array.isArray(s.children)||js(59,a.name)),s);Ck(c)&&0===c.getTextContentSize()&&(l=!1);for(let i=0;i<d.length;i++){let o=d[i],s=e(t,n,o,h.children);!l&&Ek(r)&&s&&r.extractWithChild(o,n,"clone")&&(l=!0)}if(l&&!u)i.push(h);else if(Array.isArray(h.children))for(let e=0;e<h.children.length;e++){let t=h.children[e];i.push(t)}return l}(e,t,r[i],n);return{namespace:e._config.namespace,nodes:n}}(e,t))}function ju(e,t,n){let r=e.getData("application/x-lexical-editor");if(r)try{let e=JSON.parse(r);if(e.namespace===n._config.namespace&&Array.isArray(e.nodes))return jd(n,function(e){let t=[];for(let n=0;n<e.length;n++){let r=Ed(e[n],Es()._nodes);Ck(r)&&T3(r),t.push(r)}return t}(e.nodes),t)}catch(e){console.error(e)}let i=e.getData("text/html"),o=e.getData("text/plain");if(i&&o!==i)try{let e=(new DOMParser).parseFromString(window.trustedTypes&&window.trustedTypes.createPolicy?window.trustedTypes.createPolicy("lexical",{createHTML:e=>e}).createHTML(i):i,"text/html");return jd(n,function(e,t){E1(t)&&function(e){if(null===e.querySelector("style"))return;let t=new Map;try{for(let n of Array.from(e.styleSheets)){let r;try{r=n.cssRules}catch(e){continue}for(let n of Array.from(r)){let r;if(n.constructor.name===CSSStyleRule.name){try{r=e.querySelectorAll(n.selectorText)}catch(e){continue}for(let e of Array.from(r)){if(!A$(e))continue;let r=function(e){let n=t.get(e);if(void 0===n){n=new Set;for(let t=0;t<e.style.length;t++)n.add(e.style[t]);t.set(e,n)}return n}(e);for(let t=0;t<n.style.length;t++){let i=n.style[t];r.has(i)||e.style.setProperty(i,n.style.getPropertyValue(i),n.style.getPropertyPriority(i))}}}}}}catch(e){}}(t);let n=E1(t)?t.body.childNodes:t.childNodes,r=[],i=[];for(let t of n)if(!jo.has(t.nodeName)){let n=function e(t,n,r,i,o=new Map,s){let a=[];if(jo.has(t.nodeName))return a;let l=null,u=function(e,t){let{nodeName:n}=e,r=t._htmlConversions.get(n.toLowerCase()),i=null;if(void 0!==r)for(let t of r){let n=t(e);null!==n&&(null===i||(i.priority||0)<=(n.priority||0))&&(i=n)}return null!==i?i.conversion:null}(t,n),c=u?u(t):null,d=null;if(null!==c){d=c.after;let e=c.node;if(null!==(l=Array.isArray(e)?e[e.length-1]:e)){for(let[,e]of o)if(!(l=e(l,s)))break;l&&a.push(...Array.isArray(e)?e:[l])}null!=c.forChild&&o.set(t.nodeName,c.forChild)}let h=t.childNodes,f=[],p=(null==l||!AR(l))&&(null!=l&&CW(l)||i);for(let t=0;t<h.length;t++)f.push(...e(h[t],n,r,p,new Map(o),l));if(null!=d&&(f=d(f)),AH(t)&&(f=function(e,t,n){let r=e.style.textAlign,i=[],o=[];for(let e=0;e<t.length;e++){let s=t[e];if(CW(s))r&&!s.getFormat()&&s.setFormat(r),i.push(s);else if(o.push(s),e===t.length-1||e<t.length-1&&CW(t[e+1])){let e=n();e.setFormat(r),e.append(...o),i.push(e),o=[]}}return i}(t,f,p?()=>{let e=new EP;return r.push(e),e}:ER)),null==l)if(f.length>0)for(let e of f)a.push(e);else AH(t)&&null!=t.nextSibling&&null!=t.previousSibling&&AW(t.nextSibling)&&AW(t.previousSibling)&&a.push(Ci());else Ek(l)&&l.append(...f);return a}(t,e,i,!1);if(null!==n)for(let e of n)r.push(e)}return function(e){for(let t of e)t.getParent()&&t.getNextSibling()instanceof EP&&t.insertAfter(Ci());for(let t of e){let e=t.getParent();e&&e.splice(t.getIndexWithinParent(),1,t.getChildren())}}(i),r}(n,e),t)}catch(e){console.error(e)}let s=o||e.getData("text/uri-list");if(null!=s)if(CM(t)){let e=s.split(/(\r?\n|\t)/);""===e[e.length-1]&&e.pop();for(let t=0;t<e.length;t++){let n=CJ();if(CM(n)){let r=e[t];"\n"===r||"\r\n"===r?n.insertParagraph():" "===r?n.insertNodes([CC()]):n.insertText(r)}}}else t.insertRawText(s)}let jc="application/x-lexical-drag";function jd(e,t,n){e.dispatchCommand(_L,{nodes:t,selection:n})||(n.insertNodes(t),function(e){if(CM(e)&&e.isCollapsed()){let t=e.anchor,n=null,r=Tw(t,"previous");if(r)if(Tt(r))n=r.origin;else for(let e of Tm(r,Tc(Ao(),"next").getFlipped())){if(Ck(e.origin)){n=e.origin;break}if(Ek(e.origin)&&!e.origin.isInline())break}if(n&&Ck(n)){let t=n.getFormat(),r=n.getStyle();e.format===t&&e.style===r||(e.format=t,e.style=r,e.dirty=!0)}}}(n))}let jh=null;async function jf(e,t,n){if(null!==jh)return!1;if(null!==t)return new Promise((r,i)=>{e.update(()=>{r(jp(e,t,n))})});let r=e.getRootElement(),i=e._window||window,o=i.document,s=AB(i);if(null===r||null===s)return!1;let a=o.createElement("span");a.style.position="fixed",a.style.top="-1000px",a.append(o.createTextNode("#")),r.append(a);let l=new Range;return l.setStart(a,0),l.setEnd(a,1),s.removeAllRanges(),s.addRange(l),new Promise((t,r)=>{let s=e.registerCommand(Su,r=>(Nn(r,ClipboardEvent)&&(s(),null!==jh&&(i.clearTimeout(jh),jh=null),t(jp(e,r,n))),!0),4);jh=i.setTimeout(()=>{s(),jh=null,t(!1)},50),o.execCommand("copy"),a.remove()})}function jp(e,t,n){if(void 0===n){let t=AB(e._window),r=CJ();if(!r||r.isCollapsed()||!t)return!1;let i=t.anchorNode,o=t.focusNode;if(null!==i&&null!==o&&!Eq(e,i,o))return!1;n=jg(r)}t.preventDefault();let r=t.clipboardData;return null!==r&&(jy(r,n),!0)}let jm=[["text/html",ja],["application/x-lexical-editor",jl]];function jg(e=CJ()){let t,n;var r=(t=AG(),(n=NO.maybeFromEditor(t))&&n.hasExtensionByName(jx.name)?NI(t,jx).output:jv);let i={"text/plain":""};for(let[t,n]of Object.entries(r)){let r=function(e,t){let n=r=>e[r]?e[r](t,n.bind(null,r-1)):null;return n(e.length-1)}(n,e);null!==r&&(i[t]=r)}return i}function jy(e,t){for(let[n]of jm)void 0===t[n]&&e.setData(n,"");for(let n in t){let r=t[n];void 0!==r&&e.setData(n,r)}}let jv={"application/x-lexical-editor":[(e,t)=>e?jl(AG(),e):t()],"text/html":[(e,t)=>e?ja(AG(),e):t()],"text/plain":[(e,t)=>e?e.getTextContent():t()]},jx={build:(e,t,n)=>t.$exportMimeType,config:{$exportMimeType:jv},mergeConfig(e,t){let n=TO(e,t);if(t.$exportMimeType){let r={...e.$exportMimeType};for(let[e,n]of Object.entries(t.$exportMimeType))r[e]=[...r[e],...n];n.$exportMimeType=r}return n},name:"@lexical/clipboard/GetClipboardData"};function jb(e,t){if(void 0!==document.caretRangeFromPoint){let n=document.caretRangeFromPoint(e,t);return null===n?null:{node:n.startContainer,offset:n.startOffset}}if("undefined"!==document.caretPositionFromPoint){let n=document.caretPositionFromPoint(e,t);return null===n?null:{node:n.offsetNode,offset:n.offset}}return null}let jw="u">typeof window&&void 0!==window.document&&void 0!==window.document.createElement,jk=jw&&"documentMode"in document?document.documentMode:null,j_=jw&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),jS=!(!jw||!("InputEvent"in window)||jk)&&"getTargetRanges"in new window.InputEvent("input"),jC=jw&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,jE=jw&&/Android/.test(navigator.userAgent),jA=jw&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent)&&!jE,jT=jw&&/^(?=.*Chrome).*/i.test(navigator.userAgent),jN=jw&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&j_&&!jT,jj=_D("DRAG_DROP_PASTE_FILE");function jP(e){let t=null;if(Nn(e,DragEvent)?t=e.dataTransfer:Nn(e,ClipboardEvent)&&(t=e.clipboardData),null===t)return[!1,[],!1];let n=t.types,r=n.includes("Files"),i=n.includes("text/html")||n.includes("text/plain");return[r,Array.from(t.files),i]}function jM(e){for(let t of["lowercase","uppercase","capitalize"])e.hasFormat(t)&&e.toggleFormat(t)}let jD="u">typeof window&&void 0!==window.document&&void 0!==window.document.createElement?T.useLayoutEffect:T.useEffect;function jR({editor:e,ErrorBoundary:t}){return function(e,t){let[n,r]=(0,T.useState)(()=>e.getDecorators());return jD(()=>e.registerDecoratorListener(e=>{(0,ec.flushSync)(()=>{r(e)})}),[e]),(0,T.useEffect)(()=>{r(e.getDecorators())},[e]),(0,T.useMemo)(()=>{let r=[],i=Object.keys(n);for(let o=0;o<i.length;o++){let s=i[o],a=(0,A.jsx)(t,{onError:t=>e._onError(t),children:(0,A.jsx)(T.Suspense,{fallback:null,children:n[s]})}),l=e.getElementByKey(s);null!==l&&r.push((0,ec.createPortal)(a,l,s))}return r},[t,n,e])}(e,t)}function jL({editor:e,ErrorBoundary:t}){return!function(e){let t=NO.maybeFromEditor(e);if(t&&t.hasExtensionByName("@lexical/react/ReactProvider")){for(let e of["@lexical/plain-text","@lexical/rich-text"])t.hasExtensionByName(e)&&function(...e){let t=new URL("https://lexical.dev/docs/error"),n=new URLSearchParams;for(let t of(n.append("code",320),e))n.append("v",t);throw t.search=n.toString(),Error(`Minified Lexical error #320; visit ${t.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(e);return!0}return!1}(e)?(0,A.jsx)(jR,{editor:e,ErrorBoundary:t}):null}function jO(e){return e.getEditorState().read(TV(e.isComposing()))}function jI({contentEditable:e,placeholder:t=null,ErrorBoundary:n}){var r;let[i]=kb();return jD(()=>{var e;return TF(TF((e=r).registerCommand(_O,e=>{let t=CJ();return!!CR(t)&&(t.clear(),!0)},0),e.registerCommand(_$,e=>{let t=CJ();return CM(t)?(t.deleteCharacter(e),!0):!!CR(t)&&(t.deleteNodes(),!0)},0),e.registerCommand(_G,e=>{let t=CJ();return!!CM(t)&&(t.deleteWord(e),!0)},0),e.registerCommand(_q,e=>{let t=CJ();return!!CM(t)&&(t.deleteLine(e),!0)},0),e.registerCommand(_W,t=>{let n=CJ();if("string"==typeof t)null!==n&&n.insertText(t);else{if(null===n)return!1;let r=t.dataTransfer;if(null!=r)ju(r,n,e);else if(CM(n)){let e=t.data;return e&&n.insertText(e),!0}}return!0},0),e.registerCommand(_K,()=>{let e=CJ();return!!CM(e)&&(e.removeText(),!0)},0),e.registerCommand(_J,e=>{let t=CJ();return!!CM(t)&&(t.formatText(e),!0)},0),e.registerCommand(So,e=>{let t=CJ();if(!CM(t)&&!CR(t))return!1;for(let n of t.getNodes()){let t=A2(n,e=>Ek(e)&&!e.isInline());null!==t&&t.setFormat(e)}return!0},0),e.registerCommand(_U,e=>{let t=CJ();return!!CM(t)&&(t.insertLineBreak(e),!0)},0),e.registerCommand(_V,()=>{let e=CJ();return!!CM(e)&&(e.insertParagraph(),!0)},0),e.registerCommand(St,()=>{let e=CC(),t=CJ();return CM(t)&&(e.setFormat(t.format),e.setStyle(t.style)),C5([e]),!0},0),e.registerCommand(Sn,()=>Nr(e=>{let t=e.getIndent();e.setIndent(t+1)}),0),e.registerCommand(Sr,()=>Nr(e=>{let t=e.getIndent();t>0&&e.setIndent(Math.max(0,t-1))}),0),e.registerCommand(_5,e=>{let t=CJ();if(CR(t)){let n=t.getNodes();if(n.length>0)return e.preventDefault(),n[0].selectPrevious(),!0}else if(CM(t)){let n=AS(t.focus,!0);if(!e.shiftKey&&EC(n)&&!n.isIsolated()&&!n.isInline())return n.selectPrevious(),e.preventDefault(),!0}return!1},0),e.registerCommand(_3,e=>{let t=CJ();if(CR(t)){let n=t.getNodes();if(n.length>0)return e.preventDefault(),n[0].selectNext(0,0),!0}else if(CM(t)){let n;if("root"===(n=t.focus).key&&n.offset===Ao().getChildrenSize())return e.preventDefault(),!0;let r=AS(t.focus,!1);if(!e.shiftKey&&EC(r)&&!r.isIsolated()&&!r.isInline())return r.selectNext(),e.preventDefault(),!0}return!1},0),e.registerCommand(_1,e=>{let t=CJ();if(CR(t)){let n=t.getNodes();if(n.length>0)return e.preventDefault(),T2(n[0])?n[0].selectNext(0,0):n[0].selectPrevious(),!0}if(!CM(t))return!1;if(T8(t,!0)){let n=e.shiftKey;return e.preventDefault(),T7(t,n,!0),!0}return!1},0),e.registerCommand(_Q,e=>{let t=CJ();if(CR(t)){let n=t.getNodes();if(n.length>0)return e.preventDefault(),T2(n[0])?n[0].selectPrevious():n[0].selectNext(0,0),!0}if(!CM(t))return!1;let n=e.shiftKey;return!!T8(t,!1)&&(e.preventDefault(),T7(t,n,!1),!0)},0),e.registerCommand(_8,t=>{if(EC(An(t.target)))return!1;let n=CJ();if(CM(n)){if(function(e){var t;let n;if(!e.isCollapsed())return!1;let{anchor:r}=e;if(0!==r.offset)return!1;let i=r.getNode();if(EA(i))return!1;let o=(n=A2(t=i,e=>Ek(e)&&!e.isInline()),Ek(n)||function(...e){let t=new URL("https://lexical.dev/docs/error"),n=new URLSearchParams;for(let t of(n.append("code",4),e))n.append("v",t);throw t.search=n.toString(),Error(`Minified Lexical error #${4}; visit ${t.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(t.__key),n);return o.getIndent()>0&&(o.is(i)||i.is(o.getFirstDescendant()))}(n))return t.preventDefault(),e.dispatchCommand(Sr,void 0);if(jC&&"ko-KR"===navigator.language)return!1}else if(!CR(n))return!1;return t.preventDefault(),e.dispatchCommand(_$,!0)},0),e.registerCommand(_7,t=>{if(EC(An(t.target)))return!1;let n=CJ();return!(!CM(n)&&!CR(n))&&(t.preventDefault(),e.dispatchCommand(_$,!1))},0),e.registerCommand(_4,t=>{let n=CJ();if(!CM(n))return!1;if(jM(n),null!==t){if((jC||jA||jN)&&jS)return!1;if(t.preventDefault(),t.shiftKey)return e.dispatchCommand(_U,!1)}return e.dispatchCommand(_V,void 0)},0),e.registerCommand(_9,()=>!!CM(CJ())&&(e.blur(),!0),0),e.registerCommand(Si,t=>{let[,n]=jP(t);if(n.length>0){let r=jb(t.clientX,t.clientY);if(null!==r){let{offset:t,node:i}=r,o=An(i);if(null!==o){let e=CK();if(Ck(o))e.anchor.set(o.getKey(),t,"text"),e.focus.set(o.getKey(),t,"text");else{let t=o.getParentOrThrow().getKey(),n=o.getIndexWithinParent()+1;e.anchor.set(t,n,"element"),e.focus.set(t,n,"element")}Aa(_t(e))}e.dispatchCommand(jj,n)}return t.preventDefault(),!0}return function(e,t,n){let r=e.dataTransfer;if(null===r)return!1;let i=function(e){var t;let n,r=e.getData(jc);if(!r)return null;try{n=JSON.parse(r)}catch(e){return null}return null!==(t=n)&&"object"==typeof t&&"editorKey"in t&&"string"==typeof t.editorKey?n:null}(r);if(null===i)return!1;let o=function(e){let t=function(e,t){if(void 0!==document.caretRangeFromPoint){let n=document.caretRangeFromPoint(e,t);return null===n?null:{node:n.startContainer,offset:n.startOffset}}if("undefined"!==document.caretPositionFromPoint){let n=document.caretPositionFromPoint(e,t);return null===n?null:{node:n.offsetNode,offset:n.offset}}return null}(e.clientX,e.clientY);if(null===t)return null;let n=An(t.node);if(null===n)return null;if(Ck(n))return Tl(n,"next",t.offset);if(Ek(n))return TD(n,t.offset,"next");let r=n.getParent();return null===r?null:TD(r,n.getIndexWithinParent()+1,"next")}(e);if(null===o)return!1;let s=function(e,{$copyElementNode:t=AL,$splitTextPointCaretNext:n=TR,rootMode:r="shadowRoot",$shouldSplit:i=TL,removeEmptyDestination:o=!1}={}){if(Tt(e))return n(e);let s=e.getParentCaret(r);if(s){let{origin:n}=s;if(Tr(e)){let e=TE(s);if(o&&n.isEmpty())return n.remove(),e;if(!n.canBeEmpty()||!i(n,"first"))return e}let r=function(e){let t=[];for(let n=e.getAdjacentCaret();n;n=n.getAdjacentCaret())t.push(n.origin);return t}(e);(r.length>0||!o&&n.canBeEmpty()&&i(n,"last"))&&s.insert(t(n).splice(0,0,r))}return s}(o);if(null===s)return!1;let a=i.editorKey===t.getKey(),l=CJ();if(a){if(!CM(l)||l.isCollapsed())return!1;if(function(e,t){let{anchor:n,focus:r}=TM(TC(t),"next");return 0>Ty(n,e)&&0>Ty(e,r)}(o,l))return e.preventDefault(),!0;l.removeText()}if(!s.origin.isAttached())return e.preventDefault(),!0;if(n(r,T_(Tm(s,s)),t),!a){let e=t.getRootElement(),n=e?e.ownerDocument:null,r=n?function(e,t){for(let n of Array.from(t.querySelectorAll('[data-lexical-editor="true"]'))){let t=n.__lexicalEditor;if(t&&t.getKey()===e)return n}return null}(i.editorKey,n):null;null!==r&&r.dispatchEvent(new InputEvent("beforeinput",{bubbles:!0,cancelable:!0,inputType:"deleteByDrag"}))}return e.preventDefault(),!0}(t,e,ju)},0),e.registerCommand(Ss,t=>{var n;let r,[i]=jP(t),o=CJ();return!(i&&!CM(o))&&(CM(o)&&!o.isCollapsed()&&null!==t.dataTransfer&&(jy(t.dataTransfer,jg(o)),n=t.dataTransfer,r={editorKey:e.getKey()},n.setData(jc,JSON.stringify(r))),!0)},0),e.registerCommand(Sa,e=>{let[t]=jP(e),n=CJ();if(t&&!CM(n))return!1;let r=jb(e.clientX,e.clientY);return null!==r&&EC(An(r.node))&&e.preventDefault(),!0},0),e.registerCommand(Sd,()=>((function(){let e=Ao();if(CM(void 0)){let e=(void 0).anchor,t=(void 0).focus,n=e.getNode().getTopLevelElementOrThrow().getParentOrThrow();return e.set(n.getKey(),0,"element"),t.set(n.getKey(),n.getChildrenSize(),"element"),_t(void 0)}Aa(_t(e.select(0,e.getChildrenSize())))})(),!0),0),e.registerCommand(Su,t=>(jf(e,Nn(t,ClipboardEvent)?t:null),!0),0),e.registerCommand(Sc,t=>((async function(e,t){await jf(t,Nn(e,ClipboardEvent)?e:null),t.update(()=>{let e=CJ();CM(e)?e.removeText():CR(e)&&e.getNodes().forEach(e=>e.remove())})})(t,e),!0),0),e.registerCommand(_H,t=>{let[,n,r]=jP(t);return n.length>0&&!r?(e.dispatchCommand(jj,n),!0):!(AU(t.target)&&EG(t.target))&&null!==CJ()&&(t.preventDefault(),e.update(()=>{let n=CJ(),r=Nn(t,InputEvent)||Nn(t,KeyboardEvent)?null:t.clipboardData;null!=r&&null!==n&&ju(r,n,e)},{tag:"paste"}),!0)},0),e.registerCommand(_6,e=>{let t=CJ();return CM(t)&&jM(t),!1},0),e.registerCommand(Se,e=>{let t=CJ();return CM(t)&&jM(t),!1},0)),NK(r))},[r=i]),(0,A.jsxs)(A.Fragment,{children:[e,(0,A.jsx)(jF,{content:t}),(0,A.jsx)(jL,{editor:i,ErrorBoundary:n})]})}function jF({content:e}){let[t]=kb(),n=function(e){let[t,n]=(0,T.useState)(()=>jO(e));return jD(()=>{function t(){n(jO(e))}return t(),TF(e.registerUpdateListener(()=>{t()}),e.registerEditableListener(()=>{t()}))},[e]),t}(t),r=function(e){let[t]=kb(),n=(0,T.useMemo)(()=>e(t),[t,e]),[r,i]=(0,T.useState)(()=>n.initialValueFn()),o=(0,T.useRef)(r);return NW(()=>{let{initialValueFn:e,subscribe:t}=n,r=e();return o.current!==r&&(o.current=r,i(r)),t(e=>{o.current=e,i(e)})},[n,e]),r}(NH);return n?"function"==typeof e?e(r):e:null}class jz extends ES{__href;__label;static getType(){return"file-reference"}static clone(e){return new jz(e.__label,e.__href,e.__key)}static importJSON(e){var t;return t=e.label,new jz(t,e.href)}constructor(e,t,n){super(n),this.__label=e,this.__href=t}createDOM(){let e=document.createElement("span");return e.className="composer-link-chip-shell",e}updateDOM(){return!1}decorate(){return(0,A.jsx)("span",{className:"composer-link-chip",title:this.__href,children:this.__label||jY(this.__href)})}exportJSON(){return{...super.exportJSON(),href:this.__href,label:this.__label,type:jz.getType(),version:1}}getTextContent(){return`[${(this.__label||jY(this.__href)).replace(/([\\[\]])/g,"\\$1")}](${encodeURI(this.__href)})`}isInline(){return!0}isKeyboardSelectable(){return!0}}let jB=(0,T.forwardRef)(function({className:e,onSubmit:t,onTrigger:n,placeholder:r},i){let o=(0,T.useRef)(null),s=(0,T.useRef)("");return(0,T.useImperativeHandle)(i,()=>({focus(){o.current?.focus()},getValue:()=>s.current,insertText(e,t={}){let n=o.current;n&&(n.update(()=>{jH(e,t),s.current=jq()}),n.focus())},removeCurrentTriggerToken(e){let t=o.current;t&&e&&t.update(()=>{let t=CJ();if(!CM(t)||!t.isCollapsed()||"text"!==t.anchor.type)return;let n=t.anchor.getNode();if(!Ck(n))return;let r=t.anchor.offset;r<=0||n.getTextContent()[r-1]!==e||(n.spliceText(r-1,1,""),s.current=jq())})},setValue(e){s.current=e;let t=o.current;t&&t.update(()=>{jW(e),s.current=jq()})}}),[]),(0,A.jsxs)(TU,{initialConfig:{namespace:"codex-web-ui-composer",nodes:[jz],onError(e){throw e},theme:{paragraph:"composer-lexical-paragraph"}},children:[(0,A.jsx)(j$,{editorRef:o,valueRef:s}),(0,A.jsx)(jI,{contentEditable:(0,A.jsx)(TG,{className:e,"aria-placeholder":r,placeholder:(0,A.jsx)("span",{className:"composer-lexical-placeholder",children:r})}),ErrorBoundary:TQ}),(0,A.jsx)(N$,{}),(0,A.jsx)(NV,{ignoreHistoryMergeTagChange:!0,ignoreSelectionChange:!0,onChange:e=>{e.read(()=>{s.current=jq(),n?.(function(){let e=CJ();if(!CM(e)||!e.isCollapsed()||"text"!==e.anchor.type)return null;let t=e.anchor.getNode();if(!Ck(t))return null;let n=t.getTextContent().slice(0,e.anchor.offset),r=/(?:^|\s)([@$])$/.exec(n),i=r?.[1];return"@"===i||"$"===i?i:null}())})}}),(0,A.jsx)(jU,{onSubmit:t}),(0,A.jsx)(jV,{})]})});function j$({editorRef:e,valueRef:t}){let[n]=kb();return(0,T.useEffect)(()=>(e.current=n,n.update(()=>{Ao().getFirstChild()||jW(t.current)}),()=>{e.current===n&&(e.current=null)}),[n,e,t]),null}function jU({onSubmit:e}){let[t]=kb();return(0,T.useEffect)(()=>{let n=t.getRootElement();if(n)return n.addEventListener("keydown",r),()=>n.removeEventListener("keydown",r);function r(t){"Enter"===t.key&&(t.ctrlKey||t.metaKey)&&!t.isComposing&&(t.preventDefault(),e?.())}},[t,e]),null}function jV(){let[e]=kb();return(0,T.useEffect)(()=>{let t=e.getRootElement();if(t)return t.addEventListener("paste",n),()=>t.removeEventListener("paste",n);function n(t){let n=t.clipboardData?.getData("text/plain");n&&jG().test(n)&&(t.preventDefault(),e.update(()=>jH(n,{block:!1})))}},[e]),null}function jW(e){let t=Ao();t.clear();let n=e.split("\n");for(let e of n.length?n:[""]){let n=ER();(function(e,t){for(let n of jK(t))e.append(n)})(n,e),t.append(n)}t.selectEnd()}function jH(e,t){if(!CM(CJ()))return;let n=jq(),r=!!(t.block&&n.trim()&&!n.endsWith("\n")),i=!!t.block,o=[];r&&o.push(Cw("\n")),o.push(...jK(e)),i&&o.push(Cw("\n")),C5(o)}function jK(e){let t=[],n=jG(),r=0;for(let i of e.matchAll(n))void 0!==i.index&&(i.index>r&&t.push(Cw(e.slice(r,i.index))),t.push(new jz((i[1]||"").replace(/\\([\\[\]])/g,"$1"),function(e){try{return decodeURIComponent(e)}catch{return e}}(i[2]||""))),r=i.index+i[0].length);return r<e.length&&t.push(Cw(e.slice(r))),t.length?t:[Cw("")]}function jG(){return/\[([^\]\n]{1,160})\]\(([^)\n]{1,700})\)/g}function jq(){return Ao().getChildren().map(e=>EL(e)||Ek(e)?e.getChildren().map(jJ).join(""):jJ(e)).join("\n")}function jJ(e){return e instanceof jz||Ck(e)?e.getTextContent():Ek(e)?e.getChildren().map(jJ).join(""):e.getTextContent()}function jY(e){let t=e.replace(/:\d+(?::\d+)?$/,"");return t.split(/[\\/]/).filter(Boolean).at(-1)||t}let jX=D("file-text",[["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:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]),jZ=D("file",[["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"}]]);D("folder-open",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);let jQ=(0,T.createContext)({expandedPaths:new Set,togglePath:()=>{}}),j0=({expanded:e,defaultExpanded:t=new Set,selectedPath:n,onSelect:r,onExpandedChange:i,className:o,children:s,...a})=>{let[l,u]=(0,T.useState)(t),c=e??l,d=(0,T.useCallback)(e=>{let t=new Set(c);t.has(e)?t.delete(e):t.add(e),u(t),i?.(t)},[c,i]),h=(0,T.useMemo)(()=>({expandedPaths:c,onSelect:r,selectedPath:n,togglePath:d}),[c,r,n,d]);return(0,A.jsx)(jQ.Provider,{value:h,children:(0,A.jsx)("div",{className:oG("rounded-lg border bg-background font-mono text-sm",o),role:"tree",...a,children:(0,A.jsx)("div",{className:"p-2",children:s})})})},j1=({className:e,children:t,...n})=>(0,A.jsx)("span",{className:oG("shrink-0",e),...n,children:t}),j2=({className:e,children:t,...n})=>(0,A.jsx)("span",{className:oG("truncate",e),...n,children:t}),j5=(0,T.createContext)({name:"",path:""}),j3=({path:e,name:t,icon:n,className:r,children:i,...o})=>{let{selectedPath:s,onSelect:a}=(0,T.useContext)(jQ),l=s===e,u=(0,T.useCallback)(()=>{a?.(e)},[a,e]),c=(0,T.useCallback)(t=>{("Enter"===t.key||" "===t.key)&&a?.(e)},[a,e]),d=(0,T.useMemo)(()=>({name:t,path:e}),[t,e]);return(0,A.jsx)(j5.Provider,{value:d,children:(0,A.jsx)("div",{className:oG("flex cursor-pointer items-center gap-1 rounded px-2 py-1 transition-colors hover:bg-muted/50",l&&"bg-muted",r),onClick:u,onKeyDown:c,role:"treeitem",tabIndex:0,...o,children:i??(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)("span",{className:"size-4 shrink-0"}),(0,A.jsx)(j1,{children:n??(0,A.jsx)(jZ,{className:"size-4 text-muted-foreground"})}),(0,A.jsx)(j2,{children:t})]})})})},j4=e=>e.stopPropagation(),j6=({className:e,children:t,...n})=>(0,A.jsx)("div",{className:oG("ml-auto flex items-center gap-1",e),onClick:j4,onKeyDown:j4,role:"group",...n,children:t});function j8({explorer:e,loading:t,onBrowse:n,onClose:r,onOpenFile:i,onRefresh:o,title:s="Files"}){let[a,l]=(0,T.useState)(""),u=(0,T.useMemo)(()=>{let t=a.trim().toLowerCase(),n=e?.entries??[];return t?n.filter(e=>`${e.name}
|
|
6
6
|
${e.relativePath}
|
|
7
|
-
${e.kind||""}`.toLowerCase().includes(t)):n},[e,a]),c=(0,T.useMemo)(()=>new Map(u.map(e=>[e.path,e])),[u]);return(0,A.jsx)("div",{className:"modal-backdrop",children:(0,A.jsxs)("section",{className:"modal file-explorer-modal",role:"dialog","aria-modal":"true","aria-labelledby":"file-explorer-title",children:[(0,A.jsxs)("header",{className:"modal-header",children:[(0,A.jsxs)("div",{className:"file-viewer-title",children:[(0,A.jsx)("h2",{id:"file-explorer-title",children:s}),(0,A.jsx)("p",{className:"muted",children:e?.displayPath||"Loading project files"})]}),(0,A.jsx)("button",{className:"icon-button",type:"button",onClick:r,title:"Close",children:(0,A.jsx)(eu,{size:16})})]}),(0,A.jsxs)("div",{className:"file-explorer-toolbar",children:[(0,A.jsxs)("label",{className:"file-search-field",children:[(0,A.jsx)(eo,{size:15}),(0,A.jsx)("input",{value:a,onChange:e=>l(e.target.value),placeholder:"Filter files"})]}),(0,A.jsx)("button",{className:"icon-button",type:"button",onClick:o,disabled:t,title:"Refresh files","aria-label":"Refresh files",children:(0,A.jsx)(er,{size:16,className:t?"spin-icon":""})}),(0,A.jsx)("button",{className:"icon-button",type:"button",disabled:!e?.parentPath||t,onClick:()=>e?.parentPath&&n(e.parentPath),title:"Parent directory","aria-label":"Parent directory",children:(0,A.jsx)(I,{size:17})})]}),e&&(0,A.jsxs)("div",{className:"file-explorer-summary",children:[(0,A.jsxs)("span",{children:[e.entries.length," entries"]}),(0,A.jsxs)("span",{children:[e.trackedCount," tracked"]}),e.relativePath&&(0,A.jsx)("span",{children:e.relativePath})]}),(0,A.jsxs)("div",{className:`file-explorer-list ${t?"loading":""}`,children:[t&&e&&(0,A.jsx)("div",{className:"file-list-progress",children:(0,A.jsx)(wu,{as:"span",duration:1.4,children:"Loading files"})}),e?0===u.length?(0,A.jsx)("p",{className:"muted empty-pad",children:"No files found."}):(0,A.jsx)(j1,{className:"file-explorer-tree",onSelect:function(e){let r=c.get(e);if(r&&!t){if("directory"===r.type)return void n(r.path);i(r)}},children:u.map(e=>(0,A.jsxs)(j4,{className:"file-explorer-tree-row",path:e.path,name:e.name,title:e.displayPath,children:[(0,A.jsx)(j2,{className:`file-explorer-icon ${e.type}`,children:"directory"===e.type?(0,A.jsx)(U,{size:18}):(0,A.jsx)(jZ,{size:18})}),(0,A.jsxs)("span",{className:"file-explorer-main",children:[(0,A.jsx)("strong",{children:(0,A.jsx)(j5,{children:e.name})}),(0,A.jsx)("span",{children:e.relativePath||e.displayPath})]}),(0,A.jsxs)(j8,{className:"file-explorer-meta",children:[e.tracked&&(0,A.jsx)("span",{className:"file-tracked-badge",children:"git"}),"file"===e.type&&(0,A.jsx)("span",{children:Pn(e.size??0)}),e.kind&&(0,A.jsx)("span",{children:e.kind})]})]},`${e.type}:${e.path}`))}):(0,A.jsx)(wu,{className:"muted empty-pad",duration:1.4,children:"Loading files"})]})]})})}function j7({reference:e,onClose:t}){return(0,A.jsx)("div",{className:"modal-backdrop",children:(0,A.jsxs)("section",{className:"modal file-loading-modal",role:"dialog","aria-modal":"true","aria-labelledby":"file-loading-title",children:[(0,A.jsxs)("header",{className:"modal-header",children:[(0,A.jsxs)("div",{className:"file-viewer-title",children:[(0,A.jsx)("h2",{id:"file-loading-title",children:"Opening file"}),(0,A.jsx)("p",{className:"muted",children:e.label||e.path})]}),(0,A.jsx)("button",{className:"icon-button",type:"button",onClick:t,title:"Close",children:(0,A.jsx)(eu,{size:16})})]}),(0,A.jsx)("div",{className:"file-loading-body",children:(0,A.jsx)(wu,{as:"span",duration:1.4,children:"Loading preview"})})]})})}function Pe({file:e,reference:t,onClose:n}){var r,i,o;let s;return(0,A.jsx)("div",{className:"modal-backdrop",children:(0,A.jsxs)("section",{className:"modal file-viewer-modal",role:"dialog","aria-modal":"true","aria-labelledby":"file-viewer-title",children:[(0,A.jsxs)("header",{className:"modal-header",children:[(0,A.jsxs)("div",{className:"file-viewer-title",children:[(0,A.jsx)("h2",{id:"file-viewer-title",children:e.name}),(0,A.jsxs)("p",{className:"muted",children:[e.displayPath," | ",Pn(e.size)]})]}),(0,A.jsx)("button",{className:"icon-button",type:"button",onClick:n,title:"Close",children:(0,A.jsx)(eu,{size:16})})]}),(0,A.jsx)("div",{className:"file-viewer-body",children:(r=e,i=t,s=r.content??"","image"===r.kind?(0,A.jsx)(Pt,{className:"file-image-preview",file:r,reference:i,type:"image"}):"pdf"===r.kind?(0,A.jsx)(Pt,{className:"file-pdf-preview",file:r,reference:i,type:"pdf"}):"video"===r.kind?(0,A.jsx)(Pt,{className:"file-video-preview",file:r,reference:i,type:"video"}):"json"===r.kind?(0,A.jsx)(dr,{className:"file-preview-code",code:function(e){try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}(s),language:"json",showLineNumbers:!0}):"markdown"===r.kind?(0,A.jsx)("div",{className:"markdown file-markdown-preview",children:(0,A.jsx)(rT,{remarkPlugins:[i$],children:s})}):"code"===r.kind?(0,A.jsx)(dr,{className:"file-preview-code",code:s,language:{js:"javascript",jsx:"jsx",ts:"typescript",tsx:"tsx",py:"python",rs:"rust",sh:"bash",bash:"bash",zsh:"bash",yml:"yaml",yaml:"yaml",md:"markdown",markdown:"markdown"}[(o=r).extension]||o.extension||"markdown",showLineNumbers:!0}):(0,A.jsx)(dr,{className:"file-preview-code",code:s,language:"markdown"}))}),(0,A.jsxs)("footer",{className:"modal-actions",children:[(0,A.jsx)("button",{className:"ghost-button",type:"button",onClick:()=>void kd(t,e.name),children:"Download"}),(0,A.jsx)("button",{className:"primary-button",type:"button",onClick:n,children:"Done"})]})]})})}function Pt({className:e,file:t,reference:n,type:r}){let[i,o]=(0,T.useState)(""),[s,a]=(0,T.useState)("");return((0,T.useEffect)(()=>{let e=!0,t="";return o(""),a(""),kc(n,!0).then(n=>{e&&o(t=URL.createObjectURL(n))}).catch(t=>{e&&a(t instanceof Error?t.message:String(t))}),()=>{e=!1,t&&URL.revokeObjectURL(t)}},[n.cwd,n.path]),s)?(0,A.jsx)("p",{className:"error-text empty-pad",children:s}):i?"image"===r?(0,A.jsx)("img",{className:e,src:i,alt:t.name}):"pdf"===r?(0,A.jsx)("iframe",{className:e,src:i,title:t.name}):(0,A.jsx)("video",{className:e,src:i,controls:!0,playsInline:!0,preload:"metadata"}):(0,A.jsx)(wu,{className:"muted empty-pad",duration:1.4,children:"Loading preview"})}function Pn(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}let Pr={cwd:"",model:"gpt-5.5",effort:"high",approvalPolicy:"on-request",sandbox:"workspace-write"},Pi=[.16,.26,.42,.32,.22,.34,.18],Po=[.3,.58,.82,.48,.72,.4,.62],Ps="codex",Pa="codex-web-ui-saved-composer-drafts-v1",Pl="codex-web-ui-layout-v1",Pu="codex-web-ui-thread-permissions-v1",Pc=["sessions","thread"],Pd=function(){try{var e,t;let n,r,i;return e=JSON.parse(window.localStorage.getItem(Pl)||"{}"),r=(t=(n=M_(e)).threadPaneCount,1===t||2===t?t:4===t?2:void 0),i="thread"===n.mobilePane||"sessions"===n.mobilePane?n.mobilePane:void 0,{activePaneIndex:MF(n.activePaneIndex)??void 0,composerCollapsed:"boolean"==typeof n.composerCollapsed?n.composerCollapsed:void 0,mobilePane:i,openThreadIds:Array.isArray(n.openThreadIds)?n.openThreadIds.map(e=>"string"==typeof e&&e?e:null):void 0,recentOnly:"boolean"==typeof n.recentOnly?n.recentOnly:void 0,showArchived:"boolean"==typeof n.showArchived?n.showArchived:void 0,sidebarWidth:MF(n.sidebarWidth)??void 0,threadPaneCount:r,threadSplitRatio:MF(n.threadSplitRatio)??void 0}}catch{return{}}}();function Ph(e){let t=(0,T.useRef)(e);return(0,T.useLayoutEffect)(()=>{t.current=e}),(0,T.useCallback)((...e)=>t.current(...e),[])}function Pf(e,t){e&&(e.style.setProperty("--thread-left-width",Pp(t)),e.style.setProperty("--thread-right-width",Pp(1-t)))}function Pp(e){return`calc(${(100*e).toFixed(2)}% - ${(8*e).toFixed(2)}px)`}function Pm({group:e,onRowClick:t,selectedThreadId:n,sessionPreviews:r}){let i=e.threads.some(e=>e.id===n),[o,s]=(0,T.useState)(i);return(0,T.useEffect)(()=>{i&&s(!0)},[i]),(0,A.jsxs)("section",{className:`thread-group ${o?"open":""}`,children:[(0,A.jsxs)("button",{className:"thread-group-heading",type:"button","aria-expanded":o,onClick:()=>s(e=>!e),children:[(0,A.jsx)("strong",{children:e.label}),(0,A.jsx)("span",{children:e.threads.length})]}),(0,A.jsx)("div",{className:"thread-group-content-shell",children:(0,A.jsx)("div",{className:"thread-group-content",children:e.threads.map(e=>(0,A.jsxs)("button",{type:"button","data-thread-id":e.id,className:`session-row ${e.id===n?"selected":""}`,onClick:()=>t(e.id),onContextMenu:e=>e.preventDefault(),children:[(0,A.jsx)("strong",{children:Mt(e)}),(0,A.jsx)("p",{children:r[e.id]||e.preview||e.id}),(0,A.jsxs)("div",{className:"session-meta-row",children:[(0,A.jsx)(PG,{value:Pq(e)}),(0,A.jsx)("span",{className:"muted",children:MB(e.updatedAt)})]})]},e.id))})})]})}let Pg=(0,T.memo)(function({activeTurnId:e,archiveLabel:t,composerCollapsed:n,isActive:r,isLoading:i,onActivatePane:o,onArchiveThread:s,onComposerCollapsedChange:a,onForkThread:l,onInterruptThread:u,onRenameThread:c,onError:d,onOpenFile:h,onOpenSettings:f,onReferenceFile:p,onReferenceSkill:m,onSendMessage:g,paneIndex:y,thread:v,tokenUsage:x}){let[b,w]=(0,T.useState)(()=>Ms()),k=(0,T.useRef)(null),_=(0,T.useRef)(0),S=(0,T.useRef)(b),C=(0,T.useRef)(null),E=(0,T.useRef)({}),N=(0,T.useRef)(""),j=(0,T.useRef)(0),P=(0,T.useRef)(0),M=(0,T.useRef)(!0),D=(0,T.useRef)(null),R=(0,T.useMemo)(()=>PA(v?.turns??[]),[v?.turns]),L=(0,T.useMemo)(()=>v?Mj(MA(v),x):null,[v,x]),O=(0,T.useCallback)(()=>{M.current&&I("smooth",2)},[]);function I(e="smooth",t=1){M.current=!0,null!==D.current&&window.cancelAnimationFrame(D.current);let n=t=>{D.current=window.requestAnimationFrame(()=>{D.current=null;let r=k.current;if(r){if(r.scrollTo({top:r.scrollHeight,behavior:e}),_.current=Math.max(0,r.scrollHeight-r.clientHeight),t>1&&M.current)return void n(t-1);Ms()&&z(!0)}})};n(Math.max(1,t))}function F(e){E.current={...E.current,...void 0===e.topHidden?{}:{topHidden:e.topHidden}},null===C.current&&(C.current=window.requestAnimationFrame(()=>{C.current=null;let e=E.current;E.current={},void 0!==e.topHidden&&z(e.topHidden)}))}function z(e){S.current!==e&&(S.current=e,w(e))}return(0,T.useEffect)(()=>()=>{null!==C.current&&window.cancelAnimationFrame(C.current),null!==D.current&&window.cancelAnimationFrame(D.current)},[]),(0,T.useEffect)(()=>{if(!v||"u"<typeof ResizeObserver)return;let e=!1,t=null,n=window.requestAnimationFrame(()=>{if(e)return;let n=k.current?.querySelector(".turn-history-content");n instanceof HTMLElement&&(t=new ResizeObserver(()=>{M.current&&I("instant",1)})).observe(n)});return()=>{e=!0,window.cancelAnimationFrame(n),t?.disconnect()}},[v?.id]),(0,T.useEffect)(()=>{if(!v){N.current="",j.current=0,P.current=0,M.current=!0,z(!1);return}if(N.current!==v.id){N.current=v.id,j.current=R,P.current=PT(v.turns??[]),M.current=!0,z(Ms()),I("instant");return}R>j.current&&M.current&&I("smooth"),P.current=PT(v.turns??[]),j.current=R},[R,v]),(0,A.jsxs)("section",{className:`thread-panel ${b?"top-hidden":""} ${r?"active":""}`,onPointerDown:()=>o(y),children:[(0,A.jsx)("header",{className:"thread-header",children:v?(0,A.jsxs)("div",{className:"thread-title-block",children:[(0,A.jsx)(PG,{value:Pq(v)}),(0,A.jsx)(PK,{thread:v,onRename:e=>c(v,e)}),v.cwd&&(0,A.jsx)("p",{children:v.cwd})]}):i?(0,A.jsx)("div",{className:"thread-title-block empty",children:(0,A.jsx)("h2",{children:(0,A.jsx)(wu,{as:"span",duration:1.4,children:"Loading thread"})})}):(0,A.jsxs)("div",{className:"thread-title-block empty",children:[(0,A.jsx)("h2",{children:"Select a thread"}),(0,A.jsx)("p",{children:"Choose a thread from the list or selector."})]})}),v?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)("div",{className:"conversation",ref:k,onScroll:function(e){let t=e.currentTarget,n=t.scrollTop,r=n-_.current,i=t.scrollHeight-n-t.clientHeight,o=r<-18,s=i<48,a=i>120;(_.current=n,s?M.current=!0:o&&a&&(M.current=!1),Ms())?o&&a?F({topHidden:!1}):s?F({topHidden:!0}):r>18&&F({topHidden:!0}):S.current&&F({topHidden:!1})},children:(0,A.jsx)(P_,{cwd:v.cwd||null,onRenderedItemsChange:O,onOpenFile:h,threadId:v.id,turns:v.turns??[],scrollContainerRef:k},v.id)}),(0,A.jsx)(PJ,{activeTurnId:e,deliveryKey:v.id,deliveryVersion:R,onInterrupt:()=>u(v),onSend:(e,t)=>g(v,y,e,t),onFork:()=>l(v,y),onArchive:()=>s(v,y),archiveLabel:t,collapsed:n,contextUsage:L,onError:d,onCollapsedChange:a,onOpenSettings:f,onReferenceFile:p,onReferenceSkill:m})]}):i?(0,A.jsx)("div",{className:"empty-state thread-loading-placeholder","aria-hidden":"true"}):(0,A.jsxs)("div",{className:"empty-state",children:[(0,A.jsx)("h2",{children:"Select a thread"}),(0,A.jsx)("p",{children:"Choose an existing thread or start a new one."})]})]})});function Py({onRespond:e,onUpgradePermissions:t,permissionPolicy:n,requests:r,respondingIds:i}){let o=[...r].sort((e,t)=>e.receivedAt-t.receivedAt);return(0,A.jsxs)("aside",{className:"approval-tray","aria-label":"Pending approvals",children:[(0,A.jsxs)("header",{children:[(0,A.jsx)("strong",{children:"Approval needed"}),(0,A.jsxs)("span",{children:[o.length," pending"]})]}),(0,A.jsx)("div",{className:"approval-list",children:o.map(r=>(0,A.jsx)(Pv,{onRespond:e,onUpgradePermissions:t,permissionPolicy:n,request:r,responding:i.has(P4(r.id))},P4(r.id)))})]})}function Pv({onRespond:e,onUpgradePermissions:t,permissionPolicy:n,request:r,responding:i}){var o;let s=M_(r.params),a="string"==typeof s.command?s.command:Mx(s.commandActions),l="string"==typeof s.cwd?s.cwd:"",u="string"==typeof s.reason?s.reason:"",c=!!P7(r),d=P9(r,"acceptForSession"),h=P8(n)&&!!P6(r);return(0,A.jsxs)(dJ,{approval:{id:P4(r.id)},className:"approval-card",state:"approval-requested",children:[(0,A.jsxs)(dY,{className:"approval-card-heading",children:[(0,A.jsx)("span",{children:"item/commandExecution/requestApproval"===(o=r.method)?"Command execution":"item/fileChange/requestApproval"===o?"File change":"item/mcpToolCall/requestApproval"===o?"MCP tool call":"item/permissions/requestApproval"===o?"Permission request":"App-server request"}),(0,A.jsx)("code",{children:r.method})]}),(0,A.jsx)(dX,{children:(0,A.jsxs)("div",{className:"approval-request",children:[a&&(0,A.jsx)("pre",{className:"approval-command",children:a}),u&&(0,A.jsx)("p",{className:"approval-reason",children:u}),l&&(0,A.jsx)("p",{className:"approval-cwd muted",title:l,children:l})]})}),(0,A.jsxs)(dZ,{className:"approval-actions",children:[(0,A.jsx)(dQ,{className:"primary-button",disabled:i,onClick:()=>void e(r,"accept"),children:"Approve"}),d&&(0,A.jsx)(dQ,{className:"secondary-button",disabled:i,onClick:()=>void e(r,"acceptForSession"),children:"Approve session"}),c&&(0,A.jsx)(dQ,{className:"secondary-button",disabled:i,onClick:()=>void e(r,"acceptWithExecpolicyAmendment"),children:"Trust command"}),h&&(0,A.jsxs)(dQ,{className:"nuclear-button",disabled:i,onClick:()=>void t(r),title:"Allow full permissions for this thread",children:[(0,A.jsx)(en,{size:16})," Full control"]}),(0,A.jsx)(dQ,{className:"danger-button",disabled:i,onClick:()=>void e(r,"decline"),children:"Deny"})]})]})}function Px({activeThread:e,mcpLoading:t,mcpServers:n,rateLimits:r,status:i,statusRefreshing:o,onClose:s,onLoginMcpServer:a,onRecover:l,onRefresh:u,onRefreshMcp:c,onSaveMcpServer:d}){var h;let f="string"==typeof i.config?.appServerSocketPath?i.config.appServerSocketPath:"stdio / owned",[p,m]=(0,T.useState)("agro-ontology"),[g,y]=(0,T.useState)("http://127.0.0.1:3000/api/mcp"),[v,x]=(0,T.useState)(null),[b,w]=(0,T.useState)(null),[k,_]=(0,T.useState)(""),[S,C]=(0,T.useState)(!1);async function E(e){e.preventDefault(),C(!0);try{await d({name:p,url:g})}finally{C(!1)}}async function N(e){let t=window.open("",`codex-mcp-oauth-${e}`,"popup,width=560,height=760");x(e),_("");try{let n=await a(e);t?t.location.href=n:w({name:e,url:n})}catch(e){throw t?.close(),_(M$(e)),e}finally{x(null)}}return(0,A.jsx)("div",{className:"modal-backdrop",children:(0,A.jsxs)("section",{className:"modal status-modal",role:"dialog","aria-modal":"true","aria-labelledby":"status-title",children:[(0,A.jsxs)("header",{className:"modal-header",children:[(0,A.jsxs)("div",{children:[(0,A.jsx)("h2",{id:"status-title",children:"Status"}),(0,A.jsxs)("p",{className:"muted",children:[i.command??"codex"," ",i.state?`is ${i.state}`:""]})]}),(0,A.jsx)("button",{className:"icon-button",type:"button",onClick:s,title:"Close",children:(0,A.jsx)(eu,{size:16})})]}),(0,A.jsxs)("div",{className:"status-grid",children:[(0,A.jsx)(Pw,{label:"App server",value:(0,A.jsx)(PG,{value:i.state})}),(0,A.jsx)(Pw,{label:"Socket",value:f}),(0,A.jsx)(Pw,{label:"Codex cwd",value:i.cwd||"Unavailable"}),(0,A.jsx)(Pw,{label:"Active thread",value:e?`${Mt(e)} (${(h=e.id).length>14?`${h.slice(0,8)}...${h.slice(-4)}`:h})`:"None"}),(0,A.jsx)(Pw,{label:"5hr remaining",value:(0,A.jsx)(Pk,{value:MO(r,"5hr")})}),(0,A.jsx)(Pw,{label:"Weekly remaining",value:(0,A.jsx)(Pk,{value:MO(r,"weekly")})})]}),i.error&&(0,A.jsx)("p",{className:"error-text",children:i.error}),(0,A.jsxs)("section",{className:"status-section mcp-status-section",children:[(0,A.jsxs)("header",{className:"section-heading",children:[(0,A.jsxs)("div",{children:[(0,A.jsx)("h3",{children:"MCP Servers"}),(0,A.jsxs)("p",{className:"muted",children:["Config is written to ",n?.configPath||"~/.codex/config.toml"," and reloaded without stopping the app-server."]})]}),(0,A.jsxs)("button",{className:"secondary-button",type:"button",onClick:()=>void c(),disabled:t,children:[(0,A.jsx)(er,{size:16,className:t?"spin-icon":""})," Reload"]})]}),(0,A.jsx)("div",{className:"mcp-server-list",children:n?.servers.length?n.servers.map(e=>(0,A.jsx)(Pb,{loginPending:v===e.name,onLogin:()=>void N(e.name),server:e},e.name)):(0,A.jsxs)("div",{className:"empty-state inline",children:[(0,A.jsx)("h2",{children:t?"Loading MCP servers":"No MCP servers"}),(0,A.jsx)("p",{children:"Add a streamable HTTP MCP server below."})]})}),(0,A.jsxs)("form",{className:"mcp-server-form",onSubmit:E,children:[(0,A.jsxs)("label",{className:"field",children:[(0,A.jsx)("span",{children:"Name"}),(0,A.jsx)("input",{value:p,onChange:e=>m(e.target.value),placeholder:"agro-ontology"})]}),(0,A.jsxs)("label",{className:"field",children:[(0,A.jsx)("span",{children:"URL"}),(0,A.jsx)("input",{value:g,onChange:e=>y(e.target.value),placeholder:"http://127.0.0.1:3000/api/mcp"})]}),(0,A.jsxs)("button",{className:"primary-button",type:"submit",disabled:S||t,children:[(0,A.jsx)(ee,{size:16})," Save MCP"]})]})]}),b&&(0,A.jsxs)("section",{className:"status-section oauth-fallback-panel",children:[(0,A.jsxs)("div",{children:[(0,A.jsx)("h3",{children:"OAuth login"}),(0,A.jsxs)("p",{className:"muted",children:["Popup blocked for ",b.name,". Open the login page manually."]})]}),(0,A.jsxs)("a",{className:"primary-button",href:b.url,target:"_blank",rel:"noreferrer",onClick:()=>w(null),children:[(0,A.jsx)(K,{size:16})," Open login"]})]}),k&&(0,A.jsx)("section",{className:"status-section oauth-error-panel",children:(0,A.jsxs)("div",{children:[(0,A.jsx)("h3",{children:"OAuth login needs attention"}),(0,A.jsx)("p",{children:k})]})}),(0,A.jsx)("p",{className:"muted",children:"Rate limits use the app-server account quota snapshot. Recover checks the sidecar PID and socket, then reconnects this UI."}),(0,A.jsxs)("footer",{className:"modal-actions",children:[(0,A.jsxs)("button",{className:"secondary-button",type:"button",onClick:()=>void l(),children:[(0,A.jsx)(er,{size:16})," Recover app-server"]}),(0,A.jsxs)("button",{className:"primary-button",type:"button",onClick:()=>void u(),disabled:o,children:[(0,A.jsx)(er,{size:16,className:o?"spin-icon":""})," Refresh"]})]})]})})}function Pb({loginPending:e,onLogin:t,server:n}){var r;let i="notLoggedIn"===n.authStatus,o="bearerToken"===(r=n.authStatus)?"token":"notLoggedIn"===r?"login required":"oAuth"===r?"oauth":"unsupported"===r?"unsupported":r||"unknown";return(0,A.jsxs)("article",{className:"mcp-server-card",children:[(0,A.jsxs)("div",{className:"mcp-server-card-header",children:[(0,A.jsxs)("strong",{children:[(0,A.jsx)(ee,{size:15})," ",n.name]}),(0,A.jsx)("span",{children:o})]}),(0,A.jsxs)("p",{children:[n.tools.length," tools",n.resources||n.resourceTemplates?`, ${n.resources+n.resourceTemplates} resources`:""]}),i&&(0,A.jsxs)("button",{className:"secondary-button",type:"button",onClick:t,disabled:e,children:[(0,A.jsx)(K,{size:16,className:e?"spin-icon":""})," ",e?"Opening":"Log in"]}),n.tools.length>0&&(0,A.jsx)("div",{className:"mcp-tool-list",children:n.tools.map(e=>(0,A.jsx)("code",{children:e},e))})]})}function Pw({label:e,value:t}){return(0,A.jsxs)("div",{className:"status-detail",children:[(0,A.jsx)("span",{children:e}),(0,A.jsx)("strong",{children:t})]})}function Pk({value:e}){var t,n;return(0,A.jsx)("span",{className:`usage-metric ${null===(t=e)?"neutral":t<=10?"bad":t<=30?"busy":"good"}`,children:null===(n=e)?"--":`${Math.round(n)}%`})}let P_=(0,T.memo)(function({cwd:e,onRenderedItemsChange:t,onOpenFile:n,scrollContainerRef:r,threadId:i,turns:o}){let[s,a]=(0,T.useState)(20),[l,u]=(0,T.useState)(()=>new Set),c=(0,T.useRef)(new Set),d=(0,T.useRef)(null),h=(0,T.useRef)(!1),f=(0,T.useRef)(null),p=(0,T.useMemo)(()=>{var e;let t,n;return t=!1,n=(e=o).map(e=>{let n=e.items??[],r=PN(Pj(n));return r===n?e:(t=!0,{...e,items:r})}),t?n:e},[o]),m=(0,T.useMemo)(()=>PA(p),[p]),g=(0,T.useMemo)(()=>(function(e,t){let n=[],r=t;for(let t=e.length-1;t>=0&&r>0;t-=1){let i=e[t],o=i?.items??[];if(0===o.length)continue;let s=o.slice(Math.max(0,o.length-r));n.unshift({turn:i,items:s}),r-=s.length}return n})(p,s),[p,s]),y=(0,T.useMemo)(()=>g.reduce((e,t)=>e+t.items.length,0),[g]),v=Math.max(0,m-y);return((0,T.useEffect)(()=>{a(20);let e=new Set;c.current=e,u(e),h.current=!1,f.current=null},[i]),(0,T.useEffect)(()=>{let e=d.current,t=r.current;if(!e||!t||0===v)return;let n=new IntersectionObserver(([e])=>{e?.isIntersecting&&!h.current&&(h.current=!0,f.current=t.scrollHeight,a(e=>Math.min(m,e+20)))},{root:t,rootMargin:"160px 0px 0px 0px",threshold:.01});return n.observe(e),()=>n.disconnect()},[v,r,m,s]),(0,T.useEffect)(()=>{let e=g.flatMap(({turn:e,items:t})=>t.map(t=>PS(e.id,t))).reverse().filter(e=>!c.current.has(e));if(0===e.length)return;let t=!1,n=null,r=()=>{if(n=null,t)return;let i=e.splice(0,4);i.length>0&&u(e=>{let t=new Set(e);for(let e of i)t.add(e);return c.current=t,t}),e.length>0&&(n=PC(r))};return n=PC(r),()=>{t=!0,n?.()}},[i,g]),(0,T.useLayoutEffect)(()=>{t()},[t,l]),(0,T.useLayoutEffect)(()=>{let e=f.current,t=r.current;null!==e&&t&&(t.scrollTop+=t.scrollHeight-e,f.current=null,h.current=!1)},[r,s]),0===o.length||0===m)?(0,A.jsxs)("div",{className:"empty-state inline",children:[(0,A.jsx)("h2",{children:"No items loaded"}),(0,A.jsx)("p",{children:"Select a thread or send a message."})]}):(0,A.jsxs)("div",{className:"turn-history-content",children:[v>0&&(0,A.jsxs)("div",{className:"history-limit",ref:d,"aria-live":"polite",children:[(0,A.jsx)("span",{className:"spinner","aria-hidden":"true"}),(0,A.jsx)("span",{children:"Loading earlier items"}),(0,A.jsxs)("span",{className:"history-count",children:[y," of ",m]})]}),g.map(({turn:t,items:r})=>(0,A.jsxs)("section",{className:"turn-block",children:[(0,A.jsxs)("div",{className:"turn-heading",children:[(0,A.jsx)(PG,{value:t.status}),(0,A.jsx)("span",{className:"turn-id",children:t.id}),(0,A.jsx)("span",{className:"turn-date",children:MB(t.startedAt)})]}),r.map(r=>{let i=PS(t.id,r);return l.has(i)?(0,A.jsx)(PR,{cwd:e,item:r,onOpenFile:n},i):(0,A.jsx)(PE,{item:r},i)})]},t.id))]})});function PS(e,t){return`${e}:${t.id}`}function PC(e){if("function"==typeof window.requestIdleCallback&&"function"==typeof window.cancelIdleCallback){let t=window.requestIdleCallback(e,{timeout:80});return()=>window.cancelIdleCallback(t)}let t=window.setTimeout(e,0);return()=>window.clearTimeout(t)}function PE({item:e}){var t;let n=(t=PL(e.type))?Mb(t):null;return(0,A.jsxs)("article",{className:`item ${Mw(e.type)} loading-item`,children:[n&&(0,A.jsx)("div",{className:"item-label",children:n}),(0,A.jsx)("div",{className:"item-body",children:(0,A.jsx)(wu,{as:"span",duration:1.2,children:"Loading item"})})]})}function PA(e){return e.reduce((e,t)=>e+PN(Pj(t.items??[])).length,0)}function PT(e){return e.reduce((e,t)=>e+(t.items??[]).filter(My).length,0)}function PN(e){let t=[],n=null,r=()=>{var e,r;n&&(t.push((e=n.kind,1===(r=n.items).length?r[0]:{id:`${e}:${r[0]?.id??"start"}`,type:e,items:r})),n=null)};for(let o of e){var i;let e="commandGroup"===(i=o).type||"reasoningGroup"===i.type?null:"commandExecution"===i.type?"commandGroup":"reasoning"===i.type?"reasoningGroup":null;if(!e){r(),t.push(o);continue}n&&n.kind===e||(r(),n={kind:e,items:[]}),n.items.push(o)}return r(),t}function Pj(e){let t=new Set,n=new Set,r=null;for(let i of e){let o=t.has(i.id),s=PP(i),a=!!(s&&n.has(s));if(o||a){r??=e.slice(0,t.size);continue}t.add(i.id),s&&n.add(s),r?.push(i)}return r??e}function PP(e){if("userMessage"===e.type){let t=Mv(e.content).trim();return t?`userMessage:${t}`:null}if("agentMessage"===e.type){let t="string"==typeof e.text?e.text.trim():"";return t?`agentMessage:${t}`:null}return null}function PM(e,t,n,r){let i=e.turns??[],o=!1,s=i.map(e=>{var i,s,a;let l,u,c;return e.id!==t?e:(o=!0,i=e,s=n,a=r,l=i.items??[],u=!1,c=l.map(e=>e.id!==s?e:(u=!0,a(e))),u||c.push(a({id:s,type:"agentMessage"})),{...i,items:c})});return o||s.push({id:t,status:"inProgress",items:[r({id:n,type:"agentMessage"})]}),{...e,turns:s}}function PD(e){return"inprogress"===String(e.status??"").toLowerCase()}let PR=(0,T.memo)(function({cwd:e,item:t,compact:n=!1,onOpenFile:r}){var i,o;let s=(i=PL(t.type))?Mb(i):null;return(0,A.jsxs)("article",{className:`item item-${t.type} ${Mw(t.type)} ${"agentMessage"!==(o=t).type?"":My(o)?"final-answer":"commentary"===String(M_(o).phase??"").toLowerCase().replace(/[_\s-]+/g,"")?"commentary":""} ${n?"compact":""}`,children:[s&&(0,A.jsx)("div",{className:"item-label",children:s}),(0,A.jsx)("div",{className:"item-body",children:function(e,t,n){var r,i,o;if("commandGroup"===e.type)return(0,A.jsx)(PI,{cwd:t,items:e.items??[],onOpenFile:n});if("reasoningGroup"===e.type)return(0,A.jsx)(PF,{items:e.items??[]});if("userMessage"===e.type)return(0,A.jsx)(PV,{cwd:t,onOpenFile:n,text:Mv(e.content)});if("agentMessage"===e.type){let i="string"==typeof(r=e.phase)&&r.trim()?r.trim().replace(/[_-]+/g," ").replace(/\s+/g," ").split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" "):null;return(0,A.jsxs)(A.Fragment,{children:[i&&(0,A.jsx)("p",{className:"muted item-phase",children:i}),(0,A.jsx)(PV,{cwd:t,onOpenFile:n,text:"string"==typeof e.text?e.text:""})]})}if("reasoning"===e.type)return(0,A.jsx)(Pz,{items:[e],title:"Reasoning"});if("plan"===e.type)return(0,A.jsx)(PV,{cwd:t,onOpenFile:n,text:"string"==typeof e.text?e.text:"Plan updated"});if("commandExecution"===e.type){let t="string"==typeof e.command?e.command:Mx(e.commandActions);return(0,A.jsx)(PO,{className:"command-output",meta:[e.status,"number"==typeof(i=e.exitCode)?`exit ${i}`:"",e.cwd].filter(Boolean).join(" | "),title:`$ ${t||"command"}`,children:"string"==typeof e.aggregatedOutput&&e.aggregatedOutput?(0,A.jsx)(wb,{className:"command-terminal",isStreaming:String(e.status??"").toLowerCase().includes("running"),output:(o=e.aggregatedOutput).length<=16e3?o:`${o.slice(0,16e3)}
|
|
8
|
-
... truncated ${o.length-16e3} chars ...`}):(0,A.jsx)("p",{className:"muted",children:"No command output."})})}if("fileChange"===e.type)return(0,A.jsx)(PB,{cwd:t,item:e,onOpenFile:n});if("mcpToolCall"===e.type||"dynamicToolCall"===e.type){let t,n,r,i,o=[e.server,e.namespace,e.tool].filter(Boolean).join(".")||"Tool call";return(0,A.jsxs)(wH,{className:"tool-call-element",defaultOpen:!1,children:[(0,A.jsx)(wq,{state:["failed","error","systemerror"].includes(t=String(e.status??"").toLowerCase())?"output-error":["denied","cancelled","canceled"].includes(t)?"output-denied":["running","inprogress","active","pending"].includes(t)?"input-available":["waitingonapproval","approval-requested"].includes(t)?"approval-requested":"output-available",title:o,toolName:o,type:"dynamic-tool"}),(0,A.jsxs)(wJ,{children:[(0,A.jsx)(wY,{input:(n=M_(e)).input??n.arguments??n.params??n}),(0,A.jsx)(wX,{errorText:"string"==typeof(r=M_(e)).error?r.error:void 0,output:(i=M_(e)).output??i.result??i.content??null})]})]})}return"webSearch"===e.type?(0,A.jsx)(PV,{cwd:t,onOpenFile:n,text:"string"==typeof e.query?e.query:"Web search"}):"imageView"===e.type?(0,A.jsx)("p",{children:String(e.path??"Image viewed")}):(0,A.jsx)(dr,{className:"json-block",code:JSON.stringify(e,null,2),language:"json"})}(t,e,r)})]})});function PL(e){return"agentMessage"===e||"userMessage"===e?null:e}function PO({children:e,className:t="",defaultOpen:n=!1,meta:r,title:i}){let[o,s]=(0,T.useState)(n);return(0,A.jsxs)("div",{className:`collapsible-output ${o?"open":""} ${t}`,children:[(0,A.jsxs)("button",{className:"collapsible-summary",type:"button","aria-expanded":o,onClick:()=>s(e=>!e),children:[(0,A.jsx)("span",{className:"summary-title command-line",children:i}),r&&(0,A.jsx)("span",{className:"summary-meta",children:r})]}),(0,A.jsx)("div",{className:"collapsible-content-shell",children:(0,A.jsx)("div",{className:"collapsible-content",children:e})})]})}function PI({cwd:e,items:t,onOpenFile:n}){let r=[...new Set(t.map(e=>String(e.status??"")).map(e=>e.trim()).filter(Boolean))];return(0,A.jsx)(PO,{className:"command-group-output",meta:r.join(" | ")||`${t.length} commands`,title:`Commands (${t.length})`,children:(0,A.jsx)("div",{className:"collated-item-list",children:t.map(t=>(0,A.jsx)(PR,{compact:!0,cwd:e,item:t,onOpenFile:n},t.id))})})}function PF({items:e}){return(0,A.jsx)(Pz,{items:e,title:`Reasoning (${e.length})`})}function Pz({items:e,title:t}){let n=e.some(e=>String(e.status??"").toLowerCase().includes("running"))?"Thinking":1===e.length?"Thought":`${e.length} entries`;return(0,A.jsxs)("div",{className:"reasoning-static","aria-label":t,children:[(0,A.jsx)("span",{className:"reasoning-static-title",children:t}),(0,A.jsx)("span",{className:"reasoning-static-meta",children:n})]})}function PB({cwd:e,item:t,onOpenFile:n}){var r;let i=Array.isArray(r=t.changes)?r.map(P$).filter(e=>!!e):[];return 0===i.length?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)("p",{children:String(t.status??"changed")}),(0,A.jsx)(dr,{className:"json-block",code:JSON.stringify(t.changes??[],null,2),language:"json"})]}):(0,A.jsxs)("div",{className:"file-change-view",children:[(0,A.jsxs)("div",{className:"file-change-summary",children:[(0,A.jsx)("span",{children:String(t.status??"changed")}),(0,A.jsxs)("strong",{children:[i.length," file",1===i.length?"":"s"]})]}),(0,A.jsx)("div",{className:"file-change-list",children:i.map((t,r)=>(0,A.jsx)(PO,{className:"file-diff-card",meta:(0,A.jsxs)("span",{className:"file-diff-meta",children:[(0,A.jsx)("span",{children:t.kind}),t.movePath&&(0,A.jsxs)("span",{children:["from ",PU(t.movePath)]}),t.stats.added>0&&(0,A.jsxs)("span",{className:"diff-stat add",children:["+",t.stats.added]}),t.stats.removed>0&&(0,A.jsxs)("span",{className:"diff-stat remove",children:["-",t.stats.removed]})]}),title:(0,A.jsxs)("span",{className:"file-diff-path",title:t.path,children:[(0,A.jsx)($,{size:15}),(0,A.jsx)("span",{children:PU(t.path)})]}),children:(0,A.jsxs)("div",{className:"file-diff-body",children:[(0,A.jsx)("button",{className:"secondary-button file-diff-open",type:"button",onClick:()=>void n({path:t.path,cwd:e,label:Mo(t.path)}),children:"Open file"}),t.lines.length>0?(0,A.jsx)("div",{className:"diff-block",role:"table","aria-label":`Diff for ${t.path}`,children:t.lines.map((e,t)=>{var n;return(0,A.jsxs)("div",{className:`diff-line ${e.kind}`,role:"row",children:[(0,A.jsx)("span",{className:"diff-line-marker","aria-hidden":"true",children:"add"===(n=e).kind?"+":"remove"===n.kind?"-":"hunk"===n.kind?"@":" "}),(0,A.jsx)("code",{children:e.text||" "})]},`${t}-${e.text}`)})}):(0,A.jsx)("p",{className:"muted",children:"No textual diff available."})]})},`${t.path}-${r}`))})]})}function P$(e){let t=M_(e),n="string"==typeof t.path?t.path:"";if(!n)return null;let r=M_(t.kind),i=("string"==typeof t.diff?t.diff:"").split("\n").filter((e,t,n)=>e||t<n.length-1).map(e=>e.startsWith("@@")?{kind:"hunk",text:e}:e.startsWith("+++")||e.startsWith("---")?{kind:"meta",text:e}:e.startsWith("+")?{kind:"add",text:e.slice(1)}:e.startsWith("-")?{kind:"remove",text:e.slice(1)}:{kind:"context",text:e.startsWith(" ")?e.slice(1):e});return{path:n,movePath:"string"==typeof r.move_path?r.move_path:null,kind:"string"==typeof r.type?r.type:String(t.status??"changed"),lines:i,stats:i.reduce((e,t)=>({added:e.added+ +("add"===t.kind),removed:e.removed+ +("remove"===t.kind)}),{added:0,removed:0})}}function PU(e){let t=Mi(e),n="/home/uphill/";return t.startsWith(n)?`~/${t.slice(n.length)}`:t}let PV=(0,T.memo)(function({cwd:e,onOpenFile:t,text:n}){let r,i;return(0,A.jsx)("div",{className:"markdown",children:(0,A.jsx)(rT,{remarkPlugins:[i$],components:{a({href:n,children:r}){let i=n?function(e){if(!e||e.startsWith("#")||/^(?:mailto:|data:|blob:)/i.test(e))return"";if(/^https?:/i.test(e)){try{var t;let n=new URL(e),r=Mn(decodeURIComponent(n.pathname)),i=window.location.origin;if(n.origin===i||(t=r,/^\/(?:home|Users|tmp|var|mnt|opt|workspace|app)\//.test(t)))return r}catch{}return""}if(e.startsWith("file://"))try{return Mn(decodeURIComponent(new URL(e).pathname))}catch{return Mn(e.replace(/^file:\/\//,""))}return Mn(decodeURIComponent(e.split("#")[0]?.split("?")[0]||e))}(n):"";return i&&Mr(i)?(0,A.jsx)("button",{className:"file-link-button",type:"button",onClick:n=>{n.preventDefault(),n.stopPropagation(),t({path:i,cwd:e,label:function e(t){return"string"==typeof t||"number"==typeof t?String(t):Array.isArray(t)?t.map(e).join(""):""}(r)||i})},children:r}):(0,A.jsx)("a",{href:n,children:r})}},children:(r=/(^|[\s"'])([~./A-Za-z0-9_-][^\s`"'<>)]{0,240}\.(?:json|md|markdown|mdx|py|tsx?|jsx?|css|scss|html|yaml|yml|toml|txt|log|csv|rs|go|java|kt|swift|c|h|cpp|hpp|cs|rb|php|sh|bash|zsh|fish|sql|xml|vue|svelte|png|jpe?g|gif|webp|bmp|avif|svg|pdf|mp4|m4v|webm|mov|ogv|ogg|avi|mkv|3gp|docx?|xlsx?|pptx?)(?::\d+(?::\d+)?)?)/gi,i=!1,n.split("\n").map(e=>e.trimStart().startsWith("```")?(i=!i,e):i||e.includes("](")?e:e.replace(r,(e,t,n,r,i)=>{let o=i[r+t.length-1]||"";if("`"===o||"["===o||"("===o)return e;let s=Mn(n);return Mr(s)?`${t}[${n}](${encodeURI(s)})`:e})).join("\n"))})})});function PW({title:e,settings:t,permissionPolicy:n,includePrompt:r=!1,onClose:i,onSubmit:o}){let[s,a]=(0,T.useState)(t),[l,u]=(0,T.useState)(""),c=n?.allowedApprovalPolicies.length?n.allowedApprovalPolicies:["on-request","untrusted"],d=n?.allowedSandboxes.length?n.allowedSandboxes:["read-only","workspace-write"],h=!!n?.locked;return(0,A.jsx)("div",{className:"modal-backdrop",children:(0,A.jsxs)("form",{className:"modal",onSubmit:e=>{e.preventDefault(),o({settings:s,prompt:l})},children:[(0,A.jsxs)("header",{className:"modal-header",children:[(0,A.jsx)("h2",{children:e}),(0,A.jsx)("button",{className:"icon-button",type:"button",onClick:i,title:"Close",children:(0,A.jsx)(eu,{size:16})})]}),(0,A.jsxs)("div",{className:"form-grid",children:[r?(0,A.jsx)(PH,{value:s.cwd,onChange:e=>a({...s,cwd:e})}):(0,A.jsxs)("label",{className:"field",children:[(0,A.jsx)("span",{children:"Working directory"}),(0,A.jsx)("input",{value:s.cwd,onChange:e=>a({...s,cwd:e.target.value}),placeholder:"/path/to/project"})]}),(0,A.jsxs)("label",{className:"field",children:[(0,A.jsx)("span",{children:"Model"}),(0,A.jsxs)("select",{value:s.model,onChange:e=>a({...s,model:e.target.value}),children:[(0,A.jsx)("option",{value:"gpt-5.5",children:"GPT-5.5"}),(0,A.jsx)("option",{value:"gpt-5.4",children:"GPT-5.4"})]})]}),(0,A.jsxs)("label",{className:"field",children:[(0,A.jsx)("span",{children:"Reasoning effort"}),(0,A.jsxs)("select",{value:s.effort,onChange:e=>a({...s,effort:e.target.value}),children:[(0,A.jsx)("option",{value:"minimal",children:"minimal"}),(0,A.jsx)("option",{value:"low",children:"low"}),(0,A.jsx)("option",{value:"medium",children:"medium"}),(0,A.jsx)("option",{value:"high",children:"high"}),(0,A.jsx)("option",{value:"xhigh",children:"xhigh"})]})]}),(0,A.jsxs)("label",{className:"field",children:[(0,A.jsx)("span",{children:"Approval policy"}),(0,A.jsx)("select",{value:s.approvalPolicy,onChange:e=>a({...s,approvalPolicy:e.target.value}),disabled:h,children:c.map(e=>(0,A.jsx)("option",{value:e,children:e},e))})]}),(0,A.jsxs)("label",{className:"field",children:[(0,A.jsx)("span",{children:"Sandbox"}),(0,A.jsx)("select",{value:s.sandbox,onChange:e=>a({...s,sandbox:e.target.value}),disabled:h,children:d.map(e=>(0,A.jsx)("option",{value:e,children:e},e))})]})]}),r&&(0,A.jsxs)("label",{className:"field",children:[(0,A.jsx)("span",{children:"Initial message"}),(0,A.jsx)("textarea",{value:l,onChange:e=>u(e.target.value),rows:7})]}),(0,A.jsxs)("footer",{className:"modal-actions",children:[(0,A.jsx)("button",{className:"ghost-button",type:"button",onClick:i,children:"Cancel"}),(0,A.jsx)("button",{className:"primary-button",type:"submit",children:r?"Start":"Save"})]})]})})}function PH({value:e,onChange:t}){let[n,r]=(0,T.useState)(null),[i,o]=(0,T.useState)(!1),[s,a]=(0,T.useState)(""),[l,u]=(0,T.useState)("");async function c(e){o(!0),a("");try{r(await kr(e||void 0))}catch(e){a(M$(e))}finally{o(!1)}}async function d(){if(n&&l.trim()){o(!0),a("");try{let e=await ks(n.path,l.trim());r(e),u(""),t(e.path)}catch(e){a(M$(e))}finally{o(!1)}}}return(0,T.useEffect)(()=>{c(e||void 0)},[]),(0,A.jsxs)("section",{className:"directory-picker",children:[(0,A.jsxs)("div",{className:"field",children:[(0,A.jsx)("span",{children:"Working directory"}),(0,A.jsxs)("div",{className:"path-pill",children:[(0,A.jsx)("strong",{children:n?.displayPath||e||"~"}),n?.isGitRepo&&(0,A.jsx)(PG,{value:"git repo"})]})]}),(0,A.jsxs)("div",{className:"directory-toolbar",children:[(0,A.jsxs)("button",{className:"ghost-button",type:"button",onClick:()=>c(n?.homePath),disabled:i,children:[(0,A.jsx)(H,{size:16})," Home"]}),(0,A.jsxs)("button",{className:"ghost-button",type:"button",onClick:()=>c(n?.parentPath),disabled:i||!n?.parentPath,children:[(0,A.jsx)(I,{size:16})," Up"]}),(0,A.jsxs)("button",{className:"primary-button",type:"button",onClick:()=>n&&t(n.path),disabled:!n?.isGitRepo,children:[(0,A.jsx)(V,{size:16})," Select"]})]}),(0,A.jsxs)("div",{className:"directory-list",children:[i&&(0,A.jsx)("p",{className:"muted empty-pad",children:"Loading"}),!i&&n?.entries.map(e=>(0,A.jsxs)("div",{className:`directory-row ${e.isGitRepo?"git-repo":""}`,children:[(0,A.jsxs)("button",{type:"button",onClick:()=>c(e.path),children:[e.isGitRepo?(0,A.jsx)(V,{size:17}):(0,A.jsx)(U,{size:17}),(0,A.jsx)("span",{children:e.name})]}),(0,A.jsx)("button",{className:"ghost-button",type:"button",onClick:()=>t(e.path),disabled:!e.isGitRepo,children:"Select"})]},e.path)),!i&&n?.entries.length===0&&(0,A.jsx)("p",{className:"muted empty-pad",children:"No folders"})]}),(0,A.jsxs)("div",{className:"new-repo-form",children:[(0,A.jsxs)("label",{className:"field",children:[(0,A.jsx)("span",{children:"Create repository"}),(0,A.jsx)("input",{value:l,onChange:e=>u(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),d())},placeholder:"folder-name"})]}),(0,A.jsxs)("button",{className:"secondary-button",type:"button",onClick:d,disabled:i||!n||!l.trim(),children:[(0,A.jsx)(et,{size:16})," Create"]})]}),e&&(0,A.jsxs)("p",{className:"selected-path",children:["Selected: ",e]}),s&&(0,A.jsx)("p",{className:"error-text",children:s})]})}function PK({thread:e,onRename:t}){let[n,r]=(0,T.useState)(Mt(e)),[i,o]=(0,T.useState)(!1);async function s(){o(!1),await t(n)}return(0,T.useEffect)(()=>{r(Mt(e))},[e.id,e.name,e.preview]),(0,A.jsx)("input",{className:"thread-title-input",value:n,onChange:e=>r(e.target.value),onFocus:()=>o(!0),onBlur:()=>void s(),onKeyDown:t=>{"Enter"===t.key&&(t.preventDefault(),t.currentTarget.blur()),"Escape"===t.key&&(r(Mt(e)),o(!1),t.currentTarget.blur())},"aria-label":"Thread title",title:i?"Press Enter to save":"Click to rename"})}let PG=(0,T.memo)(function({value:e}){var t,n;let r=e||"unknown";return(0,A.jsx)("span",{className:`status-badge ${["running","idle","completed"].includes(t=r)?"good":["starting","active","inProgress","waitingOnApproval","waitingOnUserInput","turn started"].includes(t)?"busy":["failed","error","systemError","exited","disconnected","stderr"].includes(t)?"bad":["notLoaded","interrupted","stdout"].includes(t)?"info":"neutral"}`,children:{inProgress:"in progress",waitingOnApproval:"waiting approval",waitingOnUserInput:"waiting input",notLoaded:"not loaded",systemError:"system error"}[n=r]||n})});function Pq(e){return e?.status?"string"==typeof e.status?e.status:e.status.type:"unknown"}let PJ=(0,T.memo)(function({activeTurnId:e,archiveLabel:t,collapsed:n,contextUsage:r,deliveryKey:i,deliveryVersion:o,onArchive:s,onCollapsedChange:a,onError:l,onFork:u,onInterrupt:c,onOpenSettings:d,onReferenceFile:h,onReferenceSkill:f,onSend:p}){let[m,g]=(0,T.useState)(!1),[y,v]=(0,T.useState)("idle"),[x,b]=(0,T.useState)(Pi),[w,k]=(0,T.useState)(null),[_,S]=(0,T.useState)(null),[C,E]=(0,T.useState)(null),[N,j]=(0,T.useState)(!1),[P,M]=(0,T.useState)(()=>(function(){try{let e=JSON.parse(window.localStorage.getItem(Pa)||"[]");if(!Array.isArray(e))return[];return e.map(Ma).filter(e=>!!e).slice(0,80)}catch{return[]}})()),[D,R]=(0,T.useState)(!1),[I,$]=(0,T.useState)(null),[U,V]=(0,T.useState)(null),H=(0,T.useRef)(null),K=(0,T.useRef)(null),G=(0,T.useRef)(null),q=(0,T.useRef)(null),ee=(0,T.useRef)(null),et=(0,T.useRef)(null),en=(0,T.useRef)(null),er=(0,T.useRef)(null),eo=(0,T.useRef)(null),el=(0,T.useRef)(0),eu=(0,T.useRef)(Pi),ec=(0,T.useRef)(null),ed=(0,T.useRef)([]),eh=(0,T.useRef)(null),ef=(0,T.useRef)(i),ep=(0,T.useRef)(!1),em=(0,T.useRef)(null);async function eg(t,n){let r=n??eC(),s=r.trim(),a=`${i}\u0000${t}\u0000${s}`,l=Date.now();if(s&&!ep.current&&(em.current?.signature!==a||!(l-em.current.at<2500))){ep.current=!0,em.current={signature:a,at:l},S(null),k(t);try{if(await p(r,t)){if(eE(""),ef.current!==i)return;S({action:t,queued:"send"===t&&!!e,deliveryKey:i,deliveryVersion:o})}else em.current?.signature===a&&(em.current=null)}finally{ep.current=!1,k(null)}}}async function ey(t){e?V(t??eC()):await eg("send",t)}async function ev(e){V(null),await eg(e,U??void 0)}async function ex(e){if(e){g(!0);try{let t=await ka(e),n=P3(t.name,t.path);eA(n,{block:!0})}catch(e){l(e)}finally{g(!1),H.current&&(H.current.value="")}}}async function eb(){if("recording"===y)return void ee.current?.stop();if("idle"===y){if(!navigator.mediaDevices?.getUserMedia||"u"<typeof MediaRecorder)return void l(Error("Audio recording is not available in this browser."));if(!window.isSecureContext)return void l(Error("Microphone permission requires HTTPS, localhost, or another secure browser context."));try{let e=await navigator.mediaDevices.getUserMedia({audio:!0}),t=MediaRecorder.isTypeSupported("audio/webm;codecs=opus")?"audio/webm;codecs=opus":"audio/webm",n=new MediaRecorder(e,{mimeType:t});ed.current=[],eh.current=e,ee.current=n,function(e){ek();let t=window.AudioContext||window.webkitAudioContext;if(!t)return b(Pi);try{let n=new t,r=n.createAnalyser(),i=n.createMediaStreamSource(e);r.fftSize=256,r.smoothingTimeConstant=.72,i.connect(r),en.current=n,et.current=r,er.current=i,ec.current=new Uint8Array(r.fftSize),eu.current=Pi,b(Pi),n.resume().catch(()=>void 0),function e(){var t,n;let r,i=et.current,o=ec.current;if(!i||!o)return;i.getByteTimeDomainData(o);let s=(t=o,n=eu.current.length,r=Math.max(1,Math.floor(t.length/n)),Array.from({length:n},(e,i)=>{let o=i*r,s=i===n-1?t.length:Math.min(t.length,o+r),a=0,l=0;for(let e=o;e<s;e+=1){let n=Math.abs((t[e]??128)-128)/128;a+=n*n,l=Math.max(l,n)}return Math.min(1,Math.max(.08,4.2*Math.sqrt(a/Math.max(1,s-o))+1.25*l))})),a=eu.current.map((e,t)=>.58*e+.42*(s[t]??0));eu.current=a;let l=performance.now();l-el.current>70&&(el.current=l,b(a)),eo.current=window.requestAnimationFrame(e)}()}catch{ek(),b(Pi)}}(e),n.ondataavailable=e=>{e.data.size>0&&ed.current.push(e.data)},n.onerror=()=>{ew(),v("idle"),l(Error("Audio recording failed."))},n.onstop=()=>{let e=ed.current,t=n.mimeType||"audio/webm";if(ew(),0===e.length)return void v("idle");let r=new File(e,`composer-recording-${Date.now()}.webm`,{type:t});v("transcribing"),kl(r).then(e=>{e&&eA(e,{block:!0})}).catch(l).finally(()=>v("idle"))},n.start(),v("recording")}catch(n){var e;let t;ew(),v("idle"),l("NotAllowedError"===(t=(e=n)instanceof DOMException||e instanceof Error?e.name:"")||"PermissionDeniedError"===t?Error("Microphone permission was denied. Enable microphone access for this site and try again."):"NotFoundError"===t||"DevicesNotFoundError"===t?Error("No microphone was found for transcription."):"SecurityError"===t?Error("Microphone permission is blocked by the browser security context or site policy."):e instanceof Error?e:Error(String(e)))}}}function ew(){for(let e of(ek(),ee.current=null,eh.current?.getTracks()??[]))e.stop();eh.current=null}function ek(){null!==eo.current&&(window.cancelAnimationFrame(eo.current),eo.current=null),er.current?.disconnect(),er.current=null,et.current?.disconnect(),et.current=null;let e=en.current;en.current=null,e?.close().catch(()=>void 0),ec.current=null,el.current=0,eu.current=Pi,b(Pi)}function e_(e){j(!1),e()}function eS(e,t={}){var n;n=C,q.current?.removeCurrentTriggerToken(n),eA(e,t)}function eC(){return q.current?.getValue()??""}function eE(e){q.current?.setValue(e)}function eA(e,t={}){q.current?.insertText(e,t)}function eT(e,t){($(null),R(!1),"insert"===t)?eA(e.text,{block:!0}):(eE(e.text),q.current?.focus())}return(0,T.useEffect)(()=>{ef.current=i,ep.current=!1,em.current=null,S(null),k(null),E(null),j(!1),V(null)},[i]),(0,T.useEffect)(()=>{if(_){if(_.deliveryKey!==i)return void S(null);o>_.deliveryVersion&&S(null)}},[i,o,_]),(0,T.useEffect)(()=>{if(C)return window.addEventListener("pointerdown",e),()=>window.removeEventListener("pointerdown",e);function e(e){let t=e.target;t instanceof Node&&G.current?.contains(t)||E(null)}},[C]),(0,T.useEffect)(()=>{if(N)return window.addEventListener("pointerdown",e),()=>window.removeEventListener("pointerdown",e);function e(e){let t=e.target;t instanceof Node&&K.current?.contains(t)||j(!1)}},[N]),(0,T.useEffect)(()=>()=>{ew()},[]),(0,T.useEffect)(()=>{var e=P;try{window.localStorage.setItem(Pa,JSON.stringify(e.slice(0,80)))}catch{}},[P]),(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(p3,{className:`composer ${n?"collapsed":""}`,maxFiles:1,onError:e=>l(Error(e.message)),onSubmit:async()=>{n||await ey(eC())},children:[(0,A.jsxs)("div",{className:"composer-top",children:[(0,A.jsx)("div",{className:"composer-top-left",children:(0,A.jsx)(p9,{className:"icon-button",type:"button",onClick:()=>a(!n),tooltip:n?"Expand composer":"Collapse composer","aria-label":n?"Expand composer":"Collapse composer",children:n?(0,A.jsx)(z,{size:17}):(0,A.jsx)(F,{size:17})})}),(0,A.jsxs)("div",{className:"composer-top-meta",children:[e?(0,A.jsx)(wu,{as:"span",className:"composer-active-status",duration:1.1,children:"Active"}):(0,A.jsx)("span",{children:"Ready"}),(0,A.jsx)(P5,{usage:r})]})]}),(0,A.jsxs)(p4,{className:"composer-body",children:[(0,A.jsx)("div",{className:"composer-rich-text",onFocus:()=>E(null),children:(0,A.jsx)(j$,{className:"composer-lexical-input",ref:q,placeholder:"Send a new message or steer the active turn",onSubmit:()=>void ey(eC()),onTrigger:e=>E(e)})}),(0,A.jsx)(P2,{action:w,notice:_,pendingQueued:"send"===w&&!!e}),(0,A.jsx)(p6,{className:"composer-bottom",children:(0,A.jsxs)(p8,{className:"composer-actions",children:[(0,A.jsx)("input",{className:"file-input",ref:H,type:"file",onChange:e=>void ex(e.currentTarget.files?.[0])}),(0,A.jsxs)("div",{className:"composer-trigger-tools",ref:G,children:[(0,A.jsx)(p9,{className:"icon-button",type:"button",disabled:m||!!w,onClick:()=>H.current?.click(),tooltip:"Attach file","aria-label":"Attach file",children:(0,A.jsx)(Z,{size:17})}),(0,A.jsxs)("div",{className:"composer-overflow",ref:K,children:[(0,A.jsx)(p9,{className:"icon-button",type:"button","aria-expanded":N,"aria-haspopup":"menu",disabled:!!w,onClick:()=>{E(null),j(e=>!e)},tooltip:"Composer actions","aria-label":"Composer actions",children:(0,A.jsx)(X,{size:17})}),N&&(0,A.jsxs)("div",{className:"composer-overflow-menu",role:"menu",children:[(0,A.jsxs)("button",{type:"button",role:"menuitem",onClick:()=>e_(d),children:[(0,A.jsx)(ea,{size:16})," Settings"]}),(0,A.jsxs)("button",{type:"button",role:"menuitem",onClick:()=>{e_(()=>eA("/compact"))},children:[(0,A.jsx)(Y,{size:16})," Compact"]}),(0,A.jsxs)("button",{type:"button",role:"menuitem",onClick:()=>e_(s),children:[(0,A.jsx)(L,{size:16})," ",t]}),(0,A.jsxs)("button",{type:"button",role:"menuitem",onClick:()=>e_(()=>R(!0)),children:[(0,A.jsx)(ei,{size:16})," Drafts"]}),(0,A.jsxs)("button",{type:"button",role:"menuitem",onClick:()=>e_(u),children:[(0,A.jsx)(W,{size:16})," Fork"]})]})]}),C&&(0,A.jsxs)("div",{className:"composer-trigger-menu",role:"menu",children:["@"===C&&(0,A.jsxs)("button",{type:"button",role:"menuitem",disabled:!!w,onClick:function(){j(!1),E(null),h(e=>{eS(P3(e.name,e.relativePath||e.path),{block:!0})})},children:[(0,A.jsx)(O,{size:16})," Reference file"]}),"$"===C&&(0,A.jsxs)("button",{type:"button",role:"menuitem",disabled:!!w,onClick:function(){j(!1),E(null),f(e=>eS(`$${e.name}`))},children:[(0,A.jsx)(B,{size:16})," Reference skill"]})]})]}),(0,A.jsxs)("div",{className:"composer-primary-actions",children:[(0,A.jsx)(p9,{className:`icon-button mic-button ${y}`,type:"button",disabled:m||!!w||"transcribing"===y,onClick:()=>void eb(),tooltip:"recording"===y?"Stop recording":"transcribing"===y?"Transcribing":"Start transcription","aria-label":"recording"===y?"Stop recording":"transcribing"===y?"Transcribing":"Start transcription",children:"idle"===y?(0,A.jsx)(J,{size:17}):(0,A.jsx)(PY,{levels:"recording"===y?x:Po})}),(0,A.jsx)(p9,{className:"icon-button interrupt-button",type:"button",disabled:!e,onClick:c,tooltip:"Interrupt active turn","aria-label":"Interrupt active turn",children:(0,A.jsx)(Q,{size:17})}),(0,A.jsx)(p9,{className:"icon-button save-draft-button",type:"button",onClick:function(){let e=eC();if(!e.trim())return;let t={id:Mu(),savedAt:Date.now(),text:e};M(e=>[t,...e].slice(0,80)),eE("")},tooltip:"Save draft for later","aria-label":"Save draft for later",children:(0,A.jsx)(ei,{size:17})}),(0,A.jsxs)("button",{className:e?"queue-button":"primary-button",disabled:!!w,type:"button",onClick:()=>void ey(eC()),children:[(0,A.jsx)(es,{size:16})," ","send"===w?"Sending":"Send"]})]})]})})]})]}),null!==U&&(0,A.jsx)(PZ,{disabled:!!w,onClose:()=>V(null),onEnqueue:()=>void ev("send"),onSteer:()=>void ev("steer")}),D&&(0,A.jsx)(PQ,{drafts:P,onClose:()=>R(!1),onDelete:function(e){M(t=>t.filter(t=>t.id!==e))},onUse:function(e){if(eC().trim()){R(!1),$(e);return}eT(e,"overwrite")}}),I&&(0,A.jsx)(P0,{draft:I,onClose:()=>$(null),onInsert:()=>eT(I,"insert"),onOverwrite:()=>eT(I,"overwrite")})]})});function PY({levels:e}){return(0,A.jsx)("span",{className:"audio-level-meter","aria-hidden":"true",children:e.map((e,t)=>(0,A.jsx)("span",{style:{"--level":`${Math.max(.08,Math.min(1,e))}`}},t))})}function PX({children:e}){let[t,n]=(0,T.useState)(!1);return((0,T.useEffect)(()=>{n(!0)},[]),t)?(0,ec.createPortal)((0,A.jsx)("div",{className:"modal-backdrop",children:e}),document.body):null}function PZ({disabled:e,onClose:t,onEnqueue:n,onSteer:r}){return(0,A.jsx)(PX,{children:(0,A.jsxs)("section",{className:"modal send-choice-modal",role:"dialog","aria-modal":"true","aria-labelledby":"send-choice-title",children:[(0,A.jsxs)("header",{className:"modal-header",children:[(0,A.jsxs)("div",{children:[(0,A.jsx)("h2",{id:"send-choice-title",children:"Active turn"}),(0,A.jsx)("p",{className:"muted",children:"Choose how to send this input."})]}),(0,A.jsx)("button",{className:"icon-button",type:"button",onClick:t,title:"Close","aria-label":"Close",children:(0,A.jsx)(eu,{size:16})})]}),(0,A.jsxs)("div",{className:"send-choice-actions",children:[(0,A.jsxs)("button",{className:"queue-button",type:"button",onClick:n,disabled:e,children:[(0,A.jsx)(es,{size:16})," Enqueue"]}),(0,A.jsxs)("button",{className:"primary-button",type:"button",onClick:r,disabled:e,children:[(0,A.jsx)(es,{size:16})," Steer active turn"]})]})]})})}function PQ({drafts:e,onClose:t,onDelete:n,onUse:r}){return(0,A.jsx)(PX,{children:(0,A.jsxs)("section",{className:"modal saved-drafts-modal",role:"dialog","aria-modal":"true","aria-labelledby":"saved-drafts-title",children:[(0,A.jsxs)("header",{className:"modal-header",children:[(0,A.jsxs)("div",{children:[(0,A.jsx)("h2",{id:"saved-drafts-title",children:"Saved drafts"}),(0,A.jsx)("p",{className:"muted",children:e.length?`${e.length} saved`:"No saved drafts"})]}),(0,A.jsx)("button",{className:"icon-button",type:"button",onClick:t,title:"Close","aria-label":"Close",children:(0,A.jsx)(eu,{size:16})})]}),e.length>0?(0,A.jsx)("div",{className:"saved-draft-list",children:e.map(e=>{var t;return(0,A.jsxs)("article",{className:"saved-draft-row",children:[(0,A.jsxs)("button",{type:"button",onClick:()=>r(e),children:[(0,A.jsx)("strong",{children:Ml(e.text)}),(0,A.jsx)("span",{children:(t=e.savedAt,new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}).format(new Date(t)))})]}),(0,A.jsx)("button",{className:"icon-button",type:"button",onClick:()=>n(e.id),title:"Delete saved draft","aria-label":"Delete saved draft",children:(0,A.jsx)(el,{size:16})})]},e.id)})}):(0,A.jsxs)("div",{className:"empty-state inline",children:[(0,A.jsx)("h2",{children:"Nothing saved"}),(0,A.jsx)("p",{children:"Use the disk button next to send to save composer text for later."})]})]})})}function P0({draft:e,onClose:t,onInsert:n,onOverwrite:r}){return(0,A.jsx)(PX,{children:(0,A.jsxs)("section",{className:"modal saved-draft-choice-modal",role:"dialog","aria-modal":"true","aria-labelledby":"saved-draft-choice-title",children:[(0,A.jsxs)("header",{className:"modal-header",children:[(0,A.jsxs)("div",{children:[(0,A.jsx)("h2",{id:"saved-draft-choice-title",children:"Composer has text"}),(0,A.jsx)("p",{className:"muted",children:Ml(e.text)})]}),(0,A.jsx)("button",{className:"icon-button",type:"button",onClick:t,title:"Close","aria-label":"Close",children:(0,A.jsx)(eu,{size:16})})]}),(0,A.jsxs)("div",{className:"send-choice-actions",children:[(0,A.jsxs)("button",{className:"secondary-button",type:"button",onClick:n,children:[(0,A.jsx)(et,{size:16})," Insert"]}),(0,A.jsxs)("button",{className:"primary-button",type:"button",onClick:r,children:[(0,A.jsx)(ei,{size:16})," Overwrite"]})]})]})})}function P1({loading:e,onClose:t,onRefresh:n,onSelect:r,skills:i}){let[o,s]=(0,T.useState)(""),a=(0,T.useMemo)(()=>{let e=o.trim().toLowerCase();return e?i.filter(t=>`${t.name}
|
|
7
|
+
${e.kind||""}`.toLowerCase().includes(t)):n},[e,a]),c=(0,T.useMemo)(()=>new Map(u.map(e=>[e.path,e])),[u]);return(0,A.jsx)("div",{className:"modal-backdrop",children:(0,A.jsxs)("section",{className:"modal file-explorer-modal",role:"dialog","aria-modal":"true","aria-labelledby":"file-explorer-title",children:[(0,A.jsxs)("header",{className:"modal-header",children:[(0,A.jsxs)("div",{className:"file-viewer-title",children:[(0,A.jsx)("h2",{id:"file-explorer-title",children:s}),(0,A.jsx)("p",{className:"muted",children:e?.displayPath||"Loading project files"})]}),(0,A.jsx)("button",{className:"icon-button",type:"button",onClick:r,title:"Close",children:(0,A.jsx)(eu,{size:16})})]}),(0,A.jsxs)("div",{className:"file-explorer-toolbar",children:[(0,A.jsxs)("label",{className:"file-search-field",children:[(0,A.jsx)(eo,{size:15}),(0,A.jsx)("input",{value:a,onChange:e=>l(e.target.value),placeholder:"Filter files"})]}),(0,A.jsx)("button",{className:"icon-button",type:"button",onClick:o,disabled:t,title:"Refresh files","aria-label":"Refresh files",children:(0,A.jsx)(er,{size:16,className:t?"spin-icon":""})}),(0,A.jsx)("button",{className:"icon-button",type:"button",disabled:!e?.parentPath||t,onClick:()=>e?.parentPath&&n(e.parentPath),title:"Parent directory","aria-label":"Parent directory",children:(0,A.jsx)(I,{size:17})})]}),e&&(0,A.jsxs)("div",{className:"file-explorer-summary",children:[(0,A.jsxs)("span",{children:[e.entries.length," entries"]}),(0,A.jsxs)("span",{children:[e.trackedCount," tracked"]}),e.relativePath&&(0,A.jsx)("span",{children:e.relativePath})]}),(0,A.jsxs)("div",{className:`file-explorer-list ${t?"loading":""}`,children:[t&&e&&(0,A.jsx)("div",{className:"file-list-progress",children:(0,A.jsx)(wu,{as:"span",duration:1.4,children:"Loading files"})}),e?0===u.length?(0,A.jsx)("p",{className:"muted empty-pad",children:"No files found."}):(0,A.jsx)(j0,{className:"file-explorer-tree",onSelect:function(e){let r=c.get(e);if(r&&!t){if("directory"===r.type)return void n(r.path);i(r)}},children:u.map(e=>(0,A.jsxs)(j3,{className:"file-explorer-tree-row",path:e.path,name:e.name,title:e.displayPath,children:[(0,A.jsx)(j1,{className:`file-explorer-icon ${e.type}`,children:"directory"===e.type?(0,A.jsx)(U,{size:18}):(0,A.jsx)(jX,{size:18})}),(0,A.jsxs)("span",{className:"file-explorer-main",children:[(0,A.jsx)("strong",{children:(0,A.jsx)(j2,{children:e.name})}),(0,A.jsx)("span",{children:e.relativePath||e.displayPath})]}),(0,A.jsxs)(j6,{className:"file-explorer-meta",children:[e.tracked&&(0,A.jsx)("span",{className:"file-tracked-badge",children:"git"}),"file"===e.type&&(0,A.jsx)("span",{children:Pt(e.size??0)}),e.kind&&(0,A.jsx)("span",{children:e.kind})]})]},`${e.type}:${e.path}`))}):(0,A.jsx)(wu,{className:"muted empty-pad",duration:1.4,children:"Loading files"})]})]})})}function j9({reference:e,onClose:t}){return(0,A.jsx)("div",{className:"modal-backdrop",children:(0,A.jsxs)("section",{className:"modal file-loading-modal",role:"dialog","aria-modal":"true","aria-labelledby":"file-loading-title",children:[(0,A.jsxs)("header",{className:"modal-header",children:[(0,A.jsxs)("div",{className:"file-viewer-title",children:[(0,A.jsx)("h2",{id:"file-loading-title",children:"Opening file"}),(0,A.jsx)("p",{className:"muted",children:e.label||e.path})]}),(0,A.jsx)("button",{className:"icon-button",type:"button",onClick:t,title:"Close",children:(0,A.jsx)(eu,{size:16})})]}),(0,A.jsx)("div",{className:"file-loading-body",children:(0,A.jsx)(wu,{as:"span",duration:1.4,children:"Loading preview"})})]})})}function j7({file:e,reference:t,onClose:n}){var r,i,o;let s;return(0,A.jsx)("div",{className:"modal-backdrop",children:(0,A.jsxs)("section",{className:"modal file-viewer-modal",role:"dialog","aria-modal":"true","aria-labelledby":"file-viewer-title",children:[(0,A.jsxs)("header",{className:"modal-header",children:[(0,A.jsxs)("div",{className:"file-viewer-title",children:[(0,A.jsx)("h2",{id:"file-viewer-title",children:e.name}),(0,A.jsxs)("p",{className:"muted",children:[e.displayPath," | ",Pt(e.size)]})]}),(0,A.jsx)("button",{className:"icon-button",type:"button",onClick:n,title:"Close",children:(0,A.jsx)(eu,{size:16})})]}),(0,A.jsx)("div",{className:"file-viewer-body",children:(r=e,i=t,s=r.content??"","image"===r.kind?(0,A.jsx)(Pe,{className:"file-image-preview",file:r,reference:i,type:"image"}):"pdf"===r.kind?(0,A.jsx)(Pe,{className:"file-pdf-preview",file:r,reference:i,type:"pdf"}):"video"===r.kind?(0,A.jsx)(Pe,{className:"file-video-preview",file:r,reference:i,type:"video"}):"json"===r.kind?(0,A.jsx)(dr,{className:"file-preview-code",code:function(e){try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}(s),language:"json",showLineNumbers:!0}):"markdown"===r.kind?(0,A.jsx)("div",{className:"markdown file-markdown-preview",children:(0,A.jsx)(rT,{remarkPlugins:[i$],children:s})}):"code"===r.kind?(0,A.jsx)(dr,{className:"file-preview-code",code:s,language:{js:"javascript",jsx:"jsx",ts:"typescript",tsx:"tsx",py:"python",rs:"rust",sh:"bash",bash:"bash",zsh:"bash",yml:"yaml",yaml:"yaml",md:"markdown",markdown:"markdown"}[(o=r).extension]||o.extension||"markdown",showLineNumbers:!0}):(0,A.jsx)(dr,{className:"file-preview-code",code:s,language:"markdown"}))}),(0,A.jsxs)("footer",{className:"modal-actions",children:[(0,A.jsx)("button",{className:"ghost-button",type:"button",onClick:()=>void kc(t,e.name),children:"Download"}),(0,A.jsx)("button",{className:"primary-button",type:"button",onClick:n,children:"Done"})]})]})})}function Pe({className:e,file:t,reference:n,type:r}){let[i,o]=(0,T.useState)(""),[s,a]=(0,T.useState)("");return((0,T.useEffect)(()=>{let e=!0,t="";return o(""),a(""),ku(n,!0).then(n=>{e&&o(t=URL.createObjectURL(n))}).catch(t=>{e&&a(t instanceof Error?t.message:String(t))}),()=>{e=!1,t&&URL.revokeObjectURL(t)}},[n.cwd,n.path]),s)?(0,A.jsx)("p",{className:"error-text empty-pad",children:s}):i?"image"===r?(0,A.jsx)("img",{className:e,src:i,alt:t.name}):"pdf"===r?(0,A.jsx)("iframe",{className:e,src:i,title:t.name}):(0,A.jsx)("video",{className:e,src:i,controls:!0,playsInline:!0,preload:"metadata"}):(0,A.jsx)(wu,{className:"muted empty-pad",duration:1.4,children:"Loading preview"})}function Pt(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}let Pn={cwd:"",model:"gpt-5.5",effort:"high",approvalPolicy:"on-request",sandbox:"workspace-write"},Pr=[.16,.26,.42,.32,.22,.34,.18],Pi=[.3,.58,.82,.48,.72,.4,.62],Po="codex",Ps="codex-web-ui-saved-composer-drafts-v1",Pa="codex-web-ui-layout-v1",Pl="codex-web-ui-thread-permissions-v1",Pu=["sessions","thread"],Pc=function(){try{var e,t;let n,r,i;return e=JSON.parse(window.localStorage.getItem(Pa)||"{}"),r=(t=(n=Mk(e)).threadPaneCount,1===t||2===t?t:4===t?2:void 0),i="thread"===n.mobilePane||"sessions"===n.mobilePane?n.mobilePane:void 0,{activePaneIndex:MI(n.activePaneIndex)??void 0,composerCollapsed:"boolean"==typeof n.composerCollapsed?n.composerCollapsed:void 0,mobilePane:i,openThreadIds:Array.isArray(n.openThreadIds)?n.openThreadIds.map(e=>"string"==typeof e&&e?e:null):void 0,recentOnly:"boolean"==typeof n.recentOnly?n.recentOnly:void 0,showArchived:"boolean"==typeof n.showArchived?n.showArchived:void 0,sidebarWidth:MI(n.sidebarWidth)??void 0,threadPaneCount:r,threadSplitRatio:MI(n.threadSplitRatio)??void 0}}catch{return{}}}();function Pd(e){let t=(0,T.useRef)(e);return(0,T.useLayoutEffect)(()=>{t.current=e}),(0,T.useCallback)((...e)=>t.current(...e),[])}function Ph(e,t){e&&(e.style.setProperty("--thread-left-width",Pf(t)),e.style.setProperty("--thread-right-width",Pf(1-t)))}function Pf(e){return`calc(${(100*e).toFixed(2)}% - ${(8*e).toFixed(2)}px)`}function Pp({group:e,onRowClick:t,selectedThreadId:n,sessionPreviews:r}){let i=e.threads.some(e=>e.id===n),[o,s]=(0,T.useState)(i);return(0,T.useEffect)(()=>{i&&s(!0)},[i]),(0,A.jsxs)("section",{className:`thread-group ${o?"open":""}`,children:[(0,A.jsxs)("button",{className:"thread-group-heading",type:"button","aria-expanded":o,onClick:()=>s(e=>!e),children:[(0,A.jsx)("strong",{children:e.label}),(0,A.jsx)("span",{children:e.threads.length})]}),(0,A.jsx)("div",{className:"thread-group-content-shell",children:(0,A.jsx)("div",{className:"thread-group-content",children:e.threads.map(e=>(0,A.jsxs)("button",{type:"button","data-thread-id":e.id,className:`session-row ${e.id===n?"selected":""}`,onClick:()=>t(e.id),onContextMenu:e=>e.preventDefault(),children:[(0,A.jsx)("strong",{children:Me(e)}),(0,A.jsx)("p",{children:r[e.id]||e.preview||e.id}),(0,A.jsxs)("div",{className:"session-meta-row",children:[(0,A.jsx)(PK,{value:PG(e)}),(0,A.jsx)("span",{className:"muted",children:Mz(e.updatedAt)})]})]},e.id))})})]})}let Pm=(0,T.memo)(function({activeTurnId:e,archiveLabel:t,composerCollapsed:n,isActive:r,isLoading:i,onActivatePane:o,onArchiveThread:s,onComposerCollapsedChange:a,onForkThread:l,onInterruptThread:u,onRenameThread:c,onError:d,onOpenFile:h,onOpenSettings:f,onReferenceFile:p,onReferenceSkill:m,onSendMessage:g,paneIndex:y,thread:v,tokenUsage:x}){let[b,w]=(0,T.useState)(()=>Mo()),k=(0,T.useRef)(null),_=(0,T.useRef)(0),S=(0,T.useRef)(b),C=(0,T.useRef)(null),E=(0,T.useRef)({}),N=(0,T.useRef)(""),j=(0,T.useRef)(0),P=(0,T.useRef)(0),M=(0,T.useRef)(!0),D=(0,T.useRef)(null),R=(0,T.useMemo)(()=>PE(v?.turns??[]),[v?.turns]),L=(0,T.useMemo)(()=>v?MN(ME(v),x):null,[v,x]),O=(0,T.useCallback)(()=>{M.current&&I("smooth",2)},[]);function I(e="smooth",t=1){M.current=!0,null!==D.current&&window.cancelAnimationFrame(D.current);let n=t=>{D.current=window.requestAnimationFrame(()=>{D.current=null;let r=k.current;if(r){if(r.scrollTo({top:r.scrollHeight,behavior:e}),_.current=Math.max(0,r.scrollHeight-r.clientHeight),t>1&&M.current)return void n(t-1);Mo()&&z(!0)}})};n(Math.max(1,t))}function F(e){E.current={...E.current,...void 0===e.topHidden?{}:{topHidden:e.topHidden}},null===C.current&&(C.current=window.requestAnimationFrame(()=>{C.current=null;let e=E.current;E.current={},void 0!==e.topHidden&&z(e.topHidden)}))}function z(e){S.current!==e&&(S.current=e,w(e))}return(0,T.useEffect)(()=>()=>{null!==C.current&&window.cancelAnimationFrame(C.current),null!==D.current&&window.cancelAnimationFrame(D.current)},[]),(0,T.useEffect)(()=>{if(!v||"u"<typeof ResizeObserver)return;let e=!1,t=null,n=window.requestAnimationFrame(()=>{if(e)return;let n=k.current?.querySelector(".turn-history-content");n instanceof HTMLElement&&(t=new ResizeObserver(()=>{M.current&&I("instant",1)})).observe(n)});return()=>{e=!0,window.cancelAnimationFrame(n),t?.disconnect()}},[v?.id]),(0,T.useEffect)(()=>{if(!v){N.current="",j.current=0,P.current=0,M.current=!0,z(!1);return}if(N.current!==v.id){N.current=v.id,j.current=R,P.current=PA(v.turns??[]),M.current=!0,z(Mo()),I("instant");return}R>j.current&&M.current&&I("smooth"),P.current=PA(v.turns??[]),j.current=R},[R,v]),(0,A.jsxs)("section",{className:`thread-panel ${b?"top-hidden":""} ${r?"active":""}`,onPointerDown:()=>o(y),children:[(0,A.jsx)("header",{className:"thread-header",children:v?(0,A.jsxs)("div",{className:"thread-title-block",children:[(0,A.jsx)(PK,{value:PG(v)}),(0,A.jsx)(PH,{thread:v,onRename:e=>c(v,e)}),v.cwd&&(0,A.jsx)("p",{children:v.cwd})]}):i?(0,A.jsx)("div",{className:"thread-title-block empty",children:(0,A.jsx)("h2",{children:(0,A.jsx)(wu,{as:"span",duration:1.4,children:"Loading thread"})})}):(0,A.jsxs)("div",{className:"thread-title-block empty",children:[(0,A.jsx)("h2",{children:"Select a thread"}),(0,A.jsx)("p",{children:"Choose a thread from the list or selector."})]})}),v?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)("div",{className:"conversation",ref:k,onScroll:function(e){let t=e.currentTarget,n=t.scrollTop,r=n-_.current,i=t.scrollHeight-n-t.clientHeight,o=r<-18,s=i<48,a=i>120;(_.current=n,s?M.current=!0:o&&a&&(M.current=!1),Mo())?o&&a?F({topHidden:!1}):s?F({topHidden:!0}):r>18&&F({topHidden:!0}):S.current&&F({topHidden:!1})},children:(0,A.jsx)(Pk,{cwd:v.cwd||null,onRenderedItemsChange:O,onOpenFile:h,threadId:v.id,turns:v.turns??[],scrollContainerRef:k},v.id)}),(0,A.jsx)(Pq,{activeTurnId:e,deliveryKey:v.id,deliveryVersion:R,onInterrupt:()=>u(v),onSend:(e,t)=>g(v,y,e,t),onFork:()=>l(v,y),onArchive:()=>s(v,y),archiveLabel:t,collapsed:n,contextUsage:L,onError:d,onCollapsedChange:a,onOpenSettings:f,onReferenceFile:p,onReferenceSkill:m})]}):i?(0,A.jsx)("div",{className:"empty-state thread-loading-placeholder","aria-hidden":"true"}):(0,A.jsxs)("div",{className:"empty-state",children:[(0,A.jsx)("h2",{children:"Select a thread"}),(0,A.jsx)("p",{children:"Choose an existing thread or start a new one."})]})]})});function Pg({onRespond:e,onUpgradePermissions:t,permissionPolicy:n,requests:r,respondingIds:i}){let o=[...r].sort((e,t)=>e.receivedAt-t.receivedAt);return(0,A.jsxs)("aside",{className:"approval-tray","aria-label":"Pending approvals",children:[(0,A.jsxs)("header",{children:[(0,A.jsx)("strong",{children:"Approval needed"}),(0,A.jsxs)("span",{children:[o.length," pending"]})]}),(0,A.jsx)("div",{className:"approval-list",children:o.map(r=>(0,A.jsx)(Py,{onRespond:e,onUpgradePermissions:t,permissionPolicy:n,request:r,responding:i.has(P3(r.id))},P3(r.id)))})]})}function Py({onRespond:e,onUpgradePermissions:t,permissionPolicy:n,request:r,responding:i}){var o;let s=Mk(r.params),a="string"==typeof s.command?s.command:Mv(s.commandActions),l="string"==typeof s.cwd?s.cwd:"",u="string"==typeof s.reason?s.reason:"",c=!!P9(r),d=P8(r,"acceptForSession"),h=P6(n)&&!!P4(r);return(0,A.jsxs)(dJ,{approval:{id:P3(r.id)},className:"approval-card",state:"approval-requested",children:[(0,A.jsxs)(dY,{className:"approval-card-heading",children:[(0,A.jsx)("span",{children:"item/commandExecution/requestApproval"===(o=r.method)?"Command execution":"item/fileChange/requestApproval"===o?"File change":"item/mcpToolCall/requestApproval"===o?"MCP tool call":"item/permissions/requestApproval"===o?"Permission request":"App-server request"}),(0,A.jsx)("code",{children:r.method})]}),(0,A.jsx)(dX,{children:(0,A.jsxs)("div",{className:"approval-request",children:[a&&(0,A.jsx)("pre",{className:"approval-command",children:a}),u&&(0,A.jsx)("p",{className:"approval-reason",children:u}),l&&(0,A.jsx)("p",{className:"approval-cwd muted",title:l,children:l})]})}),(0,A.jsxs)(dZ,{className:"approval-actions",children:[(0,A.jsx)(dQ,{className:"primary-button",disabled:i,onClick:()=>void e(r,"accept"),children:"Approve"}),d&&(0,A.jsx)(dQ,{className:"secondary-button",disabled:i,onClick:()=>void e(r,"acceptForSession"),children:"Approve session"}),c&&(0,A.jsx)(dQ,{className:"secondary-button",disabled:i,onClick:()=>void e(r,"acceptWithExecpolicyAmendment"),children:"Trust command"}),h&&(0,A.jsxs)(dQ,{className:"nuclear-button",disabled:i,onClick:()=>void t(r),title:"Allow full permissions for this thread",children:[(0,A.jsx)(en,{size:16})," Full control"]}),(0,A.jsx)(dQ,{className:"danger-button",disabled:i,onClick:()=>void e(r,"decline"),children:"Deny"})]})]})}function Pv({activeThread:e,mcpLoading:t,mcpServers:n,rateLimits:r,status:i,statusRefreshing:o,onClose:s,onLoginMcpServer:a,onRefresh:l,onRefreshMcp:u,onSaveMcpServer:c}){var d;let h="string"==typeof i.config?.appServerSocketPath?i.config.appServerSocketPath:"stdio / owned",[f,p]=(0,T.useState)("agro-ontology"),[m,g]=(0,T.useState)("http://127.0.0.1:3000/api/mcp"),[y,v]=(0,T.useState)(null),[x,b]=(0,T.useState)(null),[w,k]=(0,T.useState)(""),[_,S]=(0,T.useState)(!1);async function C(e){e.preventDefault(),S(!0);try{await c({name:f,url:m})}finally{S(!1)}}async function E(e){let t=window.open("",`codex-mcp-oauth-${e}`,"popup,width=560,height=760");v(e),k("");try{let n=await a(e);t?t.location.href=n:b({name:e,url:n})}catch(e){throw t?.close(),k(MB(e)),e}finally{v(null)}}return(0,A.jsx)("div",{className:"modal-backdrop",children:(0,A.jsxs)("section",{className:"modal status-modal",role:"dialog","aria-modal":"true","aria-labelledby":"status-title",children:[(0,A.jsxs)("header",{className:"modal-header",children:[(0,A.jsxs)("div",{children:[(0,A.jsx)("h2",{id:"status-title",children:"Status"}),(0,A.jsxs)("p",{className:"muted",children:[i.command??"codex"," ",i.state?`is ${i.state}`:""]})]}),(0,A.jsx)("button",{className:"icon-button",type:"button",onClick:s,title:"Close",children:(0,A.jsx)(eu,{size:16})})]}),(0,A.jsxs)("div",{className:"status-grid",children:[(0,A.jsx)(Pb,{label:"App server",value:(0,A.jsx)(PK,{value:i.state})}),(0,A.jsx)(Pb,{label:"Socket",value:h}),(0,A.jsx)(Pb,{label:"Codex cwd",value:i.cwd||"Unavailable"}),(0,A.jsx)(Pb,{label:"Active thread",value:e?`${Me(e)} (${(d=e.id).length>14?`${d.slice(0,8)}...${d.slice(-4)}`:d})`:"None"}),(0,A.jsx)(Pb,{label:"5hr remaining",value:(0,A.jsx)(Pw,{value:ML(r,"5hr")})}),(0,A.jsx)(Pb,{label:"Weekly remaining",value:(0,A.jsx)(Pw,{value:ML(r,"weekly")})})]}),i.error&&(0,A.jsx)("p",{className:"error-text",children:i.error}),(0,A.jsxs)("section",{className:"status-section mcp-status-section",children:[(0,A.jsxs)("header",{className:"section-heading",children:[(0,A.jsxs)("div",{children:[(0,A.jsx)("h3",{children:"MCP Servers"}),(0,A.jsxs)("p",{className:"muted",children:["Config is written to ",n?.configPath||"~/.codex/config.toml"," and reloaded without stopping the app-server."]})]}),(0,A.jsxs)("button",{className:"secondary-button",type:"button",onClick:()=>void u(),disabled:t,children:[(0,A.jsx)(er,{size:16,className:t?"spin-icon":""})," Reload"]})]}),(0,A.jsx)("div",{className:"mcp-server-list",children:n?.servers.length?n.servers.map(e=>(0,A.jsx)(Px,{loginPending:y===e.name,onLogin:()=>void E(e.name),server:e},e.name)):(0,A.jsxs)("div",{className:"empty-state inline",children:[(0,A.jsx)("h2",{children:t?"Loading MCP servers":"No MCP servers"}),(0,A.jsx)("p",{children:"Add a streamable HTTP MCP server below."})]})}),(0,A.jsxs)("form",{className:"mcp-server-form",onSubmit:C,children:[(0,A.jsxs)("label",{className:"field",children:[(0,A.jsx)("span",{children:"Name"}),(0,A.jsx)("input",{value:f,onChange:e=>p(e.target.value),placeholder:"agro-ontology"})]}),(0,A.jsxs)("label",{className:"field",children:[(0,A.jsx)("span",{children:"URL"}),(0,A.jsx)("input",{value:m,onChange:e=>g(e.target.value),placeholder:"http://127.0.0.1:3000/api/mcp"})]}),(0,A.jsxs)("button",{className:"primary-button",type:"submit",disabled:_||t,children:[(0,A.jsx)(ee,{size:16})," Save MCP"]})]})]}),x&&(0,A.jsxs)("section",{className:"status-section oauth-fallback-panel",children:[(0,A.jsxs)("div",{children:[(0,A.jsx)("h3",{children:"OAuth login"}),(0,A.jsxs)("p",{className:"muted",children:["Popup blocked for ",x.name,". Open the login page manually."]})]}),(0,A.jsxs)("a",{className:"primary-button",href:x.url,target:"_blank",rel:"noreferrer",onClick:()=>b(null),children:[(0,A.jsx)(K,{size:16})," Open login"]})]}),w&&(0,A.jsx)("section",{className:"status-section oauth-error-panel",children:(0,A.jsxs)("div",{children:[(0,A.jsx)("h3",{children:"OAuth login needs attention"}),(0,A.jsx)("p",{children:w})]})}),(0,A.jsx)("p",{className:"muted",children:"Rate limits use the app-server account quota snapshot. Start or recover the sidecar from the CLI, then reconnect this UI."}),(0,A.jsx)("footer",{className:"modal-actions",children:(0,A.jsxs)("button",{className:"primary-button",type:"button",onClick:()=>void l(),disabled:o,children:[(0,A.jsx)(er,{size:16,className:o?"spin-icon":""})," Refresh"]})})]})})}function Px({loginPending:e,onLogin:t,server:n}){var r;let i="notLoggedIn"===n.authStatus,o="bearerToken"===(r=n.authStatus)?"token":"notLoggedIn"===r?"login required":"oAuth"===r?"oauth":"unsupported"===r?"unsupported":r||"unknown";return(0,A.jsxs)("article",{className:"mcp-server-card",children:[(0,A.jsxs)("div",{className:"mcp-server-card-header",children:[(0,A.jsxs)("strong",{children:[(0,A.jsx)(ee,{size:15})," ",n.name]}),(0,A.jsx)("span",{children:o})]}),(0,A.jsxs)("p",{children:[n.tools.length," tools",n.resources||n.resourceTemplates?`, ${n.resources+n.resourceTemplates} resources`:""]}),i&&(0,A.jsxs)("button",{className:"secondary-button",type:"button",onClick:t,disabled:e,children:[(0,A.jsx)(K,{size:16,className:e?"spin-icon":""})," ",e?"Opening":"Log in"]}),n.tools.length>0&&(0,A.jsx)("div",{className:"mcp-tool-list",children:n.tools.map(e=>(0,A.jsx)("code",{children:e},e))})]})}function Pb({label:e,value:t}){return(0,A.jsxs)("div",{className:"status-detail",children:[(0,A.jsx)("span",{children:e}),(0,A.jsx)("strong",{children:t})]})}function Pw({value:e}){var t,n;return(0,A.jsx)("span",{className:`usage-metric ${null===(t=e)?"neutral":t<=10?"bad":t<=30?"busy":"good"}`,children:null===(n=e)?"--":`${Math.round(n)}%`})}let Pk=(0,T.memo)(function({cwd:e,onRenderedItemsChange:t,onOpenFile:n,scrollContainerRef:r,threadId:i,turns:o}){let[s,a]=(0,T.useState)(20),[l,u]=(0,T.useState)(()=>new Set),c=(0,T.useRef)(new Set),d=(0,T.useRef)(null),h=(0,T.useRef)(!1),f=(0,T.useRef)(null),p=(0,T.useMemo)(()=>{var e;let t,n;return t=!1,n=(e=o).map(e=>{let n=e.items??[],r=PT(PN(n));return r===n?e:(t=!0,{...e,items:r})}),t?n:e},[o]),m=(0,T.useMemo)(()=>PE(p),[p]),g=(0,T.useMemo)(()=>(function(e,t){let n=[],r=t;for(let t=e.length-1;t>=0&&r>0;t-=1){let i=e[t],o=i?.items??[];if(0===o.length)continue;let s=o.slice(Math.max(0,o.length-r));n.unshift({turn:i,items:s}),r-=s.length}return n})(p,s),[p,s]),y=(0,T.useMemo)(()=>g.reduce((e,t)=>e+t.items.length,0),[g]),v=Math.max(0,m-y);return((0,T.useEffect)(()=>{a(20);let e=new Set;c.current=e,u(e),h.current=!1,f.current=null},[i]),(0,T.useEffect)(()=>{let e=d.current,t=r.current;if(!e||!t||0===v)return;let n=new IntersectionObserver(([e])=>{e?.isIntersecting&&!h.current&&(h.current=!0,f.current=t.scrollHeight,a(e=>Math.min(m,e+20)))},{root:t,rootMargin:"160px 0px 0px 0px",threshold:.01});return n.observe(e),()=>n.disconnect()},[v,r,m,s]),(0,T.useEffect)(()=>{let e=g.flatMap(({turn:e,items:t})=>t.map(t=>P_(e.id,t))).reverse().filter(e=>!c.current.has(e));if(0===e.length)return;let t=!1,n=null,r=()=>{if(n=null,t)return;let i=e.splice(0,4);i.length>0&&u(e=>{let t=new Set(e);for(let e of i)t.add(e);return c.current=t,t}),e.length>0&&(n=PS(r))};return n=PS(r),()=>{t=!0,n?.()}},[i,g]),(0,T.useLayoutEffect)(()=>{t()},[t,l]),(0,T.useLayoutEffect)(()=>{let e=f.current,t=r.current;null!==e&&t&&(t.scrollTop+=t.scrollHeight-e,f.current=null,h.current=!1)},[r,s]),0===o.length||0===m)?(0,A.jsxs)("div",{className:"empty-state inline",children:[(0,A.jsx)("h2",{children:"No items loaded"}),(0,A.jsx)("p",{children:"Select a thread or send a message."})]}):(0,A.jsxs)("div",{className:"turn-history-content",children:[v>0&&(0,A.jsxs)("div",{className:"history-limit",ref:d,"aria-live":"polite",children:[(0,A.jsx)("span",{className:"spinner","aria-hidden":"true"}),(0,A.jsx)("span",{children:"Loading earlier items"}),(0,A.jsxs)("span",{className:"history-count",children:[y," of ",m]})]}),g.map(({turn:t,items:r})=>(0,A.jsxs)("section",{className:"turn-block",children:[(0,A.jsxs)("div",{className:"turn-heading",children:[(0,A.jsx)(PK,{value:t.status}),(0,A.jsx)("span",{className:"turn-id",children:t.id}),(0,A.jsx)("span",{className:"turn-date",children:Mz(t.startedAt)})]}),r.map(r=>{let i=P_(t.id,r);return l.has(i)?(0,A.jsx)(PD,{cwd:e,item:r,onOpenFile:n},i):(0,A.jsx)(PC,{item:r},i)})]},t.id))]})});function P_(e,t){return`${e}:${t.id}`}function PS(e){if("function"==typeof window.requestIdleCallback&&"function"==typeof window.cancelIdleCallback){let t=window.requestIdleCallback(e,{timeout:80});return()=>window.cancelIdleCallback(t)}let t=window.setTimeout(e,0);return()=>window.clearTimeout(t)}function PC({item:e}){var t;let n=(t=PR(e.type))?Mx(t):null;return(0,A.jsxs)("article",{className:`item ${Mb(e.type)} loading-item`,children:[n&&(0,A.jsx)("div",{className:"item-label",children:n}),(0,A.jsx)("div",{className:"item-body",children:(0,A.jsx)(wu,{as:"span",duration:1.2,children:"Loading item"})})]})}function PE(e){return e.reduce((e,t)=>e+PT(PN(t.items??[])).length,0)}function PA(e){return e.reduce((e,t)=>e+(t.items??[]).filter(Mg).length,0)}function PT(e){let t=[],n=null,r=()=>{var e,r;n&&(t.push((e=n.kind,1===(r=n.items).length?r[0]:{id:`${e}:${r[0]?.id??"start"}`,type:e,items:r})),n=null)};for(let o of e){var i;let e="commandGroup"===(i=o).type||"reasoningGroup"===i.type?null:"commandExecution"===i.type?"commandGroup":"reasoning"===i.type?"reasoningGroup":null;if(!e){r(),t.push(o);continue}n&&n.kind===e||(r(),n={kind:e,items:[]}),n.items.push(o)}return r(),t}function PN(e){let t=new Set,n=new Set,r=null;for(let i of e){let o=t.has(i.id),s=Pj(i),a=!!(s&&n.has(s));if(o||a){r??=e.slice(0,t.size);continue}t.add(i.id),s&&n.add(s),r?.push(i)}return r??e}function Pj(e){if("userMessage"===e.type){let t=My(e.content).trim();return t?`userMessage:${t}`:null}if("agentMessage"===e.type){let t="string"==typeof e.text?e.text.trim():"";return t?`agentMessage:${t}`:null}return null}function PP(e,t,n,r){let i=e.turns??[],o=!1,s=i.map(e=>{var i,s,a;let l,u,c;return e.id!==t?e:(o=!0,i=e,s=n,a=r,l=i.items??[],u=!1,c=l.map(e=>e.id!==s?e:(u=!0,a(e))),u||c.push(a({id:s,type:"agentMessage"})),{...i,items:c})});return o||s.push({id:t,status:"inProgress",items:[r({id:n,type:"agentMessage"})]}),{...e,turns:s}}function PM(e){return"inprogress"===String(e.status??"").toLowerCase()}let PD=(0,T.memo)(function({cwd:e,item:t,compact:n=!1,onOpenFile:r}){var i,o;let s=(i=PR(t.type))?Mx(i):null;return(0,A.jsxs)("article",{className:`item item-${t.type} ${Mb(t.type)} ${"agentMessage"!==(o=t).type?"":Mg(o)?"final-answer":"commentary"===String(Mk(o).phase??"").toLowerCase().replace(/[_\s-]+/g,"")?"commentary":""} ${n?"compact":""}`,children:[s&&(0,A.jsx)("div",{className:"item-label",children:s}),(0,A.jsx)("div",{className:"item-body",children:function(e,t,n){var r,i,o;if("commandGroup"===e.type)return(0,A.jsx)(PO,{cwd:t,items:e.items??[],onOpenFile:n});if("reasoningGroup"===e.type)return(0,A.jsx)(PI,{items:e.items??[]});if("userMessage"===e.type)return(0,A.jsx)(PU,{cwd:t,onOpenFile:n,text:My(e.content)});if("agentMessage"===e.type){let i="string"==typeof(r=e.phase)&&r.trim()?r.trim().replace(/[_-]+/g," ").replace(/\s+/g," ").split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" "):null;return(0,A.jsxs)(A.Fragment,{children:[i&&(0,A.jsx)("p",{className:"muted item-phase",children:i}),(0,A.jsx)(PU,{cwd:t,onOpenFile:n,text:"string"==typeof e.text?e.text:""})]})}if("reasoning"===e.type)return(0,A.jsx)(PF,{items:[e],title:"Reasoning"});if("plan"===e.type)return(0,A.jsx)(PU,{cwd:t,onOpenFile:n,text:"string"==typeof e.text?e.text:"Plan updated"});if("commandExecution"===e.type){let t="string"==typeof e.command?e.command:Mv(e.commandActions);return(0,A.jsx)(PL,{className:"command-output",meta:[e.status,"number"==typeof(i=e.exitCode)?`exit ${i}`:"",e.cwd].filter(Boolean).join(" | "),title:`$ ${t||"command"}`,children:"string"==typeof e.aggregatedOutput&&e.aggregatedOutput?(0,A.jsx)(wb,{className:"command-terminal",isStreaming:String(e.status??"").toLowerCase().includes("running"),output:(o=e.aggregatedOutput).length<=16e3?o:`${o.slice(0,16e3)}
|
|
8
|
+
... truncated ${o.length-16e3} chars ...`}):(0,A.jsx)("p",{className:"muted",children:"No command output."})})}if("fileChange"===e.type)return(0,A.jsx)(Pz,{cwd:t,item:e,onOpenFile:n});if("mcpToolCall"===e.type||"dynamicToolCall"===e.type){let t,n,r,i,o=[e.server,e.namespace,e.tool].filter(Boolean).join(".")||"Tool call";return(0,A.jsxs)(wH,{className:"tool-call-element",defaultOpen:!1,children:[(0,A.jsx)(wq,{state:["failed","error","systemerror"].includes(t=String(e.status??"").toLowerCase())?"output-error":["denied","cancelled","canceled"].includes(t)?"output-denied":["running","inprogress","active","pending"].includes(t)?"input-available":["waitingonapproval","approval-requested"].includes(t)?"approval-requested":"output-available",title:o,toolName:o,type:"dynamic-tool"}),(0,A.jsxs)(wJ,{children:[(0,A.jsx)(wY,{input:(n=Mk(e)).input??n.arguments??n.params??n}),(0,A.jsx)(wX,{errorText:"string"==typeof(r=Mk(e)).error?r.error:void 0,output:(i=Mk(e)).output??i.result??i.content??null})]})]})}return"webSearch"===e.type?(0,A.jsx)(PU,{cwd:t,onOpenFile:n,text:"string"==typeof e.query?e.query:"Web search"}):"imageView"===e.type?(0,A.jsx)("p",{children:String(e.path??"Image viewed")}):(0,A.jsx)(dr,{className:"json-block",code:JSON.stringify(e,null,2),language:"json"})}(t,e,r)})]})});function PR(e){return"agentMessage"===e||"userMessage"===e?null:e}function PL({children:e,className:t="",defaultOpen:n=!1,meta:r,title:i}){let[o,s]=(0,T.useState)(n);return(0,A.jsxs)("div",{className:`collapsible-output ${o?"open":""} ${t}`,children:[(0,A.jsxs)("button",{className:"collapsible-summary",type:"button","aria-expanded":o,onClick:()=>s(e=>!e),children:[(0,A.jsx)("span",{className:"summary-title command-line",children:i}),r&&(0,A.jsx)("span",{className:"summary-meta",children:r})]}),(0,A.jsx)("div",{className:"collapsible-content-shell",children:(0,A.jsx)("div",{className:"collapsible-content",children:e})})]})}function PO({cwd:e,items:t,onOpenFile:n}){let r=[...new Set(t.map(e=>String(e.status??"")).map(e=>e.trim()).filter(Boolean))];return(0,A.jsx)(PL,{className:"command-group-output",meta:r.join(" | ")||`${t.length} commands`,title:`Commands (${t.length})`,children:(0,A.jsx)("div",{className:"collated-item-list",children:t.map(t=>(0,A.jsx)(PD,{compact:!0,cwd:e,item:t,onOpenFile:n},t.id))})})}function PI({items:e}){return(0,A.jsx)(PF,{items:e,title:`Reasoning (${e.length})`})}function PF({items:e,title:t}){let n=e.some(e=>String(e.status??"").toLowerCase().includes("running"))?"Thinking":1===e.length?"Thought":`${e.length} entries`;return(0,A.jsxs)("div",{className:"reasoning-static","aria-label":t,children:[(0,A.jsx)("span",{className:"reasoning-static-title",children:t}),(0,A.jsx)("span",{className:"reasoning-static-meta",children:n})]})}function Pz({cwd:e,item:t,onOpenFile:n}){var r;let i=Array.isArray(r=t.changes)?r.map(PB).filter(e=>!!e):[];return 0===i.length?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)("p",{children:String(t.status??"changed")}),(0,A.jsx)(dr,{className:"json-block",code:JSON.stringify(t.changes??[],null,2),language:"json"})]}):(0,A.jsxs)("div",{className:"file-change-view",children:[(0,A.jsxs)("div",{className:"file-change-summary",children:[(0,A.jsx)("span",{children:String(t.status??"changed")}),(0,A.jsxs)("strong",{children:[i.length," file",1===i.length?"":"s"]})]}),(0,A.jsx)("div",{className:"file-change-list",children:i.map((t,r)=>(0,A.jsx)(PL,{className:"file-diff-card",meta:(0,A.jsxs)("span",{className:"file-diff-meta",children:[(0,A.jsx)("span",{children:t.kind}),t.movePath&&(0,A.jsxs)("span",{children:["from ",P$(t.movePath)]}),t.stats.added>0&&(0,A.jsxs)("span",{className:"diff-stat add",children:["+",t.stats.added]}),t.stats.removed>0&&(0,A.jsxs)("span",{className:"diff-stat remove",children:["-",t.stats.removed]})]}),title:(0,A.jsxs)("span",{className:"file-diff-path",title:t.path,children:[(0,A.jsx)($,{size:15}),(0,A.jsx)("span",{children:P$(t.path)})]}),children:(0,A.jsxs)("div",{className:"file-diff-body",children:[(0,A.jsx)("button",{className:"secondary-button file-diff-open",type:"button",onClick:()=>void n({path:t.path,cwd:e,label:Mi(t.path)}),children:"Open file"}),t.lines.length>0?(0,A.jsx)("div",{className:"diff-block",role:"table","aria-label":`Diff for ${t.path}`,children:t.lines.map((e,t)=>{var n;return(0,A.jsxs)("div",{className:`diff-line ${e.kind}`,role:"row",children:[(0,A.jsx)("span",{className:"diff-line-marker","aria-hidden":"true",children:"add"===(n=e).kind?"+":"remove"===n.kind?"-":"hunk"===n.kind?"@":" "}),(0,A.jsx)("code",{children:e.text||" "})]},`${t}-${e.text}`)})}):(0,A.jsx)("p",{className:"muted",children:"No textual diff available."})]})},`${t.path}-${r}`))})]})}function PB(e){let t=Mk(e),n="string"==typeof t.path?t.path:"";if(!n)return null;let r=Mk(t.kind),i=("string"==typeof t.diff?t.diff:"").split("\n").filter((e,t,n)=>e||t<n.length-1).map(e=>e.startsWith("@@")?{kind:"hunk",text:e}:e.startsWith("+++")||e.startsWith("---")?{kind:"meta",text:e}:e.startsWith("+")?{kind:"add",text:e.slice(1)}:e.startsWith("-")?{kind:"remove",text:e.slice(1)}:{kind:"context",text:e.startsWith(" ")?e.slice(1):e});return{path:n,movePath:"string"==typeof r.move_path?r.move_path:null,kind:"string"==typeof r.type?r.type:String(t.status??"changed"),lines:i,stats:i.reduce((e,t)=>({added:e.added+ +("add"===t.kind),removed:e.removed+ +("remove"===t.kind)}),{added:0,removed:0})}}function P$(e){let t=Mr(e),n="/home/uphill/";return t.startsWith(n)?`~/${t.slice(n.length)}`:t}let PU=(0,T.memo)(function({cwd:e,onOpenFile:t,text:n}){let r,i;return(0,A.jsx)("div",{className:"markdown",children:(0,A.jsx)(rT,{remarkPlugins:[i$],components:{a({href:n,children:r}){let i=n?function(e){if(!e||e.startsWith("#")||/^(?:mailto:|data:|blob:)/i.test(e))return"";if(/^https?:/i.test(e)){try{var t;let n=new URL(e),r=Mt(decodeURIComponent(n.pathname)),i=window.location.origin;if(n.origin===i||(t=r,/^\/(?:home|Users|tmp|var|mnt|opt|workspace|app)\//.test(t)))return r}catch{}return""}if(e.startsWith("file://"))try{return Mt(decodeURIComponent(new URL(e).pathname))}catch{return Mt(e.replace(/^file:\/\//,""))}return Mt(decodeURIComponent(e.split("#")[0]?.split("?")[0]||e))}(n):"";return i&&Mn(i)?(0,A.jsx)("button",{className:"file-link-button",type:"button",onClick:n=>{n.preventDefault(),n.stopPropagation(),t({path:i,cwd:e,label:function e(t){return"string"==typeof t||"number"==typeof t?String(t):Array.isArray(t)?t.map(e).join(""):""}(r)||i})},children:r}):(0,A.jsx)("a",{href:n,children:r})}},children:(r=/(^|[\s"'])([~./A-Za-z0-9_-][^\s`"'<>)]{0,240}\.(?:json|md|markdown|mdx|py|tsx?|jsx?|css|scss|html|yaml|yml|toml|txt|log|csv|rs|go|java|kt|swift|c|h|cpp|hpp|cs|rb|php|sh|bash|zsh|fish|sql|xml|vue|svelte|png|jpe?g|gif|webp|bmp|avif|svg|pdf|mp4|m4v|webm|mov|ogv|ogg|avi|mkv|3gp|docx?|xlsx?|pptx?)(?::\d+(?::\d+)?)?)/gi,i=!1,n.split("\n").map(e=>e.trimStart().startsWith("```")?(i=!i,e):i||e.includes("](")?e:e.replace(r,(e,t,n,r,i)=>{let o=i[r+t.length-1]||"";if("`"===o||"["===o||"("===o)return e;let s=Mt(n);return Mn(s)?`${t}[${n}](${encodeURI(s)})`:e})).join("\n"))})})});function PV({title:e,settings:t,permissionPolicy:n,includePrompt:r=!1,onClose:i,onSubmit:o}){let[s,a]=(0,T.useState)(t),[l,u]=(0,T.useState)(""),c=n?.allowedApprovalPolicies.length?n.allowedApprovalPolicies:["on-request","untrusted"],d=n?.allowedSandboxes.length?n.allowedSandboxes:["read-only","workspace-write"],h=!!n?.locked;return(0,A.jsx)("div",{className:"modal-backdrop",children:(0,A.jsxs)("form",{className:"modal",onSubmit:e=>{e.preventDefault(),o({settings:s,prompt:l})},children:[(0,A.jsxs)("header",{className:"modal-header",children:[(0,A.jsx)("h2",{children:e}),(0,A.jsx)("button",{className:"icon-button",type:"button",onClick:i,title:"Close",children:(0,A.jsx)(eu,{size:16})})]}),(0,A.jsxs)("div",{className:"form-grid",children:[r?(0,A.jsx)(PW,{value:s.cwd,onChange:e=>a({...s,cwd:e})}):(0,A.jsxs)("label",{className:"field",children:[(0,A.jsx)("span",{children:"Working directory"}),(0,A.jsx)("input",{value:s.cwd,onChange:e=>a({...s,cwd:e.target.value}),placeholder:"/path/to/project"})]}),(0,A.jsxs)("label",{className:"field",children:[(0,A.jsx)("span",{children:"Model"}),(0,A.jsxs)("select",{value:s.model,onChange:e=>a({...s,model:e.target.value}),children:[(0,A.jsx)("option",{value:"gpt-5.5",children:"GPT-5.5"}),(0,A.jsx)("option",{value:"gpt-5.4",children:"GPT-5.4"})]})]}),(0,A.jsxs)("label",{className:"field",children:[(0,A.jsx)("span",{children:"Reasoning effort"}),(0,A.jsxs)("select",{value:s.effort,onChange:e=>a({...s,effort:e.target.value}),children:[(0,A.jsx)("option",{value:"minimal",children:"minimal"}),(0,A.jsx)("option",{value:"low",children:"low"}),(0,A.jsx)("option",{value:"medium",children:"medium"}),(0,A.jsx)("option",{value:"high",children:"high"}),(0,A.jsx)("option",{value:"xhigh",children:"xhigh"})]})]}),(0,A.jsxs)("label",{className:"field",children:[(0,A.jsx)("span",{children:"Approval policy"}),(0,A.jsx)("select",{value:s.approvalPolicy,onChange:e=>a({...s,approvalPolicy:e.target.value}),disabled:h,children:c.map(e=>(0,A.jsx)("option",{value:e,children:e},e))})]}),(0,A.jsxs)("label",{className:"field",children:[(0,A.jsx)("span",{children:"Sandbox"}),(0,A.jsx)("select",{value:s.sandbox,onChange:e=>a({...s,sandbox:e.target.value}),disabled:h,children:d.map(e=>(0,A.jsx)("option",{value:e,children:e},e))})]})]}),r&&(0,A.jsxs)("label",{className:"field",children:[(0,A.jsx)("span",{children:"Initial message"}),(0,A.jsx)("textarea",{value:l,onChange:e=>u(e.target.value),rows:7})]}),(0,A.jsxs)("footer",{className:"modal-actions",children:[(0,A.jsx)("button",{className:"ghost-button",type:"button",onClick:i,children:"Cancel"}),(0,A.jsx)("button",{className:"primary-button",type:"submit",children:r?"Start":"Save"})]})]})})}function PW({value:e,onChange:t}){let[n,r]=(0,T.useState)(null),[i,o]=(0,T.useState)(!1),[s,a]=(0,T.useState)(""),[l,u]=(0,T.useState)("");async function c(e){o(!0),a("");try{r(await kn(e||void 0))}catch(e){a(MB(e))}finally{o(!1)}}async function d(){if(n&&l.trim()){o(!0),a("");try{let e=await ko(n.path,l.trim());r(e),u(""),t(e.path)}catch(e){a(MB(e))}finally{o(!1)}}}return(0,T.useEffect)(()=>{c(e||void 0)},[]),(0,A.jsxs)("section",{className:"directory-picker",children:[(0,A.jsxs)("div",{className:"field",children:[(0,A.jsx)("span",{children:"Working directory"}),(0,A.jsxs)("div",{className:"path-pill",children:[(0,A.jsx)("strong",{children:n?.displayPath||e||"~"}),n?.isGitRepo&&(0,A.jsx)(PK,{value:"git repo"})]})]}),(0,A.jsxs)("div",{className:"directory-toolbar",children:[(0,A.jsxs)("button",{className:"ghost-button",type:"button",onClick:()=>c(n?.homePath),disabled:i,children:[(0,A.jsx)(H,{size:16})," Home"]}),(0,A.jsxs)("button",{className:"ghost-button",type:"button",onClick:()=>c(n?.parentPath),disabled:i||!n?.parentPath,children:[(0,A.jsx)(I,{size:16})," Up"]}),(0,A.jsxs)("button",{className:"primary-button",type:"button",onClick:()=>n&&t(n.path),disabled:!n?.isGitRepo,children:[(0,A.jsx)(V,{size:16})," Select"]})]}),(0,A.jsxs)("div",{className:"directory-list",children:[i&&(0,A.jsx)("p",{className:"muted empty-pad",children:"Loading"}),!i&&n?.entries.map(e=>(0,A.jsxs)("div",{className:`directory-row ${e.isGitRepo?"git-repo":""}`,children:[(0,A.jsxs)("button",{type:"button",onClick:()=>c(e.path),children:[e.isGitRepo?(0,A.jsx)(V,{size:17}):(0,A.jsx)(U,{size:17}),(0,A.jsx)("span",{children:e.name})]}),(0,A.jsx)("button",{className:"ghost-button",type:"button",onClick:()=>t(e.path),disabled:!e.isGitRepo,children:"Select"})]},e.path)),!i&&n?.entries.length===0&&(0,A.jsx)("p",{className:"muted empty-pad",children:"No folders"})]}),(0,A.jsxs)("div",{className:"new-repo-form",children:[(0,A.jsxs)("label",{className:"field",children:[(0,A.jsx)("span",{children:"Create repository"}),(0,A.jsx)("input",{value:l,onChange:e=>u(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),d())},placeholder:"folder-name"})]}),(0,A.jsxs)("button",{className:"secondary-button",type:"button",onClick:d,disabled:i||!n||!l.trim(),children:[(0,A.jsx)(et,{size:16})," Create"]})]}),e&&(0,A.jsxs)("p",{className:"selected-path",children:["Selected: ",e]}),s&&(0,A.jsx)("p",{className:"error-text",children:s})]})}function PH({thread:e,onRename:t}){let[n,r]=(0,T.useState)(Me(e)),[i,o]=(0,T.useState)(!1);async function s(){o(!1),await t(n)}return(0,T.useEffect)(()=>{r(Me(e))},[e.id,e.name,e.preview]),(0,A.jsx)("input",{className:"thread-title-input",value:n,onChange:e=>r(e.target.value),onFocus:()=>o(!0),onBlur:()=>void s(),onKeyDown:t=>{"Enter"===t.key&&(t.preventDefault(),t.currentTarget.blur()),"Escape"===t.key&&(r(Me(e)),o(!1),t.currentTarget.blur())},"aria-label":"Thread title",title:i?"Press Enter to save":"Click to rename"})}let PK=(0,T.memo)(function({value:e}){var t,n;let r=e||"unknown";return(0,A.jsx)("span",{className:`status-badge ${["running","idle","completed"].includes(t=r)?"good":["starting","active","inProgress","waitingOnApproval","waitingOnUserInput","turn started"].includes(t)?"busy":["failed","error","systemError","exited","disconnected","stderr"].includes(t)?"bad":["notLoaded","interrupted","stdout"].includes(t)?"info":"neutral"}`,children:{inProgress:"in progress",waitingOnApproval:"waiting approval",waitingOnUserInput:"waiting input",notLoaded:"not loaded",systemError:"system error"}[n=r]||n})});function PG(e){return e?.status?"string"==typeof e.status?e.status:e.status.type:"unknown"}let Pq=(0,T.memo)(function({activeTurnId:e,archiveLabel:t,collapsed:n,contextUsage:r,deliveryKey:i,deliveryVersion:o,onArchive:s,onCollapsedChange:a,onError:l,onFork:u,onInterrupt:c,onOpenSettings:d,onReferenceFile:h,onReferenceSkill:f,onSend:p}){let[m,g]=(0,T.useState)(!1),[y,v]=(0,T.useState)("idle"),[x,b]=(0,T.useState)(Pr),[w,k]=(0,T.useState)(null),[_,S]=(0,T.useState)(null),[C,E]=(0,T.useState)(null),[N,j]=(0,T.useState)(!1),[P,M]=(0,T.useState)(()=>(function(){try{let e=JSON.parse(window.localStorage.getItem(Ps)||"[]");if(!Array.isArray(e))return[];return e.map(Ms).filter(e=>!!e).slice(0,80)}catch{return[]}})()),[D,R]=(0,T.useState)(!1),[I,$]=(0,T.useState)(null),[U,V]=(0,T.useState)(null),H=(0,T.useRef)(null),K=(0,T.useRef)(null),G=(0,T.useRef)(null),q=(0,T.useRef)(null),ee=(0,T.useRef)(null),et=(0,T.useRef)(null),en=(0,T.useRef)(null),er=(0,T.useRef)(null),eo=(0,T.useRef)(null),el=(0,T.useRef)(0),eu=(0,T.useRef)(Pr),ec=(0,T.useRef)(null),ed=(0,T.useRef)([]),eh=(0,T.useRef)(null),ef=(0,T.useRef)(i),ep=(0,T.useRef)(!1),em=(0,T.useRef)(null);async function eg(t,n){let r=n??eC(),s=r.trim(),a=`${i}\u0000${t}\u0000${s}`,l=Date.now();if(s&&!ep.current&&(em.current?.signature!==a||!(l-em.current.at<2500))){ep.current=!0,em.current={signature:a,at:l},S(null),k(t);try{if(await p(r,t)){if(eE(""),ef.current!==i)return;S({action:t,queued:"send"===t&&!!e,deliveryKey:i,deliveryVersion:o})}else em.current?.signature===a&&(em.current=null)}finally{ep.current=!1,k(null)}}}async function ey(t){e?V(t??eC()):await eg("send",t)}async function ev(e){V(null),await eg(e,U??void 0)}async function ex(e){if(e){g(!0);try{let t=await ks(e),n=P5(t.name,t.path);eA(n,{block:!0})}catch(e){l(e)}finally{g(!1),H.current&&(H.current.value="")}}}async function eb(){if("recording"===y)return void ee.current?.stop();if("idle"===y){if(!navigator.mediaDevices?.getUserMedia||"u"<typeof MediaRecorder)return void l(Error("Audio recording is not available in this browser."));if(!window.isSecureContext)return void l(Error("Microphone permission requires HTTPS, localhost, or another secure browser context."));try{let e=await navigator.mediaDevices.getUserMedia({audio:!0}),t=MediaRecorder.isTypeSupported("audio/webm;codecs=opus")?"audio/webm;codecs=opus":"audio/webm",n=new MediaRecorder(e,{mimeType:t});ed.current=[],eh.current=e,ee.current=n,function(e){ek();let t=window.AudioContext||window.webkitAudioContext;if(!t)return b(Pr);try{let n=new t,r=n.createAnalyser(),i=n.createMediaStreamSource(e);r.fftSize=256,r.smoothingTimeConstant=.72,i.connect(r),en.current=n,et.current=r,er.current=i,ec.current=new Uint8Array(r.fftSize),eu.current=Pr,b(Pr),n.resume().catch(()=>void 0),function e(){var t,n;let r,i=et.current,o=ec.current;if(!i||!o)return;i.getByteTimeDomainData(o);let s=(t=o,n=eu.current.length,r=Math.max(1,Math.floor(t.length/n)),Array.from({length:n},(e,i)=>{let o=i*r,s=i===n-1?t.length:Math.min(t.length,o+r),a=0,l=0;for(let e=o;e<s;e+=1){let n=Math.abs((t[e]??128)-128)/128;a+=n*n,l=Math.max(l,n)}return Math.min(1,Math.max(.08,4.2*Math.sqrt(a/Math.max(1,s-o))+1.25*l))})),a=eu.current.map((e,t)=>.58*e+.42*(s[t]??0));eu.current=a;let l=performance.now();l-el.current>70&&(el.current=l,b(a)),eo.current=window.requestAnimationFrame(e)}()}catch{ek(),b(Pr)}}(e),n.ondataavailable=e=>{e.data.size>0&&ed.current.push(e.data)},n.onerror=()=>{ew(),v("idle"),l(Error("Audio recording failed."))},n.onstop=()=>{let e=ed.current,t=n.mimeType||"audio/webm";if(ew(),0===e.length)return void v("idle");let r=new File(e,`composer-recording-${Date.now()}.webm`,{type:t});v("transcribing"),ka(r).then(e=>{e&&eA(e,{block:!0})}).catch(l).finally(()=>v("idle"))},n.start(),v("recording")}catch(n){var e;let t;ew(),v("idle"),l("NotAllowedError"===(t=(e=n)instanceof DOMException||e instanceof Error?e.name:"")||"PermissionDeniedError"===t?Error("Microphone permission was denied. Enable microphone access for this site and try again."):"NotFoundError"===t||"DevicesNotFoundError"===t?Error("No microphone was found for transcription."):"SecurityError"===t?Error("Microphone permission is blocked by the browser security context or site policy."):e instanceof Error?e:Error(String(e)))}}}function ew(){for(let e of(ek(),ee.current=null,eh.current?.getTracks()??[]))e.stop();eh.current=null}function ek(){null!==eo.current&&(window.cancelAnimationFrame(eo.current),eo.current=null),er.current?.disconnect(),er.current=null,et.current?.disconnect(),et.current=null;let e=en.current;en.current=null,e?.close().catch(()=>void 0),ec.current=null,el.current=0,eu.current=Pr,b(Pr)}function e_(e){j(!1),e()}function eS(e,t={}){var n;n=C,q.current?.removeCurrentTriggerToken(n),eA(e,t)}function eC(){return q.current?.getValue()??""}function eE(e){q.current?.setValue(e)}function eA(e,t={}){q.current?.insertText(e,t)}function eT(e,t){($(null),R(!1),"insert"===t)?eA(e.text,{block:!0}):(eE(e.text),q.current?.focus())}return(0,T.useEffect)(()=>{ef.current=i,ep.current=!1,em.current=null,S(null),k(null),E(null),j(!1),V(null)},[i]),(0,T.useEffect)(()=>{if(_){if(_.deliveryKey!==i)return void S(null);o>_.deliveryVersion&&S(null)}},[i,o,_]),(0,T.useEffect)(()=>{if(C)return window.addEventListener("pointerdown",e),()=>window.removeEventListener("pointerdown",e);function e(e){let t=e.target;t instanceof Node&&G.current?.contains(t)||E(null)}},[C]),(0,T.useEffect)(()=>{if(N)return window.addEventListener("pointerdown",e),()=>window.removeEventListener("pointerdown",e);function e(e){let t=e.target;t instanceof Node&&K.current?.contains(t)||j(!1)}},[N]),(0,T.useEffect)(()=>()=>{ew()},[]),(0,T.useEffect)(()=>{var e=P;try{window.localStorage.setItem(Ps,JSON.stringify(e.slice(0,80)))}catch{}},[P]),(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(p3,{className:`composer ${n?"collapsed":""}`,maxFiles:1,onError:e=>l(Error(e.message)),onSubmit:async()=>{n||await ey(eC())},children:[(0,A.jsxs)("div",{className:"composer-top",children:[(0,A.jsx)("div",{className:"composer-top-left",children:(0,A.jsx)(p9,{className:"icon-button",type:"button",onClick:()=>a(!n),tooltip:n?"Expand composer":"Collapse composer","aria-label":n?"Expand composer":"Collapse composer",children:n?(0,A.jsx)(z,{size:17}):(0,A.jsx)(F,{size:17})})}),(0,A.jsxs)("div",{className:"composer-top-meta",children:[e?(0,A.jsx)(wu,{as:"span",className:"composer-active-status",duration:1.1,children:"Active"}):(0,A.jsx)("span",{children:"Ready"}),(0,A.jsx)(P2,{usage:r})]})]}),(0,A.jsxs)(p4,{className:"composer-body",children:[(0,A.jsx)("div",{className:"composer-rich-text",onFocus:()=>E(null),children:(0,A.jsx)(jB,{className:"composer-lexical-input",ref:q,placeholder:"Send a new message or steer the active turn",onSubmit:()=>void ey(eC()),onTrigger:e=>E(e)})}),(0,A.jsx)(P1,{action:w,notice:_,pendingQueued:"send"===w&&!!e}),(0,A.jsx)(p6,{className:"composer-bottom",children:(0,A.jsxs)(p8,{className:"composer-actions",children:[(0,A.jsx)("input",{className:"file-input",ref:H,type:"file",onChange:e=>void ex(e.currentTarget.files?.[0])}),(0,A.jsxs)("div",{className:"composer-trigger-tools",ref:G,children:[(0,A.jsx)(p9,{className:"icon-button",type:"button",disabled:m||!!w,onClick:()=>H.current?.click(),tooltip:"Attach file","aria-label":"Attach file",children:(0,A.jsx)(Z,{size:17})}),(0,A.jsxs)("div",{className:"composer-overflow",ref:K,children:[(0,A.jsx)(p9,{className:"icon-button",type:"button","aria-expanded":N,"aria-haspopup":"menu",disabled:!!w,onClick:()=>{E(null),j(e=>!e)},tooltip:"Composer actions","aria-label":"Composer actions",children:(0,A.jsx)(X,{size:17})}),N&&(0,A.jsxs)("div",{className:"composer-overflow-menu",role:"menu",children:[(0,A.jsxs)("button",{type:"button",role:"menuitem",onClick:()=>e_(d),children:[(0,A.jsx)(ea,{size:16})," Settings"]}),(0,A.jsxs)("button",{type:"button",role:"menuitem",onClick:()=>{e_(()=>eA("/compact"))},children:[(0,A.jsx)(Y,{size:16})," Compact"]}),(0,A.jsxs)("button",{type:"button",role:"menuitem",onClick:()=>e_(s),children:[(0,A.jsx)(L,{size:16})," ",t]}),(0,A.jsxs)("button",{type:"button",role:"menuitem",onClick:()=>e_(()=>R(!0)),children:[(0,A.jsx)(ei,{size:16})," Drafts"]}),(0,A.jsxs)("button",{type:"button",role:"menuitem",onClick:()=>e_(u),children:[(0,A.jsx)(W,{size:16})," Fork"]})]})]}),C&&(0,A.jsxs)("div",{className:"composer-trigger-menu",role:"menu",children:["@"===C&&(0,A.jsxs)("button",{type:"button",role:"menuitem",disabled:!!w,onClick:function(){j(!1),E(null),h(e=>{eS(P5(e.name,e.relativePath||e.path),{block:!0})})},children:[(0,A.jsx)(O,{size:16})," Reference file"]}),"$"===C&&(0,A.jsxs)("button",{type:"button",role:"menuitem",disabled:!!w,onClick:function(){j(!1),E(null),f(e=>eS(`$${e.name}`))},children:[(0,A.jsx)(B,{size:16})," Reference skill"]})]})]}),(0,A.jsxs)("div",{className:"composer-primary-actions",children:[(0,A.jsx)(p9,{className:`icon-button mic-button ${y}`,type:"button",disabled:m||!!w||"transcribing"===y,onClick:()=>void eb(),tooltip:"recording"===y?"Stop recording":"transcribing"===y?"Transcribing":"Start transcription","aria-label":"recording"===y?"Stop recording":"transcribing"===y?"Transcribing":"Start transcription",children:"idle"===y?(0,A.jsx)(J,{size:17}):(0,A.jsx)(PJ,{levels:"recording"===y?x:Pi})}),(0,A.jsx)(p9,{className:"icon-button interrupt-button",type:"button",disabled:!e,onClick:c,tooltip:"Interrupt active turn","aria-label":"Interrupt active turn",children:(0,A.jsx)(Q,{size:17})}),(0,A.jsx)(p9,{className:"icon-button save-draft-button",type:"button",onClick:function(){let e=eC();if(!e.trim())return;let t={id:Ml(),savedAt:Date.now(),text:e};M(e=>[t,...e].slice(0,80)),eE("")},tooltip:"Save draft for later","aria-label":"Save draft for later",children:(0,A.jsx)(ei,{size:17})}),(0,A.jsxs)("button",{className:e?"queue-button":"primary-button",disabled:!!w,type:"button",onClick:()=>void ey(eC()),children:[(0,A.jsx)(es,{size:16})," ","send"===w?"Sending":"Send"]})]})]})})]})]}),null!==U&&(0,A.jsx)(PX,{disabled:!!w,onClose:()=>V(null),onEnqueue:()=>void ev("send"),onSteer:()=>void ev("steer")}),D&&(0,A.jsx)(PZ,{drafts:P,onClose:()=>R(!1),onDelete:function(e){M(t=>t.filter(t=>t.id!==e))},onUse:function(e){if(eC().trim()){R(!1),$(e);return}eT(e,"overwrite")}}),I&&(0,A.jsx)(PQ,{draft:I,onClose:()=>$(null),onInsert:()=>eT(I,"insert"),onOverwrite:()=>eT(I,"overwrite")})]})});function PJ({levels:e}){return(0,A.jsx)("span",{className:"audio-level-meter","aria-hidden":"true",children:e.map((e,t)=>(0,A.jsx)("span",{style:{"--level":`${Math.max(.08,Math.min(1,e))}`}},t))})}function PY({children:e}){let[t,n]=(0,T.useState)(!1);return((0,T.useEffect)(()=>{n(!0)},[]),t)?(0,ec.createPortal)((0,A.jsx)("div",{className:"modal-backdrop",children:e}),document.body):null}function PX({disabled:e,onClose:t,onEnqueue:n,onSteer:r}){return(0,A.jsx)(PY,{children:(0,A.jsxs)("section",{className:"modal send-choice-modal",role:"dialog","aria-modal":"true","aria-labelledby":"send-choice-title",children:[(0,A.jsxs)("header",{className:"modal-header",children:[(0,A.jsxs)("div",{children:[(0,A.jsx)("h2",{id:"send-choice-title",children:"Active turn"}),(0,A.jsx)("p",{className:"muted",children:"Choose how to send this input."})]}),(0,A.jsx)("button",{className:"icon-button",type:"button",onClick:t,title:"Close","aria-label":"Close",children:(0,A.jsx)(eu,{size:16})})]}),(0,A.jsxs)("div",{className:"send-choice-actions",children:[(0,A.jsxs)("button",{className:"queue-button",type:"button",onClick:n,disabled:e,children:[(0,A.jsx)(es,{size:16})," Enqueue"]}),(0,A.jsxs)("button",{className:"primary-button",type:"button",onClick:r,disabled:e,children:[(0,A.jsx)(es,{size:16})," Steer active turn"]})]})]})})}function PZ({drafts:e,onClose:t,onDelete:n,onUse:r}){return(0,A.jsx)(PY,{children:(0,A.jsxs)("section",{className:"modal saved-drafts-modal",role:"dialog","aria-modal":"true","aria-labelledby":"saved-drafts-title",children:[(0,A.jsxs)("header",{className:"modal-header",children:[(0,A.jsxs)("div",{children:[(0,A.jsx)("h2",{id:"saved-drafts-title",children:"Saved drafts"}),(0,A.jsx)("p",{className:"muted",children:e.length?`${e.length} saved`:"No saved drafts"})]}),(0,A.jsx)("button",{className:"icon-button",type:"button",onClick:t,title:"Close","aria-label":"Close",children:(0,A.jsx)(eu,{size:16})})]}),e.length>0?(0,A.jsx)("div",{className:"saved-draft-list",children:e.map(e=>{var t;return(0,A.jsxs)("article",{className:"saved-draft-row",children:[(0,A.jsxs)("button",{type:"button",onClick:()=>r(e),children:[(0,A.jsx)("strong",{children:Ma(e.text)}),(0,A.jsx)("span",{children:(t=e.savedAt,new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}).format(new Date(t)))})]}),(0,A.jsx)("button",{className:"icon-button",type:"button",onClick:()=>n(e.id),title:"Delete saved draft","aria-label":"Delete saved draft",children:(0,A.jsx)(el,{size:16})})]},e.id)})}):(0,A.jsxs)("div",{className:"empty-state inline",children:[(0,A.jsx)("h2",{children:"Nothing saved"}),(0,A.jsx)("p",{children:"Use the disk button next to send to save composer text for later."})]})]})})}function PQ({draft:e,onClose:t,onInsert:n,onOverwrite:r}){return(0,A.jsx)(PY,{children:(0,A.jsxs)("section",{className:"modal saved-draft-choice-modal",role:"dialog","aria-modal":"true","aria-labelledby":"saved-draft-choice-title",children:[(0,A.jsxs)("header",{className:"modal-header",children:[(0,A.jsxs)("div",{children:[(0,A.jsx)("h2",{id:"saved-draft-choice-title",children:"Composer has text"}),(0,A.jsx)("p",{className:"muted",children:Ma(e.text)})]}),(0,A.jsx)("button",{className:"icon-button",type:"button",onClick:t,title:"Close","aria-label":"Close",children:(0,A.jsx)(eu,{size:16})})]}),(0,A.jsxs)("div",{className:"send-choice-actions",children:[(0,A.jsxs)("button",{className:"secondary-button",type:"button",onClick:n,children:[(0,A.jsx)(et,{size:16})," Insert"]}),(0,A.jsxs)("button",{className:"primary-button",type:"button",onClick:r,children:[(0,A.jsx)(ei,{size:16})," Overwrite"]})]})]})})}function P0({loading:e,onClose:t,onRefresh:n,onSelect:r,skills:i}){let[o,s]=(0,T.useState)(""),a=(0,T.useMemo)(()=>{let e=o.trim().toLowerCase();return e?i.filter(t=>`${t.name}
|
|
9
9
|
${t.description||""}
|
|
10
|
-
${t.source}`.toLowerCase().includes(e)):i},[o,i]);return(0,A.jsx)("div",{className:"modal-backdrop",children:(0,A.jsxs)("section",{className:"modal skill-selector-modal",role:"dialog","aria-modal":"true","aria-labelledby":"skill-selector-title",children:[(0,A.jsxs)("header",{className:"modal-header",children:[(0,A.jsxs)("div",{className:"file-viewer-title",children:[(0,A.jsx)("h2",{id:"skill-selector-title",children:"Reference skill"}),(0,A.jsx)("p",{className:"muted",children:i.length?`${i.length} skills available`:"Loading skills"})]}),(0,A.jsx)("button",{className:"icon-button",type:"button",onClick:t,title:"Close","aria-label":"Close",children:(0,A.jsx)(eu,{size:16})})]}),(0,A.jsxs)("div",{className:"file-explorer-toolbar",children:[(0,A.jsxs)("label",{className:"file-search-field",children:[(0,A.jsx)(eo,{size:15}),(0,A.jsx)("input",{value:o,onChange:e=>s(e.target.value),placeholder:"Filter skills",autoFocus:!0})]}),(0,A.jsx)("button",{className:"icon-button",type:"button",onClick:n,disabled:e,title:"Refresh skills","aria-label":"Refresh skills",children:(0,A.jsx)(er,{size:16,className:e?"spin-icon":""})})]}),(0,A.jsx)("div",{className:`skill-selector-list ${e?"loading":""}`,children:e&&!i.length?(0,A.jsx)(wu,{as:"span",className:"muted empty-pad",duration:1.4,children:"Loading skills"}):0===a.length?(0,A.jsx)("p",{className:"muted empty-pad",children:"No skills found."}):a.map(e=>(0,A.jsxs)("button",{className:"skill-selector-row",type:"button",onClick:()=>r(e),children:[(0,A.jsxs)("strong",{children:["$",e.name]}),e.description&&(0,A.jsx)("span",{children:e.description}),(0,A.jsx)("small",{children:e.source})]},`${e.source}:${e.name}:${e.path}`))})]})})}function P2({action:e,notice:t,pendingQueued:n}){return e?(0,A.jsxs)("div",{className:"composer-input-status busy",children:[(0,A.jsx)("span",{className:"spinner"}),(0,A.jsx)("span",{children:"steer"===e?"Sending steer input":n?"Enqueuing input":"Sending input"})]}):t?(0,A.jsxs)("div",{className:`composer-input-status ${"steer"===t.action?"steer":"queued"}`,children:[(0,A.jsx)("span",{className:"status-dot"}),(0,A.jsx)("span",{children:"steer"===t.action?"Steer sent":t.queued?"Input enqueued":"Input sent"})]}):null}function P5({usage:e}){var t,n;let r=e?.last??e?.total??null;return(0,A.jsxs)(dP,{maxTokens:e?.modelContextWindow??null,usedTokens:r?.totalTokens??null,usage:(t=r)?{cachedTokens:t.cachedInputTokens,inputTokens:t.inputTokens,outputTokens:t.outputTokens,reasoningTokens:t.reasoningOutputTokens,totalTokens:t.totalTokens}:null,children:[(0,A.jsx)(dM,{className:"context-trigger"}),(0,A.jsxs)(dD,{children:[(0,A.jsx)(dR,{}),(0,A.jsxs)(dL,{children:[(0,A.jsx)(dI,{}),(0,A.jsx)(dF,{}),(0,A.jsx)(dz,{}),(0,A.jsx)(dB,{})]}),(0,A.jsxs)(dO,{children:["Total used: ","number"==typeof(n=e?.total.totalTokens??null)&&Number.isFinite(n)?new Intl.NumberFormat(void 0,{maximumFractionDigits:+(n>=1e3),notation:"compact"}).format(n):"n/a"]})]})]})}function P3(e,t){return`[${(e||Mo(t)).replace(/([\\[\]])/g,"\\$1")}](${encodeURI(t)})`}function P4(e){return String(e)}function P6(e){let t=M_(e.params);return"string"==typeof t.threadId?t.threadId:Mz(t.thread)}function P8(e){return!!(e?.unsafePermissions&&!e.locked&&e.allowedApprovalPolicies.includes("never")&&e.allowedSandboxes.includes("danger-full-access"))}function P9(e,t){return Me(e).some(e=>e===t)}function P7(e){let t=Me(e).find(e=>{var t;return!!((t=e)&&"object"==typeof t&&!Array.isArray(t)&&"acceptWithExecpolicyAmendment"in t)});if(t)return t;let n=M_(e.params),r=Array.isArray(n.proposedExecpolicyAmendment)?n.proposedExecpolicyAmendment:null;return r?{acceptWithExecpolicyAmendment:{execpolicy_amendment:r.filter(MI)}}:null}function Me(e){let t=M_(e.params);return Array.isArray(t.availableDecisions)?t.availableDecisions.filter(MI):[]}function Mt(e){return e.name||e.preview||e.id}function Mn(e){return Mi(e.trim().replace(/[.,;:!?]+$/g,""))}function Mr(e){return!(!e||e.includes("://")||e.startsWith("@"))&&/\.(?:json|md|markdown|mdx|py|tsx?|jsx?|css|scss|html|yaml|yml|toml|txt|log|csv|rs|go|java|kt|swift|c|h|cpp|hpp|cs|rb|php|sh|bash|zsh|fish|sql|xml|vue|svelte|png|jpe?g|gif|webp|bmp|avif|svg|pdf|mp4|m4v|webm|mov|ogv|ogg|avi|mkv|3gp|docx?|xlsx?|pptx?)$/i.test(Mi(e))}function Mi(e){return e.replace(/:\d+(?::\d+)?$/,"")}function Mo(e){let t=Mi(e);return t.split(/[\\/]/).filter(Boolean).at(-1)||t}function Ms(){return window.matchMedia("(max-width: 780px)").matches}function Ma(e){let t=M_(e),n="string"==typeof t.id&&t.id?t.id:Mu(),r="string"==typeof t.text?t.text:"",i=MF(t.savedAt)??Date.now();return r.trim()?{id:n,savedAt:i,text:r}:null}function Ml(e){let t=e.replace(/\s+/g," ").trim();return t?t.length>96?`${t.slice(0,95)}...`:t:"Empty draft"}function Mu(){return"u">typeof crypto&&"function"==typeof crypto.randomUUID?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`}function Mc(e){try{window.localStorage.setItem(Pu,JSON.stringify(e))}catch{}}function Md(e){let t=e.threadPaneCount??1,n=e.openThreadIds??[];return Array.from({length:t},(e,t)=>n[t]??null)}function Mh(e,t,n,r){return"number"==typeof e&&Number.isFinite(e)?Math.min(n,Math.max(t,e)):r}function Mf(e){let t=[...e.turns??[]].reverse().find(e=>Mp(e.status));return t?.id??null}function Mp(e){let t=String(e??"").toLowerCase().replace(/[_\s-]+/g,"");return"inprogress"===t||"active"===t||"running"===t}function Mm(e){let t=String(e??"").toLowerCase().replace(/[_\s-]+/g,"");return"idle"===t||"completed"===t||"complete"===t||"finished"===t}function Mg(e){for(let t=(e.turns?.length??0)-1;t>=0;t-=1){let n=e.turns?.[t];for(let e=(n?.items?.length??0)-1;e>=0;e-=1){let t=n?.items?.[e];if(t&&My(t))return!0}}return!1}function My(e){let t=M_(e),n=String(t.type??"").toLowerCase(),r=String(t.phase??t.kind??t.category??"").toLowerCase().replace(/[_\s-]+/g,""),i=String(t.role??"").toLowerCase();return("agentmessage"===n||"assistant"===i)&&("finalanswer"===r||"final"===r||"finalresponse"===r)}function Mv(e){return Array.isArray(e)?e.map(e=>{let t=M_(e);return"text"===t.type?String(t.text??""):"image"===t.type?`[image] ${String(t.url??"")}`:"localImage"===t.type?`[local image] ${String(t.path??"")}`:"skill"===t.type||"mention"===t.type?`[${String(t.type)}] ${String(t.name??"")}: ${String(t.path??"")}`:JSON.stringify(t)}).join("\n"):""}function Mx(e){return Array.isArray(e)?e.map(e=>M_(e).command).filter(Boolean).join(" | "):""}function Mb(e){return({userMessage:"User",agentMessage:"Codex",commandExecution:"Command",fileChange:"Files",mcpToolCall:"MCP",dynamicToolCall:"Tool",collabAgentToolCall:"Agent",webSearch:"Search",imageView:"Image",imageGeneration:"Image",logEntry:"Log",reasoning:"Reasoning",reasoningGroup:"Reasoning",commandGroup:"Commands",plan:"Plan"})[e]||e}function Mw(e){return"userMessage"===e?"user":"agentMessage"===e||"reasoning"===e||"reasoningGroup"===e||"plan"===e?"agent":"commandExecution"===e||"commandGroup"===e?"command":"tool"}function Mk(e){return Object.fromEntries(Object.entries(e).filter(([,e])=>""!==e&&null!=e))}function M_(e){return e&&"object"==typeof e&&!Array.isArray(e)?e:{}}function MS(e){let t=M_(e);return MC(M_(t.rateLimitsByLimitId)[Ps])??MC(t.rateLimits)}function MC(e){let t=M_(e),n=ME(t.primary),r=ME(t.secondary);return n||r?{limitId:"string"==typeof t.limitId?t.limitId:null,limitName:"string"==typeof t.limitName?t.limitName:null,primary:n,secondary:r}:null}function ME(e){let t=M_(e),n=MF(t.usedPercent);return null===n?null:{usedPercent:n,windowDurationMins:"number"==typeof t.windowDurationMins?t.windowDurationMins:null,resetsAt:"number"==typeof t.resetsAt?t.resetsAt:null}}function MA(e){var t;if(!e)return null;let n=M_(e),r=MT(n);if(r)return r;let i=[],o=[];for(let t of e.turns??[]){let e=M_(t),n=MT(e);n&&o.push(n);let r=MD(e.tokenUsage??e.token_usage??e.usage);for(let e of(r&&i.push(r),t.items??[])){let t=M_(e),n=MT(t);n&&o.push(n);let r=MD(t.tokenUsage??t.token_usage??t.usage);r&&i.push(r)}}let s=o.at(-1);if(s)return s;let a=(t=i).length?t.reduce((e,t)=>({totalTokens:e.totalTokens+t.totalTokens,inputTokens:e.inputTokens+t.inputTokens,cachedInputTokens:e.cachedInputTokens+t.cachedInputTokens,outputTokens:e.outputTokens+t.outputTokens,reasoningOutputTokens:e.reasoningOutputTokens+t.reasoningOutputTokens}),MR()):null,l=ML(n,["modelContextWindow","model_context_window","contextWindow","context_window","maxTokens","max_tokens"]);return a||null!==l?{total:a??MR(),last:i.at(-1)??MR(),modelContextWindow:l}:null}function MT(e){return MN(e.tokenUsage)??MN(e.token_usage)??MN(e.tokenCount)??MN(e.token_count)??MN(e.contextUsage)??MN(e.context_usage)??MN(e.usage)??MN(e.context)??MN(e.payload)??MN(e.info)??MN(e)}function MN(e){let t=M_(e),n=M_(t.info),r=Object.keys(n).length?n:t,i=MD(r.total_token_usage??r.totalTokenUsage??r.total)??MD(e),o=MD(r.last_token_usage??r.lastTokenUsage??r.last)??i,s=ML(r,["modelContextWindow","model_context_window","contextWindow","context_window","maxTokens","max_tokens"]);return i||null!==s?{total:i??MR(),last:o??MR(),modelContextWindow:s}:null}function Mj(e,t){if(!e)return t;if(!t)return e;let n=Math.max(e.total.totalTokens,e.last.totalTokens),r=Math.max(t.total.totalTokens,t.last.totalTokens);return 0===n&&r>0?{total:t.total,last:t.last,modelContextWindow:e.modelContextWindow??t.modelContextWindow}:null===e.modelContextWindow&&null!==t.modelContextWindow?{...e,modelContextWindow:t.modelContextWindow}:e}function MP(e){return!!e&&Math.max(e.total.totalTokens,e.last.totalTokens)>0}function MM(e,t){return e.totalTokens===t.totalTokens&&e.inputTokens===t.inputTokens&&e.cachedInputTokens===t.cachedInputTokens&&e.outputTokens===t.outputTokens&&e.reasoningOutputTokens===t.reasoningOutputTokens}function MD(e){let t=M_(e),n=M_(t.prompt_tokens_details??t.promptTokensDetails??t.inputTokensDetails??t.input_tokens_details),r=M_(t.completion_tokens_details??t.completionTokensDetails??t.outputTokensDetails??t.output_tokens_details),i=ML(t,["inputTokens","input_tokens","promptTokens","prompt_tokens","input"]),o=ML(t,["cachedInputTokens","cached_input_tokens","cachedTokens","cached_tokens","cached"])??ML(n,["cachedTokens","cached_tokens"]),s=ML(t,["outputTokens","output_tokens","completionTokens","completion_tokens","output"]),a=ML(t,["reasoningOutputTokens","reasoning_output_tokens","reasoningTokens","reasoning_tokens","reasoning"])??ML(r,["reasoningTokens","reasoning_tokens"]),l=ML(t,["totalTokens","total_tokens","total"])??function(...e){let t=e.filter(e=>null!==e);return t.length?t.reduce((e,t)=>e+t,0):null}(i,s);return[l,i,o,s,a].every(e=>null===e)?null:{totalTokens:l??0,inputTokens:i??0,cachedInputTokens:o??0,outputTokens:s??0,reasoningOutputTokens:a??0}}function MR(){return{totalTokens:0,inputTokens:0,cachedInputTokens:0,outputTokens:0,reasoningOutputTokens:0}}function ML(e,t){for(let n of t){let t=MF(e[n]);if(null!==t)return t}return null}function MO(e,t){if(!e)return null;let n=[e.primary,e.secondary].filter(e=>!!e),r="5hr"===t?300:10080,i=n.find(e=>null!==e.windowDurationMins&&30>=Math.abs(e.windowDurationMins-r)),o=i?.usedPercent??("5hr"===t?e.primary?.usedPercent??null:e.secondary?.usedPercent??null);return null===o?null:Math.max(0,Math.min(100,100-o))}function MI(e){return null===e||["boolean","number","string"].includes(typeof e)?"number"!=typeof e||Number.isFinite(e):Array.isArray(e)?e.every(MI):"object"==typeof e&&Object.values(e).every(MI)}function MF(e){return"number"==typeof e&&Number.isFinite(e)?e:null}function Mz(e){let t=M_(e);return"string"==typeof t.id?t.id:""}function MB(e){return e?new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}).format(new Date(e>1e10?e:1e3*e)):""}function M$(e){return e instanceof Error?e.message:String(e)}function MU(e){return/insecure protocol|https|http is only allowed/i.test(e)?"open the Web UI through HTTPS, then try login again":/invalid_grant/i.test(e)?"the OAuth callback was already used or expired; try logging in again":/timed out/i.test(e)?"the OAuth callback was not received in time; try logging in again":e}e.s(["default",0,function({initialThreadId:e=null}){var t;let[n,r]=(0,T.useState)(null),[i,o]=(0,T.useState)(null),[s,a]=(0,T.useState)(""),[l,u]=(0,T.useState)(""),[c,d]=(0,T.useState)({state:"stopped"}),[h,f]=(0,T.useState)([]),[p,m]=(0,T.useState)(new Set),[g,y]=(0,T.useState)(null),[v,x]=(0,T.useState)(()=>Md(Pd)),[b,w]=(0,T.useState)({}),[k,_]=(0,T.useState)(()=>{var e;return Mh((e=Pd).activePaneIndex,0,(e.threadPaneCount??1)-1,0)}),[S,C]=(0,T.useState)({}),[E,N]=(0,T.useState)(1),[j,P]=(0,T.useState)(!1),[M,D]=(0,T.useState)(!1),[L,O]=(0,T.useState)(()=>Mh(Pd.sidebarWidth,240,520,330)),[I,F]=(0,T.useState)(()=>Mh(Pd.threadSplitRatio,.25,.75,.5)),[z,B]=(0,T.useState)(()=>Pd.showArchived??!1),[$,V]=(0,T.useState)(()=>Pd.recentOnly??!1),[W,H]=(0,T.useState)(""),[K,J]=(0,T.useState)(()=>Pd.mobilePane??"sessions"),[Y,Z]=(0,T.useState)(()=>Pd.threadPaneCount??1),[Q,ee]=(0,T.useState)(()=>Pd.composerCollapsed??!1),[et,en]=(0,T.useState)(null),[ei,eo]=(0,T.useState)(!1),[es,ea]=(0,T.useState)(!1),[el,eu]=(0,T.useState)(!1),[ec,ed]=(0,T.useState)(!1),[eh,ef]=(0,T.useState)({...Pr}),[ep,em]=(0,T.useState)(!1),[eg,ey]=(0,T.useState)(!1),[ev,ex]=(0,T.useState)(!1),[eb,ew]=(0,T.useState)({}),[ek,e_]=(0,T.useState)({}),[eS,eC]=(0,T.useState)(null),[eE,eA]=(0,T.useState)({}),[eT,eN]=(0,T.useState)(null),[ej,eP]=(0,T.useState)(null),[eM,eD]=(0,T.useState)(!1),[eR,eL]=(0,T.useState)("view"),[eO,eI]=(0,T.useState)(null),[eF,ez]=(0,T.useState)({}),[eB,e$]=(0,T.useState)(!1),[eU,eV]=(0,T.useState)(!1),[eW,eH]=(0,T.useState)([]),[eK,eG]=(0,T.useState)(!1),[eq,eJ]=(0,T.useState)({}),[eY,eX]=(0,T.useState)({}),[eZ,eQ]=(0,T.useState)(new Set),[e0,e1]=(0,T.useState)(()=>(function(){try{let e=M_(JSON.parse(window.localStorage.getItem(Pu)||"{}"));return Object.fromEntries(Object.entries(e).map(([e,t])=>{var n;let r,i,o;return[e,(n=t,r=M_(n),i="string"==typeof r.approvalPolicy?r.approvalPolicy:"",o="string"==typeof r.sandbox?r.sandbox:"",i&&o?{approvalPolicy:i,sandbox:o}:null)]}).filter(e=>!!e[1]))}catch{return{}}})()),[e2,e5]=(0,T.useState)({active:!1,distance:0,refreshing:!1}),[e3,e4]=(0,T.useState)(null),[e6,e8]=(0,T.useState)(!1),e9=(0,T.useRef)(null),e7=(0,T.useRef)(new Map),te=(0,T.useRef)(new Map),tt=(0,T.useRef)(new Set),tn=(0,T.useRef)(new Map),tr=(0,T.useRef)(new Set),ti=(0,T.useRef)(new Set),to=(0,T.useRef)(null),ts=(0,T.useRef)(0),ta=(0,T.useRef)(0),tl=(0,T.useRef)(0),tu=(0,T.useRef)(0),tc=(0,T.useRef)(null),td=(0,T.useRef)(null),th=(0,T.useRef)({}),tf=(0,T.useRef)(null),tp=(0,T.useRef)(k),tm=(0,T.useRef)({}),tg=(0,T.useRef)(v),ty=(0,T.useRef)({}),tv=(0,T.useRef)({}),tx=(0,T.useRef)(e0),tb=(0,T.useRef)(!1),tw=(0,T.useRef)(null),tk=(0,T.useRef)(null),t_=(0,T.useRef)(!1),tS=(0,T.useRef)(!1),tC=(0,T.useRef)(null),tE=(0,T.useRef)(null),tA=(0,T.useRef)(null),tT=(0,T.useRef)(L),tN=(0,T.useRef)(null),tj=(0,T.useRef)(L),tP=(0,T.useRef)(I),tM=(0,T.useRef)(null),tD=(0,T.useRef)(I),tR=(0,T.useRef)(null);(0,T.useEffect)(()=>{if(ei||es||el)return window.addEventListener("pointerdown",e),()=>window.removeEventListener("pointerdown",e);function e(e){let t=e.target;t instanceof Element&&t.closest("[data-menu-root]")||(eo(!1),ea(!1),eu(!1))}},[es,el,ei]),(0,T.useEffect)(()=>{ty.current=b},[b]),(0,T.useEffect)(()=>{tm.current=eb},[eb]),(0,T.useEffect)(()=>{tx.current=e0,Mc(e0)},[e0]),(0,T.useEffect)(()=>()=>{for(let e of te.current.values())window.clearTimeout(e);te.current.clear(),to.current&&window.clearTimeout(to.current),tR.current&&window.clearTimeout(tR.current),tN.current&&window.cancelAnimationFrame(tN.current),tM.current&&window.cancelAnimationFrame(tM.current)},[]),(0,T.useEffect)(()=>{w0().then(t5).catch(()=>o(!1))},[]),(0,T.useEffect)(()=>{function e(){e9.current?.close(),r(null),o(!1),u("Session expired. Sign in again.")}return window.addEventListener(wQ,e),()=>window.removeEventListener(wQ,e)},[]),(0,T.useEffect)(()=>{var e,t;let n,r;if(!i)return;w5().then(d).catch(nJ),nd(),function(){if(tb.current)return;tb.current=!0;let e=tg.current.map((e,t)=>({threadId:e,paneIndex:t})).filter(e=>!!e.threadId);if(0===e.length)return;let t=tg.current[tp.current]??e[0]?.threadId??null;for(let n of(t&&y(t),eJ(t=>{let n={...t};for(let t of e)n[t.paneIndex]=t.threadId;return n}),e)){let e=++ta.current;th.current[n.paneIndex]=e,nA(n.threadId,n.paneIndex,e).finally(()=>{eJ(e=>{if(e[n.paneIndex]!==n.threadId)return e;let t={...e};return delete t[n.paneIndex],t})})}}(),nh(),nf(),e9.current?.close();let o=(e=e=>{nL(e)},t=e=>{for(let t of e)nL(t)},n=new AbortController,r={close:()=>n.abort()},ky(n,r,e,t),r);return o.onerror=()=>d(e=>({...e,state:"disconnected",error:"Event stream disconnected"})),e9.current=o,()=>{o.close()}},[i]),(0,T.useEffect)(()=>{if(!i||!e){tf.current=null;return}if(tf.current===e)return;tf.current=e;let t=tp.current,n=tg.current.indexOf(e);if(n>=0){nk(n),y(e);return}Y>1&&tg.current.some(Boolean)||nE(e,t,!1)},[i,e]),(0,T.useEffect)(()=>{i&&ev&&np()},[i,ev]),(0,T.useEffect)(()=>{if(!i)return;let e=window.setInterval(()=>{let e=Date.now();for(let n of[...new Set(tg.current.filter(e=>!!e))]){var t;let r=ty.current[n];if(!r||(t=r,!(tm.current[n]||Mf(t)||!Mg(t)&&Mp(Pq(t))))||e-(tn.current.get(n)??0)<5e3||tt.current.has(n))continue;let i=tg.current.indexOf(n);i<0||(tt.current.add(n),nA(n,i).finally(()=>tt.current.delete(n)))}},5e3);return()=>window.clearInterval(e)},[i]),(0,T.useEffect)(()=>{let e=window.setTimeout(()=>{i&&nd()},250);return()=>window.clearTimeout(e)},[z,W,E]);let tL=(0,T.useMemo)(()=>[...h].sort((e,t)=>(t.updatedAt??0)-(e.updatedAt??0)),[h]),tO=(0,T.useMemo)(()=>$?function(e){let t=new Map;for(let n of e){let e=n.cwd||"unknown",r=t.get(e);(!r||(n.updatedAt??0)>(r.updatedAt??0))&&t.set(e,n)}return[...t.values()].sort((e,t)=>(t.updatedAt??0)-(e.updatedAt??0))}(tL):tL,[tL,$]),tI=(0,T.useMemo)(()=>(function(e){let t=new Map;for(let n of e){let e=n.cwd||"unknown",r=n.cwd?n.cwd?n.cwd.split(/[\\/]+/).filter(Boolean).at(-1)||n.cwd:Mt(n):"No folder",i=t.get(e)??{key:e,label:r,threads:[]};i.threads.push(n),t.set(e,i)}return[...t.values()]})(tO),[tO]),tF=(0,T.useMemo)(()=>Array.from({length:Y},(e,t)=>v[t]??null),[v,Y]),tz=tF[k]??null,tB=tz?b[tz]??null:null,t$=Ms()&&"sessions"===K?"Codex Web UI":tB?Mt(tB):"Codex Web UI";(0,T.useEffect)(()=>{if("sessions"!==K||!g)return;let e=window.setTimeout(()=>{let e=[...tE.current?.querySelectorAll("[data-thread-id]")??[]].find(e=>e.dataset.threadId===g);e?.scrollIntoView({block:"center",behavior:"smooth"})},240);return()=>window.clearTimeout(e)},[tI,K,g]);let tU=Ph(e=>nk(e)),tV=Ph((e,t)=>nD(e,t)),tW=Ph((e,t)=>nM(e,t)),tH=Ph(e=>nj(e)),tK=Ph((e,t)=>nP(e,t)),tG=Ph((e,t,n,r)=>nN(e,t,n,r)),tq=Ph(e=>na(e)),tJ=Ph(e=>nr(e)),tY=Ph(e=>nl(e)),tX=Ph(e=>ny(e)),tZ=Ph(e=>nJ(e)),tQ=Ph((e,t)=>nv(e,t)),t0=Ph(()=>ey(!0));if((0,T.useEffect)(()=>{let e=Array.from({length:Y},(e,t)=>tg.current[t]??null);tg.current=e,x(e);let t=Math.min(tp.current,Y-1);tp.current=t,_(t)},[Y]),(0,T.useEffect)(()=>{tg.current=v},[v]),(0,T.useEffect)(()=>{tp.current=k},[k]),(0,T.useEffect)(()=>{!function e(t,n){if(n){n.current&&window.clearTimeout(n.current),n.current=window.setTimeout(()=>{n.current=null,e(t)},350);return}try{window.localStorage.setItem(Pl,JSON.stringify({activePaneIndex:Mh(t.activePaneIndex,0,(t.threadPaneCount??1)-1,0),composerCollapsed:t.composerCollapsed??!1,mobilePane:t.mobilePane,openThreadIds:Md(t),recentOnly:t.recentOnly??!1,showArchived:t.showArchived??!1,sidebarWidth:Mh(t.sidebarWidth,240,520,330),threadPaneCount:t.threadPaneCount,threadSplitRatio:Mh(t.threadSplitRatio,.25,.75,.5)}))}catch{}}({activePaneIndex:k,composerCollapsed:Q,mobilePane:K,openThreadIds:v,recentOnly:$,showArchived:z,sidebarWidth:L,threadPaneCount:Y,threadSplitRatio:I},tR)},[k,Q,K,v,$,z,L,Y,I]),(0,T.useEffect)(()=>{tT.current=L,tj.current=L,tC.current?.style.setProperty("--sidebar-width",`${L}px`)},[L]),(0,T.useEffect)(()=>{tP.current=I,tD.current=I,Pf(tA.current,I)},[I]),null===i)return(0,A.jsx)("div",{className:"boot",children:"Loading"});if(!i)return(0,A.jsx)("main",{className:"login-screen",children:(0,A.jsxs)("form",{className:"login-panel",onSubmit:t1,children:[(0,A.jsxs)("div",{children:[(0,A.jsx)("p",{className:"eyebrow",children:"Remote control"}),(0,A.jsx)("h1",{children:"Codex Web UI"})]}),(0,A.jsxs)("label",{className:"field",children:[(0,A.jsx)("span",{children:"Password"}),(0,A.jsx)("input",{value:s,onChange:e=>a(e.target.value),type:"password",autoFocus:!0})]}),(0,A.jsx)("button",{className:"primary-button",type:"submit",children:"Sign in"}),(0,A.jsx)("p",{className:"error-text",children:l})]})});return(0,A.jsxs)("main",{className:`app-shell ${n?.warning?"auth-warning-mode":""}`,children:[(0,A.jsxs)("header",{className:"topbar",onTouchStart:function(e){if(!Ms())return;let t=e.touches[0];tk.current=t?{x:t.clientX,y:t.clientY}:null},onTouchMove:function(e){let t=tk.current,n=e.touches[0];if(!t||!n||e2.refreshing)return;let r=n.clientY-t.y,i=n.clientX-t.x;r<=4||Math.abs(i)>Math.max(32,.8*r)||(e.preventDefault(),e5({active:!0,distance:Math.min(96,.72*r),refreshing:!1}))},onTouchEnd:()=>void t7(),onTouchCancel:function(){tk.current=null,e2.refreshing||e5({active:!1,distance:0,refreshing:!1})},children:[(0,A.jsxs)("div",{className:"brand-block",children:[(0,A.jsx)("div",{className:"mark","aria-hidden":"true",children:(0,A.jsx)("img",{src:"/icon.svg",alt:""})}),(0,A.jsxs)("div",{children:[(0,A.jsx)("strong",{title:t$,children:t$}),n?.warning&&(0,A.jsx)("span",{className:"auth-warning-text",children:n.warning})]})]}),(0,A.jsxs)("div",{className:"top-actions",children:[(0,A.jsxs)("button",{className:`status-button ${"disconnected"===c.state?"disconnected":""}`,type:"button",onClick:()=>ex(!0),title:"Show app server status","aria-label":"Show app server status",children:[(0,A.jsx)(R,{size:16}),(0,A.jsx)("span",{className:"top-action-label",children:"Status"}),(0,A.jsx)(PG,{value:c.state})]}),(0,A.jsxs)("div",{className:"action-overflow","data-menu-root":!0,children:[(0,A.jsx)("button",{className:"ghost-button",type:"button",onClick:()=>eo(e=>!e),title:"More actions","aria-label":"More actions","aria-expanded":ei,children:(0,A.jsx)(X,{size:18})}),ei&&(0,A.jsxs)("div",{className:"action-overflow-menu top-overflow-menu",role:"menu",children:[(0,A.jsxs)("button",{type:"button",role:"menuitem",onClick:()=>{eo(!1),nn()},children:[(0,A.jsx)(U,{size:16})," Files"]}),(0,A.jsxs)("button",{type:"button",role:"menuitem",onClick:()=>{eo(!1),t3()},children:[(0,A.jsx)(er,{size:16})," Reconnect"]}),(0,A.jsxs)("button",{type:"button",role:"menuitem",onClick:()=>{eo(!1),t2()},children:[(0,A.jsx)(G,{size:16})," Logout"]})]})]})]})]}),(0,A.jsxs)("nav",{className:"mobile-pane-tabs","aria-label":"Panes",children:[(0,A.jsx)("button",{"aria-pressed":"sessions"===K,className:`mobile-threads-pill ${"sessions"===K?"selected":""}`,type:"button",onClick:()=>J("sessions"),children:"Threads"}),(0,A.jsxs)("div",{className:"mobile-nav-actions",children:[(0,A.jsx)("button",{className:"ghost-button",type:"button",onClick:()=>em(!0),title:"New thread","aria-label":"New thread",children:(0,A.jsx)(q,{size:17})}),(0,A.jsx)("button",{className:`status-button ${"disconnected"===c.state?"disconnected":""}`,type:"button",onClick:()=>ex(!0),title:"Show app server status","aria-label":"Show app server status",children:(0,A.jsx)(R,{size:17})}),(0,A.jsxs)("div",{className:"action-overflow","data-menu-root":!0,children:[(0,A.jsx)("button",{className:"ghost-button",type:"button",onClick:()=>ea(e=>!e),title:"More actions","aria-label":"More actions","aria-expanded":es,children:(0,A.jsx)(X,{size:18})}),es&&(0,A.jsxs)("div",{className:"action-overflow-menu mobile-overflow-menu",role:"menu",children:[(0,A.jsxs)("label",{className:"menu-check-item",children:[(0,A.jsx)("input",{type:"checkbox",checked:$,onChange:e=>{V(e.target.checked)}}),(0,A.jsx)("span",{children:"Recent"})]}),(0,A.jsxs)("label",{className:"menu-check-item",children:[(0,A.jsx)("input",{type:"checkbox",checked:z,onChange:e=>{B(e.target.checked),N(1)}}),(0,A.jsx)("span",{children:"Archived"})]}),(0,A.jsxs)("button",{type:"button",role:"menuitem",disabled:M,onClick:()=>void t8(),children:[(0,A.jsx)(er,{size:16,className:M?"spin-icon":""})," Refresh"]}),(0,A.jsxs)("button",{type:"button",role:"menuitem",onClick:()=>{ea(!1),nn()},children:[(0,A.jsx)(U,{size:16})," Files"]}),(0,A.jsxs)("button",{type:"button",role:"menuitem",onClick:()=>{ea(!1),t3()},children:[(0,A.jsx)(er,{size:16})," Reconnect"]}),(0,A.jsxs)("button",{type:"button",role:"menuitem",onClick:()=>{ea(!1),t2()},children:[(0,A.jsx)(G,{size:16})," Logout"]})]})]})]})]}),(0,A.jsx)("div",{className:`pull-refresh-indicator ${e2.active||e2.refreshing?"visible":""} ${e2.refreshing?"refreshing":""}`,style:{"--pull-distance":`${Math.min(72,e2.distance)}px`},"aria-hidden":"true",children:(0,A.jsx)(er,{size:18})}),(0,A.jsxs)("section",{ref:tC,style:{"--sidebar-width":`${L}px`},className:`layout mobile-pane-${K}`,onTouchStart:e=>{let t=e.touches[0];tw.current=t?{x:t.clientX,y:t.clientY,paneSwipeBlocked:function(e,t){if(!(e instanceof Element))return!1;for(let r=e;r&&r!==t;r=r.parentElement){var n;if(n=r,["auto","scroll","overlay"].includes(window.getComputedStyle(n).overflowX)&&n.scrollWidth>n.clientWidth+1)return!0}return!1}(e.target,e.currentTarget),refreshEligible:function(e,t){if(!(e instanceof Element))return window.scrollY<=1;for(let r=e;r&&r!==t;r=r.parentElement){var n;if(n=r,["auto","scroll","overlay"].includes(window.getComputedStyle(n).overflowY)&&n.scrollHeight>n.clientHeight+1)return r.scrollTop<=1}return window.scrollY<=1}(e.target,e.currentTarget)}:null},onTouchEnd:e=>{var t;let n=tw.current,r=e.changedTouches[0];if(tw.current=null,!n||!r||n.paneSwipeBlocked)return;let i=r.clientX-n.x,o=r.clientY-n.y;n.refreshEligible&&o>110&&Math.abs(o)>1.25*Math.abs(i)?window.location.reload():70>Math.abs(i)||Math.abs(i)<1.3*Math.abs(o)||(t=i<0?1:-1,J(e=>{let n=Pc.indexOf(e),r=Math.min(Pc.length-1,Math.max(0,n+t));return Pc[r]??e}))},children:[(0,A.jsxs)("aside",{className:"sessions-panel",children:[(0,A.jsxs)("div",{className:"panel-heading",children:[(0,A.jsx)("div",{children:(0,A.jsx)("h2",{children:"Threads"})}),(0,A.jsxs)("div",{className:"panel-actions",children:[(0,A.jsx)("button",{className:"icon-button",type:"button",onClick:()=>em(!0),title:"New thread","aria-label":"New thread",children:(0,A.jsx)(q,{size:18})}),(0,A.jsxs)("div",{className:"action-overflow thread-actions-overflow","data-menu-root":!0,children:[(0,A.jsx)("button",{className:"icon-button",type:"button",onClick:()=>eu(e=>!e),title:"Thread list actions","aria-label":"Thread list actions","aria-expanded":el,children:(0,A.jsx)(X,{size:18})}),el&&(0,A.jsxs)("div",{className:"action-overflow-menu thread-actions-menu",role:"menu",children:[(0,A.jsxs)("label",{className:"menu-check-item",children:[(0,A.jsx)("input",{type:"checkbox",checked:$,onChange:e=>{V(e.target.checked)}}),(0,A.jsx)("span",{children:"Recent"})]}),(0,A.jsxs)("label",{className:"menu-check-item",children:[(0,A.jsx)("input",{type:"checkbox",checked:z,onChange:e=>{B(e.target.checked),N(1)}}),(0,A.jsx)("span",{children:"Archived"})]}),(0,A.jsxs)("button",{type:"button",role:"menuitem",disabled:M,onClick:()=>void t9(),children:[(0,A.jsx)(er,{size:16,className:M?"spin-icon":""})," Refresh"]})]})]})]})]}),(0,A.jsx)("div",{className:"session-tools",children:(0,A.jsxs)("label",{className:"field",children:[(0,A.jsx)("span",{children:"Search"}),(0,A.jsx)("input",{value:W,onChange:e=>{N(1),H(e.target.value)},placeholder:"Title, preview, cwd"})]})}),(0,A.jsxs)("div",{className:"sessions-list",ref:tE,onScroll:function(e){let t=e.currentTarget;t.scrollHeight-t.scrollTop-t.clientHeight<120&&nb()},children:[0===tL.length?(0,A.jsx)("p",{className:"muted empty-pad",children:"No threads found."}):tI.map(e=>(0,A.jsx)(Pm,{group:e,onRowClick:nw,selectedThreadId:g,sessionPreviews:S},e.key)),j&&(0,A.jsx)("button",{className:"load-more-button",type:"button",onClick:nb,disabled:M,children:M?"Loading":"Load more"})]})]}),(0,A.jsx)("div",{className:"sidebar-resizer",role:"separator","aria-label":"Resize threads sidebar","aria-orientation":"vertical",onPointerDown:e=>{t_.current=!0,tj.current=tT.current,e.currentTarget.setPointerCapture(e.pointerId)},onPointerMove:e=>{t_.current&&(tj.current=Math.min(520,Math.max(240,e.clientX)),null===tN.current&&(tN.current=window.requestAnimationFrame(()=>{tN.current=null,tC.current?.style.setProperty("--sidebar-width",`${tj.current}px`)})))},onPointerUp:e=>{t_.current=!1,O(tj.current),e.currentTarget.releasePointerCapture(e.pointerId)},onPointerCancel:()=>{t_.current=!1,O(tj.current)}}),(0,A.jsxs)("section",{className:`thread-workspace panes-${Y}`,children:[(0,A.jsx)("div",{className:"thread-view-controls","aria-label":"Thread layout",children:[1,2].map(e=>(0,A.jsx)("button",{className:Y===e?"selected":"",type:"button",onClick:()=>Z(e),children:e},e))}),(0,A.jsx)("div",{className:"thread-grid",ref:tA,style:{"--thread-left-width":Pp(t=I),"--thread-right-width":Pp(1-t)},children:tF.map((e,t)=>{let n=e?b[e]??null:null,r=!!(e&&eq[t]===e&&!n);return(0,A.jsxs)(T.Fragment,{children:[2===Y&&1===t&&(0,A.jsx)("div",{className:"thread-split-resizer",role:"separator","aria-label":"Resize thread panes","aria-orientation":"vertical",onPointerDown:e=>{tS.current=!0,tD.current=tP.current,e.currentTarget.setPointerCapture(e.pointerId)},onPointerMove:e=>{if(!tS.current)return;let t=function(e){let t=tA.current?.getBoundingClientRect();if(!t||t.width<=8)return null;let n=t.width-8;return Mh((e-t.left)/n,.25,.75,.5)}(e.clientX);null!==t&&(tD.current=t,null===tM.current&&(tM.current=window.requestAnimationFrame(()=>{tM.current=null,Pf(tA.current,tD.current)})))},onPointerUp:e=>{tS.current=!1,F(tD.current),e.currentTarget.releasePointerCapture(e.pointerId)},onPointerCancel:()=>{tS.current=!1,F(tD.current)}}),(0,A.jsx)(Pg,{activeTurnId:n&&(Mf(n)||eb[n.id])||null,archiveLabel:z?"Unarchive":"Archive",composerCollapsed:Q,isActive:t===k,isLoading:r,onActivatePane:tU,onArchiveThread:tV,onComposerCollapsedChange:ee,onForkThread:tW,onInterruptThread:tH,onRenameThread:tK,onError:tZ,onOpenFile:tq,onOpenSettings:t0,onReferenceFile:tJ,onReferenceSkill:tY,onSendMessage:tG,paneIndex:t,thread:n,tokenUsage:e?ek[e]??null:null})]},t)})})]})]}),Object.keys(eY).length>0&&(0,A.jsx)(Py,{permissionPolicy:n?.permissionPolicy,requests:Object.values(eY),respondingIds:eZ,onRespond:tQ,onUpgradePermissions:nx}),ep&&(0,A.jsx)(PW,{title:"New Thread",settings:eh,permissionPolicy:n?.permissionPolicy,onClose:()=>em(!1),onSubmit:nR,includePrompt:!0}),eg&&(0,A.jsx)(PW,{title:"Settings",settings:eh,permissionPolicy:n?.permissionPolicy,onClose:()=>ey(!1),onSubmit:({settings:e})=>{ef(e),ey(!1)}}),ev&&(0,A.jsx)(Px,{activeThread:tB,mcpLoading:e6,mcpServers:e3,rateLimits:eS,status:c,onClose:()=>ex(!1),onRecover:t4,onRefreshMcp:nm,onLoginMcpServer:tX,statusRefreshing:ec,onRefresh:t6,onSaveMcpServer:ng}),eM&&(0,A.jsx)(j9,{explorer:eO,loading:eB,onBrowse:e=>void ns(eO?.cwd||nt(),e),onClose:ni,onOpenFile:no,onRefresh:()=>eO?void ns(eO.cwd,eO.path,!0):void ns(nt(),null,!0),title:"reference"===eR?"Reference file":"Files"}),eU&&(0,A.jsx)(P1,{loading:eK,onClose:nu,onRefresh:()=>void nc(!0),onSelect:function(e){td.current?.(e),nu()},skills:eW}),eT&&(0,A.jsx)(Pe,{file:eT.file,reference:eT.reference,onClose:()=>eN(null)}),ej&&(0,A.jsx)(j7,{reference:ej,onClose:()=>{tu.current+=1,eP(null)}}),et&&(0,A.jsxs)("div",{className:`toast ${et.tone}`,children:[(0,A.jsx)("span",{children:et.message}),et.actionLabel&&et.onAction&&(0,A.jsx)("button",{type:"button",onClick:et.onAction,children:et.actionLabel})]})]});async function t1(e){e.preventDefault(),u("");try{let e=await w1(s);a(""),t5(e)}catch(e){u(M$(e))}}async function t2(){await w2().catch(()=>void 0),e9.current?.close(),t5(await w0().catch(()=>({authenticated:!1,mode:"password"})))}function t5(e){r(e),o(e.authenticated);let t=e.permissionPolicy;t&&ef(e=>({...e,approvalPolicy:t.locked?t.defaultApprovalPolicy:t.allowedApprovalPolicies.includes(e.approvalPolicy)?e.approvalPolicy:t.defaultApprovalPolicy,sandbox:t.locked?t.defaultSandbox:t.allowedSandboxes.includes(e.sandbox)?e.sandbox:t.defaultSandbox}))}async function t3(){try{d(await w3()),nJ("App server reconnected"),await nd()}catch(e){nJ(e)}}async function t4(){try{let e=await w4();d(e.status),nJ(e.output||"App server recovered"),await nd()}catch(e){nJ(e)}}async function t6(){ed(!0);try{d(await w5()),await nh()}catch(e){nJ(e)}finally{ed(!1)}}async function t8(){await nd(),ea(!1)}async function t9(){await nd(),eu(!1)}async function t7(){let e=e2.active&&e2.distance>=54;if(tk.current=null,!e)return void e5({active:!1,distance:0,refreshing:!1});e5({active:!0,distance:64,refreshing:!0});try{await ne()}finally{window.setTimeout(()=>e5({active:!1,distance:0,refreshing:!1}),220)}}async function ne(){await Promise.all([t6(),nd(),tz?nA(tz,tp.current):Promise.resolve(null)])}function nt(){return tB?.cwd||eh.cwd||c.cwd||""}async function nn(){eL("view"),tc.current=null,eD(!0),await ns(nt())}async function nr(e){tc.current=e,eL("reference"),eD(!0),await ns(nt())}function ni(){tc.current=null,eL("view"),eD(!1)}async function no(e){if(!eO)return;let t=tc.current;if("reference"===eR&&t){t(e,eO),ni();return}await na({path:e.path,cwd:eO.cwd,label:e.name})}async function ns(e,t,n=!1){let r=`${e}
|
|
11
|
-
${t||""}`,i=eF[r];if(i&&!n){tl.current+=1,eI(i),e$(!1);return}let o=++tl.current;e$(!0);try{let n=await
|
|
12
|
-
${t.path}`),r=eE[n];if(r)return(eP(null),r.previewable)?void eN({reference:e,file:r}):void await
|
|
13
|
-
${e}`,r=Date.now(),i=e7.current.get(t)??0,e7.current.set(t,r),r-i>2e4&&
|
|
10
|
+
${t.source}`.toLowerCase().includes(e)):i},[o,i]);return(0,A.jsx)("div",{className:"modal-backdrop",children:(0,A.jsxs)("section",{className:"modal skill-selector-modal",role:"dialog","aria-modal":"true","aria-labelledby":"skill-selector-title",children:[(0,A.jsxs)("header",{className:"modal-header",children:[(0,A.jsxs)("div",{className:"file-viewer-title",children:[(0,A.jsx)("h2",{id:"skill-selector-title",children:"Reference skill"}),(0,A.jsx)("p",{className:"muted",children:i.length?`${i.length} skills available`:"Loading skills"})]}),(0,A.jsx)("button",{className:"icon-button",type:"button",onClick:t,title:"Close","aria-label":"Close",children:(0,A.jsx)(eu,{size:16})})]}),(0,A.jsxs)("div",{className:"file-explorer-toolbar",children:[(0,A.jsxs)("label",{className:"file-search-field",children:[(0,A.jsx)(eo,{size:15}),(0,A.jsx)("input",{value:o,onChange:e=>s(e.target.value),placeholder:"Filter skills",autoFocus:!0})]}),(0,A.jsx)("button",{className:"icon-button",type:"button",onClick:n,disabled:e,title:"Refresh skills","aria-label":"Refresh skills",children:(0,A.jsx)(er,{size:16,className:e?"spin-icon":""})})]}),(0,A.jsx)("div",{className:`skill-selector-list ${e?"loading":""}`,children:e&&!i.length?(0,A.jsx)(wu,{as:"span",className:"muted empty-pad",duration:1.4,children:"Loading skills"}):0===a.length?(0,A.jsx)("p",{className:"muted empty-pad",children:"No skills found."}):a.map(e=>(0,A.jsxs)("button",{className:"skill-selector-row",type:"button",onClick:()=>r(e),children:[(0,A.jsxs)("strong",{children:["$",e.name]}),e.description&&(0,A.jsx)("span",{children:e.description}),(0,A.jsx)("small",{children:e.source})]},`${e.source}:${e.name}:${e.path}`))})]})})}function P1({action:e,notice:t,pendingQueued:n}){return e?(0,A.jsxs)("div",{className:"composer-input-status busy",children:[(0,A.jsx)("span",{className:"spinner"}),(0,A.jsx)("span",{children:"steer"===e?"Sending steer input":n?"Enqueuing input":"Sending input"})]}):t?(0,A.jsxs)("div",{className:`composer-input-status ${"steer"===t.action?"steer":"queued"}`,children:[(0,A.jsx)("span",{className:"status-dot"}),(0,A.jsx)("span",{children:"steer"===t.action?"Steer sent":t.queued?"Input enqueued":"Input sent"})]}):null}function P2({usage:e}){var t,n;let r=e?.last??e?.total??null;return(0,A.jsxs)(dP,{maxTokens:e?.modelContextWindow??null,usedTokens:r?.totalTokens??null,usage:(t=r)?{cachedTokens:t.cachedInputTokens,inputTokens:t.inputTokens,outputTokens:t.outputTokens,reasoningTokens:t.reasoningOutputTokens,totalTokens:t.totalTokens}:null,children:[(0,A.jsx)(dM,{className:"context-trigger"}),(0,A.jsxs)(dD,{children:[(0,A.jsx)(dR,{}),(0,A.jsxs)(dL,{children:[(0,A.jsx)(dI,{}),(0,A.jsx)(dF,{}),(0,A.jsx)(dz,{}),(0,A.jsx)(dB,{})]}),(0,A.jsxs)(dO,{children:["Total used: ","number"==typeof(n=e?.total.totalTokens??null)&&Number.isFinite(n)?new Intl.NumberFormat(void 0,{maximumFractionDigits:+(n>=1e3),notation:"compact"}).format(n):"n/a"]})]})]})}function P5(e,t){return`[${(e||Mi(t)).replace(/([\\[\]])/g,"\\$1")}](${encodeURI(t)})`}function P3(e){return String(e)}function P4(e){let t=Mk(e.params);return"string"==typeof t.threadId?t.threadId:MF(t.thread)}function P6(e){return!!(e?.unsafePermissions&&!e.locked&&e.allowedApprovalPolicies.includes("never")&&e.allowedSandboxes.includes("danger-full-access"))}function P8(e,t){return P7(e).some(e=>e===t)}function P9(e){let t=P7(e).find(e=>{var t;return!!((t=e)&&"object"==typeof t&&!Array.isArray(t)&&"acceptWithExecpolicyAmendment"in t)});if(t)return t;let n=Mk(e.params),r=Array.isArray(n.proposedExecpolicyAmendment)?n.proposedExecpolicyAmendment:null;return r?{acceptWithExecpolicyAmendment:{execpolicy_amendment:r.filter(MO)}}:null}function P7(e){let t=Mk(e.params);return Array.isArray(t.availableDecisions)?t.availableDecisions.filter(MO):[]}function Me(e){return e.name||e.preview||e.id}function Mt(e){return Mr(e.trim().replace(/[.,;:!?]+$/g,""))}function Mn(e){return!(!e||e.includes("://")||e.startsWith("@"))&&/\.(?:json|md|markdown|mdx|py|tsx?|jsx?|css|scss|html|yaml|yml|toml|txt|log|csv|rs|go|java|kt|swift|c|h|cpp|hpp|cs|rb|php|sh|bash|zsh|fish|sql|xml|vue|svelte|png|jpe?g|gif|webp|bmp|avif|svg|pdf|mp4|m4v|webm|mov|ogv|ogg|avi|mkv|3gp|docx?|xlsx?|pptx?)$/i.test(Mr(e))}function Mr(e){return e.replace(/:\d+(?::\d+)?$/,"")}function Mi(e){let t=Mr(e);return t.split(/[\\/]/).filter(Boolean).at(-1)||t}function Mo(){return window.matchMedia("(max-width: 780px)").matches}function Ms(e){let t=Mk(e),n="string"==typeof t.id&&t.id?t.id:Ml(),r="string"==typeof t.text?t.text:"",i=MI(t.savedAt)??Date.now();return r.trim()?{id:n,savedAt:i,text:r}:null}function Ma(e){let t=e.replace(/\s+/g," ").trim();return t?t.length>96?`${t.slice(0,95)}...`:t:"Empty draft"}function Ml(){return"u">typeof crypto&&"function"==typeof crypto.randomUUID?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`}function Mu(e){try{window.localStorage.setItem(Pl,JSON.stringify(e))}catch{}}function Mc(e){let t=e.threadPaneCount??1,n=e.openThreadIds??[];return Array.from({length:t},(e,t)=>n[t]??null)}function Md(e,t,n,r){return"number"==typeof e&&Number.isFinite(e)?Math.min(n,Math.max(t,e)):r}function Mh(e){let t=[...e.turns??[]].reverse().find(e=>Mf(e.status));return t?.id??null}function Mf(e){let t=String(e??"").toLowerCase().replace(/[_\s-]+/g,"");return"inprogress"===t||"active"===t||"running"===t}function Mp(e){let t=String(e??"").toLowerCase().replace(/[_\s-]+/g,"");return"idle"===t||"completed"===t||"complete"===t||"finished"===t}function Mm(e){for(let t=(e.turns?.length??0)-1;t>=0;t-=1){let n=e.turns?.[t];for(let e=(n?.items?.length??0)-1;e>=0;e-=1){let t=n?.items?.[e];if(t&&Mg(t))return!0}}return!1}function Mg(e){let t=Mk(e),n=String(t.type??"").toLowerCase(),r=String(t.phase??t.kind??t.category??"").toLowerCase().replace(/[_\s-]+/g,""),i=String(t.role??"").toLowerCase();return("agentmessage"===n||"assistant"===i)&&("finalanswer"===r||"final"===r||"finalresponse"===r)}function My(e){return Array.isArray(e)?e.map(e=>{let t=Mk(e);return"text"===t.type?String(t.text??""):"image"===t.type?`[image] ${String(t.url??"")}`:"localImage"===t.type?`[local image] ${String(t.path??"")}`:"skill"===t.type||"mention"===t.type?`[${String(t.type)}] ${String(t.name??"")}: ${String(t.path??"")}`:JSON.stringify(t)}).join("\n"):""}function Mv(e){return Array.isArray(e)?e.map(e=>Mk(e).command).filter(Boolean).join(" | "):""}function Mx(e){return({userMessage:"User",agentMessage:"Codex",commandExecution:"Command",fileChange:"Files",mcpToolCall:"MCP",dynamicToolCall:"Tool",collabAgentToolCall:"Agent",webSearch:"Search",imageView:"Image",imageGeneration:"Image",logEntry:"Log",reasoning:"Reasoning",reasoningGroup:"Reasoning",commandGroup:"Commands",plan:"Plan"})[e]||e}function Mb(e){return"userMessage"===e?"user":"agentMessage"===e||"reasoning"===e||"reasoningGroup"===e||"plan"===e?"agent":"commandExecution"===e||"commandGroup"===e?"command":"tool"}function Mw(e){return Object.fromEntries(Object.entries(e).filter(([,e])=>""!==e&&null!=e))}function Mk(e){return e&&"object"==typeof e&&!Array.isArray(e)?e:{}}function M_(e){let t=Mk(e);return MS(Mk(t.rateLimitsByLimitId)[Po])??MS(t.rateLimits)}function MS(e){let t=Mk(e),n=MC(t.primary),r=MC(t.secondary);return n||r?{limitId:"string"==typeof t.limitId?t.limitId:null,limitName:"string"==typeof t.limitName?t.limitName:null,primary:n,secondary:r}:null}function MC(e){let t=Mk(e),n=MI(t.usedPercent);return null===n?null:{usedPercent:n,windowDurationMins:"number"==typeof t.windowDurationMins?t.windowDurationMins:null,resetsAt:"number"==typeof t.resetsAt?t.resetsAt:null}}function ME(e){var t;if(!e)return null;let n=Mk(e),r=MA(n);if(r)return r;let i=[],o=[];for(let t of e.turns??[]){let e=Mk(t),n=MA(e);n&&o.push(n);let r=MM(e.tokenUsage??e.token_usage??e.usage);for(let e of(r&&i.push(r),t.items??[])){let t=Mk(e),n=MA(t);n&&o.push(n);let r=MM(t.tokenUsage??t.token_usage??t.usage);r&&i.push(r)}}let s=o.at(-1);if(s)return s;let a=(t=i).length?t.reduce((e,t)=>({totalTokens:e.totalTokens+t.totalTokens,inputTokens:e.inputTokens+t.inputTokens,cachedInputTokens:e.cachedInputTokens+t.cachedInputTokens,outputTokens:e.outputTokens+t.outputTokens,reasoningOutputTokens:e.reasoningOutputTokens+t.reasoningOutputTokens}),MD()):null,l=MR(n,["modelContextWindow","model_context_window","contextWindow","context_window","maxTokens","max_tokens"]);return a||null!==l?{total:a??MD(),last:i.at(-1)??MD(),modelContextWindow:l}:null}function MA(e){return MT(e.tokenUsage)??MT(e.token_usage)??MT(e.tokenCount)??MT(e.token_count)??MT(e.contextUsage)??MT(e.context_usage)??MT(e.usage)??MT(e.context)??MT(e.payload)??MT(e.info)??MT(e)}function MT(e){let t=Mk(e),n=Mk(t.info),r=Object.keys(n).length?n:t,i=MM(r.total_token_usage??r.totalTokenUsage??r.total)??MM(e),o=MM(r.last_token_usage??r.lastTokenUsage??r.last)??i,s=MR(r,["modelContextWindow","model_context_window","contextWindow","context_window","maxTokens","max_tokens"]);return i||null!==s?{total:i??MD(),last:o??MD(),modelContextWindow:s}:null}function MN(e,t){if(!e)return t;if(!t)return e;let n=Math.max(e.total.totalTokens,e.last.totalTokens),r=Math.max(t.total.totalTokens,t.last.totalTokens);return 0===n&&r>0?{total:t.total,last:t.last,modelContextWindow:e.modelContextWindow??t.modelContextWindow}:null===e.modelContextWindow&&null!==t.modelContextWindow?{...e,modelContextWindow:t.modelContextWindow}:e}function Mj(e){return!!e&&Math.max(e.total.totalTokens,e.last.totalTokens)>0}function MP(e,t){return e.totalTokens===t.totalTokens&&e.inputTokens===t.inputTokens&&e.cachedInputTokens===t.cachedInputTokens&&e.outputTokens===t.outputTokens&&e.reasoningOutputTokens===t.reasoningOutputTokens}function MM(e){let t=Mk(e),n=Mk(t.prompt_tokens_details??t.promptTokensDetails??t.inputTokensDetails??t.input_tokens_details),r=Mk(t.completion_tokens_details??t.completionTokensDetails??t.outputTokensDetails??t.output_tokens_details),i=MR(t,["inputTokens","input_tokens","promptTokens","prompt_tokens","input"]),o=MR(t,["cachedInputTokens","cached_input_tokens","cachedTokens","cached_tokens","cached"])??MR(n,["cachedTokens","cached_tokens"]),s=MR(t,["outputTokens","output_tokens","completionTokens","completion_tokens","output"]),a=MR(t,["reasoningOutputTokens","reasoning_output_tokens","reasoningTokens","reasoning_tokens","reasoning"])??MR(r,["reasoningTokens","reasoning_tokens"]),l=MR(t,["totalTokens","total_tokens","total"])??function(...e){let t=e.filter(e=>null!==e);return t.length?t.reduce((e,t)=>e+t,0):null}(i,s);return[l,i,o,s,a].every(e=>null===e)?null:{totalTokens:l??0,inputTokens:i??0,cachedInputTokens:o??0,outputTokens:s??0,reasoningOutputTokens:a??0}}function MD(){return{totalTokens:0,inputTokens:0,cachedInputTokens:0,outputTokens:0,reasoningOutputTokens:0}}function MR(e,t){for(let n of t){let t=MI(e[n]);if(null!==t)return t}return null}function ML(e,t){if(!e)return null;let n=[e.primary,e.secondary].filter(e=>!!e),r="5hr"===t?300:10080,i=n.find(e=>null!==e.windowDurationMins&&30>=Math.abs(e.windowDurationMins-r)),o=i?.usedPercent??("5hr"===t?e.primary?.usedPercent??null:e.secondary?.usedPercent??null);return null===o?null:Math.max(0,Math.min(100,100-o))}function MO(e){return null===e||["boolean","number","string"].includes(typeof e)?"number"!=typeof e||Number.isFinite(e):Array.isArray(e)?e.every(MO):"object"==typeof e&&Object.values(e).every(MO)}function MI(e){return"number"==typeof e&&Number.isFinite(e)?e:null}function MF(e){let t=Mk(e);return"string"==typeof t.id?t.id:""}function Mz(e){return e?new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}).format(new Date(e>1e10?e:1e3*e)):""}function MB(e){return e instanceof Error?e.message:String(e)}function M$(e){return/insecure protocol|https|http is only allowed/i.test(e)?"open the Web UI through HTTPS, then try login again":/invalid_grant/i.test(e)?"the OAuth callback was already used or expired; try logging in again":/timed out/i.test(e)?"the OAuth callback was not received in time; try logging in again":e}e.s(["default",0,function({initialThreadId:e=null}){var t;let[n,r]=(0,T.useState)(null),[i,o]=(0,T.useState)(null),[s,a]=(0,T.useState)(""),[l,u]=(0,T.useState)(""),[c,d]=(0,T.useState)({state:"stopped"}),[h,f]=(0,T.useState)([]),[p,m]=(0,T.useState)(new Set),[g,y]=(0,T.useState)(null),[v,x]=(0,T.useState)(()=>Mc(Pc)),[b,w]=(0,T.useState)({}),[k,_]=(0,T.useState)(()=>{var e;return Md((e=Pc).activePaneIndex,0,(e.threadPaneCount??1)-1,0)}),[S,C]=(0,T.useState)({}),[E,N]=(0,T.useState)(1),[j,P]=(0,T.useState)(!1),[M,D]=(0,T.useState)(!1),[L,O]=(0,T.useState)(()=>Md(Pc.sidebarWidth,240,520,330)),[I,F]=(0,T.useState)(()=>Md(Pc.threadSplitRatio,.25,.75,.5)),[z,B]=(0,T.useState)(()=>Pc.showArchived??!1),[$,V]=(0,T.useState)(()=>Pc.recentOnly??!1),[W,H]=(0,T.useState)(""),[K,J]=(0,T.useState)(()=>Pc.mobilePane??"sessions"),[Y,Z]=(0,T.useState)(()=>Pc.threadPaneCount??1),[Q,ee]=(0,T.useState)(()=>Pc.composerCollapsed??!1),[et,en]=(0,T.useState)(null),[ei,eo]=(0,T.useState)(!1),[es,ea]=(0,T.useState)(!1),[el,eu]=(0,T.useState)(!1),[ec,ed]=(0,T.useState)(!1),[eh,ef]=(0,T.useState)({...Pn}),[ep,em]=(0,T.useState)(!1),[eg,ey]=(0,T.useState)(!1),[ev,ex]=(0,T.useState)(!1),[eb,ew]=(0,T.useState)({}),[ek,e_]=(0,T.useState)({}),[eS,eC]=(0,T.useState)(null),[eE,eA]=(0,T.useState)({}),[eT,eN]=(0,T.useState)(null),[ej,eP]=(0,T.useState)(null),[eM,eD]=(0,T.useState)(!1),[eR,eL]=(0,T.useState)("view"),[eO,eI]=(0,T.useState)(null),[eF,ez]=(0,T.useState)({}),[eB,e$]=(0,T.useState)(!1),[eU,eV]=(0,T.useState)(!1),[eW,eH]=(0,T.useState)([]),[eK,eG]=(0,T.useState)(!1),[eq,eJ]=(0,T.useState)({}),[eY,eX]=(0,T.useState)({}),[eZ,eQ]=(0,T.useState)(new Set),[e0,e1]=(0,T.useState)(()=>(function(){try{let e=Mk(JSON.parse(window.localStorage.getItem(Pl)||"{}"));return Object.fromEntries(Object.entries(e).map(([e,t])=>{var n;let r,i,o;return[e,(n=t,r=Mk(n),i="string"==typeof r.approvalPolicy?r.approvalPolicy:"",o="string"==typeof r.sandbox?r.sandbox:"",i&&o?{approvalPolicy:i,sandbox:o}:null)]}).filter(e=>!!e[1]))}catch{return{}}})()),[e2,e5]=(0,T.useState)({active:!1,distance:0,refreshing:!1}),[e3,e4]=(0,T.useState)(null),[e6,e8]=(0,T.useState)(!1),e9=(0,T.useRef)(null),e7=(0,T.useRef)(new Map),te=(0,T.useRef)(new Map),tt=(0,T.useRef)(new Set),tn=(0,T.useRef)(new Map),tr=(0,T.useRef)(new Set),ti=(0,T.useRef)(new Set),to=(0,T.useRef)(null),ts=(0,T.useRef)(0),ta=(0,T.useRef)(0),tl=(0,T.useRef)(0),tu=(0,T.useRef)(0),tc=(0,T.useRef)(null),td=(0,T.useRef)(null),th=(0,T.useRef)({}),tf=(0,T.useRef)(null),tp=(0,T.useRef)(k),tm=(0,T.useRef)({}),tg=(0,T.useRef)(v),ty=(0,T.useRef)({}),tv=(0,T.useRef)({}),tx=(0,T.useRef)(e0),tb=(0,T.useRef)(!1),tw=(0,T.useRef)(null),tk=(0,T.useRef)(null),t_=(0,T.useRef)(!1),tS=(0,T.useRef)(!1),tC=(0,T.useRef)(null),tE=(0,T.useRef)(null),tA=(0,T.useRef)(null),tT=(0,T.useRef)(L),tN=(0,T.useRef)(null),tj=(0,T.useRef)(L),tP=(0,T.useRef)(I),tM=(0,T.useRef)(null),tD=(0,T.useRef)(I),tR=(0,T.useRef)(null);(0,T.useEffect)(()=>{if(ei||es||el)return window.addEventListener("pointerdown",e),()=>window.removeEventListener("pointerdown",e);function e(e){let t=e.target;t instanceof Element&&t.closest("[data-menu-root]")||(eo(!1),ea(!1),eu(!1))}},[es,el,ei]),(0,T.useEffect)(()=>{ty.current=b},[b]),(0,T.useEffect)(()=>{tm.current=eb},[eb]),(0,T.useEffect)(()=>{tx.current=e0,Mu(e0)},[e0]),(0,T.useEffect)(()=>()=>{for(let e of te.current.values())window.clearTimeout(e);te.current.clear(),to.current&&window.clearTimeout(to.current),tR.current&&window.clearTimeout(tR.current),tN.current&&window.cancelAnimationFrame(tN.current),tM.current&&window.cancelAnimationFrame(tM.current)},[]),(0,T.useEffect)(()=>{w0().then(t5).catch(()=>o(!1))},[]),(0,T.useEffect)(()=>{function e(){e9.current?.close(),r(null),o(!1),u("Session expired. Sign in again.")}return window.addEventListener(wQ,e),()=>window.removeEventListener(wQ,e)},[]),(0,T.useEffect)(()=>{var e,t;let n,r;if(!i)return;w5().then(d).catch(nq),nc(),function(){if(tb.current)return;tb.current=!0;let e=tg.current.map((e,t)=>({threadId:e,paneIndex:t})).filter(e=>!!e.threadId);if(0===e.length)return;let t=tg.current[tp.current]??e[0]?.threadId??null;for(let n of(t&&y(t),eJ(t=>{let n={...t};for(let t of e)n[t.paneIndex]=t.threadId;return n}),e)){let e=++ta.current;th.current[n.paneIndex]=e,nE(n.threadId,n.paneIndex,e).finally(()=>{eJ(e=>{if(e[n.paneIndex]!==n.threadId)return e;let t={...e};return delete t[n.paneIndex],t})})}}(),nd(),nh(),e9.current?.close();let o=(e=e=>{nR(e)},t=e=>{for(let t of e)nR(t)},n=new AbortController,r={close:()=>n.abort()},kg(n,r,e,t),r);return o.onerror=()=>d(e=>({...e,state:"disconnected",error:"Event stream disconnected"})),e9.current=o,()=>{o.close()}},[i]),(0,T.useEffect)(()=>{if(!i||!e){tf.current=null;return}if(tf.current===e)return;tf.current=e;let t=tp.current,n=tg.current.indexOf(e);if(n>=0){nw(n),y(e);return}Y>1&&tg.current.some(Boolean)||nC(e,t,!1)},[i,e]),(0,T.useEffect)(()=>{i&&ev&&nf()},[i,ev]),(0,T.useEffect)(()=>{if(!i)return;let e=window.setInterval(()=>{let e=Date.now();for(let n of[...new Set(tg.current.filter(e=>!!e))]){var t;let r=ty.current[n];if(!r||(t=r,!(tm.current[n]||Mh(t)||!Mm(t)&&Mf(PG(t))))||e-(tn.current.get(n)??0)<5e3||tt.current.has(n))continue;let i=tg.current.indexOf(n);i<0||(tt.current.add(n),nE(n,i).finally(()=>tt.current.delete(n)))}},5e3);return()=>window.clearInterval(e)},[i]),(0,T.useEffect)(()=>{let e=window.setTimeout(()=>{i&&nc()},250);return()=>window.clearTimeout(e)},[z,W,E]);let tL=(0,T.useMemo)(()=>[...h].sort((e,t)=>(t.updatedAt??0)-(e.updatedAt??0)),[h]),tO=(0,T.useMemo)(()=>$?function(e){let t=new Map;for(let n of e){let e=n.cwd||"unknown",r=t.get(e);(!r||(n.updatedAt??0)>(r.updatedAt??0))&&t.set(e,n)}return[...t.values()].sort((e,t)=>(t.updatedAt??0)-(e.updatedAt??0))}(tL):tL,[tL,$]),tI=(0,T.useMemo)(()=>(function(e){let t=new Map;for(let n of e){let e=n.cwd||"unknown",r=n.cwd?n.cwd?n.cwd.split(/[\\/]+/).filter(Boolean).at(-1)||n.cwd:Me(n):"No folder",i=t.get(e)??{key:e,label:r,threads:[]};i.threads.push(n),t.set(e,i)}return[...t.values()]})(tO),[tO]),tF=(0,T.useMemo)(()=>Array.from({length:Y},(e,t)=>v[t]??null),[v,Y]),tz=tF[k]??null,tB=tz?b[tz]??null:null,t$=Mo()&&"sessions"===K?"Codex Web UI":tB?Me(tB):"Codex Web UI";(0,T.useEffect)(()=>{if("sessions"!==K||!g)return;let e=window.setTimeout(()=>{let e=[...tE.current?.querySelectorAll("[data-thread-id]")??[]].find(e=>e.dataset.threadId===g);e?.scrollIntoView({block:"center",behavior:"smooth"})},240);return()=>window.clearTimeout(e)},[tI,K,g]);let tU=Pd(e=>nw(e)),tV=Pd((e,t)=>nM(e,t)),tW=Pd((e,t)=>nP(e,t)),tH=Pd(e=>nN(e)),tK=Pd((e,t)=>nj(e,t)),tG=Pd((e,t,n,r)=>nT(e,t,n,r)),tq=Pd(e=>ns(e)),tJ=Pd(e=>nn(e)),tY=Pd(e=>na(e)),tX=Pd(e=>ng(e)),tZ=Pd(e=>nq(e)),tQ=Pd((e,t)=>ny(e,t)),t0=Pd(()=>ey(!0));if((0,T.useEffect)(()=>{let e=Array.from({length:Y},(e,t)=>tg.current[t]??null);tg.current=e,x(e);let t=Math.min(tp.current,Y-1);tp.current=t,_(t)},[Y]),(0,T.useEffect)(()=>{tg.current=v},[v]),(0,T.useEffect)(()=>{tp.current=k},[k]),(0,T.useEffect)(()=>{!function e(t,n){if(n){n.current&&window.clearTimeout(n.current),n.current=window.setTimeout(()=>{n.current=null,e(t)},350);return}try{window.localStorage.setItem(Pa,JSON.stringify({activePaneIndex:Md(t.activePaneIndex,0,(t.threadPaneCount??1)-1,0),composerCollapsed:t.composerCollapsed??!1,mobilePane:t.mobilePane,openThreadIds:Mc(t),recentOnly:t.recentOnly??!1,showArchived:t.showArchived??!1,sidebarWidth:Md(t.sidebarWidth,240,520,330),threadPaneCount:t.threadPaneCount,threadSplitRatio:Md(t.threadSplitRatio,.25,.75,.5)}))}catch{}}({activePaneIndex:k,composerCollapsed:Q,mobilePane:K,openThreadIds:v,recentOnly:$,showArchived:z,sidebarWidth:L,threadPaneCount:Y,threadSplitRatio:I},tR)},[k,Q,K,v,$,z,L,Y,I]),(0,T.useEffect)(()=>{tT.current=L,tj.current=L,tC.current?.style.setProperty("--sidebar-width",`${L}px`)},[L]),(0,T.useEffect)(()=>{tP.current=I,tD.current=I,Ph(tA.current,I)},[I]),null===i)return(0,A.jsx)("div",{className:"boot",children:"Loading"});if(!i)return(0,A.jsx)("main",{className:"login-screen",children:(0,A.jsxs)("form",{className:"login-panel",onSubmit:t1,children:[(0,A.jsxs)("div",{children:[(0,A.jsx)("p",{className:"eyebrow",children:"Remote control"}),(0,A.jsx)("h1",{children:"Codex Web UI"})]}),(0,A.jsxs)("label",{className:"field",children:[(0,A.jsx)("span",{children:"Password"}),(0,A.jsx)("input",{value:s,onChange:e=>a(e.target.value),type:"password",autoFocus:!0})]}),(0,A.jsx)("button",{className:"primary-button",type:"submit",children:"Sign in"}),(0,A.jsx)("p",{className:"error-text",children:l})]})});return(0,A.jsxs)("main",{className:`app-shell ${n?.warning?"auth-warning-mode":""}`,children:[(0,A.jsxs)("header",{className:"topbar",onTouchStart:function(e){if(!Mo())return;let t=e.touches[0];tk.current=t?{x:t.clientX,y:t.clientY}:null},onTouchMove:function(e){let t=tk.current,n=e.touches[0];if(!t||!n||e2.refreshing)return;let r=n.clientY-t.y,i=n.clientX-t.x;r<=4||Math.abs(i)>Math.max(32,.8*r)||(e.preventDefault(),e5({active:!0,distance:Math.min(96,.72*r),refreshing:!1}))},onTouchEnd:()=>void t9(),onTouchCancel:function(){tk.current=null,e2.refreshing||e5({active:!1,distance:0,refreshing:!1})},children:[(0,A.jsxs)("div",{className:"brand-block",children:[(0,A.jsx)("div",{className:"mark","aria-hidden":"true",children:(0,A.jsx)("img",{src:"/icon.svg",alt:""})}),(0,A.jsxs)("div",{children:[(0,A.jsx)("strong",{title:t$,children:t$}),n?.warning&&(0,A.jsx)("span",{className:"auth-warning-text",children:n.warning})]})]}),(0,A.jsxs)("div",{className:"top-actions",children:[(0,A.jsxs)("button",{className:`status-button ${"disconnected"===c.state?"disconnected":""}`,type:"button",onClick:()=>ex(!0),title:"Show app server status","aria-label":"Show app server status",children:[(0,A.jsx)(R,{size:16}),(0,A.jsx)("span",{className:"top-action-label",children:"Status"}),(0,A.jsx)(PK,{value:c.state})]}),(0,A.jsxs)("div",{className:"action-overflow","data-menu-root":!0,children:[(0,A.jsx)("button",{className:"ghost-button",type:"button",onClick:()=>eo(e=>!e),title:"More actions","aria-label":"More actions","aria-expanded":ei,children:(0,A.jsx)(X,{size:18})}),ei&&(0,A.jsxs)("div",{className:"action-overflow-menu top-overflow-menu",role:"menu",children:[(0,A.jsxs)("button",{type:"button",role:"menuitem",onClick:()=>{eo(!1),nt()},children:[(0,A.jsx)(U,{size:16})," Files"]}),(0,A.jsxs)("button",{type:"button",role:"menuitem",onClick:()=>{eo(!1),t3()},children:[(0,A.jsx)(er,{size:16})," Reconnect"]}),(0,A.jsxs)("button",{type:"button",role:"menuitem",onClick:()=>{eo(!1),t2()},children:[(0,A.jsx)(G,{size:16})," Logout"]})]})]})]})]}),(0,A.jsxs)("nav",{className:"mobile-pane-tabs","aria-label":"Panes",children:[(0,A.jsx)("button",{"aria-pressed":"sessions"===K,className:`mobile-threads-pill ${"sessions"===K?"selected":""}`,type:"button",onClick:()=>J("sessions"),children:"Threads"}),(0,A.jsxs)("div",{className:"mobile-nav-actions",children:[(0,A.jsx)("button",{className:"ghost-button",type:"button",onClick:()=>em(!0),title:"New thread","aria-label":"New thread",children:(0,A.jsx)(q,{size:17})}),(0,A.jsx)("button",{className:`status-button ${"disconnected"===c.state?"disconnected":""}`,type:"button",onClick:()=>ex(!0),title:"Show app server status","aria-label":"Show app server status",children:(0,A.jsx)(R,{size:17})}),(0,A.jsxs)("div",{className:"action-overflow","data-menu-root":!0,children:[(0,A.jsx)("button",{className:"ghost-button",type:"button",onClick:()=>ea(e=>!e),title:"More actions","aria-label":"More actions","aria-expanded":es,children:(0,A.jsx)(X,{size:18})}),es&&(0,A.jsxs)("div",{className:"action-overflow-menu mobile-overflow-menu",role:"menu",children:[(0,A.jsxs)("label",{className:"menu-check-item",children:[(0,A.jsx)("input",{type:"checkbox",checked:$,onChange:e=>{V(e.target.checked)}}),(0,A.jsx)("span",{children:"Recent"})]}),(0,A.jsxs)("label",{className:"menu-check-item",children:[(0,A.jsx)("input",{type:"checkbox",checked:z,onChange:e=>{B(e.target.checked),N(1)}}),(0,A.jsx)("span",{children:"Archived"})]}),(0,A.jsxs)("button",{type:"button",role:"menuitem",disabled:M,onClick:()=>void t6(),children:[(0,A.jsx)(er,{size:16,className:M?"spin-icon":""})," Refresh"]}),(0,A.jsxs)("button",{type:"button",role:"menuitem",onClick:()=>{ea(!1),nt()},children:[(0,A.jsx)(U,{size:16})," Files"]}),(0,A.jsxs)("button",{type:"button",role:"menuitem",onClick:()=>{ea(!1),t3()},children:[(0,A.jsx)(er,{size:16})," Reconnect"]}),(0,A.jsxs)("button",{type:"button",role:"menuitem",onClick:()=>{ea(!1),t2()},children:[(0,A.jsx)(G,{size:16})," Logout"]})]})]})]})]}),(0,A.jsx)("div",{className:`pull-refresh-indicator ${e2.active||e2.refreshing?"visible":""} ${e2.refreshing?"refreshing":""}`,style:{"--pull-distance":`${Math.min(72,e2.distance)}px`},"aria-hidden":"true",children:(0,A.jsx)(er,{size:18})}),(0,A.jsxs)("section",{ref:tC,style:{"--sidebar-width":`${L}px`},className:`layout mobile-pane-${K}`,onTouchStart:e=>{let t=e.touches[0];tw.current=t?{x:t.clientX,y:t.clientY,paneSwipeBlocked:function(e,t){if(!(e instanceof Element))return!1;for(let r=e;r&&r!==t;r=r.parentElement){var n;if(n=r,["auto","scroll","overlay"].includes(window.getComputedStyle(n).overflowX)&&n.scrollWidth>n.clientWidth+1)return!0}return!1}(e.target,e.currentTarget),refreshEligible:function(e,t){if(!(e instanceof Element))return window.scrollY<=1;for(let r=e;r&&r!==t;r=r.parentElement){var n;if(n=r,["auto","scroll","overlay"].includes(window.getComputedStyle(n).overflowY)&&n.scrollHeight>n.clientHeight+1)return r.scrollTop<=1}return window.scrollY<=1}(e.target,e.currentTarget)}:null},onTouchEnd:e=>{var t;let n=tw.current,r=e.changedTouches[0];if(tw.current=null,!n||!r||n.paneSwipeBlocked)return;let i=r.clientX-n.x,o=r.clientY-n.y;n.refreshEligible&&o>110&&Math.abs(o)>1.25*Math.abs(i)?window.location.reload():70>Math.abs(i)||Math.abs(i)<1.3*Math.abs(o)||(t=i<0?1:-1,J(e=>{let n=Pu.indexOf(e),r=Math.min(Pu.length-1,Math.max(0,n+t));return Pu[r]??e}))},children:[(0,A.jsxs)("aside",{className:"sessions-panel",children:[(0,A.jsxs)("div",{className:"panel-heading",children:[(0,A.jsx)("div",{children:(0,A.jsx)("h2",{children:"Threads"})}),(0,A.jsxs)("div",{className:"panel-actions",children:[(0,A.jsx)("button",{className:"icon-button",type:"button",onClick:()=>em(!0),title:"New thread","aria-label":"New thread",children:(0,A.jsx)(q,{size:18})}),(0,A.jsxs)("div",{className:"action-overflow thread-actions-overflow","data-menu-root":!0,children:[(0,A.jsx)("button",{className:"icon-button",type:"button",onClick:()=>eu(e=>!e),title:"Thread list actions","aria-label":"Thread list actions","aria-expanded":el,children:(0,A.jsx)(X,{size:18})}),el&&(0,A.jsxs)("div",{className:"action-overflow-menu thread-actions-menu",role:"menu",children:[(0,A.jsxs)("label",{className:"menu-check-item",children:[(0,A.jsx)("input",{type:"checkbox",checked:$,onChange:e=>{V(e.target.checked)}}),(0,A.jsx)("span",{children:"Recent"})]}),(0,A.jsxs)("label",{className:"menu-check-item",children:[(0,A.jsx)("input",{type:"checkbox",checked:z,onChange:e=>{B(e.target.checked),N(1)}}),(0,A.jsx)("span",{children:"Archived"})]}),(0,A.jsxs)("button",{type:"button",role:"menuitem",disabled:M,onClick:()=>void t8(),children:[(0,A.jsx)(er,{size:16,className:M?"spin-icon":""})," Refresh"]})]})]})]})]}),(0,A.jsx)("div",{className:"session-tools",children:(0,A.jsxs)("label",{className:"field",children:[(0,A.jsx)("span",{children:"Search"}),(0,A.jsx)("input",{value:W,onChange:e=>{N(1),H(e.target.value)},placeholder:"Title, preview, cwd"})]})}),(0,A.jsxs)("div",{className:"sessions-list",ref:tE,onScroll:function(e){let t=e.currentTarget;t.scrollHeight-t.scrollTop-t.clientHeight<120&&nx()},children:[0===tL.length?(0,A.jsx)("p",{className:"muted empty-pad",children:"No threads found."}):tI.map(e=>(0,A.jsx)(Pp,{group:e,onRowClick:nb,selectedThreadId:g,sessionPreviews:S},e.key)),j&&(0,A.jsx)("button",{className:"load-more-button",type:"button",onClick:nx,disabled:M,children:M?"Loading":"Load more"})]})]}),(0,A.jsx)("div",{className:"sidebar-resizer",role:"separator","aria-label":"Resize threads sidebar","aria-orientation":"vertical",onPointerDown:e=>{t_.current=!0,tj.current=tT.current,e.currentTarget.setPointerCapture(e.pointerId)},onPointerMove:e=>{t_.current&&(tj.current=Math.min(520,Math.max(240,e.clientX)),null===tN.current&&(tN.current=window.requestAnimationFrame(()=>{tN.current=null,tC.current?.style.setProperty("--sidebar-width",`${tj.current}px`)})))},onPointerUp:e=>{t_.current=!1,O(tj.current),e.currentTarget.releasePointerCapture(e.pointerId)},onPointerCancel:()=>{t_.current=!1,O(tj.current)}}),(0,A.jsxs)("section",{className:`thread-workspace panes-${Y}`,children:[(0,A.jsx)("div",{className:"thread-view-controls","aria-label":"Thread layout",children:[1,2].map(e=>(0,A.jsx)("button",{className:Y===e?"selected":"",type:"button",onClick:()=>Z(e),children:e},e))}),(0,A.jsx)("div",{className:"thread-grid",ref:tA,style:{"--thread-left-width":Pf(t=I),"--thread-right-width":Pf(1-t)},children:tF.map((e,t)=>{let n=e?b[e]??null:null,r=!!(e&&eq[t]===e&&!n);return(0,A.jsxs)(T.Fragment,{children:[2===Y&&1===t&&(0,A.jsx)("div",{className:"thread-split-resizer",role:"separator","aria-label":"Resize thread panes","aria-orientation":"vertical",onPointerDown:e=>{tS.current=!0,tD.current=tP.current,e.currentTarget.setPointerCapture(e.pointerId)},onPointerMove:e=>{if(!tS.current)return;let t=function(e){let t=tA.current?.getBoundingClientRect();if(!t||t.width<=8)return null;let n=t.width-8;return Md((e-t.left)/n,.25,.75,.5)}(e.clientX);null!==t&&(tD.current=t,null===tM.current&&(tM.current=window.requestAnimationFrame(()=>{tM.current=null,Ph(tA.current,tD.current)})))},onPointerUp:e=>{tS.current=!1,F(tD.current),e.currentTarget.releasePointerCapture(e.pointerId)},onPointerCancel:()=>{tS.current=!1,F(tD.current)}}),(0,A.jsx)(Pm,{activeTurnId:n&&(Mh(n)||eb[n.id])||null,archiveLabel:z?"Unarchive":"Archive",composerCollapsed:Q,isActive:t===k,isLoading:r,onActivatePane:tU,onArchiveThread:tV,onComposerCollapsedChange:ee,onForkThread:tW,onInterruptThread:tH,onRenameThread:tK,onError:tZ,onOpenFile:tq,onOpenSettings:t0,onReferenceFile:tJ,onReferenceSkill:tY,onSendMessage:tG,paneIndex:t,thread:n,tokenUsage:e?ek[e]??null:null})]},t)})})]})]}),Object.keys(eY).length>0&&(0,A.jsx)(Pg,{permissionPolicy:n?.permissionPolicy,requests:Object.values(eY),respondingIds:eZ,onRespond:tQ,onUpgradePermissions:nv}),ep&&(0,A.jsx)(PV,{title:"New Thread",settings:eh,permissionPolicy:n?.permissionPolicy,onClose:()=>em(!1),onSubmit:nD,includePrompt:!0}),eg&&(0,A.jsx)(PV,{title:"Settings",settings:eh,permissionPolicy:n?.permissionPolicy,onClose:()=>ey(!1),onSubmit:({settings:e})=>{ef(e),ey(!1)}}),ev&&(0,A.jsx)(Pv,{activeThread:tB,mcpLoading:e6,mcpServers:e3,rateLimits:eS,status:c,onClose:()=>ex(!1),onRefreshMcp:np,onLoginMcpServer:tX,statusRefreshing:ec,onRefresh:t4,onSaveMcpServer:nm}),eM&&(0,A.jsx)(j8,{explorer:eO,loading:eB,onBrowse:e=>void no(eO?.cwd||ne(),e),onClose:nr,onOpenFile:ni,onRefresh:()=>eO?void no(eO.cwd,eO.path,!0):void no(ne(),null,!0),title:"reference"===eR?"Reference file":"Files"}),eU&&(0,A.jsx)(P0,{loading:eK,onClose:nl,onRefresh:()=>void nu(!0),onSelect:function(e){td.current?.(e),nl()},skills:eW}),eT&&(0,A.jsx)(j7,{file:eT.file,reference:eT.reference,onClose:()=>eN(null)}),ej&&(0,A.jsx)(j9,{reference:ej,onClose:()=>{tu.current+=1,eP(null)}}),et&&(0,A.jsxs)("div",{className:`toast ${et.tone}`,children:[(0,A.jsx)("span",{children:et.message}),et.actionLabel&&et.onAction&&(0,A.jsx)("button",{type:"button",onClick:et.onAction,children:et.actionLabel})]})]});async function t1(e){e.preventDefault(),u("");try{let e=await w1(s);a(""),t5(e)}catch(e){u(MB(e))}}async function t2(){await w2().catch(()=>void 0),e9.current?.close(),t5(await w0().catch(()=>({authenticated:!1,mode:"password"})))}function t5(e){r(e),o(e.authenticated);let t=e.permissionPolicy;t&&ef(e=>({...e,approvalPolicy:t.locked?t.defaultApprovalPolicy:t.allowedApprovalPolicies.includes(e.approvalPolicy)?e.approvalPolicy:t.defaultApprovalPolicy,sandbox:t.locked?t.defaultSandbox:t.allowedSandboxes.includes(e.sandbox)?e.sandbox:t.defaultSandbox}))}async function t3(){try{d(await w3()),nq("App server reconnected"),await nc()}catch(e){nq(e)}}async function t4(){ed(!0);try{d(await w5()),await nd()}catch(e){nq(e)}finally{ed(!1)}}async function t6(){await nc(),ea(!1)}async function t8(){await nc(),eu(!1)}async function t9(){let e=e2.active&&e2.distance>=54;if(tk.current=null,!e)return void e5({active:!1,distance:0,refreshing:!1});e5({active:!0,distance:64,refreshing:!0});try{await t7()}finally{window.setTimeout(()=>e5({active:!1,distance:0,refreshing:!1}),220)}}async function t7(){await Promise.all([t4(),nc(),tz?nE(tz,tp.current):Promise.resolve(null)])}function ne(){return tB?.cwd||eh.cwd||c.cwd||""}async function nt(){eL("view"),tc.current=null,eD(!0),await no(ne())}async function nn(e){tc.current=e,eL("reference"),eD(!0),await no(ne())}function nr(){tc.current=null,eL("view"),eD(!1)}async function ni(e){if(!eO)return;let t=tc.current;if("reference"===eR&&t){t(e,eO),nr();return}await ns({path:e.path,cwd:eO.cwd,label:e.name})}async function no(e,t,n=!1){let r=`${e}
|
|
11
|
+
${t||""}`,i=eF[r];if(i&&!n){tl.current+=1,eI(i),e$(!1);return}let o=++tl.current;e$(!0);try{let n=await kr({cwd:e,path:t});if(o!==tl.current)return;eI(n),ez(e=>({...e,[r]:n}))}catch(e){nq(e)}finally{o===tl.current&&e$(!1)}}async function ns(e){var t;let n=(t=e,`${t.cwd||""}
|
|
12
|
+
${t.path}`),r=eE[n];if(r)return(eP(null),r.previewable)?void eN({reference:e,file:r}):void await kc(e,r.name);let i=++tu.current;eN(null),eP(e);try{let t=await kl(e);if(i!==tu.current)return;if(eA(e=>({...e,[n]:t})),!t.previewable){eP(null),await kc(e,t.name);return}eP(null),eN({reference:e,file:t})}catch(e){i===tu.current&&(eP(null),nq(e))}}async function na(e){td.current=e,eV(!0),eW.length||await nu()}function nl(){td.current=null,eV(!1)}async function nu(e=!1){if(!eW.length||e){eG(!0);try{eH(await ki())}catch(e){nq(e)}finally{eG(!1)}}}async function nc(e=E){let t=++ts.current;D(!0);try{let n=50*e,r={archived:z,limit:n,sortKey:"updated_at",sortDirection:"desc"};W.trim()&&(r.searchTerm=W.trim());let[i,o]=await Promise.allSettled([w4("thread/list",r),w4("thread/loaded/list",{limit:500})]);if(t!==ts.current)return;if("fulfilled"===i.status){let e=i.value.data??[];f(e),P(e.length>=n),C(t=>{let n={...t};for(let t of e)!n[t.id]&&t.preview&&(n[t.id]=t.preview);return n})}if("fulfilled"===o.status&&m(new Set(o.value.data??[])),"rejected"===i.status)throw i.reason}catch(e){t===ts.current&&nq(e)}finally{t===ts.current&&D(!1)}}async function nd(){try{let e=await w4("account/rateLimits/read"),t=M_(e);t&&eC(t)}catch{eC(e=>e)}}async function nh(){try{let e=await w6();eX(Object.fromEntries(e.map(e=>[P3(e.id),e])))}catch(e){nq(e)}}async function nf(){e8(!0);try{e4(await w8())}catch(e){nq(e)}finally{e8(!1)}}async function np(){e8(!0);try{e4(await ke()),nq("MCP servers reloaded")}catch(e){nq(e)}finally{e8(!1)}}async function nm(e){e8(!0);try{e4(await w9(e)),nq("MCP server saved and reloaded")}catch(e){throw nq(e),e}finally{e8(!1)}}async function ng(e){try{let t=await w7(e);return nq(`Opening OAuth login for ${e}`),t.authorizationUrl}catch(e){throw nq(e),e}}async function ny(e,t){let n=P3(e.id);eQ(e=>new Set(e).add(n)),eX(e=>{let t={...e};return delete t[n],t});try{var r,i;await kt(e.id,{decision:(r=e,i=t,"acceptWithExecpolicyAmendment"===i?P9(r)??"accept":"decline"===i&&!P8(r,"decline")&&P8(r,"cancel")?"cancel":i)})}catch(e){nq(e)}finally{eQ(e=>{let t=new Set(e);return t.delete(n),t})}}async function nv(e){if(!P6(n?.permissionPolicy))return void nq("Full-control permissions are not allowed by this server.");let t=P4(e)||g;if(!t)return void nq("No thread id was available for this approval.");let r={...tx.current,[t]:{approvalPolicy:"never",sandbox:"danger-full-access"}};for(let n of(tx.current=r,Mu(r),e1(r),nq("Full-control permissions enabled for this thread."),Object.values(eY).filter(n=>P3(n.id)===P3(e.id)||P4(n)===t).sort((e,t)=>e.receivedAt-t.receivedAt))){var i;await ny(n,P8(i=n,"acceptForSession")?"acceptForSession":P9(i)?"acceptWithExecpolicyAmendment":"accept")}}function nx(){!M&&j&&(D(!0),N(e=>e+1))}function nb(e){nC(e,tp.current)}function nw(e){tp.current=e,_(e)}function nk(e,t){let n=Math.min(Y-1,Math.max(0,e)),r=Array.from({length:Y},(e,t)=>tg.current[t]??null);r[n]=t,tg.current=r,x(r)}function n_(e,t){var n,r;let i=MN(t,tv.current[e]??null);return i?(n=tv.current[e]??null,n===(r=i)||n&&r&&n.modelContextWindow===r.modelContextWindow&&MP(n.total,r.total)&&MP(n.last,r.last)||(tv.current={...tv.current,[e]:i},e_(tv.current)),i):null}function nS(e,t=tp.current,n=!0){let r=Math.min(Y-1,Math.max(0,t)),i=n_(e.id,ME(e)),o=i?{...e,tokenUsage:i}:e;w(t=>{let n=function(e,t){var n;if(!t)return e;if(!e.turns?.length)return t.turns?.length?{...e,turns:t.turns}:e;if(!t.turns?.length)return e;let r=new Map(t.turns.map(e=>[e.id,e])),i=new Set(e.turns.map(e=>e.id)),o=!(Mm(n=e)||Mp(PG(n)))&&(n.turns??[]).some(e=>PM(e)||Mf(e.status))?t.turns.filter(e=>!i.has(e.id)&&PM(e)):[];return{...e,turns:[...e.turns.map(e=>(function(e,t){var n,r;let i;if(!t?.items?.length||(n=e,r=t,!(!((n.items??[]).some(Mg)||"completed"===(i=String(n.status??"").toLowerCase().replace(/[_\s-]+/g,""))||"complete"===i||"finished"===i||"failed"===i||"interrupted"===i)&&(PM(n)||PM(r)))))return e;let o=PN(e.items??[]),s=new Set(o.map(e=>e.id)),a=new Set(o.map(Pj).filter(e=>!!e)),l=t.items.filter(e=>{if(s.has(e.id))return!1;let t=Pj(e);return!t||!a.has(t)});return 0===l.length?o===e.items?e:{...e,items:o}:{...e,items:PN([...o,...l])}})(e,r.get(e.id))),...o]}}(o,t[e.id]),r={...t,[e.id]:n};return ty.current=r,r}),n&&nk(r,e.id),r===tp.current&&tg.current[r]===e.id&&y(e.id)}async function nC(e,t=tp.current,n=!0){var r;let i=Math.min(Y-1,Math.max(0,t)),o=++ta.current;th.current[i]=o,nw(i),eJ(t=>({...t,[i]:e})),nk(i,e),n&&1===Y&&(r=`/thread/${encodeURIComponent(e)}`,window.location.pathname!==r&&window.history.pushState(window.history.state,"",r)),y(e),J("thread"),await nA(e,i,o),eJ(t=>{if(t[i]!==e||!n$(i,o))return t;let n={...t};return delete n[i],n})}async function nE(e,t=tg.current.indexOf(e),n,r=!0){try{var i,o,s;let a=await w4("thread/read",{threadId:e,includeTurns:!0}),l=t>=0?t:tg.current.indexOf(e);if(!nU(e,l,n))return null;return nS(a.thread,l,!1),nz(a.thread),nF(a.thread),r&&(i=a.thread,o=l,s=n,Mj(ME(i))||Mj(tv.current[i.id]??null)||!nU(i.id,o,s)||tr.current.has(i.id)||ti.current.has(i.id)||(tr.current.add(i.id),ti.current.add(i.id),nA(i.id,o,s).finally(()=>{ti.current.delete(i.id)}))),a.thread}catch(e){return nq(e),null}}async function nA(e,t=tp.current,n){try{let r=await w4("thread/resume",nH(e));if(!nU(e,t,n))return null;return nS(r.thread,t,!1),nz(r.thread),nF(r.thread),m(e=>new Set([...e,r.thread.id])),nB(r.thread.id,700),nW(1e3),r.thread}catch(r){return nE(e,t,n,!1)}}async function nT(e,t,n,r="send"){let i=n.trim();if(!i)return!1;try{let n=e;if(!nV(n.id,t))throw Error("Thread changed before send completed. Message was not sent.");if(!p.has(n.id)||"notLoaded"===PG(n)){if(n=(await w4("thread/resume",nH(n.id))).thread,!nV(n.id,t))throw Error("Thread changed before send completed. Message was not sent.");nS(n,t,!1),m(e=>new Set([...e,n.id]))}let o=Mh(n)||eb[n.id];if("steer"===r){if(!o)throw Error("No active turn is available to steer");if(!nV(n.id,t))throw Error("Thread changed before send completed. Message was not sent.");await w4("turn/steer",{threadId:n.id,expectedTurnId:o,input:[{type:"text",text:i}]})}else{if(!nV(n.id,t))throw Error("Thread changed before send completed. Message was not sent.");await w4("turn/start",nK(n.id,i))}return nB(n.id,800),nW(1200),!0}catch(e){return nq(e),!1}}async function nN(e){let t=Mh(e)||eb[e.id];if(t)try{await w4("turn/interrupt",{threadId:e.id,turnId:t}),nB(e.id,600)}catch(e){nq(e)}}async function nj(e,t){let n=t.trim();if(n&&n!==Me(e))try{await w4("thread/name/set",{threadId:e.id,name:n}),w(t=>({...t,[e.id]:{...e,name:n}})),f(t=>t.map(t=>t.id===e.id?{...t,name:n}:t)),await nE(e.id),await nc()}catch(e){nq(e)}}async function nP(e,t=k){try{let n=await w4("thread/fork",{...nH(e.id),ephemeral:!1,threadSource:"user"});nS(n.thread,t),B(!1),await nc()}catch(e){nq(e)}}async function nM(e,t=k){try{if(z){let n=await w4("thread/unarchive",{threadId:e.id});nS(n.thread,t),B(!1)}else{await w4("thread/archive",{threadId:e.id});let t=tg.current.map(t=>t===e.id?null:t);tg.current=t,x(t),w(t=>{let n={...t};return delete n[e.id],n}),g===e.id&&y(null)}await nc()}catch(e){nq(e)}}async function nD(e){try{ef(e.settings);let t=Mw({cwd:e.settings.cwd||null,model:e.settings.model||null,approvalPolicy:e.settings.approvalPolicy||null,sandbox:e.settings.sandbox||null,threadSource:"user"}),n=await w4("thread/start",t);nS(n.thread,tp.current),em(!1),B(!1),await nc(),e.prompt.trim()&&(await w4("turn/start",nK(n.thread.id,e.prompt.trim(),e.settings)),nB(n.thread.id,900))}catch(e){nq(e)}}function nR(e){var t,n,r,i,o,s,a,l,u,c,h,f;if("server-status"===e.type)return void d(e.payload);if("client-request"===e.type){let t,n,r,i=(n="string"==typeof(t=Mk(e.payload)).id||"number"==typeof t.id?t.id:null,r="string"==typeof t.method?t.method:"",null!==n&&r?{id:n,method:r,params:MO(t.params)?t.params:{},receivedAt:MI(t.receivedAt)??Date.now()}:null);i&&eX(e=>({...e,[P3(i.id)]:i}));return}if("client-request-resolved"===e.type){let t=Mk(e.payload),n="string"==typeof t.id||"number"==typeof t.id?t.id:null;null!==n&&eX(e=>{let t={...e};return delete t[P3(n)],t});return}if("notification"!==e.type)return;let p=Mk(e.payload),m="string"==typeof p.method?p.method:"",g=Mk(p.params),y="string"==typeof g.threadId?g.threadId:MF(g.thread);if(y&&(t=y,tn.current.set(t,Date.now())),"mcpServer/status/updated"===m)return void nf();if("mcpServer/oauthLogin/completed"===m){let e,t,r,i,o="string"==typeof g.name?g.name:"MCP server",s=!0===g.success,a="string"==typeof g.error?g.error:"";s?nq(`${o} OAuth login completed`):(n=o,e=M$(a),t=`${n}
|
|
13
|
+
${e}`,r=Date.now(),i=e7.current.get(t)??0,e7.current.set(t,r),r-i>2e4&&nq(`${o} needs MCP login${a?`: ${M$(a)}`:""}`,{tone:"error",actionLabel:"Open status",onAction:()=>ex(!0)})),nf();return}if("turn/started"===m&&y){let e=Mk(g.turn);"string"==typeof e.id&&ew(t=>({...t,[y]:e.id})),nB(y,800)}if("turn/completed"===m&&y&&(nO(y),nB(y,600),nW(1200)),"thread/status/changed"===m&&y&&nI(y,g.status),"account/rateLimits/updated"===m){let e=function(e){let t=Mk(e),n=M_(t);if(n?.limitId===Po)return n;let r=MS(t.rateLimits);if(r?.limitId===Po)return r;let i=MS(t);return i?.limitId===Po?i:null}(g);e&&eC(e)}if(y&&"thread/tokenUsage/updated"===m){let e=MT(g.tokenUsage??g.token_usage??g);if(e){let t=n_(y,e)??e;nL(y,e=>({...e,tokenUsage:MN(t,ME(e))??t}))}}if("serverRequest/resolved"===m){let e="string"==typeof g.id||"number"==typeof g.id?g.id:"string"==typeof g.requestId||"number"==typeof g.requestId?g.requestId:null;null!==e&&eX(t=>{let n={...t};return delete n[P3(e)],n})}if(y&&"item/agentMessage/delta"===m){let e="string"==typeof g.turnId?g.turnId:null,t="string"==typeof g.itemId?g.itemId:null,n="string"==typeof g.delta?g.delta:"";e&&t&&n&&(r=y,i=e,o=t,s=n,nL(r,e=>PP(e,i,o,e=>({...e,id:o,type:"agentMessage",text:`${"string"==typeof e.text?e.text:""}${s}`}))))}if(y&&"item/started"===m){let e=Mk(g.item),t="string"==typeof g.turnId?g.turnId:null;t&&"string"==typeof e.id&&"string"==typeof e.type&&(a=y,l=t,u=e,nL(a,e=>PP(e,l,u.id,e=>({...e,...u}))))}if(y&&"item/completed"===m){let e=Mk(g.item),t="string"==typeof g.turnId?g.turnId:null;if(t&&"string"==typeof e.id&&"string"==typeof e.type&&(c=y,h=t,f=e,nL(c,e=>PP(e,h,f.id,()=>f)),Mg(e))){nO(y,t),nI(y,"idle"),nB(y,350),nW(700);return}}y&&tg.current.includes(y)&&m.startsWith("item/")&&nB(y,800)}function nL(e,t){w(n=>{let r=n[e];if(!r)return n;let i=t(r),o={...n,[e]:i};return ty.current=o,o})}function nO(e,t){ew(n=>{if(!(e in n)||t&&n[e]!==t)return n;let r={...n};return delete r[e],r})}function nI(e,t){f(n=>n.map(n=>n.id===e?{...n,status:t}:n)),w(n=>{if(!n[e])return n;let r={...n,[e]:{...n[e],status:t}};return ty.current=r,r})}function nF(e){let t=Mh(e);t?ew(n=>({...n,[e.id]:t})):(Mp(PG(e))||Mm(e))&&nO(e.id)}function nz(e){var t;let n,r=(n=[...[...(t=e).turns??[]].flatMap(e=>e.items??[])].reverse().find(e=>"userMessage"===e.type||"agentMessage"===e.type))?"userMessage"===n.type?My(n.content):"string"==typeof n.text?n.text:t.preview||"":t.preview||"";r&&C(t=>({...t,[e.id]:r}))}function nB(e,t){if(0>tg.current.indexOf(e))return;let n=te.current.get(e);n&&window.clearTimeout(n);let r=window.setTimeout(()=>{te.current.delete(e);let t=tg.current.indexOf(e);t>=0&&nE(e,t)},t);te.current.set(e,r)}function n$(e,t){return void 0===t||th.current[e]===t}function nU(e,t,n){return t>=0&&tg.current[t]===e&&n$(t,n)}function nV(e,t){return t>=0&&tg.current[t]===e}function nW(e){to.current&&window.clearTimeout(to.current),to.current=window.setTimeout(()=>nc(),e)}function nH(e){let t=nG(e);return Mw({threadId:e,cwd:eh.cwd||null,model:eh.model||null,sandbox:t.sandbox||null})}function nK(e,t,n=nG(e)){var r;return Mw({threadId:e,input:[{type:"text",text:t}],cwd:n.cwd||null,model:n.model||null,effort:n.effort||null,approvalPolicy:n.approvalPolicy||null,sandboxPolicy:"danger-full-access"===(r=n.sandbox)?{type:"dangerFullAccess"}:"read-only"===r?{type:"readOnly"}:"workspace-write"===r?{type:"workspaceWrite"}:null})}function nG(e){let t=tx.current[e];return t?{...eh,...t}:eh}function nq(e,t={}){var n;let r=MB(e),i=t.tone??(e instanceof Error||(n=r,/\b(error|failed|invalid|unauthorized|forbidden|expired|timed out|requires)\b/i.test(n))?"error":"info"),o={message:r,tone:i,actionLabel:t.actionLabel,onAction:t.onAction};en(o),window.setTimeout(()=>{en(e=>e===o?null:e)},"error"===i?7e3:4200)}}],238486)}]);
|