@ycodium-ai/plugin-conversation 0.2.2588 → 0.2.2596
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/assets/ui.js +50 -50
- package/package.json +2 -2
package/assets/ui.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var
|
|
1
|
+
var PO=Object.create;var ff=Object.defineProperty;var AO=Object.getOwnPropertyDescriptor;var EO=Object.getOwnPropertyNames;var RO=Object.getPrototypeOf,MO=Object.prototype.hasOwnProperty;var NO=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(o){throw n=[o],o}};var pf=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}},En=(e,t)=>{for(var n in t)ff(e,n,{get:t[n],enumerable:!0})},nw=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of EO(t))!MO.call(e,r)&&r!==n&&ff(e,r,{get:()=>t[r],enumerable:!(o=AO(t,r))||o.enumerable});return e};var Rd=(e,t,n)=>(n=e!=null?PO(RO(e)):{},nw(t||!e||!e.__esModule?ff(n,"default",{value:e,enumerable:!0}):n,e)),ow=e=>nw(ff({},"__esModule",{value:!0}),e);var gf={};En(gf,{Activity:()=>DO,Children:()=>fh,Component:()=>wa,Fragment:()=>ni,Profiler:()=>OO,PureComponent:()=>FO,StrictMode:()=>BO,Suspense:()=>ph,__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE:()=>zO,__COMPILER_RUNTIME:()=>UO,act:()=>HO,cache:()=>$O,cacheSignal:()=>KO,captureOwnerStack:()=>VO,cloneElement:()=>mf,createContext:()=>bt,createElement:()=>De,createRef:()=>qO,default:()=>yn,forwardRef:()=>zn,isValidElement:()=>mh,lazy:()=>WO,memo:()=>pe,startTransition:()=>GO,unstable_useCacheRefresh:()=>jO,use:()=>wt,useActionState:()=>QO,useCallback:()=>R,useContext:()=>Ht,useDebugValue:()=>XO,useDeferredValue:()=>YO,useEffect:()=>W,useEffectEvent:()=>gh,useId:()=>Jr,useImperativeHandle:()=>ar,useInsertionEffect:()=>Md,useLayoutEffect:()=>he,useMemo:()=>K,useOptimistic:()=>JO,useReducer:()=>Sa,useRef:()=>N,useState:()=>J,useSyncExternalStore:()=>$o,useTransition:()=>ZO,version:()=>eF});var aw,yn,DO,fh,wa,ni,OO,FO,BO,ph,zO,UO,HO,$O,KO,VO,mf,bt,De,qO,zn,mh,WO,pe,GO,jO,wt,QO,R,Ht,XO,YO,W,gh,Jr,ar,Md,he,K,JO,Sa,N,J,$o,ZO,eF,ue=NO(()=>{aw=window.__ycodiumPluginHost.react,yn=aw,{Activity:DO,Children:fh,Component:wa,Fragment:ni,Profiler:OO,PureComponent:FO,StrictMode:BO,Suspense:ph,__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE:zO,__COMPILER_RUNTIME:UO,act:HO,cache:$O,cacheSignal:KO,captureOwnerStack:VO,cloneElement:mf,createContext:bt,createElement:De,createRef:qO,forwardRef:zn,isValidElement:mh,lazy:WO,memo:pe,startTransition:GO,unstable_useCacheRefresh:jO,use:wt,useActionState:QO,useCallback:R,useContext:Ht,useDebugValue:XO,useDeferredValue:YO,useEffect:W,useEffectEvent:gh,useId:Jr,useImperativeHandle:ar,useInsertionEffect:Md,useLayoutEffect:he,useMemo:K,useOptimistic:JO,useReducer:Sa,useRef:N,useState:J,useSyncExternalStore:$o,useTransition:ZO,version:eF}=aw});var y0=pf(xo=>{"use strict";var LU=(ue(),ow(gf));function v0(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function hi(){}var yo={d:{f:hi,r:function(){throw Error(v0(522))},D:hi,C:hi,L:hi,m:hi,X:hi,S:hi,M:hi},p:0,findDOMNode:null},PU=Symbol.for("react.portal");function AU(e,t,n){var o=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:PU,key:o==null?null:""+o,children:e,containerInfo:t,implementation:n}}var wc=LU.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function lp(e,t){if(e==="font")return"";if(typeof t=="string")return t==="use-credentials"?t:""}xo.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=yo;xo.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(v0(299));return AU(e,t,null,n)};xo.flushSync=function(e){var t=wc.T,n=yo.p;try{if(wc.T=null,yo.p=2,e)return e()}finally{wc.T=t,yo.p=n,yo.d.f()}};xo.preconnect=function(e,t){typeof e=="string"&&(t?(t=t.crossOrigin,t=typeof t=="string"?t==="use-credentials"?t:"":void 0):t=null,yo.d.C(e,t))};xo.prefetchDNS=function(e){typeof e=="string"&&yo.d.D(e)};xo.preinit=function(e,t){if(typeof e=="string"&&t&&typeof t.as=="string"){var n=t.as,o=lp(n,t.crossOrigin),r=typeof t.integrity=="string"?t.integrity:void 0,a=typeof t.fetchPriority=="string"?t.fetchPriority:void 0;n==="style"?yo.d.S(e,typeof t.precedence=="string"?t.precedence:void 0,{crossOrigin:o,integrity:r,fetchPriority:a}):n==="script"&&yo.d.X(e,{crossOrigin:o,integrity:r,fetchPriority:a,nonce:typeof t.nonce=="string"?t.nonce:void 0})}};xo.preinitModule=function(e,t){if(typeof e=="string")if(typeof t=="object"&&t!==null){if(t.as==null||t.as==="script"){var n=lp(t.as,t.crossOrigin);yo.d.M(e,{crossOrigin:n,integrity:typeof t.integrity=="string"?t.integrity:void 0,nonce:typeof t.nonce=="string"?t.nonce:void 0})}}else t==null&&yo.d.M(e)};xo.preload=function(e,t){if(typeof e=="string"&&typeof t=="object"&&t!==null&&typeof t.as=="string"){var n=t.as,o=lp(n,t.crossOrigin);yo.d.L(e,n,{crossOrigin:o,integrity:typeof t.integrity=="string"?t.integrity:void 0,nonce:typeof t.nonce=="string"?t.nonce:void 0,type:typeof t.type=="string"?t.type:void 0,fetchPriority:typeof t.fetchPriority=="string"?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy=="string"?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet=="string"?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes=="string"?t.imageSizes:void 0,media:typeof t.media=="string"?t.media:void 0})}};xo.preloadModule=function(e,t){if(typeof e=="string")if(t){var n=lp(t.as,t.crossOrigin);yo.d.m(e,{as:typeof t.as=="string"&&t.as!=="script"?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity=="string"?t.integrity:void 0})}else yo.d.m(e)};xo.requestFormReset=function(e){yo.d.r(e)};xo.unstable_batchedUpdates=function(e,t){return e(t)};xo.useFormState=function(e,t,n){return wc.H.useFormState(e,t,n)};xo.useFormStatus=function(){return wc.H.useHostTransitionStatus()};xo.version="19.2.6"});var Sc=pf((soe,C0)=>{"use strict";function x0(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(x0)}catch(e){console.error(e)}}x0(),C0.exports=y0()});var QM=pf(jM=>{"use strict";var md=(ue(),ow(gf));function Jq(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Zq=typeof Object.is=="function"?Object.is:Jq,e4=md.useState,t4=md.useEffect,n4=md.useLayoutEffect,o4=md.useDebugValue;function r4(e,t){var n=t(),o=e4({inst:{value:n,getSnapshot:t}}),r=o[0].inst,a=o[1];return n4(function(){r.value=n,r.getSnapshot=t,gC(r)&&a({inst:r})},[e,n,t]),t4(function(){return gC(r)&&a({inst:r}),e(function(){gC(r)&&a({inst:r})})},[e]),o4(n),n}function gC(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Zq(e,n)}catch{return!0}}function a4(e,t){return t()}var i4=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?a4:r4;jM.useSyncExternalStore=md.useSyncExternalStore!==void 0?md.useSyncExternalStore:i4});var YM=pf((upe,XM)=>{"use strict";XM.exports=QM()});var rw=`/*! tailwindcss v4.3.0 | MIT License | https://tailwindcss.com */
|
|
2
2
|
@layer properties, theme, base, components, utilities;
|
|
3
3
|
@layer properties;
|
|
4
4
|
:root, :host {
|
|
@@ -3737,76 +3737,76 @@ var TO=Object.create;var pf=Object.defineProperty;var kO=Object.getOwnPropertyDe
|
|
|
3737
3737
|
}
|
|
3738
3738
|
}
|
|
3739
3739
|
}
|
|
3740
|
-
`;ue();ue();var sw=Ct(null),lw=sw.Provider,dw=Ct(""),cw=dw.Provider;function vf(){return Ht(dw)}function sr(){let e=Ht(sw);if(e===null)throw new Error("Conversation UI has not been registered.");return e}var uw="ycodium.conversation.host-data.v14",vh="conversation";var yh="__ycodiumConversationBridge",fw="ycodium.conversation.rebindable-bridge.v1";ue();function pw(e){var t,n,o="";if(typeof e=="string"||typeof e=="number")o+=e;else if(typeof e=="object")if(Array.isArray(e)){var r=e.length;for(t=0;t<r;t++)e[t]&&(n=pw(e[t]))&&(o&&(o+=" "),o+=n)}else for(n in e)e[n]&&(o&&(o+=" "),o+=n);return o}function mw(){for(var e,t,n=0,o="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=pw(e))&&(o&&(o+=" "),o+=t);return o}var gw=mw;var JO=(e,t)=>{let n=new Array(e.length+t.length);for(let o=0;o<e.length;o++)n[o]=e[o];for(let o=0;o<t.length;o++)n[e.length+o]=t[o];return n},ZO=(e,t)=>({classGroupId:e,validator:t}),Sw=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n});var hw=[],eF="arbitrary..",tF=e=>{let t=oF(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:o}=e;return{getClassGroupId:i=>{if(i.startsWith("[")&&i.endsWith("]"))return nF(i);let s=i.split("-"),l=s[0]===""&&s.length>1?1:0;return Iw(s,l,t)},getConflictingClassGroupIds:(i,s)=>{if(s){let l=o[i],d=n[i];return l?d?JO(d,l):l:d||hw}return n[i]||hw}}},Iw=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],a=n.nextPart.get(r);if(a){let d=Iw(e,t+1,a);if(d)return d}let i=n.validators;if(i===null)return;let s=t===0?e.join("-"):e.slice(t).join("-"),l=i.length;for(let d=0;d<l;d++){let c=i[d];if(c.validator(s))return c.classGroupId}},nF=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(":"),o=t.slice(0,n);return o?eF+o:void 0})(),oF=e=>{let{theme:t,classGroups:n}=e;return rF(n,t)},rF=(e,t)=>{let n=Sw();for(let o in e){let r=e[o];bh(r,n,o,t)}return n},bh=(e,t,n,o)=>{let r=e.length;for(let a=0;a<r;a++){let i=e[a];aF(i,t,n,o)}},aF=(e,t,n,o)=>{if(typeof e=="string"){iF(e,t,n);return}if(typeof e=="function"){sF(e,t,n,o);return}lF(e,t,n,o)},iF=(e,t,n)=>{let o=e===""?t:Tw(t,e);o.classGroupId=n},sF=(e,t,n,o)=>{if(dF(e)){bh(e(o),t,n,o);return}t.validators===null&&(t.validators=[]),t.validators.push(ZO(n,e))},lF=(e,t,n,o)=>{let r=Object.entries(e),a=r.length;for(let i=0;i<a;i++){let[s,l]=r[i];bh(l,Tw(t,s),n,o)}},Tw=(e,t)=>{let n=e,o=t.split("-"),r=o.length;for(let a=0;a<r;a++){let i=o[a],s=n.nextPart.get(i);s||(s=Sw(),n.nextPart.set(i,s)),n=s}return n},dF=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,cF=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),o=Object.create(null),r=(a,i)=>{n[a]=i,t++,t>e&&(t=0,o=n,n=Object.create(null))};return{get(a){let i=n[a];if(i!==void 0)return i;if((i=o[a])!==void 0)return r(a,i),i},set(a,i){a in n?n[a]=i:r(a,i)}}};var uF=[],vw=(e,t,n,o,r)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:o,isExternal:r}),fF=e=>{let{prefix:t,experimentalParseClassName:n}=e,o=r=>{let a=[],i=0,s=0,l=0,d,c=r.length;for(let h=0;h<c;h++){let v=r[h];if(i===0&&s===0){if(v===":"){a.push(r.slice(l,h)),l=h+1;continue}if(v==="/"){d=h;continue}}v==="["?i++:v==="]"?i--:v==="("?s++:v===")"&&s--}let f=a.length===0?r:r.slice(l),p=f,m=!1;f.endsWith("!")?(p=f.slice(0,-1),m=!0):f.startsWith("!")&&(p=f.slice(1),m=!0);let g=d&&d>l?d-l:void 0;return vw(a,m,p,g)};if(t){let r=t+":",a=o;o=i=>i.startsWith(r)?a(i.slice(r.length)):vw(uF,!1,i,void 0,!0)}if(n){let r=o;o=a=>n({className:a,parseClassName:r})}return o},pF=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((n,o)=>{t.set(n,1e6+o)}),n=>{let o=[],r=[];for(let a=0;a<n.length;a++){let i=n[a],s=i[0]==="[",l=t.has(i);s||l?(r.length>0&&(r.sort(),o.push(...r),r=[]),o.push(i)):r.push(i)}return r.length>0&&(r.sort(),o.push(...r)),o}},mF=e=>({cache:cF(e.cacheSize),parseClassName:fF(e),sortModifiers:pF(e),postfixLookupClassGroupIds:gF(e),...tF(e)}),gF=e=>{let t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let o=0;o<n.length;o++)t[n[o]]=!0;return t},hF=/\s+/,vF=(e,t)=>{let{parseClassName:n,getClassGroupId:o,getConflictingClassGroupIds:r,sortModifiers:a,postfixLookupClassGroupIds:i}=t,s=[],l=e.trim().split(hF),d="";for(let c=l.length-1;c>=0;c-=1){let f=l[c],{isExternal:p,modifiers:m,hasImportantModifier:g,baseClassName:h,maybePostfixModifierPosition:v}=n(f);if(p){d=f+(d.length>0?" "+d:d);continue}let y=!!v,x;if(y){let k=h.substring(0,v);x=o(k);let I=x&&i[x]?o(h):void 0;I&&I!==x&&(x=I,y=!1)}else x=o(h);if(!x){if(!y){d=f+(d.length>0?" "+d:d);continue}if(x=o(h),!x){d=f+(d.length>0?" "+d:d);continue}y=!1}let C=m.length===0?"":m.length===1?m[0]:a(m).join(":"),w=g?C+"!":C,L=w+x;if(s.indexOf(L)>-1)continue;s.push(L);let S=r(x,y);for(let k=0;k<S.length;++k){let I=S[k];s.push(w+I)}d=f+(d.length>0?" "+d:d)}return d},yF=(...e)=>{let t=0,n,o,r="";for(;t<e.length;)(n=e[t++])&&(o=kw(n))&&(r&&(r+=" "),r+=o);return r},kw=e=>{if(typeof e=="string")return e;let t,n="";for(let o=0;o<e.length;o++)e[o]&&(t=kw(e[o]))&&(n&&(n+=" "),n+=t);return n},yw=(e,...t)=>{let n,o,r,a,i=l=>{let d=t.reduce((c,f)=>f(c),e());return n=mF(d),o=n.cache.get,r=n.cache.set,a=s,s(l)},s=l=>{let d=o(l);if(d)return d;let c=vF(l,n);return r(l,c),c};return a=i,(...l)=>a(yF(...l))},xF=[],_n=e=>{let t=n=>n[e]||xF;return t.isThemeGetter=!0,t},Lw=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Pw=/^\((?:(\w[\w-]*):)?(.+)\)$/i,CF=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,bF=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,wF=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,SF=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,IF=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,TF=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ri=e=>CF.test(e),mt=e=>!!e&&!Number.isNaN(Number(e)),Zr=e=>!!e&&Number.isInteger(Number(e)),xh=e=>e.endsWith("%")&&mt(e.slice(0,-1)),Ta=e=>bF.test(e),Aw=()=>!0,kF=e=>wF.test(e)&&!SF.test(e),wh=()=>!1,LF=e=>IF.test(e),PF=e=>TF.test(e),AF=e=>!Oe(e)&&!Fe(e),EF=e=>e.startsWith("@container")&&(e[10]==="/"&&e[11]!==void 0||e[11]==="s"&&e[16]!==void 0&&e.startsWith("-size/",10)||e[11]==="n"&&e[18]!==void 0&&e.startsWith("-normal/",10)),RF=e=>ai(e,Mw,wh),Oe=e=>Lw.test(e),ji=e=>ai(e,Nw,kF),xw=e=>ai(e,zF,mt),MF=e=>ai(e,Dw,Aw),NF=e=>ai(e,_w,wh),Cw=e=>ai(e,Ew,wh),_F=e=>ai(e,Rw,PF),yf=e=>ai(e,Ow,LF),Fe=e=>Pw.test(e),_d=e=>Qi(e,Nw),DF=e=>Qi(e,_w),bw=e=>Qi(e,Ew),OF=e=>Qi(e,Mw),FF=e=>Qi(e,Rw),xf=e=>Qi(e,Ow,!0),BF=e=>Qi(e,Dw,!0),ai=(e,t,n)=>{let o=Lw.exec(e);return o?o[1]?t(o[1]):n(o[2]):!1},Qi=(e,t,n=!1)=>{let o=Pw.exec(e);return o?o[1]?t(o[1]):n:!1},Ew=e=>e==="position"||e==="percentage",Rw=e=>e==="image"||e==="url",Mw=e=>e==="length"||e==="size"||e==="bg-size",Nw=e=>e==="length",zF=e=>e==="number",_w=e=>e==="family-name",Dw=e=>e==="number"||e==="weight",Ow=e=>e==="shadow";var ww=()=>{let e=_n("color"),t=_n("font"),n=_n("text"),o=_n("font-weight"),r=_n("tracking"),a=_n("leading"),i=_n("breakpoint"),s=_n("container"),l=_n("spacing"),d=_n("radius"),c=_n("shadow"),f=_n("inset-shadow"),p=_n("text-shadow"),m=_n("drop-shadow"),g=_n("blur"),h=_n("perspective"),v=_n("aspect"),y=_n("ease"),x=_n("animate"),C=()=>["auto","avoid","all","avoid-page","page","left","right","column"],w=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],L=()=>[...w(),Fe,Oe],S=()=>["auto","hidden","clip","visible","scroll"],k=()=>["auto","contain","none"],I=()=>[Fe,Oe,l],T=()=>[ri,"full","auto",...I()],A=()=>[Zr,"none","subgrid",Fe,Oe],P=()=>["auto",{span:["full",Zr,Fe,Oe]},Zr,Fe,Oe],_=()=>[Zr,"auto",Fe,Oe],E=()=>["auto","min","max","fr",Fe,Oe],F=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],B=()=>["start","end","center","stretch","center-safe","end-safe"],V=()=>["auto",...I()],Q=()=>[ri,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...I()],Se=()=>[ri,"screen","full","dvw","lvw","svw","min","max","fit",...I()],H=()=>[ri,"screen","full","lh","dvh","lvh","svh","min","max","fit",...I()],q=()=>[e,Fe,Oe],ee=()=>[...w(),bw,Cw,{position:[Fe,Oe]}],G=()=>["no-repeat",{repeat:["","x","y","space","round"]}],te=()=>["auto","cover","contain",OF,RF,{size:[Fe,Oe]}],me=()=>[xh,_d,ji],U=()=>["","none","full",d,Fe,Oe],Y=()=>["",mt,_d,ji],se=()=>["solid","dashed","dotted","double"],ge=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ie=()=>[mt,xh,bw,Cw],Ae=()=>["","none",g,Fe,Oe],Xe=()=>["none",mt,Fe,Oe],nt=()=>["none",mt,Fe,Oe],rt=()=>[mt,Fe,Oe],Ve=()=>[ri,"full",...I()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Ta],breakpoint:[Ta],color:[Aw],container:[Ta],"drop-shadow":[Ta],ease:["in","out","in-out"],font:[AF],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Ta],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Ta],shadow:[Ta],spacing:["px",mt],text:[Ta],"text-shadow":[Ta],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ri,Oe,Fe,v]}],container:["container"],"container-type":[{"@container":["","normal","size",Fe,Oe]}],"container-named":[EF],columns:[{columns:[mt,Oe,Fe,s]}],"break-after":[{"break-after":C()}],"break-before":[{"break-before":C()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:L()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:k()}],"overscroll-x":[{"overscroll-x":k()}],"overscroll-y":[{"overscroll-y":k()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:["visible","invisible","collapse"],z:[{z:[Zr,"auto",Fe,Oe]}],basis:[{basis:[ri,"full","auto",s,...I()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[mt,ri,"auto","initial","none",Oe]}],grow:[{grow:["",mt,Fe,Oe]}],shrink:[{shrink:["",mt,Fe,Oe]}],order:[{order:[Zr,"first","last","none",Fe,Oe]}],"grid-cols":[{"grid-cols":A()}],"col-start-end":[{col:P()}],"col-start":[{"col-start":_()}],"col-end":[{"col-end":_()}],"grid-rows":[{"grid-rows":A()}],"row-start-end":[{row:P()}],"row-start":[{"row-start":_()}],"row-end":[{"row-end":_()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":E()}],"auto-rows":[{"auto-rows":E()}],gap:[{gap:I()}],"gap-x":[{"gap-x":I()}],"gap-y":[{"gap-y":I()}],"justify-content":[{justify:[...F(),"normal"]}],"justify-items":[{"justify-items":[...B(),"normal"]}],"justify-self":[{"justify-self":["auto",...B()]}],"align-content":[{content:["normal",...F()]}],"align-items":[{items:[...B(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...B(),{baseline:["","last"]}]}],"place-content":[{"place-content":F()}],"place-items":[{"place-items":[...B(),"baseline"]}],"place-self":[{"place-self":["auto",...B()]}],p:[{p:I()}],px:[{px:I()}],py:[{py:I()}],ps:[{ps:I()}],pe:[{pe:I()}],pbs:[{pbs:I()}],pbe:[{pbe:I()}],pt:[{pt:I()}],pr:[{pr:I()}],pb:[{pb:I()}],pl:[{pl:I()}],m:[{m:V()}],mx:[{mx:V()}],my:[{my:V()}],ms:[{ms:V()}],me:[{me:V()}],mbs:[{mbs:V()}],mbe:[{mbe:V()}],mt:[{mt:V()}],mr:[{mr:V()}],mb:[{mb:V()}],ml:[{ml:V()}],"space-x":[{"space-x":I()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":I()}],"space-y-reverse":["space-y-reverse"],size:[{size:Q()}],"inline-size":[{inline:["auto",...Se()]}],"min-inline-size":[{"min-inline":["auto",...Se()]}],"max-inline-size":[{"max-inline":["none",...Se()]}],"block-size":[{block:["auto",...H()]}],"min-block-size":[{"min-block":["auto",...H()]}],"max-block-size":[{"max-block":["none",...H()]}],w:[{w:[s,"screen",...Q()]}],"min-w":[{"min-w":[s,"screen","none",...Q()]}],"max-w":[{"max-w":[s,"screen","none","prose",{screen:[i]},...Q()]}],h:[{h:["screen","lh",...Q()]}],"min-h":[{"min-h":["screen","lh","none",...Q()]}],"max-h":[{"max-h":["screen","lh",...Q()]}],"font-size":[{text:["base",n,_d,ji]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[o,BF,MF]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",xh,Oe]}],"font-family":[{font:[DF,NF,t]}],"font-features":[{"font-features":[Oe]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[r,Fe,Oe]}],"line-clamp":[{"line-clamp":[mt,"none",Fe,xw]}],leading:[{leading:[a,...I()]}],"list-image":[{"list-image":["none",Fe,Oe]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Fe,Oe]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:q()}],"text-color":[{text:q()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...se(),"wavy"]}],"text-decoration-thickness":[{decoration:[mt,"from-font","auto",Fe,ji]}],"text-decoration-color":[{decoration:q()}],"underline-offset":[{"underline-offset":[mt,"auto",Fe,Oe]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:I()}],"tab-size":[{tab:[Zr,Fe,Oe]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Fe,Oe]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Fe,Oe]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:ee()}],"bg-repeat":[{bg:G()}],"bg-size":[{bg:te()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Zr,Fe,Oe],radial:["",Fe,Oe],conic:[Zr,Fe,Oe]},FF,_F]}],"bg-color":[{bg:q()}],"gradient-from-pos":[{from:me()}],"gradient-via-pos":[{via:me()}],"gradient-to-pos":[{to:me()}],"gradient-from":[{from:q()}],"gradient-via":[{via:q()}],"gradient-to":[{to:q()}],rounded:[{rounded:U()}],"rounded-s":[{"rounded-s":U()}],"rounded-e":[{"rounded-e":U()}],"rounded-t":[{"rounded-t":U()}],"rounded-r":[{"rounded-r":U()}],"rounded-b":[{"rounded-b":U()}],"rounded-l":[{"rounded-l":U()}],"rounded-ss":[{"rounded-ss":U()}],"rounded-se":[{"rounded-se":U()}],"rounded-ee":[{"rounded-ee":U()}],"rounded-es":[{"rounded-es":U()}],"rounded-tl":[{"rounded-tl":U()}],"rounded-tr":[{"rounded-tr":U()}],"rounded-br":[{"rounded-br":U()}],"rounded-bl":[{"rounded-bl":U()}],"border-w":[{border:Y()}],"border-w-x":[{"border-x":Y()}],"border-w-y":[{"border-y":Y()}],"border-w-s":[{"border-s":Y()}],"border-w-e":[{"border-e":Y()}],"border-w-bs":[{"border-bs":Y()}],"border-w-be":[{"border-be":Y()}],"border-w-t":[{"border-t":Y()}],"border-w-r":[{"border-r":Y()}],"border-w-b":[{"border-b":Y()}],"border-w-l":[{"border-l":Y()}],"divide-x":[{"divide-x":Y()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":Y()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...se(),"hidden","none"]}],"divide-style":[{divide:[...se(),"hidden","none"]}],"border-color":[{border:q()}],"border-color-x":[{"border-x":q()}],"border-color-y":[{"border-y":q()}],"border-color-s":[{"border-s":q()}],"border-color-e":[{"border-e":q()}],"border-color-bs":[{"border-bs":q()}],"border-color-be":[{"border-be":q()}],"border-color-t":[{"border-t":q()}],"border-color-r":[{"border-r":q()}],"border-color-b":[{"border-b":q()}],"border-color-l":[{"border-l":q()}],"divide-color":[{divide:q()}],"outline-style":[{outline:[...se(),"none","hidden"]}],"outline-offset":[{"outline-offset":[mt,Fe,Oe]}],"outline-w":[{outline:["",mt,_d,ji]}],"outline-color":[{outline:q()}],shadow:[{shadow:["","none",c,xf,yf]}],"shadow-color":[{shadow:q()}],"inset-shadow":[{"inset-shadow":["none",f,xf,yf]}],"inset-shadow-color":[{"inset-shadow":q()}],"ring-w":[{ring:Y()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:q()}],"ring-offset-w":[{"ring-offset":[mt,ji]}],"ring-offset-color":[{"ring-offset":q()}],"inset-ring-w":[{"inset-ring":Y()}],"inset-ring-color":[{"inset-ring":q()}],"text-shadow":[{"text-shadow":["none",p,xf,yf]}],"text-shadow-color":[{"text-shadow":q()}],opacity:[{opacity:[mt,Fe,Oe]}],"mix-blend":[{"mix-blend":[...ge(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ge()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[mt]}],"mask-image-linear-from-pos":[{"mask-linear-from":ie()}],"mask-image-linear-to-pos":[{"mask-linear-to":ie()}],"mask-image-linear-from-color":[{"mask-linear-from":q()}],"mask-image-linear-to-color":[{"mask-linear-to":q()}],"mask-image-t-from-pos":[{"mask-t-from":ie()}],"mask-image-t-to-pos":[{"mask-t-to":ie()}],"mask-image-t-from-color":[{"mask-t-from":q()}],"mask-image-t-to-color":[{"mask-t-to":q()}],"mask-image-r-from-pos":[{"mask-r-from":ie()}],"mask-image-r-to-pos":[{"mask-r-to":ie()}],"mask-image-r-from-color":[{"mask-r-from":q()}],"mask-image-r-to-color":[{"mask-r-to":q()}],"mask-image-b-from-pos":[{"mask-b-from":ie()}],"mask-image-b-to-pos":[{"mask-b-to":ie()}],"mask-image-b-from-color":[{"mask-b-from":q()}],"mask-image-b-to-color":[{"mask-b-to":q()}],"mask-image-l-from-pos":[{"mask-l-from":ie()}],"mask-image-l-to-pos":[{"mask-l-to":ie()}],"mask-image-l-from-color":[{"mask-l-from":q()}],"mask-image-l-to-color":[{"mask-l-to":q()}],"mask-image-x-from-pos":[{"mask-x-from":ie()}],"mask-image-x-to-pos":[{"mask-x-to":ie()}],"mask-image-x-from-color":[{"mask-x-from":q()}],"mask-image-x-to-color":[{"mask-x-to":q()}],"mask-image-y-from-pos":[{"mask-y-from":ie()}],"mask-image-y-to-pos":[{"mask-y-to":ie()}],"mask-image-y-from-color":[{"mask-y-from":q()}],"mask-image-y-to-color":[{"mask-y-to":q()}],"mask-image-radial":[{"mask-radial":[Fe,Oe]}],"mask-image-radial-from-pos":[{"mask-radial-from":ie()}],"mask-image-radial-to-pos":[{"mask-radial-to":ie()}],"mask-image-radial-from-color":[{"mask-radial-from":q()}],"mask-image-radial-to-color":[{"mask-radial-to":q()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":w()}],"mask-image-conic-pos":[{"mask-conic":[mt]}],"mask-image-conic-from-pos":[{"mask-conic-from":ie()}],"mask-image-conic-to-pos":[{"mask-conic-to":ie()}],"mask-image-conic-from-color":[{"mask-conic-from":q()}],"mask-image-conic-to-color":[{"mask-conic-to":q()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:ee()}],"mask-repeat":[{mask:G()}],"mask-size":[{mask:te()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Fe,Oe]}],filter:[{filter:["","none",Fe,Oe]}],blur:[{blur:Ae()}],brightness:[{brightness:[mt,Fe,Oe]}],contrast:[{contrast:[mt,Fe,Oe]}],"drop-shadow":[{"drop-shadow":["","none",m,xf,yf]}],"drop-shadow-color":[{"drop-shadow":q()}],grayscale:[{grayscale:["",mt,Fe,Oe]}],"hue-rotate":[{"hue-rotate":[mt,Fe,Oe]}],invert:[{invert:["",mt,Fe,Oe]}],saturate:[{saturate:[mt,Fe,Oe]}],sepia:[{sepia:["",mt,Fe,Oe]}],"backdrop-filter":[{"backdrop-filter":["","none",Fe,Oe]}],"backdrop-blur":[{"backdrop-blur":Ae()}],"backdrop-brightness":[{"backdrop-brightness":[mt,Fe,Oe]}],"backdrop-contrast":[{"backdrop-contrast":[mt,Fe,Oe]}],"backdrop-grayscale":[{"backdrop-grayscale":["",mt,Fe,Oe]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[mt,Fe,Oe]}],"backdrop-invert":[{"backdrop-invert":["",mt,Fe,Oe]}],"backdrop-opacity":[{"backdrop-opacity":[mt,Fe,Oe]}],"backdrop-saturate":[{"backdrop-saturate":[mt,Fe,Oe]}],"backdrop-sepia":[{"backdrop-sepia":["",mt,Fe,Oe]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":I()}],"border-spacing-x":[{"border-spacing-x":I()}],"border-spacing-y":[{"border-spacing-y":I()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Fe,Oe]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[mt,"initial",Fe,Oe]}],ease:[{ease:["linear","initial",y,Fe,Oe]}],delay:[{delay:[mt,Fe,Oe]}],animate:[{animate:["none",x,Fe,Oe]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[h,Fe,Oe]}],"perspective-origin":[{"perspective-origin":L()}],rotate:[{rotate:Xe()}],"rotate-x":[{"rotate-x":Xe()}],"rotate-y":[{"rotate-y":Xe()}],"rotate-z":[{"rotate-z":Xe()}],scale:[{scale:nt()}],"scale-x":[{"scale-x":nt()}],"scale-y":[{"scale-y":nt()}],"scale-z":[{"scale-z":nt()}],"scale-3d":["scale-3d"],skew:[{skew:rt()}],"skew-x":[{"skew-x":rt()}],"skew-y":[{"skew-y":rt()}],transform:[{transform:[Fe,Oe,"","none","gpu","cpu"]}],"transform-origin":[{origin:L()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Ve()}],"translate-x":[{"translate-x":Ve()}],"translate-y":[{"translate-y":Ve()}],"translate-z":[{"translate-z":Ve()}],"translate-none":["translate-none"],zoom:[{zoom:[Zr,Fe,Oe]}],accent:[{accent:q()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:q()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Fe,Oe]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":q()}],"scrollbar-track-color":[{"scrollbar-track":q()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":I()}],"scroll-mx":[{"scroll-mx":I()}],"scroll-my":[{"scroll-my":I()}],"scroll-ms":[{"scroll-ms":I()}],"scroll-me":[{"scroll-me":I()}],"scroll-mbs":[{"scroll-mbs":I()}],"scroll-mbe":[{"scroll-mbe":I()}],"scroll-mt":[{"scroll-mt":I()}],"scroll-mr":[{"scroll-mr":I()}],"scroll-mb":[{"scroll-mb":I()}],"scroll-ml":[{"scroll-ml":I()}],"scroll-p":[{"scroll-p":I()}],"scroll-px":[{"scroll-px":I()}],"scroll-py":[{"scroll-py":I()}],"scroll-ps":[{"scroll-ps":I()}],"scroll-pe":[{"scroll-pe":I()}],"scroll-pbs":[{"scroll-pbs":I()}],"scroll-pbe":[{"scroll-pbe":I()}],"scroll-pt":[{"scroll-pt":I()}],"scroll-pr":[{"scroll-pr":I()}],"scroll-pb":[{"scroll-pb":I()}],"scroll-pl":[{"scroll-pl":I()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Fe,Oe]}],fill:[{fill:["none",...q()]}],"stroke-w":[{stroke:[mt,_d,ji,xw]}],stroke:[{stroke:["none",...q()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},UF=(e,{cacheSize:t,prefix:n,experimentalParseClassName:o,extend:r={},override:a={}})=>(ml(e,"cacheSize",t),ml(e,"prefix",n),ml(e,"experimentalParseClassName",o),Cf(e.theme,a.theme),Cf(e.classGroups,a.classGroups),Cf(e.conflictingClassGroups,a.conflictingClassGroups),Cf(e.conflictingClassGroupModifiers,a.conflictingClassGroupModifiers),ml(e,"postfixLookupClassGroups",a.postfixLookupClassGroups),ml(e,"orderSensitiveModifiers",a.orderSensitiveModifiers),bf(e.theme,r.theme),bf(e.classGroups,r.classGroups),bf(e.conflictingClassGroups,r.conflictingClassGroups),bf(e.conflictingClassGroupModifiers,r.conflictingClassGroupModifiers),Ch(e,r,"postfixLookupClassGroups"),Ch(e,r,"orderSensitiveModifiers"),e),ml=(e,t,n)=>{n!==void 0&&(e[t]=n)},Cf=(e,t)=>{if(t)for(let n in t)ml(e,n,t[n])},bf=(e,t)=>{if(t)for(let n in t)Ch(e,t,n)},Ch=(e,t,n)=>{let o=t[n];o!==void 0&&(e[n]=e[n]?e[n].concat(o):o)},Fw=(e,...t)=>typeof e=="function"?yw(ww,e,...t):yw(()=>UF(ww(),e),...t);var HF=Fw({extend:{classGroups:{"font-size":[{text:["chat","chat-row","chat-code","chat-dense","chat-meta","control-1","control-2","control-3","control-4","control-5"]}]}}});function $(...e){return HF(gw(e))}ue();var wf=Ct(!0);function Bw(){return bt(wf)}var Sh=Ct(void 0);function ea(){let e=bt(wf);return bt(Sh)??e}ue();var Sf=(...e)=>e.filter((t,n,o)=>!!t&&t.trim()!==""&&o.indexOf(t)===n).join(" ").trim();var zw=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();var Uw=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,o)=>o?o.toUpperCase():n.toLowerCase());var Ih=e=>{let t=Uw(e);return t.charAt(0).toUpperCase()+t.slice(1)};ue();var Hw={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};var $w=e=>{for(let t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};var Kw=zn(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:o,className:r="",children:a,iconNode:i,...s},l)=>De("svg",{ref:l,...Hw,width:t,height:t,stroke:e,strokeWidth:o?Number(n)*24/Number(t):n,className:Sf("lucide",r),...!a&&!$w(s)&&{"aria-hidden":"true"},...s},[...i.map(([d,c])=>De(d,c)),...Array.isArray(a)?a:[a]]));var Z=(e,t)=>{let n=zn(({className:o,...r},a)=>De(Kw,{ref:a,iconNode:t,className:Sf(`lucide-${zw(Ih(e))}`,`lucide-${e}`,o),...r}));return n.displayName=Ih(e),n};var $F=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],Dd=Z("arrow-down",$F);var KF=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],Od=Z("arrow-up-right",KF);var VF=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Fd=Z("arrow-up",VF);var qF=[["path",{d:"M10 22V7a1 1 0 0 0-1-1H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5a1 1 0 0 0-1-1H2",key:"1ah6g2"}],["rect",{x:"14",y:"2",width:"8",height:"8",rx:"1",key:"88lufb"}]],Bd=Z("blocks",qF);var WF=[["path",{d:"M17 3a2 2 0 0 1 2 2v15a1 1 0 0 1-1.496.868l-4.512-2.578a2 2 0 0 0-1.984 0l-4.512 2.578A1 1 0 0 1 5 20V5a2 2 0 0 1 2-2z",key:"oz39mx"}]],gl=Z("bookmark",WF);var GF=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],Xi=Z("bot",GF);var jF=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],ho=Z("check",jF);var QF=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],sn=Z("chevron-down",QF);var XF=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Yi=Z("chevron-left",XF);var YF=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Vo=Z("chevron-right",YF);var JF=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],zd=Z("chevron-up",JF);var ZF=[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]],Ud=Z("chevrons-left",ZF);var e2=[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]],Hd=Z("chevrons-right",e2);var t2=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],Sn=Z("circle-alert",t2);var n2=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],Ji=Z("copy",n2);var o2=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],lr=Z("ellipsis",o2);var r2=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],$d=Z("eye",r2);var a2=[["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 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}]],Zi=Z("file-code",a2);var i2=[["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"}]],es=Z("file-text",i2);var s2=[["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"}]],Kd=Z("file",s2);var l2=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],ii=Z("folder",l2);var d2=[["line",{x1:"22",x2:"2",y1:"6",y2:"6",key:"15w7dq"}],["line",{x1:"22",x2:"2",y1:"18",y2:"18",key:"1ip48p"}],["line",{x1:"6",x2:"6",y1:"2",y2:"22",key:"a2lnyx"}],["line",{x1:"18",x2:"18",y1:"2",y2:"22",key:"8vb6jd"}]],Vd=Z("frame",d2);var c2=[["path",{d:"M6 3v12",key:"qpgusn"}],["path",{d:"M18 9a3 3 0 1 0 0-6 3 3 0 0 0 0 6z",key:"1d02ji"}],["path",{d:"M6 21a3 3 0 1 0 0-6 3 3 0 0 0 0 6z",key:"chk6ph"}],["path",{d:"M15 6a9 9 0 0 0-9 9",key:"or332x"}],["path",{d:"M18 15v6",key:"9wciyi"}],["path",{d:"M21 18h-6",key:"139f0c"}]],qd=Z("git-branch-plus",c2);var u2=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],Wd=Z("globe",u2);var f2=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],Gd=Z("grip-vertical",f2);var p2=[["path",{d:"m15 12-9.373 9.373a1 1 0 0 1-3.001-3L12 9",key:"1hayfq"}],["path",{d:"m18 15 4-4",key:"16gjal"}],["path",{d:"m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172v-.344a2 2 0 0 0-.586-1.414l-1.657-1.657A6 6 0 0 0 12.516 3H9l1.243 1.243A6 6 0 0 1 12 8.485V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5",key:"15ts47"}]],jd=Z("hammer",p2);var m2=[["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"}]],ts=Z("image",m2);var g2=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],ka=Z("layers",g2);var h2=[["path",{d:"M11 5h10",key:"1cz7ny"}],["path",{d:"M11 12h10",key:"1438ji"}],["path",{d:"M11 19h10",key:"11t30w"}],["path",{d:"M4 4h1v5",key:"10yrso"}],["path",{d:"M4 9h2",key:"r1h2o0"}],["path",{d:"M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02",key:"xtkcd5"}]],Qd=Z("list-ordered",h2);var v2=[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["rect",{x:"3",y:"4",width:"6",height:"6",rx:"1",key:"cif1o7"}]],ns=Z("list-todo",v2);var y2=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],Xd=Z("list",y2);var x2=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],si=Z("loader-circle",x2);var C2=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 9.9-1",key:"1mm8w8"}]],li=Z("lock-open",C2);var b2=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],Yd=Z("lock",b2);var w2=[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}]],os=Z("message-circle",w2);var S2=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],rs=Z("message-square",S2);var I2=[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]],Jd=Z("minimize-2",I2);var T2=[["path",{d:"M14 4.1 12 6",key:"ita8i4"}],["path",{d:"m5.1 8-2.9-.8",key:"1go3kf"}],["path",{d:"m6 12-1.9 2",key:"mnht97"}],["path",{d:"M7.2 2.2 8 5.1",key:"1cfko1"}],["path",{d:"M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z",key:"s0h3yz"}]],ta=Z("mouse-pointer-click",T2);var k2=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],Zd=Z("package",k2);var L2=[["path",{d:"m14.622 17.897-10.68-2.913",key:"vj2p1u"}],["path",{d:"M18.376 2.622a1 1 0 1 1 3.002 3.002L17.36 9.643a.5.5 0 0 0 0 .707l.944.944a2.41 2.41 0 0 1 0 3.408l-.944.944a.5.5 0 0 1-.707 0L8.354 7.348a.5.5 0 0 1 0-.707l.944-.944a2.41 2.41 0 0 1 3.408 0l.944.944a.5.5 0 0 0 .707 0z",key:"18tc5c"}],["path",{d:"M9 8c-1.804 2.71-3.97 3.46-6.583 3.948a.507.507 0 0 0-.302.819l7.32 8.883a1 1 0 0 0 1.185.204C12.735 20.405 16 16.792 16 15",key:"ytzfxy"}]],as=Z("paintbrush",L2);var P2=[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]],vo=Z("paperclip",P2);var A2=[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],na=Z("pen-line",A2);var E2=[["path",{d:"M13 7 8.7 2.7a2.41 2.41 0 0 0-3.4 0L2.7 5.3a2.41 2.41 0 0 0 0 3.4L7 13",key:"orapub"}],["path",{d:"m8 6 2-2",key:"115y1s"}],["path",{d:"m18 16 2-2",key:"ee94s4"}],["path",{d:"m17 11 4.3 4.3c.94.94.94 2.46 0 3.4l-2.6 2.6c-.94.94-2.46.94-3.4 0L11 17",key:"cfq27r"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],ec=Z("pencil-ruler",E2);var R2=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],tc=Z("pencil",R2);var M2=[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]],is=Z("puzzle",M2);var N2=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],ss=Z("rotate-ccw",N2);var _2=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],ls=Z("search",_2);var D2=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],nc=Z("send",D2);var O2=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],oc=Z("settings",O2);var F2=[["path",{d:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]],hl=Z("sliders-horizontal",F2);var B2=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],di=Z("sparkles",B2);var z2=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],Ao=Z("square-pen",z2);var U2=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],rc=Z("square",U2);var H2=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],ds=Z("star",H2);var $2=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],qo=Z("terminal",$2);var K2=[["path",{d:"M17 5H3",key:"1cn7zz"}],["path",{d:"M21 12H8",key:"scolzb"}],["path",{d:"M21 19H8",key:"13qgcb"}],["path",{d:"M3 12v7",key:"1ri8j3"}]],ac=Z("text-quote",K2);var V2=[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]],oa=Z("user-round",V2);var q2=[["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"}]],ic=Z("wrench",q2);var W2=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],en=Z("x",W2);var G2=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],cs=Z("zap",G2);ue();function Ce(){return{t:sr().i18n.usePluginTranslation()}}ue();ue();var vl=Ct(null),sc=Ct(null);function If(e,t){let n=bt(sc);he(()=>{if(!(!t||e===null||n===null))return n(e)},[n,t,e])}function lc(){let e=new Map;return{rows:()=>[...e.keys()],acquire:(t,n)=>{e.set(t,(e.get(t)??0)+1),n();let o=!0;return()=>{if(!o)return;o=!1;let r=e.get(t)??0;r>1?e.set(t,r-1):e.delete(t),n()}}}}var Vw=new Set(["Select","AlertDialog","Dialog","DropdownMenu","Menu","Popover","Tooltip","Combobox"]);function le(e){let t=Vw.has(e),n=o=>{let r=sr(),a=vf(),i=ea(),s=r.ui[e],l={};if(t){let d=bt(vl),[c,f]=J(o.defaultOpen===!0),p=typeof o.open=="boolean"?o.open:c;If(d,i&&p),he(()=>{i||f(!1)},[i]),l={open:i&&p,onOpenChange:(m,...g)=>{f(m),typeof o.onOpenChange=="function"&&o.onOpenChange(m,...g)}}}return De(s,{...o,...l,...Vw.has(e)&&!i?{open:!1}:{},className:`${a} ${typeof o.className=="string"?o.className:""}`})};return n.displayName=e,n}var mY=le("useLinkContextMenu"),kr=le("ProviderInstanceIcon"),qw=le("UserAvatar"),yl=le("Badge"),ce=le("Button"),gY=le("Label"),Tf=le("Input"),Ww=le("Textarea"),hY=le("Switch"),vY=le("Separator"),yY=le("Skeleton"),kf=le("Spinner"),xY=le("ScrollArea"),CY=le("Card"),bY=le("CardAction"),wY=le("CardContent"),SY=le("CardDescription"),IY=le("CardFooter"),TY=le("CardHeader"),kY=le("CardTitle"),LY=le("Empty"),PY=le("EmptyContent"),AY=le("EmptyDescription"),EY=le("EmptyHeader"),RY=le("EmptyMedia"),MY=le("EmptyTitle"),NY=le("InputGroup"),_Y=le("InputGroupAddon"),DY=le("InputGroupInput"),OY=le("DocumentPanel"),FY=le("MasterDetail"),Lf=le("Select"),BY=le("SelectContent"),Pf=le("SelectItem"),Af=le("SelectPopup"),Gw=le("SelectTrigger"),Ef=le("SelectValue"),dc=le("Toggle"),jw=le("ToggleGroup"),Qw=le("AlertDialog"),Xw=le("AlertDialogClose"),Yw=le("AlertDialogDescription"),Jw=le("AlertDialogFooter"),Zw=le("AlertDialogHeader"),eS=le("AlertDialogPopup"),tS=le("AlertDialogTitle"),Rf=le("Dialog"),zY=le("DialogClose"),Mf=le("DialogDescription"),Nf=le("DialogFooter"),_f=le("DialogHeader"),Df=le("DialogPopup"),nS=le("DialogPanel"),Of=le("DialogTitle"),UY=le("DialogTrigger"),HY=le("DropdownMenu"),$Y=le("DropdownMenuContent"),KY=le("DropdownMenuItem"),VY=le("DropdownMenuTrigger"),Eo=le("Menu"),cc=le("MenuGroup"),qY=le("MenuGroupLabel"),dr=le("MenuItem"),Ro=le("MenuPopup"),Lr=le("MenuRadioGroup"),Wo=le("MenuRadioItem"),ci=le("MenuSeparator"),Mo=le("MenuTrigger"),xl=le("Popover"),Cl=le("PopoverPopup"),bl=le("PopoverTrigger"),oS=le("Table"),rS=le("TableBody"),ui=le("TableCell"),us=le("TableHead"),aS=le("TableHeader"),Ff=le("TableRow"),Ye=le("Tooltip"),Je=le("TooltipPopup"),Ze=le("TooltipTrigger"),iS=le("Collapsible"),sS=le("CollapsiblePanel"),lS=le("CollapsibleTrigger"),uc=le("Alert"),fc=le("AlertAction"),Bf=le("AlertDescription"),Th=le("AlertTitle"),zf=le("Kbd"),Uf=le("Command"),Hf=le("CommandGroup"),$f=le("CommandItem"),Kf=le("CommandList"),dS=le("Combobox"),cS=le("ComboboxEmpty"),uS=le("ComboboxInput"),wl=le("ComboboxItem"),fS=le("ComboboxListVirtualized"),pS=le("TooltipProvider"),mS=le("StyledDiffCodeView"),gS=le("DevBackdropArt"),cr=le("Markdown"),hS=le("DiffView");var{jsx:u,jsxs:b,Fragment:Le}=window.__ycodiumPluginHost.jsxRuntime;function vS({mode:e,onModeChange:t}){let{t:n}=Ce();return b(jw,{className:"shrink-0","data-view-mode-toggle":!0,size:"xs","aria-label":n("trajectory.toggleLabel"),variant:"segmented",value:[e],onValueChange:o=>{let r=o[0];(r==="chat"||r==="trajectory")&&t(r)},children:[b(dc,{value:"chat","aria-label":n("trajectory.toggleChat"),children:[u(rs,{"aria-hidden":!0}),n("trajectory.toggleChat")]}),b(dc,{value:"trajectory","aria-label":n("trajectory.toggleTrajectory"),children:[u(Qd,{"aria-hidden":!0}),n("trajectory.toggleTrajectory")]})]})}function yS({mode:e,visible:t,chat:n,trajectory:o}){let r=e==="chat"?"chat":"trajectory";return u("div",{className:"relative flex min-h-0 flex-1 flex-col","aria-hidden":t?void 0:!0,inert:t?void 0:!0,"data-chat-view-pane":r,"data-pane-visible":t?"true":"false",children:u(Sh,{value:t,children:r==="chat"?n:o})})}ue();function eo(){return{t:sr().i18n.usePluginTranslation()}}function xS(e){if(e.cacheDisjoint!==!0)return null;let t=e.cachedInputTokens,n=e.inputTokens;if(t===void 0||n===void 0)return null;let o=t+n;if(o<=0)return null;if(t>=o)return"100%";let r=t/o*100;for(let a=0;a<=3;a+=1){let i=r.toFixed(a);if(Number.parseFloat(i)<100)return`${i}%`}return"99.9%"}function CS(e){let t,n,o,r=!0,a=!1;for(let i of e)i!==void 0&&(a=!0,i.cacheDisjoint!==!0&&(r=!1),i.outputTokens!==void 0&&(t=(t??0)+i.outputTokens),i.inputTokens!==void 0&&(n=(n??0)+i.inputTokens),i.cachedInputTokens!==void 0&&(o=(o??0)+i.cachedInputTokens));if(!(t===void 0&&n===void 0&&o===void 0))return{...a&&r?{cacheDisjoint:!0}:{},...t!==void 0?{outputTokens:t}:{},...n!==void 0?{inputTokens:n}:{},...o!==void 0?{cachedInputTokens:o}:{}}}function pc(e){return e<1e3?String(Math.round(e)):e<1e6?`${(e/1e3).toFixed(1).replace(/\.0$/,"")}k`:`${(e/1e6).toFixed(1).replace(/\.0$/,"")}m`}var j2=pe(function({item:t,ordinal:n,usage:o,onSelect:r}){return b("button",{type:"button","data-turn-navigator-row":t.sectionKey,onClick:()=>r(t),className:"flex w-full cursor-pointer items-start gap-2.5 rounded-md px-2 py-1.5 text-left transition-colors hover:bg-accent",children:[u("span",{className:"shrink-0 pt-px font-mono text-[10px] text-muted-foreground tabular-nums",children:n}),b("span",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[u("span",{className:"line-clamp-2 min-w-0 font-medium text-chat leading-snug",children:t.userText}),t.assistantText?b("span",{className:"flex items-baseline gap-2",children:[u("span",{className:"line-clamp-1 min-w-0 flex-1 text-[11px] text-muted-foreground leading-snug",children:t.assistantText}),o?.outputTokens!==void 0?u("span",{className:"shrink-0 font-mono text-[9px] text-muted-foreground tabular-nums",children:pc(o.outputTokens)}):null]}):null]})]})});function Q2({totals:e}){let{t}=eo();if(!e)return null;let n=xS(e),o=[e.outputTokens===void 0?null:{label:t("turnNavigator.usageOutput"),value:pc(e.outputTokens)},e.inputTokens===void 0?null:{label:t("turnNavigator.usageInput"),value:pc(e.inputTokens)},e.cachedInputTokens===void 0?null:{label:t("turnNavigator.usageCacheRead"),value:n===null?pc(e.cachedInputTokens):`${pc(e.cachedInputTokens)} (${n})`}].filter(r=>r!==null);return o.length===0?null:b("div",{className:"flex items-baseline gap-2 border-t px-2 py-1.5",children:[u("span",{className:"flex-1 font-mono text-[10px] text-muted-foreground uppercase tracking-[0.14em]",children:t("turnNavigator.usage")}),o.map(r=>b("span",{className:"shrink-0 font-mono text-[10px] text-muted-foreground tabular-nums",children:[r.label," ",r.value]},r.label))]})}var X2=pe(function({getText:t,size:n="xs",variant:o="outline",className:r}){let{t:a}=eo(),i=sr().writeClipboard,[s,l]=J(!1),d=a("turnNavigator.copyMarkdown");return b(Ye,{children:[u(Ze,{render:u(ce,{"aria-label":d,disabled:s,onClick:()=>{i(t()).then(()=>{l(!0),window.setTimeout(()=>l(!1),1e3)})},type:"button",size:n,variant:o,className:$("text-muted-foreground hover:text-foreground",r)}),children:s?u(ho,{className:"size-3 text-primary"}):u(Ji,{className:"size-3"})}),u(Je,{children:u("p",{children:d})})]})});function bS({items:e,totalTurnCount:t,bottomInset:n,usageByTurnId:o,onSelect:r,exportMarkdown:a,onDownload:i,placement:s="float"}){let{t:l}=eo(),[d,c]=J(!1),f=K(()=>e.map((h,v)=>({item:h,ordinal:v+1})).reverse(),[e]),p=K(()=>CS(f.map(({item:h})=>h.turnId===null?void 0:o.get(h.turnId))),[f,o]);if(e.length===0)return null;let m=t??e.length,g=l("turnNavigator.open",{count:m});return b(xl,{onOpenChange:c,open:d,children:[b(bl,{render:u(ce,{"aria-label":g,className:$("gap-1.5 rounded-full px-3",s==="float"&&"absolute right-3 z-40"),"data-testid":"turn-navigator-pill",size:"xs",style:s==="float"?{bottom:n+12}:void 0,title:g,variant:"glass"}),children:[u(Xd,{"aria-hidden":!0}),u("span",{className:"font-mono font-semibold text-[11px] tabular-nums",children:m})]}),u(Cl,{align:"end",className:"w-80 flex-col",side:"top",children:b("div",{className:"flex max-h-[min(60vh,26rem)] flex-col",children:[b("div",{className:"flex items-center gap-1.5 border-b px-2 py-1.5",children:[u("span",{className:"flex-1 font-mono text-[10px] text-muted-foreground uppercase tracking-[0.14em]",children:l("turnNavigator.title")}),u("span",{className:"font-mono text-[10px] text-muted-foreground tabular-nums",children:m})]}),u("div",{className:$("min-h-0 flex-1 overflow-y-auto overflow-x-hidden p-1"),children:f.map(({item:h,ordinal:v})=>u(j2,{item:h,onSelect:y=>{c(!1),r(y)},ordinal:v,usage:h.turnId===null?void 0:o.get(h.turnId)},h.sectionKey))}),u(Q2,{totals:p}),b("div",{className:"flex items-center gap-1 border-t px-2 py-1.5",children:[u("span",{className:"flex-1 font-mono text-[10px] text-muted-foreground uppercase tracking-[0.14em]",children:l("turnNavigator.export")}),u(X2,{size:"icon-xs",getText:a,variant:"ghost"}),u(ce,{"aria-label":l("turnNavigator.downloadMarkdown"),onClick:()=>i("md"),size:"xs",title:l("turnNavigator.downloadMarkdown"),variant:"ghost",children:u("span",{className:"font-mono text-[10px]",children:".md"})}),u(ce,{"aria-label":l("turnNavigator.downloadJson"),onClick:()=>i("json"),size:"xs",title:l("turnNavigator.downloadJson"),variant:"ghost",children:u("span",{className:"font-mono text-[10px]",children:".json"})})]})]})})]})}ue();ue();function Y2(e){return e!==null&&"tagName"in e&&"closest"in e}function fi(e){return Y2(e)?e.tagName==="INPUT"||e.tagName==="TEXTAREA"?!0:e.closest('[contenteditable]:not([contenteditable="false"])')!==null:!1}function kh(e,t){if(!/^[1-9]$/.test(e))return null;let n=Number(e)-1;return n<t?n:null}function wS(e,t){let n=e.findIndex(o=>o.decision===t);return n===-1?null:{type:"respond",index:n}}function SS(e,t){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return null;switch(e.key){case"Enter":return wS(t,"accept");case"Escape":return wS(t,"cancel");case"ArrowDown":case"ArrowRight":return{type:"move",delta:1};case"ArrowUp":case"ArrowLeft":return{type:"move",delta:-1};default:{let n=kh(e.key,t.length);return n===null?null:{type:"respond",index:n}}}}ue();var Sl=new Map,IS=24,J2=4e3,Z2=1024,TS=16384;function Lh(e){let t=Sl.get(e);if(t)return t;let n={values:new Map,listeners:new Set,stringLength:0};if(Sl.set(e,n),Sl.size>IS){for(let[o,r]of Sl)if(r.listeners.size===0&&o!==e&&(Sl.delete(o),Sl.size<=IS))break}return n}function Ph(e,t,n){return Lh(e).values.get(t)??n}function mc(e,t,n,o=!0){let r=Lh(e);if(typeof n=="string"&&(n=n.slice(0,Z2)),r.values.get(t)===n)return;let a=r.values.get(t);if(typeof a=="string"&&(r.stringLength-=a.length),r.values.delete(t),r.values.set(t,n),typeof n=="string"&&(r.stringLength+=n.length),r.stringLength>TS){for(let[i,s]of r.values)if(!(typeof s!="string"||i===t)&&(r.values.delete(i),r.stringLength-=s.length,r.stringLength<=TS))break}if(r.values.size>J2){let i=r.values.keys().next().value;if(i!==void 0){let s=r.values.get(i);typeof s=="string"&&(r.stringLength-=s.length),r.values.delete(i)}}o&&r.listeners.forEach(i=>i())}function Go(e,t,n){let o=R(s=>{let l=Lh(e);return l.listeners.add(s),()=>l.listeners.delete(s)},[e]),r=R(()=>Ph(e,t,n),[e,t,n]),a=Ko(o,r,r),i=R(s=>mc(e,t,s),[e,t]);return[a,i]}function Vf(e){return JSON.stringify([e.turnId??null,e.toolCallId?"tool":"entry",e.toolCallId||e.id])}function kS(e){let t=e.map(o=>({key:o.key,turnId:o.turnId,firstRowIndex:o.firstRowIndex,endRowIndex:o.firstRowIndex+o.rowIds.length})),n=new Map;for(let o of e)for(let[r,a]of o.rowIds.entries())n.set(a,{turnId:o.turnId,index:o.firstRowIndex+r});return{sections:t,bySectionKey:new Map(t.map(o=>[o.key,o])),byRowId:n}}function qf({index:e,visibleSectionKeys:t,protectedRowIds:n,selectionRows:o}){let r=t.flatMap(d=>{let c=e.bySectionKey.get(d)?.turnId;return c==null?[]:[c]}),a=n.flatMap(d=>{let c=e.byRowId.get(d)?.turnId;return c==null?[]:[c]}),i=o?e.byRowId.get(o.firstRowId)?.index:void 0,s=o?e.byRowId.get(o.lastRowId)?.index:void 0,l=i===void 0||s===void 0?[]:e.sections.flatMap(d=>d.turnId!==null&&d.endRowIndex>Math.min(i,s)&&d.firstRowIndex<=Math.max(i,s)?[d.turnId]:[]);return{firstTurnId:r[0]??null,lastTurnId:r.at(-1)??null,protectedTurnIds:[...new Set(a)],selectionTurnRange:l.length>0?{firstTurnId:l[0],lastTurnId:l.at(-1)}:null}}function LS(e,t,n,o){if(!o)return n;let r=e.findIndex(a=>t.has(a));return r<0?n:Math.max(n,e.length-r)}ue();ue();function Ah(e,t){for(let n of e.querySelectorAll("[data-timeline-row-id]"))if(n.dataset.timelineRowId===t)return n;return null}function fs(e,t){let n=0,o=e.length,r=-1;for(;n<o;){let a=Math.floor((n+o)/2),s=e[a].getBoundingClientRect();Math.max(s.bottom,s.top+1)>t?(r=a,o=a):n=a+1}return r}function eB(e){let t=e.getBoundingClientRect().top,n=e.querySelectorAll("[data-timeline-turn-section]"),o=a=>{let i=a.querySelectorAll("[data-timeline-row-id]"),s=fs(i,t),l=s<0?void 0:i[s],d=l?.dataset.timelineRowId;return!l||d===void 0?null:{rowId:d,offsetPx:Math.round(t-l.getBoundingClientRect().top)}};if(n.length===0)return o(e);let r=fs(n,t);if(r<0)return null;for(let a=r;a<n.length;a+=1){let i=o(n[a]);if(i)return i}return null}function PS(e,t){let n=0,o=e;for(;o&&o!==t;)n+=o.offsetTop,o=o.offsetParent;return n}var Eh=class extends Sa{getSnapshotBeforeUpdate(t){return t.inputKey!==this.props.inputKey&&t.onBeforeInputChange(),null}componentDidUpdate(){}componentWillUnmount(){this.props.onBeforeInputChange()}render(){return this.props.children}};function AS({inputKey:e,onBeforeInputChange:t,handleRef:n,onAttach:o,className:r,children:a,onScroll:i,onInteractionRowsChange:s}){let l=N(null),d=N({inputKey:e,store:lc()});d.current.inputKey!==e&&(d.current={inputKey:e,store:lc()});let c=N(s);c.current=s;let f=R(m=>{let g=d.current;return g.store.acquire(m,()=>{d.current===g&&c.current?.(g.store.rows())})},[]);he(()=>{s?.(d.current.store.rows())},[e,s]),ir(n,()=>({get node(){return l.current},measure:()=>{let m=l.current;return m?{scroll:m.scrollTop,scrollLength:m.clientHeight,contentLength:m.scrollHeight,topOf:g=>{let h=Ah(m,g);return h===null?null:PS(h,m)},heightOf:g=>{let h=Ah(m,g);return h===null?null:h.offsetHeight},rowAtScroll:()=>eB(m)}:null},scrollToEnd:m=>{let g=l.current;if(g){if(m?.animated){g.scrollTo({top:g.scrollHeight,behavior:"smooth"});return}g.scrollTop=g.scrollHeight-g.clientHeight}},scrollToRow:(m,g)=>{let h=l.current;if(!h)return!1;let v=Ah(h,m);return v?(h.scrollTop=Math.max(0,PS(v,h)-(g?.viewOffset??0)),!0):!1},scrollToOffset:m=>{let g=l.current;g&&(g.scrollTop=Math.max(0,m))}}),[]);let p=R(m=>{l.current=m,o(m)},[o]);return u(Eh,{inputKey:e,onBeforeInputChange:t,children:u(sc,{value:f,children:u("div",{ref:p,className:r,style:{position:"relative"},onScroll:i,children:a})})})}function Tl(e){if(!e)return!1;let t=e.tagName?.toLowerCase(),n=e.getAttribute?.("contenteditable");if(t==="textarea"||n==="true"||n===""||n==="plaintext-only"||"isContentEditable"in e&&e.isContentEditable===!0)return!0;if(t==="input"){let o=e.getAttribute?.("type")?.toLowerCase()??"text";if(!["button","submit","reset","image","checkbox","radio"].includes(o))return!0}return e.matches?.(":focus-visible")??!1}function Il(e,t){let o=(e?.nodeType===1?e:e?.parentElement)?.closest("[data-timeline-row-id]");return o&&t.contains(o)?o.dataset.timelineRowId??null:null}function Wf(e){let t=e.ownerDocument.getSelection?.();if(!t||t.isCollapsed)return null;let n=null,o=null;for(let d=0;d<t.rangeCount;d+=1){let c=t.getRangeAt(d);c.intersectsNode(e)&&(n??=c,o=c)}if(!n||!o)return null;let r=Il(n.startContainer,e),a=Il(o.endContainer,e);if(r&&a)return{firstRowId:r,lastRowId:a};let i=e.querySelectorAll("[data-timeline-row-id]"),s=i[0]?.dataset.timelineRowId,l=i[i.length-1]?.dataset.timelineRowId;return s&&l?{firstRowId:r??s,lastRowId:a??l}:null}function gc(e){let t=e.ownerDocument.getSelection?.();if(!t||t.isCollapsed)return!1;for(let n=0;n<t.rangeCount;n+=1)if(t.getRangeAt(n).intersectsNode(e))return!0;return!1}ue();function pi(e){let t=N(e);t.current=e;let n=N(!1),o=N(null),r=N(null),a=N(0),i=R(()=>{a.current+=1,r.current!==null&&cancelAnimationFrame(r.current),r.current=null},[]),s=R(()=>{if(!n.current||!t.current||r.current!==null||o.current===null)return;let c=++a.current;r.current=requestAnimationFrame(f=>{if(c!==a.current||(r.current=null,!n.current||!t.current))return;let p=o.current;o.current=null,p?.(f)})},[]),l=R(c=>{o.current=c,s()},[s]),d=R(()=>{o.current=null,i()},[i]);return he(()=>(n.current=!0,s(),()=>{n.current=!1,i()}),[e,i,s]),K(()=>({request:l,cancel:d}),[l,d])}function ES({root:e,inputKey:t,visible:n,index:o,topInset:r,bottomInset:a,interactionRows:i,onRangeChange:s,onSelectionChange:l}){let d=N({inputKey:t,visible:n,index:o,topInset:r,bottomInset:a,interactionRows:i,onRangeChange:s,onSelectionChange:l});d.current={inputKey:t,visible:n,index:o,topInset:r,bottomInset:a,interactionRows:i,onRangeChange:s,onSelectionChange:l};let c=pi(n),f=N(null),p=R(()=>{let g=d.current;if(!e||!g.visible||e.clientHeight<=0)return;let h=e.getBoundingClientRect();if(h.height<=0)return;let v=h.top+g.topInset,y=h.bottom-g.bottomInset,x=e.querySelectorAll("[data-timeline-turn-section]"),C=fs(x,v),w=[];if(C>=0)for(let T=C;T<x.length;T+=1){let A=x[T];if(A.getBoundingClientRect().top>=y)break;A.dataset.timelineTurnSection!==void 0&&w.push(A.dataset.timelineTurnSection)}let L=[...g.interactionRows()],S=e.ownerDocument.activeElement;if(Tl(S)){let T=Il(S,e);T&&L.push(T)}let k=qf({index:g.index,visibleSectionKeys:w,protectedRowIds:L,selectionRows:Wf(e)}),I=`${g.inputKey}:${JSON.stringify(k)}`;I!==f.current&&(f.current=I,g.onRangeChange?.(k))},[e]),m=R(()=>c.request(p),[c,p]);return he(()=>{if(f.current=null,!n||!e)return;let g=t,h=!0,v=()=>{!h||d.current.inputKey!==g||!d.current.visible||(d.current.onSelectionChange(gc(e)),m())};e.addEventListener("scroll",v,{passive:!0}),e.addEventListener("focusin",v),e.addEventListener("focusout",v),e.ownerDocument.addEventListener("selectionchange",v);let y=typeof ResizeObserver>"u"?null:new ResizeObserver(v);return y?.observe(e),e.firstElementChild&&y?.observe(e.firstElementChild),v(),()=>{h=!1,c.cancel(),y?.disconnect(),e.removeEventListener("scroll",v),e.removeEventListener("focusin",v),e.removeEventListener("focusout",v),e.ownerDocument.removeEventListener("selectionchange",v),s?.(null)}},[c,t,s,m,e,n]),he(()=>{n&&m()},[o,m,n]),m}ue();function La(e){if(!Number.isFinite(e)||e<0)return"0ms";if(e<1e3)return`${Math.max(1,Math.round(e))}ms`;if(e<1e4){let i=Math.round(e/100)/10;return i>=10?"10s":`${i.toFixed(1)}s`}if(e<6e4)return`${Math.round(e/1e3)}s`;let t=Math.round(e/1e3),n=Math.floor(t/3600),o=Math.floor(t%3600/60),r=t%60,a=[];return n>0&&a.push(`${n}h`),o>0&&a.push(`${o}m`),r>0&&a.push(`${r}s`),a.join(" ")}function tB(e,t){let n={hour:"numeric",minute:"2-digit",...t?{second:"2-digit"}:{}};return e==="locale"?n:{...n,hour12:e==="12-hour"}}function nB(e){let t=e?.trim();if(t)try{return Intl.DateTimeFormat.supportedLocalesOf([t]),t}catch{return}}function oB(){return typeof window>"u"?null:window.desktopBridge?.getSystemLocale?.()??null}var Rh=nB(oB()),RS=new Map;function MS(e,t){let n=`${e}:${t?"seconds":"minutes"}`,o=RS.get(n);if(o)return o;let r=new Intl.DateTimeFormat(Rh,tB(e,t));return RS.set(n,r),r}function Mh(e){let t=new Date(e);return Number.isNaN(t.getTime())?null:t}var rB=new Intl.DateTimeFormat(void 0,{month:"long"});function aB(e){let t=e%100;if(t>=11&&t<=13)return"th";switch(e%10){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}}function iB(e,t){let n=Mh(e);return n?MS(t,!1).format(n):""}function ra(e,t){let n=Mh(e);if(!n)return"";let o=iB(e,t),r=n.getDate(),a=rB.format(n),i=n.getFullYear();return`${o}, ${r}${aB(r)} ${a} ${i}`}var sB=new Intl.DateTimeFormat(Rh,{month:"numeric",day:"numeric"}),lB=new Intl.DateTimeFormat(Rh,{month:"numeric",day:"numeric",year:"numeric"});function mi(e,t,n,o=Date.now()){let r=Mh(e);if(!r)return"";let a=MS(t,!1).format(r),i=new Date(o),s=new Date(i.getFullYear(),i.getMonth(),i.getDate()).getTime(),l=new Date(r.getFullYear(),r.getMonth(),r.getDate()).getTime(),d=Math.round((s-l)/864e5);return d<=0?a:d===1?n("relativeTime.yesterdayAt",{time:a}):`${(r.getFullYear()===i.getFullYear()?sB:lB).format(r)} ${a}`}ue();ue();var kl=class extends Error{reason;constructor(t,n,o){super(n,o),this.reason=t}};function dB(e){if(typeof document>"u"||typeof document.execCommand!="function")return!1;let t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.setAttribute("aria-hidden","true"),t.style.position="fixed",t.style.top="0",t.style.left="0",t.style.opacity="0",t.style.fontSize="16px";let n=document.activeElement;document.body.appendChild(t);try{return t.focus({preventScroll:!0}),t.select(),t.setSelectionRange(0,e.length),document.execCommand("copy")}catch{return!1}finally{t.remove();let o=n?.focus;typeof o=="function"&&o.call(n)}}async function cB(e,t){let n=()=>new kl("unavailable",`Clipboard API is unavailable while copying ${t}.`);if(typeof window>"u")throw n();if(!e)return!1;if(typeof navigator>"u"||!navigator.clipboard?.writeText){if(dB(e))return!0;throw n()}try{return await navigator.clipboard.writeText(e),!0}catch(o){throw new kl("write-failed",`Failed to copy ${t} to the clipboard.`,{cause:o})}}function Gf({timeout:e=2e3,target:t="text",onCopy:n,onError:o}={}){let[r,a]=J(!1),i=N(null),s=N(n),l=N(o),d=N(t),c=N(e);s.current=n,l.current=o,d.current=t,c.current=e;let f=R((p,m)=>{cB(p,d.current).then(g=>{g&&(i.current&&clearTimeout(i.current),a(!0),s.current?.(m),c.current!==0&&(i.current=setTimeout(()=>{a(!1),i.current=null},c.current)))},g=>{l.current?.(g instanceof Error?g:new Error(String(g)),m)})},[]);return W(()=>()=>{i.current&&clearTimeout(i.current)},[]),{copyToClipboard:f,isCopied:r}}function ut(){let e=sr().i18n.usePluginTranslation();return{t:(t,n)=>e(t,n)}}var NS=1e3,uB={unavailable:"copyButton.clipboardUnavailable","write-failed":"copyButton.copyFailedDetail"};function fB({title:e,description:t}){return b("span",{role:"status",className:"dropdown-glass pointer-events-none fixed z-100 rounded-md px-2 py-1 text-balance text-popover-foreground text-xs shadow-xl shadow-black/25",children:[e,t?u("span",{className:"block text-muted-foreground",children:t}):null]})}var Ll=pe(function({text:t,size:n="xs",variant:o="outline",className:r,toastAnchor:a="above"}){let{t:i}=ut(),s=N(null),[l,d]=J(null),c=N(null),f=(g,h)=>{let v=s.current?.getBoundingClientRect();v&&(c.current&&clearTimeout(c.current),d({top:a==="above"?Math.max(4,v.top-(h===void 0?26:40)):Math.min(window.innerHeight-26,v.bottom+4),left:Math.max(4,v.left+v.width/2),title:g,description:h}),c.current=setTimeout(()=>d(null),NS))};W(()=>()=>{c.current&&clearTimeout(c.current)},[]);let{copyToClipboard:p,isCopied:m}=Gf({onCopy:()=>f(i("copyButton.copied")),onError:g=>f(i("copyButton.failedToCopy"),g instanceof kl?i(uB[g.reason]):g.message),timeout:NS});return b(Ye,{children:[u(Ze,{render:u(ce,{"aria-label":i("copyButton.copyToClipboard"),disabled:m,onClick:()=>p(t),ref:s,type:"button",size:n,variant:o,className:$("text-muted-foreground hover:text-foreground",r)}),children:m?u(ho,{className:"size-3 text-primary"}):u(Ji,{className:"size-3"})}),u(Je,{children:u("p",{children:i("copyButton.copyToClipboard")})}),l?u("span",{"aria-hidden":!0,className:"pointer-events-none fixed",style:{top:l.top,left:l.left},children:u("span",{className:"relative block -translate-x-1/2",children:u(fB,{title:l.title,description:l.description})})}):null]})});function pB(e){return e<1e3?Math.round(e).toLocaleString():e<1e6?`${(e/1e3).toFixed(1).replace(/\.0$/,"")}k`:`${(e/1e6).toFixed(1).replace(/\.0$/,"")}m`}function jf({label:e,children:t}){let[n,o]=J(!1);return b(Ye,{open:n,onOpenChange:o,children:[u(Ze,{render:u("button",{type:"button",className:"inline-flex items-center gap-1 rounded-sm"}),"aria-label":e,onClick:()=>o(r=>!r),children:t}),u(Je,{children:e})]})}var _S=pe(function({footer:t,timestampFormat:n,copyText:o}){let{t:r}=ut(),a=t.state,i=r(a==="completed"?"timeline.completed":a==="error"?"timeline.error":a==="interrupted"?"timeline.interrupted":"timeline.unknown");return b("div",{"data-turn-summary":t.turnId,className:"chat-process-meta flex min-w-0 items-center gap-2 px-1 text-muted-foreground",children:[b("div",{className:"flex min-w-0 flex-1 flex-wrap items-center gap-x-2 gap-y-1",children:[a!=="unknown"?b(jf,{label:i,children:[a==="completed"?u(ho,{className:"size-icon-1 text-success","aria-hidden":!0}):a==="error"?u(en,{className:"size-icon-1 text-destructive","aria-hidden":!0}):u(rc,{className:"size-3","aria-hidden":!0}),u("span",{className:"sr-only",children:i})]}):null,t.completedAt?u(jf,{label:ra(t.completedAt,n),children:u("time",{dateTime:t.completedAt,children:mi(t.completedAt,n,r)})}):null,t.workingElapsedMs!==void 0?b(jf,{label:r("timeline.workingTime",{duration:La(t.workingElapsedMs)}),children:[u("span",{"aria-hidden":!0,children:"\xB7 "}),La(t.workingElapsedMs)]}):null,t.outputTokens!==void 0?b(jf,{label:`${r("timeline.outputTokens")}: ${t.outputTokens.toLocaleString()}`,children:[u("span",{"aria-hidden":!0,children:"\xB7 "}),pB(t.outputTokens)]}):null]}),o?u(Ll,{text:o,variant:"ghost",size:"icon-xs",className:"shrink-0",toastAnchor:"below"}):null]})});ue();ue();function DS(e){if(e<1e3)return String(e);if(e<1e6){let n=e/1e3;return`${n<10?n.toFixed(1).replace(/\.0$/,""):Math.round(n)}k`}if(e<1e9){let n=e/1e6;return`${n<10?n.toFixed(1).replace(/\.0$/,""):Math.round(n)}m`}let t=e/1e9;return`${t<10?t.toFixed(1).replace(/\.0$/,""):Math.round(t)}b`}var OS=pe(function(t){let{additions:n,deletions:o,className:r,showParentheses:a=!1,layout:i="aligned"}=t,{t:s}=ut(),l=new Intl.ListFormat(void 0,{type:"unit"}).format([s("changedFiles.additions",{count:n}),s("changedFiles.deletions",{count:o})]);return b(Le,{children:[a&&u("span",{className:"text-muted-foreground/70",children:"("}),b("span",{role:"group","aria-label":l,className:$(i==="inline"?"inline-flex items-center gap-1 tabular-nums align-middle":"inline-grid grid-cols-[4ch_4ch] gap-2 text-right tabular-nums align-middle",r),children:[b("span",{"aria-hidden":"true",className:"font-mono text-diff-addition",children:["+",DS(n)]}),b("span",{"aria-hidden":"true",className:"font-mono text-diff-deletion",children:["-",DS(o)]})]}),a&&u("span",{className:"text-muted-foreground/70",children:")"})]})});function mB(e){let t=e,n,o,r=t.match(/:(\d+)$/);if(!r?.[1])return{path:t,line:void 0,column:void 0};n=r[1],t=t.slice(0,-r[0].length);let a=t.match(/:(\d+)$/);return a?.[1]?(o=a[1],t=t.slice(0,-a[0].length)):(o=n,n=void 0),{path:t,line:o,column:n}}function FS(e){return e.replaceAll("\\","/")}function BS(e){return/^\/[A-Za-z]:\//.test(e)?e.slice(1):e}function gB(e){return e.replace(/[\\/]+$/,"")}function hB(e){let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t>=0?e.slice(t+1):e}function vB(e){return e.replace(/^\.\/+/,"").replace(/^\/+/,"")}function yB(e){return e.startsWith("/")||/^[A-Za-z]:\//.test(e)}function Qf(e,t){let{path:n,line:o,column:r}=mB(e),a=BS(FS(n)),i=a;if(t){let s=BS(FS(gB(t))),l=hB(s),d=a.toLowerCase(),c=s.toLowerCase(),f=`${c}/`,p=`${l.toLowerCase()}/`;if(d===c)i=l;else if(d.startsWith(f)){let m=a.slice(s.length+1);i=`${l}/${m}`}else if(!yB(a)){let m=vB(a);i=d.startsWith(p)?a:`${l}/${m}`}}return o?`${i}:${o}${r?`:${r}`:""}`:i}function zS(e){return e==="failed"?"failed":e==="running"?"running":"idle"}function US(e){return e.includes("failed")?"failed":e.includes("running")?"running":"idle"}var Xf="chat-process-row flex w-full min-w-0 items-center gap-1.5 px-2 text-left";function hc({children:e}){return u("span",{"aria-hidden":!0,className:"flex size-4 shrink-0 items-center justify-center",children:e})}function vc({status:e}){return u("span",{"aria-hidden":!0,className:"flex size-2 shrink-0 items-center justify-center",children:e===null?null:u("span",{className:$("block size-2 rounded-full",e==="failed"?"bg-destructive":e==="success"?"bg-success":"border border-muted-foreground/60")})})}function Yf({state:e,variant:t="inline",className:n,children:o}){return b("div",{"data-process-state":e,"data-process-kind":t,className:$("chat-process-shell relative min-w-0 overflow-hidden",t==="tool"?"rounded-lg bg-card":"rounded-md",n),children:[e==="running"?u("span",{"aria-hidden":!0,className:"chat-process-shell-pulse animate-status-pulse"}):null,o]})}function yc({name:e,className:t}){switch(e){case"bot":return u(Xi,{className:t,"aria-hidden":!0});case"check":return u(ho,{className:t,"aria-hidden":!0});case"circle-alert":return u(Sn,{className:t,"aria-hidden":!0});case"eye":return u($d,{className:t,"aria-hidden":!0});case"globe":return u(Wd,{className:t,"aria-hidden":!0});case"hammer":return u(jd,{className:t,"aria-hidden":!0});case"message-circle":return u(os,{className:t,"aria-hidden":!0});case"search":return u(ls,{className:t,"aria-hidden":!0});case"square-pen":return u(Ao,{className:t,"aria-hidden":!0});case"terminal":return u(qo,{className:t,"aria-hidden":!0});case"wrench":return u(ic,{className:t,"aria-hidden":!0});case"x":return u(en,{className:t,"aria-hidden":!0});case"zap":return u(cs,{className:t,"aria-hidden":!0})}}function xB(e){switch(e){case"read":return"eye";case"edit":return"square-pen";case"command":return"terminal";case"search":return"globe";case"code-search":return"search";case"other":return"wrench";case"dynamic-tool":return"hammer";case"agent-tool":return"bot";case"tone-tool":return"zap";case"mixed":case null:return"hammer"}}function Nh(e,t){let n=new Map;for(let o of e){let r=t(o);n.set(r,(n.get(r)??0)+1)}return Array.from(n,([o,r])=>({action:o,icon:xB(o),count:r}))}function _h(e,t){let n;for(let o of Nh(e,t))(!n||o.count>n.count)&&(n=o);return n?.icon??"wrench"}var Pl=20;function Al(e){return Vf(e)}function HS(e,t,n){let o=e.toolLabel,r=n.resolveToolCommand(e);if(r&&o?.descriptive&&!o.path&&o.detail?.trim())return o.detail.replace(/\s+/g," ").trim();for(let p of[e.rawCommand,e.command]){let m=n.parseToolCommandInput(p)?.description;if(m)return m.replace(/\s+/g," ").trim()}if(r)return r.replace(/\s+/g," ").trim();let a=typeof e.toolData=="object"&&e.toolData!==null&&!Array.isArray(e.toolData)?e.toolData:null,i=typeof a?.toolName=="string"?a.toolName:typeof a?.name=="string"?a.name:void 0,s=o?.name??i??e.toolTitle??e.label,l=o?.path??e.changedFiles?.[0],d=l?Qf(l,t):void 0,c=[s.trim().toLowerCase()==="tool"?void 0:s,d,o?.detail??e.detail],f=[];for(let p of c){let m=p?.replace(/\s+/g," ").trim();m&&!f.some(g=>g.toLowerCase()===m.toLowerCase())&&f.push(m)}return f.join(" ")||null}function $S({entry:e,failed:t}){let n=e.toolLabel?.diffStat;return!n||t||Dh(e)?null:u(OS,{...n,layout:"inline",className:"chat-process-meta ms-2 shrink-0"})}function Dh(e){return e.toolLifecycleStatus==="declined"||e.toolLifecycleStatus==="stopped"}function KS({toolIcon:e,glyphClassName:t}){let n=bt(fn),o=n.SiteIcon;return e.pageUrl!==void 0&&o!==void 0?u(o,{threadRef:n.threadRef,pageUrl:e.pageUrl,className:"size-3.5 shrink-0 rounded-sm object-contain"}):u(yc,{name:"globe",className:t})}function CB({entry:e,failed:t=!1,derive:n}){return t?u(Sn,{"aria-hidden":!0,className:"size-icon-1 shrink-0 text-destructive"}):e.toolIcon!==void 0?u(KS,{toolIcon:e.toolIcon,glyphClassName:"size-icon-1 shrink-0 stroke-[1.8] text-muted-foreground opacity-70"}):u(yc,{name:_h([e],n.toolGroupAction),className:"size-icon-1 shrink-0 stroke-[1.8] text-muted-foreground opacity-70"})}function bB({entries:e,failed:t,derive:n}){let{t:o}=ut(),r=K(()=>Nh(e,n.toolGroupAction),[e,n]),a=r.length===1;return a&&r[0].count<2?null:u("span",{className:"chat-process-meta flex shrink-0 items-center gap-2 tabular-nums","aria-label":o("toolGroup.calls",{count:e.length}),children:r.map(({action:i,icon:s,count:l})=>b("span",{"aria-hidden":!0,className:"flex items-center gap-1",children:[a?null:u(yc,{name:s,className:$("size-icon-1 shrink-0 stroke-[1.8] opacity-70",t?"text-destructive":"text-icon-muted")}),l]},i))})}function VS({entry:e}){let t=bt(fn),n=e.detail??e.command??e.rawCommand??e.toolLabel?.detail,o=JSON.stringify([e.id,e.sourceActivityKind,e.toolLifecycleStatus]),r=t.renderToolCallDetail?.({entry:e,threadRef:t.threadRef,threadKey:t.threadKey,workspaceRoot:t.workspaceRoot,revision:o,onOpenFileDiff:t.onOpenFileDiff});return u("div",{className:"min-w-0 space-y-2 p-3",children:r!==void 0?u(Le,{children:r}):u("pre",{className:"chat-tool-body overflow-x-auto rounded-md bg-muted/40 p-2",children:n??""})})}var wB=pe(function(t){let{entry:n,threadKey:o,workspaceRoot:r,onDisclosureChange:a}=t,s=bt(fn).derive,{t:l}=ut(),[d,c]=Go(o,`call:${Al(n)}`,!1),f=s.workEntryIndicatesFailure(n),p=Dh(n),m=s.resolveWorkEntryStatus(n),g=m==="failed"||m==="running"?m:null,h=Jr();return b("div",{"data-tool-call-id":n.toolCallId??n.id,"data-tool-identity":Al(n),className:"border-b border-border/50 last:border-b-0",children:[b("button",{type:"button","aria-expanded":d,"aria-controls":h,onClick:()=>{a?.(),c(!d)},className:$("chat-tool-member-row chat-tool-summary flex w-full min-w-0 items-center gap-1.5 px-3 text-left hover:bg-accent/20",f?"text-destructive":"text-muted-foreground"),children:[u(vc,{status:g}),u(hc,{children:u(CB,{entry:n,failed:f,derive:s})}),b("span",{className:"flex min-w-0 flex-1 items-center",children:[u("span",{className:"truncate",children:HS(n,r,s)??l("toolGroup.calls",{count:1})}),u($S,{entry:n,failed:f})]}),f||p?u("span",{className:"chat-process-meta shrink-0",children:f?l("toolGroup.failed",{count:1}):l("toolGroup.cancelled",{count:1})}):null,u(sn,{"aria-hidden":!0,className:$("size-icon-1 shrink-0",!d&&"-rotate-90")})]}),d?u("div",{id:h,children:u(VS,{entry:n})}):null]})});function SB({threadKey:e,stateKey:t,maxHeight:n,children:o}){let r=N(null);return he(()=>{let a=r.current;if(!a)return;a.scrollTop=Ph(e,`${t}:scroll`,0);let i=()=>{mc(e,`${t}:scroll`,a.scrollTop,!1)};return a.addEventListener("scroll",i,{passive:!0}),()=>a.removeEventListener("scroll",i)},[e,t]),u("div",{ref:r,"data-slot":"scroll-area-viewport",className:"min-w-0 overflow-y-auto overscroll-y-contain",style:{maxHeight:n},children:o})}var qS=pe(function({entries:t,groupId:n,threadKey:o,workspaceRoot:r,onDisclosureChange:a}){let s=bt(fn).derive,{t:l}=ut(),[d,c]=Go(o,`group:${n}`,!1),[f,p]=Go(o,`group-page:${n}`,0),m=Jr(),g=N(null),[h,v]=J(null),y=t.at(-1),x=K(()=>t.filter(Q=>s.workEntryIndicatesFailure(Q)),[t,s]),C=K(()=>t.filter(Dh),[t]),w=t.filter(Q=>Q.toolLifecycleStatus==="inProgress").length,L=x[0]??C[0],S=L??y,k=Math.max(0,Math.ceil(t.length/Pl)-1),I=Math.min(f,k),T=I*Pl,A=t.slice(T,T+Pl),P=t.length>1;if(he(()=>{if(!h)return;let Q=g.current,Se=Array.from(Q?.querySelectorAll("[data-tool-identity]")??[]).find(q=>q.dataset.toolIdentity===h.id);if(!Se)return;let H=Se.closest('[data-slot="scroll-area-viewport"]');H&&(H.scrollTop+=Se.getBoundingClientRect().top-H.getBoundingClientRect().top),Se.querySelector("button")?.focus({preventScroll:!0})},[h]),!y||!S)return null;let _=Q=>{a?.(),p(Q)},E={threadKey:o,workspaceRoot:r,onDisclosureChange:a},F=US(t.map(Q=>zS(s.resolveWorkEntryStatus(Q)))),B=_h(t,s.toolGroupAction),V=F==="failed"?"failed":F==="running"?"running":"success";return u(Yf,{state:F,variant:"tool",children:b("section",{ref:g,"data-tool-group-id":n,className:"min-w-0",children:[b("div",{className:"flex min-w-0 items-center",children:[b("button",{type:"button","aria-expanded":d,"aria-controls":m,onClick:()=>{a?.(),c(!d),!P&&!d&&mc(o,`call:${Al(y)}`,!0)},className:$(Xf,"flex-1",L?"text-destructive":"text-muted-foreground"),children:[u(vc,{status:V}),u(hc,{children:!P&&y.toolIcon!==void 0&&x.length===0?u(KS,{toolIcon:y.toolIcon,glyphClassName:"size-icon-1 shrink-0 stroke-[1.8] opacity-70 text-icon-muted"}):u(yc,{name:B,className:$("size-icon-1 shrink-0 stroke-[1.8] opacity-70",x.length>0?"text-destructive":"text-icon-muted")})}),b("span",{className:$("flex min-w-0 flex-1 items-center",d&&P?"chat-process-text":"chat-tool-summary"),children:[u("span",{className:"truncate",children:d&&P?l("toolGroup.calls",{count:t.length}):HS(S,r,s)??l("toolGroup.calls",{count:1})}),d&&P?null:u($S,{entry:S,failed:s.workEntryIndicatesFailure(S)})]}),w>0?u("span",{className:"chat-process-meta shrink-0 tabular-nums",children:l("toolGroup.running",{count:w})}):null,x.length>0?u("span",{className:"chat-process-meta shrink-0 tabular-nums",children:l("toolGroup.failed",{count:x.length})}):null,C.length>0?u("span",{className:"chat-process-meta shrink-0 tabular-nums",children:l("toolGroup.cancelled",{count:C.length})}):null,d&&P?null:u(bB,{entries:t,failed:x.length>0,derive:s}),u(sn,{"aria-hidden":!0,className:$("size-icon-1 shrink-0",!d&&"-rotate-90")})]}),L&&P?u("button",{type:"button",className:"chat-process-meta me-2 min-h-8 shrink-0 rounded-control-4 px-1 text-destructive underline [@media(pointer:coarse)]:min-h-11",onClick:()=>{a?.(),c(!0),p(Math.floor(t.indexOf(L)/Pl)),mc(o,`call:${Al(L)}`,!0),v({id:Al(L)})},children:l("toolGroup.showFailure")}):null]}),d?u("div",{id:m,className:"border-t border-border/50",children:P?b(Le,{children:[t.length>Pl?b("div",{className:"chat-process-meta flex items-center gap-1 border-b border-border/40 px-2 py-1 text-muted-foreground",children:[u("span",{className:"min-w-0 flex-1 tabular-nums",children:l("toolGroup.pageRange",{from:T+1,to:Math.min(T+Pl,t.length),count:t.length})}),[{label:l("toolGroup.firstPage"),target:0,disabled:I===0,Icon:Ud},{label:l("toolGroup.previousPage"),target:I-1,disabled:I===0,Icon:Yi},{label:l("toolGroup.nextPage"),target:I+1,disabled:I===k,Icon:Vo},{label:l("toolGroup.lastPage"),target:k,disabled:I===k,Icon:Hd}].map(({label:Q,target:Se,disabled:H,Icon:q})=>u("button",{type:"button","aria-label":Q,disabled:H,onClick:()=>_(Se),className:"flex size-7 items-center justify-center rounded-control-3 disabled:opacity-64 [@media(pointer:coarse)]:size-11",children:u(q,{"aria-hidden":!0,className:"size-icon-1"})},Q))]}):null,u(SB,{threadKey:o,stateKey:`group-scroll:${n}:${I}`,maxHeight:"min(320px, 50dvh)",children:u("div",{className:"space-y-0.5 py-1",children:A.map(Q=>u(wB,{entry:Q,...E},Al(Q)))})})]}):u(VS,{entry:y})}):null]})})});function IB(e,t,n){let o=n-t;if(Math.abs(o)<1)return null;let r=Math.max(0,Math.min(e.scrollHeight-e.clientHeight,e.scrollTop+o));return Math.abs(r-e.scrollTop)<1?null:r}function WS(e){let{viewport:t,anchor:n,row:o,scrollToOffset:r}=e,a=n.getBoundingClientRect().top,i=!0,s=null,l=()=>{if(s=null,!i||!n.isConnected||!t.contains(n))return;let f=IB(t,a,n.getBoundingClientRect().top);f!==null&&r(f),a=n.getBoundingClientRect().top},d=()=>{i&&s===null&&(s=requestAnimationFrame(l))},c=typeof ResizeObserver>"u"?null:new ResizeObserver(d);return c?.observe(o),d(),{schedule:d,stop:()=>{i=!1,c?.disconnect(),s!==null&&cancelAnimationFrame(s),s=null}}}ue();var GS=pe(function({sectionKey:t,rowKeyPrefix:n,rowIds:o,renderRow:r,sectionRef:a}){return u("div",{className:"session-turn","data-timeline-turn-section":t,ref:a,children:o.map(i=>u("div",{className:"transcript-col min-w-0 overflow-x-clip",children:r(i)},`${n}:${i}`))})});function TB(e,t,n){for(let o=t;o<n;o+=1){let r=e[o];switch(r.kind){case"turn-identity":return r.turnId;case"working":return r.turnId??null;case"message":if(r.message.role==="assistant")return r.message.turnId;break;case"tool-group":if(r.entries[0]?.turnId!==void 0)return r.entries[0].turnId??null;break;case"work":if(r.groupedEntries[0]?.turnId!==void 0)return r.groupedEntries[0].turnId??null;break;case"turn-plan":return r.turnPlan.turnId;case"proposed-plan":return r.proposedPlan.turnId;case"turn-summary":return r.footer.turnId}}return null}function jS(e,t,n=[]){let o=new Map(n.map(a=>[a.key,a])),r=[];for(let a of t){if(a.end<=a.start)continue;let i=TB(e,a.start,a.end),s=o.get(a.key);if(s!==void 0&&s.turnId===i&&kB(s,e,a.start,a.end)){r.push(s);continue}r.push({key:a.key,turnId:i,firstRowIndex:a.start,rowIds:e.slice(a.start,a.end).map(l=>l.id)})}return r}function kB(e,t,n,o){if(e.firstRowIndex!==n||e.rowIds.length!==o-n)return!1;for(let r=0;r<e.rowIds.length;r+=1)if(e.rowIds[r]!==t[n+r].id)return!1;return!0}function QS(e,t){let n=Math.max(0,Math.min(t,e)),o=e-n;return{startIndex:o,hasHiddenOlder:o>0}}function xc(e,t,n){let o=e.findIndex(r=>r.rowIds.includes(t));return o<0?n:Math.max(n,e.length-o)}ue();ue();var YS=100,LB=new Map,XS=new Map,Jf=e=>typeof e=="function"?e():e,JS=(e,t)=>typeof t=="function"?t(e):t;function PB(e,t,n){let o=e.get(t);return o===void 0&&(o={values:new Map,limit:Math.max(1,n)},e.set(t,o)),o}function AB(e,t){let n=XS.get(e);return n===void 0&&(n={values:new Map,limit:Math.max(1,t)},XS.set(e,n)),n}function EB(e,t){if(!(e.values.size<=e.limit)){for(let[n,o]of e.values){if(e.values.size<=e.limit)return;o===t||o.committed||o.leases>0||(e.values.delete(n),o.alive=!1,o.subscribers.clear())}for(let[n,o]of e.values){if(e.values.size<=e.limit)return;o===t||o.leases>0||(e.values.delete(n),o.alive=!1,o.subscribers.clear())}}}function Oh(e,t,n){e.values.get(t)===n&&(e.values.delete(t),e.values.set(t,n))}function ZS(e,t,n){let o=e.values.get(t);return o===void 0&&(o={value:Jf(n),subscribers:new Set,leases:0,alive:!0,committed:!1},e.values.set(t,o)),o}function Cc(e){queueMicrotask(()=>EB(e))}function ln(e,t,n,o=YS){let r=Math.max(1,o),a=PB(LB,e,r),i=ZS(a,t,n),s=R(f=>i.alive?(a.limit=r,i.committed=!0,Oh(a,t,i),i.leases+=1,i.subscribers.add(f),Cc(a),()=>{i.subscribers.delete(f),i.leases=Math.max(0,i.leases-1),Cc(a)}):()=>{},[r,i,a,t]),l=R(()=>i.value,[i]),d=Ko(s,l,l),c=R(f=>{if(!i.alive||a.values.get(t)!==i)return;let p=i.value,m=JS(p,f);if(!Object.is(m,p)){i.value=m,Oh(a,t,i);for(let g of i.subscribers)g();Cc(a)}},[i,a,t]);return[d,c]}function eI(e,t){let n=N(null);(n.current===null||n.current.key!==e)&&(n.current={key:e,value:Jf(t)});let[,o]=Ia(a=>a+1,0),r=R(a=>{let i=n.current;if(i===null||i.key!==e)return;let s=JS(i.value,a);Object.is(s,i.value)||(i.value=s,o())},[e]);return[n.current.value,r]}function Rt(e,t,n,o=YS){let r=Math.max(1,o),a=AB(e,r),i=ZS(a,t,()=>({current:Jf(n)}));return W(()=>{if(!(!i.alive||a.values.get(t)!==i))return a.limit=r,i.committed=!0,Oh(a,t,i),i.leases+=1,Cc(a),()=>{i.leases=Math.max(0,i.leases-1),Cc(a)}},[r,i,a,t]),i.value}function Pr(e,t){let n=N(null);return(n.current===null||n.current.key!==e)&&(n.current={key:e,ref:{current:Jf(t)}}),n.current.ref}var ps=3,Fh=ps;function tI(e){let[t,n]=ln("timeline-reveal-window",e,ps),o=R(()=>{n(s=>s+Fh)},[n]),r=R(s=>{n(l=>s>l?s:l)},[n]),a=R(()=>{n(ps)},[n]),i=R(s=>{n(l=>Math.min(l,Math.max(ps,s)))},[n]);return{revealedCount:t,revealOlder:o,revealAtLeast:r,compactTo:i,reset:a}}var RB=400;function nI({root:e,minimumCount:t,keepAbovePx:n=0,canCompact:o,onCompact:r}){let a=e.ownerDocument,i=new Set,s,l=!1,d=()=>e.scrollHeight-e.clientHeight-e.scrollTop<=2,c=()=>{if(s=void 0,a.hidden||i.size>0||!o()||e.clientHeight<=0||!d()||gc(e))return;let w=e.querySelectorAll("[data-timeline-turn-section]"),L=e.getBoundingClientRect().top-32-n,S=0,k=Math.max(0,w.length-t);for(;S<k;){let T=Math.floor((S+k)/2),A=w[T].getBoundingClientRect().bottom;if(!Number.isFinite(A))return;A<=L?S=T+1:k=T}if(S===0)return;let I=a.activeElement;if(I&&Tl(I)){for(let T=0;T<S;T+=1)if(w[T].contains(I))return}r(w.length-S)},f=!1,p=()=>{if(a.hidden||i.size>0||!o()||f){clearTimeout(s),s=void 0;return}s===void 0&&(s=setTimeout(c,RB))},m=()=>{clearTimeout(s),s=void 0,p()},g=()=>{let w=d();!w||!l?m():p(),l=w},h=w=>{i.add(w.pointerId),m()},v=w=>{i.delete(w.pointerId),m()},y=()=>{f=gc(e),m()},x=()=>{i.clear(),m()},C=["wheel","keydown","focusin","focusout"];for(let w of C)e.addEventListener(w,m,{passive:!0});return e.addEventListener("scroll",g,{passive:!0}),e.addEventListener("pointerdown",h,!0),a.addEventListener("pointerup",v,!0),a.addEventListener("pointercancel",v,!0),a.addEventListener("selectionchange",y),a.addEventListener("visibilitychange",p),a.defaultView?.addEventListener("blur",x),p(),{schedule:p,disconnect:()=>{clearTimeout(s);for(let w of C)e.removeEventListener(w,m);e.removeEventListener("scroll",g),e.removeEventListener("pointerdown",h,!0),a.removeEventListener("pointerup",v,!0),a.removeEventListener("pointercancel",v,!0),a.removeEventListener("selectionchange",y),a.removeEventListener("visibilitychange",p),a.defaultView?.removeEventListener("blur",x)}}}ue();function oI({root:e,topInsetPx:t,onActiveSectionChange:n,active:o}){let r=N(o);r.current=o;let a=pi(o),i=N(new Map),s=N(null),l=N(null),d=N(n);d.current=n;let c=R(()=>{if(!r.current||!e)return;let h=e.scrollTop+t,v=null,y=Number.NEGATIVE_INFINITY,x=null,C=Number.POSITIVE_INFINITY;for(let[L,S]of i.current){if(!S.isConnected)continue;let k=S.offsetTop;k<C&&(C=k,x=L),k<=h&&k>=y&&(y=k,v=L)}let w=v??x;w!==l.current&&(l.current=w,d.current(w))},[e,t]),f=R(()=>{r.current&&a.request(c)},[a,c]);W(()=>{if(!o||!e||typeof IntersectionObserver>"u")return;let h=!0,v=new IntersectionObserver(()=>{!h||!r.current||f()},{root:e,rootMargin:`-${t}px 0px 0px 0px`,threshold:0});s.current=v;for(let y of i.current.values())v.observe(y);return f(),()=>{h=!1,v.disconnect(),s.current=null,a.cancel()}},[o,a,f,e,t]);let p=N(new Map),m=R(h=>{let v=p.current.get(h);if(v)return v;let y=x=>{let C=i.current.get(h);C&&C!==x&&(s.current?.unobserve(C),i.current.delete(h)),x?(i.current.set(h,x),s.current?.observe(x)):p.current.get(h)===y&&p.current.delete(h)};return p.current.set(h,y),y},[]),g=R(()=>{r.current&&(l.current=null,f())},[f]);return K(()=>({observeSection:m,refresh:g}),[m,g])}function bc(e,t,n="duration"){let o=`<${n}></${n}>`,r=`<${n}/>`,a=s=>{let l=e.indexOf(s);return l<0?null:[e.slice(0,l),e.slice(l+s.length)]},i=a(o)??a(r);return i===null?b(Le,{children:[e,t]}):b(Le,{children:[i[0],t,i[1]]})}ue();function rI(e){return Ko(e.subscribe,e.getStructure,e.getStructure)}function aI(e,t){let n=R(r=>e.subscribeRow(t,r),[e,t]),o=R(()=>e.getRow(t),[e,t]);return Ko(n,o,o)}function gi(e,t,n=Object.is){let o=N(null),r=R(()=>{let a=e.getVersion(),i=o.current;if(i!==null&&i.store===e&&i.select===t&&i.version===a)return i.value;let s=t(e),l=i!==null&&i.store===e&&n(i.value,s)?i.value:s;return o.current={store:e,select:t,version:a,value:l},l},[e,t,n]);return Ko(e.subscribe,r,r)}ue();function Bh(e,t){let n=e.flatMap(r=>r.previewUrl?[{id:r.id,src:r.previewUrl,name:r.name}]:[]);if(n.length===0)return null;let o=n.findIndex(r=>r.id===t);return o<0?null:{images:n.map(r=>({src:r.src,name:r.name})),index:o}}function hi(e){if(e.type==="image")return"image";let t=e.mimeType.toLowerCase();return t==="application/pdf"?"pdf":t.startsWith("text/")||MB.has(t)?"text":"file"}var MB=new Set(["application/json","application/xml","application/x-yaml","application/yaml"]);function iI(e){return!Number.isFinite(e)||e<=0?"0 KB":e>=1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${Math.max(1,Math.round(e/1024))} KB`}var NB="<ycodium-system>";function Zf(e){return e.startsWith(NB)}var _B=/[ \t]*\(record [^\s()]+\)/g,DB=/^<\/?[a-z][a-z-]*(?:\s[^>]*)?>$/;function zh(e){return Zf(e)?e.split(`
|
|
3741
|
-
`).filter(t=>!
|
|
3742
|
-
`).replace(
|
|
3740
|
+
`;ue();ue();var iw=bt(null),sw=iw.Provider,lw=bt(""),dw=lw.Provider;function hf(){return Ht(lw)}function ir(){let e=Ht(iw);if(e===null)throw new Error("Conversation UI has not been registered.");return e}var cw="ycodium.conversation.host-data.v14",hh="conversation";var vh="__ycodiumConversationBridge",uw="ycodium.conversation.rebindable-bridge.v1";ue();function fw(e){var t,n,o="";if(typeof e=="string"||typeof e=="number")o+=e;else if(typeof e=="object")if(Array.isArray(e)){var r=e.length;for(t=0;t<r;t++)e[t]&&(n=fw(e[t]))&&(o&&(o+=" "),o+=n)}else for(n in e)e[n]&&(o&&(o+=" "),o+=n);return o}function pw(){for(var e,t,n=0,o="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=fw(e))&&(o&&(o+=" "),o+=t);return o}var mw=pw;var tF=(e,t)=>{let n=new Array(e.length+t.length);for(let o=0;o<e.length;o++)n[o]=e[o];for(let o=0;o<t.length;o++)n[e.length+o]=t[o];return n},nF=(e,t)=>({classGroupId:e,validator:t}),ww=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n});var gw=[],oF="arbitrary..",rF=e=>{let t=iF(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:o}=e;return{getClassGroupId:i=>{if(i.startsWith("[")&&i.endsWith("]"))return aF(i);let s=i.split("-"),l=s[0]===""&&s.length>1?1:0;return Sw(s,l,t)},getConflictingClassGroupIds:(i,s)=>{if(s){let l=o[i],d=n[i];return l?d?tF(d,l):l:d||gw}return n[i]||gw}}},Sw=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],a=n.nextPart.get(r);if(a){let d=Sw(e,t+1,a);if(d)return d}let i=n.validators;if(i===null)return;let s=t===0?e.join("-"):e.slice(t).join("-"),l=i.length;for(let d=0;d<l;d++){let c=i[d];if(c.validator(s))return c.classGroupId}},aF=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(":"),o=t.slice(0,n);return o?oF+o:void 0})(),iF=e=>{let{theme:t,classGroups:n}=e;return sF(n,t)},sF=(e,t)=>{let n=ww();for(let o in e){let r=e[o];Ch(r,n,o,t)}return n},Ch=(e,t,n,o)=>{let r=e.length;for(let a=0;a<r;a++){let i=e[a];lF(i,t,n,o)}},lF=(e,t,n,o)=>{if(typeof e=="string"){dF(e,t,n);return}if(typeof e=="function"){cF(e,t,n,o);return}uF(e,t,n,o)},dF=(e,t,n)=>{let o=e===""?t:Iw(t,e);o.classGroupId=n},cF=(e,t,n,o)=>{if(fF(e)){Ch(e(o),t,n,o);return}t.validators===null&&(t.validators=[]),t.validators.push(nF(n,e))},uF=(e,t,n,o)=>{let r=Object.entries(e),a=r.length;for(let i=0;i<a;i++){let[s,l]=r[i];Ch(l,Iw(t,s),n,o)}},Iw=(e,t)=>{let n=e,o=t.split("-"),r=o.length;for(let a=0;a<r;a++){let i=o[a],s=n.nextPart.get(i);s||(s=ww(),n.nextPart.set(i,s)),n=s}return n},fF=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,pF=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),o=Object.create(null),r=(a,i)=>{n[a]=i,t++,t>e&&(t=0,o=n,n=Object.create(null))};return{get(a){let i=n[a];if(i!==void 0)return i;if((i=o[a])!==void 0)return r(a,i),i},set(a,i){a in n?n[a]=i:r(a,i)}}};var mF=[],hw=(e,t,n,o,r)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:o,isExternal:r}),gF=e=>{let{prefix:t,experimentalParseClassName:n}=e,o=r=>{let a=[],i=0,s=0,l=0,d,c=r.length;for(let h=0;h<c;h++){let v=r[h];if(i===0&&s===0){if(v===":"){a.push(r.slice(l,h)),l=h+1;continue}if(v==="/"){d=h;continue}}v==="["?i++:v==="]"?i--:v==="("?s++:v===")"&&s--}let f=a.length===0?r:r.slice(l),p=f,m=!1;f.endsWith("!")?(p=f.slice(0,-1),m=!0):f.startsWith("!")&&(p=f.slice(1),m=!0);let g=d&&d>l?d-l:void 0;return hw(a,m,p,g)};if(t){let r=t+":",a=o;o=i=>i.startsWith(r)?a(i.slice(r.length)):hw(mF,!1,i,void 0,!0)}if(n){let r=o;o=a=>n({className:a,parseClassName:r})}return o},hF=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((n,o)=>{t.set(n,1e6+o)}),n=>{let o=[],r=[];for(let a=0;a<n.length;a++){let i=n[a],s=i[0]==="[",l=t.has(i);s||l?(r.length>0&&(r.sort(),o.push(...r),r=[]),o.push(i)):r.push(i)}return r.length>0&&(r.sort(),o.push(...r)),o}},vF=e=>({cache:pF(e.cacheSize),parseClassName:gF(e),sortModifiers:hF(e),postfixLookupClassGroupIds:yF(e),...rF(e)}),yF=e=>{let t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let o=0;o<n.length;o++)t[n[o]]=!0;return t},xF=/\s+/,CF=(e,t)=>{let{parseClassName:n,getClassGroupId:o,getConflictingClassGroupIds:r,sortModifiers:a,postfixLookupClassGroupIds:i}=t,s=[],l=e.trim().split(xF),d="";for(let c=l.length-1;c>=0;c-=1){let f=l[c],{isExternal:p,modifiers:m,hasImportantModifier:g,baseClassName:h,maybePostfixModifierPosition:v}=n(f);if(p){d=f+(d.length>0?" "+d:d);continue}let y=!!v,x;if(y){let k=h.substring(0,v);x=o(k);let I=x&&i[x]?o(h):void 0;I&&I!==x&&(x=I,y=!1)}else x=o(h);if(!x){if(!y){d=f+(d.length>0?" "+d:d);continue}if(x=o(h),!x){d=f+(d.length>0?" "+d:d);continue}y=!1}let C=m.length===0?"":m.length===1?m[0]:a(m).join(":"),w=g?C+"!":C,L=w+x;if(s.indexOf(L)>-1)continue;s.push(L);let S=r(x,y);for(let k=0;k<S.length;++k){let I=S[k];s.push(w+I)}d=f+(d.length>0?" "+d:d)}return d},bF=(...e)=>{let t=0,n,o,r="";for(;t<e.length;)(n=e[t++])&&(o=Tw(n))&&(r&&(r+=" "),r+=o);return r},Tw=e=>{if(typeof e=="string")return e;let t,n="";for(let o=0;o<e.length;o++)e[o]&&(t=Tw(e[o]))&&(n&&(n+=" "),n+=t);return n},vw=(e,...t)=>{let n,o,r,a,i=l=>{let d=t.reduce((c,f)=>f(c),e());return n=vF(d),o=n.cache.get,r=n.cache.set,a=s,s(l)},s=l=>{let d=o(l);if(d)return d;let c=CF(l,n);return r(l,c),c};return a=i,(...l)=>a(bF(...l))},wF=[],_n=e=>{let t=n=>n[e]||wF;return t.isThemeGetter=!0,t},kw=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Lw=/^\((?:(\w[\w-]*):)?(.+)\)$/i,SF=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,IF=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,TF=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,kF=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,LF=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,PF=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,oi=e=>SF.test(e),mt=e=>!!e&&!Number.isNaN(Number(e)),Zr=e=>!!e&&Number.isInteger(Number(e)),yh=e=>e.endsWith("%")&&mt(e.slice(0,-1)),Ia=e=>IF.test(e),Pw=()=>!0,AF=e=>TF.test(e)&&!kF.test(e),bh=()=>!1,EF=e=>LF.test(e),RF=e=>PF.test(e),MF=e=>!Oe(e)&&!Fe(e),NF=e=>e.startsWith("@container")&&(e[10]==="/"&&e[11]!==void 0||e[11]==="s"&&e[16]!==void 0&&e.startsWith("-size/",10)||e[11]==="n"&&e[18]!==void 0&&e.startsWith("-normal/",10)),_F=e=>ri(e,Rw,bh),Oe=e=>kw.test(e),Wi=e=>ri(e,Mw,AF),yw=e=>ri(e,$F,mt),DF=e=>ri(e,_w,Pw),OF=e=>ri(e,Nw,bh),xw=e=>ri(e,Aw,bh),FF=e=>ri(e,Ew,RF),vf=e=>ri(e,Dw,EF),Fe=e=>Lw.test(e),Nd=e=>Gi(e,Mw),BF=e=>Gi(e,Nw),Cw=e=>Gi(e,Aw),zF=e=>Gi(e,Rw),UF=e=>Gi(e,Ew),yf=e=>Gi(e,Dw,!0),HF=e=>Gi(e,_w,!0),ri=(e,t,n)=>{let o=kw.exec(e);return o?o[1]?t(o[1]):n(o[2]):!1},Gi=(e,t,n=!1)=>{let o=Lw.exec(e);return o?o[1]?t(o[1]):n:!1},Aw=e=>e==="position"||e==="percentage",Ew=e=>e==="image"||e==="url",Rw=e=>e==="length"||e==="size"||e==="bg-size",Mw=e=>e==="length",$F=e=>e==="number",Nw=e=>e==="family-name",_w=e=>e==="number"||e==="weight",Dw=e=>e==="shadow";var bw=()=>{let e=_n("color"),t=_n("font"),n=_n("text"),o=_n("font-weight"),r=_n("tracking"),a=_n("leading"),i=_n("breakpoint"),s=_n("container"),l=_n("spacing"),d=_n("radius"),c=_n("shadow"),f=_n("inset-shadow"),p=_n("text-shadow"),m=_n("drop-shadow"),g=_n("blur"),h=_n("perspective"),v=_n("aspect"),y=_n("ease"),x=_n("animate"),C=()=>["auto","avoid","all","avoid-page","page","left","right","column"],w=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],L=()=>[...w(),Fe,Oe],S=()=>["auto","hidden","clip","visible","scroll"],k=()=>["auto","contain","none"],I=()=>[Fe,Oe,l],T=()=>[oi,"full","auto",...I()],A=()=>[Zr,"none","subgrid",Fe,Oe],P=()=>["auto",{span:["full",Zr,Fe,Oe]},Zr,Fe,Oe],_=()=>[Zr,"auto",Fe,Oe],E=()=>["auto","min","max","fr",Fe,Oe],F=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],B=()=>["start","end","center","stretch","center-safe","end-safe"],V=()=>["auto",...I()],Q=()=>[oi,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...I()],Se=()=>[oi,"screen","full","dvw","lvw","svw","min","max","fit",...I()],H=()=>[oi,"screen","full","lh","dvh","lvh","svh","min","max","fit",...I()],q=()=>[e,Fe,Oe],ee=()=>[...w(),Cw,xw,{position:[Fe,Oe]}],G=()=>["no-repeat",{repeat:["","x","y","space","round"]}],te=()=>["auto","cover","contain",zF,_F,{size:[Fe,Oe]}],me=()=>[yh,Nd,Wi],U=()=>["","none","full",d,Fe,Oe],Y=()=>["",mt,Nd,Wi],se=()=>["solid","dashed","dotted","double"],ge=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ie=()=>[mt,yh,Cw,xw],Ae=()=>["","none",g,Fe,Oe],Xe=()=>["none",mt,Fe,Oe],nt=()=>["none",mt,Fe,Oe],rt=()=>[mt,Fe,Oe],Ve=()=>[oi,"full",...I()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Ia],breakpoint:[Ia],color:[Pw],container:[Ia],"drop-shadow":[Ia],ease:["in","out","in-out"],font:[MF],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Ia],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Ia],shadow:[Ia],spacing:["px",mt],text:[Ia],"text-shadow":[Ia],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",oi,Oe,Fe,v]}],container:["container"],"container-type":[{"@container":["","normal","size",Fe,Oe]}],"container-named":[NF],columns:[{columns:[mt,Oe,Fe,s]}],"break-after":[{"break-after":C()}],"break-before":[{"break-before":C()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:L()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:k()}],"overscroll-x":[{"overscroll-x":k()}],"overscroll-y":[{"overscroll-y":k()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:["visible","invisible","collapse"],z:[{z:[Zr,"auto",Fe,Oe]}],basis:[{basis:[oi,"full","auto",s,...I()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[mt,oi,"auto","initial","none",Oe]}],grow:[{grow:["",mt,Fe,Oe]}],shrink:[{shrink:["",mt,Fe,Oe]}],order:[{order:[Zr,"first","last","none",Fe,Oe]}],"grid-cols":[{"grid-cols":A()}],"col-start-end":[{col:P()}],"col-start":[{"col-start":_()}],"col-end":[{"col-end":_()}],"grid-rows":[{"grid-rows":A()}],"row-start-end":[{row:P()}],"row-start":[{"row-start":_()}],"row-end":[{"row-end":_()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":E()}],"auto-rows":[{"auto-rows":E()}],gap:[{gap:I()}],"gap-x":[{"gap-x":I()}],"gap-y":[{"gap-y":I()}],"justify-content":[{justify:[...F(),"normal"]}],"justify-items":[{"justify-items":[...B(),"normal"]}],"justify-self":[{"justify-self":["auto",...B()]}],"align-content":[{content:["normal",...F()]}],"align-items":[{items:[...B(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...B(),{baseline:["","last"]}]}],"place-content":[{"place-content":F()}],"place-items":[{"place-items":[...B(),"baseline"]}],"place-self":[{"place-self":["auto",...B()]}],p:[{p:I()}],px:[{px:I()}],py:[{py:I()}],ps:[{ps:I()}],pe:[{pe:I()}],pbs:[{pbs:I()}],pbe:[{pbe:I()}],pt:[{pt:I()}],pr:[{pr:I()}],pb:[{pb:I()}],pl:[{pl:I()}],m:[{m:V()}],mx:[{mx:V()}],my:[{my:V()}],ms:[{ms:V()}],me:[{me:V()}],mbs:[{mbs:V()}],mbe:[{mbe:V()}],mt:[{mt:V()}],mr:[{mr:V()}],mb:[{mb:V()}],ml:[{ml:V()}],"space-x":[{"space-x":I()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":I()}],"space-y-reverse":["space-y-reverse"],size:[{size:Q()}],"inline-size":[{inline:["auto",...Se()]}],"min-inline-size":[{"min-inline":["auto",...Se()]}],"max-inline-size":[{"max-inline":["none",...Se()]}],"block-size":[{block:["auto",...H()]}],"min-block-size":[{"min-block":["auto",...H()]}],"max-block-size":[{"max-block":["none",...H()]}],w:[{w:[s,"screen",...Q()]}],"min-w":[{"min-w":[s,"screen","none",...Q()]}],"max-w":[{"max-w":[s,"screen","none","prose",{screen:[i]},...Q()]}],h:[{h:["screen","lh",...Q()]}],"min-h":[{"min-h":["screen","lh","none",...Q()]}],"max-h":[{"max-h":["screen","lh",...Q()]}],"font-size":[{text:["base",n,Nd,Wi]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[o,HF,DF]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",yh,Oe]}],"font-family":[{font:[BF,OF,t]}],"font-features":[{"font-features":[Oe]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[r,Fe,Oe]}],"line-clamp":[{"line-clamp":[mt,"none",Fe,yw]}],leading:[{leading:[a,...I()]}],"list-image":[{"list-image":["none",Fe,Oe]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Fe,Oe]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:q()}],"text-color":[{text:q()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...se(),"wavy"]}],"text-decoration-thickness":[{decoration:[mt,"from-font","auto",Fe,Wi]}],"text-decoration-color":[{decoration:q()}],"underline-offset":[{"underline-offset":[mt,"auto",Fe,Oe]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:I()}],"tab-size":[{tab:[Zr,Fe,Oe]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Fe,Oe]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Fe,Oe]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:ee()}],"bg-repeat":[{bg:G()}],"bg-size":[{bg:te()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Zr,Fe,Oe],radial:["",Fe,Oe],conic:[Zr,Fe,Oe]},UF,FF]}],"bg-color":[{bg:q()}],"gradient-from-pos":[{from:me()}],"gradient-via-pos":[{via:me()}],"gradient-to-pos":[{to:me()}],"gradient-from":[{from:q()}],"gradient-via":[{via:q()}],"gradient-to":[{to:q()}],rounded:[{rounded:U()}],"rounded-s":[{"rounded-s":U()}],"rounded-e":[{"rounded-e":U()}],"rounded-t":[{"rounded-t":U()}],"rounded-r":[{"rounded-r":U()}],"rounded-b":[{"rounded-b":U()}],"rounded-l":[{"rounded-l":U()}],"rounded-ss":[{"rounded-ss":U()}],"rounded-se":[{"rounded-se":U()}],"rounded-ee":[{"rounded-ee":U()}],"rounded-es":[{"rounded-es":U()}],"rounded-tl":[{"rounded-tl":U()}],"rounded-tr":[{"rounded-tr":U()}],"rounded-br":[{"rounded-br":U()}],"rounded-bl":[{"rounded-bl":U()}],"border-w":[{border:Y()}],"border-w-x":[{"border-x":Y()}],"border-w-y":[{"border-y":Y()}],"border-w-s":[{"border-s":Y()}],"border-w-e":[{"border-e":Y()}],"border-w-bs":[{"border-bs":Y()}],"border-w-be":[{"border-be":Y()}],"border-w-t":[{"border-t":Y()}],"border-w-r":[{"border-r":Y()}],"border-w-b":[{"border-b":Y()}],"border-w-l":[{"border-l":Y()}],"divide-x":[{"divide-x":Y()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":Y()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...se(),"hidden","none"]}],"divide-style":[{divide:[...se(),"hidden","none"]}],"border-color":[{border:q()}],"border-color-x":[{"border-x":q()}],"border-color-y":[{"border-y":q()}],"border-color-s":[{"border-s":q()}],"border-color-e":[{"border-e":q()}],"border-color-bs":[{"border-bs":q()}],"border-color-be":[{"border-be":q()}],"border-color-t":[{"border-t":q()}],"border-color-r":[{"border-r":q()}],"border-color-b":[{"border-b":q()}],"border-color-l":[{"border-l":q()}],"divide-color":[{divide:q()}],"outline-style":[{outline:[...se(),"none","hidden"]}],"outline-offset":[{"outline-offset":[mt,Fe,Oe]}],"outline-w":[{outline:["",mt,Nd,Wi]}],"outline-color":[{outline:q()}],shadow:[{shadow:["","none",c,yf,vf]}],"shadow-color":[{shadow:q()}],"inset-shadow":[{"inset-shadow":["none",f,yf,vf]}],"inset-shadow-color":[{"inset-shadow":q()}],"ring-w":[{ring:Y()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:q()}],"ring-offset-w":[{"ring-offset":[mt,Wi]}],"ring-offset-color":[{"ring-offset":q()}],"inset-ring-w":[{"inset-ring":Y()}],"inset-ring-color":[{"inset-ring":q()}],"text-shadow":[{"text-shadow":["none",p,yf,vf]}],"text-shadow-color":[{"text-shadow":q()}],opacity:[{opacity:[mt,Fe,Oe]}],"mix-blend":[{"mix-blend":[...ge(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ge()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[mt]}],"mask-image-linear-from-pos":[{"mask-linear-from":ie()}],"mask-image-linear-to-pos":[{"mask-linear-to":ie()}],"mask-image-linear-from-color":[{"mask-linear-from":q()}],"mask-image-linear-to-color":[{"mask-linear-to":q()}],"mask-image-t-from-pos":[{"mask-t-from":ie()}],"mask-image-t-to-pos":[{"mask-t-to":ie()}],"mask-image-t-from-color":[{"mask-t-from":q()}],"mask-image-t-to-color":[{"mask-t-to":q()}],"mask-image-r-from-pos":[{"mask-r-from":ie()}],"mask-image-r-to-pos":[{"mask-r-to":ie()}],"mask-image-r-from-color":[{"mask-r-from":q()}],"mask-image-r-to-color":[{"mask-r-to":q()}],"mask-image-b-from-pos":[{"mask-b-from":ie()}],"mask-image-b-to-pos":[{"mask-b-to":ie()}],"mask-image-b-from-color":[{"mask-b-from":q()}],"mask-image-b-to-color":[{"mask-b-to":q()}],"mask-image-l-from-pos":[{"mask-l-from":ie()}],"mask-image-l-to-pos":[{"mask-l-to":ie()}],"mask-image-l-from-color":[{"mask-l-from":q()}],"mask-image-l-to-color":[{"mask-l-to":q()}],"mask-image-x-from-pos":[{"mask-x-from":ie()}],"mask-image-x-to-pos":[{"mask-x-to":ie()}],"mask-image-x-from-color":[{"mask-x-from":q()}],"mask-image-x-to-color":[{"mask-x-to":q()}],"mask-image-y-from-pos":[{"mask-y-from":ie()}],"mask-image-y-to-pos":[{"mask-y-to":ie()}],"mask-image-y-from-color":[{"mask-y-from":q()}],"mask-image-y-to-color":[{"mask-y-to":q()}],"mask-image-radial":[{"mask-radial":[Fe,Oe]}],"mask-image-radial-from-pos":[{"mask-radial-from":ie()}],"mask-image-radial-to-pos":[{"mask-radial-to":ie()}],"mask-image-radial-from-color":[{"mask-radial-from":q()}],"mask-image-radial-to-color":[{"mask-radial-to":q()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":w()}],"mask-image-conic-pos":[{"mask-conic":[mt]}],"mask-image-conic-from-pos":[{"mask-conic-from":ie()}],"mask-image-conic-to-pos":[{"mask-conic-to":ie()}],"mask-image-conic-from-color":[{"mask-conic-from":q()}],"mask-image-conic-to-color":[{"mask-conic-to":q()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:ee()}],"mask-repeat":[{mask:G()}],"mask-size":[{mask:te()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Fe,Oe]}],filter:[{filter:["","none",Fe,Oe]}],blur:[{blur:Ae()}],brightness:[{brightness:[mt,Fe,Oe]}],contrast:[{contrast:[mt,Fe,Oe]}],"drop-shadow":[{"drop-shadow":["","none",m,yf,vf]}],"drop-shadow-color":[{"drop-shadow":q()}],grayscale:[{grayscale:["",mt,Fe,Oe]}],"hue-rotate":[{"hue-rotate":[mt,Fe,Oe]}],invert:[{invert:["",mt,Fe,Oe]}],saturate:[{saturate:[mt,Fe,Oe]}],sepia:[{sepia:["",mt,Fe,Oe]}],"backdrop-filter":[{"backdrop-filter":["","none",Fe,Oe]}],"backdrop-blur":[{"backdrop-blur":Ae()}],"backdrop-brightness":[{"backdrop-brightness":[mt,Fe,Oe]}],"backdrop-contrast":[{"backdrop-contrast":[mt,Fe,Oe]}],"backdrop-grayscale":[{"backdrop-grayscale":["",mt,Fe,Oe]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[mt,Fe,Oe]}],"backdrop-invert":[{"backdrop-invert":["",mt,Fe,Oe]}],"backdrop-opacity":[{"backdrop-opacity":[mt,Fe,Oe]}],"backdrop-saturate":[{"backdrop-saturate":[mt,Fe,Oe]}],"backdrop-sepia":[{"backdrop-sepia":["",mt,Fe,Oe]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":I()}],"border-spacing-x":[{"border-spacing-x":I()}],"border-spacing-y":[{"border-spacing-y":I()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Fe,Oe]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[mt,"initial",Fe,Oe]}],ease:[{ease:["linear","initial",y,Fe,Oe]}],delay:[{delay:[mt,Fe,Oe]}],animate:[{animate:["none",x,Fe,Oe]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[h,Fe,Oe]}],"perspective-origin":[{"perspective-origin":L()}],rotate:[{rotate:Xe()}],"rotate-x":[{"rotate-x":Xe()}],"rotate-y":[{"rotate-y":Xe()}],"rotate-z":[{"rotate-z":Xe()}],scale:[{scale:nt()}],"scale-x":[{"scale-x":nt()}],"scale-y":[{"scale-y":nt()}],"scale-z":[{"scale-z":nt()}],"scale-3d":["scale-3d"],skew:[{skew:rt()}],"skew-x":[{"skew-x":rt()}],"skew-y":[{"skew-y":rt()}],transform:[{transform:[Fe,Oe,"","none","gpu","cpu"]}],"transform-origin":[{origin:L()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Ve()}],"translate-x":[{"translate-x":Ve()}],"translate-y":[{"translate-y":Ve()}],"translate-z":[{"translate-z":Ve()}],"translate-none":["translate-none"],zoom:[{zoom:[Zr,Fe,Oe]}],accent:[{accent:q()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:q()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Fe,Oe]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":q()}],"scrollbar-track-color":[{"scrollbar-track":q()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":I()}],"scroll-mx":[{"scroll-mx":I()}],"scroll-my":[{"scroll-my":I()}],"scroll-ms":[{"scroll-ms":I()}],"scroll-me":[{"scroll-me":I()}],"scroll-mbs":[{"scroll-mbs":I()}],"scroll-mbe":[{"scroll-mbe":I()}],"scroll-mt":[{"scroll-mt":I()}],"scroll-mr":[{"scroll-mr":I()}],"scroll-mb":[{"scroll-mb":I()}],"scroll-ml":[{"scroll-ml":I()}],"scroll-p":[{"scroll-p":I()}],"scroll-px":[{"scroll-px":I()}],"scroll-py":[{"scroll-py":I()}],"scroll-ps":[{"scroll-ps":I()}],"scroll-pe":[{"scroll-pe":I()}],"scroll-pbs":[{"scroll-pbs":I()}],"scroll-pbe":[{"scroll-pbe":I()}],"scroll-pt":[{"scroll-pt":I()}],"scroll-pr":[{"scroll-pr":I()}],"scroll-pb":[{"scroll-pb":I()}],"scroll-pl":[{"scroll-pl":I()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Fe,Oe]}],fill:[{fill:["none",...q()]}],"stroke-w":[{stroke:[mt,Nd,Wi,yw]}],stroke:[{stroke:["none",...q()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},KF=(e,{cacheSize:t,prefix:n,experimentalParseClassName:o,extend:r={},override:a={}})=>(pl(e,"cacheSize",t),pl(e,"prefix",n),pl(e,"experimentalParseClassName",o),xf(e.theme,a.theme),xf(e.classGroups,a.classGroups),xf(e.conflictingClassGroups,a.conflictingClassGroups),xf(e.conflictingClassGroupModifiers,a.conflictingClassGroupModifiers),pl(e,"postfixLookupClassGroups",a.postfixLookupClassGroups),pl(e,"orderSensitiveModifiers",a.orderSensitiveModifiers),Cf(e.theme,r.theme),Cf(e.classGroups,r.classGroups),Cf(e.conflictingClassGroups,r.conflictingClassGroups),Cf(e.conflictingClassGroupModifiers,r.conflictingClassGroupModifiers),xh(e,r,"postfixLookupClassGroups"),xh(e,r,"orderSensitiveModifiers"),e),pl=(e,t,n)=>{n!==void 0&&(e[t]=n)},xf=(e,t)=>{if(t)for(let n in t)pl(e,n,t[n])},Cf=(e,t)=>{if(t)for(let n in t)xh(e,t,n)},xh=(e,t,n)=>{let o=t[n];o!==void 0&&(e[n]=e[n]?e[n].concat(o):o)},Ow=(e,...t)=>typeof e=="function"?vw(bw,e,...t):vw(()=>KF(bw(),e),...t);var VF=Ow({extend:{classGroups:{"font-size":[{text:["chat","chat-row","chat-code","chat-dense","chat-meta","control-1","control-2","control-3","control-4","control-5"]}]}}});function $(...e){return VF(mw(e))}ue();var bf=bt(!0);function Fw(){return wt(bf)}var wh=bt(void 0);function ea(){let e=wt(bf);return wt(wh)??e}ue();var wf=(...e)=>e.filter((t,n,o)=>!!t&&t.trim()!==""&&o.indexOf(t)===n).join(" ").trim();var Bw=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();var zw=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,o)=>o?o.toUpperCase():n.toLowerCase());var Sh=e=>{let t=zw(e);return t.charAt(0).toUpperCase()+t.slice(1)};ue();var Uw={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};var Hw=e=>{for(let t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};var $w=zn(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:o,className:r="",children:a,iconNode:i,...s},l)=>De("svg",{ref:l,...Uw,width:t,height:t,stroke:e,strokeWidth:o?Number(n)*24/Number(t):n,className:wf("lucide",r),...!a&&!Hw(s)&&{"aria-hidden":"true"},...s},[...i.map(([d,c])=>De(d,c)),...Array.isArray(a)?a:[a]]));var Z=(e,t)=>{let n=zn(({className:o,...r},a)=>De($w,{ref:a,iconNode:t,className:wf(`lucide-${Bw(Sh(e))}`,`lucide-${e}`,o),...r}));return n.displayName=Sh(e),n};var qF=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],_d=Z("arrow-down",qF);var WF=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],Dd=Z("arrow-up-right",WF);var GF=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Od=Z("arrow-up",GF);var jF=[["path",{d:"M10 22V7a1 1 0 0 0-1-1H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5a1 1 0 0 0-1-1H2",key:"1ah6g2"}],["rect",{x:"14",y:"2",width:"8",height:"8",rx:"1",key:"88lufb"}]],Fd=Z("blocks",jF);var QF=[["path",{d:"M17 3a2 2 0 0 1 2 2v15a1 1 0 0 1-1.496.868l-4.512-2.578a2 2 0 0 0-1.984 0l-4.512 2.578A1 1 0 0 1 5 20V5a2 2 0 0 1 2-2z",key:"oz39mx"}]],ml=Z("bookmark",QF);var XF=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],ji=Z("bot",XF);var YF=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],ho=Z("check",YF);var JF=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],an=Z("chevron-down",JF);var ZF=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Qi=Z("chevron-left",ZF);var e2=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Ko=Z("chevron-right",e2);var t2=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Bd=Z("chevron-up",t2);var n2=[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]],zd=Z("chevrons-left",n2);var o2=[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]],Ud=Z("chevrons-right",o2);var r2=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],Sn=Z("circle-alert",r2);var a2=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],Xi=Z("copy",a2);var i2=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],sr=Z("ellipsis",i2);var s2=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Hd=Z("eye",s2);var l2=[["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 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}]],Yi=Z("file-code",l2);var d2=[["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"}]],Ji=Z("file-text",d2);var c2=[["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=Z("file",c2);var u2=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],ai=Z("folder",u2);var f2=[["line",{x1:"22",x2:"2",y1:"6",y2:"6",key:"15w7dq"}],["line",{x1:"22",x2:"2",y1:"18",y2:"18",key:"1ip48p"}],["line",{x1:"6",x2:"6",y1:"2",y2:"22",key:"a2lnyx"}],["line",{x1:"18",x2:"18",y1:"2",y2:"22",key:"8vb6jd"}]],Kd=Z("frame",f2);var p2=[["path",{d:"M6 3v12",key:"qpgusn"}],["path",{d:"M18 9a3 3 0 1 0 0-6 3 3 0 0 0 0 6z",key:"1d02ji"}],["path",{d:"M6 21a3 3 0 1 0 0-6 3 3 0 0 0 0 6z",key:"chk6ph"}],["path",{d:"M15 6a9 9 0 0 0-9 9",key:"or332x"}],["path",{d:"M18 15v6",key:"9wciyi"}],["path",{d:"M21 18h-6",key:"139f0c"}]],Vd=Z("git-branch-plus",p2);var m2=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],qd=Z("globe",m2);var g2=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],Wd=Z("grip-vertical",g2);var h2=[["path",{d:"m15 12-9.373 9.373a1 1 0 0 1-3.001-3L12 9",key:"1hayfq"}],["path",{d:"m18 15 4-4",key:"16gjal"}],["path",{d:"m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172v-.344a2 2 0 0 0-.586-1.414l-1.657-1.657A6 6 0 0 0 12.516 3H9l1.243 1.243A6 6 0 0 1 12 8.485V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5",key:"15ts47"}]],Gd=Z("hammer",h2);var v2=[["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"}]],Zi=Z("image",v2);var y2=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],Ta=Z("layers",y2);var x2=[["path",{d:"M11 5h10",key:"1cz7ny"}],["path",{d:"M11 12h10",key:"1438ji"}],["path",{d:"M11 19h10",key:"11t30w"}],["path",{d:"M4 4h1v5",key:"10yrso"}],["path",{d:"M4 9h2",key:"r1h2o0"}],["path",{d:"M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02",key:"xtkcd5"}]],jd=Z("list-ordered",x2);var C2=[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["rect",{x:"3",y:"4",width:"6",height:"6",rx:"1",key:"cif1o7"}]],es=Z("list-todo",C2);var b2=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],Qd=Z("list",b2);var w2=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],ii=Z("loader-circle",w2);var S2=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 9.9-1",key:"1mm8w8"}]],si=Z("lock-open",S2);var I2=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],Xd=Z("lock",I2);var T2=[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}]],ts=Z("message-circle",T2);var k2=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],ns=Z("message-square",k2);var L2=[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]],Yd=Z("minimize-2",L2);var P2=[["path",{d:"M14 4.1 12 6",key:"ita8i4"}],["path",{d:"m5.1 8-2.9-.8",key:"1go3kf"}],["path",{d:"m6 12-1.9 2",key:"mnht97"}],["path",{d:"M7.2 2.2 8 5.1",key:"1cfko1"}],["path",{d:"M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z",key:"s0h3yz"}]],ta=Z("mouse-pointer-click",P2);var A2=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],Jd=Z("package",A2);var E2=[["path",{d:"m14.622 17.897-10.68-2.913",key:"vj2p1u"}],["path",{d:"M18.376 2.622a1 1 0 1 1 3.002 3.002L17.36 9.643a.5.5 0 0 0 0 .707l.944.944a2.41 2.41 0 0 1 0 3.408l-.944.944a.5.5 0 0 1-.707 0L8.354 7.348a.5.5 0 0 1 0-.707l.944-.944a2.41 2.41 0 0 1 3.408 0l.944.944a.5.5 0 0 0 .707 0z",key:"18tc5c"}],["path",{d:"M9 8c-1.804 2.71-3.97 3.46-6.583 3.948a.507.507 0 0 0-.302.819l7.32 8.883a1 1 0 0 0 1.185.204C12.735 20.405 16 16.792 16 15",key:"ytzfxy"}]],os=Z("paintbrush",E2);var R2=[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]],vo=Z("paperclip",R2);var M2=[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],na=Z("pen-line",M2);var N2=[["path",{d:"M13 7 8.7 2.7a2.41 2.41 0 0 0-3.4 0L2.7 5.3a2.41 2.41 0 0 0 0 3.4L7 13",key:"orapub"}],["path",{d:"m8 6 2-2",key:"115y1s"}],["path",{d:"m18 16 2-2",key:"ee94s4"}],["path",{d:"m17 11 4.3 4.3c.94.94.94 2.46 0 3.4l-2.6 2.6c-.94.94-2.46.94-3.4 0L11 17",key:"cfq27r"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],Zd=Z("pencil-ruler",N2);var _2=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],ec=Z("pencil",_2);var D2=[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]],rs=Z("puzzle",D2);var O2=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],as=Z("rotate-ccw",O2);var F2=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],is=Z("search",F2);var B2=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],tc=Z("send",B2);var z2=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],nc=Z("settings",z2);var U2=[["path",{d:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]],gl=Z("sliders-horizontal",U2);var H2=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],li=Z("sparkles",H2);var $2=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],Ao=Z("square-pen",$2);var K2=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],oc=Z("square",K2);var V2=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],ss=Z("star",V2);var q2=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],Vo=Z("terminal",q2);var W2=[["path",{d:"M17 5H3",key:"1cn7zz"}],["path",{d:"M21 12H8",key:"scolzb"}],["path",{d:"M21 19H8",key:"13qgcb"}],["path",{d:"M3 12v7",key:"1ri8j3"}]],rc=Z("text-quote",W2);var G2=[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]],oa=Z("user-round",G2);var j2=[["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"}]],ac=Z("wrench",j2);var Q2=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Zt=Z("x",Q2);var X2=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],ls=Z("zap",X2);ue();function Ce(){return{t:ir().i18n.usePluginTranslation()}}ue();ue();var hl=bt(null),ic=bt(null);function Sf(e,t){let n=wt(ic);he(()=>{if(!(!t||e===null||n===null))return n(e)},[n,t,e])}function sc(){let e=new Map;return{rows:()=>[...e.keys()],acquire:(t,n)=>{e.set(t,(e.get(t)??0)+1),n();let o=!0;return()=>{if(!o)return;o=!1;let r=e.get(t)??0;r>1?e.set(t,r-1):e.delete(t),n()}}}}var Kw=new Set(["Select","AlertDialog","Dialog","DropdownMenu","Menu","Popover","Tooltip","Combobox"]);function le(e){let t=Kw.has(e),n=o=>{let r=ir(),a=hf(),i=ea(),s=r.ui[e],l={};if(t){let d=wt(hl),[c,f]=J(o.defaultOpen===!0),p=typeof o.open=="boolean"?o.open:c;Sf(d,i&&p),he(()=>{i||f(!1)},[i]),l={open:i&&p,onOpenChange:(m,...g)=>{f(m),typeof o.onOpenChange=="function"&&o.onOpenChange(m,...g)}}}return De(s,{...o,...l,...Kw.has(e)&&!i?{open:!1}:{},className:`${a} ${typeof o.className=="string"?o.className:""}`})};return n.displayName=e,n}var hY=le("useLinkContextMenu"),Tr=le("ProviderInstanceIcon"),Vw=le("UserAvatar"),vl=le("Badge"),ce=le("Button"),vY=le("Label"),If=le("Input"),qw=le("Textarea"),yY=le("Switch"),xY=le("Separator"),CY=le("Skeleton"),Tf=le("Spinner"),bY=le("ScrollArea"),wY=le("Card"),SY=le("CardAction"),IY=le("CardContent"),TY=le("CardDescription"),kY=le("CardFooter"),LY=le("CardHeader"),PY=le("CardTitle"),AY=le("Empty"),EY=le("EmptyContent"),RY=le("EmptyDescription"),MY=le("EmptyHeader"),NY=le("EmptyMedia"),_Y=le("EmptyTitle"),DY=le("InputGroup"),OY=le("InputGroupAddon"),FY=le("InputGroupInput"),BY=le("DocumentPanel"),zY=le("MasterDetail"),kf=le("Select"),UY=le("SelectContent"),Lf=le("SelectItem"),Pf=le("SelectPopup"),Ww=le("SelectTrigger"),Af=le("SelectValue"),lc=le("Toggle"),Gw=le("ToggleGroup"),jw=le("AlertDialog"),Qw=le("AlertDialogClose"),Xw=le("AlertDialogDescription"),Yw=le("AlertDialogFooter"),Jw=le("AlertDialogHeader"),Zw=le("AlertDialogPopup"),eS=le("AlertDialogTitle"),Ef=le("Dialog"),HY=le("DialogClose"),Rf=le("DialogDescription"),Mf=le("DialogFooter"),Nf=le("DialogHeader"),_f=le("DialogPopup"),tS=le("DialogPanel"),Df=le("DialogTitle"),$Y=le("DialogTrigger"),KY=le("DropdownMenu"),VY=le("DropdownMenuContent"),qY=le("DropdownMenuItem"),WY=le("DropdownMenuTrigger"),Eo=le("Menu"),dc=le("MenuGroup"),GY=le("MenuGroupLabel"),lr=le("MenuItem"),Ro=le("MenuPopup"),kr=le("MenuRadioGroup"),qo=le("MenuRadioItem"),di=le("MenuSeparator"),Mo=le("MenuTrigger"),yl=le("Popover"),xl=le("PopoverPopup"),Cl=le("PopoverTrigger"),nS=le("Table"),oS=le("TableBody"),ci=le("TableCell"),ds=le("TableHead"),rS=le("TableHeader"),Of=le("TableRow"),Ye=le("Tooltip"),Je=le("TooltipPopup"),Ze=le("TooltipTrigger"),aS=le("Collapsible"),iS=le("CollapsiblePanel"),sS=le("CollapsibleTrigger"),cc=le("Alert"),uc=le("AlertAction"),Ff=le("AlertDescription"),Ih=le("AlertTitle"),Bf=le("Kbd"),zf=le("Command"),Uf=le("CommandGroup"),Hf=le("CommandItem"),$f=le("CommandList"),lS=le("Combobox"),dS=le("ComboboxEmpty"),cS=le("ComboboxInput"),bl=le("ComboboxItem"),uS=le("ComboboxListVirtualized"),fS=le("TooltipProvider"),pS=le("StyledDiffCodeView"),mS=le("DevBackdropArt"),dr=le("Markdown"),gS=le("DiffView");var{jsx:u,jsxs:b,Fragment:Pe}=window.__ycodiumPluginHost.jsxRuntime;function hS({mode:e,onModeChange:t}){let{t:n}=Ce();return b(Gw,{className:"shrink-0","data-view-mode-toggle":!0,size:"xs","aria-label":n("trajectory.toggleLabel"),variant:"segmented",value:[e],onValueChange:o=>{let r=o[0];(r==="chat"||r==="trajectory")&&t(r)},children:[b(lc,{value:"chat","aria-label":n("trajectory.toggleChat"),children:[u(ns,{"aria-hidden":!0}),n("trajectory.toggleChat")]}),b(lc,{value:"trajectory","aria-label":n("trajectory.toggleTrajectory"),children:[u(jd,{"aria-hidden":!0}),n("trajectory.toggleTrajectory")]})]})}function vS({mode:e,visible:t,chat:n,trajectory:o}){let r=e==="chat"?"chat":"trajectory";return u("div",{className:"relative flex min-h-0 flex-1 flex-col","aria-hidden":t?void 0:!0,inert:t?void 0:!0,"data-chat-view-pane":r,"data-pane-visible":t?"true":"false",children:u(wh,{value:t,children:r==="chat"?n:o})})}ue();function eo(){return{t:ir().i18n.usePluginTranslation()}}function yS(e){if(e.cacheDisjoint!==!0)return null;let t=e.cachedInputTokens,n=e.inputTokens;if(t===void 0||n===void 0)return null;let o=t+n;if(o<=0)return null;if(t>=o)return"100%";let r=t/o*100;for(let a=0;a<=3;a+=1){let i=r.toFixed(a);if(Number.parseFloat(i)<100)return`${i}%`}return"99.9%"}function xS(e){let t,n,o,r=!0,a=!1;for(let i of e)i!==void 0&&(a=!0,i.cacheDisjoint!==!0&&(r=!1),i.outputTokens!==void 0&&(t=(t??0)+i.outputTokens),i.inputTokens!==void 0&&(n=(n??0)+i.inputTokens),i.cachedInputTokens!==void 0&&(o=(o??0)+i.cachedInputTokens));if(!(t===void 0&&n===void 0&&o===void 0))return{...a&&r?{cacheDisjoint:!0}:{},...t!==void 0?{outputTokens:t}:{},...n!==void 0?{inputTokens:n}:{},...o!==void 0?{cachedInputTokens:o}:{}}}function fc(e){return e<1e3?String(Math.round(e)):e<1e6?`${(e/1e3).toFixed(1).replace(/\.0$/,"")}k`:`${(e/1e6).toFixed(1).replace(/\.0$/,"")}m`}var Y2=pe(function({item:t,ordinal:n,usage:o,onSelect:r}){return b("button",{type:"button","data-turn-navigator-row":t.sectionKey,onClick:()=>r(t),className:"flex w-full cursor-pointer items-start gap-2.5 rounded-md px-2 py-1.5 text-left transition-colors hover:bg-accent",children:[u("span",{className:"shrink-0 pt-px font-mono text-[10px] text-muted-foreground tabular-nums",children:n}),b("span",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[u("span",{className:"line-clamp-2 min-w-0 font-medium text-chat leading-snug",children:t.userText}),t.assistantText?b("span",{className:"flex items-baseline gap-2",children:[u("span",{className:"line-clamp-1 min-w-0 flex-1 text-[11px] text-muted-foreground leading-snug",children:t.assistantText}),o?.outputTokens!==void 0?u("span",{className:"shrink-0 font-mono text-[9px] text-muted-foreground tabular-nums",children:fc(o.outputTokens)}):null]}):null]})]})});function J2({totals:e}){let{t}=eo();if(!e)return null;let n=yS(e),o=[e.outputTokens===void 0?null:{label:t("turnNavigator.usageOutput"),value:fc(e.outputTokens)},e.inputTokens===void 0?null:{label:t("turnNavigator.usageInput"),value:fc(e.inputTokens)},e.cachedInputTokens===void 0?null:{label:t("turnNavigator.usageCacheRead"),value:n===null?fc(e.cachedInputTokens):`${fc(e.cachedInputTokens)} (${n})`}].filter(r=>r!==null);return o.length===0?null:b("div",{className:"flex items-baseline gap-2 border-t px-2 py-1.5",children:[u("span",{className:"flex-1 font-mono text-[10px] text-muted-foreground uppercase tracking-[0.14em]",children:t("turnNavigator.usage")}),o.map(r=>b("span",{className:"shrink-0 font-mono text-[10px] text-muted-foreground tabular-nums",children:[r.label," ",r.value]},r.label))]})}var Z2=pe(function({getText:t,size:n="xs",variant:o="outline",className:r}){let{t:a}=eo(),i=ir().writeClipboard,[s,l]=J(!1),d=a("turnNavigator.copyMarkdown");return b(Ye,{children:[u(Ze,{render:u(ce,{"aria-label":d,disabled:s,onClick:()=>{i(t()).then(()=>{l(!0),window.setTimeout(()=>l(!1),1e3)})},type:"button",size:n,variant:o,className:$("text-muted-foreground hover:text-foreground",r)}),children:s?u(ho,{className:"size-3 text-primary"}):u(Xi,{className:"size-3"})}),u(Je,{children:u("p",{children:d})})]})});function CS({items:e,totalTurnCount:t,bottomInset:n,usageByTurnId:o,onSelect:r,exportMarkdown:a,onDownload:i,placement:s="float"}){let{t:l}=eo(),[d,c]=J(!1),f=K(()=>e.map((h,v)=>({item:h,ordinal:v+1})).reverse(),[e]),p=K(()=>xS(f.map(({item:h})=>h.turnId===null?void 0:o.get(h.turnId))),[f,o]);if(e.length===0)return null;let m=t??e.length,g=l("turnNavigator.open",{count:m});return b(yl,{onOpenChange:c,open:d,children:[b(Cl,{render:u(ce,{"aria-label":g,className:$("gap-1.5 rounded-full px-3",s==="float"&&"absolute right-3 z-40"),"data-testid":"turn-navigator-pill",size:"xs",style:s==="float"?{bottom:n+12}:void 0,title:g,variant:"glass"}),children:[u(Qd,{"aria-hidden":!0}),u("span",{className:"font-mono font-semibold text-[11px] tabular-nums",children:m})]}),u(xl,{align:"end",className:"w-80 flex-col",side:"top",children:b("div",{className:"flex max-h-[min(60vh,26rem)] flex-col",children:[b("div",{className:"flex items-center gap-1.5 border-b px-2 py-1.5",children:[u("span",{className:"flex-1 font-mono text-[10px] text-muted-foreground uppercase tracking-[0.14em]",children:l("turnNavigator.title")}),u("span",{className:"font-mono text-[10px] text-muted-foreground tabular-nums",children:m})]}),u("div",{className:$("min-h-0 flex-1 overflow-y-auto overflow-x-hidden p-1"),children:f.map(({item:h,ordinal:v})=>u(Y2,{item:h,onSelect:y=>{c(!1),r(y)},ordinal:v,usage:h.turnId===null?void 0:o.get(h.turnId)},h.sectionKey))}),u(J2,{totals:p}),b("div",{className:"flex items-center gap-1 border-t px-2 py-1.5",children:[u("span",{className:"flex-1 font-mono text-[10px] text-muted-foreground uppercase tracking-[0.14em]",children:l("turnNavigator.export")}),u(Z2,{size:"icon-xs",getText:a,variant:"ghost"}),u(ce,{"aria-label":l("turnNavigator.downloadMarkdown"),onClick:()=>i("md"),size:"xs",title:l("turnNavigator.downloadMarkdown"),variant:"ghost",children:u("span",{className:"font-mono text-[10px]",children:".md"})}),u(ce,{"aria-label":l("turnNavigator.downloadJson"),onClick:()=>i("json"),size:"xs",title:l("turnNavigator.downloadJson"),variant:"ghost",children:u("span",{className:"font-mono text-[10px]",children:".json"})})]})]})})]})}ue();ue();function eB(e){return e!==null&&"tagName"in e&&"closest"in e}function ui(e){return eB(e)?e.tagName==="INPUT"||e.tagName==="TEXTAREA"?!0:e.closest('[contenteditable]:not([contenteditable="false"])')!==null:!1}function Th(e,t){if(!/^[1-9]$/.test(e))return null;let n=Number(e)-1;return n<t?n:null}function bS(e,t){let n=e.findIndex(o=>o.decision===t);return n===-1?null:{type:"respond",index:n}}function wS(e,t){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return null;switch(e.key){case"Enter":return bS(t,"accept");case"Escape":return bS(t,"cancel");case"ArrowDown":case"ArrowRight":return{type:"move",delta:1};case"ArrowUp":case"ArrowLeft":return{type:"move",delta:-1};default:{let n=Th(e.key,t.length);return n===null?null:{type:"respond",index:n}}}}ue();var wl=new Map,SS=24,tB=4e3,nB=1024,IS=16384;function kh(e){let t=wl.get(e);if(t)return t;let n={values:new Map,listeners:new Set,stringLength:0};if(wl.set(e,n),wl.size>SS){for(let[o,r]of wl)if(r.listeners.size===0&&o!==e&&(wl.delete(o),wl.size<=SS))break}return n}function Lh(e,t,n){return kh(e).values.get(t)??n}function pc(e,t,n,o=!0){let r=kh(e);if(typeof n=="string"&&(n=n.slice(0,nB)),r.values.get(t)===n)return;let a=r.values.get(t);if(typeof a=="string"&&(r.stringLength-=a.length),r.values.delete(t),r.values.set(t,n),typeof n=="string"&&(r.stringLength+=n.length),r.stringLength>IS){for(let[i,s]of r.values)if(!(typeof s!="string"||i===t)&&(r.values.delete(i),r.stringLength-=s.length,r.stringLength<=IS))break}if(r.values.size>tB){let i=r.values.keys().next().value;if(i!==void 0){let s=r.values.get(i);typeof s=="string"&&(r.stringLength-=s.length),r.values.delete(i)}}o&&r.listeners.forEach(i=>i())}function Wo(e,t,n){let o=R(s=>{let l=kh(e);return l.listeners.add(s),()=>l.listeners.delete(s)},[e]),r=R(()=>Lh(e,t,n),[e,t,n]),a=$o(o,r,r),i=R(s=>pc(e,t,s),[e,t]);return[a,i]}function Kf(e){return JSON.stringify([e.turnId??null,e.toolCallId?"tool":"entry",e.toolCallId||e.id])}function TS(e){let t=e.map(o=>({key:o.key,turnId:o.turnId,firstRowIndex:o.firstRowIndex,endRowIndex:o.firstRowIndex+o.rowIds.length})),n=new Map;for(let o of e)for(let[r,a]of o.rowIds.entries())n.set(a,{turnId:o.turnId,index:o.firstRowIndex+r});return{sections:t,bySectionKey:new Map(t.map(o=>[o.key,o])),byRowId:n}}function Vf({index:e,visibleSectionKeys:t,protectedRowIds:n,selectionRows:o}){let r=t.flatMap(d=>{let c=e.bySectionKey.get(d)?.turnId;return c==null?[]:[c]}),a=n.flatMap(d=>{let c=e.byRowId.get(d)?.turnId;return c==null?[]:[c]}),i=o?e.byRowId.get(o.firstRowId)?.index:void 0,s=o?e.byRowId.get(o.lastRowId)?.index:void 0,l=i===void 0||s===void 0?[]:e.sections.flatMap(d=>d.turnId!==null&&d.endRowIndex>Math.min(i,s)&&d.firstRowIndex<=Math.max(i,s)?[d.turnId]:[]);return{firstTurnId:r[0]??null,lastTurnId:r.at(-1)??null,protectedTurnIds:[...new Set(a)],selectionTurnRange:l.length>0?{firstTurnId:l[0],lastTurnId:l.at(-1)}:null}}function kS(e,t,n,o){if(!o)return n;let r=e.findIndex(a=>t.has(a));return r<0?n:Math.max(n,e.length-r)}ue();ue();function Ph(e,t){for(let n of e.querySelectorAll("[data-timeline-row-id]"))if(n.dataset.timelineRowId===t)return n;return null}function cs(e,t){let n=0,o=e.length,r=-1;for(;n<o;){let a=Math.floor((n+o)/2),s=e[a].getBoundingClientRect();Math.max(s.bottom,s.top+1)>t?(r=a,o=a):n=a+1}return r}function oB(e){let t=e.getBoundingClientRect().top,n=e.querySelectorAll("[data-timeline-turn-section]"),o=a=>{let i=a.querySelectorAll("[data-timeline-row-id]"),s=cs(i,t),l=s<0?void 0:i[s],d=l?.dataset.timelineRowId;return!l||d===void 0?null:{rowId:d,offsetPx:Math.round(t-l.getBoundingClientRect().top)}};if(n.length===0)return o(e);let r=cs(n,t);if(r<0)return null;for(let a=r;a<n.length;a+=1){let i=o(n[a]);if(i)return i}return null}function LS(e,t){let n=0,o=e;for(;o&&o!==t;)n+=o.offsetTop,o=o.offsetParent;return n}var Ah=class extends wa{getSnapshotBeforeUpdate(t){return t.inputKey!==this.props.inputKey&&t.onBeforeInputChange(),null}componentDidUpdate(){}componentWillUnmount(){this.props.onBeforeInputChange()}render(){return this.props.children}};function PS({inputKey:e,onBeforeInputChange:t,handleRef:n,onAttach:o,className:r,children:a,onScroll:i,onInteractionRowsChange:s}){let l=N(null),d=N({inputKey:e,store:sc()});d.current.inputKey!==e&&(d.current={inputKey:e,store:sc()});let c=N(s);c.current=s;let f=R(m=>{let g=d.current;return g.store.acquire(m,()=>{d.current===g&&c.current?.(g.store.rows())})},[]);he(()=>{s?.(d.current.store.rows())},[e,s]),ar(n,()=>({get node(){return l.current},measure:()=>{let m=l.current;return m?{scroll:m.scrollTop,scrollLength:m.clientHeight,contentLength:m.scrollHeight,topOf:g=>{let h=Ph(m,g);return h===null?null:LS(h,m)},heightOf:g=>{let h=Ph(m,g);return h===null?null:h.offsetHeight},rowAtScroll:()=>oB(m)}:null},scrollToEnd:m=>{let g=l.current;if(g){if(m?.animated){g.scrollTo({top:g.scrollHeight,behavior:"smooth"});return}g.scrollTop=g.scrollHeight-g.clientHeight}},scrollToRow:(m,g)=>{let h=l.current;if(!h)return!1;let v=Ph(h,m);return v?(h.scrollTop=Math.max(0,LS(v,h)-(g?.viewOffset??0)),!0):!1},scrollToOffset:m=>{let g=l.current;g&&(g.scrollTop=Math.max(0,m))}}),[]);let p=R(m=>{l.current=m,o(m)},[o]);return u(Ah,{inputKey:e,onBeforeInputChange:t,children:u(ic,{value:f,children:u("div",{ref:p,className:r,style:{position:"relative"},onScroll:i,children:a})})})}function Il(e){if(!e)return!1;let t=e.tagName?.toLowerCase(),n=e.getAttribute?.("contenteditable");if(t==="textarea"||n==="true"||n===""||n==="plaintext-only"||"isContentEditable"in e&&e.isContentEditable===!0)return!0;if(t==="input"){let o=e.getAttribute?.("type")?.toLowerCase()??"text";if(!["button","submit","reset","image","checkbox","radio"].includes(o))return!0}return e.matches?.(":focus-visible")??!1}function Sl(e,t){let o=(e?.nodeType===1?e:e?.parentElement)?.closest("[data-timeline-row-id]");return o&&t.contains(o)?o.dataset.timelineRowId??null:null}function qf(e){let t=e.ownerDocument.getSelection?.();if(!t||t.isCollapsed)return null;let n=null,o=null;for(let d=0;d<t.rangeCount;d+=1){let c=t.getRangeAt(d);c.intersectsNode(e)&&(n??=c,o=c)}if(!n||!o)return null;let r=Sl(n.startContainer,e),a=Sl(o.endContainer,e);if(r&&a)return{firstRowId:r,lastRowId:a};let i=e.querySelectorAll("[data-timeline-row-id]"),s=i[0]?.dataset.timelineRowId,l=i[i.length-1]?.dataset.timelineRowId;return s&&l?{firstRowId:r??s,lastRowId:a??l}:null}function mc(e){let t=e.ownerDocument.getSelection?.();if(!t||t.isCollapsed)return!1;for(let n=0;n<t.rangeCount;n+=1)if(t.getRangeAt(n).intersectsNode(e))return!0;return!1}ue();function fi(e){let t=N(e);t.current=e;let n=N(!1),o=N(null),r=N(null),a=N(0),i=R(()=>{a.current+=1,r.current!==null&&cancelAnimationFrame(r.current),r.current=null},[]),s=R(()=>{if(!n.current||!t.current||r.current!==null||o.current===null)return;let c=++a.current;r.current=requestAnimationFrame(f=>{if(c!==a.current||(r.current=null,!n.current||!t.current))return;let p=o.current;o.current=null,p?.(f)})},[]),l=R(c=>{o.current=c,s()},[s]),d=R(()=>{o.current=null,i()},[i]);return he(()=>(n.current=!0,s(),()=>{n.current=!1,i()}),[e,i,s]),K(()=>({request:l,cancel:d}),[l,d])}function AS({root:e,inputKey:t,visible:n,index:o,topInset:r,bottomInset:a,interactionRows:i,onRangeChange:s,onSelectionChange:l}){let d=N({inputKey:t,visible:n,index:o,topInset:r,bottomInset:a,interactionRows:i,onRangeChange:s,onSelectionChange:l});d.current={inputKey:t,visible:n,index:o,topInset:r,bottomInset:a,interactionRows:i,onRangeChange:s,onSelectionChange:l};let c=fi(n),f=N(null),p=R(()=>{let g=d.current;if(!e||!g.visible||e.clientHeight<=0)return;let h=e.getBoundingClientRect();if(h.height<=0)return;let v=h.top+g.topInset,y=h.bottom-g.bottomInset,x=e.querySelectorAll("[data-timeline-turn-section]"),C=cs(x,v),w=[];if(C>=0)for(let T=C;T<x.length;T+=1){let A=x[T];if(A.getBoundingClientRect().top>=y)break;A.dataset.timelineTurnSection!==void 0&&w.push(A.dataset.timelineTurnSection)}let L=[...g.interactionRows()],S=e.ownerDocument.activeElement;if(Il(S)){let T=Sl(S,e);T&&L.push(T)}let k=Vf({index:g.index,visibleSectionKeys:w,protectedRowIds:L,selectionRows:qf(e)}),I=`${g.inputKey}:${JSON.stringify(k)}`;I!==f.current&&(f.current=I,g.onRangeChange?.(k))},[e]),m=R(()=>c.request(p),[c,p]);return he(()=>{if(f.current=null,!n||!e)return;let g=t,h=!0,v=()=>{!h||d.current.inputKey!==g||!d.current.visible||(d.current.onSelectionChange(mc(e)),m())};e.addEventListener("scroll",v,{passive:!0}),e.addEventListener("focusin",v),e.addEventListener("focusout",v),e.ownerDocument.addEventListener("selectionchange",v);let y=typeof ResizeObserver>"u"?null:new ResizeObserver(v);return y?.observe(e),e.firstElementChild&&y?.observe(e.firstElementChild),v(),()=>{h=!1,c.cancel(),y?.disconnect(),e.removeEventListener("scroll",v),e.removeEventListener("focusin",v),e.removeEventListener("focusout",v),e.ownerDocument.removeEventListener("selectionchange",v),s?.(null)}},[c,t,s,m,e,n]),he(()=>{n&&m()},[o,m,n]),m}ue();function ka(e){if(!Number.isFinite(e)||e<0)return"0ms";if(e<1e3)return`${Math.max(1,Math.round(e))}ms`;if(e<1e4){let i=Math.round(e/100)/10;return i>=10?"10s":`${i.toFixed(1)}s`}if(e<6e4)return`${Math.round(e/1e3)}s`;let t=Math.round(e/1e3),n=Math.floor(t/3600),o=Math.floor(t%3600/60),r=t%60,a=[];return n>0&&a.push(`${n}h`),o>0&&a.push(`${o}m`),r>0&&a.push(`${r}s`),a.join(" ")}function rB(e,t){let n={hour:"numeric",minute:"2-digit",...t?{second:"2-digit"}:{}};return e==="locale"?n:{...n,hour12:e==="12-hour"}}function aB(e){let t=e?.trim();if(t)try{return Intl.DateTimeFormat.supportedLocalesOf([t]),t}catch{return}}function iB(){return typeof window>"u"?null:window.desktopBridge?.getSystemLocale?.()??null}var Eh=aB(iB()),ES=new Map;function RS(e,t){let n=`${e}:${t?"seconds":"minutes"}`,o=ES.get(n);if(o)return o;let r=new Intl.DateTimeFormat(Eh,rB(e,t));return ES.set(n,r),r}function Rh(e){let t=new Date(e);return Number.isNaN(t.getTime())?null:t}var sB=new Intl.DateTimeFormat(void 0,{month:"long"});function lB(e){let t=e%100;if(t>=11&&t<=13)return"th";switch(e%10){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}}function dB(e,t){let n=Rh(e);return n?RS(t,!1).format(n):""}function ra(e,t){let n=Rh(e);if(!n)return"";let o=dB(e,t),r=n.getDate(),a=sB.format(n),i=n.getFullYear();return`${o}, ${r}${lB(r)} ${a} ${i}`}var cB=new Intl.DateTimeFormat(Eh,{month:"numeric",day:"numeric"}),uB=new Intl.DateTimeFormat(Eh,{month:"numeric",day:"numeric",year:"numeric"});function pi(e,t,n,o=Date.now()){let r=Rh(e);if(!r)return"";let a=RS(t,!1).format(r),i=new Date(o),s=new Date(i.getFullYear(),i.getMonth(),i.getDate()).getTime(),l=new Date(r.getFullYear(),r.getMonth(),r.getDate()).getTime(),d=Math.round((s-l)/864e5);return d<=0?a:d===1?n("relativeTime.yesterdayAt",{time:a}):`${(r.getFullYear()===i.getFullYear()?cB:uB).format(r)} ${a}`}ue();ue();var Tl=class extends Error{reason;constructor(t,n,o){super(n,o),this.reason=t}};function fB(e){if(typeof document>"u"||typeof document.execCommand!="function")return!1;let t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.setAttribute("aria-hidden","true"),t.style.position="fixed",t.style.top="0",t.style.left="0",t.style.opacity="0",t.style.fontSize="16px";let n=document.activeElement;document.body.appendChild(t);try{return t.focus({preventScroll:!0}),t.select(),t.setSelectionRange(0,e.length),document.execCommand("copy")}catch{return!1}finally{t.remove();let o=n?.focus;typeof o=="function"&&o.call(n)}}async function pB(e,t){let n=()=>new Tl("unavailable",`Clipboard API is unavailable while copying ${t}.`);if(typeof window>"u")throw n();if(!e)return!1;if(typeof navigator>"u"||!navigator.clipboard?.writeText){if(fB(e))return!0;throw n()}try{return await navigator.clipboard.writeText(e),!0}catch(o){throw new Tl("write-failed",`Failed to copy ${t} to the clipboard.`,{cause:o})}}function Wf({timeout:e=2e3,target:t="text",onCopy:n,onError:o}={}){let[r,a]=J(!1),i=N(null),s=N(n),l=N(o),d=N(t),c=N(e);s.current=n,l.current=o,d.current=t,c.current=e;let f=R((p,m)=>{pB(p,d.current).then(g=>{g&&(i.current&&clearTimeout(i.current),a(!0),s.current?.(m),c.current!==0&&(i.current=setTimeout(()=>{a(!1),i.current=null},c.current)))},g=>{l.current?.(g instanceof Error?g:new Error(String(g)),m)})},[]);return W(()=>()=>{i.current&&clearTimeout(i.current)},[]),{copyToClipboard:f,isCopied:r}}function ut(){let e=ir().i18n.usePluginTranslation();return{t:(t,n)=>e(t,n)}}var MS=1e3,mB={unavailable:"copyButton.clipboardUnavailable","write-failed":"copyButton.copyFailedDetail"};function gB({title:e,description:t}){return b("span",{role:"status",className:"dropdown-glass pointer-events-none fixed z-100 rounded-md px-2 py-1 text-balance text-popover-foreground text-xs shadow-xl shadow-black/25",children:[e,t?u("span",{className:"block text-muted-foreground",children:t}):null]})}var kl=pe(function({text:t,size:n="xs",variant:o="outline",className:r,toastAnchor:a="above"}){let{t:i}=ut(),s=N(null),[l,d]=J(null),c=N(null),f=(g,h)=>{let v=s.current?.getBoundingClientRect();v&&(c.current&&clearTimeout(c.current),d({top:a==="above"?Math.max(4,v.top-(h===void 0?26:40)):Math.min(window.innerHeight-26,v.bottom+4),left:Math.max(4,v.left+v.width/2),title:g,description:h}),c.current=setTimeout(()=>d(null),MS))};W(()=>()=>{c.current&&clearTimeout(c.current)},[]);let{copyToClipboard:p,isCopied:m}=Wf({onCopy:()=>f(i("copyButton.copied")),onError:g=>f(i("copyButton.failedToCopy"),g instanceof Tl?i(mB[g.reason]):g.message),timeout:MS});return b(Ye,{children:[u(Ze,{render:u(ce,{"aria-label":i("copyButton.copyToClipboard"),disabled:m,onClick:()=>p(t),ref:s,type:"button",size:n,variant:o,className:$("text-muted-foreground hover:text-foreground",r)}),children:m?u(ho,{className:"size-3 text-primary"}):u(Xi,{className:"size-3"})}),u(Je,{children:u("p",{children:i("copyButton.copyToClipboard")})}),l?u("span",{"aria-hidden":!0,className:"pointer-events-none fixed",style:{top:l.top,left:l.left},children:u("span",{className:"relative block -translate-x-1/2",children:u(gB,{title:l.title,description:l.description})})}):null]})});function hB(e){return e<1e3?Math.round(e).toLocaleString():e<1e6?`${(e/1e3).toFixed(1).replace(/\.0$/,"")}k`:`${(e/1e6).toFixed(1).replace(/\.0$/,"")}m`}function Gf({label:e,children:t}){let[n,o]=J(!1);return b(Ye,{open:n,onOpenChange:o,children:[u(Ze,{render:u("button",{type:"button",className:"inline-flex items-center gap-1 rounded-sm"}),"aria-label":e,onClick:()=>o(r=>!r),children:t}),u(Je,{children:e})]})}var NS=pe(function({footer:t,timestampFormat:n,copyText:o}){let{t:r}=ut(),a=t.state,i=r(a==="completed"?"timeline.completed":a==="error"?"timeline.error":a==="interrupted"?"timeline.interrupted":"timeline.unknown");return b("div",{"data-turn-summary":t.turnId,className:"chat-process-meta flex min-w-0 items-center gap-2 px-1 text-muted-foreground",children:[b("div",{className:"flex min-w-0 flex-1 flex-wrap items-center gap-x-2 gap-y-1",children:[a!=="unknown"?b(Gf,{label:i,children:[a==="completed"?u(ho,{className:"size-icon-1 text-success","aria-hidden":!0}):a==="error"?u(Zt,{className:"size-icon-1 text-destructive","aria-hidden":!0}):u(oc,{className:"size-3","aria-hidden":!0}),u("span",{className:"sr-only",children:i})]}):null,t.completedAt?u(Gf,{label:ra(t.completedAt,n),children:u("time",{dateTime:t.completedAt,children:pi(t.completedAt,n,r)})}):null,t.workingElapsedMs!==void 0?b(Gf,{label:r("timeline.workingTime",{duration:ka(t.workingElapsedMs)}),children:[u("span",{"aria-hidden":!0,children:"\xB7 "}),ka(t.workingElapsedMs)]}):null,t.outputTokens!==void 0?b(Gf,{label:`${r("timeline.outputTokens")}: ${t.outputTokens.toLocaleString()}`,children:[u("span",{"aria-hidden":!0,children:"\xB7 "}),hB(t.outputTokens)]}):null]}),o?u(kl,{text:o,variant:"ghost",size:"icon-xs",className:"shrink-0",toastAnchor:"below"}):null]})});ue();ue();function _S(e){if(e<1e3)return String(e);if(e<1e6){let n=e/1e3;return`${n<10?n.toFixed(1).replace(/\.0$/,""):Math.round(n)}k`}if(e<1e9){let n=e/1e6;return`${n<10?n.toFixed(1).replace(/\.0$/,""):Math.round(n)}m`}let t=e/1e9;return`${t<10?t.toFixed(1).replace(/\.0$/,""):Math.round(t)}b`}var DS=pe(function(t){let{additions:n,deletions:o,className:r,showParentheses:a=!1,layout:i="aligned"}=t,{t:s}=ut(),l=new Intl.ListFormat(void 0,{type:"unit"}).format([s("changedFiles.additions",{count:n}),s("changedFiles.deletions",{count:o})]);return b(Pe,{children:[a&&u("span",{className:"text-muted-foreground/70",children:"("}),b("span",{role:"group","aria-label":l,className:$(i==="inline"?"inline-flex items-center gap-1 tabular-nums align-middle":"inline-grid grid-cols-[4ch_4ch] gap-2 text-right tabular-nums align-middle",r),children:[b("span",{"aria-hidden":"true",className:"font-mono text-diff-addition",children:["+",_S(n)]}),b("span",{"aria-hidden":"true",className:"font-mono text-diff-deletion",children:["-",_S(o)]})]}),a&&u("span",{className:"text-muted-foreground/70",children:")"})]})});function vB(e){let t=e,n,o,r=t.match(/:(\d+)$/);if(!r?.[1])return{path:t,line:void 0,column:void 0};n=r[1],t=t.slice(0,-r[0].length);let a=t.match(/:(\d+)$/);return a?.[1]?(o=a[1],t=t.slice(0,-a[0].length)):(o=n,n=void 0),{path:t,line:o,column:n}}function OS(e){return e.replaceAll("\\","/")}function FS(e){return/^\/[A-Za-z]:\//.test(e)?e.slice(1):e}function yB(e){return e.replace(/[\\/]+$/,"")}function xB(e){let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t>=0?e.slice(t+1):e}function CB(e){return e.replace(/^\.\/+/,"").replace(/^\/+/,"")}function bB(e){return e.startsWith("/")||/^[A-Za-z]:\//.test(e)}function jf(e,t){let{path:n,line:o,column:r}=vB(e),a=FS(OS(n)),i=a;if(t){let s=FS(OS(yB(t))),l=xB(s),d=a.toLowerCase(),c=s.toLowerCase(),f=`${c}/`,p=`${l.toLowerCase()}/`;if(d===c)i=l;else if(d.startsWith(f)){let m=a.slice(s.length+1);i=`${l}/${m}`}else if(!bB(a)){let m=CB(a);i=d.startsWith(p)?a:`${l}/${m}`}}return o?`${i}:${o}${r?`:${r}`:""}`:i}function BS(e){return e==="failed"?"failed":e==="running"?"running":"idle"}function zS(e){return e.includes("failed")?"failed":e.includes("running")?"running":"idle"}var Qf="chat-process-row flex w-full min-w-0 items-center gap-1.5 px-2 text-left";function gc({children:e}){return u("span",{"aria-hidden":!0,className:"flex size-4 shrink-0 items-center justify-center",children:e})}function hc({status:e}){return u("span",{"aria-hidden":!0,className:"flex size-2 shrink-0 items-center justify-center",children:e===null?null:u("span",{className:$("block size-2 rounded-full",e==="failed"?"bg-destructive":e==="success"?"bg-success":"border border-muted-foreground/60")})})}function Xf({state:e,variant:t="inline",className:n,children:o}){return b("div",{"data-process-state":e,"data-process-kind":t,className:$("chat-process-shell relative min-w-0 overflow-hidden",t==="tool"?"rounded-lg bg-card":"rounded-md",n),children:[e==="running"?u("span",{"aria-hidden":!0,className:"chat-process-shell-pulse animate-status-pulse"}):null,o]})}function vc({name:e,className:t}){switch(e){case"bot":return u(ji,{className:t,"aria-hidden":!0});case"check":return u(ho,{className:t,"aria-hidden":!0});case"circle-alert":return u(Sn,{className:t,"aria-hidden":!0});case"eye":return u(Hd,{className:t,"aria-hidden":!0});case"globe":return u(qd,{className:t,"aria-hidden":!0});case"hammer":return u(Gd,{className:t,"aria-hidden":!0});case"message-circle":return u(ts,{className:t,"aria-hidden":!0});case"search":return u(is,{className:t,"aria-hidden":!0});case"square-pen":return u(Ao,{className:t,"aria-hidden":!0});case"terminal":return u(Vo,{className:t,"aria-hidden":!0});case"wrench":return u(ac,{className:t,"aria-hidden":!0});case"x":return u(Zt,{className:t,"aria-hidden":!0});case"zap":return u(ls,{className:t,"aria-hidden":!0})}}function wB(e){switch(e){case"read":return"eye";case"edit":return"square-pen";case"command":return"terminal";case"search":return"globe";case"code-search":return"search";case"other":return"wrench";case"dynamic-tool":return"hammer";case"agent-tool":return"bot";case"tone-tool":return"zap";case"mixed":case null:return"hammer"}}function Mh(e,t){let n=new Map;for(let o of e){let r=t(o);n.set(r,(n.get(r)??0)+1)}return Array.from(n,([o,r])=>({action:o,icon:wB(o),count:r}))}function Nh(e,t){let n;for(let o of Mh(e,t))(!n||o.count>n.count)&&(n=o);return n?.icon??"wrench"}var Ll=20;function Pl(e){return Kf(e)}function US(e,t,n){let o=e.toolLabel,r=n.resolveToolCommand(e);if(r&&o?.descriptive&&!o.path&&o.detail?.trim())return o.detail.replace(/\s+/g," ").trim();for(let p of[e.rawCommand,e.command]){let m=n.parseToolCommandInput(p)?.description;if(m)return m.replace(/\s+/g," ").trim()}if(r)return r.replace(/\s+/g," ").trim();let a=typeof e.toolData=="object"&&e.toolData!==null&&!Array.isArray(e.toolData)?e.toolData:null,i=typeof a?.toolName=="string"?a.toolName:typeof a?.name=="string"?a.name:void 0,s=o?.name??i??e.toolTitle??e.label,l=o?.path??e.changedFiles?.[0],d=l?jf(l,t):void 0,c=[s.trim().toLowerCase()==="tool"?void 0:s,d,o?.detail??e.detail],f=[];for(let p of c){let m=p?.replace(/\s+/g," ").trim();m&&!f.some(g=>g.toLowerCase()===m.toLowerCase())&&f.push(m)}return f.join(" ")||null}function HS({entry:e,failed:t}){let n=e.toolLabel?.diffStat;return!n||t||_h(e)?null:u(DS,{...n,layout:"inline",className:"chat-process-meta ms-2 shrink-0"})}function _h(e){return e.toolLifecycleStatus==="declined"||e.toolLifecycleStatus==="stopped"}function $S({toolIcon:e,glyphClassName:t}){let n=wt(cn),o=n.SiteIcon;return e.pageUrl!==void 0&&o!==void 0?u(o,{threadRef:n.threadRef,pageUrl:e.pageUrl,className:"size-3.5 shrink-0 rounded-sm object-contain"}):u(vc,{name:"globe",className:t})}function SB({entry:e,failed:t=!1,derive:n}){return t?u(Sn,{"aria-hidden":!0,className:"size-icon-1 shrink-0 text-destructive"}):e.toolIcon!==void 0?u($S,{toolIcon:e.toolIcon,glyphClassName:"size-icon-1 shrink-0 stroke-[1.8] text-muted-foreground opacity-70"}):u(vc,{name:Nh([e],n.toolGroupAction),className:"size-icon-1 shrink-0 stroke-[1.8] text-muted-foreground opacity-70"})}function IB({entries:e,failed:t,derive:n}){let{t:o}=ut(),r=K(()=>Mh(e,n.toolGroupAction),[e,n]),a=r.length===1;return a&&r[0].count<2?null:u("span",{className:"chat-process-meta flex shrink-0 items-center gap-2 tabular-nums","aria-label":o("toolGroup.calls",{count:e.length}),children:r.map(({action:i,icon:s,count:l})=>b("span",{"aria-hidden":!0,className:"flex items-center gap-1",children:[a?null:u(vc,{name:s,className:$("size-icon-1 shrink-0 stroke-[1.8] opacity-70",t?"text-destructive":"text-icon-muted")}),l]},i))})}function KS({entry:e}){let t=wt(cn),n=e.detail??e.command??e.rawCommand??e.toolLabel?.detail,o=JSON.stringify([e.id,e.sourceActivityKind,e.toolLifecycleStatus]),r=t.renderToolCallDetail?.({entry:e,threadRef:t.threadRef,threadKey:t.threadKey,workspaceRoot:t.workspaceRoot,revision:o,onOpenFileDiff:t.onOpenFileDiff});return u("div",{className:"min-w-0 space-y-2 p-3",children:r!==void 0?u(Pe,{children:r}):u("pre",{className:"chat-tool-body overflow-x-auto rounded-md bg-muted/40 p-2",children:n??""})})}var TB=pe(function(t){let{entry:n,threadKey:o,workspaceRoot:r,onDisclosureChange:a}=t,s=wt(cn).derive,{t:l}=ut(),[d,c]=Wo(o,`call:${Pl(n)}`,!1),f=s.workEntryIndicatesFailure(n),p=_h(n),m=s.resolveWorkEntryStatus(n),g=m==="failed"||m==="running"?m:null,h=Jr();return b("div",{"data-tool-call-id":n.toolCallId??n.id,"data-tool-identity":Pl(n),className:"border-b border-border/50 last:border-b-0",children:[b("button",{type:"button","aria-expanded":d,"aria-controls":h,onClick:()=>{a?.(),c(!d)},className:$("chat-tool-member-row chat-tool-summary flex w-full min-w-0 items-center gap-1.5 px-3 text-left hover:bg-accent/20",f?"text-destructive":"text-muted-foreground"),children:[u(hc,{status:g}),u(gc,{children:u(SB,{entry:n,failed:f,derive:s})}),b("span",{className:"flex min-w-0 flex-1 items-center",children:[u("span",{className:"truncate",children:US(n,r,s)??l("toolGroup.calls",{count:1})}),u(HS,{entry:n,failed:f})]}),f||p?u("span",{className:"chat-process-meta shrink-0",children:f?l("toolGroup.failed",{count:1}):l("toolGroup.cancelled",{count:1})}):null,u(an,{"aria-hidden":!0,className:$("size-icon-1 shrink-0",!d&&"-rotate-90")})]}),d?u("div",{id:h,children:u(KS,{entry:n})}):null]})});function kB({threadKey:e,stateKey:t,maxHeight:n,children:o}){let r=N(null);return he(()=>{let a=r.current;if(!a)return;a.scrollTop=Lh(e,`${t}:scroll`,0);let i=()=>{pc(e,`${t}:scroll`,a.scrollTop,!1)};return a.addEventListener("scroll",i,{passive:!0}),()=>a.removeEventListener("scroll",i)},[e,t]),u("div",{ref:r,"data-slot":"scroll-area-viewport",className:"min-w-0 overflow-y-auto overscroll-y-contain",style:{maxHeight:n},children:o})}var VS=pe(function({entries:t,groupId:n,threadKey:o,workspaceRoot:r,onDisclosureChange:a}){let s=wt(cn).derive,{t:l}=ut(),[d,c]=Wo(o,`group:${n}`,!1),[f,p]=Wo(o,`group-page:${n}`,0),m=Jr(),g=N(null),[h,v]=J(null),y=t.at(-1),x=K(()=>t.filter(Q=>s.workEntryIndicatesFailure(Q)),[t,s]),C=K(()=>t.filter(_h),[t]),w=t.filter(Q=>Q.toolLifecycleStatus==="inProgress").length,L=x[0]??C[0],S=L??y,k=Math.max(0,Math.ceil(t.length/Ll)-1),I=Math.min(f,k),T=I*Ll,A=t.slice(T,T+Ll),P=t.length>1;if(he(()=>{if(!h)return;let Q=g.current,Se=Array.from(Q?.querySelectorAll("[data-tool-identity]")??[]).find(q=>q.dataset.toolIdentity===h.id);if(!Se)return;let H=Se.closest('[data-slot="scroll-area-viewport"]');H&&(H.scrollTop+=Se.getBoundingClientRect().top-H.getBoundingClientRect().top),Se.querySelector("button")?.focus({preventScroll:!0})},[h]),!y||!S)return null;let _=Q=>{a?.(),p(Q)},E={threadKey:o,workspaceRoot:r,onDisclosureChange:a},F=zS(t.map(Q=>BS(s.resolveWorkEntryStatus(Q)))),B=Nh(t,s.toolGroupAction),V=F==="failed"?"failed":F==="running"?"running":"success";return u(Xf,{state:F,variant:"tool",children:b("section",{ref:g,"data-tool-group-id":n,className:"min-w-0",children:[b("div",{className:"flex min-w-0 items-center",children:[b("button",{type:"button","aria-expanded":d,"aria-controls":m,onClick:()=>{a?.(),c(!d),!P&&!d&&pc(o,`call:${Pl(y)}`,!0)},className:$(Qf,"flex-1",L?"text-destructive":"text-muted-foreground"),children:[u(hc,{status:V}),u(gc,{children:!P&&y.toolIcon!==void 0&&x.length===0?u($S,{toolIcon:y.toolIcon,glyphClassName:"size-icon-1 shrink-0 stroke-[1.8] opacity-70 text-icon-muted"}):u(vc,{name:B,className:$("size-icon-1 shrink-0 stroke-[1.8] opacity-70",x.length>0?"text-destructive":"text-icon-muted")})}),b("span",{className:$("flex min-w-0 flex-1 items-center",d&&P?"chat-process-text":"chat-tool-summary"),children:[u("span",{className:"truncate",children:d&&P?l("toolGroup.calls",{count:t.length}):US(S,r,s)??l("toolGroup.calls",{count:1})}),d&&P?null:u(HS,{entry:S,failed:s.workEntryIndicatesFailure(S)})]}),w>0?u("span",{className:"chat-process-meta shrink-0 tabular-nums",children:l("toolGroup.running",{count:w})}):null,x.length>0?u("span",{className:"chat-process-meta shrink-0 tabular-nums",children:l("toolGroup.failed",{count:x.length})}):null,C.length>0?u("span",{className:"chat-process-meta shrink-0 tabular-nums",children:l("toolGroup.cancelled",{count:C.length})}):null,d&&P?null:u(IB,{entries:t,failed:x.length>0,derive:s}),u(an,{"aria-hidden":!0,className:$("size-icon-1 shrink-0",!d&&"-rotate-90")})]}),L&&P?u("button",{type:"button",className:"chat-process-meta me-2 min-h-8 shrink-0 rounded-control-4 px-1 text-destructive underline [@media(pointer:coarse)]:min-h-11",onClick:()=>{a?.(),c(!0),p(Math.floor(t.indexOf(L)/Ll)),pc(o,`call:${Pl(L)}`,!0),v({id:Pl(L)})},children:l("toolGroup.showFailure")}):null]}),d?u("div",{id:m,className:"border-t border-border/50",children:P?b(Pe,{children:[t.length>Ll?b("div",{className:"chat-process-meta flex items-center gap-1 border-b border-border/40 px-2 py-1 text-muted-foreground",children:[u("span",{className:"min-w-0 flex-1 tabular-nums",children:l("toolGroup.pageRange",{from:T+1,to:Math.min(T+Ll,t.length),count:t.length})}),[{label:l("toolGroup.firstPage"),target:0,disabled:I===0,Icon:zd},{label:l("toolGroup.previousPage"),target:I-1,disabled:I===0,Icon:Qi},{label:l("toolGroup.nextPage"),target:I+1,disabled:I===k,Icon:Ko},{label:l("toolGroup.lastPage"),target:k,disabled:I===k,Icon:Ud}].map(({label:Q,target:Se,disabled:H,Icon:q})=>u("button",{type:"button","aria-label":Q,disabled:H,onClick:()=>_(Se),className:"flex size-7 items-center justify-center rounded-control-3 disabled:opacity-64 [@media(pointer:coarse)]:size-11",children:u(q,{"aria-hidden":!0,className:"size-icon-1"})},Q))]}):null,u(kB,{threadKey:o,stateKey:`group-scroll:${n}:${I}`,maxHeight:"min(320px, 50dvh)",children:u("div",{className:"space-y-0.5 py-1",children:A.map(Q=>u(TB,{entry:Q,...E},Pl(Q)))})})]}):u(KS,{entry:y})}):null]})})});function LB(e,t,n){let o=n-t;if(Math.abs(o)<1)return null;let r=Math.max(0,Math.min(e.scrollHeight-e.clientHeight,e.scrollTop+o));return Math.abs(r-e.scrollTop)<1?null:r}function qS(e){let{viewport:t,anchor:n,row:o,scrollToOffset:r}=e,a=n.getBoundingClientRect().top,i=!0,s=null,l=()=>{if(s=null,!i||!n.isConnected||!t.contains(n))return;let f=LB(t,a,n.getBoundingClientRect().top);f!==null&&r(f),a=n.getBoundingClientRect().top},d=()=>{i&&s===null&&(s=requestAnimationFrame(l))},c=typeof ResizeObserver>"u"?null:new ResizeObserver(d);return c?.observe(o),d(),{schedule:d,stop:()=>{i=!1,c?.disconnect(),s!==null&&cancelAnimationFrame(s),s=null}}}ue();var WS=pe(function({sectionKey:t,rowKeyPrefix:n,rowIds:o,renderRow:r,sectionRef:a}){return u("div",{className:"session-turn","data-timeline-turn-section":t,ref:a,children:o.map(i=>u("div",{className:"transcript-col min-w-0 overflow-x-clip",children:r(i)},`${n}:${i}`))})});function PB(e,t,n){for(let o=t;o<n;o+=1){let r=e[o];switch(r.kind){case"turn-identity":return r.turnId;case"working":return r.turnId??null;case"message":if(r.message.role==="assistant")return r.message.turnId;break;case"tool-group":if(r.entries[0]?.turnId!==void 0)return r.entries[0].turnId??null;break;case"work":if(r.groupedEntries[0]?.turnId!==void 0)return r.groupedEntries[0].turnId??null;break;case"turn-plan":return r.turnPlan.turnId;case"proposed-plan":return r.proposedPlan.turnId;case"turn-summary":return r.footer.turnId}}return null}function GS(e,t,n=[]){let o=new Map(n.map(a=>[a.key,a])),r=[];for(let a of t){if(a.end<=a.start)continue;let i=PB(e,a.start,a.end),s=o.get(a.key);if(s!==void 0&&s.turnId===i&&AB(s,e,a.start,a.end)){r.push(s);continue}r.push({key:a.key,turnId:i,firstRowIndex:a.start,rowIds:e.slice(a.start,a.end).map(l=>l.id)})}return r}function AB(e,t,n,o){if(e.firstRowIndex!==n||e.rowIds.length!==o-n)return!1;for(let r=0;r<e.rowIds.length;r+=1)if(e.rowIds[r]!==t[n+r].id)return!1;return!0}function jS(e,t){let n=Math.max(0,Math.min(t,e)),o=e-n;return{startIndex:o,hasHiddenOlder:o>0}}function yc(e,t,n){let o=e.findIndex(r=>r.rowIds.includes(t));return o<0?n:Math.max(n,e.length-o)}ue();ue();var XS=100,EB=new Map,QS=new Map,Yf=e=>typeof e=="function"?e():e,YS=(e,t)=>typeof t=="function"?t(e):t;function RB(e,t,n){let o=e.get(t);return o===void 0&&(o={values:new Map,limit:Math.max(1,n)},e.set(t,o)),o}function MB(e,t){let n=QS.get(e);return n===void 0&&(n={values:new Map,limit:Math.max(1,t)},QS.set(e,n)),n}function NB(e,t){if(!(e.values.size<=e.limit)){for(let[n,o]of e.values){if(e.values.size<=e.limit)return;o===t||o.committed||o.leases>0||(e.values.delete(n),o.alive=!1,o.subscribers.clear())}for(let[n,o]of e.values){if(e.values.size<=e.limit)return;o===t||o.leases>0||(e.values.delete(n),o.alive=!1,o.subscribers.clear())}}}function Dh(e,t,n){e.values.get(t)===n&&(e.values.delete(t),e.values.set(t,n))}function JS(e,t,n){let o=e.values.get(t);return o===void 0&&(o={value:Yf(n),subscribers:new Set,leases:0,alive:!0,committed:!1},e.values.set(t,o)),o}function xc(e){queueMicrotask(()=>NB(e))}function sn(e,t,n,o=XS){let r=Math.max(1,o),a=RB(EB,e,r),i=JS(a,t,n),s=R(f=>i.alive?(a.limit=r,i.committed=!0,Dh(a,t,i),i.leases+=1,i.subscribers.add(f),xc(a),()=>{i.subscribers.delete(f),i.leases=Math.max(0,i.leases-1),xc(a)}):()=>{},[r,i,a,t]),l=R(()=>i.value,[i]),d=$o(s,l,l),c=R(f=>{if(!i.alive||a.values.get(t)!==i)return;let p=i.value,m=YS(p,f);if(!Object.is(m,p)){i.value=m,Dh(a,t,i);for(let g of i.subscribers)g();xc(a)}},[i,a,t]);return[d,c]}function ZS(e,t){let n=N(null);(n.current===null||n.current.key!==e)&&(n.current={key:e,value:Yf(t)});let[,o]=Sa(a=>a+1,0),r=R(a=>{let i=n.current;if(i===null||i.key!==e)return;let s=YS(i.value,a);Object.is(s,i.value)||(i.value=s,o())},[e]);return[n.current.value,r]}function Rt(e,t,n,o=XS){let r=Math.max(1,o),a=MB(e,r),i=JS(a,t,()=>({current:Yf(n)}));return W(()=>{if(!(!i.alive||a.values.get(t)!==i))return a.limit=r,i.committed=!0,Dh(a,t,i),i.leases+=1,xc(a),()=>{i.leases=Math.max(0,i.leases-1),xc(a)}},[r,i,a,t]),i.value}function Lr(e,t){let n=N(null);return(n.current===null||n.current.key!==e)&&(n.current={key:e,ref:{current:Yf(t)}}),n.current.ref}var us=3,Oh=us;function eI(e){let[t,n]=sn("timeline-reveal-window",e,us),o=R(()=>{n(s=>s+Oh)},[n]),r=R(s=>{n(l=>s>l?s:l)},[n]),a=R(()=>{n(us)},[n]),i=R(s=>{n(l=>Math.min(l,Math.max(us,s)))},[n]);return{revealedCount:t,revealOlder:o,revealAtLeast:r,compactTo:i,reset:a}}function tI(e,t){return t.prefixMounted?"mounted":t.loading===null||t.now>e.until?"abandoned":t.loading?(e.loadingObserved=!0,e.sectionsWhileLoading=t.sections,"waiting"):e.loadingObserved?t.sections===e.sectionsWhileLoading?"waiting":"landed":"waiting"}var _B=400;function nI({root:e,minimumCount:t,keepAbovePx:n=0,canCompact:o,onCompact:r}){let a=e.ownerDocument,i=new Set,s,l=!1,d=()=>e.scrollHeight-e.clientHeight-e.scrollTop<=2,c=()=>{if(s=void 0,a.hidden||i.size>0||!o()||e.clientHeight<=0||!d()||mc(e))return;let w=e.querySelectorAll("[data-timeline-turn-section]"),L=e.getBoundingClientRect().top-32-n,S=0,k=Math.max(0,w.length-t);for(;S<k;){let T=Math.floor((S+k)/2),A=w[T].getBoundingClientRect().bottom;if(!Number.isFinite(A))return;A<=L?S=T+1:k=T}if(S===0)return;let I=a.activeElement;if(I&&Il(I)){for(let T=0;T<S;T+=1)if(w[T].contains(I))return}r(w.length-S)},f=!1,p=()=>{if(a.hidden||i.size>0||!o()||f){clearTimeout(s),s=void 0;return}s===void 0&&(s=setTimeout(c,_B))},m=()=>{clearTimeout(s),s=void 0,p()},g=()=>{let w=d();!w||!l?m():p(),l=w},h=w=>{i.add(w.pointerId),m()},v=w=>{i.delete(w.pointerId),m()},y=()=>{f=mc(e),m()},x=()=>{i.clear(),m()},C=["wheel","keydown","focusin","focusout"];for(let w of C)e.addEventListener(w,m,{passive:!0});return e.addEventListener("scroll",g,{passive:!0}),e.addEventListener("pointerdown",h,!0),a.addEventListener("pointerup",v,!0),a.addEventListener("pointercancel",v,!0),a.addEventListener("selectionchange",y),a.addEventListener("visibilitychange",p),a.defaultView?.addEventListener("blur",x),p(),{schedule:p,disconnect:()=>{clearTimeout(s);for(let w of C)e.removeEventListener(w,m);e.removeEventListener("scroll",g),e.removeEventListener("pointerdown",h,!0),a.removeEventListener("pointerup",v,!0),a.removeEventListener("pointercancel",v,!0),a.removeEventListener("selectionchange",y),a.removeEventListener("visibilitychange",p),a.defaultView?.removeEventListener("blur",x)}}}ue();function oI({root:e,topInsetPx:t,onActiveSectionChange:n,active:o}){let r=N(o);r.current=o;let a=fi(o),i=N(new Map),s=N(null),l=N(null),d=N(n);d.current=n;let c=R(()=>{if(!r.current||!e)return;let h=e.scrollTop+t,v=null,y=Number.NEGATIVE_INFINITY,x=null,C=Number.POSITIVE_INFINITY;for(let[L,S]of i.current){if(!S.isConnected)continue;let k=S.offsetTop;k<C&&(C=k,x=L),k<=h&&k>=y&&(y=k,v=L)}let w=v??x;w!==l.current&&(l.current=w,d.current(w))},[e,t]),f=R(()=>{r.current&&a.request(c)},[a,c]);W(()=>{if(!o||!e||typeof IntersectionObserver>"u")return;let h=!0,v=new IntersectionObserver(()=>{!h||!r.current||f()},{root:e,rootMargin:`-${t}px 0px 0px 0px`,threshold:0});s.current=v;for(let y of i.current.values())v.observe(y);return f(),()=>{h=!1,v.disconnect(),s.current=null,a.cancel()}},[o,a,f,e,t]);let p=N(new Map),m=R(h=>{let v=p.current.get(h);if(v)return v;let y=x=>{let C=i.current.get(h);C&&C!==x&&(s.current?.unobserve(C),i.current.delete(h)),x?(i.current.set(h,x),s.current?.observe(x)):p.current.get(h)===y&&p.current.delete(h)};return p.current.set(h,y),y},[]),g=R(()=>{r.current&&(l.current=null,f())},[f]);return K(()=>({observeSection:m,refresh:g}),[m,g])}function Cc(e,t,n="duration"){let o=`<${n}></${n}>`,r=`<${n}/>`,a=s=>{let l=e.indexOf(s);return l<0?null:[e.slice(0,l),e.slice(l+s.length)]},i=a(o)??a(r);return i===null?b(Pe,{children:[e,t]}):b(Pe,{children:[i[0],t,i[1]]})}ue();function rI(e){return $o(e.subscribe,e.getStructure,e.getStructure)}function aI(e,t){let n=R(r=>e.subscribeRow(t,r),[e,t]),o=R(()=>e.getRow(t),[e,t]);return $o(n,o,o)}function mi(e,t,n=Object.is){let o=N(null),r=R(()=>{let a=e.getVersion(),i=o.current;if(i!==null&&i.store===e&&i.select===t&&i.version===a)return i.value;let s=t(e),l=i!==null&&i.store===e&&n(i.value,s)?i.value:s;return o.current={store:e,select:t,version:a,value:l},l},[e,t,n]);return $o(e.subscribe,r,r)}ue();function Fh(e,t){let n=e.flatMap(r=>r.previewUrl?[{id:r.id,src:r.previewUrl,name:r.name}]:[]);if(n.length===0)return null;let o=n.findIndex(r=>r.id===t);return o<0?null:{images:n.map(r=>({src:r.src,name:r.name})),index:o}}function gi(e){if(e.type==="image")return"image";let t=e.mimeType.toLowerCase();return t==="application/pdf"?"pdf":t.startsWith("text/")||DB.has(t)?"text":"file"}var DB=new Set(["application/json","application/xml","application/x-yaml","application/yaml"]);function iI(e){return!Number.isFinite(e)||e<=0?"0 KB":e>=1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${Math.max(1,Math.round(e/1024))} KB`}var OB="<ycodium-system>";function Jf(e){return e.startsWith(OB)}var FB=/[ \t]*\(record [^\s()]+\)/g,BB=/^<\/?[a-z][a-z-]*(?:\s[^>]*)?>$/;function Bh(e){return Jf(e)?e.split(`
|
|
3741
|
+
`).filter(t=>!BB.test(t.trim())).join(`
|
|
3742
|
+
`).replace(FB,""):e}var zB=/<ycodium-system>[\s\S]*?<\/ycodium-system>/g;function sI(e){let t=e.match(zB);return t&&t.length>0?t:[e]}function lI(e){let t=e.match(/<plugin-instruction>\n([\s\S]*?)\n<\/plugin-instruction>/)?.[1];if(t===void 0)return null;try{let n=JSON.parse(t);if(n===null||typeof n!="object"||Array.isArray(n))return null;let o=n;return typeof o.pluginId!="string"||typeof o.title!="string"||typeof o.body!="string"?null:{pluginId:o.pluginId,title:o.title,body:o.body}}catch{return null}}function dI(e){switch(e){case"image":return Zi;case"pdf":return Ji;case"text":return Yi;case"file":return vo}}var UB=[".m4v",".mov",".mp4",".ogv",".webm"],HB=[".aac",".flac",".m4a",".mp3",".oga",".ogg",".opus",".wav",".weba"];function cI(e){let t=e.name.lastIndexOf(".");if(t<=0)return null;let n=e.name.slice(t).toLowerCase();return UB.includes(n)?"video":HB.includes(n)?"audio":null}var $B=/\n*<element_context>\n([\s\S]*?)\n<\/element_context>\s*$/;function bc(e){let t=$B.exec(e);if(!t)return{promptText:e,contextCount:0,contexts:[]};let n=e.slice(0,t.index).replace(/\n+$/,""),o=KB(t[1]??"");return{promptText:n,contextCount:o.length,contexts:o}}function KB(e){let t=[],n=null,o=()=>{n&&(t.push({header:n.header,body:n.bodyLines.join(`
|
|
3743
3743
|
`).trimEnd()}),n=null)};for(let r of e.split(`
|
|
3744
|
-
`)){let a=/^- (.+):$/.exec(r);if(a){o(),n={header:a[1],bodyLines:[]};continue}n&&(r.startsWith(" ")?n.bodyLines.push(r.slice(2)):r.length===0&&n.bodyLines.push(""))}return o(),t}var
|
|
3745
|
-
`),r=o.find(p=>p.startsWith("Page: ")),a=o.find(p=>p.startsWith("Id: ")),i=o.find(p=>p.startsWith("Comment: ")),s=o.find(p=>p.startsWith("Targets: ")),l=o.indexOf("Requested visual changes:"),d=o.slice(l+1),c=d.indexOf("<element_context>"),f=l<0?[]:d.slice(0,c<0?void 0:c).filter(p=>p.startsWith("- ")).map(p=>p.slice(2));return{promptText:e.slice(0,t.index).replace(/\n+$/,""),annotation:{id:a?.slice(4).trim()||`${t.index}`,title:r?.slice(6).trim()||"Preview annotation",comment:i?.slice(9).trim()||"",targetSummary:s?.slice(9).trim()||"",styleChanges:f,hasScreenshot:n.includes("The attached screenshot is the annotated preview crop.")}}}var
|
|
3744
|
+
`)){let a=/^- (.+):$/.exec(r);if(a){o(),n={header:a[1],bodyLines:[]};continue}n&&(r.startsWith(" ")?n.bodyLines.push(r.slice(2)):r.length===0&&n.bodyLines.push(""))}return o(),t}var VB=/\n*<preview_annotation>\n((?:(?!<preview_annotation>)[\s\S])*)\n<\/preview_annotation>\s*$/;function zh(e){let t=VB.exec(e);if(!t)return{promptText:e,annotation:null};let n=t[1]??"",o=n.split(`
|
|
3745
|
+
`),r=o.find(p=>p.startsWith("Page: ")),a=o.find(p=>p.startsWith("Id: ")),i=o.find(p=>p.startsWith("Comment: ")),s=o.find(p=>p.startsWith("Targets: ")),l=o.indexOf("Requested visual changes:"),d=o.slice(l+1),c=d.indexOf("<element_context>"),f=l<0?[]:d.slice(0,c<0?void 0:c).filter(p=>p.startsWith("- ")).map(p=>p.slice(2));return{promptText:e.slice(0,t.index).replace(/\n+$/,""),annotation:{id:a?.slice(4).trim()||`${t.index}`,title:r?.slice(6).trim()||"Preview annotation",comment:i?.slice(9).trim()||"",targetSummary:s?.slice(9).trim()||"",styleChanges:f,hasScreenshot:n.includes("The attached screenshot is the annotated preview crop.")}}}var qB=/<review_comment\b([^>]*)>\s*([\s\S]*?)<\/review_comment>/g,WB=/([a-zA-Z][a-zA-Z0-9_-]*)="([^"]*)"/g,GB=/(`{3,})([^\s`]*)[^\n]*\n([\s\S]*?)\n\1/g;function jB(e){return e.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/&/g,"&")}function QB(e){let t={};for(let n of e.matchAll(WB))t[n[1]]=jB(n[2]??"");return t}function uI(e){return e===void 0||!/^\d+$/.test(e)?null:Number(e)}function XB(e){let n=Array.from(e.matchAll(GB)).at(-1),o=n?.index;return{text:e.slice(0,o??e.length).trim(),language:n?.[2]?.trim()||"diff",contents:n?.[3]??""}}function YB(e,t,n){let o=QB(e),r=uI(o.startIndex),a=uI(o.endIndex),i=o.filePath?.trim(),s=o.sectionId?.trim();if(!i||!s||r===null||a===null)return null;let l=XB(t);return{id:`review-comment:${n}:${s}:${i}:${r}:${a}`,sectionId:s,sectionTitle:o.sectionTitle?.trim()||null,filePath:i,startIndex:Math.min(r,a),endIndex:Math.max(r,a),rangeLabel:o.rangeLabel?.trim()||null,text:l.text,diff:l.contents,fenceLanguage:l.language}}function Uh(e){let t=[],n=0,o=0;for(let a of e.matchAll(qB)){let i=a.index??0,s=e.slice(n,i);s.length>0&&t.push({kind:"text",id:`review-comment-text:${n}`,text:s});let l=YB(a[1]??"",a[2]??"",o);l?(t.push({kind:"review-comment",comment:l}),o+=1):t.push({kind:"text",id:`review-comment-invalid:${i}`,text:a[0]}),n=i+a[0].length}let r=e.slice(n);return r.length>0&&t.push({kind:"text",id:`review-comment-text:${n}`,text:r}),t}function fI(e,t){let n=Math.max(0,...Array.from(t.matchAll(/`+/g),r=>r[0].length)),o="`".repeat(Math.max(3,n+1));return[`${o}${e}`,t.trimEnd(),o].join(`
|
|
3746
3746
|
`)}function pI(e){if((e.fenceLanguage??"diff")!=="diff")return"";let t=e.diff.trim();if(t.length===0)return"";if(t.startsWith("diff --git "))return t;let n=e.filePath.replaceAll("\\","/");return[`diff --git a/${n} b/${n}`,`--- a/${n}`,`+++ b/${n}`,t].join(`
|
|
3747
|
-
`)}var
|
|
3747
|
+
`)}var JB="inline-flex h-[1.41em] max-w-full items-center gap-[0.33em] rounded-[0.5em] px-[0.5em] font-medium leading-none align-middle",ZB=`${JB} border border-border/70 bg-accent/40 text-foreground`,Zf=`${ZB} text-[12px]`,ep="block size-[1.17em] shrink-0 self-center opacity-85 [&>svg]:block",tp="truncate leading-tight",mI='<svg width="100%" height="100%" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.85" stroke-linecap="round" stroke-linejoin="round"><path d="M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z"/><path d="m3.3 7 8.7 5 8.7-5"/><path d="M12 22V12"/></svg>';var ez=/(^|\s)\$([a-zA-Z][a-zA-Z0-9:_-]*)(?=\s|$)/g;function tz(e){return e.split(/[\s_-]+/).filter(t=>t.length>0).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}function nz(e){let t=e.displayName?.trim();return t||tz(e.name)}function gI(e){let t=[],n=0;for(let o of e.text.matchAll(ez)){let r=o[1]??"",a=o[2]??"",i=(o.index??0)+r.length,s=`$${a}`,l=e.skills.find(d=>d.name===a);l&&(i>n&&t.push(e.text.slice(n,i)),t.push(u(oz,{skill:l,rawText:s},`${i}:${a}`)),n=i+s.length)}return n===0?u(Pe,{children:e.text}):(n<e.text.length&&t.push(e.text.slice(n)),u(Pe,{children:t}))}function oz(e){return u("span",{className:"inline-flex align-middle leading-none","data-markdown-copy":e.rawText,children:b("span",{className:$(Zf,"border-fuchsia-500/25 bg-fuchsia-500/12 text-fuchsia-700 dark:text-fuchsia-300"),children:[u("span",{"aria-hidden":"true",className:ep,dangerouslySetInnerHTML:{__html:mI}}),u("span",{className:tp,children:nz(e.skill)})]})})}function hI(e){let{label:t,tooltipText:n,expired:o=!1}=e;return b(Ye,{children:[b(Ze,{render:u("span",{className:$(Zf,o&&"border-destructive/35 bg-destructive/8 text-destructive"),"data-terminal-context-expired":o?"true":void 0}),children:[u(Vo,{className:$(ep,"size-icon-1",o&&"opacity-100")}),u("span",{className:tp,children:t})]}),u(Je,{side:"top",className:"max-w-80 whitespace-pre-wrap leading-tight",children:n})]})}var rz=/\n*<terminal_context>\n([\s\S]*?)\n<\/terminal_context>\s*$/;function az(e){let t=[],n=null,o=()=>{n&&(t.push({header:n.header,body:n.bodyLines.join(`
|
|
3748
3748
|
`).trimEnd()}),n=null)};for(let r of e.split(`
|
|
3749
|
-
`)){let a=/^- (.+):$/.exec(r);if(a){o(),n={header:a[1],bodyLines:[]};continue}if(n){if(r.startsWith(" ")){n.bodyLines.push(r.slice(2));continue}r.length===0&&n.bodyLines.push("")}}return o(),t}function
|
|
3749
|
+
`)){let a=/^- (.+):$/.exec(r);if(a){o(),n={header:a[1],bodyLines:[]};continue}if(n){if(r.startsWith(" ")){n.bodyLines.push(r.slice(2));continue}r.length===0&&n.bodyLines.push("")}}return o(),t}function iz(e){let t=rz.exec(e);if(!t)return{promptText:e,contextCount:0,previewTitle:null,contexts:[]};let n=e.slice(0,t.index).replace(/\n+$/,""),o=az(t[1]??"");return{promptText:n,contextCount:o.length,previewTitle:o.length>0?o.map(({header:r,body:a})=>a.length>0?`${r}
|
|
3750
3750
|
${a}`:r).join(`
|
|
3751
3751
|
|
|
3752
|
-
`):null,contexts:o}}function vI(e){let t=e.terminalLabel.trim().toLowerCase().replace(/\s+/g,"-"),n=e.lineStart===e.lineEnd?`${e.lineStart}`:`${e.lineStart}-${e.lineEnd}`;return`@${t}:${n}`}function $h(e){let t=wc(e),n=oz(t.promptText);return{visibleText:n.promptText,copyText:e,contextCount:n.contextCount,previewTitle:n.previewTitle,contexts:n.contexts,elementContexts:t.contexts}}var rz=/^(.*?)\s+line(?:s)?\s+(\d+)(?:-(\d+))?$/i;function yI(e){let t=[];for(let n of e){let o=n.header.trim();o.length>0&&t.push(op(o))}return t.join(" ")}function op(e){let t=e.trim(),n=rz.exec(t);if(!n)return`@${t.toLowerCase().replace(/\s+/g,"-")}`;let o=Number.parseInt(n[2]??"",10),r=Number.parseInt(n[3]??n[2]??"",10);return!Number.isFinite(o)||!Number.isFinite(r)?`@${t.toLowerCase().replace(/\s+/g,"-")}`:vI({terminalLabel:n[1]?.trim()||"terminal",lineStart:o,lineEnd:r})}function xI(e,t){let n=0;for(let o of t){let r=op(o.header),a=e.indexOf(r,n);if(a===-1)return!1;n=a+r.length}return!0}function Kh({row:e}){let t=bt(fn).derive;if(Zf(e.message.text)){let n=t.parsePresetPrefixText(e.message.text);return n?b(Le,{children:[u(sz,{parsed:n}),n.body.length>0||(e.message.attachments?.length??0)>0?u(Kh,{row:{...e,message:{...e.message,text:n.body}}}):null]}):u(dz,{row:e})}return u(az,{row:e,text:e.message.text})}function Vh({images:e}){let t=bt(fn),{t:n}=ut();return e.length===0?null:u("div",{className:"mb-2 grid max-w-[420px] grid-cols-2 gap-2",children:e.map(o=>u("div",{className:"overflow-hidden rounded-lg border border-border/80 bg-background/70",children:o.previewUrl?u("button",{type:"button",className:"h-full w-full cursor-zoom-in","aria-label":n("attachments.preview",{name:o.name}),onClick:()=>{let r=Bh(e,o.id);r&&t.onImageExpand(r)},children:u("img",{src:o.previewUrl,alt:o.name,className:"block h-auto max-h-[220px] w-full object-cover"})}):u("div",{className:"flex min-h-[72px] items-center justify-center px-2 py-3 text-center text-secondary-label text-chat-dense",children:o.name})},o.id))})}function az({row:e,text:t}){let{t:n}=ut(),o=bt(fn),r=e.message.attachments??[],a=$h(t),i=a.contexts,s=[],l=a.visibleText;for(;;){let v=Uh(l);if(!v.annotation)break;s.unshift(v.annotation),l=v.promptText}let d=wc(l),c=[...a.elementContexts,...d.contexts],f=r.filter(v=>v.name.startsWith("preview-annotation-")),p=r.filter(v=>!v.name.startsWith("preview-annotation-")),m=p.filter(v=>hi(v)==="image"),g=p.filter(v=>hi(v)!=="image"),h=e.message.author??null;return b("div",{className:"group flex min-w-0 items-start gap-2.5",children:[u(iz,{author:h}),b("div",{className:"min-w-0 flex-1 space-y-2",children:[b("div",{className:"flex min-h-7 min-w-0 flex-wrap items-center gap-x-2 gap-y-1 text-chat-dense",children:[u("span",{className:"min-w-0 truncate font-medium text-foreground",children:h?.displayName??n("message.user")}),b(Ye,{children:[u(Ze,{render:u("span",{className:"text-muted-foreground tabular-nums"}),children:mi(e.message.createdAt,o.timestampFormat,n)}),u(Je,{children:ra(e.message.createdAt,o.timestampFormat)})]}),b("div",{className:"ms-auto flex items-center gap-0.5",children:[o.onForkFromUserMessage!==null&&u(cz,{messageId:e.message.id,onFork:o.onForkFromUserMessage}),a.copyText&&u(Ll,{text:a.copyText,variant:"ghost"})]})]}),b("div",{className:"relative min-w-0 rounded-lg border border-border/60 bg-message px-3 py-2.5 text-message-foreground",children:[u(Vh,{images:m}),g.length>0&&u("div",{className:"mb-2 flex max-w-[420px] flex-col gap-1.5",children:g.map(v=>u(qh,{attachment:v},v.id))}),s.map((v,y)=>u(pz,{annotation:v,image:f[y]??null},v.id)),c.length>0?u("div",{className:"mb-2 flex flex-wrap gap-1.5",children:c.map(v=>u(fz,{context:v},`${v.header}:${v.body}`))}):null,u(yz,{disclosureKey:`message:${e.message.id}:user`,text:d.promptText,terminalContexts:i,skills:o.skills,markdownCwd:o.markdownCwd})]})]})]})}function iz({author:e}){let t=e;return t!==null?u(qw,{userId:t.userId,displayName:t.displayName,size:28,className:"mt-0.5"}):u("span",{"aria-hidden":!0,className:"mt-0.5 flex size-7 shrink-0 items-center justify-center rounded-full bg-message text-secondary-label",children:u(oa,{className:"size-4"})})}function rp({children:e}){return u("div",{className:"flex justify-center py-1",children:u("div",{className:"max-w-[80%] rounded-lg border border-border/60 bg-muted/30 px-3 py-2 text-chat-row text-muted-foreground",children:e})})}function sz({parsed:e}){let{t}=ut();return b(rp,{children:[u("p",{className:"font-medium text-foreground/80",children:t("preset.systemBlockTitle",{name:e.presetId})}),e.prefix.trim().length>0?u("p",{className:"mt-1 whitespace-pre-wrap",children:e.prefix}):null]})}var lz={"child.settled":"childThread.notification.settled","child.failed":"childThread.notification.failed","child.approval":"childThread.notification.approval","child.stopped":"childThread.notification.stopped","plugin.notice":"childThread.notification.pluginNotice","selfdev.resolved":"childThread.notification.selfdevResolved"};function dz({row:e}){let{t}=ut(),n=bt(fn).derive,o=e.message.attachments??[],r=o.filter(l=>hi(l)==="image"),a=o.filter(l=>hi(l)!=="image"),i=l=>{let d=lI(l);if(d)return b(rp,{children:[u("p",{className:"font-medium text-foreground/80",children:d.title}),d.body.length>0?u("p",{className:"mt-1 whitespace-pre-wrap",children:d.body}):null]});let c=n.parseThreadHandoverText(l);if(c)return b(rp,{children:[u("p",{className:"font-medium text-foreground/80",children:t("continuation.systemBlockTitle")}),u("p",{className:"mt-1",children:t("continuation.systemBlockTurns",{count:c.includedTurns})}),u("p",{className:"mt-1 whitespace-pre-wrap",children:c.body})]});let f=n.parseSystemNotificationText(l);return f?b(rp,{children:[u("p",{className:"font-medium text-foreground/80",children:t(lz[f.kind],{title:f.title})}),f.summary.trim().length>0?u("p",{className:"mt-1 whitespace-pre-wrap",children:f.summary}):null]}):null},s=sI(e.message.text).map(i).filter(l=>l!==null);return s.length===0&&o.length===0?null:b(Le,{children:[s.map((l,d)=>u(oi,{children:l},d)),o.length>0?b("div",{className:"min-w-0 px-3 py-2",children:[u(Vh,{images:r}),a.map(l=>u(qh,{attachment:l},l.id))]}):null]})}function wI(e,t){let n=t.parsePresetPrefixText(e??"")?.body??null;if(n===null&&Zf(e??""))return null;let r=$h(n??e??"").visibleText;for(;;){let s=Uh(r);if(!s.annotation)break;r=s.promptText}let a=wc(r).promptText,i=Hh(a).map(s=>s.kind==="text"?s.text:s.comment.text).join(" ").replace(/\s+/g," ").trim();return i.length>0?i:null}var SI=34,II=8,ap=SI+II,TI=pe(function({ref:t,textRef:n,initialText:o,expanded:r,onToggleExpanded:a}){let{t:i}=ut(),s=i(r?"timeline.pinnedTurnHeaderShowLess":"timeline.pinnedTurnHeaderShowMore");return u("div",{ref:t,className:"group pointer-events-none absolute inset-x-0 top-0 z-10 px-3 sm:px-5",style:{paddingTop:II},"data-timeline-turn-header":"true","data-truncated":"false",children:b("div",{className:$("transcript-col-wide pointer-events-auto flex gap-2 rounded-sm border border-border/70 bg-background pe-1 ps-3 shadow-md shadow-black/10",r?"items-start py-1.5":"items-center"),...r?{}:{style:{height:SI}},children:[u("span",{ref:n,className:$("min-w-0 flex-1 text-foreground/85 text-chat",r?"max-h-40 overflow-y-auto whitespace-pre-wrap":"truncate"),children:o}),b(Ye,{children:[u(Ze,{render:u(ce,{type:"button",size:"xs",variant:"ghost",className:"group-data-[truncated=false]:hidden","aria-label":s,onClick:a}),children:r?u(zd,{}):u(sn,{})}),u(Je,{side:"bottom",children:s})]})]})})});function cz({messageId:e,onFork:t}){let{t:n}=ut(),o=n("fork.action");return b(Ye,{children:[u(Ze,{render:u(ce,{type:"button",size:"xs",variant:"ghost",onClick:()=>t(e),"aria-label":o}),children:u(qd,{className:"size-3"})}),u(Je,{side:"top",children:o})]})}function kI({row:e}){let t=bt(fn),{t:n}=ut(),[o,r]=Go(t.threadKey,`message:${e.message.id}`,!1);if(e.presentation==="compact"&&!o)return u(Yf,{state:"idle",children:b("button",{type:"button",className:$(Xf,"chat-process-text cursor-pointer text-secondary-label hover:bg-accent/20"),"aria-expanded":!1,"aria-label":n("timeline.expandMessage"),onClick:()=>{t.onProcessDisclosureChange?.(e.id),r(!0)},children:[u(vc,{status:null}),u(hc,{children:u(ac,{className:"size-icon-1","aria-hidden":!0})}),u("span",{className:"min-w-0 flex-1 truncate",children:t.derive.reasoningPreviewText(e.message.text)}),u(sn,{className:"size-icon-1 shrink-0 -rotate-90","aria-hidden":!0})]})});let i=e.message.attachments??[],s=i.filter(c=>hi(c)==="image"),l=i.filter(c=>hi(c)!=="image"),d=e.message.text||(e.message.streaming||i.length>0?"":n("timeline.emptyResponse"));return u(Le,{children:b("div",{className:"relative min-w-0 px-1 py-0.5","data-assistant-text-tone":e.textTone==="process"&&e.presentation!=="compact"?"process":"primary",children:[e.presentation==="compact"?b("div",{className:"mb-1 flex items-center gap-2",children:[u("button",{type:"button",className:"chat-process-meta mb-1 rounded-sm text-secondary-label","aria-expanded":!0,onClick:()=>{t.onProcessDisclosureChange?.(e.id),r(!1)},children:n("timeline.collapseMessage")}),e.copyInFooter?null:u(Ll,{text:e.message.text,variant:"ghost"})]}):null,e.modelBadge?u(Wh,{badge:e.modelBadge,createdAt:e.message.createdAt}):null,u(cr,{disclosureKey:`message:${e.message.id}:assistant`,text:d,className:e.textTone==="process"&&e.presentation!=="compact"?"chat-commentary":"chat-readable-body",cwd:t.markdownCwd,threadRef:t.threadRef??void 0,isStreaming:!!e.message.streaming,lineBreaks:t.derive.shouldPreserveAssistantLineBreaks(d),skills:t.skills}),u(Vh,{images:s}),l.length>0&&u("div",{className:"mb-2 flex max-w-[420px] flex-col gap-1.5",children:l.map(c=>u(qh,{attachment:c},c.id))}),e.showAssistantMeta||e.showAssistantCopyButton&&!e.assistantCopyStreaming&&e.message.text.trim().length>0?b("div",{className:"mt-1.5 flex items-center gap-2 text-chat-row tabular-nums opacity-0 transition-opacity duration-(--control-duration) focus-within:opacity-100 group-hover/assistant:opacity-100",children:[u(uz,{row:e}),e.showAssistantMeta&&!e.message.streaming&&e.modelBadge===null&&b(Ye,{children:[u(Ze,{render:u("p",{className:"text-muted-foreground text-chat-row tabular-nums"}),children:mi(e.message.updatedAt,t.timestampFormat,n)}),u(Je,{children:ra(e.message.updatedAt,t.timestampFormat)})]})]}):null]})})}function uz({row:e}){let n=bt(fn).derive.resolveAssistantMessageCopyState({text:e.message.text??null,showCopyButton:e.showAssistantCopyButton,streaming:e.assistantCopyStreaming});return n.visible?u(Ll,{text:n.text??"",variant:"ghost"}):null}var CI=pe(function(t){let n=t.context.body.length>0?`${t.context.header}
|
|
3753
|
-
${t.context.body}`:t.context.header;return u(hI,{label:t.context.header,tooltipText:n})}),
|
|
3754
|
-
${t.context.body}`:t.context.header;return b(Ye,{children:[b(Ze,{render:u("span",{className:"inline-flex max-w-full items-center gap-1 rounded-md border border-border/70 bg-background/70 px-1.5 py-0.5 text-foreground/85 text-chat-row"}),children:[u(ta,{className:"size-3 shrink-0"}),u("span",{className:"truncate",children:t.context.header})]}),u(Je,{side:"top",className:"max-w-96 whitespace-pre-wrap leading-tight",children:n})]})});function
|
|
3755
|
-
`).length>mz}var yz=pe(function(t){let n=bt(fn),{t:o}=ut(),[r,a]=Go(n.threadKey,`${t.disclosureKey}:expanded`,!1),i=t.text.trim().length>0||t.terminalContexts.length>0,s=i&&vz(t.text),l=s&&!r;return b("div",{children:[i?u("div",{className:$("relative",l&&"max-h-44 overflow-hidden"),"data-user-message-body":"true","data-user-message-collapsed":l?"true":"false","data-user-message-collapsible":s?"true":"false","data-user-message-fade":l?"true":"false",style:l?{WebkitMaskImage:bI,maskImage:bI}:void 0,children:u(xz,{disclosureKey:t.disclosureKey,text:t.text,terminalContexts:t.terminalContexts,skills:t.skills,markdownCwd:t.markdownCwd})}):null,s||t.footer?b("div",{className:$("mt-1.5 flex items-center gap-2",s&&t.footer?"justify-between":"justify-end"),"data-user-message-footer":"true",children:[s?u(ce,{type:"button",size:"xs",variant:"ghost","aria-expanded":r,"data-scroll-anchor-ignore":!0,onClick:()=>a(!r),className:"-ml-1 h-6 rounded-control-2 px-1.5 text-secondary-label text-chat-row hover:bg-muted/40 hover:text-message-foreground",children:o(r?"timeline.showLess":"timeline.expandMessage")}):null,t.footer?u("div",{className:"ml-auto flex items-center gap-2",children:t.footer}):null]}):null]})}),xz=pe(function(t){let n=bt(fn),o=(a,i)=>{let s=/^\s+/.exec(a)?.[0]??"",l=a.slice(s.length),d=/\s+$/.exec(l)?.[0]??"",c=l.slice(0,l.length-d.length);return b(oi,{children:[s?u("span",{"aria-hidden":"true",children:s}):null,c?u(cr,{disclosureKey:`${t.disclosureKey}:inline:${i}`,text:c,cwd:t.markdownCwd,threadRef:n.threadRef??void 0,skills:t.skills,className:"text-message-foreground",lineBreaks:!0,parseRawHtml:!1}):null,d?u("span",{"aria-hidden":"true",children:d}):null]},i)},r=Hh(t.text);if(r.some(a=>a.kind==="review-comment"))return u("div",{className:"space-y-3 text-message-foreground text-chat",children:r.map(a=>a.kind==="text"?a.text.trim().length>0?u("div",{className:"wrap-break-word",children:u(cr,{disclosureKey:`${t.disclosureKey}:review:${a.id}`,text:a.text.trim(),cwd:t.markdownCwd,threadRef:n.threadRef??void 0,skills:t.skills,className:"text-message-foreground",lineBreaks:!0,parseRawHtml:!1})},a.id):null:u(Cz,{comment:a.comment,disclosureKey:`${t.disclosureKey}:review-comment:${a.comment.id}`},a.comment.id))});if(t.terminalContexts.length>0){let a=xI(t.text,t.terminalContexts),i=yI(t.terminalContexts),s=[];if(a){let l=0;for(let d of t.terminalContexts){let c=op(d.header),f=t.text.indexOf(c,l);if(f===-1){s.length=0;break}f>l&&s.push(o(t.text.slice(l,f),`user-terminal-context-inline-before:${d.header}:${l}`)),s.push(u(CI,{context:d},`user-terminal-context-inline:${d.header}`)),l=f+c.length}if(s.length>0)return l<t.text.length&&s.push(o(t.text.slice(l),`user-message-terminal-context-inline-rest:${l}`)),u("div",{className:"whitespace-pre-wrap wrap-break-word text-message-foreground text-chat",children:s})}for(let l of t.terminalContexts)s.push(u(CI,{context:l},`user-terminal-context-inline:${l.header}`)),s.push(u("span",{"aria-hidden":"true",children:" "},`user-terminal-context-inline-space:${l.header}`));if(t.text.length>0)s.push(u(cr,{disclosureKey:`${t.disclosureKey}:terminal-main`,text:t.text,cwd:t.markdownCwd,threadRef:n.threadRef??void 0,skills:t.skills,className:"text-message-foreground",lineBreaks:!0,parseRawHtml:!1},"user-message-terminal-context-inline-text"));else if(i.length===0)return null;return u("div",{className:"whitespace-pre-wrap wrap-break-word text-message-foreground text-chat",children:s})}return t.text.length===0?null:u(cr,{disclosureKey:`${t.disclosureKey}:body`,text:t.text,cwd:t.markdownCwd,threadRef:n.threadRef??void 0,skills:t.skills,className:"text-message-foreground",lineBreaks:!0,parseRawHtml:!1})});function Cz({comment:e,disclosureKey:t}){let n=bt(fn),{t:o}=ut(),r=e.fenceLanguage??"diff",a=pI(e);return b("div",{className:"space-y-2 rounded-lg border border-border/70 bg-background/70 p-3",children:[b("div",{className:"space-y-1",children:[u("div",{className:"text-message-foreground text-chat-row font-medium",children:Qf(e.filePath,n.workspaceRoot)}),b("div",{className:"text-secondary-label text-chat-dense",children:[e.sectionTitle??o("timeline.reviewCommentDefaultSection")," \xB7"," ",e.rangeLabel??o("timeline.reviewCommentDefaultRange")]})]}),e.text.length>0&&u("div",{className:"whitespace-pre-wrap wrap-break-word text-chat",children:u(gI,{text:e.text,skills:n.skills})}),r!=="diff"&&e.diff.trim().length>0&&u(cr,{disclosureKey:`${t}:fence`,text:fI(r,e.diff),cwd:n.markdownCwd,threadRef:n.threadRef??void 0,skills:n.skills,className:"text-message-foreground"}),a?u(hS,{patch:a}):null]})}function bz({badge:e}){return b(Le,{children:[e.driverKind?u("span",{className:"flex size-7 shrink-0 items-center justify-center rounded-lg border border-border/60 bg-card","aria-label":e.providerDisplayName??void 0,children:u(kr,{driver:e.driverKind,displayName:e.providerDisplayName,accentColor:e.accentColor,className:"size-5",iconClassName:"size-4"})}):null,b("span",{className:"flex min-w-0 flex-wrap items-baseline gap-x-2 gap-y-0.5",children:[e.driverKind?u("span",{className:"font-medium text-foreground",children:e.providerDisplayName}):null,u("span",{className:"min-w-0 truncate text-muted-foreground",children:e.modelLabel}),e.effortLabel?b("span",{children:[" \xB7 ",e.effortLabel]}):null]})]})}function Wh({badge:e,createdAt:t}){let n=bt(fn),{t:o}=ut();return b("div",{className:"mb-3 flex min-w-0 flex-wrap items-center gap-x-2.5 gap-y-1 text-chat-dense text-muted-foreground","data-testid":"assistant-model-header",children:[u(bz,{badge:e}),u("span",{"aria-hidden":!0,children:"\xB7"}),b(Ye,{children:[u(Ze,{render:u("span",{className:"shrink-0 tabular-nums"}),children:mi(t,n.timestampFormat,o)}),u(Je,{children:ra(t,n.timestampFormat)})]})]})}function LI({row:e}){let{t}=ut(),n=e.badge.effortLabel?`${e.badge.modelLabel} \xB7 ${e.badge.effortLabel}`:e.badge.modelLabel,o=[e.badge.providerDisplayName,n].filter(a=>typeof a=="string"&&a.length>0).join(" \xB7 "),r=e.pending?t("timeline.modelSwitchPending",{model:o}):t("timeline.modelSwitched",{model:o});return b("div",{role:"separator","aria-label":r,"data-pending":e.pending?"true":void 0,className:"flex items-center gap-2 px-1 py-1 text-chat-dense text-muted-foreground/70",children:[u("span",{"aria-hidden":!0,className:"h-px min-w-4 flex-1 bg-border/60"}),b("span",{className:"flex min-w-0 shrink items-center gap-1.5",children:[e.badge.driverKind?u(kr,{driver:e.badge.driverKind,displayName:e.badge.providerDisplayName,accentColor:e.badge.accentColor,className:"size-icon-1",iconClassName:"size-icon-1"}):null,u("span",{className:"truncate",children:r})]}),u("span",{"aria-hidden":!0,className:"h-px min-w-4 flex-1 bg-border/60"})]})}var Gh=240,wz=/\s/u;function PI(e){if(!e)return null;let t=[],n=0,o=!1,r=()=>{for(;n>Gh-1;)n-=t.pop()?.length??0;for(;t.at(-1)===" ";)t.pop(),n-=1;return t.push("\u2026"),t.join("")};for(let a of e){if(wz.test(a)){o=t.length>0;continue}if(o&&(t.push(" "),n+=1,o=!1,n>Gh)||(t.push(a),n+=a.length,n>Gh))return r()}return t.length>0?t.join(""):null}function Sz(e,t,n){let o=t.find(i=>i.kind==="message"&&i.message.role==="user"),r=o?.kind==="message"?o.message:null,a=null;for(let i of t)i.kind==="message"&&i.message.role==="assistant"&&(a=i.message.text??null);return{id:e,sectionKey:e,anchorRowId:o?.id??t[0]?.id??e,userText:r===null?null:PI(n.parseSystemNotificationText(r.text)?.summary??n.parseThreadHandoverText(r.text)?.body??r.text),assistantText:PI(a),headerText:r===null?null:wI(r.text,n)}}function Iz(e){for(let t of e){let n=t.kind==="message"?t.message.turnId??null:t.kind==="turn-summary"?t.footer.turnId:null;if(n!==null)return n}return null}function Tz(e,t){return e.sectionKey===t.sectionKey&&e.anchorRowId===t.anchorRowId&&e.userText===t.userText&&e.assistantText===t.assistantText&&e.headerText===t.headerText&&e.turnId===t.turnId}function kz(e,t,n){for(let o=0;o<e.length;o+=1)if(e[o]!==n[t.firstRowIndex+o])return!1;return!0}function Lz(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]!==t[n])return!1;return!0}function Pz(e){let t=new Map,n=null;return o=>{let r=o.getVersion();if(n!==null&&n.store===o&&n.version===r)return n.entries;let a=new Map,i=[],s=o.getRows();for(let d of o.getStructure().sections){let c=t.get(d.key);if(c!==void 0&&c.rowIds===d.rowIds&&kz(c.rows,d,s)){a.set(d.key,c),i.push(c.entry);continue}let f=s.slice(d.firstRowIndex,d.firstRowIndex+d.rowIds.length),p=Sz(d.key,f,e),m={...p,turnId:Iz(f)},g=c!==void 0&&Tz(c.entry.item,m)?c.entry:{summary:p,item:m};a.set(d.key,{rowIds:d.rowIds,rows:f,entry:g}),i.push(g)}t=a;let l=n!==null&&Lz(n.entries,i)?n.entries:i;return n={store:o,version:r,entries:l},l}}var AI=new WeakMap;function MI(e,t){let n=AI.get(e);return(n===void 0||n.derive!==t)&&(n={derive:t,read:Pz(t)},AI.set(e,n)),n.read(e)}var EI=new WeakMap;function NI(e,t){let n=MI(e,t),o=EI.get(n);return o===void 0&&(o=n.flatMap(({summary:r})=>r.headerText===null?[]:[{sectionKey:r.sectionKey,text:r.headerText}]),EI.set(n,o)),o}function _I(e,t){return e===t?!0:e.length!==t.length?!1:e.every((n,o)=>n.sectionKey===t[o].sectionKey&&n.text===t[o].text)}var RI=new WeakMap;function DI(e,t){let n=MI(e,t),o=RI.get(n);return o===void 0&&(o=n.filter(({summary:r})=>r.userText!==null).map(({item:r})=>r),RI.set(n,o)),o}function OI(e,t){return e===t?!0:e.length!==t.length?!1:e.every((n,o)=>n===t[o])}ue();var Az=[],Ez=e=>e.getMeta().usageByTurnId,Rz=e=>e.getMeta().exportApi,FI=pe(function({rowsStore:t,derive:n,paneVisible:o,totalTurnCount:r,bottomInset:a,onSelect:i,onTurnNavigatorChange:s}){let l=R(m=>o?DI(m,n):Az,[n,o]),d=gi(t,l,OI),c=gi(t,Ez),f=gi(t,Rz),p=K(()=>o?{items:d,totalTurnCount:r,bottomInset:a,usageByTurnId:c,onSelect:i,exportMarkdown:f.markdown,onDownload:f.download}:null,[a,f,d,i,o,r,c]);return W(()=>{p!==null&&s(p)},[s,p]),W(()=>{if(o)return()=>s(null)},[s,o]),null});ue();function BI(){let e=sr(),t=r=>r instanceof Error?r.message:void 0,n=(r,a)=>a!==void 0&&a.length>0?`${r}: ${a}`:r,o=(r,a,i)=>e.notify(r,a,i);return{error:(r,a,i)=>{let s=i?.description??t(a);o(n(r,s),"error",s)},warning:(r,a,i)=>{let s=i?.description??t(a);o(n(r,s),"warning",s)},success:(r,a,i)=>{let s=a??i?.description;o(n(r,s),"success",s)}}}function ip(e){let t=e.match(/^\s{0,3}#{1,6}\s+(.+)$/m)?.[1]?.trim();return t&&t.length>0?t:null}function jh(e){let t=e.trimEnd().split(/\r?\n/),n=t[0]&&/^\s{0,3}#{1,6}\s+/.test(t[0])?t.slice(1):[...t];for(;n[0]?.trim().length===0;)n.shift();if(n[0]?.match(/^\s{0,3}#{1,6}\s+(.+)$/)?.[1]?.trim().toLowerCase()==="summary")for(n.shift();n[0]?.trim().length===0;)n.shift();return n.join(`
|
|
3756
|
-
`)}function zI(e,t,n){let o=n?.maxLines??8,r=
|
|
3757
|
-
`))}function
|
|
3758
|
-
`}function $I(e,t){let n=new Blob([t],{type:"text/markdown;charset=utf-8"}),o=URL.createObjectURL(n),r=document.createElement("a");r.href=o,r.download=e,r.click(),window.setTimeout(()=>{URL.revokeObjectURL(o)},0)}var
|
|
3759
|
-
`).length,A=t.length>900||T>20,P=jh(t),_=A?zI(t,d,{maxLines:10}):null,E=UI(t),F=HI(t),B=()=>{$I(E,F)},V=()=>{L(F)},Q=()=>{if(!s){c.error(d("proposedPlan.workspacePathUnavailable"),d("proposedPlan.workspacePathUnavailableDescription"));return}h.length===0&&v(E.slice(0,sp)),g(!0)},Se=()=>{if(w.current)return;let H=h.trim();if(!(!s||l===null)){if(!H){c.warning(d("proposedPlan.enterWorkspacePath"));return}if(H.length>sp){c.warning(d("proposedPlan.pathTooLong"));return}w.current=!0,x(!0),(async()=>{try{let q=await l({environmentId:r,workspaceRoot:s,relativePath:H,contents:F});if(!C.current)return;q.ok?(g(!1),c.success(d("proposedPlan.savedToWorkspace"),q.relativePath)):c.error(d("proposedPlan.couldNotSave"),void 0,{description:d("proposedPlan.saveErrorDescription")})}catch(q){C.current&&c.error(d("proposedPlan.couldNotSave"),q,{description:d("proposedPlan.saveErrorDescription")})}finally{w.current=!1,C.current&&x(!1)}})()}};return b("div",{className:"rounded-[24px] border border-border/80 bg-card/70 p-4 sm:p-5",children:[b("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[b("div",{className:"flex min-w-0 items-center gap-2",children:[u(yl,{variant:"secondary",children:d("proposedPlan.badge")}),u("p",{className:"truncate text-sm font-medium text-foreground",children:I})]}),b(Eo,{children:[u(Mo,{render:u(ce,{"aria-label":d("proposedPlan.actions"),size:"icon-xs",variant:"outline"}),children:u(lr,{"aria-hidden":"true",className:"size-4"})}),b(Ro,{align:"end",children:[u(dr,{onClick:V,children:d(S?"proposedPlan.copied":"proposedPlan.copyToClipboard")}),u(dr,{onClick:B,children:d("proposedPlan.downloadAsMarkdown")}),l!==null?u(dr,{onClick:Q,disabled:!s||y,children:d("proposedPlan.saveToWorkspace")}):null]})]})]}),b("div",{className:"mt-4",children:[b("div",{className:$("relative",A&&!f&&"max-h-104 overflow-hidden"),children:[A&&!f?u(cr,{disclosureKey:`proposed-plan:${o}:plan`,text:_??"",cwd:i,threadRef:a,isStreaming:!1}):u(cr,{disclosureKey:`proposed-plan:${o}:plan`,text:P,cwd:i,threadRef:a,isStreaming:!1}),A&&!f?u("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 h-24 bg-linear-to-t from-card/95 via-card/80 to-transparent"}):null]}),A?u("div",{className:"mt-4 flex justify-center",children:u(ce,{size:"sm",variant:"outline","data-scroll-anchor-ignore":!0,onClick:()=>p(!f),children:d(f?"proposedPlan.collapse":"proposedPlan.expand")})}):null]}),u(Rf,{open:m,onOpenChange:H=>{y||g(H)},children:b(Df,{className:"max-w-xl",children:[b(_f,{children:[u(Of,{children:d("proposedPlan.saveToWorkspace")}),u(Mf,{children:bc(d("proposedPlan.pathHint"),u("code",{children:s??d("proposedPlan.theWorkspace")}),"path")})]}),u(nS,{className:"space-y-3",children:b("label",{htmlFor:k,className:"grid gap-1.5",children:[u("span",{className:"text-xs font-medium text-foreground",children:d("proposedPlan.workspacePath")}),u(Tf,{id:k,value:h,maxLength:sp,onChange:H=>v(H.target.value.slice(0,sp)),placeholder:E,spellCheck:!1,disabled:y})]})}),b(Nf,{children:[u(ce,{variant:"outline",size:"sm",onClick:()=>g(!1),disabled:y,children:d("proposedPlan.cancel")}),u(ce,{size:"sm",onClick:()=>{Se()},disabled:y,children:d(y?"proposedPlan.saving":"proposedPlan.save")})]})]})})]})});function VI({timeline:e,previousOverlayHeight:t,overlayHeight:n,followingEnd:o}){e&&o&&n>t&&e.scrollToEnd({animated:!1})}function qI(e,t){let n=e.topOf(t),o=e.heightOf(t);return typeof n!="number"||typeof o!="number"||!Number.isFinite(n)||!Number.isFinite(o)?null:n+Math.max(1,o)}function WI({measurement:e,followingEnd:t}){return t?null:e.rowAtScroll()}ue();var El=class extends Sa{state={failed:!1,error:null};static getDerivedStateFromError(t){return{failed:!0,error:t instanceof Error?t:new Error(String(t))}}componentDidUpdate(t){this.state.failed&&t.resetKey!==this.props.resetKey&&this.setState({failed:!1,error:null})}render(){if(!this.state.failed)return this.props.children;let{fallback:t}=this.props;return typeof t=="function"?t(this.state.error):t}};function Nz({error:e,className:t}){let{t:n}=ut();return b(Ye,{children:[b(Ze,{render:u("div",{className:$("flex min-h-6 min-w-0 items-center gap-1.5 px-0.5 py-0.5 text-destructive",t)}),children:[u(Sn,{"aria-hidden":!0,className:"size-4 shrink-0"}),u("span",{className:"min-w-0 flex-1 truncate",children:n("timeline.entryUnavailable")})]}),u(Je,{className:"max-w-xs whitespace-pre-wrap font-mono text-[11px]",children:e.message})]})}function GI(e){return u(Nz,{error:e})}var fn=Ct(null),jI=Ct(null),_z=u("div",{className:"h-3 sm:h-4"}),Dz=u("div",{className:"h-10 sm:h-12"}),Oz=Object.freeze([]);function Fz({loading:e,blocked:t,onLoadEarlier:n,fade:o}){let{t:r}=ut();return u("div",{className:o?"pt-10 sm:pt-12":"pt-3 sm:pt-4",children:u("div",{className:"transcript-col pb-2",children:u("button",{type:"button",onClick:n,disabled:e||t,className:"relative w-full py-1.5 text-chat-row text-muted-foreground/60 hover:text-foreground disabled:cursor-default pointer-coarse:after:absolute pointer-coarse:after:inset-0 pointer-coarse:after:min-h-11",children:r(e?"timeline.loadingEarlier":"timeline.loadEarlier")})})})}function Bz({loading:e,blocked:t,onLoadLater:n,onReturnToLatest:o}){let{t:r}=ut();return b("div",{className:"transcript-col flex items-center justify-center gap-2 py-2",children:[u(ce,{variant:"ghost",size:"sm",onClick:n,disabled:e||t,children:r(e?"timeline.loadingLater":"timeline.loadLater")}),o?u(ce,{variant:"ghost",size:"sm",onClick:o,children:r("timeline.returnToLatest")}):null]})}function zz({onReveal:e,fade:t}){let{t:n}=ut();return u("div",{className:t?"pt-10 sm:pt-12":"pt-3 sm:pt-4",children:u("div",{className:"transcript-col pb-2",children:u("button",{type:"button",onClick:e,className:"relative w-full py-1.5 text-chat-row text-muted-foreground/60 hover:text-foreground pointer-coarse:after:absolute pointer-coarse:after:inset-0 pointer-coarse:after:min-h-11",children:n("timeline.loadEarlier")})})})}var Uz=u("div",{className:"h-3 sm:h-4"}),Hz=[],$z=new Set,Kz=200,Vz=1e4,Qh=600;function Xh(e,t){if(typeof Element>"u"||!(e instanceof Element))return!1;if(t===null||!t.contains(e))return!0;for(let n=e;n&&n!==t;){if(n instanceof HTMLElement&&n.scrollHeight>n.clientHeight&&n.scrollTop>0)return!0;n=n.parentElement}return!1}var qz=()=>{},Wz=[];function Gz(e){let t=e.getMeta().status;return{latestTurn:t.latestTurn??null,latestAssistantMessageId:t.latestAssistantMessageId??null,isWorking:t.isWorking,workingStepLabel:t.workingStepLabel??null,stall:t.stall??null,retry:t.retry??null,totalTurnCount:t.totalTurnCount??null,scheduledWakes:t.scheduledWakes??Oz}}function jz(e,t){return e.latestTurn===t.latestTurn&&e.latestAssistantMessageId===t.latestAssistantMessageId&&e.isWorking===t.isWorking&&e.workingStepLabel===t.workingStepLabel&&e.stall===t.stall&&e.retry===t.retry&&e.totalTurnCount===t.totalTurnCount&&e.scheduledWakes===t.scheduledWakes}var Qz=e=>e.getMeta().finalAssistantMessageReceived;function Xz(e,t){let n=N(e);return t&&(n.current=e),n.current}var QI=pe(function({derive:t,SiteIcon:n,rowsStore:o,threadKey:r,threadRef:a,environmentId:i,onInterrupt:s=null,onRespondToDecision:l=null,onCancelScheduledWake:d=null,agentPanelModel:c,onOpenAgents:f=qz,onOpenFileDiff:p,onForkFromUserMessage:m,onImageExpand:g,markdownCwd:h,resolvedTheme:v,timestampFormat:y,workspaceRoot:x,skills:C=Hz,onRowsChange:w,contentInsetEndAdjustment:L,liveFollowEnabled:S,awaitingUserDecision:k=!1,onIsAtEndChange:I,onManualNavigation:T,onDisclosureNavigation:A=T,hideEmptyPlaceholder:P=!1,topFadeEnabled:_=!1,scrollerRef:E,loadEarlier:F=null,loadLater:B=null,pagingBlockedByInteraction:V=!1,onReturnToLatest:Q=null,onVisibleTurnRangeChange:Se=null,revealMessageRequest:H=null,onRevealMessageHandled:q,renderWorkGroup:ee,renderToolCallDetail:G,loadScrollAnchor:te,saveScrollAnchor:me,useVisibleThreadCompletion:U,onSavePlanToWorkspace:Y,paneActive:se,onTurnNavigatorChange:ge}){let{t:ie}=ut(),{latestTurn:Ae,latestAssistantMessageId:Xe,isWorking:nt,workingStepLabel:rt,stall:Ve,retry:ne,totalTurnCount:we,scheduledWakes:j}=gi(o,Gz,jz),X=ea(),ae=N(X);ae.current=X;let oe=N(H);oe.current=H;let[ft,pt]=ln("timeline-disclosure-reading",r,!1),yt=N(r);yt.current=r;let Lt=N(V);Lt.current=V;let on=Rt("timeline-following-end",r,!0);on.current=B===null&&S;let gt=Rt("timeline-scroll-restore-pending",r,!1),zt=Pr(r,null),Mt=Pr(r,null),wt=Pr(r,null),In=Rt("timeline-content-inset",r,L),ct=N(null),dn=Pr(r,[]),ro=Pr(r,!1),Vt=N(null),bn=R(()=>dn.current,[dn]),Tn=R(z=>{dn.current=z,Vt.current?.(),Yn.current?.schedule()},[dn]),rn=R(z=>{ro.current=z,Yn.current?.schedule()},[ro]),kn=R(z=>{z!==null&&(ct.current=z),E(z)},[E]);he(()=>{VI({timeline:ct.current,previousOverlayHeight:In.current,overlayHeight:L,followingEnd:X&&B===null&&S&&!ft}),In.current=L},[L,ft,S,B,X]),W(()=>()=>{Mt.current?.stop()},[]);let O=R(()=>{Mt.current?.stop(),Mt.current=null,zt.current=null,pt(!1)},[zt,Mt,pt]),fe=R(z=>{A(),zt.current=z,pt(!0),Mt.current?.stop();let Pe=ct.current?.node??null;if(!Pe)return;let st=Array.from(Pe.querySelectorAll("[data-timeline-row-id]")).find($o=>$o.dataset.timelineRowId===z);if(!st)return;let Xt=wt.current;Mt.current=WS({viewport:Pe,row:st,anchor:Xt&&st.contains(Xt)?Xt:st,scrollToOffset:$o=>{Pe.scrollTop=$o}})},[A]),ye=Rt("timeline-live-follow-previous",r,S);he(()=>{S&&!ye.current&&O(),ye.current=S},[S,O]);let Te=Xz(B!==null,X),Me=!Te&&nt,ht=Te?null:rt,Ln=Te?null:Ve,mn=Te?null:ne,at=rI(o),Pt=at.sections,Et=at.rowIds.length,St=R(z=>{let Pe=o.getRows().find(st=>st.id===z||st.kind==="work"&&st.groupedEntries.some(Xt=>Xt.id===z)||st.kind==="tool-group"&&st.entries.some(Xt=>Xt.id===z));fe(Pe?.id??z)},[o,fe]),an=Rt("timeline-scroll-snapshot",r,null),Jt=R((z,Pe=on.current)=>{z.scrollLength<=0||(an.current={threadKey:r,anchor:WI({measurement:z,followingEnd:Pe})})},[on,r,an]),xe=R(()=>{let z=an.current;z&&me(z.threadKey,z.anchor)},[me,an]),_e=R(()=>{if(!X||gt.current)return;if(Et===0){xe();return}let z=ct.current?.measure();z&&z.scrollLength>0&&(Jt(z,on.current&&t.resolveIsAtEnd(z,L)!==!1),xe())},[Jt,L,t,on,X,xe,gt,Et]),qe=tI(r),We=N(qe);We.current=qe;let ot=Rt("timeline-top-reveal-armed",r,!0),xt=Rt("timeline-network-prepend-awaiting-navigation",r,!1),Bt=N(null),Zt=N(null);he(()=>()=>{Zt.current!==null&&(cancelAnimationFrame(Zt.current),Zt.current=null)},[r,X]);let ke=Rt("timeline-network-prepend-scroll-top",r,null),Ut=Rt("timeline-mounted-section-keys",r,$z,3),vt=Pr(r,null),Nt=vt.current,Bn=Nt===null?-1:Pt.findIndex(z=>z.key===Nt.firstMountedSectionKey),ve=Bn>0?Pt.length-Math.max(0,Bn-Fh):qe.revealedCount,et=Bn>0?ve:qe.revealedCount,lt=LS(Pt.map(z=>z.key),Ut.current,et,B!==null||!S||ft||ro.current||dn.current.length>0),{startIndex:it,hasHiddenOlder:xn}=QS(Pt.length,lt),gn=K(()=>Pt.slice(it),[it,Pt]),cn=Nt!==null&&Bn>0&&it<Bn,It=N(Pt);It.current=Pt,he(()=>{X&&(Ut.current=new Set(gn.map(z=>z.key)),Nt!==null&&(cn?(vt.current=null,xt.current=!0):F?.loading?Nt.loadingObserved=!0:(Nt.loadingObserved||F===null)&&(vt.current=null)),lt<We.current.revealedCount?We.current.compactTo(lt):lt>We.current.revealedCount&&We.current.revealAtLeast(lt))},[xt,F,X,Nt,cn,vt,Ut,lt,gn]);let Qt=Pr(r,null),qt=R((z=null)=>{if(!ae.current)return;let Pe=ct.current?.node;Pe&&(Qt.current={scrollHeight:Pe.scrollHeight,scrollTop:Pe.scrollTop,row:ct.current?.measure()?.rowAtScroll()??null,firstMountedSectionKey:z,until:Date.now()+Vz})},[Qt]),ko=R(()=>{let z=Qt.current;if(z===null||z.firstMountedSectionKey===null||Date.now()>z.until)return;let Pe=ct.current?.node;if(!Pe)return;let st=an.current;z.scrollHeight=Pe.scrollHeight,z.scrollTop=Pe.scrollTop,z.row=st?.threadKey===r?st.anchor:null},[Qt,r,an]);he(()=>{if(!X)return;let z=Qt.current;if(!z)return;if(Date.now()>z.until){Qt.current=null;return}if(z.firstMountedSectionKey!==null&&(!cn||Nt?.firstMountedSectionKey!==z.firstMountedSectionKey))return;Qt.current=null;let Pe=ct.current?.node;if(Pe){if(z.row){let st=ct.current?.measure()?.topOf(z.row.rowId);st!=null&&(Pe.scrollTop=st+z.row.offsetPx)}else Pe.scrollTop=z.scrollTop+(Pe.scrollHeight-z.scrollHeight);cn&&(ke.current=Pe.scrollTop)}},[ke,X,Nt,cn,it,at]);let Do=R(()=>{qt(),We.current.revealOlder()},[qt]),va=N(Do);va.current=Do;let Ya=N(xn);Ya.current=xn;let Ue=N(null),ya=Rt("timeline-scroll-restore",r,void 0);if(ya.current===void 0&&Et>0){let z=te(r);ya.current=z!==null&&at.rowIds.includes(z.rowId)?z:null}let Wr=ya.current??null,tr=N(()=>{}),[Nn,Ja]=ln("timeline-scroll-restore-settled",r,!1),nr=Wr!==null&&!Nn,Za=Rt("timeline-last-anchor-save",r,0);W(()=>{let z=Wr;if(!X||Nn||z===null)return;if(oe.current!==null){Ja(!0);return}let Pe=null,st=requestAnimationFrame(()=>{!ae.current||yt.current!==r||(T(),We.current.revealAtLeast(xc(It.current,z.rowId,We.current.revealedCount)),Pe=requestAnimationFrame(()=>{!ae.current||yt.current!==r||(Ja(!0),tr.current(z.rowId,-z.offsetPx))}))});return()=>{cancelAnimationFrame(st),Pe!==null&&cancelAnimationFrame(Pe)}},[T,X,r,Wr,Nn]);let br=Rt("timeline-restore-after-presentation",r,!1),wr=nr||br.current;gt.current=wr,he(()=>{if(X)return()=>{yt.current!==r?xe():_e(),br.current=!0}},[X,r]),he(()=>{if(!X||!br.current)return;if(oe.current!==null){br.current=!1,gt.current=!1;return}let z=null,Pe=null,st=()=>{!ae.current||yt.current!==r||(ct.current?.scrollToEnd(),br.current=!1,gt.current=!1,on.current=B===null,jr.current=B===null,ar.current={...ar.current,followEnabled:!0,restoreInProgress:!1},I(B===null))},Xt=te(r),$o=Xt!==null&&It.current.some(Ca=>Ca.rowIds.includes(Xt.rowId));return Xt===null?z=requestAnimationFrame(st):$o?(T(),We.current.revealAtLeast(xc(It.current,Xt.rowId,We.current.revealedCount)),z=requestAnimationFrame(()=>{Pe=requestAnimationFrame(()=>{!ae.current||yt.current!==r||(tr.current(Xt.rowId,-Xt.offsetPx),br.current=!1,gt.current=!1)})})):Et>0&&(z=requestAnimationFrame(st)),()=>{z!==null&&cancelAnimationFrame(z),Pe!==null&&cancelAnimationFrame(Pe)}},[te,B,I,T,X,r,Et,Pt.length]);let or=R(z=>{O(),T(),We.current.revealAtLeast(xc(It.current,z.anchorRowId,We.current.revealedCount));let Pe=r;requestAnimationFrame(()=>{yt.current===Pe&&tr.current(z.anchorRowId,24)})},[T,O,r]);W(()=>{if(H===null||!X)return;O(),T();let z=t.resolveToolGroupRevealRowId(o.getRows(),H.rowId);We.current.revealAtLeast(xc(It.current,z,We.current.revealedCount));let Pe=requestAnimationFrame(()=>{yt.current===r&&(tr.current(z,24),q?.())});return()=>cancelAnimationFrame(Pe)},[H,X,T,O,q,t,r,o]);let _t=R(z=>X?NI(z,t):Wz,[t,X]),Gn=gi(o,_t,_I),Lo=N(Gn);Lo.current=Gn;let Ee=Rt("timeline-active-header",r,null),Oo=Gn.at(-1)?.text??null,zi=Oo!==null,jn=N(null),Fo=N(null),[Qn,rr]=ln("timeline-pinned-header-expanded",r,!1),Bo=N(Qn);Bo.current=Qn;let Sr=R(()=>{if(!ae.current)return;let z=jn.current,Pe=Fo.current;!z||!Pe||(z.dataset.truncated=Bo.current||Pe.scrollWidth>Pe.clientWidth+1?"true":"false")},[]),[po,zo]=J(null),Ui=gi(o,Qz),[Pn,ei]=J(null),Po=R(()=>{if(Lt.current||yt.current!==r||F===null||F.loading)return;let z=gn[0]?.key;z!==void 0&&(qt(z),vt.current={firstMountedSectionKey:z,loadingObserved:!1},F.onLoadEarlier())},[qt,F,vt,r,gn]);Ue.current=F===null||F.loading||V?null:Po;let Uo=R(()=>{Lt.current||yt.current!==r||(qt(),B?.onLoadLater())},[qt,B,r]),Gr=R((z,Pe)=>{if(!ae.current)return;let st=ct.current?.node;if(!st)return;let Xt=Array.from(st.querySelectorAll("[data-timeline-turn-section]")),$o=Xt.findIndex(qi=>qi.querySelector(`[data-timeline-row-id="${CSS.escape(z)}"]`)),Ca=$o<0?Xt:Xt.slice(0,$o+1);for(let qi of Ca)qi.style.contentVisibility="visible";st.offsetHeight,ct.current?.scrollToRow(z,{viewOffset:Pe}),requestAnimationFrame(()=>{for(let qi of Ca)qi.style.removeProperty("content-visibility")})},[]);tr.current=Gr;let Xn=X&&B===null&&S&&!ft&&!wr,jr=N(Xn);jr.current=Xn;let ar=N({followEnabled:Xn,restoreInProgress:wr,loadEarlier:F});ar.current={followEnabled:Xn,restoreInProgress:wr,loadEarlier:F};let Yn=N(null);W(()=>{if(!Pn||!X)return;let z=nI({root:Pn,minimumCount:ps,keepAbovePx:Qh,canCompact:()=>{let Pe=ar.current,st=Qt.current;return Pe.followEnabled&&dn.current.length===0&&!Pe.restoreInProgress&&!Pe.loadEarlier?.loading&&!(st&&st.until>Date.now())&&We.current.revealedCount>ps},onCompact:Pe=>{ot.current=!0,qt(),We.current.compactTo(Pe)}});return Yn.current=z,()=>{z.disconnect(),Yn.current=null}},[qt,X,Pn]),W(()=>{Yn.current?.schedule()},[Xn,F?.loading,qe.revealedCount,Pt.length]),W(()=>{if(!Pn||!X||typeof ResizeObserver>"u")return;let z=()=>{if(!ae.current||!jr.current)return;let Xt=Pn.scrollHeight-Pn.clientHeight;Math.abs(Pn.scrollTop-Xt)>.5&&(Pn.scrollTop=Xt)},Pe=new ResizeObserver(z);Pe.observe(Pn);let st=Pn.firstElementChild;return st&&Pe.observe(st),()=>Pe.disconnect()},[X,Pn]),U({viewport:po,viewActive:se&&X,threadKey:r,completedAt:B===null&&!wr&&Ae?.state==="completed"&&Ui?Ae.completedAt:null,messageId:Xe,bottomInset:L});let Hi=at.rowIds.at(-1)??null;W(()=>{w?.(Hi)},[Hi,w,r]);let mo=Rt("timeline-later-load-armed",r,!0),$e=R(z=>{if(z>Qh){ot.current=!0;return}if(ot.current){if(ot.current=!1,Ya.current){va.current();return}Ue.current?.()}},[ot]),Dt=R(()=>{xt.current&&(xt.current=!1,ke.current=null,ot.current=!0)},[xt,ke,ot]),un=R(()=>{if(Zt.current!==null||Lt.current||!ae.current||yt.current!==r||gt.current)return!1;let z=ct.current?.measure();return!z||z.scroll>2||z.contentLength-z.scrollLength-z.scroll<=2||!Ya.current&&Ue.current===null?!1:(xt.current=!1,ke.current=null,ot.current=!0,Zt.current=requestAnimationFrame(()=>{Zt.current=null}),$e(z.scroll),!0)},[$e,xt,ke,r,gt,ot,Zt]),An=R(()=>{if(!ae.current||yt.current!==r)return;let z=ct.current?.measure();if(!z||gt.current)return;Jt(z);let Pe=ke.current;xt.current&&Pe!==null&&Math.abs(z.scroll-Pe)>.5&&Dt(),ko();let st=t.resolveIsAtEnd({contentLength:z.contentLength,scroll:z.scroll,scrollLength:z.scrollLength},L);st!==void 0&&I(B===null&&st),z.contentLength-z.scrollLength-z.scroll>2&&$e(z.scroll),z.contentLength-z.scrollLength-z.scroll>Qh?mo.current=!0:mo.current&&B&&!B.loading&&!Lt.current&&(mo.current=!1,Uo());let $o=Date.now();$o-Za.current>=Kz&&(Za.current=$o,xe())},[Jt,L,t,$e,I,xe,ko,r,B,mo,Uo,xt,ke,Dt,gt]),Ho=N(null),xa=R(()=>{ae.current&&Ho.current===null&&(Ho.current=requestAnimationFrame(()=>{Ho.current=null,Sr()}))},[Sr]);W(()=>()=>{Ho.current!==null&&(cancelAnimationFrame(Ho.current),Ho.current=null)},[r]);let $i=R(z=>{if(z===null||z===Ee.current)return;Ee.current=z;let Pe=Lo.current.find(st=>st.sectionKey===z);Pe&&Fo.current&&(Fo.current.textContent=Pe.text),Bo.current&&rr(!1),xa()},[Ee,xa,rr]),nl=oI({root:Pn,topInsetPx:ap,onActiveSectionChange:$i,active:X}),Ki=K(()=>kS(Pt),[Pt]),Vi=ES({root:Pn,inputKey:r,visible:X,index:Ki,topInset:zi?ap:0,bottomInset:L,interactionRows:bn,onRangeChange:Se,onSelectionChange:rn});Vt.current=Vi,W(()=>{if(!X){xe();return}let z=requestAnimationFrame(()=>{if(!ae.current)return;let Pe=ct.current?.node;Pe&&jr.current&&(Pe.scrollTop=Pe.scrollHeight-Pe.clientHeight),nl.refresh()});return()=>cancelAnimationFrame(z)},[xe,nl,X]);let ol=R(()=>{rr(z=>!z)},[rr]);he(()=>{if(!X)return;let z=Ee.current,Pe=z===null?void 0:Lo.current.find(st=>st.sectionKey===z);Pe&&Fo.current&&(Fo.current.textContent=Pe.text),xa()},[X,xa,Qn]);let Xg=K(()=>{let z=xn?u(zz,{onReveal:Do,fade:_}):F!==null?u(Fz,{loading:F.loading,blocked:V,onLoadEarlier:Po,fade:_}):_?Dz:_z;return zi?b(Le,{children:[u("div",{style:{height:ap}}),z]}):z},[Po,xn,zi,F,V,Do,_]);W(()=>{if(!X)return;let z=requestAnimationFrame(An);return()=>cancelAnimationFrame(z)},[An,X,wr,Et]);let Xu=K(()=>({timestampFormat:y,threadKey:r,threadRef:a,markdownCwd:h,resolvedTheme:v,workspaceRoot:x,skills:C,activeThreadEnvironmentId:i,onForkFromUserMessage:m,onImageExpand:g,onOpenFileDiff:p,onProcessDisclosureChange:St,agentPanelModel:c,onOpenAgents:f,onInterrupt:s,onRespondToDecision:l,scheduledWakes:j,onCancelScheduledWake:d,derive:t,SiteIcon:n,renderWorkGroup:ee,renderToolCallDetail:G,onSavePlanToWorkspace:Y}),[y,r,a,h,v,x,C,i,m,g,p,St,c,f,s,l,j,d,t,n,ee,G,Y]),Yg=K(()=>({isWorking:Me,workingStepLabel:ht,stall:Ln,retry:mn}),[Me,mn,Ln,ht]),Yu=R(z=>u(Yz,{rowsStore:o,rowId:z}),[o]),Td=Et===0&&!Me&&!P;return u(fn,{value:Xu,children:b(jI,{value:Yg,children:[u(FI,{rowsStore:o,derive:t,paneVisible:X,totalTurnCount:we,bottomInset:L,onSelect:or,onTurnNavigatorChange:ge}),b("div",{ref:zo,onClickCapture:z=>{wt.current=z.target instanceof Element?z.target.closest("button"):null},onWheelCapture:O,onTouchMoveCapture:O,onPointerDownCapture:z=>{z.target===ct.current?.node&&(O(),un())},onKeyDownCapture:z=>{["ArrowUp","ArrowDown","PageUp","PageDown","Home","End"].includes(z.key)&&O()},className:"chat-timeline relative h-full min-h-0","data-awaiting-user-decision":k?"true":"false","data-disclosure-reading":ft?"true":void 0,"data-timeline-follow-end":Xn?"true":"false","data-timeline-end-inset":L,children:[u(AS,{inputKey:r,onBeforeInputChange:_e,handleRef:kn,onAttach:ei,onInteractionRowsChange:Tn,onScroll:An,className:$("scrollbar-gutter-both h-full min-h-0 overflow-y-auto overflow-x-hidden overscroll-y-contain px-3 sm:px-5",_&&"topbar-scroll-fade"),children:b("div",{style:{paddingBottom:L},onWheel:z=>{z.defaultPrevented||z.deltaY>=0||fi(z.target)||Xh(z.target,ct.current?.node??null)||un()},onTouchStartCapture:z=>{Bt.current=z.touches[0]?.clientY??null},onTouchMove:z=>{let Pe=z.touches[0],st=Bt.current;z.defaultPrevented||fi(z.target)||Xh(z.target,ct.current?.node??null)||Pe===void 0||st===null||Pe.clientY<=st||un()&&(Bt.current=null)},onTouchEndCapture:()=>{Bt.current=null},onTouchCancelCapture:()=>{Bt.current=null},onKeyDown:z=>{z.defaultPrevented||z.repeat||z.metaKey||z.ctrlKey||z.altKey||z.shiftKey||fi(z.target)||Xh(z.target,ct.current?.node??null)||!["ArrowUp","PageUp","Home"].includes(z.key)||un()},children:[Xg,gn.map(z=>u(GS,{sectionKey:z.key,rowKeyPrefix:r,rowIds:z.rowIds,renderRow:Yu,sectionRef:nl.observeSection(z.key)},`${r}:${z.key}`)),B?u(Bz,{loading:B.loading,blocked:V,onLoadLater:Uo,onReturnToLatest:Q}):null,Uz]})}),Td?u("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center",children:u("p",{className:"text-placeholder text-chat",children:ie("timeline.empty")})}):null,Oo!==null?u(TI,{ref:jn,textRef:Fo,initialText:Oo,expanded:Qn,onToggleExpanded:ol}):null]})]})})});var Yz=pe(function({rowsStore:t,rowId:n}){let o=aI(t,n),r=bt(fn);return o===void 0?null:u(vl,{value:o.id,children:u("div",{className:$("relative",o.kind==="message"&&o.message.role==="user"?"pb-6":o.kind==="message"&&o.message.role==="assistant"?o.copyInFooter?"pb-1 group/assistant":"pb-4 group/assistant":"pb-2"),"data-timeline-row-id":o.id,"data-timeline-row-kind":o.kind,"data-message-id":o.kind==="message"?o.message.id:void 0,"data-message-role":o.kind==="message"?o.message.role:void 0,children:b(El,{resetKey:o.id,fallback:GI,children:[o.kind==="turn-summary"?u(_S,{footer:o.footer,copyText:o.copyText,timestampFormat:r.timestampFormat}):null,o.kind==="tool-group"?u(qS,{entries:o.entries,groupId:o.groupId,threadKey:r.threadKey,workspaceRoot:r.workspaceRoot,onDisclosureChange:()=>r.onProcessDisclosureChange?.(o.id)}):null,o.kind==="work"?u(Jz,{row:o}):null,o.kind==="model-switch"?u(LI,{row:o}):null,o.kind==="turn-identity"?u("div",{"data-turn-identity":o.turnId,className:"px-1 pt-1",children:u(Wh,{badge:o.badge,createdAt:o.createdAt})}):null,o.kind==="message"&&o.message.role==="user"?u(Kh,{row:o}):null,o.kind==="message"&&o.message.role==="assistant"?u(kI,{row:o}):null,o.kind==="proposed-plan"?u(eU,{row:o}):null,o.kind==="turn-plan"?u(tU,{row:o}):null,o.kind==="working"?u(nU,{row:o}):null]})})})});function Jz({row:e}){let t=bt(fn),n=ea(),o=t.renderWorkGroup?.({row:e,threadRef:t.threadRef,visible:n});return o!==void 0?u(Le,{children:o}):u("div",{className:"min-w-0 space-y-px py-0.5",children:e.groupedEntries.map(r=>u(Zz,{entry:r},r.id))})}function Zz({entry:e}){let t=bt(fn),[n,o]=Go(t.threadKey,`work-fallback:${Vf(e)}`,!1),r=e.detail??e.command??e.rawCommand??e.toolLabel?.detail;return b("div",{children:[b("button",{type:"button","aria-expanded":n,className:$("chat-process-row flex w-full min-w-0 items-center gap-1.5 px-2 text-left",e.tone==="error"?"text-destructive":"text-muted-foreground"),onClick:()=>o(!n),disabled:r===void 0,children:[u("span",{"aria-hidden":!0,className:$("block size-2 shrink-0 rounded-full",e.tone==="error"?"bg-destructive":e.tone==="thinking"||e.tone==="info"?"bg-muted-foreground/60":"border border-muted-foreground/60")}),u("span",{className:"chat-process-text min-w-0 flex-1 truncate",children:e.label}),r!==void 0?u(sn,{"aria-hidden":!0,className:$("size-icon-1 shrink-0",!n&&"-rotate-90")}):null]}),n&&r!==void 0?u("pre",{className:"chat-tool-body mx-2 overflow-x-auto rounded-md bg-muted/40 p-2",children:r}):null]})}function eU({row:e}){let t=bt(fn);return u("div",{className:"min-w-0 px-1 py-0.5",children:u(KI,{threadKey:t.threadKey,rowId:e.id,planMarkdown:e.proposedPlan.planMarkdown,environmentId:t.activeThreadEnvironmentId,threadRef:t.threadRef??void 0,cwd:t.markdownCwd,workspaceRoot:t.workspaceRoot,onSavePlanToWorkspace:t.onSavePlanToWorkspace})})}var tU=pe(function({row:t}){let n=bt(fn),{t:o}=ut(),[r,a]=Go(n.threadKey,`turn-plan:${t.id}`,!1),{steps:i}=t.turnPlan.plan,s=i.filter(f=>f.status==="completed").length,l=s===i.length,d=i.find(f=>f.status==="inProgress")?.step??i.find(f=>f.status==="pending")?.step??i.at(-1)?.step??o("proposedPlan.badge");return b("div",{className:"min-w-0 px-1 py-0.5",children:[b("button",{type:"button",className:"relative flex w-full min-w-0 cursor-pointer items-center gap-2 rounded-md px-0.5 py-0.5 text-left text-[12px] leading-5 transition-colors duration-(--control-duration) hover:bg-accent/20 pointer-coarse:after:absolute pointer-coarse:after:inset-0 pointer-coarse:after:min-h-11","aria-expanded":r,onClick:()=>a(!r),children:[u(r?sn:Vo,{className:"size-icon-1 shrink-0 text-muted-foreground/65"}),i.length>1?u("span",{"aria-hidden":!0,className:"flex shrink-0 items-center gap-0.5",children:i.map(f=>u("span",{className:$("h-[3px] w-2.5 rounded-full",f.status==="completed"?"bg-success":f.status==="inProgress"?"bg-primary":"bg-muted-foreground/25")},f.step))}):null,u("span",{className:$("min-w-0 truncate",l?"text-muted-foreground/65":"font-medium text-foreground/85"),children:d}),i.length>1?b("span",{className:"shrink-0 text-muted-foreground/50 tabular-nums",children:[s,"/",i.length]}):null]}),r?u("div",{className:"mt-0.5 space-y-px pl-6",children:i.map(f=>b("div",{className:"flex items-baseline gap-2 text-[12px] leading-5",children:[u("span",{className:$("w-3 shrink-0 text-center font-mono text-chat-meta",f.status==="completed"?"text-success":f.status==="inProgress"?"text-primary":"text-muted-foreground/40"),"aria-hidden":!0,children:f.status==="completed"?"\u2713":f.status==="inProgress"?"\u25CF":"\u25CB"}),u("span",{className:$("min-w-0",f.status==="completed"?"text-muted-foreground/55":f.status==="inProgress"?"text-foreground/90":"text-muted-foreground/70"),children:f.step})]},f.step))}):null]})});function nU({row:e}){let{workingStepLabel:t,stall:n,retry:o}=bt(jI),{t:r}=ut();return b("div",{className:"border-b border-border/60 pb-2 pt-1",children:[u("div",{className:"flex min-w-0 flex-wrap items-center gap-x-1.5 px-1 text-chat text-muted-foreground tabular-nums","data-testid":"working-row",children:b("span",{className:"min-w-0",children:[e.compacting?r("activity.compacting"):e.createdAt?bc(r("activity.workingForLive"),u(sU,{createdAt:e.createdAt})):r("activity.workingNoTimer"),t&&!e.compacting?b("span",{className:"ml-2 text-muted-foreground/55",children:["\xB7 ",t]}):null]})}),o?u(oU,{retry:o}):n&&!e.compacting?u(aU,{stall:n}):null]})}function oU({retry:e}){let{t}=ut(),n=bt(fn);return b(uc,{variant:"warning",className:"mt-2 px-2 py-1.5 text-chat-row",children:[u(Bf,{children:n.derive.providerRetryMessage(e,(o,r)=>t(o,r))}),n.onInterrupt?u(fc,{children:u(ce,{onClick:n.onInterrupt,size:"sm",variant:"ghost",title:t("stall.interruptHint"),children:t("stall.interrupt")})}):null]})}var rU={childThread:"stall.reasonChildThread",tool:"stall.reasonTool",approval:"stall.reasonApproval",userInput:"stall.reasonUserInput",model:"stall.reasonModel"};function aU({stall:e}){let{t}=ut(),{onInterrupt:n}=bt(fn),o=t(rU[e.reason]);return b("div",{className:"mt-1 flex items-center gap-2 px-1 text-chat-row text-muted-foreground/70",children:[u("span",{className:"tabular-nums",children:bc(t("stall.noOutputForLive"),u(iU,{since:e.since}))}),u("span",{"aria-hidden":!0,children:"\xB7"}),u("span",{children:o}),n?u(ce,{className:"h-5 px-1.5 text-chat-row",onClick:n,size:"sm",title:t("stall.interruptHint"),variant:"ghost",children:t("stall.interrupt")}):null]})}function XI(e,t){let n=ea();W(()=>{let o=()=>{t.current&&(t.current.textContent=Yh(e))};if(o(),!n)return;let r=setInterval(o,1e3);return document.addEventListener("visibilitychange",o),()=>{clearInterval(r),document.removeEventListener("visibilitychange",o)}},[n,e,t])}function iU({since:e}){let t=N(null);return XI(e,t),u("span",{className:"timeline-timer tabular-nums",ref:t,children:Yh(e)})}function sU({createdAt:e}){let t=N(null);return XI(e,t),u("span",{ref:t,className:"timeline-timer tabular-nums",children:Yh(e)})}function lU(e,t){let n=Date.parse(e),o=Date.parse(t);if(!Number.isFinite(n)||!Number.isFinite(o))return null;let r=Math.max(0,Math.floor((o-n)/1e3));return r<60?`${r}s`:La(r*1e3)}function Yh(e){return lU(e,new Date().toISOString())??"0s"}function lp(e,t){return e===t?!0:!e||!t?!1:e.identity===t.identity&&e.instanceId===t.instanceId&&e.driverKind===t.driverKind&&e.providerDisplayName===t.providerDisplayName&&e.accentColor===t.accentColor&&e.modelLabel===t.modelLabel&&e.effortLabel===t.effortLabel}function YI(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]!==t[n])return!1;return!0}function JI(e,t){if(e===t)return!0;if(e.kind!==t.kind||e.id!==t.id)return!1;switch(e.kind){case"turn-identity":{let n=t;return e.turnId===n.turnId&&e.createdAt===n.createdAt&&lp(e.badge,n.badge)}case"turn-summary":{let n=t;return e.createdAt===n.createdAt&&e.copyText===n.copyText&&e.footer===n.footer}case"tool-group":{let n=t;return e.createdAt===n.createdAt&&e.groupId===n.groupId&&YI(e.entries,n.entries)}case"working":{let n=t;return e.createdAt===n.createdAt&&e.turnId===n.turnId&&e.compacting===n.compacting&&lp(e.modelBadge,n.modelBadge)}case"model-switch":{let n=t;return e.createdAt===n.createdAt&&e.pending===n.pending&&lp(e.badge,n.badge)}case"proposed-plan":return e.proposedPlan===t.proposedPlan;case"turn-plan":{let n=t;return e.createdAt===n.createdAt&&e.turnPlan.plan===n.turnPlan.plan}case"work":{let n=t;return e.isExpandedToolGroupEntry===n.isExpandedToolGroupEntry&&e.isLastExpandedToolGroupEntry===n.isLastExpandedToolGroupEntry&&YI(e.groupedEntries,n.groupedEntries)}case"message":{let n=t;return e.message===n.message&&e.presentation===n.presentation&&e.textTone===n.textTone&&e.durationStart===n.durationStart&&e.showAssistantMeta===n.showAssistantMeta&&e.showAssistantCopyButton===n.showAssistantCopyButton&&e.copyInFooter===n.copyInFooter&&e.assistantCopyStreaming===n.assistantCopyStreaming&&lp(e.modelBadge,n.modelBadge)}}}function dU(e,t){let n=t.historyWindow,{status:o}=t,r={activities:t.activities,timelineEntries:t.timelineEntries,latestTurn:n?null:o.latestTurn,runningTurnId:n?null:o.runningTurnId,expandedTurnIds:t.expandedTurnIds,isWorking:!n&&o.isWorking,activeTurnStartedAt:n?null:o.activeTurnStartedAt,resolveModelBadge:t.resolveModelBadge,pendingModelSelection:n?null:o.pendingModelSelection},a=e.deriveGroups(r),i=o.latestTurn;if(n&&i&&i.completedAt!==null){let s=i.turnId;if(a.rows.some(d=>d.kind==="message"?d.message.role==="assistant"&&d.message.turnId===s:d.kind==="work"?d.groupedEntries.some(c=>c.turnId===s):d.kind==="tool-group"&&d.entries.some(c=>c.turnId===s)))return e.deriveGroups({...r,latestTurn:i})}return a}var cU=new Map,uU={markdown:()=>"",download(){}},fU=[],pU={latestTurn:null,latestAssistantMessageId:null,runningTurnId:null,isWorking:!1,workingStepLabel:null,stall:null,retry:null,activeTurnStartedAt:null,totalTurnCount:null,pendingModelSelection:null,scheduledWakes:fU},mU={inputs:null,structure:{rowIds:[],sections:[]},indexById:new Map,rows:[],meta:{status:pU,usageByTurnId:cU,exportApi:uU,finalAssistantMessageReceived:!1},version:0};function gU(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]!==t[n])return!1;return!0}function hU(e,t,n,o){let r=dU(n,e),a=vU(t.structure.rowIds,r.rows),i=a?t.indexById:new Map(r.rows.map((g,h)=>[g.id,h])),s=r.rows.map((g,h)=>{let v=a?t.rows[h]:t.rows[t.indexById.get(g.id)??-1],y=v!==void 0&&JI(v,g)?v:g;return y!==v&&o.add(g.id),y});if(!a)for(let g of t.indexById.keys())i.has(g)||o.add(g);let l=jS(s,r.turnGroups,t.structure.sections),d=a?t.structure.rowIds:s.map(g=>g.id),c=a&&gU(t.structure.sections,l)?t.structure:{rowIds:d,sections:l},f=e.derive.hasSettledAssistantMessage(e.timelineEntries,e.status.latestAssistantMessageId),p=t.meta.status===e.status&&t.meta.usageByTurnId===e.usageByTurnId&&t.meta.exportApi===e.exportApi&&t.meta.finalAssistantMessageReceived===f?t.meta:{status:e.status,usageByTurnId:e.usageByTurnId,exportApi:e.exportApi,finalAssistantMessageReceived:f},m=o.size>0||c!==t.structure||p!==t.meta;return{inputs:e,structure:c,indexById:i,rows:s,meta:p,version:m?t.version+1:t.version}}function vU(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]!==t[n].id)return!1;return!0}function ZI(){let e=null,t=null,n=mU,o=new Set,r=0,a=new Set,i=new Map,s=()=>{if(e===null||n.inputs===e)return n;t??=e.derive.createRowsCache();let l=new Set;n=hU(e,n,t,l);for(let d of l)o.add(d);return n};return{setInputs(l){e=l},hasInputs:()=>e!==null,flush(){if(a.size===0&&i.size===0||e===null)return;let{version:l}=s();if(l===r&&o.size===0)return;r=l;let d=[...o];o.clear();for(let c of d){let f=i.get(c);if(f!==void 0)for(let p of Array.from(f))p()}for(let c of Array.from(a))c()},subscribe(l){return a.add(l),()=>{a.delete(l)}},subscribeRow(l,d){let c=i.get(l);return c===void 0&&(c=new Set,i.set(l,c)),c.add(d),()=>{c.delete(d),c.size===0&&i.get(l)===c&&i.delete(l)}},getStructure:()=>s().structure,getRow(l){let{indexById:d,rows:c}=s(),f=d.get(l);return f===void 0?void 0:c[f]},getRows:()=>s().rows,getMeta:()=>s().meta,getVersion:()=>s().version}}ue();var yU=new Set;function e0({data:e,target:t,threadKey:n,visible:o,rowsStore:r,derive:a,resolveModelBadge:i,disclosure:s,historyWindow:l}){let d=e.useChatTimeline({target:t,threadKey:n,visible:o}),c=e.useTurnStatus({target:t,threadKey:n,visible:o}),f=ea(),p=s.usePersistedExpandedTurnIds(n),[m,g]=ln("timeline-auto-expanded-turns",n,yU),h=K(()=>a.resolveExpandedTurnIds(p??[],m),[m,a,p]),{latestTurn:v}=c,y=Rt("timeline-latest-turn-previous",n,v);W(()=>{let C=y.current;if(y.current=v,!(!v||C?.turnId===void 0)){if(v.turnId===C.turnId){C.state==="running"&&v.state==="interrupted"&&g(w=>{let L=new Set(w);return L.add(v.turnId),L});return}g(w=>{if(!w.has(C.turnId))return w;let L=new Set(w);return L.delete(C.turnId),L})}},[v]);let x=K(()=>({derive:a,timelineEntries:d.timelineEntries,activities:d.activities,status:c,expandedTurnIds:h,resolveModelBadge:i,historyWindow:l,usageByTurnId:d.usageByTurnId,exportApi:d.export}),[d.activities,d.export,d.timelineEntries,d.usageByTurnId,a,h,l,i,c]);return(f||!r.hasInputs())&&r.setInputs(x),he(()=>{r.flush()}),null}var t0=pe(function({data:t,target:n,threadKey:o,visible:r,...a}){let i=Rt("timeline-rows-store",o,null,3);i.current??=ZI();let s=i.current;return b(Le,{children:[u(e0,{data:t,target:n,threadKey:o,visible:r,rowsStore:s,derive:a.derive,resolveModelBadge:a.resolveModelBadge,disclosure:a.disclosure,historyWindow:(a.loadLater??null)!==null}),u(QI,{...a,threadKey:o,rowsStore:s,SiteIcon:t.SiteIcon})]})});ue();function n0(e){return e==="loading"?"threadSync.loading":"threadSync.syncing"}var xU=1e3;function o0(e,t=xU){let[n,o]=J(null);return W(()=>{if(e===null){o(null);return}let r=globalThis.setTimeout(()=>{o(e)},t);return()=>{globalThis.clearTimeout(r)}},[e,t]),n}function r0({phase:e}){let{t}=Ce(),n=t(n0(e));return b("div",{"aria-label":n,className:"pointer-events-none flex items-center gap-2 rounded-full border border-border/60 bg-background/90 px-3 py-1 text-xs font-medium text-foreground shadow-sm backdrop-blur","data-thread-sync-pill":"true",role:"status",children:[u(si,{"aria-hidden":!0,className:"size-icon-2 shrink-0 text-muted-foreground"}),u("span",{className:"truncate",children:n})]})}function a0({data:e,target:t,bottomInset:n,showScrollToEnd:o,onScrollToEnd:r}){let{t:a}=Ce(),i=o0(e.useThreadSyncPhase(t));return i===null&&!o?null:b("div",{className:"pointer-events-none absolute left-1/2 z-30 flex -translate-x-1/2 flex-col items-center gap-1.5 py-1.5",style:{bottom:n+4},children:[i!==null?u(r0,{phase:i}):null,o?b(ce,{onClick:r,className:"pointer-events-auto gap-1.5 rounded-full px-3 text-muted-foreground hover:text-foreground",size:"xs",variant:"glass",children:[u(sn,{}),a("timeline.scrollToEnd")]}):null]})}ue();function i0(){let e=!1;return{lock:()=>{e=!0},resume:()=>{e=!1},navigate:t=>!t||!e?!1:(e=!1,!0),isLocked:()=>e}}function s0(e){return e.requestedGeneration===e.currentGeneration&&e.mode==="following-end"&&!e.readingLocked}var CU=150,bU=16;function l0(e,t){typeof e=="function"?e(t):e&&(e.current=t)}function d0({inputKey:e,visible:t,endInset:n,derive:o,onReturnToLatest:r,controlRef:a}){let[i,s]=ln("timeline-live-follow-enabled",e,!0),[l,d]=ln("timeline-show-scroll-to-end",e,!1),c=Pr(e,null),[f,p]=eI(e,null),m=R(G=>{c.current=G;let te=G?.node??null;p(me=>me===te?me:te)},[c,p]),g=Rt("timeline-is-at-end",e,!0),h=Pr(e,null),v=R(()=>{h.current!==null&&clearTimeout(h.current),h.current=null},[h]),y=R(()=>{v(),h.current=setTimeout(()=>{h.current=null,d(!0)},CU)},[v,d,h]);W(()=>v,[v]);let x=R(()=>{let G=c.current?.measure();return G==null?void 0:{contentLength:G.contentLength,scroll:G.scroll,scrollLength:G.scrollLength}},[c]),C=Rt("timeline-scroll-mode",e,"following-end"),w=pi(t);he(()=>()=>w.cancel(),[w,e]);let L=Rt("timeline-user-scroll-generation",e,0),S=Rt("timeline-live-follow-generation",e,0),k=Rt("timeline-disclosure-reading-lock",e,i0),I=Rt("timeline-last-row-id",e,null),T=R(()=>{w.cancel(),L.current+=1,C.current="free-scrolling",S.current=null,s(!1)},[w,S,C,s,L]),A=R(()=>{k.current.lock(),T(),g.current=!1,v(),d(!0)},[v,g,T,k,d]),P=N(T);P.current=T;let _=R(()=>{let G=c.current?.measure(),te=I.current;if(!G||te===null)return!1;let me=qI(G,te);return me===null?!1:me>Math.max(0,G.scrollLength-n-bU)},[n,c,I]),E=R(G=>{k.current.resume();let te=++L.current;g.current=!0,C.current="following-end",S.current=L.current,s(!0),v(),d(!1),w.request(()=>{s0({requestedGeneration:te,currentGeneration:L.current,mode:C.current,readingLocked:k.current.isLocked()})&&c.current?.scrollToEnd({animated:G})})},[v,w,c,g,S,k,C,s,d,L]),F=N(r);F.current=r;let B=R((G=!1)=>{let te=F.current;if(te){te(()=>E(G));return}E(G)},[E]),V=R(()=>B(!0),[B]),Q=R(()=>{k.current.navigate(!0)&&(g.current=!1,o.resolveIsAtEnd(x(),n)===!0&&B())},[o,n,g,x,k,B]);W(()=>{if(!t||f===null)return;let G=null,te=requestAnimationFrame(()=>{let me=()=>{P.current()},U=ae=>{let oe=ae instanceof Element?ae:null;for(;oe&&oe!==f;){if(oe instanceof HTMLElement&&oe.scrollHeight>oe.clientHeight+1&&oe.scrollTop+oe.clientHeight<oe.scrollHeight-1&&/auto|scroll/u.test(getComputedStyle(oe).overflowY))return!1;oe=oe.parentElement}return oe===f},Y=ae=>{k.current.isLocked()&&U(ae)&&Q()},se=null,ge=!1,ie=f.scrollTop,Ae=ae=>{se=ae.touches[0]?.clientY??null},Xe=()=>{se=null,ge=!1},nt=()=>{let ae=f.scrollTop;ge&&ae>ie&&Y(f),ie=ae},rt=()=>_(),Ve=()=>o.resolveIsAtEnd(x(),n)===!1,ne=ae=>{ae.deltaY>0&&Y(ae.target),ae.deltaY<0&&rt()&&me()},we=ae=>{let oe=ae.touches[0]?.clientY??null,ft=se!==null&&oe!==null&&oe<se;se=oe,Ve()&&me(),ft&&Y(ae.target)},j=ae=>{if(ae.target===f){ge=!0,ie=f.scrollTop,rt()&&me();return}Ve()&&me()},X=ae=>{if(!(ae.target instanceof Element?ae.target:null)?.closest("input, textarea, select, [contenteditable='true'], button, [role='button']"))switch(ae.key){case"PageUp":case"Home":case"ArrowUp":rt()&&me();break;case"PageDown":case"End":case"ArrowDown":Y(ae.target);break;case" ":ae.shiftKey||Y(ae.target);break;default:break}};f.addEventListener("wheel",ne,{passive:!0}),f.addEventListener("touchmove",we,{passive:!0}),f.addEventListener("touchstart",Ae,{passive:!0}),f.addEventListener("touchend",Xe,{passive:!0}),f.addEventListener("touchcancel",Xe,{passive:!0}),f.addEventListener("scroll",nt,{passive:!0}),window.addEventListener("pointerup",Xe,{passive:!0}),window.addEventListener("pointercancel",Xe,{passive:!0}),f.addEventListener("pointerdown",j,{passive:!0}),f.addEventListener("keydown",X),G=()=>{f.removeEventListener("wheel",ne),f.removeEventListener("touchmove",we),f.removeEventListener("touchstart",Ae),f.removeEventListener("touchend",Xe),f.removeEventListener("touchcancel",Xe),f.removeEventListener("scroll",nt),window.removeEventListener("pointerup",Xe),window.removeEventListener("pointercancel",Xe),f.removeEventListener("pointerdown",j),f.removeEventListener("keydown",X)}});return()=>{cancelAnimationFrame(te),G?.()}},[_,o,n,e,x,k,Q,f,t]);let Se=R(G=>{I.current=G},[I]),H=R(G=>{if(k.current.isLocked()){g.current=!1,v(),d(!0);return}if(!G&&S.current===L.current){v(),d(!1);return}g.current!==G&&(g.current=G,G?(C.current="following-end",S.current=L.current,s(!0),v(),d(!1)):(C.current="free-scrolling",S.current=null,y()))},[v,g,S,k,y,C,s,d,L]),q=N(B);q.current=B;let ee=K(()=>({followEnd:G=>q.current(G?.animated??!1)}),[]);return he(()=>(l0(a,ee),()=>l0(a,null)),[ee,a]),{liveFollowEnabled:i,showScrollToEnd:l,bindTimelineHandle:m,onRowsChange:Se,onIsAtEndChange:H,onManualNavigation:T,onDisclosureNavigation:A,returnToEnd:V}}ue();ue();var c0=["user-message","assistant-message","reasoning","tool-call","approval","user-input","compaction","retry","session","turn-intent","scheduled-wake","communication","delegation","task","event"];var u0=50,wU=32,Jh=class extends Sa{getSnapshotBeforeUpdate(t){return(t.inputKey!==this.props.inputKey||t.rows!==this.props.rows||t.expandedRows!==this.props.expandedRows||t.visible&&!this.props.visible)&&t.capture(),null}componentDidUpdate(){}componentWillUnmount(){this.props.capture()}render(){return this.props.children}};function f0(e){let t=e.getBoundingClientRect();if(e.clientHeight<=0||t.height<=0)return[];let n=e.querySelector("thead"),o=t.top+(n?.getBoundingClientRect().height??0),r=e.querySelectorAll("[data-trajectory-chunk]"),a=fs(r,o),i=[];if(a<0)return i;for(let s=a;s<r.length;s+=1){let l=r[s];if(l.getBoundingClientRect().top>=t.bottom)break;let d=l.querySelectorAll("[data-timeline-row-id]"),c=fs(d,o);if(!(c<0))for(let f=c;f<d.length;f++){let p=d[f];if(p.getBoundingClientRect().top>=t.bottom)break;i.push(p)}}return i}function SU(e){let t=[];for(let n=0;n<e.length;n+=u0)t.push(e.slice(n,n+u0));return t}function IU({useToolCallDetail:e,threadRef:t,toolCallId:n,turnId:o,fallback:r,revision:a}){let i=e===void 0?null:e({threadRef:t,toolCallId:n,turnId:o??null,revision:a??r??"initial"}),s=i===null?[]:[i.input,i.output].filter(d=>d!==void 0&&d.length>0),l=i?.input!==void 0&&i?.output!==void 0?s.join(`
|
|
3752
|
+
`):null,contexts:o}}function vI(e){let t=e.terminalLabel.trim().toLowerCase().replace(/\s+/g,"-"),n=e.lineStart===e.lineEnd?`${e.lineStart}`:`${e.lineStart}-${e.lineEnd}`;return`@${t}:${n}`}function Hh(e){let t=bc(e),n=iz(t.promptText);return{visibleText:n.promptText,copyText:e,contextCount:n.contextCount,previewTitle:n.previewTitle,contexts:n.contexts,elementContexts:t.contexts}}var sz=/^(.*?)\s+line(?:s)?\s+(\d+)(?:-(\d+))?$/i;function yI(e){let t=[];for(let n of e){let o=n.header.trim();o.length>0&&t.push(np(o))}return t.join(" ")}function np(e){let t=e.trim(),n=sz.exec(t);if(!n)return`@${t.toLowerCase().replace(/\s+/g,"-")}`;let o=Number.parseInt(n[2]??"",10),r=Number.parseInt(n[3]??n[2]??"",10);return!Number.isFinite(o)||!Number.isFinite(r)?`@${t.toLowerCase().replace(/\s+/g,"-")}`:vI({terminalLabel:n[1]?.trim()||"terminal",lineStart:o,lineEnd:r})}function xI(e,t){let n=0;for(let o of t){let r=np(o.header),a=e.indexOf(r,n);if(a===-1)return!1;n=a+r.length}return!0}function $h({row:e}){let t=wt(cn).derive;if(Jf(e.message.text)){let n=t.parsePresetPrefixText(e.message.text);return n?b(Pe,{children:[u(cz,{parsed:n}),n.body.length>0||(e.message.attachments?.length??0)>0?u($h,{row:{...e,message:{...e.message,text:n.body}}}):null]}):u(fz,{row:e})}return u(lz,{row:e,text:e.message.text})}function Kh({images:e}){let t=wt(cn),{t:n}=ut();return e.length===0?null:u("div",{className:"mb-2 grid max-w-[420px] grid-cols-2 gap-2",children:e.map(o=>u("div",{className:"overflow-hidden rounded-lg border border-border/80 bg-background/70",children:o.previewUrl?u("button",{type:"button",className:"h-full w-full cursor-zoom-in","aria-label":n("attachments.preview",{name:o.name}),onClick:()=>{let r=Fh(e,o.id);r&&t.onImageExpand(r)},children:u("img",{src:o.previewUrl,alt:o.name,className:"block h-auto max-h-[220px] w-full object-cover"})}):u("div",{className:"flex min-h-[72px] items-center justify-center px-2 py-3 text-center text-secondary-label text-chat-dense",children:o.name})},o.id))})}function lz({row:e,text:t}){let{t:n}=ut(),o=wt(cn),r=e.message.attachments??[],a=Hh(t),i=a.contexts,s=[],l=a.visibleText;for(;;){let v=zh(l);if(!v.annotation)break;s.unshift(v.annotation),l=v.promptText}let d=bc(l),c=[...a.elementContexts,...d.contexts],f=r.filter(v=>v.name.startsWith("preview-annotation-")),p=r.filter(v=>!v.name.startsWith("preview-annotation-")),m=p.filter(v=>gi(v)==="image"),g=p.filter(v=>gi(v)!=="image"),h=e.message.author??null;return b("div",{className:"group flex min-w-0 items-start gap-2.5",children:[u(dz,{author:h}),b("div",{className:"min-w-0 flex-1 space-y-2",children:[b("div",{className:"flex min-h-7 min-w-0 flex-wrap items-center gap-x-2 gap-y-1 text-chat-dense",children:[u("span",{className:"min-w-0 truncate font-medium text-foreground",children:h?.displayName??n("message.user")}),b(Ye,{children:[u(Ze,{render:u("span",{className:"text-muted-foreground tabular-nums"}),children:pi(e.message.createdAt,o.timestampFormat,n)}),u(Je,{children:ra(e.message.createdAt,o.timestampFormat)})]}),b("div",{className:"ms-auto flex items-center gap-0.5",children:[o.onForkFromUserMessage!==null&&u(pz,{messageId:e.message.id,onFork:o.onForkFromUserMessage}),a.copyText&&u(kl,{text:a.copyText,variant:"ghost"})]})]}),b("div",{className:"relative min-w-0 rounded-lg border border-border/60 bg-message px-3 py-2.5 text-message-foreground",children:[u(Kh,{images:m}),g.length>0&&u("div",{className:"mb-2 flex max-w-[420px] flex-col gap-1.5",children:g.map(v=>u(Vh,{attachment:v},v.id))}),s.map((v,y)=>u(hz,{annotation:v,image:f[y]??null},v.id)),c.length>0?u("div",{className:"mb-2 flex flex-wrap gap-1.5",children:c.map(v=>u(gz,{context:v},`${v.header}:${v.body}`))}):null,u(bz,{disclosureKey:`message:${e.message.id}:user`,text:d.promptText,terminalContexts:i,skills:o.skills,markdownCwd:o.markdownCwd})]})]})]})}function dz({author:e}){let t=e;return t!==null?u(Vw,{userId:t.userId,displayName:t.displayName,size:28,className:"mt-0.5"}):u("span",{"aria-hidden":!0,className:"mt-0.5 flex size-7 shrink-0 items-center justify-center rounded-full bg-message text-secondary-label",children:u(oa,{className:"size-4"})})}function op({children:e}){return u("div",{className:"flex justify-center py-1",children:u("div",{className:"max-w-[80%] rounded-lg border border-border/60 bg-muted/30 px-3 py-2 text-chat-row text-muted-foreground",children:e})})}function cz({parsed:e}){let{t}=ut();return b(op,{children:[u("p",{className:"font-medium text-foreground/80",children:t("preset.systemBlockTitle",{name:e.presetId})}),e.prefix.trim().length>0?u("p",{className:"mt-1 whitespace-pre-wrap",children:e.prefix}):null]})}var uz={"child.settled":"childThread.notification.settled","child.failed":"childThread.notification.failed","child.approval":"childThread.notification.approval","child.stopped":"childThread.notification.stopped","plugin.notice":"childThread.notification.pluginNotice","selfdev.resolved":"childThread.notification.selfdevResolved"};function fz({row:e}){let{t}=ut(),n=wt(cn).derive,o=e.message.attachments??[],r=o.filter(l=>gi(l)==="image"),a=o.filter(l=>gi(l)!=="image"),i=l=>{let d=lI(l);if(d)return b(op,{children:[u("p",{className:"font-medium text-foreground/80",children:d.title}),d.body.length>0?u("p",{className:"mt-1 whitespace-pre-wrap",children:d.body}):null]});let c=n.parseThreadHandoverText(l);if(c)return b(op,{children:[u("p",{className:"font-medium text-foreground/80",children:t("continuation.systemBlockTitle")}),u("p",{className:"mt-1",children:t("continuation.systemBlockTurns",{count:c.includedTurns})}),u("p",{className:"mt-1 whitespace-pre-wrap",children:c.body})]});let f=n.parseSystemNotificationText(l);return f?b(op,{children:[u("p",{className:"font-medium text-foreground/80",children:t(uz[f.kind],{title:f.title})}),f.summary.trim().length>0?u("p",{className:"mt-1 whitespace-pre-wrap",children:f.summary}):null]}):null},s=sI(e.message.text).map(i).filter(l=>l!==null);return s.length===0&&o.length===0?null:b(Pe,{children:[s.map((l,d)=>u(ni,{children:l},d)),o.length>0?b("div",{className:"min-w-0 px-3 py-2",children:[u(Kh,{images:r}),a.map(l=>u(Vh,{attachment:l},l.id))]}):null]})}function wI(e,t){let n=t.parsePresetPrefixText(e??"")?.body??null;if(n===null&&Jf(e??""))return null;let r=Hh(n??e??"").visibleText;for(;;){let s=zh(r);if(!s.annotation)break;r=s.promptText}let a=bc(r).promptText,i=Uh(a).map(s=>s.kind==="text"?s.text:s.comment.text).join(" ").replace(/\s+/g," ").trim();return i.length>0?i:null}var SI=34,II=8,rp=SI+II,TI=pe(function({ref:t,textRef:n,initialText:o,expanded:r,onToggleExpanded:a}){let{t:i}=ut(),s=i(r?"timeline.pinnedTurnHeaderShowLess":"timeline.pinnedTurnHeaderShowMore");return u("div",{ref:t,className:"group pointer-events-none absolute inset-x-0 top-0 z-10 px-3 sm:px-5",style:{paddingTop:II},"data-timeline-turn-header":"true","data-truncated":"false",children:b("div",{className:$("transcript-col-wide pointer-events-auto flex gap-2 rounded-sm border border-border/70 bg-background pe-1 ps-3 shadow-md shadow-black/10",r?"items-start py-1.5":"items-center"),...r?{}:{style:{height:SI}},children:[u("span",{ref:n,className:$("min-w-0 flex-1 text-foreground/85 text-chat",r?"max-h-40 overflow-y-auto whitespace-pre-wrap":"truncate"),children:o}),b(Ye,{children:[u(Ze,{render:u(ce,{type:"button",size:"xs",variant:"ghost",className:"group-data-[truncated=false]:hidden","aria-label":s,onClick:a}),children:r?u(Bd,{}):u(an,{})}),u(Je,{side:"bottom",children:s})]})]})})});function pz({messageId:e,onFork:t}){let{t:n}=ut(),o=n("fork.action");return b(Ye,{children:[u(Ze,{render:u(ce,{type:"button",size:"xs",variant:"ghost",onClick:()=>t(e),"aria-label":o}),children:u(Vd,{className:"size-3"})}),u(Je,{side:"top",children:o})]})}function kI({row:e}){let t=wt(cn),{t:n}=ut(),[o,r]=Wo(t.threadKey,`message:${e.message.id}`,!1);if(e.presentation==="compact"&&!o)return u(Xf,{state:"idle",children:b("button",{type:"button",className:$(Qf,"chat-process-text cursor-pointer text-secondary-label hover:bg-accent/20"),"aria-expanded":!1,"aria-label":n("timeline.expandMessage"),onClick:()=>{t.onProcessDisclosureChange?.(e.id),r(!0)},children:[u(hc,{status:null}),u(gc,{children:u(rc,{className:"size-icon-1","aria-hidden":!0})}),u("span",{className:"min-w-0 flex-1 truncate",children:t.derive.reasoningPreviewText(e.message.text)}),u(an,{className:"size-icon-1 shrink-0 -rotate-90","aria-hidden":!0})]})});let i=e.message.attachments??[],s=i.filter(c=>gi(c)==="image"),l=i.filter(c=>gi(c)!=="image"),d=e.message.text||(e.message.streaming||i.length>0?"":n("timeline.emptyResponse"));return u(Pe,{children:b("div",{className:"relative min-w-0 px-1 py-0.5","data-assistant-text-tone":e.textTone==="process"&&e.presentation!=="compact"?"process":"primary",children:[e.presentation==="compact"?b("div",{className:"mb-1 flex items-center gap-2",children:[u("button",{type:"button",className:"chat-process-meta mb-1 rounded-sm text-secondary-label","aria-expanded":!0,onClick:()=>{t.onProcessDisclosureChange?.(e.id),r(!1)},children:n("timeline.collapseMessage")}),e.copyInFooter?null:u(kl,{text:e.message.text,variant:"ghost"})]}):null,e.modelBadge?u(qh,{badge:e.modelBadge,createdAt:e.message.createdAt}):null,u(dr,{disclosureKey:`message:${e.message.id}:assistant`,text:d,className:e.textTone==="process"&&e.presentation!=="compact"?"chat-commentary":"chat-readable-body",cwd:t.markdownCwd,threadRef:t.threadRef??void 0,isStreaming:!!e.message.streaming,lineBreaks:t.derive.shouldPreserveAssistantLineBreaks(d),skills:t.skills}),u(Kh,{images:s}),l.length>0&&u("div",{className:"mb-2 flex max-w-[420px] flex-col gap-1.5",children:l.map(c=>u(Vh,{attachment:c},c.id))}),e.showAssistantMeta||e.showAssistantCopyButton&&!e.assistantCopyStreaming&&e.message.text.trim().length>0?b("div",{className:"mt-1.5 flex items-center gap-2 text-chat-row tabular-nums opacity-0 transition-opacity duration-(--control-duration) focus-within:opacity-100 group-hover/assistant:opacity-100",children:[u(mz,{row:e}),e.showAssistantMeta&&!e.message.streaming&&e.modelBadge===null&&b(Ye,{children:[u(Ze,{render:u("p",{className:"text-muted-foreground text-chat-row tabular-nums"}),children:pi(e.message.updatedAt,t.timestampFormat,n)}),u(Je,{children:ra(e.message.updatedAt,t.timestampFormat)})]})]}):null]})})}function mz({row:e}){let n=wt(cn).derive.resolveAssistantMessageCopyState({text:e.message.text??null,showCopyButton:e.showAssistantCopyButton,streaming:e.assistantCopyStreaming});return n.visible?u(kl,{text:n.text??"",variant:"ghost"}):null}var CI=pe(function(t){let n=t.context.body.length>0?`${t.context.header}
|
|
3753
|
+
${t.context.body}`:t.context.header;return u(hI,{label:t.context.header,tooltipText:n})}),gz=pe(function(t){let n=t.context.body?`${t.context.header}
|
|
3754
|
+
${t.context.body}`:t.context.header;return b(Ye,{children:[b(Ze,{render:u("span",{className:"inline-flex max-w-full items-center gap-1 rounded-md border border-border/70 bg-background/70 px-1.5 py-0.5 text-foreground/85 text-chat-row"}),children:[u(ta,{className:"size-3 shrink-0"}),u("span",{className:"truncate",children:t.context.header})]}),u(Je,{side:"top",className:"max-w-96 whitespace-pre-wrap leading-tight",children:n})]})});function Vh(e){let{t}=ut(),n=gi(e.attachment),o=dI(n),r=t("attachments.open",{name:e.attachment.name}),a=b(Pe,{children:[u(o,{className:"size-4 shrink-0 text-secondary-label"}),b("span",{className:"min-w-0 flex-1",children:[u("span",{className:"block truncate font-medium text-foreground text-chat-row",children:e.attachment.name}),u("span",{className:"block text-secondary-label text-chat-meta",children:iI(e.attachment.sizeBytes)})]})]}),i=e.attachment.previewUrl?cI(e.attachment):null;return e.attachment.previewUrl&&i!==null?b("div",{className:"flex max-w-sm flex-col gap-2 rounded-sm border border-border/70 bg-background/70 px-2.5 py-2",children:[u("a",{href:e.attachment.previewUrl,target:"_blank",rel:"noreferrer","aria-label":r,className:"flex items-center gap-2 hover:underline",children:a}),i==="video"?u("video",{src:e.attachment.previewUrl,"aria-label":e.attachment.name,controls:!0,playsInline:!0,preload:"metadata",className:"aspect-video w-full rounded-sm bg-black"}):u("audio",{src:e.attachment.previewUrl,"aria-label":e.attachment.name,controls:!0,preload:"metadata",className:"h-10 w-full"})]}):e.attachment.previewUrl?u("a",{href:e.attachment.previewUrl,target:"_blank",rel:"noreferrer","aria-label":r,className:"flex items-center gap-2 rounded-sm border border-border/70 bg-background/70 px-2.5 py-2 hover:bg-background/90",children:a}):u("div",{className:"flex items-center gap-2 rounded-sm border border-border/70 bg-background/70 px-2.5 py-2",children:a})}function hz(e){let t=wt(cn),{t:n}=ut();return b("div",{className:"mb-2 flex max-w-full items-center overflow-hidden rounded-lg border border-border/70 bg-background/70",children:[e.image?.previewUrl?u("button",{type:"button",className:"size-14 shrink-0 cursor-zoom-in overflow-hidden border-r border-border/70 bg-muted","aria-label":n("attachments.preview",{name:e.image.name}),onClick:()=>{if(!e.image)return;let o=Fh([e.image],e.image.id);o&&t.onImageExpand(o)},children:u("img",{src:e.image.previewUrl,alt:n("previewAnnotation.cropAlt"),className:"size-full object-cover"})}):null,b("div",{className:"min-w-0 px-2.5 py-2",children:[e.annotation.comment?u("div",{className:"max-w-80 truncate text-foreground text-chat-row font-medium",children:e.annotation.comment}):null,b("div",{className:$("flex items-center gap-2 text-secondary-label text-chat-meta",e.annotation.comment&&"mt-1"),children:[e.annotation.targetSummary?u("span",{className:"truncate",children:e.annotation.targetSummary}):null,e.annotation.styleChanges.length>0?b("span",{className:"inline-flex shrink-0 items-center gap-1",children:[u(os,{className:"size-3"}),e.annotation.styleChanges.length]}):null]})]})]})}var vz=8,yz=600,xz=1.75,bI=`linear-gradient(to bottom, black calc(100% - ${xz}rem), transparent)`;function Cz(e){return e.trim().length===0?!1:e.length>yz||e.split(`
|
|
3755
|
+
`).length>vz}var bz=pe(function(t){let n=wt(cn),{t:o}=ut(),[r,a]=Wo(n.threadKey,`${t.disclosureKey}:expanded`,!1),i=t.text.trim().length>0||t.terminalContexts.length>0,s=i&&Cz(t.text),l=s&&!r;return b("div",{children:[i?u("div",{className:$("relative",l&&"max-h-44 overflow-hidden"),"data-user-message-body":"true","data-user-message-collapsed":l?"true":"false","data-user-message-collapsible":s?"true":"false","data-user-message-fade":l?"true":"false",style:l?{WebkitMaskImage:bI,maskImage:bI}:void 0,children:u(wz,{disclosureKey:t.disclosureKey,text:t.text,terminalContexts:t.terminalContexts,skills:t.skills,markdownCwd:t.markdownCwd})}):null,s||t.footer?b("div",{className:$("mt-1.5 flex items-center gap-2",s&&t.footer?"justify-between":"justify-end"),"data-user-message-footer":"true",children:[s?u(ce,{type:"button",size:"xs",variant:"ghost","aria-expanded":r,"data-scroll-anchor-ignore":!0,onClick:()=>a(!r),className:"-ml-1 h-6 rounded-control-2 px-1.5 text-secondary-label text-chat-row hover:bg-muted/40 hover:text-message-foreground",children:o(r?"timeline.showLess":"timeline.expandMessage")}):null,t.footer?u("div",{className:"ml-auto flex items-center gap-2",children:t.footer}):null]}):null]})}),wz=pe(function(t){let n=wt(cn),o=(a,i)=>{let s=/^\s+/.exec(a)?.[0]??"",l=a.slice(s.length),d=/\s+$/.exec(l)?.[0]??"",c=l.slice(0,l.length-d.length);return b(ni,{children:[s?u("span",{"aria-hidden":"true",children:s}):null,c?u(dr,{disclosureKey:`${t.disclosureKey}:inline:${i}`,text:c,cwd:t.markdownCwd,threadRef:n.threadRef??void 0,skills:t.skills,className:"text-message-foreground",lineBreaks:!0,parseRawHtml:!1}):null,d?u("span",{"aria-hidden":"true",children:d}):null]},i)},r=Uh(t.text);if(r.some(a=>a.kind==="review-comment"))return u("div",{className:"space-y-3 text-message-foreground text-chat",children:r.map(a=>a.kind==="text"?a.text.trim().length>0?u("div",{className:"wrap-break-word",children:u(dr,{disclosureKey:`${t.disclosureKey}:review:${a.id}`,text:a.text.trim(),cwd:t.markdownCwd,threadRef:n.threadRef??void 0,skills:t.skills,className:"text-message-foreground",lineBreaks:!0,parseRawHtml:!1})},a.id):null:u(Sz,{comment:a.comment,disclosureKey:`${t.disclosureKey}:review-comment:${a.comment.id}`},a.comment.id))});if(t.terminalContexts.length>0){let a=xI(t.text,t.terminalContexts),i=yI(t.terminalContexts),s=[];if(a){let l=0;for(let d of t.terminalContexts){let c=np(d.header),f=t.text.indexOf(c,l);if(f===-1){s.length=0;break}f>l&&s.push(o(t.text.slice(l,f),`user-terminal-context-inline-before:${d.header}:${l}`)),s.push(u(CI,{context:d},`user-terminal-context-inline:${d.header}`)),l=f+c.length}if(s.length>0)return l<t.text.length&&s.push(o(t.text.slice(l),`user-message-terminal-context-inline-rest:${l}`)),u("div",{className:"whitespace-pre-wrap wrap-break-word text-message-foreground text-chat",children:s})}for(let l of t.terminalContexts)s.push(u(CI,{context:l},`user-terminal-context-inline:${l.header}`)),s.push(u("span",{"aria-hidden":"true",children:" "},`user-terminal-context-inline-space:${l.header}`));if(t.text.length>0)s.push(u(dr,{disclosureKey:`${t.disclosureKey}:terminal-main`,text:t.text,cwd:t.markdownCwd,threadRef:n.threadRef??void 0,skills:t.skills,className:"text-message-foreground",lineBreaks:!0,parseRawHtml:!1},"user-message-terminal-context-inline-text"));else if(i.length===0)return null;return u("div",{className:"whitespace-pre-wrap wrap-break-word text-message-foreground text-chat",children:s})}return t.text.length===0?null:u(dr,{disclosureKey:`${t.disclosureKey}:body`,text:t.text,cwd:t.markdownCwd,threadRef:n.threadRef??void 0,skills:t.skills,className:"text-message-foreground",lineBreaks:!0,parseRawHtml:!1})});function Sz({comment:e,disclosureKey:t}){let n=wt(cn),{t:o}=ut(),r=e.fenceLanguage??"diff",a=pI(e);return b("div",{className:"space-y-2 rounded-lg border border-border/70 bg-background/70 p-3",children:[b("div",{className:"space-y-1",children:[u("div",{className:"text-message-foreground text-chat-row font-medium",children:jf(e.filePath,n.workspaceRoot)}),b("div",{className:"text-secondary-label text-chat-dense",children:[e.sectionTitle??o("timeline.reviewCommentDefaultSection")," \xB7"," ",e.rangeLabel??o("timeline.reviewCommentDefaultRange")]})]}),e.text.length>0&&u("div",{className:"whitespace-pre-wrap wrap-break-word text-chat",children:u(gI,{text:e.text,skills:n.skills})}),r!=="diff"&&e.diff.trim().length>0&&u(dr,{disclosureKey:`${t}:fence`,text:fI(r,e.diff),cwd:n.markdownCwd,threadRef:n.threadRef??void 0,skills:n.skills,className:"text-message-foreground"}),a?u(gS,{patch:a}):null]})}function Iz({badge:e}){return b(Pe,{children:[e.driverKind?u("span",{className:"flex size-7 shrink-0 items-center justify-center rounded-lg border border-border/60 bg-card","aria-label":e.providerDisplayName??void 0,children:u(Tr,{driver:e.driverKind,displayName:e.providerDisplayName,accentColor:e.accentColor,className:"size-5",iconClassName:"size-4"})}):null,b("span",{className:"flex min-w-0 flex-wrap items-baseline gap-x-2 gap-y-0.5",children:[e.driverKind?u("span",{className:"font-medium text-foreground",children:e.providerDisplayName}):null,u("span",{className:"min-w-0 truncate text-muted-foreground",children:e.modelLabel}),e.effortLabel?b("span",{children:[" \xB7 ",e.effortLabel]}):null]})]})}function qh({badge:e,createdAt:t}){let n=wt(cn),{t:o}=ut();return b("div",{className:"mb-3 flex min-w-0 flex-wrap items-center gap-x-2.5 gap-y-1 text-chat-dense text-muted-foreground","data-testid":"assistant-model-header",children:[u(Iz,{badge:e}),u("span",{"aria-hidden":!0,children:"\xB7"}),b(Ye,{children:[u(Ze,{render:u("span",{className:"shrink-0 tabular-nums"}),children:pi(t,n.timestampFormat,o)}),u(Je,{children:ra(t,n.timestampFormat)})]})]})}function LI({row:e}){let{t}=ut(),n=e.badge.effortLabel?`${e.badge.modelLabel} \xB7 ${e.badge.effortLabel}`:e.badge.modelLabel,o=[e.badge.providerDisplayName,n].filter(a=>typeof a=="string"&&a.length>0).join(" \xB7 "),r=e.pending?t("timeline.modelSwitchPending",{model:o}):t("timeline.modelSwitched",{model:o});return b("div",{role:"separator","aria-label":r,"data-pending":e.pending?"true":void 0,className:"flex items-center gap-2 px-1 py-1 text-chat-dense text-muted-foreground/70",children:[u("span",{"aria-hidden":!0,className:"h-px min-w-4 flex-1 bg-border/60"}),b("span",{className:"flex min-w-0 shrink items-center gap-1.5",children:[e.badge.driverKind?u(Tr,{driver:e.badge.driverKind,displayName:e.badge.providerDisplayName,accentColor:e.badge.accentColor,className:"size-icon-1",iconClassName:"size-icon-1"}):null,u("span",{className:"truncate",children:r})]}),u("span",{"aria-hidden":!0,className:"h-px min-w-4 flex-1 bg-border/60"})]})}var Wh=240,Tz=/\s/u;function PI(e){if(!e)return null;let t=[],n=0,o=!1,r=()=>{for(;n>Wh-1;)n-=t.pop()?.length??0;for(;t.at(-1)===" ";)t.pop(),n-=1;return t.push("\u2026"),t.join("")};for(let a of e){if(Tz.test(a)){o=t.length>0;continue}if(o&&(t.push(" "),n+=1,o=!1,n>Wh)||(t.push(a),n+=a.length,n>Wh))return r()}return t.length>0?t.join(""):null}function kz(e,t,n){let o=t.find(i=>i.kind==="message"&&i.message.role==="user"),r=o?.kind==="message"?o.message:null,a=null;for(let i of t)i.kind==="message"&&i.message.role==="assistant"&&(a=i.message.text??null);return{id:e,sectionKey:e,anchorRowId:o?.id??t[0]?.id??e,userText:r===null?null:PI(n.parseSystemNotificationText(r.text)?.summary??n.parseThreadHandoverText(r.text)?.body??r.text),assistantText:PI(a),headerText:r===null?null:wI(r.text,n)}}function Lz(e){for(let t of e){let n=t.kind==="message"?t.message.turnId??null:t.kind==="turn-summary"?t.footer.turnId:null;if(n!==null)return n}return null}function Pz(e,t){return e.sectionKey===t.sectionKey&&e.anchorRowId===t.anchorRowId&&e.userText===t.userText&&e.assistantText===t.assistantText&&e.headerText===t.headerText&&e.turnId===t.turnId}function Az(e,t,n){for(let o=0;o<e.length;o+=1)if(e[o]!==n[t.firstRowIndex+o])return!1;return!0}function Ez(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]!==t[n])return!1;return!0}function Rz(e){let t=new Map,n=null;return o=>{let r=o.getVersion();if(n!==null&&n.store===o&&n.version===r)return n.entries;let a=new Map,i=[],s=o.getRows();for(let d of o.getStructure().sections){let c=t.get(d.key);if(c!==void 0&&c.rowIds===d.rowIds&&Az(c.rows,d,s)){a.set(d.key,c),i.push(c.entry);continue}let f=s.slice(d.firstRowIndex,d.firstRowIndex+d.rowIds.length),p=kz(d.key,f,e),m={...p,turnId:Lz(f)},g=c!==void 0&&Pz(c.entry.item,m)?c.entry:{summary:p,item:m};a.set(d.key,{rowIds:d.rowIds,rows:f,entry:g}),i.push(g)}t=a;let l=n!==null&&Ez(n.entries,i)?n.entries:i;return n={store:o,version:r,entries:l},l}}var AI=new WeakMap;function MI(e,t){let n=AI.get(e);return(n===void 0||n.derive!==t)&&(n={derive:t,read:Rz(t)},AI.set(e,n)),n.read(e)}var EI=new WeakMap;function NI(e,t){let n=MI(e,t),o=EI.get(n);return o===void 0&&(o=n.flatMap(({summary:r})=>r.headerText===null?[]:[{sectionKey:r.sectionKey,text:r.headerText}]),EI.set(n,o)),o}function _I(e,t){return e===t?!0:e.length!==t.length?!1:e.every((n,o)=>n.sectionKey===t[o].sectionKey&&n.text===t[o].text)}var RI=new WeakMap;function DI(e,t){let n=MI(e,t),o=RI.get(n);return o===void 0&&(o=n.filter(({summary:r})=>r.userText!==null).map(({item:r})=>r),RI.set(n,o)),o}function OI(e,t){return e===t?!0:e.length!==t.length?!1:e.every((n,o)=>n===t[o])}ue();var Mz=[],Nz=e=>e.getMeta().usageByTurnId,_z=e=>e.getMeta().exportApi,FI=pe(function({rowsStore:t,derive:n,paneVisible:o,totalTurnCount:r,bottomInset:a,onSelect:i,onTurnNavigatorChange:s}){let l=R(m=>o?DI(m,n):Mz,[n,o]),d=mi(t,l,OI),c=mi(t,Nz),f=mi(t,_z),p=K(()=>o?{items:d,totalTurnCount:r,bottomInset:a,usageByTurnId:c,onSelect:i,exportMarkdown:f.markdown,onDownload:f.download}:null,[a,f,d,i,o,r,c]);return W(()=>{p!==null&&s(p)},[s,p]),W(()=>{if(o)return()=>s(null)},[s,o]),null});ue();function BI(){let e=ir(),t=r=>r instanceof Error?r.message:void 0,n=(r,a)=>a!==void 0&&a.length>0?`${r}: ${a}`:r,o=(r,a,i)=>e.notify(r,a,i);return{error:(r,a,i)=>{let s=i?.description??t(a);o(n(r,s),"error",s)},warning:(r,a,i)=>{let s=i?.description??t(a);o(n(r,s),"warning",s)},success:(r,a,i)=>{let s=a??i?.description;o(n(r,s),"success",s)}}}function ap(e){let t=e.match(/^\s{0,3}#{1,6}\s+(.+)$/m)?.[1]?.trim();return t&&t.length>0?t:null}function Gh(e){let t=e.trimEnd().split(/\r?\n/),n=t[0]&&/^\s{0,3}#{1,6}\s+/.test(t[0])?t.slice(1):[...t];for(;n[0]?.trim().length===0;)n.shift();if(n[0]?.match(/^\s{0,3}#{1,6}\s+(.+)$/)?.[1]?.trim().toLowerCase()==="summary")for(n.shift();n[0]?.trim().length===0;)n.shift();return n.join(`
|
|
3756
|
+
`)}function zI(e,t,n){let o=n?.maxLines??8,r=Gh(e).trimEnd().split(/\r?\n/).map(l=>l.trimEnd()),a=[],i=0,s=!1;for(let l of r){let d=l.trim().length>0;if(d&&i>=o){s=!0;break}a.push(l),d&&(i+=1)}for(;a.length>0&&a.at(-1)?.trim().length===0;)a.pop();return a.length===0?ap(e)??t("proposedPlan.previewUnavailable"):(s&&a.push("","..."),a.join(`
|
|
3757
|
+
`))}function Dz(e){let t=e.toLowerCase().replace(/[`'".,!?()[\]{}]+/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"");return t.length>0?t:"plan"}function UI(e){let t=ap(e);return`${Dz(t??"plan")}.md`}function HI(e){return`${e.trimEnd()}
|
|
3758
|
+
`}function $I(e,t){let n=new Blob([t],{type:"text/markdown;charset=utf-8"}),o=URL.createObjectURL(n),r=document.createElement("a");r.href=o,r.download=e,r.click(),window.setTimeout(()=>{URL.revokeObjectURL(o)},0)}var ip=1024,KI=pe(function({planMarkdown:t,threadKey:n,rowId:o,environmentId:r,threadRef:a,cwd:i,workspaceRoot:s,onSavePlanToWorkspace:l}){let{t:d}=ut(),c=BI(),[f,p]=Wo(n,`proposed-plan:${o}:expanded`,!1),[m,g]=J(!1),[h,v]=Wo(n,`proposed-plan:${o}:save-path`,""),[y,x]=J(!1);Sf(o,m||y);let C=N(!1),w=N(!1);he(()=>(C.current=!0,()=>{C.current=!1}),[]);let{copyToClipboard:L,isCopied:S}=Wf({target:"plan",onError:H=>{c.error(d("proposedPlan.couldNotCopy"),H,{description:d("proposedPlan.copyErrorDescription")})}}),k=Jr(),I=ap(t)??d("proposedPlan.defaultTitle"),T=t.split(`
|
|
3759
|
+
`).length,A=t.length>900||T>20,P=Gh(t),_=A?zI(t,d,{maxLines:10}):null,E=UI(t),F=HI(t),B=()=>{$I(E,F)},V=()=>{L(F)},Q=()=>{if(!s){c.error(d("proposedPlan.workspacePathUnavailable"),d("proposedPlan.workspacePathUnavailableDescription"));return}h.length===0&&v(E.slice(0,ip)),g(!0)},Se=()=>{if(w.current)return;let H=h.trim();if(!(!s||l===null)){if(!H){c.warning(d("proposedPlan.enterWorkspacePath"));return}if(H.length>ip){c.warning(d("proposedPlan.pathTooLong"));return}w.current=!0,x(!0),(async()=>{try{let q=await l({environmentId:r,workspaceRoot:s,relativePath:H,contents:F});if(!C.current)return;q.ok?(g(!1),c.success(d("proposedPlan.savedToWorkspace"),q.relativePath)):c.error(d("proposedPlan.couldNotSave"),void 0,{description:d("proposedPlan.saveErrorDescription")})}catch(q){C.current&&c.error(d("proposedPlan.couldNotSave"),q,{description:d("proposedPlan.saveErrorDescription")})}finally{w.current=!1,C.current&&x(!1)}})()}};return b("div",{className:"rounded-[24px] border border-border/80 bg-card/70 p-4 sm:p-5",children:[b("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[b("div",{className:"flex min-w-0 items-center gap-2",children:[u(vl,{variant:"secondary",children:d("proposedPlan.badge")}),u("p",{className:"truncate text-sm font-medium text-foreground",children:I})]}),b(Eo,{children:[u(Mo,{render:u(ce,{"aria-label":d("proposedPlan.actions"),size:"icon-xs",variant:"outline"}),children:u(sr,{"aria-hidden":"true",className:"size-4"})}),b(Ro,{align:"end",children:[u(lr,{onClick:V,children:d(S?"proposedPlan.copied":"proposedPlan.copyToClipboard")}),u(lr,{onClick:B,children:d("proposedPlan.downloadAsMarkdown")}),l!==null?u(lr,{onClick:Q,disabled:!s||y,children:d("proposedPlan.saveToWorkspace")}):null]})]})]}),b("div",{className:"mt-4",children:[b("div",{className:$("relative",A&&!f&&"max-h-104 overflow-hidden"),children:[A&&!f?u(dr,{disclosureKey:`proposed-plan:${o}:plan`,text:_??"",cwd:i,threadRef:a,isStreaming:!1}):u(dr,{disclosureKey:`proposed-plan:${o}:plan`,text:P,cwd:i,threadRef:a,isStreaming:!1}),A&&!f?u("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 h-24 bg-linear-to-t from-card/95 via-card/80 to-transparent"}):null]}),A?u("div",{className:"mt-4 flex justify-center",children:u(ce,{size:"sm",variant:"outline","data-scroll-anchor-ignore":!0,onClick:()=>p(!f),children:d(f?"proposedPlan.collapse":"proposedPlan.expand")})}):null]}),u(Ef,{open:m,onOpenChange:H=>{y||g(H)},children:b(_f,{className:"max-w-xl",children:[b(Nf,{children:[u(Df,{children:d("proposedPlan.saveToWorkspace")}),u(Rf,{children:Cc(d("proposedPlan.pathHint"),u("code",{children:s??d("proposedPlan.theWorkspace")}),"path")})]}),u(tS,{className:"space-y-3",children:b("label",{htmlFor:k,className:"grid gap-1.5",children:[u("span",{className:"text-xs font-medium text-foreground",children:d("proposedPlan.workspacePath")}),u(If,{id:k,value:h,maxLength:ip,onChange:H=>v(H.target.value.slice(0,ip)),placeholder:E,spellCheck:!1,disabled:y})]})}),b(Mf,{children:[u(ce,{variant:"outline",size:"sm",onClick:()=>g(!1),disabled:y,children:d("proposedPlan.cancel")}),u(ce,{size:"sm",onClick:()=>{Se()},disabled:y,children:d(y?"proposedPlan.saving":"proposedPlan.save")})]})]})})]})});function VI({timeline:e,previousOverlayHeight:t,overlayHeight:n,followingEnd:o}){e&&o&&n>t&&e.scrollToEnd({animated:!1})}function qI(e,t){let n=e.topOf(t),o=e.heightOf(t);return typeof n!="number"||typeof o!="number"||!Number.isFinite(n)||!Number.isFinite(o)?null:n+Math.max(1,o)}function WI({measurement:e,followingEnd:t}){return t?null:e.rowAtScroll()}ue();var Al=class extends wa{state={failed:!1,error:null};static getDerivedStateFromError(t){return{failed:!0,error:t instanceof Error?t:new Error(String(t))}}componentDidUpdate(t){this.state.failed&&t.resetKey!==this.props.resetKey&&this.setState({failed:!1,error:null})}render(){if(!this.state.failed)return this.props.children;let{fallback:t}=this.props;return typeof t=="function"?t(this.state.error):t}};function Oz({error:e,className:t}){let{t:n}=ut();return b(Ye,{children:[b(Ze,{render:u("div",{className:$("flex min-h-6 min-w-0 items-center gap-1.5 px-0.5 py-0.5 text-destructive",t)}),children:[u(Sn,{"aria-hidden":!0,className:"size-4 shrink-0"}),u("span",{className:"min-w-0 flex-1 truncate",children:n("timeline.entryUnavailable")})]}),u(Je,{className:"max-w-xs whitespace-pre-wrap font-mono text-[11px]",children:e.message})]})}function GI(e){return u(Oz,{error:e})}var cn=bt(null),XI=bt(null),Fz=u("div",{className:"h-3 sm:h-4"}),Bz=u("div",{className:"h-10 sm:h-12"}),zz=Object.freeze([]);function Uz({loading:e,blocked:t,onLoadEarlier:n,fade:o}){let{t:r}=ut();return u("div",{className:o?"pt-10 sm:pt-12":"pt-3 sm:pt-4",children:u("div",{className:"transcript-col pb-2",children:u("button",{type:"button",onClick:n,disabled:e||t,className:"relative w-full py-1.5 text-chat-row text-muted-foreground/60 hover:text-foreground disabled:cursor-default pointer-coarse:after:absolute pointer-coarse:after:inset-0 pointer-coarse:after:min-h-11",children:r(e?"timeline.loadingEarlier":"timeline.loadEarlier")})})})}function Hz({loading:e,blocked:t,onLoadLater:n,onReturnToLatest:o}){let{t:r}=ut();return b("div",{className:"transcript-col flex items-center justify-center gap-2 py-2",children:[u(ce,{variant:"ghost",size:"sm",onClick:n,disabled:e||t,children:r(e?"timeline.loadingLater":"timeline.loadLater")}),o?u(ce,{variant:"ghost",size:"sm",onClick:o,children:r("timeline.returnToLatest")}):null]})}function $z({onReveal:e,fade:t}){let{t:n}=ut();return u("div",{className:t?"pt-10 sm:pt-12":"pt-3 sm:pt-4",children:u("div",{className:"transcript-col pb-2",children:u("button",{type:"button",onClick:e,className:"relative w-full py-1.5 text-chat-row text-muted-foreground/60 hover:text-foreground pointer-coarse:after:absolute pointer-coarse:after:inset-0 pointer-coarse:after:min-h-11",children:n("timeline.loadEarlier")})})})}var Kz=u("div",{className:"h-3 sm:h-4"}),Vz=[],qz=new Set,Wz=200,jI=1e4;function QI(e,t){let n=Array.from(e.querySelectorAll("[data-timeline-turn-section]")),o=n.findIndex(a=>a.querySelector(`[data-timeline-row-id="${CSS.escape(t)}"]`)),r=o<0?n:n.slice(0,o+1);for(let a of r)a.style.contentVisibility="visible";e.offsetHeight,requestAnimationFrame(()=>{for(let a of r)a.style.removeProperty("content-visibility")})}var jh=600;function Qh(e,t){if(typeof Element>"u"||!(e instanceof Element))return!1;if(t===null||!t.contains(e))return!0;for(let n=e;n&&n!==t;){if(n instanceof HTMLElement&&n.scrollHeight>n.clientHeight&&n.scrollTop>0)return!0;n=n.parentElement}return!1}var Gz=()=>{},jz=[];function Qz(e){let t=e.getMeta().status;return{latestTurn:t.latestTurn??null,latestAssistantMessageId:t.latestAssistantMessageId??null,isWorking:t.isWorking,workingStepLabel:t.workingStepLabel??null,stall:t.stall??null,retry:t.retry??null,totalTurnCount:t.totalTurnCount??null,scheduledWakes:t.scheduledWakes??zz}}function Xz(e,t){return e.latestTurn===t.latestTurn&&e.latestAssistantMessageId===t.latestAssistantMessageId&&e.isWorking===t.isWorking&&e.workingStepLabel===t.workingStepLabel&&e.stall===t.stall&&e.retry===t.retry&&e.totalTurnCount===t.totalTurnCount&&e.scheduledWakes===t.scheduledWakes}var Yz=e=>e.getMeta().finalAssistantMessageReceived;function Jz(e,t){let n=N(e);return t&&(n.current=e),n.current}var YI=pe(function({derive:t,SiteIcon:n,rowsStore:o,threadKey:r,threadRef:a,environmentId:i,onInterrupt:s=null,onRespondToDecision:l=null,onCancelScheduledWake:d=null,agentPanelModel:c,onOpenAgents:f=Gz,onOpenFileDiff:p,onForkFromUserMessage:m,onImageExpand:g,markdownCwd:h,resolvedTheme:v,timestampFormat:y,workspaceRoot:x,skills:C=Vz,onRowsChange:w,contentInsetEndAdjustment:L,liveFollowEnabled:S,awaitingUserDecision:k=!1,onIsAtEndChange:I,onManualNavigation:T,onDisclosureNavigation:A=T,hideEmptyPlaceholder:P=!1,topFadeEnabled:_=!1,scrollerRef:E,loadEarlier:F=null,loadLater:B=null,pagingBlockedByInteraction:V=!1,onReturnToLatest:Q=null,onVisibleTurnRangeChange:Se=null,revealMessageRequest:H=null,onRevealMessageHandled:q,renderWorkGroup:ee,renderToolCallDetail:G,loadScrollAnchor:te,saveScrollAnchor:me,useVisibleThreadCompletion:U,onSavePlanToWorkspace:Y,paneActive:se,onTurnNavigatorChange:ge}){let{t:ie}=ut(),{latestTurn:Ae,latestAssistantMessageId:Xe,isWorking:nt,workingStepLabel:rt,stall:Ve,retry:ne,totalTurnCount:we,scheduledWakes:j}=mi(o,Qz,Xz),X=ea(),ae=N(X);ae.current=X;let oe=N(H);oe.current=H;let[ft,pt]=sn("timeline-disclosure-reading",r,!1),yt=N(r);yt.current=r;let Pt=N(V);Pt.current=V;let nn=Rt("timeline-following-end",r,!0);nn.current=B===null&&S;let gt=Rt("timeline-scroll-restore-pending",r,!1),Bt=Lr(r,null),Mt=Lr(r,null),St=Lr(r,null),In=Rt("timeline-content-inset",r,L),ct=N(null),ln=Lr(r,[]),ro=Lr(r,!1),Vt=N(null),bn=R(()=>ln.current,[ln]),Tn=R(z=>{ln.current=z,Vt.current?.(),Yn.current?.schedule()},[ln]),on=R(z=>{ro.current=z,Yn.current?.schedule()},[ro]),kn=R(z=>{z!==null&&(ct.current=z),E(z)},[E]);he(()=>{VI({timeline:ct.current,previousOverlayHeight:In.current,overlayHeight:L,followingEnd:X&&B===null&&S&&!ft}),In.current=L},[L,ft,S,B,X]),W(()=>()=>{Mt.current?.stop()},[]);let O=R(()=>{Mt.current?.stop(),Mt.current=null,Bt.current=null,pt(!1)},[Bt,Mt,pt]),fe=R(z=>{A(),Bt.current=z,pt(!0),Mt.current?.stop();let Le=ct.current?.node??null;if(!Le)return;let st=Array.from(Le.querySelectorAll("[data-timeline-row-id]")).find(jr=>jr.dataset.timelineRowId===z);if(!st)return;let gn=St.current;Mt.current=qS({viewport:Le,row:st,anchor:gn&&st.contains(gn)?gn:st,scrollToOffset:jr=>{Le.scrollTop=jr}})},[A]),ye=Rt("timeline-live-follow-previous",r,S);he(()=>{S&&!ye.current&&O(),ye.current=S},[S,O]);let Te=Jz(B!==null,X),Me=!Te&&nt,ht=Te?null:rt,Ln=Te?null:Ve,fn=Te?null:ne,at=rI(o),It=at.sections,Et=at.rowIds.length,Tt=R(z=>{let Le=o.getRows().find(st=>st.id===z||st.kind==="work"&&st.groupedEntries.some(gn=>gn.id===z)||st.kind==="tool-group"&&st.entries.some(gn=>gn.id===z));fe(Le?.id??z)},[o,fe]),rn=Rt("timeline-scroll-snapshot",r,null),Yt=R((z,Le=nn.current)=>{z.scrollLength<=0||(rn.current={threadKey:r,anchor:WI({measurement:z,followingEnd:Le})})},[nn,r,rn]),xe=R(()=>{let z=rn.current;z&&me(z.threadKey,z.anchor)},[me,rn]),_e=R(()=>{if(!X||gt.current)return;if(Et===0){xe();return}let z=ct.current?.measure();z&&z.scrollLength>0&&(Yt(z,nn.current&&t.resolveIsAtEnd(z,L)!==!1),xe())},[Yt,L,t,nn,X,xe,gt,Et]),qe=eI(r),We=N(qe);We.current=qe;let ot=Rt("timeline-top-reveal-armed",r,!0),xt=Rt("timeline-network-prepend-awaiting-navigation",r,!1),Ft=N(null),Jt=N(null);he(()=>()=>{Jt.current!==null&&(cancelAnimationFrame(Jt.current),Jt.current=null)},[r,X]);let ke=Rt("timeline-network-prepend-scroll-top",r,null),zt=Rt("timeline-mounted-section-keys",r,qz,3),vt=Lr(r,null),Ut=vt.current,Bn=Ut===null?-1:It.findIndex(z=>z.key===Ut.firstMountedSectionKey),ve=Bn>0?It.length-Math.max(0,Bn-Oh):qe.revealedCount,et=Bn>0?ve:qe.revealedCount,lt=kS(It.map(z=>z.key),zt.current,et,B!==null||!S||ft||ro.current||ln.current.length>0),{startIndex:it,hasHiddenOlder:xn}=jS(It.length,lt),pn=K(()=>It.slice(it),[it,It]),mn=Ut!==null&&Bn>0&&it<Bn,Ct=N(It);Ct.current=It,he(()=>{if(X){if(zt.current=new Set(pn.map(z=>z.key)),Ut!==null){let z=tI(Ut,{prefixMounted:mn,loading:F===null?null:F.loading,sections:It,now:Date.now()});z!=="waiting"&&(vt.current=null),z==="mounted"&&(xt.current=!0)}lt<We.current.revealedCount?We.current.compactTo(lt):lt>We.current.revealedCount&&We.current.revealAtLeast(lt)}},[xt,F,X,Ut,mn,vt,zt,lt,It,pn]);let Qt=Lr(r,null),qt=R((z=null)=>{if(!ae.current)return;let Le=ct.current?.node;Le&&(Qt.current={scrollHeight:Le.scrollHeight,scrollTop:Le.scrollTop,row:ct.current?.measure()?.rowAtScroll()??null,firstMountedSectionKey:z,until:Date.now()+jI})},[Qt]),ko=R(()=>{let z=Qt.current;if(z===null||z.firstMountedSectionKey===null||Date.now()>z.until)return;let Le=ct.current?.node;if(!Le)return;let st=rn.current;z.scrollHeight=Le.scrollHeight,z.scrollTop=Le.scrollTop,z.row=st?.threadKey===r?st.anchor:null},[Qt,r,rn]);he(()=>{if(!X)return;let z=Qt.current;if(!z)return;if(Date.now()>z.until){Qt.current=null;return}if(z.firstMountedSectionKey!==null&&vt.current!==null)return;Qt.current=null;let Le=ct.current?.node;if(Le){if(z.row){QI(Le,z.row.rowId);let st=ct.current?.measure()?.topOf(z.row.rowId);st!=null&&(Le.scrollTop=st+z.row.offsetPx)}else Le.scrollTop=z.scrollTop+(Le.scrollHeight-z.scrollHeight);mn&&(ke.current=Le.scrollTop)}},[ke,X,Ut,mn,it,at]);let Do=R(()=>{qt(),We.current.revealOlder()},[qt]),va=N(Do);va.current=Do;let Xa=N(xn);Xa.current=xn;let Ue=N(null),ya=Rt("timeline-scroll-restore",r,void 0);if(ya.current===void 0&&Et>0){let z=te(r);ya.current=z!==null&&at.rowIds.includes(z.rowId)?z:null}let qr=ya.current??null,er=N(()=>{}),[Nn,Ya]=sn("timeline-scroll-restore-settled",r,!1),tr=qr!==null&&!Nn,Ja=Rt("timeline-last-anchor-save",r,0);W(()=>{let z=qr;if(!X||Nn||z===null)return;if(oe.current!==null){Ya(!0);return}let Le=null,st=requestAnimationFrame(()=>{!ae.current||yt.current!==r||(T(),We.current.revealAtLeast(yc(Ct.current,z.rowId,We.current.revealedCount)),Le=requestAnimationFrame(()=>{!ae.current||yt.current!==r||(Ya(!0),er.current(z.rowId,-z.offsetPx))}))});return()=>{cancelAnimationFrame(st),Le!==null&&cancelAnimationFrame(Le)}},[T,X,r,qr,Nn]);let Cr=Rt("timeline-restore-after-presentation",r,!1),br=tr||Cr.current;gt.current=br,he(()=>{if(X)return()=>{yt.current!==r?xe():_e(),Cr.current=!0}},[X,r]),he(()=>{if(!X||!Cr.current)return;if(oe.current!==null){Cr.current=!1,gt.current=!1;return}let z=null,Le=null,st=()=>{!ae.current||yt.current!==r||(ct.current?.scrollToEnd(),Cr.current=!1,gt.current=!1,nn.current=B===null,Gr.current=B===null,rr.current={...rr.current,followEnabled:!0,restoreInProgress:!1},I(B===null))},gn=te(r),jr=gn!==null&&Ct.current.some(nl=>nl.rowIds.includes(gn.rowId));return gn===null?z=requestAnimationFrame(st):jr?(T(),We.current.revealAtLeast(yc(Ct.current,gn.rowId,We.current.revealedCount)),z=requestAnimationFrame(()=>{Le=requestAnimationFrame(()=>{!ae.current||yt.current!==r||(er.current(gn.rowId,-gn.offsetPx),Cr.current=!1,gt.current=!1)})})):Et>0&&(z=requestAnimationFrame(st)),()=>{z!==null&&cancelAnimationFrame(z),Le!==null&&cancelAnimationFrame(Le)}},[te,B,I,T,X,r,Et,It.length]);let nr=R(z=>{O(),T(),We.current.revealAtLeast(yc(Ct.current,z.anchorRowId,We.current.revealedCount));let Le=r;requestAnimationFrame(()=>{yt.current===Le&&er.current(z.anchorRowId,24)})},[T,O,r]);W(()=>{if(H===null||!X)return;O(),T();let z=t.resolveToolGroupRevealRowId(o.getRows(),H.rowId);We.current.revealAtLeast(yc(Ct.current,z,We.current.revealedCount));let Le=requestAnimationFrame(()=>{yt.current===r&&(er.current(z,24),q?.())});return()=>cancelAnimationFrame(Le)},[H,X,T,O,q,t,r,o]);let Nt=R(z=>X?NI(z,t):jz,[t,X]),Gn=mi(o,Nt,_I),Lo=N(Gn);Lo.current=Gn;let Ee=Rt("timeline-active-header",r,null),Oo=Gn.at(-1)?.text??null,Bi=Oo!==null,jn=N(null),Fo=N(null),[Qn,or]=sn("timeline-pinned-header-expanded",r,!1),Bo=N(Qn);Bo.current=Qn;let wr=R(()=>{if(!ae.current)return;let z=jn.current,Le=Fo.current;!z||!Le||(z.dataset.truncated=Bo.current||Le.scrollWidth>Le.clientWidth+1?"true":"false")},[]),[po,zo]=J(null),zi=mi(o,Yz),[Pn,Za]=J(null),Po=R(()=>{if(Pt.current||yt.current!==r||F===null||F.loading)return;let z=pn[0]?.key;z!==void 0&&(qt(z),vt.current={firstMountedSectionKey:z,loadingObserved:!1,sectionsWhileLoading:Ct.current,until:Date.now()+jI},F.onLoadEarlier())},[qt,F,vt,r,pn]);Ue.current=F===null||F.loading||V?null:Po;let Uo=R(()=>{Pt.current||yt.current!==r||(qt(),B?.onLoadLater())},[qt,B,r]),Wr=R((z,Le)=>{if(!ae.current)return;let st=ct.current?.node;st&&(QI(st,z),ct.current?.scrollToRow(z,{viewOffset:Le}))},[]);er.current=Wr;let Xn=X&&B===null&&S&&!ft&&!br,Gr=N(Xn);Gr.current=Xn;let rr=N({followEnabled:Xn,restoreInProgress:br,loadEarlier:F});rr.current={followEnabled:Xn,restoreInProgress:br,loadEarlier:F};let Yn=N(null);W(()=>{if(!Pn||!X)return;let z=nI({root:Pn,minimumCount:us,keepAbovePx:jh,canCompact:()=>{let Le=rr.current,st=Qt.current;return Le.followEnabled&&ln.current.length===0&&!Le.restoreInProgress&&!Le.loadEarlier?.loading&&!(st&&st.until>Date.now())&&We.current.revealedCount>us},onCompact:Le=>{ot.current=!0,qt(),We.current.compactTo(Le)}});return Yn.current=z,()=>{z.disconnect(),Yn.current=null}},[qt,X,Pn]),W(()=>{Yn.current?.schedule()},[Xn,F?.loading,qe.revealedCount,It.length]),W(()=>{if(!Pn||!X||typeof ResizeObserver>"u")return;let z=()=>{if(!ae.current||!Gr.current)return;let gn=Pn.scrollHeight-Pn.clientHeight;Math.abs(Pn.scrollTop-gn)>.5&&(Pn.scrollTop=gn)},Le=new ResizeObserver(z);Le.observe(Pn);let st=Pn.firstElementChild;return st&&Le.observe(st),()=>Le.disconnect()},[X,Pn]),U({viewport:po,viewActive:se&&X,threadKey:r,completedAt:B===null&&!br&&Ae?.state==="completed"&&zi?Ae.completedAt:null,messageId:Xe,bottomInset:L});let Ui=at.rowIds.at(-1)??null;W(()=>{w?.(Ui)},[Ui,w,r]);let mo=Rt("timeline-later-load-armed",r,!0),$e=R(z=>{if(z>jh){ot.current=!0;return}if(ot.current){if(ot.current=!1,Xa.current){va.current();return}Ue.current?.()}},[ot]),_t=R(()=>{xt.current&&(xt.current=!1,ke.current=null,ot.current=!0)},[xt,ke,ot]),dn=R(()=>{if(Jt.current!==null||Pt.current||!ae.current||yt.current!==r||gt.current)return!1;let z=ct.current?.measure();return!z||z.scroll>2||z.contentLength-z.scrollLength-z.scroll<=2||!Xa.current&&Ue.current===null?!1:(xt.current=!1,ke.current=null,ot.current=!0,Jt.current=requestAnimationFrame(()=>{Jt.current=null}),$e(z.scroll),!0)},[$e,xt,ke,r,gt,ot,Jt]),An=R(()=>{if(!ae.current||yt.current!==r)return;let z=ct.current?.measure();if(!z||gt.current)return;Yt(z);let Le=ke.current;xt.current&&Le!==null&&Math.abs(z.scroll-Le)>.5&&_t(),ko();let st=t.resolveIsAtEnd({contentLength:z.contentLength,scroll:z.scroll,scrollLength:z.scrollLength},L);st!==void 0&&I(B===null&&st),z.contentLength-z.scrollLength-z.scroll>2&&$e(z.scroll),z.contentLength-z.scrollLength-z.scroll>jh?mo.current=!0:mo.current&&B&&!B.loading&&!Pt.current&&(mo.current=!1,Uo());let jr=Date.now();jr-Ja.current>=Wz&&(Ja.current=jr,xe())},[Yt,L,t,$e,I,xe,ko,r,B,mo,Uo,xt,ke,_t,gt]),Ho=N(null),xa=R(()=>{ae.current&&Ho.current===null&&(Ho.current=requestAnimationFrame(()=>{Ho.current=null,wr()}))},[wr]);W(()=>()=>{Ho.current!==null&&(cancelAnimationFrame(Ho.current),Ho.current=null)},[r]);let Hi=R(z=>{if(z===null||z===Ee.current)return;Ee.current=z;let Le=Lo.current.find(st=>st.sectionKey===z);Le&&Fo.current&&(Fo.current.textContent=Le.text),Bo.current&&or(!1),xa()},[Ee,xa,or]),el=oI({root:Pn,topInsetPx:rp,onActiveSectionChange:Hi,active:X}),$i=K(()=>TS(It),[It]),Ki=AS({root:Pn,inputKey:r,visible:X,index:$i,topInset:Bi?rp:0,bottomInset:L,interactionRows:bn,onRangeChange:Se,onSelectionChange:on});Vt.current=Ki,W(()=>{if(!X){xe();return}let z=requestAnimationFrame(()=>{if(!ae.current)return;let Le=ct.current?.node;Le&&Gr.current&&(Le.scrollTop=Le.scrollHeight-Le.clientHeight),el.refresh()});return()=>cancelAnimationFrame(z)},[xe,el,X]);let tl=R(()=>{or(z=>!z)},[or]);he(()=>{if(!X)return;let z=Ee.current,Le=z===null?void 0:Lo.current.find(st=>st.sectionKey===z);Le&&Fo.current&&(Fo.current.textContent=Le.text),xa()},[X,xa,Qn]);let Qg=K(()=>{let z=xn?u($z,{onReveal:Do,fade:_}):F!==null?u(Uz,{loading:F.loading,blocked:V,onLoadEarlier:Po,fade:_}):_?Bz:Fz;return Bi?b(Pe,{children:[u("div",{style:{height:rp}}),z]}):z},[Po,xn,Bi,F,V,Do,_]);W(()=>{if(!X)return;let z=requestAnimationFrame(An);return()=>cancelAnimationFrame(z)},[An,X,br,Et]);let Qu=K(()=>({timestampFormat:y,threadKey:r,threadRef:a,markdownCwd:h,resolvedTheme:v,workspaceRoot:x,skills:C,activeThreadEnvironmentId:i,onForkFromUserMessage:m,onImageExpand:g,onOpenFileDiff:p,onProcessDisclosureChange:Tt,agentPanelModel:c,onOpenAgents:f,onInterrupt:s,onRespondToDecision:l,scheduledWakes:j,onCancelScheduledWake:d,derive:t,SiteIcon:n,renderWorkGroup:ee,renderToolCallDetail:G,onSavePlanToWorkspace:Y}),[y,r,a,h,v,x,C,i,m,g,p,Tt,c,f,s,l,j,d,t,n,ee,G,Y]),Xg=K(()=>({isWorking:Me,workingStepLabel:ht,stall:Ln,retry:fn}),[Me,fn,Ln,ht]),Xu=R(z=>u(Zz,{rowsStore:o,rowId:z}),[o]),Id=Et===0&&!Me&&!P;return u(cn,{value:Qu,children:b(XI,{value:Xg,children:[u(FI,{rowsStore:o,derive:t,paneVisible:X,totalTurnCount:we,bottomInset:L,onSelect:nr,onTurnNavigatorChange:ge}),b("div",{ref:zo,onClickCapture:z=>{St.current=z.target instanceof Element?z.target.closest("button"):null},onWheelCapture:O,onTouchMoveCapture:O,onPointerDownCapture:z=>{z.target===ct.current?.node&&(O(),dn())},onKeyDownCapture:z=>{["ArrowUp","ArrowDown","PageUp","PageDown","Home","End"].includes(z.key)&&O()},className:"chat-timeline relative h-full min-h-0","data-awaiting-user-decision":k?"true":"false","data-disclosure-reading":ft?"true":void 0,"data-timeline-follow-end":Xn?"true":"false","data-timeline-end-inset":L,children:[u(PS,{inputKey:r,onBeforeInputChange:_e,handleRef:kn,onAttach:Za,onInteractionRowsChange:Tn,onScroll:An,className:$("scrollbar-gutter-both h-full min-h-0 overflow-y-auto overflow-x-hidden overscroll-y-contain px-3 sm:px-5",_&&"topbar-scroll-fade"),children:b("div",{style:{paddingBottom:L},onWheel:z=>{z.defaultPrevented||z.deltaY>=0||ui(z.target)||Qh(z.target,ct.current?.node??null)||dn()},onTouchStartCapture:z=>{Ft.current=z.touches[0]?.clientY??null},onTouchMove:z=>{let Le=z.touches[0],st=Ft.current;z.defaultPrevented||ui(z.target)||Qh(z.target,ct.current?.node??null)||Le===void 0||st===null||Le.clientY<=st||dn()&&(Ft.current=null)},onTouchEndCapture:()=>{Ft.current=null},onTouchCancelCapture:()=>{Ft.current=null},onKeyDown:z=>{z.defaultPrevented||z.repeat||z.metaKey||z.ctrlKey||z.altKey||z.shiftKey||ui(z.target)||Qh(z.target,ct.current?.node??null)||!["ArrowUp","PageUp","Home"].includes(z.key)||dn()},children:[Qg,pn.map(z=>u(WS,{sectionKey:z.key,rowKeyPrefix:r,rowIds:z.rowIds,renderRow:Xu,sectionRef:el.observeSection(z.key)},`${r}:${z.key}`)),B?u(Hz,{loading:B.loading,blocked:V,onLoadLater:Uo,onReturnToLatest:Q}):null,Kz]})}),Id?u("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center",children:u("p",{className:"text-placeholder text-chat",children:ie("timeline.empty")})}):null,Oo!==null?u(TI,{ref:jn,textRef:Fo,initialText:Oo,expanded:Qn,onToggleExpanded:tl}):null]})]})})});var Zz=pe(function({rowsStore:t,rowId:n}){let o=aI(t,n),r=wt(cn);return o===void 0?null:u(hl,{value:o.id,children:u("div",{className:$("relative",o.kind==="message"&&o.message.role==="user"?"pb-6":o.kind==="message"&&o.message.role==="assistant"?o.copyInFooter?"pb-1 group/assistant":"pb-4 group/assistant":"pb-2"),"data-timeline-row-id":o.id,"data-timeline-row-kind":o.kind,"data-message-id":o.kind==="message"?o.message.id:void 0,"data-message-role":o.kind==="message"?o.message.role:void 0,children:b(Al,{resetKey:o.id,fallback:GI,children:[o.kind==="turn-summary"?u(NS,{footer:o.footer,copyText:o.copyText,timestampFormat:r.timestampFormat}):null,o.kind==="tool-group"?u(VS,{entries:o.entries,groupId:o.groupId,threadKey:r.threadKey,workspaceRoot:r.workspaceRoot,onDisclosureChange:()=>r.onProcessDisclosureChange?.(o.id)}):null,o.kind==="work"?u(eU,{row:o}):null,o.kind==="model-switch"?u(LI,{row:o}):null,o.kind==="turn-identity"?u("div",{"data-turn-identity":o.turnId,className:"px-1 pt-1",children:u(qh,{badge:o.badge,createdAt:o.createdAt})}):null,o.kind==="message"&&o.message.role==="user"?u($h,{row:o}):null,o.kind==="message"&&o.message.role==="assistant"?u(kI,{row:o}):null,o.kind==="proposed-plan"?u(nU,{row:o}):null,o.kind==="turn-plan"?u(oU,{row:o}):null,o.kind==="working"?u(rU,{row:o}):null]})})})});function eU({row:e}){let t=wt(cn),n=ea(),o=t.renderWorkGroup?.({row:e,threadRef:t.threadRef,visible:n});return o!==void 0?u(Pe,{children:o}):u("div",{className:"min-w-0 space-y-px py-0.5",children:e.groupedEntries.map(r=>u(tU,{entry:r},r.id))})}function tU({entry:e}){let t=wt(cn),[n,o]=Wo(t.threadKey,`work-fallback:${Kf(e)}`,!1),r=e.detail??e.command??e.rawCommand??e.toolLabel?.detail;return b("div",{children:[b("button",{type:"button","aria-expanded":n,className:$("chat-process-row flex w-full min-w-0 items-center gap-1.5 px-2 text-left",e.tone==="error"?"text-destructive":"text-muted-foreground"),onClick:()=>o(!n),disabled:r===void 0,children:[u("span",{"aria-hidden":!0,className:$("block size-2 shrink-0 rounded-full",e.tone==="error"?"bg-destructive":e.tone==="thinking"||e.tone==="info"?"bg-muted-foreground/60":"border border-muted-foreground/60")}),u("span",{className:"chat-process-text min-w-0 flex-1 truncate",children:e.label}),r!==void 0?u(an,{"aria-hidden":!0,className:$("size-icon-1 shrink-0",!n&&"-rotate-90")}):null]}),n&&r!==void 0?u("pre",{className:"chat-tool-body mx-2 overflow-x-auto rounded-md bg-muted/40 p-2",children:r}):null]})}function nU({row:e}){let t=wt(cn);return u("div",{className:"min-w-0 px-1 py-0.5",children:u(KI,{threadKey:t.threadKey,rowId:e.id,planMarkdown:e.proposedPlan.planMarkdown,environmentId:t.activeThreadEnvironmentId,threadRef:t.threadRef??void 0,cwd:t.markdownCwd,workspaceRoot:t.workspaceRoot,onSavePlanToWorkspace:t.onSavePlanToWorkspace})})}var oU=pe(function({row:t}){let n=wt(cn),{t:o}=ut(),[r,a]=Wo(n.threadKey,`turn-plan:${t.id}`,!1),{steps:i}=t.turnPlan.plan,s=i.filter(f=>f.status==="completed").length,l=s===i.length,d=i.find(f=>f.status==="inProgress")?.step??i.find(f=>f.status==="pending")?.step??i.at(-1)?.step??o("proposedPlan.badge");return b("div",{className:"min-w-0 px-1 py-0.5",children:[b("button",{type:"button",className:"relative flex w-full min-w-0 cursor-pointer items-center gap-2 rounded-md px-0.5 py-0.5 text-left text-[12px] leading-5 transition-colors duration-(--control-duration) hover:bg-accent/20 pointer-coarse:after:absolute pointer-coarse:after:inset-0 pointer-coarse:after:min-h-11","aria-expanded":r,onClick:()=>a(!r),children:[u(r?an:Ko,{className:"size-icon-1 shrink-0 text-muted-foreground/65"}),i.length>1?u("span",{"aria-hidden":!0,className:"flex shrink-0 items-center gap-0.5",children:i.map(f=>u("span",{className:$("h-[3px] w-2.5 rounded-full",f.status==="completed"?"bg-success":f.status==="inProgress"?"bg-primary":"bg-muted-foreground/25")},f.step))}):null,u("span",{className:$("min-w-0 truncate",l?"text-muted-foreground/65":"font-medium text-foreground/85"),children:d}),i.length>1?b("span",{className:"shrink-0 text-muted-foreground/50 tabular-nums",children:[s,"/",i.length]}):null]}),r?u("div",{className:"mt-0.5 space-y-px pl-6",children:i.map(f=>b("div",{className:"flex items-baseline gap-2 text-[12px] leading-5",children:[u("span",{className:$("w-3 shrink-0 text-center font-mono text-chat-meta",f.status==="completed"?"text-success":f.status==="inProgress"?"text-primary":"text-muted-foreground/40"),"aria-hidden":!0,children:f.status==="completed"?"\u2713":f.status==="inProgress"?"\u25CF":"\u25CB"}),u("span",{className:$("min-w-0",f.status==="completed"?"text-muted-foreground/55":f.status==="inProgress"?"text-foreground/90":"text-muted-foreground/70"),children:f.step})]},f.step))}):null]})});function rU({row:e}){let{workingStepLabel:t,stall:n,retry:o}=wt(XI),{t:r}=ut();return b("div",{className:"border-b border-border/60 pb-2 pt-1",children:[u("div",{className:"flex min-w-0 flex-wrap items-center gap-x-1.5 px-1 text-chat text-muted-foreground tabular-nums","data-testid":"working-row",children:b("span",{className:"min-w-0",children:[e.compacting?r("activity.compacting"):e.createdAt?Cc(r("activity.workingForLive"),u(dU,{createdAt:e.createdAt})):r("activity.workingNoTimer"),t&&!e.compacting?b("span",{className:"ml-2 text-muted-foreground/55",children:["\xB7 ",t]}):null]})}),o?u(aU,{retry:o}):n&&!e.compacting?u(sU,{stall:n}):null]})}function aU({retry:e}){let{t}=ut(),n=wt(cn);return b(cc,{variant:"warning",className:"mt-2 px-2 py-1.5 text-chat-row",children:[u(Ff,{children:n.derive.providerRetryMessage(e,(o,r)=>t(o,r))}),n.onInterrupt?u(uc,{children:u(ce,{onClick:n.onInterrupt,size:"sm",variant:"ghost",title:t("stall.interruptHint"),children:t("stall.interrupt")})}):null]})}var iU={childThread:"stall.reasonChildThread",tool:"stall.reasonTool",approval:"stall.reasonApproval",userInput:"stall.reasonUserInput",model:"stall.reasonModel"};function sU({stall:e}){let{t}=ut(),{onInterrupt:n}=wt(cn),o=t(iU[e.reason]);return b("div",{className:"mt-1 flex items-center gap-2 px-1 text-chat-row text-muted-foreground/70",children:[u("span",{className:"tabular-nums",children:Cc(t("stall.noOutputForLive"),u(lU,{since:e.since}))}),u("span",{"aria-hidden":!0,children:"\xB7"}),u("span",{children:o}),n?u(ce,{className:"h-5 px-1.5 text-chat-row",onClick:n,size:"sm",title:t("stall.interruptHint"),variant:"ghost",children:t("stall.interrupt")}):null]})}function JI(e,t){let n=ea();W(()=>{let o=()=>{t.current&&(t.current.textContent=Xh(e))};if(o(),!n)return;let r=setInterval(o,1e3);return document.addEventListener("visibilitychange",o),()=>{clearInterval(r),document.removeEventListener("visibilitychange",o)}},[n,e,t])}function lU({since:e}){let t=N(null);return JI(e,t),u("span",{className:"timeline-timer tabular-nums",ref:t,children:Xh(e)})}function dU({createdAt:e}){let t=N(null);return JI(e,t),u("span",{ref:t,className:"timeline-timer tabular-nums",children:Xh(e)})}function cU(e,t){let n=Date.parse(e),o=Date.parse(t);if(!Number.isFinite(n)||!Number.isFinite(o))return null;let r=Math.max(0,Math.floor((o-n)/1e3));return r<60?`${r}s`:ka(r*1e3)}function Xh(e){return cU(e,new Date().toISOString())??"0s"}function sp(e,t){return e===t?!0:!e||!t?!1:e.identity===t.identity&&e.instanceId===t.instanceId&&e.driverKind===t.driverKind&&e.providerDisplayName===t.providerDisplayName&&e.accentColor===t.accentColor&&e.modelLabel===t.modelLabel&&e.effortLabel===t.effortLabel}function ZI(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]!==t[n])return!1;return!0}function e0(e,t){if(e===t)return!0;if(e.kind!==t.kind||e.id!==t.id)return!1;switch(e.kind){case"turn-identity":{let n=t;return e.turnId===n.turnId&&e.createdAt===n.createdAt&&sp(e.badge,n.badge)}case"turn-summary":{let n=t;return e.createdAt===n.createdAt&&e.copyText===n.copyText&&e.footer===n.footer}case"tool-group":{let n=t;return e.createdAt===n.createdAt&&e.groupId===n.groupId&&ZI(e.entries,n.entries)}case"working":{let n=t;return e.createdAt===n.createdAt&&e.turnId===n.turnId&&e.compacting===n.compacting&&sp(e.modelBadge,n.modelBadge)}case"model-switch":{let n=t;return e.createdAt===n.createdAt&&e.pending===n.pending&&sp(e.badge,n.badge)}case"proposed-plan":return e.proposedPlan===t.proposedPlan;case"turn-plan":{let n=t;return e.createdAt===n.createdAt&&e.turnPlan.plan===n.turnPlan.plan}case"work":{let n=t;return e.isExpandedToolGroupEntry===n.isExpandedToolGroupEntry&&e.isLastExpandedToolGroupEntry===n.isLastExpandedToolGroupEntry&&ZI(e.groupedEntries,n.groupedEntries)}case"message":{let n=t;return e.message===n.message&&e.presentation===n.presentation&&e.textTone===n.textTone&&e.durationStart===n.durationStart&&e.showAssistantMeta===n.showAssistantMeta&&e.showAssistantCopyButton===n.showAssistantCopyButton&&e.copyInFooter===n.copyInFooter&&e.assistantCopyStreaming===n.assistantCopyStreaming&&sp(e.modelBadge,n.modelBadge)}}}function uU(e,t){let n=t.historyWindow,{status:o}=t,r={activities:t.activities,timelineEntries:t.timelineEntries,latestTurn:n?null:o.latestTurn,runningTurnId:n?null:o.runningTurnId,expandedTurnIds:t.expandedTurnIds,isWorking:!n&&o.isWorking,activeTurnStartedAt:n?null:o.activeTurnStartedAt,resolveModelBadge:t.resolveModelBadge,pendingModelSelection:n?null:o.pendingModelSelection},a=e.deriveGroups(r),i=o.latestTurn;if(n&&i&&i.completedAt!==null){let s=i.turnId;if(a.rows.some(d=>d.kind==="message"?d.message.role==="assistant"&&d.message.turnId===s:d.kind==="work"?d.groupedEntries.some(c=>c.turnId===s):d.kind==="tool-group"&&d.entries.some(c=>c.turnId===s)))return e.deriveGroups({...r,latestTurn:i})}return a}var fU=new Map,pU={markdown:()=>"",download(){}},mU=[],gU={latestTurn:null,latestAssistantMessageId:null,runningTurnId:null,isWorking:!1,workingStepLabel:null,stall:null,retry:null,activeTurnStartedAt:null,totalTurnCount:null,pendingModelSelection:null,scheduledWakes:mU},hU={inputs:null,structure:{rowIds:[],sections:[]},indexById:new Map,rows:[],meta:{status:gU,usageByTurnId:fU,exportApi:pU,finalAssistantMessageReceived:!1},version:0};function vU(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]!==t[n])return!1;return!0}function yU(e,t,n,o){let r=uU(n,e),a=xU(t.structure.rowIds,r.rows),i=a?t.indexById:new Map(r.rows.map((g,h)=>[g.id,h])),s=r.rows.map((g,h)=>{let v=a?t.rows[h]:t.rows[t.indexById.get(g.id)??-1],y=v!==void 0&&e0(v,g)?v:g;return y!==v&&o.add(g.id),y});if(!a)for(let g of t.indexById.keys())i.has(g)||o.add(g);let l=GS(s,r.turnGroups,t.structure.sections),d=a?t.structure.rowIds:s.map(g=>g.id),c=a&&vU(t.structure.sections,l)?t.structure:{rowIds:d,sections:l},f=e.derive.hasSettledAssistantMessage(e.timelineEntries,e.status.latestAssistantMessageId),p=t.meta.status===e.status&&t.meta.usageByTurnId===e.usageByTurnId&&t.meta.exportApi===e.exportApi&&t.meta.finalAssistantMessageReceived===f?t.meta:{status:e.status,usageByTurnId:e.usageByTurnId,exportApi:e.exportApi,finalAssistantMessageReceived:f},m=o.size>0||c!==t.structure||p!==t.meta;return{inputs:e,structure:c,indexById:i,rows:s,meta:p,version:m?t.version+1:t.version}}function xU(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]!==t[n].id)return!1;return!0}function t0(){let e=null,t=null,n=hU,o=new Set,r=0,a=new Set,i=new Map,s=()=>{if(e===null||n.inputs===e)return n;t??=e.derive.createRowsCache();let l=new Set;n=yU(e,n,t,l);for(let d of l)o.add(d);return n};return{setInputs(l){e=l},hasInputs:()=>e!==null,flush(){if(a.size===0&&i.size===0||e===null)return;let{version:l}=s();if(l===r&&o.size===0)return;r=l;let d=[...o];o.clear();for(let c of d){let f=i.get(c);if(f!==void 0)for(let p of Array.from(f))p()}for(let c of Array.from(a))c()},subscribe(l){return a.add(l),()=>{a.delete(l)}},subscribeRow(l,d){let c=i.get(l);return c===void 0&&(c=new Set,i.set(l,c)),c.add(d),()=>{c.delete(d),c.size===0&&i.get(l)===c&&i.delete(l)}},getStructure:()=>s().structure,getRow(l){let{indexById:d,rows:c}=s(),f=d.get(l);return f===void 0?void 0:c[f]},getRows:()=>s().rows,getMeta:()=>s().meta,getVersion:()=>s().version}}ue();var CU=new Set;function n0({data:e,target:t,threadKey:n,visible:o,rowsStore:r,derive:a,resolveModelBadge:i,disclosure:s,historyWindow:l}){let d=e.useChatTimeline({target:t,threadKey:n,visible:o}),c=e.useTurnStatus({target:t,threadKey:n,visible:o}),f=ea(),p=s.usePersistedExpandedTurnIds(n),[m,g]=sn("timeline-auto-expanded-turns",n,CU),h=K(()=>a.resolveExpandedTurnIds(p??[],m),[m,a,p]),{latestTurn:v}=c,y=Rt("timeline-latest-turn-previous",n,v);W(()=>{let C=y.current;if(y.current=v,!(!v||C?.turnId===void 0)){if(v.turnId===C.turnId){C.state==="running"&&v.state==="interrupted"&&g(w=>{let L=new Set(w);return L.add(v.turnId),L});return}g(w=>{if(!w.has(C.turnId))return w;let L=new Set(w);return L.delete(C.turnId),L})}},[v]);let x=K(()=>({derive:a,timelineEntries:d.timelineEntries,activities:d.activities,status:c,expandedTurnIds:h,resolveModelBadge:i,historyWindow:l,usageByTurnId:d.usageByTurnId,exportApi:d.export}),[d.activities,d.export,d.timelineEntries,d.usageByTurnId,a,h,l,i,c]);return(f||!r.hasInputs())&&r.setInputs(x),he(()=>{r.flush()}),null}var o0=pe(function({data:t,target:n,threadKey:o,visible:r,...a}){let i=Rt("timeline-rows-store",o,null,3);i.current??=t0();let s=i.current;return b(Pe,{children:[u(n0,{data:t,target:n,threadKey:o,visible:r,rowsStore:s,derive:a.derive,resolveModelBadge:a.resolveModelBadge,disclosure:a.disclosure,historyWindow:(a.loadLater??null)!==null}),u(YI,{...a,threadKey:o,rowsStore:s,SiteIcon:t.SiteIcon})]})});ue();function r0(e){return e==="loading"?"threadSync.loading":"threadSync.syncing"}var bU=1e3;function a0(e,t=bU){let[n,o]=J(null);return W(()=>{if(e===null){o(null);return}let r=globalThis.setTimeout(()=>{o(e)},t);return()=>{globalThis.clearTimeout(r)}},[e,t]),n}function i0({phase:e}){let{t}=Ce(),n=t(r0(e));return b("div",{"aria-label":n,className:"pointer-events-none flex items-center gap-2 rounded-full border border-border/60 bg-background/90 px-3 py-1 text-xs font-medium text-foreground shadow-sm backdrop-blur","data-thread-sync-pill":"true",role:"status",children:[u(ii,{"aria-hidden":!0,className:"size-icon-2 shrink-0 text-muted-foreground"}),u("span",{className:"truncate",children:n})]})}function s0({data:e,target:t,bottomInset:n,showScrollToEnd:o,onScrollToEnd:r}){let{t:a}=Ce(),i=a0(e.useThreadSyncPhase(t));return i===null&&!o?null:b("div",{className:"pointer-events-none absolute left-1/2 z-30 flex -translate-x-1/2 flex-col items-center gap-1.5 py-1.5",style:{bottom:n+4},children:[i!==null?u(i0,{phase:i}):null,o?b(ce,{onClick:r,className:"pointer-events-auto gap-1.5 rounded-full px-3 text-muted-foreground hover:text-foreground",size:"xs",variant:"glass",children:[u(an,{}),a("timeline.scrollToEnd")]}):null]})}ue();function l0(){let e=!1;return{lock:()=>{e=!0},resume:()=>{e=!1},navigate:t=>!t||!e?!1:(e=!1,!0),isLocked:()=>e}}function d0(e){return e.requestedGeneration===e.currentGeneration&&e.mode==="following-end"&&!e.readingLocked}var wU=150,SU=16;function c0(e,t){typeof e=="function"?e(t):e&&(e.current=t)}function u0({inputKey:e,visible:t,endInset:n,derive:o,onReturnToLatest:r,controlRef:a}){let[i,s]=sn("timeline-live-follow-enabled",e,!0),[l,d]=sn("timeline-show-scroll-to-end",e,!1),c=Lr(e,null),[f,p]=ZS(e,null),m=R(G=>{c.current=G;let te=G?.node??null;p(me=>me===te?me:te)},[c,p]),g=Rt("timeline-is-at-end",e,!0),h=Lr(e,null),v=R(()=>{h.current!==null&&clearTimeout(h.current),h.current=null},[h]),y=R(()=>{v(),h.current=setTimeout(()=>{h.current=null,d(!0)},wU)},[v,d,h]);W(()=>v,[v]);let x=R(()=>{let G=c.current?.measure();return G==null?void 0:{contentLength:G.contentLength,scroll:G.scroll,scrollLength:G.scrollLength}},[c]),C=Rt("timeline-scroll-mode",e,"following-end"),w=fi(t);he(()=>()=>w.cancel(),[w,e]);let L=Rt("timeline-user-scroll-generation",e,0),S=Rt("timeline-live-follow-generation",e,0),k=Rt("timeline-disclosure-reading-lock",e,l0),I=Rt("timeline-last-row-id",e,null),T=R(()=>{w.cancel(),L.current+=1,C.current="free-scrolling",S.current=null,s(!1)},[w,S,C,s,L]),A=R(()=>{k.current.lock(),T(),g.current=!1,v(),d(!0)},[v,g,T,k,d]),P=N(T);P.current=T;let _=R(()=>{let G=c.current?.measure(),te=I.current;if(!G||te===null)return!1;let me=qI(G,te);return me===null?!1:me>Math.max(0,G.scrollLength-n-SU)},[n,c,I]),E=R(G=>{k.current.resume();let te=++L.current;g.current=!0,C.current="following-end",S.current=L.current,s(!0),v(),d(!1),w.request(()=>{d0({requestedGeneration:te,currentGeneration:L.current,mode:C.current,readingLocked:k.current.isLocked()})&&c.current?.scrollToEnd({animated:G})})},[v,w,c,g,S,k,C,s,d,L]),F=N(r);F.current=r;let B=R((G=!1)=>{let te=F.current;if(te){te(()=>E(G));return}E(G)},[E]),V=R(()=>B(!0),[B]),Q=R(()=>{k.current.navigate(!0)&&(g.current=!1,o.resolveIsAtEnd(x(),n)===!0&&B())},[o,n,g,x,k,B]);W(()=>{if(!t||f===null)return;let G=null,te=requestAnimationFrame(()=>{let me=()=>{P.current()},U=ae=>{let oe=ae instanceof Element?ae:null;for(;oe&&oe!==f;){if(oe instanceof HTMLElement&&oe.scrollHeight>oe.clientHeight+1&&oe.scrollTop+oe.clientHeight<oe.scrollHeight-1&&/auto|scroll/u.test(getComputedStyle(oe).overflowY))return!1;oe=oe.parentElement}return oe===f},Y=ae=>{k.current.isLocked()&&U(ae)&&Q()},se=null,ge=!1,ie=f.scrollTop,Ae=ae=>{se=ae.touches[0]?.clientY??null},Xe=()=>{se=null,ge=!1},nt=()=>{let ae=f.scrollTop;ge&&ae>ie&&Y(f),ie=ae},rt=()=>_(),Ve=()=>o.resolveIsAtEnd(x(),n)===!1,ne=ae=>{ae.deltaY>0&&Y(ae.target),ae.deltaY<0&&rt()&&me()},we=ae=>{let oe=ae.touches[0]?.clientY??null,ft=se!==null&&oe!==null&&oe<se;se=oe,Ve()&&me(),ft&&Y(ae.target)},j=ae=>{if(ae.target===f){ge=!0,ie=f.scrollTop,rt()&&me();return}Ve()&&me()},X=ae=>{if(!(ae.target instanceof Element?ae.target:null)?.closest("input, textarea, select, [contenteditable='true'], button, [role='button']"))switch(ae.key){case"PageUp":case"Home":case"ArrowUp":rt()&&me();break;case"PageDown":case"End":case"ArrowDown":Y(ae.target);break;case" ":ae.shiftKey||Y(ae.target);break;default:break}};f.addEventListener("wheel",ne,{passive:!0}),f.addEventListener("touchmove",we,{passive:!0}),f.addEventListener("touchstart",Ae,{passive:!0}),f.addEventListener("touchend",Xe,{passive:!0}),f.addEventListener("touchcancel",Xe,{passive:!0}),f.addEventListener("scroll",nt,{passive:!0}),window.addEventListener("pointerup",Xe,{passive:!0}),window.addEventListener("pointercancel",Xe,{passive:!0}),f.addEventListener("pointerdown",j,{passive:!0}),f.addEventListener("keydown",X),G=()=>{f.removeEventListener("wheel",ne),f.removeEventListener("touchmove",we),f.removeEventListener("touchstart",Ae),f.removeEventListener("touchend",Xe),f.removeEventListener("touchcancel",Xe),f.removeEventListener("scroll",nt),window.removeEventListener("pointerup",Xe),window.removeEventListener("pointercancel",Xe),f.removeEventListener("pointerdown",j),f.removeEventListener("keydown",X)}});return()=>{cancelAnimationFrame(te),G?.()}},[_,o,n,e,x,k,Q,f,t]);let Se=R(G=>{I.current=G},[I]),H=R(G=>{if(k.current.isLocked()){g.current=!1,v(),d(!0);return}if(!G&&S.current===L.current){v(),d(!1);return}g.current!==G&&(g.current=G,G?(C.current="following-end",S.current=L.current,s(!0),v(),d(!1)):(C.current="free-scrolling",S.current=null,y()))},[v,g,S,k,y,C,s,d,L]),q=N(B);q.current=B;let ee=K(()=>({followEnd:G=>q.current(G?.animated??!1)}),[]);return he(()=>(c0(a,ee),()=>c0(a,null)),[ee,a]),{liveFollowEnabled:i,showScrollToEnd:l,bindTimelineHandle:m,onRowsChange:Se,onIsAtEndChange:H,onManualNavigation:T,onDisclosureNavigation:A,returnToEnd:V}}ue();ue();var f0=["user-message","assistant-message","reasoning","tool-call","approval","user-input","compaction","retry","session","turn-intent","scheduled-wake","communication","delegation","task","event"];var p0=50,IU=32,Yh=class extends wa{getSnapshotBeforeUpdate(t){return(t.inputKey!==this.props.inputKey||t.rows!==this.props.rows||t.expandedRows!==this.props.expandedRows||t.visible&&!this.props.visible)&&t.capture(),null}componentDidUpdate(){}componentWillUnmount(){this.props.capture()}render(){return this.props.children}};function m0(e){let t=e.getBoundingClientRect();if(e.clientHeight<=0||t.height<=0)return[];let n=e.querySelector("thead"),o=t.top+(n?.getBoundingClientRect().height??0),r=e.querySelectorAll("[data-trajectory-chunk]"),a=cs(r,o),i=[];if(a<0)return i;for(let s=a;s<r.length;s+=1){let l=r[s];if(l.getBoundingClientRect().top>=t.bottom)break;let d=l.querySelectorAll("[data-timeline-row-id]"),c=cs(d,o);if(!(c<0))for(let f=c;f<d.length;f++){let p=d[f];if(p.getBoundingClientRect().top>=t.bottom)break;i.push(p)}}return i}function TU(e){let t=[];for(let n=0;n<e.length;n+=p0)t.push(e.slice(n,n+p0));return t}function kU({useToolCallDetail:e,threadRef:t,toolCallId:n,turnId:o,fallback:r,revision:a}){let i=e===void 0?null:e({threadRef:t,toolCallId:n,turnId:o??null,revision:a??r??"initial"}),s=i===null?[]:[i.input,i.output].filter(d=>d!==void 0&&d.length>0),l=i?.input!==void 0&&i?.output!==void 0?s.join(`
|
|
3760
3760
|
|
|
3761
3761
|
`):[r,...s].filter(Boolean).join(`
|
|
3762
3762
|
|
|
3763
|
-
`);return l.length===0?null:u("pre",{className:"max-h-80 overflow-auto rounded-md bg-muted/40 p-3 font-mono text-xs break-words whitespace-pre-wrap",children:l})}var p0=pe(function({inputKey:t,rows:n,loadEarlier:o,loadLater:r=null,pagingBlockedByInteraction:a=!1,onReturnToLatest:i=null,onVisibleTurnRangeChange:s=null,timestampFormat:l,paneVisible:d,useToolCallDetail:c,threadRef:f,resolveChatAnchorMessageId:p,onOpenInChat:m}){let{t:g}=eo(),[h,v]=ln("trajectory-kind-filter",t,"all"),[y,x]=ln("trajectory-expanded-rows",t,()=>new Set),[C,w]=ln("trajectory-follow-latest",t,!0),L=K(()=>{let ne=new Set(n.map(we=>we.kind));return c0.filter(we=>ne.has(we))},[n]),S=K(()=>h==="all"?n:n.filter(ne=>ne.kind===h),[n,h]),k=K(()=>SU(S),[S]),I=ne=>x(we=>{let j=new Set(we);return j.has(ne)?j.delete(ne):j.add(ne),j}),T=N(null),A=N(null),P=R(ne=>{T.current=ne,ne&&(A.current=ne)},[]),_=Rt("trajectory-at-end",t,!0),E=Rt("trajectory-scroll-top",t,0),F=Rt("trajectory-row-anchor",t,null),B=N({inputKey:t,paneVisible:d,pagingBlockedByInteraction:a});B.current={inputKey:t,paneVisible:d,pagingBlockedByInteraction:a};let V=N(null);he(()=>{if(V.current=null,!!d)return()=>{V.current=null,s?.(null)}},[t,d,s]);let Q=K(()=>({inputKey:t,store:lc()}),[t]),Se=N(Q);Se.current=Q;let H=N(()=>{}),q=R(ne=>{let we=Se.current;return we.store.acquire(ne,()=>{Se.current===we&&H.current()})},[]),ee=K(()=>{let ne=S.map((we,j)=>({key:we.id,turnId:we.turnId??null,firstRowIndex:j,endRowIndex:j+1}));return{sections:ne,bySectionKey:new Map(ne.map(we=>[we.key,we])),byRowId:new Map(ne.map(we=>[we.key,{turnId:we.turnId,index:we.firstRowIndex}]))}},[S]),G=R((ne,we)=>Array.from(ne.querySelectorAll("[data-trajectory-row-id]")).find(j=>j.dataset.trajectoryRowId===we),[]),te=R((ne,we)=>{let j=we[0]?.dataset.timelineRowId,X=j===void 0?void 0:G(ne,j);X&&j!==void 0&&(F.current={rowId:j,offset:ne.getBoundingClientRect().top-X.getBoundingClientRect().top})},[G,F]),me=R(()=>{if(!d)return;let ne=T.current??A.current;ne&&(E.current=ne.scrollTop,_.current=ne.scrollHeight-ne.scrollTop-ne.clientHeight<=wU,S.length>0&&te(ne,f0(ne)))},[_,S.length,d,te,E]),U=R(()=>B.current.inputKey===t&&B.current.paneVisible,[t]),Y=R(()=>{if(!U()||s===null)return;let ne=T.current;if(!ne||ne.clientHeight<=0)return;let we=f0(ne);te(ne,we);let j=Q.store.rows(),X=ne.ownerDocument.activeElement;if(Tl(X)){let ft=Il(X,ne);ft&&j.push(ft)}let ae=qf({index:ee,visibleSectionKeys:we.flatMap(ft=>{let pt=ft.dataset.timelineRowId;return pt===void 0?[]:[pt]}),protectedRowIds:j,selectionRows:Wf(ne)}),oe=JSON.stringify(ae);V.current!==oe&&(V.current=oe,s(ae))},[Q,U,s,ee,te]),se=pi(d),ge=R(()=>{U()&&s!==null&&se.request(Y)},[U,s,se,Y]);H.current=ge;let ie=R(ne=>{let we=F.current,j=we===null?void 0:G(ne,we.rowId),X=j?.closest("[data-trajectory-chunk]"),ae=X?.style.contentVisibility;X&&(X.style.contentVisibility="visible");try{ne.scrollTop=j===void 0?E.current:ne.scrollTop+j.getBoundingClientRect().top-ne.getBoundingClientRect().top+we.offset}finally{X&&(X.style.contentVisibility=ae??"")}},[G,F,E]),Ae=R(()=>{U()&&(me(),ge())},[me,U,ge]),Xe=R(()=>{!U()||B.current.pagingBlockedByInteraction||o?.loading||(me(),o?.onLoadEarlier())},[me,U,o]),nt=R(()=>{!U()||B.current.pagingBlockedByInteraction||r?.loading||(me(),r?.onLoadLater())},[me,U,r]),rt=R(()=>{U()&&i?.(()=>{if(!U())return;_.current=!0,w(!0);let ne=T.current;ne&&(ne.scrollTop=ne.scrollHeight)})},[U,i,_,w]),Ve=ne=>{if(U()){if(ne&&r!==null){rt();return}ne&&(_.current=!0),w(ne)}};return he(()=>{if(!U())return;let ne=T.current;ne&&(C&&_.current&&r===null?ne.scrollTop=ne.scrollHeight:ie(ne),ge())},[_,y,S,C,t,U,r,d,ge,ie]),he(()=>{let ne=T.current;if(!U()||s===null||!ne)return;let we=!0,j=()=>{we&&U()&&ge()},X=()=>{!we||!U()||(C&&_.current&&r===null?ne.scrollTop=ne.scrollHeight:ie(ne),j())},ae=typeof ResizeObserver>"u"?null:new ResizeObserver(X);ae?.observe(ne);let oe=ne.querySelector("table");return oe&&ae?.observe(oe),ne.addEventListener("focusin",j),ne.addEventListener("focusout",j),ne.ownerDocument.addEventListener("selectionchange",j),j(),()=>{we=!1,se.cancel(),ae?.disconnect(),ne.removeEventListener("focusin",j),ne.removeEventListener("focusout",j),ne.ownerDocument.removeEventListener("selectionchange",j)}},[_,C,t,U,r,s,d,se,ge,ie]),u(Jh,{inputKey:t,visible:d,rows:S,expandedRows:y,capture:me,children:u(sc,{value:q,children:b("div",{className:"flex min-h-0 flex-1 flex-col","data-trajectory-view":!0,children:[b("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1 border-b border-border px-3 py-1.5",children:[b("div",{role:"group","aria-label":g("trajectory.filterLabel"),className:"flex flex-wrap items-center gap-1",children:[u(ce,{size:"xs",variant:h==="all"?"secondary":"ghost","aria-pressed":h==="all",onClick:()=>v("all"),children:g("trajectory.filterAll")}),L.map(ne=>u(ce,{size:"xs",variant:h===ne?"secondary":"ghost","aria-pressed":h===ne,onClick:()=>v(ne),children:g(`trajectory.kinds.${ne}`)},ne))]}),u(dc,{className:"ml-auto",size:"xs",variant:"outline",pressed:C,onPressedChange:Ve,"aria-label":g("trajectory.followLatest"),children:g("trajectory.followLatest")})]}),b("div",{ref:P,className:"min-h-0 flex-1 overflow-auto",onScroll:Ae,"data-trajectory-scroll":!0,children:[o!==null?b("div",{className:"flex items-center justify-between gap-2 border-b border-border px-3 py-2 text-xs text-muted-foreground",children:[u("span",{children:g("trajectory.loadEarlier")}),u(ce,{size:"xs",variant:"outline",disabled:o.loading||a,onClick:Xe,children:o.loading?g("trajectory.loadingEarlier"):g("trajectory.loadEarlierAction")})]}):null,S.length===0?u("div",{className:"flex h-full items-center justify-center p-6 text-sm text-muted-foreground",children:g("trajectory.empty")}):b(oS,{children:[u(aS,{className:"sticky top-0 z-10 bg-background",children:b(Ff,{className:"hover:bg-transparent",children:[u(us,{className:"w-px whitespace-nowrap",children:g("trajectory.columnTime")}),u(us,{className:"w-px whitespace-nowrap",children:g("trajectory.columnType")}),u(us,{children:g("trajectory.columnSummary")}),u(us,{className:"w-px whitespace-nowrap",children:g("trajectory.columnStatus")}),u(us,{className:"w-px whitespace-nowrap",children:g("trajectory.columnDuration")}),u(us,{className:"w-px",children:u("span",{className:"sr-only",children:g("trajectory.openInChat")})})]})}),k.map((ne,we)=>u(rS,{className:"trajectory-chunk [&_tr:last-child]:border-b","data-trajectory-chunk":ne[0]?.id??we,children:ne.map(j=>{let X=y.has(j.id),ae=j.detail!==void 0||j.toolCallId!==void 0,oe=p(j);return u(vl,{value:j.id,children:[b(Ff,{"data-trajectory-row-id":j.id,"data-timeline-row-id":j.id,className:$(ae&&"cursor-pointer"),onClick:ae?()=>I(j.id):void 0,children:[u(ui,{className:"whitespace-nowrap text-muted-foreground",title:ra(j.createdAt,l),children:mi(j.createdAt,l,g)}),u(ui,{className:"whitespace-nowrap",children:g(`trajectory.kinds.${j.kind}`)}),u(ui,{className:"max-w-0 whitespace-normal",children:b("span",{className:"inline-flex items-start gap-1",children:[ae?u(ce,{size:"xs",variant:"ghost",className:"mt-0.5 size-4 min-w-4 shrink-0 px-0","aria-label":g(X?"trajectory.collapseRow":"trajectory.expandRow"),"aria-expanded":X,onClick:ft=>{ft.stopPropagation(),I(j.id)},children:X?u(sn,{"aria-hidden":!0}):u(Vo,{"aria-hidden":!0})}):null,u("span",{className:"break-words",children:j.summary})]})}),u(ui,{className:"whitespace-nowrap",children:g(`trajectory.status.${j.status}`)}),u(ui,{className:"whitespace-nowrap text-muted-foreground",children:j.durationMs!==void 0?La(j.durationMs):g("trajectory.valueUnknown")}),u(ui,{className:"whitespace-nowrap",children:oe!==null?b(Ye,{children:[u(Ze,{render:u(ce,{size:"xs",variant:"ghost","aria-label":g("trajectory.openInChat"),onClick:ft=>{ft.stopPropagation(),m(oe)}}),children:u(rs,{"aria-hidden":!0})}),u(Je,{side:"top",children:g("trajectory.openInChat")})]}):null})]},`${t}:${j.id}`),X&&ae?u(Ff,{className:"hover:bg-transparent","data-trajectory-detail-row":j.id,"data-timeline-row-id":j.id,children:b(ui,{colSpan:6,className:"whitespace-normal",children:[u("div",{className:"px-2 py-1 text-xs font-medium text-muted-foreground",children:g("trajectory.detailTitle")}),j.kind==="tool-call"&&j.toolCallId!==void 0?u(IU,{threadRef:f,useToolCallDetail:c,toolCallId:j.toolCallId,turnId:j.turnId,fallback:j.detail,revision:`${j.status}:${j.updatedActivityId??j.activityId??j.id}`}):j.detail!==void 0?u("pre",{className:"max-h-80 overflow-auto rounded-md bg-muted/40 p-3 font-mono text-xs break-words whitespace-pre-wrap",children:j.detail}):null]})},`${t}:${j.id}:detail`):null]},`${t}:${j.id}:owner`)})},`${t}:${ne[0]?.id??we}`))]}),r!==null?b("div",{className:"flex justify-center gap-2 px-3 py-2",children:[u(ce,{size:"xs",variant:"outline",disabled:r.loading||a,onClick:nt,children:r.loading?g("timeline.loadingLater"):g("timeline.loadLater")}),i===null?null:u(ce,{size:"xs",variant:"ghost",onClick:rt,children:g("timeline.returnToLatest")})]}):null]})]})})})});function m0({data:e,target:t,inputKey:n,paneVisible:o,timestampFormat:r,onOpenInChat:a}){let i=e.useTrajectory({target:t,threadKey:n,visible:o}),s=R(l=>e.useToolCallDetail(t,{toolCallId:l.toolCallId,turnId:l.turnId,revision:l.revision}),[e,t]);return u(p0,{inputKey:n,rows:i.rows,loadEarlier:i.loadEarlier,loadLater:i.loadLater,pagingBlockedByInteraction:i.pagingBlockedByInteraction,onReturnToLatest:i.onReturnToLatest,onVisibleTurnRangeChange:i.onVisibleTurnRangeChange,timestampFormat:r,paneVisible:o,threadRef:t,useToolCallDetail:s,resolveChatAnchorMessageId:i.resolveChatAnchorMessageId,onOpenInChat:a})}ue();ue();var xs=Md(Ic());ue();function C0(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return K(()=>o=>{t.forEach(r=>r(o))},t)}var Tc=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function ms(e){let t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function cp(e){return"nodeType"in e}function Co(e){var t,n;return e?ms(e)?e:cp(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function up(e){let{Document:t}=Co(e);return e instanceof t}function Rl(e){return ms(e)?!1:e instanceof Co(e).HTMLElement}function ev(e){return e instanceof Co(e).SVGElement}function gs(e){return e?ms(e)?e.document:cp(e)?up(e)?e:Rl(e)||ev(e)?e.ownerDocument:document:document:document}var ur=Tc?he:W;function fp(e){let t=N(e);return ur(()=>{t.current=e}),R(function(){for(var n=arguments.length,o=new Array(n),r=0;r<n;r++)o[r]=arguments[r];return t.current==null?void 0:t.current(...o)},[])}function b0(){let e=N(null),t=R((o,r)=>{e.current=setInterval(o,r)},[]),n=R(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function Ml(e,t){t===void 0&&(t=[e]);let n=N(e);return ur(()=>{n.current!==e&&(n.current=e)},t),n}function Nl(e,t){let n=N();return K(()=>{let o=e(n.current);return n.current=o,o},[...t])}function kc(e){let t=fp(e),n=N(null),o=R(r=>{r!==n.current&&t?.(r,n.current),n.current=r},[]);return[n,o]}function pp(e){let t=N();return W(()=>{t.current=e},[e]),t.current}var Zh={};function hs(e,t){return K(()=>{if(t)return t;let n=Zh[e]==null?0:Zh[e]+1;return Zh[e]=n,e+"-"+n},[e,t])}function w0(e){return function(t){for(var n=arguments.length,o=new Array(n>1?n-1:0),r=1;r<n;r++)o[r-1]=arguments[r];return o.reduce((a,i)=>{let s=Object.entries(i);for(let[l,d]of s){let c=a[l];c!=null&&(a[l]=c+e*d)}return a},{...t})}}var vs=w0(1),ys=w0(-1);function PU(e){return"clientX"in e&&"clientY"in e}function Lc(e){if(!e)return!1;let{KeyboardEvent:t}=Co(e.target);return t&&e instanceof t}function AU(e){if(!e)return!1;let{TouchEvent:t}=Co(e.target);return t&&e instanceof t}function Pc(e){if(AU(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return PU(e)?{x:e.clientX,y:e.clientY}:null}var yi=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[yi.Translate.toString(e),yi.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:o}=e;return t+" "+n+"ms "+o}}}),x0="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function S0(e){return e.matches(x0)?e:e.querySelector(x0)}ue();var EU={display:"none"};function I0(e){let{id:t,value:n}=e;return yn.createElement("div",{id:t,style:EU},n)}function T0(e){let{id:t,announcement:n,ariaLiveType:o="assertive"}=e,r={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return yn.createElement("div",{id:t,style:r,role:"status","aria-live":o,"aria-atomic":!0},n)}function k0(){let[e,t]=J("");return{announce:R(o=>{o!=null&&t(o)},[]),announcement:e}}var z0=Ct(null);function RU(e){let t=Ht(z0);W(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function MU(){let[e]=J(()=>new Set),t=R(o=>(e.add(o),()=>e.delete(o)),[e]);return[R(o=>{let{type:r,event:a}=o;e.forEach(i=>{var s;return(s=i[r])==null?void 0:s.call(i,a)})},[e]),t]}var NU={draggable:`
|
|
3763
|
+
`);return l.length===0?null:u("pre",{className:"max-h-80 overflow-auto rounded-md bg-muted/40 p-3 font-mono text-xs break-words whitespace-pre-wrap",children:l})}var g0=pe(function({inputKey:t,rows:n,loadEarlier:o,loadLater:r=null,pagingBlockedByInteraction:a=!1,onReturnToLatest:i=null,onVisibleTurnRangeChange:s=null,timestampFormat:l,paneVisible:d,useToolCallDetail:c,threadRef:f,resolveChatAnchorMessageId:p,onOpenInChat:m}){let{t:g}=eo(),[h,v]=sn("trajectory-kind-filter",t,"all"),[y,x]=sn("trajectory-expanded-rows",t,()=>new Set),[C,w]=sn("trajectory-follow-latest",t,!0),L=K(()=>{let ne=new Set(n.map(we=>we.kind));return f0.filter(we=>ne.has(we))},[n]),S=K(()=>h==="all"?n:n.filter(ne=>ne.kind===h),[n,h]),k=K(()=>TU(S),[S]),I=ne=>x(we=>{let j=new Set(we);return j.has(ne)?j.delete(ne):j.add(ne),j}),T=N(null),A=N(null),P=R(ne=>{T.current=ne,ne&&(A.current=ne)},[]),_=Rt("trajectory-at-end",t,!0),E=Rt("trajectory-scroll-top",t,0),F=Rt("trajectory-row-anchor",t,null),B=N({inputKey:t,paneVisible:d,pagingBlockedByInteraction:a});B.current={inputKey:t,paneVisible:d,pagingBlockedByInteraction:a};let V=N(null);he(()=>{if(V.current=null,!!d)return()=>{V.current=null,s?.(null)}},[t,d,s]);let Q=K(()=>({inputKey:t,store:sc()}),[t]),Se=N(Q);Se.current=Q;let H=N(()=>{}),q=R(ne=>{let we=Se.current;return we.store.acquire(ne,()=>{Se.current===we&&H.current()})},[]),ee=K(()=>{let ne=S.map((we,j)=>({key:we.id,turnId:we.turnId??null,firstRowIndex:j,endRowIndex:j+1}));return{sections:ne,bySectionKey:new Map(ne.map(we=>[we.key,we])),byRowId:new Map(ne.map(we=>[we.key,{turnId:we.turnId,index:we.firstRowIndex}]))}},[S]),G=R((ne,we)=>Array.from(ne.querySelectorAll("[data-trajectory-row-id]")).find(j=>j.dataset.trajectoryRowId===we),[]),te=R((ne,we)=>{let j=we[0]?.dataset.timelineRowId,X=j===void 0?void 0:G(ne,j);X&&j!==void 0&&(F.current={rowId:j,offset:ne.getBoundingClientRect().top-X.getBoundingClientRect().top})},[G,F]),me=R(()=>{if(!d)return;let ne=T.current??A.current;ne&&(E.current=ne.scrollTop,_.current=ne.scrollHeight-ne.scrollTop-ne.clientHeight<=IU,S.length>0&&te(ne,m0(ne)))},[_,S.length,d,te,E]),U=R(()=>B.current.inputKey===t&&B.current.paneVisible,[t]),Y=R(()=>{if(!U()||s===null)return;let ne=T.current;if(!ne||ne.clientHeight<=0)return;let we=m0(ne);te(ne,we);let j=Q.store.rows(),X=ne.ownerDocument.activeElement;if(Il(X)){let ft=Sl(X,ne);ft&&j.push(ft)}let ae=Vf({index:ee,visibleSectionKeys:we.flatMap(ft=>{let pt=ft.dataset.timelineRowId;return pt===void 0?[]:[pt]}),protectedRowIds:j,selectionRows:qf(ne)}),oe=JSON.stringify(ae);V.current!==oe&&(V.current=oe,s(ae))},[Q,U,s,ee,te]),se=fi(d),ge=R(()=>{U()&&s!==null&&se.request(Y)},[U,s,se,Y]);H.current=ge;let ie=R(ne=>{let we=F.current,j=we===null?void 0:G(ne,we.rowId),X=j?.closest("[data-trajectory-chunk]"),ae=X?.style.contentVisibility;X&&(X.style.contentVisibility="visible");try{ne.scrollTop=j===void 0?E.current:ne.scrollTop+j.getBoundingClientRect().top-ne.getBoundingClientRect().top+we.offset}finally{X&&(X.style.contentVisibility=ae??"")}},[G,F,E]),Ae=R(()=>{U()&&(me(),ge())},[me,U,ge]),Xe=R(()=>{!U()||B.current.pagingBlockedByInteraction||o?.loading||(me(),o?.onLoadEarlier())},[me,U,o]),nt=R(()=>{!U()||B.current.pagingBlockedByInteraction||r?.loading||(me(),r?.onLoadLater())},[me,U,r]),rt=R(()=>{U()&&i?.(()=>{if(!U())return;_.current=!0,w(!0);let ne=T.current;ne&&(ne.scrollTop=ne.scrollHeight)})},[U,i,_,w]),Ve=ne=>{if(U()){if(ne&&r!==null){rt();return}ne&&(_.current=!0),w(ne)}};return he(()=>{if(!U())return;let ne=T.current;ne&&(C&&_.current&&r===null?ne.scrollTop=ne.scrollHeight:ie(ne),ge())},[_,y,S,C,t,U,r,d,ge,ie]),he(()=>{let ne=T.current;if(!U()||s===null||!ne)return;let we=!0,j=()=>{we&&U()&&ge()},X=()=>{!we||!U()||(C&&_.current&&r===null?ne.scrollTop=ne.scrollHeight:ie(ne),j())},ae=typeof ResizeObserver>"u"?null:new ResizeObserver(X);ae?.observe(ne);let oe=ne.querySelector("table");return oe&&ae?.observe(oe),ne.addEventListener("focusin",j),ne.addEventListener("focusout",j),ne.ownerDocument.addEventListener("selectionchange",j),j(),()=>{we=!1,se.cancel(),ae?.disconnect(),ne.removeEventListener("focusin",j),ne.removeEventListener("focusout",j),ne.ownerDocument.removeEventListener("selectionchange",j)}},[_,C,t,U,r,s,d,se,ge,ie]),u(Yh,{inputKey:t,visible:d,rows:S,expandedRows:y,capture:me,children:u(ic,{value:q,children:b("div",{className:"flex min-h-0 flex-1 flex-col","data-trajectory-view":!0,children:[b("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1 border-b border-border px-3 py-1.5",children:[b("div",{role:"group","aria-label":g("trajectory.filterLabel"),className:"flex flex-wrap items-center gap-1",children:[u(ce,{size:"xs",variant:h==="all"?"secondary":"ghost","aria-pressed":h==="all",onClick:()=>v("all"),children:g("trajectory.filterAll")}),L.map(ne=>u(ce,{size:"xs",variant:h===ne?"secondary":"ghost","aria-pressed":h===ne,onClick:()=>v(ne),children:g(`trajectory.kinds.${ne}`)},ne))]}),u(lc,{className:"ml-auto",size:"xs",variant:"outline",pressed:C,onPressedChange:Ve,"aria-label":g("trajectory.followLatest"),children:g("trajectory.followLatest")})]}),b("div",{ref:P,className:"min-h-0 flex-1 overflow-auto",onScroll:Ae,"data-trajectory-scroll":!0,children:[o!==null?b("div",{className:"flex items-center justify-between gap-2 border-b border-border px-3 py-2 text-xs text-muted-foreground",children:[u("span",{children:g("trajectory.loadEarlier")}),u(ce,{size:"xs",variant:"outline",disabled:o.loading||a,onClick:Xe,children:o.loading?g("trajectory.loadingEarlier"):g("trajectory.loadEarlierAction")})]}):null,S.length===0?u("div",{className:"flex h-full items-center justify-center p-6 text-sm text-muted-foreground",children:g("trajectory.empty")}):b(nS,{children:[u(rS,{className:"sticky top-0 z-10 bg-background",children:b(Of,{className:"hover:bg-transparent",children:[u(ds,{className:"w-px whitespace-nowrap",children:g("trajectory.columnTime")}),u(ds,{className:"w-px whitespace-nowrap",children:g("trajectory.columnType")}),u(ds,{children:g("trajectory.columnSummary")}),u(ds,{className:"w-px whitespace-nowrap",children:g("trajectory.columnStatus")}),u(ds,{className:"w-px whitespace-nowrap",children:g("trajectory.columnDuration")}),u(ds,{className:"w-px",children:u("span",{className:"sr-only",children:g("trajectory.openInChat")})})]})}),k.map((ne,we)=>u(oS,{className:"trajectory-chunk [&_tr:last-child]:border-b","data-trajectory-chunk":ne[0]?.id??we,children:ne.map(j=>{let X=y.has(j.id),ae=j.detail!==void 0||j.toolCallId!==void 0,oe=p(j);return u(hl,{value:j.id,children:[b(Of,{"data-trajectory-row-id":j.id,"data-timeline-row-id":j.id,className:$(ae&&"cursor-pointer"),onClick:ae?()=>I(j.id):void 0,children:[u(ci,{className:"whitespace-nowrap text-muted-foreground",title:ra(j.createdAt,l),children:pi(j.createdAt,l,g)}),u(ci,{className:"whitespace-nowrap",children:g(`trajectory.kinds.${j.kind}`)}),u(ci,{className:"max-w-0 whitespace-normal",children:b("span",{className:"inline-flex items-start gap-1",children:[ae?u(ce,{size:"xs",variant:"ghost",className:"mt-0.5 size-4 min-w-4 shrink-0 px-0","aria-label":g(X?"trajectory.collapseRow":"trajectory.expandRow"),"aria-expanded":X,onClick:ft=>{ft.stopPropagation(),I(j.id)},children:X?u(an,{"aria-hidden":!0}):u(Ko,{"aria-hidden":!0})}):null,u("span",{className:"break-words",children:j.summary})]})}),u(ci,{className:"whitespace-nowrap",children:g(`trajectory.status.${j.status}`)}),u(ci,{className:"whitespace-nowrap text-muted-foreground",children:j.durationMs!==void 0?ka(j.durationMs):g("trajectory.valueUnknown")}),u(ci,{className:"whitespace-nowrap",children:oe!==null?b(Ye,{children:[u(Ze,{render:u(ce,{size:"xs",variant:"ghost","aria-label":g("trajectory.openInChat"),onClick:ft=>{ft.stopPropagation(),m(oe)}}),children:u(ns,{"aria-hidden":!0})}),u(Je,{side:"top",children:g("trajectory.openInChat")})]}):null})]},`${t}:${j.id}`),X&&ae?u(Of,{className:"hover:bg-transparent","data-trajectory-detail-row":j.id,"data-timeline-row-id":j.id,children:b(ci,{colSpan:6,className:"whitespace-normal",children:[u("div",{className:"px-2 py-1 text-xs font-medium text-muted-foreground",children:g("trajectory.detailTitle")}),j.kind==="tool-call"&&j.toolCallId!==void 0?u(kU,{threadRef:f,useToolCallDetail:c,toolCallId:j.toolCallId,turnId:j.turnId,fallback:j.detail,revision:`${j.status}:${j.updatedActivityId??j.activityId??j.id}`}):j.detail!==void 0?u("pre",{className:"max-h-80 overflow-auto rounded-md bg-muted/40 p-3 font-mono text-xs break-words whitespace-pre-wrap",children:j.detail}):null]})},`${t}:${j.id}:detail`):null]},`${t}:${j.id}:owner`)})},`${t}:${ne[0]?.id??we}`))]}),r!==null?b("div",{className:"flex justify-center gap-2 px-3 py-2",children:[u(ce,{size:"xs",variant:"outline",disabled:r.loading||a,onClick:nt,children:r.loading?g("timeline.loadingLater"):g("timeline.loadLater")}),i===null?null:u(ce,{size:"xs",variant:"ghost",onClick:rt,children:g("timeline.returnToLatest")})]}):null]})]})})})});function h0({data:e,target:t,inputKey:n,paneVisible:o,timestampFormat:r,onOpenInChat:a}){let i=e.useTrajectory({target:t,threadKey:n,visible:o}),s=R(l=>e.useToolCallDetail(t,{toolCallId:l.toolCallId,turnId:l.turnId,revision:l.revision}),[e,t]);return u(g0,{inputKey:n,rows:i.rows,loadEarlier:i.loadEarlier,loadLater:i.loadLater,pagingBlockedByInteraction:i.pagingBlockedByInteraction,onReturnToLatest:i.onReturnToLatest,onVisibleTurnRangeChange:i.onVisibleTurnRangeChange,timestampFormat:r,paneVisible:o,threadRef:t,useToolCallDetail:s,resolveChatAnchorMessageId:i.resolveChatAnchorMessageId,onOpenInChat:a})}ue();ue();var vs=Rd(Sc());ue();function w0(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return K(()=>o=>{t.forEach(r=>r(o))},t)}var Ic=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function fs(e){let t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function dp(e){return"nodeType"in e}function Co(e){var t,n;return e?fs(e)?e:dp(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function cp(e){let{Document:t}=Co(e);return e instanceof t}function El(e){return fs(e)?!1:e instanceof Co(e).HTMLElement}function Zh(e){return e instanceof Co(e).SVGElement}function ps(e){return e?fs(e)?e.document:dp(e)?cp(e)?e:El(e)||Zh(e)?e.ownerDocument:document:document:document}var cr=Ic?he:W;function up(e){let t=N(e);return cr(()=>{t.current=e}),R(function(){for(var n=arguments.length,o=new Array(n),r=0;r<n;r++)o[r]=arguments[r];return t.current==null?void 0:t.current(...o)},[])}function S0(){let e=N(null),t=R((o,r)=>{e.current=setInterval(o,r)},[]),n=R(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function Rl(e,t){t===void 0&&(t=[e]);let n=N(e);return cr(()=>{n.current!==e&&(n.current=e)},t),n}function Ml(e,t){let n=N();return K(()=>{let o=e(n.current);return n.current=o,o},[...t])}function Tc(e){let t=up(e),n=N(null),o=R(r=>{r!==n.current&&t?.(r,n.current),n.current=r},[]);return[n,o]}function fp(e){let t=N();return W(()=>{t.current=e},[e]),t.current}var Jh={};function ms(e,t){return K(()=>{if(t)return t;let n=Jh[e]==null?0:Jh[e]+1;return Jh[e]=n,e+"-"+n},[e,t])}function I0(e){return function(t){for(var n=arguments.length,o=new Array(n>1?n-1:0),r=1;r<n;r++)o[r-1]=arguments[r];return o.reduce((a,i)=>{let s=Object.entries(i);for(let[l,d]of s){let c=a[l];c!=null&&(a[l]=c+e*d)}return a},{...t})}}var gs=I0(1),hs=I0(-1);function EU(e){return"clientX"in e&&"clientY"in e}function kc(e){if(!e)return!1;let{KeyboardEvent:t}=Co(e.target);return t&&e instanceof t}function RU(e){if(!e)return!1;let{TouchEvent:t}=Co(e.target);return t&&e instanceof t}function Lc(e){if(RU(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return EU(e)?{x:e.clientX,y:e.clientY}:null}var vi=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[vi.Translate.toString(e),vi.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:o}=e;return t+" "+n+"ms "+o}}}),b0="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function T0(e){return e.matches(b0)?e:e.querySelector(b0)}ue();var MU={display:"none"};function k0(e){let{id:t,value:n}=e;return yn.createElement("div",{id:t,style:MU},n)}function L0(e){let{id:t,announcement:n,ariaLiveType:o="assertive"}=e,r={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return yn.createElement("div",{id:t,style:r,role:"status","aria-live":o,"aria-atomic":!0},n)}function P0(){let[e,t]=J("");return{announce:R(o=>{o!=null&&t(o)},[]),announcement:e}}var H0=bt(null);function NU(e){let t=Ht(H0);W(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function _U(){let[e]=J(()=>new Set),t=R(o=>(e.add(o),()=>e.delete(o)),[e]);return[R(o=>{let{type:r,event:a}=o;e.forEach(i=>{var s;return(s=i[r])==null?void 0:s.call(i,a)})},[e]),t]}var DU={draggable:`
|
|
3764
3764
|
To pick up a draggable item, press the space bar.
|
|
3765
3765
|
While dragging, use the arrow keys to move the item.
|
|
3766
3766
|
Press space again to drop the item in its new position, or press escape to cancel.
|
|
3767
|
-
`},_U={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function DU(e){let{announcements:t=_U,container:n,hiddenTextDescribedById:o,screenReaderInstructions:r=NU}=e,{announce:a,announcement:i}=k0(),s=hs("DndLiveRegion"),[l,d]=J(!1);if(W(()=>{d(!0)},[]),RU(K(()=>({onDragStart(f){let{active:p}=f;a(t.onDragStart({active:p}))},onDragMove(f){let{active:p,over:m}=f;t.onDragMove&&a(t.onDragMove({active:p,over:m}))},onDragOver(f){let{active:p,over:m}=f;a(t.onDragOver({active:p,over:m}))},onDragEnd(f){let{active:p,over:m}=f;a(t.onDragEnd({active:p,over:m}))},onDragCancel(f){let{active:p,over:m}=f;a(t.onDragCancel({active:p,over:m}))}}),[a,t])),!l)return null;let c=yn.createElement(yn.Fragment,null,yn.createElement(I0,{id:o,value:r.draggable}),yn.createElement(T0,{id:s,announcement:i}));return n?(0,xs.createPortal)(c,n):c}var Dn;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(Dn||(Dn={}));function gp(){}function dv(e,t){return K(()=>({sensor:e,options:t??{}}),[e,t])}function U0(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return K(()=>[...t].filter(o=>o!=null),[...t])}var Ar=Object.freeze({x:0,y:0});function H0(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function $0(e,t){let{data:{value:n}}=e,{data:{value:o}}=t;return n-o}function OU(e,t){let{data:{value:n}}=e,{data:{value:o}}=t;return o-n}function L0(e){let{left:t,top:n,height:o,width:r}=e;return[{x:t,y:n},{x:t+r,y:n},{x:t,y:n+o},{x:t+r,y:n+o}]}function cv(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}function P0(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}var K0=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:o}=e,r=P0(t,t.left,t.top),a=[];for(let i of o){let{id:s}=i,l=n.get(s);if(l){let d=H0(P0(l),r);a.push({id:s,data:{droppableContainer:i,value:d}})}}return a.sort($0)},V0=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:o}=e,r=L0(t),a=[];for(let i of o){let{id:s}=i,l=n.get(s);if(l){let d=L0(l),c=r.reduce((p,m,g)=>p+H0(d[g],m),0),f=Number((c/4).toFixed(4));a.push({id:s,data:{droppableContainer:i,value:f}})}}return a.sort($0)};function FU(e,t){let n=Math.max(t.top,e.top),o=Math.max(t.left,e.left),r=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),i=r-o,s=a-n;if(o<r&&n<a){let l=t.width*t.height,d=e.width*e.height,c=i*s,f=c/(l+d-c);return Number(f.toFixed(4))}return 0}var BU=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:o}=e,r=[];for(let a of o){let{id:i}=a,s=n.get(i);if(s){let l=FU(s,t);l>0&&r.push({id:i,data:{droppableContainer:a,value:l}})}}return r.sort(OU)};function zU(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function q0(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Ar}function UU(e){return function(n){for(var o=arguments.length,r=new Array(o>1?o-1:0),a=1;a<o;a++)r[a-1]=arguments[a];return r.reduce((i,s)=>({...i,top:i.top+e*s.y,bottom:i.bottom+e*s.y,left:i.left+e*s.x,right:i.right+e*s.x}),{...n})}}var HU=UU(1);function $U(e){if(e.startsWith("matrix3d(")){let t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){let t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function KU(e,t,n){let o=$U(t);if(!o)return e;let{scaleX:r,scaleY:a,x:i,y:s}=o,l=e.left-i-(1-r)*parseFloat(n),d=e.top-s-(1-a)*parseFloat(n.slice(n.indexOf(" ")+1)),c=r?e.width/r:e.width,f=a?e.height/a:e.height;return{width:c,height:f,top:d,right:l+c,bottom:d+f,left:l}}var VU={ignoreTransform:!1};function ws(e,t){t===void 0&&(t=VU);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:d,transformOrigin:c}=Co(e).getComputedStyle(e);d&&(n=KU(n,d,c))}let{top:o,left:r,width:a,height:i,bottom:s,right:l}=n;return{top:o,left:r,width:a,height:i,bottom:s,right:l}}function A0(e){return ws(e,{ignoreTransform:!0})}function qU(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function WU(e,t){return t===void 0&&(t=Co(e).getComputedStyle(e)),t.position==="fixed"}function GU(e,t){t===void 0&&(t=Co(e).getComputedStyle(e));let n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(r=>{let a=t[r];return typeof a=="string"?n.test(a):!1})}function Nc(e,t){let n=[];function o(r){if(t!=null&&n.length>=t||!r)return n;if(up(r)&&r.scrollingElement!=null&&!n.includes(r.scrollingElement))return n.push(r.scrollingElement),n;if(!Rl(r)||ev(r)||n.includes(r))return n;let a=Co(e).getComputedStyle(r);return r!==e&&GU(r,a)&&n.push(r),WU(r,a)?n:o(r.parentNode)}return e?o(e):n}function W0(e){let[t]=Nc(e,1);return t??null}function tv(e){return!Tc||!e?null:ms(e)?e:cp(e)?up(e)||e===gs(e).scrollingElement?window:Rl(e)?e:null:null}function G0(e){return ms(e)?e.scrollX:e.scrollLeft}function j0(e){return ms(e)?e.scrollY:e.scrollTop}function rv(e){return{x:G0(e),y:j0(e)}}var Un;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Un||(Un={}));function Q0(e){return!Tc||!e?!1:e===document.scrollingElement}function X0(e){let t={x:0,y:0},n=Q0(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},o={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},r=e.scrollTop<=t.y,a=e.scrollLeft<=t.x,i=e.scrollTop>=o.y,s=e.scrollLeft>=o.x;return{isTop:r,isLeft:a,isBottom:i,isRight:s,maxScroll:o,minScroll:t}}var jU={x:.2,y:.2};function QU(e,t,n,o,r){let{top:a,left:i,right:s,bottom:l}=n;o===void 0&&(o=10),r===void 0&&(r=jU);let{isTop:d,isBottom:c,isLeft:f,isRight:p}=X0(e),m={x:0,y:0},g={x:0,y:0},h={height:t.height*r.y,width:t.width*r.x};return!d&&a<=t.top+h.height?(m.y=Un.Backward,g.y=o*Math.abs((t.top+h.height-a)/h.height)):!c&&l>=t.bottom-h.height&&(m.y=Un.Forward,g.y=o*Math.abs((t.bottom-h.height-l)/h.height)),!p&&s>=t.right-h.width?(m.x=Un.Forward,g.x=o*Math.abs((t.right-h.width-s)/h.width)):!f&&i<=t.left+h.width&&(m.x=Un.Backward,g.x=o*Math.abs((t.left+h.width-i)/h.width)),{direction:m,speed:g}}function XU(e){if(e===document.scrollingElement){let{innerWidth:a,innerHeight:i}=window;return{top:0,left:0,right:a,bottom:i,width:a,height:i}}let{top:t,left:n,right:o,bottom:r}=e.getBoundingClientRect();return{top:t,left:n,right:o,bottom:r,width:e.clientWidth,height:e.clientHeight}}function Y0(e){return e.reduce((t,n)=>vs(t,rv(n)),Ar)}function YU(e){return e.reduce((t,n)=>t+G0(n),0)}function JU(e){return e.reduce((t,n)=>t+j0(n),0)}function ZU(e,t){if(t===void 0&&(t=ws),!e)return;let{top:n,left:o,bottom:r,right:a}=t(e);W0(e)&&(r<=0||a<=0||n>=window.innerHeight||o>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}var e5=[["x",["left","right"],YU],["y",["top","bottom"],JU]],Ec=class{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;let o=Nc(n),r=Y0(o);this.rect={...t},this.width=t.width,this.height=t.height;for(let[a,i,s]of e5)for(let l of i)Object.defineProperty(this,l,{get:()=>{let d=s(o),c=r[a]-d;return this.rect[l]+c},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}},Cs=class{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var o;return(o=this.target)==null?void 0:o.removeEventListener(...n)})},this.target=t}add(t,n,o){var r;(r=this.target)==null||r.addEventListener(t,n,o),this.listeners.push([t,n,o])}};function t5(e){let{EventTarget:t}=Co(e);return e instanceof t?e:gs(e)}function nv(e,t){let n=Math.abs(e.x),o=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+o**2)>t:"x"in t&&"y"in t?n>t.x&&o>t.y:"x"in t?n>t.x:"y"in t?o>t.y:!1}var fr;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(fr||(fr={}));function E0(e){e.preventDefault()}function n5(e){e.stopPropagation()}var Tt;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(Tt||(Tt={}));var J0={start:[Tt.Space,Tt.Enter],cancel:[Tt.Esc],end:[Tt.Space,Tt.Enter,Tt.Tab]},o5=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case Tt.Right:return{...n,x:n.x+25};case Tt.Left:return{...n,x:n.x-25};case Tt.Down:return{...n,y:n.y+25};case Tt.Up:return{...n,y:n.y-25}}},_l=class{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;let{event:{target:n}}=t;this.props=t,this.listeners=new Cs(gs(n)),this.windowListeners=new Cs(Co(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(fr.Resize,this.handleCancel),this.windowListeners.add(fr.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(fr.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:t,onStart:n}=this.props,o=t.node.current;o&&ZU(o),n(Ar)}handleKeyDown(t){if(Lc(t)){let{active:n,context:o,options:r}=this.props,{keyboardCodes:a=J0,coordinateGetter:i=o5,scrollBehavior:s="smooth"}=r,{code:l}=t;if(a.end.includes(l)){this.handleEnd(t);return}if(a.cancel.includes(l)){this.handleCancel(t);return}let{collisionRect:d}=o.current,c=d?{x:d.left,y:d.top}:Ar;this.referenceCoordinates||(this.referenceCoordinates=c);let f=i(t,{active:n,context:o.current,currentCoordinates:c});if(f){let p=ys(f,c),m={x:0,y:0},{scrollableAncestors:g}=o.current;for(let h of g){let v=t.code,{isTop:y,isRight:x,isLeft:C,isBottom:w,maxScroll:L,minScroll:S}=X0(h),k=XU(h),I={x:Math.min(v===Tt.Right?k.right-k.width/2:k.right,Math.max(v===Tt.Right?k.left:k.left+k.width/2,f.x)),y:Math.min(v===Tt.Down?k.bottom-k.height/2:k.bottom,Math.max(v===Tt.Down?k.top:k.top+k.height/2,f.y))},T=v===Tt.Right&&!x||v===Tt.Left&&!C,A=v===Tt.Down&&!w||v===Tt.Up&&!y;if(T&&I.x!==f.x){let P=h.scrollLeft+p.x,_=v===Tt.Right&&P<=L.x||v===Tt.Left&&P>=S.x;if(_&&!p.y){h.scrollTo({left:P,behavior:s});return}_?m.x=h.scrollLeft-P:m.x=v===Tt.Right?h.scrollLeft-L.x:h.scrollLeft-S.x,m.x&&h.scrollBy({left:-m.x,behavior:s});break}else if(A&&I.y!==f.y){let P=h.scrollTop+p.y,_=v===Tt.Down&&P<=L.y||v===Tt.Up&&P>=S.y;if(_&&!p.x){h.scrollTo({top:P,behavior:s});return}_?m.y=h.scrollTop-P:m.y=v===Tt.Down?h.scrollTop-L.y:h.scrollTop-S.y,m.y&&h.scrollBy({top:-m.y,behavior:s});break}}this.handleMove(t,vs(ys(f,this.referenceCoordinates),m))}}}handleMove(t,n){let{onMove:o}=this.props;t.preventDefault(),o(n)}handleEnd(t){let{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){let{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}};_l.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:o=J0,onActivation:r}=t,{active:a}=n,{code:i}=e.nativeEvent;if(o.start.includes(i)){let s=a.activatorNode.current;return s&&e.target!==s?!1:(e.preventDefault(),r?.({event:e.nativeEvent}),!0)}return!1}}];function R0(e){return!!(e&&"distance"in e)}function M0(e){return!!(e&&"delay"in e)}var Rc=class{constructor(t,n,o){var r;o===void 0&&(o=t5(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;let{event:a}=t,{target:i}=a;this.props=t,this.events=n,this.document=gs(i),this.documentListeners=new Cs(this.document),this.listeners=new Cs(o),this.windowListeners=new Cs(Co(i)),this.initialCoordinates=(r=Pc(a))!=null?r:Ar,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){let{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:o}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(fr.Resize,this.handleCancel),this.windowListeners.add(fr.DragStart,E0),this.windowListeners.add(fr.VisibilityChange,this.handleCancel),this.windowListeners.add(fr.ContextMenu,E0),this.documentListeners.add(fr.Keydown,this.handleKeydown),n){if(o!=null&&o({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(M0(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(R0(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){let{active:o,onPending:r}=this.props;r(o,t,this.initialCoordinates,n)}handleStart(){let{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(fr.Click,n5,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(fr.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;let{activated:o,initialCoordinates:r,props:a}=this,{onMove:i,options:{activationConstraint:s}}=a;if(!r)return;let l=(n=Pc(t))!=null?n:Ar,d=ys(r,l);if(!o&&s){if(R0(s)){if(s.tolerance!=null&&nv(d,s.tolerance))return this.handleCancel();if(nv(d,s.distance))return this.handleStart()}if(M0(s)&&nv(d,s.tolerance))return this.handleCancel();this.handlePending(s,d);return}t.cancelable&&t.preventDefault(),i(l)}handleEnd(){let{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){let{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===Tt.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}},r5={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}},Dl=class extends Rc{constructor(t){let{event:n}=t,o=gs(n.target);super(t,r5,o)}};Dl.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:o}=t;return!n.isPrimary||n.button!==0?!1:(o?.({event:n}),!0)}}];var a5={move:{name:"mousemove"},end:{name:"mouseup"}},av;(function(e){e[e.RightClick=2]="RightClick"})(av||(av={}));var iv=class extends Rc{constructor(t){super(t,a5,gs(t.event.target))}};iv.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:o}=t;return n.button===av.RightClick?!1:(o?.({event:n}),!0)}}];var ov={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}},sv=class extends Rc{constructor(t){super(t,ov)}static setup(){return window.addEventListener(ov.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(ov.move.name,t)};function t(){}}};sv.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:o}=t,{touches:r}=n;return r.length>1?!1:(o?.({event:n}),!0)}}];var Ac;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Ac||(Ac={}));var hp;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(hp||(hp={}));function i5(e){let{acceleration:t,activator:n=Ac.Pointer,canScroll:o,draggingRect:r,enabled:a,interval:i=5,order:s=hp.TreeOrder,pointerCoordinates:l,scrollableAncestors:d,scrollableAncestorRects:c,delta:f,threshold:p}=e,m=l5({delta:f,disabled:!a}),[g,h]=b0(),v=N({x:0,y:0}),y=N({x:0,y:0}),x=K(()=>{switch(n){case Ac.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case Ac.DraggableRect:return r}},[n,r,l]),C=N(null),w=R(()=>{let S=C.current;if(!S)return;let k=v.current.x*y.current.x,I=v.current.y*y.current.y;S.scrollBy(k,I)},[]),L=K(()=>s===hp.TreeOrder?[...d].reverse():d,[s,d]);W(()=>{if(!a||!d.length||!x){h();return}for(let S of L){if(o?.(S)===!1)continue;let k=d.indexOf(S),I=c[k];if(!I)continue;let{direction:T,speed:A}=QU(S,I,x,t,p);for(let P of["x","y"])m[P][T[P]]||(A[P]=0,T[P]=0);if(A.x>0||A.y>0){h(),C.current=S,g(w,i),v.current=A,y.current=T;return}}v.current={x:0,y:0},y.current={x:0,y:0},h()},[t,w,o,h,a,i,JSON.stringify(x),JSON.stringify(m),g,d,L,c,JSON.stringify(p)])}var s5={x:{[Un.Backward]:!1,[Un.Forward]:!1},y:{[Un.Backward]:!1,[Un.Forward]:!1}};function l5(e){let{delta:t,disabled:n}=e,o=pp(t);return Nl(r=>{if(n||!o||!r)return s5;let a={x:Math.sign(t.x-o.x),y:Math.sign(t.y-o.y)};return{x:{[Un.Backward]:r.x[Un.Backward]||a.x===-1,[Un.Forward]:r.x[Un.Forward]||a.x===1},y:{[Un.Backward]:r.y[Un.Backward]||a.y===-1,[Un.Forward]:r.y[Un.Forward]||a.y===1}}},[n,t,o])}function d5(e,t){let n=t!=null?e.get(t):void 0,o=n?n.node.current:null;return Nl(r=>{var a;return t==null?null:(a=o??r)!=null?a:null},[o,t])}function c5(e,t){return K(()=>e.reduce((n,o)=>{let{sensor:r}=o,a=r.activators.map(i=>({eventName:i.eventName,handler:t(i.handler,o)}));return[...n,...a]},[]),[e,t])}var Mc;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Mc||(Mc={}));var lv;(function(e){e.Optimized="optimized"})(lv||(lv={}));var N0=new Map;function u5(e,t){let{dragging:n,dependencies:o,config:r}=t,[a,i]=J(null),{frequency:s,measure:l,strategy:d}=r,c=N(e),f=v(),p=Ml(f),m=R(function(y){y===void 0&&(y=[]),!p.current&&i(x=>x===null?y:x.concat(y.filter(C=>!x.includes(C))))},[p]),g=N(null),h=Nl(y=>{if(f&&!n)return N0;if(!y||y===N0||c.current!==e||a!=null){let x=new Map;for(let C of e){if(!C)continue;if(a&&a.length>0&&!a.includes(C.id)&&C.rect.current){x.set(C.id,C.rect.current);continue}let w=C.node.current,L=w?new Ec(l(w),w):null;C.rect.current=L,L&&x.set(C.id,L)}return x}return y},[e,a,n,f,l]);return W(()=>{c.current=e},[e]),W(()=>{f||m()},[n,f]),W(()=>{a&&a.length>0&&i(null)},[JSON.stringify(a)]),W(()=>{f||typeof s!="number"||g.current!==null||(g.current=setTimeout(()=>{m(),g.current=null},s))},[s,f,m,...o]),{droppableRects:h,measureDroppableContainers:m,measuringScheduled:a!=null};function v(){switch(d){case Mc.Always:return!1;case Mc.BeforeDragging:return n;default:return!n}}}function Z0(e,t){return Nl(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function f5(e,t){return Z0(e,t)}function p5(e){let{callback:t,disabled:n}=e,o=fp(t),r=K(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;let{MutationObserver:a}=window;return new a(o)},[o,n]);return W(()=>()=>r?.disconnect(),[r]),r}function vp(e){let{callback:t,disabled:n}=e,o=fp(t),r=K(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;let{ResizeObserver:a}=window;return new a(o)},[n]);return W(()=>()=>r?.disconnect(),[r]),r}function m5(e){return new Ec(ws(e),e)}function _0(e,t,n){t===void 0&&(t=m5);let[o,r]=J(null);function a(){r(l=>{if(!e)return null;if(e.isConnected===!1){var d;return(d=l??n)!=null?d:null}let c=t(e);return JSON.stringify(l)===JSON.stringify(c)?l:c})}let i=p5({callback(l){if(e)for(let d of l){let{type:c,target:f}=d;if(c==="childList"&&f instanceof HTMLElement&&f.contains(e)){a();break}}}}),s=vp({callback:a});return ur(()=>{a(),e?(s?.observe(e),i?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),i?.disconnect())},[e]),o}function g5(e){let t=Z0(e);return q0(e,t)}var D0=[];function h5(e){let t=N(e),n=Nl(o=>e?o&&o!==D0&&e&&t.current&&e.parentNode===t.current.parentNode?o:Nc(e):D0,[e]);return W(()=>{t.current=e},[e]),n}function v5(e){let[t,n]=J(null),o=N(e),r=R(a=>{let i=tv(a.target);i&&n(s=>s?(s.set(i,rv(i)),new Map(s)):null)},[]);return W(()=>{let a=o.current;if(e!==a){i(a);let s=e.map(l=>{let d=tv(l);return d?(d.addEventListener("scroll",r,{passive:!0}),[d,rv(d)]):null}).filter(l=>l!=null);n(s.length?new Map(s):null),o.current=e}return()=>{i(e),i(a)};function i(s){s.forEach(l=>{let d=tv(l);d?.removeEventListener("scroll",r)})}},[r,e]),K(()=>e.length?t?Array.from(t.values()).reduce((a,i)=>vs(a,i),Ar):Y0(e):Ar,[e,t])}function O0(e,t){t===void 0&&(t=[]);let n=N(null);return W(()=>{n.current=null},t),W(()=>{let o=e!==Ar;o&&!n.current&&(n.current=e),!o&&n.current&&(n.current=null)},[e]),n.current?ys(e,n.current):Ar}function y5(e){W(()=>{if(!Tc)return;let t=e.map(n=>{let{sensor:o}=n;return o.setup==null?void 0:o.setup()});return()=>{for(let n of t)n?.()}},e.map(t=>{let{sensor:n}=t;return n}))}function x5(e,t){return K(()=>e.reduce((n,o)=>{let{eventName:r,handler:a}=o;return n[r]=i=>{a(i,t)},n},{}),[e,t])}function eT(e){return K(()=>e?qU(e):null,[e])}var F0=[];function C5(e,t){t===void 0&&(t=ws);let[n]=e,o=eT(n?Co(n):null),[r,a]=J(F0);function i(){a(()=>e.length?e.map(l=>Q0(l)?o:new Ec(t(l),l)):F0)}let s=vp({callback:i});return ur(()=>{s?.disconnect(),i(),e.forEach(l=>s?.observe(l))},[e]),r}function b5(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return Rl(t)?t:e}function w5(e){let{measure:t}=e,[n,o]=J(null),r=R(d=>{for(let{target:c}of d)if(Rl(c)){o(f=>{let p=t(c);return f?{...f,width:p.width,height:p.height}:p});break}},[t]),a=vp({callback:r}),i=R(d=>{let c=b5(d);a?.disconnect(),c&&a?.observe(c),o(c?t(c):null)},[t,a]),[s,l]=kc(i);return K(()=>({nodeRef:s,rect:n,setRef:l}),[n,s,l])}var S5=[{sensor:Dl,options:{}},{sensor:_l,options:{}}],I5={current:{}},mp={draggable:{measure:A0},droppable:{measure:A0,strategy:Mc.WhileDragging,frequency:lv.Optimized},dragOverlay:{measure:ws}},bs=class extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,o;return(n=(o=this.get(t))==null?void 0:o.node.current)!=null?n:void 0}},T5={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new bs,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:gp},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:mp,measureDroppableContainers:gp,windowRect:null,measuringScheduled:!1},k5={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:gp,draggableNodes:new Map,over:null,measureDroppableContainers:gp},yp=Ct(k5),tT=Ct(T5);function L5(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new bs}}}function P5(e,t){switch(t.type){case Dn.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Dn.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case Dn.DragEnd:case Dn.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Dn.RegisterDroppable:{let{element:n}=t,{id:o}=n,r=new bs(e.droppable.containers);return r.set(o,n),{...e,droppable:{...e.droppable,containers:r}}}case Dn.SetDroppableDisabled:{let{id:n,key:o,disabled:r}=t,a=e.droppable.containers.get(n);if(!a||o!==a.key)return e;let i=new bs(e.droppable.containers);return i.set(n,{...a,disabled:r}),{...e,droppable:{...e.droppable,containers:i}}}case Dn.UnregisterDroppable:{let{id:n,key:o}=t,r=e.droppable.containers.get(n);if(!r||o!==r.key)return e;let a=new bs(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function A5(e){let{disabled:t}=e,{active:n,activatorEvent:o,draggableNodes:r}=Ht(yp),a=pp(o),i=pp(n?.id);return W(()=>{if(!t&&!o&&a&&i!=null){if(!Lc(a)||document.activeElement===a.target)return;let s=r.get(i);if(!s)return;let{activatorNode:l,node:d}=s;if(!l.current&&!d.current)return;requestAnimationFrame(()=>{for(let c of[l.current,d.current]){if(!c)continue;let f=S0(c);if(f){f.focus();break}}})}},[o,t,r,i,a]),null}function E5(e,t){let{transform:n,...o}=t;return e!=null&&e.length?e.reduce((r,a)=>a({transform:r,...o}),n):n}function R5(e){return K(()=>({draggable:{...mp.draggable,...e?.draggable},droppable:{...mp.droppable,...e?.droppable},dragOverlay:{...mp.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function M5(e){let{activeNode:t,measure:n,initialRect:o,config:r=!0}=e,a=N(!1),{x:i,y:s}=typeof r=="boolean"?{x:r,y:r}:r;ur(()=>{if(!i&&!s||!t){a.current=!1;return}if(a.current||!o)return;let d=t?.node.current;if(!d||d.isConnected===!1)return;let c=n(d),f=q0(c,o);if(i||(f.x=0),s||(f.y=0),a.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){let p=W0(d);p&&p.scrollBy({top:f.y,left:f.x})}},[t,i,s,o,n])}var nT=Ct({...Ar,scaleX:1,scaleY:1}),xi;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(xi||(xi={}));var oT=pe(function(t){var n,o,r,a;let{id:i,accessibility:s,autoScroll:l=!0,children:d,sensors:c=S5,collisionDetection:f=BU,measuring:p,modifiers:m,...g}=t,h=Ia(P5,void 0,L5),[v,y]=h,[x,C]=MU(),[w,L]=J(xi.Uninitialized),S=w===xi.Initialized,{draggable:{active:k,nodes:I,translate:T},droppable:{containers:A}}=v,P=k!=null?I.get(k):null,_=N({initial:null,translated:null}),E=K(()=>{var Te;return k!=null?{id:k,data:(Te=P?.data)!=null?Te:I5,rect:_}:null},[k,P]),F=N(null),[B,V]=J(null),[Q,Se]=J(null),H=Ml(g,Object.values(g)),q=hs("DndDescribedBy",i),ee=K(()=>A.getEnabled(),[A]),G=R5(p),{droppableRects:te,measureDroppableContainers:me,measuringScheduled:U}=u5(ee,{dragging:S,dependencies:[T.x,T.y],config:G.droppable}),Y=d5(I,k),se=K(()=>Q?Pc(Q):null,[Q]),ge=ye(),ie=f5(Y,G.draggable.measure);M5({activeNode:k!=null?I.get(k):null,config:ge.layoutShiftCompensation,initialRect:ie,measure:G.draggable.measure});let Ae=_0(Y,G.draggable.measure,ie),Xe=_0(Y?Y.parentElement:null),nt=N({activatorEvent:null,active:null,activeNode:Y,collisionRect:null,collisions:null,droppableRects:te,draggableNodes:I,draggingNode:null,draggingNodeRect:null,droppableContainers:A,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),rt=A.getNodeFor((n=nt.current.over)==null?void 0:n.id),Ve=w5({measure:G.dragOverlay.measure}),ne=(o=Ve.nodeRef.current)!=null?o:Y,we=S?(r=Ve.rect)!=null?r:Ae:null,j=!!(Ve.nodeRef.current&&Ve.rect),X=g5(j?null:Ae),ae=eT(ne?Co(ne):null),oe=h5(S?rt??Y:null),ft=C5(oe),pt=E5(m,{transform:{x:T.x-X.x,y:T.y-X.y,scaleX:1,scaleY:1},activatorEvent:Q,active:E,activeNodeRect:Ae,containerNodeRect:Xe,draggingNodeRect:we,over:nt.current.over,overlayNodeRect:Ve.rect,scrollableAncestors:oe,scrollableAncestorRects:ft,windowRect:ae}),yt=se?vs(se,T):null,Lt=v5(oe),on=O0(Lt),gt=O0(Lt,[Ae]),zt=vs(pt,on),Mt=we?HU(we,pt):null,wt=E&&Mt?f({active:E,collisionRect:Mt,droppableRects:te,droppableContainers:ee,pointerCoordinates:yt}):null,In=cv(wt,"id"),[ct,dn]=J(null),ro=j?pt:vs(pt,gt),Vt=zU(ro,(a=ct?.rect)!=null?a:null,Ae),bn=N(null),Tn=R((Te,Me)=>{let{sensor:ht,options:Ln}=Me;if(F.current==null)return;let mn=I.get(F.current);if(!mn)return;let at=Te.nativeEvent,Pt=new ht({active:F.current,activeNode:mn,event:at,options:Ln,context:nt,onAbort(St){if(!I.get(St))return;let{onDragAbort:Jt}=H.current,xe={id:St};Jt?.(xe),x({type:"onDragAbort",event:xe})},onPending(St,an,Jt,xe){if(!I.get(St))return;let{onDragPending:qe}=H.current,We={id:St,constraint:an,initialCoordinates:Jt,offset:xe};qe?.(We),x({type:"onDragPending",event:We})},onStart(St){let an=F.current;if(an==null)return;let Jt=I.get(an);if(!Jt)return;let{onDragStart:xe}=H.current,_e={activatorEvent:at,active:{id:an,data:Jt.data,rect:_}};(0,xs.unstable_batchedUpdates)(()=>{xe?.(_e),L(xi.Initializing),y({type:Dn.DragStart,initialCoordinates:St,active:an}),x({type:"onDragStart",event:_e}),V(bn.current),Se(at)})},onMove(St){y({type:Dn.DragMove,coordinates:St})},onEnd:Et(Dn.DragEnd),onCancel:Et(Dn.DragCancel)});bn.current=Pt;function Et(St){return async function(){let{active:Jt,collisions:xe,over:_e,scrollAdjustedTranslate:qe}=nt.current,We=null;if(Jt&&qe){let{cancelDrop:ot}=H.current;We={activatorEvent:at,active:Jt,collisions:xe,delta:qe,over:_e},St===Dn.DragEnd&&typeof ot=="function"&&await Promise.resolve(ot(We))&&(St=Dn.DragCancel)}F.current=null,(0,xs.unstable_batchedUpdates)(()=>{y({type:St}),L(xi.Uninitialized),dn(null),V(null),Se(null),bn.current=null;let ot=St===Dn.DragEnd?"onDragEnd":"onDragCancel";if(We){let xt=H.current[ot];xt?.(We),x({type:ot,event:We})}})}}},[I]),rn=R((Te,Me)=>(ht,Ln)=>{let mn=ht.nativeEvent,at=I.get(Ln);if(F.current!==null||!at||mn.dndKit||mn.defaultPrevented)return;let Pt={active:at};Te(ht,Me.options,Pt)===!0&&(mn.dndKit={capturedBy:Me.sensor},F.current=Ln,Tn(ht,Me))},[I,Tn]),kn=c5(c,rn);y5(c),ur(()=>{Ae&&w===xi.Initializing&&L(xi.Initialized)},[Ae,w]),W(()=>{let{onDragMove:Te}=H.current,{active:Me,activatorEvent:ht,collisions:Ln,over:mn}=nt.current;if(!Me||!ht)return;let at={active:Me,activatorEvent:ht,collisions:Ln,delta:{x:zt.x,y:zt.y},over:mn};(0,xs.unstable_batchedUpdates)(()=>{Te?.(at),x({type:"onDragMove",event:at})})},[zt.x,zt.y]),W(()=>{let{active:Te,activatorEvent:Me,collisions:ht,droppableContainers:Ln,scrollAdjustedTranslate:mn}=nt.current;if(!Te||F.current==null||!Me||!mn)return;let{onDragOver:at}=H.current,Pt=Ln.get(In),Et=Pt&&Pt.rect.current?{id:Pt.id,rect:Pt.rect.current,data:Pt.data,disabled:Pt.disabled}:null,St={active:Te,activatorEvent:Me,collisions:ht,delta:{x:mn.x,y:mn.y},over:Et};(0,xs.unstable_batchedUpdates)(()=>{dn(Et),at?.(St),x({type:"onDragOver",event:St})})},[In]),ur(()=>{nt.current={activatorEvent:Q,active:E,activeNode:Y,collisionRect:Mt,collisions:wt,droppableRects:te,draggableNodes:I,draggingNode:ne,draggingNodeRect:we,droppableContainers:A,over:ct,scrollableAncestors:oe,scrollAdjustedTranslate:zt},_.current={initial:we,translated:Mt}},[E,Y,wt,Mt,I,ne,we,te,A,ct,oe,zt]),i5({...ge,delta:T,draggingRect:Mt,pointerCoordinates:yt,scrollableAncestors:oe,scrollableAncestorRects:ft});let O=K(()=>({active:E,activeNode:Y,activeNodeRect:Ae,activatorEvent:Q,collisions:wt,containerNodeRect:Xe,dragOverlay:Ve,draggableNodes:I,droppableContainers:A,droppableRects:te,over:ct,measureDroppableContainers:me,scrollableAncestors:oe,scrollableAncestorRects:ft,measuringConfiguration:G,measuringScheduled:U,windowRect:ae}),[E,Y,Ae,Q,wt,Xe,Ve,I,A,te,ct,me,oe,ft,G,U,ae]),fe=K(()=>({activatorEvent:Q,activators:kn,active:E,activeNodeRect:Ae,ariaDescribedById:{draggable:q},dispatch:y,draggableNodes:I,over:ct,measureDroppableContainers:me}),[Q,kn,E,Ae,y,q,I,ct,me]);return yn.createElement(z0.Provider,{value:C},yn.createElement(yp.Provider,{value:fe},yn.createElement(tT.Provider,{value:O},yn.createElement(nT.Provider,{value:Vt},d)),yn.createElement(A5,{disabled:s?.restoreFocus===!1})),yn.createElement(DU,{...s,hiddenTextDescribedById:q}));function ye(){let Te=B?.autoScrollEnabled===!1,Me=typeof l=="object"?l.enabled===!1:l===!1,ht=S&&!Te&&!Me;return typeof l=="object"?{...l,enabled:ht}:{enabled:ht}}}),N5=Ct(null),B0="button",_5="Draggable";function rT(e){let{id:t,data:n,disabled:o=!1,attributes:r}=e,a=hs(_5),{activators:i,activatorEvent:s,active:l,activeNodeRect:d,ariaDescribedById:c,draggableNodes:f,over:p}=Ht(yp),{role:m=B0,roleDescription:g="draggable",tabIndex:h=0}=r??{},v=l?.id===t,y=Ht(v?nT:N5),[x,C]=kc(),[w,L]=kc(),S=x5(i,t),k=Ml(n);ur(()=>(f.set(t,{id:t,key:a,node:x,activatorNode:w,data:k}),()=>{let T=f.get(t);T&&T.key===a&&f.delete(t)}),[f,t]);let I=K(()=>({role:m,tabIndex:h,"aria-disabled":o,"aria-pressed":v&&m===B0?!0:void 0,"aria-roledescription":g,"aria-describedby":c.draggable}),[o,m,h,v,g,c.draggable]);return{active:l,activatorEvent:s,activeNodeRect:d,attributes:I,isDragging:v,listeners:o?void 0:S,node:x,over:p,setNodeRef:C,setActivatorNodeRef:L,transform:y}}function aT(){return Ht(tT)}var D5="Droppable",O5={timeout:25};function iT(e){let{data:t,disabled:n=!1,id:o,resizeObserverConfig:r}=e,a=hs(D5),{active:i,dispatch:s,over:l,measureDroppableContainers:d}=Ht(yp),c=N({disabled:n}),f=N(!1),p=N(null),m=N(null),{disabled:g,updateMeasurementsFor:h,timeout:v}={...O5,...r},y=Ml(h??o),x=R(()=>{if(!f.current){f.current=!0;return}m.current!=null&&clearTimeout(m.current),m.current=setTimeout(()=>{d(Array.isArray(y.current)?y.current:[y.current]),m.current=null},v)},[v]),C=vp({callback:x,disabled:g||!i}),w=R((I,T)=>{C&&(T&&(C.unobserve(T),f.current=!1),I&&C.observe(I))},[C]),[L,S]=kc(w),k=Ml(t);return W(()=>{!C||!L.current||(C.disconnect(),f.current=!1,C.observe(L.current))},[L,C]),W(()=>(s({type:Dn.RegisterDroppable,element:{id:o,key:a,disabled:n,node:L,rect:p,data:k}}),()=>s({type:Dn.UnregisterDroppable,key:a,id:o})),[o]),W(()=>{n!==c.current.disabled&&(s({type:Dn.SetDroppableDisabled,id:o,key:a,disabled:n}),c.current.disabled=n)},[o,a,n,s]),{active:i,rect:p,isOver:l?.id===o,node:L,over:l,setNodeRef:S}}ue();function sT(e,t,n){let o=e.slice();return o.splice(n<0?o.length+n:n,0,o.splice(t,1)[0]),o}function F5(e,t){return e.reduce((n,o,r)=>{let a=t.get(o);return a&&(n[r]=a),n},Array(e.length))}function xp(e){return e!==null&&e>=0}function B5(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function z5(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}var lT=e=>{let{rects:t,activeIndex:n,overIndex:o,index:r}=e,a=sT(t,o,n),i=t[r],s=a[r];return!s||!i?null:{x:s.left-i.left,y:s.top-i.top,scaleX:s.width/i.width,scaleY:s.height/i.height}};var Cp={scaleX:1,scaleY:1},dT=e=>{var t;let{activeIndex:n,activeNodeRect:o,index:r,rects:a,overIndex:i}=e,s=(t=a[n])!=null?t:o;if(!s)return null;if(r===n){let d=a[i];return d?{x:0,y:n<i?d.top+d.height-(s.top+s.height):d.top-s.top,...Cp}:null}let l=U5(a,r,n);return r>n&&r<=i?{x:0,y:-s.height-l,...Cp}:r<n&&r>=i?{x:0,y:s.height+l,...Cp}:{x:0,y:0,...Cp}};function U5(e,t,n){let o=e[t],r=e[t-1],a=e[t+1];return o?n<t?r?o.top-(r.top+r.height):a?a.top-(o.top+o.height):0:a?a.top-(o.top+o.height):r?o.top-(r.top+r.height):0:0}var cT="Sortable",uT=yn.createContext({activeIndex:-1,containerId:cT,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:lT,disabled:{draggable:!1,droppable:!1}});function fT(e){let{children:t,id:n,items:o,strategy:r=lT,disabled:a=!1}=e,{active:i,dragOverlay:s,droppableRects:l,over:d,measureDroppableContainers:c}=aT(),f=hs(cT,n),p=s.rect!==null,m=K(()=>o.map(S=>typeof S=="object"&&"id"in S?S.id:S),[o]),g=i!=null,h=i?m.indexOf(i.id):-1,v=d?m.indexOf(d.id):-1,y=N(m),x=!B5(m,y.current),C=v!==-1&&h===-1||x,w=z5(a);ur(()=>{x&&g&&c(m)},[x,m,g,c]),W(()=>{y.current=m},[m]);let L=K(()=>({activeIndex:h,containerId:f,disabled:w,disableTransforms:C,items:m,overIndex:v,useDragOverlay:p,sortedRects:F5(m,l),strategy:r}),[h,f,w.draggable,w.droppable,C,m,v,l,p,r]);return yn.createElement(uT.Provider,{value:L},t)}var H5=e=>{let{id:t,items:n,activeIndex:o,overIndex:r}=e;return sT(n,o,r).indexOf(t)},$5=e=>{let{containerId:t,isSorting:n,wasDragging:o,index:r,items:a,newIndex:i,previousItems:s,previousContainerId:l,transition:d}=e;return!d||!o||s!==a&&r===i?!1:n?!0:i!==r&&t===l},K5={duration:200,easing:"ease"},pT="transform",V5=yi.Transition.toString({property:pT,duration:0,easing:"linear"}),q5={roleDescription:"sortable"};function W5(e){let{disabled:t,index:n,node:o,rect:r}=e,[a,i]=J(null),s=N(n);return ur(()=>{if(!t&&n!==s.current&&o.current){let l=r.current;if(l){let d=ws(o.current,{ignoreTransform:!0}),c={x:l.left-d.left,y:l.top-d.top,scaleX:l.width/d.width,scaleY:l.height/d.height};(c.x||c.y)&&i(c)}}n!==s.current&&(s.current=n)},[t,n,o,r]),W(()=>{a&&i(null)},[a]),a}function mT(e){let{animateLayoutChanges:t=$5,attributes:n,disabled:o,data:r,getNewIndex:a=H5,id:i,strategy:s,resizeObserverConfig:l,transition:d=K5}=e,{items:c,containerId:f,activeIndex:p,disabled:m,disableTransforms:g,sortedRects:h,overIndex:v,useDragOverlay:y,strategy:x}=Ht(uT),C=G5(o,m),w=c.indexOf(i),L=K(()=>({sortable:{containerId:f,index:w,items:c},...r}),[f,r,w,c]),S=K(()=>c.slice(c.indexOf(i)),[c,i]),{rect:k,node:I,isOver:T,setNodeRef:A}=iT({id:i,data:L,disabled:C.droppable,resizeObserverConfig:{updateMeasurementsFor:S,...l}}),{active:P,activatorEvent:_,activeNodeRect:E,attributes:F,setNodeRef:B,listeners:V,isDragging:Q,over:Se,setActivatorNodeRef:H,transform:q}=rT({id:i,data:L,attributes:{...q5,...n},disabled:C.draggable}),ee=C0(A,B),G=!!P,te=G&&!g&&xp(p)&&xp(v),me=!y&&Q,U=me&&te?q:null,se=te?U??(s??x)({rects:h,activeNodeRect:E,activeIndex:p,overIndex:v,index:w}):null,ge=xp(p)&&xp(v)?a({id:i,items:c,activeIndex:p,overIndex:v}):w,ie=P?.id,Ae=N({activeId:ie,items:c,newIndex:ge,containerId:f}),Xe=c!==Ae.current.items,nt=t({active:P,containerId:f,isDragging:Q,isSorting:G,id:i,index:w,items:c,newIndex:Ae.current.newIndex,previousItems:Ae.current.items,previousContainerId:Ae.current.containerId,transition:d,wasDragging:Ae.current.activeId!=null}),rt=W5({disabled:!nt,index:w,node:I,rect:k});return W(()=>{G&&Ae.current.newIndex!==ge&&(Ae.current.newIndex=ge),f!==Ae.current.containerId&&(Ae.current.containerId=f),c!==Ae.current.items&&(Ae.current.items=c)},[G,ge,f,c]),W(()=>{if(ie===Ae.current.activeId)return;if(ie!=null&&Ae.current.activeId==null){Ae.current.activeId=ie;return}let ne=setTimeout(()=>{Ae.current.activeId=ie},50);return()=>clearTimeout(ne)},[ie]),{active:P,activeIndex:p,attributes:F,data:L,rect:k,index:w,newIndex:ge,items:c,isOver:T,isSorting:G,isDragging:Q,listeners:V,node:I,overIndex:v,over:Se,setNodeRef:ee,setActivatorNodeRef:H,setDroppableNodeRef:A,setDraggableNodeRef:B,transform:rt??se,transition:Ve()};function Ve(){if(rt||Xe&&Ae.current.newIndex===w)return V5;if(!(me&&!Lc(_)||!d)&&(G||nt))return yi.Transition.toString({...d,property:pT})}}function G5(e,t){var n,o;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e?.draggable)!=null?n:t.draggable,droppable:(o=e?.droppable)!=null?o:t.droppable}}function bp(e){if(!e)return!1;let t=e.data.current;return!!(t&&"sortable"in t&&typeof t.sortable=="object"&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}var j5=[Tt.Down,Tt.Right,Tt.Up,Tt.Left],gT=(e,t)=>{let{context:{active:n,collisionRect:o,droppableRects:r,droppableContainers:a,over:i,scrollableAncestors:s}}=t;if(j5.includes(e.code)){if(e.preventDefault(),!n||!o)return;let l=[];a.getEnabled().forEach(f=>{if(!f||f!=null&&f.disabled)return;let p=r.get(f.id);if(p)switch(e.code){case Tt.Down:o.top<p.top&&l.push(f);break;case Tt.Up:o.top>p.top&&l.push(f);break;case Tt.Left:o.left>p.left&&l.push(f);break;case Tt.Right:o.left<p.left&&l.push(f);break}});let d=V0({active:n,collisionRect:o,droppableRects:r,droppableContainers:l,pointerCoordinates:null}),c=cv(d,"id");if(c===i?.id&&d.length>1&&(c=d[1].id),c!=null){let f=a.get(n.id),p=a.get(c),m=p?r.get(p.id):null,g=p?.node.current;if(g&&m&&f&&p){let v=Nc(g).some((S,k)=>s[k]!==S),y=hT(f,p),x=Q5(f,p),C=v||!y?{x:0,y:0}:{x:x?o.width-m.width:0,y:x?o.height-m.height:0},w={x:m.left,y:m.top};return C.x&&C.y?w:ys(w,C)}}}};function hT(e,t){return!bp(e)||!bp(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function Q5(e,t){return!bp(e)||!bp(t)||!hT(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}function X5(e,t,n){let o={...e};return t.top+e.y<=n.top?o.y=n.top-t.top:t.bottom+e.y>=n.top+n.height&&(o.y=n.top+n.height-t.bottom),t.left+e.x<=n.left?o.x=n.left-t.left:t.right+e.x>=n.left+n.width&&(o.x=n.left+n.width-t.right),o}var vT=e=>{let{draggingNodeRect:t,transform:n,scrollableAncestorRects:o}=e,r=o[0];return!t||!r?n:X5(n,t,r)},yT=e=>{let{transform:t}=e;return{...t,x:0}};ue();ue();var wp={"2xl":1536,"3xl":1600,"4xl":2e3,lg:1024,md:768,sm:640,xl:1280};function xT(e){return`(min-width: ${typeof e=="number"?e:wp[e]}px)`}function CT(e){return`(max-width: ${(typeof e=="number"?e:wp[e])-1}px)`}function Y5(e){if(typeof e!="string"){let n=[];return e.min!=null&&n.push(xT(e.min)),e.max!=null&&n.push(CT(e.max)),e.pointer==="coarse"&&n.push("(pointer: coarse)"),e.pointer==="fine"&&n.push("(pointer: fine)"),n.length===0?"(min-width: 0px)":n.join(" and ")}if(e.startsWith("("))return e;let t=[];for(let n of e.split(":"))if(n.startsWith("max-")){let o=n.slice(4);o in wp&&t.push(CT(o))}else n in wp&&t.push(xT(n));return t.length>0?t.join(" and "):e}function J5(){return!1}function Sp(e){let t=Y5(e),n=R(r=>{if(typeof window>"u")return()=>{};let a=window.matchMedia(t);return a.addEventListener("change",r),()=>a.removeEventListener("change",r)},[t]),o=R(()=>typeof window>"u"?!1:window.matchMedia(t).matches,[t]);return Ko(n,o,J5)}ue();var so=new Map;function Z5(e,t,n){return`${e}\0${t}\0${n??"none"}`}function uv(e,t){so.delete(e),so.set(e,t)}function Ol(e,t){if(so.get(e)===t){if(t.operationLeases>0){t.disposeRequested=!0;return}t.releaseAuthorityWatch?.(),t.releaseAuthorityWatch=void 0,so.delete(e);for(let n of t.state.added)t.releaseUpload(n.id),URL.revokeObjectURL(n.previewUrl);for(let n of t.listeners)n()}}function eH(e){if(so.size<=100)return;let t=Array.from(so);for(let[n,o]of t){if(so.size<=100)return;n===e||o.committed||o.listeners.size>0||o.operationLeases>0||Ol(n,o)}for(let[n,o]of t){if(so.size<=100)return;n===e||o.listeners.size>0||o.operationLeases>0||Ol(n,o)}}function Ip(){queueMicrotask(()=>eH())}function bT(e,t,n,o,r=void 0){let a=n.management?.revision??null,i=Z5(e,n.intentId,a),s=so.get(i);if(s)return s.releaseUpload=o.releaseUpload,s.watchAuthority=r,s.state;let l={key:i,inputKey:e,environmentId:t,intentId:n.intentId,revision:a,text:n.management?.text??n.text??"",retained:n.management?.attachments??[],added:[],saving:!1,error:null},d={state:l,listeners:new Set,releaseUpload:o.releaseUpload,operationLeases:0,committed:!1,disposeRequested:!1,watchAuthority:r,releaseAuthorityWatch:void 0};return so.set(i,d),l}function wT(e,t){let n=so.get(e);return n?(n.releaseAuthorityWatch===void 0&&n.watchAuthority!==void 0&&(n.releaseAuthorityWatch=n.watchAuthority({threadKey:n.state.inputKey,intentId:n.state.intentId,revision:n.state.revision,onInvalid:()=>Ol(e,n)})),n.committed=!0,uv(e,n),n.listeners.add(t),Ip(),()=>{n.listeners.delete(t),Ip()}):()=>{}}function Ss(e,t){let n=so.get(e);if(!n)return;n.committed=!0;let o=t(n.state);if(o!==n.state){n.state=o,uv(e,n);for(let r of n.listeners)r()}}function Tp(e){return so.get(e)?.state}function ST(e){let t=so.get(e);if(!t)return null;t.committed=!0,t.operationLeases+=1,uv(e,t);let n=!1;return()=>{if(!n){if(n=!0,t.operationLeases=Math.max(0,t.operationLeases-1),t.operationLeases===0&&t.disposeRequested){Ol(e,t);return}Ip()}}}function kp(e){let t=so.get(e);t&&Ol(e,t)}function IT(e,t){let n=new Map(t.flatMap(o=>o.waiting&&o.management!==void 0?[[o.intentId,o.management.revision]]:[]));for(let[o,r]of so)r.state.inputKey===e&&n.get(r.state.intentId)!==r.state.revision&&Ol(o,r);Ip()}function TT({entry:e,current:t,inputKey:n,environmentId:o,unavailable:r,attachments:a,watchEditorAuthority:i,onEdit:s,onClose:l}){let{t:d}=eo(),c=bT(n,o,e,a,i),f=Ko(P=>wT(c.key,P),()=>Tp(c.key)??c,()=>Tp(c.key)??c),{key:p,text:m,retained:g,added:h,saving:v,error:y}=f,x=N(null),C=a.useUploadStatuses(),w=K(()=>g.map(P=>P.id),[g]),L=a.useAssetUrls(o,w),S=!t?.management||t.management.revision!==e.management?.revision;W(()=>{t===void 0&&(kp(p),l())},[t,p,l]);let k=()=>{v||(kp(p),l())},I=P=>{if(v||r||S)return;let _=null,E=[...h];for(let F of P){let B=F.type||"application/octet-stream";if(g.length+E.length>=a.limits.maxAttachments||F.size===0||F.size>a.maxAttachmentBytes(B)){_=d("turnQueue.attachmentLimit",{name:F.name,count:a.limits.maxAttachments,size:a.formatAttachmentSize(a.maxAttachmentBytes(B))});continue}let V=a.makeImageAttachment({id:a.randomUUID(),name:F.name,mimeType:B,sizeBytes:F.size,file:F});E.push(V),a.startUpload({environmentId:o,image:V})}Ss(p,F=>({...F,added:E,error:_}))},T=async()=>{let P=Tp(p);if(!P||P.saving||r||S||!P.text.trim()&&P.retained.length+P.added.length===0)return;let _=ST(p);if(_!==null){Ss(p,E=>({...E,saving:!0,error:null}));try{await a.awaitUploads(P.added.map(F=>F.id));let E=a.getUploadedAttachments({environmentId:o,images:P.added});if(!E)throw new Error(d("turnQueue.uploadFailed"));await s(e,{text:P.text,attachments:[...P.retained,...E]}),kp(p),l()}catch(E){Ss(p,F=>({...F,saving:!1,error:E instanceof Error?E.message:d("turnQueue.actionFailed")}))}finally{_()}}},A=[...g.map((P,_)=>({...P,previewUrl:L[_],added:!1})),...h.map(P=>({...P,added:!0}))];return u(Rf,{open:!0,onOpenChange:P=>{P||k()},children:b(Df,{className:"max-w-2xl","data-queued-message-editor":!0,children:[b(_f,{children:[u(Of,{children:d("turnQueue.editTitle")}),u(Mf,{children:d("turnQueue.editDescription")})]}),b("div",{className:"max-h-[60dvh] space-y-3 overflow-y-auto px-6 pb-4",onDragOver:P=>{P.dataTransfer.types.includes("Files")&&P.preventDefault()},onDrop:P=>{P.dataTransfer.files.length&&(P.preventDefault(),P.stopPropagation(),I(Array.from(P.dataTransfer.files)))},children:[u(Ww,{"aria-label":d("turnQueue.editText"),autoFocus:!0,value:m,maxLength:a.limits.maxInputChars,disabled:v,onChange:P=>Ss(p,_=>({..._,text:P.target.value})),onPaste:P=>{P.clipboardData.files.length&&(P.preventDefault(),I(Array.from(P.clipboardData.files)))},onKeyDown:P=>{(P.metaKey||P.ctrlKey)&&P.key==="Enter"&&!P.nativeEvent.isComposing&&(P.preventDefault(),T())}}),u("ul",{className:"flex flex-wrap gap-2",children:A.map(P=>b("li",{className:"flex max-w-full items-center gap-2 rounded-md border border-border px-2 py-1.5",children:[P.type==="image"&&P.previewUrl?u("img",{src:P.previewUrl,alt:P.name,className:"size-12 rounded object-cover"}):u(vo,{className:"size-4 shrink-0"}),b("div",{className:"min-w-0 text-xs",children:[u("p",{className:"max-w-48 break-words",children:P.name}),u("p",{className:"text-muted-foreground",children:a.formatAttachmentSize(P.sizeBytes)}),P.added&&C.get(P.id)!=="ready"?u("p",{children:d(C.get(P.id)==="failed"?"turnQueue.uploadFailed":"turnQueue.uploading")}):null,P.added&&C.get(P.id)==="failed"?u(ce,{size:"xs",variant:"ghost",disabled:v||r||S,onClick:()=>{let _=h.find(E=>E.id===P.id);_&&a.retryUpload({environmentId:o,image:_})},children:d("turnQueue.retryUpload")}):null]}),u(ce,{size:"icon-xs",variant:"ghost","aria-label":d("turnQueue.removeAttachment",{name:P.name}),disabled:v||S,onClick:()=>{P.added?(a.releaseUpload(P.id),P.previewUrl&&URL.revokeObjectURL(P.previewUrl),Ss(p,_=>({..._,added:_.added.filter(E=>E.id!==P.id)}))):Ss(p,_=>({..._,retained:_.retained.filter(E=>E.id!==P.id)}))},children:u(en,{className:"size-3.5"})})]},P.id))}),u("input",{ref:x,type:"file",multiple:!0,className:"hidden","aria-label":d("turnQueue.addAttachments"),onChange:P=>{I(Array.from(P.target.files??[])),P.target.value=""}}),b(ce,{size:"sm",variant:"outline",disabled:v||r||S,onClick:()=>x.current?.click(),children:[u(vo,{className:"size-4"}),d("turnQueue.addAttachments")]}),S?u("p",{role:"alert",className:"text-sm text-muted-foreground",children:d("turnQueue.editStale")}):null,y?u("p",{role:"alert",className:"text-sm text-destructive-foreground",children:y}):null]}),b(Nf,{children:[u(ce,{variant:"ghost",disabled:v,onClick:k,children:d("turnQueue.discardEdit")}),u(ce,{disabled:v||r||S||!m.trim()&&A.length===0,onClick:()=>{T()},children:d(v?"turnQueue.saving":"turnQueue.saveEdit")})]})]})})}function kT(e,t){let n=e.find(a=>a.intentId===t.intentId);if(!n)return e;let o=e.filter(a=>a.intentId!==t.intentId),r=t.beforeIntentId===null?o.length:o.findIndex(a=>a.intentId===t.beforeIntentId);return r<0?e:(o.splice(r,0,n),o)}function LT(e,t,n){if(t===n)return null;let o={intentId:t,beforeIntentId:n,previousOrder:e.map(a=>a.intentId)};return kT(e,o).every((a,i)=>a.intentId===e[i]?.intentId)?null:o}function PT(e,t){if(!e.find(l=>l.intentId===t.intentId)?.management?.canReorder||t.beforeIntentId!==null&&!e.some(l=>l.intentId===t.beforeIntentId))return{entries:e,settled:!0};let o=new Set(e.map(l=>l.intentId)),r=new Set(t.previousOrder),a=t.previousOrder.filter(l=>o.has(l));return e.filter(l=>r.has(l.intentId)).some((l,d)=>l.intentId!==a[d])?{entries:e,settled:!0}:{entries:kT(e,t),settled:!1}}ue();ue();function tH({entry:e,unavailable:t,onCancel:n}){let{t:o}=eo(),r=N(!1),[a,i]=J(!1),[s,l]=J(!1),[d,c]=J(!1);W(()=>{c(!1),l(!1)},[e.status,e.deliveryCertainty]);let f=async()=>{if(!(r.current||t||e.action===null)){r.current=!0,i(!0),l(!1);try{await n(e),c(!1)}catch{l(!0)}finally{r.current=!1,i(!1)}}};return b("li",{className:"space-y-2 border-t border-border py-2","data-turn-queue-message":!0,children:[u("p",{className:"text-muted-foreground",children:o(e.deliveryCertainty==="unknown"?"turnQueue.itemUnknown":e.status==="queued"?"turnQueue.itemQueued":e.status==="blocked"||e.status==="reconciling"?"turnQueue.itemBlocked":"turnQueue.itemRunning")}),u("p",{className:"whitespace-pre-wrap break-words [overflow-wrap:anywhere]",children:e.text??o("turnQueue.messageUnavailable")}),e.attachmentNames.length>0?u("p",{className:"break-words text-muted-foreground",children:e.attachmentNames.join(", ")}):null,e.action!==null?d&&e.action==="abandon"?b("div",{className:"space-y-2",children:[u("p",{children:o("turnQueue.abandonDescription")}),b("div",{className:"flex flex-wrap gap-2",children:[u(ce,{size:"xs",variant:"outline",disabled:a||t,onClick:()=>{f()},children:o("turnQueue.confirmAbandon")}),u(ce,{size:"xs",variant:"ghost",disabled:a,onClick:()=>c(!1),children:o("turnQueue.keepWaiting")})]})]}):u(ce,{size:"xs",variant:"outline",disabled:a||t,onClick:()=>e.action==="abandon"?c(!0):void f(),children:o(a?"turnQueue.cancelling":e.action==="abandon"?"turnQueue.stopWaiting":"turnQueue.cancelMessage")}):null,s?u("p",{role:"alert",className:"text-destructive-foreground",children:o("turnQueue.actionFailed")}):null]})}function AT({entries:e,unavailable:t,onCancel:n}){let{t:o}=eo(),[r,a]=J(!1),i=Jr();return e.length===0?null:b("div",{className:"min-w-0 basis-full space-y-2",children:[u(ce,{size:"xs",variant:"ghost","aria-expanded":r,"aria-controls":i,onClick:()=>a(s=>!s),children:o(r?"turnQueue.hideMessages":"turnQueue.showMessages")}),r?u("ol",{id:i,className:"max-h-64 overflow-y-auto overscroll-contain",children:e.map(s=>u(tH,{entry:s,unavailable:t,onCancel:n},s.intentId))}):null]})}function fv({queue:e,unavailable:t=!1,onResume:n,entries:o,onCancel:r}){let{t:a}=eo(),i=N(!1),[s,l]=J(!1),[d,c]=J(!1),f=N(!1),[p,m]=J(!1),[g,h]=J(!1),[v,y]=J(null);W(()=>{e.paused||c(!1)},[e.paused]);let x=o?.[0];W(()=>{m(!1),y(null)},[x?.intentId,x?.status,x?.deliveryCertainty]);let C=e.deliveryUncertain||e.blocked||e.reconciling;if(!e.paused&&!C)return null;let w=r!==void 0&&x?.action==="abandon"&&(e.reconciling||e.deliveryUncertain),L=async()=>{if(f.current||t||r===void 0||x===void 0)return;let T=x;f.current=!0,h(!0),y(null);try{await r(T),m(!1)}catch{y(T.intentId)}finally{f.current=!1,h(!1)}},S=e.paused?a("turnQueue.pausedTitle"):e.deliveryUncertain?a("turnQueue.uncertainTitle"):e.blocked?a("turnQueue.blockedTitle"):e.reconciling?a("turnQueue.reconcilingTitle"):a("turnQueue.queuedTitle"),k=e.deliveryUncertain?a("turnQueue.uncertainDescription"):e.blocked?a("turnQueue.blockedDescription"):e.reconciling?a("turnQueue.reconcilingDescription"):e.paused?a("turnQueue.pausedDescription"):a("turnQueue.queuedDescription"),I=async()=>{if(!(i.current||t||!e.paused)){i.current=!0,l(!0),c(!1);try{await n()}catch{c(!0)}finally{i.current=!1,l(!1)}}};return b("div",{className:"mx-auto mb-2 flex w-full max-w-3xl flex-wrap items-start gap-2 rounded-md border border-warning/40 bg-background px-3 py-2 text-xs text-foreground","data-turn-queue-banner":!0,role:"status",children:[b("div",{className:"min-w-0 flex-1 basis-48 space-y-1",children:[b("div",{className:"flex flex-wrap items-baseline gap-x-2 gap-y-1",children:[u("span",{className:"font-medium",children:S}),u("span",{className:"text-muted-foreground",children:a("turnQueue.queued",{count:e.queuedCount})})]}),u("p",{className:"text-muted-foreground",children:k}),e.paused&&C?u("p",{className:"text-muted-foreground",children:a("turnQueue.pausedUncertainDescription")}):null,t?u("p",{className:"text-muted-foreground",children:a("turnQueue.disconnected")}):null,d&&e.paused?u("p",{className:"text-destructive-foreground",role:"alert",children:a("turnQueue.resumeFailed")}):null,v!==null&&v===x?.intentId?u("p",{className:"text-destructive-foreground",role:"alert",children:a("turnQueue.actionFailed")}):null]}),e.paused?u(ce,{size:"xs",variant:"outline",disabled:s,softDisabled:t,onClick:()=>{I()},children:a(s?"turnQueue.resuming":"turnQueue.resume")}):null,w?b(Le,{children:[u(ce,{size:"xs",variant:"outline",disabled:g,softDisabled:t,onClick:()=>m(!0),children:a("turnQueue.stopWaiting")}),u(Qw,{open:p,onOpenChange:T=>{T||m(!1)},children:b(eS,{className:"max-w-lg",children:[b(Zw,{children:[u(tS,{children:a("turnQueue.stopWaiting")}),u(Yw,{children:a("turnQueue.abandonDescription")})]}),b(Jw,{children:[u(Xw,{render:u(ce,{variant:"ghost"}),children:a("turnQueue.keepWaiting")}),u(ce,{variant:"outline",disabled:g||t,onClick:()=>{L()},children:a(g?"turnQueue.cancelling":"turnQueue.confirmAbandon")})]})]})})]}):null,r&&o?u(AT,{entries:o.filter(T=>T.status!=="queued"),unavailable:t,onCancel:r}):null]})}var nH=[yT,vT],oH=[];function rH({submission:e}){let{t}=eo();return b("li",{"data-queue-pending-message":e.messageId,className:"flex items-center gap-1.5 border-t border-border/50 px-2 py-1.5",children:[u("span",{"aria-hidden":"true",className:"grid size-6 shrink-0 place-items-center",children:u("span",{className:"size-1.5 rounded-full bg-muted-foreground/60"})}),b("div",{className:"min-w-0 flex-1",children:[u("p",{className:"line-clamp-2 whitespace-pre-wrap break-words [overflow-wrap:anywhere]",children:zh(e.text)||t("turnQueue.attachmentsOnly")}),e.attachmentNames.length?b("p",{className:"flex items-center gap-1 text-muted-foreground",children:[u(vo,{className:"size-3 shrink-0"}),u("span",{className:"truncate",children:e.attachmentNames.join(", ")})]}):null]}),u("span",{role:"status",className:"w-[5.25rem] shrink-0 text-end text-muted-foreground",children:t("primaryActions.sendingButtonLabel")})]})}function aH({entry:e,disabled:t,dropPosition:n,dragPosition:o,feedback:r,reducedMotion:a,children:i}){let{t:s}=eo(),{attributes:l,listeners:d,setNodeRef:c,setActivatorNodeRef:f,transform:p,transition:m,isDragging:g}=mT({id:e.intentId,disabled:t,transition:a?null:{duration:160,easing:"ease-out"}});return b("li",{ref:c,"data-queue-intent":e.intentId,"data-queue-dragging":g||void 0,"data-queue-feedback":r,style:{transform:yi.Transform.toString(p),transition:m},className:$("relative flex items-center gap-1.5 border-t border-border/50 px-2 py-1.5",g&&"z-10 bg-accent shadow-md ring-1 ring-primary/50 ring-inset",r==="saved"&&"bg-primary/10 ring-1 ring-primary/30 ring-inset",r==="failed"&&"bg-destructive/10"),children:[n?u("span",{"aria-hidden":"true","data-queue-drop-position":n,className:$("pointer-events-none absolute inset-x-1 z-20 h-0.5 rounded-full bg-primary before:absolute before:-top-0.5 before:start-0 before:size-1.5 before:rounded-full before:bg-primary",n==="before"?"top-0":"bottom-0")}):null,u(ce,{ref:f,size:"icon-xs",variant:"ghost",className:$("shrink-0 touch-none cursor-grab text-muted-foreground active:cursor-grabbing",(g||r==="saved")&&"bg-primary/10 text-primary"),...l,...d,"aria-label":s("turnQueue.reorderMessage"),title:s("turnQueue.reorderMessage"),softDisabled:t,children:r==="saved"?u(ho,{className:"size-3.5"}):u(Gd,{className:"size-3.5"})}),i,g&&o?u("span",{"aria-hidden":"true","data-queue-drag-position":!0,className:"pointer-events-none absolute end-3 rounded bg-primary/10 px-2 py-1 font-medium text-primary tabular-nums",children:o}):null]})}function ET({inputKey:e,entries:t,pendingSubmissions:n=oH,environmentId:o,unavailable:r,attachments:a,actions:i,onCancel:s}){let{t:l}=eo(),d=Sp("(prefers-reduced-motion: reduce)"),[c,f]=ln("turn-queue:editing",e,null),[p,m]=ln("turn-queue:pending",e,!1),g=Rt("turn-queue:pending-ref",e,!1),[h,v]=ln("turn-queue:error",e,null),[y,x]=ln("turn-queue:drag",e,null),[C,w]=ln("turn-queue:move",e,null),L=Rt("turn-queue:reorder-ref",e,!1),[S,k]=ln("turn-queue:feedback",e,null),I=U0(dv(Dl,{activationConstraint:{distance:5}}),dv(_l,{coordinateGetter:gT,scrollBehavior:d?"auto":"smooth"})),T=K(()=>t.filter(H=>H.waiting),[t]),A=C?PT(T,C.preview):null,P=A?.entries??T,_=P.length+n.length,E=r||p||C!==null,F=P.findIndex(H=>H.intentId===y?.activeId),B=P.findIndex(H=>H.intentId===y?.overId);W(()=>{IT(e,t)},[t,e]),W(()=>{C!==null&&(r||C.acknowledged&&A?.settled)&&(L.current=!1,w(null),!r&&T.some(H=>H.intentId===C.preview.intentId)&&k({intentId:C.preview.intentId,kind:"saved"}))},[T,C,A?.settled,r]),W(()=>{if(S===null||S.kind==="failed")return;let H=window.setTimeout(()=>k(q=>q===S?null:q),1600);return()=>window.clearTimeout(H)},[S]);let V=async H=>{if(!(g.current||L.current||r)){g.current=!0,m(!0),v(null),k(null);try{await H()}catch(q){v(q instanceof Error?q.message:l("turnQueue.actionFailed"))}finally{g.current=!1,m(!1)}}},Q=(H,q)=>V(async()=>{let ee=LT(T,H.intentId,q);if(!(ee===null||!H.management?.canReorder)){L.current=!0,w({preview:ee,acknowledged:!1});try{await i.onReorder(H,q),w(G=>G?.preview===ee?{...G,acknowledged:!0}:G)}catch(G){throw L.current=!1,w(null),k({intentId:H.intentId,kind:"failed"}),G}}}),Se=r?l("turnQueue.disconnected"):C!==null?l("turnQueue.saving"):y!==null?`${l("turnQueue.dragStarted")} ${B+1}/${P.length}`:S?.kind==="saved"?l("common.action.done"):S?.kind==="cancelled"?l("turnQueue.dragCancelled"):"";return b(Le,{children:[_>0?b("section",{"aria-label":l("turnQueue.pendingMessages"),"data-turn-queue-dock":!0,className:"mx-auto mb-2 w-full max-w-3xl overflow-hidden rounded-xl border border-border/60 bg-background/95 text-xs shadow-xs",children:[b("div",{className:"flex h-7 items-center justify-between gap-3 px-3 py-1.5 text-muted-foreground",children:[u("span",{className:"shrink-0",children:l("turnQueue.queued",{count:_})}),u("span",{role:"status","aria-live":y===null?"polite":"off","data-queue-reorder-status":C?"saving":S?.kind,className:$("min-w-0 truncate",S?.kind==="saved"&&"text-primary"),children:Se})]}),u(oT,{sensors:I,collisionDetection:K0,modifiers:nH,accessibility:{screenReaderInstructions:{draggable:l("turnQueue.dragInstructions")},announcements:{onDragStart:()=>l("turnQueue.dragStarted"),onDragOver:({over:H})=>{let q=P.findIndex(ee=>ee.intentId===H?.id);return q<0?void 0:`${l("turnQueue.dragStarted")} ${q+1}/${P.length}`},onDragEnd:()=>l("turnQueue.dragFinished"),onDragCancel:()=>l("turnQueue.dragCancelled")}},onDragStart:({active:H})=>{let q=P.find(ee=>ee.intentId===H.id);!q?.management?.canReorder||E||(v(null),k(null),x({activeId:q.intentId,overId:q.intentId}))},onDragOver:({over:H})=>{let q=P.find(ee=>ee.intentId===H?.id);q&&x(ee=>ee&&{...ee,overId:q.intentId})},onDragCancel:()=>{y&&k({intentId:y.activeId,kind:"cancelled"}),x(null)},onDragEnd:({active:H,over:q})=>{if(x(null),!q||H.id===q.id)return;let ee=P.findIndex(U=>U.intentId===H.id),G=P.findIndex(U=>U.intentId===q.id),te=P[ee];if(!te?.management?.canReorder||G<0)return;let me=P[G+(ee<G?1:0)]?.intentId??null;Q(te,me)},children:u(fT,{items:P.map(H=>H.intentId),strategy:dT,children:b("ol",{className:"max-h-52 overflow-x-hidden overflow-y-auto overscroll-contain [scrollbar-gutter:stable]",children:[P.map((H,q)=>b(aH,{entry:H,disabled:!H.management?.canReorder||E,reducedMotion:d,feedback:S?.intentId===H.intentId?S.kind:void 0,dropPosition:H.intentId===y?.overId&&F!==B?F<B?"after":"before":void 0,dragPosition:H.intentId===y?.activeId?`${B+1}/${P.length}`:void 0,children:[b("div",{className:"min-w-0 flex-1",children:[u("p",{className:"line-clamp-2 whitespace-pre-wrap break-words [overflow-wrap:anywhere]",children:zh(H.text??"")||l("turnQueue.attachmentsOnly")}),H.attachmentNames.length?b("p",{className:"flex items-center gap-1 text-muted-foreground",children:[u(vo,{className:"size-3 shrink-0"}),u("span",{className:"truncate",children:H.attachmentNames.join(", ")})]}):null,H.pendingAction?u("p",{className:"text-muted-foreground",children:l(H.pendingAction==="steer"?"turnQueue.steering":"turnQueue.interrupting")}):null,H.failure?u("p",{role:"alert",className:"text-destructive-foreground",children:H.failure}):null]}),b("div",{className:$("flex shrink-0 items-center gap-0.5",H.intentId===y?.activeId&&"invisible"),children:[u(ce,{size:"icon-xs",variant:"ghost",disabled:!H.management||E||y!==null,"aria-label":l("turnQueue.editMessage"),title:l("turnQueue.editMessage"),onClick:()=>f(H),children:u(tc,{className:"size-3.5"})}),H.management?.canSteer?u(ce,{size:"icon-xs",variant:"ghost",disabled:E||y!==null,"aria-label":l("turnQueue.steer"),title:l("turnQueue.steerDescription"),onClick:()=>{V(()=>i.onRun(H,"steer"))},children:u(nc,{className:"size-3.5"})}):null,b(Eo,{children:[u(Mo,{render:u(ce,{size:"icon-xs",variant:"ghost",disabled:E||!H.management||y!==null,"aria-label":l("turnQueue.messageActions")}),children:u(lr,{className:"size-4"})}),b(Ro,{align:"end",children:[b(dr,{disabled:!H.management?.canReorder||q===0,onClick:()=>{Q(H,P[q-1].intentId)},children:[u(Fd,{className:"size-4"}),l("turnQueue.moveUp")]}),b(dr,{disabled:!H.management?.canReorder||q===P.length-1,onClick:()=>{Q(H,P[q+2]?.intentId??null)},children:[u(Dd,{className:"size-4"}),l("turnQueue.moveDown")]}),H.management?.canSteer?u(dr,{onClick:()=>{V(()=>i.onRun(H,"steer"))},children:l("turnQueue.steer")}):null,u(dr,{disabled:!H.management?.canRun,onClick:()=>{V(()=>i.onRun(H,"interrupt"))},children:l(H.management?.expectedTurnId?"turnQueue.interruptAndRun":"turnQueue.sendNext")}),u(ci,{}),u(dr,{disabled:H.action!=="cancel",onClick:()=>{V(()=>s(H))},children:l("turnQueue.cancelMessage")})]})]})]})]},H.intentId)),n.map(H=>u(rH,{submission:H},H.messageId))]})})},e),h?u("p",{role:"alert",className:"px-3 py-2 text-destructive-foreground",children:h}):null]}):null,c?u(TT,{entry:c,current:t.find(H=>H.intentId===c.intentId),inputKey:e,environmentId:o,unavailable:E,attachments:a,watchEditorAuthority:i.watchEditorAuthority,onEdit:i.onEdit,onClose:()=>f(null)},`${e}\0${c.intentId}\0${c.management?.revision??"none"}`):null]})}function RT({data:e,target:t,inputKey:n,attachments:o}){let r=e.useQueue({target:t,threadKey:n}),{environmentId:a,threadId:i}=t,s=e.queue,l=K(()=>{let d={environmentId:a,threadId:i};return{actions:{onEdit:(f,p)=>s.edit(d,f,p),onReorder:(f,p)=>s.reorder(d,f,p),onRun:(f,p)=>s.run(d,f,p),watchEditorAuthority:s.watchEditorAuthority},onCancel:f=>s.cancel(d,f),onResume:()=>s.resume(d)}},[s,a,i]);return b(Le,{children:[u(ET,{inputKey:n,actions:l.actions,attachments:o,entries:r.entries,pendingSubmissions:r.pendingSubmissions,environmentId:a,onCancel:l.onCancel,unavailable:r.unavailable}),u(fv,{entries:r.entries,onCancel:l.onCancel,onResume:l.onResume,queue:r.state,unavailable:r.unavailable})]})}ue();var pv=220,iH={opacity:0,transform:"translate3d(0, 4rem, 0)"},sH={opacity:0,transform:"translate3d(0, 7rem, 0)"},MT={opacity:1,transform:"none"},NT={transition:`transform ${pv}ms ease-in, opacity ${pv}ms ease-in`},lH={default:"border-[var(--chat-composer-attached-outline)]",error:"border-destructive/24",info:"border-info/24",success:"border-success/24",warning:"border-warning/24"};function DT({className:e,items:t}){let{t:n}=Ce(),[o,r]=J(null),a=N(null),i=o!==null&&t.some(m=>m.id===o)?o:null;if(W(()=>()=>{a.current&&clearTimeout(a.current)},[]),t.length===0)return null;let s=t[0];if(!s)return null;let l=t.slice(1),d=l.length>0,c=d&&i!==s.id,f=l[0],p=m=>{!m.onDismiss||i||(r(m.id),a.current&&clearTimeout(a.current),a.current=setTimeout(()=>{a.current=null,m.onDismiss?.()},pv))};return u("div",{className:$("group/banner-stack chat-composer-drawer-slot",e),"data-composer-banner-drawer":"true",children:b("div",{className:$("relative flex flex-col-reverse",d?"group-hover/banner-stack:z-50 group-focus-within/banner-stack:z-50":null),children:[c&&f?u("div",{className:$("pointer-events-none absolute inset-x-0 -top-3 z-0 mx-auto h-3 rounded-t-2xl","chat-composer-banner-stack-cap border border-b-0 shadow-[0_6px_18px_rgba(0,0,0,0.06)]",lH[f.variant],"transition-opacity duration-150 ease-out","group-hover/banner-stack:opacity-0 group-focus-within/banner-stack:opacity-0"),style:{width:"96%"},"aria-hidden":"true"}):null,u("div",{className:$("relative z-10",i===s.id?"pointer-events-none":null),style:{...NT,...i===s.id?iH:MT},children:u(_T,{item:s,attached:!0,exiting:i===s.id,onDismissRequest:()=>p(s)})}),d?u("div",{"data-composer-banner-stack-expanded-items":"true",className:$("relative z-20 grid grid-rows-[0fr] transition-[grid-template-rows] duration-150 ease-out","group-hover/banner-stack:grid-rows-[1fr] group-focus-within/banner-stack:grid-rows-[1fr]"),children:u("div",{className:"min-h-0 overflow-hidden",children:u("div",{className:$("invisible pointer-events-none space-y-2 pb-2 opacity-0","translate-y-1 transform-gpu transition-[opacity,transform] duration-150 ease-out will-change-[opacity,transform]","group-hover/banner-stack:visible group-hover/banner-stack:pointer-events-auto group-hover/banner-stack:translate-y-0 group-hover/banner-stack:opacity-100","group-focus-within/banner-stack:visible group-focus-within/banner-stack:pointer-events-auto group-focus-within/banner-stack:translate-y-0 group-focus-within/banner-stack:opacity-100"),children:l.map(m=>u("div",{className:$(i===m.id?"pointer-events-none":null),style:{...NT,...i===m.id?sH:MT},children:u(_T,{item:m,attached:!1,exiting:i===m.id,onDismissRequest:()=>p(m)})},m.id))})})}):null]})})}function _T({item:e,attached:t,exiting:n,onDismissRequest:o}){let{t:r}=Ce(),a=e.onDismiss&&!e.actions;return e.presentation==="compact"?b(uc,{variant:e.variant,role:"status",className:$("min-h-0 px-3 text-xs sm:px-4",t?"chat-composer-drawer-surface chat-composer-drawer-attached pt-1.5 pb-[calc(var(--chat-composer-attachment-overlap)_+_0.25rem)]":"alert-glass rounded-[22px] py-1.5",e.className),"data-composer-banner-presentation":"compact","data-variant":e.variant,children:[e.icon,b(Th,{className:"flex min-w-0 items-baseline gap-1.5 font-normal leading-5",children:[u("span",{className:"shrink-0 font-medium text-foreground",children:e.title}),e.description?u("span",{className:"min-w-0 truncate text-muted-foreground",children:e.description}):null]}),e.actions||e.onDismiss?b(fc,{className:$("shrink-0",e.actionClassName),children:[e.actions,e.onDismiss?u(ce,{size:"icon-xs",variant:"ghost","aria-label":e.dismissLabel??r("composer.dismissNotice"),disabled:n,onClick:o,children:u(en,{})}):null]}):null]}):b(uc,{variant:e.variant,className:$(t?"chat-composer-drawer-surface chat-composer-drawer-attached px-3 pt-2 pb-[calc(var(--chat-composer-attachment-overlap)_+_0.375rem)] text-xs sm:px-4":"alert-glass rounded-[22px]",e.className),"data-variant":e.variant,children:[e.icon,u(Th,{children:e.title}),e.description?u(Bf,{children:e.description}):null,e.actions||e.onDismiss?b(fc,{className:$(e.actionClassName,a?"max-sm:col-start-3 max-sm:row-start-1 max-sm:mt-0 max-sm:self-start":void 0),children:[e.actions,e.onDismiss?u(ce,{size:"icon-xs",variant:"ghost","aria-label":e.dismissLabel??r("composer.dismissWarning"),disabled:n,onClick:o,children:u(en,{})}):null]}):null]})}ue();var OT=Ct(!1),FT=OT.Provider;function BT(){return Ht(OT)}function zT({belowSlot:e,composer:t,data:n,draftHero:o,onOverlayElementChange:r,queue:a,target:i,threadKey:s}){let l=n.useComposerBanners({target:i,threadKey:s}),d=u(DT,{className:"relative z-0",items:l.items});return b("div",{ref:r,"data-chat-composer-overlay":"true",className:o.active?"pointer-events-none absolute inset-0 z-20 flex items-center":"pointer-events-none absolute inset-x-0 bottom-0 z-20 pt-1.5 sm:pt-2",children:[b("div",{ref:o.transitionGroupRef,className:"w-full ps-[calc(env(safe-area-inset-left)+0.75rem)] pe-[calc(env(safe-area-inset-right)+0.75rem)] sm:ps-[calc(env(safe-area-inset-left)+1.25rem)] sm:pe-[calc(env(safe-area-inset-right)+1.25rem)]",children:[b("div",{className:"pointer-events-auto relative z-10",children:[a,o.active?b("div",{className:"absolute inset-x-0 bottom-full z-0",children:[u("div",{className:"pb-8",style:{viewTransitionName:o.headlineTransitionName},children:o.headline}),d]}):d,b("div",{"data-chat-composer-stack":"true",className:"chat-composer-glass-shell relative mx-auto w-full max-w-3xl",style:{viewTransitionName:o.composerTransitionName},children:[u("div",{className:"chat-composer-glass-host relative z-10 w-full rounded-[22px]",children:u("div",{ref:o.composerAnchorRef,className:"relative z-10",children:u(FT,{value:l.items.length>0,children:t})})}),u("div",{className:"min-h-0",children:e})]})]}),u("div",{"aria-hidden":!0,className:"h-[calc(env(safe-area-inset-bottom)+1rem)] sm:h-[calc(env(safe-area-inset-bottom)+1.25rem)]"})]}),l.overlay]})}function UT(e,t){let n=e!==null&&e!=="plan-follow-up";return{showTopDrawer:e!==null&&(n||!t),showCollapsedPromptRow:t&&!n,hasBlocking:n}}var dH=["image/gif","image/jpeg","image/png","image/webp"],cH=new Set(dH);function mv(e){return cH.has(e.toLowerCase())}function uH(e){return mv(e)?"image":"file"}var fH=new Set(["application/json","application/xml","application/x-yaml","application/yaml"]);function gv(e){if(e.type==="image")return"image";let t=e.mimeType.toLowerCase();return t==="application/pdf"?"pdf":t.startsWith("text/")||fH.has(t)?"text":"file"}function hv(e){return!Number.isFinite(e)||e<=0?"0 KB":e>=1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${Math.max(1,Math.round(e/1024))} KB`}function vv(e){let t={id:e.id,name:e.name,mimeType:e.mimeType,sizeBytes:e.sizeBytes};return uH(e.mimeType)==="image"?{type:"image",...t}:{type:"file",...t}}ue();var pH=/(^|\s)\$([a-zA-Z][a-zA-Z0-9:_-]*)(?=\s)/g,mH=/(^|\s)@(?:"((?:\\.|[^"\\])*)"|([^\s@"]+))(?=\s)/g;var gH=new RegExp("(^|\\s)\\[((?:\\\\.|[^\\]\\\\]){0,512})\\]\\(([^)\\s]+)\\)(?=\\s)","g"),hH=/^[A-Za-z][A-Za-z0-9+.-]*:/,vH=/^[A-Za-z]:[\\/]/,yH=/^[a-z0-9][a-z0-9._-]*\/[a-z0-9][a-z0-9._-]*(?:\/[^\s@"]+)*$/;function xH(e){let t=[];for(let n of e.matchAll(gH)){let o=n[0],r=n[1]??"",a=(n[2]??"").replace(/\\(.)/g,"$1"),i=n[3]??"",s=i;try{s=decodeURIComponent(i)}catch{}let l=Math.max(s.lastIndexOf("/"),s.lastIndexOf("\\")),d=l>=0?s.slice(l+1):s,c=hH.test(s)&&!vH.test(s);if(!s||c||a!==d)continue;let f=(n.index??0)+r.length,p=f+o.length-r.length;t.push({type:"mention",value:s,source:e.slice(f,p),start:f,end:p})}for(let n of e.matchAll(mH)){let o=n[0],r=n[1]??"",a=n[2],i=a!==void 0?a.replace(/\\(.)/g,"$1"):n[3]??"";if(!i||a===void 0&&yH.test(i))continue;let s=(n.index??0)+r.length,l=s+o.length-r.length;t.push({type:"mention",value:i,source:e.slice(s,l),start:s,end:l})}return t}function _c(e,t={}){let n=xH(e);for(let o of e.matchAll(pH)){let r=o[0],a=o[1]??"",i=o[2]??"";if(!i)continue;let s=(o.index??0)+a.length,l=s+r.length-a.length;n.push({type:"skill",value:i,source:e.slice(s,l),start:s,end:l})}for(let o of t.preserveTrailingFrom??[])o.end===e.length&&e.slice(o.start,o.end)===o.source&&!n.some(r=>r.type===o.type&&r.start===o.start&&r.end===o.end)&&n.push(o);return[...n].sort((o,r)=>o.start-r.start)}function CH(e){return e.replace(/\r\n/g,`
|
|
3768
|
-
`).replace(/^\n+|\n+$/g,"")}function
|
|
3769
|
-
`||e===" "||e==="\r"||e==="\uFFFC"}function
|
|
3770
|
-
`,Math.max(0,n-1))+1,r=e.slice(o,n);if(r.startsWith("/")){let s=/^\/(\S*)$/.exec(r);if(s)return{kind:"slash-command",query:s[1]??"",rangeStart:o,rangeEnd:n}}let a=
|
|
3771
|
-
`)}function RH({context:e,onRemove:t}){let{t:n}=Ce(),o=Wt().elementContext,r=o.formatLabel(e),a=o.formatSourceLabel(e);return b(Ye,{children:[u(Ze,{render:b("span",{className:$(bi,"pr-1"),children:[u(ta,{className:$(aa,"size-icon-1")}),u("span",{className:ia,children:r}),a?u("span",{className:"select-none text-[10px] font-normal leading-tight text-muted-foreground/85",children:a}):null,u("button",{type:"button","aria-label":n("pendingContext.removeElement",{label:r}),className:Ep,onClick:i=>{i.preventDefault(),i.stopPropagation(),t(e.id)},children:u(en,{className:"size-3","aria-hidden":!0})})]})}),u(Je,{side:"top",className:"max-w-96 whitespace-pre-wrap leading-tight",children:EH(e,o.formatLabel,o.formatSourceLabel)})]})}function dk({contexts:e,onRemove:t,className:n}){return e.length===0?null:u("div",{className:$("flex flex-wrap gap-1.5",n),children:e.map(o=>u(RH,{context:o,onRemove:t},o.id))})}function ck({comments:e,onRemove:t,className:n}){let{t:o}=Ce();return e.length===0?null:u("div",{className:$("flex flex-wrap gap-1.5",n),children:e.map(r=>{let a=`${r.filePath} ${r.rangeLabel}`,i=b("span",{className:$(bi,"pr-1"),children:[u(os,{className:$(aa,"size-icon-1")}),u("span",{className:ia,children:a}),u("button",{type:"button","aria-label":o("pendingContext.removeReviewComment",{label:a}),className:Ep,onClick:s=>{s.preventDefault(),s.stopPropagation(),t(r.id)},children:u(en,{className:"size-3","aria-hidden":!0})})]},r.id);return r.text.length===0?i:b(Ye,{children:[u(Ze,{render:i}),u(Je,{side:"top",className:"max-w-96 whitespace-pre-wrap leading-tight",children:r.text})]},r.id)})})}function Rp(e){let{t}=Ce(),n=t(e.tooltipKey,{count:e.count});return b(Ye,{children:[u(Ze,{render:b("span",{className:"inline-flex items-center gap-1 text-[10px] font-medium text-muted-foreground",children:[e.icon,e.count]})}),u(Je,{side:"top",children:n})]})}function uk({annotations:e,images:t,onRemove:n,onExpandImage:o,uploadsByImageId:r,onRetryUpload:a,className:i}){let{t:s}=Ce(),l=Wt().elementContext;if(e.length===0)return null;let d=new Map(t.map(c=>[c.id,c]));return u("div",{className:$("flex flex-wrap gap-1.5",i),children:e.map(c=>{let f=d.get(c.id),p=f?r?.[f.id]:void 0,m=c.elements.flatMap(g=>{let h=l.normalizeSelection(g.element);return h?[{id:g.id,label:l.formatLabel(h)}]:[]});return b("section",{className:"group/preview-annotation relative flex min-w-0 max-w-full items-center overflow-hidden rounded-lg border border-border/80 bg-background/72",children:[f?.previewUrl?u("button",{type:"button","aria-label":s("previewAnnotation.previewImage",{name:f.name}),className:"size-14 shrink-0 cursor-zoom-in overflow-hidden border-r border-border/70 bg-muted",onClick:()=>o(f.id),children:u("img",{src:f.previewUrl,alt:s("previewAnnotation.cropAlt"),className:"size-full object-cover transition-transform duration-(--control-duration) group-hover/preview-annotation:scale-[1.03]"})}):u("span",{className:"grid size-10 shrink-0 place-items-center border-r border-border/70 text-message-action",children:u(ta,{className:"size-icon-2"})}),b("div",{className:"min-w-0 px-2.5 py-2 pr-8",children:[c.comment.trim()?u("p",{className:"max-w-80 truncate text-foreground text-xs font-medium",children:c.comment.trim()}):null,b("div",{className:$("flex min-w-0 items-center gap-2",c.comment.trim()&&"mt-1"),children:[m.length>0?b("div",{className:"flex min-w-0 items-center gap-1",children:[m.slice(0,2).map(({id:g,label:h})=>u("span",{className:"max-w-40 truncate font-mono text-secondary-label text-[10px]",children:h},g)),m.length>2?b("span",{className:"text-secondary-label text-[10px]",children:["+",m.length-2]}):null]}):null,b("div",{className:"flex shrink-0 items-center gap-2",children:[c.elements.length>0?u(Rp,{icon:u(ta,{className:"size-3"}),count:c.elements.length,tooltipKey:"previewAnnotation.elementCount"}):null,c.regions.length>0?u(Rp,{icon:u(Vd,{className:"size-3"}),count:c.regions.length,tooltipKey:"previewAnnotation.regionCount"}):null,c.strokes.length>0?u(Rp,{icon:u(na,{className:"size-3"}),count:c.strokes.length,tooltipKey:"previewAnnotation.drawingCount"}):null,c.styleChanges.length>0?u(Rp,{icon:u(as,{className:"size-3"}),count:c.styleChanges.length,tooltipKey:"previewAnnotation.styleChangeCount"}):null,p?.status==="uploading"?u("span",{className:"text-[10px] text-secondary-label",children:Pp(p.progress)}):null,p?.status==="failed"&&f&&a?b(Ye,{children:[u(Ze,{render:u(ce,{size:"icon-micro",variant:"ghost-muted","aria-label":s("attachments.retryUpload",{name:f.name}),onClick:()=>a(f)}),children:u(ss,{className:"size-3"})}),u(Je,{side:"top",children:Lp(p,s)})]}):null]})]})]}),u(ce,{size:"icon-micro",variant:"ghost-muted","aria-label":s("previewAnnotation.remove"),className:"absolute right-1.5 top-1.5 [--control-icon-color:currentColor] rounded text-icon-muted hover:bg-muted",onClick:()=>n(c.id),children:u(en,{className:"size-3"})})]},c.id)})})}ue();function fk(e,t){let n=t?.hasWideActions?780:620;return e!==null&&e<n}function pk(e,t){return t?.hasWideActions?e!==null&&e<780:!1}function mk(e,t){let n=Wt().pane.useVisible(),[o,r]=J(null);he(()=>{if(!n)return;let i=e.current;if(!i)return;let s=!0;if(typeof ResizeObserver<"u"){let c=new ResizeObserver(f=>{if(!s)return;let p=f.find(v=>v.target===i);if(!p)return;let m=window.getComputedStyle(i),g=Number.parseFloat(m.paddingLeft)||0,h=Number.parseFloat(m.paddingRight)||0;r(Math.round(p.contentRect.width+g+h))});return c.observe(i),()=>{s=!1,c.disconnect()}}let l=null,d=()=>{l===null&&(l=window.requestAnimationFrame(()=>{l=null,s&&r(i.clientWidth)}))};return d(),window.addEventListener("resize",d),()=>{s=!1,window.removeEventListener("resize",d),l!==null&&window.cancelAnimationFrame(l)}},[e,n]);let a=fk(o,{hasWideActions:t});return{isComposerFooterCompact:a,isComposerPrimaryActionsCompact:a&&pk(o,{hasWideActions:t})}}ue();function MH(e){let t=[];for(let n of e.split(/[\s:_-]+/))n.length!==0&&t.push(n.charAt(0).toUpperCase()+n.slice(1));return t.join(" ")}function NH(e){return e.replaceAll("\\","/")}function sa(e){let t=e.displayName?.trim();return t||MH(e.name)}function gk(e,t){return t?e.filter(n=>n.enabled):[]}function hk(e,t){let n=new Set(t.map(o=>o.name.trim().toLowerCase()));return e.filter(o=>!n.has(o.name.trim().toLowerCase()))}function vk(e){let t=NH(e.path);if(t.includes("/.codex/plugins/")||t.includes("/.agents/plugins/"))return"app";switch(e.scope?.trim().toLowerCase()){case"repo":case"repository":return"repo";case"project":case"workspace":case"local":return"project";case"user":case"personal":return"personal";case"system":return"system";case void 0:case"":return"other";default:return"other"}}ue();ue();var Mp=pe(function(t){let n=Wt().pierreIcons,o=n.useSpriteReady();Nd(n.ensureSprite,[n]);let r=K(()=>n.resolveForEntry(t.pathValue,t.kind),[n,t.kind,t.pathValue]);return o?u("svg",{"aria-hidden":"true","data-file-icon":r.symbolId,className:$("size-4 shrink-0",t.className),children:u("use",{href:`#${r.symbolId}`})}):t.kind==="directory"?u(ii,{className:$("size-4 shrink-0 text-icon-muted",t.className)}):u(Kd,{className:$("size-4 shrink-0 text-icon-muted",t.className)})});var yk={recent:"slashMenu.sections.recent",builtIn:"slashMenu.sections.builtIn",provider:"slashMenu.sections.provider",skills:"slashMenu.sections.skills"},xk=pe(function(t){let{t:n}=Ce(),o=N(null);return he(()=>{if(!t.activeItemId||!o.current)return;o.current.querySelector(`[data-composer-item-id="${CSS.escape(t.activeItemId)}"]`)?.scrollIntoView({block:"nearest"})},[t.activeItemId]),u(Uf,{autoHighlight:!1,mode:"none",onItemHighlighted:r=>{t.onHighlightedItemChange(typeof r=="string"?r:null)},children:u("div",{ref:o,className:"chat-composer-drawer-surface chat-composer-drawer-attached relative w-full overflow-hidden **:data-[slot=scroll-area-scrollbar]:data-[orientation=vertical]:my-4","data-composer-command-drawer":"true",children:t.items.length>0?u(Kf,{className:"max-h-72 scroll-pb-6",children:u(Hf,{children:t.items.map((r,a)=>u(_H,{sectionTitle:r.section!==void 0&&t.items[a-1]?.section!==r.section?r.section:null,item:r,triggerKind:t.triggerKind,resolvedTheme:t.resolvedTheme,isActive:t.activeItemId===r.id,onHighlight:t.onHighlightedItemChange,onSelect:t.onSelect},r.id))})}):u("div",{className:"px-5 pt-3.5 pb-7",children:u("p",{className:"text-secondary-label text-xs",children:t.isLoading?t.triggerKind==="skill"?n("composer.searchingSkills"):n("composer.searchingFiles"):t.emptyStateText??(t.triggerKind==="skill"?n("composer.noSkillsFound"):t.triggerKind==="path"?n("composer.noMatchingFiles"):n("composer.noMatchingCommand"))})})})})}),_H=pe(function(t){let{t:n}=Ce(),o=t.item.type==="skill"?vk(t.item.skill):null,r=t.triggerKind==="slash-command"&&t.item.type==="skill"?t.item.skill:null;return b(Le,{children:[t.sectionTitle!==null?u("div",{role:"presentation","data-composer-menu-section":t.sectionTitle,className:"px-3 pt-2 pb-1 text-xs text-secondary-label",children:n(yk[t.sectionTitle]??yk.recent)}):null,b($f,{value:t.item.id,"data-composer-item-id":t.item.id,className:$("cursor-pointer select-none gap-3 rounded-lg px-3 py-2! hover:bg-transparent hover:text-inherit data-highlighted:bg-transparent data-highlighted:text-inherit",t.isActive&&"bg-accent! text-accent-foreground!"),onMouseMove:()=>{t.isActive||t.onHighlight(t.item.id)},onMouseDown:a=>{a.preventDefault()},onClick:()=>{t.onSelect(t.item)},children:[t.item.type==="path"?u(Mp,{pathValue:t.item.path,kind:t.item.pathKind,theme:t.resolvedTheme}):null,b("span",{className:"flex min-w-0 flex-1 items-center gap-2",children:[u("span",{className:"min-w-0 max-w-[45%] shrink-0 truncate font-sans text-xs font-medium",children:r?b(Le,{children:[u("span",{className:"text-secondary-label",children:"/skill:"}),sa(r)]}):t.item.label}),u("span",{className:"min-w-0 max-w-[48ch] flex-1 truncate text-left text-secondary-label text-xs",children:t.item.description}),o?u(FH,{kind:o,showSkillSuffix:t.triggerKind==="skill"}):null]})]})]})}),DH={app:Bd,repo:ii,project:ii,personal:oa,system:oc,other:Zd},OH={app:"slashMenu.skillSource.app",repo:"slashMenu.skillSource.repo",project:"slashMenu.skillSource.project",personal:"slashMenu.skillSource.personal",system:"slashMenu.skillSource.system",other:"slashMenu.skillSource.other"};function FH(e){let{t}=Ce(),n=DH[e.kind],o=t(OH[e.kind]);return b(yl,{className:"ms-auto",variant:"secondary",children:[u(n,{"aria-hidden":"true",className:"text-current"}),e.showSkillSuffix?t("slashMenu.skillSourceWithSuffix",{source:o}):o]})}var wv={};En(wv,{LexicalComposerContext:()=>Ck,createLexicalComposerContext:()=>BH,useLexicalComposerContext:()=>zH});ue();var Ck=Ct(null);function BH(e,t){let n=null;return e!=null&&(n=e[1]),{getTheme:function(){return t??(n!=null?n.getTheme():null)}}}function zH(){let e=Ht(Ck);return e==null&&(function(t,...n){let o=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",t);for(let a of n)r.append("v",a);throw o.search=r.toString(),Error(`Minified Lexical error #${t}; visit ${o.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)})(8),e}var Sv=wv,bk=Sv.LexicalComposerContext,wk=Sv.createLexicalComposerContext,Cn=Sv.useLexicalComposerContext;var Jy={};En(Jy,{$addUpdateTag:()=>vm,$applyNodeReplacement:()=>iu,$caretFromPoint:()=>Ri,$caretRangeFromSelection:()=>cy,$cloneWithProperties:()=>qy,$cloneWithPropertiesEphemeral:()=>wK,$comparePointCaretNext:()=>Qy,$copyNode:()=>Ky,$create:()=>IK,$createLineBreakNode:()=>ql,$createNodeSelection:()=>Py,$createParagraphNode:()=>_a,$createPoint:()=>Dr,$createRangeSelection:()=>fP,$createRangeSelectionFromDom:()=>Y$,$createTabNode:()=>um,$createTextNode:()=>Hn,$extendCaretToRange:()=>Gy,$findMatchingParent:()=>Hc,$getAdjacentChildCaret:()=>Zl,$getAdjacentNode:()=>MP,$getAdjacentSiblingOrParentSiblingCaret:()=>MK,$getCaretInDirection:()=>Mi,$getCaretRange:()=>Ei,$getCaretRangeInDirection:()=>Yy,$getCharacterOffsets:()=>ny,$getChildCaret:()=>Oa,$getChildCaretAtIndex:()=>GP,$getChildCaretOrSelf:()=>$P,$getCollapsedCaretRange:()=>KP,$getCommonAncestor:()=>$c,$getCommonAncestorResultBranchOrder:()=>Xy,$getEditor:()=>Vy,$getNearestNodeFromDOMNode:()=>hm,$getNearestRootOrShadowRoot:()=>DP,$getNodeByKey:()=>Fn,$getNodeByKeyOrThrow:()=>OP,$getNodeFromDOMNode:()=>Oy,$getPreviousSelection:()=>Ds,$getRoot:()=>Qo,$getSelection:()=>Ft,$getSiblingCaret:()=>Wn,$getState:()=>Vp,$getStateChange:()=>v$,$getTextContent:()=>eK,$getTextNodeOffset:()=>_r,$getTextPointCaret:()=>Ai,$getTextPointCaretSlice:()=>ly,$getWritableNodeState:()=>my,$hasAncestor:()=>am,$hasUpdateTag:()=>vK,$insertNodes:()=>Z$,$isBlockElementNode:()=>X$,$isChildCaret:()=>Nr,$isDecoratorNode:()=>tn,$isEditorState:()=>rK,$isElementNode:()=>re,$isExtendableTextPointCaret:()=>WP,$isInlineElementOrDecoratorNode:()=>yK,$isLeafNode:()=>mK,$isLineBreakNode:()=>Ps,$isNodeCaret:()=>LK,$isNodeSelection:()=>nu,$isParagraphNode:()=>xP,$isRangeSelection:()=>Ge,$isRootNode:()=>to,$isRootOrShadowRoot:()=>gr,$isSiblingCaret:()=>_s,$isTabNode:()=>Ly,$isTextNode:()=>ze,$isTextPointCaret:()=>Da,$isTextPointCaretSlice:()=>RK,$isTokenOrSegmented:()=>Ra,$isTokenOrTab:()=>Ii,$nodesOfType:()=>hK,$normalizeCaret:()=>Rr,$normalizeSelection__EXPERIMENTAL:()=>qp,$onUpdate:()=>_P,$parseSerializedNode:()=>oK,$removeTextFromCaretRange:()=>qP,$rewindSiblingCaret:()=>od,$selectAll:()=>gK,$setCompositionKey:()=>Kn,$setPointFromCaret:()=>ed,$setSelection:()=>_o,$setSelectionFromCaretRange:()=>VP,$setState:()=>y$,$splitAtPointCaretNext:()=>DK,$splitNode:()=>xK,$updateRangeSelectionFromCaretRange:()=>Kc,ArtificialNode__DO_NOT_USE:()=>om,BEFORE_INPUT_COMMAND:()=>hy,BLUR_COMMAND:()=>qL,CAN_REDO_COMMAND:()=>E$,CAN_UNDO_COMMAND:()=>R$,CLEAR_EDITOR_COMMAND:()=>P$,CLEAR_HISTORY_COMMAND:()=>A$,CLICK_COMMAND:()=>PL,COLLABORATION_TAG:()=>nP,COMMAND_PRIORITY_CRITICAL:()=>dK,COMMAND_PRIORITY_EDITOR:()=>zl,COMMAND_PRIORITY_HIGH:()=>lK,COMMAND_PRIORITY_LOW:()=>iK,COMMAND_PRIORITY_NORMAL:()=>sK,COMPOSITION_END_COMMAND:()=>xy,COMPOSITION_END_TAG:()=>iP,COMPOSITION_START_COMMAND:()=>yy,COMPOSITION_START_TAG:()=>aP,CONTROLLED_TEXT_INSERTION_COMMAND:()=>Hl,COPY_COMMAND:()=>Iy,CUT_COMMAND:()=>Ty,DELETE_CHARACTER_COMMAND:()=>Gc,DELETE_LINE_COMMAND:()=>Qc,DELETE_WORD_COMMAND:()=>jc,DRAGEND_COMMAND:()=>KL,DRAGOVER_COMMAND:()=>$L,DRAGSTART_COMMAND:()=>HL,DROP_COMMAND:()=>UL,DecoratorNode:()=>Yc,ElementNode:()=>Li,FOCUS_COMMAND:()=>VL,FORMAT_ELEMENT_COMMAND:()=>L$,FORMAT_TEXT_COMMAND:()=>wi,HISTORIC_TAG:()=>z$,HISTORY_MERGE_TAG:()=>Hp,HISTORY_PUSH_TAG:()=>U$,INDENT_CONTENT_COMMAND:()=>T$,INPUT_COMMAND:()=>vy,INSERT_LINE_BREAK_COMMAND:()=>Bc,INSERT_PARAGRAPH_COMMAND:()=>Wv,INSERT_TAB_COMMAND:()=>I$,INTERNAL_$isBlock:()=>Na,IS_ALL_FORMATTING:()=>JH,IS_BOLD:()=>qH,IS_CODE:()=>QH,IS_HIGHLIGHT:()=>uy,IS_ITALIC:()=>WH,IS_STRIKETHROUGH:()=>GH,IS_SUBSCRIPT:()=>XH,IS_SUPERSCRIPT:()=>YH,IS_UNDERLINE:()=>jH,KEY_ARROW_DOWN_COMMAND:()=>_L,KEY_ARROW_LEFT_COMMAND:()=>RL,KEY_ARROW_RIGHT_COMMAND:()=>AL,KEY_ARROW_UP_COMMAND:()=>NL,KEY_BACKSPACE_COMMAND:()=>OL,KEY_DELETE_COMMAND:()=>BL,KEY_DOWN_COMMAND:()=>Sy,KEY_ENTER_COMMAND:()=>Xp,KEY_ESCAPE_COMMAND:()=>FL,KEY_MODIFIER_COMMAND:()=>WL,KEY_SPACE_COMMAND:()=>DL,KEY_TAB_COMMAND:()=>zL,LineBreakNode:()=>Vl,MOVE_TO_END:()=>EL,MOVE_TO_START:()=>ML,NODE_STATE_KEY:()=>u$,OUTDENT_CONTENT_COMMAND:()=>k$,PASTE_COMMAND:()=>Cy,PASTE_TAG:()=>H$,ParagraphNode:()=>jl,REDO_COMMAND:()=>wy,REMOVE_TEXT_COMMAND:()=>Gv,RootNode:()=>Gl,SELECTION_CHANGE_COMMAND:()=>gy,SELECTION_INSERT_CLIPBOARD_NODES_COMMAND:()=>S$,SELECT_ALL_COMMAND:()=>jv,SKIP_COLLAB_TAG:()=>$$,SKIP_DOM_SELECTION_TAG:()=>rP,SKIP_SCROLL_INTO_VIEW_TAG:()=>oP,SKIP_SELECTION_FOCUS_TAG:()=>ey,TEXT_TYPE_TO_FORMAT:()=>lo,TabNode:()=>Wl,TextNode:()=>Rs,UNDO_COMMAND:()=>by,addClassNamesToElement:()=>HK,buildImportMap:()=>B$,configExtension:()=>FK,createCommand:()=>tt,createEditor:()=>cK,createSharedNodeState:()=>wL,createState:()=>h$,declarePeerDependency:()=>BK,defineExtension:()=>OK,flipDirection:()=>Ni,getDOMOwnerDocument:()=>Hy,getDOMSelection:()=>Fr,getDOMSelectionFromTarget:()=>FP,getDOMTextNode:()=>Ns,getEditorPropertyFromDOMNode:()=>ru,getNearestEditorFromDOMNode:()=>Dy,getRegisteredNode:()=>Ny,getRegisteredNodeOrThrow:()=>My,getStaticNodeConfig:()=>su,getTextDirection:()=>pK,getTransformSetFromKlass:()=>bP,isBlockDomNode:()=>iy,isCurrentlyReadOnlyMode:()=>td,isDOMDocumentNode:()=>IP,isDOMNode:()=>nd,isDOMTextNode:()=>ca,isDOMUnmanaged:()=>HP,isDocumentFragment:()=>BP,isExactShortcutMatch:()=>$t,isHTMLAnchorElement:()=>CK,isHTMLElement:()=>So,isInlineDomNode:()=>zP,isLexicalEditor:()=>mm,isModifierMatch:()=>RP,isSelectionCapturedInDecoratorInput:()=>_y,isSelectionWithinEditor:()=>ou,makeStepwiseIterator:()=>jy,mergeRegister:()=>KK,normalizeClassNames:()=>lu,removeClassNamesFromElement:()=>$K,removeFromParent:()=>Ti,resetRandomKey:()=>uK,safeCast:()=>zK,setDOMUnmanaged:()=>SK,setNodeIndentFromDOM:()=>UP,shallowMergeConfig:()=>UK,toggleTextFormatType:()=>Zc});function de(e,...t){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(let r of t)o.append("v",r);throw n.search=o.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 mL(e,...t){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(let r of t)o.append("v",r);n.search=o.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.`)}var Or=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,UH=Or&&"documentMode"in document?document.documentMode:null,Er=Or&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),ki=Or&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Kp=!(!Or||!("InputEvent"in window)||UH)&&"getTargetRanges"in new window.InputEvent("input"),sm=Or&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),tu=Or&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,HH=Or&&/Android/.test(navigator.userAgent),gL=Or&&/^(?=.*Chrome).*/i.test(navigator.userAgent),_v=Or&&HH&&gL,lm=Or&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&Er&&!gL,$H=0,KH=1,VH=2,qH=1,WH=2,GH=4,jH=8,QH=16,XH=32,YH=64,uy=128,JH=2047,ZH=1,e$=2,t$=3,n$=4,o$=5,r$=6,Vc=sm||tu||lm?"\xA0":"\u200B",dm=`
|
|
3767
|
+
`},OU={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function FU(e){let{announcements:t=OU,container:n,hiddenTextDescribedById:o,screenReaderInstructions:r=DU}=e,{announce:a,announcement:i}=P0(),s=ms("DndLiveRegion"),[l,d]=J(!1);if(W(()=>{d(!0)},[]),NU(K(()=>({onDragStart(f){let{active:p}=f;a(t.onDragStart({active:p}))},onDragMove(f){let{active:p,over:m}=f;t.onDragMove&&a(t.onDragMove({active:p,over:m}))},onDragOver(f){let{active:p,over:m}=f;a(t.onDragOver({active:p,over:m}))},onDragEnd(f){let{active:p,over:m}=f;a(t.onDragEnd({active:p,over:m}))},onDragCancel(f){let{active:p,over:m}=f;a(t.onDragCancel({active:p,over:m}))}}),[a,t])),!l)return null;let c=yn.createElement(yn.Fragment,null,yn.createElement(k0,{id:o,value:r.draggable}),yn.createElement(L0,{id:s,announcement:i}));return n?(0,vs.createPortal)(c,n):c}var Dn;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(Dn||(Dn={}));function mp(){}function lv(e,t){return K(()=>({sensor:e,options:t??{}}),[e,t])}function $0(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return K(()=>[...t].filter(o=>o!=null),[...t])}var Pr=Object.freeze({x:0,y:0});function K0(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function V0(e,t){let{data:{value:n}}=e,{data:{value:o}}=t;return n-o}function BU(e,t){let{data:{value:n}}=e,{data:{value:o}}=t;return o-n}function A0(e){let{left:t,top:n,height:o,width:r}=e;return[{x:t,y:n},{x:t+r,y:n},{x:t,y:n+o},{x:t+r,y:n+o}]}function dv(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}function E0(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}var q0=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:o}=e,r=E0(t,t.left,t.top),a=[];for(let i of o){let{id:s}=i,l=n.get(s);if(l){let d=K0(E0(l),r);a.push({id:s,data:{droppableContainer:i,value:d}})}}return a.sort(V0)},W0=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:o}=e,r=A0(t),a=[];for(let i of o){let{id:s}=i,l=n.get(s);if(l){let d=A0(l),c=r.reduce((p,m,g)=>p+K0(d[g],m),0),f=Number((c/4).toFixed(4));a.push({id:s,data:{droppableContainer:i,value:f}})}}return a.sort(V0)};function zU(e,t){let n=Math.max(t.top,e.top),o=Math.max(t.left,e.left),r=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),i=r-o,s=a-n;if(o<r&&n<a){let l=t.width*t.height,d=e.width*e.height,c=i*s,f=c/(l+d-c);return Number(f.toFixed(4))}return 0}var UU=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:o}=e,r=[];for(let a of o){let{id:i}=a,s=n.get(i);if(s){let l=zU(s,t);l>0&&r.push({id:i,data:{droppableContainer:a,value:l}})}}return r.sort(BU)};function HU(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function G0(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Pr}function $U(e){return function(n){for(var o=arguments.length,r=new Array(o>1?o-1:0),a=1;a<o;a++)r[a-1]=arguments[a];return r.reduce((i,s)=>({...i,top:i.top+e*s.y,bottom:i.bottom+e*s.y,left:i.left+e*s.x,right:i.right+e*s.x}),{...n})}}var KU=$U(1);function VU(e){if(e.startsWith("matrix3d(")){let t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){let t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function qU(e,t,n){let o=VU(t);if(!o)return e;let{scaleX:r,scaleY:a,x:i,y:s}=o,l=e.left-i-(1-r)*parseFloat(n),d=e.top-s-(1-a)*parseFloat(n.slice(n.indexOf(" ")+1)),c=r?e.width/r:e.width,f=a?e.height/a:e.height;return{width:c,height:f,top:d,right:l+c,bottom:d+f,left:l}}var WU={ignoreTransform:!1};function Cs(e,t){t===void 0&&(t=WU);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:d,transformOrigin:c}=Co(e).getComputedStyle(e);d&&(n=qU(n,d,c))}let{top:o,left:r,width:a,height:i,bottom:s,right:l}=n;return{top:o,left:r,width:a,height:i,bottom:s,right:l}}function R0(e){return Cs(e,{ignoreTransform:!0})}function GU(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function jU(e,t){return t===void 0&&(t=Co(e).getComputedStyle(e)),t.position==="fixed"}function QU(e,t){t===void 0&&(t=Co(e).getComputedStyle(e));let n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(r=>{let a=t[r];return typeof a=="string"?n.test(a):!1})}function Mc(e,t){let n=[];function o(r){if(t!=null&&n.length>=t||!r)return n;if(cp(r)&&r.scrollingElement!=null&&!n.includes(r.scrollingElement))return n.push(r.scrollingElement),n;if(!El(r)||Zh(r)||n.includes(r))return n;let a=Co(e).getComputedStyle(r);return r!==e&&QU(r,a)&&n.push(r),jU(r,a)?n:o(r.parentNode)}return e?o(e):n}function j0(e){let[t]=Mc(e,1);return t??null}function ev(e){return!Ic||!e?null:fs(e)?e:dp(e)?cp(e)||e===ps(e).scrollingElement?window:El(e)?e:null:null}function Q0(e){return fs(e)?e.scrollX:e.scrollLeft}function X0(e){return fs(e)?e.scrollY:e.scrollTop}function ov(e){return{x:Q0(e),y:X0(e)}}var Un;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Un||(Un={}));function Y0(e){return!Ic||!e?!1:e===document.scrollingElement}function J0(e){let t={x:0,y:0},n=Y0(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},o={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},r=e.scrollTop<=t.y,a=e.scrollLeft<=t.x,i=e.scrollTop>=o.y,s=e.scrollLeft>=o.x;return{isTop:r,isLeft:a,isBottom:i,isRight:s,maxScroll:o,minScroll:t}}var XU={x:.2,y:.2};function YU(e,t,n,o,r){let{top:a,left:i,right:s,bottom:l}=n;o===void 0&&(o=10),r===void 0&&(r=XU);let{isTop:d,isBottom:c,isLeft:f,isRight:p}=J0(e),m={x:0,y:0},g={x:0,y:0},h={height:t.height*r.y,width:t.width*r.x};return!d&&a<=t.top+h.height?(m.y=Un.Backward,g.y=o*Math.abs((t.top+h.height-a)/h.height)):!c&&l>=t.bottom-h.height&&(m.y=Un.Forward,g.y=o*Math.abs((t.bottom-h.height-l)/h.height)),!p&&s>=t.right-h.width?(m.x=Un.Forward,g.x=o*Math.abs((t.right-h.width-s)/h.width)):!f&&i<=t.left+h.width&&(m.x=Un.Backward,g.x=o*Math.abs((t.left+h.width-i)/h.width)),{direction:m,speed:g}}function JU(e){if(e===document.scrollingElement){let{innerWidth:a,innerHeight:i}=window;return{top:0,left:0,right:a,bottom:i,width:a,height:i}}let{top:t,left:n,right:o,bottom:r}=e.getBoundingClientRect();return{top:t,left:n,right:o,bottom:r,width:e.clientWidth,height:e.clientHeight}}function Z0(e){return e.reduce((t,n)=>gs(t,ov(n)),Pr)}function ZU(e){return e.reduce((t,n)=>t+Q0(n),0)}function e5(e){return e.reduce((t,n)=>t+X0(n),0)}function t5(e,t){if(t===void 0&&(t=Cs),!e)return;let{top:n,left:o,bottom:r,right:a}=t(e);j0(e)&&(r<=0||a<=0||n>=window.innerHeight||o>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}var n5=[["x",["left","right"],ZU],["y",["top","bottom"],e5]],Ac=class{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;let o=Mc(n),r=Z0(o);this.rect={...t},this.width=t.width,this.height=t.height;for(let[a,i,s]of n5)for(let l of i)Object.defineProperty(this,l,{get:()=>{let d=s(o),c=r[a]-d;return this.rect[l]+c},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}},ys=class{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var o;return(o=this.target)==null?void 0:o.removeEventListener(...n)})},this.target=t}add(t,n,o){var r;(r=this.target)==null||r.addEventListener(t,n,o),this.listeners.push([t,n,o])}};function o5(e){let{EventTarget:t}=Co(e);return e instanceof t?e:ps(e)}function tv(e,t){let n=Math.abs(e.x),o=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+o**2)>t:"x"in t&&"y"in t?n>t.x&&o>t.y:"x"in t?n>t.x:"y"in t?o>t.y:!1}var ur;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(ur||(ur={}));function M0(e){e.preventDefault()}function r5(e){e.stopPropagation()}var kt;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(kt||(kt={}));var eT={start:[kt.Space,kt.Enter],cancel:[kt.Esc],end:[kt.Space,kt.Enter,kt.Tab]},a5=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case kt.Right:return{...n,x:n.x+25};case kt.Left:return{...n,x:n.x-25};case kt.Down:return{...n,y:n.y+25};case kt.Up:return{...n,y:n.y-25}}},Nl=class{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;let{event:{target:n}}=t;this.props=t,this.listeners=new ys(ps(n)),this.windowListeners=new ys(Co(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(ur.Resize,this.handleCancel),this.windowListeners.add(ur.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(ur.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:t,onStart:n}=this.props,o=t.node.current;o&&t5(o),n(Pr)}handleKeyDown(t){if(kc(t)){let{active:n,context:o,options:r}=this.props,{keyboardCodes:a=eT,coordinateGetter:i=a5,scrollBehavior:s="smooth"}=r,{code:l}=t;if(a.end.includes(l)){this.handleEnd(t);return}if(a.cancel.includes(l)){this.handleCancel(t);return}let{collisionRect:d}=o.current,c=d?{x:d.left,y:d.top}:Pr;this.referenceCoordinates||(this.referenceCoordinates=c);let f=i(t,{active:n,context:o.current,currentCoordinates:c});if(f){let p=hs(f,c),m={x:0,y:0},{scrollableAncestors:g}=o.current;for(let h of g){let v=t.code,{isTop:y,isRight:x,isLeft:C,isBottom:w,maxScroll:L,minScroll:S}=J0(h),k=JU(h),I={x:Math.min(v===kt.Right?k.right-k.width/2:k.right,Math.max(v===kt.Right?k.left:k.left+k.width/2,f.x)),y:Math.min(v===kt.Down?k.bottom-k.height/2:k.bottom,Math.max(v===kt.Down?k.top:k.top+k.height/2,f.y))},T=v===kt.Right&&!x||v===kt.Left&&!C,A=v===kt.Down&&!w||v===kt.Up&&!y;if(T&&I.x!==f.x){let P=h.scrollLeft+p.x,_=v===kt.Right&&P<=L.x||v===kt.Left&&P>=S.x;if(_&&!p.y){h.scrollTo({left:P,behavior:s});return}_?m.x=h.scrollLeft-P:m.x=v===kt.Right?h.scrollLeft-L.x:h.scrollLeft-S.x,m.x&&h.scrollBy({left:-m.x,behavior:s});break}else if(A&&I.y!==f.y){let P=h.scrollTop+p.y,_=v===kt.Down&&P<=L.y||v===kt.Up&&P>=S.y;if(_&&!p.x){h.scrollTo({top:P,behavior:s});return}_?m.y=h.scrollTop-P:m.y=v===kt.Down?h.scrollTop-L.y:h.scrollTop-S.y,m.y&&h.scrollBy({top:-m.y,behavior:s});break}}this.handleMove(t,gs(hs(f,this.referenceCoordinates),m))}}}handleMove(t,n){let{onMove:o}=this.props;t.preventDefault(),o(n)}handleEnd(t){let{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){let{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}};Nl.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:o=eT,onActivation:r}=t,{active:a}=n,{code:i}=e.nativeEvent;if(o.start.includes(i)){let s=a.activatorNode.current;return s&&e.target!==s?!1:(e.preventDefault(),r?.({event:e.nativeEvent}),!0)}return!1}}];function N0(e){return!!(e&&"distance"in e)}function _0(e){return!!(e&&"delay"in e)}var Ec=class{constructor(t,n,o){var r;o===void 0&&(o=o5(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;let{event:a}=t,{target:i}=a;this.props=t,this.events=n,this.document=ps(i),this.documentListeners=new ys(this.document),this.listeners=new ys(o),this.windowListeners=new ys(Co(i)),this.initialCoordinates=(r=Lc(a))!=null?r:Pr,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){let{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:o}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(ur.Resize,this.handleCancel),this.windowListeners.add(ur.DragStart,M0),this.windowListeners.add(ur.VisibilityChange,this.handleCancel),this.windowListeners.add(ur.ContextMenu,M0),this.documentListeners.add(ur.Keydown,this.handleKeydown),n){if(o!=null&&o({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(_0(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(N0(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){let{active:o,onPending:r}=this.props;r(o,t,this.initialCoordinates,n)}handleStart(){let{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(ur.Click,r5,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(ur.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;let{activated:o,initialCoordinates:r,props:a}=this,{onMove:i,options:{activationConstraint:s}}=a;if(!r)return;let l=(n=Lc(t))!=null?n:Pr,d=hs(r,l);if(!o&&s){if(N0(s)){if(s.tolerance!=null&&tv(d,s.tolerance))return this.handleCancel();if(tv(d,s.distance))return this.handleStart()}if(_0(s)&&tv(d,s.tolerance))return this.handleCancel();this.handlePending(s,d);return}t.cancelable&&t.preventDefault(),i(l)}handleEnd(){let{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){let{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===kt.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}},i5={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}},_l=class extends Ec{constructor(t){let{event:n}=t,o=ps(n.target);super(t,i5,o)}};_l.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:o}=t;return!n.isPrimary||n.button!==0?!1:(o?.({event:n}),!0)}}];var s5={move:{name:"mousemove"},end:{name:"mouseup"}},rv;(function(e){e[e.RightClick=2]="RightClick"})(rv||(rv={}));var av=class extends Ec{constructor(t){super(t,s5,ps(t.event.target))}};av.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:o}=t;return n.button===rv.RightClick?!1:(o?.({event:n}),!0)}}];var nv={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}},iv=class extends Ec{constructor(t){super(t,nv)}static setup(){return window.addEventListener(nv.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(nv.move.name,t)};function t(){}}};iv.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:o}=t,{touches:r}=n;return r.length>1?!1:(o?.({event:n}),!0)}}];var Pc;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Pc||(Pc={}));var gp;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(gp||(gp={}));function l5(e){let{acceleration:t,activator:n=Pc.Pointer,canScroll:o,draggingRect:r,enabled:a,interval:i=5,order:s=gp.TreeOrder,pointerCoordinates:l,scrollableAncestors:d,scrollableAncestorRects:c,delta:f,threshold:p}=e,m=c5({delta:f,disabled:!a}),[g,h]=S0(),v=N({x:0,y:0}),y=N({x:0,y:0}),x=K(()=>{switch(n){case Pc.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case Pc.DraggableRect:return r}},[n,r,l]),C=N(null),w=R(()=>{let S=C.current;if(!S)return;let k=v.current.x*y.current.x,I=v.current.y*y.current.y;S.scrollBy(k,I)},[]),L=K(()=>s===gp.TreeOrder?[...d].reverse():d,[s,d]);W(()=>{if(!a||!d.length||!x){h();return}for(let S of L){if(o?.(S)===!1)continue;let k=d.indexOf(S),I=c[k];if(!I)continue;let{direction:T,speed:A}=YU(S,I,x,t,p);for(let P of["x","y"])m[P][T[P]]||(A[P]=0,T[P]=0);if(A.x>0||A.y>0){h(),C.current=S,g(w,i),v.current=A,y.current=T;return}}v.current={x:0,y:0},y.current={x:0,y:0},h()},[t,w,o,h,a,i,JSON.stringify(x),JSON.stringify(m),g,d,L,c,JSON.stringify(p)])}var d5={x:{[Un.Backward]:!1,[Un.Forward]:!1},y:{[Un.Backward]:!1,[Un.Forward]:!1}};function c5(e){let{delta:t,disabled:n}=e,o=fp(t);return Ml(r=>{if(n||!o||!r)return d5;let a={x:Math.sign(t.x-o.x),y:Math.sign(t.y-o.y)};return{x:{[Un.Backward]:r.x[Un.Backward]||a.x===-1,[Un.Forward]:r.x[Un.Forward]||a.x===1},y:{[Un.Backward]:r.y[Un.Backward]||a.y===-1,[Un.Forward]:r.y[Un.Forward]||a.y===1}}},[n,t,o])}function u5(e,t){let n=t!=null?e.get(t):void 0,o=n?n.node.current:null;return Ml(r=>{var a;return t==null?null:(a=o??r)!=null?a:null},[o,t])}function f5(e,t){return K(()=>e.reduce((n,o)=>{let{sensor:r}=o,a=r.activators.map(i=>({eventName:i.eventName,handler:t(i.handler,o)}));return[...n,...a]},[]),[e,t])}var Rc;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Rc||(Rc={}));var sv;(function(e){e.Optimized="optimized"})(sv||(sv={}));var D0=new Map;function p5(e,t){let{dragging:n,dependencies:o,config:r}=t,[a,i]=J(null),{frequency:s,measure:l,strategy:d}=r,c=N(e),f=v(),p=Rl(f),m=R(function(y){y===void 0&&(y=[]),!p.current&&i(x=>x===null?y:x.concat(y.filter(C=>!x.includes(C))))},[p]),g=N(null),h=Ml(y=>{if(f&&!n)return D0;if(!y||y===D0||c.current!==e||a!=null){let x=new Map;for(let C of e){if(!C)continue;if(a&&a.length>0&&!a.includes(C.id)&&C.rect.current){x.set(C.id,C.rect.current);continue}let w=C.node.current,L=w?new Ac(l(w),w):null;C.rect.current=L,L&&x.set(C.id,L)}return x}return y},[e,a,n,f,l]);return W(()=>{c.current=e},[e]),W(()=>{f||m()},[n,f]),W(()=>{a&&a.length>0&&i(null)},[JSON.stringify(a)]),W(()=>{f||typeof s!="number"||g.current!==null||(g.current=setTimeout(()=>{m(),g.current=null},s))},[s,f,m,...o]),{droppableRects:h,measureDroppableContainers:m,measuringScheduled:a!=null};function v(){switch(d){case Rc.Always:return!1;case Rc.BeforeDragging:return n;default:return!n}}}function tT(e,t){return Ml(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function m5(e,t){return tT(e,t)}function g5(e){let{callback:t,disabled:n}=e,o=up(t),r=K(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;let{MutationObserver:a}=window;return new a(o)},[o,n]);return W(()=>()=>r?.disconnect(),[r]),r}function hp(e){let{callback:t,disabled:n}=e,o=up(t),r=K(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;let{ResizeObserver:a}=window;return new a(o)},[n]);return W(()=>()=>r?.disconnect(),[r]),r}function h5(e){return new Ac(Cs(e),e)}function O0(e,t,n){t===void 0&&(t=h5);let[o,r]=J(null);function a(){r(l=>{if(!e)return null;if(e.isConnected===!1){var d;return(d=l??n)!=null?d:null}let c=t(e);return JSON.stringify(l)===JSON.stringify(c)?l:c})}let i=g5({callback(l){if(e)for(let d of l){let{type:c,target:f}=d;if(c==="childList"&&f instanceof HTMLElement&&f.contains(e)){a();break}}}}),s=hp({callback:a});return cr(()=>{a(),e?(s?.observe(e),i?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),i?.disconnect())},[e]),o}function v5(e){let t=tT(e);return G0(e,t)}var F0=[];function y5(e){let t=N(e),n=Ml(o=>e?o&&o!==F0&&e&&t.current&&e.parentNode===t.current.parentNode?o:Mc(e):F0,[e]);return W(()=>{t.current=e},[e]),n}function x5(e){let[t,n]=J(null),o=N(e),r=R(a=>{let i=ev(a.target);i&&n(s=>s?(s.set(i,ov(i)),new Map(s)):null)},[]);return W(()=>{let a=o.current;if(e!==a){i(a);let s=e.map(l=>{let d=ev(l);return d?(d.addEventListener("scroll",r,{passive:!0}),[d,ov(d)]):null}).filter(l=>l!=null);n(s.length?new Map(s):null),o.current=e}return()=>{i(e),i(a)};function i(s){s.forEach(l=>{let d=ev(l);d?.removeEventListener("scroll",r)})}},[r,e]),K(()=>e.length?t?Array.from(t.values()).reduce((a,i)=>gs(a,i),Pr):Z0(e):Pr,[e,t])}function B0(e,t){t===void 0&&(t=[]);let n=N(null);return W(()=>{n.current=null},t),W(()=>{let o=e!==Pr;o&&!n.current&&(n.current=e),!o&&n.current&&(n.current=null)},[e]),n.current?hs(e,n.current):Pr}function C5(e){W(()=>{if(!Ic)return;let t=e.map(n=>{let{sensor:o}=n;return o.setup==null?void 0:o.setup()});return()=>{for(let n of t)n?.()}},e.map(t=>{let{sensor:n}=t;return n}))}function b5(e,t){return K(()=>e.reduce((n,o)=>{let{eventName:r,handler:a}=o;return n[r]=i=>{a(i,t)},n},{}),[e,t])}function nT(e){return K(()=>e?GU(e):null,[e])}var z0=[];function w5(e,t){t===void 0&&(t=Cs);let[n]=e,o=nT(n?Co(n):null),[r,a]=J(z0);function i(){a(()=>e.length?e.map(l=>Y0(l)?o:new Ac(t(l),l)):z0)}let s=hp({callback:i});return cr(()=>{s?.disconnect(),i(),e.forEach(l=>s?.observe(l))},[e]),r}function S5(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return El(t)?t:e}function I5(e){let{measure:t}=e,[n,o]=J(null),r=R(d=>{for(let{target:c}of d)if(El(c)){o(f=>{let p=t(c);return f?{...f,width:p.width,height:p.height}:p});break}},[t]),a=hp({callback:r}),i=R(d=>{let c=S5(d);a?.disconnect(),c&&a?.observe(c),o(c?t(c):null)},[t,a]),[s,l]=Tc(i);return K(()=>({nodeRef:s,rect:n,setRef:l}),[n,s,l])}var T5=[{sensor:_l,options:{}},{sensor:Nl,options:{}}],k5={current:{}},pp={draggable:{measure:R0},droppable:{measure:R0,strategy:Rc.WhileDragging,frequency:sv.Optimized},dragOverlay:{measure:Cs}},xs=class extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,o;return(n=(o=this.get(t))==null?void 0:o.node.current)!=null?n:void 0}},L5={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new xs,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:mp},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:pp,measureDroppableContainers:mp,windowRect:null,measuringScheduled:!1},P5={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:mp,draggableNodes:new Map,over:null,measureDroppableContainers:mp},vp=bt(P5),oT=bt(L5);function A5(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new xs}}}function E5(e,t){switch(t.type){case Dn.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Dn.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case Dn.DragEnd:case Dn.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Dn.RegisterDroppable:{let{element:n}=t,{id:o}=n,r=new xs(e.droppable.containers);return r.set(o,n),{...e,droppable:{...e.droppable,containers:r}}}case Dn.SetDroppableDisabled:{let{id:n,key:o,disabled:r}=t,a=e.droppable.containers.get(n);if(!a||o!==a.key)return e;let i=new xs(e.droppable.containers);return i.set(n,{...a,disabled:r}),{...e,droppable:{...e.droppable,containers:i}}}case Dn.UnregisterDroppable:{let{id:n,key:o}=t,r=e.droppable.containers.get(n);if(!r||o!==r.key)return e;let a=new xs(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function R5(e){let{disabled:t}=e,{active:n,activatorEvent:o,draggableNodes:r}=Ht(vp),a=fp(o),i=fp(n?.id);return W(()=>{if(!t&&!o&&a&&i!=null){if(!kc(a)||document.activeElement===a.target)return;let s=r.get(i);if(!s)return;let{activatorNode:l,node:d}=s;if(!l.current&&!d.current)return;requestAnimationFrame(()=>{for(let c of[l.current,d.current]){if(!c)continue;let f=T0(c);if(f){f.focus();break}}})}},[o,t,r,i,a]),null}function M5(e,t){let{transform:n,...o}=t;return e!=null&&e.length?e.reduce((r,a)=>a({transform:r,...o}),n):n}function N5(e){return K(()=>({draggable:{...pp.draggable,...e?.draggable},droppable:{...pp.droppable,...e?.droppable},dragOverlay:{...pp.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function _5(e){let{activeNode:t,measure:n,initialRect:o,config:r=!0}=e,a=N(!1),{x:i,y:s}=typeof r=="boolean"?{x:r,y:r}:r;cr(()=>{if(!i&&!s||!t){a.current=!1;return}if(a.current||!o)return;let d=t?.node.current;if(!d||d.isConnected===!1)return;let c=n(d),f=G0(c,o);if(i||(f.x=0),s||(f.y=0),a.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){let p=j0(d);p&&p.scrollBy({top:f.y,left:f.x})}},[t,i,s,o,n])}var rT=bt({...Pr,scaleX:1,scaleY:1}),yi;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(yi||(yi={}));var aT=pe(function(t){var n,o,r,a;let{id:i,accessibility:s,autoScroll:l=!0,children:d,sensors:c=T5,collisionDetection:f=UU,measuring:p,modifiers:m,...g}=t,h=Sa(E5,void 0,A5),[v,y]=h,[x,C]=_U(),[w,L]=J(yi.Uninitialized),S=w===yi.Initialized,{draggable:{active:k,nodes:I,translate:T},droppable:{containers:A}}=v,P=k!=null?I.get(k):null,_=N({initial:null,translated:null}),E=K(()=>{var Te;return k!=null?{id:k,data:(Te=P?.data)!=null?Te:k5,rect:_}:null},[k,P]),F=N(null),[B,V]=J(null),[Q,Se]=J(null),H=Rl(g,Object.values(g)),q=ms("DndDescribedBy",i),ee=K(()=>A.getEnabled(),[A]),G=N5(p),{droppableRects:te,measureDroppableContainers:me,measuringScheduled:U}=p5(ee,{dragging:S,dependencies:[T.x,T.y],config:G.droppable}),Y=u5(I,k),se=K(()=>Q?Lc(Q):null,[Q]),ge=ye(),ie=m5(Y,G.draggable.measure);_5({activeNode:k!=null?I.get(k):null,config:ge.layoutShiftCompensation,initialRect:ie,measure:G.draggable.measure});let Ae=O0(Y,G.draggable.measure,ie),Xe=O0(Y?Y.parentElement:null),nt=N({activatorEvent:null,active:null,activeNode:Y,collisionRect:null,collisions:null,droppableRects:te,draggableNodes:I,draggingNode:null,draggingNodeRect:null,droppableContainers:A,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),rt=A.getNodeFor((n=nt.current.over)==null?void 0:n.id),Ve=I5({measure:G.dragOverlay.measure}),ne=(o=Ve.nodeRef.current)!=null?o:Y,we=S?(r=Ve.rect)!=null?r:Ae:null,j=!!(Ve.nodeRef.current&&Ve.rect),X=v5(j?null:Ae),ae=nT(ne?Co(ne):null),oe=y5(S?rt??Y:null),ft=w5(oe),pt=M5(m,{transform:{x:T.x-X.x,y:T.y-X.y,scaleX:1,scaleY:1},activatorEvent:Q,active:E,activeNodeRect:Ae,containerNodeRect:Xe,draggingNodeRect:we,over:nt.current.over,overlayNodeRect:Ve.rect,scrollableAncestors:oe,scrollableAncestorRects:ft,windowRect:ae}),yt=se?gs(se,T):null,Pt=x5(oe),nn=B0(Pt),gt=B0(Pt,[Ae]),Bt=gs(pt,nn),Mt=we?KU(we,pt):null,St=E&&Mt?f({active:E,collisionRect:Mt,droppableRects:te,droppableContainers:ee,pointerCoordinates:yt}):null,In=dv(St,"id"),[ct,ln]=J(null),ro=j?pt:gs(pt,gt),Vt=HU(ro,(a=ct?.rect)!=null?a:null,Ae),bn=N(null),Tn=R((Te,Me)=>{let{sensor:ht,options:Ln}=Me;if(F.current==null)return;let fn=I.get(F.current);if(!fn)return;let at=Te.nativeEvent,It=new ht({active:F.current,activeNode:fn,event:at,options:Ln,context:nt,onAbort(Tt){if(!I.get(Tt))return;let{onDragAbort:Yt}=H.current,xe={id:Tt};Yt?.(xe),x({type:"onDragAbort",event:xe})},onPending(Tt,rn,Yt,xe){if(!I.get(Tt))return;let{onDragPending:qe}=H.current,We={id:Tt,constraint:rn,initialCoordinates:Yt,offset:xe};qe?.(We),x({type:"onDragPending",event:We})},onStart(Tt){let rn=F.current;if(rn==null)return;let Yt=I.get(rn);if(!Yt)return;let{onDragStart:xe}=H.current,_e={activatorEvent:at,active:{id:rn,data:Yt.data,rect:_}};(0,vs.unstable_batchedUpdates)(()=>{xe?.(_e),L(yi.Initializing),y({type:Dn.DragStart,initialCoordinates:Tt,active:rn}),x({type:"onDragStart",event:_e}),V(bn.current),Se(at)})},onMove(Tt){y({type:Dn.DragMove,coordinates:Tt})},onEnd:Et(Dn.DragEnd),onCancel:Et(Dn.DragCancel)});bn.current=It;function Et(Tt){return async function(){let{active:Yt,collisions:xe,over:_e,scrollAdjustedTranslate:qe}=nt.current,We=null;if(Yt&&qe){let{cancelDrop:ot}=H.current;We={activatorEvent:at,active:Yt,collisions:xe,delta:qe,over:_e},Tt===Dn.DragEnd&&typeof ot=="function"&&await Promise.resolve(ot(We))&&(Tt=Dn.DragCancel)}F.current=null,(0,vs.unstable_batchedUpdates)(()=>{y({type:Tt}),L(yi.Uninitialized),ln(null),V(null),Se(null),bn.current=null;let ot=Tt===Dn.DragEnd?"onDragEnd":"onDragCancel";if(We){let xt=H.current[ot];xt?.(We),x({type:ot,event:We})}})}}},[I]),on=R((Te,Me)=>(ht,Ln)=>{let fn=ht.nativeEvent,at=I.get(Ln);if(F.current!==null||!at||fn.dndKit||fn.defaultPrevented)return;let It={active:at};Te(ht,Me.options,It)===!0&&(fn.dndKit={capturedBy:Me.sensor},F.current=Ln,Tn(ht,Me))},[I,Tn]),kn=f5(c,on);C5(c),cr(()=>{Ae&&w===yi.Initializing&&L(yi.Initialized)},[Ae,w]),W(()=>{let{onDragMove:Te}=H.current,{active:Me,activatorEvent:ht,collisions:Ln,over:fn}=nt.current;if(!Me||!ht)return;let at={active:Me,activatorEvent:ht,collisions:Ln,delta:{x:Bt.x,y:Bt.y},over:fn};(0,vs.unstable_batchedUpdates)(()=>{Te?.(at),x({type:"onDragMove",event:at})})},[Bt.x,Bt.y]),W(()=>{let{active:Te,activatorEvent:Me,collisions:ht,droppableContainers:Ln,scrollAdjustedTranslate:fn}=nt.current;if(!Te||F.current==null||!Me||!fn)return;let{onDragOver:at}=H.current,It=Ln.get(In),Et=It&&It.rect.current?{id:It.id,rect:It.rect.current,data:It.data,disabled:It.disabled}:null,Tt={active:Te,activatorEvent:Me,collisions:ht,delta:{x:fn.x,y:fn.y},over:Et};(0,vs.unstable_batchedUpdates)(()=>{ln(Et),at?.(Tt),x({type:"onDragOver",event:Tt})})},[In]),cr(()=>{nt.current={activatorEvent:Q,active:E,activeNode:Y,collisionRect:Mt,collisions:St,droppableRects:te,draggableNodes:I,draggingNode:ne,draggingNodeRect:we,droppableContainers:A,over:ct,scrollableAncestors:oe,scrollAdjustedTranslate:Bt},_.current={initial:we,translated:Mt}},[E,Y,St,Mt,I,ne,we,te,A,ct,oe,Bt]),l5({...ge,delta:T,draggingRect:Mt,pointerCoordinates:yt,scrollableAncestors:oe,scrollableAncestorRects:ft});let O=K(()=>({active:E,activeNode:Y,activeNodeRect:Ae,activatorEvent:Q,collisions:St,containerNodeRect:Xe,dragOverlay:Ve,draggableNodes:I,droppableContainers:A,droppableRects:te,over:ct,measureDroppableContainers:me,scrollableAncestors:oe,scrollableAncestorRects:ft,measuringConfiguration:G,measuringScheduled:U,windowRect:ae}),[E,Y,Ae,Q,St,Xe,Ve,I,A,te,ct,me,oe,ft,G,U,ae]),fe=K(()=>({activatorEvent:Q,activators:kn,active:E,activeNodeRect:Ae,ariaDescribedById:{draggable:q},dispatch:y,draggableNodes:I,over:ct,measureDroppableContainers:me}),[Q,kn,E,Ae,y,q,I,ct,me]);return yn.createElement(H0.Provider,{value:C},yn.createElement(vp.Provider,{value:fe},yn.createElement(oT.Provider,{value:O},yn.createElement(rT.Provider,{value:Vt},d)),yn.createElement(R5,{disabled:s?.restoreFocus===!1})),yn.createElement(FU,{...s,hiddenTextDescribedById:q}));function ye(){let Te=B?.autoScrollEnabled===!1,Me=typeof l=="object"?l.enabled===!1:l===!1,ht=S&&!Te&&!Me;return typeof l=="object"?{...l,enabled:ht}:{enabled:ht}}}),D5=bt(null),U0="button",O5="Draggable";function iT(e){let{id:t,data:n,disabled:o=!1,attributes:r}=e,a=ms(O5),{activators:i,activatorEvent:s,active:l,activeNodeRect:d,ariaDescribedById:c,draggableNodes:f,over:p}=Ht(vp),{role:m=U0,roleDescription:g="draggable",tabIndex:h=0}=r??{},v=l?.id===t,y=Ht(v?rT:D5),[x,C]=Tc(),[w,L]=Tc(),S=b5(i,t),k=Rl(n);cr(()=>(f.set(t,{id:t,key:a,node:x,activatorNode:w,data:k}),()=>{let T=f.get(t);T&&T.key===a&&f.delete(t)}),[f,t]);let I=K(()=>({role:m,tabIndex:h,"aria-disabled":o,"aria-pressed":v&&m===U0?!0:void 0,"aria-roledescription":g,"aria-describedby":c.draggable}),[o,m,h,v,g,c.draggable]);return{active:l,activatorEvent:s,activeNodeRect:d,attributes:I,isDragging:v,listeners:o?void 0:S,node:x,over:p,setNodeRef:C,setActivatorNodeRef:L,transform:y}}function sT(){return Ht(oT)}var F5="Droppable",B5={timeout:25};function lT(e){let{data:t,disabled:n=!1,id:o,resizeObserverConfig:r}=e,a=ms(F5),{active:i,dispatch:s,over:l,measureDroppableContainers:d}=Ht(vp),c=N({disabled:n}),f=N(!1),p=N(null),m=N(null),{disabled:g,updateMeasurementsFor:h,timeout:v}={...B5,...r},y=Rl(h??o),x=R(()=>{if(!f.current){f.current=!0;return}m.current!=null&&clearTimeout(m.current),m.current=setTimeout(()=>{d(Array.isArray(y.current)?y.current:[y.current]),m.current=null},v)},[v]),C=hp({callback:x,disabled:g||!i}),w=R((I,T)=>{C&&(T&&(C.unobserve(T),f.current=!1),I&&C.observe(I))},[C]),[L,S]=Tc(w),k=Rl(t);return W(()=>{!C||!L.current||(C.disconnect(),f.current=!1,C.observe(L.current))},[L,C]),W(()=>(s({type:Dn.RegisterDroppable,element:{id:o,key:a,disabled:n,node:L,rect:p,data:k}}),()=>s({type:Dn.UnregisterDroppable,key:a,id:o})),[o]),W(()=>{n!==c.current.disabled&&(s({type:Dn.SetDroppableDisabled,id:o,key:a,disabled:n}),c.current.disabled=n)},[o,a,n,s]),{active:i,rect:p,isOver:l?.id===o,node:L,over:l,setNodeRef:S}}ue();function dT(e,t,n){let o=e.slice();return o.splice(n<0?o.length+n:n,0,o.splice(t,1)[0]),o}function z5(e,t){return e.reduce((n,o,r)=>{let a=t.get(o);return a&&(n[r]=a),n},Array(e.length))}function yp(e){return e!==null&&e>=0}function U5(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function H5(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}var cT=e=>{let{rects:t,activeIndex:n,overIndex:o,index:r}=e,a=dT(t,o,n),i=t[r],s=a[r];return!s||!i?null:{x:s.left-i.left,y:s.top-i.top,scaleX:s.width/i.width,scaleY:s.height/i.height}};var xp={scaleX:1,scaleY:1},uT=e=>{var t;let{activeIndex:n,activeNodeRect:o,index:r,rects:a,overIndex:i}=e,s=(t=a[n])!=null?t:o;if(!s)return null;if(r===n){let d=a[i];return d?{x:0,y:n<i?d.top+d.height-(s.top+s.height):d.top-s.top,...xp}:null}let l=$5(a,r,n);return r>n&&r<=i?{x:0,y:-s.height-l,...xp}:r<n&&r>=i?{x:0,y:s.height+l,...xp}:{x:0,y:0,...xp}};function $5(e,t,n){let o=e[t],r=e[t-1],a=e[t+1];return o?n<t?r?o.top-(r.top+r.height):a?a.top-(o.top+o.height):0:a?a.top-(o.top+o.height):r?o.top-(r.top+r.height):0:0}var fT="Sortable",pT=yn.createContext({activeIndex:-1,containerId:fT,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:cT,disabled:{draggable:!1,droppable:!1}});function mT(e){let{children:t,id:n,items:o,strategy:r=cT,disabled:a=!1}=e,{active:i,dragOverlay:s,droppableRects:l,over:d,measureDroppableContainers:c}=sT(),f=ms(fT,n),p=s.rect!==null,m=K(()=>o.map(S=>typeof S=="object"&&"id"in S?S.id:S),[o]),g=i!=null,h=i?m.indexOf(i.id):-1,v=d?m.indexOf(d.id):-1,y=N(m),x=!U5(m,y.current),C=v!==-1&&h===-1||x,w=H5(a);cr(()=>{x&&g&&c(m)},[x,m,g,c]),W(()=>{y.current=m},[m]);let L=K(()=>({activeIndex:h,containerId:f,disabled:w,disableTransforms:C,items:m,overIndex:v,useDragOverlay:p,sortedRects:z5(m,l),strategy:r}),[h,f,w.draggable,w.droppable,C,m,v,l,p,r]);return yn.createElement(pT.Provider,{value:L},t)}var K5=e=>{let{id:t,items:n,activeIndex:o,overIndex:r}=e;return dT(n,o,r).indexOf(t)},V5=e=>{let{containerId:t,isSorting:n,wasDragging:o,index:r,items:a,newIndex:i,previousItems:s,previousContainerId:l,transition:d}=e;return!d||!o||s!==a&&r===i?!1:n?!0:i!==r&&t===l},q5={duration:200,easing:"ease"},gT="transform",W5=vi.Transition.toString({property:gT,duration:0,easing:"linear"}),G5={roleDescription:"sortable"};function j5(e){let{disabled:t,index:n,node:o,rect:r}=e,[a,i]=J(null),s=N(n);return cr(()=>{if(!t&&n!==s.current&&o.current){let l=r.current;if(l){let d=Cs(o.current,{ignoreTransform:!0}),c={x:l.left-d.left,y:l.top-d.top,scaleX:l.width/d.width,scaleY:l.height/d.height};(c.x||c.y)&&i(c)}}n!==s.current&&(s.current=n)},[t,n,o,r]),W(()=>{a&&i(null)},[a]),a}function hT(e){let{animateLayoutChanges:t=V5,attributes:n,disabled:o,data:r,getNewIndex:a=K5,id:i,strategy:s,resizeObserverConfig:l,transition:d=q5}=e,{items:c,containerId:f,activeIndex:p,disabled:m,disableTransforms:g,sortedRects:h,overIndex:v,useDragOverlay:y,strategy:x}=Ht(pT),C=Q5(o,m),w=c.indexOf(i),L=K(()=>({sortable:{containerId:f,index:w,items:c},...r}),[f,r,w,c]),S=K(()=>c.slice(c.indexOf(i)),[c,i]),{rect:k,node:I,isOver:T,setNodeRef:A}=lT({id:i,data:L,disabled:C.droppable,resizeObserverConfig:{updateMeasurementsFor:S,...l}}),{active:P,activatorEvent:_,activeNodeRect:E,attributes:F,setNodeRef:B,listeners:V,isDragging:Q,over:Se,setActivatorNodeRef:H,transform:q}=iT({id:i,data:L,attributes:{...G5,...n},disabled:C.draggable}),ee=w0(A,B),G=!!P,te=G&&!g&&yp(p)&&yp(v),me=!y&&Q,U=me&&te?q:null,se=te?U??(s??x)({rects:h,activeNodeRect:E,activeIndex:p,overIndex:v,index:w}):null,ge=yp(p)&&yp(v)?a({id:i,items:c,activeIndex:p,overIndex:v}):w,ie=P?.id,Ae=N({activeId:ie,items:c,newIndex:ge,containerId:f}),Xe=c!==Ae.current.items,nt=t({active:P,containerId:f,isDragging:Q,isSorting:G,id:i,index:w,items:c,newIndex:Ae.current.newIndex,previousItems:Ae.current.items,previousContainerId:Ae.current.containerId,transition:d,wasDragging:Ae.current.activeId!=null}),rt=j5({disabled:!nt,index:w,node:I,rect:k});return W(()=>{G&&Ae.current.newIndex!==ge&&(Ae.current.newIndex=ge),f!==Ae.current.containerId&&(Ae.current.containerId=f),c!==Ae.current.items&&(Ae.current.items=c)},[G,ge,f,c]),W(()=>{if(ie===Ae.current.activeId)return;if(ie!=null&&Ae.current.activeId==null){Ae.current.activeId=ie;return}let ne=setTimeout(()=>{Ae.current.activeId=ie},50);return()=>clearTimeout(ne)},[ie]),{active:P,activeIndex:p,attributes:F,data:L,rect:k,index:w,newIndex:ge,items:c,isOver:T,isSorting:G,isDragging:Q,listeners:V,node:I,overIndex:v,over:Se,setNodeRef:ee,setActivatorNodeRef:H,setDroppableNodeRef:A,setDraggableNodeRef:B,transform:rt??se,transition:Ve()};function Ve(){if(rt||Xe&&Ae.current.newIndex===w)return W5;if(!(me&&!kc(_)||!d)&&(G||nt))return vi.Transition.toString({...d,property:gT})}}function Q5(e,t){var n,o;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e?.draggable)!=null?n:t.draggable,droppable:(o=e?.droppable)!=null?o:t.droppable}}function Cp(e){if(!e)return!1;let t=e.data.current;return!!(t&&"sortable"in t&&typeof t.sortable=="object"&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}var X5=[kt.Down,kt.Right,kt.Up,kt.Left],vT=(e,t)=>{let{context:{active:n,collisionRect:o,droppableRects:r,droppableContainers:a,over:i,scrollableAncestors:s}}=t;if(X5.includes(e.code)){if(e.preventDefault(),!n||!o)return;let l=[];a.getEnabled().forEach(f=>{if(!f||f!=null&&f.disabled)return;let p=r.get(f.id);if(p)switch(e.code){case kt.Down:o.top<p.top&&l.push(f);break;case kt.Up:o.top>p.top&&l.push(f);break;case kt.Left:o.left>p.left&&l.push(f);break;case kt.Right:o.left<p.left&&l.push(f);break}});let d=W0({active:n,collisionRect:o,droppableRects:r,droppableContainers:l,pointerCoordinates:null}),c=dv(d,"id");if(c===i?.id&&d.length>1&&(c=d[1].id),c!=null){let f=a.get(n.id),p=a.get(c),m=p?r.get(p.id):null,g=p?.node.current;if(g&&m&&f&&p){let v=Mc(g).some((S,k)=>s[k]!==S),y=yT(f,p),x=Y5(f,p),C=v||!y?{x:0,y:0}:{x:x?o.width-m.width:0,y:x?o.height-m.height:0},w={x:m.left,y:m.top};return C.x&&C.y?w:hs(w,C)}}}};function yT(e,t){return!Cp(e)||!Cp(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function Y5(e,t){return!Cp(e)||!Cp(t)||!yT(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}function J5(e,t,n){let o={...e};return t.top+e.y<=n.top?o.y=n.top-t.top:t.bottom+e.y>=n.top+n.height&&(o.y=n.top+n.height-t.bottom),t.left+e.x<=n.left?o.x=n.left-t.left:t.right+e.x>=n.left+n.width&&(o.x=n.left+n.width-t.right),o}var xT=e=>{let{draggingNodeRect:t,transform:n,scrollableAncestorRects:o}=e,r=o[0];return!t||!r?n:J5(n,t,r)},CT=e=>{let{transform:t}=e;return{...t,x:0}};ue();ue();var bp={"2xl":1536,"3xl":1600,"4xl":2e3,lg:1024,md:768,sm:640,xl:1280};function bT(e){return`(min-width: ${typeof e=="number"?e:bp[e]}px)`}function wT(e){return`(max-width: ${(typeof e=="number"?e:bp[e])-1}px)`}function Z5(e){if(typeof e!="string"){let n=[];return e.min!=null&&n.push(bT(e.min)),e.max!=null&&n.push(wT(e.max)),e.pointer==="coarse"&&n.push("(pointer: coarse)"),e.pointer==="fine"&&n.push("(pointer: fine)"),n.length===0?"(min-width: 0px)":n.join(" and ")}if(e.startsWith("("))return e;let t=[];for(let n of e.split(":"))if(n.startsWith("max-")){let o=n.slice(4);o in bp&&t.push(wT(o))}else n in bp&&t.push(bT(n));return t.length>0?t.join(" and "):e}function eH(){return!1}function wp(e){let t=Z5(e),n=R(r=>{if(typeof window>"u")return()=>{};let a=window.matchMedia(t);return a.addEventListener("change",r),()=>a.removeEventListener("change",r)},[t]),o=R(()=>typeof window>"u"?!1:window.matchMedia(t).matches,[t]);return $o(n,o,eH)}ue();var so=new Map;function tH(e,t,n){return`${e}\0${t}\0${n??"none"}`}function cv(e,t){so.delete(e),so.set(e,t)}function Dl(e,t){if(so.get(e)===t){if(t.operationLeases>0){t.disposeRequested=!0;return}t.releaseAuthorityWatch?.(),t.releaseAuthorityWatch=void 0,so.delete(e);for(let n of t.state.added)t.releaseUpload(n.id),URL.revokeObjectURL(n.previewUrl);for(let n of t.listeners)n()}}function nH(e){if(so.size<=100)return;let t=Array.from(so);for(let[n,o]of t){if(so.size<=100)return;n===e||o.committed||o.listeners.size>0||o.operationLeases>0||Dl(n,o)}for(let[n,o]of t){if(so.size<=100)return;n===e||o.listeners.size>0||o.operationLeases>0||Dl(n,o)}}function Sp(){queueMicrotask(()=>nH())}function ST(e,t,n,o,r=void 0){let a=n.management?.revision??null,i=tH(e,n.intentId,a),s=so.get(i);if(s)return s.releaseUpload=o.releaseUpload,s.watchAuthority=r,s.state;let l={key:i,inputKey:e,environmentId:t,intentId:n.intentId,revision:a,text:n.management?.text??n.text??"",retained:n.management?.attachments??[],added:[],saving:!1,error:null},d={state:l,listeners:new Set,releaseUpload:o.releaseUpload,operationLeases:0,committed:!1,disposeRequested:!1,watchAuthority:r,releaseAuthorityWatch:void 0};return so.set(i,d),l}function IT(e,t){let n=so.get(e);return n?(n.releaseAuthorityWatch===void 0&&n.watchAuthority!==void 0&&(n.releaseAuthorityWatch=n.watchAuthority({threadKey:n.state.inputKey,intentId:n.state.intentId,revision:n.state.revision,onInvalid:()=>Dl(e,n)})),n.committed=!0,cv(e,n),n.listeners.add(t),Sp(),()=>{n.listeners.delete(t),Sp()}):()=>{}}function bs(e,t){let n=so.get(e);if(!n)return;n.committed=!0;let o=t(n.state);if(o!==n.state){n.state=o,cv(e,n);for(let r of n.listeners)r()}}function Ip(e){return so.get(e)?.state}function TT(e){let t=so.get(e);if(!t)return null;t.committed=!0,t.operationLeases+=1,cv(e,t);let n=!1;return()=>{if(!n){if(n=!0,t.operationLeases=Math.max(0,t.operationLeases-1),t.operationLeases===0&&t.disposeRequested){Dl(e,t);return}Sp()}}}function Tp(e){let t=so.get(e);t&&Dl(e,t)}function kT(e,t){let n=new Map(t.flatMap(o=>o.waiting&&o.management!==void 0?[[o.intentId,o.management.revision]]:[]));for(let[o,r]of so)r.state.inputKey===e&&n.get(r.state.intentId)!==r.state.revision&&Dl(o,r);Sp()}function LT({entry:e,current:t,inputKey:n,environmentId:o,unavailable:r,attachments:a,watchEditorAuthority:i,onEdit:s,onClose:l}){let{t:d}=eo(),c=ST(n,o,e,a,i),f=$o(P=>IT(c.key,P),()=>Ip(c.key)??c,()=>Ip(c.key)??c),{key:p,text:m,retained:g,added:h,saving:v,error:y}=f,x=N(null),C=a.useUploadStatuses(),w=K(()=>g.map(P=>P.id),[g]),L=a.useAssetUrls(o,w),S=!t?.management||t.management.revision!==e.management?.revision;W(()=>{t===void 0&&(Tp(p),l())},[t,p,l]);let k=()=>{v||(Tp(p),l())},I=P=>{if(v||r||S)return;let _=null,E=[...h];for(let F of P){let B=F.type||"application/octet-stream";if(g.length+E.length>=a.limits.maxAttachments||F.size===0||F.size>a.maxAttachmentBytes(B)){_=d("turnQueue.attachmentLimit",{name:F.name,count:a.limits.maxAttachments,size:a.formatAttachmentSize(a.maxAttachmentBytes(B))});continue}let V=a.makeImageAttachment({id:a.randomUUID(),name:F.name,mimeType:B,sizeBytes:F.size,file:F});E.push(V),a.startUpload({environmentId:o,image:V})}bs(p,F=>({...F,added:E,error:_}))},T=async()=>{let P=Ip(p);if(!P||P.saving||r||S||!P.text.trim()&&P.retained.length+P.added.length===0)return;let _=TT(p);if(_!==null){bs(p,E=>({...E,saving:!0,error:null}));try{await a.awaitUploads(P.added.map(F=>F.id));let E=a.getUploadedAttachments({environmentId:o,images:P.added});if(!E)throw new Error(d("turnQueue.uploadFailed"));await s(e,{text:P.text,attachments:[...P.retained,...E]}),Tp(p),l()}catch(E){bs(p,F=>({...F,saving:!1,error:E instanceof Error?E.message:d("turnQueue.actionFailed")}))}finally{_()}}},A=[...g.map((P,_)=>({...P,previewUrl:L[_],added:!1})),...h.map(P=>({...P,added:!0}))];return u(Ef,{open:!0,onOpenChange:P=>{P||k()},children:b(_f,{className:"max-w-2xl","data-queued-message-editor":!0,children:[b(Nf,{children:[u(Df,{children:d("turnQueue.editTitle")}),u(Rf,{children:d("turnQueue.editDescription")})]}),b("div",{className:"max-h-[60dvh] space-y-3 overflow-y-auto px-6 pb-4",onDragOver:P=>{P.dataTransfer.types.includes("Files")&&P.preventDefault()},onDrop:P=>{P.dataTransfer.files.length&&(P.preventDefault(),P.stopPropagation(),I(Array.from(P.dataTransfer.files)))},children:[u(qw,{"aria-label":d("turnQueue.editText"),autoFocus:!0,value:m,maxLength:a.limits.maxInputChars,disabled:v,onChange:P=>bs(p,_=>({..._,text:P.target.value})),onPaste:P=>{P.clipboardData.files.length&&(P.preventDefault(),I(Array.from(P.clipboardData.files)))},onKeyDown:P=>{(P.metaKey||P.ctrlKey)&&P.key==="Enter"&&!P.nativeEvent.isComposing&&(P.preventDefault(),T())}}),u("ul",{className:"flex flex-wrap gap-2",children:A.map(P=>b("li",{className:"flex max-w-full items-center gap-2 rounded-md border border-border px-2 py-1.5",children:[P.type==="image"&&P.previewUrl?u("img",{src:P.previewUrl,alt:P.name,className:"size-12 rounded object-cover"}):u(vo,{className:"size-4 shrink-0"}),b("div",{className:"min-w-0 text-xs",children:[u("p",{className:"max-w-48 break-words",children:P.name}),u("p",{className:"text-muted-foreground",children:a.formatAttachmentSize(P.sizeBytes)}),P.added&&C.get(P.id)!=="ready"?u("p",{children:d(C.get(P.id)==="failed"?"turnQueue.uploadFailed":"turnQueue.uploading")}):null,P.added&&C.get(P.id)==="failed"?u(ce,{size:"xs",variant:"ghost",disabled:v||r||S,onClick:()=>{let _=h.find(E=>E.id===P.id);_&&a.retryUpload({environmentId:o,image:_})},children:d("turnQueue.retryUpload")}):null]}),u(ce,{size:"icon-xs",variant:"ghost","aria-label":d("turnQueue.removeAttachment",{name:P.name}),disabled:v||S,onClick:()=>{P.added?(a.releaseUpload(P.id),P.previewUrl&&URL.revokeObjectURL(P.previewUrl),bs(p,_=>({..._,added:_.added.filter(E=>E.id!==P.id)}))):bs(p,_=>({..._,retained:_.retained.filter(E=>E.id!==P.id)}))},children:u(Zt,{className:"size-3.5"})})]},P.id))}),u("input",{ref:x,type:"file",multiple:!0,className:"hidden","aria-label":d("turnQueue.addAttachments"),onChange:P=>{I(Array.from(P.target.files??[])),P.target.value=""}}),b(ce,{size:"sm",variant:"outline",disabled:v||r||S,onClick:()=>x.current?.click(),children:[u(vo,{className:"size-4"}),d("turnQueue.addAttachments")]}),S?u("p",{role:"alert",className:"text-sm text-muted-foreground",children:d("turnQueue.editStale")}):null,y?u("p",{role:"alert",className:"text-sm text-destructive-foreground",children:y}):null]}),b(Mf,{children:[u(ce,{variant:"ghost",disabled:v,onClick:k,children:d("turnQueue.discardEdit")}),u(ce,{disabled:v||r||S||!m.trim()&&A.length===0,onClick:()=>{T()},children:d(v?"turnQueue.saving":"turnQueue.saveEdit")})]})]})})}function PT(e,t){let n=e.find(a=>a.intentId===t.intentId);if(!n)return e;let o=e.filter(a=>a.intentId!==t.intentId),r=t.beforeIntentId===null?o.length:o.findIndex(a=>a.intentId===t.beforeIntentId);return r<0?e:(o.splice(r,0,n),o)}function AT(e,t,n){if(t===n)return null;let o={intentId:t,beforeIntentId:n,previousOrder:e.map(a=>a.intentId)};return PT(e,o).every((a,i)=>a.intentId===e[i]?.intentId)?null:o}function ET(e,t){if(!e.find(l=>l.intentId===t.intentId)?.management?.canReorder||t.beforeIntentId!==null&&!e.some(l=>l.intentId===t.beforeIntentId))return{entries:e,settled:!0};let o=new Set(e.map(l=>l.intentId)),r=new Set(t.previousOrder),a=t.previousOrder.filter(l=>o.has(l));return e.filter(l=>r.has(l.intentId)).some((l,d)=>l.intentId!==a[d])?{entries:e,settled:!0}:{entries:PT(e,t),settled:!1}}ue();ue();function oH({entry:e,unavailable:t,onCancel:n}){let{t:o}=eo(),r=N(!1),[a,i]=J(!1),[s,l]=J(!1),[d,c]=J(!1);W(()=>{c(!1),l(!1)},[e.status,e.deliveryCertainty]);let f=async()=>{if(!(r.current||t||e.action===null)){r.current=!0,i(!0),l(!1);try{await n(e),c(!1)}catch{l(!0)}finally{r.current=!1,i(!1)}}};return b("li",{className:"space-y-2 border-t border-border py-2","data-turn-queue-message":!0,children:[u("p",{className:"text-muted-foreground",children:o(e.deliveryCertainty==="unknown"?"turnQueue.itemUnknown":e.status==="queued"?"turnQueue.itemQueued":e.status==="blocked"||e.status==="reconciling"?"turnQueue.itemBlocked":"turnQueue.itemRunning")}),u("p",{className:"whitespace-pre-wrap break-words [overflow-wrap:anywhere]",children:e.text??o("turnQueue.messageUnavailable")}),e.attachmentNames.length>0?u("p",{className:"break-words text-muted-foreground",children:e.attachmentNames.join(", ")}):null,e.action!==null?d&&e.action==="abandon"?b("div",{className:"space-y-2",children:[u("p",{children:o("turnQueue.abandonDescription")}),b("div",{className:"flex flex-wrap gap-2",children:[u(ce,{size:"xs",variant:"outline",disabled:a||t,onClick:()=>{f()},children:o("turnQueue.confirmAbandon")}),u(ce,{size:"xs",variant:"ghost",disabled:a,onClick:()=>c(!1),children:o("turnQueue.keepWaiting")})]})]}):u(ce,{size:"xs",variant:"outline",disabled:a||t,onClick:()=>e.action==="abandon"?c(!0):void f(),children:o(a?"turnQueue.cancelling":e.action==="abandon"?"turnQueue.stopWaiting":"turnQueue.cancelMessage")}):null,s?u("p",{role:"alert",className:"text-destructive-foreground",children:o("turnQueue.actionFailed")}):null]})}function RT({entries:e,unavailable:t,onCancel:n}){let{t:o}=eo(),[r,a]=J(!1),i=Jr();return e.length===0?null:b("div",{className:"min-w-0 basis-full space-y-2",children:[u(ce,{size:"xs",variant:"ghost","aria-expanded":r,"aria-controls":i,onClick:()=>a(s=>!s),children:o(r?"turnQueue.hideMessages":"turnQueue.showMessages")}),r?u("ol",{id:i,className:"max-h-64 overflow-y-auto overscroll-contain",children:e.map(s=>u(oH,{entry:s,unavailable:t,onCancel:n},s.intentId))}):null]})}function uv({queue:e,unavailable:t=!1,onResume:n,entries:o,onCancel:r}){let{t:a}=eo(),i=N(!1),[s,l]=J(!1),[d,c]=J(!1),f=N(!1),[p,m]=J(!1),[g,h]=J(!1),[v,y]=J(null);W(()=>{e.paused||c(!1)},[e.paused]);let x=o?.[0];W(()=>{m(!1),y(null)},[x?.intentId,x?.status,x?.deliveryCertainty]);let C=e.deliveryUncertain||e.blocked||e.reconciling;if(!e.paused&&!C)return null;let w=r!==void 0&&x?.action==="abandon"&&(e.reconciling||e.deliveryUncertain),L=async()=>{if(f.current||t||r===void 0||x===void 0)return;let T=x;f.current=!0,h(!0),y(null);try{await r(T),m(!1)}catch{y(T.intentId)}finally{f.current=!1,h(!1)}},S=e.paused?a("turnQueue.pausedTitle"):e.deliveryUncertain?a("turnQueue.uncertainTitle"):e.blocked?a("turnQueue.blockedTitle"):e.reconciling?a("turnQueue.reconcilingTitle"):a("turnQueue.queuedTitle"),k=e.deliveryUncertain?a("turnQueue.uncertainDescription"):e.blocked?a("turnQueue.blockedDescription"):e.reconciling?a("turnQueue.reconcilingDescription"):e.paused?a("turnQueue.pausedDescription"):a("turnQueue.queuedDescription"),I=async()=>{if(!(i.current||t||!e.paused)){i.current=!0,l(!0),c(!1);try{await n()}catch{c(!0)}finally{i.current=!1,l(!1)}}};return b("div",{className:"mx-auto mb-2 flex w-full max-w-3xl flex-wrap items-start gap-2 rounded-md border border-warning/40 bg-background px-3 py-2 text-xs text-foreground","data-turn-queue-banner":!0,role:"status",children:[b("div",{className:"min-w-0 flex-1 basis-48 space-y-1",children:[b("div",{className:"flex flex-wrap items-baseline gap-x-2 gap-y-1",children:[u("span",{className:"font-medium",children:S}),u("span",{className:"text-muted-foreground",children:a("turnQueue.queued",{count:e.queuedCount})})]}),u("p",{className:"text-muted-foreground",children:k}),e.paused&&C?u("p",{className:"text-muted-foreground",children:a("turnQueue.pausedUncertainDescription")}):null,t?u("p",{className:"text-muted-foreground",children:a("turnQueue.disconnected")}):null,d&&e.paused?u("p",{className:"text-destructive-foreground",role:"alert",children:a("turnQueue.resumeFailed")}):null,v!==null&&v===x?.intentId?u("p",{className:"text-destructive-foreground",role:"alert",children:a("turnQueue.actionFailed")}):null]}),e.paused?u(ce,{size:"xs",variant:"outline",disabled:s,softDisabled:t,onClick:()=>{I()},children:a(s?"turnQueue.resuming":"turnQueue.resume")}):null,w?b(Pe,{children:[u(ce,{size:"xs",variant:"outline",disabled:g,softDisabled:t,onClick:()=>m(!0),children:a("turnQueue.stopWaiting")}),u(jw,{open:p,onOpenChange:T=>{T||m(!1)},children:b(Zw,{className:"max-w-lg",children:[b(Jw,{children:[u(eS,{children:a("turnQueue.stopWaiting")}),u(Xw,{children:a("turnQueue.abandonDescription")})]}),b(Yw,{children:[u(Qw,{render:u(ce,{variant:"ghost"}),children:a("turnQueue.keepWaiting")}),u(ce,{variant:"outline",disabled:g||t,onClick:()=>{L()},children:a(g?"turnQueue.cancelling":"turnQueue.confirmAbandon")})]})]})})]}):null,r&&o?u(RT,{entries:o.filter(T=>T.status!=="queued"),unavailable:t,onCancel:r}):null]})}var rH=[CT,xT],aH=[];function iH({submission:e}){let{t}=eo();return b("li",{"data-queue-pending-message":e.messageId,className:"flex items-center gap-1.5 border-t border-border/50 px-2 py-1.5",children:[u("span",{"aria-hidden":"true",className:"grid size-6 shrink-0 place-items-center",children:u("span",{className:"size-1.5 rounded-full bg-muted-foreground/60"})}),b("div",{className:"min-w-0 flex-1",children:[u("p",{className:"line-clamp-2 whitespace-pre-wrap break-words [overflow-wrap:anywhere]",children:Bh(e.text)||t("turnQueue.attachmentsOnly")}),e.attachmentNames.length?b("p",{className:"flex items-center gap-1 text-muted-foreground",children:[u(vo,{className:"size-3 shrink-0"}),u("span",{className:"truncate",children:e.attachmentNames.join(", ")})]}):null]}),u("span",{role:"status",className:"w-[5.25rem] shrink-0 text-end text-muted-foreground",children:t("primaryActions.sendingButtonLabel")})]})}function sH({entry:e,disabled:t,dropPosition:n,dragPosition:o,feedback:r,reducedMotion:a,children:i}){let{t:s}=eo(),{attributes:l,listeners:d,setNodeRef:c,setActivatorNodeRef:f,transform:p,transition:m,isDragging:g}=hT({id:e.intentId,disabled:t,transition:a?null:{duration:160,easing:"ease-out"}});return b("li",{ref:c,"data-queue-intent":e.intentId,"data-queue-dragging":g||void 0,"data-queue-feedback":r,style:{transform:vi.Transform.toString(p),transition:m},className:$("relative flex items-center gap-1.5 border-t border-border/50 px-2 py-1.5",g&&"z-10 bg-accent shadow-md ring-1 ring-primary/50 ring-inset",r==="saved"&&"bg-primary/10 ring-1 ring-primary/30 ring-inset",r==="failed"&&"bg-destructive/10"),children:[n?u("span",{"aria-hidden":"true","data-queue-drop-position":n,className:$("pointer-events-none absolute inset-x-1 z-20 h-0.5 rounded-full bg-primary before:absolute before:-top-0.5 before:start-0 before:size-1.5 before:rounded-full before:bg-primary",n==="before"?"top-0":"bottom-0")}):null,u(ce,{ref:f,size:"icon-xs",variant:"ghost",className:$("shrink-0 touch-none cursor-grab text-muted-foreground active:cursor-grabbing",(g||r==="saved")&&"bg-primary/10 text-primary"),...l,...d,"aria-label":s("turnQueue.reorderMessage"),title:s("turnQueue.reorderMessage"),softDisabled:t,children:r==="saved"?u(ho,{className:"size-3.5"}):u(Wd,{className:"size-3.5"})}),i,g&&o?u("span",{"aria-hidden":"true","data-queue-drag-position":!0,className:"pointer-events-none absolute end-3 rounded bg-primary/10 px-2 py-1 font-medium text-primary tabular-nums",children:o}):null]})}function MT({inputKey:e,entries:t,pendingSubmissions:n=aH,environmentId:o,unavailable:r,attachments:a,actions:i,onCancel:s}){let{t:l}=eo(),d=wp("(prefers-reduced-motion: reduce)"),[c,f]=sn("turn-queue:editing",e,null),[p,m]=sn("turn-queue:pending",e,!1),g=Rt("turn-queue:pending-ref",e,!1),[h,v]=sn("turn-queue:error",e,null),[y,x]=sn("turn-queue:drag",e,null),[C,w]=sn("turn-queue:move",e,null),L=Rt("turn-queue:reorder-ref",e,!1),[S,k]=sn("turn-queue:feedback",e,null),I=$0(lv(_l,{activationConstraint:{distance:5}}),lv(Nl,{coordinateGetter:vT,scrollBehavior:d?"auto":"smooth"})),T=K(()=>t.filter(H=>H.waiting),[t]),A=C?ET(T,C.preview):null,P=A?.entries??T,_=P.length+n.length,E=r||p||C!==null,F=P.findIndex(H=>H.intentId===y?.activeId),B=P.findIndex(H=>H.intentId===y?.overId);W(()=>{kT(e,t)},[t,e]),W(()=>{C!==null&&(r||C.acknowledged&&A?.settled)&&(L.current=!1,w(null),!r&&T.some(H=>H.intentId===C.preview.intentId)&&k({intentId:C.preview.intentId,kind:"saved"}))},[T,C,A?.settled,r]),W(()=>{if(S===null||S.kind==="failed")return;let H=window.setTimeout(()=>k(q=>q===S?null:q),1600);return()=>window.clearTimeout(H)},[S]);let V=async H=>{if(!(g.current||L.current||r)){g.current=!0,m(!0),v(null),k(null);try{await H()}catch(q){v(q instanceof Error?q.message:l("turnQueue.actionFailed"))}finally{g.current=!1,m(!1)}}},Q=(H,q)=>V(async()=>{let ee=AT(T,H.intentId,q);if(!(ee===null||!H.management?.canReorder)){L.current=!0,w({preview:ee,acknowledged:!1});try{await i.onReorder(H,q),w(G=>G?.preview===ee?{...G,acknowledged:!0}:G)}catch(G){throw L.current=!1,w(null),k({intentId:H.intentId,kind:"failed"}),G}}}),Se=r?l("turnQueue.disconnected"):C!==null?l("turnQueue.saving"):y!==null?`${l("turnQueue.dragStarted")} ${B+1}/${P.length}`:S?.kind==="saved"?l("common.action.done"):S?.kind==="cancelled"?l("turnQueue.dragCancelled"):"";return b(Pe,{children:[_>0?b("section",{"aria-label":l("turnQueue.pendingMessages"),"data-turn-queue-dock":!0,className:"mx-auto mb-2 w-full max-w-3xl overflow-hidden rounded-xl border border-border/60 bg-background/95 text-xs shadow-xs",children:[b("div",{className:"flex h-7 items-center justify-between gap-3 px-3 py-1.5 text-muted-foreground",children:[u("span",{className:"shrink-0",children:l("turnQueue.queued",{count:_})}),u("span",{role:"status","aria-live":y===null?"polite":"off","data-queue-reorder-status":C?"saving":S?.kind,className:$("min-w-0 truncate",S?.kind==="saved"&&"text-primary"),children:Se})]}),u(aT,{sensors:I,collisionDetection:q0,modifiers:rH,accessibility:{screenReaderInstructions:{draggable:l("turnQueue.dragInstructions")},announcements:{onDragStart:()=>l("turnQueue.dragStarted"),onDragOver:({over:H})=>{let q=P.findIndex(ee=>ee.intentId===H?.id);return q<0?void 0:`${l("turnQueue.dragStarted")} ${q+1}/${P.length}`},onDragEnd:()=>l("turnQueue.dragFinished"),onDragCancel:()=>l("turnQueue.dragCancelled")}},onDragStart:({active:H})=>{let q=P.find(ee=>ee.intentId===H.id);!q?.management?.canReorder||E||(v(null),k(null),x({activeId:q.intentId,overId:q.intentId}))},onDragOver:({over:H})=>{let q=P.find(ee=>ee.intentId===H?.id);q&&x(ee=>ee&&{...ee,overId:q.intentId})},onDragCancel:()=>{y&&k({intentId:y.activeId,kind:"cancelled"}),x(null)},onDragEnd:({active:H,over:q})=>{if(x(null),!q||H.id===q.id)return;let ee=P.findIndex(U=>U.intentId===H.id),G=P.findIndex(U=>U.intentId===q.id),te=P[ee];if(!te?.management?.canReorder||G<0)return;let me=P[G+(ee<G?1:0)]?.intentId??null;Q(te,me)},children:u(mT,{items:P.map(H=>H.intentId),strategy:uT,children:b("ol",{className:"max-h-52 overflow-x-hidden overflow-y-auto overscroll-contain [scrollbar-gutter:stable]",children:[P.map((H,q)=>b(sH,{entry:H,disabled:!H.management?.canReorder||E,reducedMotion:d,feedback:S?.intentId===H.intentId?S.kind:void 0,dropPosition:H.intentId===y?.overId&&F!==B?F<B?"after":"before":void 0,dragPosition:H.intentId===y?.activeId?`${B+1}/${P.length}`:void 0,children:[b("div",{className:"min-w-0 flex-1",children:[u("p",{className:"line-clamp-2 whitespace-pre-wrap break-words [overflow-wrap:anywhere]",children:Bh(H.text??"")||l("turnQueue.attachmentsOnly")}),H.attachmentNames.length?b("p",{className:"flex items-center gap-1 text-muted-foreground",children:[u(vo,{className:"size-3 shrink-0"}),u("span",{className:"truncate",children:H.attachmentNames.join(", ")})]}):null,H.pendingAction?u("p",{className:"text-muted-foreground",children:l(H.pendingAction==="steer"?"turnQueue.steering":"turnQueue.interrupting")}):null,H.failure?u("p",{role:"alert",className:"text-destructive-foreground",children:H.failure}):null]}),b("div",{className:$("flex shrink-0 items-center gap-0.5",H.intentId===y?.activeId&&"invisible"),children:[u(ce,{size:"icon-xs",variant:"ghost",disabled:!H.management||E||y!==null,"aria-label":l("turnQueue.editMessage"),title:l("turnQueue.editMessage"),onClick:()=>f(H),children:u(ec,{className:"size-3.5"})}),H.management?.canSteer?u(ce,{size:"icon-xs",variant:"ghost",disabled:E||y!==null,"aria-label":l("turnQueue.steer"),title:l("turnQueue.steerDescription"),onClick:()=>{V(()=>i.onRun(H,"steer"))},children:u(tc,{className:"size-3.5"})}):null,b(Eo,{children:[u(Mo,{render:u(ce,{size:"icon-xs",variant:"ghost",disabled:E||!H.management||y!==null,"aria-label":l("turnQueue.messageActions")}),children:u(sr,{className:"size-4"})}),b(Ro,{align:"end",children:[b(lr,{disabled:!H.management?.canReorder||q===0,onClick:()=>{Q(H,P[q-1].intentId)},children:[u(Od,{className:"size-4"}),l("turnQueue.moveUp")]}),b(lr,{disabled:!H.management?.canReorder||q===P.length-1,onClick:()=>{Q(H,P[q+2]?.intentId??null)},children:[u(_d,{className:"size-4"}),l("turnQueue.moveDown")]}),H.management?.canSteer?u(lr,{onClick:()=>{V(()=>i.onRun(H,"steer"))},children:l("turnQueue.steer")}):null,u(lr,{disabled:!H.management?.canRun,onClick:()=>{V(()=>i.onRun(H,"interrupt"))},children:l(H.management?.expectedTurnId?"turnQueue.interruptAndRun":"turnQueue.sendNext")}),u(di,{}),u(lr,{disabled:H.action!=="cancel",onClick:()=>{V(()=>s(H))},children:l("turnQueue.cancelMessage")})]})]})]})]},H.intentId)),n.map(H=>u(iH,{submission:H},H.messageId))]})})},e),h?u("p",{role:"alert",className:"px-3 py-2 text-destructive-foreground",children:h}):null]}):null,c?u(LT,{entry:c,current:t.find(H=>H.intentId===c.intentId),inputKey:e,environmentId:o,unavailable:E,attachments:a,watchEditorAuthority:i.watchEditorAuthority,onEdit:i.onEdit,onClose:()=>f(null)},`${e}\0${c.intentId}\0${c.management?.revision??"none"}`):null]})}function NT({data:e,target:t,inputKey:n,attachments:o}){let r=e.useQueue({target:t,threadKey:n}),{environmentId:a,threadId:i}=t,s=e.queue,l=K(()=>{let d={environmentId:a,threadId:i};return{actions:{onEdit:(f,p)=>s.edit(d,f,p),onReorder:(f,p)=>s.reorder(d,f,p),onRun:(f,p)=>s.run(d,f,p),watchEditorAuthority:s.watchEditorAuthority},onCancel:f=>s.cancel(d,f),onResume:()=>s.resume(d)}},[s,a,i]);return b(Pe,{children:[u(MT,{inputKey:n,actions:l.actions,attachments:o,entries:r.entries,pendingSubmissions:r.pendingSubmissions,environmentId:a,onCancel:l.onCancel,unavailable:r.unavailable}),u(uv,{entries:r.entries,onCancel:l.onCancel,onResume:l.onResume,queue:r.state,unavailable:r.unavailable})]})}ue();var fv=220,lH={opacity:0,transform:"translate3d(0, 4rem, 0)"},dH={opacity:0,transform:"translate3d(0, 7rem, 0)"},_T={opacity:1,transform:"none"},DT={transition:`transform ${fv}ms ease-in, opacity ${fv}ms ease-in`},cH={default:"border-[var(--chat-composer-attached-outline)]",error:"border-destructive/24",info:"border-info/24",success:"border-success/24",warning:"border-warning/24"};function FT({className:e,items:t}){let{t:n}=Ce(),[o,r]=J(null),a=N(null),i=o!==null&&t.some(m=>m.id===o)?o:null;if(W(()=>()=>{a.current&&clearTimeout(a.current)},[]),t.length===0)return null;let s=t[0];if(!s)return null;let l=t.slice(1),d=l.length>0,c=d&&i!==s.id,f=l[0],p=m=>{!m.onDismiss||i||(r(m.id),a.current&&clearTimeout(a.current),a.current=setTimeout(()=>{a.current=null,m.onDismiss?.()},fv))};return u("div",{className:$("group/banner-stack chat-composer-drawer-slot",e),"data-composer-banner-drawer":"true",children:b("div",{className:$("relative flex flex-col-reverse",d?"group-hover/banner-stack:z-50 group-focus-within/banner-stack:z-50":null),children:[c&&f?u("div",{className:$("pointer-events-none absolute inset-x-0 -top-3 z-0 mx-auto h-3 rounded-t-2xl","chat-composer-banner-stack-cap border border-b-0 shadow-[0_6px_18px_rgba(0,0,0,0.06)]",cH[f.variant],"transition-opacity duration-150 ease-out","group-hover/banner-stack:opacity-0 group-focus-within/banner-stack:opacity-0"),style:{width:"96%"},"aria-hidden":"true"}):null,u("div",{className:$("relative z-10",i===s.id?"pointer-events-none":null),style:{...DT,...i===s.id?lH:_T},children:u(OT,{item:s,attached:!0,exiting:i===s.id,onDismissRequest:()=>p(s)})}),d?u("div",{"data-composer-banner-stack-expanded-items":"true",className:$("relative z-20 grid grid-rows-[0fr] transition-[grid-template-rows] duration-150 ease-out","group-hover/banner-stack:grid-rows-[1fr] group-focus-within/banner-stack:grid-rows-[1fr]"),children:u("div",{className:"min-h-0 overflow-hidden",children:u("div",{className:$("invisible pointer-events-none space-y-2 pb-2 opacity-0","translate-y-1 transform-gpu transition-[opacity,transform] duration-150 ease-out will-change-[opacity,transform]","group-hover/banner-stack:visible group-hover/banner-stack:pointer-events-auto group-hover/banner-stack:translate-y-0 group-hover/banner-stack:opacity-100","group-focus-within/banner-stack:visible group-focus-within/banner-stack:pointer-events-auto group-focus-within/banner-stack:translate-y-0 group-focus-within/banner-stack:opacity-100"),children:l.map(m=>u("div",{className:$(i===m.id?"pointer-events-none":null),style:{...DT,...i===m.id?dH:_T},children:u(OT,{item:m,attached:!1,exiting:i===m.id,onDismissRequest:()=>p(m)})},m.id))})})}):null]})})}function OT({item:e,attached:t,exiting:n,onDismissRequest:o}){let{t:r}=Ce(),a=e.onDismiss&&!e.actions;return e.presentation==="compact"?b(cc,{variant:e.variant,role:"status",className:$("min-h-0 px-3 text-xs sm:px-4",t?"chat-composer-drawer-surface chat-composer-drawer-attached pt-1.5 pb-[calc(var(--chat-composer-attachment-overlap)_+_0.25rem)]":"alert-glass rounded-[22px] py-1.5",e.className),"data-composer-banner-presentation":"compact","data-variant":e.variant,children:[e.icon,b(Ih,{className:"flex min-w-0 items-baseline gap-1.5 font-normal leading-5",children:[u("span",{className:"shrink-0 font-medium text-foreground",children:e.title}),e.description?u("span",{className:"min-w-0 truncate text-muted-foreground",children:e.description}):null]}),e.actions||e.onDismiss?b(uc,{className:$("shrink-0",e.actionClassName),children:[e.actions,e.onDismiss?u(ce,{size:"icon-xs",variant:"ghost","aria-label":e.dismissLabel??r("composer.dismissNotice"),disabled:n,onClick:o,children:u(Zt,{})}):null]}):null]}):b(cc,{variant:e.variant,className:$(t?"chat-composer-drawer-surface chat-composer-drawer-attached px-3 pt-2 pb-[calc(var(--chat-composer-attachment-overlap)_+_0.375rem)] text-xs sm:px-4":"alert-glass rounded-[22px]",e.className),"data-variant":e.variant,children:[e.icon,u(Ih,{children:e.title}),e.description?u(Ff,{children:e.description}):null,e.actions||e.onDismiss?b(uc,{className:$(e.actionClassName,a?"max-sm:col-start-3 max-sm:row-start-1 max-sm:mt-0 max-sm:self-start":void 0),children:[e.actions,e.onDismiss?u(ce,{size:"icon-xs",variant:"ghost","aria-label":e.dismissLabel??r("composer.dismissWarning"),disabled:n,onClick:o,children:u(Zt,{})}):null]}):null]})}ue();var BT=bt(!1),zT=BT.Provider;function UT(){return Ht(BT)}function HT({belowSlot:e,composer:t,data:n,draftHero:o,onOverlayElementChange:r,queue:a,target:i,threadKey:s}){let l=n.useComposerBanners({target:i,threadKey:s}),d=u(FT,{className:"relative z-0",items:l.items});return b("div",{ref:r,"data-chat-composer-overlay":"true",className:o.active?"pointer-events-none absolute inset-0 z-20 flex items-center":"pointer-events-none absolute inset-x-0 bottom-0 z-20 pt-1.5 sm:pt-2",children:[b("div",{ref:o.transitionGroupRef,className:"w-full ps-[calc(env(safe-area-inset-left)+0.75rem)] pe-[calc(env(safe-area-inset-right)+0.75rem)] sm:ps-[calc(env(safe-area-inset-left)+1.25rem)] sm:pe-[calc(env(safe-area-inset-right)+1.25rem)]",children:[b("div",{className:"pointer-events-auto relative z-10",children:[a,o.active?b("div",{className:"absolute inset-x-0 bottom-full z-0",children:[u("div",{className:"pb-8",style:{viewTransitionName:o.headlineTransitionName},children:o.headline}),d]}):d,b("div",{"data-chat-composer-stack":"true",className:"chat-composer-glass-shell relative mx-auto w-full max-w-3xl",style:{viewTransitionName:o.composerTransitionName},children:[u("div",{className:"chat-composer-glass-host relative z-10 w-full rounded-[22px]",children:u("div",{ref:o.composerAnchorRef,className:"relative z-10",children:u(zT,{value:l.items.length>0,children:t})})}),u("div",{className:"min-h-0",children:e})]})]}),u("div",{"aria-hidden":!0,className:"h-[calc(env(safe-area-inset-bottom)+1rem)] sm:h-[calc(env(safe-area-inset-bottom)+1.25rem)]"})]}),l.overlay]})}function $T(e,t){let n=e!==null&&e!=="plan-follow-up";return{showTopDrawer:e!==null&&(n||!t),showCollapsedPromptRow:t&&!n,hasBlocking:n}}var uH=["image/gif","image/jpeg","image/png","image/webp"],fH=new Set(uH);function pv(e){return fH.has(e.toLowerCase())}function pH(e){return pv(e)?"image":"file"}var mH=new Set(["application/json","application/xml","application/x-yaml","application/yaml"]);function mv(e){if(e.type==="image")return"image";let t=e.mimeType.toLowerCase();return t==="application/pdf"?"pdf":t.startsWith("text/")||mH.has(t)?"text":"file"}function gv(e){return!Number.isFinite(e)||e<=0?"0 KB":e>=1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${Math.max(1,Math.round(e/1024))} KB`}function hv(e){let t={id:e.id,name:e.name,mimeType:e.mimeType,sizeBytes:e.sizeBytes};return pH(e.mimeType)==="image"?{type:"image",...t}:{type:"file",...t}}ue();var gH=/(^|\s)\$([a-zA-Z][a-zA-Z0-9:_-]*)(?=\s)/g,hH=/(^|\s)@(?:"((?:\\.|[^"\\])*)"|([^\s@"]+))(?=\s)/g;var vH=new RegExp("(^|\\s)\\[((?:\\\\.|[^\\]\\\\]){0,512})\\]\\(([^)\\s]+)\\)(?=\\s)","g"),yH=/^[A-Za-z][A-Za-z0-9+.-]*:/,xH=/^[A-Za-z]:[\\/]/,CH=/^[a-z0-9][a-z0-9._-]*\/[a-z0-9][a-z0-9._-]*(?:\/[^\s@"]+)*$/;function bH(e){let t=[];for(let n of e.matchAll(vH)){let o=n[0],r=n[1]??"",a=(n[2]??"").replace(/\\(.)/g,"$1"),i=n[3]??"",s=i;try{s=decodeURIComponent(i)}catch{}let l=Math.max(s.lastIndexOf("/"),s.lastIndexOf("\\")),d=l>=0?s.slice(l+1):s,c=yH.test(s)&&!xH.test(s);if(!s||c||a!==d)continue;let f=(n.index??0)+r.length,p=f+o.length-r.length;t.push({type:"mention",value:s,source:e.slice(f,p),start:f,end:p})}for(let n of e.matchAll(hH)){let o=n[0],r=n[1]??"",a=n[2],i=a!==void 0?a.replace(/\\(.)/g,"$1"):n[3]??"";if(!i||a===void 0&&CH.test(i))continue;let s=(n.index??0)+r.length,l=s+o.length-r.length;t.push({type:"mention",value:i,source:e.slice(s,l),start:s,end:l})}return t}function Nc(e,t={}){let n=bH(e);for(let o of e.matchAll(gH)){let r=o[0],a=o[1]??"",i=o[2]??"";if(!i)continue;let s=(o.index??0)+a.length,l=s+r.length-a.length;n.push({type:"skill",value:i,source:e.slice(s,l),start:s,end:l})}for(let o of t.preserveTrailingFrom??[])o.end===e.length&&e.slice(o.start,o.end)===o.source&&!n.some(r=>r.type===o.type&&r.start===o.start&&r.end===o.end)&&n.push(o);return[...n].sort((o,r)=>o.start-r.start)}function wH(e){return e.replace(/\r\n/g,`
|
|
3768
|
+
`).replace(/^\n+|\n+$/g,"")}function SH(e){return wH(e.text).length>0}function KT(e){return!SH(e)}function IH(e,t){return e.lineStart===e.lineEnd?t("pendingContext.terminalLine",{line:e.lineStart}):t("pendingContext.terminalLines",{start:e.lineStart,end:e.lineEnd})}function VT(e,t){return t("pendingContext.terminalLabel",{terminal:e.terminalLabel,range:IH(e,t)})}function qT(e,t,n){return e<=n&&n<t}function WT(e,t){if(!t)return;let n=e[e.length-1];if(n&&n.type==="text"){n.text+=t;return}e.push({type:"text",text:t})}function GT(e,t){let n=0;for(let o=0;o<e.length;o+=1)if(e[o]==="\uFFFC"){if(o>n&&t({type:"text",text:e.slice(n,o),promptOffset:n})===!0||t({type:"terminal-context",promptOffset:o})===!0)return!0;n=o+1}return n<e.length&&t({type:"text",text:e.slice(n),promptOffset:n})===!0}function TH(e,t){return GT(e,n=>n.type!=="text"?!1:t(n.text,n.promptOffset))}function kH(e,t){return TH(e,(n,o)=>{for(let r of Nc(n))if(r.type==="mention"&&t(r,o)===!0)return!0;return!1})}function LH(e){let t=[];if(!e)return t;let n=Nc(e),o=0;for(let r of n)r.start<o||(r.start>o&&WT(t,e.slice(o,r.start)),r.type==="mention"?t.push({type:"mention",path:r.value,source:r.source}):t.push({type:"skill",name:r.value}),o=r.end);return o<e.length&&WT(t,e.slice(o)),t}function vv(e,t,n){return!e||t>=n?!1:kH(e,(o,r)=>{let a=r+o.start,i=r+o.end,s=a-1,l=i;return!!(s>=0&&/\s/.test(e[s]??"")&&qT(t,n,s)||l<e.length&&/\s/.test(e[l]??"")&&qT(t,n,l))})}function ws(e,t=[]){if(!e)return[];let n=[],o=0;return GT(e,r=>r.type==="text"?(n.push(...LH(r.text)),!1):(n.push({type:"terminal-context",context:t[o]??null}),o+=1,!1)),n}function QT(e){return e.isMobileViewport?null:e.modifierKey&&e.shiftKey?e.isDraftThread?"background":null:e.shiftKey?null:e.modifierKey?"steer":"foreground"}var jT=e=>e.type!=="text";function yv(e,t){return Number.isFinite(t)?Math.max(0,Math.min(e.length,Math.floor(t))):e.length}function PH(e){return e===" "||e===`
|
|
3769
|
+
`||e===" "||e==="\r"||e==="\uFFFC"}function AH(e,t){let n=t-1;for(;n>=0&&!PH(e[n]??"");)n-=1;return n+1}function Go(e,t){let n=yv(e,t),o=ws(e);if(o.length===0)return n;let r=n,a=0;for(let i of o){if(i.type==="mention"){let l=i.source.length;if(r<=1)return a+(r===0?0:l);r-=1,a+=l;continue}if(i.type==="skill"){let l=i.name.length+1;if(r<=1)return a+(r===0?0:l);r-=1,a+=l;continue}if(i.type==="terminal-context"){if(r<=1)return a+r;r-=1,a+=1;continue}let s=i.text.length;if(r<=s)return a+r;r-=s,a+=s}return a}function XT(e){return e.type==="text"?e.text.length:1}function YT(e,t){let n=e.reduce((o,r)=>o+XT(r),0);return Number.isFinite(t)?Math.max(0,Math.min(n,Math.floor(t))):n}function fr(e,t){return YT(ws(e),t)}function bo(e,t){let n=yv(e,t),o=ws(e);if(o.length===0)return n;let r=n,a=0;for(let i of o){if(i.type==="mention"){let l=i.source.length;if(r===0)return a;if(r<=l)return a+1;r-=l,a+=1;continue}if(i.type==="skill"){let l=i.name.length+1;if(r===0)return a;if(r<=l)return a+1;r-=l,a+=1;continue}if(i.type==="terminal-context"){if(r<=1)return a+r;r-=1,a+=1;continue}let s=i.text.length;if(r<=s)return a+r;r-=s,a+=s}return a}function _c(e,t,n){let o=ws(e);if(!o.some(jT))return!1;let r=YT(o,t),a=0;for(let i of o){if(jT(i)&&(n==="left"&&r===a+1||n==="right"&&r===a))return!0;a+=XT(i)}return!1}function wo(e,t){let n=yv(e,t),o=e.lastIndexOf(`
|
|
3770
|
+
`,Math.max(0,n-1))+1,r=e.slice(o,n);if(r.startsWith("/")){let s=/^\/(\S*)$/.exec(r);if(s)return{kind:"slash-command",query:s[1]??"",rangeStart:o,rangeEnd:n}}let a=AH(e,n),i=e.slice(a,n);return i.startsWith("$")?{kind:"skill",query:i.slice(1),rangeStart:a,rangeEnd:n}:i.startsWith("@")?{kind:"path",query:i.slice(1),rangeStart:a,rangeEnd:n}:null}function JT(e,t,n,o){let r=Math.max(0,Math.min(e.length,t)),a=Math.max(r,Math.min(e.length,n));return{text:`${e.slice(0,r)}${o}${e.slice(a)}`,cursor:r+o.length}}ue();var xv=pe(function(t){let{t:n}=Ce();if(t.count===0)return null;let o=t.placement==="inline",r=u("span",{className:$("text-[10px] font-medium leading-none tabular-nums",t.pulsing?"animate-[prompt-stash-count-enter_180ms_ease-out_both] text-primary motion-reduce:animate-none":"text-muted-foreground"),children:t.count},t.pulseKey);return o?b(ce,{size:"micro",variant:"ghost-muted","data-prompt-stash-badge":"true","aria-label":n("stash.ariaLabel",{count:t.count}),"aria-expanded":t.menuOpen,className:$("shrink-0 gap-1 px-1.5",(t.menuOpen||t.pulsing)&&"[--control-icon-color:currentColor] text-foreground"),onPointerDown:a=>a.preventDefault(),onClick:t.onToggleMenu,children:[u(ml,{className:"size-3 shrink-0","aria-hidden":"true"}),r]}):b("button",{type:"button","data-prompt-stash-badge":"true","aria-label":n("stash.ariaLabel",{count:t.count}),"aria-expanded":t.menuOpen,className:$("chat-composer-shoulder-tab chat-composer-stash-tab absolute -top-7 right-4 z-0 inline-flex h-8 cursor-pointer items-center gap-1.5 rounded-t-xl border border-b-0 px-3 pb-1 text-xs leading-none","transition-colors duration-(--control-duration)",t.menuOpen&&"pointer-events-none",t.menuOpen||t.pulsing?"text-foreground":"text-muted-foreground hover:text-foreground"),onPointerDown:a=>{a.preventDefault()},onClick:t.onToggleMenu,children:[u(ml,{className:"size-3 shrink-0","aria-hidden":"true"}),n("stash.label"),r]})});ue();function ek(e){let t=new Map;return e.map(n=>{let o=t.get(n.step)??0;return t.set(n.step,o+1),{key:`${n.step}:${o}`,step:n}})}function ZT({className:e,steps:t}){return t.length<=1?null:u("span",{"aria-hidden":!0,className:$("flex w-10 shrink-0 items-center gap-0.5",e),children:ek(t).map(({key:n,step:o})=>u("span",{className:$("h-[3px] min-w-0 flex-1 rounded-full",o.status==="completed"?"bg-success":o.status==="inProgress"?"bg-primary":"bg-muted-foreground/25")},n))})}var Cv=pe(function({expanded:t,hasTrailingShoulder:n=!1,onDismiss:o,onToggle:r,placement:a="tab",progress:i,steps:s}){let{t:l}=Ce();if(i.totalSteps<=0)return null;let d=i.completedSteps>=i.totalSteps,c=l("tasksBadge.ariaLabel",{completed:i.completedSteps,total:i.totalSteps,step:i.step});return a==="inline"?b("span",{className:"inline-flex shrink-0 items-center gap-0.5","data-composer-tasks-badge":"true",children:[b(ce,{size:"micro",variant:"ghost-muted","aria-expanded":t,"aria-label":c,className:"shrink-0 gap-1 px-1.5",onClick:r,onPointerDown:f=>f.preventDefault(),children:[u(es,{"aria-hidden":!0,className:"size-3 shrink-0"}),u("span",{children:l("tasksBadge.label")}),u(ZT,{steps:s}),b("span",{className:$("font-medium tabular-nums",d?"text-success":"text-muted-foreground"),children:[i.completedSteps,"/",i.totalSteps]})]}),u(ce,{size:"icon-micro",variant:"ghost-muted","aria-label":l("tasksBadge.dismissLabel"),className:"shrink-0",onClick:o,onPointerDown:f=>f.preventDefault(),children:u(Zt,{"aria-hidden":!0,className:"size-2.5"})})]}):b("div",{className:$("chat-composer-shoulder-tab chat-composer-tasks-tab absolute -top-7 left-4 z-0 flex h-8 items-center gap-1 rounded-t-xl border border-b-0 px-2 pb-1 text-xs leading-none text-muted-foreground",n?"right-28":"right-4",d&&"text-foreground"),"data-composer-tasks-badge":"true",children:[b("button",{type:"button","aria-expanded":t,"aria-label":c,className:"flex min-w-0 flex-1 cursor-pointer items-center gap-2 self-stretch text-muted-foreground hover:text-foreground",onClick:r,onPointerDown:f=>f.preventDefault(),children:[u(es,{"aria-hidden":!0,className:"size-icon-1 shrink-0"}),u("span",{className:"shrink-0",children:l("tasksBadge.label")}),u("span",{className:"min-w-0 flex-1 truncate text-left font-medium text-foreground/80","data-composer-task-current":"true",children:i.step}),b("span",{className:$("shrink-0 font-medium tabular-nums",d?"text-success":"text-muted-foreground"),children:[i.completedSteps,"/",i.totalSteps]}),u(ZT,{className:"w-20",steps:s})]}),u(ce,{size:"icon-micro",variant:"ghost-muted","aria-label":l("tasksBadge.dismissLabel"),className:"shrink-0",onClick:o,onPointerDown:f=>f.preventDefault(),children:u(Zt,{"aria-hidden":!0,className:"size-3"})})]})}),tk=pe(function({onDismiss:t,onCollapse:n,progress:o,steps:r}){let{t:a}=Ce();return b("div",{className:"chat-composer-top-drawer","data-chat-composer-tasks-drawer":"true",children:[b("div",{className:"flex items-center gap-1 px-3 py-1.5 sm:px-4",children:[b("button",{type:"button","aria-expanded":"true",className:"flex min-w-0 flex-1 cursor-pointer items-center gap-2 self-stretch text-left text-xs text-muted-foreground hover:text-foreground",onClick:n,onPointerDown:i=>i.preventDefault(),children:[u(es,{"aria-hidden":!0,className:"size-icon-1 shrink-0"}),u("span",{className:"font-medium text-foreground",children:a("tasksBadge.label")}),b("span",{className:"tabular-nums",children:[o.completedSteps,"/",o.totalSteps]})]}),u(ce,{size:"icon-micro",variant:"ghost-muted","aria-label":a("tasksBadge.dismissLabel"),className:"shrink-0",onClick:t,onPointerDown:i=>i.preventDefault(),children:u(Zt,{"aria-hidden":!0,className:"size-3"})})]}),u("div",{className:"space-y-px px-3 pb-4 sm:px-4",role:"list",children:ek(r).map(({key:i,step:s})=>b("div",{className:"flex items-baseline gap-2 text-xs leading-5",role:"listitem",children:[u("span",{"aria-hidden":!0,className:$("w-3 shrink-0 text-center font-mono text-[10px]",s.status==="completed"?"text-success":s.status==="inProgress"?"text-primary":"text-muted-foreground/40"),children:s.status==="completed"?"\u2713":s.status==="inProgress"?"\u25CF":"\u25CB"}),u("span",{className:$("min-w-0 flex-1",s.status==="completed"?"text-muted-foreground/55":s.status==="inProgress"?"text-foreground/90":"text-muted-foreground/70"),children:s.step}),u("span",{className:"ml-auto w-10 shrink-0 text-right text-[10px] text-muted-foreground/45 tabular-nums","data-composer-task-duration":"true",children:s.durationMs!==void 0?ka(s.durationMs):s.status==="inProgress"?a("tasksBadge.now"):null})]},i))})]})});var EH={"start-failed":"attachments.uploadFailure.startFailed","not-connected":"attachments.uploadFailure.notConnected",rejected:"attachments.uploadFailure.rejected","timed-out":"attachments.uploadFailure.timedOut",cancelled:"attachments.uploadFailure.cancelled",failed:"attachments.uploadFailure.failed"};function kp(e,t){let n=e.code===void 0?void 0:EH[e.code];return n===void 0?e.reason:t(n,{status:e.httpStatus??""})}function nk(e,t){let n=0,o=0;for(let r of e.imageIds){let a=e.uploadsByImageId[r];a?.status==="failed"&&a.environmentId===e.environmentId?o+=1:(a?.status!=="ready"||a.environmentId!==e.environmentId)&&(n+=1)}return o>0?t("attachments.retryOrRemoveFailed",{count:o}):n>0?t("attachments.stillUploading",{count:n}):null}function Lp(e){let t=Math.max(0,Math.min(1,Number.isFinite(e)?e:0));return`${Math.floor(t*100)}%`}function ok(e){switch(e){case"image":return Zi;case"pdf":return Ji;case"text":return Yi;case"file":return vo}}var rk="inline-flex h-[1.41em] max-w-full items-center gap-[0.33em] rounded-[0.5em] px-[0.5em] font-medium leading-none align-middle",ak=`${rk} border border-border/70 bg-accent/40 text-foreground`,RH=`${ak} text-[12px]`,Ci=`${ak} text-[0.86em] select-none`,Pp="relative inline-flex align-[-0.125em] leading-none data-[composer-chip-selected]:after:pointer-events-none data-[composer-chip-selected]:after:absolute data-[composer-chip-selected]:after:inset-0 data-[composer-chip-selected]:after:rounded-[6px] data-[composer-chip-selected]:after:bg-[Highlight] data-[composer-chip-selected]:after:opacity-30 data-[composer-chip-selected]:after:content-['']",aa="block size-[1.17em] shrink-0 self-center opacity-85 [&>svg]:block",ik="truncate leading-tight",ia="block self-center truncate leading-tight select-none",sk=`${rk} select-none border border-fuchsia-500/25 bg-fuchsia-500/12 text-[0.86em] text-fuchsia-700 dark:text-fuchsia-300`,lk='<svg width="100%" height="100%" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.85" stroke-linecap="round" stroke-linejoin="round"><path d="M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z"/><path d="m3.3 7 8.7 5 8.7-5"/><path d="M12 22V12"/></svg>',Ap="ml-[0.17em] inline-flex size-[1.17em] shrink-0 cursor-pointer items-center justify-center rounded-sm text-muted-foreground/72 transition-colors hover:bg-foreground/10 hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring";ue();var dk=bt(null),ck=dk.Provider;function Wt(){let e=Ht(dk);if(e===null)throw new Error("Composer API has not been provided.");return e}function MH(e,t,n){let o=[];o.push(t(e));let r=n(e);return r&&o.push(r),e.pageUrl&&o.push(e.pageUrl),e.selector&&o.push(e.selector),e.htmlPreview.trim().length>0&&(o.push(""),o.push(e.htmlPreview.trim().slice(0,600))),o.join(`
|
|
3771
|
+
`)}function NH({context:e,onRemove:t}){let{t:n}=Ce(),o=Wt().elementContext,r=o.formatLabel(e),a=o.formatSourceLabel(e);return b(Ye,{children:[u(Ze,{render:b("span",{className:$(Ci,"pr-1"),children:[u(ta,{className:$(aa,"size-icon-1")}),u("span",{className:ia,children:r}),a?u("span",{className:"select-none text-[10px] font-normal leading-tight text-muted-foreground/85",children:a}):null,u("button",{type:"button","aria-label":n("pendingContext.removeElement",{label:r}),className:Ap,onClick:i=>{i.preventDefault(),i.stopPropagation(),t(e.id)},children:u(Zt,{className:"size-3","aria-hidden":!0})})]})}),u(Je,{side:"top",className:"max-w-96 whitespace-pre-wrap leading-tight",children:MH(e,o.formatLabel,o.formatSourceLabel)})]})}function uk({contexts:e,onRemove:t,className:n}){return e.length===0?null:u("div",{className:$("flex flex-wrap gap-1.5",n),children:e.map(o=>u(NH,{context:o,onRemove:t},o.id))})}function fk({comments:e,onRemove:t,className:n}){let{t:o}=Ce();return e.length===0?null:u("div",{className:$("flex flex-wrap gap-1.5",n),children:e.map(r=>{let a=`${r.filePath} ${r.rangeLabel}`,i=b("span",{className:$(Ci,"pr-1"),children:[u(ts,{className:$(aa,"size-icon-1")}),u("span",{className:ia,children:a}),u("button",{type:"button","aria-label":o("pendingContext.removeReviewComment",{label:a}),className:Ap,onClick:s=>{s.preventDefault(),s.stopPropagation(),t(r.id)},children:u(Zt,{className:"size-3","aria-hidden":!0})})]},r.id);return r.text.length===0?i:b(Ye,{children:[u(Ze,{render:i}),u(Je,{side:"top",className:"max-w-96 whitespace-pre-wrap leading-tight",children:r.text})]},r.id)})})}function Ep(e){let{t}=Ce(),n=t(e.tooltipKey,{count:e.count});return b(Ye,{children:[u(Ze,{render:b("span",{className:"inline-flex items-center gap-1 text-[10px] font-medium text-muted-foreground",children:[e.icon,e.count]})}),u(Je,{side:"top",children:n})]})}function pk({annotations:e,images:t,onRemove:n,onExpandImage:o,uploadsByImageId:r,onRetryUpload:a,className:i}){let{t:s}=Ce(),l=Wt().elementContext;if(e.length===0)return null;let d=new Map(t.map(c=>[c.id,c]));return u("div",{className:$("flex flex-wrap gap-1.5",i),children:e.map(c=>{let f=d.get(c.id),p=f?r?.[f.id]:void 0,m=c.elements.flatMap(g=>{let h=l.normalizeSelection(g.element);return h?[{id:g.id,label:l.formatLabel(h)}]:[]});return b("section",{className:"group/preview-annotation relative flex min-w-0 max-w-full items-center overflow-hidden rounded-lg border border-border/80 bg-background/72",children:[f?.previewUrl?u("button",{type:"button","aria-label":s("previewAnnotation.previewImage",{name:f.name}),className:"size-14 shrink-0 cursor-zoom-in overflow-hidden border-r border-border/70 bg-muted",onClick:()=>o(f.id),children:u("img",{src:f.previewUrl,alt:s("previewAnnotation.cropAlt"),className:"size-full object-cover transition-transform duration-(--control-duration) group-hover/preview-annotation:scale-[1.03]"})}):u("span",{className:"grid size-10 shrink-0 place-items-center border-r border-border/70 text-message-action",children:u(ta,{className:"size-icon-2"})}),b("div",{className:"min-w-0 px-2.5 py-2 pr-8",children:[c.comment.trim()?u("p",{className:"max-w-80 truncate text-foreground text-xs font-medium",children:c.comment.trim()}):null,b("div",{className:$("flex min-w-0 items-center gap-2",c.comment.trim()&&"mt-1"),children:[m.length>0?b("div",{className:"flex min-w-0 items-center gap-1",children:[m.slice(0,2).map(({id:g,label:h})=>u("span",{className:"max-w-40 truncate font-mono text-secondary-label text-[10px]",children:h},g)),m.length>2?b("span",{className:"text-secondary-label text-[10px]",children:["+",m.length-2]}):null]}):null,b("div",{className:"flex shrink-0 items-center gap-2",children:[c.elements.length>0?u(Ep,{icon:u(ta,{className:"size-3"}),count:c.elements.length,tooltipKey:"previewAnnotation.elementCount"}):null,c.regions.length>0?u(Ep,{icon:u(Kd,{className:"size-3"}),count:c.regions.length,tooltipKey:"previewAnnotation.regionCount"}):null,c.strokes.length>0?u(Ep,{icon:u(na,{className:"size-3"}),count:c.strokes.length,tooltipKey:"previewAnnotation.drawingCount"}):null,c.styleChanges.length>0?u(Ep,{icon:u(os,{className:"size-3"}),count:c.styleChanges.length,tooltipKey:"previewAnnotation.styleChangeCount"}):null,p?.status==="uploading"?u("span",{className:"text-[10px] text-secondary-label",children:Lp(p.progress)}):null,p?.status==="failed"&&f&&a?b(Ye,{children:[u(Ze,{render:u(ce,{size:"icon-micro",variant:"ghost-muted","aria-label":s("attachments.retryUpload",{name:f.name}),onClick:()=>a(f)}),children:u(as,{className:"size-3"})}),u(Je,{side:"top",children:kp(p,s)})]}):null]})]})]}),u(ce,{size:"icon-micro",variant:"ghost-muted","aria-label":s("previewAnnotation.remove"),className:"absolute right-1.5 top-1.5 [--control-icon-color:currentColor] rounded text-icon-muted hover:bg-muted",onClick:()=>n(c.id),children:u(Zt,{className:"size-3"})})]},c.id)})})}ue();function mk(e,t){let n=t?.hasWideActions?780:620;return e!==null&&e<n}function gk(e,t){return t?.hasWideActions?e!==null&&e<780:!1}function hk(e,t){let n=Wt().pane.useVisible(),[o,r]=J(null);he(()=>{if(!n)return;let i=e.current;if(!i)return;let s=!0;if(typeof ResizeObserver<"u"){let c=new ResizeObserver(f=>{if(!s)return;let p=f.find(v=>v.target===i);if(!p)return;let m=window.getComputedStyle(i),g=Number.parseFloat(m.paddingLeft)||0,h=Number.parseFloat(m.paddingRight)||0;r(Math.round(p.contentRect.width+g+h))});return c.observe(i),()=>{s=!1,c.disconnect()}}let l=null,d=()=>{l===null&&(l=window.requestAnimationFrame(()=>{l=null,s&&r(i.clientWidth)}))};return d(),window.addEventListener("resize",d),()=>{s=!1,window.removeEventListener("resize",d),l!==null&&window.cancelAnimationFrame(l)}},[e,n]);let a=mk(o,{hasWideActions:t});return{isComposerFooterCompact:a,isComposerPrimaryActionsCompact:a&&gk(o,{hasWideActions:t})}}ue();function _H(e){let t=[];for(let n of e.split(/[\s:_-]+/))n.length!==0&&t.push(n.charAt(0).toUpperCase()+n.slice(1));return t.join(" ")}function DH(e){return e.replaceAll("\\","/")}function sa(e){let t=e.displayName?.trim();return t||_H(e.name)}function vk(e,t){return t?e.filter(n=>n.enabled):[]}function yk(e,t){let n=new Set(t.map(o=>o.name.trim().toLowerCase()));return e.filter(o=>!n.has(o.name.trim().toLowerCase()))}function xk(e){let t=DH(e.path);if(t.includes("/.codex/plugins/")||t.includes("/.agents/plugins/"))return"app";switch(e.scope?.trim().toLowerCase()){case"repo":case"repository":return"repo";case"project":case"workspace":case"local":return"project";case"user":case"personal":return"personal";case"system":return"system";case void 0:case"":return"other";default:return"other"}}ue();ue();var Rp=pe(function(t){let n=Wt().pierreIcons,o=n.useSpriteReady();Md(n.ensureSprite,[n]);let r=K(()=>n.resolveForEntry(t.pathValue,t.kind),[n,t.kind,t.pathValue]);return o?u("svg",{"aria-hidden":"true","data-file-icon":r.symbolId,className:$("size-4 shrink-0",t.className),children:u("use",{href:`#${r.symbolId}`})}):t.kind==="directory"?u(ai,{className:$("size-4 shrink-0 text-icon-muted",t.className)}):u($d,{className:$("size-4 shrink-0 text-icon-muted",t.className)})});var Ck={recent:"slashMenu.sections.recent",builtIn:"slashMenu.sections.builtIn",provider:"slashMenu.sections.provider",skills:"slashMenu.sections.skills"},bk=pe(function(t){let{t:n}=Ce(),o=N(null);return he(()=>{if(!t.activeItemId||!o.current)return;o.current.querySelector(`[data-composer-item-id="${CSS.escape(t.activeItemId)}"]`)?.scrollIntoView({block:"nearest"})},[t.activeItemId]),u(zf,{autoHighlight:!1,mode:"none",onItemHighlighted:r=>{t.onHighlightedItemChange(typeof r=="string"?r:null)},children:u("div",{ref:o,className:"chat-composer-drawer-surface chat-composer-drawer-attached relative w-full overflow-hidden **:data-[slot=scroll-area-scrollbar]:data-[orientation=vertical]:my-4","data-composer-command-drawer":"true",children:t.items.length>0?u($f,{className:"max-h-72 scroll-pb-6",children:u(Uf,{children:t.items.map((r,a)=>u(OH,{sectionTitle:r.section!==void 0&&t.items[a-1]?.section!==r.section?r.section:null,item:r,triggerKind:t.triggerKind,resolvedTheme:t.resolvedTheme,isActive:t.activeItemId===r.id,onHighlight:t.onHighlightedItemChange,onSelect:t.onSelect},r.id))})}):u("div",{className:"px-5 pt-3.5 pb-7",children:u("p",{className:"text-secondary-label text-xs",children:t.isLoading?t.triggerKind==="skill"?n("composer.searchingSkills"):n("composer.searchingFiles"):t.emptyStateText??(t.triggerKind==="skill"?n("composer.noSkillsFound"):t.triggerKind==="path"?n("composer.noMatchingFiles"):n("composer.noMatchingCommand"))})})})})}),OH=pe(function(t){let{t:n}=Ce(),o=t.item.type==="skill"?xk(t.item.skill):null,r=t.triggerKind==="slash-command"&&t.item.type==="skill"?t.item.skill:null;return b(Pe,{children:[t.sectionTitle!==null?u("div",{role:"presentation","data-composer-menu-section":t.sectionTitle,className:"px-3 pt-2 pb-1 text-xs text-secondary-label",children:n(Ck[t.sectionTitle]??Ck.recent)}):null,b(Hf,{value:t.item.id,"data-composer-item-id":t.item.id,className:$("cursor-pointer select-none gap-3 rounded-lg px-3 py-2! hover:bg-transparent hover:text-inherit data-highlighted:bg-transparent data-highlighted:text-inherit",t.isActive&&"bg-accent! text-accent-foreground!"),onMouseMove:()=>{t.isActive||t.onHighlight(t.item.id)},onMouseDown:a=>{a.preventDefault()},onClick:()=>{t.onSelect(t.item)},children:[t.item.type==="path"?u(Rp,{pathValue:t.item.path,kind:t.item.pathKind,theme:t.resolvedTheme}):null,b("span",{className:"flex min-w-0 flex-1 items-center gap-2",children:[u("span",{className:"min-w-0 max-w-[45%] shrink-0 truncate font-sans text-xs font-medium",children:r?b(Pe,{children:[u("span",{className:"text-secondary-label",children:"/skill:"}),sa(r)]}):t.item.label}),u("span",{className:"min-w-0 max-w-[48ch] flex-1 truncate text-left text-secondary-label text-xs",children:t.item.description}),o?u(zH,{kind:o,showSkillSuffix:t.triggerKind==="skill"}):null]})]})]})}),FH={app:Fd,repo:ai,project:ai,personal:oa,system:nc,other:Jd},BH={app:"slashMenu.skillSource.app",repo:"slashMenu.skillSource.repo",project:"slashMenu.skillSource.project",personal:"slashMenu.skillSource.personal",system:"slashMenu.skillSource.system",other:"slashMenu.skillSource.other"};function zH(e){let{t}=Ce(),n=FH[e.kind],o=t(BH[e.kind]);return b(vl,{className:"ms-auto",variant:"secondary",children:[u(n,{"aria-hidden":"true",className:"text-current"}),e.showSkillSuffix?t("slashMenu.skillSourceWithSuffix",{source:o}):o]})}var bv={};En(bv,{LexicalComposerContext:()=>wk,createLexicalComposerContext:()=>UH,useLexicalComposerContext:()=>HH});ue();var wk=bt(null);function UH(e,t){let n=null;return e!=null&&(n=e[1]),{getTheme:function(){return t??(n!=null?n.getTheme():null)}}}function HH(){let e=Ht(wk);return e==null&&(function(t,...n){let o=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",t);for(let a of n)r.append("v",a);throw o.search=r.toString(),Error(`Minified Lexical error #${t}; visit ${o.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)})(8),e}var wv=bv,Sk=wv.LexicalComposerContext,Ik=wv.createLexicalComposerContext,Cn=wv.useLexicalComposerContext;var Yy={};En(Yy,{$addUpdateTag:()=>hm,$applyNodeReplacement:()=>au,$caretFromPoint:()=>Ei,$caretRangeFromSelection:()=>dy,$cloneWithProperties:()=>Vy,$cloneWithPropertiesEphemeral:()=>IK,$comparePointCaretNext:()=>jy,$copyNode:()=>$y,$create:()=>kK,$createLineBreakNode:()=>Vl,$createNodeSelection:()=>Ly,$createParagraphNode:()=>Na,$createPoint:()=>_r,$createRangeSelection:()=>mP,$createRangeSelectionFromDom:()=>Z$,$createTabNode:()=>cm,$createTextNode:()=>Hn,$extendCaretToRange:()=>Wy,$findMatchingParent:()=>Uc,$getAdjacentChildCaret:()=>Jl,$getAdjacentNode:()=>_P,$getAdjacentSiblingOrParentSiblingCaret:()=>_K,$getCaretInDirection:()=>Ri,$getCaretRange:()=>Ai,$getCaretRangeInDirection:()=>Xy,$getCharacterOffsets:()=>ty,$getChildCaret:()=>Da,$getChildCaretAtIndex:()=>QP,$getChildCaretOrSelf:()=>VP,$getCollapsedCaretRange:()=>qP,$getCommonAncestor:()=>Hc,$getCommonAncestorResultBranchOrder:()=>Qy,$getEditor:()=>Ky,$getNearestNodeFromDOMNode:()=>gm,$getNearestRootOrShadowRoot:()=>FP,$getNodeByKey:()=>Fn,$getNodeByKeyOrThrow:()=>BP,$getNodeFromDOMNode:()=>Dy,$getPreviousSelection:()=>Ns,$getRoot:()=>jo,$getSelection:()=>Ot,$getSiblingCaret:()=>Wn,$getState:()=>Kp,$getStateChange:()=>x$,$getTextContent:()=>nK,$getTextNodeOffset:()=>Nr,$getTextPointCaret:()=>Pi,$getTextPointCaretSlice:()=>sy,$getWritableNodeState:()=>py,$hasAncestor:()=>rm,$hasUpdateTag:()=>xK,$insertNodes:()=>tK,$isBlockElementNode:()=>J$,$isChildCaret:()=>Mr,$isDecoratorNode:()=>en,$isEditorState:()=>iK,$isElementNode:()=>re,$isExtendableTextPointCaret:()=>jP,$isInlineElementOrDecoratorNode:()=>CK,$isLeafNode:()=>hK,$isLineBreakNode:()=>ks,$isNodeCaret:()=>AK,$isNodeSelection:()=>tu,$isParagraphNode:()=>bP,$isRangeSelection:()=>Ge,$isRootNode:()=>to,$isRootOrShadowRoot:()=>mr,$isSiblingCaret:()=>Ms,$isTabNode:()=>ky,$isTextNode:()=>ze,$isTextPointCaret:()=>_a,$isTextPointCaretSlice:()=>NK,$isTokenOrSegmented:()=>Ea,$isTokenOrTab:()=>Si,$nodesOfType:()=>yK,$normalizeCaret:()=>Er,$normalizeSelection__EXPERIMENTAL:()=>Vp,$onUpdate:()=>OP,$parseSerializedNode:()=>aK,$removeTextFromCaretRange:()=>GP,$rewindSiblingCaret:()=>nd,$selectAll:()=>vK,$setCompositionKey:()=>Kn,$setPointFromCaret:()=>Zl,$setSelection:()=>_o,$setSelectionFromCaretRange:()=>WP,$setState:()=>C$,$splitAtPointCaretNext:()=>FK,$splitNode:()=>bK,$updateRangeSelectionFromCaretRange:()=>$c,ArtificialNode__DO_NOT_USE:()=>nm,BEFORE_INPUT_COMMAND:()=>gy,BLUR_COMMAND:()=>GL,CAN_REDO_COMMAND:()=>M$,CAN_UNDO_COMMAND:()=>N$,CLEAR_EDITOR_COMMAND:()=>E$,CLEAR_HISTORY_COMMAND:()=>R$,CLICK_COMMAND:()=>EL,COLLABORATION_TAG:()=>rP,COMMAND_PRIORITY_CRITICAL:()=>uK,COMMAND_PRIORITY_EDITOR:()=>Bl,COMMAND_PRIORITY_HIGH:()=>cK,COMMAND_PRIORITY_LOW:()=>lK,COMMAND_PRIORITY_NORMAL:()=>dK,COMPOSITION_END_COMMAND:()=>yy,COMPOSITION_END_TAG:()=>lP,COMPOSITION_START_COMMAND:()=>vy,COMPOSITION_START_TAG:()=>sP,CONTROLLED_TEXT_INSERTION_COMMAND:()=>Ul,COPY_COMMAND:()=>Sy,CUT_COMMAND:()=>Iy,DELETE_CHARACTER_COMMAND:()=>Wc,DELETE_LINE_COMMAND:()=>jc,DELETE_WORD_COMMAND:()=>Gc,DRAGEND_COMMAND:()=>qL,DRAGOVER_COMMAND:()=>VL,DRAGSTART_COMMAND:()=>KL,DROP_COMMAND:()=>$L,DecoratorNode:()=>Xc,ElementNode:()=>ki,FOCUS_COMMAND:()=>WL,FORMAT_ELEMENT_COMMAND:()=>A$,FORMAT_TEXT_COMMAND:()=>bi,HISTORIC_TAG:()=>H$,HISTORY_MERGE_TAG:()=>Up,HISTORY_PUSH_TAG:()=>$$,INDENT_CONTENT_COMMAND:()=>L$,INPUT_COMMAND:()=>hy,INSERT_LINE_BREAK_COMMAND:()=>Fc,INSERT_PARAGRAPH_COMMAND:()=>qv,INSERT_TAB_COMMAND:()=>k$,INTERNAL_$isBlock:()=>Ma,IS_ALL_FORMATTING:()=>e$,IS_BOLD:()=>GH,IS_CODE:()=>YH,IS_HIGHLIGHT:()=>cy,IS_ITALIC:()=>jH,IS_STRIKETHROUGH:()=>QH,IS_SUBSCRIPT:()=>JH,IS_SUPERSCRIPT:()=>ZH,IS_UNDERLINE:()=>XH,KEY_ARROW_DOWN_COMMAND:()=>OL,KEY_ARROW_LEFT_COMMAND:()=>NL,KEY_ARROW_RIGHT_COMMAND:()=>RL,KEY_ARROW_UP_COMMAND:()=>DL,KEY_BACKSPACE_COMMAND:()=>BL,KEY_DELETE_COMMAND:()=>UL,KEY_DOWN_COMMAND:()=>wy,KEY_ENTER_COMMAND:()=>Qp,KEY_ESCAPE_COMMAND:()=>zL,KEY_MODIFIER_COMMAND:()=>jL,KEY_SPACE_COMMAND:()=>FL,KEY_TAB_COMMAND:()=>HL,LineBreakNode:()=>Kl,MOVE_TO_END:()=>ML,MOVE_TO_START:()=>_L,NODE_STATE_KEY:()=>p$,OUTDENT_CONTENT_COMMAND:()=>P$,PASTE_COMMAND:()=>xy,PASTE_TAG:()=>K$,ParagraphNode:()=>Gl,REDO_COMMAND:()=>by,REMOVE_TEXT_COMMAND:()=>Wv,RootNode:()=>Wl,SELECTION_CHANGE_COMMAND:()=>my,SELECTION_INSERT_CLIPBOARD_NODES_COMMAND:()=>T$,SELECT_ALL_COMMAND:()=>Gv,SKIP_COLLAB_TAG:()=>V$,SKIP_DOM_SELECTION_TAG:()=>iP,SKIP_SCROLL_INTO_VIEW_TAG:()=>aP,SKIP_SELECTION_FOCUS_TAG:()=>Zv,TEXT_TYPE_TO_FORMAT:()=>lo,TabNode:()=>ql,TextNode:()=>As,UNDO_COMMAND:()=>Cy,addClassNamesToElement:()=>KK,buildImportMap:()=>U$,configExtension:()=>zK,createCommand:()=>tt,createEditor:()=>fK,createSharedNodeState:()=>IL,createState:()=>y$,declarePeerDependency:()=>UK,defineExtension:()=>BK,flipDirection:()=>Mi,getDOMOwnerDocument:()=>Uy,getDOMSelection:()=>Or,getDOMSelectionFromTarget:()=>zP,getDOMTextNode:()=>Rs,getEditorPropertyFromDOMNode:()=>ou,getNearestEditorFromDOMNode:()=>_y,getRegisteredNode:()=>My,getRegisteredNodeOrThrow:()=>Ry,getStaticNodeConfig:()=>iu,getTextDirection:()=>gK,getTransformSetFromKlass:()=>SP,isBlockDomNode:()=>ay,isCurrentlyReadOnlyMode:()=>ed,isDOMDocumentNode:()=>kP,isDOMNode:()=>td,isDOMTextNode:()=>ca,isDOMUnmanaged:()=>KP,isDocumentFragment:()=>UP,isExactShortcutMatch:()=>$t,isHTMLAnchorElement:()=>wK,isHTMLElement:()=>So,isInlineDomNode:()=>HP,isLexicalEditor:()=>pm,isModifierMatch:()=>NP,isSelectionCapturedInDecoratorInput:()=>Ny,isSelectionWithinEditor:()=>nu,makeStepwiseIterator:()=>Gy,mergeRegister:()=>qK,normalizeClassNames:()=>su,removeClassNamesFromElement:()=>VK,removeFromParent:()=>Ii,resetRandomKey:()=>pK,safeCast:()=>HK,setDOMUnmanaged:()=>TK,setNodeIndentFromDOM:()=>$P,shallowMergeConfig:()=>$K,toggleTextFormatType:()=>Jc});function de(e,...t){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(let r of t)o.append("v",r);throw n.search=o.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 hL(e,...t){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(let r of t)o.append("v",r);n.search=o.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.`)}var Dr=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,$H=Dr&&"documentMode"in document?document.documentMode:null,Ar=Dr&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Ti=Dr&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),$p=!(!Dr||!("InputEvent"in window)||$H)&&"getTargetRanges"in new window.InputEvent("input"),im=Dr&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),eu=Dr&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,KH=Dr&&/Android/.test(navigator.userAgent),vL=Dr&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Nv=Dr&&KH&&vL,sm=Dr&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&Ar&&!vL,VH=0,qH=1,WH=2,GH=1,jH=2,QH=4,XH=8,YH=16,JH=32,ZH=64,cy=128,e$=2047,t$=1,n$=2,o$=3,r$=4,a$=5,i$=6,Kc=im||eu||sm?"\xA0":"\u200B",lm=`
|
|
3772
3772
|
|
|
3773
|
-
`,fy=ki?"\xA0":Vc,hL="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",vL="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",a$=new RegExp("^[^"+vL+"]*["+hL+"]"),i$=new RegExp("^[^"+hL+"]*["+vL+"]"),lo={bold:1,capitalize:1024,code:16,highlight:uy,italic:2,lowercase:256,strikethrough:4,subscript:32,superscript:64,underline:8,uppercase:512},s$={directionless:1,unmergeable:2},Dv={center:2,end:6,justify:4,left:1,right:3,start:5},l$={[e$]:"center",[r$]:"end",[n$]:"justify",[ZH]:"left",[t$]:"right",[o$]:"start"},d$={normal:0,segmented:2,token:1},c$={[$H]:"normal",[VH]:"segmented",[KH]:"token"},u$="$",Sk="$config";function yL(e,t,n,o,r,a){let i=e.getFirstChild();for(;i!==null;){let s=i.__key;i.__parent===t&&(re(i)&&yL(i,s,n,o,r,a),n.has(s)||a.delete(s),r.push(s)),i=i.getNextSibling()}}var Ov=!1,py=0;function f$(e){py=e.timeStamp}function Iv(e,t,n){let o=e.nodeName==="BR",r=t.__lexicalLineBreak;return r&&(e===r||o&&e.previousSibling===r)||o&&gm(e,n)!==void 0}function p$(e,t,n){let o=Fr(Xo(n)),r=null,a=null;o!==null&&o.anchorNode===e&&(r=o.anchorOffset,a=o.focusOffset);let i=e.nodeValue;i!==null&&zy(t,i,r,a,!1)}function m$(e,t,n){if(Ge(e)){let o=e.anchor.getNode();if(o.is(n)&&e.format!==o.getFormat())return!1}return ca(t)&&n.isAttached()}function g$(e,t,n,o){for(let r=e;r&&!HP(r);r=au(r)){let a=gm(r,t);if(a!==void 0){let i=Fn(a,n);if(i)return tn(i)||!So(r)?void 0:[r,i]}else if(r===o)return[o,LP(n)]}}function xL(e,t,n){Ov=!0;let o=performance.now()-py>100;try{da(e,()=>{let r=Ft()||(function(p){return p.getEditorState().read(()=>{let m=Ft();return m!==null?m.clone():null})})(e),a=new Map,i=e.getRootElement(),s=e._editorState,l=e._blockCursorElement,d=!1,c="";for(let p=0;p<t.length;p++){let m=t[p],g=m.type,h=m.target,v=g$(h,e,s,i);if(!v)continue;let[y,x]=v;if(g==="characterData")o&&ze(x)&&ca(h)&&m$(r,h,x)&&p$(h,x,e);else if(g==="childList"){d=!0;let C=m.addedNodes;for(let S=0;S<C.length;S++){let k=C[S],I=Oy(k),T=k.parentNode;if(T!=null&&k!==l&&I===null&&!Iv(k,T,e)){if(ki){let A=(So(k)?k.innerText:null)||k.nodeValue;A&&(c+=A)}T.removeChild(k)}}let w=m.removedNodes,L=w.length;if(L>0){let S=0;for(let k=0;k<L;k++){let I=w[k];(Iv(I,h,e)||l===I)&&(h.appendChild(I),S++)}L!==S&&a.set(y,x)}}}if(a.size>0)for(let[p,m]of a)m.reconcileObservedMutation(p,e);let f=n.takeRecords();if(f.length>0){for(let p=0;p<f.length;p++){let m=f[p],g=m.addedNodes,h=m.target;for(let v=0;v<g.length;v++){let y=g[v],x=y.parentNode;x==null||y.nodeName!=="BR"||Iv(y,h,e)||x.removeChild(y)}}n.takeRecords()}r!==null&&(d&&_o(r),ki&&NP(e)&&r.insertRawText(c))})}finally{Ov=!1}}function CL(e){let t=e._observer;t!==null&&xL(e,t.takeRecords(),t)}function bL(e){(function(t){py===0&&Xo(t).addEventListener("textInput",f$,!0)})(e),e._observer=new MutationObserver((t,n)=>{xL(e,t,n)})}var Fv=class{key;parse;unparse;isEqual;defaultValue;constructor(t,n){this.key=t,this.parse=n.parse.bind(n),this.unparse=(n.unparse||x$).bind(n),this.isEqual=(n.isEqual||Object.is).bind(n),this.defaultValue=this.parse(void 0)}};function h$(e,t){return new Fv(e,t)}function Vp(e,t,n="latest"){let o=(n==="latest"?e.getLatest():e).__state;return o?o.getValue(t):t.defaultValue}function v$(e,t,n){let o=Vp(e,n,"direct"),r=Vp(t,n,"direct");return n.isEqual(o,r)?null:[o,r]}function y$(e,t,n){let o;if($n(),typeof n=="function"){let a=e.getLatest(),i=Vp(a,t);if(o=n(i),t.isEqual(i,o))return a}else o=n;let r=e.getWritable();return my(r).updateFromKnown(t,o),r}function wL(e){let t=new Map,n=new Set;for(let o=typeof e=="function"?e:e.replace;o.prototype&&o.prototype.getType!==void 0;o=Object.getPrototypeOf(o)){let{ownNodeConfig:r}=su(o);if(r&&r.stateConfigs)for(let a of r.stateConfigs){let i;"stateConfig"in a?(i=a.stateConfig,a.flat&&n.add(i.key)):i=a,t.set(i.key,i)}}return{flatKeys:n,sharedConfigMap:t}}var Bv=class e{node;knownState;unknownState;sharedNodeState;size;constructor(t,n,o=void 0,r=new Map,a=void 0){this.node=t,this.sharedNodeState=n,this.unknownState=o,this.knownState=r;let{sharedConfigMap:i}=this.sharedNodeState,s=a!==void 0?a:(function(l,d,c){let f=c.size;if(d)for(let p in d){let m=l.get(p);m&&c.has(m)||f++}return f})(i,o,r);this.size=s}getValue(t){let n=this.knownState.get(t);if(n!==void 0)return n;this.sharedNodeState.sharedConfigMap.set(t.key,t);let o=t.defaultValue;if(this.unknownState&&t.key in this.unknownState){let r=this.unknownState[t.key];r!==void 0&&(o=t.parse(r)),this.updateFromKnown(t,o)}return o}getInternalState(){return[this.unknownState,this.knownState]}toJSON(){let t={...this.unknownState},n={};for(let[o,r]of this.knownState)o.isEqual(r,o.defaultValue)?delete t[o.key]:t[o.key]=o.unparse(r);for(let o of this.sharedNodeState.flatKeys)o in t&&(n[o]=t[o],delete t[o]);return Ik(t)&&(n.$=t),n}getWritable(t){if(this.node===t)return this;let{sharedNodeState:n,unknownState:o}=this,r=new Map(this.knownState);return new e(t,n,(function(a,i,s){let l;if(s)for(let[d,c]of Object.entries(s)){let f=a.get(d);f?i.has(f)||i.set(f,f.parse(c)):(l=l||{},l[d]=c)}return l})(n.sharedConfigMap,r,o),r,this.size)}updateFromKnown(t,n){let o=t.key;this.sharedNodeState.sharedConfigMap.set(o,t);let{knownState:r,unknownState:a}=this;r.has(t)||a&&o in a||(a&&(delete a[o],this.unknownState=Ik(a)),this.size++),r.set(t,n)}updateFromUnknown(t,n){let o=this.sharedNodeState.sharedConfigMap.get(t);o?this.updateFromKnown(o,o.parse(n)):(this.unknownState=this.unknownState||{},t in this.unknownState||this.size++,this.unknownState[t]=n)}updateFromJSON(t){let{knownState:n}=this;for(let o of n.keys())n.set(o,o.defaultValue);if(this.size=n.size,this.unknownState=void 0,t)for(let[o,r]of Object.entries(t))this.updateFromUnknown(o,r)}};function my(e){let t=e.getWritable(),n=t.__state?t.__state.getWritable(t):new Bv(t,SL(t));return t.__state=n,n}function SL(e){return e.__state?e.__state.sharedNodeState:My(Vy(),e.getType()).sharedNodeState}function Ik(e){if(e)for(let t in e)return e}function x$(e){return e}function Tk(e,t,n){for(let[o,r]of t.knownState){if(e.has(o.key))continue;e.add(o.key);let a=n?n.getValue(o):o.defaultValue;if(a!==r&&!o.isEqual(a,r))return!0}return!1}function kk(e,t,n){let{unknownState:o}=t,r=n?n.unknownState:void 0;if(o){for(let[a,i]of Object.entries(o))if(!e.has(a)&&(e.add(a),i!==(r?r[a]:void 0)))return!0}return!1}function Lk(e,t){let n=e.__state;return n&&n.node===e?n.getWritable(t):n}function Pk(e,t){let n=e.__mode,o=e.__format,r=e.__style,a=t.__mode,i=t.__format,s=t.__style,l=e.__state,d=t.__state;return(n===null||n===a)&&(o===null||o===i)&&(r===null||r===s)&&(e.__state===null||l===d||(function(c,f){if(c===f)return!0;if(c&&f&&c.size!==f.size)return!1;let p=new Set;return!(c&&Tk(p,c,f)||f&&Tk(p,f,c)||c&&kk(p,c,f)||f&&kk(p,f,c))})(l,d))}function Ak(e,t){let n=e.mergeWithSibling(t),o=Yt()._normalizedNodes;return o.add(e.__key),o.add(t.__key),n}function Ek(e){let t,n,o=e;if(o.__text!==""||!o.isSimpleText()||o.isUnmergeable()){for(;(t=o.getPreviousSibling())!==null&&ze(t)&&t.isSimpleText()&&!t.isUnmergeable();){if(t.__text!==""){if(Pk(t,o)){o=Ak(t,o);break}break}t.remove()}for(;(n=o.getNextSibling())!==null&&ze(n)&&n.isSimpleText()&&!n.isUnmergeable();){if(n.__text!==""){if(Pk(o,n)){o=Ak(o,n);break}break}n.remove()}}else o.remove()}function qp(e){return Rk(e.anchor),Rk(e.focus),e}function Rk(e){for(;e.type==="element";){let t=e.getNode(),n=e.offset,o,r;if(n===t.getChildrenSize()?(o=t.getChildAtIndex(n-1),r=!0):(o=t.getChildAtIndex(n),r=!1),ze(o)){e.set(o.__key,r?o.getTextContentSize():0,"text",!0);break}if(!re(o))break;e.set(o.__key,r?o.getChildrenSize():0,"element",!0)}}var As,no,qc,cm,zv,Uv,Es,Mr,Hv,Wc,On="",la=null,ks=null,Fl=!1,Wp=!1;function Gp(e,t){let n=Es.get(e);if(t!==null){let o=qv(e);o.parentNode===t&&t.removeChild(o)}if(Mr.has(e)||no._keyToDOMMap.delete(e),re(n)){let o=Qp(n,Es);$v(o,0,o.length-1,null)}n!==void 0&&Uy(Wc,qc,cm,n,"destroyed")}function $v(e,t,n,o){for(let r=t;r<=n;++r){let a=e[r];a!==void 0&&Gp(a,o)}}function Ts(e,t){e.setProperty("text-align",t)}var C$="40px";function IL(e,t){let n=As.theme.indent;if(typeof n=="string"){let r=e.classList.contains(n);t>0&&!r?e.classList.add(n):t<1&&r&&e.classList.remove(n)}if(t===0)return void e.style.setProperty("padding-inline-start","");let o=getComputedStyle(no._rootElement||e).getPropertyValue("--lexical-indent-base-value")||C$;e.style.setProperty("padding-inline-start",`calc(${t} * ${o})`)}function TL(e,t){let n=e.style;t===0?Ts(n,""):t===1?Ts(n,"left"):t===2?Ts(n,"center"):t===3?Ts(n,"right"):t===4?Ts(n,"justify"):t===5?Ts(n,"start"):t===6&&Ts(n,"end")}function Kv(e,t){let n=(function(o){let r=o.__dir;if(r!==null)return r;if(to(o))return null;let a=o.getParentOrThrow();return to(a)&&a.__dir===null?"auto":null})(t);n!==null?e.dir=n:e.removeAttribute("dir")}function jp(e,t){let n=Mr.get(e);n===void 0&&de(60);let o=n.createDOM(As,no);if((function(r,a,i){let s=i._keyToDOMMap;(function(l,d,c){let f=`__lexicalKey_${d._key}`;l[f]=c})(a,i,r),s.set(r,a)})(e,o,no),ze(n)?o.setAttribute("data-lexical-text","true"):tn(n)&&o.setAttribute("data-lexical-decorator","true"),re(n)){let r=n.__indent,a=n.__size;if(Kv(o,n),r!==0&&IL(o,r),a!==0){let s=a-1;Vv(Qp(n,Mr),n,0,s,n.getDOMSlot(o))}let i=n.__format;i!==0&&TL(o,i),n.isInline()||kL(null,n,o)}else{let r=n.getTextContent();if(tn(n)){let a=n.decorate(no,As);a!==null&&LL(e,a),o.contentEditable="false"}On+=r}return t!==null&&t.insertChild(o),Uy(Wc,qc,cm,n,"created"),o}function Vv(e,t,n,o,r){let a=On;On="";let i=n;for(;i<=o;++i){jp(e[i],r);let s=Mr.get(e[i]);s!==null&&ze(s)?la===null&&(la=s.getFormat(),ks=s.getStyle()):re(s)&&i<o&&!s.isInline()&&(On+=dm)}r.element.__lexicalTextContent=On,On=a+On}function Mk(e,t){if(e){let n=e.__last;if(n){let o=t.get(n);if(o)return Ps(o)?"line-break":tn(o)&&o.isInline()?"decorator":null}return"empty"}return null}function kL(e,t,n){let o=Mk(e,Es),r=Mk(t,Mr);o!==r&&t.getDOMSlot(n).setManagedLineBreak(r)}function b$(e,t,n){var o;la=null,ks=null,(function(r,a,i){let s=On,l=r.__size,d=a.__size;On="";let c=i.element;if(l===1&&d===1){let f=r.__first,p=a.__first;if(f===p)Fp(f,c);else{let g=qv(f),h=jp(p,null);try{c.replaceChild(h,g)}catch(v){if(typeof v=="object"&&v!=null){let y=`${v.toString()} Parent: ${c.tagName}, new child: {tag: ${h.tagName} key: ${p}}, old child: {tag: ${g.tagName}, key: ${f}}.`;throw new Error(y)}throw v}Gp(f,null)}let m=Mr.get(p);ze(m)&&la===null&&(la=m.getFormat(),ks=m.getStyle())}else{let f=Qp(r,Es),p=Qp(a,Mr);if(f.length!==l&&de(227),p.length!==d&&de(228),l===0)d!==0&&Vv(p,0,0,d-1,i);else if(d===0){if(l!==0){let m=i.after==null&&i.before==null&&i.element.__lexicalLineBreak==null;$v(f,0,l-1,m?null:c),m&&(c.textContent="")}}else(function(m,g,h,v,y,x){let C=v-1,w=y-1,L,S,k=x.getFirstChild(),I=0,T=0;for(;I<=C&&T<=w;){let _=g[I],E=h[T];if(_===E)k=Tv(Fp(E,x.element)),I++,T++;else{if(S===void 0&&(S=Nk(h,T)),L===void 0)L=Nk(g,I);else if(!L.has(_)){I++;continue}if(!S.has(_)){k=Tv(qv(_)),Gp(_,x.element),I++,L.delete(_);continue}if(L.has(E)){let B=Ql(no,E);B!==k&&x.withBefore(k).insertChild(B),k=Tv(Fp(E,x.element)),I++,T++}else jp(E,x.withBefore(k)),T++}let F=Mr.get(E);F!==null&&ze(F)?la===null&&(la=F.getFormat(),ks=F.getStyle()):re(F)&&T<=w&&!F.isInline()&&(On+=dm)}let A=I>C,P=T>w;if(A&&!P){let _=h[w+1],E=_===void 0?null:no.getElementByKey(_);Vv(h,0,T,w,x.withBefore(E))}else P&&!A&&$v(g,I,C,x.element)})(0,f,p,l,d,i)}c.__lexicalTextContent=On,On=s+On})(e,t,t.getDOMSlot(n)),o=t,la==null||la===o.__textFormat||Wp||o.setTextFormat(la),(function(r){ks==null||ks===r.__textStyle||Wp||r.setTextStyle(ks)})(t)}function Qp(e,t){let n=[],o=e.__first;for(;o!==null;){let r=t.get(o);r===void 0&&de(101),n.push(o),o=r.__next}return n}function Fp(e,t){let n=Es.get(e),o=Mr.get(e);n!==void 0&&o!==void 0||de(61);let r=Fl||Uv.has(e)||zv.has(e),a=Ql(no,e);if(n===o&&!r){let i;if(re(n)){let s=a.__lexicalTextContent;typeof s=="string"?i=s:(i=n.getTextContent(),a.__lexicalTextContent=i)}else i=n.getTextContent();return On+=i,a}if(n!==o&&r&&Uy(Wc,qc,cm,o,"updated"),o.updateDOM(n,a,As)){let i=jp(e,null);return t===null&&de(62),t.replaceChild(i,a),Gp(e,null),i}if(re(n)){re(o)||de(334,e);let i=o.__indent;(Fl||i!==n.__indent)&&IL(a,i);let s=o.__format;if((Fl||s!==n.__format)&&TL(a,s),r)b$(n,o,a),to(o)||o.isInline()||kL(n,o,a);else{let l=a.__lexicalTextContent,d;typeof l=="string"?d=l:(d=n.getTextContent(),a.__lexicalTextContent=d),On+=d}if((Fl||o.__dir!==n.__dir)&&(Kv(a,o),to(o)&&!Fl))for(let l of o.getChildren())re(l)&&Kv(Ql(no,l.getKey()),l)}else{let i=o.getTextContent();if(tn(o)){let s=o.decorate(no,As);s!==null&&LL(e,s)}On+=i}if(!Wp&&to(o)&&o.__cachedText!==On){let i=o.getWritable();i.__cachedText=On,o=i}return a}function LL(e,t){let n=no._pendingDecorators,o=no._decorators;if(n===null){if(o[e]===t)return;n=kP(no)}n[e]=t}function Tv(e){let t=e.nextSibling;return t!==null&&t===no._blockCursorElement&&(t=t.nextSibling),t}function Nk(e,t){let n=new Set;for(let o=t;o<e.length;o++)n.add(e[o]);return n}function w$(e,t,n,o,r,a){On="",Fl=o===2,no=n,As=n._config,qc=n._nodes,cm=no._listeners.mutation,zv=r,Uv=a,Es=e._nodeMap,Mr=t._nodeMap,Wp=t._readOnly,Hv=new Map(n._keyToDOMMap);let i=new Map;return Wc=i,Fp("root",null),no=void 0,qc=void 0,zv=void 0,Uv=void 0,Es=void 0,Mr=void 0,As=void 0,Hv=void 0,Wc=void 0,i}function qv(e){let t=Hv.get(e);return t===void 0&&de(75,e),t}function tt(e){return{type:e}}var gy=tt("SELECTION_CHANGE_COMMAND"),S$=tt("SELECTION_INSERT_CLIPBOARD_NODES_COMMAND"),PL=tt("CLICK_COMMAND"),hy=tt("BEFORE_INPUT_COMMAND"),vy=tt("INPUT_COMMAND"),yy=tt("COMPOSITION_START_COMMAND"),xy=tt("COMPOSITION_END_COMMAND"),Gc=tt("DELETE_CHARACTER_COMMAND"),Bc=tt("INSERT_LINE_BREAK_COMMAND"),Wv=tt("INSERT_PARAGRAPH_COMMAND"),Hl=tt("CONTROLLED_TEXT_INSERTION_COMMAND"),Cy=tt("PASTE_COMMAND"),Gv=tt("REMOVE_TEXT_COMMAND"),jc=tt("DELETE_WORD_COMMAND"),Qc=tt("DELETE_LINE_COMMAND"),wi=tt("FORMAT_TEXT_COMMAND"),by=tt("UNDO_COMMAND"),wy=tt("REDO_COMMAND"),Sy=tt("KEYDOWN_COMMAND"),AL=tt("KEY_ARROW_RIGHT_COMMAND"),EL=tt("MOVE_TO_END"),RL=tt("KEY_ARROW_LEFT_COMMAND"),ML=tt("MOVE_TO_START"),NL=tt("KEY_ARROW_UP_COMMAND"),_L=tt("KEY_ARROW_DOWN_COMMAND"),Xp=tt("KEY_ENTER_COMMAND"),DL=tt("KEY_SPACE_COMMAND"),OL=tt("KEY_BACKSPACE_COMMAND"),FL=tt("KEY_ESCAPE_COMMAND"),BL=tt("KEY_DELETE_COMMAND"),zL=tt("KEY_TAB_COMMAND"),I$=tt("INSERT_TAB_COMMAND"),T$=tt("INDENT_CONTENT_COMMAND"),k$=tt("OUTDENT_CONTENT_COMMAND"),UL=tt("DROP_COMMAND"),L$=tt("FORMAT_ELEMENT_COMMAND"),HL=tt("DRAGSTART_COMMAND"),$L=tt("DRAGOVER_COMMAND"),KL=tt("DRAGEND_COMMAND"),Iy=tt("COPY_COMMAND"),Ty=tt("CUT_COMMAND"),jv=tt("SELECT_ALL_COMMAND"),P$=tt("CLEAR_EDITOR_COMMAND"),A$=tt("CLEAR_HISTORY_COMMAND"),E$=tt("CAN_REDO_COMMAND"),R$=tt("CAN_UNDO_COMMAND"),VL=tt("FOCUS_COMMAND"),qL=tt("BLUR_COMMAND"),WL=tt("KEY_MODIFIER_COMMAND"),Pa=Object.freeze({}),Qv=[["keydown",function(e,t){Xc=e.timeStamp,GL=e.key,!t.isComposing()&&Re(t,Sy,e)}],["pointerdown",function(e,t){let n=e.target,o=e.pointerType;nd(n)&&o!=="touch"&&o!=="pen"&&e.button===0&&da(t,()=>{SP(n)||(Jv=!0)})}],["compositionstart",function(e,t){Re(t,yy,e)}],["compositionend",function(e,t){ki?Fc=!0:tu||!sm&&!lm?Re(t,xy,e):(Bp=!0,zp=e.data)}],["input",function(e,t){e.stopPropagation(),da(t,()=>{t.dispatchCommand(vy,e)},{event:e}),Bl=null}],["click",function(e,t){da(t,()=>{let n=Ft(),o=Fr(Xo(t)),r=Ds();if(o){if(Ge(n)){let a=n.anchor,i=a.getNode();if(a.type==="element"&&a.offset===0&&n.isCollapsed()&&!to(i)&&Qo().getChildrenSize()===1&&i.getTopLevelElementOrThrow().isEmpty()&&r!==null&&n.is(r))o.removeAllRanges(),n.dirty=!0;else if(e.detail===3&&!n.isCollapsed()&&i!==n.focus.getNode()){let s=Hc(i,l=>re(l)&&!l.isInline());re(s)&&s.select(0)}}else if(e.pointerType==="touch"||e.pointerType==="pen"){let a=o.anchorNode;(So(a)||ca(a))&&_o(fm(r,o,t,e))}}Re(t,PL,e)})}],["cut",Pa],["copy",Pa],["dragstart",Pa],["dragover",Pa],["dragend",Pa],["paste",Pa],["focus",Pa],["blur",Pa],["drop",Pa]];Kp&&Qv.push(["beforeinput",(e,t)=>(function(n,o){let r=n.inputType;r==="deleteCompositionText"||ki&&NP(o)||r!=="insertCompositionText"&&Re(o,hy,n)})(e,t)]);var Xc=0,GL=null,jL=0,Bl=null,Xv=new WeakMap,Yp=new WeakMap,Yv=!1,Jv=!1,zc=!1,Fc=!1,Bp=!1,zp="",Ls=null,QL=[0,"",0,"root",0];function XL(e,t,n,o,r){let a=e.anchor,i=e.focus,s=a.getNode(),l=Yt(),d=Fr(Xo(l)),c=d!==null?d.anchorNode:null,f=a.key,p=l.getElementByKey(f),m=n.length;return f!==i.key||!ze(s)||(!r&&(!Kp||jL<o+50)||s.isDirty()&&m<2||PP(n))&&a.offset!==i.offset&&!s.isComposing()||Ra(s)||s.isDirty()&&m>1||(r||!Kp)&&p!==null&&!s.isComposing()&&c!==Ns(p)||d!==null&&t!==null&&(!t.collapsed||t.startContainer!==d.anchorNode||t.startOffset!==d.anchorOffset)||!s.isComposing()&&(s.getFormat()!==e.format||s.getStyle()!==e.style)||(function(g,h){if(h.isSegmented())return!0;if(!g.isCollapsed())return!1;let v=g.anchor.offset,y=h.getParentOrThrow(),x=Ii(h);return v===0?!h.canInsertTextBefore()||!y.canInsertTextBefore()&&!h.isComposing()||x||(function(C){let w=C.getPreviousSibling();return(ze(w)||re(w)&&w.isInline())&&!w.canInsertTextAfter()})(h):v===h.getTextContentSize()&&(!h.canInsertTextAfter()||!y.canInsertTextAfter()&&!h.isComposing()||x)})(e,s)}function _k(e,t){return ca(e)&&e.nodeValue!==null&&t!==0&&t!==e.nodeValue.length}function Dk(e,t,n){let{anchorNode:o,anchorOffset:r,focusNode:a,focusOffset:i}=e;Yv&&(Yv=!1,_k(o,r)&&_k(a,i)&&!Ls)||da(t,()=>{if(!n)return void _o(null);if(!ou(t,o,a))return;let s=Ft();if(Ls&&Ge(s)&&s.isCollapsed()){let l=s.anchor,d=Ls.anchor;(l.key===d.key&&l.offset===d.offset+1||l.offset===1&&d.getNode().is(l.getNode().getPreviousSibling()))&&(s=Ls.clone(),_o(s))}if(Ls=null,Ge(s)){let l=s.anchor,d=l.getNode();if(s.isCollapsed()){e.type==="Range"&&e.anchorNode===e.focusNode&&(s.dirty=!0);let c=Xo(t).event,f=c?c.timeStamp:performance.now(),[p,m,g,h,v]=QL,y=Qo(),x=t.isComposing()===!1&&y.getTextContent()==="";if(f<v+200&&l.offset===g&&l.key===h)Up(s,p,m);else if(l.type==="text")ze(d)||de(141),YL(s,d);else if(l.type==="element"&&!x){re(d)||de(259);let C=l.getNode();C.isEmpty()?(function(w,L){let S=L.getTextFormat(),k=L.getTextStyle();Up(w,S,k)})(s,C):Up(s,0,"")}}else{let c=l.key,f=s.focus.key,p=s.getNodes(),m=p.length,g=s.isBackward(),h=g?i:r,v=g?r:i,y=g?f:c,x=g?c:f,C=2047,w=!1;for(let L=0;L<m;L++){let S=p[L],k=S.getTextContentSize();if(ze(S)&&k!==0&&!(L===0&&S.__key===y&&h===k||L===m-1&&S.__key===x&&v===0)&&(w=!0,C&=S.getFormat(),C===0))break}s.format=w?C:0}}Re(t,gy,void 0)})}function Up(e,t,n){e.format===t&&e.style===n||(e.format=t,e.style=n,e.dirty=!0)}function YL(e,t){Up(e,t.getFormat(),t.getStyle())}function JL(e){if(!e.getTargetRanges)return null;let t=e.getTargetRanges();return t.length===0?null:t[0]}function M$(e){let t=e.inputType,n=JL(e),o=Yt(),r=Ft();if(t==="deleteContentBackward"){if(r===null){let f=Ds();if(!Ge(f))return!0;_o(f.clone())}if(Ge(r)){let f=r.anchor.key===r.focus.key;if(a=e.timeStamp,GL==="MediaLast"&&a<Xc+30&&o.isComposing()&&f){if(Kn(null),Xc=0,setTimeout(()=>{da(o,()=>{Kn(null)})},30),Ge(r)){let p=r.anchor.getNode();p.markDirty(),ze(p)||de(142),YL(r,p)}}else{Kn(null),e.preventDefault();let p=r.anchor.getNode(),m=p.getTextContent(),g=p.canInsertTextAfter(),h=r.anchor.offset===0&&r.focus.offset===m.length,v=_v&&f&&!h&&g;if(v&&r.isCollapsed()&&(v=!tn(MP(r.anchor,!0))),!v){Re(o,Gc,!0);let y=Ft();_v&&Ge(y)&&y.isCollapsed()&&(Ls=y,setTimeout(()=>Ls=null))}}return!0}}var a;if(!Ge(r))return!0;let i=e.data;Bl!==null&&By(!1,o,Bl),r.dirty&&Bl===null||!r.isCollapsed()||to(r.anchor.getNode())||n===null||r.applyDOMRange(n),Bl=null;let s=r.anchor,l=r.focus,d=s.getNode(),c=l.getNode();if(t==="insertText"||t==="insertTranspose"){if(i===`
|
|
3774
|
-
`)e.preventDefault(),Re(o,
|
|
3775
|
-
`){let o=Ft();if(Ge(o)||nu(o)){if(Ge(o)){let r=o.focus;o.anchor.set(r.key,r.offset,r.type)}return void Re(e,Xp,null)}}}By(!0,e,t)}function O$(e){let t=Yt();if(e.key==null)return!0;if(Bp){if(lL(e))return da(t,()=>{Jp(t,zp)}),Bp=!1,zp="",!0;Bp=!1,zp=""}if((function(n){return $t(n,"ArrowRight",{shiftKey:"any"})})(e))Re(t,AL,e);else if((function(n){return $t(n,"ArrowRight",Ea)})(e))Re(t,EL,e);else if((function(n){return $t(n,"ArrowLeft",{shiftKey:"any"})})(e))Re(t,RL,e);else if((function(n){return $t(n,"ArrowLeft",Ea)})(e))Re(t,ML,e);else if((function(n){return $t(n,"ArrowUp",{altKey:"any",shiftKey:"any"})})(e))Re(t,NL,e);else if((function(n){return $t(n,"ArrowDown",{altKey:"any",shiftKey:"any"})})(e))Re(t,_L,e);else if((function(n){return $t(n,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any",shiftKey:!0})})(e))zc=!0,Re(t,Xp,e);else if((function(n){return n.key===" "})(e))Re(t,DL,e);else if((function(n){return Er&&$t(n,"o",{ctrlKey:!0})})(e))e.preventDefault(),zc=!0,Re(t,Bc,!0);else if((function(n){return $t(n,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any"})})(e))zc=!1,Re(t,Xp,e);else if((function(n){return $t(n,"Backspace",{shiftKey:"any"})||Er&&$t(n,"h",{ctrlKey:!0})})(e))lL(e)?Re(t,OL,e):(e.preventDefault(),Re(t,Gc,!0));else if((function(n){return n.key==="Escape"})(e))Re(t,FL,e);else if((function(n){return $t(n,"Delete",{})||Er&&$t(n,"d",{ctrlKey:!0})})(e))(function(n){return n.key==="Delete"})(e)?Re(t,BL,e):(e.preventDefault(),Re(t,Gc,!1));else if((function(n){return $t(n,"Backspace",sL)})(e))e.preventDefault(),Re(t,jc,!0);else if((function(n){return $t(n,"Delete",sL)})(e))e.preventDefault(),Re(t,jc,!1);else if((function(n){return Er&&$t(n,"Backspace",{metaKey:!0})})(e))e.preventDefault(),Re(t,Qc,!0);else if((function(n){return Er&&($t(n,"Delete",{metaKey:!0})||$t(n,"k",{ctrlKey:!0}))})(e))e.preventDefault(),Re(t,Qc,!1);else if((function(n){return $t(n,"b",Ea)})(e))e.preventDefault(),Re(t,wi,"bold");else if((function(n){return $t(n,"u",Ea)})(e))e.preventDefault(),Re(t,wi,"underline");else if((function(n){return $t(n,"i",Ea)})(e))e.preventDefault(),Re(t,wi,"italic");else if((function(n){return $t(n,"Tab",{shiftKey:"any"})})(e))Re(t,zL,e);else if((function(n){return $t(n,"z",Ea)})(e))e.preventDefault(),Re(t,by,void 0);else if((function(n){return Er?$t(n,"z",{metaKey:!0,shiftKey:!0}):$t(n,"y",{ctrlKey:!0})||$t(n,"z",{ctrlKey:!0,shiftKey:!0})})(e))e.preventDefault(),Re(t,wy,void 0);else{let n=t._editorState._selection;n===null||Ge(n)?dL(e)&&(e.preventDefault(),Re(t,jv,e)):(function(o){return $t(o,"c",Ea)})(e)?(e.preventDefault(),Re(t,Iy,e)):(function(o){return $t(o,"x",Ea)})(e)?(e.preventDefault(),Re(t,Ty,e)):dL(e)&&(e.preventDefault(),Re(t,jv,e))}return(function(n){return n.ctrlKey||n.shiftKey||n.altKey||n.metaKey})(e)&&t.dispatchCommand(WL,e),!0}function ZL(e){let t=e.__lexicalEventHandles;return t===void 0&&(t=[],e.__lexicalEventHandles=t),t}var $l=new Map;function eP(e){let t=FP(e.target);if(t===null)return;let n=Dy(t.anchorNode);if(n===null)return;Jv&&(Jv=!1,da(n,()=>{let l=Ds(),d=t.anchorNode;(So(d)||ca(d))&&_o(fm(l,t,n,e))}));let o=Fy(n),r=o[o.length-1],a=r._key,i=$l.get(a),s=i||r;s!==n&&Dk(t,s,!1),Dk(t,n,!0),n!==r?$l.set(a,n):i&&$l.delete(a)}function Ok(e){e._lexicalHandled=!0}function Fk(e){return e._lexicalHandled===!0}var Bk=()=>{};function F$(e){let t=Xv.get(e);if(t===void 0)return void Bk();let n=Yp.get(t);if(n===void 0)return void Bk();let o=n-1;o>=0||de(164),Xv.delete(e),Yp.set(t,o),o===0&&t.removeEventListener("selectionchange",eP);let r=ru(e);mm(r)?((function(i){if(i._parentEditor!==null){let s=Fy(i),l=s[s.length-1]._key;$l.get(l)===i&&$l.delete(l)}else $l.delete(i._key)})(r),e.__lexicalEditor=null):r&&de(198);let a=ZL(e);for(let i=0;i<a.length;i++)a[i]();e.__lexicalEventHandles=[]}function Zv(e,t,n){$n();let o=e.__key,r=e.getParent();if(r===null)return;let a=(function(s){let l=Ft();if(!Ge(l)||!re(s))return l;let{anchor:d,focus:c}=l,f=d.getNode(),p=c.getNode();return am(f,s)&&d.set(s.__key,0,"element"),am(p,s)&&c.set(s.__key,0,"element"),l})(e),i=!1;if(Ge(a)&&t){let s=a.anchor,l=a.focus;s.key===o&&(nm(s,e,r,e.getPreviousSibling(),e.getNextSibling()),i=!0),l.key===o&&(nm(l,e,r,e.getPreviousSibling(),e.getNextSibling()),i=!0)}else nu(a)&&t&&e.isSelected()&&e.selectPrevious();if(Ge(a)&&t&&!i){let s=e.getIndexWithinParent();Ti(e),tm(a,r,s,-1)}else Ti(e);n||gr(r)||r.canBeEmpty()||!r.isEmpty()||Zv(r,t),t&&a&&to(r)&&r.isEmpty()&&r.selectEnd()}function B$(e){return e}var tP=Symbol.for("ephemeral");function Zp(e){return e[tP]||!1}var mr=class{__type;__key;__parent;__prev;__next;__state;static getType(){let{ownNodeType:t}=su(this);return t===void 0&&de(64,this.name),t}static clone(t){de(65,this.name)}$config(){return{}}config(t,n){let o=n.extends||Object.getPrototypeOf(this.constructor);return Object.assign(n,{extends:o,type:t}),{[t]:n}}afterCloneFrom(t){this.__key===t.__key?(this.__parent=t.__parent,this.__next=t.__next,this.__prev=t.__prev,this.__state=t.__state):t.__state&&(this.__state=t.__state.getWritable(this))}static importDOM;constructor(t){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}),TP(this,t)}getType(){return this.__type}isInline(){de(137,this.constructor.name)}isAttached(){let t=this.__key;for(;t!==null;){if(t==="root")return!0;let n=Fn(t);if(n===null)break;t=n.__parent}return!1}isSelected(t){let n=t||Ft();if(n==null)return!1;let o=n.getNodes().some(r=>r.__key===this.__key);if(ze(this))return o;if(Ge(n)&&n.anchor.type==="element"&&n.focus.type==="element"){if(n.isCollapsed())return!1;let r=this.getParent();if(tn(this)&&this.isInline()&&r){let a=n.isBackward()?n.focus:n.anchor;if(r.is(a.getNode())&&a.offset===r.getChildrenSize()&&this.is(r.getLastChild()))return!1}}return o}getKey(){return this.__key}getIndexWithinParent(){let t=this.getParent();if(t===null)return-1;let n=t.getFirstChild(),o=0;for(;n!==null;){if(this.is(n))return o;o++,n=n.getNextSibling()}return-1}getParent(){let t=this.getLatest().__parent;return t===null?null:Fn(t)}getParentOrThrow(){let t=this.getParent();return t===null&&de(66,this.__key),t}getTopLevelElement(){let t=this;for(;t!==null;){let n=t.getParent();if(gr(n))return re(t)||t===this&&tn(t)||de(194),t;t=n}return null}getTopLevelElementOrThrow(){let t=this.getTopLevelElement();return t===null&&de(67,this.__key),t}getParents(){let t=[],n=this.getParent();for(;n!==null;)t.push(n),n=n.getParent();return t}getParentKeys(){let t=[],n=this.getParent();for(;n!==null;)t.push(n.__key),n=n.getParent();return t}getPreviousSibling(){let t=this.getLatest().__prev;return t===null?null:Fn(t)}getPreviousSiblings(){let t=[],n=this.getParent();if(n===null)return t;let o=n.getFirstChild();for(;o!==null&&!o.is(this);)t.push(o),o=o.getNextSibling();return t}getNextSibling(){let t=this.getLatest().__next;return t===null?null:Fn(t)}getNextSiblings(){let t=[],n=this.getNextSibling();for(;n!==null;)t.push(n),n=n.getNextSibling();return t}getCommonAncestor(t){let n=re(this)?this:this.getParent(),o=re(t)?t:t.getParent(),r=n&&o?$c(n,o):null;return r?r.commonAncestor:null}is(t){return t!=null&&this.__key===t.__key}isBefore(t){let n=$c(this,t);return n!==null&&(n.type==="descendant"||(n.type==="branch"?Xy(n)===-1:(n.type!=="same"&&n.type!=="ancestor"&&de(279),!1)))}isParentOf(t){let n=$c(this,t);return n!==null&&n.type==="ancestor"}getNodesBetween(t){let n=this.isBefore(t),o=[],r=new Set,a=this;for(;a!==null;){let i=a.__key;if(r.has(i)||(r.add(i),o.push(a)),a===t)break;let s=re(a)?n?a.getFirstChild():a.getLastChild():null;if(s!==null){a=s;continue}let l=n?a.getNextSibling():a.getPreviousSibling();if(l!==null){a=l;continue}let d=a.getParentOrThrow();if(r.has(d.__key)||o.push(d),d===t)break;let c=null,f=d;do{if(f===null&&de(68),c=n?f.getNextSibling():f.getPreviousSibling(),f=f.getParent(),f===null)break;c!==null||r.has(f.__key)||o.push(f)}while(c===null);a=c}return n||o.reverse(),o}isDirty(){let t=Yt()._dirtyLeaves;return t!==null&&t.has(this.__key)}getLatest(){if(Zp(this))return this;let t=Fn(this.__key);return t===null&&de(113),t}getWritable(){if(Zp(this))return this;$n();let t=Fa(),n=Yt(),o=t._nodeMap,r=this.__key,a=this.getLatest(),i=n._cloneNotNeeded,s=Ft();if(s!==null&&s.setCachedNodes(null),i.has(r))return rm(a),a;let l=qy(a);return i.add(r),rm(l),o.set(r,l),l}getTextContent(){return""}getTextContentSize(){return this.getTextContent().length}createDOM(t,n){de(70)}updateDOM(t,n,o){de(71)}exportDOM(t){return{element:this.createDOM(t._config,t)}}exportJSON(){let t=this.__state?this.__state.toJSON():void 0;return{type:this.__type,version:1,...t}}static importJSON(t){de(18,this.name)}updateFromJSON(t){return(function(n,o){let r=n.getWritable(),a=o.$,i=a;for(let s of SL(r).flatKeys)s in o&&(i!==void 0&&i!==a||(i={...a}),i[s]=o[s]);return(r.__state||i)&&my(n).updateFromJSON(i),r})(this,t)}static transform(){return null}remove(t){Zv(this,!0,t)}replace(t,n){$n();let o=Ft();o!==null&&(o=o.clone()),Rv(this,t);let r=this.getLatest(),a=this.__key,i=t.__key,s=t.getWritable(),l=this.getParentOrThrow().getWritable(),d=l.__size;Ti(s);let c=r.getPreviousSibling(),f=r.getNextSibling(),p=r.__prev,m=r.__next,g=r.__parent;if(Zv(r,!1,!0),c===null?l.__first=i:c.getWritable().__next=i,s.__prev=p,f===null?l.__last=i:f.getWritable().__prev=i,s.__next=m,s.__parent=g,l.__size=d,n&&(re(this)&&re(s)||de(139),this.getChildren().forEach(h=>{s.append(h)})),Ge(o)){_o(o);let h=o.anchor,v=o.focus;h.key===a&&$k(h,s),v.key===a&&$k(v,s)}return Si()===a&&Kn(i),s}insertAfter(t,n=!0){$n(),Rv(this,t);let o=this.getWritable(),r=t.getWritable(),a=r.getParent(),i=Ft(),s=!1,l=!1;if(a!==null){let m=t.getIndexWithinParent();if(Ti(r),Ge(i)){let g=a.__key,h=i.anchor,v=i.focus;s=h.type==="element"&&h.key===g&&h.offset===m+1,l=v.type==="element"&&v.key===g&&v.offset===m+1}}let d=this.getNextSibling(),c=this.getParentOrThrow().getWritable(),f=r.__key,p=o.__next;if(d===null?c.__last=f:d.getWritable().__prev=f,c.__size++,o.__next=f,r.__next=p,r.__prev=o.__key,r.__parent=o.__parent,n&&Ge(i)){let m=this.getIndexWithinParent();tm(i,c,m+1);let g=c.__key;s&&i.anchor.set(g,m+2,"element"),l&&i.focus.set(g,m+2,"element")}return t}insertBefore(t,n=!0){$n(),Rv(this,t);let o=this.getWritable(),r=t.getWritable(),a=r.__key;Ti(r);let i=this.getPreviousSibling(),s=this.getParentOrThrow().getWritable(),l=o.__prev,d=this.getIndexWithinParent();i===null?s.__first=a:i.getWritable().__next=a,s.__size++,o.__prev=a,r.__prev=l,r.__next=o.__key,r.__parent=o.__parent;let c=Ft();return n&&Ge(c)&&tm(c,this.getParentOrThrow(),d),t}isParentRequired(){return!1}createParentElementNode(){return _a()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(t,n){$n();let o=this.getPreviousSibling(),r=this.getParentOrThrow();if(o===null)return r.select(0,0);if(re(o))return o.select();if(!ze(o)){let a=o.getIndexWithinParent()+1;return r.select(a,a)}return o.select(t,n)}selectNext(t,n){$n();let o=this.getNextSibling(),r=this.getParentOrThrow();if(o===null)return r.select();if(re(o))return o.select(0,0);if(!ze(o)){let a=o.getIndexWithinParent();return r.select(a,a)}return o.select(t,n)}markDirty(){this.getWritable()}reconcileObservedMutation(t,n){this.markDirty()}},z$="historic",U$="history-push",Hp="history-merge",H$="paste",nP="collaboration",$$="skip-collab",oP="skip-scroll-into-view",rP="skip-dom-selection",ey="skip-selection-focus",aP="composition-start",iP="composition-end",Vl=class e extends mr{static getType(){return"linebreak"}static clone(t){return new e(t.__key)}constructor(t){super(t)}getTextContent(){return`
|
|
3776
|
-
`}createDOM(){return document.createElement("br")}updateDOM(){return!1}isInline(){return!0}static importDOM(){return{br:t=>(function(n){let o=n.parentElement;if(o!==null&&
|
|
3773
|
+
`,uy=Ti?"\xA0":Kc,yL="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",xL="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",s$=new RegExp("^[^"+xL+"]*["+yL+"]"),l$=new RegExp("^[^"+yL+"]*["+xL+"]"),lo={bold:1,capitalize:1024,code:16,highlight:cy,italic:2,lowercase:256,strikethrough:4,subscript:32,superscript:64,underline:8,uppercase:512},d$={directionless:1,unmergeable:2},_v={center:2,end:6,justify:4,left:1,right:3,start:5},c$={[n$]:"center",[i$]:"end",[r$]:"justify",[t$]:"left",[o$]:"right",[a$]:"start"},u$={normal:0,segmented:2,token:1},f$={[VH]:"normal",[WH]:"segmented",[qH]:"token"},p$="$",Tk="$config";function CL(e,t,n,o,r,a){let i=e.getFirstChild();for(;i!==null;){let s=i.__key;i.__parent===t&&(re(i)&&CL(i,s,n,o,r,a),n.has(s)||a.delete(s),r.push(s)),i=i.getNextSibling()}}var Dv=!1,fy=0;function m$(e){fy=e.timeStamp}function Sv(e,t,n){let o=e.nodeName==="BR",r=t.__lexicalLineBreak;return r&&(e===r||o&&e.previousSibling===r)||o&&mm(e,n)!==void 0}function g$(e,t,n){let o=Or(Qo(n)),r=null,a=null;o!==null&&o.anchorNode===e&&(r=o.anchorOffset,a=o.focusOffset);let i=e.nodeValue;i!==null&&By(t,i,r,a,!1)}function h$(e,t,n){if(Ge(e)){let o=e.anchor.getNode();if(o.is(n)&&e.format!==o.getFormat())return!1}return ca(t)&&n.isAttached()}function v$(e,t,n,o){for(let r=e;r&&!KP(r);r=ru(r)){let a=mm(r,t);if(a!==void 0){let i=Fn(a,n);if(i)return en(i)||!So(r)?void 0:[r,i]}else if(r===o)return[o,AP(n)]}}function bL(e,t,n){Dv=!0;let o=performance.now()-fy>100;try{da(e,()=>{let r=Ot()||(function(p){return p.getEditorState().read(()=>{let m=Ot();return m!==null?m.clone():null})})(e),a=new Map,i=e.getRootElement(),s=e._editorState,l=e._blockCursorElement,d=!1,c="";for(let p=0;p<t.length;p++){let m=t[p],g=m.type,h=m.target,v=v$(h,e,s,i);if(!v)continue;let[y,x]=v;if(g==="characterData")o&&ze(x)&&ca(h)&&h$(r,h,x)&&g$(h,x,e);else if(g==="childList"){d=!0;let C=m.addedNodes;for(let S=0;S<C.length;S++){let k=C[S],I=Dy(k),T=k.parentNode;if(T!=null&&k!==l&&I===null&&!Sv(k,T,e)){if(Ti){let A=(So(k)?k.innerText:null)||k.nodeValue;A&&(c+=A)}T.removeChild(k)}}let w=m.removedNodes,L=w.length;if(L>0){let S=0;for(let k=0;k<L;k++){let I=w[k];(Sv(I,h,e)||l===I)&&(h.appendChild(I),S++)}L!==S&&a.set(y,x)}}}if(a.size>0)for(let[p,m]of a)m.reconcileObservedMutation(p,e);let f=n.takeRecords();if(f.length>0){for(let p=0;p<f.length;p++){let m=f[p],g=m.addedNodes,h=m.target;for(let v=0;v<g.length;v++){let y=g[v],x=y.parentNode;x==null||y.nodeName!=="BR"||Sv(y,h,e)||x.removeChild(y)}}n.takeRecords()}r!==null&&(d&&_o(r),Ti&&DP(e)&&r.insertRawText(c))})}finally{Dv=!1}}function wL(e){let t=e._observer;t!==null&&bL(e,t.takeRecords(),t)}function SL(e){(function(t){fy===0&&Qo(t).addEventListener("textInput",m$,!0)})(e),e._observer=new MutationObserver((t,n)=>{bL(e,t,n)})}var Ov=class{key;parse;unparse;isEqual;defaultValue;constructor(t,n){this.key=t,this.parse=n.parse.bind(n),this.unparse=(n.unparse||b$).bind(n),this.isEqual=(n.isEqual||Object.is).bind(n),this.defaultValue=this.parse(void 0)}};function y$(e,t){return new Ov(e,t)}function Kp(e,t,n="latest"){let o=(n==="latest"?e.getLatest():e).__state;return o?o.getValue(t):t.defaultValue}function x$(e,t,n){let o=Kp(e,n,"direct"),r=Kp(t,n,"direct");return n.isEqual(o,r)?null:[o,r]}function C$(e,t,n){let o;if($n(),typeof n=="function"){let a=e.getLatest(),i=Kp(a,t);if(o=n(i),t.isEqual(i,o))return a}else o=n;let r=e.getWritable();return py(r).updateFromKnown(t,o),r}function IL(e){let t=new Map,n=new Set;for(let o=typeof e=="function"?e:e.replace;o.prototype&&o.prototype.getType!==void 0;o=Object.getPrototypeOf(o)){let{ownNodeConfig:r}=iu(o);if(r&&r.stateConfigs)for(let a of r.stateConfigs){let i;"stateConfig"in a?(i=a.stateConfig,a.flat&&n.add(i.key)):i=a,t.set(i.key,i)}}return{flatKeys:n,sharedConfigMap:t}}var Fv=class e{node;knownState;unknownState;sharedNodeState;size;constructor(t,n,o=void 0,r=new Map,a=void 0){this.node=t,this.sharedNodeState=n,this.unknownState=o,this.knownState=r;let{sharedConfigMap:i}=this.sharedNodeState,s=a!==void 0?a:(function(l,d,c){let f=c.size;if(d)for(let p in d){let m=l.get(p);m&&c.has(m)||f++}return f})(i,o,r);this.size=s}getValue(t){let n=this.knownState.get(t);if(n!==void 0)return n;this.sharedNodeState.sharedConfigMap.set(t.key,t);let o=t.defaultValue;if(this.unknownState&&t.key in this.unknownState){let r=this.unknownState[t.key];r!==void 0&&(o=t.parse(r)),this.updateFromKnown(t,o)}return o}getInternalState(){return[this.unknownState,this.knownState]}toJSON(){let t={...this.unknownState},n={};for(let[o,r]of this.knownState)o.isEqual(r,o.defaultValue)?delete t[o.key]:t[o.key]=o.unparse(r);for(let o of this.sharedNodeState.flatKeys)o in t&&(n[o]=t[o],delete t[o]);return kk(t)&&(n.$=t),n}getWritable(t){if(this.node===t)return this;let{sharedNodeState:n,unknownState:o}=this,r=new Map(this.knownState);return new e(t,n,(function(a,i,s){let l;if(s)for(let[d,c]of Object.entries(s)){let f=a.get(d);f?i.has(f)||i.set(f,f.parse(c)):(l=l||{},l[d]=c)}return l})(n.sharedConfigMap,r,o),r,this.size)}updateFromKnown(t,n){let o=t.key;this.sharedNodeState.sharedConfigMap.set(o,t);let{knownState:r,unknownState:a}=this;r.has(t)||a&&o in a||(a&&(delete a[o],this.unknownState=kk(a)),this.size++),r.set(t,n)}updateFromUnknown(t,n){let o=this.sharedNodeState.sharedConfigMap.get(t);o?this.updateFromKnown(o,o.parse(n)):(this.unknownState=this.unknownState||{},t in this.unknownState||this.size++,this.unknownState[t]=n)}updateFromJSON(t){let{knownState:n}=this;for(let o of n.keys())n.set(o,o.defaultValue);if(this.size=n.size,this.unknownState=void 0,t)for(let[o,r]of Object.entries(t))this.updateFromUnknown(o,r)}};function py(e){let t=e.getWritable(),n=t.__state?t.__state.getWritable(t):new Fv(t,TL(t));return t.__state=n,n}function TL(e){return e.__state?e.__state.sharedNodeState:Ry(Ky(),e.getType()).sharedNodeState}function kk(e){if(e)for(let t in e)return e}function b$(e){return e}function Lk(e,t,n){for(let[o,r]of t.knownState){if(e.has(o.key))continue;e.add(o.key);let a=n?n.getValue(o):o.defaultValue;if(a!==r&&!o.isEqual(a,r))return!0}return!1}function Pk(e,t,n){let{unknownState:o}=t,r=n?n.unknownState:void 0;if(o){for(let[a,i]of Object.entries(o))if(!e.has(a)&&(e.add(a),i!==(r?r[a]:void 0)))return!0}return!1}function Ak(e,t){let n=e.__state;return n&&n.node===e?n.getWritable(t):n}function Ek(e,t){let n=e.__mode,o=e.__format,r=e.__style,a=t.__mode,i=t.__format,s=t.__style,l=e.__state,d=t.__state;return(n===null||n===a)&&(o===null||o===i)&&(r===null||r===s)&&(e.__state===null||l===d||(function(c,f){if(c===f)return!0;if(c&&f&&c.size!==f.size)return!1;let p=new Set;return!(c&&Lk(p,c,f)||f&&Lk(p,f,c)||c&&Pk(p,c,f)||f&&Pk(p,f,c))})(l,d))}function Rk(e,t){let n=e.mergeWithSibling(t),o=Xt()._normalizedNodes;return o.add(e.__key),o.add(t.__key),n}function Mk(e){let t,n,o=e;if(o.__text!==""||!o.isSimpleText()||o.isUnmergeable()){for(;(t=o.getPreviousSibling())!==null&&ze(t)&&t.isSimpleText()&&!t.isUnmergeable();){if(t.__text!==""){if(Ek(t,o)){o=Rk(t,o);break}break}t.remove()}for(;(n=o.getNextSibling())!==null&&ze(n)&&n.isSimpleText()&&!n.isUnmergeable();){if(n.__text!==""){if(Ek(o,n)){o=Rk(o,n);break}break}n.remove()}}else o.remove()}function Vp(e){return Nk(e.anchor),Nk(e.focus),e}function Nk(e){for(;e.type==="element";){let t=e.getNode(),n=e.offset,o,r;if(n===t.getChildrenSize()?(o=t.getChildAtIndex(n-1),r=!0):(o=t.getChildAtIndex(n),r=!1),ze(o)){e.set(o.__key,r?o.getTextContentSize():0,"text",!0);break}if(!re(o))break;e.set(o.__key,r?o.getChildrenSize():0,"element",!0)}}var Ls,no,Vc,dm,Bv,zv,Ps,Rr,Uv,qc,On="",la=null,Is=null,Ol=!1,qp=!1;function Wp(e,t){let n=Ps.get(e);if(t!==null){let o=Vv(e);o.parentNode===t&&t.removeChild(o)}if(Rr.has(e)||no._keyToDOMMap.delete(e),re(n)){let o=jp(n,Ps);Hv(o,0,o.length-1,null)}n!==void 0&&zy(qc,Vc,dm,n,"destroyed")}function Hv(e,t,n,o){for(let r=t;r<=n;++r){let a=e[r];a!==void 0&&Wp(a,o)}}function Ss(e,t){e.setProperty("text-align",t)}var w$="40px";function kL(e,t){let n=Ls.theme.indent;if(typeof n=="string"){let r=e.classList.contains(n);t>0&&!r?e.classList.add(n):t<1&&r&&e.classList.remove(n)}if(t===0)return void e.style.setProperty("padding-inline-start","");let o=getComputedStyle(no._rootElement||e).getPropertyValue("--lexical-indent-base-value")||w$;e.style.setProperty("padding-inline-start",`calc(${t} * ${o})`)}function LL(e,t){let n=e.style;t===0?Ss(n,""):t===1?Ss(n,"left"):t===2?Ss(n,"center"):t===3?Ss(n,"right"):t===4?Ss(n,"justify"):t===5?Ss(n,"start"):t===6&&Ss(n,"end")}function $v(e,t){let n=(function(o){let r=o.__dir;if(r!==null)return r;if(to(o))return null;let a=o.getParentOrThrow();return to(a)&&a.__dir===null?"auto":null})(t);n!==null?e.dir=n:e.removeAttribute("dir")}function Gp(e,t){let n=Rr.get(e);n===void 0&&de(60);let o=n.createDOM(Ls,no);if((function(r,a,i){let s=i._keyToDOMMap;(function(l,d,c){let f=`__lexicalKey_${d._key}`;l[f]=c})(a,i,r),s.set(r,a)})(e,o,no),ze(n)?o.setAttribute("data-lexical-text","true"):en(n)&&o.setAttribute("data-lexical-decorator","true"),re(n)){let r=n.__indent,a=n.__size;if($v(o,n),r!==0&&kL(o,r),a!==0){let s=a-1;Kv(jp(n,Rr),n,0,s,n.getDOMSlot(o))}let i=n.__format;i!==0&&LL(o,i),n.isInline()||PL(null,n,o)}else{let r=n.getTextContent();if(en(n)){let a=n.decorate(no,Ls);a!==null&&AL(e,a),o.contentEditable="false"}On+=r}return t!==null&&t.insertChild(o),zy(qc,Vc,dm,n,"created"),o}function Kv(e,t,n,o,r){let a=On;On="";let i=n;for(;i<=o;++i){Gp(e[i],r);let s=Rr.get(e[i]);s!==null&&ze(s)?la===null&&(la=s.getFormat(),Is=s.getStyle()):re(s)&&i<o&&!s.isInline()&&(On+=lm)}r.element.__lexicalTextContent=On,On=a+On}function _k(e,t){if(e){let n=e.__last;if(n){let o=t.get(n);if(o)return ks(o)?"line-break":en(o)&&o.isInline()?"decorator":null}return"empty"}return null}function PL(e,t,n){let o=_k(e,Ps),r=_k(t,Rr);o!==r&&t.getDOMSlot(n).setManagedLineBreak(r)}function S$(e,t,n){var o;la=null,Is=null,(function(r,a,i){let s=On,l=r.__size,d=a.__size;On="";let c=i.element;if(l===1&&d===1){let f=r.__first,p=a.__first;if(f===p)Op(f,c);else{let g=Vv(f),h=Gp(p,null);try{c.replaceChild(h,g)}catch(v){if(typeof v=="object"&&v!=null){let y=`${v.toString()} Parent: ${c.tagName}, new child: {tag: ${h.tagName} key: ${p}}, old child: {tag: ${g.tagName}, key: ${f}}.`;throw new Error(y)}throw v}Wp(f,null)}let m=Rr.get(p);ze(m)&&la===null&&(la=m.getFormat(),Is=m.getStyle())}else{let f=jp(r,Ps),p=jp(a,Rr);if(f.length!==l&&de(227),p.length!==d&&de(228),l===0)d!==0&&Kv(p,0,0,d-1,i);else if(d===0){if(l!==0){let m=i.after==null&&i.before==null&&i.element.__lexicalLineBreak==null;Hv(f,0,l-1,m?null:c),m&&(c.textContent="")}}else(function(m,g,h,v,y,x){let C=v-1,w=y-1,L,S,k=x.getFirstChild(),I=0,T=0;for(;I<=C&&T<=w;){let _=g[I],E=h[T];if(_===E)k=Iv(Op(E,x.element)),I++,T++;else{if(S===void 0&&(S=Dk(h,T)),L===void 0)L=Dk(g,I);else if(!L.has(_)){I++;continue}if(!S.has(_)){k=Iv(Vv(_)),Wp(_,x.element),I++,L.delete(_);continue}if(L.has(E)){let B=jl(no,E);B!==k&&x.withBefore(k).insertChild(B),k=Iv(Op(E,x.element)),I++,T++}else Gp(E,x.withBefore(k)),T++}let F=Rr.get(E);F!==null&&ze(F)?la===null&&(la=F.getFormat(),Is=F.getStyle()):re(F)&&T<=w&&!F.isInline()&&(On+=lm)}let A=I>C,P=T>w;if(A&&!P){let _=h[w+1],E=_===void 0?null:no.getElementByKey(_);Kv(h,0,T,w,x.withBefore(E))}else P&&!A&&Hv(g,I,C,x.element)})(0,f,p,l,d,i)}c.__lexicalTextContent=On,On=s+On})(e,t,t.getDOMSlot(n)),o=t,la==null||la===o.__textFormat||qp||o.setTextFormat(la),(function(r){Is==null||Is===r.__textStyle||qp||r.setTextStyle(Is)})(t)}function jp(e,t){let n=[],o=e.__first;for(;o!==null;){let r=t.get(o);r===void 0&&de(101),n.push(o),o=r.__next}return n}function Op(e,t){let n=Ps.get(e),o=Rr.get(e);n!==void 0&&o!==void 0||de(61);let r=Ol||zv.has(e)||Bv.has(e),a=jl(no,e);if(n===o&&!r){let i;if(re(n)){let s=a.__lexicalTextContent;typeof s=="string"?i=s:(i=n.getTextContent(),a.__lexicalTextContent=i)}else i=n.getTextContent();return On+=i,a}if(n!==o&&r&&zy(qc,Vc,dm,o,"updated"),o.updateDOM(n,a,Ls)){let i=Gp(e,null);return t===null&&de(62),t.replaceChild(i,a),Wp(e,null),i}if(re(n)){re(o)||de(334,e);let i=o.__indent;(Ol||i!==n.__indent)&&kL(a,i);let s=o.__format;if((Ol||s!==n.__format)&&LL(a,s),r)S$(n,o,a),to(o)||o.isInline()||PL(n,o,a);else{let l=a.__lexicalTextContent,d;typeof l=="string"?d=l:(d=n.getTextContent(),a.__lexicalTextContent=d),On+=d}if((Ol||o.__dir!==n.__dir)&&($v(a,o),to(o)&&!Ol))for(let l of o.getChildren())re(l)&&$v(jl(no,l.getKey()),l)}else{let i=o.getTextContent();if(en(o)){let s=o.decorate(no,Ls);s!==null&&AL(e,s)}On+=i}if(!qp&&to(o)&&o.__cachedText!==On){let i=o.getWritable();i.__cachedText=On,o=i}return a}function AL(e,t){let n=no._pendingDecorators,o=no._decorators;if(n===null){if(o[e]===t)return;n=PP(no)}n[e]=t}function Iv(e){let t=e.nextSibling;return t!==null&&t===no._blockCursorElement&&(t=t.nextSibling),t}function Dk(e,t){let n=new Set;for(let o=t;o<e.length;o++)n.add(e[o]);return n}function I$(e,t,n,o,r,a){On="",Ol=o===2,no=n,Ls=n._config,Vc=n._nodes,dm=no._listeners.mutation,Bv=r,zv=a,Ps=e._nodeMap,Rr=t._nodeMap,qp=t._readOnly,Uv=new Map(n._keyToDOMMap);let i=new Map;return qc=i,Op("root",null),no=void 0,Vc=void 0,Bv=void 0,zv=void 0,Ps=void 0,Rr=void 0,Ls=void 0,Uv=void 0,qc=void 0,i}function Vv(e){let t=Uv.get(e);return t===void 0&&de(75,e),t}function tt(e){return{type:e}}var my=tt("SELECTION_CHANGE_COMMAND"),T$=tt("SELECTION_INSERT_CLIPBOARD_NODES_COMMAND"),EL=tt("CLICK_COMMAND"),gy=tt("BEFORE_INPUT_COMMAND"),hy=tt("INPUT_COMMAND"),vy=tt("COMPOSITION_START_COMMAND"),yy=tt("COMPOSITION_END_COMMAND"),Wc=tt("DELETE_CHARACTER_COMMAND"),Fc=tt("INSERT_LINE_BREAK_COMMAND"),qv=tt("INSERT_PARAGRAPH_COMMAND"),Ul=tt("CONTROLLED_TEXT_INSERTION_COMMAND"),xy=tt("PASTE_COMMAND"),Wv=tt("REMOVE_TEXT_COMMAND"),Gc=tt("DELETE_WORD_COMMAND"),jc=tt("DELETE_LINE_COMMAND"),bi=tt("FORMAT_TEXT_COMMAND"),Cy=tt("UNDO_COMMAND"),by=tt("REDO_COMMAND"),wy=tt("KEYDOWN_COMMAND"),RL=tt("KEY_ARROW_RIGHT_COMMAND"),ML=tt("MOVE_TO_END"),NL=tt("KEY_ARROW_LEFT_COMMAND"),_L=tt("MOVE_TO_START"),DL=tt("KEY_ARROW_UP_COMMAND"),OL=tt("KEY_ARROW_DOWN_COMMAND"),Qp=tt("KEY_ENTER_COMMAND"),FL=tt("KEY_SPACE_COMMAND"),BL=tt("KEY_BACKSPACE_COMMAND"),zL=tt("KEY_ESCAPE_COMMAND"),UL=tt("KEY_DELETE_COMMAND"),HL=tt("KEY_TAB_COMMAND"),k$=tt("INSERT_TAB_COMMAND"),L$=tt("INDENT_CONTENT_COMMAND"),P$=tt("OUTDENT_CONTENT_COMMAND"),$L=tt("DROP_COMMAND"),A$=tt("FORMAT_ELEMENT_COMMAND"),KL=tt("DRAGSTART_COMMAND"),VL=tt("DRAGOVER_COMMAND"),qL=tt("DRAGEND_COMMAND"),Sy=tt("COPY_COMMAND"),Iy=tt("CUT_COMMAND"),Gv=tt("SELECT_ALL_COMMAND"),E$=tt("CLEAR_EDITOR_COMMAND"),R$=tt("CLEAR_HISTORY_COMMAND"),M$=tt("CAN_REDO_COMMAND"),N$=tt("CAN_UNDO_COMMAND"),WL=tt("FOCUS_COMMAND"),GL=tt("BLUR_COMMAND"),jL=tt("KEY_MODIFIER_COMMAND"),La=Object.freeze({}),jv=[["keydown",function(e,t){Qc=e.timeStamp,QL=e.key,!t.isComposing()&&Re(t,wy,e)}],["pointerdown",function(e,t){let n=e.target,o=e.pointerType;td(n)&&o!=="touch"&&o!=="pen"&&e.button===0&&da(t,()=>{TP(n)||(Yv=!0)})}],["compositionstart",function(e,t){Re(t,vy,e)}],["compositionend",function(e,t){Ti?Oc=!0:eu||!im&&!sm?Re(t,yy,e):(Fp=!0,Bp=e.data)}],["input",function(e,t){e.stopPropagation(),da(t,()=>{t.dispatchCommand(hy,e)},{event:e}),Fl=null}],["click",function(e,t){da(t,()=>{let n=Ot(),o=Or(Qo(t)),r=Ns();if(o){if(Ge(n)){let a=n.anchor,i=a.getNode();if(a.type==="element"&&a.offset===0&&n.isCollapsed()&&!to(i)&&jo().getChildrenSize()===1&&i.getTopLevelElementOrThrow().isEmpty()&&r!==null&&n.is(r))o.removeAllRanges(),n.dirty=!0;else if(e.detail===3&&!n.isCollapsed()&&i!==n.focus.getNode()){let s=Uc(i,l=>re(l)&&!l.isInline());re(s)&&s.select(0)}}else if(e.pointerType==="touch"||e.pointerType==="pen"){let a=o.anchorNode;(So(a)||ca(a))&&_o(um(r,o,t,e))}}Re(t,EL,e)})}],["cut",La],["copy",La],["dragstart",La],["dragover",La],["dragend",La],["paste",La],["focus",La],["blur",La],["drop",La]];$p&&jv.push(["beforeinput",(e,t)=>(function(n,o){let r=n.inputType;r==="deleteCompositionText"||Ti&&DP(o)||r!=="insertCompositionText"&&Re(o,gy,n)})(e,t)]);var Qc=0,QL=null,XL=0,Fl=null,Qv=new WeakMap,Xp=new WeakMap,Xv=!1,Yv=!1,Bc=!1,Oc=!1,Fp=!1,Bp="",Ts=null,YL=[0,"",0,"root",0];function JL(e,t,n,o,r){let a=e.anchor,i=e.focus,s=a.getNode(),l=Xt(),d=Or(Qo(l)),c=d!==null?d.anchorNode:null,f=a.key,p=l.getElementByKey(f),m=n.length;return f!==i.key||!ze(s)||(!r&&(!$p||XL<o+50)||s.isDirty()&&m<2||EP(n))&&a.offset!==i.offset&&!s.isComposing()||Ea(s)||s.isDirty()&&m>1||(r||!$p)&&p!==null&&!s.isComposing()&&c!==Rs(p)||d!==null&&t!==null&&(!t.collapsed||t.startContainer!==d.anchorNode||t.startOffset!==d.anchorOffset)||!s.isComposing()&&(s.getFormat()!==e.format||s.getStyle()!==e.style)||(function(g,h){if(h.isSegmented())return!0;if(!g.isCollapsed())return!1;let v=g.anchor.offset,y=h.getParentOrThrow(),x=Si(h);return v===0?!h.canInsertTextBefore()||!y.canInsertTextBefore()&&!h.isComposing()||x||(function(C){let w=C.getPreviousSibling();return(ze(w)||re(w)&&w.isInline())&&!w.canInsertTextAfter()})(h):v===h.getTextContentSize()&&(!h.canInsertTextAfter()||!y.canInsertTextAfter()&&!h.isComposing()||x)})(e,s)}function Ok(e,t){return ca(e)&&e.nodeValue!==null&&t!==0&&t!==e.nodeValue.length}function Fk(e,t,n){let{anchorNode:o,anchorOffset:r,focusNode:a,focusOffset:i}=e;Xv&&(Xv=!1,Ok(o,r)&&Ok(a,i)&&!Ts)||da(t,()=>{if(!n)return void _o(null);if(!nu(t,o,a))return;let s=Ot();if(Ts&&Ge(s)&&s.isCollapsed()){let l=s.anchor,d=Ts.anchor;(l.key===d.key&&l.offset===d.offset+1||l.offset===1&&d.getNode().is(l.getNode().getPreviousSibling()))&&(s=Ts.clone(),_o(s))}if(Ts=null,Ge(s)){let l=s.anchor,d=l.getNode();if(s.isCollapsed()){e.type==="Range"&&e.anchorNode===e.focusNode&&(s.dirty=!0);let c=Qo(t).event,f=c?c.timeStamp:performance.now(),[p,m,g,h,v]=YL,y=jo(),x=t.isComposing()===!1&&y.getTextContent()==="";if(f<v+200&&l.offset===g&&l.key===h)zp(s,p,m);else if(l.type==="text")ze(d)||de(141),ZL(s,d);else if(l.type==="element"&&!x){re(d)||de(259);let C=l.getNode();C.isEmpty()?(function(w,L){let S=L.getTextFormat(),k=L.getTextStyle();zp(w,S,k)})(s,C):zp(s,0,"")}}else{let c=l.key,f=s.focus.key,p=s.getNodes(),m=p.length,g=s.isBackward(),h=g?i:r,v=g?r:i,y=g?f:c,x=g?c:f,C=2047,w=!1;for(let L=0;L<m;L++){let S=p[L],k=S.getTextContentSize();if(ze(S)&&k!==0&&!(L===0&&S.__key===y&&h===k||L===m-1&&S.__key===x&&v===0)&&(w=!0,C&=S.getFormat(),C===0))break}s.format=w?C:0}}Re(t,my,void 0)})}function zp(e,t,n){e.format===t&&e.style===n||(e.format=t,e.style=n,e.dirty=!0)}function ZL(e,t){zp(e,t.getFormat(),t.getStyle())}function eP(e){if(!e.getTargetRanges)return null;let t=e.getTargetRanges();return t.length===0?null:t[0]}function _$(e){let t=e.inputType,n=eP(e),o=Xt(),r=Ot();if(t==="deleteContentBackward"){if(r===null){let f=Ns();if(!Ge(f))return!0;_o(f.clone())}if(Ge(r)){let f=r.anchor.key===r.focus.key;if(a=e.timeStamp,QL==="MediaLast"&&a<Qc+30&&o.isComposing()&&f){if(Kn(null),Qc=0,setTimeout(()=>{da(o,()=>{Kn(null)})},30),Ge(r)){let p=r.anchor.getNode();p.markDirty(),ze(p)||de(142),ZL(r,p)}}else{Kn(null),e.preventDefault();let p=r.anchor.getNode(),m=p.getTextContent(),g=p.canInsertTextAfter(),h=r.anchor.offset===0&&r.focus.offset===m.length,v=Nv&&f&&!h&&g;if(v&&r.isCollapsed()&&(v=!en(_P(r.anchor,!0))),!v){Re(o,Wc,!0);let y=Ot();Nv&&Ge(y)&&y.isCollapsed()&&(Ts=y,setTimeout(()=>Ts=null))}}return!0}}var a;if(!Ge(r))return!0;let i=e.data;Fl!==null&&Fy(!1,o,Fl),r.dirty&&Fl===null||!r.isCollapsed()||to(r.anchor.getNode())||n===null||r.applyDOMRange(n),Fl=null;let s=r.anchor,l=r.focus,d=s.getNode(),c=l.getNode();if(t==="insertText"||t==="insertTranspose"){if(i===`
|
|
3774
|
+
`)e.preventDefault(),Re(o,Fc,!1);else if(i===lm)e.preventDefault(),Re(o,qv,void 0);else if(i==null&&e.dataTransfer){let f=e.dataTransfer.getData("text/plain");e.preventDefault(),r.insertRawText(f)}else i!=null&&JL(r,n,i,e.timeStamp,!0)?(e.preventDefault(),Re(o,Ul,i)):Fl=i;return XL=e.timeStamp,!0}switch(e.preventDefault(),t){case"insertFromYank":case"insertFromDrop":case"insertReplacementText":Re(o,Ul,e);break;case"insertFromComposition":Kn(null),Re(o,Ul,e);break;case"insertLineBreak":Kn(null),Re(o,Fc,!1);break;case"insertParagraph":Kn(null),Bc&&!eu?(Bc=!1,Re(o,Fc,!1)):Re(o,qv,void 0);break;case"insertFromPaste":case"insertFromPasteAsQuotation":Re(o,xy,e);break;case"deleteByComposition":(function(f,p){return f!==p||re(f)||re(p)||!Si(f)||!Si(p)})(d,c)&&Re(o,Wv,e);break;case"deleteByDrag":case"deleteByCut":Re(o,Wv,e);break;case"deleteContent":Re(o,Wc,!1);break;case"deleteWordBackward":Re(o,Gc,!0);break;case"deleteWordForward":Re(o,Gc,!1);break;case"deleteHardLineBackward":case"deleteSoftLineBackward":Re(o,jc,!0);break;case"deleteContentForward":case"deleteHardLineForward":case"deleteSoftLineForward":Re(o,jc,!1);break;case"formatStrikeThrough":Re(o,bi,"strikethrough");break;case"formatBold":Re(o,bi,"bold");break;case"formatItalic":Re(o,bi,"italic");break;case"formatUnderline":Re(o,bi,"underline");break;case"historyUndo":Re(o,Cy,void 0);break;case"historyRedo":Re(o,by,void 0)}return!0}function D$(e){if(So(e.target)&&TP(e.target))return!0;let t=Xt(),n=Ot(),o=e.data,r=eP(e);if(o!=null&&Ge(n)&&JL(n,r,o,e.timeStamp,!1)){Oc&&(Yp(t,o),Oc=!1);let a=n.anchor.getNode(),i=Or(Qo(t));if(i===null)return!0;let s=n.isBackward(),l=s?n.anchor.offset:n.focus.offset,d=s?n.focus.offset:n.anchor.offset;$p&&!n.isCollapsed()&&ze(a)&&i.anchorNode!==null&&a.getTextContent().slice(0,l)+o+a.getTextContent().slice(l+d)===MP(i.anchorNode)||Re(t,Ul,o);let c=o.length;Ti&&c>1&&e.inputType==="insertCompositionText"&&!t.isComposing()&&(n.anchor.offset-=c),Nv&&t.isComposing()&&(Qc=0,Kn(null))}else Fy(!1,t,o!==null?o:void 0),Oc&&(Yp(t,o||void 0),Oc=!1);return(function(){$n();let a=Xt();wL(a)})(),!0}function O$(e){let t=Xt(),n=Ot();if(Ge(n)&&!t.isComposing()){let o=n.anchor,r=n.anchor.getNode();Kn(o.key),hm(sP),(e.timeStamp<Qc+30||o.type==="element"||!n.isCollapsed()||r.getFormat()!==n.format||ze(r)&&r.getStyle()!==n.style)&&Re(t,Ul,uy)}return!0}function F$(e){return Yp(Xt(),e.data),hm(lP),!0}function Yp(e,t){let n=e._compositionKey;if(Kn(null),n!==null&&t!=null){if(t===""){let o=Fn(n),r=Rs(e.getElementByKey(n));if(r!==null&&r.nodeValue!==null&&ze(o)){let a=Or(Qo(e)),i=null,s=null;a!==null&&a.anchorNode===r&&(i=a.anchorOffset,s=a.focusOffset),By(o,r.nodeValue,i,s,!0)}return}if(t[t.length-1]===`
|
|
3775
|
+
`){let o=Ot();if(Ge(o)||tu(o)){if(Ge(o)){let r=o.focus;o.anchor.set(r.key,r.offset,r.type)}return void Re(e,Qp,null)}}}Fy(!0,e,t)}function B$(e){let t=Xt();if(e.key==null)return!0;if(Fp){if(cL(e))return da(t,()=>{Yp(t,Bp)}),Fp=!1,Bp="",!0;Fp=!1,Bp=""}if((function(n){return $t(n,"ArrowRight",{shiftKey:"any"})})(e))Re(t,RL,e);else if((function(n){return $t(n,"ArrowRight",Aa)})(e))Re(t,ML,e);else if((function(n){return $t(n,"ArrowLeft",{shiftKey:"any"})})(e))Re(t,NL,e);else if((function(n){return $t(n,"ArrowLeft",Aa)})(e))Re(t,_L,e);else if((function(n){return $t(n,"ArrowUp",{altKey:"any",shiftKey:"any"})})(e))Re(t,DL,e);else if((function(n){return $t(n,"ArrowDown",{altKey:"any",shiftKey:"any"})})(e))Re(t,OL,e);else if((function(n){return $t(n,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any",shiftKey:!0})})(e))Bc=!0,Re(t,Qp,e);else if((function(n){return n.key===" "})(e))Re(t,FL,e);else if((function(n){return Ar&&$t(n,"o",{ctrlKey:!0})})(e))e.preventDefault(),Bc=!0,Re(t,Fc,!0);else if((function(n){return $t(n,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any"})})(e))Bc=!1,Re(t,Qp,e);else if((function(n){return $t(n,"Backspace",{shiftKey:"any"})||Ar&&$t(n,"h",{ctrlKey:!0})})(e))cL(e)?Re(t,BL,e):(e.preventDefault(),Re(t,Wc,!0));else if((function(n){return n.key==="Escape"})(e))Re(t,zL,e);else if((function(n){return $t(n,"Delete",{})||Ar&&$t(n,"d",{ctrlKey:!0})})(e))(function(n){return n.key==="Delete"})(e)?Re(t,UL,e):(e.preventDefault(),Re(t,Wc,!1));else if((function(n){return $t(n,"Backspace",dL)})(e))e.preventDefault(),Re(t,Gc,!0);else if((function(n){return $t(n,"Delete",dL)})(e))e.preventDefault(),Re(t,Gc,!1);else if((function(n){return Ar&&$t(n,"Backspace",{metaKey:!0})})(e))e.preventDefault(),Re(t,jc,!0);else if((function(n){return Ar&&($t(n,"Delete",{metaKey:!0})||$t(n,"k",{ctrlKey:!0}))})(e))e.preventDefault(),Re(t,jc,!1);else if((function(n){return $t(n,"b",Aa)})(e))e.preventDefault(),Re(t,bi,"bold");else if((function(n){return $t(n,"u",Aa)})(e))e.preventDefault(),Re(t,bi,"underline");else if((function(n){return $t(n,"i",Aa)})(e))e.preventDefault(),Re(t,bi,"italic");else if((function(n){return $t(n,"Tab",{shiftKey:"any"})})(e))Re(t,HL,e);else if((function(n){return $t(n,"z",Aa)})(e))e.preventDefault(),Re(t,Cy,void 0);else if((function(n){return Ar?$t(n,"z",{metaKey:!0,shiftKey:!0}):$t(n,"y",{ctrlKey:!0})||$t(n,"z",{ctrlKey:!0,shiftKey:!0})})(e))e.preventDefault(),Re(t,by,void 0);else{let n=t._editorState._selection;n===null||Ge(n)?uL(e)&&(e.preventDefault(),Re(t,Gv,e)):(function(o){return $t(o,"c",Aa)})(e)?(e.preventDefault(),Re(t,Sy,e)):(function(o){return $t(o,"x",Aa)})(e)?(e.preventDefault(),Re(t,Iy,e)):uL(e)&&(e.preventDefault(),Re(t,Gv,e))}return(function(n){return n.ctrlKey||n.shiftKey||n.altKey||n.metaKey})(e)&&t.dispatchCommand(jL,e),!0}function tP(e){let t=e.__lexicalEventHandles;return t===void 0&&(t=[],e.__lexicalEventHandles=t),t}var Hl=new Map;function nP(e){let t=zP(e.target);if(t===null)return;let n=_y(t.anchorNode);if(n===null)return;Yv&&(Yv=!1,da(n,()=>{let l=Ns(),d=t.anchorNode;(So(d)||ca(d))&&_o(um(l,t,n,e))}));let o=Oy(n),r=o[o.length-1],a=r._key,i=Hl.get(a),s=i||r;s!==n&&Fk(t,s,!1),Fk(t,n,!0),n!==r?Hl.set(a,n):i&&Hl.delete(a)}function Bk(e){e._lexicalHandled=!0}function zk(e){return e._lexicalHandled===!0}var Uk=()=>{};function z$(e){let t=Qv.get(e);if(t===void 0)return void Uk();let n=Xp.get(t);if(n===void 0)return void Uk();let o=n-1;o>=0||de(164),Qv.delete(e),Xp.set(t,o),o===0&&t.removeEventListener("selectionchange",nP);let r=ou(e);pm(r)?((function(i){if(i._parentEditor!==null){let s=Oy(i),l=s[s.length-1]._key;Hl.get(l)===i&&Hl.delete(l)}else Hl.delete(i._key)})(r),e.__lexicalEditor=null):r&&de(198);let a=tP(e);for(let i=0;i<a.length;i++)a[i]();e.__lexicalEventHandles=[]}function Jv(e,t,n){$n();let o=e.__key,r=e.getParent();if(r===null)return;let a=(function(s){let l=Ot();if(!Ge(l)||!re(s))return l;let{anchor:d,focus:c}=l,f=d.getNode(),p=c.getNode();return rm(f,s)&&d.set(s.__key,0,"element"),rm(p,s)&&c.set(s.__key,0,"element"),l})(e),i=!1;if(Ge(a)&&t){let s=a.anchor,l=a.focus;s.key===o&&(tm(s,e,r,e.getPreviousSibling(),e.getNextSibling()),i=!0),l.key===o&&(tm(l,e,r,e.getPreviousSibling(),e.getNextSibling()),i=!0)}else tu(a)&&t&&e.isSelected()&&e.selectPrevious();if(Ge(a)&&t&&!i){let s=e.getIndexWithinParent();Ii(e),em(a,r,s,-1)}else Ii(e);n||mr(r)||r.canBeEmpty()||!r.isEmpty()||Jv(r,t),t&&a&&to(r)&&r.isEmpty()&&r.selectEnd()}function U$(e){return e}var oP=Symbol.for("ephemeral");function Jp(e){return e[oP]||!1}var pr=class{__type;__key;__parent;__prev;__next;__state;static getType(){let{ownNodeType:t}=iu(this);return t===void 0&&de(64,this.name),t}static clone(t){de(65,this.name)}$config(){return{}}config(t,n){let o=n.extends||Object.getPrototypeOf(this.constructor);return Object.assign(n,{extends:o,type:t}),{[t]:n}}afterCloneFrom(t){this.__key===t.__key?(this.__parent=t.__parent,this.__next=t.__next,this.__prev=t.__prev,this.__state=t.__state):t.__state&&(this.__state=t.__state.getWritable(this))}static importDOM;constructor(t){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}),LP(this,t)}getType(){return this.__type}isInline(){de(137,this.constructor.name)}isAttached(){let t=this.__key;for(;t!==null;){if(t==="root")return!0;let n=Fn(t);if(n===null)break;t=n.__parent}return!1}isSelected(t){let n=t||Ot();if(n==null)return!1;let o=n.getNodes().some(r=>r.__key===this.__key);if(ze(this))return o;if(Ge(n)&&n.anchor.type==="element"&&n.focus.type==="element"){if(n.isCollapsed())return!1;let r=this.getParent();if(en(this)&&this.isInline()&&r){let a=n.isBackward()?n.focus:n.anchor;if(r.is(a.getNode())&&a.offset===r.getChildrenSize()&&this.is(r.getLastChild()))return!1}}return o}getKey(){return this.__key}getIndexWithinParent(){let t=this.getParent();if(t===null)return-1;let n=t.getFirstChild(),o=0;for(;n!==null;){if(this.is(n))return o;o++,n=n.getNextSibling()}return-1}getParent(){let t=this.getLatest().__parent;return t===null?null:Fn(t)}getParentOrThrow(){let t=this.getParent();return t===null&&de(66,this.__key),t}getTopLevelElement(){let t=this;for(;t!==null;){let n=t.getParent();if(mr(n))return re(t)||t===this&&en(t)||de(194),t;t=n}return null}getTopLevelElementOrThrow(){let t=this.getTopLevelElement();return t===null&&de(67,this.__key),t}getParents(){let t=[],n=this.getParent();for(;n!==null;)t.push(n),n=n.getParent();return t}getParentKeys(){let t=[],n=this.getParent();for(;n!==null;)t.push(n.__key),n=n.getParent();return t}getPreviousSibling(){let t=this.getLatest().__prev;return t===null?null:Fn(t)}getPreviousSiblings(){let t=[],n=this.getParent();if(n===null)return t;let o=n.getFirstChild();for(;o!==null&&!o.is(this);)t.push(o),o=o.getNextSibling();return t}getNextSibling(){let t=this.getLatest().__next;return t===null?null:Fn(t)}getNextSiblings(){let t=[],n=this.getNextSibling();for(;n!==null;)t.push(n),n=n.getNextSibling();return t}getCommonAncestor(t){let n=re(this)?this:this.getParent(),o=re(t)?t:t.getParent(),r=n&&o?Hc(n,o):null;return r?r.commonAncestor:null}is(t){return t!=null&&this.__key===t.__key}isBefore(t){let n=Hc(this,t);return n!==null&&(n.type==="descendant"||(n.type==="branch"?Qy(n)===-1:(n.type!=="same"&&n.type!=="ancestor"&&de(279),!1)))}isParentOf(t){let n=Hc(this,t);return n!==null&&n.type==="ancestor"}getNodesBetween(t){let n=this.isBefore(t),o=[],r=new Set,a=this;for(;a!==null;){let i=a.__key;if(r.has(i)||(r.add(i),o.push(a)),a===t)break;let s=re(a)?n?a.getFirstChild():a.getLastChild():null;if(s!==null){a=s;continue}let l=n?a.getNextSibling():a.getPreviousSibling();if(l!==null){a=l;continue}let d=a.getParentOrThrow();if(r.has(d.__key)||o.push(d),d===t)break;let c=null,f=d;do{if(f===null&&de(68),c=n?f.getNextSibling():f.getPreviousSibling(),f=f.getParent(),f===null)break;c!==null||r.has(f.__key)||o.push(f)}while(c===null);a=c}return n||o.reverse(),o}isDirty(){let t=Xt()._dirtyLeaves;return t!==null&&t.has(this.__key)}getLatest(){if(Jp(this))return this;let t=Fn(this.__key);return t===null&&de(113),t}getWritable(){if(Jp(this))return this;$n();let t=Oa(),n=Xt(),o=t._nodeMap,r=this.__key,a=this.getLatest(),i=n._cloneNotNeeded,s=Ot();if(s!==null&&s.setCachedNodes(null),i.has(r))return om(a),a;let l=Vy(a);return i.add(r),om(l),o.set(r,l),l}getTextContent(){return""}getTextContentSize(){return this.getTextContent().length}createDOM(t,n){de(70)}updateDOM(t,n,o){de(71)}exportDOM(t){return{element:this.createDOM(t._config,t)}}exportJSON(){let t=this.__state?this.__state.toJSON():void 0;return{type:this.__type,version:1,...t}}static importJSON(t){de(18,this.name)}updateFromJSON(t){return(function(n,o){let r=n.getWritable(),a=o.$,i=a;for(let s of TL(r).flatKeys)s in o&&(i!==void 0&&i!==a||(i={...a}),i[s]=o[s]);return(r.__state||i)&&py(n).updateFromJSON(i),r})(this,t)}static transform(){return null}remove(t){Jv(this,!0,t)}replace(t,n){$n();let o=Ot();o!==null&&(o=o.clone()),Ev(this,t);let r=this.getLatest(),a=this.__key,i=t.__key,s=t.getWritable(),l=this.getParentOrThrow().getWritable(),d=l.__size;Ii(s);let c=r.getPreviousSibling(),f=r.getNextSibling(),p=r.__prev,m=r.__next,g=r.__parent;if(Jv(r,!1,!0),c===null?l.__first=i:c.getWritable().__next=i,s.__prev=p,f===null?l.__last=i:f.getWritable().__prev=i,s.__next=m,s.__parent=g,l.__size=d,n&&(re(this)&&re(s)||de(139),this.getChildren().forEach(h=>{s.append(h)})),Ge(o)){_o(o);let h=o.anchor,v=o.focus;h.key===a&&Vk(h,s),v.key===a&&Vk(v,s)}return wi()===a&&Kn(i),s}insertAfter(t,n=!0){$n(),Ev(this,t);let o=this.getWritable(),r=t.getWritable(),a=r.getParent(),i=Ot(),s=!1,l=!1;if(a!==null){let m=t.getIndexWithinParent();if(Ii(r),Ge(i)){let g=a.__key,h=i.anchor,v=i.focus;s=h.type==="element"&&h.key===g&&h.offset===m+1,l=v.type==="element"&&v.key===g&&v.offset===m+1}}let d=this.getNextSibling(),c=this.getParentOrThrow().getWritable(),f=r.__key,p=o.__next;if(d===null?c.__last=f:d.getWritable().__prev=f,c.__size++,o.__next=f,r.__next=p,r.__prev=o.__key,r.__parent=o.__parent,n&&Ge(i)){let m=this.getIndexWithinParent();em(i,c,m+1);let g=c.__key;s&&i.anchor.set(g,m+2,"element"),l&&i.focus.set(g,m+2,"element")}return t}insertBefore(t,n=!0){$n(),Ev(this,t);let o=this.getWritable(),r=t.getWritable(),a=r.__key;Ii(r);let i=this.getPreviousSibling(),s=this.getParentOrThrow().getWritable(),l=o.__prev,d=this.getIndexWithinParent();i===null?s.__first=a:i.getWritable().__next=a,s.__size++,o.__prev=a,r.__prev=l,r.__next=o.__key,r.__parent=o.__parent;let c=Ot();return n&&Ge(c)&&em(c,this.getParentOrThrow(),d),t}isParentRequired(){return!1}createParentElementNode(){return Na()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(t,n){$n();let o=this.getPreviousSibling(),r=this.getParentOrThrow();if(o===null)return r.select(0,0);if(re(o))return o.select();if(!ze(o)){let a=o.getIndexWithinParent()+1;return r.select(a,a)}return o.select(t,n)}selectNext(t,n){$n();let o=this.getNextSibling(),r=this.getParentOrThrow();if(o===null)return r.select();if(re(o))return o.select(0,0);if(!ze(o)){let a=o.getIndexWithinParent();return r.select(a,a)}return o.select(t,n)}markDirty(){this.getWritable()}reconcileObservedMutation(t,n){this.markDirty()}},H$="historic",$$="history-push",Up="history-merge",K$="paste",rP="collaboration",V$="skip-collab",aP="skip-scroll-into-view",iP="skip-dom-selection",Zv="skip-selection-focus",sP="composition-start",lP="composition-end",Kl=class e extends pr{static getType(){return"linebreak"}static clone(t){return new e(t.__key)}constructor(t){super(t)}getTextContent(){return`
|
|
3776
|
+
`}createDOM(){return document.createElement("br")}updateDOM(){return!1}isInline(){return!0}static importDOM(){return{br:t=>(function(n){let o=n.parentElement;if(o!==null&&ay(o)){let r=o.firstChild;if(r===n||r.nextSibling===n&&Mp(r)){let a=o.lastChild;if(a===n||a.previousSibling===n&&Mp(a))return!0}}return!1})(t)||(function(n){let o=n.parentElement;if(o!==null&&ay(o)){let r=o.firstChild;if(r===n||r.nextSibling===n&&Mp(r))return!1;let a=o.lastChild;if(a===n||a.previousSibling===n&&Mp(a))return!0}return!1})(t)?null:{conversion:q$,priority:0}}}static importJSON(t){return Vl().updateFromJSON(t)}};function q$(e){return{node:Vl()}}function Vl(){return au(new Kl)}function ks(e){return e instanceof Kl}function Mp(e){return ca(e)&&/^( |\t|\r?\n)+$/.test(e.textContent||"")}function Tv(e,t){return 16&t?"code":t&cy?"mark":32&t?"sub":64&t?"sup":null}function kv(e,t){return 1&t?"strong":2&t?"em":"span"}function dP(e,t,n,o,r){let a=o.classList,i=$l(r,"base");i!==void 0&&a.add(...i),i=$l(r,"underlineStrikethrough");let s=!1,l=8&t&&4&t;i!==void 0&&(8&n&&4&n?(s=!0,l||a.add(...i)):l&&a.remove(...i));for(let d in lo){let c=lo[d];if(i=$l(r,d),i!==void 0)if(n&c){if(s&&(d==="underline"||d==="strikethrough")){t&c&&a.remove(...i);continue}((t&c)===0||l&&d==="underline"||d==="strikethrough")&&a.add(...i)}else t&c&&a.remove(...i)}}function cP(e,t,n){let o=t.firstChild,r=n.isComposing(),a=e+(r?Kc:"");if(o==null)t.textContent=a;else{let i=o.nodeValue;if(i!==a)if(r||Ti){let[s,l,d]=(function(c,f){let p=c.length,m=f.length,g=0,h=0;for(;g<p&&g<m&&c[g]===f[g];)g++;for(;h+g<p&&h+g<m&&c[p-h-1]===f[m-h-1];)h++;return[g,p-g-h,f.slice(g,m-h)]})(i,a);l!==0&&o.deleteData(s,l),o.insertData(s,d)}else o.nodeValue=a}}function Hk(e,t,n,o,r,a){cP(r,e,t);let i=a.theme.text;i!==void 0&&dP(0,0,o,e,i)}function Np(e,t){let n=document.createElement(t);return n.appendChild(e),n}var As=class e extends pr{__text;__format;__style;__mode;__detail;static getType(){return"text"}static clone(t){return new e(t.__text,t.__key)}afterCloneFrom(t){super.afterCloneFrom(t),this.__text=t.__text,this.__format=t.__format,this.__style=t.__style,this.__mode=t.__mode,this.__detail=t.__detail}constructor(t="",n){super(n),this.__text=t,this.__format=0,this.__style="",this.__mode=0,this.__detail=0}getFormat(){return this.getLatest().__format}getDetail(){return this.getLatest().__detail}getMode(){let t=this.getLatest();return f$[t.__mode]}getStyle(){return this.getLatest().__style}isToken(){return this.getLatest().__mode===1}isComposing(){return this.__key===wi()}isSegmented(){return this.getLatest().__mode===2}isDirectionless(){return!!(1&this.getLatest().__detail)}isUnmergeable(){return!!(2&this.getLatest().__detail)}hasFormat(t){let n=lo[t];return(this.getFormat()&n)!==0}isSimpleText(){return this.__type==="text"&&this.__mode===0}getTextContent(){return this.getLatest().__text}getFormatFlags(t,n){return Jc(this.getLatest().__format,t,n)}canHaveFormat(){return!0}isInline(){return!0}createDOM(t,n){let o=this.__format,r=Tv(0,o),a=kv(0,o),i=r===null?a:r,s=document.createElement(i),l=s;this.hasFormat("code")&&s.setAttribute("spellcheck","false"),r!==null&&(l=document.createElement(a),s.appendChild(l)),Hk(l,this,0,o,this.__text,t);let d=this.__style;return d!==""&&(s.style.cssText=d),s}updateDOM(t,n,o){let r=this.__text,a=t.__format,i=this.__format,s=Tv(0,a),l=Tv(0,i),d=kv(0,a),c=kv(0,i);if((s===null?d:s)!==(l===null?c:l))return!0;if(s===l&&d!==c){let h=n.firstChild;h==null&&de(48);let v=document.createElement(c);return Hk(v,this,0,i,r,o),n.replaceChild(v,h),!1}let f=n;l!==null&&s!==null&&(f=n.firstChild,f==null&&de(49)),cP(r,f,this);let p=o.theme.text;p!==void 0&&a!==i&&dP(0,a,i,f,p);let m=t.__style,g=this.__style;return m!==g&&(n.style.cssText=g),!1}static importDOM(){return{"#text":()=>({conversion:Q$,priority:0}),b:()=>({conversion:G$,priority:0}),code:()=>({conversion:Pa,priority:0}),em:()=>({conversion:Pa,priority:0}),i:()=>({conversion:Pa,priority:0}),mark:()=>({conversion:Pa,priority:0}),s:()=>({conversion:Pa,priority:0}),span:()=>({conversion:W$,priority:0}),strong:()=>({conversion:Pa,priority:0}),sub:()=>({conversion:Pa,priority:0}),sup:()=>({conversion:Pa,priority:0}),u:()=>({conversion:Pa,priority:0})}}static importJSON(t){return Hn().updateFromJSON(t)}updateFromJSON(t){return super.updateFromJSON(t).setTextContent(t.text).setFormat(t.format).setDetail(t.detail).setMode(t.mode).setStyle(t.style)}exportDOM(t){let{element:n}=super.exportDOM(t);return So(n)||de(132),n.style.whiteSpace="pre-wrap",this.hasFormat("lowercase")?n.style.textTransform="lowercase":this.hasFormat("uppercase")?n.style.textTransform="uppercase":this.hasFormat("capitalize")&&(n.style.textTransform="capitalize"),this.hasFormat("bold")&&(n=Np(n,"b")),this.hasFormat("italic")&&(n=Np(n,"i")),this.hasFormat("strikethrough")&&(n=Np(n,"s")),this.hasFormat("underline")&&(n=Np(n,"u")),{element:n}}exportJSON(){return{detail:this.getDetail(),format:this.getFormat(),mode:this.getMode(),style:this.getStyle(),text:this.getTextContent(),...super.exportJSON()}}selectionTransform(t,n){}setFormat(t){let n=this.getWritable();return n.__format=typeof t=="string"?lo[t]:t,n}setDetail(t){let n=this.getWritable();return n.__detail=typeof t=="string"?d$[t]:t,n}setStyle(t){let n=this.getWritable();return n.__style=t,n}toggleFormat(t){let n=Jc(this.getFormat(),t,null);return this.setFormat(n)}toggleDirectionless(){let t=this.getWritable();return t.__detail^=1,t}toggleUnmergeable(){let t=this.getWritable();return t.__detail^=2,t}setMode(t){let n=u$[t];if(this.__mode===n)return this;let o=this.getWritable();return o.__mode=n,o}setTextContent(t){if(this.__text===t)return this;let n=this.getWritable();return n.__text=t,n}select(t,n){$n();let o=t,r=n,a=Ot(),i=this.getTextContent(),s=this.__key;if(typeof i=="string"){let l=i.length;o===void 0&&(o=l),r===void 0&&(r=l)}else o=0,r=0;if(!Ge(a))return pP(s,o,s,r,"text","text");{let l=wi();l!==a.anchor.key&&l!==a.focus.key||Kn(s),a.setTextNodeRange(this,o,this,r)}return a}selectStart(){return this.select(0,0)}selectEnd(){let t=this.getTextContentSize();return this.select(t,t)}spliceText(t,n,o,r){let a=this.getWritable(),i=a.__text,s=o.length,l=t;l<0&&(l=s+l,l<0&&(l=0));let d=Ot();if(r&&Ge(d)){let f=t+s;d.setTextNodeRange(a,f,a,f)}let c=i.slice(0,l)+o+i.slice(l+n);return a.__text=c,a}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...t){$n();let n=this.getLatest(),o=n.getTextContent();if(o==="")return[];let r=n.__key,a=wi(),i=o.length;t.sort((I,T)=>I-T),t.push(i);let s=[],l=t.length;for(let I=0,T=0;I<i&&T<=l;T++){let A=t[T];A>I&&(s.push(o.slice(I,A)),I=A)}let d=s.length;if(d===1)return[n];let c=s[0],f=n.getParent(),p,m=n.getFormat(),g=n.getStyle(),h=n.__detail,v=!1,y=null,x=null,C=Ot();if(Ge(C)){let[I,T]=C.isBackward()?[C.focus,C.anchor]:[C.anchor,C.focus];I.type==="text"&&I.key===r&&(y=I),T.type==="text"&&T.key===r&&(x=T)}n.isSegmented()?(p=Hn(c),p.__format=m,p.__style=g,p.__detail=h,p.__state=Ak(n,p),v=!0):p=n.setTextContent(c);let w=[p];for(let I=1;I<d;I++){let T=Hn(s[I]);T.__format=m,T.__style=g,T.__detail=h,T.__state=Ak(n,T);let A=T.__key;a===r&&Kn(A),w.push(T)}let L=y?y.offset:null,S=x?x.offset:null,k=0;for(let I of w){if(!y&&!x)break;let T=k+I.getTextContentSize();if(y!==null&&L!==null&&L<=T&&L>=k&&(y.set(I.getKey(),L-k,"text"),L<T&&(y=null)),x!==null&&S!==null&&S<=T&&S>=k){x.set(I.getKey(),S-k,"text");break}k=T}if(f!==null){(function(A){let P=A.getPreviousSibling(),_=A.getNextSibling();P!==null&&om(P),_!==null&&om(_)})(this);let I=f.getWritable(),T=this.getIndexWithinParent();v?(I.splice(T,0,w),this.remove()):I.splice(T,1,w),Ge(C)&&em(C,f,T,d-1)}return w}mergeWithSibling(t){let n=t===this.getPreviousSibling();n||t===this.getNextSibling()||de(50);let o=this.__key,r=t.__key,a=this.__text,i=a.length;wi()===r&&Kn(o);let s=Ot();if(Ge(s)){let f=s.anchor,p=s.focus;f!==null&&f.key===r&&Yk(f,n,o,t,i),p!==null&&p.key===r&&Yk(p,n,o,t,i)}let l=t.__text,d=n?l+a:a+l;this.setTextContent(d);let c=this.getWritable();return t.remove(),c}isTextEntity(){return!1}};function W$(e){return{forChild:Ty(e.style),node:null}}function G$(e){let t=e,n=t.style.fontWeight==="normal";return{forChild:Ty(t.style,n?void 0:"bold"),node:null}}var $k=new WeakMap;function j$(e){if(!So(e))return!1;if(e.nodeName==="PRE")return!0;let t=e.style.whiteSpace;return typeof t=="string"&&t.startsWith("pre")}function Q$(e){let t=e;e.parentElement===null&&de(129);let n=t.textContent||"";if((function(o){let r,a=o.parentNode,i=[o];for(;a!==null&&(r=$k.get(a))===void 0&&!j$(a);)i.push(a),a=a.parentNode;let s=r===void 0?a:r;for(let l=0;l<i.length;l++)$k.set(i[l],s);return s})(t)!==null){let o=n.split(/(\r?\n|\t)/),r=[],a=o.length;for(let i=0;i<a;i++){let s=o[i];s===`
|
|
3777
3777
|
`||s===`\r
|
|
3778
|
-
`?r.push(
|
|
3779
|
-
`),c=!p.isEmpty();else if(c=!1,ze(p)){let m=p.getTextContent();p===n?p===o?r.type==="element"&&a.type==="element"&&a.offset!==r.offset||(m=s<l?m.slice(s,l):m.slice(l,s)):m=i?m.slice(s):m.slice(l):p===o&&(m=i?m.slice(0,l):m.slice(0,s)),d+=m}else!
|
|
3778
|
+
`?r.push(Vl()):s===" "?r.push(cm()):s!==""&&r.push(Hn(s))}return{node:r}}if(n=n.replace(/\r/g,"").replace(/[ \t\n]+/g," "),n==="")return{node:null};if(n[0]===" "){let o=t,r=!0;for(;o!==null&&(o=Kk(o,!1))!==null;){let a=o.textContent||"";if(a.length>0){/[ \t\n]$/.test(a)&&(n=n.slice(1)),r=!1;break}}r&&(n=n.slice(1))}if(n[n.length-1]===" "){let o=t,r=!0;for(;o!==null&&(o=Kk(o,!0))!==null;)if((o.textContent||"").replace(/^( |\t|\r?\n)+/,"").length>0){r=!1;break}r&&(n=n.slice(0,n.length-1))}return n===""?{node:null}:{node:Hn(n)}}function Kk(e,t){let n=e;for(;;){let o;for(;(o=t?n.nextSibling:n.previousSibling)===null;){let a=n.parentElement;if(a===null)return null;n=a}if(n=o,So(n)){let a=n.style.display;if(a===""&&!HP(n)||a!==""&&!a.startsWith("inline"))return null}let r=n;for(;(r=t?n.firstChild:n.lastChild)!==null;)n=r;if(ca(n))return n;if(n.nodeName==="BR")return null}}var X$={code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};function Pa(e){let t=X$[e.nodeName.toLowerCase()];return t===void 0?{node:null}:{forChild:Ty(e.style,t),node:null}}function Hn(e=""){return au(new As(e))}function ze(e){return e instanceof As}function Ty(e,t){let n=e.fontWeight,o=e.textDecoration.split(" "),r=n==="700"||n==="bold",a=o.includes("line-through"),i=e.fontStyle==="italic",s=o.includes("underline"),l=e.verticalAlign;return d=>(ze(d)&&(r&&!d.hasFormat("bold")&&d.toggleFormat("bold"),a&&!d.hasFormat("strikethrough")&&d.toggleFormat("strikethrough"),i&&!d.hasFormat("italic")&&d.toggleFormat("italic"),s&&!d.hasFormat("underline")&&d.toggleFormat("underline"),l!=="sub"||d.hasFormat("subscript")||d.toggleFormat("subscript"),l!=="super"||d.hasFormat("superscript")||d.toggleFormat("superscript"),t&&!d.hasFormat(t)&&d.toggleFormat(t)),d)}var ql=class e extends As{static getType(){return"tab"}static clone(t){return new e(t.__key)}constructor(t){super(" ",t),this.__detail=2}static importDOM(){return null}createDOM(t){let n=super.createDOM(t),o=$l(t.theme,"tab");return o!==void 0&&n.classList.add(...o),n}static importJSON(t){return cm().updateFromJSON(t)}setTextContent(t){return t!==" "&&t!==""&&hL(126),super.setTextContent(" ")}spliceText(t,n,o,r){return o===""&&n===0||o===" "&&n===1||de(286),this}setDetail(t){return t!==2&&de(127),this}setMode(t){return t!=="normal"&&de(128),this}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}};function cm(){return au(new ql)}function ky(e){return e instanceof ql}var ey=class{key;offset;type;_selection;constructor(t,n,o){this._selection=null,this.key=t,this.offset=n,this.type=o}is(t){return this.key===t.key&&this.offset===t.offset&&this.type===t.type}isBefore(t){return this.key===t.key?this.offset<t.offset:jy(Er(Ei(this,"next")),Er(Ei(t,"next")))<0}getNode(){let t=Fn(this.key);return t===null&&de(20),t}set(t,n,o,r){let a=this._selection,i=this.key;r&&this.key===t&&this.offset===n&&this.type===o||(this.key=t,this.offset=n,this.type=o,ed()||(wi()===i&&Kn(t),a!==null&&(a.setCachedNodes(null),a.dirty=!0)))}};function _r(e,t,n){return new ey(e,t,n)}function Lv(e,t){let n=t.__key,o=e.offset,r="element";if(ze(t)){r="text";let a=t.getTextContentSize();o>a&&(o=a)}else if(!re(t)){let a=t.getNextSibling();if(ze(a))n=a.__key,o=0,r="text";else{let i=t.getParent();i&&(n=i.__key,o=t.getIndexWithinParent()+1)}}e.set(n,o,r)}function Vk(e,t){if(re(t)){let n=t.getLastDescendant();re(n)||ze(n)?Lv(e,n):Lv(e,t)}else Lv(e,t)}var Zp=class e{_nodes;_cachedNodes;dirty;constructor(t){this._cachedNodes=null,this._nodes=t,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(t){this._cachedNodes=t}is(t){if(!tu(t))return!1;let n=this._nodes,o=t._nodes;return n.size===o.size&&Array.from(n).every(r=>o.has(r))}isCollapsed(){return!1}isBackward(){return!1}getStartEndPoints(){return null}add(t){this.dirty=!0,this._nodes.add(t),this._cachedNodes=null}delete(t){this.dirty=!0,this._nodes.delete(t),this._cachedNodes=null}clear(){this.dirty=!0,this._nodes.clear(),this._cachedNodes=null}has(t){return this._nodes.has(t)}clone(){return new e(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(t){}insertText(){}insertNodes(t){let n=this.getNodes(),o=n.length,r=n[o-1],a;if(ze(r))a=r.select();else{let i=r.getIndexWithinParent()+1;a=r.getParentOrThrow().select(i,i)}a.insertNodes(t);for(let i=0;i<o;i++)n[i].remove()}getNodes(){let t=this._cachedNodes;if(t!==null)return t;let n=this._nodes,o=[];for(let r of n){let a=Fn(r);a!==null&&o.push(a)}return ed()||(this._cachedNodes=o),o}getTextContent(){let t=this.getNodes(),n="";for(let o=0;o<t.length;o++)n+=t[o].getTextContent();return n}deleteNodes(){let t=this.getNodes();if((Ot()||Ns())===this&&t[0]){let n=Wn(t[0],"next");WP(Ai(n,n))}for(let n of t)n.remove()}};function Ge(e){return e instanceof Es}var Es=class e{format;style;anchor;focus;_cachedNodes;dirty;constructor(t,n,o,r){this.anchor=t,this.focus=n,t._selection=this,n._selection=this,this._cachedNodes=null,this.format=o,this.style=r,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(t){this._cachedNodes=t}is(t){return!!Ge(t)&&this.anchor.is(t.anchor)&&this.focus.is(t.focus)&&this.format===t.format&&this.style===t.style}isCollapsed(){return this.anchor.is(this.focus)}getNodes(){let t=this._cachedNodes;if(t!==null)return t;let n=(function(o){let r=[],[a,i]=o.getTextSlices();a&&r.push(a.caret.origin);let s=new Set,l=new Set;for(let d of o)if(Mr(d)){let{origin:c}=d;r.length===0?s.add(c):(l.add(c),r.push(c))}else{let{origin:c}=d;re(c)&&l.has(c)||r.push(c)}if(i&&r.push(i.caret.origin),Ms(o.focus)&&re(o.focus.origin)&&o.focus.getNodeAtCaret()===null)for(let d=Da(o.focus.origin,"previous");Mr(d)&&s.has(d.origin)&&!d.origin.isEmpty()&&d.origin.is(r[r.length-1]);d=Jl(d))s.delete(d.origin),r.pop();for(;r.length>1;){let d=r[r.length-1];if(!re(d)||l.has(d)||d.isEmpty()||s.has(d))break;r.pop()}if(r.length===0&&o.isCollapsed()){let d=Er(o.anchor),c=Er(o.anchor.getFlipped()),f=m=>_a(m)?m.origin:m.getNodeAtCaret(),p=f(d)||f(c)||(o.anchor.getNodeAtCaret()?d.origin:c.origin);r.push(p)}return r})(Xy(dy(this),"next"));return ed()||(this._cachedNodes=n),n}setTextNodeRange(t,n,o,r){this.anchor.set(t.__key,n,"text"),this.focus.set(o.__key,r,"text")}getTextContent(){let t=this.getNodes();if(t.length===0)return"";let n=t[0],o=t[t.length-1],r=this.anchor,a=this.focus,i=r.isBefore(a),[s,l]=ty(this),d="",c=!0;for(let f=0;f<t.length;f++){let p=t[f];if(re(p)&&!p.isInline())c||(d+=`
|
|
3779
|
+
`),c=!p.isEmpty();else if(c=!1,ze(p)){let m=p.getTextContent();p===n?p===o?r.type==="element"&&a.type==="element"&&a.offset!==r.offset||(m=s<l?m.slice(s,l):m.slice(l,s)):m=i?m.slice(s):m.slice(l):p===o&&(m=i?m.slice(0,l):m.slice(0,s)),d+=m}else!en(p)&&!ks(p)||p===o&&this.isCollapsed()||(d+=p.getTextContent())}return d}applyDOMRange(t){let n=Xt(),o=n.getEditorState()._selection,r=fP(t.startContainer,t.startOffset,t.endContainer,t.endOffset,n,o);if(r===null)return;let[a,i]=r;this.anchor.set(a.key,a.offset,a.type,!0),this.focus.set(i.key,i.offset,i.type,!0),Vp(this)}clone(){let t=this.anchor,n=this.focus;return new e(_r(t.key,t.offset,t.type),_r(n.key,n.offset,n.type),this.format,this.style)}toggleFormat(t){this.format=Jc(this.format,t,null),this.dirty=!0}setFormat(t){this.format=t,this.dirty=!0}setStyle(t){this.style=t,this.dirty=!0}hasFormat(t){let n=lo[t];return(this.format&n)!==0}insertRawText(t){let n=t.split(/(\r?\n|\t)/),o=[],r=n.length;for(let a=0;a<r;a++){let i=n[a];i===`
|
|
3780
3780
|
`||i===`\r
|
|
3781
|
-
`?o.push(ql()):i===" "?o.push(um()):o.push(Hn(i))}this.insertNodes(o)}insertText(t){let n=this.anchor,o=this.focus,r=this.format,a=this.style,i=n,s=o;!this.isCollapsed()&&o.isBefore(n)&&(i=o,s=n),i.type==="element"&&(function(v,y,x,C){let w=v.getNode(),L=w.getChildAtIndex(v.offset),S=Hn();if(S.setFormat(x),S.setStyle(C),xP(L))L.splice(0,0,[S]);else{let k=to(w)?_a().append(S):S;L===null?w.append(k):L.insertBefore(k)}v.is(y)&&y.set(S.__key,0,"text"),v.set(S.__key,0,"text")})(i,s,r,a),s.type==="element"&&ed(s,Rr(Ri(s,"next")));let l=i.offset,d=s.offset,c=this.getNodes(),f=c.length,p=c[0];ze(p)||de(26);let m=p.getTextContent().length,g=p.getParentOrThrow(),h=c[f-1];if(f===1&&s.type==="element"&&(d=m,s.set(i.key,d,"text")),this.isCollapsed()&&l===m&&(Ra(p)||!p.canInsertTextAfter()||!g.canInsertTextAfter()&&p.getNextSibling()===null)){let v=p.getNextSibling();if(ze(v)&&v.canInsertTextBefore()&&!Ra(v)||(v=Hn(),v.setFormat(r),v.setStyle(a),g.canInsertTextAfter()?p.insertAfter(v):g.insertAfter(v)),v.select(0,0),p=v,t!=="")return void this.insertText(t)}else if(this.isCollapsed()&&l===0&&(Ra(p)||!p.canInsertTextBefore()||!g.canInsertTextBefore()&&p.getPreviousSibling()===null)){let v=p.getPreviousSibling();if(ze(v)&&!Ra(v)||(v=Hn(),v.setFormat(r),g.canInsertTextBefore()?p.insertBefore(v):g.insertBefore(v)),v.select(),p=v,t!=="")return void this.insertText(t)}else if(p.isSegmented()&&l!==m){let v=Hn(p.getTextContent());v.setFormat(r),p.replace(v),p=v}else if(!this.isCollapsed()&&t!==""){let v=h.getParent();if(!g.canInsertTextBefore()||!g.canInsertTextAfter()||re(v)&&(!v.canInsertTextBefore()||!v.canInsertTextAfter()))return this.insertText(""),dP(this.anchor,this.focus),void this.insertText(t)}if(f===1){if(Ii(p)){let C=Hn(t);return C.select(),void p.replace(C)}let v=p.getFormat(),y=p.getStyle();if(l!==d||v===r&&y===a){if(Ly(p)){let C=Hn(t);return C.setFormat(r),C.setStyle(a),C.select(),void p.replace(C)}}else{if(p.getTextContent()!==""){let C=Hn(t);if(C.setFormat(r),C.setStyle(a),C.select(),l===0)p.insertBefore(C,!1);else{let[w]=p.splitText(l);w.insertAfter(C,!1)}return void(C.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=t.length))}p.setFormat(r),p.setStyle(a)}let x=d-l;p=p.spliceText(l,x,t,!0),p.getTextContent()===""?p.remove():this.anchor.type==="text"&&(this.format=v,this.style=y,p.isComposing()&&(this.anchor.offset-=t.length))}else{let v=new Set([...p.getParentKeys(),...h.getParentKeys()]),y=re(p)?p:p.getParentOrThrow(),x=re(h)?h:h.getParentOrThrow(),C=h;if(!y.is(x)&&x.isInline())do C=x,x=x.getParentOrThrow();while(x.isInline());if(s.type==="text"&&(d!==0||h.getTextContent()==="")||s.type==="element"&&h.getIndexWithinParent()<d)if(ze(h)&&!Ii(h)&&d!==h.getTextContentSize()){if(h.isSegmented()){let I=Hn(h.getTextContent());h.replace(I),h=I}to(s.getNode())||s.type!=="text"||(h=h.spliceText(0,d,"")),v.add(h.__key)}else{let I=h.getParentOrThrow();I.canBeEmpty()||I.getChildrenSize()!==1?h.remove():I.remove()}else v.add(h.__key);let w=x.getChildren(),L=new Set(c),S=y.is(x),k=y.isInline()&&p.getNextSibling()===null?y:p;for(let I=w.length-1;I>=0;I--){let T=w[I];if(T.is(p)||re(T)&&T.isParentOf(p))break;T.isAttached()&&(!L.has(T)||T.is(C)?S||k.insertAfter(T,!1):T.remove())}if(!S){let I=x,T=null;for(;I!==null;){let A=I.getChildren(),P=A.length;(P===0||A[P-1].is(T))&&(v.delete(I.__key),T=I),I=I.getParent()}}if(Ii(p))if(l===m)p.select();else{let I=Hn(t);I.select(),p.replace(I)}else p=p.spliceText(l,m-l,t,!0),p.getTextContent()===""?p.remove():this.anchor.type==="text"&&(this.format=p.getFormat(),this.style=p.getStyle(),p.isComposing()&&(this.anchor.offset-=t.length));for(let I=1;I<f;I++){let T=c[I],A=T.__key;v.has(A)||T.remove()}}}removeText(){let t=Ft()===this;Kc(this,qP(cy(this))),t&&Ft()!==this&&_o(this)}formatText(t,n=null){if(this.isCollapsed())return this.toggleFormat(t),void Kn(null);let o=this.getNodes(),r=[];for(let w of o)ze(w)&&r.push(w);let a=w=>{o.forEach(L=>{if(re(L)){let S=L.getFormatFlags(t,w);L.setTextFormat(S)}})},i=r.length;if(i===0)return this.toggleFormat(t),Kn(null),void a(n);let s=this.anchor,l=this.focus,d=this.isBackward(),c=d?l:s,f=d?s:l,p=0,m=r[0],g=c.type==="element"?0:c.offset;if(c.type==="text"&&g===m.getTextContentSize()&&(p=1,m=r[1],g=0),m==null)return;let h=m.getFormatFlags(t,n);a(h);let v=i-1,y=r[v],x=f.type==="text"?f.offset:y.getTextContentSize();if(m.is(y)){if(g===x)return;if(Ra(m)||g===0&&x===m.getTextContentSize())m.setFormat(h);else{let w=m.splitText(g,x),L=g===0?w[0]:w[1];L.setFormat(h),c.type==="text"&&c.set(L.__key,0,"text"),f.type==="text"&&f.set(L.__key,x-g,"text")}return void(this.format=h)}g===0||Ra(m)||([,m]=m.splitText(g),g=0),m.setFormat(h);let C=y.getFormatFlags(t,h);x>0&&(x===y.getTextContentSize()||Ra(y)||([y]=y.splitText(x)),y.setFormat(C));for(let w=p+1;w<v;w++){let L=r[w],S=L.getFormatFlags(t,C);L.setFormat(S)}c.type==="text"&&c.set(m.__key,g,"text"),f.type==="text"&&f.set(y.__key,x,"text"),this.format=h|C}insertNodes(t){if(t.length===0)return;if(this.isCollapsed()||this.removeText(),this.anchor.key==="root"){this.insertParagraph();let g=Ft();return Ge(g)||de(134),g.insertNodes(t)}let n=(this.isBackward()?this.focus:this.anchor).getNode(),o=Hc(n,Na),r=t[t.length-1];if(re(o)&&"__language"in o){if("__language"in t[0])this.insertText(t[0].getTextContent());else{let g=Av(this);o.splice(g,0,t),r.selectEnd()}return}if(!t.some(g=>(re(g)||tn(g))&&!g.isInline())){re(o)||de(211,n.constructor.name,n.getType());let g=Av(this);return o.splice(g,0,t),void r.selectEnd()}let a=(function(g){let h=_a(),v=null;for(let y=0;y<g.length;y++){let x=g[y],C=Ps(x);if(C||tn(x)&&x.isInline()||re(x)&&x.isInline()||ze(x)||x.isParentRequired()){if(v===null&&(v=x.createParentElementNode(),h.append(v),C))continue;v!==null&&v.append(x)}else h.append(x),v=null}return h})(t),i=a.getLastDescendant(),s=a.getChildren(),l=!re(o)||!o.isEmpty()?this.insertParagraph():null,d=s[s.length-1],c=s[0];var f;re(f=c)&&Na(f)&&!f.isEmpty()&&re(o)&&(!o.isEmpty()||o.canMergeWhenEmpty())&&(re(o)||de(211,n.constructor.name,n.getType()),o.append(...c.getChildren()),c=s[1]),c&&(o===null&&de(212,n.constructor.name,n.getType()),(function(g,h){let v=h.getParentOrThrow().getLastChild(),y=h,x=[h];for(;y!==v;)y.getNextSibling()||de(140),y=y.getNextSibling(),x.push(y);let C=g;for(let w of x)C=C.insertAfter(w)})(o,c));let p=Hc(i,Na);l&&re(p)&&(l.canMergeWhenEmpty()||Na(d))&&(p.append(...l.getChildren()),l.remove()),re(o)&&o.isEmpty()&&o.remove(),i.selectEnd();let m=re(o)?o.getLastChild():null;Ps(m)&&p!==o&&m.remove()}insertParagraph(){if(this.anchor.key==="root"){let i=_a();return Qo().splice(this.anchor.offset,0,[i]),i.select(),i}let t=Av(this),n=Hc(this.anchor.getNode(),Na);re(n)||de(213);let o=n.getChildAtIndex(t),r=o?[o,...o.getNextSiblings()]:[],a=n.insertNewAfter(this,!1);return a?(a.append(...r),a.selectStart(),a):null}insertLineBreak(t){let n=ql();if(this.insertNodes([n]),t){let o=n.getParentOrThrow(),r=n.getIndexWithinParent();o.select(r,r)}}extract(){let t=[...this.getNodes()],n=t.length,o=t[0],r=t[n-1],[a,i]=ny(this),s=this.isBackward(),[l,d]=s?[this.focus,this.anchor]:[this.anchor,this.focus],[c,f]=s?[i,a]:[a,i];if(n===0)return[];if(n===1){if(ze(o)&&!this.isCollapsed()){let p=o.splitText(c,f),m=c===0?p[0]:p[1];return m?(l.set(m.getKey(),0,"text"),d.set(m.getKey(),m.getTextContentSize(),"text"),[m]):[]}return[o]}if(ze(o)&&(c===o.getTextContentSize()?t.shift():c!==0&&([,o]=o.splitText(c),t[0]=o,l.set(o.getKey(),0,"text"))),ze(r)){let p=r.getTextContent().length;f===0?t.pop():f!==p&&([r]=r.splitText(f),t[t.length-1]=r,d.set(r.getKey(),r.getTextContentSize(),"text"))}return t}modify(t,n,o){if(Yk(this,t,n,o))return;let r=t==="move",a=Yt(),i=Fr(Xo(a));if(!i)return;let s=a._blockCursorElement,l=a._rootElement,d=this.focus.getNode();if(l===null||s===null||!re(d)||d.isInline()||d.canBeEmpty()||ay(s,a,l),this.dirty){let c=Ql(a,this.anchor.key),f=Ql(a,this.focus.key);this.anchor.type==="text"&&(c=Ns(c)),this.focus.type==="text"&&(f=Ns(f)),c&&f&&pP(i,c,this.anchor.offset,f,this.focus.offset)}if((function(c,f,p,m){c.modify(f,p,m)})(i,t,n?"backward":"forward",o),i.rangeCount>0){let c=i.getRangeAt(0),f=this.anchor.getNode(),p=to(f)?f:DP(f);if(this.applyDOMRange(c),this.dirty=!0,!r){let m=this.getNodes(),g=[],h=!1;for(let v=0;v<m.length;v++){let y=m[v];am(y,p)?g.push(y):h=!0}if(h&&g.length>0)if(n){let v=g[0];re(v)?v.selectStart():v.getParentOrThrow().selectStart()}else{let v=g[g.length-1];re(v)?v.selectEnd():v.getParentOrThrow().selectEnd()}i.anchorNode===c.startContainer&&i.anchorOffset===c.startOffset||(function(v){let y=v.focus,x=v.anchor,C=x.key,w=x.offset,L=x.type;x.set(y.key,y.offset,y.type,!0),y.set(C,w,L,!0)})(this)}}o==="lineboundary"&&Yk(this,t,n,o,"decorators")}forwardDeletion(t,n,o){if(!o&&(t.type==="element"&&re(n)&&t.offset===n.getChildrenSize()||t.type==="text"&&t.offset===n.getTextContentSize())){let r=n.getParent(),a=n.getNextSibling()||(r===null?null:r.getNextSibling());if(re(a)&&a.isShadowRoot())return!0}return!1}deleteCharacter(t){let n=this.isCollapsed();if(this.isCollapsed()){let o=this.anchor,r=o.getNode();if(this.forwardDeletion(o,r,t))return;let a=Gy(Ri(o,t?"previous":"next"));if(a.getTextSlices().every(s=>s===null||s.distance===0)){let s={type:"initial"};for(let l of a.iterNodeCarets("shadowRoot"))if(Nr(l)){if(!l.origin.isInline()){if(l.origin.isShadowRoot()){if(s.type==="merge-block")break;if(re(a.anchor.origin)&&a.anchor.origin.isEmpty()){let d=Rr(l);Kc(this,Ei(d,d)),a.anchor.origin.remove()}return}s.type!=="merge-next-block"&&s.type!=="merge-block"||(s={block:s.block,caret:l,type:"merge-block"})}}else{if(s.type==="merge-block")break;if(_s(l)){if(re(l.origin)){if(l.origin.isInline()){if(!l.origin.isParentOf(a.anchor.origin))break}else s={block:l.origin,type:"merge-next-block"};continue}if(tn(l.origin)){if(!l.origin.isIsolated())if(s.type==="merge-next-block"&&(l.origin.isKeyboardSelectable()||!l.origin.isInline())&&re(a.anchor.origin)&&a.anchor.origin.isEmpty()){a.anchor.origin.remove();let d=Py();d.add(l.origin.getKey()),_o(d)}else l.origin.remove();return}break}}if(s.type==="merge-block"){let{caret:l,block:d}=s;return Kc(this,Ei(!l.origin.isEmpty()&&d.isEmpty()?od(Wn(d,l.direction)):a.anchor,l)),this.removeText()}}let i=this.focus;if(this.modify("extend",t,"character"),this.isCollapsed()){if(t&&o.offset===0&&Vk(this,o.getNode()))return}else{let s=i.type==="text"?i.getNode():null;if(r=o.type==="text"?o.getNode():null,s!==null&&s.isSegmented()){let l=i.offset,d=s.getTextContentSize();if(s.is(r)||t&&l!==d||!t&&l!==0)return void qk(s,t,l)}else if(r!==null&&r.isSegmented()){let l=o.offset,d=r.getTextContentSize();if(r.is(s)||t&&l!==0||!t&&l!==d)return void qk(r,t,l)}(function(l,d){let c=l.anchor,f=l.focus,p=c.getNode(),m=f.getNode();if(p===m&&c.type==="text"&&f.type==="text"){let g=c.offset,h=f.offset,v=g<h,y=v?g:h,x=v?h:g,C=x-1;y!==C&&(function(w){return!(PP(w)||Q$(w))})(p.getTextContent().slice(y,x))&&(d?f.set(f.key,C,f.type):c.set(c.key,C,c.type))}})(this,t)}}if(this.removeText(),t&&!n&&this.isCollapsed()&&this.anchor.type==="element"&&this.anchor.offset===0){let o=this.anchor.getNode();o.isEmpty()&&to(o.getParent())&&o.getPreviousSibling()===null&&Vk(this,o)}}deleteLine(t){this.isCollapsed()&&this.modify("extend",t,"lineboundary"),this.isCollapsed()?this.deleteCharacter(t):this.removeText()}deleteWord(t){if(this.isCollapsed()){let n=this.anchor,o=n.getNode();if(this.forwardDeletion(n,o,t))return;this.modify("extend",t,"word")}this.removeText()}isBackward(){return this.focus.isBefore(this.anchor)}getStartEndPoints(){return[this.anchor,this.focus]}};function nu(e){return e instanceof em}function Kk(e){let t=e.offset;if(e.type==="text")return t;let n=e.getNode();return t===n.getChildrenSize()?n.getTextContent().length:0}function ny(e){let t=e.getStartEndPoints();if(t===null)return[0,0];let[n,o]=t;return n.type==="element"&&o.type==="element"&&n.key===o.key&&n.offset===o.offset?[0,0]:[Kk(n),Kk(o)]}function Vk(e,t){for(let n=t;n;n=n.getParent()){if(re(n)){if(n.collapseAtStart(e))return!0;if(gr(n))break}if(n.getPreviousSibling())break}return!1}var Q$=(()=>{try{let e=new RegExp("\\p{Emoji}","u"),t=e.test.bind(e);if(t("\u2764\uFE0F")&&t("#\uFE0F\u20E3")&&t("\u{1F44D}"))return t}catch{}return()=>!1})();function qk(e,t,n){let o=e,r=o.getTextContent().split(/(?=\s)/g),a=r.length,i=0,s=0;for(let d=0;d<a;d++){let c=d===a-1;if(s=i,i+=r[d].length,t&&i===n||i>n||c){r.splice(d,1),c&&(s=void 0);break}}let l=r.join("").trim();l===""?o.remove():(o.setTextContent(l),o.select(s,s))}function Wk(e,t,n,o){let r,a=t;if(So(e)){let i=!1,s=e.childNodes,l=s.length,d=o._blockCursorElement;a===l&&(i=!0,a=l-1);let c=s[a],f=!1;if(c===d)c=s[a+1],f=!0;else if(d!==null){let p=d.parentNode;e===p&&t>Array.prototype.indexOf.call(p.children,d)&&a--}if(r=Ul(c),ze(r))a=_r(r,i?"next":"previous");else{let p=Ul(e);if(p===null)return null;if(re(p)){let m=o.getElementByKey(p.getKey());m===null&&de(214),[p,a]=p.getDOMSlot(m).resolveChildIndex(p,m,e,t),re(p)||de(215),i&&a>=p.getChildrenSize()&&(a=Math.max(0,p.getChildrenSize()-1));let h=p.getChildAtIndex(a);if(re(h)&&(function(v,y,x){let C=v.getParent();return x===null||C===null||!C.canBeEmpty()||C!==x.getNode()})(h,0,n)){let v=i?h.getLastDescendant():h.getFirstDescendant();v===null?p=h:(h=v,p=re(h)?h:h.getParentOrThrow()),a=0}ze(h)?(r=h,p=null,a=_r(h,i?"next":"previous")):h!==p&&i&&!f&&(re(p)||de(216),a=Math.min(p.getChildrenSize(),a+1))}else{let m=p.getIndexWithinParent();a=t===0&&tn(p)&&Ul(e)===p?m:m+1,p=p.getParentOrThrow()}if(re(p))return Dr(p.__key,a,"element")}}else r=Ul(e);return ze(r)?Dr(r.__key,_r(r,a,"clamp"),"text"):null}function Gk(e,t,n){let o=e.offset,r=e.getNode();if(o===0){let a=r.getPreviousSibling(),i=r.getParent();if(t){if((n||!t)&&a===null&&re(i)&&i.isInline()){let s=i.getPreviousSibling();ze(s)&&e.set(s.__key,s.getTextContent().length,"text")}}else re(a)&&!n&&a.isInline()?e.set(a.__key,a.getChildrenSize(),"element"):ze(a)&&e.set(a.__key,a.getTextContent().length,"text")}else if(o===r.getTextContent().length){let a=r.getNextSibling(),i=r.getParent();if(t&&re(a)&&a.isInline())e.set(a.__key,0,"element");else if((n||t)&&a===null&&re(i)&&i.isInline()&&!i.canInsertTextAfter()){let s=i.getNextSibling();ze(s)&&e.set(s.__key,0,"text")}}}function dP(e,t,n){if(e.type==="text"&&t.type==="text"){let o=e.isBefore(t),r=e.is(t);Gk(e,o,r),Gk(t,!o,r),r&&t.set(e.key,e.offset,e.type)}}function cP(e,t,n,o,r,a){if(e===null||n===null||!ou(r,e,n))return null;let i=Wk(e,t,Ge(a)?a.anchor:null,r);if(i===null)return null;let s=Wk(n,o,Ge(a)?a.focus:null,r);if(s===null)return null;if(i.type==="element"&&s.type==="element"){let l=Ul(e),d=Ul(n);if(tn(l)&&tn(d))return null}return dP(i,s),[i,s]}function X$(e){return re(e)&&!e.isInline()}function uP(e,t,n,o,r,a){let i=Fa(),s=new Ms(Dr(e,t,r),Dr(n,o,a),0,"");return s.dirty=!0,i._selection=s,s}function fP(){let e=Dr("root",0,"element"),t=Dr("root",0,"element");return new Ms(e,t,0,"")}function Py(){return new em(new Set)}function Y$(e,t){return fm(null,e,t,null)}function fm(e,t,n,o){let r=n._window;if(r===null)return null;let a=o||r.event,i=a?a.type:void 0,s=i==="selectionchange",l=!Ov&&(s||i==="beforeinput"||i==="compositionstart"||i==="compositionend"||i==="click"&&a&&a.detail===3||i==="drop"||i===void 0),d,c,f,p;if(Ge(e)&&!l)return e.clone();if(t===null)return null;if(d=t.anchorNode,c=t.focusNode,f=t.anchorOffset,p=t.focusOffset,(s||i===void 0)&&Ge(e)&&!ou(n,d,c))return e.clone();let m=cP(d,f,c,p,n,e);if(m===null)return null;let[g,h]=m,v=0,y="";if(Ge(e)){let x=e.anchor;if(g.key===x.key)v=e.format,y=e.style;else{let C=g.getNode();ze(C)?(v=C.getFormat(),y=C.getStyle()):re(C)&&(v=C.getTextFormat(),y=C.getTextStyle())}}return new Ms(g,h,v,y)}function Ft(){return Fa()._selection}function Ds(){return Yt()._editorState._selection}function tm(e,t,n,o=1){let r=e.anchor,a=e.focus,i=r.getNode(),s=a.getNode();if(!t.is(i)&&!t.is(s))return;let l=t.__key;if(e.isCollapsed()){let d=r.offset;if(n<=d&&o>0||n<d&&o<0){let c=Math.max(0,d+o);r.set(l,c,"element"),a.set(l,c,"element"),jk(e)}}else{let d=e.isBackward(),c=d?a:r,f=c.getNode(),p=d?r:a,m=p.getNode();if(t.is(f)){let g=c.offset;(n<=g&&o>0||n<g&&o<0)&&c.set(l,Math.max(0,g+o),"element")}if(t.is(m)){let g=p.offset;(n<=g&&o>0||n<g&&o<0)&&p.set(l,Math.max(0,g+o),"element")}}jk(e)}function jk(e){let t=e.anchor,n=t.offset,o=e.focus,r=o.offset,a=t.getNode(),i=o.getNode();if(e.isCollapsed()){if(!re(a))return;let s=a.getChildrenSize(),l=n>=s,d=l?a.getChildAtIndex(s-1):a.getChildAtIndex(n);if(ze(d)){let c=0;l&&(c=d.getTextContentSize()),t.set(d.__key,c,"text"),o.set(d.__key,c,"text")}return}if(re(a)){let s=a.getChildrenSize(),l=n>=s,d=l?a.getChildAtIndex(s-1):a.getChildAtIndex(n);if(ze(d)){let c=0;l&&(c=d.getTextContentSize()),t.set(d.__key,c,"text")}}if(re(i)){let s=i.getChildrenSize(),l=r>=s,d=l?i.getChildAtIndex(s-1):i.getChildAtIndex(r);if(ze(d)){let c=0;l&&(c=d.getTextContentSize()),o.set(d.__key,c,"text")}}}function nm(e,t,n,o,r){let a=null,i=0,s=null;o!==null?(a=o.__key,ze(o)?(i=o.getTextContentSize(),s="text"):re(o)&&(i=o.getChildrenSize(),s="element")):r!==null&&(a=r.__key,ze(r)?s="text":re(r)&&(s="element")),a!==null&&s!==null?e.set(a,i,s):(i=t.getIndexWithinParent(),i===-1&&(i=n.getChildrenSize()),e.set(n.__key,i,"element"))}function Qk(e,t,n,o,r){e.type==="text"?e.set(n,e.offset+(t?0:r),"text"):e.offset>o.getIndexWithinParent()&&e.set(e.key,e.offset-1,"element")}function pP(e,t,n,o,r){try{e.setBaseAndExtent(t,n,o,r)}catch{}}function Xk(e,t,n){let o=Ql(e,t.getKey());if(re(t)){let r=t.getDOMSlot(o);return[r.element,n+r.getFirstChildOffset()]}return[o,n]}function J$(e,t,n,o,r,a,i){let s=o.anchorNode,l=o.focusNode,d=o.anchorOffset,c=o.focusOffset,f=document.activeElement;if(r.has(nP)&&f!==a||f!==null&&_y(f))return;if(!Ge(t))return void(e!==null&&ou(n,s,l)&&o.removeAllRanges());let p=t.anchor,m=t.focus,g=p.getNode(),h=m.getNode(),[v,y]=Xk(n,g,p.offset),[x,C]=Xk(n,h,m.offset),w=t.format,L=t.style,S=t.isCollapsed(),k=v,I=x,T=!1;var A,P,_,E,F;if(p.type==="text"?(k=Ns(v),T=g.getFormat()!==w||g.getStyle()!==L):Ge(e)&&e.anchor.type==="text"&&(T=!0),m.type==="text"&&(I=Ns(x)),k!==null&&I!==null&&(S&&(e===null||T||Ge(e)&&(e.format!==w||e.style!==L))&&(A=w,P=L,_=y,E=p.key,F=performance.now(),QL=[A,P,_,E,F]),d!==y||c!==C||s!==k||l!==I||o.type==="Range"&&S||(f!==null&&a.contains(f)||r.has(ey)||a.focus({preventScroll:!0}),p.type==="element"))){if(pP(o,k,y,I,C),!ki||!t.isCollapsed()||a===null||r.has(ey)||document.activeElement!==null&&a.contains(document.activeElement)||a.focus({preventScroll:!0}),!r.has(oP)&&t.isCollapsed()&&a!==null&&a===document.activeElement){let B=Ge(t)&&t.anchor.type==="element"?k.childNodes[y]||null:o.rangeCount>0?o.getRangeAt(0):null;if(B!==null){let V;if(B instanceof Text){let Q=document.createRange();Q.selectNode(B),V=Q.getBoundingClientRect()}else V=B.getBoundingClientRect();(function(Q,Se,H){let q=Hy(H),ee=$y(q);if(q===null||ee===null)return;let{top:G,bottom:te}=Se,me=0,U=0,Y=H;for(;Y!==null;){let se=Y===q.body;if(se)me=0,U=Xo(Q).innerHeight;else{let ie=Y.getBoundingClientRect();me=ie.top,U=ie.bottom}let ge=0;if(G<me?ge=-(me-G):te>U&&(ge=te-U),ge!==0)if(se)ee.scrollBy(0,ge);else{let ie=Y.scrollTop;Y.scrollTop+=ge;let Ae=Y.scrollTop-ie;G-=Ae,te-=Ae}if(se)break;Y=au(Y)}})(n,V,a)}}Yv=!0}}function Z$(e){let t=Ft()||Ds();t===null&&(t=Qo().selectEnd()),t.insertNodes(e)}function eK(){let e=Ft();return e===null?"":e.getTextContent()}function Av(e){let t=e;e.isCollapsed()||t.removeText();let n=Ft();Ge(n)&&(t=n),Ge(t)||de(161);let o=t.anchor,r=o.getNode(),a=o.offset;for(;!Na(r);){let i=r;if([r,a]=tK(r,a),i.is(r))break}return a}function tK(e,t){let n=e.getParent();if(!n){let r=_a();return Qo().append(r),r.select(),[Qo(),0]}if(ze(e)){let r=e.splitText(t);if(r.length===0)return[n,e.getIndexWithinParent()];let a=t===0?0:1;return[n,r[0].getIndexWithinParent()+a]}if(!re(e)||t===0)return[n,e.getIndexWithinParent()];let o=e.getChildAtIndex(t);if(o){let r=new Ms(Dr(e.__key,t,"element"),Dr(e.__key,t,"element"),0,""),a=e.insertNewAfter(r);a&&a.append(o,...o.getNextSiblings())}return[n,e.getIndexWithinParent()+1]}function Yk(e,t,n,o,r="decorators-and-blocks"){if(t==="move"&&o==="character"&&!e.isCollapsed()){let[c,f]=n===e.isBackward()?[e.focus,e.anchor]:[e.anchor,e.focus];return f.set(c.key,c.offset,c.type),!0}let a=Ri(e.focus,n?"previous":"next"),i=o==="lineboundary",s=t==="move",l=a,d=r==="decorators-and-blocks";if(!WP(l)){for(let c of l){d=!1;let{origin:f}=c;if(!tn(f)||f.isIsolated()||(l=c,!i||!f.isInline()))break}if(d)for(let c of Gy(a).iterNodeCarets(t==="extend"?"shadowRoot":"root")){if(Nr(c))c.origin.isInline()||(l=c);else{if(re(c.origin))continue;tn(c.origin)&&!c.origin.isInline()&&(l=c)}break}}if(l===a)return!1;if(s&&!i&&tn(l.origin)&&l.origin.isKeyboardSelectable()){let c=Py();return c.add(l.origin.getKey()),_o(c),!0}return l=Rr(l),s&&ed(e.anchor,l),ed(e.focus,l),d||!i}var Vn=null,qn=null,No=!1,Ev=!1,$p=0,Jk={characterData:!0,childList:!0,subtree:!0};function td(){return No||Vn!==null&&Vn._readOnly}function $n(){No&&de(13)}function mP(){$p>99&&de(14)}function Fa(){return Vn===null&&de(195,gP()),Vn}function Yt(){return qn===null&&de(196,gP()),qn}function gP(){let e=0,t=new Set,n=Pi.version;if(typeof window<"u")for(let r of document.querySelectorAll("[contenteditable]")){let a=ru(r);if(mm(a))e++;else if(a){let i=String(a.constructor.version||"<0.17.1");i===n&&(i+=" (separately built, likely a bundler configuration issue)"),t.add(i)}}let o=` Detected on the page: ${e} compatible editor(s) with version ${n}`;return t.size&&(o+=` and incompatible editors with versions ${Array.from(t).join(", ")}`),o}function nK(){return qn}function Zk(e,t,n){let o=t.__type,r=My(e,o),a=n.get(o);a===void 0&&(a=Array.from(r.transforms),n.set(o,a));let i=a.length;for(let s=0;s<i&&(a[s](t),t.isAttached());s++);}function eL(e,t){return e!==void 0&&e.__key!==t&&e.isAttached()}function hP(e,t){if(!t)return;let n=e._updateTags,o=t;Array.isArray(t)||(o=[t]);for(let r of o)n.add(r)}function oK(e){return Ay(e,Yt()._nodes)}function Ay(e,t){let n=e.type,o=t.get(n);o===void 0&&de(17,n);let r=o.klass;e.type!==r.getType()&&de(18,r.name);let a=r.importJSON(e),i=e.children;if(re(a)&&Array.isArray(i))for(let s=0;s<i.length;s++){let l=Ay(i[s],t);a.append(l)}return a}function tL(e,t,n){let o=Vn,r=No,a=qn;Vn=t,No=!0,qn=e;try{return n()}finally{Vn=o,No=r,qn=a}}function Ma(e,t){let n=e._pendingEditorState,o=e._rootElement,r=e._headless||o===null;if(n===null)return;let a=e._editorState,i=a._selection,s=n._selection,l=e._dirtyType!==0,d=Vn,c=No,f=qn,p=e._updating,m=e._observer,g=null;if(e._pendingEditorState=null,e._editorState=n,!r&&l&&m!==null){qn=e,Vn=n,No=!1,e._updating=!0;try{let S=e._dirtyType,k=e._dirtyElements,I=e._dirtyLeaves;m.disconnect(),g=w$(a,n,e,S,k,I)}catch(S){if(S instanceof Error&&e._onError(S),Ev)throw S;return CP(e,null,o,n),bL(e),e._dirtyType=2,Ev=!0,Ma(e,a),void(Ev=!1)}finally{m.observe(o,Jk),e._updating=p,Vn=d,No=c,qn=f}}n._readOnly||(n._readOnly=!0);let h=e._dirtyLeaves,v=e._dirtyElements,y=e._normalizedNodes,x=e._updateTags,C=e._deferred;l&&(e._dirtyType=0,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements=new Map,e._normalizedNodes=new Set,e._updateTags=new Set),(function(S,k){let I=S._decorators,T=S._pendingDecorators||I,A=k._nodeMap,P;for(P in T)A.has(P)||(T===I&&(T=kP(S)),delete T[P])})(e,n);let w=r?null:Fr(Xo(e));if(e._editable&&w!==null&&(l||s===null||s.dirty||!s.is(i))&&o!==null&&!x.has(rP)){qn=e,Vn=n;try{if(m!==null&&m.disconnect(),l||s===null||s.dirty){let S=e._blockCursorElement;S!==null&&ay(S,e,o),J$(i,s,e,w,x,o)}(function(S,k,I){let T=S._blockCursorElement;if(Ge(I)&&I.isCollapsed()&&I.anchor.type==="element"&&k.contains(document.activeElement)){let A=I.anchor,P=A.getNode(),_=A.offset,E=!1,F=null;if(_===P.getChildrenSize())Mv(P.getChildAtIndex(_-1))&&(E=!0);else{let B=P.getChildAtIndex(_);if(B!==null&&Mv(B)){let V=B.getPreviousSibling();(V===null||Mv(V))&&(E=!0,F=S.getElementByKey(B.__key))}}if(E){let B=S.getElementByKey(P.__key);return T===null&&(S._blockCursorElement=T=(function(V){let Q=V.theme,Se=document.createElement("div");Se.contentEditable="false",Se.setAttribute("data-lexical-cursor","true");let H=Q.blockCursor;if(H!==void 0){if(typeof H=="string"){let q=lu(H);H=Q.blockCursor=q}H!==void 0&&Se.classList.add(...H)}return Se})(S._config)),k.style.caretColor="transparent",void(F===null?B.appendChild(T):B.insertBefore(T,F))}}T!==null&&ay(T,S,k)})(e,o,s)}finally{m!==null&&m.observe(o,Jk),qn=f,Vn=d}}g!==null&&(function(S,k,I,T,A){let P=Array.from(S._listeners.mutation),_=P.length;for(let E=0;E<_;E++){let[F,B]=P[E];for(let V of B){let Q=k.get(V);Q!==void 0&&F(Q,{dirtyLeaves:T,prevEditorState:A,updateTags:I})}}})(e,g,x,h,a),Ge(s)||s===null||i!==null&&i.is(s)||e.dispatchCommand(gy,void 0);let L=e._pendingDecorators;L!==null&&(e._decorators=L,e._pendingDecorators=null,Uc("decorator",e,!0,L)),(function(S,k,I){let T=aL(k),A=aL(I);T!==A&&Uc("textcontent",S,!0,A)})(e,t||a,n),Uc("update",e,!0,{dirtyElements:v,dirtyLeaves:h,editorState:n,mutatedNodes:g,normalizedNodes:y,prevEditorState:t||a,tags:x}),(function(S,k){if(S._deferred=[],k.length!==0){let I=S._updating;S._updating=!0;try{for(let T=0;T<k.length;T++)k[T]()}finally{S._updating=I}}})(e,C),(function(S){let k=S._updates;if(k.length!==0){let I=k.shift();if(I){let[T,A]=I;pm(S,T,A)}}})(e)}function Uc(e,t,n,...o){let r=t._updating;t._updating=n;try{let a=Array.from(t._listeners[e]);for(let i=0;i<a.length;i++)a[i].apply(null,o)}finally{t._updating=r}}function nL(e,t){let n=e._updates,o=t||!1;for(;n.length!==0;){let r=n.shift();if(r){let[a,i]=r,s=e._pendingEditorState,l;i!==void 0&&(l=i.onUpdate,i.skipTransforms&&(o=!0),i.discrete&&(s===null&&de(191),s._flushSync=!0),l&&e._deferred.push(l),hP(e,i.tag)),s==null?pm(e,a,i):a()}}return o}function pm(e,t,n){let o=e._updateTags,r,a=!1,i=!1;n!==void 0&&(r=n.onUpdate,hP(e,n.tag),a=n.skipTransforms||!1,i=n.discrete||!1),r&&e._deferred.push(r);let s=e._editorState,l=e._pendingEditorState,d=!1;(l===null||l._readOnly)&&(l=e._pendingEditorState=vP(l||s),d=!0),l._flushSync=i;let c=Vn,f=No,p=qn,m=e._updating;Vn=l,No=!1,e._updating=!0,qn=e;let g=e._headless||e.getRootElement()===null;Ry(null);try{d&&(g?s._selection!==null&&(l._selection=s._selection.clone()):l._selection=(function(x,C){let w=x.getEditorState()._selection,L=Fr(Xo(x));return Ge(w)||w==null?fm(w,L,x,C):w.clone()})(e,n&&n.event||null));let v=e._compositionKey;t(),a=nL(e,a),(function(x,C){let w=C.getEditorState()._selection,L=x._selection;if(Ge(L)){let S=L.anchor,k=L.focus,I;if(S.type==="text"&&(I=S.getNode(),I.selectionTransform(w,L)),k.type==="text"){let T=k.getNode();I!==T&&T.selectionTransform(w,L)}}})(l,e),e._dirtyType!==0&&(a?(function(x,C){let w=C._dirtyLeaves,L=x._nodeMap;for(let S of w){let k=L.get(S);ze(k)&&k.isAttached()&&k.isSimpleText()&&!k.isUnmergeable()&&Ek(k)}})(l,e):(function(x,C){let w=C._dirtyLeaves,L=C._dirtyElements,S=x._nodeMap,k=Si(),I=new Map,T=w,A=T.size,P=L,_=P.size;for(;A>0||_>0;){if(A>0){C._dirtyLeaves=new Set;for(let E of T){let F=S.get(E);ze(F)&&F.isAttached()&&F.isSimpleText()&&!F.isUnmergeable()&&Ek(F),F!==void 0&&eL(F,k)&&Zk(C,F,I),w.add(E)}if(T=C._dirtyLeaves,A=T.size,A>0){$p++;continue}}C._dirtyLeaves=new Set,C._dirtyElements=new Map,P.delete("root")&&P.set("root",!0);for(let E of P){let F=E[0],B=E[1];if(L.set(F,B),!B)continue;let V=S.get(F);V!==void 0&&eL(V,k)&&Zk(C,V,I)}T=C._dirtyLeaves,A=T.size,P=C._dirtyElements,_=P.size,$p++}C._dirtyLeaves=w,C._dirtyElements=L})(l,e),nL(e),(function(x,C,w,L){let S=x._nodeMap,k=C._nodeMap,I=[];for(let[T]of L){let A=k.get(T);A!==void 0&&(A.isAttached()||(re(A)&&yL(A,T,S,k,I,L),S.has(T)||L.delete(T),I.push(T)))}for(let T of I)k.delete(T);for(let T of w){let A=k.get(T);A===void 0||A.isAttached()||(S.has(T)||w.delete(T),k.delete(T))}})(s,l,e._dirtyLeaves,e._dirtyElements)),v!==e._compositionKey&&(l._flushSync=!0);let y=l._selection;if(Ge(y)){let x=l._nodeMap,C=y.anchor.key,w=y.focus.key;x.get(C)!==void 0&&x.get(w)!==void 0||de(19)}else nu(y)&&y._nodes.size===0&&(l._selection=null)}catch(v){return v instanceof Error&&e._onError(v),e._pendingEditorState=s,e._dirtyType=2,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements.clear(),void Ma(e)}finally{Vn=c,No=f,qn=p,e._updating=m,$p=0}e._dirtyType!==0||e._deferred.length>0||(function(v,y){let x=y.getEditorState()._selection,C=v._selection;if(C!==null){if(C.dirty||!C.is(x))return!0}else if(x!==null)return!0;return!1})(l,e)?l._flushSync?(l._flushSync=!1,Ma(e)):d&&fK(()=>{Ma(e)}):(l._flushSync=!1,d&&(o.clear(),e._deferred=[],e._pendingEditorState=null))}function da(e,t,n){qn===e&&n===void 0?t():pm(e,t,n)}var oy=class e{element;before;after;constructor(t,n,o){this.element=t,this.before=n||null,this.after=o||null}withBefore(t){return new e(this.element,t,this.after)}withAfter(t){return new e(this.element,this.before,t)}withElement(t){return this.element===t?this:new e(t,this.before,this.after)}insertChild(t){let n=this.before||this.getManagedLineBreak();return n!==null&&n.parentElement!==this.element&&de(222),this.element.insertBefore(t,n),this}removeChild(t){return t.parentElement!==this.element&&de(223),this.element.removeChild(t),this}replaceChild(t,n){return n.parentElement!==this.element&&de(224),this.element.replaceChild(t,n),this}getFirstChild(){let t=this.after?this.after.nextSibling:this.element.firstChild;return t===this.before||t===this.getManagedLineBreak()?null:t}getManagedLineBreak(){return this.element.__lexicalLineBreak||null}setManagedLineBreak(t){if(t===null)this.removeManagedLineBreak();else{let n=t==="decorator"&&(lm||tu||sm);this.insertManagedLineBreak(n)}}removeManagedLineBreak(){let t=this.getManagedLineBreak();if(t){let n=this.element,o=t.nodeName==="IMG"?t.nextSibling:null;o&&n.removeChild(o),n.removeChild(t),n.__lexicalLineBreak=void 0}}insertManagedLineBreak(t){let n=this.getManagedLineBreak();if(n){if(t===(n.nodeName==="IMG"))return;this.removeManagedLineBreak()}let o=this.element,r=this.before,a=document.createElement("br");if(o.insertBefore(a,r),t){let i=document.createElement("img");i.setAttribute("data-lexical-linebreak","true"),i.style.cssText="display: inline !important; border: 0px !important; margin: 0px !important;",i.alt="",o.insertBefore(i,a),o.__lexicalLineBreak=i}else o.__lexicalLineBreak=a}getFirstChildOffset(){let t=0;for(let n=this.after;n!==null;n=n.previousSibling)t++;return t}resolveChildIndex(t,n,o,r){if(o===this.element){let l=this.getFirstChildOffset();return[t,Math.min(l+t.getChildrenSize(),Math.max(l,r))]}let a=oL(n,o);a.push(r);let i=oL(n,this.element),s=t.getIndexWithinParent();for(let l=0;l<i.length;l++){let d=a[l],c=i[l];if(d===void 0||d<c)break;if(d>c){s+=1;break}}return[t.getParentOrThrow(),s]}};function oL(e,t){let n=[],o=t;for(;o!==e&&o!==null;o=o.parentNode){let r=0;for(let a=o.previousSibling;a!==null;a=a.previousSibling)r++;n.push(r)}return o!==e&&de(225),n.reverse()}var Li=class extends mr{__first;__last;__size;__format;__style;__indent;__dir;__textFormat;__textStyle;constructor(t){super(t),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(t){super.afterCloneFrom(t),this.__key===t.__key&&(this.__first=t.__first,this.__last=t.__last,this.__size=t.__size),this.__indent=t.__indent,this.__format=t.__format,this.__style=t.__style,this.__dir=t.__dir,this.__textFormat=t.__textFormat,this.__textStyle=t.__textStyle}getFormat(){return this.getLatest().__format}getFormatType(){let t=this.getFormat();return l$[t]||""}getStyle(){return this.getLatest().__style}getIndent(){return this.getLatest().__indent}getChildren(){let t=[],n=this.getFirstChild();for(;n!==null;)t.push(n),n=n.getNextSibling();return t}getChildrenKeys(){let t=[],n=this.getFirstChild();for(;n!==null;)t.push(n.__key),n=n.getNextSibling();return t}getChildrenSize(){return this.getLatest().__size}isEmpty(){return this.getChildrenSize()===0}isDirty(){let t=Yt()._dirtyElements;return t!==null&&t.has(this.__key)}isLastChild(){let t=this.getLatest(),n=this.getParentOrThrow().getLastChild();return n!==null&&n.is(t)}getAllTextNodes(){let t=[],n=this.getFirstChild();for(;n!==null;){if(ze(n)&&t.push(n),re(n)){let o=n.getAllTextNodes();t.push(...o)}n=n.getNextSibling()}return t}getFirstDescendant(){let t=this.getFirstChild();for(;re(t);){let n=t.getFirstChild();if(n===null)break;t=n}return t}getLastDescendant(){let t=this.getLastChild();for(;re(t);){let n=t.getLastChild();if(n===null)break;t=n}return t}getDescendantByIndex(t){let n=this.getChildren(),o=n.length;if(t>=o){let a=n[o-1];return re(a)&&a.getLastDescendant()||a||null}let r=n[t];return re(r)&&r.getFirstDescendant()||r||null}getFirstChild(){let t=this.getLatest().__first;return t===null?null:Fn(t)}getFirstChildOrThrow(){let t=this.getFirstChild();return t===null&&de(45,this.__key),t}getLastChild(){let t=this.getLatest().__last;return t===null?null:Fn(t)}getLastChildOrThrow(){let t=this.getLastChild();return t===null&&de(96,this.__key),t}getChildAtIndex(t){let n=this.getChildrenSize(),o,r;if(t<n/2){for(o=this.getFirstChild(),r=0;o!==null&&r<=t;){if(r===t)return o;o=o.getNextSibling(),r++}return null}for(o=this.getLastChild(),r=n-1;o!==null&&r>=t;){if(r===t)return o;o=o.getPreviousSibling(),r--}return null}getTextContent(){let t="",n=this.getChildren(),o=n.length;for(let r=0;r<o;r++){let a=n[r];t+=a.getTextContent(),re(a)&&r!==o-1&&!a.isInline()&&(t+=dm)}return t}getTextContentSize(){let t=0,n=this.getChildren(),o=n.length;for(let r=0;r<o;r++){let a=n[r];t+=a.getTextContentSize(),re(a)&&r!==o-1&&!a.isInline()&&(t+=2)}return t}getDirection(){return this.getLatest().__dir}getTextFormat(){return this.getLatest().__textFormat}hasFormat(t){if(t!==""){let n=Dv[t];return(this.getFormat()&n)!==0}return!1}hasTextFormat(t){let n=lo[t];return(this.getTextFormat()&n)!==0}getFormatFlags(t,n){return Zc(this.getLatest().__textFormat,t,n)}getTextStyle(){return this.getLatest().__textStyle}select(t,n){$n();let o=Ft(),r=t,a=n,i=this.getChildrenSize();if(!this.canBeEmpty()){if(t===0&&n===0){let l=this.getFirstChild();if(ze(l)||re(l))return l.select(0,0)}else if(!(t!==void 0&&t!==i||n!==void 0&&n!==i)){let l=this.getLastChild();if(ze(l)||re(l))return l.select()}}r===void 0&&(r=i),a===void 0&&(a=i);let s=this.__key;return Ge(o)?(o.anchor.set(s,r,"element"),o.focus.set(s,a,"element"),o.dirty=!0,o):uP(s,r,s,a,"element","element")}selectStart(){let t=this.getFirstDescendant();return t?t.selectStart():this.select()}selectEnd(){let t=this.getLastDescendant();return t?t.selectEnd():this.select()}clear(){let t=this.getWritable();return this.getChildren().forEach(n=>n.remove()),t}append(...t){return this.splice(this.getChildrenSize(),0,t)}setDirection(t){let n=this.getWritable();return n.__dir=t,n}setFormat(t){return this.getWritable().__format=t!==""?Dv[t]:0,this}setStyle(t){return this.getWritable().__style=t||"",this}setTextFormat(t){let n=this.getWritable();return n.__textFormat=t,n}setTextStyle(t){let n=this.getWritable();return n.__textStyle=t,n}setIndent(t){return this.getWritable().__indent=t,this}splice(t,n,o){Zp(this)&&de(324,this.__key,this.__type);let r=this.getChildrenSize(),a=this.getWritable();t+n<=r||de(226,String(t),String(n),String(r));let i=a.__key,s=[],l=[],d=this.getChildAtIndex(t+n),c=null,f=r-n+o.length;if(t!==0)if(t===r)c=this.getLastChild();else{let m=this.getChildAtIndex(t);m!==null&&(c=m.getPreviousSibling())}if(n>0){let m=c===null?this.getFirstChild():c.getNextSibling();for(let g=0;g<n;g++){m===null&&de(100);let h=m.getNextSibling(),v=m.__key;Ti(m.getWritable()),l.push(v),m=h}}let p=c;for(let m of o){p!==null&&m.is(p)&&(c=p=p.getPreviousSibling());let g=m.getWritable();g.__parent===i&&f--,Ti(g);let h=m.__key;if(p===null)a.__first=h,g.__prev=null;else{let v=p.getWritable();v.__next=h,g.__prev=v.__key}m.__key===i&&de(76),g.__parent=i,s.push(h),p=m}if(t+n===r)p!==null&&(p.getWritable().__next=null,a.__last=p.__key);else if(d!==null){let m=d.getWritable();if(p!==null){let g=p.getWritable();m.__prev=p.__key,g.__next=d.__key}else m.__prev=null}if(a.__size=f,l.length){let m=Ft();if(Ge(m)){let g=new Set(l),h=new Set(s),{anchor:v,focus:y}=m;rL(v,g,h)&&nm(v,v.getNode(),this,c,d),rL(y,g,h)&&nm(y,y.getNode(),this,c,d),f!==0||this.canBeEmpty()||gr(this)||this.remove()}}return a}getDOMSlot(t){return new oy(t)}exportDOM(t){let{element:n}=super.exportDOM(t);if(So(n)){let o=this.getIndent();o>0&&(n.style.paddingInlineStart=40*o+"px");let r=this.getDirection();r&&(n.dir=r)}return{element:n}}exportJSON(){let t={children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),...super.exportJSON()},n=this.getTextFormat(),o=this.getTextStyle();return n===0&&o===""||gr(this)||this.getChildren().some(ze)||(n!==0&&(t.textFormat=n),o!==""&&(t.textStyle=o)),t}updateFromJSON(t){return super.updateFromJSON(t).setFormat(t.format).setIndent(t.indent).setDirection(t.direction).setTextFormat(t.textFormat||0).setTextStyle(t.textStyle||"")}insertNewAfter(t,n){return null}canIndent(){return!0}collapseAtStart(t){return!1}excludeFromCopy(t){return!1}canReplaceWith(t){return!0}canInsertAfter(t){return!0}canBeEmpty(){return!0}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}isInline(){return!1}isShadowRoot(){return!1}canMergeWith(t){return!1}extractWithChild(t,n,o){return!1}canMergeWhenEmpty(){return!1}reconcileObservedMutation(t,n){let o=this.getDOMSlot(t),r=o.getFirstChild();for(let a=this.getFirstChild();a;a=a.getNextSibling()){let i=n.getElementByKey(a.getKey());i!==null&&(r==null?(o.insertChild(i),r=i):r!==i&&o.replaceChild(i,r),r=r.nextSibling)}}};function re(e){return e instanceof Li}function rL(e,t,n){let o=e.getNode();for(;o;){let r=o.__key;if(t.has(r)&&!n.has(r))return!0;o=o.getParent()}return!1}var Yc=class extends mr{decorate(t,n){return null}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}};function tn(e){return e instanceof Yc}var Gl=class e extends Li{__cachedText;static getType(){return"root"}static clone(){return new e}constructor(){super("root"),this.__cachedText=null}getTopLevelElementOrThrow(){de(51)}getTextContent(){let t=this.__cachedText;return!td()&&Yt()._dirtyType!==0||t===null?super.getTextContent():t}remove(){de(52)}replace(t){de(53)}insertBefore(t){de(54)}insertAfter(t){de(55)}updateDOM(t,n){return!1}splice(t,n,o){for(let r of o)re(r)||tn(r)||de(282);return super.splice(t,n,o)}static importJSON(t){return Qo().updateFromJSON(t)}collapseAtStart(){return!0}};function to(e){return e instanceof Gl}function vP(e){return new Jc(new Map(e._nodeMap))}function Ey(){return new Jc(new Map([["root",new Gl]]))}function yP(e){let t=e.exportJSON(),n=e.constructor;if(t.type!==n.getType()&&de(130,n.name),re(e)){let o=t.children;Array.isArray(o)||de(59,n.name);let r=e.getChildren();for(let a=0;a<r.length;a++){let i=yP(r[a]);o.push(i)}}return t}function rK(e){return e instanceof Jc}var Jc=class e{_nodeMap;_selection;_flushSync;_readOnly;constructor(t,n){this._nodeMap=t,this._selection=n||null,this._flushSync=!1,this._readOnly=!1}isEmpty(){return this._nodeMap.size===1&&this._selection===null}read(t,n){return tL(n&&n.editor||null,this,t)}clone(t){let n=new e(this._nodeMap,t===void 0?this._selection:t);return n._readOnly=!0,n}toJSON(){return tL(null,this,()=>({root:yP(Qo())}))}},om=class extends Li{static getType(){return"artificial"}createDOM(t){return document.createElement("div")}},jl=class e extends Li{static getType(){return"paragraph"}static clone(t){return new e(t.__key)}createDOM(t){let n=document.createElement("p"),o=Kl(t.theme,"paragraph");return o!==void 0&&n.classList.add(...o),n}updateDOM(t,n,o){return!1}static importDOM(){return{p:t=>({conversion:aK,priority:0})}}exportDOM(t){let{element:n}=super.exportDOM(t);if(So(n)){this.isEmpty()&&n.append(document.createElement("br"));let o=this.getFormatType();o&&(n.style.textAlign=o)}return{element:n}}static importJSON(t){return _a().updateFromJSON(t)}exportJSON(){let t=super.exportJSON();if(t.textFormat===void 0||t.textStyle===void 0){let n=this.getChildren().find(ze);n?(t.textFormat=n.getFormat(),t.textStyle=n.getStyle()):(t.textFormat=this.getTextFormat(),t.textStyle=this.getTextStyle())}return t}insertNewAfter(t,n){let o=_a();o.setTextFormat(t.format),o.setTextStyle(t.style);let r=this.getDirection();return o.setDirection(r),o.setFormat(this.getFormatType()),o.setStyle(this.getStyle()),this.insertAfter(o,n),o}collapseAtStart(){let t=this.getChildren();if(t.length===0||ze(t[0])&&t[0].getTextContent().trim()===""){if(this.getNextSibling()!==null)return this.selectNext(),this.remove(),!0;if(this.getPreviousSibling()!==null)return this.selectPrevious(),this.remove(),!0}return!1}};function aK(e){let t=_a();if(e.style&&(t.setFormat(e.style.textAlign),UP(e,t)),t.getFormatType()===""){let n=e.getAttribute("align");n&&n&&n in Dv&&t.setFormat(n)}return{node:t}}function _a(){return iu(new jl)}function xP(e){return e instanceof jl}var zl=0,iK=1,sK=2,lK=3,dK=4;function CP(e,t,n,o){let r=e._keyToDOMMap;r.clear(),e._editorState=Ey(),e._pendingEditorState=o,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 a=e._observer;a!==null&&(a.disconnect(),e._observer=null),t!==null&&(t.textContent=""),n!==null&&(n.textContent="",r.set("root",n))}function bP(e){let t=new Set,n=new Set,o=e;for(;o;){let{ownNodeConfig:r}=su(o),a=o.transform;if(!n.has(a)){n.add(a);let i=o.transform();i&&t.add(i)}if(r){let i=r.$transform;i&&t.add(i),o=r.extends}else{let i=Object.getPrototypeOf(o);o=i.prototype instanceof mr&&i!==mr?i:void 0}}return t}function cK(e){let t=e||{},n=nK(),o=t.theme||{},r=e===void 0?n:t.parentEditor||null,a=t.disableEvents||!1,i=Ey(),s=t.namespace||(r!==null?r._config.namespace:AP()),l=t.editorState,d=[Gl,Rs,Vl,Wl,jl,om,...t.nodes||[]],{onError:c,html:f}=t,p=t.editable===void 0||t.editable,m;if(e===void 0&&n!==null)m=n._nodes;else{m=new Map;for(let h=0;h<d.length;h++){let v=d[h],y=null,x=null;if(typeof v!="function"){let L=v;v=L.replace,y=L.with,x=L.withKlass||null}su(v);let C=v.getType(),w=bP(v);m.set(C,{exportDOM:f&&f.export?f.export.get(v):void 0,klass:v,replace:y,replaceWithKlass:x,sharedNodeState:wL(d[h]),transforms:w})}}let g=new Pi(i,r,m,{disableEvents:a,namespace:s,theme:o},c||console.error,(function(h,v){let y=new Map,x=new Set,C=w=>{Object.keys(w).forEach(L=>{let S=y.get(L);S===void 0&&(S=[],y.set(L,S)),S.push(w[L])})};return h.forEach(w=>{let L=w.klass.importDOM;if(L==null||x.has(L))return;x.add(L);let S=L.call(w.klass);S!==null&&C(S)}),v&&C(v),y})(m,f?f.import:void 0),p,e);return l!==void 0&&(g._pendingEditorState=l,g._dirtyType=2),(function(h){h.registerCommand(hy,M$,zl),h.registerCommand(vy,N$,zl),h.registerCommand(yy,_$,zl),h.registerCommand(xy,D$,zl),h.registerCommand(Sy,O$,zl)})(g),g}var Pi=class{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(t,n,o,r,a,i,s,l){this._createEditorArgs=l,this._parentEditor=n,this._rootElement=null,this._editorState=t,this._pendingEditorState=null,this._compositionKey=null,this._deferred=[],this._keyToDOMMap=new Map,this._updates=[],this._updating=!1,this._listeners={decorator:new Set,editable:new Set,mutation:new Map,root:new Set,textcontent:new Set,update:new Set},this._commands=new Map,this._config=r,this._nodes=o,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=AP(),this._onError=a,this._htmlConversions=i,this._editable=s,this._headless=n!==null&&n._headless,this._window=null,this._blockCursorElement=null}isComposing(){return this._compositionKey!=null}registerUpdateListener(t){let n=this._listeners.update;return n.add(t),()=>{n.delete(t)}}registerEditableListener(t){let n=this._listeners.editable;return n.add(t),()=>{n.delete(t)}}registerDecoratorListener(t){let n=this._listeners.decorator;return n.add(t),()=>{n.delete(t)}}registerTextContentListener(t){let n=this._listeners.textcontent;return n.add(t),()=>{n.delete(t)}}registerRootListener(t){let n=this._listeners.root;return t(this._rootElement,null),n.add(t),()=>{t(null,this._rootElement),n.delete(t)}}registerCommand(t,n,o){o===void 0&&de(35);let r=this._commands;r.has(t)||r.set(t,[new Set,new Set,new Set,new Set,new Set]);let a=r.get(t);a===void 0&&de(36,String(t));let i=a[o];return i.add(n),()=>{i.delete(n),a.every(s=>s.size===0)&&r.delete(t)}}registerMutationListener(t,n,o){let r=this.resolveRegisteredNodeAfterReplacements(this.getRegisteredNode(t)).klass,a=this._listeners.mutation,i=a.get(n);i===void 0&&(i=new Set,a.set(n,i)),i.add(r);let s=o&&o.skipInitialization;return s!==void 0&&s||this.initializeMutationListener(n,r),()=>{i.delete(r),i.size===0&&a.delete(n)}}getRegisteredNode(t){let n=this._nodes.get(t.getType());return n===void 0&&de(37,t.name),n}resolveRegisteredNodeAfterReplacements(t){for(;t.replaceWithKlass;)t=this.getRegisteredNode(t.replaceWithKlass);return t}initializeMutationListener(t,n){let o=this._editorState,r=sy(o).get(n.getType());if(!r)return;let a=new Map;for(let i of r.keys())a.set(i,"created");a.size>0&&t(a,{dirtyLeaves:new Set,prevEditorState:o,updateTags:new Set(["registerMutationListener"])})}registerNodeTransformToKlass(t,n){let o=this.getRegisteredNode(t);return o.transforms.add(n),o}registerNodeTransform(t,n){let o=this.registerNodeTransformToKlass(t,n),r=[o],a=o.replaceWithKlass;if(a!=null){let i=this.registerNodeTransformToKlass(a,n);r.push(i)}return(function(i,s){let l=sy(i.getEditorState()),d=[];for(let c of s){let f=l.get(c);f&&d.push(f)}d.length!==0&&i.update(()=>{for(let c of d)for(let f of c.keys()){let p=Fn(f);p&&p.markDirty()}},i._pendingEditorState===null?{tag:Hp}:void 0)})(this,r.map(i=>i.klass.getType())),()=>{r.forEach(i=>i.transforms.delete(n))}}hasNode(t){return this._nodes.has(t.getType())}hasNodes(t){return t.every(this.hasNode.bind(this))}dispatchCommand(t,n){return Re(this,t,n)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(t){let n=this._rootElement;if(t!==n){let o=Kl(this._config.theme,"root"),r=this._pendingEditorState||this._editorState;if(this._rootElement=t,CP(this,n,t,r),n!==null&&(this._config.disableEvents||F$(n),o!=null&&n.classList.remove(...o)),t!==null){let a=$y(t),i=t.style;i.userSelect="text",i.whiteSpace="pre-wrap",i.wordBreak="break-word",t.setAttribute("data-lexical-editor","true"),this._window=a,this._dirtyType=2,bL(this),this._updateTags.add(Hp),Ma(this),this._config.disableEvents||(function(s,l){let d=s.ownerDocument;Xv.set(s,d);let c=Yp.get(d)??0;c<1&&d.addEventListener("selectionchange",eP),Yp.set(d,c+1),s.__lexicalEditor=l;let f=ZL(s);for(let p=0;p<Qv.length;p++){let[m,g]=Qv[p],h=typeof g=="function"?v=>{Fk(v)||(Ok(v),(l.isEditable()||m==="click")&&g(v,l))}:v=>{if(Fk(v))return;Ok(v);let y=l.isEditable();switch(m){case"cut":return y&&Re(l,Ty,v);case"copy":return Re(l,Iy,v);case"paste":return y&&Re(l,Cy,v);case"dragstart":return y&&Re(l,HL,v);case"dragover":return y&&Re(l,$L,v);case"dragend":return y&&Re(l,KL,v);case"focus":return y&&Re(l,VL,v);case"blur":return y&&Re(l,qL,v);case"drop":return y&&Re(l,UL,v)}};s.addEventListener(m,h),f.push(()=>{s.removeEventListener(m,h)})}})(t,this),o!=null&&t.classList.add(...o)}else this._window=null,this._updateTags.add(Hp),Ma(this);Uc("root",this,!1,t,n)}}getElementByKey(t){return this._keyToDOMMap.get(t)||null}getEditorState(){return this._editorState}setEditorState(t,n){t.isEmpty()&&de(38);let o=t;o._readOnly&&(o=vP(t),o._selection=t._selection?t._selection.clone():null),CL(this);let r=this._pendingEditorState,a=this._updateTags,i=n!==void 0?n.tag:null;r===null||r.isEmpty()||(i!=null&&a.add(i),Ma(this)),this._pendingEditorState=o,this._dirtyType=2,this._dirtyElements.set("root",!1),this._compositionKey=null,i!=null&&a.add(i),this._updating||Ma(this)}parseEditorState(t,n){return(function(o,r,a){let i=Ey(),s=Vn,l=No,d=qn,c=r._dirtyElements,f=r._dirtyLeaves,p=r._cloneNotNeeded,m=r._dirtyType;r._dirtyElements=new Map,r._dirtyLeaves=new Set,r._cloneNotNeeded=new Set,r._dirtyType=0,Vn=i,No=!1,qn=r,Ry(null);try{let g=r._nodes;Ay(o.root,g),a&&a(),i._readOnly=!0}catch(g){g instanceof Error&&r._onError(g)}finally{r._dirtyElements=c,r._dirtyLeaves=f,r._cloneNotNeeded=p,r._dirtyType=m,Vn=s,No=l,qn=d}return i})(typeof t=="string"?JSON.parse(t):t,this,n)}read(t){return Ma(this),this.getEditorState().read(t,{editor:this})}update(t,n){(function(o,r,a){o._updating?o._updates.push([r,a]):pm(o,r,a)})(this,t,n)}focus(t,n={}){let o=this._rootElement;o!==null&&(o.setAttribute("autocapitalize","off"),da(this,()=>{let r=Ft(),a=Qo();r!==null?r.dirty||_o(r.clone()):a.getChildrenSize()!==0&&(n.defaultSelection==="rootStart"?a.selectStart():a.selectEnd()),vm("focus"),_P(()=>{o.removeAttribute("autocapitalize"),t&&t()})}),this._pendingEditorState===null&&o.removeAttribute("autocapitalize"))}blur(){let t=this._rootElement;t!==null&&t.blur();let n=Fr(this._window);n!==null&&n.removeAllRanges()}isEditable(){return this._editable}setEditable(t){this._editable!==t&&(this._editable=t,Uc("editable",this,!0,t))}toJSON(){return{editorState:this._editorState.toJSON()}}};Pi.version="0.41.0+prod.esm";var ry=null;function Ry(e){ry=e}var wP=1;function uK(){wP=1}function My(e,t){let n=Ny(e,t);return n===void 0&&de(30,t),n}function Ny(e,t){return e._nodes.get(t)}var fK=typeof queueMicrotask=="function"?queueMicrotask:e=>{Promise.resolve().then(e)};function SP(e){return tn(hm(e))}function _y(e){let t=document.activeElement;if(!So(t))return!1;let n=t.nodeName;return tn(hm(e))&&(n==="INPUT"||n==="TEXTAREA"||t.contentEditable==="true"&&ru(t)==null)}function ou(e,t,n){let o=e.getRootElement();try{return o!==null&&o.contains(t)&&o.contains(n)&&t!==null&&!_y(t)&&Dy(t)===e}catch{return!1}}function mm(e){return e instanceof Pi}function Dy(e){let t=e;for(;t!=null;){let n=ru(t);if(mm(n))return n;t=au(t)}return null}function ru(e){return e?e.__lexicalEditor:null}function pK(e){return a$.test(e)?"rtl":i$.test(e)?"ltr":null}function Ii(e){return Ly(e)||e.isToken()}function Ra(e){return Ii(e)||e.isSegmented()}function ca(e){return nd(e)&&e.nodeType===3}function IP(e){return nd(e)&&e.nodeType===9}function Ns(e){let t=e;for(;t!=null;){if(ca(t))return t;t=t.firstChild}return null}function Zc(e,t,n){let o=lo[t];if(n!==null&&(e&o)===(n&o))return e;let r=e^o;return t==="subscript"?r&=~lo.superscript:t==="superscript"?r&=~lo.subscript:t==="lowercase"?(r&=~lo.uppercase,r&=~lo.capitalize):t==="uppercase"?(r&=~lo.lowercase,r&=~lo.capitalize):t==="capitalize"&&(r&=~lo.lowercase,r&=~lo.uppercase),r}function mK(e){return ze(e)||Ps(e)||tn(e)}function TP(e,t){let n=(function(){let i=ry;return ry=null,i})();if((t=t||n&&n.__key)!=null)return void(e.__key=t);$n(),mP();let o=Yt(),r=Fa(),a=""+wP++;r._nodeMap.set(a,e),re(e)?o._dirtyElements.set(a,!0):o._dirtyLeaves.add(a),o._cloneNotNeeded.add(a),o._dirtyType=1,e.__key=a}function Ti(e){let t=e.getParent();if(t!==null){let n=e.getWritable(),o=t.getWritable(),r=e.getPreviousSibling(),a=e.getNextSibling(),i=a!==null?a.__key:null,s=r!==null?r.__key:null,l=r!==null?r.getWritable():null,d=a!==null?a.getWritable():null;r===null&&(o.__first=i),a===null&&(o.__last=s),l!==null&&(l.__next=i),d!==null&&(d.__prev=s),n.__prev=null,n.__next=null,n.__parent=null,o.__size--}}function rm(e){mP(),Zp(e)&&de(323,e.__key,e.__type);let t=e.getLatest(),n=t.__parent,o=Fa(),r=Yt(),a=o._nodeMap,i=r._dirtyElements;n!==null&&(function(l,d,c){let f=l;for(;f!==null;){if(c.has(f))return;let p=d.get(f);if(p===void 0)break;c.set(f,!1),f=p.__parent}})(n,a,i);let s=t.__key;r._dirtyType=1,re(e)?i.set(s,!0):r._dirtyLeaves.add(s)}function Kn(e){$n();let t=Yt(),n=t._compositionKey;if(e!==n){if(t._compositionKey=e,n!==null){let o=Fn(n);o!==null&&o.getWritable()}if(e!==null){let o=Fn(e);o!==null&&o.getWritable()}}}function Si(){return td()?null:Yt()._compositionKey}function Fn(e,t){let n=(t||Fa())._nodeMap.get(e);return n===void 0?null:n}function Oy(e,t){let n=gm(e,Yt());return n!==void 0?Fn(n,t):null}function gm(e,t){return e[`__lexicalKey_${t._key}`]}function hm(e,t){let n=e;for(;n!=null;){let o=Oy(n,t);if(o!==null)return o;n=au(n)}return null}function kP(e){let t=e._decorators,n=Object.assign({},t);return e._pendingDecorators=n,n}function aL(e){return e.read(()=>Qo().getTextContent())}function Qo(){return LP(Fa())}function LP(e){return e._nodeMap.get("root")}function _o(e){$n();let t=Fa();e!==null&&(e.dirty=!0,e.setCachedNodes(null)),t._selection=e}function Ul(e){let t=Yt(),n=(function(o,r){let a=o;for(;a!=null;){let i=gm(a,r);if(i!==void 0)return i;a=au(a)}return null})(e,t);return n===null?e===t.getRootElement()?Fn("root"):null:Fn(n)}function PP(e){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(e)}function Fy(e){let t=[],n=e;for(;n!==null;)t.push(n),n=n._parentEditor;return t}function AP(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,5)}function EP(e){return ca(e)?e.nodeValue:null}function By(e,t,n){let o=Fr(Xo(t));if(o===null)return;let r=o.anchorNode,{anchorOffset:a,focusOffset:i}=o;if(r!==null){let s=EP(r),l=hm(r);if(s!==null&&ze(l)){if((s===Vc||s===fy)&&n){let d=n.length;s=n,a=d,i=d}s!==null&&zy(l,s,a,i,e)}}}function zy(e,t,n,o,r){let a=e;if(a.isAttached()&&(r||!a.isDirty())){let i=a.isComposing(),s=t;if((i||r)&&(t.endsWith(Vc)&&(s=t.slice(0,-Vc.length)),r)){let d=fy,c;for(;(c=s.indexOf(d))!==-1;)s=s.slice(0,c)+s.slice(c+d.length),n!==null&&n>c&&(n=Math.max(c,n-d.length)),o!==null&&o>c&&(o=Math.max(c,o-d.length))}let l=a.getTextContent();if(r||s!==l){if(s===""){if(Kn(null),sm||tu||lm)a.remove();else{let h=Yt();setTimeout(()=>{h.update(()=>{a.isAttached()&&a.remove()})},20)}return}let d=a.getParent(),c=Ds(),f=a.getTextContentSize(),p=Si(),m=a.getKey();if(a.isToken()||p!==null&&m===p&&!i||Ge(c)&&(d!==null&&!d.canInsertTextBefore()&&c.anchor.offset===0||c.anchor.key===e.__key&&c.anchor.offset===0&&!a.canInsertTextBefore()&&!i||c.focus.key===e.__key&&c.focus.offset===f&&!a.canInsertTextAfter()&&!i))return void a.markDirty();let g=Ft();if(!Ge(g)||n===null||o===null)return void iL(a,s,g);if(g.setTextNodeRange(a,n,a,o),a.isSegmented()){let h=Hn(a.getTextContent());a.replace(h),a=h}iL(a,s,g)}}}function iL(e,t,n){if(e.setTextContent(t),Ge(n)){let o=e.getKey();for(let r of["anchor","focus"]){let a=n[r];a.type==="text"&&a.key===o&&(a.offset=_r(e,a.offset,"clamp"))}}}function Dp(e,t,n){let o=t[n]||!1;return o==="any"||o===e[n]}function RP(e,t){return Dp(e,t,"altKey")&&Dp(e,t,"ctrlKey")&&Dp(e,t,"shiftKey")&&Dp(e,t,"metaKey")}function $t(e,t,n){if(!RP(e,n))return!1;if(e.key.toLowerCase()===t.toLowerCase())return!0;if(t.length>1||e.key.length===1&&e.key.charCodeAt(0)<=127)return!1;let o="Key"+t.toUpperCase();return e.code===o}var Ea={ctrlKey:!Er,metaKey:Er},sL={altKey:Er,ctrlKey:!Er};function lL(e){return e.key==="Backspace"}function dL(e){return $t(e,"a",Ea)}function gK(e){let t=Qo();if(Ge(e)){let n=e.anchor,o=e.focus,r=n.getNode().getTopLevelElementOrThrow().getParentOrThrow();return n.set(r.getKey(),0,"element"),o.set(r.getKey(),r.getChildrenSize(),"element"),qp(e),e}{let n=t.select(0,t.getChildrenSize());return _o(qp(n)),n}}function Kl(e,t){e.__lexicalClassNameCache===void 0&&(e.__lexicalClassNameCache={});let n=e.__lexicalClassNameCache,o=n[t];if(o!==void 0)return o;let r=e[t];if(typeof r=="string"){let a=lu(r);return n[t]=a,a}return r}function Uy(e,t,n,o,r){if(n.size===0)return;let a=o.__type,i=o.__key,s=t.get(a);s===void 0&&de(33,a);let l=s.klass,d=e.get(l);d===void 0&&(d=new Map,e.set(l,d));let c=d.get(i),f=c==="destroyed"&&r==="created";(c===void 0||f)&&d.set(i,f?"updated":r)}function hK(e){let t=e.getType(),n=Fa();if(n._readOnly){let a=sy(n).get(t);return a?Array.from(a.values()):[]}let o=n._nodeMap,r=[];for(let[,a]of o)a instanceof e&&a.__type===t&&a.isAttached()&&r.push(a);return r}function cL(e,t,n){let o=e.getParent(),r=n,a=e;return o!==null&&(t&&n===0?(r=a.getIndexWithinParent(),a=o):t||n!==a.getChildrenSize()||(r=a.getIndexWithinParent()+1,a=o)),a.getChildAtIndex(t?r-1:r)}function MP(e,t){let n=e.offset;if(e.type==="element")return cL(e.getNode(),t,n);{let o=e.getNode();if(t&&n===0||!t&&n===o.getTextContentSize()){let r=t?o.getPreviousSibling():o.getNextSibling();return r===null?cL(o.getParentOrThrow(),t,o.getIndexWithinParent()+(t?0:1)):r}}return null}function NP(e){let t=Xo(e).event,n=t&&t.inputType;return n==="insertFromPaste"||n==="insertFromPasteAsQuotation"}function Re(e,t,n){return(function(o,r,a){let i=Fy(o);for(let s=4;s>=0;s--)for(let l=0;l<i.length;l++){let d=i[l],c=d._commands.get(r);if(c!==void 0){let f=c[s];if(f!==void 0){let p=Array.from(f),m=p.length,g=!1;if(da(d,()=>{for(let h=0;h<m;h++)if(p[h](a,o))return void(g=!0)}),g)return g}}}return!1})(e,t,n)}function Ql(e,t){let n=e._keyToDOMMap.get(t);return n===void 0&&de(75,t),n}function au(e){let t=e.assignedSlot||e.parentElement;return BP(t)?t.host:t}function Hy(e){return IP(e)?e:So(e)?e.ownerDocument:null}function vK(e){return Yt()._updateTags.has(e)}function vm(e){$n(),Yt()._updateTags.add(e)}function _P(e){$n(),Yt()._deferred.push(e)}function am(e,t){let n=e.getParent();for(;n!==null;){if(n.is(t))return!0;n=n.getParent()}return!1}function $y(e){let t=Hy(e);return t?t.defaultView:null}function Xo(e){let t=e._window;return t===null&&de(78),t}function yK(e){return re(e)&&e.isInline()||tn(e)&&e.isInline()}function DP(e){let t=e.getParentOrThrow();for(;t!==null;){if(gr(t))return t;t=t.getParentOrThrow()}return t}function gr(e){return to(e)||re(e)&&e.isShadowRoot()}function Ky(e){let t=e.constructor.clone(e);return TP(t,null),t.afterCloneFrom(e),t}function iu(e){let t=Yt(),n=e.getType(),o=Ny(t,n);o===void 0&&de(200,e.constructor.name,n);let{replace:r,replaceWithKlass:a}=o;if(r!==null){let i=r(e),s=i.constructor;return a!==null?i instanceof a||de(201,a.name,a.getType(),s.name,s.getType(),e.constructor.name,n):i instanceof e.constructor&&s!==e.constructor||de(202,s.name,s.getType(),e.constructor.name,n),i.__key===e.__key&&de(203,e.constructor.name,n,s.name,s.getType()),i}return e}function Rv(e,t){!to(e.getParent())||re(t)||tn(t)||de(99)}function OP(e){let t=Fn(e);return t===null&&de(63,e),t}function Mv(e){return(tn(e)||re(e)&&!e.canBeEmpty())&&!e.isInline()}function ay(e,t,n){n.style.removeProperty("caret-color"),t._blockCursorElement=null;let o=e.parentElement;o!==null&&o.removeChild(e)}function Fr(e){return Or?(e||window).getSelection():null}function FP(e){let t=$y(e);return t?t.getSelection():null}function xK(e,t){let n=e.getChildAtIndex(t);n==null&&(n=e),gr(e)&&de(102);let o=i=>{let s=i.getParentOrThrow(),l=gr(s),d=i!==n||l?Ky(i):i;if(l)return re(i)&&re(d)||de(133),i.insertAfter(d),[i,d,d];{let[c,f,p]=o(s),m=i.getNextSiblings();return p.append(d,...m),[c,f,d]}},[r,a]=o(n);return[r,a]}function CK(e){return So(e)&&e.tagName==="A"}function So(e){return nd(e)&&e.nodeType===1}function nd(e){return typeof e=="object"&&e!==null&&"nodeType"in e&&typeof e.nodeType=="number"}function BP(e){return nd(e)&&e.nodeType===11}function zP(e){let t=new 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 e.nodeName.match(t)!==null}function iy(e){let t=new 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 e.nodeName.match(t)!==null}function Na(e){if(tn(e)&&!e.isInline())return!0;if(!re(e)||gr(e))return!1;let t=e.getFirstChild(),n=t===null||Ps(t)||ze(t)||t.isInline();return!e.isInline()&&e.canBeEmpty()!==!1&&n}function Vy(){return Yt()}var uL=new WeakMap,bK=new Map;function sy(e){if(!e._readOnly&&e.isEmpty())return bK;e._readOnly||de(192);let t=uL.get(e);return t||(t=(function(n){let o=new Map;for(let[r,a]of n._nodeMap){let i=a.__type,s=o.get(i);s||(s=new Map,o.set(i,s)),s.set(r,a)}return o})(e),uL.set(e,t)),t}function qy(e){let t=e.constructor.clone(e);return t.afterCloneFrom(e),t}function wK(e){return(t=qy(e))[tP]=!0,t;var t}function UP(e,t){let n=parseInt(e.style.paddingInlineStart,10)||0,o=Math.round(n/40);t.setIndent(o)}function SK(e){e.__lexicalUnmanaged=!0}function HP(e){return e.__lexicalUnmanaged===!0}function Oc(e,t){return(function(n,o){return Object.prototype.hasOwnProperty.call(n,o)})(e,t)&&e[t]!==mr[t]}function su(e){let t=Sk in e.prototype?e.prototype[Sk]():void 0,n=(function(i){if(!(i===mr||i.prototype instanceof mr)){let s="<unknown>",l="<unknown>";try{s=i.getType()}catch{}try{Pi.version&&(l=JSON.parse(Pi.version))}catch{}de(290,i.name,s,l)}return i===Yc||i===Li||i===mr})(e),o=!n&&Oc(e,"getType")?e.getType():void 0,r,a=o;if(t)if(o)r=t[o];else for(let[i,s]of Object.entries(t))a=i,r=s;if(!n&&a&&(Oc(e,"getType")||(e.getType=()=>a),Oc(e,"clone")||(e.clone=i=>(Ry(i),new e)),Oc(e,"importJSON")||(e.importJSON=r&&r.$importJSON||(i=>new e().updateFromJSON(i))),!Oc(e,"importDOM")&&r)){let{importDOM:i}=r;i&&(e.importDOM=()=>i)}return{ownNodeConfig:r,ownNodeType:a}}function IK(e){let t=Vy();return $n(),new(t.resolveRegisteredNodeAfterReplacements(t.getRegisteredNode(e))).klass}var Hc=(e,t)=>{let n=e;for(;n!=null&&!to(n);){if(t(n))return n;n=n.getParent()}return null},TK={next:"previous",previous:"next"},Xl=class{origin;constructor(t){this.origin=t}[Symbol.iterator](){return jy({hasNext:_s,initial:this.getAdjacentCaret(),map:t=>t,step:t=>t.getAdjacentCaret()})}getAdjacentCaret(){return Wn(this.getNodeAtCaret(),this.direction)}getSiblingCaret(){return Wn(this.origin,this.direction)}remove(){let t=this.getNodeAtCaret();return t&&t.remove(),this}replaceOrInsert(t,n){let o=this.getNodeAtCaret();return t.is(this.origin)||t.is(o)||(o===null?this.insert(t):o.replace(t,n)),this}splice(t,n,o="next"){let r=o===this.direction?n:Array.from(n).reverse(),a=this,i=this.getParentAtCaret(),s=new Map;for(let l=a.getAdjacentCaret();l!==null&&s.size<t;l=l.getAdjacentCaret()){let d=l.origin.getWritable();s.set(d.getKey(),d)}for(let l of r){if(s.size>0){let d=a.getNodeAtCaret();if(d){if(s.delete(d.getKey()),s.delete(l.getKey()),!(d.is(l)||a.origin.is(l))){let c=l.getParent();c&&c.is(i)&&l.remove(),d.replace(l)}}else d===null&&de(263,Array.from(s).join(" "))}else a.insert(l);a=Wn(l,this.direction)}for(let l of s.values())l.remove();return this}},eu=class e extends Xl{type="child";getLatest(){let t=this.origin.getLatest();return t===this.origin?this:Oa(t,this.direction)}getParentCaret(t="root"){return Wn(Wy(this.getParentAtCaret(),t),this.direction)}getFlipped(){let t=Ni(this.direction);return Wn(this.getNodeAtCaret(),t)||Oa(this.origin,t)}getParentAtCaret(){return this.origin}getChildCaret(){return this}isSameNodeCaret(t){return t instanceof e&&this.direction===t.direction&&this.origin.is(t.origin)}isSamePointCaret(t){return this.isSameNodeCaret(t)}},kK={root:to,shadowRoot:gr};function Ni(e){return TK[e]}function Wy(e,t="root"){return kK[t](e)?null:e}var Yl=class e extends Xl{type="sibling";getLatest(){let t=this.origin.getLatest();return t===this.origin?this:Wn(t,this.direction)}getSiblingCaret(){return this}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return re(this.origin)?Oa(this.origin,this.direction):null}getParentCaret(t="root"){return Wn(Wy(this.getParentAtCaret(),t),this.direction)}getFlipped(){let t=Ni(this.direction);return Wn(this.getNodeAtCaret(),t)||Oa(this.origin.getParentOrThrow(),t)}isSamePointCaret(t){return t instanceof e&&this.direction===t.direction&&this.origin.is(t.origin)}isSameNodeCaret(t){return(t instanceof e||t instanceof Jl)&&this.direction===t.direction&&this.origin.is(t.origin)}},Jl=class e extends Xl{type="text";offset;constructor(t,n){super(t),this.offset=n}getLatest(){let t=this.origin.getLatest();return t===this.origin?this:Ai(t,this.direction,this.offset)}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return null}getParentCaret(t="root"){return Wn(Wy(this.getParentAtCaret(),t),this.direction)}getFlipped(){return Ai(this.origin,Ni(this.direction),this.offset)}isSamePointCaret(t){return t instanceof e&&this.direction===t.direction&&this.origin.is(t.origin)&&this.offset===t.offset}isSameNodeCaret(t){return(t instanceof Yl||t instanceof e)&&this.direction===t.direction&&this.origin.is(t.origin)}getSiblingCaret(){return Wn(this.origin,this.direction)}};function Da(e){return e instanceof Jl}function LK(e){return e instanceof Xl}function _s(e){return e instanceof Yl}function Nr(e){return e instanceof eu}var PK={next:class extends Jl{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends Jl{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},AK={next:class extends Yl{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends Yl{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},EK={next:class extends eu{direction="next";getNodeAtCaret(){return this.origin.getFirstChild()}insert(e){return this.origin.splice(0,0,[e]),this}},previous:class extends eu{direction="previous";getNodeAtCaret(){return this.origin.getLastChild()}insert(e){return this.origin.splice(this.origin.getChildrenSize(),0,[e]),this}}};function Wn(e,t){return e?new AK[t](e):null}function Ai(e,t,n){return e?new PK[t](e,_r(e,n)):null}function _r(e,t,n="error"){let o=e.getTextContentSize(),r=t==="next"?o:t==="previous"?0:t;return(r<0||r>o)&&(n!=="clamp"&&mL(284,String(t),String(o),e.getKey()),r=r<0?0:o),r}function ly(e,t){return new im(e,t)}function Oa(e,t){return re(e)?new EK[t](e):null}function $P(e){return e&&e.getChildCaret()||e}function Zl(e){return e&&$P(e.getAdjacentCaret())}var dy=class e{type="node-caret-range";direction;anchor;focus;constructor(t,n,o){this.anchor=t,this.focus=n,this.direction=o}getLatest(){let t=this.anchor.getLatest(),n=this.focus.getLatest();return t===this.anchor&&n===this.focus?this:new e(t,n,this.direction)}isCollapsed(){return this.anchor.isSamePointCaret(this.focus)}getTextSlices(){let t=r=>{let a=this[r].getLatest();return Da(a)?(function(i,s){let{direction:l,origin:d}=i,c=_r(d,s==="focus"?Ni(l):l);return ly(i,c-i.offset)})(a,r):null},n=t("anchor"),o=t("focus");if(n&&o){let{caret:r}=n,{caret:a}=o;if(r.isSameNodeCaret(a))return[ly(r,a.offset-r.offset),null]}return[n,o]}iterNodeCarets(t="root"){let n=Da(this.anchor)?this.anchor.getSiblingCaret():this.anchor.getLatest(),o=this.focus.getLatest(),r=Da(o),a=i=>i.isSameNodeCaret(o)?null:Zl(i)||i.getParentCaret(t);return jy({hasNext:i=>i!==null&&!(r&&o.isSameNodeCaret(i)),initial:n.isSameNodeCaret(o)?null:a(n),map:i=>i,step:a})}[Symbol.iterator](){return this.iterNodeCarets("root")}},im=class{type="slice";caret;distance;constructor(t,n){this.caret=t,this.distance=n}getSliceIndices(){let{distance:t,caret:{offset:n}}=this,o=n+t;return o<n?[o,n]:[n,o]}getTextContent(){let[t,n]=this.getSliceIndices();return this.caret.origin.getTextContent().slice(t,n)}getTextContentSize(){return Math.abs(this.distance)}removeTextSlice(){let{caret:{origin:t,direction:n}}=this,[o,r]=this.getSliceIndices(),a=t.getTextContent();return Ai(t.setTextContent(a.slice(0,o)+a.slice(r)),n,o)}};function RK(e){return e instanceof im}function Gy(e){return Ei(e,Wn(Qo(),e.direction))}function KP(e){return Ei(e,e)}function Ei(e,t){return e.direction!==t.direction&&de(265),new dy(e,t,e.direction)}function jy(e){let{initial:t,hasNext:n,step:o,map:r}=e,a=t;return{[Symbol.iterator](){return this},next(){if(!n(a))return{done:!0,value:void 0};let i={done:!1,value:r(a)};return a=o(a),i}}}function Qy(e,t){let n=$c(e.origin,t.origin);switch(n===null&&de(275,e.origin.getKey(),t.origin.getKey()),n.type){case"same":{let o=e.type==="text",r=t.type==="text";return o&&r?(function(a,i){return Math.sign(a-i)})(e.offset,t.offset):e.type===t.type?0:o?-1:r?1:e.type==="child"?-1:1}case"ancestor":return e.type==="child"?-1:1;case"descendant":return t.type==="child"?1:-1;case"branch":return Xy(n)}}function Xy(e){let{a:t,b:n}=e,o=t.__key,r=n.__key,a=t,i=n;for(;a&&i;a=a.getNextSibling(),i=i.getNextSibling()){if(a.__key===r)return-1;if(i.__key===o)return 1}return a===null?1:-1}function Op(e,t){return t.is(e)}function fL(e){return re(e)?[e.getLatest(),null]:[e.getParent(),e.getLatest()]}function $c(e,t){if(e.is(t))return{commonAncestor:e,type:"same"};let n=new Map;for(let[o,r]=fL(e);o;r=o,o=o.getParent())n.set(o,r);for(let[o,r]=fL(t);o;r=o,o=o.getParent()){let a=n.get(o);if(a!==void 0)return a===null?(Op(e,o)||de(276),{commonAncestor:o,type:"ancestor"}):r===null?(Op(t,o)||de(277),{commonAncestor:o,type:"descendant"}):((re(a)||Op(e,a))&&(re(r)||Op(t,r))&&o.is(a.getParent())&&o.is(r.getParent())||de(278),{a,b:r,commonAncestor:o,type:"branch"})}return null}function Ri(e,t){let{type:n,key:o,offset:r}=e,a=OP(e.key);return n==="text"?(ze(a)||de(266,a.getType(),o),Ai(a,t,r)):(re(a)||de(267,a.getType(),o),GP(a,e.offset,t))}function ed(e,t){let{origin:n,direction:o}=t,r=o==="next";Da(t)?e.set(n.getKey(),t.offset,"text"):_s(t)?ze(n)?e.set(n.getKey(),_r(n,o),"text"):e.set(n.getParentOrThrow().getKey(),n.getIndexWithinParent()+(r?1:0),"element"):(Nr(t)&&re(n)||de(268),e.set(n.getKey(),r?0:n.getChildrenSize(),"element"))}function VP(e){let t=Ft(),n=Ge(t)?t:fP();return Kc(n,e),_o(n),n}function Kc(e,t){ed(e.anchor,t.anchor),ed(e.focus,t.focus)}function cy(e){let{anchor:t,focus:n}=e,o=Ri(t,"next"),r=Ri(n,"next"),a=Qy(o,r)<=0?"next":"previous";return Ei(Mi(o,a),Mi(r,a))}function od(e){let{direction:t,origin:n}=e,o=Wn(n,Ni(t)).getNodeAtCaret();return o?Wn(o,t):Oa(n.getParentOrThrow(),t)}function pL(e,t="root"){let n=[e];for(let o=Nr(e)?e.getParentCaret(t):e.getSiblingCaret();o!==null;o=o.getParentCaret(t))n.push(od(o));return n}function Nv(e){return!!e&&e.origin.isAttached()}function qP(e,t="removeEmptySlices"){if(e.isCollapsed())return e;let n="root",o="next",r=t,a=Yy(e,o),i=pL(a.anchor,n),s=pL(a.focus.getFlipped(),n),l=new Set,d=[];for(let g of a.iterNodeCarets(n))if(Nr(g))l.add(g.origin.getKey());else if(_s(g)){let{origin:h}=g;re(h)&&!l.has(h.getKey())||d.push(h)}for(let g of d)g.remove();for(let g of a.getTextSlices()){if(!g)continue;let{origin:h}=g.caret,v=h.getTextContentSize(),y=od(Wn(h,o)),x=h.getMode();if(Math.abs(g.distance)===v&&r==="removeEmptySlices"||x==="token"&&g.distance!==0)y.remove();else if(g.distance!==0){r="removeEmptySlices";let C=g.removeTextSlice(),w=g.caret.origin;if(x==="segmented"){let L=C.origin,S=Hn(L.getTextContent()).setStyle(L.getStyle()).setFormat(L.getFormat());y.replaceOrInsert(S),C=Ai(S,o,C.offset)}w.is(i[0].origin)&&(i[0]=C),w.is(s[0].origin)&&(s[0]=C.getFlipped())}}let c,f;for(let g of i)if(Nv(g)){c=Rr(g);break}for(let g of s)if(Nv(g)){f=Rr(g);break}let p=(function(g,h,v){if(!g||!h)return null;let y=g.getParentAtCaret(),x=h.getParentAtCaret();if(!y||!x)return null;let C=y.getParents().reverse();C.push(y);let w=x.getParents().reverse();w.push(x);let L=Math.min(C.length,w.length),S;for(S=0;S<L&&C[S]===w[S];S++);let k=(A,P)=>{let _;for(let E=S;E<A.length;E++){let F=A[E];if(gr(F))return;!_&&P(F)&&(_=F)}return _},I=k(C,Na),T=I&&k(w,A=>v.has(A.getKey())&&Na(A));return I&&T?[I,T]:null})(c,f,l);if(p){let[g,h]=p;Oa(g,"previous").splice(0,h.getChildren());let v=h.getParent();for(h.remove(!0);v&&v.isEmpty();){let y=v;v=v.getParent(),y.remove(!0)}}let m=[c,f,...i,...s].find(Nv);if(m)return KP(Mi(Rr(m),e.direction));de(269,JSON.stringify(i.map(g=>g.origin.__key)))}function Rr(e){let t=(function(r){let a=r;for(;Nr(a);){let i=Zl(a);if(!Nr(i))break;a=i}return a})(e.getLatest()),{direction:n}=t;if(ze(t.origin))return Da(t)?t:Ai(t.origin,n,n);let o=t.getAdjacentCaret();return _s(o)&&ze(o.origin)?Ai(o.origin,n,Ni(n)):t}function WP(e){return Da(e)&&e.offset!==_r(e.origin,e.direction)}function Mi(e,t){return e.direction===t?e:e.getFlipped()}function Yy(e,t){return e.direction===t?e:Ei(Mi(e.focus,t),Mi(e.anchor,t))}function GP(e,t,n){let o=Oa(e,"next");for(let r=0;r<t;r++){let a=o.getAdjacentCaret();if(a===null)break;o=a}return Mi(o,n)}function MK(e,t="root"){let n=0,o=e,r=Zl(o);for(;r===null;){if(n--,r=o.getParentCaret(t),!r)return null;o=r,r=Zl(o)}return r&&[r,n]}function NK(e){let{origin:t,offset:n,direction:o}=e;if(n===_r(t,o))return e.getSiblingCaret();if(n===_r(t,Ni(o)))return od(e.getSiblingCaret());let[r]=t.splitText(n);return ze(r)||de(281),Mi(Wn(r,"next"),o)}function _K(e,t){return!0}function DK(e,{$copyElementNode:t=Ky,$splitTextPointCaretNext:n=NK,rootMode:o="shadowRoot",$shouldSplit:r=_K}={}){if(Da(e))return n(e);let a=e.getParentCaret(o);if(a){let{origin:i}=a;if(Nr(e)&&(!i.canBeEmpty()||!r(i,"first")))return od(a);let s=(function(l){let d=[];for(let c=l.getAdjacentCaret();c;c=c.getAdjacentCaret())d.push(c.origin);return d})(e);(s.length>0||i.canBeEmpty()&&r(i,"last"))&&a.insert(t(i).splice(0,0,s))}return a}function OK(e){return e}function FK(...e){return e}function BK(e,t){return[e,t]}function zK(e){return e}function UK(e,t){if(!t||e===t)return e;for(let n in t)if(e[n]!==t[n])return{...e,...t};return e}function lu(...e){let t=[];for(let n of e)if(n&&typeof n=="string")for(let[o]of n.matchAll(/\S+/g))t.push(o);return t}function HK(e,...t){let n=lu(...t);n.length>0&&e.classList.add(...n)}function $K(e,...t){let n=lu(...t);n.length>0&&e.classList.remove(...n)}function KK(...e){return()=>{for(let t=e.length-1;t>=0;t--)e[t]();e.length=0}}var M=Jy,nie=M.$addUpdateTag,ym=M.$applyNodeReplacement,rd=M.$caretFromPoint,jP=M.$caretRangeFromSelection,xm=M.$cloneWithProperties,QP=M.$cloneWithPropertiesEphemeral,oie=M.$comparePointCaretNext,rie=M.$copyNode,XP=M.$create,Os=M.$createLineBreakNode,YP=M.$createNodeSelection,hr=M.$createParagraphNode,aie=M.$createPoint,Fs=M.$createRangeSelection,JP=M.$createRangeSelectionFromDom,ZP=M.$createTabNode,Br=M.$createTextNode,eA=M.$extendCaretToRange,Ba=M.$findMatchingParent,Zy=M.$getAdjacentChildCaret,iie=M.$getAdjacentNode,Bs=M.$getAdjacentSiblingOrParentSiblingCaret,ex=M.$getCaretInDirection,tA=M.$getCaretRange,sie=M.$getCaretRangeInDirection,nA=M.$getCharacterOffsets,_i=M.$getChildCaret,lie=M.$getChildCaretAtIndex,tx=M.$getChildCaretOrSelf,oA=M.$getCollapsedCaretRange,die=M.$getCommonAncestor,cie=M.$getCommonAncestorResultBranchOrder,Cm=M.$getEditor,uie=M.$getNearestNodeFromDOMNode,fie=M.$getNearestRootOrShadowRoot,bm=M.$getNodeByKey,pie=M.$getNodeByKeyOrThrow,rA=M.$getNodeFromDOMNode,du=M.$getPreviousSelection,At=M.$getRoot,Ke=M.$getSelection,za=M.$getSiblingCaret,wm=M.$getState,mie=M.$getStateChange,gie=M.$getTextContent,hie=M.$getTextNodeOffset,vie=M.$getTextPointCaret,yie=M.$getTextPointCaretSlice,xie=M.$getWritableNodeState,aA=M.$hasAncestor,Cie=M.$hasUpdateTag,bie=M.$insertNodes,ad=M.$isBlockElementNode,cu=M.$isChildCaret,Sm=M.$isDecoratorNode,iA=M.$isEditorState,je=M.$isElementNode,sA=M.$isExtendableTextPointCaret,wie=M.$isInlineElementOrDecoratorNode,lA=M.$isLeafNode,id=M.$isLineBreakNode,Sie=M.$isNodeCaret,nx=M.$isNodeSelection,dA=M.$isParagraphNode,Ne=M.$isRangeSelection,uu=M.$isRootNode,zs=M.$isRootOrShadowRoot,cA=M.$isSiblingCaret,Iie=M.$isTabNode,dt=M.$isTextNode,Im=M.$isTextPointCaret,Tie=M.$isTextPointCaretSlice,ox=M.$isTokenOrSegmented,kie=M.$isTokenOrTab,Lie=M.$nodesOfType,uA=M.$normalizeCaret,fA=M.$normalizeSelection__EXPERIMENTAL,Pie=M.$onUpdate,pA=M.$parseSerializedNode,Aie=M.$removeTextFromCaretRange,mA=M.$rewindSiblingCaret,Tm=M.$selectAll,Eie=M.$setCompositionKey,Rie=M.$setPointFromCaret,zr=M.$setSelection,gA=M.$setSelectionFromCaretRange,km=M.$setState,hA=M.$splitAtPointCaretNext,vA=M.$splitNode,Mie=M.$updateRangeSelectionFromCaretRange,rx=M.ArtificialNode__DO_NOT_USE,Nie=M.BEFORE_INPUT_COMMAND,yA=M.BLUR_COMMAND,fu=M.CAN_REDO_COMMAND,pu=M.CAN_UNDO_COMMAND,Lm=M.CLEAR_EDITOR_COMMAND,xA=M.CLEAR_HISTORY_COMMAND,CA=M.CLICK_COMMAND,_ie=M.COLLABORATION_TAG,Pm=M.COMMAND_PRIORITY_CRITICAL,nn=M.COMMAND_PRIORITY_EDITOR,vr=M.COMMAND_PRIORITY_HIGH,sd=M.COMMAND_PRIORITY_LOW,Die=M.COMMAND_PRIORITY_NORMAL,Oie=M.COMPOSITION_END_COMMAND,bA=M.COMPOSITION_END_TAG,Fie=M.COMPOSITION_START_COMMAND,wA=M.COMPOSITION_START_TAG,SA=M.CONTROLLED_TEXT_INSERTION_COMMAND,Am=M.COPY_COMMAND,IA=M.CUT_COMMAND,Em=M.DELETE_CHARACTER_COMMAND,TA=M.DELETE_LINE_COMMAND,kA=M.DELETE_WORD_COMMAND,Bie=M.DRAGEND_COMMAND,zie=M.DRAGOVER_COMMAND,LA=M.DRAGSTART_COMMAND,PA=M.DROP_COMMAND,Ua=M.DecoratorNode,Uie=M.ElementNode,AA=M.FOCUS_COMMAND,Hie=M.FORMAT_ELEMENT_COMMAND,EA=M.FORMAT_TEXT_COMMAND,Rm=M.HISTORIC_TAG,yr=M.HISTORY_MERGE_TAG,RA=M.HISTORY_PUSH_TAG,ax=M.INDENT_CONTENT_COMMAND,$ie=M.INPUT_COMMAND,ix=M.INSERT_LINE_BREAK_COMMAND,MA=M.INSERT_PARAGRAPH_COMMAND,NA=M.INSERT_TAB_COMMAND,mu=M.INTERNAL_$isBlock,Kie=M.IS_ALL_FORMATTING,Vie=M.IS_BOLD,qie=M.IS_CODE,Wie=M.IS_HIGHLIGHT,Gie=M.IS_ITALIC,jie=M.IS_STRIKETHROUGH,Qie=M.IS_SUBSCRIPT,Xie=M.IS_SUPERSCRIPT,Yie=M.IS_UNDERLINE,_A=M.KEY_ARROW_DOWN_COMMAND,Mm=M.KEY_ARROW_LEFT_COMMAND,Nm=M.KEY_ARROW_RIGHT_COMMAND,DA=M.KEY_ARROW_UP_COMMAND,_m=M.KEY_BACKSPACE_COMMAND,OA=M.KEY_DELETE_COMMAND,FA=M.KEY_DOWN_COMMAND,Dm=M.KEY_ENTER_COMMAND,BA=M.KEY_ESCAPE_COMMAND,Jie=M.KEY_MODIFIER_COMMAND,Zie=M.KEY_SPACE_COMMAND,Om=M.KEY_TAB_COMMAND,zA=M.LineBreakNode,ese=M.MOVE_TO_END,tse=M.MOVE_TO_START,nse=M.NODE_STATE_KEY,UA=M.OUTDENT_CONTENT_COMMAND,Fm=M.PASTE_COMMAND,HA=M.PASTE_TAG,$A=M.ParagraphNode,KA=M.REDO_COMMAND,VA=M.REMOVE_TEXT_COMMAND,qA=M.RootNode,ose=M.SELECTION_CHANGE_COMMAND,WA=M.SELECTION_INSERT_CLIPBOARD_NODES_COMMAND,GA=M.SELECT_ALL_COMMAND,rse=M.SKIP_COLLAB_TAG,ase=M.SKIP_DOM_SELECTION_TAG,jA=M.SKIP_SCROLL_INTO_VIEW_TAG,ise=M.SKIP_SELECTION_FOCUS_TAG,QA=M.TEXT_TYPE_TO_FORMAT,XA=M.TabNode,Bm=M.TextNode,YA=M.UNDO_COMMAND,gu=M.addClassNamesToElement,sse=M.buildImportMap,zm=M.configExtension,JA=M.createCommand,Um=M.createEditor,lse=M.createSharedNodeState,ZA=M.createState,eE=M.declarePeerDependency,Rn=M.defineExtension,dse=M.flipDirection,cse=M.getDOMOwnerDocument,sx=M.getDOMSelection,use=M.getDOMSelectionFromTarget,tE=M.getDOMTextNode,fse=M.getEditorPropertyFromDOMNode,pse=M.getNearestEditorFromDOMNode,nE=M.getRegisteredNode,mse=M.getRegisteredNodeOrThrow,gse=M.getStaticNodeConfig,hse=M.getTextDirection,vse=M.getTransformSetFromKlass,oE=M.isBlockDomNode,yse=M.isCurrentlyReadOnlyMode,rE=M.isDOMDocumentNode,aE=M.isDOMNode,xse=M.isDOMTextNode,Cse=M.isDOMUnmanaged,lx=M.isDocumentFragment,bse=M.isExactShortcutMatch,iE=M.isHTMLAnchorElement,Hm=M.isHTMLElement,hu=M.isInlineDomNode,wse=M.isLexicalEditor,Sse=M.isModifierMatch,Ise=M.isSelectionCapturedInDecoratorInput,sE=M.isSelectionWithinEditor,dx=M.makeStepwiseIterator,ua=M.mergeRegister,Tse=M.normalizeClassNames,$m=M.removeClassNamesFromElement,kse=M.removeFromParent,Lse=M.resetRandomKey,Ur=M.safeCast,Pse=M.setDOMUnmanaged,Ase=M.setNodeIndentFromDOM,Km=M.shallowMergeConfig,cx=M.toggleTextFormatType;var hx={};En(hx,{$addNodeStyle:()=>QK,$cloneWithProperties:()=>xm,$copyBlockFormatIndent:()=>hE,$ensureForwardRangeSelection:()=>gE,$forEachSelectedTextNode:()=>mE,$getComputedStyleForElement:()=>px,$getComputedStyleForParent:()=>mx,$getSelectionStyleValueForProperty:()=>o3,$isAtNodeEnd:()=>jK,$isParentElementRTL:()=>gx,$isParentRTL:()=>WK,$moveCaretSelection:()=>xE,$moveCharacter:()=>t3,$patchStyleText:()=>XK,$selectAll:()=>Tm,$setBlocksType:()=>YK,$shouldOverrideDefaultCharacterSelection:()=>e3,$sliceSelectedTextNodeContent:()=>GK,$trimTextContentFromAnchor:()=>pE,$wrapNodes:()=>ZK,createDOMRange:()=>VK,createRectsFromDOMRange:()=>qK,getCSSFromStyleObject:()=>fE,getStyleObjectFromCSS:()=>Wm,trimTextContentFromAnchor:()=>r3});function fx(e,...t){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(let r of t)o.append("v",r);throw n.search=o.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.`)}var qm=new Map;function lE(e){let t=e;for(;t!=null;){if(t.nodeType===Node.TEXT_NODE)return t;t=t.firstChild}return null}function dE(e){let t=e.parentNode;if(t==null)throw new Error("Should never happen");return[t,Array.from(t.childNodes).indexOf(e)]}function VK(e,t,n,o,r){let a=t.getKey(),i=o.getKey(),s=document.createRange(),l=e.getElementByKey(a),d=e.getElementByKey(i),c=n,f=r;if(dt(t)&&(l=lE(l)),dt(o)&&(d=lE(d)),t===void 0||o===void 0||l===null||d===null)return null;l.nodeName==="BR"&&([l,c]=dE(l)),d.nodeName==="BR"&&([d,f]=dE(d));let p=l.firstChild;l===d&&p!=null&&p.nodeName==="BR"&&c===0&&f===0&&(f=1);try{s.setStart(l,c),s.setEnd(d,f)}catch{return null}return!s.collapsed||c===f&&a===i||(s.setStart(d,f),s.setEnd(l,c)),s}function qK(e,t){let n=e.getRootElement();if(n===null)return[];let o=n.getBoundingClientRect(),r=getComputedStyle(n),a=parseFloat(r.paddingLeft)+parseFloat(r.paddingRight),i=Array.from(t.getClientRects()),s,l=i.length;i.sort((d,c)=>{let f=d.top-c.top;return Math.abs(f)<=3?d.left-c.left:f});for(let d=0;d<l;d++){let c=i[d],f=s&&s.top<=c.top&&s.top+s.height>c.top&&s.left+s.width>c.left,p=c.width+a===o.width;f||p?(i.splice(d--,1),l--):s=c}return i}function uE(e){let t={};if(!e)return t;let n=e.split(";");for(let o of n)if(o!==""){let[r,a]=o.split(/:([^]+)/);r&&a&&(t[r.trim()]=a.trim())}return t}function Wm(e){let t=qm.get(e);return t===void 0&&(t=uE(e),qm.set(e,t)),t}function fE(e){let t="";for(let n in e)n&&(t+=`${n}: ${e[n]};`);return t}function px(e){let t=Cm().getElementByKey(e.getKey());if(t===null)return null;let n=t.ownerDocument.defaultView;return n===null?null:n.getComputedStyle(t)}function mx(e){return px(uu(e)?e:e.getParentOrThrow())}function WK(e){let t=mx(e);return t!==null&&t.direction==="rtl"}function GK(e,t,n="self"){let o=e.getStartEndPoints();if(t.isSelected(e)&&!ox(t)&&o!==null){let[r,a]=o,i=e.isBackward(),s=r.getNode(),l=a.getNode(),d=t.is(s),c=t.is(l);if(d||c){let[f,p]=nA(e),m=s.is(l),g=t.is(i?l:s),h=t.is(i?s:l),v,y=0;m?(y=f>p?p:f,v=f>p?f:p):g?(y=i?p:f,v=void 0):h&&(y=0,v=i?f:p);let x=t.__text.slice(y,v);x!==t.__text&&(n==="clone"&&(t=QP(t)),t.__text=x)}}return t}function jK(e){if(e.type==="text")return e.offset===e.getNode().getTextContentSize();let t=e.getNode();return je(t)||fx(177),e.offset===t.getChildrenSize()}function pE(e,t,n){let o=t.getNode(),r=n;if(je(o)){let a=o.getDescendantByIndex(t.offset);a!==null&&(o=a)}for(;r>0&&o!==null;){if(je(o)){let d=o.getLastDescendant();d!==null&&(o=d)}let a=o.getPreviousSibling(),i=0;if(a===null){let d=o.getParentOrThrow(),c=d.getPreviousSibling();for(;c===null;){if(d=d.getParent(),d===null){a=null;break}c=d.getPreviousSibling()}d!==null&&(i=d.isInline()?0:2,a=c)}let s=o.getTextContent();s===""&&je(o)&&!o.isInline()&&(s=`
|
|
3781
|
+
`?o.push(Vl()):i===" "?o.push(cm()):o.push(Hn(i))}this.insertNodes(o)}insertText(t){let n=this.anchor,o=this.focus,r=this.format,a=this.style,i=n,s=o;!this.isCollapsed()&&o.isBefore(n)&&(i=o,s=n),i.type==="element"&&(function(v,y,x,C){let w=v.getNode(),L=w.getChildAtIndex(v.offset),S=Hn();if(S.setFormat(x),S.setStyle(C),bP(L))L.splice(0,0,[S]);else{let k=to(w)?Na().append(S):S;L===null?w.append(k):L.insertBefore(k)}v.is(y)&&y.set(S.__key,0,"text"),v.set(S.__key,0,"text")})(i,s,r,a),s.type==="element"&&Zl(s,Er(Ei(s,"next")));let l=i.offset,d=s.offset,c=this.getNodes(),f=c.length,p=c[0];ze(p)||de(26);let m=p.getTextContent().length,g=p.getParentOrThrow(),h=c[f-1];if(f===1&&s.type==="element"&&(d=m,s.set(i.key,d,"text")),this.isCollapsed()&&l===m&&(Ea(p)||!p.canInsertTextAfter()||!g.canInsertTextAfter()&&p.getNextSibling()===null)){let v=p.getNextSibling();if(ze(v)&&v.canInsertTextBefore()&&!Ea(v)||(v=Hn(),v.setFormat(r),v.setStyle(a),g.canInsertTextAfter()?p.insertAfter(v):g.insertAfter(v)),v.select(0,0),p=v,t!=="")return void this.insertText(t)}else if(this.isCollapsed()&&l===0&&(Ea(p)||!p.canInsertTextBefore()||!g.canInsertTextBefore()&&p.getPreviousSibling()===null)){let v=p.getPreviousSibling();if(ze(v)&&!Ea(v)||(v=Hn(),v.setFormat(r),g.canInsertTextBefore()?p.insertBefore(v):g.insertBefore(v)),v.select(),p=v,t!=="")return void this.insertText(t)}else if(p.isSegmented()&&l!==m){let v=Hn(p.getTextContent());v.setFormat(r),p.replace(v),p=v}else if(!this.isCollapsed()&&t!==""){let v=h.getParent();if(!g.canInsertTextBefore()||!g.canInsertTextAfter()||re(v)&&(!v.canInsertTextBefore()||!v.canInsertTextAfter()))return this.insertText(""),uP(this.anchor,this.focus),void this.insertText(t)}if(f===1){if(Si(p)){let C=Hn(t);return C.select(),void p.replace(C)}let v=p.getFormat(),y=p.getStyle();if(l!==d||v===r&&y===a){if(ky(p)){let C=Hn(t);return C.setFormat(r),C.setStyle(a),C.select(),void p.replace(C)}}else{if(p.getTextContent()!==""){let C=Hn(t);if(C.setFormat(r),C.setStyle(a),C.select(),l===0)p.insertBefore(C,!1);else{let[w]=p.splitText(l);w.insertAfter(C,!1)}return void(C.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=t.length))}p.setFormat(r),p.setStyle(a)}let x=d-l;p=p.spliceText(l,x,t,!0),p.getTextContent()===""?p.remove():this.anchor.type==="text"&&(this.format=v,this.style=y,p.isComposing()&&(this.anchor.offset-=t.length))}else{let v=new Set([...p.getParentKeys(),...h.getParentKeys()]),y=re(p)?p:p.getParentOrThrow(),x=re(h)?h:h.getParentOrThrow(),C=h;if(!y.is(x)&&x.isInline())do C=x,x=x.getParentOrThrow();while(x.isInline());if(s.type==="text"&&(d!==0||h.getTextContent()==="")||s.type==="element"&&h.getIndexWithinParent()<d)if(ze(h)&&!Si(h)&&d!==h.getTextContentSize()){if(h.isSegmented()){let I=Hn(h.getTextContent());h.replace(I),h=I}to(s.getNode())||s.type!=="text"||(h=h.spliceText(0,d,"")),v.add(h.__key)}else{let I=h.getParentOrThrow();I.canBeEmpty()||I.getChildrenSize()!==1?h.remove():I.remove()}else v.add(h.__key);let w=x.getChildren(),L=new Set(c),S=y.is(x),k=y.isInline()&&p.getNextSibling()===null?y:p;for(let I=w.length-1;I>=0;I--){let T=w[I];if(T.is(p)||re(T)&&T.isParentOf(p))break;T.isAttached()&&(!L.has(T)||T.is(C)?S||k.insertAfter(T,!1):T.remove())}if(!S){let I=x,T=null;for(;I!==null;){let A=I.getChildren(),P=A.length;(P===0||A[P-1].is(T))&&(v.delete(I.__key),T=I),I=I.getParent()}}if(Si(p))if(l===m)p.select();else{let I=Hn(t);I.select(),p.replace(I)}else p=p.spliceText(l,m-l,t,!0),p.getTextContent()===""?p.remove():this.anchor.type==="text"&&(this.format=p.getFormat(),this.style=p.getStyle(),p.isComposing()&&(this.anchor.offset-=t.length));for(let I=1;I<f;I++){let T=c[I],A=T.__key;v.has(A)||T.remove()}}}removeText(){let t=Ot()===this;$c(this,GP(dy(this))),t&&Ot()!==this&&_o(this)}formatText(t,n=null){if(this.isCollapsed())return this.toggleFormat(t),void Kn(null);let o=this.getNodes(),r=[];for(let w of o)ze(w)&&r.push(w);let a=w=>{o.forEach(L=>{if(re(L)){let S=L.getFormatFlags(t,w);L.setTextFormat(S)}})},i=r.length;if(i===0)return this.toggleFormat(t),Kn(null),void a(n);let s=this.anchor,l=this.focus,d=this.isBackward(),c=d?l:s,f=d?s:l,p=0,m=r[0],g=c.type==="element"?0:c.offset;if(c.type==="text"&&g===m.getTextContentSize()&&(p=1,m=r[1],g=0),m==null)return;let h=m.getFormatFlags(t,n);a(h);let v=i-1,y=r[v],x=f.type==="text"?f.offset:y.getTextContentSize();if(m.is(y)){if(g===x)return;if(Ea(m)||g===0&&x===m.getTextContentSize())m.setFormat(h);else{let w=m.splitText(g,x),L=g===0?w[0]:w[1];L.setFormat(h),c.type==="text"&&c.set(L.__key,0,"text"),f.type==="text"&&f.set(L.__key,x-g,"text")}return void(this.format=h)}g===0||Ea(m)||([,m]=m.splitText(g),g=0),m.setFormat(h);let C=y.getFormatFlags(t,h);x>0&&(x===y.getTextContentSize()||Ea(y)||([y]=y.splitText(x)),y.setFormat(C));for(let w=p+1;w<v;w++){let L=r[w],S=L.getFormatFlags(t,C);L.setFormat(S)}c.type==="text"&&c.set(m.__key,g,"text"),f.type==="text"&&f.set(y.__key,x,"text"),this.format=h|C}insertNodes(t){if(t.length===0)return;if(this.isCollapsed()||this.removeText(),this.anchor.key==="root"){this.insertParagraph();let g=Ot();return Ge(g)||de(134),g.insertNodes(t)}let n=(this.isBackward()?this.focus:this.anchor).getNode(),o=Uc(n,Ma),r=t[t.length-1];if(re(o)&&"__language"in o){if("__language"in t[0])this.insertText(t[0].getTextContent());else{let g=Pv(this);o.splice(g,0,t),r.selectEnd()}return}if(!t.some(g=>(re(g)||en(g))&&!g.isInline())){re(o)||de(211,n.constructor.name,n.getType());let g=Pv(this);return o.splice(g,0,t),void r.selectEnd()}let a=(function(g){let h=Na(),v=null;for(let y=0;y<g.length;y++){let x=g[y],C=ks(x);if(C||en(x)&&x.isInline()||re(x)&&x.isInline()||ze(x)||x.isParentRequired()){if(v===null&&(v=x.createParentElementNode(),h.append(v),C))continue;v!==null&&v.append(x)}else h.append(x),v=null}return h})(t),i=a.getLastDescendant(),s=a.getChildren(),l=!re(o)||!o.isEmpty()?this.insertParagraph():null,d=s[s.length-1],c=s[0];var f;re(f=c)&&Ma(f)&&!f.isEmpty()&&re(o)&&(!o.isEmpty()||o.canMergeWhenEmpty())&&(re(o)||de(211,n.constructor.name,n.getType()),o.append(...c.getChildren()),c=s[1]),c&&(o===null&&de(212,n.constructor.name,n.getType()),(function(g,h){let v=h.getParentOrThrow().getLastChild(),y=h,x=[h];for(;y!==v;)y.getNextSibling()||de(140),y=y.getNextSibling(),x.push(y);let C=g;for(let w of x)C=C.insertAfter(w)})(o,c));let p=Uc(i,Ma);l&&re(p)&&(l.canMergeWhenEmpty()||Ma(d))&&(p.append(...l.getChildren()),l.remove()),re(o)&&o.isEmpty()&&o.remove(),i.selectEnd();let m=re(o)?o.getLastChild():null;ks(m)&&p!==o&&m.remove()}insertParagraph(){if(this.anchor.key==="root"){let i=Na();return jo().splice(this.anchor.offset,0,[i]),i.select(),i}let t=Pv(this),n=Uc(this.anchor.getNode(),Ma);re(n)||de(213);let o=n.getChildAtIndex(t),r=o?[o,...o.getNextSiblings()]:[],a=n.insertNewAfter(this,!1);return a?(a.append(...r),a.selectStart(),a):null}insertLineBreak(t){let n=Vl();if(this.insertNodes([n]),t){let o=n.getParentOrThrow(),r=n.getIndexWithinParent();o.select(r,r)}}extract(){let t=[...this.getNodes()],n=t.length,o=t[0],r=t[n-1],[a,i]=ty(this),s=this.isBackward(),[l,d]=s?[this.focus,this.anchor]:[this.anchor,this.focus],[c,f]=s?[i,a]:[a,i];if(n===0)return[];if(n===1){if(ze(o)&&!this.isCollapsed()){let p=o.splitText(c,f),m=c===0?p[0]:p[1];return m?(l.set(m.getKey(),0,"text"),d.set(m.getKey(),m.getTextContentSize(),"text"),[m]):[]}return[o]}if(ze(o)&&(c===o.getTextContentSize()?t.shift():c!==0&&([,o]=o.splitText(c),t[0]=o,l.set(o.getKey(),0,"text"))),ze(r)){let p=r.getTextContent().length;f===0?t.pop():f!==p&&([r]=r.splitText(f),t[t.length-1]=r,d.set(r.getKey(),r.getTextContentSize(),"text"))}return t}modify(t,n,o){if(Zk(this,t,n,o))return;let r=t==="move",a=Xt(),i=Or(Qo(a));if(!i)return;let s=a._blockCursorElement,l=a._rootElement,d=this.focus.getNode();if(l===null||s===null||!re(d)||d.isInline()||d.canBeEmpty()||ry(s,a,l),this.dirty){let c=jl(a,this.anchor.key),f=jl(a,this.focus.key);this.anchor.type==="text"&&(c=Rs(c)),this.focus.type==="text"&&(f=Rs(f)),c&&f&&gP(i,c,this.anchor.offset,f,this.focus.offset)}if((function(c,f,p,m){c.modify(f,p,m)})(i,t,n?"backward":"forward",o),i.rangeCount>0){let c=i.getRangeAt(0),f=this.anchor.getNode(),p=to(f)?f:FP(f);if(this.applyDOMRange(c),this.dirty=!0,!r){let m=this.getNodes(),g=[],h=!1;for(let v=0;v<m.length;v++){let y=m[v];rm(y,p)?g.push(y):h=!0}if(h&&g.length>0)if(n){let v=g[0];re(v)?v.selectStart():v.getParentOrThrow().selectStart()}else{let v=g[g.length-1];re(v)?v.selectEnd():v.getParentOrThrow().selectEnd()}i.anchorNode===c.startContainer&&i.anchorOffset===c.startOffset||(function(v){let y=v.focus,x=v.anchor,C=x.key,w=x.offset,L=x.type;x.set(y.key,y.offset,y.type,!0),y.set(C,w,L,!0)})(this)}}o==="lineboundary"&&Zk(this,t,n,o,"decorators")}forwardDeletion(t,n,o){if(!o&&(t.type==="element"&&re(n)&&t.offset===n.getChildrenSize()||t.type==="text"&&t.offset===n.getTextContentSize())){let r=n.getParent(),a=n.getNextSibling()||(r===null?null:r.getNextSibling());if(re(a)&&a.isShadowRoot())return!0}return!1}deleteCharacter(t){let n=this.isCollapsed();if(this.isCollapsed()){let o=this.anchor,r=o.getNode();if(this.forwardDeletion(o,r,t))return;let a=Wy(Ei(o,t?"previous":"next"));if(a.getTextSlices().every(s=>s===null||s.distance===0)){let s={type:"initial"};for(let l of a.iterNodeCarets("shadowRoot"))if(Mr(l)){if(!l.origin.isInline()){if(l.origin.isShadowRoot()){if(s.type==="merge-block")break;if(re(a.anchor.origin)&&a.anchor.origin.isEmpty()){let d=Er(l);$c(this,Ai(d,d)),a.anchor.origin.remove()}return}s.type!=="merge-next-block"&&s.type!=="merge-block"||(s={block:s.block,caret:l,type:"merge-block"})}}else{if(s.type==="merge-block")break;if(Ms(l)){if(re(l.origin)){if(l.origin.isInline()){if(!l.origin.isParentOf(a.anchor.origin))break}else s={block:l.origin,type:"merge-next-block"};continue}if(en(l.origin)){if(!l.origin.isIsolated())if(s.type==="merge-next-block"&&(l.origin.isKeyboardSelectable()||!l.origin.isInline())&&re(a.anchor.origin)&&a.anchor.origin.isEmpty()){a.anchor.origin.remove();let d=Ly();d.add(l.origin.getKey()),_o(d)}else l.origin.remove();return}break}}if(s.type==="merge-block"){let{caret:l,block:d}=s;return $c(this,Ai(!l.origin.isEmpty()&&d.isEmpty()?nd(Wn(d,l.direction)):a.anchor,l)),this.removeText()}}let i=this.focus;if(this.modify("extend",t,"character"),this.isCollapsed()){if(t&&o.offset===0&&Wk(this,o.getNode()))return}else{let s=i.type==="text"?i.getNode():null;if(r=o.type==="text"?o.getNode():null,s!==null&&s.isSegmented()){let l=i.offset,d=s.getTextContentSize();if(s.is(r)||t&&l!==d||!t&&l!==0)return void Gk(s,t,l)}else if(r!==null&&r.isSegmented()){let l=o.offset,d=r.getTextContentSize();if(r.is(s)||t&&l!==0||!t&&l!==d)return void Gk(r,t,l)}(function(l,d){let c=l.anchor,f=l.focus,p=c.getNode(),m=f.getNode();if(p===m&&c.type==="text"&&f.type==="text"){let g=c.offset,h=f.offset,v=g<h,y=v?g:h,x=v?h:g,C=x-1;y!==C&&(function(w){return!(EP(w)||Y$(w))})(p.getTextContent().slice(y,x))&&(d?f.set(f.key,C,f.type):c.set(c.key,C,c.type))}})(this,t)}}if(this.removeText(),t&&!n&&this.isCollapsed()&&this.anchor.type==="element"&&this.anchor.offset===0){let o=this.anchor.getNode();o.isEmpty()&&to(o.getParent())&&o.getPreviousSibling()===null&&Wk(this,o)}}deleteLine(t){this.isCollapsed()&&this.modify("extend",t,"lineboundary"),this.isCollapsed()?this.deleteCharacter(t):this.removeText()}deleteWord(t){if(this.isCollapsed()){let n=this.anchor,o=n.getNode();if(this.forwardDeletion(n,o,t))return;this.modify("extend",t,"word")}this.removeText()}isBackward(){return this.focus.isBefore(this.anchor)}getStartEndPoints(){return[this.anchor,this.focus]}};function tu(e){return e instanceof Zp}function qk(e){let t=e.offset;if(e.type==="text")return t;let n=e.getNode();return t===n.getChildrenSize()?n.getTextContent().length:0}function ty(e){let t=e.getStartEndPoints();if(t===null)return[0,0];let[n,o]=t;return n.type==="element"&&o.type==="element"&&n.key===o.key&&n.offset===o.offset?[0,0]:[qk(n),qk(o)]}function Wk(e,t){for(let n=t;n;n=n.getParent()){if(re(n)){if(n.collapseAtStart(e))return!0;if(mr(n))break}if(n.getPreviousSibling())break}return!1}var Y$=(()=>{try{let e=new RegExp("\\p{Emoji}","u"),t=e.test.bind(e);if(t("\u2764\uFE0F")&&t("#\uFE0F\u20E3")&&t("\u{1F44D}"))return t}catch{}return()=>!1})();function Gk(e,t,n){let o=e,r=o.getTextContent().split(/(?=\s)/g),a=r.length,i=0,s=0;for(let d=0;d<a;d++){let c=d===a-1;if(s=i,i+=r[d].length,t&&i===n||i>n||c){r.splice(d,1),c&&(s=void 0);break}}let l=r.join("").trim();l===""?o.remove():(o.setTextContent(l),o.select(s,s))}function jk(e,t,n,o){let r,a=t;if(So(e)){let i=!1,s=e.childNodes,l=s.length,d=o._blockCursorElement;a===l&&(i=!0,a=l-1);let c=s[a],f=!1;if(c===d)c=s[a+1],f=!0;else if(d!==null){let p=d.parentNode;e===p&&t>Array.prototype.indexOf.call(p.children,d)&&a--}if(r=zl(c),ze(r))a=Nr(r,i?"next":"previous");else{let p=zl(e);if(p===null)return null;if(re(p)){let m=o.getElementByKey(p.getKey());m===null&&de(214),[p,a]=p.getDOMSlot(m).resolveChildIndex(p,m,e,t),re(p)||de(215),i&&a>=p.getChildrenSize()&&(a=Math.max(0,p.getChildrenSize()-1));let h=p.getChildAtIndex(a);if(re(h)&&(function(v,y,x){let C=v.getParent();return x===null||C===null||!C.canBeEmpty()||C!==x.getNode()})(h,0,n)){let v=i?h.getLastDescendant():h.getFirstDescendant();v===null?p=h:(h=v,p=re(h)?h:h.getParentOrThrow()),a=0}ze(h)?(r=h,p=null,a=Nr(h,i?"next":"previous")):h!==p&&i&&!f&&(re(p)||de(216),a=Math.min(p.getChildrenSize(),a+1))}else{let m=p.getIndexWithinParent();a=t===0&&en(p)&&zl(e)===p?m:m+1,p=p.getParentOrThrow()}if(re(p))return _r(p.__key,a,"element")}}else r=zl(e);return ze(r)?_r(r.__key,Nr(r,a,"clamp"),"text"):null}function Qk(e,t,n){let o=e.offset,r=e.getNode();if(o===0){let a=r.getPreviousSibling(),i=r.getParent();if(t){if((n||!t)&&a===null&&re(i)&&i.isInline()){let s=i.getPreviousSibling();ze(s)&&e.set(s.__key,s.getTextContent().length,"text")}}else re(a)&&!n&&a.isInline()?e.set(a.__key,a.getChildrenSize(),"element"):ze(a)&&e.set(a.__key,a.getTextContent().length,"text")}else if(o===r.getTextContent().length){let a=r.getNextSibling(),i=r.getParent();if(t&&re(a)&&a.isInline())e.set(a.__key,0,"element");else if((n||t)&&a===null&&re(i)&&i.isInline()&&!i.canInsertTextAfter()){let s=i.getNextSibling();ze(s)&&e.set(s.__key,0,"text")}}}function uP(e,t,n){if(e.type==="text"&&t.type==="text"){let o=e.isBefore(t),r=e.is(t);Qk(e,o,r),Qk(t,!o,r),r&&t.set(e.key,e.offset,e.type)}}function fP(e,t,n,o,r,a){if(e===null||n===null||!nu(r,e,n))return null;let i=jk(e,t,Ge(a)?a.anchor:null,r);if(i===null)return null;let s=jk(n,o,Ge(a)?a.focus:null,r);if(s===null)return null;if(i.type==="element"&&s.type==="element"){let l=zl(e),d=zl(n);if(en(l)&&en(d))return null}return uP(i,s),[i,s]}function J$(e){return re(e)&&!e.isInline()}function pP(e,t,n,o,r,a){let i=Oa(),s=new Es(_r(e,t,r),_r(n,o,a),0,"");return s.dirty=!0,i._selection=s,s}function mP(){let e=_r("root",0,"element"),t=_r("root",0,"element");return new Es(e,t,0,"")}function Ly(){return new Zp(new Set)}function Z$(e,t){return um(null,e,t,null)}function um(e,t,n,o){let r=n._window;if(r===null)return null;let a=o||r.event,i=a?a.type:void 0,s=i==="selectionchange",l=!Dv&&(s||i==="beforeinput"||i==="compositionstart"||i==="compositionend"||i==="click"&&a&&a.detail===3||i==="drop"||i===void 0),d,c,f,p;if(Ge(e)&&!l)return e.clone();if(t===null)return null;if(d=t.anchorNode,c=t.focusNode,f=t.anchorOffset,p=t.focusOffset,(s||i===void 0)&&Ge(e)&&!nu(n,d,c))return e.clone();let m=fP(d,f,c,p,n,e);if(m===null)return null;let[g,h]=m,v=0,y="";if(Ge(e)){let x=e.anchor;if(g.key===x.key)v=e.format,y=e.style;else{let C=g.getNode();ze(C)?(v=C.getFormat(),y=C.getStyle()):re(C)&&(v=C.getTextFormat(),y=C.getTextStyle())}}return new Es(g,h,v,y)}function Ot(){return Oa()._selection}function Ns(){return Xt()._editorState._selection}function em(e,t,n,o=1){let r=e.anchor,a=e.focus,i=r.getNode(),s=a.getNode();if(!t.is(i)&&!t.is(s))return;let l=t.__key;if(e.isCollapsed()){let d=r.offset;if(n<=d&&o>0||n<d&&o<0){let c=Math.max(0,d+o);r.set(l,c,"element"),a.set(l,c,"element"),Xk(e)}}else{let d=e.isBackward(),c=d?a:r,f=c.getNode(),p=d?r:a,m=p.getNode();if(t.is(f)){let g=c.offset;(n<=g&&o>0||n<g&&o<0)&&c.set(l,Math.max(0,g+o),"element")}if(t.is(m)){let g=p.offset;(n<=g&&o>0||n<g&&o<0)&&p.set(l,Math.max(0,g+o),"element")}}Xk(e)}function Xk(e){let t=e.anchor,n=t.offset,o=e.focus,r=o.offset,a=t.getNode(),i=o.getNode();if(e.isCollapsed()){if(!re(a))return;let s=a.getChildrenSize(),l=n>=s,d=l?a.getChildAtIndex(s-1):a.getChildAtIndex(n);if(ze(d)){let c=0;l&&(c=d.getTextContentSize()),t.set(d.__key,c,"text"),o.set(d.__key,c,"text")}return}if(re(a)){let s=a.getChildrenSize(),l=n>=s,d=l?a.getChildAtIndex(s-1):a.getChildAtIndex(n);if(ze(d)){let c=0;l&&(c=d.getTextContentSize()),t.set(d.__key,c,"text")}}if(re(i)){let s=i.getChildrenSize(),l=r>=s,d=l?i.getChildAtIndex(s-1):i.getChildAtIndex(r);if(ze(d)){let c=0;l&&(c=d.getTextContentSize()),o.set(d.__key,c,"text")}}}function tm(e,t,n,o,r){let a=null,i=0,s=null;o!==null?(a=o.__key,ze(o)?(i=o.getTextContentSize(),s="text"):re(o)&&(i=o.getChildrenSize(),s="element")):r!==null&&(a=r.__key,ze(r)?s="text":re(r)&&(s="element")),a!==null&&s!==null?e.set(a,i,s):(i=t.getIndexWithinParent(),i===-1&&(i=n.getChildrenSize()),e.set(n.__key,i,"element"))}function Yk(e,t,n,o,r){e.type==="text"?e.set(n,e.offset+(t?0:r),"text"):e.offset>o.getIndexWithinParent()&&e.set(e.key,e.offset-1,"element")}function gP(e,t,n,o,r){try{e.setBaseAndExtent(t,n,o,r)}catch{}}function Jk(e,t,n){let o=jl(e,t.getKey());if(re(t)){let r=t.getDOMSlot(o);return[r.element,n+r.getFirstChildOffset()]}return[o,n]}function eK(e,t,n,o,r,a,i){let s=o.anchorNode,l=o.focusNode,d=o.anchorOffset,c=o.focusOffset,f=document.activeElement;if(r.has(rP)&&f!==a||f!==null&&Ny(f))return;if(!Ge(t))return void(e!==null&&nu(n,s,l)&&o.removeAllRanges());let p=t.anchor,m=t.focus,g=p.getNode(),h=m.getNode(),[v,y]=Jk(n,g,p.offset),[x,C]=Jk(n,h,m.offset),w=t.format,L=t.style,S=t.isCollapsed(),k=v,I=x,T=!1;var A,P,_,E,F;if(p.type==="text"?(k=Rs(v),T=g.getFormat()!==w||g.getStyle()!==L):Ge(e)&&e.anchor.type==="text"&&(T=!0),m.type==="text"&&(I=Rs(x)),k!==null&&I!==null&&(S&&(e===null||T||Ge(e)&&(e.format!==w||e.style!==L))&&(A=w,P=L,_=y,E=p.key,F=performance.now(),YL=[A,P,_,E,F]),d!==y||c!==C||s!==k||l!==I||o.type==="Range"&&S||(f!==null&&a.contains(f)||r.has(Zv)||a.focus({preventScroll:!0}),p.type==="element"))){if(gP(o,k,y,I,C),!Ti||!t.isCollapsed()||a===null||r.has(Zv)||document.activeElement!==null&&a.contains(document.activeElement)||a.focus({preventScroll:!0}),!r.has(aP)&&t.isCollapsed()&&a!==null&&a===document.activeElement){let B=Ge(t)&&t.anchor.type==="element"?k.childNodes[y]||null:o.rangeCount>0?o.getRangeAt(0):null;if(B!==null){let V;if(B instanceof Text){let Q=document.createRange();Q.selectNode(B),V=Q.getBoundingClientRect()}else V=B.getBoundingClientRect();(function(Q,Se,H){let q=Uy(H),ee=Hy(q);if(q===null||ee===null)return;let{top:G,bottom:te}=Se,me=0,U=0,Y=H;for(;Y!==null;){let se=Y===q.body;if(se)me=0,U=Qo(Q).innerHeight;else{let ie=Y.getBoundingClientRect();me=ie.top,U=ie.bottom}let ge=0;if(G<me?ge=-(me-G):te>U&&(ge=te-U),ge!==0)if(se)ee.scrollBy(0,ge);else{let ie=Y.scrollTop;Y.scrollTop+=ge;let Ae=Y.scrollTop-ie;G-=Ae,te-=Ae}if(se)break;Y=ru(Y)}})(n,V,a)}}Xv=!0}}function tK(e){let t=Ot()||Ns();t===null&&(t=jo().selectEnd()),t.insertNodes(e)}function nK(){let e=Ot();return e===null?"":e.getTextContent()}function Pv(e){let t=e;e.isCollapsed()||t.removeText();let n=Ot();Ge(n)&&(t=n),Ge(t)||de(161);let o=t.anchor,r=o.getNode(),a=o.offset;for(;!Ma(r);){let i=r;if([r,a]=oK(r,a),i.is(r))break}return a}function oK(e,t){let n=e.getParent();if(!n){let r=Na();return jo().append(r),r.select(),[jo(),0]}if(ze(e)){let r=e.splitText(t);if(r.length===0)return[n,e.getIndexWithinParent()];let a=t===0?0:1;return[n,r[0].getIndexWithinParent()+a]}if(!re(e)||t===0)return[n,e.getIndexWithinParent()];let o=e.getChildAtIndex(t);if(o){let r=new Es(_r(e.__key,t,"element"),_r(e.__key,t,"element"),0,""),a=e.insertNewAfter(r);a&&a.append(o,...o.getNextSiblings())}return[n,e.getIndexWithinParent()+1]}function Zk(e,t,n,o,r="decorators-and-blocks"){if(t==="move"&&o==="character"&&!e.isCollapsed()){let[c,f]=n===e.isBackward()?[e.focus,e.anchor]:[e.anchor,e.focus];return f.set(c.key,c.offset,c.type),!0}let a=Ei(e.focus,n?"previous":"next"),i=o==="lineboundary",s=t==="move",l=a,d=r==="decorators-and-blocks";if(!jP(l)){for(let c of l){d=!1;let{origin:f}=c;if(!en(f)||f.isIsolated()||(l=c,!i||!f.isInline()))break}if(d)for(let c of Wy(a).iterNodeCarets(t==="extend"?"shadowRoot":"root")){if(Mr(c))c.origin.isInline()||(l=c);else{if(re(c.origin))continue;en(c.origin)&&!c.origin.isInline()&&(l=c)}break}}if(l===a)return!1;if(s&&!i&&en(l.origin)&&l.origin.isKeyboardSelectable()){let c=Ly();return c.add(l.origin.getKey()),_o(c),!0}return l=Er(l),s&&Zl(e.anchor,l),Zl(e.focus,l),d||!i}var Vn=null,qn=null,No=!1,Av=!1,Hp=0,eL={characterData:!0,childList:!0,subtree:!0};function ed(){return No||Vn!==null&&Vn._readOnly}function $n(){No&&de(13)}function hP(){Hp>99&&de(14)}function Oa(){return Vn===null&&de(195,vP()),Vn}function Xt(){return qn===null&&de(196,vP()),qn}function vP(){let e=0,t=new Set,n=Li.version;if(typeof window<"u")for(let r of document.querySelectorAll("[contenteditable]")){let a=ou(r);if(pm(a))e++;else if(a){let i=String(a.constructor.version||"<0.17.1");i===n&&(i+=" (separately built, likely a bundler configuration issue)"),t.add(i)}}let o=` Detected on the page: ${e} compatible editor(s) with version ${n}`;return t.size&&(o+=` and incompatible editors with versions ${Array.from(t).join(", ")}`),o}function rK(){return qn}function tL(e,t,n){let o=t.__type,r=Ry(e,o),a=n.get(o);a===void 0&&(a=Array.from(r.transforms),n.set(o,a));let i=a.length;for(let s=0;s<i&&(a[s](t),t.isAttached());s++);}function nL(e,t){return e!==void 0&&e.__key!==t&&e.isAttached()}function yP(e,t){if(!t)return;let n=e._updateTags,o=t;Array.isArray(t)||(o=[t]);for(let r of o)n.add(r)}function aK(e){return Py(e,Xt()._nodes)}function Py(e,t){let n=e.type,o=t.get(n);o===void 0&&de(17,n);let r=o.klass;e.type!==r.getType()&&de(18,r.name);let a=r.importJSON(e),i=e.children;if(re(a)&&Array.isArray(i))for(let s=0;s<i.length;s++){let l=Py(i[s],t);a.append(l)}return a}function oL(e,t,n){let o=Vn,r=No,a=qn;Vn=t,No=!0,qn=e;try{return n()}finally{Vn=o,No=r,qn=a}}function Ra(e,t){let n=e._pendingEditorState,o=e._rootElement,r=e._headless||o===null;if(n===null)return;let a=e._editorState,i=a._selection,s=n._selection,l=e._dirtyType!==0,d=Vn,c=No,f=qn,p=e._updating,m=e._observer,g=null;if(e._pendingEditorState=null,e._editorState=n,!r&&l&&m!==null){qn=e,Vn=n,No=!1,e._updating=!0;try{let S=e._dirtyType,k=e._dirtyElements,I=e._dirtyLeaves;m.disconnect(),g=I$(a,n,e,S,k,I)}catch(S){if(S instanceof Error&&e._onError(S),Av)throw S;return wP(e,null,o,n),SL(e),e._dirtyType=2,Av=!0,Ra(e,a),void(Av=!1)}finally{m.observe(o,eL),e._updating=p,Vn=d,No=c,qn=f}}n._readOnly||(n._readOnly=!0);let h=e._dirtyLeaves,v=e._dirtyElements,y=e._normalizedNodes,x=e._updateTags,C=e._deferred;l&&(e._dirtyType=0,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements=new Map,e._normalizedNodes=new Set,e._updateTags=new Set),(function(S,k){let I=S._decorators,T=S._pendingDecorators||I,A=k._nodeMap,P;for(P in T)A.has(P)||(T===I&&(T=PP(S)),delete T[P])})(e,n);let w=r?null:Or(Qo(e));if(e._editable&&w!==null&&(l||s===null||s.dirty||!s.is(i))&&o!==null&&!x.has(iP)){qn=e,Vn=n;try{if(m!==null&&m.disconnect(),l||s===null||s.dirty){let S=e._blockCursorElement;S!==null&&ry(S,e,o),eK(i,s,e,w,x,o)}(function(S,k,I){let T=S._blockCursorElement;if(Ge(I)&&I.isCollapsed()&&I.anchor.type==="element"&&k.contains(document.activeElement)){let A=I.anchor,P=A.getNode(),_=A.offset,E=!1,F=null;if(_===P.getChildrenSize())Rv(P.getChildAtIndex(_-1))&&(E=!0);else{let B=P.getChildAtIndex(_);if(B!==null&&Rv(B)){let V=B.getPreviousSibling();(V===null||Rv(V))&&(E=!0,F=S.getElementByKey(B.__key))}}if(E){let B=S.getElementByKey(P.__key);return T===null&&(S._blockCursorElement=T=(function(V){let Q=V.theme,Se=document.createElement("div");Se.contentEditable="false",Se.setAttribute("data-lexical-cursor","true");let H=Q.blockCursor;if(H!==void 0){if(typeof H=="string"){let q=su(H);H=Q.blockCursor=q}H!==void 0&&Se.classList.add(...H)}return Se})(S._config)),k.style.caretColor="transparent",void(F===null?B.appendChild(T):B.insertBefore(T,F))}}T!==null&&ry(T,S,k)})(e,o,s)}finally{m!==null&&m.observe(o,eL),qn=f,Vn=d}}g!==null&&(function(S,k,I,T,A){let P=Array.from(S._listeners.mutation),_=P.length;for(let E=0;E<_;E++){let[F,B]=P[E];for(let V of B){let Q=k.get(V);Q!==void 0&&F(Q,{dirtyLeaves:T,prevEditorState:A,updateTags:I})}}})(e,g,x,h,a),Ge(s)||s===null||i!==null&&i.is(s)||e.dispatchCommand(my,void 0);let L=e._pendingDecorators;L!==null&&(e._decorators=L,e._pendingDecorators=null,zc("decorator",e,!0,L)),(function(S,k,I){let T=sL(k),A=sL(I);T!==A&&zc("textcontent",S,!0,A)})(e,t||a,n),zc("update",e,!0,{dirtyElements:v,dirtyLeaves:h,editorState:n,mutatedNodes:g,normalizedNodes:y,prevEditorState:t||a,tags:x}),(function(S,k){if(S._deferred=[],k.length!==0){let I=S._updating;S._updating=!0;try{for(let T=0;T<k.length;T++)k[T]()}finally{S._updating=I}}})(e,C),(function(S){let k=S._updates;if(k.length!==0){let I=k.shift();if(I){let[T,A]=I;fm(S,T,A)}}})(e)}function zc(e,t,n,...o){let r=t._updating;t._updating=n;try{let a=Array.from(t._listeners[e]);for(let i=0;i<a.length;i++)a[i].apply(null,o)}finally{t._updating=r}}function rL(e,t){let n=e._updates,o=t||!1;for(;n.length!==0;){let r=n.shift();if(r){let[a,i]=r,s=e._pendingEditorState,l;i!==void 0&&(l=i.onUpdate,i.skipTransforms&&(o=!0),i.discrete&&(s===null&&de(191),s._flushSync=!0),l&&e._deferred.push(l),yP(e,i.tag)),s==null?fm(e,a,i):a()}}return o}function fm(e,t,n){let o=e._updateTags,r,a=!1,i=!1;n!==void 0&&(r=n.onUpdate,yP(e,n.tag),a=n.skipTransforms||!1,i=n.discrete||!1),r&&e._deferred.push(r);let s=e._editorState,l=e._pendingEditorState,d=!1;(l===null||l._readOnly)&&(l=e._pendingEditorState=xP(l||s),d=!0),l._flushSync=i;let c=Vn,f=No,p=qn,m=e._updating;Vn=l,No=!1,e._updating=!0,qn=e;let g=e._headless||e.getRootElement()===null;Ey(null);try{d&&(g?s._selection!==null&&(l._selection=s._selection.clone()):l._selection=(function(x,C){let w=x.getEditorState()._selection,L=Or(Qo(x));return Ge(w)||w==null?um(w,L,x,C):w.clone()})(e,n&&n.event||null));let v=e._compositionKey;t(),a=rL(e,a),(function(x,C){let w=C.getEditorState()._selection,L=x._selection;if(Ge(L)){let S=L.anchor,k=L.focus,I;if(S.type==="text"&&(I=S.getNode(),I.selectionTransform(w,L)),k.type==="text"){let T=k.getNode();I!==T&&T.selectionTransform(w,L)}}})(l,e),e._dirtyType!==0&&(a?(function(x,C){let w=C._dirtyLeaves,L=x._nodeMap;for(let S of w){let k=L.get(S);ze(k)&&k.isAttached()&&k.isSimpleText()&&!k.isUnmergeable()&&Mk(k)}})(l,e):(function(x,C){let w=C._dirtyLeaves,L=C._dirtyElements,S=x._nodeMap,k=wi(),I=new Map,T=w,A=T.size,P=L,_=P.size;for(;A>0||_>0;){if(A>0){C._dirtyLeaves=new Set;for(let E of T){let F=S.get(E);ze(F)&&F.isAttached()&&F.isSimpleText()&&!F.isUnmergeable()&&Mk(F),F!==void 0&&nL(F,k)&&tL(C,F,I),w.add(E)}if(T=C._dirtyLeaves,A=T.size,A>0){Hp++;continue}}C._dirtyLeaves=new Set,C._dirtyElements=new Map,P.delete("root")&&P.set("root",!0);for(let E of P){let F=E[0],B=E[1];if(L.set(F,B),!B)continue;let V=S.get(F);V!==void 0&&nL(V,k)&&tL(C,V,I)}T=C._dirtyLeaves,A=T.size,P=C._dirtyElements,_=P.size,Hp++}C._dirtyLeaves=w,C._dirtyElements=L})(l,e),rL(e),(function(x,C,w,L){let S=x._nodeMap,k=C._nodeMap,I=[];for(let[T]of L){let A=k.get(T);A!==void 0&&(A.isAttached()||(re(A)&&CL(A,T,S,k,I,L),S.has(T)||L.delete(T),I.push(T)))}for(let T of I)k.delete(T);for(let T of w){let A=k.get(T);A===void 0||A.isAttached()||(S.has(T)||w.delete(T),k.delete(T))}})(s,l,e._dirtyLeaves,e._dirtyElements)),v!==e._compositionKey&&(l._flushSync=!0);let y=l._selection;if(Ge(y)){let x=l._nodeMap,C=y.anchor.key,w=y.focus.key;x.get(C)!==void 0&&x.get(w)!==void 0||de(19)}else tu(y)&&y._nodes.size===0&&(l._selection=null)}catch(v){return v instanceof Error&&e._onError(v),e._pendingEditorState=s,e._dirtyType=2,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements.clear(),void Ra(e)}finally{Vn=c,No=f,qn=p,e._updating=m,Hp=0}e._dirtyType!==0||e._deferred.length>0||(function(v,y){let x=y.getEditorState()._selection,C=v._selection;if(C!==null){if(C.dirty||!C.is(x))return!0}else if(x!==null)return!0;return!1})(l,e)?l._flushSync?(l._flushSync=!1,Ra(e)):d&&mK(()=>{Ra(e)}):(l._flushSync=!1,d&&(o.clear(),e._deferred=[],e._pendingEditorState=null))}function da(e,t,n){qn===e&&n===void 0?t():fm(e,t,n)}var ny=class e{element;before;after;constructor(t,n,o){this.element=t,this.before=n||null,this.after=o||null}withBefore(t){return new e(this.element,t,this.after)}withAfter(t){return new e(this.element,this.before,t)}withElement(t){return this.element===t?this:new e(t,this.before,this.after)}insertChild(t){let n=this.before||this.getManagedLineBreak();return n!==null&&n.parentElement!==this.element&&de(222),this.element.insertBefore(t,n),this}removeChild(t){return t.parentElement!==this.element&&de(223),this.element.removeChild(t),this}replaceChild(t,n){return n.parentElement!==this.element&&de(224),this.element.replaceChild(t,n),this}getFirstChild(){let t=this.after?this.after.nextSibling:this.element.firstChild;return t===this.before||t===this.getManagedLineBreak()?null:t}getManagedLineBreak(){return this.element.__lexicalLineBreak||null}setManagedLineBreak(t){if(t===null)this.removeManagedLineBreak();else{let n=t==="decorator"&&(sm||eu||im);this.insertManagedLineBreak(n)}}removeManagedLineBreak(){let t=this.getManagedLineBreak();if(t){let n=this.element,o=t.nodeName==="IMG"?t.nextSibling:null;o&&n.removeChild(o),n.removeChild(t),n.__lexicalLineBreak=void 0}}insertManagedLineBreak(t){let n=this.getManagedLineBreak();if(n){if(t===(n.nodeName==="IMG"))return;this.removeManagedLineBreak()}let o=this.element,r=this.before,a=document.createElement("br");if(o.insertBefore(a,r),t){let i=document.createElement("img");i.setAttribute("data-lexical-linebreak","true"),i.style.cssText="display: inline !important; border: 0px !important; margin: 0px !important;",i.alt="",o.insertBefore(i,a),o.__lexicalLineBreak=i}else o.__lexicalLineBreak=a}getFirstChildOffset(){let t=0;for(let n=this.after;n!==null;n=n.previousSibling)t++;return t}resolveChildIndex(t,n,o,r){if(o===this.element){let l=this.getFirstChildOffset();return[t,Math.min(l+t.getChildrenSize(),Math.max(l,r))]}let a=aL(n,o);a.push(r);let i=aL(n,this.element),s=t.getIndexWithinParent();for(let l=0;l<i.length;l++){let d=a[l],c=i[l];if(d===void 0||d<c)break;if(d>c){s+=1;break}}return[t.getParentOrThrow(),s]}};function aL(e,t){let n=[],o=t;for(;o!==e&&o!==null;o=o.parentNode){let r=0;for(let a=o.previousSibling;a!==null;a=a.previousSibling)r++;n.push(r)}return o!==e&&de(225),n.reverse()}var ki=class extends pr{__first;__last;__size;__format;__style;__indent;__dir;__textFormat;__textStyle;constructor(t){super(t),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(t){super.afterCloneFrom(t),this.__key===t.__key&&(this.__first=t.__first,this.__last=t.__last,this.__size=t.__size),this.__indent=t.__indent,this.__format=t.__format,this.__style=t.__style,this.__dir=t.__dir,this.__textFormat=t.__textFormat,this.__textStyle=t.__textStyle}getFormat(){return this.getLatest().__format}getFormatType(){let t=this.getFormat();return c$[t]||""}getStyle(){return this.getLatest().__style}getIndent(){return this.getLatest().__indent}getChildren(){let t=[],n=this.getFirstChild();for(;n!==null;)t.push(n),n=n.getNextSibling();return t}getChildrenKeys(){let t=[],n=this.getFirstChild();for(;n!==null;)t.push(n.__key),n=n.getNextSibling();return t}getChildrenSize(){return this.getLatest().__size}isEmpty(){return this.getChildrenSize()===0}isDirty(){let t=Xt()._dirtyElements;return t!==null&&t.has(this.__key)}isLastChild(){let t=this.getLatest(),n=this.getParentOrThrow().getLastChild();return n!==null&&n.is(t)}getAllTextNodes(){let t=[],n=this.getFirstChild();for(;n!==null;){if(ze(n)&&t.push(n),re(n)){let o=n.getAllTextNodes();t.push(...o)}n=n.getNextSibling()}return t}getFirstDescendant(){let t=this.getFirstChild();for(;re(t);){let n=t.getFirstChild();if(n===null)break;t=n}return t}getLastDescendant(){let t=this.getLastChild();for(;re(t);){let n=t.getLastChild();if(n===null)break;t=n}return t}getDescendantByIndex(t){let n=this.getChildren(),o=n.length;if(t>=o){let a=n[o-1];return re(a)&&a.getLastDescendant()||a||null}let r=n[t];return re(r)&&r.getFirstDescendant()||r||null}getFirstChild(){let t=this.getLatest().__first;return t===null?null:Fn(t)}getFirstChildOrThrow(){let t=this.getFirstChild();return t===null&&de(45,this.__key),t}getLastChild(){let t=this.getLatest().__last;return t===null?null:Fn(t)}getLastChildOrThrow(){let t=this.getLastChild();return t===null&&de(96,this.__key),t}getChildAtIndex(t){let n=this.getChildrenSize(),o,r;if(t<n/2){for(o=this.getFirstChild(),r=0;o!==null&&r<=t;){if(r===t)return o;o=o.getNextSibling(),r++}return null}for(o=this.getLastChild(),r=n-1;o!==null&&r>=t;){if(r===t)return o;o=o.getPreviousSibling(),r--}return null}getTextContent(){let t="",n=this.getChildren(),o=n.length;for(let r=0;r<o;r++){let a=n[r];t+=a.getTextContent(),re(a)&&r!==o-1&&!a.isInline()&&(t+=lm)}return t}getTextContentSize(){let t=0,n=this.getChildren(),o=n.length;for(let r=0;r<o;r++){let a=n[r];t+=a.getTextContentSize(),re(a)&&r!==o-1&&!a.isInline()&&(t+=2)}return t}getDirection(){return this.getLatest().__dir}getTextFormat(){return this.getLatest().__textFormat}hasFormat(t){if(t!==""){let n=_v[t];return(this.getFormat()&n)!==0}return!1}hasTextFormat(t){let n=lo[t];return(this.getTextFormat()&n)!==0}getFormatFlags(t,n){return Jc(this.getLatest().__textFormat,t,n)}getTextStyle(){return this.getLatest().__textStyle}select(t,n){$n();let o=Ot(),r=t,a=n,i=this.getChildrenSize();if(!this.canBeEmpty()){if(t===0&&n===0){let l=this.getFirstChild();if(ze(l)||re(l))return l.select(0,0)}else if(!(t!==void 0&&t!==i||n!==void 0&&n!==i)){let l=this.getLastChild();if(ze(l)||re(l))return l.select()}}r===void 0&&(r=i),a===void 0&&(a=i);let s=this.__key;return Ge(o)?(o.anchor.set(s,r,"element"),o.focus.set(s,a,"element"),o.dirty=!0,o):pP(s,r,s,a,"element","element")}selectStart(){let t=this.getFirstDescendant();return t?t.selectStart():this.select()}selectEnd(){let t=this.getLastDescendant();return t?t.selectEnd():this.select()}clear(){let t=this.getWritable();return this.getChildren().forEach(n=>n.remove()),t}append(...t){return this.splice(this.getChildrenSize(),0,t)}setDirection(t){let n=this.getWritable();return n.__dir=t,n}setFormat(t){return this.getWritable().__format=t!==""?_v[t]:0,this}setStyle(t){return this.getWritable().__style=t||"",this}setTextFormat(t){let n=this.getWritable();return n.__textFormat=t,n}setTextStyle(t){let n=this.getWritable();return n.__textStyle=t,n}setIndent(t){return this.getWritable().__indent=t,this}splice(t,n,o){Jp(this)&&de(324,this.__key,this.__type);let r=this.getChildrenSize(),a=this.getWritable();t+n<=r||de(226,String(t),String(n),String(r));let i=a.__key,s=[],l=[],d=this.getChildAtIndex(t+n),c=null,f=r-n+o.length;if(t!==0)if(t===r)c=this.getLastChild();else{let m=this.getChildAtIndex(t);m!==null&&(c=m.getPreviousSibling())}if(n>0){let m=c===null?this.getFirstChild():c.getNextSibling();for(let g=0;g<n;g++){m===null&&de(100);let h=m.getNextSibling(),v=m.__key;Ii(m.getWritable()),l.push(v),m=h}}let p=c;for(let m of o){p!==null&&m.is(p)&&(c=p=p.getPreviousSibling());let g=m.getWritable();g.__parent===i&&f--,Ii(g);let h=m.__key;if(p===null)a.__first=h,g.__prev=null;else{let v=p.getWritable();v.__next=h,g.__prev=v.__key}m.__key===i&&de(76),g.__parent=i,s.push(h),p=m}if(t+n===r)p!==null&&(p.getWritable().__next=null,a.__last=p.__key);else if(d!==null){let m=d.getWritable();if(p!==null){let g=p.getWritable();m.__prev=p.__key,g.__next=d.__key}else m.__prev=null}if(a.__size=f,l.length){let m=Ot();if(Ge(m)){let g=new Set(l),h=new Set(s),{anchor:v,focus:y}=m;iL(v,g,h)&&tm(v,v.getNode(),this,c,d),iL(y,g,h)&&tm(y,y.getNode(),this,c,d),f!==0||this.canBeEmpty()||mr(this)||this.remove()}}return a}getDOMSlot(t){return new ny(t)}exportDOM(t){let{element:n}=super.exportDOM(t);if(So(n)){let o=this.getIndent();o>0&&(n.style.paddingInlineStart=40*o+"px");let r=this.getDirection();r&&(n.dir=r)}return{element:n}}exportJSON(){let t={children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),...super.exportJSON()},n=this.getTextFormat(),o=this.getTextStyle();return n===0&&o===""||mr(this)||this.getChildren().some(ze)||(n!==0&&(t.textFormat=n),o!==""&&(t.textStyle=o)),t}updateFromJSON(t){return super.updateFromJSON(t).setFormat(t.format).setIndent(t.indent).setDirection(t.direction).setTextFormat(t.textFormat||0).setTextStyle(t.textStyle||"")}insertNewAfter(t,n){return null}canIndent(){return!0}collapseAtStart(t){return!1}excludeFromCopy(t){return!1}canReplaceWith(t){return!0}canInsertAfter(t){return!0}canBeEmpty(){return!0}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}isInline(){return!1}isShadowRoot(){return!1}canMergeWith(t){return!1}extractWithChild(t,n,o){return!1}canMergeWhenEmpty(){return!1}reconcileObservedMutation(t,n){let o=this.getDOMSlot(t),r=o.getFirstChild();for(let a=this.getFirstChild();a;a=a.getNextSibling()){let i=n.getElementByKey(a.getKey());i!==null&&(r==null?(o.insertChild(i),r=i):r!==i&&o.replaceChild(i,r),r=r.nextSibling)}}};function re(e){return e instanceof ki}function iL(e,t,n){let o=e.getNode();for(;o;){let r=o.__key;if(t.has(r)&&!n.has(r))return!0;o=o.getParent()}return!1}var Xc=class extends pr{decorate(t,n){return null}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}};function en(e){return e instanceof Xc}var Wl=class e extends ki{__cachedText;static getType(){return"root"}static clone(){return new e}constructor(){super("root"),this.__cachedText=null}getTopLevelElementOrThrow(){de(51)}getTextContent(){let t=this.__cachedText;return!ed()&&Xt()._dirtyType!==0||t===null?super.getTextContent():t}remove(){de(52)}replace(t){de(53)}insertBefore(t){de(54)}insertAfter(t){de(55)}updateDOM(t,n){return!1}splice(t,n,o){for(let r of o)re(r)||en(r)||de(282);return super.splice(t,n,o)}static importJSON(t){return jo().updateFromJSON(t)}collapseAtStart(){return!0}};function to(e){return e instanceof Wl}function xP(e){return new Yc(new Map(e._nodeMap))}function Ay(){return new Yc(new Map([["root",new Wl]]))}function CP(e){let t=e.exportJSON(),n=e.constructor;if(t.type!==n.getType()&&de(130,n.name),re(e)){let o=t.children;Array.isArray(o)||de(59,n.name);let r=e.getChildren();for(let a=0;a<r.length;a++){let i=CP(r[a]);o.push(i)}}return t}function iK(e){return e instanceof Yc}var Yc=class e{_nodeMap;_selection;_flushSync;_readOnly;constructor(t,n){this._nodeMap=t,this._selection=n||null,this._flushSync=!1,this._readOnly=!1}isEmpty(){return this._nodeMap.size===1&&this._selection===null}read(t,n){return oL(n&&n.editor||null,this,t)}clone(t){let n=new e(this._nodeMap,t===void 0?this._selection:t);return n._readOnly=!0,n}toJSON(){return oL(null,this,()=>({root:CP(jo())}))}},nm=class extends ki{static getType(){return"artificial"}createDOM(t){return document.createElement("div")}},Gl=class e extends ki{static getType(){return"paragraph"}static clone(t){return new e(t.__key)}createDOM(t){let n=document.createElement("p"),o=$l(t.theme,"paragraph");return o!==void 0&&n.classList.add(...o),n}updateDOM(t,n,o){return!1}static importDOM(){return{p:t=>({conversion:sK,priority:0})}}exportDOM(t){let{element:n}=super.exportDOM(t);if(So(n)){this.isEmpty()&&n.append(document.createElement("br"));let o=this.getFormatType();o&&(n.style.textAlign=o)}return{element:n}}static importJSON(t){return Na().updateFromJSON(t)}exportJSON(){let t=super.exportJSON();if(t.textFormat===void 0||t.textStyle===void 0){let n=this.getChildren().find(ze);n?(t.textFormat=n.getFormat(),t.textStyle=n.getStyle()):(t.textFormat=this.getTextFormat(),t.textStyle=this.getTextStyle())}return t}insertNewAfter(t,n){let o=Na();o.setTextFormat(t.format),o.setTextStyle(t.style);let r=this.getDirection();return o.setDirection(r),o.setFormat(this.getFormatType()),o.setStyle(this.getStyle()),this.insertAfter(o,n),o}collapseAtStart(){let t=this.getChildren();if(t.length===0||ze(t[0])&&t[0].getTextContent().trim()===""){if(this.getNextSibling()!==null)return this.selectNext(),this.remove(),!0;if(this.getPreviousSibling()!==null)return this.selectPrevious(),this.remove(),!0}return!1}};function sK(e){let t=Na();if(e.style&&(t.setFormat(e.style.textAlign),$P(e,t)),t.getFormatType()===""){let n=e.getAttribute("align");n&&n&&n in _v&&t.setFormat(n)}return{node:t}}function Na(){return au(new Gl)}function bP(e){return e instanceof Gl}var Bl=0,lK=1,dK=2,cK=3,uK=4;function wP(e,t,n,o){let r=e._keyToDOMMap;r.clear(),e._editorState=Ay(),e._pendingEditorState=o,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 a=e._observer;a!==null&&(a.disconnect(),e._observer=null),t!==null&&(t.textContent=""),n!==null&&(n.textContent="",r.set("root",n))}function SP(e){let t=new Set,n=new Set,o=e;for(;o;){let{ownNodeConfig:r}=iu(o),a=o.transform;if(!n.has(a)){n.add(a);let i=o.transform();i&&t.add(i)}if(r){let i=r.$transform;i&&t.add(i),o=r.extends}else{let i=Object.getPrototypeOf(o);o=i.prototype instanceof pr&&i!==pr?i:void 0}}return t}function fK(e){let t=e||{},n=rK(),o=t.theme||{},r=e===void 0?n:t.parentEditor||null,a=t.disableEvents||!1,i=Ay(),s=t.namespace||(r!==null?r._config.namespace:RP()),l=t.editorState,d=[Wl,As,Kl,ql,Gl,nm,...t.nodes||[]],{onError:c,html:f}=t,p=t.editable===void 0||t.editable,m;if(e===void 0&&n!==null)m=n._nodes;else{m=new Map;for(let h=0;h<d.length;h++){let v=d[h],y=null,x=null;if(typeof v!="function"){let L=v;v=L.replace,y=L.with,x=L.withKlass||null}iu(v);let C=v.getType(),w=SP(v);m.set(C,{exportDOM:f&&f.export?f.export.get(v):void 0,klass:v,replace:y,replaceWithKlass:x,sharedNodeState:IL(d[h]),transforms:w})}}let g=new Li(i,r,m,{disableEvents:a,namespace:s,theme:o},c||console.error,(function(h,v){let y=new Map,x=new Set,C=w=>{Object.keys(w).forEach(L=>{let S=y.get(L);S===void 0&&(S=[],y.set(L,S)),S.push(w[L])})};return h.forEach(w=>{let L=w.klass.importDOM;if(L==null||x.has(L))return;x.add(L);let S=L.call(w.klass);S!==null&&C(S)}),v&&C(v),y})(m,f?f.import:void 0),p,e);return l!==void 0&&(g._pendingEditorState=l,g._dirtyType=2),(function(h){h.registerCommand(gy,_$,Bl),h.registerCommand(hy,D$,Bl),h.registerCommand(vy,O$,Bl),h.registerCommand(yy,F$,Bl),h.registerCommand(wy,B$,Bl)})(g),g}var Li=class{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(t,n,o,r,a,i,s,l){this._createEditorArgs=l,this._parentEditor=n,this._rootElement=null,this._editorState=t,this._pendingEditorState=null,this._compositionKey=null,this._deferred=[],this._keyToDOMMap=new Map,this._updates=[],this._updating=!1,this._listeners={decorator:new Set,editable:new Set,mutation:new Map,root:new Set,textcontent:new Set,update:new Set},this._commands=new Map,this._config=r,this._nodes=o,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=RP(),this._onError=a,this._htmlConversions=i,this._editable=s,this._headless=n!==null&&n._headless,this._window=null,this._blockCursorElement=null}isComposing(){return this._compositionKey!=null}registerUpdateListener(t){let n=this._listeners.update;return n.add(t),()=>{n.delete(t)}}registerEditableListener(t){let n=this._listeners.editable;return n.add(t),()=>{n.delete(t)}}registerDecoratorListener(t){let n=this._listeners.decorator;return n.add(t),()=>{n.delete(t)}}registerTextContentListener(t){let n=this._listeners.textcontent;return n.add(t),()=>{n.delete(t)}}registerRootListener(t){let n=this._listeners.root;return t(this._rootElement,null),n.add(t),()=>{t(null,this._rootElement),n.delete(t)}}registerCommand(t,n,o){o===void 0&&de(35);let r=this._commands;r.has(t)||r.set(t,[new Set,new Set,new Set,new Set,new Set]);let a=r.get(t);a===void 0&&de(36,String(t));let i=a[o];return i.add(n),()=>{i.delete(n),a.every(s=>s.size===0)&&r.delete(t)}}registerMutationListener(t,n,o){let r=this.resolveRegisteredNodeAfterReplacements(this.getRegisteredNode(t)).klass,a=this._listeners.mutation,i=a.get(n);i===void 0&&(i=new Set,a.set(n,i)),i.add(r);let s=o&&o.skipInitialization;return s!==void 0&&s||this.initializeMutationListener(n,r),()=>{i.delete(r),i.size===0&&a.delete(n)}}getRegisteredNode(t){let n=this._nodes.get(t.getType());return n===void 0&&de(37,t.name),n}resolveRegisteredNodeAfterReplacements(t){for(;t.replaceWithKlass;)t=this.getRegisteredNode(t.replaceWithKlass);return t}initializeMutationListener(t,n){let o=this._editorState,r=iy(o).get(n.getType());if(!r)return;let a=new Map;for(let i of r.keys())a.set(i,"created");a.size>0&&t(a,{dirtyLeaves:new Set,prevEditorState:o,updateTags:new Set(["registerMutationListener"])})}registerNodeTransformToKlass(t,n){let o=this.getRegisteredNode(t);return o.transforms.add(n),o}registerNodeTransform(t,n){let o=this.registerNodeTransformToKlass(t,n),r=[o],a=o.replaceWithKlass;if(a!=null){let i=this.registerNodeTransformToKlass(a,n);r.push(i)}return(function(i,s){let l=iy(i.getEditorState()),d=[];for(let c of s){let f=l.get(c);f&&d.push(f)}d.length!==0&&i.update(()=>{for(let c of d)for(let f of c.keys()){let p=Fn(f);p&&p.markDirty()}},i._pendingEditorState===null?{tag:Up}:void 0)})(this,r.map(i=>i.klass.getType())),()=>{r.forEach(i=>i.transforms.delete(n))}}hasNode(t){return this._nodes.has(t.getType())}hasNodes(t){return t.every(this.hasNode.bind(this))}dispatchCommand(t,n){return Re(this,t,n)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(t){let n=this._rootElement;if(t!==n){let o=$l(this._config.theme,"root"),r=this._pendingEditorState||this._editorState;if(this._rootElement=t,wP(this,n,t,r),n!==null&&(this._config.disableEvents||z$(n),o!=null&&n.classList.remove(...o)),t!==null){let a=Hy(t),i=t.style;i.userSelect="text",i.whiteSpace="pre-wrap",i.wordBreak="break-word",t.setAttribute("data-lexical-editor","true"),this._window=a,this._dirtyType=2,SL(this),this._updateTags.add(Up),Ra(this),this._config.disableEvents||(function(s,l){let d=s.ownerDocument;Qv.set(s,d);let c=Xp.get(d)??0;c<1&&d.addEventListener("selectionchange",nP),Xp.set(d,c+1),s.__lexicalEditor=l;let f=tP(s);for(let p=0;p<jv.length;p++){let[m,g]=jv[p],h=typeof g=="function"?v=>{zk(v)||(Bk(v),(l.isEditable()||m==="click")&&g(v,l))}:v=>{if(zk(v))return;Bk(v);let y=l.isEditable();switch(m){case"cut":return y&&Re(l,Iy,v);case"copy":return Re(l,Sy,v);case"paste":return y&&Re(l,xy,v);case"dragstart":return y&&Re(l,KL,v);case"dragover":return y&&Re(l,VL,v);case"dragend":return y&&Re(l,qL,v);case"focus":return y&&Re(l,WL,v);case"blur":return y&&Re(l,GL,v);case"drop":return y&&Re(l,$L,v)}};s.addEventListener(m,h),f.push(()=>{s.removeEventListener(m,h)})}})(t,this),o!=null&&t.classList.add(...o)}else this._window=null,this._updateTags.add(Up),Ra(this);zc("root",this,!1,t,n)}}getElementByKey(t){return this._keyToDOMMap.get(t)||null}getEditorState(){return this._editorState}setEditorState(t,n){t.isEmpty()&&de(38);let o=t;o._readOnly&&(o=xP(t),o._selection=t._selection?t._selection.clone():null),wL(this);let r=this._pendingEditorState,a=this._updateTags,i=n!==void 0?n.tag:null;r===null||r.isEmpty()||(i!=null&&a.add(i),Ra(this)),this._pendingEditorState=o,this._dirtyType=2,this._dirtyElements.set("root",!1),this._compositionKey=null,i!=null&&a.add(i),this._updating||Ra(this)}parseEditorState(t,n){return(function(o,r,a){let i=Ay(),s=Vn,l=No,d=qn,c=r._dirtyElements,f=r._dirtyLeaves,p=r._cloneNotNeeded,m=r._dirtyType;r._dirtyElements=new Map,r._dirtyLeaves=new Set,r._cloneNotNeeded=new Set,r._dirtyType=0,Vn=i,No=!1,qn=r,Ey(null);try{let g=r._nodes;Py(o.root,g),a&&a(),i._readOnly=!0}catch(g){g instanceof Error&&r._onError(g)}finally{r._dirtyElements=c,r._dirtyLeaves=f,r._cloneNotNeeded=p,r._dirtyType=m,Vn=s,No=l,qn=d}return i})(typeof t=="string"?JSON.parse(t):t,this,n)}read(t){return Ra(this),this.getEditorState().read(t,{editor:this})}update(t,n){(function(o,r,a){o._updating?o._updates.push([r,a]):fm(o,r,a)})(this,t,n)}focus(t,n={}){let o=this._rootElement;o!==null&&(o.setAttribute("autocapitalize","off"),da(this,()=>{let r=Ot(),a=jo();r!==null?r.dirty||_o(r.clone()):a.getChildrenSize()!==0&&(n.defaultSelection==="rootStart"?a.selectStart():a.selectEnd()),hm("focus"),OP(()=>{o.removeAttribute("autocapitalize"),t&&t()})}),this._pendingEditorState===null&&o.removeAttribute("autocapitalize"))}blur(){let t=this._rootElement;t!==null&&t.blur();let n=Or(this._window);n!==null&&n.removeAllRanges()}isEditable(){return this._editable}setEditable(t){this._editable!==t&&(this._editable=t,zc("editable",this,!0,t))}toJSON(){return{editorState:this._editorState.toJSON()}}};Li.version="0.41.0+prod.esm";var oy=null;function Ey(e){oy=e}var IP=1;function pK(){IP=1}function Ry(e,t){let n=My(e,t);return n===void 0&&de(30,t),n}function My(e,t){return e._nodes.get(t)}var mK=typeof queueMicrotask=="function"?queueMicrotask:e=>{Promise.resolve().then(e)};function TP(e){return en(gm(e))}function Ny(e){let t=document.activeElement;if(!So(t))return!1;let n=t.nodeName;return en(gm(e))&&(n==="INPUT"||n==="TEXTAREA"||t.contentEditable==="true"&&ou(t)==null)}function nu(e,t,n){let o=e.getRootElement();try{return o!==null&&o.contains(t)&&o.contains(n)&&t!==null&&!Ny(t)&&_y(t)===e}catch{return!1}}function pm(e){return e instanceof Li}function _y(e){let t=e;for(;t!=null;){let n=ou(t);if(pm(n))return n;t=ru(t)}return null}function ou(e){return e?e.__lexicalEditor:null}function gK(e){return s$.test(e)?"rtl":l$.test(e)?"ltr":null}function Si(e){return ky(e)||e.isToken()}function Ea(e){return Si(e)||e.isSegmented()}function ca(e){return td(e)&&e.nodeType===3}function kP(e){return td(e)&&e.nodeType===9}function Rs(e){let t=e;for(;t!=null;){if(ca(t))return t;t=t.firstChild}return null}function Jc(e,t,n){let o=lo[t];if(n!==null&&(e&o)===(n&o))return e;let r=e^o;return t==="subscript"?r&=~lo.superscript:t==="superscript"?r&=~lo.subscript:t==="lowercase"?(r&=~lo.uppercase,r&=~lo.capitalize):t==="uppercase"?(r&=~lo.lowercase,r&=~lo.capitalize):t==="capitalize"&&(r&=~lo.lowercase,r&=~lo.uppercase),r}function hK(e){return ze(e)||ks(e)||en(e)}function LP(e,t){let n=(function(){let i=oy;return oy=null,i})();if((t=t||n&&n.__key)!=null)return void(e.__key=t);$n(),hP();let o=Xt(),r=Oa(),a=""+IP++;r._nodeMap.set(a,e),re(e)?o._dirtyElements.set(a,!0):o._dirtyLeaves.add(a),o._cloneNotNeeded.add(a),o._dirtyType=1,e.__key=a}function Ii(e){let t=e.getParent();if(t!==null){let n=e.getWritable(),o=t.getWritable(),r=e.getPreviousSibling(),a=e.getNextSibling(),i=a!==null?a.__key:null,s=r!==null?r.__key:null,l=r!==null?r.getWritable():null,d=a!==null?a.getWritable():null;r===null&&(o.__first=i),a===null&&(o.__last=s),l!==null&&(l.__next=i),d!==null&&(d.__prev=s),n.__prev=null,n.__next=null,n.__parent=null,o.__size--}}function om(e){hP(),Jp(e)&&de(323,e.__key,e.__type);let t=e.getLatest(),n=t.__parent,o=Oa(),r=Xt(),a=o._nodeMap,i=r._dirtyElements;n!==null&&(function(l,d,c){let f=l;for(;f!==null;){if(c.has(f))return;let p=d.get(f);if(p===void 0)break;c.set(f,!1),f=p.__parent}})(n,a,i);let s=t.__key;r._dirtyType=1,re(e)?i.set(s,!0):r._dirtyLeaves.add(s)}function Kn(e){$n();let t=Xt(),n=t._compositionKey;if(e!==n){if(t._compositionKey=e,n!==null){let o=Fn(n);o!==null&&o.getWritable()}if(e!==null){let o=Fn(e);o!==null&&o.getWritable()}}}function wi(){return ed()?null:Xt()._compositionKey}function Fn(e,t){let n=(t||Oa())._nodeMap.get(e);return n===void 0?null:n}function Dy(e,t){let n=mm(e,Xt());return n!==void 0?Fn(n,t):null}function mm(e,t){return e[`__lexicalKey_${t._key}`]}function gm(e,t){let n=e;for(;n!=null;){let o=Dy(n,t);if(o!==null)return o;n=ru(n)}return null}function PP(e){let t=e._decorators,n=Object.assign({},t);return e._pendingDecorators=n,n}function sL(e){return e.read(()=>jo().getTextContent())}function jo(){return AP(Oa())}function AP(e){return e._nodeMap.get("root")}function _o(e){$n();let t=Oa();e!==null&&(e.dirty=!0,e.setCachedNodes(null)),t._selection=e}function zl(e){let t=Xt(),n=(function(o,r){let a=o;for(;a!=null;){let i=mm(a,r);if(i!==void 0)return i;a=ru(a)}return null})(e,t);return n===null?e===t.getRootElement()?Fn("root"):null:Fn(n)}function EP(e){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(e)}function Oy(e){let t=[],n=e;for(;n!==null;)t.push(n),n=n._parentEditor;return t}function RP(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,5)}function MP(e){return ca(e)?e.nodeValue:null}function Fy(e,t,n){let o=Or(Qo(t));if(o===null)return;let r=o.anchorNode,{anchorOffset:a,focusOffset:i}=o;if(r!==null){let s=MP(r),l=gm(r);if(s!==null&&ze(l)){if((s===Kc||s===uy)&&n){let d=n.length;s=n,a=d,i=d}s!==null&&By(l,s,a,i,e)}}}function By(e,t,n,o,r){let a=e;if(a.isAttached()&&(r||!a.isDirty())){let i=a.isComposing(),s=t;if((i||r)&&(t.endsWith(Kc)&&(s=t.slice(0,-Kc.length)),r)){let d=uy,c;for(;(c=s.indexOf(d))!==-1;)s=s.slice(0,c)+s.slice(c+d.length),n!==null&&n>c&&(n=Math.max(c,n-d.length)),o!==null&&o>c&&(o=Math.max(c,o-d.length))}let l=a.getTextContent();if(r||s!==l){if(s===""){if(Kn(null),im||eu||sm)a.remove();else{let h=Xt();setTimeout(()=>{h.update(()=>{a.isAttached()&&a.remove()})},20)}return}let d=a.getParent(),c=Ns(),f=a.getTextContentSize(),p=wi(),m=a.getKey();if(a.isToken()||p!==null&&m===p&&!i||Ge(c)&&(d!==null&&!d.canInsertTextBefore()&&c.anchor.offset===0||c.anchor.key===e.__key&&c.anchor.offset===0&&!a.canInsertTextBefore()&&!i||c.focus.key===e.__key&&c.focus.offset===f&&!a.canInsertTextAfter()&&!i))return void a.markDirty();let g=Ot();if(!Ge(g)||n===null||o===null)return void lL(a,s,g);if(g.setTextNodeRange(a,n,a,o),a.isSegmented()){let h=Hn(a.getTextContent());a.replace(h),a=h}lL(a,s,g)}}}function lL(e,t,n){if(e.setTextContent(t),Ge(n)){let o=e.getKey();for(let r of["anchor","focus"]){let a=n[r];a.type==="text"&&a.key===o&&(a.offset=Nr(e,a.offset,"clamp"))}}}function _p(e,t,n){let o=t[n]||!1;return o==="any"||o===e[n]}function NP(e,t){return _p(e,t,"altKey")&&_p(e,t,"ctrlKey")&&_p(e,t,"shiftKey")&&_p(e,t,"metaKey")}function $t(e,t,n){if(!NP(e,n))return!1;if(e.key.toLowerCase()===t.toLowerCase())return!0;if(t.length>1||e.key.length===1&&e.key.charCodeAt(0)<=127)return!1;let o="Key"+t.toUpperCase();return e.code===o}var Aa={ctrlKey:!Ar,metaKey:Ar},dL={altKey:Ar,ctrlKey:!Ar};function cL(e){return e.key==="Backspace"}function uL(e){return $t(e,"a",Aa)}function vK(e){let t=jo();if(Ge(e)){let n=e.anchor,o=e.focus,r=n.getNode().getTopLevelElementOrThrow().getParentOrThrow();return n.set(r.getKey(),0,"element"),o.set(r.getKey(),r.getChildrenSize(),"element"),Vp(e),e}{let n=t.select(0,t.getChildrenSize());return _o(Vp(n)),n}}function $l(e,t){e.__lexicalClassNameCache===void 0&&(e.__lexicalClassNameCache={});let n=e.__lexicalClassNameCache,o=n[t];if(o!==void 0)return o;let r=e[t];if(typeof r=="string"){let a=su(r);return n[t]=a,a}return r}function zy(e,t,n,o,r){if(n.size===0)return;let a=o.__type,i=o.__key,s=t.get(a);s===void 0&&de(33,a);let l=s.klass,d=e.get(l);d===void 0&&(d=new Map,e.set(l,d));let c=d.get(i),f=c==="destroyed"&&r==="created";(c===void 0||f)&&d.set(i,f?"updated":r)}function yK(e){let t=e.getType(),n=Oa();if(n._readOnly){let a=iy(n).get(t);return a?Array.from(a.values()):[]}let o=n._nodeMap,r=[];for(let[,a]of o)a instanceof e&&a.__type===t&&a.isAttached()&&r.push(a);return r}function fL(e,t,n){let o=e.getParent(),r=n,a=e;return o!==null&&(t&&n===0?(r=a.getIndexWithinParent(),a=o):t||n!==a.getChildrenSize()||(r=a.getIndexWithinParent()+1,a=o)),a.getChildAtIndex(t?r-1:r)}function _P(e,t){let n=e.offset;if(e.type==="element")return fL(e.getNode(),t,n);{let o=e.getNode();if(t&&n===0||!t&&n===o.getTextContentSize()){let r=t?o.getPreviousSibling():o.getNextSibling();return r===null?fL(o.getParentOrThrow(),t,o.getIndexWithinParent()+(t?0:1)):r}}return null}function DP(e){let t=Qo(e).event,n=t&&t.inputType;return n==="insertFromPaste"||n==="insertFromPasteAsQuotation"}function Re(e,t,n){return(function(o,r,a){let i=Oy(o);for(let s=4;s>=0;s--)for(let l=0;l<i.length;l++){let d=i[l],c=d._commands.get(r);if(c!==void 0){let f=c[s];if(f!==void 0){let p=Array.from(f),m=p.length,g=!1;if(da(d,()=>{for(let h=0;h<m;h++)if(p[h](a,o))return void(g=!0)}),g)return g}}}return!1})(e,t,n)}function jl(e,t){let n=e._keyToDOMMap.get(t);return n===void 0&&de(75,t),n}function ru(e){let t=e.assignedSlot||e.parentElement;return UP(t)?t.host:t}function Uy(e){return kP(e)?e:So(e)?e.ownerDocument:null}function xK(e){return Xt()._updateTags.has(e)}function hm(e){$n(),Xt()._updateTags.add(e)}function OP(e){$n(),Xt()._deferred.push(e)}function rm(e,t){let n=e.getParent();for(;n!==null;){if(n.is(t))return!0;n=n.getParent()}return!1}function Hy(e){let t=Uy(e);return t?t.defaultView:null}function Qo(e){let t=e._window;return t===null&&de(78),t}function CK(e){return re(e)&&e.isInline()||en(e)&&e.isInline()}function FP(e){let t=e.getParentOrThrow();for(;t!==null;){if(mr(t))return t;t=t.getParentOrThrow()}return t}function mr(e){return to(e)||re(e)&&e.isShadowRoot()}function $y(e){let t=e.constructor.clone(e);return LP(t,null),t.afterCloneFrom(e),t}function au(e){let t=Xt(),n=e.getType(),o=My(t,n);o===void 0&&de(200,e.constructor.name,n);let{replace:r,replaceWithKlass:a}=o;if(r!==null){let i=r(e),s=i.constructor;return a!==null?i instanceof a||de(201,a.name,a.getType(),s.name,s.getType(),e.constructor.name,n):i instanceof e.constructor&&s!==e.constructor||de(202,s.name,s.getType(),e.constructor.name,n),i.__key===e.__key&&de(203,e.constructor.name,n,s.name,s.getType()),i}return e}function Ev(e,t){!to(e.getParent())||re(t)||en(t)||de(99)}function BP(e){let t=Fn(e);return t===null&&de(63,e),t}function Rv(e){return(en(e)||re(e)&&!e.canBeEmpty())&&!e.isInline()}function ry(e,t,n){n.style.removeProperty("caret-color"),t._blockCursorElement=null;let o=e.parentElement;o!==null&&o.removeChild(e)}function Or(e){return Dr?(e||window).getSelection():null}function zP(e){let t=Hy(e);return t?t.getSelection():null}function bK(e,t){let n=e.getChildAtIndex(t);n==null&&(n=e),mr(e)&&de(102);let o=i=>{let s=i.getParentOrThrow(),l=mr(s),d=i!==n||l?$y(i):i;if(l)return re(i)&&re(d)||de(133),i.insertAfter(d),[i,d,d];{let[c,f,p]=o(s),m=i.getNextSiblings();return p.append(d,...m),[c,f,d]}},[r,a]=o(n);return[r,a]}function wK(e){return So(e)&&e.tagName==="A"}function So(e){return td(e)&&e.nodeType===1}function td(e){return typeof e=="object"&&e!==null&&"nodeType"in e&&typeof e.nodeType=="number"}function UP(e){return td(e)&&e.nodeType===11}function HP(e){let t=new 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 e.nodeName.match(t)!==null}function ay(e){let t=new 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 e.nodeName.match(t)!==null}function Ma(e){if(en(e)&&!e.isInline())return!0;if(!re(e)||mr(e))return!1;let t=e.getFirstChild(),n=t===null||ks(t)||ze(t)||t.isInline();return!e.isInline()&&e.canBeEmpty()!==!1&&n}function Ky(){return Xt()}var pL=new WeakMap,SK=new Map;function iy(e){if(!e._readOnly&&e.isEmpty())return SK;e._readOnly||de(192);let t=pL.get(e);return t||(t=(function(n){let o=new Map;for(let[r,a]of n._nodeMap){let i=a.__type,s=o.get(i);s||(s=new Map,o.set(i,s)),s.set(r,a)}return o})(e),pL.set(e,t)),t}function Vy(e){let t=e.constructor.clone(e);return t.afterCloneFrom(e),t}function IK(e){return(t=Vy(e))[oP]=!0,t;var t}function $P(e,t){let n=parseInt(e.style.paddingInlineStart,10)||0,o=Math.round(n/40);t.setIndent(o)}function TK(e){e.__lexicalUnmanaged=!0}function KP(e){return e.__lexicalUnmanaged===!0}function Dc(e,t){return(function(n,o){return Object.prototype.hasOwnProperty.call(n,o)})(e,t)&&e[t]!==pr[t]}function iu(e){let t=Tk in e.prototype?e.prototype[Tk]():void 0,n=(function(i){if(!(i===pr||i.prototype instanceof pr)){let s="<unknown>",l="<unknown>";try{s=i.getType()}catch{}try{Li.version&&(l=JSON.parse(Li.version))}catch{}de(290,i.name,s,l)}return i===Xc||i===ki||i===pr})(e),o=!n&&Dc(e,"getType")?e.getType():void 0,r,a=o;if(t)if(o)r=t[o];else for(let[i,s]of Object.entries(t))a=i,r=s;if(!n&&a&&(Dc(e,"getType")||(e.getType=()=>a),Dc(e,"clone")||(e.clone=i=>(Ey(i),new e)),Dc(e,"importJSON")||(e.importJSON=r&&r.$importJSON||(i=>new e().updateFromJSON(i))),!Dc(e,"importDOM")&&r)){let{importDOM:i}=r;i&&(e.importDOM=()=>i)}return{ownNodeConfig:r,ownNodeType:a}}function kK(e){let t=Ky();return $n(),new(t.resolveRegisteredNodeAfterReplacements(t.getRegisteredNode(e))).klass}var Uc=(e,t)=>{let n=e;for(;n!=null&&!to(n);){if(t(n))return n;n=n.getParent()}return null},LK={next:"previous",previous:"next"},Ql=class{origin;constructor(t){this.origin=t}[Symbol.iterator](){return Gy({hasNext:Ms,initial:this.getAdjacentCaret(),map:t=>t,step:t=>t.getAdjacentCaret()})}getAdjacentCaret(){return Wn(this.getNodeAtCaret(),this.direction)}getSiblingCaret(){return Wn(this.origin,this.direction)}remove(){let t=this.getNodeAtCaret();return t&&t.remove(),this}replaceOrInsert(t,n){let o=this.getNodeAtCaret();return t.is(this.origin)||t.is(o)||(o===null?this.insert(t):o.replace(t,n)),this}splice(t,n,o="next"){let r=o===this.direction?n:Array.from(n).reverse(),a=this,i=this.getParentAtCaret(),s=new Map;for(let l=a.getAdjacentCaret();l!==null&&s.size<t;l=l.getAdjacentCaret()){let d=l.origin.getWritable();s.set(d.getKey(),d)}for(let l of r){if(s.size>0){let d=a.getNodeAtCaret();if(d){if(s.delete(d.getKey()),s.delete(l.getKey()),!(d.is(l)||a.origin.is(l))){let c=l.getParent();c&&c.is(i)&&l.remove(),d.replace(l)}}else d===null&&de(263,Array.from(s).join(" "))}else a.insert(l);a=Wn(l,this.direction)}for(let l of s.values())l.remove();return this}},Zc=class e extends Ql{type="child";getLatest(){let t=this.origin.getLatest();return t===this.origin?this:Da(t,this.direction)}getParentCaret(t="root"){return Wn(qy(this.getParentAtCaret(),t),this.direction)}getFlipped(){let t=Mi(this.direction);return Wn(this.getNodeAtCaret(),t)||Da(this.origin,t)}getParentAtCaret(){return this.origin}getChildCaret(){return this}isSameNodeCaret(t){return t instanceof e&&this.direction===t.direction&&this.origin.is(t.origin)}isSamePointCaret(t){return this.isSameNodeCaret(t)}},PK={root:to,shadowRoot:mr};function Mi(e){return LK[e]}function qy(e,t="root"){return PK[t](e)?null:e}var Xl=class e extends Ql{type="sibling";getLatest(){let t=this.origin.getLatest();return t===this.origin?this:Wn(t,this.direction)}getSiblingCaret(){return this}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return re(this.origin)?Da(this.origin,this.direction):null}getParentCaret(t="root"){return Wn(qy(this.getParentAtCaret(),t),this.direction)}getFlipped(){let t=Mi(this.direction);return Wn(this.getNodeAtCaret(),t)||Da(this.origin.getParentOrThrow(),t)}isSamePointCaret(t){return t instanceof e&&this.direction===t.direction&&this.origin.is(t.origin)}isSameNodeCaret(t){return(t instanceof e||t instanceof Yl)&&this.direction===t.direction&&this.origin.is(t.origin)}},Yl=class e extends Ql{type="text";offset;constructor(t,n){super(t),this.offset=n}getLatest(){let t=this.origin.getLatest();return t===this.origin?this:Pi(t,this.direction,this.offset)}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return null}getParentCaret(t="root"){return Wn(qy(this.getParentAtCaret(),t),this.direction)}getFlipped(){return Pi(this.origin,Mi(this.direction),this.offset)}isSamePointCaret(t){return t instanceof e&&this.direction===t.direction&&this.origin.is(t.origin)&&this.offset===t.offset}isSameNodeCaret(t){return(t instanceof Xl||t instanceof e)&&this.direction===t.direction&&this.origin.is(t.origin)}getSiblingCaret(){return Wn(this.origin,this.direction)}};function _a(e){return e instanceof Yl}function AK(e){return e instanceof Ql}function Ms(e){return e instanceof Xl}function Mr(e){return e instanceof Zc}var EK={next:class extends Yl{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends Yl{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},RK={next:class extends Xl{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends Xl{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},MK={next:class extends Zc{direction="next";getNodeAtCaret(){return this.origin.getFirstChild()}insert(e){return this.origin.splice(0,0,[e]),this}},previous:class extends Zc{direction="previous";getNodeAtCaret(){return this.origin.getLastChild()}insert(e){return this.origin.splice(this.origin.getChildrenSize(),0,[e]),this}}};function Wn(e,t){return e?new RK[t](e):null}function Pi(e,t,n){return e?new EK[t](e,Nr(e,n)):null}function Nr(e,t,n="error"){let o=e.getTextContentSize(),r=t==="next"?o:t==="previous"?0:t;return(r<0||r>o)&&(n!=="clamp"&&hL(284,String(t),String(o),e.getKey()),r=r<0?0:o),r}function sy(e,t){return new am(e,t)}function Da(e,t){return re(e)?new MK[t](e):null}function VP(e){return e&&e.getChildCaret()||e}function Jl(e){return e&&VP(e.getAdjacentCaret())}var ly=class e{type="node-caret-range";direction;anchor;focus;constructor(t,n,o){this.anchor=t,this.focus=n,this.direction=o}getLatest(){let t=this.anchor.getLatest(),n=this.focus.getLatest();return t===this.anchor&&n===this.focus?this:new e(t,n,this.direction)}isCollapsed(){return this.anchor.isSamePointCaret(this.focus)}getTextSlices(){let t=r=>{let a=this[r].getLatest();return _a(a)?(function(i,s){let{direction:l,origin:d}=i,c=Nr(d,s==="focus"?Mi(l):l);return sy(i,c-i.offset)})(a,r):null},n=t("anchor"),o=t("focus");if(n&&o){let{caret:r}=n,{caret:a}=o;if(r.isSameNodeCaret(a))return[sy(r,a.offset-r.offset),null]}return[n,o]}iterNodeCarets(t="root"){let n=_a(this.anchor)?this.anchor.getSiblingCaret():this.anchor.getLatest(),o=this.focus.getLatest(),r=_a(o),a=i=>i.isSameNodeCaret(o)?null:Jl(i)||i.getParentCaret(t);return Gy({hasNext:i=>i!==null&&!(r&&o.isSameNodeCaret(i)),initial:n.isSameNodeCaret(o)?null:a(n),map:i=>i,step:a})}[Symbol.iterator](){return this.iterNodeCarets("root")}},am=class{type="slice";caret;distance;constructor(t,n){this.caret=t,this.distance=n}getSliceIndices(){let{distance:t,caret:{offset:n}}=this,o=n+t;return o<n?[o,n]:[n,o]}getTextContent(){let[t,n]=this.getSliceIndices();return this.caret.origin.getTextContent().slice(t,n)}getTextContentSize(){return Math.abs(this.distance)}removeTextSlice(){let{caret:{origin:t,direction:n}}=this,[o,r]=this.getSliceIndices(),a=t.getTextContent();return Pi(t.setTextContent(a.slice(0,o)+a.slice(r)),n,o)}};function NK(e){return e instanceof am}function Wy(e){return Ai(e,Wn(jo(),e.direction))}function qP(e){return Ai(e,e)}function Ai(e,t){return e.direction!==t.direction&&de(265),new ly(e,t,e.direction)}function Gy(e){let{initial:t,hasNext:n,step:o,map:r}=e,a=t;return{[Symbol.iterator](){return this},next(){if(!n(a))return{done:!0,value:void 0};let i={done:!1,value:r(a)};return a=o(a),i}}}function jy(e,t){let n=Hc(e.origin,t.origin);switch(n===null&&de(275,e.origin.getKey(),t.origin.getKey()),n.type){case"same":{let o=e.type==="text",r=t.type==="text";return o&&r?(function(a,i){return Math.sign(a-i)})(e.offset,t.offset):e.type===t.type?0:o?-1:r?1:e.type==="child"?-1:1}case"ancestor":return e.type==="child"?-1:1;case"descendant":return t.type==="child"?1:-1;case"branch":return Qy(n)}}function Qy(e){let{a:t,b:n}=e,o=t.__key,r=n.__key,a=t,i=n;for(;a&&i;a=a.getNextSibling(),i=i.getNextSibling()){if(a.__key===r)return-1;if(i.__key===o)return 1}return a===null?1:-1}function Dp(e,t){return t.is(e)}function mL(e){return re(e)?[e.getLatest(),null]:[e.getParent(),e.getLatest()]}function Hc(e,t){if(e.is(t))return{commonAncestor:e,type:"same"};let n=new Map;for(let[o,r]=mL(e);o;r=o,o=o.getParent())n.set(o,r);for(let[o,r]=mL(t);o;r=o,o=o.getParent()){let a=n.get(o);if(a!==void 0)return a===null?(Dp(e,o)||de(276),{commonAncestor:o,type:"ancestor"}):r===null?(Dp(t,o)||de(277),{commonAncestor:o,type:"descendant"}):((re(a)||Dp(e,a))&&(re(r)||Dp(t,r))&&o.is(a.getParent())&&o.is(r.getParent())||de(278),{a,b:r,commonAncestor:o,type:"branch"})}return null}function Ei(e,t){let{type:n,key:o,offset:r}=e,a=BP(e.key);return n==="text"?(ze(a)||de(266,a.getType(),o),Pi(a,t,r)):(re(a)||de(267,a.getType(),o),QP(a,e.offset,t))}function Zl(e,t){let{origin:n,direction:o}=t,r=o==="next";_a(t)?e.set(n.getKey(),t.offset,"text"):Ms(t)?ze(n)?e.set(n.getKey(),Nr(n,o),"text"):e.set(n.getParentOrThrow().getKey(),n.getIndexWithinParent()+(r?1:0),"element"):(Mr(t)&&re(n)||de(268),e.set(n.getKey(),r?0:n.getChildrenSize(),"element"))}function WP(e){let t=Ot(),n=Ge(t)?t:mP();return $c(n,e),_o(n),n}function $c(e,t){Zl(e.anchor,t.anchor),Zl(e.focus,t.focus)}function dy(e){let{anchor:t,focus:n}=e,o=Ei(t,"next"),r=Ei(n,"next"),a=jy(o,r)<=0?"next":"previous";return Ai(Ri(o,a),Ri(r,a))}function nd(e){let{direction:t,origin:n}=e,o=Wn(n,Mi(t)).getNodeAtCaret();return o?Wn(o,t):Da(n.getParentOrThrow(),t)}function gL(e,t="root"){let n=[e];for(let o=Mr(e)?e.getParentCaret(t):e.getSiblingCaret();o!==null;o=o.getParentCaret(t))n.push(nd(o));return n}function Mv(e){return!!e&&e.origin.isAttached()}function GP(e,t="removeEmptySlices"){if(e.isCollapsed())return e;let n="root",o="next",r=t,a=Xy(e,o),i=gL(a.anchor,n),s=gL(a.focus.getFlipped(),n),l=new Set,d=[];for(let g of a.iterNodeCarets(n))if(Mr(g))l.add(g.origin.getKey());else if(Ms(g)){let{origin:h}=g;re(h)&&!l.has(h.getKey())||d.push(h)}for(let g of d)g.remove();for(let g of a.getTextSlices()){if(!g)continue;let{origin:h}=g.caret,v=h.getTextContentSize(),y=nd(Wn(h,o)),x=h.getMode();if(Math.abs(g.distance)===v&&r==="removeEmptySlices"||x==="token"&&g.distance!==0)y.remove();else if(g.distance!==0){r="removeEmptySlices";let C=g.removeTextSlice(),w=g.caret.origin;if(x==="segmented"){let L=C.origin,S=Hn(L.getTextContent()).setStyle(L.getStyle()).setFormat(L.getFormat());y.replaceOrInsert(S),C=Pi(S,o,C.offset)}w.is(i[0].origin)&&(i[0]=C),w.is(s[0].origin)&&(s[0]=C.getFlipped())}}let c,f;for(let g of i)if(Mv(g)){c=Er(g);break}for(let g of s)if(Mv(g)){f=Er(g);break}let p=(function(g,h,v){if(!g||!h)return null;let y=g.getParentAtCaret(),x=h.getParentAtCaret();if(!y||!x)return null;let C=y.getParents().reverse();C.push(y);let w=x.getParents().reverse();w.push(x);let L=Math.min(C.length,w.length),S;for(S=0;S<L&&C[S]===w[S];S++);let k=(A,P)=>{let _;for(let E=S;E<A.length;E++){let F=A[E];if(mr(F))return;!_&&P(F)&&(_=F)}return _},I=k(C,Ma),T=I&&k(w,A=>v.has(A.getKey())&&Ma(A));return I&&T?[I,T]:null})(c,f,l);if(p){let[g,h]=p;Da(g,"previous").splice(0,h.getChildren());let v=h.getParent();for(h.remove(!0);v&&v.isEmpty();){let y=v;v=v.getParent(),y.remove(!0)}}let m=[c,f,...i,...s].find(Mv);if(m)return qP(Ri(Er(m),e.direction));de(269,JSON.stringify(i.map(g=>g.origin.__key)))}function Er(e){let t=(function(r){let a=r;for(;Mr(a);){let i=Jl(a);if(!Mr(i))break;a=i}return a})(e.getLatest()),{direction:n}=t;if(ze(t.origin))return _a(t)?t:Pi(t.origin,n,n);let o=t.getAdjacentCaret();return Ms(o)&&ze(o.origin)?Pi(o.origin,n,Mi(n)):t}function jP(e){return _a(e)&&e.offset!==Nr(e.origin,e.direction)}function Ri(e,t){return e.direction===t?e:e.getFlipped()}function Xy(e,t){return e.direction===t?e:Ai(Ri(e.focus,t),Ri(e.anchor,t))}function QP(e,t,n){let o=Da(e,"next");for(let r=0;r<t;r++){let a=o.getAdjacentCaret();if(a===null)break;o=a}return Ri(o,n)}function _K(e,t="root"){let n=0,o=e,r=Jl(o);for(;r===null;){if(n--,r=o.getParentCaret(t),!r)return null;o=r,r=Jl(o)}return r&&[r,n]}function DK(e){let{origin:t,offset:n,direction:o}=e;if(n===Nr(t,o))return e.getSiblingCaret();if(n===Nr(t,Mi(o)))return nd(e.getSiblingCaret());let[r]=t.splitText(n);return ze(r)||de(281),Ri(Wn(r,"next"),o)}function OK(e,t){return!0}function FK(e,{$copyElementNode:t=$y,$splitTextPointCaretNext:n=DK,rootMode:o="shadowRoot",$shouldSplit:r=OK}={}){if(_a(e))return n(e);let a=e.getParentCaret(o);if(a){let{origin:i}=a;if(Mr(e)&&(!i.canBeEmpty()||!r(i,"first")))return nd(a);let s=(function(l){let d=[];for(let c=l.getAdjacentCaret();c;c=c.getAdjacentCaret())d.push(c.origin);return d})(e);(s.length>0||i.canBeEmpty()&&r(i,"last"))&&a.insert(t(i).splice(0,0,s))}return a}function BK(e){return e}function zK(...e){return e}function UK(e,t){return[e,t]}function HK(e){return e}function $K(e,t){if(!t||e===t)return e;for(let n in t)if(e[n]!==t[n])return{...e,...t};return e}function su(...e){let t=[];for(let n of e)if(n&&typeof n=="string")for(let[o]of n.matchAll(/\S+/g))t.push(o);return t}function KK(e,...t){let n=su(...t);n.length>0&&e.classList.add(...n)}function VK(e,...t){let n=su(...t);n.length>0&&e.classList.remove(...n)}function qK(...e){return()=>{for(let t=e.length-1;t>=0;t--)e[t]();e.length=0}}var M=Yy,iie=M.$addUpdateTag,vm=M.$applyNodeReplacement,od=M.$caretFromPoint,XP=M.$caretRangeFromSelection,ym=M.$cloneWithProperties,YP=M.$cloneWithPropertiesEphemeral,sie=M.$comparePointCaretNext,lie=M.$copyNode,JP=M.$create,_s=M.$createLineBreakNode,ZP=M.$createNodeSelection,gr=M.$createParagraphNode,die=M.$createPoint,Ds=M.$createRangeSelection,eA=M.$createRangeSelectionFromDom,tA=M.$createTabNode,Fr=M.$createTextNode,nA=M.$extendCaretToRange,Fa=M.$findMatchingParent,Jy=M.$getAdjacentChildCaret,cie=M.$getAdjacentNode,Os=M.$getAdjacentSiblingOrParentSiblingCaret,Zy=M.$getCaretInDirection,oA=M.$getCaretRange,uie=M.$getCaretRangeInDirection,rA=M.$getCharacterOffsets,Ni=M.$getChildCaret,fie=M.$getChildCaretAtIndex,ex=M.$getChildCaretOrSelf,aA=M.$getCollapsedCaretRange,pie=M.$getCommonAncestor,mie=M.$getCommonAncestorResultBranchOrder,xm=M.$getEditor,gie=M.$getNearestNodeFromDOMNode,hie=M.$getNearestRootOrShadowRoot,Cm=M.$getNodeByKey,vie=M.$getNodeByKeyOrThrow,iA=M.$getNodeFromDOMNode,lu=M.$getPreviousSelection,At=M.$getRoot,Ke=M.$getSelection,Ba=M.$getSiblingCaret,bm=M.$getState,yie=M.$getStateChange,xie=M.$getTextContent,Cie=M.$getTextNodeOffset,bie=M.$getTextPointCaret,wie=M.$getTextPointCaretSlice,Sie=M.$getWritableNodeState,sA=M.$hasAncestor,Iie=M.$hasUpdateTag,Tie=M.$insertNodes,rd=M.$isBlockElementNode,du=M.$isChildCaret,wm=M.$isDecoratorNode,lA=M.$isEditorState,je=M.$isElementNode,dA=M.$isExtendableTextPointCaret,kie=M.$isInlineElementOrDecoratorNode,cA=M.$isLeafNode,ad=M.$isLineBreakNode,Lie=M.$isNodeCaret,tx=M.$isNodeSelection,uA=M.$isParagraphNode,Ne=M.$isRangeSelection,cu=M.$isRootNode,Fs=M.$isRootOrShadowRoot,fA=M.$isSiblingCaret,Pie=M.$isTabNode,dt=M.$isTextNode,Sm=M.$isTextPointCaret,Aie=M.$isTextPointCaretSlice,nx=M.$isTokenOrSegmented,Eie=M.$isTokenOrTab,Rie=M.$nodesOfType,pA=M.$normalizeCaret,mA=M.$normalizeSelection__EXPERIMENTAL,Mie=M.$onUpdate,gA=M.$parseSerializedNode,Nie=M.$removeTextFromCaretRange,hA=M.$rewindSiblingCaret,Im=M.$selectAll,_ie=M.$setCompositionKey,Die=M.$setPointFromCaret,Br=M.$setSelection,vA=M.$setSelectionFromCaretRange,Tm=M.$setState,yA=M.$splitAtPointCaretNext,xA=M.$splitNode,Oie=M.$updateRangeSelectionFromCaretRange,ox=M.ArtificialNode__DO_NOT_USE,Fie=M.BEFORE_INPUT_COMMAND,CA=M.BLUR_COMMAND,uu=M.CAN_REDO_COMMAND,fu=M.CAN_UNDO_COMMAND,km=M.CLEAR_EDITOR_COMMAND,bA=M.CLEAR_HISTORY_COMMAND,wA=M.CLICK_COMMAND,Bie=M.COLLABORATION_TAG,Lm=M.COMMAND_PRIORITY_CRITICAL,tn=M.COMMAND_PRIORITY_EDITOR,hr=M.COMMAND_PRIORITY_HIGH,id=M.COMMAND_PRIORITY_LOW,zie=M.COMMAND_PRIORITY_NORMAL,Uie=M.COMPOSITION_END_COMMAND,SA=M.COMPOSITION_END_TAG,Hie=M.COMPOSITION_START_COMMAND,IA=M.COMPOSITION_START_TAG,TA=M.CONTROLLED_TEXT_INSERTION_COMMAND,Pm=M.COPY_COMMAND,kA=M.CUT_COMMAND,Am=M.DELETE_CHARACTER_COMMAND,LA=M.DELETE_LINE_COMMAND,PA=M.DELETE_WORD_COMMAND,$ie=M.DRAGEND_COMMAND,Kie=M.DRAGOVER_COMMAND,AA=M.DRAGSTART_COMMAND,EA=M.DROP_COMMAND,za=M.DecoratorNode,Vie=M.ElementNode,RA=M.FOCUS_COMMAND,qie=M.FORMAT_ELEMENT_COMMAND,MA=M.FORMAT_TEXT_COMMAND,Em=M.HISTORIC_TAG,vr=M.HISTORY_MERGE_TAG,NA=M.HISTORY_PUSH_TAG,rx=M.INDENT_CONTENT_COMMAND,Wie=M.INPUT_COMMAND,ax=M.INSERT_LINE_BREAK_COMMAND,_A=M.INSERT_PARAGRAPH_COMMAND,DA=M.INSERT_TAB_COMMAND,pu=M.INTERNAL_$isBlock,Gie=M.IS_ALL_FORMATTING,jie=M.IS_BOLD,Qie=M.IS_CODE,Xie=M.IS_HIGHLIGHT,Yie=M.IS_ITALIC,Jie=M.IS_STRIKETHROUGH,Zie=M.IS_SUBSCRIPT,ese=M.IS_SUPERSCRIPT,tse=M.IS_UNDERLINE,OA=M.KEY_ARROW_DOWN_COMMAND,Rm=M.KEY_ARROW_LEFT_COMMAND,Mm=M.KEY_ARROW_RIGHT_COMMAND,FA=M.KEY_ARROW_UP_COMMAND,Nm=M.KEY_BACKSPACE_COMMAND,BA=M.KEY_DELETE_COMMAND,zA=M.KEY_DOWN_COMMAND,_m=M.KEY_ENTER_COMMAND,UA=M.KEY_ESCAPE_COMMAND,nse=M.KEY_MODIFIER_COMMAND,ose=M.KEY_SPACE_COMMAND,Dm=M.KEY_TAB_COMMAND,HA=M.LineBreakNode,rse=M.MOVE_TO_END,ase=M.MOVE_TO_START,ise=M.NODE_STATE_KEY,$A=M.OUTDENT_CONTENT_COMMAND,Om=M.PASTE_COMMAND,KA=M.PASTE_TAG,VA=M.ParagraphNode,qA=M.REDO_COMMAND,WA=M.REMOVE_TEXT_COMMAND,GA=M.RootNode,sse=M.SELECTION_CHANGE_COMMAND,jA=M.SELECTION_INSERT_CLIPBOARD_NODES_COMMAND,QA=M.SELECT_ALL_COMMAND,lse=M.SKIP_COLLAB_TAG,dse=M.SKIP_DOM_SELECTION_TAG,XA=M.SKIP_SCROLL_INTO_VIEW_TAG,cse=M.SKIP_SELECTION_FOCUS_TAG,YA=M.TEXT_TYPE_TO_FORMAT,JA=M.TabNode,Fm=M.TextNode,ZA=M.UNDO_COMMAND,mu=M.addClassNamesToElement,use=M.buildImportMap,Bm=M.configExtension,eE=M.createCommand,zm=M.createEditor,fse=M.createSharedNodeState,tE=M.createState,nE=M.declarePeerDependency,Rn=M.defineExtension,pse=M.flipDirection,mse=M.getDOMOwnerDocument,ix=M.getDOMSelection,gse=M.getDOMSelectionFromTarget,oE=M.getDOMTextNode,hse=M.getEditorPropertyFromDOMNode,vse=M.getNearestEditorFromDOMNode,rE=M.getRegisteredNode,yse=M.getRegisteredNodeOrThrow,xse=M.getStaticNodeConfig,Cse=M.getTextDirection,bse=M.getTransformSetFromKlass,aE=M.isBlockDomNode,wse=M.isCurrentlyReadOnlyMode,iE=M.isDOMDocumentNode,sE=M.isDOMNode,Sse=M.isDOMTextNode,Ise=M.isDOMUnmanaged,sx=M.isDocumentFragment,Tse=M.isExactShortcutMatch,lE=M.isHTMLAnchorElement,Um=M.isHTMLElement,gu=M.isInlineDomNode,kse=M.isLexicalEditor,Lse=M.isModifierMatch,Pse=M.isSelectionCapturedInDecoratorInput,dE=M.isSelectionWithinEditor,lx=M.makeStepwiseIterator,ua=M.mergeRegister,Ase=M.normalizeClassNames,Hm=M.removeClassNamesFromElement,Ese=M.removeFromParent,Rse=M.resetRandomKey,zr=M.safeCast,Mse=M.setDOMUnmanaged,Nse=M.setNodeIndentFromDOM,$m=M.shallowMergeConfig,dx=M.toggleTextFormatType;var gx={};En(gx,{$addNodeStyle:()=>YK,$cloneWithProperties:()=>ym,$copyBlockFormatIndent:()=>yE,$ensureForwardRangeSelection:()=>vE,$forEachSelectedTextNode:()=>hE,$getComputedStyleForElement:()=>fx,$getComputedStyleForParent:()=>px,$getSelectionStyleValueForProperty:()=>a3,$isAtNodeEnd:()=>XK,$isParentElementRTL:()=>mx,$isParentRTL:()=>jK,$moveCaretSelection:()=>bE,$moveCharacter:()=>o3,$patchStyleText:()=>JK,$selectAll:()=>Im,$setBlocksType:()=>ZK,$shouldOverrideDefaultCharacterSelection:()=>n3,$sliceSelectedTextNodeContent:()=>QK,$trimTextContentFromAnchor:()=>gE,$wrapNodes:()=>t3,createDOMRange:()=>WK,createRectsFromDOMRange:()=>GK,getCSSFromStyleObject:()=>mE,getStyleObjectFromCSS:()=>qm,trimTextContentFromAnchor:()=>i3});function ux(e,...t){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(let r of t)o.append("v",r);throw n.search=o.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.`)}var Vm=new Map;function cE(e){let t=e;for(;t!=null;){if(t.nodeType===Node.TEXT_NODE)return t;t=t.firstChild}return null}function uE(e){let t=e.parentNode;if(t==null)throw new Error("Should never happen");return[t,Array.from(t.childNodes).indexOf(e)]}function WK(e,t,n,o,r){let a=t.getKey(),i=o.getKey(),s=document.createRange(),l=e.getElementByKey(a),d=e.getElementByKey(i),c=n,f=r;if(dt(t)&&(l=cE(l)),dt(o)&&(d=cE(d)),t===void 0||o===void 0||l===null||d===null)return null;l.nodeName==="BR"&&([l,c]=uE(l)),d.nodeName==="BR"&&([d,f]=uE(d));let p=l.firstChild;l===d&&p!=null&&p.nodeName==="BR"&&c===0&&f===0&&(f=1);try{s.setStart(l,c),s.setEnd(d,f)}catch{return null}return!s.collapsed||c===f&&a===i||(s.setStart(d,f),s.setEnd(l,c)),s}function GK(e,t){let n=e.getRootElement();if(n===null)return[];let o=n.getBoundingClientRect(),r=getComputedStyle(n),a=parseFloat(r.paddingLeft)+parseFloat(r.paddingRight),i=Array.from(t.getClientRects()),s,l=i.length;i.sort((d,c)=>{let f=d.top-c.top;return Math.abs(f)<=3?d.left-c.left:f});for(let d=0;d<l;d++){let c=i[d],f=s&&s.top<=c.top&&s.top+s.height>c.top&&s.left+s.width>c.left,p=c.width+a===o.width;f||p?(i.splice(d--,1),l--):s=c}return i}function pE(e){let t={};if(!e)return t;let n=e.split(";");for(let o of n)if(o!==""){let[r,a]=o.split(/:([^]+)/);r&&a&&(t[r.trim()]=a.trim())}return t}function qm(e){let t=Vm.get(e);return t===void 0&&(t=pE(e),Vm.set(e,t)),t}function mE(e){let t="";for(let n in e)n&&(t+=`${n}: ${e[n]};`);return t}function fx(e){let t=xm().getElementByKey(e.getKey());if(t===null)return null;let n=t.ownerDocument.defaultView;return n===null?null:n.getComputedStyle(t)}function px(e){return fx(cu(e)?e:e.getParentOrThrow())}function jK(e){let t=px(e);return t!==null&&t.direction==="rtl"}function QK(e,t,n="self"){let o=e.getStartEndPoints();if(t.isSelected(e)&&!nx(t)&&o!==null){let[r,a]=o,i=e.isBackward(),s=r.getNode(),l=a.getNode(),d=t.is(s),c=t.is(l);if(d||c){let[f,p]=rA(e),m=s.is(l),g=t.is(i?l:s),h=t.is(i?s:l),v,y=0;m?(y=f>p?p:f,v=f>p?f:p):g?(y=i?p:f,v=void 0):h&&(y=0,v=i?f:p);let x=t.__text.slice(y,v);x!==t.__text&&(n==="clone"&&(t=YP(t)),t.__text=x)}}return t}function XK(e){if(e.type==="text")return e.offset===e.getNode().getTextContentSize();let t=e.getNode();return je(t)||ux(177),e.offset===t.getChildrenSize()}function gE(e,t,n){let o=t.getNode(),r=n;if(je(o)){let a=o.getDescendantByIndex(t.offset);a!==null&&(o=a)}for(;r>0&&o!==null;){if(je(o)){let d=o.getLastDescendant();d!==null&&(o=d)}let a=o.getPreviousSibling(),i=0;if(a===null){let d=o.getParentOrThrow(),c=d.getPreviousSibling();for(;c===null;){if(d=d.getParent(),d===null){a=null;break}c=d.getPreviousSibling()}d!==null&&(i=d.isInline()?0:2,a=c)}let s=o.getTextContent();s===""&&je(o)&&!o.isInline()&&(s=`
|
|
3782
3782
|
|
|
3783
|
-
`);let l=s.length;if(!dt(o)||r>=l){let d=o.getParent();o.remove(),d==null||d.getChildrenSize()!==0||uu(d)||d.remove(),r-=l+i,o=a}else{let d=o.getKey(),c=e.getEditorState().read(()=>{let m=bm(d);return dt(m)&&m.isSimpleText()?m.getTextContent():null}),f=l-r,p=s.slice(0,f);if(c!==null&&c!==s){let m=du(),g=o;if(o.isSimpleText())o.setTextContent(c);else{let h=Br(c);o.replace(h),g=h}if(Ne(m)&&m.isCollapsed()){let h=m.anchor.offset;g.select(h,h)}}else if(o.isSimpleText()){let m=t.key===d,g=t.offset;g<r&&(g=l);let h=m?g-r:0,v=m?g:f;if(m&&h===0){let[y]=o.splitText(h,v);y.remove()}else{let[,y]=o.splitText(h,v);y.remove()}}else{let m=Br(p);o.replace(m)}r=0}}}function QK(e){let t=e.getStyle(),n=uE(t);qm.set(t,n)}function Vm(e,t){(Ne(e)?e.isCollapsed():dt(e)||je(e))||fx(280);let n=Wm(Ne(e)?e.style:dt(e)?e.getStyle():e.getTextStyle()),o=Object.entries(t).reduce((a,[i,s])=>(typeof s=="function"?a[i]=s(n[i],e):s===null?delete a[i]:a[i]=s,a),{...n}),r=fE(o);Ne(e)||dt(e)?e.setStyle(r):e.setTextStyle(r),qm.set(r,o)}function XK(e,t){if(Ne(e)&&e.isCollapsed()){Vm(e,t);let o=e.anchor.getNode();je(o)&&o.isEmpty()&&Vm(o,t)}mE(o=>{Vm(o,t)});let n=e.getNodes();if(n.length>0){let o=new Set;for(let r of n){if(!je(r)||!r.canBeEmpty()||r.getChildrenSize()!==0)continue;let a=r.getKey();o.has(a)||(o.add(a),Vm(r,t))}}}function mE(e){let t=Ke();if(!t)return;let n=new Map,o=a=>n.get(a.getKey())||[0,a.getTextContentSize()];if(Ne(t))for(let a of jP(t).getTextSlices())a&&n.set(a.caret.origin.getKey(),a.getSliceIndices());let r=t.getNodes();for(let a of r){if(!dt(a)||!a.canHaveFormat())continue;let[i,s]=o(a);s!==i&&(ox(a)||i===0&&s===a.getTextContentSize()?e(a):e(a.splitText(i,s)[i===0?0:1]))}Ne(t)&&t.anchor.type==="text"&&t.focus.type==="text"&&t.anchor.key===t.focus.key&&gE(t)}function gE(e){if(e.isBackward()){let{anchor:t,focus:n}=e,{key:o,offset:r,type:a}=t;t.set(n.key,n.offset,n.type),n.set(o,r,a)}}function hE(e,t){let n=e.getFormatType(),o=e.getIndent();n!==t.getFormatType()&&t.setFormat(n),o!==t.getIndent()&&t.setIndent(o)}function YK(e,t,n=hE){if(e===null)return;let o=e.getStartEndPoints(),r=new Map,a=null;if(o){let[i,s]=o;a=Fs(),a.anchor.set(i.key,i.offset,i.type),a.focus.set(s.key,s.offset,s.type);let l=Ba(i.getNode(),mu),d=Ba(s.getNode(),mu);je(l)&&r.set(l.getKey(),l),je(d)&&r.set(d.getKey(),d)}for(let i of e.getNodes())if(je(i)&&mu(i))r.set(i.getKey(),i);else if(o===null){let s=Ba(i,mu);je(s)&&r.set(s.getKey(),s)}for(let[i,s]of r){let l=t();n(s,l),s.replace(l,!0),a&&(i===a.anchor.key&&a.anchor.set(l.getKey(),a.anchor.offset,a.anchor.type),i===a.focus.key&&a.focus.set(l.getKey(),a.focus.offset,a.focus.type))}a&&e.is(Ke())&&zr(a)}function cE(e){return e.getNode().isAttached()}function JK(e){let t=e;for(;t!==null&&!zs(t);){let n=t.getLatest(),o=t.getParent();n.getChildrenSize()===0&&t.remove(!0),t=o}}function ZK(e,t,n=null){let o=e.getStartEndPoints(),r=o?o[0]:null,a=e.getNodes(),i=a.length;if(r!==null&&(i===0||i===1&&r.type==="element"&&r.getNode().getChildrenSize()===0)){let d=r.type==="text"?r.getNode().getParentOrThrow():r.getNode(),c=d.getChildren(),f=t();return f.setFormat(d.getFormatType()),f.setIndent(d.getIndent()),c.forEach(p=>f.append(p)),n&&(f=n.append(f)),void d.replace(f)}let s=null,l=[];for(let d=0;d<i;d++){let c=a[d];zs(c)?(ux(e,l,l.length,t,n),l=[],s=c):s===null||s!==null&&aA(c,s)?l.push(c):(ux(e,l,l.length,t,n),l=[c])}ux(e,l,l.length,t,n)}function ux(e,t,n,o,r=null){if(t.length===0)return;let a=t[0],i=new Map,s=[],l=je(a)?a:a.getParentOrThrow();l.isInline()&&(l=l.getParentOrThrow());let d=!1;for(;l!==null;){let g=l.getPreviousSibling();if(g!==null){l=g,d=!0;break}if(l=l.getParentOrThrow(),zs(l))break}let c=new Set;for(let g=0;g<n;g++){let h=t[g];je(h)&&h.getChildrenSize()===0&&c.add(h.getKey())}let f=new Set;for(let g=0;g<n;g++){let h=t[g],v=h.getParent();if(v!==null&&v.isInline()&&(v=v.getParent()),v!==null&&lA(h)&&!f.has(h.getKey())){let y=v.getKey();if(i.get(y)===void 0){let x=o();x.setFormat(v.getFormatType()),x.setIndent(v.getIndent()),s.push(x),i.set(y,x),v.getChildren().forEach(C=>{x.append(C),f.add(C.getKey()),je(C)&&C.getChildrenKeys().forEach(w=>f.add(w))}),JK(v)}}else if(c.has(h.getKey())){je(h)||fx(179);let y=o();y.setFormat(h.getFormatType()),y.setIndent(h.getIndent()),s.push(y),h.remove(!0)}}if(r!==null)for(let g=0;g<s.length;g++){let h=s[g];r.append(h)}let p=null;if(zs(l))if(d)if(r!==null)l.insertAfter(r);else for(let g=s.length-1;g>=0;g--){let h=s[g];l.insertAfter(h)}else{let g=l.getFirstChild();if(je(g)&&(l=g),g===null)if(r)l.append(r);else for(let h=0;h<s.length;h++){let v=s[h];l.append(v),p=v}else if(r!==null)g.insertBefore(r);else for(let h=0;h<s.length;h++){let v=s[h];g.insertBefore(v),p=v}}else if(r)l.insertAfter(r);else for(let g=s.length-1;g>=0;g--){let h=s[g];l.insertAfter(h),p=h}let m=du();Ne(m)&&cE(m.anchor)&&cE(m.focus)?zr(m.clone()):p!==null?p.selectEnd():e.dirty=!0}function vE(e){let t=yE(e);return t!==null&&t.writingMode==="vertical-rl"}function yE(e){let t=e.anchor.getNode();return je(t)?px(t):mx(t)}function e3(e,t){let n=vE(e)?!t:t;gx(e)&&(n=!n);let o=rd(e.focus,n?"previous":"next");if(sA(o))return!1;for(let r of eA(o)){if(cu(r))return!r.origin.isInline();if(!je(r.origin)){if(Sm(r.origin))return!0;break}}return!1}function xE(e,t,n,o){e.modify(t?"extend":"move",n,o)}function gx(e){let t=yE(e);return t!==null&&t.direction==="rtl"}function t3(e,t,n){let o=gx(e),r;r=vE(e)||o?!n:n,xE(e,t,r,"character")}function n3(e,t,n){let o=Wm(e.getStyle());return o!==null&&o[t]||n}function o3(e,t,n=""){let o=null,r=e.getNodes(),a=e.anchor,i=e.focus,s=e.isBackward(),l=s?i.offset:a.offset,d=s?i.getNode():a.getNode();if(Ne(e)&&e.isCollapsed()&&e.style!==""){let c=Wm(e.style);if(c!==null&&t in c)return c[t]}for(let c=0;c<r.length;c++){let f=r[c];if((c===0||l!==0||!f.is(d))&&dt(f)){let p=n3(f,t,n);if(o===null)o=p;else if(o!==p){o="";break}}}return o===null?n:o}var r3=pE;var pn=hx,CE=pn.$addNodeStyle,Nse=pn.$cloneWithProperties,_se=pn.$copyBlockFormatIndent,Dse=pn.$ensureForwardRangeSelection,Ose=pn.$forEachSelectedTextNode,Fse=pn.$getComputedStyleForElement,Bse=pn.$getComputedStyleForParent,zse=pn.$getSelectionStyleValueForProperty,Use=pn.$isAtNodeEnd,Hse=pn.$isParentElementRTL,$se=pn.$isParentRTL,Kse=pn.$moveCaretSelection,vx=pn.$moveCharacter,Vse=pn.$patchStyleText,qse=pn.$selectAll,Wse=pn.$setBlocksType,yx=pn.$shouldOverrideDefaultCharacterSelection,Gm=pn.$sliceSelectedTextNodeContent,Gse=pn.$trimTextContentFromAnchor,jse=pn.$wrapNodes,Qse=pn.createDOMRange,bE=pn.createRectsFromDOMRange,Xse=pn.getCSSFromStyleObject,Yse=pn.getStyleObjectFromCSS,Jse=pn.trimTextContentFromAnchor;var wx={};En(wx,{$descendantsMatching:()=>H3,$dfs:()=>S3,$dfsIterator:()=>RE,$filter:()=>D3,$findMatchingParent:()=>Ba,$firstToLastIterator:()=>$3,$getAdjacentCaret:()=>I3,$getAdjacentSiblingOrParentSiblingCaret:()=>Bs,$getDepth:()=>NE,$getNearestBlockElementAncestorOrThrow:()=>A3,$getNearestNodeOfType:()=>P3,$getNextRightPreorderNode:()=>L3,$getNextSiblingOrParentSibling:()=>k3,$handleIndentAndOutdent:()=>O3,$insertFirst:()=>F3,$insertNodeToNearestRoot:()=>M3,$insertNodeToNearestRootAtCaret:()=>DE,$isEditorIsNestedEditor:()=>z3,$lastToFirstIterator:()=>bx,$restoreEditorState:()=>R3,$reverseDfs:()=>T3,$reverseDfsIterator:()=>_E,$splitNode:()=>vA,$unwrapAndFilterDescendants:()=>U3,$unwrapNode:()=>K3,$wrapNodeInElement:()=>N3,CAN_USE_BEFORE_INPUT:()=>m3,CAN_USE_DOM:()=>PE,IS_ANDROID:()=>g3,IS_ANDROID_CHROME:()=>h3,IS_APPLE:()=>v3,IS_APPLE_WEBKIT:()=>y3,IS_CHROME:()=>x3,IS_FIREFOX:()=>AE,IS_IOS:()=>C3,IS_SAFARI:()=>b3,addClassNamesToElement:()=>gu,calculateZoomLevel:()=>B3,isBlockDomNode:()=>oE,isHTMLAnchorElement:()=>iE,isHTMLElement:()=>Hm,isInlineDomNode:()=>hu,isMimeType:()=>EE,makeStateWrapper:()=>V3,markSelection:()=>LE,mediaFileReader:()=>w3,mergeRegister:()=>ua,objectKlassEquals:()=>_3,positionNodeOnRange:()=>kE,registerNestedElementResolver:()=>E3,removeClassNamesFromElement:()=>$m,selectionAlwaysOnDisplay:()=>p3});function jm(e,...t){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(let r of t)o.append("v",r);throw n.search=o.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.`)}var Hr=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,a3=Hr&&"documentMode"in document?document.documentMode:null,IE=Hr&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),i3=Hr&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),s3=!(!Hr||!("InputEvent"in window)||a3)&&"getTargetRanges"in new window.InputEvent("input"),l3=Hr&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),d3=Hr&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,TE=Hr&&/Android/.test(navigator.userAgent),Cx=Hr&&/^(?=.*Chrome).*/i.test(navigator.userAgent),c3=Hr&&TE&&Cx,u3=Hr&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&IE&&!Cx;function fa(e){return`${e}px`}var f3={attributes:!0,characterData:!0,childList:!0,subtree:!0};function kE(e,t,n){let o=null,r=null,a=null,i=[],s=document.createElement("div");function l(){o===null&&jm(182),r===null&&jm(183);let{left:f,top:p}=r.getBoundingClientRect(),m=bE(e,t);var g,h;s.isConnected||(h=s,(g=r).insertBefore(h,g.firstChild));let v=!1;for(let y=0;y<m.length;y++){let x=m[y],C=i[y]||document.createElement("div"),w=C.style;w.position!=="absolute"&&(w.position="absolute",v=!0);let L=fa(x.left-f);w.left!==L&&(w.left=L,v=!0);let S=fa(x.top-p);w.top!==S&&(C.style.top=S,v=!0);let k=fa(x.width);w.width!==k&&(C.style.width=k,v=!0);let I=fa(x.height);w.height!==I&&(C.style.height=I,v=!0),C.parentNode!==s&&(s.append(C),v=!0),i[y]=C}for(;i.length>m.length;)i.pop();v&&n(i)}function d(){r=null,o=null,a!==null&&a.disconnect(),a=null,s.remove();for(let f of i)f.remove();i=[]}s.style.position="relative";let c=e.registerRootListener(function f(){let p=e.getRootElement();if(p===null)return d();let m=p.parentElement;if(!Hm(m))return d();d(),o=p,r=m,a=new MutationObserver(g=>{let h=e.getRootElement(),v=h&&h.parentElement;if(h!==o||v!==r)return f();for(let y of g)if(!s.contains(y.target))return l()}),a.observe(m,f3),l()});return()=>{c(),d()}}function wE(e,t,n){if(e.type!=="text"&&je(t)){let o=t.getDOMSlot(n);return[o.element,o.getFirstChildOffset()+e.offset]}return[tE(n)||n,e.offset]}function LE(e,t){let n=null,o=null,r=null,a=null,i=null,s=null,l=()=>{};function d(c){c.read(()=>{let f=Ke();if(!Ne(f))return n=null,r=null,a=null,s=null,l(),void(l=()=>{});let[p,m]=(function(I){let T=I.getStartEndPoints();return I.isBackward()?[T[1],T[0]]:T})(f),g=p.getNode(),h=g.getKey(),v=p.offset,y=m.getNode(),x=y.getKey(),C=m.offset,w=e.getElementByKey(h),L=e.getElementByKey(x),S=n===null||w!==o||v!==r||h!==n.getKey(),k=a===null||L!==i||C!==s||x!==a.getKey();if((S||k)&&w!==null&&L!==null){let I=(function(T,A,P,_,E,F,B){let V=(T._window?T._window.document:document).createRange();return V.setStart(...wE(A,P,_)),V.setEnd(...wE(E,F,B)),V})(e,p,g,w,m,y,L);l(),l=kE(e,I,T=>{if(t===void 0)for(let A of T){let P=A.style;P.background!=="Highlight"&&(P.background="Highlight"),P.color!=="HighlightText"&&(P.color="HighlightText"),P.marginTop!==fa(-1.5)&&(P.marginTop=fa(-1.5)),P.paddingTop!==fa(4)&&(P.paddingTop=fa(4)),P.paddingBottom!==fa(0)&&(P.paddingBottom=fa(0))}else t(T)})}n=g,o=w,r=v,a=y,i=L,s=C})}return d(e.getEditorState()),ua(e.registerUpdateListener(({editorState:c})=>d(c)),()=>{l()})}function p3(e,t){let n=null,o=()=>{let r=getSelection(),a=r&&r.anchorNode,i=e.getRootElement();a!==null&&i!==null&&i.contains(a)?n!==null&&(n(),n=null):n===null&&(n=LE(e,t))};return document.addEventListener("selectionchange",o),()=>{n!==null&&n(),document.removeEventListener("selectionchange",o)}}var m3=s3,PE=Hr,g3=TE,h3=c3,v3=IE,y3=u3,x3=Cx,AE=i3,C3=d3,b3=l3;function EE(e,t){for(let n of t)if(e.type.startsWith(n))return!0;return!1}function w3(e,t){let n=e[Symbol.iterator]();return new Promise((o,r)=>{let a=[],i=()=>{let{done:s,value:l}=n.next();if(s)return o(a);let d=new FileReader;d.addEventListener("error",r),d.addEventListener("load",()=>{let c=d.result;typeof c=="string"&&a.push({file:l,result:c}),i()}),EE(l,t)?d.readAsDataURL(l):i()};i()})}function S3(e,t){return Array.from(RE(e,t))}function I3(e){return e?e.getAdjacentCaret():null}function T3(e,t){return Array.from(_E(e,t))}function RE(e,t){return ME("next",e,t)}function SE(e,t){let n=Bs(za(e,t));return n&&n[0]}function ME(e,t,n){let o=At(),r=t||o,a=je(r)?_i(r,e):za(r,e),i=NE(r),s=n?Zy(tx(za(n,e)))||SE(n,e):SE(r,e),l=i;return dx({hasNext:d=>d!==null,initial:a,map:d=>({depth:l,node:d.origin}),step:d=>{if(d.isSameNodeCaret(s))return null;cu(d)&&l++;let c=Bs(d);return!c||c[0].isSameNodeCaret(s)?null:(l+=c[1],c[0])}})}function k3(e){let t=Bs(za(e,"next"));return t&&[t[0].origin,t[1]]}function NE(e){let t=-1;for(let n=e;n!==null;n=n.getParent())t++;return t}function L3(e){let t=tx(za(e,"previous")),n=Bs(t,"root");return n&&n[0].origin}function _E(e,t){return ME("previous",e,t)}function P3(e,t){let n=e;for(;n!=null;){if(n instanceof t)return n;n=n.getParent()}return null}function A3(e){let t=Ba(e,n=>je(n)&&!n.isInline());return je(t)||jm(4,e.__key),t}function E3(e,t,n,o){let r=a=>a instanceof t;return e.registerNodeTransform(t,a=>{let i=(s=>{let l=s.getChildren();for(let f=0;f<l.length;f++){let p=l[f];if(r(p))return null}let d=s,c=s;for(;d!==null;)if(c=d,d=d.getParent(),r(d))return{child:c,parent:d};return null})(a);if(i!==null){let{child:s,parent:l}=i;if(s.is(a)){o(l,a);let d=s.getNextSiblings(),c=d.length;if(l.insertAfter(s),c!==0){let f=n(l);s.insertAfter(f);for(let p=0;p<c;p++)f.append(d[p])}l.canBeEmpty()||l.getChildrenSize()!==0||l.remove()}}})}function R3(e,t){let n=new Map,o=e._pendingEditorState;for(let[a,i]of t._nodeMap)n.set(a,xm(i));o&&(o._nodeMap=n),e._dirtyType=2;let r=t._selection;zr(r===null?null:r.clone())}function M3(e){let t=Ke()||du(),n;if(Ne(t))n=rd(t.focus,"next");else{if(t!=null){let i=t.getNodes(),s=i[i.length-1];s&&(n=za(s,"next"))}n=n||_i(At(),"previous").getFlipped().insert(hr())}let o=DE(e,n),r=Zy(o),a=cu(r)?uA(r):o;return gA(oA(a)),e.getLatest()}function DE(e,t,n){let o=ex(t,"next");for(let r=o;r;r=hA(r,n))o=r;return Im(o)&&jm(283),o.insert(e.isInline()?hr().append(e):e),ex(za(e.getLatest(),"next"),t.direction)}function N3(e,t){let n=t();return e.replace(n),n.append(e),n}function _3(e,t){return e!==null&&Object.getPrototypeOf(e).constructor.name===t.name}function D3(e,t){let n=[];for(let o=0;o<e.length;o++){let r=t(e[o]);r!==null&&n.push(r)}return n}function O3(e){let t=Ke();if(!Ne(t))return!1;let n=new Set,o=t.getNodes();for(let r=0;r<o.length;r++){let a=o[r],i=a.getKey();if(n.has(i))continue;let s=Ba(a,d=>je(d)&&!d.isInline());if(s===null)continue;let l=s.getKey();s.canIndent()&&!n.has(l)&&(n.add(l),e(s))}return n.size>0}function F3(e,t){_i(e,"next").insert(t)}var xx=!(AE||!PE)&&void 0;function B3(e,t=!1){let n=1;if((function(){if(xx===void 0){let o=document.createElement("div");o.style.cssText="position: absolute; opacity: 0; width: 100px; left: -1000px;",document.body.appendChild(o);let r=o.getBoundingClientRect();o.style.setProperty("zoom","2"),xx=o.getBoundingClientRect().width===r.width,document.body.removeChild(o)}return xx})()||t)for(;e;)n*=Number(window.getComputedStyle(e).getPropertyValue("zoom")),e=e.parentElement;return n}function z3(e){return e._parentEditor!==null}function U3(e,t){return OE(e,t,null)}function OE(e,t,n){let o=!1;for(let r of bx(e))t(r)?n!==null&&n(r):(o=!0,je(r)&&OE(r,t,n||(a=>r.insertAfter(a))),r.remove());return o}function H3(e,t){let n=[],o=Array.from(e).reverse();for(let r=o.pop();r!==void 0;r=o.pop())if(t(r))n.push(r);else if(je(r))for(let a of bx(r))o.push(a);return n}function $3(e){return FE(_i(e,"next"))}function bx(e){return FE(_i(e,"previous"))}function FE(e){return dx({hasNext:cA,initial:e.getAdjacentCaret(),map:t=>t.origin.getLatest(),step:t=>t.getAdjacentCaret()})}function K3(e){mA(za(e,"next")).splice(1,e.getChildren())}function V3(e){let t=o=>wm(o,e),n=(o,r)=>km(o,e,r);return{$get:t,$set:n,accessors:[t,n],makeGetterMethod:()=>function(){return t(this)},makeSetterMethod:()=>function(o){return n(this,o)},stateConfig:e}}var Qe=wx,ole=Qe.$descendantsMatching,rle=Qe.$dfs,ale=Qe.$dfsIterator,ile=Qe.$filter,sle=Qe.$findMatchingParent,lle=Qe.$firstToLastIterator,dle=Qe.$getAdjacentCaret,cle=Qe.$getAdjacentSiblingOrParentSiblingCaret,ule=Qe.$getDepth,BE=Qe.$getNearestBlockElementAncestorOrThrow,fle=Qe.$getNearestNodeOfType,ple=Qe.$getNextRightPreorderNode,mle=Qe.$getNextSiblingOrParentSibling,zE=Qe.$handleIndentAndOutdent,gle=Qe.$insertFirst,hle=Qe.$insertNodeToNearestRoot,vle=Qe.$insertNodeToNearestRootAtCaret,yle=Qe.$isEditorIsNestedEditor,xle=Qe.$lastToFirstIterator,Cle=Qe.$restoreEditorState,ble=Qe.$reverseDfs,wle=Qe.$reverseDfsIterator,Sle=Qe.$splitNode,Ile=Qe.$unwrapAndFilterDescendants,Tle=Qe.$unwrapNode,kle=Qe.$wrapNodeInElement,Lle=Qe.CAN_USE_BEFORE_INPUT,Ple=Qe.CAN_USE_DOM,Ale=Qe.IS_ANDROID,Ele=Qe.IS_ANDROID_CHROME,Rle=Qe.IS_APPLE,Mle=Qe.IS_APPLE_WEBKIT,Nle=Qe.IS_CHROME,_le=Qe.IS_FIREFOX,Dle=Qe.IS_IOS,Ole=Qe.IS_SAFARI,Fle=Qe.addClassNamesToElement,Ble=Qe.calculateZoomLevel,Sx=Qe.isBlockDomNode,zle=Qe.isHTMLAnchorElement,UE=Qe.isHTMLElement,Ule=Qe.isInlineDomNode,Hle=Qe.isMimeType,$le=Qe.makeStateWrapper,Kle=Qe.markSelection,Vle=Qe.mediaFileReader,Ha=Qe.mergeRegister,vu=Qe.objectKlassEquals,qle=Qe.positionNodeOnRange,Wle=Qe.registerNestedElementResolver,Gle=Qe.removeClassNamesFromElement,jle=Qe.selectionAlwaysOnDisplay;var Bx={};En(Bx,{$createHorizontalRuleNode:()=>Fx,$isDecoratorTextNode:()=>eR,$isHorizontalRuleNode:()=>iR,AutoFocusExtension:()=>G3,ClearEditorExtension:()=>j3,DecoratorTextExtension:()=>eV,DecoratorTextNode:()=>Cu,EditorStateExtension:()=>Jm,HorizontalRuleExtension:()=>uV,HorizontalRuleNode:()=>Hs,INSERT_HORIZONTAL_RULE_COMMAND:()=>dV,InitialStateExtension:()=>rR,LexicalBuilder:()=>ud,NodeSelectionExtension:()=>Nx,TabIndentationExtension:()=>fV,applyFormatFromStyle:()=>X3,applyFormatToDom:()=>Y3,batch:()=>WE,buildEditorFromExtensions:()=>rV,computed:()=>QE,configExtension:()=>zm,declarePeerDependency:()=>eE,defineExtension:()=>Rn,effect:()=>Oi,getExtensionDependencyFromEditor:()=>iV,getKnownTypesAndNodes:()=>Q3,getPeerDependencyFromEditor:()=>aR,getPeerDependencyFromEditorOrThrow:()=>sV,namedSignals:()=>eg,registerClearEditor:()=>JE,registerTabIndentation:()=>lR,safeCast:()=>Ur,shallowMergeConfig:()=>Km,signal:()=>cd,untracked:()=>Ax,watchedSignal:()=>Dx});var q3=Symbol.for("preact-signals");function Zm(){if(Di>1)return void Di--;let e,t=!1;for(;xu!==void 0;){let n=xu;for(xu=void 0,Ex++;n!==void 0;){let o=n.o;if(n.o=void 0,n.f&=-3,!(8&n.f)&&GE(n))try{n.c()}catch(r){t||(e=r,t=!0)}n=o}}if(Ex=0,Di--,t)throw e}function WE(e){if(Di>0)return e();Di++;try{return e()}finally{Zm()}}var Kt,xu;function Ax(e){let t=Kt;Kt=void 0;try{return e()}finally{Kt=t}}var Di=0,Ex=0,Ym=0;function HE(e){if(Kt===void 0)return;let t=e.n;return t===void 0||t.t!==Kt?(t={i:0,S:e,p:Kt.s,n:void 0,t:Kt,e:void 0,x:void 0,r:t},Kt.s!==void 0&&(Kt.s.n=t),Kt.s=t,e.n=t,32&Kt.f&&e.S(t),t):t.i===-1?(t.i=0,t.n!==void 0&&(t.n.p=t.p,t.p!==void 0&&(t.p.n=t.n),t.p=Kt.s,t.n=void 0,Kt.s.n=t,Kt.s=t),t):void 0}function Io(e,t){this.v=e,this.i=0,this.n=void 0,this.t=void 0,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}function cd(e,t){return new Io(e,t)}function GE(e){for(let t=e.s;t!==void 0;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function $E(e){for(let t=e.s;t!==void 0;t=t.n){let n=t.S.n;if(n!==void 0&&(t.r=n),t.S.n=t,t.i=-1,t.n===void 0){e.s=t;break}}}function jE(e){let t,n=e.s;for(;n!==void 0;){let o=n.p;n.i===-1?(n.S.U(n),o!==void 0&&(o.n=n.n),n.n!==void 0&&(n.n.p=o)):t=n,n.S.n=n.r,n.r!==void 0&&(n.r=void 0),n=o}e.s=t}function Us(e,t){Io.call(this,void 0),this.x=e,this.s=void 0,this.g=Ym-1,this.f=4,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}function QE(e,t){return new Us(e,t)}function XE(e){let t=e.u;if(e.u=void 0,typeof t=="function"){Di++;let n=Kt;Kt=void 0;try{t()}catch(o){throw e.f&=-2,e.f|=8,_x(e),o}finally{Kt=n,Zm()}}}function _x(e){for(let t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,XE(e)}function W3(e){if(Kt!==this)throw new Error("Out-of-order effect");jE(this),Kt=e,this.f&=-2,8&this.f&&_x(this),Zm()}function dd(e,t){this.x=e,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32,this.name=t?.name}function Oi(e,t){let n=new dd(e,t);try{n.c()}catch(r){throw n.d(),r}let o=n.d.bind(n);return o[Symbol.dispose]=o,o}function eg(e,t={}){let n={};for(let o in e){let r=t[o],a=cd(r===void 0?e[o]:r);n[o]=a}return n}Io.prototype.brand=q3,Io.prototype.h=function(){return!0},Io.prototype.S=function(e){let t=this.t;t!==e&&e.e===void 0&&(e.x=t,this.t=e,t!==void 0?t.e=e:Ax(()=>{var n;(n=this.W)==null||n.call(this)}))},Io.prototype.U=function(e){if(this.t!==void 0){let t=e.e,n=e.x;t!==void 0&&(t.x=n,e.e=void 0),n!==void 0&&(n.e=t,e.x=void 0),e===this.t&&(this.t=n,n===void 0&&Ax(()=>{var o;(o=this.Z)==null||o.call(this)}))}},Io.prototype.subscribe=function(e){return Oi(()=>{let t=this.value,n=Kt;Kt=void 0;try{e(t)}finally{Kt=n}},{name:"sub"})},Io.prototype.valueOf=function(){return this.value},Io.prototype.toString=function(){return this.value+""},Io.prototype.toJSON=function(){return this.value},Io.prototype.peek=function(){let e=Kt;Kt=void 0;try{return this.value}finally{Kt=e}},Object.defineProperty(Io.prototype,"value",{get(){let e=HE(this);return e!==void 0&&(e.i=this.i),this.v},set(e){if(e!==this.v){if(Ex>100)throw new Error("Cycle detected");this.v=e,this.i++,Ym++,Di++;try{for(let t=this.t;t!==void 0;t=t.x)t.t.N()}finally{Zm()}}}}),Us.prototype=new Io,Us.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===Ym))return!0;if(this.g=Ym,this.f|=1,this.i>0&&!GE(this))return this.f&=-2,!0;let e=Kt;try{$E(this),Kt=this;let t=this.x();(16&this.f||this.v!==t||this.i===0)&&(this.v=t,this.f&=-17,this.i++)}catch(t){this.v=t,this.f|=16,this.i++}return Kt=e,jE(this),this.f&=-2,!0},Us.prototype.S=function(e){if(this.t===void 0){this.f|=36;for(let t=this.s;t!==void 0;t=t.n)t.S.S(t)}Io.prototype.S.call(this,e)},Us.prototype.U=function(e){if(this.t!==void 0&&(Io.prototype.U.call(this,e),this.t===void 0)){this.f&=-33;for(let t=this.s;t!==void 0;t=t.n)t.S.U(t)}},Us.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(let e=this.t;e!==void 0;e=e.x)e.t.N()}},Object.defineProperty(Us.prototype,"value",{get(){if(1&this.f)throw new Error("Cycle detected");let e=HE(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}}),dd.prototype.c=function(){let e=this.S();try{if(8&this.f||this.x===void 0)return;let t=this.x();typeof t=="function"&&(this.u=t)}finally{e()}},dd.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,XE(this),$E(this),Di++;let e=Kt;return Kt=this,W3.bind(this,e)},dd.prototype.N=function(){2&this.f||(this.f|=2,this.o=xu,xu=this)},dd.prototype.d=function(){this.f|=8,1&this.f||_x(this)},dd.prototype.dispose=function(){this.d()};var G3=Rn({build:(e,t,n)=>eg(t),config:Ur({defaultSelection:"rootEnd",disabled:!1}),name:"@lexical/extension/AutoFocus",register(e,t,n){let o=n.getOutput();return Oi(()=>o.disabled.value?void 0:e.registerRootListener(r=>{e.focus(()=>{let a=document.activeElement;r===null||a!==null&&r.contains(a)||r.focus({preventScroll:!0})},{defaultSelection:o.defaultSelection.peek()})}))}});function YE(){let e=At(),t=Ke(),n=hr();e.clear(),e.append(n),t!==null&&n.select(),Ne(t)&&(t.format=0)}function JE(e,t=YE){return e.registerCommand(Lm,n=>(e.update(t),!0),nn)}var j3=Rn({build:(e,t,n)=>eg(t),config:Ur({$onClear:YE}),name:"@lexical/extension/ClearEditor",register(e,t,n){let{$onClear:o}=n.getOutput();return Oi(()=>JE(e,o.value))}});function Q3(e){let t=new Set,n=new Set;for(let o of ZE(e)){let r=typeof o=="function"?o:o.replace;t.add(r.getType()),n.add(r)}return{nodes:n,types:t}}function ZE(e){return(typeof e.nodes=="function"?e.nodes():e.nodes)||[]}var Ix=ZA("format",{parse:e=>typeof e=="number"?e:0}),Cu=class extends Ua{$config(){return this.config("decorator-text",{extends:Ua,stateConfigs:[{flat:!0,stateConfig:Ix}]})}getFormat(){return wm(this,Ix)}getFormatFlags(t,n){return cx(this.getFormat(),t,n)}hasFormat(t){let n=QA[t];return(this.getFormat()&n)!==0}setFormat(t){return km(this,Ix,t)}toggleFormat(t){let n=this.getFormat(),o=cx(n,t,null);return this.setFormat(o)}isInline(){return!0}createDOM(){return document.createElement("span")}updateDOM(){return!1}};function eR(e){return e instanceof Cu}function X3(e,t,n){let o=t.fontWeight,r=t.textDecoration.split(" "),a=o==="700"||o==="bold",i=r.includes("line-through"),s=t.fontStyle==="italic",l=r.includes("underline"),d=t.verticalAlign;return a&&!e.hasFormat("bold")&&e.toggleFormat("bold"),i&&!e.hasFormat("strikethrough")&&e.toggleFormat("strikethrough"),s&&!e.hasFormat("italic")&&e.toggleFormat("italic"),l&&!e.hasFormat("underline")&&e.toggleFormat("underline"),d!=="sub"||e.hasFormat("subscript")||e.toggleFormat("subscript"),d!=="super"||e.hasFormat("superscript")||e.toggleFormat("superscript"),n&&!e.hasFormat(n)&&e.toggleFormat(n),e}function Y3(e,t,n=Z3){for(let[o,r]of Object.entries(n))e.hasFormat(r)&&(t=J3(t,o));return t}function J3(e,t){let n=document.createElement(t);return n.appendChild(e),n}var Z3={b:"bold",code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"},eV=Rn({name:"@lexical/extension/DecoratorText",nodes:()=>[Cu],register:(e,t,n)=>e.registerCommand(EA,o=>{let r=Ke();if(nx(r)||Ne(r))for(let a of r.getNodes())eR(a)&&a.toggleFormat(o);return!1},sd)});function Dx(e,t){let n;return cd(e(),{unwatched(){n&&(n(),n=void 0)},watched(){this.value=e(),n=t(this)}})}var Jm=Rn({build:e=>Dx(()=>e.getEditorState(),t=>e.registerUpdateListener(n=>{t.value=n.editorState})),name:"@lexical/extension/EditorState"});function Gt(e,...t){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(let r of t)o.append("v",r);throw n.search=o.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 tR(e,t){if(e&&t&&!Array.isArray(t)&&typeof e=="object"&&typeof t=="object"){let n=e,o=t;for(let r in o)n[r]=tR(n[r],o[r]);return e}return t}var Ox=0,Rx=1,nR=2,Tx=3,Qm=4,ld=5,kx=6,yu=7;function Lx(e){return e.id===Ox}function oR(e){return e.id===nR}function tV(e){return(function(t){return t.id===Rx})(e)||Gt(305,String(e.id),String(Rx)),Object.assign(e,{id:nR})}var nV=new Set,Mx=class{builder;configs;_dependency;_peerNameSet;extension;state;_signal;constructor(t,n){this.builder=t,this.extension=n,this.configs=new Set,this.state={id:Ox}}mergeConfigs(){let t=this.extension.config||{},n=this.extension.mergeConfig?this.extension.mergeConfig.bind(this.extension):Km;for(let o of this.configs)t=n(t,o);return t}init(t){let n=this.state;oR(n)||Gt(306,String(n.id));let o={getDependency:this.getInitDependency.bind(this),getDirectDependentNames:this.getDirectDependentNames.bind(this),getPeer:this.getInitPeer.bind(this),getPeerNameSet:this.getPeerNameSet.bind(this)},r={...o,getDependency:this.getDependency.bind(this),getInitResult:this.getInitResult.bind(this),getPeer:this.getPeer.bind(this)},a=(function(s,l,d){return Object.assign(s,{config:l,id:Tx,registerState:d})})(n,this.mergeConfigs(),o),i;this.state=a,this.extension.init&&(i=this.extension.init(t,a.config,o)),this.state=(function(s,l,d){return Object.assign(s,{id:Qm,initResult:l,registerState:d})})(a,i,r)}build(t){let n=this.state,o;n.id!==Qm&&Gt(307,String(n.id),String(ld)),this.extension.build&&(o=this.extension.build(t,n.config,n.registerState));let r={...n.registerState,getOutput:()=>o,getSignal:this.getSignal.bind(this)};this.state=(function(a,i,s){return Object.assign(a,{id:ld,output:i,registerState:s})})(n,o,r)}register(t,n){this._signal=n;let o=this.state;o.id!==ld&&Gt(308,String(o.id),String(ld));let r=this.extension.register&&this.extension.register(t,o.config,o.registerState);return this.state=(function(a){return Object.assign(a,{id:kx})})(o),()=>{let a=this.state;a.id!==yu&&Gt(309,String(o.id),String(yu)),this.state=(function(i){return Object.assign(i,{id:ld})})(a),r&&r()}}afterRegistration(t){let n=this.state,o;return n.id!==kx&&Gt(310,String(n.id),String(kx)),this.extension.afterRegistration&&(o=this.extension.afterRegistration(t,n.config,n.registerState)),this.state=(function(r){return Object.assign(r,{id:yu})})(n),o}getSignal(){return this._signal===void 0&&Gt(311),this._signal}getInitResult(){this.extension.init===void 0&&Gt(312,this.extension.name);let t=this.state;return(function(n){return n.id>=Qm})(t)||Gt(313,String(t.id),String(Qm)),t.initResult}getInitPeer(t){let n=this.builder.extensionNameMap.get(t);return n?n.getExtensionInitDependency():void 0}getExtensionInitDependency(){let t=this.state;return(function(n){return n.id>=Tx})(t)||Gt(314,String(t.id),String(Tx)),{config:t.config}}getPeer(t){let n=this.builder.extensionNameMap.get(t);return n?n.getExtensionDependency():void 0}getInitDependency(t){let n=this.builder.getExtensionRep(t);return n===void 0&&Gt(315,this.extension.name,t.name),n.getExtensionInitDependency()}getDependency(t){let n=this.builder.getExtensionRep(t);return n===void 0&&Gt(315,this.extension.name,t.name),n.getExtensionDependency()}getState(){let t=this.state;return(function(n){return n.id>=yu})(t)||Gt(316,String(t.id),String(yu)),t}getDirectDependentNames(){return this.builder.incomingEdges.get(this.extension.name)||nV}getPeerNameSet(){let t=this._peerNameSet;return t||(t=new Set((this.extension.peerDependencies||[]).map(([n])=>n)),this._peerNameSet=t),t}getExtensionDependency(){if(!this._dependency){let t=this.state;(function(n){return n.id>=ld})(t)||Gt(317,this.extension.name),this._dependency={config:t.config,init:t.initResult,output:t.output}}return this._dependency}},KE={tag:yr};function oV(){let e=At();e.isEmpty()&&e.append(hr())}var rR=Rn({config:Ur({setOptions:KE,updateOptions:KE}),init:({$initialEditorState:e=oV})=>({$initialEditorState:e,initialized:!1}),afterRegistration(e,{updateOptions:t,setOptions:n},o){let r=o.getInitResult();if(!r.initialized){r.initialized=!0;let{$initialEditorState:a}=r;if(iA(a))e.setEditorState(a,n);else if(typeof a=="function")e.update(()=>{a(e)},t);else if(a&&(typeof a=="string"||typeof a=="object")){let i=e.parseEditorState(a);e.setEditorState(i,n)}}return()=>{}},name:"@lexical/extension/InitialState",nodes:[qA,Bm,zA,XA,$A]}),VE=Symbol.for("@lexical/extension/LexicalBuilder");function rV(...e){return ud.fromExtensions(e).buildEditor()}function qE(){}function aV(e){throw e}function Xm(e){return Array.isArray(e)?e:[e]}var Px="0.41.0+prod.esm",ud=class e{roots;extensionNameMap;outgoingConfigEdges;incomingEdges;conflicts;_sortedExtensionReps;PACKAGE_VERSION;constructor(t){this.outgoingConfigEdges=new Map,this.incomingEdges=new Map,this.extensionNameMap=new Map,this.conflicts=new Map,this.PACKAGE_VERSION=Px,this.roots=t;for(let n of t)this.addExtension(n)}static fromExtensions(t){let n=[Xm(rR)];for(let o of t)n.push(Xm(o));return new e(n)}static maybeFromEditor(t){let n=t[VE];return n&&(n.PACKAGE_VERSION!==Px&&Gt(292,n.PACKAGE_VERSION,Px),n instanceof e||Gt(293)),n}static fromEditor(t){let n=e.maybeFromEditor(t);return n===void 0&&Gt(294),n}constructEditor(){let{$initialEditorState:t,onError:n,...o}=this.buildCreateEditorArgs(),r=Object.assign(Um({...o,...n?{onError:a=>{n(a,r)}}:{}}),{[VE]:this});for(let a of this.sortedExtensionReps())a.build(r);return r}buildEditor(){let t=qE;function n(){try{t()}finally{t=qE}}let o=Object.assign(this.constructEditor(),{dispose:n,[Symbol.dispose]:n});return t=ua(this.registerEditor(o),()=>o.setRootElement(null)),o}hasExtensionByName(t){return this.extensionNameMap.has(t)}getExtensionRep(t){let n=this.extensionNameMap.get(t.name);if(n)return n.extension!==t&&Gt(295,t.name),n}addEdge(t,n,o){let r=this.outgoingConfigEdges.get(t);r?r.set(n,o):this.outgoingConfigEdges.set(t,new Map([[n,o]]));let a=this.incomingEdges.get(n);a?a.add(t):this.incomingEdges.set(n,new Set([t]))}addExtension(t){this._sortedExtensionReps!==void 0&&Gt(296);let n=Xm(t),[o]=n;typeof o.name!="string"&&Gt(297,typeof o.name);let r=this.extensionNameMap.get(o.name);if(r!==void 0&&r.extension!==o&&Gt(298,o.name),!r){r=new Mx(this,o),this.extensionNameMap.set(o.name,r);let a=this.conflicts.get(o.name);typeof a=="string"&&Gt(299,o.name,a);for(let i of o.conflictsWith||[])this.extensionNameMap.has(i)&&Gt(299,o.name,i),this.conflicts.set(i,o.name);for(let i of o.dependencies||[]){let s=Xm(i);this.addEdge(o.name,s[0].name,s.slice(1)),this.addExtension(s)}for(let[i,s]of o.peerDependencies||[])this.addEdge(o.name,i,s?[s]:[])}}sortedExtensionReps(){if(this._sortedExtensionReps)return this._sortedExtensionReps;let t=[],n=(o,r)=>{let a=o.state;if(oR(a))return;let i=o.extension.name;var s;Lx(a)||Gt(300,i,r||"[unknown]"),Lx(s=a)||Gt(304,String(s.id),String(Ox)),a=Object.assign(s,{id:Rx}),o.state=a;let l=this.outgoingConfigEdges.get(i);if(l)for(let d of l.keys()){let c=this.extensionNameMap.get(d);c&&n(c,i)}a=tV(a),o.state=a,t.push(o)};for(let o of this.extensionNameMap.values())Lx(o.state)&&n(o);for(let o of t)for(let[r,a]of this.outgoingConfigEdges.get(o.extension.name)||[])if(a.length>0){let i=this.extensionNameMap.get(r);if(i)for(let s of a)i.configs.add(s)}for(let[o,...r]of this.roots)if(r.length>0){let a=this.extensionNameMap.get(o.name);a===void 0&&Gt(301,o.name);for(let i of r)a.configs.add(i)}return this._sortedExtensionReps=t,this._sortedExtensionReps}registerEditor(t){let n=this.sortedExtensionReps(),o=new AbortController,r=[()=>o.abort()],a=o.signal;for(let i of n){let s=i.register(t,a);s&&r.push(s)}for(let i of n){let s=i.afterRegistration(t);s&&r.push(s)}return ua(...r)}buildCreateEditorArgs(){let t={},n=new Set,o=new Map,r=new Map,a={},i={},s=this.sortedExtensionReps();for(let c of s){let{extension:f}=c;if(f.onError!==void 0&&(t.onError=f.onError),f.disableEvents!==void 0&&(t.disableEvents=f.disableEvents),f.parentEditor!==void 0&&(t.parentEditor=f.parentEditor),f.editable!==void 0&&(t.editable=f.editable),f.namespace!==void 0&&(t.namespace=f.namespace),f.$initialEditorState!==void 0&&(t.$initialEditorState=f.$initialEditorState),f.nodes)for(let p of ZE(f)){if(typeof p!="function"){let m=o.get(p.replace);m&&Gt(302,f.name,p.replace.name,m.extension.name),o.set(p.replace,c)}n.add(p)}if(f.html){if(f.html.export)for(let[p,m]of f.html.export.entries())r.set(p,m);f.html.import&&Object.assign(a,f.html.import)}f.theme&&tR(i,f.theme)}Object.keys(i).length>0&&(t.theme=i),n.size&&(t.nodes=[...n]);let l=Object.keys(a).length>0,d=r.size>0;(l||d)&&(t.html={},l&&(t.html.import=a),d&&(t.html.export=r));for(let c of s)c.init(t);return t.onError||(t.onError=aV),t}};function iV(e,t){let n=ud.fromEditor(e).getExtensionRep(t);return n===void 0&&Gt(303,t.name),n.getExtensionDependency()}function aR(e,t){let n=ud.fromEditor(e).extensionNameMap.get(t);return n?n.getExtensionDependency():void 0}function sV(e,t){let n=aR(e,t);return n===void 0&&Gt(291,t),n}var lV=new Set,Nx=Rn({build(e,t,n){let o=n.getDependency(Jm).output,r=cd({watchedNodeKeys:new Map}),a=Dx(()=>{},()=>Oi(()=>{let i=a.peek(),{watchedNodeKeys:s}=r.value,l,d=!1;o.value.read(()=>{if(Ke())for(let[c,f]of s.entries()){if(f.size===0){s.delete(c);continue}let p=bm(c),m=p&&p.isSelected()||!1;d=d||m!==(!!i&&i.has(c)),m&&(l=l||new Set,l.add(c))}}),!d&&l&&i&&l.size===i.size||(a.value=l)}));return{watchNodeKey:function(i){let s=QE(()=>(a.value||lV).has(i)),{watchedNodeKeys:l}=r.peek(),d=l.get(i),c=d!==void 0;return d=d||new Set,d.add(s),c||(l.set(i,d),r.value={watchedNodeKeys:l}),s}}},dependencies:[Jm],name:"@lexical/extension/NodeSelection"}),dV=JA("INSERT_HORIZONTAL_RULE_COMMAND"),Hs=class e extends Ua{static getType(){return"horizontalrule"}static clone(t){return new e(t.__key)}static importJSON(t){return Fx().updateFromJSON(t)}static importDOM(){return{hr:()=>({conversion:cV,priority:0})}}exportDOM(){return{element:document.createElement("hr")}}createDOM(t){let n=document.createElement("hr");return gu(n,t.theme.hr),n}getTextContent(){return`
|
|
3784
|
-
`}isInline(){return!1}updateDOM(){return!1}};function cV(){return{node:Fx()}}function Fx(){return XP(Hs)}function iR(e){return e instanceof Hs}var uV=Rn({dependencies:[Jm,Nx],name:"@lexical/extension/HorizontalRule",nodes:()=>[Hs],register(e,t,n){let{watchNodeKey:o}=n.getDependency(Nx).output,r=cd({nodeSelections:new Map}),a=e._config.theme.hrSelected??"selected";return ua(e.registerCommand(CA,i=>{if(aE(i.target)){let s=rA(i.target);if(iR(s))return(function(l,d=!1){let c=Ke(),f=l.isSelected(),p=l.getKey(),m;d&&nx(c)?m=c:(m=YP(),zr(m)),f?m.delete(p):m.add(p)})(s,i.shiftKey),!0}return!1},sd),e.registerMutationListener(Hs,(i,s)=>{WE(()=>{let l=!1,{nodeSelections:d}=r.peek();for(let[c,f]of i.entries())if(f==="destroyed")d.delete(c),l=!0;else{let p=d.get(c),m=e.getElementByKey(c);p?p.domNode.value=m:(l=!0,d.set(c,{domNode:cd(m),selectedSignal:o(c)}))}l&&(r.value={nodeSelections:d})})}),Oi(()=>{let i=[];for(let{domNode:s,selectedSignal:l}of r.value.nodeSelections.values())i.push(Oi(()=>{let d=s.value;d&&(l.value?gu(d,a):$m(d,a))}));return ua(...i)}))}});function sR(e){return e.canBeEmpty()}function lR(e,t,n=sR){return ua(e.registerCommand(Om,o=>{let r=Ke();if(!Ne(r))return!1;o.preventDefault();let a=(function(i){if(i.getNodes().filter(p=>ad(p)&&p.canIndent()).length>0)return!0;let s=i.anchor,l=i.focus,d=l.isBefore(s)?l:s,c=d.getNode(),f=BE(c);if(f.canIndent()){let p=f.getKey(),m=Fs();if(m.anchor.set(p,0,"element"),m.focus.set(p,0,"element"),m=fA(m),m.anchor.is(d))return!0}return!1})(r)?o.shiftKey?UA:ax:NA;return e.dispatchCommand(a,void 0)},nn),e.registerCommand(ax,()=>{let o=typeof t=="number"?t:t?t.peek():null,r=Ke();if(!Ne(r))return!1;let a=typeof n=="function"?n:n.peek();return zE(i=>{if(a(i)){let s=i.getIndent()+1;(!o||s<o)&&i.setIndent(s)}})},Pm))}var fV=Rn({build:(e,t,n)=>eg(t),config:Ur({$canIndent:sR,disabled:!1,maxIndent:null}),name:"@lexical/extension/TabIndentation",register(e,t,n){let{disabled:o,maxIndent:r,$canIndent:a}=n.getOutput();return Oi(()=>{if(!o.value)return lR(e,r,a)})}});var kt=Bx,Zle=kt.$createHorizontalRuleNode,ede=kt.$isDecoratorTextNode,tde=kt.$isHorizontalRuleNode,nde=kt.AutoFocusExtension,ode=kt.ClearEditorExtension,rde=kt.DecoratorTextExtension,ade=kt.DecoratorTextNode,ide=kt.EditorStateExtension,sde=kt.HorizontalRuleExtension,lde=kt.HorizontalRuleNode,dde=kt.INSERT_HORIZONTAL_RULE_COMMAND,cde=kt.InitialStateExtension,dR=kt.LexicalBuilder,ude=kt.NodeSelectionExtension,fde=kt.TabIndentationExtension,pde=kt.applyFormatFromStyle,mde=kt.applyFormatToDom,cR=kt.batch,gde=kt.buildEditorFromExtensions,hde=kt.computed,vde=kt.configExtension,yde=kt.declarePeerDependency,xde=kt.defineExtension,bu=kt.effect,Cde=kt.getExtensionDependencyFromEditor,bde=kt.getKnownTypesAndNodes,uR=kt.getPeerDependencyFromEditor,wde=kt.getPeerDependencyFromEditorOrThrow,tg=kt.namedSignals,Sde=kt.registerClearEditor,Ide=kt.registerTabIndentation,Tde=kt.safeCast,kde=kt.shallowMergeConfig,Lde=kt.signal,Pde=kt.untracked,Ade=kt.watchedSignal;var zx={};En(zx,{HistoryExtension:()=>ng,SharedHistoryExtension:()=>gV,createEmptyHistoryState:()=>mR,registerHistory:()=>pR});function pV(e,t,n,o,r){if(e===null||n.size===0&&o.size===0&&!r)return 0;let a=t._selection,i=e._selection;if(r)return 1;if(!(Ne(a)&&Ne(i)&&i.isCollapsed()&&a.isCollapsed()))return 0;let s=(function(y,x,C){let w=y._nodeMap,L=[];for(let S of x){let k=w.get(S);k!==void 0&&L.push(k)}for(let[S,k]of C){if(!k)continue;let I=w.get(S);I===void 0||uu(I)||L.push(I)}return L})(t,n,o);if(s.length===0)return 0;if(s.length>1){let y=t._nodeMap,x=y.get(a.anchor.key),C=y.get(i.anchor.key);return x&&C&&!e._nodeMap.has(x.__key)&&dt(x)&&x.__text.length===1&&a.anchor.offset===1?2:0}let l=s[0],d=e._nodeMap.get(l.__key);if(!dt(d)||!dt(l)||d.__mode!==l.__mode)return 0;let c=d.__text,f=l.__text;if(c===f)return 0;let p=a.anchor,m=i.anchor;if(p.key!==m.key||p.type!=="text")return 0;let g=p.offset,h=m.offset,v=f.length-c.length;return v===1&&h===g-1?2:v===-1&&h===g+1?3:v===-1&&h===g?4:0}function mV(e,t){let n=Date.now(),o=0,r=Date.now(),a=0,i=null;return(s,l,d,c,f,p)=>{let m=Date.now();if(p.has(wA)&&(r=n,a=o,i=s),p.has(Rm))return o=0,n=m,2;p.has(bA)&&i&&(n=r,o=a,s=i);let g=pV(s,l,c,f,e.isComposing()),h=(()=>{let v=d===null||d.editor===e,y=p.has(RA);if(!y&&v&&p.has(yr))return 0;if(g===1)return 2;if(s===null)return 1;let x=l._selection;if(!(c.size>0||f.size>0))return x!==null?0:2;let C=typeof t=="number"?t:t.peek();return y===!1&&g!==0&&g===o&&m<n+C&&v||c.size===1&&(function(w,L,S){let k=L._nodeMap.get(w),I=S._nodeMap.get(w),T=L._selection,A=S._selection;return!(Ne(T)&&Ne(A)&&T.anchor.type==="element"&&T.focus.type==="element"&&A.anchor.type==="text"&&A.focus.type==="text"||!dt(k)||!dt(I)||k.__parent!==I.__parent)&&JSON.stringify(L.read(()=>k.exportJSON()))===JSON.stringify(S.read(()=>I.exportJSON()))})(Array.from(c)[0],s,l)?0:1})();return n=m,o=g,h}}function fR(e){e.undoStack=[],e.redoStack=[],e.current=null}function pR(e,t,n){let o=mV(e,n);return Ha(e.registerCommand(YA,()=>((function(a,i){let s=i.redoStack,l=i.undoStack;if(l.length!==0){let d=i.current,c=l.pop();d!==null&&(s.push(d),a.dispatchCommand(fu,!0)),l.length===0&&a.dispatchCommand(pu,!1),i.current=c||null,c&&c.editor.setEditorState(c.editorState,{tag:Rm})}})(e,t),!0),nn),e.registerCommand(KA,()=>((function(a,i){let s=i.redoStack,l=i.undoStack;if(s.length!==0){let d=i.current;d!==null&&(l.push(d),a.dispatchCommand(pu,!0));let c=s.pop();s.length===0&&a.dispatchCommand(fu,!1),i.current=c||null,c&&c.editor.setEditorState(c.editorState,{tag:Rm})}})(e,t),!0),nn),e.registerCommand(Lm,()=>(fR(t),!1),nn),e.registerCommand(xA,()=>(fR(t),e.dispatchCommand(fu,!1),e.dispatchCommand(pu,!1),!0),nn),e.registerUpdateListener(({editorState:a,prevEditorState:i,dirtyLeaves:s,dirtyElements:l,tags:d})=>{let c=t.current,f=t.redoStack,p=t.undoStack,m=c===null?null:c.editorState;if(c!==null&&a===m)return;let g=o(i,a,c,s,l,d);if(g===1)f.length!==0&&(t.redoStack=[],e.dispatchCommand(fu,!1)),c!==null&&(p.push({...c}),e.dispatchCommand(pu,!0));else if(g===2)return;t.current={editor:e,editorState:a}}))}function mR(){return{current:null,redoStack:[],undoStack:[]}}var ng=Rn({build:(e,{delay:t,createInitialHistoryState:n,disabled:o})=>tg({delay:t,disabled:o,historyState:n(e)}),config:Ur({createInitialHistoryState:mR,delay:300,disabled:typeof window>"u"}),name:"@lexical/history/History",register:(e,t,n)=>{let o=n.getOutput();return bu(()=>o.disabled.value?void 0:pR(e,o.historyState.value,o.delay))}}),gV=Rn({dependencies:[zm(ng,{createInitialHistoryState:()=>{throw new Error("SharedHistory did not inherit parent history")},disabled:!0})],name:"@lexical/history/SharedHistory",register(e,t,n){let{output:o}=n.getDependency(ng),r=(function(i){return i?uR(i,ng.name):null})(e._parentEditor);if(!r)return()=>{};let a=r.output;return bu(()=>cR(()=>{o.delay.value=a.delay.value,o.historyState.value=a.historyState.value,o.disabled.value=a.disabled.value}))}});var og=zx,_de=og.HistoryExtension,Dde=og.SharedHistoryExtension,rg=og.createEmptyHistoryState,gR=og.registerHistory;var Ux={};En(Ux,{HistoryPlugin:()=>hV,createEmptyHistoryState:()=>rg});ue();function hV({delay:e,externalHistoryState:t}){let[n]=Cn();return(function(o,r,a=1e3){let i=K(()=>r||rg(),[r]);W(()=>gR(o,i,a),[a,o,i])})(n,t,e),null}var hR=Ux,vR=hR.HistoryPlugin,yR=hR.createEmptyHistoryState;var fd=new Map,vV=32;function xR(e,t){for(fd.delete(e),fd.set(e,t);fd.size>vV;){let n=fd.keys().next().value;if(n===void 0)break;fd.delete(n)}}function yV(e){return{anchor:e.length,focus:e.length}}function $a(e,t,n){let o=fd.get(e);if(o)return xR(e,o),o;let r={cursor:n?.cursor??t.length,expandedCursor:n?.expandedCursor??t.length,selection:n?{anchor:n.cursor,focus:n.cursor}:yV(t),history:yR()};return xR(e,r),r}function pd(e,t,n){let o=$a(e,t);o.cursor=n.cursor,o.expandedCursor=n.expandedCursor,o.selection=n.selection}function CR(e,t,n,o){let r=$a(e,t);r.cursor=n,r.expandedCursor=o}function bR(e,t){let n=e.current,o=[...e.undoStack],r=[...e.redoStack];t(),e.current=n,e.undoStack.splice(0,e.undoStack.length,...o),e.redoStack.splice(0,e.redoStack.length,...r)}var Hx={};En(Hx,{LexicalComposer:()=>CV});ue();var wR=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,xV=wR?he:W,ag={tag:yr};function CV({initialConfig:e,children:t}){let n=K(()=>{let{theme:o,namespace:r,nodes:a,onError:i,editorState:s,html:l}=e,d=wk(null,o),c=Um({editable:e.editable,html:l,namespace:r,nodes:a,onError:f=>i(f,c),theme:o});return(function(f,p){if(p!==null){if(p===void 0)f.update(()=>{let m=At();if(m.isEmpty()){let g=hr();m.append(g);let h=wR?document.activeElement:null;(Ke()!==null||h!==null&&h===f.getRootElement())&&g.select()}},ag);else if(p!==null)switch(typeof p){case"string":{let m=f.parseEditorState(p);f.setEditorState(m,ag);break}case"object":f.setEditorState(p,ag);break;case"function":f.update(()=>{At().isEmpty()&&p(f)},ag)}}})(c,s),[c,d]},[]);return xV(()=>{let o=e.editable,[r]=n;r.setEditable(o===void 0||o)},[]),u(bk.Provider,{value:n,children:t})}var bV=Hx,SR=bV.LexicalComposer;var Kx={};En(Kx,{$canShowPlaceholder:()=>TR,$canShowPlaceholderCurry:()=>SV,$findTextIntersectionFromCharacters:()=>IV,$isRootTextContentEmpty:()=>$x,$isRootTextContentEmptyCurry:()=>wV,$rootTextContent:()=>IR,registerLexicalTextEntity:()=>kV});function IR(){return At().getTextContent()}function $x(e,t=!0){if(e)return!1;let n=IR();return t&&(n=n.trim()),n===""}function wV(e,t){return()=>$x(e,t)}function TR(e){if(!$x(e,!1))return!1;let t=At().getChildren(),n=t.length;if(n>1)return!1;for(let o=0;o<n;o++){let r=t[o];if(Sm(r))return!1;if(je(r)){if(!dA(r)||r.__indent!==0)return!1;let a=r.getChildren(),i=a.length;for(let s=0;s<i;s++){let l=a[o];if(!dt(l))return!1}}}return!0}function SV(e){return()=>TR(e)}function IV(e,t){let n=e.getFirstChild(),o=0;e:for(;n!==null;){if(je(n)){let i=n.getFirstChild();if(i!==null){n=i;continue}}else if(dt(n)){let i=n.getTextContentSize();if(o+i>t)return{node:n,offset:t-o};o+=i}let r=n.getNextSibling();if(r!==null){n=r;continue}let a=n.getParent();for(;a!==null;){let i=a.getNextSibling();if(i!==null){n=i;continue e}a=a.getParent()}break}return null}function TV(e,...t){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(let r of t)o.append("v",r);throw n.search=o.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 kV(e,t,n,o){let r=i=>i instanceof n,a=i=>{let s=Br(i.getTextContent());s.setFormat(i.getFormat()),i.replace(s)};return[e.registerNodeTransform(Bm,i=>{if(!i.isSimpleText())return;let s,l=i.getPreviousSibling(),d=i.getTextContent(),c=i;if(dt(l)){let p=l.getTextContent(),m=t(p+d);if(r(l)){if(m===null||(g=>g.getLatest().__mode)(l)!==0)return void a(l);{let g=m.end-p.length;if(g>0){let h=p+d.slice(0,g);if(l.select(),l.setTextContent(h),g===d.length)i.remove();else{let v=d.slice(g);i.setTextContent(v)}return}}}else if(m===null||m.start<p.length)return}let f=0;for(;;){s=t(d);let p,m=s===null?"":d.slice(s.end);if(d=m,m===""){let h=c.getNextSibling();if(dt(h)){m=c.getTextContent()+h.getTextContent();let v=t(m);if(v===null)return void(r(h)?a(h):h.markDirty());if(v.start!==0)return}}if(s===null)return;if(s.start===0&&dt(l)&&l.isTextEntity()){f+=s.end;continue}s.start===0?[p,c]=c.splitText(s.end):[,p,c]=c.splitText(s.start+f,s.end+f),p===void 0&&TV(165,"nodeToReplace");let g=o(p);if(g.setFormat(p.getFormat()),p.replace(g),c==null)return;f=0,l=g}}),e.registerNodeTransform(n,i=>{let s=i.getTextContent(),l=t(s);if(l===null||l.start!==0)return void a(i);if(s.length>l.end)return void i.splitText(l.end);let d=i.getPreviousSibling();dt(d)&&d.isTextEntity()&&(a(d),a(i));let c=i.getNextSibling();dt(c)&&c.isTextEntity()&&(a(c),r(i)&&a(i))})]}var $s=Kx,Xde=$s.$canShowPlaceholder,ig=$s.$canShowPlaceholderCurry,Yde=$s.$findTextIntersectionFromCharacters,Jde=$s.$isRootTextContentEmpty,Zde=$s.$isRootTextContentEmptyCurry,ece=$s.$rootTextContent,tce=$s.registerLexicalTextEntity;var Vx={};En(Vx,{ContentEditable:()=>PV,ContentEditableElement:()=>PR});ue();var LR=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?he:W;function LV({editor:e,ariaActiveDescendant:t,ariaAutoComplete:n,ariaControls:o,ariaDescribedBy:r,ariaErrorMessage:a,ariaExpanded:i,ariaInvalid:s,ariaLabel:l,ariaLabelledBy:d,ariaMultiline:c,ariaOwns:f,ariaRequired:p,autoCapitalize:m,className:g,id:h,role:v="textbox",spellCheck:y=!0,style:x,tabIndex:C,"data-testid":w,...L},S){let[k,I]=J(e.isEditable()),T=R(P=>{P&&P.ownerDocument&&P.ownerDocument.defaultView?e.setRootElement(P):e.setRootElement(null)},[e]),A=K(()=>(function(...P){return _=>{for(let E of P)typeof E=="function"?E(_):E!=null&&(E.current=_)}})(S,T),[T,S]);return LR(()=>(I(e.isEditable()),e.registerEditableListener(P=>{I(P)})),[e]),u("div",{"aria-activedescendant":k?t:void 0,"aria-autocomplete":k?n:"none","aria-controls":k?o:void 0,"aria-describedby":r,...a!=null?{"aria-errormessage":a}:{},"aria-expanded":k&&v==="combobox"?!!i:void 0,...s!=null?{"aria-invalid":s}:{},"aria-label":l,"aria-labelledby":d,"aria-multiline":c,"aria-owns":k?f:void 0,"aria-readonly":!k||void 0,"aria-required":p,autoCapitalize:m,className:g,contentEditable:k,"data-testid":w,id:h,ref:A,role:v,spellCheck:y,style:x,tabIndex:C,...L})}var PR=zn(LV);function kR(e){return e.getEditorState().read(ig(e.isComposing()))}var PV=zn(AV);function AV(e,t){let{placeholder:n,...o}=e,[r]=Cn();return b(Le,{children:[u(PR,{editor:r,...o,ref:t}),n!=null&&u(EV,{editor:r,content:n})]})}function EV({content:e,editor:t}){let n=(function(i){let[s,l]=J(()=>kR(i));return LR(()=>{function d(){let c=kR(i);l(c)}return d(),Ha(i.registerUpdateListener(()=>{d()}),i.registerEditableListener(()=>{d()}))},[i]),s})(t),[o,r]=J(t.isEditable());if(he(()=>(r(t.isEditable()),t.registerEditableListener(i=>{r(i)})),[t]),!n)return null;let a=null;return typeof e=="function"?a=e(o):e!==null&&(a=e),a===null?null:u("div",{"aria-hidden":!0,children:a})}var AR=Vx,ER=AR.ContentEditable,lce=AR.ContentEditableElement;ue();var RV=Ct(null),qx={didCatch:!1,error:null},sg=class extends Sa{constructor(t){super(t),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=qx}static getDerivedStateFromError(t){return{didCatch:!0,error:t}}resetErrorBoundary(...t){let{error:n}=this.state;n!==null&&(this.props.onReset?.({args:t,reason:"imperative-api"}),this.setState(qx))}componentDidCatch(t,n){this.props.onError?.(t,n)}componentDidUpdate(t,n){let{didCatch:o}=this.state,{resetKeys:r}=this.props;o&&n.error!==null&&MV(t.resetKeys,r)&&(this.props.onReset?.({next:r,prev:t.resetKeys,reason:"keys"}),this.setState(qx))}render(){let{children:t,fallbackRender:n,FallbackComponent:o,fallback:r}=this.props,{didCatch:a,error:i}=this.state,s=t;if(a){let l={error:i,resetErrorBoundary:this.resetErrorBoundary};if(typeof n=="function")s=n(l);else if(o)s=De(o,l);else if(r!==void 0)s=r;else throw i}return De(RV.Provider,{value:{didCatch:a,error:i,resetErrorBoundary:this.resetErrorBoundary}},s)}};function MV(e=[],t=[]){return e.length!==t.length||e.some((n,o)=>!Object.is(n,t[o]))}var Wx={};En(Wx,{LexicalErrorBoundary:()=>NV});function NV({children:e,onError:t}){return u(sg,{fallback:u("div",{style:{border:"1px solid #f00",color:"#f00",padding:"8px"},children:"An error was thrown."}),onError:t,children:e})}var _V=Wx,RR=_V.LexicalErrorBoundary;var Gx={};En(Gx,{OnChangePlugin:()=>OV});ue();var DV=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?he:W;function OV({ignoreHistoryMergeTagChange:e=!0,ignoreSelectionChange:t=!1,onChange:n}){let[o]=Cn();return DV(()=>{if(n)return o.registerUpdateListener(({editorState:r,dirtyElements:a,dirtyLeaves:i,prevEditorState:s,tags:l})=>{t&&a.size===0&&i.size===0||e&&l.has(yr)||s.isEmpty()||n(r,o,l)})},[o,e,t,n]),null}var FV=Gx,MR=FV.OnChangePlugin;var jx={};En(jx,{useLexicalEditable:()=>UV});ue();var BV=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?he:W;function zV(e){return{initialValueFn:()=>e.isEditable(),subscribe:t=>e.registerEditableListener(t)}}function UV(){return(function(e){let[t]=Cn(),n=K(()=>e(t),[t,e]),[o,r]=J(()=>n.initialValueFn()),a=N(o);return BV(()=>{let{initialValueFn:i,subscribe:s}=n,l=i();return a.current!==l&&(a.current=l,r(l)),s(d=>{a.current=d,r(d)})},[n,e]),o})(zV)}var HV=jx,NR=HV.useLexicalEditable;var Qx={};En(Qx,{ReactProviderExtension:()=>$V});var $V=Rn({name:"@lexical/react/ReactProvider"});var KV=Qx,_R=KV.ReactProviderExtension;var Xx={};En(Xx,{DragonExtension:()=>VV,registerDragonSupport:()=>DR});function DR(e){let t=window.location.origin,n=o=>{if(o.origin!==t)return;let r=e.getRootElement();if(document.activeElement!==r)return;let a=o.data;if(typeof a=="string"){let i;try{i=JSON.parse(a)}catch{return}if(i&&i.protocol==="nuanria_messaging"&&i.type==="request"){let s=i.payload;if(s&&s.functionId==="makeChanges"){let l=s.args;if(l){let[d,c,f,p,m]=l;e.update(()=>{let g=Ke();if(Ne(g)){let h=g.anchor,v=h.getNode(),y=0,x=0;if(dt(v)&&d>=0&&c>=0&&(y=d,x=d+c,g.setTextNodeRange(v,y,v,x)),y===x&&f===""||(g.insertRawText(f),v=h.getNode()),dt(v)){y=p,x=p+m;let C=v.getTextContentSize();y=y>C?C:y,x=x>C?C:x,g.setTextNodeRange(v,y,v,x)}o.stopImmediatePropagation()}})}}}}};return window.addEventListener("message",n,!0),()=>{window.removeEventListener("message",n,!0)}}var VV=Rn({build:(e,t,n)=>tg(t),config:Ur({disabled:typeof window>"u"}),name:"@lexical/dragon",register:(e,t,n)=>bu(()=>n.getOutput().disabled.value?void 0:DR(e))});var OR=Xx,FR=OR.DragonExtension,BR=OR.registerDragonSupport;var Yx={};En(Yx,{$generateHtmlFromNodes:()=>WV,$generateNodesFromDOM:()=>qV});function qV(e,t){let n=rE(t)?t.body.childNodes:t.childNodes,o=[],r=[];for(let a of n)if(!UR.has(a.nodeName)){let i=HR(a,e,r,!1);i!==null&&(o=o.concat(i))}return(function(a){for(let i of a)i.getNextSibling()instanceof rx&&i.insertAfter(Os());for(let i of a){let s=i.getChildren();for(let l of s)i.insertBefore(l);i.remove()}})(r),o}function WV(e,t){if(typeof document>"u"||typeof window>"u"&&global.window===void 0)throw new Error("To use $generateHtmlFromNodes in headless mode please initialize a headless browser implementation such as JSDom before calling this function.");let n=document.createElement("div"),o=At().getChildren();for(let r=0;r<o.length;r++)zR(e,o[r],n,t);return n.innerHTML}function zR(e,t,n,o=null){let r=o===null||t.isSelected(o),a=je(t)&&t.excludeFromCopy("html"),i=t;o!==null&&dt(t)&&(i=Gm(o,t,"clone"));let s=je(i)?i.getChildren():[],l=nE(e,i.getType()),d;d=l&&l.exportDOM!==void 0?l.exportDOM(e,i):i.exportDOM(e);let{element:c,after:f}=d;if(!c)return!1;let p=document.createDocumentFragment();for(let m=0;m<s.length;m++){let g=s[m],h=zR(e,g,p,o);!r&&je(t)&&h&&t.extractWithChild(g,o,"html")&&(r=!0)}if(r&&!a){if((UE(c)||lx(c))&&c.append(p),n.append(c),f){let m=f.call(i,c);m&&(lx(c)?c.replaceChildren(m):c.replaceWith(m))}}else n.append(p);return r}var UR=new Set(["STYLE","SCRIPT"]);function HR(e,t,n,o,r=new Map,a){let i=[];if(UR.has(e.nodeName))return i;let s=null,l=(function(g,h){let{nodeName:v}=g,y=h._htmlConversions.get(v.toLowerCase()),x=null;if(y!==void 0)for(let C of y){let w=C(g);w!==null&&(x===null||(x.priority||0)<=(w.priority||0))&&(x=w)}return x!==null?x.conversion:null})(e,t),d=l?l(e):null,c=null;if(d!==null){c=d.after;let g=d.node;if(s=Array.isArray(g)?g[g.length-1]:g,s!==null){for(let[,h]of r)if(s=h(s,a),!s)break;s&&i.push(...Array.isArray(g)?g:[s])}d.forChild!=null&&r.set(e.nodeName,d.forChild)}let f=e.childNodes,p=[],m=(s==null||!zs(s))&&(s!=null&&ad(s)||o);for(let g=0;g<f.length;g++)p.push(...HR(f[g],t,n,m,new Map(r),s));return c!=null&&(p=c(p)),Sx(e)&&(p=GV(e,p,m?()=>{let g=new rx;return n.push(g),g}:hr)),s==null?p.length>0?i=i.concat(p):Sx(e)&&(function(g){return g.nextSibling==null||g.previousSibling==null?!1:hu(g.nextSibling)&&hu(g.previousSibling)})(e)&&(i=i.concat(Os())):je(s)&&s.append(...p),i}function GV(e,t,n){let o=e.style.textAlign,r=[],a=[];for(let i=0;i<t.length;i++){let s=t[i];if(ad(s))o&&!s.getFormat()&&s.setFormat(o),r.push(s);else if(a.push(s),i===t.length-1||i<t.length-1&&ad(t[i+1])){let l=n();l.setFormat(o),l.append(...a),r.push(l),a=[]}}return r}var $R=Yx,KR=$R.$generateHtmlFromNodes,VR=$R.$generateNodesFromDOM;var Zx={};En(Zx,{$generateJSONFromSelectedNodes:()=>QR,$generateNodesFromSerializedNodes:()=>XR,$getClipboardDataFromSelection:()=>JR,$getHtmlContent:()=>WR,$getLexicalContent:()=>GR,$insertDataTransferForPlainText:()=>jV,$insertDataTransferForRichText:()=>QV,$insertGeneratedNodes:()=>Jx,copyToClipboard:()=>XV,setLexicalClipboardDataTransfer:()=>ZR});function lg(e,...t){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(let r of t)o.append("v",r);throw n.search=o.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 WR(e,t=Ke()){return t==null&&lg(166),Ne(t)&&t.isCollapsed()||t.getNodes().length===0?"":KR(e,t)}function GR(e,t=Ke()){return t==null&&lg(166),Ne(t)&&t.isCollapsed()||t.getNodes().length===0?null:JSON.stringify(QR(e,t))}function jV(e,t){let n=e.getData("text/plain")||e.getData("text/uri-list");n!=null&&t.insertRawText(n)}function QV(e,t,n){let o=e.getData("application/x-lexical-editor");if(o)try{let s=JSON.parse(o);if(s.namespace===n._config.namespace&&Array.isArray(s.nodes))return Jx(n,XR(s.nodes),t)}catch(s){console.error(s)}let r=e.getData("text/html"),a=e.getData("text/plain");if(r&&a!==r)try{let s=new DOMParser().parseFromString((function(l){return window.trustedTypes&&window.trustedTypes.createPolicy?window.trustedTypes.createPolicy("lexical",{createHTML:d=>d}).createHTML(l):l})(r),"text/html");return Jx(n,VR(n,s),t)}catch(s){console.error(s)}let i=a||e.getData("text/uri-list");if(i!=null)if(Ne(t)){let s=i.split(/(\r?\n|\t)/);s[s.length-1]===""&&s.pop();for(let l=0;l<s.length;l++){let d=Ke();if(Ne(d)){let c=s[l];c===`
|
|
3783
|
+
`);let l=s.length;if(!dt(o)||r>=l){let d=o.getParent();o.remove(),d==null||d.getChildrenSize()!==0||cu(d)||d.remove(),r-=l+i,o=a}else{let d=o.getKey(),c=e.getEditorState().read(()=>{let m=Cm(d);return dt(m)&&m.isSimpleText()?m.getTextContent():null}),f=l-r,p=s.slice(0,f);if(c!==null&&c!==s){let m=lu(),g=o;if(o.isSimpleText())o.setTextContent(c);else{let h=Fr(c);o.replace(h),g=h}if(Ne(m)&&m.isCollapsed()){let h=m.anchor.offset;g.select(h,h)}}else if(o.isSimpleText()){let m=t.key===d,g=t.offset;g<r&&(g=l);let h=m?g-r:0,v=m?g:f;if(m&&h===0){let[y]=o.splitText(h,v);y.remove()}else{let[,y]=o.splitText(h,v);y.remove()}}else{let m=Fr(p);o.replace(m)}r=0}}}function YK(e){let t=e.getStyle(),n=pE(t);Vm.set(t,n)}function Km(e,t){(Ne(e)?e.isCollapsed():dt(e)||je(e))||ux(280);let n=qm(Ne(e)?e.style:dt(e)?e.getStyle():e.getTextStyle()),o=Object.entries(t).reduce((a,[i,s])=>(typeof s=="function"?a[i]=s(n[i],e):s===null?delete a[i]:a[i]=s,a),{...n}),r=mE(o);Ne(e)||dt(e)?e.setStyle(r):e.setTextStyle(r),Vm.set(r,o)}function JK(e,t){if(Ne(e)&&e.isCollapsed()){Km(e,t);let o=e.anchor.getNode();je(o)&&o.isEmpty()&&Km(o,t)}hE(o=>{Km(o,t)});let n=e.getNodes();if(n.length>0){let o=new Set;for(let r of n){if(!je(r)||!r.canBeEmpty()||r.getChildrenSize()!==0)continue;let a=r.getKey();o.has(a)||(o.add(a),Km(r,t))}}}function hE(e){let t=Ke();if(!t)return;let n=new Map,o=a=>n.get(a.getKey())||[0,a.getTextContentSize()];if(Ne(t))for(let a of XP(t).getTextSlices())a&&n.set(a.caret.origin.getKey(),a.getSliceIndices());let r=t.getNodes();for(let a of r){if(!dt(a)||!a.canHaveFormat())continue;let[i,s]=o(a);s!==i&&(nx(a)||i===0&&s===a.getTextContentSize()?e(a):e(a.splitText(i,s)[i===0?0:1]))}Ne(t)&&t.anchor.type==="text"&&t.focus.type==="text"&&t.anchor.key===t.focus.key&&vE(t)}function vE(e){if(e.isBackward()){let{anchor:t,focus:n}=e,{key:o,offset:r,type:a}=t;t.set(n.key,n.offset,n.type),n.set(o,r,a)}}function yE(e,t){let n=e.getFormatType(),o=e.getIndent();n!==t.getFormatType()&&t.setFormat(n),o!==t.getIndent()&&t.setIndent(o)}function ZK(e,t,n=yE){if(e===null)return;let o=e.getStartEndPoints(),r=new Map,a=null;if(o){let[i,s]=o;a=Ds(),a.anchor.set(i.key,i.offset,i.type),a.focus.set(s.key,s.offset,s.type);let l=Fa(i.getNode(),pu),d=Fa(s.getNode(),pu);je(l)&&r.set(l.getKey(),l),je(d)&&r.set(d.getKey(),d)}for(let i of e.getNodes())if(je(i)&&pu(i))r.set(i.getKey(),i);else if(o===null){let s=Fa(i,pu);je(s)&&r.set(s.getKey(),s)}for(let[i,s]of r){let l=t();n(s,l),s.replace(l,!0),a&&(i===a.anchor.key&&a.anchor.set(l.getKey(),a.anchor.offset,a.anchor.type),i===a.focus.key&&a.focus.set(l.getKey(),a.focus.offset,a.focus.type))}a&&e.is(Ke())&&Br(a)}function fE(e){return e.getNode().isAttached()}function e3(e){let t=e;for(;t!==null&&!Fs(t);){let n=t.getLatest(),o=t.getParent();n.getChildrenSize()===0&&t.remove(!0),t=o}}function t3(e,t,n=null){let o=e.getStartEndPoints(),r=o?o[0]:null,a=e.getNodes(),i=a.length;if(r!==null&&(i===0||i===1&&r.type==="element"&&r.getNode().getChildrenSize()===0)){let d=r.type==="text"?r.getNode().getParentOrThrow():r.getNode(),c=d.getChildren(),f=t();return f.setFormat(d.getFormatType()),f.setIndent(d.getIndent()),c.forEach(p=>f.append(p)),n&&(f=n.append(f)),void d.replace(f)}let s=null,l=[];for(let d=0;d<i;d++){let c=a[d];Fs(c)?(cx(e,l,l.length,t,n),l=[],s=c):s===null||s!==null&&sA(c,s)?l.push(c):(cx(e,l,l.length,t,n),l=[c])}cx(e,l,l.length,t,n)}function cx(e,t,n,o,r=null){if(t.length===0)return;let a=t[0],i=new Map,s=[],l=je(a)?a:a.getParentOrThrow();l.isInline()&&(l=l.getParentOrThrow());let d=!1;for(;l!==null;){let g=l.getPreviousSibling();if(g!==null){l=g,d=!0;break}if(l=l.getParentOrThrow(),Fs(l))break}let c=new Set;for(let g=0;g<n;g++){let h=t[g];je(h)&&h.getChildrenSize()===0&&c.add(h.getKey())}let f=new Set;for(let g=0;g<n;g++){let h=t[g],v=h.getParent();if(v!==null&&v.isInline()&&(v=v.getParent()),v!==null&&cA(h)&&!f.has(h.getKey())){let y=v.getKey();if(i.get(y)===void 0){let x=o();x.setFormat(v.getFormatType()),x.setIndent(v.getIndent()),s.push(x),i.set(y,x),v.getChildren().forEach(C=>{x.append(C),f.add(C.getKey()),je(C)&&C.getChildrenKeys().forEach(w=>f.add(w))}),e3(v)}}else if(c.has(h.getKey())){je(h)||ux(179);let y=o();y.setFormat(h.getFormatType()),y.setIndent(h.getIndent()),s.push(y),h.remove(!0)}}if(r!==null)for(let g=0;g<s.length;g++){let h=s[g];r.append(h)}let p=null;if(Fs(l))if(d)if(r!==null)l.insertAfter(r);else for(let g=s.length-1;g>=0;g--){let h=s[g];l.insertAfter(h)}else{let g=l.getFirstChild();if(je(g)&&(l=g),g===null)if(r)l.append(r);else for(let h=0;h<s.length;h++){let v=s[h];l.append(v),p=v}else if(r!==null)g.insertBefore(r);else for(let h=0;h<s.length;h++){let v=s[h];g.insertBefore(v),p=v}}else if(r)l.insertAfter(r);else for(let g=s.length-1;g>=0;g--){let h=s[g];l.insertAfter(h),p=h}let m=lu();Ne(m)&&fE(m.anchor)&&fE(m.focus)?Br(m.clone()):p!==null?p.selectEnd():e.dirty=!0}function xE(e){let t=CE(e);return t!==null&&t.writingMode==="vertical-rl"}function CE(e){let t=e.anchor.getNode();return je(t)?fx(t):px(t)}function n3(e,t){let n=xE(e)?!t:t;mx(e)&&(n=!n);let o=od(e.focus,n?"previous":"next");if(dA(o))return!1;for(let r of nA(o)){if(du(r))return!r.origin.isInline();if(!je(r.origin)){if(wm(r.origin))return!0;break}}return!1}function bE(e,t,n,o){e.modify(t?"extend":"move",n,o)}function mx(e){let t=CE(e);return t!==null&&t.direction==="rtl"}function o3(e,t,n){let o=mx(e),r;r=xE(e)||o?!n:n,bE(e,t,r,"character")}function r3(e,t,n){let o=qm(e.getStyle());return o!==null&&o[t]||n}function a3(e,t,n=""){let o=null,r=e.getNodes(),a=e.anchor,i=e.focus,s=e.isBackward(),l=s?i.offset:a.offset,d=s?i.getNode():a.getNode();if(Ne(e)&&e.isCollapsed()&&e.style!==""){let c=qm(e.style);if(c!==null&&t in c)return c[t]}for(let c=0;c<r.length;c++){let f=r[c];if((c===0||l!==0||!f.is(d))&&dt(f)){let p=r3(f,t,n);if(o===null)o=p;else if(o!==p){o="";break}}}return o===null?n:o}var i3=gE;var un=gx,wE=un.$addNodeStyle,Fse=un.$cloneWithProperties,Bse=un.$copyBlockFormatIndent,zse=un.$ensureForwardRangeSelection,Use=un.$forEachSelectedTextNode,Hse=un.$getComputedStyleForElement,$se=un.$getComputedStyleForParent,Kse=un.$getSelectionStyleValueForProperty,Vse=un.$isAtNodeEnd,qse=un.$isParentElementRTL,Wse=un.$isParentRTL,Gse=un.$moveCaretSelection,hx=un.$moveCharacter,jse=un.$patchStyleText,Qse=un.$selectAll,Xse=un.$setBlocksType,vx=un.$shouldOverrideDefaultCharacterSelection,Wm=un.$sliceSelectedTextNodeContent,Yse=un.$trimTextContentFromAnchor,Jse=un.$wrapNodes,Zse=un.createDOMRange,SE=un.createRectsFromDOMRange,ele=un.getCSSFromStyleObject,tle=un.getStyleObjectFromCSS,nle=un.trimTextContentFromAnchor;var bx={};En(bx,{$descendantsMatching:()=>K3,$dfs:()=>T3,$dfsIterator:()=>NE,$filter:()=>F3,$findMatchingParent:()=>Fa,$firstToLastIterator:()=>V3,$getAdjacentCaret:()=>k3,$getAdjacentSiblingOrParentSiblingCaret:()=>Os,$getDepth:()=>DE,$getNearestBlockElementAncestorOrThrow:()=>R3,$getNearestNodeOfType:()=>E3,$getNextRightPreorderNode:()=>A3,$getNextSiblingOrParentSibling:()=>P3,$handleIndentAndOutdent:()=>B3,$insertFirst:()=>z3,$insertNodeToNearestRoot:()=>_3,$insertNodeToNearestRootAtCaret:()=>FE,$isEditorIsNestedEditor:()=>H3,$lastToFirstIterator:()=>Cx,$restoreEditorState:()=>N3,$reverseDfs:()=>L3,$reverseDfsIterator:()=>OE,$splitNode:()=>xA,$unwrapAndFilterDescendants:()=>$3,$unwrapNode:()=>q3,$wrapNodeInElement:()=>D3,CAN_USE_BEFORE_INPUT:()=>h3,CAN_USE_DOM:()=>EE,IS_ANDROID:()=>v3,IS_ANDROID_CHROME:()=>y3,IS_APPLE:()=>x3,IS_APPLE_WEBKIT:()=>C3,IS_CHROME:()=>b3,IS_FIREFOX:()=>RE,IS_IOS:()=>w3,IS_SAFARI:()=>S3,addClassNamesToElement:()=>mu,calculateZoomLevel:()=>U3,isBlockDomNode:()=>aE,isHTMLAnchorElement:()=>lE,isHTMLElement:()=>Um,isInlineDomNode:()=>gu,isMimeType:()=>ME,makeStateWrapper:()=>W3,markSelection:()=>AE,mediaFileReader:()=>I3,mergeRegister:()=>ua,objectKlassEquals:()=>O3,positionNodeOnRange:()=>PE,registerNestedElementResolver:()=>M3,removeClassNamesFromElement:()=>Hm,selectionAlwaysOnDisplay:()=>g3});function Gm(e,...t){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(let r of t)o.append("v",r);throw n.search=o.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.`)}var Ur=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,s3=Ur&&"documentMode"in document?document.documentMode:null,kE=Ur&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),l3=Ur&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),d3=!(!Ur||!("InputEvent"in window)||s3)&&"getTargetRanges"in new window.InputEvent("input"),c3=Ur&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),u3=Ur&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,LE=Ur&&/Android/.test(navigator.userAgent),xx=Ur&&/^(?=.*Chrome).*/i.test(navigator.userAgent),f3=Ur&&LE&&xx,p3=Ur&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&kE&&!xx;function fa(e){return`${e}px`}var m3={attributes:!0,characterData:!0,childList:!0,subtree:!0};function PE(e,t,n){let o=null,r=null,a=null,i=[],s=document.createElement("div");function l(){o===null&&Gm(182),r===null&&Gm(183);let{left:f,top:p}=r.getBoundingClientRect(),m=SE(e,t);var g,h;s.isConnected||(h=s,(g=r).insertBefore(h,g.firstChild));let v=!1;for(let y=0;y<m.length;y++){let x=m[y],C=i[y]||document.createElement("div"),w=C.style;w.position!=="absolute"&&(w.position="absolute",v=!0);let L=fa(x.left-f);w.left!==L&&(w.left=L,v=!0);let S=fa(x.top-p);w.top!==S&&(C.style.top=S,v=!0);let k=fa(x.width);w.width!==k&&(C.style.width=k,v=!0);let I=fa(x.height);w.height!==I&&(C.style.height=I,v=!0),C.parentNode!==s&&(s.append(C),v=!0),i[y]=C}for(;i.length>m.length;)i.pop();v&&n(i)}function d(){r=null,o=null,a!==null&&a.disconnect(),a=null,s.remove();for(let f of i)f.remove();i=[]}s.style.position="relative";let c=e.registerRootListener(function f(){let p=e.getRootElement();if(p===null)return d();let m=p.parentElement;if(!Um(m))return d();d(),o=p,r=m,a=new MutationObserver(g=>{let h=e.getRootElement(),v=h&&h.parentElement;if(h!==o||v!==r)return f();for(let y of g)if(!s.contains(y.target))return l()}),a.observe(m,m3),l()});return()=>{c(),d()}}function IE(e,t,n){if(e.type!=="text"&&je(t)){let o=t.getDOMSlot(n);return[o.element,o.getFirstChildOffset()+e.offset]}return[oE(n)||n,e.offset]}function AE(e,t){let n=null,o=null,r=null,a=null,i=null,s=null,l=()=>{};function d(c){c.read(()=>{let f=Ke();if(!Ne(f))return n=null,r=null,a=null,s=null,l(),void(l=()=>{});let[p,m]=(function(I){let T=I.getStartEndPoints();return I.isBackward()?[T[1],T[0]]:T})(f),g=p.getNode(),h=g.getKey(),v=p.offset,y=m.getNode(),x=y.getKey(),C=m.offset,w=e.getElementByKey(h),L=e.getElementByKey(x),S=n===null||w!==o||v!==r||h!==n.getKey(),k=a===null||L!==i||C!==s||x!==a.getKey();if((S||k)&&w!==null&&L!==null){let I=(function(T,A,P,_,E,F,B){let V=(T._window?T._window.document:document).createRange();return V.setStart(...IE(A,P,_)),V.setEnd(...IE(E,F,B)),V})(e,p,g,w,m,y,L);l(),l=PE(e,I,T=>{if(t===void 0)for(let A of T){let P=A.style;P.background!=="Highlight"&&(P.background="Highlight"),P.color!=="HighlightText"&&(P.color="HighlightText"),P.marginTop!==fa(-1.5)&&(P.marginTop=fa(-1.5)),P.paddingTop!==fa(4)&&(P.paddingTop=fa(4)),P.paddingBottom!==fa(0)&&(P.paddingBottom=fa(0))}else t(T)})}n=g,o=w,r=v,a=y,i=L,s=C})}return d(e.getEditorState()),ua(e.registerUpdateListener(({editorState:c})=>d(c)),()=>{l()})}function g3(e,t){let n=null,o=()=>{let r=getSelection(),a=r&&r.anchorNode,i=e.getRootElement();a!==null&&i!==null&&i.contains(a)?n!==null&&(n(),n=null):n===null&&(n=AE(e,t))};return document.addEventListener("selectionchange",o),()=>{n!==null&&n(),document.removeEventListener("selectionchange",o)}}var h3=d3,EE=Ur,v3=LE,y3=f3,x3=kE,C3=p3,b3=xx,RE=l3,w3=u3,S3=c3;function ME(e,t){for(let n of t)if(e.type.startsWith(n))return!0;return!1}function I3(e,t){let n=e[Symbol.iterator]();return new Promise((o,r)=>{let a=[],i=()=>{let{done:s,value:l}=n.next();if(s)return o(a);let d=new FileReader;d.addEventListener("error",r),d.addEventListener("load",()=>{let c=d.result;typeof c=="string"&&a.push({file:l,result:c}),i()}),ME(l,t)?d.readAsDataURL(l):i()};i()})}function T3(e,t){return Array.from(NE(e,t))}function k3(e){return e?e.getAdjacentCaret():null}function L3(e,t){return Array.from(OE(e,t))}function NE(e,t){return _E("next",e,t)}function TE(e,t){let n=Os(Ba(e,t));return n&&n[0]}function _E(e,t,n){let o=At(),r=t||o,a=je(r)?Ni(r,e):Ba(r,e),i=DE(r),s=n?Jy(ex(Ba(n,e)))||TE(n,e):TE(r,e),l=i;return lx({hasNext:d=>d!==null,initial:a,map:d=>({depth:l,node:d.origin}),step:d=>{if(d.isSameNodeCaret(s))return null;du(d)&&l++;let c=Os(d);return!c||c[0].isSameNodeCaret(s)?null:(l+=c[1],c[0])}})}function P3(e){let t=Os(Ba(e,"next"));return t&&[t[0].origin,t[1]]}function DE(e){let t=-1;for(let n=e;n!==null;n=n.getParent())t++;return t}function A3(e){let t=ex(Ba(e,"previous")),n=Os(t,"root");return n&&n[0].origin}function OE(e,t){return _E("previous",e,t)}function E3(e,t){let n=e;for(;n!=null;){if(n instanceof t)return n;n=n.getParent()}return null}function R3(e){let t=Fa(e,n=>je(n)&&!n.isInline());return je(t)||Gm(4,e.__key),t}function M3(e,t,n,o){let r=a=>a instanceof t;return e.registerNodeTransform(t,a=>{let i=(s=>{let l=s.getChildren();for(let f=0;f<l.length;f++){let p=l[f];if(r(p))return null}let d=s,c=s;for(;d!==null;)if(c=d,d=d.getParent(),r(d))return{child:c,parent:d};return null})(a);if(i!==null){let{child:s,parent:l}=i;if(s.is(a)){o(l,a);let d=s.getNextSiblings(),c=d.length;if(l.insertAfter(s),c!==0){let f=n(l);s.insertAfter(f);for(let p=0;p<c;p++)f.append(d[p])}l.canBeEmpty()||l.getChildrenSize()!==0||l.remove()}}})}function N3(e,t){let n=new Map,o=e._pendingEditorState;for(let[a,i]of t._nodeMap)n.set(a,ym(i));o&&(o._nodeMap=n),e._dirtyType=2;let r=t._selection;Br(r===null?null:r.clone())}function _3(e){let t=Ke()||lu(),n;if(Ne(t))n=od(t.focus,"next");else{if(t!=null){let i=t.getNodes(),s=i[i.length-1];s&&(n=Ba(s,"next"))}n=n||Ni(At(),"previous").getFlipped().insert(gr())}let o=FE(e,n),r=Jy(o),a=du(r)?pA(r):o;return vA(aA(a)),e.getLatest()}function FE(e,t,n){let o=Zy(t,"next");for(let r=o;r;r=yA(r,n))o=r;return Sm(o)&&Gm(283),o.insert(e.isInline()?gr().append(e):e),Zy(Ba(e.getLatest(),"next"),t.direction)}function D3(e,t){let n=t();return e.replace(n),n.append(e),n}function O3(e,t){return e!==null&&Object.getPrototypeOf(e).constructor.name===t.name}function F3(e,t){let n=[];for(let o=0;o<e.length;o++){let r=t(e[o]);r!==null&&n.push(r)}return n}function B3(e){let t=Ke();if(!Ne(t))return!1;let n=new Set,o=t.getNodes();for(let r=0;r<o.length;r++){let a=o[r],i=a.getKey();if(n.has(i))continue;let s=Fa(a,d=>je(d)&&!d.isInline());if(s===null)continue;let l=s.getKey();s.canIndent()&&!n.has(l)&&(n.add(l),e(s))}return n.size>0}function z3(e,t){Ni(e,"next").insert(t)}var yx=!(RE||!EE)&&void 0;function U3(e,t=!1){let n=1;if((function(){if(yx===void 0){let o=document.createElement("div");o.style.cssText="position: absolute; opacity: 0; width: 100px; left: -1000px;",document.body.appendChild(o);let r=o.getBoundingClientRect();o.style.setProperty("zoom","2"),yx=o.getBoundingClientRect().width===r.width,document.body.removeChild(o)}return yx})()||t)for(;e;)n*=Number(window.getComputedStyle(e).getPropertyValue("zoom")),e=e.parentElement;return n}function H3(e){return e._parentEditor!==null}function $3(e,t){return BE(e,t,null)}function BE(e,t,n){let o=!1;for(let r of Cx(e))t(r)?n!==null&&n(r):(o=!0,je(r)&&BE(r,t,n||(a=>r.insertAfter(a))),r.remove());return o}function K3(e,t){let n=[],o=Array.from(e).reverse();for(let r=o.pop();r!==void 0;r=o.pop())if(t(r))n.push(r);else if(je(r))for(let a of Cx(r))o.push(a);return n}function V3(e){return zE(Ni(e,"next"))}function Cx(e){return zE(Ni(e,"previous"))}function zE(e){return lx({hasNext:fA,initial:e.getAdjacentCaret(),map:t=>t.origin.getLatest(),step:t=>t.getAdjacentCaret()})}function q3(e){hA(Ba(e,"next")).splice(1,e.getChildren())}function W3(e){let t=o=>bm(o,e),n=(o,r)=>Tm(o,e,r);return{$get:t,$set:n,accessors:[t,n],makeGetterMethod:()=>function(){return t(this)},makeSetterMethod:()=>function(o){return n(this,o)},stateConfig:e}}var Qe=bx,sle=Qe.$descendantsMatching,lle=Qe.$dfs,dle=Qe.$dfsIterator,cle=Qe.$filter,ule=Qe.$findMatchingParent,fle=Qe.$firstToLastIterator,ple=Qe.$getAdjacentCaret,mle=Qe.$getAdjacentSiblingOrParentSiblingCaret,gle=Qe.$getDepth,UE=Qe.$getNearestBlockElementAncestorOrThrow,hle=Qe.$getNearestNodeOfType,vle=Qe.$getNextRightPreorderNode,yle=Qe.$getNextSiblingOrParentSibling,HE=Qe.$handleIndentAndOutdent,xle=Qe.$insertFirst,Cle=Qe.$insertNodeToNearestRoot,ble=Qe.$insertNodeToNearestRootAtCaret,wle=Qe.$isEditorIsNestedEditor,Sle=Qe.$lastToFirstIterator,Ile=Qe.$restoreEditorState,Tle=Qe.$reverseDfs,kle=Qe.$reverseDfsIterator,Lle=Qe.$splitNode,Ple=Qe.$unwrapAndFilterDescendants,Ale=Qe.$unwrapNode,Ele=Qe.$wrapNodeInElement,Rle=Qe.CAN_USE_BEFORE_INPUT,Mle=Qe.CAN_USE_DOM,Nle=Qe.IS_ANDROID,_le=Qe.IS_ANDROID_CHROME,Dle=Qe.IS_APPLE,Ole=Qe.IS_APPLE_WEBKIT,Fle=Qe.IS_CHROME,Ble=Qe.IS_FIREFOX,zle=Qe.IS_IOS,Ule=Qe.IS_SAFARI,Hle=Qe.addClassNamesToElement,$le=Qe.calculateZoomLevel,wx=Qe.isBlockDomNode,Kle=Qe.isHTMLAnchorElement,$E=Qe.isHTMLElement,Vle=Qe.isInlineDomNode,qle=Qe.isMimeType,Wle=Qe.makeStateWrapper,Gle=Qe.markSelection,jle=Qe.mediaFileReader,Ua=Qe.mergeRegister,hu=Qe.objectKlassEquals,Qle=Qe.positionNodeOnRange,Xle=Qe.registerNestedElementResolver,Yle=Qe.removeClassNamesFromElement,Jle=Qe.selectionAlwaysOnDisplay;var Fx={};En(Fx,{$createHorizontalRuleNode:()=>Ox,$isDecoratorTextNode:()=>nR,$isHorizontalRuleNode:()=>lR,AutoFocusExtension:()=>Q3,ClearEditorExtension:()=>X3,DecoratorTextExtension:()=>nV,DecoratorTextNode:()=>xu,EditorStateExtension:()=>Ym,HorizontalRuleExtension:()=>pV,HorizontalRuleNode:()=>zs,INSERT_HORIZONTAL_RULE_COMMAND:()=>uV,InitialStateExtension:()=>iR,LexicalBuilder:()=>cd,NodeSelectionExtension:()=>Mx,TabIndentationExtension:()=>mV,applyFormatFromStyle:()=>J3,applyFormatToDom:()=>Z3,batch:()=>jE,buildEditorFromExtensions:()=>iV,computed:()=>YE,configExtension:()=>Bm,declarePeerDependency:()=>nE,defineExtension:()=>Rn,effect:()=>Di,getExtensionDependencyFromEditor:()=>lV,getKnownTypesAndNodes:()=>Y3,getPeerDependencyFromEditor:()=>sR,getPeerDependencyFromEditorOrThrow:()=>dV,namedSignals:()=>Zm,registerClearEditor:()=>eR,registerTabIndentation:()=>cR,safeCast:()=>zr,shallowMergeConfig:()=>$m,signal:()=>dd,untracked:()=>Px,watchedSignal:()=>_x});var G3=Symbol.for("preact-signals");function Jm(){if(_i>1)return void _i--;let e,t=!1;for(;yu!==void 0;){let n=yu;for(yu=void 0,Ax++;n!==void 0;){let o=n.o;if(n.o=void 0,n.f&=-3,!(8&n.f)&&QE(n))try{n.c()}catch(r){t||(e=r,t=!0)}n=o}}if(Ax=0,_i--,t)throw e}function jE(e){if(_i>0)return e();_i++;try{return e()}finally{Jm()}}var Kt,yu;function Px(e){let t=Kt;Kt=void 0;try{return e()}finally{Kt=t}}var _i=0,Ax=0,Xm=0;function KE(e){if(Kt===void 0)return;let t=e.n;return t===void 0||t.t!==Kt?(t={i:0,S:e,p:Kt.s,n:void 0,t:Kt,e:void 0,x:void 0,r:t},Kt.s!==void 0&&(Kt.s.n=t),Kt.s=t,e.n=t,32&Kt.f&&e.S(t),t):t.i===-1?(t.i=0,t.n!==void 0&&(t.n.p=t.p,t.p!==void 0&&(t.p.n=t.n),t.p=Kt.s,t.n=void 0,Kt.s.n=t,Kt.s=t),t):void 0}function Io(e,t){this.v=e,this.i=0,this.n=void 0,this.t=void 0,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}function dd(e,t){return new Io(e,t)}function QE(e){for(let t=e.s;t!==void 0;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function VE(e){for(let t=e.s;t!==void 0;t=t.n){let n=t.S.n;if(n!==void 0&&(t.r=n),t.S.n=t,t.i=-1,t.n===void 0){e.s=t;break}}}function XE(e){let t,n=e.s;for(;n!==void 0;){let o=n.p;n.i===-1?(n.S.U(n),o!==void 0&&(o.n=n.n),n.n!==void 0&&(n.n.p=o)):t=n,n.S.n=n.r,n.r!==void 0&&(n.r=void 0),n=o}e.s=t}function Bs(e,t){Io.call(this,void 0),this.x=e,this.s=void 0,this.g=Xm-1,this.f=4,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}function YE(e,t){return new Bs(e,t)}function JE(e){let t=e.u;if(e.u=void 0,typeof t=="function"){_i++;let n=Kt;Kt=void 0;try{t()}catch(o){throw e.f&=-2,e.f|=8,Nx(e),o}finally{Kt=n,Jm()}}}function Nx(e){for(let t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,JE(e)}function j3(e){if(Kt!==this)throw new Error("Out-of-order effect");XE(this),Kt=e,this.f&=-2,8&this.f&&Nx(this),Jm()}function ld(e,t){this.x=e,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32,this.name=t?.name}function Di(e,t){let n=new ld(e,t);try{n.c()}catch(r){throw n.d(),r}let o=n.d.bind(n);return o[Symbol.dispose]=o,o}function Zm(e,t={}){let n={};for(let o in e){let r=t[o],a=dd(r===void 0?e[o]:r);n[o]=a}return n}Io.prototype.brand=G3,Io.prototype.h=function(){return!0},Io.prototype.S=function(e){let t=this.t;t!==e&&e.e===void 0&&(e.x=t,this.t=e,t!==void 0?t.e=e:Px(()=>{var n;(n=this.W)==null||n.call(this)}))},Io.prototype.U=function(e){if(this.t!==void 0){let t=e.e,n=e.x;t!==void 0&&(t.x=n,e.e=void 0),n!==void 0&&(n.e=t,e.x=void 0),e===this.t&&(this.t=n,n===void 0&&Px(()=>{var o;(o=this.Z)==null||o.call(this)}))}},Io.prototype.subscribe=function(e){return Di(()=>{let t=this.value,n=Kt;Kt=void 0;try{e(t)}finally{Kt=n}},{name:"sub"})},Io.prototype.valueOf=function(){return this.value},Io.prototype.toString=function(){return this.value+""},Io.prototype.toJSON=function(){return this.value},Io.prototype.peek=function(){let e=Kt;Kt=void 0;try{return this.value}finally{Kt=e}},Object.defineProperty(Io.prototype,"value",{get(){let e=KE(this);return e!==void 0&&(e.i=this.i),this.v},set(e){if(e!==this.v){if(Ax>100)throw new Error("Cycle detected");this.v=e,this.i++,Xm++,_i++;try{for(let t=this.t;t!==void 0;t=t.x)t.t.N()}finally{Jm()}}}}),Bs.prototype=new Io,Bs.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===Xm))return!0;if(this.g=Xm,this.f|=1,this.i>0&&!QE(this))return this.f&=-2,!0;let e=Kt;try{VE(this),Kt=this;let t=this.x();(16&this.f||this.v!==t||this.i===0)&&(this.v=t,this.f&=-17,this.i++)}catch(t){this.v=t,this.f|=16,this.i++}return Kt=e,XE(this),this.f&=-2,!0},Bs.prototype.S=function(e){if(this.t===void 0){this.f|=36;for(let t=this.s;t!==void 0;t=t.n)t.S.S(t)}Io.prototype.S.call(this,e)},Bs.prototype.U=function(e){if(this.t!==void 0&&(Io.prototype.U.call(this,e),this.t===void 0)){this.f&=-33;for(let t=this.s;t!==void 0;t=t.n)t.S.U(t)}},Bs.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(let e=this.t;e!==void 0;e=e.x)e.t.N()}},Object.defineProperty(Bs.prototype,"value",{get(){if(1&this.f)throw new Error("Cycle detected");let e=KE(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}}),ld.prototype.c=function(){let e=this.S();try{if(8&this.f||this.x===void 0)return;let t=this.x();typeof t=="function"&&(this.u=t)}finally{e()}},ld.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,JE(this),VE(this),_i++;let e=Kt;return Kt=this,j3.bind(this,e)},ld.prototype.N=function(){2&this.f||(this.f|=2,this.o=yu,yu=this)},ld.prototype.d=function(){this.f|=8,1&this.f||Nx(this)},ld.prototype.dispose=function(){this.d()};var Q3=Rn({build:(e,t,n)=>Zm(t),config:zr({defaultSelection:"rootEnd",disabled:!1}),name:"@lexical/extension/AutoFocus",register(e,t,n){let o=n.getOutput();return Di(()=>o.disabled.value?void 0:e.registerRootListener(r=>{e.focus(()=>{let a=document.activeElement;r===null||a!==null&&r.contains(a)||r.focus({preventScroll:!0})},{defaultSelection:o.defaultSelection.peek()})}))}});function ZE(){let e=At(),t=Ke(),n=gr();e.clear(),e.append(n),t!==null&&n.select(),Ne(t)&&(t.format=0)}function eR(e,t=ZE){return e.registerCommand(km,n=>(e.update(t),!0),tn)}var X3=Rn({build:(e,t,n)=>Zm(t),config:zr({$onClear:ZE}),name:"@lexical/extension/ClearEditor",register(e,t,n){let{$onClear:o}=n.getOutput();return Di(()=>eR(e,o.value))}});function Y3(e){let t=new Set,n=new Set;for(let o of tR(e)){let r=typeof o=="function"?o:o.replace;t.add(r.getType()),n.add(r)}return{nodes:n,types:t}}function tR(e){return(typeof e.nodes=="function"?e.nodes():e.nodes)||[]}var Sx=tE("format",{parse:e=>typeof e=="number"?e:0}),xu=class extends za{$config(){return this.config("decorator-text",{extends:za,stateConfigs:[{flat:!0,stateConfig:Sx}]})}getFormat(){return bm(this,Sx)}getFormatFlags(t,n){return dx(this.getFormat(),t,n)}hasFormat(t){let n=YA[t];return(this.getFormat()&n)!==0}setFormat(t){return Tm(this,Sx,t)}toggleFormat(t){let n=this.getFormat(),o=dx(n,t,null);return this.setFormat(o)}isInline(){return!0}createDOM(){return document.createElement("span")}updateDOM(){return!1}};function nR(e){return e instanceof xu}function J3(e,t,n){let o=t.fontWeight,r=t.textDecoration.split(" "),a=o==="700"||o==="bold",i=r.includes("line-through"),s=t.fontStyle==="italic",l=r.includes("underline"),d=t.verticalAlign;return a&&!e.hasFormat("bold")&&e.toggleFormat("bold"),i&&!e.hasFormat("strikethrough")&&e.toggleFormat("strikethrough"),s&&!e.hasFormat("italic")&&e.toggleFormat("italic"),l&&!e.hasFormat("underline")&&e.toggleFormat("underline"),d!=="sub"||e.hasFormat("subscript")||e.toggleFormat("subscript"),d!=="super"||e.hasFormat("superscript")||e.toggleFormat("superscript"),n&&!e.hasFormat(n)&&e.toggleFormat(n),e}function Z3(e,t,n=tV){for(let[o,r]of Object.entries(n))e.hasFormat(r)&&(t=eV(t,o));return t}function eV(e,t){let n=document.createElement(t);return n.appendChild(e),n}var tV={b:"bold",code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"},nV=Rn({name:"@lexical/extension/DecoratorText",nodes:()=>[xu],register:(e,t,n)=>e.registerCommand(MA,o=>{let r=Ke();if(tx(r)||Ne(r))for(let a of r.getNodes())nR(a)&&a.toggleFormat(o);return!1},id)});function _x(e,t){let n;return dd(e(),{unwatched(){n&&(n(),n=void 0)},watched(){this.value=e(),n=t(this)}})}var Ym=Rn({build:e=>_x(()=>e.getEditorState(),t=>e.registerUpdateListener(n=>{t.value=n.editorState})),name:"@lexical/extension/EditorState"});function Gt(e,...t){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(let r of t)o.append("v",r);throw n.search=o.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 oR(e,t){if(e&&t&&!Array.isArray(t)&&typeof e=="object"&&typeof t=="object"){let n=e,o=t;for(let r in o)n[r]=oR(n[r],o[r]);return e}return t}var Dx=0,Ex=1,rR=2,Ix=3,jm=4,sd=5,Tx=6,vu=7;function kx(e){return e.id===Dx}function aR(e){return e.id===rR}function oV(e){return(function(t){return t.id===Ex})(e)||Gt(305,String(e.id),String(Ex)),Object.assign(e,{id:rR})}var rV=new Set,Rx=class{builder;configs;_dependency;_peerNameSet;extension;state;_signal;constructor(t,n){this.builder=t,this.extension=n,this.configs=new Set,this.state={id:Dx}}mergeConfigs(){let t=this.extension.config||{},n=this.extension.mergeConfig?this.extension.mergeConfig.bind(this.extension):$m;for(let o of this.configs)t=n(t,o);return t}init(t){let n=this.state;aR(n)||Gt(306,String(n.id));let o={getDependency:this.getInitDependency.bind(this),getDirectDependentNames:this.getDirectDependentNames.bind(this),getPeer:this.getInitPeer.bind(this),getPeerNameSet:this.getPeerNameSet.bind(this)},r={...o,getDependency:this.getDependency.bind(this),getInitResult:this.getInitResult.bind(this),getPeer:this.getPeer.bind(this)},a=(function(s,l,d){return Object.assign(s,{config:l,id:Ix,registerState:d})})(n,this.mergeConfigs(),o),i;this.state=a,this.extension.init&&(i=this.extension.init(t,a.config,o)),this.state=(function(s,l,d){return Object.assign(s,{id:jm,initResult:l,registerState:d})})(a,i,r)}build(t){let n=this.state,o;n.id!==jm&&Gt(307,String(n.id),String(sd)),this.extension.build&&(o=this.extension.build(t,n.config,n.registerState));let r={...n.registerState,getOutput:()=>o,getSignal:this.getSignal.bind(this)};this.state=(function(a,i,s){return Object.assign(a,{id:sd,output:i,registerState:s})})(n,o,r)}register(t,n){this._signal=n;let o=this.state;o.id!==sd&&Gt(308,String(o.id),String(sd));let r=this.extension.register&&this.extension.register(t,o.config,o.registerState);return this.state=(function(a){return Object.assign(a,{id:Tx})})(o),()=>{let a=this.state;a.id!==vu&&Gt(309,String(o.id),String(vu)),this.state=(function(i){return Object.assign(i,{id:sd})})(a),r&&r()}}afterRegistration(t){let n=this.state,o;return n.id!==Tx&&Gt(310,String(n.id),String(Tx)),this.extension.afterRegistration&&(o=this.extension.afterRegistration(t,n.config,n.registerState)),this.state=(function(r){return Object.assign(r,{id:vu})})(n),o}getSignal(){return this._signal===void 0&&Gt(311),this._signal}getInitResult(){this.extension.init===void 0&&Gt(312,this.extension.name);let t=this.state;return(function(n){return n.id>=jm})(t)||Gt(313,String(t.id),String(jm)),t.initResult}getInitPeer(t){let n=this.builder.extensionNameMap.get(t);return n?n.getExtensionInitDependency():void 0}getExtensionInitDependency(){let t=this.state;return(function(n){return n.id>=Ix})(t)||Gt(314,String(t.id),String(Ix)),{config:t.config}}getPeer(t){let n=this.builder.extensionNameMap.get(t);return n?n.getExtensionDependency():void 0}getInitDependency(t){let n=this.builder.getExtensionRep(t);return n===void 0&&Gt(315,this.extension.name,t.name),n.getExtensionInitDependency()}getDependency(t){let n=this.builder.getExtensionRep(t);return n===void 0&&Gt(315,this.extension.name,t.name),n.getExtensionDependency()}getState(){let t=this.state;return(function(n){return n.id>=vu})(t)||Gt(316,String(t.id),String(vu)),t}getDirectDependentNames(){return this.builder.incomingEdges.get(this.extension.name)||rV}getPeerNameSet(){let t=this._peerNameSet;return t||(t=new Set((this.extension.peerDependencies||[]).map(([n])=>n)),this._peerNameSet=t),t}getExtensionDependency(){if(!this._dependency){let t=this.state;(function(n){return n.id>=sd})(t)||Gt(317,this.extension.name),this._dependency={config:t.config,init:t.initResult,output:t.output}}return this._dependency}},qE={tag:vr};function aV(){let e=At();e.isEmpty()&&e.append(gr())}var iR=Rn({config:zr({setOptions:qE,updateOptions:qE}),init:({$initialEditorState:e=aV})=>({$initialEditorState:e,initialized:!1}),afterRegistration(e,{updateOptions:t,setOptions:n},o){let r=o.getInitResult();if(!r.initialized){r.initialized=!0;let{$initialEditorState:a}=r;if(lA(a))e.setEditorState(a,n);else if(typeof a=="function")e.update(()=>{a(e)},t);else if(a&&(typeof a=="string"||typeof a=="object")){let i=e.parseEditorState(a);e.setEditorState(i,n)}}return()=>{}},name:"@lexical/extension/InitialState",nodes:[GA,Fm,HA,JA,VA]}),WE=Symbol.for("@lexical/extension/LexicalBuilder");function iV(...e){return cd.fromExtensions(e).buildEditor()}function GE(){}function sV(e){throw e}function Qm(e){return Array.isArray(e)?e:[e]}var Lx="0.41.0+prod.esm",cd=class e{roots;extensionNameMap;outgoingConfigEdges;incomingEdges;conflicts;_sortedExtensionReps;PACKAGE_VERSION;constructor(t){this.outgoingConfigEdges=new Map,this.incomingEdges=new Map,this.extensionNameMap=new Map,this.conflicts=new Map,this.PACKAGE_VERSION=Lx,this.roots=t;for(let n of t)this.addExtension(n)}static fromExtensions(t){let n=[Qm(iR)];for(let o of t)n.push(Qm(o));return new e(n)}static maybeFromEditor(t){let n=t[WE];return n&&(n.PACKAGE_VERSION!==Lx&&Gt(292,n.PACKAGE_VERSION,Lx),n instanceof e||Gt(293)),n}static fromEditor(t){let n=e.maybeFromEditor(t);return n===void 0&&Gt(294),n}constructEditor(){let{$initialEditorState:t,onError:n,...o}=this.buildCreateEditorArgs(),r=Object.assign(zm({...o,...n?{onError:a=>{n(a,r)}}:{}}),{[WE]:this});for(let a of this.sortedExtensionReps())a.build(r);return r}buildEditor(){let t=GE;function n(){try{t()}finally{t=GE}}let o=Object.assign(this.constructEditor(),{dispose:n,[Symbol.dispose]:n});return t=ua(this.registerEditor(o),()=>o.setRootElement(null)),o}hasExtensionByName(t){return this.extensionNameMap.has(t)}getExtensionRep(t){let n=this.extensionNameMap.get(t.name);if(n)return n.extension!==t&&Gt(295,t.name),n}addEdge(t,n,o){let r=this.outgoingConfigEdges.get(t);r?r.set(n,o):this.outgoingConfigEdges.set(t,new Map([[n,o]]));let a=this.incomingEdges.get(n);a?a.add(t):this.incomingEdges.set(n,new Set([t]))}addExtension(t){this._sortedExtensionReps!==void 0&&Gt(296);let n=Qm(t),[o]=n;typeof o.name!="string"&&Gt(297,typeof o.name);let r=this.extensionNameMap.get(o.name);if(r!==void 0&&r.extension!==o&&Gt(298,o.name),!r){r=new Rx(this,o),this.extensionNameMap.set(o.name,r);let a=this.conflicts.get(o.name);typeof a=="string"&&Gt(299,o.name,a);for(let i of o.conflictsWith||[])this.extensionNameMap.has(i)&&Gt(299,o.name,i),this.conflicts.set(i,o.name);for(let i of o.dependencies||[]){let s=Qm(i);this.addEdge(o.name,s[0].name,s.slice(1)),this.addExtension(s)}for(let[i,s]of o.peerDependencies||[])this.addEdge(o.name,i,s?[s]:[])}}sortedExtensionReps(){if(this._sortedExtensionReps)return this._sortedExtensionReps;let t=[],n=(o,r)=>{let a=o.state;if(aR(a))return;let i=o.extension.name;var s;kx(a)||Gt(300,i,r||"[unknown]"),kx(s=a)||Gt(304,String(s.id),String(Dx)),a=Object.assign(s,{id:Ex}),o.state=a;let l=this.outgoingConfigEdges.get(i);if(l)for(let d of l.keys()){let c=this.extensionNameMap.get(d);c&&n(c,i)}a=oV(a),o.state=a,t.push(o)};for(let o of this.extensionNameMap.values())kx(o.state)&&n(o);for(let o of t)for(let[r,a]of this.outgoingConfigEdges.get(o.extension.name)||[])if(a.length>0){let i=this.extensionNameMap.get(r);if(i)for(let s of a)i.configs.add(s)}for(let[o,...r]of this.roots)if(r.length>0){let a=this.extensionNameMap.get(o.name);a===void 0&&Gt(301,o.name);for(let i of r)a.configs.add(i)}return this._sortedExtensionReps=t,this._sortedExtensionReps}registerEditor(t){let n=this.sortedExtensionReps(),o=new AbortController,r=[()=>o.abort()],a=o.signal;for(let i of n){let s=i.register(t,a);s&&r.push(s)}for(let i of n){let s=i.afterRegistration(t);s&&r.push(s)}return ua(...r)}buildCreateEditorArgs(){let t={},n=new Set,o=new Map,r=new Map,a={},i={},s=this.sortedExtensionReps();for(let c of s){let{extension:f}=c;if(f.onError!==void 0&&(t.onError=f.onError),f.disableEvents!==void 0&&(t.disableEvents=f.disableEvents),f.parentEditor!==void 0&&(t.parentEditor=f.parentEditor),f.editable!==void 0&&(t.editable=f.editable),f.namespace!==void 0&&(t.namespace=f.namespace),f.$initialEditorState!==void 0&&(t.$initialEditorState=f.$initialEditorState),f.nodes)for(let p of tR(f)){if(typeof p!="function"){let m=o.get(p.replace);m&&Gt(302,f.name,p.replace.name,m.extension.name),o.set(p.replace,c)}n.add(p)}if(f.html){if(f.html.export)for(let[p,m]of f.html.export.entries())r.set(p,m);f.html.import&&Object.assign(a,f.html.import)}f.theme&&oR(i,f.theme)}Object.keys(i).length>0&&(t.theme=i),n.size&&(t.nodes=[...n]);let l=Object.keys(a).length>0,d=r.size>0;(l||d)&&(t.html={},l&&(t.html.import=a),d&&(t.html.export=r));for(let c of s)c.init(t);return t.onError||(t.onError=sV),t}};function lV(e,t){let n=cd.fromEditor(e).getExtensionRep(t);return n===void 0&&Gt(303,t.name),n.getExtensionDependency()}function sR(e,t){let n=cd.fromEditor(e).extensionNameMap.get(t);return n?n.getExtensionDependency():void 0}function dV(e,t){let n=sR(e,t);return n===void 0&&Gt(291,t),n}var cV=new Set,Mx=Rn({build(e,t,n){let o=n.getDependency(Ym).output,r=dd({watchedNodeKeys:new Map}),a=_x(()=>{},()=>Di(()=>{let i=a.peek(),{watchedNodeKeys:s}=r.value,l,d=!1;o.value.read(()=>{if(Ke())for(let[c,f]of s.entries()){if(f.size===0){s.delete(c);continue}let p=Cm(c),m=p&&p.isSelected()||!1;d=d||m!==(!!i&&i.has(c)),m&&(l=l||new Set,l.add(c))}}),!d&&l&&i&&l.size===i.size||(a.value=l)}));return{watchNodeKey:function(i){let s=YE(()=>(a.value||cV).has(i)),{watchedNodeKeys:l}=r.peek(),d=l.get(i),c=d!==void 0;return d=d||new Set,d.add(s),c||(l.set(i,d),r.value={watchedNodeKeys:l}),s}}},dependencies:[Ym],name:"@lexical/extension/NodeSelection"}),uV=eE("INSERT_HORIZONTAL_RULE_COMMAND"),zs=class e extends za{static getType(){return"horizontalrule"}static clone(t){return new e(t.__key)}static importJSON(t){return Ox().updateFromJSON(t)}static importDOM(){return{hr:()=>({conversion:fV,priority:0})}}exportDOM(){return{element:document.createElement("hr")}}createDOM(t){let n=document.createElement("hr");return mu(n,t.theme.hr),n}getTextContent(){return`
|
|
3784
|
+
`}isInline(){return!1}updateDOM(){return!1}};function fV(){return{node:Ox()}}function Ox(){return JP(zs)}function lR(e){return e instanceof zs}var pV=Rn({dependencies:[Ym,Mx],name:"@lexical/extension/HorizontalRule",nodes:()=>[zs],register(e,t,n){let{watchNodeKey:o}=n.getDependency(Mx).output,r=dd({nodeSelections:new Map}),a=e._config.theme.hrSelected??"selected";return ua(e.registerCommand(wA,i=>{if(sE(i.target)){let s=iA(i.target);if(lR(s))return(function(l,d=!1){let c=Ke(),f=l.isSelected(),p=l.getKey(),m;d&&tx(c)?m=c:(m=ZP(),Br(m)),f?m.delete(p):m.add(p)})(s,i.shiftKey),!0}return!1},id),e.registerMutationListener(zs,(i,s)=>{jE(()=>{let l=!1,{nodeSelections:d}=r.peek();for(let[c,f]of i.entries())if(f==="destroyed")d.delete(c),l=!0;else{let p=d.get(c),m=e.getElementByKey(c);p?p.domNode.value=m:(l=!0,d.set(c,{domNode:dd(m),selectedSignal:o(c)}))}l&&(r.value={nodeSelections:d})})}),Di(()=>{let i=[];for(let{domNode:s,selectedSignal:l}of r.value.nodeSelections.values())i.push(Di(()=>{let d=s.value;d&&(l.value?mu(d,a):Hm(d,a))}));return ua(...i)}))}});function dR(e){return e.canBeEmpty()}function cR(e,t,n=dR){return ua(e.registerCommand(Dm,o=>{let r=Ke();if(!Ne(r))return!1;o.preventDefault();let a=(function(i){if(i.getNodes().filter(p=>rd(p)&&p.canIndent()).length>0)return!0;let s=i.anchor,l=i.focus,d=l.isBefore(s)?l:s,c=d.getNode(),f=UE(c);if(f.canIndent()){let p=f.getKey(),m=Ds();if(m.anchor.set(p,0,"element"),m.focus.set(p,0,"element"),m=mA(m),m.anchor.is(d))return!0}return!1})(r)?o.shiftKey?$A:rx:DA;return e.dispatchCommand(a,void 0)},tn),e.registerCommand(rx,()=>{let o=typeof t=="number"?t:t?t.peek():null,r=Ke();if(!Ne(r))return!1;let a=typeof n=="function"?n:n.peek();return HE(i=>{if(a(i)){let s=i.getIndent()+1;(!o||s<o)&&i.setIndent(s)}})},Lm))}var mV=Rn({build:(e,t,n)=>Zm(t),config:zr({$canIndent:dR,disabled:!1,maxIndent:null}),name:"@lexical/extension/TabIndentation",register(e,t,n){let{disabled:o,maxIndent:r,$canIndent:a}=n.getOutput();return Di(()=>{if(!o.value)return cR(e,r,a)})}});var Lt=Fx,ode=Lt.$createHorizontalRuleNode,rde=Lt.$isDecoratorTextNode,ade=Lt.$isHorizontalRuleNode,ide=Lt.AutoFocusExtension,sde=Lt.ClearEditorExtension,lde=Lt.DecoratorTextExtension,dde=Lt.DecoratorTextNode,cde=Lt.EditorStateExtension,ude=Lt.HorizontalRuleExtension,fde=Lt.HorizontalRuleNode,pde=Lt.INSERT_HORIZONTAL_RULE_COMMAND,mde=Lt.InitialStateExtension,uR=Lt.LexicalBuilder,gde=Lt.NodeSelectionExtension,hde=Lt.TabIndentationExtension,vde=Lt.applyFormatFromStyle,yde=Lt.applyFormatToDom,fR=Lt.batch,xde=Lt.buildEditorFromExtensions,Cde=Lt.computed,bde=Lt.configExtension,wde=Lt.declarePeerDependency,Sde=Lt.defineExtension,Cu=Lt.effect,Ide=Lt.getExtensionDependencyFromEditor,Tde=Lt.getKnownTypesAndNodes,pR=Lt.getPeerDependencyFromEditor,kde=Lt.getPeerDependencyFromEditorOrThrow,eg=Lt.namedSignals,Lde=Lt.registerClearEditor,Pde=Lt.registerTabIndentation,Ade=Lt.safeCast,Ede=Lt.shallowMergeConfig,Rde=Lt.signal,Mde=Lt.untracked,Nde=Lt.watchedSignal;var Bx={};En(Bx,{HistoryExtension:()=>tg,SharedHistoryExtension:()=>vV,createEmptyHistoryState:()=>hR,registerHistory:()=>gR});function gV(e,t,n,o,r){if(e===null||n.size===0&&o.size===0&&!r)return 0;let a=t._selection,i=e._selection;if(r)return 1;if(!(Ne(a)&&Ne(i)&&i.isCollapsed()&&a.isCollapsed()))return 0;let s=(function(y,x,C){let w=y._nodeMap,L=[];for(let S of x){let k=w.get(S);k!==void 0&&L.push(k)}for(let[S,k]of C){if(!k)continue;let I=w.get(S);I===void 0||cu(I)||L.push(I)}return L})(t,n,o);if(s.length===0)return 0;if(s.length>1){let y=t._nodeMap,x=y.get(a.anchor.key),C=y.get(i.anchor.key);return x&&C&&!e._nodeMap.has(x.__key)&&dt(x)&&x.__text.length===1&&a.anchor.offset===1?2:0}let l=s[0],d=e._nodeMap.get(l.__key);if(!dt(d)||!dt(l)||d.__mode!==l.__mode)return 0;let c=d.__text,f=l.__text;if(c===f)return 0;let p=a.anchor,m=i.anchor;if(p.key!==m.key||p.type!=="text")return 0;let g=p.offset,h=m.offset,v=f.length-c.length;return v===1&&h===g-1?2:v===-1&&h===g+1?3:v===-1&&h===g?4:0}function hV(e,t){let n=Date.now(),o=0,r=Date.now(),a=0,i=null;return(s,l,d,c,f,p)=>{let m=Date.now();if(p.has(IA)&&(r=n,a=o,i=s),p.has(Em))return o=0,n=m,2;p.has(SA)&&i&&(n=r,o=a,s=i);let g=gV(s,l,c,f,e.isComposing()),h=(()=>{let v=d===null||d.editor===e,y=p.has(NA);if(!y&&v&&p.has(vr))return 0;if(g===1)return 2;if(s===null)return 1;let x=l._selection;if(!(c.size>0||f.size>0))return x!==null?0:2;let C=typeof t=="number"?t:t.peek();return y===!1&&g!==0&&g===o&&m<n+C&&v||c.size===1&&(function(w,L,S){let k=L._nodeMap.get(w),I=S._nodeMap.get(w),T=L._selection,A=S._selection;return!(Ne(T)&&Ne(A)&&T.anchor.type==="element"&&T.focus.type==="element"&&A.anchor.type==="text"&&A.focus.type==="text"||!dt(k)||!dt(I)||k.__parent!==I.__parent)&&JSON.stringify(L.read(()=>k.exportJSON()))===JSON.stringify(S.read(()=>I.exportJSON()))})(Array.from(c)[0],s,l)?0:1})();return n=m,o=g,h}}function mR(e){e.undoStack=[],e.redoStack=[],e.current=null}function gR(e,t,n){let o=hV(e,n);return Ua(e.registerCommand(ZA,()=>((function(a,i){let s=i.redoStack,l=i.undoStack;if(l.length!==0){let d=i.current,c=l.pop();d!==null&&(s.push(d),a.dispatchCommand(uu,!0)),l.length===0&&a.dispatchCommand(fu,!1),i.current=c||null,c&&c.editor.setEditorState(c.editorState,{tag:Em})}})(e,t),!0),tn),e.registerCommand(qA,()=>((function(a,i){let s=i.redoStack,l=i.undoStack;if(s.length!==0){let d=i.current;d!==null&&(l.push(d),a.dispatchCommand(fu,!0));let c=s.pop();s.length===0&&a.dispatchCommand(uu,!1),i.current=c||null,c&&c.editor.setEditorState(c.editorState,{tag:Em})}})(e,t),!0),tn),e.registerCommand(km,()=>(mR(t),!1),tn),e.registerCommand(bA,()=>(mR(t),e.dispatchCommand(uu,!1),e.dispatchCommand(fu,!1),!0),tn),e.registerUpdateListener(({editorState:a,prevEditorState:i,dirtyLeaves:s,dirtyElements:l,tags:d})=>{let c=t.current,f=t.redoStack,p=t.undoStack,m=c===null?null:c.editorState;if(c!==null&&a===m)return;let g=o(i,a,c,s,l,d);if(g===1)f.length!==0&&(t.redoStack=[],e.dispatchCommand(uu,!1)),c!==null&&(p.push({...c}),e.dispatchCommand(fu,!0));else if(g===2)return;t.current={editor:e,editorState:a}}))}function hR(){return{current:null,redoStack:[],undoStack:[]}}var tg=Rn({build:(e,{delay:t,createInitialHistoryState:n,disabled:o})=>eg({delay:t,disabled:o,historyState:n(e)}),config:zr({createInitialHistoryState:hR,delay:300,disabled:typeof window>"u"}),name:"@lexical/history/History",register:(e,t,n)=>{let o=n.getOutput();return Cu(()=>o.disabled.value?void 0:gR(e,o.historyState.value,o.delay))}}),vV=Rn({dependencies:[Bm(tg,{createInitialHistoryState:()=>{throw new Error("SharedHistory did not inherit parent history")},disabled:!0})],name:"@lexical/history/SharedHistory",register(e,t,n){let{output:o}=n.getDependency(tg),r=(function(i){return i?pR(i,tg.name):null})(e._parentEditor);if(!r)return()=>{};let a=r.output;return Cu(()=>fR(()=>{o.delay.value=a.delay.value,o.historyState.value=a.historyState.value,o.disabled.value=a.disabled.value}))}});var ng=Bx,Bde=ng.HistoryExtension,zde=ng.SharedHistoryExtension,og=ng.createEmptyHistoryState,vR=ng.registerHistory;var zx={};En(zx,{HistoryPlugin:()=>yV,createEmptyHistoryState:()=>og});ue();function yV({delay:e,externalHistoryState:t}){let[n]=Cn();return(function(o,r,a=1e3){let i=K(()=>r||og(),[r]);W(()=>vR(o,i,a),[a,o,i])})(n,t,e),null}var yR=zx,xR=yR.HistoryPlugin,CR=yR.createEmptyHistoryState;var ud=new Map,xV=32;function bR(e,t){for(ud.delete(e),ud.set(e,t);ud.size>xV;){let n=ud.keys().next().value;if(n===void 0)break;ud.delete(n)}}function CV(e){return{anchor:e.length,focus:e.length}}function Ha(e,t,n){let o=ud.get(e);if(o)return bR(e,o),o;let r={cursor:n?.cursor??t.length,expandedCursor:n?.expandedCursor??t.length,selection:n?{anchor:n.cursor,focus:n.cursor}:CV(t),history:CR()};return bR(e,r),r}function fd(e,t,n){let o=Ha(e,t);o.cursor=n.cursor,o.expandedCursor=n.expandedCursor,o.selection=n.selection}function wR(e,t,n,o){let r=Ha(e,t);r.cursor=n,r.expandedCursor=o}function SR(e,t){let n=e.current,o=[...e.undoStack],r=[...e.redoStack];t(),e.current=n,e.undoStack.splice(0,e.undoStack.length,...o),e.redoStack.splice(0,e.redoStack.length,...r)}var Ux={};En(Ux,{LexicalComposer:()=>wV});ue();var IR=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,bV=IR?he:W,rg={tag:vr};function wV({initialConfig:e,children:t}){let n=K(()=>{let{theme:o,namespace:r,nodes:a,onError:i,editorState:s,html:l}=e,d=Ik(null,o),c=zm({editable:e.editable,html:l,namespace:r,nodes:a,onError:f=>i(f,c),theme:o});return(function(f,p){if(p!==null){if(p===void 0)f.update(()=>{let m=At();if(m.isEmpty()){let g=gr();m.append(g);let h=IR?document.activeElement:null;(Ke()!==null||h!==null&&h===f.getRootElement())&&g.select()}},rg);else if(p!==null)switch(typeof p){case"string":{let m=f.parseEditorState(p);f.setEditorState(m,rg);break}case"object":f.setEditorState(p,rg);break;case"function":f.update(()=>{At().isEmpty()&&p(f)},rg)}}})(c,s),[c,d]},[]);return bV(()=>{let o=e.editable,[r]=n;r.setEditable(o===void 0||o)},[]),u(Sk.Provider,{value:n,children:t})}var SV=Ux,TR=SV.LexicalComposer;var $x={};En($x,{$canShowPlaceholder:()=>LR,$canShowPlaceholderCurry:()=>TV,$findTextIntersectionFromCharacters:()=>kV,$isRootTextContentEmpty:()=>Hx,$isRootTextContentEmptyCurry:()=>IV,$rootTextContent:()=>kR,registerLexicalTextEntity:()=>PV});function kR(){return At().getTextContent()}function Hx(e,t=!0){if(e)return!1;let n=kR();return t&&(n=n.trim()),n===""}function IV(e,t){return()=>Hx(e,t)}function LR(e){if(!Hx(e,!1))return!1;let t=At().getChildren(),n=t.length;if(n>1)return!1;for(let o=0;o<n;o++){let r=t[o];if(wm(r))return!1;if(je(r)){if(!uA(r)||r.__indent!==0)return!1;let a=r.getChildren(),i=a.length;for(let s=0;s<i;s++){let l=a[o];if(!dt(l))return!1}}}return!0}function TV(e){return()=>LR(e)}function kV(e,t){let n=e.getFirstChild(),o=0;e:for(;n!==null;){if(je(n)){let i=n.getFirstChild();if(i!==null){n=i;continue}}else if(dt(n)){let i=n.getTextContentSize();if(o+i>t)return{node:n,offset:t-o};o+=i}let r=n.getNextSibling();if(r!==null){n=r;continue}let a=n.getParent();for(;a!==null;){let i=a.getNextSibling();if(i!==null){n=i;continue e}a=a.getParent()}break}return null}function LV(e,...t){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(let r of t)o.append("v",r);throw n.search=o.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 PV(e,t,n,o){let r=i=>i instanceof n,a=i=>{let s=Fr(i.getTextContent());s.setFormat(i.getFormat()),i.replace(s)};return[e.registerNodeTransform(Fm,i=>{if(!i.isSimpleText())return;let s,l=i.getPreviousSibling(),d=i.getTextContent(),c=i;if(dt(l)){let p=l.getTextContent(),m=t(p+d);if(r(l)){if(m===null||(g=>g.getLatest().__mode)(l)!==0)return void a(l);{let g=m.end-p.length;if(g>0){let h=p+d.slice(0,g);if(l.select(),l.setTextContent(h),g===d.length)i.remove();else{let v=d.slice(g);i.setTextContent(v)}return}}}else if(m===null||m.start<p.length)return}let f=0;for(;;){s=t(d);let p,m=s===null?"":d.slice(s.end);if(d=m,m===""){let h=c.getNextSibling();if(dt(h)){m=c.getTextContent()+h.getTextContent();let v=t(m);if(v===null)return void(r(h)?a(h):h.markDirty());if(v.start!==0)return}}if(s===null)return;if(s.start===0&&dt(l)&&l.isTextEntity()){f+=s.end;continue}s.start===0?[p,c]=c.splitText(s.end):[,p,c]=c.splitText(s.start+f,s.end+f),p===void 0&&LV(165,"nodeToReplace");let g=o(p);if(g.setFormat(p.getFormat()),p.replace(g),c==null)return;f=0,l=g}}),e.registerNodeTransform(n,i=>{let s=i.getTextContent(),l=t(s);if(l===null||l.start!==0)return void a(i);if(s.length>l.end)return void i.splitText(l.end);let d=i.getPreviousSibling();dt(d)&&d.isTextEntity()&&(a(d),a(i));let c=i.getNextSibling();dt(c)&&c.isTextEntity()&&(a(c),r(i)&&a(i))})]}var Us=$x,ece=Us.$canShowPlaceholder,ag=Us.$canShowPlaceholderCurry,tce=Us.$findTextIntersectionFromCharacters,nce=Us.$isRootTextContentEmpty,oce=Us.$isRootTextContentEmptyCurry,rce=Us.$rootTextContent,ace=Us.registerLexicalTextEntity;var Kx={};En(Kx,{ContentEditable:()=>EV,ContentEditableElement:()=>ER});ue();var AR=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?he:W;function AV({editor:e,ariaActiveDescendant:t,ariaAutoComplete:n,ariaControls:o,ariaDescribedBy:r,ariaErrorMessage:a,ariaExpanded:i,ariaInvalid:s,ariaLabel:l,ariaLabelledBy:d,ariaMultiline:c,ariaOwns:f,ariaRequired:p,autoCapitalize:m,className:g,id:h,role:v="textbox",spellCheck:y=!0,style:x,tabIndex:C,"data-testid":w,...L},S){let[k,I]=J(e.isEditable()),T=R(P=>{P&&P.ownerDocument&&P.ownerDocument.defaultView?e.setRootElement(P):e.setRootElement(null)},[e]),A=K(()=>(function(...P){return _=>{for(let E of P)typeof E=="function"?E(_):E!=null&&(E.current=_)}})(S,T),[T,S]);return AR(()=>(I(e.isEditable()),e.registerEditableListener(P=>{I(P)})),[e]),u("div",{"aria-activedescendant":k?t:void 0,"aria-autocomplete":k?n:"none","aria-controls":k?o:void 0,"aria-describedby":r,...a!=null?{"aria-errormessage":a}:{},"aria-expanded":k&&v==="combobox"?!!i:void 0,...s!=null?{"aria-invalid":s}:{},"aria-label":l,"aria-labelledby":d,"aria-multiline":c,"aria-owns":k?f:void 0,"aria-readonly":!k||void 0,"aria-required":p,autoCapitalize:m,className:g,contentEditable:k,"data-testid":w,id:h,ref:A,role:v,spellCheck:y,style:x,tabIndex:C,...L})}var ER=zn(AV);function PR(e){return e.getEditorState().read(ag(e.isComposing()))}var EV=zn(RV);function RV(e,t){let{placeholder:n,...o}=e,[r]=Cn();return b(Pe,{children:[u(ER,{editor:r,...o,ref:t}),n!=null&&u(MV,{editor:r,content:n})]})}function MV({content:e,editor:t}){let n=(function(i){let[s,l]=J(()=>PR(i));return AR(()=>{function d(){let c=PR(i);l(c)}return d(),Ua(i.registerUpdateListener(()=>{d()}),i.registerEditableListener(()=>{d()}))},[i]),s})(t),[o,r]=J(t.isEditable());if(he(()=>(r(t.isEditable()),t.registerEditableListener(i=>{r(i)})),[t]),!n)return null;let a=null;return typeof e=="function"?a=e(o):e!==null&&(a=e),a===null?null:u("div",{"aria-hidden":!0,children:a})}var RR=Kx,MR=RR.ContentEditable,fce=RR.ContentEditableElement;ue();var NV=bt(null),Vx={didCatch:!1,error:null},ig=class extends wa{constructor(t){super(t),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=Vx}static getDerivedStateFromError(t){return{didCatch:!0,error:t}}resetErrorBoundary(...t){let{error:n}=this.state;n!==null&&(this.props.onReset?.({args:t,reason:"imperative-api"}),this.setState(Vx))}componentDidCatch(t,n){this.props.onError?.(t,n)}componentDidUpdate(t,n){let{didCatch:o}=this.state,{resetKeys:r}=this.props;o&&n.error!==null&&_V(t.resetKeys,r)&&(this.props.onReset?.({next:r,prev:t.resetKeys,reason:"keys"}),this.setState(Vx))}render(){let{children:t,fallbackRender:n,FallbackComponent:o,fallback:r}=this.props,{didCatch:a,error:i}=this.state,s=t;if(a){let l={error:i,resetErrorBoundary:this.resetErrorBoundary};if(typeof n=="function")s=n(l);else if(o)s=De(o,l);else if(r!==void 0)s=r;else throw i}return De(NV.Provider,{value:{didCatch:a,error:i,resetErrorBoundary:this.resetErrorBoundary}},s)}};function _V(e=[],t=[]){return e.length!==t.length||e.some((n,o)=>!Object.is(n,t[o]))}var qx={};En(qx,{LexicalErrorBoundary:()=>DV});function DV({children:e,onError:t}){return u(ig,{fallback:u("div",{style:{border:"1px solid #f00",color:"#f00",padding:"8px"},children:"An error was thrown."}),onError:t,children:e})}var OV=qx,NR=OV.LexicalErrorBoundary;var Wx={};En(Wx,{OnChangePlugin:()=>BV});ue();var FV=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?he:W;function BV({ignoreHistoryMergeTagChange:e=!0,ignoreSelectionChange:t=!1,onChange:n}){let[o]=Cn();return FV(()=>{if(n)return o.registerUpdateListener(({editorState:r,dirtyElements:a,dirtyLeaves:i,prevEditorState:s,tags:l})=>{t&&a.size===0&&i.size===0||e&&l.has(vr)||s.isEmpty()||n(r,o,l)})},[o,e,t,n]),null}var zV=Wx,_R=zV.OnChangePlugin;var Gx={};En(Gx,{useLexicalEditable:()=>$V});ue();var UV=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?he:W;function HV(e){return{initialValueFn:()=>e.isEditable(),subscribe:t=>e.registerEditableListener(t)}}function $V(){return(function(e){let[t]=Cn(),n=K(()=>e(t),[t,e]),[o,r]=J(()=>n.initialValueFn()),a=N(o);return UV(()=>{let{initialValueFn:i,subscribe:s}=n,l=i();return a.current!==l&&(a.current=l,r(l)),s(d=>{a.current=d,r(d)})},[n,e]),o})(HV)}var KV=Gx,DR=KV.useLexicalEditable;var jx={};En(jx,{ReactProviderExtension:()=>VV});var VV=Rn({name:"@lexical/react/ReactProvider"});var qV=jx,OR=qV.ReactProviderExtension;var Qx={};En(Qx,{DragonExtension:()=>WV,registerDragonSupport:()=>FR});function FR(e){let t=window.location.origin,n=o=>{if(o.origin!==t)return;let r=e.getRootElement();if(document.activeElement!==r)return;let a=o.data;if(typeof a=="string"){let i;try{i=JSON.parse(a)}catch{return}if(i&&i.protocol==="nuanria_messaging"&&i.type==="request"){let s=i.payload;if(s&&s.functionId==="makeChanges"){let l=s.args;if(l){let[d,c,f,p,m]=l;e.update(()=>{let g=Ke();if(Ne(g)){let h=g.anchor,v=h.getNode(),y=0,x=0;if(dt(v)&&d>=0&&c>=0&&(y=d,x=d+c,g.setTextNodeRange(v,y,v,x)),y===x&&f===""||(g.insertRawText(f),v=h.getNode()),dt(v)){y=p,x=p+m;let C=v.getTextContentSize();y=y>C?C:y,x=x>C?C:x,g.setTextNodeRange(v,y,v,x)}o.stopImmediatePropagation()}})}}}}};return window.addEventListener("message",n,!0),()=>{window.removeEventListener("message",n,!0)}}var WV=Rn({build:(e,t,n)=>eg(t),config:zr({disabled:typeof window>"u"}),name:"@lexical/dragon",register:(e,t,n)=>Cu(()=>n.getOutput().disabled.value?void 0:FR(e))});var BR=Qx,zR=BR.DragonExtension,UR=BR.registerDragonSupport;var Xx={};En(Xx,{$generateHtmlFromNodes:()=>jV,$generateNodesFromDOM:()=>GV});function GV(e,t){let n=iE(t)?t.body.childNodes:t.childNodes,o=[],r=[];for(let a of n)if(!$R.has(a.nodeName)){let i=KR(a,e,r,!1);i!==null&&(o=o.concat(i))}return(function(a){for(let i of a)i.getNextSibling()instanceof ox&&i.insertAfter(_s());for(let i of a){let s=i.getChildren();for(let l of s)i.insertBefore(l);i.remove()}})(r),o}function jV(e,t){if(typeof document>"u"||typeof window>"u"&&global.window===void 0)throw new Error("To use $generateHtmlFromNodes in headless mode please initialize a headless browser implementation such as JSDom before calling this function.");let n=document.createElement("div"),o=At().getChildren();for(let r=0;r<o.length;r++)HR(e,o[r],n,t);return n.innerHTML}function HR(e,t,n,o=null){let r=o===null||t.isSelected(o),a=je(t)&&t.excludeFromCopy("html"),i=t;o!==null&&dt(t)&&(i=Wm(o,t,"clone"));let s=je(i)?i.getChildren():[],l=rE(e,i.getType()),d;d=l&&l.exportDOM!==void 0?l.exportDOM(e,i):i.exportDOM(e);let{element:c,after:f}=d;if(!c)return!1;let p=document.createDocumentFragment();for(let m=0;m<s.length;m++){let g=s[m],h=HR(e,g,p,o);!r&&je(t)&&h&&t.extractWithChild(g,o,"html")&&(r=!0)}if(r&&!a){if(($E(c)||sx(c))&&c.append(p),n.append(c),f){let m=f.call(i,c);m&&(sx(c)?c.replaceChildren(m):c.replaceWith(m))}}else n.append(p);return r}var $R=new Set(["STYLE","SCRIPT"]);function KR(e,t,n,o,r=new Map,a){let i=[];if($R.has(e.nodeName))return i;let s=null,l=(function(g,h){let{nodeName:v}=g,y=h._htmlConversions.get(v.toLowerCase()),x=null;if(y!==void 0)for(let C of y){let w=C(g);w!==null&&(x===null||(x.priority||0)<=(w.priority||0))&&(x=w)}return x!==null?x.conversion:null})(e,t),d=l?l(e):null,c=null;if(d!==null){c=d.after;let g=d.node;if(s=Array.isArray(g)?g[g.length-1]:g,s!==null){for(let[,h]of r)if(s=h(s,a),!s)break;s&&i.push(...Array.isArray(g)?g:[s])}d.forChild!=null&&r.set(e.nodeName,d.forChild)}let f=e.childNodes,p=[],m=(s==null||!Fs(s))&&(s!=null&&rd(s)||o);for(let g=0;g<f.length;g++)p.push(...KR(f[g],t,n,m,new Map(r),s));return c!=null&&(p=c(p)),wx(e)&&(p=QV(e,p,m?()=>{let g=new ox;return n.push(g),g}:gr)),s==null?p.length>0?i=i.concat(p):wx(e)&&(function(g){return g.nextSibling==null||g.previousSibling==null?!1:gu(g.nextSibling)&&gu(g.previousSibling)})(e)&&(i=i.concat(_s())):je(s)&&s.append(...p),i}function QV(e,t,n){let o=e.style.textAlign,r=[],a=[];for(let i=0;i<t.length;i++){let s=t[i];if(rd(s))o&&!s.getFormat()&&s.setFormat(o),r.push(s);else if(a.push(s),i===t.length-1||i<t.length-1&&rd(t[i+1])){let l=n();l.setFormat(o),l.append(...a),r.push(l),a=[]}}return r}var VR=Xx,qR=VR.$generateHtmlFromNodes,WR=VR.$generateNodesFromDOM;var Jx={};En(Jx,{$generateJSONFromSelectedNodes:()=>YR,$generateNodesFromSerializedNodes:()=>JR,$getClipboardDataFromSelection:()=>eM,$getHtmlContent:()=>jR,$getLexicalContent:()=>QR,$insertDataTransferForPlainText:()=>XV,$insertDataTransferForRichText:()=>YV,$insertGeneratedNodes:()=>Yx,copyToClipboard:()=>JV,setLexicalClipboardDataTransfer:()=>tM});function sg(e,...t){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(let r of t)o.append("v",r);throw n.search=o.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 jR(e,t=Ke()){return t==null&&sg(166),Ne(t)&&t.isCollapsed()||t.getNodes().length===0?"":qR(e,t)}function QR(e,t=Ke()){return t==null&&sg(166),Ne(t)&&t.isCollapsed()||t.getNodes().length===0?null:JSON.stringify(YR(e,t))}function XV(e,t){let n=e.getData("text/plain")||e.getData("text/uri-list");n!=null&&t.insertRawText(n)}function YV(e,t,n){let o=e.getData("application/x-lexical-editor");if(o)try{let s=JSON.parse(o);if(s.namespace===n._config.namespace&&Array.isArray(s.nodes))return Yx(n,JR(s.nodes),t)}catch(s){console.error(s)}let r=e.getData("text/html"),a=e.getData("text/plain");if(r&&a!==r)try{let s=new DOMParser().parseFromString((function(l){return window.trustedTypes&&window.trustedTypes.createPolicy?window.trustedTypes.createPolicy("lexical",{createHTML:d=>d}).createHTML(l):l})(r),"text/html");return Yx(n,WR(n,s),t)}catch(s){console.error(s)}let i=a||e.getData("text/uri-list");if(i!=null)if(Ne(t)){let s=i.split(/(\r?\n|\t)/);s[s.length-1]===""&&s.pop();for(let l=0;l<s.length;l++){let d=Ke();if(Ne(d)){let c=s[l];c===`
|
|
3785
3785
|
`||c===`\r
|
|
3786
|
-
`?d.insertParagraph():c===" "?d.insertNodes([
|
|
3786
|
+
`?d.insertParagraph():c===" "?d.insertNodes([tA()]):d.insertText(c)}}}else t.insertRawText(i)}function Yx(e,t,n){e.dispatchCommand(jA,{nodes:t,selection:n})||(n.insertNodes(t),(function(o){if(Ne(o)&&o.isCollapsed()){let r=o.anchor,a=null,i=od(r,"previous");if(i)if(Sm(i))a=i.origin;else{let s=oA(i,Ni(At(),"next").getFlipped());for(let l of s){if(dt(l.origin)){a=l.origin;break}if(je(l.origin)&&!l.origin.isInline())break}}if(a&&dt(a)){let s=a.getFormat(),l=a.getStyle();o.format===s&&o.style===l||(o.format=s,o.style=l,o.dirty=!0)}}})(n))}function XR(e,t,n,o=[]){let r=t===null||n.isSelected(t),a=je(n)&&n.excludeFromCopy("html"),i=n;t!==null&&dt(i)&&(i=Wm(t,i,"clone"));let s=je(i)?i.getChildren():[],l=(function(d){let c=d.exportJSON(),f=d.constructor;if(c.type!==f.getType()&&sg(58,f.name),je(d)){let p=c.children;Array.isArray(p)||sg(59,f.name)}return c})(i);dt(i)&&i.getTextContentSize()===0&&(r=!1);for(let d=0;d<s.length;d++){let c=s[d],f=XR(e,t,c,l.children);!r&&je(n)&&f&&n.extractWithChild(c,t,"clone")&&(r=!0)}if(r&&!a)o.push(l);else if(Array.isArray(l.children))for(let d=0;d<l.children.length;d++){let c=l.children[d];o.push(c)}return r}function YR(e,t){let n=[],o=At().getChildren();for(let r=0;r<o.length;r++)XR(e,t,o[r],n);return{namespace:e._config.namespace,nodes:n}}function JR(e){let t=[];for(let n=0;n<e.length;n++){let o=e[n],r=gA(o);dt(r)&&wE(r),t.push(r)}return t}var pd=null;async function JV(e,t,n){if(pd!==null)return!1;if(t!==null)return new Promise((d,c)=>{e.update(()=>{d(GR(e,t,n))})});let o=e.getRootElement(),r=e._window||window,a=r.document,i=ix(r);if(o===null||i===null)return!1;let s=a.createElement("span");s.style.cssText="position: fixed; top: -1000px;",s.append(a.createTextNode("#")),o.append(s);let l=new Range;return l.setStart(s,0),l.setEnd(s,1),i.removeAllRanges(),i.addRange(l),new Promise((d,c)=>{let f=e.registerCommand(Pm,p=>(hu(p,ClipboardEvent)&&(f(),pd!==null&&(r.clearTimeout(pd),pd=null),d(GR(e,p,n))),!0),Lm);pd=r.setTimeout(()=>{f(),pd=null,d(!1)},50),a.execCommand("copy"),s.remove()})}function GR(e,t,n){if(n===void 0){let r=ix(e._window),a=Ke();if(!a||a.isCollapsed()||!r)return!1;let i=r.anchorNode,s=r.focusNode;if(i!==null&&s!==null&&!dE(e,i,s))return!1;n=eM(a)}t.preventDefault();let o=t.clipboardData;return o!==null&&(tM(o,n),!0)}var ZR=[["text/html",jR],["application/x-lexical-editor",QR]];function eM(e=Ke()){let t={"text/plain":e?e.getTextContent():""};if(e){let n=xm();for(let[o,r]of ZR){let a=r(n,e);a!==null&&(t[o]=a)}}return t}function tM(e,t){for(let[n]of ZR)t[n]===void 0&&e.setData(n,"");for(let n in t){let o=t[n];o!==void 0&&e.setData(n,o)}}var pa=Jx,zce=pa.$generateJSONFromSelectedNodes,Uce=pa.$generateNodesFromSerializedNodes,Hce=pa.$getClipboardDataFromSelection,nM=pa.$getHtmlContent,$ce=pa.$getLexicalContent,Zx=pa.$insertDataTransferForPlainText,Kce=pa.$insertDataTransferForRichText,Vce=pa.$insertGeneratedNodes,qce=pa.copyToClipboard,Wce=pa.setLexicalClipboardDataTransfer;var eC={};En(eC,{PlainTextExtension:()=>aq,registerPlainText:()=>aM});var Hs=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,ZV=Hs&&"documentMode"in document?document.documentMode:null,eq=Hs&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),tq=!(!Hs||!("InputEvent"in window)||ZV)&&"getTargetRanges"in new window.InputEvent("input"),nq=Hs&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),oM=Hs&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,oq=Hs&&/^(?=.*Chrome).*/i.test(navigator.userAgent),rq=Hs&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&eq&&!oq;function rM(e,t){t.update(()=>{if(e!==null){let n=hu(e,KeyboardEvent)?null:e.clipboardData,o=Ke();if(o!==null&&!o.isCollapsed()&&n!=null){e.preventDefault();let r=nM(t);r!==null&&n.setData("text/html",r),n.setData("text/plain",o.getTextContent())}}})}function aM(e){return Ua(e.registerCommand(Am,t=>{let n=Ke();return!!Ne(n)&&(n.deleteCharacter(t),!0)},tn),e.registerCommand(PA,t=>{let n=Ke();return!!Ne(n)&&(n.deleteWord(t),!0)},tn),e.registerCommand(LA,t=>{let n=Ke();return!!Ne(n)&&(n.deleteLine(t),!0)},tn),e.registerCommand(TA,t=>{let n=Ke();if(!Ne(n))return!1;if(typeof t=="string")n.insertText(t);else{let o=t.dataTransfer;if(o!=null)Zx(o,n);else{let r=t.data;r&&n.insertText(r)}}return!0},tn),e.registerCommand(WA,()=>{let t=Ke();return!!Ne(t)&&(t.removeText(),!0)},tn),e.registerCommand(ax,t=>{let n=Ke();return!!Ne(n)&&(n.insertLineBreak(t),!0)},tn),e.registerCommand(_A,()=>{let t=Ke();return!!Ne(t)&&(t.insertLineBreak(),!0)},tn),e.registerCommand(Rm,t=>{let n=Ke();if(!Ne(n))return!1;let o=t,r=o.shiftKey;return!!vx(n,!0)&&(o.preventDefault(),hx(n,r,!0),!0)},tn),e.registerCommand(Mm,t=>{let n=Ke();if(!Ne(n))return!1;let o=t,r=o.shiftKey;return!!vx(n,!1)&&(o.preventDefault(),hx(n,r,!1),!0)},tn),e.registerCommand(Nm,t=>{let n=Ke();return!!Ne(n)&&(!oM||navigator.language!=="ko-KR")&&(t.preventDefault(),e.dispatchCommand(Am,!0))},tn),e.registerCommand(BA,t=>{let n=Ke();return!!Ne(n)&&(t.preventDefault(),e.dispatchCommand(Am,!1))},tn),e.registerCommand(_m,t=>{let n=Ke();if(!Ne(n))return!1;if(t!==null){if((oM||nq||rq)&&tq)return!1;t.preventDefault()}return e.dispatchCommand(ax,!1)},tn),e.registerCommand(QA,()=>(Im(),!0),tn),e.registerCommand(Pm,t=>{let n=Ke();return!!Ne(n)&&(rM(t,e),!0)},tn),e.registerCommand(kA,t=>{let n=Ke();return!!Ne(n)&&((function(o,r){rM(o,r),r.update(()=>{let a=Ke();Ne(a)&&a.removeText()})})(t,e),!0)},tn),e.registerCommand(Om,t=>{let n=Ke();return!!Ne(n)&&((function(o,r){o.preventDefault(),r.update(()=>{let a=Ke(),i=hu(o,ClipboardEvent)?o.clipboardData:null;i!=null&&Ne(a)&&Zx(i,a)},{tag:KA})})(t,e),!0)},tn),e.registerCommand(EA,t=>{let n=Ke();return!!Ne(n)&&(t.preventDefault(),!0)},tn),e.registerCommand(AA,t=>{let n=Ke();return!!Ne(n)&&(t.preventDefault(),!0)},tn))}var aq=Rn({conflictsWith:["@lexical/rich-text"],dependencies:[zR],name:"@lexical/plain-text",register:aM});var iM=eC,Zce=iM.PlainTextExtension,sM=iM.registerPlainText;var nC={};En(nC,{PlainTextPlugin:()=>dq});ue();var lg=Rd(Sc(),1);function iq(e,...t){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(let r of t)o.append("v",r);throw n.search=o.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.`)}var tC=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?he:W;function sq({editor:e,ErrorBoundary:t}){return(function(n,o){let[r,a]=J(()=>n.getDecorators());return tC(()=>n.registerDecoratorListener(i=>{(0,lg.flushSync)(()=>{a(i)})}),[n]),W(()=>{a(n.getDecorators())},[n]),K(()=>{let i=[],s=Object.keys(r);for(let l=0;l<s.length;l++){let d=s[l],c=u(o,{onError:p=>n._onError(p),children:u(ph,{fallback:null,children:r[d]})}),f=n.getElementByKey(d);f!==null&&i.push((0,lg.createPortal)(c,f,d))}return i},[o,r,n])})(e,t)}function lq({editor:e,ErrorBoundary:t}){return(function(n){let o=uR.maybeFromEditor(n);if(o&&o.hasExtensionByName(OR.name)){for(let r of["@lexical/plain-text","@lexical/rich-text"])o.hasExtensionByName(r)&&iq(320,r);return!0}return!1})(e)?null:u(sq,{editor:e,ErrorBoundary:t})}function lM(e){return e.getEditorState().read(ag(e.isComposing()))}function dq({contentEditable:e,placeholder:t=null,ErrorBoundary:n}){let[o]=Cn();return(function(r){tC(()=>Ua(sM(r),UR(r)),[r])})(o),b(Pe,{children:[e,u(cq,{content:t}),u(lq,{editor:o,ErrorBoundary:n})]})}function cq({content:e}){let[t]=Cn(),n=(function(r){let[a,i]=J(()=>lM(r));return tC(()=>{function s(){let l=lM(r);i(l)}return s(),Ua(r.registerUpdateListener(()=>{s()}),r.registerEditableListener(()=>{s()}))},[r]),a})(t),o=DR();return n?typeof e=="function"?e(o):e:null}var uq=nC,dM=uq.PlainTextPlugin;function fq(e){let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t>=0?e.slice(t+1):e}function pq(e){return e.replaceAll("\\","\\\\").replaceAll("[","\\[").replaceAll("]","\\]")}function mq(e){return encodeURI(e).replaceAll("(","%28").replaceAll(")","%29").replaceAll("#","%23").replaceAll("?","%3F").replaceAll("\\","%5C")}function bu(e){return`[${pq(fq(e))}](${mq(e)})`}ue();function cM(e){return/mac|iphone|ipad|ipod/i.test(e)}function wu(){let e=globalThis.crypto.getRandomValues(new Uint8Array(16));e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t="";for(let n of e)t+=n.toString(16).padStart(2,"0");return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}function oC(e){let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t===-1?e:e.slice(t+1)}function uM(e){let t=oC(e);return t.startsWith(".")&&!t.slice(1).includes(".")?"directory":t.includes(".")?"file":"directory"}var fM=Ci;function pM(e){return b(Pe,{children:[u(Rp,{pathValue:e.path,kind:uM(e.path),theme:e.theme,className:aa}),u("span",{className:e.selectable?ik:ia,children:e.label})]})}function mM(e){let{label:t,tooltipText:n,expired:o=!1}=e;return b(Ye,{children:[u(Ze,{render:b("span",{className:$(Ci,o&&"border-destructive/35 bg-destructive/8 text-destructive"),"data-terminal-context-expired":o?"true":void 0,children:[u(Vo,{className:$(aa,"size-icon-1",o&&"opacity-100")}),u("span",{className:ia,children:t})]})}),u(Je,{side:"top",className:"max-w-80 whitespace-pre-wrap leading-tight",children:n})]})}function gM({context:e}){let{t}=Ce(),n=VT(e,t),o=KT(e),r=o?t("pendingContext.terminalExpired",{label:n}):e.text;return u(mM,{label:n,tooltipText:r,expired:o})}function hM(e,t){return e.registerCommand(Om,n=>{if(!(n instanceof ClipboardEvent)||n.clipboardData===null||n.clipboardData.files.length>0)return!1;let o=n.clipboardData.getData("text/plain");if(o.length===0)return!1;let r=Nc(`${o}
|
|
3787
3787
|
`).filter(c=>c.type==="mention"&&c.end<=o.length);if(r.length===0)return!1;let a=Ke();if(!Ne(a))return!1;let i=[],s=c=>{let f=c.split(`
|
|
3788
|
-
`);for(let p=0;p<f.length;p+=1){let m=f[p]??"";m.length>0&&i.push(
|
|
3789
|
-
`);for(let o=0;o<n.length;o+=1){let r=n[o]??"";r.length>0&&e.append(Br(r)),o<n.length-1&&e.append(Os())}}function dC(e,t,n){let o=At();o.clear();let r=hr();o.append(r);let a=Is(e,t);for(let i of a){if(i.type==="mention"){r.append(lC(i.path,i.source));continue}if(i.type==="skill"){let s=n.get(i.name);r.append(bM(i.name,s?.label??sa({name:i.name}),s?.description??null));continue}if(i.type==="terminal-context"){i.context&&r.append(wM(i.context));continue}Tq(r,i.text)}}function sC(e){return e instanceof Vs?[e.__context.id]:je(e)?e.getChildren().flatMap(t=>sC(t)):[]}function kq(e){let[t]=Cn();return W(()=>{let n=(l,d)=>{if(!e.onCommandKeyDown||!d)return!1;if(l==="Enter"&&(d.isComposing||d.keyCode===229))return d.stopPropagation(),!0;let c=e.onCommandKeyDown(l,d);return c&&(d.preventDefault(),d.stopPropagation()),c},o=t.registerCommand(_A,l=>n("ArrowDown",l),vr),r=t.registerCommand(DA,l=>n("ArrowUp",l),vr),a=t.registerCommand(Dm,l=>n("Enter",l),vr),i=t.registerCommand(Om,l=>n("Tab",l),vr),s=t.registerCommand(BA,l=>n("Escape",l),vr);return()=>{o(),r(),a(),i(),s()}},[t,e]),null}function Lq(){let[e]=Cn();return W(()=>{let t=e.registerCommand(Mm,o=>{let r=null;if(e.getEditorState().read(()=>{let i=Ke();if(!Ne(i)||!i.isCollapsed())return;let s=Pu(0);if(s<=0)return;let l=At().getTextContent();Dc(l,s,"left")&&(r=s-1)}),r===null)return!1;let a=r;return o?.preventDefault(),o?.stopPropagation(),e.update(()=>{qs(a)}),!0},vr),n=e.registerCommand(Nm,o=>{let r=null;if(e.getEditorState().read(()=>{let i=Ke();if(!Ne(i)||!i.isCollapsed())return;let s=Pu(0),l=hg();if(s>=l)return;let d=At().getTextContent();Dc(d,s,"right")&&(r=s+1)}),r===null)return!1;let a=r;return o?.preventDefault(),o?.stopPropagation(),e.update(()=>{qs(a)}),!0},vr);return()=>{t(),n()}},[e]),null}function Pq(){let[e]=Cn();return W(()=>e.registerCommand(FA,t=>{if(!lM(navigator.platform)||t.key!=="Home"&&t.key!=="End"||t.altKey||t.metaKey||t.ctrlKey||t.isComposing)return!1;let n=e.getRootElement(),o=window.getSelection(),r=o?.anchorNode;return!n||!o||!r||!n.contains(r)||o.rangeCount===0||typeof o.modify!="function"?!1:(t.preventDefault(),t.stopPropagation(),o.modify(t.shiftKey?"extend":"move",t.key==="Home"?"backward":"forward","lineboundary"),e.update(()=>{zr(JP(o,e))}),!0)},vr),[e]),null}function Aq(){let[e]=Cn();return W(()=>e.registerUpdateListener(({editorState:t})=>{let n=null;t.read(()=>{let o=Ke();if(!Ne(o)||!o.isCollapsed())return;let r=o.anchor.getNode();if(!Fi(r)||o.anchor.offset===0)return;n=Lu(r,0)+1}),n!==null&&queueMicrotask(()=>{e.update(()=>{qs(n)})})}),[e]),null}function Eq(){let[e]=Cn(),{onRemoveTerminalContext:t}=bt(CM);return W(()=>e.registerCommand(_m,n=>{let o=Ke();if(!Ne(o)||!o.isCollapsed())return!1;let r=o.anchor.getNode(),a=Pu(0),i=s=>{if(!Fi(s))return!1;let l=Lu(s,0);return s.remove(),s instanceof Vs?(t(s.__context.id),qs(a)):qs(l),n?.preventDefault(),!0};if(i(r))return!0;if(dt(r)){if(o.anchor.offset>0)return!1;if(i(r.getPreviousSibling()))return!0;let s=r.getParent();if(je(s)){let l=r.getIndexWithinParent();if(l>0&&i(s.getChildAtIndex(l-1)))return!0}return!1}if(je(r)){let s=o.anchor.offset-1;if(s>=0&&i(r.getChildAtIndex(s)))return!0}return!1},vr),[e,t]),null}function Rq(){let[e]=Cn();return W(()=>{let t=new Set,n=e.getRootElement()===document.activeElement,o=l=>{for(let d of t)l.has(d)||e.getElementByKey(d)?.removeAttribute("data-composer-chip-selected");for(let d of l)e.getElementByKey(d)?.setAttribute("data-composer-chip-selected","true");t=l},r=()=>{let l=new Set;return e.getEditorState().read(()=>{let d=Ke();if(Ne(d)&&!d.isCollapsed())for(let c of d.getNodes())c instanceof Ua&&l.add(c.getKey())}),l},a=e.registerUpdateListener(()=>{o(n?r():new Set)}),i=e.registerCommand(AA,()=>(n=!0,o(r()),!1),sd),s=e.registerCommand(yA,()=>(n=!1,o(new Set),!1),sd);return()=>{a(),i(),s()}},[e]),null}function Mq(){let[e]=Cn();return W(()=>mM(e,{createMentionNode:lC,getExpandedAbsoluteOffsetForPoint:mg}),[e]),null}function Nq(e){let[t]=Cn(),n=N(e.terminalContexts),o=N(Tu(e.skills)),r=N(null),a=N(null);W(()=>{n.current=e.terminalContexts},[e.terminalContexts]),W(()=>{o.current=Tu(e.skills)},[e.skills]);let i=hh(s=>{let l=xM.get(s),d=r.current;if(!l)return r.current=null,!1;let c=!1;return t.update(()=>{let f=d??(()=>{let h=Ke();if(!Ne(h)||h.isCollapsed()||vM(h))return null;let v=hM(h);if(!v||v.start===v.end)return null;let y=At().getTextContent();return yv(y,v.start,v.end)?null:{value:y,expandedStart:v.start,expandedEnd:v.end}})();if(!f||!l)return;let p=f.value.slice(f.expandedStart,f.expandedEnd),m=`${f.value.slice(0,f.expandedStart)}${s}${p}${l}${f.value.slice(f.expandedEnd)}`;dC(m,n.current,o.current);let g=bo(m,f.expandedStart);ug(g+s.length,g+s.length+p.length),c=!0,r.current=null}),c});return W(()=>{let s=g=>{if(a.current){if(g.key==="Dead"||g.key===" "||g.code==="Space")return;a.current=null}if(g.defaultPrevented||g.isComposing||g.metaKey||g.ctrlKey){r.current=null,a.current=null;return}t.getEditorState().read(()=>{let h=Ke();if(!Ne(h)||h.isCollapsed()){r.current=null,a.current=null;return}if(vM(h)){r.current=null,a.current=null;return}let v=hM(h);if(!v||v.start===v.end){r.current=null,a.current=null;return}let y=At().getTextContent();if(yv(y,v.start,v.end)){r.current=null,a.current=null;return}let x={value:y,expandedStart:v.start,expandedEnd:v.end};r.current=x,a.current=null})},l=g=>{if(g.inputType==="insertCompositionText"&&g.data==="`"&&gM!==null&&r.current){a.current=r.current;return}if(a.current||g.inputType==="insertCompositionText")return;if(typeof g.data!="string"){r.current=null;return}let h=g.inputType==="insertText"?g.data:null;if(!h||h.length!==1){r.current=null;return}i(h)&&(g.preventDefault(),g.stopPropagation(),g.stopImmediatePropagation())},d=g=>{queueMicrotask(()=>{t.update(()=>{let h=a.current;if(!h)return;let v=At().getTextContent(),y=gM;if(y===null){a.current=null;return}let x=`${h.value.slice(0,h.expandedStart)}\`${h.value.slice(h.expandedEnd)}`;if(v!==x){g?.finalAttempt&&(r.current=null,a.current=null);return}let C=h.value.slice(h.expandedStart,h.expandedEnd),w=bo(v,h.expandedStart);ug(w,w+1);let L=Ke();if(!Ne(L)){r.current=null,a.current=null;return}L.insertText(`\`${C}${y}`),ug(w+1,w+1+C.length),r.current=null,a.current=null},{tag:yr})})},c=g=>{let h=g;(h.inputType==="insertText"||h.inputType==="insertCompositionText")&&d()},f=()=>{d({finalAttempt:!0})},p=null,m=t.registerRootListener((g,h)=>{h?.removeEventListener("keydown",s),h?.removeEventListener("beforeinput",l,!0),h?.removeEventListener("input",c),h?.removeEventListener("compositionend",f),g?.addEventListener("keydown",s),g?.addEventListener("beforeinput",l,!0),g?.addEventListener("input",c),g?.addEventListener("compositionend",f),p=g});return()=>{p&&(p.removeEventListener("keydown",s),p.removeEventListener("beforeinput",l,!0),p.removeEventListener("input",c),p.removeEventListener("compositionend",f)),m()}},[t]),null}function _q({documentKey:e,value:t,cursor:n,terminalContexts:o,skills:r,disabled:a,placeholder:i,className:s,onRemoveTerminalContext:l,onChange:d,onCommandKeyDown:c,onPaste:f,editorRef:p}){let[m]=Cn(),g=N(d);g.current=d;let h=pr(t,n),v=$a(e,t,{cursor:h,expandedCursor:jo(t,h)}),y=pr(t,v.cursor),x=Cq(o),C=N(x),w=bq(r),L=N(w),S=N(Tu(r)),k=N({value:t,cursor:y,expandedCursor:v.expandedCursor,selection:v.selection,terminalContextIds:o.map(B=>B.id)}),I=N(e),T=v.history,A=N(!1),P=K(()=>({onRemoveTerminalContext:l}),[l]);he(()=>{S.current=Tu(r)},[r]),W(()=>{m.setEditable(!a)},[a,m]),he(()=>{let B=pr(t,n),V=k.current,Q=I.current,Se=Q!==e,H=C.current!==x,q=L.current!==w;if(!Se&&V.value===t&&V.cursor===B&&!H&&!q)return;if(Se){let se=V.selection;m.getEditorState().read(()=>{se=aC(se)}),pd(Q,V.value,{cursor:V.cursor,expandedCursor:V.expandedCursor,selection:se})}let ee=$a(e,t),G=Se?ee.selection:{anchor:B,focus:B};k.current={value:t,cursor:Se?ee.cursor:B,expandedCursor:Se?ee.expandedCursor:jo(t,B),selection:G,terminalContextIds:o.map(se=>se.id)},I.current=e,C.current=x,L.current=w;let te=m.getRootElement(),me=!!(te&&document.activeElement===te);if(!Se&&V.value===t&&!H&&!q&&!me)return;let U=Se?$a(Q,V.value).history:null;A.current=!0;let Y=()=>m.update(()=>{let se=Se||V.value!==t||H||q;se&&dC(t,o,S.current),Se?ug(G.anchor,G.focus):(se||me)&&qs(B)},{discrete:!0,tag:t===""?[yr,jA]:yr});U?bR(U,Y):Y(),pd(e,t,k.current),queueMicrotask(()=>{A.current=!1})},[n,e,m,w,o,x,t]);let _=R(B=>{let V=m.getRootElement();if(!V)return;let Q=pr(k.current.value,B);V.focus({preventScroll:!0}),m.update(()=>{qs(Q)}),k.current={value:k.current.value,cursor:Q,expandedCursor:jo(k.current.value,Q),selection:{anchor:Q,focus:Q},terminalContextIds:k.current.terminalContextIds},pd(I.current,k.current.value,{cursor:k.current.cursor,expandedCursor:k.current.expandedCursor,selection:k.current.selection}),g.current(k.current.value,Q,k.current.expandedCursor,!1,k.current.terminalContextIds)},[m]),E=R(()=>{let B=k.current;return m.getEditorState().read(()=>{let V=At().getTextContent(),Q=pr(V,k.current.cursor),Se=pr(V,Pu(Q)),H=cg(V,k.current.expandedCursor),q=cg(V,yM(H)),ee=sC(At()),G=aC(k.current.selection);B={value:V,cursor:Se,expandedCursor:q,selection:G,terminalContextIds:ee}}),k.current=B,pd(I.current,B.value,B),B},[m]);ir(p,()=>({focus:()=>{_(k.current.cursor)},focusAt:_,focusAtEnd:()=>{_(bo(k.current.value,k.current.value.length))},readSnapshot:E}),[_,E]);let F=R(B=>{B.read(()=>{let V=At().getTextContent(),Q=pr(V,k.current.cursor),Se=pr(V,Pu(Q)),H=cg(V,k.current.expandedCursor),q=cg(V,yM(H)),ee=sC(At()),G=aC(k.current.selection),te=k.current;if(te.value===V&&te.cursor===Se&&te.expandedCursor===q&&te.selection.anchor===G.anchor&&te.selection.focus===G.focus&&te.terminalContextIds.length===ee.length&&te.terminalContextIds.every((U,Y)=>U===ee[Y])||A.current)return;k.current={value:V,cursor:Se,expandedCursor:q,selection:G,terminalContextIds:ee},pd(I.current,V,{cursor:Se,expandedCursor:q,selection:G});let me=Dc(V,Se,"left")||Dc(V,Se,"right");g.current(V,Se,q,me,ee)})},[]);return u(CM,{value:P,children:b("div",{className:"relative [font-family:var(--font-composer,var(--font-sans))] [font-size:var(--font-size-prompt,0.875rem)] [@media(max-width:39.999rem)_and_(pointer:coarse)]:[font-size:max(var(--font-size-prompt,1rem),16px)]",children:[u(sM,{contentEditable:u(ER,{className:$("block max-h-50 min-h-17.5 w-full overflow-y-auto whitespace-pre-wrap wrap-break-word bg-transparent leading-relaxed text-foreground focus:outline-none",s),"data-testid":"composer-editor","data-composer-prompt":"true",spellCheck:!1,autoCorrect:"off",autoCapitalize:"off","aria-placeholder":i,placeholder:u("span",{}),onPaste:f}),placeholder:o.length>0?null:u("div",{className:"pointer-events-none absolute inset-0 leading-relaxed text-placeholder",children:i}),ErrorBoundary:RR}),u(MR,{onChange:F}),u(kq,{...c?{onCommandKeyDown:c}:{}}),u(Nq,{terminalContexts:o,skills:r}),u(Pq,{}),u(Lq,{}),u(Aq,{}),u(Eq,{}),u(Mq,{}),u(Rq,{}),u(vR,{externalHistoryState:T},e)]})})}function Dq(e){let[t]=Cn(),n=N(e),o=N(e),[r,a]=J(e.documentKey);r===e.documentKey&&(n.current=e),o.current=e,he(()=>{r===e.documentKey||t.isComposing()||a(e.documentKey)},[r,t,e.documentKey]),W(()=>{let s=null,l=()=>{let c=o.current.documentKey;a(f=>f===c?f:c)},d=t.registerRootListener((c,f)=>{f?.removeEventListener("compositionend",l),c?.addEventListener("compositionend",l),s=c});return()=>{s?.removeEventListener("compositionend",l),d()}},[t]);let i=r===e.documentKey?e:n.current;return u(_q,{...i})}function IM({documentKey:e,value:t,cursor:n,terminalContexts:o,skills:r,disabled:a,placeholder:i,className:s,onRemoveTerminalContext:l,onChange:d,onCommandKeyDown:c,onPaste:f,editorRef:p}){let m=N(t),g=N(o),h=N(Tu(r)),v=K(()=>({namespace:"ycodium-composer-editor",editable:!0,nodes:[Iu,ku,Vs],editorState:()=>{dC(m.current,g.current,h.current)},onError:y=>{throw y}}),[]);return u(SR,{initialConfig:v,children:u(Dq,{documentKey:e,value:t,cursor:n,terminalContexts:o,skills:r,disabled:a,placeholder:i,onRemoveTerminalContext:l,onChange:d,onPaste:f,editorRef:p,...c?{onCommandKeyDown:c}:{},...s?{className:s}:{}})},pq)}ue();function Oq(e){let t=new Date(e);return Number.isNaN(t.getTime())?null:t}function TM(e,t){let n=Oq(e);if(!n)return"";let o=Date.now()-n.getTime();if(o<0)return t("relativeTime.justNow");let r=Math.floor(o/1e3);if(r<60)return t("relativeTime.justNow");let a=Math.floor(r/60);if(a<60)return t("relativeTime.minutesAgo",{count:a});let i=Math.floor(a/60);return i<24?t("relativeTime.hoursAgo",{count:i}):t("relativeTime.daysAgo",{count:Math.floor(i/24)})}var kM=90;function LM(e){return e.droppedImageNames.length+(e.unreadableImageNames?.length??0)}function Fq(e,t){let n=e.prompt.trim().replace(/\s+/g," ");if(n.length>0)return n.length>kM?`${n.slice(0,kM)}\u2026`:n;let o=e.attachments.length+e.droppedImageNames.length;return o>0?t("stash.imageCountLabel",{count:o}):t("stash.emptyEntry")}var PM=pe(function(t){let{entries:n,onRestore:o,onDelete:r,onClose:a}=t,{t:i}=Ce(),s=Wt(),l=N(null),[d,c]=J(n[0]?.id??null),f=n.find(p=>p.id===d)??n[0];return W(()=>{let p=m=>{let g=l.current;g&&m.composedPath().includes(g)||m.target instanceof Element&&m.target.closest('[data-prompt-stash-badge="true"]')||a()};return document.addEventListener("pointerdown",p,!0),()=>document.removeEventListener("pointerdown",p,!0)},[a]),W(()=>{n.length!==0&&(n.some(p=>p.id===d)||c(n[0]?.id??null))},[n,d]),s.pane.useKeydown(p=>{if(p.key==="Escape"){p.preventDefault(),p.stopPropagation(),a();return}if(p.key==="ArrowDown"||p.key==="ArrowUp"){if(n.length===0)return;p.preventDefault(),p.stopPropagation();let m=n.findIndex(y=>y.id===d),g=p.key==="ArrowDown"?1:-1,v=((m>=0?m:g===1?-1:0)+g+n.length)%n.length;c(n[v]?.id??null);return}if(p.key==="Enter"){if(p.target instanceof HTMLElement&&p.target.closest("button[aria-label]")||!f)return;p.preventDefault(),p.stopPropagation(),o(f);return}if(p.key==="Backspace"&&(p.metaKey||p.ctrlKey)){if(!f)return;p.preventDefault(),p.stopPropagation(),r(f)}},{capture:!0}),u(Uf,{autoHighlight:!1,mode:"none",children:b("div",{ref:l,className:"chat-composer-drawer-surface chat-composer-drawer-attached relative w-full overflow-hidden","data-composer-stash-drawer":"true",children:[u("div",{className:"flex h-7 items-center justify-end px-2 pt-1",children:u(ce,{variant:"ghost-muted",size:"icon-micro","aria-label":i("stash.closeLabel"),onPointerDown:p=>p.preventDefault(),onClick:a,children:u(en,{className:"size-3"})})}),u(Kf,{className:"max-h-64 scroll-pb-6",children:u(Hf,{children:n.length===0?u("p",{className:"px-3 py-1.5 text-secondary-label text-xs",children:i("stash.empty")}):n.map(p=>b($f,{value:p.id,className:$("group/stash relative cursor-pointer select-none gap-3 rounded-lg px-3 py-1.5! hover:bg-transparent hover:text-inherit data-highlighted:bg-transparent data-highlighted:text-inherit",d===p.id&&"bg-accent! text-accent-foreground!"),onMouseMove:()=>{d!==p.id&&c(p.id)},onMouseDown:m=>{m.preventDefault()},onClick:()=>{o(p)},children:[u("span",{className:"min-w-0 flex-1 truncate text-xs",children:Fq(p,i)}),p.pendingImageCount?u("span",{className:"shrink-0 text-[10px] text-secondary-label",children:i("stash.savingImage",{count:p.pendingImageCount})}):LM(p)>0?u("span",{className:"shrink-0 text-[10px] text-warning-foreground",children:i("stash.imagesDropped",{count:LM(p)})}):null,p.attachments.length>0?u("span",{className:"flex shrink-0 items-center -space-x-1.5",children:p.attachments.slice(0,3).map(m=>u("img",{src:m.dataUrl,alt:"","aria-hidden":"true",className:"size-5 rounded border border-border/70 object-cover"},m.id))}):null,u("span",{className:"shrink-0 text-secondary-label text-xs max-sm:hidden",children:TM(p.createdAt,i)}),u(ce,{variant:"ghost",size:"icon-xs",className:"pointer-events-none shrink-0 [--control-icon-color:currentColor] opacity-0 shadow-none! transition-opacity pointer-coarse:pointer-events-auto pointer-coarse:opacity-100 group-hover/stash:pointer-events-auto group-hover/stash:opacity-100 group-focus-within/stash:pointer-events-auto group-focus-within/stash:opacity-100 focus-visible:pointer-events-auto focus-visible:opacity-100","aria-label":i("stash.deleteLabel"),onClick:m=>{m.stopPropagation(),r(p)},children:u(en,{className:"stroke-2"})})]},p.id))})})]})})});ue();function co(e,t){let n=e.trim();return n?t?.trimLeadingPattern?n.replace(t.trimLeadingPattern,"").toLowerCase():n.toLowerCase():""}function Bq(e,t){if(!t)return 0;let n=0,o=-1,r=-1,a=0;for(let i=0;i<e.length;i+=1)if(e[i]===t[n]&&(o===-1&&(o=i),r!==-1&&(a+=i-r-1),r=i,n+=1,n===t.length)){let s=i-o+1-t.length,l=Math.min(64,e.length-t.length);return o*2+a*3+s+l}return null}function cC(e,t){return Math.min(64,Math.max(0,e.length-t.length))}function zq(e,t,n){let o=null;for(let r of n){let a=e.indexOf(`${r}${t}`);if(a===-1)continue;let i=a+r.length;(o===null||i<o)&&(o=i)}return o}function $r(e){let{value:t,query:n}=e;if(!t||!n)return null;if(t===n)return e.exactBase;if(e.prefixBase!==void 0&&t.startsWith(n))return e.prefixBase+cC(t,n);if(e.boundaryBase!==void 0){let o=zq(t,n,e.boundaryMarkers??[" ","-","_","/"]);if(o!==null)return e.boundaryBase+o*2+cC(t,n)}if(e.includesBase!==void 0){let o=t.indexOf(n);if(o!==-1)return e.includesBase+o*2+cC(t,n)}if(e.fuzzyBase!==void 0){let o=Bq(t,n);if(o!==null)return e.fuzzyBase+o}return null}function Uq(e,t){let n=e.score-t.score;return n!==0?n:e.tieBreaker.localeCompare(t.tieBreaker)}function Hq(e,t){let n=0,o=e.length;for(;n<o;){let r=n+Math.floor((o-n)/2),a=e[r];if(!a)break;Uq(t,a)<0?o=r:n=r+1}return n}function vg(e,t,n){if(n<=0)return;let o=Hq(e,t);if(e.length<n){e.splice(o,0,t);return}o>=n||(e.splice(o,0,t),e.pop())}function uC(e,t){let n=e.name.toLowerCase(),o=sa(e).toLowerCase(),r=e.shortDescription?.toLowerCase()??"",a=e.description?.toLowerCase()??"",i=e.scope?.toLowerCase()??"",s=[$r({value:n,query:t,exactBase:0,prefixBase:2,boundaryBase:4,includesBase:6,fuzzyBase:100,boundaryMarkers:["-","_","/"]}),$r({value:o,query:t,exactBase:1,prefixBase:3,boundaryBase:5,includesBase:7,fuzzyBase:110}),$r({value:r,query:t,exactBase:20,prefixBase:22,boundaryBase:24,includesBase:26}),$r({value:a,query:t,exactBase:30,prefixBase:32,boundaryBase:34,includesBase:36}),$r({value:i,query:t,exactBase:40,prefixBase:42,includesBase:44})].filter(l=>l!==null);return s.length===0?null:Math.min(...s)}function AM(e,t,n=Number.POSITIVE_INFINITY){let o=e.filter(i=>i.enabled),r=co(t,{trimLeadingPattern:/^\$+/});if(!r)return o;let a=[];for(let i of o){let s=uC(i,r);s!==null&&vg(a,{item:i,score:s,tieBreaker:`${sa(i).toLowerCase()}\0${i.name}`},n)}return a.map(i=>i.item)}function $q(e,t){if(e.type==="skill"){if(t==="skill")return 0;let a=t.startsWith("skill:")?t.slice(6):t,i=a?uC(e.skill,a):0;return i!==null?i:"skill".startsWith(t)?Number.MAX_SAFE_INTEGER:null}let n=e.type==="slash-command"?e.command.toLowerCase():e.command.name.toLowerCase(),o=e.description.toLowerCase(),r=[$r({value:n,query:t,exactBase:0,prefixBase:2,boundaryBase:4,includesBase:6,fuzzyBase:100,boundaryMarkers:["-","_","/"]}),$r({value:o,query:t,exactBase:20,prefixBase:22,boundaryBase:24,includesBase:26})].filter(a=>a!==null);return r.length===0?null:Math.min(...r)}function EM(e,t,n=[]){let o=co(t,{trimLeadingPattern:/^\/+/});if(!o)return[...e];let r=[];for(let a of e){let i=$q(a,o);if(i===null)continue;let s=n.includes(a.id)?i-1:i;vg(r,{item:a,score:s,tieBreaker:a.type==="slash-command"?`0\0${a.command}`:a.type==="provider-slash-command"?`1\0${a.command.name}\0${a.provider}`:`2\0${a.skill.name}\0${a.provider}`},Number.POSITIVE_INFINITY)}return r.map(a=>a.item)}function RM(e,t){let n=new Map(e.map(s=>[s.id,s])),o=t.map(s=>n.get(s)).filter(s=>s!==void 0).slice(0,3).map(s=>({...s,section:"recent"})),r=new Set(o.map(s=>s.id)),a=e.filter(s=>!r.has(s.id)),i=s=>s.type==="slash-command"?"builtIn":s.type==="provider-slash-command"?"provider":"skills";return[...o,...a.map(s=>({...s,section:i(s)}))]}function fC(e){return e.items.length===0?null:e.currentSearchKey===e.highlightedSearchKey&&e.highlightedItemId&&e.items.some(t=>t.id===e.highlightedItemId)?e.highlightedItemId:e.items[0]?.id??null}var MM=(e,t,n)=>n.endsWith(" ")&&e[t]===" "?t+1:t;function yg(e){return e===null?null:`${e.kind}:${e.rangeStart}:${e.rangeEnd}:${e.query}`}function NM({prompt:e,selectedProvider:t,selectedProviderStatus:n,planModeUiEnabled:o,showSkillsInSlashMenu:r,recentSlashCommandIds:a,environmentId:i,gitCwd:s,useComposerPathSearch:l,readComposerSnapshot:d,applyPromptReplacement:c,onInteractionModeChange:f,onOpenModelPicker:p,onSlashCommandUsed:m}){let{t:g}=Ce(),[h,v]=J(()=>wo(e,e.length)),[y,x]=J(null),[C,w]=J(null),[L,S]=J(null),k=y!==null&&yg(h)===y?null:h,I=k?.kind==="path"?k.query:"",T=k?.kind==="path",A=l({environmentId:i,cwd:T?s:null,query:T?I:null}),P=K(()=>{if(!k)return[];if(k.kind==="path")return A.entries.map(ee=>({id:`path:${ee.kind}:${ee.path}`,type:"path",path:ee.path,pathKind:ee.kind,label:Kq(ee.path),description:ee.path.slice(0,Math.max(0,ee.path.lastIndexOf("/")))}));if(k.kind==="slash-command"){let ee=[{id:"slash:model",type:"slash-command",command:"model",label:"/model",description:g("composer.switchModelDesc")},...o?[{id:"slash:plan",type:"slash-command",command:"plan",label:"/plan",description:g("composer.planDesc")},{id:"slash:default",type:"slash-command",command:"default",label:"/default",description:g("composer.defaultDesc")}]:[]],G=gk(n?.skills??[],r),te=hk(n?.slashCommands??[],G).map(se=>({id:`provider-slash-command:${t}:${se.name}`,type:"provider-slash-command",provider:t,command:se,label:`/${se.name}`,description:se.description??se.input?.hint??g("composer.runProviderCommand")})),me=k.query.trim().toLowerCase(),U=G.map(se=>({id:`skill:${t}:${se.name}`,type:"skill",provider:t,skill:se,label:`/skill:${se.name}`,description:se.shortDescription??se.description??(se.scope?g("composer.skillScopeDescription",{scope:se.scope}):"")})),Y=[...ee,...te,...U];return me===""?RM(Y,a):EM(Y,me,a)}return k.kind==="skill"?AM(n?.skills??[],k.query).map(ee=>({id:`skill:${t}:${ee.name}`,type:"skill",provider:t,skill:ee,label:sa(ee),description:ee.shortDescription??ee.description??(ee.scope?g("composer.skillScopeDescription",{scope:ee.scope}):g("composer.runProviderSkill"))})):[]},[k,o,a,t,n,r,g,A.entries]),_=!!k,E=k?`${k.kind}:${k.query.trim().toLowerCase()}`:null,F=K(()=>{let ee=fC({items:P,highlightedItemId:C,currentSearchKey:E,highlightedSearchKey:L});return P.find(G=>G.id===ee)??null},[P,C,E,L]),B=R(()=>{let ee=d(),G=wo(ee.value,ee.expandedCursor),te=y!==null&&yg(G)===y?null:G;return{snapshot:ee,trigger:te}},[d,y]),V=R(ee=>{let{snapshot:G,trigger:te}=B();if(!te)return;if((ee.type==="slash-command"||ee.type==="provider-slash-command"||ee.type==="skill")&&m?.(ee.id),ee.type==="path"){let se=`${wu(ee.path)} `,ge=MM(G.value,te.rangeEnd,se);c(te.rangeStart,ge,se,{expectedText:G.value.slice(te.rangeStart,ge)})&&w(null);return}if(ee.type==="slash-command"){if(ee.command==="model"){c(te.rangeStart,te.rangeEnd,"",{expectedText:G.value.slice(te.rangeStart,te.rangeEnd),focusEditorAfterReplace:!1})&&(w(null),p());return}f(ee.command==="plan"?"plan":"default"),c(te.rangeStart,te.rangeEnd,"",{expectedText:G.value.slice(te.rangeStart,te.rangeEnd)})&&w(null);return}let me=ee.type==="provider-slash-command"?`/${ee.command.name} `:`$${ee.skill.name} `,U=MM(G.value,te.rangeEnd,me);c(te.rangeStart,U,me,{expectedText:G.value.slice(te.rangeStart,U)})&&w(null)},[c,f,p,m,B]);W(()=>{if(!_){w(null),S(null);return}let ee=fC({items:P,highlightedItemId:C,currentSearchKey:E,highlightedSearchKey:L});w(G=>G===ee?G:ee),S(G=>G===E?G:E)},[C,L,P,_,E]);let Q=R(ee=>{w(ee),S(E)},[E]),Se=R(()=>{let{trigger:ee}=B();return ee===null?!1:(x(yg(ee)),w(null),!0)},[B]),H=R((ee,G)=>{let te=jo(ee,G),me=wo(ee,te);v(me);let U=yg(me);x(Y=>Y!==null&&Y!==U?null:Y),w(null),S(null)},[]),q=R(()=>{w(null)},[]);return{composerTrigger:h,menuTrigger:k,composerMenuItems:P,composerMenuOpen:_,composerMenuSearchKey:E,activeComposerMenuItem:F,resolveActiveComposerTrigger:B,onSelectComposerItem:V,onComposerMenuItemHighlighted:Q,onMenuEscape:Se,resetForDocumentChange:H,dismissTrigger:q,workspaceEntries:A,highlightedItemId:C,setTrigger:v,setHighlightedItemId:w,setHighlightedSearchKey:S}}function Kq(e){let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t>=0?e.slice(t+1):e}function Vq(e,t){return e.bottom===t.bottom&&e.left===t.left&&e.maxHeight===t.maxHeight&&e.width===t.width&&e.overlap===t.overlap}function _M(e){let t=Wt(),n=vf(),o=t.pane.useActive(),[r,a]=J(null);return he(()=>{if(!o)return;let i=e.anchor;if(!i){a(null);return}let s=!0,l=()=>{if(!s)return;let c=i.closest('[data-chat-composer-form="true"]'),p=(c?.querySelector('[data-chat-composer-main-surface="true"]')??c??i).getBoundingClientRect(),m=Number.parseFloat(window.getComputedStyle(document.documentElement).fontSize)||16,h=(Number.parseFloat(window.getComputedStyle(c??i).getPropertyValue("--chat-composer-drawer-inset"))||1.375)*m,v=m+1,y={bottom:window.innerHeight-p.top-v,left:p.left+h,maxHeight:Math.max(96,p.top-24+v),width:Math.max(0,p.width-h*2),overlap:v};a(x=>x&&Vq(x,y)?x:y)};l(),window.addEventListener("resize",l),window.addEventListener("scroll",l,!0);let d=typeof ResizeObserver>"u"?null:new ResizeObserver(l);if(d){d.observe(i);for(let c=i.parentElement;c;c=c.parentElement)d.observe(c)}return()=>{s=!1,d?.disconnect(),window.removeEventListener("resize",l),window.removeEventListener("scroll",l,!0)}},[e.anchor,o]),!o||!r?null:t.createPortal(u("div",{className:n,"data-composer-drawer-layer":"true",style:{position:"fixed",zIndex:45,pointerEvents:"auto",clipPath:`inset(0 0 ${r.overlap}px 0)`,bottom:r.bottom,left:r.left,maxHeight:r.maxHeight,width:r.width},children:e.children}),document.body)}var qq=[],Wq=[],Gq=e=>e.prompt,jq=(e,t)=>{let n=new Map(e.map(o=>[o.id,o]));return t.flatMap(o=>{let r=n.get(o);return r?[r]:[]})},Qq=(e,t)=>e.length===t.length&&e.every((n,o)=>n.id===t[o]),DM=pe(function(t){let{handleRef:n,api:o,composerDraftTarget:r,composerDocumentKey:a,promptRef:i,editorRef:s,menuAnchor:l,resolvedTheme:d,selectedProvider:c,selectedProviderStatus:f,planModeUiEnabled:p,showSkillsInSlashMenu:m,recentSlashCommandIds:g,environmentId:h,gitCwd:v,onSlashCommandUsed:y,onOpenModelPicker:x,onInteractionModeChange:C,onToggleInteractionMode:w,activePendingProgress:L,activePendingRequestId:S,hasPendingUserInputs:k,changeUserInputCustomAnswer:I,terminalContexts:T,showTerminalContexts:A,showEditor:P,isApprovalState:_,editorClassName:E,placeholder:F,disabled:B,onPaste:V,onSubmit:Q,isMobileViewport:Se,isDraftRoute:H,stashMenuOpen:q,stashEntries:ee,onRestoreStashEntry:G,onDeleteStashEntry:te,onCloseStashMenu:me,onPromptEdited:U,onUnclaimedEscape:Y}=t,{t:se}=Ce(),ge=o.draft.useThreadDraftSelector(r,Gq),ie=o.draft.useStore,Ae=ie(xe=>xe.setPrompt),Xe=ie(xe=>xe.setTerminalContexts),nt=ie(xe=>xe.removeTerminalContext),rt=bo(ge,ge.length),Ve=$a(a,ge,{cursor:rt,expandedCursor:ge.length}),[ne,we]=J(()=>({documentKey:a,cursor:Ve.cursor})),j=ne.documentKey===a?ne.cursor:Ve.cursor,X=R(xe=>{we(_e=>{let qe=_e.documentKey===a?_e.cursor:$a(a,i.current).cursor,We=typeof xe=="function"?xe(qe):xe,ot=i.current,xt=jo(ot,We);return CR(a,ot,We,xt),_e.documentKey===a&&_e.cursor===We?_e:{documentKey:a,cursor:We}})},[a,i]),ae=N(!1),oe=N(!1),ft=N([]),pt=N(null),yt=R(xe=>{Ae(r,xe)},[r,Ae]),Lt=R((xe,_e,qe,We,ot)=>{I(xe,_e,qe,We,ot),i.current=_e},[I,i]),on=R((xe,_e,qe,We)=>{let ot=i.current,xt=Math.max(0,Math.min(ot.length,xe)),Bt=Math.max(xt,Math.min(ot.length,_e));if(We?.expectedText!==void 0&&ot.slice(xt,Bt)!==We.expectedText)return!1;let Zt=XT(i.current,xe,_e,qe),ke=bo(Zt.text,Zt.cursor),Ut=jo(Zt.text,ke);i.current=Zt.text;let vt=L?.activeQuestion;return vt&&k?Lt(vt.id,Zt.text,ke,Ut,!1):yt(Zt.text),X(ke),rn(wo(Zt.text,Ut)),We?.focusEditorAfterReplace!==!1&&window.requestAnimationFrame(()=>{s.current?.focusAt(ke)}),!0},[L?.activeQuestion,s,k,Lt,i,X,yt]),gt=R(()=>{let xe=s.current?.readSnapshot();return xe||{value:i.current,cursor:j,expandedCursor:jo(i.current,j),terminalContextIds:T.map(_e=>_e.id)}},[j,s,i,T]),zt=NM({prompt:ge,selectedProvider:c,selectedProviderStatus:f,planModeUiEnabled:p,showSkillsInSlashMenu:m,recentSlashCommandIds:g,environmentId:h,gitCwd:v,useComposerPathSearch:o.pathSearch.useComposerPathSearch,readComposerSnapshot:gt,applyPromptReplacement:on,onInteractionModeChange:C,onOpenModelPicker:x,onSlashCommandUsed:y}),{composerTrigger:Mt,composerMenuItems:wt,composerMenuOpen:In,activeComposerMenuItem:ct,resolveActiveComposerTrigger:dn,onComposerMenuItemHighlighted:ro,onMenuEscape:Vt,workspaceEntries:bn,highlightedItemId:Tn,setTrigger:rn,setHighlightedItemId:kn}=zt,O=Mt?.kind??null,fe=Mt?.kind==="path"?Mt.query:"",ye=L?L.customAnswer:ge,Te=_?"":ye,Me=zt.resetForDocumentChange;W(()=>{Me(ye,j)},[a,Me,ye,j]),oe.current=In,ft.current=wt,pt.current=ct;let ht=O==="path"&&fe.length>0&&bn.isPending===!0,Ln=K(()=>se(O==="skill"?"composer.noSkillsFound":O==="path"?"composer.noMatchingFiles":"composer.noMatchingCommand"),[O]),mn=R(xe=>{let _e=T.findIndex(ot=>ot.id===xe);if(_e<0)return;let qe=o.terminalContext.removeInlinePlaceholder(i.current,_e);i.current=qe.prompt,yt(qe.prompt),nt(r,xe);let We=bo(qe.prompt,qe.cursor);X(We),rn(wo(qe.prompt,qe.cursor))},[o.terminalContext,r,i,nt,X,yt,T,rn]);he(()=>{i.current=ge,X(xe=>pr(ge,xe))},[a,ge,i,X]),W(()=>{U(ge)},[U,ge]),W(()=>{In&&me()},[In,me]);let at=N(null);W(()=>{let xe=L?.customAnswer;if(typeof xe!="string"){if(at.current!==null){i.current=ge;let Bt=bo(ge,ge.length);X(Bt),rn(wo(ge,jo(ge,Bt)))}at.current=null;return}let _e=S,qe=L?.activeQuestion?.id??null,We=at.current?.requestId!==_e||at.current?.questionId!==qe,ot=i.current!==xe;if(at.current={requestId:_e,questionId:qe},!We&&!ot)return;i.current=xe;let xt=bo(xe,xe.length);X(xt),rn(wo(xe,jo(xe,xt))),kn(null)},[L?.customAnswer,L?.activeQuestion?.id,S,ge,i]);let Pt=R((xe,_e,qe,We,ot)=>{if(L?.activeQuestion&&k){if(L.activeQuestion.allowFreeform===!1)return;X(_e),rn(We?null:wo(xe,qe)),Lt(L.activeQuestion.id,xe,_e,qe,We);return}i.current=xe,yt(xe),Qq(T,ot)||Xe(r,jq(T,ot)),X(_e),rn(We?null:wo(xe,qe))},[L?.activeQuestion,k,Lt,i,X,yt,r,T,Xe,rn]),Et=zt.onSelectComposerItem,St=R(xe=>{ae.current||(ae.current=!0,window.requestAnimationFrame(()=>{ae.current=!1}),Et(xe))},[Et]),an=R(xe=>{if(wt.length===0)return;let _e=wt.findIndex(Bt=>Bt.id===Tn),ot=((_e>=0?_e:xe==="ArrowDown"?-1:0)+(xe==="ArrowDown"?1:-1)+wt.length)%wt.length,xt=wt[ot];kn(xt?.id??null)},[Tn,wt,kn]),Jt=(xe,_e)=>{if(xe==="Escape")return _e.isComposing||_e.keyCode===229?!1:Vt()||(Y?.()??!1);if(xe==="Tab"&&_e.shiftKey)return p?(w(),!0):!1;let{trigger:qe}=dn();if(oe.current||qe!==null){let xt=ft.current,Bt=pt.current??xt[0];if(xe==="ArrowDown"&&xt.length>0)return an("ArrowDown"),!0;if(xe==="ArrowUp"&&xt.length>0)return an("ArrowUp"),!0;if((xe==="Enter"||xe==="Tab")&&Bt)return St(Bt),!0}let ot=xe==="Enter"?GT({isMobileViewport:Se,shiftKey:_e.shiftKey,modifierKey:_e.metaKey||_e.ctrlKey,isDraftThread:H}):null;return ot?(Q(void 0,ot),!0):!1};return ir(n,()=>({readSnapshot:gt,readDraftPrompt:()=>ge,applyPromptReplacement:on,syncCursor:(xe,_e)=>{X(xe),rn(_e)},resetCursorState:xe=>{let _e=xe?.prompt??i.current,qe=pr(_e,xe?.cursor??0);kn(null),X(qe),rn(xe?.detectTrigger?wo(_e,jo(_e,qe)):null)}}),[on,ge,i,gt,X,kn,rn]),b(Le,{children:[q&&!In&&!_&&u(_M,{anchor:l,children:u(PM,{entries:ee,onRestore:G,onDelete:te,onClose:me})}),In&&!_&&u(_M,{anchor:l,children:u(xk,{items:wt,resolvedTheme:d,isLoading:ht,triggerKind:O,emptyStateText:Ln,activeItemId:ct?.id??null,onHighlightedItemChange:ro,onSelect:St})}),P?u(IM,{editorRef:s,documentKey:a,value:Te,cursor:j,terminalContexts:A?T:qq,skills:f?.skills??Wq,...E?{className:E}:{},onRemoveTerminalContext:mn,onChange:Pt,onCommandKeyDown:Jt,onPaste:V,placeholder:F,disabled:B}):null]})});ue();function OM(e){return e==="ready"}function FM(e){return e==="ready"||e==="unchecked"||e==="checking"}function BM(e,t){switch(e){case"ready":return t("readiness.ready.title");case"unchecked":return t("readiness.unchecked.title");case"checking":return t("readiness.checking.title");case"disabled":return t("readiness.disabled.title");case"not-installed":return t("readiness.notInstalled.title");case"unauthenticated":return t("readiness.unauthenticated.title");case"error":return t("readiness.error.title");default:return e}}function xg(e){return e.enabled&&FM(e.readiness)}function Au(e){return e.enabled}function zM(e){let t=new Map;for(let n of e){let o=t.get(n.driverKind);o?o.push(n):t.set(n.driverKind,[n])}return[...t.values()].flat()}var UM=e=>e.enabled;function HM(e,t){let n=e.find(o=>o.instanceId===t);if(n)return n.driverKind}var $M="h-7 min-h-7 gap-1.5 rounded-[var(--control-radius)] px-2.5 text-secondary-label transition-none hover:text-foreground [&_svg[data-composer-control-icon]]:mx-0 [&_svg[data-composer-control-chevron]]:-mx-0.5";function Yo({className:e,size:t="sm",variant:n="ghost",...o}){return u(ce,{className:$($M,e),size:t,variant:n,...o})}function Jo({icon:e,className:t,opticalSize:n="default"}){return u(e,{"aria-hidden":"true",className:$("shrink-0",n==="large"?"size-4.5":"size-4",t),"data-composer-control-icon":!0})}function ma(){return u(sn,{"aria-hidden":"true",className:"-mx-0.5 size-icon-2 shrink-0 text-icon-muted","data-composer-control-chevron":!0,strokeWidth:2.25})}function Cg({className:e,size:t="sm",variant:n="ghost",...o}){return u(Gw,{className:$($M,e),icon:u(ma,{}),size:t,variant:n,...o})}function pC(e,t){if(!e)return t("composer.agentPickerLabel");let n=e.agentName?.trim(),o=e.displayName.trim();return n?!o||o===n?n:`${n} \xB7 ${o}`:o}function mC(e,t){let n=e.filter(Au),o=t.lockedProvider;if(o==null||o.length===0)return n;let r=t.lockedContinuationGroupKey;return n.filter(a=>a.driverKind===o&&(!r||a.continuationGroupKey===r))}var gC=pe(function(t){let{t:n}=Ce(),o=t.instanceEntries.filter(Au),r=t.unavailableInstanceId??null,a=r===null?null:t.instanceEntries.find(c=>c.instanceId===r)??null,i=t.notChosen===!0&&r===null,s=r!==null||i?null:o.find(c=>c.instanceId===t.activeInstanceId)??null,l=t.lockedProvider!=null&&t.lockedProvider.length>0,d=r!==null||i?mC(t.instanceEntries,t):o;return b(Eo,{children:[b(Mo,{render:u(Yo,{"aria-label":n("composer.agentPickerLabel"),"data-composer-agent-picker":"true",disabled:t.disabled||l&&r===null||d.length===0,className:$("min-w-0 justify-between whitespace-nowrap",t.compact?"max-w-36 shrink-0":"max-w-44 shrink")}),children:[r!==null?u(Sn,{"aria-hidden":"true",className:"size-4 shrink-0 text-warning"}):i?null:s?u(kr,{driver:s.driverKind,displayName:s.displayName,accentColor:s.accentColor,className:"size-4",iconClassName:"size-4",indicatorBackground:"var(--contrast-input)"}):null,r!==null?b("span",{className:"min-w-0 truncate text-warning","data-composer-agent-unavailable":"true",children:[a===null?r:pC(a,n)," \xB7 ",n("composer.agentUnavailableBadge")]}):i?u("span",{className:"min-w-0 truncate","data-composer-agent-not-chosen":"true",children:n("composer.agentChoosePlaceholder")}):u("span",{className:"min-w-0 truncate",children:pC(s,n)}),u(ma,{})]}),u(Ro,{align:"start",children:u(Lr,{value:r!==null||i?"":t.activeInstanceId,onValueChange:c=>{!c||r===null&&!i&&c===t.activeInstanceId||t.onInstanceChange(c)},children:d.map(c=>u(Wo,{value:c.instanceId,children:pC(c,n)},c.instanceId))})})]})});function KM(e){return u(gC,{...e})}function VM(e){return e.machineUnavailable?"machineDisconnected":e.sessionStarted&&e.sessionDisconnected?"settled":"default"}function qM(e){switch(e){case"machineDisconnected":return"composer.disconnectedPlaceholder";case"settled":return"composer.idlePlaceholder";case"default":return null}}ue();ue();ue();var _C=Md(QM(),1),RN=Md(Ic(),1),MN=Md(Ic(),1);zn(function(t,n){return De("div",{ref:n,...t})});var Eg=zn(function(t,n){return De("div",{ref:n,...t})}),xr=Eg,Wa={OS:"web"};function Ws(e,t){return t===void 0?e:Math.max(0,Math.min(t,e))}function DC(e,t){return t===void 0||!Number.isFinite(t)||!Number.isFinite(e.scrollLength)||t<=e.scrollLength?t!==void 0&&Number.isFinite(t)&&Number.isFinite(e.scrollLength)?0:void 0:Math.max(0,t-e.scrollLength)}function NN(){return"normal"}function a4(e){var t;return(t=e?.horizontalRTLScrollType)!=null?t:NN()}function i4(e){var t;return(t=e?.rtl)!=null?t:!1}function ja(e){return OC(e?.props)}function OC(e){return!!e?.horizontal&&i4(e)}function FC(e){return e?.horizontal?(OC(e)?e.stylePaddingLeft:e.stylePaddingRight)||0:e?.stylePaddingBottom||0}function s4(e,t){var n;return(n=DC(e,t))!=null?n:0}function XM(e,t){return t&&(ja(e)?t.left:t.right)||0}function l4(e,t,n,o){return!ja(e)||o===void 0||!Number.isFinite(o)?t:Math.max(0,o-t-n)}function BC(e,t,n){if(!e||!ja(e))return t;let o=DC(e,n),r=Ws(t,o),a=a4(e);return a==="negative"?r===0?0:-r:a==="inverted"?o===void 0?r:Ws(o-r,o):r}function d4(e,t,n){if(!ja(e))return e.horizontalRTLScrollType=void 0,t;let o=DC(e,n);if(t<0)return e.horizontalRTLScrollType="negative",Ws(-t,o);if(o===void 0)return t;let r=t,a=o-t;if(!Number.isFinite(a))return e.horizontalRTLScrollType="normal",r;let i=e.horizontalRTLScrollType;if(i==="inverted")return Ws(a,o);if(i==="normal")return Ws(r,o);if(!e.hasScrolled){let f=NN();return e.horizontalRTLScrollType=f,Ws(r,o)}let s=e.scroll,l=Math.abs(r-s),c=Math.abs(a-s)+.5<l;return e.horizontalRTLScrollType=c?"inverted":"normal",Ws(c?a:r,o)}var c4=e=>e,Rg=Ct(null),_N="\0",u4=0;function f4({children:e}){let[t]=J(()=>({animatedScrollY:c4(0),columnWrapperStyle:void 0,containerLayoutTriggers:new Map,contextNum:u4++,listeners:new Map,mapViewabilityAmountCallbacks:new Map,mapViewabilityAmountValues:new Map,mapViewabilityCallbacks:new Map,mapViewabilityConfigStates:new Map,mapViewabilityValues:new Map,pendingContainerIds:void 0,positionListeners:new Map,scrollAxisGap:0,state:void 0,values:new Map([["alignItemsAtEndPadding",0],["containerLayoutEpoch",0],["stylePaddingTop",0],["headerSize",0],["numContainers",0],["activeStickyIndex",-1],["isAtEnd",!1],["isAtStart",!1],["isNearEnd",!1],["isNearStart",!1],["isWithinMaintainScrollAtEndThreshold",!1],["adaptiveRender","normal"],["totalSize",0],["scrollAdjustPending",0]]),viewRefs:new Map}));return De(Rg.Provider,{value:t},e)}function Vr(){return Ht(Rg)}function DN(e,t){if(!e){let r=[];return{get:()=>r,subscribe:()=>()=>{}}}let n=[],o=[];return{get:()=>{let r=[],a=!1;for(let i=0;i<t.length;i++){let s=be(e,t[i]);r.push(s),s!==o[i]&&(a=!0)}return o=r,a&&(n=r),n},subscribe:r=>{let a=[];for(let i of t)a.push(Va(e,i,r));return()=>{for(let i of a)i()}}}}function p4(e){return e.length===1?e[0]:e.join(_N)}function m4(e){return e.split(_N)}function Va(e,t,n){let{listeners:o}=e,r=o.get(t);return r||(r=new Set,o.set(t,r)),r.add(n),()=>r.delete(n)}function be(e,t){let{values:n}=e;return n.get(t)}function Be(e,t,n){let{listeners:o,values:r}=e;if(r.get(t)!==n){r.set(t,n);let a=o.get(t);if(a)for(let i of a)i(n)}}function g4(e,t,n){let{positionListeners:o}=e,r=o.get(t);return r||(r=new Set,o.set(t,r)),r.add(n),()=>r.delete(n)}function h4(e,t,n){let{positionListeners:o}=e,r=o.get(t);if(r)for(let a of r)a(n)}function er(e){let t=Ht(Rg),n=p4(e),{subscribe:o,get:r}=K(()=>DN(t,m4(n)),[t,n]);return(0,_C.useSyncExternalStore)(o,r,r)}function v4(e,t){let n=Ht(Rg),{subscribe:o,get:r}=K(()=>DN(n,[e]),[n,e]),a=R(()=>t(r()[0]),[r,t]);return(0,_C.useSyncExternalStore)(o,a,a)}function y4(e){return Math.max(0,e??0)}function js(e,t){var n;let o=e.state,{props:r}=o,a=r.horizontal,i=r.contentInset,s=i??o.nativeContentInset,l=(a?XM(o,s):s?.bottom)||0,d=y4(t??r.contentInsetEndAdjustment),c=be(e,"anchoredEndSpaceSize"),f=r.anchoredEndSpace&&c?c:0,p=(n=o.contentInsetOverride)!=null?n:void 0,m=l+d;if(p){let g={bottom:0,left:0,right:0,...s,...p};return Math.max(((a?XM(o,g):g.bottom)||0)+d,f)}return Math.max(m,f)}function uo(e){var t,n;let{values:o,state:r}=e,a=r.props.horizontal?r.props.stylePaddingLeft||0:o.get("stylePaddingTop")||0,i=r.props.horizontal?r.props.stylePaddingRight||0:r.props.stylePaddingBottom||0,s=o.get("alignItemsAtEndPadding")||0,l=o.get("headerSize")||0,d=o.get("footerSize")||0,c=js(e),f=(n=(t=r.pendingTotalSize)!=null?t:r.totalSize)!=null?n:o.get("totalSize"),p=Math.max(0,f-(r.props.data.length>0?e.scrollAxisGap:0));return l+d+p+a+s+i+(c||0)}var hd=({children:e})=>De(Eg,{style:{alignItems:"center",flexDirection:"row",justifyContent:"space-between"}},e);pe(function(){let t=Vr(),[n=0,o=0,r=0,a=0,i=0,s=0,l=!1]=er(["totalSize","scrollAdjust","debugRawScroll","debugComputedScroll","numContainers","numContainersPooled","isAtEnd"]),d=uo(t),[,c]=Ia(f=>f+1,0);return x4(()=>{c()},100),De(Eg,{pointerEvents:"none",style:{backgroundColor:"#FFFFFFCC",borderRadius:4,padding:4,paddingBottom:4,paddingLeft:4,position:"absolute",right:0,top:0}},De(hd,null,De(xr,null,"TotalSize:"),De(xr,null,n.toFixed(2))),De(hd,null,De(xr,null,"ContentSize:"),De(xr,null,d.toFixed(2))),De(hd,null,De(xr,null,"At end:"),De(xr,null,String(l))),De(hd,null,De(xr,null,"ScrollAdjust:"),De(xr,null,o.toFixed(2))),De(hd,null,De(xr,null,"RawScroll: "),De(xr,null,r.toFixed(2))),De(hd,null,De(xr,null,"ComputedScroll: "),De(xr,null,a.toFixed(2))))});function x4(e,t){W(()=>{let n=setInterval(e,t);return()=>clearInterval(n)},[t])}var zC=!0,ON=new WeakMap;function C4(e){return ON.get(e)}function b4(e,t){ON.set(e,t)}var w4=typeof __DEV__<"u"?__DEV__:void 0,YM,JM=typeof process<"u"&&typeof process.env=="object"&&process.env?(YM="production")!=null?YM:process.env.MODE:void 0,ZM=typeof JM=="string"?JM.toLowerCase()!=="production":void 0,eN,Zo=(eN=ZM??w4)!=null?eN:!1,vd=-1e7,FN=1,S4=Zo&&!1,I4=Zo&&!1;function Mg({scheduledWork:e}){e.cancel("checkFinishedScrollFrame"),e.cancel("checkFinishedScrollRetryFrame"),e.cancel("checkFinishedScrollFallback"),e.cancel("platformScrollCompletion")}function BN(e){var t,n;let o=(n=e.pendingScrollResolve)!=null?n:(t=e.pendingScrollToEnd)==null?void 0:t.resolve;e.pendingScrollResolve=void 0,e.pendingScrollToEnd=void 0,o?.()}function T4(e){Mg(e),e.scheduledWork.cancel("imperativeScrollReady"),e.scrollingTo=void 0,e.scrollTargetPinnedRange=void 0,BN(e)}function k4(e,t,n){return{...t,nativeEvent:{...t.nativeEvent,contentOffset:e.props.horizontal?{x:n,y:0}:{x:0,y:n}}}}function L4(e,t){var n,o,r,a;let i=e.state,s=i.deferredPublicOnScrollEvent;i.deferredPublicOnScrollEvent=void 0,s&&((a=(r=i.props).onScroll)==null||a.call(r,k4(i,s,(o=(n=t??i.scrollPending)!=null?n:i.scroll)!=null?o:0)))}var vC=1;function P4(e){return!!(e?.didDispatchNativeScroll||e?.didRetrySilentInitialScroll||e?.watchdog)}function tN(e){e.initialScrollSession=void 0}function SC(e){let{bootstrap:t,completion:n,kind:o,previousDataLength:r}=e;return o==="offset"?{completion:n,kind:o,previousDataLength:r}:{bootstrap:t,completion:n,kind:o,previousDataLength:r}}function bg(e,t=(n=>(n=(o=>(o=e.initialScrollSession)==null?void 0:o.kind)())!=null?n:"bootstrap")()){var n,o;return e.initialScrollSession?e.initialScrollSession.kind!==t&&(e.initialScrollSession=SC({bootstrap:e.initialScrollSession.kind==="bootstrap"?e.initialScrollSession.bootstrap:void 0,completion:e.initialScrollSession.completion,kind:t,previousDataLength:e.initialScrollSession.previousDataLength})):e.initialScrollSession=SC({completion:{},kind:t,previousDataLength:0}),(o=(n=e.initialScrollSession).completion)!=null||(n.completion={}),e.initialScrollSession.completion}var Ng={didDispatchNativeScroll(e){var t,n;return!!((n=(t=e.initialScrollSession)==null?void 0:t.completion)!=null&&n.didDispatchNativeScroll)},didRetrySilentInitialScroll(e){var t,n;return!!((n=(t=e.initialScrollSession)==null?void 0:t.completion)!=null&&n.didRetrySilentInitialScroll)},markInitialScrollNativeDispatch(e){bg(e).didDispatchNativeScroll=!0},markSilentInitialScrollRetry(e){bg(e).didRetrySilentInitialScroll=!0},resetFlags(e){if(!e.initialScrollSession)return;let t=bg(e,e.initialScrollSession.kind);t.didDispatchNativeScroll=void 0,t.didRetrySilentInitialScroll=void 0}},oo={clear(e){oo.set(e,void 0)},didReachTarget(e,t){return Math.abs(e-t.targetOffset)<=vC},get(e){var t,n;return(n=(t=e.initialScrollSession)==null?void 0:t.completion)==null?void 0:n.watchdog},hasNonZeroTargetOffset(e){return e!==void 0&&e>vC},isAtZeroTargetOffset(e){return e<=vC},set(e,t){var n,o;if(!t&&!((o=(n=e.initialScrollSession)==null?void 0:n.completion)!=null&&o.watchdog))return;let r=bg(e);r.watchdog=t?{startScroll:t.startScroll,targetOffset:t.targetOffset}:void 0}};function Ga(e,t={}){var n,o,r,a;let i=e.initialScrollSession,s=(n=t.kind)!=null?n:i?.kind,l=i?.completion,d=i?.kind==="bootstrap"?i.bootstrap:void 0,c=s==="bootstrap"?t.bootstrap===null?void 0:(o=t.bootstrap)!=null?o:d:void 0;if(!s||!e.initialScroll&&!c&&!P4(l))return tN(e);let f=(a=(r=t.previousDataLength)!=null?r:i?.previousDataLength)!=null?a:0;return e.initialScrollSession=SC({bootstrap:c,completion:l,kind:s,previousDataLength:f}),e.initialScrollSession}var A4=1.3;function IC(e,t,n){let o=Math.abs(e);return!t&&n>0&&o>=n*A4||!t&&n<=0&&o>0}var zN=(e,t,n,o,r,a,i,s)=>{let l=Math.abs(e),d=t||n>0&&l<=n,c=()=>{s({atThreshold:t,contentSize:a.contentSize,dataLength:a.dataLength,scrollPosition:a.scrollPosition})};return o?IC(e,t,n)?(s(void 0),!1):(d&&(!r||r.atThreshold!==t||r.contentSize!==a.contentSize||r.dataLength!==a.dataLength)&&c(),!0):d?(i(e),c(),!0):!1};function E4(e,t){let n=e.state;t==="start"?(n.isStartReached=!1,n.startReachedSnapshot=void 0):(n.isEndReached=!1,n.endReachedSnapshot=void 0)}function UN(e){let t=e.state;if(!t.edgeReachedGate)return;let n=uo(e),o=n-t.scroll-t.scrollLength-js(e),r=n<t.scrollLength,a=t.props.onStartReachedThreshold*t.scrollLength,i=t.props.onEndReachedThreshold*t.scrollLength,s=IC(t.scroll,!1,a),l=IC(o,r,i);s&&l&&(t.edgeReachedGate=void 0)}function HN(e,t,n,o){return!e.state.edgeReachedGate||n===t||!!o}function $N(e){e.state.edgeReachedGate="closed"}function nN(e){e.state.edgeReachedGate&&(e.state.edgeReachedGate="prepared")}function R4(e,t){let n=e.state;if(n.edgeReachedGate!=="prepared")return;let o=t<0?"start":"end";return n.edgeReachedGate="closed",E4(e,o),o}function Mu(e){return!!e?.initialScroll&&!e.didFinishInitialScroll}function KN(e,t,n){var o;let r=e.state;if(!r)return;let{queuedInitialLayout:a,scrollLength:i,scroll:s,maintainingScrollAtEnd:l,props:{maintainScrollAtEndThreshold:d,onEndReachedThreshold:c}}=r,f=uo(e);if(UN(e),f>0&&a){let p=js(e),m=f-s-i-p,g=f<i;Be(e,"isAtEnd",g||m<=FN),Be(e,"isNearEnd",g||m<=c*i),Be(e,"isWithinMaintainScrollAtEndThreshold",g||m<=d*i),Mu(r)||l||(r.isEndReached=zN(m,g,c*i,r.isEndReached,r.endReachedSnapshot,{contentSize:f,dataLength:(o=r.props.data)==null?void 0:o.length,scrollPosition:s},v=>{var y,x;HN(e,"end",t,n)&&($N(e),(x=(y=r.props).onEndReached)==null||x.call(y,{distanceFromEnd:v}))},v=>{r.endReachedSnapshot=v}))}}function M4(e,t,n){let o=e?.state;if(!o)return;let{isStartReached:r,props:{data:a,onStartReachedThreshold:i},scroll:s,scrollLength:l,startReachedSnapshot:d,totalSize:c}=o,f=a.length,p=i*l;UN(e),r&&p>0&&s>p&&d&&(d.contentSize!==c||d.dataLength!==f)&&(o.isStartReached=!1,o.startReachedSnapshot=void 0),Be(e,"isAtStart",s<=FN),Be(e,"isNearStart",s<=p),Mu(o)||o.scrollingTo||(o.isStartReached=zN(s,!1,p,o.isStartReached,d,{contentSize:c,dataLength:f,scrollPosition:s},g=>{var h,v;HN(e,"start",t,n)&&($N(e),(v=(h=o.props).onStartReached)==null||v.call(h,{distanceFromStart:g}))},g=>{o.startReachedSnapshot=g}))}function _g(e,t){let n=!e.state.edgeReachedGate;KN(e,t,n),M4(e,t,n)}function VN(e){var t,n;let o=e.state;(t=o.props)!=null&&t.data&&((n=o.triggerCalculateItemsInView)==null||n.call(o,{forceFullItemPositions:!0})),_g(e)}var N4=6,_4=3,D4=250;function qN(e){e.state.scheduledWork.cancel("adaptiveRender")}function oN(e,t){let n=e.state;qN(e),t<=0?Ou(e,"normal","scroll"):n.scheduledWork.timeout(()=>Ou(e,"normal","scroll"),t,"adaptiveRender")}function Ou(e,t,n){var o,r;be(e,"adaptiveRender")!==t&&(Be(e,"adaptiveRender",t),(r=(o=e.state.props.adaptiveRender)==null?void 0:o.onChange)==null||r.call(o,t,n))}function UC(e){var t,n;qN(e);let o=(n=(t=e.state.props.adaptiveRender)==null?void 0:t.initialMode)!=null?n:"normal";be(e,"adaptiveRender")!==o&&Ou(e,o,"initial")}function O4(e,t,n){var o,r,a;let i=e.state,s=i.props.adaptiveRender,l=be(e,"adaptiveRender");if(be(e,"readyToRender"))if(s){let d=(o=s.enterVelocity)!=null?o:N4,c=(r=s.exitVelocity)!=null?r:_4,f=(a=s.exitDelay)!=null?a:D4,p=l==="light"?c:d,m=n?.forceLight||Math.abs(t)>p?"light":"normal",g=i.scheduledWork.has("adaptiveRender")?"normal":l;m!==g&&(m==="light"?(Ou(e,"light","scroll"),oN(e,f)):l==="light"&&oN(e,f))}else UC(e)}var HC=50;function WN(e,t){var n;let o=e.state.props.drawDistance,r=e.state.initialScroll,a=r!==void 0&&((n=r.viewPosition)!=null?n:0)>0;return t==="visible-first"||t!=="full"&&!be(e,"readyToRender")&&!a?Math.min(o,HC):o}function GN(e){let{state:t}=e;t.props.drawDistance<=HC||t.scheduledWork.has("fullDrawDistancePrewarm")||t.scheduledWork.frame(()=>{var n;return(n=t.triggerCalculateItemsInView)==null?void 0:n.call(t)},"fullDrawDistancePrewarm")}function $C(e,{resetLayout:t,resetInitialScroll:n}){let{state:o}=e;t&&(o.didContainersLayout=!1,o.queuedInitialLayout=!1),n&&(o.didFinishInitialScroll=!1),Be(e,"readyToRender",!1),UC(e)}function KC(e,{didLayout:t,didInitialScroll:n}){let{state:o}=e,{loadStartTime:r,props:{onLoad:a}}=o;t&&(o.didContainersLayout=!0),n&&(o.didFinishInitialScroll=!0),o.didContainersLayout&&o.didFinishInitialScroll&&!be(e,"readyToRender")&&(Be(e,"readyToRender",!0),Ou(e,"normal","ready"),o.props.drawDistance>HC&&GN(e),o.didLoad||(o.didLoad=!0,a&&a({elapsedTimeInMs:Date.now()-r})))}var F4=2e3;function rN(e,t){e.scroll=t,e.scrollPending=t,e.scrollPrev=t}function jN(e){e.scheduledWork.cancel("preservedInitialScroll")}function yd(e){jN(e),e.clearPreservedInitialScrollOnNextFinish=void 0,e.initialScroll=void 0,Ga(e)}function aN(e){var t,n,o;let r=e.state,a=((t=r.initialScrollSession)==null?void 0:t.kind)==="bootstrap"?r.initialScrollSession.bootstrap:void 0;(r.initialScroll||a||(n=r.scrollingTo)!=null&&n.isInitialScroll)&&(a?.frameHandle!==void 0&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(a.frameHandle),(o=r.scrollingTo)!=null&&o.isInitialScroll&&(Mg(r),r.scrollingTo=void 0,r.scrollTargetPinnedRange=void 0),Ng.resetFlags(r),Ga(r,{bootstrap:null}),xd(e))}function xd(e,t){var n,o,r;let a=e.state;if(t?.resolvedOffset!==void 0)rN(a,t.resolvedOffset);else if(t?.syncObservedOffset&&((n=a.initialScrollSession)==null?void 0:n.kind)==="offset"){let s=(r=(o=a.refScroller.current)==null?void 0:o.getCurrentScrollOffset)==null?void 0:r.call(o);typeof s=="number"&&Number.isFinite(s)&&rN(a,s)}let i=()=>{var s,l,d,c,f;let p=((s=a.initialScrollSession)==null?void 0:s.kind)==="bootstrap",m=(c=(d=(l=t?.resolvedOffset)!=null?l:a.scrollPending)!=null?d:a.scroll)!=null?c:0;oo.clear(a),t?.preserveTarget&&a.initialScroll?(a.clearPreservedInitialScrollOnNextFinish=void 0,Ga(a),jN(a),t?.schedulePreservedTargetClear&&a.scheduledWork.timeout(()=>{var g;!a.didFinishInitialScroll||(g=a.scrollingTo)!=null&&g.isInitialScroll||!a.initialScroll||yd(a)},F4,"preservedInitialScroll")):yd(a),t?.recalculateItems&&VN(e),KC(e,{didInitialScroll:!0}),p&&L4(e,m),(f=t?.onFinished)==null||f.call(t)};if(t?.waitForCompletionFrame){requestAnimationFrame(i);return}i()}function Dg(e,t){let n=e.state;return t!==void 0&&n.positions[t]||0}function B4(e){let{state:t}=e;return(t.props.horizontal?(ja(t)?t.props.stylePaddingRight:t.props.stylePaddingLeft)||0:be(e,"stylePaddingTop")||0)+(be(e,"alignItemsAtEndPadding")||0)+(be(e,"headerSize")||0)}function jt(e,t){let{data:n,keyExtractor:o}=e.props;if(!n)return"";let a=t<n.length?o?o(n[t],t):t:null;return e.idCache[t]=a,a}function z4(e){var t,n,o;let{state:r,values:a}=e;return(a.get("headerSize")||0)+(a.get("footerSize")||0)+((o=(n=(t=r.pendingTotalSize)!=null?t:r.totalSize)!=null?n:a.get("totalSize"))!=null?o:0)+(r.props.stylePaddingTop||0)+(r.props.stylePaddingBottom||0)}function U4(e){let{state:t}=e;return!!t.props.alignItemsAtEndPaddingEnabled&&!t.props.horizontal&&t.props.data.length>0&&t.scrollLength>0?Math.max(0,t.scrollLength-z4(e)-js(e)):0}function Js(e){let t=be(e,"alignItemsAtEndPadding")||0,n=U4(e);t!==n&&Be(e,"alignItemsAtEndPadding",n)}function Nu(e,t,n,o=!0){let r=e.state,a=r.totalSize,i=r.totalSize;t===null?(i=n,r.timeoutSetPaddingTop&&(clearTimeout(r.timeoutSetPaddingTop),r.timeoutSetPaddingTop=void 0)):i+=n,a!==i?(r.pendingTotalSize=void 0,r.totalSize=i,o&&Be(e,"totalSize",i),Js(e)):o&&e.values.get("totalSize")!==i&&Be(e,"totalSize",i)}function TC(e,t,n,o=!0){let r=e.state,{sizes:a}=r,i=a.get(t),s=i!==void 0?n-i:n;s!==0&&Nu(e,t,s,o),a.set(t,n)}function QN(e){return typeof e=="function"}function Og(e){return Array.isArray(e)}var iN=new Set;function Gs(e,t){Zo&&!iN.has(e)&&(iN.add(e),console.warn(`[legend-list] ${t}`))}function Fu(e){return Math.floor(e*8)/8}function _u(e){return e==null}function sN(e,t){var n,o,r;let a=t==="Left"||t==="Right"?e.paddingHorizontal:e.paddingVertical;return(r=(o=(n=e[`padding${t}`])!=null?n:a)!=null?o:e.padding)!=null?r:0}function Ru(e,t,n){return sN(e,n)+sN(t,n)}function kC(e,t){var n,o;let r=(o=(n=e.state)==null?void 0:n.containerItemKeys)==null?void 0:o.get(t);if(r!==void 0)return r;let a=be(e,"numContainers");for(let i=0;i<a;i++)if(be(e,`containerItemKey${i}`)===t)return i;return-1}function XN(e,t,n,o,r){var a,i;let s=e.state,{getFixedItemSize:l,getItemType:d}=s.props,c=t?s.sizesKnown.get(t):void 0;if(c===void 0&&t&&l){let f=(i=r?.itemType)!=null?i:d&&(a=d(o,n))!=null?a:"",p=r?.didResolveFixedItemSize?r.fixedItemSize:l(o,n,f);p!==void 0&&(c=p+e.scrollAxisGap,s.sizesKnown.set(t,c))}return c}function YN(e,t){let n=jt(e.state,t);return XN(e,n,t,e.state.props.data[t])}function H4(e,t,n){for(let o=t;o<=n;o++)if(YN(e,o)===void 0)return!1;return!0}function fo(e,t,n,o,r,a,i,s){var l,d,c,f;let p=e.state,{sizes:m,averageSizes:g,props:{estimatedItemSize:h,getItemType:v},scrollingTo:y}=p,x=p.sizesKnown.get(t);if(x!==void 0)return x;let C,w=m.get(t);if(a&&w!==void 0)return w;if(C=XN(e,t,n,o,s),C!==void 0)return TC(e,t,C,i),C;let L=(d=s?.itemType)!=null?d:v&&(l=v(o,n))!=null?l:"";if(r&&!y){let S=(c=g[L])==null?void 0:c.avg;S!==void 0&&(C=Fu(S))}if(C===void 0&&w!==void 0)return w;if(C===void 0&&r&&y){let S=(f=y.averageSizeSnapshot)==null?void 0:f[L];S!==void 0&&(C=Fu(S))}return C===void 0&&(C=h+e.scrollAxisGap),TC(e,t,C,i),C}function VC(e,t){if(t===void 0||t<0)return;let n=jt(e.state,t);return fo(e,n,t,e.state.props.data[t])}function Fg(e,t,n){var o;let r=e.state,{index:a,viewOffset:i,viewPosition:s}=n,l=t;if(i&&(l-=i),a!==void 0){let d=B4(e);d&&(l+=d)}if(s!==void 0&&a!==void 0){let d=r.props.data.length;if(d===0)return l;let c=a<0||a>=d,f=(o=r.props.estimatedItemSize)!=null?o:0,p=c?f:fo(e,jt(r,a),a,r.props.data[a]),m=Math.max(0,p-(c?0:e.scrollAxisGap)),g=js(e);if(l-=s*(r.scrollLength-g-m),!c&&a===r.props.data.length-1){let h=be(e,"footerSize")||0;l+=h}}return l}function Bi(e,t,n){let o=e.state,r=uo(e),a=t;if(Number.isFinite(r)&&Number.isFinite(o.scrollLength)&&Wa.OS!=="android"){let i=Math.max(0,r-o.scrollLength),s=n?.viewOffset,l=typeof s=="number"&&s<0?-s:0,d=i+l;a=Math.min(t,d)}return a=Math.max(0,a),a}function Bu(e){var t,n;let o=e.state;if(o?.scrollingTo){Mg(o);let r=o.pendingScrollResolve;o.pendingScrollResolve=void 0;let a=o.scrollingTo;if(o.scrollHistory.length=0,o.scrollingTo=void 0,o.scrollTargetPinnedRange=void 0,o.pendingTotalSize!==void 0&&Nu(e,null,o.pendingTotalSize),o.scrollAdjustHandler.commitPendingAdjust(a),a.isInitialScroll||o.initialScroll){let i=((t=o.initialScrollSession)==null?void 0:t.kind)==="offset",s=!!a.isInitialScroll&&!o.clearPreservedInitialScrollOnNextFinish&&o.props.data.length>0&&((n=o.initialScroll)==null?void 0:n.viewPosition)===1;xd(e,{onFinished:()=>{r?.()},preserveTarget:i&&o.props.data.length===0||s,recalculateItems:!0,schedulePreservedTargetClear:s,syncObservedOffset:i,waitForCompletionFrame:!!a.waitForInitialScrollCompletionFrame});return}VN(e),r?.()}}var $4=80,K4=1500,V4=320,q4=1;function W4(e,t){var n,o;let r=e.state,{animated:a,horizontal:i,offset:s}=t;r.scheduledWork.cancel("platformScrollCompletion");let l=r.refScroller.current,d=l?.getScrollableNode();if(!l||!d)return;let c=!!a,f=!!i,p=f?uo(e):void 0,m=f?BC(r,s,p):0,g=f?0:s;if(l.scrollTo({animated:c,x:m,y:g}),c){let h=(o=(n=l.getScrollEventTarget)==null?void 0:n.call(l))!=null?o:null;G4(e,{readOffset:()=>l.getCurrentScrollOffset(),target:h,targetOffset:s})}else{r.scroll=s;let h=r.scrollingTo;r.scheduledWork.timeout(()=>{h===r.scrollingTo&&Bu(e)},100,"platformScrollCompletion")}}function G4(e,t){let{readOffset:n,target:o,targetOffset:r}=t;if(!o){Bu(e);return}let a="onscrollend"in o,i,s=!1,{scheduledWork:l,scrollingTo:d}=e.state,c=setTimeout(()=>m("max"),K4),f=()=>{o.removeEventListener("scroll",g),a&&o.removeEventListener("scrollend",h),i!==void 0&&clearTimeout(i),clearTimeout(c)},p=()=>{s||(s=!0,f())},m=v=>{if(s)return;if(d!==e.state.scrollingTo){l.cancel("platformScrollCompletion");return}let y=n(),x=Math.abs(y-r)<=q4;v==="scrollend"&&!x||(l.cancel("platformScrollCompletion"),Bu(e))},g=()=>{i!==void 0&&clearTimeout(i),i=setTimeout(()=>m("idle"),$4)},h=()=>m("scrollend");o.addEventListener("scroll",g),a?o.addEventListener("scrollend",h):i=setTimeout(()=>m("idle"),V4),l.register("platformScrollCompletion",p)}function Cd(e){let t=e.state,{didContainersLayout:n,pendingNativeMVCPAdjust:o,refScroller:r,props:{maintainScrollAtEnd:a}}=t,s=!!(be(e,"isWithinMaintainScrollAtEndThreshold")&&a&&n);if(o)return t.pendingMaintainScrollAtEnd=s,!1;if(s){if(t.pendingMaintainScrollAtEnd=!1,uo(e)<t.scrollLength&&(t.scroll=0),t.maintainingScrollAtEnd)t.pendingMaintainScrollAtEnd=!0;else{let d=a.animated?"pending-animated":"pending-instant",c=a.animated?"animated":"instant",f=t.scroll;t.maintainingScrollAtEnd=d,requestAnimationFrame(()=>{let p=be(e,"isWithinMaintainScrollAtEndThreshold"),m=t.scroll!==f;if(p||!m){t.maintainingScrollAtEnd=c;let g=r.current;if(t.props.horizontal&&ja(t)){let h=uo(e),v=s4(t,h),y=BC(t,v,h);g?.scrollTo({animated:a.animated,x:y,y:0})}else g?.scrollToEnd({animated:a.animated});setTimeout(()=>{t.maintainingScrollAtEnd===c&&(t.maintainingScrollAtEnd=void 0,t.pendingMaintainScrollAtEnd&&Cd(e))},a.animated?500:0)}else t.maintainingScrollAtEnd===d&&(t.maintainingScrollAtEnd=void 0,t.pendingMaintainScrollAtEnd=!1)})}return!0}return t.pendingMaintainScrollAtEnd=!1,!1}function Zs(e,t,n){let o=e.state;if(Math.abs(t)>.1){let r=()=>{o.scrollAdjustHandler.requestAdjust(t),o.adjustingFromInitialMount&&o.adjustingFromInitialMount--};o.scroll+=t,o.scrollForNextCalculateItemsInView=void 0,be(e,"readyToRender")?r():(o.adjustingFromInitialMount=(o.adjustingFromInitialMount||0)+1,requestAnimationFrame(r))}}var To=.1,j4=300,Q4=2,X4=1;function Y4(e,t,n,o){if(!t){e.mvcpAnchorLock=void 0;return}let r=e.mvcpAnchorLock;if(!r)return;let a=o>r.expiresAt,i=e.indexByKey.get(r.id)===void 0;if(a||i||!n){e.mvcpAnchorLock=void 0;return}return r}function J4(e,t){{let{anchorId:n,anchorPosition:o,dataChanged:r,now:a,positionDiff:i}=t,s=!!r||!!e.mvcpAnchorLock,l=e.props.maintainVisibleContentPosition.data;if(!s||!l||e.scrollingTo||!n||o===void 0)return;let d=e.mvcpAnchorLock,c=!r&&Math.abs(i)<=To&&d?.id===n?d.quietPasses+1:0;if(!r&&c>=Q4){e.mvcpAnchorLock=void 0;return}e.mvcpAnchorLock={expiresAt:a+j4,id:n,position:o,quietPasses:c}}}function Z4(e,t,n,o,r,a){return!1}function eW(e,t,n){if(Math.abs(t)<=To)return 0;let r=Math.max(0,n-e.scrollLength)-e.scroll;return t<0?Math.max(t,Math.min(0,r)):t>0?Math.min(t,Math.max(0,r)):0}function tW(e,t){return e<0?-t:t}function yC(e,t,n){let o=e.state;o.pendingNativeMVCPAdjust=void 0;let r=t-n;Math.abs(r)>To&&Zs(e,r)}function nW(e){let t=e.state,n=t.pendingNativeMVCPAdjust;if(!n||Math.abs(n.manualApplied)>To)return;let o=uo(e),r=eW(t,n.amount,o);if(Math.abs(r)<=To)return;let a=n.amount-r;Math.abs(a)<=To||(n.manualApplied=a,Zs(e,a),n.furthestProgressTowardAmount=0)}function oW(e,t){let n=e.state,o=n.pendingNativeMVCPAdjust;if(!o)return!1;let r=o.amount-o.manualApplied,a=t-(o.startScroll+o.manualApplied),i=r<0&&a>To||r>0&&a<-To,s=tW(r,a);if(Math.abs(r)<=To)return n.pendingNativeMVCPAdjust=void 0,!0;if(i)return n.pendingNativeMVCPAdjust=void 0,!1;if(s+To>=Math.abs(r))return yC(e,r,a),!0;let l=Math.max(0,uo(e)-n.scrollLength);return Math.abs(t-l)<=X4||n.pendingMaintainScrollAtEnd&&be(e,"isWithinMaintainScrollAtEndThreshold")&&s>To?(yC(e,r,a),!0):s>o.furthestProgressTowardAmount+To?(o.furthestProgressTowardAmount=s,!1):(o.furthestProgressTowardAmount>To&&s<o.furthestProgressTowardAmount-To&&(n.pendingNativeMVCPAdjust=void 0),!1)}function rW(e,t){let n=e.state,{idsInView:o,positions:r,props:a}=n,{maintainVisibleContentPosition:{data:i,size:s,shouldRestorePosition:l}}=a,d=Date.now(),c=!!t||!!n.mvcpAnchorLock,f=n.scrollingTo;if(t&&n.pendingScrollToEnd&&f===void 0){n.mvcpAnchorLock=void 0;return}let p=Y4(n,c,i,d),m,g,h=[],v=f?.index,y=f?.viewPosition,x=v!==void 0&&n.props.data.length>0&&v>=n.props.data.length-1&&(y??0)>0,C=t?i:s,w=n.indexByKey,L=n.scroll;if(uo(e),C){if(p&&v===void 0?(g=p.id,m=p.position):v!==void 0?g=jt(n,v):o.length>0&&n.didContainersLayout&&!t&&(g=o.find(S=>w.get(S)!==void 0)),t&&o.length>0&&n.didContainersLayout)for(let S=0;S<o.length;S++){let k=o[S],I=w.get(k);if(I!==void 0){let T=r[I];T!==void 0&&h.push({id:k,position:T})}}if(g!==void 0&&m===void 0){let S=w.get(g);S!==void 0&&(m=r[S])}return()=>{let S=0,k=p?.id,I,T=!1,A=n.props.data;if(t&&i&&v===void 0&&g!==void 0&&p?.id===g&&l!==void 0&&g!==void 0){let E=w.get(g);if(E!==void 0){let F=A[E];T=F===void 0||!l(F,E,A),T&&p?.id===g&&(n.mvcpAnchorLock=void 0)}}if(t&&i&&v===void 0&&(()=>{if(g===void 0||T)return!0;let E=w.get(g);return E===void 0||r[E]===void 0})())for(let E=0;E<h.length;E++){let{id:F,position:B}=h[E],V=w.get(F);if(V!==void 0&&l){let Se=A[V];if(Se===void 0||!l(Se,V,A))continue}let Q=V!==void 0?r[V]:void 0;if(Q!==void 0){S=Q-B,k=F,I=Q;break}}if(!T&&g!==void 0&&m!==void 0){let E=w.get(g),F=E!==void 0?r[E]:void 0;if(F!==void 0){let B=uo(e),V=F-m;if(V!==0&&x&&n.scroll+n.scrollLength>B)if(V>0)V=Math.max(0,B-n.scroll-n.scrollLength);else{let Q=Math.max(0,B-n.scrollLength);n.scroll=Q,n.scrollPending=Q,V=0}S=V,k=g,I=F}}if(y&&y>0){let E=fo(e,g,v,n.props.data[v]),F=f?.itemSize;if(E!==void 0&&F!==void 0&&E!==F){let B=E-F;B!==0&&(S+=B*y,f.itemSize=E)}}if(J4(n,{anchorId:k,anchorPosition:I,dataChanged:t,now:d,positionDiff:S}),Z4()){n.pendingNativeMVCPAdjust={amount:S,furthestProgressTowardAmount:0,manualApplied:0,startScroll:L},nW(e);return}Math.abs(S)>To&&((n.maintainingScrollAtEnd==="pending-animated"||n.maintainingScrollAtEnd==="animated")&&be(e,"isWithinMaintainScrollAtEndThreshold")||Zs(e,S))}}}var lN=1e3,aW=200,Bg=e=>{let{scrollHistory:t}=e,n=t.length-1;if(n<1)return 0;let o=t[n];if(Date.now()-o.time>lN)return 0;let r=0,a=0,i=0;for(let s=n;s>0;s--){let l=t[s],d=t[s-1],c=l.scroll-d.scroll,f=l.time-d.time,p=Math.sign(c);if(p!==0){if(r===0)r=p;else if(p!==r)break}if(o.time-d.time>lN)break;if(c===0||f<=0)continue;let m=o.time-l.time,g=Math.exp(-m/aW);a+=c/f*g,i+=g}return i>0?a/i:0};function iW(e){let t=e.mvcpAnchorLock;return t?Date.now()>t.expiresAt?(e.mvcpAnchorLock=void 0,!1):!0:!1}function Ku(e){return e.dataChangeNeedsScrollUpdate||iW(e)}function Qs(e,t,n,o){var r;let a=e.state,{ignoreScrollFromMVCP:i,lastScrollAdjustForHistory:s,scrollAdjustHandler:l,scrollHistory:d,scrollingTo:c}=a,f=a.scroll;o?.markHasScrolled!==!1&&(a.hasScrolled=!0);let p=Date.now();a.lastBatchingAction=p;let m=l.getAdjust(),g=s!==void 0&&Math.abs(m-s)>.1;if(g&&(d.length=0),a.lastScrollAdjustForHistory=m,c===void 0&&!(d.length===0&&t===a.scroll)&&(g||d.push({scroll:t,time:p})),d.length>5&&d.shift(),i&&!c){let{lt:T,gt:A}=i;if(T&&t<T||A&&t>A){a.ignoreScrollFromMVCPIgnored=!0;return}}a.scrollPrev=f,a.scrollPrevTime=a.scrollTime,a.scroll=t,a.scrollTime=p;let h=Math.abs(t-f),y=!!o?.fromNativeScrollEvent&&h>.1&&!g&&c===void 0&&!a.pendingNativeMVCPAdjust?R4(e,t-f):void 0,x=oW(e,t),C=a.scrollLength,w=C>0&&c===void 0&&h>C&&!a.pendingNativeMVCPAdjust,L=Bg(a);O4(e,L,{forceLight:w});let S=a.scrollLastCalculate;if(Ku(a)||x||y!==void 0||n||S===void 0||Math.abs(a.scroll-S)>2){a.scrollLastCalculate=a.scroll,a.ignoreScrollFromMVCPIgnored=!1,a.lastScrollDelta=h;let T=()=>{var P;let _={doMVCP:c!==void 0,scrollVelocity:L};w&&(_.drawDistanceMode="visible-first"),(P=a.triggerCalculateItemsInView)==null||P.call(a,_),_g(e,y)};w?(a.mvcpAnchorLock=void 0,a.pendingNativeMVCPAdjust=void 0,a.userScrollAnchorReset={keys:new Set},a.scheduledWork.cancel("mvcpRecalculate"),(0,MN.flushSync)(T),GN(e)):T();let A=!!a.pendingMaintainScrollAtEnd||!!((r=a.props.maintainScrollAtEnd)!=null&&r.onDataChange);x&&A&&(a.pendingMaintainScrollAtEnd=!1,Cd(e)),a.dataChangeNeedsScrollUpdate=!1,a.lastScrollDelta=0}}function sW(e){if(Object.keys(e.averageSizes).length===0)return;let t={};for(let n in e.averageSizes){let o=e.averageSizes[n];t[n]=o.avg}return t}function lW(e,t){var n;let{isInitialScroll:o,requestedOffset:r,targetOffset:a}=t,i=oo.get(e),s=!e.didFinishInitialScroll&&(o||!!i)&&oo.hasNonZeroTargetOffset(a),l=!e.didFinishInitialScroll&&!!i&&oo.isAtZeroTargetOffset(r);if(s){e.hasScrolled=!1,oo.set(e,{startScroll:(n=i?.startScroll)!=null?n:e.scroll,targetOffset:a});return}l&&oo.clear(e)}function dW(e,t){let n=e.state,o=n.props.data.length,r=0,a=o-1,i;for(;r<=a;){let s=Math.floor((r+a)/2),l=n.positions[s];l===void 0?a=s-1:l<=t?(i=s,r=s+1):a=s-1}return i}function dN(e,t){var n;let o=e.state.positions[t];if(o===void 0)return;let r=(n=VC(e,t))!=null?n:0;return o+(Number.isFinite(r)?r:0)}function cW(e,t,n){let o=e.state,r=o.props.data.length;if(r===0)return;let a=Math.max(0,t),i=Math.max(a,t+o.scrollLength),s=n!==void 0?Math.max(0,Math.min(r-1,n)):dW(e,a);if(s===void 0)return;if(n!==void 0&&o.positions[s]===void 0)return{end:s,start:s};if(n===void 0){let d=dN(e,s);if(d===void 0||d<=a)return}for(;s>0;){let d=o.positions[s];if(d===void 0||d<=a||o.positions[s-1]===void 0)break;s--}for(;s>0;){let d=dN(e,s-1);if(d===void 0||d<=a)break;s--}let l=s;for(;l+1<r;){let d=o.positions[l+1];if(d===void 0||d>i)break;l++}return{end:l,start:s}}function uW(e,t,n){let o=cW(e,t,n);o?(e.state.scrollTargetPinnedRange=o,e.state.scrollForNextCalculateItemsInView=void 0):e.state.scrollTargetPinnedRange=void 0}function zg(e,t){var n,o;let r=e.state,{noScrollingTo:a,forceScroll:i,...s}=t,{animated:l,isInitialScroll:d,offset:c,precomputedWithViewOffset:f,waitForInitialScrollCompletionFrame:p}=s,{props:{horizontal:m}}=r;Mg(r);let g=f?c:Fg(e,c,s),h=!!d&&((n=r.initialScrollSession)==null?void 0:n.kind)==="offset",v=Bi(e,g,s),y=h?g:v;if(r.scrollHistory.length=0,!a){d&&Ng.resetFlags(r);let x=sW(r);r.scrollingTo={...s,...x?{averageSizeSnapshot:x}:{},targetOffset:v,waitForInitialScrollCompletionFrame:p},d||uW(e,v,s.index)}r.scrollPending=v,lW(r,{isInitialScroll:d,requestedOffset:y,targetOffset:v}),!d&&!a&&Math.abs(r.scroll-v)>1&&(l?r.scrollTargetPinnedRange&&((o=r.triggerCalculateItemsInView)==null||o.call(r)):Qs(e,v,!0,{markHasScrolled:!1})),i||!d||Wa.OS==="android"?W4(e,{animated:l,horizontal:m,offset:y}):r.scroll=y}function JN(e,t){return t<=0?-1:e>=t?t-1:e<0?0:e}function wg(e,{index:t,viewOffset:n=0,animated:o=!0,forceScroll:r,isInitialScroll:a,viewPosition:i}){let s=e.state,{data:l}=s.props;t=JN(t,l.length);let d=VC(e,t),c=Dg(e,t);t===l.length-1&&i===void 0&&(i=1),s.scrollForNextCalculateItemsInView=void 0,zg(e,{animated:o,forceScroll:r,index:t,isInitialScroll:a,itemSize:d,offset:c,viewOffset:n,viewPosition:i??0})}function Ug(e,t){let{forceScroll:n,resolvedOffset:o,target:r,waitForCompletionFrame:a}=t,i=r.index,s=i!==void 0?JN(i,e.state.props.data.length):void 0,l=VC(e,s);zg(e,{animated:!1,forceScroll:n,index:s!==void 0&&s>=0?s:void 0,isInitialScroll:!0,itemSize:l,offset:o,precomputedWithViewOffset:!0,viewOffset:r.viewOffset,viewPosition:r.viewPosition,waitForInitialScrollCompletionFrame:a})}function Xs(e,t,n){var o;let{state:r}=e;r.clearPreservedInitialScrollOnNextFinish=void 0,r.scheduledWork.cancel("preservedInitialScroll"),r.initialScroll=t,n?.resetDidFinish&&$C(e,{resetInitialScroll:!0}),Ga(r,{kind:((o=r.initialScrollSession)==null?void 0:o.kind)==="offset"?"offset":"bootstrap"})}function Kr(e,t){var n,o;if(((n=e.state.initialScrollSession)==null?void 0:n.kind)==="offset")return(o=t.contentOffset)!=null?o:0;let a=t.index!==void 0?Dg(e,t.index):0,i=Fg(e,a,t);return Bi(e,i,t)}function ZN(e,t){let{didFinishInitialScroll:n,queuedInitialLayout:o,scrollingTo:r}=e,a=e.initialScroll,i=!!r?.isInitialScroll,s=!!t?.requiresMeasuredLayout&&!o&&!i;if(!(!a||s||n||r&&!i))return{initialScroll:a,isInitialScrollInProgress:i,queuedInitialLayout:o,scrollingTo:r}}function fW(e,t){var n,o,r;let a=e.state,i=ZN(a,{requiresMeasuredLayout:!0});if(!i)return!1;let{initialScroll:s,isInitialScrollInProgress:l,queuedInitialLayout:d}=i,c=l?i.scrollingTo:void 0,f=Kr(e,s),p=c?(n=c.targetOffset)!=null?n:c.offset:void 0,m=s.contentOffset===void 0||Math.abs(s.contentOffset-f)>1,g=p!==void 0&&Math.abs(p-f)>1,h=p!==void 0&&Math.abs(a.scroll-f)<=1&&Math.abs(a.scrollPending-f)<=1;if(!t?.forceScroll&&!m&&l&&!g||t?.forceScroll&&h)return!1;m&&((o=a.initialScrollSession)==null?void 0:o.kind)!=="offset"&&Xs(e,{...s,contentOffset:f});let v=(r=t?.forceScroll)!=null?r:!!d||l&&m;return Ug(e,{forceScroll:v,resolvedOffset:f,target:s}),!0}function pW(e,t){var n,o;let r=e.state,a=ZN(r);if(!a)return!1;let{initialScroll:i,queuedInitialLayout:s}=a,l=(n=i.contentOffset)!=null?n:0,d=Math.abs(r.scroll-l)<=1&&Math.abs(r.scrollPending-l)<=1;if(t?.forceScroll&&d)return!1;let c=!!r.lastLayout&&r.scrollLength>0,f=(o=t?.forceScroll)!=null?o:c||!!s;return Ug(e,{forceScroll:f,resolvedOffset:l,target:i}),!0}function zu(e,t){var n;return((n=e.state.initialScrollSession)==null?void 0:n.kind)==="offset"?pW(e,{forceScroll:t?.forceScroll}):fW(e,{forceScroll:t?.forceScroll})}function Du(e,t,n){if(t==null||n==null||t<0||n<t)return!1;let o=!1;for(let r of e.containerItemKeys.keys()){let a=e.indexByKey.get(r);if(a!==void 0&&a>=t&&a<=n){o=!0;let i=jt(e,a);if(i===void 0||!e.sizesKnown.has(i))return!1}}return o}var Hg=1,mW=8,gW=24,hW="LegendList bootstrap initial scroll aborted after exceeding convergence bounds.";function Cr(e){var t;return((t=e.initialScrollSession)==null?void 0:t.kind)==="bootstrap"?e.initialScrollSession.bootstrap:void 0}function el(e){var t;return((t=e.initialScrollSession)==null?void 0:t.kind)==="offset"}function vW(e,t){if(!e||e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function yW(e){let{dataLength:t,getSize:n,offset:o,positions:r,scrollLength:a,startIndex:i}=e,s=o+a,l=[],d=i!==void 0?Math.max(0,Math.min(t-1,i)):0;for(;d>0;){let c=d-1,f=r[c];if(f===void 0){d=c;continue}let p=n(c);if(p===void 0){d=c;continue}if(f+p<=o)break;d=c}for(;d<t;d++){let c=r[d];if(c===void 0)continue;let f=n(d);if(f!==void 0){if(c<s&&c+f>o)l.push(d);else if(l.length>0&&c>=s)break}}return l}function xW(e){let{mountFrameCount:t,maxFrames:n=mW,maxPasses:o=gW,passCount:r}=e;return t>=n||r>=o}function e_(e,t){return xW(t)?(Zo&&console.warn(hW),MW(e),!0):!1}function Uu(e){var t;let n=Cr(e),o=n?.frameHandle;o!==void 0&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(o),n&&(n.frameHandle=void 0),Ga(e,{bootstrap:null,kind:(t=e.initialScrollSession)==null?void 0:t.kind})}function t_(e,t){var n,o,r;let a=Cr(e);Ga(e,{bootstrap:{frameHandle:a?.frameHandle,mountFrameCount:(n=a?.mountFrameCount)!=null?n:0,passCount:0,previousResolvedOffset:void 0,scroll:t.scroll,seedContentOffset:(r=(o=t.seedContentOffset)!=null?o:a?.seedContentOffset)!=null?r:t.scroll,targetIndexSeed:t.targetIndexSeed,visibleIndices:void 0},kind:"bootstrap"})}function CW(e,t){var n,o,r;let a=Cr(e);a?(a.passCount=0,a.previousResolvedOffset=void 0,a.scroll=(n=t?.scroll)!=null?n:a.scroll,a.seedContentOffset=(o=t?.seedContentOffset)!=null?o:a.seedContentOffset,a.targetIndexSeed=(r=t?.targetIndexSeed)!=null?r:a.targetIndexSeed,a.visibleIndices=void 0,Ga(e,{bootstrap:a,kind:"bootstrap"})):t?.scroll!==void 0&&t_(e,{scroll:t.scroll,seedContentOffset:t.seedContentOffset,targetIndexSeed:t.targetIndexSeed})}function LC(e){requestAnimationFrame(()=>{var t;Cr(e)&&((t=e.triggerCalculateItemsInView)==null||t.call(e,{forceFullItemPositions:!0}))})}function qC(e){let t=e.state,n=Cr(t);if(!n||n.frameHandle!==void 0)return;let o=()=>{let r=Cr(t);r&&(r.frameHandle=void 0,r.mountFrameCount+=1,!e_(e,{mountFrameCount:r.mountFrameCount,passCount:r.passCount})&&qC(e))};n.frameHandle=requestAnimationFrame(o)}function kg(e,t){CW(e.state,t),qC(e),LC(e.state)}function WC(e){let{dataLength:t,footerSize:n,preserveForFooterLayout:o,stylePaddingEnd:r}=e;return{contentOffset:void 0,index:Math.max(0,t-1),preserveForBottomPadding:!0,preserveForFooterLayout:o,viewOffset:-r-n,viewPosition:1}}function bW(e){return!!e?.preserveForBottomPadding}function Ys(e){return!!e?.preserveForFooterLayout}function n_(e){return!!(e&&e.viewPosition===1&&(bW(e)||Ys(e)))}function wW(e){let{dataLength:t,footerSize:n,initialScrollAtEnd:o,stylePaddingEnd:r,target:a}=e,i=Ys(a);return{...a,contentOffset:void 0,index:o?Math.max(0,t-1):a.index,preserveForBottomPadding:!0,preserveForFooterLayout:i,viewOffset:-r-(i?n:0),viewPosition:1}}function SW(e,t){return e.index===t.index&&e.preserveForBottomPadding===t.preserveForBottomPadding&&e.preserveForFooterLayout===t.preserveForFooterLayout&&e.viewOffset===t.viewOffset&&e.viewPosition===t.viewPosition}function Lg(e,t){let{dataLength:n,stylePaddingEnd:o,target:r}=t;if(!Ys(r))return;let a=WC({dataLength:n,footerSize:0,preserveForFooterLayout:void 0,stylePaddingEnd:o});Xs(e,a)}function IW(e){yd(e)}function GC(e,t,n=Hg){let o=e.state;if(!o.didFinishInitialScroll)return!1;let r=Hu(o);return Math.abs(r-Kr(e,t))>n}function Hu(e){var t,n,o,r;let a=(n=(t=e.refScroller.current)==null?void 0:t.getCurrentScrollOffset)==null?void 0:n.call(t);return typeof a=="number"&&Number.isFinite(a)?a:(r=(o=e.scrollPending)!=null?o:e.scroll)!=null?r:0}function o_(e){var t;let n=e.state,o=n.initialScroll;if(!n.didFinishInitialScroll||(t=n.scrollingTo)!=null&&t.isInitialScroll||!o||o.viewPosition!==1||n.props.data.length===0||el(n))return;let r=typeof n.lastNativeScroll=="number"&&Number.isFinite(n.lastNativeScroll)?n.lastNativeScroll:Hu(n);return Kr(e,o)-r}function r_(e){return o_(e)===void 0?!1:(a_(e,{}),!0)}function a_(e,t){let n=e.state;n.preservedEndAnchorCorrection=t,requestAnimationFrame(()=>{var o;let r=n.preservedEndAnchorCorrection;if(r!==t)return;let a=o_(e);if(a===void 0||Math.abs(a)<=Hg){n.preservedEndAnchorCorrection=void 0;return}(!r.lastRequestTime||((o=n.lastNativeScrollTime)!=null?o:0)>r.lastRequestTime)&&(r.lastRequestTime=Date.now(),Zs(e,a)),a_(e,t)})}function TW(e){var t;let n=e.state,o=n.initialScroll;!n.didFinishInitialScroll||(t=n.scrollingTo)!=null&&t.isInitialScroll||o?.viewPosition!==1||n.preservedEndAnchorCorrection||GC(e,o)&&(n_(o)&&be(e,"isAtEnd")||(Ys(o)?Lg(e,{dataLength:n.props.data.length,stylePaddingEnd:FC(n.props),target:o}):IW(n)))}function kW(e,t){var n,o,r;let{initialScrollAtEnd:a,target:i}=t,s=e.state,l=Kr(e,i),d=l===0&&!a&&(el(s)?Math.abs((n=i.contentOffset)!=null?n:0)<=1:i.index===0&&((o=i.viewPosition)!=null?o:0)===0&&Math.abs((r=i.viewOffset)!=null?r:0)<=1),c=s.props.data.length===0&&i.index!==void 0;d?(Uu(s),xd(e,{resolvedOffset:l})):c?(Uu(s),xd(e,{preserveTarget:!0,resolvedOffset:l})):(t_(s,{scroll:l,seedContentOffset:0,targetIndexSeed:i.index}),qC(e))}function LW(e,t){let{dataLength:n,didDataChange:o,initialScrollAtEnd:r,previousDataLength:a,stylePaddingEnd:i}=t,s=e.state,l=s.initialScroll;if(el(s)||!l)return;let d=!!(s.didFinishInitialScroll&&a===0&&n>0&&l.index!==void 0),c=Cr(s);if(!r&&o&&n>0&&s.didFinishInitialScroll&&!c&&!d){yd(s);return}let p=n>0&&(r||n_(l));if(!(!o&&!d&&!p)){if(p){let m=r?WC({dataLength:n,footerSize:be(e,"footerSize")||0,preserveForFooterLayout:Ys(l),stylePaddingEnd:i}):wW({dataLength:n,footerSize:be(e,"footerSize")||0,initialScrollAtEnd:r,stylePaddingEnd:i,target:l});if(!d&&GC(e,l)){Lg(e,{dataLength:n,stylePaddingEnd:i,target:l});return}if(!SW(l,m)||c||d||o){Xs(e,m,{resetDidFinish:d}),kg(e,{scroll:Kr(e,m),seedContentOffset:d&&!c?Hu(s):void 0,targetIndexSeed:m.index});return}}o&&(c||d)&&(Xs(e,l,{resetDidFinish:d}),kg(e,{scroll:Kr(e,l),seedContentOffset:d&&!c?Hu(s):void 0,targetIndexSeed:l.index}))}}function PW(e,t){let{dataLength:n,footerSize:o,initialScrollAtEnd:r,stylePaddingEnd:a}=t,i=e.state;if(!r)return;let s=i.initialScroll;if(!(el(i)||n===0||!s||!(Cr(i)||Ys(s))))if(GC(e,s))Lg(e,{dataLength:n,stylePaddingEnd:a,target:s});else{let d=WC({dataLength:n,footerSize:o,preserveForFooterLayout:Ys(s),stylePaddingEnd:a});if(!(s.index!==d.index||s.viewPosition!==d.viewPosition||s.viewOffset!==d.viewOffset))Lg(e,{dataLength:n,stylePaddingEnd:a,target:s});else{let f=!!i.didFinishInitialScroll;Xs(e,d,{resetDidFinish:f}),kg(e,{scroll:Kr(e,d),targetIndexSeed:d.index})}}}function AW(e){var t,n,o;let r=e.state,a=r.initialScroll,i=Cr(r);if(a&&r.props.data.length>0&&!el(r)&&(i||a.viewPosition===1)){let s=Kr(e,a),l=(t=r.scrollingTo)!=null&&t.isInitialScroll?r.scrollingTo:void 0;if(!i&&(l||r.didFinishInitialScroll)){let d=l?(n=l.targetOffset)!=null?n:l.offset:Hu(r),c=s-d;if(Math.abs(c)>Hg){if(r.didFinishInitialScroll)r_(e);else if(l){let f=oo.get(r);l.offset=s,l.targetOffset=s,r.initialScroll={...a,contentOffset:s},r.hasScrolled=!1,oo.set(r,{startScroll:(o=f?.startScroll)!=null?o:r.scroll,targetOffset:s}),Zs(e,c)}}}else kg(e,{scroll:s,targetIndexSeed:a.index})}}function EW(e){var t,n;let o=e.state,r=Cr(o),a=o.initialScroll;if(!r||!a||el(o)||(t=o.scrollingTo)!=null&&t.isInitialScroll||(r.passCount+=1,e_(e,{mountFrameCount:r.mountFrameCount,passCount:r.passCount})))return;a.index!==void 0&&o.startBuffered>=0&&o.endBuffered>=0&&a.index>=o.startBuffered&&a.index<=o.endBuffered&&(r.targetIndexSeed=void 0);let i=Kr(e,a),s=Du(o,o.startBuffered,o.endBuffered),l=Math.abs(r.scroll-i)>1,{data:d}=o.props,c=yW({dataLength:d.length,getSize:h=>{var v,y;let x=(v=o.idCache[h])!=null?v:jt(o,h);return(y=o.sizes.get(x))!=null?y:fo(e,x,h,d[h])},offset:i,positions:o.positions,scrollLength:o.scrollLength,startIndex:(n=r.targetIndexSeed)!=null?n:o.startBuffered>=0?o.startBuffered:void 0}),f=c.length>0&&c.every(h=>{var v;let y=(v=o.idCache[h])!=null?v:jt(o,h);return o.sizesKnown.has(y)}),p=r.previousResolvedOffset,m=r.visibleIndices;if(r.previousResolvedOffset=i,r.visibleIndices=c,l){r.scroll=i,LC(o);return}if(!s||!f)return;if(!(p!==void 0&&Math.abs(p-i)<=Hg&&vW(m,c))){LC(o);return}Uu(o),Ug(e,{forceScroll:!0,resolvedOffset:i,target:a,waitForCompletionFrame:Wa.OS==="web"})}function RW(e,t){var n;let o=e.state;Uu(o);let r=!o.clearPreservedInitialScrollOnNextFinish&&o.props.data.length>0&&((n=o.initialScroll)==null?void 0:n.viewPosition)===1;xd(e,{preserveTarget:r,recalculateItems:!0,resolvedOffset:t,schedulePreservedTargetClear:r})}function MW(e){var t,n,o,r;let a=e.state,i=Cr(a),s=a.initialScroll;i&&s&&!el(a)&&a.refScroller.current?(Uu(a),Ug(e,{forceScroll:!0,resolvedOffset:i.scroll,target:s,waitForCompletionFrame:Wa.OS==="web"})):RW(e,(r=(o=(n=(t=Cr(a))==null?void 0:t.scroll)!=null?n:a.scrollPending)!=null?o:a.scroll)!=null?r:0)}function i_(e,t,n,o){return{dataChangeEpoch:e.dataChangeEpoch,getFixedItemSize:e.props.getFixedItemSize,getItemType:e.props.getItemType,itemData:n,itemIndex:t,itemType:o}}function NW(e,t,n,o){var r,a;let{getFixedItemSize:i,getItemType:s}=e.props,l=e.containerItemMetadata.get(t),d;if(l?.dataChangeEpoch===e.dataChangeEpoch&&l.getItemType===s&&l.itemData===o&&l.itemIndex===n)d=l;else{let c=s?(r=s(o,n))!=null?r:"":void 0;d=i_(e,n,o,c),e.containerItemMetadata.set(t,d)}return d.getFixedItemSize!==i&&(d.didResolveFixedItemSize=!1,d.fixedItemSize=void 0,d.getFixedItemSize=i),i&&!d.didResolveFixedItemSize&&(d.fixedItemSize=i(o,n,(a=d.itemType)!=null?a:""),d.didResolveFixedItemSize=!0),d}function s_(e){for(let t of e.containerItemMetadata.values())t.didResolveFixedItemSize=!1,t.fixedItemSize=void 0}var _W=20,DW=1,OW=1,xC=16;function jC(e,t){let n=e.state.scrollingTo;t?.onlyIfAligned&&(!n?.isInitialScroll||n.animated||!QC(e,n).isAtResolvedTarget)||e.state.scheduledWork.frame(()=>HW(e),"checkFinishedScrollFrame")}function FW(e,t){let{clampedTargetOffset:n,scrollingTo:o}=t;return!o.isInitialScroll||e.hasScrolled||n<=DW}function BW(e,t){return!!t?.isInitialScroll&&Ng.didDispatchNativeScroll(e)&&!e.hasScrolled}function l_(e){var t;return(t=oo.get(e))==null?void 0:t.targetOffset}function d_(e){let t=l_(e);return!e.didFinishInitialScroll&&oo.hasNonZeroTargetOffset(t)}function cN(e,t){var n,o;if(!t.isInitialScroll||t.animated||!e.didContainersLayout||((n=e.initialScrollSession)==null?void 0:n.kind)==="bootstrap")return!1;let r=(o=t.targetOffset)!=null?o:t.offset;return oo.hasNonZeroTargetOffset(r)&&Ng.didDispatchNativeScroll(e)&&!e.hasScrolled||oo.isAtZeroTargetOffset(r)||Math.abs(e.scroll-r)>1||Math.abs(e.scrollPending-r)>1?!1:!!t.waitForInitialScrollCompletionFrame||d_(e)}function uN(e){var t;let{state:n}=e;return!!((t=n.scrollingTo)!=null&&t.isInitialScroll)&&n.props.data.length>0&&uo(e)<=n.scrollLength&&n.scrollPending<=OW}function zW(e,t){return t.index===e.state.props.data.length-1&&t.viewPosition===1}function UW(e,t){var n;let o=t.index,a=zW(e,t)&&o!==void 0?Fg(e,Dg(e,o),t):(n=t.targetOffset)!=null?n:Bi(e,t.offset-(t.viewOffset||0),t);return Bi(e,a,t)}function QC(e,t){let{state:n}=e,o=n.scrollPending,r=n.scrollAdjustHandler.getAdjust(),a=UW(e,t),i=Bi(e,o,t),s=Math.abs(o-a),l=a+r,d=Math.abs(o-l),c=!t.animated||Wa.OS==="ios";return{clampedTargetOffset:a,isAtResolvedTarget:Math.abs(o-i)<1&&(s<1||c&&d<1)}}function HW(e){let t=e.state.scrollingTo;if(!t)return;let{state:n}=e,o=QC(e,t);o.isAtResolvedTarget&&FW(n,{clampedTargetOffset:o.clampedTargetOffset,scrollingTo:t})&&Bu(e)}function $W(e,t){var n;(n=e.state.refScroller.current)==null||n.scrollTo({animated:!1,x:e.state.props.horizontal?t:0,y:e.state.props.horizontal?0:t})}function KW(e){let t=e.state;if(t.scheduledWork.has("checkFinishedScrollFallback"))return;let n=t.scrollingTo,o=uN(e),r=BW(t,n),a=n!==void 0?cN(t,n):!1,i=n?.isInitialScroll&&!o&&!a||!t.didContainersLayout,s=o||a?0:r?xC:i?500:100,l=0,d=f=>{t.scheduledWork.timeout(c,f,"checkFinishedScrollFallback")},c=()=>{var f,p;let m=t.scrollingTo;if(m){l++;let g=d_(t)&&!t.hasScrolled,h=r?5:g?_W:5,v=uN(e),y=cN(t,m),x=QC(e,m),C=Wa.OS==="android",w=t.hasScrolled&&(!m.isInitialScroll||x.isAtResolvedTarget),L=m.isInitialScroll&&!x.isAtResolvedTarget&&l<=h;if(v||w||y||C||l>h)Bu(e);else if((g||L)&&l<=h){let S=(p=(f=l_(t))!=null?f:m.targetOffset)!=null?p:t.scrollPending;$W(e,S),d(r?xC:100)}else d(r?xC:100)}};d(s)}function c_(e){var t;let n=e.state,o=n.initialScroll;return n.didFinishInitialScroll?r_(e):!o||((t=n.initialScrollSession)==null?void 0:t.kind)==="offset"||o.viewPosition!==1||n.props.data.length===0?!1:zu(e,{forceScroll:!0})}function VW(e){var t;if(!e.state.initialScroll)return;let n=()=>zu(e,{forceScroll:!0});n(),((t=e.state.initialScrollSession)==null?void 0:t.kind)!=="offset"&&requestAnimationFrame(n),jC(e,{onlyIfAligned:!0})}function qW(e,t){var n,o;let{alwaysDispatchInitialScroll:r,dataLength:a,hasFooterComponent:i,initialContentOffset:s,initialScrollAtEnd:l,useBootstrapInitialScroll:d}=t,c=e.state,f=c.initialScroll,p=s??0,m=d&&l&&i;if(f&&(f.contentOffset===void 0||!!f.preserveForFooterLayout!==m&&((n=c.initialScrollSession)==null?void 0:n.kind)!=="offset")&&Xs(e,{...f,contentOffset:p,preserveForFooterLayout:m}),d&&f&&((o=c.initialScrollSession)==null?void 0:o.kind)!=="offset"){kW(e,{initialScrollAtEnd:l,target:c.initialScroll});return}!r&&!p&&!(f&&a===0&&!(p===0&&!l))&&(f&&!l?xd(e,{resolvedOffset:p}):KC(e,{didInitialScroll:!0}))}function WW(e,t){var n,o,r;let{dataLength:a,didDataChange:i,didStartFreshData:s,initialScrollAtEnd:l,latestInitialScroll:d,latestInitialScrollSessionKind:c,stylePaddingEnd:f,useBootstrapInitialScroll:p}=t,m=e.state,g=(o=(n=m.initialScrollSession)==null?void 0:n.previousDataLength)!=null?o:0,h=a>0&&(!m.hasHadNonEmptyData||s);if(a>0&&(m.hasHadNonEmptyData=!0),h&&(d?(Xs(e,d),Ga(m,{kind:c,previousDataLength:g})):yd(m)),m.initialScrollSession&&(m.initialScrollSession.previousDataLength=a),Ga(m),p){LW(e,{dataLength:a,didDataChange:i,initialScrollAtEnd:l,previousDataLength:g,stylePaddingEnd:f});return}let v=g===0&&a>0&&!!m.initialScroll&&((r=e.state.initialScrollSession)==null?void 0:r.kind)==="offset"&&!!m.didFinishInitialScroll;g!==0||a===0||!m.initialScroll||!m.queuedInitialLayout||m.didFinishInitialScroll&&!v||(v&&$C(e,{resetInitialScroll:!0}),zu(e))}function u_(e){e.indexByKey.clear(),e.idCache.length=0,e.positions.length=0,e.columns.length=0,e.columnSpans.length=0}function GW(e){var t;let n=e.pendingContainerIds;if(e.pendingContainerIds=void 0,n===void 0)return;let o=e.state,r=n;if(r&&((t=o.userScrollAnchorReset)!=null&&t.keys.size)){r=new Set(r);for(let a of o.userScrollAnchorReset.keys){let i=o.containerItemKeys.get(a);i!==void 0&&r.add(i)}}return r}function Pg(e,t){var n;let o=e.pendingContainerIds!==void 0,r=e.pendingContainerIds;if(t===void 0)e.pendingContainerIds=null;else if(r!==null){let a=r;if(!a)a=typeof t=="number"?new Set([t]):new Set(t);else if(typeof t=="number")a.add(t);else for(let i of t)a.add(i);e.pendingContainerIds=a}if(!o){let a=((n=be(e,"containerLayoutEpoch"))!=null?n:0)+1;Be(e,"containerLayoutEpoch",a)}}function jW(e,t,n,o){var r,a,i,s,l,d,c,f,p;let m=e.state,{columns:g,columnSpans:h,positions:v,props:{data:y,itemsAreEqual:x,keyExtractor:C}}=m,w=y[n];if(w===void 0)return{didChangePosition:!1,didRefreshData:!1};let L=(r=m.idCache[n])!=null?r:jt(m,n),S=(a=o?.updateLayout)!=null?a:!0,k=!1,I=!1;if(S){let _=v[n];if(_===void 0)return Be(e,`containerPosition${t}`,vd),{didChangePosition:!1,didRefreshData:!1};let E=(_||0)-((i=o?.scrollAdjustPending)!=null?i:0),F=(s=m.sizes.get(L))!=null?s:fo(e,L,n,w),B=l4(m,E,F,be(e,"totalSize")),V=g[n]||1,Q=h[n]||1,Se=be(e,`containerPosition${t}`),H=be(e,`containerColumn${t}`),q=be(e,`containerSpan${t}`);B>vd&&B!==Se&&(Be(e,`containerPosition${t}`,B),k=!0),V>=0&&V!==H&&Be(e,`containerColumn${t}`,V),Q!==q&&Be(e,`containerSpan${t}`,Q)}be(e,`containerItemIndex${t}`)!==n&&Be(e,`containerItemIndex${t}`,n);let A=be(e,`containerItemData${t}`),P=()=>{Be(e,`containerItemData${t}`,w),I=!0};if(A!==w){let _=((l=m.pendingDataComparison)==null?void 0:l.previousData)===m.previousData&&((d=m.pendingDataComparison)==null?void 0:d.nextData)===y?m.pendingDataComparison:void 0,E=(c=_?.byIndex[n])!=null?c:0;if(E===2)P();else if(E!==1){let F=(f=be(e,`containerItemKey${t}`))!=null?f:L,B=C?.(A,n);if(A===void 0||!C||B!==F)P();else if(!x)P();else{let V=x(A,w,n,y);(!m.pendingDataComparison||m.pendingDataComparison.previousData!==m.previousData||m.pendingDataComparison.nextData!==y)&&m.previousData&&(m.pendingDataComparison={byIndex:[],nextData:y,previousData:m.previousData}),(p=m.pendingDataComparison)!=null&&p.byIndex&&(m.pendingDataComparison.byIndex[n]=V?1:2),V||P()}}}return{didChangePosition:k,didRefreshData:I}}function QW(e,t,n){var o;let r=e.state,a=be(e,"numColumns"),i=t;r.columns[t]!==1&&(i=fN(r,a,t));let l=0,d=r.columns[i];if(i>0){let c=i-1,f=(o=r.positions[c])!=null?o:0,p=fN(r,a,c),m=XW(e,p,c,n);l=f+m}return{column:d,currentRowTop:l,startIndex:i}}function fN(e,t,n){if(t<=1)return Math.max(0,n);let o=Math.max(0,n);for(;o>0&&e.columns[o]!==1;)o--;return o}function XW(e,t,n,o){let r=e.state;if(n<t)return 0;let{data:a}=r.props;if(!a)return 0;let i=0;for(let s=t;s<=n;s++){if(s<0||s>=a.length)continue;let l=r.idCache[s],d=fo(e,l,s,a[s],o);d>i&&(i=d)}return i}function YW(e){var t,n;let o=e.state,{positions:r,props:{data:a}}=o,i=(t=be(e,"numColumns"))!=null?t:1;if(a.length===0)Nu(e,null,0);else{let s=a.length-1,l=jt(o,s),d=r[s];if(l!==void 0&&d!==void 0)if(i>1){let c=s;for(;c>0;){let p=o.columns[c];if(p===1||p===void 0)break;c-=1}let f=0;for(let p=c;p<=s;p++){let m=(n=o.idCache[p])!=null?n:jt(o,p),g=fo(e,m,p,a[p]);g>f&&(f=g)}Nu(e,null,d+f)}else{let c=fo(e,l,s,a[s]);if(c!==void 0){let f=d+c;Nu(e,null,f)}}}}function f_(e){let t=e.state,{props:{snapToIndices:n}}=t,o=t.props.horizontal?uo(e):void 0,r=Array(n.length);for(let a=0;a<n.length;a++){let i=n[a];jt(t,i);let s=t.positions[i];r[a]=BC(t,s,o)}Be(e,"snapToOffsets",r)}function p_(e,t,{doMVCP:n,forceFullUpdate:o=!1,optimizeForVisibleWindow:r=!1,scrollBottomBuffered:a,scrollVelocity:i,startIndex:s}={doMVCP:!1,forceFullUpdate:!1,optimizeForVisibleWindow:!1,scrollBottomBuffered:-1,startIndex:0}){var l,d,c,f,p;let m=e.state,g=e.positionListeners.size>0,{columns:h,columnSpans:v,indexByKey:y,positions:x,idCache:C,sizesKnown:w,props:{data:L,overrideItemLayout:S,snapToIndices:k},scrollingTo:I}=m,T=L.length,A=(l=be(e,"numColumns"))!=null?l:1,P=A>1,_=Zo?new Map:void 0,E=be(e,"extraData"),F=S?{span:1}:void 0,B=m.lastScrollDelta,V=i??Bg(m),Q=!o&&!t&&(r||Math.abs(V)>0||m.scrollLength>0&&B>m.scrollLength),Se=a+1e3,H=!0,q=!n||t||m.scrollAdjustHandler.getAdjust()!==0||((d=be(e,"scrollAdjustPending"))!=null?d:0)!==0,ee=!1,G=0,te=1,me=0;if(t&&(v.length=0),P||(h.length&&(h.length=0),v.length&&(v.length=0)),s>0){if(P){let{startIndex:ie,currentRowTop:Ae}=QW(e,s,H);s=ie,G=Ae}else if(s<T){let ie=s-1,Ae=jt(m,ie),Xe=(c=x[ie])!=null?c:0,nt=(f=w.get(Ae))!=null?f:fo(e,Ae,ie,L[ie],H,q,ee);G=Xe+nt}}let U=t||y.size===0,Y=P&&!!S&&!!F,se=!1,ge;for(let ie=s;ie<T;ie++){if(Q&&ge!==void 0&&ie>ge){se=!0;break}Q&&ge===void 0&&!I&&!t&&G>Se&&(ge=ie+(P?A:1)+10);let Ae=(p=C[ie])!=null?p:jt(m,ie),Xe=1;if(Y){F.span=1,S(F,L[ie],ie,A,E);let Ve=F.span;Ve!==void 0&&Number.isFinite(Ve)&&(Xe=Math.max(1,Math.min(A,Math.round(Ve))))}P&&te+Xe-1>A&&(G+=me,te=1,me=0);let nt=w.get(Ae),rt=nt!==void 0?nt:fo(e,Ae,ie,L[ie],H,q,ee);Zo&&U&&(_.has(Ae)&&console.error(`[legend-list] Error: Detected overlapping key (${Ae}) which causes missing items and gaps and other terrrible things. Check that keyExtractor returns unique values.`),_.set(Ae,ie)),G!==x[ie]&&(x[ie]=G,g&&h4(e,Ae,G)),U&&y.set(Ae,ie),P?(h[ie]=te,v[ie]=Xe,rt>me&&(me=rt),te+=Xe,te>A&&(G+=me,te=1,me=0)):G+=rt}se||YW(e),k&&f_(e)}function m_(e,t){let n=e.mapViewabilityConfigStates;n||(n=new Map,e.mapViewabilityConfigStates=n);let o=n.get(t);return o||(o={end:-1,endBuffered:-1,previousEnd:-1,previousStart:-1,start:-1,startBuffered:-1,viewableItems:[]},n.set(t,o)),o}function JW(e){let{viewabilityConfig:t,viewabilityConfigCallbackPairs:n,onViewableItemsChanged:o}=e;return(t||o)&&(n=[...n||[],{onViewableItemsChanged:o,viewabilityConfig:t||{viewAreaCoveragePercentThreshold:0}}]),n}function g_(e,t,n,o,r,a,i=r,s=a){let{props:{data:l}}=e;for(let d of n){let c=m_(t,d.viewabilityConfig.id);c.start=r,c.end=a,c.startBuffered=i,c.endBuffered=s,d.viewabilityConfig.minimumViewTime?e.scheduledWork.timeout(()=>pN(l,d,e,t,o),d.viewabilityConfig.minimumViewTime):pN(l,d,e,t,o)}}function pN(e,t,n,o,r){let{viewabilityConfig:a,onViewableItemsChanged:i}=t,s=a.id,l=m_(o,s),{viewableItems:d,start:c,end:f,startBuffered:p,endBuffered:m}=l,g;for(let[x,C]of o.mapViewabilityAmountValues)h_(n,o,a,x,C.key,r,C.item,C.index).sizeVisible<0&&(g??(g=[]),g.push(x));let h=[],v=new Set;if(d)for(let x of d){v.add(x.key);let C=n.indexByKey.get(x.key),w=C!==void 0?e[C]:void 0,L=kC(o,x.key),S=!1;C!==void 0&&w!==void 0&&(S=gN(n,o,a,L,x.key,r,w,C)),S||h.push({...x,index:C??x.index,isViewable:!1,item:w??x.item})}let y=[];for(let x=c;x<=f;x++){let C=e[x];if(C){let w=jt(n,x),L=kC(o,w);if(gN(n,o,a,L,w,r,C,x)){let S={containerId:L,index:x,isViewable:!0,item:C,key:w};y.push(S),v.has(S.key)||h.push(S)}}}if(Object.assign(l,{previousEnd:f,previousStart:c,viewableItems:y}),h.length>0){l.viewableItems=y;for(let x=0;x<h.length;x++){let C=h[x];ZW(o,s,C.containerId,C)}i&&i({changed:h,end:f,endBuffered:m,start:c,startBuffered:p,viewableItems:y})}if(g)for(let x of g){let C=o.mapViewabilityAmountValues.get(x);C&&C.sizeVisible<0&&o.mapViewabilityAmountValues.delete(x)}}function mN(e,t){return!!e&&e.containerId===t.containerId&&e.index===t.index&&e.isViewable===t.isViewable&&e.item===t.item&&e.key===t.key&&e.percentOfScroller===t.percentOfScroller&&e.percentVisible===t.percentVisible&&e.scrollSize===t.scrollSize&&e.size===t.size&&e.sizeVisible===t.sizeVisible}function h_(e,t,n,o,r,a,i,s){let{sizes:l,scroll:d}=e,c=(be(t,"stylePaddingTop")||0)+(be(t,"alignItemsAtEndPadding")||0)+(be(t,"headerSize")||0),{itemVisiblePercentThreshold:f,viewAreaCoveragePercentThreshold:p}=n,m=p!=null,g=m?p:f,h=d-c,v=e.positions[s],y=l.get(r)||0;if(v===void 0){let _={containerId:o,index:s,isViewable:!1,item:i,key:r,percentOfScroller:0,percentVisible:0,scrollSize:a,size:y,sizeVisible:-1},E=t.mapViewabilityAmountValues.get(o);if(!mN(E,_)){t.mapViewabilityAmountValues.set(o,_);let F=t.mapViewabilityAmountCallbacks.get(o);F&&F(_)}return _}let x=v-h,C=x+y,w=x>=0&&C<=a&&C>x,L=w?y:Math.min(C,a)-Math.max(x,0),S=y?w?100:100*(L/y):0,k=y?100*(L/a):0,T=(w?100:m?k:S)>=g,A={containerId:o,index:s,isViewable:T,item:i,key:r,percentOfScroller:k,percentVisible:S,scrollSize:a,size:y,sizeVisible:L},P=t.mapViewabilityAmountValues.get(o);if(!mN(P,A)){t.mapViewabilityAmountValues.set(o,A);let _=t.mapViewabilityAmountCallbacks.get(o);_&&_(A)}return A}function gN(e,t,n,o,r,a,i,s){let l=t.mapViewabilityAmountValues.get(o);return(!l||l.key!==r||l.index!==s)&&(l=h_(e,t,n,o,r,a,i,s)),l.isViewable}function ZW(e,t,n,o){let r=n+t;e.mapViewabilityValues.set(r,o);let a=e.mapViewabilityCallbacks.get(r);a?.(o)}var hN=RN.unstable_batchedUpdates,eG=typeof hN=="function"?hN:e=>e(),tG=32,nG=64,oG=3;function rG(e,t){if(e<=0||t<=0)return 0;let n=Math.ceil(t*oG),o=t+nG,r=Math.max(t,Math.min(n,o),Math.min(e,tG)),a=Math.max(e,t);return Math.min(a,r)}function aG(e,t){return e<=0||t<=0?0:Math.min(Math.max(e,t),Math.max(t,Math.ceil(t*1.5)))}function iG(e,t,n,o,r,a,i){var s;let l=t.length;if(l===0)return[];let d=be(e,"numContainers"),c=e.state,{containerItemMetadata:f,stickyContainerPool:p}=c,m=c.props.recycleItems&&!!c.props.positionComponentInternal,g=r.length>0?new Set(r):void 0,h=t.map((A,P)=>({isSticky:c.props.stickyHeaderIndicesSet.has(A),itemIndex:A,itemType:a?.(A),order:P})),v=h.filter(A=>!A.isSticky),y=h.filter(A=>A.isSticky),x=[],C=[];for(let A=0;A<d;A++){let P=be(e,`containerItemKey${A}`),_=!!g?.has(A);if(!(P&&i?.has(P)&&c.indexByKey.has(P))){if(p.has(A))(P===void 0||_)&&C.push({containerIndex:A,distance:Number.POSITIVE_INFINITY});else if(P===void 0||_)x.push({containerIndex:A,distance:Number.POSITIVE_INFINITY});else if(!m){let F=c.indexByKey.get(P);if(F!==void 0&&(F<n||F>o)){let B=F<n?n-F:F-o;x.push({containerIndex:A,distance:B})}}}}x.sort(sG);let w=new Array(l),L=d,S=!1,k=(A,P)=>{w[A.order]={containerIndex:P,itemIndex:A.itemIndex,itemType:A.itemType},g?.delete(P)&&(S=!0)},I=(A,P,_)=>{for(let E of A){if(w[E.order])continue;let F=P.findIndex(B=>{var V;return _((V=f.get(B.containerIndex))==null?void 0:V.itemType,E.itemType)});if(F!==-1){let[B]=P.splice(F,1);k(E,B.containerIndex)}}},T=(A,P,_)=>{a&&I(A,P,(E,F)=>F!==void 0&&E===F),I(A,P,E=>E===void 0),_&&I(A,P,()=>!0)};T(v,x,!0),T(y,C,!1);for(let A of h){if(w[A.order])continue;let P=L++;A.isSticky&&p.add(P),k(A,P)}if(S&&(r.length=0,g))for(let A of g)r.push(A);if(Zo){let A=(s=be(e,"numContainersPooled"))!=null?s:Number.POSITIVE_INFINITY;L>A&&console.warn("[legend-list] No unused container available, so creating one on demand. This can be a minor performance issue and is likely caused by the estimatedItemSize being too large. Consider decreasing estimatedItemSize.",{debugInfo:{numContainers:d,numContainersPooled:A,numNeeded:l,stillNeeded:L-d}})}return w}function sG(e,t){return t.distance-e.distance}function lG(e){let t=e.state;t.queuedInitialLayout=!0,KN(e),KC(e,{didLayout:!0})}var dG=4,cG=100;function uG(e,t){if(t<=0)return 0;let n=Math.min(1,Math.abs(e)/dG);return Math.sign(e)*t*n}function fG(e){let t=e.state;t.scheduledWork.timeout(()=>{var n;t.scrollHistory.length=0,(n=t.triggerCalculateItemsInView)==null||n.call(t)},cG,"renderRangeProjection")}function pG(e,t,n){let o=n.positions;for(let r=e.length-1;r>=0;r--){let a=e[r],i=o[a];if(i!==void 0&&t>=i)return r}return-1}function mG(e,t){let n=e.state,o=!1;for(let r of n.stickyContainerPool){let a=be(e,`containerItemKey${r}`);if((a?n.indexByKey.get(a):void 0)===t){o=!0;break}}return o}function gG(e,t,n,o,r,a,i){var s;let l=e.state;Be(e,"activeStickyIndex",n>=0?t[n]:-1);for(let d=0;d<=1;d++){let c=n-d;if(c<0)continue;let f=t[c];if(mG(e,f))continue;let p=(s=l.idCache[f])!=null?s:jt(l,f);p&&!l.containerItemKeys.has(p)&&(f<a||f>i)&&!r.has(f)&&(r.add(f),o.push(f))}}function hG(e,t,n,o,r,a,i){var s,l;let d=e.state;for(let c of d.stickyContainerPool){let f=be(e,`containerItemKey${c}`),p=f?d.indexByKey.get(f):void 0;if(p===void 0||i(p))continue;let m=t.indexOf(p);if(m===-1){d.stickyContainerPool.delete(c),Be(e,`containerSticky${c}`,!1);continue}if(m>=r-1&&m<=r+1)continue;let h=t[m+1],v=!1;if(h){let y=d.positions[h];v=y!==void 0&&n>y+o*2}else{let y=(s=d.idCache[p])!=null?s:jt(d,p);if(y){let x=d.positions[p],C=(l=d.sizes.get(y))!=null?l:fo(e,y,p,d.props.data[p]);v=x!==void 0&&n>x+C+o*3}}v&&a.push(c)}}function v_(e,t,n,o,r,a){let i=!1;return e.startNoBuffer===null&&n+o>r&&(e.startNoBuffer=t),e.firstFullyOnScreenIndex===void 0&&n>=r-10&&n<=a&&(e.firstFullyOnScreenIndex=t),e.startNoBuffer!==null&&(n<=a?e.endNoBuffer=t:i=!0),i}function y_(e,t){var n,o;let r=[],a=(n=t.firstFullyOnScreenIndex)!=null?n:t.startNoBuffer;if(a!=null&&t.endNoBuffer!==null)for(let i=a;i<=t.endNoBuffer;i++){let s=(o=e.idCache[i])!=null?o:jt(e,i);r.push(s)}return r}function PC(e,t){var n;let o=e.props.onFirstVisibleItemChanged;if(!o||t===null||t<0||t>=e.props.data.length)return;let r=(n=e.idCache[t])!=null?n:jt(e,t),a=e.lastFirstVisibleItemCallback;a?.index===t&&a.key===r||(e.lastFirstVisibleItemCallback={index:t,key:r},o({index:t,item:e.props.data[t],key:r}))}function vG(e,t){var n,o;let r=e.state,{endBuffered:a,idCache:i,positions:s,props:{data:l},sizes:d,startBuffered:c}=r;if(c===null||a===null||c<0||a<c)return null;for(let f=c;f<=a&&f<l.length;f++){let p=(n=i[f])!=null?n:jt(r,f),m=(o=d.get(p))!=null?o:fo(e,p,f,l[f]);if(s[f]+m>t)return f}return null}function yG(e,t,n,o,r){var a,i;let s=e.state,{endBuffered:l,idCache:d,positions:c,props:{data:f},sizes:p,startBuffered:m}=s;if(m===null||l===null||m<0||l<m)return;let g={endNoBuffer:null,firstFullyOnScreenIndex:void 0,startNoBuffer:null};for(let h=m;h<=l&&h<f.length;h++){let v=(a=d[h])!=null?a:jt(s,h),y=(i=p.get(v))!=null?i:fo(e,v,h,f[h]),x=c[h];if(v_(g,h,x,y,o,r))break}Object.assign(s,{endNoBuffer:g.endNoBuffer,firstFullyOnScreenIndex:g.firstFullyOnScreenIndex,idsInView:y_(s,g),startNoBuffer:g.startNoBuffer}),PC(s,g.startNoBuffer),g.startNoBuffer!==null&&g.endNoBuffer!==null&&g_(s,e,t,n,g.startNoBuffer,g.endNoBuffer,m,l)}function qa(e,t={}){let n=e.state;eG(()=>{var o,r,a,i,s,l,d,c,f,p,m,g,h,v,y,x,C,w,L,S,k;let{columns:I,containerItemKeys:T,enableScrollForNextCalculateItemsInView:A,idCache:P,indexByKey:_,minIndexSizeChanged:E,positions:F,props:{alwaysRenderIndicesArr:B,alwaysRenderIndicesSet:V,getItemType:Q,keyExtractor:Se,onStickyHeaderChange:H},scrollForNextCalculateItemsInView:q,scrollLength:ee,sizes:G,startBufferedId:te,viewabilityConfigCallbackPairs:me}=n,{data:U}=n.props,Y=n.props.stickyHeaderIndicesArr||[],se=n.props.stickyHeaderIndicesSet||new Set,ge=WN(e,t.drawDistanceMode),{dataChanged:ie,doMVCP:Ae,forceFullItemPositions:Xe}=t,nt=((o=n.initialScrollSession)==null?void 0:o.kind)==="bootstrap"?n.initialScrollSession.bootstrap:void 0,rt=!!nt,Ve=be(e,"numContainers");if(!U||ee===0||!Ve)return;let ne=uo(e),we,j=be(e,"stylePaddingTop")+be(e,"alignItemsAtEndPadding")+be(e,"headerSize"),X=be(e,"numColumns"),ae=(r=t.scrollVelocity)!=null?r:Bg(n),oe=0,{initialScroll:ft,queuedInitialLayout:pt}=n,yt=rt?(a=nt?.scroll)!=null?a:n.scroll:!pt&&Mu(n)&&ft?Kr(e,ft):n.scroll,Lt=0,on=0,gt=0,zt=0,Mt=0,wt=0,In=yt,ct=ve=>{var et;In=ve,Lt=(et=be(e,"scrollAdjustPending"))!=null?et:0,on=Lt-j,gt=Math.round(ve+oe+on),gt+ee>ne&&(gt=Math.max(0,ne-ee))};ct(yt);let dn=be(e,"activeStickyIndex"),ro=()=>{let ve=Y.length>0?pG(Y,gt,n):-1,et=ve>=0?Y[ve]:-1,lt=dn!==et;(ve>=0||dn>=0)&&Be(e,"activeStickyIndex",et);let it=!!H&&Y.length>0&<return{currentStickyIdx:ve,finishCalculateItemsInView:it?()=>{let xn=U[et];xn!==void 0&&H?.({index:et,item:xn})}:void 0}},Vt=ie?void 0:ro(),bn=ge,Tn=ge;ae>0||ae===0&><Math.max(50,ge)?(bn=ge*.5,Tn=ge*1.5):(bn=ge*1.5,Tn=ge*.5);let kn=!ie&&!Xe&&!rt&&!Mu(n)&&!n.scrollingTo&&!n.pendingNativeMVCPAdjust&&!!be(e,"readyToRender")?uG(ae,Math.min(bn,Tn)):0,O=()=>{let ve=Math.max(0,gt),et=Math.max(0,-In);Mt=Math.max(ve,gt+ee+et),zt=ve-bn+kn,wt=Mt+Tn+kn};if(O(),kn!==0&&fG(e),A&&!rt&&!ie&&!Xe&&q){let{top:ve,bottom:et}=q;if(ve===null&&et===null)n.scrollForNextCalculateItemsInView=void 0;else if((ve===null||zt>ve)&&(et===null||wt<et)&&!Ku(n)){me?yG(e,me,ee,gt,Mt):n.props.onFirstVisibleItemChanged&&PC(n,vG(e,gt)),(i=Vt?.finishCalculateItemsInView)==null||i.call(Vt);return}}let fe=Ae&&!rt?rW(e,ie):void 0;ie&&u_(n);let ye=Xe||ie?0:(s=E??n.startBuffered)!=null?s:0,Te=!Xe&&!ie&&X>1&&E!==void 0;p_(e,ie,{doMVCP:Ae,forceFullUpdate:!!Xe,optimizeForVisibleWindow:Te,scrollBottomBuffered:wt,scrollVelocity:ae,startIndex:ye}),ne=uo(e),E!==void 0&&(n.minIndexSizeChanged=void 0);let Me;if(ie&&Ae&&n.props.maintainVisibleContentPosition.data&&n.didContainersLayout&&n.idsInView.length>0){let ve=n.props.maintainVisibleContentPosition.shouldRestorePosition;Me=new Set;for(let et of n.idsInView){let lt=_.get(et);lt!==void 0&&(ve&&!ve(U[lt],lt,U)||Me.add(et))}}let ht=n.scroll,Ln=(l=be(e,"scrollAdjustPending"))!=null?l:0;fe?.(),fe&&(n.scroll!==ht||((d=be(e,"scrollAdjustPending"))!=null?d:0)!==Ln)&&(ct(n.scroll),O()),ie&&(Vt=ro());let at=null,Pt=null,Et=null,St=(c=rt?nt?.targetIndexSeed:void 0)!=null?c:!ie&&te&&_.get(te)||0;for(let ve=St;ve>=0;ve--){let et=(f=P[ve])!=null?f:jt(n,ve),lt=F[ve],it=(p=G.get(et))!=null?p:fo(e,et,ve,U[ve]);if(lt+it>zt)St=ve;else break}if(X>1)for(;St>0;){let ve=I[St];if(ve===1||ve===void 0)break;St-=1}let an=!1,Jt,xe,_e=0;for(let ve=0;ve<Ve;ve++){let et=be(e,`containerItemKey${ve}`);if(et!==void 0){let lt=_.get(et);_e=Math.max(_e,lt)}}let qe={endNoBuffer:null,firstFullyOnScreenIndex:void 0,startNoBuffer:null},We=U.length;for(let ve=Math.max(0,St);ve<We&&(!an||ve<=_e);ve++){let et=(m=P[ve])!=null?m:jt(n,ve),lt=(g=G.get(et))!=null?g:fo(e,et,ve,U[ve]),it=F[ve];an||(v_(qe,ve,it,lt,gt,Mt),at===null&&it+lt>zt&&(at=ve,Pt=et,zt<0?Jt=null:Jt=it),qe.startNoBuffer!==null&&(it<=wt?(Et=ve,wt>ne?xe=null:xe=it+lt):an=!0))}Object.assign(n,{endBuffered:Et,endNoBuffer:qe.endNoBuffer,firstFullyOnScreenIndex:qe.firstFullyOnScreenIndex,idsInView:y_(n,qe),startBuffered:at,startBufferedId:Pt,startNoBuffer:qe.startNoBuffer}),A&&Jt!==void 0&&xe!==void 0&&(n.scrollForNextCalculateItemsInView=_u(Jt)&&_u(xe)?void 0:{bottom:xe,top:Jt});let ot=Ve,xt=[];if(ie)for(let ve=0;ve<ot;ve++){let et=be(e,`containerItemKey${ve}`);(!Se||et&&_.get(et)===void 0)&&xt.push(ve)}let Bt=n.scrollTargetPinnedRange,Zt=0,ke=-1;Bt&&(Zt=Math.max(0,Math.min(Bt.start,Bt.end)),ke=Math.min(We-1,Math.max(Bt.start,Bt.end)));let Ut=Zt<=ke,vt=ve=>V.has(ve)||Ut&&ve>=Zt&&ve<=ke;if(at!==null&&Et!==null){let ve=[],et=new Set,lt=it=>{var xn;if(it>=0&&it<We){let gn=(xn=P[it])!=null?xn:jt(n,it),cn=T.get(gn);cn!==void 0?n.stickyContainerPool.add(cn):!_u(gn)&&!et.has(it)&&(et.add(it),ve.push(it))}};for(let it=at;it<=Et;it++){let xn=(h=P[it])!=null?h:jt(n,it);T.has(xn)||(et.add(it),ve.push(it))}for(let it of B)lt(it);if(Ut)for(let it=Zt;it<=ke;it++)lt(it);if(Y.length>0?gG(e,Y,(v=Vt?.currentStickyIdx)!=null?v:-1,ve,et,at,Et):dn!==-1&&Be(e,"activeStickyIndex",-1),ve.length>0){let xn=iG(e,ve,at,Et,xt,Q?gn=>{let cn=Q(U[gn],gn);return cn!==void 0?String(cn):""}:void 0,Me);for(let gn of xn){let cn=gn.itemIndex,It=gn.containerIndex,Qt=(y=P[cn])!=null?y:jt(n,cn),qt=be(e,`containerItemKey${It}`);qt&&qt!==Qt&&T.delete(qt),qt!==Qt&&(we??(we=new Set),we.add(It),n.containerItemGenerations[It]=((x=n.containerItemGenerations[It])!=null?x:0)+1),Be(e,`containerItemKey${It}`,Qt),Be(e,`containerItemIndex${It}`,cn),Be(e,`containerItemData${It}`,U[cn]),n.containerItemMetadata.set(It,i_(n,cn,U[cn],gn.itemType)),T.set(Qt,It),(C=n.userScrollAnchorReset)==null||C.keys.add(Qt);let ko=`containerSticky${It}`,Do=se.has(cn),va=vt(cn);Do?(Be(e,ko,!0),n.stickyContainerPool.add(It)):(be(e,ko)&&Be(e,ko,!1),va?n.stickyContainerPool.add(It):n.stickyContainerPool.delete(It)),It>=ot&&(ot=It+1)}ot!==Ve&&(Be(e,"numContainers",ot),ot>be(e,"numContainersPooled")&&Be(e,"numContainersPooled",aG(We,ot)))}((w=n.userScrollAnchorReset)==null?void 0:w.keys.size)===0&&(n.userScrollAnchorReset=void 0)}n.stickyContainerPool.size>0&&hG(e,Y,gt,ge,(L=Vt?.currentStickyIdx)!=null?L:-1,xt,vt);let Nt=xt.length>0?new Set(xt):void 0,Bn=!1;for(let ve=0;ve<ot;ve++){let et=be(e,`containerItemKey${ve}`);if(Nt?.has(ve))et!==void 0&&(T.delete(et),we??(we=new Set),we.add(ve),n.containerItemGenerations[ve]=((S=n.containerItemGenerations[ve])!=null?S:0)+1),n.containerItemMetadata.delete(ve),n.stickyContainerPool.has(ve)&&(Be(e,`containerSticky${ve}`,!1),n.stickyContainerPool.delete(ve)),Be(e,`containerItemKey${ve}`,void 0),Be(e,`containerItemIndex${ve}`,void 0),Be(e,`containerItemData${ve}`,void 0),Be(e,`containerPosition${ve}`,vd),Be(e,`containerColumn${ve}`,-1),Be(e,`containerSpan${ve}`,1);else{let lt=_.get(et);lt!==void 0&&(Bn=jW(e,ve,lt,{scrollAdjustPending:Lt,updateLayout:!0}).didChangePosition||Bn)}}if(we&&zC&&Pg(e,we),Bn&&Be(e,"lastPositionUpdate",Date.now()),rt){EW(e);return}PC(n,qe.startNoBuffer),!pt&&!n.didContainersLayout&&(Mu(n)?Du(n,n.startBuffered,n.endBuffered):Du(n,n.startNoBuffer,n.endNoBuffer)||Du(n,n.startBuffered,n.endBuffered))&&(lG(e),VW(e)),me&&qe.startNoBuffer!==null&&qe.endNoBuffer!==null&&g_(e.state,e,me,ee,qe.startNoBuffer,qe.endNoBuffer,at??qe.startNoBuffer,Et??qe.endNoBuffer),(k=Vt?.finishCalculateItemsInView)==null||k.call(Vt)})}function Ag(e){var t,n;let o=e.state,r=o.props.anchoredEndSpace,a=be(e,"anchoredEndSpaceSize"),i=o.anchoredEndSpaceReadyAnchorIndex,s=o.anchoredEndSpaceReadyAnchorKey,l=r?.anchorIndex,d,c=!0,f=0;if(r){let{anchorIndex:h,anchorMaxSize:v,anchorOffset:y=0}=r,{data:x}=o.props;if(h>=0&&h<x.length&&o.scrollLength>0){d=jt(o,h);let C=0,w=!1;for(let S=h;S<x.length;S++){let k=YN(e,S),I=S===h&&v!==void 0?Math.min(k||0,Math.max(0,v)):k;k===void 0&&(w=!0),I!=null&&I>0&&(C+=I)}C=Math.max(0,C-e.scrollAxisGap),C+=(e.values.get("footerSize")||0)+FC(o.props),c=!w;let L=Math.max(0,o.scrollLength-C-y);f=w?Math.min(a||0,L):L}else h>=0&&(c=!1)}let p=a!==f&&(a!==void 0||r!==void 0),m=(a||0)!==f;return c&&(p||(i!==l||s!==d))?(o.anchoredEndSpaceReadyAnchorIndex=l,o.anchoredEndSpaceReadyAnchorKey=d,p&&(Be(e,"anchoredEndSpaceSize",f),(t=r?.onSizeChanged)==null||t.call(r,f)),m&&(Js(e),Qs(e,o.scroll,!0,{markHasScrolled:!1})),(n=r?.onReady)==null||n.call(r,{anchorIndex:l,anchorKey:d,size:f})):!c&&p&&f<(a||0)&&(Be(e,"anchoredEndSpaceSize",f),(t=r?.onSizeChanged)==null||t.call(r,f),r?.includeInEndInset&&Qs(e,o.scroll,!0,{markHasScrolled:!1})),f}function xG(e){var t;let n=e.state;n.userScrollAnchorReset!==void 0?(qa(e),((t=n.userScrollAnchorReset)==null?void 0:t.keys.size)===0&&(n.userScrollAnchorReset=void 0)):n.mvcpAnchorLock?n.scheduledWork.has("mvcpRecalculate")||n.scheduledWork.frame(()=>qa(e,{doMVCP:!0}),"mvcpRecalculate"):(n.scheduledWork.cancel("mvcpRecalculate"),qa(e,{doMVCP:!0}))}function vN(e,t,n){if(e.state.needsOtherAxisSize){let r=n?t.height:t.width,a=be(e,"otherAxisSize");(!a||r>a)&&Be(e,"otherAxisSize",r)}}var Ka;function x_(e){let t=Ka===void 0;Ka??(Ka=new Map);try{e()}finally{if(t){let n=Ka;Ka=void 0;for(let[o,r]of n)XC(o,r)}}}function CG(e,t){e.didChange||(e.didChange=t.didChange),e.didMeasureUserScrollAnchorResetItem||(e.didMeasureUserScrollAnchorResetItem=t.didMeasureUserScrollAnchorResetItem),e.needsRecalculate||(e.needsRecalculate=t.needsRecalculate),e.shouldMaintainScrollAtEnd||(e.shouldMaintainScrollAtEnd=t.shouldMaintainScrollAtEnd)}function bG(e,t){var n;let o=e.state;t.needsRecalculate?(o.scrollForNextCalculateItemsInView=void 0,xG(e)):t.didMeasureUserScrollAnchorResetItem&&((n=o.userScrollAnchorReset)==null?void 0:n.keys.size)===0&&(o.userScrollAnchorReset=void 0),t.didChange&&Ag(e),t.didChange&&t.shouldMaintainScrollAtEnd&&Cd(e)}function C_(e,t){if(Ka){let n=Ka.get(e);n?n.push(t):Ka.set(e,[t])}else XC(e,[t])}function XC(e,t){var n;let o=e.state,r={};for(let a of t)if(a.containerId===void 0||be(e,`containerItemKey${a.containerId}`)===a.itemKey){let s=o.indexByKey.get(a.itemKey),l=s===void 0||(n=o.props.data)==null?void 0:n[s],d=a.containerId!==void 0&&s!==void 0&&l!==void 0?NW(o,a.containerId,s,l):void 0,c=wG(e,a.itemKey,a.size,d);CG(r,c)}bG(e,r)}function wG(e,t,n,o){var r,a;let i=e.state,s=i.userScrollAnchorReset,l=!!s?.keys.delete(t),{didContainersLayout:d,sizesKnown:c,props:{getFixedItemSize:f,getItemType:p,horizontal:m,onItemSizeChanged:g,data:h,maintainScrollAtEnd:v}}=i;if(!h)return{didMeasureUserScrollAnchorResetItem:l};let y=i.indexByKey.get(t);if(f){if(y===void 0)return{didMeasureUserScrollAnchorResetItem:l};let I=i.props.data[y];if(I===void 0)return{didMeasureUserScrollAnchorResetItem:l};if(!o?.didResolveFixedItemSize){let A=(a=o?.itemType)!=null?a:p&&(r=p(I,y))!=null?r:"";o={didResolveFixedItemSize:!0,fixedItemSize:f(I,y,A),itemType:A}}let T=o.fixedItemSize;if(T!==void 0&&T===c.get(t))return vN(e,n,m),{didMeasureUserScrollAnchorResetItem:l}}let x=!d,C=!1,w,L=i.sizesKnown.get(t),S=SG(e,t,n,o),k=Fu(m?n.width:n.height);if(S!==0){w=w!==void 0?Math.min(w,y):y;let{startBuffered:I,endBuffered:T}=i;x||(x=y>=I&&y<=T),!x&&i.containerItemKeys.has(t)&&(x=!0),(L===void 0||Math.abs(L-k)>5)&&(C=!0),g?.({index:y,itemData:i.props.data[y],itemKey:t,previous:k-S,size:k})}if(w!==void 0&&(i.minIndexSizeChanged=i.minIndexSizeChanged!==void 0?Math.min(i.minIndexSizeChanged,w):w),vN(e,n,m),d||Du(i,i.startBuffered,i.endBuffered)){let I=C&&!!v?.onItemLayout;return{didChange:S!==0,didMeasureUserScrollAnchorResetItem:l,needsRecalculate:x,shouldMaintainScrollAtEnd:I}}return{didChange:S!==0,didMeasureUserScrollAnchorResetItem:l}}function SG(e,t,n,o){var r,a;let i=e.state,{indexByKey:s,sizesKnown:l,averageSizes:d,props:{data:c,horizontal:f,getItemType:p,getFixedItemSize:m}}=i;if(!c)return 0;let g=s.get(t),h=c[g],v=o?.itemType,y=o?.fixedItemSize;m&&!o?.didResolveFixedItemSize&&(v=p&&(r=p(h,g))!=null?r:"",y=m(h,g,v));let x=o?.didResolveFixedItemSize||v!==void 0||y!==void 0?{didResolveFixedItemSize:o?.didResolveFixedItemSize,fixedItemSize:y,itemType:v}:void 0,C=fo(e,t,g,h,void 0,void 0,void 0,x),w=f?n.width:n.height,L=l.get(t),S=Math.round(w);if(l.set(t,S),y===void 0&&S>0){v??(v=p&&(a=p(h,g))!=null?a:"");let k=d[v];k||(k=d[v]={avg:0,num:0}),k.num===0?(k.avg=S,k.num++):L!==void 0&&L>0?k.avg+=(S-L)/k.num:(k.avg=(k.avg*k.num+S)/(k.num+1),k.num++)}return!C||Math.abs(C-S)>.1?(TC(e,t,S),S-C):0}function IG(e,t=null){let n=[],o=t??e.viewRefs.keys();for(let r of o){let a=e.viewRefs.get(r),i=be(e,`containerItemKey${r}`),s=a?.current;if(i!==void 0&&s){let l=s.getBoundingClientRect();b4(s,l),n.push({containerId:r,itemKey:i,size:{height:l.height,width:l.width}})}}n.length>0&&XC(e,n)}var b_=zn,ga=pe,TG=ga(function({children:t}){let n=Vr(),[o]=er(["containerLayoutEpoch"]);return he(()=>{{let r=GW(n);r!==void 0&&IG(n,r)}},[n,o]),t}),Sg=e=>gh(e)?e:e?De(e,null):null,kG=typeof document<"u"&&!!document.getElementById("react-native-stylesheet"),AC={contain:"paint layout style",...kG?{display:"flex",flexDirection:"column"}:{}},LG=ga(function({id:t,horizontal:n,style:o,refView:r,...a}){let[i=vd]=er([`containerPosition${t}`]),s=Og(o)?Object.assign({},...o):o,l=n?{...AC,...s,left:i}:{...AC,...s,top:i},{animatedScrollY:d,onLayout:c,onLayoutChange:f,stickyHeaderConfig:p,...m}=a;return De("div",{ref:r,...m,style:l})}),PG=ga(function({id:t,horizontal:n,style:o,refView:r,animatedScrollY:a,stickyHeaderConfig:i,onLayout:s,onLayoutChange:l,children:d,...c}){let[f=vd,p,m]=er([`containerPosition${t}`,"activeStickyIndex",`containerItemIndex${t}`]),g=K(()=>{var y;return(y=Og(o)?Object.assign({},...o):o)!=null?y:{}},[o]),h=K(()=>{var y;let x={...AC,...g};delete x.transform;let C=(y=i?.offset)!=null?y:0,w=p===m;return x.position=w?"sticky":"absolute",x.zIndex=m+1e3,n?x.left=w?C:f:x.top=w?C:f,x},[g,n,f,m,p,i?.offset]),v=K(()=>i?.backdropComponent?De("div",{style:{inset:0,pointerEvents:"none",position:"absolute"}},Sg(i.backdropComponent)):null,[i?.backdropComponent]);return De("div",{ref:r,style:h,...c},v,d)}),AG=LG;function EG(e){J(()=>e())}var w_=Ct(null),RG=-1;function MG(){return Ht(w_)}function NG(){var e;let t=MG(),n=(e=t?.containerId)!=null?e:RG,[o]=er([`containerItemKey${n}`]);return v4("lastItemKeys",a=>t&&!_u(o)&&a?.includes(o)||!1)}function _G({ItemSeparatorComponent:e,leadingItem:t}){return NG()?null:De(e,{leadingItem:t})}var CC=null;function DG(){return CC||(CC=new ResizeObserver(e=>{x_(()=>{for(let t of e){let n=Ig.get(t.target);if(n)for(let o of n)o(t)}})})),CC}var Ig=new WeakMap;function OG(e,t){var n;if(typeof ResizeObserver>"u"||!e)return()=>{};let o=DG(),r=(n=Ig.get(e))!=null?n:new Set;return r.size===0&&(Ig.set(e,r),o.observe(e,{box:"border-box"})),r.add(t),()=>{r.delete(t),r.size===0&&(Ig.delete(e),o.unobserve(e))}}function YC({ref:e,measureInLayoutEffect:t=!0,onLayoutProp:n,onLayoutChange:o,webLayoutResync:r},a){return he(()=>{var i,s;let l=e.current,c=((s=(i=l?.getScrollableNode)==null?void 0:i.call(l))!=null?s:null)||l;if(!c)return;let f=(m,g)=>{m.height===0&&m.width===0||(o(m,g),n?.({nativeEvent:{layout:m}}))},p;if(t){let m=c.getBoundingClientRect();f(yN(m),!0),p=m}return OG(c,m=>{var g;let h=m.target instanceof HTMLElement?m.target:void 0,v=Array.isArray(m.borderBoxSize)?m.borderBoxSize[0]:m.borderBoxSize,y=v?{height:v.blockSize,left:m.contentRect.left,top:m.contentRect.top,width:v.inlineSize}:(g=h?.getBoundingClientRect())!=null?g:m.contentRect,x=p??C4(c),C=x===void 0||y.width!==x.width||y.height!==x.height;p=y;let w=!!r?.();(C||w)&&f(yN(y),!1)})},[t,...a||[]]),{}}function yN(e){return e?{height:e.height,width:e.width,x:e.left,y:e.top}:{height:0,width:0,x:0,y:0}}var Tg=new Map,bC;function S_(e){Tg.delete(e)}function FG(e,t){Tg.set(e,t),bC===void 0&&(bC=requestAnimationFrame(()=>{let n=Array.from(Tg.values());Tg.clear(),bC=void 0,x_(()=>{for(let o of n)o()})}))}function BG({containerId:e,ctx:t,rectangle:n,ref:o,state:r}){let a=t.state,i=r.itemKey;r.didLayout=!0;let s=n,l=r.horizontal?"width":"height",d=Fu(n[l]);r.lastSize&&Fu(r.lastSize[l]);let f=a.sizesKnown.get(i),p=()=>{r.lastSize=s,C_(t,{containerId:e,itemKey:i,size:s})};!Ku(a)&&f!==void 0&&d+1<f?FG(r,()=>{var g;if(r.itemKey===i){let h=o.current,v=(g=h?.getBoundingClientRect)==null?void 0:g.call(h);v&&(s={height:v.height,width:v.width}),p()}}):(S_(r),p())}function zG({containerId:e,ctx:t,horizontal:n,itemKey:o,ref:r}){let a=N({didLayout:!1,horizontal:n,itemKey:o});a.current.horizontal=n,a.current.itemKey=o;let[i,s]=J(0),l=R(f=>{BG({containerId:e,ctx:t,rectangle:f,ref:r,state:a.current})},[e,t,r]),d=R(()=>{Pg(t,e)},[e,t]);he(()=>(t.containerLayoutTriggers.set(e,d),()=>{S_(a.current),t.containerLayoutTriggers.get(e)===d&&t.containerLayoutTriggers.delete(e)}),[e,t,d]),he(()=>{Pg(t,e)});let{onLayout:c}=YC({measureInLayoutEffect:!zC,onLayoutChange:l,ref:r,webLayoutResync:()=>Ku(t.state)},[o,i]);return W(()=>{},[e,t,o]),{onLayout:c,triggerLayout:d}}function UG({columnWrapperStyle:e,contentContainerAlignItems:t,horizontal:n,hasItemSeparator:o,isHorizontalRTLList:r,numColumns:a,otherAxisPos:i,otherAxisSize:s}){let l;if(e){let{columnGap:d,rowGap:c,gap:f}=e;n?l={paddingBottom:a>1?(c||f||0)/2:void 0,paddingRight:d||f||void 0,paddingTop:a>1?(c||f||0)/2:void 0}:l={paddingBottom:c||f||void 0,paddingLeft:a>1?(d||f||0)/2:void 0,paddingRight:a>1?(d||f||0)/2:void 0}}return n?{bottom:t==="flex-end"&&a===1?0:void 0,boxSizing:l?"border-box":void 0,direction:r&&Wa.OS==="web"?"ltr":void 0,flexDirection:o?"row":void 0,height:s,left:0,position:"absolute",top:t==="flex-end"&&a===1?void 0:i,...l||{}}:{boxSizing:l?"border-box":void 0,left:i,position:"absolute",right:a>1?null:0,top:0,width:s,...l||{}}}var HG=ga(function({id:t,itemKey:n,recycleItems:o,horizontal:r,getRenderedItem:a,ItemSeparatorComponent:i,stickyHeaderConfig:s}){let l=Vr(),{columnWrapperStyle:d,animatedScrollY:c}=l,f=ja(l.state),p=l.state.props.positionComponentInternal,m=l.state.props.stickyPositionComponentInternal,[g=0,h=1,v,y=1,x,C]=er([`containerColumn${t}`,`containerSpan${t}`,`containerItemData${t}`,"numColumns","extraData",`containerSticky${t}`]),w=N(null),{onLayout:L,triggerLayout:S}=zG({containerId:t,ctx:l,horizontal:r,itemKey:n,ref:w}),k=g>0?g:1,I=Math.min(Math.max(h||1,1),y),T=y>1?`${(k-1)/y*100}%`:0,A=y>1?`${I/y*100}%`:void 0,P=K(()=>UG({columnWrapperStyle:d,contentContainerAlignItems:l.state.props.contentContainerAlignItems,hasItemSeparator:!!i,horizontal:r,isHorizontalRTLList:f,numColumns:y,otherAxisPos:T,otherAxisSize:A}),[r,f,T,A,d,l.state.props.contentContainerAlignItems,y,i]),_=K(()=>n!==void 0?a(n):null,[n,v,x]),{renderedItem:E}=_||{},F=K(()=>(l.viewRefs.set(t,w),{containerId:t,triggerLayout:S}),[t,S]);return De(C?m||PG:p||AG,{animatedScrollY:C?c:void 0,horizontal:r,id:t,key:o?void 0:n,onLayout:L,refView:w,stickyHeaderConfig:s,style:P},De(w_.Provider,{value:F},E,_&&i&&De(_G,{ItemSeparatorComponent:i,leadingItem:_.item})))});function $G({id:e,horizontal:t,recycleItems:n,ItemSeparatorComponent:o,getRenderedItem:r,stickyHeaderConfig:a,ContainerComponent:i=HG}){let[s]=er([`containerItemKey${e}`]);return s===void 0?null:De(i,{getRenderedItem:r,horizontal:t,ItemSeparatorComponent:o,id:e,itemKey:s,recycleItems:n,stickyHeaderConfig:a})}var KG=ga(function(t){return De($G,{...t})});function VG(e,t){let n=Array.from(e.children);if(n.length<=1)return n;let o=n.map(l=>{var d;return[l,(d=t.get(l))!=null?d:null]});o.sort((l,d)=>{let c=l[1],f=d[1];return c===null?1:f===null?-1:c-f});let r=new Map;o.forEach((l,d)=>{r.set(l[0],d)});let a=n.map(l=>r.get(l)),i=qG(a),s=new Set(i);for(let l=0;l<o.length;l++){let d=o[l][0],c=n.indexOf(d);if(!s.has(c)){let f=null;for(let p=l+1;p<o.length;p++){let m=o[p][0],g=n.indexOf(m);if(s.has(g)){f=m;break}}f?e.insertBefore(d,f):e.appendChild(d)}}}function qG(e){let t=e.length,n=[],o=new Array(t).fill(-1),r=[];for(let s=0;s<t;s++){let l=e[s],d=0,c=n.length;for(;d<c;){let f=Math.floor((d+c)/2);e[r[f]]<l?d=f+1:c=f}d===n.length?(n.push(l),r.push(s)):(n[d]=l,r[d]=s),d>0&&(o[s]=r[d-1])}let a=[],i=r[r.length-1];for(;i!==-1;)a.unshift(i),i=o[i];return a}function WG(e){let t=Vr(),n=N(void 0);W(()=>{let o=Va(t,"lastPositionUpdate",()=>{n.current!==void 0&&clearTimeout(n.current),n.current=setTimeout(()=>{let r=e.current;if(r){let a=new Map;for(let[i,s]of t.viewRefs){let l=s.current,d=be(t,`containerItemIndex${i}`);l&&d!==void 0&&a.set(l,d)}VG(r,a)}n.current=void 0},500)});return()=>{o(),n.current!==void 0&&clearTimeout(n.current)}},[t])}function GG(e,t){let[n,o]=J(t),r=n!==t;return he(()=>{o(t)},[t]),e&&!r}var jG=ga(function({freshDataTransitionEpoch:t,horizontal:n,numColumns:o,children:r}){let a=N(null),i=Vr(),s=i.columnWrapperStyle,l=ja(i.state),[d,c,f]=er(["otherAxisSize","readyToRender","totalSize"]),p=GG(!!c,t);WG(a);let m=n?{direction:l?"ltr":void 0,flexShrink:0,minHeight:d,opacity:p?1:0,position:"relative",width:f}:{height:f,minWidth:d,opacity:p?1:0,position:"relative"};if(p||(m.pointerEvents="none"),s&&o>1){let{columnGap:g,rowGap:h,gap:v}=s,y=g||v||0,x=h||v||0;n?(x&&(m.marginTop=m.marginBottom=-x/2),y&&(m.marginRight=-y)):x&&(m.marginBottom=-x)}return De("div",{ref:a,style:m},De(TG,null,r))}),QG=ga(function({freshDataTransitionEpoch:t,horizontal:n,recycleItems:o,ItemSeparatorComponent:r,getRenderedItem:a,stickyHeaderConfig:i}){let[s,l]=er(["numContainersPooled","numColumns"]),d=[];for(let c=0;c<s;c++)d.push(De(KG,{getRenderedItem:a,horizontal:n,ItemSeparatorComponent:r,id:c,key:c,recycleItems:o,stickyHeaderConfig:i}));return De(jG,{freshDataTransitionEpoch:t,horizontal:n,numColumns:l},d)});function XG(e){return Og(e)?Object.assign({},...e.filter(Boolean)):e}var $u={create:e=>e,flatten:e=>XG(e)};function EC(e){let t=N(e);return t.current=e,t}function YG(e){let t=EC(e),n=N(void 0),o=K(()=>({cancel(){n.current!==void 0&&(cancelAnimationFrame(n.current),n.current=void 0)},flush(){o.cancel(),t.current()},schedule(){if(n.current!==void 0)return!1;let r=requestAnimationFrame(()=>{n.current===r&&(n.current=void 0,t.current())});return n.current=r,!0}}),[]);return W(()=>()=>{o.cancel()},[o]),o}var RC="legend-list-content-container",I_="legend-list-scrollbar-x-hidden",T_="legend-list-scrollbar-y-hidden";function JG(){return typeof document>"u"?null:document.scrollingElement||document.documentElement||document.body}function MC(){var e,t,n,o;return typeof window>"u"?{x:0,y:0}:{x:(t=(e=window.scrollX)!=null?e:window.pageXOffset)!=null?t:0,y:(o=(n=window.scrollY)!=null?n:window.pageYOffset)!=null?o:0}}function xN(e,t){var n,o;let r=e?.getBoundingClientRect();return{left:((n=r?.left)!=null?n:0)+t.x,top:((o=r?.top)!=null?o:0)+t.y}}function k_(e){var t,n;return{height:(t=e?.scrollHeight)!=null?t:0,width:(n=e?.scrollWidth)!=null?n:0}}function ZG(e,t,n){return k_(n?t:e)}function CN(e,t,n){var o,r,a,i,s,l;if(t&&typeof window<"u"){let d=e?.getBoundingClientRect();return{height:n&&(r=(o=d?.height)!=null?o:e?.clientHeight)!=null?r:window.innerHeight,width:n?window.innerWidth:(i=(a=d?.width)!=null?a:e?.clientWidth)!=null?i:window.innerWidth}}return{height:(s=e?.clientHeight)!=null?s:0,width:(l=e?.clientWidth)!=null?l:0}}function bN(e,t){return Math.max(0,Math.min(e,t))}function wN(e,t){return t?e.width:e.height}function ej(e,t,n){return Math.max(0,wN(e,n)-wN(t,n))}function SN(e,t){return t&&JG()||e}function tj(e,t){return t&&typeof window<"u"?window:e}function nj(e,t,n){let o=e.getBoundingClientRect(),r=MC();return{height:t&&typeof window<"u"&&!n?window.innerHeight:o.height,width:t&&typeof window<"u"&&n?window.innerWidth:o.width,x:t?o.left+r.x:o.left,y:t?o.top+r.y:o.top}}function oj({clampedOffset:e,horizontal:t,listPos:n,scroll:o}){return{left:t?n.left+e:o.x,top:t?o.y:n.top+e}}var IN="legend-list-scrollbar-axis-hidden-style",rj=200,aj=`.${T_}::-webkit-scrollbar:vertical{width:0;display:none;}.${I_}::-webkit-scrollbar:horizontal{height:0;display:none;}`;function ij(){if(typeof document>"u"||document.getElementById(IN))return;let e=document.createElement("style");e.id=IN,e.textContent=aj,document.head.appendChild(e)}function sj(e){var t,n;let o=(n=(t=e.state)==null?void 0:t.props)==null?void 0:n.contentInsetEndAdjustment;return Math.max(0,o??0)}function lj(e){if(!e?.length)return[];let t=[],n=new Set;for(let o of e)Number.isFinite(o)&&!n.has(o)&&(n.add(o),t.push(o));return t}function dj(e,t){return{height:t?"100%":1,left:t?e:0,pointerEvents:"none",position:"absolute",scrollSnapAlign:"start",top:t?0:e,width:t?1:"100%"}}var TN=zn(function({children:t,style:n,contentContainerClassName:o,contentContainerStyle:r,horizontal:a=!1,contentOffset:i,maintainVisibleContentPosition:s,onScroll:l,onInternalScrollEnd:d,onMomentumScrollEnd:c,showsHorizontalScrollIndicator:f=!0,showsVerticalScrollIndicator:p=!0,refreshControl:m,useWindowScroll:g=!1,onLayout:h,...v},y){var x,C,w;let L=Vr(),[S]=er(["anchoredEndSpaceSize"]),k=N(null),I=N(null),T=g,A=R(()=>tj(k.current,T),[T]),P=R(()=>{let j=k.current,X=ZG(j,I.current,T),ae=CN(j,T,a);return ej(X,ae,a)},[a,T]),_=R(()=>{let j=k.current;if(T){let X=P(),ae=MC(),oe=xN(j,ae),ft=a?ae.x-oe.left:ae.y-oe.top;return bN(ft,X)}return j?a?j.scrollLeft:j.scrollTop:0},[P,a,T]),E=R((j,X)=>{let ae=k.current,oe=A();if(!oe||typeof oe.scrollTo!="function")return;let ft=P(),pt=bN(j,ft),Lt={behavior:X?"smooth":"auto"};if(T){let on=MC(),gt=xN(ae,on),{left:zt,top:Mt}=oj({clampedOffset:pt,horizontal:a,listPos:gt,scroll:on});Lt.left=zt,Lt.top=Mt}else a?Lt.left=pt:Lt.top=pt;oe.scrollTo(Lt)},[P,A,a,T]);ir(y,()=>({getBoundingClientRect:()=>{var X;return(X=k.current)==null?void 0:X.getBoundingClientRect()},getCurrentScrollOffset:_,getScrollableNode:()=>SN(k.current,T),getScrollEventTarget:()=>A(),getScrollResponder:()=>SN(k.current,T),isWindowScroll:()=>T,scrollBy:(X,ae)=>{let oe=A();!oe||typeof oe.scrollBy!="function"||oe.scrollBy({behavior:"auto",left:X,top:ae})},scrollTo:X=>{let{x:ae=0,y:oe=0,animated:ft=!0}=X;E(a?ae:oe,ft)},scrollToEnd:(X={})=>{let{animated:ae=!0}=X,oe=P();E(oe,ae)},scrollToOffset:X=>{let{offset:ae,animated:oe=!0}=X;E(ae,oe)}}),[_,P,A,a,T,E]);let F=R(()=>{if(!l||!k.current)return;let j=k_(I.current),X=CN(k.current,T,a),ae=_(),oe={nativeEvent:{contentOffset:{x:a?ae:0,y:a?0:ae},contentSize:{height:j.height,width:j.width},layoutMeasurement:{height:X.height,width:X.width}}};l(oe)},[_,a,T,l]),B=YG(F),V=N(void 0),Q=R(()=>{let j=V.current;j!==void 0&&(clearTimeout(j),V.current=void 0),B.flush(),d?.()},[d,B]),Se=R(j=>{if(!l)return;let X=L.state;if(!!X?.scrollingTo||!!X?.initialScrollSession&&!X.didFinishInitialScroll||!!X?.initialScroll&&!X.didFinishInitialScroll||!!X&&Ku(X)?B.flush():B.schedule(),d){let oe=V.current;oe!==void 0&&clearTimeout(oe),V.current=setTimeout(Q,rj)}},[L.state,Q,d,l,B]);he(()=>{let j=A();if(j)return j.addEventListener("scroll",Se,{passive:!0}),"onscrollend"in j&&j.addEventListener("scrollend",Q),()=>{j.removeEventListener("scroll",Se),"onscrollend"in j&&j.removeEventListener("scrollend",Q);let X=V.current;X!==void 0&&(clearTimeout(X),V.current=void 0),B.cancel()}},[Q,A,Se,B]),W(()=>{let j=()=>{i&&E(a?i.x||0:i.y||0,!1)};j(),requestAnimationFrame(j)},[i?.x,i?.y,a,E]),he(()=>{if(!h||!k.current)return;let j=k.current,X=()=>{h({nativeEvent:{layout:nj(j,T,a)}})};X();let ae=new ResizeObserver(()=>{X()});ae.observe(j);let oe=()=>{X()};return T&&typeof window<"u"&&typeof window.addEventListener=="function"&&window.addEventListener("resize",oe),()=>{ae.disconnect(),T&&typeof window<"u"&&typeof window.removeEventListener=="function"&&window.removeEventListener("resize",oe)}},[T,h]);let H=!T&&(a?!f&&I_:!p&&T_);he(()=>{H&&ij()},[H]);let q={...T?{}:{overflow:"auto",overflowX:a||f?"auto":"hidden",overflowY:a?p?"auto":"hidden":"auto",WebkitOverflowScrolling:"touch"},...$u.flatten(n),...s?{overflowAnchor:"none"}:{}},ee=sj(L),G=(C=(x=L.state)==null?void 0:x.props)!=null&&C.anchoredEndSpace&&S?S:0,te=Math.max(0,ee-G),me=te?a?{flexShrink:0,width:te}:{height:te}:void 0,U={display:a?"flex":"block",flexDirection:a?"row":void 0,minHeight:a?void 0:"100%",minWidth:a?"100%":void 0,...$u.flatten(r),...s?{overflowAnchor:"none"}:{}},Y=o?`${RC} ${o}`:RC,{contentContainerClassName:se,contentInset:ge,scrollEventThrottle:ie,ScrollComponent:Ae,snapToOffsets:Xe,useWindowScroll:nt,className:rt,...Ve}=v,ne=T?[]:lj(Xe);ne.length>0&&(q.scrollSnapType=a?"x mandatory":"y mandatory",U.position=(w=U.position)!=null?w:"relative");let we=H?rt?`${rt} ${H}`:H:rt;return Zo&&/(?:^|\s)(?:[a-z0-9_-]+:)*gap(?:-[xy])?-(?:\[[^\]]+\]|[^\s]+)/.test(`${o??""} ${rt??""}`)&&Gs("className-gap","className/contentContainerClassName gap classes are not supported in LegendList because it needs to use exact values internally. Use contentContainerStyle={{ gap: ... }} or columnWrapperStyle instead."),De("div",{className:we,ref:k,...Ve,style:q},m,De("div",{className:Y,ref:I,style:U},ne.map(j=>De("div",{"aria-hidden":!0,"data-legend-list-snap-anchor":j,key:`snap-${j}`,style:dj(j,a)})),t,me?De("div",{"aria-hidden":!0,style:me}):null))});function cj({horizontal:e,needsOtherAxisSize:t,otherAxisSize:n}){if(!(!t||!n||n<=0))return e?{height:n}:{width:n}}function kN(e,t){let n=Vr();he(()=>Va(n,e,r=>{t(r)}),[t,n,e])}function uj(e){return e?{contentSizeKey:"scrollWidth",paddingEndProp:"paddingRight",viewportSizeKey:"clientWidth",x:1,y:0}:{contentSizeKey:"scrollHeight",paddingEndProp:"paddingBottom",viewportSizeKey:"clientHeight",x:0,y:1}}function fj(e,t){var n,o,r;let a=(n=e.state)==null?void 0:n.refScroller.current,i=(r=(o=a?.getScrollableNode)==null?void 0:o.call(a))!=null?r:null,s=null;return i&&(s=t?.isConnected&&t.parentElement===i?t:i.querySelector(`:scope > .${RC}`)),i?{contentNode:s,scrollElement:i}:null}function pj(e,t,n){e.scrollBy({behavior:"auto",left:t,top:n})}function mj(){let e=Vr(),t=N(0),n=N(0),o=N(void 0),r=N(void 0),a=N(null),i=R(()=>{let s=be(e,"scrollAdjust"),l=be(e,"scrollAdjustUserOffset"),d=(s||0)+(l||0);if(d-t.current!==0){let f=fj(e,a.current);if(f){let p=!!e.state.props.horizontal,m=uj(p),{contentNode:g,scrollElement:h}=f,v=p?h.scrollLeft:h.scrollTop,y=(l||0)-n.current,C=(y!==0?v+y:e.state.scroll)-v,w=Math.abs(C)>.01,L=()=>pj(h,m.x*C,m.y*C);if(a.current=g,w&&g){let S=g[m.contentSizeKey],k=h[m.viewportSizeKey],I=v+C;if(C>0&&!e.state.adjustingFromInitialMount&&S<I+k){let A=g.style[m.paddingEndProp],P=r.current,_=P?.value===A?P.baseline:A,E=(I+k-S)*2,B=`${(Number.parseFloat(window.getComputedStyle(g)[m.paddingEndProp])||0)+E}px`;g.style[m.paddingEndProp]=B,r.current={baseline:_,value:g.style[m.paddingEndProp]},g.offsetHeight,L(),o.current!==void 0&&cancelAnimationFrame(o.current),o.current=requestAnimationFrame(()=>{let V=r.current;o.current=void 0,r.current=void 0,g.style[m.paddingEndProp]===V?.value&&(g.style[m.paddingEndProp]=V.baseline)})}else L()}else w&&L()}t.current=d,n.current=l||0}},[e]);return kN("scrollAdjust",i),kN("scrollAdjustUserOffset",i),null}var gj=zn(function({ScrollComponent:t,...n},o){let[r]=er(["snapToOffsets"]);return De(t,{...n,ref:o,snapToOffsets:r})}),NC=.1;function hj(e,t,n){let o=be(e,t)!==n;return o&&(Be(e,t,n),Js(e)),o}function vj(e,t,n){let{didContainersLayout:o,didFinishInitialScroll:r,props:a,scroll:i,scrollingTo:s}=e.state,l=n-t,c=((a.horizontal?a.stylePaddingLeft:a.stylePaddingTop)||0)+t;return a.maintainVisibleContentPosition.size&&o&&r&&!s&&i>=c-NC&&Math.abs(l)>NC}function LN(e,t){let{state:n}=e,o=be(e,"headerSize")||0,r=o!==t,a=n.didMeasureHeader||o>NC;r&&(Be(e,"headerSize",t),Js(e),a&&vj(e,o,t)&&Zs(e,t-o)),n.didMeasureHeader=!0}function yj(e,t){let n=hj(e,"footerSize",t);return n&&Ag(e),n}function xj(e,t){var n,o,r,a,i,s,l,d;return((n=e?.top)!=null?n:0)===((o=t?.top)!=null?o:0)&&((r=e?.bottom)!=null?r:0)===((a=t?.bottom)!=null?a:0)&&((i=e?.left)!=null?i:0)===((s=t?.left)!=null?s:0)&&((l=e?.right)!=null?l:0)===((d=t?.right)!=null?d:0)}function Cj(e,t){let{state:n}=e,o=n.contentInsetOverride,r=t??void 0,a=!xj(o,r);return n.contentInsetOverride=r,a&&Js(e),a}function bj(e,t){let n=EC(e),o=EC(t);return K(()=>zn((r,a)=>{var i,s;return(s=(i=n.current)==null?void 0:i.call(n,o.current(r,a)))!=null?s:null}),[o,n])}var PN=({onLayoutChange:e,refView:t,children:n,...o})=>{let r=N(null),a=t??r;return YC({onLayoutChange:e,ref:a}),De("div",{...o,ref:a},n)},wj=ga(function({horizontal:t}){let[n=0]=er(["alignItemsAtEndPadding"]);return n<=0?null:De(Eg,{style:t?{flexShrink:0,width:n}:{flexShrink:0,height:n}},null)}),Sj=ga(function({canRender:t,freshDataTransitionEpoch:n,style:o,contentContainerStyle:r,horizontal:a,initialContentOffset:i,recycleItems:s,ItemSeparatorComponent:l,alignItemsAtEnd:d,onScroll:c,onLayout:f,ListHeaderComponent:p,ListHeaderComponentStyle:m,ListFooterComponent:g,ListFooterComponentStyle:h,ListEmptyComponent:v,getRenderedItem:y,refScrollView:x,renderScrollComponent:C,onLayoutFooter:w,onInternalScrollBeginDrag:L,onInternalScrollEnd:S,scrollAdjustHandler:k,snapToIndices:I,stickyHeaderConfig:T,stickyHeaderIndices:A,useWindowScroll:P=!1,..._}){let E=Vr(),F=E.state.props.maintainVisibleContentPosition,[B=0,V=0]=er(["anchoredEndSpaceSize","otherAxisSize"]),Q=E.state.props.alignItemsAtEndPaddingEnabled,Se=!!E.state.props.anchoredEndSpace&&E.state.props.anchoredEndSpaceOwner==="list"&&B>0,H;if(Se){let se=a?ja(E.state)?"Left":"Right":"Bottom",ge=$u.flatten(r);H={[`padding${se}`]:Ru({},ge||{},se)+B}}let q=cj({horizontal:a,needsOtherAxisSize:E.state.needsOtherAxisSize,otherAxisSize:V}),ee=bj(C,(se,ge)=>({...se,ref:ge})),G=C?ee:TN,te=I?gj:G,me=R((se,ge)=>{var ie;let Ae=yj(E,se);ge?.(),Ae&&((ie=E.state.props.maintainScrollAtEnd)!=null&&ie.onFooterLayout)&&Cd(E)},[E]);he(()=>{p||LN(E,0),g||me(0)},[p,g,E,me]);let U=R(se=>{let ge=se[a?"width":"height"];LN(E,ge)},[E,a]),Y=R((se,ge)=>{let ie=se[a?"width":"height"];me(ie,()=>{w?.(se,ge)})},[a,w,me]);return De(te,{..._,...G===TN?{onInternalScrollEnd:S,useWindowScroll:P}:{},contentContainerStyle:[a?{height:"100%"}:{},r,H,{boxSizing:"border-box"}],contentOffset:i!==void 0?a?{x:i,y:0}:{x:0,y:i}:void 0,horizontal:a,maintainVisibleContentPosition:F.size||F.data?{minIndexForVisible:0}:void 0,onLayout:f,onScroll:c,ref:x,ScrollComponent:I?G:void 0,style:q?[q,o]:o},De(mj,null),p&&De(PN,{onLayoutChange:U,style:m},Sg(p)),v&&Sg(v),Q&&De(wj,{horizontal:a}),t&&!v&&De(QG,{freshDataTransitionEpoch:n,getRenderedItem:y,horizontal:a,ItemSeparatorComponent:l,recycleItems:s,stickyHeaderConfig:T}),g&&De(PN,{onLayoutChange:Y,style:h},Sg(g)),Zo&&S4)}),Ij=100,Tj=.9,kj=.9;function Lj(e){let t=Vr(),{anchoredEndSpace:n,childrenMode:o,keyExtractor:r,numColumns:a,renderScrollComponent:i,useWindowScroll:s}=e,l=!!n;W(()=>{l&&(a??1)>1&&Gs("anchoredEndSpaceNumColumns","anchoredEndSpace is only supported when numColumns is 1. Using it with multiple columns may produce incorrect anchored spacing.")},[l,a]),W(()=>{s&&i&&Gs("useWindowScrollRenderScrollComponent","useWindowScroll is not supported when renderScrollComponent is provided.")},[i,s]),W(()=>{!r&&!t.state.isFirst&&t.state.didDataChange&&!o&&Gs("keyExtractor","Changing data without a keyExtractor can cause slow performance and resetting scroll. If your list data can change you should use a keyExtractor with a unique id for best performance and behavior.")},[o,t,r]),W(()=>{let d=t.state,c=d.props.data.length;if(d.props.useWindowScroll||c<Ij)return;let p=()=>{let g=be(t,"readyToRender"),h=be(t,"numContainers")||0,v=be(t,"totalSize")||0,y=t.state.scrollLength||0;if(!g||v<=0||y<=0)return;let x=h>=Math.ceil(c*Tj),C=y>=v*kj;x&&C&&Gs("webUnboundedOuterSize","LegendList appears to have an unbounded outer height on web, so virtualization is effectively disabled. Set a bounded height or flex: 1 on the list container, or use useWindowScroll.")};p();let m=[Va(t,"numContainers",p),Va(t,"readyToRender",p),Va(t,"totalSize",p)];return()=>{for(let g of m)g()}},[t])}function Pj(e){}var Aj=Zo?Lj:Pj;function Ej(e,t,{didColumnsChange:n=!1}={}){let o=e.state,{previousData:r}=o,{maintainScrollAtEnd:a}=o.props;if(n){o.sizes.clear(),o.sizesKnown.clear(),s_(o);for(let l in o.averageSizes)delete o.averageSizes[l];o.minIndexSizeChanged=0,o.scrollForNextCalculateItemsInView=void 0}qa(e,{dataChanged:!0,doMVCP:!0});let s=!n&&a?.onDataChange&&Cd(e);!s&&r&&t.length>r.length&&(o.isEndReached=!1),s||_g(e),delete o.previousData}function Rj(e,t,n){var o;if(e.pendingDataComparison=void 0,!n||!t||t.length!==n.length)return!0;let{idCache:r,props:{itemsAreEqual:a,keyExtractor:i}}=e,s;for(let l=0;l<t.length;l++){if(t[l]===n[l])continue;if(!i)return s&&(e.pendingDataComparison={byIndex:s,nextData:t,previousData:n}),!0;let d=(o=r[l])!=null?o:i(n[l],l),c=i(t[l],l);if(d!==c)return s&&(e.pendingDataComparison={byIndex:s,nextData:t,previousData:n}),!0;if(!a)return s&&(e.pendingDataComparison={byIndex:s,nextData:t,previousData:n}),!0;let f=a(n[l],t[l],l,t);if(s??(s=[]),s[l]=f?1:2,!f)return e.pendingDataComparison={byIndex:s,nextData:t,previousData:n},!0}return!1}function L_(e){var t,n;let o=e.state,{scrollLength:r,props:{data:a,getFixedItemSize:i,getItemType:s,numColumns:l,estimatedItemSize:d}}=o,c=WN(e),f=be(e,"numContainers");if(r>0&&a.length>0&&!f){let p;if(i){let g=0,h=Math.min(20,a.length);for(let v=0;v<h;v++){let y=a[v];if(y!==void 0){let x=(t=s?.(y,v))!=null?t:"";g+=((n=i(y,v,x))!=null?n:d)+e.scrollAxisGap}}p=g/h}else p=d+e.scrollAxisGap;let m=Math.max(1,Math.ceil((r+c*2)/p*l));for(let g=0;g<m;g++)Be(e,`containerPosition${g}`,vd),Be(e,`containerColumn${g}`,-1),Be(e,`containerSpan${g}`,1);return Be(e,"numContainers",m),Be(e,"numContainersPooled",rG(a.length,m)),o.lastLayout&&(o.initialScroll?requestAnimationFrame(()=>{qa(e,{dataChanged:!0,doMVCP:!0})}):qa(e,{dataChanged:!0,doMVCP:!0})),!0}}function Mj(){return typeof window>"u"?{height:0,width:0}:{height:window.innerHeight,width:window.innerWidth}}function Nj(e,t,n){let o=e.state,{maintainScrollAtEnd:r,useWindowScroll:a}=o.props,i=o.props.horizontal?"width":"height",s=o.props.horizontal?"height":"width",l=t;if(a){let v=Mj()[i];l=v>0?{...t,[i]:v}:t}let d=l[i],c=o.scrollLength,f=d>0?d:c,p=l[s],m=!o.lastLayout||f>o.scrollLength||o.lastLayout.x!==l.x||o.lastLayout.y!==l.y;o.lastLayout=l;let g=o.otherAxisSize,h=f!==o.scrollLength||p!==g;if(h){if(o.scrollLength=f,o.otherAxisSize=p,Js(e),o.lastBatchingAction=Date.now(),o.scrollForNextCalculateItemsInView=void 0,f>0&&L_(e),m&&qa(e,{doMVCP:!0}),(h||p!==g)&&Be(e,"scrollSize",{height:l.height,width:l.width}),r?.onLayout&&Cd(e),_g(e),o){let v=o.props.horizontal?(o.props.stylePaddingTop||0)+(o.props.stylePaddingBottom||0):(o.props.stylePaddingLeft||0)+(o.props.stylePaddingRight||0);o.needsOtherAxisSize=p-v<10}Zo&&d===0&&Gs("height0",`List ${o.props.horizontal?"width":"height"} is 0. You may need to set a style or \`flex: \` for the list, because children are absolutely positioned.`)}n(!0)}function _j(e,t){let n=oo.get(e);if(!!n&&oo.didReachTarget(t,n)){oo.clear(e);return}n&&(e.hasScrolled=!1,oo.set(e,{startScroll:n.startScroll,targetOffset:n.targetOffset}))}function Dj(e){var t;return!!e.initialScroll&&((t=e.initialScrollSession)==null?void 0:t.kind)==="bootstrap"&&!e.didFinishInitialScroll}function Oj(e){return{...e,nativeEvent:{...e.nativeEvent}}}function Fj(e,t){var n,o,r,a,i,s;let l=e.state,{scrollProcessingEnabled:d}=l;if(d===!1||((o=(n=t.nativeEvent)==null?void 0:n.contentSize)==null?void 0:o.height)===0&&((r=t.nativeEvent.contentSize)==null?void 0:r.width)===0)return;let c=!1;if((a=t.nativeEvent)!=null&&a.contentInset){let{contentInset:p}=t.nativeEvent,m=l.nativeContentInset;(!m||m.top!==p.top||m.bottom!==p.bottom||m.left!==p.left||m.right!==p.right)&&(l.nativeContentInset=p,c=!0)}let f=t.nativeEvent.contentOffset[l.props.horizontal?"x":"y"];if(l.props.horizontal&&(f=d4(l,f,(i=t.nativeEvent.contentSize)==null?void 0:i.width)),l.didFinishInitialScroll&&((s=l.initialScroll)==null?void 0:s.viewPosition)===1&&l.scroll>l.scrollLength,l.lastNativeScroll=f,l.lastNativeScrollTime=Date.now(),l.scrollingTo&&l.scrollingTo.offset>=f){let p=Bi(e,f,l.scrollingTo);if(f!==p&&Math.abs(f-p)>1){f=p,zg(e,{forceScroll:!0,isInitialScroll:!0,noScrollingTo:!0,offset:f});return}}l.scrollPending=f,Qs(e,f,c,{fromNativeScrollEvent:!0}),_j(l,f),TW(e),l.scrollingTo&&jC(e),l.props.onScroll&&(Dj(l)?l.deferredPublicOnScrollEvent=Oj(t):l.props.onScroll(t))}var Bj=class{constructor(){this.work=new Map}timeout(e,t,n){n&&this.cancel(n);let o=[void 0,clearTimeout],r=setTimeout(()=>{let a=n??r;this.work.get(a)===o&&(this.work.delete(a),e())},t);o[0]=r,this.work.set(n??r,o)}frame(e,t){this.cancel(t);let n=[void 0,cancelAnimationFrame];this.work.set(t,n),n[0]=requestAnimationFrame(()=>{this.work.get(t)===n&&(this.work.delete(t),e())})}register(e,t){this.cancel(e),this.work.set(e,[void 0,t])}cancel(e){let t=this.work.get(e);if(t){this.work.delete(e);let[n,o]=t;o(n)}}has(e){return this.work.has(e)}dispose(){for(let[e,t]of this.work.values())t(e);this.work.clear()}},zj=class{constructor(e){this.appliedAdjust=0,this.pendingAdjust=0,this.ctx=e}requestAdjust(e){let t=this.ctx.state.scrollingTo;t?.animated&&!t.isInitialScroll?(this.pendingAdjust+=e,Be(this.ctx,"scrollAdjustPending",this.pendingAdjust)):(this.appliedAdjust+=e,Be(this.ctx,"scrollAdjust",this.appliedAdjust)),this.ctx.state.scrollingTo&&jC(this.ctx)}getAdjust(){return this.appliedAdjust}commitPendingAdjust(e){{let t=this.ctx.state,n=this.pendingAdjust;if(this.pendingAdjust=0,n!==0){let o;if(e?.index!==void 0){let a=Dg(this.ctx,e.index);o=Fg(this.ctx,a,e),o=Bi(this.ctx,o,e)}else o=Bi(this.ctx,t.scroll+n);let r=o-t.scroll;(Math.abs(r)>.1||Math.abs(n)>.1)&&(this.appliedAdjust+=r,t.scroll=o,t.scrollForNextCalculateItemsInView=void 0,Be(this.ctx,"scrollAdjust",this.appliedAdjust)),Be(this.ctx,"scrollAdjustPending",0),qa(this.ctx)}}}};function Uj(e,t){let n=e.state,o=js(e,t),a=js(e)-o;if(a!==0){let i=!!be(e,"isWithinMaintainScrollAtEndThreshold");Qs(e,n.scroll,!0,{markHasScrolled:!1}),!c_(e)&&i&&a>0&&Zs(e,a)}}function wC(e){return K(()=>e?(t,n,o)=>t!==void 0&&n!==void 0?e(t,n,o):void 0:void 0,[e])}var Hj=(...e)=>R(n=>{for(let o of e)o&&(QN(o)?o(n):o.current=n)},e);function $j(e){return null}function Kj(e,t,n,o){return o}function Vj(e){let{gap:t,columnGap:n,rowGap:o}=e;if(t||n||o)return e.gap=void 0,e.columnGap=void 0,e.rowGap=void 0,{columnGap:n,gap:t,rowGap:o}}function qj(e,t){let n=e.state,r=n.props.data.length-1;if(r===-1)return!1;let a=n.props.stylePaddingBottom||0,i=be(e,"footerSize")||0;return wg(e,{...t,index:r,viewOffset:-a-i+(t?.viewOffset||0),viewPosition:1}),!0}var Wj="default";function Gj(e){let t={};for(let n in e.averageSizes){let o=e.averageSizes[n];o&&(t[n||Wj]={average:o.avg,count:o.num})}return t}function jj(e){Pg(e)}function Qj(e,t){let n=e.state,o=800,r=2,a=0,i=()=>!!n.didDataChange||!!n.didColumnsChange||n.scheduledWork.has("mvcpRecalculate")||n.ignoreScrollFromMVCP!==void 0,s=(h,v=!1)=>{var y;let x=n.props,C=x.data.length,w=(y=x.anchoredEndSpace)==null?void 0:y.anchorIndex;return h<0?v:h>=C?!1:w===void 0||w<0||w>=C||h<w?!0:H4(e,w,C-1)},l=(h,v,y)=>{let x=Date.now(),C=0,w=()=>{if(h!==a)return;i()||!y()?C=0:C+=1;let L=Date.now()-x>=o;if(C>=r||L){v();return}n.scheduledWork.frame(w,"imperativeScrollReady")};n.scheduledWork.frame(w,"imperativeScrollReady")},d=(h,v,y,x=()=>!0)=>{let C=()=>{if(h!==a)return;(!y()||!n.scrollingTo)&&(n.pendingScrollResolve===v&&(n.pendingScrollResolve=void 0),v())};i()||!x()?l(h,C,x):C()},c=h=>{n.scheduledWork.cancel("imperativeScrollReady");let v=++a;return BN(n),n.pendingScrollResolve=h,v},f=(h,v=()=>!0)=>new Promise(y=>{let x=c(y);aN(e),d(x,y,h,v)});n.runPendingScrollToEnd=()=>{let h=n.pendingScrollToEnd;h&&(n.pendingScrollToEnd=void 0,h.token===a&&d(h.token,h.resolve,()=>qj(e,h.options),()=>s(n.props.data.length-1,!0)))};let p=h=>{if(n){let{index:v,...y}=h,{startNoBuffer:x,endNoBuffer:C}=n;if(v<x||v>C){let w=v<x?0:1;return wg(e,{...y,index:v,viewPosition:w}),!0}}return!1},m=n.refScroller;return{clearCaches:h=>{var v,y;let x=(v=h?.mode)!=null?v:"sizes";n.sizes.clear(),n.sizesKnown.clear(),s_(n);for(let C in n.averageSizes)delete n.averageSizes[C];n.minIndexSizeChanged=0,n.scrollForNextCalculateItemsInView=void 0,n.pendingTotalSize=void 0,n.totalSize=0,Be(e,"totalSize",0),x==="full"&&(n.indexByKey.clear(),n.idCache.length=0,n.positions.length=0,n.columns.length=0,n.columnSpans.length=0),jj(e),(y=n.triggerCalculateItemsInView)==null||y.call(n,{forceFullItemPositions:!0})},flashScrollIndicators:()=>m.current.flashScrollIndicators(),getAnimatableRef:()=>{var h,v,y;return(y=(v=(h=m.current).getNativeScrollRef)==null?void 0:v.call(h))!=null?y:m.current},getNativeScrollRef:()=>m.current,getScrollableNode:()=>m.current.getScrollableNode(),getScrollResponder:()=>m.current.getScrollResponder(),getState:()=>({activeStickyIndex:be(e,"activeStickyIndex"),contentLength:uo(e),data:n.props.data,elementAtIndex:h=>{var v;return(v=e.viewRefs.get(kC(e,jt(n,h))))==null?void 0:v.current},end:n.endNoBuffer,endBuffered:n.endBuffered,getAverageItemSizes:()=>Gj(n),indexByKey:h=>n.indexByKey.get(h),isAtEnd:be(e,"isAtEnd"),isAtStart:be(e,"isAtStart"),isEndReached:n.isEndReached,isNearEnd:be(e,"isNearEnd"),isNearStart:be(e,"isNearStart"),isStartReached:n.isStartReached,isWithinMaintainScrollAtEndThreshold:be(e,"isWithinMaintainScrollAtEndThreshold"),listen:(h,v)=>Va(e,h,v),listenToPosition:(h,v)=>g4(e,h,v),positionAtIndex:h=>n.positions[h],positionByKey:h=>{let v=n.indexByKey.get(h);return v===void 0?void 0:n.positions[v]},scroll:n.scroll,scrollLength:n.scrollLength,scrollVelocity:Bg(n),sizeAtIndex:h=>n.sizesKnown.get(jt(n,h)),sizes:n.sizesKnown,start:n.startNoBuffer,startBuffered:n.startBuffered}),reportContentInset:h=>{let v=Cj(e,h);Qs(e,n.scroll,!0,{markHasScrolled:!1}),v&&c_(e)},scrollIndexIntoView:h=>f(()=>p(h)),scrollItemIntoView:({item:h,...v})=>f(()=>{let x=n.props.data.indexOf(h);return x!==-1?(p({index:x,...v}),!0):!1}),scrollToEnd:h=>new Promise(v=>{var y;let x=c(v);n.pendingScrollToEnd={options:h,resolve:v,token:x},t?.(),aN(e),t||(y=n.runPendingScrollToEnd)==null||y.call(n)}),scrollToIndex:h=>f(()=>(wg(e,h),!0),h.index>=0?()=>s(h.index):void 0),scrollToItem:({item:h,...v})=>f(()=>{let x=n.props.data.indexOf(h);return x!==-1?(wg(e,{index:x,...v}),!0):!1}),scrollToOffset:h=>f(()=>(zg(e,h),!0)),setItemSize:(h,v)=>{C_(e,{itemKey:h,size:v})},setScrollProcessingEnabled:h=>{n.scrollProcessingEnabled=h},setVisibleContentAnchorOffset:h=>{let v=QN(h)?h(be(e,"scrollAdjustUserOffset")||0):h;Be(e,"scrollAdjustUserOffset",v)}}}var Xj=(e,t)=>e-t,AN=e=>typeof e=="number"&&Number.isFinite(e)?Math.max(0,Math.floor(e)):0,Eu=(e,t,n)=>{n>=0&&n<t&&e.add(n)};function Yj(e,t,n,o){var r,a;if(t.length===0)return[];let i=new Set,s=t.length,l=AN(e?.top);if(l>0)for(let f=0;f<Math.min(l,s);f++)Eu(i,s,f);let d=AN(e?.bottom);if(d>0)for(let f=Math.max(0,s-d);f<s;f++)Eu(i,s,f);if((r=e?.indices)!=null&&r.length)for(let f of e.indices)Number.isFinite(f)&&Eu(i,s,Math.floor(f));if((a=e?.keys)!=null&&a.length){let f=new Set(e.keys);for(let p=0;p<s&&f.size>0;p++){let m=n(t[p],p);f.has(m)&&(Eu(i,s,p),f.delete(m))}}if(o!==void 0&&Number.isFinite(o)){let f=Math.floor(o);for(let p=f>=0?f:s;p<s;p++)Eu(i,s,p)}let c=Array.from(i);return c.sort(Xj),c}function Jj(e,t){var n;let o=e.state;if(!o)return null;let{indexByKey:r,props:{data:a,getItemType:i,renderItem:s}}=o,l=r.get(t);if(l===void 0)return null;let d=null,c=be(e,"extraData"),f=a[l];if(s&&!_u(f)){let p={data:a,extraData:c,index:l,item:f,type:i&&(n=i(f,l))!=null?n:""};d=s(p)}return{index:l,item:a[l],renderedItem:d}}function EN(e,t){var n,o,r,a;return{animated:!1,onDataChange:t?(n=e?.dataChange)!=null?n:!1:!0,onFooterLayout:t?(o=e?.footerLayout)!=null?o:!1:!0,onItemLayout:t?(r=e?.itemLayout)!=null?r:!1:!0,onLayout:t?(a=e?.layout)!=null?a:!1:!0}}function Zj(e){var t;return e?e===!0?{...EN(void 0,!1),animated:!1}:{...EN(e.on,"on"in e),animated:(t=e.animated)!=null?t:!1}:void 0}function e6(e){var t,n;return e===!0?{data:!0,size:!0}:e&&typeof e=="object"?{data:(t=e.data)!=null?t:!1,shouldRestorePosition:e.shouldRestorePosition,size:(n=e.size)!=null?n:!0}:e===!1?{data:!1,size:!1}:{data:!1,size:!0}}function t6(e,{stylePaddingTop:t}){let n=e.state;if(t!==void 0){let o=be(e,"stylePaddingTop")||0;if(t<o){let r=be(e,"totalSize")||0;Be(e,"totalSize",r+o),n.timeoutSetPaddingTop=setTimeout(()=>{r=be(e,"totalSize")||0,Be(e,"totalSize",r-o)},16)}Be(e,"stylePaddingTop",t)}}function n6(e){let t=N(null),n=N(0),o=N(null),r=()=>{t.current&&(clearTimeout(t.current),t.current=null)};return R((i,s,...l)=>{{let d=Date.now();o.current=l,d-n.current>=s?(n.current=d,i(...l),r()):(r(),t.current=setTimeout(()=>{o.current&&(n.current=Date.now(),i(...o.current),t.current=null,o.current=null)},s-(d-n.current)))}},[e])}function o6(e,t){let n=n6("throttle");return o=>n(e,t,{nativeEvent:o.nativeEvent})}var r6=ga(b_(function(t,n){let{children:o,data:r,renderItem:a,...i}=t,l=o!==void 0&&r===void 0?{...i,childrenMode:!0,data:(Og(o)?o:ph.toArray(o)).flat(1),renderItem:({item:d})=>d}:{...i,data:r||[],renderItem:a};return De(f4,null,De(a6,{...l,ref:n}))})),a6=b_(function(t,n){var o,r,a,i,s,l,d,c,f,p,m,g,h,v,y,x,C,w,L;let S=R($e=>{},[]);t.recycleItems===void 0&&Gs("recycleItems-omitted","recycleItems was not provided, so it defaults to false. Set recycleItems explicitly to true for better performance with recycling-aware rows, or false to preserve remount-on-reuse behavior.");let{alignItemsAtEnd:k=!1,anchoredEndSpace:I,alwaysRender:T,columnWrapperStyle:A,contentContainerStyle:P,contentInset:_,data:E=[],dataKey:F,dataVersion:B,drawDistance:V=250,contentInsetEndAdjustment:Q,estimatedItemSize:Se=100,estimatedListSize:H,extraData:q,getFixedItemSize:ee,getItemType:G,horizontal:te,rtl:me,estimatedHeaderSize:U,initialScrollAtEnd:Y=!1,initialScrollIndex:se,initialScrollOffset:ge,experimental_adaptiveRender:ie,itemsAreEqual:Ae,keyExtractor:Xe,ListEmptyComponent:nt,ListFooterComponent:rt,ListFooterComponentStyle:Ve,ListHeaderComponent:ne,maintainScrollAtEnd:we=!1,maintainScrollAtEndThreshold:j=.1,maintainVisibleContentPosition:X,numColumns:ae=1,overrideItemLayout:oe,onEndReached:ft,onEndReachedThreshold:pt=.5,onItemSizeChanged:yt,onMetricsChange:Lt,onLayout:on,onLoad:gt,onMomentumScrollEnd:zt,onRefresh:Mt,onScroll:wt,onScrollBeginDrag:In,onStartReached:ct,onStartReachedThreshold:dn=.5,onStickyHeaderChange:ro,onFirstVisibleItemChanged:Vt,onViewableItemsChanged:bn,progressViewOffset:Tn,recycleItems:rn=!1,refreshControl:kn,refreshing:O,refScrollView:fe,renderScrollComponent:ye,renderItem:Te,scrollEventThrottle:Me,snapToIndices:ht,stickyHeaderIndices:Ln,style:mn,useWindowScroll:at=!1,viewabilityConfig:Pt,viewabilityConfigCallbackPairs:Et,...St}=t,an=t.animatedPropsInternal,Jt=(o=t.anchoredEndSpaceOwnerInternal)!=null?o:"list",xe=t.positionComponentInternal,_e=t.stickyPositionComponentInternal,{anchoredEndSpaceOwnerInternal:qe,positionComponentInternal:We,stickyPositionComponentInternal:ot,...xt}=St,Bt=$u.flatten(P),Zt=k&&!te&&Bt?.minHeight==null&&E.length>0,ke=k&&!Zt&&(te?Bt?.minWidth==null:Bt?.minHeight==null),Ut={...Bt,...k&&!Zt?{display:"flex",flexDirection:te?"row":"column",...ke?{flexGrow:1}:{},justifyContent:"flex-end"}:{}},vt={...$u.flatten(mn)},Nt=Ru(vt,Ut,"Top"),Bn=Ru(vt,Ut,"Bottom"),ve=Ru(vt,Ut,"Left"),et=Ru(vt,Ut,"Right"),lt=FC({horizontal:te,rtl:me,stylePaddingBottom:Bn,stylePaddingLeft:ve,stylePaddingRight:et}),it=Zj(we),xn=e6(X),gn=se!=null,cn=ge!=null,It=!Y&&!gn&&!cn&&OC({horizontal:te,rtl:me}),Qt=!Y&&!gn&&(cn||It),qt=Y||gn,ko=Y?{index:Math.max(0,E.length-1),preserveForBottomPadding:!0,viewOffset:-lt,viewPosition:1}:gn?typeof se=="object"?{index:(r=se.index)!=null?r:0,preserveForBottomPadding:se.viewOffset===void 0&&se.viewPosition===1?!0:void 0,viewOffset:(a=se.viewOffset)!=null?a:se.viewPosition===1?-lt:0,viewPosition:(i=se.viewPosition)!=null?i:0}:{index:se??0,viewOffset:ge??0}:Qt?{contentOffset:ge??0,index:0,viewOffset:0}:void 0,[Do,va]=J(!zC),[,Ya]=Ia($e=>$e+1,0),Ue=Vr();Ue.columnWrapperStyle=A||(Ut?Vj(Ut):void 0);let ya=te?(d=(s=Ue.columnWrapperStyle)==null?void 0:s.columnGap)!=null?d:(l=Ue.columnWrapperStyle)==null?void 0:l.gap:(p=(c=Ue.columnWrapperStyle)==null?void 0:c.rowGap)!=null?p:(f=Ue.columnWrapperStyle)==null?void 0:f.gap,Wr=typeof ya=="number"&&Number.isFinite(ya)?ya:0,tr=N(null),Nn=Hj(tr,fe),Ja=Xe??(($e,Dt)=>Dt.toString()),nr=Ln,Za=Q,br=N(Za),wr=K(()=>{let $e=Yj(T,E,Ja,I?.anchorIndex);return{arr:$e,set:new Set($e)}},[I?.anchorIndex,T?.top,T?.bottom,(m=T?.indices)==null?void 0:m.join(","),(g=T?.keys)==null?void 0:g.join(","),E,F,B,Ja]),or=!!at&&!ye,_t=N(void 0),Gn=!!oe,Lo=N(Gn);if(!_t.current){if(!Ue.state){let $e=(H??{height:0,width:0})[te?"width":"height"];Ue.values.set("adaptiveRender",(h=ie?.initialMode)!=null?h:"normal"),Ue.state={averageSizes:{},columnSpans:[],columns:[],containerItemGenerations:[],containerItemKeys:new Map,containerItemMetadata:new Map,contentInsetOverride:void 0,dataChangeEpoch:0,dataChangeNeedsScrollUpdate:!1,didColumnsChange:!1,didDataChange:!1,didLoad:!1,enableScrollForNextCalculateItemsInView:!0,endBuffered:-1,endNoBuffer:-1,endReachedSnapshot:void 0,firstFullyOnScreenIndex:-1,freshDataTransitionEpoch:0,hasHadNonEmptyData:E.length>0,idCache:[],idsInView:[],indexByKey:new Map,initialScroll:ko,initialScrollSession:ko?{kind:Qt?"offset":"bootstrap",previousDataLength:E.length}:void 0,isEndReached:null,isFirst:!0,isStartReached:null,lastBatchingAction:Date.now(),lastLayout:void 0,lastScrollDelta:0,loadStartTime:Date.now(),minIndexSizeChanged:0,nativeContentInset:void 0,nativeMarginTop:0,pendingDataComparison:void 0,pendingNativeMVCPAdjust:void 0,positions:[],props:{},queuedCalculateItemsInView:0,refScroller:{current:null},scheduledWork:new Bj,scroll:0,scrollAdjustHandler:new zj(Ue),scrollForNextCalculateItemsInView:void 0,scrollHistory:[],scrollLength:$e,scrollPending:0,scrollPrev:0,scrollPrevTime:0,scrollProcessingEnabled:!0,scrollTime:0,sizes:new Map,sizesKnown:new Map,startBuffered:-1,startNoBuffer:-1,startReachedSnapshot:void 0,stickyContainerPool:new Set,stickyContainers:new Map,totalSize:0,viewabilityConfigCallbackPairs:void 0};let Dt=Ue.state;Dt.triggerCalculateItemsInView=un=>qa(Ue,un),Dt.reprocessCurrentScroll=()=>Qs(Ue,Dt.scroll,!0),Be(Ue,"maintainVisibleContentPosition",xn),Be(Ue,"extraData",q),U!==void 0&&Be(Ue,"headerSize",U)}_t.current=Ue.state}let Ee=_t.current,Oo=Ee.isFirst,zi=Ee.props.adaptiveRender,jn=Ee.props.numColumns,Fo=!Oo&&Ue.scrollAxisGap!==Wr;Ue.scrollAxisGap=Wr,Ee.didColumnsChange=ae!==jn||Fo;let Qn=(y=(v=Ee.props.data)==null?void 0:v.length)!=null?y:0,rr=Ee.props.data!==E,Bo=Ee.props.dataKey!==F,Sr=Ee.props.dataVersion!==B,po=Bo||Sr||rr&&Rj(Ee,E,Ee.props.data),zo=!Oo&&po&&Ee.hasHadNonEmptyData&&(Bo||Qn===0)&&E.length>0;po&&!Y&&Ee.didFinishInitialScroll&&((x=Ee.initialScroll)==null?void 0:x.viewPosition)===1&&Ee.props.data.length>0&&yd(Ee),po&&(Ee.dataChangeEpoch+=1,Ee.dataChangeNeedsScrollUpdate=!0,Ee.didDataChange=!0,Ee.previousData=Ee.props.data),zo&&(Ee.freshDataTransitionEpoch+=1);let Ui=o6(wt??S,Me??0),Pn=Me&&wt?Ui:wt,ei=!Oo&&!po&&((C=Ee.props.anchoredEndSpace)==null?void 0:C.anchorIndex)!==I?.anchorIndex;Ee.props={adaptiveRender:ie,alignItemsAtEnd:k,alignItemsAtEndPaddingEnabled:Zt,alwaysRender:T,alwaysRenderIndicesArr:wr.arr,alwaysRenderIndicesSet:wr.set,anchoredEndSpace:I,anchoredEndSpaceOwner:Jt,animatedProps:an,contentContainerAlignItems:Ut.alignItems,contentInset:_,contentInsetEndAdjustment:Za,data:E,dataKey:F,dataVersion:B,drawDistance:V,estimatedItemSize:Se,getFixedItemSize:wC(ee),getItemType:wC(G),horizontal:!!te,itemsAreEqual:Ae,keyExtractor:wC(Ja),maintainScrollAtEnd:it,maintainScrollAtEndThreshold:j,maintainVisibleContentPosition:xn,numColumns:ae,onEndReached:ft,onEndReachedThreshold:pt,onFirstVisibleItemChanged:Vt,onItemSizeChanged:yt,onLoad:gt,onMomentumScrollEnd:zt,onScroll:Pn,onScrollBeginDrag:In,onStartReached:ct,onStartReachedThreshold:dn,onStickyHeaderChange:ro,overrideItemLayout:oe,positionComponentInternal:xe,recycleItems:!!rn,renderItem:Te,rtl:me,snapToIndices:ht,stickyHeaderIndicesArr:nr??[],stickyHeaderIndicesSet:K(()=>new Set(nr??[]),[nr?.join(",")]),stickyPositionComponentInternal:_e,stylePaddingBottom:Bn,stylePaddingLeft:ve,stylePaddingRight:et,stylePaddingTop:Nt,useWindowScroll:or},Ee.refScroller=tr,!Oo&&zi&&!ie&&UC(Ue);let Po=K(()=>E.length?Array.from({length:Math.min(ae,E.length)},($e,Dt)=>jt(Ee,E.length-1-Dt)):[],[E,F,B,ae]),Uo=$e=>{Be(Ue,"lastItemKeys",Po),Be(Ue,"numColumns",ae);let Dt=be(Ue,"stylePaddingTop");t6(Ue,{stylePaddingTop:Nt}),_t.current.props.stylePaddingBottom=Bn,Js(Ue);let un=Nt-Dt;$e&&xn.size&&un&&Dt!==void 0&&Wa.OS};Oo&&(Uo(!1),u_(Ee),p_(Ue,!0));let Gr=K(()=>{var $e,Dt;let un=Ee.initialScroll;if(!un)return;let An=($e=un.contentOffset)!=null?$e:Kr(Ue,un);return qt&&((Dt=Ee.initialScrollSession)==null?void 0:Dt.kind)==="bootstrap"&&Wa.OS==="web"?void 0:An},[qt]);he(()=>{qW(Ue,{alwaysDispatchInitialScroll:It,dataLength:E.length,hasFooterComponent:!!rt,initialContentOffset:Gr,initialScrollAtEnd:Y,useBootstrapInitialScroll:qt})},[]),(Oo||po||Ee.didColumnsChange)&&(_t.current.lastBatchingAction=Date.now(),!Xe&&!Oo&&po&&(_t.current.sizes.clear(),_t.current.positions.length=0,_t.current.totalSize=0,Be(Ue,"totalSize",0))),Zo&&Aj(t),he(()=>{zo&&$C(Ue,{resetInitialScroll:!!ko,resetLayout:!0}),WW(Ue,{dataLength:E.length,didDataChange:po,didStartFreshData:zo,initialScrollAtEnd:Y,latestInitialScroll:ko,latestInitialScrollSessionKind:Qt?"offset":"bootstrap",stylePaddingEnd:lt,useBootstrapInitialScroll:qt})},[E.length,F,po,zo,Y,lt,qt]),he(()=>{var $e;ei&&(Ee.scrollForNextCalculateItemsInView=void 0,($e=Ee.triggerCalculateItemsInView)==null||$e.call(Ee)),Ag(Ue)},[Ue,E,B,I?.anchorIndex,I?.anchorMaxSize,I?.anchorOffset,ei,te,ae,me,Bn,ve,et]),he(()=>{let $e=br.current;br.current=Za,Uj(Ue,$e)},[Ue,Za]);let Xn=R($e=>{qt&&PW(Ue,{dataLength:E.length,footerSize:$e[te?"width":"height"],initialScrollAtEnd:Y,stylePaddingEnd:lt})},[E.length,Y,te,lt,qt]),jr=R(($e,Dt)=>{let un=Ee.scrollLength,An=Ee.otherAxisSize;Nj(Ue,$e,va),Ag(Ue);let Ho=un!==Ee.scrollLength||An!==Ee.otherAxisSize;qt&&!Dt&&Ho&&AW(Ue),!qt&&zu(Ue)},[E.length,Y,lt,qt]),{onLayout:ar}=YC({onLayoutChange:jr,onLayoutProp:on,ref:tr});he(()=>{ht&&f_(Ue)},[ht]),he(()=>Uo(!0),[F,B,Po.join(","),ae,Wr,Bn,Nt,Zt]),he(()=>{let{didColumnsChange:$e,didDataChange:Dt,isFirst:un,props:{data:An}}=Ee;!(An.length>0&&L_(Ue))&&!un&&(Dt||$e)&&Ej(Ue,An,{didColumnsChange:$e}),Dt&&(Ee.pendingDataComparison=void 0),Ee.didColumnsChange=!1,Ee.didDataChange=!1,Ee.isFirst=!1},[E,F,B,ae,Wr]),he(()=>{var $e;Be(Ue,"extraData",q);let Dt=Lo.current!==Gn;Lo.current=Gn,(Gn||Dt)&&ae>1&&(($e=Ee.triggerCalculateItemsInView)==null||$e.call(Ee,{forceFullItemPositions:!0}))},[q,Gn,ae]),W(()=>{if(!Lt)return;let $e,Dt=()=>{let An={footerSize:be(Ue,"footerSize")||0,headerSize:be(Ue,"headerSize")||0};(!$e||An.headerSize!==$e.headerSize||An.footerSize!==$e.footerSize)&&($e=An,Lt(An))};Dt();let un=[Va(Ue,"headerSize",Dt),Va(Ue,"footerSize",Dt)];return()=>{for(let An of un)An()}},[Ue,Lt]),W(()=>{let $e=JW({onViewableItemsChanged:bn,viewabilityConfig:Pt,viewabilityConfigCallbackPairs:Et});Ee.viewabilityConfigCallbackPairs=$e,Ee.enableScrollForNextCalculateItemsInView=!0,$e&&(Ee.scrollForNextCalculateItemsInView=void 0)},[Pt,Et,bn]),EG(()=>{}),ir(n,()=>Qj(Ue,Ya),[]),W(()=>()=>{T4(Ee),Ee.scheduledWork.dispose()},[Ee]),he(()=>{var $e;($e=Ee.runPendingScrollToEnd)==null||$e.call(Ee)}),W(()=>{qt||zu(Ue)},[Ue,qt]);let Yn=K(()=>({getRenderedItem:$e=>Jj(Ue,$e),onMomentumScrollEnd:$e=>{KW(Ue),Ee.props.onMomentumScrollEnd&&Ee.props.onMomentumScrollEnd($e)},onScroll:$e=>Fj(Ue,$e),onScrollBeginDrag:$e=>{var Dt,un;nN(Ue),(un=(Dt=Ee.props).onScrollBeginDrag)==null||un.call(Dt,$e)},onScrollEnd:()=>nN(Ue)}),[]),Hi=Kj(nr,te,Ue,Yn.onScroll),mo=kn;return De(oi,null,De(Sj,{...xt,alignItemsAtEnd:k,canRender:Do,contentContainerStyle:Ut,contentInset:_,freshDataTransitionEpoch:Ee.freshDataTransitionEpoch,getRenderedItem:Yn.getRenderedItem,horizontal:te,initialContentOffset:Gr,ListEmptyComponent:E.length===0?nt:void 0,ListFooterComponent:rt,ListFooterComponentStyle:Ve,ListHeaderComponent:ne,onInternalScrollBeginDrag:Yn.onScrollBeginDrag,onInternalScrollEnd:Yn.onScrollEnd,onLayout:ar,onLayoutFooter:Xn,onMomentumScrollEnd:Yn.onMomentumScrollEnd,onScroll:Hi,recycleItems:rn,refreshControl:mo?Nt>0?gf(mo,{progressViewOffset:((w=mo.props.progressViewOffset)!=null?w:0)+Nt}):mo:Mt&&De($j,{onRefresh:Mt,progressViewOffset:(Tn||0)+Nt,refreshing:!!O}),refScrollView:Nn,renderScrollComponent:ye,scrollAdjustHandler:(L=_t.current)==null?void 0:L.scrollAdjustHandler,scrollEventThrottle:0,snapToIndices:ht,stickyHeaderIndices:nr,style:vt,useWindowScroll:or}),Zo&&I4)});var i6=r6;var P_=i6;ue();ue();function s6(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function l6(e,t){let n=t?.trim();if(!n)return e;let o=new RegExp(`^${s6(n)}(?:\\s*[.:/-]\\s*|\\s+)`,"iu");return e.replace(o,"").trim()||e}function JC(e,t){let n=t?.preferShortName&&e.shortName?e.shortName:e.name;return l6(n,e.subProvider)}function bd(e){return JC(e,{preferShortName:!0})}var ZC="model:",eb="unavailable-models:",tb="action:",wd="pluginActions:manage";function Vu(e,t){return`${ZC}${e.length}:${e}${t}`}function nb(e){if(!e.startsWith(ZC))return null;let t=e.slice(ZC.length),n=t.indexOf(":");if(n===-1)return null;let o=t.slice(0,n);if(!/^\d+$/.test(o))return null;let r=Number(o),a=t.slice(n+1);return!Number.isSafeInteger(r)||r>a.length?null:{instanceId:a.slice(0,r),slug:a.slice(r)}}function A_(e){return`${eb}${e}`}function E_(e){return e.startsWith(eb)?e.slice(eb.length):null}function qu(e){return`${tb}${e}`}function R_(e){if(!e.startsWith(tb))return null;let t=e.slice(tb.length);return t.length>0?t:null}var M_=pe(function(t){let{t:n}=Ce(),o=t.isFavorite?n("modelPicker.removeFromFavorites"):n("modelPicker.addToFavorites"),r=[t.providerDisplayName,t.model.subProvider,t.providerAccountEmail].filter(s=>typeof s=="string"&&s.length>0).join(" \xB7 "),a=b(wl,{hideIndicator:!0,index:t.index,value:Vu(t.instanceId,t.model.slug),disabled:!!t.disabledReason,contentClassName:"flex w-full items-center gap-3",className:$("group relative w-full !min-w-0 max-w-full cursor-pointer rounded-md px-2 py-2 transition-colors duration-(--control-duration)","hover:bg-[color-mix(in_srgb,var(--popover)_90%,var(--contrast-foreground))] data-highlighted:bg-[color-mix(in_srgb,var(--popover)_90%,var(--contrast-foreground))] data-selected:bg-foreground/[0.08] data-selected:text-foreground data-selected:ring-0 [&[data-highlighted][data-selected]]:bg-[color-mix(in_srgb,var(--popover)_90%,var(--contrast-foreground))]",t.disabledReason&&"data-disabled:pointer-events-auto data-disabled:cursor-not-allowed data-disabled:hover:bg-transparent"),children:[b("div",{className:"min-w-0 flex-1 text-left",children:[u("div",{className:"flex min-w-0 items-center gap-2",children:u("div",{className:"min-w-0 truncate text-xs font-medium leading-snug",children:t.useTriggerLabel?bd(t.model):JC(t.model,t.preferShortName?{preferShortName:!0}:void 0)})}),t.showProvider&&b("div",{className:"mt-1 flex items-center gap-1.5",children:[u(kr,{driver:t.driver,displayName:t.providerDisplayName,accentColor:t.providerAccentColor,className:"size-icon-2",iconClassName:"size-3",indicatorBackground:"var(--popover)"}),u("span",{className:"truncate text-xs font-normal leading-snug text-muted-foreground/70",children:r})]})]}),b("div",{className:"flex shrink-0 items-center gap-1.5",children:[t.jumpLabel?u(zf,{className:"h-4 min-w-0 rounded-sm px-1.5 text-[10px]",children:t.jumpLabel}):null,b(Ye,{children:[u(Ze,{render:u(ce,{size:"icon-xs",variant:"ghost",className:$("-mr-1 shrink-0 text-muted-foreground/70 opacity-64 transition-[color,opacity] hover:text-foreground hover:opacity-100 group-hover:opacity-100",t.isFavorite&&"text-foreground opacity-100"),onClick:s=>{s.stopPropagation(),t.onToggleFavorite()},onKeyDown:s=>{s.stopPropagation()},softDisabled:!!t.disabledReason,"aria-label":o,children:u(ds,{className:$("size-icon-1",t.isFavorite&&"fill-current text-yellow-500")})})}),u(Je,{side:"top",align:"center",children:o})]})]})]}),i=t.disabledReason??t.actionLabel;return i?b(Ye,{children:[u(Ze,{render:a}),u(Je,{side:"left",align:"center",className:"max-w-64 text-balance leading-snug",children:i})]}):a});ue();function d6(e,t){let n=e.displayName,o=e.enabled?e.readiness:"disabled";if(OM(o))return n;let r=BM(o,t),a=e.snapshot.readiness.detail?.trim();return a?t("instance.statusWithDetail",{name:n,status:r,detail:a}):t("instance.status",{name:n,status:r})}var c6="pointer-events-none absolute -right-1 top-1/2 z-10 h-5 w-0.75 -translate-y-1/2 rounded-l-full bg-primary",u6="pointer-events-none absolute -right-0.5 top-0.5 z-10 flex size-3.5 items-center justify-center rounded-full bg-transparent shadow-sm ",f6=`${u6} text-update-foreground`,N_="left",__=8,D_="max-w-64 text-balance font-normal leading-snug",O_=pe(function(t){let{t:n}=Ce(),{t:o}=Ce(),r=Wt().model.isProviderUpdateInFlight,a=p=>{t.onSelectInstance(p)},i=t.showFavorites??!0,[s,l]=J(null),d=N(null),[c,f]=J(null);return he(()=>{let p=d.current;if(!p)return;let m=Array.from(p.querySelectorAll("[data-model-picker-provider]")).find(g=>g.dataset.modelPickerProvider===t.selectedInstanceId);if(!m){f(null);return}f(m.offsetTop+m.offsetHeight/2-10)},[t.instanceEntries,t.selectedInstanceId,i]),u("div",{className:"w-11 shrink-0 overflow-hidden bg-muted/30","data-model-picker-sidebar":"true",children:u("div",{className:"h-full overflow-y-auto overscroll-contain [-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:b("div",{ref:d,className:"relative flex min-h-full flex-col gap-1 p-1",children:[c!==null?u("div",{"data-model-picker-selected-indicator":"true",className:$(c6,"right-0 translate-y-0 transition-[top] duration-200 ease-out"),style:{top:c}}):null,i?b(Le,{children:[u("div",{className:"relative w-full","data-model-picker-provider":"favorites",children:b(Ye,{children:[u(Ze,{render:u("button",{className:$("relative isolate flex w-full cursor-pointer aspect-square items-center justify-center rounded-md transition-colors hover:bg-[color-mix(in_srgb,var(--popover)_90%,var(--contrast-foreground))] focus-visible:bg-[color-mix(in_srgb,var(--popover)_90%,var(--contrast-foreground))]"),onClick:()=>a("favorites"),type:"button","aria-label":n("modelPicker.favorites"),children:u(ds,{className:"size-5 fill-current shrink-0","aria-hidden":!0})})}),u(Je,{side:N_,sideOffset:__,align:"center",className:D_,children:n("modelPicker.favorites")})]})}),u("div",{className:"border-b border-border/70","aria-hidden":"true"})]}):null,t.instanceEntries.map(p=>{let m=!xg(p),g=t.disabledInstanceIds?.has(p.instanceId)??!1,h=m||g,v=t.selectedInstanceId===p.instanceId,y=s===p.instanceId,x=r(p.snapshot),C=p.snapshot.versionAdvisory?.latestVersion!=null?o("updates.rail.updatingToVersion",{version:p.snapshot.versionAdvisory.latestVersion}):o("updates.rail.updating"),w=m?d6(p,o):g?t.getDisabledInstanceTooltip?.(p)??p.displayName:x?`${p.displayName} \u2014 ${C}`:p.displayName,L=b("button",{className:$("relative isolate flex w-full cursor-pointer aspect-square items-center justify-center rounded-md transition-colors hover:bg-[color-mix(in_srgb,var(--popover)_90%,var(--contrast-foreground))] focus-visible:bg-[color-mix(in_srgb,var(--popover)_90%,var(--contrast-foreground))]",h&&"opacity-50 cursor-not-allowed hover:bg-transparent"),"data-provider-accent-color":p.accentColor,onClick:()=>!h&&a(p.instanceId),onMouseEnter:()=>l(p.instanceId),onMouseLeave:()=>l(k=>k===p.instanceId?null:k),onFocus:()=>l(p.instanceId),onBlur:()=>l(k=>k===p.instanceId?null:k),disabled:h,type:"button","aria-label":h?w:p.displayName,children:[u(kr,{driver:p.driverKind,displayName:p.displayName,accentColor:p.accentColor,className:"size-6",iconClassName:"size-5",indicatorBackground:y&&!h?"var(--muted)":v?"var(--background)":"color-mix(in oklab, var(--muted) 30%, transparent)"}),x?u("span",{className:f6,"aria-hidden":!0,children:u(kf,{className:"size-2.5"})}):null]}),S=h?u("span",{className:"relative block w-full",children:L}):L;return u("div",{className:"relative w-full","data-model-picker-provider":p.instanceId,children:b(Ye,{children:[u(Ze,{render:S}),b(Je,{side:N_,sideOffset:__,align:"center",className:D_,children:[w,p.accountEmail?u("span",{className:"mt-0.5 block text-[10px] text-muted-foreground",children:p.accountEmail}):null]})]})},p.instanceId)})]})})})});function F_(e,t){let n=[],o=[];for(let r of e)t(r)?o.push(r):n.push(r);return{current:n,unavailable:o}}var p6=24;function m6(e){return[co(e.name),...e.shortName?[co(e.shortName)]:[],...e.subProvider?[co(e.subProvider)]:[],co(e.driverKind),co(e.providerDisplayName),...e.providerAccountEmail?[co(e.providerAccountEmail)]:[],ob(e),...e.slug?[co(e.slug)]:[]]}function g6(e,t,n){return $r({value:e,query:t,exactBase:n,prefixBase:n+2,boundaryBase:n+4,includesBase:n+6,...t.length>=3?{fuzzyBase:n+100}:{}})}function ob(e){return co([e.name,e.shortName,e.subProvider,e.driverKind,e.providerDisplayName,e.providerAccountEmail,e.slug].filter(t=>typeof t=="string"&&t.length>0).join(" "))}function B_(e,t){let n=co(t).split(/\s+/u).filter(r=>r.length>0);if(n.length===0)return 0;let o=0;for(let r of n){let a=[];for(let i=0;i<e.length;i+=1){let s=g6(e[i],r,i*10);s!==null&&a.push(s)}if(a.length===0)return null;o+=Math.min(...a)}return o}function z_(e,t){let n=B_(m6(e),t);return n===null?null:e.isFavorite?n-p6:n}function U_(e,t){return B_([co(e.title),co(e.description??"")],t)}function H_({top:e,bottom:t}){if(!(!e&&!t))return $("virtualized-scroll-fade [--fade-size:1.5rem]",e&&t&&"[--virtualized-scroll-fade-mask:linear-gradient(to_bottom,transparent,black_var(--fade-size),black_calc(100%-var(--fade-size)),transparent)]",e&&!t&&"[--virtualized-scroll-fade-mask:linear-gradient(to_bottom,transparent,black_var(--fade-size))]",!e&&t&&"[--virtualized-scroll-fade-mask:linear-gradient(to_bottom,black_calc(100%-var(--fade-size)),transparent)]")}function $_(e,t){return`${e}:${t}`}var K_=new Map,V_=[],h6=[],v6=[];function Wu(e){return Vu(e.instanceId,e.slug)}function q_(e,t,n){return t.environmentId===n&&t.instanceId===e.instanceId&&t.model===e.slug}function y6(){return u("div",{className:"h-0.5"})}function rb(e){return e?.trim()||null}function W_({label:e}){return u("div",{className:"px-2 pt-2 pb-1 text-[10px] font-medium uppercase leading-none tracking-wide text-muted-foreground/70",children:e})}var x6=pe(function({index:t,itemKey:n,action:o,showSectionHeader:r}){let{t:a}=Ce(),i=rb(o.description);return b(Le,{children:[r?u(W_,{label:a("modelPicker.plugins")}):null,b(wl,{hideIndicator:!0,index:t,value:n,className:"group w-full cursor-pointer rounded-md px-2 py-2",contentClassName:"flex w-full items-center gap-2",children:[u(is,{className:"size-4 shrink-0 text-muted-foreground/70"}),b("div",{className:"min-w-0 flex-1 text-left",children:[u("div",{className:"truncate text-xs font-medium leading-snug",children:o.title}),u("div",{className:"mt-1 truncate text-xs font-normal leading-snug text-muted-foreground/70",children:i})]})]})]})}),C6=pe(function({index:t,showSectionHeader:n}){let{t:o}=Ce();return b(Le,{children:[n?u(W_,{label:o("modelPicker.plugins")}):null,b(wl,{hideIndicator:!0,index:t,value:wd,className:"group w-full cursor-pointer rounded-md px-2 py-2",contentClassName:"flex w-full items-center gap-2",children:[u(Od,{className:"size-4 shrink-0 text-muted-foreground/70"}),u("span",{className:"min-w-0 flex-1 truncate text-left text-xs font-normal leading-snug text-muted-foreground",children:o("modelPicker.managePlugins")})]})]})}),G_=pe(function(t){let{keybindings:n,modelOptionsByInstance:o,instanceEntries:r,hideInstanceRail:a=!1,getModelDisabledReason:i,getModelContinuationLabel:s,onContinueInModel:l,onInstanceModelChange:d,onManagePlugins:c,onSelectPluginAction:f}=t,p=t.pluginActions??V_,m=t.selectedPluginActionKey??null,{t:g}=Ce(),{t:h}=Ce(),v=Wt(),[y,x]=J(""),[C,w]=J(!1),[L,S]=J(!1),k=N(null),I=N(null),T=N(null),A=v.environment.useActiveEnvironmentId(),P=v.settings.useClientSettings(O=>O.favorites??[]),_=K(()=>A===null?v6:P.filter(O=>O.environmentId===A),[A,P]),[E,F]=J(()=>t.lockedProvider!==null?t.activeInstanceId:_.length>0?"favorites":t.activeInstanceId),[B,V]=J(()=>new Set),Q=K(()=>n??[],[n]),Se=v.settings.useUpdateClientSettings(),H=R(()=>{k.current?.focus({preventScroll:!0})},[]),q=R(O=>{F(O),window.requestAnimationFrame(()=>{H()})},[H]);he(()=>{H();let O=window.requestAnimationFrame(()=>{H()}),fe=window.setTimeout(()=>{H()},0);return()=>{window.cancelAnimationFrame(O),window.clearTimeout(fe)}},[H]);let ee=K(()=>new Set(_.map(O=>$_(O.instanceId,O.model))),[_]),G=R(O=>A===null?!1:_.some(fe=>q_(O,fe,A)),[A,_]),te=K(()=>new Map(r.map(O=>[O.instanceId,O])),[r]),me=R(O=>t.lockedProvider===null?!0:O.driverKind!==t.lockedProvider?!1:t.lockedContinuationGroupKey?O.continuationGroupKey===t.lockedContinuationGroupKey:!0,[t.lockedContinuationGroupKey,t.lockedProvider]),U=K(()=>{let O=new Set;for(let fe of r)xg(fe)&&O.add(fe.instanceId);return O},[r]),Y=K(()=>{let O=[];for(let[fe,ye]of o){let Te=te.get(fe);if(Te&&U.has(fe))for(let Me of ye)O.push({slug:Me.slug,name:Me.name,...Me.shortName?{shortName:Me.shortName}:{},...Me.subProvider?{subProvider:Me.subProvider}:{},instanceId:fe,driverKind:Te.driverKind,instanceDisplayName:Te.displayName,...Te.accentColor?{instanceAccentColor:Te.accentColor}:{},...Te.accountEmail?{instanceAccountEmail:Te.accountEmail}:{},...Te.continuationGroupKey?{continuationGroupKey:Te.continuationGroupKey}:{}})}return O},[o,te,U]),se=t.lockedProvider!==null,ge=y.trim().length>0,ie=K(()=>{if(!se)return;let O=new Set;for(let fe of r)me(fe)||O.add(fe.instanceId);return O},[r,se,me]),Ae=K(()=>{let O=r.filter(Au);if(!se)return O;let fe=[],ye=[];for(let Te of O)me(Te)?fe.push(Te):ye.push(Te);return[...fe,...ye]},[r,se,me]),Xe=!a&&!ge&&Ae.length>0,nt=K(()=>r.map(O=>O.instanceId),[r]),rt=K(()=>{let O=Y;if(y.trim()){let fe=O.map(ye=>({model:ye,score:z_({name:ye.name,...ye.shortName?{shortName:ye.shortName}:{},...ye.subProvider?{subProvider:ye.subProvider}:{},driverKind:ye.driverKind,providerDisplayName:ye.instanceDisplayName,...ye.instanceAccountEmail?{providerAccountEmail:ye.instanceAccountEmail}:{},isFavorite:G(ye)},y),isFavorite:G(ye),tieBreaker:ob({name:ye.name,...ye.shortName?{shortName:ye.shortName}:{},...ye.subProvider?{subProvider:ye.subProvider}:{},driverKind:ye.driverKind,providerDisplayName:ye.instanceDisplayName,...ye.instanceAccountEmail?{providerAccountEmail:ye.instanceAccountEmail}:{}})})).filter(ye=>ye.score!==null);if(t.lockedProvider!==null){let ye=[];for(let Te of fe)me(Te.model)&&ye.push(Te);return ye.toSorted((Te,Me)=>{let ht=Te.score-Me.score;return ht!==0?ht:Te.isFavorite!==Me.isFavorite?Te.isFavorite?-1:1:Te.tieBreaker.localeCompare(Me.tieBreaker)}).map(Te=>Te.model)}return fe.toSorted((ye,Te)=>{let Me=ye.score-Te.score;return Me!==0?Me:ye.isFavorite!==Te.isFavorite?ye.isFavorite?-1:1:ye.tieBreaker.localeCompare(Te.tieBreaker)}).map(ye=>ye.model)}return t.lockedProvider!==null?(O=O.filter(fe=>me(fe)),E==="favorites"?O=O.filter(fe=>G(fe)):O=O.filter(fe=>fe.instanceId===E)):E==="favorites"?O=O.filter(fe=>G(fe)):O=O.filter(fe=>fe.instanceId===E),v.model.sortProviderModelItems(O,{favoriteModelKeys:ee,groupFavorites:E!=="favorites",instanceOrder:E==="favorites"?nt:[]})},[ee,Y,nt,me,t.lockedProvider,y,E,G]),Ve=R((O,fe)=>v.model.resolvePickerRowAction({disabledReason:i?.(O,fe)??null,continuationLabel:l?s?.(O,fe)??null:null}),[s,i,l]),ne=R(O=>Ve(O.instanceId,O.slug),[Ve]),we=K(()=>F_(rt,O=>ne(O).kind==="blocked"),[rt,ne]),j=K(()=>we.unavailable.length===0?null:{key:A_(E),models:we.unavailable,isExpanded:B.has(E)},[B,we,E]),X=K(()=>[...we.current,...j?.isExpanded?j.models:[]],[we,j]),ae=f!==void 0,oe=K(()=>{if(!ae)return V_;let O=y.trim();return O.length===0?p:p.map(fe=>({action:fe,score:U_(fe,O)})).filter(fe=>fe.score!==null).toSorted((fe,ye)=>fe.score-ye.score||fe.action.title.localeCompare(ye.action.title)).map(fe=>fe.action)},[y,p,ae]),ft=ae&&(!ge||oe.length>0),pt=K(()=>ft?[...oe.map(O=>qu(O.id)),wd]:h6,[ft,oe]),yt=K(()=>new Map(oe.map(O=>[qu(O.id),O])),[oe]),Lt=pt[0]??null,on=R(O=>{V(fe=>{let ye=new Set(fe);return ye.has(O)?ye.delete(O):ye.add(O),ye})},[]),gt=R((O,fe)=>{let ye=Ve(fe,O);if(ye.kind==="blocked")return;if(ye.kind==="continue"){l?.(fe,O);return}let Te=o.get(fe);if(!Te||!te.has(fe))return;let Me=v.model.resolveSelectableModel(O,Te);Me&&d(fe,Me)},[te,o,l,d,Ve]),zt=R(O=>{let fe=E_(O);if(fe){on(fe);return}if(O===wd){c?.();return}let ye=R_(O);if(ye!==null){f?.(ye);return}let Te=X.find(ht=>Wu(ht)===O);if(!Te||ne(Te).kind==="blocked")return;let Me=nb(O);Me&>(Me.slug,Me.instanceId)},[gt,c,f,on,X,ne]),Mt=R(O=>{if(A===null)return;let fe=P.findIndex(Te=>q_(O,Te,A)),ye=[...P];fe>=0?ye.splice(fe,1):ye.push({environmentId:A,instanceId:O.instanceId,model:O.slug}),Se({favorites:ye})},[A,P,Se]),wt=K(()=>{let O=new Map,fe=0;for(let ye of X){if(Ve(ye.instanceId,ye.slug).kind==="blocked")continue;let Te=v.keybindings.modelPickerJumpCommandForIndex(fe);if(!Te)return O;O.set(Wu(ye),Te),fe+=1}return O},[Ve,X]),In=K(()=>[...wt.keys()],[wt]),ct=K(()=>[...Y.map(O=>Wu(O)),...j?[j.key]:[],...ae?[...p.map(O=>qu(O.id)),wd]:[]],[Y,p,ae,j]),dn=K(()=>{let O=X.map(fe=>Wu(fe));return j&&O.splice(we.current.length,0,j.key),pt.length>0?[...O,...pt]:O},[j,we,pt,X]),ro=K(()=>new Map(X.map(O=>[Wu(O),O])),[X]),Vt=R(()=>{let O=I.current?.getScrollableNode();if(!(O instanceof HTMLElement))return;let fe=Math.max(0,O.scrollHeight-O.clientHeight);w(O.scrollTop>1),S(fe-O.scrollTop>1)},[]),bn=K(()=>({terminalFocus:!1,terminalOpen:t.terminalOpen,modelPickerOpen:!0}),[t.terminalOpen]),Tn=K(()=>{if(wt.size===0)return K_;let O={platform:navigator.platform,context:bn},fe=new Map;for(let[ye,Te]of wt){let Me=v.keybindings.shortcutLabelForCommand(Q,Te,O);Me&&fe.set(ye,Me)}return fe.size>0?fe:K_},[Q,wt,bn]),rn=m===null?Vu(t.activeInstanceId,t.model):qu(m),kn=K(()=>({favoritesSet:ee,modelJumpLabelByKey:Tn,selectedItemKey:rn}),[ee,Tn,rn]);return v.pane.useKeydown(O=>{if(O.defaultPrevented||O.repeat)return;let fe=v.keybindings.resolveShortcutCommand(O,Q,{platform:navigator.platform,context:bn}),ye=v.keybindings.modelPickerJumpIndexFromCommand(fe??"");if(ye===null)return;let Te=In[ye];if(!Te)return;let Me=nb(Te);Me&&(O.preventDefault(),O.stopPropagation(),gt(Me.slug,Me.instanceId))},{capture:!0}),he(()=>{w(!1),S(dn.length>5);let O=0,fe=window.requestAnimationFrame(()=>{Vt(),O=window.requestAnimationFrame(Vt)});return()=>{window.cancelAnimationFrame(fe),window.cancelAnimationFrame(O)}},[dn,Vt]),u(pS,{delay:0,children:b("div",{className:"relative flex h-screen max-h-86.5 w-screen max-w-90 flex-row overflow-hidden","data-model-picker-content":"true",children:[Xe&&u(O_,{selectedInstanceId:E,onSelectInstance:q,instanceEntries:Ae,showFavorites:!0,...ie?{disabledInstanceIds:ie,getDisabledInstanceTooltip:O=>h("instance.lockedToThread",{name:O.displayName})}:{}}),u(dS,{inline:!0,items:ct,filteredItems:dn,filter:null,autoHighlight:!0,open:!0,virtualized:!0,value:rn,onItemHighlighted:(O,fe)=>{T.current=typeof O=="string"?O:null,fe.reason==="keyboard"&&fe.index>=0&&I.current?.scrollIndexIntoView?.({index:fe.index,animated:!1})},onValueChange:O=>{typeof O=="string"&&zt(O)},children:b("div",{className:$("flex min-h-0 flex-1 flex-col overflow-hidden bg-muted/40",Xe&&"border-l border-border/70"),children:[u("div",{className:"px-2 pt-2",children:u("div",{className:"border-b border-border/70 pb-2.5 transition-colors focus-within:border-ring",children:u(uS,{ref:k,className:"[&_input]:h-control-3 [&_input]:font-sans [&_input]:leading-control-3",inputClassName:"rounded-none bg-transparent text-sm",placeholder:g("modelPicker.searchPlaceholder"),showTrigger:!1,startAddon:u(ls,{className:"-translate-x-0.5 size-4 shrink-0 text-muted-foreground opacity-70"}),value:y,onChange:O=>x(O.target.value),onKeyDown:O=>{if(O.key==="Escape"){O.preventDefault(),O.stopPropagation(),t.onRequestClose?.();return}if(O.key==="Enter"&&T.current){O.preventBaseUIHandler?.(),O.preventDefault(),O.stopPropagation(),zt(T.current);return}O.stopPropagation()},onMouseDown:O=>O.stopPropagation(),onTouchStart:O=>O.stopPropagation(),size:"sm",unstyled:!0})})}),u("div",{className:"relative min-h-0 flex-1 overflow-hidden pr-px",children:u(fS,{className:"size-full min-w-0 p-0 not-empty:p-0",children:u(P_,{ref:I,data:dn,extraData:kn,keyExtractor:O=>O,renderItem:({item:O,index:fe})=>{let ye=j?.key===O?{label:g("modelPicker.unavailableModels"),count:j.models.length,isExpanded:j.isExpanded}:null;if(ye)return b(wl,{hideIndicator:!0,index:fe,value:O,"aria-expanded":ye.isExpanded,className:"group w-full cursor-pointer rounded-md px-2 py-2",contentClassName:"flex w-full items-center gap-3",children:[b("div",{className:"min-w-0 flex-1 text-left",children:[u("div",{className:"text-xs font-medium leading-snug",children:ye.label}),u("div",{className:"mt-1 text-xs font-normal leading-snug text-muted-foreground/70",children:g("modelPicker.modelCount",{count:ye.count})})]}),u(Vo,{className:$("size-4 transition-transform",ye.isExpanded&&"rotate-90")})]});let Te=yt.get(O);if(Te)return u(x6,{index:fe,itemKey:O,action:Te,showSectionHeader:O===Lt});if(O===wd)return u(C6,{index:fe,showSectionHeader:O===Lt});let Me=ro.get(O);if(!Me)return null;let ht=ne(Me);return u(M_,{index:fe,model:Me,instanceId:Me.instanceId,driver:Me.driverKind,providerDisplayName:Me.instanceDisplayName,providerAccentColor:Me.instanceAccentColor,providerAccountEmail:Me.instanceAccountEmail,isFavorite:G(Me),isSelected:O===rn,showProvider:!0,preferShortName:!se,useTriggerLabel:!1,jumpLabel:Tn.get(O)??null,disabledReason:ht.kind==="blocked"?ht.reason:null,actionLabel:ht.kind==="continue"?ht.label:null,onToggleFavorite:()=>Mt(Me)},O)},estimatedItemSize:52,drawDistance:480,recycleItems:!0,contentContainerClassName:"pl-2 pr-px",ItemSeparatorComponent:y6,onLayout:Vt,onScroll:Vt,className:$("scrollbar-gutter-stable h-full overflow-x-hidden overscroll-y-contain py-1.5 [&::-webkit-scrollbar-track]:my-2",H_({top:C,bottom:L}))})})}),u(cS,{className:"not-empty:py-6 empty:h-0 text-xs font-normal leading-snug",children:g("modelPicker.noModelsFound")})]})})]})})});function $g(e){switch(e){case"probing":return{seatKey:"modelPicker.fetchingModels",blockKey:"composer.modelFetching",canChooseModel:!1};case"missing":return{seatKey:"modelPicker.chooseModel",blockKey:"composer.modelMissing",canChooseModel:!0};default:return null}}function j_(e){return e.submissionTarget==="provider-turn"&&e.status!=="known"}function b6(e){let t=e.unknownModelLabel?.trim();if(t)return t;let n=e.catalogOptions.find(o=>o.slug===e.model);return n?bd(n):e.model}var ab=pe(function(t){let{t:n}=Ce(),[o,r]=J(!1),i=ea()&&(t.open??o),s=K(()=>t.instanceEntries.find(C=>C.instanceId===t.activeInstanceId)??null,[t.activeInstanceId,t.instanceEntries]),l=t.activeInstanceId,d=t.modelOptionsByInstance.get(l)??[],c=$g(t.modelStatus??"known"),f=b6({model:t.model,catalogOptions:d,unknownModelLabel:c?n(c.seatKey):null}),p=C=>{t.onOpenChange?.(C),t.open===void 0&&r(C)};W(()=>{if(!i)return;let{documentElement:C,body:w}=document,L=C.style.overscrollBehavior,S=w.style.overflow,k=w.style.paddingRight,I=window.innerWidth-C.clientWidth;C.style.overscrollBehavior="contain",w.style.overflow="hidden",I>0&&(w.style.paddingRight=`${I}px`);let T=_=>_ instanceof Element&&_.closest("[data-model-picker-content]"),A=_=>{T(_.target)||_.preventDefault()},P=_=>{T(_.target)||_.preventDefault()};return document.addEventListener("wheel",A,{capture:!0,passive:!1}),document.addEventListener("touchmove",P,{capture:!0,passive:!1}),()=>{document.removeEventListener("wheel",A,{capture:!0}),document.removeEventListener("touchmove",P,{capture:!0}),C.style.overscrollBehavior=L,w.style.overflow=S,w.style.paddingRight=k}},[i]);let m=(C,w)=>{t.disabled||(t.onInstanceModelChange(C,w),p(!1))},g=(C,w)=>{t.disabled||(t.onContinueInModel?.(C,w),p(!1))},h=C=>{t.disabled||(t.onSelectPluginAction?.(C),p(!1))},v=()=>{t.onManagePlugins?.(),p(!1)},y=t.selectedPluginActionKey==null?null:t.pluginActions?.find(C=>C.id===t.selectedPluginActionKey)??null,x=y?rb(y.description):null;return b(xl,{open:i,onOpenChange:C=>{if(t.disabled){p(!1);return}p(C)},children:[b(bl,{render:u(Yo,{"aria-label":t.triggerAriaLabel,variant:t.triggerVariant??"ghost","data-chat-provider-model-picker":"true",className:$("min-w-0 justify-between whitespace-nowrap",t.compact?"max-w-42 shrink-0":"max-w-48 shrink sm:max-w-56",t.triggerClassName),disabled:t.disabled}),children:[u("span",{className:"flex min-w-0 flex-1 items-center gap-1.5",children:y?b(Le,{children:[u(is,{className:"size-4 shrink-0"}),b(Ye,{children:[b(Ze,{render:u("span",{className:"flex min-w-0 flex-1 items-center gap-1.5 truncate"}),children:[u("span",{className:"shrink-0",children:y.title}),x?b("span",{className:"min-w-0 truncate text-muted-foreground/80",children:["\xB7 ",x]}):null]}),u(Je,{side:"top",children:x?`${y.title} \xB7 ${x}`:y.title})]})]}):b(Le,{children:[t.showInstanceOnTrigger!==!1&&s?u(kr,{driver:s.driverKind,displayName:s.displayName,accentColor:s.accentColor,className:$("size-4",t.activeProviderIconClassName),iconClassName:"size-4",indicatorBackground:"var(--contrast-input)"}):null,b(Ye,{children:[u(Ze,{render:u("span",{className:"min-w-0 flex-1 overflow-hidden truncate"}),children:f}),u(Je,{side:"top",children:f})]})]})}),u("span",{"aria-hidden":"true",className:"flex items-center",children:u(ma,{})})]}),u(Cl,{align:"start",className:"before:hidden [--viewport-inline-padding:0]",viewportClassName:"!overflow-hidden rounded-[calc(var(--radius-lg)-1px)] p-0 [clip-path:inset(0_round_calc(var(--radius-lg)-1px))]",children:u(G_,{activeInstanceId:l,model:t.model,lockedProvider:t.lockedProvider,lockedContinuationGroupKey:t.lockedContinuationGroupKey??null,instanceEntries:t.instanceEntries,...t.hideInstanceRail?{hideInstanceRail:!0}:{},...t.keybindings?{keybindings:t.keybindings}:{},modelOptionsByInstance:t.modelOptionsByInstance,terminalOpen:t.terminalOpen??!1,onRequestClose:()=>p(!1),...t.getModelDisabledReason?{getModelDisabledReason:t.getModelDisabledReason}:{},...t.getModelContinuationLabel?{getModelContinuationLabel:t.getModelContinuationLabel}:{},...t.onContinueInModel?{onContinueInModel:g}:{},onInstanceModelChange:m,...t.pluginActions?{pluginActions:t.pluginActions}:{},selectedPluginActionKey:t.selectedPluginActionKey??null,...t.onSelectPluginAction?{onSelectPluginAction:h}:{},...t.onManagePlugins?{onManagePlugins:v}:{}})})]})});function Q_(e){let{slots:t,...n}=e,o=u(ab,{...n,hideInstanceRail:!0,showInstanceOnTrigger:!1}),r=t?.renderSlot("conversation.input.model",n,o);return u("span",{"data-conversation-slot":"conversation.input.model",children:r??o})}function X_(e){return u(ab,{...e,hideInstanceRail:!0,showInstanceOnTrigger:!1})}function ib(e){let{t}=Ce();if(!e.showInteractionModeToggle)return null;let n=e.interactionMode==="plan",o=t(n?"composer.planModeTooltip":"composer.defaultModeTooltip");return b(Ye,{children:[b(Ze,{render:u(Yo,{"data-composer-plan-toggle":"true",className:$("shrink-0 whitespace-nowrap",n?"bg-accent text-accent-foreground hover:bg-accent/90":"text-secondary-label hover:text-foreground"),type:"button",onClick:e.onToggleInteractionMode,"aria-label":o}),children:[n?u(Jo,{icon:ec,className:"text-current opacity-100"}):u(Jo,{icon:Xi,opticalSize:"large"}),u("span",{className:"sr-only sm:not-sr-only",children:t(n?"composer.interactionModePlan":"composer.interactionModeBuild")})]}),u(Je,{side:"top",children:o})]})}function Y_(e){return u(ib,{...e})}ue();var qr=["approval-required","auto-accept-edits","auto","full-access"];var w6={"approval-required":Yd,"auto-accept-edits":na,auto:di,"full-access":li},S6={"approval-required":"approvalRequired","auto-accept-edits":"autoAcceptEdits",auto:"auto","full-access":"fullAccess"};function Kg(){let{t:e}=Ce();return R(t=>{let n=S6[t];return{mode:t,label:e(`runtimeMode.${n}`),description:e(`runtimeMode.${n}Description`),icon:w6[t]}},[e])}ue();function J_(e){return e.description??e.name}var Z_=pe(function(t){let{t:n}=Ce(),{current:o,modes:r}=t.nativeMode,a=J_(o);return!t.canSwitch||r.length<2?b(Ye,{children:[b(Ze,{render:u(Yo,{className:"shrink-0 cursor-default whitespace-nowrap font-medium",type:"button",disabled:!0,"data-composer-native-mode":o.id,"aria-label":n("composer.agentModeLabel",{name:o.name})}),children:[u(Jo,{icon:hl}),u("span",{children:o.name})]}),b(Je,{side:"top",children:[u("span",{className:"block font-medium",children:a}),r.length>1?u("span",{className:"mt-1 block text-muted-foreground text-xs",children:n("composer.agentModesList",{modes:r.map(i=>i.name).join(", ")})}):null]})]}):b(Le,{children:[b(Ye,{children:[b(Lf,{value:o.id,onValueChange:i=>t.onNativeModeChange(i),children:[b(Ze,{render:u(Cg,{className:"shrink-0 whitespace-nowrap font-medium","data-composer-native-mode":o.id,"aria-label":n("composer.agentModeLabel",{name:o.name})}),children:[u(Jo,{icon:hl}),u(Ef,{children:o.name})]}),b(Af,{alignItemWithTrigger:!1,children:[r.map(i=>u(Pf,{value:i.id,hideIndicator:!0,className:"min-w-56 py-2",children:b("div",{className:"grid min-w-0 gap-0.5",children:[u("span",{className:"font-medium text-foreground",children:i.name}),i.description?u("span",{className:"text-muted-foreground text-xs leading-4",children:i.description}):null]})},i.id)),t.appliesNextTurn?u("div",{className:"border-t px-2 py-1.5 text-muted-foreground text-xs leading-4","data-composer-next-turn-note":"popup",children:n("runtimeMode.appliesNextTurnHint")}):null]})]}),u(Je,{side:"top",children:t.appliesNextTurn?`${a} ${n("runtimeMode.appliesNextTurnHint")}`:a})]}),t.appliesNextTurn?u("span",{className:"hidden whitespace-nowrap text-muted-foreground text-xs sm:inline","data-composer-next-turn-note":"inline",children:n("runtimeMode.appliesNextTurn")}):null]})});function sb(e){let{t}=Ce(),n=Kg();if(e.nativeMode)return u(Z_,{nativeMode:e.nativeMode,canSwitch:e.canSwitchNativeMode,appliesNextTurn:e.runtimeModeSwitch==="next-turn",onNativeModeChange:e.onNativeModeChange});let o=n(e.runtimeMode),r=o.icon,a=e.runtimeModeSwitch==="next-turn";return b(Le,{children:[b(Ye,{children:[b(Lf,{value:e.runtimeMode,onValueChange:i=>e.onRuntimeModeChange(i),children:[b(Ze,{render:u(Cg,{"data-composer-permission":"true","data-composer-runtime-mode-switch":e.runtimeModeSwitch,className:"font-medium","aria-label":t("composer.runtimeMode")}),children:[u(Jo,{icon:r}),u(Ef,{children:o.label})]}),b(Af,{alignItemWithTrigger:!1,children:[qr.map(i=>{let s=n(i),l=s.icon;return u(Pf,{value:i,hideIndicator:!0,className:"min-w-64 py-2",children:b("span",{className:"flex items-center gap-2",children:[u(l,{className:"size-4"}),s.label]})},i)}),a?u("div",{className:"border-t px-2 py-1.5 text-muted-foreground text-xs leading-4","data-composer-next-turn-note":"popup",children:t("runtimeMode.appliesNextTurnHint")}):null]})]}),u(Je,{side:"top",children:a?t("runtimeMode.appliesNextTurnHint"):o.label})]}),a?u("span",{className:"hidden whitespace-nowrap text-muted-foreground text-xs sm:inline","data-composer-next-turn-note":"inline",children:t("runtimeMode.appliesNextTurn")}):null]})}function eD(e){return u(sb,{...e})}function Gu(e){let t=e.slots?.renderSlot(e.name,e.owner??{},e.fallback);return u("span",{"data-conversation-slot":e.name,children:t??e.fallback})}ue();var tD=pe(function(t){let{t:n}=Ce(),o=Kg();return b(Eo,{children:[u(Mo,{render:u(ce,{size:"sm",variant:"ghost",className:"shrink-0 px-2 text-muted-foreground/70 hover:text-foreground/80","aria-label":n("composer.moreComposerControls")}),children:u(lr,{"aria-hidden":"true",className:"size-4"})}),b(Ro,{align:"start",children:[t.traitsMenuContent?b(Le,{children:[t.traitsMenuContent,u(ci,{})]}):null,t.showInteractionModeToggle&&t.nativeMode===null?b(Le,{children:[u("div",{className:"px-2 py-1.5 font-medium text-muted-foreground text-xs",children:n("composer.modeMenuTitle")}),b(Lr,{value:t.interactionMode,onValueChange:r=>{!r||r===t.interactionMode||t.onToggleInteractionMode()},children:[u(Wo,{value:"default",children:n("composer.interactionModeChat")}),u(Wo,{value:"plan",children:n("composer.interactionModePlan")})]}),u(ci,{})]}):null,t.nativeMode===null?b(Le,{children:[u("div",{className:"px-2 py-1.5 font-medium text-muted-foreground text-xs",children:n("composer.accessMenuTitle")}),u(Lr,{value:t.runtimeMode,onValueChange:r=>{!r||r===t.runtimeMode||t.onRuntimeModeChange(r)},children:qr.map(r=>u(Wo,{value:r,children:o(r).label},r))}),t.runtimeModeSwitch==="next-turn"?u("div",{className:"px-2 pb-1.5 text-muted-foreground text-xs leading-4",children:n("runtimeMode.appliesNextTurnHint")}):null]}):b(Le,{children:[u("div",{className:"px-2 py-1.5 font-medium text-muted-foreground text-xs",children:n("composer.accessMenuTitle")}),t.canSwitchNativeMode&&t.nativeMode.modes.length>1?b(Le,{children:[u(Lr,{value:t.nativeMode.current.id,onValueChange:r=>{t.onNativeModeChange(String(r))},children:t.nativeMode.modes.map(r=>u(Wo,{value:r.id,children:r.name},r.id))}),t.runtimeModeSwitch==="next-turn"?u("div",{className:"px-2 pb-1.5 text-muted-foreground text-xs leading-4",children:n("runtimeMode.appliesNextTurnHint")}):null]}):u("div",{className:"px-2 pb-1.5 text-foreground text-sm","data-composer-native-mode":t.nativeMode.current.id,children:t.nativeMode.current.name})]})]})]})});ue();var nD="application/x-ycodium-composer-mention";function lb(e){return e.includes(nD)}function oD(e){let t=n=>lb(n.dataTransfer.types)?(n.preventDefault(),n.stopPropagation(),n.nativeEvent.stopPropagation(),!0):!1;return{onDragEnter(n){t(n)&&e.setDragActive(!0)},onDragOver(n){t(n)&&(n.dataTransfer.dropEffect="move",e.setDragActive(!0))},onDrop(n){if(!t(n))return;e.setDragActive(!1);let o=n.dataTransfer.getData(nD);o.length!==0&&(e.insertMentionAtEnd(`${o} `)||e.onInsertRejected())}}}function rD({documentKey:e,insertMentionAtEnd:t,onInsertRejected:n}){let[o,r]=J(!1),a=oD({insertMentionAtEnd:t,setDragActive:r,onInsertRejected:n}),i=s=>{if(!lb(s.dataTransfer.types))return;s.stopPropagation();let l=s.relatedTarget;l instanceof Node&&s.currentTarget.contains(l)||r(!1)};return he(()=>{r(!1)},[e]),W(()=>{if(!o)return;let s=()=>{r(!1)};return window.addEventListener("dragend",s),()=>window.removeEventListener("dragend",s)},[o]),{isDragOverComposer:o,composerMentionDragHandlers:a,onComposerMentionDragLeaveCapture:i}}ue();function db(e,t,n){let o=e.trim().length-t;return o<=0?null:n("composer.promptTooLong",{count:o,excess:o.toLocaleString("en-US"),max:t.toLocaleString("en-US")})}function cb(e){return e.submissionTarget==="provider-turn"?db(e.providerInput??e.prompt,e.maxInputChars,e.t):null}function aD(e){let t=e.disabledReason??cb(e);return t?(e.event?.preventDefault(),{validationMessage:t,didDispatch:!1}):e.onSend(e.event)===!1?(e.event?.preventDefault(),{validationMessage:null,didDispatch:!1}):{validationMessage:null,didDispatch:!0}}function iD({promptRef:e,maxInputChars:t,noProviderAvailable:n,isSendDisabled:o,sendDisabledReason:r,isModelSendBlocked:a,onModelSendBlocked:i,activeThreadId:s,activePendingProgress:l,composerDocumentKey:d,pendingImageCompressionsRef:c,onSend:f,onProviderInputRejectedReset:p,wasProviderInputRejected:m,onStillCompressing:g,shouldBlurMobileComposerOnSubmit:h,blurMobileComposerAfterSend:v}){let{t:y}=Ce(),[x,C]=J(null);W(()=>C(null),[d]);let w=R(S=>{C(k=>k===null?k:db(S,t,y))},[t,y]),L=R((S,k="foreground")=>{if(n||o){S?.preventDefault();return}if(a){S?.preventDefault(),i();return}if(s&&(c.current.get(d)??0)>0){S?.preventDefault(),g();return}let I=aD({prompt:e.current,submissionTarget:l?"pending-user-input":"provider-turn",maxInputChars:t,t:y,disabledReason:r,event:S,onSend:T=>(p(),f(T,k),!m())});C(I.validationMessage),I.didDispatch&&h()&&v()},[l,s,v,d,a,o,t,n,i,p,f,g,c,e,r,h,y,m]);return{composerSubmissionError:x,setComposerSubmissionError:C,revalidatePromptLength:w,submitComposer:L}}ue();var I6=(e,t)=>t.isResponding?e("primaryActions.submitting"):t.compact?t.isLastQuestion?e("primaryActions.submit"):e("primaryActions.next"):t.isLastQuestion?t.questionIndex>0?e("primaryActions.submitAnswers"):e("primaryActions.submitAnswer"):e("primaryActions.nextQuestion"),T6=e=>{e.preventDefault()},ju=pe(function({compact:t,pendingAction:n,isRunning:o,showPlanFollowUpPrompt:r,promptHasText:a,isSendBusy:i,sendDisabledReason:s,isEnvironmentUnavailable:l,isPreparingWorktree:d,hasSendableContent:c,preserveComposerFocusOnPointerDown:f=!1,showSendWhileRunning:p=!1,onPreviousPendingQuestion:m,onInterrupt:g,interruptArmed:h=!1,onImplementPlanInNewThread:v,shellCommandMode:y=!1,shellCommandUnavailableReason:x=null}){let{t:C}=Ce(),w=Wt(),L=f?{onPointerDown:T6}:void 0,S=w.settings.useEnvironmentIdentificationMode(),k=s!==null,I=w.devBackdrop.useVisible(S==="artwork"),T=P=>u("button",{type:"button",className:$("flex cursor-pointer items-center justify-center rounded-full bg-destructive/90 text-white shadow-xs shadow-destructive/24 inset-shadow-[0_1px_--theme(--color-white/16%)] transition-[background-color,scale] duration-(--control-duration) hover:bg-destructive hover:scale-105 active:inset-shadow-[0_1px_--theme(--color-black/8%)] active:shadow-none",h?"h-8 px-3 text-xs font-medium whitespace-nowrap ring-2 ring-destructive/60":P?"size-8 sm:size-7":p&&c?"size-9 sm:size-8":"size-8 sm:h-8 sm:w-8"),...L,onClick:g,"data-interrupt-armed":h?"":void 0,"aria-label":C(h?"primaryActions.confirmStopEsc":"primaryActions.stopGeneration"),children:h?C("primaryActions.confirmStopEsc"):u("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"currentColor","aria-hidden":"true",children:u("rect",{x:"2",y:"2",width:"8",height:"8",rx:"1.5"})})});if(n)return b("div",{className:$("flex items-center justify-end",t?"gap-1.5":"gap-2"),children:[o?T(!0):null,n.questionIndex>0?t?u(ce,{size:"icon-sm",variant:"outline",className:"rounded-full",...L,onClick:m,disabled:n.isResponding,"aria-label":C("primaryActions.previousQuestion"),children:u(Yi,{})}):u(ce,{size:"sm",variant:"outline",className:"rounded-full",...L,onClick:m,disabled:n.isResponding,children:C("primaryActions.previous")}):null,u(ce,{type:"submit",size:"sm",className:$("rounded-full bg-message-action text-message-action-foreground hover:bg-message-action-hover",t?"px-3":"px-4"),...L,disabled:l||n.isResponding||(n.isLastQuestion?!n.isComplete:!n.canAdvance),children:I6(C,{compact:t,isLastQuestion:n.isLastQuestion,isResponding:n.isResponding,questionIndex:n.questionIndex})})]});if(y){let P=u("button",{type:"submit","data-shell-command-run":"true",className:"flex h-9 w-9 items-center justify-center rounded-full bg-message-action text-message-action-foreground shadow-xs shadow-message-action/24 transition-[background-color,opacity,scale] duration-(--control-duration) enabled:cursor-pointer enabled:inset-shadow-[0_1px_--theme(--color-white/16%)] hover:scale-105 hover:bg-message-action-hover active:inset-shadow-[0_1px_--theme(--color-black/8%)] active:shadow-none disabled:pointer-events-none disabled:opacity-64 disabled:shadow-none disabled:hover:scale-100 sm:h-8 sm:w-8",...L,disabled:x!==null||!c,"aria-label":x??C("primaryActions.runInTerminal"),children:u(qo,{"aria-hidden":"true",className:"size-4"})});return o?b(Le,{children:[T(!1),P]}):P}if(r)return a?u(ce,{type:"submit",size:"sm",className:$("rounded-full bg-message-action text-message-action-foreground hover:bg-message-action-hover",t?"h-9 px-3 sm:h-8":"h-9 px-4 sm:h-8"),...L,disabled:i||k||l,children:C(i?"primaryActions.sendingButtonLabel":"primaryActions.refine")}):b("div",{"data-chat-composer-implement-actions":"true",className:"flex items-center justify-end",children:[u(ce,{type:"submit",size:"sm",className:"h-9 rounded-l-full rounded-r-none bg-message-action px-4 text-message-action-foreground hover:bg-message-action-hover sm:h-8",...L,disabled:i||k||l,children:C(i?"primaryActions.sendingButtonLabel":"primaryActions.implement")}),b(Eo,{children:[u(Mo,{render:u(ce,{size:"sm",variant:"default",className:"h-9 rounded-l-none rounded-r-full border-l-message-action-foreground/20 bg-message-action px-2 text-message-action-foreground hover:bg-message-action-hover sm:h-8","aria-label":C("primaryActions.implementationActions"),...L,disabled:i||k||l}),children:u(sn,{})}),u(Ro,{align:"end",side:"top",children:u(dr,{disabled:i||k||l,onClick:()=>{v()},children:C("primaryActions.implementInNewThread")})})]})]});let A=b("button",{type:"submit",className:$("relative isolate flex h-9 w-9 items-center justify-center overflow-hidden rounded-full shadow-xs transition-[background-color,filter,opacity,scale] duration-(--control-duration) enabled:cursor-pointer enabled:inset-shadow-[0_1px_--theme(--color-white/16%)] hover:scale-105 active:inset-shadow-[0_1px_--theme(--color-black/8%)] active:shadow-none disabled:pointer-events-none disabled:opacity-64 disabled:shadow-none disabled:hover:scale-100 sm:h-8 sm:w-8",I?"bg-transparent text-white enabled:shadow-black/24 enabled:hover:brightness-110":"bg-message-action text-message-action-foreground enabled:shadow-message-action/24 hover:bg-message-action-hover"),...L,disabled:i||k||l||!c,"aria-label":l?C("primaryActions.environmentDisconnected"):s||C(d?"primaryActions.preparingWorktree":i?"primaryActions.sendingAriaLabel":"primaryActions.sendMessage"),children:[I?u("span",{className:"absolute inset-0 -z-10","aria-hidden":"true",children:u(gS,{compact:!0})}):null,i?u(kf,{className:"size-3.5","aria-hidden":"true"}):u("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:u("path",{d:"M7 11.5V2.5M7 2.5L3 6.5M7 2.5L11 6.5",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})})]});return o?b(Le,{children:[T(!1),p&&c?A:null]}):A});function sD(e){let{t}=Ce(),n=e.activePendingProgress?.activeQuestion?.multiSelect??!1;return u("div",{className:"px-3 pb-3 sm:px-4",children:b("div",{"data-chat-composer-mobile-pending-compact":"true",className:$("flex min-w-0 items-center gap-2 rounded-lg border border-border/55 bg-background/55 p-1.5 pl-3 transition-colors hover:bg-background/90",!n&&"p-0"),children:[e.isPendingUserInputChoiceOnly?null:u("button",{type:"button",className:$("min-w-0 flex-1 truncate bg-transparent py-1.5 text-left text-sm",e.activePendingProgress?.customAnswer?"text-foreground":"text-placeholder",!n&&"px-3 py-2"),onPointerDown:o=>o.preventDefault(),onClick:e.expandMobileComposer,"aria-label":t("composer.writeCustomAnswer"),children:e.activePendingProgress?.customAnswer||t("composer.writeCustomAnswer")}),e.inlineTasksBadge,e.inlineStashBadge,n?u(ju,{compact:!0,pendingAction:e.pendingPrimaryAction,isRunning:!1,showPlanFollowUpPrompt:!1,promptHasText:!1,isSendBusy:e.isSendBusy,sendDisabledReason:e.sendDisabledReason,isEnvironmentUnavailable:e.isEnvironmentUnavailable,isPreparingWorktree:!1,hasSendableContent:!1,preserveComposerFocusOnPointerDown:!0,onPreviousPendingQuestion:e.onPreviousActivePendingUserInputQuestion,onInterrupt:e.handleInterruptPrimaryAction,onImplementPlanInNewThread:e.handleImplementPlanInNewThreadPrimaryAction}):null]})})}function lD(e){let t=e.match(/^\s{0,3}#{1,6}\s+(.+)$/m)?.[1]?.trim();return t&&t.length>0?t:null}ue();var k6=2e3,L6="min-h-8 max-w-full py-1.5 font-normal whitespace-normal text-start",P6=e=>[{decision:"cancel",label:e("composer.cancel")},{decision:"decline",label:e("composer.decline")},{decision:"acceptForSession",label:e("composer.alwaysAllowSession")},{decision:"accept",label:e("composer.approve")}];function A6(e,t){let n=[];return t<9&&n.push(String(t+1)),e==="accept"&&n.push("Enter"),e==="cancel"&&n.push("Escape"),n.length>0?n.join(" "):void 0}var dD=pe(function({requestId:t,isResponding:n,options:o,keybindings:r,declineReasonRelay:a,onRespondToApproval:i}){let{t:s}=Ce(),l=o??P6(s),d=Wt(),c=a==="native"||a==="queued",[f,p]=J(""),m=N([]);W(()=>{p("")},[t]);let g=R(v=>{let y=v==="decline"?f.trim():"";i(t,v,y.length>0?y:void 0)},[f,i,t]),h=R(v=>{let y=m.current.filter(w=>w!==null);if(y.length===0)return;let x=y.findIndex(w=>w===document.activeElement),C=x===-1?v===1?0:y.length-1:(x+v+y.length)%y.length;y[C]?.focus()},[]);return d.pane.useKeydown(v=>{if(n||d.terminalFocus.getOwner()!==null||v.isComposing||v.keyCode===229)return;let y=fi(v.target);if(r&&(!y||v.metaKey||v.ctrlKey||v.altKey)){let w=d.keybindings.approvalDecisionFromCommand(d.keybindings.resolveShortcutCommand(v,r));if(w!==null&&l.some(L=>L.decision===w)){v.preventDefault(),g(w);return}}if(y)return;let x=SS(v,l);if(x===null)return;if(v.preventDefault(),x.type==="move"){h(x.delta);return}let C=l[x.index];C&&g(C.decision)},{target:"document"}),u(Le,{children:l.map((v,y)=>{let x=y<9?y+1:null,C=b(ce,{ref:w=>{m.current[y]=w},size:"xs",variant:v.decision==="accept"?"default":"outline",style:{height:"auto"},"aria-keyshortcuts":A6(v.decision,y),className:`${L6}${v.decision==="decline"?" text-destructive-foreground [:hover,[data-pressed]]:text-destructive-foreground":""}`,disabled:n,onClick:()=>g(v.decision),children:[u("span",{className:"min-w-0 break-words",children:v.label}),x===null?null:u(zf,{className:"h-3.5 min-w-3.5 rounded-[3px] bg-transparent px-0 text-[10px] tabular-nums opacity-70",children:x})]},v.decision);return v.decision!=="decline"||!c?C:b(oi,{children:[u(Tf,{type:"text",value:f,disabled:n,maxLength:k6,placeholder:s(a==="queued"?"approval.declineReasonQueuedPlaceholder":"approval.declineReasonPlaceholder"),"aria-label":s("approval.declineReasonLabel"),"data-approval-decline-reason":"true",className:"h-8 min-w-24 max-w-56 flex-1",onChange:w=>p(w.target.value),onKeyDown:w=>{if(w.key==="Enter"){w.preventDefault(),g("decline");return}w.key==="Escape"&&(w.preventDefault(),f.length>0?p(""):w.currentTarget.blur())}}),C]},v.decision)})})});ue();var E6=["command","cmd"],R6=["file_path","filePath","path","notebook_path","notebookPath"],M6=["url"],N6=["query","q"],_6=["name","skill","skill_name","skillName"],cD=["toolName","tool_name"],uD=["description"],D6=[],O6=[];function Qa(e,t,n){for(let o of t){let a=e.find(i=>i.name===o)?.value.trim();if(!(a===void 0||a.length===0))return n.add(o),a}return null}function F6(e){let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\")),n=t>=0?e.slice(t+1):e;return n.length>0?n:e}function B6(e){let t=e[0];return t===void 0?null:e.every(n=>n.path===t.path)?t.path:null}function pD(e){let t=e.args??D6,n=e.fileChanges??O6,o=new Set,r=e.detail?.trim()??"",a=r.length>0?{shape:"text",text:r}:{shape:"none"},i=null,s=a,l=null;switch(e.requestKind){case"command":{let d=Qa(t,E6,o);d!==null&&(s={shape:"command",command:d});break}case"file-read":case"file-change":{let d=Qa(t,R6,o)??B6(n);d!==null&&(i=F6(d),s=n.some(c=>c.path===d)?{shape:"none"}:{shape:"path",path:d});break}case"web-fetch":{let d=Qa(t,M6,o);d!==null&&(s={shape:"url",url:d});break}case"web-search":{let d=Qa(t,N6,o);d!==null&&(s={shape:"query",query:d});break}case"skill":{i=Qa(t,_6,o)??Qa(t,cD,o),l=Qa(t,uD,o),t.length>0&&(s={shape:"none"});break}case"mcp-tool":case"tool":{i=Qa(t,cD,o),l=Qa(t,uD,o),t.length>0&&(s={shape:"none"});break}case"mcp-elicitation":{i=e.appName?.trim()||null;break}}return{kind:e.requestKind,subject:i,body:s,description:l,args:t.filter(d=>!o.has(d.name)),fileChanges:n}}var z6={"file-read":"approval.title.fileRead","file-change":"approval.title.fileChange",skill:"approval.title.skill","mcp-tool":"approval.title.tool",tool:"approval.title.tool","mcp-elicitation":"approval.title.appAccess"},U6={command:"approval.title.command","file-read":"approval.title.fileReadGeneric","file-change":"approval.title.fileChangeGeneric","web-fetch":"approval.title.webFetch","web-search":"approval.title.webSearch",skill:"approval.title.skillGeneric","mcp-tool":"approval.title.toolGeneric",tool:"approval.title.toolGeneric","mcp-elicitation":"approval.title.appAccessGeneric"},H6={command:"approval.commandLabel","file-read":"approval.fileReadLabel","file-change":"approval.fileChangeLabel","web-fetch":"approval.webFetchLabel","web-search":"approval.webSearchLabel",skill:"approval.skillLabel","mcp-tool":"approval.mcpToolLabel",tool:"approval.toolLabel","mcp-elicitation":"approval.appAccessLabel"},$6={command:"approval.commandDetailLabel",path:"approval.body.pathLabel",url:"approval.body.urlLabel",query:"approval.body.queryLabel",text:"approval.body.detailLabel"};function mD(e,t){let n=e.subject!==null?z6[e.kind]:void 0;return n!==void 0?t(n,{name:e.subject}):t(U6[e.kind])}function gD(e,t){return t(H6[e])}function hD(e,t){return t($6[e])}function vD(e){let t=e.content;if(t===void 0)return null;if(t.kind==="unified")return t.diff.length>0?t.diff:null;let n=fD(t.oldText??""),o=fD(t.newText);if(n.length===0&&o.length===0)return null;let r=`--- a/${e.path}
|
|
3788
|
+
`);for(let p=0;p<f.length;p+=1){let m=f[p]??"";m.length>0&&i.push(Fr(m)),p<f.length-1&&i.push(_s())}},l=r[0];if(l&&l.start===0){let c=a.isBackward()?a.focus:a.anchor,f=t.getExpandedAbsoluteOffsetForPoint(c.getNode(),c.offset),p=At().getTextContent().slice(f-1,f);p.length>0&&!/\s/.test(p)&&i.push(Fr(" "))}let d=0;for(let c of r)c.start<d||(c.start>d&&s(o.slice(d,c.start)),i.push(t.createMentionNode(c.value,c.source)),d=c.end);return d<o.length?s(o.slice(d)):i.push(Fr(" ")),a.insertNodes(i),n.preventDefault(),!0},hr)}var gq=`composer-editor-${Math.random().toString(36).slice(2)}`,hq=[["(",")"],["[","]"],["{","}"],["'","'"],['"','"'],["\u201C","\u201D"],["`","`"],["<",">"],["\xAB","\xBB"],["*","*"],["_","_"]],bM=new Map(hq),vM=bM.get("`")??null,wM=bt({onRemoveTerminalContext:()=>{}});function vq(e){let t=bq(),n=u("span",{className:fM,contentEditable:!1,spellCheck:!1,"data-composer-mention-chip":"true",children:u(pM,{path:e.path,label:oC(e.path),theme:t})});return b(Ye,{children:[u(Ze,{render:n}),u(Je,{side:"top",className:"max-w-120 whitespace-normal leading-tight wrap-anywhere",children:e.path})]})}var Su=class e extends za{__path;__source;static getType(){return"composer-mention"}static clone(t){return new e(t.__path,t.__source,t.__key)}static importJSON(t){return sC(t.path,t.source).updateFromJSON(t)}constructor(t,n=bu(t),o){super(o),this.__path=t,this.__source=n}exportJSON(){return{...super.exportJSON(),path:this.__path,source:this.__source,type:"composer-mention",version:1}}createDOM(){let t=document.createElement("span");return t.className=Pp,t}updateDOM(){return!1}getTextContent(){return this.__source}isInline(){return!0}decorate(){return u(vq,{path:this.__path})}};function sC(e,t){return vm(new Su(e,t))}function yq(e){let t=e.shortDescription?.trim();return t||e.description?.trim()||null}function Iu(e){return new Map(e.map(t=>[t.name,{label:sa(t),description:yq(t)}]))}function xq(e){let t=b("span",{className:sk,contentEditable:!1,spellCheck:!1,"data-composer-skill-chip":"true",children:[u("span",{"aria-hidden":"true",className:aa,dangerouslySetInnerHTML:{__html:lk}}),u("span",{className:ia,children:e.skillLabel})]});return e.skillDescription?b(Ye,{children:[u(Ze,{render:t}),u(Je,{side:"top",className:"max-w-120 whitespace-normal leading-tight",children:e.skillDescription})]}):t}var Tu=class e extends za{__skillName;__skillLabel;__skillDescription;static getType(){return"composer-skill"}static clone(t){return new e(t.__skillName,t.__skillLabel,t.__skillDescription,t.__key)}static importJSON(t){return SM(t.skillName,t.skillLabel??t.skillName,t.skillDescription??null).updateFromJSON(t)}constructor(t,n,o,r){super(r);let a=t.startsWith("$")?t.slice(1):t;this.__skillName=a,this.__skillLabel=n,this.__skillDescription=o}exportJSON(){return{...super.exportJSON(),skillName:this.__skillName,skillLabel:this.__skillLabel,...this.__skillDescription?{skillDescription:this.__skillDescription}:{},type:"composer-skill",version:1}}createDOM(){let t=document.createElement("span");return t.className=Pp,t}updateDOM(){return!1}getTextContent(){return`$${this.__skillName}`}isInline(){return!0}decorate(){return u(xq,{skillLabel:this.__skillLabel,skillDescription:this.__skillDescription})}};function SM(e,t,n){return vm(new Tu(e,t,n))}function Cq(e){return u(gM,{context:e.context})}var $s=class e extends za{__context;static getType(){return"composer-terminal-context"}static clone(t){return new e(t.__context,t.__key)}static importJSON(t){return IM(t.context)}constructor(t,n){super(n),this.__context=t}exportJSON(){return{...super.exportJSON(),context:this.__context,type:"composer-terminal-context",version:1}}createDOM(){let t=document.createElement("span");return t.className=Pp,t}updateDOM(){return!1}getTextContent(){return"\uFFFC"}isInline(){return!0}decorate(){return u(Cq,{context:this.__context})}};function IM(e){return vm(new $s(e))}function Oi(e){return e instanceof Su||e instanceof Tu||e instanceof $s}function bq(){return document.documentElement.classList.contains("dark")?"dark":"light"}function wq(e){return e.map(t=>[t.id,t.threadId,t.terminalId,t.terminalLabel,t.lineStart,t.lineEnd,t.createdAt,t.text].join("")).join("")}function Sq(e){return e.map(t=>[t.name,t.displayName??"",t.shortDescription??"",t.description??"",t.path,t.scope??"",t.enabled?"1":"0"].join("")).join("")}function dg(e,t){return Number.isFinite(t)?Math.max(0,Math.min(e.length,Math.floor(t))):e.length}function ug(e){return 1}function TM(e){return e.getTextContentSize()}function Iq(e,t,n){return t+(n>0?ug(e):0)}function Tq(e,t,n){return t+(n>0?TM(e):0)}function kq(e,t){let n=e.getParent();if(!n||!je(n))return null;let o=e.getIndexWithinParent();return t.value===0?{key:n.getKey(),offset:o,type:"element"}:t.value===ug(e)?{key:n.getKey(),offset:o+1,type:"element"}:(t.value-=ug(e),null)}function fg(e){return Oi(e)?ug(e):dt(e)?e.getTextContentSize():ad(e)?1:je(e)?e.getChildren().reduce((t,n)=>t+fg(n),0):0}function aC(e){return Oi(e)?TM(e):dt(e)?e.getTextContentSize():ad(e)?1:je(e)?e.getChildren().reduce((t,n)=>t+aC(n),0):0}function ku(e,t){let n=0,o=e;for(;o;){let r=o.getParent();if(!r||!je(r))break;let a=r.getChildren(),i=o.getIndexWithinParent();for(let s=0;s<i;s+=1){let l=a[s];l&&(n+=fg(l))}o=r}if(dt(e))return n+Math.min(t,e.getTextContentSize());if(Oi(e))return Iq(e,n,t);if(ad(e))return n+Math.min(t,1);if(je(e)){let r=e.getChildren(),a=Math.max(0,Math.min(t,r.length));for(let i=0;i<a;i+=1){let s=r[i];s&&(n+=fg(s))}return n}return n}function pg(e,t){let n=0,o=e;for(;o;){let r=o.getParent();if(!r||!je(r))break;let a=r.getChildren(),i=o.getIndexWithinParent();for(let s=0;s<i;s+=1){let l=a[s];l&&(n+=aC(l))}o=r}if(dt(e))return n+Math.min(t,e.getTextContentSize());if(Oi(e))return Tq(e,n,t);if(ad(e))return n+Math.min(t,1);if(je(e)){let r=e.getChildren(),a=Math.max(0,Math.min(t,r.length));for(let i=0;i<a;i+=1){let s=r[i];s&&(n+=aC(s))}return n}return n}function mg(e,t){if(Oi(e))return kq(e,t);if(dt(e)){let n=e.getTextContentSize();return t.value<=n?{key:e.getKey(),offset:t.value,type:"text"}:(t.value-=n,null)}if(ad(e)){let n=e.getParent();if(!n)return null;let o=e.getIndexWithinParent();return t.value===0?{key:n.getKey(),offset:o,type:"element"}:t.value===1?{key:n.getKey(),offset:o+1,type:"element"}:(t.value-=1,null)}if(je(e)){let n=e.getChildren();for(let o of n){let r=mg(o,t);if(r)return r}if(t.value===0)return{key:e.getKey(),offset:n.length,type:"element"}}return null}function gg(){return At().getChildren().reduce((n,o)=>n+fg(o),0)}function Ks(e){let t=At(),n=gg(),r={value:Math.max(0,Math.min(e,n))},a=mg(t,r)??{key:t.getKey(),offset:t.getChildren().length,type:"element"},i=Ds();i.anchor.set(a.key,a.offset,a.type),i.focus.set(a.key,a.offset,a.type),Br(i)}function cg(e,t){let n=At(),o=gg(),r=Math.max(0,Math.min(e,o)),a=Math.max(0,Math.min(t,o)),i={value:r},s={value:a},l=mg(n,i)??{key:n.getKey(),offset:n.getChildren().length,type:"element"},d=mg(n,s)??{key:n.getKey(),offset:n.getChildren().length,type:"element"},c=Ds();c.anchor.set(l.key,l.offset,l.type),c.focus.set(d.key,d.offset,d.type),Br(c)}function yM(e){if(!Ne(e))return null;let t=e.anchor.getNode(),n=e.focus.getNode(),o=pg(t,e.anchor.offset),r=pg(n,e.focus.offset);return{start:Math.min(o,r),end:Math.max(o,r)}}function xM(e){return Ne(e)?e.getNodes().some(t=>Oi(t)):!1}function Lu(e){let t=Ke();if(!Ne(t)||!t.isCollapsed())return e;let n=t.anchor.getNode(),o=ku(n,t.anchor.offset),r=gg();return Math.max(0,Math.min(o,r))}function CM(e){let t=Ke();if(!Ne(t)||!t.isCollapsed())return e;let n=t.anchor.getNode(),o=pg(n,t.anchor.offset),r=At().getTextContent().length;return Math.max(0,Math.min(o,r))}function rC(e){let t=Ke();return Ne(t)?{anchor:ku(t.anchor.getNode(),t.anchor.offset),focus:ku(t.focus.getNode(),t.focus.offset)}:e}function Lq(e,t){let n=t.split(`
|
|
3789
|
+
`);for(let o=0;o<n.length;o+=1){let r=n[o]??"";r.length>0&&e.append(Fr(r)),o<n.length-1&&e.append(_s())}}function lC(e,t,n){let o=At();o.clear();let r=gr();o.append(r);let a=ws(e,t);for(let i of a){if(i.type==="mention"){r.append(sC(i.path,i.source));continue}if(i.type==="skill"){let s=n.get(i.name);r.append(SM(i.name,s?.label??sa({name:i.name}),s?.description??null));continue}if(i.type==="terminal-context"){i.context&&r.append(IM(i.context));continue}Lq(r,i.text)}}function iC(e){return e instanceof $s?[e.__context.id]:je(e)?e.getChildren().flatMap(t=>iC(t)):[]}function Pq(e){let[t]=Cn();return W(()=>{let n=(l,d)=>{if(!e.onCommandKeyDown||!d)return!1;if(l==="Enter"&&(d.isComposing||d.keyCode===229))return d.stopPropagation(),!0;let c=e.onCommandKeyDown(l,d);return c&&(d.preventDefault(),d.stopPropagation()),c},o=t.registerCommand(OA,l=>n("ArrowDown",l),hr),r=t.registerCommand(FA,l=>n("ArrowUp",l),hr),a=t.registerCommand(_m,l=>n("Enter",l),hr),i=t.registerCommand(Dm,l=>n("Tab",l),hr),s=t.registerCommand(UA,l=>n("Escape",l),hr);return()=>{o(),r(),a(),i(),s()}},[t,e]),null}function Aq(){let[e]=Cn();return W(()=>{let t=e.registerCommand(Rm,o=>{let r=null;if(e.getEditorState().read(()=>{let i=Ke();if(!Ne(i)||!i.isCollapsed())return;let s=Lu(0);if(s<=0)return;let l=At().getTextContent();_c(l,s,"left")&&(r=s-1)}),r===null)return!1;let a=r;return o?.preventDefault(),o?.stopPropagation(),e.update(()=>{Ks(a)}),!0},hr),n=e.registerCommand(Mm,o=>{let r=null;if(e.getEditorState().read(()=>{let i=Ke();if(!Ne(i)||!i.isCollapsed())return;let s=Lu(0),l=gg();if(s>=l)return;let d=At().getTextContent();_c(d,s,"right")&&(r=s+1)}),r===null)return!1;let a=r;return o?.preventDefault(),o?.stopPropagation(),e.update(()=>{Ks(a)}),!0},hr);return()=>{t(),n()}},[e]),null}function Eq(){let[e]=Cn();return W(()=>e.registerCommand(zA,t=>{if(!cM(navigator.platform)||t.key!=="Home"&&t.key!=="End"||t.altKey||t.metaKey||t.ctrlKey||t.isComposing)return!1;let n=e.getRootElement(),o=window.getSelection(),r=o?.anchorNode;return!n||!o||!r||!n.contains(r)||o.rangeCount===0||typeof o.modify!="function"?!1:(t.preventDefault(),t.stopPropagation(),o.modify(t.shiftKey?"extend":"move",t.key==="Home"?"backward":"forward","lineboundary"),e.update(()=>{Br(eA(o,e))}),!0)},hr),[e]),null}function Rq(){let[e]=Cn();return W(()=>e.registerUpdateListener(({editorState:t})=>{let n=null;t.read(()=>{let o=Ke();if(!Ne(o)||!o.isCollapsed())return;let r=o.anchor.getNode();if(!Oi(r)||o.anchor.offset===0)return;n=ku(r,0)+1}),n!==null&&queueMicrotask(()=>{e.update(()=>{Ks(n)})})}),[e]),null}function Mq(){let[e]=Cn(),{onRemoveTerminalContext:t}=wt(wM);return W(()=>e.registerCommand(Nm,n=>{let o=Ke();if(!Ne(o)||!o.isCollapsed())return!1;let r=o.anchor.getNode(),a=Lu(0),i=s=>{if(!Oi(s))return!1;let l=ku(s,0);return s.remove(),s instanceof $s?(t(s.__context.id),Ks(a)):Ks(l),n?.preventDefault(),!0};if(i(r))return!0;if(dt(r)){if(o.anchor.offset>0)return!1;if(i(r.getPreviousSibling()))return!0;let s=r.getParent();if(je(s)){let l=r.getIndexWithinParent();if(l>0&&i(s.getChildAtIndex(l-1)))return!0}return!1}if(je(r)){let s=o.anchor.offset-1;if(s>=0&&i(r.getChildAtIndex(s)))return!0}return!1},hr),[e,t]),null}function Nq(){let[e]=Cn();return W(()=>{let t=new Set,n=e.getRootElement()===document.activeElement,o=l=>{for(let d of t)l.has(d)||e.getElementByKey(d)?.removeAttribute("data-composer-chip-selected");for(let d of l)e.getElementByKey(d)?.setAttribute("data-composer-chip-selected","true");t=l},r=()=>{let l=new Set;return e.getEditorState().read(()=>{let d=Ke();if(Ne(d)&&!d.isCollapsed())for(let c of d.getNodes())c instanceof za&&l.add(c.getKey())}),l},a=e.registerUpdateListener(()=>{o(n?r():new Set)}),i=e.registerCommand(RA,()=>(n=!0,o(r()),!1),id),s=e.registerCommand(CA,()=>(n=!1,o(new Set),!1),id);return()=>{a(),i(),s()}},[e]),null}function _q(){let[e]=Cn();return W(()=>hM(e,{createMentionNode:sC,getExpandedAbsoluteOffsetForPoint:pg}),[e]),null}function Dq(e){let[t]=Cn(),n=N(e.terminalContexts),o=N(Iu(e.skills)),r=N(null),a=N(null);W(()=>{n.current=e.terminalContexts},[e.terminalContexts]),W(()=>{o.current=Iu(e.skills)},[e.skills]);let i=gh(s=>{let l=bM.get(s),d=r.current;if(!l)return r.current=null,!1;let c=!1;return t.update(()=>{let f=d??(()=>{let h=Ke();if(!Ne(h)||h.isCollapsed()||xM(h))return null;let v=yM(h);if(!v||v.start===v.end)return null;let y=At().getTextContent();return vv(y,v.start,v.end)?null:{value:y,expandedStart:v.start,expandedEnd:v.end}})();if(!f||!l)return;let p=f.value.slice(f.expandedStart,f.expandedEnd),m=`${f.value.slice(0,f.expandedStart)}${s}${p}${l}${f.value.slice(f.expandedEnd)}`;lC(m,n.current,o.current);let g=bo(m,f.expandedStart);cg(g+s.length,g+s.length+p.length),c=!0,r.current=null}),c});return W(()=>{let s=g=>{if(a.current){if(g.key==="Dead"||g.key===" "||g.code==="Space")return;a.current=null}if(g.defaultPrevented||g.isComposing||g.metaKey||g.ctrlKey){r.current=null,a.current=null;return}t.getEditorState().read(()=>{let h=Ke();if(!Ne(h)||h.isCollapsed()){r.current=null,a.current=null;return}if(xM(h)){r.current=null,a.current=null;return}let v=yM(h);if(!v||v.start===v.end){r.current=null,a.current=null;return}let y=At().getTextContent();if(vv(y,v.start,v.end)){r.current=null,a.current=null;return}let x={value:y,expandedStart:v.start,expandedEnd:v.end};r.current=x,a.current=null})},l=g=>{if(g.inputType==="insertCompositionText"&&g.data==="`"&&vM!==null&&r.current){a.current=r.current;return}if(a.current||g.inputType==="insertCompositionText")return;if(typeof g.data!="string"){r.current=null;return}let h=g.inputType==="insertText"?g.data:null;if(!h||h.length!==1){r.current=null;return}i(h)&&(g.preventDefault(),g.stopPropagation(),g.stopImmediatePropagation())},d=g=>{queueMicrotask(()=>{t.update(()=>{let h=a.current;if(!h)return;let v=At().getTextContent(),y=vM;if(y===null){a.current=null;return}let x=`${h.value.slice(0,h.expandedStart)}\`${h.value.slice(h.expandedEnd)}`;if(v!==x){g?.finalAttempt&&(r.current=null,a.current=null);return}let C=h.value.slice(h.expandedStart,h.expandedEnd),w=bo(v,h.expandedStart);cg(w,w+1);let L=Ke();if(!Ne(L)){r.current=null,a.current=null;return}L.insertText(`\`${C}${y}`),cg(w+1,w+1+C.length),r.current=null,a.current=null},{tag:vr})})},c=g=>{let h=g;(h.inputType==="insertText"||h.inputType==="insertCompositionText")&&d()},f=()=>{d({finalAttempt:!0})},p=null,m=t.registerRootListener((g,h)=>{h?.removeEventListener("keydown",s),h?.removeEventListener("beforeinput",l,!0),h?.removeEventListener("input",c),h?.removeEventListener("compositionend",f),g?.addEventListener("keydown",s),g?.addEventListener("beforeinput",l,!0),g?.addEventListener("input",c),g?.addEventListener("compositionend",f),p=g});return()=>{p&&(p.removeEventListener("keydown",s),p.removeEventListener("beforeinput",l,!0),p.removeEventListener("input",c),p.removeEventListener("compositionend",f)),m()}},[t]),null}function Oq({documentKey:e,value:t,cursor:n,terminalContexts:o,skills:r,disabled:a,placeholder:i,className:s,onRemoveTerminalContext:l,onChange:d,onCommandKeyDown:c,onPaste:f,editorRef:p}){let[m]=Cn(),g=N(d);g.current=d;let h=fr(t,n),v=Ha(e,t,{cursor:h,expandedCursor:Go(t,h)}),y=fr(t,v.cursor),x=wq(o),C=N(x),w=Sq(r),L=N(w),S=N(Iu(r)),k=N({value:t,cursor:y,expandedCursor:v.expandedCursor,selection:v.selection,terminalContextIds:o.map(B=>B.id)}),I=N(e),T=v.history,A=N(!1),P=K(()=>({onRemoveTerminalContext:l}),[l]);he(()=>{S.current=Iu(r)},[r]),W(()=>{m.setEditable(!a)},[a,m]),he(()=>{let B=fr(t,n),V=k.current,Q=I.current,Se=Q!==e,H=C.current!==x,q=L.current!==w;if(!Se&&V.value===t&&V.cursor===B&&!H&&!q)return;if(Se){let se=V.selection;m.getEditorState().read(()=>{se=rC(se)}),fd(Q,V.value,{cursor:V.cursor,expandedCursor:V.expandedCursor,selection:se})}let ee=Ha(e,t),G=Se?ee.selection:{anchor:B,focus:B};k.current={value:t,cursor:Se?ee.cursor:B,expandedCursor:Se?ee.expandedCursor:Go(t,B),selection:G,terminalContextIds:o.map(se=>se.id)},I.current=e,C.current=x,L.current=w;let te=m.getRootElement(),me=!!(te&&document.activeElement===te);if(!Se&&V.value===t&&!H&&!q&&!me)return;let U=Se?Ha(Q,V.value).history:null;A.current=!0;let Y=()=>m.update(()=>{let se=Se||V.value!==t||H||q;se&&lC(t,o,S.current),Se?cg(G.anchor,G.focus):(se||me)&&Ks(B)},{discrete:!0,tag:t===""?[vr,XA]:vr});U?SR(U,Y):Y(),fd(e,t,k.current),queueMicrotask(()=>{A.current=!1})},[n,e,m,w,o,x,t]);let _=R(B=>{let V=m.getRootElement();if(!V)return;let Q=fr(k.current.value,B);V.focus({preventScroll:!0}),m.update(()=>{Ks(Q)}),k.current={value:k.current.value,cursor:Q,expandedCursor:Go(k.current.value,Q),selection:{anchor:Q,focus:Q},terminalContextIds:k.current.terminalContextIds},fd(I.current,k.current.value,{cursor:k.current.cursor,expandedCursor:k.current.expandedCursor,selection:k.current.selection}),g.current(k.current.value,Q,k.current.expandedCursor,!1,k.current.terminalContextIds)},[m]),E=R(()=>{let B=k.current;return m.getEditorState().read(()=>{let V=At().getTextContent(),Q=fr(V,k.current.cursor),Se=fr(V,Lu(Q)),H=dg(V,k.current.expandedCursor),q=dg(V,CM(H)),ee=iC(At()),G=rC(k.current.selection);B={value:V,cursor:Se,expandedCursor:q,selection:G,terminalContextIds:ee}}),k.current=B,fd(I.current,B.value,B),B},[m]);ar(p,()=>({focus:()=>{_(k.current.cursor)},focusAt:_,focusAtEnd:()=>{_(bo(k.current.value,k.current.value.length))},readSnapshot:E}),[_,E]);let F=R(B=>{B.read(()=>{let V=At().getTextContent(),Q=fr(V,k.current.cursor),Se=fr(V,Lu(Q)),H=dg(V,k.current.expandedCursor),q=dg(V,CM(H)),ee=iC(At()),G=rC(k.current.selection),te=k.current;if(te.value===V&&te.cursor===Se&&te.expandedCursor===q&&te.selection.anchor===G.anchor&&te.selection.focus===G.focus&&te.terminalContextIds.length===ee.length&&te.terminalContextIds.every((U,Y)=>U===ee[Y])||A.current)return;k.current={value:V,cursor:Se,expandedCursor:q,selection:G,terminalContextIds:ee},fd(I.current,V,{cursor:Se,expandedCursor:q,selection:G});let me=_c(V,Se,"left")||_c(V,Se,"right");g.current(V,Se,q,me,ee)})},[]);return u(wM,{value:P,children:b("div",{className:"relative [font-family:var(--font-composer,var(--font-sans))] [font-size:var(--font-size-prompt,0.875rem)] [@media(max-width:39.999rem)_and_(pointer:coarse)]:[font-size:max(var(--font-size-prompt,1rem),16px)]",children:[u(dM,{contentEditable:u(MR,{className:$("block max-h-50 min-h-17.5 w-full overflow-y-auto whitespace-pre-wrap wrap-break-word bg-transparent leading-relaxed text-foreground focus:outline-none",s),"data-testid":"composer-editor","data-composer-prompt":"true",spellCheck:!1,autoCorrect:"off",autoCapitalize:"off","aria-placeholder":i,placeholder:u("span",{}),onPaste:f}),placeholder:o.length>0?null:u("div",{className:"pointer-events-none absolute inset-0 leading-relaxed text-placeholder",children:i}),ErrorBoundary:NR}),u(_R,{onChange:F}),u(Pq,{...c?{onCommandKeyDown:c}:{}}),u(Dq,{terminalContexts:o,skills:r}),u(Eq,{}),u(Aq,{}),u(Rq,{}),u(Mq,{}),u(_q,{}),u(Nq,{}),u(xR,{externalHistoryState:T},e)]})})}function Fq(e){let[t]=Cn(),n=N(e),o=N(e),[r,a]=J(e.documentKey);r===e.documentKey&&(n.current=e),o.current=e,he(()=>{r===e.documentKey||t.isComposing()||a(e.documentKey)},[r,t,e.documentKey]),W(()=>{let s=null,l=()=>{let c=o.current.documentKey;a(f=>f===c?f:c)},d=t.registerRootListener((c,f)=>{f?.removeEventListener("compositionend",l),c?.addEventListener("compositionend",l),s=c});return()=>{s?.removeEventListener("compositionend",l),d()}},[t]);let i=r===e.documentKey?e:n.current;return u(Oq,{...i})}function kM({documentKey:e,value:t,cursor:n,terminalContexts:o,skills:r,disabled:a,placeholder:i,className:s,onRemoveTerminalContext:l,onChange:d,onCommandKeyDown:c,onPaste:f,editorRef:p}){let m=N(t),g=N(o),h=N(Iu(r)),v=K(()=>({namespace:"ycodium-composer-editor",editable:!0,nodes:[Su,Tu,$s],editorState:()=>{lC(m.current,g.current,h.current)},onError:y=>{throw y}}),[]);return u(TR,{initialConfig:v,children:u(Fq,{documentKey:e,value:t,cursor:n,terminalContexts:o,skills:r,disabled:a,placeholder:i,onRemoveTerminalContext:l,onChange:d,onPaste:f,editorRef:p,...c?{onCommandKeyDown:c}:{},...s?{className:s}:{}})},gq)}ue();function Bq(e){let t=new Date(e);return Number.isNaN(t.getTime())?null:t}function LM(e,t){let n=Bq(e);if(!n)return"";let o=Date.now()-n.getTime();if(o<0)return t("relativeTime.justNow");let r=Math.floor(o/1e3);if(r<60)return t("relativeTime.justNow");let a=Math.floor(r/60);if(a<60)return t("relativeTime.minutesAgo",{count:a});let i=Math.floor(a/60);return i<24?t("relativeTime.hoursAgo",{count:i}):t("relativeTime.daysAgo",{count:Math.floor(i/24)})}var PM=90;function AM(e){return e.droppedImageNames.length+(e.unreadableImageNames?.length??0)}function zq(e,t){let n=e.prompt.trim().replace(/\s+/g," ");if(n.length>0)return n.length>PM?`${n.slice(0,PM)}\u2026`:n;let o=e.attachments.length+e.droppedImageNames.length;return o>0?t("stash.imageCountLabel",{count:o}):t("stash.emptyEntry")}var EM=pe(function(t){let{entries:n,onRestore:o,onDelete:r,onClose:a}=t,{t:i}=Ce(),s=Wt(),l=N(null),[d,c]=J(n[0]?.id??null),f=n.find(p=>p.id===d)??n[0];return W(()=>{let p=m=>{let g=l.current;g&&m.composedPath().includes(g)||m.target instanceof Element&&m.target.closest('[data-prompt-stash-badge="true"]')||a()};return document.addEventListener("pointerdown",p,!0),()=>document.removeEventListener("pointerdown",p,!0)},[a]),W(()=>{n.length!==0&&(n.some(p=>p.id===d)||c(n[0]?.id??null))},[n,d]),s.pane.useKeydown(p=>{if(p.key==="Escape"){p.preventDefault(),p.stopPropagation(),a();return}if(p.key==="ArrowDown"||p.key==="ArrowUp"){if(n.length===0)return;p.preventDefault(),p.stopPropagation();let m=n.findIndex(y=>y.id===d),g=p.key==="ArrowDown"?1:-1,v=((m>=0?m:g===1?-1:0)+g+n.length)%n.length;c(n[v]?.id??null);return}if(p.key==="Enter"){if(p.target instanceof HTMLElement&&p.target.closest("button[aria-label]")||!f)return;p.preventDefault(),p.stopPropagation(),o(f);return}if(p.key==="Backspace"&&(p.metaKey||p.ctrlKey)){if(!f)return;p.preventDefault(),p.stopPropagation(),r(f)}},{capture:!0}),u(zf,{autoHighlight:!1,mode:"none",children:b("div",{ref:l,className:"chat-composer-drawer-surface chat-composer-drawer-attached relative w-full overflow-hidden","data-composer-stash-drawer":"true",children:[u("div",{className:"flex h-7 items-center justify-end px-2 pt-1",children:u(ce,{variant:"ghost-muted",size:"icon-micro","aria-label":i("stash.closeLabel"),onPointerDown:p=>p.preventDefault(),onClick:a,children:u(Zt,{className:"size-3"})})}),u($f,{className:"max-h-64 scroll-pb-6",children:u(Uf,{children:n.length===0?u("p",{className:"px-3 py-1.5 text-secondary-label text-xs",children:i("stash.empty")}):n.map(p=>b(Hf,{value:p.id,className:$("group/stash relative cursor-pointer select-none gap-3 rounded-lg px-3 py-1.5! hover:bg-transparent hover:text-inherit data-highlighted:bg-transparent data-highlighted:text-inherit",d===p.id&&"bg-accent! text-accent-foreground!"),onMouseMove:()=>{d!==p.id&&c(p.id)},onMouseDown:m=>{m.preventDefault()},onClick:()=>{o(p)},children:[u("span",{className:"min-w-0 flex-1 truncate text-xs",children:zq(p,i)}),p.pendingImageCount?u("span",{className:"shrink-0 text-[10px] text-secondary-label",children:i("stash.savingImage",{count:p.pendingImageCount})}):AM(p)>0?u("span",{className:"shrink-0 text-[10px] text-warning-foreground",children:i("stash.imagesDropped",{count:AM(p)})}):null,p.attachments.length>0?u("span",{className:"flex shrink-0 items-center -space-x-1.5",children:p.attachments.slice(0,3).map(m=>u("img",{src:m.dataUrl,alt:"","aria-hidden":"true",className:"size-5 rounded border border-border/70 object-cover"},m.id))}):null,u("span",{className:"shrink-0 text-secondary-label text-xs max-sm:hidden",children:LM(p.createdAt,i)}),u(ce,{variant:"ghost",size:"icon-xs",className:"pointer-events-none shrink-0 [--control-icon-color:currentColor] opacity-0 shadow-none! transition-opacity pointer-coarse:pointer-events-auto pointer-coarse:opacity-100 group-hover/stash:pointer-events-auto group-hover/stash:opacity-100 group-focus-within/stash:pointer-events-auto group-focus-within/stash:opacity-100 focus-visible:pointer-events-auto focus-visible:opacity-100","aria-label":i("stash.deleteLabel"),onClick:m=>{m.stopPropagation(),r(p)},children:u(Zt,{className:"stroke-2"})})]},p.id))})})]})})});ue();function co(e,t){let n=e.trim();return n?t?.trimLeadingPattern?n.replace(t.trimLeadingPattern,"").toLowerCase():n.toLowerCase():""}function Uq(e,t){if(!t)return 0;let n=0,o=-1,r=-1,a=0;for(let i=0;i<e.length;i+=1)if(e[i]===t[n]&&(o===-1&&(o=i),r!==-1&&(a+=i-r-1),r=i,n+=1,n===t.length)){let s=i-o+1-t.length,l=Math.min(64,e.length-t.length);return o*2+a*3+s+l}return null}function dC(e,t){return Math.min(64,Math.max(0,e.length-t.length))}function Hq(e,t,n){let o=null;for(let r of n){let a=e.indexOf(`${r}${t}`);if(a===-1)continue;let i=a+r.length;(o===null||i<o)&&(o=i)}return o}function Hr(e){let{value:t,query:n}=e;if(!t||!n)return null;if(t===n)return e.exactBase;if(e.prefixBase!==void 0&&t.startsWith(n))return e.prefixBase+dC(t,n);if(e.boundaryBase!==void 0){let o=Hq(t,n,e.boundaryMarkers??[" ","-","_","/"]);if(o!==null)return e.boundaryBase+o*2+dC(t,n)}if(e.includesBase!==void 0){let o=t.indexOf(n);if(o!==-1)return e.includesBase+o*2+dC(t,n)}if(e.fuzzyBase!==void 0){let o=Uq(t,n);if(o!==null)return e.fuzzyBase+o}return null}function $q(e,t){let n=e.score-t.score;return n!==0?n:e.tieBreaker.localeCompare(t.tieBreaker)}function Kq(e,t){let n=0,o=e.length;for(;n<o;){let r=n+Math.floor((o-n)/2),a=e[r];if(!a)break;$q(t,a)<0?o=r:n=r+1}return n}function hg(e,t,n){if(n<=0)return;let o=Kq(e,t);if(e.length<n){e.splice(o,0,t);return}o>=n||(e.splice(o,0,t),e.pop())}function cC(e,t){let n=e.name.toLowerCase(),o=sa(e).toLowerCase(),r=e.shortDescription?.toLowerCase()??"",a=e.description?.toLowerCase()??"",i=e.scope?.toLowerCase()??"",s=[Hr({value:n,query:t,exactBase:0,prefixBase:2,boundaryBase:4,includesBase:6,fuzzyBase:100,boundaryMarkers:["-","_","/"]}),Hr({value:o,query:t,exactBase:1,prefixBase:3,boundaryBase:5,includesBase:7,fuzzyBase:110}),Hr({value:r,query:t,exactBase:20,prefixBase:22,boundaryBase:24,includesBase:26}),Hr({value:a,query:t,exactBase:30,prefixBase:32,boundaryBase:34,includesBase:36}),Hr({value:i,query:t,exactBase:40,prefixBase:42,includesBase:44})].filter(l=>l!==null);return s.length===0?null:Math.min(...s)}function RM(e,t,n=Number.POSITIVE_INFINITY){let o=e.filter(i=>i.enabled),r=co(t,{trimLeadingPattern:/^\$+/});if(!r)return o;let a=[];for(let i of o){let s=cC(i,r);s!==null&&hg(a,{item:i,score:s,tieBreaker:`${sa(i).toLowerCase()}\0${i.name}`},n)}return a.map(i=>i.item)}function Vq(e,t){if(e.type==="skill"){if(t==="skill")return 0;let a=t.startsWith("skill:")?t.slice(6):t,i=a?cC(e.skill,a):0;return i!==null?i:"skill".startsWith(t)?Number.MAX_SAFE_INTEGER:null}let n=e.type==="slash-command"?e.command.toLowerCase():e.command.name.toLowerCase(),o=e.description.toLowerCase(),r=[Hr({value:n,query:t,exactBase:0,prefixBase:2,boundaryBase:4,includesBase:6,fuzzyBase:100,boundaryMarkers:["-","_","/"]}),Hr({value:o,query:t,exactBase:20,prefixBase:22,boundaryBase:24,includesBase:26})].filter(a=>a!==null);return r.length===0?null:Math.min(...r)}function MM(e,t,n=[]){let o=co(t,{trimLeadingPattern:/^\/+/});if(!o)return[...e];let r=[];for(let a of e){let i=Vq(a,o);if(i===null)continue;let s=n.includes(a.id)?i-1:i;hg(r,{item:a,score:s,tieBreaker:a.type==="slash-command"?`0\0${a.command}`:a.type==="provider-slash-command"?`1\0${a.command.name}\0${a.provider}`:`2\0${a.skill.name}\0${a.provider}`},Number.POSITIVE_INFINITY)}return r.map(a=>a.item)}function NM(e,t){let n=new Map(e.map(s=>[s.id,s])),o=t.map(s=>n.get(s)).filter(s=>s!==void 0).slice(0,3).map(s=>({...s,section:"recent"})),r=new Set(o.map(s=>s.id)),a=e.filter(s=>!r.has(s.id)),i=s=>s.type==="slash-command"?"builtIn":s.type==="provider-slash-command"?"provider":"skills";return[...o,...a.map(s=>({...s,section:i(s)}))]}function uC(e){return e.items.length===0?null:e.currentSearchKey===e.highlightedSearchKey&&e.highlightedItemId&&e.items.some(t=>t.id===e.highlightedItemId)?e.highlightedItemId:e.items[0]?.id??null}var _M=(e,t,n)=>n.endsWith(" ")&&e[t]===" "?t+1:t;function vg(e){return e===null?null:`${e.kind}:${e.rangeStart}:${e.rangeEnd}:${e.query}`}function DM({prompt:e,selectedProvider:t,selectedProviderStatus:n,planModeUiEnabled:o,showSkillsInSlashMenu:r,recentSlashCommandIds:a,environmentId:i,gitCwd:s,useComposerPathSearch:l,readComposerSnapshot:d,applyPromptReplacement:c,onInteractionModeChange:f,onOpenModelPicker:p,onSlashCommandUsed:m}){let{t:g}=Ce(),[h,v]=J(()=>wo(e,e.length)),[y,x]=J(null),[C,w]=J(null),[L,S]=J(null),k=y!==null&&vg(h)===y?null:h,I=k?.kind==="path"?k.query:"",T=k?.kind==="path",A=l({environmentId:i,cwd:T?s:null,query:T?I:null}),P=K(()=>{if(!k)return[];if(k.kind==="path")return A.entries.map(ee=>({id:`path:${ee.kind}:${ee.path}`,type:"path",path:ee.path,pathKind:ee.kind,label:qq(ee.path),description:ee.path.slice(0,Math.max(0,ee.path.lastIndexOf("/")))}));if(k.kind==="slash-command"){let ee=[{id:"slash:model",type:"slash-command",command:"model",label:"/model",description:g("composer.switchModelDesc")},...o?[{id:"slash:plan",type:"slash-command",command:"plan",label:"/plan",description:g("composer.planDesc")},{id:"slash:default",type:"slash-command",command:"default",label:"/default",description:g("composer.defaultDesc")}]:[]],G=vk(n?.skills??[],r),te=yk(n?.slashCommands??[],G).map(se=>({id:`provider-slash-command:${t}:${se.name}`,type:"provider-slash-command",provider:t,command:se,label:`/${se.name}`,description:se.description??se.input?.hint??g("composer.runProviderCommand")})),me=k.query.trim().toLowerCase(),U=G.map(se=>({id:`skill:${t}:${se.name}`,type:"skill",provider:t,skill:se,label:`/skill:${se.name}`,description:se.shortDescription??se.description??(se.scope?g("composer.skillScopeDescription",{scope:se.scope}):"")})),Y=[...ee,...te,...U];return me===""?NM(Y,a):MM(Y,me,a)}return k.kind==="skill"?RM(n?.skills??[],k.query).map(ee=>({id:`skill:${t}:${ee.name}`,type:"skill",provider:t,skill:ee,label:sa(ee),description:ee.shortDescription??ee.description??(ee.scope?g("composer.skillScopeDescription",{scope:ee.scope}):g("composer.runProviderSkill"))})):[]},[k,o,a,t,n,r,g,A.entries]),_=!!k,E=k?`${k.kind}:${k.query.trim().toLowerCase()}`:null,F=K(()=>{let ee=uC({items:P,highlightedItemId:C,currentSearchKey:E,highlightedSearchKey:L});return P.find(G=>G.id===ee)??null},[P,C,E,L]),B=R(()=>{let ee=d(),G=wo(ee.value,ee.expandedCursor),te=y!==null&&vg(G)===y?null:G;return{snapshot:ee,trigger:te}},[d,y]),V=R(ee=>{let{snapshot:G,trigger:te}=B();if(!te)return;if((ee.type==="slash-command"||ee.type==="provider-slash-command"||ee.type==="skill")&&m?.(ee.id),ee.type==="path"){let se=`${bu(ee.path)} `,ge=_M(G.value,te.rangeEnd,se);c(te.rangeStart,ge,se,{expectedText:G.value.slice(te.rangeStart,ge)})&&w(null);return}if(ee.type==="slash-command"){if(ee.command==="model"){c(te.rangeStart,te.rangeEnd,"",{expectedText:G.value.slice(te.rangeStart,te.rangeEnd),focusEditorAfterReplace:!1})&&(w(null),p());return}f(ee.command==="plan"?"plan":"default"),c(te.rangeStart,te.rangeEnd,"",{expectedText:G.value.slice(te.rangeStart,te.rangeEnd)})&&w(null);return}let me=ee.type==="provider-slash-command"?`/${ee.command.name} `:`$${ee.skill.name} `,U=_M(G.value,te.rangeEnd,me);c(te.rangeStart,U,me,{expectedText:G.value.slice(te.rangeStart,U)})&&w(null)},[c,f,p,m,B]);W(()=>{if(!_){w(null),S(null);return}let ee=uC({items:P,highlightedItemId:C,currentSearchKey:E,highlightedSearchKey:L});w(G=>G===ee?G:ee),S(G=>G===E?G:E)},[C,L,P,_,E]);let Q=R(ee=>{w(ee),S(E)},[E]),Se=R(()=>{let{trigger:ee}=B();return ee===null?!1:(x(vg(ee)),w(null),!0)},[B]),H=R((ee,G)=>{let te=Go(ee,G),me=wo(ee,te);v(me);let U=vg(me);x(Y=>Y!==null&&Y!==U?null:Y),w(null),S(null)},[]),q=R(()=>{w(null)},[]);return{composerTrigger:h,menuTrigger:k,composerMenuItems:P,composerMenuOpen:_,composerMenuSearchKey:E,activeComposerMenuItem:F,resolveActiveComposerTrigger:B,onSelectComposerItem:V,onComposerMenuItemHighlighted:Q,onMenuEscape:Se,resetForDocumentChange:H,dismissTrigger:q,workspaceEntries:A,highlightedItemId:C,setTrigger:v,setHighlightedItemId:w,setHighlightedSearchKey:S}}function qq(e){let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t>=0?e.slice(t+1):e}function Wq(e,t){return e.bottom===t.bottom&&e.left===t.left&&e.maxHeight===t.maxHeight&&e.width===t.width&&e.overlap===t.overlap}function OM(e){let t=Wt(),n=hf(),o=t.pane.useActive(),[r,a]=J(null);return he(()=>{if(!o)return;let i=e.anchor;if(!i){a(null);return}let s=!0,l=()=>{if(!s)return;let c=i.closest('[data-chat-composer-form="true"]'),p=(c?.querySelector('[data-chat-composer-main-surface="true"]')??c??i).getBoundingClientRect(),m=Number.parseFloat(window.getComputedStyle(document.documentElement).fontSize)||16,h=(Number.parseFloat(window.getComputedStyle(c??i).getPropertyValue("--chat-composer-drawer-inset"))||1.375)*m,v=m+1,y={bottom:window.innerHeight-p.top-v,left:p.left+h,maxHeight:Math.max(96,p.top-24+v),width:Math.max(0,p.width-h*2),overlap:v};a(x=>x&&Wq(x,y)?x:y)};l(),window.addEventListener("resize",l),window.addEventListener("scroll",l,!0);let d=typeof ResizeObserver>"u"?null:new ResizeObserver(l);if(d){d.observe(i);for(let c=i.parentElement;c;c=c.parentElement)d.observe(c)}return()=>{s=!1,d?.disconnect(),window.removeEventListener("resize",l),window.removeEventListener("scroll",l,!0)}},[e.anchor,o]),!o||!r?null:t.createPortal(u("div",{className:n,"data-composer-drawer-layer":"true",style:{position:"fixed",zIndex:45,pointerEvents:"auto",clipPath:`inset(0 0 ${r.overlap}px 0)`,bottom:r.bottom,left:r.left,maxHeight:r.maxHeight,width:r.width},children:e.children}),document.body)}var Gq=[],jq=[],Qq=e=>e.prompt,Xq=(e,t)=>{let n=new Map(e.map(o=>[o.id,o]));return t.flatMap(o=>{let r=n.get(o);return r?[r]:[]})},Yq=(e,t)=>e.length===t.length&&e.every((n,o)=>n.id===t[o]),FM=pe(function(t){let{handleRef:n,api:o,composerDraftTarget:r,composerDocumentKey:a,promptRef:i,editorRef:s,menuAnchor:l,resolvedTheme:d,selectedProvider:c,selectedProviderStatus:f,planModeUiEnabled:p,showSkillsInSlashMenu:m,recentSlashCommandIds:g,environmentId:h,gitCwd:v,onSlashCommandUsed:y,onOpenModelPicker:x,onInteractionModeChange:C,onToggleInteractionMode:w,activePendingProgress:L,activePendingRequestId:S,hasPendingUserInputs:k,changeUserInputCustomAnswer:I,terminalContexts:T,showTerminalContexts:A,showEditor:P,isApprovalState:_,editorClassName:E,placeholder:F,disabled:B,onPaste:V,onSubmit:Q,isMobileViewport:Se,isDraftRoute:H,stashMenuOpen:q,stashEntries:ee,onRestoreStashEntry:G,onDeleteStashEntry:te,onCloseStashMenu:me,onPromptEdited:U,onUnclaimedEscape:Y}=t,{t:se}=Ce(),ge=o.draft.useThreadDraftSelector(r,Qq),ie=o.draft.useStore,Ae=ie(xe=>xe.setPrompt),Xe=ie(xe=>xe.setTerminalContexts),nt=ie(xe=>xe.removeTerminalContext),rt=bo(ge,ge.length),Ve=Ha(a,ge,{cursor:rt,expandedCursor:ge.length}),[ne,we]=J(()=>({documentKey:a,cursor:Ve.cursor})),j=ne.documentKey===a?ne.cursor:Ve.cursor,X=R(xe=>{we(_e=>{let qe=_e.documentKey===a?_e.cursor:Ha(a,i.current).cursor,We=typeof xe=="function"?xe(qe):xe,ot=i.current,xt=Go(ot,We);return wR(a,ot,We,xt),_e.documentKey===a&&_e.cursor===We?_e:{documentKey:a,cursor:We}})},[a,i]),ae=N(!1),oe=N(!1),ft=N([]),pt=N(null),yt=R(xe=>{Ae(r,xe)},[r,Ae]),Pt=R((xe,_e,qe,We,ot)=>{I(xe,_e,qe,We,ot),i.current=_e},[I,i]),nn=R((xe,_e,qe,We)=>{let ot=i.current,xt=Math.max(0,Math.min(ot.length,xe)),Ft=Math.max(xt,Math.min(ot.length,_e));if(We?.expectedText!==void 0&&ot.slice(xt,Ft)!==We.expectedText)return!1;let Jt=JT(i.current,xe,_e,qe),ke=bo(Jt.text,Jt.cursor),zt=Go(Jt.text,ke);i.current=Jt.text;let vt=L?.activeQuestion;return vt&&k?Pt(vt.id,Jt.text,ke,zt,!1):yt(Jt.text),X(ke),on(wo(Jt.text,zt)),We?.focusEditorAfterReplace!==!1&&window.requestAnimationFrame(()=>{s.current?.focusAt(ke)}),!0},[L?.activeQuestion,s,k,Pt,i,X,yt]),gt=R(()=>{let xe=s.current?.readSnapshot();return xe||{value:i.current,cursor:j,expandedCursor:Go(i.current,j),terminalContextIds:T.map(_e=>_e.id)}},[j,s,i,T]),Bt=DM({prompt:ge,selectedProvider:c,selectedProviderStatus:f,planModeUiEnabled:p,showSkillsInSlashMenu:m,recentSlashCommandIds:g,environmentId:h,gitCwd:v,useComposerPathSearch:o.pathSearch.useComposerPathSearch,readComposerSnapshot:gt,applyPromptReplacement:nn,onInteractionModeChange:C,onOpenModelPicker:x,onSlashCommandUsed:y}),{composerTrigger:Mt,composerMenuItems:St,composerMenuOpen:In,activeComposerMenuItem:ct,resolveActiveComposerTrigger:ln,onComposerMenuItemHighlighted:ro,onMenuEscape:Vt,workspaceEntries:bn,highlightedItemId:Tn,setTrigger:on,setHighlightedItemId:kn}=Bt,O=Mt?.kind??null,fe=Mt?.kind==="path"?Mt.query:"",ye=L?L.customAnswer:ge,Te=_?"":ye,Me=Bt.resetForDocumentChange;W(()=>{Me(ye,j)},[a,Me,ye,j]),oe.current=In,ft.current=St,pt.current=ct;let ht=O==="path"&&fe.length>0&&bn.isPending===!0,Ln=K(()=>se(O==="skill"?"composer.noSkillsFound":O==="path"?"composer.noMatchingFiles":"composer.noMatchingCommand"),[O]),fn=R(xe=>{let _e=T.findIndex(ot=>ot.id===xe);if(_e<0)return;let qe=o.terminalContext.removeInlinePlaceholder(i.current,_e);i.current=qe.prompt,yt(qe.prompt),nt(r,xe);let We=bo(qe.prompt,qe.cursor);X(We),on(wo(qe.prompt,qe.cursor))},[o.terminalContext,r,i,nt,X,yt,T,on]);he(()=>{i.current=ge,X(xe=>fr(ge,xe))},[a,ge,i,X]),W(()=>{U(ge)},[U,ge]),W(()=>{In&&me()},[In,me]);let at=N(null);W(()=>{let xe=L?.customAnswer;if(typeof xe!="string"){if(at.current!==null){i.current=ge;let Ft=bo(ge,ge.length);X(Ft),on(wo(ge,Go(ge,Ft)))}at.current=null;return}let _e=S,qe=L?.activeQuestion?.id??null,We=at.current?.requestId!==_e||at.current?.questionId!==qe,ot=i.current!==xe;if(at.current={requestId:_e,questionId:qe},!We&&!ot)return;i.current=xe;let xt=bo(xe,xe.length);X(xt),on(wo(xe,Go(xe,xt))),kn(null)},[L?.customAnswer,L?.activeQuestion?.id,S,ge,i]);let It=R((xe,_e,qe,We,ot)=>{if(L?.activeQuestion&&k){if(L.activeQuestion.allowFreeform===!1)return;X(_e),on(We?null:wo(xe,qe)),Pt(L.activeQuestion.id,xe,_e,qe,We);return}i.current=xe,yt(xe),Yq(T,ot)||Xe(r,Xq(T,ot)),X(_e),on(We?null:wo(xe,qe))},[L?.activeQuestion,k,Pt,i,X,yt,r,T,Xe,on]),Et=Bt.onSelectComposerItem,Tt=R(xe=>{ae.current||(ae.current=!0,window.requestAnimationFrame(()=>{ae.current=!1}),Et(xe))},[Et]),rn=R(xe=>{if(St.length===0)return;let _e=St.findIndex(Ft=>Ft.id===Tn),ot=((_e>=0?_e:xe==="ArrowDown"?-1:0)+(xe==="ArrowDown"?1:-1)+St.length)%St.length,xt=St[ot];kn(xt?.id??null)},[Tn,St,kn]),Yt=(xe,_e)=>{if(xe==="Escape")return _e.isComposing||_e.keyCode===229?!1:Vt()||(Y?.()??!1);if(xe==="Tab"&&_e.shiftKey)return p?(w(),!0):!1;let{trigger:qe}=ln();if(oe.current||qe!==null){let xt=ft.current,Ft=pt.current??xt[0];if(xe==="ArrowDown"&&xt.length>0)return rn("ArrowDown"),!0;if(xe==="ArrowUp"&&xt.length>0)return rn("ArrowUp"),!0;if((xe==="Enter"||xe==="Tab")&&Ft)return Tt(Ft),!0}let ot=xe==="Enter"?QT({isMobileViewport:Se,shiftKey:_e.shiftKey,modifierKey:_e.metaKey||_e.ctrlKey,isDraftThread:H}):null;return ot?(Q(void 0,ot),!0):!1};return ar(n,()=>({readSnapshot:gt,readDraftPrompt:()=>ge,applyPromptReplacement:nn,syncCursor:(xe,_e)=>{X(xe),on(_e)},resetCursorState:xe=>{let _e=xe?.prompt??i.current,qe=fr(_e,xe?.cursor??0);kn(null),X(qe),on(xe?.detectTrigger?wo(_e,Go(_e,qe)):null)}}),[nn,ge,i,gt,X,kn,on]),b(Pe,{children:[q&&!In&&!_&&u(OM,{anchor:l,children:u(EM,{entries:ee,onRestore:G,onDelete:te,onClose:me})}),In&&!_&&u(OM,{anchor:l,children:u(bk,{items:St,resolvedTheme:d,isLoading:ht,triggerKind:O,emptyStateText:Ln,activeItemId:ct?.id??null,onHighlightedItemChange:ro,onSelect:Tt})}),P?u(kM,{editorRef:s,documentKey:a,value:Te,cursor:j,terminalContexts:A?T:Gq,skills:f?.skills??jq,...E?{className:E}:{},onRemoveTerminalContext:fn,onChange:It,onCommandKeyDown:Yt,onPaste:V,placeholder:F,disabled:B}):null]})});ue();function BM(e){return e==="ready"}function zM(e){return e==="ready"||e==="unchecked"||e==="checking"}function UM(e,t){switch(e){case"ready":return t("readiness.ready.title");case"unchecked":return t("readiness.unchecked.title");case"checking":return t("readiness.checking.title");case"disabled":return t("readiness.disabled.title");case"not-installed":return t("readiness.notInstalled.title");case"unauthenticated":return t("readiness.unauthenticated.title");case"error":return t("readiness.error.title");default:return e}}function yg(e){return e.enabled&&zM(e.readiness)}function Pu(e){return e.enabled}function HM(e){let t=new Map;for(let n of e){let o=t.get(n.driverKind);o?o.push(n):t.set(n.driverKind,[n])}return[...t.values()].flat()}var $M=e=>e.enabled;function KM(e,t){let n=e.find(o=>o.instanceId===t);if(n)return n.driverKind}var VM="h-7 min-h-7 gap-1.5 rounded-[var(--control-radius)] px-2.5 text-secondary-label transition-none hover:text-foreground [&_svg[data-composer-control-icon]]:mx-0 [&_svg[data-composer-control-chevron]]:-mx-0.5";function Xo({className:e,size:t="sm",variant:n="ghost",...o}){return u(ce,{className:$(VM,e),size:t,variant:n,...o})}function Yo({icon:e,className:t,opticalSize:n="default"}){return u(e,{"aria-hidden":"true",className:$("shrink-0",n==="large"?"size-4.5":"size-4",t),"data-composer-control-icon":!0})}function ma(){return u(an,{"aria-hidden":"true",className:"-mx-0.5 size-icon-2 shrink-0 text-icon-muted","data-composer-control-chevron":!0,strokeWidth:2.25})}function xg({className:e,size:t="sm",variant:n="ghost",...o}){return u(Ww,{className:$(VM,e),icon:u(ma,{}),size:t,variant:n,...o})}function fC(e,t){if(!e)return t("composer.agentPickerLabel");let n=e.agentName?.trim(),o=e.displayName.trim();return n?!o||o===n?n:`${n} \xB7 ${o}`:o}function pC(e,t){let n=e.filter(Pu),o=t.lockedProvider;if(o==null||o.length===0)return n;let r=t.lockedContinuationGroupKey;return n.filter(a=>a.driverKind===o&&(!r||a.continuationGroupKey===r))}var mC=pe(function(t){let{t:n}=Ce(),o=t.instanceEntries.filter(Pu),r=t.unavailableInstanceId??null,a=r===null?null:t.instanceEntries.find(c=>c.instanceId===r)??null,i=t.notChosen===!0&&r===null,s=r!==null||i?null:o.find(c=>c.instanceId===t.activeInstanceId)??null,l=t.lockedProvider!=null&&t.lockedProvider.length>0,d=r!==null||i?pC(t.instanceEntries,t):o;return b(Eo,{children:[b(Mo,{render:u(Xo,{"aria-label":n("composer.agentPickerLabel"),"data-composer-agent-picker":"true",disabled:t.disabled||l&&r===null||d.length===0,className:$("min-w-0 justify-between whitespace-nowrap",t.compact?"max-w-36 shrink-0":"max-w-44 shrink")}),children:[r!==null?u(Sn,{"aria-hidden":"true",className:"size-4 shrink-0 text-warning"}):i?null:s?u(Tr,{driver:s.driverKind,displayName:s.displayName,accentColor:s.accentColor,className:"size-4",iconClassName:"size-4",indicatorBackground:"var(--contrast-input)"}):null,r!==null?b("span",{className:"min-w-0 truncate text-warning","data-composer-agent-unavailable":"true",children:[a===null?r:fC(a,n)," \xB7 ",n("composer.agentUnavailableBadge")]}):i?u("span",{className:"min-w-0 truncate","data-composer-agent-not-chosen":"true",children:n("composer.agentChoosePlaceholder")}):u("span",{className:"min-w-0 truncate",children:fC(s,n)}),u(ma,{})]}),u(Ro,{align:"start",children:u(kr,{value:r!==null||i?"":t.activeInstanceId,onValueChange:c=>{!c||r===null&&!i&&c===t.activeInstanceId||t.onInstanceChange(c)},children:d.map(c=>u(qo,{value:c.instanceId,children:fC(c,n)},c.instanceId))})})]})});function qM(e){return u(mC,{...e})}function WM(e){return e.machineUnavailable?"machineDisconnected":e.sessionStarted&&e.sessionDisconnected?"settled":"default"}function GM(e){switch(e){case"machineDisconnected":return"composer.disconnectedPlaceholder";case"settled":return"composer.idlePlaceholder";case"default":return null}}ue();ue();ue();var NC=Rd(YM(),1),NN=Rd(Sc(),1),_N=Rd(Sc(),1);zn(function(t,n){return De("div",{ref:n,...t})});var Ag=zn(function(t,n){return De("div",{ref:n,...t})}),yr=Ag,qa={OS:"web"};function Vs(e,t){return t===void 0?e:Math.max(0,Math.min(t,e))}function _C(e,t){return t===void 0||!Number.isFinite(t)||!Number.isFinite(e.scrollLength)||t<=e.scrollLength?t!==void 0&&Number.isFinite(t)&&Number.isFinite(e.scrollLength)?0:void 0:Math.max(0,t-e.scrollLength)}function DN(){return"normal"}function s4(e){var t;return(t=e?.horizontalRTLScrollType)!=null?t:DN()}function l4(e){var t;return(t=e?.rtl)!=null?t:!1}function Ga(e){return DC(e?.props)}function DC(e){return!!e?.horizontal&&l4(e)}function OC(e){return e?.horizontal?(DC(e)?e.stylePaddingLeft:e.stylePaddingRight)||0:e?.stylePaddingBottom||0}function d4(e,t){var n;return(n=_C(e,t))!=null?n:0}function JM(e,t){return t&&(Ga(e)?t.left:t.right)||0}function c4(e,t,n,o){return!Ga(e)||o===void 0||!Number.isFinite(o)?t:Math.max(0,o-t-n)}function FC(e,t,n){if(!e||!Ga(e))return t;let o=_C(e,n),r=Vs(t,o),a=s4(e);return a==="negative"?r===0?0:-r:a==="inverted"?o===void 0?r:Vs(o-r,o):r}function u4(e,t,n){if(!Ga(e))return e.horizontalRTLScrollType=void 0,t;let o=_C(e,n);if(t<0)return e.horizontalRTLScrollType="negative",Vs(-t,o);if(o===void 0)return t;let r=t,a=o-t;if(!Number.isFinite(a))return e.horizontalRTLScrollType="normal",r;let i=e.horizontalRTLScrollType;if(i==="inverted")return Vs(a,o);if(i==="normal")return Vs(r,o);if(!e.hasScrolled){let f=DN();return e.horizontalRTLScrollType=f,Vs(r,o)}let s=e.scroll,l=Math.abs(r-s),c=Math.abs(a-s)+.5<l;return e.horizontalRTLScrollType=c?"inverted":"normal",Vs(c?a:r,o)}var f4=e=>e,Eg=bt(null),ON="\0",p4=0;function m4({children:e}){let[t]=J(()=>({animatedScrollY:f4(0),columnWrapperStyle:void 0,containerLayoutTriggers:new Map,contextNum:p4++,listeners:new Map,mapViewabilityAmountCallbacks:new Map,mapViewabilityAmountValues:new Map,mapViewabilityCallbacks:new Map,mapViewabilityConfigStates:new Map,mapViewabilityValues:new Map,pendingContainerIds:void 0,positionListeners:new Map,scrollAxisGap:0,state:void 0,values:new Map([["alignItemsAtEndPadding",0],["containerLayoutEpoch",0],["stylePaddingTop",0],["headerSize",0],["numContainers",0],["activeStickyIndex",-1],["isAtEnd",!1],["isAtStart",!1],["isNearEnd",!1],["isNearStart",!1],["isWithinMaintainScrollAtEndThreshold",!1],["adaptiveRender","normal"],["totalSize",0],["scrollAdjustPending",0]]),viewRefs:new Map}));return De(Eg.Provider,{value:t},e)}function Kr(){return Ht(Eg)}function FN(e,t){if(!e){let r=[];return{get:()=>r,subscribe:()=>()=>{}}}let n=[],o=[];return{get:()=>{let r=[],a=!1;for(let i=0;i<t.length;i++){let s=be(e,t[i]);r.push(s),s!==o[i]&&(a=!0)}return o=r,a&&(n=r),n},subscribe:r=>{let a=[];for(let i of t)a.push(Ka(e,i,r));return()=>{for(let i of a)i()}}}}function g4(e){return e.length===1?e[0]:e.join(ON)}function h4(e){return e.split(ON)}function Ka(e,t,n){let{listeners:o}=e,r=o.get(t);return r||(r=new Set,o.set(t,r)),r.add(n),()=>r.delete(n)}function be(e,t){let{values:n}=e;return n.get(t)}function Be(e,t,n){let{listeners:o,values:r}=e;if(r.get(t)!==n){r.set(t,n);let a=o.get(t);if(a)for(let i of a)i(n)}}function v4(e,t,n){let{positionListeners:o}=e,r=o.get(t);return r||(r=new Set,o.set(t,r)),r.add(n),()=>r.delete(n)}function y4(e,t,n){let{positionListeners:o}=e,r=o.get(t);if(r)for(let a of r)a(n)}function Zo(e){let t=Ht(Eg),n=g4(e),{subscribe:o,get:r}=K(()=>FN(t,h4(n)),[t,n]);return(0,NC.useSyncExternalStore)(o,r,r)}function x4(e,t){let n=Ht(Eg),{subscribe:o,get:r}=K(()=>FN(n,[e]),[n,e]),a=R(()=>t(r()[0]),[r,t]);return(0,NC.useSyncExternalStore)(o,a,a)}function C4(e){return Math.max(0,e??0)}function Ws(e,t){var n;let o=e.state,{props:r}=o,a=r.horizontal,i=r.contentInset,s=i??o.nativeContentInset,l=(a?JM(o,s):s?.bottom)||0,d=C4(t??r.contentInsetEndAdjustment),c=be(e,"anchoredEndSpaceSize"),f=r.anchoredEndSpace&&c?c:0,p=(n=o.contentInsetOverride)!=null?n:void 0,m=l+d;if(p){let g={bottom:0,left:0,right:0,...s,...p};return Math.max(((a?JM(o,g):g.bottom)||0)+d,f)}return Math.max(m,f)}function uo(e){var t,n;let{values:o,state:r}=e,a=r.props.horizontal?r.props.stylePaddingLeft||0:o.get("stylePaddingTop")||0,i=r.props.horizontal?r.props.stylePaddingRight||0:r.props.stylePaddingBottom||0,s=o.get("alignItemsAtEndPadding")||0,l=o.get("headerSize")||0,d=o.get("footerSize")||0,c=Ws(e),f=(n=(t=r.pendingTotalSize)!=null?t:r.totalSize)!=null?n:o.get("totalSize"),p=Math.max(0,f-(r.props.data.length>0?e.scrollAxisGap:0));return l+d+p+a+s+i+(c||0)}var gd=({children:e})=>De(Ag,{style:{alignItems:"center",flexDirection:"row",justifyContent:"space-between"}},e);pe(function(){let t=Kr(),[n=0,o=0,r=0,a=0,i=0,s=0,l=!1]=Zo(["totalSize","scrollAdjust","debugRawScroll","debugComputedScroll","numContainers","numContainersPooled","isAtEnd"]),d=uo(t),[,c]=Sa(f=>f+1,0);return b4(()=>{c()},100),De(Ag,{pointerEvents:"none",style:{backgroundColor:"#FFFFFFCC",borderRadius:4,padding:4,paddingBottom:4,paddingLeft:4,position:"absolute",right:0,top:0}},De(gd,null,De(yr,null,"TotalSize:"),De(yr,null,n.toFixed(2))),De(gd,null,De(yr,null,"ContentSize:"),De(yr,null,d.toFixed(2))),De(gd,null,De(yr,null,"At end:"),De(yr,null,String(l))),De(gd,null,De(yr,null,"ScrollAdjust:"),De(yr,null,o.toFixed(2))),De(gd,null,De(yr,null,"RawScroll: "),De(yr,null,r.toFixed(2))),De(gd,null,De(yr,null,"ComputedScroll: "),De(yr,null,a.toFixed(2))))});function b4(e,t){W(()=>{let n=setInterval(e,t);return()=>clearInterval(n)},[t])}var BC=!0,BN=new WeakMap;function w4(e){return BN.get(e)}function S4(e,t){BN.set(e,t)}var I4=typeof __DEV__<"u"?__DEV__:void 0,ZM,eN=typeof process<"u"&&typeof process.env=="object"&&process.env?(ZM="production")!=null?ZM:process.env.MODE:void 0,tN=typeof eN=="string"?eN.toLowerCase()!=="production":void 0,nN,Jo=(nN=tN??I4)!=null?nN:!1,hd=-1e7,zN=1,T4=Jo&&!1,k4=Jo&&!1;function Rg({scheduledWork:e}){e.cancel("checkFinishedScrollFrame"),e.cancel("checkFinishedScrollRetryFrame"),e.cancel("checkFinishedScrollFallback"),e.cancel("platformScrollCompletion")}function UN(e){var t,n;let o=(n=e.pendingScrollResolve)!=null?n:(t=e.pendingScrollToEnd)==null?void 0:t.resolve;e.pendingScrollResolve=void 0,e.pendingScrollToEnd=void 0,o?.()}function L4(e){Rg(e),e.scheduledWork.cancel("imperativeScrollReady"),e.scrollingTo=void 0,e.scrollTargetPinnedRange=void 0,UN(e)}function P4(e,t,n){return{...t,nativeEvent:{...t.nativeEvent,contentOffset:e.props.horizontal?{x:n,y:0}:{x:0,y:n}}}}function A4(e,t){var n,o,r,a;let i=e.state,s=i.deferredPublicOnScrollEvent;i.deferredPublicOnScrollEvent=void 0,s&&((a=(r=i.props).onScroll)==null||a.call(r,P4(i,s,(o=(n=t??i.scrollPending)!=null?n:i.scroll)!=null?o:0)))}var hC=1;function E4(e){return!!(e?.didDispatchNativeScroll||e?.didRetrySilentInitialScroll||e?.watchdog)}function oN(e){e.initialScrollSession=void 0}function wC(e){let{bootstrap:t,completion:n,kind:o,previousDataLength:r}=e;return o==="offset"?{completion:n,kind:o,previousDataLength:r}:{bootstrap:t,completion:n,kind:o,previousDataLength:r}}function Cg(e,t=(n=>(n=(o=>(o=e.initialScrollSession)==null?void 0:o.kind)())!=null?n:"bootstrap")()){var n,o;return e.initialScrollSession?e.initialScrollSession.kind!==t&&(e.initialScrollSession=wC({bootstrap:e.initialScrollSession.kind==="bootstrap"?e.initialScrollSession.bootstrap:void 0,completion:e.initialScrollSession.completion,kind:t,previousDataLength:e.initialScrollSession.previousDataLength})):e.initialScrollSession=wC({completion:{},kind:t,previousDataLength:0}),(o=(n=e.initialScrollSession).completion)!=null||(n.completion={}),e.initialScrollSession.completion}var Mg={didDispatchNativeScroll(e){var t,n;return!!((n=(t=e.initialScrollSession)==null?void 0:t.completion)!=null&&n.didDispatchNativeScroll)},didRetrySilentInitialScroll(e){var t,n;return!!((n=(t=e.initialScrollSession)==null?void 0:t.completion)!=null&&n.didRetrySilentInitialScroll)},markInitialScrollNativeDispatch(e){Cg(e).didDispatchNativeScroll=!0},markSilentInitialScrollRetry(e){Cg(e).didRetrySilentInitialScroll=!0},resetFlags(e){if(!e.initialScrollSession)return;let t=Cg(e,e.initialScrollSession.kind);t.didDispatchNativeScroll=void 0,t.didRetrySilentInitialScroll=void 0}},oo={clear(e){oo.set(e,void 0)},didReachTarget(e,t){return Math.abs(e-t.targetOffset)<=hC},get(e){var t,n;return(n=(t=e.initialScrollSession)==null?void 0:t.completion)==null?void 0:n.watchdog},hasNonZeroTargetOffset(e){return e!==void 0&&e>hC},isAtZeroTargetOffset(e){return e<=hC},set(e,t){var n,o;if(!t&&!((o=(n=e.initialScrollSession)==null?void 0:n.completion)!=null&&o.watchdog))return;let r=Cg(e);r.watchdog=t?{startScroll:t.startScroll,targetOffset:t.targetOffset}:void 0}};function Wa(e,t={}){var n,o,r,a;let i=e.initialScrollSession,s=(n=t.kind)!=null?n:i?.kind,l=i?.completion,d=i?.kind==="bootstrap"?i.bootstrap:void 0,c=s==="bootstrap"?t.bootstrap===null?void 0:(o=t.bootstrap)!=null?o:d:void 0;if(!s||!e.initialScroll&&!c&&!E4(l))return oN(e);let f=(a=(r=t.previousDataLength)!=null?r:i?.previousDataLength)!=null?a:0;return e.initialScrollSession=wC({bootstrap:c,completion:l,kind:s,previousDataLength:f}),e.initialScrollSession}var R4=1.3;function SC(e,t,n){let o=Math.abs(e);return!t&&n>0&&o>=n*R4||!t&&n<=0&&o>0}var HN=(e,t,n,o,r,a,i,s)=>{let l=Math.abs(e),d=t||n>0&&l<=n,c=()=>{s({atThreshold:t,contentSize:a.contentSize,dataLength:a.dataLength,scrollPosition:a.scrollPosition})};return o?SC(e,t,n)?(s(void 0),!1):(d&&(!r||r.atThreshold!==t||r.contentSize!==a.contentSize||r.dataLength!==a.dataLength)&&c(),!0):d?(i(e),c(),!0):!1};function M4(e,t){let n=e.state;t==="start"?(n.isStartReached=!1,n.startReachedSnapshot=void 0):(n.isEndReached=!1,n.endReachedSnapshot=void 0)}function $N(e){let t=e.state;if(!t.edgeReachedGate)return;let n=uo(e),o=n-t.scroll-t.scrollLength-Ws(e),r=n<t.scrollLength,a=t.props.onStartReachedThreshold*t.scrollLength,i=t.props.onEndReachedThreshold*t.scrollLength,s=SC(t.scroll,!1,a),l=SC(o,r,i);s&&l&&(t.edgeReachedGate=void 0)}function KN(e,t,n,o){return!e.state.edgeReachedGate||n===t||!!o}function VN(e){e.state.edgeReachedGate="closed"}function rN(e){e.state.edgeReachedGate&&(e.state.edgeReachedGate="prepared")}function N4(e,t){let n=e.state;if(n.edgeReachedGate!=="prepared")return;let o=t<0?"start":"end";return n.edgeReachedGate="closed",M4(e,o),o}function Ru(e){return!!e?.initialScroll&&!e.didFinishInitialScroll}function qN(e,t,n){var o;let r=e.state;if(!r)return;let{queuedInitialLayout:a,scrollLength:i,scroll:s,maintainingScrollAtEnd:l,props:{maintainScrollAtEndThreshold:d,onEndReachedThreshold:c}}=r,f=uo(e);if($N(e),f>0&&a){let p=Ws(e),m=f-s-i-p,g=f<i;Be(e,"isAtEnd",g||m<=zN),Be(e,"isNearEnd",g||m<=c*i),Be(e,"isWithinMaintainScrollAtEndThreshold",g||m<=d*i),Ru(r)||l||(r.isEndReached=HN(m,g,c*i,r.isEndReached,r.endReachedSnapshot,{contentSize:f,dataLength:(o=r.props.data)==null?void 0:o.length,scrollPosition:s},v=>{var y,x;KN(e,"end",t,n)&&(VN(e),(x=(y=r.props).onEndReached)==null||x.call(y,{distanceFromEnd:v}))},v=>{r.endReachedSnapshot=v}))}}function _4(e,t,n){let o=e?.state;if(!o)return;let{isStartReached:r,props:{data:a,onStartReachedThreshold:i},scroll:s,scrollLength:l,startReachedSnapshot:d,totalSize:c}=o,f=a.length,p=i*l;$N(e),r&&p>0&&s>p&&d&&(d.contentSize!==c||d.dataLength!==f)&&(o.isStartReached=!1,o.startReachedSnapshot=void 0),Be(e,"isAtStart",s<=zN),Be(e,"isNearStart",s<=p),Ru(o)||o.scrollingTo||(o.isStartReached=HN(s,!1,p,o.isStartReached,d,{contentSize:c,dataLength:f,scrollPosition:s},g=>{var h,v;KN(e,"start",t,n)&&(VN(e),(v=(h=o.props).onStartReached)==null||v.call(h,{distanceFromStart:g}))},g=>{o.startReachedSnapshot=g}))}function Ng(e,t){let n=!e.state.edgeReachedGate;qN(e,t,n),_4(e,t,n)}function WN(e){var t,n;let o=e.state;(t=o.props)!=null&&t.data&&((n=o.triggerCalculateItemsInView)==null||n.call(o,{forceFullItemPositions:!0})),Ng(e)}var D4=6,O4=3,F4=250;function GN(e){e.state.scheduledWork.cancel("adaptiveRender")}function aN(e,t){let n=e.state;GN(e),t<=0?Du(e,"normal","scroll"):n.scheduledWork.timeout(()=>Du(e,"normal","scroll"),t,"adaptiveRender")}function Du(e,t,n){var o,r;be(e,"adaptiveRender")!==t&&(Be(e,"adaptiveRender",t),(r=(o=e.state.props.adaptiveRender)==null?void 0:o.onChange)==null||r.call(o,t,n))}function zC(e){var t,n;GN(e);let o=(n=(t=e.state.props.adaptiveRender)==null?void 0:t.initialMode)!=null?n:"normal";be(e,"adaptiveRender")!==o&&Du(e,o,"initial")}function B4(e,t,n){var o,r,a;let i=e.state,s=i.props.adaptiveRender,l=be(e,"adaptiveRender");if(be(e,"readyToRender"))if(s){let d=(o=s.enterVelocity)!=null?o:D4,c=(r=s.exitVelocity)!=null?r:O4,f=(a=s.exitDelay)!=null?a:F4,p=l==="light"?c:d,m=n?.forceLight||Math.abs(t)>p?"light":"normal",g=i.scheduledWork.has("adaptiveRender")?"normal":l;m!==g&&(m==="light"?(Du(e,"light","scroll"),aN(e,f)):l==="light"&&aN(e,f))}else zC(e)}var UC=50;function jN(e,t){var n;let o=e.state.props.drawDistance,r=e.state.initialScroll,a=r!==void 0&&((n=r.viewPosition)!=null?n:0)>0;return t==="visible-first"||t!=="full"&&!be(e,"readyToRender")&&!a?Math.min(o,UC):o}function QN(e){let{state:t}=e;t.props.drawDistance<=UC||t.scheduledWork.has("fullDrawDistancePrewarm")||t.scheduledWork.frame(()=>{var n;return(n=t.triggerCalculateItemsInView)==null?void 0:n.call(t)},"fullDrawDistancePrewarm")}function HC(e,{resetLayout:t,resetInitialScroll:n}){let{state:o}=e;t&&(o.didContainersLayout=!1,o.queuedInitialLayout=!1),n&&(o.didFinishInitialScroll=!1),Be(e,"readyToRender",!1),zC(e)}function $C(e,{didLayout:t,didInitialScroll:n}){let{state:o}=e,{loadStartTime:r,props:{onLoad:a}}=o;t&&(o.didContainersLayout=!0),n&&(o.didFinishInitialScroll=!0),o.didContainersLayout&&o.didFinishInitialScroll&&!be(e,"readyToRender")&&(Be(e,"readyToRender",!0),Du(e,"normal","ready"),o.props.drawDistance>UC&&QN(e),o.didLoad||(o.didLoad=!0,a&&a({elapsedTimeInMs:Date.now()-r})))}var z4=2e3;function iN(e,t){e.scroll=t,e.scrollPending=t,e.scrollPrev=t}function XN(e){e.scheduledWork.cancel("preservedInitialScroll")}function vd(e){XN(e),e.clearPreservedInitialScrollOnNextFinish=void 0,e.initialScroll=void 0,Wa(e)}function sN(e){var t,n,o;let r=e.state,a=((t=r.initialScrollSession)==null?void 0:t.kind)==="bootstrap"?r.initialScrollSession.bootstrap:void 0;(r.initialScroll||a||(n=r.scrollingTo)!=null&&n.isInitialScroll)&&(a?.frameHandle!==void 0&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(a.frameHandle),(o=r.scrollingTo)!=null&&o.isInitialScroll&&(Rg(r),r.scrollingTo=void 0,r.scrollTargetPinnedRange=void 0),Mg.resetFlags(r),Wa(r,{bootstrap:null}),yd(e))}function yd(e,t){var n,o,r;let a=e.state;if(t?.resolvedOffset!==void 0)iN(a,t.resolvedOffset);else if(t?.syncObservedOffset&&((n=a.initialScrollSession)==null?void 0:n.kind)==="offset"){let s=(r=(o=a.refScroller.current)==null?void 0:o.getCurrentScrollOffset)==null?void 0:r.call(o);typeof s=="number"&&Number.isFinite(s)&&iN(a,s)}let i=()=>{var s,l,d,c,f;let p=((s=a.initialScrollSession)==null?void 0:s.kind)==="bootstrap",m=(c=(d=(l=t?.resolvedOffset)!=null?l:a.scrollPending)!=null?d:a.scroll)!=null?c:0;oo.clear(a),t?.preserveTarget&&a.initialScroll?(a.clearPreservedInitialScrollOnNextFinish=void 0,Wa(a),XN(a),t?.schedulePreservedTargetClear&&a.scheduledWork.timeout(()=>{var g;!a.didFinishInitialScroll||(g=a.scrollingTo)!=null&&g.isInitialScroll||!a.initialScroll||vd(a)},z4,"preservedInitialScroll")):vd(a),t?.recalculateItems&&WN(e),$C(e,{didInitialScroll:!0}),p&&A4(e,m),(f=t?.onFinished)==null||f.call(t)};if(t?.waitForCompletionFrame){requestAnimationFrame(i);return}i()}function _g(e,t){let n=e.state;return t!==void 0&&n.positions[t]||0}function U4(e){let{state:t}=e;return(t.props.horizontal?(Ga(t)?t.props.stylePaddingRight:t.props.stylePaddingLeft)||0:be(e,"stylePaddingTop")||0)+(be(e,"alignItemsAtEndPadding")||0)+(be(e,"headerSize")||0)}function jt(e,t){let{data:n,keyExtractor:o}=e.props;if(!n)return"";let a=t<n.length?o?o(n[t],t):t:null;return e.idCache[t]=a,a}function H4(e){var t,n,o;let{state:r,values:a}=e;return(a.get("headerSize")||0)+(a.get("footerSize")||0)+((o=(n=(t=r.pendingTotalSize)!=null?t:r.totalSize)!=null?n:a.get("totalSize"))!=null?o:0)+(r.props.stylePaddingTop||0)+(r.props.stylePaddingBottom||0)}function $4(e){let{state:t}=e;return!!t.props.alignItemsAtEndPaddingEnabled&&!t.props.horizontal&&t.props.data.length>0&&t.scrollLength>0?Math.max(0,t.scrollLength-H4(e)-Ws(e)):0}function Xs(e){let t=be(e,"alignItemsAtEndPadding")||0,n=$4(e);t!==n&&Be(e,"alignItemsAtEndPadding",n)}function Mu(e,t,n,o=!0){let r=e.state,a=r.totalSize,i=r.totalSize;t===null?(i=n,r.timeoutSetPaddingTop&&(clearTimeout(r.timeoutSetPaddingTop),r.timeoutSetPaddingTop=void 0)):i+=n,a!==i?(r.pendingTotalSize=void 0,r.totalSize=i,o&&Be(e,"totalSize",i),Xs(e)):o&&e.values.get("totalSize")!==i&&Be(e,"totalSize",i)}function IC(e,t,n,o=!0){let r=e.state,{sizes:a}=r,i=a.get(t),s=i!==void 0?n-i:n;s!==0&&Mu(e,t,s,o),a.set(t,n)}function YN(e){return typeof e=="function"}function Dg(e){return Array.isArray(e)}var lN=new Set;function qs(e,t){Jo&&!lN.has(e)&&(lN.add(e),console.warn(`[legend-list] ${t}`))}function Ou(e){return Math.floor(e*8)/8}function Nu(e){return e==null}function dN(e,t){var n,o,r;let a=t==="Left"||t==="Right"?e.paddingHorizontal:e.paddingVertical;return(r=(o=(n=e[`padding${t}`])!=null?n:a)!=null?o:e.padding)!=null?r:0}function Eu(e,t,n){return dN(e,n)+dN(t,n)}function TC(e,t){var n,o;let r=(o=(n=e.state)==null?void 0:n.containerItemKeys)==null?void 0:o.get(t);if(r!==void 0)return r;let a=be(e,"numContainers");for(let i=0;i<a;i++)if(be(e,`containerItemKey${i}`)===t)return i;return-1}function JN(e,t,n,o,r){var a,i;let s=e.state,{getFixedItemSize:l,getItemType:d}=s.props,c=t?s.sizesKnown.get(t):void 0;if(c===void 0&&t&&l){let f=(i=r?.itemType)!=null?i:d&&(a=d(o,n))!=null?a:"",p=r?.didResolveFixedItemSize?r.fixedItemSize:l(o,n,f);p!==void 0&&(c=p+e.scrollAxisGap,s.sizesKnown.set(t,c))}return c}function ZN(e,t){let n=jt(e.state,t);return JN(e,n,t,e.state.props.data[t])}function K4(e,t,n){for(let o=t;o<=n;o++)if(ZN(e,o)===void 0)return!1;return!0}function fo(e,t,n,o,r,a,i,s){var l,d,c,f;let p=e.state,{sizes:m,averageSizes:g,props:{estimatedItemSize:h,getItemType:v},scrollingTo:y}=p,x=p.sizesKnown.get(t);if(x!==void 0)return x;let C,w=m.get(t);if(a&&w!==void 0)return w;if(C=JN(e,t,n,o,s),C!==void 0)return IC(e,t,C,i),C;let L=(d=s?.itemType)!=null?d:v&&(l=v(o,n))!=null?l:"";if(r&&!y){let S=(c=g[L])==null?void 0:c.avg;S!==void 0&&(C=Ou(S))}if(C===void 0&&w!==void 0)return w;if(C===void 0&&r&&y){let S=(f=y.averageSizeSnapshot)==null?void 0:f[L];S!==void 0&&(C=Ou(S))}return C===void 0&&(C=h+e.scrollAxisGap),IC(e,t,C,i),C}function KC(e,t){if(t===void 0||t<0)return;let n=jt(e.state,t);return fo(e,n,t,e.state.props.data[t])}function Og(e,t,n){var o;let r=e.state,{index:a,viewOffset:i,viewPosition:s}=n,l=t;if(i&&(l-=i),a!==void 0){let d=U4(e);d&&(l+=d)}if(s!==void 0&&a!==void 0){let d=r.props.data.length;if(d===0)return l;let c=a<0||a>=d,f=(o=r.props.estimatedItemSize)!=null?o:0,p=c?f:fo(e,jt(r,a),a,r.props.data[a]),m=Math.max(0,p-(c?0:e.scrollAxisGap)),g=Ws(e);if(l-=s*(r.scrollLength-g-m),!c&&a===r.props.data.length-1){let h=be(e,"footerSize")||0;l+=h}}return l}function Fi(e,t,n){let o=e.state,r=uo(e),a=t;if(Number.isFinite(r)&&Number.isFinite(o.scrollLength)&&qa.OS!=="android"){let i=Math.max(0,r-o.scrollLength),s=n?.viewOffset,l=typeof s=="number"&&s<0?-s:0,d=i+l;a=Math.min(t,d)}return a=Math.max(0,a),a}function Fu(e){var t,n;let o=e.state;if(o?.scrollingTo){Rg(o);let r=o.pendingScrollResolve;o.pendingScrollResolve=void 0;let a=o.scrollingTo;if(o.scrollHistory.length=0,o.scrollingTo=void 0,o.scrollTargetPinnedRange=void 0,o.pendingTotalSize!==void 0&&Mu(e,null,o.pendingTotalSize),o.scrollAdjustHandler.commitPendingAdjust(a),a.isInitialScroll||o.initialScroll){let i=((t=o.initialScrollSession)==null?void 0:t.kind)==="offset",s=!!a.isInitialScroll&&!o.clearPreservedInitialScrollOnNextFinish&&o.props.data.length>0&&((n=o.initialScroll)==null?void 0:n.viewPosition)===1;yd(e,{onFinished:()=>{r?.()},preserveTarget:i&&o.props.data.length===0||s,recalculateItems:!0,schedulePreservedTargetClear:s,syncObservedOffset:i,waitForCompletionFrame:!!a.waitForInitialScrollCompletionFrame});return}WN(e),r?.()}}var V4=80,q4=1500,W4=320,G4=1;function j4(e,t){var n,o;let r=e.state,{animated:a,horizontal:i,offset:s}=t;r.scheduledWork.cancel("platformScrollCompletion");let l=r.refScroller.current,d=l?.getScrollableNode();if(!l||!d)return;let c=!!a,f=!!i,p=f?uo(e):void 0,m=f?FC(r,s,p):0,g=f?0:s;if(l.scrollTo({animated:c,x:m,y:g}),c){let h=(o=(n=l.getScrollEventTarget)==null?void 0:n.call(l))!=null?o:null;Q4(e,{readOffset:()=>l.getCurrentScrollOffset(),target:h,targetOffset:s})}else{r.scroll=s;let h=r.scrollingTo;r.scheduledWork.timeout(()=>{h===r.scrollingTo&&Fu(e)},100,"platformScrollCompletion")}}function Q4(e,t){let{readOffset:n,target:o,targetOffset:r}=t;if(!o){Fu(e);return}let a="onscrollend"in o,i,s=!1,{scheduledWork:l,scrollingTo:d}=e.state,c=setTimeout(()=>m("max"),q4),f=()=>{o.removeEventListener("scroll",g),a&&o.removeEventListener("scrollend",h),i!==void 0&&clearTimeout(i),clearTimeout(c)},p=()=>{s||(s=!0,f())},m=v=>{if(s)return;if(d!==e.state.scrollingTo){l.cancel("platformScrollCompletion");return}let y=n(),x=Math.abs(y-r)<=G4;v==="scrollend"&&!x||(l.cancel("platformScrollCompletion"),Fu(e))},g=()=>{i!==void 0&&clearTimeout(i),i=setTimeout(()=>m("idle"),V4)},h=()=>m("scrollend");o.addEventListener("scroll",g),a?o.addEventListener("scrollend",h):i=setTimeout(()=>m("idle"),W4),l.register("platformScrollCompletion",p)}function xd(e){let t=e.state,{didContainersLayout:n,pendingNativeMVCPAdjust:o,refScroller:r,props:{maintainScrollAtEnd:a}}=t,s=!!(be(e,"isWithinMaintainScrollAtEndThreshold")&&a&&n);if(o)return t.pendingMaintainScrollAtEnd=s,!1;if(s){if(t.pendingMaintainScrollAtEnd=!1,uo(e)<t.scrollLength&&(t.scroll=0),t.maintainingScrollAtEnd)t.pendingMaintainScrollAtEnd=!0;else{let d=a.animated?"pending-animated":"pending-instant",c=a.animated?"animated":"instant",f=t.scroll;t.maintainingScrollAtEnd=d,requestAnimationFrame(()=>{let p=be(e,"isWithinMaintainScrollAtEndThreshold"),m=t.scroll!==f;if(p||!m){t.maintainingScrollAtEnd=c;let g=r.current;if(t.props.horizontal&&Ga(t)){let h=uo(e),v=d4(t,h),y=FC(t,v,h);g?.scrollTo({animated:a.animated,x:y,y:0})}else g?.scrollToEnd({animated:a.animated});setTimeout(()=>{t.maintainingScrollAtEnd===c&&(t.maintainingScrollAtEnd=void 0,t.pendingMaintainScrollAtEnd&&xd(e))},a.animated?500:0)}else t.maintainingScrollAtEnd===d&&(t.maintainingScrollAtEnd=void 0,t.pendingMaintainScrollAtEnd=!1)})}return!0}return t.pendingMaintainScrollAtEnd=!1,!1}function Ys(e,t,n){let o=e.state;if(Math.abs(t)>.1){let r=()=>{o.scrollAdjustHandler.requestAdjust(t),o.adjustingFromInitialMount&&o.adjustingFromInitialMount--};o.scroll+=t,o.scrollForNextCalculateItemsInView=void 0,be(e,"readyToRender")?r():(o.adjustingFromInitialMount=(o.adjustingFromInitialMount||0)+1,requestAnimationFrame(r))}}var To=.1,X4=300,Y4=2,J4=1;function Z4(e,t,n,o){if(!t){e.mvcpAnchorLock=void 0;return}let r=e.mvcpAnchorLock;if(!r)return;let a=o>r.expiresAt,i=e.indexByKey.get(r.id)===void 0;if(a||i||!n){e.mvcpAnchorLock=void 0;return}return r}function eW(e,t){{let{anchorId:n,anchorPosition:o,dataChanged:r,now:a,positionDiff:i}=t,s=!!r||!!e.mvcpAnchorLock,l=e.props.maintainVisibleContentPosition.data;if(!s||!l||e.scrollingTo||!n||o===void 0)return;let d=e.mvcpAnchorLock,c=!r&&Math.abs(i)<=To&&d?.id===n?d.quietPasses+1:0;if(!r&&c>=Y4){e.mvcpAnchorLock=void 0;return}e.mvcpAnchorLock={expiresAt:a+X4,id:n,position:o,quietPasses:c}}}function tW(e,t,n,o,r,a){return!1}function nW(e,t,n){if(Math.abs(t)<=To)return 0;let r=Math.max(0,n-e.scrollLength)-e.scroll;return t<0?Math.max(t,Math.min(0,r)):t>0?Math.min(t,Math.max(0,r)):0}function oW(e,t){return e<0?-t:t}function vC(e,t,n){let o=e.state;o.pendingNativeMVCPAdjust=void 0;let r=t-n;Math.abs(r)>To&&Ys(e,r)}function rW(e){let t=e.state,n=t.pendingNativeMVCPAdjust;if(!n||Math.abs(n.manualApplied)>To)return;let o=uo(e),r=nW(t,n.amount,o);if(Math.abs(r)<=To)return;let a=n.amount-r;Math.abs(a)<=To||(n.manualApplied=a,Ys(e,a),n.furthestProgressTowardAmount=0)}function aW(e,t){let n=e.state,o=n.pendingNativeMVCPAdjust;if(!o)return!1;let r=o.amount-o.manualApplied,a=t-(o.startScroll+o.manualApplied),i=r<0&&a>To||r>0&&a<-To,s=oW(r,a);if(Math.abs(r)<=To)return n.pendingNativeMVCPAdjust=void 0,!0;if(i)return n.pendingNativeMVCPAdjust=void 0,!1;if(s+To>=Math.abs(r))return vC(e,r,a),!0;let l=Math.max(0,uo(e)-n.scrollLength);return Math.abs(t-l)<=J4||n.pendingMaintainScrollAtEnd&&be(e,"isWithinMaintainScrollAtEndThreshold")&&s>To?(vC(e,r,a),!0):s>o.furthestProgressTowardAmount+To?(o.furthestProgressTowardAmount=s,!1):(o.furthestProgressTowardAmount>To&&s<o.furthestProgressTowardAmount-To&&(n.pendingNativeMVCPAdjust=void 0),!1)}function iW(e,t){let n=e.state,{idsInView:o,positions:r,props:a}=n,{maintainVisibleContentPosition:{data:i,size:s,shouldRestorePosition:l}}=a,d=Date.now(),c=!!t||!!n.mvcpAnchorLock,f=n.scrollingTo;if(t&&n.pendingScrollToEnd&&f===void 0){n.mvcpAnchorLock=void 0;return}let p=Z4(n,c,i,d),m,g,h=[],v=f?.index,y=f?.viewPosition,x=v!==void 0&&n.props.data.length>0&&v>=n.props.data.length-1&&(y??0)>0,C=t?i:s,w=n.indexByKey,L=n.scroll;if(uo(e),C){if(p&&v===void 0?(g=p.id,m=p.position):v!==void 0?g=jt(n,v):o.length>0&&n.didContainersLayout&&!t&&(g=o.find(S=>w.get(S)!==void 0)),t&&o.length>0&&n.didContainersLayout)for(let S=0;S<o.length;S++){let k=o[S],I=w.get(k);if(I!==void 0){let T=r[I];T!==void 0&&h.push({id:k,position:T})}}if(g!==void 0&&m===void 0){let S=w.get(g);S!==void 0&&(m=r[S])}return()=>{let S=0,k=p?.id,I,T=!1,A=n.props.data;if(t&&i&&v===void 0&&g!==void 0&&p?.id===g&&l!==void 0&&g!==void 0){let E=w.get(g);if(E!==void 0){let F=A[E];T=F===void 0||!l(F,E,A),T&&p?.id===g&&(n.mvcpAnchorLock=void 0)}}if(t&&i&&v===void 0&&(()=>{if(g===void 0||T)return!0;let E=w.get(g);return E===void 0||r[E]===void 0})())for(let E=0;E<h.length;E++){let{id:F,position:B}=h[E],V=w.get(F);if(V!==void 0&&l){let Se=A[V];if(Se===void 0||!l(Se,V,A))continue}let Q=V!==void 0?r[V]:void 0;if(Q!==void 0){S=Q-B,k=F,I=Q;break}}if(!T&&g!==void 0&&m!==void 0){let E=w.get(g),F=E!==void 0?r[E]:void 0;if(F!==void 0){let B=uo(e),V=F-m;if(V!==0&&x&&n.scroll+n.scrollLength>B)if(V>0)V=Math.max(0,B-n.scroll-n.scrollLength);else{let Q=Math.max(0,B-n.scrollLength);n.scroll=Q,n.scrollPending=Q,V=0}S=V,k=g,I=F}}if(y&&y>0){let E=fo(e,g,v,n.props.data[v]),F=f?.itemSize;if(E!==void 0&&F!==void 0&&E!==F){let B=E-F;B!==0&&(S+=B*y,f.itemSize=E)}}if(eW(n,{anchorId:k,anchorPosition:I,dataChanged:t,now:d,positionDiff:S}),tW()){n.pendingNativeMVCPAdjust={amount:S,furthestProgressTowardAmount:0,manualApplied:0,startScroll:L},rW(e);return}Math.abs(S)>To&&((n.maintainingScrollAtEnd==="pending-animated"||n.maintainingScrollAtEnd==="animated")&&be(e,"isWithinMaintainScrollAtEndThreshold")||Ys(e,S))}}}var cN=1e3,sW=200,Fg=e=>{let{scrollHistory:t}=e,n=t.length-1;if(n<1)return 0;let o=t[n];if(Date.now()-o.time>cN)return 0;let r=0,a=0,i=0;for(let s=n;s>0;s--){let l=t[s],d=t[s-1],c=l.scroll-d.scroll,f=l.time-d.time,p=Math.sign(c);if(p!==0){if(r===0)r=p;else if(p!==r)break}if(o.time-d.time>cN)break;if(c===0||f<=0)continue;let m=o.time-l.time,g=Math.exp(-m/sW);a+=c/f*g,i+=g}return i>0?a/i:0};function lW(e){let t=e.mvcpAnchorLock;return t?Date.now()>t.expiresAt?(e.mvcpAnchorLock=void 0,!1):!0:!1}function $u(e){return e.dataChangeNeedsScrollUpdate||lW(e)}function Gs(e,t,n,o){var r;let a=e.state,{ignoreScrollFromMVCP:i,lastScrollAdjustForHistory:s,scrollAdjustHandler:l,scrollHistory:d,scrollingTo:c}=a,f=a.scroll;o?.markHasScrolled!==!1&&(a.hasScrolled=!0);let p=Date.now();a.lastBatchingAction=p;let m=l.getAdjust(),g=s!==void 0&&Math.abs(m-s)>.1;if(g&&(d.length=0),a.lastScrollAdjustForHistory=m,c===void 0&&!(d.length===0&&t===a.scroll)&&(g||d.push({scroll:t,time:p})),d.length>5&&d.shift(),i&&!c){let{lt:T,gt:A}=i;if(T&&t<T||A&&t>A){a.ignoreScrollFromMVCPIgnored=!0;return}}a.scrollPrev=f,a.scrollPrevTime=a.scrollTime,a.scroll=t,a.scrollTime=p;let h=Math.abs(t-f),y=!!o?.fromNativeScrollEvent&&h>.1&&!g&&c===void 0&&!a.pendingNativeMVCPAdjust?N4(e,t-f):void 0,x=aW(e,t),C=a.scrollLength,w=C>0&&c===void 0&&h>C&&!a.pendingNativeMVCPAdjust,L=Fg(a);B4(e,L,{forceLight:w});let S=a.scrollLastCalculate;if($u(a)||x||y!==void 0||n||S===void 0||Math.abs(a.scroll-S)>2){a.scrollLastCalculate=a.scroll,a.ignoreScrollFromMVCPIgnored=!1,a.lastScrollDelta=h;let T=()=>{var P;let _={doMVCP:c!==void 0,scrollVelocity:L};w&&(_.drawDistanceMode="visible-first"),(P=a.triggerCalculateItemsInView)==null||P.call(a,_),Ng(e,y)};w?(a.mvcpAnchorLock=void 0,a.pendingNativeMVCPAdjust=void 0,a.userScrollAnchorReset={keys:new Set},a.scheduledWork.cancel("mvcpRecalculate"),(0,_N.flushSync)(T),QN(e)):T();let A=!!a.pendingMaintainScrollAtEnd||!!((r=a.props.maintainScrollAtEnd)!=null&&r.onDataChange);x&&A&&(a.pendingMaintainScrollAtEnd=!1,xd(e)),a.dataChangeNeedsScrollUpdate=!1,a.lastScrollDelta=0}}function dW(e){if(Object.keys(e.averageSizes).length===0)return;let t={};for(let n in e.averageSizes){let o=e.averageSizes[n];t[n]=o.avg}return t}function cW(e,t){var n;let{isInitialScroll:o,requestedOffset:r,targetOffset:a}=t,i=oo.get(e),s=!e.didFinishInitialScroll&&(o||!!i)&&oo.hasNonZeroTargetOffset(a),l=!e.didFinishInitialScroll&&!!i&&oo.isAtZeroTargetOffset(r);if(s){e.hasScrolled=!1,oo.set(e,{startScroll:(n=i?.startScroll)!=null?n:e.scroll,targetOffset:a});return}l&&oo.clear(e)}function uW(e,t){let n=e.state,o=n.props.data.length,r=0,a=o-1,i;for(;r<=a;){let s=Math.floor((r+a)/2),l=n.positions[s];l===void 0?a=s-1:l<=t?(i=s,r=s+1):a=s-1}return i}function uN(e,t){var n;let o=e.state.positions[t];if(o===void 0)return;let r=(n=KC(e,t))!=null?n:0;return o+(Number.isFinite(r)?r:0)}function fW(e,t,n){let o=e.state,r=o.props.data.length;if(r===0)return;let a=Math.max(0,t),i=Math.max(a,t+o.scrollLength),s=n!==void 0?Math.max(0,Math.min(r-1,n)):uW(e,a);if(s===void 0)return;if(n!==void 0&&o.positions[s]===void 0)return{end:s,start:s};if(n===void 0){let d=uN(e,s);if(d===void 0||d<=a)return}for(;s>0;){let d=o.positions[s];if(d===void 0||d<=a||o.positions[s-1]===void 0)break;s--}for(;s>0;){let d=uN(e,s-1);if(d===void 0||d<=a)break;s--}let l=s;for(;l+1<r;){let d=o.positions[l+1];if(d===void 0||d>i)break;l++}return{end:l,start:s}}function pW(e,t,n){let o=fW(e,t,n);o?(e.state.scrollTargetPinnedRange=o,e.state.scrollForNextCalculateItemsInView=void 0):e.state.scrollTargetPinnedRange=void 0}function Bg(e,t){var n,o;let r=e.state,{noScrollingTo:a,forceScroll:i,...s}=t,{animated:l,isInitialScroll:d,offset:c,precomputedWithViewOffset:f,waitForInitialScrollCompletionFrame:p}=s,{props:{horizontal:m}}=r;Rg(r);let g=f?c:Og(e,c,s),h=!!d&&((n=r.initialScrollSession)==null?void 0:n.kind)==="offset",v=Fi(e,g,s),y=h?g:v;if(r.scrollHistory.length=0,!a){d&&Mg.resetFlags(r);let x=dW(r);r.scrollingTo={...s,...x?{averageSizeSnapshot:x}:{},targetOffset:v,waitForInitialScrollCompletionFrame:p},d||pW(e,v,s.index)}r.scrollPending=v,cW(r,{isInitialScroll:d,requestedOffset:y,targetOffset:v}),!d&&!a&&Math.abs(r.scroll-v)>1&&(l?r.scrollTargetPinnedRange&&((o=r.triggerCalculateItemsInView)==null||o.call(r)):Gs(e,v,!0,{markHasScrolled:!1})),i||!d||qa.OS==="android"?j4(e,{animated:l,horizontal:m,offset:y}):r.scroll=y}function e_(e,t){return t<=0?-1:e>=t?t-1:e<0?0:e}function bg(e,{index:t,viewOffset:n=0,animated:o=!0,forceScroll:r,isInitialScroll:a,viewPosition:i}){let s=e.state,{data:l}=s.props;t=e_(t,l.length);let d=KC(e,t),c=_g(e,t);t===l.length-1&&i===void 0&&(i=1),s.scrollForNextCalculateItemsInView=void 0,Bg(e,{animated:o,forceScroll:r,index:t,isInitialScroll:a,itemSize:d,offset:c,viewOffset:n,viewPosition:i??0})}function zg(e,t){let{forceScroll:n,resolvedOffset:o,target:r,waitForCompletionFrame:a}=t,i=r.index,s=i!==void 0?e_(i,e.state.props.data.length):void 0,l=KC(e,s);Bg(e,{animated:!1,forceScroll:n,index:s!==void 0&&s>=0?s:void 0,isInitialScroll:!0,itemSize:l,offset:o,precomputedWithViewOffset:!0,viewOffset:r.viewOffset,viewPosition:r.viewPosition,waitForInitialScrollCompletionFrame:a})}function js(e,t,n){var o;let{state:r}=e;r.clearPreservedInitialScrollOnNextFinish=void 0,r.scheduledWork.cancel("preservedInitialScroll"),r.initialScroll=t,n?.resetDidFinish&&HC(e,{resetInitialScroll:!0}),Wa(r,{kind:((o=r.initialScrollSession)==null?void 0:o.kind)==="offset"?"offset":"bootstrap"})}function $r(e,t){var n,o;if(((n=e.state.initialScrollSession)==null?void 0:n.kind)==="offset")return(o=t.contentOffset)!=null?o:0;let a=t.index!==void 0?_g(e,t.index):0,i=Og(e,a,t);return Fi(e,i,t)}function t_(e,t){let{didFinishInitialScroll:n,queuedInitialLayout:o,scrollingTo:r}=e,a=e.initialScroll,i=!!r?.isInitialScroll,s=!!t?.requiresMeasuredLayout&&!o&&!i;if(!(!a||s||n||r&&!i))return{initialScroll:a,isInitialScrollInProgress:i,queuedInitialLayout:o,scrollingTo:r}}function mW(e,t){var n,o,r;let a=e.state,i=t_(a,{requiresMeasuredLayout:!0});if(!i)return!1;let{initialScroll:s,isInitialScrollInProgress:l,queuedInitialLayout:d}=i,c=l?i.scrollingTo:void 0,f=$r(e,s),p=c?(n=c.targetOffset)!=null?n:c.offset:void 0,m=s.contentOffset===void 0||Math.abs(s.contentOffset-f)>1,g=p!==void 0&&Math.abs(p-f)>1,h=p!==void 0&&Math.abs(a.scroll-f)<=1&&Math.abs(a.scrollPending-f)<=1;if(!t?.forceScroll&&!m&&l&&!g||t?.forceScroll&&h)return!1;m&&((o=a.initialScrollSession)==null?void 0:o.kind)!=="offset"&&js(e,{...s,contentOffset:f});let v=(r=t?.forceScroll)!=null?r:!!d||l&&m;return zg(e,{forceScroll:v,resolvedOffset:f,target:s}),!0}function gW(e,t){var n,o;let r=e.state,a=t_(r);if(!a)return!1;let{initialScroll:i,queuedInitialLayout:s}=a,l=(n=i.contentOffset)!=null?n:0,d=Math.abs(r.scroll-l)<=1&&Math.abs(r.scrollPending-l)<=1;if(t?.forceScroll&&d)return!1;let c=!!r.lastLayout&&r.scrollLength>0,f=(o=t?.forceScroll)!=null?o:c||!!s;return zg(e,{forceScroll:f,resolvedOffset:l,target:i}),!0}function Bu(e,t){var n;return((n=e.state.initialScrollSession)==null?void 0:n.kind)==="offset"?gW(e,{forceScroll:t?.forceScroll}):mW(e,{forceScroll:t?.forceScroll})}function _u(e,t,n){if(t==null||n==null||t<0||n<t)return!1;let o=!1;for(let r of e.containerItemKeys.keys()){let a=e.indexByKey.get(r);if(a!==void 0&&a>=t&&a<=n){o=!0;let i=jt(e,a);if(i===void 0||!e.sizesKnown.has(i))return!1}}return o}var Ug=1,hW=8,vW=24,yW="LegendList bootstrap initial scroll aborted after exceeding convergence bounds.";function xr(e){var t;return((t=e.initialScrollSession)==null?void 0:t.kind)==="bootstrap"?e.initialScrollSession.bootstrap:void 0}function Js(e){var t;return((t=e.initialScrollSession)==null?void 0:t.kind)==="offset"}function xW(e,t){if(!e||e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function CW(e){let{dataLength:t,getSize:n,offset:o,positions:r,scrollLength:a,startIndex:i}=e,s=o+a,l=[],d=i!==void 0?Math.max(0,Math.min(t-1,i)):0;for(;d>0;){let c=d-1,f=r[c];if(f===void 0){d=c;continue}let p=n(c);if(p===void 0){d=c;continue}if(f+p<=o)break;d=c}for(;d<t;d++){let c=r[d];if(c===void 0)continue;let f=n(d);if(f!==void 0){if(c<s&&c+f>o)l.push(d);else if(l.length>0&&c>=s)break}}return l}function bW(e){let{mountFrameCount:t,maxFrames:n=hW,maxPasses:o=vW,passCount:r}=e;return t>=n||r>=o}function n_(e,t){return bW(t)?(Jo&&console.warn(yW),_W(e),!0):!1}function zu(e){var t;let n=xr(e),o=n?.frameHandle;o!==void 0&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(o),n&&(n.frameHandle=void 0),Wa(e,{bootstrap:null,kind:(t=e.initialScrollSession)==null?void 0:t.kind})}function o_(e,t){var n,o,r;let a=xr(e);Wa(e,{bootstrap:{frameHandle:a?.frameHandle,mountFrameCount:(n=a?.mountFrameCount)!=null?n:0,passCount:0,previousResolvedOffset:void 0,scroll:t.scroll,seedContentOffset:(r=(o=t.seedContentOffset)!=null?o:a?.seedContentOffset)!=null?r:t.scroll,targetIndexSeed:t.targetIndexSeed,visibleIndices:void 0},kind:"bootstrap"})}function wW(e,t){var n,o,r;let a=xr(e);a?(a.passCount=0,a.previousResolvedOffset=void 0,a.scroll=(n=t?.scroll)!=null?n:a.scroll,a.seedContentOffset=(o=t?.seedContentOffset)!=null?o:a.seedContentOffset,a.targetIndexSeed=(r=t?.targetIndexSeed)!=null?r:a.targetIndexSeed,a.visibleIndices=void 0,Wa(e,{bootstrap:a,kind:"bootstrap"})):t?.scroll!==void 0&&o_(e,{scroll:t.scroll,seedContentOffset:t.seedContentOffset,targetIndexSeed:t.targetIndexSeed})}function kC(e){requestAnimationFrame(()=>{var t;xr(e)&&((t=e.triggerCalculateItemsInView)==null||t.call(e,{forceFullItemPositions:!0}))})}function VC(e){let t=e.state,n=xr(t);if(!n||n.frameHandle!==void 0)return;let o=()=>{let r=xr(t);r&&(r.frameHandle=void 0,r.mountFrameCount+=1,!n_(e,{mountFrameCount:r.mountFrameCount,passCount:r.passCount})&&VC(e))};n.frameHandle=requestAnimationFrame(o)}function Tg(e,t){wW(e.state,t),VC(e),kC(e.state)}function qC(e){let{dataLength:t,footerSize:n,preserveForFooterLayout:o,stylePaddingEnd:r}=e;return{contentOffset:void 0,index:Math.max(0,t-1),preserveForBottomPadding:!0,preserveForFooterLayout:o,viewOffset:-r-n,viewPosition:1}}function SW(e){return!!e?.preserveForBottomPadding}function Qs(e){return!!e?.preserveForFooterLayout}function r_(e){return!!(e&&e.viewPosition===1&&(SW(e)||Qs(e)))}function IW(e){let{dataLength:t,footerSize:n,initialScrollAtEnd:o,stylePaddingEnd:r,target:a}=e,i=Qs(a);return{...a,contentOffset:void 0,index:o?Math.max(0,t-1):a.index,preserveForBottomPadding:!0,preserveForFooterLayout:i,viewOffset:-r-(i?n:0),viewPosition:1}}function TW(e,t){return e.index===t.index&&e.preserveForBottomPadding===t.preserveForBottomPadding&&e.preserveForFooterLayout===t.preserveForFooterLayout&&e.viewOffset===t.viewOffset&&e.viewPosition===t.viewPosition}function kg(e,t){let{dataLength:n,stylePaddingEnd:o,target:r}=t;if(!Qs(r))return;let a=qC({dataLength:n,footerSize:0,preserveForFooterLayout:void 0,stylePaddingEnd:o});js(e,a)}function kW(e){vd(e)}function WC(e,t,n=Ug){let o=e.state;if(!o.didFinishInitialScroll)return!1;let r=Uu(o);return Math.abs(r-$r(e,t))>n}function Uu(e){var t,n,o,r;let a=(n=(t=e.refScroller.current)==null?void 0:t.getCurrentScrollOffset)==null?void 0:n.call(t);return typeof a=="number"&&Number.isFinite(a)?a:(r=(o=e.scrollPending)!=null?o:e.scroll)!=null?r:0}function a_(e){var t;let n=e.state,o=n.initialScroll;if(!n.didFinishInitialScroll||(t=n.scrollingTo)!=null&&t.isInitialScroll||!o||o.viewPosition!==1||n.props.data.length===0||Js(n))return;let r=typeof n.lastNativeScroll=="number"&&Number.isFinite(n.lastNativeScroll)?n.lastNativeScroll:Uu(n);return $r(e,o)-r}function i_(e){return a_(e)===void 0?!1:(s_(e,{}),!0)}function s_(e,t){let n=e.state;n.preservedEndAnchorCorrection=t,requestAnimationFrame(()=>{var o;let r=n.preservedEndAnchorCorrection;if(r!==t)return;let a=a_(e);if(a===void 0||Math.abs(a)<=Ug){n.preservedEndAnchorCorrection=void 0;return}(!r.lastRequestTime||((o=n.lastNativeScrollTime)!=null?o:0)>r.lastRequestTime)&&(r.lastRequestTime=Date.now(),Ys(e,a)),s_(e,t)})}function LW(e){var t;let n=e.state,o=n.initialScroll;!n.didFinishInitialScroll||(t=n.scrollingTo)!=null&&t.isInitialScroll||o?.viewPosition!==1||n.preservedEndAnchorCorrection||WC(e,o)&&(r_(o)&&be(e,"isAtEnd")||(Qs(o)?kg(e,{dataLength:n.props.data.length,stylePaddingEnd:OC(n.props),target:o}):kW(n)))}function PW(e,t){var n,o,r;let{initialScrollAtEnd:a,target:i}=t,s=e.state,l=$r(e,i),d=l===0&&!a&&(Js(s)?Math.abs((n=i.contentOffset)!=null?n:0)<=1:i.index===0&&((o=i.viewPosition)!=null?o:0)===0&&Math.abs((r=i.viewOffset)!=null?r:0)<=1),c=s.props.data.length===0&&i.index!==void 0;d?(zu(s),yd(e,{resolvedOffset:l})):c?(zu(s),yd(e,{preserveTarget:!0,resolvedOffset:l})):(o_(s,{scroll:l,seedContentOffset:0,targetIndexSeed:i.index}),VC(e))}function AW(e,t){let{dataLength:n,didDataChange:o,initialScrollAtEnd:r,previousDataLength:a,stylePaddingEnd:i}=t,s=e.state,l=s.initialScroll;if(Js(s)||!l)return;let d=!!(s.didFinishInitialScroll&&a===0&&n>0&&l.index!==void 0),c=xr(s);if(!r&&o&&n>0&&s.didFinishInitialScroll&&!c&&!d){vd(s);return}let p=n>0&&(r||r_(l));if(!(!o&&!d&&!p)){if(p){let m=r?qC({dataLength:n,footerSize:be(e,"footerSize")||0,preserveForFooterLayout:Qs(l),stylePaddingEnd:i}):IW({dataLength:n,footerSize:be(e,"footerSize")||0,initialScrollAtEnd:r,stylePaddingEnd:i,target:l});if(!d&&WC(e,l)){kg(e,{dataLength:n,stylePaddingEnd:i,target:l});return}if(!TW(l,m)||c||d||o){js(e,m,{resetDidFinish:d}),Tg(e,{scroll:$r(e,m),seedContentOffset:d&&!c?Uu(s):void 0,targetIndexSeed:m.index});return}}o&&(c||d)&&(js(e,l,{resetDidFinish:d}),Tg(e,{scroll:$r(e,l),seedContentOffset:d&&!c?Uu(s):void 0,targetIndexSeed:l.index}))}}function EW(e,t){let{dataLength:n,footerSize:o,initialScrollAtEnd:r,stylePaddingEnd:a}=t,i=e.state;if(!r)return;let s=i.initialScroll;if(!(Js(i)||n===0||!s||!(xr(i)||Qs(s))))if(WC(e,s))kg(e,{dataLength:n,stylePaddingEnd:a,target:s});else{let d=qC({dataLength:n,footerSize:o,preserveForFooterLayout:Qs(s),stylePaddingEnd:a});if(!(s.index!==d.index||s.viewPosition!==d.viewPosition||s.viewOffset!==d.viewOffset))kg(e,{dataLength:n,stylePaddingEnd:a,target:s});else{let f=!!i.didFinishInitialScroll;js(e,d,{resetDidFinish:f}),Tg(e,{scroll:$r(e,d),targetIndexSeed:d.index})}}}function RW(e){var t,n,o;let r=e.state,a=r.initialScroll,i=xr(r);if(a&&r.props.data.length>0&&!Js(r)&&(i||a.viewPosition===1)){let s=$r(e,a),l=(t=r.scrollingTo)!=null&&t.isInitialScroll?r.scrollingTo:void 0;if(!i&&(l||r.didFinishInitialScroll)){let d=l?(n=l.targetOffset)!=null?n:l.offset:Uu(r),c=s-d;if(Math.abs(c)>Ug){if(r.didFinishInitialScroll)i_(e);else if(l){let f=oo.get(r);l.offset=s,l.targetOffset=s,r.initialScroll={...a,contentOffset:s},r.hasScrolled=!1,oo.set(r,{startScroll:(o=f?.startScroll)!=null?o:r.scroll,targetOffset:s}),Ys(e,c)}}}else Tg(e,{scroll:s,targetIndexSeed:a.index})}}function MW(e){var t,n;let o=e.state,r=xr(o),a=o.initialScroll;if(!r||!a||Js(o)||(t=o.scrollingTo)!=null&&t.isInitialScroll||(r.passCount+=1,n_(e,{mountFrameCount:r.mountFrameCount,passCount:r.passCount})))return;a.index!==void 0&&o.startBuffered>=0&&o.endBuffered>=0&&a.index>=o.startBuffered&&a.index<=o.endBuffered&&(r.targetIndexSeed=void 0);let i=$r(e,a),s=_u(o,o.startBuffered,o.endBuffered),l=Math.abs(r.scroll-i)>1,{data:d}=o.props,c=CW({dataLength:d.length,getSize:h=>{var v,y;let x=(v=o.idCache[h])!=null?v:jt(o,h);return(y=o.sizes.get(x))!=null?y:fo(e,x,h,d[h])},offset:i,positions:o.positions,scrollLength:o.scrollLength,startIndex:(n=r.targetIndexSeed)!=null?n:o.startBuffered>=0?o.startBuffered:void 0}),f=c.length>0&&c.every(h=>{var v;let y=(v=o.idCache[h])!=null?v:jt(o,h);return o.sizesKnown.has(y)}),p=r.previousResolvedOffset,m=r.visibleIndices;if(r.previousResolvedOffset=i,r.visibleIndices=c,l){r.scroll=i,kC(o);return}if(!s||!f)return;if(!(p!==void 0&&Math.abs(p-i)<=Ug&&xW(m,c))){kC(o);return}zu(o),zg(e,{forceScroll:!0,resolvedOffset:i,target:a,waitForCompletionFrame:qa.OS==="web"})}function NW(e,t){var n;let o=e.state;zu(o);let r=!o.clearPreservedInitialScrollOnNextFinish&&o.props.data.length>0&&((n=o.initialScroll)==null?void 0:n.viewPosition)===1;yd(e,{preserveTarget:r,recalculateItems:!0,resolvedOffset:t,schedulePreservedTargetClear:r})}function _W(e){var t,n,o,r;let a=e.state,i=xr(a),s=a.initialScroll;i&&s&&!Js(a)&&a.refScroller.current?(zu(a),zg(e,{forceScroll:!0,resolvedOffset:i.scroll,target:s,waitForCompletionFrame:qa.OS==="web"})):NW(e,(r=(o=(n=(t=xr(a))==null?void 0:t.scroll)!=null?n:a.scrollPending)!=null?o:a.scroll)!=null?r:0)}function l_(e,t,n,o){return{dataChangeEpoch:e.dataChangeEpoch,getFixedItemSize:e.props.getFixedItemSize,getItemType:e.props.getItemType,itemData:n,itemIndex:t,itemType:o}}function DW(e,t,n,o){var r,a;let{getFixedItemSize:i,getItemType:s}=e.props,l=e.containerItemMetadata.get(t),d;if(l?.dataChangeEpoch===e.dataChangeEpoch&&l.getItemType===s&&l.itemData===o&&l.itemIndex===n)d=l;else{let c=s?(r=s(o,n))!=null?r:"":void 0;d=l_(e,n,o,c),e.containerItemMetadata.set(t,d)}return d.getFixedItemSize!==i&&(d.didResolveFixedItemSize=!1,d.fixedItemSize=void 0,d.getFixedItemSize=i),i&&!d.didResolveFixedItemSize&&(d.fixedItemSize=i(o,n,(a=d.itemType)!=null?a:""),d.didResolveFixedItemSize=!0),d}function d_(e){for(let t of e.containerItemMetadata.values())t.didResolveFixedItemSize=!1,t.fixedItemSize=void 0}var OW=20,FW=1,BW=1,yC=16;function GC(e,t){let n=e.state.scrollingTo;t?.onlyIfAligned&&(!n?.isInitialScroll||n.animated||!jC(e,n).isAtResolvedTarget)||e.state.scheduledWork.frame(()=>KW(e),"checkFinishedScrollFrame")}function zW(e,t){let{clampedTargetOffset:n,scrollingTo:o}=t;return!o.isInitialScroll||e.hasScrolled||n<=FW}function UW(e,t){return!!t?.isInitialScroll&&Mg.didDispatchNativeScroll(e)&&!e.hasScrolled}function c_(e){var t;return(t=oo.get(e))==null?void 0:t.targetOffset}function u_(e){let t=c_(e);return!e.didFinishInitialScroll&&oo.hasNonZeroTargetOffset(t)}function fN(e,t){var n,o;if(!t.isInitialScroll||t.animated||!e.didContainersLayout||((n=e.initialScrollSession)==null?void 0:n.kind)==="bootstrap")return!1;let r=(o=t.targetOffset)!=null?o:t.offset;return oo.hasNonZeroTargetOffset(r)&&Mg.didDispatchNativeScroll(e)&&!e.hasScrolled||oo.isAtZeroTargetOffset(r)||Math.abs(e.scroll-r)>1||Math.abs(e.scrollPending-r)>1?!1:!!t.waitForInitialScrollCompletionFrame||u_(e)}function pN(e){var t;let{state:n}=e;return!!((t=n.scrollingTo)!=null&&t.isInitialScroll)&&n.props.data.length>0&&uo(e)<=n.scrollLength&&n.scrollPending<=BW}function HW(e,t){return t.index===e.state.props.data.length-1&&t.viewPosition===1}function $W(e,t){var n;let o=t.index,a=HW(e,t)&&o!==void 0?Og(e,_g(e,o),t):(n=t.targetOffset)!=null?n:Fi(e,t.offset-(t.viewOffset||0),t);return Fi(e,a,t)}function jC(e,t){let{state:n}=e,o=n.scrollPending,r=n.scrollAdjustHandler.getAdjust(),a=$W(e,t),i=Fi(e,o,t),s=Math.abs(o-a),l=a+r,d=Math.abs(o-l),c=!t.animated||qa.OS==="ios";return{clampedTargetOffset:a,isAtResolvedTarget:Math.abs(o-i)<1&&(s<1||c&&d<1)}}function KW(e){let t=e.state.scrollingTo;if(!t)return;let{state:n}=e,o=jC(e,t);o.isAtResolvedTarget&&zW(n,{clampedTargetOffset:o.clampedTargetOffset,scrollingTo:t})&&Fu(e)}function VW(e,t){var n;(n=e.state.refScroller.current)==null||n.scrollTo({animated:!1,x:e.state.props.horizontal?t:0,y:e.state.props.horizontal?0:t})}function qW(e){let t=e.state;if(t.scheduledWork.has("checkFinishedScrollFallback"))return;let n=t.scrollingTo,o=pN(e),r=UW(t,n),a=n!==void 0?fN(t,n):!1,i=n?.isInitialScroll&&!o&&!a||!t.didContainersLayout,s=o||a?0:r?yC:i?500:100,l=0,d=f=>{t.scheduledWork.timeout(c,f,"checkFinishedScrollFallback")},c=()=>{var f,p;let m=t.scrollingTo;if(m){l++;let g=u_(t)&&!t.hasScrolled,h=r?5:g?OW:5,v=pN(e),y=fN(t,m),x=jC(e,m),C=qa.OS==="android",w=t.hasScrolled&&(!m.isInitialScroll||x.isAtResolvedTarget),L=m.isInitialScroll&&!x.isAtResolvedTarget&&l<=h;if(v||w||y||C||l>h)Fu(e);else if((g||L)&&l<=h){let S=(p=(f=c_(t))!=null?f:m.targetOffset)!=null?p:t.scrollPending;VW(e,S),d(r?yC:100)}else d(r?yC:100)}};d(s)}function f_(e){var t;let n=e.state,o=n.initialScroll;return n.didFinishInitialScroll?i_(e):!o||((t=n.initialScrollSession)==null?void 0:t.kind)==="offset"||o.viewPosition!==1||n.props.data.length===0?!1:Bu(e,{forceScroll:!0})}function WW(e){var t;if(!e.state.initialScroll)return;let n=()=>Bu(e,{forceScroll:!0});n(),((t=e.state.initialScrollSession)==null?void 0:t.kind)!=="offset"&&requestAnimationFrame(n),GC(e,{onlyIfAligned:!0})}function GW(e,t){var n,o;let{alwaysDispatchInitialScroll:r,dataLength:a,hasFooterComponent:i,initialContentOffset:s,initialScrollAtEnd:l,useBootstrapInitialScroll:d}=t,c=e.state,f=c.initialScroll,p=s??0,m=d&&l&&i;if(f&&(f.contentOffset===void 0||!!f.preserveForFooterLayout!==m&&((n=c.initialScrollSession)==null?void 0:n.kind)!=="offset")&&js(e,{...f,contentOffset:p,preserveForFooterLayout:m}),d&&f&&((o=c.initialScrollSession)==null?void 0:o.kind)!=="offset"){PW(e,{initialScrollAtEnd:l,target:c.initialScroll});return}!r&&!p&&!(f&&a===0&&!(p===0&&!l))&&(f&&!l?yd(e,{resolvedOffset:p}):$C(e,{didInitialScroll:!0}))}function jW(e,t){var n,o,r;let{dataLength:a,didDataChange:i,didStartFreshData:s,initialScrollAtEnd:l,latestInitialScroll:d,latestInitialScrollSessionKind:c,stylePaddingEnd:f,useBootstrapInitialScroll:p}=t,m=e.state,g=(o=(n=m.initialScrollSession)==null?void 0:n.previousDataLength)!=null?o:0,h=a>0&&(!m.hasHadNonEmptyData||s);if(a>0&&(m.hasHadNonEmptyData=!0),h&&(d?(js(e,d),Wa(m,{kind:c,previousDataLength:g})):vd(m)),m.initialScrollSession&&(m.initialScrollSession.previousDataLength=a),Wa(m),p){AW(e,{dataLength:a,didDataChange:i,initialScrollAtEnd:l,previousDataLength:g,stylePaddingEnd:f});return}let v=g===0&&a>0&&!!m.initialScroll&&((r=e.state.initialScrollSession)==null?void 0:r.kind)==="offset"&&!!m.didFinishInitialScroll;g!==0||a===0||!m.initialScroll||!m.queuedInitialLayout||m.didFinishInitialScroll&&!v||(v&&HC(e,{resetInitialScroll:!0}),Bu(e))}function p_(e){e.indexByKey.clear(),e.idCache.length=0,e.positions.length=0,e.columns.length=0,e.columnSpans.length=0}function QW(e){var t;let n=e.pendingContainerIds;if(e.pendingContainerIds=void 0,n===void 0)return;let o=e.state,r=n;if(r&&((t=o.userScrollAnchorReset)!=null&&t.keys.size)){r=new Set(r);for(let a of o.userScrollAnchorReset.keys){let i=o.containerItemKeys.get(a);i!==void 0&&r.add(i)}}return r}function Lg(e,t){var n;let o=e.pendingContainerIds!==void 0,r=e.pendingContainerIds;if(t===void 0)e.pendingContainerIds=null;else if(r!==null){let a=r;if(!a)a=typeof t=="number"?new Set([t]):new Set(t);else if(typeof t=="number")a.add(t);else for(let i of t)a.add(i);e.pendingContainerIds=a}if(!o){let a=((n=be(e,"containerLayoutEpoch"))!=null?n:0)+1;Be(e,"containerLayoutEpoch",a)}}function XW(e,t,n,o){var r,a,i,s,l,d,c,f,p;let m=e.state,{columns:g,columnSpans:h,positions:v,props:{data:y,itemsAreEqual:x,keyExtractor:C}}=m,w=y[n];if(w===void 0)return{didChangePosition:!1,didRefreshData:!1};let L=(r=m.idCache[n])!=null?r:jt(m,n),S=(a=o?.updateLayout)!=null?a:!0,k=!1,I=!1;if(S){let _=v[n];if(_===void 0)return Be(e,`containerPosition${t}`,hd),{didChangePosition:!1,didRefreshData:!1};let E=(_||0)-((i=o?.scrollAdjustPending)!=null?i:0),F=(s=m.sizes.get(L))!=null?s:fo(e,L,n,w),B=c4(m,E,F,be(e,"totalSize")),V=g[n]||1,Q=h[n]||1,Se=be(e,`containerPosition${t}`),H=be(e,`containerColumn${t}`),q=be(e,`containerSpan${t}`);B>hd&&B!==Se&&(Be(e,`containerPosition${t}`,B),k=!0),V>=0&&V!==H&&Be(e,`containerColumn${t}`,V),Q!==q&&Be(e,`containerSpan${t}`,Q)}be(e,`containerItemIndex${t}`)!==n&&Be(e,`containerItemIndex${t}`,n);let A=be(e,`containerItemData${t}`),P=()=>{Be(e,`containerItemData${t}`,w),I=!0};if(A!==w){let _=((l=m.pendingDataComparison)==null?void 0:l.previousData)===m.previousData&&((d=m.pendingDataComparison)==null?void 0:d.nextData)===y?m.pendingDataComparison:void 0,E=(c=_?.byIndex[n])!=null?c:0;if(E===2)P();else if(E!==1){let F=(f=be(e,`containerItemKey${t}`))!=null?f:L,B=C?.(A,n);if(A===void 0||!C||B!==F)P();else if(!x)P();else{let V=x(A,w,n,y);(!m.pendingDataComparison||m.pendingDataComparison.previousData!==m.previousData||m.pendingDataComparison.nextData!==y)&&m.previousData&&(m.pendingDataComparison={byIndex:[],nextData:y,previousData:m.previousData}),(p=m.pendingDataComparison)!=null&&p.byIndex&&(m.pendingDataComparison.byIndex[n]=V?1:2),V||P()}}}return{didChangePosition:k,didRefreshData:I}}function YW(e,t,n){var o;let r=e.state,a=be(e,"numColumns"),i=t;r.columns[t]!==1&&(i=mN(r,a,t));let l=0,d=r.columns[i];if(i>0){let c=i-1,f=(o=r.positions[c])!=null?o:0,p=mN(r,a,c),m=JW(e,p,c,n);l=f+m}return{column:d,currentRowTop:l,startIndex:i}}function mN(e,t,n){if(t<=1)return Math.max(0,n);let o=Math.max(0,n);for(;o>0&&e.columns[o]!==1;)o--;return o}function JW(e,t,n,o){let r=e.state;if(n<t)return 0;let{data:a}=r.props;if(!a)return 0;let i=0;for(let s=t;s<=n;s++){if(s<0||s>=a.length)continue;let l=r.idCache[s],d=fo(e,l,s,a[s],o);d>i&&(i=d)}return i}function ZW(e){var t,n;let o=e.state,{positions:r,props:{data:a}}=o,i=(t=be(e,"numColumns"))!=null?t:1;if(a.length===0)Mu(e,null,0);else{let s=a.length-1,l=jt(o,s),d=r[s];if(l!==void 0&&d!==void 0)if(i>1){let c=s;for(;c>0;){let p=o.columns[c];if(p===1||p===void 0)break;c-=1}let f=0;for(let p=c;p<=s;p++){let m=(n=o.idCache[p])!=null?n:jt(o,p),g=fo(e,m,p,a[p]);g>f&&(f=g)}Mu(e,null,d+f)}else{let c=fo(e,l,s,a[s]);if(c!==void 0){let f=d+c;Mu(e,null,f)}}}}function m_(e){let t=e.state,{props:{snapToIndices:n}}=t,o=t.props.horizontal?uo(e):void 0,r=Array(n.length);for(let a=0;a<n.length;a++){let i=n[a];jt(t,i);let s=t.positions[i];r[a]=FC(t,s,o)}Be(e,"snapToOffsets",r)}function g_(e,t,{doMVCP:n,forceFullUpdate:o=!1,optimizeForVisibleWindow:r=!1,scrollBottomBuffered:a,scrollVelocity:i,startIndex:s}={doMVCP:!1,forceFullUpdate:!1,optimizeForVisibleWindow:!1,scrollBottomBuffered:-1,startIndex:0}){var l,d,c,f,p;let m=e.state,g=e.positionListeners.size>0,{columns:h,columnSpans:v,indexByKey:y,positions:x,idCache:C,sizesKnown:w,props:{data:L,overrideItemLayout:S,snapToIndices:k},scrollingTo:I}=m,T=L.length,A=(l=be(e,"numColumns"))!=null?l:1,P=A>1,_=Jo?new Map:void 0,E=be(e,"extraData"),F=S?{span:1}:void 0,B=m.lastScrollDelta,V=i??Fg(m),Q=!o&&!t&&(r||Math.abs(V)>0||m.scrollLength>0&&B>m.scrollLength),Se=a+1e3,H=!0,q=!n||t||m.scrollAdjustHandler.getAdjust()!==0||((d=be(e,"scrollAdjustPending"))!=null?d:0)!==0,ee=!1,G=0,te=1,me=0;if(t&&(v.length=0),P||(h.length&&(h.length=0),v.length&&(v.length=0)),s>0){if(P){let{startIndex:ie,currentRowTop:Ae}=YW(e,s,H);s=ie,G=Ae}else if(s<T){let ie=s-1,Ae=jt(m,ie),Xe=(c=x[ie])!=null?c:0,nt=(f=w.get(Ae))!=null?f:fo(e,Ae,ie,L[ie],H,q,ee);G=Xe+nt}}let U=t||y.size===0,Y=P&&!!S&&!!F,se=!1,ge;for(let ie=s;ie<T;ie++){if(Q&&ge!==void 0&&ie>ge){se=!0;break}Q&&ge===void 0&&!I&&!t&&G>Se&&(ge=ie+(P?A:1)+10);let Ae=(p=C[ie])!=null?p:jt(m,ie),Xe=1;if(Y){F.span=1,S(F,L[ie],ie,A,E);let Ve=F.span;Ve!==void 0&&Number.isFinite(Ve)&&(Xe=Math.max(1,Math.min(A,Math.round(Ve))))}P&&te+Xe-1>A&&(G+=me,te=1,me=0);let nt=w.get(Ae),rt=nt!==void 0?nt:fo(e,Ae,ie,L[ie],H,q,ee);Jo&&U&&(_.has(Ae)&&console.error(`[legend-list] Error: Detected overlapping key (${Ae}) which causes missing items and gaps and other terrrible things. Check that keyExtractor returns unique values.`),_.set(Ae,ie)),G!==x[ie]&&(x[ie]=G,g&&y4(e,Ae,G)),U&&y.set(Ae,ie),P?(h[ie]=te,v[ie]=Xe,rt>me&&(me=rt),te+=Xe,te>A&&(G+=me,te=1,me=0)):G+=rt}se||ZW(e),k&&m_(e)}function h_(e,t){let n=e.mapViewabilityConfigStates;n||(n=new Map,e.mapViewabilityConfigStates=n);let o=n.get(t);return o||(o={end:-1,endBuffered:-1,previousEnd:-1,previousStart:-1,start:-1,startBuffered:-1,viewableItems:[]},n.set(t,o)),o}function eG(e){let{viewabilityConfig:t,viewabilityConfigCallbackPairs:n,onViewableItemsChanged:o}=e;return(t||o)&&(n=[...n||[],{onViewableItemsChanged:o,viewabilityConfig:t||{viewAreaCoveragePercentThreshold:0}}]),n}function v_(e,t,n,o,r,a,i=r,s=a){let{props:{data:l}}=e;for(let d of n){let c=h_(t,d.viewabilityConfig.id);c.start=r,c.end=a,c.startBuffered=i,c.endBuffered=s,d.viewabilityConfig.minimumViewTime?e.scheduledWork.timeout(()=>gN(l,d,e,t,o),d.viewabilityConfig.minimumViewTime):gN(l,d,e,t,o)}}function gN(e,t,n,o,r){let{viewabilityConfig:a,onViewableItemsChanged:i}=t,s=a.id,l=h_(o,s),{viewableItems:d,start:c,end:f,startBuffered:p,endBuffered:m}=l,g;for(let[x,C]of o.mapViewabilityAmountValues)y_(n,o,a,x,C.key,r,C.item,C.index).sizeVisible<0&&(g??(g=[]),g.push(x));let h=[],v=new Set;if(d)for(let x of d){v.add(x.key);let C=n.indexByKey.get(x.key),w=C!==void 0?e[C]:void 0,L=TC(o,x.key),S=!1;C!==void 0&&w!==void 0&&(S=vN(n,o,a,L,x.key,r,w,C)),S||h.push({...x,index:C??x.index,isViewable:!1,item:w??x.item})}let y=[];for(let x=c;x<=f;x++){let C=e[x];if(C){let w=jt(n,x),L=TC(o,w);if(vN(n,o,a,L,w,r,C,x)){let S={containerId:L,index:x,isViewable:!0,item:C,key:w};y.push(S),v.has(S.key)||h.push(S)}}}if(Object.assign(l,{previousEnd:f,previousStart:c,viewableItems:y}),h.length>0){l.viewableItems=y;for(let x=0;x<h.length;x++){let C=h[x];tG(o,s,C.containerId,C)}i&&i({changed:h,end:f,endBuffered:m,start:c,startBuffered:p,viewableItems:y})}if(g)for(let x of g){let C=o.mapViewabilityAmountValues.get(x);C&&C.sizeVisible<0&&o.mapViewabilityAmountValues.delete(x)}}function hN(e,t){return!!e&&e.containerId===t.containerId&&e.index===t.index&&e.isViewable===t.isViewable&&e.item===t.item&&e.key===t.key&&e.percentOfScroller===t.percentOfScroller&&e.percentVisible===t.percentVisible&&e.scrollSize===t.scrollSize&&e.size===t.size&&e.sizeVisible===t.sizeVisible}function y_(e,t,n,o,r,a,i,s){let{sizes:l,scroll:d}=e,c=(be(t,"stylePaddingTop")||0)+(be(t,"alignItemsAtEndPadding")||0)+(be(t,"headerSize")||0),{itemVisiblePercentThreshold:f,viewAreaCoveragePercentThreshold:p}=n,m=p!=null,g=m?p:f,h=d-c,v=e.positions[s],y=l.get(r)||0;if(v===void 0){let _={containerId:o,index:s,isViewable:!1,item:i,key:r,percentOfScroller:0,percentVisible:0,scrollSize:a,size:y,sizeVisible:-1},E=t.mapViewabilityAmountValues.get(o);if(!hN(E,_)){t.mapViewabilityAmountValues.set(o,_);let F=t.mapViewabilityAmountCallbacks.get(o);F&&F(_)}return _}let x=v-h,C=x+y,w=x>=0&&C<=a&&C>x,L=w?y:Math.min(C,a)-Math.max(x,0),S=y?w?100:100*(L/y):0,k=y?100*(L/a):0,T=(w?100:m?k:S)>=g,A={containerId:o,index:s,isViewable:T,item:i,key:r,percentOfScroller:k,percentVisible:S,scrollSize:a,size:y,sizeVisible:L},P=t.mapViewabilityAmountValues.get(o);if(!hN(P,A)){t.mapViewabilityAmountValues.set(o,A);let _=t.mapViewabilityAmountCallbacks.get(o);_&&_(A)}return A}function vN(e,t,n,o,r,a,i,s){let l=t.mapViewabilityAmountValues.get(o);return(!l||l.key!==r||l.index!==s)&&(l=y_(e,t,n,o,r,a,i,s)),l.isViewable}function tG(e,t,n,o){let r=n+t;e.mapViewabilityValues.set(r,o);let a=e.mapViewabilityCallbacks.get(r);a?.(o)}var yN=NN.unstable_batchedUpdates,nG=typeof yN=="function"?yN:e=>e(),oG=32,rG=64,aG=3;function iG(e,t){if(e<=0||t<=0)return 0;let n=Math.ceil(t*aG),o=t+rG,r=Math.max(t,Math.min(n,o),Math.min(e,oG)),a=Math.max(e,t);return Math.min(a,r)}function sG(e,t){return e<=0||t<=0?0:Math.min(Math.max(e,t),Math.max(t,Math.ceil(t*1.5)))}function lG(e,t,n,o,r,a,i){var s;let l=t.length;if(l===0)return[];let d=be(e,"numContainers"),c=e.state,{containerItemMetadata:f,stickyContainerPool:p}=c,m=c.props.recycleItems&&!!c.props.positionComponentInternal,g=r.length>0?new Set(r):void 0,h=t.map((A,P)=>({isSticky:c.props.stickyHeaderIndicesSet.has(A),itemIndex:A,itemType:a?.(A),order:P})),v=h.filter(A=>!A.isSticky),y=h.filter(A=>A.isSticky),x=[],C=[];for(let A=0;A<d;A++){let P=be(e,`containerItemKey${A}`),_=!!g?.has(A);if(!(P&&i?.has(P)&&c.indexByKey.has(P))){if(p.has(A))(P===void 0||_)&&C.push({containerIndex:A,distance:Number.POSITIVE_INFINITY});else if(P===void 0||_)x.push({containerIndex:A,distance:Number.POSITIVE_INFINITY});else if(!m){let F=c.indexByKey.get(P);if(F!==void 0&&(F<n||F>o)){let B=F<n?n-F:F-o;x.push({containerIndex:A,distance:B})}}}}x.sort(dG);let w=new Array(l),L=d,S=!1,k=(A,P)=>{w[A.order]={containerIndex:P,itemIndex:A.itemIndex,itemType:A.itemType},g?.delete(P)&&(S=!0)},I=(A,P,_)=>{for(let E of A){if(w[E.order])continue;let F=P.findIndex(B=>{var V;return _((V=f.get(B.containerIndex))==null?void 0:V.itemType,E.itemType)});if(F!==-1){let[B]=P.splice(F,1);k(E,B.containerIndex)}}},T=(A,P,_)=>{a&&I(A,P,(E,F)=>F!==void 0&&E===F),I(A,P,E=>E===void 0),_&&I(A,P,()=>!0)};T(v,x,!0),T(y,C,!1);for(let A of h){if(w[A.order])continue;let P=L++;A.isSticky&&p.add(P),k(A,P)}if(S&&(r.length=0,g))for(let A of g)r.push(A);if(Jo){let A=(s=be(e,"numContainersPooled"))!=null?s:Number.POSITIVE_INFINITY;L>A&&console.warn("[legend-list] No unused container available, so creating one on demand. This can be a minor performance issue and is likely caused by the estimatedItemSize being too large. Consider decreasing estimatedItemSize.",{debugInfo:{numContainers:d,numContainersPooled:A,numNeeded:l,stillNeeded:L-d}})}return w}function dG(e,t){return t.distance-e.distance}function cG(e){let t=e.state;t.queuedInitialLayout=!0,qN(e),$C(e,{didLayout:!0})}var uG=4,fG=100;function pG(e,t){if(t<=0)return 0;let n=Math.min(1,Math.abs(e)/uG);return Math.sign(e)*t*n}function mG(e){let t=e.state;t.scheduledWork.timeout(()=>{var n;t.scrollHistory.length=0,(n=t.triggerCalculateItemsInView)==null||n.call(t)},fG,"renderRangeProjection")}function gG(e,t,n){let o=n.positions;for(let r=e.length-1;r>=0;r--){let a=e[r],i=o[a];if(i!==void 0&&t>=i)return r}return-1}function hG(e,t){let n=e.state,o=!1;for(let r of n.stickyContainerPool){let a=be(e,`containerItemKey${r}`);if((a?n.indexByKey.get(a):void 0)===t){o=!0;break}}return o}function vG(e,t,n,o,r,a,i){var s;let l=e.state;Be(e,"activeStickyIndex",n>=0?t[n]:-1);for(let d=0;d<=1;d++){let c=n-d;if(c<0)continue;let f=t[c];if(hG(e,f))continue;let p=(s=l.idCache[f])!=null?s:jt(l,f);p&&!l.containerItemKeys.has(p)&&(f<a||f>i)&&!r.has(f)&&(r.add(f),o.push(f))}}function yG(e,t,n,o,r,a,i){var s,l;let d=e.state;for(let c of d.stickyContainerPool){let f=be(e,`containerItemKey${c}`),p=f?d.indexByKey.get(f):void 0;if(p===void 0||i(p))continue;let m=t.indexOf(p);if(m===-1){d.stickyContainerPool.delete(c),Be(e,`containerSticky${c}`,!1);continue}if(m>=r-1&&m<=r+1)continue;let h=t[m+1],v=!1;if(h){let y=d.positions[h];v=y!==void 0&&n>y+o*2}else{let y=(s=d.idCache[p])!=null?s:jt(d,p);if(y){let x=d.positions[p],C=(l=d.sizes.get(y))!=null?l:fo(e,y,p,d.props.data[p]);v=x!==void 0&&n>x+C+o*3}}v&&a.push(c)}}function x_(e,t,n,o,r,a){let i=!1;return e.startNoBuffer===null&&n+o>r&&(e.startNoBuffer=t),e.firstFullyOnScreenIndex===void 0&&n>=r-10&&n<=a&&(e.firstFullyOnScreenIndex=t),e.startNoBuffer!==null&&(n<=a?e.endNoBuffer=t:i=!0),i}function C_(e,t){var n,o;let r=[],a=(n=t.firstFullyOnScreenIndex)!=null?n:t.startNoBuffer;if(a!=null&&t.endNoBuffer!==null)for(let i=a;i<=t.endNoBuffer;i++){let s=(o=e.idCache[i])!=null?o:jt(e,i);r.push(s)}return r}function LC(e,t){var n;let o=e.props.onFirstVisibleItemChanged;if(!o||t===null||t<0||t>=e.props.data.length)return;let r=(n=e.idCache[t])!=null?n:jt(e,t),a=e.lastFirstVisibleItemCallback;a?.index===t&&a.key===r||(e.lastFirstVisibleItemCallback={index:t,key:r},o({index:t,item:e.props.data[t],key:r}))}function xG(e,t){var n,o;let r=e.state,{endBuffered:a,idCache:i,positions:s,props:{data:l},sizes:d,startBuffered:c}=r;if(c===null||a===null||c<0||a<c)return null;for(let f=c;f<=a&&f<l.length;f++){let p=(n=i[f])!=null?n:jt(r,f),m=(o=d.get(p))!=null?o:fo(e,p,f,l[f]);if(s[f]+m>t)return f}return null}function CG(e,t,n,o,r){var a,i;let s=e.state,{endBuffered:l,idCache:d,positions:c,props:{data:f},sizes:p,startBuffered:m}=s;if(m===null||l===null||m<0||l<m)return;let g={endNoBuffer:null,firstFullyOnScreenIndex:void 0,startNoBuffer:null};for(let h=m;h<=l&&h<f.length;h++){let v=(a=d[h])!=null?a:jt(s,h),y=(i=p.get(v))!=null?i:fo(e,v,h,f[h]),x=c[h];if(x_(g,h,x,y,o,r))break}Object.assign(s,{endNoBuffer:g.endNoBuffer,firstFullyOnScreenIndex:g.firstFullyOnScreenIndex,idsInView:C_(s,g),startNoBuffer:g.startNoBuffer}),LC(s,g.startNoBuffer),g.startNoBuffer!==null&&g.endNoBuffer!==null&&v_(s,e,t,n,g.startNoBuffer,g.endNoBuffer,m,l)}function Va(e,t={}){let n=e.state;nG(()=>{var o,r,a,i,s,l,d,c,f,p,m,g,h,v,y,x,C,w,L,S,k;let{columns:I,containerItemKeys:T,enableScrollForNextCalculateItemsInView:A,idCache:P,indexByKey:_,minIndexSizeChanged:E,positions:F,props:{alwaysRenderIndicesArr:B,alwaysRenderIndicesSet:V,getItemType:Q,keyExtractor:Se,onStickyHeaderChange:H},scrollForNextCalculateItemsInView:q,scrollLength:ee,sizes:G,startBufferedId:te,viewabilityConfigCallbackPairs:me}=n,{data:U}=n.props,Y=n.props.stickyHeaderIndicesArr||[],se=n.props.stickyHeaderIndicesSet||new Set,ge=jN(e,t.drawDistanceMode),{dataChanged:ie,doMVCP:Ae,forceFullItemPositions:Xe}=t,nt=((o=n.initialScrollSession)==null?void 0:o.kind)==="bootstrap"?n.initialScrollSession.bootstrap:void 0,rt=!!nt,Ve=be(e,"numContainers");if(!U||ee===0||!Ve)return;let ne=uo(e),we,j=be(e,"stylePaddingTop")+be(e,"alignItemsAtEndPadding")+be(e,"headerSize"),X=be(e,"numColumns"),ae=(r=t.scrollVelocity)!=null?r:Fg(n),oe=0,{initialScroll:ft,queuedInitialLayout:pt}=n,yt=rt?(a=nt?.scroll)!=null?a:n.scroll:!pt&&Ru(n)&&ft?$r(e,ft):n.scroll,Pt=0,nn=0,gt=0,Bt=0,Mt=0,St=0,In=yt,ct=ve=>{var et;In=ve,Pt=(et=be(e,"scrollAdjustPending"))!=null?et:0,nn=Pt-j,gt=Math.round(ve+oe+nn),gt+ee>ne&&(gt=Math.max(0,ne-ee))};ct(yt);let ln=be(e,"activeStickyIndex"),ro=()=>{let ve=Y.length>0?gG(Y,gt,n):-1,et=ve>=0?Y[ve]:-1,lt=ln!==et;(ve>=0||ln>=0)&&Be(e,"activeStickyIndex",et);let it=!!H&&Y.length>0&<return{currentStickyIdx:ve,finishCalculateItemsInView:it?()=>{let xn=U[et];xn!==void 0&&H?.({index:et,item:xn})}:void 0}},Vt=ie?void 0:ro(),bn=ge,Tn=ge;ae>0||ae===0&><Math.max(50,ge)?(bn=ge*.5,Tn=ge*1.5):(bn=ge*1.5,Tn=ge*.5);let kn=!ie&&!Xe&&!rt&&!Ru(n)&&!n.scrollingTo&&!n.pendingNativeMVCPAdjust&&!!be(e,"readyToRender")?pG(ae,Math.min(bn,Tn)):0,O=()=>{let ve=Math.max(0,gt),et=Math.max(0,-In);Mt=Math.max(ve,gt+ee+et),Bt=ve-bn+kn,St=Mt+Tn+kn};if(O(),kn!==0&&mG(e),A&&!rt&&!ie&&!Xe&&q){let{top:ve,bottom:et}=q;if(ve===null&&et===null)n.scrollForNextCalculateItemsInView=void 0;else if((ve===null||Bt>ve)&&(et===null||St<et)&&!$u(n)){me?CG(e,me,ee,gt,Mt):n.props.onFirstVisibleItemChanged&&LC(n,xG(e,gt)),(i=Vt?.finishCalculateItemsInView)==null||i.call(Vt);return}}let fe=Ae&&!rt?iW(e,ie):void 0;ie&&p_(n);let ye=Xe||ie?0:(s=E??n.startBuffered)!=null?s:0,Te=!Xe&&!ie&&X>1&&E!==void 0;g_(e,ie,{doMVCP:Ae,forceFullUpdate:!!Xe,optimizeForVisibleWindow:Te,scrollBottomBuffered:St,scrollVelocity:ae,startIndex:ye}),ne=uo(e),E!==void 0&&(n.minIndexSizeChanged=void 0);let Me;if(ie&&Ae&&n.props.maintainVisibleContentPosition.data&&n.didContainersLayout&&n.idsInView.length>0){let ve=n.props.maintainVisibleContentPosition.shouldRestorePosition;Me=new Set;for(let et of n.idsInView){let lt=_.get(et);lt!==void 0&&(ve&&!ve(U[lt],lt,U)||Me.add(et))}}let ht=n.scroll,Ln=(l=be(e,"scrollAdjustPending"))!=null?l:0;fe?.(),fe&&(n.scroll!==ht||((d=be(e,"scrollAdjustPending"))!=null?d:0)!==Ln)&&(ct(n.scroll),O()),ie&&(Vt=ro());let at=null,It=null,Et=null,Tt=(c=rt?nt?.targetIndexSeed:void 0)!=null?c:!ie&&te&&_.get(te)||0;for(let ve=Tt;ve>=0;ve--){let et=(f=P[ve])!=null?f:jt(n,ve),lt=F[ve],it=(p=G.get(et))!=null?p:fo(e,et,ve,U[ve]);if(lt+it>Bt)Tt=ve;else break}if(X>1)for(;Tt>0;){let ve=I[Tt];if(ve===1||ve===void 0)break;Tt-=1}let rn=!1,Yt,xe,_e=0;for(let ve=0;ve<Ve;ve++){let et=be(e,`containerItemKey${ve}`);if(et!==void 0){let lt=_.get(et);_e=Math.max(_e,lt)}}let qe={endNoBuffer:null,firstFullyOnScreenIndex:void 0,startNoBuffer:null},We=U.length;for(let ve=Math.max(0,Tt);ve<We&&(!rn||ve<=_e);ve++){let et=(m=P[ve])!=null?m:jt(n,ve),lt=(g=G.get(et))!=null?g:fo(e,et,ve,U[ve]),it=F[ve];rn||(x_(qe,ve,it,lt,gt,Mt),at===null&&it+lt>Bt&&(at=ve,It=et,Bt<0?Yt=null:Yt=it),qe.startNoBuffer!==null&&(it<=St?(Et=ve,St>ne?xe=null:xe=it+lt):rn=!0))}Object.assign(n,{endBuffered:Et,endNoBuffer:qe.endNoBuffer,firstFullyOnScreenIndex:qe.firstFullyOnScreenIndex,idsInView:C_(n,qe),startBuffered:at,startBufferedId:It,startNoBuffer:qe.startNoBuffer}),A&&Yt!==void 0&&xe!==void 0&&(n.scrollForNextCalculateItemsInView=Nu(Yt)&&Nu(xe)?void 0:{bottom:xe,top:Yt});let ot=Ve,xt=[];if(ie)for(let ve=0;ve<ot;ve++){let et=be(e,`containerItemKey${ve}`);(!Se||et&&_.get(et)===void 0)&&xt.push(ve)}let Ft=n.scrollTargetPinnedRange,Jt=0,ke=-1;Ft&&(Jt=Math.max(0,Math.min(Ft.start,Ft.end)),ke=Math.min(We-1,Math.max(Ft.start,Ft.end)));let zt=Jt<=ke,vt=ve=>V.has(ve)||zt&&ve>=Jt&&ve<=ke;if(at!==null&&Et!==null){let ve=[],et=new Set,lt=it=>{var xn;if(it>=0&&it<We){let pn=(xn=P[it])!=null?xn:jt(n,it),mn=T.get(pn);mn!==void 0?n.stickyContainerPool.add(mn):!Nu(pn)&&!et.has(it)&&(et.add(it),ve.push(it))}};for(let it=at;it<=Et;it++){let xn=(h=P[it])!=null?h:jt(n,it);T.has(xn)||(et.add(it),ve.push(it))}for(let it of B)lt(it);if(zt)for(let it=Jt;it<=ke;it++)lt(it);if(Y.length>0?vG(e,Y,(v=Vt?.currentStickyIdx)!=null?v:-1,ve,et,at,Et):ln!==-1&&Be(e,"activeStickyIndex",-1),ve.length>0){let xn=lG(e,ve,at,Et,xt,Q?pn=>{let mn=Q(U[pn],pn);return mn!==void 0?String(mn):""}:void 0,Me);for(let pn of xn){let mn=pn.itemIndex,Ct=pn.containerIndex,Qt=(y=P[mn])!=null?y:jt(n,mn),qt=be(e,`containerItemKey${Ct}`);qt&&qt!==Qt&&T.delete(qt),qt!==Qt&&(we??(we=new Set),we.add(Ct),n.containerItemGenerations[Ct]=((x=n.containerItemGenerations[Ct])!=null?x:0)+1),Be(e,`containerItemKey${Ct}`,Qt),Be(e,`containerItemIndex${Ct}`,mn),Be(e,`containerItemData${Ct}`,U[mn]),n.containerItemMetadata.set(Ct,l_(n,mn,U[mn],pn.itemType)),T.set(Qt,Ct),(C=n.userScrollAnchorReset)==null||C.keys.add(Qt);let ko=`containerSticky${Ct}`,Do=se.has(mn),va=vt(mn);Do?(Be(e,ko,!0),n.stickyContainerPool.add(Ct)):(be(e,ko)&&Be(e,ko,!1),va?n.stickyContainerPool.add(Ct):n.stickyContainerPool.delete(Ct)),Ct>=ot&&(ot=Ct+1)}ot!==Ve&&(Be(e,"numContainers",ot),ot>be(e,"numContainersPooled")&&Be(e,"numContainersPooled",sG(We,ot)))}((w=n.userScrollAnchorReset)==null?void 0:w.keys.size)===0&&(n.userScrollAnchorReset=void 0)}n.stickyContainerPool.size>0&&yG(e,Y,gt,ge,(L=Vt?.currentStickyIdx)!=null?L:-1,xt,vt);let Ut=xt.length>0?new Set(xt):void 0,Bn=!1;for(let ve=0;ve<ot;ve++){let et=be(e,`containerItemKey${ve}`);if(Ut?.has(ve))et!==void 0&&(T.delete(et),we??(we=new Set),we.add(ve),n.containerItemGenerations[ve]=((S=n.containerItemGenerations[ve])!=null?S:0)+1),n.containerItemMetadata.delete(ve),n.stickyContainerPool.has(ve)&&(Be(e,`containerSticky${ve}`,!1),n.stickyContainerPool.delete(ve)),Be(e,`containerItemKey${ve}`,void 0),Be(e,`containerItemIndex${ve}`,void 0),Be(e,`containerItemData${ve}`,void 0),Be(e,`containerPosition${ve}`,hd),Be(e,`containerColumn${ve}`,-1),Be(e,`containerSpan${ve}`,1);else{let lt=_.get(et);lt!==void 0&&(Bn=XW(e,ve,lt,{scrollAdjustPending:Pt,updateLayout:!0}).didChangePosition||Bn)}}if(we&&BC&&Lg(e,we),Bn&&Be(e,"lastPositionUpdate",Date.now()),rt){MW(e);return}LC(n,qe.startNoBuffer),!pt&&!n.didContainersLayout&&(Ru(n)?_u(n,n.startBuffered,n.endBuffered):_u(n,n.startNoBuffer,n.endNoBuffer)||_u(n,n.startBuffered,n.endBuffered))&&(cG(e),WW(e)),me&&qe.startNoBuffer!==null&&qe.endNoBuffer!==null&&v_(e.state,e,me,ee,qe.startNoBuffer,qe.endNoBuffer,at??qe.startNoBuffer,Et??qe.endNoBuffer),(k=Vt?.finishCalculateItemsInView)==null||k.call(Vt)})}function Pg(e){var t,n;let o=e.state,r=o.props.anchoredEndSpace,a=be(e,"anchoredEndSpaceSize"),i=o.anchoredEndSpaceReadyAnchorIndex,s=o.anchoredEndSpaceReadyAnchorKey,l=r?.anchorIndex,d,c=!0,f=0;if(r){let{anchorIndex:h,anchorMaxSize:v,anchorOffset:y=0}=r,{data:x}=o.props;if(h>=0&&h<x.length&&o.scrollLength>0){d=jt(o,h);let C=0,w=!1;for(let S=h;S<x.length;S++){let k=ZN(e,S),I=S===h&&v!==void 0?Math.min(k||0,Math.max(0,v)):k;k===void 0&&(w=!0),I!=null&&I>0&&(C+=I)}C=Math.max(0,C-e.scrollAxisGap),C+=(e.values.get("footerSize")||0)+OC(o.props),c=!w;let L=Math.max(0,o.scrollLength-C-y);f=w?Math.min(a||0,L):L}else h>=0&&(c=!1)}let p=a!==f&&(a!==void 0||r!==void 0),m=(a||0)!==f;return c&&(p||(i!==l||s!==d))?(o.anchoredEndSpaceReadyAnchorIndex=l,o.anchoredEndSpaceReadyAnchorKey=d,p&&(Be(e,"anchoredEndSpaceSize",f),(t=r?.onSizeChanged)==null||t.call(r,f)),m&&(Xs(e),Gs(e,o.scroll,!0,{markHasScrolled:!1})),(n=r?.onReady)==null||n.call(r,{anchorIndex:l,anchorKey:d,size:f})):!c&&p&&f<(a||0)&&(Be(e,"anchoredEndSpaceSize",f),(t=r?.onSizeChanged)==null||t.call(r,f),r?.includeInEndInset&&Gs(e,o.scroll,!0,{markHasScrolled:!1})),f}function bG(e){var t;let n=e.state;n.userScrollAnchorReset!==void 0?(Va(e),((t=n.userScrollAnchorReset)==null?void 0:t.keys.size)===0&&(n.userScrollAnchorReset=void 0)):n.mvcpAnchorLock?n.scheduledWork.has("mvcpRecalculate")||n.scheduledWork.frame(()=>Va(e,{doMVCP:!0}),"mvcpRecalculate"):(n.scheduledWork.cancel("mvcpRecalculate"),Va(e,{doMVCP:!0}))}function xN(e,t,n){if(e.state.needsOtherAxisSize){let r=n?t.height:t.width,a=be(e,"otherAxisSize");(!a||r>a)&&Be(e,"otherAxisSize",r)}}var $a;function b_(e){let t=$a===void 0;$a??($a=new Map);try{e()}finally{if(t){let n=$a;$a=void 0;for(let[o,r]of n)QC(o,r)}}}function wG(e,t){e.didChange||(e.didChange=t.didChange),e.didMeasureUserScrollAnchorResetItem||(e.didMeasureUserScrollAnchorResetItem=t.didMeasureUserScrollAnchorResetItem),e.needsRecalculate||(e.needsRecalculate=t.needsRecalculate),e.shouldMaintainScrollAtEnd||(e.shouldMaintainScrollAtEnd=t.shouldMaintainScrollAtEnd)}function SG(e,t){var n;let o=e.state;t.needsRecalculate?(o.scrollForNextCalculateItemsInView=void 0,bG(e)):t.didMeasureUserScrollAnchorResetItem&&((n=o.userScrollAnchorReset)==null?void 0:n.keys.size)===0&&(o.userScrollAnchorReset=void 0),t.didChange&&Pg(e),t.didChange&&t.shouldMaintainScrollAtEnd&&xd(e)}function w_(e,t){if($a){let n=$a.get(e);n?n.push(t):$a.set(e,[t])}else QC(e,[t])}function QC(e,t){var n;let o=e.state,r={};for(let a of t)if(a.containerId===void 0||be(e,`containerItemKey${a.containerId}`)===a.itemKey){let s=o.indexByKey.get(a.itemKey),l=s===void 0||(n=o.props.data)==null?void 0:n[s],d=a.containerId!==void 0&&s!==void 0&&l!==void 0?DW(o,a.containerId,s,l):void 0,c=IG(e,a.itemKey,a.size,d);wG(r,c)}SG(e,r)}function IG(e,t,n,o){var r,a;let i=e.state,s=i.userScrollAnchorReset,l=!!s?.keys.delete(t),{didContainersLayout:d,sizesKnown:c,props:{getFixedItemSize:f,getItemType:p,horizontal:m,onItemSizeChanged:g,data:h,maintainScrollAtEnd:v}}=i;if(!h)return{didMeasureUserScrollAnchorResetItem:l};let y=i.indexByKey.get(t);if(f){if(y===void 0)return{didMeasureUserScrollAnchorResetItem:l};let I=i.props.data[y];if(I===void 0)return{didMeasureUserScrollAnchorResetItem:l};if(!o?.didResolveFixedItemSize){let A=(a=o?.itemType)!=null?a:p&&(r=p(I,y))!=null?r:"";o={didResolveFixedItemSize:!0,fixedItemSize:f(I,y,A),itemType:A}}let T=o.fixedItemSize;if(T!==void 0&&T===c.get(t))return xN(e,n,m),{didMeasureUserScrollAnchorResetItem:l}}let x=!d,C=!1,w,L=i.sizesKnown.get(t),S=TG(e,t,n,o),k=Ou(m?n.width:n.height);if(S!==0){w=w!==void 0?Math.min(w,y):y;let{startBuffered:I,endBuffered:T}=i;x||(x=y>=I&&y<=T),!x&&i.containerItemKeys.has(t)&&(x=!0),(L===void 0||Math.abs(L-k)>5)&&(C=!0),g?.({index:y,itemData:i.props.data[y],itemKey:t,previous:k-S,size:k})}if(w!==void 0&&(i.minIndexSizeChanged=i.minIndexSizeChanged!==void 0?Math.min(i.minIndexSizeChanged,w):w),xN(e,n,m),d||_u(i,i.startBuffered,i.endBuffered)){let I=C&&!!v?.onItemLayout;return{didChange:S!==0,didMeasureUserScrollAnchorResetItem:l,needsRecalculate:x,shouldMaintainScrollAtEnd:I}}return{didChange:S!==0,didMeasureUserScrollAnchorResetItem:l}}function TG(e,t,n,o){var r,a;let i=e.state,{indexByKey:s,sizesKnown:l,averageSizes:d,props:{data:c,horizontal:f,getItemType:p,getFixedItemSize:m}}=i;if(!c)return 0;let g=s.get(t),h=c[g],v=o?.itemType,y=o?.fixedItemSize;m&&!o?.didResolveFixedItemSize&&(v=p&&(r=p(h,g))!=null?r:"",y=m(h,g,v));let x=o?.didResolveFixedItemSize||v!==void 0||y!==void 0?{didResolveFixedItemSize:o?.didResolveFixedItemSize,fixedItemSize:y,itemType:v}:void 0,C=fo(e,t,g,h,void 0,void 0,void 0,x),w=f?n.width:n.height,L=l.get(t),S=Math.round(w);if(l.set(t,S),y===void 0&&S>0){v??(v=p&&(a=p(h,g))!=null?a:"");let k=d[v];k||(k=d[v]={avg:0,num:0}),k.num===0?(k.avg=S,k.num++):L!==void 0&&L>0?k.avg+=(S-L)/k.num:(k.avg=(k.avg*k.num+S)/(k.num+1),k.num++)}return!C||Math.abs(C-S)>.1?(IC(e,t,S),S-C):0}function kG(e,t=null){let n=[],o=t??e.viewRefs.keys();for(let r of o){let a=e.viewRefs.get(r),i=be(e,`containerItemKey${r}`),s=a?.current;if(i!==void 0&&s){let l=s.getBoundingClientRect();S4(s,l),n.push({containerId:r,itemKey:i,size:{height:l.height,width:l.width}})}}n.length>0&&QC(e,n)}var S_=zn,ga=pe,LG=ga(function({children:t}){let n=Kr(),[o]=Zo(["containerLayoutEpoch"]);return he(()=>{{let r=QW(n);r!==void 0&&kG(n,r)}},[n,o]),t}),wg=e=>mh(e)?e:e?De(e,null):null,PG=typeof document<"u"&&!!document.getElementById("react-native-stylesheet"),PC={contain:"paint layout style",...PG?{display:"flex",flexDirection:"column"}:{}},AG=ga(function({id:t,horizontal:n,style:o,refView:r,...a}){let[i=hd]=Zo([`containerPosition${t}`]),s=Dg(o)?Object.assign({},...o):o,l=n?{...PC,...s,left:i}:{...PC,...s,top:i},{animatedScrollY:d,onLayout:c,onLayoutChange:f,stickyHeaderConfig:p,...m}=a;return De("div",{ref:r,...m,style:l})}),EG=ga(function({id:t,horizontal:n,style:o,refView:r,animatedScrollY:a,stickyHeaderConfig:i,onLayout:s,onLayoutChange:l,children:d,...c}){let[f=hd,p,m]=Zo([`containerPosition${t}`,"activeStickyIndex",`containerItemIndex${t}`]),g=K(()=>{var y;return(y=Dg(o)?Object.assign({},...o):o)!=null?y:{}},[o]),h=K(()=>{var y;let x={...PC,...g};delete x.transform;let C=(y=i?.offset)!=null?y:0,w=p===m;return x.position=w?"sticky":"absolute",x.zIndex=m+1e3,n?x.left=w?C:f:x.top=w?C:f,x},[g,n,f,m,p,i?.offset]),v=K(()=>i?.backdropComponent?De("div",{style:{inset:0,pointerEvents:"none",position:"absolute"}},wg(i.backdropComponent)):null,[i?.backdropComponent]);return De("div",{ref:r,style:h,...c},v,d)}),RG=AG;function MG(e){J(()=>e())}var I_=bt(null),NG=-1;function _G(){return Ht(I_)}function DG(){var e;let t=_G(),n=(e=t?.containerId)!=null?e:NG,[o]=Zo([`containerItemKey${n}`]);return x4("lastItemKeys",a=>t&&!Nu(o)&&a?.includes(o)||!1)}function OG({ItemSeparatorComponent:e,leadingItem:t}){return DG()?null:De(e,{leadingItem:t})}var xC=null;function FG(){return xC||(xC=new ResizeObserver(e=>{b_(()=>{for(let t of e){let n=Sg.get(t.target);if(n)for(let o of n)o(t)}})})),xC}var Sg=new WeakMap;function BG(e,t){var n;if(typeof ResizeObserver>"u"||!e)return()=>{};let o=FG(),r=(n=Sg.get(e))!=null?n:new Set;return r.size===0&&(Sg.set(e,r),o.observe(e,{box:"border-box"})),r.add(t),()=>{r.delete(t),r.size===0&&(Sg.delete(e),o.unobserve(e))}}function XC({ref:e,measureInLayoutEffect:t=!0,onLayoutProp:n,onLayoutChange:o,webLayoutResync:r},a){return he(()=>{var i,s;let l=e.current,c=((s=(i=l?.getScrollableNode)==null?void 0:i.call(l))!=null?s:null)||l;if(!c)return;let f=(m,g)=>{m.height===0&&m.width===0||(o(m,g),n?.({nativeEvent:{layout:m}}))},p;if(t){let m=c.getBoundingClientRect();f(CN(m),!0),p=m}return BG(c,m=>{var g;let h=m.target instanceof HTMLElement?m.target:void 0,v=Array.isArray(m.borderBoxSize)?m.borderBoxSize[0]:m.borderBoxSize,y=v?{height:v.blockSize,left:m.contentRect.left,top:m.contentRect.top,width:v.inlineSize}:(g=h?.getBoundingClientRect())!=null?g:m.contentRect,x=p??w4(c),C=x===void 0||y.width!==x.width||y.height!==x.height;p=y;let w=!!r?.();(C||w)&&f(CN(y),!1)})},[t,...a||[]]),{}}function CN(e){return e?{height:e.height,width:e.width,x:e.left,y:e.top}:{height:0,width:0,x:0,y:0}}var Ig=new Map,CC;function T_(e){Ig.delete(e)}function zG(e,t){Ig.set(e,t),CC===void 0&&(CC=requestAnimationFrame(()=>{let n=Array.from(Ig.values());Ig.clear(),CC=void 0,b_(()=>{for(let o of n)o()})}))}function UG({containerId:e,ctx:t,rectangle:n,ref:o,state:r}){let a=t.state,i=r.itemKey;r.didLayout=!0;let s=n,l=r.horizontal?"width":"height",d=Ou(n[l]);r.lastSize&&Ou(r.lastSize[l]);let f=a.sizesKnown.get(i),p=()=>{r.lastSize=s,w_(t,{containerId:e,itemKey:i,size:s})};!$u(a)&&f!==void 0&&d+1<f?zG(r,()=>{var g;if(r.itemKey===i){let h=o.current,v=(g=h?.getBoundingClientRect)==null?void 0:g.call(h);v&&(s={height:v.height,width:v.width}),p()}}):(T_(r),p())}function HG({containerId:e,ctx:t,horizontal:n,itemKey:o,ref:r}){let a=N({didLayout:!1,horizontal:n,itemKey:o});a.current.horizontal=n,a.current.itemKey=o;let[i,s]=J(0),l=R(f=>{UG({containerId:e,ctx:t,rectangle:f,ref:r,state:a.current})},[e,t,r]),d=R(()=>{Lg(t,e)},[e,t]);he(()=>(t.containerLayoutTriggers.set(e,d),()=>{T_(a.current),t.containerLayoutTriggers.get(e)===d&&t.containerLayoutTriggers.delete(e)}),[e,t,d]),he(()=>{Lg(t,e)});let{onLayout:c}=XC({measureInLayoutEffect:!BC,onLayoutChange:l,ref:r,webLayoutResync:()=>$u(t.state)},[o,i]);return W(()=>{},[e,t,o]),{onLayout:c,triggerLayout:d}}function $G({columnWrapperStyle:e,contentContainerAlignItems:t,horizontal:n,hasItemSeparator:o,isHorizontalRTLList:r,numColumns:a,otherAxisPos:i,otherAxisSize:s}){let l;if(e){let{columnGap:d,rowGap:c,gap:f}=e;n?l={paddingBottom:a>1?(c||f||0)/2:void 0,paddingRight:d||f||void 0,paddingTop:a>1?(c||f||0)/2:void 0}:l={paddingBottom:c||f||void 0,paddingLeft:a>1?(d||f||0)/2:void 0,paddingRight:a>1?(d||f||0)/2:void 0}}return n?{bottom:t==="flex-end"&&a===1?0:void 0,boxSizing:l?"border-box":void 0,direction:r&&qa.OS==="web"?"ltr":void 0,flexDirection:o?"row":void 0,height:s,left:0,position:"absolute",top:t==="flex-end"&&a===1?void 0:i,...l||{}}:{boxSizing:l?"border-box":void 0,left:i,position:"absolute",right:a>1?null:0,top:0,width:s,...l||{}}}var KG=ga(function({id:t,itemKey:n,recycleItems:o,horizontal:r,getRenderedItem:a,ItemSeparatorComponent:i,stickyHeaderConfig:s}){let l=Kr(),{columnWrapperStyle:d,animatedScrollY:c}=l,f=Ga(l.state),p=l.state.props.positionComponentInternal,m=l.state.props.stickyPositionComponentInternal,[g=0,h=1,v,y=1,x,C]=Zo([`containerColumn${t}`,`containerSpan${t}`,`containerItemData${t}`,"numColumns","extraData",`containerSticky${t}`]),w=N(null),{onLayout:L,triggerLayout:S}=HG({containerId:t,ctx:l,horizontal:r,itemKey:n,ref:w}),k=g>0?g:1,I=Math.min(Math.max(h||1,1),y),T=y>1?`${(k-1)/y*100}%`:0,A=y>1?`${I/y*100}%`:void 0,P=K(()=>$G({columnWrapperStyle:d,contentContainerAlignItems:l.state.props.contentContainerAlignItems,hasItemSeparator:!!i,horizontal:r,isHorizontalRTLList:f,numColumns:y,otherAxisPos:T,otherAxisSize:A}),[r,f,T,A,d,l.state.props.contentContainerAlignItems,y,i]),_=K(()=>n!==void 0?a(n):null,[n,v,x]),{renderedItem:E}=_||{},F=K(()=>(l.viewRefs.set(t,w),{containerId:t,triggerLayout:S}),[t,S]);return De(C?m||EG:p||RG,{animatedScrollY:C?c:void 0,horizontal:r,id:t,key:o?void 0:n,onLayout:L,refView:w,stickyHeaderConfig:s,style:P},De(I_.Provider,{value:F},E,_&&i&&De(OG,{ItemSeparatorComponent:i,leadingItem:_.item})))});function VG({id:e,horizontal:t,recycleItems:n,ItemSeparatorComponent:o,getRenderedItem:r,stickyHeaderConfig:a,ContainerComponent:i=KG}){let[s]=Zo([`containerItemKey${e}`]);return s===void 0?null:De(i,{getRenderedItem:r,horizontal:t,ItemSeparatorComponent:o,id:e,itemKey:s,recycleItems:n,stickyHeaderConfig:a})}var qG=ga(function(t){return De(VG,{...t})});function WG(e,t){let n=Array.from(e.children);if(n.length<=1)return n;let o=n.map(l=>{var d;return[l,(d=t.get(l))!=null?d:null]});o.sort((l,d)=>{let c=l[1],f=d[1];return c===null?1:f===null?-1:c-f});let r=new Map;o.forEach((l,d)=>{r.set(l[0],d)});let a=n.map(l=>r.get(l)),i=GG(a),s=new Set(i);for(let l=0;l<o.length;l++){let d=o[l][0],c=n.indexOf(d);if(!s.has(c)){let f=null;for(let p=l+1;p<o.length;p++){let m=o[p][0],g=n.indexOf(m);if(s.has(g)){f=m;break}}f?e.insertBefore(d,f):e.appendChild(d)}}}function GG(e){let t=e.length,n=[],o=new Array(t).fill(-1),r=[];for(let s=0;s<t;s++){let l=e[s],d=0,c=n.length;for(;d<c;){let f=Math.floor((d+c)/2);e[r[f]]<l?d=f+1:c=f}d===n.length?(n.push(l),r.push(s)):(n[d]=l,r[d]=s),d>0&&(o[s]=r[d-1])}let a=[],i=r[r.length-1];for(;i!==-1;)a.unshift(i),i=o[i];return a}function jG(e){let t=Kr(),n=N(void 0);W(()=>{let o=Ka(t,"lastPositionUpdate",()=>{n.current!==void 0&&clearTimeout(n.current),n.current=setTimeout(()=>{let r=e.current;if(r){let a=new Map;for(let[i,s]of t.viewRefs){let l=s.current,d=be(t,`containerItemIndex${i}`);l&&d!==void 0&&a.set(l,d)}WG(r,a)}n.current=void 0},500)});return()=>{o(),n.current!==void 0&&clearTimeout(n.current)}},[t])}function QG(e,t){let[n,o]=J(t),r=n!==t;return he(()=>{o(t)},[t]),e&&!r}var XG=ga(function({freshDataTransitionEpoch:t,horizontal:n,numColumns:o,children:r}){let a=N(null),i=Kr(),s=i.columnWrapperStyle,l=Ga(i.state),[d,c,f]=Zo(["otherAxisSize","readyToRender","totalSize"]),p=QG(!!c,t);jG(a);let m=n?{direction:l?"ltr":void 0,flexShrink:0,minHeight:d,opacity:p?1:0,position:"relative",width:f}:{height:f,minWidth:d,opacity:p?1:0,position:"relative"};if(p||(m.pointerEvents="none"),s&&o>1){let{columnGap:g,rowGap:h,gap:v}=s,y=g||v||0,x=h||v||0;n?(x&&(m.marginTop=m.marginBottom=-x/2),y&&(m.marginRight=-y)):x&&(m.marginBottom=-x)}return De("div",{ref:a,style:m},De(LG,null,r))}),YG=ga(function({freshDataTransitionEpoch:t,horizontal:n,recycleItems:o,ItemSeparatorComponent:r,getRenderedItem:a,stickyHeaderConfig:i}){let[s,l]=Zo(["numContainersPooled","numColumns"]),d=[];for(let c=0;c<s;c++)d.push(De(qG,{getRenderedItem:a,horizontal:n,ItemSeparatorComponent:r,id:c,key:c,recycleItems:o,stickyHeaderConfig:i}));return De(XG,{freshDataTransitionEpoch:t,horizontal:n,numColumns:l},d)});function JG(e){return Dg(e)?Object.assign({},...e.filter(Boolean)):e}var Hu={create:e=>e,flatten:e=>JG(e)};function AC(e){let t=N(e);return t.current=e,t}function ZG(e){let t=AC(e),n=N(void 0),o=K(()=>({cancel(){n.current!==void 0&&(cancelAnimationFrame(n.current),n.current=void 0)},flush(){o.cancel(),t.current()},schedule(){if(n.current!==void 0)return!1;let r=requestAnimationFrame(()=>{n.current===r&&(n.current=void 0,t.current())});return n.current=r,!0}}),[]);return W(()=>()=>{o.cancel()},[o]),o}var EC="legend-list-content-container",k_="legend-list-scrollbar-x-hidden",L_="legend-list-scrollbar-y-hidden";function ej(){return typeof document>"u"?null:document.scrollingElement||document.documentElement||document.body}function RC(){var e,t,n,o;return typeof window>"u"?{x:0,y:0}:{x:(t=(e=window.scrollX)!=null?e:window.pageXOffset)!=null?t:0,y:(o=(n=window.scrollY)!=null?n:window.pageYOffset)!=null?o:0}}function bN(e,t){var n,o;let r=e?.getBoundingClientRect();return{left:((n=r?.left)!=null?n:0)+t.x,top:((o=r?.top)!=null?o:0)+t.y}}function P_(e){var t,n;return{height:(t=e?.scrollHeight)!=null?t:0,width:(n=e?.scrollWidth)!=null?n:0}}function tj(e,t,n){return P_(n?t:e)}function wN(e,t,n){var o,r,a,i,s,l;if(t&&typeof window<"u"){let d=e?.getBoundingClientRect();return{height:n&&(r=(o=d?.height)!=null?o:e?.clientHeight)!=null?r:window.innerHeight,width:n?window.innerWidth:(i=(a=d?.width)!=null?a:e?.clientWidth)!=null?i:window.innerWidth}}return{height:(s=e?.clientHeight)!=null?s:0,width:(l=e?.clientWidth)!=null?l:0}}function SN(e,t){return Math.max(0,Math.min(e,t))}function IN(e,t){return t?e.width:e.height}function nj(e,t,n){return Math.max(0,IN(e,n)-IN(t,n))}function TN(e,t){return t&&ej()||e}function oj(e,t){return t&&typeof window<"u"?window:e}function rj(e,t,n){let o=e.getBoundingClientRect(),r=RC();return{height:t&&typeof window<"u"&&!n?window.innerHeight:o.height,width:t&&typeof window<"u"&&n?window.innerWidth:o.width,x:t?o.left+r.x:o.left,y:t?o.top+r.y:o.top}}function aj({clampedOffset:e,horizontal:t,listPos:n,scroll:o}){return{left:t?n.left+e:o.x,top:t?o.y:n.top+e}}var kN="legend-list-scrollbar-axis-hidden-style",ij=200,sj=`.${L_}::-webkit-scrollbar:vertical{width:0;display:none;}.${k_}::-webkit-scrollbar:horizontal{height:0;display:none;}`;function lj(){if(typeof document>"u"||document.getElementById(kN))return;let e=document.createElement("style");e.id=kN,e.textContent=sj,document.head.appendChild(e)}function dj(e){var t,n;let o=(n=(t=e.state)==null?void 0:t.props)==null?void 0:n.contentInsetEndAdjustment;return Math.max(0,o??0)}function cj(e){if(!e?.length)return[];let t=[],n=new Set;for(let o of e)Number.isFinite(o)&&!n.has(o)&&(n.add(o),t.push(o));return t}function uj(e,t){return{height:t?"100%":1,left:t?e:0,pointerEvents:"none",position:"absolute",scrollSnapAlign:"start",top:t?0:e,width:t?1:"100%"}}var LN=zn(function({children:t,style:n,contentContainerClassName:o,contentContainerStyle:r,horizontal:a=!1,contentOffset:i,maintainVisibleContentPosition:s,onScroll:l,onInternalScrollEnd:d,onMomentumScrollEnd:c,showsHorizontalScrollIndicator:f=!0,showsVerticalScrollIndicator:p=!0,refreshControl:m,useWindowScroll:g=!1,onLayout:h,...v},y){var x,C,w;let L=Kr(),[S]=Zo(["anchoredEndSpaceSize"]),k=N(null),I=N(null),T=g,A=R(()=>oj(k.current,T),[T]),P=R(()=>{let j=k.current,X=tj(j,I.current,T),ae=wN(j,T,a);return nj(X,ae,a)},[a,T]),_=R(()=>{let j=k.current;if(T){let X=P(),ae=RC(),oe=bN(j,ae),ft=a?ae.x-oe.left:ae.y-oe.top;return SN(ft,X)}return j?a?j.scrollLeft:j.scrollTop:0},[P,a,T]),E=R((j,X)=>{let ae=k.current,oe=A();if(!oe||typeof oe.scrollTo!="function")return;let ft=P(),pt=SN(j,ft),Pt={behavior:X?"smooth":"auto"};if(T){let nn=RC(),gt=bN(ae,nn),{left:Bt,top:Mt}=aj({clampedOffset:pt,horizontal:a,listPos:gt,scroll:nn});Pt.left=Bt,Pt.top=Mt}else a?Pt.left=pt:Pt.top=pt;oe.scrollTo(Pt)},[P,A,a,T]);ar(y,()=>({getBoundingClientRect:()=>{var X;return(X=k.current)==null?void 0:X.getBoundingClientRect()},getCurrentScrollOffset:_,getScrollableNode:()=>TN(k.current,T),getScrollEventTarget:()=>A(),getScrollResponder:()=>TN(k.current,T),isWindowScroll:()=>T,scrollBy:(X,ae)=>{let oe=A();!oe||typeof oe.scrollBy!="function"||oe.scrollBy({behavior:"auto",left:X,top:ae})},scrollTo:X=>{let{x:ae=0,y:oe=0,animated:ft=!0}=X;E(a?ae:oe,ft)},scrollToEnd:(X={})=>{let{animated:ae=!0}=X,oe=P();E(oe,ae)},scrollToOffset:X=>{let{offset:ae,animated:oe=!0}=X;E(ae,oe)}}),[_,P,A,a,T,E]);let F=R(()=>{if(!l||!k.current)return;let j=P_(I.current),X=wN(k.current,T,a),ae=_(),oe={nativeEvent:{contentOffset:{x:a?ae:0,y:a?0:ae},contentSize:{height:j.height,width:j.width},layoutMeasurement:{height:X.height,width:X.width}}};l(oe)},[_,a,T,l]),B=ZG(F),V=N(void 0),Q=R(()=>{let j=V.current;j!==void 0&&(clearTimeout(j),V.current=void 0),B.flush(),d?.()},[d,B]),Se=R(j=>{if(!l)return;let X=L.state;if(!!X?.scrollingTo||!!X?.initialScrollSession&&!X.didFinishInitialScroll||!!X?.initialScroll&&!X.didFinishInitialScroll||!!X&&$u(X)?B.flush():B.schedule(),d){let oe=V.current;oe!==void 0&&clearTimeout(oe),V.current=setTimeout(Q,ij)}},[L.state,Q,d,l,B]);he(()=>{let j=A();if(j)return j.addEventListener("scroll",Se,{passive:!0}),"onscrollend"in j&&j.addEventListener("scrollend",Q),()=>{j.removeEventListener("scroll",Se),"onscrollend"in j&&j.removeEventListener("scrollend",Q);let X=V.current;X!==void 0&&(clearTimeout(X),V.current=void 0),B.cancel()}},[Q,A,Se,B]),W(()=>{let j=()=>{i&&E(a?i.x||0:i.y||0,!1)};j(),requestAnimationFrame(j)},[i?.x,i?.y,a,E]),he(()=>{if(!h||!k.current)return;let j=k.current,X=()=>{h({nativeEvent:{layout:rj(j,T,a)}})};X();let ae=new ResizeObserver(()=>{X()});ae.observe(j);let oe=()=>{X()};return T&&typeof window<"u"&&typeof window.addEventListener=="function"&&window.addEventListener("resize",oe),()=>{ae.disconnect(),T&&typeof window<"u"&&typeof window.removeEventListener=="function"&&window.removeEventListener("resize",oe)}},[T,h]);let H=!T&&(a?!f&&k_:!p&&L_);he(()=>{H&&lj()},[H]);let q={...T?{}:{overflow:"auto",overflowX:a||f?"auto":"hidden",overflowY:a?p?"auto":"hidden":"auto",WebkitOverflowScrolling:"touch"},...Hu.flatten(n),...s?{overflowAnchor:"none"}:{}},ee=dj(L),G=(C=(x=L.state)==null?void 0:x.props)!=null&&C.anchoredEndSpace&&S?S:0,te=Math.max(0,ee-G),me=te?a?{flexShrink:0,width:te}:{height:te}:void 0,U={display:a?"flex":"block",flexDirection:a?"row":void 0,minHeight:a?void 0:"100%",minWidth:a?"100%":void 0,...Hu.flatten(r),...s?{overflowAnchor:"none"}:{}},Y=o?`${EC} ${o}`:EC,{contentContainerClassName:se,contentInset:ge,scrollEventThrottle:ie,ScrollComponent:Ae,snapToOffsets:Xe,useWindowScroll:nt,className:rt,...Ve}=v,ne=T?[]:cj(Xe);ne.length>0&&(q.scrollSnapType=a?"x mandatory":"y mandatory",U.position=(w=U.position)!=null?w:"relative");let we=H?rt?`${rt} ${H}`:H:rt;return Jo&&/(?:^|\s)(?:[a-z0-9_-]+:)*gap(?:-[xy])?-(?:\[[^\]]+\]|[^\s]+)/.test(`${o??""} ${rt??""}`)&&qs("className-gap","className/contentContainerClassName gap classes are not supported in LegendList because it needs to use exact values internally. Use contentContainerStyle={{ gap: ... }} or columnWrapperStyle instead."),De("div",{className:we,ref:k,...Ve,style:q},m,De("div",{className:Y,ref:I,style:U},ne.map(j=>De("div",{"aria-hidden":!0,"data-legend-list-snap-anchor":j,key:`snap-${j}`,style:uj(j,a)})),t,me?De("div",{"aria-hidden":!0,style:me}):null))});function fj({horizontal:e,needsOtherAxisSize:t,otherAxisSize:n}){if(!(!t||!n||n<=0))return e?{height:n}:{width:n}}function PN(e,t){let n=Kr();he(()=>Ka(n,e,r=>{t(r)}),[t,n,e])}function pj(e){return e?{contentSizeKey:"scrollWidth",paddingEndProp:"paddingRight",viewportSizeKey:"clientWidth",x:1,y:0}:{contentSizeKey:"scrollHeight",paddingEndProp:"paddingBottom",viewportSizeKey:"clientHeight",x:0,y:1}}function mj(e,t){var n,o,r;let a=(n=e.state)==null?void 0:n.refScroller.current,i=(r=(o=a?.getScrollableNode)==null?void 0:o.call(a))!=null?r:null,s=null;return i&&(s=t?.isConnected&&t.parentElement===i?t:i.querySelector(`:scope > .${EC}`)),i?{contentNode:s,scrollElement:i}:null}function gj(e,t,n){e.scrollBy({behavior:"auto",left:t,top:n})}function hj(){let e=Kr(),t=N(0),n=N(0),o=N(void 0),r=N(void 0),a=N(null),i=R(()=>{let s=be(e,"scrollAdjust"),l=be(e,"scrollAdjustUserOffset"),d=(s||0)+(l||0);if(d-t.current!==0){let f=mj(e,a.current);if(f){let p=!!e.state.props.horizontal,m=pj(p),{contentNode:g,scrollElement:h}=f,v=p?h.scrollLeft:h.scrollTop,y=(l||0)-n.current,C=(y!==0?v+y:e.state.scroll)-v,w=Math.abs(C)>.01,L=()=>gj(h,m.x*C,m.y*C);if(a.current=g,w&&g){let S=g[m.contentSizeKey],k=h[m.viewportSizeKey],I=v+C;if(C>0&&!e.state.adjustingFromInitialMount&&S<I+k){let A=g.style[m.paddingEndProp],P=r.current,_=P?.value===A?P.baseline:A,E=(I+k-S)*2,B=`${(Number.parseFloat(window.getComputedStyle(g)[m.paddingEndProp])||0)+E}px`;g.style[m.paddingEndProp]=B,r.current={baseline:_,value:g.style[m.paddingEndProp]},g.offsetHeight,L(),o.current!==void 0&&cancelAnimationFrame(o.current),o.current=requestAnimationFrame(()=>{let V=r.current;o.current=void 0,r.current=void 0,g.style[m.paddingEndProp]===V?.value&&(g.style[m.paddingEndProp]=V.baseline)})}else L()}else w&&L()}t.current=d,n.current=l||0}},[e]);return PN("scrollAdjust",i),PN("scrollAdjustUserOffset",i),null}var vj=zn(function({ScrollComponent:t,...n},o){let[r]=Zo(["snapToOffsets"]);return De(t,{...n,ref:o,snapToOffsets:r})}),MC=.1;function yj(e,t,n){let o=be(e,t)!==n;return o&&(Be(e,t,n),Xs(e)),o}function xj(e,t,n){let{didContainersLayout:o,didFinishInitialScroll:r,props:a,scroll:i,scrollingTo:s}=e.state,l=n-t,c=((a.horizontal?a.stylePaddingLeft:a.stylePaddingTop)||0)+t;return a.maintainVisibleContentPosition.size&&o&&r&&!s&&i>=c-MC&&Math.abs(l)>MC}function AN(e,t){let{state:n}=e,o=be(e,"headerSize")||0,r=o!==t,a=n.didMeasureHeader||o>MC;r&&(Be(e,"headerSize",t),Xs(e),a&&xj(e,o,t)&&Ys(e,t-o)),n.didMeasureHeader=!0}function Cj(e,t){let n=yj(e,"footerSize",t);return n&&Pg(e),n}function bj(e,t){var n,o,r,a,i,s,l,d;return((n=e?.top)!=null?n:0)===((o=t?.top)!=null?o:0)&&((r=e?.bottom)!=null?r:0)===((a=t?.bottom)!=null?a:0)&&((i=e?.left)!=null?i:0)===((s=t?.left)!=null?s:0)&&((l=e?.right)!=null?l:0)===((d=t?.right)!=null?d:0)}function wj(e,t){let{state:n}=e,o=n.contentInsetOverride,r=t??void 0,a=!bj(o,r);return n.contentInsetOverride=r,a&&Xs(e),a}function Sj(e,t){let n=AC(e),o=AC(t);return K(()=>zn((r,a)=>{var i,s;return(s=(i=n.current)==null?void 0:i.call(n,o.current(r,a)))!=null?s:null}),[o,n])}var EN=({onLayoutChange:e,refView:t,children:n,...o})=>{let r=N(null),a=t??r;return XC({onLayoutChange:e,ref:a}),De("div",{...o,ref:a},n)},Ij=ga(function({horizontal:t}){let[n=0]=Zo(["alignItemsAtEndPadding"]);return n<=0?null:De(Ag,{style:t?{flexShrink:0,width:n}:{flexShrink:0,height:n}},null)}),Tj=ga(function({canRender:t,freshDataTransitionEpoch:n,style:o,contentContainerStyle:r,horizontal:a,initialContentOffset:i,recycleItems:s,ItemSeparatorComponent:l,alignItemsAtEnd:d,onScroll:c,onLayout:f,ListHeaderComponent:p,ListHeaderComponentStyle:m,ListFooterComponent:g,ListFooterComponentStyle:h,ListEmptyComponent:v,getRenderedItem:y,refScrollView:x,renderScrollComponent:C,onLayoutFooter:w,onInternalScrollBeginDrag:L,onInternalScrollEnd:S,scrollAdjustHandler:k,snapToIndices:I,stickyHeaderConfig:T,stickyHeaderIndices:A,useWindowScroll:P=!1,..._}){let E=Kr(),F=E.state.props.maintainVisibleContentPosition,[B=0,V=0]=Zo(["anchoredEndSpaceSize","otherAxisSize"]),Q=E.state.props.alignItemsAtEndPaddingEnabled,Se=!!E.state.props.anchoredEndSpace&&E.state.props.anchoredEndSpaceOwner==="list"&&B>0,H;if(Se){let se=a?Ga(E.state)?"Left":"Right":"Bottom",ge=Hu.flatten(r);H={[`padding${se}`]:Eu({},ge||{},se)+B}}let q=fj({horizontal:a,needsOtherAxisSize:E.state.needsOtherAxisSize,otherAxisSize:V}),ee=Sj(C,(se,ge)=>({...se,ref:ge})),G=C?ee:LN,te=I?vj:G,me=R((se,ge)=>{var ie;let Ae=Cj(E,se);ge?.(),Ae&&((ie=E.state.props.maintainScrollAtEnd)!=null&&ie.onFooterLayout)&&xd(E)},[E]);he(()=>{p||AN(E,0),g||me(0)},[p,g,E,me]);let U=R(se=>{let ge=se[a?"width":"height"];AN(E,ge)},[E,a]),Y=R((se,ge)=>{let ie=se[a?"width":"height"];me(ie,()=>{w?.(se,ge)})},[a,w,me]);return De(te,{..._,...G===LN?{onInternalScrollEnd:S,useWindowScroll:P}:{},contentContainerStyle:[a?{height:"100%"}:{},r,H,{boxSizing:"border-box"}],contentOffset:i!==void 0?a?{x:i,y:0}:{x:0,y:i}:void 0,horizontal:a,maintainVisibleContentPosition:F.size||F.data?{minIndexForVisible:0}:void 0,onLayout:f,onScroll:c,ref:x,ScrollComponent:I?G:void 0,style:q?[q,o]:o},De(hj,null),p&&De(EN,{onLayoutChange:U,style:m},wg(p)),v&&wg(v),Q&&De(Ij,{horizontal:a}),t&&!v&&De(YG,{freshDataTransitionEpoch:n,getRenderedItem:y,horizontal:a,ItemSeparatorComponent:l,recycleItems:s,stickyHeaderConfig:T}),g&&De(EN,{onLayoutChange:Y,style:h},wg(g)),Jo&&T4)}),kj=100,Lj=.9,Pj=.9;function Aj(e){let t=Kr(),{anchoredEndSpace:n,childrenMode:o,keyExtractor:r,numColumns:a,renderScrollComponent:i,useWindowScroll:s}=e,l=!!n;W(()=>{l&&(a??1)>1&&qs("anchoredEndSpaceNumColumns","anchoredEndSpace is only supported when numColumns is 1. Using it with multiple columns may produce incorrect anchored spacing.")},[l,a]),W(()=>{s&&i&&qs("useWindowScrollRenderScrollComponent","useWindowScroll is not supported when renderScrollComponent is provided.")},[i,s]),W(()=>{!r&&!t.state.isFirst&&t.state.didDataChange&&!o&&qs("keyExtractor","Changing data without a keyExtractor can cause slow performance and resetting scroll. If your list data can change you should use a keyExtractor with a unique id for best performance and behavior.")},[o,t,r]),W(()=>{let d=t.state,c=d.props.data.length;if(d.props.useWindowScroll||c<kj)return;let p=()=>{let g=be(t,"readyToRender"),h=be(t,"numContainers")||0,v=be(t,"totalSize")||0,y=t.state.scrollLength||0;if(!g||v<=0||y<=0)return;let x=h>=Math.ceil(c*Lj),C=y>=v*Pj;x&&C&&qs("webUnboundedOuterSize","LegendList appears to have an unbounded outer height on web, so virtualization is effectively disabled. Set a bounded height or flex: 1 on the list container, or use useWindowScroll.")};p();let m=[Ka(t,"numContainers",p),Ka(t,"readyToRender",p),Ka(t,"totalSize",p)];return()=>{for(let g of m)g()}},[t])}function Ej(e){}var Rj=Jo?Aj:Ej;function Mj(e,t,{didColumnsChange:n=!1}={}){let o=e.state,{previousData:r}=o,{maintainScrollAtEnd:a}=o.props;if(n){o.sizes.clear(),o.sizesKnown.clear(),d_(o);for(let l in o.averageSizes)delete o.averageSizes[l];o.minIndexSizeChanged=0,o.scrollForNextCalculateItemsInView=void 0}Va(e,{dataChanged:!0,doMVCP:!0});let s=!n&&a?.onDataChange&&xd(e);!s&&r&&t.length>r.length&&(o.isEndReached=!1),s||Ng(e),delete o.previousData}function Nj(e,t,n){var o;if(e.pendingDataComparison=void 0,!n||!t||t.length!==n.length)return!0;let{idCache:r,props:{itemsAreEqual:a,keyExtractor:i}}=e,s;for(let l=0;l<t.length;l++){if(t[l]===n[l])continue;if(!i)return s&&(e.pendingDataComparison={byIndex:s,nextData:t,previousData:n}),!0;let d=(o=r[l])!=null?o:i(n[l],l),c=i(t[l],l);if(d!==c)return s&&(e.pendingDataComparison={byIndex:s,nextData:t,previousData:n}),!0;if(!a)return s&&(e.pendingDataComparison={byIndex:s,nextData:t,previousData:n}),!0;let f=a(n[l],t[l],l,t);if(s??(s=[]),s[l]=f?1:2,!f)return e.pendingDataComparison={byIndex:s,nextData:t,previousData:n},!0}return!1}function A_(e){var t,n;let o=e.state,{scrollLength:r,props:{data:a,getFixedItemSize:i,getItemType:s,numColumns:l,estimatedItemSize:d}}=o,c=jN(e),f=be(e,"numContainers");if(r>0&&a.length>0&&!f){let p;if(i){let g=0,h=Math.min(20,a.length);for(let v=0;v<h;v++){let y=a[v];if(y!==void 0){let x=(t=s?.(y,v))!=null?t:"";g+=((n=i(y,v,x))!=null?n:d)+e.scrollAxisGap}}p=g/h}else p=d+e.scrollAxisGap;let m=Math.max(1,Math.ceil((r+c*2)/p*l));for(let g=0;g<m;g++)Be(e,`containerPosition${g}`,hd),Be(e,`containerColumn${g}`,-1),Be(e,`containerSpan${g}`,1);return Be(e,"numContainers",m),Be(e,"numContainersPooled",iG(a.length,m)),o.lastLayout&&(o.initialScroll?requestAnimationFrame(()=>{Va(e,{dataChanged:!0,doMVCP:!0})}):Va(e,{dataChanged:!0,doMVCP:!0})),!0}}function _j(){return typeof window>"u"?{height:0,width:0}:{height:window.innerHeight,width:window.innerWidth}}function Dj(e,t,n){let o=e.state,{maintainScrollAtEnd:r,useWindowScroll:a}=o.props,i=o.props.horizontal?"width":"height",s=o.props.horizontal?"height":"width",l=t;if(a){let v=_j()[i];l=v>0?{...t,[i]:v}:t}let d=l[i],c=o.scrollLength,f=d>0?d:c,p=l[s],m=!o.lastLayout||f>o.scrollLength||o.lastLayout.x!==l.x||o.lastLayout.y!==l.y;o.lastLayout=l;let g=o.otherAxisSize,h=f!==o.scrollLength||p!==g;if(h){if(o.scrollLength=f,o.otherAxisSize=p,Xs(e),o.lastBatchingAction=Date.now(),o.scrollForNextCalculateItemsInView=void 0,f>0&&A_(e),m&&Va(e,{doMVCP:!0}),(h||p!==g)&&Be(e,"scrollSize",{height:l.height,width:l.width}),r?.onLayout&&xd(e),Ng(e),o){let v=o.props.horizontal?(o.props.stylePaddingTop||0)+(o.props.stylePaddingBottom||0):(o.props.stylePaddingLeft||0)+(o.props.stylePaddingRight||0);o.needsOtherAxisSize=p-v<10}Jo&&d===0&&qs("height0",`List ${o.props.horizontal?"width":"height"} is 0. You may need to set a style or \`flex: \` for the list, because children are absolutely positioned.`)}n(!0)}function Oj(e,t){let n=oo.get(e);if(!!n&&oo.didReachTarget(t,n)){oo.clear(e);return}n&&(e.hasScrolled=!1,oo.set(e,{startScroll:n.startScroll,targetOffset:n.targetOffset}))}function Fj(e){var t;return!!e.initialScroll&&((t=e.initialScrollSession)==null?void 0:t.kind)==="bootstrap"&&!e.didFinishInitialScroll}function Bj(e){return{...e,nativeEvent:{...e.nativeEvent}}}function zj(e,t){var n,o,r,a,i,s;let l=e.state,{scrollProcessingEnabled:d}=l;if(d===!1||((o=(n=t.nativeEvent)==null?void 0:n.contentSize)==null?void 0:o.height)===0&&((r=t.nativeEvent.contentSize)==null?void 0:r.width)===0)return;let c=!1;if((a=t.nativeEvent)!=null&&a.contentInset){let{contentInset:p}=t.nativeEvent,m=l.nativeContentInset;(!m||m.top!==p.top||m.bottom!==p.bottom||m.left!==p.left||m.right!==p.right)&&(l.nativeContentInset=p,c=!0)}let f=t.nativeEvent.contentOffset[l.props.horizontal?"x":"y"];if(l.props.horizontal&&(f=u4(l,f,(i=t.nativeEvent.contentSize)==null?void 0:i.width)),l.didFinishInitialScroll&&((s=l.initialScroll)==null?void 0:s.viewPosition)===1&&l.scroll>l.scrollLength,l.lastNativeScroll=f,l.lastNativeScrollTime=Date.now(),l.scrollingTo&&l.scrollingTo.offset>=f){let p=Fi(e,f,l.scrollingTo);if(f!==p&&Math.abs(f-p)>1){f=p,Bg(e,{forceScroll:!0,isInitialScroll:!0,noScrollingTo:!0,offset:f});return}}l.scrollPending=f,Gs(e,f,c,{fromNativeScrollEvent:!0}),Oj(l,f),LW(e),l.scrollingTo&&GC(e),l.props.onScroll&&(Fj(l)?l.deferredPublicOnScrollEvent=Bj(t):l.props.onScroll(t))}var Uj=class{constructor(){this.work=new Map}timeout(e,t,n){n&&this.cancel(n);let o=[void 0,clearTimeout],r=setTimeout(()=>{let a=n??r;this.work.get(a)===o&&(this.work.delete(a),e())},t);o[0]=r,this.work.set(n??r,o)}frame(e,t){this.cancel(t);let n=[void 0,cancelAnimationFrame];this.work.set(t,n),n[0]=requestAnimationFrame(()=>{this.work.get(t)===n&&(this.work.delete(t),e())})}register(e,t){this.cancel(e),this.work.set(e,[void 0,t])}cancel(e){let t=this.work.get(e);if(t){this.work.delete(e);let[n,o]=t;o(n)}}has(e){return this.work.has(e)}dispose(){for(let[e,t]of this.work.values())t(e);this.work.clear()}},Hj=class{constructor(e){this.appliedAdjust=0,this.pendingAdjust=0,this.ctx=e}requestAdjust(e){let t=this.ctx.state.scrollingTo;t?.animated&&!t.isInitialScroll?(this.pendingAdjust+=e,Be(this.ctx,"scrollAdjustPending",this.pendingAdjust)):(this.appliedAdjust+=e,Be(this.ctx,"scrollAdjust",this.appliedAdjust)),this.ctx.state.scrollingTo&&GC(this.ctx)}getAdjust(){return this.appliedAdjust}commitPendingAdjust(e){{let t=this.ctx.state,n=this.pendingAdjust;if(this.pendingAdjust=0,n!==0){let o;if(e?.index!==void 0){let a=_g(this.ctx,e.index);o=Og(this.ctx,a,e),o=Fi(this.ctx,o,e)}else o=Fi(this.ctx,t.scroll+n);let r=o-t.scroll;(Math.abs(r)>.1||Math.abs(n)>.1)&&(this.appliedAdjust+=r,t.scroll=o,t.scrollForNextCalculateItemsInView=void 0,Be(this.ctx,"scrollAdjust",this.appliedAdjust)),Be(this.ctx,"scrollAdjustPending",0),Va(this.ctx)}}}};function $j(e,t){let n=e.state,o=Ws(e,t),a=Ws(e)-o;if(a!==0){let i=!!be(e,"isWithinMaintainScrollAtEndThreshold");Gs(e,n.scroll,!0,{markHasScrolled:!1}),!f_(e)&&i&&a>0&&Ys(e,a)}}function bC(e){return K(()=>e?(t,n,o)=>t!==void 0&&n!==void 0?e(t,n,o):void 0:void 0,[e])}var Kj=(...e)=>R(n=>{for(let o of e)o&&(YN(o)?o(n):o.current=n)},e);function Vj(e){return null}function qj(e,t,n,o){return o}function Wj(e){let{gap:t,columnGap:n,rowGap:o}=e;if(t||n||o)return e.gap=void 0,e.columnGap=void 0,e.rowGap=void 0,{columnGap:n,gap:t,rowGap:o}}function Gj(e,t){let n=e.state,r=n.props.data.length-1;if(r===-1)return!1;let a=n.props.stylePaddingBottom||0,i=be(e,"footerSize")||0;return bg(e,{...t,index:r,viewOffset:-a-i+(t?.viewOffset||0),viewPosition:1}),!0}var jj="default";function Qj(e){let t={};for(let n in e.averageSizes){let o=e.averageSizes[n];o&&(t[n||jj]={average:o.avg,count:o.num})}return t}function Xj(e){Lg(e)}function Yj(e,t){let n=e.state,o=800,r=2,a=0,i=()=>!!n.didDataChange||!!n.didColumnsChange||n.scheduledWork.has("mvcpRecalculate")||n.ignoreScrollFromMVCP!==void 0,s=(h,v=!1)=>{var y;let x=n.props,C=x.data.length,w=(y=x.anchoredEndSpace)==null?void 0:y.anchorIndex;return h<0?v:h>=C?!1:w===void 0||w<0||w>=C||h<w?!0:K4(e,w,C-1)},l=(h,v,y)=>{let x=Date.now(),C=0,w=()=>{if(h!==a)return;i()||!y()?C=0:C+=1;let L=Date.now()-x>=o;if(C>=r||L){v();return}n.scheduledWork.frame(w,"imperativeScrollReady")};n.scheduledWork.frame(w,"imperativeScrollReady")},d=(h,v,y,x=()=>!0)=>{let C=()=>{if(h!==a)return;(!y()||!n.scrollingTo)&&(n.pendingScrollResolve===v&&(n.pendingScrollResolve=void 0),v())};i()||!x()?l(h,C,x):C()},c=h=>{n.scheduledWork.cancel("imperativeScrollReady");let v=++a;return UN(n),n.pendingScrollResolve=h,v},f=(h,v=()=>!0)=>new Promise(y=>{let x=c(y);sN(e),d(x,y,h,v)});n.runPendingScrollToEnd=()=>{let h=n.pendingScrollToEnd;h&&(n.pendingScrollToEnd=void 0,h.token===a&&d(h.token,h.resolve,()=>Gj(e,h.options),()=>s(n.props.data.length-1,!0)))};let p=h=>{if(n){let{index:v,...y}=h,{startNoBuffer:x,endNoBuffer:C}=n;if(v<x||v>C){let w=v<x?0:1;return bg(e,{...y,index:v,viewPosition:w}),!0}}return!1},m=n.refScroller;return{clearCaches:h=>{var v,y;let x=(v=h?.mode)!=null?v:"sizes";n.sizes.clear(),n.sizesKnown.clear(),d_(n);for(let C in n.averageSizes)delete n.averageSizes[C];n.minIndexSizeChanged=0,n.scrollForNextCalculateItemsInView=void 0,n.pendingTotalSize=void 0,n.totalSize=0,Be(e,"totalSize",0),x==="full"&&(n.indexByKey.clear(),n.idCache.length=0,n.positions.length=0,n.columns.length=0,n.columnSpans.length=0),Xj(e),(y=n.triggerCalculateItemsInView)==null||y.call(n,{forceFullItemPositions:!0})},flashScrollIndicators:()=>m.current.flashScrollIndicators(),getAnimatableRef:()=>{var h,v,y;return(y=(v=(h=m.current).getNativeScrollRef)==null?void 0:v.call(h))!=null?y:m.current},getNativeScrollRef:()=>m.current,getScrollableNode:()=>m.current.getScrollableNode(),getScrollResponder:()=>m.current.getScrollResponder(),getState:()=>({activeStickyIndex:be(e,"activeStickyIndex"),contentLength:uo(e),data:n.props.data,elementAtIndex:h=>{var v;return(v=e.viewRefs.get(TC(e,jt(n,h))))==null?void 0:v.current},end:n.endNoBuffer,endBuffered:n.endBuffered,getAverageItemSizes:()=>Qj(n),indexByKey:h=>n.indexByKey.get(h),isAtEnd:be(e,"isAtEnd"),isAtStart:be(e,"isAtStart"),isEndReached:n.isEndReached,isNearEnd:be(e,"isNearEnd"),isNearStart:be(e,"isNearStart"),isStartReached:n.isStartReached,isWithinMaintainScrollAtEndThreshold:be(e,"isWithinMaintainScrollAtEndThreshold"),listen:(h,v)=>Ka(e,h,v),listenToPosition:(h,v)=>v4(e,h,v),positionAtIndex:h=>n.positions[h],positionByKey:h=>{let v=n.indexByKey.get(h);return v===void 0?void 0:n.positions[v]},scroll:n.scroll,scrollLength:n.scrollLength,scrollVelocity:Fg(n),sizeAtIndex:h=>n.sizesKnown.get(jt(n,h)),sizes:n.sizesKnown,start:n.startNoBuffer,startBuffered:n.startBuffered}),reportContentInset:h=>{let v=wj(e,h);Gs(e,n.scroll,!0,{markHasScrolled:!1}),v&&f_(e)},scrollIndexIntoView:h=>f(()=>p(h)),scrollItemIntoView:({item:h,...v})=>f(()=>{let x=n.props.data.indexOf(h);return x!==-1?(p({index:x,...v}),!0):!1}),scrollToEnd:h=>new Promise(v=>{var y;let x=c(v);n.pendingScrollToEnd={options:h,resolve:v,token:x},t?.(),sN(e),t||(y=n.runPendingScrollToEnd)==null||y.call(n)}),scrollToIndex:h=>f(()=>(bg(e,h),!0),h.index>=0?()=>s(h.index):void 0),scrollToItem:({item:h,...v})=>f(()=>{let x=n.props.data.indexOf(h);return x!==-1?(bg(e,{index:x,...v}),!0):!1}),scrollToOffset:h=>f(()=>(Bg(e,h),!0)),setItemSize:(h,v)=>{w_(e,{itemKey:h,size:v})},setScrollProcessingEnabled:h=>{n.scrollProcessingEnabled=h},setVisibleContentAnchorOffset:h=>{let v=YN(h)?h(be(e,"scrollAdjustUserOffset")||0):h;Be(e,"scrollAdjustUserOffset",v)}}}var Jj=(e,t)=>e-t,RN=e=>typeof e=="number"&&Number.isFinite(e)?Math.max(0,Math.floor(e)):0,Au=(e,t,n)=>{n>=0&&n<t&&e.add(n)};function Zj(e,t,n,o){var r,a;if(t.length===0)return[];let i=new Set,s=t.length,l=RN(e?.top);if(l>0)for(let f=0;f<Math.min(l,s);f++)Au(i,s,f);let d=RN(e?.bottom);if(d>0)for(let f=Math.max(0,s-d);f<s;f++)Au(i,s,f);if((r=e?.indices)!=null&&r.length)for(let f of e.indices)Number.isFinite(f)&&Au(i,s,Math.floor(f));if((a=e?.keys)!=null&&a.length){let f=new Set(e.keys);for(let p=0;p<s&&f.size>0;p++){let m=n(t[p],p);f.has(m)&&(Au(i,s,p),f.delete(m))}}if(o!==void 0&&Number.isFinite(o)){let f=Math.floor(o);for(let p=f>=0?f:s;p<s;p++)Au(i,s,p)}let c=Array.from(i);return c.sort(Jj),c}function e6(e,t){var n;let o=e.state;if(!o)return null;let{indexByKey:r,props:{data:a,getItemType:i,renderItem:s}}=o,l=r.get(t);if(l===void 0)return null;let d=null,c=be(e,"extraData"),f=a[l];if(s&&!Nu(f)){let p={data:a,extraData:c,index:l,item:f,type:i&&(n=i(f,l))!=null?n:""};d=s(p)}return{index:l,item:a[l],renderedItem:d}}function MN(e,t){var n,o,r,a;return{animated:!1,onDataChange:t?(n=e?.dataChange)!=null?n:!1:!0,onFooterLayout:t?(o=e?.footerLayout)!=null?o:!1:!0,onItemLayout:t?(r=e?.itemLayout)!=null?r:!1:!0,onLayout:t?(a=e?.layout)!=null?a:!1:!0}}function t6(e){var t;return e?e===!0?{...MN(void 0,!1),animated:!1}:{...MN(e.on,"on"in e),animated:(t=e.animated)!=null?t:!1}:void 0}function n6(e){var t,n;return e===!0?{data:!0,size:!0}:e&&typeof e=="object"?{data:(t=e.data)!=null?t:!1,shouldRestorePosition:e.shouldRestorePosition,size:(n=e.size)!=null?n:!0}:e===!1?{data:!1,size:!1}:{data:!1,size:!0}}function o6(e,{stylePaddingTop:t}){let n=e.state;if(t!==void 0){let o=be(e,"stylePaddingTop")||0;if(t<o){let r=be(e,"totalSize")||0;Be(e,"totalSize",r+o),n.timeoutSetPaddingTop=setTimeout(()=>{r=be(e,"totalSize")||0,Be(e,"totalSize",r-o)},16)}Be(e,"stylePaddingTop",t)}}function r6(e){let t=N(null),n=N(0),o=N(null),r=()=>{t.current&&(clearTimeout(t.current),t.current=null)};return R((i,s,...l)=>{{let d=Date.now();o.current=l,d-n.current>=s?(n.current=d,i(...l),r()):(r(),t.current=setTimeout(()=>{o.current&&(n.current=Date.now(),i(...o.current),t.current=null,o.current=null)},s-(d-n.current)))}},[e])}function a6(e,t){let n=r6("throttle");return o=>n(e,t,{nativeEvent:o.nativeEvent})}var i6=ga(S_(function(t,n){let{children:o,data:r,renderItem:a,...i}=t,l=o!==void 0&&r===void 0?{...i,childrenMode:!0,data:(Dg(o)?o:fh.toArray(o)).flat(1),renderItem:({item:d})=>d}:{...i,data:r||[],renderItem:a};return De(m4,null,De(s6,{...l,ref:n}))})),s6=S_(function(t,n){var o,r,a,i,s,l,d,c,f,p,m,g,h,v,y,x,C,w,L;let S=R($e=>{},[]);t.recycleItems===void 0&&qs("recycleItems-omitted","recycleItems was not provided, so it defaults to false. Set recycleItems explicitly to true for better performance with recycling-aware rows, or false to preserve remount-on-reuse behavior.");let{alignItemsAtEnd:k=!1,anchoredEndSpace:I,alwaysRender:T,columnWrapperStyle:A,contentContainerStyle:P,contentInset:_,data:E=[],dataKey:F,dataVersion:B,drawDistance:V=250,contentInsetEndAdjustment:Q,estimatedItemSize:Se=100,estimatedListSize:H,extraData:q,getFixedItemSize:ee,getItemType:G,horizontal:te,rtl:me,estimatedHeaderSize:U,initialScrollAtEnd:Y=!1,initialScrollIndex:se,initialScrollOffset:ge,experimental_adaptiveRender:ie,itemsAreEqual:Ae,keyExtractor:Xe,ListEmptyComponent:nt,ListFooterComponent:rt,ListFooterComponentStyle:Ve,ListHeaderComponent:ne,maintainScrollAtEnd:we=!1,maintainScrollAtEndThreshold:j=.1,maintainVisibleContentPosition:X,numColumns:ae=1,overrideItemLayout:oe,onEndReached:ft,onEndReachedThreshold:pt=.5,onItemSizeChanged:yt,onMetricsChange:Pt,onLayout:nn,onLoad:gt,onMomentumScrollEnd:Bt,onRefresh:Mt,onScroll:St,onScrollBeginDrag:In,onStartReached:ct,onStartReachedThreshold:ln=.5,onStickyHeaderChange:ro,onFirstVisibleItemChanged:Vt,onViewableItemsChanged:bn,progressViewOffset:Tn,recycleItems:on=!1,refreshControl:kn,refreshing:O,refScrollView:fe,renderScrollComponent:ye,renderItem:Te,scrollEventThrottle:Me,snapToIndices:ht,stickyHeaderIndices:Ln,style:fn,useWindowScroll:at=!1,viewabilityConfig:It,viewabilityConfigCallbackPairs:Et,...Tt}=t,rn=t.animatedPropsInternal,Yt=(o=t.anchoredEndSpaceOwnerInternal)!=null?o:"list",xe=t.positionComponentInternal,_e=t.stickyPositionComponentInternal,{anchoredEndSpaceOwnerInternal:qe,positionComponentInternal:We,stickyPositionComponentInternal:ot,...xt}=Tt,Ft=Hu.flatten(P),Jt=k&&!te&&Ft?.minHeight==null&&E.length>0,ke=k&&!Jt&&(te?Ft?.minWidth==null:Ft?.minHeight==null),zt={...Ft,...k&&!Jt?{display:"flex",flexDirection:te?"row":"column",...ke?{flexGrow:1}:{},justifyContent:"flex-end"}:{}},vt={...Hu.flatten(fn)},Ut=Eu(vt,zt,"Top"),Bn=Eu(vt,zt,"Bottom"),ve=Eu(vt,zt,"Left"),et=Eu(vt,zt,"Right"),lt=OC({horizontal:te,rtl:me,stylePaddingBottom:Bn,stylePaddingLeft:ve,stylePaddingRight:et}),it=t6(we),xn=n6(X),pn=se!=null,mn=ge!=null,Ct=!Y&&!pn&&!mn&&DC({horizontal:te,rtl:me}),Qt=!Y&&!pn&&(mn||Ct),qt=Y||pn,ko=Y?{index:Math.max(0,E.length-1),preserveForBottomPadding:!0,viewOffset:-lt,viewPosition:1}:pn?typeof se=="object"?{index:(r=se.index)!=null?r:0,preserveForBottomPadding:se.viewOffset===void 0&&se.viewPosition===1?!0:void 0,viewOffset:(a=se.viewOffset)!=null?a:se.viewPosition===1?-lt:0,viewPosition:(i=se.viewPosition)!=null?i:0}:{index:se??0,viewOffset:ge??0}:Qt?{contentOffset:ge??0,index:0,viewOffset:0}:void 0,[Do,va]=J(!BC),[,Xa]=Sa($e=>$e+1,0),Ue=Kr();Ue.columnWrapperStyle=A||(zt?Wj(zt):void 0);let ya=te?(d=(s=Ue.columnWrapperStyle)==null?void 0:s.columnGap)!=null?d:(l=Ue.columnWrapperStyle)==null?void 0:l.gap:(p=(c=Ue.columnWrapperStyle)==null?void 0:c.rowGap)!=null?p:(f=Ue.columnWrapperStyle)==null?void 0:f.gap,qr=typeof ya=="number"&&Number.isFinite(ya)?ya:0,er=N(null),Nn=Kj(er,fe),Ya=Xe??(($e,_t)=>_t.toString()),tr=Ln,Ja=Q,Cr=N(Ja),br=K(()=>{let $e=Zj(T,E,Ya,I?.anchorIndex);return{arr:$e,set:new Set($e)}},[I?.anchorIndex,T?.top,T?.bottom,(m=T?.indices)==null?void 0:m.join(","),(g=T?.keys)==null?void 0:g.join(","),E,F,B,Ya]),nr=!!at&&!ye,Nt=N(void 0),Gn=!!oe,Lo=N(Gn);if(!Nt.current){if(!Ue.state){let $e=(H??{height:0,width:0})[te?"width":"height"];Ue.values.set("adaptiveRender",(h=ie?.initialMode)!=null?h:"normal"),Ue.state={averageSizes:{},columnSpans:[],columns:[],containerItemGenerations:[],containerItemKeys:new Map,containerItemMetadata:new Map,contentInsetOverride:void 0,dataChangeEpoch:0,dataChangeNeedsScrollUpdate:!1,didColumnsChange:!1,didDataChange:!1,didLoad:!1,enableScrollForNextCalculateItemsInView:!0,endBuffered:-1,endNoBuffer:-1,endReachedSnapshot:void 0,firstFullyOnScreenIndex:-1,freshDataTransitionEpoch:0,hasHadNonEmptyData:E.length>0,idCache:[],idsInView:[],indexByKey:new Map,initialScroll:ko,initialScrollSession:ko?{kind:Qt?"offset":"bootstrap",previousDataLength:E.length}:void 0,isEndReached:null,isFirst:!0,isStartReached:null,lastBatchingAction:Date.now(),lastLayout:void 0,lastScrollDelta:0,loadStartTime:Date.now(),minIndexSizeChanged:0,nativeContentInset:void 0,nativeMarginTop:0,pendingDataComparison:void 0,pendingNativeMVCPAdjust:void 0,positions:[],props:{},queuedCalculateItemsInView:0,refScroller:{current:null},scheduledWork:new Uj,scroll:0,scrollAdjustHandler:new Hj(Ue),scrollForNextCalculateItemsInView:void 0,scrollHistory:[],scrollLength:$e,scrollPending:0,scrollPrev:0,scrollPrevTime:0,scrollProcessingEnabled:!0,scrollTime:0,sizes:new Map,sizesKnown:new Map,startBuffered:-1,startNoBuffer:-1,startReachedSnapshot:void 0,stickyContainerPool:new Set,stickyContainers:new Map,totalSize:0,viewabilityConfigCallbackPairs:void 0};let _t=Ue.state;_t.triggerCalculateItemsInView=dn=>Va(Ue,dn),_t.reprocessCurrentScroll=()=>Gs(Ue,_t.scroll,!0),Be(Ue,"maintainVisibleContentPosition",xn),Be(Ue,"extraData",q),U!==void 0&&Be(Ue,"headerSize",U)}Nt.current=Ue.state}let Ee=Nt.current,Oo=Ee.isFirst,Bi=Ee.props.adaptiveRender,jn=Ee.props.numColumns,Fo=!Oo&&Ue.scrollAxisGap!==qr;Ue.scrollAxisGap=qr,Ee.didColumnsChange=ae!==jn||Fo;let Qn=(y=(v=Ee.props.data)==null?void 0:v.length)!=null?y:0,or=Ee.props.data!==E,Bo=Ee.props.dataKey!==F,wr=Ee.props.dataVersion!==B,po=Bo||wr||or&&Nj(Ee,E,Ee.props.data),zo=!Oo&&po&&Ee.hasHadNonEmptyData&&(Bo||Qn===0)&&E.length>0;po&&!Y&&Ee.didFinishInitialScroll&&((x=Ee.initialScroll)==null?void 0:x.viewPosition)===1&&Ee.props.data.length>0&&vd(Ee),po&&(Ee.dataChangeEpoch+=1,Ee.dataChangeNeedsScrollUpdate=!0,Ee.didDataChange=!0,Ee.previousData=Ee.props.data),zo&&(Ee.freshDataTransitionEpoch+=1);let zi=a6(St??S,Me??0),Pn=Me&&St?zi:St,Za=!Oo&&!po&&((C=Ee.props.anchoredEndSpace)==null?void 0:C.anchorIndex)!==I?.anchorIndex;Ee.props={adaptiveRender:ie,alignItemsAtEnd:k,alignItemsAtEndPaddingEnabled:Jt,alwaysRender:T,alwaysRenderIndicesArr:br.arr,alwaysRenderIndicesSet:br.set,anchoredEndSpace:I,anchoredEndSpaceOwner:Yt,animatedProps:rn,contentContainerAlignItems:zt.alignItems,contentInset:_,contentInsetEndAdjustment:Ja,data:E,dataKey:F,dataVersion:B,drawDistance:V,estimatedItemSize:Se,getFixedItemSize:bC(ee),getItemType:bC(G),horizontal:!!te,itemsAreEqual:Ae,keyExtractor:bC(Ya),maintainScrollAtEnd:it,maintainScrollAtEndThreshold:j,maintainVisibleContentPosition:xn,numColumns:ae,onEndReached:ft,onEndReachedThreshold:pt,onFirstVisibleItemChanged:Vt,onItemSizeChanged:yt,onLoad:gt,onMomentumScrollEnd:Bt,onScroll:Pn,onScrollBeginDrag:In,onStartReached:ct,onStartReachedThreshold:ln,onStickyHeaderChange:ro,overrideItemLayout:oe,positionComponentInternal:xe,recycleItems:!!on,renderItem:Te,rtl:me,snapToIndices:ht,stickyHeaderIndicesArr:tr??[],stickyHeaderIndicesSet:K(()=>new Set(tr??[]),[tr?.join(",")]),stickyPositionComponentInternal:_e,stylePaddingBottom:Bn,stylePaddingLeft:ve,stylePaddingRight:et,stylePaddingTop:Ut,useWindowScroll:nr},Ee.refScroller=er,!Oo&&Bi&&!ie&&zC(Ue);let Po=K(()=>E.length?Array.from({length:Math.min(ae,E.length)},($e,_t)=>jt(Ee,E.length-1-_t)):[],[E,F,B,ae]),Uo=$e=>{Be(Ue,"lastItemKeys",Po),Be(Ue,"numColumns",ae);let _t=be(Ue,"stylePaddingTop");o6(Ue,{stylePaddingTop:Ut}),Nt.current.props.stylePaddingBottom=Bn,Xs(Ue);let dn=Ut-_t;$e&&xn.size&&dn&&_t!==void 0&&qa.OS};Oo&&(Uo(!1),p_(Ee),g_(Ue,!0));let Wr=K(()=>{var $e,_t;let dn=Ee.initialScroll;if(!dn)return;let An=($e=dn.contentOffset)!=null?$e:$r(Ue,dn);return qt&&((_t=Ee.initialScrollSession)==null?void 0:_t.kind)==="bootstrap"&&qa.OS==="web"?void 0:An},[qt]);he(()=>{GW(Ue,{alwaysDispatchInitialScroll:Ct,dataLength:E.length,hasFooterComponent:!!rt,initialContentOffset:Wr,initialScrollAtEnd:Y,useBootstrapInitialScroll:qt})},[]),(Oo||po||Ee.didColumnsChange)&&(Nt.current.lastBatchingAction=Date.now(),!Xe&&!Oo&&po&&(Nt.current.sizes.clear(),Nt.current.positions.length=0,Nt.current.totalSize=0,Be(Ue,"totalSize",0))),Jo&&Rj(t),he(()=>{zo&&HC(Ue,{resetInitialScroll:!!ko,resetLayout:!0}),jW(Ue,{dataLength:E.length,didDataChange:po,didStartFreshData:zo,initialScrollAtEnd:Y,latestInitialScroll:ko,latestInitialScrollSessionKind:Qt?"offset":"bootstrap",stylePaddingEnd:lt,useBootstrapInitialScroll:qt})},[E.length,F,po,zo,Y,lt,qt]),he(()=>{var $e;Za&&(Ee.scrollForNextCalculateItemsInView=void 0,($e=Ee.triggerCalculateItemsInView)==null||$e.call(Ee)),Pg(Ue)},[Ue,E,B,I?.anchorIndex,I?.anchorMaxSize,I?.anchorOffset,Za,te,ae,me,Bn,ve,et]),he(()=>{let $e=Cr.current;Cr.current=Ja,$j(Ue,$e)},[Ue,Ja]);let Xn=R($e=>{qt&&EW(Ue,{dataLength:E.length,footerSize:$e[te?"width":"height"],initialScrollAtEnd:Y,stylePaddingEnd:lt})},[E.length,Y,te,lt,qt]),Gr=R(($e,_t)=>{let dn=Ee.scrollLength,An=Ee.otherAxisSize;Dj(Ue,$e,va),Pg(Ue);let Ho=dn!==Ee.scrollLength||An!==Ee.otherAxisSize;qt&&!_t&&Ho&&RW(Ue),!qt&&Bu(Ue)},[E.length,Y,lt,qt]),{onLayout:rr}=XC({onLayoutChange:Gr,onLayoutProp:nn,ref:er});he(()=>{ht&&m_(Ue)},[ht]),he(()=>Uo(!0),[F,B,Po.join(","),ae,qr,Bn,Ut,Jt]),he(()=>{let{didColumnsChange:$e,didDataChange:_t,isFirst:dn,props:{data:An}}=Ee;!(An.length>0&&A_(Ue))&&!dn&&(_t||$e)&&Mj(Ue,An,{didColumnsChange:$e}),_t&&(Ee.pendingDataComparison=void 0),Ee.didColumnsChange=!1,Ee.didDataChange=!1,Ee.isFirst=!1},[E,F,B,ae,qr]),he(()=>{var $e;Be(Ue,"extraData",q);let _t=Lo.current!==Gn;Lo.current=Gn,(Gn||_t)&&ae>1&&(($e=Ee.triggerCalculateItemsInView)==null||$e.call(Ee,{forceFullItemPositions:!0}))},[q,Gn,ae]),W(()=>{if(!Pt)return;let $e,_t=()=>{let An={footerSize:be(Ue,"footerSize")||0,headerSize:be(Ue,"headerSize")||0};(!$e||An.headerSize!==$e.headerSize||An.footerSize!==$e.footerSize)&&($e=An,Pt(An))};_t();let dn=[Ka(Ue,"headerSize",_t),Ka(Ue,"footerSize",_t)];return()=>{for(let An of dn)An()}},[Ue,Pt]),W(()=>{let $e=eG({onViewableItemsChanged:bn,viewabilityConfig:It,viewabilityConfigCallbackPairs:Et});Ee.viewabilityConfigCallbackPairs=$e,Ee.enableScrollForNextCalculateItemsInView=!0,$e&&(Ee.scrollForNextCalculateItemsInView=void 0)},[It,Et,bn]),MG(()=>{}),ar(n,()=>Yj(Ue,Xa),[]),W(()=>()=>{L4(Ee),Ee.scheduledWork.dispose()},[Ee]),he(()=>{var $e;($e=Ee.runPendingScrollToEnd)==null||$e.call(Ee)}),W(()=>{qt||Bu(Ue)},[Ue,qt]);let Yn=K(()=>({getRenderedItem:$e=>e6(Ue,$e),onMomentumScrollEnd:$e=>{qW(Ue),Ee.props.onMomentumScrollEnd&&Ee.props.onMomentumScrollEnd($e)},onScroll:$e=>zj(Ue,$e),onScrollBeginDrag:$e=>{var _t,dn;rN(Ue),(dn=(_t=Ee.props).onScrollBeginDrag)==null||dn.call(_t,$e)},onScrollEnd:()=>rN(Ue)}),[]),Ui=qj(tr,te,Ue,Yn.onScroll),mo=kn;return De(ni,null,De(Tj,{...xt,alignItemsAtEnd:k,canRender:Do,contentContainerStyle:zt,contentInset:_,freshDataTransitionEpoch:Ee.freshDataTransitionEpoch,getRenderedItem:Yn.getRenderedItem,horizontal:te,initialContentOffset:Wr,ListEmptyComponent:E.length===0?nt:void 0,ListFooterComponent:rt,ListFooterComponentStyle:Ve,ListHeaderComponent:ne,onInternalScrollBeginDrag:Yn.onScrollBeginDrag,onInternalScrollEnd:Yn.onScrollEnd,onLayout:rr,onLayoutFooter:Xn,onMomentumScrollEnd:Yn.onMomentumScrollEnd,onScroll:Ui,recycleItems:on,refreshControl:mo?Ut>0?mf(mo,{progressViewOffset:((w=mo.props.progressViewOffset)!=null?w:0)+Ut}):mo:Mt&&De(Vj,{onRefresh:Mt,progressViewOffset:(Tn||0)+Ut,refreshing:!!O}),refScrollView:Nn,renderScrollComponent:ye,scrollAdjustHandler:(L=Nt.current)==null?void 0:L.scrollAdjustHandler,scrollEventThrottle:0,snapToIndices:ht,stickyHeaderIndices:tr,style:vt,useWindowScroll:nr}),Jo&&k4)});var l6=i6;var E_=l6;ue();ue();function d6(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function c6(e,t){let n=t?.trim();if(!n)return e;let o=new RegExp(`^${d6(n)}(?:\\s*[.:/-]\\s*|\\s+)`,"iu");return e.replace(o,"").trim()||e}function YC(e,t){let n=t?.preferShortName&&e.shortName?e.shortName:e.name;return c6(n,e.subProvider)}function Cd(e){return YC(e,{preferShortName:!0})}var JC="model:",ZC="unavailable-models:",eb="action:",bd="pluginActions:manage";function Ku(e,t){return`${JC}${e.length}:${e}${t}`}function tb(e){if(!e.startsWith(JC))return null;let t=e.slice(JC.length),n=t.indexOf(":");if(n===-1)return null;let o=t.slice(0,n);if(!/^\d+$/.test(o))return null;let r=Number(o),a=t.slice(n+1);return!Number.isSafeInteger(r)||r>a.length?null:{instanceId:a.slice(0,r),slug:a.slice(r)}}function R_(e){return`${ZC}${e}`}function M_(e){return e.startsWith(ZC)?e.slice(ZC.length):null}function Vu(e){return`${eb}${e}`}function N_(e){if(!e.startsWith(eb))return null;let t=e.slice(eb.length);return t.length>0?t:null}var __=pe(function(t){let{t:n}=Ce(),o=t.isFavorite?n("modelPicker.removeFromFavorites"):n("modelPicker.addToFavorites"),r=[t.providerDisplayName,t.model.subProvider,t.providerAccountEmail].filter(s=>typeof s=="string"&&s.length>0).join(" \xB7 "),a=b(bl,{hideIndicator:!0,index:t.index,value:Ku(t.instanceId,t.model.slug),disabled:!!t.disabledReason,contentClassName:"flex w-full items-center gap-3",className:$("group relative w-full !min-w-0 max-w-full cursor-pointer rounded-md px-2 py-2 transition-colors duration-(--control-duration)","hover:bg-[color-mix(in_srgb,var(--popover)_90%,var(--contrast-foreground))] data-highlighted:bg-[color-mix(in_srgb,var(--popover)_90%,var(--contrast-foreground))] data-selected:bg-foreground/[0.08] data-selected:text-foreground data-selected:ring-0 [&[data-highlighted][data-selected]]:bg-[color-mix(in_srgb,var(--popover)_90%,var(--contrast-foreground))]",t.disabledReason&&"data-disabled:pointer-events-auto data-disabled:cursor-not-allowed data-disabled:hover:bg-transparent"),children:[b("div",{className:"min-w-0 flex-1 text-left",children:[u("div",{className:"flex min-w-0 items-center gap-2",children:u("div",{className:"min-w-0 truncate text-xs font-medium leading-snug",children:t.useTriggerLabel?Cd(t.model):YC(t.model,t.preferShortName?{preferShortName:!0}:void 0)})}),t.showProvider&&b("div",{className:"mt-1 flex items-center gap-1.5",children:[u(Tr,{driver:t.driver,displayName:t.providerDisplayName,accentColor:t.providerAccentColor,className:"size-icon-2",iconClassName:"size-3",indicatorBackground:"var(--popover)"}),u("span",{className:"truncate text-xs font-normal leading-snug text-muted-foreground/70",children:r})]})]}),b("div",{className:"flex shrink-0 items-center gap-1.5",children:[t.jumpLabel?u(Bf,{className:"h-4 min-w-0 rounded-sm px-1.5 text-[10px]",children:t.jumpLabel}):null,b(Ye,{children:[u(Ze,{render:u(ce,{size:"icon-xs",variant:"ghost",className:$("-mr-1 shrink-0 text-muted-foreground/70 opacity-64 transition-[color,opacity] hover:text-foreground hover:opacity-100 group-hover:opacity-100",t.isFavorite&&"text-foreground opacity-100"),onClick:s=>{s.stopPropagation(),t.onToggleFavorite()},onKeyDown:s=>{s.stopPropagation()},softDisabled:!!t.disabledReason,"aria-label":o,children:u(ss,{className:$("size-icon-1",t.isFavorite&&"fill-current text-yellow-500")})})}),u(Je,{side:"top",align:"center",children:o})]})]})]}),i=t.disabledReason??t.actionLabel;return i?b(Ye,{children:[u(Ze,{render:a}),u(Je,{side:"left",align:"center",className:"max-w-64 text-balance leading-snug",children:i})]}):a});ue();function u6(e,t){let n=e.displayName,o=e.enabled?e.readiness:"disabled";if(BM(o))return n;let r=UM(o,t),a=e.snapshot.readiness.detail?.trim();return a?t("instance.statusWithDetail",{name:n,status:r,detail:a}):t("instance.status",{name:n,status:r})}var f6="pointer-events-none absolute -right-1 top-1/2 z-10 h-5 w-0.75 -translate-y-1/2 rounded-l-full bg-primary",p6="pointer-events-none absolute -right-0.5 top-0.5 z-10 flex size-3.5 items-center justify-center rounded-full bg-transparent shadow-sm ",m6=`${p6} text-update-foreground`,D_="left",O_=8,F_="max-w-64 text-balance font-normal leading-snug",B_=pe(function(t){let{t:n}=Ce(),{t:o}=Ce(),r=Wt().model.isProviderUpdateInFlight,a=p=>{t.onSelectInstance(p)},i=t.showFavorites??!0,[s,l]=J(null),d=N(null),[c,f]=J(null);return he(()=>{let p=d.current;if(!p)return;let m=Array.from(p.querySelectorAll("[data-model-picker-provider]")).find(g=>g.dataset.modelPickerProvider===t.selectedInstanceId);if(!m){f(null);return}f(m.offsetTop+m.offsetHeight/2-10)},[t.instanceEntries,t.selectedInstanceId,i]),u("div",{className:"w-11 shrink-0 overflow-hidden bg-muted/30","data-model-picker-sidebar":"true",children:u("div",{className:"h-full overflow-y-auto overscroll-contain [-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:b("div",{ref:d,className:"relative flex min-h-full flex-col gap-1 p-1",children:[c!==null?u("div",{"data-model-picker-selected-indicator":"true",className:$(f6,"right-0 translate-y-0 transition-[top] duration-200 ease-out"),style:{top:c}}):null,i?b(Pe,{children:[u("div",{className:"relative w-full","data-model-picker-provider":"favorites",children:b(Ye,{children:[u(Ze,{render:u("button",{className:$("relative isolate flex w-full cursor-pointer aspect-square items-center justify-center rounded-md transition-colors hover:bg-[color-mix(in_srgb,var(--popover)_90%,var(--contrast-foreground))] focus-visible:bg-[color-mix(in_srgb,var(--popover)_90%,var(--contrast-foreground))]"),onClick:()=>a("favorites"),type:"button","aria-label":n("modelPicker.favorites"),children:u(ss,{className:"size-5 fill-current shrink-0","aria-hidden":!0})})}),u(Je,{side:D_,sideOffset:O_,align:"center",className:F_,children:n("modelPicker.favorites")})]})}),u("div",{className:"border-b border-border/70","aria-hidden":"true"})]}):null,t.instanceEntries.map(p=>{let m=!yg(p),g=t.disabledInstanceIds?.has(p.instanceId)??!1,h=m||g,v=t.selectedInstanceId===p.instanceId,y=s===p.instanceId,x=r(p.snapshot),C=p.snapshot.versionAdvisory?.latestVersion!=null?o("updates.rail.updatingToVersion",{version:p.snapshot.versionAdvisory.latestVersion}):o("updates.rail.updating"),w=m?u6(p,o):g?t.getDisabledInstanceTooltip?.(p)??p.displayName:x?`${p.displayName} \u2014 ${C}`:p.displayName,L=b("button",{className:$("relative isolate flex w-full cursor-pointer aspect-square items-center justify-center rounded-md transition-colors hover:bg-[color-mix(in_srgb,var(--popover)_90%,var(--contrast-foreground))] focus-visible:bg-[color-mix(in_srgb,var(--popover)_90%,var(--contrast-foreground))]",h&&"opacity-50 cursor-not-allowed hover:bg-transparent"),"data-provider-accent-color":p.accentColor,onClick:()=>!h&&a(p.instanceId),onMouseEnter:()=>l(p.instanceId),onMouseLeave:()=>l(k=>k===p.instanceId?null:k),onFocus:()=>l(p.instanceId),onBlur:()=>l(k=>k===p.instanceId?null:k),disabled:h,type:"button","aria-label":h?w:p.displayName,children:[u(Tr,{driver:p.driverKind,displayName:p.displayName,accentColor:p.accentColor,className:"size-6",iconClassName:"size-5",indicatorBackground:y&&!h?"var(--muted)":v?"var(--background)":"color-mix(in oklab, var(--muted) 30%, transparent)"}),x?u("span",{className:m6,"aria-hidden":!0,children:u(Tf,{className:"size-2.5"})}):null]}),S=h?u("span",{className:"relative block w-full",children:L}):L;return u("div",{className:"relative w-full","data-model-picker-provider":p.instanceId,children:b(Ye,{children:[u(Ze,{render:S}),b(Je,{side:D_,sideOffset:O_,align:"center",className:F_,children:[w,p.accountEmail?u("span",{className:"mt-0.5 block text-[10px] text-muted-foreground",children:p.accountEmail}):null]})]})},p.instanceId)})]})})})});function z_(e,t){let n=[],o=[];for(let r of e)t(r)?o.push(r):n.push(r);return{current:n,unavailable:o}}var g6=24;function h6(e){return[co(e.name),...e.shortName?[co(e.shortName)]:[],...e.subProvider?[co(e.subProvider)]:[],co(e.driverKind),co(e.providerDisplayName),...e.providerAccountEmail?[co(e.providerAccountEmail)]:[],nb(e),...e.slug?[co(e.slug)]:[]]}function v6(e,t,n){return Hr({value:e,query:t,exactBase:n,prefixBase:n+2,boundaryBase:n+4,includesBase:n+6,...t.length>=3?{fuzzyBase:n+100}:{}})}function nb(e){return co([e.name,e.shortName,e.subProvider,e.driverKind,e.providerDisplayName,e.providerAccountEmail,e.slug].filter(t=>typeof t=="string"&&t.length>0).join(" "))}function U_(e,t){let n=co(t).split(/\s+/u).filter(r=>r.length>0);if(n.length===0)return 0;let o=0;for(let r of n){let a=[];for(let i=0;i<e.length;i+=1){let s=v6(e[i],r,i*10);s!==null&&a.push(s)}if(a.length===0)return null;o+=Math.min(...a)}return o}function H_(e,t){let n=U_(h6(e),t);return n===null?null:e.isFavorite?n-g6:n}function $_(e,t){return U_([co(e.title),co(e.description??"")],t)}function K_({top:e,bottom:t}){if(!(!e&&!t))return $("virtualized-scroll-fade [--fade-size:1.5rem]",e&&t&&"[--virtualized-scroll-fade-mask:linear-gradient(to_bottom,transparent,black_var(--fade-size),black_calc(100%-var(--fade-size)),transparent)]",e&&!t&&"[--virtualized-scroll-fade-mask:linear-gradient(to_bottom,transparent,black_var(--fade-size))]",!e&&t&&"[--virtualized-scroll-fade-mask:linear-gradient(to_bottom,black_calc(100%-var(--fade-size)),transparent)]")}function V_(e,t){return`${e}:${t}`}var q_=new Map,W_=[],y6=[],x6=[];function qu(e){return Ku(e.instanceId,e.slug)}function G_(e,t,n){return t.environmentId===n&&t.instanceId===e.instanceId&&t.model===e.slug}function C6(){return u("div",{className:"h-0.5"})}function ob(e){return e?.trim()||null}function j_({label:e}){return u("div",{className:"px-2 pt-2 pb-1 text-[10px] font-medium uppercase leading-none tracking-wide text-muted-foreground/70",children:e})}var b6=pe(function({index:t,itemKey:n,action:o,showSectionHeader:r}){let{t:a}=Ce(),i=ob(o.description);return b(Pe,{children:[r?u(j_,{label:a("modelPicker.plugins")}):null,b(bl,{hideIndicator:!0,index:t,value:n,className:"group w-full cursor-pointer rounded-md px-2 py-2",contentClassName:"flex w-full items-center gap-2",children:[u(rs,{className:"size-4 shrink-0 text-muted-foreground/70"}),b("div",{className:"min-w-0 flex-1 text-left",children:[u("div",{className:"truncate text-xs font-medium leading-snug",children:o.title}),u("div",{className:"mt-1 truncate text-xs font-normal leading-snug text-muted-foreground/70",children:i})]})]})]})}),w6=pe(function({index:t,showSectionHeader:n}){let{t:o}=Ce();return b(Pe,{children:[n?u(j_,{label:o("modelPicker.plugins")}):null,b(bl,{hideIndicator:!0,index:t,value:bd,className:"group w-full cursor-pointer rounded-md px-2 py-2",contentClassName:"flex w-full items-center gap-2",children:[u(Dd,{className:"size-4 shrink-0 text-muted-foreground/70"}),u("span",{className:"min-w-0 flex-1 truncate text-left text-xs font-normal leading-snug text-muted-foreground",children:o("modelPicker.managePlugins")})]})]})}),Q_=pe(function(t){let{keybindings:n,modelOptionsByInstance:o,instanceEntries:r,hideInstanceRail:a=!1,getModelDisabledReason:i,getModelContinuationLabel:s,onContinueInModel:l,onInstanceModelChange:d,onManagePlugins:c,onSelectPluginAction:f}=t,p=t.pluginActions??W_,m=t.selectedPluginActionKey??null,{t:g}=Ce(),{t:h}=Ce(),v=Wt(),[y,x]=J(""),[C,w]=J(!1),[L,S]=J(!1),k=N(null),I=N(null),T=N(null),A=v.environment.useActiveEnvironmentId(),P=v.settings.useClientSettings(O=>O.favorites??[]),_=K(()=>A===null?x6:P.filter(O=>O.environmentId===A),[A,P]),[E,F]=J(()=>t.lockedProvider!==null?t.activeInstanceId:_.length>0?"favorites":t.activeInstanceId),[B,V]=J(()=>new Set),Q=K(()=>n??[],[n]),Se=v.settings.useUpdateClientSettings(),H=R(()=>{k.current?.focus({preventScroll:!0})},[]),q=R(O=>{F(O),window.requestAnimationFrame(()=>{H()})},[H]);he(()=>{H();let O=window.requestAnimationFrame(()=>{H()}),fe=window.setTimeout(()=>{H()},0);return()=>{window.cancelAnimationFrame(O),window.clearTimeout(fe)}},[H]);let ee=K(()=>new Set(_.map(O=>V_(O.instanceId,O.model))),[_]),G=R(O=>A===null?!1:_.some(fe=>G_(O,fe,A)),[A,_]),te=K(()=>new Map(r.map(O=>[O.instanceId,O])),[r]),me=R(O=>t.lockedProvider===null?!0:O.driverKind!==t.lockedProvider?!1:t.lockedContinuationGroupKey?O.continuationGroupKey===t.lockedContinuationGroupKey:!0,[t.lockedContinuationGroupKey,t.lockedProvider]),U=K(()=>{let O=new Set;for(let fe of r)yg(fe)&&O.add(fe.instanceId);return O},[r]),Y=K(()=>{let O=[];for(let[fe,ye]of o){let Te=te.get(fe);if(Te&&U.has(fe))for(let Me of ye)O.push({slug:Me.slug,name:Me.name,...Me.shortName?{shortName:Me.shortName}:{},...Me.subProvider?{subProvider:Me.subProvider}:{},instanceId:fe,driverKind:Te.driverKind,instanceDisplayName:Te.displayName,...Te.accentColor?{instanceAccentColor:Te.accentColor}:{},...Te.accountEmail?{instanceAccountEmail:Te.accountEmail}:{},...Te.continuationGroupKey?{continuationGroupKey:Te.continuationGroupKey}:{}})}return O},[o,te,U]),se=t.lockedProvider!==null,ge=y.trim().length>0,ie=K(()=>{if(!se)return;let O=new Set;for(let fe of r)me(fe)||O.add(fe.instanceId);return O},[r,se,me]),Ae=K(()=>{let O=r.filter(Pu);if(!se)return O;let fe=[],ye=[];for(let Te of O)me(Te)?fe.push(Te):ye.push(Te);return[...fe,...ye]},[r,se,me]),Xe=!a&&!ge&&Ae.length>0,nt=K(()=>r.map(O=>O.instanceId),[r]),rt=K(()=>{let O=Y;if(y.trim()){let fe=O.map(ye=>({model:ye,score:H_({name:ye.name,...ye.shortName?{shortName:ye.shortName}:{},...ye.subProvider?{subProvider:ye.subProvider}:{},driverKind:ye.driverKind,providerDisplayName:ye.instanceDisplayName,...ye.instanceAccountEmail?{providerAccountEmail:ye.instanceAccountEmail}:{},isFavorite:G(ye)},y),isFavorite:G(ye),tieBreaker:nb({name:ye.name,...ye.shortName?{shortName:ye.shortName}:{},...ye.subProvider?{subProvider:ye.subProvider}:{},driverKind:ye.driverKind,providerDisplayName:ye.instanceDisplayName,...ye.instanceAccountEmail?{providerAccountEmail:ye.instanceAccountEmail}:{}})})).filter(ye=>ye.score!==null);if(t.lockedProvider!==null){let ye=[];for(let Te of fe)me(Te.model)&&ye.push(Te);return ye.toSorted((Te,Me)=>{let ht=Te.score-Me.score;return ht!==0?ht:Te.isFavorite!==Me.isFavorite?Te.isFavorite?-1:1:Te.tieBreaker.localeCompare(Me.tieBreaker)}).map(Te=>Te.model)}return fe.toSorted((ye,Te)=>{let Me=ye.score-Te.score;return Me!==0?Me:ye.isFavorite!==Te.isFavorite?ye.isFavorite?-1:1:ye.tieBreaker.localeCompare(Te.tieBreaker)}).map(ye=>ye.model)}return t.lockedProvider!==null?(O=O.filter(fe=>me(fe)),E==="favorites"?O=O.filter(fe=>G(fe)):O=O.filter(fe=>fe.instanceId===E)):E==="favorites"?O=O.filter(fe=>G(fe)):O=O.filter(fe=>fe.instanceId===E),v.model.sortProviderModelItems(O,{favoriteModelKeys:ee,groupFavorites:E!=="favorites",instanceOrder:E==="favorites"?nt:[]})},[ee,Y,nt,me,t.lockedProvider,y,E,G]),Ve=R((O,fe)=>v.model.resolvePickerRowAction({disabledReason:i?.(O,fe)??null,continuationLabel:l?s?.(O,fe)??null:null}),[s,i,l]),ne=R(O=>Ve(O.instanceId,O.slug),[Ve]),we=K(()=>z_(rt,O=>ne(O).kind==="blocked"),[rt,ne]),j=K(()=>we.unavailable.length===0?null:{key:R_(E),models:we.unavailable,isExpanded:B.has(E)},[B,we,E]),X=K(()=>[...we.current,...j?.isExpanded?j.models:[]],[we,j]),ae=f!==void 0,oe=K(()=>{if(!ae)return W_;let O=y.trim();return O.length===0?p:p.map(fe=>({action:fe,score:$_(fe,O)})).filter(fe=>fe.score!==null).toSorted((fe,ye)=>fe.score-ye.score||fe.action.title.localeCompare(ye.action.title)).map(fe=>fe.action)},[y,p,ae]),ft=ae&&(!ge||oe.length>0),pt=K(()=>ft?[...oe.map(O=>Vu(O.id)),bd]:y6,[ft,oe]),yt=K(()=>new Map(oe.map(O=>[Vu(O.id),O])),[oe]),Pt=pt[0]??null,nn=R(O=>{V(fe=>{let ye=new Set(fe);return ye.has(O)?ye.delete(O):ye.add(O),ye})},[]),gt=R((O,fe)=>{let ye=Ve(fe,O);if(ye.kind==="blocked")return;if(ye.kind==="continue"){l?.(fe,O);return}let Te=o.get(fe);if(!Te||!te.has(fe))return;let Me=v.model.resolveSelectableModel(O,Te);Me&&d(fe,Me)},[te,o,l,d,Ve]),Bt=R(O=>{let fe=M_(O);if(fe){nn(fe);return}if(O===bd){c?.();return}let ye=N_(O);if(ye!==null){f?.(ye);return}let Te=X.find(ht=>qu(ht)===O);if(!Te||ne(Te).kind==="blocked")return;let Me=tb(O);Me&>(Me.slug,Me.instanceId)},[gt,c,f,nn,X,ne]),Mt=R(O=>{if(A===null)return;let fe=P.findIndex(Te=>G_(O,Te,A)),ye=[...P];fe>=0?ye.splice(fe,1):ye.push({environmentId:A,instanceId:O.instanceId,model:O.slug}),Se({favorites:ye})},[A,P,Se]),St=K(()=>{let O=new Map,fe=0;for(let ye of X){if(Ve(ye.instanceId,ye.slug).kind==="blocked")continue;let Te=v.keybindings.modelPickerJumpCommandForIndex(fe);if(!Te)return O;O.set(qu(ye),Te),fe+=1}return O},[Ve,X]),In=K(()=>[...St.keys()],[St]),ct=K(()=>[...Y.map(O=>qu(O)),...j?[j.key]:[],...ae?[...p.map(O=>Vu(O.id)),bd]:[]],[Y,p,ae,j]),ln=K(()=>{let O=X.map(fe=>qu(fe));return j&&O.splice(we.current.length,0,j.key),pt.length>0?[...O,...pt]:O},[j,we,pt,X]),ro=K(()=>new Map(X.map(O=>[qu(O),O])),[X]),Vt=R(()=>{let O=I.current?.getScrollableNode();if(!(O instanceof HTMLElement))return;let fe=Math.max(0,O.scrollHeight-O.clientHeight);w(O.scrollTop>1),S(fe-O.scrollTop>1)},[]),bn=K(()=>({terminalFocus:!1,terminalOpen:t.terminalOpen,modelPickerOpen:!0}),[t.terminalOpen]),Tn=K(()=>{if(St.size===0)return q_;let O={platform:navigator.platform,context:bn},fe=new Map;for(let[ye,Te]of St){let Me=v.keybindings.shortcutLabelForCommand(Q,Te,O);Me&&fe.set(ye,Me)}return fe.size>0?fe:q_},[Q,St,bn]),on=m===null?Ku(t.activeInstanceId,t.model):Vu(m),kn=K(()=>({favoritesSet:ee,modelJumpLabelByKey:Tn,selectedItemKey:on}),[ee,Tn,on]);return v.pane.useKeydown(O=>{if(O.defaultPrevented||O.repeat)return;let fe=v.keybindings.resolveShortcutCommand(O,Q,{platform:navigator.platform,context:bn}),ye=v.keybindings.modelPickerJumpIndexFromCommand(fe??"");if(ye===null)return;let Te=In[ye];if(!Te)return;let Me=tb(Te);Me&&(O.preventDefault(),O.stopPropagation(),gt(Me.slug,Me.instanceId))},{capture:!0}),he(()=>{w(!1),S(ln.length>5);let O=0,fe=window.requestAnimationFrame(()=>{Vt(),O=window.requestAnimationFrame(Vt)});return()=>{window.cancelAnimationFrame(fe),window.cancelAnimationFrame(O)}},[ln,Vt]),u(fS,{delay:0,children:b("div",{className:"relative flex h-screen max-h-86.5 w-screen max-w-90 flex-row overflow-hidden","data-model-picker-content":"true",children:[Xe&&u(B_,{selectedInstanceId:E,onSelectInstance:q,instanceEntries:Ae,showFavorites:!0,...ie?{disabledInstanceIds:ie,getDisabledInstanceTooltip:O=>h("instance.lockedToThread",{name:O.displayName})}:{}}),u(lS,{inline:!0,items:ct,filteredItems:ln,filter:null,autoHighlight:!0,open:!0,virtualized:!0,value:on,onItemHighlighted:(O,fe)=>{T.current=typeof O=="string"?O:null,fe.reason==="keyboard"&&fe.index>=0&&I.current?.scrollIndexIntoView?.({index:fe.index,animated:!1})},onValueChange:O=>{typeof O=="string"&&Bt(O)},children:b("div",{className:$("flex min-h-0 flex-1 flex-col overflow-hidden bg-muted/40",Xe&&"border-l border-border/70"),children:[u("div",{className:"px-2 pt-2",children:u("div",{className:"border-b border-border/70 pb-2.5 transition-colors focus-within:border-ring",children:u(cS,{ref:k,className:"[&_input]:h-control-3 [&_input]:font-sans [&_input]:leading-control-3",inputClassName:"rounded-none bg-transparent text-sm",placeholder:g("modelPicker.searchPlaceholder"),showTrigger:!1,startAddon:u(is,{className:"-translate-x-0.5 size-4 shrink-0 text-muted-foreground opacity-70"}),value:y,onChange:O=>x(O.target.value),onKeyDown:O=>{if(O.key==="Escape"){O.preventDefault(),O.stopPropagation(),t.onRequestClose?.();return}if(O.key==="Enter"&&T.current){O.preventBaseUIHandler?.(),O.preventDefault(),O.stopPropagation(),Bt(T.current);return}O.stopPropagation()},onMouseDown:O=>O.stopPropagation(),onTouchStart:O=>O.stopPropagation(),size:"sm",unstyled:!0})})}),u("div",{className:"relative min-h-0 flex-1 overflow-hidden pr-px",children:u(uS,{className:"size-full min-w-0 p-0 not-empty:p-0",children:u(E_,{ref:I,data:ln,extraData:kn,keyExtractor:O=>O,renderItem:({item:O,index:fe})=>{let ye=j?.key===O?{label:g("modelPicker.unavailableModels"),count:j.models.length,isExpanded:j.isExpanded}:null;if(ye)return b(bl,{hideIndicator:!0,index:fe,value:O,"aria-expanded":ye.isExpanded,className:"group w-full cursor-pointer rounded-md px-2 py-2",contentClassName:"flex w-full items-center gap-3",children:[b("div",{className:"min-w-0 flex-1 text-left",children:[u("div",{className:"text-xs font-medium leading-snug",children:ye.label}),u("div",{className:"mt-1 text-xs font-normal leading-snug text-muted-foreground/70",children:g("modelPicker.modelCount",{count:ye.count})})]}),u(Ko,{className:$("size-4 transition-transform",ye.isExpanded&&"rotate-90")})]});let Te=yt.get(O);if(Te)return u(b6,{index:fe,itemKey:O,action:Te,showSectionHeader:O===Pt});if(O===bd)return u(w6,{index:fe,showSectionHeader:O===Pt});let Me=ro.get(O);if(!Me)return null;let ht=ne(Me);return u(__,{index:fe,model:Me,instanceId:Me.instanceId,driver:Me.driverKind,providerDisplayName:Me.instanceDisplayName,providerAccentColor:Me.instanceAccentColor,providerAccountEmail:Me.instanceAccountEmail,isFavorite:G(Me),isSelected:O===on,showProvider:!0,preferShortName:!se,useTriggerLabel:!1,jumpLabel:Tn.get(O)??null,disabledReason:ht.kind==="blocked"?ht.reason:null,actionLabel:ht.kind==="continue"?ht.label:null,onToggleFavorite:()=>Mt(Me)},O)},estimatedItemSize:52,drawDistance:480,recycleItems:!0,contentContainerClassName:"pl-2 pr-px",ItemSeparatorComponent:C6,onLayout:Vt,onScroll:Vt,className:$("scrollbar-gutter-stable h-full overflow-x-hidden overscroll-y-contain py-1.5 [&::-webkit-scrollbar-track]:my-2",K_({top:C,bottom:L}))})})}),u(dS,{className:"not-empty:py-6 empty:h-0 text-xs font-normal leading-snug",children:g("modelPicker.noModelsFound")})]})})]})})});function Hg(e){switch(e){case"probing":return{seatKey:"modelPicker.fetchingModels",blockKey:"composer.modelFetching",canChooseModel:!1};case"missing":return{seatKey:"modelPicker.chooseModel",blockKey:"composer.modelMissing",canChooseModel:!0};default:return null}}function X_(e){return e.submissionTarget==="provider-turn"&&e.status!=="known"}function S6(e){let t=e.unknownModelLabel?.trim();if(t)return t;let n=e.catalogOptions.find(o=>o.slug===e.model);return n?Cd(n):e.model}var rb=pe(function(t){let{t:n}=Ce(),[o,r]=J(!1),i=ea()&&(t.open??o),s=K(()=>t.instanceEntries.find(C=>C.instanceId===t.activeInstanceId)??null,[t.activeInstanceId,t.instanceEntries]),l=t.activeInstanceId,d=t.modelOptionsByInstance.get(l)??[],c=Hg(t.modelStatus??"known"),f=S6({model:t.model,catalogOptions:d,unknownModelLabel:c?n(c.seatKey):null}),p=C=>{t.onOpenChange?.(C),t.open===void 0&&r(C)};W(()=>{if(!i)return;let{documentElement:C,body:w}=document,L=C.style.overscrollBehavior,S=w.style.overflow,k=w.style.paddingRight,I=window.innerWidth-C.clientWidth;C.style.overscrollBehavior="contain",w.style.overflow="hidden",I>0&&(w.style.paddingRight=`${I}px`);let T=_=>_ instanceof Element&&_.closest("[data-model-picker-content]"),A=_=>{T(_.target)||_.preventDefault()},P=_=>{T(_.target)||_.preventDefault()};return document.addEventListener("wheel",A,{capture:!0,passive:!1}),document.addEventListener("touchmove",P,{capture:!0,passive:!1}),()=>{document.removeEventListener("wheel",A,{capture:!0}),document.removeEventListener("touchmove",P,{capture:!0}),C.style.overscrollBehavior=L,w.style.overflow=S,w.style.paddingRight=k}},[i]);let m=(C,w)=>{t.disabled||(t.onInstanceModelChange(C,w),p(!1))},g=(C,w)=>{t.disabled||(t.onContinueInModel?.(C,w),p(!1))},h=C=>{t.disabled||(t.onSelectPluginAction?.(C),p(!1))},v=()=>{t.onManagePlugins?.(),p(!1)},y=t.selectedPluginActionKey==null?null:t.pluginActions?.find(C=>C.id===t.selectedPluginActionKey)??null,x=y?ob(y.description):null;return b(yl,{open:i,onOpenChange:C=>{if(t.disabled){p(!1);return}p(C)},children:[b(Cl,{render:u(Xo,{"aria-label":t.triggerAriaLabel,variant:t.triggerVariant??"ghost","data-chat-provider-model-picker":"true",className:$("min-w-0 justify-between whitespace-nowrap",t.compact?"max-w-42 shrink-0":"max-w-48 shrink sm:max-w-56",t.triggerClassName),disabled:t.disabled}),children:[u("span",{className:"flex min-w-0 flex-1 items-center gap-1.5",children:y?b(Pe,{children:[u(rs,{className:"size-4 shrink-0"}),b(Ye,{children:[b(Ze,{render:u("span",{className:"flex min-w-0 flex-1 items-center gap-1.5 truncate"}),children:[u("span",{className:"shrink-0",children:y.title}),x?b("span",{className:"min-w-0 truncate text-muted-foreground/80",children:["\xB7 ",x]}):null]}),u(Je,{side:"top",children:x?`${y.title} \xB7 ${x}`:y.title})]})]}):b(Pe,{children:[t.showInstanceOnTrigger!==!1&&s?u(Tr,{driver:s.driverKind,displayName:s.displayName,accentColor:s.accentColor,className:$("size-4",t.activeProviderIconClassName),iconClassName:"size-4",indicatorBackground:"var(--contrast-input)"}):null,b(Ye,{children:[u(Ze,{render:u("span",{className:"min-w-0 flex-1 overflow-hidden truncate"}),children:f}),u(Je,{side:"top",children:f})]})]})}),u("span",{"aria-hidden":"true",className:"flex items-center",children:u(ma,{})})]}),u(xl,{align:"start",className:"before:hidden [--viewport-inline-padding:0]",viewportClassName:"!overflow-hidden rounded-[calc(var(--radius-lg)-1px)] p-0 [clip-path:inset(0_round_calc(var(--radius-lg)-1px))]",children:u(Q_,{activeInstanceId:l,model:t.model,lockedProvider:t.lockedProvider,lockedContinuationGroupKey:t.lockedContinuationGroupKey??null,instanceEntries:t.instanceEntries,...t.hideInstanceRail?{hideInstanceRail:!0}:{},...t.keybindings?{keybindings:t.keybindings}:{},modelOptionsByInstance:t.modelOptionsByInstance,terminalOpen:t.terminalOpen??!1,onRequestClose:()=>p(!1),...t.getModelDisabledReason?{getModelDisabledReason:t.getModelDisabledReason}:{},...t.getModelContinuationLabel?{getModelContinuationLabel:t.getModelContinuationLabel}:{},...t.onContinueInModel?{onContinueInModel:g}:{},onInstanceModelChange:m,...t.pluginActions?{pluginActions:t.pluginActions}:{},selectedPluginActionKey:t.selectedPluginActionKey??null,...t.onSelectPluginAction?{onSelectPluginAction:h}:{},...t.onManagePlugins?{onManagePlugins:v}:{}})})]})});function Y_(e){let{slots:t,...n}=e,o=u(rb,{...n,hideInstanceRail:!0,showInstanceOnTrigger:!1}),r=t?.renderSlot("conversation.input.model",n,o);return u("span",{"data-conversation-slot":"conversation.input.model",children:r??o})}function J_(e){return u(rb,{...e,hideInstanceRail:!0,showInstanceOnTrigger:!1})}function ab(e){let{t}=Ce();if(!e.showInteractionModeToggle)return null;let n=e.interactionMode==="plan",o=t(n?"composer.planModeTooltip":"composer.defaultModeTooltip");return b(Ye,{children:[b(Ze,{render:u(Xo,{"data-composer-plan-toggle":"true",className:$("shrink-0 whitespace-nowrap",n?"bg-accent text-accent-foreground hover:bg-accent/90":"text-secondary-label hover:text-foreground"),type:"button",onClick:e.onToggleInteractionMode,"aria-label":o}),children:[n?u(Yo,{icon:Zd,className:"text-current opacity-100"}):u(Yo,{icon:ji,opticalSize:"large"}),u("span",{className:"sr-only sm:not-sr-only",children:t(n?"composer.interactionModePlan":"composer.interactionModeBuild")})]}),u(Je,{side:"top",children:o})]})}function Z_(e){return u(ab,{...e})}ue();var Vr=["approval-required","auto-accept-edits","auto","full-access"];var I6={"approval-required":Xd,"auto-accept-edits":na,auto:li,"full-access":si},T6={"approval-required":"approvalRequired","auto-accept-edits":"autoAcceptEdits",auto:"auto","full-access":"fullAccess"};function $g(){let{t:e}=Ce();return R(t=>{let n=T6[t];return{mode:t,label:e(`runtimeMode.${n}`),description:e(`runtimeMode.${n}Description`),icon:I6[t]}},[e])}ue();function eD(e){return e.description??e.name}var tD=pe(function(t){let{t:n}=Ce(),{current:o,modes:r}=t.nativeMode,a=eD(o);return!t.canSwitch||r.length<2?b(Ye,{children:[b(Ze,{render:u(Xo,{className:"shrink-0 cursor-default whitespace-nowrap font-medium",type:"button",disabled:!0,"data-composer-native-mode":o.id,"aria-label":n("composer.agentModeLabel",{name:o.name})}),children:[u(Yo,{icon:gl}),u("span",{children:o.name})]}),b(Je,{side:"top",children:[u("span",{className:"block font-medium",children:a}),r.length>1?u("span",{className:"mt-1 block text-muted-foreground text-xs",children:n("composer.agentModesList",{modes:r.map(i=>i.name).join(", ")})}):null]})]}):b(Pe,{children:[b(Ye,{children:[b(kf,{value:o.id,onValueChange:i=>t.onNativeModeChange(i),children:[b(Ze,{render:u(xg,{className:"shrink-0 whitespace-nowrap font-medium","data-composer-native-mode":o.id,"aria-label":n("composer.agentModeLabel",{name:o.name})}),children:[u(Yo,{icon:gl}),u(Af,{children:o.name})]}),b(Pf,{alignItemWithTrigger:!1,children:[r.map(i=>u(Lf,{value:i.id,hideIndicator:!0,className:"min-w-56 py-2",children:b("div",{className:"grid min-w-0 gap-0.5",children:[u("span",{className:"font-medium text-foreground",children:i.name}),i.description?u("span",{className:"text-muted-foreground text-xs leading-4",children:i.description}):null]})},i.id)),t.appliesNextTurn?u("div",{className:"border-t px-2 py-1.5 text-muted-foreground text-xs leading-4","data-composer-next-turn-note":"popup",children:n("runtimeMode.appliesNextTurnHint")}):null]})]}),u(Je,{side:"top",children:t.appliesNextTurn?`${a} ${n("runtimeMode.appliesNextTurnHint")}`:a})]}),t.appliesNextTurn?u("span",{className:"hidden whitespace-nowrap text-muted-foreground text-xs sm:inline","data-composer-next-turn-note":"inline",children:n("runtimeMode.appliesNextTurn")}):null]})});function ib(e){let{t}=Ce(),n=$g();if(e.nativeMode)return u(tD,{nativeMode:e.nativeMode,canSwitch:e.canSwitchNativeMode,appliesNextTurn:e.runtimeModeSwitch==="next-turn",onNativeModeChange:e.onNativeModeChange});let o=n(e.runtimeMode),r=o.icon,a=e.runtimeModeSwitch==="next-turn";return b(Pe,{children:[b(Ye,{children:[b(kf,{value:e.runtimeMode,onValueChange:i=>e.onRuntimeModeChange(i),children:[b(Ze,{render:u(xg,{"data-composer-permission":"true","data-composer-runtime-mode-switch":e.runtimeModeSwitch,className:"font-medium","aria-label":t("composer.runtimeMode")}),children:[u(Yo,{icon:r}),u(Af,{children:o.label})]}),b(Pf,{alignItemWithTrigger:!1,children:[Vr.map(i=>{let s=n(i),l=s.icon;return u(Lf,{value:i,hideIndicator:!0,className:"min-w-64 py-2",children:b("span",{className:"flex items-center gap-2",children:[u(l,{className:"size-4"}),s.label]})},i)}),a?u("div",{className:"border-t px-2 py-1.5 text-muted-foreground text-xs leading-4","data-composer-next-turn-note":"popup",children:t("runtimeMode.appliesNextTurnHint")}):null]})]}),u(Je,{side:"top",children:a?t("runtimeMode.appliesNextTurnHint"):o.label})]}),a?u("span",{className:"hidden whitespace-nowrap text-muted-foreground text-xs sm:inline","data-composer-next-turn-note":"inline",children:t("runtimeMode.appliesNextTurn")}):null]})}function nD(e){return u(ib,{...e})}function Wu(e){let t=e.slots?.renderSlot(e.name,e.owner??{},e.fallback);return u("span",{"data-conversation-slot":e.name,children:t??e.fallback})}ue();var oD=pe(function(t){let{t:n}=Ce(),o=$g();return b(Eo,{children:[u(Mo,{render:u(ce,{size:"sm",variant:"ghost",className:"shrink-0 px-2 text-muted-foreground/70 hover:text-foreground/80","aria-label":n("composer.moreComposerControls")}),children:u(sr,{"aria-hidden":"true",className:"size-4"})}),b(Ro,{align:"start",children:[t.traitsMenuContent?b(Pe,{children:[t.traitsMenuContent,u(di,{})]}):null,t.showInteractionModeToggle&&t.nativeMode===null?b(Pe,{children:[u("div",{className:"px-2 py-1.5 font-medium text-muted-foreground text-xs",children:n("composer.modeMenuTitle")}),b(kr,{value:t.interactionMode,onValueChange:r=>{!r||r===t.interactionMode||t.onToggleInteractionMode()},children:[u(qo,{value:"default",children:n("composer.interactionModeChat")}),u(qo,{value:"plan",children:n("composer.interactionModePlan")})]}),u(di,{})]}):null,t.nativeMode===null?b(Pe,{children:[u("div",{className:"px-2 py-1.5 font-medium text-muted-foreground text-xs",children:n("composer.accessMenuTitle")}),u(kr,{value:t.runtimeMode,onValueChange:r=>{!r||r===t.runtimeMode||t.onRuntimeModeChange(r)},children:Vr.map(r=>u(qo,{value:r,children:o(r).label},r))}),t.runtimeModeSwitch==="next-turn"?u("div",{className:"px-2 pb-1.5 text-muted-foreground text-xs leading-4",children:n("runtimeMode.appliesNextTurnHint")}):null]}):b(Pe,{children:[u("div",{className:"px-2 py-1.5 font-medium text-muted-foreground text-xs",children:n("composer.accessMenuTitle")}),t.canSwitchNativeMode&&t.nativeMode.modes.length>1?b(Pe,{children:[u(kr,{value:t.nativeMode.current.id,onValueChange:r=>{t.onNativeModeChange(String(r))},children:t.nativeMode.modes.map(r=>u(qo,{value:r.id,children:r.name},r.id))}),t.runtimeModeSwitch==="next-turn"?u("div",{className:"px-2 pb-1.5 text-muted-foreground text-xs leading-4",children:n("runtimeMode.appliesNextTurnHint")}):null]}):u("div",{className:"px-2 pb-1.5 text-foreground text-sm","data-composer-native-mode":t.nativeMode.current.id,children:t.nativeMode.current.name})]})]})]})});ue();var rD="application/x-ycodium-composer-mention";function sb(e){return e.includes(rD)}function aD(e){let t=n=>sb(n.dataTransfer.types)?(n.preventDefault(),n.stopPropagation(),n.nativeEvent.stopPropagation(),!0):!1;return{onDragEnter(n){t(n)&&e.setDragActive(!0)},onDragOver(n){t(n)&&(n.dataTransfer.dropEffect="move",e.setDragActive(!0))},onDrop(n){if(!t(n))return;e.setDragActive(!1);let o=n.dataTransfer.getData(rD);o.length!==0&&(e.insertMentionAtEnd(`${o} `)||e.onInsertRejected())}}}function iD({documentKey:e,insertMentionAtEnd:t,onInsertRejected:n}){let[o,r]=J(!1),a=aD({insertMentionAtEnd:t,setDragActive:r,onInsertRejected:n}),i=s=>{if(!sb(s.dataTransfer.types))return;s.stopPropagation();let l=s.relatedTarget;l instanceof Node&&s.currentTarget.contains(l)||r(!1)};return he(()=>{r(!1)},[e]),W(()=>{if(!o)return;let s=()=>{r(!1)};return window.addEventListener("dragend",s),()=>window.removeEventListener("dragend",s)},[o]),{isDragOverComposer:o,composerMentionDragHandlers:a,onComposerMentionDragLeaveCapture:i}}ue();function lb(e,t,n){let o=e.trim().length-t;return o<=0?null:n("composer.promptTooLong",{count:o,excess:o.toLocaleString("en-US"),max:t.toLocaleString("en-US")})}function db(e){return e.submissionTarget==="provider-turn"?lb(e.providerInput??e.prompt,e.maxInputChars,e.t):null}function sD(e){let t=e.disabledReason??db(e);return t?(e.event?.preventDefault(),{validationMessage:t,didDispatch:!1}):e.onSend(e.event)===!1?(e.event?.preventDefault(),{validationMessage:null,didDispatch:!1}):{validationMessage:null,didDispatch:!0}}function lD({promptRef:e,maxInputChars:t,noProviderAvailable:n,isSendDisabled:o,sendDisabledReason:r,isModelSendBlocked:a,onModelSendBlocked:i,activeThreadId:s,activePendingProgress:l,composerDocumentKey:d,pendingImageCompressionsRef:c,onSend:f,onProviderInputRejectedReset:p,wasProviderInputRejected:m,onStillCompressing:g,shouldBlurMobileComposerOnSubmit:h,blurMobileComposerAfterSend:v}){let{t:y}=Ce(),[x,C]=J(null);W(()=>C(null),[d]);let w=R(S=>{C(k=>k===null?k:lb(S,t,y))},[t,y]),L=R((S,k="foreground")=>{if(n||o){S?.preventDefault();return}if(a){S?.preventDefault(),i();return}if(s&&(c.current.get(d)??0)>0){S?.preventDefault(),g();return}let I=sD({prompt:e.current,submissionTarget:l?"pending-user-input":"provider-turn",maxInputChars:t,t:y,disabledReason:r,event:S,onSend:T=>(p(),f(T,k),!m())});C(I.validationMessage),I.didDispatch&&h()&&v()},[l,s,v,d,a,o,t,n,i,p,f,g,c,e,r,h,y,m]);return{composerSubmissionError:x,setComposerSubmissionError:C,revalidatePromptLength:w,submitComposer:L}}ue();var k6=(e,t)=>t.isResponding?e("primaryActions.submitting"):t.compact?t.isLastQuestion?e("primaryActions.submit"):e("primaryActions.next"):t.isLastQuestion?t.questionIndex>0?e("primaryActions.submitAnswers"):e("primaryActions.submitAnswer"):e("primaryActions.nextQuestion"),L6=e=>{e.preventDefault()},Gu=pe(function({compact:t,pendingAction:n,isRunning:o,showPlanFollowUpPrompt:r,promptHasText:a,isSendBusy:i,sendDisabledReason:s,isEnvironmentUnavailable:l,isPreparingWorktree:d,hasSendableContent:c,preserveComposerFocusOnPointerDown:f=!1,showSendWhileRunning:p=!1,onPreviousPendingQuestion:m,onInterrupt:g,interruptArmed:h=!1,onImplementPlanInNewThread:v,shellCommandMode:y=!1,shellCommandUnavailableReason:x=null}){let{t:C}=Ce(),w=Wt(),L=f?{onPointerDown:L6}:void 0,S=w.settings.useEnvironmentIdentificationMode(),k=s!==null,I=w.devBackdrop.useVisible(S==="artwork"),T=P=>u("button",{type:"button",className:$("flex cursor-pointer items-center justify-center rounded-full bg-destructive/90 text-white shadow-xs shadow-destructive/24 inset-shadow-[0_1px_--theme(--color-white/16%)] transition-[background-color,scale] duration-(--control-duration) hover:bg-destructive hover:scale-105 active:inset-shadow-[0_1px_--theme(--color-black/8%)] active:shadow-none",h?"h-8 px-3 text-xs font-medium whitespace-nowrap ring-2 ring-destructive/60":P?"size-8 sm:size-7":p&&c?"size-9 sm:size-8":"size-8 sm:h-8 sm:w-8"),...L,onClick:g,"data-interrupt-armed":h?"":void 0,"aria-label":C(h?"primaryActions.confirmStopEsc":"primaryActions.stopGeneration"),children:h?C("primaryActions.confirmStopEsc"):u("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"currentColor","aria-hidden":"true",children:u("rect",{x:"2",y:"2",width:"8",height:"8",rx:"1.5"})})});if(n)return b("div",{className:$("flex items-center justify-end",t?"gap-1.5":"gap-2"),children:[o?T(!0):null,n.questionIndex>0?t?u(ce,{size:"icon-sm",variant:"outline",className:"rounded-full",...L,onClick:m,disabled:n.isResponding,"aria-label":C("primaryActions.previousQuestion"),children:u(Qi,{})}):u(ce,{size:"sm",variant:"outline",className:"rounded-full",...L,onClick:m,disabled:n.isResponding,children:C("primaryActions.previous")}):null,u(ce,{type:"submit",size:"sm",className:$("rounded-full bg-message-action text-message-action-foreground hover:bg-message-action-hover",t?"px-3":"px-4"),...L,disabled:l||n.isResponding||(n.isLastQuestion?!n.isComplete:!n.canAdvance),children:k6(C,{compact:t,isLastQuestion:n.isLastQuestion,isResponding:n.isResponding,questionIndex:n.questionIndex})})]});if(y){let P=u("button",{type:"submit","data-shell-command-run":"true",className:"flex h-9 w-9 items-center justify-center rounded-full bg-message-action text-message-action-foreground shadow-xs shadow-message-action/24 transition-[background-color,opacity,scale] duration-(--control-duration) enabled:cursor-pointer enabled:inset-shadow-[0_1px_--theme(--color-white/16%)] hover:scale-105 hover:bg-message-action-hover active:inset-shadow-[0_1px_--theme(--color-black/8%)] active:shadow-none disabled:pointer-events-none disabled:opacity-64 disabled:shadow-none disabled:hover:scale-100 sm:h-8 sm:w-8",...L,disabled:x!==null||!c,"aria-label":x??C("primaryActions.runInTerminal"),children:u(Vo,{"aria-hidden":"true",className:"size-4"})});return o?b(Pe,{children:[T(!1),P]}):P}if(r)return a?u(ce,{type:"submit",size:"sm",className:$("rounded-full bg-message-action text-message-action-foreground hover:bg-message-action-hover",t?"h-9 px-3 sm:h-8":"h-9 px-4 sm:h-8"),...L,disabled:i||k||l,children:C(i?"primaryActions.sendingButtonLabel":"primaryActions.refine")}):b("div",{"data-chat-composer-implement-actions":"true",className:"flex items-center justify-end",children:[u(ce,{type:"submit",size:"sm",className:"h-9 rounded-l-full rounded-r-none bg-message-action px-4 text-message-action-foreground hover:bg-message-action-hover sm:h-8",...L,disabled:i||k||l,children:C(i?"primaryActions.sendingButtonLabel":"primaryActions.implement")}),b(Eo,{children:[u(Mo,{render:u(ce,{size:"sm",variant:"default",className:"h-9 rounded-l-none rounded-r-full border-l-message-action-foreground/20 bg-message-action px-2 text-message-action-foreground hover:bg-message-action-hover sm:h-8","aria-label":C("primaryActions.implementationActions"),...L,disabled:i||k||l}),children:u(an,{})}),u(Ro,{align:"end",side:"top",children:u(lr,{disabled:i||k||l,onClick:()=>{v()},children:C("primaryActions.implementInNewThread")})})]})]});let A=b("button",{type:"submit",className:$("relative isolate flex h-9 w-9 items-center justify-center overflow-hidden rounded-full shadow-xs transition-[background-color,filter,opacity,scale] duration-(--control-duration) enabled:cursor-pointer enabled:inset-shadow-[0_1px_--theme(--color-white/16%)] hover:scale-105 active:inset-shadow-[0_1px_--theme(--color-black/8%)] active:shadow-none disabled:pointer-events-none disabled:opacity-64 disabled:shadow-none disabled:hover:scale-100 sm:h-8 sm:w-8",I?"bg-transparent text-white enabled:shadow-black/24 enabled:hover:brightness-110":"bg-message-action text-message-action-foreground enabled:shadow-message-action/24 hover:bg-message-action-hover"),...L,disabled:i||k||l||!c,"aria-label":l?C("primaryActions.environmentDisconnected"):s||C(d?"primaryActions.preparingWorktree":i?"primaryActions.sendingAriaLabel":"primaryActions.sendMessage"),children:[I?u("span",{className:"absolute inset-0 -z-10","aria-hidden":"true",children:u(mS,{compact:!0})}):null,i?u(Tf,{className:"size-3.5","aria-hidden":"true"}):u("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:u("path",{d:"M7 11.5V2.5M7 2.5L3 6.5M7 2.5L11 6.5",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})})]});return o?b(Pe,{children:[T(!1),p&&c?A:null]}):A});function dD(e){let{t}=Ce(),n=e.activePendingProgress?.activeQuestion?.multiSelect??!1;return u("div",{className:"px-3 pb-3 sm:px-4",children:b("div",{"data-chat-composer-mobile-pending-compact":"true",className:$("flex min-w-0 items-center gap-2 rounded-lg border border-border/55 bg-background/55 p-1.5 pl-3 transition-colors hover:bg-background/90",!n&&"p-0"),children:[e.isPendingUserInputChoiceOnly?null:u("button",{type:"button",className:$("min-w-0 flex-1 truncate bg-transparent py-1.5 text-left text-sm",e.activePendingProgress?.customAnswer?"text-foreground":"text-placeholder",!n&&"px-3 py-2"),onPointerDown:o=>o.preventDefault(),onClick:e.expandMobileComposer,"aria-label":t("composer.writeCustomAnswer"),children:e.activePendingProgress?.customAnswer||t("composer.writeCustomAnswer")}),e.inlineTasksBadge,e.inlineStashBadge,n?u(Gu,{compact:!0,pendingAction:e.pendingPrimaryAction,isRunning:!1,showPlanFollowUpPrompt:!1,promptHasText:!1,isSendBusy:e.isSendBusy,sendDisabledReason:e.sendDisabledReason,isEnvironmentUnavailable:e.isEnvironmentUnavailable,isPreparingWorktree:!1,hasSendableContent:!1,preserveComposerFocusOnPointerDown:!0,onPreviousPendingQuestion:e.onPreviousActivePendingUserInputQuestion,onInterrupt:e.handleInterruptPrimaryAction,onImplementPlanInNewThread:e.handleImplementPlanInNewThreadPrimaryAction}):null]})})}function cD(e){let t=e.match(/^\s{0,3}#{1,6}\s+(.+)$/m)?.[1]?.trim();return t&&t.length>0?t:null}ue();var P6=2e3,A6="min-h-8 max-w-full py-1.5 font-normal whitespace-normal text-start",E6=e=>[{decision:"cancel",label:e("composer.cancel")},{decision:"decline",label:e("composer.decline")},{decision:"acceptForSession",label:e("composer.alwaysAllowSession")},{decision:"accept",label:e("composer.approve")}];function R6(e,t){let n=[];return t<9&&n.push(String(t+1)),e==="accept"&&n.push("Enter"),e==="cancel"&&n.push("Escape"),n.length>0?n.join(" "):void 0}var uD=pe(function({requestId:t,isResponding:n,options:o,keybindings:r,declineReasonRelay:a,onRespondToApproval:i}){let{t:s}=Ce(),l=o??E6(s),d=Wt(),c=a==="native"||a==="queued",[f,p]=J(""),m=N([]);W(()=>{p("")},[t]);let g=R(v=>{let y=v==="decline"?f.trim():"";i(t,v,y.length>0?y:void 0)},[f,i,t]),h=R(v=>{let y=m.current.filter(w=>w!==null);if(y.length===0)return;let x=y.findIndex(w=>w===document.activeElement),C=x===-1?v===1?0:y.length-1:(x+v+y.length)%y.length;y[C]?.focus()},[]);return d.pane.useKeydown(v=>{if(n||d.terminalFocus.getOwner()!==null||v.isComposing||v.keyCode===229)return;let y=ui(v.target);if(r&&(!y||v.metaKey||v.ctrlKey||v.altKey)){let w=d.keybindings.approvalDecisionFromCommand(d.keybindings.resolveShortcutCommand(v,r));if(w!==null&&l.some(L=>L.decision===w)){v.preventDefault(),g(w);return}}if(y)return;let x=wS(v,l);if(x===null)return;if(v.preventDefault(),x.type==="move"){h(x.delta);return}let C=l[x.index];C&&g(C.decision)},{target:"document"}),u(Pe,{children:l.map((v,y)=>{let x=y<9?y+1:null,C=b(ce,{ref:w=>{m.current[y]=w},size:"xs",variant:v.decision==="accept"?"default":"outline",style:{height:"auto"},"aria-keyshortcuts":R6(v.decision,y),className:`${A6}${v.decision==="decline"?" text-destructive-foreground [:hover,[data-pressed]]:text-destructive-foreground":""}`,disabled:n,onClick:()=>g(v.decision),children:[u("span",{className:"min-w-0 break-words",children:v.label}),x===null?null:u(Bf,{className:"h-3.5 min-w-3.5 rounded-[3px] bg-transparent px-0 text-[10px] tabular-nums opacity-70",children:x})]},v.decision);return v.decision!=="decline"||!c?C:b(ni,{children:[u(If,{type:"text",value:f,disabled:n,maxLength:P6,placeholder:s(a==="queued"?"approval.declineReasonQueuedPlaceholder":"approval.declineReasonPlaceholder"),"aria-label":s("approval.declineReasonLabel"),"data-approval-decline-reason":"true",className:"h-8 min-w-24 max-w-56 flex-1",onChange:w=>p(w.target.value),onKeyDown:w=>{if(w.key==="Enter"){w.preventDefault(),g("decline");return}w.key==="Escape"&&(w.preventDefault(),f.length>0?p(""):w.currentTarget.blur())}}),C]},v.decision)})})});ue();var M6=["command","cmd"],N6=["file_path","filePath","path","notebook_path","notebookPath"],_6=["url"],D6=["query","q"],O6=["name","skill","skill_name","skillName"],fD=["toolName","tool_name"],pD=["description"],F6=[],B6=[];function ja(e,t,n){for(let o of t){let a=e.find(i=>i.name===o)?.value.trim();if(!(a===void 0||a.length===0))return n.add(o),a}return null}function z6(e){let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\")),n=t>=0?e.slice(t+1):e;return n.length>0?n:e}function U6(e){let t=e[0];return t===void 0?null:e.every(n=>n.path===t.path)?t.path:null}function gD(e){let t=e.args??F6,n=e.fileChanges??B6,o=new Set,r=e.detail?.trim()??"",a=r.length>0?{shape:"text",text:r}:{shape:"none"},i=null,s=a,l=null;switch(e.requestKind){case"command":{let d=ja(t,M6,o);d!==null&&(s={shape:"command",command:d});break}case"file-read":case"file-change":{let d=ja(t,N6,o)??U6(n);d!==null&&(i=z6(d),s=n.some(c=>c.path===d)?{shape:"none"}:{shape:"path",path:d});break}case"web-fetch":{let d=ja(t,_6,o);d!==null&&(s={shape:"url",url:d});break}case"web-search":{let d=ja(t,D6,o);d!==null&&(s={shape:"query",query:d});break}case"skill":{i=ja(t,O6,o)??ja(t,fD,o),l=ja(t,pD,o),t.length>0&&(s={shape:"none"});break}case"mcp-tool":case"tool":{i=ja(t,fD,o),l=ja(t,pD,o),t.length>0&&(s={shape:"none"});break}case"mcp-elicitation":{i=e.appName?.trim()||null;break}}return{kind:e.requestKind,subject:i,body:s,description:l,args:t.filter(d=>!o.has(d.name)),fileChanges:n}}var H6={"file-read":"approval.title.fileRead","file-change":"approval.title.fileChange",skill:"approval.title.skill","mcp-tool":"approval.title.tool",tool:"approval.title.tool","mcp-elicitation":"approval.title.appAccess"},$6={command:"approval.title.command","file-read":"approval.title.fileReadGeneric","file-change":"approval.title.fileChangeGeneric","web-fetch":"approval.title.webFetch","web-search":"approval.title.webSearch",skill:"approval.title.skillGeneric","mcp-tool":"approval.title.toolGeneric",tool:"approval.title.toolGeneric","mcp-elicitation":"approval.title.appAccessGeneric"},K6={command:"approval.commandLabel","file-read":"approval.fileReadLabel","file-change":"approval.fileChangeLabel","web-fetch":"approval.webFetchLabel","web-search":"approval.webSearchLabel",skill:"approval.skillLabel","mcp-tool":"approval.mcpToolLabel",tool:"approval.toolLabel","mcp-elicitation":"approval.appAccessLabel"},V6={command:"approval.commandDetailLabel",path:"approval.body.pathLabel",url:"approval.body.urlLabel",query:"approval.body.queryLabel",text:"approval.body.detailLabel"};function hD(e,t){let n=e.subject!==null?H6[e.kind]:void 0;return n!==void 0?t(n,{name:e.subject}):t($6[e.kind])}function vD(e,t){return t(K6[e])}function yD(e,t){return t(V6[e])}function xD(e){let t=e.content;if(t===void 0)return null;if(t.kind==="unified")return t.diff.length>0?t.diff:null;let n=mD(t.oldText??""),o=mD(t.newText);if(n.length===0&&o.length===0)return null;let r=`--- a/${e.path}
|
|
3790
3790
|
+++ b/${e.path}
|
|
3791
3791
|
`,a=`@@ -${n.length===0?"0,0":`1,${n.length}`} +${o.length===0?"0,0":`1,${o.length}`} @@
|
|
3792
3792
|
`,i=[...n.map(s=>`-${s}`),...o.map(s=>`+${s}`)];return`${r}${a}${i.join(`
|
|
3793
3793
|
`)}
|
|
3794
|
-
`}function
|
|
3795
|
-
`);return t.at(-1)===""?t.slice(0,-1):t}function
|
|
3794
|
+
`}function mD(e){if(e.length===0)return[];let t=e.split(`
|
|
3795
|
+
`);return t.at(-1)===""?t.slice(0,-1):t}function CD(e){let t=new Map;return e.map(n=>{let o=t.get(n.path)??0;return t.set(n.path,o+1),o===0?n.path:`${n.path}#${o}`})}function bD(e){return{additions:e.additions??0,deletions:e.deletions??0}}ue();ue();var Oge=(()=>{try{return!1}catch{return!1}})(),wD=/(?=^From [a-f0-9]+ .+$)/m,cb=/(?=^diff --git)/gm;var SD=/^(---|\+\+\+)\s+([^\t\r\n]+)/,ID=/^(---|\+\+\+)\s+[ab]\/([^\t\r\n]+)/,TD=/^diff --git (?:"a\/(.+?)"|a\/(.+?)) (?:"b\/(.+?)"|b\/(.+?))$/,kD=/^index ([0-9a-f]+)\.\.([0-9a-f]+)(?: (\d+))?$/i;var q6={hunkLineCount:50,lineHeight:20,diffHeaderHeight:44,spacing:8},Fge={...q6,hunkLineCount:1};var Bge=Object.freeze({fromStart:0,fromEnd:0});function ub(e){let t=e.length;return e.charCodeAt(t-1)===10&&(t--,e.charCodeAt(t-1)===13&&t--),e.slice(0,t)}var W6=new TextEncoder,G6=new TextDecoder("utf-8",{ignoreBOM:!0}),j6=/[\uD800-\uDFFF]/,fb=1024,wd=new Uint8Array(fb);function LD(){wd.length!==fb&&(wd=new Uint8Array(fb))}function Mn(e){if(e.length===0)return e;if(j6.test(e))return JSON.parse(JSON.stringify(e));let t=e.length*3;wd.length<t&&(wd=new Uint8Array(t));let{written:n}=W6.encodeInto(e,wd);return G6.decode(wd.subarray(0,n))}function AD(e){for(let t of e.hunks){for(let n=0;n<t.hunkContent.length;n++){let o=t.hunkContent[n];if(o.type!=="change")continue;let r=X6(e,o);r!=null&&(t.hunkContent.splice(n,1,...r),n+=r.length-1)}Q6(t,e)}}function Q6(e,t){let{hunkContent:n}=e;for(let o=1;o<n.length;o++){let r=n[o],a=n[o-1];if(r.type!=="change"||r.additions>0&&r.deletions>0||a.type!=="context")continue;let i=r.additions>0,s=i?t.additionLines:t.deletionLines,l=i?r.additionLineIndex:r.deletionLineIndex,d=i?r.additions:r.deletions,c=s[l]??"";if(c.trim()!=="")continue;let f=!0;for(let v=1;v<d;v++)if(s[l+v]!==c){f=!1;break}if(!f)continue;let p=0;for(;p<a.lines&&t.additionLines[a.additionLineIndex+a.lines-1-p]===c;)p++;if(p===0)continue;r.additionLineIndex-=p,r.deletionLineIndex-=p;let m=r.additionLineIndex+r.additions,g=r.deletionLineIndex+r.deletions,h=n[o+1];h?.type==="context"?(h.lines+=p,h.additionLineIndex=m,h.deletionLineIndex=g):n.splice(o+1,0,{type:"context",lines:p,additionLineIndex:m,deletionLineIndex:g}),a.lines-=p,a.lines===0&&(n.splice(o-1,1),o--)}}function X6(e,t){let{deletions:n,additions:o,deletionLineIndex:r,additionLineIndex:a}=t,i=Math.min(n,o),s=Math.abs(o-n);if(i===0||s===0||i*(s+1)>4096)return null;let l=[];for(let h=0;h<n;h++)l.push(PD(e.deletionLines[r+h]??""));let d=[];for(let h=0;h<o;h++)d.push(PD(e.additionLines[a+h]??""));let c=o>n,f=0,p=-1;for(let h=0;h<=s;h++){let v=0;for(let y=0;y<i;y++)v+=J6(l[y+(c?0:h)],d[y+(c?h:0)]);h===0?p=v+i*.5:v>p&&(p=v,f=h)}if(f===0)return null;let m=[],g=(h,v,y,x)=>{(h>0||v>0)&&m.push({type:"change",deletions:h,additions:v,deletionLineIndex:y,additionLineIndex:x})};return c?(g(0,f,r,a),g(i,i,r,a+f),g(0,o-i-f,r+i,a+f+i)):(g(f,0,r,a),g(i,i,r+f,a),g(n-i-f,0,r+f+i,a+i)),m}var Y6=/\s+/g;function PD(e){return e.replace(Y6,"")}function J6(e,t){if(e===t)return 1;let n=Math.max(e.length,t.length),o=Math.min(e.length,t.length);if(o===0)return 0;let r=0;for(;r<o&&e[r]===t[r];)r++;let a=0;for(;a<o-r&&e[e.length-1-a]===t[t.length-1-a];)a++;return(r+a)/n}function Z6(e,t,n){try{return e8(e,t,n)}finally{LD()}}function e8(e,t,n=!1){let o=d8(e),r=o?o8(e):r8(e),a,i=[];for(let s of r){if(o&&!cb.test(s)){if(a==null)a=Mn(s);else{if(n)throw Error("parsePatchContent: unknown file blob");console.error("parsePatchContent: unknown file blob:",s)}continue}else if(!o&&!a8(s)){if(a==null)a=Mn(s);else{if(n)throw Error("parsePatchContent: unknown file blob");console.error("parsePatchContent: unknown file blob:",s)}continue}let l=t8(s,{cacheKey:t!=null?`${t}-${i.length}`:void 0,isGitDiff:o,throwOnError:n});l!=null&&i.push(l)}return{patchMetadata:a,files:i}}function t8(e,{cacheKey:t,isGitDiff:n=cb.test(e),oldFile:o,newFile:r,throwOnError:a=!1}={}){let i=0,s=BD(e,"@@ "),l,d=o==null||r==null,c=0,f=0;for(let p of s){let m=DD(p),g=m[0];if(g==null){if(a)throw Error("parsePatchContent: invalid hunk");console.error("parsePatchContent: invalid hunk",p);continue}let h=FD(g),v=0,y=0;if(h==null||l==null){if(l!=null){if(a)throw Error("parsePatchContent: Invalid hunk");console.error("parsePatchContent: Invalid hunk",p);continue}l={name:"",type:"change",hunks:[],splitLineCount:0,unifiedLineCount:0,isPartial:d,additionLines:!d&&o!=null&&r!=null?ED(r.contents):[],deletionLines:!d&&o!=null&&r!=null?ED(o.contents):[],cacheKey:ND(t)},l.additionLines.length===1&&r?.contents===""&&(l.additionLines.length=0),l.deletionLines.length===1&&o?.contents===""&&(l.deletionLines.length=0);for(let T of m){if(T.startsWith("diff --git")){let P=T.trim().match(TD),_=P?.[1]??P?.[2],E=P?.[3]??P?.[4];if(_==null||E==null){if(a)throw Error("parsePatchContent: invalid git diff header");console.error("parsePatchContent: invalid git diff header",T);continue}l.name=Mn(E.trim()),_!==E&&(l.prevName=Mn(_.trim()));continue}let A=T.startsWith("---")||T.startsWith("+++")?T.match(n?ID:SD):null;if(A!=null){let[,P,_]=A;if(P==="---"&&_!=="/dev/null"){let E=Mn(_.trim());l.prevName=E,l.name=E}else P==="+++"&&_!=="/dev/null"&&(l.name=Mn(_.trim()))}else if(n){if(T.startsWith("new mode ")&&(l.mode=Mn(T.slice(8).trim())),T.startsWith("old mode ")&&(l.prevMode=Mn(T.slice(8).trim())),T.startsWith("new file mode")&&(l.type="new",l.mode=Mn(T.slice(13).trim())),T.startsWith("deleted file mode")&&(l.type="deleted",l.mode=Mn(T.slice(17).trim())),T.startsWith("similarity index")&&(T.startsWith("similarity index 100%")?l.type="rename-pure":l.type="rename-changed"),T.startsWith("index ")){let[,P,_,E]=T.trim().match(kD)??[];P!=null&&(l.prevObjectId=Mn(P)),_!=null&&(l.newObjectId=Mn(_)),E!=null&&(l.mode=Mn(E))}T.startsWith("rename from ")&&(l.prevName=Mn(T.slice(12).trim())),T.startsWith("rename to ")&&(l.name=Mn(T.slice(10).trim()))}}continue}let x,C;for(;m.length>0&&(m[m.length-1]===`
|
|
3796
3796
|
`||m[m.length-1]==="\r"||m[m.length-1]===`\r
|
|
3797
|
-
`||m[m.length-1]==="");)m.pop();let{additionStart:w,deletionStart:L}=h;c=d?c:L-1,f=d?f:w-1;let S={collapsedBefore:0,splitLineCount:0,splitLineStart:0,unifiedLineCount:0,unifiedLineStart:0,additionCount:h.additionCount,additionStart:w,additionLines:v,deletionCount:h.deletionCount,deletionStart:L,deletionLines:y,deletionLineIndex:c,additionLineIndex:f,hunkContent:[],hunkContext:
|
|
3798
|
-
From `)}function
|
|
3799
|
-
`,n);if(o===-1)break;t.push(e.slice(n,o+1)),n=o+1}return n<e.length&&t.push(e.slice(n)),t}function
|
|
3800
|
-
`||a==="\r")break;if(a!==" "&&a!==" ")return!0}return!1}function
|
|
3801
|
-
`,t);return n===-1?e.length:n+1}function
|
|
3802
|
-
`&&n!=="\r")return!1}return!0}function
|
|
3797
|
+
`||m[m.length-1]==="");)m.pop();let{additionStart:w,deletionStart:L}=h;c=d?c:L-1,f=d?f:w-1;let S={collapsedBefore:0,splitLineCount:0,splitLineStart:0,unifiedLineCount:0,unifiedLineStart:0,additionCount:h.additionCount,additionStart:w,additionLines:v,deletionCount:h.deletionCount,deletionStart:L,deletionLines:y,deletionLineIndex:c,additionLineIndex:f,hunkContent:[],hunkContext:ND(h.hunkContext),hunkSpecs:Mn(g),noEOFCRAdditions:!1,noEOFCRDeletions:!1},k=0,I=0;for(let T=1;T<m.length;T++){let A=m[T];if(k>=S.additionCount&&I>=S.deletionCount&&!A.startsWith("\\")){if(a&&i8(A)&&!s8(A))throw Error("parsePatchContent: hunk has more lines than expected");break}let P=A[0];if(P!=="+"&&P!=="-"&&P!==" "&&P!=="\\"){if(a)throw Error("parsePatchContent: invalid hunk line");console.error(`parseLineType: Invalid firstChar: "${P}", full line: "${A}"`),console.error("processFile: invalid rawLine:",A);continue}let _=c8(P);if(_==="addition"){if(a&&k>=S.additionCount)throw Error("parsePatchContent: hunk has too many addition lines");let E=pb(A);(x==null||x.type!=="change")&&(x=mb("change",c,f),S.hunkContent.push(x)),f++,k++,d&&l.additionLines.push(E),x.additions++,v++,C="addition"}else if(_==="deletion"){if(a&&I>=S.deletionCount)throw Error("parsePatchContent: hunk has too many deletion lines");let E=pb(A);(x==null||x.type!=="change")&&(x=mb("change",c,f),S.hunkContent.push(x)),c++,I++,d&&l.deletionLines.push(E),x.deletions++,y++,C="deletion"}else if(_==="context"){if(a&&(I>=S.deletionCount||k>=S.additionCount))throw Error("parsePatchContent: hunk has too many context lines");let E=pb(A);(x==null||x.type!=="context")&&(x=mb("context",c,f),S.hunkContent.push(x)),f++,c++,k++,I++,d&&(l.deletionLines.push(E),l.additionLines.push(E)),x.lines++,C="context"}else if(_==="metadata"&&x!=null){if(x.type==="context"?(S.noEOFCRAdditions=!0,S.noEOFCRDeletions=!0):C==="deletion"?S.noEOFCRDeletions=!0:C==="addition"&&(S.noEOFCRAdditions=!0),d&&(C==="addition"||C==="context")){let E=l.additionLines.length-1;E>=0&&(l.additionLines[E]=ub(l.additionLines[E]))}if(d&&(C==="deletion"||C==="context")){let E=l.deletionLines.length-1;E>=0&&(l.deletionLines[E]=ub(l.deletionLines[E]))}}}if(a&&(k!==S.additionCount||I!==S.deletionCount))throw Error("parsePatchContent: hunk line count mismatch");S.additionLines=v,S.deletionLines=y,S.collapsedBefore=Math.max(S.additionStart-1-i,0),l.hunks.push(S),i=S.additionStart+S.additionCount-1;for(let T of S.hunkContent)T.type==="context"?(S.splitLineCount+=T.lines,S.unifiedLineCount+=T.lines):(S.splitLineCount+=Math.max(T.additions,T.deletions),S.unifiedLineCount+=T.deletions+T.additions);S.splitLineStart=l.splitLineCount+S.collapsedBefore,S.unifiedLineStart=l.unifiedLineCount+S.collapsedBefore,l.splitLineCount+=S.collapsedBefore+S.splitLineCount,l.unifiedLineCount+=S.collapsedBefore+S.unifiedLineCount}if(l!=null){if(a&&d&&!n&&l.hunks.length===0)throw Error("parsePatchContent: unified file has no hunks");if(l.hunks.length>0&&!d&&l.additionLines.length>0&&l.deletionLines.length>0){let p=l.hunks[l.hunks.length-1],m=p.additionStart+p.additionCount-1,g=l.additionLines.length,h=Math.max(g-m,0);l.splitLineCount+=h,l.unifiedLineCount+=h}return n||(l.prevName!=null&&l.name!==l.prevName?l.hunks.length>0?l.type="rename-changed":l.type="rename-pure":(o==null||o.contents==="")&&r!=null&&r.contents!==""?l.type="new":o!=null&&o.contents!==""&&(r==null||r.contents==="")&&(l.type="deleted")),l.type!=="rename-pure"&&l.type!=="rename-changed"&&(l.prevName=void 0),AD(l),l}}function _D(e,t,n=!1){let o=[],r=n8(e)?e.split(wD):[e];for(let a of r)try{o.push(Z6(a,t!=null?`${t}-${o.length}`:void 0,n))}catch(i){if(n)throw i;console.error(i)}return o}function n8(e){return e.startsWith("From ")||e.includes(`
|
|
3798
|
+
From `)}function ED(e){let t=DD(e);for(let n=0;n<t.length;n++)t[n]=Mn(t[n]);return t}function DD(e){if(e.length===0)return[""];let t=[],n=0;for(;;){let o=e.indexOf(`
|
|
3799
|
+
`,n);if(o===-1)break;t.push(e.slice(n,o+1)),n=o+1}return n<e.length&&t.push(e.slice(n)),t}function o8(e){return BD(e,"diff --git")}function r8(e){if(e.length===0)return[""];let t=[],n=0,o=0,r=0,a=0,i=!1;for(;o<e.length;){let s=gb(e,o);if(r<=0&&a<=0){if(OD(e,o)){o>n&&t.push(e.slice(n,o)),n=o,i=!0,o=gb(e,s);continue}if(i&&e.startsWith("@@ -",o)){let d=FD(e.slice(o,s));d!=null&&(r=d.deletionCount,a=d.additionCount)}o=s;continue}let l=e[o];if(l==="\\"){o=s;continue}l===" "?(r=Math.max(r-1,0),a=Math.max(a-1,0)):l==="-"?r=Math.max(r-1,0):l==="+"&&(a=Math.max(a-1,0)),o=s}return t.push(e.slice(n)),t}function a8(e){return OD(e,0)}function OD(e,t){let n=gb(e,t);return RD(e,t,"---")&&RD(e,n,"+++")}function RD(e,t,n){if(!e.startsWith(n,t))return!1;let o=e[t+n.length];if(o!==" "&&o!==" ")return!1;for(let r=t+n.length+1;r<e.length;r++){let a=e[r];if(a===`
|
|
3800
|
+
`||a==="\r")break;if(a!==" "&&a!==" ")return!0}return!1}function gb(e,t){let n=e.indexOf(`
|
|
3801
|
+
`,t);return n===-1?e.length:n+1}function i8(e){let t=e[0];return t==="+"||t==="-"||t===" "}function s8(e){if(!e.startsWith("--"))return!1;for(let t=2;t<e.length;t++){let n=e[t];if(n!==" "&&n!==" "&&n!==`
|
|
3802
|
+
`&&n!=="\r")return!1}return!0}function FD(e){if(!e.startsWith("@@ -"))return;let t=4,n=Kg(e,t);if(n==null)return;let o=n.value;t=n.endIndex;let r=1;if(e[t]===","){let c=Kg(e,t+1);if(c==null)return;r=c.value,t=c.endIndex}if(e[t]!==" "||e[t+1]!=="+")return;t+=2;let a=Kg(e,t);if(a==null)return;let i=a.value;t=a.endIndex;let s=1;if(e[t]===","){let c=Kg(e,t+1);if(c==null)return;s=c.value,t=c.endIndex}if(e[t]!==" "||e[t+1]!=="@"||e[t+2]!=="@")return;let l,d=t+3;return e[d]===" "&&(l=l8(e.slice(d+1))),{additionCount:s,additionStart:i,deletionCount:r,deletionStart:o,hunkContext:l}}function Kg(e,t){let n=t,o=0;for(;n<e.length;n++){let r=e.charCodeAt(n)-48;if(r<0||r>9)break;o=o*10+r}if(n!==t)return{value:o,endIndex:n}}function l8(e){return e.endsWith(`\r
|
|
3803
3803
|
`)?e.slice(0,-2):e.endsWith(`
|
|
3804
|
-
`)?e.slice(0,-1):e}function
|
|
3805
|
-
diff --git`)}function
|
|
3806
|
-
${t}`,o=e.startsWith(t)?0:
|
|
3807
|
-
`:t)}function
|
|
3808
|
-
`)[0]}),u("div",{className:"flex min-w-0 flex-wrap items-center gap-1 pt-0.5",children:s.options.map(f=>u(ce,{size:"xs",variant:f.tone==="primary"?"default":f.tone==="danger"?"destructive":"outline",disabled:a,onClick:()=>{i(!0),t.onRespond(l,f.id)},children:d(f.label)},f.id))})]})});function
|
|
3809
|
-
${n}`}ue();var
|
|
3810
|
-
`;function S8(){let{t:e}=Ce();return u(yl,{variant:"outline",className:"inline-flex h-4 w-fit min-w-0 items-center justify-center gap-0 border-border/70 bg-muted/60 px-1.5 py-0 font-semibold text-[10px] text-muted-foreground leading-none sm:h-4",children:e("traits.default")})}function n1(e,t,n){return e.map(o=>o.id!==t?o:o.type==="boolean"?{...o,...typeof n=="boolean"?{currentValue:n}:{}}:{...o,...typeof n=="string"?{currentValue:n}:{}})}function jg(e){if(!e)return null;let t=tl(e);return typeof t=="string"?t:null}function I8(e,t,n,o,r,a,i,s){let l=e.getModelCapabilities(n,o,s),d=Wg({caps:l,selections:a}),c=d.filter(I=>I.type==="select"),f=d.filter(I=>I.type==="boolean"),p=c[0]??null,m=c.find(I=>I.id==="contextWindow")??null,g=c.find(I=>I.id==="agent")??null,h=f.find(I=>I.id==="fastMode")??null,v=f.find(I=>I.id==="thinking")??null,y=i&&(p?.promptInjectedValues?.length??0)>0&&r!=="none",x=y&&r==="ultrathink-in-body",C=(y?"ultrathink":jg(p))??null,w=typeof v?.currentValue=="boolean"?v.currentValue:null,L=jg(m),S=jg(g),k=g?wb(g):null;return{caps:l,descriptors:d,selectDescriptors:c,booleanDescriptors:f,primarySelectDescriptor:p,contextWindowDescriptor:m,agentDescriptor:g,fastModeDescriptor:h,thinkingDescriptor:v,effort:C,thinkingEnabled:w,contextWindow:L,ultrathinkPromptControlled:y,ultrathinkInBodyText:x,selectedAgent:S,selectedAgentLabel:k}}function Ib(e){let t=I8(e.modelApi,e.provider,e.models,e.model,e.promptInjection,e.modelOptions,e.allowPromptInjectedEffort??!0,e.planModeEnabled),n=t.primarySelectDescriptor!==null,o=t.thinkingDescriptor!==null,r=t.fastModeDescriptor!==null,a=t.contextWindowDescriptor!==null,i=t.agentDescriptor!==null;return{...t,showEffort:n,showThinking:o,showFastMode:r,showContextWindow:a,showAgent:i,hasAnyControls:n||o||r||a||i}}function Tb(e){return Ib(e).hasAnyControls}var kb=pe(function({provider:t,instanceId:n,models:o,model:r,promptInjection:a,onPromptUpdate:i,modelOptions:s,allowPromptInjectedEffort:l=!0,planModeEnabled:d,...c}){let{t:f}=Ce(),p=Wt(),m=p.draft.useStore(I=>I.setProviderModelOptions),g=R(I=>{if("onModelOptionsChange"in c){c.onModelOptionsChange(I);return}let T=c.threadRef??c.draftId;T&&m(T,t,I,{...n?{instanceId:n}:{},model:r,persistSticky:!0})},[n,r,c,t,m]),{descriptors:h,selectDescriptors:v,booleanDescriptors:y,primarySelectDescriptor:x,ultrathinkPromptControlled:C,ultrathinkInBodyText:w,hasAnyControls:L}=Ib({modelApi:p.model,provider:t,models:o,model:r,promptInjection:a,modelOptions:s,allowPromptInjectedEffort:l,planModeEnabled:d}),S=I=>{g(Gg(I))},k=(I,T)=>{if(T){if(I.promptInjectedValues?.includes(T)){i(A=>A.trim().length===0?w8:t1(A,"ultrathink"));return}w&&I.id===x?.id||(C&&I.id===x?.id&&i(A=>A.replace(/^Ultrathink:\s*/i,"")),S(n1(h,I.id,T)))}};return L?b(Le,{children:[v.map((I,T)=>{let A=C&&I.id===x?.id?"ultrathink":jg(I)??"";return b("div",{children:[T>0?u(ci,{}):null,b(cc,{children:[u("div",{className:"px-2 pt-1.5 pb-1 font-medium text-muted-foreground text-xs",children:I.label}),w&&I.id===x?.id?u("div",{className:"px-2 pb-1.5 text-muted-foreground/80 text-xs",children:f("traits.ultrathinkInBodyNotice")}):null,u(Lr,{value:A,onValueChange:P=>k(I,P),children:I.options.map(P=>u(Wo,{value:P.id,hideIndicator:!0,closeOnClick:!0,disabled:w&&I.id===x?.id,children:b("span",{className:"flex w-full min-w-0 flex-col",children:[u("span",{className:"flex w-full min-w-0 items-center justify-between gap-3",children:b("span",{className:"min-w-0 truncate",children:[P.label,P.isDefault?b(Le,{children:[" ",u(S8,{})]}):null]})}),P.description?u("span",{className:"max-w-56 text-pretty text-muted-foreground/80 text-xs",children:P.description}):null]})},P.id))})]})]},I.id)}),y.map((I,T)=>{let A=I.currentValue===!0?"on":"off";return b("div",{children:[T>0||v.length>0?u(ci,{}):null,b(cc,{children:[u("div",{className:"px-2 py-1.5 font-medium text-muted-foreground text-xs",children:I.label}),u(Lr,{value:A,onValueChange:P=>{S(n1(h,I.id,P==="on"))},children:["on","off"].map(P=>u(Wo,{value:P,hideIndicator:!0,closeOnClick:!0,children:u("span",{className:"flex w-full min-w-0 items-center justify-between gap-3",children:u("span",{children:f(P==="on"?"traits.on":"traits.off")})})},P))})]})]},I.id)})]}):null});function T8(e,t){let n=null,o=!1,r=[];for(let a of t.descriptors){if(a.id==="fastMode"&&a.type==="boolean"){o=a.currentValue===!0,n=e(o?"traits.fast":"traits.normal");continue}if(t.provider==="codex"&&a.id==="serviceTier"&&a.type==="select"){let s=tl(a),l=a.options.find(({label:d})=>d==="Fast");if(l&&(s==="default"||s===l.id)){o=s===l.id,n=a.options.find(({id:d})=>d===s)?.label??e(o?"traits.fast":"traits.normal");continue}}let i=t.ultrathinkPromptControlled&&a.id===t.primarySelectDescriptorId?e("traits.ultrathink"):a.type==="boolean"?e("traits.labelWithState",{label:a.label,state:e(a.currentValue===!0?"traits.on":"traits.off")}):wb(a);typeof i=="string"&&i.length>0&&r.push(i)}return r.length===0&&n!==null?{label:n,showFastModeIcon:!1}:{label:r.join(" \xB7 "),showFastModeIcon:o}}var o1=pe(function({provider:t,instanceId:n,models:o,model:r,promptInjection:a,onPromptUpdate:i,modelOptions:s,allowPromptInjectedEffort:l=!0,planModeEnabled:d,triggerVariant:c,triggerClassName:f,...p}){let[m,g]=J(!1),{t:h}=Ce(),v=Wt().model,{descriptors:y,primarySelectDescriptor:x,ultrathinkPromptControlled:C}=Ib({modelApi:v,provider:t,models:o,model:r,promptInjection:a,modelOptions:s,allowPromptInjectedEffort:l,planModeEnabled:d});if(!Tb({modelApi:v,provider:t,models:o,model:r,promptInjection:a,modelOptions:s,allowPromptInjectedEffort:l,planModeEnabled:d}))return null;let{label:w,showFastModeIcon:L}=T8(h,{provider:t,descriptors:y,primarySelectDescriptorId:x?.id??null,ultrathinkPromptControlled:C}),S=L?b(Le,{children:[u(Jo,{icon:cs,className:$("fill-current opacity-80",t==="claudeAgent"?"text-[#d97757]":"text-foreground")}),u("span",{className:"sr-only",children:h("traits.fastModeOn")})]}):null,k=t==="codex";return b(Eo,{open:m,onOpenChange:I=>{g(I)},children:[u(Mo,{render:u(Yo,{variant:c??"ghost",className:$(k?"min-w-0 max-w-40 shrink justify-start overflow-hidden whitespace-nowrap sm:max-w-48":"shrink-0 whitespace-nowrap",f)}),children:k?b("span",{className:"flex min-w-0 w-full items-center gap-1.5 overflow-hidden",children:[S,u("span",{className:"min-w-0 truncate",children:w}),u(ma,{})]}):b(Le,{children:[S,u("span",{children:w}),u(ma,{})]})}),u(Ro,{align:"start",children:u(kb,{provider:t,...n?{instanceId:n}:{},models:o,model:r,promptInjection:a,onPromptUpdate:i,modelOptions:s,allowPromptInjectedEffort:l,planModeEnabled:d,...p})})]})});function r1(e){return Sb(e)?Sb(e.replace(/^Ultrathink:\s*/i,""))?"ultrathink-in-body":"ultrathink":"none"}function a1(e,t){let{provider:n,model:o,models:r,modelOptions:a,promptInjectionState:i="none",planModeEnabled:s}=e,l=t.getModelCapabilities(r,o,s),d=Wg({caps:l,selections:a}),c=d.find(g=>g.type==="select"),f=tl(c??null),p=typeof f=="string"?f:null,m=(c?.promptInjectedValues?.length??0)>0&&i!=="none";return{provider:n,promptEffort:p,modelOptionsForDispatch:Gg(d),...m?{composerFrameClassName:"ultrathink-frame",composerSurfaceClassName:"shadow-[0_0_0_1px_rgba(255,255,255,0.07)_inset]",modelPickerIconClassName:"ultrathink-chroma"}:{}}}function i1(e,t){let{provider:n,instanceId:o,threadRef:r,draftId:a,model:i,models:s,modelOptions:l,promptInjection:d,onPromptUpdate:c,planModeEnabled:f}=t;return!(r!==void 0||a!==void 0)||!Tb({modelApi:t.modelApi,provider:n,models:s,model:i,modelOptions:l,promptInjection:d,planModeEnabled:f})?null:u(e,{provider:n,...o?{instanceId:o}:{},models:s,...r?{threadRef:r}:{},...a?{draftId:a}:{},model:i,modelOptions:l,promptInjection:d,onPromptUpdate:c,planModeEnabled:f})}function s1(e){return i1(kb,e)}function l1(e){return i1(o1,e)}ue();var d1=e=>{let t,n=new Set,o=(d,c)=>{let f=typeof d=="function"?d(t):d;if(!Object.is(f,t)){let p=t;t=c??(typeof f!="object"||f===null)?f:Object.assign({},t,f),n.forEach(m=>m(t,p))}},r=()=>t,s={setState:o,getState:r,getInitialState:()=>l,subscribe:d=>(n.add(d),()=>n.delete(d))},l=t=e(o,r,s);return s},c1=(e=>e?d1(e):d1);ue();var k8=e=>e;function L8(e,t=k8){let n=yn.useSyncExternalStore(e.subscribe,yn.useCallback(()=>t(e.getState()),[e,t]),yn.useCallback(()=>t(e.getInitialState()),[e,t]));return yn.useDebugValue(n),n}var u1=e=>{let t=c1(e),n=o=>L8(t,o);return Object.assign(n,t),n},f1=(e=>e?u1(e):u1);var Lb=f1(e=>({presetIdByDraftId:{},setDraftPresetId:(t,n)=>{e(o=>{if((o.presetIdByDraftId[t]??null)===n)return o;let r={...o.presetIdByDraftId};return n===null?delete r[t]:r[t]=n,{presetIdByDraftId:r}})},clearDraftPresetId:t=>{e(n=>{if(n.presetIdByDraftId[t]===void 0)return n;let o={...n.presetIdByDraftId};return delete o[t],{presetIdByDraftId:o}})}}));function p1(e){return Lb(t=>e===null?null:t.presetIdByDraftId[e]??null)}function Pb(e,t){return t==null?void 0:e.find(n=>n.presetId===t)}var Ab="__none__",m1=pe(function({environmentId:t,draftId:n,threadPresetId:o,compact:r}){let{t:a}=Ce(),i=Wt().presets.useThreadPresets(t),s=p1(n),l=Lb(c=>c.setDraftPresetId);if(n===null){let f=Pb(i,o)?.displayName??o;return f===null?null:b(Yo,{variant:"ghost",disabled:!0,"aria-label":a("preset.appliedLabel",{name:f}),className:"shrink-0 whitespace-nowrap",children:[u(Jo,{icon:ka}),u("span",{className:"min-w-0 truncate",children:f})]})}if(i.length===0)return null;let d=Pb(i,s);return b(Eo,{children:[u(Mo,{render:u(Yo,{variant:"ghost","aria-label":a("preset.triggerLabel"),className:"min-w-0 max-w-40 shrink whitespace-nowrap sm:max-w-48"}),children:b("span",{className:"flex w-full min-w-0 items-center gap-1.5 overflow-hidden",children:[u(Jo,{icon:ka}),r?null:u("span",{className:"min-w-0 truncate",children:d?.displayName??a("preset.none")}),u(ma,{})]})}),u(Ro,{align:"start",children:b(cc,{children:[u("div",{className:"px-2 pt-1.5 pb-1 font-medium text-muted-foreground text-xs",children:a("preset.menuTitle")}),b(Lr,{value:s??Ab,onValueChange:c=>{l(n,c===Ab?null:c)},children:[u(Wo,{value:Ab,hideIndicator:!0,closeOnClick:!0,children:u("span",{className:"min-w-0 truncate",children:a("preset.none")})}),i.map(c=>u(Wo,{value:c.presetId,hideIndicator:!0,closeOnClick:!0,children:b("span",{className:"flex w-full min-w-0 flex-col",children:[u("span",{className:"min-w-0 truncate",children:c.displayName}),c.description?u("span",{className:"max-w-56 text-pretty text-muted-foreground/80 text-xs",children:c.description}):null]})},c.presetId))]})]})})]})});ue();function g1(e){let t=e.credentialIdentity;return[e.queryKey,t===null?"":t.id,t===null?"":String(t.revision)].join("\0")}function P8(e,t){let n=t.credentialIdentity;return n===null?!1:e.environmentId===t.environmentId&&e.instanceId===t.instanceId&&e.credentialIdentity.id===n.id&&e.credentialIdentity.revision===n.revision}function h1(e){return e.capability.status!=="unsupported"&&e.credentialIdentity!==null}function Eb(e,t){return e===null||!Number.isFinite(e)?null:t.kind==="money"?e.toFixed(t.precision):(Number.isInteger(e),String(e))}function Qg(e){if(e==null||!Number.isFinite(e)||e<=0)return null;let t=864e5,n=36e5,o=6e4,r=1e3;return e%t===0?{unit:"days",count:e/t}:e%n===0?{unit:"hours",count:e/n}:e%o===0?{unit:"minutes",count:e/o}:e%r===0?{unit:"seconds",count:e/r}:null}function Rb(e,t){return e.freshness==="stale"||e.status==="error"||e.errorReason!==null||t!==null}function v1(e){if(e.unlimited===!0)return{kind:"unlimited"};let t=e.kind==="spend-cap"?e.used??e.remaining:e.remaining??e.used,n=Eb(t,e.unit);return n===null?null:e.unit.kind==="money"?{kind:"money",amount:n,currency:e.unit.currency}:e.unit.kind==="percent"?{kind:"percent",amount:n,direction:e.unit.direction}:{kind:"quantity",amount:n,nativeUnit:e.unit.nativeUnit}}function y1(e,t){let n=[];for(let o of e){let r=v1(o);r!==null&&n.push({metricId:o.metricId,kind:o.kind,display:r,nativeLabel:o.nativeLabel,durationMs:o.windowMs,resetsAt:o.resetsAt,fetchedAt:o.fetchedAt,stale:Rb(o,t)})}return n}function x1(e){return e.filter(t=>t.kind==="rate-limit"&&v1(t)===null).map(t=>({metricId:t.metricId,kind:t.kind,nativeLabel:t.nativeLabel,durationMs:t.windowMs,resetsAt:t.resetsAt}))}function C1(e){return e.snapshot===null||e.credentialIdentity===null?null:P8(e.snapshot,e)?e.snapshot:null}function b1(e){for(let t of e)if(t.resetsAt!==null)return t.resetsAt;return null}function w1(e){let t=null;for(let n of e)n.fetchedAt!==null&&(t===null||n.fetchedAt<t)&&(t=n.fetchedAt);return t}ue();function S1(e,t){let n=N(e),o=N(0),r=N(!1),[a,i]=J(e),[s,l]=J(null),[d,c]=J(!1);a!==e&&(i(e),n.current=e,o.current+=1,r.current=!1,l(null),c(!1));let f=R(async()=>{if(r.current)return;let p=o.current+1;o.current=p;let m=e;r.current=!0,c(!0);try{let g=await t();if(o.current!==p||n.current!==m)return;l(g)}catch{if(o.current!==p||n.current!==m)return;l({outcome:"error",retryAt:null})}finally{o.current===p&&n.current===m&&(r.current=!1,c(!1))}},[e,t]);return{feedback:s,refreshing:d,refresh:f}}function Nb(e,t){switch(e.unit){case"days":return t("accountUsage.windowDays",{count:e.count});case"hours":return t("accountUsage.windowHours",{count:e.count});case"minutes":return t("accountUsage.windowMinutes",{count:e.count});case"seconds":return t("accountUsage.windowSeconds",{count:e.count})}}function _b(e,t){let n=e.nativeLabel?.trim()??"";if(n.length>0)return n;let o=Qg(e.durationMs);return o!==null?Nb(o,t):M8(e.kind,t)}function A8(e,t){switch(e.kind){case"unlimited":return t("accountUsage.unlimited");case"money":return`${e.currency} ${e.amount}`;case"quantity":return`${e.amount} ${e.nativeUnit}`;case"percent":return e.direction==="used"?t("accountUsage.percentUsed",{value:e.amount}):t("accountUsage.percentRemaining",{value:e.amount})}}function E8(e,t){let n=A8(e.display,t);if(e.kind==="quota-window")return`${_b(e,t)} ${n}`;let o=e.nativeLabel?.trim()??"";return o.length>0?`${o} ${n}`:n}function R8(e,t){let n=_b({kind:e.kind,nativeLabel:e.nativeLabel,durationMs:e.durationMs},t),o=Qg(e.durationMs);return o!==null?`${n} \xB7 ${Nb(o,t)}`:e.resetsAt!==null?`${n} \xB7 ${t("accountUsage.resetsAt",{time:Id(e.resetsAt)})}`:n}function M8(e,t){switch(e){case"balance":return t("accountUsage.kindBalance");case"credits":return t("accountUsage.kindCredits");case"quota-window":return t("accountUsage.kindQuotaWindow");case"spend-cap":return t("accountUsage.kindSpendCap");case"rate-limit":return t("accountUsage.kindRateLimit")}}function N8(e,t){switch(e){case"account":return t("accountUsage.scopeAccount");case"org":return t("accountUsage.scopeOrg")}}function Id(e){return ra(e,"locale")||e}function _8(e,t){switch(e.outcome){case"fresh":return t("accountUsage.outcomeFresh");case"partial":return t("accountUsage.outcomePartial");case"joined-inflight":return t("accountUsage.outcomeJoinedInflight");case"rate-limited":return e.retryAt===null?t("accountUsage.outcomeRateLimited"):t("accountUsage.outcomeRateLimitedUntil",{time:Id(e.retryAt)});case"offline":return t("accountUsage.outcomeOffline");case"unsupported":return t("accountUsage.outcomeUnsupported");case"error":return t("accountUsage.outcomeError")}}function D8(e,t){switch(e){case"credential-unavailable":return t("accountUsage.unsupportedSignedOut");case"instance-disabled":return t("accountUsage.unsupportedDisabled");case"unsupported-driver":return t("accountUsage.unsupportedNoChannel");default:return t("accountUsage.unsupported")}}function O8(e,t){switch(e){case"rate-limited":return t("accountUsage.outcomeRateLimited");case"auth-rejected":return t("accountUsage.errorAuthRejected");case"unreachable":return t("accountUsage.errorUnreachable");case"response-invalid":return t("accountUsage.errorResponseInvalid");case"reader-unloaded":return t("accountUsage.errorReaderUnloaded");default:return t("accountUsage.outcomeError")}}function F8(e,t,n){return e.capability.status==="unsupported"?D8(e.error,n):t.length>0?null:e.loading?n("accountUsage.loading"):e.error!==null?O8(e.error,n):e.credentialIdentity===null||e.capability.status==="unknown"?n("accountUsage.unknown"):n("accountUsage.noData")}function Mb(e,t){let n=Eb(t,e.unit);return n===null?null:e.unit.kind==="money"?`${e.unit.currency} ${n}`:e.unit.kind==="percent"?`${n}%`:`${n} ${e.unit.nativeUnit}`}function I1(e){let[t,n]=J(!1);return u(B8,{...e,expanded:t,onToggleExpanded:()=>n(o=>!o)})}function B8(e){let{expanded:t,onToggleExpanded:n,onRefresh:o,...r}=e,{t:a}=Ce(),i=g1(r),{feedback:s,refreshing:l,refresh:d}=S1(i,o),c=r.capability.status==="supported"&&r.credentialIdentity!==null?C1(r):null,f=c?.metrics??[],p=y1(f,r.error),m=p.some(S=>S.stale)||r.error!==null&&c!==null,g=b1(p),h=w1(f),v=l,y=F8(r,p,a),x=h1(r),w=`${Jr()}-account-usage-details`,L=[...p.map(S=>({key:S.metricId,text:E8(S,a)})),...x1(f).map(S=>({key:`${S.metricId}\0status`,text:R8(S,a)})),...g===null?[]:[{key:"resets-at",text:a("accountUsage.resetsAt",{time:Id(g)})}]];return b("div",{className:"min-w-0 px-3 pt-1 sm:px-4","data-composer-account-usage":"true","data-refresh-outcome":s?.outcome??"",children:[b("div",{className:"flex min-w-0 items-start gap-1.5",children:[u(ce,{type:"button",variant:"ghost",size:"sm",className:"h-auto min-h-control-3 min-w-0 flex-1 justify-start px-1 py-1 text-left whitespace-normal","aria-expanded":t,"aria-controls":w,"aria-label":a(t?"accountUsage.hideDetails":"accountUsage.showDetails"),onClick:n,children:b("div",{className:"flex min-w-0 flex-1 flex-col items-stretch gap-0.5",children:[b("div",{className:"flex min-w-0 flex-wrap items-baseline gap-x-2 gap-y-0.5",children:[u("span",{className:"text-xs font-medium text-foreground",children:r.instanceLabel}),m?u("span",{className:"text-[11px] text-muted-foreground","data-composer-account-usage-stale":"true",children:a("accountUsage.stale")}):null,u(sn,{"aria-hidden":"true",className:$("ml-auto size-icon-2 shrink-0 text-secondary-label",t?"rotate-180":"rotate-0")})]}),u("div",{className:"flex min-w-0 flex-wrap items-baseline gap-x-2 gap-y-0.5 text-[11px] tabular-nums text-secondary-label",children:L.length>0?L.map((S,k)=>b("span",{children:[k>0?u("span",{"aria-hidden":"true",children:" \xB7 "}):null,S.text]},S.key)):y})]})}),x?u(ce,{type:"button",size:"xs",variant:"ghost",className:"mt-0.5 shrink-0 text-secondary-label","aria-label":a("accountUsage.refreshAria",{instance:r.instanceLabel}),disabled:v,onClick:()=>{d()},children:a(v?"accountUsage.refreshing":"accountUsage.refresh")}):null]}),t?b("div",{id:w,className:"max-h-36 space-y-2 overflow-y-auto overscroll-contain px-1 pb-1 pt-1.5","data-composer-account-usage-details":"true",children:[f.length===0?u("p",{className:"text-[11px] text-secondary-label",children:y??a("accountUsage.noData")}):f.map(S=>u(z8,{metric:S,queryError:r.error,t:a},S.metricId)),h!==null?u("p",{className:"text-[11px] text-secondary-label",children:a("accountUsage.collectedAt",{time:Id(h)})}):null]}):null,s!==null?u("p",{role:"status",className:"px-1 pb-1 text-[11px] text-muted-foreground",children:_8(s,a)}):r.error!==null&&c!==null?u("p",{role:"status",className:"px-1 pb-1 text-[11px] text-muted-foreground",children:a("accountUsage.errorKeepLast")}):null]})}function z8({metric:e,queryError:t,t:n}){let o=Mb(e,e.used),r=e.unlimited===!0?n("accountUsage.unlimited"):Mb(e,e.remaining),a=Mb(e,e.limit),i=n("accountUsage.sharedScope",{scope:N8(e.scope,n)}),s=Rb(e,t),l=e.windowMs,d=Qg(l),c=_b({kind:e.kind,nativeLabel:e.nativeLabel,durationMs:l},n);return b("div",{className:"text-[11px] text-secondary-label","data-metric-id":e.metricId,"data-metric-kind":e.kind,"data-window-ms":l===null?void 0:String(l),children:[b("div",{className:"font-medium text-foreground",children:[c,s?u("span",{className:"ms-2 font-normal text-muted-foreground",children:n("accountUsage.stale")}):null]}),b("div",{className:"mt-0.5 flex flex-wrap gap-x-2 tabular-nums",children:[o!==null?b("span",{children:[o," ",n("accountUsage.used")]}):null,r!==null?b("span",{children:[r," ",e.unlimited===!0?null:n("accountUsage.remaining")]}):null,a!==null?b("span",{children:[a," ",n("accountUsage.limit")]}):null]}),u("div",{className:"mt-0.5",children:i}),e.fetchedAt!==null?u("div",{children:n("accountUsage.collectedAt",{time:Id(e.fetchedAt)})}):null,e.resetsAt!==null?u("div",{children:n("accountUsage.resetsAt",{time:Id(e.resetsAt)})}):null,d!==null?u("div",{children:Nb(d,n)}):null]})}function Xa(e){return e===null||!Number.isFinite(e)?"0":e<1e3?`${Math.round(e)}`:e<1e4?`${(e/1e3).toFixed(1).replace(/\.0$/,"")}k`:e<1e6?`${Math.round(e/1e3)}k`:`${(e/1e6).toFixed(1).replace(/\.0$/,"")}m`}function T1(e,t){if(!e)return null;let n=t.get(e.instanceId)?.find(o=>o.slug===e.model);return n?bd(n):e.model}function k1(e,t,n){return typeof n=="number"&&n>0?e("contextWindow.compactsAtThreshold",{threshold:n.toLocaleString()}):t?e("contextWindow.compactsForModel",{model:t}):e("contextWindow.compactsWhenNeeded")}function U8(e){return e===null||!Number.isFinite(e)?null:e<10?`${e.toFixed(1).replace(/\.0$/,"")}%`:`${Math.round(e)}%`}function L1(e){let{t}=Ce(),{usage:n,breakdown:o,modelDisplayName:r,onCompact:a,compactDisabled:i,compactDisabledReason:s}=e,l=U8(n.usedPercentage),d=Math.max(0,Math.min(100,n.usedPercentage??0)),c=9.75,f=2*Math.PI*c,p=f*(1-d/100),m=n.totalProcessedTokens??null,g=m!==null&&m>0,v=d>90?"var(--color-error)":"color-mix(in oklab, var(--color-muted-foreground) 72%, transparent)";return b(xl,{children:[u(bl,{openOnHover:!0,delay:150,closeDelay:a?150:0,render:u(ce,{size:"icon-sm",variant:"ghost-muted","data-context-window-meter":"true",className:"size-7 rounded-full hover:text-muted-foreground data-pressed:text-muted-foreground","aria-label":n.maxTokens!==null&&l?t("contextWindow.usedPercentAria",{percentage:l}):t("contextWindow.usedTokensAria",{tokens:Xa(n.usedTokens)}),children:u("span",{className:"relative flex size-5 items-center justify-center",children:b("svg",{viewBox:"0 0 24 24",className:"-rotate-90 absolute inset-0 size-full transform-gpu mx-0!","aria-hidden":"true",children:[u("circle",{cx:"12",cy:"12",r:c,fill:"none",stroke:"color-mix(in oklab, var(--color-muted-foreground) 24%, transparent)",strokeWidth:"3"}),u("circle",{cx:"12",cy:"12",r:c,fill:"none",stroke:v,strokeWidth:"3",strokeLinecap:"round",strokeDasharray:f,strokeDashoffset:p})]})})})}),u(Cl,{tooltipStyle:!0,side:"top",align:"end",viewportClassName:"p-0",className:"w-64 max-w-none text-left whitespace-normal",children:b("div",{className:"flex flex-col gap-2 p-[var(--floating-content-inset)]",children:[b("div",{className:"flex items-center justify-between gap-3",children:[u("div",{className:"font-medium text-muted-foreground text-xs",children:t("contextWindow.title")}),n.maxTokens!==null&&l?b("div",{className:"text-secondary-label text-[11px] tabular-nums",children:[u("span",{children:l}),u("span",{className:"mx-1",children:"\xB7"}),b("span",{children:[Xa(n.usedTokens),"/",Xa(n.maxTokens??null)]})]}):u("div",{className:"text-secondary-label text-[11px] tabular-nums",children:Xa(n.usedTokens)})]}),n.maxTokens!==null?u("div",{className:"h-1.5 w-full overflow-hidden rounded-full bg-muted/60",role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(d),"aria-label":t("contextWindow.usage"),children:u("div",{className:"h-full rounded-full transition-[width,background-color] duration-500 ease-out motion-reduce:transition-none",style:{width:`${d}%`,backgroundColor:v}})}):null,o?b("div",{className:"flex flex-col gap-1","data-context-breakdown":"true",children:[b("div",{className:"flex items-center justify-between gap-3 text-[11px] leading-4","data-context-breakdown-row":"system",children:[u("span",{className:"text-secondary-label",children:t("contextWindow.system")}),u("span",{className:"font-medium tabular-nums text-secondary-label",children:Xa(o.systemTokens)})]}),b("div",{className:"flex items-center justify-between gap-3 text-[11px] leading-4","data-context-breakdown-row":"tools",children:[u("span",{className:"text-secondary-label",children:t("contextWindow.tools")}),u("span",{className:"font-medium tabular-nums text-secondary-label",children:Xa(o.toolsTokens)})]}),b("div",{className:"flex items-center justify-between gap-3 text-[11px] leading-4","data-context-breakdown-row":"messages",children:[u("span",{className:"text-secondary-label",children:t("contextWindow.messages")}),u("span",{className:"font-medium tabular-nums text-secondary-label",children:Xa(o.messageTokens)})]})]}):null,g?b("div",{className:"flex items-center justify-between gap-3 text-[11px] leading-4",children:[u("span",{className:"text-secondary-label",children:t("contextWindow.totalProcessed")}),u("span",{className:"font-medium tabular-nums text-secondary-label",children:Xa(m)})]}):null,n.compactsAutomatically?u("div",{className:"mt-1 text-pretty text-secondary-label text-[11px] font-medium",children:k1(t,r,n.autoCompactThreshold)}):null,a?b(Le,{children:[b(ce,{size:"xs",variant:"outline",className:"mt-1 w-full justify-center",disabled:i,onClick:a,children:[u(Jd,{"aria-hidden":"true"}),t("contextWindow.compactContext")]}),i&&s?u("div",{className:"text-pretty text-secondary-label text-[11px]",children:s}):null]}):null]})})]})}ue();ue();var P1=Ct(null),A1=P1.Provider;function ha(){let e=Ht(P1);if(e===null)throw new Error("Composer thread data has not been provided.");return e}var E1=Ct(null);function R1({children:e}){let{data:t,target:n,threadKey:o}=ha(),r=t.useComposerStatus({target:n,threadKey:o});return u(E1.Provider,{value:r,children:e})}function M1(){let e=Ht(E1);if(e===null)throw new Error("Composer status has not been provided.");return e}function N1(e){return e.startsWith("!")}function _1(e){return e.slice(1).trim()}function D1(e){return e.length===0?"empty":/[\r\n]/.test(e)?"multiline":null}function H8(){return null}function O1(){let{data:e,target:t,threadKey:n}=ha();return(e.useShellCommand??H8)({target:t,threadKey:n})}function Db(e,t){let n=e.flatMap(r=>r.previewUrl?[{id:r.id,src:r.previewUrl,name:r.name}]:[]);if(n.length===0)return null;let o=n.findIndex(r=>r.id===t);return o<0?null:{images:n.map(r=>({src:r.src,name:r.name})),index:o}}function F1({message:e}){return e?u("p",{role:"alert",className:"px-3 pb-2 text-xs text-destructive sm:px-4","data-chat-composer-validation":"prompt-length",children:e}):null}function B1(e,t){let n=qr.indexOf(e);if(n===-1)return qr[0];let o=(n+t+qr.length)%qr.length;return qr[o]??qr[0]}var $8=['[data-composer-drawer-layer="true"]','[data-slot="popover-popup"]','[data-slot="menu-popup"]','[data-slot="select-popup"]','[data-slot="combobox-popup"]','[data-slot="autocomplete-popup"]'].join(",");function K8(e){return e.closest($8)!==null}var V8=[];function q8(e,t){return{images:e.images,terminalContexts:e.terminalContexts,elementContexts:e.elementContexts,previewAnnotations:e.previewAnnotations,reviewComments:e.reviewComments,nonPersistedImageIds:e.nonPersistedImageIds,activeProvider:e.activeProvider,nativeModeByProvider:e.nativeModeByProvider,selectedPluginActionKey:e.selectedPluginActionKey,promptHasText:e.prompt.trim().length>0,promptInjection:r1(e.prompt),hasSendableContent:t({prompt:e.prompt,imageCount:e.images.length,terminalContexts:e.terminalContexts,elementContextCount:e.elementContexts.length+e.previewAnnotations.length+e.reviewComments.length}).hasSendableContent}}var W8=e=>e.prompt.trim();function G8(e){let{t}=Ce(),n=e.api.draft.useThreadDraftSelector(e.composerDraftTarget,W8),o=e.pendingCustomAnswer!==null;return u("button",{type:"button",className:$("min-w-0 flex-1 truncate bg-transparent p-0 text-left text-[14px]",(o?e.pendingCustomAnswer:n)?"text-foreground":"text-placeholder"),onPointerDown:r=>r.preventDefault(),onClick:e.onExpand,"aria-label":t("composer.expandComposer"),children:o?e.pendingCustomAnswer||t("composer.typeOwnAnswer"):n||(e.noProviderAvailable?t("composer.enableProviderSettings"):t("composer.askAnything"))})}var j8=pe(function(t){let{data:n,target:o}=ha(),r=Bw(),a=n.useAccountUsage({target:o,active:r&&!t.hidden});return t.hidden||a===void 0?null:u(I1,{...a},a.queryKey)}),Q8=pe(function(t){let{data:n,target:o}=ha(),r=n.useContextUsage(o);return r?.window==null?null:u(L1,{usage:r.window,breakdown:r.breakdown,modelDisplayName:t.modelDisplayName,onCompact:t.onCompact,compactDisabled:t.compactDisabled,compactDisabledReason:t.compactDisabledReason})}),X8=pe(function(t){let{t:n}=Ce();return b(Le,{children:[u(Q8,{modelDisplayName:t.activeThreadModelDisplayName,onCompact:t.onCompactContext,compactDisabled:t.compactDisabled,compactDisabledReason:t.compactDisabledReason}),t.isPreparingWorktree?u("span",{className:"text-secondary-label text-xs",children:n("composer.preparingWorktree")}):null,u(ju,{compact:t.compact,pendingAction:t.pendingAction,isRunning:t.isRunning,showPlanFollowUpPrompt:t.showPlanFollowUpPrompt,promptHasText:t.promptHasText,isSendBusy:t.isSendBusy,sendDisabledReason:t.sendDisabledReason,isEnvironmentUnavailable:t.isEnvironmentUnavailable,isPreparingWorktree:t.isPreparingWorktree,hasSendableContent:t.hasSendableContent,preserveComposerFocusOnPointerDown:t.preserveComposerFocusOnPointerDown??!1,showSendWhileRunning:t.showSendWhileRunning??!1,onPreviousPendingQuestion:t.onPreviousPendingQuestion,onInterrupt:t.onInterrupt,interruptArmed:t.interruptArmed,onImplementPlanInNewThread:t.onImplementPlanInNewThread,shellCommandMode:t.shellCommandMode,shellCommandUnavailableReason:t.shellCommandUnavailableReason})]})}),z1=pe(function(t){let n=BT(),{data:o,target:r,threadKey:a}=ha(),{activePendingApproval:i,pendingUserInputs:s,activePendingProgress:l,activePendingResolvedAnswers:d,activePendingIsResponding:c,activePendingDraftAnswers:f,activePendingQuestionIndex:p,respondingRequestIds:m,occupants:g,respondToApproval:h,respondToDecision:v,selectUserInputOption:y,changeUserInputCustomAnswer:x,advanceUserInput:C,previousUserInputQuestion:w}=o.useComposerPending({target:r,threadKey:a}),{runtimeMode:L,interactionMode:S,lockedProvider:k,providerStatuses:I,activeProjectDefaultModelSelection:T,projectId:A,activeThreadModelSelection:P}=o.useComposerModelContext(r),{activeThreadId:_,activeThread:E,isLocalDraftThread:F,projectSelectionRequired:B,phase:V,isSendBusy:Q,sendDisabledReason:Se,unavailableAgentInstanceId:H=null,noAgentChosen:q=!1,isPreparingWorktree:ee,environmentUnavailable:G,compactDisabled:te,compactDisabledReason:me}=M1(),{t:U}=Ce(),{composerDraftTarget:Y,environmentId:se,attachmentUploadsCapabilityKnown:ge,supportsAttachmentUploads:ie,routeKind:Ae,routeThreadRef:Xe,draftId:nt,forceExpandedOnMobile:rt,slots:Ve,resolvedTheme:ne,settings:we,keybindings:j,terminalOpen:X,gitCwd:ae,promptRef:oe,composerRef:ft,composerImagesRef:pt,composerTerminalContextsRef:yt,composerElementContextsRef:Lt,sendContextRef:on,onSend:gt,onInterrupt:zt,interruptArmed:Mt=!1,recentSlashCommandIds:wt=V8,onSlashCommandUsed:In,onCompactContext:ct,onImplementPlanInNewThread:dn,onProviderModelSelect:ro,onProviderInstanceSelect:Vt,onModelSelectionChosen:bn,onSelectPluginAction:Tn,onManagePlugins:rn,getModelDisabledReason:kn,getModelContinuationLabel:O,onContinueInModel:fe,toggleInteractionMode:ye,handleRuntimeModeChange:Te,handleInteractionModeChange:Me,handleNativeModeChange:ht,focusComposer:Ln,scheduleComposerFocus:mn,setThreadError:at,onExpandImage:Pt}=t,Et=o.useComposerPlan(r),St=Et.proposedPlan,an=Et.tasksProgress,Jt=Et.taskSteps,xe=s.length===0&&S==="plan"&&St!==null,_e=N(null),qe=R((D,Ie)=>{y(D,Ie),oe.current="",_e.current?.resetCursorState({cursor:0})},[oe,y]),We=R(async(D,Ie,He)=>{try{await h(D,Ie,He)}catch(Ot){at(r.threadId,Ot instanceof Error?Ot.message:U("approval.respondFailed"))}},[r.threadId,h,at,U]),ot=R((D,Ie)=>{v(D,Ie).then(He=>{He!==null&&at(r.threadId,He)})},[r.threadId,v,at]),xt=R(()=>{C().then(D=>{D!==null&&at(r.threadId,D)})},[C,r.threadId,at]),Bt=VM({machineUnavailable:G!==null,sessionStarted:E?.session!=null,sessionDisconnected:V==="disconnected"}),Zt=qM(Bt),ke=t.api,{limits:Ut}=t.attachments,vt=ke.draft.useThreadDraftSelector(Y,D=>q8(D,ke.chat.deriveComposerSendState)),Nt=vt.images,Bn=K(()=>Nt.filter(D=>gv(D)==="image"),[Nt]),ve=vt.terminalContexts,et=vt.elementContexts,lt=vt.previewAnnotations,it=vt.reviewComments,xn=vt.nonPersistedImageIds,gn=ke.uploads.useStore(D=>D.uploadsByImageId),cn=ie?ek({imageIds:Nt.map(D=>D.id),uploadsByImageId:gn,environmentId:se},U):null,It=ke.draft.useStore,Qt=It(D=>D.setPrompt),qt=It(D=>D.setNativeMode),ko=It(D=>D.addImage),Do=It(D=>D.addImages),va=It(D=>D.removeImage),Ya=It(D=>D.insertTerminalContext),Ue=It(D=>D.removeElementContext),ya=It(D=>D.removePreviewAnnotation),Wr=It(D=>D.removeReviewComment),tr=It(D=>D.clearComposerPromptAndImages);W(()=>{if(ge){if(!ie){for(let D of Nt)ke.uploads.release(D.id);return}ke.draft.restoreAttachments();for(let D of Nt)ke.uploads.start({environmentId:se,image:D})}},[ge,Nt,se,ie]);let Nn=K(()=>zM(ke.model.applyInstanceSettings(ke.model.deriveInstanceEntries(I),we)),[ke.model,I,we]),Ja=vt.activeProvider??null,nr=E?.session?.providerInstanceId??P?.instanceId??T?.instanceId??null,br=HM(Nn,Ja??nr)??ke.model.makeDriverKind("unconfigured"),wr=k??br,or=K(()=>{if(!k||!E)return null;let D=E.session?.providerInstanceId??P?.instanceId;return D?Nn.find(Ie=>Ie.instanceId===D)?.continuationGroupKey??null:null},[E,P?.instanceId,k,Nn]),_t=K(()=>{if(H!==null)return H;let D=[vt.activeProvider,E?.session?.providerInstanceId,P?.instanceId,T?.instanceId];for(let Ie of D){if(!Ie)continue;let He=Nn.find(Ot=>Ot.instanceId===Ie&&UM(Ot));if(He){if(k&&He.driverKind!==k||or&&He.continuationGroupKey!==or)continue;return He.instanceId}}return ke.model.noProviderSelection.instanceId},[T?.instanceId,E?.session?.providerInstanceId,P?.instanceId,vt.activeProvider,or,k,Nn,H]),Gn=H!==null,Lo=K(()=>Gn||q?void 0:Nn.find(D=>D.instanceId===_t),[q,Gn,Nn,_t]),Ee=Lo===void 0&&!Gn&&!q,Oo=Gn&&mC(Nn,{lockedProvider:k,lockedContinuationGroupKey:or}).length===0,zi=me??(Ee?U("composer.compactingUnavailable"):null),jn=Lo?.driverKind??wr,{modelOptions:Fo,selectedModel:Qn,selectedModelStatus:rr}=ke.draft.useEffectiveModelState({threadRef:Y,providers:I,selectedProvider:jn,selectedInstanceId:_t,threadModelSelection:P,projectModelSelection:T,settings:we}),Bo=K(()=>Lo?.snapshot??null,[Lo]),Sr=K(()=>Lo?.models??[],[Lo]),po=vt.promptInjection,zo=K(()=>a1({provider:jn,model:Qn,models:Sr,promptInjectionState:po,modelOptions:Fo?.[_t],planModeEnabled:we.planModeEnabled},ke.model),[Fo,po,_t,Qn,jn,Sr,we.planModeEnabled]),Ui=zo.promptEffort,Pn=zo.modelOptionsForDispatch,ei=we.planModeEnabled,Po=K(()=>({showInteractionModeToggle:ei&&ke.model.getInteractionModeToggle(I,jn),runtimeModeSwitch:Bo?.runtimeModeSwitch??"next-turn"}),[ei,I,jn,Bo]),Uo=Bo?.supportsNativeModeSwitch===!0,Gr=F&&Uo?vt.nativeModeByProvider?.[_t]??null:null,Xn=K(()=>ke.model.resolveNativeMode(Bo,{runtimeMode:L,nativeModeId:F?Gr:E?.nativeModeId??null}),[ke.model,E?.nativeModeId,Bo,L,F,Gr]),jr=Gr&&Xn?.current.id===Gr?Gr:void 0,ar=R(D=>{F&&qt(Y,_t,D),ht(D)},[F,qt,Y,_t,ht]),Yn=K(()=>ke.model.createSelection(_t,Qn,Pn),[ke.model,_t,Qn,Pn]);ZD({threadId:E?.id??null,isLocalDraftThread:F,selection:Yn,selectionsEqual:ke.model.selectionsEqual,onChosen:Gn||q?void 0:bn});let Hi=R(D=>Vt(D,Yn),[Vt,Yn]),mo=Qn,$e=K(()=>{let D=new Map;for(let Ie of Nn)D.set(Ie.instanceId,ke.model.getAppModelOptionsForInstance(we,Ie));return D},[Nn,we]),Dt=K(()=>($e.get(_t)??[]).some(Ie=>Ie.slug===mo)?mo:ke.model.normalizeSlug(mo)??mo,[ke.model,$e,_t,mo,jn]),un=F&&k===null,An=ke.pluginComposer.useOptions(un?se:null,A),Ho=An.options,xa=un?vt.selectedPluginActionKey:null,$i=K(()=>xa===null?null:Ho.find(D=>D.id===xa)??null,[xa,Ho]),nl=xa!==null,Ki=nl&&$i===null?U(An.isKnown?"composer.pluginUnavailable":"composer.pluginLoading"):null,Vi=Se??Ki??(l?null:cn),ol=Vi!==null,[Xg,Xu]=J(!1);W(()=>{Xu(!1)},[_t]);let Yg=$g(rr),Yu=j_({status:rr,submissionTarget:l?"pending-user-input":"provider-turn"}),Td=Xg&&Yu?Yg:null,z=K(()=>T1(P,$e),[P,$e]),Pe=`${String(se)}\0${String(Y)}`,[st,Xt]=J(!1),[$o,Ca]=J(!1),[qi,Ju]=J(null),[V1,q1]=J(null),[Jg,ti]=J(!1),[kd,rl]=J(!1),[W1,Fb]=J(null),[al,Zg]=J({key:0,active:!1}),Bb=N(Pe);he(()=>{Bb.current!==Pe&&(Bb.current=Pe,Xt(!1),Ju(null),ti(!1),rl(!1),Fb(null),Zg({key:al.key,active:!1}))},[Pe,al.key]);let Ir=Sp("max-sm"),ao=Ir&&!rt&&!$o,il=N(null),zb=N(null),eh=N(null),Ub=N(null),th=N(!1),go=N(null),sl=N(null),ll=N(null),Zu=N(!1),Hb=N(0),dl=N(null),nh=N(new Set),Wi=N(new Map),G1=R(()=>{Xt(!0)},[]),j1=R(D=>{Me(D)},[Me]),Q1=K(()=>new Set(xn),[xn]),Jn=i!==null,$b=l?.activeQuestion?.allowFreeform===!1,ni=O1(),X1=ke.draft.useThreadDraftSelector(Y,D=>N1(D.prompt)),cl=ni!==null&&X1&&!Jn&&l===null,Ld=g[0]??null,{showTopDrawer:ef,showCollapsedPromptRow:Y1,hasBlocking:Pd}=UT(Ld?.kind??null,ao),J1=xe||l!==null,{isComposerFooterCompact:Gi,isComposerPrimaryActionsCompact:Kb}=mk(eh,J1),Vb=l!==null,qb=R(D=>{let Ie=_e.current?.readDraftPrompt()??oe.current,He=D(Ie);if(He===Ie){mn();return}Vb?Qt(Y,He):(oe.current=He,Qt(Y,He),_e.current?.syncCursor(bo(He,He.length),wo(He,He.length))),mn()},[Vb,Y,oe,mn,Qt]),Z1=s1({modelApi:ke.model,provider:jn,instanceId:_t,...Ae==="server"?{threadRef:Xe}:{},...Ae==="draft"&&nt?{draftId:nt}:{},model:Qn,models:Sr,modelOptions:Fo?.[_t],promptInjection:po,onPromptUpdate:qb,planModeEnabled:we.planModeEnabled}),Wb=l1({modelApi:ke.model,provider:jn,instanceId:_t,...Ae==="server"?{threadRef:Xe}:{},...Ae==="draft"&&nt?{draftId:nt}:{},model:Qn,models:Sr,modelOptions:Fo?.[_t],promptInjection:po,onPromptUpdate:qb,planModeEnabled:we.planModeEnabled}),tf=K(()=>l?{questionIndex:l.questionIndex,isLastQuestion:l.isLastQuestion,canAdvance:l.canAdvance,isResponding:c,isComplete:!!d}:null,[c,l,d]),eO=V==="running"||Q||ol||Ee||B||G!==null||!vt.hasSendableContent,tO=U("composer.sendMessage"),Ad=Ir&&!ao&&tf!==null,nO=R(D=>{ko(Y,D)},[Y,ko]),oO=R(D=>{Do(Y,D)},[Y,Do]),rO=R(D=>{ke.uploads.release(D),va(Y,D)},[ke.uploads,Y,va]);W(()=>{Ju(null)},[et,lt,it,ve,Qn,Ui,jn]),he(()=>{pt.current=Nt},[Nt,pt]),he(()=>{yt.current=ve},[ve,yt]),he(()=>{Lt.current=et},[et,Lt]);let aO=R(()=>{if(!Ir)return;go.current!==null&&(window.cancelAnimationFrame(go.current),go.current=null);let D=document.activeElement;D instanceof HTMLElement&&D.blur(),Ca(!1)},[Ir]),iO=R(()=>!Ir||Q||ol||Ee||G!==null||V==="running"?!1:l?l.isLastQuestion&&!!d:xe||vt.hasSendableContent,[l,d,vt.hasSendableContent,G,Ir,Q,ol,Ee,V,xe]),{composerSubmissionError:sO,setComposerSubmissionError:nf,revalidatePromptLength:Gb,submitComposer:jb}=iD({promptRef:oe,maxInputChars:Ut.maxInputChars,noProviderAvailable:Ee,isSendDisabled:ol,sendDisabledReason:Vi,isModelSendBlocked:Yu,onModelSendBlocked:()=>{Xu(!0)},activeThreadId:_,activePendingProgress:l,composerDocumentKey:Pe,pendingImageCompressionsRef:Wi,onSend:gt,onProviderInputRejectedReset:()=>{th.current=!1},wasProviderInputRejected:()=>th.current,onStillCompressing:()=>{ke.notify.info(U("composer.stillCompressing"),U("composer.sendAgainThumbnail"))},shouldBlurMobileComposerOnSubmit:iO,blurMobileComposerAfterSend:aO}),oh=N(!1),Qb=R(D=>{if(D?.preventDefault(),ni===null||oh.current)return;if(ni.unavailableReason!==null){nf(ni.unavailableReason);return}let Ie=oe.current,He=_1(Ie),Ot=D1(He);if(Ot==="empty")return;if(Ot==="multiline"){nf(U("composer.shellCommand.singleLine"));return}nf(null),oh.current=!0;let wn=Y;ni.run(He).then(hn=>{!hn||oe.current!==Ie||(oe.current="",Qt(wn,""),_e.current?.syncCursor(0,null))}).finally(()=>{oh.current=!1})},[Y,ni,oe,Qt,nf,U]),of=R((D,Ie)=>{if(cl){Qb(D);return}jb(D,Ie)},[Qb,cl,jb]),Xb=R(()=>{if(!cl)return!1;let D=oe.current.slice(1);return oe.current=D,Qt(Y,D),_e.current?.resetCursorState({prompt:D,cursor:D.length}),!0},[Y,oe,Qt,cl]),lO=R(()=>{if(!(te||Ee||vt.hasSendableContent||i!==null||s.length>0||V==="running"||Q||!_)){if((Wi.current.get(Pe)??0)>0){ke.notify.info(U("composer.stillCompressing"),U("composer.compactAgainThumbnail"));return}ct()}},[i,_,te,Pe,vt.hasSendableContent,Q,Ee,ct,s.length,V]),rf=R(()=>{go.current!==null&&(window.cancelAnimationFrame(go.current),go.current=null),sl.current!==null&&window.cancelAnimationFrame(sl.current),ll.current!==null&&window.cancelAnimationFrame(ll.current),Zu.current=!0,Ca(!0),sl.current=window.requestAnimationFrame(()=>{sl.current=null,il.current?.focusAtEnd(),ll.current=window.requestAnimationFrame(()=>{ll.current=null,Zu.current=!1})})},[]),af=ke.stash.useStore,ul=af(D=>D.entries),Yb=af(D=>D.stashEntry),sf=af(D=>D.takeEntry),Jb=af(D=>D.finalizeEntryImages);W(()=>()=>{dl.current!==null&&window.clearTimeout(dl.current)},[]);let Zb=R(()=>{Hb.current+=1,Zg({key:Hb.current,active:!0}),dl.current!==null&&window.clearTimeout(dl.current),dl.current=window.setTimeout(()=>{dl.current=null,Zg(D=>({...D,active:!1}))},1200)},[]),dO=R(D=>{let{entry:Ie,durable:He}=sf(D.id);if(!Ie)return;He||ke.notify.warning(U("composer.stashReappear"),U("composer.storageRejectedKeep")),ti(!1);let Ot=oe.current,wn=D.prompt.length===0?Ot:Ot.trim().length?`${Ot.replace(/\s+$/,"")}
|
|
3804
|
+
`)?e.slice(0,-1):e}function d8(e){return e.startsWith("diff --git")||e.includes(`
|
|
3805
|
+
diff --git`)}function BD(e,t){if(e.length===0)return[""];let n=`
|
|
3806
|
+
${t}`,o=e.startsWith(t)?0:MD(e,n,0);if(o===-1)return[e];let r=[];o>0&&r.push(e.slice(0,o));let a=o;for(;;){let i=MD(e,n,a+1);if(i===-1)break;r.push(e.slice(a,i)),a=i}return r.push(e.slice(a)),r}function MD(e,t,n){let o=e.indexOf(t,n);return o===-1?-1:o+1}function ND(e){return e==null?e:Mn(e)}function c8(e){return e===" "?"context":e==="\\"?"metadata":e==="+"?"addition":"deletion"}function pb(e){let t=e.slice(1);return Mn(t===""?`
|
|
3807
|
+
`:t)}function mb(e,t,n){return e==="change"?{type:"change",additions:0,deletions:0,additionLineIndex:n,deletionLineIndex:t}:{type:"context",lines:0,additionLineIndex:n,deletionLineIndex:t}}var zD={light:"vscode-light-modern",dark:"vscode-dark-modern"};function HD(e){return e==="dark"?zD.dark:zD.light}var $D=2166136261,KD=16777619,u8=2654435769,f8=2246822507;function UD(e,t=$D,n=KD){let o=t>>>0;for(let r=0;r<e.length;r+=1)o^=e.charCodeAt(r),o=Math.imul(o,n)>>>0;return o>>>0}function p8(e,t="diff-panel"){let n=e.trim(),o=UD(n,$D,KD).toString(36),r=UD(n,u8,f8).toString(36);return`${t}:${n.length}:${o}:${r}`}function hb(e){if(!e.isPartial)return e;let t=0,n=0,o=e.hunks.map(r=>{let a={...r,splitLineStart:t,unifiedLineStart:n};return t+=r.splitLineCount,n+=r.unifiedLineCount,a});return{...e,hunks:o,splitLineCount:t,unifiedLineCount:n,...e.cacheKey?{cacheKey:`${e.cacheKey}:compact-partial`}:{}}}function VD(e,t="diff-panel",n={}){if(!e)return null;let o=e.trim();if(o.length===0)return null;try{let a=_D(o,p8(o,t)).flatMap(i=>n.compactPartialHunkOffsets?i.files.map(hb):i.files);return a.length>0?{kind:"files",files:a}:{kind:"raw",text:o,reason:"Unsupported diff format. Showing raw patch."}}catch{return{kind:"raw",text:o,reason:"Failed to parse patch. Showing raw patch."}}}function qD(e){let t=e.cacheKey;return t?t.endsWith(":hydrated")?t.slice(0,-9):t:`${e.prevName??"none"}:${e.name}`}function WD({fileChange:e,onOpenDiff:t}){let{t:n}=Ce(),[o,r]=J(!1),a=K(()=>xD(e),[e]),i=bD(e);return b("div",{className:"min-w-0",children:[b("div",{className:"flex min-w-0 flex-wrap items-center gap-1",children:[u("span",{className:"min-w-0 shrink truncate font-mono text-[11px] text-foreground/85",children:e.path}),u("span",{className:"shrink-0 font-mono text-[10px] text-muted-foreground tabular-nums",children:n("approval.diff.stat",{additions:i.additions,deletions:i.deletions})}),a===null?u("span",{className:"text-[11px] text-muted-foreground",children:e.omitted==="too-large"?n("approval.diff.tooLarge"):n("approval.diff.unavailable")}):b(ce,{size:"micro",variant:"ghost-muted",className:"font-normal","aria-expanded":o,onClick:()=>r(s=>!s),children:[o?u(an,{className:"size-3 shrink-0"}):u(Ko,{className:"size-3 shrink-0"}),u("span",{children:n(o?"approval.diff.hide":"approval.diff.show")})]}),t?u(ce,{size:"micro",variant:"ghost-muted",className:"font-normal",onClick:()=>t(e.path),children:n("approval.diff.open")}):null]}),o&&a!==null?u(m8,{path:e.path,unifiedDiff:a}):null]})}function m8({path:e,unifiedDiff:t}){let n=Wt().theme.useResolvedTheme(),o=K(()=>{let r=VD(t,`approval:${n}`,{compactPartialHunkOffsets:!0});return r?.kind==="files"?r.files.map(a=>({id:qD(hb(a)),type:"diff",fileDiff:a,collapsed:!1})):[]},[n,t]);return o.length===0?u("pre",{"aria-label":e,className:"mt-1 max-h-56 overflow-auto rounded-md border border-border/60 bg-background/60 p-2 font-mono text-[11px] leading-relaxed text-muted-foreground/90 [scrollbar-width:thin]",tabIndex:0,children:t}):u("div",{className:"mt-1 overflow-hidden rounded-md border border-border/60",children:u(pS,{className:"max-h-56 overflow-auto [scrollbar-gutter:stable]",items:o,options:{diffStyle:"unified",lineDiffType:"none",overflow:"wrap",theme:HD(n),themeType:n,stickyHeaders:!1}})})}var g8="block max-h-20 min-w-0 overflow-auto whitespace-pre font-mono text-[11px] text-foreground/85 [scrollbar-width:thin] [&::-webkit-scrollbar]:h-1.5",GD=pe(function({approval:t,pendingCount:n,onOpenDiff:o,className:r}){let{t:a}=Ce(),i=gD(t),{body:s}=i,l=CD(i.fileChanges);return b("div",{"aria-label":vD(i.kind,a),className:$("flex min-w-0 flex-1 flex-col gap-1",r),role:"group",children:[b("div",{className:"flex min-w-0 items-baseline gap-2",children:[u("span",{className:"min-w-0 flex-1 truncate text-[11px] font-medium text-foreground",children:hD(i,a)}),n>1?b("span",{className:"shrink-0 text-[10px] font-medium text-muted-foreground tabular-nums",children:["1/",n]}):null]}),s.shape==="none"?null:u("code",{"aria-label":yD(s.shape,a),className:$(g8,s.shape==="path"||s.shape==="url"?"truncate":null),"data-approval-detail":"complete",tabIndex:0,children:s.shape==="command"?s.command:s.shape==="path"?s.path:s.shape==="url"?s.url:s.shape==="query"?s.query:s.text}),i.description===null?null:u("span",{className:"min-w-0 text-[11px] text-muted-foreground",children:i.description}),i.fileChanges.map((d,c)=>u(WD,{fileChange:d,onOpenDiff:o},l[c])),i.args.length===0?null:b("details",{className:"min-w-0","data-approval-args":"true",children:[u("summary",{className:"cursor-pointer text-[11px] text-muted-foreground",children:a("approval.body.detailsSummary")}),u("dl",{"aria-label":a("approval.body.argumentsLabel"),className:"mt-1 grid max-h-32 min-w-0 grid-cols-[auto_minmax(0,1fr)] gap-x-2 gap-y-0.5 overflow-auto rounded-md border border-border/60 bg-background/60 p-2 text-[11px] [scrollbar-width:thin]",tabIndex:0,children:i.args.map(d=>b("div",{className:"col-span-2 grid grid-cols-subgrid",children:[u("dt",{className:"font-mono text-muted-foreground",children:d.name}),u("dd",{className:"min-w-0 font-mono whitespace-pre-wrap wrap-break-word text-foreground/85",children:d.value})]},d.name))})]})]})});var vb=pe(function(t){return u(GD,{...t})});ue();var yb=pe(function(t){let{t:n}=Ce(),[o,r]=J(!1),[a,i]=J(!1),s=t.decision,l=s.requestId;if(l===null)return null;let d=f=>f.key===void 0?f.text:n(f.key,{...f.params,defaultValue:f.text}),c=s.askedBy.kind==="plugin"?s.askedBy.pluginId:null;return b("div",{className:$("flex min-w-0 flex-col gap-1 px-3 py-1.5 sm:px-4",t.className),"data-composer-pending-decision":"true",children:[b("div",{className:"flex min-w-0 items-baseline gap-2",children:[u("span",{className:"min-w-0 flex-1 truncate text-[11px] font-medium text-foreground",children:d(s.title)}),c===null?null:u("span",{className:"shrink-0 font-mono text-[10px] text-muted-foreground",children:c})]}),s.body.map((f,p)=>u("span",{className:"min-w-0 text-[11px] text-muted-foreground",children:d(f)},`${String(p)}:${f.key??f.text}`)),s.detail===null?null:u("button",{type:"button",className:"min-w-0 truncate text-left font-mono text-[11px] text-muted-foreground",onClick:()=>r(f=>!f),children:o?s.detail.text.slice(0,4e3):s.detail.text.split(`
|
|
3808
|
+
`)[0]}),u("div",{className:"flex min-w-0 flex-wrap items-center gap-1 pt-0.5",children:s.options.map(f=>u(ce,{size:"xs",variant:f.tone==="primary"?"default":f.tone==="danger"?"destructive":"outline",disabled:a,onClick:()=>{i(!0),t.onRespond(l,f.id)},children:d(f.label)},f.id))})]})});function Vg(e){return e.id??e.label}function xb(e,t){return Array.from(new Set((t??[]).flatMap(n=>{let o=e.options.find(r=>r.id!==void 0?r.id===n:r.label===n.trim());return o?[Vg(o)]:[]})))}function h8(e){if(typeof e!="string")return null;let t=e.trim();return t.length>0?t:null}function Cb(e,t){let n=h8(t?.customAnswer);if(e.allowFreeform!==!1&&n)return n;let o=xb(e,t?.selectedOptionLabels);return e.multiSelect?o.length>0?o:null:o[0]??null}function v8(e,t){let n={};for(let o of e){let r=Cb(o,t[o.id]);if(!r)return null;n[o.id]=r}return n}function y8(e,t){return e.reduce((n,o)=>Cb(o,t[o.id])?n+1:n,0)}function jD(e,t,n){let o=e.length===0?0:Math.max(0,Math.min(n,e.length-1)),r=e[o]??null,a=r?t[r.id]:void 0,i=r?Cb(r,a):null,s=r?.allowFreeform===!1?"":a?.customAnswer??"",l=y8(e,t),d=e.length===0?!0:o>=e.length-1;return{questionIndex:o,activeQuestion:r,activeDraft:a,selectedOptionLabels:r?xb(r,a?.selectedOptionLabels):[],customAnswer:s,resolvedAnswer:i,usingCustomAnswer:s.trim().length>0,answeredQuestionCount:l,isLastQuestion:d,isComplete:v8(e,t)!==null,canAdvance:!!i}}ue();var QD=pe(function({pendingUserInputs:t,respondingRequestIds:n,answers:o,questionIndex:r,onToggleOption:a,onAdvance:i}){if(t.length===0)return null;let s=t[0];return s?u(x8,{prompt:s,isResponding:n.includes(s.requestId),answers:o,questionIndex:r,onToggleOption:a,onAdvance:i},s.requestId):null}),x8=pe(function({prompt:t,isResponding:n,answers:o,questionIndex:r,onToggleOption:a,onAdvance:i}){let{t:s}=Ce(),l=Wt(),d=jD(t.questions,o,r),c=d.activeQuestion,f=N(null),p=N(i),[m,g]=J(null),[h,v]=J(null),y=h!==null&&h===c?.id;W(()=>{p.current=i},[i]),W(()=>{if(!(!c||c.multiSelect||!m)){if(m.questionId!==c.id){g(null);return}d.customAnswer.trim().length===0&&d.selectedOptionLabels.includes(m.optionLabel)&&g(null)}},[c,m,d.customAnswer,d.selectedOptionLabels]),W(()=>()=>{f.current!==null&&window.clearTimeout(f.current)},[]);let x=R((w,L)=>{if(c?.multiSelect){a(w,L);return}g({questionId:w,optionLabel:L}),a(w,L),f.current!==null&&window.clearTimeout(f.current),f.current=window.setTimeout(()=>{f.current=null,p.current()},200)},[c,a]);if(l.pane.useKeydown(w=>{if(!c||n||y||w.metaKey||w.ctrlKey||w.altKey||w.isComposing||w.keyCode===229||ui(w.target))return;let L=Th(w.key,c.options.length);if(L===null)return;let S=c.options[L];S&&(w.preventDefault(),x(c.id,Vg(S)))},{target:"document"}),!c)return null;let C=d.customAnswer.trim().length>0;return b(aS,{className:"py-2",open:!y,onOpenChange:w=>{v(w?null:c.id)},children:[u("div",{className:"flex items-center gap-1 px-1 sm:px-2",children:b(sS,{title:s(y?"pendingUserInput.showQuestion":"pendingUserInput.hideQuestion"),"data-pending-user-input-toggle":y?"collapsed":"expanded",className:"group -my-1 flex min-w-0 flex-1 items-center gap-2 rounded-md px-2 py-1.5 text-left transition-colors duration-(--control-duration) hover:bg-muted/40",children:[u("span",{className:"text-xs font-medium text-muted-foreground group-hover:text-foreground/85",children:c.header}),t.questions.length>1?b("span",{className:"text-[10px] font-medium text-muted-foreground tabular-nums",children:[r+1,"/",t.questions.length]}):null,y?u("span",{className:"min-w-0 flex-1 truncate text-secondary-label text-xs",children:c.question}):null,u(an,{"aria-hidden":"true",className:$("ml-auto size-icon-2 shrink-0 text-secondary-label transition-transform duration-(--control-duration) group-hover:text-foreground",y&&"rotate-180")})]})}),u(iS,{className:"px-3 sm:px-4",children:b("div",{className:"pt-2 pb-0.5",children:[u("div",{className:"max-h-[min(45vh,28rem)] overflow-y-auto overscroll-contain break-words text-sm text-foreground/85","data-pending-user-input-body":c.kind??"question",tabIndex:0,children:c.kind==="plan"?u(dr,{text:c.question,cwd:void 0,isStreaming:!1}):u("p",{className:"whitespace-pre-wrap",children:c.question})}),c.multiSelect?u("p",{className:"mt-1 text-secondary-label text-xs",children:s("pendingUserInput.selectOneOrMore")}):null,u("div",{className:"mt-2 space-y-0.5",children:c.options.map((w,L)=>{let S=Vg(w),I=m?.questionId===c.id&&m.optionLabel===S||!C&&d.selectedOptionLabels.includes(S),T=L<9?L+1:null,A=$("group relative flex w-full items-center gap-2 rounded-md px-2.5 py-2 text-left transition-colors duration-(--control-duration) pointer-coarse:after:absolute pointer-coarse:after:inset-0 pointer-coarse:after:min-h-11",I?"bg-muted/55 text-foreground":"bg-transparent text-foreground/85 hover:bg-muted/40",n&&"opacity-50 cursor-not-allowed",!n&&"cursor-pointer"),P=b(Pe,{children:[b("div",{className:"min-w-0 flex-1 flex flex-col gap-0.5",children:[u("span",{className:"text-sm font-medium",children:w.label}),w.description&&w.description!==w.label?u("span",{className:"text-secondary-label text-[11px]",children:w.description}):null]}),I?u(ho,{className:"size-icon-2 shrink-0 text-primary"}):T!==null?u("kbd",{className:$("flex size-5 shrink-0 items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums"),children:T}):null]});return u("button",{type:"button","aria-pressed":I,disabled:n,onClick:()=>{x(c.id,S)},className:A,children:P},`${c.id}:${S}`)})})]})})]})});ue();var XD=pe(function({planTitle:t}){let{t:n}=Ce();return u("div",{className:"px-3 py-2 sm:px-4",children:b("div",{className:"flex flex-wrap items-center gap-2",children:[u("span",{className:"text-xs font-medium text-muted-foreground",children:n("plan.ready")}),t?u("span",{className:"min-w-0 flex-1 truncate text-xs text-foreground/85",children:t}):null]})})});function YD(e){if(e.occupant.kind!=="approval")return null;let{approval:t}=e.occupant;return u(uD,{requestId:t.requestId,isResponding:e.respondingRequestIds.includes(t.requestId),options:t.options,keybindings:e.keybindings,declineReasonRelay:t.declineReasonRelay,onRespondToApproval:e.onRespondToApproval})}function JD(e){return e.occupant.kind!=="user-input"?null:u(QD,{pendingUserInputs:[e.occupant.userInput],respondingRequestIds:e.respondingRequestIds,answers:e.activePendingDraftAnswers,questionIndex:e.activePendingQuestionIndex,onToggleOption:e.onSelectActivePendingUserInputOption,onAdvance:e.onAdvanceActivePendingUserInput})}var ZD={approval:{expanded:e=>e.occupant.kind!=="approval"?null:b("div",{className:"flex min-w-0 flex-wrap items-start gap-1 px-3 py-1.5 sm:px-4",children:[u(vb,{approval:e.occupant.approval,pendingCount:e.occupant.pendingCount}),u("div",{className:"flex min-w-0 flex-wrap items-center gap-0.5",children:YD(e)})]}),collapsed:e=>e.occupant.kind!=="approval"?null:b("div",{"data-chat-composer-collapsed-controls":"true",children:[u(vb,{approval:e.occupant.approval,pendingCount:e.occupant.pendingCount,className:"px-3 pt-2 sm:px-4"}),u("div",{className:"flex flex-wrap items-center justify-end gap-1 px-3 pt-2 pb-3 sm:px-4",children:YD(e)})]})},decision:{expanded:e=>e.occupant.kind!=="decision"?null:u(yb,{decision:e.occupant.decision.card,onRespond:e.onRespondToDecision}),collapsed:e=>e.occupant.kind!=="decision"?null:u("div",{"data-chat-composer-collapsed-controls":"true",children:u(yb,{decision:e.occupant.decision.card,onRespond:e.onRespondToDecision,className:"pt-2 pb-3"})})},"user-input":{expanded:JD,collapsed:e=>b("div",{"data-chat-composer-collapsed-controls":"true",children:[JD(e),e.collapsedPendingRow]})},"plan-follow-up":{expanded:e=>e.activeProposedPlan===null?null:u(XD,{planTitle:cD(e.activeProposedPlan.planMarkdown)??null},e.activeProposedPlan.id),collapsed:null}};function e1(e,t){let n=ZD[e.occupant.kind],o=t?n.collapsed:n.expanded;return o===null?null:o(e)}var Whe=Object.keys(ZD);ue();function t1(e){let{threadId:t,isLocalDraftThread:n,selection:o,selectionsEqual:r,onChosen:a}=e,i=N(null);W(()=>{let s=i.current;i.current={threadId:t,selection:o},!(s===null||s.threadId!==t||n)&&(r(s.selection,o)||a?.(o))},[t,n,o,r,a])}function C8(e){return typeof e!="string"?null:e.trim()||null}function b8(e){return e.type==="select"?{...e,options:[...e.options],...e.promptInjectedValues?{promptInjectedValues:[...e.promptInjectedValues]}:{}}:{...e}}function w8(e,t){return e?.find(o=>o.id===t)?.value}function n1(e,t){let n=C8(t);return n?e.options.length===0?n:e.promptInjectedValues?.includes(n)&&e.options.some(o=>o.id===n)?e.options.find(o=>o.isDefault)?.id:e.options.some(o=>o.id===n)?n:e.currentValue??e.options.find(o=>o.isDefault)?.id:e.currentValue??e.options.find(o=>o.isDefault)?.id}function S8(e,t){if(e.type==="boolean")return typeof t=="boolean"?{...e,currentValue:t}:e;let n=typeof t=="string"?n1(e,t):n1(e,e.currentValue);if(!n){let{currentValue:o,...r}=e;return r}return{...e,currentValue:n}}function qg(e){let{caps:t,selections:n}=e;return(t.optionDescriptors??[]).map(b8).map(r=>S8(r,w8(n,r.id)??r.currentValue))}function Zs(e){if(e)return e.type==="boolean"||e.currentValue?e.currentValue:e.options.find(t=>t.isDefault)?.id}function bb(e){if(!e)return;let t=Zs(e);if(typeof t=="string")return e.options.find(n=>n.id===t)?.label}function Wg(e){if(!e||e.length===0)return;let t=[];for(let n of e){let o=Zs(n);(typeof o=="string"||typeof o=="boolean")&&t.push({id:n.id,value:o})}return t.length>0?t:void 0}function wb(e){return typeof e=="string"&&/\bultrathink\b/i.test(e)}function o1(e,t){let n=e.trim();return!n||t!=="ultrathink"||/^\/[^\s/]+(?:\s|$)/u.test(n)||n.startsWith("Ultrathink:")?n:`Ultrathink:
|
|
3809
|
+
${n}`}ue();var I8=`Ultrathink:
|
|
3810
|
+
`;function T8(){let{t:e}=Ce();return u(vl,{variant:"outline",className:"inline-flex h-4 w-fit min-w-0 items-center justify-center gap-0 border-border/70 bg-muted/60 px-1.5 py-0 font-semibold text-[10px] text-muted-foreground leading-none sm:h-4",children:e("traits.default")})}function r1(e,t,n){return e.map(o=>o.id!==t?o:o.type==="boolean"?{...o,...typeof n=="boolean"?{currentValue:n}:{}}:{...o,...typeof n=="string"?{currentValue:n}:{}})}function Gg(e){if(!e)return null;let t=Zs(e);return typeof t=="string"?t:null}function k8(e,t,n,o,r,a,i,s){let l=e.getModelCapabilities(n,o,s),d=qg({caps:l,selections:a}),c=d.filter(I=>I.type==="select"),f=d.filter(I=>I.type==="boolean"),p=c[0]??null,m=c.find(I=>I.id==="contextWindow")??null,g=c.find(I=>I.id==="agent")??null,h=f.find(I=>I.id==="fastMode")??null,v=f.find(I=>I.id==="thinking")??null,y=i&&(p?.promptInjectedValues?.length??0)>0&&r!=="none",x=y&&r==="ultrathink-in-body",C=(y?"ultrathink":Gg(p))??null,w=typeof v?.currentValue=="boolean"?v.currentValue:null,L=Gg(m),S=Gg(g),k=g?bb(g):null;return{caps:l,descriptors:d,selectDescriptors:c,booleanDescriptors:f,primarySelectDescriptor:p,contextWindowDescriptor:m,agentDescriptor:g,fastModeDescriptor:h,thinkingDescriptor:v,effort:C,thinkingEnabled:w,contextWindow:L,ultrathinkPromptControlled:y,ultrathinkInBodyText:x,selectedAgent:S,selectedAgentLabel:k}}function Sb(e){let t=k8(e.modelApi,e.provider,e.models,e.model,e.promptInjection,e.modelOptions,e.allowPromptInjectedEffort??!0,e.planModeEnabled),n=t.primarySelectDescriptor!==null,o=t.thinkingDescriptor!==null,r=t.fastModeDescriptor!==null,a=t.contextWindowDescriptor!==null,i=t.agentDescriptor!==null;return{...t,showEffort:n,showThinking:o,showFastMode:r,showContextWindow:a,showAgent:i,hasAnyControls:n||o||r||a||i}}function Ib(e){return Sb(e).hasAnyControls}var Tb=pe(function({provider:t,instanceId:n,models:o,model:r,promptInjection:a,onPromptUpdate:i,modelOptions:s,allowPromptInjectedEffort:l=!0,planModeEnabled:d,...c}){let{t:f}=Ce(),p=Wt(),m=p.draft.useStore(I=>I.setProviderModelOptions),g=R(I=>{if("onModelOptionsChange"in c){c.onModelOptionsChange(I);return}let T=c.threadRef??c.draftId;T&&m(T,t,I,{...n?{instanceId:n}:{},model:r,persistSticky:!0})},[n,r,c,t,m]),{descriptors:h,selectDescriptors:v,booleanDescriptors:y,primarySelectDescriptor:x,ultrathinkPromptControlled:C,ultrathinkInBodyText:w,hasAnyControls:L}=Sb({modelApi:p.model,provider:t,models:o,model:r,promptInjection:a,modelOptions:s,allowPromptInjectedEffort:l,planModeEnabled:d}),S=I=>{g(Wg(I))},k=(I,T)=>{if(T){if(I.promptInjectedValues?.includes(T)){i(A=>A.trim().length===0?I8:o1(A,"ultrathink"));return}w&&I.id===x?.id||(C&&I.id===x?.id&&i(A=>A.replace(/^Ultrathink:\s*/i,"")),S(r1(h,I.id,T)))}};return L?b(Pe,{children:[v.map((I,T)=>{let A=C&&I.id===x?.id?"ultrathink":Gg(I)??"";return b("div",{children:[T>0?u(di,{}):null,b(dc,{children:[u("div",{className:"px-2 pt-1.5 pb-1 font-medium text-muted-foreground text-xs",children:I.label}),w&&I.id===x?.id?u("div",{className:"px-2 pb-1.5 text-muted-foreground/80 text-xs",children:f("traits.ultrathinkInBodyNotice")}):null,u(kr,{value:A,onValueChange:P=>k(I,P),children:I.options.map(P=>u(qo,{value:P.id,hideIndicator:!0,closeOnClick:!0,disabled:w&&I.id===x?.id,children:b("span",{className:"flex w-full min-w-0 flex-col",children:[u("span",{className:"flex w-full min-w-0 items-center justify-between gap-3",children:b("span",{className:"min-w-0 truncate",children:[P.label,P.isDefault?b(Pe,{children:[" ",u(T8,{})]}):null]})}),P.description?u("span",{className:"max-w-56 text-pretty text-muted-foreground/80 text-xs",children:P.description}):null]})},P.id))})]})]},I.id)}),y.map((I,T)=>{let A=I.currentValue===!0?"on":"off";return b("div",{children:[T>0||v.length>0?u(di,{}):null,b(dc,{children:[u("div",{className:"px-2 py-1.5 font-medium text-muted-foreground text-xs",children:I.label}),u(kr,{value:A,onValueChange:P=>{S(r1(h,I.id,P==="on"))},children:["on","off"].map(P=>u(qo,{value:P,hideIndicator:!0,closeOnClick:!0,children:u("span",{className:"flex w-full min-w-0 items-center justify-between gap-3",children:u("span",{children:f(P==="on"?"traits.on":"traits.off")})})},P))})]})]},I.id)})]}):null});function L8(e,t){let n=null,o=!1,r=[];for(let a of t.descriptors){if(a.id==="fastMode"&&a.type==="boolean"){o=a.currentValue===!0,n=e(o?"traits.fast":"traits.normal");continue}if(t.provider==="codex"&&a.id==="serviceTier"&&a.type==="select"){let s=Zs(a),l=a.options.find(({label:d})=>d==="Fast");if(l&&(s==="default"||s===l.id)){o=s===l.id,n=a.options.find(({id:d})=>d===s)?.label??e(o?"traits.fast":"traits.normal");continue}}let i=t.ultrathinkPromptControlled&&a.id===t.primarySelectDescriptorId?e("traits.ultrathink"):a.type==="boolean"?e("traits.labelWithState",{label:a.label,state:e(a.currentValue===!0?"traits.on":"traits.off")}):bb(a);typeof i=="string"&&i.length>0&&r.push(i)}return r.length===0&&n!==null?{label:n,showFastModeIcon:!1}:{label:r.join(" \xB7 "),showFastModeIcon:o}}var a1=pe(function({provider:t,instanceId:n,models:o,model:r,promptInjection:a,onPromptUpdate:i,modelOptions:s,allowPromptInjectedEffort:l=!0,planModeEnabled:d,triggerVariant:c,triggerClassName:f,...p}){let[m,g]=J(!1),{t:h}=Ce(),v=Wt().model,{descriptors:y,primarySelectDescriptor:x,ultrathinkPromptControlled:C}=Sb({modelApi:v,provider:t,models:o,model:r,promptInjection:a,modelOptions:s,allowPromptInjectedEffort:l,planModeEnabled:d});if(!Ib({modelApi:v,provider:t,models:o,model:r,promptInjection:a,modelOptions:s,allowPromptInjectedEffort:l,planModeEnabled:d}))return null;let{label:w,showFastModeIcon:L}=L8(h,{provider:t,descriptors:y,primarySelectDescriptorId:x?.id??null,ultrathinkPromptControlled:C}),S=L?b(Pe,{children:[u(Yo,{icon:ls,className:$("fill-current opacity-80",t==="claudeAgent"?"text-[#d97757]":"text-foreground")}),u("span",{className:"sr-only",children:h("traits.fastModeOn")})]}):null,k=t==="codex";return b(Eo,{open:m,onOpenChange:I=>{g(I)},children:[u(Mo,{render:u(Xo,{variant:c??"ghost",className:$(k?"min-w-0 max-w-40 shrink justify-start overflow-hidden whitespace-nowrap sm:max-w-48":"shrink-0 whitespace-nowrap",f)}),children:k?b("span",{className:"flex min-w-0 w-full items-center gap-1.5 overflow-hidden",children:[S,u("span",{className:"min-w-0 truncate",children:w}),u(ma,{})]}):b(Pe,{children:[S,u("span",{children:w}),u(ma,{})]})}),u(Ro,{align:"start",children:u(Tb,{provider:t,...n?{instanceId:n}:{},models:o,model:r,promptInjection:a,onPromptUpdate:i,modelOptions:s,allowPromptInjectedEffort:l,planModeEnabled:d,...p})})]})});function i1(e){return wb(e)?wb(e.replace(/^Ultrathink:\s*/i,""))?"ultrathink-in-body":"ultrathink":"none"}function s1(e,t){let{provider:n,model:o,models:r,modelOptions:a,promptInjectionState:i="none",planModeEnabled:s}=e,l=t.getModelCapabilities(r,o,s),d=qg({caps:l,selections:a}),c=d.find(g=>g.type==="select"),f=Zs(c??null),p=typeof f=="string"?f:null,m=(c?.promptInjectedValues?.length??0)>0&&i!=="none";return{provider:n,promptEffort:p,modelOptionsForDispatch:Wg(d),...m?{composerFrameClassName:"ultrathink-frame",composerSurfaceClassName:"shadow-[0_0_0_1px_rgba(255,255,255,0.07)_inset]",modelPickerIconClassName:"ultrathink-chroma"}:{}}}function l1(e,t){let{provider:n,instanceId:o,threadRef:r,draftId:a,model:i,models:s,modelOptions:l,promptInjection:d,onPromptUpdate:c,planModeEnabled:f}=t;return!(r!==void 0||a!==void 0)||!Ib({modelApi:t.modelApi,provider:n,models:s,model:i,modelOptions:l,promptInjection:d,planModeEnabled:f})?null:u(e,{provider:n,...o?{instanceId:o}:{},models:s,...r?{threadRef:r}:{},...a?{draftId:a}:{},model:i,modelOptions:l,promptInjection:d,onPromptUpdate:c,planModeEnabled:f})}function d1(e){return l1(Tb,e)}function c1(e){return l1(a1,e)}ue();var u1=e=>{let t,n=new Set,o=(d,c)=>{let f=typeof d=="function"?d(t):d;if(!Object.is(f,t)){let p=t;t=c??(typeof f!="object"||f===null)?f:Object.assign({},t,f),n.forEach(m=>m(t,p))}},r=()=>t,s={setState:o,getState:r,getInitialState:()=>l,subscribe:d=>(n.add(d),()=>n.delete(d))},l=t=e(o,r,s);return s},f1=(e=>e?u1(e):u1);ue();var P8=e=>e;function A8(e,t=P8){let n=yn.useSyncExternalStore(e.subscribe,yn.useCallback(()=>t(e.getState()),[e,t]),yn.useCallback(()=>t(e.getInitialState()),[e,t]));return yn.useDebugValue(n),n}var p1=e=>{let t=f1(e),n=o=>A8(t,o);return Object.assign(n,t),n},m1=(e=>e?p1(e):p1);var kb=m1(e=>({presetIdByDraftId:{},setDraftPresetId:(t,n)=>{e(o=>{if((o.presetIdByDraftId[t]??null)===n)return o;let r={...o.presetIdByDraftId};return n===null?delete r[t]:r[t]=n,{presetIdByDraftId:r}})},clearDraftPresetId:t=>{e(n=>{if(n.presetIdByDraftId[t]===void 0)return n;let o={...n.presetIdByDraftId};return delete o[t],{presetIdByDraftId:o}})}}));function g1(e){return kb(t=>e===null?null:t.presetIdByDraftId[e]??null)}function Lb(e,t){return t==null?void 0:e.find(n=>n.presetId===t)}var Pb="__none__",h1=pe(function({environmentId:t,draftId:n,threadPresetId:o,compact:r}){let{t:a}=Ce(),i=Wt().presets.useThreadPresets(t),s=g1(n),l=kb(c=>c.setDraftPresetId);if(n===null){let f=Lb(i,o)?.displayName??o;return f===null?null:b(Xo,{variant:"ghost",disabled:!0,"aria-label":a("preset.appliedLabel",{name:f}),className:"shrink-0 whitespace-nowrap",children:[u(Yo,{icon:Ta}),u("span",{className:"min-w-0 truncate",children:f})]})}if(i.length===0)return null;let d=Lb(i,s);return b(Eo,{children:[u(Mo,{render:u(Xo,{variant:"ghost","aria-label":a("preset.triggerLabel"),className:"min-w-0 max-w-40 shrink whitespace-nowrap sm:max-w-48"}),children:b("span",{className:"flex w-full min-w-0 items-center gap-1.5 overflow-hidden",children:[u(Yo,{icon:Ta}),r?null:u("span",{className:"min-w-0 truncate",children:d?.displayName??a("preset.none")}),u(ma,{})]})}),u(Ro,{align:"start",children:b(dc,{children:[u("div",{className:"px-2 pt-1.5 pb-1 font-medium text-muted-foreground text-xs",children:a("preset.menuTitle")}),b(kr,{value:s??Pb,onValueChange:c=>{l(n,c===Pb?null:c)},children:[u(qo,{value:Pb,hideIndicator:!0,closeOnClick:!0,children:u("span",{className:"min-w-0 truncate",children:a("preset.none")})}),i.map(c=>u(qo,{value:c.presetId,hideIndicator:!0,closeOnClick:!0,children:b("span",{className:"flex w-full min-w-0 flex-col",children:[u("span",{className:"min-w-0 truncate",children:c.displayName}),c.description?u("span",{className:"max-w-56 text-pretty text-muted-foreground/80 text-xs",children:c.description}):null]})},c.presetId))]})]})})]})});ue();function v1(e){let t=e.credentialIdentity;return[e.queryKey,t===null?"":t.id,t===null?"":String(t.revision)].join("\0")}function E8(e,t){let n=t.credentialIdentity;return n===null?!1:e.environmentId===t.environmentId&&e.instanceId===t.instanceId&&e.credentialIdentity.id===n.id&&e.credentialIdentity.revision===n.revision}function y1(e){return e.capability.status!=="unsupported"&&e.credentialIdentity!==null}function Ab(e,t){return e===null||!Number.isFinite(e)?null:t.kind==="money"?e.toFixed(t.precision):(Number.isInteger(e),String(e))}function jg(e){if(e==null||!Number.isFinite(e)||e<=0)return null;let t=864e5,n=36e5,o=6e4,r=1e3;return e%t===0?{unit:"days",count:e/t}:e%n===0?{unit:"hours",count:e/n}:e%o===0?{unit:"minutes",count:e/o}:e%r===0?{unit:"seconds",count:e/r}:null}function Eb(e,t){return e.freshness==="stale"||e.status==="error"||e.errorReason!==null||t!==null}function x1(e){if(e.unlimited===!0)return{kind:"unlimited"};let t=e.kind==="spend-cap"?e.used??e.remaining:e.remaining??e.used,n=Ab(t,e.unit);return n===null?null:e.unit.kind==="money"?{kind:"money",amount:n,currency:e.unit.currency}:e.unit.kind==="percent"?{kind:"percent",amount:n,direction:e.unit.direction}:{kind:"quantity",amount:n,nativeUnit:e.unit.nativeUnit}}function C1(e,t){let n=[];for(let o of e){let r=x1(o);r!==null&&n.push({metricId:o.metricId,kind:o.kind,display:r,nativeLabel:o.nativeLabel,durationMs:o.windowMs,resetsAt:o.resetsAt,fetchedAt:o.fetchedAt,stale:Eb(o,t)})}return n}function b1(e){return e.filter(t=>t.kind==="rate-limit"&&x1(t)===null).map(t=>({metricId:t.metricId,kind:t.kind,nativeLabel:t.nativeLabel,durationMs:t.windowMs,resetsAt:t.resetsAt}))}function w1(e){return e.snapshot===null||e.credentialIdentity===null?null:E8(e.snapshot,e)?e.snapshot:null}function S1(e){for(let t of e)if(t.resetsAt!==null)return t.resetsAt;return null}function I1(e){let t=null;for(let n of e)n.fetchedAt!==null&&(t===null||n.fetchedAt<t)&&(t=n.fetchedAt);return t}ue();function T1(e,t){let n=N(e),o=N(0),r=N(!1),[a,i]=J(e),[s,l]=J(null),[d,c]=J(!1);a!==e&&(i(e),n.current=e,o.current+=1,r.current=!1,l(null),c(!1));let f=R(async()=>{if(r.current)return;let p=o.current+1;o.current=p;let m=e;r.current=!0,c(!0);try{let g=await t();if(o.current!==p||n.current!==m)return;l(g)}catch{if(o.current!==p||n.current!==m)return;l({outcome:"error",retryAt:null})}finally{o.current===p&&n.current===m&&(r.current=!1,c(!1))}},[e,t]);return{feedback:s,refreshing:d,refresh:f}}function Mb(e,t){switch(e.unit){case"days":return t("accountUsage.windowDays",{count:e.count});case"hours":return t("accountUsage.windowHours",{count:e.count});case"minutes":return t("accountUsage.windowMinutes",{count:e.count});case"seconds":return t("accountUsage.windowSeconds",{count:e.count})}}function Nb(e,t){let n=e.nativeLabel?.trim()??"";if(n.length>0)return n;let o=jg(e.durationMs);return o!==null?Mb(o,t):_8(e.kind,t)}function R8(e,t){switch(e.kind){case"unlimited":return t("accountUsage.unlimited");case"money":return`${e.currency} ${e.amount}`;case"quantity":return`${e.amount} ${e.nativeUnit}`;case"percent":return e.direction==="used"?t("accountUsage.percentUsed",{value:e.amount}):t("accountUsage.percentRemaining",{value:e.amount})}}function M8(e,t){let n=R8(e.display,t);if(e.kind==="quota-window")return`${Nb(e,t)} ${n}`;let o=e.nativeLabel?.trim()??"";return o.length>0?`${o} ${n}`:n}function N8(e,t){let n=Nb({kind:e.kind,nativeLabel:e.nativeLabel,durationMs:e.durationMs},t),o=jg(e.durationMs);return o!==null?`${n} \xB7 ${Mb(o,t)}`:e.resetsAt!==null?`${n} \xB7 ${t("accountUsage.resetsAt",{time:Sd(e.resetsAt)})}`:n}function _8(e,t){switch(e){case"balance":return t("accountUsage.kindBalance");case"credits":return t("accountUsage.kindCredits");case"quota-window":return t("accountUsage.kindQuotaWindow");case"spend-cap":return t("accountUsage.kindSpendCap");case"rate-limit":return t("accountUsage.kindRateLimit")}}function D8(e,t){switch(e){case"account":return t("accountUsage.scopeAccount");case"org":return t("accountUsage.scopeOrg")}}function Sd(e){return ra(e,"locale")||e}function O8(e,t){switch(e.outcome){case"fresh":return t("accountUsage.outcomeFresh");case"partial":return t("accountUsage.outcomePartial");case"joined-inflight":return t("accountUsage.outcomeJoinedInflight");case"rate-limited":return e.retryAt===null?t("accountUsage.outcomeRateLimited"):t("accountUsage.outcomeRateLimitedUntil",{time:Sd(e.retryAt)});case"offline":return t("accountUsage.outcomeOffline");case"unsupported":return t("accountUsage.outcomeUnsupported");case"error":return t("accountUsage.outcomeError")}}function F8(e,t){switch(e){case"credential-unavailable":return t("accountUsage.unsupportedSignedOut");case"instance-disabled":return t("accountUsage.unsupportedDisabled");case"unsupported-driver":return t("accountUsage.unsupportedNoChannel");default:return t("accountUsage.unsupported")}}function B8(e,t){switch(e){case"rate-limited":return t("accountUsage.outcomeRateLimited");case"auth-rejected":return t("accountUsage.errorAuthRejected");case"unreachable":return t("accountUsage.errorUnreachable");case"response-invalid":return t("accountUsage.errorResponseInvalid");case"reader-unloaded":return t("accountUsage.errorReaderUnloaded");default:return t("accountUsage.outcomeError")}}function z8(e,t,n){return e.capability.status==="unsupported"?F8(e.error,n):t.length>0?null:e.loading?n("accountUsage.loading"):e.error!==null?B8(e.error,n):e.credentialIdentity===null||e.capability.status==="unknown"?n("accountUsage.unknown"):n("accountUsage.noData")}function Rb(e,t){let n=Ab(t,e.unit);return n===null?null:e.unit.kind==="money"?`${e.unit.currency} ${n}`:e.unit.kind==="percent"?`${n}%`:`${n} ${e.unit.nativeUnit}`}function k1(e){let[t,n]=J(!1);return u(U8,{...e,expanded:t,onToggleExpanded:()=>n(o=>!o)})}function U8(e){let{expanded:t,onToggleExpanded:n,onRefresh:o,...r}=e,{t:a}=Ce(),i=v1(r),{feedback:s,refreshing:l,refresh:d}=T1(i,o),c=r.capability.status==="supported"&&r.credentialIdentity!==null?w1(r):null,f=c?.metrics??[],p=C1(f,r.error),m=p.some(S=>S.stale)||r.error!==null&&c!==null,g=S1(p),h=I1(f),v=l,y=z8(r,p,a),x=y1(r),w=`${Jr()}-account-usage-details`,L=[...p.map(S=>({key:S.metricId,text:M8(S,a)})),...b1(f).map(S=>({key:`${S.metricId}\0status`,text:N8(S,a)})),...g===null?[]:[{key:"resets-at",text:a("accountUsage.resetsAt",{time:Sd(g)})}]];return b("div",{className:"min-w-0 px-3 pt-1 sm:px-4","data-composer-account-usage":"true","data-refresh-outcome":s?.outcome??"",children:[b("div",{className:"flex min-w-0 items-start gap-1.5",children:[u(ce,{type:"button",variant:"ghost",size:"sm",className:"h-auto min-h-control-3 min-w-0 flex-1 justify-start px-1 py-1 text-left whitespace-normal","aria-expanded":t,"aria-controls":w,"aria-label":a(t?"accountUsage.hideDetails":"accountUsage.showDetails"),onClick:n,children:b("div",{className:"flex min-w-0 flex-1 flex-col items-stretch gap-0.5",children:[b("div",{className:"flex min-w-0 flex-wrap items-baseline gap-x-2 gap-y-0.5",children:[u("span",{className:"text-xs font-medium text-foreground",children:r.instanceLabel}),m?u("span",{className:"text-[11px] text-muted-foreground","data-composer-account-usage-stale":"true",children:a("accountUsage.stale")}):null,u(an,{"aria-hidden":"true",className:$("ml-auto size-icon-2 shrink-0 text-secondary-label",t?"rotate-180":"rotate-0")})]}),u("div",{className:"flex min-w-0 flex-wrap items-baseline gap-x-2 gap-y-0.5 text-[11px] tabular-nums text-secondary-label",children:L.length>0?L.map((S,k)=>b("span",{children:[k>0?u("span",{"aria-hidden":"true",children:" \xB7 "}):null,S.text]},S.key)):y})]})}),x?u(ce,{type:"button",size:"xs",variant:"ghost",className:"mt-0.5 shrink-0 text-secondary-label","aria-label":a("accountUsage.refreshAria",{instance:r.instanceLabel}),disabled:v,onClick:()=>{d()},children:a(v?"accountUsage.refreshing":"accountUsage.refresh")}):null]}),t?b("div",{id:w,className:"max-h-36 space-y-2 overflow-y-auto overscroll-contain px-1 pb-1 pt-1.5","data-composer-account-usage-details":"true",children:[f.length===0?u("p",{className:"text-[11px] text-secondary-label",children:y??a("accountUsage.noData")}):f.map(S=>u(H8,{metric:S,queryError:r.error,t:a},S.metricId)),h!==null?u("p",{className:"text-[11px] text-secondary-label",children:a("accountUsage.collectedAt",{time:Sd(h)})}):null]}):null,s!==null?u("p",{role:"status",className:"px-1 pb-1 text-[11px] text-muted-foreground",children:O8(s,a)}):r.error!==null&&c!==null?u("p",{role:"status",className:"px-1 pb-1 text-[11px] text-muted-foreground",children:a("accountUsage.errorKeepLast")}):null]})}function H8({metric:e,queryError:t,t:n}){let o=Rb(e,e.used),r=e.unlimited===!0?n("accountUsage.unlimited"):Rb(e,e.remaining),a=Rb(e,e.limit),i=n("accountUsage.sharedScope",{scope:D8(e.scope,n)}),s=Eb(e,t),l=e.windowMs,d=jg(l),c=Nb({kind:e.kind,nativeLabel:e.nativeLabel,durationMs:l},n);return b("div",{className:"text-[11px] text-secondary-label","data-metric-id":e.metricId,"data-metric-kind":e.kind,"data-window-ms":l===null?void 0:String(l),children:[b("div",{className:"font-medium text-foreground",children:[c,s?u("span",{className:"ms-2 font-normal text-muted-foreground",children:n("accountUsage.stale")}):null]}),b("div",{className:"mt-0.5 flex flex-wrap gap-x-2 tabular-nums",children:[o!==null?b("span",{children:[o," ",n("accountUsage.used")]}):null,r!==null?b("span",{children:[r," ",e.unlimited===!0?null:n("accountUsage.remaining")]}):null,a!==null?b("span",{children:[a," ",n("accountUsage.limit")]}):null]}),u("div",{className:"mt-0.5",children:i}),e.fetchedAt!==null?u("div",{children:n("accountUsage.collectedAt",{time:Sd(e.fetchedAt)})}):null,e.resetsAt!==null?u("div",{children:n("accountUsage.resetsAt",{time:Sd(e.resetsAt)})}):null,d!==null?u("div",{children:Mb(d,n)}):null]})}function Qa(e){return e===null||!Number.isFinite(e)?"0":e<1e3?`${Math.round(e)}`:e<1e4?`${(e/1e3).toFixed(1).replace(/\.0$/,"")}k`:e<1e6?`${Math.round(e/1e3)}k`:`${(e/1e6).toFixed(1).replace(/\.0$/,"")}m`}function L1(e,t){if(!e)return null;let n=t.get(e.instanceId)?.find(o=>o.slug===e.model);return n?Cd(n):e.model}function P1(e,t,n){return typeof n=="number"&&n>0?e("contextWindow.compactsAtThreshold",{threshold:n.toLocaleString()}):t?e("contextWindow.compactsForModel",{model:t}):e("contextWindow.compactsWhenNeeded")}function $8(e){return e===null||!Number.isFinite(e)?null:e<10?`${e.toFixed(1).replace(/\.0$/,"")}%`:`${Math.round(e)}%`}function A1(e){let{t}=Ce(),{usage:n,breakdown:o,modelDisplayName:r,onCompact:a,compactDisabled:i,compactDisabledReason:s}=e,l=$8(n.usedPercentage),d=Math.max(0,Math.min(100,n.usedPercentage??0)),c=9.75,f=2*Math.PI*c,p=f*(1-d/100),m=n.totalProcessedTokens??null,g=m!==null&&m>0,v=d>90?"var(--color-error)":"color-mix(in oklab, var(--color-muted-foreground) 72%, transparent)";return b(yl,{children:[u(Cl,{openOnHover:!0,delay:150,closeDelay:a?150:0,render:u(ce,{size:"icon-sm",variant:"ghost-muted","data-context-window-meter":"true",className:"size-7 rounded-full hover:text-muted-foreground data-pressed:text-muted-foreground","aria-label":n.maxTokens!==null&&l?t("contextWindow.usedPercentAria",{percentage:l}):t("contextWindow.usedTokensAria",{tokens:Qa(n.usedTokens)}),children:u("span",{className:"relative flex size-5 items-center justify-center",children:b("svg",{viewBox:"0 0 24 24",className:"-rotate-90 absolute inset-0 size-full transform-gpu mx-0!","aria-hidden":"true",children:[u("circle",{cx:"12",cy:"12",r:c,fill:"none",stroke:"color-mix(in oklab, var(--color-muted-foreground) 24%, transparent)",strokeWidth:"3"}),u("circle",{cx:"12",cy:"12",r:c,fill:"none",stroke:v,strokeWidth:"3",strokeLinecap:"round",strokeDasharray:f,strokeDashoffset:p})]})})})}),u(xl,{tooltipStyle:!0,side:"top",align:"end",viewportClassName:"p-0",className:"w-64 max-w-none text-left whitespace-normal",children:b("div",{className:"flex flex-col gap-2 p-[var(--floating-content-inset)]",children:[b("div",{className:"flex items-center justify-between gap-3",children:[u("div",{className:"font-medium text-muted-foreground text-xs",children:t("contextWindow.title")}),n.maxTokens!==null&&l?b("div",{className:"text-secondary-label text-[11px] tabular-nums",children:[u("span",{children:l}),u("span",{className:"mx-1",children:"\xB7"}),b("span",{children:[Qa(n.usedTokens),"/",Qa(n.maxTokens??null)]})]}):u("div",{className:"text-secondary-label text-[11px] tabular-nums",children:Qa(n.usedTokens)})]}),n.maxTokens!==null?u("div",{className:"h-1.5 w-full overflow-hidden rounded-full bg-muted/60",role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(d),"aria-label":t("contextWindow.usage"),children:u("div",{className:"h-full rounded-full transition-[width,background-color] duration-500 ease-out motion-reduce:transition-none",style:{width:`${d}%`,backgroundColor:v}})}):null,o?b("div",{className:"flex flex-col gap-1","data-context-breakdown":"true",children:[b("div",{className:"flex items-center justify-between gap-3 text-[11px] leading-4","data-context-breakdown-row":"system",children:[u("span",{className:"text-secondary-label",children:t("contextWindow.system")}),u("span",{className:"font-medium tabular-nums text-secondary-label",children:Qa(o.systemTokens)})]}),b("div",{className:"flex items-center justify-between gap-3 text-[11px] leading-4","data-context-breakdown-row":"tools",children:[u("span",{className:"text-secondary-label",children:t("contextWindow.tools")}),u("span",{className:"font-medium tabular-nums text-secondary-label",children:Qa(o.toolsTokens)})]}),b("div",{className:"flex items-center justify-between gap-3 text-[11px] leading-4","data-context-breakdown-row":"messages",children:[u("span",{className:"text-secondary-label",children:t("contextWindow.messages")}),u("span",{className:"font-medium tabular-nums text-secondary-label",children:Qa(o.messageTokens)})]})]}):null,g?b("div",{className:"flex items-center justify-between gap-3 text-[11px] leading-4",children:[u("span",{className:"text-secondary-label",children:t("contextWindow.totalProcessed")}),u("span",{className:"font-medium tabular-nums text-secondary-label",children:Qa(m)})]}):null,n.compactsAutomatically?u("div",{className:"mt-1 text-pretty text-secondary-label text-[11px] font-medium",children:P1(t,r,n.autoCompactThreshold)}):null,a?b(Pe,{children:[b(ce,{size:"xs",variant:"outline",className:"mt-1 w-full justify-center",disabled:i,onClick:a,children:[u(Yd,{"aria-hidden":"true"}),t("contextWindow.compactContext")]}),i&&s?u("div",{className:"text-pretty text-secondary-label text-[11px]",children:s}):null]}):null]})})]})}ue();ue();var E1=bt(null),R1=E1.Provider;function ha(){let e=Ht(E1);if(e===null)throw new Error("Composer thread data has not been provided.");return e}var M1=bt(null);function N1({children:e}){let{data:t,target:n,threadKey:o}=ha(),r=t.useComposerStatus({target:n,threadKey:o});return u(M1.Provider,{value:r,children:e})}function _1(){let e=Ht(M1);if(e===null)throw new Error("Composer status has not been provided.");return e}function D1(e){return e.startsWith("!")}function O1(e){return e.slice(1).trim()}function F1(e){return e.length===0?"empty":/[\r\n]/.test(e)?"multiline":null}function K8(){return null}function B1(){let{data:e,target:t,threadKey:n}=ha();return(e.useShellCommand??K8)({target:t,threadKey:n})}function _b(e,t){let n=e.flatMap(r=>r.previewUrl?[{id:r.id,src:r.previewUrl,name:r.name}]:[]);if(n.length===0)return null;let o=n.findIndex(r=>r.id===t);return o<0?null:{images:n.map(r=>({src:r.src,name:r.name})),index:o}}function z1({message:e}){return e?u("p",{role:"alert",className:"px-3 pb-2 text-xs text-destructive sm:px-4","data-chat-composer-validation":"prompt-length",children:e}):null}function U1(e,t){let n=Vr.indexOf(e);if(n===-1)return Vr[0];let o=(n+t+Vr.length)%Vr.length;return Vr[o]??Vr[0]}var V8=['[data-composer-drawer-layer="true"]','[data-slot="popover-popup"]','[data-slot="menu-popup"]','[data-slot="select-popup"]','[data-slot="combobox-popup"]','[data-slot="autocomplete-popup"]'].join(",");function q8(e){return e.closest(V8)!==null}var W8=[];function G8(e,t){return{images:e.images,terminalContexts:e.terminalContexts,elementContexts:e.elementContexts,previewAnnotations:e.previewAnnotations,reviewComments:e.reviewComments,nonPersistedImageIds:e.nonPersistedImageIds,activeProvider:e.activeProvider,nativeModeByProvider:e.nativeModeByProvider,selectedPluginActionKey:e.selectedPluginActionKey,promptHasText:e.prompt.trim().length>0,promptInjection:i1(e.prompt),hasSendableContent:t({prompt:e.prompt,imageCount:e.images.length,terminalContexts:e.terminalContexts,elementContextCount:e.elementContexts.length+e.previewAnnotations.length+e.reviewComments.length}).hasSendableContent}}var j8=e=>e.prompt.trim();function Q8(e){let{t}=Ce(),n=e.api.draft.useThreadDraftSelector(e.composerDraftTarget,j8),o=e.pendingCustomAnswer!==null;return u("button",{type:"button",className:$("min-w-0 flex-1 truncate bg-transparent p-0 text-left text-[14px]",(o?e.pendingCustomAnswer:n)?"text-foreground":"text-placeholder"),onPointerDown:r=>r.preventDefault(),onClick:e.onExpand,"aria-label":t("composer.expandComposer"),children:o?e.pendingCustomAnswer||t("composer.typeOwnAnswer"):n||(e.noProviderAvailable?t("composer.enableProviderSettings"):t("composer.askAnything"))})}var X8=pe(function(t){let{data:n,target:o}=ha(),r=Fw(),a=n.useAccountUsage({target:o,active:r&&!t.hidden});return t.hidden||a===void 0?null:u(k1,{...a},a.queryKey)}),Y8=pe(function(t){let{data:n,target:o}=ha(),r=n.useContextUsage(o);return r?.window==null?null:u(A1,{usage:r.window,breakdown:r.breakdown,modelDisplayName:t.modelDisplayName,onCompact:t.onCompact,compactDisabled:t.compactDisabled,compactDisabledReason:t.compactDisabledReason})}),J8=pe(function(t){let{t:n}=Ce();return b(Pe,{children:[u(Y8,{modelDisplayName:t.activeThreadModelDisplayName,onCompact:t.onCompactContext,compactDisabled:t.compactDisabled,compactDisabledReason:t.compactDisabledReason}),t.isPreparingWorktree?u("span",{className:"text-secondary-label text-xs",children:n("composer.preparingWorktree")}):null,u(Gu,{compact:t.compact,pendingAction:t.pendingAction,isRunning:t.isRunning,showPlanFollowUpPrompt:t.showPlanFollowUpPrompt,promptHasText:t.promptHasText,isSendBusy:t.isSendBusy,sendDisabledReason:t.sendDisabledReason,isEnvironmentUnavailable:t.isEnvironmentUnavailable,isPreparingWorktree:t.isPreparingWorktree,hasSendableContent:t.hasSendableContent,preserveComposerFocusOnPointerDown:t.preserveComposerFocusOnPointerDown??!1,showSendWhileRunning:t.showSendWhileRunning??!1,onPreviousPendingQuestion:t.onPreviousPendingQuestion,onInterrupt:t.onInterrupt,interruptArmed:t.interruptArmed,onImplementPlanInNewThread:t.onImplementPlanInNewThread,shellCommandMode:t.shellCommandMode,shellCommandUnavailableReason:t.shellCommandUnavailableReason})]})}),H1=pe(function(t){let n=UT(),{data:o,target:r,threadKey:a}=ha(),{activePendingApproval:i,pendingUserInputs:s,activePendingProgress:l,activePendingResolvedAnswers:d,activePendingIsResponding:c,activePendingDraftAnswers:f,activePendingQuestionIndex:p,respondingRequestIds:m,occupants:g,respondToApproval:h,respondToDecision:v,selectUserInputOption:y,changeUserInputCustomAnswer:x,advanceUserInput:C,previousUserInputQuestion:w}=o.useComposerPending({target:r,threadKey:a}),{runtimeMode:L,interactionMode:S,lockedProvider:k,providerStatuses:I,activeProjectDefaultModelSelection:T,projectId:A,activeThreadModelSelection:P}=o.useComposerModelContext(r),{activeThreadId:_,activeThread:E,isLocalDraftThread:F,projectSelectionRequired:B,phase:V,isSendBusy:Q,sendDisabledReason:Se,unavailableAgentInstanceId:H=null,noAgentChosen:q=!1,isPreparingWorktree:ee,environmentUnavailable:G,compactDisabled:te,compactDisabledReason:me}=_1(),{t:U}=Ce(),{composerDraftTarget:Y,environmentId:se,attachmentUploadsCapabilityKnown:ge,supportsAttachmentUploads:ie,routeKind:Ae,routeThreadRef:Xe,draftId:nt,forceExpandedOnMobile:rt,slots:Ve,resolvedTheme:ne,settings:we,keybindings:j,terminalOpen:X,gitCwd:ae,promptRef:oe,composerRef:ft,composerImagesRef:pt,composerTerminalContextsRef:yt,composerElementContextsRef:Pt,sendContextRef:nn,onSend:gt,onInterrupt:Bt,interruptArmed:Mt=!1,recentSlashCommandIds:St=W8,onSlashCommandUsed:In,onCompactContext:ct,onImplementPlanInNewThread:ln,onProviderModelSelect:ro,onProviderInstanceSelect:Vt,onModelSelectionChosen:bn,onSelectPluginAction:Tn,onManagePlugins:on,getModelDisabledReason:kn,getModelContinuationLabel:O,onContinueInModel:fe,toggleInteractionMode:ye,handleRuntimeModeChange:Te,handleInteractionModeChange:Me,handleNativeModeChange:ht,focusComposer:Ln,scheduleComposerFocus:fn,setThreadError:at,onExpandImage:It}=t,Et=o.useComposerPlan(r),Tt=Et.proposedPlan,rn=Et.tasksProgress,Yt=Et.taskSteps,xe=s.length===0&&S==="plan"&&Tt!==null,_e=N(null),qe=R((D,Ie)=>{y(D,Ie),oe.current="",_e.current?.resetCursorState({cursor:0})},[oe,y]),We=R(async(D,Ie,He)=>{try{await h(D,Ie,He)}catch(Dt){at(r.threadId,Dt instanceof Error?Dt.message:U("approval.respondFailed"))}},[r.threadId,h,at,U]),ot=R((D,Ie)=>{v(D,Ie).then(He=>{He!==null&&at(r.threadId,He)})},[r.threadId,v,at]),xt=R(()=>{C().then(D=>{D!==null&&at(r.threadId,D)})},[C,r.threadId,at]),Ft=WM({machineUnavailable:G!==null,sessionStarted:E?.session!=null,sessionDisconnected:V==="disconnected"}),Jt=GM(Ft),ke=t.api,{limits:zt}=t.attachments,vt=ke.draft.useThreadDraftSelector(Y,D=>G8(D,ke.chat.deriveComposerSendState)),Ut=vt.images,Bn=K(()=>Ut.filter(D=>mv(D)==="image"),[Ut]),ve=vt.terminalContexts,et=vt.elementContexts,lt=vt.previewAnnotations,it=vt.reviewComments,xn=vt.nonPersistedImageIds,pn=ke.uploads.useStore(D=>D.uploadsByImageId),mn=ie?nk({imageIds:Ut.map(D=>D.id),uploadsByImageId:pn,environmentId:se},U):null,Ct=ke.draft.useStore,Qt=Ct(D=>D.setPrompt),qt=Ct(D=>D.setNativeMode),ko=Ct(D=>D.addImage),Do=Ct(D=>D.addImages),va=Ct(D=>D.removeImage),Xa=Ct(D=>D.insertTerminalContext),Ue=Ct(D=>D.removeElementContext),ya=Ct(D=>D.removePreviewAnnotation),qr=Ct(D=>D.removeReviewComment),er=Ct(D=>D.clearComposerPromptAndImages);W(()=>{if(ge){if(!ie){for(let D of Ut)ke.uploads.release(D.id);return}ke.draft.restoreAttachments();for(let D of Ut)ke.uploads.start({environmentId:se,image:D})}},[ge,Ut,se,ie]);let Nn=K(()=>HM(ke.model.applyInstanceSettings(ke.model.deriveInstanceEntries(I),we)),[ke.model,I,we]),Ya=vt.activeProvider??null,tr=E?.session?.providerInstanceId??P?.instanceId??T?.instanceId??null,Cr=KM(Nn,Ya??tr)??ke.model.makeDriverKind("unconfigured"),br=k??Cr,nr=K(()=>{if(!k||!E)return null;let D=E.session?.providerInstanceId??P?.instanceId;return D?Nn.find(Ie=>Ie.instanceId===D)?.continuationGroupKey??null:null},[E,P?.instanceId,k,Nn]),Nt=K(()=>{if(H!==null)return H;let D=[vt.activeProvider,E?.session?.providerInstanceId,P?.instanceId,T?.instanceId];for(let Ie of D){if(!Ie)continue;let He=Nn.find(Dt=>Dt.instanceId===Ie&&$M(Dt));if(He){if(k&&He.driverKind!==k||nr&&He.continuationGroupKey!==nr)continue;return He.instanceId}}return ke.model.noProviderSelection.instanceId},[T?.instanceId,E?.session?.providerInstanceId,P?.instanceId,vt.activeProvider,nr,k,Nn,H]),Gn=H!==null,Lo=K(()=>Gn||q?void 0:Nn.find(D=>D.instanceId===Nt),[q,Gn,Nn,Nt]),Ee=Lo===void 0&&!Gn&&!q,Oo=Gn&&pC(Nn,{lockedProvider:k,lockedContinuationGroupKey:nr}).length===0,Bi=me??(Ee?U("composer.compactingUnavailable"):null),jn=Lo?.driverKind??br,{modelOptions:Fo,selectedModel:Qn,selectedModelStatus:or}=ke.draft.useEffectiveModelState({threadRef:Y,providers:I,selectedProvider:jn,selectedInstanceId:Nt,threadModelSelection:P,projectModelSelection:T,settings:we}),Bo=K(()=>Lo?.snapshot??null,[Lo]),wr=K(()=>Lo?.models??[],[Lo]),po=vt.promptInjection,zo=K(()=>s1({provider:jn,model:Qn,models:wr,promptInjectionState:po,modelOptions:Fo?.[Nt],planModeEnabled:we.planModeEnabled},ke.model),[Fo,po,Nt,Qn,jn,wr,we.planModeEnabled]),zi=zo.promptEffort,Pn=zo.modelOptionsForDispatch,Za=we.planModeEnabled,Po=K(()=>({showInteractionModeToggle:Za&&ke.model.getInteractionModeToggle(I,jn),runtimeModeSwitch:Bo?.runtimeModeSwitch??"next-turn"}),[Za,I,jn,Bo]),Uo=Bo?.supportsNativeModeSwitch===!0,Wr=F&&Uo?vt.nativeModeByProvider?.[Nt]??null:null,Xn=K(()=>ke.model.resolveNativeMode(Bo,{runtimeMode:L,nativeModeId:F?Wr:E?.nativeModeId??null}),[ke.model,E?.nativeModeId,Bo,L,F,Wr]),Gr=Wr&&Xn?.current.id===Wr?Wr:void 0,rr=R(D=>{F&&qt(Y,Nt,D),ht(D)},[F,qt,Y,Nt,ht]),Yn=K(()=>ke.model.createSelection(Nt,Qn,Pn),[ke.model,Nt,Qn,Pn]);t1({threadId:E?.id??null,isLocalDraftThread:F,selection:Yn,selectionsEqual:ke.model.selectionsEqual,onChosen:Gn||q?void 0:bn});let Ui=R(D=>Vt(D,Yn),[Vt,Yn]),mo=Qn,$e=K(()=>{let D=new Map;for(let Ie of Nn)D.set(Ie.instanceId,ke.model.getAppModelOptionsForInstance(we,Ie));return D},[Nn,we]),_t=K(()=>($e.get(Nt)??[]).some(Ie=>Ie.slug===mo)?mo:ke.model.normalizeSlug(mo)??mo,[ke.model,$e,Nt,mo,jn]),dn=F&&k===null,An=ke.pluginComposer.useOptions(dn?se:null,A),Ho=An.options,xa=dn?vt.selectedPluginActionKey:null,Hi=K(()=>xa===null?null:Ho.find(D=>D.id===xa)??null,[xa,Ho]),el=xa!==null,$i=el&&Hi===null?U(An.isKnown?"composer.pluginUnavailable":"composer.pluginLoading"):null,Ki=Se??$i??(l?null:mn),tl=Ki!==null,[Qg,Qu]=J(!1);W(()=>{Qu(!1)},[Nt]);let Xg=Hg(or),Xu=X_({status:or,submissionTarget:l?"pending-user-input":"provider-turn"}),Id=Qg&&Xu?Xg:null,z=K(()=>L1(P,$e),[P,$e]),Le=`${String(se)}\0${String(Y)}`,[st,gn]=J(!1),[jr,nl]=J(!1),[W1,Yu]=J(null),[G1,j1]=J(null),[Yg,ei]=J(!1),[Td,ol]=J(!1),[Q1,Ob]=J(null),[rl,Jg]=J({key:0,active:!1}),Fb=N(Le);he(()=>{Fb.current!==Le&&(Fb.current=Le,gn(!1),Yu(null),ei(!1),ol(!1),Ob(null),Jg({key:rl.key,active:!1}))},[Le,rl.key]);let Sr=wp("max-sm"),ao=Sr&&!rt&&!jr,al=N(null),Bb=N(null),Zg=N(null),zb=N(null),eh=N(!1),go=N(null),il=N(null),sl=N(null),Ju=N(!1),Ub=N(0),ll=N(null),th=N(new Set),Vi=N(new Map),X1=R(()=>{gn(!0)},[]),Y1=R(D=>{Me(D)},[Me]),J1=K(()=>new Set(xn),[xn]),Jn=i!==null,Hb=l?.activeQuestion?.allowFreeform===!1,ti=B1(),Z1=ke.draft.useThreadDraftSelector(Y,D=>D1(D.prompt)),dl=ti!==null&&Z1&&!Jn&&l===null,kd=g[0]??null,{showTopDrawer:Zu,showCollapsedPromptRow:eO,hasBlocking:Ld}=$T(kd?.kind??null,ao),tO=xe||l!==null,{isComposerFooterCompact:qi,isComposerPrimaryActionsCompact:$b}=hk(Zg,tO),Kb=l!==null,Vb=R(D=>{let Ie=_e.current?.readDraftPrompt()??oe.current,He=D(Ie);if(He===Ie){fn();return}Kb?Qt(Y,He):(oe.current=He,Qt(Y,He),_e.current?.syncCursor(bo(He,He.length),wo(He,He.length))),fn()},[Kb,Y,oe,fn,Qt]),nO=d1({modelApi:ke.model,provider:jn,instanceId:Nt,...Ae==="server"?{threadRef:Xe}:{},...Ae==="draft"&&nt?{draftId:nt}:{},model:Qn,models:wr,modelOptions:Fo?.[Nt],promptInjection:po,onPromptUpdate:Vb,planModeEnabled:we.planModeEnabled}),qb=c1({modelApi:ke.model,provider:jn,instanceId:Nt,...Ae==="server"?{threadRef:Xe}:{},...Ae==="draft"&&nt?{draftId:nt}:{},model:Qn,models:wr,modelOptions:Fo?.[Nt],promptInjection:po,onPromptUpdate:Vb,planModeEnabled:we.planModeEnabled}),ef=K(()=>l?{questionIndex:l.questionIndex,isLastQuestion:l.isLastQuestion,canAdvance:l.canAdvance,isResponding:c,isComplete:!!d}:null,[c,l,d]),oO=V==="running"||Q||tl||Ee||B||G!==null||!vt.hasSendableContent,rO=U("composer.sendMessage"),Pd=Sr&&!ao&&ef!==null,aO=R(D=>{ko(Y,D)},[Y,ko]),iO=R(D=>{Do(Y,D)},[Y,Do]),sO=R(D=>{ke.uploads.release(D),va(Y,D)},[ke.uploads,Y,va]);W(()=>{Yu(null)},[et,lt,it,ve,Qn,zi,jn]),he(()=>{pt.current=Ut},[Ut,pt]),he(()=>{yt.current=ve},[ve,yt]),he(()=>{Pt.current=et},[et,Pt]);let lO=R(()=>{if(!Sr)return;go.current!==null&&(window.cancelAnimationFrame(go.current),go.current=null);let D=document.activeElement;D instanceof HTMLElement&&D.blur(),nl(!1)},[Sr]),dO=R(()=>!Sr||Q||tl||Ee||G!==null||V==="running"?!1:l?l.isLastQuestion&&!!d:xe||vt.hasSendableContent,[l,d,vt.hasSendableContent,G,Sr,Q,tl,Ee,V,xe]),{composerSubmissionError:cO,setComposerSubmissionError:tf,revalidatePromptLength:Wb,submitComposer:Gb}=lD({promptRef:oe,maxInputChars:zt.maxInputChars,noProviderAvailable:Ee,isSendDisabled:tl,sendDisabledReason:Ki,isModelSendBlocked:Xu,onModelSendBlocked:()=>{Qu(!0)},activeThreadId:_,activePendingProgress:l,composerDocumentKey:Le,pendingImageCompressionsRef:Vi,onSend:gt,onProviderInputRejectedReset:()=>{eh.current=!1},wasProviderInputRejected:()=>eh.current,onStillCompressing:()=>{ke.notify.info(U("composer.stillCompressing"),U("composer.sendAgainThumbnail"))},shouldBlurMobileComposerOnSubmit:dO,blurMobileComposerAfterSend:lO}),nh=N(!1),jb=R(D=>{if(D?.preventDefault(),ti===null||nh.current)return;if(ti.unavailableReason!==null){tf(ti.unavailableReason);return}let Ie=oe.current,He=O1(Ie),Dt=F1(He);if(Dt==="empty")return;if(Dt==="multiline"){tf(U("composer.shellCommand.singleLine"));return}tf(null),nh.current=!0;let wn=Y;ti.run(He).then(hn=>{!hn||oe.current!==Ie||(oe.current="",Qt(wn,""),_e.current?.syncCursor(0,null))}).finally(()=>{nh.current=!1})},[Y,ti,oe,Qt,tf,U]),nf=R((D,Ie)=>{if(dl){jb(D);return}Gb(D,Ie)},[jb,dl,Gb]),Qb=R(()=>{if(!dl)return!1;let D=oe.current.slice(1);return oe.current=D,Qt(Y,D),_e.current?.resetCursorState({prompt:D,cursor:D.length}),!0},[Y,oe,Qt,dl]),uO=R(()=>{if(!(te||Ee||vt.hasSendableContent||i!==null||s.length>0||V==="running"||Q||!_)){if((Vi.current.get(Le)??0)>0){ke.notify.info(U("composer.stillCompressing"),U("composer.compactAgainThumbnail"));return}ct()}},[i,_,te,Le,vt.hasSendableContent,Q,Ee,ct,s.length,V]),of=R(()=>{go.current!==null&&(window.cancelAnimationFrame(go.current),go.current=null),il.current!==null&&window.cancelAnimationFrame(il.current),sl.current!==null&&window.cancelAnimationFrame(sl.current),Ju.current=!0,nl(!0),il.current=window.requestAnimationFrame(()=>{il.current=null,al.current?.focusAtEnd(),sl.current=window.requestAnimationFrame(()=>{sl.current=null,Ju.current=!1})})},[]),rf=ke.stash.useStore,cl=rf(D=>D.entries),Xb=rf(D=>D.stashEntry),af=rf(D=>D.takeEntry),Yb=rf(D=>D.finalizeEntryImages);W(()=>()=>{ll.current!==null&&window.clearTimeout(ll.current)},[]);let Jb=R(()=>{Ub.current+=1,Jg({key:Ub.current,active:!0}),ll.current!==null&&window.clearTimeout(ll.current),ll.current=window.setTimeout(()=>{ll.current=null,Jg(D=>({...D,active:!1}))},1200)},[]),fO=R(D=>{let{entry:Ie,durable:He}=af(D.id);if(!Ie)return;He||ke.notify.warning(U("composer.stashReappear"),U("composer.storageRejectedKeep")),ei(!1);let Dt=oe.current,wn=D.prompt.length===0?Dt:Dt.trim().length?`${Dt.replace(/\s+$/,"")}
|
|
3811
3811
|
|
|
3812
|
-
${D.prompt}`:D.prompt,hn=wn!==Ot;hn&&(oe.current=wn,Qt(Y,wn),_e.current?.syncCursor(bo(wn,wn.length),null));let Tr=[];if(D.attachments.length>0){let wa=new Set(pt.current.map(io=>io.id)),Zn=new Set(pt.current.map(io=>`${io.mimeType}\0${io.sizeBytes}\0${io.name}`)),fl=Math.max(0,Ut.maxAttachments-pt.current.length),Xr=D.attachments.filter(io=>!wa.has(io.id)&&!Zn.has(`${io.mimeType}\0${io.sizeBytes}\0${io.name}`));Tr=Xr.slice(fl).map(io=>io.name);let Yr=ke.draft.hydrateImagesFromPersisted(Xr.slice(0,fl));Yr.length>0&&Do(Y,Yr)}let vn=[];D.droppedImageNames.length>0&&vn.push(U("composer.stashImagesTooLarge",{names:D.droppedImageNames.join(", ")})),D.unreadableImageNames&&D.unreadableImageNames.length>0&&vn.push(U("composer.stashImagesUnreadable",{names:D.unreadableImageNames.join(", ")})),Tr.length>0&&vn.push(U("composer.stashImagesOverLimit",{names:Tr.join(", "),limit:Ut.maxAttachments})),vn.length>0&&ke.notify.warning(U("composer.someImagesNotRestored"),vn.join(" ")),hn&&window.requestAnimationFrame(()=>{il.current?.focusAtEnd()})},[Do,Y,pt,Ut.maxAttachments,oe,Qt,U,sf]),cO=R(D=>{let{durable:Ie}=sf(D.id);Ie||ke.notify.warning(U("composer.stashEntryMayReturn"),U("composer.storageRejectedDelete"))},[U,sf]),uO=R(async()=>{let D=oe.current.split("\uFFFC").join("").trim(),Ie=[...pt.current];if(D.length===0&&Ie.length===0){ti(hn=>!hn);return}let He=`${String(Y)}\0${D}\0${Ie.map(hn=>hn.id).join(",")}`;if(nh.current.has(He))return;nh.current.add(He);let Ot=Y,wn=Su();try{let{evicted:hn,written:Tr,durable:vn}=Yb({id:wn,createdAt:new Date().toISOString(),prompt:D,attachments:[],droppedImageNames:[],unreadableImageNames:[],pendingImageCount:Ie.length});if(!Tr){ke.notify.error(U("composer.couldNotStash"),U("composer.storageRejectedWrite"));return}vn||ke.notify.warning(U("composer.stashNotSurvive"),U("composer.storageUnavailableMemory")),oe.current="",tr(Ot);for(let pl of Ie)ke.uploads.release(pl.id);_e.current?.syncCursor(0,null),Zb(),hn&&ke.notify.warning(U("composer.oldestStashDiscarded"),U("composer.oldestStashDiscardedDetail",{count:ke.stash.maxEntries}));let wa=[],Zn=[],fl=[];for(let pl of Ie){let Rd=await ke.imageCompression.compressForStash(pl.file);if(!Rd.ok){(Rd.reason==="too-large"?Zn:fl).push(pl.name);continue}wa.push({id:pl.id,name:pl.name,mimeType:Rd.image.mimeType,sizeBytes:Rd.image.sizeBytes,dataUrl:Rd.image.dataUrl})}let{kept:Xr,droppedNames:Yr}=ke.stash.partitionAttachments(wa),{attached:io,durable:ff}=Jb(wn,{attachments:Xr,droppedImageNames:[...Zn,...Yr],unreadableImageNames:fl});io?!ff&&vn&&Ie.length>0&&ke.notify.warning(U("composer.stashImagesNotSaved"),U("composer.stashImagesMissingOnReload")):Xr.length>0&&ke.notify.warning(U("composer.stashImagesDidNotAttach"),U("composer.stashImagesDidNotAttachDetail",{count:Xr.length}))}finally{nh.current.delete(He)}},[tr,Y,pt,Jb,oe,Zb,Yb,U]),rh=R(()=>{ti(D=>!D)},[]),fO=R(()=>{if(ao){rf(),ti(!0);return}rh()},[rf,ao,rh]),ah=R(()=>{rl(D=>!D)},[]),Ed=E?.latestTurn?.turnId??null,ew=Ed!==null&&W1===Ed,Qr=ew?null:an,ba=ew?null:Jt,ih=R(()=>{Ed!==null&&Fb(Ed),rl(!1)},[Ed]),lf=ul.length>0&&!Jn&&(n||ef||kd||ao)?u(Cv,{count:ul.length,menuOpen:Jg,placement:"inline",pulseKey:al.key,pulsing:al.active,onToggleMenu:fO}):null,df=Qr!==null&&ba!==null&&!kd&&!Pd&&(n||ef||ao)?u(bv,{expanded:!1,onDismiss:ih,onToggle:ah,placement:"inline",progress:Qr,steps:ba}):null,sh=!n&&!ef&&!kd&&!ao,pO=sh&&(ul.length>0||Qr!==null&&ba!==null&&Qr.totalSteps>0);W(()=>{(Qr===null||ba===null)&&rl(!1)},[ba,Qr]),W(()=>{Pd&&rl(!1)},[Pd]),W(()=>{rl(!1)},[_]);let mO=R(()=>{ti(!1)},[]),gO=R(D=>{Ju(null),Gb(D),ti(!1)},[Gb]);ke.pane.useKeydown(D=>{if(ke.keybindings.resolveShortcutCommand(D,j,{context:{terminalFocus:ke.terminalFocus.getOwner()!==null,terminalOpen:X,modelPickerOpen:st}})==="composer.stash"&&(D.preventDefault(),D.stopPropagation(),!ke.commandPalette.isOpen())){if(s.length>0&&!Jn){ti(He=>!He);return}Jn||B||l!==null||uO()}},{capture:!0});let cf=async D=>{if(!_||D.length===0)return;if(s.length>0){ke.notify.error(U("attachments.answerQuestionsFirst"));return}let Ie=_,He=Pe,Ot=Wi.current.get(He)??0,wn=pt.current.length+Ot,hn=[],Tr=null;for(let vn of D){if(wn>=Ut.maxAttachments){Tr=U("attachments.limitReached",{count:Ut.maxAttachments});break}if(vn.size<=0){Tr=U("attachments.empty",{name:vn.name});continue}hn.push(vn),wn+=1}if(at(Ie,Tr),hn.length!==0){Wi.current.set(He,Ot+hn.length);try{let vn=[],wa=null;for(let Zn of hn){if(!(ke.imageCompression.isHeicFile(Zn)||mv(Zn.type))){let ff=ie?Ut.maxFileBytes:Ut.maxImageBytes;if(Zn.size>ff){wa=U("attachments.tooLarge",{name:Zn.name,limit:hv(ff)});continue}vn.push({...vv({id:Su(),name:Zn.name||U("attachments.defaultFileName"),mimeType:Zn.type||"application/octet-stream",sizeBytes:Zn.size}),previewUrl:URL.createObjectURL(Zn),file:Zn});continue}let Xr=await ke.imageCompression.prepareForAttachment(Zn,Ut.maxImageBytes);if(!Xr.ok){wa=Xr.reason==="unreadable"?U("attachments.unreadableImage",{name:Zn.name}):U("attachments.imageTooLarge",{name:Zn.name});continue}let Yr=Xr.file,io=URL.createObjectURL(Yr);vn.push({...vv({id:Su(),name:Yr.name||U("attachments.defaultImageName"),mimeType:Yr.type,sizeBytes:Yr.size}),previewUrl:io,file:Yr})}vn.length===1&&vn[0]?nO(vn[0]):vn.length>1&&oO(vn),wa!==null&&at(Ie,wa)}finally{let vn=(Wi.current.get(He)??0)-hn.length;vn>0?Wi.current.set(He,vn):Wi.current.delete(He)}}},hO=D=>{rO(D)},vO=D=>{let Ie=Array.from(D.target.files??[]);D.target.value="",Ie.length!==0&&cf(Ie)},tw=D=>{let Ie=Array.from(D.clipboardData.files);Ie.length!==0&&(D.preventDefault(),cf(Ie))},nw=(D,Ie)=>{if(D.length===0||Jn||s.length>0||B)return!1;let He=oe.current,Ot=(Ie?.ensureLeadingBoundary??!1)&&He.length>0&&!/\s$/.test(He);return _e.current?.applyPromptReplacement(He.length,He.length,Ot?` ${D}`:D)??!1},{isDragOverComposer:yO,composerMentionDragHandlers:lh,onComposerMentionDragLeaveCapture:xO}=rD({documentKey:Pe,insertMentionAtEnd:D=>nw(D,{ensureLeadingBoundary:!0}),onInsertRejected:()=>{ke.notify.error(U("composer.unableToAddToChat"),U("composer.composerBusy"))}}),dh=R(()=>{zt()},[zt]),ch=R(()=>{dn()},[dn]),CO=R(()=>{Ir&&(Zu.current||(go.current!==null&&window.cancelAnimationFrame(go.current),go.current=window.requestAnimationFrame(()=>{if(go.current=null,Zu.current)return;let D=Ub.current,Ie=eh.current,He=document.activeElement;He instanceof Element&&K8(He)||He instanceof Node&&(D&&D.contains(He)||Ie&&Ie.contains(He))||Ca(!1)})))},[Ir]);W(()=>()=>{go.current!==null&&window.cancelAnimationFrame(go.current),sl.current!==null&&window.cancelAnimationFrame(sl.current),ll.current!==null&&window.cancelAnimationFrame(ll.current)},[]);let uh=R(()=>_e.current?.readSnapshot()??{value:oe.current,cursor:bo(oe.current,oe.current.length),expandedCursor:oe.current.length,terminalContextIds:yt.current.map(D=>D.id)},[yt,oe]),uf=N({onComposerPaste:tw,submitComposer:of,exitShellCommandMode:Xb});uf.current={onComposerPaste:tw,submitComposer:of,exitShellCommandMode:Xb};let bO=R(D=>{uf.current.onComposerPaste(D)},[]),wO=R((D,Ie)=>{uf.current.submitComposer(D,Ie)},[]),SO=R(()=>uf.current.exitShellCommandMode(),[]),fh=()=>({prompt:oe.current,images:pt.current,terminalContexts:yt.current,elementContexts:Lt.current,previewAnnotations:lt,reviewComments:it,selectedPromptEffort:Ui,selectedModelOptionsForDispatch:Pn,selectedModelSelection:Yn,...jr?{selectedNativeModeId:jr}:{},providerAvailable:Lo!==void 0,selectedProvider:jn,selectedModel:Qn,selectedModelStatus:rr,selectedProviderModels:Sr,selectedPluginAction:$i});on.current=fh,ir(ft,()=>({focusAtEnd:()=>{il.current?.focusAtEnd()},focusAt:Ie=>{il.current?.focusAt(Ie)},addDroppedFiles:Ie=>{cf(Ie),Ln()},insertTextAtEnd:nw,toggleModelPicker:()=>{Xt(Ie=>!Ie)},cyclePermissionMode:Ie=>{if(Xn===null){Te(B1(L,Ie));return}let{modes:He,current:Ot}=Xn;if(!Uo||He.length<2)return;let wn=He.findIndex(Tr=>Tr.id===Ot.id),hn=He[(wn+Ie+He.length)%He.length];hn!==void 0&&ar(hn.id)},readSnapshot:uh,resetCursorState:Ie=>{_e.current?.resetCursorState(Ie)},addTerminalContext:Ie=>{if(!E)return;let He=uh(),Ot=ke.terminalContext.insertInlinePlaceholder(He.value,He.expandedCursor),wn=bo(Ot.prompt,Ot.cursor);Ya(Y,Ot.prompt,{id:Su(),threadId:E.id,createdAt:new Date().toISOString(),...Ie},Ot.contextIndex)&&(oe.current=Ot.prompt,_e.current?.syncCursor(wn,wo(Ot.prompt,Ot.cursor)),window.requestAnimationFrame(()=>{il.current?.focusAt(wn)}))},readSendIdentity:()=>({pluginActionId:$i?.id??null,prompt:oe.current}),getSendContext:fh,validateProviderInput:Ie=>{let He=Ki??cb({prompt:oe.current,providerInput:Ie,submissionTarget:"provider-turn",maxInputChars:Ut.maxInputChars,t:U});return th.current=He!==null,Ju(He),He===null}}),[E,cf,Y,Ya,oe,pt,yt,Lt,lt,it,Ln,Jn,s.length,B,uh,Qn,Pn,Yn,jr,Ee,Ui,jn,Sr,$i,Ki,fh,on,Ut.maxInputChars,Xn,Uo,ar,Te,L,U]);let IO=Jn?i?.detail??U("composer.resolveApprovalToContinue"):U(l?"composer.typeOwnAnswer":xe&&St?"composer.addFeedbackRefinePlan":B?"composer.chooseProjectToStart":Ee?"composer.enableProviderToSend":Zt??"composer.askAnythingFull");return b("form",{ref:eh,onSubmit:of,onFocusCapture:D=>{let Ie=D.target;ao&&Ie instanceof HTMLElement&&Ie.closest('[data-chat-composer-collapsed-controls="true"]')||(go.current!==null&&(window.cancelAnimationFrame(go.current),go.current=null),Ca(!0))},onBlurCapture:()=>{CO()},onDragEnterCapture:lh.onDragEnter,onDragOverCapture:lh.onDragOver,onDragLeaveCapture:xO,onDropCapture:lh.onDrop,className:$("mx-auto w-full min-w-0 max-w-3xl",pO&&"pt-7"),"data-chat-composer-form":"true",children:[ef&&(!kd||Pd)?u("div",{className:"chat-composer-top-drawer","data-chat-composer-top-drawer":"true","data-variant":Ld?.kind==="approval"?"warning":"info","data-occupant":Ld?.kind??"none",children:Ld===null?null:JD({occupant:Ld,respondingRequestIds:m,keybindings:j,onRespondToApproval:We,onRespondToDecision:ot,activePendingDraftAnswers:f,activePendingQuestionIndex:p,onSelectActivePendingUserInputOption:qe,onAdvanceActivePendingUserInput:xt,activeProposedPlan:St,collapsedPendingRow:u(sD,{activePendingProgress:l,isPendingUserInputChoiceOnly:$b,expandMobileComposer:rf,inlineTasksBadge:df,inlineStashBadge:lf,pendingPrimaryAction:tf,isSendBusy:Q,sendDisabledReason:Vi,isEnvironmentUnavailable:G!==null||Ee||B,onPreviousActivePendingUserInputQuestion:w,handleInterruptPrimaryAction:dh,handleImplementPlanInNewThreadPrimaryAction:ch})},ao)}):null,kd&&!Pd&&Qr&&ba?u(ZT,{onDismiss:ih,onCollapse:ah,progress:Qr,steps:ba}):null,b("div",{className:"relative",children:[sh&&Qr&&ba?u(bv,{expanded:!1,hasTrailingShoulder:ul.length>0,onDismiss:ih,onToggle:ah,progress:Qr,steps:ba}):null,sh?u(Cv,{count:ul.length,menuOpen:Jg,pulseKey:al.key,pulsing:al.active,onToggleMenu:rh}):null,u("div",{"data-chat-composer-main-surface":"true",className:$("group relative z-10 rounded-[22px] p-px transition-colors duration-200",zo.composerFrameClassName),children:b("div",{ref:Ub,"data-chat-composer-surface":"true","data-chat-composer-mobile-collapsed":ao?"true":"false",className:$("rounded-[20px] transition-[background-color] duration-200",yO?"bg-accent/45 ring-1 ring-primary/70":null,B?"opacity-75":null,zo.composerSurfaceClassName),children:[t.firstRow?u("div",{className:"flex items-center gap-2 px-3 pt-2 sm:px-4","data-conversation-card-first-row":!0,"data-chat-composer-collapsed-controls":"true",children:t.firstRow}):null,u(j8,{hidden:Jn}),Y1?b("div",{className:"flex items-center justify-between gap-2 px-3 py-2",children:[u(G8,{api:ke,composerDraftTarget:Y,pendingCustomAnswer:l?l.customAnswer:null,noProviderAvailable:Ee,onExpand:rf}),df,lf,u("button",{type:"button",className:"flex size-8 shrink-0 items-center justify-center rounded-full bg-message-action text-message-action-foreground hover:bg-message-action-hover disabled:opacity-64",disabled:eO,"aria-label":tO,onPointerDown:D=>D.preventDefault(),onClick:D=>{D.stopPropagation(),of()},children:u("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:u("path",{d:"M8 3L8 13M8 3L4 7M8 3L12 7",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]}):null,b("div",{ref:q1,className:$("relative px-3 pb-2 sm:px-4","pt-3.5 sm:pt-4",Jn&&"pb-3 sm:pb-4",ao&&"hidden"),children:[!ao&&!Jn&&s.length===0&<.length>0&&u(uk,{annotations:lt,images:Nt,...ie?{uploadsByImageId:gn,onRetryUpload:D=>ke.uploads.retry({environmentId:se,image:D})}:{},onRemove:D=>{ke.uploads.release(D),ya(Y,D)},onExpandImage:D=>{let Ie=Db(Bn,D);Ie&&Pt(Ie)},className:"mb-3"}),!ao&&!Jn&&s.length===0&&it.length>0&&u(ck,{comments:it,onRemove:D=>Wr(Y,D),className:"mb-3"}),!ao&&!Jn&&s.length===0&&et.length>0&&u(dk,{contexts:et,onRemove:D=>Ue(Y,D),className:"mb-3"}),!ao&&!Jn&&s.length===0&&Nt.some(D=>!lt.some(Ie=>Ie.id===D.id))&&u("div",{className:"mb-3 flex flex-wrap gap-2",children:Nt.filter(D=>!lt.some(Ie=>Ie.id===D.id)).map(D=>{let Ie=ie?gn[D.id]:void 0,He=gv(D),Ot=tk(He),wn=He==="image"&&!!D.previewUrl;return b("div",{className:$("relative h-16 overflow-hidden rounded-lg border border-border/80 bg-background",wn?"w-16":"w-44 max-w-full"),children:[wn?u("button",{type:"button",className:"h-full w-full cursor-zoom-in","aria-label":U("attachments.preview",{name:D.name}),onClick:()=>{let hn=Db(Bn,D.id);hn&&Pt(hn)},children:u("img",{src:D.previewUrl,alt:D.name,className:"h-full w-full object-cover"})}):b("a",{href:D.previewUrl,target:"_blank",rel:"noreferrer",className:"flex h-full w-full items-center gap-2 px-2 pe-7 text-start","aria-label":U("attachments.open",{name:D.name}),children:[u(Ot,{className:"size-4 shrink-0 text-secondary-label"}),b("span",{className:"min-w-0",children:[u("span",{className:"block truncate text-[11px] text-foreground",children:D.name}),u("span",{className:"block text-[10px] text-secondary-label",children:hv(D.sizeBytes)})]})]}),Q1.has(D.id)&&b(Ye,{children:[u(Ze,{render:u("span",{role:"img","aria-label":U("attachments.draftMayNotPersist"),className:"absolute left-1 top-1 inline-flex items-center justify-center rounded bg-background/85 p-0.5 text-amber-600",children:u(Sn,{className:"size-3"})})}),u(Je,{side:"top",className:"max-w-64 whitespace-normal leading-tight",children:U("attachments.draftMayNotPersistDetail")})]}),Ie?.status==="uploading"&&u("span",{className:"pointer-events-none absolute inset-x-0 bottom-0 bg-background/85 px-1 text-center text-[10px] text-foreground",children:Pp(Ie.progress)}),Ie?.status==="failed"&&b(Ye,{children:[u(Ze,{render:u(ce,{variant:"ghost",size:"icon-xs",className:"absolute bottom-1 left-1 bg-background/85 hover:bg-background/90",onClick:()=>ke.uploads.retry({environmentId:se,image:D}),"aria-label":U("attachments.retryUpload",{name:D.name})}),children:u(ss,{})}),u(Je,{side:"top",className:"max-w-64 whitespace-normal leading-tight",children:Lp(Ie,U)})]}),u(ce,{variant:"ghost",size:"icon-xs",className:"absolute right-1 top-1 bg-background/80 hover:bg-background/90",onClick:()=>hO(D.id),"aria-label":U("attachments.remove",{name:D.name}),children:u(en,{})})]},D.id)})}),cl?b("div",{"data-composer-shell-command-mode":"true",className:"flex min-w-0 items-center gap-1.5 px-1 pb-1 text-xs",children:[u(qo,{"aria-hidden":"true",className:"size-3.5 shrink-0 text-primary"}),u("span",{className:"shrink-0 font-medium text-primary",children:U("composer.shellCommand.mode")}),u("span",{className:"min-w-0 truncate text-muted-foreground",children:ni?.unavailableReason??U("composer.shellCommand.hint")})]}):null,b("div",{className:"relative",children:[u(DM,{handleRef:_e,api:ke,composerDraftTarget:Y,composerDocumentKey:Pe,promptRef:oe,editorRef:il,menuAnchor:V1,resolvedTheme:ne,selectedProvider:jn,selectedProviderStatus:Bo,planModeUiEnabled:ei,showSkillsInSlashMenu:we.showSkillsInSlashMenu,recentSlashCommandIds:wt,environmentId:se,gitCwd:ae,onSlashCommandUsed:In,onOpenModelPicker:G1,onInteractionModeChange:j1,onToggleInteractionMode:ye,activePendingProgress:l,activePendingRequestId:s[0]?.requestId??null,hasPendingUserInputs:s.length>0,changeUserInputCustomAnswer:x,terminalContexts:ve,showTerminalContexts:!Jn&&s.length===0,showEditor:!$b,isApprovalState:Jn,editorClassName:Ad?"max-sm:pb-11":void 0,placeholder:IO,disabled:Jn||B,onPaste:bO,onSubmit:wO,isMobileViewport:Ir,isDraftRoute:Ae==="draft",stashMenuOpen:Jg,stashEntries:ul,onRestoreStashEntry:dO,onDeleteStashEntry:cO,onCloseStashMenu:mO,onPromptEdited:gO,onUnclaimedEscape:SO}),Ad?b("div",{"data-chat-composer-mobile-pending-actions":"true",className:"absolute bottom-0 right-0 flex items-center justify-end gap-1",children:[df,lf,u(ju,{compact:!0,pendingAction:tf,isRunning:!1,showPlanFollowUpPrompt:!1,promptHasText:!1,isSendBusy:Q,sendDisabledReason:Vi,isEnvironmentUnavailable:G!==null||Ee||B,isPreparingWorktree:!1,hasSendableContent:!1,preserveComposerFocusOnPointerDown:!0,onPreviousPendingQuestion:w,onInterrupt:dh,interruptArmed:Mt,onImplementPlanInNewThread:ch})]}):null]})]}),u(F1,{message:qi??sO}),Ki===null?null:u("p",{role:"status",className:"px-3 pb-2 text-xs text-muted-foreground sm:px-4","data-chat-composer-plugin-blocked":"true",children:Ki}),q?u("p",{role:"status",className:"px-3 pb-2 text-xs text-muted-foreground sm:px-4","data-chat-composer-agent-not-chosen":"true",children:U("composer.agentNotChosen")}):null,Gn?u("p",{role:"status",className:"px-3 pb-2 text-xs text-warning sm:px-4","data-chat-composer-agent-unavailable":"true",children:U(Oo?"composer.agentUnavailableNoChoice":"composer.agentUnavailable")}):null,Td===null?null:b("p",{role:"status",className:"flex flex-wrap items-center gap-2 px-3 pb-2 text-xs text-muted-foreground sm:px-4","data-chat-composer-model-blocked":rr,children:[U(Td.blockKey),Td.canChooseModel?u(ce,{type:"button",size:"sm",variant:"ghost",className:"h-6 px-2 text-xs","data-chat-composer-choose-model":"true",onClick:()=>{Xt(!0)},children:U("modelPicker.chooseModel")}):null]}),ao||Jn?null:b("div",{"data-chat-composer-footer":"true","data-chat-composer-footer-compact":Gi?"true":"false",className:$("flex min-w-0 flex-nowrap items-center justify-between gap-2 overflow-visible px-3 pb-3 sm:px-4 sm:pb-4",s.length>0&&"pt-2",Gi?"gap-1.5":"gap-2 sm:gap-0",Ad&&"hidden sm:flex"),children:[b("div",{className:"-m-1 -ms-3.5 flex min-w-0 flex-1 items-center gap-1 overflow-x-auto p-1 ps-3.5 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:[u("input",{ref:zb,type:"file",multiple:!0,className:"hidden",tabIndex:-1,"aria-hidden":"true",onChange:vO}),b(Ye,{children:[u(Ze,{render:u(ce,{type:"button",variant:"ghost",size:"icon-sm","data-chat-composer-attach":"true",className:"shrink-0",disabled:B||s.length>0,"aria-label":U("attachments.add"),onClick:()=>zb.current?.click()}),children:u(vo,{})}),u(Je,{side:"top",children:U("attachments.add")})]}),Ee?b(ce,{type:"button",size:"sm",variant:"ghost",disabled:!0,"data-chat-provider-unavailable":"true",className:"shrink-0 gap-2 px-2 text-secondary-label sm:px-3",children:[u(Sn,{className:"size-4"}),U("composer.noProviderAvailable")]}):b(Le,{children:[u(Gu,{name:"conversation.input.agent",...Ve===void 0?{}:{slots:Ve},owner:{activeInstanceId:_t,unavailableInstanceId:H,notChosen:q,instanceEntries:Nn,lockedProvider:k,lockedContinuationGroupKey:or,compact:Gi,onInstanceChange:Hi},fallback:u(gC,{activeInstanceId:_t,unavailableInstanceId:H,notChosen:q,instanceEntries:Nn,lockedProvider:k,lockedContinuationGroupKey:or,compact:Gi,onInstanceChange:Hi})}),Gn||q?null:u(Q_,{...Ve===void 0?{}:{slots:Ve},compact:Gi,hideInstanceRail:!0,showInstanceOnTrigger:!1,activeInstanceId:_t,model:Dt,modelStatus:rr,lockedProvider:k,lockedContinuationGroupKey:or,instanceEntries:Nn,keybindings:j,modelOptionsByInstance:$e,terminalOpen:X,open:st,...zo.modelPickerIconClassName?{activeProviderIconClassName:zo.modelPickerIconClassName}:{},onOpenChange:D=>{Xt(D)},getModelDisabledReason:kn,getModelContinuationLabel:O,onContinueInModel:fe,onInstanceModelChange:ro,...un?{pluginActions:Ho,selectedPluginActionKey:$i?.id??null,onSelectPluginAction:Tn,onManagePlugins:rn}:{}})]}),nl?null:b(Le,{children:[u(m1,{environmentId:se,draftId:Ae==="draft"?nt:null,threadPresetId:E?.presetId??null,compact:Gi}),Gi?u(tD,{interactionMode:S,runtimeMode:L,runtimeModeSwitch:Po.runtimeModeSwitch,nativeMode:Xn,canSwitchNativeMode:Uo,showInteractionModeToggle:Po.showInteractionModeToggle,traitsMenuContent:Z1,onToggleInteractionMode:ye,onRuntimeModeChange:Te,onNativeModeChange:ar}):b(Le,{children:[Wb?u(Gu,{name:"conversation.input.effort",...Ve===void 0?{}:{slots:Ve},fallback:Wb}):null,Xn===null&&Po.showInteractionModeToggle?u(Gu,{name:"conversation.input.plan",...Ve===void 0?{}:{slots:Ve},owner:{interactionMode:S,showInteractionModeToggle:Po.showInteractionModeToggle,onToggleInteractionMode:ye},fallback:u(ib,{interactionMode:S,showInteractionModeToggle:Po.showInteractionModeToggle,onToggleInteractionMode:ye})}):null,u(Gu,{name:"conversation.input.permission",...Ve===void 0?{}:{slots:Ve},owner:{runtimeMode:L,runtimeModeSwitch:Po.runtimeModeSwitch,nativeMode:Xn,canSwitchNativeMode:Uo,onRuntimeModeChange:Te,onNativeModeChange:ar},fallback:u(sb,{runtimeMode:L,runtimeModeSwitch:Po.runtimeModeSwitch,nativeMode:Xn,canSwitchNativeMode:Uo,onRuntimeModeChange:Te,onNativeModeChange:ar})})]})]})]}),b("div",{"data-chat-composer-actions":"right","data-chat-composer-primary-actions-compact":Kb?"true":"false",className:"flex shrink-0 flex-nowrap items-center justify-end gap-2",children:[Ad?null:df,Ad?null:lf,u(X8,{compact:Kb,activeThreadModelDisplayName:z,pendingAction:tf,isRunning:V==="running",showPlanFollowUpPrompt:s.length===0&&xe,promptHasText:vt.promptHasText,isSendBusy:Q,sendDisabledReason:Vi,isEnvironmentUnavailable:G!==null||Ee||B,isPreparingWorktree:ee,hasSendableContent:vt.hasSendableContent,preserveComposerFocusOnPointerDown:Ir,showSendWhileRunning:Ir,onPreviousPendingQuestion:w,onInterrupt:dh,interruptArmed:Mt,onImplementPlanInNewThread:ch,shellCommandMode:cl,shellCommandUnavailableReason:ni?.unavailableReason??null,compactDisabled:te||Ee||Q,compactDisabledReason:zi,onCompactContext:lO})]})]})]})})]})]})});function U1(e){let{composerRef:t,...n}=e,o=n;return u(lk,{value:o.api,children:u(z1,{...o,composerRef:t})})}function Qu({section:e,resetKey:t,children:n}){return u(El,{resetKey:t,fallback:o=>Y8(e,o),children:n})}function Y8(e,t){return u(J8,{section:e,error:t})}function J8({section:e,error:t}){let{t:n}=ut();return b("div",{role:"status","data-conversation-section-error":e,className:e==="composer"||e==="queue"?"pointer-events-auto mx-auto flex w-full max-w-3xl items-start gap-2 rounded-lg border border-destructive/30 bg-background px-3 py-2 text-sm":"flex min-h-0 flex-1 flex-col items-center justify-center gap-2 px-6 py-12 text-center text-sm",children:[u(Sn,{"aria-hidden":!0,className:"size-4 shrink-0 text-destructive"}),b("div",{className:"min-w-0",children:[u("p",{className:"font-medium text-foreground",children:n(`timeline.sectionUnavailable.${e}`)}),u("p",{className:"whitespace-pre-wrap break-words text-muted-foreground",children:n("timeline.sectionUnavailableHint",{reason:t.message})})]})]})}function H1({hostVersion:e,scopeClass:t}){let{t:n}=ut();return b("div",{role:"status","data-conversation-host-data-mismatch":!0,className:$("flex min-h-0 min-w-0 flex-1 flex-col items-center justify-center gap-2 px-6 py-12 text-center text-sm",t),children:[u(Sn,{"aria-hidden":!0,className:"size-5 text-destructive"}),u("p",{className:"font-medium text-foreground",children:n("timeline.hostDataMismatchTitle")}),u("p",{className:"max-w-md text-muted-foreground",children:n("timeline.hostDataMismatchDescription",{host:e??0,plugin:14})})]})}function $1(e){let{data:t}=e;return t?.version!==14?u(H1,{hostVersion:t?.version??null,scopeClass:e.scopeClass}):u(wf.Provider,{value:e.scope.active,children:u(t7,{...e,data:t})})}var Z8=pe(function({threadKey:t,onModeChange:n}){let[o]=ln("turn-navigator",t,null),r=R(a=>{n("chat"),o?.onSelect(a)},[n,o]);return o===null?null:u(bS,{...o,placement:"inline",onSelect:r})});function e7({slots:e,children:t}){let{data:n,target:o,threadKey:r}=ha(),a=n.useComposerPending({target:o,threadKey:r});return e?.renderSlotChain("conversation.composer",{occupants:a.occupants},t)??t}function t7(e){let{scope:t,mode:n,timeline:o,trajectory:r,composer:a,data:i}=e,[,s]=ln("turn-navigator",t.threadKey,null),l=a.draftHero.active,d=a.sessionActions,c=a.terminalControl,f=a.agentsControl,{mode:p,onModeChange:m}=n,g=K(()=>l?b(Le,{children:[d,u("div",{className:"min-w-0 flex-1"}),c]}):b(Le,{children:[d,u(vS,{mode:p,onModeChange:m}),u("div",{className:"min-w-0 flex-1"}),c,f,u(Z8,{threadKey:t.threadKey,onModeChange:m})]}),[l,d,c,f,p,m,t.threadKey]),{belowSlot:h,draftHero:v,onOverlayElementChange:y,sessionActions:x,terminalControl:C,agentsControl:w,contextStrip:L,...S}=a,k=u(U1,{...S,attachments:e.attachments,firstRow:g}),I=K(()=>({environmentId:t.environmentId,threadId:t.threadId}),[t.environmentId,t.threadId]),[T,A]=ln("trajectory-reveal",t.threadKey,null),P=R(Se=>{n.onModeChange("chat"),A(H=>({rowId:Se,nonce:(H?.nonce??0)+1}))},[n,A]),_=R(()=>A(null),[A]),E=K(()=>({data:i,target:I,threadKey:t.threadKey}),[i,I,t.threadKey]),{controlRef:F,...B}=o,V=i.useChatWindow({target:I,threadKey:t.threadKey,visible:t.visible&&n.mode==="chat"}),Q=d0({inputKey:t.threadKey,visible:t.visible,endInset:o.contentInsetEndAdjustment,derive:e.derive,onReturnToLatest:V.onReturnToLatest,controlRef:F});return b("div",{className:$("relative flex min-h-0 min-w-0 flex-1 flex-col",e.scopeClass),"data-conversation-surface":!0,children:[u(yS,{chat:b(Qu,{section:"chat",resetKey:t.threadKey,children:[u(t0,{data:i,target:I,visible:t.visible,...B,paneActive:t.active,liveFollowEnabled:Q.liveFollowEnabled,scrollerRef:Q.bindTimelineHandle,onRowsChange:Q.onRowsChange,onIsAtEndChange:Q.onIsAtEndChange,onManualNavigation:Q.onManualNavigation,onDisclosureNavigation:Q.onDisclosureNavigation,loadEarlier:V.loadEarlier,loadLater:V.loadLater,pagingBlockedByInteraction:V.pagingBlockedByInteraction,onVisibleTurnRangeChange:V.onVisibleTurnRangeChange,onReturnToLatest:V.loadLater===null?null:Q.returnToEnd,onTurnNavigatorChange:s,revealMessageRequest:T,onRevealMessageHandled:_}),u(a0,{data:i,target:I,bottomInset:o.contentInsetEndAdjustment,showScrollToEnd:Q.showScrollToEnd,onScrollToEnd:Q.returnToEnd})]},"chat"),mode:n.mode,trajectory:u(Qu,{section:"trajectory",resetKey:t.threadKey,children:u(m0,{data:i,target:I,inputKey:t.threadKey,paneVisible:t.visible&&n.mode==="trajectory",timestampFormat:r.timestampFormat,onOpenInChat:P})},"trajectory"),visible:t.visible}),u(zT,{data:i,target:I,threadKey:t.threadKey,belowSlot:a.belowSlot,composer:u(Qu,{section:"composer",resetKey:t.threadKey,children:u(A1,{value:E,children:u(R1,{children:u(e7,{slots:a.slots,children:k})})})}),draftHero:a.draftHero,onOverlayElementChange:a.onOverlayElementChange,queue:u(Qu,{section:"queue",resetKey:t.threadKey,children:u(RT,{data:i,target:I,inputKey:t.threadKey,attachments:e.attachments})})})]})}var n7=".ycodium-conversation-ui";function o7(){let e=globalThis,t=(e.__ycodiumConversationScope??0)+1;return e.__ycodiumConversationScope=t,`ycodium-conversation-ui-${t}`}function K1(e,t="conversation"){let n=o7(),o=e.replaceAll(n7,`.${n}`),r=0,a=null;return{scopeClass:n,retain(){return typeof document>"u"?()=>{}:(r===0&&(a=document.createElement("style"),a.setAttribute("data-ycodium-plugin-css",t),a.textContent=o,document.head.appendChild(a)),r+=1,()=>{r-=1,r===0&&a!==null&&(a.remove(),a=null)})}}}function r7(e){let t=K1(aw);return{views:{[vh]:a7(t,e)},viewCapabilities:{[vh]:[fw,uw]},slots:[{name:"conversation.input.agent",order:0,component:KM},{name:"conversation.input.model",order:0,component:X_},{name:"conversation.input.plan",order:0,component:Y_},{name:"conversation.input.permission",order:0,component:eD}]}}function a7(e,t){return function(o){let a=o[yh]??t,i={...o};return delete i[yh],b(lw,{value:a,children:[u(i7,{retain:e.retain}),u(cw,{value:e.scopeClass,children:u($1,{...i,scopeClass:e.scopeClass})})]})}}function i7({retain:e}){return Nd(()=>e(),[e]),null}export{r7 as default};
|
|
3812
|
+
${D.prompt}`:D.prompt,hn=wn!==Dt;hn&&(oe.current=wn,Qt(Y,wn),_e.current?.syncCursor(bo(wn,wn.length),null));let Ir=[];if(D.attachments.length>0){let ba=new Set(pt.current.map(io=>io.id)),Zn=new Set(pt.current.map(io=>`${io.mimeType}\0${io.sizeBytes}\0${io.name}`)),ul=Math.max(0,zt.maxAttachments-pt.current.length),Xr=D.attachments.filter(io=>!ba.has(io.id)&&!Zn.has(`${io.mimeType}\0${io.sizeBytes}\0${io.name}`));Ir=Xr.slice(ul).map(io=>io.name);let Yr=ke.draft.hydrateImagesFromPersisted(Xr.slice(0,ul));Yr.length>0&&Do(Y,Yr)}let vn=[];D.droppedImageNames.length>0&&vn.push(U("composer.stashImagesTooLarge",{names:D.droppedImageNames.join(", ")})),D.unreadableImageNames&&D.unreadableImageNames.length>0&&vn.push(U("composer.stashImagesUnreadable",{names:D.unreadableImageNames.join(", ")})),Ir.length>0&&vn.push(U("composer.stashImagesOverLimit",{names:Ir.join(", "),limit:zt.maxAttachments})),vn.length>0&&ke.notify.warning(U("composer.someImagesNotRestored"),vn.join(" ")),hn&&window.requestAnimationFrame(()=>{al.current?.focusAtEnd()})},[Do,Y,pt,zt.maxAttachments,oe,Qt,U,af]),pO=R(D=>{let{durable:Ie}=af(D.id);Ie||ke.notify.warning(U("composer.stashEntryMayReturn"),U("composer.storageRejectedDelete"))},[U,af]),mO=R(async()=>{let D=oe.current.split("\uFFFC").join("").trim(),Ie=[...pt.current];if(D.length===0&&Ie.length===0){ei(hn=>!hn);return}let He=`${String(Y)}\0${D}\0${Ie.map(hn=>hn.id).join(",")}`;if(th.current.has(He))return;th.current.add(He);let Dt=Y,wn=wu();try{let{evicted:hn,written:Ir,durable:vn}=Xb({id:wn,createdAt:new Date().toISOString(),prompt:D,attachments:[],droppedImageNames:[],unreadableImageNames:[],pendingImageCount:Ie.length});if(!Ir){ke.notify.error(U("composer.couldNotStash"),U("composer.storageRejectedWrite"));return}vn||ke.notify.warning(U("composer.stashNotSurvive"),U("composer.storageUnavailableMemory")),oe.current="",er(Dt);for(let fl of Ie)ke.uploads.release(fl.id);_e.current?.syncCursor(0,null),Jb(),hn&&ke.notify.warning(U("composer.oldestStashDiscarded"),U("composer.oldestStashDiscardedDetail",{count:ke.stash.maxEntries}));let ba=[],Zn=[],ul=[];for(let fl of Ie){let Ed=await ke.imageCompression.compressForStash(fl.file);if(!Ed.ok){(Ed.reason==="too-large"?Zn:ul).push(fl.name);continue}ba.push({id:fl.id,name:fl.name,mimeType:Ed.image.mimeType,sizeBytes:Ed.image.sizeBytes,dataUrl:Ed.image.dataUrl})}let{kept:Xr,droppedNames:Yr}=ke.stash.partitionAttachments(ba),{attached:io,durable:uf}=Yb(wn,{attachments:Xr,droppedImageNames:[...Zn,...Yr],unreadableImageNames:ul});io?!uf&&vn&&Ie.length>0&&ke.notify.warning(U("composer.stashImagesNotSaved"),U("composer.stashImagesMissingOnReload")):Xr.length>0&&ke.notify.warning(U("composer.stashImagesDidNotAttach"),U("composer.stashImagesDidNotAttachDetail",{count:Xr.length}))}finally{th.current.delete(He)}},[er,Y,pt,Yb,oe,Jb,Xb,U]),oh=R(()=>{ei(D=>!D)},[]),gO=R(()=>{if(ao){of(),ei(!0);return}oh()},[of,ao,oh]),rh=R(()=>{ol(D=>!D)},[]),Ad=E?.latestTurn?.turnId??null,Zb=Ad!==null&&Q1===Ad,Qr=Zb?null:rn,Ca=Zb?null:Yt,ah=R(()=>{Ad!==null&&Ob(Ad),ol(!1)},[Ad]),sf=cl.length>0&&!Jn&&(n||Zu||Td||ao)?u(xv,{count:cl.length,menuOpen:Yg,placement:"inline",pulseKey:rl.key,pulsing:rl.active,onToggleMenu:gO}):null,lf=Qr!==null&&Ca!==null&&!Td&&!Ld&&(n||Zu||ao)?u(Cv,{expanded:!1,onDismiss:ah,onToggle:rh,placement:"inline",progress:Qr,steps:Ca}):null,ih=!n&&!Zu&&!Td&&!ao,hO=ih&&(cl.length>0||Qr!==null&&Ca!==null&&Qr.totalSteps>0);W(()=>{(Qr===null||Ca===null)&&ol(!1)},[Ca,Qr]),W(()=>{Ld&&ol(!1)},[Ld]),W(()=>{ol(!1)},[_]);let vO=R(()=>{ei(!1)},[]),yO=R(D=>{Yu(null),Wb(D),ei(!1)},[Wb]);ke.pane.useKeydown(D=>{if(ke.keybindings.resolveShortcutCommand(D,j,{context:{terminalFocus:ke.terminalFocus.getOwner()!==null,terminalOpen:X,modelPickerOpen:st}})==="composer.stash"&&(D.preventDefault(),D.stopPropagation(),!ke.commandPalette.isOpen())){if(s.length>0&&!Jn){ei(He=>!He);return}Jn||B||l!==null||mO()}},{capture:!0});let df=async D=>{if(!_||D.length===0)return;if(s.length>0){ke.notify.error(U("attachments.answerQuestionsFirst"));return}let Ie=_,He=Le,Dt=Vi.current.get(He)??0,wn=pt.current.length+Dt,hn=[],Ir=null;for(let vn of D){if(wn>=zt.maxAttachments){Ir=U("attachments.limitReached",{count:zt.maxAttachments});break}if(vn.size<=0){Ir=U("attachments.empty",{name:vn.name});continue}hn.push(vn),wn+=1}if(at(Ie,Ir),hn.length!==0){Vi.current.set(He,Dt+hn.length);try{let vn=[],ba=null;for(let Zn of hn){if(!(ke.imageCompression.isHeicFile(Zn)||pv(Zn.type))){let uf=ie?zt.maxFileBytes:zt.maxImageBytes;if(Zn.size>uf){ba=U("attachments.tooLarge",{name:Zn.name,limit:gv(uf)});continue}vn.push({...hv({id:wu(),name:Zn.name||U("attachments.defaultFileName"),mimeType:Zn.type||"application/octet-stream",sizeBytes:Zn.size}),previewUrl:URL.createObjectURL(Zn),file:Zn});continue}let Xr=await ke.imageCompression.prepareForAttachment(Zn,zt.maxImageBytes);if(!Xr.ok){ba=Xr.reason==="unreadable"?U("attachments.unreadableImage",{name:Zn.name}):U("attachments.imageTooLarge",{name:Zn.name});continue}let Yr=Xr.file,io=URL.createObjectURL(Yr);vn.push({...hv({id:wu(),name:Yr.name||U("attachments.defaultImageName"),mimeType:Yr.type,sizeBytes:Yr.size}),previewUrl:io,file:Yr})}vn.length===1&&vn[0]?aO(vn[0]):vn.length>1&&iO(vn),ba!==null&&at(Ie,ba)}finally{let vn=(Vi.current.get(He)??0)-hn.length;vn>0?Vi.current.set(He,vn):Vi.current.delete(He)}}},xO=D=>{sO(D)},CO=D=>{let Ie=Array.from(D.target.files??[]);D.target.value="",Ie.length!==0&&df(Ie)},ew=D=>{let Ie=Array.from(D.clipboardData.files);Ie.length!==0&&(D.preventDefault(),df(Ie))},tw=(D,Ie)=>{if(D.length===0||Jn||s.length>0||B)return!1;let He=oe.current,Dt=(Ie?.ensureLeadingBoundary??!1)&&He.length>0&&!/\s$/.test(He);return _e.current?.applyPromptReplacement(He.length,He.length,Dt?` ${D}`:D)??!1},{isDragOverComposer:bO,composerMentionDragHandlers:sh,onComposerMentionDragLeaveCapture:wO}=iD({documentKey:Le,insertMentionAtEnd:D=>tw(D,{ensureLeadingBoundary:!0}),onInsertRejected:()=>{ke.notify.error(U("composer.unableToAddToChat"),U("composer.composerBusy"))}}),lh=R(()=>{Bt()},[Bt]),dh=R(()=>{ln()},[ln]),SO=R(()=>{Sr&&(Ju.current||(go.current!==null&&window.cancelAnimationFrame(go.current),go.current=window.requestAnimationFrame(()=>{if(go.current=null,Ju.current)return;let D=zb.current,Ie=Zg.current,He=document.activeElement;He instanceof Element&&q8(He)||He instanceof Node&&(D&&D.contains(He)||Ie&&Ie.contains(He))||nl(!1)})))},[Sr]);W(()=>()=>{go.current!==null&&window.cancelAnimationFrame(go.current),il.current!==null&&window.cancelAnimationFrame(il.current),sl.current!==null&&window.cancelAnimationFrame(sl.current)},[]);let ch=R(()=>_e.current?.readSnapshot()??{value:oe.current,cursor:bo(oe.current,oe.current.length),expandedCursor:oe.current.length,terminalContextIds:yt.current.map(D=>D.id)},[yt,oe]),cf=N({onComposerPaste:ew,submitComposer:nf,exitShellCommandMode:Qb});cf.current={onComposerPaste:ew,submitComposer:nf,exitShellCommandMode:Qb};let IO=R(D=>{cf.current.onComposerPaste(D)},[]),TO=R((D,Ie)=>{cf.current.submitComposer(D,Ie)},[]),kO=R(()=>cf.current.exitShellCommandMode(),[]),uh=()=>({prompt:oe.current,images:pt.current,terminalContexts:yt.current,elementContexts:Pt.current,previewAnnotations:lt,reviewComments:it,selectedPromptEffort:zi,selectedModelOptionsForDispatch:Pn,selectedModelSelection:Yn,...Gr?{selectedNativeModeId:Gr}:{},providerAvailable:Lo!==void 0,selectedProvider:jn,selectedModel:Qn,selectedModelStatus:or,selectedProviderModels:wr,selectedPluginAction:Hi});nn.current=uh,ar(ft,()=>({focusAtEnd:()=>{al.current?.focusAtEnd()},focusAt:Ie=>{al.current?.focusAt(Ie)},addDroppedFiles:Ie=>{df(Ie),Ln()},insertTextAtEnd:tw,toggleModelPicker:()=>{gn(Ie=>!Ie)},cyclePermissionMode:Ie=>{if(Xn===null){Te(U1(L,Ie));return}let{modes:He,current:Dt}=Xn;if(!Uo||He.length<2)return;let wn=He.findIndex(Ir=>Ir.id===Dt.id),hn=He[(wn+Ie+He.length)%He.length];hn!==void 0&&rr(hn.id)},readSnapshot:ch,resetCursorState:Ie=>{_e.current?.resetCursorState(Ie)},addTerminalContext:Ie=>{if(!E)return;let He=ch(),Dt=ke.terminalContext.insertInlinePlaceholder(He.value,He.expandedCursor),wn=bo(Dt.prompt,Dt.cursor);Xa(Y,Dt.prompt,{id:wu(),threadId:E.id,createdAt:new Date().toISOString(),...Ie},Dt.contextIndex)&&(oe.current=Dt.prompt,_e.current?.syncCursor(wn,wo(Dt.prompt,Dt.cursor)),window.requestAnimationFrame(()=>{al.current?.focusAt(wn)}))},readSendIdentity:()=>({pluginActionId:Hi?.id??null,prompt:oe.current}),getSendContext:uh,validateProviderInput:Ie=>{let He=$i??db({prompt:oe.current,providerInput:Ie,submissionTarget:"provider-turn",maxInputChars:zt.maxInputChars,t:U});return eh.current=He!==null,Yu(He),He===null}}),[E,df,Y,Xa,oe,pt,yt,Pt,lt,it,Ln,Jn,s.length,B,ch,Qn,Pn,Yn,Gr,Ee,zi,jn,wr,Hi,$i,uh,nn,zt.maxInputChars,Xn,Uo,rr,Te,L,U]);let LO=Jn?i?.detail??U("composer.resolveApprovalToContinue"):U(l?"composer.typeOwnAnswer":xe&&Tt?"composer.addFeedbackRefinePlan":B?"composer.chooseProjectToStart":Ee?"composer.enableProviderToSend":Jt??"composer.askAnythingFull");return b("form",{ref:Zg,onSubmit:nf,onFocusCapture:D=>{let Ie=D.target;ao&&Ie instanceof HTMLElement&&Ie.closest('[data-chat-composer-collapsed-controls="true"]')||(go.current!==null&&(window.cancelAnimationFrame(go.current),go.current=null),nl(!0))},onBlurCapture:()=>{SO()},onDragEnterCapture:sh.onDragEnter,onDragOverCapture:sh.onDragOver,onDragLeaveCapture:wO,onDropCapture:sh.onDrop,className:$("mx-auto w-full min-w-0 max-w-3xl",hO&&"pt-7"),"data-chat-composer-form":"true",children:[Zu&&(!Td||Ld)?u("div",{className:"chat-composer-top-drawer","data-chat-composer-top-drawer":"true","data-variant":kd?.kind==="approval"?"warning":"info","data-occupant":kd?.kind??"none",children:kd===null?null:e1({occupant:kd,respondingRequestIds:m,keybindings:j,onRespondToApproval:We,onRespondToDecision:ot,activePendingDraftAnswers:f,activePendingQuestionIndex:p,onSelectActivePendingUserInputOption:qe,onAdvanceActivePendingUserInput:xt,activeProposedPlan:Tt,collapsedPendingRow:u(dD,{activePendingProgress:l,isPendingUserInputChoiceOnly:Hb,expandMobileComposer:of,inlineTasksBadge:lf,inlineStashBadge:sf,pendingPrimaryAction:ef,isSendBusy:Q,sendDisabledReason:Ki,isEnvironmentUnavailable:G!==null||Ee||B,onPreviousActivePendingUserInputQuestion:w,handleInterruptPrimaryAction:lh,handleImplementPlanInNewThreadPrimaryAction:dh})},ao)}):null,Td&&!Ld&&Qr&&Ca?u(tk,{onDismiss:ah,onCollapse:rh,progress:Qr,steps:Ca}):null,b("div",{className:"relative",children:[ih&&Qr&&Ca?u(Cv,{expanded:!1,hasTrailingShoulder:cl.length>0,onDismiss:ah,onToggle:rh,progress:Qr,steps:Ca}):null,ih?u(xv,{count:cl.length,menuOpen:Yg,pulseKey:rl.key,pulsing:rl.active,onToggleMenu:oh}):null,u("div",{"data-chat-composer-main-surface":"true",className:$("group relative z-10 rounded-[22px] p-px transition-colors duration-200",zo.composerFrameClassName),children:b("div",{ref:zb,"data-chat-composer-surface":"true","data-chat-composer-mobile-collapsed":ao?"true":"false",className:$("rounded-[20px] transition-[background-color] duration-200",bO?"bg-accent/45 ring-1 ring-primary/70":null,B?"opacity-75":null,zo.composerSurfaceClassName),children:[t.firstRow?u("div",{className:"flex items-center gap-2 px-3 pt-2 sm:px-4","data-conversation-card-first-row":!0,"data-chat-composer-collapsed-controls":"true",children:t.firstRow}):null,u(X8,{hidden:Jn}),eO?b("div",{className:"flex items-center justify-between gap-2 px-3 py-2",children:[u(Q8,{api:ke,composerDraftTarget:Y,pendingCustomAnswer:l?l.customAnswer:null,noProviderAvailable:Ee,onExpand:of}),lf,sf,u("button",{type:"button",className:"flex size-8 shrink-0 items-center justify-center rounded-full bg-message-action text-message-action-foreground hover:bg-message-action-hover disabled:opacity-64",disabled:oO,"aria-label":rO,onPointerDown:D=>D.preventDefault(),onClick:D=>{D.stopPropagation(),nf()},children:u("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:u("path",{d:"M8 3L8 13M8 3L4 7M8 3L12 7",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]}):null,b("div",{ref:j1,className:$("relative px-3 pb-2 sm:px-4","pt-3.5 sm:pt-4",Jn&&"pb-3 sm:pb-4",ao&&"hidden"),children:[!ao&&!Jn&&s.length===0&<.length>0&&u(pk,{annotations:lt,images:Ut,...ie?{uploadsByImageId:pn,onRetryUpload:D=>ke.uploads.retry({environmentId:se,image:D})}:{},onRemove:D=>{ke.uploads.release(D),ya(Y,D)},onExpandImage:D=>{let Ie=_b(Bn,D);Ie&&It(Ie)},className:"mb-3"}),!ao&&!Jn&&s.length===0&&it.length>0&&u(fk,{comments:it,onRemove:D=>qr(Y,D),className:"mb-3"}),!ao&&!Jn&&s.length===0&&et.length>0&&u(uk,{contexts:et,onRemove:D=>Ue(Y,D),className:"mb-3"}),!ao&&!Jn&&s.length===0&&Ut.some(D=>!lt.some(Ie=>Ie.id===D.id))&&u("div",{className:"mb-3 flex flex-wrap gap-2",children:Ut.filter(D=>!lt.some(Ie=>Ie.id===D.id)).map(D=>{let Ie=ie?pn[D.id]:void 0,He=mv(D),Dt=ok(He),wn=He==="image"&&!!D.previewUrl;return b("div",{className:$("relative h-16 overflow-hidden rounded-lg border border-border/80 bg-background",wn?"w-16":"w-44 max-w-full"),children:[wn?u("button",{type:"button",className:"h-full w-full cursor-zoom-in","aria-label":U("attachments.preview",{name:D.name}),onClick:()=>{let hn=_b(Bn,D.id);hn&&It(hn)},children:u("img",{src:D.previewUrl,alt:D.name,className:"h-full w-full object-cover"})}):b("a",{href:D.previewUrl,target:"_blank",rel:"noreferrer",className:"flex h-full w-full items-center gap-2 px-2 pe-7 text-start","aria-label":U("attachments.open",{name:D.name}),children:[u(Dt,{className:"size-4 shrink-0 text-secondary-label"}),b("span",{className:"min-w-0",children:[u("span",{className:"block truncate text-[11px] text-foreground",children:D.name}),u("span",{className:"block text-[10px] text-secondary-label",children:gv(D.sizeBytes)})]})]}),J1.has(D.id)&&b(Ye,{children:[u(Ze,{render:u("span",{role:"img","aria-label":U("attachments.draftMayNotPersist"),className:"absolute left-1 top-1 inline-flex items-center justify-center rounded bg-background/85 p-0.5 text-amber-600",children:u(Sn,{className:"size-3"})})}),u(Je,{side:"top",className:"max-w-64 whitespace-normal leading-tight",children:U("attachments.draftMayNotPersistDetail")})]}),Ie?.status==="uploading"&&u("span",{className:"pointer-events-none absolute inset-x-0 bottom-0 bg-background/85 px-1 text-center text-[10px] text-foreground",children:Lp(Ie.progress)}),Ie?.status==="failed"&&b(Ye,{children:[u(Ze,{render:u(ce,{variant:"ghost",size:"icon-xs",className:"absolute bottom-1 left-1 bg-background/85 hover:bg-background/90",onClick:()=>ke.uploads.retry({environmentId:se,image:D}),"aria-label":U("attachments.retryUpload",{name:D.name})}),children:u(as,{})}),u(Je,{side:"top",className:"max-w-64 whitespace-normal leading-tight",children:kp(Ie,U)})]}),u(ce,{variant:"ghost",size:"icon-xs",className:"absolute right-1 top-1 bg-background/80 hover:bg-background/90",onClick:()=>xO(D.id),"aria-label":U("attachments.remove",{name:D.name}),children:u(Zt,{})})]},D.id)})}),dl?b("div",{"data-composer-shell-command-mode":"true",className:"flex min-w-0 items-center gap-1.5 px-1 pb-1 text-xs",children:[u(Vo,{"aria-hidden":"true",className:"size-3.5 shrink-0 text-primary"}),u("span",{className:"shrink-0 font-medium text-primary",children:U("composer.shellCommand.mode")}),u("span",{className:"min-w-0 truncate text-muted-foreground",children:ti?.unavailableReason??U("composer.shellCommand.hint")})]}):null,b("div",{className:"relative",children:[u(FM,{handleRef:_e,api:ke,composerDraftTarget:Y,composerDocumentKey:Le,promptRef:oe,editorRef:al,menuAnchor:G1,resolvedTheme:ne,selectedProvider:jn,selectedProviderStatus:Bo,planModeUiEnabled:Za,showSkillsInSlashMenu:we.showSkillsInSlashMenu,recentSlashCommandIds:St,environmentId:se,gitCwd:ae,onSlashCommandUsed:In,onOpenModelPicker:X1,onInteractionModeChange:Y1,onToggleInteractionMode:ye,activePendingProgress:l,activePendingRequestId:s[0]?.requestId??null,hasPendingUserInputs:s.length>0,changeUserInputCustomAnswer:x,terminalContexts:ve,showTerminalContexts:!Jn&&s.length===0,showEditor:!Hb,isApprovalState:Jn,editorClassName:Pd?"max-sm:pb-11":void 0,placeholder:LO,disabled:Jn||B,onPaste:IO,onSubmit:TO,isMobileViewport:Sr,isDraftRoute:Ae==="draft",stashMenuOpen:Yg,stashEntries:cl,onRestoreStashEntry:fO,onDeleteStashEntry:pO,onCloseStashMenu:vO,onPromptEdited:yO,onUnclaimedEscape:kO}),Pd?b("div",{"data-chat-composer-mobile-pending-actions":"true",className:"absolute bottom-0 right-0 flex items-center justify-end gap-1",children:[lf,sf,u(Gu,{compact:!0,pendingAction:ef,isRunning:!1,showPlanFollowUpPrompt:!1,promptHasText:!1,isSendBusy:Q,sendDisabledReason:Ki,isEnvironmentUnavailable:G!==null||Ee||B,isPreparingWorktree:!1,hasSendableContent:!1,preserveComposerFocusOnPointerDown:!0,onPreviousPendingQuestion:w,onInterrupt:lh,interruptArmed:Mt,onImplementPlanInNewThread:dh})]}):null]})]}),u(z1,{message:W1??cO}),$i===null?null:u("p",{role:"status",className:"px-3 pb-2 text-xs text-muted-foreground sm:px-4","data-chat-composer-plugin-blocked":"true",children:$i}),q?u("p",{role:"status",className:"px-3 pb-2 text-xs text-muted-foreground sm:px-4","data-chat-composer-agent-not-chosen":"true",children:U("composer.agentNotChosen")}):null,Gn?u("p",{role:"status",className:"px-3 pb-2 text-xs text-warning sm:px-4","data-chat-composer-agent-unavailable":"true",children:U(Oo?"composer.agentUnavailableNoChoice":"composer.agentUnavailable")}):null,Id===null?null:b("p",{role:"status",className:"flex flex-wrap items-center gap-2 px-3 pb-2 text-xs text-muted-foreground sm:px-4","data-chat-composer-model-blocked":or,children:[U(Id.blockKey),Id.canChooseModel?u(ce,{type:"button",size:"sm",variant:"ghost",className:"h-6 px-2 text-xs","data-chat-composer-choose-model":"true",onClick:()=>{gn(!0)},children:U("modelPicker.chooseModel")}):null]}),ao||Jn?null:b("div",{"data-chat-composer-footer":"true","data-chat-composer-footer-compact":qi?"true":"false",className:$("flex min-w-0 flex-nowrap items-center justify-between gap-2 overflow-visible px-3 pb-3 sm:px-4 sm:pb-4",s.length>0&&"pt-2",qi?"gap-1.5":"gap-2 sm:gap-0",Pd&&"hidden sm:flex"),children:[b("div",{className:"-m-1 -ms-3.5 flex min-w-0 flex-1 items-center gap-1 overflow-x-auto p-1 ps-3.5 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:[u("input",{ref:Bb,type:"file",multiple:!0,className:"hidden",tabIndex:-1,"aria-hidden":"true",onChange:CO}),b(Ye,{children:[u(Ze,{render:u(ce,{type:"button",variant:"ghost",size:"icon-sm","data-chat-composer-attach":"true",className:"shrink-0",disabled:B||s.length>0,"aria-label":U("attachments.add"),onClick:()=>Bb.current?.click()}),children:u(vo,{})}),u(Je,{side:"top",children:U("attachments.add")})]}),Ee?b(ce,{type:"button",size:"sm",variant:"ghost",disabled:!0,"data-chat-provider-unavailable":"true",className:"shrink-0 gap-2 px-2 text-secondary-label sm:px-3",children:[u(Sn,{className:"size-4"}),U("composer.noProviderAvailable")]}):b(Pe,{children:[u(Wu,{name:"conversation.input.agent",...Ve===void 0?{}:{slots:Ve},owner:{activeInstanceId:Nt,unavailableInstanceId:H,notChosen:q,instanceEntries:Nn,lockedProvider:k,lockedContinuationGroupKey:nr,compact:qi,onInstanceChange:Ui},fallback:u(mC,{activeInstanceId:Nt,unavailableInstanceId:H,notChosen:q,instanceEntries:Nn,lockedProvider:k,lockedContinuationGroupKey:nr,compact:qi,onInstanceChange:Ui})}),Gn||q?null:u(Y_,{...Ve===void 0?{}:{slots:Ve},compact:qi,hideInstanceRail:!0,showInstanceOnTrigger:!1,activeInstanceId:Nt,model:_t,modelStatus:or,lockedProvider:k,lockedContinuationGroupKey:nr,instanceEntries:Nn,keybindings:j,modelOptionsByInstance:$e,terminalOpen:X,open:st,...zo.modelPickerIconClassName?{activeProviderIconClassName:zo.modelPickerIconClassName}:{},onOpenChange:D=>{gn(D)},getModelDisabledReason:kn,getModelContinuationLabel:O,onContinueInModel:fe,onInstanceModelChange:ro,...dn?{pluginActions:Ho,selectedPluginActionKey:Hi?.id??null,onSelectPluginAction:Tn,onManagePlugins:on}:{}})]}),el?null:b(Pe,{children:[u(h1,{environmentId:se,draftId:Ae==="draft"?nt:null,threadPresetId:E?.presetId??null,compact:qi}),qi?u(oD,{interactionMode:S,runtimeMode:L,runtimeModeSwitch:Po.runtimeModeSwitch,nativeMode:Xn,canSwitchNativeMode:Uo,showInteractionModeToggle:Po.showInteractionModeToggle,traitsMenuContent:nO,onToggleInteractionMode:ye,onRuntimeModeChange:Te,onNativeModeChange:rr}):b(Pe,{children:[qb?u(Wu,{name:"conversation.input.effort",...Ve===void 0?{}:{slots:Ve},fallback:qb}):null,Xn===null&&Po.showInteractionModeToggle?u(Wu,{name:"conversation.input.plan",...Ve===void 0?{}:{slots:Ve},owner:{interactionMode:S,showInteractionModeToggle:Po.showInteractionModeToggle,onToggleInteractionMode:ye},fallback:u(ab,{interactionMode:S,showInteractionModeToggle:Po.showInteractionModeToggle,onToggleInteractionMode:ye})}):null,u(Wu,{name:"conversation.input.permission",...Ve===void 0?{}:{slots:Ve},owner:{runtimeMode:L,runtimeModeSwitch:Po.runtimeModeSwitch,nativeMode:Xn,canSwitchNativeMode:Uo,onRuntimeModeChange:Te,onNativeModeChange:rr},fallback:u(ib,{runtimeMode:L,runtimeModeSwitch:Po.runtimeModeSwitch,nativeMode:Xn,canSwitchNativeMode:Uo,onRuntimeModeChange:Te,onNativeModeChange:rr})})]})]})]}),b("div",{"data-chat-composer-actions":"right","data-chat-composer-primary-actions-compact":$b?"true":"false",className:"flex shrink-0 flex-nowrap items-center justify-end gap-2",children:[Pd?null:lf,Pd?null:sf,u(J8,{compact:$b,activeThreadModelDisplayName:z,pendingAction:ef,isRunning:V==="running",showPlanFollowUpPrompt:s.length===0&&xe,promptHasText:vt.promptHasText,isSendBusy:Q,sendDisabledReason:Ki,isEnvironmentUnavailable:G!==null||Ee||B,isPreparingWorktree:ee,hasSendableContent:vt.hasSendableContent,preserveComposerFocusOnPointerDown:Sr,showSendWhileRunning:Sr,onPreviousPendingQuestion:w,onInterrupt:lh,interruptArmed:Mt,onImplementPlanInNewThread:dh,shellCommandMode:dl,shellCommandUnavailableReason:ti?.unavailableReason??null,compactDisabled:te||Ee||Q,compactDisabledReason:Bi,onCompactContext:uO})]})]})]})})]})]})});function $1(e){let{composerRef:t,...n}=e,o=n;return u(ck,{value:o.api,children:u(H1,{...o,composerRef:t})})}function ju({section:e,resetKey:t,children:n}){return u(Al,{resetKey:t,fallback:o=>Z8(e,o),children:n})}function Z8(e,t){return u(e7,{section:e,error:t})}function e7({section:e,error:t}){let{t:n}=ut();return b("div",{role:"status","data-conversation-section-error":e,className:e==="composer"||e==="queue"?"pointer-events-auto mx-auto flex w-full max-w-3xl items-start gap-2 rounded-lg border border-destructive/30 bg-background px-3 py-2 text-sm":"flex min-h-0 flex-1 flex-col items-center justify-center gap-2 px-6 py-12 text-center text-sm",children:[u(Sn,{"aria-hidden":!0,className:"size-4 shrink-0 text-destructive"}),b("div",{className:"min-w-0",children:[u("p",{className:"font-medium text-foreground",children:n(`timeline.sectionUnavailable.${e}`)}),u("p",{className:"whitespace-pre-wrap break-words text-muted-foreground",children:n("timeline.sectionUnavailableHint",{reason:t.message})})]})]})}function K1({hostVersion:e,scopeClass:t}){let{t:n}=ut();return b("div",{role:"status","data-conversation-host-data-mismatch":!0,className:$("flex min-h-0 min-w-0 flex-1 flex-col items-center justify-center gap-2 px-6 py-12 text-center text-sm",t),children:[u(Sn,{"aria-hidden":!0,className:"size-5 text-destructive"}),u("p",{className:"font-medium text-foreground",children:n("timeline.hostDataMismatchTitle")}),u("p",{className:"max-w-md text-muted-foreground",children:n("timeline.hostDataMismatchDescription",{host:e??0,plugin:14})})]})}function V1(e){let{data:t}=e;return t?.version!==14?u(K1,{hostVersion:t?.version??null,scopeClass:e.scopeClass}):u(bf.Provider,{value:e.scope.active,children:u(o7,{...e,data:t})})}var t7=pe(function({threadKey:t,onModeChange:n}){let[o]=sn("turn-navigator",t,null),r=R(a=>{n("chat"),o?.onSelect(a)},[n,o]);return o===null?null:u(CS,{...o,placement:"inline",onSelect:r})});function n7({slots:e,children:t}){let{data:n,target:o,threadKey:r}=ha(),a=n.useComposerPending({target:o,threadKey:r});return e?.renderSlotChain("conversation.composer",{occupants:a.occupants},t)??t}function o7(e){let{scope:t,mode:n,timeline:o,trajectory:r,composer:a,data:i}=e,[,s]=sn("turn-navigator",t.threadKey,null),l=a.draftHero.active,d=a.sessionActions,c=a.terminalControl,f=a.agentsControl,{mode:p,onModeChange:m}=n,g=K(()=>l?b(Pe,{children:[d,u("div",{className:"min-w-0 flex-1"}),c]}):b(Pe,{children:[d,u(hS,{mode:p,onModeChange:m}),u("div",{className:"min-w-0 flex-1"}),c,f,u(t7,{threadKey:t.threadKey,onModeChange:m})]}),[l,d,c,f,p,m,t.threadKey]),{belowSlot:h,draftHero:v,onOverlayElementChange:y,sessionActions:x,terminalControl:C,agentsControl:w,contextStrip:L,...S}=a,k=u($1,{...S,attachments:e.attachments,firstRow:g}),I=K(()=>({environmentId:t.environmentId,threadId:t.threadId}),[t.environmentId,t.threadId]),[T,A]=sn("trajectory-reveal",t.threadKey,null),P=R(Se=>{n.onModeChange("chat"),A(H=>({rowId:Se,nonce:(H?.nonce??0)+1}))},[n,A]),_=R(()=>A(null),[A]),E=K(()=>({data:i,target:I,threadKey:t.threadKey}),[i,I,t.threadKey]),{controlRef:F,...B}=o,V=i.useChatWindow({target:I,threadKey:t.threadKey,visible:t.visible&&n.mode==="chat"}),Q=u0({inputKey:t.threadKey,visible:t.visible,endInset:o.contentInsetEndAdjustment,derive:e.derive,onReturnToLatest:V.onReturnToLatest,controlRef:F});return b("div",{className:$("relative flex min-h-0 min-w-0 flex-1 flex-col",e.scopeClass),"data-conversation-surface":!0,children:[u(vS,{chat:b(ju,{section:"chat",resetKey:t.threadKey,children:[u(o0,{data:i,target:I,visible:t.visible,...B,paneActive:t.active,liveFollowEnabled:Q.liveFollowEnabled,scrollerRef:Q.bindTimelineHandle,onRowsChange:Q.onRowsChange,onIsAtEndChange:Q.onIsAtEndChange,onManualNavigation:Q.onManualNavigation,onDisclosureNavigation:Q.onDisclosureNavigation,loadEarlier:V.loadEarlier,loadLater:V.loadLater,pagingBlockedByInteraction:V.pagingBlockedByInteraction,onVisibleTurnRangeChange:V.onVisibleTurnRangeChange,onReturnToLatest:V.loadLater===null?null:Q.returnToEnd,onTurnNavigatorChange:s,revealMessageRequest:T,onRevealMessageHandled:_}),u(s0,{data:i,target:I,bottomInset:o.contentInsetEndAdjustment,showScrollToEnd:Q.showScrollToEnd,onScrollToEnd:Q.returnToEnd})]},"chat"),mode:n.mode,trajectory:u(ju,{section:"trajectory",resetKey:t.threadKey,children:u(h0,{data:i,target:I,inputKey:t.threadKey,paneVisible:t.visible&&n.mode==="trajectory",timestampFormat:r.timestampFormat,onOpenInChat:P})},"trajectory"),visible:t.visible}),u(HT,{data:i,target:I,threadKey:t.threadKey,belowSlot:a.belowSlot,composer:u(ju,{section:"composer",resetKey:t.threadKey,children:u(R1,{value:E,children:u(N1,{children:u(n7,{slots:a.slots,children:k})})})}),draftHero:a.draftHero,onOverlayElementChange:a.onOverlayElementChange,queue:u(ju,{section:"queue",resetKey:t.threadKey,children:u(NT,{data:i,target:I,inputKey:t.threadKey,attachments:e.attachments})})})]})}var r7=".ycodium-conversation-ui";function a7(){let e=globalThis,t=(e.__ycodiumConversationScope??0)+1;return e.__ycodiumConversationScope=t,`ycodium-conversation-ui-${t}`}function q1(e,t="conversation"){let n=a7(),o=e.replaceAll(r7,`.${n}`),r=0,a=null;return{scopeClass:n,retain(){return typeof document>"u"?()=>{}:(r===0&&(a=document.createElement("style"),a.setAttribute("data-ycodium-plugin-css",t),a.textContent=o,document.head.appendChild(a)),r+=1,()=>{r-=1,r===0&&a!==null&&(a.remove(),a=null)})}}}function i7(e){let t=q1(rw);return{views:{[hh]:s7(t,e)},viewCapabilities:{[hh]:[uw,cw]},slots:[{name:"conversation.input.agent",order:0,component:qM},{name:"conversation.input.model",order:0,component:J_},{name:"conversation.input.plan",order:0,component:Z_},{name:"conversation.input.permission",order:0,component:nD}]}}function s7(e,t){return function(o){let a=o[vh]??t,i={...o};return delete i[vh],b(sw,{value:a,children:[u(l7,{retain:e.retain}),u(dw,{value:e.scopeClass,children:u(V1,{...i,scopeClass:e.scopeClass})})]})}}function l7({retain:e}){return Md(()=>e(),[e]),null}export{i7 as default};
|