@ycodium-ai/plugin-conversation 0.2.2510 → 0.2.2544
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 +74 -52
- package/locales/en.json +5 -0
- package/locales/zh-CN.json +5 -0
- package/package.json +2 -2
package/assets/ui.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
var
|
|
1
|
+
var SO=Object.create;var pf=Object.defineProperty;var IO=Object.getOwnPropertyDescriptor;var TO=Object.getOwnPropertyNames;var kO=Object.getPrototypeOf,LO=Object.prototype.hasOwnProperty;var PO=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(o){throw n=[o],o}};var mf=(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)pf(e,n,{get:t[n],enumerable:!0})},nw=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of TO(t))!LO.call(e,r)&&r!==n&&pf(e,r,{get:()=>t[r],enumerable:!(o=IO(t,r))||o.enumerable});return e};var Md=(e,t,n)=>(n=e!=null?SO(kO(e)):{},nw(t||!e||!e.__esModule?pf(n,"default",{value:e,enumerable:!0}):n,e)),ow=e=>nw(pf({},"__esModule",{value:!0}),e);var hf={};En(hf,{Activity:()=>EO,Children:()=>fh,Component:()=>Sa,Fragment:()=>oi,Profiler:()=>RO,PureComponent:()=>MO,StrictMode:()=>NO,Suspense:()=>ph,__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE:()=>_O,__COMPILER_RUNTIME:()=>DO,act:()=>OO,cache:()=>FO,cacheSignal:()=>BO,captureOwnerStack:()=>zO,cloneElement:()=>gf,createContext:()=>Ct,createElement:()=>De,createRef:()=>UO,default:()=>yn,forwardRef:()=>zn,isValidElement:()=>mh,lazy:()=>HO,memo:()=>pe,startTransition:()=>$O,unstable_useCacheRefresh:()=>KO,use:()=>bt,useActionState:()=>VO,useCallback:()=>R,useContext:()=>Ht,useDebugValue:()=>qO,useDeferredValue:()=>WO,useEffect:()=>W,useEffectEvent:()=>gh,useId:()=>Jr,useImperativeHandle:()=>ir,useInsertionEffect:()=>Nd,useLayoutEffect:()=>he,useMemo:()=>K,useOptimistic:()=>GO,useReducer:()=>Ia,useRef:()=>N,useState:()=>J,useSyncExternalStore:()=>Ko,useTransition:()=>jO,version:()=>QO});var aw,yn,EO,fh,Sa,oi,RO,MO,NO,ph,_O,DO,OO,FO,BO,zO,gf,Ct,De,UO,zn,mh,HO,pe,$O,KO,bt,VO,R,Ht,qO,WO,W,gh,Jr,ir,Nd,he,K,GO,Ia,N,J,Ko,jO,QO,ue=PO(()=>{aw=window.__ycodiumPluginHost.react,yn=aw,{Activity:EO,Children:fh,Component:Sa,Fragment:oi,Profiler:RO,PureComponent:MO,StrictMode:NO,Suspense:ph,__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE:_O,__COMPILER_RUNTIME:DO,act:OO,cache:FO,cacheSignal:BO,captureOwnerStack:zO,cloneElement:gf,createContext:Ct,createElement:De,createRef:UO,forwardRef:zn,isValidElement:mh,lazy:HO,memo:pe,startTransition:$O,unstable_useCacheRefresh:KO,use:bt,useActionState:VO,useCallback:R,useContext:Ht,useDebugValue:qO,useDeferredValue:WO,useEffect:W,useEffectEvent:gh,useId:Jr,useImperativeHandle:ir,useInsertionEffect:Nd,useLayoutEffect:he,useMemo:K,useOptimistic:GO,useReducer:Ia,useRef:N,useState:J,useSyncExternalStore:Ko,useTransition:jO,version:QO}=aw});var g0=mf(xo=>{"use strict";var SU=(ue(),ow(hf));function m0(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 vi(){}var yo={d:{f:vi,r:function(){throw Error(m0(522))},D:vi,C:vi,L:vi,m:vi,X:vi,S:vi,M:vi},p:0,findDOMNode:null},IU=Symbol.for("react.portal");function TU(e,t,n){var o=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:IU,key:o==null?null:""+o,children:e,containerInfo:t,implementation:n}}var Sc=SU.__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(m0(299));return TU(e,t,null,n)};xo.flushSync=function(e){var t=Sc.T,n=yo.p;try{if(Sc.T=null,yo.p=2,e)return e()}finally{Sc.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 Sc.H.useFormState(e,t,n)};xo.useFormStatus=function(){return Sc.H.useHostTransitionStatus()};xo.version="19.2.6"});var Ic=mf((toe,v0)=>{"use strict";function h0(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(h0)}catch(e){console.error(e)}}h0(),v0.exports=g0()});var qM=mf(VM=>{"use strict";var gd=(ue(),ow(hf));function jq(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Qq=typeof Object.is=="function"?Object.is:jq,Xq=gd.useState,Yq=gd.useEffect,Jq=gd.useLayoutEffect,Zq=gd.useDebugValue;function e4(e,t){var n=t(),o=Xq({inst:{value:n,getSnapshot:t}}),r=o[0].inst,a=o[1];return Jq(function(){r.value=n,r.getSnapshot=t,gC(r)&&a({inst:r})},[e,n,t]),Yq(function(){return gC(r)&&a({inst:r}),e(function(){gC(r)&&a({inst:r})})},[e]),Zq(n),n}function gC(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Qq(e,n)}catch{return!0}}function t4(e,t){return t()}var n4=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?t4:e4;VM.useSyncExternalStore=gd.useSyncExternalStore!==void 0?gd.useSyncExternalStore:n4});var GM=mf((ipe,WM)=>{"use strict";WM.exports=qM()});var rw=`/*! tailwindcss v4.3.0 | MIT License | https://tailwindcss.com */
|
|
2
|
+
@layer properties, theme, base, components, utilities;
|
|
2
3
|
@layer properties;
|
|
3
4
|
:root, :host {
|
|
4
5
|
--radius-lg: var(--radius);
|
|
@@ -48,6 +49,7 @@ var yO=Object.create;var ff=Object.defineProperty;var xO=Object.getOwnPropertyDe
|
|
|
48
49
|
filter: hue-rotate(360deg) saturate(1.2);
|
|
49
50
|
}
|
|
50
51
|
}
|
|
52
|
+
@layer utilities {
|
|
51
53
|
@scope (.ycodium-conversation-ui) {
|
|
52
54
|
.pointer-events-auto:where(:scope, *) {
|
|
53
55
|
pointer-events: auto;
|
|
@@ -351,6 +353,9 @@ var yO=Object.create;var ff=Object.defineProperty;var xO=Object.getOwnPropertyDe
|
|
|
351
353
|
.aspect-square:where(:scope, *) {
|
|
352
354
|
aspect-ratio: 1 / 1;
|
|
353
355
|
}
|
|
356
|
+
.aspect-video:where(:scope, *) {
|
|
357
|
+
aspect-ratio: var(--aspect-video, 16 / 9);
|
|
358
|
+
}
|
|
354
359
|
.size-1\\.5:where(:scope, *) {
|
|
355
360
|
width: calc(var(--spacing, 0.25rem) * 1.5);
|
|
356
361
|
height: calc(var(--spacing, 0.25rem) * 1.5);
|
|
@@ -676,6 +681,9 @@ var yO=Object.create;var ff=Object.defineProperty;var xO=Object.getOwnPropertyDe
|
|
|
676
681
|
.max-w-none:where(:scope, *) {
|
|
677
682
|
max-width: none;
|
|
678
683
|
}
|
|
684
|
+
.max-w-sm:where(:scope, *) {
|
|
685
|
+
max-width: var(--container-sm, 24rem);
|
|
686
|
+
}
|
|
679
687
|
.max-w-xl:where(:scope, *) {
|
|
680
688
|
max-width: var(--container-xl, 36rem);
|
|
681
689
|
}
|
|
@@ -1253,6 +1261,9 @@ var yO=Object.create;var ff=Object.defineProperty;var xO=Object.getOwnPropertyDe
|
|
|
1253
1261
|
background-color: color-mix(in oklab, var(--background) 95%, transparent);
|
|
1254
1262
|
}
|
|
1255
1263
|
}
|
|
1264
|
+
.bg-black:where(:scope, *) {
|
|
1265
|
+
background-color: var(--color-black, #000);
|
|
1266
|
+
}
|
|
1256
1267
|
.bg-border\\/60:where(:scope, *) {
|
|
1257
1268
|
background-color: var(--contrast-border);
|
|
1258
1269
|
@supports (color: color-mix(in lab, red, red)) {
|
|
@@ -1904,6 +1915,9 @@ var yO=Object.create;var ff=Object.defineProperty;var xO=Object.getOwnPropertyDe
|
|
|
1904
1915
|
.text-update-foreground:where(:scope, *) {
|
|
1905
1916
|
color: var(--update-foreground);
|
|
1906
1917
|
}
|
|
1918
|
+
.text-warning:where(:scope, *) {
|
|
1919
|
+
color: var(--warning);
|
|
1920
|
+
}
|
|
1907
1921
|
.text-warning-foreground:where(:scope, *) {
|
|
1908
1922
|
color: var(--warning-foreground);
|
|
1909
1923
|
}
|
|
@@ -2588,6 +2602,13 @@ var yO=Object.create;var ff=Object.defineProperty;var xO=Object.getOwnPropertyDe
|
|
|
2588
2602
|
}
|
|
2589
2603
|
}
|
|
2590
2604
|
}
|
|
2605
|
+
.hover\\:underline:where(:scope, *) {
|
|
2606
|
+
&:hover {
|
|
2607
|
+
@media (hover: hover) {
|
|
2608
|
+
text-decoration-line: underline;
|
|
2609
|
+
}
|
|
2610
|
+
}
|
|
2611
|
+
}
|
|
2591
2612
|
.hover\\:opacity-100:where(:scope, *) {
|
|
2592
2613
|
&:hover {
|
|
2593
2614
|
@media (hover: hover) {
|
|
@@ -3614,6 +3635,7 @@ var yO=Object.create;var ff=Object.defineProperty;var xO=Object.getOwnPropertyDe
|
|
|
3614
3635
|
}
|
|
3615
3636
|
}
|
|
3616
3637
|
}
|
|
3638
|
+
}
|
|
3617
3639
|
@keyframes spin {
|
|
3618
3640
|
to {
|
|
3619
3641
|
transform: rotate(360deg);
|
|
@@ -3709,76 +3731,76 @@ var yO=Object.create;var ff=Object.defineProperty;var xO=Object.getOwnPropertyDe
|
|
|
3709
3731
|
}
|
|
3710
3732
|
}
|
|
3711
3733
|
}
|
|
3712
|
-
`;pe();pe();var aw=wt(null),iw=aw.Provider,sw=wt(""),lw=sw.Provider;function hf(){return Kt(sw)}function or(){let e=Kt(aw);if(e===null)throw new Error("Conversation UI has not been registered.");return e}var dw="ycodium.conversation.host-data.v14",vh="conversation";var yh="__ycodiumConversationBridge",cw="ycodium.conversation.rebindable-bridge.v1";pe();function uw(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=uw(e[t]))&&(o&&(o+=" "),o+=n)}else for(n in e)e[n]&&(o&&(o+=" "),o+=n);return o}function fw(){for(var e,t,n=0,o="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=uw(e))&&(o&&(o+=" "),o+=t);return o}var pw=fw;var qO=(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},WO=(e,t)=>({classGroupId:e,validator:t}),bw=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n});var mw=[],GO="arbitrary..",jO=e=>{let t=XO(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:o}=e;return{getClassGroupId:i=>{if(i.startsWith("[")&&i.endsWith("]"))return QO(i);let s=i.split("-"),l=s[0]===""&&s.length>1?1:0;return ww(s,l,t)},getConflictingClassGroupIds:(i,s)=>{if(s){let l=o[i],d=n[i];return l?d?qO(d,l):l:d||mw}return n[i]||mw}}},ww=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],a=n.nextPart.get(r);if(a){let d=ww(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}},QO=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?GO+o:void 0})(),XO=e=>{let{theme:t,classGroups:n}=e;return YO(n,t)},YO=(e,t)=>{let n=bw();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];JO(i,t,n,o)}},JO=(e,t,n,o)=>{if(typeof e=="string"){ZO(e,t,n);return}if(typeof e=="function"){eF(e,t,n,o);return}tF(e,t,n,o)},ZO=(e,t,n)=>{let o=e===""?t:Sw(t,e);o.classGroupId=n},eF=(e,t,n,o)=>{if(nF(e)){bh(e(o),t,n,o);return}t.validators===null&&(t.validators=[]),t.validators.push(WO(n,e))},tF=(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,Sw(t,s),n,o)}},Sw=(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=bw(),n.nextPart.set(i,s)),n=s}return n},nF=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,oF=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 rF=[],gw=(e,t,n,o,r)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:o,isExternal:r}),aF=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 gw(a,m,p,g)};if(t){let r=t+":",a=o;o=i=>i.startsWith(r)?a(i.slice(r.length)):gw(rF,!1,i,void 0,!0)}if(n){let r=o;o=a=>n({className:a,parseClassName:r})}return o},iF=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}},sF=e=>({cache:oF(e.cacheSize),parseClassName:aF(e),sortModifiers:iF(e),postfixLookupClassGroupIds:lF(e),...jO(e)}),lF=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},dF=/\s+/,cF=(e,t)=>{let{parseClassName:n,getClassGroupId:o,getConflictingClassGroupIds:r,sortModifiers:a,postfixLookupClassGroupIds:i}=t,s=[],l=e.trim().split(dF),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 T=h.substring(0,v);x=o(T);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 T=0;T<S.length;++T){let I=S[T];s.push(w+I)}d=f+(d.length>0?" "+d:d)}return d},uF=(...e)=>{let t=0,n,o,r="";for(;t<e.length;)(n=e[t++])&&(o=Iw(n))&&(r&&(r+=" "),r+=o);return r},Iw=e=>{if(typeof e=="string")return e;let t,n="";for(let o=0;o<e.length;o++)e[o]&&(t=Iw(e[o]))&&(n&&(n+=" "),n+=t);return n},hw=(e,...t)=>{let n,o,r,a,i=l=>{let d=t.reduce((c,f)=>f(c),e());return n=sF(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(uF(...l))},fF=[],Fn=e=>{let t=n=>n[e]||fF;return t.isThemeGetter=!0,t},Tw=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,kw=/^\((?:(\w[\w-]*):)?(.+)\)$/i,pF=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,mF=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,gF=/\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$/,hF=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,vF=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,yF=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ai=e=>pF.test(e),gt=e=>!!e&&!Number.isNaN(Number(e)),ra=e=>!!e&&Number.isInteger(Number(e)),xh=e=>e.endsWith("%")&>(e.slice(0,-1)),Pa=e=>mF.test(e),Lw=()=>!0,xF=e=>gF.test(e)&&!hF.test(e),wh=()=>!1,CF=e=>vF.test(e),bF=e=>yF.test(e),wF=e=>!_e(e)&&!De(e),SF=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)),IF=e=>ii(e,Ew,wh),_e=e=>Tw.test(e),Wi=e=>ii(e,Rw,xF),vw=e=>ii(e,MF,gt),TF=e=>ii(e,Nw,Lw),kF=e=>ii(e,Mw,wh),yw=e=>ii(e,Pw,wh),LF=e=>ii(e,Aw,bF),vf=e=>ii(e,_w,CF),De=e=>kw.test(e),Nd=e=>Gi(e,Rw),PF=e=>Gi(e,Mw),xw=e=>Gi(e,Pw),AF=e=>Gi(e,Ew),EF=e=>Gi(e,Aw),yf=e=>Gi(e,_w,!0),RF=e=>Gi(e,Nw,!0),ii=(e,t,n)=>{let o=Tw.exec(e);return o?o[1]?t(o[1]):n(o[2]):!1},Gi=(e,t,n=!1)=>{let o=kw.exec(e);return o?o[1]?t(o[1]):n:!1},Pw=e=>e==="position"||e==="percentage",Aw=e=>e==="image"||e==="url",Ew=e=>e==="length"||e==="size"||e==="bg-size",Rw=e=>e==="length",MF=e=>e==="number",Mw=e=>e==="family-name",Nw=e=>e==="number"||e==="weight",_w=e=>e==="shadow";var Cw=()=>{let e=Fn("color"),t=Fn("font"),n=Fn("text"),o=Fn("font-weight"),r=Fn("tracking"),a=Fn("leading"),i=Fn("breakpoint"),s=Fn("container"),l=Fn("spacing"),d=Fn("radius"),c=Fn("shadow"),f=Fn("inset-shadow"),p=Fn("text-shadow"),m=Fn("drop-shadow"),g=Fn("blur"),h=Fn("perspective"),v=Fn("aspect"),y=Fn("ease"),x=Fn("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(),De,_e],S=()=>["auto","hidden","clip","visible","scroll"],T=()=>["auto","contain","none"],I=()=>[De,_e,l],k=()=>[ai,"full","auto",...I()],E=()=>[ra,"none","subgrid",De,_e],P=()=>["auto",{span:["full",ra,De,_e]},ra,De,_e],_=()=>[ra,"auto",De,_e],A=()=>["auto","min","max","fr",De,_e],B=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],z=()=>["start","end","center","stretch","center-safe","end-safe"],q=()=>["auto",...I()],X=()=>[ai,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...I()],Se=()=>[ai,"screen","full","dvw","lvw","svw","min","max","fit",...I()],K=()=>[ai,"screen","full","lh","dvh","lvh","svh","min","max","fit",...I()],W=()=>[e,De,_e],Z=()=>[...w(),xw,yw,{position:[De,_e]}],j=()=>["no-repeat",{repeat:["","x","y","space","round"]}],O=()=>["auto","cover","contain",AF,IF,{size:[De,_e]}],Y=()=>[xh,Nd,Wi],re=()=>["","none","full",d,De,_e],ue=()=>["",gt,Nd,Wi],le=()=>["solid","dashed","dotted","double"],fe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ae=()=>[gt,xh,xw,yw],Le=()=>["","none",g,De,_e],et=()=>["none",gt,De,_e],Ge=()=>["none",gt,De,_e],rt=()=>[gt,De,_e],$e=()=>[ai,"full",...I()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Pa],breakpoint:[Pa],color:[Lw],container:[Pa],"drop-shadow":[Pa],ease:["in","out","in-out"],font:[wF],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Pa],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Pa],shadow:[Pa],spacing:["px",gt],text:[Pa],"text-shadow":[Pa],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ai,_e,De,v]}],container:["container"],"container-type":[{"@container":["","normal","size",De,_e]}],"container-named":[SF],columns:[{columns:[gt,_e,De,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:T()}],"overscroll-x":[{"overscroll-x":T()}],"overscroll-y":[{"overscroll-y":T()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:k()}],"inset-x":[{"inset-x":k()}],"inset-y":[{"inset-y":k()}],start:[{"inset-s":k(),start:k()}],end:[{"inset-e":k(),end:k()}],"inset-bs":[{"inset-bs":k()}],"inset-be":[{"inset-be":k()}],top:[{top:k()}],right:[{right:k()}],bottom:[{bottom:k()}],left:[{left:k()}],visibility:["visible","invisible","collapse"],z:[{z:[ra,"auto",De,_e]}],basis:[{basis:[ai,"full","auto",s,...I()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[gt,ai,"auto","initial","none",_e]}],grow:[{grow:["",gt,De,_e]}],shrink:[{shrink:["",gt,De,_e]}],order:[{order:[ra,"first","last","none",De,_e]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:P()}],"col-start":[{"col-start":_()}],"col-end":[{"col-end":_()}],"grid-rows":[{"grid-rows":E()}],"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":A()}],"auto-rows":[{"auto-rows":A()}],gap:[{gap:I()}],"gap-x":[{"gap-x":I()}],"gap-y":[{"gap-y":I()}],"justify-content":[{justify:[...B(),"normal"]}],"justify-items":[{"justify-items":[...z(),"normal"]}],"justify-self":[{"justify-self":["auto",...z()]}],"align-content":[{content:["normal",...B()]}],"align-items":[{items:[...z(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...z(),{baseline:["","last"]}]}],"place-content":[{"place-content":B()}],"place-items":[{"place-items":[...z(),"baseline"]}],"place-self":[{"place-self":["auto",...z()]}],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:q()}],mx:[{mx:q()}],my:[{my:q()}],ms:[{ms:q()}],me:[{me:q()}],mbs:[{mbs:q()}],mbe:[{mbe:q()}],mt:[{mt:q()}],mr:[{mr:q()}],mb:[{mb:q()}],ml:[{ml:q()}],"space-x":[{"space-x":I()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":I()}],"space-y-reverse":["space-y-reverse"],size:[{size:X()}],"inline-size":[{inline:["auto",...Se()]}],"min-inline-size":[{"min-inline":["auto",...Se()]}],"max-inline-size":[{"max-inline":["none",...Se()]}],"block-size":[{block:["auto",...K()]}],"min-block-size":[{"min-block":["auto",...K()]}],"max-block-size":[{"max-block":["none",...K()]}],w:[{w:[s,"screen",...X()]}],"min-w":[{"min-w":[s,"screen","none",...X()]}],"max-w":[{"max-w":[s,"screen","none","prose",{screen:[i]},...X()]}],h:[{h:["screen","lh",...X()]}],"min-h":[{"min-h":["screen","lh","none",...X()]}],"max-h":[{"max-h":["screen","lh",...X()]}],"font-size":[{text:["base",n,Nd,Wi]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[o,RF,TF]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",xh,_e]}],"font-family":[{font:[PF,kF,t]}],"font-features":[{"font-features":[_e]}],"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,De,_e]}],"line-clamp":[{"line-clamp":[gt,"none",De,vw]}],leading:[{leading:[a,...I()]}],"list-image":[{"list-image":["none",De,_e]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",De,_e]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:W()}],"text-color":[{text:W()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...le(),"wavy"]}],"text-decoration-thickness":[{decoration:[gt,"from-font","auto",De,Wi]}],"text-decoration-color":[{decoration:W()}],"underline-offset":[{"underline-offset":[gt,"auto",De,_e]}],"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:[ra,De,_e]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",De,_e]}],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",De,_e]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:Z()}],"bg-repeat":[{bg:j()}],"bg-size":[{bg:O()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},ra,De,_e],radial:["",De,_e],conic:[ra,De,_e]},EF,LF]}],"bg-color":[{bg:W()}],"gradient-from-pos":[{from:Y()}],"gradient-via-pos":[{via:Y()}],"gradient-to-pos":[{to:Y()}],"gradient-from":[{from:W()}],"gradient-via":[{via:W()}],"gradient-to":[{to:W()}],rounded:[{rounded:re()}],"rounded-s":[{"rounded-s":re()}],"rounded-e":[{"rounded-e":re()}],"rounded-t":[{"rounded-t":re()}],"rounded-r":[{"rounded-r":re()}],"rounded-b":[{"rounded-b":re()}],"rounded-l":[{"rounded-l":re()}],"rounded-ss":[{"rounded-ss":re()}],"rounded-se":[{"rounded-se":re()}],"rounded-ee":[{"rounded-ee":re()}],"rounded-es":[{"rounded-es":re()}],"rounded-tl":[{"rounded-tl":re()}],"rounded-tr":[{"rounded-tr":re()}],"rounded-br":[{"rounded-br":re()}],"rounded-bl":[{"rounded-bl":re()}],"border-w":[{border:ue()}],"border-w-x":[{"border-x":ue()}],"border-w-y":[{"border-y":ue()}],"border-w-s":[{"border-s":ue()}],"border-w-e":[{"border-e":ue()}],"border-w-bs":[{"border-bs":ue()}],"border-w-be":[{"border-be":ue()}],"border-w-t":[{"border-t":ue()}],"border-w-r":[{"border-r":ue()}],"border-w-b":[{"border-b":ue()}],"border-w-l":[{"border-l":ue()}],"divide-x":[{"divide-x":ue()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ue()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...le(),"hidden","none"]}],"divide-style":[{divide:[...le(),"hidden","none"]}],"border-color":[{border:W()}],"border-color-x":[{"border-x":W()}],"border-color-y":[{"border-y":W()}],"border-color-s":[{"border-s":W()}],"border-color-e":[{"border-e":W()}],"border-color-bs":[{"border-bs":W()}],"border-color-be":[{"border-be":W()}],"border-color-t":[{"border-t":W()}],"border-color-r":[{"border-r":W()}],"border-color-b":[{"border-b":W()}],"border-color-l":[{"border-l":W()}],"divide-color":[{divide:W()}],"outline-style":[{outline:[...le(),"none","hidden"]}],"outline-offset":[{"outline-offset":[gt,De,_e]}],"outline-w":[{outline:["",gt,Nd,Wi]}],"outline-color":[{outline:W()}],shadow:[{shadow:["","none",c,yf,vf]}],"shadow-color":[{shadow:W()}],"inset-shadow":[{"inset-shadow":["none",f,yf,vf]}],"inset-shadow-color":[{"inset-shadow":W()}],"ring-w":[{ring:ue()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:W()}],"ring-offset-w":[{"ring-offset":[gt,Wi]}],"ring-offset-color":[{"ring-offset":W()}],"inset-ring-w":[{"inset-ring":ue()}],"inset-ring-color":[{"inset-ring":W()}],"text-shadow":[{"text-shadow":["none",p,yf,vf]}],"text-shadow-color":[{"text-shadow":W()}],opacity:[{opacity:[gt,De,_e]}],"mix-blend":[{"mix-blend":[...fe(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":fe()}],"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":[gt]}],"mask-image-linear-from-pos":[{"mask-linear-from":ae()}],"mask-image-linear-to-pos":[{"mask-linear-to":ae()}],"mask-image-linear-from-color":[{"mask-linear-from":W()}],"mask-image-linear-to-color":[{"mask-linear-to":W()}],"mask-image-t-from-pos":[{"mask-t-from":ae()}],"mask-image-t-to-pos":[{"mask-t-to":ae()}],"mask-image-t-from-color":[{"mask-t-from":W()}],"mask-image-t-to-color":[{"mask-t-to":W()}],"mask-image-r-from-pos":[{"mask-r-from":ae()}],"mask-image-r-to-pos":[{"mask-r-to":ae()}],"mask-image-r-from-color":[{"mask-r-from":W()}],"mask-image-r-to-color":[{"mask-r-to":W()}],"mask-image-b-from-pos":[{"mask-b-from":ae()}],"mask-image-b-to-pos":[{"mask-b-to":ae()}],"mask-image-b-from-color":[{"mask-b-from":W()}],"mask-image-b-to-color":[{"mask-b-to":W()}],"mask-image-l-from-pos":[{"mask-l-from":ae()}],"mask-image-l-to-pos":[{"mask-l-to":ae()}],"mask-image-l-from-color":[{"mask-l-from":W()}],"mask-image-l-to-color":[{"mask-l-to":W()}],"mask-image-x-from-pos":[{"mask-x-from":ae()}],"mask-image-x-to-pos":[{"mask-x-to":ae()}],"mask-image-x-from-color":[{"mask-x-from":W()}],"mask-image-x-to-color":[{"mask-x-to":W()}],"mask-image-y-from-pos":[{"mask-y-from":ae()}],"mask-image-y-to-pos":[{"mask-y-to":ae()}],"mask-image-y-from-color":[{"mask-y-from":W()}],"mask-image-y-to-color":[{"mask-y-to":W()}],"mask-image-radial":[{"mask-radial":[De,_e]}],"mask-image-radial-from-pos":[{"mask-radial-from":ae()}],"mask-image-radial-to-pos":[{"mask-radial-to":ae()}],"mask-image-radial-from-color":[{"mask-radial-from":W()}],"mask-image-radial-to-color":[{"mask-radial-to":W()}],"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":[gt]}],"mask-image-conic-from-pos":[{"mask-conic-from":ae()}],"mask-image-conic-to-pos":[{"mask-conic-to":ae()}],"mask-image-conic-from-color":[{"mask-conic-from":W()}],"mask-image-conic-to-color":[{"mask-conic-to":W()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:Z()}],"mask-repeat":[{mask:j()}],"mask-size":[{mask:O()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",De,_e]}],filter:[{filter:["","none",De,_e]}],blur:[{blur:Le()}],brightness:[{brightness:[gt,De,_e]}],contrast:[{contrast:[gt,De,_e]}],"drop-shadow":[{"drop-shadow":["","none",m,yf,vf]}],"drop-shadow-color":[{"drop-shadow":W()}],grayscale:[{grayscale:["",gt,De,_e]}],"hue-rotate":[{"hue-rotate":[gt,De,_e]}],invert:[{invert:["",gt,De,_e]}],saturate:[{saturate:[gt,De,_e]}],sepia:[{sepia:["",gt,De,_e]}],"backdrop-filter":[{"backdrop-filter":["","none",De,_e]}],"backdrop-blur":[{"backdrop-blur":Le()}],"backdrop-brightness":[{"backdrop-brightness":[gt,De,_e]}],"backdrop-contrast":[{"backdrop-contrast":[gt,De,_e]}],"backdrop-grayscale":[{"backdrop-grayscale":["",gt,De,_e]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[gt,De,_e]}],"backdrop-invert":[{"backdrop-invert":["",gt,De,_e]}],"backdrop-opacity":[{"backdrop-opacity":[gt,De,_e]}],"backdrop-saturate":[{"backdrop-saturate":[gt,De,_e]}],"backdrop-sepia":[{"backdrop-sepia":["",gt,De,_e]}],"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",De,_e]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[gt,"initial",De,_e]}],ease:[{ease:["linear","initial",y,De,_e]}],delay:[{delay:[gt,De,_e]}],animate:[{animate:["none",x,De,_e]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[h,De,_e]}],"perspective-origin":[{"perspective-origin":L()}],rotate:[{rotate:et()}],"rotate-x":[{"rotate-x":et()}],"rotate-y":[{"rotate-y":et()}],"rotate-z":[{"rotate-z":et()}],scale:[{scale:Ge()}],"scale-x":[{"scale-x":Ge()}],"scale-y":[{"scale-y":Ge()}],"scale-z":[{"scale-z":Ge()}],"scale-3d":["scale-3d"],skew:[{skew:rt()}],"skew-x":[{"skew-x":rt()}],"skew-y":[{"skew-y":rt()}],transform:[{transform:[De,_e,"","none","gpu","cpu"]}],"transform-origin":[{origin:L()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:$e()}],"translate-x":[{"translate-x":$e()}],"translate-y":[{"translate-y":$e()}],"translate-z":[{"translate-z":$e()}],"translate-none":["translate-none"],zoom:[{zoom:[ra,De,_e]}],accent:[{accent:W()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:W()}],"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",De,_e]}],"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":W()}],"scrollbar-track-color":[{"scrollbar-track":W()}],"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",De,_e]}],fill:[{fill:["none",...W()]}],"stroke-w":[{stroke:[gt,Nd,Wi,vw]}],stroke:[{stroke:["none",...W()]}],"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"]}},NF=(e,{cacheSize:t,prefix:n,experimentalParseClassName:o,extend:r={},override:a={}})=>(fl(e,"cacheSize",t),fl(e,"prefix",n),fl(e,"experimentalParseClassName",o),xf(e.theme,a.theme),xf(e.classGroups,a.classGroups),xf(e.conflictingClassGroups,a.conflictingClassGroups),xf(e.conflictingClassGroupModifiers,a.conflictingClassGroupModifiers),fl(e,"postfixLookupClassGroups",a.postfixLookupClassGroups),fl(e,"orderSensitiveModifiers",a.orderSensitiveModifiers),Cf(e.theme,r.theme),Cf(e.classGroups,r.classGroups),Cf(e.conflictingClassGroups,r.conflictingClassGroups),Cf(e.conflictingClassGroupModifiers,r.conflictingClassGroupModifiers),Ch(e,r,"postfixLookupClassGroups"),Ch(e,r,"orderSensitiveModifiers"),e),fl=(e,t,n)=>{n!==void 0&&(e[t]=n)},xf=(e,t)=>{if(t)for(let n in t)fl(e,n,t[n])},Cf=(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)},Dw=(e,...t)=>typeof e=="function"?hw(Cw,e,...t):hw(()=>NF(Cw(),e),...t);var _F=Dw({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 H(...e){return _F(pw(e))}pe();var bf=wt(!0);function Ow(){return St(bf)}var Sh=wt(void 0);function aa(){let e=St(bf);return St(Sh)??e}pe();var wf=(...e)=>e.filter((t,n,o)=>!!t&&t.trim()!==""&&o.indexOf(t)===n).join(" ").trim();var Fw=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();var Bw=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,o)=>o?o.toUpperCase():n.toLowerCase());var Ih=e=>{let t=Bw(e);return t.charAt(0).toUpperCase()+t.slice(1)};pe();var zw={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 Uw=e=>{for(let t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};var Hw=$n(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:o,className:r="",children:a,iconNode:i,...s},l)=>Ne("svg",{ref:l,...zw,width:t,height:t,stroke:e,strokeWidth:o?Number(n)*24/Number(t):n,className:wf("lucide",r),...!a&&!Uw(s)&&{"aria-hidden":"true"},...s},[...i.map(([d,c])=>Ne(d,c)),...Array.isArray(a)?a:[a]]));var ee=(e,t)=>{let n=$n(({className:o,...r},a)=>Ne(Hw,{ref:a,iconNode:t,className:wf(`lucide-${Fw(Ih(e))}`,`lucide-${e}`,o),...r}));return n.displayName=Ih(e),n};var DF=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],_d=ee("arrow-down",DF);var OF=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],Dd=ee("arrow-up-right",OF);var FF=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Od=ee("arrow-up",FF);var BF=[["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=ee("blocks",BF);var zF=[["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"}]],pl=ee("bookmark",zF);var UF=[["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=ee("bot",UF);var HF=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],go=ee("check",HF);var $F=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],un=ee("chevron-down",$F);var KF=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Qi=ee("chevron-left",KF);var VF=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],zo=ee("chevron-right",VF);var qF=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Bd=ee("chevron-up",qF);var WF=[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]],zd=ee("chevrons-left",WF);var GF=[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]],Ud=ee("chevrons-right",GF);var jF=[["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"}]],Bn=ee("circle-alert",jF);var QF=[["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=ee("copy",QF);var XF=[["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"}]],rr=ee("ellipsis",XF);var YF=[["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=ee("eye",YF);var JF=[["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=ee("file-code",JF);var ZF=[["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=ee("file-text",ZF);var e2=[["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=ee("file",e2);var t2=[["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"}]],si=ee("folder",t2);var n2=[["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=ee("frame",n2);var o2=[["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=ee("git-branch-plus",o2);var r2=[["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=ee("globe",r2);var a2=[["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=ee("grip-vertical",a2);var i2=[["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=ee("hammer",i2);var s2=[["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=ee("image",s2);var l2=[["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"}]],Aa=ee("layers",l2);var d2=[["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=ee("list-ordered",d2);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=ee("list-todo",c2);var u2=[["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=ee("list",u2);var f2=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],li=ee("loader-circle",f2);var p2=[["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"}]],di=ee("lock-open",p2);var m2=[["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=ee("lock",m2);var g2=[["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=ee("message-circle",g2);var h2=[["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=ee("message-square",h2);var v2=[["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=ee("minimize-2",v2);var y2=[["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"}]],ia=ee("mouse-pointer-click",y2);var x2=[["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=ee("package",x2);var C2=[["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=ee("paintbrush",C2);var b2=[["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"}]],ho=ee("paperclip",b2);var w2=[["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"}]],sa=ee("pen-line",w2);var S2=[["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=ee("pencil-ruler",S2);var I2=[["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=ee("pencil",I2);var T2=[["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=ee("puzzle",T2);var k2=[["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=ee("rotate-ccw",k2);var L2=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],is=ee("search",L2);var P2=[["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=ee("send",P2);var A2=[["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=ee("settings",A2);var E2=[["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"}]],ml=ee("sliders-horizontal",E2);var R2=[["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"}]],ci=ee("sparkles",R2);var M2=[["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"}]],Po=ee("square-pen",M2);var N2=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],oc=ee("square",N2);var _2=[["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=ee("star",_2);var D2=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],Uo=ee("terminal",D2);var O2=[["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=ee("text-quote",O2);var F2=[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]],la=ee("user-round",F2);var B2=[["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=ee("wrench",B2);var z2=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],nn=ee("x",z2);var U2=[["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=ee("zap",U2);pe();function xe(){return{t:or().i18n.usePluginTranslation()}}pe();pe();var gl=wt(null),ic=wt(null);function Sf(e,t){let n=St(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 $w=new Set(["Select","AlertDialog","Dialog","DropdownMenu","Menu","Popover","Tooltip","Combobox"]);function ie(e){let t=$w.has(e),n=o=>{let r=or(),a=hf(),i=aa(),s=r.ui[e],l={};if(t){let d=St(gl),[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 Ne(s,{...o,...l,...$w.has(e)&&!i?{open:!1}:{},className:`${a} ${typeof o.className=="string"?o.className:""}`})};return n.displayName=e,n}var aY=ie("useLinkContextMenu"),Lr=ie("ProviderInstanceIcon"),Kw=ie("UserAvatar"),hl=ie("Badge"),de=ie("Button"),iY=ie("Label"),If=ie("Input"),Vw=ie("Textarea"),sY=ie("Switch"),lY=ie("Separator"),dY=ie("Skeleton"),Tf=ie("Spinner"),cY=ie("ScrollArea"),uY=ie("Card"),fY=ie("CardAction"),pY=ie("CardContent"),mY=ie("CardDescription"),gY=ie("CardFooter"),hY=ie("CardHeader"),vY=ie("CardTitle"),yY=ie("Empty"),xY=ie("EmptyContent"),CY=ie("EmptyDescription"),bY=ie("EmptyHeader"),wY=ie("EmptyMedia"),SY=ie("EmptyTitle"),IY=ie("InputGroup"),TY=ie("InputGroupAddon"),kY=ie("InputGroupInput"),LY=ie("DocumentPanel"),PY=ie("MasterDetail"),kf=ie("Select"),AY=ie("SelectContent"),Lf=ie("SelectItem"),Pf=ie("SelectPopup"),qw=ie("SelectTrigger"),Af=ie("SelectValue"),lc=ie("Toggle"),Ww=ie("ToggleGroup"),Gw=ie("AlertDialog"),jw=ie("AlertDialogClose"),Qw=ie("AlertDialogDescription"),Xw=ie("AlertDialogFooter"),Yw=ie("AlertDialogHeader"),Jw=ie("AlertDialogPopup"),Zw=ie("AlertDialogTitle"),Ef=ie("Dialog"),EY=ie("DialogClose"),Rf=ie("DialogDescription"),Mf=ie("DialogFooter"),Nf=ie("DialogHeader"),_f=ie("DialogPopup"),eS=ie("DialogPanel"),Df=ie("DialogTitle"),RY=ie("DialogTrigger"),MY=ie("DropdownMenu"),NY=ie("DropdownMenuContent"),_Y=ie("DropdownMenuItem"),DY=ie("DropdownMenuTrigger"),Ao=ie("Menu"),dc=ie("MenuGroup"),OY=ie("MenuGroupLabel"),ar=ie("MenuItem"),Eo=ie("MenuPopup"),Pr=ie("MenuRadioGroup"),Ho=ie("MenuRadioItem"),ui=ie("MenuSeparator"),Ro=ie("MenuTrigger"),vl=ie("Popover"),yl=ie("PopoverPopup"),xl=ie("PopoverTrigger"),tS=ie("Table"),nS=ie("TableBody"),fi=ie("TableCell"),ds=ie("TableHead"),oS=ie("TableHeader"),Of=ie("TableRow"),Ye=ie("Tooltip"),Je=ie("TooltipPopup"),Ze=ie("TooltipTrigger"),rS=ie("Collapsible"),aS=ie("CollapsiblePanel"),iS=ie("CollapsibleTrigger"),cc=ie("Alert"),uc=ie("AlertAction"),Ff=ie("AlertDescription"),Th=ie("AlertTitle"),Bf=ie("Kbd"),zf=ie("Command"),Uf=ie("CommandGroup"),Hf=ie("CommandItem"),$f=ie("CommandList"),sS=ie("Combobox"),lS=ie("ComboboxEmpty"),dS=ie("ComboboxInput"),Cl=ie("ComboboxItem"),cS=ie("ComboboxListVirtualized"),uS=ie("TooltipProvider"),fS=ie("StyledDiffCodeView"),pS=ie("DevBackdropArt"),ir=ie("Markdown"),mS=ie("DiffView");var{jsx:u,jsxs:b,Fragment:Te}=window.__ycodiumPluginHost.jsxRuntime;function gS({mode:e,onModeChange:t}){let{t:n}=xe();return b(Ww,{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 hS({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})})}pe();function Jn(){return{t:or().i18n.usePluginTranslation()}}function vS(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 yS(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 H2=me(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 $2({totals:e}){let{t}=Jn();if(!e)return null;let n=vS(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 K2=me(function({getText:t,size:n="xs",variant:o="outline",className:r}){let{t:a}=Jn(),i=or().writeClipboard,[s,l]=J(!1),d=a("turnNavigator.copyMarkdown");return b(Ye,{children:[u(Ze,{render:u(de,{"aria-label":d,disabled:s,onClick:()=>{i(t()).then(()=>{l(!0),window.setTimeout(()=>l(!1),1e3)})},type:"button",size:n,variant:o,className:H("text-muted-foreground hover:text-foreground",r)}),children:s?u(go,{className:"size-3 text-primary"}):u(Xi,{className:"size-3"})}),u(Je,{children:u("p",{children:d})})]})});function xS({items:e,totalTurnCount:t,bottomInset:n,usageByTurnId:o,onSelect:r,exportMarkdown:a,onDownload:i,placement:s="float"}){let{t:l}=Jn(),[d,c]=J(!1),f=V(()=>e.map((h,v)=>({item:h,ordinal:v+1})).reverse(),[e]),p=V(()=>yS(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(vl,{onOpenChange:c,open:d,children:[b(xl,{render:u(de,{"aria-label":g,className:H("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(yl,{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:H("min-h-0 flex-1 overflow-y-auto overflow-x-hidden p-1"),children:f.map(({item:h,ordinal:v})=>u(H2,{item:h,onSelect:y=>{c(!1),r(y)},ordinal:v,usage:h.turnId===null?void 0:o.get(h.turnId)},h.sectionKey))}),u($2,{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(K2,{size:"icon-xs",getText:a,variant:"ghost"}),u(de,{"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(de,{"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"})})]})]})})]})}pe();pe();function V2(e){return e!==null&&"tagName"in e&&"closest"in e}function pi(e){return V2(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 CS(e,t){let n=e.findIndex(o=>o.decision===t);return n===-1?null:{type:"respond",index:n}}function bS(e,t){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return null;switch(e.key){case"Enter":return CS(t,"accept");case"Escape":return CS(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}}}}pe();var bl=new Map,wS=24,q2=4e3,W2=1024,SS=16384;function Lh(e){let t=bl.get(e);if(t)return t;let n={values:new Map,listeners:new Set,stringLength:0};if(bl.set(e,n),bl.size>wS){for(let[o,r]of bl)if(r.listeners.size===0&&o!==e&&(bl.delete(o),bl.size<=wS))break}return n}function Ph(e,t,n){return Lh(e).values.get(t)??n}function pc(e,t,n,o=!0){let r=Lh(e);if(typeof n=="string"&&(n=n.slice(0,W2)),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>SS){for(let[i,s]of r.values)if(!(typeof s!="string"||i===t)&&(r.values.delete(i),r.stringLength-=s.length,r.stringLength<=SS))break}if(r.values.size>q2){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 $o(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=Bo(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 IS(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 TS(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)}pe();pe();function Ah(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 G2(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 kS(e,t){let n=0,o=e;for(;o&&o!==t;)n+=o.offsetTop,o=o.offsetParent;return n}var Eh=class extends ka{getSnapshotBeforeUpdate(t){return t.inputKey!==this.props.inputKey&&t.onBeforeInputChange(),null}componentDidUpdate(){}componentWillUnmount(){this.props.onBeforeInputChange()}render(){return this.props.children}};function LS({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]),nr(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:kS(h,m)},heightOf:g=>{let h=Ah(m,g);return h===null?null:h.offsetHeight},rowAtScroll:()=>G2(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,kS(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(ic,{value:f,children:u("div",{ref:p,className:r,style:{position:"relative"},onScroll:i,children:a})})})}function Sl(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 wl(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=wl(n.startContainer,e),a=wl(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}pe();function mi(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]),V(()=>({request:l,cancel:d}),[l,d])}function PS({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=mi(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 k=C;k<x.length;k+=1){let E=x[k];if(E.getBoundingClientRect().top>=y)break;E.dataset.timelineTurnSection!==void 0&&w.push(E.dataset.timelineTurnSection)}let L=[...g.interactionRows()],S=e.ownerDocument.activeElement;if(Sl(S)){let k=wl(S,e);k&&L.push(k)}let T=Vf({index:g.index,visibleSectionKeys:w,protectedRowIds:L,selectionRows:qf(e)}),I=`${g.inputKey}:${JSON.stringify(T)}`;I!==f.current&&(f.current=I,g.onRangeChange?.(T))},[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}pe();function Ea(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 j2(e,t){let n={hour:"numeric",minute:"2-digit",...t?{second:"2-digit"}:{}};return e==="locale"?n:{...n,hour12:e==="12-hour"}}function Q2(e){let t=e?.trim();if(t)try{return Intl.DateTimeFormat.supportedLocalesOf([t]),t}catch{return}}function X2(){return typeof window>"u"?null:window.desktopBridge?.getSystemLocale?.()??null}var Rh=Q2(X2()),AS=new Map;function ES(e,t){let n=`${e}:${t?"seconds":"minutes"}`,o=AS.get(n);if(o)return o;let r=new Intl.DateTimeFormat(Rh,j2(e,t));return AS.set(n,r),r}function Mh(e){let t=new Date(e);return Number.isNaN(t.getTime())?null:t}var Y2=new Intl.DateTimeFormat(void 0,{month:"long"});function J2(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 Z2(e,t){let n=Mh(e);return n?ES(t,!1).format(n):""}function da(e,t){let n=Mh(e);if(!n)return"";let o=Z2(e,t),r=n.getDate(),a=Y2.format(n),i=n.getFullYear();return`${o}, ${r}${J2(r)} ${a} ${i}`}var eB=new Intl.DateTimeFormat(Rh,{month:"numeric",day:"numeric"}),tB=new Intl.DateTimeFormat(Rh,{month:"numeric",day:"numeric",year:"numeric"});function gi(e,t,n,o=Date.now()){let r=Mh(e);if(!r)return"";let a=ES(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()?eB:tB).format(r)} ${a}`}pe();pe();var Il=class extends Error{reason;constructor(t,n,o){super(n,o),this.reason=t}};function nB(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 oB(e,t){let n=()=>new Il("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(nB(e))return!0;throw n()}try{return await navigator.clipboard.writeText(e),!0}catch(o){throw new Il("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)=>{oB(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 G(()=>()=>{i.current&&clearTimeout(i.current)},[]),{copyToClipboard:f,isCopied:r}}function ut(){let e=or().i18n.usePluginTranslation();return{t:(t,n)=>e(t,n)}}var RS=1e3,rB={unavailable:"copyButton.clipboardUnavailable","write-failed":"copyButton.copyFailedDetail"};function aB({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 Tl=me(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),RS))};G(()=>()=>{c.current&&clearTimeout(c.current)},[]);let{copyToClipboard:p,isCopied:m}=Wf({onCopy:()=>f(i("copyButton.copied")),onError:g=>f(i("copyButton.failedToCopy"),g instanceof Il?i(rB[g.reason]):g.message),timeout:RS});return b(Ye,{children:[u(Ze,{render:u(de,{"aria-label":i("copyButton.copyToClipboard"),disabled:m,onClick:()=>p(t),ref:s,type:"button",size:n,variant:o,className:H("text-muted-foreground hover:text-foreground",r)}),children:m?u(go,{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(aB,{title:l.title,description:l.description})})}):null]})});function iB(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 MS=me(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(go,{className:"size-icon-1 text-success","aria-hidden":!0}):a==="error"?u(nn,{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:da(t.completedAt,n),children:u("time",{dateTime:t.completedAt,children:gi(t.completedAt,n,r)})}):null,t.workingElapsedMs!==void 0?b(Gf,{label:r("timeline.workingTime",{duration:Ea(t.workingElapsedMs)}),children:[u("span",{"aria-hidden":!0,children:"\xB7 "}),Ea(t.workingElapsedMs)]}):null,t.outputTokens!==void 0?b(Gf,{label:`${r("timeline.outputTokens")}: ${t.outputTokens.toLocaleString()}`,children:[u("span",{"aria-hidden":!0,children:"\xB7 "}),iB(t.outputTokens)]}):null]}),o?u(Tl,{text:o,variant:"ghost",size:"icon-xs",className:"shrink-0",toastAnchor:"below"}):null]})});pe();pe();function NS(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 _S=me(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(Te,{children:[a&&u("span",{className:"text-muted-foreground/70",children:"("}),b("span",{role:"group","aria-label":l,className:H(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-success",children:["+",NS(n)]}),b("span",{"aria-hidden":"true",className:"font-mono text-destructive",children:["-",NS(o)]})]}),a&&u("span",{className:"text-muted-foreground/70",children:")"})]})});function sB(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 DS(e){return e.replaceAll("\\","/")}function OS(e){return/^\/[A-Za-z]:\//.test(e)?e.slice(1):e}function lB(e){return e.replace(/[\\/]+$/,"")}function dB(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 uB(e){return e.startsWith("/")||/^[A-Za-z]:\//.test(e)}function jf(e,t){let{path:n,line:o,column:r}=sB(e),a=OS(DS(n)),i=a;if(t){let s=OS(DS(lB(t))),l=dB(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(!uB(a)){let m=cB(a);i=d.startsWith(p)?a:`${l}/${m}`}}return o?`${i}:${o}${r?`:${r}`:""}`:i}function FS(e){return e==="failed"?"failed":e==="running"?"running":"idle"}function BS(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:H("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:H("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(go,{className:t,"aria-hidden":!0});case"circle-alert":return u(Bn,{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(Po,{className:t,"aria-hidden":!0});case"terminal":return u(Uo,{className:t,"aria-hidden":!0});case"wrench":return u(ac,{className:t,"aria-hidden":!0});case"x":return u(nn,{className:t,"aria-hidden":!0});case"zap":return u(ls,{className:t,"aria-hidden":!0})}}function fB(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:fB(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 kl=20;function Ll(e){return Kf(e)}function zS(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 US({entry:e,failed:t}){let n=e.toolLabel?.diffStat;return!n||t||Dh(e)?null:u(_S,{...n,layout:"inline",className:"chat-process-meta ms-2 shrink-0"})}function Dh(e){return e.toolLifecycleStatus==="declined"||e.toolLifecycleStatus==="stopped"}function HS({toolIcon:e,glyphClassName:t}){let n=St(gn),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 pB({entry:e,failed:t=!1,derive:n}){return t?u(Bn,{"aria-hidden":!0,className:"size-icon-1 shrink-0 text-destructive"}):e.toolIcon!==void 0?u(HS,{toolIcon:e.toolIcon,glyphClassName:"size-icon-1 shrink-0 stroke-[1.8] text-muted-foreground opacity-70"}):u(vc,{name:_h([e],n.toolGroupAction),className:"size-icon-1 shrink-0 stroke-[1.8] text-muted-foreground opacity-70"})}function mB({entries:e,failed:t,derive:n}){let{t:o}=ut(),r=V(()=>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(vc,{name:s,className:H("size-icon-1 shrink-0 stroke-[1.8] opacity-70",t?"text-destructive":"text-icon-muted")}),l]},i))})}function $S({entry:e}){let t=St(gn),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(Te,{children:r}):u("pre",{className:"chat-tool-body overflow-x-auto rounded-md bg-muted/40 p-2",children:n??""})})}var gB=me(function(t){let{entry:n,threadKey:o,workspaceRoot:r,onDisclosureChange:a}=t,s=St(gn).derive,{t:l}=ut(),[d,c]=$o(o,`call:${Ll(n)}`,!1),f=s.workEntryIndicatesFailure(n),p=Dh(n),m=s.resolveWorkEntryStatus(n),g=m==="failed"||m==="running"?m:null,h=oa();return b("div",{"data-tool-call-id":n.toolCallId??n.id,"data-tool-identity":Ll(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:H("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(pB,{entry:n,failed:f,derive:s})}),b("span",{className:"flex min-w-0 flex-1 items-center",children:[u("span",{className:"truncate",children:zS(n,r,s)??l("toolGroup.calls",{count:1})}),u(US,{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(un,{"aria-hidden":!0,className:H("size-icon-1 shrink-0",!d&&"-rotate-90")})]}),d?u("div",{id:h,children:u($S,{entry:n})}):null]})});function hB({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=()=>{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 KS=me(function({entries:t,groupId:n,threadKey:o,workspaceRoot:r,onDisclosureChange:a}){let s=St(gn).derive,{t:l}=ut(),[d,c]=$o(o,`group:${n}`,!1),[f,p]=$o(o,`group-page:${n}`,0),m=oa(),g=N(null),[h,v]=J(null),y=t.at(-1),x=V(()=>t.filter(X=>s.workEntryIndicatesFailure(X)),[t,s]),C=V(()=>t.filter(Dh),[t]),w=t.filter(X=>X.toolLifecycleStatus==="inProgress").length,L=x[0]??C[0],S=L??y,T=Math.max(0,Math.ceil(t.length/kl)-1),I=Math.min(f,T),k=I*kl,E=t.slice(k,k+kl),P=t.length>1;if(he(()=>{if(!h)return;let X=g.current,Se=Array.from(X?.querySelectorAll("[data-tool-identity]")??[]).find(W=>W.dataset.toolIdentity===h.id);if(!Se)return;let K=Se.closest('[data-slot="scroll-area-viewport"]');K&&(K.scrollTop+=Se.getBoundingClientRect().top-K.getBoundingClientRect().top),Se.querySelector("button")?.focus({preventScroll:!0})},[h]),!y||!S)return null;let _=X=>{a?.(),p(X)},A={threadKey:o,workspaceRoot:r,onDisclosureChange:a},B=BS(t.map(X=>FS(s.resolveWorkEntryStatus(X)))),z=_h(t,s.toolGroupAction),q=B==="failed"?"failed":B==="running"?"running":"success";return u(Xf,{state:B,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:${Ll(y)}`,!0)},className:H(Qf,"flex-1",L?"text-destructive":"text-muted-foreground"),children:[u(hc,{status:q}),u(gc,{children:!P&&y.toolIcon!==void 0&&x.length===0?u(HS,{toolIcon:y.toolIcon,glyphClassName:"size-icon-1 shrink-0 stroke-[1.8] opacity-70 text-icon-muted"}):u(vc,{name:z,className:H("size-icon-1 shrink-0 stroke-[1.8] opacity-70",x.length>0?"text-destructive":"text-icon-muted")})}),b("span",{className:H("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}):zS(S,r,s)??l("toolGroup.calls",{count:1})}),d&&P?null:u(US,{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(mB,{entries:t,failed:x.length>0,derive:s}),u(un,{"aria-hidden":!0,className:H("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)/kl)),pc(o,`call:${Ll(L)}`,!0),v({id:Ll(L)})},children:l("toolGroup.showFailure")}):null]}),d?u("div",{id:m,className:"border-t border-border/50",children:P?b(Te,{children:[t.length>kl?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:k+1,to:Math.min(k+kl,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===T,Icon:zo},{label:l("toolGroup.lastPage"),target:T,disabled:I===T,Icon:Ud}].map(({label:X,target:Se,disabled:K,Icon:W})=>u("button",{type:"button","aria-label":X,disabled:K,onClick:()=>_(Se),className:"flex size-7 items-center justify-center rounded-control-3 disabled:opacity-64 [@media(pointer:coarse)]:size-11",children:u(W,{"aria-hidden":!0,className:"size-icon-1"})},X))]}):null,u(hB,{threadKey:o,stateKey:`group-scroll:${n}:${I}`,maxHeight:"min(320px, 50dvh)",children:u("div",{className:"space-y-0.5 py-1",children:E.map(X=>u(gB,{entry:X,...A},Ll(X)))})})]}):u($S,{entry:y})}):null]})})});function vB(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 VS(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=vB(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}}}pe();var qS=me(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 yB(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 WS(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=yB(e,a.start,a.end),s=o.get(a.key);if(s!==void 0&&s.turnId===i&&xB(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 xB(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 GS(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)}pe();pe();var QS=100,CB=new Map,jS=new Map,Yf=e=>typeof e=="function"?e():e,XS=(e,t)=>typeof t=="function"?t(e):t;function bB(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 wB(e,t){let n=jS.get(e);return n===void 0&&(n={values:new Map,limit:Math.max(1,t)},jS.set(e,n)),n}function SB(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 YS(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(()=>SB(e))}function fn(e,t,n,o=QS){let r=Math.max(1,o),a=bB(CB,e,r),i=YS(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),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=Bo(s,l,l),c=R(f=>{if(!i.alive||a.values.get(t)!==i)return;let p=i.value,m=XS(p,f);if(!Object.is(m,p)){i.value=m,Oh(a,t,i);for(let g of i.subscribers)g();xc(a)}},[i,a,t]);return[d,c]}function JS(e,t){let n=N(null);(n.current===null||n.current.key!==e)&&(n.current={key:e,value:Yf(t)});let[,o]=La(a=>a+1,0),r=R(a=>{let i=n.current;if(i===null||i.key!==e)return;let s=XS(i.value,a);Object.is(s,i.value)||(i.value=s,o())},[e]);return[n.current.value,r]}function Nt(e,t,n,o=QS){let r=Math.max(1,o),a=wB(e,r),i=YS(a,t,()=>({current:Yf(n)}));return G(()=>{if(!(!i.alive||a.values.get(t)!==i))return a.limit=r,i.committed=!0,Oh(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 Ar(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,Fh=us;function ZS(e){let[t,n]=fn("timeline-reveal-window",e,us),o=R(()=>{n(s=>s+Fh)},[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}}var IB=400;function eI({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 x=e.querySelectorAll("[data-timeline-turn-section]"),C=e.getBoundingClientRect().top-32-n,w=0,L=Math.max(0,x.length-t);for(;w<L;){let T=Math.floor((w+L)/2),I=x[T].getBoundingClientRect().bottom;if(!Number.isFinite(I))return;I<=C?w=T+1:L=T}if(w===0)return;let S=a.activeElement;if(S&&Sl(S)){for(let T=0;T<w;T+=1)if(x[T].contains(S))return}r(x.length-w)},f=()=>{if(a.hidden||i.size>0||!o()||mc(e)){clearTimeout(s),s=void 0;return}s===void 0&&(s=setTimeout(c,IB))},p=()=>{clearTimeout(s),s=void 0,f()},m=()=>{let x=d();!x||!l?p():f(),l=x},g=x=>{i.add(x.pointerId),p()},h=x=>{i.delete(x.pointerId),p()},v=()=>{i.clear(),p()},y=["wheel","keydown","focusin","focusout"];for(let x of y)e.addEventListener(x,p,{passive:!0});return e.addEventListener("scroll",m,{passive:!0}),e.addEventListener("pointerdown",g,!0),a.addEventListener("pointerup",h,!0),a.addEventListener("pointercancel",h,!0),a.addEventListener("selectionchange",p),a.addEventListener("visibilitychange",f),a.defaultView?.addEventListener("blur",v),f(),{schedule:f,disconnect:()=>{clearTimeout(s);for(let x of y)e.removeEventListener(x,p);e.removeEventListener("scroll",m),e.removeEventListener("pointerdown",g,!0),a.removeEventListener("pointerup",h,!0),a.removeEventListener("pointercancel",h,!0),a.removeEventListener("selectionchange",p),a.removeEventListener("visibilitychange",f),a.defaultView?.removeEventListener("blur",v)}}}pe();function tI({root:e,topInsetPx:t,onActiveSectionChange:n,active:o}){let r=N(o);r.current=o;let a=mi(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 T=S.offsetTop;T<C&&(C=T,x=L),T<=h&&T>=y&&(y=T,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]);G(()=>{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 V(()=>({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(Te,{children:[e,t]}):b(Te,{children:[i[0],t,i[1]]})}pe();function nI(e){return Bo(e.subscribe,e.getStructure,e.getStructure)}function oI(e,t){let n=R(r=>e.subscribeRow(t,r),[e,t]),o=R(()=>e.getRow(t),[e,t]);return Bo(n,o,o)}function hi(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 Bo(e.subscribe,r,r)}pe();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 vi(e){if(e.type==="image")return"image";let t=e.mimeType.toLowerCase();return t==="application/pdf"?"pdf":t.startsWith("text/")||TB.has(t)?"text":"file"}var TB=new Set(["application/json","application/xml","application/x-yaml","application/yaml"]);function rI(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 kB="<ycodium-system>";function Jf(e){return e.startsWith(kB)}var LB=/[ \t]*\(record [^\s()]+\)/g,PB=/^<\/?[a-z][a-z-]*(?:\s[^>]*)?>$/;function zh(e){return Jf(e)?e.split(`
|
|
3713
|
-
`).filter(t=>!
|
|
3714
|
-
`).replace(
|
|
3734
|
+
`;ue();ue();var iw=Ct(null),sw=iw.Provider,lw=Ct(""),dw=lw.Provider;function vf(){return Ht(lw)}function sr(){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 XO=(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},YO=(e,t)=>({classGroupId:e,validator:t}),ww=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n});var gw=[],JO="arbitrary..",ZO=e=>{let t=tF(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:o}=e;return{getClassGroupId:i=>{if(i.startsWith("[")&&i.endsWith("]"))return eF(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?XO(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}},eF=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?JO+o:void 0})(),tF=e=>{let{theme:t,classGroups:n}=e;return nF(n,t)},nF=(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];oF(i,t,n,o)}},oF=(e,t,n,o)=>{if(typeof e=="string"){rF(e,t,n);return}if(typeof e=="function"){aF(e,t,n,o);return}iF(e,t,n,o)},rF=(e,t,n)=>{let o=e===""?t:Iw(t,e);o.classGroupId=n},aF=(e,t,n,o)=>{if(sF(e)){Ch(e(o),t,n,o);return}t.validators===null&&(t.validators=[]),t.validators.push(YO(n,e))},iF=(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},sF=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,lF=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 dF=[],hw=(e,t,n,o,r)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:o,isExternal:r}),cF=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(dF,!1,i,void 0,!0)}if(n){let r=o;o=a=>n({className:a,parseClassName:r})}return o},uF=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}},fF=e=>({cache:lF(e.cacheSize),parseClassName:cF(e),sortModifiers:uF(e),postfixLookupClassGroupIds:pF(e),...ZO(e)}),pF=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},mF=/\s+/,gF=(e,t)=>{let{parseClassName:n,getClassGroupId:o,getConflictingClassGroupIds:r,sortModifiers:a,postfixLookupClassGroupIds:i}=t,s=[],l=e.trim().split(mF),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 T=h.substring(0,v);x=o(T);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 T=0;T<S.length;++T){let I=S[T];s.push(w+I)}d=f+(d.length>0?" "+d:d)}return d},hF=(...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=fF(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=gF(l,n);return r(l,c),c};return a=i,(...l)=>a(hF(...l))},vF=[],_n=e=>{let t=n=>n[e]||vF;return t.isThemeGetter=!0,t},kw=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Lw=/^\((?:(\w[\w-]*):)?(.+)\)$/i,yF=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,xF=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,CF=/\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$/,bF=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,wF=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,SF=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ri=e=>yF.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)),Ta=e=>xF.test(e),Pw=()=>!0,IF=e=>CF.test(e)&&!bF.test(e),bh=()=>!1,TF=e=>wF.test(e),kF=e=>SF.test(e),LF=e=>!Oe(e)&&!Fe(e),PF=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)),AF=e=>ai(e,Rw,bh),Oe=e=>kw.test(e),ji=e=>ai(e,Mw,IF),yw=e=>ai(e,FF,mt),EF=e=>ai(e,_w,Pw),RF=e=>ai(e,Nw,bh),xw=e=>ai(e,Aw,bh),MF=e=>ai(e,Ew,kF),yf=e=>ai(e,Dw,TF),Fe=e=>Lw.test(e),_d=e=>Qi(e,Mw),NF=e=>Qi(e,Nw),Cw=e=>Qi(e,Aw),_F=e=>Qi(e,Rw),DF=e=>Qi(e,Ew),xf=e=>Qi(e,Dw,!0),OF=e=>Qi(e,_w,!0),ai=(e,t,n)=>{let o=kw.exec(e);return o?o[1]?t(o[1]):n(o[2]):!1},Qi=(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",FF=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"],T=()=>["auto","contain","none"],I=()=>[Fe,Oe,l],k=()=>[ri,"full","auto",...I()],E=()=>[Zr,"none","subgrid",Fe,Oe],P=()=>["auto",{span:["full",Zr,Fe,Oe]},Zr,Fe,Oe],_=()=>[Zr,"auto",Fe,Oe],A=()=>["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(),Cw,xw,{position:[Fe,Oe]}],G=()=>["no-repeat",{repeat:["","x","y","space","round"]}],te=()=>["auto","cover","contain",_F,AF,{size:[Fe,Oe]}],me=()=>[yh,_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,yh,Cw,xw],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:[Pw],container:[Ta],"drop-shadow":[Ta],ease:["in","out","in-out"],font:[LF],"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":[PF],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:T()}],"overscroll-x":[{"overscroll-x":T()}],"overscroll-y":[{"overscroll-y":T()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:k()}],"inset-x":[{"inset-x":k()}],"inset-y":[{"inset-y":k()}],start:[{"inset-s":k(),start:k()}],end:[{"inset-e":k(),end:k()}],"inset-bs":[{"inset-bs":k()}],"inset-be":[{"inset-be":k()}],top:[{top:k()}],right:[{right:k()}],bottom:[{bottom:k()}],left:[{left:k()}],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":E()}],"col-start-end":[{col:P()}],"col-start":[{"col-start":_()}],"col-end":[{"col-end":_()}],"grid-rows":[{"grid-rows":E()}],"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":A()}],"auto-rows":[{"auto-rows":A()}],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,OF,EF]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",yh,Oe]}],"font-family":[{font:[NF,RF,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,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]},DF,MF]}],"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,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"]}},BF=(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),xh(e,r,"postfixLookupClassGroups"),xh(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)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(()=>BF(bw(),e),...t);var zF=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 zF(mw(e))}ue();var wf=Ct(!0);function Fw(){return bt(wf)}var wh=Ct(void 0);function ea(){let e=bt(wf);return bt(wh)??e}ue();var Sf=(...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:Sf("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:Sf(`lucide-${Bw(Sh(e))}`,`lucide-${e}`,o),...r}));return n.displayName=Sh(e),n};var UF=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],Dd=Z("arrow-down",UF);var HF=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],Od=Z("arrow-up-right",HF);var $F=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Fd=Z("arrow-up",$F);var KF=[["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",KF);var VF=[["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",VF);var qF=[["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",qF);var WF=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],ho=Z("check",WF);var GF=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],sn=Z("chevron-down",GF);var jF=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Yi=Z("chevron-left",jF);var QF=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Vo=Z("chevron-right",QF);var XF=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],zd=Z("chevron-up",XF);var YF=[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]],Ud=Z("chevrons-left",YF);var JF=[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]],Hd=Z("chevrons-right",JF);var ZF=[["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",ZF);var e2=[["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",e2);var t2=[["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",t2);var n2=[["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",n2);var o2=[["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",o2);var r2=[["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",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"}]],Kd=Z("file",a2);var i2=[["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",i2);var s2=[["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",s2);var l2=[["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",l2);var d2=[["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",d2);var c2=[["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",c2);var u2=[["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",u2);var f2=[["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",f2);var p2=[["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",p2);var m2=[["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",m2);var g2=[["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",g2);var h2=[["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",h2);var v2=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],si=Z("loader-circle",v2);var y2=[["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",y2);var x2=[["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",x2);var C2=[["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",C2);var b2=[["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",b2);var w2=[["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",w2);var S2=[["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",S2);var I2=[["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",I2);var T2=[["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",T2);var k2=[["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",k2);var L2=[["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",L2);var P2=[["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",P2);var A2=[["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",A2);var E2=[["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",E2);var R2=[["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",R2);var M2=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],ls=Z("search",M2);var N2=[["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",N2);var _2=[["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",_2);var D2=[["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",D2);var O2=[["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",O2);var F2=[["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",F2);var B2=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],rc=Z("square",B2);var z2=[["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",z2);var U2=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],qo=Z("terminal",U2);var H2=[["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",H2);var $2=[["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",$2);var K2=[["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",K2);var V2=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],en=Z("x",V2);var q2=[["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",q2);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 Kw=new Set(["Select","AlertDialog","Dialog","DropdownMenu","Menu","Popover","Tooltip","Combobox"]);function le(e){let t=Kw.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,...Kw.has(e)&&!i?{open:!1}:{},className:`${a} ${typeof o.className=="string"?o.className:""}`})};return n.displayName=e,n}var fY=le("useLinkContextMenu"),Tr=le("ProviderInstanceIcon"),Vw=le("UserAvatar"),yl=le("Badge"),ce=le("Button"),pY=le("Label"),Tf=le("Input"),qw=le("Textarea"),mY=le("Switch"),gY=le("Separator"),hY=le("Skeleton"),kf=le("Spinner"),vY=le("ScrollArea"),yY=le("Card"),xY=le("CardAction"),CY=le("CardContent"),bY=le("CardDescription"),wY=le("CardFooter"),SY=le("CardHeader"),IY=le("CardTitle"),TY=le("Empty"),kY=le("EmptyContent"),LY=le("EmptyDescription"),PY=le("EmptyHeader"),AY=le("EmptyMedia"),EY=le("EmptyTitle"),RY=le("InputGroup"),MY=le("InputGroupAddon"),NY=le("InputGroupInput"),_Y=le("DocumentPanel"),DY=le("MasterDetail"),Lf=le("Select"),OY=le("SelectContent"),Pf=le("SelectItem"),Af=le("SelectPopup"),Ww=le("SelectTrigger"),Ef=le("SelectValue"),dc=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"),Rf=le("Dialog"),FY=le("DialogClose"),Mf=le("DialogDescription"),Nf=le("DialogFooter"),_f=le("DialogHeader"),Df=le("DialogPopup"),tS=le("DialogPanel"),Of=le("DialogTitle"),BY=le("DialogTrigger"),zY=le("DropdownMenu"),UY=le("DropdownMenuContent"),HY=le("DropdownMenuItem"),$Y=le("DropdownMenuTrigger"),Eo=le("Menu"),cc=le("MenuGroup"),KY=le("MenuGroupLabel"),dr=le("MenuItem"),Ro=le("MenuPopup"),kr=le("MenuRadioGroup"),Wo=le("MenuRadioItem"),ci=le("MenuSeparator"),Mo=le("MenuTrigger"),xl=le("Popover"),Cl=le("PopoverPopup"),bl=le("PopoverTrigger"),nS=le("Table"),oS=le("TableBody"),ui=le("TableCell"),us=le("TableHead"),rS=le("TableHeader"),Ff=le("TableRow"),Ye=le("Tooltip"),Je=le("TooltipPopup"),Ze=le("TooltipTrigger"),aS=le("Collapsible"),iS=le("CollapsiblePanel"),sS=le("CollapsibleTrigger"),uc=le("Alert"),fc=le("AlertAction"),Bf=le("AlertDescription"),Ih=le("AlertTitle"),zf=le("Kbd"),Uf=le("Command"),Hf=le("CommandGroup"),$f=le("CommandItem"),Kf=le("CommandList"),lS=le("Combobox"),dS=le("ComboboxEmpty"),cS=le("ComboboxInput"),wl=le("ComboboxItem"),uS=le("ComboboxListVirtualized"),fS=le("TooltipProvider"),pS=le("StyledDiffCodeView"),mS=le("DevBackdropArt"),cr=le("Markdown"),gS=le("DiffView");var{jsx:u,jsxs:b,Fragment:Le}=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(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 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:sr().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 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 W2=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 G2({totals:e}){let{t}=eo();if(!e)return null;let n=yS(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 j2=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 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(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(W2,{item:h,onSelect:y=>{c(!1),r(y)},ordinal:v,usage:h.turnId===null?void 0:o.get(h.turnId)},h.sectionKey))}),u(G2,{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(j2,{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 Q2(e){return e!==null&&"tagName"in e&&"closest"in e}function fi(e){return Q2(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 Sl=new Map,SS=24,X2=4e3,Y2=1024,IS=16384;function kh(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>SS){for(let[o,r]of Sl)if(r.listeners.size===0&&o!==e&&(Sl.delete(o),Sl.size<=SS))break}return n}function Lh(e,t,n){return kh(e).values.get(t)??n}function mc(e,t,n,o=!0){let r=kh(e);if(typeof n=="string"&&(n=n.slice(0,Y2)),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>X2){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=kh(e);return l.listeners.add(s),()=>l.listeners.delete(s)},[e]),r=R(()=>Lh(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 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 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 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 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 J2(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 LS(e,t){let n=0,o=e;for(;o&&o!==t;)n+=o.offsetTop,o=o.offsetParent;return n}var Ah=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 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: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=Ph(m,g);return h===null?null:LS(h,m)},heightOf:g=>{let h=Ph(m,g);return h===null?null:h.offsetHeight},rowAtScroll:()=>J2(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(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 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=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 k=C;k<x.length;k+=1){let E=x[k];if(E.getBoundingClientRect().top>=y)break;E.dataset.timelineTurnSection!==void 0&&w.push(E.dataset.timelineTurnSection)}let L=[...g.interactionRows()],S=e.ownerDocument.activeElement;if(Tl(S)){let k=Il(S,e);k&&L.push(k)}let T=qf({index:g.index,visibleSectionKeys:w,protectedRowIds:L,selectionRows:Wf(e)}),I=`${g.inputKey}:${JSON.stringify(T)}`;I!==f.current&&(f.current=I,g.onRangeChange?.(T))},[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 Z2(e,t){let n={hour:"numeric",minute:"2-digit",...t?{second:"2-digit"}:{}};return e==="locale"?n:{...n,hour12:e==="12-hour"}}function eB(e){let t=e?.trim();if(t)try{return Intl.DateTimeFormat.supportedLocalesOf([t]),t}catch{return}}function tB(){return typeof window>"u"?null:window.desktopBridge?.getSystemLocale?.()??null}var Eh=eB(tB()),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,Z2(e,t));return ES.set(n,r),r}function Rh(e){let t=new Date(e);return Number.isNaN(t.getTime())?null:t}var nB=new Intl.DateTimeFormat(void 0,{month:"long"});function oB(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 rB(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=rB(e,t),r=n.getDate(),a=nB.format(n),i=n.getFullYear();return`${o}, ${r}${oB(r)} ${a} ${i}`}var aB=new Intl.DateTimeFormat(Eh,{month:"numeric",day:"numeric"}),iB=new Intl.DateTimeFormat(Eh,{month:"numeric",day:"numeric",year:"numeric"});function mi(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()?aB:iB).format(r)} ${a}`}ue();ue();var kl=class extends Error{reason;constructor(t,n,o){super(n,o),this.reason=t}};function sB(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 lB(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(sB(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)=>{lB(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 MS=1e3,dB={unavailable:"copyButton.clipboardUnavailable","write-failed":"copyButton.copyFailedDetail"};function cB({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),MS))};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(dB[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(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(cB,{title:l.title,description:l.description})})}):null]})});function uB(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 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(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 "}),uB(t.outputTokens)]}):null]}),o?u(Ll,{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(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-success",children:["+",_S(n)]}),b("span",{"aria-hidden":"true",className:"font-mono text-destructive",children:["-",_S(o)]})]}),a&&u("span",{className:"text-muted-foreground/70",children:")"})]})});function fB(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 pB(e){return e.replace(/[\\/]+$/,"")}function mB(e){let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t>=0?e.slice(t+1):e}function gB(e){return e.replace(/^\.\/+/,"").replace(/^\/+/,"")}function hB(e){return e.startsWith("/")||/^[A-Za-z]:\//.test(e)}function Qf(e,t){let{path:n,line:o,column:r}=fB(e),a=FS(OS(n)),i=a;if(t){let s=FS(OS(pB(t))),l=mB(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(!hB(a)){let m=gB(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 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 vB(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:vB(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 Pl=20;function Al(e){return Vf(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?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 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=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 yB({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(yc,{name:Nh([e],n.toolGroupAction),className:"size-icon-1 shrink-0 stroke-[1.8] text-muted-foreground opacity-70"})}function xB({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(yc,{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=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 CB=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=_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":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(yB,{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(sn,{"aria-hidden":!0,className:$("size-icon-1 shrink-0",!d&&"-rotate-90")})]}),d?u("div",{id:h,children:u(KS,{entry:n})}):null]})});function bB({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=()=>{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 VS=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(_h),[t]),w=t.filter(Q=>Q.toolLifecycleStatus==="inProgress").length,L=x[0]??C[0],S=L??y,T=Math.max(0,Math.ceil(t.length/Pl)-1),I=Math.min(f,T),k=I*Pl,E=t.slice(k,k+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)},A={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(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($S,{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}):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(xB,{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:k+1,to:Math.min(k+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===T,Icon:Vo},{label:l("toolGroup.lastPage"),target:T,disabled:I===T,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(bB,{threadKey:o,stateKey:`group-scroll:${n}:${I}`,maxHeight:"min(320px, 50dvh)",children:u("div",{className:"space-y-0.5 py-1",children:E.map(Q=>u(CB,{entry:Q,...A},Al(Q)))})})]}):u(KS,{entry:y})}):null]})})});function wB(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=wB(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 SB(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=SB(e,a.start,a.end),s=o.get(a.key);if(s!==void 0&&s.turnId===i&&IB(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 IB(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 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 XS=100,TB=new Map,QS=new Map,Jf=e=>typeof e=="function"?e():e,YS=(e,t)=>typeof t=="function"?t(e):t;function kB(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 LB(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 PB(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:Jf(n),subscribers:new Set,leases:0,alive:!0,committed:!1},e.values.set(t,o)),o}function Cc(e){queueMicrotask(()=>PB(e))}function ln(e,t,n,o=XS){let r=Math.max(1,o),a=kB(TB,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),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=YS(p,f);if(!Object.is(m,p)){i.value=m,Dh(a,t,i);for(let g of i.subscribers)g();Cc(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: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=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=LB(e,r),i=JS(a,t,()=>({current:Jf(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,Cc(a),()=>{i.leases=Math.max(0,i.leases-1),Cc(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:Jf(t)}}),n.current.ref}var ps=3,Oh=ps;function eI(e){let[t,n]=ln("timeline-reveal-window",e,ps),o=R(()=>{n(s=>s+Oh)},[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 AB=400;function tI({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 x=e.querySelectorAll("[data-timeline-turn-section]"),C=e.getBoundingClientRect().top-32-n,w=0,L=Math.max(0,x.length-t);for(;w<L;){let T=Math.floor((w+L)/2),I=x[T].getBoundingClientRect().bottom;if(!Number.isFinite(I))return;I<=C?w=T+1:L=T}if(w===0)return;let S=a.activeElement;if(S&&Tl(S)){for(let T=0;T<w;T+=1)if(x[T].contains(S))return}r(x.length-w)},f=()=>{if(a.hidden||i.size>0||!o()||gc(e)){clearTimeout(s),s=void 0;return}s===void 0&&(s=setTimeout(c,AB))},p=()=>{clearTimeout(s),s=void 0,f()},m=()=>{let x=d();!x||!l?p():f(),l=x},g=x=>{i.add(x.pointerId),p()},h=x=>{i.delete(x.pointerId),p()},v=()=>{i.clear(),p()},y=["wheel","keydown","focusin","focusout"];for(let x of y)e.addEventListener(x,p,{passive:!0});return e.addEventListener("scroll",m,{passive:!0}),e.addEventListener("pointerdown",g,!0),a.addEventListener("pointerup",h,!0),a.addEventListener("pointercancel",h,!0),a.addEventListener("selectionchange",p),a.addEventListener("visibilitychange",f),a.defaultView?.addEventListener("blur",v),f(),{schedule:f,disconnect:()=>{clearTimeout(s);for(let x of y)e.removeEventListener(x,p);e.removeEventListener("scroll",m),e.removeEventListener("pointerdown",g,!0),a.removeEventListener("pointerup",h,!0),a.removeEventListener("pointercancel",h,!0),a.removeEventListener("selectionchange",p),a.removeEventListener("visibilitychange",f),a.defaultView?.removeEventListener("blur",v)}}}ue();function nI({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 T=S.offsetTop;T<C&&(C=T,x=L),T<=h&&T>=y&&(y=T,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 oI(e){return Ko(e.subscribe,e.getStructure,e.getStructure)}function rI(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 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 hi(e){if(e.type==="image")return"image";let t=e.mimeType.toLowerCase();return t==="application/pdf"?"pdf":t.startsWith("text/")||EB.has(t)?"text":"file"}var EB=new Set(["application/json","application/xml","application/x-yaml","application/yaml"]);function aI(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 RB="<ycodium-system>";function Zf(e){return e.startsWith(RB)}var MB=/[ \t]*\(record [^\s()]+\)/g,NB=/^<\/?[a-z][a-z-]*(?:\s[^>]*)?>$/;function Bh(e){return Zf(e)?e.split(`
|
|
3735
|
+
`).filter(t=>!NB.test(t.trim())).join(`
|
|
3736
|
+
`).replace(MB,""):e}var _B=/<ycodium-system>[\s\S]*?<\/ycodium-system>/g;function iI(e){let t=e.match(_B);return t&&t.length>0?t:[e]}function sI(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 lI(e){switch(e){case"image":return ts;case"pdf":return es;case"text":return Zi;case"file":return vo}}var DB=[".m4v",".mov",".mp4",".ogv",".webm"],OB=[".aac",".flac",".m4a",".mp3",".oga",".ogg",".opus",".wav",".weba"];function dI(e){let t=e.name.lastIndexOf(".");if(t<=0)return null;let n=e.name.slice(t).toLowerCase();return DB.includes(n)?"video":OB.includes(n)?"audio":null}var FB=/\n*<element_context>\n([\s\S]*?)\n<\/element_context>\s*$/;function wc(e){let t=FB.exec(e);if(!t)return{promptText:e,contextCount:0,contexts:[]};let n=e.slice(0,t.index).replace(/\n+$/,""),o=BB(t[1]??"");return{promptText:n,contextCount:o.length,contexts:o}}function BB(e){let t=[],n=null,o=()=>{n&&(t.push({header:n.header,body:n.bodyLines.join(`
|
|
3715
3737
|
`).trimEnd()}),n=null)};for(let r of e.split(`
|
|
3716
|
-
`)){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
|
|
3717
|
-
`),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
|
|
3718
|
-
`)}function
|
|
3719
|
-
`)}var
|
|
3738
|
+
`)){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 zB=/\n*<preview_annotation>\n((?:(?!<preview_annotation>)[\s\S])*)\n<\/preview_annotation>\s*$/;function zh(e){let t=zB.exec(e);if(!t)return{promptText:e,annotation:null};let n=t[1]??"",o=n.split(`
|
|
3739
|
+
`),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 UB=/<review_comment\b([^>]*)>\s*([\s\S]*?)<\/review_comment>/g,HB=/([a-zA-Z][a-zA-Z0-9_-]*)="([^"]*)"/g,$B=/(`{3,})([^\s`]*)[^\n]*\n([\s\S]*?)\n\1/g;function KB(e){return e.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/&/g,"&")}function VB(e){let t={};for(let n of e.matchAll(HB))t[n[1]]=KB(n[2]??"");return t}function cI(e){return e===void 0||!/^\d+$/.test(e)?null:Number(e)}function qB(e){let n=Array.from(e.matchAll($B)).at(-1),o=n?.index;return{text:e.slice(0,o??e.length).trim(),language:n?.[2]?.trim()||"diff",contents:n?.[3]??""}}function WB(e,t,n){let o=VB(e),r=cI(o.startIndex),a=cI(o.endIndex),i=o.filePath?.trim(),s=o.sectionId?.trim();if(!i||!s||r===null||a===null)return null;let l=qB(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(UB)){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=WB(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 uI(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(`
|
|
3740
|
+
`)}function fI(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(`
|
|
3741
|
+
`)}var GB="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",jB=`${GB} border border-border/70 bg-accent/40 text-foreground`,ep=`${jB} text-[12px]`,tp="block size-[1.17em] shrink-0 self-center opacity-85 [&>svg]:block",np="truncate leading-tight",pI='<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 QB=/(^|\s)\$([a-zA-Z][a-zA-Z0-9:_-]*)(?=\s|$)/g;function XB(e){return e.split(/[\s_-]+/).filter(t=>t.length>0).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}function YB(e){let t=e.displayName?.trim();return t||XB(e.name)}function mI(e){let t=[],n=0;for(let o of e.text.matchAll(QB)){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(JB,{skill:l,rawText:s},`${i}:${a}`)),n=i+s.length)}return n===0?u(Le,{children:e.text}):(n<e.text.length&&t.push(e.text.slice(n)),u(Le,{children:t}))}function JB(e){return u("span",{className:"inline-flex align-middle leading-none","data-markdown-copy":e.rawText,children:b("span",{className:$(ep,"border-fuchsia-500/25 bg-fuchsia-500/12 text-fuchsia-700 dark:text-fuchsia-300"),children:[u("span",{"aria-hidden":"true",className:tp,dangerouslySetInnerHTML:{__html:pI}}),u("span",{className:np,children:YB(e.skill)})]})})}function gI(e){let{label:t,tooltipText:n,expired:o=!1}=e;return b(Ye,{children:[b(Ze,{render:u("span",{className:$(ep,o&&"border-destructive/35 bg-destructive/8 text-destructive"),"data-terminal-context-expired":o?"true":void 0}),children:[u(qo,{className:$(tp,"size-icon-1",o&&"opacity-100")}),u("span",{className:np,children:t})]}),u(Je,{side:"top",className:"max-w-80 whitespace-pre-wrap leading-tight",children:n})]})}var ZB=/\n*<terminal_context>\n([\s\S]*?)\n<\/terminal_context>\s*$/;function ez(e){let t=[],n=null,o=()=>{n&&(t.push({header:n.header,body:n.bodyLines.join(`
|
|
3720
3742
|
`).trimEnd()}),n=null)};for(let r of e.split(`
|
|
3721
|
-
`)){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
|
|
3743
|
+
`)){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 tz(e){let t=ZB.exec(e);if(!t)return{promptText:e,contextCount:0,previewTitle:null,contexts:[]};let n=e.slice(0,t.index).replace(/\n+$/,""),o=ez(t[1]??"");return{promptText:n,contextCount:o.length,previewTitle:o.length>0?o.map(({header:r,body:a})=>a.length>0?`${r}
|
|
3722
3744
|
${a}`:r).join(`
|
|
3723
3745
|
|
|
3724
|
-
`):null,contexts:o}}function mI(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=bc(e),n=jB(t.promptText);return{visibleText:n.promptText,copyText:e,contextCount:n.contextCount,previewTitle:n.previewTitle,contexts:n.contexts,elementContexts:t.contexts}}var QB=/^(.*?)\s+line(?:s)?\s+(\d+)(?:-(\d+))?$/i;function gI(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=QB.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,"-")}`:mI({terminalLabel:n[1]?.trim()||"terminal",lineStart:o,lineEnd:r})}function hI(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 Kh({row:e}){let t=St(gn).derive;if(Jf(e.message.text)){let n=t.parsePresetPrefixText(e.message.text);return n?b(Te,{children:[u(JB,{parsed:n}),n.body.length>0||(e.message.attachments?.length??0)>0?u(Kh,{row:{...e,message:{...e.message,text:n.body}}}):null]}):u(ez,{row:e})}return u(XB,{row:e,text:e.message.text})}function Vh({images:e}){let t=St(gn),{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 XB({row:e,text:t}){let{t:n}=ut(),o=St(gn),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=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=>vi(v)==="image"),g=p.filter(v=>vi(v)!=="image"),h=e.message.author??null;return b("div",{className:"group flex min-w-0 items-start gap-2.5",children:[u(YB,{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:gi(e.message.createdAt,o.timestampFormat,n)}),u(Je,{children:da(e.message.createdAt,o.timestampFormat)})]}),b("div",{className:"ms-auto flex items-center gap-0.5",children:[o.onForkFromUserMessage!==null&&u(tz,{messageId:e.message.id,onFork:o.onForkFromUserMessage}),a.copyText&&u(Tl,{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(rz,{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(oz,{context:v},`${v.header}:${v.body}`))}):null,u(dz,{disclosureKey:`message:${e.message.id}:user`,text:d.promptText,terminalContexts:i,skills:o.skills,markdownCwd:o.markdownCwd})]})]})]})}function YB({author:e}){let t=e;return t!==null?u(Kw,{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(la,{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 JB({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 ZB={"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 ez({row:e}){let{t}=ut(),n=St(gn).derive,o=e.message.attachments??[],r=o.filter(l=>vi(l)==="image"),a=o.filter(l=>vi(l)!=="image"),i=l=>{let d=iI(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(ZB[f.kind],{title:f.title})}),f.summary.trim().length>0?u("p",{className:"mt-1 whitespace-pre-wrap",children:f.summary}):null]}):null},s=aI(e.message.text).map(i).filter(l=>l!==null);return s.length===0&&o.length===0?null:b(Te,{children:[s.map((l,d)=>u(ri,{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 xI(e,t){let n=t.parsePresetPrefixText(e??"")?.body??null;if(n===null&&Jf(e??""))return null;let r=$h(n??e??"").visibleText;for(;;){let s=Uh(r);if(!s.annotation)break;r=s.promptText}let a=bc(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 CI=34,bI=8,rp=CI+bI,wI=me(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:bI},"data-timeline-turn-header":"true","data-truncated":"false",children:b("div",{className:H("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:CI}},children:[u("span",{ref:n,className:H("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(de,{type:"button",size:"xs",variant:"ghost",className:"group-data-[truncated=false]:hidden","aria-label":s,onClick:a}),children:r?u(Bd,{}):u(un,{})}),u(Je,{side:"bottom",children:s})]})]})})});function tz({messageId:e,onFork:t}){let{t:n}=ut(),o=n("fork.action");return b(Ye,{children:[u(Ze,{render:u(de,{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 SI({row:e}){let t=St(gn),{t:n}=ut(),[o,r]=$o(t.threadKey,`message:${e.message.id}`,!1);if(e.presentation==="compact"&&!o)return u(Xf,{state:"idle",children:b("button",{type:"button",className:H(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(un,{className:"size-icon-1 shrink-0 -rotate-90","aria-hidden":!0})]})});let i=e.message.attachments??[],s=i.filter(c=>vi(c)==="image"),l=i.filter(c=>vi(c)!=="image"),d=e.message.text||(e.message.streaming||i.length>0?"":n("timeline.emptyResponse"));return u(Te,{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(Tl,{text:e.message.text,variant:"ghost"})]}):null,e.modelBadge?u(Wh,{badge:e.modelBadge,createdAt:e.message.createdAt}):null,u(ir,{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(nz,{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:gi(e.message.updatedAt,t.timestampFormat,n)}),u(Je,{children:da(e.message.updatedAt,t.timestampFormat)})]})]}):null]})})}function nz({row:e}){let n=St(gn).derive.resolveAssistantMessageCopyState({text:e.message.text??null,showCopyButton:e.showAssistantCopyButton,streaming:e.assistantCopyStreaming});return n.visible?u(Tl,{text:n.text??"",variant:"ghost"}):null}var vI=me(function(t){let n=t.context.body.length>0?`${t.context.header}
|
|
3725
|
-
${t.context.body}`:t.context.header;return u(
|
|
3726
|
-
${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(
|
|
3727
|
-
`).length>az}var dz=me(function(t){let n=St(gn),{t:o}=ut(),[r,a]=$o(n.threadKey,`${t.disclosureKey}:expanded`,!1),i=t.text.trim().length>0||t.terminalContexts.length>0,s=i&&lz(t.text),l=s&&!r;return b("div",{children:[i?u("div",{className:H("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:yI,maskImage:yI}:void 0,children:u(cz,{disclosureKey:t.disclosureKey,text:t.text,terminalContexts:t.terminalContexts,skills:t.skills,markdownCwd:t.markdownCwd})}):null,s||t.footer?b("div",{className:H("mt-1.5 flex items-center gap-2",s&&t.footer?"justify-between":"justify-end"),"data-user-message-footer":"true",children:[s?u(de,{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]})}),cz=me(function(t){let n=St(gn),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(ri,{children:[s?u("span",{"aria-hidden":"true",children:s}):null,c?u(ir,{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(ir,{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(uz,{comment:a.comment,disclosureKey:`${t.disclosureKey}:review-comment:${a.comment.id}`},a.comment.id))});if(t.terminalContexts.length>0){let a=hI(t.text,t.terminalContexts),i=gI(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(vI,{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(vI,{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(ir,{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(ir,{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 uz({comment:e,disclosureKey:t}){let n=St(gn),{t:o}=ut(),r=e.fenceLanguage??"diff",a=cI(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(fI,{text:e.text,skills:n.skills})}),r!=="diff"&&e.diff.trim().length>0&&u(ir,{disclosureKey:`${t}:fence`,text:dI(r,e.diff),cwd:n.markdownCwd,threadRef:n.threadRef??void 0,skills:n.skills,className:"text-message-foreground"}),a?u(mS,{patch:a}):null]})}function fz({badge:e}){return b(Te,{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(Lr,{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=St(gn),{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(fz,{badge:e}),u("span",{"aria-hidden":!0,children:"\xB7"}),b(Ye,{children:[u(Ze,{render:u("span",{className:"shrink-0 tabular-nums"}),children:gi(t,n.timestampFormat,o)}),u(Je,{children:da(t,n.timestampFormat)})]})]})}function II({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(Lr,{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,pz=/\s/u;function TI(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(pz.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 mz(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:TI(n.parseSystemNotificationText(r.text)?.summary??n.parseThreadHandoverText(r.text)?.body??r.text),assistantText:TI(a),headerText:r===null?null:xI(r.text,n)}}function gz(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 hz(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 vz(e,t,n){for(let o=0;o<e.length;o+=1)if(e[o]!==n[t.firstRowIndex+o])return!1;return!0}function yz(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 xz(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&&vz(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=mz(d.key,f,e),m={...p,turnId:gz(f)},g=c!==void 0&&hz(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&&yz(n.entries,i)?n.entries:i;return n={store:o,version:r,entries:l},l}}var kI=new WeakMap;function AI(e,t){let n=kI.get(e);return(n===void 0||n.derive!==t)&&(n={derive:t,read:xz(t)},kI.set(e,n)),n.read(e)}var LI=new WeakMap;function EI(e,t){let n=AI(e,t),o=LI.get(n);return o===void 0&&(o=n.flatMap(({summary:r})=>r.headerText===null?[]:[{sectionKey:r.sectionKey,text:r.headerText}]),LI.set(n,o)),o}function RI(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 PI=new WeakMap;function MI(e,t){let n=AI(e,t),o=PI.get(n);return o===void 0&&(o=n.filter(({summary:r})=>r.userText!==null).map(({item:r})=>r),PI.set(n,o)),o}function NI(e,t){return e===t?!0:e.length!==t.length?!1:e.every((n,o)=>n===t[o])}pe();var Cz=[],bz=e=>e.getMeta().usageByTurnId,wz=e=>e.getMeta().exportApi,_I=me(function({rowsStore:t,derive:n,paneVisible:o,totalTurnCount:r,bottomInset:a,onSelect:i,onTurnNavigatorChange:s}){let l=R(m=>o?MI(m,n):Cz,[n,o]),d=hi(t,l,NI),c=hi(t,bz),f=hi(t,wz),p=V(()=>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 G(()=>{p!==null&&s(p)},[s,p]),G(()=>{if(o)return()=>s(null)},[s,o]),null});pe();function DI(){let e=or(),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 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(`
|
|
3728
|
-
`)}function
|
|
3729
|
-
`))}function
|
|
3730
|
-
`}function
|
|
3731
|
-
`).length,E=t.length>900||k>20,P=jh(t),_=E?OI(t,d,{maxLines:10}):null,A=FI(t),B=BI(t),z=()=>{zI(A,B)},q=()=>{L(B)},X=()=>{if(!s){c.error(d("proposedPlan.workspacePathUnavailable"),d("proposedPlan.workspacePathUnavailableDescription"));return}h.length===0&&v(A.slice(0,ip)),g(!0)},Se=()=>{if(w.current)return;let K=h.trim();if(!(!s||l===null)){if(!K){c.warning(d("proposedPlan.enterWorkspacePath"));return}if(K.length>ip){c.warning(d("proposedPlan.pathTooLong"));return}w.current=!0,x(!0),(async()=>{try{let W=await l({environmentId:r,workspaceRoot:s,relativePath:K,contents:B});if(!C.current)return;W.ok?(g(!1),c.success(d("proposedPlan.savedToWorkspace"),W.relativePath)):c.error(d("proposedPlan.couldNotSave"),void 0,{description:d("proposedPlan.saveErrorDescription")})}catch(W){C.current&&c.error(d("proposedPlan.couldNotSave"),W,{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(hl,{variant:"secondary",children:d("proposedPlan.badge")}),u("p",{className:"truncate text-sm font-medium text-foreground",children:I})]}),b(Ao,{children:[u(Ro,{render:u(de,{"aria-label":d("proposedPlan.actions"),size:"icon-xs",variant:"outline"}),children:u(rr,{"aria-hidden":"true",className:"size-4"})}),b(Eo,{align:"end",children:[u(ar,{onClick:q,children:d(S?"proposedPlan.copied":"proposedPlan.copyToClipboard")}),u(ar,{onClick:z,children:d("proposedPlan.downloadAsMarkdown")}),l!==null?u(ar,{onClick:X,disabled:!s||y,children:d("proposedPlan.saveToWorkspace")}):null]})]})]}),b("div",{className:"mt-4",children:[b("div",{className:H("relative",E&&!f&&"max-h-104 overflow-hidden"),children:[E&&!f?u(ir,{disclosureKey:`proposed-plan:${o}:plan`,text:_??"",cwd:i,threadRef:a,isStreaming:!1}):u(ir,{disclosureKey:`proposed-plan:${o}:plan`,text:P,cwd:i,threadRef:a,isStreaming:!1}),E&&!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]}),E?u("div",{className:"mt-4 flex justify-center",children:u(de,{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:K=>{y||g(K)},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(eS,{className:"space-y-3",children:b("label",{htmlFor:T,className:"grid gap-1.5",children:[u("span",{className:"text-xs font-medium text-foreground",children:d("proposedPlan.workspacePath")}),u(If,{id:T,value:h,maxLength:ip,onChange:K=>v(K.target.value.slice(0,ip)),placeholder:A,spellCheck:!1,disabled:y})]})}),b(Mf,{children:[u(de,{variant:"outline",size:"sm",onClick:()=>g(!1),disabled:y,children:d("proposedPlan.cancel")}),u(de,{size:"sm",onClick:()=>{Se()},disabled:y,children:d(y?"proposedPlan.saving":"proposedPlan.save")})]})]})})]})});function HI({timeline:e,previousOverlayHeight:t,overlayHeight:n,followingEnd:o}){e&&o&&n>t&&e.scrollToEnd({animated:!1})}function $I(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 KI({measurement:e,followingEnd:t}){return t?null:e.rowAtScroll()}pe();var Pl=class extends ka{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 Iz({error:e,className:t}){let{t:n}=ut();return b(Ye,{children:[b(Ze,{render:u("div",{className:H("flex min-h-6 min-w-0 items-center gap-1.5 px-0.5 py-0.5 text-destructive",t)}),children:[u(Bn,{"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 VI(e){return u(Iz,{error:e})}var gn=wt(null),qI=wt(null),Tz=u("div",{className:"h-3 sm:h-4"}),kz=u("div",{className:"h-10 sm:h-12"}),Lz=Object.freeze([]);function Pz({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 Az({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(de,{variant:"ghost",size:"sm",onClick:n,disabled:e||t,children:r(e?"timeline.loadingLater":"timeline.loadLater")}),o?u(de,{variant:"ghost",size:"sm",onClick:o,children:r("timeline.returnToLatest")}):null]})}function Ez({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 Rz=u("div",{className:"h-3 sm:h-4"}),Mz=[],Nz=new Set,_z=200,Dz=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 Oz=()=>{},Fz=[];function Bz(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??Lz}}function zz(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 Uz=e=>e.getMeta().finalAssistantMessageReceived;function Hz(e,t){let n=N(e);return t&&(n.current=e),n.current}var WI=me(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=Oz,onOpenFileDiff:p,onForkFromUserMessage:m,onImageExpand:g,markdownCwd:h,resolvedTheme:v,timestampFormat:y,workspaceRoot:x,skills:C=Mz,onRowsChange:w,contentInsetEndAdjustment:L,liveFollowEnabled:S,awaitingUserDecision:T=!1,onIsAtEndChange:I,onManualNavigation:k,onDisclosureNavigation:E=k,hideEmptyPlaceholder:P=!1,topFadeEnabled:_=!1,scrollerRef:A,loadEarlier:B=null,loadLater:z=null,pagingBlockedByInteraction:q=!1,onReturnToLatest:X=null,onVisibleTurnRangeChange:Se=null,revealMessageRequest:K=null,onRevealMessageHandled:W,renderWorkGroup:Z,renderToolCallDetail:j,loadScrollAnchor:O,saveScrollAnchor:Y,useVisibleThreadCompletion:re,onSavePlanToWorkspace:ue,paneActive:le,onTurnNavigatorChange:fe}){let{t:ae}=ut(),{latestTurn:Le,latestAssistantMessageId:et,isWorking:Ge,workingStepLabel:rt,stall:$e,retry:te,totalTurnCount:Pe,scheduledWakes:Q}=hi(o,Bz,zz),$=aa(),oe=N($);oe.current=$;let ve=N(K);ve.current=K;let[at,Et]=fn("timeline-disclosure-reading",r,!1),Rt=N(r);Rt.current=r;let _t=N(q);_t.current=q;let an=Nt("timeline-following-end",r,!0);an.current=z===null&&S;let mt=Nt("timeline-scroll-restore-pending",r,!1),Wt=Ar(r,null),Ot=Ar(r,null),vt=Ar(r,null),Sn=Nt("timeline-content-inset",r,L),ft=N(null),pn=Ar(r,[]),no=Ar(r,!1),Xt=N(null),In=R(()=>pn.current,[pn]),En=R(U=>{pn.current=U,Xt.current?.(),Oo.current?.schedule()},[pn]),sn=R(U=>{no.current=U,Oo.current?.schedule()},[no]),Rn=R(U=>{U!==null&&(ft.current=U),A(U)},[A]);he(()=>{HI({timeline:ft.current,previousOverlayHeight:Sn.current,overlayHeight:L,followingEnd:$&&z===null&&S&&!at}),Sn.current=L},[L,at,S,z,$]),G(()=>()=>{Ot.current?.stop()},[]);let F=R(()=>{Ot.current?.stop(),Ot.current=null,Wt.current=null,Et(!1)},[Wt,Ot,Et]),ce=R(U=>{E(),Wt.current=U,Et(!0),Ot.current?.stop();let Ae=ft.current?.node??null;if(!Ae)return;let it=Array.from(Ae.querySelectorAll("[data-timeline-row-id]")).find(Fo=>Fo.dataset.timelineRowId===U);if(!it)return;let tn=vt.current;Ot.current=VS({viewport:Ae,row:it,anchor:tn&&it.contains(tn)?tn:it,scrollToOffset:Fo=>{Ae.scrollTop=Fo}})},[E]),be=Nt("timeline-live-follow-previous",r,S);he(()=>{S&&!be.current&&F(),be.current=S},[S,F]);let ke=Hz(z!==null,$),Re=!ke&&Ge,st=ke?null:rt,ln=ke?null:$e,vn=ke?null:te,ct=nI(o),kt=ct.sections,Ft=ct.rowIds.length,Pt=R(U=>{let Ae=o.getRows().find(it=>it.id===U||it.kind==="work"&&it.groupedEntries.some(tn=>tn.id===U)||it.kind==="tool-group"&&it.entries.some(tn=>tn.id===U));ce(Ae?.id??U)},[o,ce]),Ut=Nt("timeline-scroll-snapshot",r,null),ht=R((U,Ae=an.current)=>{U.scrollLength<=0||(Ut.current={threadKey:r,anchor:KI({measurement:U,followingEnd:Ae})})},[an,r,Ut]),we=R(()=>{let U=Ut.current;U&&Y(U.threadKey,U.anchor)},[Y,Ut]),Ve=R(()=>{if(!$||mt.current)return;if(Ft===0){we();return}let U=ft.current?.measure();U&&U.scrollLength>0&&(ht(U,an.current&&t.resolveIsAtEnd(U,L)!==!1),we())},[ht,L,t,an,$,we,mt,Ft]),qe=ZS(r),We=N(qe);We.current=qe;let ot=Nt("timeline-top-reveal-armed",r,!0),yt=Nt("timeline-network-prepend-awaiting-navigation",r,!1),ye=N(null),xt=N(null);he(()=>()=>{xt.current!==null&&(cancelAnimationFrame(xt.current),xt.current=null)},[r,$]);let pt=Nt("timeline-network-prepend-scroll-top",r,null),Ht=Nt("timeline-mounted-section-keys",r,Nz,3),Tn=Ar(r,null),mn=Tn.current,kn=mn===null?-1:kt.findIndex(U=>U.key===mn.firstMountedSectionKey),ge=kn>0?kt.length-Math.max(0,kn-Fh):qe.revealedCount,tt=kn>0?ge:qe.revealedCount,Ct=TS(kt.map(U=>U.key),Ht.current,tt,z!==null||!S||at||no.current||pn.current.length>0),{startIndex:lt,hasHiddenOlder:Ln}=GS(kt.length,Ct),Bt=V(()=>kt.slice(lt),[lt,kt]),Mt=mn!==null&&kn>0&<<kn,Yt=N(kt);Yt.current=kt,he(()=>{$&&(Ht.current=new Set(Bt.map(U=>U.key)),mn!==null&&(Mt?(Tn.current=null,yt.current=!0):B?.loading?mn.loadingObserved=!0:(mn.loadingObserved||B===null)&&(Tn.current=null)),Ct<We.current.revealedCount?We.current.compactTo(Ct):Ct>We.current.revealedCount&&We.current.revealAtLeast(Ct))},[yt,B,$,mn,Mt,Tn,Ht,Ct,Bt]);let Pn=Ar(r,null),zt=R((U=null)=>{if(!oe.current)return;let Ae=ft.current?.node;Ae&&(Pn.current={scrollHeight:Ae.scrollHeight,scrollTop:Ae.scrollTop,row:ft.current?.measure()?.rowAtScroll()??null,firstMountedSectionKey:U,until:Date.now()+Dz})},[Pn]),To=R(()=>{let U=Pn.current;if(U===null||U.firstMountedSectionKey===null||Date.now()>U.until)return;let Ae=ft.current?.node;if(!Ae)return;let it=Ut.current;U.scrollHeight=Ae.scrollHeight,U.scrollTop=Ae.scrollTop,U.row=it?.threadKey===r?it.anchor:null},[Pn,r,Ut]);he(()=>{if(!$)return;let U=Pn.current;if(!U)return;if(Date.now()>U.until){Pn.current=null;return}if(U.firstMountedSectionKey!==null&&(!Mt||mn?.firstMountedSectionKey!==U.firstMountedSectionKey))return;Pn.current=null;let Ae=ft.current?.node;if(Ae){if(U.row){let it=ft.current?.measure()?.topOf(U.row.rowId);it!=null&&(Ae.scrollTop=it+U.row.offsetPx)}else Ae.scrollTop=U.scrollTop+(Ae.scrollHeight-U.scrollHeight);Mt&&(pt.current=Ae.scrollTop)}},[pt,$,mn,Mt,lt,ct]);let hr=R(()=>{zt(),We.current.revealOlder()},[zt]),ei=N(hr);ei.current=hr;let Ui=N(Ln);Ui.current=Ln;let ze=N(null),jr=Nt("timeline-scroll-restore",r,void 0);if(jr.current===void 0&&Ft>0){let U=O(r);jr.current=U!==null&&ct.rowIds.includes(U.rowId)?U:null}let yn=jr.current??null,vr=N(()=>{}),[Hi,$i]=fn("timeline-scroll-restore-settled",r,!1),Xo=yn!==null&&!Hi,yr=Nt("timeline-last-anchor-save",r,0);G(()=>{let U=yn;if(!$||Hi||U===null)return;if(ve.current!==null){$i(!0);return}let Ae=null,it=requestAnimationFrame(()=>{!oe.current||Rt.current!==r||(k(),We.current.revealAtLeast(yc(Yt.current,U.rowId,We.current.revealedCount)),Ae=requestAnimationFrame(()=>{!oe.current||Rt.current!==r||($i(!0),vr.current(U.rowId,-U.offsetPx))}))});return()=>{cancelAnimationFrame(it),Ae!==null&&cancelAnimationFrame(Ae)}},[k,$,r,yn,Hi]);let oo=Nt("timeline-restore-after-presentation",r,!1),$t=Xo||oo.current;mt.current=$t,he(()=>{if($)return()=>{Rt.current!==r?we():Ve(),oo.current=!0}},[$,r]),he(()=>{if(!$||!oo.current)return;if(ve.current!==null){oo.current=!1,mt.current=!1;return}let U=null,Ae=null,it=()=>{!oe.current||Rt.current!==r||(ft.current?.scrollToEnd(),oo.current=!1,mt.current=!1,an.current=z===null,Jo.current=z===null,Zo.current={...Zo.current,followEnabled:!0,restoreInProgress:!1},I(z===null))},tn=O(r),Fo=tn!==null&&Yt.current.some(tl=>tl.rowIds.includes(tn.rowId));return tn===null?U=requestAnimationFrame(it):Fo?(k(),We.current.revealAtLeast(yc(Yt.current,tn.rowId,We.current.revealedCount)),U=requestAnimationFrame(()=>{Ae=requestAnimationFrame(()=>{!oe.current||Rt.current!==r||(vr.current(tn.rowId,-tn.offsetPx),oo.current=!1,mt.current=!1)})})):Ft>0&&(U=requestAnimationFrame(it)),()=>{U!==null&&cancelAnimationFrame(U),Ae!==null&&cancelAnimationFrame(Ae)}},[O,z,I,k,$,r,Ft,kt.length]);let xr=R(U=>{F(),k(),We.current.revealAtLeast(yc(Yt.current,U.anchorRowId,We.current.revealedCount));let Ae=r;requestAnimationFrame(()=>{Rt.current===Ae&&vr.current(U.anchorRowId,24)})},[k,F,r]);G(()=>{if(K===null||!$)return;F(),k();let U=t.resolveToolGroupRevealRowId(o.getRows(),K.rowId);We.current.revealAtLeast(yc(Yt.current,U,We.current.revealedCount));let Ae=requestAnimationFrame(()=>{Rt.current===r&&(vr.current(U,24),W?.())});return()=>cancelAnimationFrame(Ae)},[K,$,k,F,W,t,r,o]);let Jt=R(U=>$?EI(U,t):Fz,[t,$]),Cr=hi(o,Jt,RI),Mn=N(Cr);Mn.current=Cr;let Oe=Nt("timeline-active-header",r,null),bn=Cr.at(-1)?.text??null,br=bn!==null,wr=N(null),fo=N(null),[Sr,_o]=fn("timeline-pinned-header-expanded",r,!1),Qr=N(Sr);Qr.current=Sr;let wa=R(()=>{if(!oe.current)return;let U=wr.current,Ae=fo.current;!U||!Ae||(U.dataset.truncated=Qr.current||Ae.scrollWidth>Ae.clientWidth+1?"true":"false")},[]),[ko,Lo]=J(null),Xr=hi(o,Uz),[An,Do]=J(null),Yr=R(()=>{if(_t.current||Rt.current!==r||B===null||B.loading)return;let U=Bt[0]?.key;U!==void 0&&(zt(U),Tn.current={firstMountedSectionKey:U,loadingObserved:!1},B.onLoadEarlier())},[zt,B,Tn,r,Bt]);ze.current=B===null||B.loading||q?null:Yr;let Yo=R(()=>{_t.current||Rt.current!==r||(zt(),z?.onLoadLater())},[zt,z,r]),Jr=R((U,Ae)=>{if(!oe.current)return;let it=ft.current?.node;if(!it)return;let tn=Array.from(it.querySelectorAll("[data-timeline-turn-section]")),Fo=tn.findIndex(Sa=>Sa.querySelector(`[data-timeline-row-id="${CSS.escape(U)}"]`)),tl=Fo<0?tn:tn.slice(0,Fo+1);for(let Sa of tl)Sa.style.contentVisibility="visible";it.offsetHeight,ft.current?.scrollToRow(U,{viewOffset:Ae}),requestAnimationFrame(()=>{for(let Sa of tl)Sa.style.removeProperty("content-visibility")})},[]);vr.current=Jr;let Ir=$&&z===null&&S&&!at&&!$t,Jo=N(Ir);Jo.current=Ir;let Zo=N({followEnabled:Ir,restoreInProgress:$t,loadEarlier:B});Zo.current={followEnabled:Ir,restoreInProgress:$t,loadEarlier:B};let Oo=N(null);G(()=>{if(!An||!$)return;let U=eI({root:An,minimumCount:us,keepAbovePx:Qh,canCompact:()=>{let Ae=Zo.current,it=Pn.current;return Ae.followEnabled&&pn.current.length===0&&!Ae.restoreInProgress&&!Ae.loadEarlier?.loading&&!(it&&it.until>Date.now())&&We.current.revealedCount>us},onCompact:Ae=>{ot.current=!0,zt(),We.current.compactTo(Ae)}});return Oo.current=U,()=>{U.disconnect(),Oo.current=null}},[zt,$,An]),G(()=>{Oo.current?.schedule()},[Ir,B?.loading,qe.revealedCount,kt.length]),G(()=>{if(!An||!$||typeof ResizeObserver>"u")return;let U=()=>{if(!oe.current||!Jo.current)return;let tn=An.scrollHeight-An.clientHeight;Math.abs(An.scrollTop-tn)>.5&&(An.scrollTop=tn)},Ae=new ResizeObserver(U);Ae.observe(An);let it=An.firstElementChild;return it&&Ae.observe(it),()=>Ae.disconnect()},[$,An]),re({viewport:ko,viewActive:le&&$,threadKey:r,completedAt:z===null&&!$t&&Le?.state==="completed"&&Xr?Le.completedAt:null,messageId:et,bottomInset:L});let ti=ct.rowIds.at(-1)??null;G(()=>{w?.(ti)},[ti,w,r]);let er=Nt("timeline-later-load-armed",r,!0),Ke=R(U=>{if(U>Qh){ot.current=!0;return}if(ot.current){if(ot.current=!1,Ui.current){ei.current();return}ze.current?.()}},[ot]),Lt=R(()=>{yt.current&&(yt.current=!1,pt.current=null,ot.current=!0)},[yt,pt,ot]),en=R(()=>{if(xt.current!==null||_t.current||!oe.current||Rt.current!==r||mt.current)return!1;let U=ft.current?.measure();return!U||U.scroll>2||U.contentLength-U.scrollLength-U.scroll<=2||!Ui.current&&ze.current===null?!1:(yt.current=!1,pt.current=null,ot.current=!0,xt.current=requestAnimationFrame(()=>{xt.current=null}),Ke(U.scroll),!0)},[Ke,yt,pt,r,mt,ot,xt]),Nn=R(()=>{if(!oe.current||Rt.current!==r)return;let U=ft.current?.measure();if(!U||mt.current)return;ht(U);let Ae=pt.current;yt.current&&Ae!==null&&Math.abs(U.scroll-Ae)>.5&&Lt(),To();let it=t.resolveIsAtEnd({contentLength:U.contentLength,scroll:U.scroll,scrollLength:U.scrollLength},L);it!==void 0&&I(z===null&&it),U.contentLength-U.scrollLength-U.scroll>2&&Ke(U.scroll),U.contentLength-U.scrollLength-U.scroll>Qh?er.current=!0:er.current&&z&&!z.loading&&!_t.current&&(er.current=!1,Yo());let Fo=Date.now();Fo-yr.current>=_z&&(yr.current=Fo,we())},[ht,L,t,Ke,I,we,To,r,z,er,Yo,yt,pt,Lt,mt]),po=N(null),Zr=R(()=>{oe.current&&po.current===null&&(po.current=requestAnimationFrame(()=>{po.current=null,wa()}))},[wa]);G(()=>()=>{po.current!==null&&(cancelAnimationFrame(po.current),po.current=null)},[r]);let el=R(U=>{if(U===null||U===Oe.current)return;Oe.current=U;let Ae=Mn.current.find(it=>it.sectionKey===U);Ae&&fo.current&&(fo.current.textContent=Ae.text),Qr.current&&_o(!1),Zr()},[Oe,Zr,_o]),Sd=tI({root:An,topInsetPx:rp,onActiveSectionChange:el,active:$}),Qu=V(()=>IS(kt),[kt]),Yg=PS({root:An,inputKey:r,visible:$,index:Qu,topInset:br?rp:0,bottomInset:L,interactionRows:In,onRangeChange:Se,onSelectionChange:sn});Xt.current=Yg,G(()=>{if(!$){we();return}let U=requestAnimationFrame(()=>{if(!oe.current)return;let Ae=ft.current?.node;Ae&&Jo.current&&(Ae.scrollTop=Ae.scrollHeight-Ae.clientHeight),Sd.refresh()});return()=>cancelAnimationFrame(U)},[we,Sd,$]);let Xu=R(()=>{_o(U=>!U)},[_o]);he(()=>{if(!$)return;let U=Oe.current,Ae=U===null?void 0:Mn.current.find(it=>it.sectionKey===U);Ae&&fo.current&&(fo.current.textContent=Ae.text),Zr()},[$,Zr,Sr]);let Id=V(()=>{let U=Ln?u(Ez,{onReveal:hr,fade:_}):B!==null?u(Pz,{loading:B.loading,blocked:q,onLoadEarlier:Yr,fade:_}):_?kz:Tz;return br?b(Te,{children:[u("div",{style:{height:rp}}),U]}):U},[Yr,Ln,br,B,q,hr,_]);G(()=>{if(!$)return;let U=requestAnimationFrame(Nn);return()=>cancelAnimationFrame(U)},[Nn,$,$t,Ft]);let Jg=V(()=>({timestampFormat:y,threadKey:r,threadRef:a,markdownCwd:h,resolvedTheme:v,workspaceRoot:x,skills:C,activeThreadEnvironmentId:i,onForkFromUserMessage:m,onImageExpand:g,onOpenFileDiff:p,onProcessDisclosureChange:Pt,agentPanelModel:c,onOpenAgents:f,onInterrupt:s,onRespondToDecision:l,scheduledWakes:Q,onCancelScheduledWake:d,derive:t,SiteIcon:n,renderWorkGroup:Z,renderToolCallDetail:j,onSavePlanToWorkspace:ue}),[y,r,a,h,v,x,C,i,m,g,p,Pt,c,f,s,l,Q,d,t,n,Z,j,ue]),tr=V(()=>({isWorking:Re,workingStepLabel:st,stall:ln,retry:vn}),[Re,vn,ln,st]),Yu=R(U=>u($z,{rowsStore:o,rowId:U}),[o]),Ki=Ft===0&&!Re&&!P;return u(gn,{value:Jg,children:b(qI,{value:tr,children:[u(_I,{rowsStore:o,derive:t,paneVisible:$,totalTurnCount:Pe,bottomInset:L,onSelect:xr,onTurnNavigatorChange:fe}),b("div",{ref:Lo,onClickCapture:U=>{vt.current=U.target instanceof Element?U.target.closest("button"):null},onWheelCapture:F,onTouchMoveCapture:F,onPointerDownCapture:U=>{U.target===ft.current?.node&&(F(),en())},onKeyDownCapture:U=>{["ArrowUp","ArrowDown","PageUp","PageDown","Home","End"].includes(U.key)&&F()},className:"chat-timeline relative h-full min-h-0","data-awaiting-user-decision":T?"true":"false","data-disclosure-reading":at?"true":void 0,"data-timeline-follow-end":Ir?"true":"false","data-timeline-end-inset":L,children:[u(LS,{inputKey:r,onBeforeInputChange:Ve,handleRef:Rn,onAttach:Do,onInteractionRowsChange:En,onScroll:Nn,className:H("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:U=>{U.defaultPrevented||U.deltaY>=0||pi(U.target)||Xh(U.target,ft.current?.node??null)||en()},onTouchStartCapture:U=>{ye.current=U.touches[0]?.clientY??null},onTouchMove:U=>{let Ae=U.touches[0],it=ye.current;U.defaultPrevented||pi(U.target)||Xh(U.target,ft.current?.node??null)||Ae===void 0||it===null||Ae.clientY<=it||en()&&(ye.current=null)},onTouchEndCapture:()=>{ye.current=null},onTouchCancelCapture:()=>{ye.current=null},onKeyDown:U=>{U.defaultPrevented||U.repeat||U.metaKey||U.ctrlKey||U.altKey||U.shiftKey||pi(U.target)||Xh(U.target,ft.current?.node??null)||!["ArrowUp","PageUp","Home"].includes(U.key)||en()},children:[Id,Bt.map(U=>u(qS,{sectionKey:U.key,rowKeyPrefix:r,rowIds:U.rowIds,renderRow:Yu,sectionRef:Sd.observeSection(U.key)},`${r}:${U.key}`)),z?u(Az,{loading:z.loading,blocked:q,onLoadLater:Yo,onReturnToLatest:X}):null,Rz]})}),Ki?u("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center",children:u("p",{className:"text-placeholder text-chat",children:ae("timeline.empty")})}):null,bn!==null?u(wI,{ref:wr,textRef:fo,initialText:bn,expanded:Sr,onToggleExpanded:Xu}):null]})]})})});var $z=me(function({rowsStore:t,rowId:n}){let o=oI(t,n),r=St(gn);return o===void 0?null:u(gl,{value:o.id,children:u("div",{className:H("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(Pl,{resetKey:o.id,fallback:VI,children:[o.kind==="turn-summary"?u(MS,{footer:o.footer,copyText:o.copyText,timestampFormat:r.timestampFormat}):null,o.kind==="tool-group"?u(KS,{entries:o.entries,groupId:o.groupId,threadKey:r.threadKey,workspaceRoot:r.workspaceRoot,onDisclosureChange:()=>r.onProcessDisclosureChange?.(o.id)}):null,o.kind==="work"?u(Kz,{row:o}):null,o.kind==="model-switch"?u(II,{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(SI,{row:o}):null,o.kind==="proposed-plan"?u(qz,{row:o}):null,o.kind==="turn-plan"?u(Wz,{row:o}):null,o.kind==="working"?u(Gz,{row:o}):null]})})})});function Kz({row:e}){let t=St(gn),n=aa(),o=t.renderWorkGroup?.({row:e,threadRef:t.threadRef,visible:n});return o!==void 0?u(Te,{children:o}):u("div",{className:"min-w-0 space-y-px py-0.5",children:e.groupedEntries.map(r=>u(Vz,{entry:r},r.id))})}function Vz({entry:e}){let t=St(gn),[n,o]=$o(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:H("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:H("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(un,{"aria-hidden":!0,className:H("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 qz({row:e}){let t=St(gn);return u("div",{className:"min-w-0 px-1 py-0.5",children:u(UI,{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 Wz=me(function({row:t}){let n=St(gn),{t:o}=ut(),[r,a]=$o(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?un:zo,{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("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:H("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:H("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:H("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 Gz({row:e}){let{workingStepLabel:t,stall:n,retry:o}=St(qI),{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(Jz,{createdAt:e.createdAt})):r("activity.workingNoTimer"),t&&!e.compacting?b("span",{className:"ml-2 text-muted-foreground/55",children:["\xB7 ",t]}):null]})}),o?u(jz,{retry:o}):n&&!e.compacting?u(Xz,{stall:n}):null]})}function jz({retry:e}){let{t}=ut(),n=St(gn);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(de,{onClick:n.onInterrupt,size:"sm",variant:"ghost",title:t("stall.interruptHint"),children:t("stall.interrupt")})}):null]})}var Qz={childThread:"stall.reasonChildThread",tool:"stall.reasonTool",approval:"stall.reasonApproval",userInput:"stall.reasonUserInput",model:"stall.reasonModel"};function Xz({stall:e}){let{t}=ut(),{onInterrupt:n}=St(gn),o=t(Qz[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(Yz,{since:e.since}))}),u("span",{"aria-hidden":!0,children:"\xB7"}),u("span",{children:o}),n?u(de,{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 GI(e,t){let n=aa();G(()=>{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 Yz({since:e}){let t=N(null);return GI(e,t),u("span",{className:"timeline-timer tabular-nums",ref:t,children:Yh(e)})}function Jz({createdAt:e}){let t=N(null);return GI(e,t),u("span",{ref:t,className:"timeline-timer tabular-nums",children:Yh(e)})}function Zz(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`:Ea(r*1e3)}function Yh(e){return Zz(e,new Date().toISOString())??"0s"}function jI(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 QI(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&&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&&jI(e.entries,n.entries)}case"working":{let n=t;return e.createdAt===n.createdAt&&e.turnId===n.turnId&&e.compacting===n.compacting&&e.modelBadge===n.modelBadge}case"model-switch":{let n=t;return e.createdAt===n.createdAt&&e.pending===n.pending&&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&&jI(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&&e.modelBadge===n.modelBadge}}}function eU(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 tU=new Map,nU={markdown:()=>"",download(){}},oU=[],rU={latestTurn:null,latestAssistantMessageId:null,runningTurnId:null,isWorking:!1,workingStepLabel:null,stall:null,retry:null,activeTurnStartedAt:null,totalTurnCount:null,pendingModelSelection:null,scheduledWakes:oU},aU={inputs:null,structure:{rowIds:[],sections:[]},indexById:new Map,rows:[],meta:{status:rU,usageByTurnId:tU,exportApi:nU,finalAssistantMessageReceived:!1},version:0};function iU(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 sU(e,t,n,o){let r=eU(n,e),a=lU(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&&QI(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=WS(s,r.turnGroups,t.structure.sections),d=a?t.structure.rowIds:s.map(g=>g.id),c=a&&iU(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 lU(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 XI(){let e=null,t=null,n=aU,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=sU(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}}pe();var dU=new Set;function YI({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=aa(),p=s.usePersistedExpandedTurnIds(n),[m,g]=fn("timeline-auto-expanded-turns",n,dU),h=V(()=>a.resolveExpandedTurnIds(p??[],m),[m,a,p]),{latestTurn:v}=c,y=Nt("timeline-latest-turn-previous",n,v);G(()=>{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=V(()=>({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 JI=me(function({data:t,target:n,threadKey:o,visible:r,...a}){let i=Nt("timeline-rows-store",o,null,3);i.current??=XI();let s=i.current;return b(Te,{children:[u(YI,{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(WI,{...a,threadKey:o,rowsStore:s,SiteIcon:t.SiteIcon})]})});pe();function ZI(e){return e==="loading"?"threadSync.loading":"threadSync.syncing"}var cU=1e3;function e0(e,t=cU){let[n,o]=J(null);return G(()=>{if(e===null){o(null);return}let r=globalThis.setTimeout(()=>{o(e)},t);return()=>{globalThis.clearTimeout(r)}},[e,t]),n}function t0({phase:e}){let{t}=xe(),n=t(ZI(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(li,{"aria-hidden":!0,className:"size-icon-2 shrink-0 text-muted-foreground"}),u("span",{className:"truncate",children:n})]})}function n0({data:e,target:t,bottomInset:n,showScrollToEnd:o,onScrollToEnd:r}){let{t:a}=xe(),i=e0(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(t0,{phase:i}):null,o?b(de,{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(un,{}),a("timeline.scrollToEnd")]}):null]})}pe();function o0(){let e=!1;return{lock:()=>{e=!0},resume:()=>{e=!1},navigate:t=>!t||!e?!1:(e=!1,!0),isLocked:()=>e}}function r0(e){return e.requestedGeneration===e.currentGeneration&&e.mode==="following-end"&&!e.readingLocked}var uU=150,fU=16;function a0(e,t){typeof e=="function"?e(t):e&&(e.current=t)}function i0({inputKey:e,visible:t,endInset:n,derive:o,onReturnToLatest:r,controlRef:a}){let[i,s]=fn("timeline-live-follow-enabled",e,!0),[l,d]=fn("timeline-show-scroll-to-end",e,!1),c=Ar(e,null),[f,p]=JS(e,null),m=R(j=>{c.current=j;let O=j?.node??null;p(Y=>Y===O?Y:O)},[c,p]),g=Nt("timeline-is-at-end",e,!0),h=Ar(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)},uU)},[v,d,h]);G(()=>v,[v]);let x=R(()=>{let j=c.current?.measure();return j==null?void 0:{contentLength:j.contentLength,scroll:j.scroll,scrollLength:j.scrollLength}},[c]),C=Nt("timeline-scroll-mode",e,"following-end"),w=mi(t);he(()=>()=>w.cancel(),[w,e]);let L=Nt("timeline-user-scroll-generation",e,0),S=Nt("timeline-live-follow-generation",e,0),T=Nt("timeline-disclosure-reading-lock",e,o0),I=Nt("timeline-last-row-id",e,null),k=R(()=>{w.cancel(),L.current+=1,C.current="free-scrolling",S.current=null,s(!1)},[w,S,C,s,L]),E=R(()=>{T.current.lock(),k(),g.current=!1,v(),d(!0)},[v,g,k,T,d]),P=N(k);P.current=k;let _=R(()=>{let j=c.current?.measure(),O=I.current;if(!j||O===null)return!1;let Y=$I(j,O);return Y===null?!1:Y>Math.max(0,j.scrollLength-n-fU)},[n,c,I]),A=R(j=>{T.current.resume();let O=++L.current;g.current=!0,C.current="following-end",S.current=L.current,s(!0),v(),d(!1),w.request(()=>{r0({requestedGeneration:O,currentGeneration:L.current,mode:C.current,readingLocked:T.current.isLocked()})&&c.current?.scrollToEnd({animated:j})})},[v,w,c,g,S,T,C,s,d,L]),B=N(r);B.current=r;let z=R((j=!1)=>{let O=B.current;if(O){O(()=>A(j));return}A(j)},[A]),q=R(()=>z(!0),[z]),X=R(()=>{T.current.navigate(!0)&&(g.current=!1,o.resolveIsAtEnd(x(),n)===!0&&z())},[o,n,g,x,T,z]);G(()=>{if(!t||f===null)return;let j=null,O=requestAnimationFrame(()=>{let Y=()=>{P.current()},re=oe=>{let ve=oe instanceof Element?oe:null;for(;ve&&ve!==f;){if(ve instanceof HTMLElement&&ve.scrollHeight>ve.clientHeight+1&&ve.scrollTop+ve.clientHeight<ve.scrollHeight-1&&/auto|scroll/u.test(getComputedStyle(ve).overflowY))return!1;ve=ve.parentElement}return ve===f},ue=oe=>{T.current.isLocked()&&re(oe)&&X()},le=null,fe=!1,ae=f.scrollTop,Le=oe=>{le=oe.touches[0]?.clientY??null},et=()=>{le=null,fe=!1},Ge=()=>{let oe=f.scrollTop;fe&&oe>ae&&ue(f),ae=oe},rt=()=>_(),$e=()=>o.resolveIsAtEnd(x(),n)===!1,te=oe=>{oe.deltaY>0&&ue(oe.target),oe.deltaY<0&&rt()&&Y()},Pe=oe=>{let ve=oe.touches[0]?.clientY??null,at=le!==null&&ve!==null&&ve<le;le=ve,$e()&&Y(),at&&ue(oe.target)},Q=oe=>{if(oe.target===f){fe=!0,ae=f.scrollTop,rt()&&Y();return}$e()&&Y()},$=oe=>{if(!(oe.target instanceof Element?oe.target:null)?.closest("input, textarea, select, [contenteditable='true'], button, [role='button']"))switch(oe.key){case"PageUp":case"Home":case"ArrowUp":rt()&&Y();break;case"PageDown":case"End":case"ArrowDown":ue(oe.target);break;case" ":oe.shiftKey||ue(oe.target);break;default:break}};f.addEventListener("wheel",te,{passive:!0}),f.addEventListener("touchmove",Pe,{passive:!0}),f.addEventListener("touchstart",Le,{passive:!0}),f.addEventListener("touchend",et,{passive:!0}),f.addEventListener("touchcancel",et,{passive:!0}),f.addEventListener("scroll",Ge,{passive:!0}),window.addEventListener("pointerup",et,{passive:!0}),window.addEventListener("pointercancel",et,{passive:!0}),f.addEventListener("pointerdown",Q,{passive:!0}),f.addEventListener("keydown",$),j=()=>{f.removeEventListener("wheel",te),f.removeEventListener("touchmove",Pe),f.removeEventListener("touchstart",Le),f.removeEventListener("touchend",et),f.removeEventListener("touchcancel",et),f.removeEventListener("scroll",Ge),window.removeEventListener("pointerup",et),window.removeEventListener("pointercancel",et),f.removeEventListener("pointerdown",Q),f.removeEventListener("keydown",$)}});return()=>{cancelAnimationFrame(O),j?.()}},[_,o,n,e,x,T,X,f,t]);let Se=R(j=>{I.current=j},[I]),K=R(j=>{if(T.current.isLocked()){g.current=!1,v(),d(!0);return}if(!j&&S.current===L.current){v(),d(!1);return}g.current!==j&&(g.current=j,j?(C.current="following-end",S.current=L.current,s(!0),v(),d(!1)):(C.current="free-scrolling",S.current=null,y()))},[v,g,S,T,y,C,s,d,L]),W=N(z);W.current=z;let Z=V(()=>({followEnd:j=>W.current(j?.animated??!1)}),[]);return he(()=>(a0(a,Z),()=>a0(a,null)),[Z,a]),{liveFollowEnabled:i,showScrollToEnd:l,bindTimelineHandle:m,onRowsChange:Se,onIsAtEndChange:K,onManualNavigation:k,onDisclosureNavigation:E,returnToEnd:q}}pe();pe();var s0=["user-message","assistant-message","reasoning","tool-call","approval","user-input","compaction","retry","session","turn-intent","scheduled-wake","communication","delegation","task","event"];var l0=50,pU=32,Jh=class extends ka{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 d0(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 mU(e){let t=[];for(let n=0;n<e.length;n+=l0)t.push(e.slice(n,n+l0));return t}function gU({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(`
|
|
3746
|
+
`):null,contexts:o}}function hI(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=wc(e),n=tz(t.promptText);return{visibleText:n.promptText,copyText:e,contextCount:n.contextCount,previewTitle:n.previewTitle,contexts:n.contexts,elementContexts:t.contexts}}var nz=/^(.*?)\s+line(?:s)?\s+(\d+)(?:-(\d+))?$/i;function vI(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=nz.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,"-")}`:hI({terminalLabel:n[1]?.trim()||"terminal",lineStart:o,lineEnd:r})}function yI(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 $h({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(az,{parsed:n}),n.body.length>0||(e.message.attachments?.length??0)>0?u($h,{row:{...e,message:{...e.message,text:n.body}}}):null]}):u(sz,{row:e})}return u(oz,{row:e,text:e.message.text})}function Kh({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=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 oz({row:e,text:t}){let{t:n}=ut(),o=bt(fn),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=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(rz,{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(lz,{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(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(uz,{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(cz,{context:v},`${v.header}:${v.body}`))}):null,u(hz,{disclosureKey:`message:${e.message.id}:user`,text:d.promptText,terminalContexts:i,skills:o.skills,markdownCwd:o.markdownCwd})]})]})]})}function rz({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 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 az({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 iz={"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 sz({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=sI(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(iz[f.kind],{title:f.title})}),f.summary.trim().length>0?u("p",{className:"mt-1 whitespace-pre-wrap",children:f.summary}):null]}):null},s=iI(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(Kh,{images:r}),a.map(l=>u(Vh,{attachment:l},l.id))]}):null]})}function bI(e,t){let n=t.parsePresetPrefixText(e??"")?.body??null;if(n===null&&Zf(e??""))return null;let r=Hh(n??e??"").visibleText;for(;;){let s=zh(r);if(!s.annotation)break;r=s.promptText}let a=wc(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 wI=34,SI=8,ap=wI+SI,II=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:SI},"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:wI}},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 lz({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 TI({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(qh,{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(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(dz,{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 dz({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 xI=pe(function(t){let n=t.context.body.length>0?`${t.context.header}
|
|
3747
|
+
${t.context.body}`:t.context.header;return u(gI,{label:t.context.header,tooltipText:n})}),cz=pe(function(t){let n=t.context.body?`${t.context.header}
|
|
3748
|
+
${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=hi(e.attachment),o=lI(n),r=t("attachments.open",{name:e.attachment.name}),a=b(Le,{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:aI(e.attachment.sizeBytes)})]})]}),i=e.attachment.previewUrl?dI(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 uz(e){let t=bt(fn),{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(as,{className:"size-3"}),e.annotation.styleChanges.length]}):null]})]})]})}var fz=8,pz=600,mz=1.75,CI=`linear-gradient(to bottom, black calc(100% - ${mz}rem), transparent)`;function gz(e){return e.trim().length===0?!1:e.length>pz||e.split(`
|
|
3749
|
+
`).length>fz}var hz=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&&gz(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:CI,maskImage:CI}:void 0,children:u(vz,{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]})}),vz=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=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(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(yz,{comment:a.comment,disclosureKey:`${t.disclosureKey}:review-comment:${a.comment.id}`},a.comment.id))});if(t.terminalContexts.length>0){let a=yI(t.text,t.terminalContexts),i=vI(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(xI,{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(xI,{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 yz({comment:e,disclosureKey:t}){let n=bt(fn),{t:o}=ut(),r=e.fenceLanguage??"diff",a=fI(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(mI,{text:e.text,skills:n.skills})}),r!=="diff"&&e.diff.trim().length>0&&u(cr,{disclosureKey:`${t}:fence`,text:uI(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 xz({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(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=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(xz,{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 kI({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,Cz=/\s/u;function LI(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(Cz.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 bz(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:LI(n.parseSystemNotificationText(r.text)?.summary??n.parseThreadHandoverText(r.text)?.body??r.text),assistantText:LI(a),headerText:r===null?null:bI(r.text,n)}}function wz(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 Sz(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 Iz(e,t,n){for(let o=0;o<e.length;o+=1)if(e[o]!==n[t.firstRowIndex+o])return!1;return!0}function Tz(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 kz(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&&Iz(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=bz(d.key,f,e),m={...p,turnId:wz(f)},g=c!==void 0&&Sz(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&&Tz(n.entries,i)?n.entries:i;return n={store:o,version:r,entries:l},l}}var PI=new WeakMap;function RI(e,t){let n=PI.get(e);return(n===void 0||n.derive!==t)&&(n={derive:t,read:kz(t)},PI.set(e,n)),n.read(e)}var AI=new WeakMap;function MI(e,t){let n=RI(e,t),o=AI.get(n);return o===void 0&&(o=n.flatMap(({summary:r})=>r.headerText===null?[]:[{sectionKey:r.sectionKey,text:r.headerText}]),AI.set(n,o)),o}function NI(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 EI=new WeakMap;function _I(e,t){let n=RI(e,t),o=EI.get(n);return o===void 0&&(o=n.filter(({summary:r})=>r.userText!==null).map(({item:r})=>r),EI.set(n,o)),o}function DI(e,t){return e===t?!0:e.length!==t.length?!1:e.every((n,o)=>n===t[o])}ue();var Lz=[],Pz=e=>e.getMeta().usageByTurnId,Az=e=>e.getMeta().exportApi,OI=pe(function({rowsStore:t,derive:n,paneVisible:o,totalTurnCount:r,bottomInset:a,onSelect:i,onTurnNavigatorChange:s}){let l=R(m=>o?_I(m,n):Lz,[n,o]),d=gi(t,l,DI),c=gi(t,Pz),f=gi(t,Az),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 FI(){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 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(`
|
|
3750
|
+
`)}function BI(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?ip(e)??t("proposedPlan.previewUnavailable"):(s&&a.push("","..."),a.join(`
|
|
3751
|
+
`))}function Ez(e){let t=e.toLowerCase().replace(/[`'".,!?()[\]{}]+/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"");return t.length>0?t:"plan"}function zI(e){let t=ip(e);return`${Ez(t??"plan")}.md`}function UI(e){return`${e.trimEnd()}
|
|
3752
|
+
`}function HI(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 sp=1024,$I=pe(function({planMarkdown:t,threadKey:n,rowId:o,environmentId:r,threadRef:a,cwd:i,workspaceRoot:s,onSavePlanToWorkspace:l}){let{t:d}=ut(),c=FI(),[f,p]=Go(n,`proposed-plan:${o}:expanded`,!1),[m,g]=J(!1),[h,v]=Go(n,`proposed-plan:${o}:save-path`,""),[y,x]=J(!1);If(o,m||y);let C=N(!1),w=N(!1);he(()=>(C.current=!0,()=>{C.current=!1}),[]);let{copyToClipboard:L,isCopied:S}=Gf({target:"plan",onError:H=>{c.error(d("proposedPlan.couldNotCopy"),H,{description:d("proposedPlan.copyErrorDescription")})}}),T=Jr(),I=ip(t)??d("proposedPlan.defaultTitle"),k=t.split(`
|
|
3753
|
+
`).length,E=t.length>900||k>20,P=Gh(t),_=E?BI(t,d,{maxLines:10}):null,A=zI(t),F=UI(t),B=()=>{HI(A,F)},V=()=>{L(F)},Q=()=>{if(!s){c.error(d("proposedPlan.workspacePathUnavailable"),d("proposedPlan.workspacePathUnavailableDescription"));return}h.length===0&&v(A.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",E&&!f&&"max-h-104 overflow-hidden"),children:[E&&!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}),E&&!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]}),E?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(tS,{className:"space-y-3",children:b("label",{htmlFor:T,className:"grid gap-1.5",children:[u("span",{className:"text-xs font-medium text-foreground",children:d("proposedPlan.workspacePath")}),u(Tf,{id:T,value:h,maxLength:sp,onChange:H=>v(H.target.value.slice(0,sp)),placeholder:A,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 KI({timeline:e,previousOverlayHeight:t,overlayHeight:n,followingEnd:o}){e&&o&&n>t&&e.scrollToEnd({animated:!1})}function VI(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 qI({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 Rz({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 WI(e){return u(Rz,{error:e})}var fn=Ct(null),GI=Ct(null),Mz=u("div",{className:"h-3 sm:h-4"}),Nz=u("div",{className:"h-10 sm:h-12"}),_z=Object.freeze([]);function Dz({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 Oz({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 Fz({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 Bz=u("div",{className:"h-3 sm:h-4"}),zz=[],Uz=new Set,Hz=200,$z=1e4,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 Kz=()=>{},Vz=[];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??_z}}function Wz(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 Gz=e=>e.getMeta().finalAssistantMessageReceived;function jz(e,t){let n=N(e);return t&&(n.current=e),n.current}var jI=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=Kz,onOpenFileDiff:p,onForkFromUserMessage:m,onImageExpand:g,markdownCwd:h,resolvedTheme:v,timestampFormat:y,workspaceRoot:x,skills:C=zz,onRowsChange:w,contentInsetEndAdjustment:L,liveFollowEnabled:S,awaitingUserDecision:T=!1,onIsAtEndChange:I,onManualNavigation:k,onDisclosureNavigation:E=k,hideEmptyPlaceholder:P=!1,topFadeEnabled:_=!1,scrollerRef:A,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,qz,Wz),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=Lr(r,null),Mt=Lr(r,null),wt=Lr(r,null),In=Rt("timeline-content-inset",r,L),ct=N(null),dn=Lr(r,[]),ro=Lr(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),A(z)},[A]);he(()=>{KI({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=>{E(),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=qS({viewport:Pe,row:st,anchor:Xt&&st.contains(Xt)?Xt:st,scrollToOffset:$o=>{Pe.scrollTop=$o}})},[E]),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,mn=Te?null:ne,at=oI(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:qI({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=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),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,Uz,3),vt=Lr(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-Oh):qe.revealedCount,et=Bn>0?ve:qe.revealedCount,lt=kS(Pt.map(z=>z.key),Ut.current,et,B!==null||!S||ft||ro.current||dn.current.length>0),{startIndex:it,hasHiddenOlder:xn}=jS(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=Lr(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()+$z})},[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||(k(),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)}},[k,X,r,Wr,Nn]);let Cr=Rt("timeline-restore-after-presentation",r,!1),br=nr||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,Pe=null,st=()=>{!ae.current||yt.current!==r||(ct.current?.scrollToEnd(),Cr.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?(k(),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),Cr.current=!1,gt.current=!1)})})):Et>0&&(z=requestAnimationFrame(st)),()=>{z!==null&&cancelAnimationFrame(z),Pe!==null&&cancelAnimationFrame(Pe)}},[te,B,I,k,X,r,Et,Pt.length]);let or=R(z=>{O(),k(),We.current.revealAtLeast(xc(It.current,z.anchorRowId,We.current.revealedCount));let Pe=r;requestAnimationFrame(()=>{yt.current===Pe&&tr.current(z.anchorRowId,24)})},[k,O,r]);W(()=>{if(H===null||!X)return;O(),k();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,k,O,q,t,r,o]);let _t=R(z=>X?MI(z,t):Vz,[t,X]),Gn=gi(o,_t,NI),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 wr=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,Gz),[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&&!br,jr=N(Xn);jr.current=Xn;let ar=N({followEnabled:Xn,restoreInProgress:br,loadEarlier:F});ar.current={followEnabled:Xn,restoreInProgress:br,loadEarlier:F};let Yn=N(null);W(()=>{if(!Pn||!X)return;let z=tI({root:Pn,minimumCount:ps,keepAbovePx:jh,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&&!br&&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>jh){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>jh?mo.current=!0:mo.current&&B&&!B.loading&&!Lt.current&&(mo.current=!1,Uo());let $o=Date.now();$o-Za.current>=Hz&&(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,wr()}))},[wr]);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=nI({root:Pn,topInsetPx:ap,onActiveSectionChange:$i,active:X}),Ki=K(()=>TS(Pt),[Pt]),Vi=AS({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 Qg=K(()=>{let z=xn?u(Fz,{onReveal:Do,fade:_}):F!==null?u(Dz,{loading:F.loading,blocked:V,onLoadEarlier:Po,fade:_}):_?Nz:Mz;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,br,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]),Xg=K(()=>({isWorking:Me,workingStepLabel:ht,stall:Ln,retry:mn}),[Me,mn,Ln,ht]),Yu=R(z=>u(Qz,{rowsStore:o,rowId:z}),[o]),Td=Et===0&&!Me&&!P;return u(fn,{value:Xu,children:b(GI,{value:Xg,children:[u(OI,{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":T?"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: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)||Qh(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)||Qh(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)||Qh(z.target,ct.current?.node??null)||!["ArrowUp","PageUp","Home"].includes(z.key)||un()},children:[Qg,gn.map(z=>u(WS,{sectionKey:z.key,rowKeyPrefix:r,rowIds:z.rowIds,renderRow:Yu,sectionRef:nl.observeSection(z.key)},`${r}:${z.key}`)),B?u(Oz,{loading:B.loading,blocked:V,onLoadLater:Uo,onReturnToLatest:Q}):null,Bz]})}),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(II,{ref:jn,textRef:Fo,initialText:Oo,expanded:Qn,onToggleExpanded:ol}):null]})]})})});var Qz=pe(function({rowsStore:t,rowId:n}){let o=rI(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:WI,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(Xz,{row:o}):null,o.kind==="model-switch"?u(kI,{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(TI,{row:o}):null,o.kind==="proposed-plan"?u(Jz,{row:o}):null,o.kind==="turn-plan"?u(Zz,{row:o}):null,o.kind==="working"?u(eU,{row:o}):null]})})})});function Xz({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(Yz,{entry:r},r.id))})}function Yz({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 Jz({row:e}){let t=bt(fn);return u("div",{className:"min-w-0 px-1 py-0.5",children:u($I,{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 Zz=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 eU({row:e}){let{workingStepLabel:t,stall:n,retry:o}=bt(GI),{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(aU,{createdAt:e.createdAt})):r("activity.workingNoTimer"),t&&!e.compacting?b("span",{className:"ml-2 text-muted-foreground/55",children:["\xB7 ",t]}):null]})}),o?u(tU,{retry:o}):n&&!e.compacting?u(oU,{stall:n}):null]})}function tU({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 nU={childThread:"stall.reasonChildThread",tool:"stall.reasonTool",approval:"stall.reasonApproval",userInput:"stall.reasonUserInput",model:"stall.reasonModel"};function oU({stall:e}){let{t}=ut(),{onInterrupt:n}=bt(fn),o=t(nU[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(rU,{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 QI(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 rU({since:e}){let t=N(null);return QI(e,t),u("span",{className:"timeline-timer tabular-nums",ref:t,children:Xh(e)})}function aU({createdAt:e}){let t=N(null);return QI(e,t),u("span",{ref:t,className:"timeline-timer tabular-nums",children:Xh(e)})}function iU(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 Xh(e){return iU(e,new Date().toISOString())??"0s"}function XI(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 YI(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&&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&&XI(e.entries,n.entries)}case"working":{let n=t;return e.createdAt===n.createdAt&&e.turnId===n.turnId&&e.compacting===n.compacting&&e.modelBadge===n.modelBadge}case"model-switch":{let n=t;return e.createdAt===n.createdAt&&e.pending===n.pending&&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&&XI(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&&e.modelBadge===n.modelBadge}}}function sU(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 lU=new Map,dU={markdown:()=>"",download(){}},cU=[],uU={latestTurn:null,latestAssistantMessageId:null,runningTurnId:null,isWorking:!1,workingStepLabel:null,stall:null,retry:null,activeTurnStartedAt:null,totalTurnCount:null,pendingModelSelection:null,scheduledWakes:cU},fU={inputs:null,structure:{rowIds:[],sections:[]},indexById:new Map,rows:[],meta:{status:uU,usageByTurnId:lU,exportApi:dU,finalAssistantMessageReceived:!1},version:0};function pU(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 mU(e,t,n,o){let r=sU(n,e),a=gU(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&&YI(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&&pU(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 gU(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 JI(){let e=null,t=null,n=fU,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=mU(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 hU=new Set;function ZI({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,hU),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 e0=pe(function({data:t,target:n,threadKey:o,visible:r,...a}){let i=Rt("timeline-rows-store",o,null,3);i.current??=JI();let s=i.current;return b(Le,{children:[u(ZI,{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(jI,{...a,threadKey:o,rowsStore:s,SiteIcon:t.SiteIcon})]})});ue();function t0(e){return e==="loading"?"threadSync.loading":"threadSync.syncing"}var vU=1e3;function n0(e,t=vU){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 o0({phase:e}){let{t}=Ce(),n=t(t0(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 r0({data:e,target:t,bottomInset:n,showScrollToEnd:o,onScrollToEnd:r}){let{t:a}=Ce(),i=n0(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(o0,{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 a0(){let e=!1;return{lock:()=>{e=!0},resume:()=>{e=!1},navigate:t=>!t||!e?!1:(e=!1,!0),isLocked:()=>e}}function i0(e){return e.requestedGeneration===e.currentGeneration&&e.mode==="following-end"&&!e.readingLocked}var yU=150,xU=16;function s0(e,t){typeof e=="function"?e(t):e&&(e.current=t)}function l0({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=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)},yU)},[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),T=Rt("timeline-disclosure-reading-lock",e,a0),I=Rt("timeline-last-row-id",e,null),k=R(()=>{w.cancel(),L.current+=1,C.current="free-scrolling",S.current=null,s(!1)},[w,S,C,s,L]),E=R(()=>{T.current.lock(),k(),g.current=!1,v(),d(!0)},[v,g,k,T,d]),P=N(k);P.current=k;let _=R(()=>{let G=c.current?.measure(),te=I.current;if(!G||te===null)return!1;let me=VI(G,te);return me===null?!1:me>Math.max(0,G.scrollLength-n-xU)},[n,c,I]),A=R(G=>{T.current.resume();let te=++L.current;g.current=!0,C.current="following-end",S.current=L.current,s(!0),v(),d(!1),w.request(()=>{i0({requestedGeneration:te,currentGeneration:L.current,mode:C.current,readingLocked:T.current.isLocked()})&&c.current?.scrollToEnd({animated:G})})},[v,w,c,g,S,T,C,s,d,L]),F=N(r);F.current=r;let B=R((G=!1)=>{let te=F.current;if(te){te(()=>A(G));return}A(G)},[A]),V=R(()=>B(!0),[B]),Q=R(()=>{T.current.navigate(!0)&&(g.current=!1,o.resolveIsAtEnd(x(),n)===!0&&B())},[o,n,g,x,T,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=>{T.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,T,Q,f,t]);let Se=R(G=>{I.current=G},[I]),H=R(G=>{if(T.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,T,y,C,s,d,L]),q=N(B);q.current=B;let ee=K(()=>({followEnd:G=>q.current(G?.animated??!1)}),[]);return he(()=>(s0(a,ee),()=>s0(a,null)),[ee,a]),{liveFollowEnabled:i,showScrollToEnd:l,bindTimelineHandle:m,onRowsChange:Se,onIsAtEndChange:H,onManualNavigation:k,onDisclosureNavigation:E,returnToEnd:V}}ue();ue();var d0=["user-message","assistant-message","reasoning","tool-call","approval","user-input","compaction","retry","session","turn-intent","scheduled-wake","communication","delegation","task","event"];var c0=50,CU=32,Yh=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 u0(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 bU(e){let t=[];for(let n=0;n<e.length;n+=c0)t.push(e.slice(n,n+c0));return t}function wU({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(`
|
|
3732
3754
|
|
|
3733
3755
|
`):[r,...s].filter(Boolean).join(`
|
|
3734
3756
|
|
|
3735
|
-
`);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 c0=me(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}=Jn(),[h,v]=fn("trajectory-kind-filter",t,"all"),[y,x]=fn("trajectory-expanded-rows",t,()=>new Set),[C,w]=fn("trajectory-follow-latest",t,!0),L=V(()=>{let te=new Set(n.map(Pe=>Pe.kind));return s0.filter(Pe=>te.has(Pe))},[n]),S=V(()=>h==="all"?n:n.filter(te=>te.kind===h),[n,h]),T=V(()=>mU(S),[S]),I=te=>x(Pe=>{let Q=new Set(Pe);return Q.has(te)?Q.delete(te):Q.add(te),Q}),k=N(null),E=N(null),P=R(te=>{k.current=te,te&&(E.current=te)},[]),_=Nt("trajectory-at-end",t,!0),A=Nt("trajectory-scroll-top",t,0),B=Nt("trajectory-row-anchor",t,null),z=N({inputKey:t,paneVisible:d,pagingBlockedByInteraction:a});z.current={inputKey:t,paneVisible:d,pagingBlockedByInteraction:a};let q=N(null);he(()=>{if(q.current=null,!!d)return()=>{q.current=null,s?.(null)}},[t,d,s]);let X=V(()=>({inputKey:t,store:sc()}),[t]),Se=N(X);Se.current=X;let K=N(()=>{}),W=R(te=>{let Pe=Se.current;return Pe.store.acquire(te,()=>{Se.current===Pe&&K.current()})},[]),Z=V(()=>{let te=S.map((Pe,Q)=>({key:Pe.id,turnId:Pe.turnId??null,firstRowIndex:Q,endRowIndex:Q+1}));return{sections:te,bySectionKey:new Map(te.map(Pe=>[Pe.key,Pe])),byRowId:new Map(te.map(Pe=>[Pe.key,{turnId:Pe.turnId,index:Pe.firstRowIndex}]))}},[S]),j=R((te,Pe)=>Array.from(te.querySelectorAll("[data-trajectory-row-id]")).find(Q=>Q.dataset.trajectoryRowId===Pe),[]),O=R((te,Pe)=>{let Q=Pe[0]?.dataset.timelineRowId,$=Q===void 0?void 0:j(te,Q);$&&Q!==void 0&&(B.current={rowId:Q,offset:te.getBoundingClientRect().top-$.getBoundingClientRect().top})},[j,B]),Y=R(()=>{if(!d)return;let te=k.current??E.current;te&&(A.current=te.scrollTop,_.current=te.scrollHeight-te.scrollTop-te.clientHeight<=pU,S.length>0&&O(te,d0(te)))},[_,S.length,d,O,A]),re=R(()=>z.current.inputKey===t&&z.current.paneVisible,[t]),ue=R(()=>{if(!re()||s===null)return;let te=k.current;if(!te||te.clientHeight<=0)return;let Pe=d0(te);O(te,Pe);let Q=X.store.rows(),$=te.ownerDocument.activeElement;if(Sl($)){let at=wl($,te);at&&Q.push(at)}let oe=Vf({index:Z,visibleSectionKeys:Pe.flatMap(at=>{let Et=at.dataset.timelineRowId;return Et===void 0?[]:[Et]}),protectedRowIds:Q,selectionRows:qf(te)}),ve=JSON.stringify(oe);q.current!==ve&&(q.current=ve,s(oe))},[X,re,s,Z,O]),le=mi(d),fe=R(()=>{re()&&s!==null&&le.request(ue)},[re,s,le,ue]);K.current=fe;let ae=R(te=>{let Pe=B.current,Q=Pe===null?void 0:j(te,Pe.rowId),$=Q?.closest("[data-trajectory-chunk]"),oe=$?.style.contentVisibility;$&&($.style.contentVisibility="visible");try{te.scrollTop=Q===void 0?A.current:te.scrollTop+Q.getBoundingClientRect().top-te.getBoundingClientRect().top+Pe.offset}finally{$&&($.style.contentVisibility=oe??"")}},[j,B,A]),Le=R(()=>{re()&&(Y(),fe())},[Y,re,fe]),et=R(()=>{!re()||z.current.pagingBlockedByInteraction||o?.loading||(Y(),o?.onLoadEarlier())},[Y,re,o]),Ge=R(()=>{!re()||z.current.pagingBlockedByInteraction||r?.loading||(Y(),r?.onLoadLater())},[Y,re,r]),rt=R(()=>{re()&&i?.(()=>{if(!re())return;_.current=!0,w(!0);let te=k.current;te&&(te.scrollTop=te.scrollHeight)})},[re,i,_,w]),$e=te=>{if(re()){if(te&&r!==null){rt();return}te&&(_.current=!0),w(te)}};return he(()=>{if(!re())return;let te=k.current;te&&(C&&_.current&&r===null?te.scrollTop=te.scrollHeight:ae(te),fe())},[_,y,S,C,t,re,r,d,fe,ae]),he(()=>{let te=k.current;if(!re()||s===null||!te)return;let Pe=!0,Q=()=>{Pe&&re()&&fe()},$=()=>{!Pe||!re()||(C&&_.current&&r===null?te.scrollTop=te.scrollHeight:ae(te),Q())},oe=typeof ResizeObserver>"u"?null:new ResizeObserver($);oe?.observe(te);let ve=te.querySelector("table");return ve&&oe?.observe(ve),te.addEventListener("focusin",Q),te.addEventListener("focusout",Q),te.ownerDocument.addEventListener("selectionchange",Q),Q(),()=>{Pe=!1,le.cancel(),oe?.disconnect(),te.removeEventListener("focusin",Q),te.removeEventListener("focusout",Q),te.ownerDocument.removeEventListener("selectionchange",Q)}},[_,C,t,re,r,s,d,le,fe,ae]),u(Jh,{inputKey:t,visible:d,rows:S,expandedRows:y,capture:Y,children:u(ic,{value:W,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(de,{size:"xs",variant:h==="all"?"secondary":"ghost","aria-pressed":h==="all",onClick:()=>v("all"),children:g("trajectory.filterAll")}),L.map(te=>u(de,{size:"xs",variant:h===te?"secondary":"ghost","aria-pressed":h===te,onClick:()=>v(te),children:g(`trajectory.kinds.${te}`)},te))]}),u(lc,{className:"ml-auto",size:"xs",variant:"outline",pressed:C,onPressedChange:$e,"aria-label":g("trajectory.followLatest"),children:g("trajectory.followLatest")})]}),b("div",{ref:P,className:"min-h-0 flex-1 overflow-auto",onScroll:Le,"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(de,{size:"xs",variant:"outline",disabled:o.loading||a,onClick:et,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(tS,{children:[u(oS,{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")})})]})}),T.map((te,Pe)=>u(nS,{className:"trajectory-chunk [&_tr:last-child]:border-b","data-trajectory-chunk":te[0]?.id??Pe,children:te.map(Q=>{let $=y.has(Q.id),oe=Q.detail!==void 0||Q.toolCallId!==void 0,ve=p(Q);return u(gl,{value:Q.id,children:[b(Of,{"data-trajectory-row-id":Q.id,"data-timeline-row-id":Q.id,className:H(oe&&"cursor-pointer"),onClick:oe?()=>I(Q.id):void 0,children:[u(fi,{className:"whitespace-nowrap text-muted-foreground",title:da(Q.createdAt,l),children:gi(Q.createdAt,l,g)}),u(fi,{className:"whitespace-nowrap",children:g(`trajectory.kinds.${Q.kind}`)}),u(fi,{className:"max-w-0 whitespace-normal",children:b("span",{className:"inline-flex items-start gap-1",children:[oe?u(de,{size:"xs",variant:"ghost",className:"mt-0.5 size-4 min-w-4 shrink-0 px-0","aria-label":g($?"trajectory.collapseRow":"trajectory.expandRow"),"aria-expanded":$,onClick:at=>{at.stopPropagation(),I(Q.id)},children:$?u(un,{"aria-hidden":!0}):u(zo,{"aria-hidden":!0})}):null,u("span",{className:"break-words",children:Q.summary})]})}),u(fi,{className:"whitespace-nowrap",children:g(`trajectory.status.${Q.status}`)}),u(fi,{className:"whitespace-nowrap text-muted-foreground",children:Q.durationMs!==void 0?Ea(Q.durationMs):g("trajectory.valueUnknown")}),u(fi,{className:"whitespace-nowrap",children:ve!==null?b(Ye,{children:[u(Ze,{render:u(de,{size:"xs",variant:"ghost","aria-label":g("trajectory.openInChat"),onClick:at=>{at.stopPropagation(),m(ve)}}),children:u(ns,{"aria-hidden":!0})}),u(Je,{side:"top",children:g("trajectory.openInChat")})]}):null})]},`${t}:${Q.id}`),$&&oe?u(Of,{className:"hover:bg-transparent","data-trajectory-detail-row":Q.id,"data-timeline-row-id":Q.id,children:b(fi,{colSpan:6,className:"whitespace-normal",children:[u("div",{className:"px-2 py-1 text-xs font-medium text-muted-foreground",children:g("trajectory.detailTitle")}),Q.kind==="tool-call"&&Q.toolCallId!==void 0?u(gU,{threadRef:f,useToolCallDetail:c,toolCallId:Q.toolCallId,turnId:Q.turnId,fallback:Q.detail,revision:`${Q.status}:${Q.updatedActivityId??Q.activityId??Q.id}`}):Q.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:Q.detail}):null]})},`${t}:${Q.id}:detail`):null]},`${t}:${Q.id}:owner`)})},`${t}:${te[0]?.id??Pe}`))]}),r!==null?b("div",{className:"flex justify-center gap-2 px-3 py-2",children:[u(de,{size:"xs",variant:"outline",disabled:r.loading||a,onClick:Ge,children:r.loading?g("timeline.loadingLater"):g("timeline.loadLater")}),i===null?null:u(de,{size:"xs",variant:"ghost",onClick:rt,children:g("timeline.returnToLatest")})]}):null]})]})})})});function u0({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(c0,{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})}pe();pe();var vs=Rd(Sc());pe();function v0(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return V(()=>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 lp(e){return"nodeType"in e}function xo(e){var t,n;return e?fs(e)?e:lp(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function dp(e){let{Document:t}=xo(e);return e instanceof t}function Al(e){return fs(e)?!1:e instanceof xo(e).HTMLElement}function ev(e){return e instanceof xo(e).SVGElement}function ps(e){return e?fs(e)?e.document:lp(e)?dp(e)?e:Al(e)||ev(e)?e.ownerDocument:document:document:document}var sr=Ic?he:G;function cp(e){let t=N(e);return sr(()=>{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 y0(){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 El(e,t){t===void 0&&(t=[e]);let n=N(e);return sr(()=>{n.current!==e&&(n.current=e)},t),n}function Rl(e,t){let n=N();return V(()=>{let o=e(n.current);return n.current=o,o},[...t])}function Tc(e){let t=cp(e),n=N(null),o=R(r=>{r!==n.current&&t?.(r,n.current),n.current=r},[]);return[n,o]}function up(e){let t=N();return G(()=>{t.current=e},[e]),t.current}var Zh={};function ms(e,t){return V(()=>{if(t)return t;let n=Zh[e]==null?0:Zh[e]+1;return Zh[e]=n,e+"-"+n},[e,t])}function x0(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=x0(1),hs=x0(-1);function xU(e){return"clientX"in e&&"clientY"in e}function kc(e){if(!e)return!1;let{KeyboardEvent:t}=xo(e.target);return t&&e instanceof t}function CU(e){if(!e)return!1;let{TouchEvent:t}=xo(e.target);return t&&e instanceof t}function Lc(e){if(CU(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 xU(e)?{x:e.clientX,y:e.clientY}:null}var xi=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[xi.Translate.toString(e),xi.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:o}=e;return t+" "+n+"ms "+o}}}),h0="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function C0(e){return e.matches(h0)?e:e.querySelector(h0)}pe();var bU={display:"none"};function b0(e){let{id:t,value:n}=e;return Cn.createElement("div",{id:t,style:bU},n)}function w0(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 Cn.createElement("div",{id:t,style:r,role:"status","aria-live":o,"aria-atomic":!0},n)}function S0(){let[e,t]=J("");return{announce:R(o=>{o!=null&&t(o)},[]),announcement:e}}var O0=wt(null);function wU(e){let t=Kt(O0);G(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function SU(){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 IU={draggable:`
|
|
3757
|
+
`);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 f0=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 d0.filter(we=>ne.has(we))},[n]),S=K(()=>h==="all"?n:n.filter(ne=>ne.kind===h),[n,h]),T=K(()=>bU(S),[S]),I=ne=>x(we=>{let j=new Set(we);return j.has(ne)?j.delete(ne):j.add(ne),j}),k=N(null),E=N(null),P=R(ne=>{k.current=ne,ne&&(E.current=ne)},[]),_=Rt("trajectory-at-end",t,!0),A=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=k.current??E.current;ne&&(A.current=ne.scrollTop,_.current=ne.scrollHeight-ne.scrollTop-ne.clientHeight<=CU,S.length>0&&te(ne,u0(ne)))},[_,S.length,d,te,A]),U=R(()=>B.current.inputKey===t&&B.current.paneVisible,[t]),Y=R(()=>{if(!U()||s===null)return;let ne=k.current;if(!ne||ne.clientHeight<=0)return;let we=u0(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?A.current:ne.scrollTop+j.getBoundingClientRect().top-ne.getBoundingClientRect().top+we.offset}finally{X&&(X.style.contentVisibility=ae??"")}},[G,F,A]),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=k.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=k.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=k.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(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(nS,{children:[u(rS,{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")})})]})}),T.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(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(wU,{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 p0({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(f0,{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 x0(){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 dp(e){return"nodeType"in e}function Co(e){var t,n;return e?ms(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 Rl(e){return ms(e)?!1:e instanceof Co(e).HTMLElement}function Zh(e){return e instanceof Co(e).SVGElement}function gs(e){return e?ms(e)?e.document:dp(e)?cp(e)?e:Rl(e)||Zh(e)?e.ownerDocument:document:document:document}var ur=Tc?he:W;function up(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 C0(){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=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 hs(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 b0(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=b0(1),ys=b0(-1);function kU(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 LU(e){if(!e)return!1;let{TouchEvent:t}=Co(e.target);return t&&e instanceof t}function Pc(e){if(LU(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 kU(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}}}),y0="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function w0(e){return e.matches(y0)?e:e.querySelector(y0)}ue();var PU={display:"none"};function S0(e){let{id:t,value:n}=e;return yn.createElement("div",{id:t,style:PU},n)}function I0(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 T0(){let[e,t]=J("");return{announce:R(o=>{o!=null&&t(o)},[]),announcement:e}}var B0=Ct(null);function AU(e){let t=Ht(B0);W(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function EU(){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 RU={draggable:`
|
|
3736
3758
|
To pick up a draggable item, press the space bar.
|
|
3737
3759
|
While dragging, use the arrow keys to move the item.
|
|
3738
3760
|
Press space again to drop the item in its new position, or press escape to cancel.
|
|
3739
|
-
`},TU={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 kU(e){let{announcements:t=TU,container:n,hiddenTextDescribedById:o,screenReaderInstructions:r=IU}=e,{announce:a,announcement:i}=S0(),s=ms("DndLiveRegion"),[l,d]=J(!1);if(G(()=>{d(!0)},[]),wU(V(()=>({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=Cn.createElement(Cn.Fragment,null,Cn.createElement(b0,{id:o,value:r.draggable}),Cn.createElement(w0,{id:s,announcement:i}));return n?(0,vs.createPortal)(c,n):c}var zn;(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"})(zn||(zn={}));function pp(){}function dv(e,t){return V(()=>({sensor:e,options:t??{}}),[e,t])}function F0(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return V(()=>[...t].filter(o=>o!=null),[...t])}var Er=Object.freeze({x:0,y:0});function B0(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function z0(e,t){let{data:{value:n}}=e,{data:{value:o}}=t;return n-o}function LU(e,t){let{data:{value:n}}=e,{data:{value:o}}=t;return o-n}function I0(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 T0(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 U0=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:o}=e,r=T0(t,t.left,t.top),a=[];for(let i of o){let{id:s}=i,l=n.get(s);if(l){let d=B0(T0(l),r);a.push({id:s,data:{droppableContainer:i,value:d}})}}return a.sort(z0)},H0=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:o}=e,r=I0(t),a=[];for(let i of o){let{id:s}=i,l=n.get(s);if(l){let d=I0(l),c=r.reduce((p,m,g)=>p+B0(d[g],m),0),f=Number((c/4).toFixed(4));a.push({id:s,data:{droppableContainer:i,value:f}})}}return a.sort(z0)};function PU(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 AU=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=PU(s,t);l>0&&r.push({id:i,data:{droppableContainer:a,value:l}})}}return r.sort(LU)};function EU(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function $0(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Er}function RU(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 MU=RU(1);function NU(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 _U(e,t,n){let o=NU(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 DU={ignoreTransform:!1};function Cs(e,t){t===void 0&&(t=DU);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:d,transformOrigin:c}=xo(e).getComputedStyle(e);d&&(n=_U(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 k0(e){return Cs(e,{ignoreTransform:!0})}function OU(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function FU(e,t){return t===void 0&&(t=xo(e).getComputedStyle(e)),t.position==="fixed"}function BU(e,t){t===void 0&&(t=xo(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(dp(r)&&r.scrollingElement!=null&&!n.includes(r.scrollingElement))return n.push(r.scrollingElement),n;if(!Al(r)||ev(r)||n.includes(r))return n;let a=xo(e).getComputedStyle(r);return r!==e&&BU(r,a)&&n.push(r),FU(r,a)?n:o(r.parentNode)}return e?o(e):n}function K0(e){let[t]=Mc(e,1);return t??null}function tv(e){return!Ic||!e?null:fs(e)?e:lp(e)?dp(e)||e===ps(e).scrollingElement?window:Al(e)?e:null:null}function V0(e){return fs(e)?e.scrollX:e.scrollLeft}function q0(e){return fs(e)?e.scrollY:e.scrollTop}function rv(e){return{x:V0(e),y:q0(e)}}var Kn;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Kn||(Kn={}));function W0(e){return!Ic||!e?!1:e===document.scrollingElement}function G0(e){let t={x:0,y:0},n=W0(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 zU={x:.2,y:.2};function UU(e,t,n,o,r){let{top:a,left:i,right:s,bottom:l}=n;o===void 0&&(o=10),r===void 0&&(r=zU);let{isTop:d,isBottom:c,isLeft:f,isRight:p}=G0(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=Kn.Backward,g.y=o*Math.abs((t.top+h.height-a)/h.height)):!c&&l>=t.bottom-h.height&&(m.y=Kn.Forward,g.y=o*Math.abs((t.bottom-h.height-l)/h.height)),!p&&s>=t.right-h.width?(m.x=Kn.Forward,g.x=o*Math.abs((t.right-h.width-s)/h.width)):!f&&i<=t.left+h.width&&(m.x=Kn.Backward,g.x=o*Math.abs((t.left+h.width-i)/h.width)),{direction:m,speed:g}}function HU(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 j0(e){return e.reduce((t,n)=>gs(t,rv(n)),Er)}function $U(e){return e.reduce((t,n)=>t+V0(n),0)}function KU(e){return e.reduce((t,n)=>t+q0(n),0)}function VU(e,t){if(t===void 0&&(t=Cs),!e)return;let{top:n,left:o,bottom:r,right:a}=t(e);K0(e)&&(r<=0||a<=0||n>=window.innerHeight||o>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}var qU=[["x",["left","right"],$U],["y",["top","bottom"],KU]],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=j0(o);this.rect={...t},this.width=t.width,this.height=t.height;for(let[a,i,s]of qU)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 WU(e){let{EventTarget:t}=xo(e);return e instanceof t?e:ps(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 lr;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(lr||(lr={}));function L0(e){e.preventDefault()}function GU(e){e.stopPropagation()}var It;(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"})(It||(It={}));var Q0={start:[It.Space,It.Enter],cancel:[It.Esc],end:[It.Space,It.Enter,It.Tab]},jU=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case It.Right:return{...n,x:n.x+25};case It.Left:return{...n,x:n.x-25};case It.Down:return{...n,y:n.y+25};case It.Up:return{...n,y:n.y-25}}},Ml=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(xo(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(lr.Resize,this.handleCancel),this.windowListeners.add(lr.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(lr.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:t,onStart:n}=this.props,o=t.node.current;o&&VU(o),n(Er)}handleKeyDown(t){if(kc(t)){let{active:n,context:o,options:r}=this.props,{keyboardCodes:a=Q0,coordinateGetter:i=jU,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}:Er;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}=G0(h),T=HU(h),I={x:Math.min(v===It.Right?T.right-T.width/2:T.right,Math.max(v===It.Right?T.left:T.left+T.width/2,f.x)),y:Math.min(v===It.Down?T.bottom-T.height/2:T.bottom,Math.max(v===It.Down?T.top:T.top+T.height/2,f.y))},k=v===It.Right&&!x||v===It.Left&&!C,E=v===It.Down&&!w||v===It.Up&&!y;if(k&&I.x!==f.x){let P=h.scrollLeft+p.x,_=v===It.Right&&P<=L.x||v===It.Left&&P>=S.x;if(_&&!p.y){h.scrollTo({left:P,behavior:s});return}_?m.x=h.scrollLeft-P:m.x=v===It.Right?h.scrollLeft-L.x:h.scrollLeft-S.x,m.x&&h.scrollBy({left:-m.x,behavior:s});break}else if(E&&I.y!==f.y){let P=h.scrollTop+p.y,_=v===It.Down&&P<=L.y||v===It.Up&&P>=S.y;if(_&&!p.x){h.scrollTo({top:P,behavior:s});return}_?m.y=h.scrollTop-P:m.y=v===It.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()}};Ml.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:o=Q0,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 P0(e){return!!(e&&"distance"in e)}function A0(e){return!!(e&&"delay"in e)}var Ec=class{constructor(t,n,o){var r;o===void 0&&(o=WU(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(xo(i)),this.initialCoordinates=(r=Lc(a))!=null?r:Er,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(lr.Resize,this.handleCancel),this.windowListeners.add(lr.DragStart,L0),this.windowListeners.add(lr.VisibilityChange,this.handleCancel),this.windowListeners.add(lr.ContextMenu,L0),this.documentListeners.add(lr.Keydown,this.handleKeydown),n){if(o!=null&&o({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(A0(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(P0(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(lr.Click,GU,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(lr.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:Er,d=hs(r,l);if(!o&&s){if(P0(s)){if(s.tolerance!=null&&nv(d,s.tolerance))return this.handleCancel();if(nv(d,s.distance))return this.handleStart()}if(A0(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===It.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}},QU={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}},Nl=class extends Ec{constructor(t){let{event:n}=t,o=ps(n.target);super(t,QU,o)}};Nl.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 XU={move:{name:"mousemove"},end:{name:"mouseup"}},av;(function(e){e[e.RightClick=2]="RightClick"})(av||(av={}));var iv=class extends Ec{constructor(t){super(t,XU,ps(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 Ec{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 Pc;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Pc||(Pc={}));var mp;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(mp||(mp={}));function YU(e){let{acceleration:t,activator:n=Pc.Pointer,canScroll:o,draggingRect:r,enabled:a,interval:i=5,order:s=mp.TreeOrder,pointerCoordinates:l,scrollableAncestors:d,scrollableAncestorRects:c,delta:f,threshold:p}=e,m=ZU({delta:f,disabled:!a}),[g,h]=y0(),v=N({x:0,y:0}),y=N({x:0,y:0}),x=V(()=>{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 T=v.current.x*y.current.x,I=v.current.y*y.current.y;S.scrollBy(T,I)},[]),L=V(()=>s===mp.TreeOrder?[...d].reverse():d,[s,d]);G(()=>{if(!a||!d.length||!x){h();return}for(let S of L){if(o?.(S)===!1)continue;let T=d.indexOf(S),I=c[T];if(!I)continue;let{direction:k,speed:E}=UU(S,I,x,t,p);for(let P of["x","y"])m[P][k[P]]||(E[P]=0,k[P]=0);if(E.x>0||E.y>0){h(),C.current=S,g(w,i),v.current=E,y.current=k;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 JU={x:{[Kn.Backward]:!1,[Kn.Forward]:!1},y:{[Kn.Backward]:!1,[Kn.Forward]:!1}};function ZU(e){let{delta:t,disabled:n}=e,o=up(t);return Rl(r=>{if(n||!o||!r)return JU;let a={x:Math.sign(t.x-o.x),y:Math.sign(t.y-o.y)};return{x:{[Kn.Backward]:r.x[Kn.Backward]||a.x===-1,[Kn.Forward]:r.x[Kn.Forward]||a.x===1},y:{[Kn.Backward]:r.y[Kn.Backward]||a.y===-1,[Kn.Forward]:r.y[Kn.Forward]||a.y===1}}},[n,t,o])}function e5(e,t){let n=t!=null?e.get(t):void 0,o=n?n.node.current:null;return Rl(r=>{var a;return t==null?null:(a=o??r)!=null?a:null},[o,t])}function t5(e,t){return V(()=>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 lv;(function(e){e.Optimized="optimized"})(lv||(lv={}));var E0=new Map;function n5(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=El(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=Rl(y=>{if(f&&!n)return E0;if(!y||y===E0||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 G(()=>{c.current=e},[e]),G(()=>{f||m()},[n,f]),G(()=>{a&&a.length>0&&i(null)},[JSON.stringify(a)]),G(()=>{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 X0(e,t){return Rl(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function o5(e,t){return X0(e,t)}function r5(e){let{callback:t,disabled:n}=e,o=cp(t),r=V(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;let{MutationObserver:a}=window;return new a(o)},[o,n]);return G(()=>()=>r?.disconnect(),[r]),r}function gp(e){let{callback:t,disabled:n}=e,o=cp(t),r=V(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;let{ResizeObserver:a}=window;return new a(o)},[n]);return G(()=>()=>r?.disconnect(),[r]),r}function a5(e){return new Ac(Cs(e),e)}function R0(e,t,n){t===void 0&&(t=a5);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=r5({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=gp({callback:a});return sr(()=>{a(),e?(s?.observe(e),i?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),i?.disconnect())},[e]),o}function i5(e){let t=X0(e);return $0(e,t)}var M0=[];function s5(e){let t=N(e),n=Rl(o=>e?o&&o!==M0&&e&&t.current&&e.parentNode===t.current.parentNode?o:Mc(e):M0,[e]);return G(()=>{t.current=e},[e]),n}function l5(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 G(()=>{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]),V(()=>e.length?t?Array.from(t.values()).reduce((a,i)=>gs(a,i),Er):j0(e):Er,[e,t])}function N0(e,t){t===void 0&&(t=[]);let n=N(null);return G(()=>{n.current=null},t),G(()=>{let o=e!==Er;o&&!n.current&&(n.current=e),!o&&n.current&&(n.current=null)},[e]),n.current?hs(e,n.current):Er}function d5(e){G(()=>{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 c5(e,t){return V(()=>e.reduce((n,o)=>{let{eventName:r,handler:a}=o;return n[r]=i=>{a(i,t)},n},{}),[e,t])}function Y0(e){return V(()=>e?OU(e):null,[e])}var _0=[];function u5(e,t){t===void 0&&(t=Cs);let[n]=e,o=Y0(n?xo(n):null),[r,a]=J(_0);function i(){a(()=>e.length?e.map(l=>W0(l)?o:new Ac(t(l),l)):_0)}let s=gp({callback:i});return sr(()=>{s?.disconnect(),i(),e.forEach(l=>s?.observe(l))},[e]),r}function f5(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return Al(t)?t:e}function p5(e){let{measure:t}=e,[n,o]=J(null),r=R(d=>{for(let{target:c}of d)if(Al(c)){o(f=>{let p=t(c);return f?{...f,width:p.width,height:p.height}:p});break}},[t]),a=gp({callback:r}),i=R(d=>{let c=f5(d);a?.disconnect(),c&&a?.observe(c),o(c?t(c):null)},[t,a]),[s,l]=Tc(i);return V(()=>({nodeRef:s,rect:n,setRef:l}),[n,s,l])}var m5=[{sensor:Nl,options:{}},{sensor:Ml,options:{}}],g5={current:{}},fp={draggable:{measure:k0},droppable:{measure:k0,strategy:Rc.WhileDragging,frequency:lv.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}},h5={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:pp},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:fp,measureDroppableContainers:pp,windowRect:null,measuringScheduled:!1},v5={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:pp,draggableNodes:new Map,over:null,measureDroppableContainers:pp},hp=wt(v5),J0=wt(h5);function y5(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new xs}}}function x5(e,t){switch(t.type){case zn.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case zn.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 zn.DragEnd:case zn.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case zn.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 zn.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 zn.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 C5(e){let{disabled:t}=e,{active:n,activatorEvent:o,draggableNodes:r}=Kt(hp),a=up(o),i=up(n?.id);return G(()=>{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=C0(c);if(f){f.focus();break}}})}},[o,t,r,i,a]),null}function b5(e,t){let{transform:n,...o}=t;return e!=null&&e.length?e.reduce((r,a)=>a({transform:r,...o}),n):n}function w5(e){return V(()=>({draggable:{...fp.draggable,...e?.draggable},droppable:{...fp.droppable,...e?.droppable},dragOverlay:{...fp.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function S5(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;sr(()=>{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=$0(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=K0(d);p&&p.scrollBy({top:f.y,left:f.x})}},[t,i,s,o,n])}var Z0=wt({...Er,scaleX:1,scaleY:1}),Ci;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(Ci||(Ci={}));var eT=me(function(t){var n,o,r,a;let{id:i,accessibility:s,autoScroll:l=!0,children:d,sensors:c=m5,collisionDetection:f=AU,measuring:p,modifiers:m,...g}=t,h=La(x5,void 0,y5),[v,y]=h,[x,C]=SU(),[w,L]=J(Ci.Uninitialized),S=w===Ci.Initialized,{draggable:{active:T,nodes:I,translate:k},droppable:{containers:E}}=v,P=T!=null?I.get(T):null,_=N({initial:null,translated:null}),A=V(()=>{var ke;return T!=null?{id:T,data:(ke=P?.data)!=null?ke:g5,rect:_}:null},[T,P]),B=N(null),[z,q]=J(null),[X,Se]=J(null),K=El(g,Object.values(g)),W=ms("DndDescribedBy",i),Z=V(()=>E.getEnabled(),[E]),j=w5(p),{droppableRects:O,measureDroppableContainers:Y,measuringScheduled:re}=n5(Z,{dragging:S,dependencies:[k.x,k.y],config:j.droppable}),ue=e5(I,T),le=V(()=>X?Lc(X):null,[X]),fe=be(),ae=o5(ue,j.draggable.measure);S5({activeNode:T!=null?I.get(T):null,config:fe.layoutShiftCompensation,initialRect:ae,measure:j.draggable.measure});let Le=R0(ue,j.draggable.measure,ae),et=R0(ue?ue.parentElement:null),Ge=N({activatorEvent:null,active:null,activeNode:ue,collisionRect:null,collisions:null,droppableRects:O,draggableNodes:I,draggingNode:null,draggingNodeRect:null,droppableContainers:E,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),rt=E.getNodeFor((n=Ge.current.over)==null?void 0:n.id),$e=p5({measure:j.dragOverlay.measure}),te=(o=$e.nodeRef.current)!=null?o:ue,Pe=S?(r=$e.rect)!=null?r:Le:null,Q=!!($e.nodeRef.current&&$e.rect),$=i5(Q?null:Le),oe=Y0(te?xo(te):null),ve=s5(S?rt??ue:null),at=u5(ve),Et=b5(m,{transform:{x:k.x-$.x,y:k.y-$.y,scaleX:1,scaleY:1},activatorEvent:X,active:A,activeNodeRect:Le,containerNodeRect:et,draggingNodeRect:Pe,over:Ge.current.over,overlayNodeRect:$e.rect,scrollableAncestors:ve,scrollableAncestorRects:at,windowRect:oe}),Rt=le?gs(le,k):null,_t=l5(ve),an=N0(_t),mt=N0(_t,[Le]),Wt=gs(Et,an),Ot=Pe?MU(Pe,Et):null,vt=A&&Ot?f({active:A,collisionRect:Ot,droppableRects:O,droppableContainers:Z,pointerCoordinates:Rt}):null,Sn=cv(vt,"id"),[ft,pn]=J(null),no=Q?Et:gs(Et,mt),Xt=EU(no,(a=ft?.rect)!=null?a:null,Le),In=N(null),En=R((ke,Re)=>{let{sensor:st,options:ln}=Re;if(B.current==null)return;let vn=I.get(B.current);if(!vn)return;let ct=ke.nativeEvent,kt=new st({active:B.current,activeNode:vn,event:ct,options:ln,context:Ge,onAbort(Pt){if(!I.get(Pt))return;let{onDragAbort:ht}=K.current,we={id:Pt};ht?.(we),x({type:"onDragAbort",event:we})},onPending(Pt,Ut,ht,we){if(!I.get(Pt))return;let{onDragPending:qe}=K.current,We={id:Pt,constraint:Ut,initialCoordinates:ht,offset:we};qe?.(We),x({type:"onDragPending",event:We})},onStart(Pt){let Ut=B.current;if(Ut==null)return;let ht=I.get(Ut);if(!ht)return;let{onDragStart:we}=K.current,Ve={activatorEvent:ct,active:{id:Ut,data:ht.data,rect:_}};(0,vs.unstable_batchedUpdates)(()=>{we?.(Ve),L(Ci.Initializing),y({type:zn.DragStart,initialCoordinates:Pt,active:Ut}),x({type:"onDragStart",event:Ve}),q(In.current),Se(ct)})},onMove(Pt){y({type:zn.DragMove,coordinates:Pt})},onEnd:Ft(zn.DragEnd),onCancel:Ft(zn.DragCancel)});In.current=kt;function Ft(Pt){return async function(){let{active:ht,collisions:we,over:Ve,scrollAdjustedTranslate:qe}=Ge.current,We=null;if(ht&&qe){let{cancelDrop:ot}=K.current;We={activatorEvent:ct,active:ht,collisions:we,delta:qe,over:Ve},Pt===zn.DragEnd&&typeof ot=="function"&&await Promise.resolve(ot(We))&&(Pt=zn.DragCancel)}B.current=null,(0,vs.unstable_batchedUpdates)(()=>{y({type:Pt}),L(Ci.Uninitialized),pn(null),q(null),Se(null),In.current=null;let ot=Pt===zn.DragEnd?"onDragEnd":"onDragCancel";if(We){let yt=K.current[ot];yt?.(We),x({type:ot,event:We})}})}}},[I]),sn=R((ke,Re)=>(st,ln)=>{let vn=st.nativeEvent,ct=I.get(ln);if(B.current!==null||!ct||vn.dndKit||vn.defaultPrevented)return;let kt={active:ct};ke(st,Re.options,kt)===!0&&(vn.dndKit={capturedBy:Re.sensor},B.current=ln,En(st,Re))},[I,En]),Rn=t5(c,sn);d5(c),sr(()=>{Le&&w===Ci.Initializing&&L(Ci.Initialized)},[Le,w]),G(()=>{let{onDragMove:ke}=K.current,{active:Re,activatorEvent:st,collisions:ln,over:vn}=Ge.current;if(!Re||!st)return;let ct={active:Re,activatorEvent:st,collisions:ln,delta:{x:Wt.x,y:Wt.y},over:vn};(0,vs.unstable_batchedUpdates)(()=>{ke?.(ct),x({type:"onDragMove",event:ct})})},[Wt.x,Wt.y]),G(()=>{let{active:ke,activatorEvent:Re,collisions:st,droppableContainers:ln,scrollAdjustedTranslate:vn}=Ge.current;if(!ke||B.current==null||!Re||!vn)return;let{onDragOver:ct}=K.current,kt=ln.get(Sn),Ft=kt&&kt.rect.current?{id:kt.id,rect:kt.rect.current,data:kt.data,disabled:kt.disabled}:null,Pt={active:ke,activatorEvent:Re,collisions:st,delta:{x:vn.x,y:vn.y},over:Ft};(0,vs.unstable_batchedUpdates)(()=>{pn(Ft),ct?.(Pt),x({type:"onDragOver",event:Pt})})},[Sn]),sr(()=>{Ge.current={activatorEvent:X,active:A,activeNode:ue,collisionRect:Ot,collisions:vt,droppableRects:O,draggableNodes:I,draggingNode:te,draggingNodeRect:Pe,droppableContainers:E,over:ft,scrollableAncestors:ve,scrollAdjustedTranslate:Wt},_.current={initial:Pe,translated:Ot}},[A,ue,vt,Ot,I,te,Pe,O,E,ft,ve,Wt]),YU({...fe,delta:k,draggingRect:Ot,pointerCoordinates:Rt,scrollableAncestors:ve,scrollableAncestorRects:at});let F=V(()=>({active:A,activeNode:ue,activeNodeRect:Le,activatorEvent:X,collisions:vt,containerNodeRect:et,dragOverlay:$e,draggableNodes:I,droppableContainers:E,droppableRects:O,over:ft,measureDroppableContainers:Y,scrollableAncestors:ve,scrollableAncestorRects:at,measuringConfiguration:j,measuringScheduled:re,windowRect:oe}),[A,ue,Le,X,vt,et,$e,I,E,O,ft,Y,ve,at,j,re,oe]),ce=V(()=>({activatorEvent:X,activators:Rn,active:A,activeNodeRect:Le,ariaDescribedById:{draggable:W},dispatch:y,draggableNodes:I,over:ft,measureDroppableContainers:Y}),[X,Rn,A,Le,y,W,I,ft,Y]);return Cn.createElement(O0.Provider,{value:C},Cn.createElement(hp.Provider,{value:ce},Cn.createElement(J0.Provider,{value:F},Cn.createElement(Z0.Provider,{value:Xt},d)),Cn.createElement(C5,{disabled:s?.restoreFocus===!1})),Cn.createElement(kU,{...s,hiddenTextDescribedById:W}));function be(){let ke=z?.autoScrollEnabled===!1,Re=typeof l=="object"?l.enabled===!1:l===!1,st=S&&!ke&&!Re;return typeof l=="object"?{...l,enabled:st}:{enabled:st}}}),I5=wt(null),D0="button",T5="Draggable";function tT(e){let{id:t,data:n,disabled:o=!1,attributes:r}=e,a=ms(T5),{activators:i,activatorEvent:s,active:l,activeNodeRect:d,ariaDescribedById:c,draggableNodes:f,over:p}=Kt(hp),{role:m=D0,roleDescription:g="draggable",tabIndex:h=0}=r??{},v=l?.id===t,y=Kt(v?Z0:I5),[x,C]=Tc(),[w,L]=Tc(),S=c5(i,t),T=El(n);sr(()=>(f.set(t,{id:t,key:a,node:x,activatorNode:w,data:T}),()=>{let k=f.get(t);k&&k.key===a&&f.delete(t)}),[f,t]);let I=V(()=>({role:m,tabIndex:h,"aria-disabled":o,"aria-pressed":v&&m===D0?!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 nT(){return Kt(J0)}var k5="Droppable",L5={timeout:25};function oT(e){let{data:t,disabled:n=!1,id:o,resizeObserverConfig:r}=e,a=ms(k5),{active:i,dispatch:s,over:l,measureDroppableContainers:d}=Kt(hp),c=N({disabled:n}),f=N(!1),p=N(null),m=N(null),{disabled:g,updateMeasurementsFor:h,timeout:v}={...L5,...r},y=El(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=gp({callback:x,disabled:g||!i}),w=R((I,k)=>{C&&(k&&(C.unobserve(k),f.current=!1),I&&C.observe(I))},[C]),[L,S]=Tc(w),T=El(t);return G(()=>{!C||!L.current||(C.disconnect(),f.current=!1,C.observe(L.current))},[L,C]),G(()=>(s({type:zn.RegisterDroppable,element:{id:o,key:a,disabled:n,node:L,rect:p,data:T}}),()=>s({type:zn.UnregisterDroppable,key:a,id:o})),[o]),G(()=>{n!==c.current.disabled&&(s({type:zn.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}}pe();function rT(e,t,n){let o=e.slice();return o.splice(n<0?o.length+n:n,0,o.splice(t,1)[0]),o}function P5(e,t){return e.reduce((n,o,r)=>{let a=t.get(o);return a&&(n[r]=a),n},Array(e.length))}function vp(e){return e!==null&&e>=0}function A5(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 E5(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}var aT=e=>{let{rects:t,activeIndex:n,overIndex:o,index:r}=e,a=rT(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 yp={scaleX:1,scaleY:1},iT=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,...yp}:null}let l=R5(a,r,n);return r>n&&r<=i?{x:0,y:-s.height-l,...yp}:r<n&&r>=i?{x:0,y:s.height+l,...yp}:{x:0,y:0,...yp}};function R5(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 sT="Sortable",lT=Cn.createContext({activeIndex:-1,containerId:sT,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:aT,disabled:{draggable:!1,droppable:!1}});function dT(e){let{children:t,id:n,items:o,strategy:r=aT,disabled:a=!1}=e,{active:i,dragOverlay:s,droppableRects:l,over:d,measureDroppableContainers:c}=nT(),f=ms(sT,n),p=s.rect!==null,m=V(()=>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=!A5(m,y.current),C=v!==-1&&h===-1||x,w=E5(a);sr(()=>{x&&g&&c(m)},[x,m,g,c]),G(()=>{y.current=m},[m]);let L=V(()=>({activeIndex:h,containerId:f,disabled:w,disableTransforms:C,items:m,overIndex:v,useDragOverlay:p,sortedRects:P5(m,l),strategy:r}),[h,f,w.draggable,w.droppable,C,m,v,l,p,r]);return Cn.createElement(lT.Provider,{value:L},t)}var M5=e=>{let{id:t,items:n,activeIndex:o,overIndex:r}=e;return rT(n,o,r).indexOf(t)},N5=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},_5={duration:200,easing:"ease"},cT="transform",D5=xi.Transition.toString({property:cT,duration:0,easing:"linear"}),O5={roleDescription:"sortable"};function F5(e){let{disabled:t,index:n,node:o,rect:r}=e,[a,i]=J(null),s=N(n);return sr(()=>{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]),G(()=>{a&&i(null)},[a]),a}function uT(e){let{animateLayoutChanges:t=N5,attributes:n,disabled:o,data:r,getNewIndex:a=M5,id:i,strategy:s,resizeObserverConfig:l,transition:d=_5}=e,{items:c,containerId:f,activeIndex:p,disabled:m,disableTransforms:g,sortedRects:h,overIndex:v,useDragOverlay:y,strategy:x}=Kt(lT),C=B5(o,m),w=c.indexOf(i),L=V(()=>({sortable:{containerId:f,index:w,items:c},...r}),[f,r,w,c]),S=V(()=>c.slice(c.indexOf(i)),[c,i]),{rect:T,node:I,isOver:k,setNodeRef:E}=oT({id:i,data:L,disabled:C.droppable,resizeObserverConfig:{updateMeasurementsFor:S,...l}}),{active:P,activatorEvent:_,activeNodeRect:A,attributes:B,setNodeRef:z,listeners:q,isDragging:X,over:Se,setActivatorNodeRef:K,transform:W}=tT({id:i,data:L,attributes:{...O5,...n},disabled:C.draggable}),Z=v0(E,z),j=!!P,O=j&&!g&&vp(p)&&vp(v),Y=!y&&X,re=Y&&O?W:null,le=O?re??(s??x)({rects:h,activeNodeRect:A,activeIndex:p,overIndex:v,index:w}):null,fe=vp(p)&&vp(v)?a({id:i,items:c,activeIndex:p,overIndex:v}):w,ae=P?.id,Le=N({activeId:ae,items:c,newIndex:fe,containerId:f}),et=c!==Le.current.items,Ge=t({active:P,containerId:f,isDragging:X,isSorting:j,id:i,index:w,items:c,newIndex:Le.current.newIndex,previousItems:Le.current.items,previousContainerId:Le.current.containerId,transition:d,wasDragging:Le.current.activeId!=null}),rt=F5({disabled:!Ge,index:w,node:I,rect:T});return G(()=>{j&&Le.current.newIndex!==fe&&(Le.current.newIndex=fe),f!==Le.current.containerId&&(Le.current.containerId=f),c!==Le.current.items&&(Le.current.items=c)},[j,fe,f,c]),G(()=>{if(ae===Le.current.activeId)return;if(ae!=null&&Le.current.activeId==null){Le.current.activeId=ae;return}let te=setTimeout(()=>{Le.current.activeId=ae},50);return()=>clearTimeout(te)},[ae]),{active:P,activeIndex:p,attributes:B,data:L,rect:T,index:w,newIndex:fe,items:c,isOver:k,isSorting:j,isDragging:X,listeners:q,node:I,overIndex:v,over:Se,setNodeRef:Z,setActivatorNodeRef:K,setDroppableNodeRef:E,setDraggableNodeRef:z,transform:rt??le,transition:$e()};function $e(){if(rt||et&&Le.current.newIndex===w)return D5;if(!(Y&&!kc(_)||!d)&&(j||Ge))return xi.Transition.toString({...d,property:cT})}}function B5(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 xp(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 z5=[It.Down,It.Right,It.Up,It.Left],fT=(e,t)=>{let{context:{active:n,collisionRect:o,droppableRects:r,droppableContainers:a,over:i,scrollableAncestors:s}}=t;if(z5.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 It.Down:o.top<p.top&&l.push(f);break;case It.Up:o.top>p.top&&l.push(f);break;case It.Left:o.left>p.left&&l.push(f);break;case It.Right:o.left<p.left&&l.push(f);break}});let d=H0({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=Mc(g).some((S,T)=>s[T]!==S),y=pT(f,p),x=U5(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 pT(e,t){return!xp(e)||!xp(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function U5(e,t){return!xp(e)||!xp(t)||!pT(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}function H5(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 mT=e=>{let{draggingNodeRect:t,transform:n,scrollableAncestorRects:o}=e,r=o[0];return!t||!r?n:H5(n,t,r)},gT=e=>{let{transform:t}=e;return{...t,x:0}};pe();pe();var Cp={"2xl":1536,"3xl":1600,"4xl":2e3,lg:1024,md:768,sm:640,xl:1280};function hT(e){return`(min-width: ${typeof e=="number"?e:Cp[e]}px)`}function vT(e){return`(max-width: ${(typeof e=="number"?e:Cp[e])-1}px)`}function $5(e){if(typeof e!="string"){let n=[];return e.min!=null&&n.push(hT(e.min)),e.max!=null&&n.push(vT(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 Cp&&t.push(vT(o))}else n in Cp&&t.push(hT(n));return t.length>0?t.join(" and "):e}function K5(){return!1}function bp(e){let t=$5(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 Bo(n,o,K5)}pe();var io=new Map;function V5(e,t,n){return`${e}\0${t}\0${n??"none"}`}function uv(e,t){io.delete(e),io.set(e,t)}function _l(e,t){if(io.get(e)===t){if(t.operationLeases>0){t.disposeRequested=!0;return}t.releaseAuthorityWatch?.(),t.releaseAuthorityWatch=void 0,io.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 q5(e){if(io.size<=100)return;let t=Array.from(io);for(let[n,o]of t){if(io.size<=100)return;n===e||o.committed||o.listeners.size>0||o.operationLeases>0||_l(n,o)}for(let[n,o]of t){if(io.size<=100)return;n===e||o.listeners.size>0||o.operationLeases>0||_l(n,o)}}function wp(){queueMicrotask(()=>q5())}function yT(e,t,n,o,r=void 0){let a=n.management?.revision??null,i=V5(e,n.intentId,a),s=io.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 io.set(i,d),l}function xT(e,t){let n=io.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:()=>_l(e,n)})),n.committed=!0,uv(e,n),n.listeners.add(t),wp(),()=>{n.listeners.delete(t),wp()}):()=>{}}function bs(e,t){let n=io.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 Sp(e){return io.get(e)?.state}function CT(e){let t=io.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){_l(e,t);return}wp()}}}function Ip(e){let t=io.get(e);t&&_l(e,t)}function bT(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 io)r.state.inputKey===e&&n.get(r.state.intentId)!==r.state.revision&&_l(o,r);wp()}function wT({entry:e,current:t,inputKey:n,environmentId:o,unavailable:r,attachments:a,watchEditorAuthority:i,onEdit:s,onClose:l}){let{t:d}=Jn(),c=yT(n,o,e,a,i),f=Bo(P=>xT(c.key,P),()=>Sp(c.key)??c,()=>Sp(c.key)??c),{key:p,text:m,retained:g,added:h,saving:v,error:y}=f,x=N(null),C=a.useUploadStatuses(),w=V(()=>g.map(P=>P.id),[g]),L=a.useAssetUrls(o,w),S=!t?.management||t.management.revision!==e.management?.revision;G(()=>{t===void 0&&(Ip(p),l())},[t,p,l]);let T=()=>{v||(Ip(p),l())},I=P=>{if(v||r||S)return;let _=null,A=[...h];for(let B of P){let z=B.type||"application/octet-stream";if(g.length+A.length>=a.limits.maxAttachments||B.size===0||B.size>a.maxAttachmentBytes(z)){_=d("turnQueue.attachmentLimit",{name:B.name,count:a.limits.maxAttachments,size:a.formatAttachmentSize(a.maxAttachmentBytes(z))});continue}let q=a.makeImageAttachment({id:a.randomUUID(),name:B.name,mimeType:z,sizeBytes:B.size,file:B});A.push(q),a.startUpload({environmentId:o,image:q})}bs(p,B=>({...B,added:A,error:_}))},k=async()=>{let P=Sp(p);if(!P||P.saving||r||S||!P.text.trim()&&P.retained.length+P.added.length===0)return;let _=CT(p);if(_!==null){bs(p,A=>({...A,saving:!0,error:null}));try{await a.awaitUploads(P.added.map(B=>B.id));let A=a.getUploadedAttachments({environmentId:o,images:P.added});if(!A)throw new Error(d("turnQueue.uploadFailed"));await s(e,{text:P.text,attachments:[...P.retained,...A]}),Ip(p),l()}catch(A){bs(p,B=>({...B,saving:!1,error:A instanceof Error?A.message:d("turnQueue.actionFailed")}))}finally{_()}}},E=[...g.map((P,_)=>({...P,previewUrl:L[_],added:!1})),...h.map(P=>({...P,added:!0}))];return u(Ef,{open:!0,onOpenChange:P=>{P||T()},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(Vw,{"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(),k())}}),u("ul",{className:"flex flex-wrap gap-2",children:E.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(ho,{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(de,{size:"xs",variant:"ghost",disabled:v||r||S,onClick:()=>{let _=h.find(A=>A.id===P.id);_&&a.retryUpload({environmentId:o,image:_})},children:d("turnQueue.retryUpload")}):null]}),u(de,{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(A=>A.id!==P.id)}))):bs(p,_=>({..._,retained:_.retained.filter(A=>A.id!==P.id)}))},children:u(nn,{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(de,{size:"sm",variant:"outline",disabled:v||r||S,onClick:()=>x.current?.click(),children:[u(ho,{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(de,{variant:"ghost",disabled:v,onClick:T,children:d("turnQueue.discardEdit")}),u(de,{disabled:v||r||S||!m.trim()&&E.length===0,onClick:()=>{k()},children:d(v?"turnQueue.saving":"turnQueue.saveEdit")})]})]})})}function ST(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 IT(e,t,n){if(t===n)return null;let o={intentId:t,beforeIntentId:n,previousOrder:e.map(a=>a.intentId)};return ST(e,o).every((a,i)=>a.intentId===e[i]?.intentId)?null:o}function TT(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:ST(e,t),settled:!1}}pe();pe();function W5({entry:e,unavailable:t,onCancel:n}){let{t:o}=Jn(),r=N(!1),[a,i]=J(!1),[s,l]=J(!1),[d,c]=J(!1);G(()=>{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(de,{size:"xs",variant:"outline",disabled:a||t,onClick:()=>{f()},children:o("turnQueue.confirmAbandon")}),u(de,{size:"xs",variant:"ghost",disabled:a,onClick:()=>c(!1),children:o("turnQueue.keepWaiting")})]})]}):u(de,{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 kT({entries:e,unavailable:t,onCancel:n}){let{t:o}=Jn(),[r,a]=J(!1),i=oa();return e.length===0?null:b("div",{className:"min-w-0 basis-full space-y-2",children:[u(de,{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(W5,{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}=Jn(),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);G(()=>{e.paused||c(!1)},[e.paused]);let x=o?.[0];G(()=>{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 k=x;f.current=!0,h(!0),y(null);try{await r(k),m(!1)}catch{y(k.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"),T=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:T}),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(de,{size:"xs",variant:"outline",disabled:s,softDisabled:t,onClick:()=>{I()},children:a(s?"turnQueue.resuming":"turnQueue.resume")}):null,w?b(Te,{children:[u(de,{size:"xs",variant:"outline",disabled:g,softDisabled:t,onClick:()=>m(!0),children:a("turnQueue.stopWaiting")}),u(Gw,{open:p,onOpenChange:k=>{k||m(!1)},children:b(Jw,{className:"max-w-lg",children:[b(Yw,{children:[u(Zw,{children:a("turnQueue.stopWaiting")}),u(Qw,{children:a("turnQueue.abandonDescription")})]}),b(Xw,{children:[u(jw,{render:u(de,{variant:"ghost"}),children:a("turnQueue.keepWaiting")}),u(de,{variant:"outline",disabled:g||t,onClick:()=>{L()},children:a(g?"turnQueue.cancelling":"turnQueue.confirmAbandon")})]})]})})]}):null,r&&o?u(kT,{entries:o.filter(k=>k.status!=="queued"),unavailable:t,onCancel:r}):null]})}var G5=[gT,mT],j5=[];function Q5({submission:e}){let{t}=Jn();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(ho,{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 X5({entry:e,disabled:t,dropPosition:n,dragPosition:o,feedback:r,reducedMotion:a,children:i}){let{t:s}=Jn(),{attributes:l,listeners:d,setNodeRef:c,setActivatorNodeRef:f,transform:p,transition:m,isDragging:g}=uT({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:xi.Transform.toString(p),transition:m},className:H("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:H("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(de,{ref:f,size:"icon-xs",variant:"ghost",className:H("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(go,{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 LT({inputKey:e,entries:t,pendingSubmissions:n=j5,environmentId:o,unavailable:r,attachments:a,actions:i,onCancel:s}){let{t:l}=Jn(),d=bp("(prefers-reduced-motion: reduce)"),[c,f]=fn("turn-queue:editing",e,null),[p,m]=fn("turn-queue:pending",e,!1),g=Nt("turn-queue:pending-ref",e,!1),[h,v]=fn("turn-queue:error",e,null),[y,x]=fn("turn-queue:drag",e,null),[C,w]=fn("turn-queue:move",e,null),L=Nt("turn-queue:reorder-ref",e,!1),[S,T]=fn("turn-queue:feedback",e,null),I=F0(dv(Nl,{activationConstraint:{distance:5}}),dv(Ml,{coordinateGetter:fT,scrollBehavior:d?"auto":"smooth"})),k=V(()=>t.filter(K=>K.waiting),[t]),E=C?TT(k,C.preview):null,P=E?.entries??k,_=P.length+n.length,A=r||p||C!==null,B=P.findIndex(K=>K.intentId===y?.activeId),z=P.findIndex(K=>K.intentId===y?.overId);G(()=>{bT(e,t)},[t,e]),G(()=>{C!==null&&(r||C.acknowledged&&E?.settled)&&(L.current=!1,w(null),!r&&k.some(K=>K.intentId===C.preview.intentId)&&T({intentId:C.preview.intentId,kind:"saved"}))},[k,C,E?.settled,r]),G(()=>{if(S===null||S.kind==="failed")return;let K=window.setTimeout(()=>T(W=>W===S?null:W),1600);return()=>window.clearTimeout(K)},[S]);let q=async K=>{if(!(g.current||L.current||r)){g.current=!0,m(!0),v(null),T(null);try{await K()}catch(W){v(W instanceof Error?W.message:l("turnQueue.actionFailed"))}finally{g.current=!1,m(!1)}}},X=(K,W)=>q(async()=>{let Z=IT(k,K.intentId,W);if(!(Z===null||!K.management?.canReorder)){L.current=!0,w({preview:Z,acknowledged:!1});try{await i.onReorder(K,W),w(j=>j?.preview===Z?{...j,acknowledged:!0}:j)}catch(j){throw L.current=!1,w(null),T({intentId:K.intentId,kind:"failed"}),j}}}),Se=r?l("turnQueue.disconnected"):C!==null?l("turnQueue.saving"):y!==null?`${l("turnQueue.dragStarted")} ${z+1}/${P.length}`:S?.kind==="saved"?l("common.action.done"):S?.kind==="cancelled"?l("turnQueue.dragCancelled"):"";return b(Te,{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:H("min-w-0 truncate",S?.kind==="saved"&&"text-primary"),children:Se})]}),u(eT,{sensors:I,collisionDetection:U0,modifiers:G5,accessibility:{screenReaderInstructions:{draggable:l("turnQueue.dragInstructions")},announcements:{onDragStart:()=>l("turnQueue.dragStarted"),onDragOver:({over:K})=>{let W=P.findIndex(Z=>Z.intentId===K?.id);return W<0?void 0:`${l("turnQueue.dragStarted")} ${W+1}/${P.length}`},onDragEnd:()=>l("turnQueue.dragFinished"),onDragCancel:()=>l("turnQueue.dragCancelled")}},onDragStart:({active:K})=>{let W=P.find(Z=>Z.intentId===K.id);!W?.management?.canReorder||A||(v(null),T(null),x({activeId:W.intentId,overId:W.intentId}))},onDragOver:({over:K})=>{let W=P.find(Z=>Z.intentId===K?.id);W&&x(Z=>Z&&{...Z,overId:W.intentId})},onDragCancel:()=>{y&&T({intentId:y.activeId,kind:"cancelled"}),x(null)},onDragEnd:({active:K,over:W})=>{if(x(null),!W||K.id===W.id)return;let Z=P.findIndex(re=>re.intentId===K.id),j=P.findIndex(re=>re.intentId===W.id),O=P[Z];if(!O?.management?.canReorder||j<0)return;let Y=P[j+(Z<j?1:0)]?.intentId??null;X(O,Y)},children:u(dT,{items:P.map(K=>K.intentId),strategy:iT,children:b("ol",{className:"max-h-52 overflow-x-hidden overflow-y-auto overscroll-contain [scrollbar-gutter:stable]",children:[P.map((K,W)=>b(X5,{entry:K,disabled:!K.management?.canReorder||A,reducedMotion:d,feedback:S?.intentId===K.intentId?S.kind:void 0,dropPosition:K.intentId===y?.overId&&B!==z?B<z?"after":"before":void 0,dragPosition:K.intentId===y?.activeId?`${z+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(K.text??"")||l("turnQueue.attachmentsOnly")}),K.attachmentNames.length?b("p",{className:"flex items-center gap-1 text-muted-foreground",children:[u(ho,{className:"size-3 shrink-0"}),u("span",{className:"truncate",children:K.attachmentNames.join(", ")})]}):null,K.pendingAction?u("p",{className:"text-muted-foreground",children:l(K.pendingAction==="steer"?"turnQueue.steering":"turnQueue.interrupting")}):null,K.failure?u("p",{role:"alert",className:"text-destructive-foreground",children:K.failure}):null]}),b("div",{className:H("flex shrink-0 items-center gap-0.5",K.intentId===y?.activeId&&"invisible"),children:[u(de,{size:"icon-xs",variant:"ghost",disabled:!K.management||A||y!==null,"aria-label":l("turnQueue.editMessage"),title:l("turnQueue.editMessage"),onClick:()=>f(K),children:u(ec,{className:"size-3.5"})}),K.management?.canSteer?u(de,{size:"icon-xs",variant:"ghost",disabled:A||y!==null,"aria-label":l("turnQueue.steer"),title:l("turnQueue.steerDescription"),onClick:()=>{q(()=>i.onRun(K,"steer"))},children:u(tc,{className:"size-3.5"})}):null,b(Ao,{children:[u(Ro,{render:u(de,{size:"icon-xs",variant:"ghost",disabled:A||!K.management||y!==null,"aria-label":l("turnQueue.messageActions")}),children:u(rr,{className:"size-4"})}),b(Eo,{align:"end",children:[b(ar,{disabled:!K.management?.canReorder||W===0,onClick:()=>{X(K,P[W-1].intentId)},children:[u(Od,{className:"size-4"}),l("turnQueue.moveUp")]}),b(ar,{disabled:!K.management?.canReorder||W===P.length-1,onClick:()=>{X(K,P[W+2]?.intentId??null)},children:[u(_d,{className:"size-4"}),l("turnQueue.moveDown")]}),K.management?.canSteer?u(ar,{onClick:()=>{q(()=>i.onRun(K,"steer"))},children:l("turnQueue.steer")}):null,u(ar,{disabled:!K.management?.canRun,onClick:()=>{q(()=>i.onRun(K,"interrupt"))},children:l(K.management?.expectedTurnId?"turnQueue.interruptAndRun":"turnQueue.sendNext")}),u(ui,{}),u(ar,{disabled:K.action!=="cancel",onClick:()=>{q(()=>s(K))},children:l("turnQueue.cancelMessage")})]})]})]})]},K.intentId)),n.map(K=>u(Q5,{submission:K},K.messageId))]})})},e),h?u("p",{role:"alert",className:"px-3 py-2 text-destructive-foreground",children:h}):null]}):null,c?u(wT,{entry:c,current:t.find(K=>K.intentId===c.intentId),inputKey:e,environmentId:o,unavailable:A,attachments:a,watchEditorAuthority:i.watchEditorAuthority,onEdit:i.onEdit,onClose:()=>f(null)},`${e}\0${c.intentId}\0${c.management?.revision??"none"}`):null]})}function PT({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=V(()=>{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(Te,{children:[u(LT,{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})]})}pe();var pv=220,Y5={opacity:0,transform:"translate3d(0, 4rem, 0)"},J5={opacity:0,transform:"translate3d(0, 7rem, 0)"},AT={opacity:1,transform:"none"},ET={transition:`transform ${pv}ms ease-in, opacity ${pv}ms ease-in`},Z5={default:"border-[var(--chat-composer-attached-outline)]",error:"border-destructive/24",info:"border-info/24",success:"border-success/24",warning:"border-warning/24"};function MT({className:e,items:t}){let{t:n}=xe(),[o,r]=J(null),a=N(null),i=o!==null&&t.some(m=>m.id===o)?o:null;if(G(()=>()=>{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:H("group/banner-stack chat-composer-drawer-slot",e),"data-composer-banner-drawer":"true",children:b("div",{className:H("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:H("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)]",Z5[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:H("relative z-10",i===s.id?"pointer-events-none":null),style:{...ET,...i===s.id?Y5:AT},children:u(RT,{item:s,attached:!0,exiting:i===s.id,onDismissRequest:()=>p(s)})}),d?u("div",{"data-composer-banner-stack-expanded-items":"true",className:H("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:H("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:H(i===m.id?"pointer-events-none":null),style:{...ET,...i===m.id?J5:AT},children:u(RT,{item:m,attached:!1,exiting:i===m.id,onDismissRequest:()=>p(m)})},m.id))})})}):null]})})}function RT({item:e,attached:t,exiting:n,onDismissRequest:o}){let{t:r}=xe(),a=e.onDismiss&&!e.actions;return e.presentation==="compact"?b(cc,{variant:e.variant,role:"status",className:H("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(uc,{className:H("shrink-0",e.actionClassName),children:[e.actions,e.onDismiss?u(de,{size:"icon-xs",variant:"ghost","aria-label":e.dismissLabel??r("composer.dismissNotice"),disabled:n,onClick:o,children:u(nn,{})}):null]}):null]}):b(cc,{variant:e.variant,className:H(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(Ff,{children:e.description}):null,e.actions||e.onDismiss?b(uc,{className:H(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(de,{size:"icon-xs",variant:"ghost","aria-label":e.dismissLabel??r("composer.dismissWarning"),disabled:n,onClick:o,children:u(nn,{})}):null]}):null]})}pe();var NT=wt(!1),_T=NT.Provider;function DT(){return Kt(NT)}function OT({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(MT,{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(_T,{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 FT(e,t){let n=e!==null&&e!=="plan-follow-up";return{showTopDrawer:e!==null&&(n||!t),showCollapsedPromptRow:t&&!n,hasBlocking:n}}var eH=["image/gif","image/jpeg","image/png","image/webp"],tH=new Set(eH);function mv(e){return tH.has(e.toLowerCase())}function nH(e){return mv(e)?"image":"file"}var oH=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/")||oH.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 nH(e.mimeType)==="image"?{type:"image",...t}:{type:"file",...t}}pe();var rH=/(^|\s)\$([a-zA-Z][a-zA-Z0-9:_-]*)(?=\s)/g,aH=/(^|\s)@(?:"((?:\\.|[^"\\])*)"|([^\s@"]+))(?=\s)/g;var iH=new RegExp("(^|\\s)\\[((?:\\\\.|[^\\]\\\\]){0,512})\\]\\(([^)\\s]+)\\)(?=\\s)","g"),sH=/^[A-Za-z][A-Za-z0-9+.-]*:/,lH=/^[A-Za-z]:[\\/]/,dH=/^[a-z0-9][a-z0-9._-]*\/[a-z0-9][a-z0-9._-]*(?:\/[^\s@"]+)*$/;function cH(e){let t=[];for(let n of e.matchAll(iH)){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=sH.test(s)&&!lH.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(aH)){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&&dH.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=cH(e);for(let o of e.matchAll(rH)){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 uH(e){return e.replace(/\r\n/g,`
|
|
3740
|
-
`).replace(/^\n+|\n+$/g,"")}function
|
|
3741
|
-
`||e===" "||e==="\r"||e==="\uFFFC"}function
|
|
3742
|
-
`,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=
|
|
3743
|
-
`)}function wH({context:e,onRemove:t}){let{t:n}=xe(),o=Gt().elementContext,r=o.formatLabel(e),a=o.formatSourceLabel(e);return b(Ye,{children:[u(Ze,{render:b("span",{className:H(wi,"pr-1"),children:[u(ia,{className:H(ca,"size-icon-1")}),u("span",{className:ua,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:Pp,onClick:i=>{i.preventDefault(),i.stopPropagation(),t(e.id)},children:u(nn,{className:"size-3","aria-hidden":!0})})]})}),u(Je,{side:"top",className:"max-w-96 whitespace-pre-wrap leading-tight",children:bH(e,o.formatLabel,o.formatSourceLabel)})]})}function ik({contexts:e,onRemove:t,className:n}){return e.length===0?null:u("div",{className:H("flex flex-wrap gap-1.5",n),children:e.map(o=>u(wH,{context:o,onRemove:t},o.id))})}function sk({comments:e,onRemove:t,className:n}){let{t:o}=xe();return e.length===0?null:u("div",{className:H("flex flex-wrap gap-1.5",n),children:e.map(r=>{let a=`${r.filePath} ${r.rangeLabel}`,i=b("span",{className:H(wi,"pr-1"),children:[u(ts,{className:H(ca,"size-icon-1")}),u("span",{className:ua,children:a}),u("button",{type:"button","aria-label":o("pendingContext.removeReviewComment",{label:a}),className:Pp,onClick:s=>{s.preventDefault(),s.stopPropagation(),t(r.id)},children:u(nn,{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 Ap(e){let{t}=xe(),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 lk({annotations:e,images:t,onRemove:n,onExpandImage:o,uploadsByImageId:r,onRetryUpload:a,className:i}){let{t:s}=xe(),l=Gt().elementContext;if(e.length===0)return null;let d=new Map(t.map(c=>[c.id,c]));return u("div",{className:H("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(ia,{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:H("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(Ap,{icon:u(ia,{className:"size-3"}),count:c.elements.length,tooltipKey:"previewAnnotation.elementCount"}):null,c.regions.length>0?u(Ap,{icon:u(Kd,{className:"size-3"}),count:c.regions.length,tooltipKey:"previewAnnotation.regionCount"}):null,c.strokes.length>0?u(Ap,{icon:u(sa,{className:"size-3"}),count:c.strokes.length,tooltipKey:"previewAnnotation.drawingCount"}):null,c.styleChanges.length>0?u(Ap,{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:kp(p.progress)}):null,p?.status==="failed"&&f&&a?b(Ye,{children:[u(Ze,{render:u(de,{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:Tp(p,s)})]}):null]})]})]}),u(de,{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(nn,{className:"size-3"})})]},c.id)})})}pe();function dk(e,t){let n=t?.hasWideActions?780:620;return e!==null&&e<n}function ck(e,t){return t?.hasWideActions?e!==null&&e<780:!1}function uk(e,t){let n=Gt().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=dk(o,{hasWideActions:t});return{isComposerFooterCompact:a,isComposerPrimaryActionsCompact:a&&ck(o,{hasWideActions:t})}}pe();function SH(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 IH(e){return e.replaceAll("\\","/")}function fa(e){let t=e.displayName?.trim();return t||SH(e.name)}function fk(e,t){return t?e.filter(n=>n.enabled):[]}function pk(e,t){let n=new Set(t.map(o=>o.name.trim().toLowerCase()));return e.filter(o=>!n.has(o.name.trim().toLowerCase()))}function mk(e){let t=IH(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"}}pe();pe();var Ep=me(function(t){let n=Gt().pierreIcons,o=n.useSpriteReady();Md(n.ensureSprite,[n]);let r=V(()=>n.resolveForEntry(t.pathValue,t.kind),[n,t.kind,t.pathValue]);return o?u("svg",{"aria-hidden":"true","data-file-icon":r.symbolId,className:H("size-4 shrink-0",t.className),children:u("use",{href:`#${r.symbolId}`})}):t.kind==="directory"?u(si,{className:H("size-4 shrink-0 text-icon-muted",t.className)}):u($d,{className:H("size-4 shrink-0 text-icon-muted",t.className)})});var gk={recent:"slashMenu.sections.recent",builtIn:"slashMenu.sections.builtIn",provider:"slashMenu.sections.provider",skills:"slashMenu.sections.skills"},hk=me(function(t){let{t:n}=xe(),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(TH,{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"))})})})})}),TH=me(function(t){let{t:n}=xe(),o=t.item.type==="skill"?mk(t.item.skill):null,r=t.triggerKind==="slash-command"&&t.item.type==="skill"?t.item.skill:null;return b(Te,{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(gk[t.sectionTitle]??gk.recent)}):null,b(Hf,{value:t.item.id,"data-composer-item-id":t.item.id,className:H("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(Ep,{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(Te,{children:[u("span",{className:"text-secondary-label",children:"/skill:"}),fa(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(PH,{kind:o,showSkillSuffix:t.triggerKind==="skill"}):null]})]})]})}),kH={app:Fd,repo:si,project:si,personal:la,system:nc,other:Jd},LH={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 PH(e){let{t}=xe(),n=kH[e.kind],o=t(LH[e.kind]);return b(hl,{className:"ms-auto",variant:"secondary",children:[u(n,{"aria-hidden":"true",className:"text-current"}),e.showSkillSuffix?t("slashMenu.skillSourceWithSuffix",{source:o}):o]})}var wv={};_n(wv,{LexicalComposerContext:()=>vk,createLexicalComposerContext:()=>AH,useLexicalComposerContext:()=>EH});pe();var vk=wt(null);function AH(e,t){let n=null;return e!=null&&(n=e[1]),{getTheme:function(){return t??(n!=null?n.getTheme():null)}}}function EH(){let e=Kt(vk);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,yk=Sv.LexicalComposerContext,xk=Sv.createLexicalComposerContext,wn=Sv.useLexicalComposerContext;var Jy={};_n(Jy,{$addUpdateTag:()=>gm,$applyNodeReplacement:()=>au,$caretFromPoint:()=>Mi,$caretRangeFromSelection:()=>cy,$cloneWithProperties:()=>qy,$cloneWithPropertiesEphemeral:()=>pK,$comparePointCaretNext:()=>Qy,$copyNode:()=>Ky,$create:()=>gK,$createLineBreakNode:()=>Kl,$createNodeSelection:()=>Py,$createParagraphNode:()=>Fa,$createPoint:()=>Or,$createRangeSelection:()=>dP,$createRangeSelectionFromDom:()=>$$,$createTabNode:()=>dm,$createTextNode:()=>Vn,$extendCaretToRange:()=>Gy,$findMatchingParent:()=>Uc,$getAdjacentChildCaret:()=>Yl,$getAdjacentNode:()=>AP,$getAdjacentSiblingOrParentSiblingCaret:()=>SK,$getCaretInDirection:()=>Ni,$getCaretRange:()=>Ri,$getCaretRangeInDirection:()=>Yy,$getCharacterOffsets:()=>ny,$getChildCaret:()=>za,$getChildCaretAtIndex:()=>VP,$getChildCaretOrSelf:()=>zP,$getCollapsedCaretRange:()=>UP,$getCommonAncestor:()=>Hc,$getCommonAncestorResultBranchOrder:()=>Xy,$getEditor:()=>Vy,$getNearestNodeFromDOMNode:()=>mm,$getNearestRootOrShadowRoot:()=>MP,$getNodeByKey:()=>Hn,$getNodeByKeyOrThrow:()=>NP,$getNodeFromDOMNode:()=>Oy,$getPreviousSelection:()=>Ns,$getRoot:()=>Vo,$getSelection:()=>Dt,$getSiblingCaret:()=>Qn,$getState:()=>$p,$getStateChange:()=>l$,$getTextContent:()=>q$,$getTextNodeOffset:()=>Dr,$getTextPointCaret:()=>Ei,$getTextPointCaretSlice:()=>ly,$getWritableNodeState:()=>my,$hasAncestor:()=>om,$hasUpdateTag:()=>lK,$insertNodes:()=>V$,$isBlockElementNode:()=>H$,$isChildCaret:()=>_r,$isDecoratorNode:()=>on,$isEditorState:()=>Q$,$isElementNode:()=>ne,$isExtendableTextPointCaret:()=>KP,$isInlineElementOrDecoratorNode:()=>dK,$isLeafNode:()=>aK,$isLineBreakNode:()=>ks,$isNodeCaret:()=>yK,$isNodeSelection:()=>tu,$isParagraphNode:()=>hP,$isRangeSelection:()=>je,$isRootNode:()=>Zn,$isRootOrShadowRoot:()=>ur,$isSiblingCaret:()=>Ms,$isTabNode:()=>Ly,$isTextNode:()=>Be,$isTextPointCaret:()=>Ba,$isTextPointCaretSlice:()=>wK,$isTokenOrSegmented:()=>_a,$isTokenOrTab:()=>Ti,$nodesOfType:()=>sK,$normalizeCaret:()=>Mr,$normalizeSelection__EXPERIMENTAL:()=>Kp,$onUpdate:()=>RP,$parseSerializedNode:()=>j$,$removeTextFromCaretRange:()=>$P,$rewindSiblingCaret:()=>td,$selectAll:()=>iK,$setCompositionKey:()=>Wn,$setPointFromCaret:()=>Jl,$setSelection:()=>No,$setSelectionFromCaretRange:()=>HP,$setState:()=>d$,$splitAtPointCaretNext:()=>kK,$splitNode:()=>cK,$updateRangeSelectionFromCaretRange:()=>$c,ArtificialNode__DO_NOT_USE:()=>tm,BEFORE_INPUT_COMMAND:()=>hy,BLUR_COMMAND:()=>$L,CAN_REDO_COMMAND:()=>b$,CAN_UNDO_COMMAND:()=>w$,CLEAR_EDITOR_COMMAND:()=>x$,CLEAR_HISTORY_COMMAND:()=>C$,CLICK_COMMAND:()=>TL,COLLABORATION_TAG:()=>ZL,COMMAND_PRIORITY_CRITICAL:()=>eK,COMMAND_PRIORITY_EDITOR:()=>Fl,COMMAND_PRIORITY_HIGH:()=>Z$,COMMAND_PRIORITY_LOW:()=>Y$,COMMAND_PRIORITY_NORMAL:()=>J$,COMPOSITION_END_COMMAND:()=>xy,COMPOSITION_END_TAG:()=>oP,COMPOSITION_START_COMMAND:()=>yy,COMPOSITION_START_TAG:()=>nP,CONTROLLED_TEXT_INSERTION_COMMAND:()=>zl,COPY_COMMAND:()=>Iy,CUT_COMMAND:()=>Ty,DELETE_CHARACTER_COMMAND:()=>Wc,DELETE_LINE_COMMAND:()=>jc,DELETE_WORD_COMMAND:()=>Gc,DRAGEND_COMMAND:()=>UL,DRAGOVER_COMMAND:()=>zL,DRAGSTART_COMMAND:()=>BL,DROP_COMMAND:()=>FL,DecoratorNode:()=>Xc,ElementNode:()=>Pi,FOCUS_COMMAND:()=>HL,FORMAT_ELEMENT_COMMAND:()=>y$,FORMAT_TEXT_COMMAND:()=>Si,HISTORIC_TAG:()=>E$,HISTORY_MERGE_TAG:()=>zp,HISTORY_PUSH_TAG:()=>R$,INDENT_CONTENT_COMMAND:()=>h$,INPUT_COMMAND:()=>vy,INSERT_LINE_BREAK_COMMAND:()=>Fc,INSERT_PARAGRAPH_COMMAND:()=>Wv,INSERT_TAB_COMMAND:()=>g$,INTERNAL_$isBlock:()=>Oa,IS_ALL_FORMATTING:()=>KH,IS_BOLD:()=>OH,IS_CODE:()=>UH,IS_HIGHLIGHT:()=>uy,IS_ITALIC:()=>FH,IS_STRIKETHROUGH:()=>BH,IS_SUBSCRIPT:()=>HH,IS_SUPERSCRIPT:()=>$H,IS_UNDERLINE:()=>zH,KEY_ARROW_DOWN_COMMAND:()=>RL,KEY_ARROW_LEFT_COMMAND:()=>PL,KEY_ARROW_RIGHT_COMMAND:()=>kL,KEY_ARROW_UP_COMMAND:()=>EL,KEY_BACKSPACE_COMMAND:()=>NL,KEY_DELETE_COMMAND:()=>DL,KEY_DOWN_COMMAND:()=>Sy,KEY_ENTER_COMMAND:()=>jp,KEY_ESCAPE_COMMAND:()=>_L,KEY_MODIFIER_COMMAND:()=>KL,KEY_SPACE_COMMAND:()=>ML,KEY_TAB_COMMAND:()=>OL,LineBreakNode:()=>$l,MOVE_TO_END:()=>LL,MOVE_TO_START:()=>AL,NODE_STATE_KEY:()=>n$,OUTDENT_CONTENT_COMMAND:()=>v$,PASTE_COMMAND:()=>Cy,PASTE_TAG:()=>M$,ParagraphNode:()=>Wl,REDO_COMMAND:()=>wy,REMOVE_TEXT_COMMAND:()=>Gv,RootNode:()=>ql,SELECTION_CHANGE_COMMAND:()=>gy,SELECTION_INSERT_CLIPBOARD_NODES_COMMAND:()=>m$,SELECT_ALL_COMMAND:()=>jv,SKIP_COLLAB_TAG:()=>N$,SKIP_DOM_SELECTION_TAG:()=>tP,SKIP_SCROLL_INTO_VIEW_TAG:()=>eP,SKIP_SELECTION_FOCUS_TAG:()=>ey,TEXT_TYPE_TO_FORMAT:()=>so,TabNode:()=>Vl,TextNode:()=>As,UNDO_COMMAND:()=>by,addClassNamesToElement:()=>MK,buildImportMap:()=>A$,configExtension:()=>PK,createCommand:()=>nt,createEditor:()=>tK,createSharedNodeState:()=>xL,createState:()=>s$,declarePeerDependency:()=>AK,defineExtension:()=>LK,flipDirection:()=>_i,getDOMOwnerDocument:()=>Hy,getDOMSelection:()=>Br,getDOMSelectionFromTarget:()=>_P,getDOMTextNode:()=>Rs,getEditorPropertyFromDOMNode:()=>ou,getNearestEditorFromDOMNode:()=>Dy,getRegisteredNode:()=>Ny,getRegisteredNodeOrThrow:()=>My,getStaticNodeConfig:()=>iu,getTextDirection:()=>rK,getTransformSetFromKlass:()=>yP,isBlockDomNode:()=>iy,isCurrentlyReadOnlyMode:()=>Zl,isDOMDocumentNode:()=>bP,isDOMNode:()=>ed,isDOMTextNode:()=>ga,isDOMUnmanaged:()=>BP,isDocumentFragment:()=>DP,isExactShortcutMatch:()=>Vt,isHTMLAnchorElement:()=>uK,isHTMLElement:()=>wo,isInlineDomNode:()=>OP,isLexicalEditor:()=>fm,isModifierMatch:()=>PP,isSelectionCapturedInDecoratorInput:()=>_y,isSelectionWithinEditor:()=>nu,makeStepwiseIterator:()=>jy,mergeRegister:()=>_K,normalizeClassNames:()=>su,removeClassNamesFromElement:()=>NK,removeFromParent:()=>ki,resetRandomKey:()=>nK,safeCast:()=>EK,setDOMUnmanaged:()=>mK,setNodeIndentFromDOM:()=>FP,shallowMergeConfig:()=>RK,toggleTextFormatType:()=>Jc});function se(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 uL(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 Fr=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,RH=Fr&&"documentMode"in document?document.documentMode:null,Rr=Fr&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Li=Fr&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Hp=!(!Fr||!("InputEvent"in window)||RH)&&"getTargetRanges"in new window.InputEvent("input"),am=Fr&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),eu=Fr&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,MH=Fr&&/Android/.test(navigator.userAgent),fL=Fr&&/^(?=.*Chrome).*/i.test(navigator.userAgent),_v=Fr&&MH&&fL,im=Fr&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&Rr&&!fL,NH=0,_H=1,DH=2,OH=1,FH=2,BH=4,zH=8,UH=16,HH=32,$H=64,uy=128,KH=2047,VH=1,qH=2,WH=3,GH=4,jH=5,QH=6,Kc=am||eu||im?"\xA0":"\u200B",sm=`
|
|
3761
|
+
`},MU={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 NU(e){let{announcements:t=MU,container:n,hiddenTextDescribedById:o,screenReaderInstructions:r=RU}=e,{announce:a,announcement:i}=T0(),s=hs("DndLiveRegion"),[l,d]=J(!1);if(W(()=>{d(!0)},[]),AU(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(S0,{id:o,value:r.draggable}),yn.createElement(I0,{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 mp(){}function lv(e,t){return K(()=>({sensor:e,options:t??{}}),[e,t])}function z0(){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 U0(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function H0(e,t){let{data:{value:n}}=e,{data:{value:o}}=t;return n-o}function _U(e,t){let{data:{value:n}}=e,{data:{value:o}}=t;return o-n}function k0(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 L0(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 $0=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:o}=e,r=L0(t,t.left,t.top),a=[];for(let i of o){let{id:s}=i,l=n.get(s);if(l){let d=U0(L0(l),r);a.push({id:s,data:{droppableContainer:i,value:d}})}}return a.sort(H0)},K0=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:o}=e,r=k0(t),a=[];for(let i of o){let{id:s}=i,l=n.get(s);if(l){let d=k0(l),c=r.reduce((p,m,g)=>p+U0(d[g],m),0),f=Number((c/4).toFixed(4));a.push({id:s,data:{droppableContainer:i,value:f}})}}return a.sort(H0)};function DU(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 OU=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=DU(s,t);l>0&&r.push({id:i,data:{droppableContainer:a,value:l}})}}return r.sort(_U)};function FU(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function V0(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Pr}function BU(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 zU=BU(1);function UU(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 HU(e,t,n){let o=UU(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 $U={ignoreTransform:!1};function ws(e,t){t===void 0&&(t=$U);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:d,transformOrigin:c}=Co(e).getComputedStyle(e);d&&(n=HU(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 P0(e){return ws(e,{ignoreTransform:!0})}function KU(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function VU(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 Nc(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(!Rl(r)||Zh(r)||n.includes(r))return n;let a=Co(e).getComputedStyle(r);return r!==e&&qU(r,a)&&n.push(r),VU(r,a)?n:o(r.parentNode)}return e?o(e):n}function q0(e){let[t]=Nc(e,1);return t??null}function ev(e){return!Tc||!e?null:ms(e)?e:dp(e)?cp(e)||e===gs(e).scrollingElement?window:Rl(e)?e:null:null}function W0(e){return ms(e)?e.scrollX:e.scrollLeft}function G0(e){return ms(e)?e.scrollY:e.scrollTop}function ov(e){return{x:W0(e),y:G0(e)}}var Un;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Un||(Un={}));function j0(e){return!Tc||!e?!1:e===document.scrollingElement}function Q0(e){let t={x:0,y:0},n=j0(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 WU={x:.2,y:.2};function GU(e,t,n,o,r){let{top:a,left:i,right:s,bottom:l}=n;o===void 0&&(o=10),r===void 0&&(r=WU);let{isTop:d,isBottom:c,isLeft:f,isRight:p}=Q0(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 X0(e){return e.reduce((t,n)=>vs(t,ov(n)),Pr)}function QU(e){return e.reduce((t,n)=>t+W0(n),0)}function XU(e){return e.reduce((t,n)=>t+G0(n),0)}function YU(e,t){if(t===void 0&&(t=ws),!e)return;let{top:n,left:o,bottom:r,right:a}=t(e);q0(e)&&(r<=0||a<=0||n>=window.innerHeight||o>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}var JU=[["x",["left","right"],QU],["y",["top","bottom"],XU]],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=X0(o);this.rect={...t},this.width=t.width,this.height=t.height;for(let[a,i,s]of JU)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 ZU(e){let{EventTarget:t}=Co(e);return e instanceof t?e:gs(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 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 A0(e){e.preventDefault()}function e5(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 Y0={start:[Tt.Space,Tt.Enter],cancel:[Tt.Esc],end:[Tt.Space,Tt.Enter,Tt.Tab]},t5=(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&&YU(o),n(Pr)}handleKeyDown(t){if(Lc(t)){let{active:n,context:o,options:r}=this.props,{keyboardCodes:a=Y0,coordinateGetter:i=t5,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=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}=Q0(h),T=jU(h),I={x:Math.min(v===Tt.Right?T.right-T.width/2:T.right,Math.max(v===Tt.Right?T.left:T.left+T.width/2,f.x)),y:Math.min(v===Tt.Down?T.bottom-T.height/2:T.bottom,Math.max(v===Tt.Down?T.top:T.top+T.height/2,f.y))},k=v===Tt.Right&&!x||v===Tt.Left&&!C,E=v===Tt.Down&&!w||v===Tt.Up&&!y;if(k&&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(E&&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=Y0,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 E0(e){return!!(e&&"distance"in e)}function R0(e){return!!(e&&"delay"in e)}var Rc=class{constructor(t,n,o){var r;o===void 0&&(o=ZU(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: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(fr.Resize,this.handleCancel),this.windowListeners.add(fr.DragStart,A0),this.windowListeners.add(fr.VisibilityChange,this.handleCancel),this.windowListeners.add(fr.ContextMenu,A0),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(R0(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(E0(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,e5,{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:Pr,d=ys(r,l);if(!o&&s){if(E0(s)){if(s.tolerance!=null&&tv(d,s.tolerance))return this.handleCancel();if(tv(d,s.distance))return this.handleStart()}if(R0(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===Tt.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}},n5={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,n5,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 o5={move:{name:"mousemove"},end:{name:"mouseup"}},rv;(function(e){e[e.RightClick=2]="RightClick"})(rv||(rv={}));var av=class extends Rc{constructor(t){super(t,o5,gs(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 Rc{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 Ac;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Ac||(Ac={}));var gp;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(gp||(gp={}));function r5(e){let{acceleration:t,activator:n=Ac.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=i5({delta:f,disabled:!a}),[g,h]=C0(),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 T=v.current.x*y.current.x,I=v.current.y*y.current.y;S.scrollBy(T,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 T=d.indexOf(S),I=c[T];if(!I)continue;let{direction:k,speed:E}=GU(S,I,x,t,p);for(let P of["x","y"])m[P][k[P]]||(E[P]=0,k[P]=0);if(E.x>0||E.y>0){h(),C.current=S,g(w,i),v.current=E,y.current=k;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 a5={x:{[Un.Backward]:!1,[Un.Forward]:!1},y:{[Un.Backward]:!1,[Un.Forward]:!1}};function i5(e){let{delta:t,disabled:n}=e,o=fp(t);return Nl(r=>{if(n||!o||!r)return a5;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 s5(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 l5(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 sv;(function(e){e.Optimized="optimized"})(sv||(sv={}));var M0=new Map;function d5(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 M0;if(!y||y===M0||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 J0(e,t){return Nl(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function c5(e,t){return J0(e,t)}function u5(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 f5(e){return new Ec(ws(e),e)}function N0(e,t,n){t===void 0&&(t=f5);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=u5({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 ur(()=>{a(),e?(s?.observe(e),i?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),i?.disconnect())},[e]),o}function p5(e){let t=J0(e);return V0(e,t)}var _0=[];function m5(e){let t=N(e),n=Nl(o=>e?o&&o!==_0&&e&&t.current&&e.parentNode===t.current.parentNode?o:Nc(e):_0,[e]);return W(()=>{t.current=e},[e]),n}function g5(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)=>vs(a,i),Pr):X0(e):Pr,[e,t])}function D0(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?ys(e,n.current):Pr}function h5(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 v5(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 Z0(e){return K(()=>e?KU(e):null,[e])}var O0=[];function y5(e,t){t===void 0&&(t=ws);let[n]=e,o=Z0(n?Co(n):null),[r,a]=J(O0);function i(){a(()=>e.length?e.map(l=>j0(l)?o:new Ec(t(l),l)):O0)}let s=hp({callback:i});return ur(()=>{s?.disconnect(),i(),e.forEach(l=>s?.observe(l))},[e]),r}function x5(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return Rl(t)?t:e}function C5(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=hp({callback:r}),i=R(d=>{let c=x5(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 b5=[{sensor:Dl,options:{}},{sensor:_l,options:{}}],w5={current:{}},pp={draggable:{measure:P0},droppable:{measure:P0,strategy:Mc.WhileDragging,frequency:sv.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}},S5={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:mp},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:pp,measureDroppableContainers:mp,windowRect:null,measuringScheduled:!1},I5={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:mp,draggableNodes:new Map,over:null,measureDroppableContainers:mp},vp=Ct(I5),eT=Ct(S5);function T5(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new bs}}}function k5(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 L5(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(!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=w0(c);if(f){f.focus();break}}})}},[o,t,r,i,a]),null}function P5(e,t){let{transform:n,...o}=t;return e!=null&&e.length?e.reduce((r,a)=>a({transform:r,...o}),n):n}function A5(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 E5(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=V0(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=q0(d);p&&p.scrollBy({top:f.y,left:f.x})}},[t,i,s,o,n])}var tT=Ct({...Pr,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 nT=pe(function(t){var n,o,r,a;let{id:i,accessibility:s,autoScroll:l=!0,children:d,sensors:c=b5,collisionDetection:f=OU,measuring:p,modifiers:m,...g}=t,h=Ia(k5,void 0,T5),[v,y]=h,[x,C]=EU(),[w,L]=J(xi.Uninitialized),S=w===xi.Initialized,{draggable:{active:T,nodes:I,translate:k},droppable:{containers:E}}=v,P=T!=null?I.get(T):null,_=N({initial:null,translated:null}),A=K(()=>{var Te;return T!=null?{id:T,data:(Te=P?.data)!=null?Te:w5,rect:_}:null},[T,P]),F=N(null),[B,V]=J(null),[Q,Se]=J(null),H=Ml(g,Object.values(g)),q=hs("DndDescribedBy",i),ee=K(()=>E.getEnabled(),[E]),G=A5(p),{droppableRects:te,measureDroppableContainers:me,measuringScheduled:U}=d5(ee,{dragging:S,dependencies:[k.x,k.y],config:G.droppable}),Y=s5(I,T),se=K(()=>Q?Pc(Q):null,[Q]),ge=ye(),ie=c5(Y,G.draggable.measure);E5({activeNode:T!=null?I.get(T):null,config:ge.layoutShiftCompensation,initialRect:ie,measure:G.draggable.measure});let Ae=N0(Y,G.draggable.measure,ie),Xe=N0(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:E,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),rt=E.getNodeFor((n=nt.current.over)==null?void 0:n.id),Ve=C5({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=p5(j?null:Ae),ae=Z0(ne?Co(ne):null),oe=m5(S?rt??Y:null),ft=y5(oe),pt=P5(m,{transform:{x:k.x-X.x,y:k.y-X.y,scaleX:1,scaleY:1},activatorEvent:Q,active:A,activeNodeRect:Ae,containerNodeRect:Xe,draggingNodeRect:we,over:nt.current.over,overlayNodeRect:Ve.rect,scrollableAncestors:oe,scrollableAncestorRects:ft,windowRect:ae}),yt=se?vs(se,k):null,Lt=g5(oe),on=D0(Lt),gt=D0(Lt,[Ae]),zt=vs(pt,on),Mt=we?zU(we,pt):null,wt=A&&Mt?f({active:A,collisionRect:Mt,droppableRects:te,droppableContainers:ee,pointerCoordinates:yt}):null,In=dv(wt,"id"),[ct,dn]=J(null),ro=j?pt:vs(pt,gt),Vt=FU(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=l5(c,rn);h5(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:A,activeNode:Y,collisionRect:Mt,collisions:wt,droppableRects:te,draggableNodes:I,draggingNode:ne,draggingNodeRect:we,droppableContainers:E,over:ct,scrollableAncestors:oe,scrollAdjustedTranslate:zt},_.current={initial:we,translated:Mt}},[A,Y,wt,Mt,I,ne,we,te,E,ct,oe,zt]),r5({...ge,delta:k,draggingRect:Mt,pointerCoordinates:yt,scrollableAncestors:oe,scrollableAncestorRects:ft});let O=K(()=>({active:A,activeNode:Y,activeNodeRect:Ae,activatorEvent:Q,collisions:wt,containerNodeRect:Xe,dragOverlay:Ve,draggableNodes:I,droppableContainers:E,droppableRects:te,over:ct,measureDroppableContainers:me,scrollableAncestors:oe,scrollableAncestorRects:ft,measuringConfiguration:G,measuringScheduled:U,windowRect:ae}),[A,Y,Ae,Q,wt,Xe,Ve,I,E,te,ct,me,oe,ft,G,U,ae]),fe=K(()=>({activatorEvent:Q,activators:kn,active:A,activeNodeRect:Ae,ariaDescribedById:{draggable:q},dispatch:y,draggableNodes:I,over:ct,measureDroppableContainers:me}),[Q,kn,A,Ae,y,q,I,ct,me]);return yn.createElement(B0.Provider,{value:C},yn.createElement(vp.Provider,{value:fe},yn.createElement(eT.Provider,{value:O},yn.createElement(tT.Provider,{value:Vt},d)),yn.createElement(L5,{disabled:s?.restoreFocus===!1})),yn.createElement(NU,{...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}}}),R5=Ct(null),F0="button",M5="Draggable";function oT(e){let{id:t,data:n,disabled:o=!1,attributes:r}=e,a=hs(M5),{activators:i,activatorEvent:s,active:l,activeNodeRect:d,ariaDescribedById:c,draggableNodes:f,over:p}=Ht(vp),{role:m=F0,roleDescription:g="draggable",tabIndex:h=0}=r??{},v=l?.id===t,y=Ht(v?tT:R5),[x,C]=kc(),[w,L]=kc(),S=v5(i,t),T=Ml(n);ur(()=>(f.set(t,{id:t,key:a,node:x,activatorNode:w,data:T}),()=>{let k=f.get(t);k&&k.key===a&&f.delete(t)}),[f,t]);let I=K(()=>({role:m,tabIndex:h,"aria-disabled":o,"aria-pressed":v&&m===F0?!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 rT(){return Ht(eT)}var N5="Droppable",_5={timeout:25};function aT(e){let{data:t,disabled:n=!1,id:o,resizeObserverConfig:r}=e,a=hs(N5),{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}={..._5,...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=hp({callback:x,disabled:g||!i}),w=R((I,k)=>{C&&(k&&(C.unobserve(k),f.current=!1),I&&C.observe(I))},[C]),[L,S]=kc(w),T=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:T}}),()=>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 iT(e,t,n){let o=e.slice();return o.splice(n<0?o.length+n:n,0,o.splice(t,1)[0]),o}function D5(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 O5(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 F5(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}var sT=e=>{let{rects:t,activeIndex:n,overIndex:o,index:r}=e,a=iT(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},lT=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=B5(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 B5(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 dT="Sortable",cT=yn.createContext({activeIndex:-1,containerId:dT,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:sT,disabled:{draggable:!1,droppable:!1}});function uT(e){let{children:t,id:n,items:o,strategy:r=sT,disabled:a=!1}=e,{active:i,dragOverlay:s,droppableRects:l,over:d,measureDroppableContainers:c}=rT(),f=hs(dT,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=!O5(m,y.current),C=v!==-1&&h===-1||x,w=F5(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:D5(m,l),strategy:r}),[h,f,w.draggable,w.droppable,C,m,v,l,p,r]);return yn.createElement(cT.Provider,{value:L},t)}var z5=e=>{let{id:t,items:n,activeIndex:o,overIndex:r}=e;return iT(n,o,r).indexOf(t)},U5=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},H5={duration:200,easing:"ease"},fT="transform",$5=yi.Transition.toString({property:fT,duration:0,easing:"linear"}),K5={roleDescription:"sortable"};function V5(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 pT(e){let{animateLayoutChanges:t=U5,attributes:n,disabled:o,data:r,getNewIndex:a=z5,id:i,strategy:s,resizeObserverConfig:l,transition:d=H5}=e,{items:c,containerId:f,activeIndex:p,disabled:m,disableTransforms:g,sortedRects:h,overIndex:v,useDragOverlay:y,strategy:x}=Ht(cT),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:T,node:I,isOver:k,setNodeRef:E}=aT({id:i,data:L,disabled:C.droppable,resizeObserverConfig:{updateMeasurementsFor:S,...l}}),{active:P,activatorEvent:_,activeNodeRect:A,attributes:F,setNodeRef:B,listeners:V,isDragging:Q,over:Se,setActivatorNodeRef:H,transform:q}=oT({id:i,data:L,attributes:{...K5,...n},disabled:C.draggable}),ee=x0(E,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:A,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=V5({disabled:!nt,index:w,node:I,rect:T});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:T,index:w,newIndex:ge,items:c,isOver:k,isSorting:G,isDragging:Q,listeners:V,node:I,overIndex:v,over:Se,setNodeRef:ee,setActivatorNodeRef:H,setDroppableNodeRef:E,setDraggableNodeRef:B,transform:rt??se,transition:Ve()};function Ve(){if(rt||Xe&&Ae.current.newIndex===w)return $5;if(!(me&&!Lc(_)||!d)&&(G||nt))return yi.Transition.toString({...d,property:fT})}}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 W5=[Tt.Down,Tt.Right,Tt.Up,Tt.Left],mT=(e,t)=>{let{context:{active:n,collisionRect:o,droppableRects:r,droppableContainers:a,over:i,scrollableAncestors:s}}=t;if(W5.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=K0({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=Nc(g).some((S,T)=>s[T]!==S),y=gT(f,p),x=G5(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 gT(e,t){return!Cp(e)||!Cp(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function G5(e,t){return!Cp(e)||!Cp(t)||!gT(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 hT=e=>{let{draggingNodeRect:t,transform:n,scrollableAncestorRects:o}=e,r=o[0];return!t||!r?n:j5(n,t,r)},vT=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 yT(e){return`(min-width: ${typeof e=="number"?e:bp[e]}px)`}function xT(e){return`(max-width: ${(typeof e=="number"?e:bp[e])-1}px)`}function Q5(e){if(typeof e!="string"){let n=[];return e.min!=null&&n.push(yT(e.min)),e.max!=null&&n.push(xT(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(xT(o))}else n in bp&&t.push(yT(n));return t.length>0?t.join(" and "):e}function X5(){return!1}function wp(e){let t=Q5(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,X5)}ue();var so=new Map;function Y5(e,t,n){return`${e}\0${t}\0${n??"none"}`}function cv(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 J5(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 Sp(){queueMicrotask(()=>J5())}function CT(e,t,n,o,r=void 0){let a=n.management?.revision??null,i=Y5(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 bT(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,cv(e,n),n.listeners.add(t),Sp(),()=>{n.listeners.delete(t),Sp()}):()=>{}}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,cv(e,n);for(let r of n.listeners)r()}}function Ip(e){return so.get(e)?.state}function wT(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){Ol(e,t);return}Sp()}}}function Tp(e){let t=so.get(e);t&&Ol(e,t)}function ST(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);Sp()}function IT({entry:e,current:t,inputKey:n,environmentId:o,unavailable:r,attachments:a,watchEditorAuthority:i,onEdit:s,onClose:l}){let{t:d}=eo(),c=CT(n,o,e,a,i),f=Ko(P=>bT(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 T=()=>{v||(Tp(p),l())},I=P=>{if(v||r||S)return;let _=null,A=[...h];for(let F of P){let B=F.type||"application/octet-stream";if(g.length+A.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});A.push(V),a.startUpload({environmentId:o,image:V})}Ss(p,F=>({...F,added:A,error:_}))},k=async()=>{let P=Ip(p);if(!P||P.saving||r||S||!P.text.trim()&&P.retained.length+P.added.length===0)return;let _=wT(p);if(_!==null){Ss(p,A=>({...A,saving:!0,error:null}));try{await a.awaitUploads(P.added.map(F=>F.id));let A=a.getUploadedAttachments({environmentId:o,images:P.added});if(!A)throw new Error(d("turnQueue.uploadFailed"));await s(e,{text:P.text,attachments:[...P.retained,...A]}),Tp(p),l()}catch(A){Ss(p,F=>({...F,saving:!1,error:A instanceof Error?A.message:d("turnQueue.actionFailed")}))}finally{_()}}},E=[...g.map((P,_)=>({...P,previewUrl:L[_],added:!1})),...h.map(P=>({...P,added:!0}))];return u(Rf,{open:!0,onOpenChange:P=>{P||T()},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(qw,{"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(),k())}}),u("ul",{className:"flex flex-wrap gap-2",children:E.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(A=>A.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(A=>A.id!==P.id)}))):Ss(p,_=>({..._,retained:_.retained.filter(A=>A.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:T,children:d("turnQueue.discardEdit")}),u(ce,{disabled:v||r||S||!m.trim()&&E.length===0,onClick:()=>{k()},children:d(v?"turnQueue.saving":"turnQueue.saveEdit")})]})]})})}function TT(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 kT(e,t,n){if(t===n)return null;let o={intentId:t,beforeIntentId:n,previousOrder:e.map(a=>a.intentId)};return TT(e,o).every((a,i)=>a.intentId===e[i]?.intentId)?null:o}function LT(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:TT(e,t),settled:!1}}ue();ue();function Z5({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 PT({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(Z5,{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 k=x;f.current=!0,h(!0),y(null);try{await r(k),m(!1)}catch{y(k.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"),T=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:T}),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(jw,{open:p,onOpenChange:k=>{k||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(PT,{entries:o.filter(k=>k.status!=="queued"),unavailable:t,onCancel:r}):null]})}var eH=[vT,hT],tH=[];function nH({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 oH({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}=pT({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 AT({inputKey:e,entries:t,pendingSubmissions:n=tH,environmentId:o,unavailable:r,attachments:a,actions:i,onCancel:s}){let{t:l}=eo(),d=wp("(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,T]=ln("turn-queue:feedback",e,null),I=z0(lv(Dl,{activationConstraint:{distance:5}}),lv(_l,{coordinateGetter:mT,scrollBehavior:d?"auto":"smooth"})),k=K(()=>t.filter(H=>H.waiting),[t]),E=C?LT(k,C.preview):null,P=E?.entries??k,_=P.length+n.length,A=r||p||C!==null,F=P.findIndex(H=>H.intentId===y?.activeId),B=P.findIndex(H=>H.intentId===y?.overId);W(()=>{ST(e,t)},[t,e]),W(()=>{C!==null&&(r||C.acknowledged&&E?.settled)&&(L.current=!1,w(null),!r&&k.some(H=>H.intentId===C.preview.intentId)&&T({intentId:C.preview.intentId,kind:"saved"}))},[k,C,E?.settled,r]),W(()=>{if(S===null||S.kind==="failed")return;let H=window.setTimeout(()=>T(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),T(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=kT(k,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),T({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(nT,{sensors:I,collisionDetection:$0,modifiers:eH,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||A||(v(null),T(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&&T({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(uT,{items:P.map(H=>H.intentId),strategy:lT,children:b("ol",{className:"max-h-52 overflow-x-hidden overflow-y-auto overscroll-contain [scrollbar-gutter:stable]",children:[P.map((H,q)=>b(oH,{entry:H,disabled:!H.management?.canReorder||A,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||A||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:A||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:A||!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(nH,{submission:H},H.messageId))]})})},e),h?u("p",{role:"alert",className:"px-3 py-2 text-destructive-foreground",children:h}):null]}):null,c?u(IT,{entry:c,current:t.find(H=>H.intentId===c.intentId),inputKey:e,environmentId:o,unavailable:A,attachments:a,watchEditorAuthority:i.watchEditorAuthority,onEdit:i.onEdit,onClose:()=>f(null)},`${e}\0${c.intentId}\0${c.management?.revision??"none"}`):null]})}function ET({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(AT,{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,rH={opacity:0,transform:"translate3d(0, 4rem, 0)"},aH={opacity:0,transform:"translate3d(0, 7rem, 0)"},RT={opacity:1,transform:"none"},MT={transition:`transform ${fv}ms ease-in, opacity ${fv}ms ease-in`},iH={default:"border-[var(--chat-composer-attached-outline)]",error:"border-destructive/24",info:"border-info/24",success:"border-success/24",warning:"border-warning/24"};function _T({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)]",iH[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:{...MT,...i===s.id?rH:RT},children:u(NT,{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:{...MT,...i===m.id?aH:RT},children:u(NT,{item:m,attached:!1,exiting:i===m.id,onDismissRequest:()=>p(m)})},m.id))})})}):null]})})}function NT({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(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(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(Ih,{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 DT=Ct(!1),OT=DT.Provider;function FT(){return Ht(DT)}function BT({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(_T,{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(OT,{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 zT(e,t){let n=e!==null&&e!=="plan-follow-up";return{showTopDrawer:e!==null&&(n||!t),showCollapsedPromptRow:t&&!n,hasBlocking:n}}var sH=["image/gif","image/jpeg","image/png","image/webp"],lH=new Set(sH);function pv(e){return lH.has(e.toLowerCase())}function dH(e){return pv(e)?"image":"file"}var cH=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/")||cH.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 dH(e.mimeType)==="image"?{type:"image",...t}:{type:"file",...t}}ue();var uH=/(^|\s)\$([a-zA-Z][a-zA-Z0-9:_-]*)(?=\s)/g,fH=/(^|\s)@(?:"((?:\\.|[^"\\])*)"|([^\s@"]+))(?=\s)/g;var pH=new RegExp("(^|\\s)\\[((?:\\\\.|[^\\]\\\\]){0,512})\\]\\(([^)\\s]+)\\)(?=\\s)","g"),mH=/^[A-Za-z][A-Za-z0-9+.-]*:/,gH=/^[A-Za-z]:[\\/]/,hH=/^[a-z0-9][a-z0-9._-]*\/[a-z0-9][a-z0-9._-]*(?:\/[^\s@"]+)*$/;function vH(e){let t=[];for(let n of e.matchAll(pH)){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=mH.test(s)&&!gH.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(fH)){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&&hH.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=vH(e);for(let o of e.matchAll(uH)){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 yH(e){return e.replace(/\r\n/g,`
|
|
3762
|
+
`).replace(/^\n+|\n+$/g,"")}function xH(e){return yH(e.text).length>0}function UT(e){return!xH(e)}function CH(e,t){return e.lineStart===e.lineEnd?t("pendingContext.terminalLine",{line:e.lineStart}):t("pendingContext.terminalLines",{start:e.lineStart,end:e.lineEnd})}function HT(e,t){return t("pendingContext.terminalLabel",{terminal:e.terminalLabel,range:CH(e,t)})}function $T(e,t,n){return e<=n&&n<t}function KT(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 VT(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 bH(e,t){return VT(e,n=>n.type!=="text"?!1:t(n.text,n.promptOffset))}function wH(e,t){return bH(e,(n,o)=>{for(let r of _c(n))if(r.type==="mention"&&t(r,o)===!0)return!0;return!1})}function SH(e){let t=[];if(!e)return t;let n=_c(e),o=0;for(let r of n)r.start<o||(r.start>o&&KT(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&&KT(t,e.slice(o)),t}function vv(e,t,n){return!e||t>=n?!1:wH(e,(o,r)=>{let a=r+o.start,i=r+o.end,s=a-1,l=i;return!!(s>=0&&/\s/.test(e[s]??"")&&$T(t,n,s)||l<e.length&&/\s/.test(e[l]??"")&&$T(t,n,l))})}function Is(e,t=[]){if(!e)return[];let n=[],o=0;return VT(e,r=>r.type==="text"?(n.push(...SH(r.text)),!1):(n.push({type:"terminal-context",context:t[o]??null}),o+=1,!1)),n}function WT(e){return e.isMobileViewport?null:e.modifierKey&&e.shiftKey?e.isDraftThread?"background":null:e.shiftKey?null:e.modifierKey?"steer":"foreground"}var qT=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 IH(e){return e===" "||e===`
|
|
3763
|
+
`||e===" "||e==="\r"||e==="\uFFFC"}function TH(e,t){let n=t-1;for(;n>=0&&!IH(e[n]??"");)n-=1;return n+1}function jo(e,t){let n=yv(e,t),o=Is(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 GT(e){return e.type==="text"?e.text.length:1}function jT(e,t){let n=e.reduce((o,r)=>o+GT(r),0);return Number.isFinite(t)?Math.max(0,Math.min(n,Math.floor(t))):n}function pr(e,t){return jT(Is(e),t)}function bo(e,t){let n=yv(e,t),o=Is(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 Dc(e,t,n){let o=Is(e);if(!o.some(qT))return!1;let r=jT(o,t),a=0;for(let i of o){if(qT(i)&&(n==="left"&&r===a+1||n==="right"&&r===a))return!0;a+=GT(i)}return!1}function wo(e,t){let n=yv(e,t),o=e.lastIndexOf(`
|
|
3764
|
+
`,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=TH(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 QT(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(gl,{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(gl,{className:"size-3 shrink-0","aria-hidden":"true"}),n("stash.label"),r]})});ue();function YT(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 XT({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:YT(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(ns,{"aria-hidden":!0,className:"size-3 shrink-0"}),u("span",{children:l("tasksBadge.label")}),u(XT,{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(en,{"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(ns,{"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(XT,{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(en,{"aria-hidden":!0,className:"size-3"})})]})}),JT=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(ns,{"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(en,{"aria-hidden":!0,className:"size-3"})})]}),u("div",{className:"space-y-px px-3 pb-4 sm:px-4",role:"list",children:YT(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?La(s.durationMs):s.status==="inProgress"?a("tasksBadge.now"):null})]},i))})]})});var kH={"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:kH[e.code];return n===void 0?e.reason:t(n,{status:e.httpStatus??""})}function ZT(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 ek(e){switch(e){case"image":return ts;case"pdf":return es;case"text":return Zi;case"file":return vo}}var tk="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",nk=`${tk} border border-border/70 bg-accent/40 text-foreground`,LH=`${nk} text-[12px]`,bi=`${nk} 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",ok="truncate leading-tight",ia="block self-center truncate leading-tight select-none",rk=`${tk} select-none border border-fuchsia-500/25 bg-fuchsia-500/12 text-[0.86em] text-fuchsia-700 dark:text-fuchsia-300`,ak='<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 ik=Ct(null),sk=ik.Provider;function Wt(){let e=Ht(ik);if(e===null)throw new Error("Composer API has not been provided.");return e}function PH(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(`
|
|
3765
|
+
`)}function AH({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:Ap,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:PH(e,o.formatLabel,o.formatSourceLabel)})]})}function lk({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(AH,{context:o,onRemove:t},o.id))})}function dk({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:Ap,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 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 ck({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(Vd,{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(as,{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(ss,{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(en,{className:"size-3"})})]},c.id)})})}ue();function uk(e,t){let n=t?.hasWideActions?780:620;return e!==null&&e<n}function fk(e,t){return t?.hasWideActions?e!==null&&e<780:!1}function pk(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=uk(o,{hasWideActions:t});return{isComposerFooterCompact:a,isComposerPrimaryActionsCompact:a&&fk(o,{hasWideActions:t})}}ue();function EH(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 RH(e){return e.replaceAll("\\","/")}function sa(e){let t=e.displayName?.trim();return t||EH(e.name)}function mk(e,t){return t?e.filter(n=>n.enabled):[]}function gk(e,t){let n=new Set(t.map(o=>o.name.trim().toLowerCase()));return e.filter(o=>!n.has(o.name.trim().toLowerCase()))}function hk(e){let t=RH(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();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 vk={recent:"slashMenu.sections.recent",builtIn:"slashMenu.sections.builtIn",provider:"slashMenu.sections.provider",skills:"slashMenu.sections.skills"},yk=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(MH,{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"))})})})})}),MH=pe(function(t){let{t:n}=Ce(),o=t.item.type==="skill"?hk(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(vk[t.sectionTitle]??vk.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(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(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(DH,{kind:o,showSkillSuffix:t.triggerKind==="skill"}):null]})]})]})}),NH={app:Bd,repo:ii,project:ii,personal:oa,system:oc,other:Zd},_H={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 DH(e){let{t}=Ce(),n=NH[e.kind],o=t(_H[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 bv={};En(bv,{LexicalComposerContext:()=>xk,createLexicalComposerContext:()=>OH,useLexicalComposerContext:()=>FH});ue();var xk=Ct(null);function OH(e,t){let n=null;return e!=null&&(n=e[1]),{getTheme:function(){return t??(n!=null?n.getTheme():null)}}}function FH(){let e=Ht(xk);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,Ck=wv.LexicalComposerContext,bk=wv.createLexicalComposerContext,Cn=wv.useLexicalComposerContext;var Yy={};En(Yy,{$addUpdateTag:()=>hm,$applyNodeReplacement:()=>iu,$caretFromPoint:()=>Ri,$caretRangeFromSelection:()=>dy,$cloneWithProperties:()=>Vy,$cloneWithPropertiesEphemeral:()=>CK,$comparePointCaretNext:()=>jy,$copyNode:()=>$y,$create:()=>wK,$createLineBreakNode:()=>ql,$createNodeSelection:()=>Ly,$createParagraphNode:()=>_a,$createPoint:()=>_r,$createRangeSelection:()=>uP,$createRangeSelectionFromDom:()=>Q$,$createTabNode:()=>cm,$createTextNode:()=>Hn,$extendCaretToRange:()=>Wy,$findMatchingParent:()=>Hc,$getAdjacentChildCaret:()=>Zl,$getAdjacentNode:()=>RP,$getAdjacentSiblingOrParentSiblingCaret:()=>EK,$getCaretInDirection:()=>Mi,$getCaretRange:()=>Ei,$getCaretRangeInDirection:()=>Xy,$getCharacterOffsets:()=>ty,$getChildCaret:()=>Oa,$getChildCaretAtIndex:()=>WP,$getChildCaretOrSelf:()=>HP,$getCollapsedCaretRange:()=>$P,$getCommonAncestor:()=>$c,$getCommonAncestorResultBranchOrder:()=>Qy,$getEditor:()=>Ky,$getNearestNodeFromDOMNode:()=>gm,$getNearestRootOrShadowRoot:()=>_P,$getNodeByKey:()=>Fn,$getNodeByKeyOrThrow:()=>DP,$getNodeFromDOMNode:()=>Dy,$getPreviousSelection:()=>Ds,$getRoot:()=>Qo,$getSelection:()=>Ft,$getSiblingCaret:()=>Wn,$getState:()=>Kp,$getStateChange:()=>g$,$getTextContent:()=>J$,$getTextNodeOffset:()=>Nr,$getTextPointCaret:()=>Ai,$getTextPointCaretSlice:()=>sy,$getWritableNodeState:()=>py,$hasAncestor:()=>rm,$hasUpdateTag:()=>gK,$insertNodes:()=>Y$,$isBlockElementNode:()=>j$,$isChildCaret:()=>Mr,$isDecoratorNode:()=>tn,$isEditorState:()=>nK,$isElementNode:()=>re,$isExtendableTextPointCaret:()=>qP,$isInlineElementOrDecoratorNode:()=>hK,$isLeafNode:()=>fK,$isLineBreakNode:()=>Ps,$isNodeCaret:()=>TK,$isNodeSelection:()=>nu,$isParagraphNode:()=>yP,$isRangeSelection:()=>Ge,$isRootNode:()=>to,$isRootOrShadowRoot:()=>gr,$isSiblingCaret:()=>_s,$isTabNode:()=>ky,$isTextNode:()=>ze,$isTextPointCaret:()=>Da,$isTextPointCaretSlice:()=>AK,$isTokenOrSegmented:()=>Ra,$isTokenOrTab:()=>Ii,$nodesOfType:()=>mK,$normalizeCaret:()=>Er,$normalizeSelection__EXPERIMENTAL:()=>Vp,$onUpdate:()=>NP,$parseSerializedNode:()=>tK,$removeTextFromCaretRange:()=>VP,$rewindSiblingCaret:()=>od,$selectAll:()=>pK,$setCompositionKey:()=>Kn,$setPointFromCaret:()=>ed,$setSelection:()=>_o,$setSelectionFromCaretRange:()=>KP,$setState:()=>h$,$splitAtPointCaretNext:()=>NK,$splitNode:()=>vK,$updateRangeSelectionFromCaretRange:()=>Kc,ArtificialNode__DO_NOT_USE:()=>nm,BEFORE_INPUT_COMMAND:()=>gy,BLUR_COMMAND:()=>VL,CAN_REDO_COMMAND:()=>P$,CAN_UNDO_COMMAND:()=>A$,CLEAR_EDITOR_COMMAND:()=>k$,CLEAR_HISTORY_COMMAND:()=>L$,CLICK_COMMAND:()=>LL,COLLABORATION_TAG:()=>tP,COMMAND_PRIORITY_CRITICAL:()=>sK,COMMAND_PRIORITY_EDITOR:()=>zl,COMMAND_PRIORITY_HIGH:()=>iK,COMMAND_PRIORITY_LOW:()=>rK,COMMAND_PRIORITY_NORMAL:()=>aK,COMPOSITION_END_COMMAND:()=>yy,COMPOSITION_END_TAG:()=>aP,COMPOSITION_START_COMMAND:()=>vy,COMPOSITION_START_TAG:()=>rP,CONTROLLED_TEXT_INSERTION_COMMAND:()=>Hl,COPY_COMMAND:()=>Sy,CUT_COMMAND:()=>Iy,DELETE_CHARACTER_COMMAND:()=>Gc,DELETE_LINE_COMMAND:()=>Qc,DELETE_WORD_COMMAND:()=>jc,DRAGEND_COMMAND:()=>$L,DRAGOVER_COMMAND:()=>HL,DRAGSTART_COMMAND:()=>UL,DROP_COMMAND:()=>zL,DecoratorNode:()=>Yc,ElementNode:()=>Li,FOCUS_COMMAND:()=>KL,FORMAT_ELEMENT_COMMAND:()=>T$,FORMAT_TEXT_COMMAND:()=>wi,HISTORIC_TAG:()=>F$,HISTORY_MERGE_TAG:()=>Up,HISTORY_PUSH_TAG:()=>B$,INDENT_CONTENT_COMMAND:()=>S$,INPUT_COMMAND:()=>hy,INSERT_LINE_BREAK_COMMAND:()=>Bc,INSERT_PARAGRAPH_COMMAND:()=>qv,INSERT_TAB_COMMAND:()=>w$,INTERNAL_$isBlock:()=>Na,IS_ALL_FORMATTING:()=>XH,IS_BOLD:()=>KH,IS_CODE:()=>GH,IS_HIGHLIGHT:()=>cy,IS_ITALIC:()=>VH,IS_STRIKETHROUGH:()=>qH,IS_SUBSCRIPT:()=>jH,IS_SUPERSCRIPT:()=>QH,IS_UNDERLINE:()=>WH,KEY_ARROW_DOWN_COMMAND:()=>NL,KEY_ARROW_LEFT_COMMAND:()=>EL,KEY_ARROW_RIGHT_COMMAND:()=>PL,KEY_ARROW_UP_COMMAND:()=>ML,KEY_BACKSPACE_COMMAND:()=>DL,KEY_DELETE_COMMAND:()=>FL,KEY_DOWN_COMMAND:()=>wy,KEY_ENTER_COMMAND:()=>Qp,KEY_ESCAPE_COMMAND:()=>OL,KEY_MODIFIER_COMMAND:()=>qL,KEY_SPACE_COMMAND:()=>_L,KEY_TAB_COMMAND:()=>BL,LineBreakNode:()=>Vl,MOVE_TO_END:()=>AL,MOVE_TO_START:()=>RL,NODE_STATE_KEY:()=>d$,OUTDENT_CONTENT_COMMAND:()=>I$,PASTE_COMMAND:()=>xy,PASTE_TAG:()=>z$,ParagraphNode:()=>jl,REDO_COMMAND:()=>by,REMOVE_TEXT_COMMAND:()=>Wv,RootNode:()=>Gl,SELECTION_CHANGE_COMMAND:()=>my,SELECTION_INSERT_CLIPBOARD_NODES_COMMAND:()=>b$,SELECT_ALL_COMMAND:()=>Gv,SKIP_COLLAB_TAG:()=>U$,SKIP_DOM_SELECTION_TAG:()=>oP,SKIP_SCROLL_INTO_VIEW_TAG:()=>nP,SKIP_SELECTION_FOCUS_TAG:()=>Zv,TEXT_TYPE_TO_FORMAT:()=>lo,TabNode:()=>Wl,TextNode:()=>Rs,UNDO_COMMAND:()=>Cy,addClassNamesToElement:()=>zK,buildImportMap:()=>O$,configExtension:()=>DK,createCommand:()=>tt,createEditor:()=>lK,createSharedNodeState:()=>bL,createState:()=>m$,declarePeerDependency:()=>OK,defineExtension:()=>_K,flipDirection:()=>Ni,getDOMOwnerDocument:()=>Uy,getDOMSelection:()=>Or,getDOMSelectionFromTarget:()=>OP,getDOMTextNode:()=>Ns,getEditorPropertyFromDOMNode:()=>ru,getNearestEditorFromDOMNode:()=>_y,getRegisteredNode:()=>My,getRegisteredNodeOrThrow:()=>Ry,getStaticNodeConfig:()=>su,getTextDirection:()=>uK,getTransformSetFromKlass:()=>CP,isBlockDomNode:()=>ay,isCurrentlyReadOnlyMode:()=>td,isDOMDocumentNode:()=>SP,isDOMNode:()=>nd,isDOMTextNode:()=>ca,isDOMUnmanaged:()=>UP,isDocumentFragment:()=>FP,isExactShortcutMatch:()=>$t,isHTMLAnchorElement:()=>yK,isHTMLElement:()=>So,isInlineDomNode:()=>BP,isLexicalEditor:()=>pm,isModifierMatch:()=>EP,isSelectionCapturedInDecoratorInput:()=>Ny,isSelectionWithinEditor:()=>ou,makeStepwiseIterator:()=>Gy,mergeRegister:()=>HK,normalizeClassNames:()=>lu,removeClassNamesFromElement:()=>UK,removeFromParent:()=>Ti,resetRandomKey:()=>dK,safeCast:()=>FK,setDOMUnmanaged:()=>bK,setNodeIndentFromDOM:()=>zP,shallowMergeConfig:()=>BK,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 pL(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,BH=Dr&&"documentMode"in document?document.documentMode:null,Ar=Dr&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),ki=Dr&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),$p=!(!Dr||!("InputEvent"in window)||BH)&&"getTargetRanges"in new window.InputEvent("input"),im=Dr&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),tu=Dr&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,zH=Dr&&/Android/.test(navigator.userAgent),mL=Dr&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Nv=Dr&&zH&&mL,sm=Dr&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&Ar&&!mL,UH=0,HH=1,$H=2,KH=1,VH=2,qH=4,WH=8,GH=16,jH=32,QH=64,cy=128,XH=2047,YH=1,JH=2,ZH=3,e$=4,t$=5,n$=6,Vc=im||tu||sm?"\xA0":"\u200B",lm=`
|
|
3744
3766
|
|
|
3745
|
-
`,fy=Li?"\xA0":Kc,pL="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",mL="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",XH=new RegExp("^[^"+mL+"]*["+pL+"]"),YH=new RegExp("^[^"+pL+"]*["+mL+"]"),so={bold:1,capitalize:1024,code:16,highlight:uy,italic:2,lowercase:256,strikethrough:4,subscript:32,superscript:64,underline:8,uppercase:512},JH={directionless:1,unmergeable:2},Dv={center:2,end:6,justify:4,left:1,right:3,start:5},ZH={[qH]:"center",[QH]:"end",[GH]:"justify",[VH]:"left",[WH]:"right",[jH]:"start"},e$={normal:0,segmented:2,token:1},t$={[NH]:"normal",[DH]:"segmented",[_H]:"token"},n$="$",Ck="$config";function gL(e,t,n,o,r,a){let i=e.getFirstChild();for(;i!==null;){let s=i.__key;i.__parent===t&&(ne(i)&&gL(i,s,n,o,r,a),n.has(s)||a.delete(s),r.push(s)),i=i.getNextSibling()}}var Ov=!1,py=0;function o$(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&&pm(e,n)!==void 0}function r$(e,t,n){let o=Br(qo(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 a$(e,t,n){if(je(e)){let o=e.anchor.getNode();if(o.is(n)&&e.format!==o.getFormat())return!1}return ga(t)&&n.isAttached()}function i$(e,t,n,o){for(let r=e;r&&!BP(r);r=ru(r)){let a=pm(r,t);if(a!==void 0){let i=Hn(a,n);if(i)return on(i)||!wo(r)?void 0:[r,i]}else if(r===o)return[o,IP(n)]}}function hL(e,t,n){Ov=!0;let o=performance.now()-py>100;try{ma(e,()=>{let r=Dt()||(function(p){return p.getEditorState().read(()=>{let m=Dt();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=i$(h,e,s,i);if(!v)continue;let[y,x]=v;if(g==="characterData")o&&Be(x)&&ga(h)&&a$(r,h,x)&&r$(h,x,e);else if(g==="childList"){d=!0;let C=m.addedNodes;for(let S=0;S<C.length;S++){let T=C[S],I=Oy(T),k=T.parentNode;if(k!=null&&T!==l&&I===null&&!Iv(T,k,e)){if(Li){let E=(wo(T)?T.innerText:null)||T.nodeValue;E&&(c+=E)}k.removeChild(T)}}let w=m.removedNodes,L=w.length;if(L>0){let S=0;for(let T=0;T<L;T++){let I=w[T];(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&&No(r),Li&&EP(e)&&r.insertRawText(c))})}finally{Ov=!1}}function vL(e){let t=e._observer;t!==null&&hL(e,t.takeRecords(),t)}function yL(e){(function(t){py===0&&qo(t).addEventListener("textInput",o$,!0)})(e),e._observer=new MutationObserver((t,n)=>{hL(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||c$).bind(n),this.isEqual=(n.isEqual||Object.is).bind(n),this.defaultValue=this.parse(void 0)}};function s$(e,t){return new Fv(e,t)}function $p(e,t,n="latest"){let o=(n==="latest"?e.getLatest():e).__state;return o?o.getValue(t):t.defaultValue}function l$(e,t,n){let o=$p(e,n,"direct"),r=$p(t,n,"direct");return n.isEqual(o,r)?null:[o,r]}function d$(e,t,n){let o;if(qn(),typeof n=="function"){let a=e.getLatest(),i=$p(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 xL(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 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 bk(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=bk(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,CL(t));return t.__state=n,n}function CL(e){return e.__state?e.__state.sharedNodeState:My(Vy(),e.getType()).sharedNodeState}function bk(e){if(e)for(let t in e)return e}function c$(e){return e}function wk(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 Sk(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 Ik(e,t){let n=e.__state;return n&&n.node===e?n.getWritable(t):n}function Tk(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&&wk(p,c,f)||f&&wk(p,f,c)||c&&Sk(p,c,f)||f&&Sk(p,f,c))})(l,d))}function kk(e,t){let n=e.mergeWithSibling(t),o=Zt()._normalizedNodes;return o.add(e.__key),o.add(t.__key),n}function Lk(e){let t,n,o=e;if(o.__text!==""||!o.isSimpleText()||o.isUnmergeable()){for(;(t=o.getPreviousSibling())!==null&&Be(t)&&t.isSimpleText()&&!t.isUnmergeable();){if(t.__text!==""){if(Tk(t,o)){o=kk(t,o);break}break}t.remove()}for(;(n=o.getNextSibling())!==null&&Be(n)&&n.isSimpleText()&&!n.isUnmergeable();){if(n.__text!==""){if(Tk(o,n)){o=kk(o,n);break}break}n.remove()}}else o.remove()}function Kp(e){return Pk(e.anchor),Pk(e.focus),e}function Pk(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),Be(o)){e.set(o.__key,r?o.getTextContentSize():0,"text",!0);break}if(!ne(o))break;e.set(o.__key,r?o.getChildrenSize():0,"element",!0)}}var Ls,eo,Vc,lm,zv,Uv,Ps,Nr,Hv,qc,Un="",pa=null,Is=null,Dl=!1,Vp=!1;function qp(e,t){let n=Ps.get(e);if(t!==null){let o=qv(e);o.parentNode===t&&t.removeChild(o)}if(Nr.has(e)||eo._keyToDOMMap.delete(e),ne(n)){let o=Gp(n,Ps);$v(o,0,o.length-1,null)}n!==void 0&&Uy(qc,Vc,lm,n,"destroyed")}function $v(e,t,n,o){for(let r=t;r<=n;++r){let a=e[r];a!==void 0&&qp(a,o)}}function Ss(e,t){e.setProperty("text-align",t)}var u$="40px";function bL(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(eo._rootElement||e).getPropertyValue("--lexical-indent-base-value")||u$;e.style.setProperty("padding-inline-start",`calc(${t} * ${o})`)}function wL(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 Kv(e,t){let n=(function(o){let r=o.__dir;if(r!==null)return r;if(Zn(o))return null;let a=o.getParentOrThrow();return Zn(a)&&a.__dir===null?"auto":null})(t);n!==null?e.dir=n:e.removeAttribute("dir")}function Wp(e,t){let n=Nr.get(e);n===void 0&&se(60);let o=n.createDOM(Ls,eo);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,eo),Be(n)?o.setAttribute("data-lexical-text","true"):on(n)&&o.setAttribute("data-lexical-decorator","true"),ne(n)){let r=n.__indent,a=n.__size;if(Kv(o,n),r!==0&&bL(o,r),a!==0){let s=a-1;Vv(Gp(n,Nr),n,0,s,n.getDOMSlot(o))}let i=n.__format;i!==0&&wL(o,i),n.isInline()||SL(null,n,o)}else{let r=n.getTextContent();if(on(n)){let a=n.decorate(eo,Ls);a!==null&&IL(e,a),o.contentEditable="false"}Un+=r}return t!==null&&t.insertChild(o),Uy(qc,Vc,lm,n,"created"),o}function Vv(e,t,n,o,r){let a=Un;Un="";let i=n;for(;i<=o;++i){Wp(e[i],r);let s=Nr.get(e[i]);s!==null&&Be(s)?pa===null&&(pa=s.getFormat(),Is=s.getStyle()):ne(s)&&i<o&&!s.isInline()&&(Un+=sm)}r.element.__lexicalTextContent=Un,Un=a+Un}function Ak(e,t){if(e){let n=e.__last;if(n){let o=t.get(n);if(o)return ks(o)?"line-break":on(o)&&o.isInline()?"decorator":null}return"empty"}return null}function SL(e,t,n){let o=Ak(e,Ps),r=Ak(t,Nr);o!==r&&t.getDOMSlot(n).setManagedLineBreak(r)}function f$(e,t,n){var o;pa=null,Is=null,(function(r,a,i){let s=Un,l=r.__size,d=a.__size;Un="";let c=i.element;if(l===1&&d===1){let f=r.__first,p=a.__first;if(f===p)Dp(f,c);else{let g=qv(f),h=Wp(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}qp(f,null)}let m=Nr.get(p);Be(m)&&pa===null&&(pa=m.getFormat(),Is=m.getStyle())}else{let f=Gp(r,Ps),p=Gp(a,Nr);if(f.length!==l&&se(227),p.length!==d&&se(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,T=x.getFirstChild(),I=0,k=0;for(;I<=C&&k<=w;){let _=g[I],A=h[k];if(_===A)T=Tv(Dp(A,x.element)),I++,k++;else{if(S===void 0&&(S=Ek(h,k)),L===void 0)L=Ek(g,I);else if(!L.has(_)){I++;continue}if(!S.has(_)){T=Tv(qv(_)),qp(_,x.element),I++,L.delete(_);continue}if(L.has(A)){let z=Gl(eo,A);z!==T&&x.withBefore(T).insertChild(z),T=Tv(Dp(A,x.element)),I++,k++}else Wp(A,x.withBefore(T)),k++}let B=Nr.get(A);B!==null&&Be(B)?pa===null&&(pa=B.getFormat(),Is=B.getStyle()):ne(B)&&k<=w&&!B.isInline()&&(Un+=sm)}let E=I>C,P=k>w;if(E&&!P){let _=h[w+1],A=_===void 0?null:eo.getElementByKey(_);Vv(h,0,k,w,x.withBefore(A))}else P&&!E&&$v(g,I,C,x.element)})(0,f,p,l,d,i)}c.__lexicalTextContent=Un,Un=s+Un})(e,t,t.getDOMSlot(n)),o=t,pa==null||pa===o.__textFormat||Vp||o.setTextFormat(pa),(function(r){Is==null||Is===r.__textStyle||Vp||r.setTextStyle(Is)})(t)}function Gp(e,t){let n=[],o=e.__first;for(;o!==null;){let r=t.get(o);r===void 0&&se(101),n.push(o),o=r.__next}return n}function Dp(e,t){let n=Ps.get(e),o=Nr.get(e);n!==void 0&&o!==void 0||se(61);let r=Dl||Uv.has(e)||zv.has(e),a=Gl(eo,e);if(n===o&&!r){let i;if(ne(n)){let s=a.__lexicalTextContent;typeof s=="string"?i=s:(i=n.getTextContent(),a.__lexicalTextContent=i)}else i=n.getTextContent();return Un+=i,a}if(n!==o&&r&&Uy(qc,Vc,lm,o,"updated"),o.updateDOM(n,a,Ls)){let i=Wp(e,null);return t===null&&se(62),t.replaceChild(i,a),qp(e,null),i}if(ne(n)){ne(o)||se(334,e);let i=o.__indent;(Dl||i!==n.__indent)&&bL(a,i);let s=o.__format;if((Dl||s!==n.__format)&&wL(a,s),r)f$(n,o,a),Zn(o)||o.isInline()||SL(n,o,a);else{let l=a.__lexicalTextContent,d;typeof l=="string"?d=l:(d=n.getTextContent(),a.__lexicalTextContent=d),Un+=d}if((Dl||o.__dir!==n.__dir)&&(Kv(a,o),Zn(o)&&!Dl))for(let l of o.getChildren())ne(l)&&Kv(Gl(eo,l.getKey()),l)}else{let i=o.getTextContent();if(on(o)){let s=o.decorate(eo,Ls);s!==null&&IL(e,s)}Un+=i}if(!Vp&&Zn(o)&&o.__cachedText!==Un){let i=o.getWritable();i.__cachedText=Un,o=i}return a}function IL(e,t){let n=eo._pendingDecorators,o=eo._decorators;if(n===null){if(o[e]===t)return;n=SP(eo)}n[e]=t}function Tv(e){let t=e.nextSibling;return t!==null&&t===eo._blockCursorElement&&(t=t.nextSibling),t}function Ek(e,t){let n=new Set;for(let o=t;o<e.length;o++)n.add(e[o]);return n}function p$(e,t,n,o,r,a){Un="",Dl=o===2,eo=n,Ls=n._config,Vc=n._nodes,lm=eo._listeners.mutation,zv=r,Uv=a,Ps=e._nodeMap,Nr=t._nodeMap,Vp=t._readOnly,Hv=new Map(n._keyToDOMMap);let i=new Map;return qc=i,Dp("root",null),eo=void 0,Vc=void 0,zv=void 0,Uv=void 0,Ps=void 0,Nr=void 0,Ls=void 0,Hv=void 0,qc=void 0,i}function qv(e){let t=Hv.get(e);return t===void 0&&se(75,e),t}function nt(e){return{type:e}}var gy=nt("SELECTION_CHANGE_COMMAND"),m$=nt("SELECTION_INSERT_CLIPBOARD_NODES_COMMAND"),TL=nt("CLICK_COMMAND"),hy=nt("BEFORE_INPUT_COMMAND"),vy=nt("INPUT_COMMAND"),yy=nt("COMPOSITION_START_COMMAND"),xy=nt("COMPOSITION_END_COMMAND"),Wc=nt("DELETE_CHARACTER_COMMAND"),Fc=nt("INSERT_LINE_BREAK_COMMAND"),Wv=nt("INSERT_PARAGRAPH_COMMAND"),zl=nt("CONTROLLED_TEXT_INSERTION_COMMAND"),Cy=nt("PASTE_COMMAND"),Gv=nt("REMOVE_TEXT_COMMAND"),Gc=nt("DELETE_WORD_COMMAND"),jc=nt("DELETE_LINE_COMMAND"),Si=nt("FORMAT_TEXT_COMMAND"),by=nt("UNDO_COMMAND"),wy=nt("REDO_COMMAND"),Sy=nt("KEYDOWN_COMMAND"),kL=nt("KEY_ARROW_RIGHT_COMMAND"),LL=nt("MOVE_TO_END"),PL=nt("KEY_ARROW_LEFT_COMMAND"),AL=nt("MOVE_TO_START"),EL=nt("KEY_ARROW_UP_COMMAND"),RL=nt("KEY_ARROW_DOWN_COMMAND"),jp=nt("KEY_ENTER_COMMAND"),ML=nt("KEY_SPACE_COMMAND"),NL=nt("KEY_BACKSPACE_COMMAND"),_L=nt("KEY_ESCAPE_COMMAND"),DL=nt("KEY_DELETE_COMMAND"),OL=nt("KEY_TAB_COMMAND"),g$=nt("INSERT_TAB_COMMAND"),h$=nt("INDENT_CONTENT_COMMAND"),v$=nt("OUTDENT_CONTENT_COMMAND"),FL=nt("DROP_COMMAND"),y$=nt("FORMAT_ELEMENT_COMMAND"),BL=nt("DRAGSTART_COMMAND"),zL=nt("DRAGOVER_COMMAND"),UL=nt("DRAGEND_COMMAND"),Iy=nt("COPY_COMMAND"),Ty=nt("CUT_COMMAND"),jv=nt("SELECT_ALL_COMMAND"),x$=nt("CLEAR_EDITOR_COMMAND"),C$=nt("CLEAR_HISTORY_COMMAND"),b$=nt("CAN_REDO_COMMAND"),w$=nt("CAN_UNDO_COMMAND"),HL=nt("FOCUS_COMMAND"),$L=nt("BLUR_COMMAND"),KL=nt("KEY_MODIFIER_COMMAND"),Ra=Object.freeze({}),Qv=[["keydown",function(e,t){Qc=e.timeStamp,VL=e.key,!t.isComposing()&&Ee(t,Sy,e)}],["pointerdown",function(e,t){let n=e.target,o=e.pointerType;ed(n)&&o!=="touch"&&o!=="pen"&&e.button===0&&ma(t,()=>{CP(n)||(Jv=!0)})}],["compositionstart",function(e,t){Ee(t,yy,e)}],["compositionend",function(e,t){Li?Oc=!0:eu||!am&&!im?Ee(t,xy,e):(Op=!0,Fp=e.data)}],["input",function(e,t){e.stopPropagation(),ma(t,()=>{t.dispatchCommand(vy,e)},{event:e}),Ol=null}],["click",function(e,t){ma(t,()=>{let n=Dt(),o=Br(qo(t)),r=Ns();if(o){if(je(n)){let a=n.anchor,i=a.getNode();if(a.type==="element"&&a.offset===0&&n.isCollapsed()&&!Zn(i)&&Vo().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=>ne(l)&&!l.isInline());ne(s)&&s.select(0)}}else if(e.pointerType==="touch"||e.pointerType==="pen"){let a=o.anchorNode;(wo(a)||ga(a))&&No(cm(r,o,t,e))}}Ee(t,TL,e)})}],["cut",Ra],["copy",Ra],["dragstart",Ra],["dragover",Ra],["dragend",Ra],["paste",Ra],["focus",Ra],["blur",Ra],["drop",Ra]];Hp&&Qv.push(["beforeinput",(e,t)=>(function(n,o){let r=n.inputType;r==="deleteCompositionText"||Li&&EP(o)||r!=="insertCompositionText"&&Ee(o,hy,n)})(e,t)]);var Qc=0,VL=null,qL=0,Ol=null,Xv=new WeakMap,Qp=new WeakMap,Yv=!1,Jv=!1,Bc=!1,Oc=!1,Op=!1,Fp="",Ts=null,WL=[0,"",0,"root",0];function GL(e,t,n,o,r){let a=e.anchor,i=e.focus,s=a.getNode(),l=Zt(),d=Br(qo(l)),c=d!==null?d.anchorNode:null,f=a.key,p=l.getElementByKey(f),m=n.length;return f!==i.key||!Be(s)||(!r&&(!Hp||qL<o+50)||s.isDirty()&&m<2||TP(n))&&a.offset!==i.offset&&!s.isComposing()||_a(s)||s.isDirty()&&m>1||(r||!Hp)&&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=Ti(h);return v===0?!h.canInsertTextBefore()||!y.canInsertTextBefore()&&!h.isComposing()||x||(function(C){let w=C.getPreviousSibling();return(Be(w)||ne(w)&&w.isInline())&&!w.canInsertTextAfter()})(h):v===h.getTextContentSize()&&(!h.canInsertTextAfter()||!y.canInsertTextAfter()&&!h.isComposing()||x)})(e,s)}function Rk(e,t){return ga(e)&&e.nodeValue!==null&&t!==0&&t!==e.nodeValue.length}function Mk(e,t,n){let{anchorNode:o,anchorOffset:r,focusNode:a,focusOffset:i}=e;Yv&&(Yv=!1,Rk(o,r)&&Rk(a,i)&&!Ts)||ma(t,()=>{if(!n)return void No(null);if(!nu(t,o,a))return;let s=Dt();if(Ts&&je(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(),No(s))}if(Ts=null,je(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]=WL,y=Vo(),x=t.isComposing()===!1&&y.getTextContent()==="";if(f<v+200&&l.offset===g&&l.key===h)Bp(s,p,m);else if(l.type==="text")Be(d)||se(141),jL(s,d);else if(l.type==="element"&&!x){ne(d)||se(259);let C=l.getNode();C.isEmpty()?(function(w,L){let S=L.getTextFormat(),T=L.getTextStyle();Bp(w,S,T)})(s,C):Bp(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],T=S.getTextContentSize();if(Be(S)&&T!==0&&!(L===0&&S.__key===y&&h===T||L===m-1&&S.__key===x&&v===0)&&(w=!0,C&=S.getFormat(),C===0))break}s.format=w?C:0}}Ee(t,gy,void 0)})}function Bp(e,t,n){e.format===t&&e.style===n||(e.format=t,e.style=n,e.dirty=!0)}function jL(e,t){Bp(e,t.getFormat(),t.getStyle())}function QL(e){if(!e.getTargetRanges)return null;let t=e.getTargetRanges();return t.length===0?null:t[0]}function S$(e){let t=e.inputType,n=QL(e),o=Zt(),r=Dt();if(t==="deleteContentBackward"){if(r===null){let f=Ns();if(!je(f))return!0;No(f.clone())}if(je(r)){let f=r.anchor.key===r.focus.key;if(a=e.timeStamp,VL==="MediaLast"&&a<Qc+30&&o.isComposing()&&f){if(Wn(null),Qc=0,setTimeout(()=>{ma(o,()=>{Wn(null)})},30),je(r)){let p=r.anchor.getNode();p.markDirty(),Be(p)||se(142),jL(r,p)}}else{Wn(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=!on(AP(r.anchor,!0))),!v){Ee(o,Wc,!0);let y=Dt();_v&&je(y)&&y.isCollapsed()&&(Ts=y,setTimeout(()=>Ts=null))}}return!0}}var a;if(!je(r))return!0;let i=e.data;Ol!==null&&By(!1,o,Ol),r.dirty&&Ol===null||!r.isCollapsed()||Zn(r.anchor.getNode())||n===null||r.applyDOMRange(n),Ol=null;let s=r.anchor,l=r.focus,d=s.getNode(),c=l.getNode();if(t==="insertText"||t==="insertTranspose"){if(i===`
|
|
3746
|
-
`)e.preventDefault(),
|
|
3747
|
-
`){let o=Dt();if(je(o)||tu(o)){if(je(o)){let r=o.focus;o.anchor.set(r.key,r.offset,r.type)}return void Ee(e,jp,null)}}}By(!0,e,t)}function L$(e){let t=Zt();if(e.key==null)return!0;if(Op){if(aL(e))return ma(t,()=>{Xp(t,Fp)}),Op=!1,Fp="",!0;Op=!1,Fp=""}if((function(n){return Vt(n,"ArrowRight",{shiftKey:"any"})})(e))Ee(t,kL,e);else if((function(n){return Vt(n,"ArrowRight",Na)})(e))Ee(t,LL,e);else if((function(n){return Vt(n,"ArrowLeft",{shiftKey:"any"})})(e))Ee(t,PL,e);else if((function(n){return Vt(n,"ArrowLeft",Na)})(e))Ee(t,AL,e);else if((function(n){return Vt(n,"ArrowUp",{altKey:"any",shiftKey:"any"})})(e))Ee(t,EL,e);else if((function(n){return Vt(n,"ArrowDown",{altKey:"any",shiftKey:"any"})})(e))Ee(t,RL,e);else if((function(n){return Vt(n,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any",shiftKey:!0})})(e))Bc=!0,Ee(t,jp,e);else if((function(n){return n.key===" "})(e))Ee(t,ML,e);else if((function(n){return Rr&&Vt(n,"o",{ctrlKey:!0})})(e))e.preventDefault(),Bc=!0,Ee(t,Fc,!0);else if((function(n){return Vt(n,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any"})})(e))Bc=!1,Ee(t,jp,e);else if((function(n){return Vt(n,"Backspace",{shiftKey:"any"})||Rr&&Vt(n,"h",{ctrlKey:!0})})(e))aL(e)?Ee(t,NL,e):(e.preventDefault(),Ee(t,Wc,!0));else if((function(n){return n.key==="Escape"})(e))Ee(t,_L,e);else if((function(n){return Vt(n,"Delete",{})||Rr&&Vt(n,"d",{ctrlKey:!0})})(e))(function(n){return n.key==="Delete"})(e)?Ee(t,DL,e):(e.preventDefault(),Ee(t,Wc,!1));else if((function(n){return Vt(n,"Backspace",rL)})(e))e.preventDefault(),Ee(t,Gc,!0);else if((function(n){return Vt(n,"Delete",rL)})(e))e.preventDefault(),Ee(t,Gc,!1);else if((function(n){return Rr&&Vt(n,"Backspace",{metaKey:!0})})(e))e.preventDefault(),Ee(t,jc,!0);else if((function(n){return Rr&&(Vt(n,"Delete",{metaKey:!0})||Vt(n,"k",{ctrlKey:!0}))})(e))e.preventDefault(),Ee(t,jc,!1);else if((function(n){return Vt(n,"b",Na)})(e))e.preventDefault(),Ee(t,Si,"bold");else if((function(n){return Vt(n,"u",Na)})(e))e.preventDefault(),Ee(t,Si,"underline");else if((function(n){return Vt(n,"i",Na)})(e))e.preventDefault(),Ee(t,Si,"italic");else if((function(n){return Vt(n,"Tab",{shiftKey:"any"})})(e))Ee(t,OL,e);else if((function(n){return Vt(n,"z",Na)})(e))e.preventDefault(),Ee(t,by,void 0);else if((function(n){return Rr?Vt(n,"z",{metaKey:!0,shiftKey:!0}):Vt(n,"y",{ctrlKey:!0})||Vt(n,"z",{ctrlKey:!0,shiftKey:!0})})(e))e.preventDefault(),Ee(t,wy,void 0);else{let n=t._editorState._selection;n===null||je(n)?iL(e)&&(e.preventDefault(),Ee(t,jv,e)):(function(o){return Vt(o,"c",Na)})(e)?(e.preventDefault(),Ee(t,Iy,e)):(function(o){return Vt(o,"x",Na)})(e)?(e.preventDefault(),Ee(t,Ty,e)):iL(e)&&(e.preventDefault(),Ee(t,jv,e))}return(function(n){return n.ctrlKey||n.shiftKey||n.altKey||n.metaKey})(e)&&t.dispatchCommand(KL,e),!0}function XL(e){let t=e.__lexicalEventHandles;return t===void 0&&(t=[],e.__lexicalEventHandles=t),t}var Ul=new Map;function YL(e){let t=_P(e.target);if(t===null)return;let n=Dy(t.anchorNode);if(n===null)return;Jv&&(Jv=!1,ma(n,()=>{let l=Ns(),d=t.anchorNode;(wo(d)||ga(d))&&No(cm(l,t,n,e))}));let o=Fy(n),r=o[o.length-1],a=r._key,i=Ul.get(a),s=i||r;s!==n&&Mk(t,s,!1),Mk(t,n,!0),n!==r?Ul.set(a,n):i&&Ul.delete(a)}function Nk(e){e._lexicalHandled=!0}function _k(e){return e._lexicalHandled===!0}var Dk=()=>{};function P$(e){let t=Xv.get(e);if(t===void 0)return void Dk();let n=Qp.get(t);if(n===void 0)return void Dk();let o=n-1;o>=0||se(164),Xv.delete(e),Qp.set(t,o),o===0&&t.removeEventListener("selectionchange",YL);let r=ou(e);fm(r)?((function(i){if(i._parentEditor!==null){let s=Fy(i),l=s[s.length-1]._key;Ul.get(l)===i&&Ul.delete(l)}else Ul.delete(i._key)})(r),e.__lexicalEditor=null):r&&se(198);let a=XL(e);for(let i=0;i<a.length;i++)a[i]();e.__lexicalEventHandles=[]}function Zv(e,t,n){qn();let o=e.__key,r=e.getParent();if(r===null)return;let a=(function(s){let l=Dt();if(!je(l)||!ne(s))return l;let{anchor:d,focus:c}=l,f=d.getNode(),p=c.getNode();return om(f,s)&&d.set(s.__key,0,"element"),om(p,s)&&c.set(s.__key,0,"element"),l})(e),i=!1;if(je(a)&&t){let s=a.anchor,l=a.focus;s.key===o&&(em(s,e,r,e.getPreviousSibling(),e.getNextSibling()),i=!0),l.key===o&&(em(l,e,r,e.getPreviousSibling(),e.getNextSibling()),i=!0)}else tu(a)&&t&&e.isSelected()&&e.selectPrevious();if(je(a)&&t&&!i){let s=e.getIndexWithinParent();ki(e),Zp(a,r,s,-1)}else ki(e);n||ur(r)||r.canBeEmpty()||!r.isEmpty()||Zv(r,t),t&&a&&Zn(r)&&r.isEmpty()&&r.selectEnd()}function A$(e){return e}var JL=Symbol.for("ephemeral");function Yp(e){return e[JL]||!1}var cr=class{__type;__key;__parent;__prev;__next;__state;static getType(){let{ownNodeType:t}=iu(this);return t===void 0&&se(64,this.name),t}static clone(t){se(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}),wP(this,t)}getType(){return this.__type}isInline(){se(137,this.constructor.name)}isAttached(){let t=this.__key;for(;t!==null;){if(t==="root")return!0;let n=Hn(t);if(n===null)break;t=n.__parent}return!1}isSelected(t){let n=t||Dt();if(n==null)return!1;let o=n.getNodes().some(r=>r.__key===this.__key);if(Be(this))return o;if(je(n)&&n.anchor.type==="element"&&n.focus.type==="element"){if(n.isCollapsed())return!1;let r=this.getParent();if(on(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:Hn(t)}getParentOrThrow(){let t=this.getParent();return t===null&&se(66,this.__key),t}getTopLevelElement(){let t=this;for(;t!==null;){let n=t.getParent();if(ur(n))return ne(t)||t===this&&on(t)||se(194),t;t=n}return null}getTopLevelElementOrThrow(){let t=this.getTopLevelElement();return t===null&&se(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:Hn(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:Hn(t)}getNextSiblings(){let t=[],n=this.getNextSibling();for(;n!==null;)t.push(n),n=n.getNextSibling();return t}getCommonAncestor(t){let n=ne(this)?this:this.getParent(),o=ne(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"?Xy(n)===-1:(n.type!=="same"&&n.type!=="ancestor"&&se(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=ne(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&&se(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=Zt()._dirtyLeaves;return t!==null&&t.has(this.__key)}getLatest(){if(Yp(this))return this;let t=Hn(this.__key);return t===null&&se(113),t}getWritable(){if(Yp(this))return this;qn();let t=Ua(),n=Zt(),o=t._nodeMap,r=this.__key,a=this.getLatest(),i=n._cloneNotNeeded,s=Dt();if(s!==null&&s.setCachedNodes(null),i.has(r))return nm(a),a;let l=qy(a);return i.add(r),nm(l),o.set(r,l),l}getTextContent(){return""}getTextContentSize(){return this.getTextContent().length}createDOM(t,n){se(70)}updateDOM(t,n,o){se(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){se(18,this.name)}updateFromJSON(t){return(function(n,o){let r=n.getWritable(),a=o.$,i=a;for(let s of CL(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){qn();let o=Dt();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;ki(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&&(ne(this)&&ne(s)||se(139),this.getChildren().forEach(h=>{s.append(h)})),je(o)){No(o);let h=o.anchor,v=o.focus;h.key===a&&zk(h,s),v.key===a&&zk(v,s)}return Ii()===a&&Wn(i),s}insertAfter(t,n=!0){qn(),Rv(this,t);let o=this.getWritable(),r=t.getWritable(),a=r.getParent(),i=Dt(),s=!1,l=!1;if(a!==null){let m=t.getIndexWithinParent();if(ki(r),je(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&&je(i)){let m=this.getIndexWithinParent();Zp(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){qn(),Rv(this,t);let o=this.getWritable(),r=t.getWritable(),a=r.__key;ki(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=Dt();return n&&je(c)&&Zp(c,this.getParentOrThrow(),d),t}isParentRequired(){return!1}createParentElementNode(){return Fa()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(t,n){qn();let o=this.getPreviousSibling(),r=this.getParentOrThrow();if(o===null)return r.select(0,0);if(ne(o))return o.select();if(!Be(o)){let a=o.getIndexWithinParent()+1;return r.select(a,a)}return o.select(t,n)}selectNext(t,n){qn();let o=this.getNextSibling(),r=this.getParentOrThrow();if(o===null)return r.select();if(ne(o))return o.select(0,0);if(!Be(o)){let a=o.getIndexWithinParent();return r.select(a,a)}return o.select(t,n)}markDirty(){this.getWritable()}reconcileObservedMutation(t,n){this.markDirty()}},E$="historic",R$="history-push",zp="history-merge",M$="paste",ZL="collaboration",N$="skip-collab",eP="skip-scroll-into-view",tP="skip-dom-selection",ey="skip-selection-focus",nP="composition-start",oP="composition-end",$l=class e extends cr{static getType(){return"linebreak"}static clone(t){return new e(t.__key)}constructor(t){super(t)}getTextContent(){return`
|
|
3748
|
-
`}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&&
|
|
3767
|
+
`,uy=ki?"\xA0":Vc,gL="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",hL="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",o$=new RegExp("^[^"+hL+"]*["+gL+"]"),r$=new RegExp("^[^"+gL+"]*["+hL+"]"),lo={bold:1,capitalize:1024,code:16,highlight:cy,italic:2,lowercase:256,strikethrough:4,subscript:32,superscript:64,underline:8,uppercase:512},a$={directionless:1,unmergeable:2},_v={center:2,end:6,justify:4,left:1,right:3,start:5},i$={[JH]:"center",[n$]:"end",[e$]:"justify",[YH]:"left",[ZH]:"right",[t$]:"start"},s$={normal:0,segmented:2,token:1},l$={[UH]:"normal",[$H]:"segmented",[HH]:"token"},d$="$",wk="$config";function vL(e,t,n,o,r,a){let i=e.getFirstChild();for(;i!==null;){let s=i.__key;i.__parent===t&&(re(i)&&vL(i,s,n,o,r,a),n.has(s)||a.delete(s),r.push(s)),i=i.getNextSibling()}}var Dv=!1,fy=0;function c$(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 u$(e,t,n){let o=Or(Xo(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 f$(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 p$(e,t,n,o){for(let r=e;r&&!UP(r);r=au(r)){let a=mm(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,kP(n)]}}function yL(e,t,n){Dv=!0;let o=performance.now()-fy>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=p$(h,e,s,i);if(!v)continue;let[y,x]=v;if(g==="characterData")o&&ze(x)&&ca(h)&&f$(r,h,x)&&u$(h,x,e);else if(g==="childList"){d=!0;let C=m.addedNodes;for(let S=0;S<C.length;S++){let T=C[S],I=Dy(T),k=T.parentNode;if(k!=null&&T!==l&&I===null&&!Sv(T,k,e)){if(ki){let E=(So(T)?T.innerText:null)||T.nodeValue;E&&(c+=E)}k.removeChild(T)}}let w=m.removedNodes,L=w.length;if(L>0){let S=0;for(let T=0;T<L;T++){let I=w[T];(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),ki&&MP(e)&&r.insertRawText(c))})}finally{Dv=!1}}function xL(e){let t=e._observer;t!==null&&yL(e,t.takeRecords(),t)}function CL(e){(function(t){fy===0&&Xo(t).addEventListener("textInput",c$,!0)})(e),e._observer=new MutationObserver((t,n)=>{yL(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||v$).bind(n),this.isEqual=(n.isEqual||Object.is).bind(n),this.defaultValue=this.parse(void 0)}};function m$(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 g$(e,t,n){let o=Kp(e,n,"direct"),r=Kp(t,n,"direct");return n.isEqual(o,r)?null:[o,r]}function h$(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 bL(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 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 Sk(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=Sk(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,wL(t));return t.__state=n,n}function wL(e){return e.__state?e.__state.sharedNodeState:Ry(Ky(),e.getType()).sharedNodeState}function Sk(e){if(e)for(let t in e)return e}function v$(e){return e}function Ik(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 Tk(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 kk(e,t){let n=e.__state;return n&&n.node===e?n.getWritable(t):n}function Lk(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&&Ik(p,c,f)||f&&Ik(p,f,c)||c&&Tk(p,c,f)||f&&Tk(p,f,c))})(l,d))}function Pk(e,t){let n=e.mergeWithSibling(t),o=Yt()._normalizedNodes;return o.add(e.__key),o.add(t.__key),n}function Ak(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(Lk(t,o)){o=Pk(t,o);break}break}t.remove()}for(;(n=o.getNextSibling())!==null&&ze(n)&&n.isSimpleText()&&!n.isUnmergeable();){if(n.__text!==""){if(Lk(o,n)){o=Pk(o,n);break}break}n.remove()}}else o.remove()}function Vp(e){return Ek(e.anchor),Ek(e.focus),e}function Ek(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,dm,Bv,zv,Es,Rr,Uv,Wc,On="",la=null,ks=null,Fl=!1,qp=!1;function Wp(e,t){let n=Es.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,Es);Hv(o,0,o.length-1,null)}n!==void 0&&zy(Wc,qc,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 Ts(e,t){e.setProperty("text-align",t)}var y$="40px";function SL(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")||y$;e.style.setProperty("padding-inline-start",`calc(${t} * ${o})`)}function IL(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 $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(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($v(o,n),r!==0&&SL(o,r),a!==0){let s=a-1;Kv(jp(n,Rr),n,0,s,n.getDOMSlot(o))}let i=n.__format;i!==0&&IL(o,i),n.isInline()||TL(null,n,o)}else{let r=n.getTextContent();if(tn(n)){let a=n.decorate(no,As);a!==null&&kL(e,a),o.contentEditable="false"}On+=r}return t!==null&&t.insertChild(o),zy(Wc,qc,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(),ks=s.getStyle()):re(s)&&i<o&&!s.isInline()&&(On+=lm)}r.element.__lexicalTextContent=On,On=a+On}function Rk(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 TL(e,t,n){let o=Rk(e,Es),r=Rk(t,Rr);o!==r&&t.getDOMSlot(n).setManagedLineBreak(r)}function x$(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)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(),ks=m.getStyle())}else{let f=jp(r,Es),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,T=x.getFirstChild(),I=0,k=0;for(;I<=C&&k<=w;){let _=g[I],A=h[k];if(_===A)T=Iv(Op(A,x.element)),I++,k++;else{if(S===void 0&&(S=Mk(h,k)),L===void 0)L=Mk(g,I);else if(!L.has(_)){I++;continue}if(!S.has(_)){T=Iv(Vv(_)),Wp(_,x.element),I++,L.delete(_);continue}if(L.has(A)){let B=Ql(no,A);B!==T&&x.withBefore(T).insertChild(B),T=Iv(Op(A,x.element)),I++,k++}else Gp(A,x.withBefore(T)),k++}let F=Rr.get(A);F!==null&&ze(F)?la===null&&(la=F.getFormat(),ks=F.getStyle()):re(F)&&k<=w&&!F.isInline()&&(On+=lm)}let E=I>C,P=k>w;if(E&&!P){let _=h[w+1],A=_===void 0?null:no.getElementByKey(_);Kv(h,0,k,w,x.withBefore(A))}else P&&!E&&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){ks==null||ks===r.__textStyle||qp||r.setTextStyle(ks)})(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=Es.get(e),o=Rr.get(e);n!==void 0&&o!==void 0||de(61);let r=Fl||zv.has(e)||Bv.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&&zy(Wc,qc,dm,o,"updated"),o.updateDOM(n,a,As)){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;(Fl||i!==n.__indent)&&SL(a,i);let s=o.__format;if((Fl||s!==n.__format)&&IL(a,s),r)x$(n,o,a),to(o)||o.isInline()||TL(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)&&($v(a,o),to(o)&&!Fl))for(let l of o.getChildren())re(l)&&$v(Ql(no,l.getKey()),l)}else{let i=o.getTextContent();if(tn(o)){let s=o.decorate(no,As);s!==null&&kL(e,s)}On+=i}if(!qp&&to(o)&&o.__cachedText!==On){let i=o.getWritable();i.__cachedText=On,o=i}return a}function kL(e,t){let n=no._pendingDecorators,o=no._decorators;if(n===null){if(o[e]===t)return;n=TP(no)}n[e]=t}function Iv(e){let t=e.nextSibling;return t!==null&&t===no._blockCursorElement&&(t=t.nextSibling),t}function Mk(e,t){let n=new Set;for(let o=t;o<e.length;o++)n.add(e[o]);return n}function C$(e,t,n,o,r,a){On="",Fl=o===2,no=n,As=n._config,qc=n._nodes,dm=no._listeners.mutation,Bv=r,zv=a,Es=e._nodeMap,Rr=t._nodeMap,qp=t._readOnly,Uv=new Map(n._keyToDOMMap);let i=new Map;return Wc=i,Op("root",null),no=void 0,qc=void 0,Bv=void 0,zv=void 0,Es=void 0,Rr=void 0,As=void 0,Uv=void 0,Wc=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"),b$=tt("SELECTION_INSERT_CLIPBOARD_NODES_COMMAND"),LL=tt("CLICK_COMMAND"),gy=tt("BEFORE_INPUT_COMMAND"),hy=tt("INPUT_COMMAND"),vy=tt("COMPOSITION_START_COMMAND"),yy=tt("COMPOSITION_END_COMMAND"),Gc=tt("DELETE_CHARACTER_COMMAND"),Bc=tt("INSERT_LINE_BREAK_COMMAND"),qv=tt("INSERT_PARAGRAPH_COMMAND"),Hl=tt("CONTROLLED_TEXT_INSERTION_COMMAND"),xy=tt("PASTE_COMMAND"),Wv=tt("REMOVE_TEXT_COMMAND"),jc=tt("DELETE_WORD_COMMAND"),Qc=tt("DELETE_LINE_COMMAND"),wi=tt("FORMAT_TEXT_COMMAND"),Cy=tt("UNDO_COMMAND"),by=tt("REDO_COMMAND"),wy=tt("KEYDOWN_COMMAND"),PL=tt("KEY_ARROW_RIGHT_COMMAND"),AL=tt("MOVE_TO_END"),EL=tt("KEY_ARROW_LEFT_COMMAND"),RL=tt("MOVE_TO_START"),ML=tt("KEY_ARROW_UP_COMMAND"),NL=tt("KEY_ARROW_DOWN_COMMAND"),Qp=tt("KEY_ENTER_COMMAND"),_L=tt("KEY_SPACE_COMMAND"),DL=tt("KEY_BACKSPACE_COMMAND"),OL=tt("KEY_ESCAPE_COMMAND"),FL=tt("KEY_DELETE_COMMAND"),BL=tt("KEY_TAB_COMMAND"),w$=tt("INSERT_TAB_COMMAND"),S$=tt("INDENT_CONTENT_COMMAND"),I$=tt("OUTDENT_CONTENT_COMMAND"),zL=tt("DROP_COMMAND"),T$=tt("FORMAT_ELEMENT_COMMAND"),UL=tt("DRAGSTART_COMMAND"),HL=tt("DRAGOVER_COMMAND"),$L=tt("DRAGEND_COMMAND"),Sy=tt("COPY_COMMAND"),Iy=tt("CUT_COMMAND"),Gv=tt("SELECT_ALL_COMMAND"),k$=tt("CLEAR_EDITOR_COMMAND"),L$=tt("CLEAR_HISTORY_COMMAND"),P$=tt("CAN_REDO_COMMAND"),A$=tt("CAN_UNDO_COMMAND"),KL=tt("FOCUS_COMMAND"),VL=tt("BLUR_COMMAND"),qL=tt("KEY_MODIFIER_COMMAND"),Pa=Object.freeze({}),jv=[["keydown",function(e,t){Xc=e.timeStamp,WL=e.key,!t.isComposing()&&Re(t,wy,e)}],["pointerdown",function(e,t){let n=e.target,o=e.pointerType;nd(n)&&o!=="touch"&&o!=="pen"&&e.button===0&&da(t,()=>{wP(n)||(Yv=!0)})}],["compositionstart",function(e,t){Re(t,vy,e)}],["compositionend",function(e,t){ki?Fc=!0:tu||!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}),Bl=null}],["click",function(e,t){da(t,()=>{let n=Ft(),o=Or(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(um(r,o,t,e))}}Re(t,LL,e)})}],["cut",Pa],["copy",Pa],["dragstart",Pa],["dragover",Pa],["dragend",Pa],["paste",Pa],["focus",Pa],["blur",Pa],["drop",Pa]];$p&&jv.push(["beforeinput",(e,t)=>(function(n,o){let r=n.inputType;r==="deleteCompositionText"||ki&&MP(o)||r!=="insertCompositionText"&&Re(o,gy,n)})(e,t)]);var Xc=0,WL=null,GL=0,Bl=null,Qv=new WeakMap,Xp=new WeakMap,Xv=!1,Yv=!1,zc=!1,Fc=!1,Fp=!1,Bp="",Ls=null,jL=[0,"",0,"root",0];function QL(e,t,n,o,r){let a=e.anchor,i=e.focus,s=a.getNode(),l=Yt(),d=Or(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&&(!$p||GL<o+50)||s.isDirty()&&m<2||LP(n))&&a.offset!==i.offset&&!s.isComposing()||Ra(s)||s.isDirty()&&m>1||(r||!$p)&&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 Nk(e,t){return ca(e)&&e.nodeValue!==null&&t!==0&&t!==e.nodeValue.length}function _k(e,t,n){let{anchorNode:o,anchorOffset:r,focusNode:a,focusOffset:i}=e;Xv&&(Xv=!1,Nk(o,r)&&Nk(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]=jL,y=Qo(),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),XL(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(),T=L.getTextStyle();zp(w,S,T)})(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],T=S.getTextContentSize();if(ze(S)&&T!==0&&!(L===0&&S.__key===y&&h===T||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 XL(e,t){zp(e,t.getFormat(),t.getStyle())}function YL(e){if(!e.getTargetRanges)return null;let t=e.getTargetRanges();return t.length===0?null:t[0]}function E$(e){let t=e.inputType,n=YL(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,WL==="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),XL(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=!tn(RP(r.anchor,!0))),!v){Re(o,Gc,!0);let y=Ft();Nv&&Ge(y)&&y.isCollapsed()&&(Ls=y,setTimeout(()=>Ls=null))}}return!0}}var a;if(!Ge(r))return!0;let i=e.data;Bl!==null&&Fy(!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===`
|
|
3768
|
+
`)e.preventDefault(),Re(o,Bc,!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&&QL(r,n,i,e.timeStamp,!0)?(e.preventDefault(),Re(o,Hl,i)):Bl=i;return GL=e.timeStamp,!0}switch(e.preventDefault(),t){case"insertFromYank":case"insertFromDrop":case"insertReplacementText":Re(o,Hl,e);break;case"insertFromComposition":Kn(null),Re(o,Hl,e);break;case"insertLineBreak":Kn(null),Re(o,Bc,!1);break;case"insertParagraph":Kn(null),zc&&!tu?(zc=!1,Re(o,Bc,!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)||!Ii(f)||!Ii(p)})(d,c)&&Re(o,Wv,e);break;case"deleteByDrag":case"deleteByCut":Re(o,Wv,e);break;case"deleteContent":Re(o,Gc,!1);break;case"deleteWordBackward":Re(o,jc,!0);break;case"deleteWordForward":Re(o,jc,!1);break;case"deleteHardLineBackward":case"deleteSoftLineBackward":Re(o,Qc,!0);break;case"deleteContentForward":case"deleteHardLineForward":case"deleteSoftLineForward":Re(o,Qc,!1);break;case"formatStrikeThrough":Re(o,wi,"strikethrough");break;case"formatBold":Re(o,wi,"bold");break;case"formatItalic":Re(o,wi,"italic");break;case"formatUnderline":Re(o,wi,"underline");break;case"historyUndo":Re(o,Cy,void 0);break;case"historyRedo":Re(o,by,void 0)}return!0}function R$(e){if(So(e.target)&&wP(e.target))return!0;let t=Yt(),n=Ft(),o=e.data,r=YL(e);if(o!=null&&Ge(n)&&QL(n,r,o,e.timeStamp,!1)){Fc&&(Yp(t,o),Fc=!1);let a=n.anchor.getNode(),i=Or(Xo(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)===AP(i.anchorNode)||Re(t,Hl,o);let c=o.length;ki&&c>1&&e.inputType==="insertCompositionText"&&!t.isComposing()&&(n.anchor.offset-=c),Nv&&t.isComposing()&&(Xc=0,Kn(null))}else Fy(!1,t,o!==null?o:void 0),Fc&&(Yp(t,o||void 0),Fc=!1);return(function(){$n();let a=Yt();xL(a)})(),!0}function M$(e){let t=Yt(),n=Ft();if(Ge(n)&&!t.isComposing()){let o=n.anchor,r=n.anchor.getNode();Kn(o.key),hm(rP),(e.timeStamp<Xc+30||o.type==="element"||!n.isCollapsed()||r.getFormat()!==n.format||ze(r)&&r.getStyle()!==n.style)&&Re(t,Hl,uy)}return!0}function N$(e){return Yp(Yt(),e.data),hm(aP),!0}function Yp(e,t){let n=e._compositionKey;if(Kn(null),n!==null&&t!=null){if(t===""){let o=Fn(n),r=Ns(e.getElementByKey(n));if(r!==null&&r.nodeValue!==null&&ze(o)){let a=Or(Xo(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]===`
|
|
3769
|
+
`){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,Qp,null)}}}Fy(!0,e,t)}function _$(e){let t=Yt();if(e.key==null)return!0;if(Fp){if(sL(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,PL,e);else if((function(n){return $t(n,"ArrowRight",Ea)})(e))Re(t,AL,e);else if((function(n){return $t(n,"ArrowLeft",{shiftKey:"any"})})(e))Re(t,EL,e);else if((function(n){return $t(n,"ArrowLeft",Ea)})(e))Re(t,RL,e);else if((function(n){return $t(n,"ArrowUp",{altKey:"any",shiftKey:"any"})})(e))Re(t,ML,e);else if((function(n){return $t(n,"ArrowDown",{altKey:"any",shiftKey:"any"})})(e))Re(t,NL,e);else if((function(n){return $t(n,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any",shiftKey:!0})})(e))zc=!0,Re(t,Qp,e);else if((function(n){return n.key===" "})(e))Re(t,_L,e);else if((function(n){return Ar&&$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,Qp,e);else if((function(n){return $t(n,"Backspace",{shiftKey:"any"})||Ar&&$t(n,"h",{ctrlKey:!0})})(e))sL(e)?Re(t,DL,e):(e.preventDefault(),Re(t,Gc,!0));else if((function(n){return n.key==="Escape"})(e))Re(t,OL,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,FL,e):(e.preventDefault(),Re(t,Gc,!1));else if((function(n){return $t(n,"Backspace",iL)})(e))e.preventDefault(),Re(t,jc,!0);else if((function(n){return $t(n,"Delete",iL)})(e))e.preventDefault(),Re(t,jc,!1);else if((function(n){return Ar&&$t(n,"Backspace",{metaKey:!0})})(e))e.preventDefault(),Re(t,Qc,!0);else if((function(n){return Ar&&($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,BL,e);else if((function(n){return $t(n,"z",Ea)})(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)?lL(e)&&(e.preventDefault(),Re(t,Gv,e)):(function(o){return $t(o,"c",Ea)})(e)?(e.preventDefault(),Re(t,Sy,e)):(function(o){return $t(o,"x",Ea)})(e)?(e.preventDefault(),Re(t,Iy,e)):lL(e)&&(e.preventDefault(),Re(t,Gv,e))}return(function(n){return n.ctrlKey||n.shiftKey||n.altKey||n.metaKey})(e)&&t.dispatchCommand(qL,e),!0}function JL(e){let t=e.__lexicalEventHandles;return t===void 0&&(t=[],e.__lexicalEventHandles=t),t}var $l=new Map;function ZL(e){let t=OP(e.target);if(t===null)return;let n=_y(t.anchorNode);if(n===null)return;Yv&&(Yv=!1,da(n,()=>{let l=Ds(),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=$l.get(a),s=i||r;s!==n&&_k(t,s,!1),_k(t,n,!0),n!==r?$l.set(a,n):i&&$l.delete(a)}function Dk(e){e._lexicalHandled=!0}function Ok(e){return e._lexicalHandled===!0}var Fk=()=>{};function D$(e){let t=Qv.get(e);if(t===void 0)return void Fk();let n=Xp.get(t);if(n===void 0)return void Fk();let o=n-1;o>=0||de(164),Qv.delete(e),Xp.set(t,o),o===0&&t.removeEventListener("selectionchange",ZL);let r=ru(e);pm(r)?((function(i){if(i._parentEditor!==null){let s=Oy(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=JL(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=Ft();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 nu(a)&&t&&e.isSelected()&&e.selectPrevious();if(Ge(a)&&t&&!i){let s=e.getIndexWithinParent();Ti(e),em(a,r,s,-1)}else Ti(e);n||gr(r)||r.canBeEmpty()||!r.isEmpty()||Jv(r,t),t&&a&&to(r)&&r.isEmpty()&&r.selectEnd()}function O$(e){return e}var eP=Symbol.for("ephemeral");function Jp(e){return e[eP]||!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}),IP(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"?Qy(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(Jp(this))return this;let t=Fn(this.__key);return t===null&&de(113),t}getWritable(){if(Jp(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 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 wL(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=Ft();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;Ti(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&&Hk(h,s),v.key===a&&Hk(v,s)}return Si()===a&&Kn(i),s}insertAfter(t,n=!0){$n(),Ev(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();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;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)&&em(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()}},F$="historic",B$="history-push",Up="history-merge",z$="paste",tP="collaboration",U$="skip-collab",nP="skip-scroll-into-view",oP="skip-dom-selection",Zv="skip-selection-focus",rP="composition-start",aP="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`
|
|
3770
|
+
`}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:H$,priority:0}}}static importJSON(t){return ql().updateFromJSON(t)}};function H$(e){return{node:ql()}}function ql(){return iu(new Vl)}function Ps(e){return e instanceof Vl}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 iP(e,t,n,o,r){let a=o.classList,i=Kl(r,"base");i!==void 0&&a.add(...i),i=Kl(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=Kl(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 sP(e,t,n){let o=t.firstChild,r=n.isComposing(),a=e+(r?Vc:"");if(o==null)t.textContent=a;else{let i=o.nodeValue;if(i!==a)if(r||ki){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 Bk(e,t,n,o,r,a){sP(r,e,t);let i=a.theme.text;i!==void 0&&iP(0,0,o,e,i)}function Np(e,t){let n=document.createElement(t);return n.appendChild(e),n}var Rs=class e extends mr{__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 l$[t.__mode]}getStyle(){return this.getLatest().__style}isToken(){return this.getLatest().__mode===1}isComposing(){return this.__key===Si()}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 Zc(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)),Bk(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 Bk(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)),sP(r,f,this);let p=o.theme.text;p!==void 0&&a!==i&&iP(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:K$,priority:0}),code:()=>({conversion:Aa,priority:0}),em:()=>({conversion:Aa,priority:0}),i:()=>({conversion:Aa,priority:0}),mark:()=>({conversion:Aa,priority:0}),s:()=>({conversion:Aa,priority:0}),span:()=>({conversion:$$,priority:0}),strong:()=>({conversion:Aa,priority:0}),sub:()=>({conversion:Aa,priority:0}),sup:()=>({conversion:Aa,priority:0}),u:()=>({conversion:Aa,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"?a$[t]:t,n}setStyle(t){let n=this.getWritable();return n.__style=t,n}toggleFormat(t){let n=Zc(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=s$[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=Ft(),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 cP(s,o,s,r,"text","text");{let l=Si();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=Ft();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=Si(),i=o.length;t.sort((I,k)=>I-k),t.push(i);let s=[],l=t.length;for(let I=0,k=0;I<i&&k<=l;k++){let E=t[k];E>I&&(s.push(o.slice(I,E)),I=E)}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=Ft();if(Ge(C)){let[I,k]=C.isBackward()?[C.focus,C.anchor]:[C.anchor,C.focus];I.type==="text"&&I.key===r&&(y=I),k.type==="text"&&k.key===r&&(x=k)}n.isSegmented()?(p=Hn(c),p.__format=m,p.__style=g,p.__detail=h,p.__state=kk(n,p),v=!0):p=n.setTextContent(c);let w=[p];for(let I=1;I<d;I++){let k=Hn(s[I]);k.__format=m,k.__style=g,k.__detail=h,k.__state=kk(n,k);let E=k.__key;a===r&&Kn(E),w.push(k)}let L=y?y.offset:null,S=x?x.offset:null,T=0;for(let I of w){if(!y&&!x)break;let k=T+I.getTextContentSize();if(y!==null&&L!==null&&L<=k&&L>=T&&(y.set(I.getKey(),L-T,"text"),L<k&&(y=null)),x!==null&&S!==null&&S<=k&&S>=T){x.set(I.getKey(),S-T,"text");break}T=k}if(f!==null){(function(E){let P=E.getPreviousSibling(),_=E.getNextSibling();P!==null&&om(P),_!==null&&om(_)})(this);let I=f.getWritable(),k=this.getIndexWithinParent();v?(I.splice(k,0,w),this.remove()):I.splice(k,1,w),Ge(C)&&em(C,f,k,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;Si()===r&&Kn(o);let s=Ft();if(Ge(s)){let f=s.anchor,p=s.focus;f!==null&&f.key===r&&jk(f,n,o,t,i),p!==null&&p.key===r&&jk(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 $$(e){return{forChild:Ty(e.style),node:null}}function K$(e){let t=e,n=t.style.fontWeight==="normal";return{forChild:Ty(t.style,n?void 0:"bold"),node:null}}var zk=new WeakMap;function V$(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=zk.get(a))===void 0&&!V$(a);)i.push(a),a=a.parentNode;let s=r===void 0?a:r;for(let l=0;l<i.length;l++)zk.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===`
|
|
3749
3771
|
`||s===`\r
|
|
3750
|
-
`?r.push(
|
|
3751
|
-
`),c=!p.isEmpty();else if(c=!1,
|
|
3772
|
+
`?r.push(ql()):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=Uk(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=Uk(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 Uk(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===""&&!BP(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 W$={code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};function Aa(e){let t=W$[e.nodeName.toLowerCase()];return t===void 0?{node:null}:{forChild:Ty(e.style,t),node:null}}function Hn(e=""){return iu(new Rs(e))}function ze(e){return e instanceof Rs}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 Wl=class e extends Rs{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=Kl(t.theme,"tab");return o!==void 0&&n.classList.add(...o),n}static importJSON(t){return cm().updateFromJSON(t)}setTextContent(t){return t!==" "&&t!==""&&pL(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 iu(new Wl)}function ky(e){return e instanceof Wl}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(Ri(this,"next")),Er(Ri(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,td()||(Si()===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 Hk(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(!nu(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 td()||(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((Ft()||Ds())===this&&t[0]){let n=Wn(t[0],"next");KP(Ei(n,n))}for(let n of t)n.remove()}};function Ge(e){return e instanceof Ms}var Ms=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),_s(o.focus)&&re(o.focus.origin)&&o.focus.getNodeAtCaret()===null)for(let d=Oa(o.focus.origin,"previous");Mr(d)&&s.has(d.origin)&&!d.origin.isEmpty()&&d.origin.is(r[r.length-1]);d=Zl(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=>Da(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 td()||(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+=`
|
|
3773
|
+
`),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!tn(p)&&!Ps(p)||p===o&&this.isCollapsed()||(d+=p.getTextContent())}return d}applyDOMRange(t){let n=Yt(),o=n.getEditorState()._selection,r=dP(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=Zc(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===`
|
|
3752
3774
|
`||i===`\r
|
|
3753
|
-
`?o.push(Kl()):i===" "?o.push(dm()):o.push(Vn(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=Vn();if(S.setFormat(x),S.setStyle(C),hP(L))L.splice(0,0,[S]);else{let T=Zn(w)?Fa().append(S):S;L===null?w.append(T):L.insertBefore(T)}v.is(y)&&y.set(S.__key,0,"text"),v.set(S.__key,0,"text")})(i,s,r,a),s.type==="element"&&Jl(s,Mr(Mi(s,"next")));let l=i.offset,d=s.offset,c=this.getNodes(),f=c.length,p=c[0];Be(p)||se(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&&(_a(p)||!p.canInsertTextAfter()||!g.canInsertTextAfter()&&p.getNextSibling()===null)){let v=p.getNextSibling();if(Be(v)&&v.canInsertTextBefore()&&!_a(v)||(v=Vn(),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&&(_a(p)||!p.canInsertTextBefore()||!g.canInsertTextBefore()&&p.getPreviousSibling()===null)){let v=p.getPreviousSibling();if(Be(v)&&!_a(v)||(v=Vn(),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=Vn(p.getTextContent());v.setFormat(r),p.replace(v),p=v}else if(!this.isCollapsed()&&t!==""){let v=h.getParent();if(!g.canInsertTextBefore()||!g.canInsertTextAfter()||ne(v)&&(!v.canInsertTextBefore()||!v.canInsertTextAfter()))return this.insertText(""),iP(this.anchor,this.focus),void this.insertText(t)}if(f===1){if(Ti(p)){let C=Vn(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=Vn(t);return C.setFormat(r),C.setStyle(a),C.select(),void p.replace(C)}}else{if(p.getTextContent()!==""){let C=Vn(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=ne(p)?p:p.getParentOrThrow(),x=ne(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(Be(h)&&!Ti(h)&&d!==h.getTextContentSize()){if(h.isSegmented()){let I=Vn(h.getTextContent());h.replace(I),h=I}Zn(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),T=y.isInline()&&p.getNextSibling()===null?y:p;for(let I=w.length-1;I>=0;I--){let k=w[I];if(k.is(p)||ne(k)&&k.isParentOf(p))break;k.isAttached()&&(!L.has(k)||k.is(C)?S||T.insertAfter(k,!1):k.remove())}if(!S){let I=x,k=null;for(;I!==null;){let E=I.getChildren(),P=E.length;(P===0||E[P-1].is(k))&&(v.delete(I.__key),k=I),I=I.getParent()}}if(Ti(p))if(l===m)p.select();else{let I=Vn(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 k=c[I],E=k.__key;v.has(E)||k.remove()}}}removeText(){let t=Dt()===this;$c(this,$P(cy(this))),t&&Dt()!==this&&No(this)}formatText(t,n=null){if(this.isCollapsed())return this.toggleFormat(t),void Wn(null);let o=this.getNodes(),r=[];for(let w of o)Be(w)&&r.push(w);let a=w=>{o.forEach(L=>{if(ne(L)){let S=L.getFormatFlags(t,w);L.setTextFormat(S)}})},i=r.length;if(i===0)return this.toggleFormat(t),Wn(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(_a(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||_a(m)||([,m]=m.splitText(g),g=0),m.setFormat(h);let C=y.getFormatFlags(t,h);x>0&&(x===y.getTextContentSize()||_a(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=Dt();return je(g)||se(134),g.insertNodes(t)}let n=(this.isBackward()?this.focus:this.anchor).getNode(),o=Uc(n,Oa),r=t[t.length-1];if(ne(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=>(ne(g)||on(g))&&!g.isInline())){ne(o)||se(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=Fa(),v=null;for(let y=0;y<g.length;y++){let x=g[y],C=ks(x);if(C||on(x)&&x.isInline()||ne(x)&&x.isInline()||Be(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=!ne(o)||!o.isEmpty()?this.insertParagraph():null,d=s[s.length-1],c=s[0];var f;ne(f=c)&&Oa(f)&&!f.isEmpty()&&ne(o)&&(!o.isEmpty()||o.canMergeWhenEmpty())&&(ne(o)||se(211,n.constructor.name,n.getType()),o.append(...c.getChildren()),c=s[1]),c&&(o===null&&se(212,n.constructor.name,n.getType()),(function(g,h){let v=h.getParentOrThrow().getLastChild(),y=h,x=[h];for(;y!==v;)y.getNextSibling()||se(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,Oa);l&&ne(p)&&(l.canMergeWhenEmpty()||Oa(d))&&(p.append(...l.getChildren()),l.remove()),ne(o)&&o.isEmpty()&&o.remove(),i.selectEnd();let m=ne(o)?o.getLastChild():null;ks(m)&&p!==o&&m.remove()}insertParagraph(){if(this.anchor.key==="root"){let i=Fa();return Vo().splice(this.anchor.offset,0,[i]),i.select(),i}let t=Av(this),n=Uc(this.anchor.getNode(),Oa);ne(n)||se(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=Kl();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(Be(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(Be(o)&&(c===o.getTextContentSize()?t.shift():c!==0&&([,o]=o.splitText(c),t[0]=o,l.set(o.getKey(),0,"text"))),Be(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(jk(this,t,n,o))return;let r=t==="move",a=Zt(),i=Br(qo(a));if(!i)return;let s=a._blockCursorElement,l=a._rootElement,d=this.focus.getNode();if(l===null||s===null||!ne(d)||d.isInline()||d.canBeEmpty()||ay(s,a,l),this.dirty){let c=Gl(a,this.anchor.key),f=Gl(a,this.focus.key);this.anchor.type==="text"&&(c=Rs(c)),this.focus.type==="text"&&(f=Rs(f)),c&&f&&cP(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=Zn(f)?f:MP(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];om(y,p)?g.push(y):h=!0}if(h&&g.length>0)if(n){let v=g[0];ne(v)?v.selectStart():v.getParentOrThrow().selectStart()}else{let v=g[g.length-1];ne(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"&&jk(this,t,n,o,"decorators")}forwardDeletion(t,n,o){if(!o&&(t.type==="element"&&ne(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(ne(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(Mi(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(_r(l)){if(!l.origin.isInline()){if(l.origin.isShadowRoot()){if(s.type==="merge-block")break;if(ne(a.anchor.origin)&&a.anchor.origin.isEmpty()){let d=Mr(l);$c(this,Ri(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(ne(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(on(l.origin)){if(!l.origin.isIsolated())if(s.type==="merge-next-block"&&(l.origin.isKeyboardSelectable()||!l.origin.isInline())&&ne(a.anchor.origin)&&a.anchor.origin.isEmpty()){a.anchor.origin.remove();let d=Py();d.add(l.origin.getKey()),No(d)}else l.origin.remove();return}break}}if(s.type==="merge-block"){let{caret:l,block:d}=s;return $c(this,Ri(!l.origin.isEmpty()&&d.isEmpty()?td(Qn(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&&Hk(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 $k(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 $k(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!(TP(w)||U$(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()&&Zn(o.getParent())&&o.getPreviousSibling()===null&&Hk(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 Jp}function Uk(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]:[Uk(n),Uk(o)]}function Hk(e,t){for(let n=t;n;n=n.getParent()){if(ne(n)){if(n.collapseAtStart(e))return!0;if(ur(n))break}if(n.getPreviousSibling())break}return!1}var U$=(()=>{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 $k(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 Kk(e,t,n,o){let r,a=t;if(wo(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=Bl(c),Be(r))a=Dr(r,i?"next":"previous");else{let p=Bl(e);if(p===null)return null;if(ne(p)){let m=o.getElementByKey(p.getKey());m===null&&se(214),[p,a]=p.getDOMSlot(m).resolveChildIndex(p,m,e,t),ne(p)||se(215),i&&a>=p.getChildrenSize()&&(a=Math.max(0,p.getChildrenSize()-1));let h=p.getChildAtIndex(a);if(ne(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=ne(h)?h:h.getParentOrThrow()),a=0}Be(h)?(r=h,p=null,a=Dr(h,i?"next":"previous")):h!==p&&i&&!f&&(ne(p)||se(216),a=Math.min(p.getChildrenSize(),a+1))}else{let m=p.getIndexWithinParent();a=t===0&&on(p)&&Bl(e)===p?m:m+1,p=p.getParentOrThrow()}if(ne(p))return Or(p.__key,a,"element")}}else r=Bl(e);return Be(r)?Or(r.__key,Dr(r,a,"clamp"),"text"):null}function Vk(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&&ne(i)&&i.isInline()){let s=i.getPreviousSibling();Be(s)&&e.set(s.__key,s.getTextContent().length,"text")}}else ne(a)&&!n&&a.isInline()?e.set(a.__key,a.getChildrenSize(),"element"):Be(a)&&e.set(a.__key,a.getTextContent().length,"text")}else if(o===r.getTextContent().length){let a=r.getNextSibling(),i=r.getParent();if(t&&ne(a)&&a.isInline())e.set(a.__key,0,"element");else if((n||t)&&a===null&&ne(i)&&i.isInline()&&!i.canInsertTextAfter()){let s=i.getNextSibling();Be(s)&&e.set(s.__key,0,"text")}}}function iP(e,t,n){if(e.type==="text"&&t.type==="text"){let o=e.isBefore(t),r=e.is(t);Vk(e,o,r),Vk(t,!o,r),r&&t.set(e.key,e.offset,e.type)}}function sP(e,t,n,o,r,a){if(e===null||n===null||!nu(r,e,n))return null;let i=Kk(e,t,je(a)?a.anchor:null,r);if(i===null)return null;let s=Kk(n,o,je(a)?a.focus:null,r);if(s===null)return null;if(i.type==="element"&&s.type==="element"){let l=Bl(e),d=Bl(n);if(on(l)&&on(d))return null}return iP(i,s),[i,s]}function H$(e){return ne(e)&&!e.isInline()}function lP(e,t,n,o,r,a){let i=Ua(),s=new Es(Or(e,t,r),Or(n,o,a),0,"");return s.dirty=!0,i._selection=s,s}function dP(){let e=Or("root",0,"element"),t=Or("root",0,"element");return new Es(e,t,0,"")}function Py(){return new Jp(new Set)}function $$(e,t){return cm(null,e,t,null)}function cm(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(je(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)&&je(e)&&!nu(n,d,c))return e.clone();let m=sP(d,f,c,p,n,e);if(m===null)return null;let[g,h]=m,v=0,y="";if(je(e)){let x=e.anchor;if(g.key===x.key)v=e.format,y=e.style;else{let C=g.getNode();Be(C)?(v=C.getFormat(),y=C.getStyle()):ne(C)&&(v=C.getTextFormat(),y=C.getTextStyle())}}return new Es(g,h,v,y)}function Dt(){return Ua()._selection}function Ns(){return Zt()._editorState._selection}function Zp(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"),qk(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")}}qk(e)}function qk(e){let t=e.anchor,n=t.offset,o=e.focus,r=o.offset,a=t.getNode(),i=o.getNode();if(e.isCollapsed()){if(!ne(a))return;let s=a.getChildrenSize(),l=n>=s,d=l?a.getChildAtIndex(s-1):a.getChildAtIndex(n);if(Be(d)){let c=0;l&&(c=d.getTextContentSize()),t.set(d.__key,c,"text"),o.set(d.__key,c,"text")}return}if(ne(a)){let s=a.getChildrenSize(),l=n>=s,d=l?a.getChildAtIndex(s-1):a.getChildAtIndex(n);if(Be(d)){let c=0;l&&(c=d.getTextContentSize()),t.set(d.__key,c,"text")}}if(ne(i)){let s=i.getChildrenSize(),l=r>=s,d=l?i.getChildAtIndex(s-1):i.getChildAtIndex(r);if(Be(d)){let c=0;l&&(c=d.getTextContentSize()),o.set(d.__key,c,"text")}}}function em(e,t,n,o,r){let a=null,i=0,s=null;o!==null?(a=o.__key,Be(o)?(i=o.getTextContentSize(),s="text"):ne(o)&&(i=o.getChildrenSize(),s="element")):r!==null&&(a=r.__key,Be(r)?s="text":ne(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 Wk(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 cP(e,t,n,o,r){try{e.setBaseAndExtent(t,n,o,r)}catch{}}function Gk(e,t,n){let o=Gl(e,t.getKey());if(ne(t)){let r=t.getDOMSlot(o);return[r.element,n+r.getFirstChildOffset()]}return[o,n]}function K$(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(ZL)&&f!==a||f!==null&&_y(f))return;if(!je(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]=Gk(n,g,p.offset),[x,C]=Gk(n,h,m.offset),w=t.format,L=t.style,S=t.isCollapsed(),T=v,I=x,k=!1;var E,P,_,A,B;if(p.type==="text"?(T=Rs(v),k=g.getFormat()!==w||g.getStyle()!==L):je(e)&&e.anchor.type==="text"&&(k=!0),m.type==="text"&&(I=Rs(x)),T!==null&&I!==null&&(S&&(e===null||k||je(e)&&(e.format!==w||e.style!==L))&&(E=w,P=L,_=y,A=p.key,B=performance.now(),WL=[E,P,_,A,B]),d!==y||c!==C||s!==T||l!==I||o.type==="Range"&&S||(f!==null&&a.contains(f)||r.has(ey)||a.focus({preventScroll:!0}),p.type==="element"))){if(cP(o,T,y,I,C),!Li||!t.isCollapsed()||a===null||r.has(ey)||document.activeElement!==null&&a.contains(document.activeElement)||a.focus({preventScroll:!0}),!r.has(eP)&&t.isCollapsed()&&a!==null&&a===document.activeElement){let z=je(t)&&t.anchor.type==="element"?T.childNodes[y]||null:o.rangeCount>0?o.getRangeAt(0):null;if(z!==null){let q;if(z instanceof Text){let X=document.createRange();X.selectNode(z),q=X.getBoundingClientRect()}else q=z.getBoundingClientRect();(function(X,Se,K){let W=Hy(K),Z=$y(W);if(W===null||Z===null)return;let{top:j,bottom:O}=Se,Y=0,re=0,ue=K;for(;ue!==null;){let le=ue===W.body;if(le)Y=0,re=qo(X).innerHeight;else{let ae=ue.getBoundingClientRect();Y=ae.top,re=ae.bottom}let fe=0;if(j<Y?fe=-(Y-j):O>re&&(fe=O-re),fe!==0)if(le)Z.scrollBy(0,fe);else{let ae=ue.scrollTop;ue.scrollTop+=fe;let Le=ue.scrollTop-ae;j-=Le,O-=Le}if(le)break;ue=ru(ue)}})(n,q,a)}}Yv=!0}}function V$(e){let t=Dt()||Ns();t===null&&(t=Vo().selectEnd()),t.insertNodes(e)}function q$(){let e=Dt();return e===null?"":e.getTextContent()}function Av(e){let t=e;e.isCollapsed()||t.removeText();let n=Dt();je(n)&&(t=n),je(t)||se(161);let o=t.anchor,r=o.getNode(),a=o.offset;for(;!Oa(r);){let i=r;if([r,a]=W$(r,a),i.is(r))break}return a}function W$(e,t){let n=e.getParent();if(!n){let r=Fa();return Vo().append(r),r.select(),[Vo(),0]}if(Be(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(!ne(e)||t===0)return[n,e.getIndexWithinParent()];let o=e.getChildAtIndex(t);if(o){let r=new Es(Or(e.__key,t,"element"),Or(e.__key,t,"element"),0,""),a=e.insertNewAfter(r);a&&a.append(o,...o.getNextSiblings())}return[n,e.getIndexWithinParent()+1]}function jk(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=Mi(e.focus,n?"previous":"next"),i=o==="lineboundary",s=t==="move",l=a,d=r==="decorators-and-blocks";if(!KP(l)){for(let c of l){d=!1;let{origin:f}=c;if(!on(f)||f.isIsolated()||(l=c,!i||!f.isInline()))break}if(d)for(let c of Gy(a).iterNodeCarets(t==="extend"?"shadowRoot":"root")){if(_r(c))c.origin.isInline()||(l=c);else{if(ne(c.origin))continue;on(c.origin)&&!c.origin.isInline()&&(l=c)}break}}if(l===a)return!1;if(s&&!i&&on(l.origin)&&l.origin.isKeyboardSelectable()){let c=Py();return c.add(l.origin.getKey()),No(c),!0}return l=Mr(l),s&&Jl(e.anchor,l),Jl(e.focus,l),d||!i}var Gn=null,jn=null,Mo=!1,Ev=!1,Up=0,Qk={characterData:!0,childList:!0,subtree:!0};function Zl(){return Mo||Gn!==null&&Gn._readOnly}function qn(){Mo&&se(13)}function uP(){Up>99&&se(14)}function Ua(){return Gn===null&&se(195,fP()),Gn}function Zt(){return jn===null&&se(196,fP()),jn}function fP(){let e=0,t=new Set,n=Ai.version;if(typeof window<"u")for(let r of document.querySelectorAll("[contenteditable]")){let a=ou(r);if(fm(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 G$(){return jn}function Xk(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 Yk(e,t){return e!==void 0&&e.__key!==t&&e.isAttached()}function pP(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 j$(e){return Ay(e,Zt()._nodes)}function Ay(e,t){let n=e.type,o=t.get(n);o===void 0&&se(17,n);let r=o.klass;e.type!==r.getType()&&se(18,r.name);let a=r.importJSON(e),i=e.children;if(ne(a)&&Array.isArray(i))for(let s=0;s<i.length;s++){let l=Ay(i[s],t);a.append(l)}return a}function Jk(e,t,n){let o=Gn,r=Mo,a=jn;Gn=t,Mo=!0,jn=e;try{return n()}finally{Gn=o,Mo=r,jn=a}}function Da(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=Gn,c=Mo,f=jn,p=e._updating,m=e._observer,g=null;if(e._pendingEditorState=null,e._editorState=n,!r&&l&&m!==null){jn=e,Gn=n,Mo=!1,e._updating=!0;try{let S=e._dirtyType,T=e._dirtyElements,I=e._dirtyLeaves;m.disconnect(),g=p$(a,n,e,S,T,I)}catch(S){if(S instanceof Error&&e._onError(S),Ev)throw S;return vP(e,null,o,n),yL(e),e._dirtyType=2,Ev=!0,Da(e,a),void(Ev=!1)}finally{m.observe(o,Qk),e._updating=p,Gn=d,Mo=c,jn=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,T){let I=S._decorators,k=S._pendingDecorators||I,E=T._nodeMap,P;for(P in k)E.has(P)||(k===I&&(k=SP(S)),delete k[P])})(e,n);let w=r?null:Br(qo(e));if(e._editable&&w!==null&&(l||s===null||s.dirty||!s.is(i))&&o!==null&&!x.has(tP)){jn=e,Gn=n;try{if(m!==null&&m.disconnect(),l||s===null||s.dirty){let S=e._blockCursorElement;S!==null&&ay(S,e,o),K$(i,s,e,w,x,o)}(function(S,T,I){let k=S._blockCursorElement;if(je(I)&&I.isCollapsed()&&I.anchor.type==="element"&&T.contains(document.activeElement)){let E=I.anchor,P=E.getNode(),_=E.offset,A=!1,B=null;if(_===P.getChildrenSize())Mv(P.getChildAtIndex(_-1))&&(A=!0);else{let z=P.getChildAtIndex(_);if(z!==null&&Mv(z)){let q=z.getPreviousSibling();(q===null||Mv(q))&&(A=!0,B=S.getElementByKey(z.__key))}}if(A){let z=S.getElementByKey(P.__key);return k===null&&(S._blockCursorElement=k=(function(q){let X=q.theme,Se=document.createElement("div");Se.contentEditable="false",Se.setAttribute("data-lexical-cursor","true");let K=X.blockCursor;if(K!==void 0){if(typeof K=="string"){let W=su(K);K=X.blockCursor=W}K!==void 0&&Se.classList.add(...K)}return Se})(S._config)),T.style.caretColor="transparent",void(B===null?z.appendChild(k):z.insertBefore(k,B))}}k!==null&&ay(k,S,T)})(e,o,s)}finally{m!==null&&m.observe(o,Qk),jn=f,Gn=d}}g!==null&&(function(S,T,I,k,E){let P=Array.from(S._listeners.mutation),_=P.length;for(let A=0;A<_;A++){let[B,z]=P[A];for(let q of z){let X=T.get(q);X!==void 0&&B(X,{dirtyLeaves:k,prevEditorState:E,updateTags:I})}}})(e,g,x,h,a),je(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,zc("decorator",e,!0,L)),(function(S,T,I){let k=nL(T),E=nL(I);k!==E&&zc("textcontent",S,!0,E)})(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,T){if(S._deferred=[],T.length!==0){let I=S._updating;S._updating=!0;try{for(let k=0;k<T.length;k++)T[k]()}finally{S._updating=I}}})(e,C),(function(S){let T=S._updates;if(T.length!==0){let I=T.shift();if(I){let[k,E]=I;um(S,k,E)}}})(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 Zk(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&&se(191),s._flushSync=!0),l&&e._deferred.push(l),pP(e,i.tag)),s==null?um(e,a,i):a()}}return o}function um(e,t,n){let o=e._updateTags,r,a=!1,i=!1;n!==void 0&&(r=n.onUpdate,pP(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=mP(l||s),d=!0),l._flushSync=i;let c=Gn,f=Mo,p=jn,m=e._updating;Gn=l,Mo=!1,e._updating=!0,jn=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=Br(qo(x));return je(w)||w==null?cm(w,L,x,C):w.clone()})(e,n&&n.event||null));let v=e._compositionKey;t(),a=Zk(e,a),(function(x,C){let w=C.getEditorState()._selection,L=x._selection;if(je(L)){let S=L.anchor,T=L.focus,I;if(S.type==="text"&&(I=S.getNode(),I.selectionTransform(w,L)),T.type==="text"){let k=T.getNode();I!==k&&k.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 T=L.get(S);Be(T)&&T.isAttached()&&T.isSimpleText()&&!T.isUnmergeable()&&Lk(T)}})(l,e):(function(x,C){let w=C._dirtyLeaves,L=C._dirtyElements,S=x._nodeMap,T=Ii(),I=new Map,k=w,E=k.size,P=L,_=P.size;for(;E>0||_>0;){if(E>0){C._dirtyLeaves=new Set;for(let A of k){let B=S.get(A);Be(B)&&B.isAttached()&&B.isSimpleText()&&!B.isUnmergeable()&&Lk(B),B!==void 0&&Yk(B,T)&&Xk(C,B,I),w.add(A)}if(k=C._dirtyLeaves,E=k.size,E>0){Up++;continue}}C._dirtyLeaves=new Set,C._dirtyElements=new Map,P.delete("root")&&P.set("root",!0);for(let A of P){let B=A[0],z=A[1];if(L.set(B,z),!z)continue;let q=S.get(B);q!==void 0&&Yk(q,T)&&Xk(C,q,I)}k=C._dirtyLeaves,E=k.size,P=C._dirtyElements,_=P.size,Up++}C._dirtyLeaves=w,C._dirtyElements=L})(l,e),Zk(e),(function(x,C,w,L){let S=x._nodeMap,T=C._nodeMap,I=[];for(let[k]of L){let E=T.get(k);E!==void 0&&(E.isAttached()||(ne(E)&&gL(E,k,S,T,I,L),S.has(k)||L.delete(k),I.push(k)))}for(let k of I)T.delete(k);for(let k of w){let E=T.get(k);E===void 0||E.isAttached()||(S.has(k)||w.delete(k),T.delete(k))}})(s,l,e._dirtyLeaves,e._dirtyElements)),v!==e._compositionKey&&(l._flushSync=!0);let y=l._selection;if(je(y)){let x=l._nodeMap,C=y.anchor.key,w=y.focus.key;x.get(C)!==void 0&&x.get(w)!==void 0||se(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 Da(e)}finally{Gn=c,Mo=f,jn=p,e._updating=m,Up=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,Da(e)):d&&oK(()=>{Da(e)}):(l._flushSync=!1,d&&(o.clear(),e._deferred=[],e._pendingEditorState=null))}function ma(e,t,n){jn===e&&n===void 0?t():um(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&&se(222),this.element.insertBefore(t,n),this}removeChild(t){return t.parentElement!==this.element&&se(223),this.element.removeChild(t),this}replaceChild(t,n){return n.parentElement!==this.element&&se(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"&&(im||eu||am);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=eL(n,o);a.push(r);let i=eL(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 eL(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&&se(225),n.reverse()}var Pi=class extends cr{__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 ZH[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=Zt()._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(Be(n)&&t.push(n),ne(n)){let o=n.getAllTextNodes();t.push(...o)}n=n.getNextSibling()}return t}getFirstDescendant(){let t=this.getFirstChild();for(;ne(t);){let n=t.getFirstChild();if(n===null)break;t=n}return t}getLastDescendant(){let t=this.getLastChild();for(;ne(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 ne(a)&&a.getLastDescendant()||a||null}let r=n[t];return ne(r)&&r.getFirstDescendant()||r||null}getFirstChild(){let t=this.getLatest().__first;return t===null?null:Hn(t)}getFirstChildOrThrow(){let t=this.getFirstChild();return t===null&&se(45,this.__key),t}getLastChild(){let t=this.getLatest().__last;return t===null?null:Hn(t)}getLastChildOrThrow(){let t=this.getLastChild();return t===null&&se(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(),ne(a)&&r!==o-1&&!a.isInline()&&(t+=sm)}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(),ne(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=so[t];return(this.getTextFormat()&n)!==0}getFormatFlags(t,n){return Jc(this.getLatest().__textFormat,t,n)}getTextStyle(){return this.getLatest().__textStyle}select(t,n){qn();let o=Dt(),r=t,a=n,i=this.getChildrenSize();if(!this.canBeEmpty()){if(t===0&&n===0){let l=this.getFirstChild();if(Be(l)||ne(l))return l.select(0,0)}else if(!(t!==void 0&&t!==i||n!==void 0&&n!==i)){let l=this.getLastChild();if(Be(l)||ne(l))return l.select()}}r===void 0&&(r=i),a===void 0&&(a=i);let s=this.__key;return je(o)?(o.anchor.set(s,r,"element"),o.focus.set(s,a,"element"),o.dirty=!0,o):lP(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){Yp(this)&&se(324,this.__key,this.__type);let r=this.getChildrenSize(),a=this.getWritable();t+n<=r||se(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&&se(100);let h=m.getNextSibling(),v=m.__key;ki(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--,ki(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&&se(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=Dt();if(je(m)){let g=new Set(l),h=new Set(s),{anchor:v,focus:y}=m;tL(v,g,h)&&em(v,v.getNode(),this,c,d),tL(y,g,h)&&em(y,y.getNode(),this,c,d),f!==0||this.canBeEmpty()||ur(this)||this.remove()}}return a}getDOMSlot(t){return new oy(t)}exportDOM(t){let{element:n}=super.exportDOM(t);if(wo(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===""||ur(this)||this.getChildren().some(Be)||(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 ne(e){return e instanceof Pi}function tL(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 cr{decorate(t,n){return null}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}};function on(e){return e instanceof Xc}var ql=class e extends Pi{__cachedText;static getType(){return"root"}static clone(){return new e}constructor(){super("root"),this.__cachedText=null}getTopLevelElementOrThrow(){se(51)}getTextContent(){let t=this.__cachedText;return!Zl()&&Zt()._dirtyType!==0||t===null?super.getTextContent():t}remove(){se(52)}replace(t){se(53)}insertBefore(t){se(54)}insertAfter(t){se(55)}updateDOM(t,n){return!1}splice(t,n,o){for(let r of o)ne(r)||on(r)||se(282);return super.splice(t,n,o)}static importJSON(t){return Vo().updateFromJSON(t)}collapseAtStart(){return!0}};function Zn(e){return e instanceof ql}function mP(e){return new Yc(new Map(e._nodeMap))}function Ey(){return new Yc(new Map([["root",new ql]]))}function gP(e){let t=e.exportJSON(),n=e.constructor;if(t.type!==n.getType()&&se(130,n.name),ne(e)){let o=t.children;Array.isArray(o)||se(59,n.name);let r=e.getChildren();for(let a=0;a<r.length;a++){let i=gP(r[a]);o.push(i)}}return t}function Q$(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 Jk(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 Jk(null,this,()=>({root:gP(Vo())}))}},tm=class extends Pi{static getType(){return"artificial"}createDOM(t){return document.createElement("div")}},Wl=class e extends Pi{static getType(){return"paragraph"}static clone(t){return new e(t.__key)}createDOM(t){let n=document.createElement("p"),o=Hl(t.theme,"paragraph");return o!==void 0&&n.classList.add(...o),n}updateDOM(t,n,o){return!1}static importDOM(){return{p:t=>({conversion:X$,priority:0})}}exportDOM(t){let{element:n}=super.exportDOM(t);if(wo(n)){this.isEmpty()&&n.append(document.createElement("br"));let o=this.getFormatType();o&&(n.style.textAlign=o)}return{element:n}}static importJSON(t){return Fa().updateFromJSON(t)}exportJSON(){let t=super.exportJSON();if(t.textFormat===void 0||t.textStyle===void 0){let n=this.getChildren().find(Be);n?(t.textFormat=n.getFormat(),t.textStyle=n.getStyle()):(t.textFormat=this.getTextFormat(),t.textStyle=this.getTextStyle())}return t}insertNewAfter(t,n){let o=Fa();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||Be(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 X$(e){let t=Fa();if(e.style&&(t.setFormat(e.style.textAlign),FP(e,t)),t.getFormatType()===""){let n=e.getAttribute("align");n&&n&&n in Dv&&t.setFormat(n)}return{node:t}}function Fa(){return au(new Wl)}function hP(e){return e instanceof Wl}var Fl=0,Y$=1,J$=2,Z$=3,eK=4;function vP(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 yP(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 cr&&i!==cr?i:void 0}}return t}function tK(e){let t=e||{},n=G$(),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:kP()),l=t.editorState,d=[ql,As,$l,Vl,Wl,tm,...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=yP(v);m.set(C,{exportDOM:f&&f.export?f.export.get(v):void 0,klass:v,replace:y,replaceWithKlass:x,sharedNodeState:xL(d[h]),transforms:w})}}let g=new Ai(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,S$,Fl),h.registerCommand(vy,I$,Fl),h.registerCommand(yy,T$,Fl),h.registerCommand(xy,k$,Fl),h.registerCommand(Sy,L$,Fl)})(g),g}var Ai=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=kP(),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&&se(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&&se(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&&se(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=Hn(f);p&&p.markDirty()}},i._pendingEditorState===null?{tag:zp}: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 Ee(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=Hl(this._config.theme,"root"),r=this._pendingEditorState||this._editorState;if(this._rootElement=t,vP(this,n,t,r),n!==null&&(this._config.disableEvents||P$(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,yL(this),this._updateTags.add(zp),Da(this),this._config.disableEvents||(function(s,l){let d=s.ownerDocument;Xv.set(s,d);let c=Qp.get(d)??0;c<1&&d.addEventListener("selectionchange",YL),Qp.set(d,c+1),s.__lexicalEditor=l;let f=XL(s);for(let p=0;p<Qv.length;p++){let[m,g]=Qv[p],h=typeof g=="function"?v=>{_k(v)||(Nk(v),(l.isEditable()||m==="click")&&g(v,l))}:v=>{if(_k(v))return;Nk(v);let y=l.isEditable();switch(m){case"cut":return y&&Ee(l,Ty,v);case"copy":return Ee(l,Iy,v);case"paste":return y&&Ee(l,Cy,v);case"dragstart":return y&&Ee(l,BL,v);case"dragover":return y&&Ee(l,zL,v);case"dragend":return y&&Ee(l,UL,v);case"focus":return y&&Ee(l,HL,v);case"blur":return y&&Ee(l,$L,v);case"drop":return y&&Ee(l,FL,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(zp),Da(this);zc("root",this,!1,t,n)}}getElementByKey(t){return this._keyToDOMMap.get(t)||null}getEditorState(){return this._editorState}setEditorState(t,n){t.isEmpty()&&se(38);let o=t;o._readOnly&&(o=mP(t),o._selection=t._selection?t._selection.clone():null),vL(this);let r=this._pendingEditorState,a=this._updateTags,i=n!==void 0?n.tag:null;r===null||r.isEmpty()||(i!=null&&a.add(i),Da(this)),this._pendingEditorState=o,this._dirtyType=2,this._dirtyElements.set("root",!1),this._compositionKey=null,i!=null&&a.add(i),this._updating||Da(this)}parseEditorState(t,n){return(function(o,r,a){let i=Ey(),s=Gn,l=Mo,d=jn,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,Gn=i,Mo=!1,jn=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,Gn=s,Mo=l,jn=d}return i})(typeof t=="string"?JSON.parse(t):t,this,n)}read(t){return Da(this),this.getEditorState().read(t,{editor:this})}update(t,n){(function(o,r,a){o._updating?o._updates.push([r,a]):um(o,r,a)})(this,t,n)}focus(t,n={}){let o=this._rootElement;o!==null&&(o.setAttribute("autocapitalize","off"),ma(this,()=>{let r=Dt(),a=Vo();r!==null?r.dirty||No(r.clone()):a.getChildrenSize()!==0&&(n.defaultSelection==="rootStart"?a.selectStart():a.selectEnd()),gm("focus"),RP(()=>{o.removeAttribute("autocapitalize"),t&&t()})}),this._pendingEditorState===null&&o.removeAttribute("autocapitalize"))}blur(){let t=this._rootElement;t!==null&&t.blur();let n=Br(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()}}};Ai.version="0.41.0+prod.esm";var ry=null;function Ry(e){ry=e}var xP=1;function nK(){xP=1}function My(e,t){let n=Ny(e,t);return n===void 0&&se(30,t),n}function Ny(e,t){return e._nodes.get(t)}var oK=typeof queueMicrotask=="function"?queueMicrotask:e=>{Promise.resolve().then(e)};function CP(e){return on(mm(e))}function _y(e){let t=document.activeElement;if(!wo(t))return!1;let n=t.nodeName;return on(mm(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&&!_y(t)&&Dy(t)===e}catch{return!1}}function fm(e){return e instanceof Ai}function Dy(e){let t=e;for(;t!=null;){let n=ou(t);if(fm(n))return n;t=ru(t)}return null}function ou(e){return e?e.__lexicalEditor:null}function rK(e){return XH.test(e)?"rtl":YH.test(e)?"ltr":null}function Ti(e){return Ly(e)||e.isToken()}function _a(e){return Ti(e)||e.isSegmented()}function ga(e){return ed(e)&&e.nodeType===3}function bP(e){return ed(e)&&e.nodeType===9}function Rs(e){let t=e;for(;t!=null;){if(ga(t))return t;t=t.firstChild}return null}function Jc(e,t,n){let o=so[t];if(n!==null&&(e&o)===(n&o))return e;let r=e^o;return t==="subscript"?r&=~so.superscript:t==="superscript"?r&=~so.subscript:t==="lowercase"?(r&=~so.uppercase,r&=~so.capitalize):t==="uppercase"?(r&=~so.lowercase,r&=~so.capitalize):t==="capitalize"&&(r&=~so.lowercase,r&=~so.uppercase),r}function aK(e){return Be(e)||ks(e)||on(e)}function wP(e,t){let n=(function(){let i=ry;return ry=null,i})();if((t=t||n&&n.__key)!=null)return void(e.__key=t);qn(),uP();let o=Zt(),r=Ua(),a=""+xP++;r._nodeMap.set(a,e),ne(e)?o._dirtyElements.set(a,!0):o._dirtyLeaves.add(a),o._cloneNotNeeded.add(a),o._dirtyType=1,e.__key=a}function ki(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 nm(e){uP(),Yp(e)&&se(323,e.__key,e.__type);let t=e.getLatest(),n=t.__parent,o=Ua(),r=Zt(),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,ne(e)?i.set(s,!0):r._dirtyLeaves.add(s)}function Wn(e){qn();let t=Zt(),n=t._compositionKey;if(e!==n){if(t._compositionKey=e,n!==null){let o=Hn(n);o!==null&&o.getWritable()}if(e!==null){let o=Hn(e);o!==null&&o.getWritable()}}}function Ii(){return Zl()?null:Zt()._compositionKey}function Hn(e,t){let n=(t||Ua())._nodeMap.get(e);return n===void 0?null:n}function Oy(e,t){let n=pm(e,Zt());return n!==void 0?Hn(n,t):null}function pm(e,t){return e[`__lexicalKey_${t._key}`]}function mm(e,t){let n=e;for(;n!=null;){let o=Oy(n,t);if(o!==null)return o;n=ru(n)}return null}function SP(e){let t=e._decorators,n=Object.assign({},t);return e._pendingDecorators=n,n}function nL(e){return e.read(()=>Vo().getTextContent())}function Vo(){return IP(Ua())}function IP(e){return e._nodeMap.get("root")}function No(e){qn();let t=Ua();e!==null&&(e.dirty=!0,e.setCachedNodes(null)),t._selection=e}function Bl(e){let t=Zt(),n=(function(o,r){let a=o;for(;a!=null;){let i=pm(a,r);if(i!==void 0)return i;a=ru(a)}return null})(e,t);return n===null?e===t.getRootElement()?Hn("root"):null:Hn(n)}function TP(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 kP(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,5)}function LP(e){return ga(e)?e.nodeValue:null}function By(e,t,n){let o=Br(qo(t));if(o===null)return;let r=o.anchorNode,{anchorOffset:a,focusOffset:i}=o;if(r!==null){let s=LP(r),l=mm(r);if(s!==null&&Be(l)){if((s===Kc||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(Kc)&&(s=t.slice(0,-Kc.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(Wn(null),am||eu||im)a.remove();else{let h=Zt();setTimeout(()=>{h.update(()=>{a.isAttached()&&a.remove()})},20)}return}let d=a.getParent(),c=Ns(),f=a.getTextContentSize(),p=Ii(),m=a.getKey();if(a.isToken()||p!==null&&m===p&&!i||je(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=Dt();if(!je(g)||n===null||o===null)return void oL(a,s,g);if(g.setTextNodeRange(a,n,a,o),a.isSegmented()){let h=Vn(a.getTextContent());a.replace(h),a=h}oL(a,s,g)}}}function oL(e,t,n){if(e.setTextContent(t),je(n)){let o=e.getKey();for(let r of["anchor","focus"]){let a=n[r];a.type==="text"&&a.key===o&&(a.offset=Dr(e,a.offset,"clamp"))}}}function Np(e,t,n){let o=t[n]||!1;return o==="any"||o===e[n]}function PP(e,t){return Np(e,t,"altKey")&&Np(e,t,"ctrlKey")&&Np(e,t,"shiftKey")&&Np(e,t,"metaKey")}function Vt(e,t,n){if(!PP(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 Na={ctrlKey:!Rr,metaKey:Rr},rL={altKey:Rr,ctrlKey:!Rr};function aL(e){return e.key==="Backspace"}function iL(e){return Vt(e,"a",Na)}function iK(e){let t=Vo();if(je(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"),Kp(e),e}{let n=t.select(0,t.getChildrenSize());return No(Kp(n)),n}}function Hl(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 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&&se(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 sK(e){let t=e.getType(),n=Ua();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 sL(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 AP(e,t){let n=e.offset;if(e.type==="element")return sL(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?sL(o.getParentOrThrow(),t,o.getIndexWithinParent()+(t?0:1)):r}}return null}function EP(e){let t=qo(e).event,n=t&&t.inputType;return n==="insertFromPaste"||n==="insertFromPasteAsQuotation"}function Ee(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(ma(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 Gl(e,t){let n=e._keyToDOMMap.get(t);return n===void 0&&se(75,t),n}function ru(e){let t=e.assignedSlot||e.parentElement;return DP(t)?t.host:t}function Hy(e){return bP(e)?e:wo(e)?e.ownerDocument:null}function lK(e){return Zt()._updateTags.has(e)}function gm(e){qn(),Zt()._updateTags.add(e)}function RP(e){qn(),Zt()._deferred.push(e)}function om(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 qo(e){let t=e._window;return t===null&&se(78),t}function dK(e){return ne(e)&&e.isInline()||on(e)&&e.isInline()}function MP(e){let t=e.getParentOrThrow();for(;t!==null;){if(ur(t))return t;t=t.getParentOrThrow()}return t}function ur(e){return Zn(e)||ne(e)&&e.isShadowRoot()}function Ky(e){let t=e.constructor.clone(e);return wP(t,null),t.afterCloneFrom(e),t}function au(e){let t=Zt(),n=e.getType(),o=Ny(t,n);o===void 0&&se(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||se(201,a.name,a.getType(),s.name,s.getType(),e.constructor.name,n):i instanceof e.constructor&&s!==e.constructor||se(202,s.name,s.getType(),e.constructor.name,n),i.__key===e.__key&&se(203,e.constructor.name,n,s.name,s.getType()),i}return e}function Rv(e,t){!Zn(e.getParent())||ne(t)||on(t)||se(99)}function NP(e){let t=Hn(e);return t===null&&se(63,e),t}function Mv(e){return(on(e)||ne(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 Br(e){return Fr?(e||window).getSelection():null}function _P(e){let t=$y(e);return t?t.getSelection():null}function cK(e,t){let n=e.getChildAtIndex(t);n==null&&(n=e),ur(e)&&se(102);let o=i=>{let s=i.getParentOrThrow(),l=ur(s),d=i!==n||l?Ky(i):i;if(l)return ne(i)&&ne(d)||se(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 uK(e){return wo(e)&&e.tagName==="A"}function wo(e){return ed(e)&&e.nodeType===1}function ed(e){return typeof e=="object"&&e!==null&&"nodeType"in e&&typeof e.nodeType=="number"}function DP(e){return ed(e)&&e.nodeType===11}function OP(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 Oa(e){if(on(e)&&!e.isInline())return!0;if(!ne(e)||ur(e))return!1;let t=e.getFirstChild(),n=t===null||ks(t)||Be(t)||t.isInline();return!e.isInline()&&e.canBeEmpty()!==!1&&n}function Vy(){return Zt()}var lL=new WeakMap,fK=new Map;function sy(e){if(!e._readOnly&&e.isEmpty())return fK;e._readOnly||se(192);let t=lL.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),lL.set(e,t)),t}function qy(e){let t=e.constructor.clone(e);return t.afterCloneFrom(e),t}function pK(e){return(t=qy(e))[JL]=!0,t;var t}function FP(e,t){let n=parseInt(e.style.paddingInlineStart,10)||0,o=Math.round(n/40);t.setIndent(o)}function mK(e){e.__lexicalUnmanaged=!0}function BP(e){return e.__lexicalUnmanaged===!0}function Dc(e,t){return(function(n,o){return Object.prototype.hasOwnProperty.call(n,o)})(e,t)&&e[t]!==cr[t]}function iu(e){let t=Ck in e.prototype?e.prototype[Ck]():void 0,n=(function(i){if(!(i===cr||i.prototype instanceof cr)){let s="<unknown>",l="<unknown>";try{s=i.getType()}catch{}try{Ai.version&&(l=JSON.parse(Ai.version))}catch{}se(290,i.name,s,l)}return i===Xc||i===Pi||i===cr})(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=>(Ry(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 gK(e){let t=Vy();return qn(),new(t.resolveRegisteredNodeAfterReplacements(t.getRegisteredNode(e))).klass}var Uc=(e,t)=>{let n=e;for(;n!=null&&!Zn(n);){if(t(n))return n;n=n.getParent()}return null},hK={next:"previous",previous:"next"},jl=class{origin;constructor(t){this.origin=t}[Symbol.iterator](){return jy({hasNext:Ms,initial:this.getAdjacentCaret(),map:t=>t,step:t=>t.getAdjacentCaret()})}getAdjacentCaret(){return Qn(this.getNodeAtCaret(),this.direction)}getSiblingCaret(){return Qn(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&&se(263,Array.from(s).join(" "))}else a.insert(l);a=Qn(l,this.direction)}for(let l of s.values())l.remove();return this}},Zc=class e extends jl{type="child";getLatest(){let t=this.origin.getLatest();return t===this.origin?this:za(t,this.direction)}getParentCaret(t="root"){return Qn(Wy(this.getParentAtCaret(),t),this.direction)}getFlipped(){let t=_i(this.direction);return Qn(this.getNodeAtCaret(),t)||za(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)}},vK={root:Zn,shadowRoot:ur};function _i(e){return hK[e]}function Wy(e,t="root"){return vK[t](e)?null:e}var Ql=class e extends jl{type="sibling";getLatest(){let t=this.origin.getLatest();return t===this.origin?this:Qn(t,this.direction)}getSiblingCaret(){return this}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return ne(this.origin)?za(this.origin,this.direction):null}getParentCaret(t="root"){return Qn(Wy(this.getParentAtCaret(),t),this.direction)}getFlipped(){let t=_i(this.direction);return Qn(this.getNodeAtCaret(),t)||za(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 Xl)&&this.direction===t.direction&&this.origin.is(t.origin)}},Xl=class e extends jl{type="text";offset;constructor(t,n){super(t),this.offset=n}getLatest(){let t=this.origin.getLatest();return t===this.origin?this:Ei(t,this.direction,this.offset)}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return null}getParentCaret(t="root"){return Qn(Wy(this.getParentAtCaret(),t),this.direction)}getFlipped(){return Ei(this.origin,_i(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 Ql||t instanceof e)&&this.direction===t.direction&&this.origin.is(t.origin)}getSiblingCaret(){return Qn(this.origin,this.direction)}};function Ba(e){return e instanceof Xl}function yK(e){return e instanceof jl}function Ms(e){return e instanceof Ql}function _r(e){return e instanceof Zc}var xK={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}}},CK={next:class extends Ql{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends Ql{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},bK={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 Qn(e,t){return e?new CK[t](e):null}function Ei(e,t,n){return e?new xK[t](e,Dr(e,n)):null}function Dr(e,t,n="error"){let o=e.getTextContentSize(),r=t==="next"?o:t==="previous"?0:t;return(r<0||r>o)&&(n!=="clamp"&&uL(284,String(t),String(o),e.getKey()),r=r<0?0:o),r}function ly(e,t){return new rm(e,t)}function za(e,t){return ne(e)?new bK[t](e):null}function zP(e){return e&&e.getChildCaret()||e}function Yl(e){return e&&zP(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 Ba(a)?(function(i,s){let{direction:l,origin:d}=i,c=Dr(d,s==="focus"?_i(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=Ba(this.anchor)?this.anchor.getSiblingCaret():this.anchor.getLatest(),o=this.focus.getLatest(),r=Ba(o),a=i=>i.isSameNodeCaret(o)?null:Yl(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")}},rm=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 Ei(t.setTextContent(a.slice(0,o)+a.slice(r)),n,o)}};function wK(e){return e instanceof rm}function Gy(e){return Ri(e,Qn(Vo(),e.direction))}function UP(e){return Ri(e,e)}function Ri(e,t){return e.direction!==t.direction&&se(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=Hc(e.origin,t.origin);switch(n===null&&se(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 _p(e,t){return t.is(e)}function dL(e){return ne(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]=dL(e);o;r=o,o=o.getParent())n.set(o,r);for(let[o,r]=dL(t);o;r=o,o=o.getParent()){let a=n.get(o);if(a!==void 0)return a===null?(_p(e,o)||se(276),{commonAncestor:o,type:"ancestor"}):r===null?(_p(t,o)||se(277),{commonAncestor:o,type:"descendant"}):((ne(a)||_p(e,a))&&(ne(r)||_p(t,r))&&o.is(a.getParent())&&o.is(r.getParent())||se(278),{a,b:r,commonAncestor:o,type:"branch"})}return null}function Mi(e,t){let{type:n,key:o,offset:r}=e,a=NP(e.key);return n==="text"?(Be(a)||se(266,a.getType(),o),Ei(a,t,r)):(ne(a)||se(267,a.getType(),o),VP(a,e.offset,t))}function Jl(e,t){let{origin:n,direction:o}=t,r=o==="next";Ba(t)?e.set(n.getKey(),t.offset,"text"):Ms(t)?Be(n)?e.set(n.getKey(),Dr(n,o),"text"):e.set(n.getParentOrThrow().getKey(),n.getIndexWithinParent()+(r?1:0),"element"):(_r(t)&&ne(n)||se(268),e.set(n.getKey(),r?0:n.getChildrenSize(),"element"))}function HP(e){let t=Dt(),n=je(t)?t:dP();return $c(n,e),No(n),n}function $c(e,t){Jl(e.anchor,t.anchor),Jl(e.focus,t.focus)}function cy(e){let{anchor:t,focus:n}=e,o=Mi(t,"next"),r=Mi(n,"next"),a=Qy(o,r)<=0?"next":"previous";return Ri(Ni(o,a),Ni(r,a))}function td(e){let{direction:t,origin:n}=e,o=Qn(n,_i(t)).getNodeAtCaret();return o?Qn(o,t):za(n.getParentOrThrow(),t)}function cL(e,t="root"){let n=[e];for(let o=_r(e)?e.getParentCaret(t):e.getSiblingCaret();o!==null;o=o.getParentCaret(t))n.push(td(o));return n}function Nv(e){return!!e&&e.origin.isAttached()}function $P(e,t="removeEmptySlices"){if(e.isCollapsed())return e;let n="root",o="next",r=t,a=Yy(e,o),i=cL(a.anchor,n),s=cL(a.focus.getFlipped(),n),l=new Set,d=[];for(let g of a.iterNodeCarets(n))if(_r(g))l.add(g.origin.getKey());else if(Ms(g)){let{origin:h}=g;ne(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=td(Qn(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=Vn(L.getTextContent()).setStyle(L.getStyle()).setFormat(L.getFormat());y.replaceOrInsert(S),C=Ei(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=Mr(g);break}for(let g of s)if(Nv(g)){f=Mr(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 T=(E,P)=>{let _;for(let A=S;A<E.length;A++){let B=E[A];if(ur(B))return;!_&&P(B)&&(_=B)}return _},I=T(C,Oa),k=I&&T(w,E=>v.has(E.getKey())&&Oa(E));return I&&k?[I,k]:null})(c,f,l);if(p){let[g,h]=p;za(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 UP(Ni(Mr(m),e.direction));se(269,JSON.stringify(i.map(g=>g.origin.__key)))}function Mr(e){let t=(function(r){let a=r;for(;_r(a);){let i=Yl(a);if(!_r(i))break;a=i}return a})(e.getLatest()),{direction:n}=t;if(Be(t.origin))return Ba(t)?t:Ei(t.origin,n,n);let o=t.getAdjacentCaret();return Ms(o)&&Be(o.origin)?Ei(o.origin,n,_i(n)):t}function KP(e){return Ba(e)&&e.offset!==Dr(e.origin,e.direction)}function Ni(e,t){return e.direction===t?e:e.getFlipped()}function Yy(e,t){return e.direction===t?e:Ri(Ni(e.focus,t),Ni(e.anchor,t))}function VP(e,t,n){let o=za(e,"next");for(let r=0;r<t;r++){let a=o.getAdjacentCaret();if(a===null)break;o=a}return Ni(o,n)}function SK(e,t="root"){let n=0,o=e,r=Yl(o);for(;r===null;){if(n--,r=o.getParentCaret(t),!r)return null;o=r,r=Yl(o)}return r&&[r,n]}function IK(e){let{origin:t,offset:n,direction:o}=e;if(n===Dr(t,o))return e.getSiblingCaret();if(n===Dr(t,_i(o)))return td(e.getSiblingCaret());let[r]=t.splitText(n);return Be(r)||se(281),Ni(Qn(r,"next"),o)}function TK(e,t){return!0}function kK(e,{$copyElementNode:t=Ky,$splitTextPointCaretNext:n=IK,rootMode:o="shadowRoot",$shouldSplit:r=TK}={}){if(Ba(e))return n(e);let a=e.getParentCaret(o);if(a){let{origin:i}=a;if(_r(e)&&(!i.canBeEmpty()||!r(i,"first")))return td(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 LK(e){return e}function PK(...e){return e}function AK(e,t){return[e,t]}function EK(e){return e}function RK(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 MK(e,...t){let n=su(...t);n.length>0&&e.classList.add(...n)}function NK(e,...t){let n=su(...t);n.length>0&&e.classList.remove(...n)}function _K(...e){return()=>{for(let t=e.length-1;t>=0;t--)e[t]();e.length=0}}var M=Jy,qae=M.$addUpdateTag,hm=M.$applyNodeReplacement,nd=M.$caretFromPoint,qP=M.$caretRangeFromSelection,vm=M.$cloneWithProperties,WP=M.$cloneWithPropertiesEphemeral,Wae=M.$comparePointCaretNext,Gae=M.$copyNode,GP=M.$create,_s=M.$createLineBreakNode,jP=M.$createNodeSelection,fr=M.$createParagraphNode,jae=M.$createPoint,Ds=M.$createRangeSelection,QP=M.$createRangeSelectionFromDom,XP=M.$createTabNode,zr=M.$createTextNode,YP=M.$extendCaretToRange,Ha=M.$findMatchingParent,Zy=M.$getAdjacentChildCaret,Qae=M.$getAdjacentNode,Os=M.$getAdjacentSiblingOrParentSiblingCaret,ex=M.$getCaretInDirection,JP=M.$getCaretRange,Xae=M.$getCaretRangeInDirection,ZP=M.$getCharacterOffsets,Di=M.$getChildCaret,Yae=M.$getChildCaretAtIndex,tx=M.$getChildCaretOrSelf,eA=M.$getCollapsedCaretRange,Jae=M.$getCommonAncestor,Zae=M.$getCommonAncestorResultBranchOrder,ym=M.$getEditor,eie=M.$getNearestNodeFromDOMNode,tie=M.$getNearestRootOrShadowRoot,xm=M.$getNodeByKey,nie=M.$getNodeByKeyOrThrow,tA=M.$getNodeFromDOMNode,lu=M.$getPreviousSelection,At=M.$getRoot,He=M.$getSelection,$a=M.$getSiblingCaret,Cm=M.$getState,oie=M.$getStateChange,rie=M.$getTextContent,aie=M.$getTextNodeOffset,iie=M.$getTextPointCaret,sie=M.$getTextPointCaretSlice,lie=M.$getWritableNodeState,nA=M.$hasAncestor,die=M.$hasUpdateTag,cie=M.$insertNodes,od=M.$isBlockElementNode,du=M.$isChildCaret,bm=M.$isDecoratorNode,oA=M.$isEditorState,Qe=M.$isElementNode,rA=M.$isExtendableTextPointCaret,uie=M.$isInlineElementOrDecoratorNode,aA=M.$isLeafNode,rd=M.$isLineBreakNode,fie=M.$isNodeCaret,nx=M.$isNodeSelection,iA=M.$isParagraphNode,Me=M.$isRangeSelection,cu=M.$isRootNode,Fs=M.$isRootOrShadowRoot,sA=M.$isSiblingCaret,pie=M.$isTabNode,dt=M.$isTextNode,wm=M.$isTextPointCaret,mie=M.$isTextPointCaretSlice,ox=M.$isTokenOrSegmented,gie=M.$isTokenOrTab,hie=M.$nodesOfType,lA=M.$normalizeCaret,dA=M.$normalizeSelection__EXPERIMENTAL,vie=M.$onUpdate,cA=M.$parseSerializedNode,yie=M.$removeTextFromCaretRange,uA=M.$rewindSiblingCaret,Sm=M.$selectAll,xie=M.$setCompositionKey,Cie=M.$setPointFromCaret,Ur=M.$setSelection,fA=M.$setSelectionFromCaretRange,Im=M.$setState,pA=M.$splitAtPointCaretNext,mA=M.$splitNode,bie=M.$updateRangeSelectionFromCaretRange,rx=M.ArtificialNode__DO_NOT_USE,wie=M.BEFORE_INPUT_COMMAND,gA=M.BLUR_COMMAND,uu=M.CAN_REDO_COMMAND,fu=M.CAN_UNDO_COMMAND,Tm=M.CLEAR_EDITOR_COMMAND,hA=M.CLEAR_HISTORY_COMMAND,vA=M.CLICK_COMMAND,Sie=M.COLLABORATION_TAG,km=M.COMMAND_PRIORITY_CRITICAL,rn=M.COMMAND_PRIORITY_EDITOR,pr=M.COMMAND_PRIORITY_HIGH,ad=M.COMMAND_PRIORITY_LOW,Iie=M.COMMAND_PRIORITY_NORMAL,Tie=M.COMPOSITION_END_COMMAND,yA=M.COMPOSITION_END_TAG,kie=M.COMPOSITION_START_COMMAND,xA=M.COMPOSITION_START_TAG,CA=M.CONTROLLED_TEXT_INSERTION_COMMAND,Lm=M.COPY_COMMAND,bA=M.CUT_COMMAND,Pm=M.DELETE_CHARACTER_COMMAND,wA=M.DELETE_LINE_COMMAND,SA=M.DELETE_WORD_COMMAND,Lie=M.DRAGEND_COMMAND,Pie=M.DRAGOVER_COMMAND,IA=M.DRAGSTART_COMMAND,TA=M.DROP_COMMAND,Ka=M.DecoratorNode,Aie=M.ElementNode,kA=M.FOCUS_COMMAND,Eie=M.FORMAT_ELEMENT_COMMAND,LA=M.FORMAT_TEXT_COMMAND,Am=M.HISTORIC_TAG,Hr=M.HISTORY_MERGE_TAG,PA=M.HISTORY_PUSH_TAG,ax=M.INDENT_CONTENT_COMMAND,Rie=M.INPUT_COMMAND,ix=M.INSERT_LINE_BREAK_COMMAND,AA=M.INSERT_PARAGRAPH_COMMAND,EA=M.INSERT_TAB_COMMAND,pu=M.INTERNAL_$isBlock,Mie=M.IS_ALL_FORMATTING,Nie=M.IS_BOLD,_ie=M.IS_CODE,Die=M.IS_HIGHLIGHT,Oie=M.IS_ITALIC,Fie=M.IS_STRIKETHROUGH,Bie=M.IS_SUBSCRIPT,zie=M.IS_SUPERSCRIPT,Uie=M.IS_UNDERLINE,RA=M.KEY_ARROW_DOWN_COMMAND,Em=M.KEY_ARROW_LEFT_COMMAND,Rm=M.KEY_ARROW_RIGHT_COMMAND,MA=M.KEY_ARROW_UP_COMMAND,Mm=M.KEY_BACKSPACE_COMMAND,NA=M.KEY_DELETE_COMMAND,_A=M.KEY_DOWN_COMMAND,Nm=M.KEY_ENTER_COMMAND,DA=M.KEY_ESCAPE_COMMAND,Hie=M.KEY_MODIFIER_COMMAND,$ie=M.KEY_SPACE_COMMAND,_m=M.KEY_TAB_COMMAND,OA=M.LineBreakNode,Kie=M.MOVE_TO_END,Vie=M.MOVE_TO_START,qie=M.NODE_STATE_KEY,FA=M.OUTDENT_CONTENT_COMMAND,Dm=M.PASTE_COMMAND,BA=M.PASTE_TAG,zA=M.ParagraphNode,UA=M.REDO_COMMAND,HA=M.REMOVE_TEXT_COMMAND,$A=M.RootNode,Wie=M.SELECTION_CHANGE_COMMAND,KA=M.SELECTION_INSERT_CLIPBOARD_NODES_COMMAND,VA=M.SELECT_ALL_COMMAND,Gie=M.SKIP_COLLAB_TAG,jie=M.SKIP_DOM_SELECTION_TAG,Qie=M.SKIP_SCROLL_INTO_VIEW_TAG,Xie=M.SKIP_SELECTION_FOCUS_TAG,qA=M.TEXT_TYPE_TO_FORMAT,WA=M.TabNode,Om=M.TextNode,GA=M.UNDO_COMMAND,mu=M.addClassNamesToElement,Yie=M.buildImportMap,Fm=M.configExtension,jA=M.createCommand,Bm=M.createEditor,Jie=M.createSharedNodeState,QA=M.createState,XA=M.declarePeerDependency,Dn=M.defineExtension,Zie=M.flipDirection,ese=M.getDOMOwnerDocument,sx=M.getDOMSelection,tse=M.getDOMSelectionFromTarget,YA=M.getDOMTextNode,nse=M.getEditorPropertyFromDOMNode,ose=M.getNearestEditorFromDOMNode,JA=M.getRegisteredNode,rse=M.getRegisteredNodeOrThrow,ase=M.getStaticNodeConfig,ise=M.getTextDirection,sse=M.getTransformSetFromKlass,ZA=M.isBlockDomNode,lse=M.isCurrentlyReadOnlyMode,eE=M.isDOMDocumentNode,tE=M.isDOMNode,dse=M.isDOMTextNode,cse=M.isDOMUnmanaged,lx=M.isDocumentFragment,use=M.isExactShortcutMatch,nE=M.isHTMLAnchorElement,zm=M.isHTMLElement,gu=M.isInlineDomNode,fse=M.isLexicalEditor,pse=M.isModifierMatch,mse=M.isSelectionCapturedInDecoratorInput,oE=M.isSelectionWithinEditor,dx=M.makeStepwiseIterator,ha=M.mergeRegister,gse=M.normalizeClassNames,Um=M.removeClassNamesFromElement,hse=M.removeFromParent,vse=M.resetRandomKey,$r=M.safeCast,yse=M.setDOMUnmanaged,xse=M.setNodeIndentFromDOM,Hm=M.shallowMergeConfig,cx=M.toggleTextFormatType;var hx={};_n(hx,{$addNodeStyle:()=>UK,$cloneWithProperties:()=>vm,$copyBlockFormatIndent:()=>fE,$ensureForwardRangeSelection:()=>uE,$forEachSelectedTextNode:()=>cE,$getComputedStyleForElement:()=>px,$getComputedStyleForParent:()=>mx,$getSelectionStyleValueForProperty:()=>jK,$isAtNodeEnd:()=>zK,$isParentElementRTL:()=>gx,$isParentRTL:()=>FK,$moveCaretSelection:()=>gE,$moveCharacter:()=>WK,$patchStyleText:()=>HK,$selectAll:()=>Sm,$setBlocksType:()=>$K,$shouldOverrideDefaultCharacterSelection:()=>qK,$sliceSelectedTextNodeContent:()=>BK,$trimTextContentFromAnchor:()=>dE,$wrapNodes:()=>VK,createDOMRange:()=>DK,createRectsFromDOMRange:()=>OK,getCSSFromStyleObject:()=>lE,getStyleObjectFromCSS:()=>Vm,trimTextContentFromAnchor:()=>QK});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 Km=new Map;function rE(e){let t=e;for(;t!=null;){if(t.nodeType===Node.TEXT_NODE)return t;t=t.firstChild}return null}function aE(e){let t=e.parentNode;if(t==null)throw new Error("Should never happen");return[t,Array.from(t.childNodes).indexOf(e)]}function DK(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=rE(l)),dt(o)&&(d=rE(d)),t===void 0||o===void 0||l===null||d===null)return null;l.nodeName==="BR"&&([l,c]=aE(l)),d.nodeName==="BR"&&([d,f]=aE(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 OK(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 sE(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 Vm(e){let t=Km.get(e);return t===void 0&&(t=sE(e),Km.set(e,t)),t}function lE(e){let t="";for(let n in e)n&&(t+=`${n}: ${e[n]};`);return t}function px(e){let t=ym().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(cu(e)?e:e.getParentOrThrow())}function FK(e){let t=mx(e);return t!==null&&t.direction==="rtl"}function BK(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]=ZP(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=WP(t)),t.__text=x)}}return t}function zK(e){if(e.type==="text")return e.offset===e.getNode().getTextContentSize();let t=e.getNode();return Qe(t)||fx(177),e.offset===t.getChildrenSize()}function dE(e,t,n){let o=t.getNode(),r=n;if(Qe(o)){let a=o.getDescendantByIndex(t.offset);a!==null&&(o=a)}for(;r>0&&o!==null;){if(Qe(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===""&&Qe(o)&&!o.isInline()&&(s=`
|
|
3775
|
+
`?o.push(ql()):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),yP(L))L.splice(0,0,[S]);else{let T=to(w)?_a().append(S):S;L===null?w.append(T):L.insertBefore(T)}v.is(y)&&y.set(S.__key,0,"text"),v.set(S.__key,0,"text")})(i,s,r,a),s.type==="element"&&ed(s,Er(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(""),lP(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(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)&&!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),T=y.isInline()&&p.getNextSibling()===null?y:p;for(let I=w.length-1;I>=0;I--){let k=w[I];if(k.is(p)||re(k)&&k.isParentOf(p))break;k.isAttached()&&(!L.has(k)||k.is(C)?S||T.insertAfter(k,!1):k.remove())}if(!S){let I=x,k=null;for(;I!==null;){let E=I.getChildren(),P=E.length;(P===0||E[P-1].is(k))&&(v.delete(I.__key),k=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 k=c[I],E=k.__key;v.has(E)||k.remove()}}}removeText(){let t=Ft()===this;Kc(this,VP(dy(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=Pv(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=Pv(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=Pv(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]=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(Xk(this,t,n,o))return;let r=t==="move",a=Yt(),i=Or(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()||ry(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&&fP(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:_P(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"&&Xk(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(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(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);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=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 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&&Kk(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 Vk(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 Vk(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!(LP(w)||G$(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&&Kk(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 Zp}function $k(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]:[$k(n),$k(o)]}function Kk(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 G$=(()=>{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 Vk(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 qk(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=Nr(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=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&&tn(p)&&Ul(e)===p?m:m+1,p=p.getParentOrThrow()}if(re(p))return _r(p.__key,a,"element")}}else r=Ul(e);return ze(r)?_r(r.__key,Nr(r,a,"clamp"),"text"):null}function Wk(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 lP(e,t,n){if(e.type==="text"&&t.type==="text"){let o=e.isBefore(t),r=e.is(t);Wk(e,o,r),Wk(t,!o,r),r&&t.set(e.key,e.offset,e.type)}}function dP(e,t,n,o,r,a){if(e===null||n===null||!ou(r,e,n))return null;let i=qk(e,t,Ge(a)?a.anchor:null,r);if(i===null)return null;let s=qk(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 lP(i,s),[i,s]}function j$(e){return re(e)&&!e.isInline()}function cP(e,t,n,o,r,a){let i=Fa(),s=new Ms(_r(e,t,r),_r(n,o,a),0,"");return s.dirty=!0,i._selection=s,s}function uP(){let e=_r("root",0,"element"),t=_r("root",0,"element");return new Ms(e,t,0,"")}function Ly(){return new Zp(new Set)}function Q$(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)&&!ou(n,d,c))return e.clone();let m=dP(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 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"),Gk(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")}}Gk(e)}function Gk(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 jk(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 fP(e,t,n,o,r){try{e.setBaseAndExtent(t,n,o,r)}catch{}}function Qk(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 X$(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(tP)&&f!==a||f!==null&&Ny(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]=Qk(n,g,p.offset),[x,C]=Qk(n,h,m.offset),w=t.format,L=t.style,S=t.isCollapsed(),T=v,I=x,k=!1;var E,P,_,A,F;if(p.type==="text"?(T=Ns(v),k=g.getFormat()!==w||g.getStyle()!==L):Ge(e)&&e.anchor.type==="text"&&(k=!0),m.type==="text"&&(I=Ns(x)),T!==null&&I!==null&&(S&&(e===null||k||Ge(e)&&(e.format!==w||e.style!==L))&&(E=w,P=L,_=y,A=p.key,F=performance.now(),jL=[E,P,_,A,F]),d!==y||c!==C||s!==T||l!==I||o.type==="Range"&&S||(f!==null&&a.contains(f)||r.has(Zv)||a.focus({preventScroll:!0}),p.type==="element"))){if(fP(o,T,y,I,C),!ki||!t.isCollapsed()||a===null||r.has(Zv)||document.activeElement!==null&&a.contains(document.activeElement)||a.focus({preventScroll:!0}),!r.has(nP)&&t.isCollapsed()&&a!==null&&a===document.activeElement){let B=Ge(t)&&t.anchor.type==="element"?T.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=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)}}Xv=!0}}function Y$(e){let t=Ft()||Ds();t===null&&(t=Qo().selectEnd()),t.insertNodes(e)}function J$(){let e=Ft();return e===null?"":e.getTextContent()}function Pv(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]=Z$(r,a),i.is(r))break}return a}function Z$(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(_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 Xk(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(!qP(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 Wy(a).iterNodeCarets(t==="extend"?"shadowRoot":"root")){if(Mr(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=Ly();return c.add(l.origin.getKey()),_o(c),!0}return l=Er(l),s&&ed(e.anchor,l),ed(e.focus,l),d||!i}var Vn=null,qn=null,No=!1,Av=!1,Hp=0,Yk={characterData:!0,childList:!0,subtree:!0};function td(){return No||Vn!==null&&Vn._readOnly}function $n(){No&&de(13)}function pP(){Hp>99&&de(14)}function Fa(){return Vn===null&&de(195,mP()),Vn}function Yt(){return qn===null&&de(196,mP()),qn}function mP(){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(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 eK(){return qn}function Jk(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 Zk(e,t){return e!==void 0&&e.__key!==t&&e.isAttached()}function gP(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 tK(e){return Py(e,Yt()._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 eL(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,T=e._dirtyElements,I=e._dirtyLeaves;m.disconnect(),g=C$(a,n,e,S,T,I)}catch(S){if(S instanceof Error&&e._onError(S),Av)throw S;return xP(e,null,o,n),CL(e),e._dirtyType=2,Av=!0,Ma(e,a),void(Av=!1)}finally{m.observe(o,Yk),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,T){let I=S._decorators,k=S._pendingDecorators||I,E=T._nodeMap,P;for(P in k)E.has(P)||(k===I&&(k=TP(S)),delete k[P])})(e,n);let w=r?null:Or(Xo(e));if(e._editable&&w!==null&&(l||s===null||s.dirty||!s.is(i))&&o!==null&&!x.has(oP)){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),X$(i,s,e,w,x,o)}(function(S,T,I){let k=S._blockCursorElement;if(Ge(I)&&I.isCollapsed()&&I.anchor.type==="element"&&T.contains(document.activeElement)){let E=I.anchor,P=E.getNode(),_=E.offset,A=!1,F=null;if(_===P.getChildrenSize())Rv(P.getChildAtIndex(_-1))&&(A=!0);else{let B=P.getChildAtIndex(_);if(B!==null&&Rv(B)){let V=B.getPreviousSibling();(V===null||Rv(V))&&(A=!0,F=S.getElementByKey(B.__key))}}if(A){let B=S.getElementByKey(P.__key);return k===null&&(S._blockCursorElement=k=(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)),T.style.caretColor="transparent",void(F===null?B.appendChild(k):B.insertBefore(k,F))}}k!==null&&ry(k,S,T)})(e,o,s)}finally{m!==null&&m.observe(o,Yk),qn=f,Vn=d}}g!==null&&(function(S,T,I,k,E){let P=Array.from(S._listeners.mutation),_=P.length;for(let A=0;A<_;A++){let[F,B]=P[A];for(let V of B){let Q=T.get(V);Q!==void 0&&F(Q,{dirtyLeaves:k,prevEditorState:E,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,Uc("decorator",e,!0,L)),(function(S,T,I){let k=rL(T),E=rL(I);k!==E&&Uc("textcontent",S,!0,E)})(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,T){if(S._deferred=[],T.length!==0){let I=S._updating;S._updating=!0;try{for(let k=0;k<T.length;k++)T[k]()}finally{S._updating=I}}})(e,C),(function(S){let T=S._updates;if(T.length!==0){let I=T.shift();if(I){let[k,E]=I;fm(S,k,E)}}})(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 tL(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),gP(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,gP(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=hP(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(Xo(x));return Ge(w)||w==null?um(w,L,x,C):w.clone()})(e,n&&n.event||null));let v=e._compositionKey;t(),a=tL(e,a),(function(x,C){let w=C.getEditorState()._selection,L=x._selection;if(Ge(L)){let S=L.anchor,T=L.focus,I;if(S.type==="text"&&(I=S.getNode(),I.selectionTransform(w,L)),T.type==="text"){let k=T.getNode();I!==k&&k.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 T=L.get(S);ze(T)&&T.isAttached()&&T.isSimpleText()&&!T.isUnmergeable()&&Ak(T)}})(l,e):(function(x,C){let w=C._dirtyLeaves,L=C._dirtyElements,S=x._nodeMap,T=Si(),I=new Map,k=w,E=k.size,P=L,_=P.size;for(;E>0||_>0;){if(E>0){C._dirtyLeaves=new Set;for(let A of k){let F=S.get(A);ze(F)&&F.isAttached()&&F.isSimpleText()&&!F.isUnmergeable()&&Ak(F),F!==void 0&&Zk(F,T)&&Jk(C,F,I),w.add(A)}if(k=C._dirtyLeaves,E=k.size,E>0){Hp++;continue}}C._dirtyLeaves=new Set,C._dirtyElements=new Map,P.delete("root")&&P.set("root",!0);for(let A of P){let F=A[0],B=A[1];if(L.set(F,B),!B)continue;let V=S.get(F);V!==void 0&&Zk(V,T)&&Jk(C,V,I)}k=C._dirtyLeaves,E=k.size,P=C._dirtyElements,_=P.size,Hp++}C._dirtyLeaves=w,C._dirtyElements=L})(l,e),tL(e),(function(x,C,w,L){let S=x._nodeMap,T=C._nodeMap,I=[];for(let[k]of L){let E=T.get(k);E!==void 0&&(E.isAttached()||(re(E)&&vL(E,k,S,T,I,L),S.has(k)||L.delete(k),I.push(k)))}for(let k of I)T.delete(k);for(let k of w){let E=T.get(k);E===void 0||E.isAttached()||(S.has(k)||w.delete(k),T.delete(k))}})(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,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,Ma(e)):d&&cK(()=>{Ma(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||tu||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=nL(n,o);a.push(r);let i=nL(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 nL(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 i$[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+=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 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):cP(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;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;oL(v,g,h)&&tm(v,v.getNode(),this,c,d),oL(y,g,h)&&tm(y,y.getNode(),this,c,d),f!==0||this.canBeEmpty()||gr(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===""||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 oL(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 hP(e){return new Jc(new Map(e._nodeMap))}function Ay(){return new Jc(new Map([["root",new Gl]]))}function vP(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=vP(r[a]);o.push(i)}}return t}function nK(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 eL(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 eL(null,this,()=>({root:vP(Qo())}))}},nm=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:oK,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 oK(e){let t=_a();if(e.style&&(t.setFormat(e.style.textAlign),zP(e,t)),t.getFormatType()===""){let n=e.getAttribute("align");n&&n&&n in _v&&t.setFormat(n)}return{node:t}}function _a(){return iu(new jl)}function yP(e){return e instanceof jl}var zl=0,rK=1,aK=2,iK=3,sK=4;function xP(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 CP(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 lK(e){let t=e||{},n=eK(),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:PP()),l=t.editorState,d=[Gl,Rs,Vl,Wl,jl,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}su(v);let C=v.getType(),w=CP(v);m.set(C,{exportDOM:f&&f.export?f.export.get(v):void 0,klass:v,replace:y,replaceWithKlass:x,sharedNodeState:bL(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(gy,E$,zl),h.registerCommand(hy,R$,zl),h.registerCommand(vy,M$,zl),h.registerCommand(yy,N$,zl),h.registerCommand(wy,_$,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=PP(),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=Kl(this._config.theme,"root"),r=this._pendingEditorState||this._editorState;if(this._rootElement=t,xP(this,n,t,r),n!==null&&(this._config.disableEvents||D$(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,CL(this),this._updateTags.add(Up),Ma(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",ZL),Xp.set(d,c+1),s.__lexicalEditor=l;let f=JL(s);for(let p=0;p<jv.length;p++){let[m,g]=jv[p],h=typeof g=="function"?v=>{Ok(v)||(Dk(v),(l.isEditable()||m==="click")&&g(v,l))}:v=>{if(Ok(v))return;Dk(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,UL,v);case"dragover":return y&&Re(l,HL,v);case"dragend":return y&&Re(l,$L,v);case"focus":return y&&Re(l,KL,v);case"blur":return y&&Re(l,VL,v);case"drop":return y&&Re(l,zL,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),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=hP(t),o._selection=t._selection?t._selection.clone():null),xL(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=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 Ma(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=Ft(),a=Qo();r!==null?r.dirty||_o(r.clone()):a.getChildrenSize()!==0&&(n.defaultSelection==="rootStart"?a.selectStart():a.selectEnd()),hm("focus"),NP(()=>{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,Uc("editable",this,!0,t))}toJSON(){return{editorState:this._editorState.toJSON()}}};Pi.version="0.41.0+prod.esm";var oy=null;function Ey(e){oy=e}var bP=1;function dK(){bP=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 cK=typeof queueMicrotask=="function"?queueMicrotask:e=>{Promise.resolve().then(e)};function wP(e){return tn(gm(e))}function Ny(e){let t=document.activeElement;if(!So(t))return!1;let n=t.nodeName;return tn(gm(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&&!Ny(t)&&_y(t)===e}catch{return!1}}function pm(e){return e instanceof Pi}function _y(e){let t=e;for(;t!=null;){let n=ru(t);if(pm(n))return n;t=au(t)}return null}function ru(e){return e?e.__lexicalEditor:null}function uK(e){return o$.test(e)?"rtl":r$.test(e)?"ltr":null}function Ii(e){return ky(e)||e.isToken()}function Ra(e){return Ii(e)||e.isSegmented()}function ca(e){return nd(e)&&e.nodeType===3}function SP(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 fK(e){return ze(e)||Ps(e)||tn(e)}function IP(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(),pP();let o=Yt(),r=Fa(),a=""+bP++;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 om(e){pP(),Jp(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 Dy(e,t){let n=mm(e,Yt());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=au(n)}return null}function TP(e){let t=e._decorators,n=Object.assign({},t);return e._pendingDecorators=n,n}function rL(e){return e.read(()=>Qo().getTextContent())}function Qo(){return kP(Fa())}function kP(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=mm(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 LP(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 PP(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,5)}function AP(e){return ca(e)?e.nodeValue:null}function Fy(e,t,n){let o=Or(Xo(t));if(o===null)return;let r=o.anchorNode,{anchorOffset:a,focusOffset:i}=o;if(r!==null){let s=AP(r),l=gm(r);if(s!==null&&ze(l)){if((s===Vc||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(Vc)&&(s=t.slice(0,-Vc.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||tu||sm)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 aL(a,s,g);if(g.setTextNodeRange(a,n,a,o),a.isSegmented()){let h=Hn(a.getTextContent());a.replace(h),a=h}aL(a,s,g)}}}function aL(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 EP(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(!EP(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:!Ar,metaKey:Ar},iL={altKey:Ar,ctrlKey:!Ar};function sL(e){return e.key==="Backspace"}function lL(e){return $t(e,"a",Ea)}function pK(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"),Vp(e),e}{let n=t.select(0,t.getChildrenSize());return _o(Vp(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 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 mK(e){let t=e.getType(),n=Fa();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 dL(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 RP(e,t){let n=e.offset;if(e.type==="element")return dL(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?dL(o.getParentOrThrow(),t,o.getIndexWithinParent()+(t?0:1)):r}}return null}function MP(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=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 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 FP(t)?t.host:t}function Uy(e){return SP(e)?e:So(e)?e.ownerDocument:null}function gK(e){return Yt()._updateTags.has(e)}function hm(e){$n(),Yt()._updateTags.add(e)}function NP(e){$n(),Yt()._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 Xo(e){let t=e._window;return t===null&&de(78),t}function hK(e){return re(e)&&e.isInline()||tn(e)&&e.isInline()}function _P(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 $y(e){let t=e.constructor.clone(e);return IP(t,null),t.afterCloneFrom(e),t}function iu(e){let t=Yt(),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)||tn(t)||de(99)}function DP(e){let t=Fn(e);return t===null&&de(63,e),t}function Rv(e){return(tn(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 OP(e){let t=Hy(e);return t?t.getSelection():null}function vK(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?$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 yK(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 FP(e){return nd(e)&&e.nodeType===11}function BP(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 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 Ky(){return Yt()}var cL=new WeakMap,xK=new Map;function iy(e){if(!e._readOnly&&e.isEmpty())return xK;e._readOnly||de(192);let t=cL.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),cL.set(e,t)),t}function Vy(e){let t=e.constructor.clone(e);return t.afterCloneFrom(e),t}function CK(e){return(t=Vy(e))[eP]=!0,t;var t}function zP(e,t){let n=parseInt(e.style.paddingInlineStart,10)||0,o=Math.round(n/40);t.setIndent(o)}function bK(e){e.__lexicalUnmanaged=!0}function UP(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=wk in e.prototype?e.prototype[wk]():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=>(Ey(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 wK(e){let t=Ky();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},SK={next:"previous",previous:"next"},Xl=class{origin;constructor(t){this.origin=t}[Symbol.iterator](){return Gy({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(qy(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)}},IK={root:to,shadowRoot:gr};function Ni(e){return SK[e]}function qy(e,t="root"){return IK[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(qy(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(qy(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 TK(e){return e instanceof Xl}function _s(e){return e instanceof Yl}function Mr(e){return e instanceof eu}var kK={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}}},LK={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}}},PK={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 LK[t](e):null}function Ai(e,t,n){return e?new kK[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"&&pL(284,String(t),String(o),e.getKey()),r=r<0?0:o),r}function sy(e,t){return new am(e,t)}function Oa(e,t){return re(e)?new PK[t](e):null}function HP(e){return e&&e.getChildCaret()||e}function Zl(e){return e&&HP(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 Da(a)?(function(i,s){let{direction:l,origin:d}=i,c=Nr(d,s==="focus"?Ni(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=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 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 Ai(t.setTextContent(a.slice(0,o)+a.slice(r)),n,o)}};function AK(e){return e instanceof am}function Wy(e){return Ei(e,Wn(Qo(),e.direction))}function $P(e){return Ei(e,e)}function Ei(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=$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 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 uL(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]=uL(e);o;r=o,o=o.getParent())n.set(o,r);for(let[o,r]=uL(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 Ri(e,t){let{type:n,key:o,offset:r}=e,a=DP(e.key);return n==="text"?(ze(a)||de(266,a.getType(),o),Ai(a,t,r)):(re(a)||de(267,a.getType(),o),WP(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(),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 KP(e){let t=Ft(),n=Ge(t)?t:uP();return Kc(n,e),_o(n),n}function Kc(e,t){ed(e.anchor,t.anchor),ed(e.focus,t.focus)}function dy(e){let{anchor:t,focus:n}=e,o=Ri(t,"next"),r=Ri(n,"next"),a=jy(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 fL(e,t="root"){let n=[e];for(let o=Mr(e)?e.getParentCaret(t):e.getSiblingCaret();o!==null;o=o.getParentCaret(t))n.push(od(o));return n}function Mv(e){return!!e&&e.origin.isAttached()}function VP(e,t="removeEmptySlices"){if(e.isCollapsed())return e;let n="root",o="next",r=t,a=Xy(e,o),i=fL(a.anchor,n),s=fL(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(_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(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 T=(E,P)=>{let _;for(let A=S;A<E.length;A++){let F=E[A];if(gr(F))return;!_&&P(F)&&(_=F)}return _},I=T(C,Na),k=I&&T(w,E=>v.has(E.getKey())&&Na(E));return I&&k?[I,k]: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(Mv);if(m)return $P(Mi(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=Zl(a);if(!Mr(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 qP(e){return Da(e)&&e.offset!==Nr(e.origin,e.direction)}function Mi(e,t){return e.direction===t?e:e.getFlipped()}function Xy(e,t){return e.direction===t?e:Ei(Mi(e.focus,t),Mi(e.anchor,t))}function WP(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 EK(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 RK(e){let{origin:t,offset:n,direction:o}=e;if(n===Nr(t,o))return e.getSiblingCaret();if(n===Nr(t,Ni(o)))return od(e.getSiblingCaret());let[r]=t.splitText(n);return ze(r)||de(281),Mi(Wn(r,"next"),o)}function MK(e,t){return!0}function NK(e,{$copyElementNode:t=$y,$splitTextPointCaretNext:n=RK,rootMode:o="shadowRoot",$shouldSplit:r=MK}={}){if(Da(e))return n(e);let a=e.getParentCaret(o);if(a){let{origin:i}=a;if(Mr(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 _K(e){return e}function DK(...e){return e}function OK(e,t){return[e,t]}function FK(e){return e}function BK(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 zK(e,...t){let n=lu(...t);n.length>0&&e.classList.add(...n)}function UK(e,...t){let n=lu(...t);n.length>0&&e.classList.remove(...n)}function HK(...e){return()=>{for(let t=e.length-1;t>=0;t--)e[t]();e.length=0}}var M=Yy,eie=M.$addUpdateTag,vm=M.$applyNodeReplacement,rd=M.$caretFromPoint,GP=M.$caretRangeFromSelection,ym=M.$cloneWithProperties,jP=M.$cloneWithPropertiesEphemeral,tie=M.$comparePointCaretNext,nie=M.$copyNode,QP=M.$create,Os=M.$createLineBreakNode,XP=M.$createNodeSelection,hr=M.$createParagraphNode,oie=M.$createPoint,Fs=M.$createRangeSelection,YP=M.$createRangeSelectionFromDom,JP=M.$createTabNode,Fr=M.$createTextNode,ZP=M.$extendCaretToRange,Ba=M.$findMatchingParent,Jy=M.$getAdjacentChildCaret,rie=M.$getAdjacentNode,Bs=M.$getAdjacentSiblingOrParentSiblingCaret,Zy=M.$getCaretInDirection,eA=M.$getCaretRange,aie=M.$getCaretRangeInDirection,tA=M.$getCharacterOffsets,_i=M.$getChildCaret,iie=M.$getChildCaretAtIndex,ex=M.$getChildCaretOrSelf,nA=M.$getCollapsedCaretRange,sie=M.$getCommonAncestor,lie=M.$getCommonAncestorResultBranchOrder,xm=M.$getEditor,die=M.$getNearestNodeFromDOMNode,cie=M.$getNearestRootOrShadowRoot,Cm=M.$getNodeByKey,uie=M.$getNodeByKeyOrThrow,oA=M.$getNodeFromDOMNode,du=M.$getPreviousSelection,At=M.$getRoot,Ke=M.$getSelection,za=M.$getSiblingCaret,bm=M.$getState,fie=M.$getStateChange,pie=M.$getTextContent,mie=M.$getTextNodeOffset,gie=M.$getTextPointCaret,hie=M.$getTextPointCaretSlice,vie=M.$getWritableNodeState,rA=M.$hasAncestor,yie=M.$hasUpdateTag,xie=M.$insertNodes,ad=M.$isBlockElementNode,cu=M.$isChildCaret,wm=M.$isDecoratorNode,aA=M.$isEditorState,je=M.$isElementNode,iA=M.$isExtendableTextPointCaret,Cie=M.$isInlineElementOrDecoratorNode,sA=M.$isLeafNode,id=M.$isLineBreakNode,bie=M.$isNodeCaret,tx=M.$isNodeSelection,lA=M.$isParagraphNode,Ne=M.$isRangeSelection,uu=M.$isRootNode,zs=M.$isRootOrShadowRoot,dA=M.$isSiblingCaret,wie=M.$isTabNode,dt=M.$isTextNode,Sm=M.$isTextPointCaret,Sie=M.$isTextPointCaretSlice,nx=M.$isTokenOrSegmented,Iie=M.$isTokenOrTab,Tie=M.$nodesOfType,cA=M.$normalizeCaret,uA=M.$normalizeSelection__EXPERIMENTAL,kie=M.$onUpdate,fA=M.$parseSerializedNode,Lie=M.$removeTextFromCaretRange,pA=M.$rewindSiblingCaret,Im=M.$selectAll,Pie=M.$setCompositionKey,Aie=M.$setPointFromCaret,Br=M.$setSelection,mA=M.$setSelectionFromCaretRange,Tm=M.$setState,gA=M.$splitAtPointCaretNext,hA=M.$splitNode,Eie=M.$updateRangeSelectionFromCaretRange,ox=M.ArtificialNode__DO_NOT_USE,Rie=M.BEFORE_INPUT_COMMAND,vA=M.BLUR_COMMAND,fu=M.CAN_REDO_COMMAND,pu=M.CAN_UNDO_COMMAND,km=M.CLEAR_EDITOR_COMMAND,yA=M.CLEAR_HISTORY_COMMAND,xA=M.CLICK_COMMAND,Mie=M.COLLABORATION_TAG,Lm=M.COMMAND_PRIORITY_CRITICAL,nn=M.COMMAND_PRIORITY_EDITOR,vr=M.COMMAND_PRIORITY_HIGH,sd=M.COMMAND_PRIORITY_LOW,Nie=M.COMMAND_PRIORITY_NORMAL,_ie=M.COMPOSITION_END_COMMAND,CA=M.COMPOSITION_END_TAG,Die=M.COMPOSITION_START_COMMAND,bA=M.COMPOSITION_START_TAG,wA=M.CONTROLLED_TEXT_INSERTION_COMMAND,Pm=M.COPY_COMMAND,SA=M.CUT_COMMAND,Am=M.DELETE_CHARACTER_COMMAND,IA=M.DELETE_LINE_COMMAND,TA=M.DELETE_WORD_COMMAND,Oie=M.DRAGEND_COMMAND,Fie=M.DRAGOVER_COMMAND,kA=M.DRAGSTART_COMMAND,LA=M.DROP_COMMAND,Ua=M.DecoratorNode,Bie=M.ElementNode,PA=M.FOCUS_COMMAND,zie=M.FORMAT_ELEMENT_COMMAND,AA=M.FORMAT_TEXT_COMMAND,Em=M.HISTORIC_TAG,zr=M.HISTORY_MERGE_TAG,EA=M.HISTORY_PUSH_TAG,rx=M.INDENT_CONTENT_COMMAND,Uie=M.INPUT_COMMAND,ax=M.INSERT_LINE_BREAK_COMMAND,RA=M.INSERT_PARAGRAPH_COMMAND,MA=M.INSERT_TAB_COMMAND,mu=M.INTERNAL_$isBlock,Hie=M.IS_ALL_FORMATTING,$ie=M.IS_BOLD,Kie=M.IS_CODE,Vie=M.IS_HIGHLIGHT,qie=M.IS_ITALIC,Wie=M.IS_STRIKETHROUGH,Gie=M.IS_SUBSCRIPT,jie=M.IS_SUPERSCRIPT,Qie=M.IS_UNDERLINE,NA=M.KEY_ARROW_DOWN_COMMAND,Rm=M.KEY_ARROW_LEFT_COMMAND,Mm=M.KEY_ARROW_RIGHT_COMMAND,_A=M.KEY_ARROW_UP_COMMAND,Nm=M.KEY_BACKSPACE_COMMAND,DA=M.KEY_DELETE_COMMAND,OA=M.KEY_DOWN_COMMAND,_m=M.KEY_ENTER_COMMAND,FA=M.KEY_ESCAPE_COMMAND,Xie=M.KEY_MODIFIER_COMMAND,Yie=M.KEY_SPACE_COMMAND,Dm=M.KEY_TAB_COMMAND,BA=M.LineBreakNode,Jie=M.MOVE_TO_END,Zie=M.MOVE_TO_START,ese=M.NODE_STATE_KEY,zA=M.OUTDENT_CONTENT_COMMAND,Om=M.PASTE_COMMAND,UA=M.PASTE_TAG,HA=M.ParagraphNode,$A=M.REDO_COMMAND,KA=M.REMOVE_TEXT_COMMAND,VA=M.RootNode,tse=M.SELECTION_CHANGE_COMMAND,qA=M.SELECTION_INSERT_CLIPBOARD_NODES_COMMAND,WA=M.SELECT_ALL_COMMAND,nse=M.SKIP_COLLAB_TAG,ose=M.SKIP_DOM_SELECTION_TAG,rse=M.SKIP_SCROLL_INTO_VIEW_TAG,ase=M.SKIP_SELECTION_FOCUS_TAG,GA=M.TEXT_TYPE_TO_FORMAT,jA=M.TabNode,Fm=M.TextNode,QA=M.UNDO_COMMAND,gu=M.addClassNamesToElement,ise=M.buildImportMap,Bm=M.configExtension,XA=M.createCommand,zm=M.createEditor,sse=M.createSharedNodeState,YA=M.createState,JA=M.declarePeerDependency,Rn=M.defineExtension,lse=M.flipDirection,dse=M.getDOMOwnerDocument,ix=M.getDOMSelection,cse=M.getDOMSelectionFromTarget,ZA=M.getDOMTextNode,use=M.getEditorPropertyFromDOMNode,fse=M.getNearestEditorFromDOMNode,eE=M.getRegisteredNode,pse=M.getRegisteredNodeOrThrow,mse=M.getStaticNodeConfig,gse=M.getTextDirection,hse=M.getTransformSetFromKlass,tE=M.isBlockDomNode,vse=M.isCurrentlyReadOnlyMode,nE=M.isDOMDocumentNode,oE=M.isDOMNode,yse=M.isDOMTextNode,xse=M.isDOMUnmanaged,sx=M.isDocumentFragment,Cse=M.isExactShortcutMatch,rE=M.isHTMLAnchorElement,Um=M.isHTMLElement,hu=M.isInlineDomNode,bse=M.isLexicalEditor,wse=M.isModifierMatch,Sse=M.isSelectionCapturedInDecoratorInput,aE=M.isSelectionWithinEditor,lx=M.makeStepwiseIterator,ua=M.mergeRegister,Ise=M.normalizeClassNames,Hm=M.removeClassNamesFromElement,Tse=M.removeFromParent,kse=M.resetRandomKey,Ur=M.safeCast,Lse=M.setDOMUnmanaged,Pse=M.setNodeIndentFromDOM,$m=M.shallowMergeConfig,dx=M.toggleTextFormatType;var gx={};En(gx,{$addNodeStyle:()=>GK,$cloneWithProperties:()=>ym,$copyBlockFormatIndent:()=>mE,$ensureForwardRangeSelection:()=>pE,$forEachSelectedTextNode:()=>fE,$getComputedStyleForElement:()=>fx,$getComputedStyleForParent:()=>px,$getSelectionStyleValueForProperty:()=>t3,$isAtNodeEnd:()=>WK,$isParentElementRTL:()=>mx,$isParentRTL:()=>VK,$moveCaretSelection:()=>vE,$moveCharacter:()=>ZK,$patchStyleText:()=>jK,$selectAll:()=>Im,$setBlocksType:()=>QK,$shouldOverrideDefaultCharacterSelection:()=>JK,$sliceSelectedTextNodeContent:()=>qK,$trimTextContentFromAnchor:()=>uE,$wrapNodes:()=>YK,createDOMRange:()=>$K,createRectsFromDOMRange:()=>KK,getCSSFromStyleObject:()=>cE,getStyleObjectFromCSS:()=>qm,trimTextContentFromAnchor:()=>n3});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 iE(e){let t=e;for(;t!=null;){if(t.nodeType===Node.TEXT_NODE)return t;t=t.firstChild}return null}function sE(e){let t=e.parentNode;if(t==null)throw new Error("Should never happen");return[t,Array.from(t.childNodes).indexOf(e)]}function $K(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=iE(l)),dt(o)&&(d=iE(d)),t===void 0||o===void 0||l===null||d===null)return null;l.nodeName==="BR"&&([l,c]=sE(l)),d.nodeName==="BR"&&([d,f]=sE(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 KK(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 dE(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=dE(e),Vm.set(e,t)),t}function cE(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(uu(e)?e:e.getParentOrThrow())}function VK(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]=tA(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=jP(t)),t.__text=x)}}return t}function WK(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 uE(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=`
|
|
3754
3776
|
|
|
3755
|
-
`);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=xm(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=zr(c);o.replace(h),g=h}if(Me(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=zr(p);o.replace(m)}r=0}}}function UK(e){let t=e.getStyle(),n=sE(t);Km.set(t,n)}function $m(e,t){(Me(e)?e.isCollapsed():dt(e)||Qe(e))||fx(280);let n=Vm(Me(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=lE(o);Me(e)||dt(e)?e.setStyle(r):e.setTextStyle(r),Km.set(r,o)}function HK(e,t){if(Me(e)&&e.isCollapsed()){$m(e,t);let o=e.anchor.getNode();Qe(o)&&o.isEmpty()&&$m(o,t)}cE(o=>{$m(o,t)});let n=e.getNodes();if(n.length>0){let o=new Set;for(let r of n){if(!Qe(r)||!r.canBeEmpty()||r.getChildrenSize()!==0)continue;let a=r.getKey();o.has(a)||(o.add(a),$m(r,t))}}}function cE(e){let t=He();if(!t)return;let n=new Map,o=a=>n.get(a.getKey())||[0,a.getTextContentSize()];if(Me(t))for(let a of qP(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]))}Me(t)&&t.anchor.type==="text"&&t.focus.type==="text"&&t.anchor.key===t.focus.key&&uE(t)}function uE(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 fE(e,t){let n=e.getFormatType(),o=e.getIndent();n!==t.getFormatType()&&t.setFormat(n),o!==t.getIndent()&&t.setIndent(o)}function $K(e,t,n=fE){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=Ha(i.getNode(),pu),d=Ha(s.getNode(),pu);Qe(l)&&r.set(l.getKey(),l),Qe(d)&&r.set(d.getKey(),d)}for(let i of e.getNodes())if(Qe(i)&&pu(i))r.set(i.getKey(),i);else if(o===null){let s=Ha(i,pu);Qe(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(He())&&Ur(a)}function iE(e){return e.getNode().isAttached()}function KK(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 VK(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)?(ux(e,l,l.length,t,n),l=[],s=c):s===null||s!==null&&nA(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=Qe(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];Qe(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&&aA(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()),Qe(C)&&C.getChildrenKeys().forEach(w=>f.add(w))}),KK(v)}}else if(c.has(h.getKey())){Qe(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(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(Qe(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();Me(m)&&iE(m.anchor)&&iE(m.focus)?Ur(m.clone()):p!==null?p.selectEnd():e.dirty=!0}function pE(e){let t=mE(e);return t!==null&&t.writingMode==="vertical-rl"}function mE(e){let t=e.anchor.getNode();return Qe(t)?px(t):mx(t)}function qK(e,t){let n=pE(e)?!t:t;gx(e)&&(n=!n);let o=nd(e.focus,n?"previous":"next");if(rA(o))return!1;for(let r of YP(o)){if(du(r))return!r.origin.isInline();if(!Qe(r.origin)){if(bm(r.origin))return!0;break}}return!1}function gE(e,t,n,o){e.modify(t?"extend":"move",n,o)}function gx(e){let t=mE(e);return t!==null&&t.direction==="rtl"}function WK(e,t,n){let o=gx(e),r;r=pE(e)||o?!n:n,gE(e,t,r,"character")}function GK(e,t,n){let o=Vm(e.getStyle());return o!==null&&o[t]||n}function jK(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(Me(e)&&e.isCollapsed()&&e.style!==""){let c=Vm(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=GK(f,t,n);if(o===null)o=p;else if(o!==p){o="";break}}}return o===null?n:o}var QK=dE;var hn=hx,hE=hn.$addNodeStyle,Sse=hn.$cloneWithProperties,Ise=hn.$copyBlockFormatIndent,Tse=hn.$ensureForwardRangeSelection,kse=hn.$forEachSelectedTextNode,Lse=hn.$getComputedStyleForElement,Pse=hn.$getComputedStyleForParent,Ase=hn.$getSelectionStyleValueForProperty,Ese=hn.$isAtNodeEnd,Rse=hn.$isParentElementRTL,Mse=hn.$isParentRTL,Nse=hn.$moveCaretSelection,vx=hn.$moveCharacter,_se=hn.$patchStyleText,Dse=hn.$selectAll,Ose=hn.$setBlocksType,yx=hn.$shouldOverrideDefaultCharacterSelection,qm=hn.$sliceSelectedTextNodeContent,Fse=hn.$trimTextContentFromAnchor,Bse=hn.$wrapNodes,zse=hn.createDOMRange,vE=hn.createRectsFromDOMRange,Use=hn.getCSSFromStyleObject,Hse=hn.getStyleObjectFromCSS,$se=hn.trimTextContentFromAnchor;var wx={};_n(wx,{$descendantsMatching:()=>M3,$dfs:()=>m3,$dfsIterator:()=>LE,$filter:()=>k3,$findMatchingParent:()=>Ha,$firstToLastIterator:()=>N3,$getAdjacentCaret:()=>g3,$getAdjacentSiblingOrParentSiblingCaret:()=>Os,$getDepth:()=>AE,$getNearestBlockElementAncestorOrThrow:()=>C3,$getNearestNodeOfType:()=>x3,$getNextRightPreorderNode:()=>y3,$getNextSiblingOrParentSibling:()=>v3,$handleIndentAndOutdent:()=>L3,$insertFirst:()=>P3,$insertNodeToNearestRoot:()=>S3,$insertNodeToNearestRootAtCaret:()=>RE,$isEditorIsNestedEditor:()=>E3,$lastToFirstIterator:()=>bx,$restoreEditorState:()=>w3,$reverseDfs:()=>h3,$reverseDfsIterator:()=>EE,$splitNode:()=>mA,$unwrapAndFilterDescendants:()=>R3,$unwrapNode:()=>_3,$wrapNodeInElement:()=>I3,CAN_USE_BEFORE_INPUT:()=>a3,CAN_USE_DOM:()=>IE,IS_ANDROID:()=>i3,IS_ANDROID_CHROME:()=>s3,IS_APPLE:()=>l3,IS_APPLE_WEBKIT:()=>d3,IS_CHROME:()=>c3,IS_FIREFOX:()=>TE,IS_IOS:()=>u3,IS_SAFARI:()=>f3,addClassNamesToElement:()=>mu,calculateZoomLevel:()=>A3,isBlockDomNode:()=>ZA,isHTMLAnchorElement:()=>nE,isHTMLElement:()=>zm,isInlineDomNode:()=>gu,isMimeType:()=>kE,makeStateWrapper:()=>D3,markSelection:()=>SE,mediaFileReader:()=>p3,mergeRegister:()=>ha,objectKlassEquals:()=>T3,positionNodeOnRange:()=>wE,registerNestedElementResolver:()=>b3,removeClassNamesFromElement:()=>Um,selectionAlwaysOnDisplay:()=>r3});function Wm(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 Kr=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,XK=Kr&&"documentMode"in document?document.documentMode:null,CE=Kr&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),YK=Kr&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),JK=!(!Kr||!("InputEvent"in window)||XK)&&"getTargetRanges"in new window.InputEvent("input"),ZK=Kr&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),e3=Kr&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,bE=Kr&&/Android/.test(navigator.userAgent),Cx=Kr&&/^(?=.*Chrome).*/i.test(navigator.userAgent),t3=Kr&&bE&&Cx,n3=Kr&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&CE&&!Cx;function va(e){return`${e}px`}var o3={attributes:!0,characterData:!0,childList:!0,subtree:!0};function wE(e,t,n){let o=null,r=null,a=null,i=[],s=document.createElement("div");function l(){o===null&&Wm(182),r===null&&Wm(183);let{left:f,top:p}=r.getBoundingClientRect(),m=vE(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=va(x.left-f);w.left!==L&&(w.left=L,v=!0);let S=va(x.top-p);w.top!==S&&(C.style.top=S,v=!0);let T=va(x.width);w.width!==T&&(C.style.width=T,v=!0);let I=va(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(!zm(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,o3),l()});return()=>{c(),d()}}function yE(e,t,n){if(e.type!=="text"&&Qe(t)){let o=t.getDOMSlot(n);return[o.element,o.getFirstChildOffset()+e.offset]}return[YA(n)||n,e.offset]}function SE(e,t){let n=null,o=null,r=null,a=null,i=null,s=null,l=()=>{};function d(c){c.read(()=>{let f=He();if(!Me(f))return n=null,r=null,a=null,s=null,l(),void(l=()=>{});let[p,m]=(function(I){let k=I.getStartEndPoints();return I.isBackward()?[k[1],k[0]]:k})(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(),T=a===null||L!==i||C!==s||x!==a.getKey();if((S||T)&&w!==null&&L!==null){let I=(function(k,E,P,_,A,B,z){let q=(k._window?k._window.document:document).createRange();return q.setStart(...yE(E,P,_)),q.setEnd(...yE(A,B,z)),q})(e,p,g,w,m,y,L);l(),l=wE(e,I,k=>{if(t===void 0)for(let E of k){let P=E.style;P.background!=="Highlight"&&(P.background="Highlight"),P.color!=="HighlightText"&&(P.color="HighlightText"),P.marginTop!==va(-1.5)&&(P.marginTop=va(-1.5)),P.paddingTop!==va(4)&&(P.paddingTop=va(4)),P.paddingBottom!==va(0)&&(P.paddingBottom=va(0))}else t(k)})}n=g,o=w,r=v,a=y,i=L,s=C})}return d(e.getEditorState()),ha(e.registerUpdateListener(({editorState:c})=>d(c)),()=>{l()})}function r3(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=SE(e,t))};return document.addEventListener("selectionchange",o),()=>{n!==null&&n(),document.removeEventListener("selectionchange",o)}}var a3=JK,IE=Kr,i3=bE,s3=t3,l3=CE,d3=n3,c3=Cx,TE=YK,u3=e3,f3=ZK;function kE(e,t){for(let n of t)if(e.type.startsWith(n))return!0;return!1}function p3(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()}),kE(l,t)?d.readAsDataURL(l):i()};i()})}function m3(e,t){return Array.from(LE(e,t))}function g3(e){return e?e.getAdjacentCaret():null}function h3(e,t){return Array.from(EE(e,t))}function LE(e,t){return PE("next",e,t)}function xE(e,t){let n=Os($a(e,t));return n&&n[0]}function PE(e,t,n){let o=At(),r=t||o,a=Qe(r)?Di(r,e):$a(r,e),i=AE(r),s=n?Zy(tx($a(n,e)))||xE(n,e):xE(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;du(d)&&l++;let c=Os(d);return!c||c[0].isSameNodeCaret(s)?null:(l+=c[1],c[0])}})}function v3(e){let t=Os($a(e,"next"));return t&&[t[0].origin,t[1]]}function AE(e){let t=-1;for(let n=e;n!==null;n=n.getParent())t++;return t}function y3(e){let t=tx($a(e,"previous")),n=Os(t,"root");return n&&n[0].origin}function EE(e,t){return PE("previous",e,t)}function x3(e,t){let n=e;for(;n!=null;){if(n instanceof t)return n;n=n.getParent()}return null}function C3(e){let t=Ha(e,n=>Qe(n)&&!n.isInline());return Qe(t)||Wm(4,e.__key),t}function b3(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 w3(e,t){let n=new Map,o=e._pendingEditorState;for(let[a,i]of t._nodeMap)n.set(a,vm(i));o&&(o._nodeMap=n),e._dirtyType=2;let r=t._selection;Ur(r===null?null:r.clone())}function S3(e){let t=He()||lu(),n;if(Me(t))n=nd(t.focus,"next");else{if(t!=null){let i=t.getNodes(),s=i[i.length-1];s&&(n=$a(s,"next"))}n=n||Di(At(),"previous").getFlipped().insert(fr())}let o=RE(e,n),r=Zy(o),a=du(r)?lA(r):o;return fA(eA(a)),e.getLatest()}function RE(e,t,n){let o=ex(t,"next");for(let r=o;r;r=pA(r,n))o=r;return wm(o)&&Wm(283),o.insert(e.isInline()?fr().append(e):e),ex($a(e.getLatest(),"next"),t.direction)}function I3(e,t){let n=t();return e.replace(n),n.append(e),n}function T3(e,t){return e!==null&&Object.getPrototypeOf(e).constructor.name===t.name}function k3(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 L3(e){let t=He();if(!Me(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=Ha(a,d=>Qe(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 P3(e,t){Di(e,"next").insert(t)}var xx=!(TE||!IE)&&void 0;function A3(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 E3(e){return e._parentEditor!==null}function R3(e,t){return ME(e,t,null)}function ME(e,t,n){let o=!1;for(let r of bx(e))t(r)?n!==null&&n(r):(o=!0,Qe(r)&&ME(r,t,n||(a=>r.insertAfter(a))),r.remove());return o}function M3(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(Qe(r))for(let a of bx(r))o.push(a);return n}function N3(e){return NE(Di(e,"next"))}function bx(e){return NE(Di(e,"previous"))}function NE(e){return dx({hasNext:sA,initial:e.getAdjacentCaret(),map:t=>t.origin.getLatest(),step:t=>t.getAdjacentCaret()})}function _3(e){uA($a(e,"next")).splice(1,e.getChildren())}function D3(e){let t=o=>Cm(o,e),n=(o,r)=>Im(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 Xe=wx,Gse=Xe.$descendantsMatching,jse=Xe.$dfs,Qse=Xe.$dfsIterator,Xse=Xe.$filter,Yse=Xe.$findMatchingParent,Jse=Xe.$firstToLastIterator,Zse=Xe.$getAdjacentCaret,ele=Xe.$getAdjacentSiblingOrParentSiblingCaret,tle=Xe.$getDepth,_E=Xe.$getNearestBlockElementAncestorOrThrow,nle=Xe.$getNearestNodeOfType,ole=Xe.$getNextRightPreorderNode,rle=Xe.$getNextSiblingOrParentSibling,DE=Xe.$handleIndentAndOutdent,ale=Xe.$insertFirst,ile=Xe.$insertNodeToNearestRoot,sle=Xe.$insertNodeToNearestRootAtCaret,lle=Xe.$isEditorIsNestedEditor,dle=Xe.$lastToFirstIterator,cle=Xe.$restoreEditorState,ule=Xe.$reverseDfs,fle=Xe.$reverseDfsIterator,ple=Xe.$splitNode,mle=Xe.$unwrapAndFilterDescendants,gle=Xe.$unwrapNode,hle=Xe.$wrapNodeInElement,vle=Xe.CAN_USE_BEFORE_INPUT,yle=Xe.CAN_USE_DOM,xle=Xe.IS_ANDROID,Cle=Xe.IS_ANDROID_CHROME,ble=Xe.IS_APPLE,wle=Xe.IS_APPLE_WEBKIT,Sle=Xe.IS_CHROME,Ile=Xe.IS_FIREFOX,Tle=Xe.IS_IOS,kle=Xe.IS_SAFARI,Lle=Xe.addClassNamesToElement,Ple=Xe.calculateZoomLevel,Sx=Xe.isBlockDomNode,Ale=Xe.isHTMLAnchorElement,OE=Xe.isHTMLElement,Ele=Xe.isInlineDomNode,Rle=Xe.isMimeType,Mle=Xe.makeStateWrapper,Nle=Xe.markSelection,_le=Xe.mediaFileReader,Va=Xe.mergeRegister,hu=Xe.objectKlassEquals,Dle=Xe.positionNodeOnRange,Ole=Xe.registerNestedElementResolver,Fle=Xe.removeClassNamesFromElement,Ble=Xe.selectionAlwaysOnDisplay;var Bx={};_n(Bx,{$createHorizontalRuleNode:()=>Fx,$isDecoratorTextNode:()=>XE,$isHorizontalRuleNode:()=>nR,AutoFocusExtension:()=>B3,ClearEditorExtension:()=>z3,DecoratorTextExtension:()=>q3,DecoratorTextNode:()=>xu,EditorStateExtension:()=>Xm,HorizontalRuleExtension:()=>nV,HorizontalRuleNode:()=>zs,INSERT_HORIZONTAL_RULE_COMMAND:()=>eV,InitialStateExtension:()=>eR,LexicalBuilder:()=>dd,NodeSelectionExtension:()=>Nx,TabIndentationExtension:()=>oV,applyFormatFromStyle:()=>H3,applyFormatToDom:()=>$3,batch:()=>$E,buildEditorFromExtensions:()=>Q3,computed:()=>qE,configExtension:()=>Fm,declarePeerDependency:()=>XA,defineExtension:()=>Dn,effect:()=>Fi,getExtensionDependencyFromEditor:()=>Y3,getKnownTypesAndNodes:()=>U3,getPeerDependencyFromEditor:()=>tR,getPeerDependencyFromEditorOrThrow:()=>J3,namedSignals:()=>Jm,registerClearEditor:()=>jE,registerTabIndentation:()=>rR,safeCast:()=>$r,shallowMergeConfig:()=>Hm,signal:()=>ld,untracked:()=>Ax,watchedSignal:()=>Dx});var O3=Symbol.for("preact-signals");function Ym(){if(Oi>1)return void Oi--;let e,t=!1;for(;yu!==void 0;){let n=yu;for(yu=void 0,Ex++;n!==void 0;){let o=n.o;if(n.o=void 0,n.f&=-3,!(8&n.f)&&KE(n))try{n.c()}catch(r){t||(e=r,t=!0)}n=o}}if(Ex=0,Oi--,t)throw e}function $E(e){if(Oi>0)return e();Oi++;try{return e()}finally{Ym()}}var qt,yu;function Ax(e){let t=qt;qt=void 0;try{return e()}finally{qt=t}}var Oi=0,Ex=0,Qm=0;function FE(e){if(qt===void 0)return;let t=e.n;return t===void 0||t.t!==qt?(t={i:0,S:e,p:qt.s,n:void 0,t:qt,e:void 0,x:void 0,r:t},qt.s!==void 0&&(qt.s.n=t),qt.s=t,e.n=t,32&qt.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=qt.s,t.n=void 0,qt.s.n=t,qt.s=t),t):void 0}function So(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 ld(e,t){return new So(e,t)}function KE(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 BE(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 VE(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){So.call(this,void 0),this.x=e,this.s=void 0,this.g=Qm-1,this.f=4,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}function qE(e,t){return new Bs(e,t)}function WE(e){let t=e.u;if(e.u=void 0,typeof t=="function"){Oi++;let n=qt;qt=void 0;try{t()}catch(o){throw e.f&=-2,e.f|=8,_x(e),o}finally{qt=n,Ym()}}}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,WE(e)}function F3(e){if(qt!==this)throw new Error("Out-of-order effect");VE(this),qt=e,this.f&=-2,8&this.f&&_x(this),Ym()}function sd(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 Fi(e,t){let n=new sd(e,t);try{n.c()}catch(r){throw n.d(),r}let o=n.d.bind(n);return o[Symbol.dispose]=o,o}function Jm(e,t={}){let n={};for(let o in e){let r=t[o],a=ld(r===void 0?e[o]:r);n[o]=a}return n}So.prototype.brand=O3,So.prototype.h=function(){return!0},So.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)}))},So.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)}))}},So.prototype.subscribe=function(e){return Fi(()=>{let t=this.value,n=qt;qt=void 0;try{e(t)}finally{qt=n}},{name:"sub"})},So.prototype.valueOf=function(){return this.value},So.prototype.toString=function(){return this.value+""},So.prototype.toJSON=function(){return this.value},So.prototype.peek=function(){let e=qt;qt=void 0;try{return this.value}finally{qt=e}},Object.defineProperty(So.prototype,"value",{get(){let e=FE(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++,Qm++,Oi++;try{for(let t=this.t;t!==void 0;t=t.x)t.t.N()}finally{Ym()}}}}),Bs.prototype=new So,Bs.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===Qm))return!0;if(this.g=Qm,this.f|=1,this.i>0&&!KE(this))return this.f&=-2,!0;let e=qt;try{BE(this),qt=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 qt=e,VE(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)}So.prototype.S.call(this,e)},Bs.prototype.U=function(e){if(this.t!==void 0&&(So.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=FE(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}}),sd.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()}},sd.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,WE(this),BE(this),Oi++;let e=qt;return qt=this,F3.bind(this,e)},sd.prototype.N=function(){2&this.f||(this.f|=2,this.o=yu,yu=this)},sd.prototype.d=function(){this.f|=8,1&this.f||_x(this)},sd.prototype.dispose=function(){this.d()};var B3=Dn({build:(e,t,n)=>Jm(t),config:$r({defaultSelection:"rootEnd",disabled:!1}),name:"@lexical/extension/AutoFocus",register(e,t,n){let o=n.getOutput();return Fi(()=>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 GE(){let e=At(),t=He(),n=fr();e.clear(),e.append(n),t!==null&&n.select(),Me(t)&&(t.format=0)}function jE(e,t=GE){return e.registerCommand(Tm,n=>(e.update(t),!0),rn)}var z3=Dn({build:(e,t,n)=>Jm(t),config:$r({$onClear:GE}),name:"@lexical/extension/ClearEditor",register(e,t,n){let{$onClear:o}=n.getOutput();return Fi(()=>jE(e,o.value))}});function U3(e){let t=new Set,n=new Set;for(let o of QE(e)){let r=typeof o=="function"?o:o.replace;t.add(r.getType()),n.add(r)}return{nodes:n,types:t}}function QE(e){return(typeof e.nodes=="function"?e.nodes():e.nodes)||[]}var Ix=QA("format",{parse:e=>typeof e=="number"?e:0}),xu=class extends Ka{$config(){return this.config("decorator-text",{extends:Ka,stateConfigs:[{flat:!0,stateConfig:Ix}]})}getFormat(){return Cm(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 Im(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 XE(e){return e instanceof xu}function H3(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 $3(e,t,n=V3){for(let[o,r]of Object.entries(n))e.hasFormat(r)&&(t=K3(t,o));return t}function K3(e,t){let n=document.createElement(t);return n.appendChild(e),n}var V3={b:"bold",code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"},q3=Dn({name:"@lexical/extension/DecoratorText",nodes:()=>[xu],register:(e,t,n)=>e.registerCommand(LA,o=>{let r=He();if(nx(r)||Me(r))for(let a of r.getNodes())XE(a)&&a.toggleFormat(o);return!1},ad)});function Dx(e,t){let n;return ld(e(),{unwatched(){n&&(n(),n=void 0)},watched(){this.value=e(),n=t(this)}})}var Xm=Dn({build:e=>Dx(()=>e.getEditorState(),t=>e.registerUpdateListener(n=>{t.value=n.editorState})),name:"@lexical/extension/EditorState"});function jt(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 YE(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]=YE(n[r],o[r]);return e}return t}var Ox=0,Rx=1,JE=2,Tx=3,Gm=4,id=5,kx=6,vu=7;function Lx(e){return e.id===Ox}function ZE(e){return e.id===JE}function W3(e){return(function(t){return t.id===Rx})(e)||jt(305,String(e.id),String(Rx)),Object.assign(e,{id:JE})}var G3=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):Hm;for(let o of this.configs)t=n(t,o);return t}init(t){let n=this.state;ZE(n)||jt(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:Gm,initResult:l,registerState:d})})(a,i,r)}build(t){let n=this.state,o;n.id!==Gm&&jt(307,String(n.id),String(id)),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,output:i,registerState:s})})(n,o,r)}register(t,n){this._signal=n;let o=this.state;o.id!==id&&jt(308,String(o.id),String(id));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!==vu&&jt(309,String(o.id),String(vu)),this.state=(function(i){return Object.assign(i,{id})})(a),r&&r()}}afterRegistration(t){let n=this.state,o;return n.id!==kx&&jt(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:vu})})(n),o}getSignal(){return this._signal===void 0&&jt(311),this._signal}getInitResult(){this.extension.init===void 0&&jt(312,this.extension.name);let t=this.state;return(function(n){return n.id>=Gm})(t)||jt(313,String(t.id),String(Gm)),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)||jt(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&&jt(315,this.extension.name,t.name),n.getExtensionInitDependency()}getDependency(t){let n=this.builder.getExtensionRep(t);return n===void 0&&jt(315,this.extension.name,t.name),n.getExtensionDependency()}getState(){let t=this.state;return(function(n){return n.id>=vu})(t)||jt(316,String(t.id),String(vu)),t}getDirectDependentNames(){return this.builder.incomingEdges.get(this.extension.name)||G3}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>=id})(t)||jt(317,this.extension.name),this._dependency={config:t.config,init:t.initResult,output:t.output}}return this._dependency}},zE={tag:Hr};function j3(){let e=At();e.isEmpty()&&e.append(fr())}var eR=Dn({config:$r({setOptions:zE,updateOptions:zE}),init:({$initialEditorState:e=j3})=>({$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(oA(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:[$A,Om,OA,WA,zA]}),UE=Symbol.for("@lexical/extension/LexicalBuilder");function Q3(...e){return dd.fromExtensions(e).buildEditor()}function HE(){}function X3(e){throw e}function jm(e){return Array.isArray(e)?e:[e]}var Px="0.41.0+prod.esm",dd=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=[jm(eR)];for(let o of t)n.push(jm(o));return new e(n)}static maybeFromEditor(t){let n=t[UE];return n&&(n.PACKAGE_VERSION!==Px&&jt(292,n.PACKAGE_VERSION,Px),n instanceof e||jt(293)),n}static fromEditor(t){let n=e.maybeFromEditor(t);return n===void 0&&jt(294),n}constructEditor(){let{$initialEditorState:t,onError:n,...o}=this.buildCreateEditorArgs(),r=Object.assign(Bm({...o,...n?{onError:a=>{n(a,r)}}:{}}),{[UE]:this});for(let a of this.sortedExtensionReps())a.build(r);return r}buildEditor(){let t=HE;function n(){try{t()}finally{t=HE}}let o=Object.assign(this.constructEditor(),{dispose:n,[Symbol.dispose]:n});return t=ha(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&&jt(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&&jt(296);let n=jm(t),[o]=n;typeof o.name!="string"&&jt(297,typeof o.name);let r=this.extensionNameMap.get(o.name);if(r!==void 0&&r.extension!==o&&jt(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"&&jt(299,o.name,a);for(let i of o.conflictsWith||[])this.extensionNameMap.has(i)&&jt(299,o.name,i),this.conflicts.set(i,o.name);for(let i of o.dependencies||[]){let s=jm(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(ZE(a))return;let i=o.extension.name;var s;Lx(a)||jt(300,i,r||"[unknown]"),Lx(s=a)||jt(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=W3(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&&jt(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 ha(...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 QE(f)){if(typeof p!="function"){let m=o.get(p.replace);m&&jt(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&&YE(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=X3),t}};function Y3(e,t){let n=dd.fromEditor(e).getExtensionRep(t);return n===void 0&&jt(303,t.name),n.getExtensionDependency()}function tR(e,t){let n=dd.fromEditor(e).extensionNameMap.get(t);return n?n.getExtensionDependency():void 0}function J3(e,t){let n=tR(e,t);return n===void 0&&jt(291,t),n}var Z3=new Set,Nx=Dn({build(e,t,n){let o=n.getDependency(Xm).output,r=ld({watchedNodeKeys:new Map}),a=Dx(()=>{},()=>Fi(()=>{let i=a.peek(),{watchedNodeKeys:s}=r.value,l,d=!1;o.value.read(()=>{if(He())for(let[c,f]of s.entries()){if(f.size===0){s.delete(c);continue}let p=xm(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||Z3).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:[Xm],name:"@lexical/extension/NodeSelection"}),eV=jA("INSERT_HORIZONTAL_RULE_COMMAND"),zs=class e extends Ka{static getType(){return"horizontalrule"}static clone(t){return new e(t.__key)}static importJSON(t){return Fx().updateFromJSON(t)}static importDOM(){return{hr:()=>({conversion:tV,priority:0})}}exportDOM(){return{element:document.createElement("hr")}}createDOM(t){let n=document.createElement("hr");return mu(n,t.theme.hr),n}getTextContent(){return`
|
|
3756
|
-
`}isInline(){return!1}updateDOM(){return!1}};function tV(){return{node:Fx()}}function Fx(){return GP(zs)}function nR(e){return e instanceof zs}var nV=Dn({dependencies:[Xm,Nx],name:"@lexical/extension/HorizontalRule",nodes:()=>[zs],register(e,t,n){let{watchNodeKey:o}=n.getDependency(Nx).output,r=ld({nodeSelections:new Map}),a=e._config.theme.hrSelected??"selected";return ha(e.registerCommand(vA,i=>{if(tE(i.target)){let s=tA(i.target);if(nR(s))return(function(l,d=!1){let c=He(),f=l.isSelected(),p=l.getKey(),m;d&&nx(c)?m=c:(m=jP(),Ur(m)),f?m.delete(p):m.add(p)})(s,i.shiftKey),!0}return!1},ad),e.registerMutationListener(zs,(i,s)=>{$E(()=>{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:ld(m),selectedSignal:o(c)}))}l&&(r.value={nodeSelections:d})})}),Fi(()=>{let i=[];for(let{domNode:s,selectedSignal:l}of r.value.nodeSelections.values())i.push(Fi(()=>{let d=s.value;d&&(l.value?mu(d,a):Um(d,a))}));return ha(...i)}))}});function oR(e){return e.canBeEmpty()}function rR(e,t,n=oR){return ha(e.registerCommand(_m,o=>{let r=He();if(!Me(r))return!1;o.preventDefault();let a=(function(i){if(i.getNodes().filter(p=>od(p)&&p.canIndent()).length>0)return!0;let s=i.anchor,l=i.focus,d=l.isBefore(s)?l:s,c=d.getNode(),f=_E(c);if(f.canIndent()){let p=f.getKey(),m=Ds();if(m.anchor.set(p,0,"element"),m.focus.set(p,0,"element"),m=dA(m),m.anchor.is(d))return!0}return!1})(r)?o.shiftKey?FA:ax:EA;return e.dispatchCommand(a,void 0)},rn),e.registerCommand(ax,()=>{let o=typeof t=="number"?t:t?t.peek():null,r=He();if(!Me(r))return!1;let a=typeof n=="function"?n:n.peek();return DE(i=>{if(a(i)){let s=i.getIndent()+1;(!o||s<o)&&i.setIndent(s)}})},km))}var oV=Dn({build:(e,t,n)=>Jm(t),config:$r({$canIndent:oR,disabled:!1,maxIndent:null}),name:"@lexical/extension/TabIndentation",register(e,t,n){let{disabled:o,maxIndent:r,$canIndent:a}=n.getOutput();return Fi(()=>{if(!o.value)return rR(e,r,a)})}});var Tt=Bx,Kle=Tt.$createHorizontalRuleNode,Vle=Tt.$isDecoratorTextNode,qle=Tt.$isHorizontalRuleNode,Wle=Tt.AutoFocusExtension,Gle=Tt.ClearEditorExtension,jle=Tt.DecoratorTextExtension,Qle=Tt.DecoratorTextNode,Xle=Tt.EditorStateExtension,Yle=Tt.HorizontalRuleExtension,Jle=Tt.HorizontalRuleNode,Zle=Tt.INSERT_HORIZONTAL_RULE_COMMAND,ede=Tt.InitialStateExtension,aR=Tt.LexicalBuilder,tde=Tt.NodeSelectionExtension,nde=Tt.TabIndentationExtension,ode=Tt.applyFormatFromStyle,rde=Tt.applyFormatToDom,iR=Tt.batch,ade=Tt.buildEditorFromExtensions,ide=Tt.computed,sde=Tt.configExtension,lde=Tt.declarePeerDependency,dde=Tt.defineExtension,Cu=Tt.effect,cde=Tt.getExtensionDependencyFromEditor,ude=Tt.getKnownTypesAndNodes,sR=Tt.getPeerDependencyFromEditor,fde=Tt.getPeerDependencyFromEditorOrThrow,Zm=Tt.namedSignals,pde=Tt.registerClearEditor,mde=Tt.registerTabIndentation,gde=Tt.safeCast,hde=Tt.shallowMergeConfig,vde=Tt.signal,yde=Tt.untracked,xde=Tt.watchedSignal;var zx={};_n(zx,{HistoryExtension:()=>eg,SharedHistoryExtension:()=>iV,createEmptyHistoryState:()=>cR,registerHistory:()=>dR});function rV(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(!(Me(a)&&Me(i)&&i.isCollapsed()&&a.isCollapsed()))return 0;let s=(function(y,x,C){let w=y._nodeMap,L=[];for(let S of x){let T=w.get(S);T!==void 0&&L.push(T)}for(let[S,T]of C){if(!T)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 aV(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(xA)&&(r=n,a=o,i=s),p.has(Am))return o=0,n=m,2;p.has(yA)&&i&&(n=r,o=a,s=i);let g=rV(s,l,c,f,e.isComposing()),h=(()=>{let v=d===null||d.editor===e,y=p.has(PA);if(!y&&v&&p.has(Hr))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 T=L._nodeMap.get(w),I=S._nodeMap.get(w),k=L._selection,E=S._selection;return!(Me(k)&&Me(E)&&k.anchor.type==="element"&&k.focus.type==="element"&&E.anchor.type==="text"&&E.focus.type==="text"||!dt(T)||!dt(I)||T.__parent!==I.__parent)&&JSON.stringify(L.read(()=>T.exportJSON()))===JSON.stringify(S.read(()=>I.exportJSON()))})(Array.from(c)[0],s,l)?0:1})();return n=m,o=g,h}}function lR(e){e.undoStack=[],e.redoStack=[],e.current=null}function dR(e,t,n){let o=aV(e,n);return Va(e.registerCommand(GA,()=>((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:Am})}})(e,t),!0),rn),e.registerCommand(UA,()=>((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:Am})}})(e,t),!0),rn),e.registerCommand(Tm,()=>(lR(t),!1),rn),e.registerCommand(hA,()=>(lR(t),e.dispatchCommand(uu,!1),e.dispatchCommand(fu,!1),!0),rn),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 cR(){return{current:null,redoStack:[],undoStack:[]}}var eg=Dn({build:(e,{delay:t,createInitialHistoryState:n,disabled:o})=>Zm({delay:t,disabled:o,historyState:n(e)}),config:$r({createInitialHistoryState:cR,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:dR(e,o.historyState.value,o.delay))}}),iV=Dn({dependencies:[Fm(eg,{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(eg),r=(function(i){return i?sR(i,eg.name):null})(e._parentEditor);if(!r)return()=>{};let a=r.output;return Cu(()=>iR(()=>{o.delay.value=a.delay.value,o.historyState.value=a.historyState.value,o.disabled.value=a.disabled.value}))}});var tg=zx,Ide=tg.HistoryExtension,Tde=tg.SharedHistoryExtension,ng=tg.createEmptyHistoryState,uR=tg.registerHistory;var Ux={};_n(Ux,{HistoryPlugin:()=>sV,createEmptyHistoryState:()=>ng});pe();function sV({delay:e,externalHistoryState:t}){let[n]=wn();return(function(o,r,a=1e3){let i=V(()=>r||ng(),[r]);G(()=>uR(o,i,a),[a,o,i])})(n,t,e),null}var fR=Ux,pR=fR.HistoryPlugin,mR=fR.createEmptyHistoryState;var cd=new Map,lV=32;function gR(e,t){for(cd.delete(e),cd.set(e,t);cd.size>lV;){let n=cd.keys().next().value;if(n===void 0)break;cd.delete(n)}}function dV(e){return{anchor:e.length,focus:e.length}}function qa(e,t,n){let o=cd.get(e);if(o)return gR(e,o),o;let r={cursor:n?.cursor??t.length,expandedCursor:n?.expandedCursor??t.length,selection:n?{anchor:n.cursor,focus:n.cursor}:dV(t),history:mR()};return gR(e,r),r}function ud(e,t,n){let o=qa(e,t);o.cursor=n.cursor,o.expandedCursor=n.expandedCursor,o.selection=n.selection}function hR(e,t,n,o){let r=qa(e,t);r.cursor=n,r.expandedCursor=o}function vR(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={};_n(Hx,{LexicalComposer:()=>uV});pe();var yR=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,cV=yR?he:G,og={tag:Hr};function uV({initialConfig:e,children:t}){let n=V(()=>{let{theme:o,namespace:r,nodes:a,onError:i,editorState:s,html:l}=e,d=xk(null,o),c=Bm({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=fr();m.append(g);let h=yR?document.activeElement:null;(He()!==null||h!==null&&h===f.getRootElement())&&g.select()}},og);else if(p!==null)switch(typeof p){case"string":{let m=f.parseEditorState(p);f.setEditorState(m,og);break}case"object":f.setEditorState(p,og);break;case"function":f.update(()=>{At().isEmpty()&&p(f)},og)}}})(c,s),[c,d]},[]);return cV(()=>{let o=e.editable,[r]=n;r.setEditable(o===void 0||o)},[]),u(yk.Provider,{value:n,children:t})}var fV=Hx,xR=fV.LexicalComposer;var Kx={};_n(Kx,{$canShowPlaceholder:()=>bR,$canShowPlaceholderCurry:()=>mV,$findTextIntersectionFromCharacters:()=>gV,$isRootTextContentEmpty:()=>$x,$isRootTextContentEmptyCurry:()=>pV,$rootTextContent:()=>CR,registerLexicalTextEntity:()=>vV});function CR(){return At().getTextContent()}function $x(e,t=!0){if(e)return!1;let n=CR();return t&&(n=n.trim()),n===""}function pV(e,t){return()=>$x(e,t)}function bR(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(bm(r))return!1;if(Qe(r)){if(!iA(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 mV(e){return()=>bR(e)}function gV(e,t){let n=e.getFirstChild(),o=0;e:for(;n!==null;){if(Qe(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 hV(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 vV(e,t,n,o){let r=i=>i instanceof n,a=i=>{let s=zr(i.getTextContent());s.setFormat(i.getFormat()),i.replace(s)};return[e.registerNodeTransform(Om,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&&hV(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=Kx,Ude=Us.$canShowPlaceholder,rg=Us.$canShowPlaceholderCurry,Hde=Us.$findTextIntersectionFromCharacters,$de=Us.$isRootTextContentEmpty,Kde=Us.$isRootTextContentEmptyCurry,Vde=Us.$rootTextContent,qde=Us.registerLexicalTextEntity;var Vx={};_n(Vx,{ContentEditable:()=>xV,ContentEditableElement:()=>IR});pe();var SR=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?he:G;function yV({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[T,I]=J(e.isEditable()),k=R(P=>{P&&P.ownerDocument&&P.ownerDocument.defaultView?e.setRootElement(P):e.setRootElement(null)},[e]),E=V(()=>(function(...P){return _=>{for(let A of P)typeof A=="function"?A(_):A!=null&&(A.current=_)}})(S,k),[k,S]);return SR(()=>(I(e.isEditable()),e.registerEditableListener(P=>{I(P)})),[e]),u("div",{"aria-activedescendant":T?t:void 0,"aria-autocomplete":T?n:"none","aria-controls":T?o:void 0,"aria-describedby":r,...a!=null?{"aria-errormessage":a}:{},"aria-expanded":T&&v==="combobox"?!!i:void 0,...s!=null?{"aria-invalid":s}:{},"aria-label":l,"aria-labelledby":d,"aria-multiline":c,"aria-owns":T?f:void 0,"aria-readonly":!T||void 0,"aria-required":p,autoCapitalize:m,className:g,contentEditable:T,"data-testid":w,id:h,ref:E,role:v,spellCheck:y,style:x,tabIndex:C,...L})}var IR=$n(yV);function wR(e){return e.getEditorState().read(rg(e.isComposing()))}var xV=$n(CV);function CV(e,t){let{placeholder:n,...o}=e,[r]=wn();return b(Te,{children:[u(IR,{editor:r,...o,ref:t}),n!=null&&u(bV,{editor:r,content:n})]})}function bV({content:e,editor:t}){let n=(function(i){let[s,l]=J(()=>wR(i));return SR(()=>{function d(){let c=wR(i);l(c)}return d(),Va(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 TR=Vx,kR=TR.ContentEditable,Jde=TR.ContentEditableElement;pe();var wV=wt(null),qx={didCatch:!1,error:null},ag=class extends ka{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&&SV(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=Ne(o,l);else if(r!==void 0)s=r;else throw i}return Ne(wV.Provider,{value:{didCatch:a,error:i,resetErrorBoundary:this.resetErrorBoundary}},s)}};function SV(e=[],t=[]){return e.length!==t.length||e.some((n,o)=>!Object.is(n,t[o]))}var Wx={};_n(Wx,{LexicalErrorBoundary:()=>IV});function IV({children:e,onError:t}){return u(ag,{fallback:u("div",{style:{border:"1px solid #f00",color:"#f00",padding:"8px"},children:"An error was thrown."}),onError:t,children:e})}var TV=Wx,LR=TV.LexicalErrorBoundary;var Gx={};_n(Gx,{OnChangePlugin:()=>LV});pe();var kV=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?he:G;function LV({ignoreHistoryMergeTagChange:e=!0,ignoreSelectionChange:t=!1,onChange:n}){let[o]=wn();return kV(()=>{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(Hr)||s.isEmpty()||n(r,o,l)})},[o,e,t,n]),null}var PV=Gx,PR=PV.OnChangePlugin;var jx={};_n(jx,{useLexicalEditable:()=>RV});pe();var AV=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?he:G;function EV(e){return{initialValueFn:()=>e.isEditable(),subscribe:t=>e.registerEditableListener(t)}}function RV(){return(function(e){let[t]=wn(),n=V(()=>e(t),[t,e]),[o,r]=J(()=>n.initialValueFn()),a=N(o);return AV(()=>{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})(EV)}var MV=jx,AR=MV.useLexicalEditable;var Qx={};_n(Qx,{ReactProviderExtension:()=>NV});var NV=Dn({name:"@lexical/react/ReactProvider"});var _V=Qx,ER=_V.ReactProviderExtension;var Xx={};_n(Xx,{DragonExtension:()=>DV,registerDragonSupport:()=>RR});function RR(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=He();if(Me(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 DV=Dn({build:(e,t,n)=>Zm(t),config:$r({disabled:typeof window>"u"}),name:"@lexical/dragon",register:(e,t,n)=>Cu(()=>n.getOutput().disabled.value?void 0:RR(e))});var MR=Xx,NR=MR.DragonExtension,_R=MR.registerDragonSupport;var Yx={};_n(Yx,{$generateHtmlFromNodes:()=>FV,$generateNodesFromDOM:()=>OV});function OV(e,t){let n=eE(t)?t.body.childNodes:t.childNodes,o=[],r=[];for(let a of n)if(!OR.has(a.nodeName)){let i=FR(a,e,r,!1);i!==null&&(o=o.concat(i))}return(function(a){for(let i of a)i.getNextSibling()instanceof rx&&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 FV(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++)DR(e,o[r],n,t);return n.innerHTML}function DR(e,t,n,o=null){let r=o===null||t.isSelected(o),a=Qe(t)&&t.excludeFromCopy("html"),i=t;o!==null&&dt(t)&&(i=qm(o,t,"clone"));let s=Qe(i)?i.getChildren():[],l=JA(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=DR(e,g,p,o);!r&&Qe(t)&&h&&t.extractWithChild(g,o,"html")&&(r=!0)}if(r&&!a){if((OE(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 OR=new Set(["STYLE","SCRIPT"]);function FR(e,t,n,o,r=new Map,a){let i=[];if(OR.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&&od(s)||o);for(let g=0;g<f.length;g++)p.push(...FR(f[g],t,n,m,new Map(r),s));return c!=null&&(p=c(p)),Sx(e)&&(p=BV(e,p,m?()=>{let g=new rx;return n.push(g),g}:fr)),s==null?p.length>0?i=i.concat(p):Sx(e)&&(function(g){return g.nextSibling==null||g.previousSibling==null?!1:gu(g.nextSibling)&&gu(g.previousSibling)})(e)&&(i=i.concat(_s())):Qe(s)&&s.append(...p),i}function BV(e,t,n){let o=e.style.textAlign,r=[],a=[];for(let i=0;i<t.length;i++){let s=t[i];if(od(s))o&&!s.getFormat()&&s.setFormat(o),r.push(s);else if(a.push(s),i===t.length-1||i<t.length-1&&od(t[i+1])){let l=n();l.setFormat(o),l.append(...a),r.push(l),a=[]}}return r}var BR=Yx,zR=BR.$generateHtmlFromNodes,UR=BR.$generateNodesFromDOM;var Zx={};_n(Zx,{$generateJSONFromSelectedNodes:()=>qR,$generateNodesFromSerializedNodes:()=>WR,$getClipboardDataFromSelection:()=>jR,$getHtmlContent:()=>$R,$getLexicalContent:()=>KR,$insertDataTransferForPlainText:()=>zV,$insertDataTransferForRichText:()=>UV,$insertGeneratedNodes:()=>Jx,copyToClipboard:()=>HV,setLexicalClipboardDataTransfer:()=>QR});function ig(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 $R(e,t=He()){return t==null&&ig(166),Me(t)&&t.isCollapsed()||t.getNodes().length===0?"":zR(e,t)}function KR(e,t=He()){return t==null&&ig(166),Me(t)&&t.isCollapsed()||t.getNodes().length===0?null:JSON.stringify(qR(e,t))}function zV(e,t){let n=e.getData("text/plain")||e.getData("text/uri-list");n!=null&&t.insertRawText(n)}function UV(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,WR(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,UR(n,s),t)}catch(s){console.error(s)}let i=a||e.getData("text/uri-list");if(i!=null)if(Me(t)){let s=i.split(/(\r?\n|\t)/);s[s.length-1]===""&&s.pop();for(let l=0;l<s.length;l++){let d=He();if(Me(d)){let c=s[l];c===`
|
|
3777
|
+
`);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=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=du(),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 GK(e){let t=e.getStyle(),n=dE(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=cE(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)}fE(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 fE(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 GP(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&&pE(t)}function pE(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 mE(e,t){let n=e.getFormatType(),o=e.getIndent();n!==t.getFormatType()&&t.setFormat(n),o!==t.getIndent()&&t.setIndent(o)}function QK(e,t,n=mE){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())&&Br(a)}function lE(e){return e.getNode().isAttached()}function XK(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 YK(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)?(cx(e,l,l.length,t,n),l=[],s=c):s===null||s!==null&&rA(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(),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&&sA(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))}),XK(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(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)&&lE(m.anchor)&&lE(m.focus)?Br(m.clone()):p!==null?p.selectEnd():e.dirty=!0}function gE(e){let t=hE(e);return t!==null&&t.writingMode==="vertical-rl"}function hE(e){let t=e.anchor.getNode();return je(t)?fx(t):px(t)}function JK(e,t){let n=gE(e)?!t:t;mx(e)&&(n=!n);let o=rd(e.focus,n?"previous":"next");if(iA(o))return!1;for(let r of ZP(o)){if(cu(r))return!r.origin.isInline();if(!je(r.origin)){if(wm(r.origin))return!0;break}}return!1}function vE(e,t,n,o){e.modify(t?"extend":"move",n,o)}function mx(e){let t=hE(e);return t!==null&&t.direction==="rtl"}function ZK(e,t,n){let o=mx(e),r;r=gE(e)||o?!n:n,vE(e,t,r,"character")}function e3(e,t,n){let o=qm(e.getStyle());return o!==null&&o[t]||n}function t3(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=e3(f,t,n);if(o===null)o=p;else if(o!==p){o="";break}}}return o===null?n:o}var n3=uE;var pn=gx,yE=pn.$addNodeStyle,Mse=pn.$cloneWithProperties,Nse=pn.$copyBlockFormatIndent,_se=pn.$ensureForwardRangeSelection,Dse=pn.$forEachSelectedTextNode,Ose=pn.$getComputedStyleForElement,Fse=pn.$getComputedStyleForParent,Bse=pn.$getSelectionStyleValueForProperty,zse=pn.$isAtNodeEnd,Use=pn.$isParentElementRTL,Hse=pn.$isParentRTL,$se=pn.$moveCaretSelection,hx=pn.$moveCharacter,Kse=pn.$patchStyleText,Vse=pn.$selectAll,qse=pn.$setBlocksType,vx=pn.$shouldOverrideDefaultCharacterSelection,Wm=pn.$sliceSelectedTextNodeContent,Wse=pn.$trimTextContentFromAnchor,Gse=pn.$wrapNodes,jse=pn.createDOMRange,xE=pn.createRectsFromDOMRange,Qse=pn.getCSSFromStyleObject,Xse=pn.getStyleObjectFromCSS,Yse=pn.trimTextContentFromAnchor;var bx={};En(bx,{$descendantsMatching:()=>z3,$dfs:()=>b3,$dfsIterator:()=>AE,$filter:()=>N3,$findMatchingParent:()=>Ba,$firstToLastIterator:()=>U3,$getAdjacentCaret:()=>w3,$getAdjacentSiblingOrParentSiblingCaret:()=>Bs,$getDepth:()=>RE,$getNearestBlockElementAncestorOrThrow:()=>L3,$getNearestNodeOfType:()=>k3,$getNextRightPreorderNode:()=>T3,$getNextSiblingOrParentSibling:()=>I3,$handleIndentAndOutdent:()=>_3,$insertFirst:()=>D3,$insertNodeToNearestRoot:()=>E3,$insertNodeToNearestRootAtCaret:()=>NE,$isEditorIsNestedEditor:()=>F3,$lastToFirstIterator:()=>Cx,$restoreEditorState:()=>A3,$reverseDfs:()=>S3,$reverseDfsIterator:()=>ME,$splitNode:()=>hA,$unwrapAndFilterDescendants:()=>B3,$unwrapNode:()=>H3,$wrapNodeInElement:()=>R3,CAN_USE_BEFORE_INPUT:()=>f3,CAN_USE_DOM:()=>kE,IS_ANDROID:()=>p3,IS_ANDROID_CHROME:()=>m3,IS_APPLE:()=>g3,IS_APPLE_WEBKIT:()=>h3,IS_CHROME:()=>v3,IS_FIREFOX:()=>LE,IS_IOS:()=>y3,IS_SAFARI:()=>x3,addClassNamesToElement:()=>gu,calculateZoomLevel:()=>O3,isBlockDomNode:()=>tE,isHTMLAnchorElement:()=>rE,isHTMLElement:()=>Um,isInlineDomNode:()=>hu,isMimeType:()=>PE,makeStateWrapper:()=>$3,markSelection:()=>TE,mediaFileReader:()=>C3,mergeRegister:()=>ua,objectKlassEquals:()=>M3,positionNodeOnRange:()=>IE,registerNestedElementResolver:()=>P3,removeClassNamesFromElement:()=>Hm,selectionAlwaysOnDisplay:()=>u3});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 Hr=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,o3=Hr&&"documentMode"in document?document.documentMode:null,wE=Hr&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),r3=Hr&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),a3=!(!Hr||!("InputEvent"in window)||o3)&&"getTargetRanges"in new window.InputEvent("input"),i3=Hr&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),s3=Hr&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,SE=Hr&&/Android/.test(navigator.userAgent),xx=Hr&&/^(?=.*Chrome).*/i.test(navigator.userAgent),l3=Hr&&SE&&xx,d3=Hr&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&wE&&!xx;function fa(e){return`${e}px`}var c3={attributes:!0,characterData:!0,childList:!0,subtree:!0};function IE(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=xE(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 T=fa(x.width);w.width!==T&&(C.style.width=T,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,c3),l()});return()=>{c(),d()}}function CE(e,t,n){if(e.type!=="text"&&je(t)){let o=t.getDOMSlot(n);return[o.element,o.getFirstChildOffset()+e.offset]}return[ZA(n)||n,e.offset]}function TE(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 k=I.getStartEndPoints();return I.isBackward()?[k[1],k[0]]:k})(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(),T=a===null||L!==i||C!==s||x!==a.getKey();if((S||T)&&w!==null&&L!==null){let I=(function(k,E,P,_,A,F,B){let V=(k._window?k._window.document:document).createRange();return V.setStart(...CE(E,P,_)),V.setEnd(...CE(A,F,B)),V})(e,p,g,w,m,y,L);l(),l=IE(e,I,k=>{if(t===void 0)for(let E of k){let P=E.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(k)})}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 u3(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=TE(e,t))};return document.addEventListener("selectionchange",o),()=>{n!==null&&n(),document.removeEventListener("selectionchange",o)}}var f3=a3,kE=Hr,p3=SE,m3=l3,g3=wE,h3=d3,v3=xx,LE=r3,y3=s3,x3=i3;function PE(e,t){for(let n of t)if(e.type.startsWith(n))return!0;return!1}function C3(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()}),PE(l,t)?d.readAsDataURL(l):i()};i()})}function b3(e,t){return Array.from(AE(e,t))}function w3(e){return e?e.getAdjacentCaret():null}function S3(e,t){return Array.from(ME(e,t))}function AE(e,t){return EE("next",e,t)}function bE(e,t){let n=Bs(za(e,t));return n&&n[0]}function EE(e,t,n){let o=At(),r=t||o,a=je(r)?_i(r,e):za(r,e),i=RE(r),s=n?Jy(ex(za(n,e)))||bE(n,e):bE(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;cu(d)&&l++;let c=Bs(d);return!c||c[0].isSameNodeCaret(s)?null:(l+=c[1],c[0])}})}function I3(e){let t=Bs(za(e,"next"));return t&&[t[0].origin,t[1]]}function RE(e){let t=-1;for(let n=e;n!==null;n=n.getParent())t++;return t}function T3(e){let t=ex(za(e,"previous")),n=Bs(t,"root");return n&&n[0].origin}function ME(e,t){return EE("previous",e,t)}function k3(e,t){let n=e;for(;n!=null;){if(n instanceof t)return n;n=n.getParent()}return null}function L3(e){let t=Ba(e,n=>je(n)&&!n.isInline());return je(t)||Gm(4,e.__key),t}function P3(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 A3(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 E3(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=NE(e,n),r=Jy(o),a=cu(r)?cA(r):o;return mA(nA(a)),e.getLatest()}function NE(e,t,n){let o=Zy(t,"next");for(let r=o;r;r=gA(r,n))o=r;return Sm(o)&&Gm(283),o.insert(e.isInline()?hr().append(e):e),Zy(za(e.getLatest(),"next"),t.direction)}function R3(e,t){let n=t();return e.replace(n),n.append(e),n}function M3(e,t){return e!==null&&Object.getPrototypeOf(e).constructor.name===t.name}function N3(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 _3(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 D3(e,t){_i(e,"next").insert(t)}var yx=!(LE||!kE)&&void 0;function O3(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 F3(e){return e._parentEditor!==null}function B3(e,t){return _E(e,t,null)}function _E(e,t,n){let o=!1;for(let r of Cx(e))t(r)?n!==null&&n(r):(o=!0,je(r)&&_E(r,t,n||(a=>r.insertAfter(a))),r.remove());return o}function z3(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 U3(e){return DE(_i(e,"next"))}function Cx(e){return DE(_i(e,"previous"))}function DE(e){return lx({hasNext:dA,initial:e.getAdjacentCaret(),map:t=>t.origin.getLatest(),step:t=>t.getAdjacentCaret()})}function H3(e){pA(za(e,"next")).splice(1,e.getChildren())}function $3(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,nle=Qe.$descendantsMatching,ole=Qe.$dfs,rle=Qe.$dfsIterator,ale=Qe.$filter,ile=Qe.$findMatchingParent,sle=Qe.$firstToLastIterator,lle=Qe.$getAdjacentCaret,dle=Qe.$getAdjacentSiblingOrParentSiblingCaret,cle=Qe.$getDepth,OE=Qe.$getNearestBlockElementAncestorOrThrow,ule=Qe.$getNearestNodeOfType,fle=Qe.$getNextRightPreorderNode,ple=Qe.$getNextSiblingOrParentSibling,FE=Qe.$handleIndentAndOutdent,mle=Qe.$insertFirst,gle=Qe.$insertNodeToNearestRoot,hle=Qe.$insertNodeToNearestRootAtCaret,vle=Qe.$isEditorIsNestedEditor,yle=Qe.$lastToFirstIterator,xle=Qe.$restoreEditorState,Cle=Qe.$reverseDfs,ble=Qe.$reverseDfsIterator,wle=Qe.$splitNode,Sle=Qe.$unwrapAndFilterDescendants,Ile=Qe.$unwrapNode,Tle=Qe.$wrapNodeInElement,kle=Qe.CAN_USE_BEFORE_INPUT,Lle=Qe.CAN_USE_DOM,Ple=Qe.IS_ANDROID,Ale=Qe.IS_ANDROID_CHROME,Ele=Qe.IS_APPLE,Rle=Qe.IS_APPLE_WEBKIT,Mle=Qe.IS_CHROME,Nle=Qe.IS_FIREFOX,_le=Qe.IS_IOS,Dle=Qe.IS_SAFARI,Ole=Qe.addClassNamesToElement,Fle=Qe.calculateZoomLevel,wx=Qe.isBlockDomNode,Ble=Qe.isHTMLAnchorElement,BE=Qe.isHTMLElement,zle=Qe.isInlineDomNode,Ule=Qe.isMimeType,Hle=Qe.makeStateWrapper,$le=Qe.markSelection,Kle=Qe.mediaFileReader,Ha=Qe.mergeRegister,vu=Qe.objectKlassEquals,Vle=Qe.positionNodeOnRange,qle=Qe.registerNestedElementResolver,Wle=Qe.removeClassNamesFromElement,Gle=Qe.selectionAlwaysOnDisplay;var Fx={};En(Fx,{$createHorizontalRuleNode:()=>Ox,$isDecoratorTextNode:()=>JE,$isHorizontalRuleNode:()=>rR,AutoFocusExtension:()=>q3,ClearEditorExtension:()=>W3,DecoratorTextExtension:()=>J3,DecoratorTextNode:()=>Cu,EditorStateExtension:()=>Ym,HorizontalRuleExtension:()=>dV,HorizontalRuleNode:()=>Hs,INSERT_HORIZONTAL_RULE_COMMAND:()=>sV,InitialStateExtension:()=>nR,LexicalBuilder:()=>ud,NodeSelectionExtension:()=>Mx,TabIndentationExtension:()=>cV,applyFormatFromStyle:()=>j3,applyFormatToDom:()=>Q3,batch:()=>VE,buildEditorFromExtensions:()=>nV,computed:()=>GE,configExtension:()=>Bm,declarePeerDependency:()=>JA,defineExtension:()=>Rn,effect:()=>Oi,getExtensionDependencyFromEditor:()=>rV,getKnownTypesAndNodes:()=>G3,getPeerDependencyFromEditor:()=>oR,getPeerDependencyFromEditorOrThrow:()=>aV,namedSignals:()=>Zm,registerClearEditor:()=>XE,registerTabIndentation:()=>iR,safeCast:()=>Ur,shallowMergeConfig:()=>$m,signal:()=>cd,untracked:()=>Px,watchedSignal:()=>_x});var K3=Symbol.for("preact-signals");function Jm(){if(Di>1)return void Di--;let e,t=!1;for(;xu!==void 0;){let n=xu;for(xu=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,Di--,t)throw e}function VE(e){if(Di>0)return e();Di++;try{return e()}finally{Jm()}}var Kt,xu;function Px(e){let t=Kt;Kt=void 0;try{return e()}finally{Kt=t}}var Di=0,Ax=0,Xm=0;function zE(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 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 UE(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 WE(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=Xm-1,this.f=4,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}function GE(e,t){return new Us(e,t)}function jE(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,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 V3(e){if(Kt!==this)throw new Error("Out-of-order effect");WE(this),Kt=e,this.f&=-2,8&this.f&&Nx(this),Jm()}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 Zm(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=K3,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 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=zE(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++,Di++;try{for(let t=this.t;t!==void 0;t=t.x)t.t.N()}finally{Jm()}}}}),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===Xm))return!0;if(this.g=Xm,this.f|=1,this.i>0&&!qE(this))return this.f&=-2,!0;let e=Kt;try{UE(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,WE(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=zE(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,jE(this),UE(this),Di++;let e=Kt;return Kt=this,V3.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||Nx(this)},dd.prototype.dispose=function(){this.d()};var q3=Rn({build:(e,t,n)=>Zm(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 QE(){let e=At(),t=Ke(),n=hr();e.clear(),e.append(n),t!==null&&n.select(),Ne(t)&&(t.format=0)}function XE(e,t=QE){return e.registerCommand(km,n=>(e.update(t),!0),nn)}var W3=Rn({build:(e,t,n)=>Zm(t),config:Ur({$onClear:QE}),name:"@lexical/extension/ClearEditor",register(e,t,n){let{$onClear:o}=n.getOutput();return Oi(()=>XE(e,o.value))}});function G3(e){let t=new Set,n=new Set;for(let o of YE(e)){let r=typeof o=="function"?o:o.replace;t.add(r.getType()),n.add(r)}return{nodes:n,types:t}}function YE(e){return(typeof e.nodes=="function"?e.nodes():e.nodes)||[]}var Sx=YA("format",{parse:e=>typeof e=="number"?e:0}),Cu=class extends Ua{$config(){return this.config("decorator-text",{extends:Ua,stateConfigs:[{flat:!0,stateConfig:Sx}]})}getFormat(){return bm(this,Sx)}getFormatFlags(t,n){return dx(this.getFormat(),t,n)}hasFormat(t){let n=GA[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 JE(e){return e instanceof Cu}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 Q3(e,t,n=Y3){for(let[o,r]of Object.entries(n))e.hasFormat(r)&&(t=X3(t,o));return t}function X3(e,t){let n=document.createElement(t);return n.appendChild(e),n}var Y3={b:"bold",code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"},J3=Rn({name:"@lexical/extension/DecoratorText",nodes:()=>[Cu],register:(e,t,n)=>e.registerCommand(AA,o=>{let r=Ke();if(tx(r)||Ne(r))for(let a of r.getNodes())JE(a)&&a.toggleFormat(o);return!1},sd)});function _x(e,t){let n;return cd(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 ZE(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]=ZE(n[r],o[r]);return e}return t}var Dx=0,Ex=1,eR=2,Ix=3,jm=4,ld=5,Tx=6,yu=7;function kx(e){return e.id===Dx}function tR(e){return e.id===eR}function Z3(e){return(function(t){return t.id===Ex})(e)||Gt(305,String(e.id),String(Ex)),Object.assign(e,{id:eR})}var eV=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;tR(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(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:Tx})})(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!==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: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>=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>=yu})(t)||Gt(316,String(t.id),String(yu)),t}getDirectDependentNames(){return this.builder.incomingEdges.get(this.extension.name)||eV}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}},HE={tag:zr};function tV(){let e=At();e.isEmpty()&&e.append(hr())}var nR=Rn({config:Ur({setOptions:HE,updateOptions:HE}),init:({$initialEditorState:e=tV})=>({$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(aA(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:[VA,Fm,BA,jA,HA]}),$E=Symbol.for("@lexical/extension/LexicalBuilder");function nV(...e){return ud.fromExtensions(e).buildEditor()}function KE(){}function oV(e){throw e}function Qm(e){return Array.isArray(e)?e:[e]}var Lx="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=Lx,this.roots=t;for(let n of t)this.addExtension(n)}static fromExtensions(t){let n=[Qm(nR)];for(let o of t)n.push(Qm(o));return new e(n)}static maybeFromEditor(t){let n=t[$E];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)}}:{}}),{[$E]:this});for(let a of this.sortedExtensionReps())a.build(r);return r}buildEditor(){let t=KE;function n(){try{t()}finally{t=KE}}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(tR(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=Z3(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 YE(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&&ZE(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=oV),t}};function rV(e,t){let n=ud.fromEditor(e).getExtensionRep(t);return n===void 0&&Gt(303,t.name),n.getExtensionDependency()}function oR(e,t){let n=ud.fromEditor(e).extensionNameMap.get(t);return n?n.getExtensionDependency():void 0}function aV(e,t){let n=oR(e,t);return n===void 0&&Gt(291,t),n}var iV=new Set,Mx=Rn({build(e,t,n){let o=n.getDependency(Ym).output,r=cd({watchedNodeKeys:new Map}),a=_x(()=>{},()=>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=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=GE(()=>(a.value||iV).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"}),sV=XA("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 Ox().updateFromJSON(t)}static importDOM(){return{hr:()=>({conversion:lV,priority:0})}}exportDOM(){return{element:document.createElement("hr")}}createDOM(t){let n=document.createElement("hr");return gu(n,t.theme.hr),n}getTextContent(){return`
|
|
3778
|
+
`}isInline(){return!1}updateDOM(){return!1}};function lV(){return{node:Ox()}}function Ox(){return QP(Hs)}function rR(e){return e instanceof Hs}var dV=Rn({dependencies:[Ym,Mx],name:"@lexical/extension/HorizontalRule",nodes:()=>[Hs],register(e,t,n){let{watchNodeKey:o}=n.getDependency(Mx).output,r=cd({nodeSelections:new Map}),a=e._config.theme.hrSelected??"selected";return ua(e.registerCommand(xA,i=>{if(oE(i.target)){let s=oA(i.target);if(rR(s))return(function(l,d=!1){let c=Ke(),f=l.isSelected(),p=l.getKey(),m;d&&tx(c)?m=c:(m=XP(),Br(m)),f?m.delete(p):m.add(p)})(s,i.shiftKey),!0}return!1},sd),e.registerMutationListener(Hs,(i,s)=>{VE(()=>{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):Hm(d,a))}));return ua(...i)}))}});function aR(e){return e.canBeEmpty()}function iR(e,t,n=aR){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=>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=OE(c);if(f.canIndent()){let p=f.getKey(),m=Fs();if(m.anchor.set(p,0,"element"),m.focus.set(p,0,"element"),m=uA(m),m.anchor.is(d))return!0}return!1})(r)?o.shiftKey?zA:rx:MA;return e.dispatchCommand(a,void 0)},nn),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 FE(i=>{if(a(i)){let s=i.getIndent()+1;(!o||s<o)&&i.setIndent(s)}})},Lm))}var cV=Rn({build:(e,t,n)=>Zm(t),config:Ur({$canIndent:aR,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 iR(e,r,a)})}});var kt=Fx,Jle=kt.$createHorizontalRuleNode,Zle=kt.$isDecoratorTextNode,ede=kt.$isHorizontalRuleNode,tde=kt.AutoFocusExtension,nde=kt.ClearEditorExtension,ode=kt.DecoratorTextExtension,rde=kt.DecoratorTextNode,ade=kt.EditorStateExtension,ide=kt.HorizontalRuleExtension,sde=kt.HorizontalRuleNode,lde=kt.INSERT_HORIZONTAL_RULE_COMMAND,dde=kt.InitialStateExtension,sR=kt.LexicalBuilder,cde=kt.NodeSelectionExtension,ude=kt.TabIndentationExtension,fde=kt.applyFormatFromStyle,pde=kt.applyFormatToDom,lR=kt.batch,mde=kt.buildEditorFromExtensions,gde=kt.computed,hde=kt.configExtension,vde=kt.declarePeerDependency,yde=kt.defineExtension,bu=kt.effect,xde=kt.getExtensionDependencyFromEditor,Cde=kt.getKnownTypesAndNodes,dR=kt.getPeerDependencyFromEditor,bde=kt.getPeerDependencyFromEditorOrThrow,eg=kt.namedSignals,wde=kt.registerClearEditor,Sde=kt.registerTabIndentation,Ide=kt.safeCast,Tde=kt.shallowMergeConfig,kde=kt.signal,Lde=kt.untracked,Pde=kt.watchedSignal;var Bx={};En(Bx,{HistoryExtension:()=>tg,SharedHistoryExtension:()=>pV,createEmptyHistoryState:()=>fR,registerHistory:()=>uR});function uV(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 T=w.get(S);T!==void 0&&L.push(T)}for(let[S,T]of C){if(!T)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 fV(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(bA)&&(r=n,a=o,i=s),p.has(Em))return o=0,n=m,2;p.has(CA)&&i&&(n=r,o=a,s=i);let g=uV(s,l,c,f,e.isComposing()),h=(()=>{let v=d===null||d.editor===e,y=p.has(EA);if(!y&&v&&p.has(zr))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 T=L._nodeMap.get(w),I=S._nodeMap.get(w),k=L._selection,E=S._selection;return!(Ne(k)&&Ne(E)&&k.anchor.type==="element"&&k.focus.type==="element"&&E.anchor.type==="text"&&E.focus.type==="text"||!dt(T)||!dt(I)||T.__parent!==I.__parent)&&JSON.stringify(L.read(()=>T.exportJSON()))===JSON.stringify(S.read(()=>I.exportJSON()))})(Array.from(c)[0],s,l)?0:1})();return n=m,o=g,h}}function cR(e){e.undoStack=[],e.redoStack=[],e.current=null}function uR(e,t,n){let o=fV(e,n);return Ha(e.registerCommand(QA,()=>((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:Em})}})(e,t),!0),nn),e.registerCommand($A,()=>((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:Em})}})(e,t),!0),nn),e.registerCommand(km,()=>(cR(t),!1),nn),e.registerCommand(yA,()=>(cR(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 fR(){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:Ur({createInitialHistoryState:fR,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:uR(e,o.historyState.value,o.delay))}}),pV=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?dR(i,tg.name):null})(e._parentEditor);if(!r)return()=>{};let a=r.output;return bu(()=>lR(()=>{o.delay.value=a.delay.value,o.historyState.value=a.historyState.value,o.disabled.value=a.disabled.value}))}});var ng=Bx,Nde=ng.HistoryExtension,_de=ng.SharedHistoryExtension,og=ng.createEmptyHistoryState,pR=ng.registerHistory;var zx={};En(zx,{HistoryPlugin:()=>mV,createEmptyHistoryState:()=>og});ue();function mV({delay:e,externalHistoryState:t}){let[n]=Cn();return(function(o,r,a=1e3){let i=K(()=>r||og(),[r]);W(()=>pR(o,i,a),[a,o,i])})(n,t,e),null}var mR=zx,gR=mR.HistoryPlugin,hR=mR.createEmptyHistoryState;var fd=new Map,gV=32;function vR(e,t){for(fd.delete(e),fd.set(e,t);fd.size>gV;){let n=fd.keys().next().value;if(n===void 0)break;fd.delete(n)}}function hV(e){return{anchor:e.length,focus:e.length}}function $a(e,t,n){let o=fd.get(e);if(o)return vR(e,o),o;let r={cursor:n?.cursor??t.length,expandedCursor:n?.expandedCursor??t.length,selection:n?{anchor:n.cursor,focus:n.cursor}:hV(t),history:hR()};return vR(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 yR(e,t,n,o){let r=$a(e,t);r.cursor=n,r.expandedCursor=o}function xR(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:()=>yV});ue();var CR=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,vV=CR?he:W,rg={tag:zr};function yV({initialConfig:e,children:t}){let n=K(()=>{let{theme:o,namespace:r,nodes:a,onError:i,editorState:s,html:l}=e,d=bk(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=hr();m.append(g);let h=CR?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 vV(()=>{let o=e.editable,[r]=n;r.setEditable(o===void 0||o)},[]),u(Ck.Provider,{value:n,children:t})}var xV=Ux,bR=xV.LexicalComposer;var $x={};En($x,{$canShowPlaceholder:()=>SR,$canShowPlaceholderCurry:()=>bV,$findTextIntersectionFromCharacters:()=>wV,$isRootTextContentEmpty:()=>Hx,$isRootTextContentEmptyCurry:()=>CV,$rootTextContent:()=>wR,registerLexicalTextEntity:()=>IV});function wR(){return At().getTextContent()}function Hx(e,t=!0){if(e)return!1;let n=wR();return t&&(n=n.trim()),n===""}function CV(e,t){return()=>Hx(e,t)}function SR(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(!lA(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 bV(e){return()=>SR(e)}function wV(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 SV(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 IV(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&&SV(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=$x,Qde=$s.$canShowPlaceholder,ag=$s.$canShowPlaceholderCurry,Xde=$s.$findTextIntersectionFromCharacters,Yde=$s.$isRootTextContentEmpty,Jde=$s.$isRootTextContentEmptyCurry,Zde=$s.$rootTextContent,ece=$s.registerLexicalTextEntity;var Kx={};En(Kx,{ContentEditable:()=>kV,ContentEditableElement:()=>kR});ue();var TR=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?he:W;function TV({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[T,I]=J(e.isEditable()),k=R(P=>{P&&P.ownerDocument&&P.ownerDocument.defaultView?e.setRootElement(P):e.setRootElement(null)},[e]),E=K(()=>(function(...P){return _=>{for(let A of P)typeof A=="function"?A(_):A!=null&&(A.current=_)}})(S,k),[k,S]);return TR(()=>(I(e.isEditable()),e.registerEditableListener(P=>{I(P)})),[e]),u("div",{"aria-activedescendant":T?t:void 0,"aria-autocomplete":T?n:"none","aria-controls":T?o:void 0,"aria-describedby":r,...a!=null?{"aria-errormessage":a}:{},"aria-expanded":T&&v==="combobox"?!!i:void 0,...s!=null?{"aria-invalid":s}:{},"aria-label":l,"aria-labelledby":d,"aria-multiline":c,"aria-owns":T?f:void 0,"aria-readonly":!T||void 0,"aria-required":p,autoCapitalize:m,className:g,contentEditable:T,"data-testid":w,id:h,ref:E,role:v,spellCheck:y,style:x,tabIndex:C,...L})}var kR=zn(TV);function IR(e){return e.getEditorState().read(ag(e.isComposing()))}var kV=zn(LV);function LV(e,t){let{placeholder:n,...o}=e,[r]=Cn();return b(Le,{children:[u(kR,{editor:r,...o,ref:t}),n!=null&&u(PV,{editor:r,content:n})]})}function PV({content:e,editor:t}){let n=(function(i){let[s,l]=J(()=>IR(i));return TR(()=>{function d(){let c=IR(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 LR=Kx,PR=LR.ContentEditable,sce=LR.ContentEditableElement;ue();var AV=Ct(null),Vx={didCatch:!1,error:null},ig=class extends Sa{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&&EV(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(AV.Provider,{value:{didCatch:a,error:i,resetErrorBoundary:this.resetErrorBoundary}},s)}};function EV(e=[],t=[]){return e.length!==t.length||e.some((n,o)=>!Object.is(n,t[o]))}var qx={};En(qx,{LexicalErrorBoundary:()=>RV});function RV({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 MV=qx,AR=MV.LexicalErrorBoundary;var Wx={};En(Wx,{OnChangePlugin:()=>_V});ue();var NV=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?he:W;function _V({ignoreHistoryMergeTagChange:e=!0,ignoreSelectionChange:t=!1,onChange:n}){let[o]=Cn();return NV(()=>{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(zr)||s.isEmpty()||n(r,o,l)})},[o,e,t,n]),null}var DV=Wx,ER=DV.OnChangePlugin;var Gx={};En(Gx,{useLexicalEditable:()=>BV});ue();var OV=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?he:W;function FV(e){return{initialValueFn:()=>e.isEditable(),subscribe:t=>e.registerEditableListener(t)}}function BV(){return(function(e){let[t]=Cn(),n=K(()=>e(t),[t,e]),[o,r]=J(()=>n.initialValueFn()),a=N(o);return OV(()=>{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})(FV)}var zV=Gx,RR=zV.useLexicalEditable;var jx={};En(jx,{ReactProviderExtension:()=>UV});var UV=Rn({name:"@lexical/react/ReactProvider"});var HV=jx,MR=HV.ReactProviderExtension;var Qx={};En(Qx,{DragonExtension:()=>$V,registerDragonSupport:()=>NR});function NR(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 $V=Rn({build:(e,t,n)=>eg(t),config:Ur({disabled:typeof window>"u"}),name:"@lexical/dragon",register:(e,t,n)=>bu(()=>n.getOutput().disabled.value?void 0:NR(e))});var _R=Qx,DR=_R.DragonExtension,OR=_R.registerDragonSupport;var Xx={};En(Xx,{$generateHtmlFromNodes:()=>VV,$generateNodesFromDOM:()=>KV});function KV(e,t){let n=nE(t)?t.body.childNodes:t.childNodes,o=[],r=[];for(let a of n)if(!BR.has(a.nodeName)){let i=zR(a,e,r,!1);i!==null&&(o=o.concat(i))}return(function(a){for(let i of a)i.getNextSibling()instanceof ox&&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 VV(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++)FR(e,o[r],n,t);return n.innerHTML}function FR(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=eE(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=FR(e,g,p,o);!r&&je(t)&&h&&t.extractWithChild(g,o,"html")&&(r=!0)}if(r&&!a){if((BE(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 BR=new Set(["STYLE","SCRIPT"]);function zR(e,t,n,o,r=new Map,a){let i=[];if(BR.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(...zR(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}:hr)),s==null?p.length>0?i=i.concat(p):wx(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 qV(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 UR=Xx,HR=UR.$generateHtmlFromNodes,$R=UR.$generateNodesFromDOM;var Jx={};En(Jx,{$generateJSONFromSelectedNodes:()=>GR,$generateNodesFromSerializedNodes:()=>jR,$getClipboardDataFromSelection:()=>XR,$getHtmlContent:()=>VR,$getLexicalContent:()=>qR,$insertDataTransferForPlainText:()=>WV,$insertDataTransferForRichText:()=>GV,$insertGeneratedNodes:()=>Yx,copyToClipboard:()=>jV,setLexicalClipboardDataTransfer:()=>YR});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 VR(e,t=Ke()){return t==null&&sg(166),Ne(t)&&t.isCollapsed()||t.getNodes().length===0?"":HR(e,t)}function qR(e,t=Ke()){return t==null&&sg(166),Ne(t)&&t.isCollapsed()||t.getNodes().length===0?null:JSON.stringify(GR(e,t))}function WV(e,t){let n=e.getData("text/plain")||e.getData("text/uri-list");n!=null&&t.insertRawText(n)}function GV(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,$R(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===`
|
|
3757
3779
|
`||c===`\r
|
|
3758
|
-
`?d.insertParagraph():c===" "?d.insertNodes([
|
|
3759
|
-
`).filter(c=>c.type==="mention"&&c.end<=o.length);if(r.length===0)return!1;let a=
|
|
3760
|
-
`);for(let p=0;p<f.length;p+=1){let m=f[p]??"";m.length>0&&i.push(
|
|
3761
|
-
`);for(let o=0;o<n.length;o+=1){let r=n[o]??"";r.length>0&&e.append(zr(r)),o<n.length-1&&e.append(_s())}}function dC(e,t,n){let o=At();o.clear();let r=fr();o.append(r);let a=ws(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(vM(i.name,s?.label??fa({name:i.name}),s?.description??null));continue}if(i.type==="terminal-context"){i.context&&r.append(yM(i.context));continue}hq(r,i.text)}}function sC(e){return e instanceof $s?[e.__context.id]:Qe(e)?e.getChildren().flatMap(t=>sC(t)):[]}function vq(e){let[t]=wn();return G(()=>{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(RA,l=>n("ArrowDown",l),pr),r=t.registerCommand(MA,l=>n("ArrowUp",l),pr),a=t.registerCommand(Nm,l=>n("Enter",l),pr),i=t.registerCommand(_m,l=>n("Tab",l),pr),s=t.registerCommand(DA,l=>n("Escape",l),pr);return()=>{o(),r(),a(),i(),s()}},[t,e]),null}function yq(){let[e]=wn();return G(()=>{let t=e.registerCommand(Em,o=>{let r=null;if(e.getEditorState().read(()=>{let i=He();if(!Me(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},pr),n=e.registerCommand(Rm,o=>{let r=null;if(e.getEditorState().read(()=>{let i=He();if(!Me(i)||!i.isCollapsed())return;let s=Lu(0),l=mg();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},pr);return()=>{t(),n()}},[e]),null}function xq(){let[e]=wn();return G(()=>e.registerCommand(_A,t=>{if(!rM(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(()=>{Ur(QP(o,e))}),!0)},pr),[e]),null}function Cq(){let[e]=wn();return G(()=>e.registerUpdateListener(({editorState:t})=>{let n=null;t.read(()=>{let o=He();if(!Me(o)||!o.isCollapsed())return;let r=o.anchor.getNode();if(!Bi(r)||o.anchor.offset===0)return;n=ku(r,0)+1}),n!==null&&queueMicrotask(()=>{e.update(()=>{Ks(n)})})}),[e]),null}function bq(){let[e]=wn(),{onRemoveTerminalContext:t}=St(hM);return G(()=>e.registerCommand(Mm,n=>{let o=He();if(!Me(o)||!o.isCollapsed())return!1;let r=o.anchor.getNode(),a=Lu(0),i=s=>{if(!Bi(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(Qe(s)){let l=r.getIndexWithinParent();if(l>0&&i(s.getChildAtIndex(l-1)))return!0}return!1}if(Qe(r)){let s=o.anchor.offset-1;if(s>=0&&i(r.getChildAtIndex(s)))return!0}return!1},pr),[e,t]),null}function wq(){let[e]=wn();return G(()=>{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=He();if(Me(d)&&!d.isCollapsed())for(let c of d.getNodes())c instanceof Ka&&l.add(c.getKey())}),l},a=e.registerUpdateListener(()=>{o(n?r():new Set)}),i=e.registerCommand(kA,()=>(n=!0,o(r()),!1),ad),s=e.registerCommand(gA,()=>(n=!1,o(new Set),!1),ad);return()=>{a(),i(),s()}},[e]),null}function Sq(){let[e]=wn();return G(()=>cM(e,{createMentionNode:lC,getExpandedAbsoluteOffsetForPoint:fg}),[e]),null}function Iq(e){let[t]=wn(),n=N(e.terminalContexts),o=N(Iu(e.skills)),r=N(null),a=N(null);G(()=>{n.current=e.terminalContexts},[e.terminalContexts]),G(()=>{o.current=Iu(e.skills)},[e.skills]);let i=hh(s=>{let l=gM.get(s),d=r.current;if(!l)return r.current=null,!1;let c=!1;return t.update(()=>{let f=d??(()=>{let h=He();if(!Me(h)||h.isCollapsed()||pM(h))return null;let v=fM(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=Co(m,f.expandedStart);dg(g+s.length,g+s.length+p.length),c=!0,r.current=null}),c});return G(()=>{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=He();if(!Me(h)||h.isCollapsed()){r.current=null,a.current=null;return}if(pM(h)){r.current=null,a.current=null;return}let v=fM(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==="`"&&uM!==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=uM;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=Co(v,h.expandedStart);dg(w,w+1);let L=He();if(!Me(L)){r.current=null,a.current=null;return}L.insertText(`\`${C}${y}`),dg(w+1,w+1+C.length),r.current=null,a.current=null},{tag:Hr})})},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 Tq({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]=wn(),g=N(d);g.current=d;let h=dr(t,n),v=qa(e,t,{cursor:h,expandedCursor:Ko(t,h)}),y=dr(t,v.cursor),x=uq(o),C=N(x),w=fq(r),L=N(w),S=N(Iu(r)),T=N({value:t,cursor:y,expandedCursor:v.expandedCursor,selection:v.selection,terminalContextIds:o.map(z=>z.id)}),I=N(e),k=v.history,E=N(!1),P=V(()=>({onRemoveTerminalContext:l}),[l]);he(()=>{S.current=Iu(r)},[r]),G(()=>{m.setEditable(!a)},[a,m]),he(()=>{let z=dr(t,n),q=T.current,X=I.current,Se=X!==e,K=C.current!==x,W=L.current!==w;if(!Se&&q.value===t&&q.cursor===z&&!K&&!W)return;if(Se){let le=q.selection;m.getEditorState().read(()=>{le=aC(le)}),ud(X,q.value,{cursor:q.cursor,expandedCursor:q.expandedCursor,selection:le})}let Z=qa(e,t),j=Se?Z.selection:{anchor:z,focus:z};T.current={value:t,cursor:Se?Z.cursor:z,expandedCursor:Se?Z.expandedCursor:Ko(t,z),selection:j,terminalContextIds:o.map(le=>le.id)},I.current=e,C.current=x,L.current=w;let O=m.getRootElement(),Y=!!(O&&document.activeElement===O);if(!Se&&q.value===t&&!K&&!W&&!Y)return;let re=Se?qa(X,q.value).history:null;E.current=!0;let ue=()=>m.update(()=>{let le=Se||q.value!==t||K||W;le&&dC(t,o,S.current),Se?dg(j.anchor,j.focus):(le||Y)&&Ks(z)},{discrete:!0,tag:Hr});re?vR(re,ue):ue(),ud(e,t,T.current),queueMicrotask(()=>{E.current=!1})},[n,e,m,w,o,x,t]);let _=R(z=>{let q=m.getRootElement();if(!q)return;let X=dr(T.current.value,z);q.focus({preventScroll:!0}),m.update(()=>{Ks(X)}),T.current={value:T.current.value,cursor:X,expandedCursor:Ko(T.current.value,X),selection:{anchor:X,focus:X},terminalContextIds:T.current.terminalContextIds},ud(I.current,T.current.value,{cursor:T.current.cursor,expandedCursor:T.current.expandedCursor,selection:T.current.selection}),g.current(T.current.value,X,T.current.expandedCursor,!1,T.current.terminalContextIds)},[m]),A=R(()=>{let z=T.current;return m.getEditorState().read(()=>{let q=At().getTextContent(),X=dr(q,T.current.cursor),Se=dr(q,Lu(X)),K=lg(q,T.current.expandedCursor),W=lg(q,mM(K)),Z=sC(At()),j=aC(T.current.selection);z={value:q,cursor:Se,expandedCursor:W,selection:j,terminalContextIds:Z}}),T.current=z,ud(I.current,z.value,z),z},[m]);nr(p,()=>({focus:()=>{_(T.current.cursor)},focusAt:_,focusAtEnd:()=>{_(Co(T.current.value,T.current.value.length))},readSnapshot:A}),[_,A]);let B=R(z=>{z.read(()=>{let q=At().getTextContent(),X=dr(q,T.current.cursor),Se=dr(q,Lu(X)),K=lg(q,T.current.expandedCursor),W=lg(q,mM(K)),Z=sC(At()),j=aC(T.current.selection),O=T.current;if(O.value===q&&O.cursor===Se&&O.expandedCursor===W&&O.selection.anchor===j.anchor&&O.selection.focus===j.focus&&O.terminalContextIds.length===Z.length&&O.terminalContextIds.every((re,ue)=>re===Z[ue])||E.current)return;T.current={value:q,cursor:Se,expandedCursor:W,selection:j,terminalContextIds:Z},ud(I.current,q,{cursor:Se,expandedCursor:W,selection:j});let Y=_c(q,Se,"left")||_c(q,Se,"right");g.current(q,Se,W,Y,Z)})},[]);return u(hM,{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(oM,{contentEditable:u(kR,{className:H("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:LR}),u(PR,{onChange:B}),u(vq,{...c?{onCommandKeyDown:c}:{}}),u(Iq,{terminalContexts:o,skills:r}),u(xq,{}),u(yq,{}),u(Cq,{}),u(bq,{}),u(Sq,{}),u(wq,{}),u(pR,{externalHistoryState:k},e)]})})}function kq(e){let[t]=wn(),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]),G(()=>{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(Tq,{...i})}function CM({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=V(()=>({namespace:"ycodium-composer-editor",editable:!0,nodes:[Su,Tu,$s],editorState:()=>{dC(m.current,g.current,h.current)},onError:y=>{throw y}}),[]);return u(xR,{initialConfig:v,children:u(kq,{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}:{}})},rq)}pe();function Lq(e){let t=new Date(e);return Number.isNaN(t.getTime())?null:t}function bM(e,t){let n=Lq(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 wM=90;function SM(e){return e.droppedImageNames.length+(e.unreadableImageNames?.length??0)}function Pq(e,t){let n=e.prompt.trim().replace(/\s+/g," ");if(n.length>0)return n.length>wM?`${n.slice(0,wM)}\u2026`:n;let o=e.attachments.length+e.droppedImageNames.length;return o>0?t("stash.imageCountLabel",{count:o}):t("stash.emptyEntry")}var IM=me(function(t){let{entries:n,onRestore:o,onDelete:r,onClose:a}=t,{t:i}=xe(),s=Gt(),l=N(null),[d,c]=J(n[0]?.id??null),f=n.find(p=>p.id===d)??n[0];return G(()=>{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]),G(()=>{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(de,{variant:"ghost-muted",size:"icon-micro","aria-label":i("stash.closeLabel"),onPointerDown:p=>p.preventDefault(),onClick:a,children:u(nn,{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:H("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:Pq(p,i)}),p.pendingImageCount?u("span",{className:"shrink-0 text-[10px] text-secondary-label",children:i("stash.savingImage",{count:p.pendingImageCount})}):SM(p)>0?u("span",{className:"shrink-0 text-[10px] text-warning-foreground",children:i("stash.imagesDropped",{count:SM(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:bM(p.createdAt,i)}),u(de,{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(nn,{className:"stroke-2"})})]},p.id))})})]})})});pe();function lo(e,t){let n=e.trim();return n?t?.trimLeadingPattern?n.replace(t.trimLeadingPattern,"").toLowerCase():n.toLowerCase():""}function Aq(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 Eq(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 Vr(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=Eq(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=Aq(t,n);if(o!==null)return e.fuzzyBase+o}return null}function Rq(e,t){let n=e.score-t.score;return n!==0?n:e.tieBreaker.localeCompare(t.tieBreaker)}function Mq(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;Rq(t,a)<0?o=r:n=r+1}return n}function gg(e,t,n){if(n<=0)return;let o=Mq(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=fa(e).toLowerCase(),r=e.shortDescription?.toLowerCase()??"",a=e.description?.toLowerCase()??"",i=e.scope?.toLowerCase()??"",s=[Vr({value:n,query:t,exactBase:0,prefixBase:2,boundaryBase:4,includesBase:6,fuzzyBase:100,boundaryMarkers:["-","_","/"]}),Vr({value:o,query:t,exactBase:1,prefixBase:3,boundaryBase:5,includesBase:7,fuzzyBase:110}),Vr({value:r,query:t,exactBase:20,prefixBase:22,boundaryBase:24,includesBase:26}),Vr({value:a,query:t,exactBase:30,prefixBase:32,boundaryBase:34,includesBase:36}),Vr({value:i,query:t,exactBase:40,prefixBase:42,includesBase:44})].filter(l=>l!==null);return s.length===0?null:Math.min(...s)}function TM(e,t,n=Number.POSITIVE_INFINITY){let o=e.filter(i=>i.enabled),r=lo(t,{trimLeadingPattern:/^\$+/});if(!r)return o;let a=[];for(let i of o){let s=uC(i,r);s!==null&&gg(a,{item:i,score:s,tieBreaker:`${fa(i).toLowerCase()}\0${i.name}`},n)}return a.map(i=>i.item)}function Nq(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=[Vr({value:n,query:t,exactBase:0,prefixBase:2,boundaryBase:4,includesBase:6,fuzzyBase:100,boundaryMarkers:["-","_","/"]}),Vr({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 kM(e,t,n=[]){let o=lo(t,{trimLeadingPattern:/^\/+/});if(!o)return[...e];let r=[];for(let a of e){let i=Nq(a,o);if(i===null)continue;let s=n.includes(a.id)?i-1:i;gg(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 LM(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 PM=(e,t,n)=>n.endsWith(" ")&&e[t]===" "?t+1:t;function hg(e){return e===null?null:`${e.kind}:${e.rangeStart}:${e.rangeEnd}:${e.query}`}function AM({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}=xe(),[h,v]=J(()=>bo(e,e.length)),[y,x]=J(null),[C,w]=J(null),[L,S]=J(null),T=y!==null&&hg(h)===y?null:h,I=T?.kind==="path"?T.query:"",k=T?.kind==="path",E=l({environmentId:i,cwd:k?s:null,query:k?I:null}),P=V(()=>{if(!T)return[];if(T.kind==="path")return E.entries.map(Z=>({id:`path:${Z.kind}:${Z.path}`,type:"path",path:Z.path,pathKind:Z.kind,label:_q(Z.path),description:Z.path.slice(0,Math.max(0,Z.path.lastIndexOf("/")))}));if(T.kind==="slash-command"){let Z=[{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")}]:[]],j=fk(n?.skills??[],r),O=pk(n?.slashCommands??[],j).map(le=>({id:`provider-slash-command:${t}:${le.name}`,type:"provider-slash-command",provider:t,command:le,label:`/${le.name}`,description:le.description??le.input?.hint??g("composer.runProviderCommand")})),Y=T.query.trim().toLowerCase(),re=j.map(le=>({id:`skill:${t}:${le.name}`,type:"skill",provider:t,skill:le,label:`/skill:${le.name}`,description:le.shortDescription??le.description??(le.scope?g("composer.skillScopeDescription",{scope:le.scope}):"")})),ue=[...Z,...O,...re];return Y===""?LM(ue,a):kM(ue,Y,a)}return T.kind==="skill"?TM(n?.skills??[],T.query).map(Z=>({id:`skill:${t}:${Z.name}`,type:"skill",provider:t,skill:Z,label:fa(Z),description:Z.shortDescription??Z.description??(Z.scope?g("composer.skillScopeDescription",{scope:Z.scope}):g("composer.runProviderSkill"))})):[]},[T,o,a,t,n,r,g,E.entries]),_=!!T,A=T?`${T.kind}:${T.query.trim().toLowerCase()}`:null,B=V(()=>{let Z=fC({items:P,highlightedItemId:C,currentSearchKey:A,highlightedSearchKey:L});return P.find(j=>j.id===Z)??null},[P,C,A,L]),z=R(()=>{let Z=d(),j=bo(Z.value,Z.expandedCursor),O=y!==null&&hg(j)===y?null:j;return{snapshot:Z,trigger:O}},[d,y]),q=R(Z=>{let{snapshot:j,trigger:O}=z();if(!O)return;if((Z.type==="slash-command"||Z.type==="provider-slash-command"||Z.type==="skill")&&m?.(Z.id),Z.type==="path"){let le=`${bu(Z.path)} `,fe=PM(j.value,O.rangeEnd,le);c(O.rangeStart,fe,le,{expectedText:j.value.slice(O.rangeStart,fe)})&&w(null);return}if(Z.type==="slash-command"){if(Z.command==="model"){c(O.rangeStart,O.rangeEnd,"",{expectedText:j.value.slice(O.rangeStart,O.rangeEnd),focusEditorAfterReplace:!1})&&(w(null),p());return}f(Z.command==="plan"?"plan":"default"),c(O.rangeStart,O.rangeEnd,"",{expectedText:j.value.slice(O.rangeStart,O.rangeEnd)})&&w(null);return}let Y=Z.type==="provider-slash-command"?`/${Z.command.name} `:`$${Z.skill.name} `,re=PM(j.value,O.rangeEnd,Y);c(O.rangeStart,re,Y,{expectedText:j.value.slice(O.rangeStart,re)})&&w(null)},[c,f,p,m,z]);G(()=>{if(!_){w(null),S(null);return}let Z=fC({items:P,highlightedItemId:C,currentSearchKey:A,highlightedSearchKey:L});w(j=>j===Z?j:Z),S(j=>j===A?j:A)},[C,L,P,_,A]);let X=R(Z=>{w(Z),S(A)},[A]),Se=R(()=>{let{trigger:Z}=z();return Z===null?!1:(x(hg(Z)),w(null),!0)},[z]),K=R((Z,j)=>{let O=Ko(Z,j),Y=bo(Z,O);v(Y);let re=hg(Y);x(ue=>ue!==null&&ue!==re?null:ue),w(null),S(null)},[]),W=R(()=>{w(null)},[]);return{composerTrigger:h,menuTrigger:T,composerMenuItems:P,composerMenuOpen:_,composerMenuSearchKey:A,activeComposerMenuItem:B,resolveActiveComposerTrigger:z,onSelectComposerItem:q,onComposerMenuItemHighlighted:X,onMenuEscape:Se,resetForDocumentChange:K,dismissTrigger:W,workspaceEntries:E,highlightedItemId:C,setTrigger:v,setHighlightedItemId:w,setHighlightedSearchKey:S}}function _q(e){let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t>=0?e.slice(t+1):e}function Dq(e,t){return e.bottom===t.bottom&&e.left===t.left&&e.maxHeight===t.maxHeight&&e.width===t.width&&e.overlap===t.overlap}function EM(e){let t=Gt(),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&&Dq(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 Oq=[],Fq=[],Bq=e=>e.prompt,zq=(e,t)=>{let n=new Map(e.map(o=>[o.id,o]));return t.flatMap(o=>{let r=n.get(o);return r?[r]:[]})},Uq=(e,t)=>e.length===t.length&&e.every((n,o)=>n.id===t[o]),RM=me(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:T,changeUserInputCustomAnswer:I,terminalContexts:k,showTerminalContexts:E,showEditor:P,isApprovalState:_,editorClassName:A,placeholder:B,disabled:z,onPaste:q,onSubmit:X,isMobileViewport:Se,isDraftRoute:K,stashMenuOpen:W,stashEntries:Z,onRestoreStashEntry:j,onDeleteStashEntry:O,onCloseStashMenu:Y,onPromptEdited:re,onUnclaimedEscape:ue}=t,{t:le}=xe(),fe=o.draft.useThreadDraftSelector(r,Bq),ae=o.draft.useStore,Le=ae(we=>we.setPrompt),et=ae(we=>we.setTerminalContexts),Ge=ae(we=>we.removeTerminalContext),rt=Co(fe,fe.length),$e=qa(a,fe,{cursor:rt,expandedCursor:fe.length}),[te,Pe]=J(()=>({documentKey:a,cursor:$e.cursor})),Q=te.documentKey===a?te.cursor:$e.cursor,$=R(we=>{Pe(Ve=>{let qe=Ve.documentKey===a?Ve.cursor:qa(a,i.current).cursor,We=typeof we=="function"?we(qe):we,ot=i.current,yt=Ko(ot,We);return hR(a,ot,We,yt),Ve.documentKey===a&&Ve.cursor===We?Ve:{documentKey:a,cursor:We}})},[a,i]),oe=N(!1),ve=N(!1),at=N([]),Et=N(null),Rt=R(we=>{Le(r,we)},[r,Le]),_t=R((we,Ve,qe,We,ot)=>{I(we,Ve,qe,We,ot),i.current=Ve},[I,i]),an=R((we,Ve,qe,We)=>{let ot=i.current,yt=Math.max(0,Math.min(ot.length,we)),ye=Math.max(yt,Math.min(ot.length,Ve));if(We?.expectedText!==void 0&&ot.slice(yt,ye)!==We.expectedText)return!1;let xt=GT(i.current,we,Ve,qe),pt=Co(xt.text,xt.cursor),Ht=Ko(xt.text,pt);i.current=xt.text;let Tn=L?.activeQuestion;return Tn&&T?_t(Tn.id,xt.text,pt,Ht,!1):Rt(xt.text),$(pt),sn(bo(xt.text,Ht)),We?.focusEditorAfterReplace!==!1&&window.requestAnimationFrame(()=>{s.current?.focusAt(pt)}),!0},[L?.activeQuestion,s,T,_t,i,$,Rt]),mt=R(()=>{let we=s.current?.readSnapshot();return we||{value:i.current,cursor:Q,expandedCursor:Ko(i.current,Q),terminalContextIds:k.map(Ve=>Ve.id)}},[Q,s,i,k]),Wt=AM({prompt:fe,selectedProvider:c,selectedProviderStatus:f,planModeUiEnabled:p,showSkillsInSlashMenu:m,recentSlashCommandIds:g,environmentId:h,gitCwd:v,useComposerPathSearch:o.pathSearch.useComposerPathSearch,readComposerSnapshot:mt,applyPromptReplacement:an,onInteractionModeChange:C,onOpenModelPicker:x,onSlashCommandUsed:y}),{composerTrigger:Ot,composerMenuItems:vt,composerMenuOpen:Sn,activeComposerMenuItem:ft,resolveActiveComposerTrigger:pn,onComposerMenuItemHighlighted:no,onMenuEscape:Xt,workspaceEntries:In,highlightedItemId:En,setTrigger:sn,setHighlightedItemId:Rn}=Wt,F=Ot?.kind??null,ce=Ot?.kind==="path"?Ot.query:"",be=L?L.customAnswer:fe,ke=_?"":be,Re=Wt.resetForDocumentChange;G(()=>{Re(be,Q)},[a,Re,be,Q]),ve.current=Sn,at.current=vt,Et.current=ft;let st=F==="path"&&ce.length>0&&In.isPending===!0,ln=V(()=>le(F==="skill"?"composer.noSkillsFound":F==="path"?"composer.noMatchingFiles":"composer.noMatchingCommand"),[F]),vn=R(we=>{let Ve=k.findIndex(ot=>ot.id===we);if(Ve<0)return;let qe=o.terminalContext.removeInlinePlaceholder(i.current,Ve);i.current=qe.prompt,Rt(qe.prompt),Ge(r,we);let We=Co(qe.prompt,qe.cursor);$(We),sn(bo(qe.prompt,qe.cursor))},[o.terminalContext,r,i,Ge,$,Rt,k,sn]);he(()=>{i.current=fe,$(we=>dr(fe,we))},[a,fe,i,$]),G(()=>{re(fe)},[re,fe]),G(()=>{Sn&&Y()},[Sn,Y]);let ct=N(null);G(()=>{let we=L?.customAnswer;if(typeof we!="string"){if(ct.current!==null){i.current=fe;let ye=Co(fe,fe.length);$(ye),sn(bo(fe,Ko(fe,ye)))}ct.current=null;return}let Ve=S,qe=L?.activeQuestion?.id??null,We=ct.current?.requestId!==Ve||ct.current?.questionId!==qe,ot=i.current!==we;if(ct.current={requestId:Ve,questionId:qe},!We&&!ot)return;i.current=we;let yt=Co(we,we.length);$(yt),sn(bo(we,Ko(we,yt))),Rn(null)},[L?.customAnswer,L?.activeQuestion?.id,S,fe,i]);let kt=R((we,Ve,qe,We,ot)=>{if(L?.activeQuestion&&T){if(L.activeQuestion.allowFreeform===!1)return;$(Ve),sn(We?null:bo(we,qe)),_t(L.activeQuestion.id,we,Ve,qe,We);return}i.current=we,Rt(we),Uq(k,ot)||et(r,zq(k,ot)),$(Ve),sn(We?null:bo(we,qe))},[L?.activeQuestion,T,_t,i,$,Rt,r,k,et,sn]),Ft=Wt.onSelectComposerItem,Pt=R(we=>{oe.current||(oe.current=!0,window.requestAnimationFrame(()=>{oe.current=!1}),Ft(we))},[Ft]),Ut=R(we=>{if(vt.length===0)return;let Ve=vt.findIndex(ye=>ye.id===En),ot=((Ve>=0?Ve:we==="ArrowDown"?-1:0)+(we==="ArrowDown"?1:-1)+vt.length)%vt.length,yt=vt[ot];Rn(yt?.id??null)},[En,vt,Rn]),ht=(we,Ve)=>{if(we==="Escape")return Ve.isComposing||Ve.keyCode===229?!1:Xt()||(ue?.()??!1);if(we==="Tab"&&Ve.shiftKey)return p?(w(),!0):!1;let{trigger:qe}=pn();if(ve.current||qe!==null){let yt=at.current,ye=Et.current??yt[0];if(we==="ArrowDown"&&yt.length>0)return Ut("ArrowDown"),!0;if(we==="ArrowUp"&&yt.length>0)return Ut("ArrowUp"),!0;if((we==="Enter"||we==="Tab")&&ye)return Pt(ye),!0}let ot=we==="Enter"?VT({isMobileViewport:Se,shiftKey:Ve.shiftKey,modifierKey:Ve.metaKey||Ve.ctrlKey,isDraftThread:K}):null;return ot?(X(void 0,ot),!0):!1};return nr(n,()=>({readSnapshot:mt,readDraftPrompt:()=>fe,applyPromptReplacement:an,syncCursor:(we,Ve)=>{$(we),sn(Ve)},resetCursorState:we=>{let Ve=we?.prompt??i.current,qe=dr(Ve,we?.cursor??0);Rn(null),$(qe),sn(we?.detectTrigger?bo(Ve,Ko(Ve,qe)):null)}}),[an,fe,i,mt,$,Rn,sn]),b(Te,{children:[W&&!Sn&&!_&&u(EM,{anchor:l,children:u(IM,{entries:Z,onRestore:j,onDelete:O,onClose:Y})}),Sn&&!_&&u(EM,{anchor:l,children:u(hk,{items:vt,resolvedTheme:d,isLoading:st,triggerKind:F,emptyStateText:ln,activeItemId:ft?.id??null,onHighlightedItemChange:no,onSelect:Pt})}),P?u(CM,{editorRef:s,documentKey:a,value:ke,cursor:Q,terminalContexts:E?k:Oq,skills:f?.skills??Fq,...A?{className:A}:{},onRemoveTerminalContext:vn,onChange:kt,onCommandKeyDown:ht,onPaste:q,placeholder:B,disabled:z}):null]})});pe();function vg(e){return e==="ready"}function MM(e){return e==="ready"||e==="unchecked"||e==="checking"}function NM(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 Pu(e){return e.enabled&&MM(e.readiness)}function xg(e){return e.enabled}function _M(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 yg=e=>e.enabled;function Cg(e,t){if(t!==void 0){let n=e.find(o=>o.instanceId===t);if(n&&yg(n))return n}return e.find(n=>n.enabled&&vg(n.readiness))??e.find(Pu)??e.find(n=>yg(n)&&n.readiness!=="error")}function DM(e,t){let n=e.find(o=>o.instanceId===t);if(n)return n.driverKind}var OM="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 Wo({className:e,size:t="sm",variant:n="ghost",...o}){return u(de,{className:H(OM,e),size:t,variant:n,...o})}function Go({icon:e,className:t,opticalSize:n="default"}){return u(e,{"aria-hidden":"true",className:H("shrink-0",n==="large"?"size-4.5":"size-4",t),"data-composer-control-icon":!0})}function xa(){return u(un,{"aria-hidden":"true",className:"-mx-0.5 size-icon-2 shrink-0 text-icon-muted","data-composer-control-chevron":!0,strokeWidth:2.25})}function bg({className:e,size:t="sm",variant:n="ghost",...o}){return u(qw,{className:H(OM,e),icon:u(xa,{}),size:t,variant:n,...o})}function FM(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}var pC=me(function(t){let{t:n}=xe(),o=t.instanceEntries.filter(xg),r=o.find(i=>i.instanceId===t.activeInstanceId)??o[0]??null,a=t.lockedProvider!=null&&t.lockedProvider.length>0;return b(Ao,{children:[b(Ro,{render:u(Wo,{"aria-label":n("composer.agentPickerLabel"),"data-composer-agent-picker":"true",disabled:t.disabled||a||o.length===0,className:H("min-w-0 justify-between whitespace-nowrap",t.compact?"max-w-36 shrink-0":"max-w-44 shrink")}),children:[r?u(Lr,{driver:r.driverKind,displayName:r.displayName,accentColor:r.accentColor,className:"size-4",iconClassName:"size-4",indicatorBackground:"var(--contrast-input)"}):null,u("span",{className:"min-w-0 truncate",children:FM(r,n)}),u(xa,{})]}),u(Eo,{align:"start",children:u(Pr,{value:t.activeInstanceId,onValueChange:i=>{!i||i===t.activeInstanceId||t.onInstanceChange(i)},children:o.map(i=>u(Ho,{value:i.instanceId,children:FM(i,n)},i.instanceId))})})]})});function BM(e){return u(pC,{...e})}function zM(e){return e.machineUnavailable?"machineDisconnected":e.sessionStarted&&e.sessionDisconnected?"settled":"default"}function UM(e){switch(e){case"machineDisconnected":return"composer.disconnectedPlaceholder";case"settled":return"composer.idlePlaceholder";case"default":return null}}pe();pe();pe();var MC=Rd(VM(),1),kN=Rd(Sc(),1),LN=Rd(Sc(),1);$n(function(t,n){return Ne("div",{ref:n,...t})});var Rg=$n(function(t,n){return Ne("div",{ref:n,...t})}),mr=Rg,Qa={OS:"web"};function Vs(e,t){return t===void 0?e:Math.max(0,Math.min(t,e))}function NC(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 PN(){return"normal"}function Xq(e){var t;return(t=e?.horizontalRTLScrollType)!=null?t:PN()}function Yq(e){var t;return(t=e?.rtl)!=null?t:!1}function Ya(e){return _C(e?.props)}function _C(e){return!!e?.horizontal&&Yq(e)}function DC(e){return e?.horizontal?(_C(e)?e.stylePaddingLeft:e.stylePaddingRight)||0:e?.stylePaddingBottom||0}function Jq(e,t){var n;return(n=NC(e,t))!=null?n:0}function qM(e,t){return t&&(Ya(e)?t.left:t.right)||0}function Zq(e,t,n,o){return!Ya(e)||o===void 0||!Number.isFinite(o)?t:Math.max(0,o-t-n)}function OC(e,t,n){if(!e||!Ya(e))return t;let o=NC(e,n),r=Vs(t,o),a=Xq(e);return a==="negative"?r===0?0:-r:a==="inverted"?o===void 0?r:Vs(o-r,o):r}function e4(e,t,n){if(!Ya(e))return e.horizontalRTLScrollType=void 0,t;let o=NC(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=PN();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 t4=e=>e,Mg=wt(null),AN="\0",n4=0;function o4({children:e}){let[t]=J(()=>({animatedScrollY:t4(0),columnWrapperStyle:void 0,containerLayoutTriggers:new Map,contextNum:n4++,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 Ne(Mg.Provider,{value:t},e)}function Wr(){return Kt(Mg)}function EN(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=Ce(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(Ga(e,i,r));return()=>{for(let i of a)i()}}}}function r4(e){return e.length===1?e[0]:e.join(AN)}function a4(e){return e.split(AN)}function Ga(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 Ce(e,t){let{values:n}=e;return n.get(t)}function Fe(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 i4(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 s4(e,t,n){let{positionListeners:o}=e,r=o.get(t);if(r)for(let a of r)a(n)}function Qo(e){let t=Kt(Mg),n=r4(e),{subscribe:o,get:r}=V(()=>EN(t,a4(n)),[t,n]);return(0,MC.useSyncExternalStore)(o,r,r)}function l4(e,t){let n=Kt(Mg),{subscribe:o,get:r}=V(()=>EN(n,[e]),[n,e]),a=R(()=>t(r()[0]),[r,t]);return(0,MC.useSyncExternalStore)(o,a,a)}function d4(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?qM(o,s):s?.bottom)||0,d=d4(t??r.contentInsetEndAdjustment),c=Ce(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?qM(o,g):g.bottom)||0)+d,f)}return Math.max(m,f)}function co(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 md=({children:e})=>Ne(Rg,{style:{alignItems:"center",flexDirection:"row",justifyContent:"space-between"}},e);me(function(){let t=Wr(),[n=0,o=0,r=0,a=0,i=0,s=0,l=!1]=Qo(["totalSize","scrollAdjust","debugRawScroll","debugComputedScroll","numContainers","numContainersPooled","isAtEnd"]),d=co(t),[,c]=La(f=>f+1,0);return c4(()=>{c()},100),Ne(Rg,{pointerEvents:"none",style:{backgroundColor:"#FFFFFFCC",borderRadius:4,padding:4,paddingBottom:4,paddingLeft:4,position:"absolute",right:0,top:0}},Ne(md,null,Ne(mr,null,"TotalSize:"),Ne(mr,null,n.toFixed(2))),Ne(md,null,Ne(mr,null,"ContentSize:"),Ne(mr,null,d.toFixed(2))),Ne(md,null,Ne(mr,null,"At end:"),Ne(mr,null,String(l))),Ne(md,null,Ne(mr,null,"ScrollAdjust:"),Ne(mr,null,o.toFixed(2))),Ne(md,null,Ne(mr,null,"RawScroll: "),Ne(mr,null,r.toFixed(2))),Ne(md,null,Ne(mr,null,"ComputedScroll: "),Ne(mr,null,a.toFixed(2))))});function c4(e,t){G(()=>{let n=setInterval(e,t);return()=>clearInterval(n)},[t])}var FC=!0,RN=new WeakMap;function u4(e){return RN.get(e)}function f4(e,t){RN.set(e,t)}var p4=typeof __DEV__<"u"?__DEV__:void 0,WM,GM=typeof process<"u"&&typeof process.env=="object"&&process.env?(WM="production")!=null?WM:process.env.MODE:void 0,jM=typeof GM=="string"?GM.toLowerCase()!=="production":void 0,QM,jo=(QM=jM??p4)!=null?QM:!1,gd=-1e7,MN=1,m4=jo&&!1,g4=jo&&!1;function Ng({scheduledWork:e}){e.cancel("checkFinishedScrollFrame"),e.cancel("checkFinishedScrollRetryFrame"),e.cancel("checkFinishedScrollFallback"),e.cancel("platformScrollCompletion")}function NN(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 h4(e){Ng(e),e.scheduledWork.cancel("imperativeScrollReady"),e.scrollingTo=void 0,e.scrollTargetPinnedRange=void 0,NN(e)}function v4(e,t,n){return{...t,nativeEvent:{...t.nativeEvent,contentOffset:e.props.horizontal?{x:n,y:0}:{x:0,y:n}}}}function y4(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,v4(i,s,(o=(n=t??i.scrollPending)!=null?n:i.scroll)!=null?o:0)))}var gC=1;function x4(e){return!!(e?.didDispatchNativeScroll||e?.didRetrySilentInitialScroll||e?.watchdog)}function XM(e){e.initialScrollSession=void 0}function bC(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 wg(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=bC({bootstrap:e.initialScrollSession.kind==="bootstrap"?e.initialScrollSession.bootstrap:void 0,completion:e.initialScrollSession.completion,kind:t,previousDataLength:e.initialScrollSession.previousDataLength})):e.initialScrollSession=bC({completion:{},kind:t,previousDataLength:0}),(o=(n=e.initialScrollSession).completion)!=null||(n.completion={}),e.initialScrollSession.completion}var _g={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){wg(e).didDispatchNativeScroll=!0},markSilentInitialScrollRetry(e){wg(e).didRetrySilentInitialScroll=!0},resetFlags(e){if(!e.initialScrollSession)return;let t=wg(e,e.initialScrollSession.kind);t.didDispatchNativeScroll=void 0,t.didRetrySilentInitialScroll=void 0}},to={clear(e){to.set(e,void 0)},didReachTarget(e,t){return Math.abs(e-t.targetOffset)<=gC},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>gC},isAtZeroTargetOffset(e){return e<=gC},set(e,t){var n,o;if(!t&&!((o=(n=e.initialScrollSession)==null?void 0:n.completion)!=null&&o.watchdog))return;let r=wg(e);r.watchdog=t?{startScroll:t.startScroll,targetOffset:t.targetOffset}:void 0}};function Xa(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&&!x4(l))return XM(e);let f=(a=(r=t.previousDataLength)!=null?r:i?.previousDataLength)!=null?a:0;return e.initialScrollSession=bC({bootstrap:c,completion:l,kind:s,previousDataLength:f}),e.initialScrollSession}var C4=1.3;function wC(e,t,n){let o=Math.abs(e);return!t&&n>0&&o>=n*C4||!t&&n<=0&&o>0}var _N=(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?wC(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 b4(e,t){let n=e.state;t==="start"?(n.isStartReached=!1,n.startReachedSnapshot=void 0):(n.isEndReached=!1,n.endReachedSnapshot=void 0)}function DN(e){let t=e.state;if(!t.edgeReachedGate)return;let n=co(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=wC(t.scroll,!1,a),l=wC(o,r,i);s&&l&&(t.edgeReachedGate=void 0)}function ON(e,t,n,o){return!e.state.edgeReachedGate||n===t||!!o}function FN(e){e.state.edgeReachedGate="closed"}function YM(e){e.state.edgeReachedGate&&(e.state.edgeReachedGate="prepared")}function w4(e,t){let n=e.state;if(n.edgeReachedGate!=="prepared")return;let o=t<0?"start":"end";return n.edgeReachedGate="closed",b4(e,o),o}function Ru(e){return!!e?.initialScroll&&!e.didFinishInitialScroll}function BN(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=co(e);if(DN(e),f>0&&a){let p=Ws(e),m=f-s-i-p,g=f<i;Fe(e,"isAtEnd",g||m<=MN),Fe(e,"isNearEnd",g||m<=c*i),Fe(e,"isWithinMaintainScrollAtEndThreshold",g||m<=d*i),Ru(r)||l||(r.isEndReached=_N(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;ON(e,"end",t,n)&&(FN(e),(x=(y=r.props).onEndReached)==null||x.call(y,{distanceFromEnd:v}))},v=>{r.endReachedSnapshot=v}))}}function S4(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;DN(e),r&&p>0&&s>p&&d&&(d.contentSize!==c||d.dataLength!==f)&&(o.isStartReached=!1,o.startReachedSnapshot=void 0),Fe(e,"isAtStart",s<=MN),Fe(e,"isNearStart",s<=p),Ru(o)||o.scrollingTo||(o.isStartReached=_N(s,!1,p,o.isStartReached,d,{contentSize:c,dataLength:f,scrollPosition:s},g=>{var h,v;ON(e,"start",t,n)&&(FN(e),(v=(h=o.props).onStartReached)==null||v.call(h,{distanceFromStart:g}))},g=>{o.startReachedSnapshot=g}))}function Dg(e,t){let n=!e.state.edgeReachedGate;BN(e,t,n),S4(e,t,n)}function zN(e){var t,n;let o=e.state;(t=o.props)!=null&&t.data&&((n=o.triggerCalculateItemsInView)==null||n.call(o,{forceFullItemPositions:!0})),Dg(e)}var I4=6,T4=3,k4=250;function UN(e){e.state.scheduledWork.cancel("adaptiveRender")}function JM(e,t){let n=e.state;UN(e),t<=0?Du(e,"normal","scroll"):n.scheduledWork.timeout(()=>Du(e,"normal","scroll"),t,"adaptiveRender")}function Du(e,t,n){var o,r;Ce(e,"adaptiveRender")!==t&&(Fe(e,"adaptiveRender",t),(r=(o=e.state.props.adaptiveRender)==null?void 0:o.onChange)==null||r.call(o,t,n))}function BC(e){var t,n;UN(e);let o=(n=(t=e.state.props.adaptiveRender)==null?void 0:t.initialMode)!=null?n:"normal";Ce(e,"adaptiveRender")!==o&&Du(e,o,"initial")}function L4(e,t,n){var o,r,a;let i=e.state,s=i.props.adaptiveRender,l=Ce(e,"adaptiveRender");if(Ce(e,"readyToRender"))if(s){let d=(o=s.enterVelocity)!=null?o:I4,c=(r=s.exitVelocity)!=null?r:T4,f=(a=s.exitDelay)!=null?a:k4,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"),JM(e,f)):l==="light"&&JM(e,f))}else BC(e)}var zC=50;function HN(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"&&!Ce(e,"readyToRender")&&!a?Math.min(o,zC):o}function $N(e){let{state:t}=e;t.props.drawDistance<=zC||t.scheduledWork.has("fullDrawDistancePrewarm")||t.scheduledWork.frame(()=>{var n;return(n=t.triggerCalculateItemsInView)==null?void 0:n.call(t)},"fullDrawDistancePrewarm")}function UC(e,{resetLayout:t,resetInitialScroll:n}){let{state:o}=e;t&&(o.didContainersLayout=!1,o.queuedInitialLayout=!1),n&&(o.didFinishInitialScroll=!1),Fe(e,"readyToRender",!1),BC(e)}function HC(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&&!Ce(e,"readyToRender")&&(Fe(e,"readyToRender",!0),Du(e,"normal","ready"),o.props.drawDistance>zC&&$N(e),o.didLoad||(o.didLoad=!0,a&&a({elapsedTimeInMs:Date.now()-r})))}var P4=2e3;function ZM(e,t){e.scroll=t,e.scrollPending=t,e.scrollPrev=t}function KN(e){e.scheduledWork.cancel("preservedInitialScroll")}function hd(e){KN(e),e.clearPreservedInitialScrollOnNextFinish=void 0,e.initialScroll=void 0,Xa(e)}function eN(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&&(Ng(r),r.scrollingTo=void 0,r.scrollTargetPinnedRange=void 0),_g.resetFlags(r),Xa(r,{bootstrap:null}),vd(e))}function vd(e,t){var n,o,r;let a=e.state;if(t?.resolvedOffset!==void 0)ZM(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)&&ZM(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;to.clear(a),t?.preserveTarget&&a.initialScroll?(a.clearPreservedInitialScrollOnNextFinish=void 0,Xa(a),KN(a),t?.schedulePreservedTargetClear&&a.scheduledWork.timeout(()=>{var g;!a.didFinishInitialScroll||(g=a.scrollingTo)!=null&&g.isInitialScroll||!a.initialScroll||hd(a)},P4,"preservedInitialScroll")):hd(a),t?.recalculateItems&&zN(e),HC(e,{didInitialScroll:!0}),p&&y4(e,m),(f=t?.onFinished)==null||f.call(t)};if(t?.waitForCompletionFrame){requestAnimationFrame(i);return}i()}function Og(e,t){let n=e.state;return t!==void 0&&n.positions[t]||0}function A4(e){let{state:t}=e;return(t.props.horizontal?(Ya(t)?t.props.stylePaddingRight:t.props.stylePaddingLeft)||0:Ce(e,"stylePaddingTop")||0)+(Ce(e,"alignItemsAtEndPadding")||0)+(Ce(e,"headerSize")||0)}function Qt(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 E4(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 R4(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-E4(e)-Ws(e)):0}function Xs(e){let t=Ce(e,"alignItemsAtEndPadding")||0,n=R4(e);t!==n&&Fe(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&&Fe(e,"totalSize",i),Xs(e)):o&&e.values.get("totalSize")!==i&&Fe(e,"totalSize",i)}function SC(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 VN(e){return typeof e=="function"}function Fg(e){return Array.isArray(e)}var tN=new Set;function qs(e,t){jo&&!tN.has(e)&&(tN.add(e),console.warn(`[legend-list] ${t}`))}function Ou(e){return Math.floor(e*8)/8}function Nu(e){return e==null}function nN(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 nN(e,n)+nN(t,n)}function IC(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=Ce(e,"numContainers");for(let i=0;i<a;i++)if(Ce(e,`containerItemKey${i}`)===t)return i;return-1}function qN(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 WN(e,t){let n=Qt(e.state,t);return qN(e,n,t,e.state.props.data[t])}function M4(e,t,n){for(let o=t;o<=n;o++)if(WN(e,o)===void 0)return!1;return!0}function uo(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=qN(e,t,n,o,s),C!==void 0)return SC(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),SC(e,t,C,i),C}function $C(e,t){if(t===void 0||t<0)return;let n=Qt(e.state,t);return uo(e,n,t,e.state.props.data[t])}function Bg(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=A4(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:uo(e,Qt(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=Ce(e,"footerSize")||0;l+=h}}return l}function zi(e,t,n){let o=e.state,r=co(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){Ng(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;vd(e,{onFinished:()=>{r?.()},preserveTarget:i&&o.props.data.length===0||s,recalculateItems:!0,schedulePreservedTargetClear:s,syncObservedOffset:i,waitForCompletionFrame:!!a.waitForInitialScrollCompletionFrame});return}zN(e),r?.()}}var N4=80,_4=1500,D4=320,O4=1;function F4(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?co(e):void 0,m=f?OC(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;B4(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 B4(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"),_4),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)<=O4;v==="scrollend"&&!x||(l.cancel("platformScrollCompletion"),Fu(e))},g=()=>{i!==void 0&&clearTimeout(i),i=setTimeout(()=>m("idle"),N4)},h=()=>m("scrollend");o.addEventListener("scroll",g),a?o.addEventListener("scrollend",h):i=setTimeout(()=>m("idle"),D4),l.register("platformScrollCompletion",p)}function yd(e){let t=e.state,{didContainersLayout:n,pendingNativeMVCPAdjust:o,refScroller:r,props:{maintainScrollAtEnd:a}}=t,s=!!(Ce(e,"isWithinMaintainScrollAtEndThreshold")&&a&&n);if(o)return t.pendingMaintainScrollAtEnd=s,!1;if(s){if(t.pendingMaintainScrollAtEnd=!1,co(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=Ce(e,"isWithinMaintainScrollAtEndThreshold"),m=t.scroll!==f;if(p||!m){t.maintainingScrollAtEnd=c;let g=r.current;if(t.props.horizontal&&Ya(t)){let h=co(e),v=Jq(t,h),y=OC(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&&yd(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,Ce(e,"readyToRender")?r():(o.adjustingFromInitialMount=(o.adjustingFromInitialMount||0)+1,requestAnimationFrame(r))}}var Io=.1,z4=300,U4=2,H4=1;function $4(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 K4(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)<=Io&&d?.id===n?d.quietPasses+1:0;if(!r&&c>=U4){e.mvcpAnchorLock=void 0;return}e.mvcpAnchorLock={expiresAt:a+z4,id:n,position:o,quietPasses:c}}}function V4(e,t,n,o,r,a){return!1}function q4(e,t,n){if(Math.abs(t)<=Io)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 W4(e,t){return e<0?-t:t}function hC(e,t,n){let o=e.state;o.pendingNativeMVCPAdjust=void 0;let r=t-n;Math.abs(r)>Io&&Ys(e,r)}function G4(e){let t=e.state,n=t.pendingNativeMVCPAdjust;if(!n||Math.abs(n.manualApplied)>Io)return;let o=co(e),r=q4(t,n.amount,o);if(Math.abs(r)<=Io)return;let a=n.amount-r;Math.abs(a)<=Io||(n.manualApplied=a,Ys(e,a),n.furthestProgressTowardAmount=0)}function j4(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>Io||r>0&&a<-Io,s=W4(r,a);if(Math.abs(r)<=Io)return n.pendingNativeMVCPAdjust=void 0,!0;if(i)return n.pendingNativeMVCPAdjust=void 0,!1;if(s+Io>=Math.abs(r))return hC(e,r,a),!0;let l=Math.max(0,co(e)-n.scrollLength);return Math.abs(t-l)<=H4||n.pendingMaintainScrollAtEnd&&Ce(e,"isWithinMaintainScrollAtEndThreshold")&&s>Io?(hC(e,r,a),!0):s>o.furthestProgressTowardAmount+Io?(o.furthestProgressTowardAmount=s,!1):(o.furthestProgressTowardAmount>Io&&s<o.furthestProgressTowardAmount-Io&&(n.pendingNativeMVCPAdjust=void 0),!1)}function Q4(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=$4(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(co(e),C){if(p&&v===void 0?(g=p.id,m=p.position):v!==void 0?g=Qt(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 T=o[S],I=w.get(T);if(I!==void 0){let k=r[I];k!==void 0&&h.push({id:T,position:k})}}if(g!==void 0&&m===void 0){let S=w.get(g);S!==void 0&&(m=r[S])}return()=>{let S=0,T=p?.id,I,k=!1,E=n.props.data;if(t&&i&&v===void 0&&g!==void 0&&p?.id===g&&l!==void 0&&g!==void 0){let A=w.get(g);if(A!==void 0){let B=E[A];k=B===void 0||!l(B,A,E),k&&p?.id===g&&(n.mvcpAnchorLock=void 0)}}if(t&&i&&v===void 0&&(()=>{if(g===void 0||k)return!0;let A=w.get(g);return A===void 0||r[A]===void 0})())for(let A=0;A<h.length;A++){let{id:B,position:z}=h[A],q=w.get(B);if(q!==void 0&&l){let Se=E[q];if(Se===void 0||!l(Se,q,E))continue}let X=q!==void 0?r[q]:void 0;if(X!==void 0){S=X-z,T=B,I=X;break}}if(!k&&g!==void 0&&m!==void 0){let A=w.get(g),B=A!==void 0?r[A]:void 0;if(B!==void 0){let z=co(e),q=B-m;if(q!==0&&x&&n.scroll+n.scrollLength>z)if(q>0)q=Math.max(0,z-n.scroll-n.scrollLength);else{let X=Math.max(0,z-n.scrollLength);n.scroll=X,n.scrollPending=X,q=0}S=q,T=g,I=B}}if(y&&y>0){let A=uo(e,g,v,n.props.data[v]),B=f?.itemSize;if(A!==void 0&&B!==void 0&&A!==B){let z=A-B;z!==0&&(S+=z*y,f.itemSize=A)}}if(K4(n,{anchorId:T,anchorPosition:I,dataChanged:t,now:d,positionDiff:S}),V4()){n.pendingNativeMVCPAdjust={amount:S,furthestProgressTowardAmount:0,manualApplied:0,startScroll:L},G4(e);return}Math.abs(S)>Io&&((n.maintainingScrollAtEnd==="pending-animated"||n.maintainingScrollAtEnd==="animated")&&Ce(e,"isWithinMaintainScrollAtEndThreshold")||Ys(e,S))}}}var oN=1e3,X4=200,zg=e=>{let{scrollHistory:t}=e,n=t.length-1;if(n<1)return 0;let o=t[n];if(Date.now()-o.time>oN)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>oN)break;if(c===0||f<=0)continue;let m=o.time-l.time,g=Math.exp(-m/X4);a+=c/f*g,i+=g}return i>0?a/i:0};function Y4(e){let t=e.mvcpAnchorLock;return t?Date.now()>t.expiresAt?(e.mvcpAnchorLock=void 0,!1):!0:!1}function $u(e){return e.dataChangeNeedsScrollUpdate||Y4(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:k,gt:E}=i;if(k&&t<k||E&&t>E){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?w4(e,t-f):void 0,x=j4(e,t),C=a.scrollLength,w=C>0&&c===void 0&&h>C&&!a.pendingNativeMVCPAdjust,L=zg(a);L4(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 k=()=>{var P;let _={doMVCP:c!==void 0,scrollVelocity:L};w&&(_.drawDistanceMode="visible-first"),(P=a.triggerCalculateItemsInView)==null||P.call(a,_),Dg(e,y)};w?(a.mvcpAnchorLock=void 0,a.pendingNativeMVCPAdjust=void 0,a.userScrollAnchorReset={keys:new Set},a.scheduledWork.cancel("mvcpRecalculate"),(0,LN.flushSync)(k),$N(e)):k();let E=!!a.pendingMaintainScrollAtEnd||!!((r=a.props.maintainScrollAtEnd)!=null&&r.onDataChange);x&&E&&(a.pendingMaintainScrollAtEnd=!1,yd(e)),a.dataChangeNeedsScrollUpdate=!1,a.lastScrollDelta=0}}function J4(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 Z4(e,t){var n;let{isInitialScroll:o,requestedOffset:r,targetOffset:a}=t,i=to.get(e),s=!e.didFinishInitialScroll&&(o||!!i)&&to.hasNonZeroTargetOffset(a),l=!e.didFinishInitialScroll&&!!i&&to.isAtZeroTargetOffset(r);if(s){e.hasScrolled=!1,to.set(e,{startScroll:(n=i?.startScroll)!=null?n:e.scroll,targetOffset:a});return}l&&to.clear(e)}function eW(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 rN(e,t){var n;let o=e.state.positions[t];if(o===void 0)return;let r=(n=$C(e,t))!=null?n:0;return o+(Number.isFinite(r)?r:0)}function tW(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)):eW(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=rN(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=rN(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 nW(e,t,n){let o=tW(e,t,n);o?(e.state.scrollTargetPinnedRange=o,e.state.scrollForNextCalculateItemsInView=void 0):e.state.scrollTargetPinnedRange=void 0}function Ug(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;Ng(r);let g=f?c:Bg(e,c,s),h=!!d&&((n=r.initialScrollSession)==null?void 0:n.kind)==="offset",v=zi(e,g,s),y=h?g:v;if(r.scrollHistory.length=0,!a){d&&_g.resetFlags(r);let x=J4(r);r.scrollingTo={...s,...x?{averageSizeSnapshot:x}:{},targetOffset:v,waitForInitialScrollCompletionFrame:p},d||nW(e,v,s.index)}r.scrollPending=v,Z4(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"?F4(e,{animated:l,horizontal:m,offset:y}):r.scroll=y}function GN(e,t){return t<=0?-1:e>=t?t-1:e<0?0:e}function Sg(e,{index:t,viewOffset:n=0,animated:o=!0,forceScroll:r,isInitialScroll:a,viewPosition:i}){let s=e.state,{data:l}=s.props;t=GN(t,l.length);let d=$C(e,t),c=Og(e,t);t===l.length-1&&i===void 0&&(i=1),s.scrollForNextCalculateItemsInView=void 0,Ug(e,{animated:o,forceScroll:r,index:t,isInitialScroll:a,itemSize:d,offset:c,viewOffset:n,viewPosition:i??0})}function Hg(e,t){let{forceScroll:n,resolvedOffset:o,target:r,waitForCompletionFrame:a}=t,i=r.index,s=i!==void 0?GN(i,e.state.props.data.length):void 0,l=$C(e,s);Ug(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&&UC(e,{resetInitialScroll:!0}),Xa(r,{kind:((o=r.initialScrollSession)==null?void 0:o.kind)==="offset"?"offset":"bootstrap"})}function qr(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?Og(e,t.index):0,i=Bg(e,a,t);return zi(e,i,t)}function jN(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 oW(e,t){var n,o,r;let a=e.state,i=jN(a,{requiresMeasuredLayout:!0});if(!i)return!1;let{initialScroll:s,isInitialScrollInProgress:l,queuedInitialLayout:d}=i,c=l?i.scrollingTo:void 0,f=qr(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 Hg(e,{forceScroll:v,resolvedOffset:f,target:s}),!0}function rW(e,t){var n,o;let r=e.state,a=jN(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 Hg(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"?rW(e,{forceScroll:t?.forceScroll}):oW(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=Qt(e,a);if(i===void 0||!e.sizesKnown.has(i))return!1}}return o}var $g=1,aW=8,iW=24,sW="LegendList bootstrap initial scroll aborted after exceeding convergence bounds.";function gr(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 lW(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 dW(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 cW(e){let{mountFrameCount:t,maxFrames:n=aW,maxPasses:o=iW,passCount:r}=e;return t>=n||r>=o}function QN(e,t){return cW(t)?(jo&&console.warn(sW),SW(e),!0):!1}function zu(e){var t;let n=gr(e),o=n?.frameHandle;o!==void 0&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(o),n&&(n.frameHandle=void 0),Xa(e,{bootstrap:null,kind:(t=e.initialScrollSession)==null?void 0:t.kind})}function XN(e,t){var n,o,r;let a=gr(e);Xa(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 uW(e,t){var n,o,r;let a=gr(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,Xa(e,{bootstrap:a,kind:"bootstrap"})):t?.scroll!==void 0&&XN(e,{scroll:t.scroll,seedContentOffset:t.seedContentOffset,targetIndexSeed:t.targetIndexSeed})}function TC(e){requestAnimationFrame(()=>{var t;gr(e)&&((t=e.triggerCalculateItemsInView)==null||t.call(e,{forceFullItemPositions:!0}))})}function KC(e){let t=e.state,n=gr(t);if(!n||n.frameHandle!==void 0)return;let o=()=>{let r=gr(t);r&&(r.frameHandle=void 0,r.mountFrameCount+=1,!QN(e,{mountFrameCount:r.mountFrameCount,passCount:r.passCount})&&KC(e))};n.frameHandle=requestAnimationFrame(o)}function Lg(e,t){uW(e.state,t),KC(e),TC(e.state)}function VC(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 fW(e){return!!e?.preserveForBottomPadding}function Qs(e){return!!e?.preserveForFooterLayout}function YN(e){return!!(e&&e.viewPosition===1&&(fW(e)||Qs(e)))}function pW(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 mW(e,t){return e.index===t.index&&e.preserveForBottomPadding===t.preserveForBottomPadding&&e.preserveForFooterLayout===t.preserveForFooterLayout&&e.viewOffset===t.viewOffset&&e.viewPosition===t.viewPosition}function Pg(e,t){let{dataLength:n,stylePaddingEnd:o,target:r}=t;if(!Qs(r))return;let a=VC({dataLength:n,footerSize:0,preserveForFooterLayout:void 0,stylePaddingEnd:o});js(e,a)}function gW(e){hd(e)}function qC(e,t,n=$g){let o=e.state;if(!o.didFinishInitialScroll)return!1;let r=Uu(o);return Math.abs(r-qr(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 JN(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 qr(e,o)-r}function ZN(e){return JN(e)===void 0?!1:(e_(e,{}),!0)}function e_(e,t){let n=e.state;n.preservedEndAnchorCorrection=t,requestAnimationFrame(()=>{var o;let r=n.preservedEndAnchorCorrection;if(r!==t)return;let a=JN(e);if(a===void 0||Math.abs(a)<=$g){n.preservedEndAnchorCorrection=void 0;return}(!r.lastRequestTime||((o=n.lastNativeScrollTime)!=null?o:0)>r.lastRequestTime)&&(r.lastRequestTime=Date.now(),Ys(e,a)),e_(e,t)})}function hW(e){var t;let n=e.state,o=n.initialScroll;!n.didFinishInitialScroll||(t=n.scrollingTo)!=null&&t.isInitialScroll||o?.viewPosition!==1||n.preservedEndAnchorCorrection||qC(e,o)&&(YN(o)&&Ce(e,"isAtEnd")||(Qs(o)?Pg(e,{dataLength:n.props.data.length,stylePaddingEnd:DC(n.props),target:o}):gW(n)))}function vW(e,t){var n,o,r;let{initialScrollAtEnd:a,target:i}=t,s=e.state,l=qr(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),vd(e,{resolvedOffset:l})):c?(zu(s),vd(e,{preserveTarget:!0,resolvedOffset:l})):(XN(s,{scroll:l,seedContentOffset:0,targetIndexSeed:i.index}),KC(e))}function yW(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=gr(s);if(!r&&o&&n>0&&s.didFinishInitialScroll&&!c&&!d){hd(s);return}let p=n>0&&(r||YN(l));if(!(!o&&!d&&!p)){if(p){let m=r?VC({dataLength:n,footerSize:Ce(e,"footerSize")||0,preserveForFooterLayout:Qs(l),stylePaddingEnd:i}):pW({dataLength:n,footerSize:Ce(e,"footerSize")||0,initialScrollAtEnd:r,stylePaddingEnd:i,target:l});if(!d&&qC(e,l)){Pg(e,{dataLength:n,stylePaddingEnd:i,target:l});return}if(!mW(l,m)||c||d||o){js(e,m,{resetDidFinish:d}),Lg(e,{scroll:qr(e,m),seedContentOffset:d&&!c?Uu(s):void 0,targetIndexSeed:m.index});return}}o&&(c||d)&&(js(e,l,{resetDidFinish:d}),Lg(e,{scroll:qr(e,l),seedContentOffset:d&&!c?Uu(s):void 0,targetIndexSeed:l.index}))}}function xW(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||!(gr(i)||Qs(s))))if(qC(e,s))Pg(e,{dataLength:n,stylePaddingEnd:a,target:s});else{let d=VC({dataLength:n,footerSize:o,preserveForFooterLayout:Qs(s),stylePaddingEnd:a});if(!(s.index!==d.index||s.viewPosition!==d.viewPosition||s.viewOffset!==d.viewOffset))Pg(e,{dataLength:n,stylePaddingEnd:a,target:s});else{let f=!!i.didFinishInitialScroll;js(e,d,{resetDidFinish:f}),Lg(e,{scroll:qr(e,d),targetIndexSeed:d.index})}}}function CW(e){var t,n,o;let r=e.state,a=r.initialScroll,i=gr(r);if(a&&r.props.data.length>0&&!Js(r)&&(i||a.viewPosition===1)){let s=qr(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)>$g){if(r.didFinishInitialScroll)ZN(e);else if(l){let f=to.get(r);l.offset=s,l.targetOffset=s,r.initialScroll={...a,contentOffset:s},r.hasScrolled=!1,to.set(r,{startScroll:(o=f?.startScroll)!=null?o:r.scroll,targetOffset:s}),Ys(e,c)}}}else Lg(e,{scroll:s,targetIndexSeed:a.index})}}function bW(e){var t,n;let o=e.state,r=gr(o),a=o.initialScroll;if(!r||!a||Js(o)||(t=o.scrollingTo)!=null&&t.isInitialScroll||(r.passCount+=1,QN(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=qr(e,a),s=_u(o,o.startBuffered,o.endBuffered),l=Math.abs(r.scroll-i)>1,{data:d}=o.props,c=dW({dataLength:d.length,getSize:h=>{var v,y;let x=(v=o.idCache[h])!=null?v:Qt(o,h);return(y=o.sizes.get(x))!=null?y:uo(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:Qt(o,h);return o.sizesKnown.has(y)}),p=r.previousResolvedOffset,m=r.visibleIndices;if(r.previousResolvedOffset=i,r.visibleIndices=c,l){r.scroll=i,TC(o);return}if(!s||!f)return;if(!(p!==void 0&&Math.abs(p-i)<=$g&&lW(m,c))){TC(o);return}zu(o),Hg(e,{forceScroll:!0,resolvedOffset:i,target:a,waitForCompletionFrame:Qa.OS==="web"})}function wW(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;vd(e,{preserveTarget:r,recalculateItems:!0,resolvedOffset:t,schedulePreservedTargetClear:r})}function SW(e){var t,n,o,r;let a=e.state,i=gr(a),s=a.initialScroll;i&&s&&!Js(a)&&a.refScroller.current?(zu(a),Hg(e,{forceScroll:!0,resolvedOffset:i.scroll,target:s,waitForCompletionFrame:Qa.OS==="web"})):wW(e,(r=(o=(n=(t=gr(a))==null?void 0:t.scroll)!=null?n:a.scrollPending)!=null?o:a.scroll)!=null?r:0)}function t_(e,t,n,o){return{dataChangeEpoch:e.dataChangeEpoch,getFixedItemSize:e.props.getFixedItemSize,getItemType:e.props.getItemType,itemData:n,itemIndex:t,itemType:o}}function IW(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=t_(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 n_(e){for(let t of e.containerItemMetadata.values())t.didResolveFixedItemSize=!1,t.fixedItemSize=void 0}var TW=20,kW=1,LW=1,vC=16;function WC(e,t){let n=e.state.scrollingTo;t?.onlyIfAligned&&(!n?.isInitialScroll||n.animated||!GC(e,n).isAtResolvedTarget)||e.state.scheduledWork.frame(()=>MW(e),"checkFinishedScrollFrame")}function PW(e,t){let{clampedTargetOffset:n,scrollingTo:o}=t;return!o.isInitialScroll||e.hasScrolled||n<=kW}function AW(e,t){return!!t?.isInitialScroll&&_g.didDispatchNativeScroll(e)&&!e.hasScrolled}function o_(e){var t;return(t=to.get(e))==null?void 0:t.targetOffset}function r_(e){let t=o_(e);return!e.didFinishInitialScroll&&to.hasNonZeroTargetOffset(t)}function aN(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 to.hasNonZeroTargetOffset(r)&&_g.didDispatchNativeScroll(e)&&!e.hasScrolled||to.isAtZeroTargetOffset(r)||Math.abs(e.scroll-r)>1||Math.abs(e.scrollPending-r)>1?!1:!!t.waitForInitialScrollCompletionFrame||r_(e)}function iN(e){var t;let{state:n}=e;return!!((t=n.scrollingTo)!=null&&t.isInitialScroll)&&n.props.data.length>0&&co(e)<=n.scrollLength&&n.scrollPending<=LW}function EW(e,t){return t.index===e.state.props.data.length-1&&t.viewPosition===1}function RW(e,t){var n;let o=t.index,a=EW(e,t)&&o!==void 0?Bg(e,Og(e,o),t):(n=t.targetOffset)!=null?n:zi(e,t.offset-(t.viewOffset||0),t);return zi(e,a,t)}function GC(e,t){let{state:n}=e,o=n.scrollPending,r=n.scrollAdjustHandler.getAdjust(),a=RW(e,t),i=zi(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 MW(e){let t=e.state.scrollingTo;if(!t)return;let{state:n}=e,o=GC(e,t);o.isAtResolvedTarget&&PW(n,{clampedTargetOffset:o.clampedTargetOffset,scrollingTo:t})&&Fu(e)}function NW(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 _W(e){let t=e.state;if(t.scheduledWork.has("checkFinishedScrollFallback"))return;let n=t.scrollingTo,o=iN(e),r=AW(t,n),a=n!==void 0?aN(t,n):!1,i=n?.isInitialScroll&&!o&&!a||!t.didContainersLayout,s=o||a?0:r?vC: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=r_(t)&&!t.hasScrolled,h=r?5:g?TW:5,v=iN(e),y=aN(t,m),x=GC(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=o_(t))!=null?f:m.targetOffset)!=null?p:t.scrollPending;NW(e,S),d(r?vC:100)}else d(r?vC:100)}};d(s)}function a_(e){var t;let n=e.state,o=n.initialScroll;return n.didFinishInitialScroll?ZN(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 DW(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),WC(e,{onlyIfAligned:!0})}function OW(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"){vW(e,{initialScrollAtEnd:l,target:c.initialScroll});return}!r&&!p&&!(f&&a===0&&!(p===0&&!l))&&(f&&!l?vd(e,{resolvedOffset:p}):HC(e,{didInitialScroll:!0}))}function FW(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),Xa(m,{kind:c,previousDataLength:g})):hd(m)),m.initialScrollSession&&(m.initialScrollSession.previousDataLength=a),Xa(m),p){yW(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&&UC(e,{resetInitialScroll:!0}),Bu(e))}function i_(e){e.indexByKey.clear(),e.idCache.length=0,e.positions.length=0,e.columns.length=0,e.columnSpans.length=0}function BW(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 Ag(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=Ce(e,"containerLayoutEpoch"))!=null?n:0)+1;Fe(e,"containerLayoutEpoch",a)}}function zW(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:Qt(m,n),S=(a=o?.updateLayout)!=null?a:!0,T=!1,I=!1;if(S){let _=v[n];if(_===void 0)return Fe(e,`containerPosition${t}`,gd),{didChangePosition:!1,didRefreshData:!1};let A=(_||0)-((i=o?.scrollAdjustPending)!=null?i:0),B=(s=m.sizes.get(L))!=null?s:uo(e,L,n,w),z=Zq(m,A,B,Ce(e,"totalSize")),q=g[n]||1,X=h[n]||1,Se=Ce(e,`containerPosition${t}`),K=Ce(e,`containerColumn${t}`),W=Ce(e,`containerSpan${t}`);z>gd&&z!==Se&&(Fe(e,`containerPosition${t}`,z),T=!0),q>=0&&q!==K&&Fe(e,`containerColumn${t}`,q),X!==W&&Fe(e,`containerSpan${t}`,X)}Ce(e,`containerItemIndex${t}`)!==n&&Fe(e,`containerItemIndex${t}`,n);let E=Ce(e,`containerItemData${t}`),P=()=>{Fe(e,`containerItemData${t}`,w),I=!0};if(E!==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,A=(c=_?.byIndex[n])!=null?c:0;if(A===2)P();else if(A!==1){let B=(f=Ce(e,`containerItemKey${t}`))!=null?f:L,z=C?.(E,n);if(E===void 0||!C||z!==B)P();else if(!x)P();else{let q=x(E,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]=q?1:2),q||P()}}}return{didChangePosition:T,didRefreshData:I}}function UW(e,t,n){var o;let r=e.state,a=Ce(e,"numColumns"),i=t;r.columns[t]!==1&&(i=sN(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=sN(r,a,c),m=HW(e,p,c,n);l=f+m}return{column:d,currentRowTop:l,startIndex:i}}function sN(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 HW(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=uo(e,l,s,a[s],o);d>i&&(i=d)}return i}function $W(e){var t,n;let o=e.state,{positions:r,props:{data:a}}=o,i=(t=Ce(e,"numColumns"))!=null?t:1;if(a.length===0)Mu(e,null,0);else{let s=a.length-1,l=Qt(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:Qt(o,p),g=uo(e,m,p,a[p]);g>f&&(f=g)}Mu(e,null,d+f)}else{let c=uo(e,l,s,a[s]);if(c!==void 0){let f=d+c;Mu(e,null,f)}}}}function s_(e){let t=e.state,{props:{snapToIndices:n}}=t,o=t.props.horizontal?co(e):void 0,r=Array(n.length);for(let a=0;a<n.length;a++){let i=n[a];Qt(t,i);let s=t.positions[i];r[a]=OC(t,s,o)}Fe(e,"snapToOffsets",r)}function l_(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:T},scrollingTo:I}=m,k=L.length,E=(l=Ce(e,"numColumns"))!=null?l:1,P=E>1,_=jo?new Map:void 0,A=Ce(e,"extraData"),B=S?{span:1}:void 0,z=m.lastScrollDelta,q=i??zg(m),X=!o&&!t&&(r||Math.abs(q)>0||m.scrollLength>0&&z>m.scrollLength),Se=a+1e3,K=!0,W=!n||t||m.scrollAdjustHandler.getAdjust()!==0||((d=Ce(e,"scrollAdjustPending"))!=null?d:0)!==0,Z=!1,j=0,O=1,Y=0;if(t&&(v.length=0),P||(h.length&&(h.length=0),v.length&&(v.length=0)),s>0){if(P){let{startIndex:ae,currentRowTop:Le}=UW(e,s,K);s=ae,j=Le}else if(s<k){let ae=s-1,Le=Qt(m,ae),et=(c=x[ae])!=null?c:0,Ge=(f=w.get(Le))!=null?f:uo(e,Le,ae,L[ae],K,W,Z);j=et+Ge}}let re=t||y.size===0,ue=P&&!!S&&!!B,le=!1,fe;for(let ae=s;ae<k;ae++){if(X&&fe!==void 0&&ae>fe){le=!0;break}X&&fe===void 0&&!I&&!t&&j>Se&&(fe=ae+(P?E:1)+10);let Le=(p=C[ae])!=null?p:Qt(m,ae),et=1;if(ue){B.span=1,S(B,L[ae],ae,E,A);let $e=B.span;$e!==void 0&&Number.isFinite($e)&&(et=Math.max(1,Math.min(E,Math.round($e))))}P&&O+et-1>E&&(j+=Y,O=1,Y=0);let Ge=w.get(Le),rt=Ge!==void 0?Ge:uo(e,Le,ae,L[ae],K,W,Z);jo&&re&&(_.has(Le)&&console.error(`[legend-list] Error: Detected overlapping key (${Le}) which causes missing items and gaps and other terrrible things. Check that keyExtractor returns unique values.`),_.set(Le,ae)),j!==x[ae]&&(x[ae]=j,g&&s4(e,Le,j)),re&&y.set(Le,ae),P?(h[ae]=O,v[ae]=et,rt>Y&&(Y=rt),O+=et,O>E&&(j+=Y,O=1,Y=0)):j+=rt}le||$W(e),T&&s_(e)}function d_(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 KW(e){let{viewabilityConfig:t,viewabilityConfigCallbackPairs:n,onViewableItemsChanged:o}=e;return(t||o)&&(n=[...n||[],{onViewableItemsChanged:o,viewabilityConfig:t||{viewAreaCoveragePercentThreshold:0}}]),n}function c_(e,t,n,o,r,a,i=r,s=a){let{props:{data:l}}=e;for(let d of n){let c=d_(t,d.viewabilityConfig.id);c.start=r,c.end=a,c.startBuffered=i,c.endBuffered=s,d.viewabilityConfig.minimumViewTime?e.scheduledWork.timeout(()=>lN(l,d,e,t,o),d.viewabilityConfig.minimumViewTime):lN(l,d,e,t,o)}}function lN(e,t,n,o,r){let{viewabilityConfig:a,onViewableItemsChanged:i}=t,s=a.id,l=d_(o,s),{viewableItems:d,start:c,end:f,startBuffered:p,endBuffered:m}=l,g;for(let[x,C]of o.mapViewabilityAmountValues)u_(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=IC(o,x.key),S=!1;C!==void 0&&w!==void 0&&(S=cN(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=Qt(n,x),L=IC(o,w);if(cN(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];VW(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 dN(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 u_(e,t,n,o,r,a,i,s){let{sizes:l,scroll:d}=e,c=(Ce(t,"stylePaddingTop")||0)+(Ce(t,"alignItemsAtEndPadding")||0)+(Ce(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},A=t.mapViewabilityAmountValues.get(o);if(!dN(A,_)){t.mapViewabilityAmountValues.set(o,_);let B=t.mapViewabilityAmountCallbacks.get(o);B&&B(_)}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,T=y?100*(L/a):0,k=(w?100:m?T:S)>=g,E={containerId:o,index:s,isViewable:k,item:i,key:r,percentOfScroller:T,percentVisible:S,scrollSize:a,size:y,sizeVisible:L},P=t.mapViewabilityAmountValues.get(o);if(!dN(P,E)){t.mapViewabilityAmountValues.set(o,E);let _=t.mapViewabilityAmountCallbacks.get(o);_&&_(E)}return E}function cN(e,t,n,o,r,a,i,s){let l=t.mapViewabilityAmountValues.get(o);return(!l||l.key!==r||l.index!==s)&&(l=u_(e,t,n,o,r,a,i,s)),l.isViewable}function VW(e,t,n,o){let r=n+t;e.mapViewabilityValues.set(r,o);let a=e.mapViewabilityCallbacks.get(r);a?.(o)}var uN=kN.unstable_batchedUpdates,qW=typeof uN=="function"?uN:e=>e(),WW=32,GW=64,jW=3;function QW(e,t){if(e<=0||t<=0)return 0;let n=Math.ceil(t*jW),o=t+GW,r=Math.max(t,Math.min(n,o),Math.min(e,WW)),a=Math.max(e,t);return Math.min(a,r)}function XW(e,t){return e<=0||t<=0?0:Math.min(Math.max(e,t),Math.max(t,Math.ceil(t*1.5)))}function YW(e,t,n,o,r,a,i){var s;let l=t.length;if(l===0)return[];let d=Ce(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((E,P)=>({isSticky:c.props.stickyHeaderIndicesSet.has(E),itemIndex:E,itemType:a?.(E),order:P})),v=h.filter(E=>!E.isSticky),y=h.filter(E=>E.isSticky),x=[],C=[];for(let E=0;E<d;E++){let P=Ce(e,`containerItemKey${E}`),_=!!g?.has(E);if(!(P&&i?.has(P)&&c.indexByKey.has(P))){if(p.has(E))(P===void 0||_)&&C.push({containerIndex:E,distance:Number.POSITIVE_INFINITY});else if(P===void 0||_)x.push({containerIndex:E,distance:Number.POSITIVE_INFINITY});else if(!m){let B=c.indexByKey.get(P);if(B!==void 0&&(B<n||B>o)){let z=B<n?n-B:B-o;x.push({containerIndex:E,distance:z})}}}}x.sort(JW);let w=new Array(l),L=d,S=!1,T=(E,P)=>{w[E.order]={containerIndex:P,itemIndex:E.itemIndex,itemType:E.itemType},g?.delete(P)&&(S=!0)},I=(E,P,_)=>{for(let A of E){if(w[A.order])continue;let B=P.findIndex(z=>{var q;return _((q=f.get(z.containerIndex))==null?void 0:q.itemType,A.itemType)});if(B!==-1){let[z]=P.splice(B,1);T(A,z.containerIndex)}}},k=(E,P,_)=>{a&&I(E,P,(A,B)=>B!==void 0&&A===B),I(E,P,A=>A===void 0),_&&I(E,P,()=>!0)};k(v,x,!0),k(y,C,!1);for(let E of h){if(w[E.order])continue;let P=L++;E.isSticky&&p.add(P),T(E,P)}if(S&&(r.length=0,g))for(let E of g)r.push(E);if(jo){let E=(s=Ce(e,"numContainersPooled"))!=null?s:Number.POSITIVE_INFINITY;L>E&&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:E,numNeeded:l,stillNeeded:L-d}})}return w}function JW(e,t){return t.distance-e.distance}function ZW(e){let t=e.state;t.queuedInitialLayout=!0,BN(e),HC(e,{didLayout:!0})}var eG=4,tG=100;function nG(e,t){if(t<=0)return 0;let n=Math.min(1,Math.abs(e)/eG);return Math.sign(e)*t*n}function oG(e){let t=e.state;t.scheduledWork.timeout(()=>{var n;t.scrollHistory.length=0,(n=t.triggerCalculateItemsInView)==null||n.call(t)},tG,"renderRangeProjection")}function rG(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 aG(e,t){let n=e.state,o=!1;for(let r of n.stickyContainerPool){let a=Ce(e,`containerItemKey${r}`);if((a?n.indexByKey.get(a):void 0)===t){o=!0;break}}return o}function iG(e,t,n,o,r,a,i){var s;let l=e.state;Fe(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(aG(e,f))continue;let p=(s=l.idCache[f])!=null?s:Qt(l,f);p&&!l.containerItemKeys.has(p)&&(f<a||f>i)&&!r.has(f)&&(r.add(f),o.push(f))}}function sG(e,t,n,o,r,a,i){var s,l;let d=e.state;for(let c of d.stickyContainerPool){let f=Ce(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),Fe(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:Qt(d,p);if(y){let x=d.positions[p],C=(l=d.sizes.get(y))!=null?l:uo(e,y,p,d.props.data[p]);v=x!==void 0&&n>x+C+o*3}}v&&a.push(c)}}function f_(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 p_(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:Qt(e,i);r.push(s)}return r}function kC(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:Qt(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 lG(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:Qt(r,f),m=(o=d.get(p))!=null?o:uo(e,p,f,l[f]);if(s[f]+m>t)return f}return null}function dG(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:Qt(s,h),y=(i=p.get(v))!=null?i:uo(e,v,h,f[h]),x=c[h];if(f_(g,h,x,y,o,r))break}Object.assign(s,{endNoBuffer:g.endNoBuffer,firstFullyOnScreenIndex:g.firstFullyOnScreenIndex,idsInView:p_(s,g),startNoBuffer:g.startNoBuffer}),kC(s,g.startNoBuffer),g.startNoBuffer!==null&&g.endNoBuffer!==null&&c_(s,e,t,n,g.startNoBuffer,g.endNoBuffer,m,l)}function ja(e,t={}){let n=e.state;qW(()=>{var o,r,a,i,s,l,d,c,f,p,m,g,h,v,y,x,C,w,L,S,T;let{columns:I,containerItemKeys:k,enableScrollForNextCalculateItemsInView:E,idCache:P,indexByKey:_,minIndexSizeChanged:A,positions:B,props:{alwaysRenderIndicesArr:z,alwaysRenderIndicesSet:q,getItemType:X,keyExtractor:Se,onStickyHeaderChange:K},scrollForNextCalculateItemsInView:W,scrollLength:Z,sizes:j,startBufferedId:O,viewabilityConfigCallbackPairs:Y}=n,{data:re}=n.props,ue=n.props.stickyHeaderIndicesArr||[],le=n.props.stickyHeaderIndicesSet||new Set,fe=HN(e,t.drawDistanceMode),{dataChanged:ae,doMVCP:Le,forceFullItemPositions:et}=t,Ge=((o=n.initialScrollSession)==null?void 0:o.kind)==="bootstrap"?n.initialScrollSession.bootstrap:void 0,rt=!!Ge,$e=Ce(e,"numContainers");if(!re||Z===0||!$e)return;let te=co(e),Pe,Q=Ce(e,"stylePaddingTop")+Ce(e,"alignItemsAtEndPadding")+Ce(e,"headerSize"),$=Ce(e,"numColumns"),oe=(r=t.scrollVelocity)!=null?r:zg(n),ve=0,{initialScroll:at,queuedInitialLayout:Et}=n,Rt=rt?(a=Ge?.scroll)!=null?a:n.scroll:!Et&&Ru(n)&&at?qr(e,at):n.scroll,_t=0,an=0,mt=0,Wt=0,Ot=0,vt=0,Sn=Rt,ft=ge=>{var tt;Sn=ge,_t=(tt=Ce(e,"scrollAdjustPending"))!=null?tt:0,an=_t-Q,mt=Math.round(ge+ve+an),mt+Z>te&&(mt=Math.max(0,te-Z))};ft(Rt);let pn=Ce(e,"activeStickyIndex"),no=()=>{let ge=ue.length>0?rG(ue,mt,n):-1,tt=ge>=0?ue[ge]:-1,Ct=pn!==tt;(ge>=0||pn>=0)&&Fe(e,"activeStickyIndex",tt);let lt=!!K&&ue.length>0&&Ct;return{currentStickyIdx:ge,finishCalculateItemsInView:lt?()=>{let Ln=re[tt];Ln!==void 0&&K?.({index:tt,item:Ln})}:void 0}},Xt=ae?void 0:no(),In=fe,En=fe;oe>0||oe===0&&mt<Math.max(50,fe)?(In=fe*.5,En=fe*1.5):(In=fe*1.5,En=fe*.5);let Rn=!ae&&!et&&!rt&&!Ru(n)&&!n.scrollingTo&&!n.pendingNativeMVCPAdjust&&!!Ce(e,"readyToRender")?nG(oe,Math.min(In,En)):0,F=()=>{let ge=Math.max(0,mt),tt=Math.max(0,-Sn);Ot=Math.max(ge,mt+Z+tt),Wt=ge-In+Rn,vt=Ot+En+Rn};if(F(),Rn!==0&&oG(e),E&&!rt&&!ae&&!et&&W){let{top:ge,bottom:tt}=W;if(ge===null&&tt===null)n.scrollForNextCalculateItemsInView=void 0;else if((ge===null||Wt>ge)&&(tt===null||vt<tt)&&!$u(n)){Y?dG(e,Y,Z,mt,Ot):n.props.onFirstVisibleItemChanged&&kC(n,lG(e,mt)),(i=Xt?.finishCalculateItemsInView)==null||i.call(Xt);return}}let ce=Le&&!rt?Q4(e,ae):void 0;ae&&i_(n);let be=et||ae?0:(s=A??n.startBuffered)!=null?s:0,ke=!et&&!ae&&$>1&&A!==void 0;l_(e,ae,{doMVCP:Le,forceFullUpdate:!!et,optimizeForVisibleWindow:ke,scrollBottomBuffered:vt,scrollVelocity:oe,startIndex:be}),te=co(e),A!==void 0&&(n.minIndexSizeChanged=void 0);let Re;if(ae&&Le&&n.props.maintainVisibleContentPosition.data&&n.didContainersLayout&&n.idsInView.length>0){let ge=n.props.maintainVisibleContentPosition.shouldRestorePosition;Re=new Set;for(let tt of n.idsInView){let Ct=_.get(tt);Ct!==void 0&&(ge&&!ge(re[Ct],Ct,re)||Re.add(tt))}}let st=n.scroll,ln=(l=Ce(e,"scrollAdjustPending"))!=null?l:0;ce?.(),ce&&(n.scroll!==st||((d=Ce(e,"scrollAdjustPending"))!=null?d:0)!==ln)&&(ft(n.scroll),F()),ae&&(Xt=no());let ct=null,kt=null,Ft=null,Pt=(c=rt?Ge?.targetIndexSeed:void 0)!=null?c:!ae&&O&&_.get(O)||0;for(let ge=Pt;ge>=0;ge--){let tt=(f=P[ge])!=null?f:Qt(n,ge),Ct=B[ge],lt=(p=j.get(tt))!=null?p:uo(e,tt,ge,re[ge]);if(Ct+lt>Wt)Pt=ge;else break}if($>1)for(;Pt>0;){let ge=I[Pt];if(ge===1||ge===void 0)break;Pt-=1}let Ut=!1,ht,we,Ve=0;for(let ge=0;ge<$e;ge++){let tt=Ce(e,`containerItemKey${ge}`);if(tt!==void 0){let Ct=_.get(tt);Ve=Math.max(Ve,Ct)}}let qe={endNoBuffer:null,firstFullyOnScreenIndex:void 0,startNoBuffer:null},We=re.length;for(let ge=Math.max(0,Pt);ge<We&&(!Ut||ge<=Ve);ge++){let tt=(m=P[ge])!=null?m:Qt(n,ge),Ct=(g=j.get(tt))!=null?g:uo(e,tt,ge,re[ge]),lt=B[ge];Ut||(f_(qe,ge,lt,Ct,mt,Ot),ct===null&<+Ct>Wt&&(ct=ge,kt=tt,Wt<0?ht=null:ht=lt),qe.startNoBuffer!==null&&(lt<=vt?(Ft=ge,vt>te?we=null:we=lt+Ct):Ut=!0))}Object.assign(n,{endBuffered:Ft,endNoBuffer:qe.endNoBuffer,firstFullyOnScreenIndex:qe.firstFullyOnScreenIndex,idsInView:p_(n,qe),startBuffered:ct,startBufferedId:kt,startNoBuffer:qe.startNoBuffer}),E&&ht!==void 0&&we!==void 0&&(n.scrollForNextCalculateItemsInView=Nu(ht)&&Nu(we)?void 0:{bottom:we,top:ht});let ot=$e,yt=[];if(ae)for(let ge=0;ge<ot;ge++){let tt=Ce(e,`containerItemKey${ge}`);(!Se||tt&&_.get(tt)===void 0)&&yt.push(ge)}let ye=n.scrollTargetPinnedRange,xt=0,pt=-1;ye&&(xt=Math.max(0,Math.min(ye.start,ye.end)),pt=Math.min(We-1,Math.max(ye.start,ye.end)));let Ht=xt<=pt,Tn=ge=>q.has(ge)||Ht&&ge>=xt&&ge<=pt;if(ct!==null&&Ft!==null){let ge=[],tt=new Set,Ct=lt=>{var Ln;if(lt>=0&<<We){let Bt=(Ln=P[lt])!=null?Ln:Qt(n,lt),Mt=k.get(Bt);Mt!==void 0?n.stickyContainerPool.add(Mt):!Nu(Bt)&&!tt.has(lt)&&(tt.add(lt),ge.push(lt))}};for(let lt=ct;lt<=Ft;lt++){let Ln=(h=P[lt])!=null?h:Qt(n,lt);k.has(Ln)||(tt.add(lt),ge.push(lt))}for(let lt of z)Ct(lt);if(Ht)for(let lt=xt;lt<=pt;lt++)Ct(lt);if(ue.length>0?iG(e,ue,(v=Xt?.currentStickyIdx)!=null?v:-1,ge,tt,ct,Ft):pn!==-1&&Fe(e,"activeStickyIndex",-1),ge.length>0){let Ln=YW(e,ge,ct,Ft,yt,X?Bt=>{let Mt=X(re[Bt],Bt);return Mt!==void 0?String(Mt):""}:void 0,Re);for(let Bt of Ln){let Mt=Bt.itemIndex,Yt=Bt.containerIndex,Pn=(y=P[Mt])!=null?y:Qt(n,Mt),zt=Ce(e,`containerItemKey${Yt}`);zt&&zt!==Pn&&k.delete(zt),zt!==Pn&&(Pe??(Pe=new Set),Pe.add(Yt),n.containerItemGenerations[Yt]=((x=n.containerItemGenerations[Yt])!=null?x:0)+1),Fe(e,`containerItemKey${Yt}`,Pn),Fe(e,`containerItemIndex${Yt}`,Mt),Fe(e,`containerItemData${Yt}`,re[Mt]),n.containerItemMetadata.set(Yt,t_(n,Mt,re[Mt],Bt.itemType)),k.set(Pn,Yt),(C=n.userScrollAnchorReset)==null||C.keys.add(Pn);let To=`containerSticky${Yt}`,hr=le.has(Mt),ei=Tn(Mt);hr?(Fe(e,To,!0),n.stickyContainerPool.add(Yt)):(Ce(e,To)&&Fe(e,To,!1),ei?n.stickyContainerPool.add(Yt):n.stickyContainerPool.delete(Yt)),Yt>=ot&&(ot=Yt+1)}ot!==$e&&(Fe(e,"numContainers",ot),ot>Ce(e,"numContainersPooled")&&Fe(e,"numContainersPooled",XW(We,ot)))}((w=n.userScrollAnchorReset)==null?void 0:w.keys.size)===0&&(n.userScrollAnchorReset=void 0)}n.stickyContainerPool.size>0&&sG(e,ue,mt,fe,(L=Xt?.currentStickyIdx)!=null?L:-1,yt,Tn);let mn=yt.length>0?new Set(yt):void 0,kn=!1;for(let ge=0;ge<ot;ge++){let tt=Ce(e,`containerItemKey${ge}`);if(mn?.has(ge))tt!==void 0&&(k.delete(tt),Pe??(Pe=new Set),Pe.add(ge),n.containerItemGenerations[ge]=((S=n.containerItemGenerations[ge])!=null?S:0)+1),n.containerItemMetadata.delete(ge),n.stickyContainerPool.has(ge)&&(Fe(e,`containerSticky${ge}`,!1),n.stickyContainerPool.delete(ge)),Fe(e,`containerItemKey${ge}`,void 0),Fe(e,`containerItemIndex${ge}`,void 0),Fe(e,`containerItemData${ge}`,void 0),Fe(e,`containerPosition${ge}`,gd),Fe(e,`containerColumn${ge}`,-1),Fe(e,`containerSpan${ge}`,1);else{let Ct=_.get(tt);Ct!==void 0&&(kn=zW(e,ge,Ct,{scrollAdjustPending:_t,updateLayout:!0}).didChangePosition||kn)}}if(Pe&&FC&&Ag(e,Pe),kn&&Fe(e,"lastPositionUpdate",Date.now()),rt){bW(e);return}kC(n,qe.startNoBuffer),!Et&&!n.didContainersLayout&&(Ru(n)?_u(n,n.startBuffered,n.endBuffered):_u(n,n.startNoBuffer,n.endNoBuffer)||_u(n,n.startBuffered,n.endBuffered))&&(ZW(e),DW(e)),Y&&qe.startNoBuffer!==null&&qe.endNoBuffer!==null&&c_(e.state,e,Y,Z,qe.startNoBuffer,qe.endNoBuffer,ct??qe.startNoBuffer,Ft??qe.endNoBuffer),(T=Xt?.finishCalculateItemsInView)==null||T.call(Xt)})}function Eg(e){var t,n;let o=e.state,r=o.props.anchoredEndSpace,a=Ce(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=Qt(o,h);let C=0,w=!1;for(let S=h;S<x.length;S++){let T=WN(e,S),I=S===h&&v!==void 0?Math.min(T||0,Math.max(0,v)):T;T===void 0&&(w=!0),I!=null&&I>0&&(C+=I)}C=Math.max(0,C-e.scrollAxisGap),C+=(e.values.get("footerSize")||0)+DC(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&&(Fe(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)&&(Fe(e,"anchoredEndSpaceSize",f),(t=r?.onSizeChanged)==null||t.call(r,f),r?.includeInEndInset&&Gs(e,o.scroll,!0,{markHasScrolled:!1})),f}function cG(e){var t;let n=e.state;n.userScrollAnchorReset!==void 0?(ja(e),((t=n.userScrollAnchorReset)==null?void 0:t.keys.size)===0&&(n.userScrollAnchorReset=void 0)):n.mvcpAnchorLock?n.scheduledWork.has("mvcpRecalculate")||n.scheduledWork.frame(()=>ja(e,{doMVCP:!0}),"mvcpRecalculate"):(n.scheduledWork.cancel("mvcpRecalculate"),ja(e,{doMVCP:!0}))}function fN(e,t,n){if(e.state.needsOtherAxisSize){let r=n?t.height:t.width,a=Ce(e,"otherAxisSize");(!a||r>a)&&Fe(e,"otherAxisSize",r)}}var Wa;function m_(e){let t=Wa===void 0;Wa??(Wa=new Map);try{e()}finally{if(t){let n=Wa;Wa=void 0;for(let[o,r]of n)jC(o,r)}}}function uG(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 fG(e,t){var n;let o=e.state;t.needsRecalculate?(o.scrollForNextCalculateItemsInView=void 0,cG(e)):t.didMeasureUserScrollAnchorResetItem&&((n=o.userScrollAnchorReset)==null?void 0:n.keys.size)===0&&(o.userScrollAnchorReset=void 0),t.didChange&&Eg(e),t.didChange&&t.shouldMaintainScrollAtEnd&&yd(e)}function g_(e,t){if(Wa){let n=Wa.get(e);n?n.push(t):Wa.set(e,[t])}else jC(e,[t])}function jC(e,t){var n;let o=e.state,r={};for(let a of t)if(a.containerId===void 0||Ce(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?IW(o,a.containerId,s,l):void 0,c=pG(e,a.itemKey,a.size,d);uG(r,c)}fG(e,r)}function pG(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 E=(a=o?.itemType)!=null?a:p&&(r=p(I,y))!=null?r:"";o={didResolveFixedItemSize:!0,fixedItemSize:f(I,y,E),itemType:E}}let k=o.fixedItemSize;if(k!==void 0&&k===c.get(t))return fN(e,n,m),{didMeasureUserScrollAnchorResetItem:l}}let x=!d,C=!1,w,L=i.sizesKnown.get(t),S=mG(e,t,n,o),T=Ou(m?n.width:n.height);if(S!==0){w=w!==void 0?Math.min(w,y):y;let{startBuffered:I,endBuffered:k}=i;x||(x=y>=I&&y<=k),!x&&i.containerItemKeys.has(t)&&(x=!0),(L===void 0||Math.abs(L-T)>5)&&(C=!0),g?.({index:y,itemData:i.props.data[y],itemKey:t,previous:T-S,size:T})}if(w!==void 0&&(i.minIndexSizeChanged=i.minIndexSizeChanged!==void 0?Math.min(i.minIndexSizeChanged,w):w),fN(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 mG(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=uo(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 T=d[v];T||(T=d[v]={avg:0,num:0}),T.num===0?(T.avg=S,T.num++):L!==void 0&&L>0?T.avg+=(S-L)/T.num:(T.avg=(T.avg*T.num+S)/(T.num+1),T.num++)}return!C||Math.abs(C-S)>.1?(SC(e,t,S),S-C):0}function gG(e,t=null){let n=[],o=t??e.viewRefs.keys();for(let r of o){let a=e.viewRefs.get(r),i=Ce(e,`containerItemKey${r}`),s=a?.current;if(i!==void 0&&s){let l=s.getBoundingClientRect();f4(s,l),n.push({containerId:r,itemKey:i,size:{height:l.height,width:l.width}})}}n.length>0&&jC(e,n)}var h_=$n,Ca=me,hG=Ca(function({children:t}){let n=Wr(),[o]=Qo(["containerLayoutEpoch"]);return he(()=>{{let r=BW(n);r!==void 0&&gG(n,r)}},[n,o]),t}),Ig=e=>gh(e)?e:e?Ne(e,null):null,vG=typeof document<"u"&&!!document.getElementById("react-native-stylesheet"),LC={contain:"paint layout style",...vG?{display:"flex",flexDirection:"column"}:{}},yG=Ca(function({id:t,horizontal:n,style:o,refView:r,...a}){let[i=gd]=Qo([`containerPosition${t}`]),s=Fg(o)?Object.assign({},...o):o,l=n?{...LC,...s,left:i}:{...LC,...s,top:i},{animatedScrollY:d,onLayout:c,onLayoutChange:f,stickyHeaderConfig:p,...m}=a;return Ne("div",{ref:r,...m,style:l})}),xG=Ca(function({id:t,horizontal:n,style:o,refView:r,animatedScrollY:a,stickyHeaderConfig:i,onLayout:s,onLayoutChange:l,children:d,...c}){let[f=gd,p,m]=Qo([`containerPosition${t}`,"activeStickyIndex",`containerItemIndex${t}`]),g=V(()=>{var y;return(y=Fg(o)?Object.assign({},...o):o)!=null?y:{}},[o]),h=V(()=>{var y;let x={...LC,...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=V(()=>i?.backdropComponent?Ne("div",{style:{inset:0,pointerEvents:"none",position:"absolute"}},Ig(i.backdropComponent)):null,[i?.backdropComponent]);return Ne("div",{ref:r,style:h,...c},v,d)}),CG=yG;function bG(e){J(()=>e())}var v_=wt(null),wG=-1;function SG(){return Kt(v_)}function IG(){var e;let t=SG(),n=(e=t?.containerId)!=null?e:wG,[o]=Qo([`containerItemKey${n}`]);return l4("lastItemKeys",a=>t&&!Nu(o)&&a?.includes(o)||!1)}function TG({ItemSeparatorComponent:e,leadingItem:t}){return IG()?null:Ne(e,{leadingItem:t})}var yC=null;function kG(){return yC||(yC=new ResizeObserver(e=>{m_(()=>{for(let t of e){let n=Tg.get(t.target);if(n)for(let o of n)o(t)}})})),yC}var Tg=new WeakMap;function LG(e,t){var n;if(typeof ResizeObserver>"u"||!e)return()=>{};let o=kG(),r=(n=Tg.get(e))!=null?n:new Set;return r.size===0&&(Tg.set(e,r),o.observe(e,{box:"border-box"})),r.add(t),()=>{r.delete(t),r.size===0&&(Tg.delete(e),o.unobserve(e))}}function QC({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(pN(m),!0),p=m}return LG(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??u4(c),C=x===void 0||y.width!==x.width||y.height!==x.height;p=y;let w=!!r?.();(C||w)&&f(pN(y),!1)})},[t,...a||[]]),{}}function pN(e){return e?{height:e.height,width:e.width,x:e.left,y:e.top}:{height:0,width:0,x:0,y:0}}var kg=new Map,xC;function y_(e){kg.delete(e)}function PG(e,t){kg.set(e,t),xC===void 0&&(xC=requestAnimationFrame(()=>{let n=Array.from(kg.values());kg.clear(),xC=void 0,m_(()=>{for(let o of n)o()})}))}function AG({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,g_(t,{containerId:e,itemKey:i,size:s})};!$u(a)&&f!==void 0&&d+1<f?PG(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()}}):(y_(r),p())}function EG({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=>{AG({containerId:e,ctx:t,rectangle:f,ref:r,state:a.current})},[e,t,r]),d=R(()=>{Ag(t,e)},[e,t]);he(()=>(t.containerLayoutTriggers.set(e,d),()=>{y_(a.current),t.containerLayoutTriggers.get(e)===d&&t.containerLayoutTriggers.delete(e)}),[e,t,d]),he(()=>{Ag(t,e)});let{onLayout:c}=QC({measureInLayoutEffect:!FC,onLayoutChange:l,ref:r,webLayoutResync:()=>$u(t.state)},[o,i]);return G(()=>{},[e,t,o]),{onLayout:c,triggerLayout:d}}function RG({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 MG=Ca(function({id:t,itemKey:n,recycleItems:o,horizontal:r,getRenderedItem:a,ItemSeparatorComponent:i,stickyHeaderConfig:s}){let l=Wr(),{columnWrapperStyle:d,animatedScrollY:c}=l,f=Ya(l.state),p=l.state.props.positionComponentInternal,m=l.state.props.stickyPositionComponentInternal,[g=0,h=1,v,y=1,x,C]=Qo([`containerColumn${t}`,`containerSpan${t}`,`containerItemData${t}`,"numColumns","extraData",`containerSticky${t}`]),w=N(null),{onLayout:L,triggerLayout:S}=EG({containerId:t,ctx:l,horizontal:r,itemKey:n,ref:w}),T=g>0?g:1,I=Math.min(Math.max(h||1,1),y),k=y>1?`${(T-1)/y*100}%`:0,E=y>1?`${I/y*100}%`:void 0,P=V(()=>RG({columnWrapperStyle:d,contentContainerAlignItems:l.state.props.contentContainerAlignItems,hasItemSeparator:!!i,horizontal:r,isHorizontalRTLList:f,numColumns:y,otherAxisPos:k,otherAxisSize:E}),[r,f,k,E,d,l.state.props.contentContainerAlignItems,y,i]),_=V(()=>n!==void 0?a(n):null,[n,v,x]),{renderedItem:A}=_||{},B=V(()=>(l.viewRefs.set(t,w),{containerId:t,triggerLayout:S}),[t,S]);return Ne(C?m||xG:p||CG,{animatedScrollY:C?c:void 0,horizontal:r,id:t,key:o?void 0:n,onLayout:L,refView:w,stickyHeaderConfig:s,style:P},Ne(v_.Provider,{value:B},A,_&&i&&Ne(TG,{ItemSeparatorComponent:i,leadingItem:_.item})))});function NG({id:e,horizontal:t,recycleItems:n,ItemSeparatorComponent:o,getRenderedItem:r,stickyHeaderConfig:a,ContainerComponent:i=MG}){let[s]=Qo([`containerItemKey${e}`]);return s===void 0?null:Ne(i,{getRenderedItem:r,horizontal:t,ItemSeparatorComponent:o,id:e,itemKey:s,recycleItems:n,stickyHeaderConfig:a})}var _G=Ca(function(t){return Ne(NG,{...t})});function DG(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=OG(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 OG(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 FG(e){let t=Wr(),n=N(void 0);G(()=>{let o=Ga(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=Ce(t,`containerItemIndex${i}`);l&&d!==void 0&&a.set(l,d)}DG(r,a)}n.current=void 0},500)});return()=>{o(),n.current!==void 0&&clearTimeout(n.current)}},[t])}function BG(e,t){let[n,o]=J(t),r=n!==t;return he(()=>{o(t)},[t]),e&&!r}var zG=Ca(function({freshDataTransitionEpoch:t,horizontal:n,numColumns:o,children:r}){let a=N(null),i=Wr(),s=i.columnWrapperStyle,l=Ya(i.state),[d,c,f]=Qo(["otherAxisSize","readyToRender","totalSize"]),p=BG(!!c,t);FG(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 Ne("div",{ref:a,style:m},Ne(hG,null,r))}),UG=Ca(function({freshDataTransitionEpoch:t,horizontal:n,recycleItems:o,ItemSeparatorComponent:r,getRenderedItem:a,stickyHeaderConfig:i}){let[s,l]=Qo(["numContainersPooled","numColumns"]),d=[];for(let c=0;c<s;c++)d.push(Ne(_G,{getRenderedItem:a,horizontal:n,ItemSeparatorComponent:r,id:c,key:c,recycleItems:o,stickyHeaderConfig:i}));return Ne(zG,{freshDataTransitionEpoch:t,horizontal:n,numColumns:l},d)});function HG(e){return Fg(e)?Object.assign({},...e.filter(Boolean)):e}var Hu={create:e=>e,flatten:e=>HG(e)};function PC(e){let t=N(e);return t.current=e,t}function $G(e){let t=PC(e),n=N(void 0),o=V(()=>({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 G(()=>()=>{o.cancel()},[o]),o}var AC="legend-list-content-container",x_="legend-list-scrollbar-x-hidden",C_="legend-list-scrollbar-y-hidden";function KG(){return typeof document>"u"?null:document.scrollingElement||document.documentElement||document.body}function EC(){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 mN(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 b_(e){var t,n;return{height:(t=e?.scrollHeight)!=null?t:0,width:(n=e?.scrollWidth)!=null?n:0}}function VG(e,t,n){return b_(n?t:e)}function gN(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 hN(e,t){return Math.max(0,Math.min(e,t))}function vN(e,t){return t?e.width:e.height}function qG(e,t,n){return Math.max(0,vN(e,n)-vN(t,n))}function yN(e,t){return t&&KG()||e}function WG(e,t){return t&&typeof window<"u"?window:e}function GG(e,t,n){let o=e.getBoundingClientRect(),r=EC();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 jG({clampedOffset:e,horizontal:t,listPos:n,scroll:o}){return{left:t?n.left+e:o.x,top:t?o.y:n.top+e}}var xN="legend-list-scrollbar-axis-hidden-style",QG=200,XG=`.${C_}::-webkit-scrollbar:vertical{width:0;display:none;}.${x_}::-webkit-scrollbar:horizontal{height:0;display:none;}`;function YG(){if(typeof document>"u"||document.getElementById(xN))return;let e=document.createElement("style");e.id=xN,e.textContent=XG,document.head.appendChild(e)}function JG(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 ZG(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 ej(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 CN=$n(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=Wr(),[S]=Qo(["anchoredEndSpaceSize"]),T=N(null),I=N(null),k=g,E=R(()=>WG(T.current,k),[k]),P=R(()=>{let Q=T.current,$=VG(Q,I.current,k),oe=gN(Q,k,a);return qG($,oe,a)},[a,k]),_=R(()=>{let Q=T.current;if(k){let $=P(),oe=EC(),ve=mN(Q,oe),at=a?oe.x-ve.left:oe.y-ve.top;return hN(at,$)}return Q?a?Q.scrollLeft:Q.scrollTop:0},[P,a,k]),A=R((Q,$)=>{let oe=T.current,ve=E();if(!ve||typeof ve.scrollTo!="function")return;let at=P(),Et=hN(Q,at),_t={behavior:$?"smooth":"auto"};if(k){let an=EC(),mt=mN(oe,an),{left:Wt,top:Ot}=jG({clampedOffset:Et,horizontal:a,listPos:mt,scroll:an});_t.left=Wt,_t.top=Ot}else a?_t.left=Et:_t.top=Et;ve.scrollTo(_t)},[P,E,a,k]);nr(y,()=>({getBoundingClientRect:()=>{var $;return($=T.current)==null?void 0:$.getBoundingClientRect()},getCurrentScrollOffset:_,getScrollableNode:()=>yN(T.current,k),getScrollEventTarget:()=>E(),getScrollResponder:()=>yN(T.current,k),isWindowScroll:()=>k,scrollBy:($,oe)=>{let ve=E();!ve||typeof ve.scrollBy!="function"||ve.scrollBy({behavior:"auto",left:$,top:oe})},scrollTo:$=>{let{x:oe=0,y:ve=0,animated:at=!0}=$;A(a?oe:ve,at)},scrollToEnd:($={})=>{let{animated:oe=!0}=$,ve=P();A(ve,oe)},scrollToOffset:$=>{let{offset:oe,animated:ve=!0}=$;A(oe,ve)}}),[_,P,E,a,k,A]);let B=R(()=>{if(!l||!T.current)return;let Q=b_(I.current),$=gN(T.current,k,a),oe=_(),ve={nativeEvent:{contentOffset:{x:a?oe:0,y:a?0:oe},contentSize:{height:Q.height,width:Q.width},layoutMeasurement:{height:$.height,width:$.width}}};l(ve)},[_,a,k,l]),z=$G(B),q=N(void 0),X=R(()=>{let Q=q.current;Q!==void 0&&(clearTimeout(Q),q.current=void 0),z.flush(),d?.()},[d,z]),Se=R(Q=>{if(!l)return;let $=L.state;if(!!$?.scrollingTo||!!$?.initialScrollSession&&!$.didFinishInitialScroll||!!$?.initialScroll&&!$.didFinishInitialScroll||!!$&&$u($)?z.flush():z.schedule(),d){let ve=q.current;ve!==void 0&&clearTimeout(ve),q.current=setTimeout(X,QG)}},[L.state,X,d,l,z]);he(()=>{let Q=E();if(Q)return Q.addEventListener("scroll",Se,{passive:!0}),"onscrollend"in Q&&Q.addEventListener("scrollend",X),()=>{Q.removeEventListener("scroll",Se),"onscrollend"in Q&&Q.removeEventListener("scrollend",X);let $=q.current;$!==void 0&&(clearTimeout($),q.current=void 0),z.cancel()}},[X,E,Se,z]),G(()=>{let Q=()=>{i&&A(a?i.x||0:i.y||0,!1)};Q(),requestAnimationFrame(Q)},[i?.x,i?.y,a,A]),he(()=>{if(!h||!T.current)return;let Q=T.current,$=()=>{h({nativeEvent:{layout:GG(Q,k,a)}})};$();let oe=new ResizeObserver(()=>{$()});oe.observe(Q);let ve=()=>{$()};return k&&typeof window<"u"&&typeof window.addEventListener=="function"&&window.addEventListener("resize",ve),()=>{oe.disconnect(),k&&typeof window<"u"&&typeof window.removeEventListener=="function"&&window.removeEventListener("resize",ve)}},[k,h]);let K=!k&&(a?!f&&x_:!p&&C_);he(()=>{K&&YG()},[K]);let W={...k?{}:{overflow:"auto",overflowX:a||f?"auto":"hidden",overflowY:a?p?"auto":"hidden":"auto",WebkitOverflowScrolling:"touch"},...Hu.flatten(n),...s?{overflowAnchor:"none"}:{}},Z=JG(L),j=(C=(x=L.state)==null?void 0:x.props)!=null&&C.anchoredEndSpace&&S?S:0,O=Math.max(0,Z-j),Y=O?a?{flexShrink:0,width:O}:{height:O}:void 0,re={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"}:{}},ue=o?`${AC} ${o}`:AC,{contentContainerClassName:le,contentInset:fe,scrollEventThrottle:ae,ScrollComponent:Le,snapToOffsets:et,useWindowScroll:Ge,className:rt,...$e}=v,te=k?[]:ZG(et);te.length>0&&(W.scrollSnapType=a?"x mandatory":"y mandatory",re.position=(w=re.position)!=null?w:"relative");let Pe=K?rt?`${rt} ${K}`:K: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."),Ne("div",{className:Pe,ref:T,...$e,style:W},m,Ne("div",{className:ue,ref:I,style:re},te.map(Q=>Ne("div",{"aria-hidden":!0,"data-legend-list-snap-anchor":Q,key:`snap-${Q}`,style:ej(Q,a)})),t,Y?Ne("div",{"aria-hidden":!0,style:Y}):null))});function tj({horizontal:e,needsOtherAxisSize:t,otherAxisSize:n}){if(!(!t||!n||n<=0))return e?{height:n}:{width:n}}function bN(e,t){let n=Wr();he(()=>Ga(n,e,r=>{t(r)}),[t,n,e])}function nj(e){return e?{contentSizeKey:"scrollWidth",paddingEndProp:"paddingRight",viewportSizeKey:"clientWidth",x:1,y:0}:{contentSizeKey:"scrollHeight",paddingEndProp:"paddingBottom",viewportSizeKey:"clientHeight",x:0,y:1}}function oj(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 > .${AC}`)),i?{contentNode:s,scrollElement:i}:null}function rj(e,t,n){e.scrollBy({behavior:"auto",left:t,top:n})}function aj(){let e=Wr(),t=N(0),n=N(0),o=N(void 0),r=N(void 0),a=N(null),i=R(()=>{let s=Ce(e,"scrollAdjust"),l=Ce(e,"scrollAdjustUserOffset"),d=(s||0)+(l||0);if(d-t.current!==0){let f=oj(e,a.current);if(f){let p=!!e.state.props.horizontal,m=nj(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=()=>rj(h,m.x*C,m.y*C);if(a.current=g,w&&g){let S=g[m.contentSizeKey],T=h[m.viewportSizeKey],I=v+C;if(C>0&&!e.state.adjustingFromInitialMount&&S<I+T){let E=g.style[m.paddingEndProp],P=r.current,_=P?.value===E?P.baseline:E,A=(I+T-S)*2,z=`${(Number.parseFloat(window.getComputedStyle(g)[m.paddingEndProp])||0)+A}px`;g.style[m.paddingEndProp]=z,r.current={baseline:_,value:g.style[m.paddingEndProp]},g.offsetHeight,L(),o.current!==void 0&&cancelAnimationFrame(o.current),o.current=requestAnimationFrame(()=>{let q=r.current;o.current=void 0,r.current=void 0,g.style[m.paddingEndProp]===q?.value&&(g.style[m.paddingEndProp]=q.baseline)})}else L()}else w&&L()}t.current=d,n.current=l||0}},[e]);return bN("scrollAdjust",i),bN("scrollAdjustUserOffset",i),null}var ij=$n(function({ScrollComponent:t,...n},o){let[r]=Qo(["snapToOffsets"]);return Ne(t,{...n,ref:o,snapToOffsets:r})}),RC=.1;function sj(e,t,n){let o=Ce(e,t)!==n;return o&&(Fe(e,t,n),Xs(e)),o}function lj(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-RC&&Math.abs(l)>RC}function wN(e,t){let{state:n}=e,o=Ce(e,"headerSize")||0,r=o!==t,a=n.didMeasureHeader||o>RC;r&&(Fe(e,"headerSize",t),Xs(e),a&&lj(e,o,t)&&Ys(e,t-o)),n.didMeasureHeader=!0}function dj(e,t){let n=sj(e,"footerSize",t);return n&&Eg(e),n}function cj(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 uj(e,t){let{state:n}=e,o=n.contentInsetOverride,r=t??void 0,a=!cj(o,r);return n.contentInsetOverride=r,a&&Xs(e),a}function fj(e,t){let n=PC(e),o=PC(t);return V(()=>$n((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 SN=({onLayoutChange:e,refView:t,children:n,...o})=>{let r=N(null),a=t??r;return QC({onLayoutChange:e,ref:a}),Ne("div",{...o,ref:a},n)},pj=Ca(function({horizontal:t}){let[n=0]=Qo(["alignItemsAtEndPadding"]);return n<=0?null:Ne(Rg,{style:t?{flexShrink:0,width:n}:{flexShrink:0,height:n}},null)}),mj=Ca(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:T,snapToIndices:I,stickyHeaderConfig:k,stickyHeaderIndices:E,useWindowScroll:P=!1,..._}){let A=Wr(),B=A.state.props.maintainVisibleContentPosition,[z=0,q=0]=Qo(["anchoredEndSpaceSize","otherAxisSize"]),X=A.state.props.alignItemsAtEndPaddingEnabled,Se=!!A.state.props.anchoredEndSpace&&A.state.props.anchoredEndSpaceOwner==="list"&&z>0,K;if(Se){let le=a?Ya(A.state)?"Left":"Right":"Bottom",fe=Hu.flatten(r);K={[`padding${le}`]:Eu({},fe||{},le)+z}}let W=tj({horizontal:a,needsOtherAxisSize:A.state.needsOtherAxisSize,otherAxisSize:q}),Z=fj(C,(le,fe)=>({...le,ref:fe})),j=C?Z:CN,O=I?ij:j,Y=R((le,fe)=>{var ae;let Le=dj(A,le);fe?.(),Le&&((ae=A.state.props.maintainScrollAtEnd)!=null&&ae.onFooterLayout)&&yd(A)},[A]);he(()=>{p||wN(A,0),g||Y(0)},[p,g,A,Y]);let re=R(le=>{let fe=le[a?"width":"height"];wN(A,fe)},[A,a]),ue=R((le,fe)=>{let ae=le[a?"width":"height"];Y(ae,()=>{w?.(le,fe)})},[a,w,Y]);return Ne(O,{..._,...j===CN?{onInternalScrollEnd:S,useWindowScroll:P}:{},contentContainerStyle:[a?{height:"100%"}:{},r,K,{boxSizing:"border-box"}],contentOffset:i!==void 0?a?{x:i,y:0}:{x:0,y:i}:void 0,horizontal:a,maintainVisibleContentPosition:B.size||B.data?{minIndexForVisible:0}:void 0,onLayout:f,onScroll:c,ref:x,ScrollComponent:I?j:void 0,style:W?[W,o]:o},Ne(aj,null),p&&Ne(SN,{onLayoutChange:re,style:m},Ig(p)),v&&Ig(v),X&&Ne(pj,{horizontal:a}),t&&!v&&Ne(UG,{freshDataTransitionEpoch:n,getRenderedItem:y,horizontal:a,ItemSeparatorComponent:l,recycleItems:s,stickyHeaderConfig:k}),g&&Ne(SN,{onLayoutChange:ue,style:h},Ig(g)),jo&&m4)}),gj=100,hj=.9,vj=.9;function yj(e){let t=Wr(),{anchoredEndSpace:n,childrenMode:o,keyExtractor:r,numColumns:a,renderScrollComponent:i,useWindowScroll:s}=e,l=!!n;G(()=>{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]),G(()=>{s&&i&&qs("useWindowScrollRenderScrollComponent","useWindowScroll is not supported when renderScrollComponent is provided.")},[i,s]),G(()=>{!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]),G(()=>{let d=t.state,c=d.props.data.length;if(d.props.useWindowScroll||c<gj)return;let p=()=>{let g=Ce(t,"readyToRender"),h=Ce(t,"numContainers")||0,v=Ce(t,"totalSize")||0,y=t.state.scrollLength||0;if(!g||v<=0||y<=0)return;let x=h>=Math.ceil(c*hj),C=y>=v*vj;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=[Ga(t,"numContainers",p),Ga(t,"readyToRender",p),Ga(t,"totalSize",p)];return()=>{for(let g of m)g()}},[t])}function xj(e){}var Cj=jo?yj:xj;function bj(e,t,{didColumnsChange:n=!1}={}){let o=e.state,{previousData:r}=o,{maintainScrollAtEnd:a}=o.props;if(n){o.sizes.clear(),o.sizesKnown.clear(),n_(o);for(let l in o.averageSizes)delete o.averageSizes[l];o.minIndexSizeChanged=0,o.scrollForNextCalculateItemsInView=void 0}ja(e,{dataChanged:!0,doMVCP:!0});let s=!n&&a?.onDataChange&&yd(e);!s&&r&&t.length>r.length&&(o.isEndReached=!1),s||Dg(e),delete o.previousData}function wj(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 w_(e){var t,n;let o=e.state,{scrollLength:r,props:{data:a,getFixedItemSize:i,getItemType:s,numColumns:l,estimatedItemSize:d}}=o,c=HN(e),f=Ce(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++)Fe(e,`containerPosition${g}`,gd),Fe(e,`containerColumn${g}`,-1),Fe(e,`containerSpan${g}`,1);return Fe(e,"numContainers",m),Fe(e,"numContainersPooled",QW(a.length,m)),o.lastLayout&&(o.initialScroll?requestAnimationFrame(()=>{ja(e,{dataChanged:!0,doMVCP:!0})}):ja(e,{dataChanged:!0,doMVCP:!0})),!0}}function Sj(){return typeof window>"u"?{height:0,width:0}:{height:window.innerHeight,width:window.innerWidth}}function Ij(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=Sj()[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&&w_(e),m&&ja(e,{doMVCP:!0}),(h||p!==g)&&Fe(e,"scrollSize",{height:l.height,width:l.width}),r?.onLayout&&yd(e),Dg(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 Tj(e,t){let n=to.get(e);if(!!n&&to.didReachTarget(t,n)){to.clear(e);return}n&&(e.hasScrolled=!1,to.set(e,{startScroll:n.startScroll,targetOffset:n.targetOffset}))}function kj(e){var t;return!!e.initialScroll&&((t=e.initialScrollSession)==null?void 0:t.kind)==="bootstrap"&&!e.didFinishInitialScroll}function Lj(e){return{...e,nativeEvent:{...e.nativeEvent}}}function Pj(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=e4(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=zi(e,f,l.scrollingTo);if(f!==p&&Math.abs(f-p)>1){f=p,Ug(e,{forceScroll:!0,isInitialScroll:!0,noScrollingTo:!0,offset:f});return}}l.scrollPending=f,Gs(e,f,c,{fromNativeScrollEvent:!0}),Tj(l,f),hW(e),l.scrollingTo&&WC(e),l.props.onScroll&&(kj(l)?l.deferredPublicOnScrollEvent=Lj(t):l.props.onScroll(t))}var Aj=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()}},Ej=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,Fe(this.ctx,"scrollAdjustPending",this.pendingAdjust)):(this.appliedAdjust+=e,Fe(this.ctx,"scrollAdjust",this.appliedAdjust)),this.ctx.state.scrollingTo&&WC(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=Og(this.ctx,e.index);o=Bg(this.ctx,a,e),o=zi(this.ctx,o,e)}else o=zi(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,Fe(this.ctx,"scrollAdjust",this.appliedAdjust)),Fe(this.ctx,"scrollAdjustPending",0),ja(this.ctx)}}}};function Rj(e,t){let n=e.state,o=Ws(e,t),a=Ws(e)-o;if(a!==0){let i=!!Ce(e,"isWithinMaintainScrollAtEndThreshold");Gs(e,n.scroll,!0,{markHasScrolled:!1}),!a_(e)&&i&&a>0&&Ys(e,a)}}function CC(e){return V(()=>e?(t,n,o)=>t!==void 0&&n!==void 0?e(t,n,o):void 0:void 0,[e])}var Mj=(...e)=>R(n=>{for(let o of e)o&&(VN(o)?o(n):o.current=n)},e);function Nj(e){return null}function _j(e,t,n,o){return o}function Dj(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 Oj(e,t){let n=e.state,r=n.props.data.length-1;if(r===-1)return!1;let a=n.props.stylePaddingBottom||0,i=Ce(e,"footerSize")||0;return Sg(e,{...t,index:r,viewOffset:-a-i+(t?.viewOffset||0),viewPosition:1}),!0}var Fj="default";function Bj(e){let t={};for(let n in e.averageSizes){let o=e.averageSizes[n];o&&(t[n||Fj]={average:o.avg,count:o.num})}return t}function zj(e){Ag(e)}function Uj(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:M4(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 NN(n),n.pendingScrollResolve=h,v},f=(h,v=()=>!0)=>new Promise(y=>{let x=c(y);eN(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,()=>Oj(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 Sg(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(),n_(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,Fe(e,"totalSize",0),x==="full"&&(n.indexByKey.clear(),n.idCache.length=0,n.positions.length=0,n.columns.length=0,n.columnSpans.length=0),zj(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:Ce(e,"activeStickyIndex"),contentLength:co(e),data:n.props.data,elementAtIndex:h=>{var v;return(v=e.viewRefs.get(IC(e,Qt(n,h))))==null?void 0:v.current},end:n.endNoBuffer,endBuffered:n.endBuffered,getAverageItemSizes:()=>Bj(n),indexByKey:h=>n.indexByKey.get(h),isAtEnd:Ce(e,"isAtEnd"),isAtStart:Ce(e,"isAtStart"),isEndReached:n.isEndReached,isNearEnd:Ce(e,"isNearEnd"),isNearStart:Ce(e,"isNearStart"),isStartReached:n.isStartReached,isWithinMaintainScrollAtEndThreshold:Ce(e,"isWithinMaintainScrollAtEndThreshold"),listen:(h,v)=>Ga(e,h,v),listenToPosition:(h,v)=>i4(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:zg(n),sizeAtIndex:h=>n.sizesKnown.get(Qt(n,h)),sizes:n.sizesKnown,start:n.startNoBuffer,startBuffered:n.startBuffered}),reportContentInset:h=>{let v=uj(e,h);Gs(e,n.scroll,!0,{markHasScrolled:!1}),v&&a_(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?.(),eN(e),t||(y=n.runPendingScrollToEnd)==null||y.call(n)}),scrollToIndex:h=>f(()=>(Sg(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?(Sg(e,{index:x,...v}),!0):!1}),scrollToOffset:h=>f(()=>(Ug(e,h),!0)),setItemSize:(h,v)=>{g_(e,{itemKey:h,size:v})},setScrollProcessingEnabled:h=>{n.scrollProcessingEnabled=h},setVisibleContentAnchorOffset:h=>{let v=VN(h)?h(Ce(e,"scrollAdjustUserOffset")||0):h;Fe(e,"scrollAdjustUserOffset",v)}}}var Hj=(e,t)=>e-t,IN=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 $j(e,t,n,o){var r,a;if(t.length===0)return[];let i=new Set,s=t.length,l=IN(e?.top);if(l>0)for(let f=0;f<Math.min(l,s);f++)Au(i,s,f);let d=IN(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(Hj),c}function Kj(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=Ce(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 TN(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 Vj(e){var t;return e?e===!0?{...TN(void 0,!1),animated:!1}:{...TN(e.on,"on"in e),animated:(t=e.animated)!=null?t:!1}:void 0}function qj(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 Wj(e,{stylePaddingTop:t}){let n=e.state;if(t!==void 0){let o=Ce(e,"stylePaddingTop")||0;if(t<o){let r=Ce(e,"totalSize")||0;Fe(e,"totalSize",r+o),n.timeoutSetPaddingTop=setTimeout(()=>{r=Ce(e,"totalSize")||0,Fe(e,"totalSize",r-o)},16)}Fe(e,"stylePaddingTop",t)}}function Gj(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 jj(e,t){let n=Gj("throttle");return o=>n(e,t,{nativeEvent:o.nativeEvent})}var Qj=Ca(h_(function(t,n){let{children:o,data:r,renderItem:a,...i}=t,l=o!==void 0&&r===void 0?{...i,childrenMode:!0,data:(Fg(o)?o:ph.toArray(o)).flat(1),renderItem:({item:d})=>d}:{...i,data:r||[],renderItem:a};return Ne(o4,null,Ne(Xj,{...l,ref:n}))})),Xj=h_(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(Ke=>{},[]);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:T=!1,anchoredEndSpace:I,alwaysRender:k,columnWrapperStyle:E,contentContainerStyle:P,contentInset:_,data:A=[],dataKey:B,dataVersion:z,drawDistance:q=250,contentInsetEndAdjustment:X,estimatedItemSize:Se=100,estimatedListSize:K,extraData:W,getFixedItemSize:Z,getItemType:j,horizontal:O,rtl:Y,estimatedHeaderSize:re,initialScrollAtEnd:ue=!1,initialScrollIndex:le,initialScrollOffset:fe,experimental_adaptiveRender:ae,itemsAreEqual:Le,keyExtractor:et,ListEmptyComponent:Ge,ListFooterComponent:rt,ListFooterComponentStyle:$e,ListHeaderComponent:te,maintainScrollAtEnd:Pe=!1,maintainScrollAtEndThreshold:Q=.1,maintainVisibleContentPosition:$,numColumns:oe=1,overrideItemLayout:ve,onEndReached:at,onEndReachedThreshold:Et=.5,onItemSizeChanged:Rt,onMetricsChange:_t,onLayout:an,onLoad:mt,onMomentumScrollEnd:Wt,onRefresh:Ot,onScroll:vt,onScrollBeginDrag:Sn,onStartReached:ft,onStartReachedThreshold:pn=.5,onStickyHeaderChange:no,onFirstVisibleItemChanged:Xt,onViewableItemsChanged:In,progressViewOffset:En,recycleItems:sn=!1,refreshControl:Rn,refreshing:F,refScrollView:ce,renderScrollComponent:be,renderItem:ke,scrollEventThrottle:Re,snapToIndices:st,stickyHeaderIndices:ln,style:vn,useWindowScroll:ct=!1,viewabilityConfig:kt,viewabilityConfigCallbackPairs:Ft,...Pt}=t,Ut=t.animatedPropsInternal,ht=(o=t.anchoredEndSpaceOwnerInternal)!=null?o:"list",we=t.positionComponentInternal,Ve=t.stickyPositionComponentInternal,{anchoredEndSpaceOwnerInternal:qe,positionComponentInternal:We,stickyPositionComponentInternal:ot,...yt}=Pt,ye=Hu.flatten(P),xt=T&&!O&&ye?.minHeight==null&&A.length>0,pt=T&&!xt&&(O?ye?.minWidth==null:ye?.minHeight==null),Ht={...ye,...T&&!xt?{display:"flex",flexDirection:O?"row":"column",...pt?{flexGrow:1}:{},justifyContent:"flex-end"}:{}},Tn={...Hu.flatten(vn)},mn=Eu(Tn,Ht,"Top"),kn=Eu(Tn,Ht,"Bottom"),ge=Eu(Tn,Ht,"Left"),tt=Eu(Tn,Ht,"Right"),Ct=DC({horizontal:O,rtl:Y,stylePaddingBottom:kn,stylePaddingLeft:ge,stylePaddingRight:tt}),lt=Vj(Pe),Ln=qj($),Bt=le!=null,Mt=fe!=null,Yt=!ue&&!Bt&&!Mt&&_C({horizontal:O,rtl:Y}),Pn=!ue&&!Bt&&(Mt||Yt),zt=ue||Bt,To=ue?{index:Math.max(0,A.length-1),preserveForBottomPadding:!0,viewOffset:-Ct,viewPosition:1}:Bt?typeof le=="object"?{index:(r=le.index)!=null?r:0,preserveForBottomPadding:le.viewOffset===void 0&&le.viewPosition===1?!0:void 0,viewOffset:(a=le.viewOffset)!=null?a:le.viewPosition===1?-Ct:0,viewPosition:(i=le.viewPosition)!=null?i:0}:{index:le??0,viewOffset:fe??0}:Pn?{contentOffset:fe??0,index:0,viewOffset:0}:void 0,[hr,ei]=J(!FC),[,Ui]=La(Ke=>Ke+1,0),ze=Wr();ze.columnWrapperStyle=E||(Ht?Dj(Ht):void 0);let jr=O?(d=(s=ze.columnWrapperStyle)==null?void 0:s.columnGap)!=null?d:(l=ze.columnWrapperStyle)==null?void 0:l.gap:(p=(c=ze.columnWrapperStyle)==null?void 0:c.rowGap)!=null?p:(f=ze.columnWrapperStyle)==null?void 0:f.gap,yn=typeof jr=="number"&&Number.isFinite(jr)?jr:0,vr=N(null),Hi=Mj(vr,ce),$i=et??((Ke,Lt)=>Lt.toString()),Xo=ln,yr=X,oo=N(yr),$t=V(()=>{let Ke=$j(k,A,$i,I?.anchorIndex);return{arr:Ke,set:new Set(Ke)}},[I?.anchorIndex,k?.top,k?.bottom,(m=k?.indices)==null?void 0:m.join(","),(g=k?.keys)==null?void 0:g.join(","),A,B,z,$i]),xr=!!ct&&!be,Jt=N(void 0),Cr=!!ve,Mn=N(Cr);if(!Jt.current){if(!ze.state){let Ke=(K??{height:0,width:0})[O?"width":"height"];ze.values.set("adaptiveRender",(h=ae?.initialMode)!=null?h:"normal"),ze.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:A.length>0,idCache:[],idsInView:[],indexByKey:new Map,initialScroll:To,initialScrollSession:To?{kind:Pn?"offset":"bootstrap",previousDataLength:A.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 Aj,scroll:0,scrollAdjustHandler:new Ej(ze),scrollForNextCalculateItemsInView:void 0,scrollHistory:[],scrollLength:Ke,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 Lt=ze.state;Lt.triggerCalculateItemsInView=en=>ja(ze,en),Lt.reprocessCurrentScroll=()=>Gs(ze,Lt.scroll,!0),Fe(ze,"maintainVisibleContentPosition",Ln),Fe(ze,"extraData",W),re!==void 0&&Fe(ze,"headerSize",re)}Jt.current=ze.state}let Oe=Jt.current,bn=Oe.isFirst,br=Oe.props.adaptiveRender,wr=Oe.props.numColumns,fo=!bn&&ze.scrollAxisGap!==yn;ze.scrollAxisGap=yn,Oe.didColumnsChange=oe!==wr||fo;let Sr=(y=(v=Oe.props.data)==null?void 0:v.length)!=null?y:0,_o=Oe.props.data!==A,Qr=Oe.props.dataKey!==B,wa=Oe.props.dataVersion!==z,ko=Qr||wa||_o&&wj(Oe,A,Oe.props.data),Lo=!bn&&ko&&Oe.hasHadNonEmptyData&&(Qr||Sr===0)&&A.length>0;ko&&!ue&&Oe.didFinishInitialScroll&&((x=Oe.initialScroll)==null?void 0:x.viewPosition)===1&&Oe.props.data.length>0&&hd(Oe),ko&&(Oe.dataChangeEpoch+=1,Oe.dataChangeNeedsScrollUpdate=!0,Oe.didDataChange=!0,Oe.previousData=Oe.props.data),Lo&&(Oe.freshDataTransitionEpoch+=1);let Xr=jj(vt??S,Re??0),An=Re&&vt?Xr:vt,Do=!bn&&!ko&&((C=Oe.props.anchoredEndSpace)==null?void 0:C.anchorIndex)!==I?.anchorIndex;Oe.props={adaptiveRender:ae,alignItemsAtEnd:T,alignItemsAtEndPaddingEnabled:xt,alwaysRender:k,alwaysRenderIndicesArr:$t.arr,alwaysRenderIndicesSet:$t.set,anchoredEndSpace:I,anchoredEndSpaceOwner:ht,animatedProps:Ut,contentContainerAlignItems:Ht.alignItems,contentInset:_,contentInsetEndAdjustment:yr,data:A,dataKey:B,dataVersion:z,drawDistance:q,estimatedItemSize:Se,getFixedItemSize:CC(Z),getItemType:CC(j),horizontal:!!O,itemsAreEqual:Le,keyExtractor:CC($i),maintainScrollAtEnd:lt,maintainScrollAtEndThreshold:Q,maintainVisibleContentPosition:Ln,numColumns:oe,onEndReached:at,onEndReachedThreshold:Et,onFirstVisibleItemChanged:Xt,onItemSizeChanged:Rt,onLoad:mt,onMomentumScrollEnd:Wt,onScroll:An,onScrollBeginDrag:Sn,onStartReached:ft,onStartReachedThreshold:pn,onStickyHeaderChange:no,overrideItemLayout:ve,positionComponentInternal:we,recycleItems:!!sn,renderItem:ke,rtl:Y,snapToIndices:st,stickyHeaderIndicesArr:Xo??[],stickyHeaderIndicesSet:V(()=>new Set(Xo??[]),[Xo?.join(",")]),stickyPositionComponentInternal:Ve,stylePaddingBottom:kn,stylePaddingLeft:ge,stylePaddingRight:tt,stylePaddingTop:mn,useWindowScroll:xr},Oe.refScroller=vr,!bn&&br&&!ae&&BC(ze);let Yr=V(()=>A.length?Array.from({length:Math.min(oe,A.length)},(Ke,Lt)=>Qt(Oe,A.length-1-Lt)):[],[A,B,z,oe]),Yo=Ke=>{Fe(ze,"lastItemKeys",Yr),Fe(ze,"numColumns",oe);let Lt=Ce(ze,"stylePaddingTop");Wj(ze,{stylePaddingTop:mn}),Jt.current.props.stylePaddingBottom=kn,Xs(ze);let en=mn-Lt;Ke&&Ln.size&&en&&Lt!==void 0&&Qa.OS};bn&&(Yo(!1),i_(Oe),l_(ze,!0));let Jr=V(()=>{var Ke,Lt;let en=Oe.initialScroll;if(!en)return;let Nn=(Ke=en.contentOffset)!=null?Ke:qr(ze,en);return zt&&((Lt=Oe.initialScrollSession)==null?void 0:Lt.kind)==="bootstrap"&&Qa.OS==="web"?void 0:Nn},[zt]);he(()=>{OW(ze,{alwaysDispatchInitialScroll:Yt,dataLength:A.length,hasFooterComponent:!!rt,initialContentOffset:Jr,initialScrollAtEnd:ue,useBootstrapInitialScroll:zt})},[]),(bn||ko||Oe.didColumnsChange)&&(Jt.current.lastBatchingAction=Date.now(),!et&&!bn&&ko&&(Jt.current.sizes.clear(),Jt.current.positions.length=0,Jt.current.totalSize=0,Fe(ze,"totalSize",0))),jo&&Cj(t),he(()=>{Lo&&UC(ze,{resetInitialScroll:!!To,resetLayout:!0}),FW(ze,{dataLength:A.length,didDataChange:ko,didStartFreshData:Lo,initialScrollAtEnd:ue,latestInitialScroll:To,latestInitialScrollSessionKind:Pn?"offset":"bootstrap",stylePaddingEnd:Ct,useBootstrapInitialScroll:zt})},[A.length,B,ko,Lo,ue,Ct,zt]),he(()=>{var Ke;Do&&(Oe.scrollForNextCalculateItemsInView=void 0,(Ke=Oe.triggerCalculateItemsInView)==null||Ke.call(Oe)),Eg(ze)},[ze,A,z,I?.anchorIndex,I?.anchorMaxSize,I?.anchorOffset,Do,O,oe,Y,kn,ge,tt]),he(()=>{let Ke=oo.current;oo.current=yr,Rj(ze,Ke)},[ze,yr]);let Ir=R(Ke=>{zt&&xW(ze,{dataLength:A.length,footerSize:Ke[O?"width":"height"],initialScrollAtEnd:ue,stylePaddingEnd:Ct})},[A.length,ue,O,Ct,zt]),Jo=R((Ke,Lt)=>{let en=Oe.scrollLength,Nn=Oe.otherAxisSize;Ij(ze,Ke,ei),Eg(ze);let po=en!==Oe.scrollLength||Nn!==Oe.otherAxisSize;zt&&!Lt&&po&&CW(ze),!zt&&Bu(ze)},[A.length,ue,Ct,zt]),{onLayout:Zo}=QC({onLayoutChange:Jo,onLayoutProp:an,ref:vr});he(()=>{st&&s_(ze)},[st]),he(()=>Yo(!0),[B,z,Yr.join(","),oe,yn,kn,mn,xt]),he(()=>{let{didColumnsChange:Ke,didDataChange:Lt,isFirst:en,props:{data:Nn}}=Oe;!(Nn.length>0&&w_(ze))&&!en&&(Lt||Ke)&&bj(ze,Nn,{didColumnsChange:Ke}),Lt&&(Oe.pendingDataComparison=void 0),Oe.didColumnsChange=!1,Oe.didDataChange=!1,Oe.isFirst=!1},[A,B,z,oe,yn]),he(()=>{var Ke;Fe(ze,"extraData",W);let Lt=Mn.current!==Cr;Mn.current=Cr,(Cr||Lt)&&oe>1&&((Ke=Oe.triggerCalculateItemsInView)==null||Ke.call(Oe,{forceFullItemPositions:!0}))},[W,Cr,oe]),G(()=>{if(!_t)return;let Ke,Lt=()=>{let Nn={footerSize:Ce(ze,"footerSize")||0,headerSize:Ce(ze,"headerSize")||0};(!Ke||Nn.headerSize!==Ke.headerSize||Nn.footerSize!==Ke.footerSize)&&(Ke=Nn,_t(Nn))};Lt();let en=[Ga(ze,"headerSize",Lt),Ga(ze,"footerSize",Lt)];return()=>{for(let Nn of en)Nn()}},[ze,_t]),G(()=>{let Ke=KW({onViewableItemsChanged:In,viewabilityConfig:kt,viewabilityConfigCallbackPairs:Ft});Oe.viewabilityConfigCallbackPairs=Ke,Oe.enableScrollForNextCalculateItemsInView=!0,Ke&&(Oe.scrollForNextCalculateItemsInView=void 0)},[kt,Ft,In]),bG(()=>{}),nr(n,()=>Uj(ze,Ui),[]),G(()=>()=>{h4(Oe),Oe.scheduledWork.dispose()},[Oe]),he(()=>{var Ke;(Ke=Oe.runPendingScrollToEnd)==null||Ke.call(Oe)}),G(()=>{zt||Bu(ze)},[ze,zt]);let Oo=V(()=>({getRenderedItem:Ke=>Kj(ze,Ke),onMomentumScrollEnd:Ke=>{_W(ze),Oe.props.onMomentumScrollEnd&&Oe.props.onMomentumScrollEnd(Ke)},onScroll:Ke=>Pj(ze,Ke),onScrollBeginDrag:Ke=>{var Lt,en;YM(ze),(en=(Lt=Oe.props).onScrollBeginDrag)==null||en.call(Lt,Ke)},onScrollEnd:()=>YM(ze)}),[]),ti=_j(Xo,O,ze,Oo.onScroll),er=Rn;return Ne(ri,null,Ne(mj,{...yt,alignItemsAtEnd:T,canRender:hr,contentContainerStyle:Ht,contentInset:_,freshDataTransitionEpoch:Oe.freshDataTransitionEpoch,getRenderedItem:Oo.getRenderedItem,horizontal:O,initialContentOffset:Jr,ListEmptyComponent:A.length===0?Ge:void 0,ListFooterComponent:rt,ListFooterComponentStyle:$e,ListHeaderComponent:te,onInternalScrollBeginDrag:Oo.onScrollBeginDrag,onInternalScrollEnd:Oo.onScrollEnd,onLayout:Zo,onLayoutFooter:Ir,onMomentumScrollEnd:Oo.onMomentumScrollEnd,onScroll:ti,recycleItems:sn,refreshControl:er?mn>0?mf(er,{progressViewOffset:((w=er.props.progressViewOffset)!=null?w:0)+mn}):er:Ot&&Ne(Nj,{onRefresh:Ot,progressViewOffset:(En||0)+mn,refreshing:!!F}),refScrollView:Hi,renderScrollComponent:be,scrollAdjustHandler:(L=Jt.current)==null?void 0:L.scrollAdjustHandler,scrollEventThrottle:0,snapToIndices:st,stickyHeaderIndices:Xo,style:Tn,useWindowScroll:xr}),jo&&g4)});var Yj=Qj;var S_=Yj;pe();pe();function Jj(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Zj(e,t){let n=t?.trim();if(!n)return e;let o=new RegExp(`^${Jj(n)}(?:\\s*[.:/-]\\s*|\\s+)`,"iu");return e.replace(o,"").trim()||e}function XC(e,t){let n=t?.preferShortName&&e.shortName?e.shortName:e.name;return Zj(n,e.subProvider)}function xd(e){return XC(e,{preferShortName:!0})}var YC="model:",JC="unavailable-models:",ZC="action:",Cd="pluginActions:manage";function Ku(e,t){return`${YC}${e.length}:${e}${t}`}function eb(e){if(!e.startsWith(YC))return null;let t=e.slice(YC.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 I_(e){return`${JC}${e}`}function T_(e){return e.startsWith(JC)?e.slice(JC.length):null}function Vu(e){return`${ZC}${e}`}function k_(e){if(!e.startsWith(ZC))return null;let t=e.slice(ZC.length);return t.length>0?t:null}var L_=me(function(t){let{t:n}=xe(),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(Cl,{hideIndicator:!0,index:t.index,value:Ku(t.instanceId,t.model.slug),disabled:!!t.disabledReason,contentClassName:"flex w-full items-center gap-3",className:H("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?xd(t.model):XC(t.model,t.preferShortName?{preferShortName:!0}:void 0)})}),t.showProvider&&b("div",{className:"mt-1 flex items-center gap-1.5",children:[u(Lr,{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(de,{size:"icon-xs",variant:"ghost",className:H("-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:H("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});pe();function e6(e,t){let n=e.displayName,o=e.enabled?e.readiness:"disabled";if(vg(o))return n;let r=NM(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 t6="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",n6="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 ",o6=`${n6} text-update-foreground`,P_="left",A_=8,E_="max-w-64 text-balance font-normal leading-snug",R_=me(function(t){let{t:n}=xe(),{t:o}=xe(),r=Gt().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:H(t6,"right-0 translate-y-0 transition-[top] duration-200 ease-out"),style:{top:c}}):null,i?b(Te,{children:[u("div",{className:"relative w-full","data-model-picker-provider":"favorites",children:b(Ye,{children:[u(Ze,{render:u("button",{className:H("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:P_,sideOffset:A_,align:"center",className:E_,children:n("modelPicker.favorites")})]})}),u("div",{className:"border-b border-border/70","aria-hidden":"true"})]}):null,t.instanceEntries.map(p=>{let m=!Pu(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?e6(p,o):g?t.getDisabledInstanceTooltip?.(p)??p.displayName:x?`${p.displayName} \u2014 ${C}`:p.displayName,L=b("button",{className:H("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(T=>T===p.instanceId?null:T),onFocus:()=>l(p.instanceId),onBlur:()=>l(T=>T===p.instanceId?null:T),disabled:h,type:"button","aria-label":h?w:p.displayName,children:[u(Lr,{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:o6,"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:P_,sideOffset:A_,align:"center",className:E_,children:[w,p.accountEmail?u("span",{className:"mt-0.5 block text-[10px] text-muted-foreground",children:p.accountEmail}):null]})]})},p.instanceId)})]})})})});function M_(e,t){let n=[],o=[];for(let r of e)t(r)?o.push(r):n.push(r);return{current:n,unavailable:o}}var r6=24;function a6(e){return[lo(e.name),...e.shortName?[lo(e.shortName)]:[],...e.subProvider?[lo(e.subProvider)]:[],lo(e.driverKind),lo(e.providerDisplayName),...e.providerAccountEmail?[lo(e.providerAccountEmail)]:[],tb(e),...e.slug?[lo(e.slug)]:[]]}function i6(e,t,n){return Vr({value:e,query:t,exactBase:n,prefixBase:n+2,boundaryBase:n+4,includesBase:n+6,...t.length>=3?{fuzzyBase:n+100}:{}})}function tb(e){return lo([e.name,e.shortName,e.subProvider,e.driverKind,e.providerDisplayName,e.providerAccountEmail,e.slug].filter(t=>typeof t=="string"&&t.length>0).join(" "))}function N_(e,t){let n=lo(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=i6(e[i],r,i*10);s!==null&&a.push(s)}if(a.length===0)return null;o+=Math.min(...a)}return o}function __(e,t){let n=N_(a6(e),t);return n===null?null:e.isFavorite?n-r6:n}function D_(e,t){return N_([lo(e.title),lo(e.description??"")],t)}function O_({top:e,bottom:t}){if(!(!e&&!t))return H("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 F_(e,t){return`${e}:${t}`}var B_=new Map,z_=[],s6=[],l6=[];function qu(e){return Ku(e.instanceId,e.slug)}function U_(e,t,n){return t.environmentId===n&&t.instanceId===e.instanceId&&t.model===e.slug}function d6(){return u("div",{className:"h-0.5"})}function nb(e){return e?.trim()||null}function H_({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 c6=me(function({index:t,itemKey:n,action:o,showSectionHeader:r}){let{t:a}=xe(),i=nb(o.description);return b(Te,{children:[r?u(H_,{label:a("modelPicker.plugins")}):null,b(Cl,{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})]})]})]})}),u6=me(function({index:t,showSectionHeader:n}){let{t:o}=xe();return b(Te,{children:[n?u(H_,{label:o("modelPicker.plugins")}):null,b(Cl,{hideIndicator:!0,index:t,value:Cd,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")})]})]})}),$_=me(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??z_,m=t.selectedPluginActionKey??null,{t:g}=xe(),{t:h}=xe(),v=Gt(),[y,x]=J(""),[C,w]=J(!1),[L,S]=J(!1),T=N(null),I=N(null),k=N(null),E=v.environment.useActiveEnvironmentId(),P=v.settings.useClientSettings(F=>F.favorites??[]),_=V(()=>E===null?l6:P.filter(F=>F.environmentId===E),[E,P]),[A,B]=J(()=>t.lockedProvider!==null?t.activeInstanceId:_.length>0?"favorites":t.activeInstanceId),[z,q]=J(()=>new Set),X=V(()=>n??[],[n]),Se=v.settings.useUpdateClientSettings(),K=R(()=>{T.current?.focus({preventScroll:!0})},[]),W=R(F=>{B(F),window.requestAnimationFrame(()=>{K()})},[K]);he(()=>{K();let F=window.requestAnimationFrame(()=>{K()}),ce=window.setTimeout(()=>{K()},0);return()=>{window.cancelAnimationFrame(F),window.clearTimeout(ce)}},[K]);let Z=V(()=>new Set(_.map(F=>F_(F.instanceId,F.model))),[_]),j=R(F=>E===null?!1:_.some(ce=>U_(F,ce,E)),[E,_]),O=V(()=>new Map(r.map(F=>[F.instanceId,F])),[r]),Y=R(F=>t.lockedProvider===null?!0:F.driverKind!==t.lockedProvider?!1:t.lockedContinuationGroupKey?F.continuationGroupKey===t.lockedContinuationGroupKey:!0,[t.lockedContinuationGroupKey,t.lockedProvider]),re=V(()=>{let F=new Set;for(let ce of r)Pu(ce)&&F.add(ce.instanceId);return F},[r]),ue=V(()=>{let F=[];for(let[ce,be]of o){let ke=O.get(ce);if(ke&&re.has(ce))for(let Re of be)F.push({slug:Re.slug,name:Re.name,...Re.shortName?{shortName:Re.shortName}:{},...Re.subProvider?{subProvider:Re.subProvider}:{},instanceId:ce,driverKind:ke.driverKind,instanceDisplayName:ke.displayName,...ke.accentColor?{instanceAccentColor:ke.accentColor}:{},...ke.accountEmail?{instanceAccountEmail:ke.accountEmail}:{},...ke.continuationGroupKey?{continuationGroupKey:ke.continuationGroupKey}:{}})}return F},[o,O,re]),le=t.lockedProvider!==null,fe=y.trim().length>0,ae=V(()=>{if(!le)return;let F=new Set;for(let ce of r)Y(ce)||F.add(ce.instanceId);return F},[r,le,Y]),Le=V(()=>{let F=r.filter(xg);if(!le)return F;let ce=[],be=[];for(let ke of F)Y(ke)?ce.push(ke):be.push(ke);return[...ce,...be]},[r,le,Y]),et=!a&&!fe&&Le.length>0,Ge=V(()=>r.map(F=>F.instanceId),[r]),rt=V(()=>{let F=ue;if(y.trim()){let ce=F.map(be=>({model:be,score:__({name:be.name,...be.shortName?{shortName:be.shortName}:{},...be.subProvider?{subProvider:be.subProvider}:{},driverKind:be.driverKind,providerDisplayName:be.instanceDisplayName,...be.instanceAccountEmail?{providerAccountEmail:be.instanceAccountEmail}:{},isFavorite:j(be)},y),isFavorite:j(be),tieBreaker:tb({name:be.name,...be.shortName?{shortName:be.shortName}:{},...be.subProvider?{subProvider:be.subProvider}:{},driverKind:be.driverKind,providerDisplayName:be.instanceDisplayName,...be.instanceAccountEmail?{providerAccountEmail:be.instanceAccountEmail}:{}})})).filter(be=>be.score!==null);if(t.lockedProvider!==null){let be=[];for(let ke of ce)Y(ke.model)&&be.push(ke);return be.toSorted((ke,Re)=>{let st=ke.score-Re.score;return st!==0?st:ke.isFavorite!==Re.isFavorite?ke.isFavorite?-1:1:ke.tieBreaker.localeCompare(Re.tieBreaker)}).map(ke=>ke.model)}return ce.toSorted((be,ke)=>{let Re=be.score-ke.score;return Re!==0?Re:be.isFavorite!==ke.isFavorite?be.isFavorite?-1:1:be.tieBreaker.localeCompare(ke.tieBreaker)}).map(be=>be.model)}return t.lockedProvider!==null?(F=F.filter(ce=>Y(ce)),A==="favorites"?F=F.filter(ce=>j(ce)):F=F.filter(ce=>ce.instanceId===A)):A==="favorites"?F=F.filter(ce=>j(ce)):F=F.filter(ce=>ce.instanceId===A),v.model.sortProviderModelItems(F,{favoriteModelKeys:Z,groupFavorites:A!=="favorites",instanceOrder:A==="favorites"?Ge:[]})},[Z,ue,Ge,Y,t.lockedProvider,y,A,j]),$e=R((F,ce)=>v.model.resolvePickerRowAction({disabledReason:i?.(F,ce)??null,continuationLabel:l?s?.(F,ce)??null:null}),[s,i,l]),te=R(F=>$e(F.instanceId,F.slug),[$e]),Pe=V(()=>M_(rt,F=>te(F).kind==="blocked"),[rt,te]),Q=V(()=>Pe.unavailable.length===0?null:{key:I_(A),models:Pe.unavailable,isExpanded:z.has(A)},[z,Pe,A]),$=V(()=>[...Pe.current,...Q?.isExpanded?Q.models:[]],[Pe,Q]),oe=f!==void 0,ve=V(()=>{if(!oe)return z_;let F=y.trim();return F.length===0?p:p.map(ce=>({action:ce,score:D_(ce,F)})).filter(ce=>ce.score!==null).toSorted((ce,be)=>ce.score-be.score||ce.action.title.localeCompare(be.action.title)).map(ce=>ce.action)},[y,p,oe]),at=oe&&(!fe||ve.length>0),Et=V(()=>at?[...ve.map(F=>Vu(F.id)),Cd]:s6,[at,ve]),Rt=V(()=>new Map(ve.map(F=>[Vu(F.id),F])),[ve]),_t=Et[0]??null,an=R(F=>{q(ce=>{let be=new Set(ce);return be.has(F)?be.delete(F):be.add(F),be})},[]),mt=R((F,ce)=>{let be=$e(ce,F);if(be.kind==="blocked")return;if(be.kind==="continue"){l?.(ce,F);return}let ke=o.get(ce);if(!ke)return;let Re=O.get(ce);if(!Re)return;let st=v.model.resolveSelectableModel(Re.driverKind,F,ke);st&&d(ce,st)},[O,o,l,d,$e]),Wt=R(F=>{let ce=T_(F);if(ce){an(ce);return}if(F===Cd){c?.();return}let be=k_(F);if(be!==null){f?.(be);return}let ke=$.find(st=>qu(st)===F);if(!ke||te(ke).kind==="blocked")return;let Re=eb(F);Re&&mt(Re.slug,Re.instanceId)},[mt,c,f,an,$,te]),Ot=R(F=>{if(E===null)return;let ce=P.findIndex(ke=>U_(F,ke,E)),be=[...P];ce>=0?be.splice(ce,1):be.push({environmentId:E,instanceId:F.instanceId,model:F.slug}),Se({favorites:be})},[E,P,Se]),vt=V(()=>{let F=new Map,ce=0;for(let be of $){if($e(be.instanceId,be.slug).kind==="blocked")continue;let ke=v.keybindings.modelPickerJumpCommandForIndex(ce);if(!ke)return F;F.set(qu(be),ke),ce+=1}return F},[$e,$]),Sn=V(()=>[...vt.keys()],[vt]),ft=V(()=>[...ue.map(F=>qu(F)),...Q?[Q.key]:[],...oe?[...p.map(F=>Vu(F.id)),Cd]:[]],[ue,p,oe,Q]),pn=V(()=>{let F=$.map(ce=>qu(ce));return Q&&F.splice(Pe.current.length,0,Q.key),Et.length>0?[...F,...Et]:F},[Q,Pe,Et,$]),no=V(()=>new Map($.map(F=>[qu(F),F])),[$]),Xt=R(()=>{let F=I.current?.getScrollableNode();if(!(F instanceof HTMLElement))return;let ce=Math.max(0,F.scrollHeight-F.clientHeight);w(F.scrollTop>1),S(ce-F.scrollTop>1)},[]),In=V(()=>({terminalFocus:!1,terminalOpen:t.terminalOpen,modelPickerOpen:!0}),[t.terminalOpen]),En=V(()=>{if(vt.size===0)return B_;let F={platform:navigator.platform,context:In},ce=new Map;for(let[be,ke]of vt){let Re=v.keybindings.shortcutLabelForCommand(X,ke,F);Re&&ce.set(be,Re)}return ce.size>0?ce:B_},[X,vt,In]),sn=m===null?Ku(t.activeInstanceId,t.model):Vu(m),Rn=V(()=>({favoritesSet:Z,modelJumpLabelByKey:En,selectedItemKey:sn}),[Z,En,sn]);return v.pane.useKeydown(F=>{if(F.defaultPrevented||F.repeat)return;let ce=v.keybindings.resolveShortcutCommand(F,X,{platform:navigator.platform,context:In}),be=v.keybindings.modelPickerJumpIndexFromCommand(ce??"");if(be===null)return;let ke=Sn[be];if(!ke)return;let Re=eb(ke);Re&&(F.preventDefault(),F.stopPropagation(),mt(Re.slug,Re.instanceId))},{capture:!0}),he(()=>{w(!1),S(pn.length>5);let F=0,ce=window.requestAnimationFrame(()=>{Xt(),F=window.requestAnimationFrame(Xt)});return()=>{window.cancelAnimationFrame(ce),window.cancelAnimationFrame(F)}},[pn,Xt]),u(uS,{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:[et&&u(R_,{selectedInstanceId:A,onSelectInstance:W,instanceEntries:Le,showFavorites:!0,...ae?{disabledInstanceIds:ae,getDisabledInstanceTooltip:F=>h("instance.lockedToThread",{name:F.displayName})}:{}}),u(sS,{inline:!0,items:ft,filteredItems:pn,filter:null,autoHighlight:!0,open:!0,virtualized:!0,value:sn,onItemHighlighted:(F,ce)=>{k.current=typeof F=="string"?F:null,ce.reason==="keyboard"&&ce.index>=0&&I.current?.scrollIndexIntoView?.({index:ce.index,animated:!1})},onValueChange:F=>{typeof F=="string"&&Wt(F)},children:b("div",{className:H("flex min-h-0 flex-1 flex-col overflow-hidden bg-muted/40",et&&"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(dS,{ref:T,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:F=>x(F.target.value),onKeyDown:F=>{if(F.key==="Escape"){F.preventDefault(),F.stopPropagation(),t.onRequestClose?.();return}if(F.key==="Enter"&&k.current){F.preventBaseUIHandler?.(),F.preventDefault(),F.stopPropagation(),Wt(k.current);return}F.stopPropagation()},onMouseDown:F=>F.stopPropagation(),onTouchStart:F=>F.stopPropagation(),size:"sm",unstyled:!0})})}),u("div",{className:"relative min-h-0 flex-1 overflow-hidden pr-px",children:u(cS,{className:"size-full min-w-0 p-0 not-empty:p-0",children:u(S_,{ref:I,data:pn,extraData:Rn,keyExtractor:F=>F,renderItem:({item:F,index:ce})=>{let be=Q?.key===F?{label:g("modelPicker.unavailableModels"),count:Q.models.length,isExpanded:Q.isExpanded}:null;if(be)return b(Cl,{hideIndicator:!0,index:ce,value:F,"aria-expanded":be.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:be.label}),u("div",{className:"mt-1 text-xs font-normal leading-snug text-muted-foreground/70",children:g("modelPicker.modelCount",{count:be.count})})]}),u(zo,{className:H("size-4 transition-transform",be.isExpanded&&"rotate-90")})]});let ke=Rt.get(F);if(ke)return u(c6,{index:ce,itemKey:F,action:ke,showSectionHeader:F===_t});if(F===Cd)return u(u6,{index:ce,showSectionHeader:F===_t});let Re=no.get(F);if(!Re)return null;let st=te(Re);return u(L_,{index:ce,model:Re,instanceId:Re.instanceId,driver:Re.driverKind,providerDisplayName:Re.instanceDisplayName,providerAccentColor:Re.instanceAccentColor,providerAccountEmail:Re.instanceAccountEmail,isFavorite:j(Re),isSelected:F===sn,showProvider:!0,preferShortName:!le,useTriggerLabel:!1,jumpLabel:En.get(F)??null,disabledReason:st.kind==="blocked"?st.reason:null,actionLabel:st.kind==="continue"?st.label:null,onToggleFavorite:()=>Ot(Re)},F)},estimatedItemSize:52,drawDistance:480,recycleItems:!0,contentContainerClassName:"pl-2 pr-px",ItemSeparatorComponent:d6,onLayout:Xt,onScroll:Xt,className:H("scrollbar-gutter-stable h-full overflow-x-hidden overscroll-y-contain py-1.5 [&::-webkit-scrollbar-track]:my-2",O_({top:C,bottom:L}))})})}),u(lS,{className:"not-empty:py-6 empty:h-0 text-xs font-normal leading-snug",children:g("modelPicker.noModelsFound")})]})})]})})});function Kg(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 K_(e){return e.submissionTarget==="provider-turn"&&e.status!=="known"}function f6(e){let t=e.unknownModelLabel?.trim();if(t)return t;let n=e.catalogOptions.find(o=>o.slug===e.model);return n?xd(n):e.model}var ob=me(function(t){let{t:n}=xe(),[o,r]=J(!1),i=aa()&&(t.open??o),s=V(()=>t.instanceEntries.find(C=>C.instanceId===t.activeInstanceId)??null,[t.activeInstanceId,t.instanceEntries]),l=t.activeInstanceId,d=t.modelOptionsByInstance.get(l)??[],c=Kg(t.modelStatus??"known"),f=f6({model:t.model,catalogOptions:d,unknownModelLabel:c?n(c.seatKey):null}),p=C=>{t.onOpenChange?.(C),t.open===void 0&&r(C)};G(()=>{if(!i)return;let{documentElement:C,body:w}=document,L=C.style.overscrollBehavior,S=w.style.overflow,T=w.style.paddingRight,I=window.innerWidth-C.clientWidth;C.style.overscrollBehavior="contain",w.style.overflow="hidden",I>0&&(w.style.paddingRight=`${I}px`);let k=_=>_ instanceof Element&&_.closest("[data-model-picker-content]"),E=_=>{k(_.target)||_.preventDefault()},P=_=>{k(_.target)||_.preventDefault()};return document.addEventListener("wheel",E,{capture:!0,passive:!1}),document.addEventListener("touchmove",P,{capture:!0,passive:!1}),()=>{document.removeEventListener("wheel",E,{capture:!0}),document.removeEventListener("touchmove",P,{capture:!0}),C.style.overscrollBehavior=L,w.style.overflow=S,w.style.paddingRight=T}},[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?nb(y.description):null;return b(vl,{open:i,onOpenChange:C=>{if(t.disabled){p(!1);return}p(C)},children:[b(xl,{render:u(Wo,{"aria-label":t.triggerAriaLabel,variant:t.triggerVariant??"ghost","data-chat-provider-model-picker":"true",className:H("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(Te,{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(Te,{children:[t.showInstanceOnTrigger!==!1&&s?u(Lr,{driver:s.driverKind,displayName:s.displayName,accentColor:s.accentColor,className:H("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(xa,{})})]}),u(yl,{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($_,{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 V_(e){let{slots:t,...n}=e,o=u(ob,{...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 q_(e){return u(ob,{...e,hideInstanceRail:!0,showInstanceOnTrigger:!1})}function rb(e){let{t}=xe();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(Wo,{"data-composer-plan-toggle":"true",className:H("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(Go,{icon:Zd,className:"text-current opacity-100"}):u(Go,{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 W_(e){return u(rb,{...e})}pe();var Gr=["approval-required","auto-accept-edits","auto","full-access"];var p6={"approval-required":Xd,"auto-accept-edits":sa,auto:ci,"full-access":di},m6={"approval-required":"approvalRequired","auto-accept-edits":"autoAcceptEdits",auto:"auto","full-access":"fullAccess"};function Vg(){let{t:e}=xe();return R(t=>{let n=m6[t];return{mode:t,label:e(`runtimeMode.${n}`),description:e(`runtimeMode.${n}Description`),icon:p6[t]}},[e])}pe();function G_(e){return e.description??e.name}var j_=me(function(t){let{t:n}=xe(),{current:o,modes:r}=t.nativeMode,a=G_(o);return!t.canSwitch||r.length<2?b(Ye,{children:[b(Ze,{render:u(Wo,{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(Go,{icon:ml}),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(Te,{children:[b(Ye,{children:[b(kf,{value:o.id,onValueChange:i=>t.onNativeModeChange(i),children:[b(Ze,{render:u(bg,{className:"shrink-0 whitespace-nowrap font-medium","data-composer-native-mode":o.id,"aria-label":n("composer.agentModeLabel",{name:o.name})}),children:[u(Go,{icon:ml}),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 ab(e){let{t}=xe(),n=Vg();if(e.nativeMode)return u(j_,{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(Te,{children:[b(Ye,{children:[b(kf,{value:e.runtimeMode,onValueChange:i=>e.onRuntimeModeChange(i),children:[b(Ze,{render:u(bg,{"data-composer-permission":"true","data-composer-runtime-mode-switch":e.runtimeModeSwitch,className:"font-medium","aria-label":t("composer.runtimeMode")}),children:[u(Go,{icon:r}),u(Af,{children:o.label})]}),b(Pf,{alignItemWithTrigger:!1,children:[Gr.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 Q_(e){return u(ab,{...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})}pe();var X_=me(function(t){let{t:n}=xe(),o=Vg();return b(Ao,{children:[u(Ro,{render:u(de,{size:"sm",variant:"ghost",className:"shrink-0 px-2 text-muted-foreground/70 hover:text-foreground/80","aria-label":n("composer.moreComposerControls")}),children:u(rr,{"aria-hidden":"true",className:"size-4"})}),b(Eo,{align:"start",children:[t.traitsMenuContent?b(Te,{children:[t.traitsMenuContent,u(ui,{})]}):null,t.showInteractionModeToggle&&t.nativeMode===null?b(Te,{children:[u("div",{className:"px-2 py-1.5 font-medium text-muted-foreground text-xs",children:n("composer.modeMenuTitle")}),b(Pr,{value:t.interactionMode,onValueChange:r=>{!r||r===t.interactionMode||t.onToggleInteractionMode()},children:[u(Ho,{value:"default",children:n("composer.interactionModeChat")}),u(Ho,{value:"plan",children:n("composer.interactionModePlan")})]}),u(ui,{})]}):null,t.nativeMode===null?b(Te,{children:[u("div",{className:"px-2 py-1.5 font-medium text-muted-foreground text-xs",children:n("composer.accessMenuTitle")}),u(Pr,{value:t.runtimeMode,onValueChange:r=>{!r||r===t.runtimeMode||t.onRuntimeModeChange(r)},children:Gr.map(r=>u(Ho,{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(Te,{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(Te,{children:[u(Pr,{value:t.nativeMode.current.id,onValueChange:r=>{t.onNativeModeChange(String(r))},children:t.nativeMode.modes.map(r=>u(Ho,{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})]})]})]})});pe();var Y_="application/x-ycodium-composer-mention";function ib(e){return e.includes(Y_)}function J_(e){let t=n=>ib(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(Y_);o.length!==0&&(e.insertMentionAtEnd(`${o} `)||e.onInsertRejected())}}}function Z_({documentKey:e,insertMentionAtEnd:t,onInsertRejected:n}){let[o,r]=J(!1),a=J_({insertMentionAtEnd:t,setDragActive:r,onInsertRejected:n}),i=s=>{if(!ib(s.dataTransfer.types))return;s.stopPropagation();let l=s.relatedTarget;l instanceof Node&&s.currentTarget.contains(l)||r(!1)};return he(()=>{r(!1)},[e]),G(()=>{if(!o)return;let s=()=>{r(!1)};return window.addEventListener("dragend",s),()=>window.removeEventListener("dragend",s)},[o]),{isDragOverComposer:o,composerMentionDragHandlers:a,onComposerMentionDragLeaveCapture:i}}pe();function sb(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 lb(e){return e.submissionTarget==="provider-turn"?sb(e.providerInput??e.prompt,e.maxInputChars,e.t):null}function eD(e){let t=e.disabledReason??lb(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 tD({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}=xe(),[x,C]=J(null);G(()=>C(null),[d]);let w=R(S=>{C(T=>T===null?T:sb(S,t,y))},[t,y]),L=R((S,T="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=eD({prompt:e.current,submissionTarget:l?"pending-user-input":"provider-turn",maxInputChars:t,t:y,disabledReason:r,event:S,onSend:k=>(p(),f(k,T),!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}}pe();var g6=(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"),h6=e=>{e.preventDefault()},Gu=me(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}=xe(),w=Gt(),L=f?{onPointerDown:h6}:void 0,S=w.settings.useEnvironmentIdentificationMode(),T=s!==null,I=w.devBackdrop.useVisible(S==="artwork"),k=P=>u("button",{type:"button",className:H("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:H("flex items-center justify-end",t?"gap-1.5":"gap-2"),children:[o?k(!0):null,n.questionIndex>0?t?u(de,{size:"icon-sm",variant:"outline",className:"rounded-full",...L,onClick:m,disabled:n.isResponding,"aria-label":C("primaryActions.previousQuestion"),children:u(Qi,{})}):u(de,{size:"sm",variant:"outline",className:"rounded-full",...L,onClick:m,disabled:n.isResponding,children:C("primaryActions.previous")}):null,u(de,{type:"submit",size:"sm",className:H("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:g6(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(Uo,{"aria-hidden":"true",className:"size-4"})});return o?b(Te,{children:[k(!1),P]}):P}if(r)return a?u(de,{type:"submit",size:"sm",className:H("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||T||l,children:C(i?"primaryActions.sendingButtonLabel":"primaryActions.refine")}):b("div",{"data-chat-composer-implement-actions":"true",className:"flex items-center justify-end",children:[u(de,{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||T||l,children:C(i?"primaryActions.sendingButtonLabel":"primaryActions.implement")}),b(Ao,{children:[u(Ro,{render:u(de,{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||T||l}),children:u(un,{})}),u(Eo,{align:"end",side:"top",children:u(ar,{disabled:i||T||l,onClick:()=>{v()},children:C("primaryActions.implementInNewThread")})})]})]});let E=b("button",{type:"submit",className:H("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||T||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(pS,{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(Te,{children:[k(!1),p&&c?E:null]}):E});function nD(e){let{t}=xe(),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:H("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:H("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 oD(e){let t=e.match(/^\s{0,3}#{1,6}\s+(.+)$/m)?.[1]?.trim();return t&&t.length>0?t:null}pe();var v6=2e3,y6="min-h-8 max-w-full py-1.5 font-normal whitespace-normal text-start",x6=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 C6(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 rD=me(function({requestId:t,isResponding:n,options:o,keybindings:r,declineReasonRelay:a,onRespondToApproval:i}){let{t:s}=xe(),l=o??x6(s),d=Gt(),c=a==="native"||a==="queued",[f,p]=J(""),m=N([]);G(()=>{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=pi(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=bS(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(Te,{children:l.map((v,y)=>{let x=y<9?y+1:null,C=b(de,{ref:w=>{m.current[y]=w},size:"xs",variant:v.decision==="accept"?"default":"outline",style:{height:"auto"},"aria-keyshortcuts":C6(v.decision,y),className:`${y6}${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(ri,{children:[u(If,{type:"text",value:f,disabled:n,maxLength:v6,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)})})});pe();var b6=["command","cmd"],w6=["file_path","filePath","path","notebook_path","notebookPath"],S6=["url"],I6=["query","q"],T6=["name","skill","skill_name","skillName"],aD=["toolName","tool_name"],iD=["description"],k6=[],L6=[];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 P6(e){let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\")),n=t>=0?e.slice(t+1):e;return n.length>0?n:e}function A6(e){let t=e[0];return t===void 0?null:e.every(n=>n.path===t.path)?t.path:null}function lD(e){let t=e.args??k6,n=e.fileChanges??L6,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,b6,o);d!==null&&(s={shape:"command",command:d});break}case"file-read":case"file-change":{let d=Ja(t,w6,o)??A6(n);d!==null&&(i=P6(d),s=n.some(c=>c.path===d)?{shape:"none"}:{shape:"path",path:d});break}case"web-fetch":{let d=Ja(t,S6,o);d!==null&&(s={shape:"url",url:d});break}case"web-search":{let d=Ja(t,I6,o);d!==null&&(s={shape:"query",query:d});break}case"skill":{i=Ja(t,T6,o)??Ja(t,aD,o),l=Ja(t,iD,o),t.length>0&&(s={shape:"none"});break}case"mcp-tool":case"tool":{i=Ja(t,aD,o),l=Ja(t,iD,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 E6={"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"},R6={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"},M6={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"},N6={command:"approval.commandDetailLabel",path:"approval.body.pathLabel",url:"approval.body.urlLabel",query:"approval.body.queryLabel",text:"approval.body.detailLabel"};function dD(e,t){let n=e.subject!==null?E6[e.kind]:void 0;return n!==void 0?t(n,{name:e.subject}):t(R6[e.kind])}function cD(e,t){return t(M6[e])}function uD(e,t){return t(N6[e])}function fD(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=sD(t.oldText??""),o=sD(t.newText);if(n.length===0&&o.length===0)return null;let r=`--- a/${e.path}
|
|
3780
|
+
`?d.insertParagraph():c===" "?d.insertNodes([JP()]):d.insertText(c)}}}else t.insertRawText(i)}function Yx(e,t,n){e.dispatchCommand(qA,{nodes:t,selection:n})||(n.insertNodes(t),(function(o){if(Ne(o)&&o.isCollapsed()){let r=o.anchor,a=null,i=rd(r,"previous");if(i)if(Sm(i))a=i.origin;else{let s=eA(i,_i(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 WR(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=WR(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 GR(e,t){let n=[],o=At().getChildren();for(let r=0;r<o.length;r++)WR(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=fA(o);dt(r)&&yE(r),t.push(r)}return t}var md=null;async function jV(e,t,n){if(md!==null)return!1;if(t!==null)return new Promise((d,c)=>{e.update(()=>{d(KR(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=>(vu(p,ClipboardEvent)&&(f(),md!==null&&(r.clearTimeout(md),md=null),d(KR(e,p,n))),!0),Lm);md=r.setTimeout(()=>{f(),md=null,d(!1)},50),a.execCommand("copy"),s.remove()})}function KR(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&&!aE(e,i,s))return!1;n=XR(a)}t.preventDefault();let o=t.clipboardData;return o!==null&&(YR(o,n),!0)}var QR=[["text/html",VR],["application/x-lexical-editor",qR]];function XR(e=Ke()){let t={"text/plain":e?e.getTextContent():""};if(e){let n=xm();for(let[o,r]of QR){let a=r(n,e);a!==null&&(t[o]=a)}}return t}function YR(e,t){for(let[n]of QR)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,_ce=pa.$generateJSONFromSelectedNodes,Dce=pa.$generateNodesFromSerializedNodes,Oce=pa.$getClipboardDataFromSelection,JR=pa.$getHtmlContent,Fce=pa.$getLexicalContent,Zx=pa.$insertDataTransferForPlainText,Bce=pa.$insertDataTransferForRichText,zce=pa.$insertGeneratedNodes,Uce=pa.copyToClipboard,Hce=pa.setLexicalClipboardDataTransfer;var eC={};En(eC,{PlainTextExtension:()=>tq,registerPlainText:()=>tM});var Ks=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,QV=Ks&&"documentMode"in document?document.documentMode:null,XV=Ks&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),YV=!(!Ks||!("InputEvent"in window)||QV)&&"getTargetRanges"in new window.InputEvent("input"),JV=Ks&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),ZR=Ks&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,ZV=Ks&&/^(?=.*Chrome).*/i.test(navigator.userAgent),eq=Ks&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&XV&&!ZV;function eM(e,t){t.update(()=>{if(e!==null){let n=vu(e,KeyboardEvent)?null:e.clipboardData,o=Ke();if(o!==null&&!o.isCollapsed()&&n!=null){e.preventDefault();let r=JR(t);r!==null&&n.setData("text/html",r),n.setData("text/plain",o.getTextContent())}}})}function tM(e){return Ha(e.registerCommand(Am,t=>{let n=Ke();return!!Ne(n)&&(n.deleteCharacter(t),!0)},nn),e.registerCommand(TA,t=>{let n=Ke();return!!Ne(n)&&(n.deleteWord(t),!0)},nn),e.registerCommand(IA,t=>{let n=Ke();return!!Ne(n)&&(n.deleteLine(t),!0)},nn),e.registerCommand(wA,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},nn),e.registerCommand(KA,()=>{let t=Ke();return!!Ne(t)&&(t.removeText(),!0)},nn),e.registerCommand(ax,t=>{let n=Ke();return!!Ne(n)&&(n.insertLineBreak(t),!0)},nn),e.registerCommand(RA,()=>{let t=Ke();return!!Ne(t)&&(t.insertLineBreak(),!0)},nn),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)},nn),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)},nn),e.registerCommand(Nm,t=>{let n=Ke();return!!Ne(n)&&(!ZR||navigator.language!=="ko-KR")&&(t.preventDefault(),e.dispatchCommand(Am,!0))},nn),e.registerCommand(DA,t=>{let n=Ke();return!!Ne(n)&&(t.preventDefault(),e.dispatchCommand(Am,!1))},nn),e.registerCommand(_m,t=>{let n=Ke();if(!Ne(n))return!1;if(t!==null){if((ZR||JV||eq)&&YV)return!1;t.preventDefault()}return e.dispatchCommand(ax,!1)},nn),e.registerCommand(WA,()=>(Im(),!0),nn),e.registerCommand(Pm,t=>{let n=Ke();return!!Ne(n)&&(eM(t,e),!0)},nn),e.registerCommand(SA,t=>{let n=Ke();return!!Ne(n)&&((function(o,r){eM(o,r),r.update(()=>{let a=Ke();Ne(a)&&a.removeText()})})(t,e),!0)},nn),e.registerCommand(Om,t=>{let n=Ke();return!!Ne(n)&&((function(o,r){o.preventDefault(),r.update(()=>{let a=Ke(),i=vu(o,ClipboardEvent)?o.clipboardData:null;i!=null&&Ne(a)&&Zx(i,a)},{tag:UA})})(t,e),!0)},nn),e.registerCommand(LA,t=>{let n=Ke();return!!Ne(n)&&(t.preventDefault(),!0)},nn),e.registerCommand(kA,t=>{let n=Ke();return!!Ne(n)&&(t.preventDefault(),!0)},nn))}var tq=Rn({conflictsWith:["@lexical/rich-text"],dependencies:[DR],name:"@lexical/plain-text",register:tM});var nM=eC,jce=nM.PlainTextExtension,oM=nM.registerPlainText;var nC={};En(nC,{PlainTextPlugin:()=>aq});ue();var lg=Md(Ic(),1);function nq(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 oq({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 rq({editor:e,ErrorBoundary:t}){return(function(n){let o=sR.maybeFromEditor(n);if(o&&o.hasExtensionByName(MR.name)){for(let r of["@lexical/plain-text","@lexical/rich-text"])o.hasExtensionByName(r)&&nq(320,r);return!0}return!1})(e)?null:u(oq,{editor:e,ErrorBoundary:t})}function rM(e){return e.getEditorState().read(ag(e.isComposing()))}function aq({contentEditable:e,placeholder:t=null,ErrorBoundary:n}){let[o]=Cn();return(function(r){tC(()=>Ha(oM(r),OR(r)),[r])})(o),b(Le,{children:[e,u(iq,{content:t}),u(rq,{editor:o,ErrorBoundary:n})]})}function iq({content:e}){let[t]=Cn(),n=(function(r){let[a,i]=J(()=>rM(r));return tC(()=>{function s(){let l=rM(r);i(l)}return s(),Ha(r.registerUpdateListener(()=>{s()}),r.registerEditableListener(()=>{s()}))},[r]),a})(t),o=RR();return n?typeof e=="function"?e(o):e:null}var sq=nC,aM=sq.PlainTextPlugin;function lq(e){let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t>=0?e.slice(t+1):e}function dq(e){return e.replaceAll("\\","\\\\").replaceAll("[","\\[").replaceAll("]","\\]")}function cq(e){return encodeURI(e).replaceAll("(","%28").replaceAll(")","%29").replaceAll("#","%23").replaceAll("?","%3F").replaceAll("\\","%5C")}function wu(e){return`[${dq(lq(e))}](${cq(e)})`}ue();function iM(e){return/mac|iphone|ipad|ipod/i.test(e)}function Su(){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 sM(e){let t=oC(e);return t.startsWith(".")&&!t.slice(1).includes(".")?"directory":t.includes(".")?"file":"directory"}var lM=bi;function dM(e){return b(Le,{children:[u(Rp,{pathValue:e.path,kind:sM(e.path),theme:e.theme,className:aa}),u("span",{className:e.selectable?ok:ia,children:e.label})]})}function cM(e){let{label:t,tooltipText:n,expired:o=!1}=e;return b(Ye,{children:[u(Ze,{render:b("span",{className:$(bi,o&&"border-destructive/35 bg-destructive/8 text-destructive"),"data-terminal-context-expired":o?"true":void 0,children:[u(qo,{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 uM({context:e}){let{t}=Ce(),n=HT(e,t),o=UT(e),r=o?t("pendingContext.terminalExpired",{label:n}):e.text;return u(cM,{label:n,tooltipText:r,expired:o})}function fM(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=_c(`${o}
|
|
3781
|
+
`).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(`
|
|
3782
|
+
`);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(Os())}},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},vr)}var uq=`composer-editor-${Math.random().toString(36).slice(2)}`,fq=[["(",")"],["[","]"],["{","}"],["'","'"],['"','"'],["\u201C","\u201D"],["`","`"],["<",">"],["\xAB","\xBB"],["*","*"],["_","_"]],vM=new Map(fq),pM=vM.get("`")??null,yM=Ct({onRemoveTerminalContext:()=>{}});function pq(e){let t=vq(),n=u("span",{className:lM,contentEditable:!1,spellCheck:!1,"data-composer-mention-chip":"true",children:u(dM,{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 Iu=class e extends Ua{__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=wu(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(pq,{path:this.__path})}};function sC(e,t){return vm(new Iu(e,t))}function mq(e){let t=e.shortDescription?.trim();return t||e.description?.trim()||null}function Tu(e){return new Map(e.map(t=>[t.name,{label:sa(t),description:mq(t)}]))}function gq(e){let t=b("span",{className:rk,contentEditable:!1,spellCheck:!1,"data-composer-skill-chip":"true",children:[u("span",{"aria-hidden":"true",className:aa,dangerouslySetInnerHTML:{__html:ak}}),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 ku=class e extends Ua{__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 xM(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(gq,{skillLabel:this.__skillLabel,skillDescription:this.__skillDescription})}};function xM(e,t,n){return vm(new ku(e,t,n))}function hq(e){return u(uM,{context:e.context})}var Vs=class e extends Ua{__context;static getType(){return"composer-terminal-context"}static clone(t){return new e(t.__context,t.__key)}static importJSON(t){return CM(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(hq,{context:this.__context})}};function CM(e){return vm(new Vs(e))}function Fi(e){return e instanceof Iu||e instanceof ku||e instanceof Vs}function vq(){return document.documentElement.classList.contains("dark")?"dark":"light"}function yq(e){return e.map(t=>[t.id,t.threadId,t.terminalId,t.terminalLabel,t.lineStart,t.lineEnd,t.createdAt,t.text].join("")).join("")}function xq(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 bM(e){return e.getTextContentSize()}function Cq(e,t,n){return t+(n>0?ug(e):0)}function bq(e,t,n){return t+(n>0?bM(e):0)}function wq(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 Fi(e)?ug(e):dt(e)?e.getTextContentSize():id(e)?1:je(e)?e.getChildren().reduce((t,n)=>t+fg(n),0):0}function aC(e){return Fi(e)?bM(e):dt(e)?e.getTextContentSize():id(e)?1:je(e)?e.getChildren().reduce((t,n)=>t+aC(n),0):0}function Lu(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(Fi(e))return Cq(e,n,t);if(id(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(Fi(e))return bq(e,n,t);if(id(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(Fi(e))return wq(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(id(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 qs(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=Fs();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=Fs();c.anchor.set(l.key,l.offset,l.type),c.focus.set(d.key,d.offset,d.type),Br(c)}function mM(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 gM(e){return Ne(e)?e.getNodes().some(t=>Fi(t)):!1}function Pu(e){let t=Ke();if(!Ne(t)||!t.isCollapsed())return e;let n=t.anchor.getNode(),o=Lu(n,t.anchor.offset),r=gg();return Math.max(0,Math.min(o,r))}function hM(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:Lu(t.anchor.getNode(),t.anchor.offset),focus:Lu(t.focus.getNode(),t.focus.offset)}:e}function Sq(e,t){let n=t.split(`
|
|
3783
|
+
`);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(Os())}}function lC(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(sC(i.path,i.source));continue}if(i.type==="skill"){let s=n.get(i.name);r.append(xM(i.name,s?.label??sa({name:i.name}),s?.description??null));continue}if(i.type==="terminal-context"){i.context&&r.append(CM(i.context));continue}Sq(r,i.text)}}function iC(e){return e instanceof Vs?[e.__context.id]:je(e)?e.getChildren().flatMap(t=>iC(t)):[]}function Iq(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(NA,l=>n("ArrowDown",l),vr),r=t.registerCommand(_A,l=>n("ArrowUp",l),vr),a=t.registerCommand(_m,l=>n("Enter",l),vr),i=t.registerCommand(Dm,l=>n("Tab",l),vr),s=t.registerCommand(FA,l=>n("Escape",l),vr);return()=>{o(),r(),a(),i(),s()}},[t,e]),null}function Tq(){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=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(Mm,o=>{let r=null;if(e.getEditorState().read(()=>{let i=Ke();if(!Ne(i)||!i.isCollapsed())return;let s=Pu(0),l=gg();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 kq(){let[e]=Cn();return W(()=>e.registerCommand(OA,t=>{if(!iM(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(YP(o,e))}),!0)},vr),[e]),null}function Lq(){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 Pq(){let[e]=Cn(),{onRemoveTerminalContext:t}=bt(yM);return W(()=>e.registerCommand(Nm,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 Aq(){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(PA,()=>(n=!0,o(r()),!1),sd),s=e.registerCommand(vA,()=>(n=!1,o(new Set),!1),sd);return()=>{a(),i(),s()}},[e]),null}function Eq(){let[e]=Cn();return W(()=>fM(e,{createMentionNode:sC,getExpandedAbsoluteOffsetForPoint:pg}),[e]),null}function Rq(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=gh(s=>{let l=vM.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()||gM(h))return null;let v=mM(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(gM(h)){r.current=null,a.current=null;return}let v=mM(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==="`"&&pM!==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=pM;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:zr})})},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 Mq({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=yq(o),C=N(x),w=xq(r),L=N(w),S=N(Tu(r)),T=N({value:t,cursor:y,expandedCursor:v.expandedCursor,selection:v.selection,terminalContextIds:o.map(B=>B.id)}),I=N(e),k=v.history,E=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=T.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)}),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};T.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;E.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)&&qs(B)},{discrete:!0,tag:zr});U?xR(U,Y):Y(),pd(e,t,T.current),queueMicrotask(()=>{E.current=!1})},[n,e,m,w,o,x,t]);let _=R(B=>{let V=m.getRootElement();if(!V)return;let Q=pr(T.current.value,B);V.focus({preventScroll:!0}),m.update(()=>{qs(Q)}),T.current={value:T.current.value,cursor:Q,expandedCursor:jo(T.current.value,Q),selection:{anchor:Q,focus:Q},terminalContextIds:T.current.terminalContextIds},pd(I.current,T.current.value,{cursor:T.current.cursor,expandedCursor:T.current.expandedCursor,selection:T.current.selection}),g.current(T.current.value,Q,T.current.expandedCursor,!1,T.current.terminalContextIds)},[m]),A=R(()=>{let B=T.current;return m.getEditorState().read(()=>{let V=At().getTextContent(),Q=pr(V,T.current.cursor),Se=pr(V,Pu(Q)),H=dg(V,T.current.expandedCursor),q=dg(V,hM(H)),ee=iC(At()),G=rC(T.current.selection);B={value:V,cursor:Se,expandedCursor:q,selection:G,terminalContextIds:ee}}),T.current=B,pd(I.current,B.value,B),B},[m]);ir(p,()=>({focus:()=>{_(T.current.cursor)},focusAt:_,focusAtEnd:()=>{_(bo(T.current.value,T.current.value.length))},readSnapshot:A}),[_,A]);let F=R(B=>{B.read(()=>{let V=At().getTextContent(),Q=pr(V,T.current.cursor),Se=pr(V,Pu(Q)),H=dg(V,T.current.expandedCursor),q=dg(V,hM(H)),ee=iC(At()),G=rC(T.current.selection),te=T.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])||E.current)return;T.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(yM,{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(aM,{contentEditable:u(PR,{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:AR}),u(ER,{onChange:F}),u(Iq,{...c?{onCommandKeyDown:c}:{}}),u(Rq,{terminalContexts:o,skills:r}),u(kq,{}),u(Tq,{}),u(Lq,{}),u(Pq,{}),u(Eq,{}),u(Aq,{}),u(gR,{externalHistoryState:k},e)]})})}function Nq(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(Mq,{...i})}function wM({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:()=>{lC(m.current,g.current,h.current)},onError:y=>{throw y}}),[]);return u(bR,{initialConfig:v,children:u(Nq,{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}:{}})},uq)}ue();function _q(e){let t=new Date(e);return Number.isNaN(t.getTime())?null:t}function SM(e,t){let n=_q(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 IM=90;function TM(e){return e.droppedImageNames.length+(e.unreadableImageNames?.length??0)}function Dq(e,t){let n=e.prompt.trim().replace(/\s+/g," ");if(n.length>0)return n.length>IM?`${n.slice(0,IM)}\u2026`:n;let o=e.attachments.length+e.droppedImageNames.length;return o>0?t("stash.imageCountLabel",{count:o}):t("stash.emptyEntry")}var kM=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:Dq(p,i)}),p.pendingImageCount?u("span",{className:"shrink-0 text-[10px] text-secondary-label",children:i("stash.savingImage",{count:p.pendingImageCount})}):TM(p)>0?u("span",{className:"shrink-0 text-[10px] text-warning-foreground",children:i("stash.imagesDropped",{count:TM(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:SM(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 Oq(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 Fq(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+dC(t,n);if(e.boundaryBase!==void 0){let o=Fq(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=Oq(t,n);if(o!==null)return e.fuzzyBase+o}return null}function Bq(e,t){let n=e.score-t.score;return n!==0?n:e.tieBreaker.localeCompare(t.tieBreaker)}function zq(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;Bq(t,a)<0?o=r:n=r+1}return n}function hg(e,t,n){if(n<=0)return;let o=zq(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=[$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 LM(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 Uq(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=[$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 PM(e,t,n=[]){let o=co(t,{trimLeadingPattern:/^\/+/});if(!o)return[...e];let r=[];for(let a of e){let i=Uq(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 AM(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 EM=(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 RM({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),T=y!==null&&vg(h)===y?null:h,I=T?.kind==="path"?T.query:"",k=T?.kind==="path",E=l({environmentId:i,cwd:k?s:null,query:k?I:null}),P=K(()=>{if(!T)return[];if(T.kind==="path")return E.entries.map(ee=>({id:`path:${ee.kind}:${ee.path}`,type:"path",path:ee.path,pathKind:ee.kind,label:Hq(ee.path),description:ee.path.slice(0,Math.max(0,ee.path.lastIndexOf("/")))}));if(T.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=mk(n?.skills??[],r),te=gk(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=T.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===""?AM(Y,a):PM(Y,me,a)}return T.kind==="skill"?LM(n?.skills??[],T.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"))})):[]},[T,o,a,t,n,r,g,E.entries]),_=!!T,A=T?`${T.kind}:${T.query.trim().toLowerCase()}`:null,F=K(()=>{let ee=uC({items:P,highlightedItemId:C,currentSearchKey:A,highlightedSearchKey:L});return P.find(G=>G.id===ee)??null},[P,C,A,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=`${wu(ee.path)} `,ge=EM(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=EM(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:A,highlightedSearchKey:L});w(G=>G===ee?G:ee),S(G=>G===A?G:A)},[C,L,P,_,A]);let Q=R(ee=>{w(ee),S(A)},[A]),Se=R(()=>{let{trigger:ee}=B();return ee===null?!1:(x(vg(ee)),w(null),!0)},[B]),H=R((ee,G)=>{let te=jo(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:T,composerMenuItems:P,composerMenuOpen:_,composerMenuSearchKey:A,activeComposerMenuItem:F,resolveActiveComposerTrigger:B,onSelectComposerItem:V,onComposerMenuItemHighlighted:Q,onMenuEscape:Se,resetForDocumentChange:H,dismissTrigger:q,workspaceEntries:E,highlightedItemId:C,setTrigger:v,setHighlightedItemId:w,setHighlightedSearchKey:S}}function Hq(e){let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t>=0?e.slice(t+1):e}function $q(e,t){return e.bottom===t.bottom&&e.left===t.left&&e.maxHeight===t.maxHeight&&e.width===t.width&&e.overlap===t.overlap}function MM(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&&$q(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 Kq=[],Vq=[],qq=e=>e.prompt,Wq=(e,t)=>{let n=new Map(e.map(o=>[o.id,o]));return t.flatMap(o=>{let r=n.get(o);return r?[r]:[]})},Gq=(e,t)=>e.length===t.length&&e.every((n,o)=>n.id===t[o]),NM=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:T,changeUserInputCustomAnswer:I,terminalContexts:k,showTerminalContexts:E,showEditor:P,isApprovalState:_,editorClassName:A,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=$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 yR(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=QT(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&&T?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,T,Lt,i,X,yt]),gt=R(()=>{let xe=s.current?.readSnapshot();return xe||{value:i.current,cursor:j,expandedCursor:jo(i.current,j),terminalContextIds:k.map(_e=>_e.id)}},[j,s,i,k]),zt=RM({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=k.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,k,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&&T){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),Gq(k,ot)||Xe(r,Wq(k,ot)),X(_e),rn(We?null:wo(xe,qe))},[L?.activeQuestion,T,Lt,i,X,yt,r,k,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"?WT({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(MM,{anchor:l,children:u(kM,{entries:ee,onRestore:G,onDelete:te,onClose:me})}),In&&!_&&u(MM,{anchor:l,children:u(yk,{items:wt,resolvedTheme:d,isLoading:ht,triggerKind:O,emptyStateText:Ln,activeItemId:ct?.id??null,onHighlightedItemChange:ro,onSelect:St})}),P?u(wM,{editorRef:s,documentKey:a,value:Te,cursor:j,terminalContexts:E?k:Kq,skills:f?.skills??Vq,...A?{className:A}:{},onRemoveTerminalContext:mn,onChange:Pt,onCommandKeyDown:Jt,onPaste:V,placeholder:F,disabled:B}):null]})});ue();function _M(e){return e==="ready"}function DM(e){return e==="ready"||e==="unchecked"||e==="checking"}function OM(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&&DM(e.readiness)}function Au(e){return e.enabled}function FM(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 BM=e=>e.enabled;function zM(e,t){let n=e.find(o=>o.instanceId===t);if(n)return n.driverKind}var UM="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:$(UM,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 xg({className:e,size:t="sm",variant:n="ghost",...o}){return u(Ww,{className:$(UM,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(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 mC=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?pC(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(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(Wo,{value:c.instanceId,children:fC(c,n)},c.instanceId))})})]})});function HM(e){return u(mC,{...e})}function $M(e){return e.machineUnavailable?"machineDisconnected":e.sessionStarted&&e.sessionDisconnected?"settled":"default"}function KM(e){switch(e){case"machineDisconnected":return"composer.disconnectedPlaceholder";case"settled":return"composer.idlePlaceholder";case"default":return null}}ue();ue();ue();var NC=Md(GM(),1),AN=Md(Ic(),1),EN=Md(Ic(),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,Wa={OS:"web"};function Ws(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 RN(){return"normal"}function o4(e){var t;return(t=e?.horizontalRTLScrollType)!=null?t:RN()}function r4(e){var t;return(t=e?.rtl)!=null?t:!1}function ja(e){return DC(e?.props)}function DC(e){return!!e?.horizontal&&r4(e)}function OC(e){return e?.horizontal?(DC(e)?e.stylePaddingLeft:e.stylePaddingRight)||0:e?.stylePaddingBottom||0}function a4(e,t){var n;return(n=_C(e,t))!=null?n:0}function jM(e,t){return t&&(ja(e)?t.left:t.right)||0}function i4(e,t,n,o){return!ja(e)||o===void 0||!Number.isFinite(o)?t:Math.max(0,o-t-n)}function FC(e,t,n){if(!e||!ja(e))return t;let o=_C(e,n),r=Ws(t,o),a=o4(e);return a==="negative"?r===0?0:-r:a==="inverted"?o===void 0?r:Ws(o-r,o):r}function s4(e,t,n){if(!ja(e))return e.horizontalRTLScrollType=void 0,t;let o=_C(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=RN();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 l4=e=>e,Eg=Ct(null),MN="\0",d4=0;function c4({children:e}){let[t]=J(()=>({animatedScrollY:l4(0),columnWrapperStyle:void 0,containerLayoutTriggers:new Map,contextNum:d4++,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 Vr(){return Ht(Eg)}function NN(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 u4(e){return e.length===1?e[0]:e.join(MN)}function f4(e){return e.split(MN)}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 p4(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 m4(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(Eg),n=u4(e),{subscribe:o,get:r}=K(()=>NN(t,f4(n)),[t,n]);return(0,NC.useSyncExternalStore)(o,r,r)}function g4(e,t){let n=Ht(Eg),{subscribe:o,get:r}=K(()=>NN(n,[e]),[n,e]),a=R(()=>t(r()[0]),[r,t]);return(0,NC.useSyncExternalStore)(o,a,a)}function h4(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?jM(o,s):s?.bottom)||0,d=h4(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=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(Ag,{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 v4(()=>{c()},100),De(Ag,{pointerEvents:"none",style:{backgroundColor:"#FFFFFFCC",borderRadius:4,padding:4,paddingBottom:4,paddingLeft:4,position:"absolute",right:0,top:0}},De(hd,null,De(yr,null,"TotalSize:"),De(yr,null,n.toFixed(2))),De(hd,null,De(yr,null,"ContentSize:"),De(yr,null,d.toFixed(2))),De(hd,null,De(yr,null,"At end:"),De(yr,null,String(l))),De(hd,null,De(yr,null,"ScrollAdjust:"),De(yr,null,o.toFixed(2))),De(hd,null,De(yr,null,"RawScroll: "),De(yr,null,r.toFixed(2))),De(hd,null,De(yr,null,"ComputedScroll: "),De(yr,null,a.toFixed(2))))});function v4(e,t){W(()=>{let n=setInterval(e,t);return()=>clearInterval(n)},[t])}var BC=!0,_N=new WeakMap;function y4(e){return _N.get(e)}function x4(e,t){_N.set(e,t)}var C4=typeof __DEV__<"u"?__DEV__:void 0,QM,XM=typeof process<"u"&&typeof process.env=="object"&&process.env?(QM="production")!=null?QM:process.env.MODE:void 0,YM=typeof XM=="string"?XM.toLowerCase()!=="production":void 0,JM,Zo=(JM=YM??C4)!=null?JM:!1,vd=-1e7,DN=1,b4=Zo&&!1,w4=Zo&&!1;function Rg({scheduledWork:e}){e.cancel("checkFinishedScrollFrame"),e.cancel("checkFinishedScrollRetryFrame"),e.cancel("checkFinishedScrollFallback"),e.cancel("platformScrollCompletion")}function ON(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 S4(e){Rg(e),e.scheduledWork.cancel("imperativeScrollReady"),e.scrollingTo=void 0,e.scrollTargetPinnedRange=void 0,ON(e)}function I4(e,t,n){return{...t,nativeEvent:{...t.nativeEvent,contentOffset:e.props.horizontal?{x:n,y:0}:{x:0,y:n}}}}function T4(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,I4(i,s,(o=(n=t??i.scrollPending)!=null?n:i.scroll)!=null?o:0)))}var hC=1;function k4(e){return!!(e?.didDispatchNativeScroll||e?.didRetrySilentInitialScroll||e?.watchdog)}function ZM(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 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&&!k4(l))return ZM(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 L4=1.3;function SC(e,t,n){let o=Math.abs(e);return!t&&n>0&&o>=n*L4||!t&&n<=0&&o>0}var FN=(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 P4(e,t){let n=e.state;t==="start"?(n.isStartReached=!1,n.startReachedSnapshot=void 0):(n.isEndReached=!1,n.endReachedSnapshot=void 0)}function BN(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=SC(t.scroll,!1,a),l=SC(o,r,i);s&&l&&(t.edgeReachedGate=void 0)}function zN(e,t,n,o){return!e.state.edgeReachedGate||n===t||!!o}function UN(e){e.state.edgeReachedGate="closed"}function eN(e){e.state.edgeReachedGate&&(e.state.edgeReachedGate="prepared")}function A4(e,t){let n=e.state;if(n.edgeReachedGate!=="prepared")return;let o=t<0?"start":"end";return n.edgeReachedGate="closed",P4(e,o),o}function Mu(e){return!!e?.initialScroll&&!e.didFinishInitialScroll}function HN(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(BN(e),f>0&&a){let p=js(e),m=f-s-i-p,g=f<i;Be(e,"isAtEnd",g||m<=DN),Be(e,"isNearEnd",g||m<=c*i),Be(e,"isWithinMaintainScrollAtEndThreshold",g||m<=d*i),Mu(r)||l||(r.isEndReached=FN(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;zN(e,"end",t,n)&&(UN(e),(x=(y=r.props).onEndReached)==null||x.call(y,{distanceFromEnd:v}))},v=>{r.endReachedSnapshot=v}))}}function E4(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;BN(e),r&&p>0&&s>p&&d&&(d.contentSize!==c||d.dataLength!==f)&&(o.isStartReached=!1,o.startReachedSnapshot=void 0),Be(e,"isAtStart",s<=DN),Be(e,"isNearStart",s<=p),Mu(o)||o.scrollingTo||(o.isStartReached=FN(s,!1,p,o.isStartReached,d,{contentSize:c,dataLength:f,scrollPosition:s},g=>{var h,v;zN(e,"start",t,n)&&(UN(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;HN(e,t,n),E4(e,t,n)}function $N(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 R4=6,M4=3,N4=250;function KN(e){e.state.scheduledWork.cancel("adaptiveRender")}function tN(e,t){let n=e.state;KN(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 zC(e){var t,n;KN(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 _4(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:R4,c=(r=s.exitVelocity)!=null?r:M4,f=(a=s.exitDelay)!=null?a:N4,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"),tN(e,f)):l==="light"&&tN(e,f))}else zC(e)}var UC=50;function VN(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),Ou(e,"normal","ready"),o.props.drawDistance>UC&&qN(e),o.didLoad||(o.didLoad=!0,a&&a({elapsedTimeInMs:Date.now()-r})))}var D4=2e3;function nN(e,t){e.scroll=t,e.scrollPending=t,e.scrollPrev=t}function WN(e){e.scheduledWork.cancel("preservedInitialScroll")}function yd(e){WN(e),e.clearPreservedInitialScrollOnNextFinish=void 0,e.initialScroll=void 0,Ga(e)}function oN(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),Ga(r,{bootstrap:null}),xd(e))}function xd(e,t){var n,o,r;let a=e.state;if(t?.resolvedOffset!==void 0)nN(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)&&nN(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),WN(a),t?.schedulePreservedTargetClear&&a.scheduledWork.timeout(()=>{var g;!a.didFinishInitialScroll||(g=a.scrollingTo)!=null&&g.isInitialScroll||!a.initialScroll||yd(a)},D4,"preservedInitialScroll")):yd(a),t?.recalculateItems&&$N(e),$C(e,{didInitialScroll:!0}),p&&T4(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 O4(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 F4(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 B4(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-F4(e)-js(e)):0}function Js(e){let t=be(e,"alignItemsAtEndPadding")||0,n=B4(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 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&&Nu(e,t,s,o),a.set(t,n)}function GN(e){return typeof e=="function"}function Dg(e){return Array.isArray(e)}var rN=new Set;function Gs(e,t){Zo&&!rN.has(e)&&(rN.add(e),console.warn(`[legend-list] ${t}`))}function Fu(e){return Math.floor(e*8)/8}function _u(e){return e==null}function aN(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 aN(e,n)+aN(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 QN(e,t){let n=jt(e.state,t);return jN(e,n,t,e.state.props.data[t])}function z4(e,t,n){for(let o=t;o<=n;o++)if(QN(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=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),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=O4(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){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&&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}$N(e),r?.()}}var U4=80,H4=1500,$4=320,K4=1;function V4(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&&Bu(e)},100,"platformScrollCompletion")}}function q4(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"),H4),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)<=K4;v==="scrollend"&&!x||(l.cancel("platformScrollCompletion"),Bu(e))},g=()=>{i!==void 0&&clearTimeout(i),i=setTimeout(()=>m("idle"),U4)},h=()=>m("scrollend");o.addEventListener("scroll",g),a?o.addEventListener("scrollend",h):i=setTimeout(()=>m("idle"),$4),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=a4(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&&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,W4=300,G4=2,j4=1;function Q4(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 X4(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>=G4){e.mvcpAnchorLock=void 0;return}e.mvcpAnchorLock={expiresAt:a+W4,id:n,position:o,quietPasses:c}}}function Y4(e,t,n,o,r,a){return!1}function J4(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 Z4(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&&Zs(e,r)}function eW(e){let t=e.state,n=t.pendingNativeMVCPAdjust;if(!n||Math.abs(n.manualApplied)>To)return;let o=uo(e),r=J4(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 tW(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=Z4(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 nW(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=Q4(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 T=o[S],I=w.get(T);if(I!==void 0){let k=r[I];k!==void 0&&h.push({id:T,position:k})}}if(g!==void 0&&m===void 0){let S=w.get(g);S!==void 0&&(m=r[S])}return()=>{let S=0,T=p?.id,I,k=!1,E=n.props.data;if(t&&i&&v===void 0&&g!==void 0&&p?.id===g&&l!==void 0&&g!==void 0){let A=w.get(g);if(A!==void 0){let F=E[A];k=F===void 0||!l(F,A,E),k&&p?.id===g&&(n.mvcpAnchorLock=void 0)}}if(t&&i&&v===void 0&&(()=>{if(g===void 0||k)return!0;let A=w.get(g);return A===void 0||r[A]===void 0})())for(let A=0;A<h.length;A++){let{id:F,position:B}=h[A],V=w.get(F);if(V!==void 0&&l){let Se=E[V];if(Se===void 0||!l(Se,V,E))continue}let Q=V!==void 0?r[V]:void 0;if(Q!==void 0){S=Q-B,T=F,I=Q;break}}if(!k&&g!==void 0&&m!==void 0){let A=w.get(g),F=A!==void 0?r[A]: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,T=g,I=F}}if(y&&y>0){let A=fo(e,g,v,n.props.data[v]),F=f?.itemSize;if(A!==void 0&&F!==void 0&&A!==F){let B=A-F;B!==0&&(S+=B*y,f.itemSize=A)}}if(X4(n,{anchorId:T,anchorPosition:I,dataChanged:t,now:d,positionDiff:S}),Y4()){n.pendingNativeMVCPAdjust={amount:S,furthestProgressTowardAmount:0,manualApplied:0,startScroll:L},eW(e);return}Math.abs(S)>To&&((n.maintainingScrollAtEnd==="pending-animated"||n.maintainingScrollAtEnd==="animated")&&be(e,"isWithinMaintainScrollAtEndThreshold")||Zs(e,S))}}}var iN=1e3,oW=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>iN)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>iN)break;if(c===0||f<=0)continue;let m=o.time-l.time,g=Math.exp(-m/oW);a+=c/f*g,i+=g}return i>0?a/i:0};function rW(e){let t=e.mvcpAnchorLock;return t?Date.now()>t.expiresAt?(e.mvcpAnchorLock=void 0,!1):!0:!1}function Ku(e){return e.dataChangeNeedsScrollUpdate||rW(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:k,gt:E}=i;if(k&&t<k||E&&t>E){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?A4(e,t-f):void 0,x=tW(e,t),C=a.scrollLength,w=C>0&&c===void 0&&h>C&&!a.pendingNativeMVCPAdjust,L=Fg(a);_4(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 k=()=>{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,EN.flushSync)(k),qN(e)):k();let E=!!a.pendingMaintainScrollAtEnd||!!((r=a.props.maintainScrollAtEnd)!=null&&r.onDataChange);x&&E&&(a.pendingMaintainScrollAtEnd=!1,Cd(e)),a.dataChangeNeedsScrollUpdate=!1,a.lastScrollDelta=0}}function aW(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 iW(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 sW(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 sN(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 lW(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)):sW(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=sN(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=sN(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 dW(e,t,n){let o=lW(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=Bi(e,g,s),y=h?g:v;if(r.scrollHistory.length=0,!a){d&&Mg.resetFlags(r);let x=aW(r);r.scrollingTo={...s,...x?{averageSizeSnapshot:x}:{},targetOffset:v,waitForInitialScrollCompletionFrame:p},d||dW(e,v,s.index)}r.scrollPending=v,iW(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"?V4(e,{animated:l,horizontal:m,offset:y}):r.scroll=y}function XN(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=XN(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?XN(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 Xs(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}),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?_g(e,t.index):0,i=Og(e,a,t);return Bi(e,i,t)}function YN(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 cW(e,t){var n,o,r;let a=e.state,i=YN(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 zg(e,{forceScroll:v,resolvedOffset:f,target:s}),!0}function uW(e,t){var n,o;let r=e.state,a=YN(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 zu(e,t){var n;return((n=e.state.initialScrollSession)==null?void 0:n.kind)==="offset"?uW(e,{forceScroll:t?.forceScroll}):cW(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 Ug=1,fW=8,pW=24,mW="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 el(e){var t;return((t=e.initialScrollSession)==null?void 0:t.kind)==="offset"}function gW(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 hW(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 vW(e){let{mountFrameCount:t,maxFrames:n=fW,maxPasses:o=pW,passCount:r}=e;return t>=n||r>=o}function JN(e,t){return vW(t)?(Zo&&console.warn(mW),EW(e),!0):!1}function Uu(e){var t;let n=xr(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 ZN(e,t){var n,o,r;let a=xr(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 yW(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,Ga(e,{bootstrap:a,kind:"bootstrap"})):t?.scroll!==void 0&&ZN(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,!JN(e,{mountFrameCount:r.mountFrameCount,passCount:r.passCount})&&VC(e))};n.frameHandle=requestAnimationFrame(o)}function Tg(e,t){yW(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 xW(e){return!!e?.preserveForBottomPadding}function Ys(e){return!!e?.preserveForFooterLayout}function e_(e){return!!(e&&e.viewPosition===1&&(xW(e)||Ys(e)))}function CW(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 bW(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(!Ys(r))return;let a=qC({dataLength:n,footerSize:0,preserveForFooterLayout:void 0,stylePaddingEnd:o});Xs(e,a)}function wW(e){yd(e)}function WC(e,t,n=Ug){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 t_(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 n_(e){return t_(e)===void 0?!1:(o_(e,{}),!0)}function o_(e,t){let n=e.state;n.preservedEndAnchorCorrection=t,requestAnimationFrame(()=>{var o;let r=n.preservedEndAnchorCorrection;if(r!==t)return;let a=t_(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(),Zs(e,a)),o_(e,t)})}function SW(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)&&(e_(o)&&be(e,"isAtEnd")||(Ys(o)?kg(e,{dataLength:n.props.data.length,stylePaddingEnd:OC(n.props),target:o}):wW(n)))}function IW(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})):(ZN(s,{scroll:l,seedContentOffset:0,targetIndexSeed:i.index}),VC(e))}function TW(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=xr(s);if(!r&&o&&n>0&&s.didFinishInitialScroll&&!c&&!d){yd(s);return}let p=n>0&&(r||e_(l));if(!(!o&&!d&&!p)){if(p){let m=r?qC({dataLength:n,footerSize:be(e,"footerSize")||0,preserveForFooterLayout:Ys(l),stylePaddingEnd:i}):CW({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(!bW(l,m)||c||d||o){Xs(e,m,{resetDidFinish:d}),Tg(e,{scroll:Kr(e,m),seedContentOffset:d&&!c?Hu(s):void 0,targetIndexSeed:m.index});return}}o&&(c||d)&&(Xs(e,l,{resetDidFinish:d}),Tg(e,{scroll:Kr(e,l),seedContentOffset:d&&!c?Hu(s):void 0,targetIndexSeed:l.index}))}}function kW(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||!(xr(i)||Ys(s))))if(WC(e,s))kg(e,{dataLength:n,stylePaddingEnd:a,target:s});else{let d=qC({dataLength:n,footerSize:o,preserveForFooterLayout:Ys(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;Xs(e,d,{resetDidFinish:f}),Tg(e,{scroll:Kr(e,d),targetIndexSeed:d.index})}}}function LW(e){var t,n,o;let r=e.state,a=r.initialScroll,i=xr(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)>Ug){if(r.didFinishInitialScroll)n_(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 Tg(e,{scroll:s,targetIndexSeed:a.index})}}function PW(e){var t,n;let o=e.state,r=xr(o),a=o.initialScroll;if(!r||!a||el(o)||(t=o.scrollingTo)!=null&&t.isInitialScroll||(r.passCount+=1,JN(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=hW({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&&gW(m,c))){kC(o);return}Uu(o),zg(e,{forceScroll:!0,resolvedOffset:i,target:a,waitForCompletionFrame:Wa.OS==="web"})}function AW(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 EW(e){var t,n,o,r;let a=e.state,i=xr(a),s=a.initialScroll;i&&s&&!el(a)&&a.refScroller.current?(Uu(a),zg(e,{forceScroll:!0,resolvedOffset:i.scroll,target:s,waitForCompletionFrame:Wa.OS==="web"})):AW(e,(r=(o=(n=(t=xr(a))==null?void 0:t.scroll)!=null?n:a.scrollPending)!=null?o:a.scroll)!=null?r:0)}function r_(e,t,n,o){return{dataChangeEpoch:e.dataChangeEpoch,getFixedItemSize:e.props.getFixedItemSize,getItemType:e.props.getItemType,itemData:n,itemIndex:t,itemType:o}}function RW(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=r_(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 a_(e){for(let t of e.containerItemMetadata.values())t.didResolveFixedItemSize=!1,t.fixedItemSize=void 0}var MW=20,NW=1,_W=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(()=>zW(e),"checkFinishedScrollFrame")}function DW(e,t){let{clampedTargetOffset:n,scrollingTo:o}=t;return!o.isInitialScroll||e.hasScrolled||n<=NW}function OW(e,t){return!!t?.isInitialScroll&&Mg.didDispatchNativeScroll(e)&&!e.hasScrolled}function i_(e){var t;return(t=oo.get(e))==null?void 0:t.targetOffset}function s_(e){let t=i_(e);return!e.didFinishInitialScroll&&oo.hasNonZeroTargetOffset(t)}function lN(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||s_(e)}function dN(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<=_W}function FW(e,t){return t.index===e.state.props.data.length-1&&t.viewPosition===1}function BW(e,t){var n;let o=t.index,a=FW(e,t)&&o!==void 0?Og(e,_g(e,o),t):(n=t.targetOffset)!=null?n:Bi(e,t.offset-(t.viewOffset||0),t);return Bi(e,a,t)}function jC(e,t){let{state:n}=e,o=n.scrollPending,r=n.scrollAdjustHandler.getAdjust(),a=BW(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 zW(e){let t=e.state.scrollingTo;if(!t)return;let{state:n}=e,o=jC(e,t);o.isAtResolvedTarget&&DW(n,{clampedTargetOffset:o.clampedTargetOffset,scrollingTo:t})&&Bu(e)}function UW(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 HW(e){let t=e.state;if(t.scheduledWork.has("checkFinishedScrollFallback"))return;let n=t.scrollingTo,o=dN(e),r=OW(t,n),a=n!==void 0?lN(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=s_(t)&&!t.hasScrolled,h=r?5:g?MW:5,v=dN(e),y=lN(t,m),x=jC(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=i_(t))!=null?f:m.targetOffset)!=null?p:t.scrollPending;UW(e,S),d(r?yC:100)}else d(r?yC:100)}};d(s)}function l_(e){var t;let n=e.state,o=n.initialScroll;return n.didFinishInitialScroll?n_(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 $W(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),GC(e,{onlyIfAligned:!0})}function KW(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"){IW(e,{initialScrollAtEnd:l,target:c.initialScroll});return}!r&&!p&&!(f&&a===0&&!(p===0&&!l))&&(f&&!l?xd(e,{resolvedOffset:p}):$C(e,{didInitialScroll:!0}))}function VW(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){TW(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}),zu(e))}function d_(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 WW(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,T=!1,I=!1;if(S){let _=v[n];if(_===void 0)return Be(e,`containerPosition${t}`,vd),{didChangePosition:!1,didRefreshData:!1};let A=(_||0)-((i=o?.scrollAdjustPending)!=null?i:0),F=(s=m.sizes.get(L))!=null?s:fo(e,L,n,w),B=i4(m,A,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),T=!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 E=be(e,`containerItemData${t}`),P=()=>{Be(e,`containerItemData${t}`,w),I=!0};if(E!==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,A=(c=_?.byIndex[n])!=null?c:0;if(A===2)P();else if(A!==1){let F=(f=be(e,`containerItemKey${t}`))!=null?f:L,B=C?.(E,n);if(E===void 0||!C||B!==F)P();else if(!x)P();else{let V=x(E,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:T,didRefreshData:I}}function GW(e,t,n){var o;let r=e.state,a=be(e,"numColumns"),i=t;r.columns[t]!==1&&(i=cN(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=cN(r,a,c),m=jW(e,p,c,n);l=f+m}return{column:d,currentRowTop:l,startIndex:i}}function cN(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 QW(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 c_(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 u_(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:T},scrollingTo:I}=m,k=L.length,E=(l=be(e,"numColumns"))!=null?l:1,P=E>1,_=Zo?new Map:void 0,A=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}=GW(e,s,H);s=ie,G=Ae}else if(s<k){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<k;ie++){if(Q&&ge!==void 0&&ie>ge){se=!0;break}Q&&ge===void 0&&!I&&!t&&G>Se&&(ge=ie+(P?E:1)+10);let Ae=(p=C[ie])!=null?p:jt(m,ie),Xe=1;if(Y){F.span=1,S(F,L[ie],ie,E,A);let Ve=F.span;Ve!==void 0&&Number.isFinite(Ve)&&(Xe=Math.max(1,Math.min(E,Math.round(Ve))))}P&&te+Xe-1>E&&(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&&m4(e,Ae,G)),U&&y.set(Ae,ie),P?(h[ie]=te,v[ie]=Xe,rt>me&&(me=rt),te+=Xe,te>E&&(G+=me,te=1,me=0)):G+=rt}se||QW(e),T&&c_(e)}function f_(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 XW(e){let{viewabilityConfig:t,viewabilityConfigCallbackPairs:n,onViewableItemsChanged:o}=e;return(t||o)&&(n=[...n||[],{onViewableItemsChanged:o,viewabilityConfig:t||{viewAreaCoveragePercentThreshold:0}}]),n}function p_(e,t,n,o,r,a,i=r,s=a){let{props:{data:l}}=e;for(let d of n){let c=f_(t,d.viewabilityConfig.id);c.start=r,c.end=a,c.startBuffered=i,c.endBuffered=s,d.viewabilityConfig.minimumViewTime?e.scheduledWork.timeout(()=>uN(l,d,e,t,o),d.viewabilityConfig.minimumViewTime):uN(l,d,e,t,o)}}function uN(e,t,n,o,r){let{viewabilityConfig:a,onViewableItemsChanged:i}=t,s=a.id,l=f_(o,s),{viewableItems:d,start:c,end:f,startBuffered:p,endBuffered:m}=l,g;for(let[x,C]of o.mapViewabilityAmountValues)m_(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=pN(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(pN(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];YW(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 fN(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 m_(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},A=t.mapViewabilityAmountValues.get(o);if(!fN(A,_)){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,T=y?100*(L/a):0,k=(w?100:m?T:S)>=g,E={containerId:o,index:s,isViewable:k,item:i,key:r,percentOfScroller:T,percentVisible:S,scrollSize:a,size:y,sizeVisible:L},P=t.mapViewabilityAmountValues.get(o);if(!fN(P,E)){t.mapViewabilityAmountValues.set(o,E);let _=t.mapViewabilityAmountCallbacks.get(o);_&&_(E)}return E}function pN(e,t,n,o,r,a,i,s){let l=t.mapViewabilityAmountValues.get(o);return(!l||l.key!==r||l.index!==s)&&(l=m_(e,t,n,o,r,a,i,s)),l.isViewable}function YW(e,t,n,o){let r=n+t;e.mapViewabilityValues.set(r,o);let a=e.mapViewabilityCallbacks.get(r);a?.(o)}var mN=AN.unstable_batchedUpdates,JW=typeof mN=="function"?mN:e=>e(),ZW=32,eG=64,tG=3;function nG(e,t){if(e<=0||t<=0)return 0;let n=Math.ceil(t*tG),o=t+eG,r=Math.max(t,Math.min(n,o),Math.min(e,ZW)),a=Math.max(e,t);return Math.min(a,r)}function oG(e,t){return e<=0||t<=0?0:Math.min(Math.max(e,t),Math.max(t,Math.ceil(t*1.5)))}function rG(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((E,P)=>({isSticky:c.props.stickyHeaderIndicesSet.has(E),itemIndex:E,itemType:a?.(E),order:P})),v=h.filter(E=>!E.isSticky),y=h.filter(E=>E.isSticky),x=[],C=[];for(let E=0;E<d;E++){let P=be(e,`containerItemKey${E}`),_=!!g?.has(E);if(!(P&&i?.has(P)&&c.indexByKey.has(P))){if(p.has(E))(P===void 0||_)&&C.push({containerIndex:E,distance:Number.POSITIVE_INFINITY});else if(P===void 0||_)x.push({containerIndex:E,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:E,distance:B})}}}}x.sort(aG);let w=new Array(l),L=d,S=!1,T=(E,P)=>{w[E.order]={containerIndex:P,itemIndex:E.itemIndex,itemType:E.itemType},g?.delete(P)&&(S=!0)},I=(E,P,_)=>{for(let A of E){if(w[A.order])continue;let F=P.findIndex(B=>{var V;return _((V=f.get(B.containerIndex))==null?void 0:V.itemType,A.itemType)});if(F!==-1){let[B]=P.splice(F,1);T(A,B.containerIndex)}}},k=(E,P,_)=>{a&&I(E,P,(A,F)=>F!==void 0&&A===F),I(E,P,A=>A===void 0),_&&I(E,P,()=>!0)};k(v,x,!0),k(y,C,!1);for(let E of h){if(w[E.order])continue;let P=L++;E.isSticky&&p.add(P),T(E,P)}if(S&&(r.length=0,g))for(let E of g)r.push(E);if(Zo){let E=(s=be(e,"numContainersPooled"))!=null?s:Number.POSITIVE_INFINITY;L>E&&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:E,numNeeded:l,stillNeeded:L-d}})}return w}function aG(e,t){return t.distance-e.distance}function iG(e){let t=e.state;t.queuedInitialLayout=!0,HN(e),$C(e,{didLayout:!0})}var sG=4,lG=100;function dG(e,t){if(t<=0)return 0;let n=Math.min(1,Math.abs(e)/sG);return Math.sign(e)*t*n}function cG(e){let t=e.state;t.scheduledWork.timeout(()=>{var n;t.scrollHistory.length=0,(n=t.triggerCalculateItemsInView)==null||n.call(t)},lG,"renderRangeProjection")}function uG(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 fG(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 pG(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(fG(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 mG(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 g_(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 h_(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 gG(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 hG(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(g_(g,h,x,y,o,r))break}Object.assign(s,{endNoBuffer:g.endNoBuffer,firstFullyOnScreenIndex:g.firstFullyOnScreenIndex,idsInView:h_(s,g),startNoBuffer:g.startNoBuffer}),LC(s,g.startNoBuffer),g.startNoBuffer!==null&&g.endNoBuffer!==null&&p_(s,e,t,n,g.startNoBuffer,g.endNoBuffer,m,l)}function qa(e,t={}){let n=e.state;JW(()=>{var o,r,a,i,s,l,d,c,f,p,m,g,h,v,y,x,C,w,L,S,T;let{columns:I,containerItemKeys:k,enableScrollForNextCalculateItemsInView:E,idCache:P,indexByKey:_,minIndexSizeChanged:A,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=VN(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&&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?uG(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")?dG(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&&cG(e),E&&!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?hG(e,me,ee,gt,Mt):n.props.onFirstVisibleItemChanged&&LC(n,gG(e,gt)),(i=Vt?.finishCalculateItemsInView)==null||i.call(Vt);return}}let fe=Ae&&!rt?nW(e,ie):void 0;ie&&d_(n);let ye=Xe||ie?0:(s=A??n.startBuffered)!=null?s:0,Te=!Xe&&!ie&&X>1&&A!==void 0;u_(e,ie,{doMVCP:Ae,forceFullUpdate:!!Xe,optimizeForVisibleWindow:Te,scrollBottomBuffered:wt,scrollVelocity:ae,startIndex:ye}),ne=uo(e),A!==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||(g_(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:h_(n,qe),startBuffered:at,startBufferedId:Pt,startNoBuffer:qe.startNoBuffer}),E&&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=k.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);k.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?pG(e,Y,(v=Vt?.currentStickyIdx)!=null?v:-1,ve,et,at,Et):dn!==-1&&Be(e,"activeStickyIndex",-1),ve.length>0){let xn=rG(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&&k.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,r_(n,cn,U[cn],gn.itemType)),k.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",oG(We,ot)))}((w=n.userScrollAnchorReset)==null?void 0:w.keys.size)===0&&(n.userScrollAnchorReset=void 0)}n.stickyContainerPool.size>0&&mG(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&&(k.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=WW(e,ve,lt,{scrollAdjustPending:Lt,updateLayout:!0}).didChangePosition||Bn)}}if(we&&BC&&Lg(e,we),Bn&&Be(e,"lastPositionUpdate",Date.now()),rt){PW(e);return}LC(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))&&(iG(e),$W(e)),me&&qe.startNoBuffer!==null&&qe.endNoBuffer!==null&&p_(e.state,e,me,ee,qe.startNoBuffer,qe.endNoBuffer,at??qe.startNoBuffer,Et??qe.endNoBuffer),(T=Vt?.finishCalculateItemsInView)==null||T.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 T=QN(e,S),I=S===h&&v!==void 0?Math.min(T||0,Math.max(0,v)):T;T===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&&(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 vG(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 gN(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 v_(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)QC(o,r)}}}function yG(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 xG(e,t){var n;let o=e.state;t.needsRecalculate?(o.scrollForNextCalculateItemsInView=void 0,vG(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&&Cd(e)}function y_(e,t){if(Ka){let n=Ka.get(e);n?n.push(t):Ka.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?RW(o,a.containerId,s,l):void 0,c=CG(e,a.itemKey,a.size,d);yG(r,c)}xG(e,r)}function CG(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 E=(a=o?.itemType)!=null?a:p&&(r=p(I,y))!=null?r:"";o={didResolveFixedItemSize:!0,fixedItemSize:f(I,y,E),itemType:E}}let k=o.fixedItemSize;if(k!==void 0&&k===c.get(t))return gN(e,n,m),{didMeasureUserScrollAnchorResetItem:l}}let x=!d,C=!1,w,L=i.sizesKnown.get(t),S=bG(e,t,n,o),T=Fu(m?n.width:n.height);if(S!==0){w=w!==void 0?Math.min(w,y):y;let{startBuffered:I,endBuffered:k}=i;x||(x=y>=I&&y<=k),!x&&i.containerItemKeys.has(t)&&(x=!0),(L===void 0||Math.abs(L-T)>5)&&(C=!0),g?.({index:y,itemData:i.props.data[y],itemKey:t,previous:T-S,size:T})}if(w!==void 0&&(i.minIndexSizeChanged=i.minIndexSizeChanged!==void 0?Math.min(i.minIndexSizeChanged,w):w),gN(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 bG(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 T=d[v];T||(T=d[v]={avg:0,num:0}),T.num===0?(T.avg=S,T.num++):L!==void 0&&L>0?T.avg+=(S-L)/T.num:(T.avg=(T.avg*T.num+S)/(T.num+1),T.num++)}return!C||Math.abs(C-S)>.1?(IC(e,t,S),S-C):0}function wG(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();x4(s,l),n.push({containerId:r,itemKey:i,size:{height:l.height,width:l.width}})}}n.length>0&&QC(e,n)}var x_=zn,ga=pe,SG=ga(function({children:t}){let n=Vr(),[o]=er(["containerLayoutEpoch"]);return he(()=>{{let r=qW(n);r!==void 0&&wG(n,r)}},[n,o]),t}),wg=e=>mh(e)?e:e?De(e,null):null,IG=typeof document<"u"&&!!document.getElementById("react-native-stylesheet"),PC={contain:"paint layout style",...IG?{display:"flex",flexDirection:"column"}:{}},TG=ga(function({id:t,horizontal:n,style:o,refView:r,...a}){let[i=vd]=er([`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})}),kG=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=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)}),LG=TG;function PG(e){J(()=>e())}var C_=Ct(null),AG=-1;function EG(){return Ht(C_)}function RG(){var e;let t=EG(),n=(e=t?.containerId)!=null?e:AG,[o]=er([`containerItemKey${n}`]);return g4("lastItemKeys",a=>t&&!_u(o)&&a?.includes(o)||!1)}function MG({ItemSeparatorComponent:e,leadingItem:t}){return RG()?null:De(e,{leadingItem:t})}var xC=null;function NG(){return xC||(xC=new ResizeObserver(e=>{v_(()=>{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 _G(e,t){var n;if(typeof ResizeObserver>"u"||!e)return()=>{};let o=NG(),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(hN(m),!0),p=m}return _G(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??y4(c),C=x===void 0||y.width!==x.width||y.height!==x.height;p=y;let w=!!r?.();(C||w)&&f(hN(y),!1)})},[t,...a||[]]),{}}function hN(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 b_(e){Ig.delete(e)}function DG(e,t){Ig.set(e,t),CC===void 0&&(CC=requestAnimationFrame(()=>{let n=Array.from(Ig.values());Ig.clear(),CC=void 0,v_(()=>{for(let o of n)o()})}))}function OG({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,y_(t,{containerId:e,itemKey:i,size:s})};!Ku(a)&&f!==void 0&&d+1<f?DG(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()}}):(b_(r),p())}function FG({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=>{OG({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),()=>{b_(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:()=>Ku(t.state)},[o,i]);return W(()=>{},[e,t,o]),{onLayout:c,triggerLayout:d}}function BG({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 zG=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}=FG({containerId:t,ctx:l,horizontal:r,itemKey:n,ref:w}),T=g>0?g:1,I=Math.min(Math.max(h||1,1),y),k=y>1?`${(T-1)/y*100}%`:0,E=y>1?`${I/y*100}%`:void 0,P=K(()=>BG({columnWrapperStyle:d,contentContainerAlignItems:l.state.props.contentContainerAlignItems,hasItemSeparator:!!i,horizontal:r,isHorizontalRTLList:f,numColumns:y,otherAxisPos:k,otherAxisSize:E}),[r,f,k,E,d,l.state.props.contentContainerAlignItems,y,i]),_=K(()=>n!==void 0?a(n):null,[n,v,x]),{renderedItem:A}=_||{},F=K(()=>(l.viewRefs.set(t,w),{containerId:t,triggerLayout:S}),[t,S]);return De(C?m||kG:p||LG,{animatedScrollY:C?c:void 0,horizontal:r,id:t,key:o?void 0:n,onLayout:L,refView:w,stickyHeaderConfig:s,style:P},De(C_.Provider,{value:F},A,_&&i&&De(MG,{ItemSeparatorComponent:i,leadingItem:_.item})))});function UG({id:e,horizontal:t,recycleItems:n,ItemSeparatorComponent:o,getRenderedItem:r,stickyHeaderConfig:a,ContainerComponent:i=zG}){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 HG=ga(function(t){return De(UG,{...t})});function $G(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=KG(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 KG(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 VG(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)}$G(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 WG=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=qG(!!c,t);VG(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(SG,null,r))}),GG=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(HG,{getRenderedItem:a,horizontal:n,ItemSeparatorComponent:r,id:c,key:c,recycleItems:o,stickyHeaderConfig:i}));return De(WG,{freshDataTransitionEpoch:t,horizontal:n,numColumns:l},d)});function jG(e){return Dg(e)?Object.assign({},...e.filter(Boolean)):e}var $u={create:e=>e,flatten:e=>jG(e)};function AC(e){let t=N(e);return t.current=e,t}function QG(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",w_="legend-list-scrollbar-x-hidden",S_="legend-list-scrollbar-y-hidden";function XG(){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 vN(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 I_(e){var t,n;return{height:(t=e?.scrollHeight)!=null?t:0,width:(n=e?.scrollWidth)!=null?n:0}}function YG(e,t,n){return I_(n?t:e)}function yN(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 xN(e,t){return Math.max(0,Math.min(e,t))}function CN(e,t){return t?e.width:e.height}function JG(e,t,n){return Math.max(0,CN(e,n)-CN(t,n))}function bN(e,t){return t&&XG()||e}function ZG(e,t){return t&&typeof window<"u"?window:e}function ej(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 tj({clampedOffset:e,horizontal:t,listPos:n,scroll:o}){return{left:t?n.left+e:o.x,top:t?o.y:n.top+e}}var wN="legend-list-scrollbar-axis-hidden-style",nj=200,oj=`.${S_}::-webkit-scrollbar:vertical{width:0;display:none;}.${w_}::-webkit-scrollbar:horizontal{height:0;display:none;}`;function rj(){if(typeof document>"u"||document.getElementById(wN))return;let e=document.createElement("style");e.id=wN,e.textContent=oj,document.head.appendChild(e)}function aj(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 ij(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 sj(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 SN=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"]),T=N(null),I=N(null),k=g,E=R(()=>ZG(T.current,k),[k]),P=R(()=>{let j=T.current,X=YG(j,I.current,k),ae=yN(j,k,a);return JG(X,ae,a)},[a,k]),_=R(()=>{let j=T.current;if(k){let X=P(),ae=RC(),oe=vN(j,ae),ft=a?ae.x-oe.left:ae.y-oe.top;return xN(ft,X)}return j?a?j.scrollLeft:j.scrollTop:0},[P,a,k]),A=R((j,X)=>{let ae=T.current,oe=E();if(!oe||typeof oe.scrollTo!="function")return;let ft=P(),pt=xN(j,ft),Lt={behavior:X?"smooth":"auto"};if(k){let on=RC(),gt=vN(ae,on),{left:zt,top:Mt}=tj({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,E,a,k]);ir(y,()=>({getBoundingClientRect:()=>{var X;return(X=T.current)==null?void 0:X.getBoundingClientRect()},getCurrentScrollOffset:_,getScrollableNode:()=>bN(T.current,k),getScrollEventTarget:()=>E(),getScrollResponder:()=>bN(T.current,k),isWindowScroll:()=>k,scrollBy:(X,ae)=>{let oe=E();!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;A(a?ae:oe,ft)},scrollToEnd:(X={})=>{let{animated:ae=!0}=X,oe=P();A(oe,ae)},scrollToOffset:X=>{let{offset:ae,animated:oe=!0}=X;A(ae,oe)}}),[_,P,E,a,k,A]);let F=R(()=>{if(!l||!T.current)return;let j=I_(I.current),X=yN(T.current,k,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,k,l]),B=QG(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,nj)}},[L.state,Q,d,l,B]);he(()=>{let j=E();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,E,Se,B]),W(()=>{let j=()=>{i&&A(a?i.x||0:i.y||0,!1)};j(),requestAnimationFrame(j)},[i?.x,i?.y,a,A]),he(()=>{if(!h||!T.current)return;let j=T.current,X=()=>{h({nativeEvent:{layout:ej(j,k,a)}})};X();let ae=new ResizeObserver(()=>{X()});ae.observe(j);let oe=()=>{X()};return k&&typeof window<"u"&&typeof window.addEventListener=="function"&&window.addEventListener("resize",oe),()=>{ae.disconnect(),k&&typeof window<"u"&&typeof window.removeEventListener=="function"&&window.removeEventListener("resize",oe)}},[k,h]);let H=!k&&(a?!f&&w_:!p&&S_);he(()=>{H&&rj()},[H]);let q={...k?{}:{overflow:"auto",overflowX:a||f?"auto":"hidden",overflowY:a?p?"auto":"hidden":"auto",WebkitOverflowScrolling:"touch"},...$u.flatten(n),...s?{overflowAnchor:"none"}:{}},ee=aj(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?`${EC} ${o}`:EC,{contentContainerClassName:se,contentInset:ge,scrollEventThrottle:ie,ScrollComponent:Ae,snapToOffsets:Xe,useWindowScroll:nt,className:rt,...Ve}=v,ne=k?[]:ij(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:T,...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:sj(j,a)})),t,me?De("div",{"aria-hidden":!0,style:me}):null))});function lj({horizontal:e,needsOtherAxisSize:t,otherAxisSize:n}){if(!(!t||!n||n<=0))return e?{height:n}:{width:n}}function IN(e,t){let n=Vr();he(()=>Va(n,e,r=>{t(r)}),[t,n,e])}function dj(e){return e?{contentSizeKey:"scrollWidth",paddingEndProp:"paddingRight",viewportSizeKey:"clientWidth",x:1,y:0}:{contentSizeKey:"scrollHeight",paddingEndProp:"paddingBottom",viewportSizeKey:"clientHeight",x:0,y:1}}function cj(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 uj(e,t,n){e.scrollBy({behavior:"auto",left:t,top:n})}function fj(){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=cj(e,a.current);if(f){let p=!!e.state.props.horizontal,m=dj(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=()=>uj(h,m.x*C,m.y*C);if(a.current=g,w&&g){let S=g[m.contentSizeKey],T=h[m.viewportSizeKey],I=v+C;if(C>0&&!e.state.adjustingFromInitialMount&&S<I+T){let E=g.style[m.paddingEndProp],P=r.current,_=P?.value===E?P.baseline:E,A=(I+T-S)*2,B=`${(Number.parseFloat(window.getComputedStyle(g)[m.paddingEndProp])||0)+A}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 IN("scrollAdjust",i),IN("scrollAdjustUserOffset",i),null}var pj=zn(function({ScrollComponent:t,...n},o){let[r]=er(["snapToOffsets"]);return De(t,{...n,ref:o,snapToOffsets:r})}),MC=.1;function mj(e,t,n){let o=be(e,t)!==n;return o&&(Be(e,t,n),Js(e)),o}function gj(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 TN(e,t){let{state:n}=e,o=be(e,"headerSize")||0,r=o!==t,a=n.didMeasureHeader||o>MC;r&&(Be(e,"headerSize",t),Js(e),a&&gj(e,o,t)&&Zs(e,t-o)),n.didMeasureHeader=!0}function hj(e,t){let n=mj(e,"footerSize",t);return n&&Pg(e),n}function vj(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 yj(e,t){let{state:n}=e,o=n.contentInsetOverride,r=t??void 0,a=!vj(o,r);return n.contentInsetOverride=r,a&&Js(e),a}function xj(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 kN=({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)},Cj=ga(function({horizontal:t}){let[n=0]=er(["alignItemsAtEndPadding"]);return n<=0?null:De(Ag,{style:t?{flexShrink:0,width:n}:{flexShrink:0,height:n}},null)}),bj=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:T,snapToIndices:I,stickyHeaderConfig:k,stickyHeaderIndices:E,useWindowScroll:P=!1,..._}){let A=Vr(),F=A.state.props.maintainVisibleContentPosition,[B=0,V=0]=er(["anchoredEndSpaceSize","otherAxisSize"]),Q=A.state.props.alignItemsAtEndPaddingEnabled,Se=!!A.state.props.anchoredEndSpace&&A.state.props.anchoredEndSpaceOwner==="list"&&B>0,H;if(Se){let se=a?ja(A.state)?"Left":"Right":"Bottom",ge=$u.flatten(r);H={[`padding${se}`]:Ru({},ge||{},se)+B}}let q=lj({horizontal:a,needsOtherAxisSize:A.state.needsOtherAxisSize,otherAxisSize:V}),ee=xj(C,(se,ge)=>({...se,ref:ge})),G=C?ee:SN,te=I?pj:G,me=R((se,ge)=>{var ie;let Ae=hj(A,se);ge?.(),Ae&&((ie=A.state.props.maintainScrollAtEnd)!=null&&ie.onFooterLayout)&&Cd(A)},[A]);he(()=>{p||TN(A,0),g||me(0)},[p,g,A,me]);let U=R(se=>{let ge=se[a?"width":"height"];TN(A,ge)},[A,a]),Y=R((se,ge)=>{let ie=se[a?"width":"height"];me(ie,()=>{w?.(se,ge)})},[a,w,me]);return De(te,{..._,...G===SN?{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(fj,null),p&&De(kN,{onLayoutChange:U,style:m},wg(p)),v&&wg(v),Q&&De(Cj,{horizontal:a}),t&&!v&&De(GG,{freshDataTransitionEpoch:n,getRenderedItem:y,horizontal:a,ItemSeparatorComponent:l,recycleItems:s,stickyHeaderConfig:k}),g&&De(kN,{onLayoutChange:Y,style:h},wg(g)),Zo&&b4)}),wj=100,Sj=.9,Ij=.9;function Tj(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<wj)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*Sj),C=y>=v*Ij;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 kj(e){}var Lj=Zo?Tj:kj;function Pj(e,t,{didColumnsChange:n=!1}={}){let o=e.state,{previousData:r}=o,{maintainScrollAtEnd:a}=o.props;if(n){o.sizes.clear(),o.sizesKnown.clear(),a_(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||Ng(e),delete o.previousData}function Aj(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 T_(e){var t,n;let o=e.state,{scrollLength:r,props:{data:a,getFixedItemSize:i,getItemType:s,numColumns:l,estimatedItemSize:d}}=o,c=VN(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",nG(a.length,m)),o.lastLayout&&(o.initialScroll?requestAnimationFrame(()=>{qa(e,{dataChanged:!0,doMVCP:!0})}):qa(e,{dataChanged:!0,doMVCP:!0})),!0}}function Ej(){return typeof window>"u"?{height:0,width:0}:{height:window.innerHeight,width:window.innerWidth}}function Rj(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=Ej()[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&&T_(e),m&&qa(e,{doMVCP:!0}),(h||p!==g)&&Be(e,"scrollSize",{height:l.height,width:l.width}),r?.onLayout&&Cd(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}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 Mj(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 Nj(e){var t;return!!e.initialScroll&&((t=e.initialScrollSession)==null?void 0:t.kind)==="bootstrap"&&!e.didFinishInitialScroll}function _j(e){return{...e,nativeEvent:{...e.nativeEvent}}}function Dj(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=s4(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,Bg(e,{forceScroll:!0,isInitialScroll:!0,noScrollingTo:!0,offset:f});return}}l.scrollPending=f,Qs(e,f,c,{fromNativeScrollEvent:!0}),Mj(l,f),SW(e),l.scrollingTo&&GC(e),l.props.onScroll&&(Nj(l)?l.deferredPublicOnScrollEvent=_j(t):l.props.onScroll(t))}var Oj=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()}},Fj=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=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 Bj(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}),!l_(e)&&i&&a>0&&Zs(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 zj=(...e)=>R(n=>{for(let o of e)o&&(GN(o)?o(n):o.current=n)},e);function Uj(e){return null}function Hj(e,t,n,o){return o}function $j(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 Kj(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 Vj="default";function qj(e){let t={};for(let n in e.averageSizes){let o=e.averageSizes[n];o&&(t[n||Vj]={average:o.avg,count:o.num})}return t}function Wj(e){Lg(e)}function Gj(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:z4(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 ON(n),n.pendingScrollResolve=h,v},f=(h,v=()=>!0)=>new Promise(y=>{let x=c(y);oN(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,()=>Kj(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(),a_(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),Wj(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)=>Va(e,h,v),listenToPosition:(h,v)=>p4(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=yj(e,h);Qs(e,n.scroll,!0,{markHasScrolled:!1}),v&&l_(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?.(),oN(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)=>{y_(e,{itemKey:h,size:v})},setScrollProcessingEnabled:h=>{n.scrollProcessingEnabled=h},setVisibleContentAnchorOffset:h=>{let v=GN(h)?h(be(e,"scrollAdjustUserOffset")||0):h;Be(e,"scrollAdjustUserOffset",v)}}}var jj=(e,t)=>e-t,LN=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 Qj(e,t,n,o){var r,a;if(t.length===0)return[];let i=new Set,s=t.length,l=LN(e?.top);if(l>0)for(let f=0;f<Math.min(l,s);f++)Eu(i,s,f);let d=LN(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(jj),c}function Xj(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 PN(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 Yj(e){var t;return e?e===!0?{...PN(void 0,!1),animated:!1}:{...PN(e.on,"on"in e),animated:(t=e.animated)!=null?t:!1}:void 0}function Jj(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 Zj(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 e6(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 t6(e,t){let n=e6("throttle");return o=>n(e,t,{nativeEvent:o.nativeEvent})}var n6=ga(x_(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(c4,null,De(o6,{...l,ref:n}))})),o6=x_(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:T=!1,anchoredEndSpace:I,alwaysRender:k,columnWrapperStyle:E,contentContainerStyle:P,contentInset:_,data:A=[],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=T&&!te&&Bt?.minHeight==null&&A.length>0,ke=T&&!Zt&&(te?Bt?.minWidth==null:Bt?.minHeight==null),Ut={...Bt,...T&&!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=OC({horizontal:te,rtl:me,stylePaddingBottom:Bn,stylePaddingLeft:ve,stylePaddingRight:et}),it=Yj(we),xn=Jj(X),gn=se!=null,cn=ge!=null,It=!Y&&!gn&&!cn&&DC({horizontal:te,rtl:me}),Qt=!Y&&!gn&&(cn||It),qt=Y||gn,ko=Y?{index:Math.max(0,A.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(!BC),[,Ya]=Ia($e=>$e+1,0),Ue=Vr();Ue.columnWrapperStyle=E||(Ut?$j(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=zj(tr,fe),Ja=Xe??(($e,Dt)=>Dt.toString()),nr=Ln,Za=Q,Cr=N(Za),br=K(()=>{let $e=Qj(k,A,Ja,I?.anchorIndex);return{arr:$e,set:new Set($e)}},[I?.anchorIndex,k?.top,k?.bottom,(m=k?.indices)==null?void 0:m.join(","),(g=k?.keys)==null?void 0:g.join(","),A,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:A.length>0,idCache:[],idsInView:[],indexByKey:new Map,initialScroll:ko,initialScrollSession:ko?{kind:Qt?"offset":"bootstrap",previousDataLength:A.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 Oj,scroll:0,scrollAdjustHandler:new Fj(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!==A,Bo=Ee.props.dataKey!==F,wr=Ee.props.dataVersion!==B,po=Bo||wr||rr&&Aj(Ee,A,Ee.props.data),zo=!Oo&&po&&Ee.hasHadNonEmptyData&&(Bo||Qn===0)&&A.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=t6(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:T,alignItemsAtEndPaddingEnabled:Zt,alwaysRender:k,alwaysRenderIndicesArr:br.arr,alwaysRenderIndicesSet:br.set,anchoredEndSpace:I,anchoredEndSpaceOwner:Jt,animatedProps:an,contentContainerAlignItems:Ut.alignItems,contentInset:_,contentInsetEndAdjustment:Za,data:A,dataKey:F,dataVersion:B,drawDistance:V,estimatedItemSize:Se,getFixedItemSize:bC(ee),getItemType:bC(G),horizontal:!!te,itemsAreEqual:Ae,keyExtractor:bC(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&&zC(Ue);let Po=K(()=>A.length?Array.from({length:Math.min(ae,A.length)},($e,Dt)=>jt(Ee,A.length-1-Dt)):[],[A,F,B,ae]),Uo=$e=>{Be(Ue,"lastItemKeys",Po),Be(Ue,"numColumns",ae);let Dt=be(Ue,"stylePaddingTop");Zj(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),d_(Ee),u_(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(()=>{KW(Ue,{alwaysDispatchInitialScroll:It,dataLength:A.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&&Lj(t),he(()=>{zo&&HC(Ue,{resetInitialScroll:!!ko,resetLayout:!0}),VW(Ue,{dataLength:A.length,didDataChange:po,didStartFreshData:zo,initialScrollAtEnd:Y,latestInitialScroll:ko,latestInitialScrollSessionKind:Qt?"offset":"bootstrap",stylePaddingEnd:lt,useBootstrapInitialScroll:qt})},[A.length,F,po,zo,Y,lt,qt]),he(()=>{var $e;ei&&(Ee.scrollForNextCalculateItemsInView=void 0,($e=Ee.triggerCalculateItemsInView)==null||$e.call(Ee)),Pg(Ue)},[Ue,A,B,I?.anchorIndex,I?.anchorMaxSize,I?.anchorOffset,ei,te,ae,me,Bn,ve,et]),he(()=>{let $e=Cr.current;Cr.current=Za,Bj(Ue,$e)},[Ue,Za]);let Xn=R($e=>{qt&&kW(Ue,{dataLength:A.length,footerSize:$e[te?"width":"height"],initialScrollAtEnd:Y,stylePaddingEnd:lt})},[A.length,Y,te,lt,qt]),jr=R(($e,Dt)=>{let un=Ee.scrollLength,An=Ee.otherAxisSize;Rj(Ue,$e,va),Pg(Ue);let Ho=un!==Ee.scrollLength||An!==Ee.otherAxisSize;qt&&!Dt&&Ho&&LW(Ue),!qt&&zu(Ue)},[A.length,Y,lt,qt]),{onLayout:ar}=XC({onLayoutChange:jr,onLayoutProp:on,ref:tr});he(()=>{ht&&c_(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&&T_(Ue))&&!un&&(Dt||$e)&&Pj(Ue,An,{didColumnsChange:$e}),Dt&&(Ee.pendingDataComparison=void 0),Ee.didColumnsChange=!1,Ee.didDataChange=!1,Ee.isFirst=!1},[A,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=XW({onViewableItemsChanged:bn,viewabilityConfig:Pt,viewabilityConfigCallbackPairs:Et});Ee.viewabilityConfigCallbackPairs=$e,Ee.enableScrollForNextCalculateItemsInView=!0,$e&&(Ee.scrollForNextCalculateItemsInView=void 0)},[Pt,Et,bn]),PG(()=>{}),ir(n,()=>Gj(Ue,Ya),[]),W(()=>()=>{S4(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=>Xj(Ue,$e),onMomentumScrollEnd:$e=>{HW(Ue),Ee.props.onMomentumScrollEnd&&Ee.props.onMomentumScrollEnd($e)},onScroll:$e=>Dj(Ue,$e),onScrollBeginDrag:$e=>{var Dt,un;eN(Ue),(un=(Dt=Ee.props).onScrollBeginDrag)==null||un.call(Dt,$e)},onScrollEnd:()=>eN(Ue)}),[]),Hi=Hj(nr,te,Ue,Yn.onScroll),mo=kn;return De(oi,null,De(bj,{...xt,alignItemsAtEnd:T,canRender:Do,contentContainerStyle:Ut,contentInset:_,freshDataTransitionEpoch:Ee.freshDataTransitionEpoch,getRenderedItem:Yn.getRenderedItem,horizontal:te,initialContentOffset:Gr,ListEmptyComponent:A.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(Uj,{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&&w4)});var r6=n6;var k_=r6;ue();ue();function a6(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function i6(e,t){let n=t?.trim();if(!n)return e;let o=new RegExp(`^${a6(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 i6(n,e.subProvider)}function bd(e){return YC(e,{preferShortName:!0})}var JC="model:",ZC="unavailable-models:",eb="action:",wd="pluginActions:manage";function Vu(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 L_(e){return`${ZC}${e}`}function P_(e){return e.startsWith(ZC)?e.slice(ZC.length):null}function qu(e){return`${eb}${e}`}function A_(e){if(!e.startsWith(eb))return null;let t=e.slice(eb.length);return t.length>0?t:null}var E_=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):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(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 s6(e,t){let n=e.displayName,o=e.enabled?e.readiness:"disabled";if(_M(o))return n;let r=OM(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 l6="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",d6="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 ",c6=`${d6} text-update-foreground`,R_="left",M_=8,N_="max-w-64 text-balance font-normal leading-snug",__=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:$(l6,"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:R_,sideOffset:M_,align:"center",className:N_,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?s6(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(T=>T===p.instanceId?null:T),onFocus:()=>l(p.instanceId),onBlur:()=>l(T=>T===p.instanceId?null:T),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:c6,"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:R_,sideOffset:M_,align:"center",className:N_,children:[w,p.accountEmail?u("span",{className:"mt-0.5 block text-[10px] text-muted-foreground",children:p.accountEmail}):null]})]})},p.instanceId)})]})})})});function D_(e,t){let n=[],o=[];for(let r of e)t(r)?o.push(r):n.push(r);return{current:n,unavailable:o}}var u6=24;function f6(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 p6(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 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 O_(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=p6(e[i],r,i*10);s!==null&&a.push(s)}if(a.length===0)return null;o+=Math.min(...a)}return o}function F_(e,t){let n=O_(f6(e),t);return n===null?null:e.isFavorite?n-u6:n}function B_(e,t){return O_([co(e.title),co(e.description??"")],t)}function z_({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 U_(e,t){return`${e}:${t}`}var H_=new Map,$_=[],m6=[],g6=[];function Wu(e){return Vu(e.instanceId,e.slug)}function K_(e,t,n){return t.environmentId===n&&t.instanceId===e.instanceId&&t.model===e.slug}function h6(){return u("div",{className:"h-0.5"})}function ob(e){return e?.trim()||null}function V_({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 v6=pe(function({index:t,itemKey:n,action:o,showSectionHeader:r}){let{t:a}=Ce(),i=ob(o.description);return b(Le,{children:[r?u(V_,{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})]})]})]})}),y6=pe(function({index:t,showSectionHeader:n}){let{t:o}=Ce();return b(Le,{children:[n?u(V_,{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")})]})]})}),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??$_,m=t.selectedPluginActionKey??null,{t:g}=Ce(),{t:h}=Ce(),v=Wt(),[y,x]=J(""),[C,w]=J(!1),[L,S]=J(!1),T=N(null),I=N(null),k=N(null),E=v.environment.useActiveEnvironmentId(),P=v.settings.useClientSettings(O=>O.favorites??[]),_=K(()=>E===null?g6:P.filter(O=>O.environmentId===E),[E,P]),[A,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(()=>{T.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=>U_(O.instanceId,O.model))),[_]),G=R(O=>E===null?!1:_.some(fe=>K_(O,fe,E)),[E,_]),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(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:F_({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)),A==="favorites"?O=O.filter(fe=>G(fe)):O=O.filter(fe=>fe.instanceId===A)):A==="favorites"?O=O.filter(fe=>G(fe)):O=O.filter(fe=>fe.instanceId===A),v.model.sortProviderModelItems(O,{favoriteModelKeys:ee,groupFavorites:A!=="favorites",instanceOrder:A==="favorites"?nt:[]})},[ee,Y,nt,me,t.lockedProvider,y,A,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(()=>D_(rt,O=>ne(O).kind==="blocked"),[rt,ne]),j=K(()=>we.unavailable.length===0?null:{key:L_(A),models:we.unavailable,isExpanded:B.has(A)},[B,we,A]),X=K(()=>[...we.current,...j?.isExpanded?j.models:[]],[we,j]),ae=f!==void 0,oe=K(()=>{if(!ae)return $_;let O=y.trim();return O.length===0?p:p.map(fe=>({action:fe,score:B_(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]:m6,[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=P_(O);if(fe){on(fe);return}if(O===wd){c?.();return}let ye=A_(O);if(ye!==null){f?.(ye);return}let Te=X.find(ht=>Wu(ht)===O);if(!Te||ne(Te).kind==="blocked")return;let Me=tb(O);Me&>(Me.slug,Me.instanceId)},[gt,c,f,on,X,ne]),Mt=R(O=>{if(E===null)return;let fe=P.findIndex(Te=>K_(O,Te,E)),ye=[...P];fe>=0?ye.splice(fe,1):ye.push({environmentId:E,instanceId:O.instanceId,model:O.slug}),Se({favorites:ye})},[E,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 H_;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:H_},[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=tb(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(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(__,{selectedInstanceId:A,onSelectInstance:q,instanceEntries:Ae,showFavorites:!0,...ie?{disabledInstanceIds:ie,getDisabledInstanceTooltip:O=>h("instance.lockedToThread",{name:O.displayName})}:{}}),u(lS,{inline:!0,items:ct,filteredItems:dn,filter:null,autoHighlight:!0,open:!0,virtualized:!0,value:rn,onItemHighlighted:(O,fe)=>{k.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(cS,{ref:T,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"&&k.current){O.preventBaseUIHandler?.(),O.preventDefault(),O.stopPropagation(),zt(k.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(k_,{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(v6,{index:fe,itemKey:O,action:Te,showSectionHeader:O===Lt});if(O===wd)return u(y6,{index:fe,showSectionHeader:O===Lt});let Me=ro.get(O);if(!Me)return null;let ht=ne(Me);return u(E_,{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:h6,onLayout:Vt,onScroll:Vt,className:$("scrollbar-gutter-stable h-full overflow-x-hidden overscroll-y-contain py-1.5 [&::-webkit-scrollbar-track]:my-2",z_({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 W_(e){return e.submissionTarget==="provider-turn"&&e.status!=="known"}function x6(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 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=x6({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,T=w.style.paddingRight,I=window.innerWidth-C.clientWidth;C.style.overscrollBehavior="contain",w.style.overflow="hidden",I>0&&(w.style.paddingRight=`${I}px`);let k=_=>_ instanceof Element&&_.closest("[data-model-picker-content]"),E=_=>{k(_.target)||_.preventDefault()},P=_=>{k(_.target)||_.preventDefault()};return document.addEventListener("wheel",E,{capture:!0,passive:!1}),document.addEventListener("touchmove",P,{capture:!0,passive:!1}),()=>{document.removeEventListener("wheel",E,{capture:!0}),document.removeEventListener("touchmove",P,{capture:!0}),C.style.overscrollBehavior=L,w.style.overflow=S,w.style.paddingRight=T}},[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(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(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(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(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 G_(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(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 Q_(e){return u(ab,{...e})}ue();var qr=["approval-required","auto-accept-edits","auto","full-access"];var C6={"approval-required":Yd,"auto-accept-edits":na,auto:di,"full-access":li},b6={"approval-required":"approvalRequired","auto-accept-edits":"autoAcceptEdits",auto:"auto","full-access":"fullAccess"};function $g(){let{t:e}=Ce();return R(t=>{let n=b6[t];return{mode:t,label:e(`runtimeMode.${n}`),description:e(`runtimeMode.${n}Description`),icon:C6[t]}},[e])}ue();function X_(e){return e.description??e.name}var Y_=pe(function(t){let{t:n}=Ce(),{current:o,modes:r}=t.nativeMode,a=X_(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(xg,{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 ib(e){let{t}=Ce(),n=$g();if(e.nativeMode)return u(Y_,{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(xg,{"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 J_(e){return u(ib,{...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 Z_=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(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(kr,{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(kr,{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(kr,{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 eD="application/x-ycodium-composer-mention";function sb(e){return e.includes(eD)}function tD(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(eD);o.length!==0&&(e.insertMentionAtEnd(`${o} `)||e.onInsertRejected())}}}function nD({documentKey:e,insertMentionAtEnd:t,onInsertRejected:n}){let[o,r]=J(!1),a=tD({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 oD(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 rD({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(T=>T===null?T:lb(S,t,y))},[t,y]),L=R((S,T="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=oD({prompt:e.current,submissionTarget:l?"pending-user-input":"provider-turn",maxInputChars:t,t:y,disabledReason:r,event:S,onSend:k=>(p(),f(k,T),!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 w6=(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"),S6=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:S6}:void 0,S=w.settings.useEnvironmentIdentificationMode(),T=s!==null,I=w.devBackdrop.useVisible(S==="artwork"),k=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?k(!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:w6(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:[k(!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||T||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||T||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||T||l}),children:u(sn,{})}),u(Ro,{align:"end",side:"top",children:u(dr,{disabled:i||T||l,onClick:()=>{v()},children:C("primaryActions.implementInNewThread")})})]})]});let E=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||T||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(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:[k(!1),p&&c?E:null]}):E});function aD(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 iD(e){let t=e.match(/^\s{0,3}#{1,6}\s+(.+)$/m)?.[1]?.trim();return t&&t.length>0?t:null}ue();var I6=2e3,T6="min-h-8 max-w-full py-1.5 font-normal whitespace-normal text-start",k6=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 L6(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 sD=pe(function({requestId:t,isResponding:n,options:o,keybindings:r,declineReasonRelay:a,onRespondToApproval:i}){let{t:s}=Ce(),l=o??k6(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=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(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":L6(v.decision,y),className:`${T6}${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:I6,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 P6=["command","cmd"],A6=["file_path","filePath","path","notebook_path","notebookPath"],E6=["url"],R6=["query","q"],M6=["name","skill","skill_name","skillName"],lD=["toolName","tool_name"],dD=["description"],N6=[],_6=[];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 D6(e){let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\")),n=t>=0?e.slice(t+1):e;return n.length>0?n:e}function O6(e){let t=e[0];return t===void 0?null:e.every(n=>n.path===t.path)?t.path:null}function uD(e){let t=e.args??N6,n=e.fileChanges??_6,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,P6,o);d!==null&&(s={shape:"command",command:d});break}case"file-read":case"file-change":{let d=Qa(t,A6,o)??O6(n);d!==null&&(i=D6(d),s=n.some(c=>c.path===d)?{shape:"none"}:{shape:"path",path:d});break}case"web-fetch":{let d=Qa(t,E6,o);d!==null&&(s={shape:"url",url:d});break}case"web-search":{let d=Qa(t,R6,o);d!==null&&(s={shape:"query",query:d});break}case"skill":{i=Qa(t,M6,o)??Qa(t,lD,o),l=Qa(t,dD,o),t.length>0&&(s={shape:"none"});break}case"mcp-tool":case"tool":{i=Qa(t,lD,o),l=Qa(t,dD,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 F6={"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"},B6={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"},z6={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"},U6={command:"approval.commandDetailLabel",path:"approval.body.pathLabel",url:"approval.body.urlLabel",query:"approval.body.queryLabel",text:"approval.body.detailLabel"};function fD(e,t){let n=e.subject!==null?F6[e.kind]:void 0;return n!==void 0?t(n,{name:e.subject}):t(B6[e.kind])}function pD(e,t){return t(z6[e])}function mD(e,t){return t(U6[e])}function gD(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=cD(t.oldText??""),o=cD(t.newText);if(n.length===0&&o.length===0)return null;let r=`--- a/${e.path}
|
|
3762
3784
|
+++ b/${e.path}
|
|
3763
3785
|
`,a=`@@ -${n.length===0?"0,0":`1,${n.length}`} +${o.length===0?"0,0":`1,${o.length}`} @@
|
|
3764
3786
|
`,i=[...n.map(s=>`-${s}`),...o.map(s=>`+${s}`)];return`${r}${a}${i.join(`
|
|
3765
3787
|
`)}
|
|
3766
|
-
`}function
|
|
3767
|
-
`);return t.at(-1)===""?t.slice(0,-1):t}function
|
|
3788
|
+
`}function cD(e){if(e.length===0)return[];let t=e.split(`
|
|
3789
|
+
`);return t.at(-1)===""?t.slice(0,-1):t}function hD(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 vD(e){return{additions:e.additions??0,deletions:e.deletions??0}}ue();ue();var Rge=(()=>{try{return!1}catch{return!1}})(),yD=/(?=^From [a-f0-9]+ .+$)/m,cb=/(?=^diff --git)/gm;var xD=/^(---|\+\+\+)\s+([^\t\r\n]+)/,CD=/^(---|\+\+\+)\s+[ab]\/([^\t\r\n]+)/,bD=/^diff --git (?:"a\/(.+?)"|a\/(.+?)) (?:"b\/(.+?)"|b\/(.+?))$/,wD=/^index ([0-9a-f]+)\.\.([0-9a-f]+)(?: (\d+))?$/i;var H6={hunkLineCount:50,lineHeight:20,diffHeaderHeight:44,spacing:8},Mge={...H6,hunkLineCount:1};var Nge=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 $6=new TextEncoder,K6=new TextDecoder("utf-8",{ignoreBOM:!0}),V6=/[\uD800-\uDFFF]/,fb=1024,Sd=new Uint8Array(fb);function SD(){Sd.length!==fb&&(Sd=new Uint8Array(fb))}function Mn(e){if(e.length===0)return e;if(V6.test(e))return JSON.parse(JSON.stringify(e));let t=e.length*3;Sd.length<t&&(Sd=new Uint8Array(t));let{written:n}=$6.encodeInto(e,Sd);return K6.decode(Sd.subarray(0,n))}function TD(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=W6(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 W6(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(ID(e.deletionLines[r+h]??""));let d=[];for(let h=0;h<o;h++)d.push(ID(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 G6=/\s+/g;function ID(e){return e.replace(G6,"")}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 Q6(e,t,n){try{return X6(e,t,n)}finally{SD()}}function X6(e,t,n=!1){let o=a8(e),r=o?Z6(e):e8(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&&!t8(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=Y6(s,{cacheKey:t!=null?`${t}-${i.length}`:void 0,isGitDiff:o,throwOnError:n});l!=null&&i.push(l)}return{patchMetadata:a,files:i}}function Y6(e,{cacheKey:t,isGitDiff:n=cb.test(e),oldFile:o,newFile:r,throwOnError:a=!1}={}){let i=0,s=_D(e,"@@ "),l,d=o==null||r==null,c=0,f=0;for(let p of s){let m=RD(p),g=m[0];if(g==null){if(a)throw Error("parsePatchContent: invalid hunk");console.error("parsePatchContent: invalid hunk",p);continue}let h=ND(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?kD(r.contents):[],deletionLines:!d&&o!=null&&r!=null?kD(o.contents):[],cacheKey:AD(t)},l.additionLines.length===1&&r?.contents===""&&(l.additionLines.length=0),l.deletionLines.length===1&&o?.contents===""&&(l.deletionLines.length=0);for(let k of m){if(k.startsWith("diff --git")){let P=k.trim().match(bD),_=P?.[1]??P?.[2],A=P?.[3]??P?.[4];if(_==null||A==null){if(a)throw Error("parsePatchContent: invalid git diff header");console.error("parsePatchContent: invalid git diff header",k);continue}l.name=Mn(A.trim()),_!==A&&(l.prevName=Mn(_.trim()));continue}let E=k.startsWith("---")||k.startsWith("+++")?k.match(n?CD:xD):null;if(E!=null){let[,P,_]=E;if(P==="---"&&_!=="/dev/null"){let A=Mn(_.trim());l.prevName=A,l.name=A}else P==="+++"&&_!=="/dev/null"&&(l.name=Mn(_.trim()))}else if(n){if(k.startsWith("new mode ")&&(l.mode=Mn(k.slice(8).trim())),k.startsWith("old mode ")&&(l.prevMode=Mn(k.slice(8).trim())),k.startsWith("new file mode")&&(l.type="new",l.mode=Mn(k.slice(13).trim())),k.startsWith("deleted file mode")&&(l.type="deleted",l.mode=Mn(k.slice(17).trim())),k.startsWith("similarity index")&&(k.startsWith("similarity index 100%")?l.type="rename-pure":l.type="rename-changed"),k.startsWith("index ")){let[,P,_,A]=k.trim().match(wD)??[];P!=null&&(l.prevObjectId=Mn(P)),_!=null&&(l.newObjectId=Mn(_)),A!=null&&(l.mode=Mn(A))}k.startsWith("rename from ")&&(l.prevName=Mn(k.slice(12).trim())),k.startsWith("rename to ")&&(l.name=Mn(k.slice(10).trim()))}}continue}let x,C;for(;m.length>0&&(m[m.length-1]===`
|
|
3768
3790
|
`||m[m.length-1]==="\r"||m[m.length-1]===`\r
|
|
3769
|
-
`||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:
|
|
3770
|
-
From `)}function
|
|
3771
|
-
`,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
|
|
3772
|
-
`||a==="\r")break;if(a!==" "&&a!==" ")return!0}return!1}function
|
|
3773
|
-
`,t);return n===-1?e.length:n+1}function
|
|
3774
|
-
`&&n!=="\r")return!1}return!0}function
|
|
3791
|
+
`||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:AD(h.hunkContext),hunkSpecs:Mn(g),noEOFCRAdditions:!1,noEOFCRDeletions:!1},T=0,I=0;for(let k=1;k<m.length;k++){let E=m[k];if(T>=S.additionCount&&I>=S.deletionCount&&!E.startsWith("\\")){if(a&&n8(E)&&!o8(E))throw Error("parsePatchContent: hunk has more lines than expected");break}let P=E[0];if(P!=="+"&&P!=="-"&&P!==" "&&P!=="\\"){if(a)throw Error("parsePatchContent: invalid hunk line");console.error(`parseLineType: Invalid firstChar: "${P}", full line: "${E}"`),console.error("processFile: invalid rawLine:",E);continue}let _=i8(P);if(_==="addition"){if(a&&T>=S.additionCount)throw Error("parsePatchContent: hunk has too many addition lines");let A=pb(E);(x==null||x.type!=="change")&&(x=mb("change",c,f),S.hunkContent.push(x)),f++,T++,d&&l.additionLines.push(A),x.additions++,v++,C="addition"}else if(_==="deletion"){if(a&&I>=S.deletionCount)throw Error("parsePatchContent: hunk has too many deletion lines");let A=pb(E);(x==null||x.type!=="change")&&(x=mb("change",c,f),S.hunkContent.push(x)),c++,I++,d&&l.deletionLines.push(A),x.deletions++,y++,C="deletion"}else if(_==="context"){if(a&&(I>=S.deletionCount||T>=S.additionCount))throw Error("parsePatchContent: hunk has too many context lines");let A=pb(E);(x==null||x.type!=="context")&&(x=mb("context",c,f),S.hunkContent.push(x)),f++,c++,T++,I++,d&&(l.deletionLines.push(A),l.additionLines.push(A)),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 A=l.additionLines.length-1;A>=0&&(l.additionLines[A]=ub(l.additionLines[A]))}if(d&&(C==="deletion"||C==="context")){let A=l.deletionLines.length-1;A>=0&&(l.deletionLines[A]=ub(l.deletionLines[A]))}}}if(a&&(T!==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 k of S.hunkContent)k.type==="context"?(S.splitLineCount+=k.lines,S.unifiedLineCount+=k.lines):(S.splitLineCount+=Math.max(k.additions,k.deletions),S.unifiedLineCount+=k.deletions+k.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),TD(l),l}}function ED(e,t,n=!1){let o=[],r=J6(e)?e.split(yD):[e];for(let a of r)try{o.push(Q6(a,t!=null?`${t}-${o.length}`:void 0,n))}catch(i){if(n)throw i;console.error(i)}return o}function J6(e){return e.startsWith("From ")||e.includes(`
|
|
3792
|
+
From `)}function kD(e){let t=RD(e);for(let n=0;n<t.length;n++)t[n]=Mn(t[n]);return t}function RD(e){if(e.length===0)return[""];let t=[],n=0;for(;;){let o=e.indexOf(`
|
|
3793
|
+
`,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 Z6(e){return _D(e,"diff --git")}function e8(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(MD(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=ND(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 t8(e){return MD(e,0)}function MD(e,t){let n=gb(e,t);return LD(e,t,"---")&&LD(e,n,"+++")}function LD(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===`
|
|
3794
|
+
`||a==="\r")break;if(a!==" "&&a!==" ")return!0}return!1}function gb(e,t){let n=e.indexOf(`
|
|
3795
|
+
`,t);return n===-1?e.length:n+1}function n8(e){let t=e[0];return t==="+"||t==="-"||t===" "}function o8(e){if(!e.startsWith("--"))return!1;for(let t=2;t<e.length;t++){let n=e[t];if(n!==" "&&n!==" "&&n!==`
|
|
3796
|
+
`&&n!=="\r")return!1}return!0}function ND(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=r8(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 r8(e){return e.endsWith(`\r
|
|
3775
3797
|
`)?e.slice(0,-2):e.endsWith(`
|
|
3776
|
-
`)?e.slice(0,-1):e}function
|
|
3777
|
-
diff --git`)}function
|
|
3778
|
-
${t}`,o=e.startsWith(t)?0:
|
|
3779
|
-
`:t)}function
|
|
3780
|
-
`)[0]}),u("div",{className:"flex min-w-0 flex-wrap items-center gap-1 pt-0.5",children:s.options.map(f=>u(
|
|
3781
|
-
${n}`}
|
|
3782
|
-
`;function m8(){let{t:e}=xe();return u(hl,{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 YD(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 Qg(e){if(!e)return null;let t=Zs(e);return typeof t=="string"?t:null}function g8(e,t,n,o,r,a,i,s){let l=e.getModelCapabilities(n,o,t,s),d=Gg({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":Qg(p))??null,w=typeof v?.currentValue=="boolean"?v.currentValue:null,L=Qg(m),S=Qg(g),T=g?Cb(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:T}}function wb(e){let t=g8(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 Sb(e){return wb(e).hasAnyControls}var Ib=me(function({provider:t,instanceId:n,models:o,model:r,promptInjection:a,onPromptUpdate:i,modelOptions:s,allowPromptInjectedEffort:l=!0,planModeEnabled:d,...c}){let{t:f}=xe(),p=Gt(),m=p.draft.useStore(I=>I.setProviderModelOptions),g=R(I=>{if("onModelOptionsChange"in c){c.onModelOptionsChange(I);return}let k=c.threadRef??c.draftId;k&&m(k,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}=wb({modelApi:p.model,provider:t,models:o,model:r,promptInjection:a,modelOptions:s,allowPromptInjectedEffort:l,planModeEnabled:d}),S=I=>{g(jg(I))},T=(I,k)=>{if(k){if(I.promptInjectedValues?.includes(k)){i(E=>E.trim().length===0?p8:XD(E,"ultrathink"));return}w&&I.id===x?.id||(C&&I.id===x?.id&&i(E=>E.replace(/^Ultrathink:\s*/i,"")),S(YD(h,I.id,k)))}};return L?b(Te,{children:[v.map((I,k)=>{let E=C&&I.id===x?.id?"ultrathink":Qg(I)??"";return b("div",{children:[k>0?u(ui,{}):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(Pr,{value:E,onValueChange:P=>T(I,P),children:I.options.map(P=>u(Ho,{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(Te,{children:[" ",u(m8,{})]}):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,k)=>{let E=I.currentValue===!0?"on":"off";return b("div",{children:[k>0||v.length>0?u(ui,{}):null,b(dc,{children:[u("div",{className:"px-2 py-1.5 font-medium text-muted-foreground text-xs",children:I.label}),u(Pr,{value:E,onValueChange:P=>{S(YD(h,I.id,P==="on"))},children:["on","off"].map(P=>u(Ho,{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 h8(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")}):Cb(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 JD=me(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}=xe(),v=Gt().model,{descriptors:y,primarySelectDescriptor:x,ultrathinkPromptControlled:C}=wb({modelApi:v,provider:t,models:o,model:r,promptInjection:a,modelOptions:s,allowPromptInjectedEffort:l,planModeEnabled:d});if(!Sb({modelApi:v,provider:t,models:o,model:r,promptInjection:a,modelOptions:s,allowPromptInjectedEffort:l,planModeEnabled:d}))return null;let{label:w,showFastModeIcon:L}=h8(h,{provider:t,descriptors:y,primarySelectDescriptorId:x?.id??null,ultrathinkPromptControlled:C}),S=L?b(Te,{children:[u(Go,{icon:ls,className:H("fill-current opacity-80",t==="claudeAgent"?"text-[#d97757]":"text-foreground")}),u("span",{className:"sr-only",children:h("traits.fastModeOn")})]}):null,T=t==="codex";return b(Ao,{open:m,onOpenChange:I=>{g(I)},children:[u(Ro,{render:u(Wo,{variant:c??"ghost",className:H(T?"min-w-0 max-w-40 shrink justify-start overflow-hidden whitespace-nowrap sm:max-w-48":"shrink-0 whitespace-nowrap",f)}),children:T?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(xa,{})]}):b(Te,{children:[S,u("span",{children:w}),u(xa,{})]})}),u(Eo,{align:"start",children:u(Ib,{provider:t,...n?{instanceId:n}:{},models:o,model:r,promptInjection:a,onPromptUpdate:i,modelOptions:s,allowPromptInjectedEffort:l,planModeEnabled:d,...p})})]})});function ZD(e){return bb(e)?bb(e.replace(/^Ultrathink:\s*/i,""))?"ultrathink-in-body":"ultrathink":"none"}function e1(e,t){let{provider:n,model:o,models:r,modelOptions:a,promptInjectionState:i="none",planModeEnabled:s}=e,l=t.getModelCapabilities(r,o,n,s),d=Gg({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:jg(d),...m?{composerFrameClassName:"ultrathink-frame",composerSurfaceClassName:"shadow-[0_0_0_1px_rgba(255,255,255,0.07)_inset]",modelPickerIconClassName:"ultrathink-chroma"}:{}}}function t1(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)||!Sb({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 n1(e){return t1(Ib,e)}function o1(e){return t1(JD,e)}pe();var r1=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},a1=(e=>e?r1(e):r1);pe();var v8=e=>e;function y8(e,t=v8){let n=Cn.useSyncExternalStore(e.subscribe,Cn.useCallback(()=>t(e.getState()),[e,t]),Cn.useCallback(()=>t(e.getInitialState()),[e,t]));return Cn.useDebugValue(n),n}var i1=e=>{let t=a1(e),n=o=>y8(t,o);return Object.assign(n,t),n},s1=(e=>e?i1(e):i1);var Tb=s1(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 l1(e){return Tb(t=>e===null?null:t.presetIdByDraftId[e]??null)}function kb(e,t){return t==null?void 0:e.find(n=>n.presetId===t)}var Lb="__none__",d1=me(function({environmentId:t,draftId:n,threadPresetId:o,compact:r}){let{t:a}=xe(),i=Gt().presets.useThreadPresets(t),s=l1(n),l=Tb(c=>c.setDraftPresetId);if(n===null){let f=kb(i,o)?.displayName??o;return f===null?null:b(Wo,{variant:"ghost",disabled:!0,"aria-label":a("preset.appliedLabel",{name:f}),className:"shrink-0 whitespace-nowrap",children:[u(Go,{icon:Aa}),u("span",{className:"min-w-0 truncate",children:f})]})}if(i.length===0)return null;let d=kb(i,s);return b(Ao,{children:[u(Ro,{render:u(Wo,{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(Go,{icon:Aa}),r?null:u("span",{className:"min-w-0 truncate",children:d?.displayName??a("preset.none")}),u(xa,{})]})}),u(Eo,{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(Pr,{value:s??Lb,onValueChange:c=>{l(n,c===Lb?null:c)},children:[u(Ho,{value:Lb,hideIndicator:!0,closeOnClick:!0,children:u("span",{className:"min-w-0 truncate",children:a("preset.none")})}),i.map(c=>u(Ho,{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))]})]})})]})});pe();function c1(e){let t=e.credentialIdentity;return[e.queryKey,t===null?"":t.id,t===null?"":String(t.revision)].join("\0")}function x8(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 u1(e){return e.capability.status!=="unsupported"&&e.credentialIdentity!==null}function Pb(e,t){return e===null||!Number.isFinite(e)?null:t.kind==="money"?e.toFixed(t.precision):(Number.isInteger(e),String(e))}function Xg(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 Ab(e,t){return e.freshness==="stale"||e.status==="error"||e.errorReason!==null||t!==null}function f1(e){if(e.unlimited===!0)return{kind:"unlimited"};let t=e.kind==="spend-cap"?e.used??e.remaining:e.remaining??e.used,n=Pb(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 p1(e,t){let n=[];for(let o of e){let r=f1(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:Ab(o,t)})}return n}function m1(e){return e.filter(t=>t.kind==="rate-limit"&&f1(t)===null).map(t=>({metricId:t.metricId,kind:t.kind,nativeLabel:t.nativeLabel,durationMs:t.windowMs,resetsAt:t.resetsAt}))}function g1(e){return e.snapshot===null||e.credentialIdentity===null?null:x8(e.snapshot,e)?e.snapshot:null}function h1(e){for(let t of e)if(t.resetsAt!==null)return t.resetsAt;return null}function v1(e){let t=null;for(let n of e)n.fetchedAt!==null&&(t===null||n.fetchedAt<t)&&(t=n.fetchedAt);return t}pe();function y1(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 Rb(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 Mb(e,t){let n=e.nativeLabel?.trim()??"";if(n.length>0)return n;let o=Xg(e.durationMs);return o!==null?Rb(o,t):S8(e.kind,t)}function C8(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 b8(e,t){let n=C8(e.display,t);if(e.kind==="quota-window")return`${Mb(e,t)} ${n}`;let o=e.nativeLabel?.trim()??"";return o.length>0?`${o} ${n}`:n}function w8(e,t){let n=Mb({kind:e.kind,nativeLabel:e.nativeLabel,durationMs:e.durationMs},t),o=Xg(e.durationMs);return o!==null?`${n} \xB7 ${Rb(o,t)}`:e.resetsAt!==null?`${n} \xB7 ${t("accountUsage.resetsAt",{time:wd(e.resetsAt)})}`:n}function S8(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 I8(e,t){switch(e){case"account":return t("accountUsage.scopeAccount");case"org":return t("accountUsage.scopeOrg")}}function wd(e){return da(e,"locale")||e}function T8(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:wd(e.retryAt)});case"offline":return t("accountUsage.outcomeOffline");case"unsupported":return t("accountUsage.outcomeUnsupported");case"error":return t("accountUsage.outcomeError")}}function k8(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 L8(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 P8(e,t,n){return e.capability.status==="unsupported"?k8(e.error,n):t.length>0?null:e.loading?n("accountUsage.loading"):e.error!==null?L8(e.error,n):e.credentialIdentity===null||e.capability.status==="unknown"?n("accountUsage.unknown"):n("accountUsage.noData")}function Eb(e,t){let n=Pb(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 x1(e){let[t,n]=J(!1);return u(A8,{...e,expanded:t,onToggleExpanded:()=>n(o=>!o)})}function A8(e){let{expanded:t,onToggleExpanded:n,onRefresh:o,...r}=e,{t:a}=xe(),i=c1(r),{feedback:s,refreshing:l,refresh:d}=y1(i,o),c=r.capability.status==="supported"&&r.credentialIdentity!==null?g1(r):null,f=c?.metrics??[],p=p1(f,r.error),m=p.some(S=>S.stale)||r.error!==null&&c!==null,g=h1(p),h=v1(f),v=l,y=P8(r,p,a),x=u1(r),w=`${oa()}-account-usage-details`,L=[...p.map(S=>({key:S.metricId,text:b8(S,a)})),...m1(f).map(S=>({key:`${S.metricId}\0status`,text:w8(S,a)})),...g===null?[]:[{key:"resets-at",text:a("accountUsage.resetsAt",{time:wd(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(de,{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(un,{"aria-hidden":"true",className:H("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,T)=>b("span",{children:[T>0?u("span",{"aria-hidden":"true",children:" \xB7 "}):null,S.text]},S.key)):y})]})}),x?u(de,{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(E8,{metric:S,queryError:r.error,t:a},S.metricId)),h!==null?u("p",{className:"text-[11px] text-secondary-label",children:a("accountUsage.collectedAt",{time:wd(h)})}):null]}):null,s!==null?u("p",{role:"status",className:"px-1 pb-1 text-[11px] text-muted-foreground",children:T8(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 E8({metric:e,queryError:t,t:n}){let o=Eb(e,e.used),r=e.unlimited===!0?n("accountUsage.unlimited"):Eb(e,e.remaining),a=Eb(e,e.limit),i=n("accountUsage.sharedScope",{scope:I8(e.scope,n)}),s=Ab(e,t),l=e.windowMs,d=Xg(l),c=Mb({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:wd(e.fetchedAt)})}):null,e.resetsAt!==null?u("div",{children:n("accountUsage.resetsAt",{time:wd(e.resetsAt)})}):null,d!==null?u("div",{children:Rb(d,n)}):null]})}function Za(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 C1(e,t){if(!e)return null;let n=t.get(e.instanceId)?.find(o=>o.slug===e.model);return n?xd(n):e.model}function b1(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 R8(e){return e===null||!Number.isFinite(e)?null:e<10?`${e.toFixed(1).replace(/\.0$/,"")}%`:`${Math.round(e)}%`}function w1(e){let{t}=xe(),{usage:n,breakdown:o,modelDisplayName:r,onCompact:a,compactDisabled:i,compactDisabledReason:s}=e,l=R8(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(vl,{children:[u(xl,{openOnHover:!0,delay:150,closeDelay:a?150:0,render:u(de,{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:Za(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(yl,{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:[Za(n.usedTokens),"/",Za(n.maxTokens??null)]})]}):u("div",{className:"text-secondary-label text-[11px] tabular-nums",children:Za(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:Za(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:Za(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:Za(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:Za(m)})]}):null,n.compactsAutomatically?u("div",{className:"mt-1 text-pretty text-secondary-label text-[11px] font-medium",children:b1(t,r,n.autoCompactThreshold)}):null,a?b(Te,{children:[b(de,{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]})})]})}pe();pe();var S1=wt(null),I1=S1.Provider;function ba(){let e=Kt(S1);if(e===null)throw new Error("Composer thread data has not been provided.");return e}var T1=wt(null);function k1({children:e}){let{data:t,target:n,threadKey:o}=ba(),r=t.useComposerStatus({target:n,threadKey:o});return u(T1.Provider,{value:r,children:e})}function L1(){let e=Kt(T1);if(e===null)throw new Error("Composer status has not been provided.");return e}function P1(e){return e.startsWith("!")}function A1(e){return e.slice(1).trim()}function E1(e){return e.length===0?"empty":/[\r\n]/.test(e)?"multiline":null}function M8(){return null}function R1(){let{data:e,target:t,threadKey:n}=ba();return(e.useShellCommand??M8)({target:t,threadKey:n})}function Nb(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 M1({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 N1(e,t){let n=Gr.indexOf(e);if(n===-1)return Gr[0];let o=(n+t+Gr.length)%Gr.length;return Gr[o]??Gr[0]}var N8=['[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 _8(e){return e.closest(N8)!==null}var D8=[];function O8(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:ZD(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 F8=e=>e.prompt.trim();function B8(e){let{t}=xe(),n=e.api.draft.useThreadDraftSelector(e.composerDraftTarget,F8),o=e.pendingCustomAnswer!==null;return u("button",{type:"button",className:H("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 z8=me(function(t){let{data:n,target:o}=ba(),r=Ow(),a=n.useAccountUsage({target:o,active:r&&!t.hidden});return t.hidden||a===void 0?null:u(x1,{...a},a.queryKey)}),U8=me(function(t){let{data:n,target:o}=ba(),r=n.useContextUsage(o);return r?.window==null?null:u(w1,{usage:r.window,breakdown:r.breakdown,modelDisplayName:t.modelDisplayName,onCompact:t.onCompact,compactDisabled:t.compactDisabled,compactDisabledReason:t.compactDisabledReason})}),H8=me(function(t){let{t:n}=xe();return b(Te,{children:[u(U8,{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})]})}),_1=me(function(t){let n=DT(),{data:o,target:r,threadKey:a}=ba(),{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:T,providerStatuses:I,activeProjectDefaultModelSelection:k,projectId:E,activeThreadModelSelection:P}=o.useComposerModelContext(r),{activeThreadId:_,activeThread:A,isLocalDraftThread:B,projectSelectionRequired:z,phase:q,isSendBusy:X,sendDisabledReason:Se,isPreparingWorktree:K,environmentUnavailable:W,compactDisabled:Z,compactDisabledReason:j}=L1(),{t:O}=xe(),{composerDraftTarget:Y,environmentId:re,attachmentUploadsCapabilityKnown:ue,supportsAttachmentUploads:le,routeKind:fe,routeThreadRef:ae,draftId:Le,forceExpandedOnMobile:et,slots:Ge,resolvedTheme:rt,settings:$e,keybindings:te,terminalOpen:Pe,gitCwd:Q,promptRef:$,composerRef:oe,composerImagesRef:ve,composerTerminalContextsRef:at,composerElementContextsRef:Et,sendContextRef:Rt,onSend:_t,onInterrupt:an,interruptArmed:mt=!1,recentSlashCommandIds:Wt=D8,onSlashCommandUsed:Ot,onCompactContext:vt,onImplementPlanInNewThread:Sn,onProviderModelSelect:ft,onProviderInstanceSelect:pn,onModelSelectionChosen:no,onSelectPluginAction:Xt,onManagePlugins:In,getModelDisabledReason:En,getModelContinuationLabel:sn,onContinueInModel:Rn,toggleInteractionMode:F,handleRuntimeModeChange:ce,handleInteractionModeChange:be,handleNativeModeChange:ke,focusComposer:Re,scheduleComposerFocus:st,setThreadError:ln,onExpandImage:vn}=t,ct=o.useComposerPlan(r),kt=ct.proposedPlan,Ft=ct.tasksProgress,Pt=ct.taskSteps,Ut=s.length===0&&S==="plan"&&kt!==null,ht=N(null),we=R((D,Ie)=>{y(D,Ie),$.current="",ht.current?.resetCursorState({cursor:0})},[$,y]),Ve=R(async(D,Ie,Ue)=>{try{await h(D,Ie,Ue)}catch(bt){ln(r.threadId,bt instanceof Error?bt.message:O("approval.respondFailed"))}},[r.threadId,h,ln,O]),qe=R((D,Ie)=>{v(D,Ie).then(Ue=>{Ue!==null&&ln(r.threadId,Ue)})},[r.threadId,v,ln]),We=R(()=>{C().then(D=>{D!==null&&ln(r.threadId,D)})},[C,r.threadId,ln]),ot=zM({machineUnavailable:W!==null,sessionStarted:A?.session!=null,sessionDisconnected:q==="disconnected"}),yt=UM(ot),ye=t.api,{limits:xt}=t.attachments,pt=ye.draft.useThreadDraftSelector(Y,D=>O8(D,ye.chat.deriveComposerSendState)),Ht=pt.images,Tn=V(()=>Ht.filter(D=>gv(D)==="image"),[Ht]),mn=pt.terminalContexts,kn=pt.elementContexts,ge=pt.previewAnnotations,tt=pt.reviewComments,Ct=pt.nonPersistedImageIds,lt=ye.uploads.useStore(D=>D.uploadsByImageId),Ln=le?YT({imageIds:Ht.map(D=>D.id),uploadsByImageId:lt,environmentId:re},O):null,Bt=ye.draft.useStore,Mt=Bt(D=>D.setPrompt),Yt=Bt(D=>D.setNativeMode),Pn=Bt(D=>D.addImage),zt=Bt(D=>D.addImages),To=Bt(D=>D.removeImage),hr=Bt(D=>D.insertTerminalContext),ei=Bt(D=>D.removeElementContext),Ui=Bt(D=>D.removePreviewAnnotation),ze=Bt(D=>D.removeReviewComment),jr=Bt(D=>D.clearComposerPromptAndImages);G(()=>{if(ue){if(!le){for(let D of Ht)ye.uploads.release(D.id);return}ye.draft.restoreAttachments();for(let D of Ht)ye.uploads.start({environmentId:re,image:D})}},[ue,Ht,re,le]);let yn=V(()=>_M(ye.model.applyInstanceSettings(ye.model.deriveInstanceEntries(I),$e)),[ye.model,I,$e]),vr=pt.activeProvider??null,Hi=A?.session?.providerInstanceId??P?.instanceId??k?.instanceId??null,Xo=DM(yn,vr??Hi)??yn[0]?.driverKind??ye.model.makeDriverKind("unconfigured"),yr=T??Xo,oo=V(()=>{if(!T||!A)return null;let D=A.session?.providerInstanceId??P?.instanceId;return D?yn.find(Ie=>Ie.instanceId===D)?.continuationGroupKey??null:null},[A,P?.instanceId,T,yn]),$t=V(()=>{let D=[pt.activeProvider,A?.session?.providerInstanceId,P?.instanceId,k?.instanceId];for(let bt of D){if(!bt)continue;let dn=yn.find(cn=>cn.instanceId===bt&&yg(cn));if(dn){if(T&&dn.driverKind!==T||oo&&dn.continuationGroupKey!==oo)continue;return dn.instanceId}}let Ie=yn.filter(bt=>(!T||bt.driverKind===T)&&(!oo||bt.continuationGroupKey===oo)),Ue=Ie.filter(bt=>bt.driverKind===yr);return Cg(Ue,void 0)?.instanceId??Cg(Ie,void 0)?.instanceId??ye.model.noProviderSelection.instanceId},[k?.instanceId,A?.session?.providerInstanceId,P?.instanceId,pt.activeProvider,oo,T,yn,yr]),xr=V(()=>yn.find(D=>D.instanceId===$t),[yn,$t]),Jt=xr===void 0,Cr=j??(Jt?O("composer.compactingUnavailable"):null),Mn=xr?.driverKind??yr,{modelOptions:Oe,selectedModel:bn,selectedModelStatus:br}=ye.draft.useEffectiveModelState({threadRef:Y,providers:I,selectedProvider:Mn,selectedInstanceId:$t,threadModelSelection:P,projectModelSelection:k,settings:$e}),wr=V(()=>xr?.snapshot??null,[xr]),fo=V(()=>xr?.models??[],[xr]),Sr=pt.promptInjection,_o=V(()=>e1({provider:Mn,model:bn,models:fo,promptInjectionState:Sr,modelOptions:Oe?.[$t],planModeEnabled:$e.planModeEnabled},ye.model),[Oe,Sr,$t,bn,Mn,fo,$e.planModeEnabled]),Qr=_o.promptEffort,wa=_o.modelOptionsForDispatch,ko=$e.planModeEnabled,Lo=V(()=>({showInteractionModeToggle:ko&&ye.model.getInteractionModeToggle(I,Mn),runtimeModeSwitch:wr?.runtimeModeSwitch??"next-turn"}),[ko,I,Mn,wr]),Xr=wr?.supportsNativeModeSwitch===!0,An=B&&Xr?pt.nativeModeByProvider?.[$t]??null:null,Do=V(()=>ye.model.resolveNativeMode(wr,{runtimeMode:L,nativeModeId:B?An:A?.nativeModeId??null}),[ye.model,A?.nativeModeId,wr,L,B,An]),Yr=An&&Do?.current.id===An?An:void 0,Yo=R(D=>{B&&Yt(Y,$t,D),ke(D)},[B,Yt,Y,$t,ke]),Jr=V(()=>ye.model.createSelection($t,bn,wa),[ye.model,$t,bn,wa]);jD({threadId:A?.id??null,isLocalDraftThread:B,selection:Jr,selectionsEqual:ye.model.selectionsEqual,onChosen:no});let Ir=R(D=>pn(D,Jr),[pn,Jr]),Jo=bn,Zo=V(()=>{let D=new Map;for(let Ie of yn)D.set(Ie.instanceId,ye.model.getAppModelOptionsForInstance($e,Ie));return D},[yn,$e]),Oo=V(()=>(Zo.get($t)??[]).some(Ie=>Ie.slug===Jo)?Jo:ye.model.normalizeSlug(Jo,Mn)??Jo,[ye.model,Zo,$t,Jo,Mn]),ti=B&&T===null,er=ye.pluginComposer.useOptions(ti?re:null,E),Ke=er.options,Lt=ti?pt.selectedPluginActionKey:null,en=V(()=>Lt===null?null:Ke.find(D=>D.id===Lt)??null,[Lt,Ke]),Nn=Lt!==null,po=Nn&&en===null?O(er.isKnown?"composer.pluginUnavailable":"composer.pluginLoading"):null,Zr=Se??po??(l?null:Ln),el=Zr!==null,[Sd,Qu]=J(!1);G(()=>{Qu(!1)},[$t]);let Yg=Kg(br),Xu=K_({status:br,submissionTarget:l?"pending-user-input":"provider-turn"}),Id=Sd&&Xu?Yg:null,Jg=V(()=>C1(P,Zo),[P,Zo]),tr=`${String(re)}\0${String(Y)}`,[Yu,Ki]=J(!1),[U,Ae]=J(!1),[it,tn]=J(null),[Fo,tl]=J(null),[Sa,ni]=J(!1),[Td,nl]=J(!1),[z1,Db]=J(null),[ol,Zg]=J({key:0,active:!1}),Ob=N(tr);he(()=>{Ob.current!==tr&&(Ob.current=tr,Ki(!1),tn(null),ni(!1),nl(!1),Db(null),Zg({key:ol.key,active:!1}))},[tr,ol.key]);let Tr=bp("max-sm"),ro=Tr&&!et&&!U,rl=N(null),Fb=N(null),eh=N(null),Bb=N(null),th=N(!1),mo=N(null),al=N(null),il=N(null),Ju=N(!1),zb=N(0),sl=N(null),nh=N(new Set),Vi=N(new Map),U1=R(()=>{Ki(!0)},[]),H1=R(D=>{be(D)},[be]),$1=V(()=>new Set(Ct),[Ct]),Xn=i!==null,Ub=l?.activeQuestion?.allowFreeform===!1,oi=R1(),K1=ye.draft.useThreadDraftSelector(Y,D=>P1(D.prompt)),ll=oi!==null&&K1&&!Xn&&l===null,kd=g[0]??null,{showTopDrawer:Zu,showCollapsedPromptRow:V1,hasBlocking:Ld}=FT(kd?.kind??null,ro),q1=Ut||l!==null,{isComposerFooterCompact:qi,isComposerPrimaryActionsCompact:Hb}=uk(eh,q1),$b=l!==null,Kb=R(D=>{let Ie=ht.current?.readDraftPrompt()??$.current,Ue=D(Ie);if(Ue===Ie){st();return}$b?Mt(Y,Ue):($.current=Ue,Mt(Y,Ue),ht.current?.syncCursor(Co(Ue,Ue.length),bo(Ue,Ue.length))),st()},[$b,Y,$,st,Mt]),W1=n1({modelApi:ye.model,provider:Mn,instanceId:$t,...fe==="server"?{threadRef:ae}:{},...fe==="draft"&&Le?{draftId:Le}:{},model:bn,models:fo,modelOptions:Oe?.[$t],promptInjection:Sr,onPromptUpdate:Kb,planModeEnabled:$e.planModeEnabled}),Vb=o1({modelApi:ye.model,provider:Mn,instanceId:$t,...fe==="server"?{threadRef:ae}:{},...fe==="draft"&&Le?{draftId:Le}:{},model:bn,models:fo,modelOptions:Oe?.[$t],promptInjection:Sr,onPromptUpdate:Kb,planModeEnabled:$e.planModeEnabled}),ef=V(()=>l?{questionIndex:l.questionIndex,isLastQuestion:l.isLastQuestion,canAdvance:l.canAdvance,isResponding:c,isComplete:!!d}:null,[c,l,d]),G1=q==="running"||X||el||Jt||z||W!==null||!pt.hasSendableContent,j1=O("composer.sendMessage"),Pd=Tr&&!ro&&ef!==null,Q1=R(D=>{Pn(Y,D)},[Y,Pn]),X1=R(D=>{zt(Y,D)},[Y,zt]),Y1=R(D=>{ye.uploads.release(D),To(Y,D)},[ye.uploads,Y,To]);G(()=>{tn(null)},[kn,ge,tt,mn,bn,Qr,Mn]),he(()=>{ve.current=Ht},[Ht,ve]),he(()=>{at.current=mn},[mn,at]),he(()=>{Et.current=kn},[kn,Et]);let J1=R(()=>{if(!Tr)return;mo.current!==null&&(window.cancelAnimationFrame(mo.current),mo.current=null);let D=document.activeElement;D instanceof HTMLElement&&D.blur(),Ae(!1)},[Tr]),Z1=R(()=>!Tr||X||el||Jt||W!==null||q==="running"?!1:l?l.isLastQuestion&&!!d:Ut||pt.hasSendableContent,[l,d,pt.hasSendableContent,W,Tr,X,el,Jt,q,Ut]),{composerSubmissionError:eO,setComposerSubmissionError:tf,revalidatePromptLength:qb,submitComposer:Wb}=tD({promptRef:$,maxInputChars:xt.maxInputChars,noProviderAvailable:Jt,isSendDisabled:el,sendDisabledReason:Zr,isModelSendBlocked:Xu,onModelSendBlocked:()=>{Qu(!0)},activeThreadId:_,activePendingProgress:l,composerDocumentKey:tr,pendingImageCompressionsRef:Vi,onSend:_t,onProviderInputRejectedReset:()=>{th.current=!1},wasProviderInputRejected:()=>th.current,onStillCompressing:()=>{ye.notify.info(O("composer.stillCompressing"),O("composer.sendAgainThumbnail"))},shouldBlurMobileComposerOnSubmit:Z1,blurMobileComposerAfterSend:J1}),oh=N(!1),Gb=R(D=>{if(D?.preventDefault(),oi===null||oh.current)return;if(oi.unavailableReason!==null){tf(oi.unavailableReason);return}let Ie=$.current,Ue=A1(Ie),bt=E1(Ue);if(bt==="empty")return;if(bt==="multiline"){tf(O("composer.shellCommand.singleLine"));return}tf(null),oh.current=!0;let dn=Y;oi.run(Ue).then(cn=>{!cn||$.current!==Ie||($.current="",Mt(dn,""),ht.current?.syncCursor(0,null))}).finally(()=>{oh.current=!1})},[Y,oi,$,Mt,tf,O]),nf=R((D,Ie)=>{if(ll){Gb(D);return}Wb(D,Ie)},[Gb,ll,Wb]),jb=R(()=>{if(!ll)return!1;let D=$.current.slice(1);return $.current=D,Mt(Y,D),ht.current?.resetCursorState({prompt:D,cursor:D.length}),!0},[Y,$,Mt,ll]),tO=R(()=>{if(!(Z||Jt||pt.hasSendableContent||i!==null||s.length>0||q==="running"||X||!_)){if((Vi.current.get(tr)??0)>0){ye.notify.info(O("composer.stillCompressing"),O("composer.compactAgainThumbnail"));return}vt()}},[i,_,Z,tr,pt.hasSendableContent,X,Jt,vt,s.length,q]),of=R(()=>{mo.current!==null&&(window.cancelAnimationFrame(mo.current),mo.current=null),al.current!==null&&window.cancelAnimationFrame(al.current),il.current!==null&&window.cancelAnimationFrame(il.current),Ju.current=!0,Ae(!0),al.current=window.requestAnimationFrame(()=>{al.current=null,rl.current?.focusAtEnd(),il.current=window.requestAnimationFrame(()=>{il.current=null,Ju.current=!1})})},[]),rf=ye.stash.useStore,dl=rf(D=>D.entries),Qb=rf(D=>D.stashEntry),af=rf(D=>D.takeEntry),Xb=rf(D=>D.finalizeEntryImages);G(()=>()=>{sl.current!==null&&window.clearTimeout(sl.current)},[]);let Yb=R(()=>{zb.current+=1,Zg({key:zb.current,active:!0}),sl.current!==null&&window.clearTimeout(sl.current),sl.current=window.setTimeout(()=>{sl.current=null,Zg(D=>({...D,active:!1}))},1200)},[]),nO=R(D=>{let{entry:Ie,durable:Ue}=af(D.id);if(!Ie)return;Ue||ye.notify.warning(O("composer.stashReappear"),O("composer.storageRejectedKeep")),ni(!1);let bt=$.current,dn=D.prompt.length===0?bt:bt.trim().length?`${bt.replace(/\s+$/,"")}
|
|
3798
|
+
`)?e.slice(0,-1):e}function a8(e){return e.startsWith("diff --git")||e.includes(`
|
|
3799
|
+
diff --git`)}function _D(e,t){if(e.length===0)return[""];let n=`
|
|
3800
|
+
${t}`,o=e.startsWith(t)?0:PD(e,n,0);if(o===-1)return[e];let r=[];o>0&&r.push(e.slice(0,o));let a=o;for(;;){let i=PD(e,n,a+1);if(i===-1)break;r.push(e.slice(a,i)),a=i}return r.push(e.slice(a)),r}function PD(e,t,n){let o=e.indexOf(t,n);return o===-1?-1:o+1}function AD(e){return e==null?e:Mn(e)}function i8(e){return e===" "?"context":e==="\\"?"metadata":e==="+"?"addition":"deletion"}function pb(e){let t=e.slice(1);return Mn(t===""?`
|
|
3801
|
+
`: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 DD={light:"vscode-light-modern",dark:"vscode-dark-modern"};function FD(e){return e==="dark"?DD.dark:DD.light}var BD=2166136261,zD=16777619,s8=2654435769,l8=2246822507;function OD(e,t=BD,n=zD){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 d8(e,t="diff-panel"){let n=e.trim(),o=OD(n,BD,zD).toString(36),r=OD(n,s8,l8).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 UD(e,t="diff-panel",n={}){if(!e)return null;let o=e.trim();if(o.length===0)return null;try{let a=ED(o,d8(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 HD(e){let t=e.cacheKey;return t?t.endsWith(":hydrated")?t.slice(0,-9):t:`${e.prevName??"none"}:${e.name}`}function $D({fileChange:e,onOpenDiff:t}){let{t:n}=Ce(),[o,r]=J(!1),a=K(()=>gD(e),[e]),i=vD(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(sn,{className:"size-3 shrink-0"}):u(Vo,{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(c8,{path:e.path,unifiedDiff:a}):null]})}function c8({path:e,unifiedDiff:t}){let n=Wt().theme.useResolvedTheme(),o=K(()=>{let r=UD(t,`approval:${n}`,{compactPartialHunkOffsets:!0});return r?.kind==="files"?r.files.map(a=>({id:HD(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:FD(n),themeType:n,stickyHeaders:!1}})})}var u8="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",KD=pe(function({approval:t,pendingCount:n,onOpenDiff:o,className:r}){let{t:a}=Ce(),i=uD(t),{body:s}=i,l=hD(i.fileChanges);return b("div",{"aria-label":pD(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:fD(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":mD(s.shape,a),className:$(u8,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($D,{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(KD,{...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(`
|
|
3802
|
+
`)[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 f8(e){if(typeof e!="string")return null;let t=e.trim();return t.length>0?t:null}function Cb(e,t){let n=f8(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 p8(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 m8(e,t){return e.reduce((n,o)=>Cb(o,t[o.id])?n+1:n,0)}function VD(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=m8(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:p8(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(g8,{prompt:s,isResponding:n.includes(s.requestId),answers:o,questionIndex:r,onToggleOption:a,onAdvance:i},s.requestId):null}),g8=pe(function({prompt:t,isResponding:n,answers:o,questionIndex:r,onToggleOption:a,onAdvance:i}){let{t:s}=Ce(),l=Wt(),d=VD(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||fi(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(sn,{"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(cr,{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),k=L<9?L+1:null,E=$("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(Le,{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"}):k!==null?u("kbd",{className:$("flex size-5 shrink-0 items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums"),children:k}):null]});return u("button",{type:"button","aria-pressed":I,disabled:n,onClick:()=>{x(c.id,S)},className:E,children:P},`${c.id}:${S}`)})})]})})]})});ue();var WD=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 GD(e){if(e.occupant.kind!=="approval")return null;let{approval:t}=e.occupant;return u(sD,{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 QD={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:GD(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:GD(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(WD,{planTitle:iD(e.activeProposedPlan.planMarkdown)??null},e.activeProposedPlan.id),collapsed:null}};function XD(e,t){let n=QD[e.occupant.kind],o=t?n.collapsed:n.expanded;return o===null?null:o(e)}var Hhe=Object.keys(QD);ue();function YD(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 h8(e){return typeof e!="string"?null:e.trim()||null}function v8(e){return e.type==="select"?{...e,options:[...e.options],...e.promptInjectedValues?{promptInjectedValues:[...e.promptInjectedValues]}:{}}:{...e}}function y8(e,t){return e?.find(o=>o.id===t)?.value}function JD(e,t){let n=h8(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 x8(e,t){if(e.type==="boolean")return typeof t=="boolean"?{...e,currentValue:t}:e;let n=typeof t=="string"?JD(e,t):JD(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(v8).map(r=>x8(r,y8(n,r.id)??r.currentValue))}function tl(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=tl(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=tl(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 ZD(e,t){let n=e.trim();return!n||t!=="ultrathink"||/^\/[^\s/]+(?:\s|$)/u.test(n)||n.startsWith("Ultrathink:")?n:`Ultrathink:
|
|
3803
|
+
${n}`}ue();var C8=`Ultrathink:
|
|
3804
|
+
`;function b8(){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 e1(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=tl(e);return typeof t=="string"?t:null}function w8(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),T=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:T}}function Sb(e){let t=w8(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 k=c.threadRef??c.draftId;k&&m(k,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))},T=(I,k)=>{if(k){if(I.promptInjectedValues?.includes(k)){i(E=>E.trim().length===0?C8:ZD(E,"ultrathink"));return}w&&I.id===x?.id||(C&&I.id===x?.id&&i(E=>E.replace(/^Ultrathink:\s*/i,"")),S(e1(h,I.id,k)))}};return L?b(Le,{children:[v.map((I,k)=>{let E=C&&I.id===x?.id?"ultrathink":Gg(I)??"";return b("div",{children:[k>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(kr,{value:E,onValueChange:P=>T(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(b8,{})]}):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,k)=>{let E=I.currentValue===!0?"on":"off";return b("div",{children:[k>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(kr,{value:E,onValueChange:P=>{S(e1(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 S8(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")}):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 t1=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}=S8(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,T=t==="codex";return b(Eo,{open:m,onOpenChange:I=>{g(I)},children:[u(Mo,{render:u(Yo,{variant:c??"ghost",className:$(T?"min-w-0 max-w-40 shrink justify-start overflow-hidden whitespace-nowrap sm:max-w-48":"shrink-0 whitespace-nowrap",f)}),children:T?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(Tb,{provider:t,...n?{instanceId:n}:{},models:o,model:r,promptInjection:a,onPromptUpdate:i,modelOptions:s,allowPromptInjectedEffort:l,planModeEnabled:d,...p})})]})});function n1(e){return wb(e)?wb(e.replace(/^Ultrathink:\s*/i,""))?"ultrathink-in-body":"ultrathink":"none"}function o1(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=tl(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 r1(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 a1(e){return r1(Tb,e)}function i1(e){return r1(t1,e)}ue();var s1=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},l1=(e=>e?s1(e):s1);ue();var I8=e=>e;function T8(e,t=I8){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 d1=e=>{let t=l1(e),n=o=>T8(t,o);return Object.assign(n,t),n},c1=(e=>e?d1(e):d1);var kb=c1(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 u1(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__",f1=pe(function({environmentId:t,draftId:n,threadPresetId:o,compact:r}){let{t:a}=Ce(),i=Wt().presets.useThreadPresets(t),s=u1(n),l=kb(c=>c.setDraftPresetId);if(n===null){let f=Lb(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=Lb(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(kr,{value:s??Pb,onValueChange:c=>{l(n,c===Pb?null:c)},children:[u(Wo,{value:Pb,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 p1(e){let t=e.credentialIdentity;return[e.queryKey,t===null?"":t.id,t===null?"":String(t.revision)].join("\0")}function k8(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 m1(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 g1(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 h1(e,t){let n=[];for(let o of e){let r=g1(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 v1(e){return e.filter(t=>t.kind==="rate-limit"&&g1(t)===null).map(t=>({metricId:t.metricId,kind:t.kind,nativeLabel:t.nativeLabel,durationMs:t.windowMs,resetsAt:t.resetsAt}))}function y1(e){return e.snapshot===null||e.credentialIdentity===null?null:k8(e.snapshot,e)?e.snapshot:null}function x1(e){for(let t of e)if(t.resetsAt!==null)return t.resetsAt;return null}function C1(e){let t=null;for(let n of e)n.fetchedAt!==null&&(t===null||n.fetchedAt<t)&&(t=n.fetchedAt);return t}ue();function b1(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):E8(e.kind,t)}function L8(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 P8(e,t){let n=L8(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 A8(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:Id(e.resetsAt)})}`:n}function E8(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 R8(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 M8(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 N8(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 _8(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 D8(e,t,n){return e.capability.status==="unsupported"?N8(e.error,n):t.length>0?null:e.loading?n("accountUsage.loading"):e.error!==null?_8(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 w1(e){let[t,n]=J(!1);return u(O8,{...e,expanded:t,onToggleExpanded:()=>n(o=>!o)})}function O8(e){let{expanded:t,onToggleExpanded:n,onRefresh:o,...r}=e,{t:a}=Ce(),i=p1(r),{feedback:s,refreshing:l,refresh:d}=b1(i,o),c=r.capability.status==="supported"&&r.credentialIdentity!==null?y1(r):null,f=c?.metrics??[],p=h1(f,r.error),m=p.some(S=>S.stale)||r.error!==null&&c!==null,g=x1(p),h=C1(f),v=l,y=D8(r,p,a),x=m1(r),w=`${Jr()}-account-usage-details`,L=[...p.map(S=>({key:S.metricId,text:P8(S,a)})),...v1(f).map(S=>({key:`${S.metricId}\0status`,text:A8(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,T)=>b("span",{children:[T>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(F8,{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:M8(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 F8({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:R8(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:Id(e.fetchedAt)})}):null,e.resetsAt!==null?u("div",{children:n("accountUsage.resetsAt",{time:Id(e.resetsAt)})}):null,d!==null?u("div",{children:Mb(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 S1(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 I1(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 B8(e){return e===null||!Number.isFinite(e)?null:e<10?`${e.toFixed(1).replace(/\.0$/,"")}%`:`${Math.round(e)}%`}function T1(e){let{t}=Ce(),{usage:n,breakdown:o,modelDisplayName:r,onCompact:a,compactDisabled:i,compactDisabledReason:s}=e,l=B8(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:I1(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 k1=Ct(null),L1=k1.Provider;function ha(){let e=Ht(k1);if(e===null)throw new Error("Composer thread data has not been provided.");return e}var P1=Ct(null);function A1({children:e}){let{data:t,target:n,threadKey:o}=ha(),r=t.useComposerStatus({target:n,threadKey:o});return u(P1.Provider,{value:r,children:e})}function E1(){let e=Ht(P1);if(e===null)throw new Error("Composer status has not been provided.");return e}function R1(e){return e.startsWith("!")}function M1(e){return e.slice(1).trim()}function N1(e){return e.length===0?"empty":/[\r\n]/.test(e)?"multiline":null}function z8(){return null}function _1(){let{data:e,target:t,threadKey:n}=ha();return(e.useShellCommand??z8)({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 D1({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 O1(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 U8=['[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 H8(e){return e.closest(U8)!==null}var $8=[];function K8(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:n1(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 V8=e=>e.prompt.trim();function q8(e){let{t}=Ce(),n=e.api.draft.useThreadDraftSelector(e.composerDraftTarget,V8),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 W8=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(w1,{...a},a.queryKey)}),G8=pe(function(t){let{data:n,target:o}=ha(),r=n.useContextUsage(o);return r?.window==null?null:u(T1,{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(Le,{children:[u(G8,{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})]})}),F1=pe(function(t){let n=FT(),{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:T,providerStatuses:I,activeProjectDefaultModelSelection:k,projectId:E,activeThreadModelSelection:P}=o.useComposerModelContext(r),{activeThreadId:_,activeThread:A,isLocalDraftThread:F,projectSelectionRequired:B,phase:V,isSendBusy:Q,sendDisabledReason:Se,unavailableAgentInstanceId:H=null,noAgentChosen:q=!1,isPreparingWorktree:ee,environmentUnavailable:G,compactDisabled:te,compactDisabledReason:me}=E1(),{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=$8,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=$M({machineUnavailable:G!==null,sessionStarted:A?.session!=null,sessionDisconnected:V==="disconnected"}),Zt=KM(Bt),ke=t.api,{limits:Ut}=t.attachments,vt=ke.draft.useThreadDraftSelector(Y,D=>K8(D,ke.chat.deriveComposerSendState)),Nt=vt.images,Bn=K(()=>Nt.filter(D=>mv(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?ZT({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(()=>FM(ke.model.applyInstanceSettings(ke.model.deriveInstanceEntries(I),we)),[ke.model,I,we]),Ja=vt.activeProvider??null,nr=A?.session?.providerInstanceId??P?.instanceId??k?.instanceId??null,Cr=zM(Nn,Ja??nr)??ke.model.makeDriverKind("unconfigured"),br=T??Cr,or=K(()=>{if(!T||!A)return null;let D=A.session?.providerInstanceId??P?.instanceId;return D?Nn.find(Ie=>Ie.instanceId===D)?.continuationGroupKey??null:null},[A,P?.instanceId,T,Nn]),_t=K(()=>{if(H!==null)return H;let D=[vt.activeProvider,A?.session?.providerInstanceId,P?.instanceId,k?.instanceId];for(let Ie of D){if(!Ie)continue;let He=Nn.find(Ot=>Ot.instanceId===Ie&&BM(Ot));if(He){if(T&&He.driverKind!==T||or&&He.continuationGroupKey!==or)continue;return He.instanceId}}return ke.model.noProviderSelection.instanceId},[k?.instanceId,A?.session?.providerInstanceId,P?.instanceId,vt.activeProvider,or,T,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&&pC(Nn,{lockedProvider:T,lockedContinuationGroupKey:or}).length===0,zi=me??(Ee?U("composer.compactingUnavailable"):null),jn=Lo?.driverKind??br,{modelOptions:Fo,selectedModel:Qn,selectedModelStatus:rr}=ke.draft.useEffectiveModelState({threadRef:Y,providers:I,selectedProvider:jn,selectedInstanceId:_t,threadModelSelection:P,projectModelSelection:k,settings:we}),Bo=K(()=>Lo?.snapshot??null,[Lo]),wr=K(()=>Lo?.models??[],[Lo]),po=vt.promptInjection,zo=K(()=>o1({provider:jn,model:Qn,models:wr,promptInjectionState:po,modelOptions:Fo?.[_t],planModeEnabled:we.planModeEnabled},ke.model),[Fo,po,_t,Qn,jn,wr,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:A?.nativeModeId??null}),[ke.model,A?.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]);YD({threadId:A?.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&&T===null,An=ke.pluginComposer.useOptions(un?se:null,E),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,[Qg,Xu]=J(!1);W(()=>{Xu(!1)},[_t]);let Xg=Hg(rr),Yu=W_({status:rr,submissionTarget:l?"pending-user-input":"provider-turn"}),Td=Qg&&Yu?Xg:null,z=K(()=>S1(P,$e),[P,$e]),Pe=`${String(se)}\0${String(Y)}`,[st,Xt]=J(!1),[$o,Ca]=J(!1),[qi,Ju]=J(null),[$1,K1]=J(null),[Yg,ti]=J(!1),[kd,rl]=J(!1),[V1,Ob]=J(null),[al,Jg]=J({key:0,active:!1}),Fb=N(Pe);he(()=>{Fb.current!==Pe&&(Fb.current=Pe,Xt(!1),Ju(null),ti(!1),rl(!1),Ob(null),Jg({key:al.key,active:!1}))},[Pe,al.key]);let Sr=wp("max-sm"),ao=Sr&&!rt&&!$o,il=N(null),Bb=N(null),Zg=N(null),zb=N(null),eh=N(!1),go=N(null),sl=N(null),ll=N(null),Zu=N(!1),Ub=N(0),dl=N(null),th=N(new Set),Wi=N(new Map),q1=R(()=>{Xt(!0)},[]),W1=R(D=>{Me(D)},[Me]),G1=K(()=>new Set(xn),[xn]),Jn=i!==null,Hb=l?.activeQuestion?.allowFreeform===!1,ni=_1(),j1=ke.draft.useThreadDraftSelector(Y,D=>R1(D.prompt)),cl=ni!==null&&j1&&!Jn&&l===null,Ld=g[0]??null,{showTopDrawer:ef,showCollapsedPromptRow:Q1,hasBlocking:Pd}=zT(Ld?.kind??null,ao),X1=xe||l!==null,{isComposerFooterCompact:Gi,isComposerPrimaryActionsCompact:$b}=pk(Zg,X1),Kb=l!==null,Vb=R(D=>{let Ie=_e.current?.readDraftPrompt()??oe.current,He=D(Ie);if(He===Ie){mn();return}Kb?Qt(Y,He):(oe.current=He,Qt(Y,He),_e.current?.syncCursor(bo(He,He.length),wo(He,He.length))),mn()},[Kb,Y,oe,mn,Qt]),Y1=a1({modelApi:ke.model,provider:jn,instanceId:_t,...Ae==="server"?{threadRef:Xe}:{},...Ae==="draft"&&nt?{draftId:nt}:{},model:Qn,models:wr,modelOptions:Fo?.[_t],promptInjection:po,onPromptUpdate:Vb,planModeEnabled:we.planModeEnabled}),qb=i1({modelApi:ke.model,provider:jn,instanceId:_t,...Ae==="server"?{threadRef:Xe}:{},...Ae==="draft"&&nt?{draftId:nt}:{},model:Qn,models:wr,modelOptions:Fo?.[_t],promptInjection:po,onPromptUpdate:Vb,planModeEnabled:we.planModeEnabled}),tf=K(()=>l?{questionIndex:l.questionIndex,isLastQuestion:l.isLastQuestion,canAdvance:l.canAdvance,isResponding:c,isComplete:!!d}:null,[c,l,d]),J1=V==="running"||Q||ol||Ee||B||G!==null||!vt.hasSendableContent,Z1=U("composer.sendMessage"),Ad=Sr&&!ao&&tf!==null,eO=R(D=>{ko(Y,D)},[Y,ko]),tO=R(D=>{Do(Y,D)},[Y,Do]),nO=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 oO=R(()=>{if(!Sr)return;go.current!==null&&(window.cancelAnimationFrame(go.current),go.current=null);let D=document.activeElement;D instanceof HTMLElement&&D.blur(),Ca(!1)},[Sr]),rO=R(()=>!Sr||Q||ol||Ee||G!==null||V==="running"?!1:l?l.isLastQuestion&&!!d:xe||vt.hasSendableContent,[l,d,vt.hasSendableContent,G,Sr,Q,ol,Ee,V,xe]),{composerSubmissionError:aO,setComposerSubmissionError:nf,revalidatePromptLength:Wb,submitComposer:Gb}=rD({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:()=>{eh.current=!1},wasProviderInputRejected:()=>eh.current,onStillCompressing:()=>{ke.notify.info(U("composer.stillCompressing"),U("composer.sendAgainThumbnail"))},shouldBlurMobileComposerOnSubmit:rO,blurMobileComposerAfterSend:oO}),nh=N(!1),jb=R(D=>{if(D?.preventDefault(),ni===null||nh.current)return;if(ni.unavailableReason!==null){nf(ni.unavailableReason);return}let Ie=oe.current,He=M1(Ie),Ot=N1(He);if(Ot==="empty")return;if(Ot==="multiline"){nf(U("composer.shellCommand.singleLine"));return}nf(null),nh.current=!0;let wn=Y;ni.run(He).then(hn=>{!hn||oe.current!==Ie||(oe.current="",Qt(wn,""),_e.current?.syncCursor(0,null))}).finally(()=>{nh.current=!1})},[Y,ni,oe,Qt,nf,U]),of=R((D,Ie)=>{if(cl){jb(D);return}Gb(D,Ie)},[jb,cl,Gb]),Qb=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]),iO=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),Xb=af(D=>D.stashEntry),sf=af(D=>D.takeEntry),Yb=af(D=>D.finalizeEntryImages);W(()=>()=>{dl.current!==null&&window.clearTimeout(dl.current)},[]);let Jb=R(()=>{Ub.current+=1,Jg({key:Ub.current,active:!0}),dl.current!==null&&window.clearTimeout(dl.current),dl.current=window.setTimeout(()=>{dl.current=null,Jg(D=>({...D,active:!1}))},1200)},[]),sO=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+$/,"")}
|
|
3783
3805
|
|
|
3784
|
-
${D.prompt}`:D.prompt,cn=dn!==bt;cn&&($.current=dn,Mt(Y,dn),ht.current?.syncCursor(Co(dn,dn.length),null));let kr=[];if(D.attachments.length>0){let Ta=new Set(ve.current.map(ao=>ao.id)),Yn=new Set(ve.current.map(ao=>`${ao.mimeType}\0${ao.sizeBytes}\0${ao.name}`)),cl=Math.max(0,xt.maxAttachments-ve.current.length),ta=D.attachments.filter(ao=>!Ta.has(ao.id)&&!Yn.has(`${ao.mimeType}\0${ao.sizeBytes}\0${ao.name}`));kr=ta.slice(cl).map(ao=>ao.name);let na=ye.draft.hydrateImagesFromPersisted(ta.slice(0,cl));na.length>0&&zt(Y,na)}let xn=[];D.droppedImageNames.length>0&&xn.push(O("composer.stashImagesTooLarge",{names:D.droppedImageNames.join(", ")})),D.unreadableImageNames&&D.unreadableImageNames.length>0&&xn.push(O("composer.stashImagesUnreadable",{names:D.unreadableImageNames.join(", ")})),kr.length>0&&xn.push(O("composer.stashImagesOverLimit",{names:kr.join(", "),limit:xt.maxAttachments})),xn.length>0&&ye.notify.warning(O("composer.someImagesNotRestored"),xn.join(" ")),cn&&window.requestAnimationFrame(()=>{rl.current?.focusAtEnd()})},[zt,Y,ve,xt.maxAttachments,$,Mt,O,af]),oO=R(D=>{let{durable:Ie}=af(D.id);Ie||ye.notify.warning(O("composer.stashEntryMayReturn"),O("composer.storageRejectedDelete"))},[O,af]),rO=R(async()=>{let D=$.current.split("\uFFFC").join("").trim(),Ie=[...ve.current];if(D.length===0&&Ie.length===0){ni(cn=>!cn);return}let Ue=`${String(Y)}\0${D}\0${Ie.map(cn=>cn.id).join(",")}`;if(nh.current.has(Ue))return;nh.current.add(Ue);let bt=Y,dn=wu();try{let{evicted:cn,written:kr,durable:xn}=Qb({id:dn,createdAt:new Date().toISOString(),prompt:D,attachments:[],droppedImageNames:[],unreadableImageNames:[],pendingImageCount:Ie.length});if(!kr){ye.notify.error(O("composer.couldNotStash"),O("composer.storageRejectedWrite"));return}xn||ye.notify.warning(O("composer.stashNotSurvive"),O("composer.storageUnavailableMemory")),$.current="",jr(bt);for(let ul of Ie)ye.uploads.release(ul.id);ht.current?.syncCursor(0,null),Yb(),cn&&ye.notify.warning(O("composer.oldestStashDiscarded"),O("composer.oldestStashDiscardedDetail",{count:ye.stash.maxEntries}));let Ta=[],Yn=[],cl=[];for(let ul of Ie){let Ed=await ye.imageCompression.compressForStash(ul.file);if(!Ed.ok){(Ed.reason==="too-large"?Yn:cl).push(ul.name);continue}Ta.push({id:ul.id,name:ul.name,mimeType:Ed.image.mimeType,sizeBytes:Ed.image.sizeBytes,dataUrl:Ed.image.dataUrl})}let{kept:ta,droppedNames:na}=ye.stash.partitionAttachments(Ta),{attached:ao,durable:uf}=Xb(dn,{attachments:ta,droppedImageNames:[...Yn,...na],unreadableImageNames:cl});ao?!uf&&xn&&Ie.length>0&&ye.notify.warning(O("composer.stashImagesNotSaved"),O("composer.stashImagesMissingOnReload")):ta.length>0&&ye.notify.warning(O("composer.stashImagesDidNotAttach"),O("composer.stashImagesDidNotAttachDetail",{count:ta.length}))}finally{nh.current.delete(Ue)}},[jr,Y,ve,Xb,$,Yb,Qb,O]),rh=R(()=>{ni(D=>!D)},[]),aO=R(()=>{if(ro){of(),ni(!0);return}rh()},[of,ro,rh]),ah=R(()=>{nl(D=>!D)},[]),Ad=A?.latestTurn?.turnId??null,Jb=Ad!==null&&z1===Ad,ea=Jb?null:Ft,Ia=Jb?null:Pt,ih=R(()=>{Ad!==null&&Db(Ad),nl(!1)},[Ad]),sf=dl.length>0&&!Xn&&(n||Zu||Td||ro)?u(Cv,{count:dl.length,menuOpen:Sa,placement:"inline",pulseKey:ol.key,pulsing:ol.active,onToggleMenu:aO}):null,lf=ea!==null&&Ia!==null&&!Td&&!Ld&&(n||Zu||ro)?u(bv,{expanded:!1,onDismiss:ih,onToggle:ah,placement:"inline",progress:ea,steps:Ia}):null,sh=!n&&!Zu&&!Td&&!ro,iO=sh&&(dl.length>0||ea!==null&&Ia!==null&&ea.totalSteps>0);G(()=>{(ea===null||Ia===null)&&nl(!1)},[Ia,ea]),G(()=>{Ld&&nl(!1)},[Ld]),G(()=>{nl(!1)},[_]);let sO=R(()=>{ni(!1)},[]),lO=R(D=>{tn(null),qb(D),ni(!1)},[qb]);ye.pane.useKeydown(D=>{if(ye.keybindings.resolveShortcutCommand(D,te,{context:{terminalFocus:ye.terminalFocus.getOwner()!==null,terminalOpen:Pe,modelPickerOpen:Yu}})==="composer.stash"&&(D.preventDefault(),D.stopPropagation(),!ye.commandPalette.isOpen())){if(s.length>0&&!Xn){ni(Ue=>!Ue);return}Xn||z||l!==null||rO()}},{capture:!0});let df=async D=>{if(!_||D.length===0)return;if(s.length>0){ye.notify.error(O("attachments.answerQuestionsFirst"));return}let Ie=_,Ue=tr,bt=Vi.current.get(Ue)??0,dn=ve.current.length+bt,cn=[],kr=null;for(let xn of D){if(dn>=xt.maxAttachments){kr=O("attachments.limitReached",{count:xt.maxAttachments});break}if(xn.size<=0){kr=O("attachments.empty",{name:xn.name});continue}cn.push(xn),dn+=1}if(ln(Ie,kr),cn.length!==0){Vi.current.set(Ue,bt+cn.length);try{let xn=[],Ta=null;for(let Yn of cn){if(!(ye.imageCompression.isHeicFile(Yn)||mv(Yn.type))){let uf=le?xt.maxFileBytes:xt.maxImageBytes;if(Yn.size>uf){Ta=O("attachments.tooLarge",{name:Yn.name,limit:hv(uf)});continue}xn.push({...vv({id:wu(),name:Yn.name||O("attachments.defaultFileName"),mimeType:Yn.type||"application/octet-stream",sizeBytes:Yn.size}),previewUrl:URL.createObjectURL(Yn),file:Yn});continue}let ta=await ye.imageCompression.prepareForAttachment(Yn,xt.maxImageBytes);if(!ta.ok){Ta=ta.reason==="unreadable"?O("attachments.unreadableImage",{name:Yn.name}):O("attachments.imageTooLarge",{name:Yn.name});continue}let na=ta.file,ao=URL.createObjectURL(na);xn.push({...vv({id:wu(),name:na.name||O("attachments.defaultImageName"),mimeType:na.type,sizeBytes:na.size}),previewUrl:ao,file:na})}xn.length===1&&xn[0]?Q1(xn[0]):xn.length>1&&X1(xn),Ta!==null&&ln(Ie,Ta)}finally{let xn=(Vi.current.get(Ue)??0)-cn.length;xn>0?Vi.current.set(Ue,xn):Vi.current.delete(Ue)}}},dO=D=>{Y1(D)},cO=D=>{let Ie=Array.from(D.target.files??[]);D.target.value="",Ie.length!==0&&df(Ie)},Zb=D=>{let Ie=Array.from(D.clipboardData.files);Ie.length!==0&&(D.preventDefault(),df(Ie))},ew=(D,Ie)=>{if(D.length===0||Xn||s.length>0||z)return!1;let Ue=$.current,bt=(Ie?.ensureLeadingBoundary??!1)&&Ue.length>0&&!/\s$/.test(Ue);return ht.current?.applyPromptReplacement(Ue.length,Ue.length,bt?` ${D}`:D)??!1},{isDragOverComposer:uO,composerMentionDragHandlers:lh,onComposerMentionDragLeaveCapture:fO}=Z_({documentKey:tr,insertMentionAtEnd:D=>ew(D,{ensureLeadingBoundary:!0}),onInsertRejected:()=>{ye.notify.error(O("composer.unableToAddToChat"),O("composer.composerBusy"))}}),dh=R(()=>{an()},[an]),ch=R(()=>{Sn()},[Sn]),pO=R(()=>{Tr&&(Ju.current||(mo.current!==null&&window.cancelAnimationFrame(mo.current),mo.current=window.requestAnimationFrame(()=>{if(mo.current=null,Ju.current)return;let D=Bb.current,Ie=eh.current,Ue=document.activeElement;Ue instanceof Element&&_8(Ue)||Ue instanceof Node&&(D&&D.contains(Ue)||Ie&&Ie.contains(Ue))||Ae(!1)})))},[Tr]);G(()=>()=>{mo.current!==null&&window.cancelAnimationFrame(mo.current),al.current!==null&&window.cancelAnimationFrame(al.current),il.current!==null&&window.cancelAnimationFrame(il.current)},[]);let uh=R(()=>ht.current?.readSnapshot()??{value:$.current,cursor:Co($.current,$.current.length),expandedCursor:$.current.length,terminalContextIds:at.current.map(D=>D.id)},[at,$]),cf=N({onComposerPaste:Zb,submitComposer:nf,exitShellCommandMode:jb});cf.current={onComposerPaste:Zb,submitComposer:nf,exitShellCommandMode:jb};let mO=R(D=>{cf.current.onComposerPaste(D)},[]),gO=R((D,Ie)=>{cf.current.submitComposer(D,Ie)},[]),hO=R(()=>cf.current.exitShellCommandMode(),[]),fh=()=>({prompt:$.current,images:ve.current,terminalContexts:at.current,elementContexts:Et.current,previewAnnotations:ge,reviewComments:tt,selectedPromptEffort:Qr,selectedModelOptionsForDispatch:wa,selectedModelSelection:Jr,...Yr?{selectedNativeModeId:Yr}:{},providerAvailable:!Jt,selectedProvider:Mn,selectedModel:bn,selectedModelStatus:br,selectedProviderModels:fo,selectedPluginAction:en});Rt.current=fh,nr(oe,()=>({focusAtEnd:()=>{rl.current?.focusAtEnd()},focusAt:Ie=>{rl.current?.focusAt(Ie)},addDroppedFiles:Ie=>{df(Ie),Re()},insertTextAtEnd:ew,toggleModelPicker:()=>{Ki(Ie=>!Ie)},cyclePermissionMode:Ie=>{if(Do===null){ce(N1(L,Ie));return}let{modes:Ue,current:bt}=Do;if(!Xr||Ue.length<2)return;let dn=Ue.findIndex(kr=>kr.id===bt.id),cn=Ue[(dn+Ie+Ue.length)%Ue.length];cn!==void 0&&Yo(cn.id)},readSnapshot:uh,resetCursorState:Ie=>{ht.current?.resetCursorState(Ie)},addTerminalContext:Ie=>{if(!A)return;let Ue=uh(),bt=ye.terminalContext.insertInlinePlaceholder(Ue.value,Ue.expandedCursor),dn=Co(bt.prompt,bt.cursor);hr(Y,bt.prompt,{id:wu(),threadId:A.id,createdAt:new Date().toISOString(),...Ie},bt.contextIndex)&&($.current=bt.prompt,ht.current?.syncCursor(dn,bo(bt.prompt,bt.cursor)),window.requestAnimationFrame(()=>{rl.current?.focusAt(dn)}))},readSendIdentity:()=>({pluginActionId:en?.id??null,prompt:$.current}),getSendContext:fh,validateProviderInput:Ie=>{let Ue=po??lb({prompt:$.current,providerInput:Ie,submissionTarget:"provider-turn",maxInputChars:xt.maxInputChars,t:O});return th.current=Ue!==null,tn(Ue),Ue===null}}),[A,df,Y,hr,$,ve,at,Et,ge,tt,Re,Xn,s.length,z,uh,bn,wa,Jr,Yr,Jt,Qr,Mn,fo,en,po,fh,Rt,xt.maxInputChars,Do,Xr,Yo,ce,L,O]);let vO=Xn?i?.detail??O("composer.resolveApprovalToContinue"):O(l?"composer.typeOwnAnswer":Ut&&kt?"composer.addFeedbackRefinePlan":z?"composer.chooseProjectToStart":Jt?"composer.enableProviderToSend":yt??"composer.askAnythingFull");return b("form",{ref:eh,onSubmit:nf,onFocusCapture:D=>{let Ie=D.target;ro&&Ie instanceof HTMLElement&&Ie.closest('[data-chat-composer-collapsed-controls="true"]')||(mo.current!==null&&(window.cancelAnimationFrame(mo.current),mo.current=null),Ae(!0))},onBlurCapture:()=>{pO()},onDragEnterCapture:lh.onDragEnter,onDragOverCapture:lh.onDragOver,onDragLeaveCapture:fO,onDropCapture:lh.onDrop,className:H("mx-auto w-full min-w-0 max-w-3xl",iO&&"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:GD({occupant:kd,respondingRequestIds:m,keybindings:te,onRespondToApproval:Ve,onRespondToDecision:qe,activePendingDraftAnswers:f,activePendingQuestionIndex:p,onSelectActivePendingUserInputOption:we,onAdvanceActivePendingUserInput:We,activeProposedPlan:kt,collapsedPendingRow:u(nD,{activePendingProgress:l,isPendingUserInputChoiceOnly:Ub,expandMobileComposer:of,inlineTasksBadge:lf,inlineStashBadge:sf,pendingPrimaryAction:ef,isSendBusy:X,sendDisabledReason:Zr,isEnvironmentUnavailable:W!==null||Jt||z,onPreviousActivePendingUserInputQuestion:w,handleInterruptPrimaryAction:dh,handleImplementPlanInNewThreadPrimaryAction:ch})},ro)}):null,Td&&!Ld&&ea&&Ia?u(XT,{onDismiss:ih,onCollapse:ah,progress:ea,steps:Ia}):null,b("div",{className:"relative",children:[sh&&ea&&Ia?u(bv,{expanded:!1,hasTrailingShoulder:dl.length>0,onDismiss:ih,onToggle:ah,progress:ea,steps:Ia}):null,sh?u(Cv,{count:dl.length,menuOpen:Sa,pulseKey:ol.key,pulsing:ol.active,onToggleMenu:rh}):null,u("div",{"data-chat-composer-main-surface":"true",className:H("group relative z-10 rounded-[22px] p-px transition-colors duration-200",_o.composerFrameClassName),children:b("div",{ref:Bb,"data-chat-composer-surface":"true","data-chat-composer-mobile-collapsed":ro?"true":"false",className:H("rounded-[20px] transition-[background-color] duration-200",uO?"bg-accent/45 ring-1 ring-primary/70":null,z?"opacity-75":null,_o.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(z8,{hidden:Xn}),V1?b("div",{className:"flex items-center justify-between gap-2 px-3 py-2",children:[u(B8,{api:ye,composerDraftTarget:Y,pendingCustomAnswer:l?l.customAnswer:null,noProviderAvailable:Jt,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:G1,"aria-label":j1,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:tl,className:H("relative px-3 pb-2 sm:px-4","pt-3.5 sm:pt-4",Xn&&"pb-3 sm:pb-4",ro&&"hidden"),children:[!ro&&!Xn&&s.length===0&&ge.length>0&&u(lk,{annotations:ge,images:Ht,...le?{uploadsByImageId:lt,onRetryUpload:D=>ye.uploads.retry({environmentId:re,image:D})}:{},onRemove:D=>{ye.uploads.release(D),Ui(Y,D)},onExpandImage:D=>{let Ie=Nb(Tn,D);Ie&&vn(Ie)},className:"mb-3"}),!ro&&!Xn&&s.length===0&&tt.length>0&&u(sk,{comments:tt,onRemove:D=>ze(Y,D),className:"mb-3"}),!ro&&!Xn&&s.length===0&&kn.length>0&&u(ik,{contexts:kn,onRemove:D=>ei(Y,D),className:"mb-3"}),!ro&&!Xn&&s.length===0&&Ht.some(D=>!ge.some(Ie=>Ie.id===D.id))&&u("div",{className:"mb-3 flex flex-wrap gap-2",children:Ht.filter(D=>!ge.some(Ie=>Ie.id===D.id)).map(D=>{let Ie=le?lt[D.id]:void 0,Ue=gv(D),bt=JT(Ue),dn=Ue==="image"&&!!D.previewUrl;return b("div",{className:H("relative h-16 overflow-hidden rounded-lg border border-border/80 bg-background",dn?"w-16":"w-44 max-w-full"),children:[dn?u("button",{type:"button",className:"h-full w-full cursor-zoom-in","aria-label":O("attachments.preview",{name:D.name}),onClick:()=>{let cn=Nb(Tn,D.id);cn&&vn(cn)},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":O("attachments.open",{name:D.name}),children:[u(bt,{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)})]})]}),$1.has(D.id)&&b(Ye,{children:[u(Ze,{render:u("span",{role:"img","aria-label":O("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(Bn,{className:"size-3"})})}),u(Je,{side:"top",className:"max-w-64 whitespace-normal leading-tight",children:O("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:kp(Ie.progress)}),Ie?.status==="failed"&&b(Ye,{children:[u(Ze,{render:u(de,{variant:"ghost",size:"icon-xs",className:"absolute bottom-1 left-1 bg-background/85 hover:bg-background/90",onClick:()=>ye.uploads.retry({environmentId:re,image:D}),"aria-label":O("attachments.retryUpload",{name:D.name})}),children:u(as,{})}),u(Je,{side:"top",className:"max-w-64 whitespace-normal leading-tight",children:Tp(Ie,O)})]}),u(de,{variant:"ghost",size:"icon-xs",className:"absolute right-1 top-1 bg-background/80 hover:bg-background/90",onClick:()=>dO(D.id),"aria-label":O("attachments.remove",{name:D.name}),children:u(nn,{})})]},D.id)})}),ll?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(Uo,{"aria-hidden":"true",className:"size-3.5 shrink-0 text-primary"}),u("span",{className:"shrink-0 font-medium text-primary",children:O("composer.shellCommand.mode")}),u("span",{className:"min-w-0 truncate text-muted-foreground",children:oi?.unavailableReason??O("composer.shellCommand.hint")})]}):null,b("div",{className:"relative",children:[u(RM,{handleRef:ht,api:ye,composerDraftTarget:Y,composerDocumentKey:tr,promptRef:$,editorRef:rl,menuAnchor:Fo,resolvedTheme:rt,selectedProvider:Mn,selectedProviderStatus:wr,planModeUiEnabled:ko,showSkillsInSlashMenu:$e.showSkillsInSlashMenu,recentSlashCommandIds:Wt,environmentId:re,gitCwd:Q,onSlashCommandUsed:Ot,onOpenModelPicker:U1,onInteractionModeChange:H1,onToggleInteractionMode:F,activePendingProgress:l,activePendingRequestId:s[0]?.requestId??null,hasPendingUserInputs:s.length>0,changeUserInputCustomAnswer:x,terminalContexts:mn,showTerminalContexts:!Xn&&s.length===0,showEditor:!Ub,isApprovalState:Xn,editorClassName:Pd?"max-sm:pb-11":void 0,placeholder:vO,disabled:Xn||z,onPaste:mO,onSubmit:gO,isMobileViewport:Tr,isDraftRoute:fe==="draft",stashMenuOpen:Sa,stashEntries:dl,onRestoreStashEntry:nO,onDeleteStashEntry:oO,onCloseStashMenu:sO,onPromptEdited:lO,onUnclaimedEscape:hO}),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:X,sendDisabledReason:Zr,isEnvironmentUnavailable:W!==null||Jt||z,isPreparingWorktree:!1,hasSendableContent:!1,preserveComposerFocusOnPointerDown:!0,onPreviousPendingQuestion:w,onInterrupt:dh,interruptArmed:mt,onImplementPlanInNewThread:ch})]}):null]})]}),u(M1,{message:it??eO}),po===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:po}),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":br,children:[O(Id.blockKey),Id.canChooseModel?u(de,{type:"button",size:"sm",variant:"ghost",className:"h-6 px-2 text-xs","data-chat-composer-choose-model":"true",onClick:()=>{Ki(!0)},children:O("modelPicker.chooseModel")}):null]}),ro||Xn?null:b("div",{"data-chat-composer-footer":"true","data-chat-composer-footer-compact":qi?"true":"false",className:H("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:Fb,type:"file",multiple:!0,className:"hidden",tabIndex:-1,"aria-hidden":"true",onChange:cO}),b(Ye,{children:[u(Ze,{render:u(de,{type:"button",variant:"ghost",size:"icon-sm","data-chat-composer-attach":"true",className:"shrink-0",disabled:z||s.length>0,"aria-label":O("attachments.add"),onClick:()=>Fb.current?.click()}),children:u(ho,{})}),u(Je,{side:"top",children:O("attachments.add")})]}),Jt?b(de,{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(Bn,{className:"size-4"}),O("composer.noProviderAvailable")]}):b(Te,{children:[u(Wu,{name:"conversation.input.agent",...Ge===void 0?{}:{slots:Ge},owner:{activeInstanceId:$t,instanceEntries:yn,lockedProvider:T,compact:qi,onInstanceChange:Ir},fallback:u(pC,{activeInstanceId:$t,instanceEntries:yn,lockedProvider:T,compact:qi,onInstanceChange:Ir})}),u(V_,{...Ge===void 0?{}:{slots:Ge},compact:qi,hideInstanceRail:!0,showInstanceOnTrigger:!1,activeInstanceId:$t,model:Oo,modelStatus:br,lockedProvider:T,lockedContinuationGroupKey:oo,instanceEntries:yn,keybindings:te,modelOptionsByInstance:Zo,terminalOpen:Pe,open:Yu,..._o.modelPickerIconClassName?{activeProviderIconClassName:_o.modelPickerIconClassName}:{},onOpenChange:D=>{Ki(D)},getModelDisabledReason:En,getModelContinuationLabel:sn,onContinueInModel:Rn,onInstanceModelChange:ft,...ti?{pluginActions:Ke,selectedPluginActionKey:en?.id??null,onSelectPluginAction:Xt,onManagePlugins:In}:{}})]}),Nn?null:b(Te,{children:[u(d1,{environmentId:re,draftId:fe==="draft"?Le:null,threadPresetId:A?.presetId??null,compact:qi}),qi?u(X_,{interactionMode:S,runtimeMode:L,runtimeModeSwitch:Lo.runtimeModeSwitch,nativeMode:Do,canSwitchNativeMode:Xr,showInteractionModeToggle:Lo.showInteractionModeToggle,traitsMenuContent:W1,onToggleInteractionMode:F,onRuntimeModeChange:ce,onNativeModeChange:Yo}):b(Te,{children:[Vb?u(Wu,{name:"conversation.input.effort",...Ge===void 0?{}:{slots:Ge},fallback:Vb}):null,Do===null&&Lo.showInteractionModeToggle?u(Wu,{name:"conversation.input.plan",...Ge===void 0?{}:{slots:Ge},owner:{interactionMode:S,showInteractionModeToggle:Lo.showInteractionModeToggle,onToggleInteractionMode:F},fallback:u(rb,{interactionMode:S,showInteractionModeToggle:Lo.showInteractionModeToggle,onToggleInteractionMode:F})}):null,u(Wu,{name:"conversation.input.permission",...Ge===void 0?{}:{slots:Ge},owner:{runtimeMode:L,runtimeModeSwitch:Lo.runtimeModeSwitch,nativeMode:Do,canSwitchNativeMode:Xr,onRuntimeModeChange:ce,onNativeModeChange:Yo},fallback:u(ab,{runtimeMode:L,runtimeModeSwitch:Lo.runtimeModeSwitch,nativeMode:Do,canSwitchNativeMode:Xr,onRuntimeModeChange:ce,onNativeModeChange:Yo})})]})]})]}),b("div",{"data-chat-composer-actions":"right","data-chat-composer-primary-actions-compact":Hb?"true":"false",className:"flex shrink-0 flex-nowrap items-center justify-end gap-2",children:[Pd?null:lf,Pd?null:sf,u(H8,{compact:Hb,activeThreadModelDisplayName:Jg,pendingAction:ef,isRunning:q==="running",showPlanFollowUpPrompt:s.length===0&&Ut,promptHasText:pt.promptHasText,isSendBusy:X,sendDisabledReason:Zr,isEnvironmentUnavailable:W!==null||Jt||z,isPreparingWorktree:K,hasSendableContent:pt.hasSendableContent,preserveComposerFocusOnPointerDown:Tr,showSendWhileRunning:Tr,onPreviousPendingQuestion:w,onInterrupt:dh,interruptArmed:mt,onImplementPlanInNewThread:ch,shellCommandMode:ll,shellCommandUnavailableReason:oi?.unavailableReason??null,compactDisabled:Z||Jt||X,compactDisabledReason:Cr,onCompactContext:tO})]})]})]})})]})]})});function D1(e){let{composerRef:t,...n}=e,o=n;return u(ak,{value:o.api,children:u(_1,{...o,composerRef:t})})}function ju({section:e,resetKey:t,children:n}){return u(Pl,{resetKey:t,fallback:o=>$8(e,o),children:n})}function $8(e,t){return u(K8,{section:e,error:t})}function K8({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(Bn,{"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 O1({hostVersion:e,scopeClass:t}){let{t:n}=ut();return b("div",{role:"status","data-conversation-host-data-mismatch":!0,className:H("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(Bn,{"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 F1(e){let{data:t}=e;return t?.version!==14?u(O1,{hostVersion:t?.version??null,scopeClass:e.scopeClass}):u(bf.Provider,{value:e.scope.active,children:u(W8,{...e,data:t})})}var V8=me(function({threadKey:t,onModeChange:n}){let[o]=fn("turn-navigator",t,null),r=R(a=>{n("chat"),o?.onSelect(a)},[n,o]);return o===null?null:u(xS,{...o,placement:"inline",onSelect:r})});function q8({slots:e,children:t}){let{data:n,target:o,threadKey:r}=ba(),a=n.useComposerPending({target:o,threadKey:r});return e?.renderSlotChain("conversation.composer",{occupants:a.occupants},t)??t}function W8(e){let{scope:t,mode:n,timeline:o,trajectory:r,composer:a,data:i}=e,[,s]=fn("turn-navigator",t.threadKey,null),l=a.draftHero.active,d=a.sessionActions,c=a.terminalControl,f=a.agentsControl,{mode:p,onModeChange:m}=n,g=V(()=>l?b(Te,{children:[d,u("div",{className:"min-w-0 flex-1"}),c]}):b(Te,{children:[d,u(gS,{mode:p,onModeChange:m}),u("div",{className:"min-w-0 flex-1"}),c,f,u(V8,{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,T=u(D1,{...S,attachments:e.attachments,firstRow:g}),I=V(()=>({environmentId:t.environmentId,threadId:t.threadId}),[t.environmentId,t.threadId]),[k,E]=fn("trajectory-reveal",t.threadKey,null),P=R(Se=>{n.onModeChange("chat"),E(K=>({rowId:Se,nonce:(K?.nonce??0)+1}))},[n,E]),_=R(()=>E(null),[E]),A=V(()=>({data:i,target:I,threadKey:t.threadKey}),[i,I,t.threadKey]),{controlRef:B,...z}=o,q=i.useChatWindow({target:I,threadKey:t.threadKey,visible:t.visible&&n.mode==="chat"}),X=i0({inputKey:t.threadKey,visible:t.visible,endInset:o.contentInsetEndAdjustment,derive:e.derive,onReturnToLatest:q.onReturnToLatest,controlRef:B});return b("div",{className:H("relative flex min-h-0 min-w-0 flex-1 flex-col",e.scopeClass),"data-conversation-surface":!0,children:[u(hS,{chat:b(ju,{section:"chat",resetKey:t.threadKey,children:[u(JI,{data:i,target:I,visible:t.visible,...z,paneActive:t.active,liveFollowEnabled:X.liveFollowEnabled,scrollerRef:X.bindTimelineHandle,onRowsChange:X.onRowsChange,onIsAtEndChange:X.onIsAtEndChange,onManualNavigation:X.onManualNavigation,onDisclosureNavigation:X.onDisclosureNavigation,loadEarlier:q.loadEarlier,loadLater:q.loadLater,pagingBlockedByInteraction:q.pagingBlockedByInteraction,onVisibleTurnRangeChange:q.onVisibleTurnRangeChange,onReturnToLatest:q.loadLater===null?null:X.returnToEnd,onTurnNavigatorChange:s,revealMessageRequest:k,onRevealMessageHandled:_}),u(n0,{data:i,target:I,bottomInset:o.contentInsetEndAdjustment,showScrollToEnd:X.showScrollToEnd,onScrollToEnd:X.returnToEnd})]},"chat"),mode:n.mode,trajectory:u(ju,{section:"trajectory",resetKey:t.threadKey,children:u(u0,{data:i,target:I,inputKey:t.threadKey,paneVisible:t.visible&&n.mode==="trajectory",timestampFormat:r.timestampFormat,onOpenInChat:P})},"trajectory"),visible:t.visible}),u(OT,{data:i,target:I,threadKey:t.threadKey,belowSlot:a.belowSlot,composer:u(ju,{section:"composer",resetKey:t.threadKey,children:u(I1,{value:A,children:u(k1,{children:u(q8,{slots:a.slots,children:T})})})}),draftHero:a.draftHero,onOverlayElementChange:a.onOverlayElementChange,queue:u(ju,{section:"queue",resetKey:t.threadKey,children:u(PT,{data:i,target:I,inputKey:t.threadKey,attachments:e.attachments})})})]})}var G8=".ycodium-conversation-ui";function j8(){let e=globalThis,t=(e.__ycodiumConversationScope??0)+1;return e.__ycodiumConversationScope=t,`ycodium-conversation-ui-${t}`}function B1(e,t="conversation"){let n=j8(),o=e.replaceAll(G8,`.${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 Q8(e){let t=B1(ow);return{views:{[vh]:X8(t,e)},viewCapabilities:{[vh]:[cw,dw]},slots:[{name:"conversation.input.agent",order:0,component:BM},{name:"conversation.input.model",order:0,component:q_},{name:"conversation.input.plan",order:0,component:W_},{name:"conversation.input.permission",order:0,component:Q_}]}}function X8(e,t){return function(o){let a=o[yh]??t,i={...o};return delete i[yh],b(iw,{value:a,children:[u(Y8,{retain:e.retain}),u(lw,{value:e.scopeClass,children:u(F1,{...i,scopeClass:e.scopeClass})})]})}}function Y8({retain:e}){return Md(()=>e(),[e]),null}export{Q8 as default};
|
|
3806
|
+
${D.prompt}`:D.prompt,hn=wn!==Ot;hn&&(oe.current=wn,Qt(Y,wn),_e.current?.syncCursor(bo(wn,wn.length),null));let Ir=[];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}`));Ir=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(", ")})),Ir.length>0&&vn.push(U("composer.stashImagesOverLimit",{names:Ir.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]),lO=R(D=>{let{durable:Ie}=sf(D.id);Ie||ke.notify.warning(U("composer.stashEntryMayReturn"),U("composer.storageRejectedDelete"))},[U,sf]),dO=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(th.current.has(He))return;th.current.add(He);let Ot=Y,wn=Su();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="",tr(Ot);for(let pl of Ie)ke.uploads.release(pl.id);_e.current?.syncCursor(0,null),Jb(),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}=Yb(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{th.current.delete(He)}},[tr,Y,pt,Yb,oe,Jb,Xb,U]),oh=R(()=>{ti(D=>!D)},[]),cO=R(()=>{if(ao){rf(),ti(!0);return}oh()},[rf,ao,oh]),rh=R(()=>{rl(D=>!D)},[]),Ed=A?.latestTurn?.turnId??null,Zb=Ed!==null&&V1===Ed,Qr=Zb?null:an,ba=Zb?null:Jt,ah=R(()=>{Ed!==null&&Ob(Ed),rl(!1)},[Ed]),lf=ul.length>0&&!Jn&&(n||ef||kd||ao)?u(xv,{count:ul.length,menuOpen:Yg,placement:"inline",pulseKey:al.key,pulsing:al.active,onToggleMenu:cO}):null,df=Qr!==null&&ba!==null&&!kd&&!Pd&&(n||ef||ao)?u(Cv,{expanded:!1,onDismiss:ah,onToggle:rh,placement:"inline",progress:Qr,steps:ba}):null,ih=!n&&!ef&&!kd&&!ao,uO=ih&&(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 fO=R(()=>{ti(!1)},[]),pO=R(D=>{Ju(null),Wb(D),ti(!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){ti(He=>!He);return}Jn||B||l!==null||dO()}},{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=[],Ir=null;for(let vn of D){if(wn>=Ut.maxAttachments){Ir=U("attachments.limitReached",{count:Ut.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){Wi.current.set(He,Ot+hn.length);try{let vn=[],wa=null;for(let Zn of hn){if(!(ke.imageCompression.isHeicFile(Zn)||pv(Zn.type))){let ff=ie?Ut.maxFileBytes:Ut.maxImageBytes;if(Zn.size>ff){wa=U("attachments.tooLarge",{name:Zn.name,limit:gv(ff)});continue}vn.push({...hv({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({...hv({id:Su(),name:Yr.name||U("attachments.defaultImageName"),mimeType:Yr.type,sizeBytes:Yr.size}),previewUrl:io,file:Yr})}vn.length===1&&vn[0]?eO(vn[0]):vn.length>1&&tO(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)}}},mO=D=>{nO(D)},gO=D=>{let Ie=Array.from(D.target.files??[]);D.target.value="",Ie.length!==0&&cf(Ie)},ew=D=>{let Ie=Array.from(D.clipboardData.files);Ie.length!==0&&(D.preventDefault(),cf(Ie))},tw=(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:hO,composerMentionDragHandlers:sh,onComposerMentionDragLeaveCapture:vO}=nD({documentKey:Pe,insertMentionAtEnd:D=>tw(D,{ensureLeadingBoundary:!0}),onInsertRejected:()=>{ke.notify.error(U("composer.unableToAddToChat"),U("composer.composerBusy"))}}),lh=R(()=>{zt()},[zt]),dh=R(()=>{dn()},[dn]),yO=R(()=>{Sr&&(Zu.current||(go.current!==null&&window.cancelAnimationFrame(go.current),go.current=window.requestAnimationFrame(()=>{if(go.current=null,Zu.current)return;let D=zb.current,Ie=Zg.current,He=document.activeElement;He instanceof Element&&H8(He)||He instanceof Node&&(D&&D.contains(He)||Ie&&Ie.contains(He))||Ca(!1)})))},[Sr]);W(()=>()=>{go.current!==null&&window.cancelAnimationFrame(go.current),sl.current!==null&&window.cancelAnimationFrame(sl.current),ll.current!==null&&window.cancelAnimationFrame(ll.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]),uf=N({onComposerPaste:ew,submitComposer:of,exitShellCommandMode:Qb});uf.current={onComposerPaste:ew,submitComposer:of,exitShellCommandMode:Qb};let xO=R(D=>{uf.current.onComposerPaste(D)},[]),CO=R((D,Ie)=>{uf.current.submitComposer(D,Ie)},[]),bO=R(()=>uf.current.exitShellCommandMode(),[]),uh=()=>({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:wr,selectedPluginAction:$i});on.current=uh,ir(ft,()=>({focusAtEnd:()=>{il.current?.focusAtEnd()},focusAt:Ie=>{il.current?.focusAt(Ie)},addDroppedFiles:Ie=>{cf(Ie),Ln()},insertTextAtEnd:tw,toggleModelPicker:()=>{Xt(Ie=>!Ie)},cyclePermissionMode:Ie=>{if(Xn===null){Te(O1(L,Ie));return}let{modes:He,current:Ot}=Xn;if(!Uo||He.length<2)return;let wn=He.findIndex(Ir=>Ir.id===Ot.id),hn=He[(wn+Ie+He.length)%He.length];hn!==void 0&&ar(hn.id)},readSnapshot:ch,resetCursorState:Ie=>{_e.current?.resetCursorState(Ie)},addTerminalContext:Ie=>{if(!A)return;let He=ch(),Ot=ke.terminalContext.insertInlinePlaceholder(He.value,He.expandedCursor),wn=bo(Ot.prompt,Ot.cursor);Ya(Y,Ot.prompt,{id:Su(),threadId:A.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:uh,validateProviderInput:Ie=>{let He=Ki??db({prompt:oe.current,providerInput:Ie,submissionTarget:"provider-turn",maxInputChars:Ut.maxInputChars,t:U});return eh.current=He!==null,Ju(He),He===null}}),[A,cf,Y,Ya,oe,pt,yt,Lt,lt,it,Ln,Jn,s.length,B,ch,Qn,Pn,Yn,jr,Ee,Ui,jn,wr,$i,Ki,uh,on,Ut.maxInputChars,Xn,Uo,ar,Te,L,U]);let wO=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:Zg,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:()=>{yO()},onDragEnterCapture:sh.onDragEnter,onDragOverCapture:sh.onDragOver,onDragLeaveCapture:vO,onDropCapture:sh.onDrop,className:$("mx-auto w-full min-w-0 max-w-3xl",uO&&"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:XD({occupant:Ld,respondingRequestIds:m,keybindings:j,onRespondToApproval:We,onRespondToDecision:ot,activePendingDraftAnswers:f,activePendingQuestionIndex:p,onSelectActivePendingUserInputOption:qe,onAdvanceActivePendingUserInput:xt,activeProposedPlan:St,collapsedPendingRow:u(aD,{activePendingProgress:l,isPendingUserInputChoiceOnly:Hb,expandMobileComposer:rf,inlineTasksBadge:df,inlineStashBadge:lf,pendingPrimaryAction:tf,isSendBusy:Q,sendDisabledReason:Vi,isEnvironmentUnavailable:G!==null||Ee||B,onPreviousActivePendingUserInputQuestion:w,handleInterruptPrimaryAction:lh,handleImplementPlanInNewThreadPrimaryAction:dh})},ao)}):null,kd&&!Pd&&Qr&&ba?u(JT,{onDismiss:ah,onCollapse:rh,progress:Qr,steps:ba}):null,b("div",{className:"relative",children:[ih&&Qr&&ba?u(Cv,{expanded:!1,hasTrailingShoulder:ul.length>0,onDismiss:ah,onToggle:rh,progress:Qr,steps:ba}):null,ih?u(xv,{count:ul.length,menuOpen:Yg,pulseKey:al.key,pulsing:al.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",hO?"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(W8,{hidden:Jn}),Q1?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: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:J1,"aria-label":Z1,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:K1,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(ck,{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=_b(Bn,D);Ie&&Pt(Ie)},className:"mb-3"}),!ao&&!Jn&&s.length===0&&it.length>0&&u(dk,{comments:it,onRemove:D=>Wr(Y,D),className:"mb-3"}),!ao&&!Jn&&s.length===0&&et.length>0&&u(lk,{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=mv(D),Ot=ek(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&&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:gv(D.sizeBytes)})]})]}),G1.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(ss,{})}),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:()=>mO(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(NM,{handleRef:_e,api:ke,composerDraftTarget:Y,composerDocumentKey:Pe,promptRef:oe,editorRef:il,menuAnchor:$1,resolvedTheme:ne,selectedProvider:jn,selectedProviderStatus:Bo,planModeUiEnabled:ei,showSkillsInSlashMenu:we.showSkillsInSlashMenu,recentSlashCommandIds:wt,environmentId:se,gitCwd:ae,onSlashCommandUsed:In,onOpenModelPicker:q1,onInteractionModeChange:W1,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:Ad?"max-sm:pb-11":void 0,placeholder:wO,disabled:Jn||B,onPaste:xO,onSubmit:CO,isMobileViewport:Sr,isDraftRoute:Ae==="draft",stashMenuOpen:Yg,stashEntries:ul,onRestoreStashEntry:sO,onDeleteStashEntry:lO,onCloseStashMenu:fO,onPromptEdited:pO,onUnclaimedEscape:bO}),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:lh,interruptArmed:Mt,onImplementPlanInNewThread:dh})]}):null]})]}),u(D1,{message:qi??aO}),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:Bb,type:"file",multiple:!0,className:"hidden",tabIndex:-1,"aria-hidden":"true",onChange:gO}),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(Le,{children:[u(Gu,{name:"conversation.input.agent",...Ve===void 0?{}:{slots:Ve},owner:{activeInstanceId:_t,unavailableInstanceId:H,notChosen:q,instanceEntries:Nn,lockedProvider:T,lockedContinuationGroupKey:or,compact:Gi,onInstanceChange:Hi},fallback:u(mC,{activeInstanceId:_t,unavailableInstanceId:H,notChosen:q,instanceEntries:Nn,lockedProvider:T,lockedContinuationGroupKey:or,compact:Gi,onInstanceChange:Hi})}),Gn||q?null:u(G_,{...Ve===void 0?{}:{slots:Ve},compact:Gi,hideInstanceRail:!0,showInstanceOnTrigger:!1,activeInstanceId:_t,model:Dt,modelStatus:rr,lockedProvider:T,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(f1,{environmentId:se,draftId:Ae==="draft"?nt:null,threadPresetId:A?.presetId??null,compact:Gi}),Gi?u(Z_,{interactionMode:S,runtimeMode:L,runtimeModeSwitch:Po.runtimeModeSwitch,nativeMode:Xn,canSwitchNativeMode:Uo,showInteractionModeToggle:Po.showInteractionModeToggle,traitsMenuContent:Y1,onToggleInteractionMode:ye,onRuntimeModeChange:Te,onNativeModeChange:ar}):b(Le,{children:[qb?u(Gu,{name:"conversation.input.effort",...Ve===void 0?{}:{slots:Ve},fallback:qb}):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(ab,{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(ib,{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":$b?"true":"false",className:"flex shrink-0 flex-nowrap items-center justify-end gap-2",children:[Ad?null:df,Ad?null:lf,u(j8,{compact:$b,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:Sr,showSendWhileRunning:Sr,onPreviousPendingQuestion:w,onInterrupt:lh,interruptArmed:Mt,onImplementPlanInNewThread:dh,shellCommandMode:cl,shellCommandUnavailableReason:ni?.unavailableReason??null,compactDisabled:te||Ee||Q,compactDisabledReason:zi,onCompactContext:iO})]})]})]})})]})]})});function B1(e){let{composerRef:t,...n}=e,o=n;return u(sk,{value:o.api,children:u(F1,{...o,composerRef:t})})}function Qu({section:e,resetKey:t,children:n}){return u(El,{resetKey:t,fallback:o=>Q8(e,o),children:n})}function Q8(e,t){return u(X8,{section:e,error:t})}function X8({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 z1({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 U1(e){let{data:t}=e;return t?.version!==14?u(z1,{hostVersion:t?.version??null,scopeClass:e.scopeClass}):u(wf.Provider,{value:e.scope.active,children:u(Z8,{...e,data:t})})}var Y8=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(CS,{...o,placement:"inline",onSelect:r})});function J8({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 Z8(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(hS,{mode:p,onModeChange:m}),u("div",{className:"min-w-0 flex-1"}),c,f,u(Y8,{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,T=u(B1,{...S,attachments:e.attachments,firstRow:g}),I=K(()=>({environmentId:t.environmentId,threadId:t.threadId}),[t.environmentId,t.threadId]),[k,E]=ln("trajectory-reveal",t.threadKey,null),P=R(Se=>{n.onModeChange("chat"),E(H=>({rowId:Se,nonce:(H?.nonce??0)+1}))},[n,E]),_=R(()=>E(null),[E]),A=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=l0({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(Qu,{section:"chat",resetKey:t.threadKey,children:[u(e0,{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:k,onRevealMessageHandled:_}),u(r0,{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(p0,{data:i,target:I,inputKey:t.threadKey,paneVisible:t.visible&&n.mode==="trajectory",timestampFormat:r.timestampFormat,onOpenInChat:P})},"trajectory"),visible:t.visible}),u(BT,{data:i,target:I,threadKey:t.threadKey,belowSlot:a.belowSlot,composer:u(Qu,{section:"composer",resetKey:t.threadKey,children:u(L1,{value:A,children:u(A1,{children:u(J8,{slots:a.slots,children:T})})})}),draftHero:a.draftHero,onOverlayElementChange:a.onOverlayElementChange,queue:u(Qu,{section:"queue",resetKey:t.threadKey,children:u(ET,{data:i,target:I,inputKey:t.threadKey,attachments:e.attachments})})})]})}var e7=".ycodium-conversation-ui";function t7(){let e=globalThis,t=(e.__ycodiumConversationScope??0)+1;return e.__ycodiumConversationScope=t,`ycodium-conversation-ui-${t}`}function H1(e,t="conversation"){let n=t7(),o=e.replaceAll(e7,`.${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 n7(e){let t=H1(rw);return{views:{[hh]:o7(t,e)},viewCapabilities:{[hh]:[uw,cw]},slots:[{name:"conversation.input.agent",order:0,component:HM},{name:"conversation.input.model",order:0,component:j_},{name:"conversation.input.plan",order:0,component:Q_},{name:"conversation.input.permission",order:0,component:J_}]}}function o7(e,t){return function(o){let a=o[vh]??t,i={...o};return delete i[vh],b(sw,{value:a,children:[u(r7,{retain:e.retain}),u(dw,{value:e.scopeClass,children:u(U1,{...i,scopeClass:e.scopeClass})})]})}}function r7({retain:e}){return Nd(()=>e(),[e]),null}export{n7 as default};
|