@ycodium-ai/plugin-conversation 0.2.5177 → 0.2.5220

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 CHANGED
@@ -1,4 +1,4 @@
1
- var IO=Object.create;var Cu=Object.defineProperty;var SO=Object.getOwnPropertyDescriptor;var kO=Object.getOwnPropertyNames;var LO=Object.getPrototypeOf,PO=Object.prototype.hasOwnProperty;var Sx=(e,t,o)=>()=>{if(o)throw o[0];try{return e&&(t=e(e=0)),t}catch(n){throw o=[n],n}};var kx=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(o){throw t=0,o}},Ut=(e,t)=>{for(var o in t)Cu(e,o,{get:t[o],enumerable:!0})},Lx=(e,t,o,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of kO(t))!PO.call(e,r)&&r!==o&&Cu(e,r,{get:()=>t[r],enumerable:!(n=SO(t,r))||n.enumerable});return e};var Px=(e,t,o)=>(o=e!=null?IO(LO(e)):{},Lx(t||!e||!e.__esModule?Cu(o,"default",{value:e,enumerable:!0}):o,e)),RO=e=>Lx(Cu({},"__esModule",{value:!0}),e);var Ax={};Ut(Ax,{Activity:()=>MO,Children:()=>AO,Component:()=>ur,Fragment:()=>Aa,Profiler:()=>NO,PureComponent:()=>DO,StrictMode:()=>_O,Suspense:()=>Cg,__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE:()=>OO,__COMPILER_RUNTIME:()=>FO,act:()=>BO,cache:()=>HO,cacheSignal:()=>UO,captureOwnerStack:()=>$O,cloneElement:()=>Mx,createContext:()=>qe,createElement:()=>vn,createRef:()=>zO,default:()=>Zt,forwardRef:()=>zn,isValidElement:()=>KO,lazy:()=>qO,memo:()=>pe,startTransition:()=>WO,unstable_useCacheRefresh:()=>GO,use:()=>xe,useActionState:()=>jO,useCallback:()=>R,useContext:()=>Pt,useDebugValue:()=>VO,useDeferredValue:()=>QO,useEffect:()=>H,useEffectEvent:()=>xg,useId:()=>ho,useImperativeHandle:()=>pr,useInsertionEffect:()=>El,useLayoutEffect:()=>fe,useMemo:()=>W,useOptimistic:()=>XO,useReducer:()=>Na,useRef:()=>E,useState:()=>q,useSyncExternalStore:()=>Go,useTransition:()=>YO,version:()=>JO});var Ex,Zt,MO,AO,ur,Aa,NO,DO,_O,Cg,OO,FO,BO,HO,UO,$O,Mx,qe,vn,zO,zn,KO,qO,pe,WO,GO,xe,jO,R,Pt,VO,QO,H,xg,ho,pr,El,fe,W,XO,Na,E,q,Go,YO,JO,$=Sx(()=>{Ex=window.__ycodiumPluginHost.react,Zt=Ex,{Activity:MO,Children:AO,Component:ur,Fragment:Aa,Profiler:NO,PureComponent:DO,StrictMode:_O,Suspense:Cg,__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE:OO,__COMPILER_RUNTIME:FO,act:BO,cache:HO,cacheSignal:UO,captureOwnerStack:$O,cloneElement:Mx,createContext:qe,createElement:vn,createRef:zO,forwardRef:zn,isValidElement:KO,lazy:qO,memo:pe,startTransition:WO,unstable_useCacheRefresh:GO,use:xe,useActionState:jO,useCallback:R,useContext:Pt,useDebugValue:VO,useDeferredValue:QO,useEffect:H,useEffectEvent:xg,useId:ho,useImperativeHandle:pr,useInsertionEffect:El,useLayoutEffect:fe,useMemo:W,useOptimistic:XO,useReducer:Na,useRef:E,useState:q,useSyncExternalStore:Go,useTransition:YO,version:JO}=Ex});var ZS=kx(Io=>{"use strict";var y$=($(),RO(Ax));function JS(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var o=2;o<arguments.length;o++)t+="&args[]="+encodeURIComponent(arguments[o])}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 oa(){}var To={d:{f:oa,r:function(){throw Error(JS(522))},D:oa,C:oa,L:oa,m:oa,X:oa,S:oa,M:oa},p:0,findDOMNode:null},v$=Symbol.for("react.portal");function C$(e,t,o){var n=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:v$,key:n==null?null:""+n,children:e,containerInfo:t,implementation:o}}var $d=y$.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function Dp(e,t){if(e==="font")return"";if(typeof t=="string")return t==="use-credentials"?t:""}Io.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=To;Io.createPortal=function(e,t){var o=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(JS(299));return C$(e,t,null,o)};Io.flushSync=function(e){var t=$d.T,o=To.p;try{if($d.T=null,To.p=2,e)return e()}finally{$d.T=t,To.p=o,To.d.f()}};Io.preconnect=function(e,t){typeof e=="string"&&(t?(t=t.crossOrigin,t=typeof t=="string"?t==="use-credentials"?t:"":void 0):t=null,To.d.C(e,t))};Io.prefetchDNS=function(e){typeof e=="string"&&To.d.D(e)};Io.preinit=function(e,t){if(typeof e=="string"&&t&&typeof t.as=="string"){var o=t.as,n=Dp(o,t.crossOrigin),r=typeof t.integrity=="string"?t.integrity:void 0,a=typeof t.fetchPriority=="string"?t.fetchPriority:void 0;o==="style"?To.d.S(e,typeof t.precedence=="string"?t.precedence:void 0,{crossOrigin:n,integrity:r,fetchPriority:a}):o==="script"&&To.d.X(e,{crossOrigin:n,integrity:r,fetchPriority:a,nonce:typeof t.nonce=="string"?t.nonce:void 0})}};Io.preinitModule=function(e,t){if(typeof e=="string")if(typeof t=="object"&&t!==null){if(t.as==null||t.as==="script"){var o=Dp(t.as,t.crossOrigin);To.d.M(e,{crossOrigin:o,integrity:typeof t.integrity=="string"?t.integrity:void 0,nonce:typeof t.nonce=="string"?t.nonce:void 0})}}else t==null&&To.d.M(e)};Io.preload=function(e,t){if(typeof e=="string"&&typeof t=="object"&&t!==null&&typeof t.as=="string"){var o=t.as,n=Dp(o,t.crossOrigin);To.d.L(e,o,{crossOrigin:n,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})}};Io.preloadModule=function(e,t){if(typeof e=="string")if(t){var o=Dp(t.as,t.crossOrigin);To.d.m(e,{as:typeof t.as=="string"&&t.as!=="script"?t.as:void 0,crossOrigin:o,integrity:typeof t.integrity=="string"?t.integrity:void 0})}else To.d.m(e)};Io.requestFormReset=function(e){To.d.r(e)};Io.unstable_batchedUpdates=function(e,t){return e(t)};Io.useFormState=function(e,t,o){return $d.H.useFormState(e,t,o)};Io.useFormStatus=function(){return $d.H.useHostTransitionStatus()};Io.version="19.2.6"});var yh=kx((Mle,tk)=>{"use strict";function ek(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(ek)}catch(e){console.error(e)}}ek(),tk.exports=ZS()});var Uke,S_,ex,k_,L_,DG,$ke,zke,Kke,P_=Sx(()=>{Uke=(()=>{try{return!1}catch{return!1}})(),S_=/(?=^From [a-f0-9]+ .+$)/m,ex=/(?=^diff --git)/gm,k_=/^(---|\+\+\+)\s+([^\t\r\n]+)/,L_=/^index ([0-9a-f]+)\.\.([0-9a-f]+)(?: (\d+))?$/i,DG={hunkLineCount:50,lineHeight:20,diffHeaderHeight:44,spacing:8},$ke={...DG,hunkLineCount:1},zke=Object.freeze({fromStart:0,fromEnd:0}),Kke=Object.freeze([])});var Rx=`/*! tailwindcss v4.3.0 | MIT License | https://tailwindcss.com */
1
+ var kO=Object.create;var Cu=Object.defineProperty;var LO=Object.getOwnPropertyDescriptor;var PO=Object.getOwnPropertyNames;var RO=Object.getPrototypeOf,EO=Object.prototype.hasOwnProperty;var Sx=(e,t,o)=>()=>{if(o)throw o[0];try{return e&&(t=e(e=0)),t}catch(n){throw o=[n],n}};var kx=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(o){throw t=0,o}},Ut=(e,t)=>{for(var o in t)Cu(e,o,{get:t[o],enumerable:!0})},Lx=(e,t,o,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of PO(t))!EO.call(e,r)&&r!==o&&Cu(e,r,{get:()=>t[r],enumerable:!(n=LO(t,r))||n.enumerable});return e};var Px=(e,t,o)=>(o=e!=null?kO(RO(e)):{},Lx(t||!e||!e.__esModule?Cu(o,"default",{value:e,enumerable:!0}):o,e)),MO=e=>Lx(Cu({},"__esModule",{value:!0}),e);var Ax={};Ut(Ax,{Activity:()=>NO,Children:()=>DO,Component:()=>ur,Fragment:()=>Aa,Profiler:()=>_O,PureComponent:()=>OO,StrictMode:()=>FO,Suspense:()=>Cg,__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE:()=>BO,__COMPILER_RUNTIME:()=>HO,act:()=>UO,cache:()=>$O,cacheSignal:()=>zO,captureOwnerStack:()=>KO,cloneElement:()=>Mx,createContext:()=>qe,createElement:()=>yn,createRef:()=>qO,default:()=>Zt,forwardRef:()=>zn,isValidElement:()=>WO,lazy:()=>GO,memo:()=>pe,startTransition:()=>jO,unstable_useCacheRefresh:()=>VO,use:()=>xe,useActionState:()=>QO,useCallback:()=>R,useContext:()=>Pt,useDebugValue:()=>XO,useDeferredValue:()=>YO,useEffect:()=>H,useEffectEvent:()=>xg,useId:()=>ho,useImperativeHandle:()=>pr,useInsertionEffect:()=>El,useLayoutEffect:()=>fe,useMemo:()=>W,useOptimistic:()=>JO,useReducer:()=>Na,useRef:()=>E,useState:()=>q,useSyncExternalStore:()=>Go,useTransition:()=>ZO,version:()=>eF});var Ex,Zt,NO,DO,ur,Aa,_O,OO,FO,Cg,BO,HO,UO,$O,zO,KO,Mx,qe,yn,qO,zn,WO,GO,pe,jO,VO,xe,QO,R,Pt,XO,YO,H,xg,ho,pr,El,fe,W,JO,Na,E,q,Go,ZO,eF,$=Sx(()=>{Ex=window.__ycodiumPluginHost.react,Zt=Ex,{Activity:NO,Children:DO,Component:ur,Fragment:Aa,Profiler:_O,PureComponent:OO,StrictMode:FO,Suspense:Cg,__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE:BO,__COMPILER_RUNTIME:HO,act:UO,cache:$O,cacheSignal:zO,captureOwnerStack:KO,cloneElement:Mx,createContext:qe,createElement:yn,createRef:qO,forwardRef:zn,isValidElement:WO,lazy:GO,memo:pe,startTransition:jO,unstable_useCacheRefresh:VO,use:xe,useActionState:QO,useCallback:R,useContext:Pt,useDebugValue:XO,useDeferredValue:YO,useEffect:H,useEffectEvent:xg,useId:ho,useImperativeHandle:pr,useInsertionEffect:El,useLayoutEffect:fe,useMemo:W,useOptimistic:JO,useReducer:Na,useRef:E,useState:q,useSyncExternalStore:Go,useTransition:ZO,version:eF}=Ex});var tk=kx(Io=>{"use strict";var x$=($(),MO(Ax));function ek(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var o=2;o<arguments.length;o++)t+="&args[]="+encodeURIComponent(arguments[o])}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 oa(){}var To={d:{f:oa,r:function(){throw Error(ek(522))},D:oa,C:oa,L:oa,m:oa,X:oa,S:oa,M:oa},p:0,findDOMNode:null},b$=Symbol.for("react.portal");function w$(e,t,o){var n=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:b$,key:n==null?null:""+n,children:e,containerInfo:t,implementation:o}}var $d=x$.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function Dp(e,t){if(e==="font")return"";if(typeof t=="string")return t==="use-credentials"?t:""}Io.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=To;Io.createPortal=function(e,t){var o=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(ek(299));return w$(e,t,null,o)};Io.flushSync=function(e){var t=$d.T,o=To.p;try{if($d.T=null,To.p=2,e)return e()}finally{$d.T=t,To.p=o,To.d.f()}};Io.preconnect=function(e,t){typeof e=="string"&&(t?(t=t.crossOrigin,t=typeof t=="string"?t==="use-credentials"?t:"":void 0):t=null,To.d.C(e,t))};Io.prefetchDNS=function(e){typeof e=="string"&&To.d.D(e)};Io.preinit=function(e,t){if(typeof e=="string"&&t&&typeof t.as=="string"){var o=t.as,n=Dp(o,t.crossOrigin),r=typeof t.integrity=="string"?t.integrity:void 0,a=typeof t.fetchPriority=="string"?t.fetchPriority:void 0;o==="style"?To.d.S(e,typeof t.precedence=="string"?t.precedence:void 0,{crossOrigin:n,integrity:r,fetchPriority:a}):o==="script"&&To.d.X(e,{crossOrigin:n,integrity:r,fetchPriority:a,nonce:typeof t.nonce=="string"?t.nonce:void 0})}};Io.preinitModule=function(e,t){if(typeof e=="string")if(typeof t=="object"&&t!==null){if(t.as==null||t.as==="script"){var o=Dp(t.as,t.crossOrigin);To.d.M(e,{crossOrigin:o,integrity:typeof t.integrity=="string"?t.integrity:void 0,nonce:typeof t.nonce=="string"?t.nonce:void 0})}}else t==null&&To.d.M(e)};Io.preload=function(e,t){if(typeof e=="string"&&typeof t=="object"&&t!==null&&typeof t.as=="string"){var o=t.as,n=Dp(o,t.crossOrigin);To.d.L(e,o,{crossOrigin:n,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})}};Io.preloadModule=function(e,t){if(typeof e=="string")if(t){var o=Dp(t.as,t.crossOrigin);To.d.m(e,{as:typeof t.as=="string"&&t.as!=="script"?t.as:void 0,crossOrigin:o,integrity:typeof t.integrity=="string"?t.integrity:void 0})}else To.d.m(e)};Io.requestFormReset=function(e){To.d.r(e)};Io.unstable_batchedUpdates=function(e,t){return e(t)};Io.useFormState=function(e,t,o){return $d.H.useFormState(e,t,o)};Io.useFormStatus=function(){return $d.H.useHostTransitionStatus()};Io.version="19.2.6"});var yh=kx((Dle,nk)=>{"use strict";function ok(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(ok)}catch(e){console.error(e)}}ok(),nk.exports=tk()});var Kke,L_,ex,P_,R_,FG,qke,Wke,Gke,E_=Sx(()=>{Kke=(()=>{try{return!1}catch{return!1}})(),L_=/(?=^From [a-f0-9]+ .+$)/m,ex=/(?=^diff --git)/gm,P_=/^(---|\+\+\+)\s+([^\t\r\n]+)/,R_=/^index ([0-9a-f]+)\.\.([0-9a-f]+)(?: (\d+))?$/i,FG={hunkLineCount:50,lineHeight:20,diffHeaderHeight:44,spacing:8},qke={...FG,hunkLineCount:1},Wke=Object.freeze({fromStart:0,fromEnd:0}),Gke=Object.freeze([])});var Rx=`/*! tailwindcss v4.3.0 | MIT License | https://tailwindcss.com */
2
2
  @layer properties, theme, base, components, utilities;
3
3
  @layer properties;
4
4
  :root, :host {
@@ -3514,84 +3514,84 @@ var IO=Object.create;var Cu=Object.defineProperty;var SO=Object.getOwnPropertyDe
3514
3514
  }
3515
3515
  }
3516
3516
  }
3517
- `;$();$();var Nx=qe(null),Bs=Nx.Provider,Dx=qe(""),xu=Dx.Provider;function bu(){return Pt(Dx)}function Nt(){let e=Pt(Nx);if(e===null)throw new Error("Conversation UI has not been registered.");return e}var wu="ycodium:assistant-quote-open",Hs="ycodium:thread-reference-open";var Tu="conversation",bg="conversation.prompt-preview";var Iu="__ycodiumConversationBridge",wg="ycodium.conversation.rebindable-bridge.v1",Tg="conversation.pendingRequests";var Ml=18,_x=`ycodium.conversation.host-data.v${Ml}`,Ox=80,mr="\uFFFC";$();function Fx(e){var t,o,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var r=e.length;for(t=0;t<r;t++)e[t]&&(o=Fx(e[t]))&&(n&&(n+=" "),n+=o)}else for(o in e)e[o]&&(n&&(n+=" "),n+=o);return n}function Bx(){for(var e,t,o=0,n="",r=arguments.length;o<r;o++)(e=arguments[o])&&(t=Fx(e))&&(n&&(n+=" "),n+=t);return n}var Hx=Bx;var ZO=(e,t)=>{let o=new Array(e.length+t.length);for(let n=0;n<e.length;n++)o[n]=e[n];for(let n=0;n<t.length;n++)o[e.length+n]=t[n];return o},eF=(e,t)=>({classGroupId:e,validator:t}),jx=(e=new Map,t=null,o)=>({nextPart:e,validators:t,classGroupId:o});var Ux=[],tF="arbitrary..",oF=e=>{let t=rF(e),{conflictingClassGroups:o,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:s=>{if(s.startsWith("[")&&s.endsWith("]"))return nF(s);let i=s.split("-"),d=i[0]===""&&i.length>1?1:0;return Vx(i,d,t)},getConflictingClassGroupIds:(s,i)=>{if(i){let d=n[s],c=o[s];return d?c?ZO(c,d):d:c||Ux}return o[s]||Ux}}},Vx=(e,t,o)=>{if(e.length-t===0)return o.classGroupId;let r=e[t],a=o.nextPart.get(r);if(a){let c=Vx(e,t+1,a);if(c)return c}let s=o.validators;if(s===null)return;let i=t===0?e.join("-"):e.slice(t).join("-"),d=s.length;for(let c=0;c<d;c++){let u=s[c];if(u.validator(i))return u.classGroupId}},nF=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{let t=e.slice(1,-1),o=t.indexOf(":"),n=t.slice(0,o);return n?tF+n:void 0})(),rF=e=>{let{theme:t,classGroups:o}=e;return aF(o,t)},aF=(e,t)=>{let o=jx();for(let n in e){let r=e[n];kg(r,o,n,t)}return o},kg=(e,t,o,n)=>{let r=e.length;for(let a=0;a<r;a++){let s=e[a];sF(s,t,o,n)}},sF=(e,t,o,n)=>{if(typeof e=="string"){iF(e,t,o);return}if(typeof e=="function"){lF(e,t,o,n);return}dF(e,t,o,n)},iF=(e,t,o)=>{let n=e===""?t:Qx(t,e);n.classGroupId=o},lF=(e,t,o,n)=>{if(cF(e)){kg(e(n),t,o,n);return}t.validators===null&&(t.validators=[]),t.validators.push(eF(o,e))},dF=(e,t,o,n)=>{let r=Object.entries(e),a=r.length;for(let s=0;s<a;s++){let[i,d]=r[s];kg(d,Qx(t,i),o,n)}},Qx=(e,t)=>{let o=e,n=t.split("-"),r=n.length;for(let a=0;a<r;a++){let s=n[a],i=o.nextPart.get(s);i||(i=jx(),o.nextPart.set(s,i)),o=i}return o},cF=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,uF=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,o=Object.create(null),n=Object.create(null),r=(a,s)=>{o[a]=s,t++,t>e&&(t=0,n=o,o=Object.create(null))};return{get(a){let s=o[a];if(s!==void 0)return s;if((s=n[a])!==void 0)return r(a,s),s},set(a,s){a in o?o[a]=s:r(a,s)}}};var pF=[],$x=(e,t,o,n,r)=>({modifiers:e,hasImportantModifier:t,baseClassName:o,maybePostfixModifierPosition:n,isExternal:r}),mF=e=>{let{prefix:t,experimentalParseClassName:o}=e,n=r=>{let a=[],s=0,i=0,d=0,c,u=r.length;for(let h=0;h<u;h++){let y=r[h];if(s===0&&i===0){if(y===":"){a.push(r.slice(d,h)),d=h+1;continue}if(y==="/"){c=h;continue}}y==="["?s++:y==="]"?s--:y==="("?i++:y===")"&&i--}let m=a.length===0?r:r.slice(d),p=m,f=!1;m.endsWith("!")?(p=m.slice(0,-1),f=!0):m.startsWith("!")&&(p=m.slice(1),f=!0);let g=c&&c>d?c-d:void 0;return $x(a,f,p,g)};if(t){let r=t+":",a=n;n=s=>s.startsWith(r)?a(s.slice(r.length)):$x(pF,!1,s,void 0,!0)}if(o){let r=n;n=a=>o({className:a,parseClassName:r})}return n},fF=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((o,n)=>{t.set(o,1e6+n)}),o=>{let n=[],r=[];for(let a=0;a<o.length;a++){let s=o[a],i=s[0]==="[",d=t.has(s);i||d?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(s)):r.push(s)}return r.length>0&&(r.sort(),n.push(...r)),n}},gF=e=>({cache:uF(e.cacheSize),parseClassName:mF(e),sortModifiers:fF(e),postfixLookupClassGroupIds:hF(e),...oF(e)}),hF=e=>{let t=Object.create(null),o=e.postfixLookupClassGroups;if(o)for(let n=0;n<o.length;n++)t[o[n]]=!0;return t},yF=/\s+/,vF=(e,t)=>{let{parseClassName:o,getClassGroupId:n,getConflictingClassGroupIds:r,sortModifiers:a,postfixLookupClassGroupIds:s}=t,i=[],d=e.trim().split(yF),c="";for(let u=d.length-1;u>=0;u-=1){let m=d[u],{isExternal:p,modifiers:f,hasImportantModifier:g,baseClassName:h,maybePostfixModifierPosition:y}=o(m);if(p){c=m+(c.length>0?" "+c:c);continue}let x=!!y,C;if(x){let I=h.substring(0,y);C=n(I);let T=C&&s[C]?n(h):void 0;T&&T!==C&&(C=T,x=!1)}else C=n(h);if(!C){if(!x){c=m+(c.length>0?" "+c:c);continue}if(C=n(h),!C){c=m+(c.length>0?" "+c:c);continue}x=!1}let b=f.length===0?"":f.length===1?f[0]:a(f).join(":"),L=g?b+"!":b,w=L+C;if(i.indexOf(w)>-1)continue;i.push(w);let k=r(C,x);for(let I=0;I<k.length;++I){let T=k[I];i.push(L+T)}c=m+(c.length>0?" "+c:c)}return c},CF=(...e)=>{let t=0,o,n,r="";for(;t<e.length;)(o=e[t++])&&(n=Xx(o))&&(r&&(r+=" "),r+=n);return r},Xx=e=>{if(typeof e=="string")return e;let t,o="";for(let n=0;n<e.length;n++)e[n]&&(t=Xx(e[n]))&&(o&&(o+=" "),o+=t);return o},zx=(e,...t)=>{let o,n,r,a,s=d=>{let c=t.reduce((u,m)=>m(u),e());return o=gF(c),n=o.cache.get,r=o.cache.set,a=i,i(d)},i=d=>{let c=n(d);if(c)return c;let u=vF(d,o);return r(d,u),u};return a=s,(...d)=>a(CF(...d))},xF=[],qt=e=>{let t=o=>o[e]||xF;return t.isThemeGetter=!0,t},Yx=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Jx=/^\((?:(\w[\w-]*):)?(.+)\)$/i,bF=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,wF=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,TF=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,IF=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,SF=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,kF=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Br=e=>bF.test(e),We=e=>!!e&&!Number.isNaN(Number(e)),Kn=e=>!!e&&Number.isInteger(Number(e)),Ig=e=>e.endsWith("%")&&We(e.slice(0,-1)),fr=e=>wF.test(e),Zx=()=>!0,LF=e=>TF.test(e)&&!IF.test(e),Lg=()=>!1,PF=e=>SF.test(e),RF=e=>kF.test(e),EF=e=>!Ie(e)&&!Se(e),MF=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=>Hr(e,ob,Lg),Ie=e=>Yx.test(e),Da=e=>Hr(e,nb,LF),Kx=e=>Hr(e,UF,We),NF=e=>Hr(e,ab,Zx),DF=e=>Hr(e,rb,Lg),qx=e=>Hr(e,eb,Lg),_F=e=>Hr(e,tb,RF),Su=e=>Hr(e,sb,PF),Se=e=>Jx.test(e),Al=e=>_a(e,nb),OF=e=>_a(e,rb),Wx=e=>_a(e,eb),FF=e=>_a(e,ob),BF=e=>_a(e,tb),ku=e=>_a(e,sb,!0),HF=e=>_a(e,ab,!0),Hr=(e,t,o)=>{let n=Yx.exec(e);return n?n[1]?t(n[1]):o(n[2]):!1},_a=(e,t,o=!1)=>{let n=Jx.exec(e);return n?n[1]?t(n[1]):o:!1},eb=e=>e==="position"||e==="percentage",tb=e=>e==="image"||e==="url",ob=e=>e==="length"||e==="size"||e==="bg-size",nb=e=>e==="length",UF=e=>e==="number",rb=e=>e==="family-name",ab=e=>e==="number"||e==="weight",sb=e=>e==="shadow";var Gx=()=>{let e=qt("color"),t=qt("font"),o=qt("text"),n=qt("font-weight"),r=qt("tracking"),a=qt("leading"),s=qt("breakpoint"),i=qt("container"),d=qt("spacing"),c=qt("radius"),u=qt("shadow"),m=qt("inset-shadow"),p=qt("text-shadow"),f=qt("drop-shadow"),g=qt("blur"),h=qt("perspective"),y=qt("aspect"),x=qt("ease"),C=qt("animate"),b=()=>["auto","avoid","all","avoid-page","page","left","right","column"],L=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],w=()=>[...L(),Se,Ie],k=()=>["auto","hidden","clip","visible","scroll"],I=()=>["auto","contain","none"],T=()=>[Se,Ie,d],S=()=>[Br,"full","auto",...T()],P=()=>[Kn,"none","subgrid",Se,Ie],A=()=>["auto",{span:["full",Kn,Se,Ie]},Kn,Se,Ie],N=()=>[Kn,"auto",Se,Ie],B=()=>["auto","min","max","fr",Se,Ie],O=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],j=()=>["start","end","center","stretch","center-safe","end-safe"],U=()=>["auto",...T()],D=()=>[Br,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...T()],J=()=>[Br,"screen","full","dvw","lvw","svw","min","max","fit",...T()],G=()=>[Br,"screen","full","lh","dvh","lvh","svh","min","max","fit",...T()],M=()=>[e,Se,Ie],X=()=>[...L(),Wx,qx,{position:[Se,Ie]}],F=()=>["no-repeat",{repeat:["","x","y","space","round"]}],ee=()=>["auto","cover","contain",FF,AF,{size:[Se,Ie]}],Y=()=>[Ig,Al,Da],ae=()=>["","none","full",c,Se,Ie],te=()=>["",We,Al,Da],de=()=>["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"],ne=()=>[We,Ig,Wx,qx],Z=()=>["","none",g,Se,Ie],ve=()=>["none",We,Se,Ie],he=()=>["none",We,Se,Ie],Ae=()=>[We,Se,Ie],De=()=>[Br,"full",...T()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[fr],breakpoint:[fr],color:[Zx],container:[fr],"drop-shadow":[fr],ease:["in","out","in-out"],font:[EF],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[fr],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[fr],shadow:[fr],spacing:["px",We],text:[fr],"text-shadow":[fr],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Br,Ie,Se,y]}],container:["container"],"container-type":[{"@container":["","normal","size",Se,Ie]}],"container-named":[MF],columns:[{columns:[We,Ie,Se,i]}],"break-after":[{"break-after":b()}],"break-before":[{"break-before":b()}],"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:w()}],overflow:[{overflow:k()}],"overflow-x":[{"overflow-x":k()}],"overflow-y":[{"overflow-y":k()}],overscroll:[{overscroll:I()}],"overscroll-x":[{"overscroll-x":I()}],"overscroll-y":[{"overscroll-y":I()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:S()}],"inset-x":[{"inset-x":S()}],"inset-y":[{"inset-y":S()}],start:[{"inset-s":S(),start:S()}],end:[{"inset-e":S(),end:S()}],"inset-bs":[{"inset-bs":S()}],"inset-be":[{"inset-be":S()}],top:[{top:S()}],right:[{right:S()}],bottom:[{bottom:S()}],left:[{left:S()}],visibility:["visible","invisible","collapse"],z:[{z:[Kn,"auto",Se,Ie]}],basis:[{basis:[Br,"full","auto",i,...T()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[We,Br,"auto","initial","none",Ie]}],grow:[{grow:["",We,Se,Ie]}],shrink:[{shrink:["",We,Se,Ie]}],order:[{order:[Kn,"first","last","none",Se,Ie]}],"grid-cols":[{"grid-cols":P()}],"col-start-end":[{col:A()}],"col-start":[{"col-start":N()}],"col-end":[{"col-end":N()}],"grid-rows":[{"grid-rows":P()}],"row-start-end":[{row:A()}],"row-start":[{"row-start":N()}],"row-end":[{"row-end":N()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":B()}],"auto-rows":[{"auto-rows":B()}],gap:[{gap:T()}],"gap-x":[{"gap-x":T()}],"gap-y":[{"gap-y":T()}],"justify-content":[{justify:[...O(),"normal"]}],"justify-items":[{"justify-items":[...j(),"normal"]}],"justify-self":[{"justify-self":["auto",...j()]}],"align-content":[{content:["normal",...O()]}],"align-items":[{items:[...j(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...j(),{baseline:["","last"]}]}],"place-content":[{"place-content":O()}],"place-items":[{"place-items":[...j(),"baseline"]}],"place-self":[{"place-self":["auto",...j()]}],p:[{p:T()}],px:[{px:T()}],py:[{py:T()}],ps:[{ps:T()}],pe:[{pe:T()}],pbs:[{pbs:T()}],pbe:[{pbe:T()}],pt:[{pt:T()}],pr:[{pr:T()}],pb:[{pb:T()}],pl:[{pl:T()}],m:[{m:U()}],mx:[{mx:U()}],my:[{my:U()}],ms:[{ms:U()}],me:[{me:U()}],mbs:[{mbs:U()}],mbe:[{mbe:U()}],mt:[{mt:U()}],mr:[{mr:U()}],mb:[{mb:U()}],ml:[{ml:U()}],"space-x":[{"space-x":T()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":T()}],"space-y-reverse":["space-y-reverse"],size:[{size:D()}],"inline-size":[{inline:["auto",...J()]}],"min-inline-size":[{"min-inline":["auto",...J()]}],"max-inline-size":[{"max-inline":["none",...J()]}],"block-size":[{block:["auto",...G()]}],"min-block-size":[{"min-block":["auto",...G()]}],"max-block-size":[{"max-block":["none",...G()]}],w:[{w:[i,"screen",...D()]}],"min-w":[{"min-w":[i,"screen","none",...D()]}],"max-w":[{"max-w":[i,"screen","none","prose",{screen:[s]},...D()]}],h:[{h:["screen","lh",...D()]}],"min-h":[{"min-h":["screen","lh","none",...D()]}],"max-h":[{"max-h":["screen","lh",...D()]}],"font-size":[{text:["base",o,Al,Da]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,HF,NF]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Ig,Ie]}],"font-family":[{font:[OF,DF,t]}],"font-features":[{"font-features":[Ie]}],"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,Se,Ie]}],"line-clamp":[{"line-clamp":[We,"none",Se,Kx]}],leading:[{leading:[a,...T()]}],"list-image":[{"list-image":["none",Se,Ie]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Se,Ie]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:M()}],"text-color":[{text:M()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...de(),"wavy"]}],"text-decoration-thickness":[{decoration:[We,"from-font","auto",Se,Da]}],"text-decoration-color":[{decoration:M()}],"underline-offset":[{"underline-offset":[We,"auto",Se,Ie]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:T()}],"tab-size":[{tab:[Kn,Se,Ie]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Se,Ie]}],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",Se,Ie]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:X()}],"bg-repeat":[{bg:F()}],"bg-size":[{bg:ee()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Kn,Se,Ie],radial:["",Se,Ie],conic:[Kn,Se,Ie]},BF,_F]}],"bg-color":[{bg:M()}],"gradient-from-pos":[{from:Y()}],"gradient-via-pos":[{via:Y()}],"gradient-to-pos":[{to:Y()}],"gradient-from":[{from:M()}],"gradient-via":[{via:M()}],"gradient-to":[{to:M()}],rounded:[{rounded:ae()}],"rounded-s":[{"rounded-s":ae()}],"rounded-e":[{"rounded-e":ae()}],"rounded-t":[{"rounded-t":ae()}],"rounded-r":[{"rounded-r":ae()}],"rounded-b":[{"rounded-b":ae()}],"rounded-l":[{"rounded-l":ae()}],"rounded-ss":[{"rounded-ss":ae()}],"rounded-se":[{"rounded-se":ae()}],"rounded-ee":[{"rounded-ee":ae()}],"rounded-es":[{"rounded-es":ae()}],"rounded-tl":[{"rounded-tl":ae()}],"rounded-tr":[{"rounded-tr":ae()}],"rounded-br":[{"rounded-br":ae()}],"rounded-bl":[{"rounded-bl":ae()}],"border-w":[{border:te()}],"border-w-x":[{"border-x":te()}],"border-w-y":[{"border-y":te()}],"border-w-s":[{"border-s":te()}],"border-w-e":[{"border-e":te()}],"border-w-bs":[{"border-bs":te()}],"border-w-be":[{"border-be":te()}],"border-w-t":[{"border-t":te()}],"border-w-r":[{"border-r":te()}],"border-w-b":[{"border-b":te()}],"border-w-l":[{"border-l":te()}],"divide-x":[{"divide-x":te()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":te()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...de(),"hidden","none"]}],"divide-style":[{divide:[...de(),"hidden","none"]}],"border-color":[{border:M()}],"border-color-x":[{"border-x":M()}],"border-color-y":[{"border-y":M()}],"border-color-s":[{"border-s":M()}],"border-color-e":[{"border-e":M()}],"border-color-bs":[{"border-bs":M()}],"border-color-be":[{"border-be":M()}],"border-color-t":[{"border-t":M()}],"border-color-r":[{"border-r":M()}],"border-color-b":[{"border-b":M()}],"border-color-l":[{"border-l":M()}],"divide-color":[{divide:M()}],"outline-style":[{outline:[...de(),"none","hidden"]}],"outline-offset":[{"outline-offset":[We,Se,Ie]}],"outline-w":[{outline:["",We,Al,Da]}],"outline-color":[{outline:M()}],shadow:[{shadow:["","none",u,ku,Su]}],"shadow-color":[{shadow:M()}],"inset-shadow":[{"inset-shadow":["none",m,ku,Su]}],"inset-shadow-color":[{"inset-shadow":M()}],"ring-w":[{ring:te()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:M()}],"ring-offset-w":[{"ring-offset":[We,Da]}],"ring-offset-color":[{"ring-offset":M()}],"inset-ring-w":[{"inset-ring":te()}],"inset-ring-color":[{"inset-ring":M()}],"text-shadow":[{"text-shadow":["none",p,ku,Su]}],"text-shadow-color":[{"text-shadow":M()}],opacity:[{opacity:[We,Se,Ie]}],"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":[We]}],"mask-image-linear-from-pos":[{"mask-linear-from":ne()}],"mask-image-linear-to-pos":[{"mask-linear-to":ne()}],"mask-image-linear-from-color":[{"mask-linear-from":M()}],"mask-image-linear-to-color":[{"mask-linear-to":M()}],"mask-image-t-from-pos":[{"mask-t-from":ne()}],"mask-image-t-to-pos":[{"mask-t-to":ne()}],"mask-image-t-from-color":[{"mask-t-from":M()}],"mask-image-t-to-color":[{"mask-t-to":M()}],"mask-image-r-from-pos":[{"mask-r-from":ne()}],"mask-image-r-to-pos":[{"mask-r-to":ne()}],"mask-image-r-from-color":[{"mask-r-from":M()}],"mask-image-r-to-color":[{"mask-r-to":M()}],"mask-image-b-from-pos":[{"mask-b-from":ne()}],"mask-image-b-to-pos":[{"mask-b-to":ne()}],"mask-image-b-from-color":[{"mask-b-from":M()}],"mask-image-b-to-color":[{"mask-b-to":M()}],"mask-image-l-from-pos":[{"mask-l-from":ne()}],"mask-image-l-to-pos":[{"mask-l-to":ne()}],"mask-image-l-from-color":[{"mask-l-from":M()}],"mask-image-l-to-color":[{"mask-l-to":M()}],"mask-image-x-from-pos":[{"mask-x-from":ne()}],"mask-image-x-to-pos":[{"mask-x-to":ne()}],"mask-image-x-from-color":[{"mask-x-from":M()}],"mask-image-x-to-color":[{"mask-x-to":M()}],"mask-image-y-from-pos":[{"mask-y-from":ne()}],"mask-image-y-to-pos":[{"mask-y-to":ne()}],"mask-image-y-from-color":[{"mask-y-from":M()}],"mask-image-y-to-color":[{"mask-y-to":M()}],"mask-image-radial":[{"mask-radial":[Se,Ie]}],"mask-image-radial-from-pos":[{"mask-radial-from":ne()}],"mask-image-radial-to-pos":[{"mask-radial-to":ne()}],"mask-image-radial-from-color":[{"mask-radial-from":M()}],"mask-image-radial-to-color":[{"mask-radial-to":M()}],"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":L()}],"mask-image-conic-pos":[{"mask-conic":[We]}],"mask-image-conic-from-pos":[{"mask-conic-from":ne()}],"mask-image-conic-to-pos":[{"mask-conic-to":ne()}],"mask-image-conic-from-color":[{"mask-conic-from":M()}],"mask-image-conic-to-color":[{"mask-conic-to":M()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:X()}],"mask-repeat":[{mask:F()}],"mask-size":[{mask:ee()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Se,Ie]}],filter:[{filter:["","none",Se,Ie]}],blur:[{blur:Z()}],brightness:[{brightness:[We,Se,Ie]}],contrast:[{contrast:[We,Se,Ie]}],"drop-shadow":[{"drop-shadow":["","none",f,ku,Su]}],"drop-shadow-color":[{"drop-shadow":M()}],grayscale:[{grayscale:["",We,Se,Ie]}],"hue-rotate":[{"hue-rotate":[We,Se,Ie]}],invert:[{invert:["",We,Se,Ie]}],saturate:[{saturate:[We,Se,Ie]}],sepia:[{sepia:["",We,Se,Ie]}],"backdrop-filter":[{"backdrop-filter":["","none",Se,Ie]}],"backdrop-blur":[{"backdrop-blur":Z()}],"backdrop-brightness":[{"backdrop-brightness":[We,Se,Ie]}],"backdrop-contrast":[{"backdrop-contrast":[We,Se,Ie]}],"backdrop-grayscale":[{"backdrop-grayscale":["",We,Se,Ie]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[We,Se,Ie]}],"backdrop-invert":[{"backdrop-invert":["",We,Se,Ie]}],"backdrop-opacity":[{"backdrop-opacity":[We,Se,Ie]}],"backdrop-saturate":[{"backdrop-saturate":[We,Se,Ie]}],"backdrop-sepia":[{"backdrop-sepia":["",We,Se,Ie]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":T()}],"border-spacing-x":[{"border-spacing-x":T()}],"border-spacing-y":[{"border-spacing-y":T()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Se,Ie]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[We,"initial",Se,Ie]}],ease:[{ease:["linear","initial",x,Se,Ie]}],delay:[{delay:[We,Se,Ie]}],animate:[{animate:["none",C,Se,Ie]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[h,Se,Ie]}],"perspective-origin":[{"perspective-origin":w()}],rotate:[{rotate:ve()}],"rotate-x":[{"rotate-x":ve()}],"rotate-y":[{"rotate-y":ve()}],"rotate-z":[{"rotate-z":ve()}],scale:[{scale:he()}],"scale-x":[{"scale-x":he()}],"scale-y":[{"scale-y":he()}],"scale-z":[{"scale-z":he()}],"scale-3d":["scale-3d"],skew:[{skew:Ae()}],"skew-x":[{"skew-x":Ae()}],"skew-y":[{"skew-y":Ae()}],transform:[{transform:[Se,Ie,"","none","gpu","cpu"]}],"transform-origin":[{origin:w()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:De()}],"translate-x":[{"translate-x":De()}],"translate-y":[{"translate-y":De()}],"translate-z":[{"translate-z":De()}],"translate-none":["translate-none"],zoom:[{zoom:[Kn,Se,Ie]}],accent:[{accent:M()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:M()}],"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",Se,Ie]}],"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":M()}],"scrollbar-track-color":[{"scrollbar-track":M()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":T()}],"scroll-mx":[{"scroll-mx":T()}],"scroll-my":[{"scroll-my":T()}],"scroll-ms":[{"scroll-ms":T()}],"scroll-me":[{"scroll-me":T()}],"scroll-mbs":[{"scroll-mbs":T()}],"scroll-mbe":[{"scroll-mbe":T()}],"scroll-mt":[{"scroll-mt":T()}],"scroll-mr":[{"scroll-mr":T()}],"scroll-mb":[{"scroll-mb":T()}],"scroll-ml":[{"scroll-ml":T()}],"scroll-p":[{"scroll-p":T()}],"scroll-px":[{"scroll-px":T()}],"scroll-py":[{"scroll-py":T()}],"scroll-ps":[{"scroll-ps":T()}],"scroll-pe":[{"scroll-pe":T()}],"scroll-pbs":[{"scroll-pbs":T()}],"scroll-pbe":[{"scroll-pbe":T()}],"scroll-pt":[{"scroll-pt":T()}],"scroll-pr":[{"scroll-pr":T()}],"scroll-pb":[{"scroll-pb":T()}],"scroll-pl":[{"scroll-pl":T()}],"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",Se,Ie]}],fill:[{fill:["none",...M()]}],"stroke-w":[{stroke:[We,Al,Da,Kx]}],stroke:[{stroke:["none",...M()]}],"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"]}},$F=(e,{cacheSize:t,prefix:o,experimentalParseClassName:n,extend:r={},override:a={}})=>(Us(e,"cacheSize",t),Us(e,"prefix",o),Us(e,"experimentalParseClassName",n),Lu(e.theme,a.theme),Lu(e.classGroups,a.classGroups),Lu(e.conflictingClassGroups,a.conflictingClassGroups),Lu(e.conflictingClassGroupModifiers,a.conflictingClassGroupModifiers),Us(e,"postfixLookupClassGroups",a.postfixLookupClassGroups),Us(e,"orderSensitiveModifiers",a.orderSensitiveModifiers),Pu(e.theme,r.theme),Pu(e.classGroups,r.classGroups),Pu(e.conflictingClassGroups,r.conflictingClassGroups),Pu(e.conflictingClassGroupModifiers,r.conflictingClassGroupModifiers),Sg(e,r,"postfixLookupClassGroups"),Sg(e,r,"orderSensitiveModifiers"),e),Us=(e,t,o)=>{o!==void 0&&(e[t]=o)},Lu=(e,t)=>{if(t)for(let o in t)Us(e,o,t[o])},Pu=(e,t)=>{if(t)for(let o in t)Sg(e,t,o)},Sg=(e,t,o)=>{let n=t[o];n!==void 0&&(e[o]=e[o]?e[o].concat(n):n)},ib=(e,...t)=>typeof e=="function"?zx(Gx,e,...t):zx(()=>$F(Gx(),e),...t);var zF=ib({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 V(...e){return zF(Hx(e))}$();var Ru=qe(!0);function lb(){return xe(Ru)}var Pg=qe(void 0);function Cn(){let e=xe(Ru);return xe(Pg)??e}$();var Eu=(...e)=>e.filter((t,o,n)=>!!t&&t.trim()!==""&&n.indexOf(t)===o).join(" ").trim();var db=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();var cb=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,o,n)=>n?n.toUpperCase():o.toLowerCase());var Rg=e=>{let t=cb(e);return t.charAt(0).toUpperCase()+t.slice(1)};$();var ub={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 pb=e=>{for(let t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};var mb=zn(({color:e="currentColor",size:t=24,strokeWidth:o=2,absoluteStrokeWidth:n,className:r="",children:a,iconNode:s,...i},d)=>vn("svg",{ref:d,...ub,width:t,height:t,stroke:e,strokeWidth:n?Number(o)*24/Number(t):o,className:Eu("lucide",r),...!a&&!pb(i)&&{"aria-hidden":"true"},...i},[...s.map(([c,u])=>vn(c,u)),...Array.isArray(a)?a:[a]]));var Q=(e,t)=>{let o=zn(({className:n,...r},a)=>vn(mb,{ref:a,iconNode:t,className:Eu(`lucide-${db(Rg(e))}`,`lucide-${e}`,n),...r}));return o.displayName=Rg(e),o};var KF=[["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}],["path",{d:"M10 4v4",key:"pp8u80"}],["path",{d:"M2 8h20",key:"d11cs7"}],["path",{d:"M6 4v4",key:"1svtjw"}]],Nl=Q("app-window",KF);var qF=[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]],Oa=Q("archive",qF);var WF=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],Dl=Q("arrow-down",WF);var GF=[["path",{d:"M5 3h14",key:"7usisc"}],["path",{d:"m18 13-6-6-6 6",key:"1kf1n9"}],["path",{d:"M12 7v14",key:"1akyts"}]],_l=Q("arrow-up-to-line",GF);var jF=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Ol=Q("arrow-up",jF);var VF=[["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"}]],Fa=Q("blocks",VF);var QF=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],Fl=Q("book-open",QF);var XF=[["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"}]],$s=Q("bookmark",XF);var YF=[["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"}]],Bl=Q("bot",YF);var JF=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],jo=Q("check",JF);var ZF=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Tt=Q("chevron-down",ZF);var e2=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Hl=Q("chevron-left",e2);var t2=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],yo=Q("chevron-right",t2);var o2=[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]],Ul=Q("chevrons-left",o2);var n2=[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]],$l=Q("chevrons-right",n2);var r2=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],eo=Q("circle-alert",r2);var a2=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],Ba=Q("copy",a2);var s2=[["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"}]],Eo=Q("ellipsis",s2);var i2=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],zl=Q("eye-off",i2);var l2=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}]],Kl=Q("file-code",l2);var d2=[["path",{d:"M4 6.835V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-.343",key:"1vfytu"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M2 19a2 2 0 0 1 4 0v1a2 2 0 0 1-4 0v-4a6 6 0 0 1 12 0v4a2 2 0 0 1-4 0v-1a2 2 0 0 1 4 0",key:"1etmh7"}]],xn=Q("file-headphone",d2);var c2=[["path",{d:"M12.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v9.34",key:"o6klzx"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10.378 12.622a1 1 0 0 1 3 3.003L8.36 20.637a2 2 0 0 1-.854.506l-2.867.837a.5.5 0 0 1-.62-.62l.836-2.869a2 2 0 0 1 .506-.853z",key:"zhnas1"}]],Ur=Q("file-pen",c2);var u2=[["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:"M15.033 13.44a.647.647 0 0 1 0 1.12l-4.065 2.352a.645.645 0 0 1-.968-.56v-4.704a.645.645 0 0 1 .967-.56z",key:"1tzo1f"}]],$r=Q("file-play",u2);var p2=[["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"}]],Ha=Q("file-text",p2);var m2=[["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:"M11 18h2",key:"12mj7e"}],["path",{d:"M12 12v6",key:"3ahymv"}],["path",{d:"M9 13v-.5a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 .5.5v.5",key:"qbrxap"}]],ql=Q("file-type",m2);var f2=[["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"}]],Wl=Q("file",f2);var g2=[["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"}]],zr=Q("folder",g2);var h2=[["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"}]],Gl=Q("frame",h2);var y2=[["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"}]],jl=Q("git-branch-plus",y2);var v2=[["path",{d:"M15 6a9 9 0 0 0-9 9V3",key:"1cii5b"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}]],Vl=Q("git-branch",v2);var C2=[["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"}]],Ql=Q("globe",C2);var x2=[["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"}]],Xl=Q("grip-vertical",x2);var b2=[["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"}]],Yl=Q("image",b2);var w2=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],Jl=Q("info",w2);var T2=[["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"}]],Kr=Q("layers",T2);var I2=[["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"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}]],Zl=Q("list-checks",I2);var S2=[["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"}]],ed=Q("list-ordered",S2);var k2=[["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"}]],Ua=Q("list-todo",k2);var L2=[["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"}]],td=Q("list",L2);var P2=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],qr=Q("loader-circle",P2);var R2=[["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"}]],Wr=Q("lock-open",R2);var E2=[["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"}]],od=Q("lock",E2);var M2=[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]],zs=Q("maximize",M2);var A2=[["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"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],qn=Q("message-circle-question-mark",A2);var N2=[["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"}]],nd=Q("message-circle",N2);var D2=[["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"}]],$a=Q("message-square",D2);var _2=[["path",{d:"M16 10a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 14.286V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z",key:"1n2ejm"}],["path",{d:"M20 9a2 2 0 0 1 2 2v10.286a.71.71 0 0 1-1.212.502l-2.202-2.202A2 2 0 0 0 17.172 19H10a2 2 0 0 1-2-2v-1",key:"1qfcsi"}]],gr=Q("messages-square",_2);var O2=[["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"}]],rd=Q("minimize-2",O2);var F2=[["path",{d:"M5 12h14",key:"1ays0h"}]],ad=Q("minus",F2);var B2=[["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"}]],Wn=Q("mouse-pointer-click",B2);var H2=[["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"}]],sd=Q("package",H2);var U2=[["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"}]],za=Q("paintbrush",U2);var $2=[["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=Q("paperclip",$2);var z2=[["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"}]],Gn=Q("pen-line",z2);var K2=[["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"}]],id=Q("pencil-ruler",K2);var q2=[["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"}]],ld=Q("pencil",q2);var W2=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],dd=Q("plus",W2);var G2=[["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"}]],cd=Q("puzzle",G2);var j2=[["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"}]],Ka=Q("rotate-ccw",j2);var V2=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],ud=Q("search",V2);var Q2=[["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"}]],pd=Q("send",Q2);var X2=[["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"}]],md=Q("settings",X2);var Y2=[["path",{d:"M21 4v16",key:"7j8fe9"}],["path",{d:"M6.029 4.285A2 2 0 0 0 3 6v12a2 2 0 0 0 3.029 1.715l9.997-5.998a2 2 0 0 0 .003-3.432z",key:"zs4d6"}]],Ks=Q("skip-forward",Y2);var J2=[["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"}]],qs=Q("sliders-horizontal",J2);var Z2=[["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"}]],jn=Q("sparkles",Z2);var eB=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],fd=Q("square",eB);var tB=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],Qo=Q("terminal",tB);var oB=[["path",{d:"M17 5H3",key:"1cn7zz"}],["path",{d:"M21 12H8",key:"scolzb"}],["path",{d:"M21 19H8",key:"13qgcb"}],["path",{d:"M3 12v7",key:"1ri8j3"}]],hr=Q("text-quote",oB);var nB=[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]],yr=Q("user-round",nB);var rB=[["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"}]],Ws=Q("wrench",rB);var aB=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],dt=Q("x",aB);$();function z(){return{t:Nt().i18n.usePluginTranslation()}}$();$();var Gr=qe(null),gd=qe(null);function Gs(e,t){let o=xe(gd);fe(()=>{if(!(!t||e===null||o===null))return o(e)},[o,t,e])}function hd(){let e=new Map;return{rows:()=>[...e.keys()],acquire:(t,o)=>{e.set(t,(e.get(t)??0)+1),o();let n=!0;return()=>{if(!n)return;n=!1;let r=e.get(t)??0;r>1?e.set(t,r-1):e.delete(t),o()}}}}var fb=new Set(["Select","AlertDialog","Dialog","Menu","Popover","Tooltip","ProviderModelPicker","TraitsPicker","TimelineRowErrorFallback"]);function ie(e){let t=fb.has(e),o=n=>{let r=Nt(),a=bu(),s=Cn(),i=r.ui[e],d={};if(t){let c=xe(Gr),[u,m]=q(n.defaultOpen===!0),p=typeof n.open=="boolean"?n.open:u;Gs(c,s&&p),fe(()=>{s||m(!1)},[s]),d={open:s&&p,onOpenChange:(f,...g)=>{m(f),typeof n.onOpenChange=="function"&&n.onOpenChange(f,...g)}}}return i===void 0&&["MachineName","ProjectName","ProviderName","ThreadName","PluginName","TimelineRowErrorFallback"].includes(e)?null:vn(i,{...n,...d,...fb.has(e)&&!s?{open:!1}:{},className:`${a} ${typeof n.className=="string"?n.className:""}`})};return o.displayName=e,o}var B7=ie("useLinkContextMenu"),js=ie("ProviderInstanceIcon"),gb=ie("MachineName"),hb=ie("ProjectName"),yb=ie("ProviderName"),yd=ie("ThreadName"),Mo=ie("PluginName"),vb=ie("ProviderModelPicker"),Cb=ie("TraitsPicker"),xb=ie("TraitsMenuContent"),Vn=ie("ComposerControl"),Qn=ie("ComposerControlIcon"),Mu=ie("ComposerControlChevron"),Au=ie("ComposerSelectControl"),bb=ie("TimelineRowErrorFallback"),Nu=ie("TimelineProcessShell"),vd=ie("ProcessRowIcon"),Cd=ie("WorkEntryStatusDot"),Vs=ie("WorkEntryIcon");function Xn(e,t,o){return Nt().usePluginName?.(e,t,o)??null}function wb(e,t){return Nt().useThreadName?.(e,t)??null}var Tb=ie("UserAvatar"),jr=ie("Badge"),H7=ie("InlineTag"),Eg=ie("Meter"),K=ie("Button"),Du=ie("Label"),Vr=ie("Input"),Ib=ie("SearchInput"),Qr=ie("EmptyInline"),Sb=ie("Textarea"),_u=ie("Switch"),U7=ie("Separator"),Mg=ie("Skeleton"),Qs=ie("Spinner"),$7=ie("ScrollArea"),z7=ie("Card"),K7=ie("CardAction"),q7=ie("CardPanel"),W7=ie("CardDescription"),G7=ie("CardFooter"),j7=ie("CardHeader"),V7=ie("CardTitle"),Q7=ie("Empty"),X7=ie("EmptyContent"),Y7=ie("EmptyDescription"),J7=ie("EmptyHeader"),Z7=ie("EmptyMedia"),e9=ie("EmptyTitle"),t9=ie("InputGroup"),o9=ie("InputGroupAddon"),n9=ie("InputGroupInput"),r9=ie("DocumentPanel"),a9=ie("MasterDetail"),Xs=ie("Select"),qa=ie("SelectItem"),Ys=ie("SelectPopup"),kb=ie("SelectTrigger"),Ou=ie("SelectValue"),Xr=ie("Toggle"),Fu=ie("ToggleGroup"),Js=ie("Dialog"),s9=ie("DialogClose"),Zs=ie("DialogDescription"),Bu=ie("DialogFooter"),Hu=ie("DialogHeader"),ei=ie("DialogPopup"),Lb=ie("DialogPanel"),ti=ie("DialogTitle"),i9=ie("DialogTrigger"),Ao=ie("Menu"),Pb=ie("MenuGroup"),vo=ie("MenuItem"),No=ie("MenuPopup"),Yr=ie("MenuRadioGroup"),Yn=ie("MenuRadioItem"),xd=ie("MenuSeparator"),Do=ie("MenuTrigger"),rn=ie("Popover"),an=ie("PopoverPopup"),sn=ie("PopoverTrigger"),Rb=ie("Table"),Eb=ie("TableBody"),bn=ie("TableCell"),Wa=ie("TableHead"),Mb=ie("TableHeader"),Jr=ie("TableRow"),Pe=ie("Tooltip"),Re=ie("TooltipPopup"),Ee=ie("TooltipTrigger"),bd=ie("Alert"),wd=ie("AlertAction"),Uu=ie("AlertDescription"),Ag=ie("AlertTitle"),oi=ie("Kbd"),vr=ie("DecisionCard"),$u=ie("ChoiceList"),zu=ie("Command"),Ku=ie("CommandGroup"),qu=ie("CommandItem"),Wu=ie("CommandList"),Ab=ie("StyledDiffCodeView"),Nb=ie("DevBackdropArt"),wo=ie("Markdown"),Db=ie("DiffView"),_b=ie("MediaPlayer");var{jsx:l,jsxs:v,Fragment:oe}=window.__ycodiumPluginHost.jsxRuntime;var sB="sr-only @min-[30rem]/composer-first-row:not-sr-only";function Fb({mode:e,onModeChange:t}){let{t:o}=z();return l("div",{className:"flex shrink-0 items-center gap-1",children:v(Fu,{className:"shrink-0","data-view-mode-toggle":!0,size:"xs","aria-label":o("trajectory.toggleLabel"),variant:"segmented",value:[e],onValueChange:n=>{let r=n[0];(r==="chat"||r==="trajectory")&&t(r)},children:[l(Ob,{value:"chat",label:o("trajectory.toggleChat"),icon:l($a,{"aria-hidden":!0})}),l(Ob,{value:"trajectory",label:o("trajectory.toggleTrajectory"),icon:l(ed,{"aria-hidden":!0})})]})})}function Ob({value:e,label:t,icon:o}){return v(Pe,{children:[v(Ee,{render:l(Xr,{value:e,"aria-label":t}),children:[o,l("span",{className:sB,children:t})]}),l(Re,{side:"top",children:t})]})}function Bb({mode:e,visible:t,chat:o,trajectory:n}){return l("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":e,"data-pane-visible":t?"true":"false",children:l(Pg,{value:t,children:e==="chat"?o:n})})}$();function Hb(e){if(e.cacheDisjoint!==!0)return null;let t=e.cachedInputTokens,o=e.inputTokens;if(t===void 0||o===void 0)return null;let n=t+o;if(n<=0)return null;if(t>=n)return"100%";let r=t/n*100;for(let a=0;a<=3;a+=1){let s=r.toFixed(a);if(Number.parseFloat(s)<100)return`${s}%`}return"99.9%"}function Ub(e){let t,o,n,r=!0,a=!1;for(let s of e)s!==void 0&&(a=!0,s.cacheDisjoint!==!0&&(r=!1),s.outputTokens!==void 0&&(t=(t??0)+s.outputTokens),s.inputTokens!==void 0&&(o=(o??0)+s.inputTokens),s.cachedInputTokens!==void 0&&(n=(n??0)+s.cachedInputTokens));if(!(t===void 0&&o===void 0&&n===void 0))return{...a&&r?{cacheDisjoint:!0}:{},...t!==void 0?{outputTokens:t}:{},...o!==void 0?{inputTokens:o}:{},...n!==void 0?{cachedInputTokens:n}:{}}}$();$();var $b=qe(null);function zb({data:e,target:t,children:o}){let n=R(r=>e.readTurnChanges(t,r),[e,t.environmentId,t.threadId]);return l($b,{value:e.readTurnChanges?n:null,children:o})}function Kb({turnId:e,filePath:t,onClose:o}){let n=xe($b),r=E(n),a=E(o);a.current=o;let{t:s}=z(),[i,d]=q(0),[c,u]=q(0),[m,p]=q(null),[f,g]=q("loading");return H(()=>{if(n!==r.current){a.current();return}let h=!0;if(g("loading"),!n){g("ready");return}return n({turnId:e,filePath:t,textOffset:i}).then(y=>{h&&(p(x=>({...y,text:i===0?y.text:(x?.text??"")+y.text})),g("ready"))},()=>{h&&g("failed")}),()=>{h=!1}},[n,e,t,i,c]),l(Js,{open:!0,onOpenChange:h=>{h||o()},children:v(ei,{className:"flex max-h-[80vh] w-[min(90vw,60rem)] flex-col gap-3",children:[l(ti,{children:s("turnOverview.recordedChanges")}),l(Zs,{children:t}),l("p",{className:"text-xs text-muted-foreground",children:m||f==="ready"?s(m?.machineUpdateRequired?"turnOverview.changesUpgradeMachine":`turnOverview.changesSource.${m?.source??"unavailable"}`):null}),f==="loading"?l("p",{role:"status",children:s("turnOverview.changesLoading")}):null,f==="failed"?l(K,{onClick:()=>u(h=>h+1),children:s("turnOverview.changesRetry")}):null,m?.text?l("pre",{className:"min-h-0 overflow-auto whitespace-pre-wrap break-all text-xs",tabIndex:0,children:m.text}):null,m?.truncated?l("p",{children:s("turnOverview.changesTruncated")}):null,m?.textWindow?.nextOffset!=null?l(K,{disabled:f==="loading",onClick:()=>d(m.textWindow.nextOffset),children:s("turnOverview.changesMore")}):null,l(K,{onClick:o,children:s("turnOverview.changesClose")})]})})}$();$();function Td(e,t){if(!Number.isFinite(e)||e<0)return t.milliseconds("0");if(e<1e3)return t.milliseconds(String(Math.max(1,Math.round(e))));if(e<1e4){let i=Math.round(e/100)/10;return t.seconds(i>=10?"10":i.toFixed(1))}if(e<6e4)return t.seconds(String(Math.round(e/1e3)));let o=Math.round(e/1e3),n=Math.floor(o/3600),r=Math.floor(o%3600/60),a=o%60,s=[];return n>0&&s.push(t.hours(String(n))),r>0&&s.push(t.minutes(String(r))),a>0&&s.push(t.seconds(String(a))),s.reduce((i,d)=>t.pair(i,d))}function qb(e,t){return!Number.isFinite(e)||e<=0?t.seconds("0"):Td(e,t)}function _o(){let{t:e}=z();return W(()=>{let t={milliseconds:o=>e("duration.milliseconds",{value:o}),seconds:o=>e("duration.seconds",{value:o}),minutes:o=>e("duration.minutes",{value:o}),hours:o=>e("duration.hours",{value:o}),pair:(o,n)=>e("duration.pair",{left:o,right:n})};return{units:t,formatDuration:o=>Td(o,t),formatCountedDuration:o=>qb(o,t)}},[e])}function iB({fact:e,ownerId:t,onLocate:o,turnId:n}){let{t:r}=z(),{formatDuration:a}=_o(),[s,i]=q(!1),[d,c]=q(null);Gs(t,s||d!==null);let u=r(`turnOverview.${e.kind}`,{count:e.value,duration:a(e.value)}),m=e.targets[0];return e.targets.length===1&&m?.filePath===void 0?l(K,{size:"xs",variant:"ghost",className:"h-auto px-1 py-0.5 text-xs",title:r("turnOverview.locate"),onClick:()=>m&&o(m.rowId),disabled:!m,children:u}):v(oe,{children:[v(rn,{open:s,onOpenChange:i,children:[l(sn,{render:l(K,{size:"xs",variant:"ghost",className:"h-auto px-1 py-0.5 text-xs"}),children:u}),v(an,{className:"flex max-h-72 w-80 flex-col gap-1 overflow-auto p-2",children:[e.partial?l("p",{className:"px-2 py-1 text-xs text-muted-foreground",children:r("turnOverview.loadedFacts")}):null,e.targets.map((p,f)=>v("div",{className:"flex min-w-0 items-center gap-1",children:[p.filePath?l(K,{variant:"ghost",size:"sm",className:"min-w-0 flex-1 justify-start whitespace-normal break-all text-left",title:r("turnOverview.recordedChanges"),onClick:()=>{i(!1),c(p.filePath)},children:p.filePath}):l("span",{className:"min-w-0 flex-1 px-2 text-xs",children:r("turnOverview.step",{index:f+1})}),l(K,{size:"xs",variant:"outline",onClick:()=>{i(!1),o(p.rowId)},children:r("turnOverview.locate")})]},`${p.rowId}:${p.filePath??f}`))]})]}),d!==null?l(Kb,{turnId:n,filePath:d,onClose:()=>c(null)},`${n}:${d}`):null]})}function Gu({summary:e,...t}){let{t:o}=z();return v("div",{className:"flex min-w-0 flex-wrap items-center gap-x-1 gap-y-0.5 text-muted-foreground","data-turn-facts":e.turnId,children:[e.facts.map(n=>l(iB,{fact:n,turnId:e.turnId,ownerId:`turn:${e.turnId}`,...t},n.kind)),e.facts.some(n=>n.partial)?l(Wb,{className:"px-1 text-ui-2xs",detail:o("turnOverview.loadedFacts"),children:o("turnOverview.loaded")}):null]})}function ju({summary:e}){let{t}=z();return e.hasCompaction?v(Wb,{className:"inline-flex shrink-0 items-center text-muted-foreground",detail:t("turnOverview.compaction"),children:[l(Oa,{className:"size-3","aria-hidden":!0}),l("span",{className:"sr-only",children:t("turnOverview.compaction")})]}):null}function Wb({children:e,detail:t,className:o}){return v(Pe,{children:[l(Ee,{render:l("span",{className:o}),children:e}),l(Re,{children:t})]})}$();var Ng=100;function Vu(e){return typeof e=="function"?e():e}function Vb(e,t){return typeof t=="function"?t(e):t}var lB=new Map,Gb=new Map;function dB(e,t,o){let n=e.get(t);return n===void 0&&(n={values:new Map,limit:Math.max(1,o)},e.set(t,n)),n}function cB(e,t){let o=Gb.get(e);return o===void 0&&(o={values:new Map,limit:Math.max(1,t)},Gb.set(e,o)),o}function jb(e){e.alive&&(e.alive=!1,e.dispose?.(e.value),e.subscribers.clear())}function uB(e,t){if(!(e.values.size<=e.limit)){for(let[o,n]of e.values){if(e.values.size<=e.limit)break;n===t||n.committed||n.leases>0||e.values.get(o)===n&&(e.values.delete(o),jb(n))}for(let[o,n]of e.values){if(e.values.size<=e.limit)break;n===t||n.leases>0||n.retain?.(n.value)===!0||e.values.get(o)===n&&(e.values.delete(o),jb(n))}}}function Dg(e,t,o){e.values.get(t)===o&&(e.values.delete(t),e.values.set(t,o))}function Id(e){queueMicrotask(()=>uB(e))}function Qb(e,t,o,n){let r=e.values.get(t);return r===void 0&&(r={value:Vu(o),subscribers:new Set,leases:0,alive:!0,committed:!1,dispose:n.dispose,retain:n.retain},e.values.set(t,r)),r}function Ge(e,t,o){"use no memo";let{cell:n,subscribe:r,setValue:a}=pB(e,t,o),s=R(()=>n.value,[n]);return[Go(r,s,s),a]}function pB(e,t,o){let n=dB(lB,o.namespace,o.limit??Ng),r=Qb(n,e,t,o),a=Math.max(1,o.limit??Ng),s=R(d=>r.alive?(n.limit=a,r.committed=!0,r.dispose=o.dispose,r.retain=o.retain,Dg(n,e,r),r.leases+=1,r.subscribers.add(d),Id(n),()=>{r.subscribers.delete(d),r.leases=Math.max(0,r.leases-1),Id(n)}):()=>{},[r,n,e,a,o.dispose,o.retain]),i=R(d=>{if(!r.alive||n.values.get(e)!==r)return;let c=r.value,u=Vb(c,d);if(!Object.is(c,u)){r.value=u,Dg(n,e,r);for(let m of r.subscribers)m();Id(n)}},[r,n,e]);return{cell:r,subscribe:s,setValue:i}}function Xb(e,t){let o=E(null);(o.current===null||o.current.key!==e)&&(o.current={key:e,value:Vu(t)});let[,n]=Na(a=>a+1,0),r=R(a=>{let s=o.current;if(s===null||s.key!==e)return;let i=Vb(s.value,a);Object.is(s.value,i)||(s.value=i,n())},[e]);return[o.current.value,r]}function $e(e,t,o){let n=Math.max(1,o.limit??Ng),r=cB(o.namespace,n),a=Qb(r,e,()=>({current:Vu(t)}),o);return H(()=>{if(!(!a.alive||r.values.get(e)!==a))return r.limit=n,a.committed=!0,a.dispose=o.dispose,a.retain=o.retain,Dg(r,e,a),a.leases+=1,Id(r),()=>{a.leases=Math.max(0,a.leases-1),Id(r)}},[a,r,e,n,o.dispose,o.retain]),a.value}function Xo(e,t){let o=E(null);return(o.current===null||o.current.key!==e)&&(o.current={key:e,ref:{current:Vu(t)}}),o.current.ref}$();var _g="trajectory-summary-reveal";function Yb({inputKey:e,rows:t,groupRows:o,paneVisible:n,resetFilter:r}){let[a,s]=Ge(e,{},{namespace:"trajectory-turn-disclosure"}),[i,d]=Ge(e,()=>new Set,{namespace:"trajectory-routine-disclosure"}),[c,u]=Ge(e,!1,{namespace:"trajectory-expand-all"}),[m,p]=Ge(e,null,{namespace:_g}),[f,g]=Ge(e,null,{namespace:"trajectory-summary-highlight"}),h=$e(e,()=>new Set,{namespace:"trajectory-default-open"}),y=W(()=>o?.(t,c)??null,[o,t,c]),x=W(()=>{let I=new Map,T=new Map;if(y===null)return{rows:t,headers:I,routines:T};let S=y.findLast(N=>N.turnId!==null),P=new Set(y.map(N=>N.id));if(h.current.size>200)for(let N of h.current)P.has(N)||h.current.delete(N);n&&S&&h.current.add(S.id);let A=[];for(let N of y){let B=N.items[0],O=B?.kind==="step"?B.row:B?.rows[0];if(!O)continue;let j=c||(a[N.id]??(N.turnId===null||h.current.has(N.id)||N.summary?.state==="running"));if(I.set(N.id,{group:N,expanded:j}),A.push({...O,id:N.id,kind:"turn-header",turnId:N.turnId,createdAt:N.summary?.startedAt??O.createdAt}),!!j)for(let U of N.items){if(U.kind==="step"){A.push(U.row);continue}let D=i.has(U.id);T.set(U.id,{count:U.rows.length,expanded:D}),A.push({...U.rows[0],id:U.id,kind:"routine-header"}),D&&A.push(...U.rows)}}return{rows:A,headers:I,routines:T}},[y,t,n,h,c,a,i]),C=E(x.headers);C.current=x.headers;let b=R(I=>{u(!1),s(T=>({...T,[I]:!C.current.get(I)?.expanded}))},[u,s]),L=R(I=>d(T=>{let S=new Set(T);return S.has(I)?S.delete(I):S.add(I),S}),[d]),w=R(I=>p(T=>({rowId:I,nonce:(T?.nonce??0)+1})),[p]);fe(()=>{if(!n||m===null)return;r();let I=y?.find(S=>S.id===m.rowId||S.items.some(P=>P.kind==="step"?P.row.id===m.rowId:P.rows.some(A=>A.id===m.rowId)));if(!I||I.id===m.rowId)return;x.headers.get(I.id)?.expanded||s(S=>({...S,[I.id]:!0}));let T=I.items.find(S=>S.kind==="routine"&&S.rows.some(P=>P.id===m.rowId));T&&!i.has(T.id)&&d(S=>new Set([...S,T.id]))},[n,m,r,y,x.headers,i,s,d]);let k=R(I=>{g(I.rowId),p(T=>T===I?null:T)},[g,p]);return{...x,expandAll:c,setExpandAll:u,toggleTurn:b,toggleRoutine:L,locate:w,request:m,completeReveal:k,highlighted:f}}function ni(e){return e<1e3?String(Math.round(e)):e<1e6?`${(e/1e3).toFixed(1).replace(/\.0$/,"")}k`:`${(e/1e6).toFixed(1).replace(/\.0$/,"")}m`}function Jb({rows:e,usageByTurnId:t,onSelect:o,summaries:n,actions:r}){let{t:a}=z();return e.map(({item:s,ordinal:i})=>{let d=s.attachmentPreview,c=s.isSystemMessage?a("turnNavigator.systemWake"):d===void 0?s.userText:d.count===1?d.name:a("forkRelations.attachmentPreview",d),u=s.turnId===null?void 0:n.get(s.turnId),m=s.turnId===null?void 0:t.get(s.turnId);return v("div",{className:"rounded-md hover:bg-accent/50",children:[v("button",{type:"button","data-turn-navigator-row":s.sectionKey,onClick:()=>o(s),className:"flex w-full cursor-[var(--control-cursor)] items-start gap-2.5 rounded-md px-2 py-1.5 text-left transition-colors hover:bg-accent",children:[l("span",{className:"shrink-0 pt-px font-mono text-ui-2xs text-muted-foreground tabular-nums",children:i}),v("span",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[v("span",{className:"flex items-start gap-1",children:[l("span",{className:"line-clamp-2 min-w-0 flex-1 font-medium text-chat leading-snug",children:c}),u?l(ju,{summary:u}):null]}),s.assistantText?l("span",{className:"line-clamp-1 text-ui-xs text-muted-foreground leading-snug",children:s.assistantText}):null,m?.outputTokens!==void 0?l("span",{className:"font-mono text-ui-2xs text-muted-foreground tabular-nums",children:ni(m.outputTokens)}):null]})]}),u&&r?l("div",{className:"pb-1 pl-7 pr-2",children:l(Gu,{summary:u,...r})}):null]},s.sectionKey)})}function mB({context:e,useSummaries:t,...o}){let n=t(e.target),r=W(()=>new Map(n.map(s=>[s.turnId,s])),[n]),[,a]=Ge(e.threadKey,null,{namespace:_g});return l(Jb,{...o,summaries:r,actions:{onLocate:s=>{a(i=>({rowId:s,nonce:(i?.nonce??0)+1})),o.onClose(),e.openTrajectory()},onOpenFileDiff:e.onOpenFileDiff}})}var fB=new Map;function Zb(e){let t=e.summaryContext;return t?.data.useTurnSummaries?l(mB,{...e,context:t,useSummaries:t.data.useTurnSummaries}):l(Jb,{...e,summaries:fB})}function gB({totals:e}){let{t}=z();if(!e)return null;let o=Hb(e),n=[e.outputTokens===void 0?null:{label:t("turnNavigator.usageOutput"),value:ni(e.outputTokens)},e.inputTokens===void 0?null:{label:t("turnNavigator.usageInput"),value:ni(e.inputTokens)},e.cachedInputTokens===void 0?null:{label:t("turnNavigator.usageCacheRead"),value:o===null?ni(e.cachedInputTokens):`${ni(e.cachedInputTokens)} (${o})`}].filter(r=>r!==null);return n.length===0?null:v("div",{className:"flex items-baseline gap-2 border-t px-2 py-1.5",children:[l("span",{className:"flex-1 font-mono text-ui-2xs text-muted-foreground uppercase tracking-[0.14em]",children:t("turnNavigator.usage")}),n.map(r=>v("span",{className:"shrink-0 font-mono text-ui-2xs text-muted-foreground tabular-nums",children:[r.label," ",r.value]},r.label))]})}var hB=pe(function({getText:t,size:o="xs",variant:n="outline",className:r}){let{t:a}=z(),s=Nt().writeClipboard,[i,d]=q(!1),c=a("turnNavigator.copyMarkdown");return v(Pe,{children:[l(Ee,{render:l(K,{"aria-label":c,disabled:i,onClick:()=>{s(t()).then(()=>{d(!0),window.setTimeout(()=>d(!1),1e3)})},type:"button",size:o,variant:n,className:V("text-muted-foreground hover:text-foreground",r)}),children:i?l(jo,{className:"size-3 text-primary"}):l(Ba,{className:"size-3"})}),l(Re,{children:l("p",{children:c})})]})});function ew({items:e,totalTurnCount:t,bottomInset:o,usageByTurnId:n,onSelect:r,exportMarkdown:a,onDownload:s,placement:i="float",summaryContext:d}){let{t:c}=z(),[u,m]=q(!1),p=W(()=>e.map((y,x)=>({item:y,ordinal:x+1})).reverse(),[e]),f=W(()=>Ub(p.map(({item:y})=>y.turnId===null?void 0:n.get(y.turnId))),[p,n]);if(e.length===0)return null;let g=t??e.length,h=c("turnNavigator.open",{count:g});return v(rn,{onOpenChange:m,open:u,children:[v(sn,{render:l(K,{"aria-label":h,className:V("gap-1.5 rounded-full px-3",i==="float"&&"absolute right-3 z-40"),"data-testid":"turn-navigator-pill",size:"xs",style:i==="float"?{bottom:o+12}:void 0,title:h,variant:"glass"}),children:[l(td,{"aria-hidden":!0}),l("span",{className:"font-mono font-semibold tabular-nums",children:g})]}),l(an,{align:"end",className:"w-80 flex-col",side:"top",children:v("div",{className:"flex max-h-[min(60vh,26rem)] flex-col",children:[v("div",{className:"flex items-center gap-1.5 border-b px-2 py-1.5",children:[l("span",{className:"flex-1 font-mono text-ui-2xs text-muted-foreground uppercase tracking-[0.14em]",children:c("turnNavigator.title")}),l("span",{className:"font-mono text-ui-2xs text-muted-foreground tabular-nums",children:g})]}),l("div",{className:V("min-h-0 flex-1 overflow-y-auto overflow-x-hidden p-1"),children:l(Zb,{rows:p,usageByTurnId:n,summaryContext:d,onSelect:y=>{m(!1),r(y)},onClose:()=>m(!1)})}),l(gB,{totals:f}),v("div",{className:"flex items-center gap-1 border-t px-2 py-1.5",children:[l("span",{className:"flex-1 font-mono text-ui-2xs text-muted-foreground uppercase tracking-[0.14em]",children:c("turnNavigator.export")}),l(hB,{size:"icon-xs",getText:a,variant:"ghost"}),l(K,{"aria-label":c("turnNavigator.downloadMarkdown"),onClick:()=>s("md"),size:"xs",title:c("turnNavigator.downloadMarkdown"),variant:"ghost",children:l("span",{className:"font-mono",children:".md"})}),l(K,{"aria-label":c("turnNavigator.downloadJson"),onClick:()=>s("json"),size:"xs",title:c("turnNavigator.downloadJson"),variant:"ghost",children:l("span",{className:"font-mono",children:".json"})})]})]})})]})}$();function Sd(e){return e.replace(/\s+/g," ")}function yB(e,t){let o=e.slice(Math.max(0,e.length-t));return/^[\uDC00-\uDFFF]/.test(o)&&(o=o.slice(1)),o}function vB(e,t){let o=e.slice(0,t);return/[\uD800-\uDBFF]$/.test(o)&&(o=o.slice(0,-1)),o}function Qu(e){let o=(e instanceof Element?e:e?.parentElement??null)?.closest("[data-assistant-quote-body]")??null;return o?.closest('[data-message-role="assistant"]')?o:null}function tw(e){if(!e||e.isCollapsed||e.rangeCount===0)return null;let t=e.getRangeAt(0),o=Qu(t.startContainer);if(o===null||Qu(t.endContainer)!==o)return null;let n=o.closest("[data-message-id]")?.dataset.messageId;if(!n)return null;let r=e.toString().trim();if(r.length===0)return null;let a=document.createRange();a.selectNodeContents(o),a.setEnd(t.startContainer,t.startOffset);let s=document.createRange();s.selectNodeContents(o),s.setStart(t.endContainer,t.endOffset);let i=Sd(t.toString()),d=i.length>i.trimStart().length?" ":"",c=i.length>i.trimEnd().length?" ":"",u=Sd(a.toString()+d),m=Sd(c+s.toString()),p=u.length,f=p+i.trim().length,g=t.getClientRects(),h=g[0]??t.getBoundingClientRect(),y=g[g.length-1]??h;return{messageId:n,text:r,start:p,end:f,prefix:yB(u,32),suffix:vB(m,32),anchor:{x:y.right,top:h.top,bottom:y.bottom}}}var Xu="assistant-quote-inserter",Yu="assistant-quote-open-comment";var CB=300;function ow(e){let{data:t,target:o,threadKey:n,surfaceRef:r}=e,{t:a}=z(),s=$e(n,null,{namespace:Xu}),[,i]=Ge(n,null,{namespace:Yu}),[d,c]=q(null),u=E(null);if(H(()=>{let h,y=()=>{let k=r.current,I=document.getSelection(),T=I&&I.rangeCount>0?I.getRangeAt(0):null;if(!k||!T||!k.contains(T.commonAncestorContainer)){c(null);return}let S=tw(I);if(S===null){c(null);return}let P=t.assistantQuotes.serialize({version:1,environmentId:o.environmentId,threadId:o.threadId,messageId:S.messageId,text:S.text,start:S.start,end:S.end,prefix:S.prefix,suffix:S.suffix});c({source:P,...S.anchor})},x=k=>{u.current?.contains(k.target)||(clearTimeout(h),h=setTimeout(y,CB))},C=k=>{u.current?.contains(k.target)||(clearTimeout(h),c(null))},b=()=>c(null),L=k=>{k.key==="Escape"&&c(null)},w=()=>{(document.getSelection()?.isCollapsed??!0)&&c(null)};return document.addEventListener("pointerup",x,!0),document.addEventListener("keyup",x,!0),document.addEventListener("pointerdown",C,!0),document.addEventListener("keydown",L,!0),document.addEventListener("selectionchange",w),window.addEventListener("scroll",b,!0),()=>{clearTimeout(h),document.removeEventListener("pointerup",x,!0),document.removeEventListener("keyup",x,!0),document.removeEventListener("pointerdown",C,!0),document.removeEventListener("keydown",L,!0),document.removeEventListener("selectionchange",w),window.removeEventListener("scroll",b,!0)}},[t,r,o.environmentId,o.threadId]),d===null)return null;let m=d.source,p=Math.max(8,Math.min(window.innerWidth-200,d.x-12)),f=d.bottom+6,g=f+40<=window.innerHeight?f:Math.max(8,d.top-40);return l("div",{ref:u,className:"fixed z-50 rounded-control-3 bg-background",style:{left:p,top:g},"data-assistant-quote-toolbar":"",children:v(K,{size:"sm",variant:"outline",className:"shadow-md",disabled:m===null,title:m===null?a("timeline.quote.tooLong"):void 0,onMouseDown:h=>h.preventDefault(),onClick:()=>{m!==null&&s.current?.(m)===!0&&(i(m),document.getSelection()?.removeAllRanges(),c(null))},children:[l(hr,{"aria-hidden":"true"}),a("timeline.quote.cite")]})})}$();$();function nw(e){let t=e.map(n=>({key:n.key,turnId:n.turnId,firstRowIndex:n.firstRowIndex,endRowIndex:n.firstRowIndex+n.rowIds.length})),o=new Map;for(let n of e)for(let[r,a]of n.rowIds.entries())o.set(a,{turnId:n.turnId,index:n.firstRowIndex+r});return{sections:t,bySectionKey:new Map(t.map(n=>[n.key,n])),byRowId:o}}function Ju({index:e,visibleSectionKeys:t,protectedRowIds:o,selectionRows:n}){let r=t.flatMap(c=>{let u=e.bySectionKey.get(c)?.turnId;return u==null?[]:[u]}),a=o.flatMap(c=>{let u=e.byRowId.get(c)?.turnId;return u==null?[]:[u]}),s=n?e.byRowId.get(n.firstRowId)?.index:void 0,i=n?e.byRowId.get(n.lastRowId)?.index:void 0,d=s===void 0||i===void 0?[]:e.sections.flatMap(c=>c.turnId!==null&&c.endRowIndex>Math.min(s,i)&&c.firstRowIndex<=Math.max(s,i)?[c.turnId]:[]);return{firstTurnId:r[0]??null,lastTurnId:r.at(-1)??null,protectedTurnIds:[...new Set(a)],selectionTurnRange:d.length>0?{firstTurnId:d[0],lastTurnId:d.at(-1)}:null}}function rw(e,t,o,n){if(!n)return o;let r=e.findIndex(a=>t.has(a));return r<0?o:Math.max(o,e.length-r)}$();$();function Og(e,t){for(let o of e.querySelectorAll("[data-timeline-row-id]"))if(o.dataset.timelineRowId===t)return o;return null}function Ga(e,t){let o=0,n=e.length,r=-1;for(;o<n;){let a=Math.floor((o+n)/2),i=e[a].getBoundingClientRect();Math.max(i.bottom,i.top+1)>t?(r=a,n=a):o=a+1}return r}function xB(e){let t=e.getBoundingClientRect().top,o=e.querySelectorAll("[data-timeline-turn-section]"),n=a=>{let s=a.querySelectorAll("[data-timeline-row-id]"),i=Ga(s,t),d=i<0?void 0:s[i],c=d?.dataset.timelineRowId;return!d||c===void 0?null:{rowId:c,offsetPx:Math.round(t-d.getBoundingClientRect().top)}};if(o.length===0)return n(e);let r=Ga(o,t);if(r<0)return null;for(let a=r;a<o.length;a+=1){let s=n(o[a]);if(s)return s}return null}function aw(e,t){let o=0,n=e;for(;n&&n!==t;)o+=n.offsetTop,n=n.offsetParent;return o}var Fg=class extends ur{getSnapshotBeforeUpdate(t){return t.inputKey!==this.props.inputKey&&t.onBeforeInputChange(),null}componentDidUpdate(){}componentWillUnmount(){this.props.onBeforeInputChange()}render(){return this.props.children}};function sw({inputKey:e,onBeforeInputChange:t,handleRef:o,onAttach:n,className:r,children:a,onScroll:s,onInteractionRowsChange:i}){let d=E(null),c=E({inputKey:e,store:hd()});c.current.inputKey!==e&&(c.current={inputKey:e,store:hd()});let u=E(i);u.current=i;let m=R(f=>{let g=c.current;return g.store.acquire(f,()=>{c.current===g&&u.current?.(g.store.rows())})},[]);fe(()=>{i?.(c.current.store.rows())},[e,i]),pr(o,()=>({get node(){return d.current},measure:()=>{let f=d.current;return f?{scroll:f.scrollTop,scrollLength:f.clientHeight,contentLength:f.scrollHeight,topOf:g=>{let h=Og(f,g);return h===null?null:aw(h,f)},heightOf:g=>{let h=Og(f,g);return h===null?null:h.offsetHeight},rowAtScroll:()=>xB(f)}:null},scrollToEnd:f=>{let g=d.current;if(g){if(f?.animated){g.scrollTo({top:g.scrollHeight,behavior:"smooth"});return}g.scrollTop=g.scrollHeight-g.clientHeight}},scrollToRow:(f,g)=>{let h=d.current;if(!h)return!1;let y=Og(h,f);return y?(h.scrollTop=Math.max(0,aw(y,h)-(g?.viewOffset??0)),!0):!1},scrollToOffset:f=>{let g=d.current;g&&(g.scrollTop=Math.max(0,f))}}),[]);let p=R(f=>{d.current=f,n(f)},[n]);return l(Fg,{inputKey:e,onBeforeInputChange:t,children:l(gd,{value:m,children:l("div",{ref:p,className:r,style:{position:"relative"},onScroll:s,children:a})})})}function ai(e){if(!e)return!1;let t=e.tagName?.toLowerCase(),o=e.getAttribute?.("contenteditable");if(t==="textarea"||o==="true"||o===""||o==="plaintext-only"||"isContentEditable"in e&&e.isContentEditable===!0)return!0;if(t==="input"){let n=e.getAttribute?.("type")?.toLowerCase()??"text";if(!["button","submit","reset","image","checkbox","radio"].includes(n))return!0}return e.matches?.(":focus-visible")??!1}function ri(e,t){let n=(e?.nodeType===1?e:e?.parentElement)?.closest("[data-timeline-row-id]");return n&&t.contains(n)?n.dataset.timelineRowId??null:null}function Zu(e){let t=e.ownerDocument.getSelection?.();if(!t||t.isCollapsed)return null;let o=null,n=null;for(let c=0;c<t.rangeCount;c+=1){let u=t.getRangeAt(c);u.intersectsNode(e)&&(o??=u,n=u)}if(!o||!n)return null;let r=ri(o.startContainer,e),a=ri(n.endContainer,e);if(r&&a)return{firstRowId:r,lastRowId:a};let s=e.querySelectorAll("[data-timeline-row-id]"),i=s[0]?.dataset.timelineRowId,d=s[s.length-1]?.dataset.timelineRowId;return i&&d?{firstRowId:r??i,lastRowId:a??d}:null}function kd(e){let t=e.ownerDocument.getSelection?.();if(!t||t.isCollapsed)return!1;for(let o=0;o<t.rangeCount;o+=1)if(t.getRangeAt(o).intersectsNode(e))return!0;return!1}$();function Zr(e){let t=E(e);t.current=e;let o=E(!1),n=E(null),r=E(null),a=E(0),s=R(()=>{a.current+=1,r.current!==null&&cancelAnimationFrame(r.current),r.current=null},[]),i=R(()=>{if(!o.current||!t.current||r.current!==null||n.current===null)return;let u=++a.current;r.current=requestAnimationFrame(m=>{if(u!==a.current||(r.current=null,!o.current||!t.current))return;let p=n.current;n.current=null,p?.(m)})},[]),d=R(u=>{n.current=u,i()},[i]),c=R(()=>{n.current=null,s()},[s]);return fe(()=>(o.current=!0,i(),()=>{o.current=!1,s()}),[e,s,i]),W(()=>({request:d,cancel:c}),[d,c])}function iw({root:e,inputKey:t,visible:o,index:n,topInset:r,bottomInset:a,interactionRows:s,onRangeChange:i,onSelectionChange:d}){let c=E({inputKey:t,visible:o,index:n,topInset:r,bottomInset:a,interactionRows:s,onRangeChange:i,onSelectionChange:d});c.current={inputKey:t,visible:o,index:n,topInset:r,bottomInset:a,interactionRows:s,onRangeChange:i,onSelectionChange:d};let u=Zr(o),m=E(null),p=R(()=>{let g=c.current;if(!e||!g.visible||e.clientHeight<=0)return;let h=e.getBoundingClientRect();if(h.height<=0)return;let y=h.top+g.topInset,x=h.bottom-g.bottomInset,C=e.querySelectorAll("[data-timeline-turn-section]"),b=Ga(C,y),L=[];if(b>=0)for(let S=b;S<C.length;S+=1){let P=C[S];if(P.getBoundingClientRect().top>=x)break;P.dataset.timelineTurnSection!==void 0&&L.push(P.dataset.timelineTurnSection)}let w=[...g.interactionRows()],k=e.ownerDocument.activeElement;if(ai(k)){let S=ri(k,e);S&&w.push(S)}let I=Ju({index:g.index,visibleSectionKeys:L,protectedRowIds:w,selectionRows:Zu(e)}),T=`${g.inputKey}:${JSON.stringify(I)}`;T!==m.current&&(m.current=T,g.onRangeChange?.(I))},[e]),f=R(()=>u.request(p),[u,p]);return fe(()=>{if(m.current=null,!o||!e)return;let g=t,h=!0,y=()=>{!h||c.current.inputKey!==g||!c.current.visible||(c.current.onSelectionChange(kd(e)),f())};e.addEventListener("scroll",y,{passive:!0}),e.addEventListener("focusin",y),e.addEventListener("focusout",y),e.ownerDocument.addEventListener("selectionchange",y);let x=typeof ResizeObserver>"u"?null:new ResizeObserver(y);return x?.observe(e),e.firstElementChild&&x?.observe(e.firstElementChild),y(),()=>{h=!1,u.cancel(),x?.disconnect(),e.removeEventListener("scroll",y),e.removeEventListener("focusin",y),e.removeEventListener("focusout",y),e.ownerDocument.removeEventListener("selectionchange",y),i?.(null)}},[u,t,i,f,e,o]),fe(()=>{o&&f()},[n,f,o]),f}$();var lw=pe(function({sectionKey:t,rowKeyPrefix:o,rowIds:n,renderRow:r,sectionRef:a}){return l("div",{className:"session-turn","data-timeline-turn-section":t,ref:a,children:n.map(s=>l("div",{className:"transcript-col min-w-0 overflow-x-clip",children:r(s)},`${o}:${s}`))})});var bB=400;function dw({root:e,minimumCount:t,keepAbovePx:o=0,canCompact:n,onCompact:r}){let a=e.ownerDocument,s=new Set,i,d=!1,c=()=>e.scrollHeight-e.clientHeight-e.scrollTop<=2,u=()=>{if(i=void 0,a.hidden||s.size>0||!n()||e.clientHeight<=0||!c()||kd(e))return;let L=e.querySelectorAll("[data-timeline-turn-section]"),w=e.getBoundingClientRect().top-32-o,k=0,I=Math.max(0,L.length-t);for(;k<I;){let S=Math.floor((k+I)/2),P=L[S].getBoundingClientRect().bottom;if(!Number.isFinite(P))return;P<=w?k=S+1:I=S}if(k===0)return;let T=a.activeElement;if(T&&ai(T)){for(let S=0;S<k;S+=1)if(L[S].contains(T))return}r(L.length-k)},m=!1,p=()=>{if(a.hidden||s.size>0||!n()||m){clearTimeout(i),i=void 0;return}i===void 0&&(i=setTimeout(u,bB))},f=()=>{clearTimeout(i),i=void 0,p()},g=()=>{let L=c();!L||!d?f():p(),d=L},h=L=>{s.add(L.pointerId),f()},y=L=>{s.delete(L.pointerId),f()},x=()=>{m=kd(e),f()},C=()=>{s.clear(),f()},b=["wheel","keydown","focusin","focusout"];for(let L of b)e.addEventListener(L,f,{passive:!0});return e.addEventListener("scroll",g,{passive:!0}),e.addEventListener("pointerdown",h,!0),a.addEventListener("pointerup",y,!0),a.addEventListener("pointercancel",y,!0),a.addEventListener("selectionchange",x),a.addEventListener("visibilitychange",p),a.defaultView?.addEventListener("blur",C),p(),{schedule:p,disconnect:()=>{clearTimeout(i);for(let L of b)e.removeEventListener(L,f);e.removeEventListener("scroll",g),e.removeEventListener("pointerdown",h,!0),a.removeEventListener("pointerup",y,!0),a.removeEventListener("pointercancel",y,!0),a.removeEventListener("selectionchange",x),a.removeEventListener("visibilitychange",p),a.defaultView?.removeEventListener("blur",C)}}}$();function cw({root:e,topInsetPx:t,onActiveSectionChange:o,onActiveStartHiddenChange:n,active:r}){let a=E(r);a.current=r;let s=Zr(r),i=E(new Map),d=E(null),c=E(null),u=E(o);u.current=o;let m=E(n);m.current=n;let p=E(null),f=E(null),g=R(()=>{if(!a.current||!e)return;let b=e.scrollTop+t,L=null,w=Number.NEGATIVE_INFINITY,k=null,I=Number.POSITIVE_INFINITY;for(let[A,N]of i.current){if(!N.isConnected)continue;let B=N.offsetTop;B<I&&(I=B,k=A),B<=b&&B>=w&&(w=B,L=A)}let T=L??k;T!==c.current&&(c.current=T,u.current(T));let S=T===null?null:i.current.get(T)?.firstElementChild??null,P=S!==null&&S.getBoundingClientRect().bottom<=e.getBoundingClientRect().top+1;P!==p.current&&(p.current=P,m.current?.(P))},[e,t]),h=R(()=>{a.current&&s.request(g)},[s,g]);H(()=>{if(!r||!e||typeof IntersectionObserver>"u")return;let b=!0,L=new IntersectionObserver(()=>{!b||!a.current||h()},{root:e,rootMargin:`-${t}px 0px 0px 0px`,threshold:0});d.current=L;for(let k of i.current.values())L.observe(k);let w=new IntersectionObserver(()=>{!b||!a.current||h()},{root:e,threshold:0});f.current=w;for(let k of i.current.values())k.firstElementChild&&w.observe(k.firstElementChild);return h(),()=>{b=!1,L.disconnect(),d.current=null,w.disconnect(),f.current=null,s.cancel()}},[r,s,h,e,t]);let y=E(new Map),x=R(b=>{let L=y.current.get(b);if(L)return L;let w=k=>{let I=i.current.get(b);I&&I!==k&&(d.current?.unobserve(I),I.firstElementChild&&f.current?.unobserve(I.firstElementChild),i.current.delete(b)),k?(i.current.set(b,k),d.current?.observe(k),k.firstElementChild&&f.current?.observe(k.firstElementChild)):y.current.get(b)===w&&y.current.delete(b)};return y.current.set(b,w),w},[]),C=R(()=>{a.current&&(c.current=null,p.current=null,h())},[h]);return W(()=>({observeSection:x,refresh:C}),[x,C])}function ep(e,t){return e===t?!0:!e||!t?!1:e.identity===t.identity&&e.instanceId===t.instanceId&&e.driverKind===t.driverKind&&e.providerDisplayName===t.providerDisplayName&&e.accentColor===t.accentColor&&e.modelLabel===t.modelLabel&&e.effortLabel===t.effortLabel&&e.effortLevel===t.effortLevel}function uw(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let o=0;o<e.length;o+=1)if(e[o]!==t[o])return!1;return!0}function pw(e,t){return e.turnId===t.turnId&&e.createdAt===t.createdAt&&ep(e.badge,t.badge)}function mw(e,t){if(e===t)return!0;if(e.kind!==t.kind||e.id!==t.id)return!1;switch(e.kind){case"turn-identity":return pw(e,t);case"turn-summary":{let o=t;return e.createdAt===o.createdAt&&e.copyText===o.copyText&&e.cardAnchor===o.cardAnchor&&e.footer===o.footer&&(e.identity===void 0?o.identity===void 0:o.identity!==void 0&&pw(e.identity,o.identity))}case"tool-group":{let o=t;return e.createdAt===o.createdAt&&e.groupId===o.groupId&&uw(e.entries,o.entries)}case"working":{let o=t;return e.createdAt===o.createdAt&&e.turnId===o.turnId&&e.compacting===o.compacting&&ep(e.modelBadge,o.modelBadge)}case"continuation-check":{let o=t;return e.createdAt===o.createdAt&&e.pluginIds.length===o.pluginIds.length&&e.pluginIds.every((n,r)=>n===o.pluginIds[r])}case"model-switch":{let o=t;return e.createdAt===o.createdAt&&e.pending===o.pending&&ep(e.badge,o.badge)}case"proposed-plan":return e.proposedPlan===t.proposedPlan;case"turn-plan":{let o=t;return e.createdAt===o.createdAt&&e.turnPlan.plan===o.turnPlan.plan}case"work":{let o=t;return e.isExpandedToolGroupEntry===o.isExpandedToolGroupEntry&&e.isLastExpandedToolGroupEntry===o.isLastExpandedToolGroupEntry&&uw(e.groupedEntries,o.groupedEntries)}case"message":{let o=t;return e.message===o.message&&e.presentation===o.presentation&&e.textTone===o.textTone&&e.durationStart===o.durationStart&&e.showAssistantMeta===o.showAssistantMeta&&e.showAssistantCopyButton===o.showAssistantCopyButton&&e.copyInFooter===o.copyInFooter&&e.assistantCopyStreaming===o.assistantCopyStreaming&&ep(e.modelBadge,o.modelBadge)}}}function wB(e,t,o){for(let n=t;n<o;n+=1){let r=e[n];switch(r.kind){case"turn-identity":return r.turnId;case"working":if(r.turnId!=null)return r.turnId;break;case"message":if(r.message.role==="assistant")return r.message.turnId;break;case"tool-group":if(r.entries[0]?.turnId!=null)return r.entries[0].turnId;break;case"work":if(r.groupedEntries[0]?.turnId!=null)return r.groupedEntries[0].turnId;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 fw(e,t,o=[]){let n=new Map(o.map(a=>[a.key,a])),r=[];for(let a of t){if(a.end<=a.start)continue;let s=wB(e,a.start,a.end),i=n.get(a.key);if(i!==void 0&&i.turnId===s&&TB(i,e,a.start,a.end)){r.push(i);continue}r.push({key:a.key,turnId:s,firstRowIndex:a.start,rowIds:e.slice(a.start,a.end).map(d=>d.id)})}return r}function TB(e,t,o,n){if(e.firstRowIndex!==o||e.rowIds.length!==n-o)return!1;for(let r=0;r<e.rowIds.length;r+=1)if(e.rowIds[r]!==t[o+r].id)return!1;return!0}function gw(e,t){let o=Math.max(0,Math.min(t,e)),n=e-o;return{startIndex:n,hasHiddenOlder:n>0}}function ja(e,t,o){let n=e.findIndex(r=>r.rowIds.includes(t));return n<0?o:Math.max(o,e.length-n)}function IB(e,t){let o=t.historyWindow,{status:n}=t,r={activities:t.activities,timelineEntries:t.timelineEntries,turnSummaries:t.turnSummaries,latestTurn:o?null:n.latestTurn,runningTurnId:o?null:n.runningTurnId,expandedTurnIds:t.expandedTurnIds,isWorking:!o&&n.isWorking,activeTurnStartedAt:o?null:n.activeTurnStartedAt,continuationCheck:o?null:n.continuationCheck??null,resolveModelBadge:t.resolveModelBadge,pendingModelSelection:o?null:n.pendingModelSelection},a=e.deriveGroups(r),s=n.latestTurn;if(o&&s&&s.completedAt!==null){let i=s.turnId;if(a.rows.some(c=>c.kind==="message"?c.message.role==="assistant"&&c.message.turnId===i:c.kind==="work"?c.groupedEntries.some(u=>u.turnId===i):c.kind==="tool-group"&&c.entries.some(u=>u.turnId===i)))return e.deriveGroups({...r,latestTurn:s})}return a}var SB=new Map,kB={markdown:()=>"",download(){}},LB=[],PB={latestTurn:null,latestAssistantMessageId:null,runningTurnId:null,isWorking:!1,workingStepLabel:null,stall:null,retry:null,activeTurnStartedAt:null,totalTurnCount:null,pendingModelSelection:null,scheduledWakes:LB},RB={inputs:null,structure:{rowIds:[],sections:[]},indexById:new Map,rows:[],meta:{status:PB,usageByTurnId:SB,exportApi:kB,finalAssistantMessageReceived:!1},version:0};function EB(e,t){if(e.length!==t.length)return!1;for(let o=0;o<e.length;o+=1)if(e[o]!==t[o])return!1;return!0}function MB(e,t,o,n){let r=IB(o,e),a=AB(t.structure.rowIds,r.rows),s=a?t.indexById:new Map(r.rows.map((g,h)=>[g.id,h])),i=r.rows.map((g,h)=>{let y=a?t.rows[h]:t.rows[t.indexById.get(g.id)??-1],x=y!==void 0&&mw(y,g)?y:g;return x!==y&&n.add(g.id),x});if(!a)for(let g of t.indexById.keys())s.has(g)||n.add(g);let d=fw(i,r.turnGroups,t.structure.sections),c=a?t.structure.rowIds:i.map(g=>g.id),u=a&&EB(t.structure.sections,d)?t.structure:{rowIds:c,sections:d},m=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===m?t.meta:{status:e.status,usageByTurnId:e.usageByTurnId,exportApi:e.exportApi,finalAssistantMessageReceived:m},f=n.size>0||u!==t.structure||p!==t.meta;return{inputs:e,structure:u,indexById:s,rows:i,meta:p,version:f?t.version+1:t.version}}function AB(e,t){if(e.length!==t.length)return!1;for(let o=0;o<e.length;o+=1)if(e[o]!==t[o].id)return!1;return!0}function si(e){return e.getStructure().rowIds.some(t=>e.getRow(t)?.kind==="message")}function hw(){let e=null,t=null,o=RB,n=new Set,r=0,a=new Set,s=new Map,i=()=>{if(e===null||o.inputs===e)return o;t??=e.derive.createRowsCache();let d=new Set;o=MB(e,o,t,d);for(let c of d)n.add(c);return o};return{setInputs(d){e=d},hasInputs:()=>e!==null,flush(){if(a.size===0&&s.size===0||e===null)return;let{version:d}=i();if(d===r&&n.size===0)return;r=d;let c=[...n];n.clear();for(let u of c){let m=s.get(u);if(m!==void 0)for(let p of Array.from(m))p()}for(let u of Array.from(a))u()},subscribe(d){return a.add(d),()=>{a.delete(d)}},subscribeRow(d,c){let u=s.get(d);return u===void 0&&(u=new Set,s.set(d,u)),u.add(c),()=>{u.delete(c),u.size===0&&s.get(d)===u&&s.delete(d)}},getStructure:()=>i().structure,getRow(d){let{indexById:c,rows:u}=i(),m=c.get(d);return m===void 0?void 0:u[m]},getRows:()=>i().rows,getMeta:()=>i().meta,getVersion:()=>i().version}}$();function tp(e){return Go(e.subscribe,e.getStructure,e.getStructure)}function yw(e,t){let o=R(r=>e.subscribeRow(t,r),[e,t]),n=R(()=>e.getRow(t),[e,t]);return Go(o,n,n)}function Wt(e,t,o=Object.is){let n=E(null),r=R(()=>{let a=e.getVersion(),s=n.current;if(s!==null&&s.store===e&&s.select===t&&s.version===a)return s.value;let i=t(e),d=s!==null&&s.store===e&&o(s.value,i)?s.value:i;return n.current={store:e,select:t,version:a,value:d},d},[e,t,o]);return Go(e.subscribe,r,r)}$();$();function vw(e,t){return e.getFullYear()!==new Date(t).getFullYear()}function Bg(e,t){return{month:e,day:"numeric",...t?{year:"numeric"}:{}}}function Cw(e){let t=new Intl.DateTimeFormat(e,Bg("numeric",!1)),o=new Intl.DateTimeFormat(e,Bg("numeric",!0)),n=(r,a)=>(vw(r,a)?o:t).format(r);return{ofDate:n,ofIso:(r,a)=>{let s=new Date(r);return Number.isNaN(s.getTime())?"":n(s,a)}}}function xw(e,t){let o=new Date(e);return Number.isNaN(o.getTime())?null:{date:o,formatParams:{date:Bg("short",vw(o,t))}}}function ww(e,t){let o={hour:"numeric",minute:"2-digit",...t?{second:"2-digit"}:{}};return e==="locale"?o:{...o,hour12:e==="12-hour"}}function NB(e){let t=e?.trim();if(t)try{return Intl.DateTimeFormat.supportedLocalesOf([t]),t}catch{return}}function DB(){return globalThis.window?.desktopBridge?.getSystemLocale?.()??null}var Tw=NB(DB()),bw=new Map;function Iw(e,t){let o=`${e}:${t?"seconds":"minutes"}`,n=bw.get(o);if(n)return n;let r=new Intl.DateTimeFormat(Tw,ww(e,t));return bw.set(o,r),r}function Hg(e){let t=new Date(e);return Number.isNaN(t.getTime())?null:t}function _B(e){return{...ww(e,!1),...e==="locale"?{hourCycle:Iw(e,!1).resolvedOptions().hourCycle}:{}}}function wn(e,t,o){let n=Hg(e);return n?o("timeline.timestampTooltip",{date:n,formatParams:{date:{..._B(t),year:"numeric",month:"long",day:"numeric"}}}):""}var Sw=Cw(Tw);function Jn(e,t,o,n=Date.now()){let r=Hg(e);if(!r)return"";let a=Iw(t,!1).format(r),s=new Date(n),i=new Date(s.getFullYear(),s.getMonth(),s.getDate()).getTime(),d=new Date(r.getFullYear(),r.getMonth(),r.getDate()).getTime(),c=Math.round((i-d)/864e5);return c<=0?a:c===1?o("relativeTime.yesterdayAt",{time:a}):`${Sw.ofDate(r,n)} ${a}`}function kw(e,t=Date.now()){return Sw.ofIso(e,t)}function Lw(e){let t=Hg(e);return t?`${t.getFullYear()}-${t.getMonth()+1}-${t.getDate()}`:""}$();var Fe=qe(null),op=qe(null);$();var ii=new Map,Pw=24,OB=4e3,FB=1024,Rw=16384;function Ug(e){let t=ii.get(e);if(t)return t;let o={values:new Map,listeners:new Set,stringLength:0};if(ii.set(e,o),ii.size>Pw){for(let[n,r]of ii)if(r.listeners.size===0&&n!==e&&(ii.delete(n),ii.size<=Pw))break}return o}function $g(e,t,o){return Ug(e).values.get(t)??o}function Ld(e,t,o,n=!0){let r=Ug(e);if(typeof o=="string"&&(o=o.slice(0,FB)),r.values.get(t)===o)return;let a=r.values.get(t);if(typeof a=="string"&&(r.stringLength-=a.length),r.values.delete(t),r.values.set(t,o),typeof o=="string"&&(r.stringLength+=o.length),r.stringLength>Rw){for(let[s,i]of r.values)if(!(typeof i!="string"||s===t)&&(r.values.delete(s),r.stringLength-=i.length,r.stringLength<=Rw))break}if(r.values.size>OB){let s=r.values.keys().next().value;if(s!==void 0){let i=r.values.get(s);typeof i=="string"&&(r.stringLength-=i.length),r.values.delete(s)}}n&&r.listeners.forEach(s=>s())}function $t(e,t,o){let n=R(i=>{let d=Ug(e);return d.listeners.add(i),()=>d.listeners.delete(i)},[e]),r=R(()=>$g(e,t,o),[e,t,o]),a=Go(n,r,r),s=R(i=>Ld(e,t,i),[e,t]);return[a,s]}function Ne(){let e=Nt().i18n.usePluginTranslation();return{t:(t,o)=>e(t,o)}}var li="chat-process-row flex w-full min-w-0 select-none items-center gap-1.5 px-2 text-left";$();$();var Va=class extends Error{reason;target;constructor(t,o,n){super(BB(t,o),n),this.name="ClipboardError",this.reason=t,this.target=o}};function BB(e,t){switch(e){case"unavailable":return`Clipboard API is unavailable while copying ${t}.`;case"write-failed":return`Failed to copy ${t} to the clipboard.`;case"read-unavailable":return`Clipboard API is unavailable while reading ${t}.`;case"read-failed":return`Failed to read ${t} from the clipboard.`}}function HB(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 o=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 n=o?.focus;typeof n=="function"&&n.call(o)}}async function UB(e,t="text"){if(typeof window>"u")throw new Va("unavailable",t);if(!e)return!1;if(typeof navigator>"u"||!navigator.clipboard?.writeText){if(HB(e))return!0;throw new Va("unavailable",t)}try{return await navigator.clipboard.writeText(e),!0}catch(o){throw new Va("write-failed",t,{cause:o})}}function np({timeout:e=2e3,target:t="text",onCopy:o,onError:n}={}){let[r,a]=q(!1),s=E(null),i=E(o),d=E(n),c=E(t),u=E(e);i.current=o,d.current=n,c.current=t,u.current=e;let m=R((p,f)=>{UB(p,c.current).then(g=>{g&&(s.current&&clearTimeout(s.current),a(!0),i.current?.(f),u.current!==0&&(s.current=setTimeout(()=>{a(!1),s.current=null},u.current)))},g=>{let h=g instanceof Error?g:new Error(String(g));console.error(h),d.current?.(h,f)})},[]);return H(()=>()=>{s.current&&clearTimeout(s.current)},[]),{copyToClipboard:m,isCopied:r}}var Ew=1e3,$B={unavailable:"copyButton.clipboardUnavailable","write-failed":"copyButton.copyFailedDetail"},ea=pe(function({text:t,size:o="xs",variant:n="outline",className:r,toastAnchor:a="above",label:s}){let{t:i}=Ne(),d=s??i("copyButton.copyToClipboard"),[c,u]=q(!1),[m,p]=q(null),f=E(null),g=(x,C)=>{f.current&&clearTimeout(f.current),p({title:x,description:C}),f.current=setTimeout(()=>{p(null),u(!1)},Ew)};H(()=>()=>{f.current&&clearTimeout(f.current)},[]);let{copyToClipboard:h,isCopied:y}=np({onCopy:()=>g(i("copyButton.copied")),onError:x=>g(i("copyButton.failedToCopy"),x instanceof Va&&(x.reason==="unavailable"||x.reason==="write-failed")?i($B[x.reason]):x.message),timeout:Ew});return v(Pe,{open:m!==null||c,onOpenChange:u,children:[l(Ee,{render:l(K,{"aria-label":d,softDisabled:y,onClick:()=>h(t),type:"button",size:o,variant:n,className:V("text-muted-foreground hover:text-foreground",r)}),children:y?l(jo,{className:"size-3 text-primary"}):l(Ba,{className:"size-3"})}),v(Re,{side:a==="above"?"top":"bottom",className:"max-w-72",role:m?"status":void 0,children:[l("span",{children:m?.title??d}),m?.description?l("span",{className:"block text-muted-foreground",children:m.description}):null]})]})});function rp({text:e,label:t,children:o}){return v("span",{className:"group/hover-copy inline-flex min-w-0 items-center gap-0.5",children:[o,l("span",{className:"inline-flex opacity-0 transition-opacity duration-(--control-duration) pointer-events-none group-focus-within/hover-copy:pointer-events-auto group-focus-within/hover-copy:opacity-100 group-hover/hover-copy:pointer-events-auto group-hover/hover-copy:opacity-100 [@media(pointer:coarse)]:pointer-events-auto [@media(pointer:coarse)]:opacity-100",children:l(ea,{text:e,label:t,variant:"ghost",size:"icon-xs",className:"shrink-0",toastAnchor:"below"})})]})}$();var zB=new Map([[".m4v","video/mp4"],[".mov","video/quicktime"],[".mp4","video/mp4"],[".ogv","video/ogg"],[".webm","video/webm"]]),KB=new Map([[".aac","audio/aac"],[".flac","audio/flac"],[".m4a","audio/mp4"],[".mp3","audio/mpeg"],[".oga","audio/ogg"],[".ogg","audio/ogg"],[".opus","audio/ogg"],[".wav","audio/wav"],[".weba","audio/webm"]]),Mw=new Set([".doc",".docx",".odt",".ppt",".pptx",".odp",".xls",".xlsx",".ods"]);function Aw(e){let t=zg(e);return zB.has(t)?"video":KB.has(t)?"audio":null}function zg(e){let t=e.split(/[\\/]/).at(-1)??"",o=t.lastIndexOf(".");return o<=0?"":t.slice(o).toLowerCase()}var qB=["image/gif","image/jpeg","image/png","image/webp"],WB=new Set(qB);function GB(e){return WB.has(e.toLowerCase())}function Nw(e){return GB(e)?"image":"file"}var jB=new Set(["application/json","application/xml","application/x-yaml","application/yaml"]);function Tn(e){if(e.type==="image")return"image";let t=e.mimeType.toLowerCase();if(t==="image/svg+xml")return"svg";if(t==="application/pdf")return"pdf";let o=Aw(e.name);return o||(Mw.has(zg(e.name))?"office":t.startsWith("text/")||jB.has(t)?"text":"file")}function di(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 ap(e,t){let o=e.flatMap(r=>r.previewUrl?[{...r,src:r.previewUrl}]:[]);if(o.length===0)return null;let n=o.findIndex(r=>r.id===t);return n<0?null:{images:o.map(r=>({src:r.src,name:r.name,attachmentId:r.id,...r.source===void 0?{}:{source:r.source},...r.type!==void 0&&r.mimeType!==void 0&&Tn({type:r.type,mimeType:r.mimeType,name:r.name})==="svg"?{svg:!0}:{}})),index:n}}function sp(e){switch(e){case"image":case"svg":return Yl;case"video":return $r;case"audio":return xn;case"pdf":return Ha;case"office":return ql;case"text":return Kl;case"file":return Vo}}function Cr(e){let t=Tn(e);return t==="image"||t==="svg"}function Kg(e){let t={id:e.id,name:e.name,mimeType:e.mimeType,sizeBytes:e.sizeBytes};return Nw(e.mimeType)==="image"?{type:"image",...t}:{type:"file",...t,...e.source?{source:e.source}:{}}}function Oo(e){return e.source?._tag==="agent-artifact"?e.source:void 0}function qg({rowId:e,messageId:t,attachments:o}){let n=xe(Fe),[r,a]=$t(n.threadKey,`attachments:${t}`,!1),{t:s}=Ne(),i=o.toSorted((c,u)=>+(Oo(u)?.delivered===!0)-+(Oo(c)?.delivered===!0)),d=r?i:i.slice(0,4);return o.length===0?null:v("div",{className:"mb-2 max-w-[420px]","data-assistant-attachments":"",children:[l("div",{className:"grid grid-cols-2 items-start gap-2",children:d.map(c=>l("div",{className:"min-w-0",children:Cr(c)?l(Pd,{images:[c],gallery:i.filter(Cr)}):l(Rd,{attachment:c})},c.id))}),!r&&i.length>4?l(K,{variant:"ghost",size:"xs",className:"mt-1","aria-expanded":!1,onClick:()=>{n.onProcessDisclosureChange?.(e),a(!0)},children:s("attachments.showMore")}):null]})}function Pd({images:e,gallery:t}){let o=xe(Fe),{t:n}=Ne();return e.length===0?null:l("div",{className:t?"grid":"mb-2 grid max-w-[420px] grid-cols-2 gap-2",children:e.map(r=>v("div",{className:"overflow-hidden rounded-lg border border-border/80 bg-background/70",children:[r.previewUrl?l("button",{type:"button",className:"w-full cursor-zoom-in","data-attachment-action":"preview","data-attachment-name":r.name,"aria-label":n("attachments.preview",{name:r.name}),onClick:()=>{let a=ap(t??e,r.id);a&&o.onImageExpand(a)},children:l("img",{src:r.previewUrl,alt:r.name,loading:"lazy",decoding:"async",className:Tn(r)==="svg"?"block h-auto max-h-[220px] w-full bg-white object-contain":"block h-auto max-h-[220px] w-full object-cover object-top"})}):l("div",{className:"flex min-h-[72px] items-center justify-center px-2 py-3 text-center text-secondary-label text-chat-dense",children:r.name}),Oo(r)?.delivered||Oo(r)?.title||Oo(r)?.note?v("div",{className:"px-2 py-1 text-chat-meta",children:[l("p",{className:"break-words font-medium",children:Oo(r)?.title||r.name}),Oo(r)?.note?l("p",{className:"whitespace-pre-wrap break-words text-secondary-label",children:Oo(r)?.note}):null]}):null]},r.id))})}function Rd(e){let{t}=Ne(),o=xe(Fe).onAttachmentDocumentOpen,n=Tn(e.attachment),r=sp(n),a=t("attachments.open",{name:e.attachment.name}),s=v(oe,{children:[l(r,{className:"size-4 shrink-0 text-secondary-label"}),v("span",{className:"min-w-0 flex-1",children:[l("span",{className:"block truncate font-medium text-foreground text-chat-row",children:Oo(e.attachment)?.title||e.attachment.name}),Oo(e.attachment)?.note?l("span",{className:"block whitespace-pre-wrap break-words text-secondary-label text-chat-meta",children:Oo(e.attachment)?.note}):null,l("span",{className:"block text-secondary-label text-chat-meta",children:Oo(e.attachment)?.fileCount?t("attachments.folderFiles",{count:Oo(e.attachment).fileCount}):di(e.attachment.sizeBytes)})]})]});return!Oo(e.attachment)?.delivered&&e.attachment.previewUrl&&(n==="video"||n==="audio")?v("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:[l("a",{href:e.attachment.previewUrl,target:"_blank",rel:"noreferrer","aria-label":a,className:"flex items-center gap-2 hover:underline",children:s}),l(_b,{kind:n,src:e.attachment.previewUrl,title:e.attachment.name})]}):o?l("button",{type:"button","data-attachment-action":"open","data-attachment-name":e.attachment.name,"aria-label":a,onClick:()=>o({attachmentId:e.attachment.id,name:e.attachment.name,mimeType:e.attachment.mimeType}),className:"flex w-full cursor-[var(--control-cursor)] items-center gap-2 rounded-sm border border-border/70 bg-background/70 px-2.5 py-2 text-start hover:bg-background/90",children:s}):e.attachment.previewUrl?l("a",{href:e.attachment.previewUrl,download:e.attachment.name,target:"_blank",rel:"noreferrer","aria-label":a,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:s}):l("div",{className:"flex items-center gap-2 rounded-sm border border-border/70 bg-background/70 px-2.5 py-2",children:s})}$();function VB({environmentId:e,pluginId:t}){let{t:o}=z();return Xn(e,t)??o("rewrite.unknownPlugin")}function ip({rewrite:e,text:t,environmentId:o}){let{t:n}=z(),[r,a]=q(!1);if(!e)return null;let s=[...new Set(e.steps.filter(c=>c.via==="before-send").map(c=>c.pluginId))],i=[...new Set(e.steps.filter(c=>c.via==="slash-command").map(c=>c.pluginId))],d=c=>c.map((u,m)=>v("span",{children:[m?", ":"",l(VB,{environmentId:o,pluginId:u})]},u));return v("div",{className:"max-w-full text-chat-row text-muted-foreground","data-message-rewrite":"",children:[l(K,{size:"xs",variant:"ghost",className:"h-auto min-h-6 max-w-full whitespace-normal text-xs","aria-expanded":r,"aria-label":n("rewrite.showReceived"),onClick:()=>a(c=>!c),children:v("span",{children:[i.length?v(oe,{children:[n("rewrite.expandedPrefix"),d(i),n("rewrite.expandedSuffix"),s.length?", ":""]}):null,s.length?v(oe,{children:[n("rewrite.changedPrefix"),d(s),n("rewrite.changedSuffix")]}):null]})}),r?v("div",{className:"mt-1 max-w-full rounded-md border border-border p-2",children:[l("p",{className:"mb-1 text-xs",children:n("rewrite.received")}),l("pre",{className:"whitespace-pre-wrap break-words font-sans text-xs [overflow-wrap:anywhere]",children:t})]}):null]})}$();$();var Ed=e=>e;function Zn(){return Nt().useThreadDisplayTitle?.()??Ed}$();var Dw=qe(null);function _w({data:e,target:t,children:o}){let n=W(()=>({data:e,target:t}),[e,t]);return l(Dw,{value:n,children:o})}function ci(){return xe(Dw)}function Ow({messageId:e}){let t=ci(),o=t?.data.useMessageForks;return!t||!o?null:l(QB,{read:o,target:t.target,messageId:e})}function QB({read:e,target:t,messageId:o}){let{t:n}=z(),r=Zn(),[a,s]=q(!1),{threads:i,openThread:d}=e(t,o);return i.length===0?null:v(rn,{open:a,onOpenChange:s,children:[l(sn,{render:l(K,{variant:"ghost",size:"xs"}),children:n("forkRelations.count",{count:i.length})}),l(an,{"aria-label":n("forkRelations.listTitle"),className:"max-h-72 max-w-80 overflow-y-auto p-1",children:i.map(c=>v(K,{variant:"ghost",className:"h-auto w-full flex-col items-start gap-0.5 py-2",onClick:()=>{s(!1),d(c.threadId)},children:[l("span",{className:"max-w-full truncate",children:r(c.title)}),l("time",{className:"text-chat-dense text-muted-foreground",dateTime:c.createdAt,children:new Date(c.createdAt).toLocaleString()})]},c.threadId))})]})}$();function Fw({messageId:e,rowId:t}){let o=ci(),n=o?.data.useMessageMemory,r=o?.data.useMemoryExperience;return!o||!n||!r?null:l(XB,{readMemory:n,readExperience:r,target:o.target,messageId:e,rowId:t})}function XB({readMemory:e,readExperience:t,target:o,messageId:n,rowId:r}){let a=e(o,n);return a===null?null:l(YB,{experienceIds:a.experienceIds,readExperience:t,target:o,messageId:n,rowId:r})}function YB({experienceIds:e,readExperience:t,target:o,messageId:n,rowId:r}){let{t:a}=z(),s=xe(Fe),[i,d]=$t(s.threadKey,`memory-context:${n}`,!1),c=ho();return v("div",{className:"flex min-w-0 flex-col items-start gap-1.5 self-stretch","data-memory-context":"",children:[v(K,{variant:"ghost-muted",size:"xs",className:"-ms-1 gap-1.5 [&_svg]:mx-0","aria-expanded":i,"aria-controls":i?c:void 0,onClick:()=>{s.onProcessDisclosureChange?.(r),d(!i)},children:[l(Tt,{"aria-hidden":!0,className:V("size-icon-1",!i&&"-rotate-90")}),l(Fl,{"aria-hidden":!0,className:"size-icon-1"}),a("memoryContext.included",{count:e.length})]}),i?l("ul",{id:c,className:"m-0 w-full max-w-xl list-none divide-y divide-border overflow-hidden rounded-xl border border-border bg-card p-0",children:e.map(u=>l(JB,{readExperience:t,target:o,experienceId:u},u))}):null]})}function JB({readExperience:e,target:t,experienceId:o}){let n=e(t,o);return v("li",{className:"flex min-w-0 items-center gap-2.5 py-2 ps-3 pe-2","data-memory-experience-state":n.state,children:[l(ZB,{experience:n}),l(eH,{experience:n})]})}function ZB({experience:e}){let{t}=z();switch(e.state){case"loading":return v("div",{className:"min-w-0 flex-1","aria-busy":"true",children:[l("span",{className:"sr-only",children:t("memoryContext.loading")}),l(Mg,{className:"h-4 w-3/4"}),l(Mg,{className:"mt-1 h-3 w-1/2"})]});case"failed":return l("p",{className:"m-0 min-w-0 flex-1 text-chat-row text-muted-foreground",children:t("memoryContext.loadFailed")});case"erased":return l("p",{className:"m-0 min-w-0 flex-1 text-chat-row text-muted-foreground",children:t("memoryContext.erased")});case"active":case"forgotten":{let o=e.state==="forgotten",n=e.recordedAt===null?null:xw(e.recordedAt,Date.now());return v("div",{className:"min-w-0 flex-1",children:[l("p",{className:V("m-0 line-clamp-2 text-ui-sm",e.title===null?"text-muted-foreground":"font-medium",o&&"text-muted-foreground line-through"),children:e.title??t("memoryContext.textUnavailable")}),n===null?null:l("p",{className:"m-0 text-chat-row text-muted-foreground",children:t("memoryContext.recordedBy",{author:e.authorLabel??"",...n})}),o?l("p",{className:"m-0 text-chat-row text-muted-foreground",children:t("memoryContext.forgottenNote")}):null]})}}}function eH({experience:e}){let{t}=z();switch(e.state){case"loading":case"erased":return null;case"failed":return l(K,{variant:"ghost",size:"xs",onClick:e.retry,children:t("memoryContext.retry")});case"active":case"forgotten":{let o=e.state==="forgotten";return v("div",{className:"flex shrink-0 items-center gap-1.5",children:[o?l(jr,{variant:"muted",size:"sm",children:t("memoryContext.forgotten")}):null,v(K,{variant:"ghost",size:"xs",disabled:e.pending,softDisabled:e.blockedReason!==null,title:e.blockedReason??void 0,onClick:o?e.restore:e.forget,children:[e.pending?l(Qs,{}):null,t(o?"memoryContext.restore":"memoryContext.forget")]})]})}}}$();var tH=()=>null;function lp(e){let t=(e.useMachineLabel??tH)(e.reference.environmentId),o=Zn();return v(oe,{children:[l("div",{className:"wrap-anywhere",children:o(e.reference.title)}),t===null?null:l("div",{className:"text-muted-foreground",children:t})]})}var oH=Object.freeze([]),nH=()=>oH;function Bw(e){return e.type==="file"&&e.source?._tag==="thread-reference"}function rH(e){return e.omitted===null?e.carried:v(oe,{children:[l("span",{className:"inline-block max-w-full",children:e.carried})," ",l("span",{className:"inline-block max-w-full",children:e.omitted})]})}function Hw(e){let t=xe(Fe),{t:o}=Ne(),r=(t.threadReferences?.useDeliveries??nH)(t.activeThreadEnvironmentId,e).filter(a=>a.status!=="unreadable");return r.length===0?null:l("ul",{"aria-label":o("threadReference.listLabel"),className:"flex min-w-0 max-w-[min(70%,40rem)] flex-col gap-0.5 text-chat-dense text-muted-foreground",children:r.map(a=>l(aH,{delivery:a},`${a.reference.environmentId}:${a.reference.threadId}`))})}function aH(e){let{delivery:t}=e,o=xe(Fe),{t:n}=Ne(),r=Zn(),a=s=>{let i={reference:t.reference};s.dispatchEvent(new CustomEvent(Hs,{bubbles:!0,detail:i}))};return l("li",{"data-thread-reference-delivery":t.status,className:"flex min-w-0",children:v(Pe,{children:[v(Ee,{render:l("button",{type:"button",className:"relative flex min-w-0 flex-1 cursor-[var(--control-cursor)] items-start gap-1 rounded-sm text-left hover:text-foreground pointer-coarse:after:absolute pointer-coarse:after:inset-0 pointer-coarse:after:min-h-11",onClick:s=>a(s.currentTarget)}),children:[l("span",{className:"flex h-lh shrink-0 items-center",children:l(gr,{"aria-hidden":"true",className:"size-3.5"})}),v("span",{className:"flex min-w-0 flex-1 flex-wrap gap-x-1",children:[l("span",{className:"max-w-max min-w-0 grow basis-24 truncate",children:n("threadReference.title",{title:r(t.reference.title)})}),l("span",{className:"max-w-full",children:t.status==="carried"?l(rH,{carried:n("threadReference.carried",{count:t.carriedMessages}),omitted:t.omittedMessages>0?n("threadReference.omitted",{count:t.omittedMessages}):null}):t.status==="missing"?n("threadReference.missing"):n("threadReference.loading")})]})]}),l(Re,{side:"top",className:"max-w-120 whitespace-normal leading-tight",children:l(lp,{reference:t.reference,useMachineLabel:o.threadReferences?.useMachineLabel})})]})})}$();var sH=/\n*<terminal_context>\n([\s\S]*?)\n<\/terminal_context>\s*$/,iH=/\n*<element_context>\n([\s\S]*?)\n<\/element_context>\s*$/,lH=/\n*<browser_annotation>\n((?:(?!<browser_annotation>)[\s\S])*)\n<\/browser_annotation>\s*$/;function Uw(e){let t=[],o=null,n=()=>{o&&(t.push({header:o.header,body:o.bodyLines.join(`
3517
+ `;$();$();var Nx=qe(null),Bs=Nx.Provider,Dx=qe(""),xu=Dx.Provider;function bu(){return Pt(Dx)}function Nt(){let e=Pt(Nx);if(e===null)throw new Error("Conversation UI has not been registered.");return e}var wu="ycodium:assistant-quote-open",Hs="ycodium:thread-reference-open";var Tu="conversation",bg="conversation.prompt-preview";var Iu="__ycodiumConversationBridge",wg="ycodium.conversation.rebindable-bridge.v1",Tg="conversation.pendingRequests";var Ml=18,_x=`ycodium.conversation.host-data.v${Ml}`,Ox=80,mr="\uFFFC";$();function Fx(e){var t,o,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var r=e.length;for(t=0;t<r;t++)e[t]&&(o=Fx(e[t]))&&(n&&(n+=" "),n+=o)}else for(o in e)e[o]&&(n&&(n+=" "),n+=o);return n}function Bx(){for(var e,t,o=0,n="",r=arguments.length;o<r;o++)(e=arguments[o])&&(t=Fx(e))&&(n&&(n+=" "),n+=t);return n}var Hx=Bx;var tF=(e,t)=>{let o=new Array(e.length+t.length);for(let n=0;n<e.length;n++)o[n]=e[n];for(let n=0;n<t.length;n++)o[e.length+n]=t[n];return o},oF=(e,t)=>({classGroupId:e,validator:t}),jx=(e=new Map,t=null,o)=>({nextPart:e,validators:t,classGroupId:o});var Ux=[],nF="arbitrary..",rF=e=>{let t=sF(e),{conflictingClassGroups:o,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:s=>{if(s.startsWith("[")&&s.endsWith("]"))return aF(s);let i=s.split("-"),d=i[0]===""&&i.length>1?1:0;return Vx(i,d,t)},getConflictingClassGroupIds:(s,i)=>{if(i){let d=n[s],c=o[s];return d?c?tF(c,d):d:c||Ux}return o[s]||Ux}}},Vx=(e,t,o)=>{if(e.length-t===0)return o.classGroupId;let r=e[t],a=o.nextPart.get(r);if(a){let c=Vx(e,t+1,a);if(c)return c}let s=o.validators;if(s===null)return;let i=t===0?e.join("-"):e.slice(t).join("-"),d=s.length;for(let c=0;c<d;c++){let u=s[c];if(u.validator(i))return u.classGroupId}},aF=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{let t=e.slice(1,-1),o=t.indexOf(":"),n=t.slice(0,o);return n?nF+n:void 0})(),sF=e=>{let{theme:t,classGroups:o}=e;return iF(o,t)},iF=(e,t)=>{let o=jx();for(let n in e){let r=e[n];kg(r,o,n,t)}return o},kg=(e,t,o,n)=>{let r=e.length;for(let a=0;a<r;a++){let s=e[a];lF(s,t,o,n)}},lF=(e,t,o,n)=>{if(typeof e=="string"){dF(e,t,o);return}if(typeof e=="function"){cF(e,t,o,n);return}uF(e,t,o,n)},dF=(e,t,o)=>{let n=e===""?t:Qx(t,e);n.classGroupId=o},cF=(e,t,o,n)=>{if(pF(e)){kg(e(n),t,o,n);return}t.validators===null&&(t.validators=[]),t.validators.push(oF(o,e))},uF=(e,t,o,n)=>{let r=Object.entries(e),a=r.length;for(let s=0;s<a;s++){let[i,d]=r[s];kg(d,Qx(t,i),o,n)}},Qx=(e,t)=>{let o=e,n=t.split("-"),r=n.length;for(let a=0;a<r;a++){let s=n[a],i=o.nextPart.get(s);i||(i=jx(),o.nextPart.set(s,i)),o=i}return o},pF=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,mF=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,o=Object.create(null),n=Object.create(null),r=(a,s)=>{o[a]=s,t++,t>e&&(t=0,n=o,o=Object.create(null))};return{get(a){let s=o[a];if(s!==void 0)return s;if((s=n[a])!==void 0)return r(a,s),s},set(a,s){a in o?o[a]=s:r(a,s)}}};var fF=[],$x=(e,t,o,n,r)=>({modifiers:e,hasImportantModifier:t,baseClassName:o,maybePostfixModifierPosition:n,isExternal:r}),gF=e=>{let{prefix:t,experimentalParseClassName:o}=e,n=r=>{let a=[],s=0,i=0,d=0,c,u=r.length;for(let h=0;h<u;h++){let y=r[h];if(s===0&&i===0){if(y===":"){a.push(r.slice(d,h)),d=h+1;continue}if(y==="/"){c=h;continue}}y==="["?s++:y==="]"?s--:y==="("?i++:y===")"&&i--}let m=a.length===0?r:r.slice(d),p=m,f=!1;m.endsWith("!")?(p=m.slice(0,-1),f=!0):m.startsWith("!")&&(p=m.slice(1),f=!0);let g=c&&c>d?c-d:void 0;return $x(a,f,p,g)};if(t){let r=t+":",a=n;n=s=>s.startsWith(r)?a(s.slice(r.length)):$x(fF,!1,s,void 0,!0)}if(o){let r=n;n=a=>o({className:a,parseClassName:r})}return n},hF=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((o,n)=>{t.set(o,1e6+n)}),o=>{let n=[],r=[];for(let a=0;a<o.length;a++){let s=o[a],i=s[0]==="[",d=t.has(s);i||d?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(s)):r.push(s)}return r.length>0&&(r.sort(),n.push(...r)),n}},yF=e=>({cache:mF(e.cacheSize),parseClassName:gF(e),sortModifiers:hF(e),postfixLookupClassGroupIds:vF(e),...rF(e)}),vF=e=>{let t=Object.create(null),o=e.postfixLookupClassGroups;if(o)for(let n=0;n<o.length;n++)t[o[n]]=!0;return t},CF=/\s+/,xF=(e,t)=>{let{parseClassName:o,getClassGroupId:n,getConflictingClassGroupIds:r,sortModifiers:a,postfixLookupClassGroupIds:s}=t,i=[],d=e.trim().split(CF),c="";for(let u=d.length-1;u>=0;u-=1){let m=d[u],{isExternal:p,modifiers:f,hasImportantModifier:g,baseClassName:h,maybePostfixModifierPosition:y}=o(m);if(p){c=m+(c.length>0?" "+c:c);continue}let x=!!y,C;if(x){let I=h.substring(0,y);C=n(I);let T=C&&s[C]?n(h):void 0;T&&T!==C&&(C=T,x=!1)}else C=n(h);if(!C){if(!x){c=m+(c.length>0?" "+c:c);continue}if(C=n(h),!C){c=m+(c.length>0?" "+c:c);continue}x=!1}let b=f.length===0?"":f.length===1?f[0]:a(f).join(":"),L=g?b+"!":b,w=L+C;if(i.indexOf(w)>-1)continue;i.push(w);let k=r(C,x);for(let I=0;I<k.length;++I){let T=k[I];i.push(L+T)}c=m+(c.length>0?" "+c:c)}return c},bF=(...e)=>{let t=0,o,n,r="";for(;t<e.length;)(o=e[t++])&&(n=Xx(o))&&(r&&(r+=" "),r+=n);return r},Xx=e=>{if(typeof e=="string")return e;let t,o="";for(let n=0;n<e.length;n++)e[n]&&(t=Xx(e[n]))&&(o&&(o+=" "),o+=t);return o},zx=(e,...t)=>{let o,n,r,a,s=d=>{let c=t.reduce((u,m)=>m(u),e());return o=yF(c),n=o.cache.get,r=o.cache.set,a=i,i(d)},i=d=>{let c=n(d);if(c)return c;let u=xF(d,o);return r(d,u),u};return a=s,(...d)=>a(bF(...d))},wF=[],qt=e=>{let t=o=>o[e]||wF;return t.isThemeGetter=!0,t},Yx=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Jx=/^\((?:(\w[\w-]*):)?(.+)\)$/i,TF=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,IF=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,SF=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,kF=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,LF=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,PF=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Br=e=>TF.test(e),We=e=>!!e&&!Number.isNaN(Number(e)),Kn=e=>!!e&&Number.isInteger(Number(e)),Ig=e=>e.endsWith("%")&&We(e.slice(0,-1)),fr=e=>IF.test(e),Zx=()=>!0,RF=e=>SF.test(e)&&!kF.test(e),Lg=()=>!1,EF=e=>LF.test(e),MF=e=>PF.test(e),AF=e=>!Ie(e)&&!Se(e),NF=e=>e.startsWith("@container")&&(e[10]==="/"&&e[11]!==void 0||e[11]==="s"&&e[16]!==void 0&&e.startsWith("-size/",10)||e[11]==="n"&&e[18]!==void 0&&e.startsWith("-normal/",10)),DF=e=>Hr(e,ob,Lg),Ie=e=>Yx.test(e),Da=e=>Hr(e,nb,RF),Kx=e=>Hr(e,zF,We),_F=e=>Hr(e,ab,Zx),OF=e=>Hr(e,rb,Lg),qx=e=>Hr(e,eb,Lg),FF=e=>Hr(e,tb,MF),Su=e=>Hr(e,sb,EF),Se=e=>Jx.test(e),Al=e=>_a(e,nb),BF=e=>_a(e,rb),Wx=e=>_a(e,eb),HF=e=>_a(e,ob),UF=e=>_a(e,tb),ku=e=>_a(e,sb,!0),$F=e=>_a(e,ab,!0),Hr=(e,t,o)=>{let n=Yx.exec(e);return n?n[1]?t(n[1]):o(n[2]):!1},_a=(e,t,o=!1)=>{let n=Jx.exec(e);return n?n[1]?t(n[1]):o:!1},eb=e=>e==="position"||e==="percentage",tb=e=>e==="image"||e==="url",ob=e=>e==="length"||e==="size"||e==="bg-size",nb=e=>e==="length",zF=e=>e==="number",rb=e=>e==="family-name",ab=e=>e==="number"||e==="weight",sb=e=>e==="shadow";var Gx=()=>{let e=qt("color"),t=qt("font"),o=qt("text"),n=qt("font-weight"),r=qt("tracking"),a=qt("leading"),s=qt("breakpoint"),i=qt("container"),d=qt("spacing"),c=qt("radius"),u=qt("shadow"),m=qt("inset-shadow"),p=qt("text-shadow"),f=qt("drop-shadow"),g=qt("blur"),h=qt("perspective"),y=qt("aspect"),x=qt("ease"),C=qt("animate"),b=()=>["auto","avoid","all","avoid-page","page","left","right","column"],L=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],w=()=>[...L(),Se,Ie],k=()=>["auto","hidden","clip","visible","scroll"],I=()=>["auto","contain","none"],T=()=>[Se,Ie,d],S=()=>[Br,"full","auto",...T()],P=()=>[Kn,"none","subgrid",Se,Ie],A=()=>["auto",{span:["full",Kn,Se,Ie]},Kn,Se,Ie],N=()=>[Kn,"auto",Se,Ie],B=()=>["auto","min","max","fr",Se,Ie],O=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],j=()=>["start","end","center","stretch","center-safe","end-safe"],U=()=>["auto",...T()],D=()=>[Br,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...T()],J=()=>[Br,"screen","full","dvw","lvw","svw","min","max","fit",...T()],G=()=>[Br,"screen","full","lh","dvh","lvh","svh","min","max","fit",...T()],M=()=>[e,Se,Ie],X=()=>[...L(),Wx,qx,{position:[Se,Ie]}],F=()=>["no-repeat",{repeat:["","x","y","space","round"]}],ee=()=>["auto","cover","contain",HF,DF,{size:[Se,Ie]}],Y=()=>[Ig,Al,Da],ae=()=>["","none","full",c,Se,Ie],te=()=>["",We,Al,Da],de=()=>["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"],ne=()=>[We,Ig,Wx,qx],Z=()=>["","none",g,Se,Ie],ve=()=>["none",We,Se,Ie],he=()=>["none",We,Se,Ie],Ae=()=>[We,Se,Ie],De=()=>[Br,"full",...T()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[fr],breakpoint:[fr],color:[Zx],container:[fr],"drop-shadow":[fr],ease:["in","out","in-out"],font:[AF],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[fr],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[fr],shadow:[fr],spacing:["px",We],text:[fr],"text-shadow":[fr],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Br,Ie,Se,y]}],container:["container"],"container-type":[{"@container":["","normal","size",Se,Ie]}],"container-named":[NF],columns:[{columns:[We,Ie,Se,i]}],"break-after":[{"break-after":b()}],"break-before":[{"break-before":b()}],"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:w()}],overflow:[{overflow:k()}],"overflow-x":[{"overflow-x":k()}],"overflow-y":[{"overflow-y":k()}],overscroll:[{overscroll:I()}],"overscroll-x":[{"overscroll-x":I()}],"overscroll-y":[{"overscroll-y":I()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:S()}],"inset-x":[{"inset-x":S()}],"inset-y":[{"inset-y":S()}],start:[{"inset-s":S(),start:S()}],end:[{"inset-e":S(),end:S()}],"inset-bs":[{"inset-bs":S()}],"inset-be":[{"inset-be":S()}],top:[{top:S()}],right:[{right:S()}],bottom:[{bottom:S()}],left:[{left:S()}],visibility:["visible","invisible","collapse"],z:[{z:[Kn,"auto",Se,Ie]}],basis:[{basis:[Br,"full","auto",i,...T()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[We,Br,"auto","initial","none",Ie]}],grow:[{grow:["",We,Se,Ie]}],shrink:[{shrink:["",We,Se,Ie]}],order:[{order:[Kn,"first","last","none",Se,Ie]}],"grid-cols":[{"grid-cols":P()}],"col-start-end":[{col:A()}],"col-start":[{"col-start":N()}],"col-end":[{"col-end":N()}],"grid-rows":[{"grid-rows":P()}],"row-start-end":[{row:A()}],"row-start":[{"row-start":N()}],"row-end":[{"row-end":N()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":B()}],"auto-rows":[{"auto-rows":B()}],gap:[{gap:T()}],"gap-x":[{"gap-x":T()}],"gap-y":[{"gap-y":T()}],"justify-content":[{justify:[...O(),"normal"]}],"justify-items":[{"justify-items":[...j(),"normal"]}],"justify-self":[{"justify-self":["auto",...j()]}],"align-content":[{content:["normal",...O()]}],"align-items":[{items:[...j(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...j(),{baseline:["","last"]}]}],"place-content":[{"place-content":O()}],"place-items":[{"place-items":[...j(),"baseline"]}],"place-self":[{"place-self":["auto",...j()]}],p:[{p:T()}],px:[{px:T()}],py:[{py:T()}],ps:[{ps:T()}],pe:[{pe:T()}],pbs:[{pbs:T()}],pbe:[{pbe:T()}],pt:[{pt:T()}],pr:[{pr:T()}],pb:[{pb:T()}],pl:[{pl:T()}],m:[{m:U()}],mx:[{mx:U()}],my:[{my:U()}],ms:[{ms:U()}],me:[{me:U()}],mbs:[{mbs:U()}],mbe:[{mbe:U()}],mt:[{mt:U()}],mr:[{mr:U()}],mb:[{mb:U()}],ml:[{ml:U()}],"space-x":[{"space-x":T()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":T()}],"space-y-reverse":["space-y-reverse"],size:[{size:D()}],"inline-size":[{inline:["auto",...J()]}],"min-inline-size":[{"min-inline":["auto",...J()]}],"max-inline-size":[{"max-inline":["none",...J()]}],"block-size":[{block:["auto",...G()]}],"min-block-size":[{"min-block":["auto",...G()]}],"max-block-size":[{"max-block":["none",...G()]}],w:[{w:[i,"screen",...D()]}],"min-w":[{"min-w":[i,"screen","none",...D()]}],"max-w":[{"max-w":[i,"screen","none","prose",{screen:[s]},...D()]}],h:[{h:["screen","lh",...D()]}],"min-h":[{"min-h":["screen","lh","none",...D()]}],"max-h":[{"max-h":["screen","lh",...D()]}],"font-size":[{text:["base",o,Al,Da]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,$F,_F]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Ig,Ie]}],"font-family":[{font:[BF,OF,t]}],"font-features":[{"font-features":[Ie]}],"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,Se,Ie]}],"line-clamp":[{"line-clamp":[We,"none",Se,Kx]}],leading:[{leading:[a,...T()]}],"list-image":[{"list-image":["none",Se,Ie]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Se,Ie]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:M()}],"text-color":[{text:M()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...de(),"wavy"]}],"text-decoration-thickness":[{decoration:[We,"from-font","auto",Se,Da]}],"text-decoration-color":[{decoration:M()}],"underline-offset":[{"underline-offset":[We,"auto",Se,Ie]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:T()}],"tab-size":[{tab:[Kn,Se,Ie]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Se,Ie]}],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",Se,Ie]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:X()}],"bg-repeat":[{bg:F()}],"bg-size":[{bg:ee()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Kn,Se,Ie],radial:["",Se,Ie],conic:[Kn,Se,Ie]},UF,FF]}],"bg-color":[{bg:M()}],"gradient-from-pos":[{from:Y()}],"gradient-via-pos":[{via:Y()}],"gradient-to-pos":[{to:Y()}],"gradient-from":[{from:M()}],"gradient-via":[{via:M()}],"gradient-to":[{to:M()}],rounded:[{rounded:ae()}],"rounded-s":[{"rounded-s":ae()}],"rounded-e":[{"rounded-e":ae()}],"rounded-t":[{"rounded-t":ae()}],"rounded-r":[{"rounded-r":ae()}],"rounded-b":[{"rounded-b":ae()}],"rounded-l":[{"rounded-l":ae()}],"rounded-ss":[{"rounded-ss":ae()}],"rounded-se":[{"rounded-se":ae()}],"rounded-ee":[{"rounded-ee":ae()}],"rounded-es":[{"rounded-es":ae()}],"rounded-tl":[{"rounded-tl":ae()}],"rounded-tr":[{"rounded-tr":ae()}],"rounded-br":[{"rounded-br":ae()}],"rounded-bl":[{"rounded-bl":ae()}],"border-w":[{border:te()}],"border-w-x":[{"border-x":te()}],"border-w-y":[{"border-y":te()}],"border-w-s":[{"border-s":te()}],"border-w-e":[{"border-e":te()}],"border-w-bs":[{"border-bs":te()}],"border-w-be":[{"border-be":te()}],"border-w-t":[{"border-t":te()}],"border-w-r":[{"border-r":te()}],"border-w-b":[{"border-b":te()}],"border-w-l":[{"border-l":te()}],"divide-x":[{"divide-x":te()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":te()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...de(),"hidden","none"]}],"divide-style":[{divide:[...de(),"hidden","none"]}],"border-color":[{border:M()}],"border-color-x":[{"border-x":M()}],"border-color-y":[{"border-y":M()}],"border-color-s":[{"border-s":M()}],"border-color-e":[{"border-e":M()}],"border-color-bs":[{"border-bs":M()}],"border-color-be":[{"border-be":M()}],"border-color-t":[{"border-t":M()}],"border-color-r":[{"border-r":M()}],"border-color-b":[{"border-b":M()}],"border-color-l":[{"border-l":M()}],"divide-color":[{divide:M()}],"outline-style":[{outline:[...de(),"none","hidden"]}],"outline-offset":[{"outline-offset":[We,Se,Ie]}],"outline-w":[{outline:["",We,Al,Da]}],"outline-color":[{outline:M()}],shadow:[{shadow:["","none",u,ku,Su]}],"shadow-color":[{shadow:M()}],"inset-shadow":[{"inset-shadow":["none",m,ku,Su]}],"inset-shadow-color":[{"inset-shadow":M()}],"ring-w":[{ring:te()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:M()}],"ring-offset-w":[{"ring-offset":[We,Da]}],"ring-offset-color":[{"ring-offset":M()}],"inset-ring-w":[{"inset-ring":te()}],"inset-ring-color":[{"inset-ring":M()}],"text-shadow":[{"text-shadow":["none",p,ku,Su]}],"text-shadow-color":[{"text-shadow":M()}],opacity:[{opacity:[We,Se,Ie]}],"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":[We]}],"mask-image-linear-from-pos":[{"mask-linear-from":ne()}],"mask-image-linear-to-pos":[{"mask-linear-to":ne()}],"mask-image-linear-from-color":[{"mask-linear-from":M()}],"mask-image-linear-to-color":[{"mask-linear-to":M()}],"mask-image-t-from-pos":[{"mask-t-from":ne()}],"mask-image-t-to-pos":[{"mask-t-to":ne()}],"mask-image-t-from-color":[{"mask-t-from":M()}],"mask-image-t-to-color":[{"mask-t-to":M()}],"mask-image-r-from-pos":[{"mask-r-from":ne()}],"mask-image-r-to-pos":[{"mask-r-to":ne()}],"mask-image-r-from-color":[{"mask-r-from":M()}],"mask-image-r-to-color":[{"mask-r-to":M()}],"mask-image-b-from-pos":[{"mask-b-from":ne()}],"mask-image-b-to-pos":[{"mask-b-to":ne()}],"mask-image-b-from-color":[{"mask-b-from":M()}],"mask-image-b-to-color":[{"mask-b-to":M()}],"mask-image-l-from-pos":[{"mask-l-from":ne()}],"mask-image-l-to-pos":[{"mask-l-to":ne()}],"mask-image-l-from-color":[{"mask-l-from":M()}],"mask-image-l-to-color":[{"mask-l-to":M()}],"mask-image-x-from-pos":[{"mask-x-from":ne()}],"mask-image-x-to-pos":[{"mask-x-to":ne()}],"mask-image-x-from-color":[{"mask-x-from":M()}],"mask-image-x-to-color":[{"mask-x-to":M()}],"mask-image-y-from-pos":[{"mask-y-from":ne()}],"mask-image-y-to-pos":[{"mask-y-to":ne()}],"mask-image-y-from-color":[{"mask-y-from":M()}],"mask-image-y-to-color":[{"mask-y-to":M()}],"mask-image-radial":[{"mask-radial":[Se,Ie]}],"mask-image-radial-from-pos":[{"mask-radial-from":ne()}],"mask-image-radial-to-pos":[{"mask-radial-to":ne()}],"mask-image-radial-from-color":[{"mask-radial-from":M()}],"mask-image-radial-to-color":[{"mask-radial-to":M()}],"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":L()}],"mask-image-conic-pos":[{"mask-conic":[We]}],"mask-image-conic-from-pos":[{"mask-conic-from":ne()}],"mask-image-conic-to-pos":[{"mask-conic-to":ne()}],"mask-image-conic-from-color":[{"mask-conic-from":M()}],"mask-image-conic-to-color":[{"mask-conic-to":M()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:X()}],"mask-repeat":[{mask:F()}],"mask-size":[{mask:ee()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Se,Ie]}],filter:[{filter:["","none",Se,Ie]}],blur:[{blur:Z()}],brightness:[{brightness:[We,Se,Ie]}],contrast:[{contrast:[We,Se,Ie]}],"drop-shadow":[{"drop-shadow":["","none",f,ku,Su]}],"drop-shadow-color":[{"drop-shadow":M()}],grayscale:[{grayscale:["",We,Se,Ie]}],"hue-rotate":[{"hue-rotate":[We,Se,Ie]}],invert:[{invert:["",We,Se,Ie]}],saturate:[{saturate:[We,Se,Ie]}],sepia:[{sepia:["",We,Se,Ie]}],"backdrop-filter":[{"backdrop-filter":["","none",Se,Ie]}],"backdrop-blur":[{"backdrop-blur":Z()}],"backdrop-brightness":[{"backdrop-brightness":[We,Se,Ie]}],"backdrop-contrast":[{"backdrop-contrast":[We,Se,Ie]}],"backdrop-grayscale":[{"backdrop-grayscale":["",We,Se,Ie]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[We,Se,Ie]}],"backdrop-invert":[{"backdrop-invert":["",We,Se,Ie]}],"backdrop-opacity":[{"backdrop-opacity":[We,Se,Ie]}],"backdrop-saturate":[{"backdrop-saturate":[We,Se,Ie]}],"backdrop-sepia":[{"backdrop-sepia":["",We,Se,Ie]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":T()}],"border-spacing-x":[{"border-spacing-x":T()}],"border-spacing-y":[{"border-spacing-y":T()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Se,Ie]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[We,"initial",Se,Ie]}],ease:[{ease:["linear","initial",x,Se,Ie]}],delay:[{delay:[We,Se,Ie]}],animate:[{animate:["none",C,Se,Ie]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[h,Se,Ie]}],"perspective-origin":[{"perspective-origin":w()}],rotate:[{rotate:ve()}],"rotate-x":[{"rotate-x":ve()}],"rotate-y":[{"rotate-y":ve()}],"rotate-z":[{"rotate-z":ve()}],scale:[{scale:he()}],"scale-x":[{"scale-x":he()}],"scale-y":[{"scale-y":he()}],"scale-z":[{"scale-z":he()}],"scale-3d":["scale-3d"],skew:[{skew:Ae()}],"skew-x":[{"skew-x":Ae()}],"skew-y":[{"skew-y":Ae()}],transform:[{transform:[Se,Ie,"","none","gpu","cpu"]}],"transform-origin":[{origin:w()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:De()}],"translate-x":[{"translate-x":De()}],"translate-y":[{"translate-y":De()}],"translate-z":[{"translate-z":De()}],"translate-none":["translate-none"],zoom:[{zoom:[Kn,Se,Ie]}],accent:[{accent:M()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:M()}],"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",Se,Ie]}],"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":M()}],"scrollbar-track-color":[{"scrollbar-track":M()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":T()}],"scroll-mx":[{"scroll-mx":T()}],"scroll-my":[{"scroll-my":T()}],"scroll-ms":[{"scroll-ms":T()}],"scroll-me":[{"scroll-me":T()}],"scroll-mbs":[{"scroll-mbs":T()}],"scroll-mbe":[{"scroll-mbe":T()}],"scroll-mt":[{"scroll-mt":T()}],"scroll-mr":[{"scroll-mr":T()}],"scroll-mb":[{"scroll-mb":T()}],"scroll-ml":[{"scroll-ml":T()}],"scroll-p":[{"scroll-p":T()}],"scroll-px":[{"scroll-px":T()}],"scroll-py":[{"scroll-py":T()}],"scroll-ps":[{"scroll-ps":T()}],"scroll-pe":[{"scroll-pe":T()}],"scroll-pbs":[{"scroll-pbs":T()}],"scroll-pbe":[{"scroll-pbe":T()}],"scroll-pt":[{"scroll-pt":T()}],"scroll-pr":[{"scroll-pr":T()}],"scroll-pb":[{"scroll-pb":T()}],"scroll-pl":[{"scroll-pl":T()}],"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",Se,Ie]}],fill:[{fill:["none",...M()]}],"stroke-w":[{stroke:[We,Al,Da,Kx]}],stroke:[{stroke:["none",...M()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},KF=(e,{cacheSize:t,prefix:o,experimentalParseClassName:n,extend:r={},override:a={}})=>(Us(e,"cacheSize",t),Us(e,"prefix",o),Us(e,"experimentalParseClassName",n),Lu(e.theme,a.theme),Lu(e.classGroups,a.classGroups),Lu(e.conflictingClassGroups,a.conflictingClassGroups),Lu(e.conflictingClassGroupModifiers,a.conflictingClassGroupModifiers),Us(e,"postfixLookupClassGroups",a.postfixLookupClassGroups),Us(e,"orderSensitiveModifiers",a.orderSensitiveModifiers),Pu(e.theme,r.theme),Pu(e.classGroups,r.classGroups),Pu(e.conflictingClassGroups,r.conflictingClassGroups),Pu(e.conflictingClassGroupModifiers,r.conflictingClassGroupModifiers),Sg(e,r,"postfixLookupClassGroups"),Sg(e,r,"orderSensitiveModifiers"),e),Us=(e,t,o)=>{o!==void 0&&(e[t]=o)},Lu=(e,t)=>{if(t)for(let o in t)Us(e,o,t[o])},Pu=(e,t)=>{if(t)for(let o in t)Sg(e,t,o)},Sg=(e,t,o)=>{let n=t[o];n!==void 0&&(e[o]=e[o]?e[o].concat(n):n)},ib=(e,...t)=>typeof e=="function"?zx(Gx,e,...t):zx(()=>KF(Gx(),e),...t);var qF=ib({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 V(...e){return qF(Hx(e))}$();var Ru=qe(!0);function lb(){return xe(Ru)}var Pg=qe(void 0);function vn(){let e=xe(Ru);return xe(Pg)??e}$();var Eu=(...e)=>e.filter((t,o,n)=>!!t&&t.trim()!==""&&n.indexOf(t)===o).join(" ").trim();var db=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();var cb=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,o,n)=>n?n.toUpperCase():o.toLowerCase());var Rg=e=>{let t=cb(e);return t.charAt(0).toUpperCase()+t.slice(1)};$();var ub={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 pb=e=>{for(let t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};var mb=zn(({color:e="currentColor",size:t=24,strokeWidth:o=2,absoluteStrokeWidth:n,className:r="",children:a,iconNode:s,...i},d)=>yn("svg",{ref:d,...ub,width:t,height:t,stroke:e,strokeWidth:n?Number(o)*24/Number(t):o,className:Eu("lucide",r),...!a&&!pb(i)&&{"aria-hidden":"true"},...i},[...s.map(([c,u])=>yn(c,u)),...Array.isArray(a)?a:[a]]));var Q=(e,t)=>{let o=zn(({className:n,...r},a)=>yn(mb,{ref:a,iconNode:t,className:Eu(`lucide-${db(Rg(e))}`,`lucide-${e}`,n),...r}));return o.displayName=Rg(e),o};var WF=[["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}],["path",{d:"M10 4v4",key:"pp8u80"}],["path",{d:"M2 8h20",key:"d11cs7"}],["path",{d:"M6 4v4",key:"1svtjw"}]],Nl=Q("app-window",WF);var GF=[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]],Oa=Q("archive",GF);var jF=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],Dl=Q("arrow-down",jF);var VF=[["path",{d:"M5 3h14",key:"7usisc"}],["path",{d:"m18 13-6-6-6 6",key:"1kf1n9"}],["path",{d:"M12 7v14",key:"1akyts"}]],_l=Q("arrow-up-to-line",VF);var QF=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Ol=Q("arrow-up",QF);var XF=[["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"}]],Fa=Q("blocks",XF);var YF=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],Fl=Q("book-open",YF);var JF=[["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"}]],$s=Q("bookmark",JF);var ZF=[["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"}]],Bl=Q("bot",ZF);var e2=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Cn=Q("check",e2);var t2=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Tt=Q("chevron-down",t2);var o2=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Hl=Q("chevron-left",o2);var n2=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],yo=Q("chevron-right",n2);var r2=[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]],Ul=Q("chevrons-left",r2);var a2=[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]],$l=Q("chevrons-right",a2);var s2=[["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"}]],eo=Q("circle-alert",s2);var i2=[["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"}]],Ba=Q("copy",i2);var l2=[["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"}]],Eo=Q("ellipsis",l2);var d2=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],zl=Q("eye-off",d2);var c2=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}]],Kl=Q("file-code",c2);var u2=[["path",{d:"M4 6.835V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-.343",key:"1vfytu"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M2 19a2 2 0 0 1 4 0v1a2 2 0 0 1-4 0v-4a6 6 0 0 1 12 0v4a2 2 0 0 1-4 0v-1a2 2 0 0 1 4 0",key:"1etmh7"}]],xn=Q("file-headphone",u2);var p2=[["path",{d:"M12.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v9.34",key:"o6klzx"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10.378 12.622a1 1 0 0 1 3 3.003L8.36 20.637a2 2 0 0 1-.854.506l-2.867.837a.5.5 0 0 1-.62-.62l.836-2.869a2 2 0 0 1 .506-.853z",key:"zhnas1"}]],Ur=Q("file-pen",p2);var m2=[["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:"M15.033 13.44a.647.647 0 0 1 0 1.12l-4.065 2.352a.645.645 0 0 1-.968-.56v-4.704a.645.645 0 0 1 .967-.56z",key:"1tzo1f"}]],$r=Q("file-play",m2);var f2=[["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"}]],Ha=Q("file-text",f2);var g2=[["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:"M11 18h2",key:"12mj7e"}],["path",{d:"M12 12v6",key:"3ahymv"}],["path",{d:"M9 13v-.5a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 .5.5v.5",key:"qbrxap"}]],ql=Q("file-type",g2);var h2=[["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"}]],Wl=Q("file",h2);var y2=[["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"}]],zr=Q("folder",y2);var v2=[["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"}]],Gl=Q("frame",v2);var C2=[["path",{d:"M6 3v12",key:"qpgusn"}],["path",{d:"M18 9a3 3 0 1 0 0-6 3 3 0 0 0 0 6z",key:"1d02ji"}],["path",{d:"M6 21a3 3 0 1 0 0-6 3 3 0 0 0 0 6z",key:"chk6ph"}],["path",{d:"M15 6a9 9 0 0 0-9 9",key:"or332x"}],["path",{d:"M18 15v6",key:"9wciyi"}],["path",{d:"M21 18h-6",key:"139f0c"}]],jl=Q("git-branch-plus",C2);var x2=[["path",{d:"M15 6a9 9 0 0 0-9 9V3",key:"1cii5b"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}]],Vl=Q("git-branch",x2);var b2=[["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"}]],Ql=Q("globe",b2);var w2=[["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"}]],Xl=Q("grip-vertical",w2);var T2=[["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"}]],Yl=Q("image",T2);var I2=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],Jl=Q("info",I2);var S2=[["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"}]],Kr=Q("layers",S2);var k2=[["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"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}]],Zl=Q("list-checks",k2);var L2=[["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"}]],ed=Q("list-ordered",L2);var P2=[["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"}]],Ua=Q("list-todo",P2);var R2=[["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"}]],td=Q("list",R2);var E2=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],qr=Q("loader-circle",E2);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 9.9-1",key:"1mm8w8"}]],Wr=Q("lock-open",M2);var A2=[["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"}]],od=Q("lock",A2);var N2=[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]],zs=Q("maximize",N2);var D2=[["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"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],qn=Q("message-circle-question-mark",D2);var _2=[["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"}]],nd=Q("message-circle",_2);var O2=[["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"}]],$a=Q("message-square",O2);var F2=[["path",{d:"M16 10a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 14.286V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z",key:"1n2ejm"}],["path",{d:"M20 9a2 2 0 0 1 2 2v10.286a.71.71 0 0 1-1.212.502l-2.202-2.202A2 2 0 0 0 17.172 19H10a2 2 0 0 1-2-2v-1",key:"1qfcsi"}]],gr=Q("messages-square",F2);var B2=[["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"}]],rd=Q("minimize-2",B2);var H2=[["path",{d:"M5 12h14",key:"1ays0h"}]],ad=Q("minus",H2);var U2=[["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"}]],Wn=Q("mouse-pointer-click",U2);var $2=[["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"}]],sd=Q("package",$2);var z2=[["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"}]],za=Q("paintbrush",z2);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"}]],jo=Q("paperclip",K2);var q2=[["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"}]],Gn=Q("pen-line",q2);var W2=[["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"}]],id=Q("pencil-ruler",W2);var G2=[["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"}]],ld=Q("pencil",G2);var j2=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],dd=Q("plus",j2);var V2=[["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"}]],cd=Q("puzzle",V2);var Q2=[["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"}]],Ka=Q("rotate-ccw",Q2);var X2=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],ud=Q("search",X2);var Y2=[["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"}]],pd=Q("send",Y2);var J2=[["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"}]],md=Q("settings",J2);var Z2=[["path",{d:"M21 4v16",key:"7j8fe9"}],["path",{d:"M6.029 4.285A2 2 0 0 0 3 6v12a2 2 0 0 0 3.029 1.715l9.997-5.998a2 2 0 0 0 .003-3.432z",key:"zs4d6"}]],Ks=Q("skip-forward",Z2);var eB=[["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"}]],qs=Q("sliders-horizontal",eB);var tB=[["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"}]],jn=Q("sparkles",tB);var oB=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],fd=Q("square",oB);var nB=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],Vo=Q("terminal",nB);var rB=[["path",{d:"M17 5H3",key:"1cn7zz"}],["path",{d:"M21 12H8",key:"scolzb"}],["path",{d:"M21 19H8",key:"13qgcb"}],["path",{d:"M3 12v7",key:"1ri8j3"}]],hr=Q("text-quote",rB);var aB=[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]],yr=Q("user-round",aB);var sB=[["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"}]],Ws=Q("wrench",sB);var iB=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],dt=Q("x",iB);$();function z(){return{t:Nt().i18n.usePluginTranslation()}}$();$();var Gr=qe(null),gd=qe(null);function Gs(e,t){let o=xe(gd);fe(()=>{if(!(!t||e===null||o===null))return o(e)},[o,t,e])}function hd(){let e=new Map;return{rows:()=>[...e.keys()],acquire:(t,o)=>{e.set(t,(e.get(t)??0)+1),o();let n=!0;return()=>{if(!n)return;n=!1;let r=e.get(t)??0;r>1?e.set(t,r-1):e.delete(t),o()}}}}var fb=new Set(["Select","AlertDialog","Dialog","Menu","Popover","Tooltip","ProviderModelPicker","TraitsPicker","TimelineRowErrorFallback"]);function ie(e){let t=fb.has(e),o=n=>{let r=Nt(),a=bu(),s=vn(),i=r.ui[e],d={};if(t){let c=xe(Gr),[u,m]=q(n.defaultOpen===!0),p=typeof n.open=="boolean"?n.open:u;Gs(c,s&&p),fe(()=>{s||m(!1)},[s]),d={open:s&&p,onOpenChange:(f,...g)=>{m(f),typeof n.onOpenChange=="function"&&n.onOpenChange(f,...g)}}}return i===void 0&&["MachineName","ProjectName","ProviderName","ThreadName","PluginName","TimelineRowErrorFallback","MenuCheckboxItem"].includes(e)?null:yn(i,{...n,...d,...fb.has(e)&&!s?{open:!1}:{},className:`${a} ${typeof n.className=="string"?n.className:""}`})};return o.displayName=e,o}var $7=ie("useLinkContextMenu"),js=ie("ProviderInstanceIcon"),gb=ie("MachineName"),hb=ie("ProjectName"),yb=ie("ProviderName"),yd=ie("ThreadName"),Mo=ie("PluginName"),vb=ie("ProviderModelPicker"),Cb=ie("TraitsPicker"),xb=ie("TraitsMenuContent"),Vn=ie("ComposerControl"),Qn=ie("ComposerControlIcon"),Mu=ie("ComposerControlChevron"),Au=ie("ComposerSelectControl"),bb=ie("TimelineRowErrorFallback"),Nu=ie("TimelineProcessShell"),vd=ie("ProcessRowIcon"),Cd=ie("WorkEntryStatusDot"),Vs=ie("WorkEntryIcon");function Xn(e,t,o){return Nt().usePluginName?.(e,t,o)??null}function wb(e,t){return Nt().useThreadName?.(e,t)??null}var Tb=ie("UserAvatar"),jr=ie("Badge"),z7=ie("InlineTag"),Eg=ie("Meter"),K=ie("Button"),Du=ie("Label"),Vr=ie("Input"),Ib=ie("SearchInput"),Qr=ie("EmptyInline"),Sb=ie("Textarea"),_u=ie("Switch"),K7=ie("Separator"),Mg=ie("Skeleton"),Qs=ie("Spinner"),q7=ie("ScrollArea"),W7=ie("Card"),G7=ie("CardAction"),j7=ie("CardPanel"),V7=ie("CardDescription"),Q7=ie("CardFooter"),X7=ie("CardHeader"),Y7=ie("CardTitle"),J7=ie("Empty"),Z7=ie("EmptyContent"),e9=ie("EmptyDescription"),t9=ie("EmptyHeader"),o9=ie("EmptyMedia"),n9=ie("EmptyTitle"),r9=ie("InputGroup"),a9=ie("InputGroupAddon"),s9=ie("InputGroupInput"),i9=ie("DocumentPanel"),l9=ie("MasterDetail"),Xs=ie("Select"),qa=ie("SelectItem"),Ys=ie("SelectPopup"),kb=ie("SelectTrigger"),Ou=ie("SelectValue"),Xr=ie("Toggle"),Fu=ie("ToggleGroup"),Js=ie("Dialog"),d9=ie("DialogClose"),Zs=ie("DialogDescription"),Bu=ie("DialogFooter"),Hu=ie("DialogHeader"),ei=ie("DialogPopup"),Lb=ie("DialogPanel"),ti=ie("DialogTitle"),c9=ie("DialogTrigger"),Ao=ie("Menu"),Pb=ie("MenuGroup"),bo=ie("MenuItem"),Rb=ie("MenuCheckboxItem"),No=ie("MenuPopup"),Yr=ie("MenuRadioGroup"),Yn=ie("MenuRadioItem"),xd=ie("MenuSeparator"),Do=ie("MenuTrigger"),nn=ie("Popover"),rn=ie("PopoverPopup"),an=ie("PopoverTrigger"),Eb=ie("Table"),Mb=ie("TableBody"),bn=ie("TableCell"),Wa=ie("TableHead"),Ab=ie("TableHeader"),Jr=ie("TableRow"),Pe=ie("Tooltip"),Re=ie("TooltipPopup"),Ee=ie("TooltipTrigger"),bd=ie("Alert"),wd=ie("AlertAction"),Uu=ie("AlertDescription"),Ag=ie("AlertTitle"),oi=ie("Kbd"),vr=ie("DecisionCard"),$u=ie("ChoiceList"),zu=ie("Command"),Ku=ie("CommandGroup"),qu=ie("CommandItem"),Wu=ie("CommandList"),Nb=ie("StyledDiffCodeView"),Db=ie("DevBackdropArt"),wo=ie("Markdown"),_b=ie("DiffView"),Ob=ie("MediaPlayer");var{jsx:l,jsxs:v,Fragment:oe}=window.__ycodiumPluginHost.jsxRuntime;var lB="sr-only @min-[30rem]/composer-first-row:not-sr-only";function Bb({mode:e,onModeChange:t}){let{t:o}=z();return l("div",{className:"flex shrink-0 items-center gap-1",children:v(Fu,{className:"shrink-0","data-view-mode-toggle":!0,size:"xs","aria-label":o("trajectory.toggleLabel"),variant:"segmented",value:[e],onValueChange:n=>{let r=n[0];(r==="chat"||r==="trajectory")&&t(r)},children:[l(Fb,{value:"chat",label:o("trajectory.toggleChat"),icon:l($a,{"aria-hidden":!0})}),l(Fb,{value:"trajectory",label:o("trajectory.toggleTrajectory"),icon:l(ed,{"aria-hidden":!0})})]})})}function Fb({value:e,label:t,icon:o}){return v(Pe,{children:[v(Ee,{render:l(Xr,{value:e,"aria-label":t}),children:[o,l("span",{className:lB,children:t})]}),l(Re,{side:"top",children:t})]})}function Hb({mode:e,visible:t,chat:o,trajectory:n}){return l("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":e,"data-pane-visible":t?"true":"false",children:l(Pg,{value:t,children:e==="chat"?o:n})})}$();function Ub(e){if(e.cacheDisjoint!==!0)return null;let t=e.cachedInputTokens,o=e.inputTokens;if(t===void 0||o===void 0)return null;let n=t+o;if(n<=0)return null;if(t>=n)return"100%";let r=t/n*100;for(let a=0;a<=3;a+=1){let s=r.toFixed(a);if(Number.parseFloat(s)<100)return`${s}%`}return"99.9%"}function $b(e){let t,o,n,r=!0,a=!1;for(let s of e)s!==void 0&&(a=!0,s.cacheDisjoint!==!0&&(r=!1),s.outputTokens!==void 0&&(t=(t??0)+s.outputTokens),s.inputTokens!==void 0&&(o=(o??0)+s.inputTokens),s.cachedInputTokens!==void 0&&(n=(n??0)+s.cachedInputTokens));if(!(t===void 0&&o===void 0&&n===void 0))return{...a&&r?{cacheDisjoint:!0}:{},...t!==void 0?{outputTokens:t}:{},...o!==void 0?{inputTokens:o}:{},...n!==void 0?{cachedInputTokens:n}:{}}}$();$();var zb=qe(null);function Kb({data:e,target:t,children:o}){let n=R(r=>e.readTurnChanges(t,r),[e,t.environmentId,t.threadId]);return l(zb,{value:e.readTurnChanges?n:null,children:o})}function qb({turnId:e,filePath:t,onClose:o}){let n=xe(zb),r=E(n),a=E(o);a.current=o;let{t:s}=z(),[i,d]=q(0),[c,u]=q(0),[m,p]=q(null),[f,g]=q("loading");return H(()=>{if(n!==r.current){a.current();return}let h=!0;if(g("loading"),!n){g("ready");return}return n({turnId:e,filePath:t,textOffset:i}).then(y=>{h&&(p(x=>({...y,text:i===0?y.text:(x?.text??"")+y.text})),g("ready"))},()=>{h&&g("failed")}),()=>{h=!1}},[n,e,t,i,c]),l(Js,{open:!0,onOpenChange:h=>{h||o()},children:v(ei,{className:"flex max-h-[80vh] w-[min(90vw,60rem)] flex-col gap-3",children:[l(ti,{children:s("turnOverview.recordedChanges")}),l(Zs,{children:t}),l("p",{className:"text-xs text-muted-foreground",children:m||f==="ready"?s(m?.machineUpdateRequired?"turnOverview.changesUpgradeMachine":`turnOverview.changesSource.${m?.source??"unavailable"}`):null}),f==="loading"?l("p",{role:"status",children:s("turnOverview.changesLoading")}):null,f==="failed"?l(K,{onClick:()=>u(h=>h+1),children:s("turnOverview.changesRetry")}):null,m?.text?l("pre",{className:"min-h-0 overflow-auto whitespace-pre-wrap break-all text-xs",tabIndex:0,children:m.text}):null,m?.truncated?l("p",{children:s("turnOverview.changesTruncated")}):null,m?.textWindow?.nextOffset!=null?l(K,{disabled:f==="loading",onClick:()=>d(m.textWindow.nextOffset),children:s("turnOverview.changesMore")}):null,l(K,{onClick:o,children:s("turnOverview.changesClose")})]})})}$();$();function Td(e,t){if(!Number.isFinite(e)||e<0)return t.milliseconds("0");if(e<1e3)return t.milliseconds(String(Math.max(1,Math.round(e))));if(e<1e4){let i=Math.round(e/100)/10;return t.seconds(i>=10?"10":i.toFixed(1))}if(e<6e4)return t.seconds(String(Math.round(e/1e3)));let o=Math.round(e/1e3),n=Math.floor(o/3600),r=Math.floor(o%3600/60),a=o%60,s=[];return n>0&&s.push(t.hours(String(n))),r>0&&s.push(t.minutes(String(r))),a>0&&s.push(t.seconds(String(a))),s.reduce((i,d)=>t.pair(i,d))}function Wb(e,t){return!Number.isFinite(e)||e<=0?t.seconds("0"):Td(e,t)}function _o(){let{t:e}=z();return W(()=>{let t={milliseconds:o=>e("duration.milliseconds",{value:o}),seconds:o=>e("duration.seconds",{value:o}),minutes:o=>e("duration.minutes",{value:o}),hours:o=>e("duration.hours",{value:o}),pair:(o,n)=>e("duration.pair",{left:o,right:n})};return{units:t,formatDuration:o=>Td(o,t),formatCountedDuration:o=>Wb(o,t)}},[e])}function dB({fact:e,ownerId:t,onLocate:o,turnId:n}){let{t:r}=z(),{formatDuration:a}=_o(),[s,i]=q(!1),[d,c]=q(null);Gs(t,s||d!==null);let u=r(`turnOverview.${e.kind}`,{count:e.value,duration:a(e.value)}),m=e.targets[0];return e.targets.length===1&&m?.filePath===void 0?l(K,{size:"xs",variant:"ghost",className:"h-auto px-1 py-0.5 text-xs",title:r("turnOverview.locate"),onClick:()=>m&&o(m.rowId),disabled:!m,children:u}):v(oe,{children:[v(nn,{open:s,onOpenChange:i,children:[l(an,{render:l(K,{size:"xs",variant:"ghost",className:"h-auto px-1 py-0.5 text-xs"}),children:u}),v(rn,{className:"flex max-h-72 w-80 flex-col gap-1 overflow-auto p-2",children:[e.partial?l("p",{className:"px-2 py-1 text-xs text-muted-foreground",children:r("turnOverview.loadedFacts")}):null,e.targets.map((p,f)=>v("div",{className:"flex min-w-0 items-center gap-1",children:[p.filePath?l(K,{variant:"ghost",size:"sm",className:"min-w-0 flex-1 justify-start whitespace-normal break-all text-left",title:r("turnOverview.recordedChanges"),onClick:()=>{i(!1),c(p.filePath)},children:p.filePath}):l("span",{className:"min-w-0 flex-1 px-2 text-xs",children:r("turnOverview.step",{index:f+1})}),l(K,{size:"xs",variant:"outline",onClick:()=>{i(!1),o(p.rowId)},children:r("turnOverview.locate")})]},`${p.rowId}:${p.filePath??f}`))]})]}),d!==null?l(qb,{turnId:n,filePath:d,onClose:()=>c(null)},`${n}:${d}`):null]})}function Gu({summary:e,...t}){let{t:o}=z();return v("div",{className:"flex min-w-0 flex-wrap items-center gap-x-1 gap-y-0.5 text-muted-foreground","data-turn-facts":e.turnId,children:[e.facts.map(n=>l(dB,{fact:n,turnId:e.turnId,ownerId:`turn:${e.turnId}`,...t},n.kind)),e.facts.some(n=>n.partial)?l(Gb,{className:"px-1 text-ui-2xs",detail:o("turnOverview.loadedFacts"),children:o("turnOverview.loaded")}):null]})}function ju({summary:e}){let{t}=z();return e.hasCompaction?v(Gb,{className:"inline-flex shrink-0 items-center text-muted-foreground",detail:t("turnOverview.compaction"),children:[l(Oa,{className:"size-3","aria-hidden":!0}),l("span",{className:"sr-only",children:t("turnOverview.compaction")})]}):null}function Gb({children:e,detail:t,className:o}){return v(Pe,{children:[l(Ee,{render:l("span",{className:o}),children:e}),l(Re,{children:t})]})}$();var Ng=100;function Vu(e){return typeof e=="function"?e():e}function Qb(e,t){return typeof t=="function"?t(e):t}var cB=new Map,jb=new Map;function uB(e,t,o){let n=e.get(t);return n===void 0&&(n={values:new Map,limit:Math.max(1,o)},e.set(t,n)),n}function pB(e,t){let o=jb.get(e);return o===void 0&&(o={values:new Map,limit:Math.max(1,t)},jb.set(e,o)),o}function Vb(e){e.alive&&(e.alive=!1,e.dispose?.(e.value),e.subscribers.clear())}function mB(e,t){if(!(e.values.size<=e.limit)){for(let[o,n]of e.values){if(e.values.size<=e.limit)break;n===t||n.committed||n.leases>0||e.values.get(o)===n&&(e.values.delete(o),Vb(n))}for(let[o,n]of e.values){if(e.values.size<=e.limit)break;n===t||n.leases>0||n.retain?.(n.value)===!0||e.values.get(o)===n&&(e.values.delete(o),Vb(n))}}}function Dg(e,t,o){e.values.get(t)===o&&(e.values.delete(t),e.values.set(t,o))}function Id(e){queueMicrotask(()=>mB(e))}function Xb(e,t,o,n){let r=e.values.get(t);return r===void 0&&(r={value:Vu(o),subscribers:new Set,leases:0,alive:!0,committed:!1,dispose:n.dispose,retain:n.retain},e.values.set(t,r)),r}function Ge(e,t,o){"use no memo";let{cell:n,subscribe:r,setValue:a}=fB(e,t,o),s=R(()=>n.value,[n]);return[Go(r,s,s),a]}function fB(e,t,o){let n=uB(cB,o.namespace,o.limit??Ng),r=Xb(n,e,t,o),a=Math.max(1,o.limit??Ng),s=R(d=>r.alive?(n.limit=a,r.committed=!0,r.dispose=o.dispose,r.retain=o.retain,Dg(n,e,r),r.leases+=1,r.subscribers.add(d),Id(n),()=>{r.subscribers.delete(d),r.leases=Math.max(0,r.leases-1),Id(n)}):()=>{},[r,n,e,a,o.dispose,o.retain]),i=R(d=>{if(!r.alive||n.values.get(e)!==r)return;let c=r.value,u=Qb(c,d);if(!Object.is(c,u)){r.value=u,Dg(n,e,r);for(let m of r.subscribers)m();Id(n)}},[r,n,e]);return{cell:r,subscribe:s,setValue:i}}function Yb(e,t){let o=E(null);(o.current===null||o.current.key!==e)&&(o.current={key:e,value:Vu(t)});let[,n]=Na(a=>a+1,0),r=R(a=>{let s=o.current;if(s===null||s.key!==e)return;let i=Qb(s.value,a);Object.is(s.value,i)||(s.value=i,n())},[e]);return[o.current.value,r]}function $e(e,t,o){let n=Math.max(1,o.limit??Ng),r=pB(o.namespace,n),a=Xb(r,e,()=>({current:Vu(t)}),o);return H(()=>{if(!(!a.alive||r.values.get(e)!==a))return r.limit=n,a.committed=!0,a.dispose=o.dispose,a.retain=o.retain,Dg(r,e,a),a.leases+=1,Id(r),()=>{a.leases=Math.max(0,a.leases-1),Id(r)}},[a,r,e,n,o.dispose,o.retain]),a.value}function Qo(e,t){let o=E(null);return(o.current===null||o.current.key!==e)&&(o.current={key:e,ref:{current:Vu(t)}}),o.current.ref}$();var _g="trajectory-summary-reveal";function Jb({inputKey:e,rows:t,groupRows:o,paneVisible:n,resetFilter:r}){let[a,s]=Ge(e,{},{namespace:"trajectory-turn-disclosure"}),[i,d]=Ge(e,()=>new Set,{namespace:"trajectory-routine-disclosure"}),[c,u]=Ge(e,!1,{namespace:"trajectory-expand-all"}),[m,p]=Ge(e,null,{namespace:_g}),[f,g]=Ge(e,null,{namespace:"trajectory-summary-highlight"}),h=$e(e,()=>new Set,{namespace:"trajectory-default-open"}),y=W(()=>o?.(t,c)??null,[o,t,c]),x=W(()=>{let I=new Map,T=new Map;if(y===null)return{rows:t,headers:I,routines:T};let S=y.findLast(N=>N.turnId!==null),P=new Set(y.map(N=>N.id));if(h.current.size>200)for(let N of h.current)P.has(N)||h.current.delete(N);n&&S&&h.current.add(S.id);let A=[];for(let N of y){let B=N.items[0],O=B?.kind==="step"?B.row:B?.rows[0];if(!O)continue;let j=c||(a[N.id]??(N.turnId===null||h.current.has(N.id)||N.summary?.state==="running"));if(I.set(N.id,{group:N,expanded:j}),A.push({...O,id:N.id,kind:"turn-header",turnId:N.turnId,createdAt:N.summary?.startedAt??O.createdAt}),!!j)for(let U of N.items){if(U.kind==="step"){A.push(U.row);continue}let D=i.has(U.id);T.set(U.id,{count:U.rows.length,expanded:D}),A.push({...U.rows[0],id:U.id,kind:"routine-header"}),D&&A.push(...U.rows)}}return{rows:A,headers:I,routines:T}},[y,t,n,h,c,a,i]),C=E(x.headers);C.current=x.headers;let b=R(I=>{u(!1),s(T=>({...T,[I]:!C.current.get(I)?.expanded}))},[u,s]),L=R(I=>d(T=>{let S=new Set(T);return S.has(I)?S.delete(I):S.add(I),S}),[d]),w=R(I=>p(T=>({rowId:I,nonce:(T?.nonce??0)+1})),[p]);fe(()=>{if(!n||m===null)return;r();let I=y?.find(S=>S.id===m.rowId||S.items.some(P=>P.kind==="step"?P.row.id===m.rowId:P.rows.some(A=>A.id===m.rowId)));if(!I||I.id===m.rowId)return;x.headers.get(I.id)?.expanded||s(S=>({...S,[I.id]:!0}));let T=I.items.find(S=>S.kind==="routine"&&S.rows.some(P=>P.id===m.rowId));T&&!i.has(T.id)&&d(S=>new Set([...S,T.id]))},[n,m,r,y,x.headers,i,s,d]);let k=R(I=>{g(I.rowId),p(T=>T===I?null:T)},[g,p]);return{...x,expandAll:c,setExpandAll:u,toggleTurn:b,toggleRoutine:L,locate:w,request:m,completeReveal:k,highlighted:f}}function ni(e){return e<1e3?String(Math.round(e)):e<1e6?`${(e/1e3).toFixed(1).replace(/\.0$/,"")}k`:`${(e/1e6).toFixed(1).replace(/\.0$/,"")}m`}function Zb({rows:e,usageByTurnId:t,onSelect:o,summaries:n,actions:r}){let{t:a}=z();return e.map(({item:s,ordinal:i})=>{let d=s.attachmentPreview,c=s.isSystemMessage?a("turnNavigator.systemWake"):d===void 0?s.userText:d.count===1?d.name:a("forkRelations.attachmentPreview",d),u=s.turnId===null?void 0:n.get(s.turnId),m=s.turnId===null?void 0:t.get(s.turnId);return v("div",{className:"rounded-md hover:bg-accent/50",children:[v("button",{type:"button","data-turn-navigator-row":s.sectionKey,onClick:()=>o(s),className:"flex w-full cursor-[var(--control-cursor)] items-start gap-2.5 rounded-md px-2 py-1.5 text-left transition-colors hover:bg-accent",children:[l("span",{className:"shrink-0 pt-px font-mono text-ui-2xs text-muted-foreground tabular-nums",children:i}),v("span",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[v("span",{className:"flex items-start gap-1",children:[l("span",{className:"line-clamp-2 min-w-0 flex-1 font-medium text-chat leading-snug",children:c}),u?l(ju,{summary:u}):null]}),s.assistantText?l("span",{className:"line-clamp-1 text-ui-xs text-muted-foreground leading-snug",children:s.assistantText}):null,m?.outputTokens!==void 0?l("span",{className:"font-mono text-ui-2xs text-muted-foreground tabular-nums",children:ni(m.outputTokens)}):null]})]}),u&&r?l("div",{className:"pb-1 pl-7 pr-2",children:l(Gu,{summary:u,...r})}):null]},s.sectionKey)})}function gB({context:e,useSummaries:t,...o}){let n=t(e.target),r=W(()=>new Map(n.map(s=>[s.turnId,s])),[n]),[,a]=Ge(e.threadKey,null,{namespace:_g});return l(Zb,{...o,summaries:r,actions:{onLocate:s=>{a(i=>({rowId:s,nonce:(i?.nonce??0)+1})),o.onClose(),e.openTrajectory()},onOpenFileDiff:e.onOpenFileDiff}})}var hB=new Map;function ew(e){let t=e.summaryContext;return t?.data.useTurnSummaries?l(gB,{...e,context:t,useSummaries:t.data.useTurnSummaries}):l(Zb,{...e,summaries:hB})}function yB({totals:e}){let{t}=z();if(!e)return null;let o=Ub(e),n=[e.outputTokens===void 0?null:{label:t("turnNavigator.usageOutput"),value:ni(e.outputTokens)},e.inputTokens===void 0?null:{label:t("turnNavigator.usageInput"),value:ni(e.inputTokens)},e.cachedInputTokens===void 0?null:{label:t("turnNavigator.usageCacheRead"),value:o===null?ni(e.cachedInputTokens):`${ni(e.cachedInputTokens)} (${o})`}].filter(r=>r!==null);return n.length===0?null:v("div",{className:"flex items-baseline gap-2 border-t px-2 py-1.5",children:[l("span",{className:"flex-1 font-mono text-ui-2xs text-muted-foreground uppercase tracking-[0.14em]",children:t("turnNavigator.usage")}),n.map(r=>v("span",{className:"shrink-0 font-mono text-ui-2xs text-muted-foreground tabular-nums",children:[r.label," ",r.value]},r.label))]})}var vB=pe(function({getText:t,size:o="xs",variant:n="outline",className:r}){let{t:a}=z(),s=Nt().writeClipboard,[i,d]=q(!1),c=a("turnNavigator.copyMarkdown");return v(Pe,{children:[l(Ee,{render:l(K,{"aria-label":c,disabled:i,onClick:()=>{s(t()).then(()=>{d(!0),window.setTimeout(()=>d(!1),1e3)})},type:"button",size:o,variant:n,className:V("text-muted-foreground hover:text-foreground",r)}),children:i?l(Cn,{className:"size-3 text-primary"}):l(Ba,{className:"size-3"})}),l(Re,{children:l("p",{children:c})})]})});function tw({items:e,totalTurnCount:t,bottomInset:o,usageByTurnId:n,onSelect:r,exportMarkdown:a,onDownload:s,placement:i="float",summaryContext:d}){let{t:c}=z(),[u,m]=q(!1),p=W(()=>e.map((y,x)=>({item:y,ordinal:x+1})).reverse(),[e]),f=W(()=>$b(p.map(({item:y})=>y.turnId===null?void 0:n.get(y.turnId))),[p,n]);if(e.length===0)return null;let g=t??e.length,h=c("turnNavigator.open",{count:g});return v(nn,{onOpenChange:m,open:u,children:[v(an,{render:l(K,{"aria-label":h,className:V("gap-1.5 rounded-full px-3",i==="float"&&"absolute right-3 z-40"),"data-testid":"turn-navigator-pill",size:"xs",style:i==="float"?{bottom:o+12}:void 0,title:h,variant:"glass"}),children:[l(td,{"aria-hidden":!0}),l("span",{className:"font-mono font-semibold tabular-nums",children:g})]}),l(rn,{align:"end",className:"w-80 flex-col",side:"top",children:v("div",{className:"flex max-h-[min(60vh,26rem)] flex-col",children:[v("div",{className:"flex items-center gap-1.5 border-b px-2 py-1.5",children:[l("span",{className:"flex-1 font-mono text-ui-2xs text-muted-foreground uppercase tracking-[0.14em]",children:c("turnNavigator.title")}),l("span",{className:"font-mono text-ui-2xs text-muted-foreground tabular-nums",children:g})]}),l("div",{className:V("min-h-0 flex-1 overflow-y-auto overflow-x-hidden p-1"),children:l(ew,{rows:p,usageByTurnId:n,summaryContext:d,onSelect:y=>{m(!1),r(y)},onClose:()=>m(!1)})}),l(yB,{totals:f}),v("div",{className:"flex items-center gap-1 border-t px-2 py-1.5",children:[l("span",{className:"flex-1 font-mono text-ui-2xs text-muted-foreground uppercase tracking-[0.14em]",children:c("turnNavigator.export")}),l(vB,{size:"icon-xs",getText:a,variant:"ghost"}),l(K,{"aria-label":c("turnNavigator.downloadMarkdown"),onClick:()=>s("md"),size:"xs",title:c("turnNavigator.downloadMarkdown"),variant:"ghost",children:l("span",{className:"font-mono",children:".md"})}),l(K,{"aria-label":c("turnNavigator.downloadJson"),onClick:()=>s("json"),size:"xs",title:c("turnNavigator.downloadJson"),variant:"ghost",children:l("span",{className:"font-mono",children:".json"})})]})]})})]})}$();function Sd(e){return e.replace(/\s+/g," ")}function CB(e,t){let o=e.slice(Math.max(0,e.length-t));return/^[\uDC00-\uDFFF]/.test(o)&&(o=o.slice(1)),o}function xB(e,t){let o=e.slice(0,t);return/[\uD800-\uDBFF]$/.test(o)&&(o=o.slice(0,-1)),o}function Qu(e){let o=(e instanceof Element?e:e?.parentElement??null)?.closest("[data-assistant-quote-body]")??null;return o?.closest('[data-message-role="assistant"]')?o:null}function ow(e){if(!e||e.isCollapsed||e.rangeCount===0)return null;let t=e.getRangeAt(0),o=Qu(t.startContainer);if(o===null||Qu(t.endContainer)!==o)return null;let n=o.closest("[data-message-id]")?.dataset.messageId;if(!n)return null;let r=e.toString().trim();if(r.length===0)return null;let a=document.createRange();a.selectNodeContents(o),a.setEnd(t.startContainer,t.startOffset);let s=document.createRange();s.selectNodeContents(o),s.setStart(t.endContainer,t.endOffset);let i=Sd(t.toString()),d=i.length>i.trimStart().length?" ":"",c=i.length>i.trimEnd().length?" ":"",u=Sd(a.toString()+d),m=Sd(c+s.toString()),p=u.length,f=p+i.trim().length,g=t.getClientRects(),h=g[0]??t.getBoundingClientRect(),y=g[g.length-1]??h;return{messageId:n,text:r,start:p,end:f,prefix:CB(u,32),suffix:xB(m,32),anchor:{x:y.right,top:h.top,bottom:y.bottom}}}var Xu="assistant-quote-inserter",Yu="assistant-quote-open-comment";var bB=300;function nw(e){let{data:t,target:o,threadKey:n,surfaceRef:r}=e,{t:a}=z(),s=$e(n,null,{namespace:Xu}),[,i]=Ge(n,null,{namespace:Yu}),[d,c]=q(null),u=E(null);if(H(()=>{let h,y=()=>{let k=r.current,I=document.getSelection(),T=I&&I.rangeCount>0?I.getRangeAt(0):null;if(!k||!T||!k.contains(T.commonAncestorContainer)){c(null);return}let S=ow(I);if(S===null){c(null);return}let P=t.assistantQuotes.serialize({version:1,environmentId:o.environmentId,threadId:o.threadId,messageId:S.messageId,text:S.text,start:S.start,end:S.end,prefix:S.prefix,suffix:S.suffix});c({source:P,...S.anchor})},x=k=>{u.current?.contains(k.target)||(clearTimeout(h),h=setTimeout(y,bB))},C=k=>{u.current?.contains(k.target)||(clearTimeout(h),c(null))},b=()=>c(null),L=k=>{k.key==="Escape"&&c(null)},w=()=>{(document.getSelection()?.isCollapsed??!0)&&c(null)};return document.addEventListener("pointerup",x,!0),document.addEventListener("keyup",x,!0),document.addEventListener("pointerdown",C,!0),document.addEventListener("keydown",L,!0),document.addEventListener("selectionchange",w),window.addEventListener("scroll",b,!0),()=>{clearTimeout(h),document.removeEventListener("pointerup",x,!0),document.removeEventListener("keyup",x,!0),document.removeEventListener("pointerdown",C,!0),document.removeEventListener("keydown",L,!0),document.removeEventListener("selectionchange",w),window.removeEventListener("scroll",b,!0)}},[t,r,o.environmentId,o.threadId]),d===null)return null;let m=d.source,p=Math.max(8,Math.min(window.innerWidth-200,d.x-12)),f=d.bottom+6,g=f+40<=window.innerHeight?f:Math.max(8,d.top-40);return l("div",{ref:u,className:"fixed z-50 rounded-control-3 bg-background",style:{left:p,top:g},"data-assistant-quote-toolbar":"",children:v(K,{size:"sm",variant:"outline",className:"shadow-md",disabled:m===null,title:m===null?a("timeline.quote.tooLong"):void 0,onMouseDown:h=>h.preventDefault(),onClick:()=>{m!==null&&s.current?.(m)===!0&&(i(m),document.getSelection()?.removeAllRanges(),c(null))},children:[l(hr,{"aria-hidden":"true"}),a("timeline.quote.cite")]})})}$();$();function rw(e){let t=e.map(n=>({key:n.key,turnId:n.turnId,firstRowIndex:n.firstRowIndex,endRowIndex:n.firstRowIndex+n.rowIds.length})),o=new Map;for(let n of e)for(let[r,a]of n.rowIds.entries())o.set(a,{turnId:n.turnId,index:n.firstRowIndex+r});return{sections:t,bySectionKey:new Map(t.map(n=>[n.key,n])),byRowId:o}}function Ju({index:e,visibleSectionKeys:t,protectedRowIds:o,selectionRows:n}){let r=t.flatMap(c=>{let u=e.bySectionKey.get(c)?.turnId;return u==null?[]:[u]}),a=o.flatMap(c=>{let u=e.byRowId.get(c)?.turnId;return u==null?[]:[u]}),s=n?e.byRowId.get(n.firstRowId)?.index:void 0,i=n?e.byRowId.get(n.lastRowId)?.index:void 0,d=s===void 0||i===void 0?[]:e.sections.flatMap(c=>c.turnId!==null&&c.endRowIndex>Math.min(s,i)&&c.firstRowIndex<=Math.max(s,i)?[c.turnId]:[]);return{firstTurnId:r[0]??null,lastTurnId:r.at(-1)??null,protectedTurnIds:[...new Set(a)],selectionTurnRange:d.length>0?{firstTurnId:d[0],lastTurnId:d.at(-1)}:null}}function aw(e,t,o,n){if(!n)return o;let r=e.findIndex(a=>t.has(a));return r<0?o:Math.max(o,e.length-r)}$();$();function Og(e,t){for(let o of e.querySelectorAll("[data-timeline-row-id]"))if(o.dataset.timelineRowId===t)return o;return null}function Ga(e,t){let o=0,n=e.length,r=-1;for(;o<n;){let a=Math.floor((o+n)/2),i=e[a].getBoundingClientRect();Math.max(i.bottom,i.top+1)>t?(r=a,n=a):o=a+1}return r}function wB(e){let t=e.getBoundingClientRect().top,o=e.querySelectorAll("[data-timeline-turn-section]"),n=a=>{let s=a.querySelectorAll("[data-timeline-row-id]"),i=Ga(s,t),d=i<0?void 0:s[i],c=d?.dataset.timelineRowId;return!d||c===void 0?null:{rowId:c,offsetPx:Math.round(t-d.getBoundingClientRect().top)}};if(o.length===0)return n(e);let r=Ga(o,t);if(r<0)return null;for(let a=r;a<o.length;a+=1){let s=n(o[a]);if(s)return s}return null}function sw(e,t){let o=0,n=e;for(;n&&n!==t;)o+=n.offsetTop,n=n.offsetParent;return o}var Fg=class extends ur{getSnapshotBeforeUpdate(t){return t.inputKey!==this.props.inputKey&&t.onBeforeInputChange(),null}componentDidUpdate(){}componentWillUnmount(){this.props.onBeforeInputChange()}render(){return this.props.children}};function iw({inputKey:e,onBeforeInputChange:t,handleRef:o,onAttach:n,className:r,children:a,onScroll:s,onInteractionRowsChange:i}){let d=E(null),c=E({inputKey:e,store:hd()});c.current.inputKey!==e&&(c.current={inputKey:e,store:hd()});let u=E(i);u.current=i;let m=R(f=>{let g=c.current;return g.store.acquire(f,()=>{c.current===g&&u.current?.(g.store.rows())})},[]);fe(()=>{i?.(c.current.store.rows())},[e,i]),pr(o,()=>({get node(){return d.current},measure:()=>{let f=d.current;return f?{scroll:f.scrollTop,scrollLength:f.clientHeight,contentLength:f.scrollHeight,topOf:g=>{let h=Og(f,g);return h===null?null:sw(h,f)},heightOf:g=>{let h=Og(f,g);return h===null?null:h.offsetHeight},rowAtScroll:()=>wB(f)}:null},scrollToEnd:f=>{let g=d.current;if(g){if(f?.animated){g.scrollTo({top:g.scrollHeight,behavior:"smooth"});return}g.scrollTop=g.scrollHeight-g.clientHeight}},scrollToRow:(f,g)=>{let h=d.current;if(!h)return!1;let y=Og(h,f);return y?(h.scrollTop=Math.max(0,sw(y,h)-(g?.viewOffset??0)),!0):!1},scrollToOffset:f=>{let g=d.current;g&&(g.scrollTop=Math.max(0,f))}}),[]);let p=R(f=>{d.current=f,n(f)},[n]);return l(Fg,{inputKey:e,onBeforeInputChange:t,children:l(gd,{value:m,children:l("div",{ref:p,className:r,style:{position:"relative"},onScroll:s,children:a})})})}function ai(e){if(!e)return!1;let t=e.tagName?.toLowerCase(),o=e.getAttribute?.("contenteditable");if(t==="textarea"||o==="true"||o===""||o==="plaintext-only"||"isContentEditable"in e&&e.isContentEditable===!0)return!0;if(t==="input"){let n=e.getAttribute?.("type")?.toLowerCase()??"text";if(!["button","submit","reset","image","checkbox","radio"].includes(n))return!0}return e.matches?.(":focus-visible")??!1}function ri(e,t){let n=(e?.nodeType===1?e:e?.parentElement)?.closest("[data-timeline-row-id]");return n&&t.contains(n)?n.dataset.timelineRowId??null:null}function Zu(e){let t=e.ownerDocument.getSelection?.();if(!t||t.isCollapsed)return null;let o=null,n=null;for(let c=0;c<t.rangeCount;c+=1){let u=t.getRangeAt(c);u.intersectsNode(e)&&(o??=u,n=u)}if(!o||!n)return null;let r=ri(o.startContainer,e),a=ri(n.endContainer,e);if(r&&a)return{firstRowId:r,lastRowId:a};let s=e.querySelectorAll("[data-timeline-row-id]"),i=s[0]?.dataset.timelineRowId,d=s[s.length-1]?.dataset.timelineRowId;return i&&d?{firstRowId:r??i,lastRowId:a??d}:null}function kd(e){let t=e.ownerDocument.getSelection?.();if(!t||t.isCollapsed)return!1;for(let o=0;o<t.rangeCount;o+=1)if(t.getRangeAt(o).intersectsNode(e))return!0;return!1}$();function Zr(e){let t=E(e);t.current=e;let o=E(!1),n=E(null),r=E(null),a=E(0),s=R(()=>{a.current+=1,r.current!==null&&cancelAnimationFrame(r.current),r.current=null},[]),i=R(()=>{if(!o.current||!t.current||r.current!==null||n.current===null)return;let u=++a.current;r.current=requestAnimationFrame(m=>{if(u!==a.current||(r.current=null,!o.current||!t.current))return;let p=n.current;n.current=null,p?.(m)})},[]),d=R(u=>{n.current=u,i()},[i]),c=R(()=>{n.current=null,s()},[s]);return fe(()=>(o.current=!0,i(),()=>{o.current=!1,s()}),[e,s,i]),W(()=>({request:d,cancel:c}),[d,c])}function lw({root:e,inputKey:t,visible:o,index:n,topInset:r,bottomInset:a,interactionRows:s,onRangeChange:i,onSelectionChange:d}){let c=E({inputKey:t,visible:o,index:n,topInset:r,bottomInset:a,interactionRows:s,onRangeChange:i,onSelectionChange:d});c.current={inputKey:t,visible:o,index:n,topInset:r,bottomInset:a,interactionRows:s,onRangeChange:i,onSelectionChange:d};let u=Zr(o),m=E(null),p=R(()=>{let g=c.current;if(!e||!g.visible||e.clientHeight<=0)return;let h=e.getBoundingClientRect();if(h.height<=0)return;let y=h.top+g.topInset,x=h.bottom-g.bottomInset,C=e.querySelectorAll("[data-timeline-turn-section]"),b=Ga(C,y),L=[];if(b>=0)for(let S=b;S<C.length;S+=1){let P=C[S];if(P.getBoundingClientRect().top>=x)break;P.dataset.timelineTurnSection!==void 0&&L.push(P.dataset.timelineTurnSection)}let w=[...g.interactionRows()],k=e.ownerDocument.activeElement;if(ai(k)){let S=ri(k,e);S&&w.push(S)}let I=Ju({index:g.index,visibleSectionKeys:L,protectedRowIds:w,selectionRows:Zu(e)}),T=`${g.inputKey}:${JSON.stringify(I)}`;T!==m.current&&(m.current=T,g.onRangeChange?.(I))},[e]),f=R(()=>u.request(p),[u,p]);return fe(()=>{if(m.current=null,!o||!e)return;let g=t,h=!0,y=()=>{!h||c.current.inputKey!==g||!c.current.visible||(c.current.onSelectionChange(kd(e)),f())};e.addEventListener("scroll",y,{passive:!0}),e.addEventListener("focusin",y),e.addEventListener("focusout",y),e.ownerDocument.addEventListener("selectionchange",y);let x=typeof ResizeObserver>"u"?null:new ResizeObserver(y);return x?.observe(e),e.firstElementChild&&x?.observe(e.firstElementChild),y(),()=>{h=!1,u.cancel(),x?.disconnect(),e.removeEventListener("scroll",y),e.removeEventListener("focusin",y),e.removeEventListener("focusout",y),e.ownerDocument.removeEventListener("selectionchange",y),i?.(null)}},[u,t,i,f,e,o]),fe(()=>{o&&f()},[n,f,o]),f}$();var dw=pe(function({sectionKey:t,rowKeyPrefix:o,rowIds:n,renderRow:r,sectionRef:a}){return l("div",{className:"session-turn","data-timeline-turn-section":t,ref:a,children:n.map(s=>l("div",{className:"transcript-col min-w-0 overflow-x-clip",children:r(s)},`${o}:${s}`))})});var TB=400;function cw({root:e,minimumCount:t,keepAbovePx:o=0,canCompact:n,onCompact:r}){let a=e.ownerDocument,s=new Set,i,d=!1,c=()=>e.scrollHeight-e.clientHeight-e.scrollTop<=2,u=()=>{if(i=void 0,a.hidden||s.size>0||!n()||e.clientHeight<=0||!c()||kd(e))return;let L=e.querySelectorAll("[data-timeline-turn-section]"),w=e.getBoundingClientRect().top-32-o,k=0,I=Math.max(0,L.length-t);for(;k<I;){let S=Math.floor((k+I)/2),P=L[S].getBoundingClientRect().bottom;if(!Number.isFinite(P))return;P<=w?k=S+1:I=S}if(k===0)return;let T=a.activeElement;if(T&&ai(T)){for(let S=0;S<k;S+=1)if(L[S].contains(T))return}r(L.length-k)},m=!1,p=()=>{if(a.hidden||s.size>0||!n()||m){clearTimeout(i),i=void 0;return}i===void 0&&(i=setTimeout(u,TB))},f=()=>{clearTimeout(i),i=void 0,p()},g=()=>{let L=c();!L||!d?f():p(),d=L},h=L=>{s.add(L.pointerId),f()},y=L=>{s.delete(L.pointerId),f()},x=()=>{m=kd(e),f()},C=()=>{s.clear(),f()},b=["wheel","keydown","focusin","focusout"];for(let L of b)e.addEventListener(L,f,{passive:!0});return e.addEventListener("scroll",g,{passive:!0}),e.addEventListener("pointerdown",h,!0),a.addEventListener("pointerup",y,!0),a.addEventListener("pointercancel",y,!0),a.addEventListener("selectionchange",x),a.addEventListener("visibilitychange",p),a.defaultView?.addEventListener("blur",C),p(),{schedule:p,disconnect:()=>{clearTimeout(i);for(let L of b)e.removeEventListener(L,f);e.removeEventListener("scroll",g),e.removeEventListener("pointerdown",h,!0),a.removeEventListener("pointerup",y,!0),a.removeEventListener("pointercancel",y,!0),a.removeEventListener("selectionchange",x),a.removeEventListener("visibilitychange",p),a.defaultView?.removeEventListener("blur",C)}}}$();function uw({root:e,topInsetPx:t,onActiveSectionChange:o,onActiveStartHiddenChange:n,active:r}){let a=E(r);a.current=r;let s=Zr(r),i=E(new Map),d=E(null),c=E(null),u=E(o);u.current=o;let m=E(n);m.current=n;let p=E(null),f=E(null),g=R(()=>{if(!a.current||!e)return;let b=e.scrollTop+t,L=null,w=Number.NEGATIVE_INFINITY,k=null,I=Number.POSITIVE_INFINITY;for(let[A,N]of i.current){if(!N.isConnected)continue;let B=N.offsetTop;B<I&&(I=B,k=A),B<=b&&B>=w&&(w=B,L=A)}let T=L??k;T!==c.current&&(c.current=T,u.current(T));let S=T===null?null:i.current.get(T)?.firstElementChild??null,P=S!==null&&S.getBoundingClientRect().bottom<=e.getBoundingClientRect().top+1;P!==p.current&&(p.current=P,m.current?.(P))},[e,t]),h=R(()=>{a.current&&s.request(g)},[s,g]);H(()=>{if(!r||!e||typeof IntersectionObserver>"u")return;let b=!0,L=new IntersectionObserver(()=>{!b||!a.current||h()},{root:e,rootMargin:`-${t}px 0px 0px 0px`,threshold:0});d.current=L;for(let k of i.current.values())L.observe(k);let w=new IntersectionObserver(()=>{!b||!a.current||h()},{root:e,threshold:0});f.current=w;for(let k of i.current.values())k.firstElementChild&&w.observe(k.firstElementChild);return h(),()=>{b=!1,L.disconnect(),d.current=null,w.disconnect(),f.current=null,s.cancel()}},[r,s,h,e,t]);let y=E(new Map),x=R(b=>{let L=y.current.get(b);if(L)return L;let w=k=>{let I=i.current.get(b);I&&I!==k&&(d.current?.unobserve(I),I.firstElementChild&&f.current?.unobserve(I.firstElementChild),i.current.delete(b)),k?(i.current.set(b,k),d.current?.observe(k),k.firstElementChild&&f.current?.observe(k.firstElementChild)):y.current.get(b)===w&&y.current.delete(b)};return y.current.set(b,w),w},[]),C=R(()=>{a.current&&(c.current=null,p.current=null,h())},[h]);return W(()=>({observeSection:x,refresh:C}),[x,C])}function ep(e,t){return e===t?!0:!e||!t?!1:e.identity===t.identity&&e.instanceId===t.instanceId&&e.driverKind===t.driverKind&&e.providerDisplayName===t.providerDisplayName&&e.accentColor===t.accentColor&&e.modelLabel===t.modelLabel&&e.effortLabel===t.effortLabel&&e.effortLevel===t.effortLevel}function pw(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let o=0;o<e.length;o+=1)if(e[o]!==t[o])return!1;return!0}function mw(e,t){return e.turnId===t.turnId&&e.createdAt===t.createdAt&&ep(e.badge,t.badge)}function fw(e,t){if(e===t)return!0;if(e.kind!==t.kind||e.id!==t.id)return!1;switch(e.kind){case"turn-identity":return mw(e,t);case"turn-summary":{let o=t;return e.createdAt===o.createdAt&&e.copyText===o.copyText&&e.cardAnchor===o.cardAnchor&&e.footer===o.footer&&(e.identity===void 0?o.identity===void 0:o.identity!==void 0&&mw(e.identity,o.identity))}case"tool-group":{let o=t;return e.createdAt===o.createdAt&&e.groupId===o.groupId&&pw(e.entries,o.entries)}case"working":{let o=t;return e.createdAt===o.createdAt&&e.turnId===o.turnId&&e.compacting===o.compacting&&ep(e.modelBadge,o.modelBadge)}case"continuation-check":{let o=t;return e.createdAt===o.createdAt&&e.pluginIds.length===o.pluginIds.length&&e.pluginIds.every((n,r)=>n===o.pluginIds[r])}case"model-switch":{let o=t;return e.createdAt===o.createdAt&&e.pending===o.pending&&ep(e.badge,o.badge)}case"proposed-plan":return e.proposedPlan===t.proposedPlan;case"turn-plan":{let o=t;return e.createdAt===o.createdAt&&e.turnPlan.plan===o.turnPlan.plan}case"work":{let o=t;return e.isExpandedToolGroupEntry===o.isExpandedToolGroupEntry&&e.isLastExpandedToolGroupEntry===o.isLastExpandedToolGroupEntry&&pw(e.groupedEntries,o.groupedEntries)}case"message":{let o=t;return e.message===o.message&&e.presentation===o.presentation&&e.textTone===o.textTone&&e.durationStart===o.durationStart&&e.showAssistantMeta===o.showAssistantMeta&&e.showAssistantCopyButton===o.showAssistantCopyButton&&e.copyInFooter===o.copyInFooter&&e.assistantCopyStreaming===o.assistantCopyStreaming&&ep(e.modelBadge,o.modelBadge)}}}function IB(e,t,o){for(let n=t;n<o;n+=1){let r=e[n];switch(r.kind){case"turn-identity":return r.turnId;case"working":if(r.turnId!=null)return r.turnId;break;case"message":if(r.message.role==="assistant")return r.message.turnId;break;case"tool-group":if(r.entries[0]?.turnId!=null)return r.entries[0].turnId;break;case"work":if(r.groupedEntries[0]?.turnId!=null)return r.groupedEntries[0].turnId;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 gw(e,t,o=[]){let n=new Map(o.map(a=>[a.key,a])),r=[];for(let a of t){if(a.end<=a.start)continue;let s=IB(e,a.start,a.end),i=n.get(a.key);if(i!==void 0&&i.turnId===s&&SB(i,e,a.start,a.end)){r.push(i);continue}r.push({key:a.key,turnId:s,firstRowIndex:a.start,rowIds:e.slice(a.start,a.end).map(d=>d.id)})}return r}function SB(e,t,o,n){if(e.firstRowIndex!==o||e.rowIds.length!==n-o)return!1;for(let r=0;r<e.rowIds.length;r+=1)if(e.rowIds[r]!==t[o+r].id)return!1;return!0}function hw(e,t){let o=Math.max(0,Math.min(t,e)),n=e-o;return{startIndex:n,hasHiddenOlder:n>0}}function ja(e,t,o){let n=e.findIndex(r=>r.rowIds.includes(t));return n<0?o:Math.max(o,e.length-n)}function kB(e,t){let o=t.historyWindow,{status:n}=t,r={activities:t.activities,timelineEntries:t.timelineEntries,turnSummaries:t.turnSummaries,latestTurn:o?null:n.latestTurn,runningTurnId:o?null:n.runningTurnId,expandedTurnIds:t.expandedTurnIds,isWorking:!o&&n.isWorking,activeTurnStartedAt:o?null:n.activeTurnStartedAt,continuationCheck:o?null:n.continuationCheck??null,resolveModelBadge:t.resolveModelBadge,pendingModelSelection:o?null:n.pendingModelSelection},a=e.deriveGroups(r),s=n.latestTurn;if(o&&s&&s.completedAt!==null){let i=s.turnId;if(a.rows.some(c=>c.kind==="message"?c.message.role==="assistant"&&c.message.turnId===i:c.kind==="work"?c.groupedEntries.some(u=>u.turnId===i):c.kind==="tool-group"&&c.entries.some(u=>u.turnId===i)))return e.deriveGroups({...r,latestTurn:s})}return a}var LB=new Map,PB={markdown:()=>"",download(){}},RB=[],EB={latestTurn:null,latestAssistantMessageId:null,runningTurnId:null,isWorking:!1,workingStepLabel:null,stall:null,retry:null,activeTurnStartedAt:null,totalTurnCount:null,pendingModelSelection:null,scheduledWakes:RB},MB={inputs:null,structure:{rowIds:[],sections:[]},indexById:new Map,rows:[],meta:{status:EB,usageByTurnId:LB,exportApi:PB,finalAssistantMessageReceived:!1},version:0};function AB(e,t){if(e.length!==t.length)return!1;for(let o=0;o<e.length;o+=1)if(e[o]!==t[o])return!1;return!0}function NB(e,t,o,n){let r=kB(o,e),a=DB(t.structure.rowIds,r.rows),s=a?t.indexById:new Map(r.rows.map((g,h)=>[g.id,h])),i=r.rows.map((g,h)=>{let y=a?t.rows[h]:t.rows[t.indexById.get(g.id)??-1],x=y!==void 0&&fw(y,g)?y:g;return x!==y&&n.add(g.id),x});if(!a)for(let g of t.indexById.keys())s.has(g)||n.add(g);let d=gw(i,r.turnGroups,t.structure.sections),c=a?t.structure.rowIds:i.map(g=>g.id),u=a&&AB(t.structure.sections,d)?t.structure:{rowIds:c,sections:d},m=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===m?t.meta:{status:e.status,usageByTurnId:e.usageByTurnId,exportApi:e.exportApi,finalAssistantMessageReceived:m},f=n.size>0||u!==t.structure||p!==t.meta;return{inputs:e,structure:u,indexById:s,rows:i,meta:p,version:f?t.version+1:t.version}}function DB(e,t){if(e.length!==t.length)return!1;for(let o=0;o<e.length;o+=1)if(e[o]!==t[o].id)return!1;return!0}function si(e){return e.getStructure().rowIds.some(t=>e.getRow(t)?.kind==="message")}function yw(){let e=null,t=null,o=MB,n=new Set,r=0,a=new Set,s=new Map,i=()=>{if(e===null||o.inputs===e)return o;t??=e.derive.createRowsCache();let d=new Set;o=NB(e,o,t,d);for(let c of d)n.add(c);return o};return{setInputs(d){e=d},hasInputs:()=>e!==null,flush(){if(a.size===0&&s.size===0||e===null)return;let{version:d}=i();if(d===r&&n.size===0)return;r=d;let c=[...n];n.clear();for(let u of c){let m=s.get(u);if(m!==void 0)for(let p of Array.from(m))p()}for(let u of Array.from(a))u()},subscribe(d){return a.add(d),()=>{a.delete(d)}},subscribeRow(d,c){let u=s.get(d);return u===void 0&&(u=new Set,s.set(d,u)),u.add(c),()=>{u.delete(c),u.size===0&&s.get(d)===u&&s.delete(d)}},getStructure:()=>i().structure,getRow(d){let{indexById:c,rows:u}=i(),m=c.get(d);return m===void 0?void 0:u[m]},getRows:()=>i().rows,getMeta:()=>i().meta,getVersion:()=>i().version}}$();function tp(e){return Go(e.subscribe,e.getStructure,e.getStructure)}function vw(e,t){let o=R(r=>e.subscribeRow(t,r),[e,t]),n=R(()=>e.getRow(t),[e,t]);return Go(o,n,n)}function Wt(e,t,o=Object.is){let n=E(null),r=R(()=>{let a=e.getVersion(),s=n.current;if(s!==null&&s.store===e&&s.select===t&&s.version===a)return s.value;let i=t(e),d=s!==null&&s.store===e&&o(s.value,i)?s.value:i;return n.current={store:e,select:t,version:a,value:d},d},[e,t,o]);return Go(e.subscribe,r,r)}$();$();function Cw(e,t){return e.getFullYear()!==new Date(t).getFullYear()}function Bg(e,t){return{month:e,day:"numeric",...t?{year:"numeric"}:{}}}function xw(e){let t=new Intl.DateTimeFormat(e,Bg("numeric",!1)),o=new Intl.DateTimeFormat(e,Bg("numeric",!0)),n=(r,a)=>(Cw(r,a)?o:t).format(r);return{ofDate:n,ofIso:(r,a)=>{let s=new Date(r);return Number.isNaN(s.getTime())?"":n(s,a)}}}function bw(e,t){let o=new Date(e);return Number.isNaN(o.getTime())?null:{date:o,formatParams:{date:Bg("short",Cw(o,t))}}}function Tw(e,t){let o={hour:"numeric",minute:"2-digit",...t?{second:"2-digit"}:{}};return e==="locale"?o:{...o,hour12:e==="12-hour"}}function _B(e){let t=e?.trim();if(t)try{return Intl.DateTimeFormat.supportedLocalesOf([t]),t}catch{return}}function OB(){return globalThis.window?.desktopBridge?.getSystemLocale?.()??null}var Iw=_B(OB()),ww=new Map;function Sw(e,t){let o=`${e}:${t?"seconds":"minutes"}`,n=ww.get(o);if(n)return n;let r=new Intl.DateTimeFormat(Iw,Tw(e,t));return ww.set(o,r),r}function Hg(e){let t=new Date(e);return Number.isNaN(t.getTime())?null:t}function FB(e){return{...Tw(e,!1),...e==="locale"?{hourCycle:Sw(e,!1).resolvedOptions().hourCycle}:{}}}function wn(e,t,o){let n=Hg(e);return n?o("timeline.timestampTooltip",{date:n,formatParams:{date:{...FB(t),year:"numeric",month:"long",day:"numeric"}}}):""}var kw=xw(Iw);function Jn(e,t,o,n=Date.now()){let r=Hg(e);if(!r)return"";let a=Sw(t,!1).format(r),s=new Date(n),i=new Date(s.getFullYear(),s.getMonth(),s.getDate()).getTime(),d=new Date(r.getFullYear(),r.getMonth(),r.getDate()).getTime(),c=Math.round((i-d)/864e5);return c<=0?a:c===1?o("relativeTime.yesterdayAt",{time:a}):`${kw.ofDate(r,n)} ${a}`}function Lw(e,t=Date.now()){return kw.ofIso(e,t)}function Pw(e){let t=Hg(e);return t?`${t.getFullYear()}-${t.getMonth()+1}-${t.getDate()}`:""}$();var Fe=qe(null),op=qe(null);$();var ii=new Map,Rw=24,BB=4e3,HB=1024,Ew=16384;function Ug(e){let t=ii.get(e);if(t)return t;let o={values:new Map,listeners:new Set,stringLength:0};if(ii.set(e,o),ii.size>Rw){for(let[n,r]of ii)if(r.listeners.size===0&&n!==e&&(ii.delete(n),ii.size<=Rw))break}return o}function $g(e,t,o){return Ug(e).values.get(t)??o}function Ld(e,t,o,n=!0){let r=Ug(e);if(typeof o=="string"&&(o=o.slice(0,HB)),r.values.get(t)===o)return;let a=r.values.get(t);if(typeof a=="string"&&(r.stringLength-=a.length),r.values.delete(t),r.values.set(t,o),typeof o=="string"&&(r.stringLength+=o.length),r.stringLength>Ew){for(let[s,i]of r.values)if(!(typeof i!="string"||s===t)&&(r.values.delete(s),r.stringLength-=i.length,r.stringLength<=Ew))break}if(r.values.size>BB){let s=r.values.keys().next().value;if(s!==void 0){let i=r.values.get(s);typeof i=="string"&&(r.stringLength-=i.length),r.values.delete(s)}}n&&r.listeners.forEach(s=>s())}function $t(e,t,o){let n=R(i=>{let d=Ug(e);return d.listeners.add(i),()=>d.listeners.delete(i)},[e]),r=R(()=>$g(e,t,o),[e,t,o]),a=Go(n,r,r),s=R(i=>Ld(e,t,i),[e,t]);return[a,s]}function Ne(){let e=Nt().i18n.usePluginTranslation();return{t:(t,o)=>e(t,o)}}var li="chat-process-row flex w-full min-w-0 select-none items-center gap-1.5 px-2 text-left";$();$();var Va=class extends Error{reason;target;constructor(t,o,n){super(UB(t,o),n),this.name="ClipboardError",this.reason=t,this.target=o}};function UB(e,t){switch(e){case"unavailable":return`Clipboard API is unavailable while copying ${t}.`;case"write-failed":return`Failed to copy ${t} to the clipboard.`;case"read-unavailable":return`Clipboard API is unavailable while reading ${t}.`;case"read-failed":return`Failed to read ${t} from the clipboard.`}}function $B(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 o=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 n=o?.focus;typeof n=="function"&&n.call(o)}}async function zB(e,t="text"){if(typeof window>"u")throw new Va("unavailable",t);if(!e)return!1;if(typeof navigator>"u"||!navigator.clipboard?.writeText){if($B(e))return!0;throw new Va("unavailable",t)}try{return await navigator.clipboard.writeText(e),!0}catch(o){throw new Va("write-failed",t,{cause:o})}}function np({timeout:e=2e3,target:t="text",onCopy:o,onError:n}={}){let[r,a]=q(!1),s=E(null),i=E(o),d=E(n),c=E(t),u=E(e);i.current=o,d.current=n,c.current=t,u.current=e;let m=R((p,f)=>{zB(p,c.current).then(g=>{g&&(s.current&&clearTimeout(s.current),a(!0),i.current?.(f),u.current!==0&&(s.current=setTimeout(()=>{a(!1),s.current=null},u.current)))},g=>{let h=g instanceof Error?g:new Error(String(g));console.error(h),d.current?.(h,f)})},[]);return H(()=>()=>{s.current&&clearTimeout(s.current)},[]),{copyToClipboard:m,isCopied:r}}var Mw=1e3,KB={unavailable:"copyButton.clipboardUnavailable","write-failed":"copyButton.copyFailedDetail"},ea=pe(function({text:t,size:o="xs",variant:n="outline",className:r,toastAnchor:a="above",label:s}){let{t:i}=Ne(),d=s??i("copyButton.copyToClipboard"),[c,u]=q(!1),[m,p]=q(null),f=E(null),g=(x,C)=>{f.current&&clearTimeout(f.current),p({title:x,description:C}),f.current=setTimeout(()=>{p(null),u(!1)},Mw)};H(()=>()=>{f.current&&clearTimeout(f.current)},[]);let{copyToClipboard:h,isCopied:y}=np({onCopy:()=>g(i("copyButton.copied")),onError:x=>g(i("copyButton.failedToCopy"),x instanceof Va&&(x.reason==="unavailable"||x.reason==="write-failed")?i(KB[x.reason]):x.message),timeout:Mw});return v(Pe,{open:m!==null||c,onOpenChange:u,children:[l(Ee,{render:l(K,{"aria-label":d,softDisabled:y,onClick:()=>h(t),type:"button",size:o,variant:n,className:V("text-muted-foreground hover:text-foreground",r)}),children:y?l(Cn,{className:"size-3 text-primary"}):l(Ba,{className:"size-3"})}),v(Re,{side:a==="above"?"top":"bottom",className:"max-w-72",role:m?"status":void 0,children:[l("span",{children:m?.title??d}),m?.description?l("span",{className:"block text-muted-foreground",children:m.description}):null]})]})});function rp({text:e,label:t,children:o}){return v("span",{className:"group/hover-copy inline-flex min-w-0 items-center gap-0.5",children:[o,l("span",{className:"inline-flex opacity-0 transition-opacity duration-(--control-duration) pointer-events-none group-focus-within/hover-copy:pointer-events-auto group-focus-within/hover-copy:opacity-100 group-hover/hover-copy:pointer-events-auto group-hover/hover-copy:opacity-100 [@media(pointer:coarse)]:pointer-events-auto [@media(pointer:coarse)]:opacity-100",children:l(ea,{text:e,label:t,variant:"ghost",size:"icon-xs",className:"shrink-0",toastAnchor:"below"})})]})}$();var qB=new Map([[".m4v","video/mp4"],[".mov","video/quicktime"],[".mp4","video/mp4"],[".ogv","video/ogg"],[".webm","video/webm"]]),WB=new Map([[".aac","audio/aac"],[".flac","audio/flac"],[".m4a","audio/mp4"],[".mp3","audio/mpeg"],[".oga","audio/ogg"],[".ogg","audio/ogg"],[".opus","audio/ogg"],[".wav","audio/wav"],[".weba","audio/webm"]]),Aw=new Set([".doc",".docx",".odt",".ppt",".pptx",".odp",".xls",".xlsx",".ods"]);function Nw(e){let t=zg(e);return qB.has(t)?"video":WB.has(t)?"audio":null}function zg(e){let t=e.split(/[\\/]/).at(-1)??"",o=t.lastIndexOf(".");return o<=0?"":t.slice(o).toLowerCase()}var GB=["image/gif","image/jpeg","image/png","image/webp"],jB=new Set(GB);function VB(e){return jB.has(e.toLowerCase())}function Dw(e){return VB(e)?"image":"file"}var QB=new Set(["application/json","application/xml","application/x-yaml","application/yaml"]);function Tn(e){if(e.type==="image")return"image";let t=e.mimeType.toLowerCase();if(t==="image/svg+xml")return"svg";if(t==="application/pdf")return"pdf";let o=Nw(e.name);return o||(Aw.has(zg(e.name))?"office":t.startsWith("text/")||QB.has(t)?"text":"file")}var XB=25*1024*1024;function _w(e){return e.kind==="video"||e.kind==="audio"||e.sizeBytes===void 0||e.sizeBytes<=XB}function di(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 ap(e,t){let o=e.flatMap(r=>r.previewUrl?[{...r,src:r.previewUrl}]:[]);if(o.length===0)return null;let n=o.findIndex(r=>r.id===t);return n<0?null:{images:o.map(r=>({src:r.src,name:r.name,attachmentId:r.id,...r.source===void 0?{}:{source:r.source},...r.type!==void 0&&r.mimeType!==void 0&&Tn({type:r.type,mimeType:r.mimeType,name:r.name})==="svg"?{svg:!0}:{}})),index:n}}function sp(e){switch(e){case"image":case"svg":return Yl;case"video":return $r;case"audio":return xn;case"pdf":return Ha;case"office":return ql;case"text":return Kl;case"file":return jo}}function Cr(e){let t=Tn(e);return(t==="image"||t==="svg")&&_w({kind:t,sizeBytes:e.sizeBytes})}function Kg(e){let t={id:e.id,name:e.name,mimeType:e.mimeType,sizeBytes:e.sizeBytes};return Dw(e.mimeType)==="image"?{type:"image",...t}:{type:"file",...t,...e.source?{source:e.source}:{}}}function Oo(e){return e.source?._tag==="agent-artifact"?e.source:void 0}function qg({rowId:e,messageId:t,attachments:o}){let n=xe(Fe),[r,a]=$t(n.threadKey,`attachments:${t}`,!1),{t:s}=Ne(),i=o.toSorted((c,u)=>+(Oo(u)?.delivered===!0)-+(Oo(c)?.delivered===!0)),d=r?i:i.slice(0,4);return o.length===0?null:v("div",{className:"mb-2 max-w-[420px]","data-assistant-attachments":"",children:[l("div",{className:"grid grid-cols-2 items-start gap-2",children:d.map(c=>l("div",{className:"min-w-0",children:Cr(c)?l(Pd,{images:[c],gallery:i.filter(Cr)}):l(Rd,{attachment:c})},c.id))}),!r&&i.length>4?l(K,{variant:"ghost",size:"xs",className:"mt-1","aria-expanded":!1,onClick:()=>{n.onProcessDisclosureChange?.(e),a(!0)},children:s("attachments.showMore")}):null]})}function Pd({images:e,gallery:t}){let o=xe(Fe),{t:n}=Ne();return e.length===0?null:l("div",{className:t?"grid":"mb-2 grid max-w-[420px] grid-cols-2 gap-2",children:e.map(r=>v("div",{className:"overflow-hidden rounded-lg border border-border/80 bg-background/70",children:[r.previewUrl?l("button",{type:"button",className:"w-full cursor-zoom-in","data-attachment-action":"preview","data-attachment-name":r.name,"aria-label":n("attachments.preview",{name:r.name}),onClick:()=>{let a=ap(t??e,r.id);a&&o.onImageExpand(a)},children:l("img",{src:r.previewUrl,alt:r.name,loading:"lazy",decoding:"async",className:Tn(r)==="svg"?"block h-auto max-h-[220px] w-full bg-white object-contain":"block h-auto max-h-[220px] w-full object-cover object-top"})}):l("div",{className:"flex min-h-[72px] items-center justify-center px-2 py-3 text-center text-secondary-label text-chat-dense",children:r.name}),Oo(r)?.delivered||Oo(r)?.title||Oo(r)?.note?v("div",{className:"px-2 py-1 text-chat-meta",children:[l("p",{className:"break-words font-medium",children:Oo(r)?.title||r.name}),Oo(r)?.note?l("p",{className:"whitespace-pre-wrap break-words text-secondary-label",children:Oo(r)?.note}):null]}):null]},r.id))})}function Rd(e){let{t}=Ne(),o=xe(Fe).onAttachmentDocumentOpen,n=Tn(e.attachment),r=sp(n),a=t("attachments.open",{name:e.attachment.name}),s=v(oe,{children:[l(r,{className:"size-4 shrink-0 text-secondary-label"}),v("span",{className:"min-w-0 flex-1",children:[l("span",{className:"block truncate font-medium text-foreground text-chat-row",children:Oo(e.attachment)?.title||e.attachment.name}),Oo(e.attachment)?.note?l("span",{className:"block whitespace-pre-wrap break-words text-secondary-label text-chat-meta",children:Oo(e.attachment)?.note}):null,l("span",{className:"block text-secondary-label text-chat-meta",children:Oo(e.attachment)?.fileCount?t("attachments.folderFiles",{count:Oo(e.attachment).fileCount}):di(e.attachment.sizeBytes)})]})]});return!Oo(e.attachment)?.delivered&&e.attachment.previewUrl&&(n==="video"||n==="audio")?v("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:[l("a",{href:e.attachment.previewUrl,target:"_blank",rel:"noreferrer","aria-label":a,className:"flex items-center gap-2 hover:underline",children:s}),l(Ob,{kind:n,src:e.attachment.previewUrl,title:e.attachment.name})]}):o?l("button",{type:"button","data-attachment-action":"open","data-attachment-name":e.attachment.name,"aria-label":a,onClick:()=>o({attachmentId:e.attachment.id,name:e.attachment.name,mimeType:e.attachment.mimeType,sizeBytes:e.attachment.sizeBytes}),className:"flex w-full cursor-[var(--control-cursor)] items-center gap-2 rounded-sm border border-border/70 bg-background/70 px-2.5 py-2 text-start hover:bg-background/90",children:s}):e.attachment.previewUrl?l("a",{href:e.attachment.previewUrl,download:e.attachment.name,target:"_blank",rel:"noreferrer","aria-label":a,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:s}):l("div",{className:"flex items-center gap-2 rounded-sm border border-border/70 bg-background/70 px-2.5 py-2",children:s})}$();function YB({environmentId:e,pluginId:t}){let{t:o}=z();return Xn(e,t)??o("rewrite.unknownPlugin")}function ip({rewrite:e,text:t,environmentId:o}){let{t:n}=z(),[r,a]=q(!1);if(!e)return null;let s=[...new Set(e.steps.filter(c=>c.via==="before-send").map(c=>c.pluginId))],i=[...new Set(e.steps.filter(c=>c.via==="slash-command").map(c=>c.pluginId))],d=c=>c.map((u,m)=>v("span",{children:[m?", ":"",l(YB,{environmentId:o,pluginId:u})]},u));return v("div",{className:"max-w-full text-chat-row text-muted-foreground","data-message-rewrite":"",children:[l(K,{size:"xs",variant:"ghost",className:"h-auto min-h-6 max-w-full whitespace-normal text-xs","aria-expanded":r,"aria-label":n("rewrite.showReceived"),onClick:()=>a(c=>!c),children:v("span",{children:[i.length?v(oe,{children:[n("rewrite.expandedPrefix"),d(i),n("rewrite.expandedSuffix"),s.length?", ":""]}):null,s.length?v(oe,{children:[n("rewrite.changedPrefix"),d(s),n("rewrite.changedSuffix")]}):null]})}),r?v("div",{className:"mt-1 max-w-full rounded-md border border-border p-2",children:[l("p",{className:"mb-1 text-xs",children:n("rewrite.received")}),l("pre",{className:"whitespace-pre-wrap break-words font-sans text-xs [overflow-wrap:anywhere]",children:t})]}):null]})}$();$();var Ed=e=>e;function Zn(){return Nt().useThreadDisplayTitle?.()??Ed}$();var Ow=qe(null);function Fw({data:e,target:t,children:o}){let n=W(()=>({data:e,target:t}),[e,t]);return l(Ow,{value:n,children:o})}function ci(){return xe(Ow)}function Bw({messageId:e}){let t=ci(),o=t?.data.useMessageForks;return!t||!o?null:l(JB,{read:o,target:t.target,messageId:e})}function JB({read:e,target:t,messageId:o}){let{t:n}=z(),r=Zn(),[a,s]=q(!1),{threads:i,openThread:d}=e(t,o);return i.length===0?null:v(nn,{open:a,onOpenChange:s,children:[l(an,{render:l(K,{variant:"ghost",size:"xs"}),children:n("forkRelations.count",{count:i.length})}),l(rn,{"aria-label":n("forkRelations.listTitle"),className:"max-h-72 max-w-80 overflow-y-auto p-1",children:i.map(c=>v(K,{variant:"ghost",className:"h-auto w-full flex-col items-start gap-0.5 py-2",onClick:()=>{s(!1),d(c.threadId)},children:[l("span",{className:"max-w-full truncate",children:r(c.title)}),l("time",{className:"text-chat-dense text-muted-foreground",dateTime:c.createdAt,children:new Date(c.createdAt).toLocaleString()})]},c.threadId))})]})}$();function Hw({messageId:e,rowId:t}){let o=ci(),n=o?.data.useMessageMemory,r=o?.data.useMemoryExperience;return!o||!n||!r?null:l(ZB,{readMemory:n,readExperience:r,target:o.target,messageId:e,rowId:t})}function ZB({readMemory:e,readExperience:t,target:o,messageId:n,rowId:r}){let a=e(o,n);return a===null?null:l(eH,{experienceIds:a.experienceIds,readExperience:t,target:o,messageId:n,rowId:r})}function eH({experienceIds:e,readExperience:t,target:o,messageId:n,rowId:r}){let{t:a}=z(),s=xe(Fe),[i,d]=$t(s.threadKey,`memory-context:${n}`,!1),c=ho();return v("div",{className:"flex min-w-0 flex-col items-start gap-1.5 self-stretch","data-memory-context":"",children:[v(K,{variant:"ghost-muted",size:"xs",className:"-ms-1 gap-1.5 [&_svg]:mx-0","aria-expanded":i,"aria-controls":i?c:void 0,onClick:()=>{s.onProcessDisclosureChange?.(r),d(!i)},children:[l(Tt,{"aria-hidden":!0,className:V("size-icon-1",!i&&"-rotate-90")}),l(Fl,{"aria-hidden":!0,className:"size-icon-1"}),a("memoryContext.included",{count:e.length})]}),i?l("ul",{id:c,className:"m-0 w-full max-w-xl list-none divide-y divide-border overflow-hidden rounded-xl border border-border bg-card p-0",children:e.map(u=>l(tH,{readExperience:t,target:o,experienceId:u},u))}):null]})}function tH({readExperience:e,target:t,experienceId:o}){let n=e(t,o);return v("li",{className:"flex min-w-0 items-center gap-2.5 py-2 ps-3 pe-2","data-memory-experience-state":n.state,children:[l(oH,{experience:n}),l(nH,{experience:n})]})}function oH({experience:e}){let{t}=z();switch(e.state){case"loading":return v("div",{className:"min-w-0 flex-1","aria-busy":"true",children:[l("span",{className:"sr-only",children:t("memoryContext.loading")}),l(Mg,{className:"h-4 w-3/4"}),l(Mg,{className:"mt-1 h-3 w-1/2"})]});case"failed":return l("p",{className:"m-0 min-w-0 flex-1 text-chat-row text-muted-foreground",children:t("memoryContext.loadFailed")});case"erased":return l("p",{className:"m-0 min-w-0 flex-1 text-chat-row text-muted-foreground",children:t("memoryContext.erased")});case"active":case"forgotten":{let o=e.state==="forgotten",n=e.recordedAt===null?null:bw(e.recordedAt,Date.now());return v("div",{className:"min-w-0 flex-1",children:[l("p",{className:V("m-0 line-clamp-2 text-ui-sm",e.title===null?"text-muted-foreground":"font-medium",o&&"text-muted-foreground line-through"),children:e.title??t("memoryContext.textUnavailable")}),n===null?null:l("p",{className:"m-0 text-chat-row text-muted-foreground",children:t("memoryContext.recordedBy",{author:e.authorLabel??"",...n})}),o?l("p",{className:"m-0 text-chat-row text-muted-foreground",children:t("memoryContext.forgottenNote")}):null]})}}}function nH({experience:e}){let{t}=z();switch(e.state){case"loading":case"erased":return null;case"failed":return l(K,{variant:"ghost",size:"xs",onClick:e.retry,children:t("memoryContext.retry")});case"active":case"forgotten":{let o=e.state==="forgotten";return v("div",{className:"flex shrink-0 items-center gap-1.5",children:[o?l(jr,{variant:"muted",size:"sm",children:t("memoryContext.forgotten")}):null,v(K,{variant:"ghost",size:"xs",disabled:e.pending,softDisabled:e.blockedReason!==null,title:e.blockedReason??void 0,onClick:o?e.restore:e.forget,children:[e.pending?l(Qs,{}):null,t(o?"memoryContext.restore":"memoryContext.forget")]})]})}}}$();var rH=()=>null;function lp(e){let t=(e.useMachineLabel??rH)(e.reference.environmentId),o=Zn();return v(oe,{children:[l("div",{className:"wrap-anywhere",children:o(e.reference.title)}),t===null?null:l("div",{className:"text-muted-foreground",children:t})]})}var aH=Object.freeze([]),sH=()=>aH;function Uw(e){return e.type==="file"&&e.source?._tag==="thread-reference"}function iH(e){return e.omitted===null?e.carried:v(oe,{children:[l("span",{className:"inline-block max-w-full",children:e.carried})," ",l("span",{className:"inline-block max-w-full",children:e.omitted})]})}function $w(e){let t=xe(Fe),{t:o}=Ne(),r=(t.threadReferences?.useDeliveries??sH)(t.activeThreadEnvironmentId,e).filter(a=>a.status!=="unreadable");return r.length===0?null:l("ul",{"aria-label":o("threadReference.listLabel"),className:"flex min-w-0 max-w-[min(70%,40rem)] flex-col gap-0.5 text-chat-dense text-muted-foreground",children:r.map(a=>l(lH,{delivery:a},`${a.reference.environmentId}:${a.reference.threadId}`))})}function lH(e){let{delivery:t}=e,o=xe(Fe),{t:n}=Ne(),r=Zn(),a=s=>{let i={reference:t.reference};s.dispatchEvent(new CustomEvent(Hs,{bubbles:!0,detail:i}))};return l("li",{"data-thread-reference-delivery":t.status,className:"flex min-w-0",children:v(Pe,{children:[v(Ee,{render:l("button",{type:"button",className:"relative flex min-w-0 flex-1 cursor-[var(--control-cursor)] items-start gap-1 rounded-sm text-left hover:text-foreground pointer-coarse:after:absolute pointer-coarse:after:inset-0 pointer-coarse:after:min-h-11",onClick:s=>a(s.currentTarget)}),children:[l("span",{className:"flex h-lh shrink-0 items-center",children:l(gr,{"aria-hidden":"true",className:"size-3.5"})}),v("span",{className:"flex min-w-0 flex-1 flex-wrap gap-x-1",children:[l("span",{className:"max-w-max min-w-0 grow basis-24 truncate",children:n("threadReference.title",{title:r(t.reference.title)})}),l("span",{className:"max-w-full",children:t.status==="carried"?l(iH,{carried:n("threadReference.carried",{count:t.carriedMessages}),omitted:t.omittedMessages>0?n("threadReference.omitted",{count:t.omittedMessages}):null}):t.status==="missing"?n("threadReference.missing"):n("threadReference.loading")})]})]}),l(Re,{side:"top",className:"max-w-120 whitespace-normal leading-tight",children:l(lp,{reference:t.reference,useMachineLabel:o.threadReferences?.useMachineLabel})})]})})}$();var dH=/\n*<terminal_context>\n([\s\S]*?)\n<\/terminal_context>\s*$/,cH=/\n*<element_context>\n([\s\S]*?)\n<\/element_context>\s*$/,uH=/\n*<browser_annotation>\n((?:(?!<browser_annotation>)[\s\S])*)\n<\/browser_annotation>\s*$/;function zw(e){let t=[],o=null,n=()=>{o&&(t.push({header:o.header,body:o.bodyLines.join(`
3518
3518
  `).trimEnd()}),o=null)};for(let r of e.split(`
3519
- `)){let a=/^- (.+):$/.exec(r);if(a){n(),o={header:a[1],bodyLines:[]};continue}o&&(r.startsWith(" ")?o.bodyLines.push(r.slice(2)):r.length===0&&o.bodyLines.push(""))}return n(),t}function dH(e){return e.replace(/\r\n/g,`
3520
- `).replace(/^\n+|\n+$/g,"")}function cH(e){return dH(e.text).length>0}function $w(e){return!cH(e)}function zw(e){let t=e.terminalLabel.trim().toLowerCase().replace(/\s+/g,"-"),o=e.lineStart===e.lineEnd?`${e.lineStart}`:`${e.lineStart}-${e.lineEnd}`;return`@${t}:${o}`}function Qa(e){let t=iH.exec(e);if(!t)return{promptText:e,contextCount:0,contexts:[]};let o=e.slice(0,t.index).replace(/\n+$/,""),n=Uw(t[1]??"");return{promptText:o,contextCount:n.length,contexts:n}}function uH(e){let t=sH.exec(e);if(!t)return{promptText:e,contextCount:0,previewTitle:null,contexts:[]};let o=e.slice(0,t.index).replace(/\n+$/,""),n=Uw(t[1]??"");return{promptText:o,contextCount:n.length,previewTitle:n.length>0?n.map(({header:r,body:a})=>a.length>0?`${r}
3519
+ `)){let a=/^- (.+):$/.exec(r);if(a){n(),o={header:a[1],bodyLines:[]};continue}o&&(r.startsWith(" ")?o.bodyLines.push(r.slice(2)):r.length===0&&o.bodyLines.push(""))}return n(),t}function pH(e){return e.replace(/\r\n/g,`
3520
+ `).replace(/^\n+|\n+$/g,"")}function mH(e){return pH(e.text).length>0}function Kw(e){return!mH(e)}function qw(e){let t=e.terminalLabel.trim().toLowerCase().replace(/\s+/g,"-"),o=e.lineStart===e.lineEnd?`${e.lineStart}`:`${e.lineStart}-${e.lineEnd}`;return`@${t}:${o}`}function Qa(e){let t=cH.exec(e);if(!t)return{promptText:e,contextCount:0,contexts:[]};let o=e.slice(0,t.index).replace(/\n+$/,""),n=zw(t[1]??"");return{promptText:o,contextCount:n.length,contexts:n}}function fH(e){let t=dH.exec(e);if(!t)return{promptText:e,contextCount:0,previewTitle:null,contexts:[]};let o=e.slice(0,t.index).replace(/\n+$/,""),n=zw(t[1]??"");return{promptText:o,contextCount:n.length,previewTitle:n.length>0?n.map(({header:r,body:a})=>a.length>0?`${r}
3521
3521
  ${a}`:r).join(`
3522
3522
 
3523
- `):null,contexts:n}}function ui(e){let t=Qa(e),o=uH(t.promptText);return{visibleText:o.promptText,copyText:e,contextCount:o.contextCount,previewTitle:o.previewTitle,contexts:o.contexts,elementContexts:t.contexts}}function pi(e){let t=lH.exec(e);if(!t)return{promptText:e,annotation:null};let o=t[1]??"",n=o.split(`
3524
- `),r=n.find(p=>p.startsWith("Page: ")),a=n.find(p=>p.startsWith("Id: ")),s=n.find(p=>p.startsWith("Comment: ")),i=n.find(p=>p.startsWith("Targets: ")),d=n.indexOf("Requested visual changes:"),c=n.slice(d+1),u=c.indexOf("<element_context>"),m=d<0?[]:c.slice(0,u<0?void 0:u).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()||"Browser annotation",comment:s?.slice(9).trim()||"",targetSummary:i?.slice(9).trim()||"",styleChanges:m,hasScreenshot:o.includes("The attached screenshot is the annotated browser crop.")}}}function pH(e){let t=e.match(/:(\d+)$/);if(!t?.[1])return{path:e,line:void 0,column:void 0};let o=e.slice(0,-t[0].length),n=o.match(/:(\d+)$/);return n?.[1]?{path:o.slice(0,-n[0].length),line:n[1],column:t[1]}:{path:o,line:t[1],column:void 0}}function Wg(e){return e.replaceAll("\\","/")}function Gg(e){return/^\/[A-Za-z]:\//.test(e)?e.slice(1):e}function mH(e){return Gg(Wg(e.replace(/[\\/]+$/,"")))}function fH(e){return e.slice(e.lastIndexOf("/")+1)}function gH(e){return e.startsWith("/")||/^[A-Za-z]:\//.test(e)}function hH(e){return e.startsWith("\\\\")||/^[A-Za-z]:([/\\]|$)/.test(Gg(Wg(e)))}function dp(e,t){let{path:o,line:n,column:r}=pH(e),a=Gg(Wg(o)),s=a;if(t){let i=mH(t),d=fH(i),c=hH(t)?p=>p.toLowerCase():p=>p,u=c(a),m=c(i);if(u===m)s=d;else if(u.startsWith(`${m}/`))s=`${d}/${a.slice(i.length+1)}`;else if(!gH(a)){let p=a.replace(/^\.\/+/,"").replace(/^\/+/,"");s=u.startsWith(`${c(d)}/`)?a:`${d}/${p}`}}return n?`${s}:${n}${r?`:${r}`:""}`:s}var yH=/<review_comment\b([^>]*)>\s*([\s\S]*?)<\/review_comment>/g,vH=/([a-zA-Z][a-zA-Z0-9_-]*)="([^"]*)"/g,CH=/(`{3,})([^\s`]*)[^\n]*\n([\s\S]*?)\n\1/g;function xH(e){return e.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&amp;/g,"&")}function bH(e){let t={};for(let o of e.matchAll(vH))t[o[1]]=xH(o[2]??"");return t}function Kw(e){return e===void 0||!/^\d+$/.test(e)?null:Number(e)}function wH(e){let o=Array.from(e.matchAll(CH)).at(-1),n=o?.index;return{text:e.slice(0,n??e.length).trim(),language:o?.[2]?.trim()||"diff",contents:o?.[3]??""}}function TH(e,t,o){let n=bH(e),r=Kw(n.startIndex),a=Kw(n.endIndex),s=n.filePath?.trim(),i=n.sectionId?.trim();if(!s||!i||r===null||a===null)return null;let d=wH(t);return{id:`review-comment:${o}:${i}:${s}:${r}:${a}`,sectionId:i,sectionTitle:n.sectionTitle?.trim()||null,filePath:s,startIndex:Math.min(r,a),endIndex:Math.max(r,a),rangeLabel:n.rangeLabel?.trim()||null,text:d.text,diff:d.contents,fenceLanguage:d.language}}function mi(e){let t=[],o=0,n=0;for(let a of e.matchAll(yH)){let s=a.index??0,i=e.slice(o,s);i.length>0&&t.push({kind:"text",id:`review-comment-text:${o}`,text:i});let d=TH(a[1]??"",a[2]??"",n);d?(t.push({kind:"review-comment",comment:d}),n+=1):t.push({kind:"text",id:`review-comment-invalid:${s}`,text:a[0]}),o=s+a[0].length}let r=e.slice(o);return r.length>0&&t.push({kind:"text",id:`review-comment-text:${o}`,text:r}),t}function qw(e,t){let o=Math.max(0,...Array.from(t.matchAll(/`+/g),r=>r[0].length)),n="`".repeat(Math.max(3,o+1));return[`${n}${e}`,t.trimEnd(),n].join(`
3525
- `)}function Ww(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 o=e.filePath.replaceAll("\\","/");return[`diff --git a/${o} b/${o}`,`--- a/${o}`,`+++ b/${o}`,t].join(`
3526
- `)}$();function Gw(e){return pe(function(o){let n=e.usePierreIcons();El(n.ensureSprite,[n.ensureSprite]);let{resolveForEntry:r}=n,a=W(()=>r(o.pathValue,o.kind),[r,o.kind,o.pathValue]);return n.ready?l("svg",{"aria-hidden":"true","data-file-icon":a.symbolId,className:e.cn("size-4 shrink-0",o.className),children:l("use",{href:`#${a.symbolId}`})}):o.kind==="directory"?l(zr,{className:e.cn("size-4 shrink-0 text-icon-muted",o.className)}):l(Wl,{className:e.cn("size-4 shrink-0 text-icon-muted",o.className)})})}function jw(e){return function(o){return v(oe,{children:[l(e.EntryIcon,{pathValue:o.path,kind:e.inferEntryKindFromPath(o.path),theme:o.theme,className:e.iconClassName}),l("span",{className:o.selectable?e.selectableLabelClassName:e.labelClassName,children:o.label})]})}}function Vw(e){return(t,o)=>l("span",{className:"inline-flex align-middle leading-none","data-markdown-copy":o,children:v("span",{className:e.chipClassName,children:[l("span",{"aria-hidden":"true",className:e.iconClassName,dangerouslySetInnerHTML:{__html:e.iconSvg}}),l("span",{className:e.labelClassName,children:e.label(t)})]})})}$();var Md="[a-zA-Z][a-zA-Z0-9:_-]*";function fi(e){return e===" "||e===`
3527
- `||e===" "||e==="\r"}function xr(e){return e.enabled&&e.userInvocable!==!1}var Xw="ycodium",Qw=`${Xw}:`,IH=new RegExp(String.raw`(^|\s)([$/])(${Md})(?=\s|$)`,"g");function jg(e){return[...e.matchAll(IH)].map(t=>{let o=(t.index??0)+(t[1]?.length??0),n=t[3]??"";return{sigil:t[2],name:n,start:o,end:o+n.length+1}})}var RJ=new RegExp(String.raw`([$/])(${Md})(?=\s|$)`,"y");function Yw(e,t){let o=t.get(e);if(o!==void 0)return o;if(!e.startsWith(Qw))return;let n=t.get(e.slice(Qw.length));return n?.scope===Xw?n:void 0}function Jw(e,t,o,n=fi){if(t.length!==e.length+1)return null;let r=0;for(;r<e.length&&e[r]===t[r];)r+=1;let a=t.charAt(r);if(!fi(a)||r<e.length&&n(e.charAt(r))||t.slice(r+1)!==e.slice(r))return null;let s=r;for(;s>0&&!n(t.charAt(s-1));)s-=1;let d=SH.exec(t.slice(s,r))?.[1];return d===void 0||Yw(d,o)===void 0?null:{start:s,end:r+1,replacement:`$${d}${a}`}}var SH=new RegExp(String.raw`^/(${Md})$`);function cp(e){return new Map(e.map(t=>[t.name,t]))}function kH(e,t){return t.size===0?[]:jg(e).flatMap(o=>{let n=Yw(o.name,t);return n===void 0?[]:[{...o,skill:n}]})}function Zw(e,t){let o=[],n=0;for(let r of kH(e,t))r.start>n&&o.push({kind:"text",text:e.slice(n,r.start)}),o.push({kind:"skill",key:`${r.start}:${r.name}`,skill:r.skill,raw:e.slice(r.start,r.end)}),n=r.end;return n===0?null:(n<e.length&&o.push({kind:"text",text:e.slice(n)}),o)}function eT(e){let t=Zw(e.text,e.index);return t===null?l(oe,{children:e.text}):l(oe,{children:t.map(o=>o.kind==="text"?o.text:l(Aa,{children:e.renderSkill(o.skill,o.raw)},o.key))})}var LH="inline-flex h-[1.41em] max-w-full items-center gap-[0.33em] rounded-[0.5em] px-[0.5em] font-medium align-middle",PH=`${LH} border border-border/70 bg-accent/40 text-foreground`,up=`${PH} text-control-1`,pp="block size-[1.17em] shrink-0 self-center opacity-85 [&>svg]:block",mp="truncate",tT='<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 oT="inline-flex h-[1.41em] max-w-full items-center gap-[0.33em] rounded-[0.5em] px-[0.5em] font-medium align-middle",nT=`${oT} border border-border/70 bg-accent/40 text-foreground`,RH=`${nT} text-control-1`,ln=`${nT} text-[0.86em] leading-none select-none`,Ad="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-['']",Fo="block size-[1.17em] shrink-0 self-center opacity-85 [&>svg]:block",rT="truncate",Bo="block self-center truncate leading-tight select-none",Vg="border-skill-chip-border bg-skill-chip text-skill-chip-foreground",aT=`${oT} select-none border ${Vg} text-[0.86em] leading-none`,sT='<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>',fp="ml-[0.17em] inline-flex size-[1.17em] shrink-0 cursor-[var(--control-cursor)] items-center justify-center rounded-sm text-muted-foreground/72 transition-colors hover:bg-foreground/10 hover:text-foreground";function EH(e){return e.split(/[\s_-]+/).filter(t=>t.length>0).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}function MH(e){let t=e.displayName?.trim();return t||EH(e.name)}var AH=Vw({chipClassName:V(up,Vg),iconClassName:pp,labelClassName:mp,iconSvg:tT,label:MH});function iT(e){return l(eT,{text:e.text,index:e.index,renderSkill:AH})}function lT(e){let{label:t,tooltipText:o,expired:n=!1}=e;return v(Pe,{children:[v(Ee,{render:l("span",{className:V(up,n&&"border-destructive/35 bg-destructive/8 text-destructive-foreground"),"data-terminal-context-expired":n?"true":void 0}),children:[l(Qo,{className:V(pp,"size-icon-1",n&&"opacity-100")}),l("span",{className:mp,children:t})]}),l(Re,{side:"top",className:"max-w-80 whitespace-pre-wrap leading-tight",children:o})]})}var NH=/^(.*?)\s+line(?:s)?\s+(\d+)(?:-(\d+))?$/i;function dT(e){let t=[];for(let o of e){let n=o.header.trim();n.length>0&&t.push(gp(n))}return t.join(" ")}function gp(e){let t=e.trim(),o=NH.exec(t);if(!o)return`@${t.toLowerCase().replace(/\s+/g,"-")}`;let n=Number.parseInt(o[2]??"",10),r=Number.parseInt(o[3]??o[2]??"",10);return!Number.isFinite(n)||!Number.isFinite(r)?`@${t.toLowerCase().replace(/\s+/g,"-")}`:zw({terminalLabel:o[1]?.trim()||"terminal",lineStart:n,lineEnd:r})}function cT(e,t){let o=0;for(let n of t){let r=gp(n.header),a=e.indexOf(r,o);if(a===-1)return!1;o=a+r.length}return!0}var uT=pe(function(t){let o=t.context.body.length>0?`${t.context.header}
3528
- ${t.context.body}`:t.context.header;return l(lT,{label:t.context.header,tooltipText:o})}),mT=pe(function(t){let o=t.context.body?`${t.context.header}
3529
- ${t.context.body}`:t.context.header;return v(Pe,{children:[v(Ee,{render:l("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:[l(Wn,{className:"size-3 shrink-0"}),l("span",{className:"truncate",children:t.context.header})]}),l(Re,{side:"top",className:"max-w-96 whitespace-pre-wrap leading-tight",children:o})]})});function fT(e){let t=xe(Fe),{t:o}=Ne();return v("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?l("button",{type:"button",className:"size-14 shrink-0 cursor-zoom-in overflow-hidden border-r border-border/70 bg-muted","aria-label":o("attachments.preview",{name:e.image.name}),onClick:()=>{if(!e.image)return;let n=ap([e.image],e.image.id);n&&t.onImageExpand(n)},children:l("img",{src:e.image.previewUrl,alt:o("browserAnnotation.cropAlt"),className:"size-full object-cover"})}):null,v("div",{className:"min-w-0 px-2.5 py-2",children:[e.annotation.comment?l("div",{className:"max-w-80 truncate text-foreground text-chat-row font-medium",children:e.annotation.comment}):null,v("div",{className:V("flex items-center gap-2 text-secondary-label text-chat-meta",e.annotation.comment&&"mt-1"),children:[e.annotation.targetSummary?l("span",{className:"truncate",children:e.annotation.targetSummary}):null,e.annotation.styleChanges.length>0?v("span",{className:"inline-flex shrink-0 items-center gap-1",children:[l(za,{className:"size-3"}),e.annotation.styleChanges.length]}):null]})]})]})}var DH=8,_H=600,OH=1.75,pT=`linear-gradient(to bottom, black calc(100% - ${OH}rem), transparent)`;function FH(e){return e.trim().length===0?!1:e.length>_H||e.split(`
3530
- `).length>DH}var gT=pe(function(t){let o=xe(Fe),{t:n}=Ne(),[r,a]=$t(o.threadKey,`${t.disclosureKey}:expanded`,!1),s=t.text.trim().length>0||t.terminalContexts.length>0,i=s&&FH(t.text),d=i&&!r;return v("div",{children:[s?l("div",{className:V("relative",d&&"max-h-44 overflow-hidden"),"data-user-message-body":"true","data-user-message-collapsed":d?"true":"false","data-user-message-collapsible":i?"true":"false","data-user-message-fade":d?"true":"false",style:d?{WebkitMaskImage:pT,maskImage:pT}:void 0,children:l(BH,{disclosureKey:t.disclosureKey,text:t.text,terminalContexts:t.terminalContexts,skills:t.skills,markdownCwd:t.markdownCwd})}):null,i||t.footer?v("div",{className:V("mt-1.5 flex items-center gap-2",i&&t.footer?"justify-between":"justify-end"),"data-user-message-footer":"true",children:[i?l(K,{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:n(r?"timeline.showLess":"timeline.expandMessage")}):null,t.footer?l("div",{className:"ml-auto flex items-center gap-2",children:t.footer}):null]}):null]})}),BH=pe(function(t){let o=xe(Fe),n=(a,s)=>{let i=/^\s+/.exec(a)?.[0]??"",d=a.slice(i.length),c=/\s+$/.exec(d)?.[0]??"",u=d.slice(0,d.length-c.length);return v(Aa,{children:[i?l("span",{"aria-hidden":"true",children:i}):null,u?l(wo,{disclosureKey:`${t.disclosureKey}:inline:${s}`,text:u,cwd:t.markdownCwd,threadRef:o.threadRef??void 0,skills:t.skills,className:"text-message-foreground",lineBreaks:!0,parseRawHtml:!1}):null,c?l("span",{"aria-hidden":"true",children:c}):null]},s)},r=mi(t.text);if(r.some(a=>a.kind==="review-comment"))return l("div",{className:"space-y-3 text-message-foreground text-chat",children:r.map(a=>a.kind==="text"?a.text.trim().length>0?l("div",{className:"wrap-break-word",children:l(wo,{disclosureKey:`${t.disclosureKey}:review:${a.id}`,text:a.text.trim(),cwd:t.markdownCwd,threadRef:o.threadRef??void 0,skills:t.skills,className:"text-message-foreground",lineBreaks:!0,parseRawHtml:!1})},a.id):null:l(HH,{comment:a.comment,disclosureKey:`${t.disclosureKey}:review-comment:${a.comment.id}`},a.comment.id))});if(t.terminalContexts.length>0){let a=cT(t.text,t.terminalContexts),s=dT(t.terminalContexts),i=[];if(a){let d=0;for(let c of t.terminalContexts){let u=gp(c.header),m=t.text.indexOf(u,d);if(m===-1){i.length=0;break}m>d&&i.push(n(t.text.slice(d,m),`user-terminal-context-inline-before:${c.header}:${d}`)),i.push(l(uT,{context:c},`user-terminal-context-inline:${c.header}`)),d=m+u.length}if(i.length>0)return d<t.text.length&&i.push(n(t.text.slice(d),`user-message-terminal-context-inline-rest:${d}`)),l("div",{className:"whitespace-pre-wrap wrap-break-word text-message-foreground text-chat",children:i})}for(let d of t.terminalContexts)i.push(l(uT,{context:d},`user-terminal-context-inline:${d.header}`)),i.push(l("span",{"aria-hidden":"true",children:" "},`user-terminal-context-inline-space:${d.header}`));if(t.text.length>0)i.push(l(wo,{disclosureKey:`${t.disclosureKey}:terminal-main`,text:t.text,cwd:t.markdownCwd,threadRef:o.threadRef??void 0,skills:t.skills,className:"text-message-foreground",lineBreaks:!0,parseRawHtml:!1,onImageExpand:o.onImageExpand},"user-message-terminal-context-inline-text"));else if(s.length===0)return null;return l("div",{className:"whitespace-pre-wrap wrap-break-word text-message-foreground text-chat",children:i})}return t.text.length===0?null:l(wo,{disclosureKey:`${t.disclosureKey}:body`,text:t.text,cwd:t.markdownCwd,threadRef:o.threadRef??void 0,skills:t.skills,className:"text-message-foreground",lineBreaks:!0,parseRawHtml:!1,onImageExpand:o.onImageExpand})});function HH({comment:e,disclosureKey:t}){let o=xe(Fe),{t:n}=Ne(),r=e.fenceLanguage??"diff",a=Ww(e);return v("div",{className:"space-y-2 rounded-lg border border-border/70 bg-background/70 p-3",children:[v("div",{className:"space-y-1",children:[l("div",{className:"text-message-foreground text-chat-row font-medium",children:dp(e.filePath,o.workspaceRoot)}),v("div",{className:"text-secondary-label text-chat-dense",children:[e.sectionTitle??n("timeline.reviewCommentDefaultSection")," ",e.rangeLabel??n("timeline.reviewCommentDefaultRange")]})]}),e.text.length>0&&l("div",{className:"whitespace-pre-wrap wrap-break-word text-chat",children:l(iT,{text:e.text,index:o.skillIndex})}),r!=="diff"&&e.diff.trim().length>0&&l(wo,{disclosureKey:`${t}:fence`,text:qw(r,e.diff),cwd:o.markdownCwd,threadRef:o.threadRef??void 0,skills:o.skills,className:"text-message-foreground"}),a?l(Db,{patch:a}):null]})}function Qg({row:e,text:t}){let{t:o}=Ne(),n=xe(Fe),r=e.message.attachments??[],a=ui(e.message.rewrite?.original??t),s=a.contexts,i=[],d=a.visibleText;for(;;){let b=pi(d);if(!b.annotation)break;i.unshift(b.annotation),d=b.promptText}let c=Qa(d),u=[...a.elementContexts,...c.contexts],m=r.filter(b=>b.name.startsWith("browser-annotation-")),p=r.filter(b=>!b.name.startsWith("browser-annotation-")),f=p.filter(b=>Cr(b)),g=p.filter(b=>!Cr(b)&&!Bw(b)),h=n.derive.messageSpeaker(e.message,n.selfUserId??null,n.ownsUnsignedMessages),y=h.kind==="person"?h:null,x=h.kind==="person"||h.kind==="automation"||h.kind==="unknown"&&n.ownsUnsignedMessages===!1,C=y!==null?o("message.saidBy",{name:y.displayName}):h.kind==="automation"?o("message.saidAutomatically"):o(x?"message.saidBySomeoneElse":"message.saidByYou");return v("div",{className:`group/user flex min-w-0 flex-col gap-1 ${x?"items-start":"items-end"}`,role:"group","aria-label":C,tabIndex:-1,children:[y!==null?l(UH,{speaker:y}):null,h.kind==="automation"&&h.schedule!==void 0?l(KH,{environmentId:n.activeThreadEnvironmentId,schedule:h.schedule}):null,v("div",{...x?{"data-teammate-bubble":""}:{"data-user-bubble":""},children:[l(Pd,{images:f}),g.length>0&&l("div",{className:"mb-2 flex max-w-[420px] flex-col gap-1.5",children:g.map(b=>l(Rd,{attachment:b},b.id))}),i.map((b,L)=>l(fT,{annotation:b,image:m[L]??null},b.id)),u.length>0?l("div",{className:"mb-2 flex flex-wrap gap-1.5",children:u.map(b=>l(mT,{context:b},`${b.header}:${b.body}`))}):null,l(gT,{disclosureKey:`message:${e.message.id}:user`,text:c.promptText,terminalContexts:s,skills:n.skills,markdownCwd:n.markdownCwd})]}),l(Hw,{text:t,attachments:r}),e.message.localDelivery!==void 0&&l(zH,{messageId:e.message.id,state:e.message.localDelivery,onRestore:n.onRestoreUnsentMessage??null}),l(ip,{rewrite:e.message.rewrite,text:e.message.text,environmentId:n.activeThreadEnvironmentId}),l(Ow,{messageId:e.message.id}),v("div",{"data-user-message-actions":"",className:"flex min-h-6 select-none items-center gap-0.5 text-chat-row text-muted-foreground opacity-0 transition-opacity duration-(--control-duration) group-focus-within/user:opacity-100 group-hover/user:opacity-100",children:[v(Pe,{children:[l(Ee,{render:l("span",{tabIndex:0,className:"me-1 rounded-sm tabular-nums"}),children:Jn(e.message.createdAt,n.timestampFormat,o)}),l(Re,{children:wn(e.message.createdAt,n.timestampFormat,o)})]}),n.onForkFromUserMessage!==null&&l($H,{messageId:e.message.id,onFork:n.onForkFromUserMessage}),a.copyText&&l(ea,{text:a.copyText,variant:"ghost"})]}),l(Fw,{messageId:e.message.id,rowId:e.id})]})}function UH({speaker:e}){return v("div",{className:"flex min-w-0 max-w-[min(70%,40rem)] select-none items-center gap-1.5 text-chat-dense text-muted-foreground",children:[l(Tb,{userId:e.userId??e.displayName,displayName:e.displayName,size:16}),l("span",{className:"min-w-0 truncate",children:e.displayName})]})}function $H({messageId:e,onFork:t}){let{t:o}=Ne(),n=o("fork.action");return v(Pe,{children:[l(Ee,{render:l(K,{type:"button",size:"xs",variant:"ghost",onClick:()=>t(e),"aria-label":n}),children:l(jl,{className:"size-3"})}),l(Re,{side:"top",children:n})]})}function zH({messageId:e,state:t,onRestore:o}){let{t:n}=Ne();return v("div",{"data-local-delivery":t,role:"status",className:"flex min-h-6 select-none items-center gap-1.5 text-chat-row text-muted-foreground",children:[l("span",{children:n(t==="unconfirmed"?"message.deliveryUnconfirmed":"message.deliveryNotSent")}),t==="not-sent"&&o!==null&&l(K,{type:"button",size:"xs",variant:"outline",onClick:()=>o(e),children:n("message.putBackInMessageBox")})]})}function KH(e){let{t}=Ne(),o=Xn(e.schedule.pluginId===void 0?null:e.environmentId,e.schedule.pluginId??"");return l("span",{className:"text-chat-meta text-muted-foreground",children:e.schedule.pluginId===void 0?t("message.fromSchedule",{name:e.schedule.name}):t("message.fromPluginSchedule",{name:e.schedule.name,plugin:o??t("message.unknownPlugin")})})}var hp="<ycodium-system>",hT="</ycodium-system>",qH=e=>e.startsWith(hp),Xa=e=>qH(e)&&!(yT(e)&&e.includes(xT)&&bT(e)===null),Xg=`^(?:${hp}\\n)?`,WH=/<ycodium-system>[\s\S]*?<\/ycodium-system>/g,GH=e=>e.match(WH)??[],jH=`${hp}
3531
- <preset-prefix `,yT=e=>e.startsWith(jH),vT=e=>{if(yT(e))return[e];let t=GH(e);return t.length>0?t:[e]},CT='esc="1"';var Nd=e=>e.replace(/&#10;/g,`
3532
- `).replace(/&#13;/g,"\r").replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");var VH=/[ \t]*\(record [^\s()]+\)/g,QH=/^<\/?[a-z][a-z-]*(?:\s[^>]*)?>$/,XH=["thread-response","thread-handover","scheduled-wake","plugin-wake"];var YH=new RegExp(`^<(?:${XH.join("|")})(?:\\s[^>]*)? ${CT}>$`);var Dd=e=>{if(!Xa(e))return e;let t=!1,o=[];for(let n of e.split(`
3533
- `)){let r=n.trim();if(!QH.test(r)){o.push(t?Nd(n):n);continue}t=!r.startsWith("</")&&YH.test(r)}return o.join(`
3534
- `).replace(VH,"")};var xT=`
3523
+ `):null,contexts:n}}function ui(e){let t=Qa(e),o=fH(t.promptText);return{visibleText:o.promptText,copyText:e,contextCount:o.contextCount,previewTitle:o.previewTitle,contexts:o.contexts,elementContexts:t.contexts}}function pi(e){let t=uH.exec(e);if(!t)return{promptText:e,annotation:null};let o=t[1]??"",n=o.split(`
3524
+ `),r=n.find(p=>p.startsWith("Page: ")),a=n.find(p=>p.startsWith("Id: ")),s=n.find(p=>p.startsWith("Comment: ")),i=n.find(p=>p.startsWith("Targets: ")),d=n.indexOf("Requested visual changes:"),c=n.slice(d+1),u=c.indexOf("<element_context>"),m=d<0?[]:c.slice(0,u<0?void 0:u).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()||"Browser annotation",comment:s?.slice(9).trim()||"",targetSummary:i?.slice(9).trim()||"",styleChanges:m,hasScreenshot:o.includes("The attached screenshot is the annotated browser crop.")}}}function gH(e){let t=e.match(/:(\d+)$/);if(!t?.[1])return{path:e,line:void 0,column:void 0};let o=e.slice(0,-t[0].length),n=o.match(/:(\d+)$/);return n?.[1]?{path:o.slice(0,-n[0].length),line:n[1],column:t[1]}:{path:o,line:t[1],column:void 0}}function Wg(e){return e.replaceAll("\\","/")}function Gg(e){return/^\/[A-Za-z]:\//.test(e)?e.slice(1):e}function hH(e){return Gg(Wg(e.replace(/[\\/]+$/,"")))}function yH(e){return e.slice(e.lastIndexOf("/")+1)}function vH(e){return e.startsWith("/")||/^[A-Za-z]:\//.test(e)}function CH(e){return e.startsWith("\\\\")||/^[A-Za-z]:([/\\]|$)/.test(Gg(Wg(e)))}function dp(e,t){let{path:o,line:n,column:r}=gH(e),a=Gg(Wg(o)),s=a;if(t){let i=hH(t),d=yH(i),c=CH(t)?p=>p.toLowerCase():p=>p,u=c(a),m=c(i);if(u===m)s=d;else if(u.startsWith(`${m}/`))s=`${d}/${a.slice(i.length+1)}`;else if(!vH(a)){let p=a.replace(/^\.\/+/,"").replace(/^\/+/,"");s=u.startsWith(`${c(d)}/`)?a:`${d}/${p}`}}return n?`${s}:${n}${r?`:${r}`:""}`:s}var xH=/<review_comment\b([^>]*)>\s*([\s\S]*?)<\/review_comment>/g,bH=/([a-zA-Z][a-zA-Z0-9_-]*)="([^"]*)"/g,wH=/(`{3,})([^\s`]*)[^\n]*\n([\s\S]*?)\n\1/g;function TH(e){return e.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&amp;/g,"&")}function IH(e){let t={};for(let o of e.matchAll(bH))t[o[1]]=TH(o[2]??"");return t}function Ww(e){return e===void 0||!/^\d+$/.test(e)?null:Number(e)}function SH(e){let o=Array.from(e.matchAll(wH)).at(-1),n=o?.index;return{text:e.slice(0,n??e.length).trim(),language:o?.[2]?.trim()||"diff",contents:o?.[3]??""}}function kH(e,t,o){let n=IH(e),r=Ww(n.startIndex),a=Ww(n.endIndex),s=n.filePath?.trim(),i=n.sectionId?.trim();if(!s||!i||r===null||a===null)return null;let d=SH(t);return{id:`review-comment:${o}:${i}:${s}:${r}:${a}`,sectionId:i,sectionTitle:n.sectionTitle?.trim()||null,filePath:s,startIndex:Math.min(r,a),endIndex:Math.max(r,a),rangeLabel:n.rangeLabel?.trim()||null,text:d.text,diff:d.contents,fenceLanguage:d.language}}function mi(e){let t=[],o=0,n=0;for(let a of e.matchAll(xH)){let s=a.index??0,i=e.slice(o,s);i.length>0&&t.push({kind:"text",id:`review-comment-text:${o}`,text:i});let d=kH(a[1]??"",a[2]??"",n);d?(t.push({kind:"review-comment",comment:d}),n+=1):t.push({kind:"text",id:`review-comment-invalid:${s}`,text:a[0]}),o=s+a[0].length}let r=e.slice(o);return r.length>0&&t.push({kind:"text",id:`review-comment-text:${o}`,text:r}),t}function Gw(e,t){let o=Math.max(0,...Array.from(t.matchAll(/`+/g),r=>r[0].length)),n="`".repeat(Math.max(3,o+1));return[`${n}${e}`,t.trimEnd(),n].join(`
3525
+ `)}function jw(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 o=e.filePath.replaceAll("\\","/");return[`diff --git a/${o} b/${o}`,`--- a/${o}`,`+++ b/${o}`,t].join(`
3526
+ `)}$();function Vw(e){return pe(function(o){let n=e.usePierreIcons();El(n.ensureSprite,[n.ensureSprite]);let{resolveForEntry:r}=n,a=W(()=>r(o.pathValue,o.kind),[r,o.kind,o.pathValue]);return n.ready?l("svg",{"aria-hidden":"true","data-file-icon":a.symbolId,className:e.cn("size-4 shrink-0",o.className),children:l("use",{href:`#${a.symbolId}`})}):o.kind==="directory"?l(zr,{className:e.cn("size-4 shrink-0 text-icon-muted",o.className)}):l(Wl,{className:e.cn("size-4 shrink-0 text-icon-muted",o.className)})})}function Qw(e){return function(o){return v(oe,{children:[l(e.EntryIcon,{pathValue:o.path,kind:e.inferEntryKindFromPath(o.path),theme:o.theme,className:e.iconClassName}),l("span",{className:o.selectable?e.selectableLabelClassName:e.labelClassName,children:o.label})]})}}function Xw(e){return(t,o)=>l("span",{className:"inline-flex align-middle leading-none","data-markdown-copy":o,children:v("span",{className:e.chipClassName,children:[l("span",{"aria-hidden":"true",className:e.iconClassName,dangerouslySetInnerHTML:{__html:e.iconSvg}}),l("span",{className:e.labelClassName,children:e.label(t)})]})})}$();var Md="[a-zA-Z][a-zA-Z0-9:_-]*";function fi(e){return e===" "||e===`
3527
+ `||e===" "||e==="\r"}function xr(e){return e.enabled&&e.userInvocable!==!1}var Jw="ycodium",Yw=`${Jw}:`,LH=new RegExp(String.raw`(^|\s)([$/])(${Md})(?=\s|$)`,"g");function jg(e){return[...e.matchAll(LH)].map(t=>{let o=(t.index??0)+(t[1]?.length??0),n=t[3]??"";return{sigil:t[2],name:n,start:o,end:o+n.length+1}})}var AJ=new RegExp(String.raw`([$/])(${Md})(?=\s|$)`,"y");function Zw(e,t){let o=t.get(e);if(o!==void 0)return o;if(!e.startsWith(Yw))return;let n=t.get(e.slice(Yw.length));return n?.scope===Jw?n:void 0}function eT(e,t,o,n=fi){if(t.length!==e.length+1)return null;let r=0;for(;r<e.length&&e[r]===t[r];)r+=1;let a=t.charAt(r);if(!fi(a)||r<e.length&&n(e.charAt(r))||t.slice(r+1)!==e.slice(r))return null;let s=r;for(;s>0&&!n(t.charAt(s-1));)s-=1;let d=PH.exec(t.slice(s,r))?.[1];return d===void 0||Zw(d,o)===void 0?null:{start:s,end:r+1,replacement:`$${d}${a}`}}var PH=new RegExp(String.raw`^/(${Md})$`);function cp(e){return new Map(e.map(t=>[t.name,t]))}function RH(e,t){return t.size===0?[]:jg(e).flatMap(o=>{let n=Zw(o.name,t);return n===void 0?[]:[{...o,skill:n}]})}function tT(e,t){let o=[],n=0;for(let r of RH(e,t))r.start>n&&o.push({kind:"text",text:e.slice(n,r.start)}),o.push({kind:"skill",key:`${r.start}:${r.name}`,skill:r.skill,raw:e.slice(r.start,r.end)}),n=r.end;return n===0?null:(n<e.length&&o.push({kind:"text",text:e.slice(n)}),o)}function oT(e){let t=tT(e.text,e.index);return t===null?l(oe,{children:e.text}):l(oe,{children:t.map(o=>o.kind==="text"?o.text:l(Aa,{children:e.renderSkill(o.skill,o.raw)},o.key))})}var EH="inline-flex h-[1.41em] max-w-full items-center gap-[0.33em] rounded-[0.5em] px-[0.5em] font-medium align-middle",MH=`${EH} border border-border/70 bg-accent/40 text-foreground`,up=`${MH} text-control-1`,pp="block size-[1.17em] shrink-0 self-center opacity-85 [&>svg]:block",mp="truncate",nT='<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 rT="inline-flex h-[1.41em] max-w-full items-center gap-[0.33em] rounded-[0.5em] px-[0.5em] font-medium align-middle",aT=`${rT} border border-border/70 bg-accent/40 text-foreground`,AH=`${aT} text-control-1`,sn=`${aT} text-[0.86em] leading-none select-none`,Ad="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-['']",Fo="block size-[1.17em] shrink-0 self-center opacity-85 [&>svg]:block",sT="truncate",Bo="block self-center truncate leading-tight select-none",Vg="border-skill-chip-border bg-skill-chip text-skill-chip-foreground",iT=`${rT} select-none border ${Vg} text-[0.86em] leading-none`,lT='<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>',fp="ml-[0.17em] inline-flex size-[1.17em] shrink-0 cursor-[var(--control-cursor)] items-center justify-center rounded-sm text-muted-foreground/72 transition-colors hover:bg-foreground/10 hover:text-foreground";function NH(e){return e.split(/[\s_-]+/).filter(t=>t.length>0).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}function DH(e){let t=e.displayName?.trim();return t||NH(e.name)}var _H=Xw({chipClassName:V(up,Vg),iconClassName:pp,labelClassName:mp,iconSvg:nT,label:DH});function dT(e){return l(oT,{text:e.text,index:e.index,renderSkill:_H})}function cT(e){let{label:t,tooltipText:o,expired:n=!1}=e;return v(Pe,{children:[v(Ee,{render:l("span",{className:V(up,n&&"border-destructive/35 bg-destructive/8 text-destructive-foreground"),"data-terminal-context-expired":n?"true":void 0}),children:[l(Vo,{className:V(pp,"size-icon-1",n&&"opacity-100")}),l("span",{className:mp,children:t})]}),l(Re,{side:"top",className:"max-w-80 whitespace-pre-wrap leading-tight",children:o})]})}var OH=/^(.*?)\s+line(?:s)?\s+(\d+)(?:-(\d+))?$/i;function uT(e){let t=[];for(let o of e){let n=o.header.trim();n.length>0&&t.push(gp(n))}return t.join(" ")}function gp(e){let t=e.trim(),o=OH.exec(t);if(!o)return`@${t.toLowerCase().replace(/\s+/g,"-")}`;let n=Number.parseInt(o[2]??"",10),r=Number.parseInt(o[3]??o[2]??"",10);return!Number.isFinite(n)||!Number.isFinite(r)?`@${t.toLowerCase().replace(/\s+/g,"-")}`:qw({terminalLabel:o[1]?.trim()||"terminal",lineStart:n,lineEnd:r})}function pT(e,t){let o=0;for(let n of t){let r=gp(n.header),a=e.indexOf(r,o);if(a===-1)return!1;o=a+r.length}return!0}var mT=pe(function(t){let o=t.context.body.length>0?`${t.context.header}
3528
+ ${t.context.body}`:t.context.header;return l(cT,{label:t.context.header,tooltipText:o})}),gT=pe(function(t){let o=t.context.body?`${t.context.header}
3529
+ ${t.context.body}`:t.context.header;return v(Pe,{children:[v(Ee,{render:l("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:[l(Wn,{className:"size-3 shrink-0"}),l("span",{className:"truncate",children:t.context.header})]}),l(Re,{side:"top",className:"max-w-96 whitespace-pre-wrap leading-tight",children:o})]})});function hT(e){let t=xe(Fe),{t:o}=Ne();return v("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?l("button",{type:"button",className:"size-14 shrink-0 cursor-zoom-in overflow-hidden border-r border-border/70 bg-muted","aria-label":o("attachments.preview",{name:e.image.name}),onClick:()=>{if(!e.image)return;let n=ap([e.image],e.image.id);n&&t.onImageExpand(n)},children:l("img",{src:e.image.previewUrl,alt:o("browserAnnotation.cropAlt"),className:"size-full object-cover"})}):null,v("div",{className:"min-w-0 px-2.5 py-2",children:[e.annotation.comment?l("div",{className:"max-w-80 truncate text-foreground text-chat-row font-medium",children:e.annotation.comment}):null,v("div",{className:V("flex items-center gap-2 text-secondary-label text-chat-meta",e.annotation.comment&&"mt-1"),children:[e.annotation.targetSummary?l("span",{className:"truncate",children:e.annotation.targetSummary}):null,e.annotation.styleChanges.length>0?v("span",{className:"inline-flex shrink-0 items-center gap-1",children:[l(za,{className:"size-3"}),e.annotation.styleChanges.length]}):null]})]})]})}var FH=8,BH=600,HH=1.75,fT=`linear-gradient(to bottom, black calc(100% - ${HH}rem), transparent)`;function UH(e){return e.trim().length===0?!1:e.length>BH||e.split(`
3530
+ `).length>FH}var yT=pe(function(t){let o=xe(Fe),{t:n}=Ne(),[r,a]=$t(o.threadKey,`${t.disclosureKey}:expanded`,!1),s=t.text.trim().length>0||t.terminalContexts.length>0,i=s&&UH(t.text),d=i&&!r;return v("div",{children:[s?l("div",{className:V("relative",d&&"max-h-44 overflow-hidden"),"data-user-message-body":"true","data-user-message-collapsed":d?"true":"false","data-user-message-collapsible":i?"true":"false","data-user-message-fade":d?"true":"false",style:d?{WebkitMaskImage:fT,maskImage:fT}:void 0,children:l($H,{disclosureKey:t.disclosureKey,text:t.text,terminalContexts:t.terminalContexts,skills:t.skills,markdownCwd:t.markdownCwd})}):null,i||t.footer?v("div",{className:V("mt-1.5 flex items-center gap-2",i&&t.footer?"justify-between":"justify-end"),"data-user-message-footer":"true",children:[i?l(K,{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:n(r?"timeline.showLess":"timeline.expandMessage")}):null,t.footer?l("div",{className:"ml-auto flex items-center gap-2",children:t.footer}):null]}):null]})}),$H=pe(function(t){let o=xe(Fe),n=(a,s)=>{let i=/^\s+/.exec(a)?.[0]??"",d=a.slice(i.length),c=/\s+$/.exec(d)?.[0]??"",u=d.slice(0,d.length-c.length);return v(Aa,{children:[i?l("span",{"aria-hidden":"true",children:i}):null,u?l(wo,{disclosureKey:`${t.disclosureKey}:inline:${s}`,text:u,cwd:t.markdownCwd,threadRef:o.threadRef??void 0,skills:t.skills,className:"text-message-foreground",lineBreaks:!0,parseRawHtml:!1}):null,c?l("span",{"aria-hidden":"true",children:c}):null]},s)},r=mi(t.text);if(r.some(a=>a.kind==="review-comment"))return l("div",{className:"space-y-3 text-message-foreground text-chat",children:r.map(a=>a.kind==="text"?a.text.trim().length>0?l("div",{className:"wrap-break-word",children:l(wo,{disclosureKey:`${t.disclosureKey}:review:${a.id}`,text:a.text.trim(),cwd:t.markdownCwd,threadRef:o.threadRef??void 0,skills:t.skills,className:"text-message-foreground",lineBreaks:!0,parseRawHtml:!1})},a.id):null:l(zH,{comment:a.comment,disclosureKey:`${t.disclosureKey}:review-comment:${a.comment.id}`},a.comment.id))});if(t.terminalContexts.length>0){let a=pT(t.text,t.terminalContexts),s=uT(t.terminalContexts),i=[];if(a){let d=0;for(let c of t.terminalContexts){let u=gp(c.header),m=t.text.indexOf(u,d);if(m===-1){i.length=0;break}m>d&&i.push(n(t.text.slice(d,m),`user-terminal-context-inline-before:${c.header}:${d}`)),i.push(l(mT,{context:c},`user-terminal-context-inline:${c.header}`)),d=m+u.length}if(i.length>0)return d<t.text.length&&i.push(n(t.text.slice(d),`user-message-terminal-context-inline-rest:${d}`)),l("div",{className:"whitespace-pre-wrap wrap-break-word text-message-foreground text-chat",children:i})}for(let d of t.terminalContexts)i.push(l(mT,{context:d},`user-terminal-context-inline:${d.header}`)),i.push(l("span",{"aria-hidden":"true",children:" "},`user-terminal-context-inline-space:${d.header}`));if(t.text.length>0)i.push(l(wo,{disclosureKey:`${t.disclosureKey}:terminal-main`,text:t.text,cwd:t.markdownCwd,threadRef:o.threadRef??void 0,skills:t.skills,className:"text-message-foreground",lineBreaks:!0,parseRawHtml:!1,onImageExpand:o.onImageExpand},"user-message-terminal-context-inline-text"));else if(s.length===0)return null;return l("div",{className:"whitespace-pre-wrap wrap-break-word text-message-foreground text-chat",children:i})}return t.text.length===0?null:l(wo,{disclosureKey:`${t.disclosureKey}:body`,text:t.text,cwd:t.markdownCwd,threadRef:o.threadRef??void 0,skills:t.skills,className:"text-message-foreground",lineBreaks:!0,parseRawHtml:!1,onImageExpand:o.onImageExpand})});function zH({comment:e,disclosureKey:t}){let o=xe(Fe),{t:n}=Ne(),r=e.fenceLanguage??"diff",a=jw(e);return v("div",{className:"space-y-2 rounded-lg border border-border/70 bg-background/70 p-3",children:[v("div",{className:"space-y-1",children:[l("div",{className:"text-message-foreground text-chat-row font-medium",children:dp(e.filePath,o.workspaceRoot)}),v("div",{className:"text-secondary-label text-chat-dense",children:[e.sectionTitle??n("timeline.reviewCommentDefaultSection")," ",e.rangeLabel??n("timeline.reviewCommentDefaultRange")]})]}),e.text.length>0&&l("div",{className:"whitespace-pre-wrap wrap-break-word text-chat",children:l(dT,{text:e.text,index:o.skillIndex})}),r!=="diff"&&e.diff.trim().length>0&&l(wo,{disclosureKey:`${t}:fence`,text:Gw(r,e.diff),cwd:o.markdownCwd,threadRef:o.threadRef??void 0,skills:o.skills,className:"text-message-foreground"}),a?l(_b,{patch:a}):null]})}function Qg({row:e,text:t}){let{t:o}=Ne(),n=xe(Fe),r=e.message.attachments??[],a=ui(e.message.rewrite?.original??t),s=a.contexts,i=[],d=a.visibleText;for(;;){let b=pi(d);if(!b.annotation)break;i.unshift(b.annotation),d=b.promptText}let c=Qa(d),u=[...a.elementContexts,...c.contexts],m=r.filter(b=>b.name.startsWith("browser-annotation-")),p=r.filter(b=>!b.name.startsWith("browser-annotation-")),f=p.filter(b=>Cr(b)),g=p.filter(b=>!Cr(b)&&!Uw(b)),h=n.derive.messageSpeaker(e.message,n.selfUserId??null,n.ownsUnsignedMessages),y=h.kind==="person"?h:null,x=h.kind==="person"||h.kind==="automation"||h.kind==="unknown"&&n.ownsUnsignedMessages===!1,C=y!==null?o("message.saidBy",{name:y.displayName}):h.kind==="automation"?o("message.saidAutomatically"):o(x?"message.saidBySomeoneElse":"message.saidByYou");return v("div",{className:`group/user flex min-w-0 flex-col gap-1 ${x?"items-start":"items-end"}`,role:"group","aria-label":C,tabIndex:-1,children:[y!==null?l(KH,{speaker:y}):null,h.kind==="automation"&&h.schedule!==void 0?l(GH,{environmentId:n.activeThreadEnvironmentId,schedule:h.schedule}):null,v("div",{...x?{"data-teammate-bubble":""}:{"data-user-bubble":""},children:[l(Pd,{images:f}),g.length>0&&l("div",{className:"mb-2 flex max-w-[420px] flex-col gap-1.5",children:g.map(b=>l(Rd,{attachment:b},b.id))}),i.map((b,L)=>l(hT,{annotation:b,image:m[L]??null},b.id)),u.length>0?l("div",{className:"mb-2 flex flex-wrap gap-1.5",children:u.map(b=>l(gT,{context:b},`${b.header}:${b.body}`))}):null,l(yT,{disclosureKey:`message:${e.message.id}:user`,text:c.promptText,terminalContexts:s,skills:n.skills,markdownCwd:n.markdownCwd})]}),l($w,{text:t,attachments:r}),e.message.localDelivery!==void 0&&l(WH,{messageId:e.message.id,state:e.message.localDelivery,onRestore:n.onRestoreUnsentMessage??null}),l(ip,{rewrite:e.message.rewrite,text:e.message.text,environmentId:n.activeThreadEnvironmentId}),l(Bw,{messageId:e.message.id}),v("div",{"data-user-message-actions":"",className:"flex min-h-6 select-none items-center gap-0.5 text-chat-row text-muted-foreground opacity-0 transition-opacity duration-(--control-duration) group-focus-within/user:opacity-100 group-hover/user:opacity-100",children:[v(Pe,{children:[l(Ee,{render:l("span",{tabIndex:0,className:"me-1 rounded-sm tabular-nums"}),children:Jn(e.message.createdAt,n.timestampFormat,o)}),l(Re,{children:wn(e.message.createdAt,n.timestampFormat,o)})]}),n.onForkFromUserMessage!==null&&l(qH,{messageId:e.message.id,onFork:n.onForkFromUserMessage}),a.copyText&&l(ea,{text:a.copyText,variant:"ghost"})]}),l(Hw,{messageId:e.message.id,rowId:e.id})]})}function KH({speaker:e}){return v("div",{className:"flex min-w-0 max-w-[min(70%,40rem)] select-none items-center gap-1.5 text-chat-dense text-muted-foreground",children:[l(Tb,{userId:e.userId??e.displayName,displayName:e.displayName,size:16}),l("span",{className:"min-w-0 truncate",children:e.displayName})]})}function qH({messageId:e,onFork:t}){let{t:o}=Ne(),n=o("fork.action");return v(Pe,{children:[l(Ee,{render:l(K,{type:"button",size:"xs",variant:"ghost",onClick:()=>t(e),"aria-label":n}),children:l(jl,{className:"size-3"})}),l(Re,{side:"top",children:n})]})}function WH({messageId:e,state:t,onRestore:o}){let{t:n}=Ne();return v("div",{"data-local-delivery":t,role:"status",className:"flex min-h-6 select-none items-center gap-1.5 text-chat-row text-muted-foreground",children:[l("span",{children:n(t==="unconfirmed"?"message.deliveryUnconfirmed":"message.deliveryNotSent")}),t==="not-sent"&&o!==null&&l(K,{type:"button",size:"xs",variant:"outline",onClick:()=>o(e),children:n("message.putBackInMessageBox")})]})}function GH(e){let{t}=Ne(),o=Xn(e.schedule.pluginId===void 0?null:e.environmentId,e.schedule.pluginId??"");return l("span",{className:"text-chat-meta text-muted-foreground",children:e.schedule.pluginId===void 0?t("message.fromSchedule",{name:e.schedule.name}):t("message.fromPluginSchedule",{name:e.schedule.name,plugin:o??t("message.unknownPlugin")})})}var hp="<ycodium-system>",vT="</ycodium-system>",jH=e=>e.startsWith(hp),Xa=e=>jH(e)&&!(CT(e)&&e.includes(wT)&&TT(e)===null),Xg=`^(?:${hp}\\n)?`,VH=/<ycodium-system>[\s\S]*?<\/ycodium-system>/g,QH=e=>e.match(VH)??[],XH=`${hp}
3531
+ <preset-prefix `,CT=e=>e.startsWith(XH),xT=e=>{if(CT(e))return[e];let t=QH(e);return t.length>0?t:[e]},bT='esc="1"';var Nd=e=>e.replace(/&#10;/g,`
3532
+ `).replace(/&#13;/g,"\r").replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");var YH=/[ \t]*\(record [^\s()]+\)/g,JH=/^<\/?[a-z][a-z-]*(?:\s[^>]*)?>$/,ZH=["thread-response","thread-handover","scheduled-wake","plugin-wake"];var eU=new RegExp(`^<(?:${ZH.join("|")})(?:\\s[^>]*)? ${bT}>$`);var Dd=e=>{if(!Xa(e))return e;let t=!1,o=[];for(let n of e.split(`
3533
+ `)){let r=n.trim();if(!JH.test(r)){o.push(t?Nd(n):n);continue}t=!r.startsWith("</")&&eU.test(r)}return o.join(`
3534
+ `).replace(YH,"")};var wT=`
3535
3535
  </preset-prefix>
3536
- ${hT}`,JH=new RegExp(`^${hp}\\n<preset-prefix id="([^"]*)">\\n([\\s\\S]*?)\\n</preset-prefix>\\n${hT}(?:\\n\\n([\\s\\S]*))?$`),bT=e=>{if(e.split(xT).length!==2)return null;let t=JH.exec(e);if(t===null)return null;let[,o,n,r]=t;return o?{presetId:o,prefix:n??"",body:r??""}:null},wT=e=>Xa(e)?bT(e)?.body||null:e,ZH=["work","check-in","instructions","notice","continue"];var eU=new RegExp(`${Xg}<plugin-wake plugin="([^"]+)" reason="([^"]+)"(?: item="([^"]+)")?(?: round="(\\d+)" limit="(\\d+)")? ${CT}>\\n([\\s\\S]*?)\\n</plugin-wake>`),TT=e=>{let t=eU.exec(e);if(t===null)return null;let[,o,n,r,a,s,i]=t;if(!o||!n)return null;let d=ZH.find(c=>c===Nd(n));return{pluginId:Nd(o),reason:d??"notice",...r?{item:Nd(r)}:{},...d==="continue"&&a&&s?{continuation:{round:Number(a),limit:Number(s),body:Nd(i??"")}}:{}}},IT=e=>{switch(e.reason){case"work":return e.item===void 0?{key:"work"}:{key:"workItem",item:e.item};case"check-in":return{key:"checkIn"};case"instructions":return{key:"instructions"};case"notice":return{key:"notice"};case"continue":return e.continuation===void 0?{key:"notice"}:{key:"continue",round:e.continuation.round,limit:e.continuation.limit}}};$();function ST({wake:e,blockKey:t}){let{t:o}=Ne(),{activeThreadEnvironmentId:n,threadKey:r}=xe(Fe),a=IT(e),[s,i]=$t(r,`plugin-wake:${t}`,!1),d=e.continuation?.body;return v("div",{className:"flex flex-col items-center gap-1 py-1","data-plugin-wake":e.pluginId,children:[v("p",{className:"flex max-w-[80%] flex-wrap items-center justify-center gap-x-1.5 text-center text-chat-row text-muted-foreground",children:[l(Mo,{environmentId:n,pluginId:e.pluginId}),l("span",{children:o(`pluginWake.${a.key}`,{item:a.item,round:a.round,limit:a.limit})}),d!==void 0&&d.length>0?l(K,{type:"button",variant:"link",size:"xs","aria-expanded":s,onClick:()=>i(!s),children:o(s?"pluginWake.hideReceived":"pluginWake.showReceived")}):null]}),s&&d!==void 0?l("p",{className:"max-w-[80%] whitespace-pre-wrap rounded-lg border border-border/60 bg-muted/30 px-3 py-2 text-chat-row text-muted-foreground",children:d}):null]})}function kT({row:e}){let{t}=Ne(),{activeThreadEnvironmentId:o}=xe(Fe),n=t("turnContinuation.nameSeparator");return v("p",{className:"flex flex-wrap items-center gap-x-1 px-1 pb-2 pt-1 text-chat-row text-muted-foreground","data-testid":"continuation-check-row",children:[e.pluginIds.map((r,a)=>v("span",{className:"inline-flex items-center",children:[a>0?n:null,l(Mo,{environmentId:o,pluginId:r})]},r)),l("span",{children:t("turnContinuation.checking")})]})}var tU=new RegExp(`${Xg}<plugin-instruction>\\n([\\s\\S]*?)\\n<\\/plugin-instruction>`);function LT(e){let t=e.match(tU)?.[1];if(t===void 0)return null;try{let o=JSON.parse(t);if(o===null||typeof o!="object"||Array.isArray(o))return null;let n=o;return typeof n.pluginId!="string"||typeof n.title!="string"||typeof n.body!="string"?null:{pluginId:n.pluginId,title:n.title,body:n.body}}catch{return null}}$();var PT=window.__ycodiumPluginHost.modules?.["@ycodium-ai/plugin-api"];if(!PT)throw new Error("This plugin needs a newer Ycodium app. Update the app.");var{COMMUNICATION_RECORDS_READ_LIMIT:zZ,HOST_TEAM_VIEW_PREFIX:KZ,MAX_PLUGIN_SESSION_PROJECTION_BYTES:qZ,MAX_PLUGIN_SKILL_COMPANION_FILE_BYTES:WZ,MAX_PLUGIN_SKILL_COMPANION_TOTAL_BYTES:GZ,MAX_PLUGIN_STREAM_BUFFER:jZ,MAX_PLUGIN_TOOL_PRESENTATION_BYTES:VZ,MAX_PLUGIN_WORKSPACE_WRITE_BYTES:QZ,MEMBER_INSTRUCTIONS_MAX_BYTES:XZ,MEMBER_NAME_MAX:YZ,MEMBER_RESPONSIBILITY_MAX:JZ,MEMBER_TITLE_MAX:ZZ,MIN_PLUGIN_INTERVAL_MS:eee,PLUGIN_API_MIN_VERSION:tee,PLUGIN_API_VERSION:oee,PLUGIN_PROXY_DIRECT:nee,PluginSignInRequiredError:ree,PluginSignInUnavailableError:aee,REASONING_OPTION_LABEL:see,REQUEST_RESOLVED_TRIGGER_KIND:iee,TEAM_VIEW_KEY_PATTERN:lee,THREAD_ACTIVITIES_LIST_LIMIT:dee,THREAD_MESSAGES_LIST_LIMIT:cee,TOOL_LIFECYCLE_ACTIVITY_KINDS:uee,TURN_PROGRESS_TRIGGER_KIND:pee,USER_INPUT_PENDING_TRIGGER_KIND:mee,acceptPluginToolPresentation:fee,definePlugin:gee,defineTeamView:hee,effortText:RT,findReasoningEffortDescriptor:yee,getDisplayModelName:vee,getTriggerDisplayModelName:ET,hasModelTraitControls:MT,holdKeyedSubscriber:Cee,isProviderSelectionAvailable:_d,isReadOnlyModelChoice:AT,isReasoningEffortOptionId:xee,isTeamViewKey:bee,isThreadNotFound:wee,isWithinProviderSelectionLock:yp,knownEffortLevel:Tee,mergeLaunchEnv:Iee,modelCatalogNoticeOf:See,modelChoiceTraitDescriptors:NT,modelOptionLabelKind:kee,modelOptionTitle:DT,modelOptionsAfterChange:Lee,modelSelectionStringOption:Pee,modelTraitDescriptors:Ree,nearestEffortLevel:Eee,parseRetryAfterMs:Mee,pluginJsonByteLength:Aee,projectOrNull:Nee,readRequestResolved:Dee,readThreadFailed:_ee,readTurnProgress:Oee,readUserInputPending:Fee,reasoningEffortLevel:_T,reasoningEffortShortLabel:Bee,relabelModelOptionDescriptors:Hee,resolveModelChoice:Uee,resolveModelOptions:$ee,resolveProviderDriverKindForInstanceSelection:OT,sortProviderInstanceEntries:FT,threadMessagesNewestFirst:zee,threadOrNull:Kee}=PT;var oU={effort:"traits.savedOption.effort",reasoningEffort:"traits.savedOption.reasoningEffort",variant:"traits.savedOption.variant",fastMode:"traits.savedOption.fastMode",agent:"traits.savedOption.agent",serviceTier:"traits.savedOption.serviceTier"},nU=e=>`traits.optionValue.${e}`;function BT(e,t){return DT(t,o=>e(oU[o]))}function Yg(e,t){return t.effortDisplayKind==="standard-tier"?e("traits.standardTier"):RT(t,o=>e(nU(o)))}function gi({badge:e,compact:t=!1}){let{t:o}=Ne(),n=Yg(o,e);return v(oe,{children:[e.driverKind?l("span",{className:t?"flex size-5 shrink-0 items-center justify-center":"flex size-7 shrink-0 items-center justify-center rounded-lg border border-border/60 bg-card","aria-label":e.providerDisplayName??void 0,children:l(js,{driver:e.driverKind,displayName:e.providerDisplayName,accentColor:e.accentColor,className:"size-5",iconClassName:"size-4"})}):null,v("span",{className:"flex min-w-0 flex-wrap items-baseline gap-x-2 gap-y-0.5",children:[e.driverKind?l("span",{className:"font-medium text-foreground",children:e.providerDisplayName}):null,t?l("span",{className:"min-w-0 truncate text-muted-foreground",children:e.modelLabel}):l(rp,{text:e.modelLabel,label:o("copyButton.copyModelName"),children:l("span",{className:"min-w-0 truncate text-muted-foreground",children:e.modelLabel})}),n?v(oe,{children:[" ",l("span",{children:n})]}):null]})]})}function HT({badge:e,createdAt:t}){let o=xe(Fe),{t:n}=Ne();return v("div",{className:"mb-3 flex min-w-0 select-none flex-wrap items-center gap-x-2.5 gap-y-1 text-chat-dense text-muted-foreground","data-testid":"assistant-model-header",children:[l(gi,{badge:e})," ",v(Pe,{children:[l(Ee,{render:l("span",{className:"shrink-0 tabular-nums"}),children:Jn(t,o.timestampFormat,n)}),l(Re,{children:wn(t,o.timestampFormat,n)})]})]})}function Jg({row:e}){let{t}=Ne(),o=Yg(t,e.badge),n=o?`${e.badge.modelLabel} (${o})`:e.badge.modelLabel,r=[e.badge.providerDisplayName,n].filter(s=>typeof s=="string"&&s.length>0).join(" "),a=e.pending?t("timeline.modelSwitchPending",{model:r}):t("timeline.modelSwitched",{model:r});return v("div",{role:"separator","aria-label":a,"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:[l("span",{"aria-hidden":!0,className:"h-px min-w-4 flex-1 bg-border/60"}),v("span",{className:"flex min-w-0 shrink items-center gap-1.5",children:[e.badge.driverKind?l(js,{driver:e.badge.driverKind,displayName:e.badge.providerDisplayName,accentColor:e.badge.accentColor,className:"size-icon-1",iconClassName:"size-icon-1"}):null,l("span",{className:"truncate",children:a})]}),l("span",{"aria-hidden":!0,className:"h-px min-w-4 flex-1 bg-border/60"})]})}function Cp({row:e}){let t=xe(Fe).derive;if(e.message.rewrite){let o=t.parsePresetPrefixText(e.message.rewrite.original);return o?v(oe,{children:[l(UT,{parsed:o}),l(Cp,{row:{...e,message:{...e.message,rewrite:{...e.message.rewrite,original:o.body}}}})]}):l(Qg,{row:e,text:e.message.rewrite.original})}if(Xa(e.message.text)){let o=t.parsePresetPrefixText(e.message.text);return o?v(oe,{children:[l(UT,{parsed:o}),o.body.length>0||(e.message.attachments?.length??0)>0?l(Cp,{row:{...e,message:{...e.message,text:o.body}}}):null]}):l(sU,{row:e})}return l(Qg,{row:e,text:e.message.text})}var rU={"child.settled":{tone:"success",label:"childThread.state.settled"},"child.failed":{tone:"error",label:"childThread.state.failed"},"child.approval":{tone:"attention",label:"childThread.state.approval"},"child.question":{tone:"attention",label:"childThread.state.question"},"child.stopped":{tone:"neutral",label:"childThread.state.stopped"},"child.resolved":{tone:"success",label:"childThread.state.resolved"}};function vp({children:e}){return l("div",{className:"flex justify-center py-1",children:l("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 UT({parsed:e}){let{t}=Ne();return v(vp,{children:[l("p",{className:"font-medium text-foreground/80",children:t("preset.systemBlockTitle",{name:e.presetId})}),e.prefix.trim().length>0?l("p",{className:"mt-1 whitespace-pre-wrap",children:e.prefix}):null]})}var aU={"child.settled":"childThread.notification.settled","child.failed":"childThread.notification.failed","child.approval":"childThread.notification.approval","child.question":"childThread.notification.question","child.stopped":"childThread.notification.stopped","child.resolved":"childThread.notification.resolved","plugin.notice":"childThread.notification.pluginNotice","selfdev.resolved":"childThread.notification.selfdevResolved","cookie-import.resolved":"childThread.notification.cookieImportResolved"};function sU({row:e}){let{t}=Ne(),o=Nt(),{derive:n,activeThreadEnvironmentId:r}=xe(Fe),a=xe(Fe).SessionMessageCard,s=e.message.attachments??[],i=s.filter(m=>Cr(m)),d=s.filter(m=>!Cr(m)),c=(m,p)=>{let f=TT(m);if(f)return l(ST,{wake:f,blockKey:`${e.message.id}:${p}`});let g=LT(m);if(g)return v(vp,{children:[l("p",{className:"font-medium text-foreground/80",children:g.title}),g.body.length>0?l("p",{className:"mt-1 whitespace-pre-wrap",children:g.body}):null]});let h=n.parseThreadHandoverText(m);if(h)return v(vp,{children:[l("p",{className:"font-medium text-foreground/80",children:t("continuation.systemBlockTitle")}),l("p",{className:"mt-1",children:t("continuation.systemBlockTurns",{count:h.includedTurns})}),l("p",{className:"mt-1 whitespace-pre-wrap",children:h.body})]});let y=n.parseSystemNotificationText(m);if(!y||y.recordId!==void 0)return null;let x=y.childThreadId&&n.notificationOpensChildThread(y.kind),C=()=>{y.childThreadId!==void 0&&o.openThread({environmentId:r,threadId:y.childThreadId})},b=rU[y.kind];if(a!==void 0&&b!==void 0&&y.childThreadId){let w=[y.kind==="child.resolved"&&y.resolution!==void 0?t(`childThread.resolution.${y.resolution}`):null,y.summary.trim()].filter(k=>k).join(`
3537
- `);return l(a,{environmentId:r,threadId:y.childThreadId,fallbackName:y.title,status:{tone:b.tone,label:t(b.label)},text:w.length>0?w:t(b.label),action:x?{label:t("childThread.open"),onPress:C}:void 0})}return v(vp,{children:[l("p",{className:"font-medium text-foreground/80",children:t(aU[y.kind],{title:y.title})}),y.kind==="child.resolved"&&y.resolution!==void 0?l("p",{className:"mt-1",children:t(`childThread.resolution.${y.resolution}`)}):null,y.summary.trim().length>0?l("p",{className:"mt-1 whitespace-pre-wrap",children:y.summary}):null,x?l(K,{type:"button",size:"xs",variant:"outline",className:"relative mt-2 pointer-coarse:after:absolute pointer-coarse:after:inset-0 pointer-coarse:after:min-h-11",onClick:C,children:t("childThread.open")}):null]})},u=vT(e.message.text).map(c).filter(m=>m!==null);return u.length===0&&s.length===0?null:v(oe,{children:[u.map((m,p)=>l(Aa,{children:m},p)),s.length>0?v("div",{className:"min-w-0 px-3 py-2",children:[l(Pd,{images:i}),d.map(m=>l(Rd,{attachment:m},m.id))]}):null]})}function $T(e,t){let o=t.parsePresetPrefixText(e??"")?.body??null;if(o===null&&Xa(e??""))return null;let r=ui(o??e??"").visibleText;for(;;){let i=pi(r);if(!i.annotation)break;r=i.promptText}let a=Qa(r).promptText,s=mi(a).map(i=>i.kind==="text"?t.messageLinksToPreviewText(i.text):i.comment.text).join(" ").replace(/\s+/g," ").trim();return s.length>0?s:null}var zT=30,KT=8,Zg=zT+KT,qT=pe(function({ref:t,textRef:o,initialText:n,onJump:r}){let{t:a}=Ne(),s=a("timeline.pinnedTurnHeaderJump");return l("div",{ref:t,className:"pointer-events-none absolute inset-x-0 top-0 z-10 px-3 data-[visible=false]:hidden sm:px-5","data-timeline-turn-header":"true","data-visible":"false",children:l("div",{className:"transcript-col-wide",style:{paddingTop:KT},children:l("div",{className:"rounded-control-3 bg-background",children:v(K,{type:"button",variant:"outline",size:"sm",title:s,onClick:r,className:"pointer-events-auto w-full min-w-0 justify-start gap-2 bg-background px-2.5 text-xs font-normal text-muted-foreground shadow-xs hover:text-foreground",style:{height:zT},children:[l(_l,{"aria-hidden":!0,className:"size-icon-2 shrink-0"}),l("span",{className:"sr-only",children:s}),l("span",{ref:o,className:"min-w-0 flex-1 truncate text-left",children:n})]})})})})});function WT({row:e}){let t=xe(Fe),{t:o}=Ne(),[n,r]=$t(t.threadKey,`message:${e.message.id}`,!1);if(e.message.text.trim().length===0&&(e.message.attachments?.length??0)>0)return l(qg,{rowId:e.id,messageId:e.message.id,attachments:e.message.attachments},e.message.id);if(e.presentation==="compact"&&!n)return l(Nu,{state:"idle",children:v("button",{type:"button",className:V(li,"chat-process-text cursor-[var(--control-cursor)] text-secondary-label hover:bg-accent/20"),"aria-expanded":!1,"aria-label":o("timeline.expandMessage"),onClick:()=>{t.onProcessDisclosureChange?.(e.id),r(!0)},children:[l(Cd,{status:null}),l(vd,{children:l(hr,{className:"size-icon-1","aria-hidden":!0})}),l("span",{className:"min-w-0 flex-1 truncate",children:t.derive.reasoningPreviewText(e.message.text)}),l(Tt,{className:"size-icon-1 shrink-0 -rotate-90","aria-hidden":!0})]})});let s=e.message.attachments??[],i=e.message.text||(e.message.streaming||s.length>0?"":o("timeline.emptyResponse"));return l(oe,{children:v("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"?v("div",{className:"mb-1 flex items-center gap-2",children:[l("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:o("timeline.collapseMessage")}),e.copyInFooter?null:l(ea,{text:e.message.text,variant:"ghost"})]}):null,e.modelBadge?l(HT,{badge:e.modelBadge,createdAt:e.message.createdAt}):null,i.trim().length>0?l("div",{"data-assistant-quote-body":"",children:l(wo,{disclosureKey:`message:${e.message.id}:assistant`,text:i,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(i),skills:t.skills,onImageExpand:t.onImageExpand,artifactTurnId:e.message.turnId})}):null,l(qg,{rowId:e.id,messageId:e.message.id,attachments:s},e.message.id),e.showAssistantMeta||e.showAssistantCopyButton&&!e.assistantCopyStreaming&&e.message.text.trim().length>0?v("div",{className:"mt-1.5 flex select-none 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 [@media(pointer:coarse)]:opacity-100",children:[l(iU,{row:e}),e.showAssistantMeta&&!e.message.streaming&&e.modelBadge===null&&v(Pe,{children:[l(Ee,{render:l("p",{className:"text-muted-foreground text-chat-row tabular-nums"}),children:Jn(e.message.updatedAt,t.timestampFormat,o)}),l(Re,{children:wn(e.message.updatedAt,t.timestampFormat,o)})]})]}):null]})})}function iU({row:e}){let o=xe(Fe).derive.resolveAssistantMessageCopyState({text:e.message.text??null,showCopyButton:e.showAssistantCopyButton,streaming:e.assistantCopyStreaming});return o.visible?l(ea,{text:o.text??"",variant:"ghost"}):null}var eh=240,lU=/\s/u;function GT(e){if(!e)return null;let t=[],o=0,n=!1,r=()=>{for(;o>eh-1;)o-=t.pop()?.length??0;for(;t.at(-1)===" ";)t.pop(),o-=1;return t.push("\u2026"),t.join("")};for(let a of e){if(lU.test(a)){n=t.length>0;continue}if(n&&(t.push(" "),o+=1,n=!1,o>eh)||(t.push(a),o+=a.length,o>eh))return r()}return t.length>0?t.join(""):null}function dU(e,t,o){let n=t.find(p=>p.kind==="message"&&p.message.role==="user"),r=n?.kind==="message"?n.message:null,a=r?.rewrite?.original??r?.text??"",s=null;for(let p of t)p.kind==="message"&&p.message.role==="assistant"&&(s=p.message.text.trim()?p.message.text:(p.message.attachments??[]).map(f=>f.source?._tag==="agent-artifact"&&f.source.title?`${f.name} \u2014 ${f.source.title}`:f.name).join(", "));let i=r?.attachments??[],d=r!==null&&!a.trim()&&i[0]?{name:i[0].name,count:i.length}:void 0,c=r!==null&&Xa(a)&&o.parsePresetPrefixText(a)===null,u=r===null?null:$T(a,o),m=u===null&&!c&&i[0]?{name:i[0].name,count:i.length}:void 0;return{...d===void 0?{}:{attachmentPreview:d},...m===void 0?{}:{headerAttachment:m},...c?{isSystemMessage:!0}:{},id:e,sectionKey:e,anchorRowId:n?.id??t[0]?.id??e,userText:r===null?null:GT(o.parseSystemNotificationText(a)?.summary??o.parseThreadHandoverText(a)?.body??o.messageLinksToPreviewText(o.parsePresetPrefixText(a)?.body??a))??(d===void 0?null:""),assistantText:GT(s),headerText:u}}function cU(e){for(let t of e){let o=t.kind==="message"?t.message.turnId??null:t.kind==="turn-summary"?t.footer.turnId:null;if(o!==null)return o}return null}function uU(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&&e.isSystemMessage===t.isSystemMessage&&e.attachmentPreview?.name===t.attachmentPreview?.name&&e.attachmentPreview?.count===t.attachmentPreview?.count}function pU(e,t,o){for(let n=0;n<e.length;n+=1)if(e[n]!==o[t.firstRowIndex+n])return!1;return!0}function mU(e,t){if(e.length!==t.length)return!1;for(let o=0;o<e.length;o+=1)if(e[o]!==t[o])return!1;return!0}function fU(e){let t=new Map,o=null;return n=>{let r=n.getVersion();if(o!==null&&o.store===n&&o.version===r)return o.entries;let a=new Map,s=[],i=n.getRows();for(let c of n.getStructure().sections){let u=t.get(c.key);if(u!==void 0&&u.rowIds===c.rowIds&&pU(u.rows,c,i)){a.set(c.key,u),s.push(u.entry);continue}let m=i.slice(c.firstRowIndex,c.firstRowIndex+c.rowIds.length),p=dU(c.key,m,e),{headerAttachment:f,...g}=p,h={...g,turnId:cU(m)},y=u?.entry.summary.headerAttachment,x=u!==void 0&&uU(u.entry.item,h)&&y?.name===f?.name&&y?.count===f?.count?u.entry:{summary:p,item:h};a.set(c.key,{rowIds:c.rowIds,rows:m,entry:x}),s.push(x)}t=a;let d=o!==null&&mU(o.entries,s)?o.entries:s;return o={store:n,version:r,entries:d},d}}var jT=new WeakMap;function XT(e,t){let o=jT.get(e);return(o===void 0||o.derive!==t)&&(o={derive:t,read:fU(t)},jT.set(e,o)),o.read(e)}var VT=new WeakMap;function YT(e,t){let o=XT(e,t),n=VT.get(o);if(n===void 0){let r=null;n=o.flatMap(({summary:a})=>{if(a.isSystemMessage===!0)return r===null?[]:[{...r,sectionKey:a.sectionKey,inherited:!0}];let s=a.headerAttachment;return a.headerText===null&&s===void 0?(r=null,[]):(r={sectionKey:a.sectionKey,text:a.headerText??"",...s===void 0?{}:{attachment:s},anchorRowId:a.anchorRowId,inherited:!1},[r])}),VT.set(o,n)}return n}function JT(e,t){return e===t?!0:e.length!==t.length?!1:e.every((o,n)=>{let r=t[n];return o.sectionKey===r.sectionKey&&o.text===r.text&&o.anchorRowId===r.anchorRowId&&o.attachment?.name===r.attachment?.name&&o.attachment?.count===r.attachment?.count&&o.inherited===r.inherited})}var QT=new WeakMap;function ZT(e,t){let o=XT(e,t),n=QT.get(o);return n===void 0&&(n=o.filter(({summary:r})=>r.userText!==null).map(({item:r})=>r),QT.set(o,n)),n}function eI(e,t){return e===t?!0:e.length!==t.length?!1:e.every((o,n)=>o===t[n])}var gU=[],hU=e=>e.getMeta().usageByTurnId,yU=e=>e.getMeta().exportApi,vU=e=>e.getMeta().status.totalTurnCount??null,tI=pe(function({rowsStore:t,derive:o,paneVisible:n,bottomInset:r,onSelect:a,onTurnNavigatorChange:s}){let i=R(f=>n?ZT(f,o):gU,[o,n]),d=Wt(t,i,eI),c=Wt(t,hU),u=Wt(t,yU),m=Wt(t,vU),p=W(()=>n?{items:d,totalTurnCount:m,bottomInset:r,usageByTurnId:c,onSelect:a,exportMarkdown:u.markdown,onDownload:u.download}:null,[r,u,d,a,n,m,c]);return H(()=>{p!==null&&s(p)},[s,p]),H(()=>{if(n)return()=>s(null)},[s,n]),null});function nI({timeline:e,previousOverlayHeight:t,overlayHeight:o,followingEnd:n}){e&&n&&o>t&&e.scrollToEnd({animated:!1})}function rI(e,t){let o=e.topOf(t),n=e.heightOf(t);return typeof o!="number"||typeof n!="number"||!Number.isFinite(o)||!Number.isFinite(n)?null:o+Math.max(1,n)}function aI({measurement:e,followingEnd:t}){return t?null:e.rowAtScroll()}var oI="--chat-frozen-block-visibility";function xp(e,t){let o=Array.from(e.querySelectorAll("[data-timeline-turn-section]")),n=o.findIndex(a=>a.querySelector(`[data-timeline-row-id="${CSS.escape(t)}"]`)),r=n<0?o:o.slice(0,n+1);for(let a of r)a.style.contentVisibility="visible",a.style.setProperty(oI,"visible");e.offsetHeight,requestAnimationFrame(()=>{for(let a of r)a.style.removeProperty("content-visibility"),a.style.removeProperty(oI)})}$();var CU=e=>e.getMeta().status.workingStepLabel??null,xU=e=>e.getMeta().status.waitingFor??null,bU=e=>e.getMeta().status.liveOutputTokens??null,wU=e=>e.getMeta().status.stall??null,TU=e=>e.getMeta().status.retry??null,sI=pe(function({rowsStore:t,historyWindow:o,children:n}){let r=Wt(t,CU),a=Wt(t,xU),s=Wt(t,bU),i=Wt(t,wU),d=Wt(t,TU),c=W(()=>o?{workingStepLabel:null,waitingFor:null,liveOutputTokens:null,stall:null,retry:null}:{workingStepLabel:r,waitingFor:a,liveOutputTokens:s,stall:i,retry:d},[o,s,d,i,a,r]);return l(op,{value:c,children:n})});$();function bp(e){return e==="loading"?"threadSync.loading":"threadSync.syncing"}var IU=1e3,wp=150;function Tp(e,t=IU){let[o,n]=q(null);return H(()=>{if(e===null){n(null);return}let r=globalThis.setTimeout(()=>{n(e)},t);return()=>{globalThis.clearTimeout(r)}},[e,t]),o}var SU=5;function iI(e){let t=e.data.useThreadSyncPhase(e.target);return Tp(t,wp)==="loading"?l(th,{}):null}function th(){let{t:e}=z();return v("div",{className:"pointer-events-none absolute inset-0 overflow-hidden bg-background px-3 pt-4 sm:px-5","data-timeline-loading-skeleton":"",role:"status",children:[l("span",{className:"sr-only",children:e(bp("loading"))}),l("div",{className:"transcript-col flex flex-col gap-6",children:Array.from({length:SU},(t,o)=>v("div",{"aria-hidden":"true",className:"flex flex-col gap-3",children:[l("div",{className:"h-9 self-end rounded-[18px] bg-muted-foreground/15",style:{width:`${44-o%2*14}%`}}),[92,84,61].map((n,r)=>l("div",{className:"h-3 rounded-control-1 bg-muted-foreground/15",style:{width:`${n-o%3*6}%`}},r))]},o))})]})}var lI=l("div",{className:"h-3 sm:h-4"}),dI=l("div",{className:"h-10 sm:h-12"});function cI({loading:e,blocked:t,onLoadEarlier:o,fade:n}){let{t:r}=Ne();return l("div",{className:n?"pt-10 sm:pt-12":"pt-3 sm:pt-4",children:l("div",{className:"transcript-col pb-2",children:l("button",{type:"button","data-timeline-load-earlier":"",onClick:o,disabled:e||t,className:"relative w-full select-none 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 uI({loading:e,blocked:t,onLoadLater:o,onReturnToLatest:n}){let{t:r}=Ne();return v("div",{className:"transcript-col flex items-center justify-center gap-2 py-2",children:[l(K,{variant:"ghost",size:"sm",onClick:o,disabled:e||t,children:r(e?"timeline.loadingLater":"timeline.loadLater")}),n?l(K,{variant:"ghost",size:"sm",onClick:n,children:r("timeline.returnToLatest")}):null]})}function pI({onReveal:e,fade:t}){let{t:o}=Ne();return l("div",{className:t?"pt-10 sm:pt-12":"pt-3 sm:pt-4",children:l("div",{className:"transcript-col pb-2",children:l("button",{type:"button","data-timeline-load-earlier":"",onClick:e,className:"relative w-full select-none 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:o("timeline.loadEarlier")})})})}var mI=l("div",{className:"h-3 sm:h-4"});$();var kU=Object.freeze([]),fI=e=>e.getMeta().status.scheduledWakes??kU;function gI(e,t){let o=E(e);return t&&(o.current=e),o.current}$();function Ip(e){return JSON.stringify([e.turnId??null,e.toolCallId?"tool":"entry",e.toolCallId||e.id])}$();function Sp(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 hI({badge:e,startedAt:t,completedAt:o,waitingLabel:n,timestampFormat:r}){let{t:a}=Ne();if(e===null&&t===void 0)return null;let s=a("timeline.turnInfo");return v(rn,{children:[l(sn,{openOnHover:!0,delay:250,render:l(K,{type:"button",size:"icon-xs",variant:"ghost","data-turn-info":"","aria-label":s,className:"shrink-0 text-muted-foreground"}),children:l(Jl,{className:"size-3.5","aria-hidden":!0})}),l(an,{side:"top",align:"start",className:"max-w-80",children:v("div",{className:"flex flex-col gap-2 text-chat-dense",children:[e!==null?l("div",{className:"flex min-w-0 items-center gap-2",children:l(gi,{badge:e})}):null,t!==void 0?l("div",{className:"text-muted-foreground tabular-nums",children:a("timeline.turnStarted",{time:wn(t,r,a)})}):null,o!==void 0?l("div",{className:"text-muted-foreground tabular-nums",children:a("timeline.turnFinished",{time:wn(o,r,a)})}):null,n!==void 0?l("div",{className:"text-muted-foreground tabular-nums",children:n}):null]})})]})}function LU(e,t,o,n){if(o===void 0||o<=0)return null;let r=t(o);return n!==void 0&&n>0?e("timeline.waitingWithApprovals",{waiting:r,approvals:t(n)}):e("timeline.waiting",{waiting:r})}function kp({label:e,children:t}){let[o,n]=q(!1);return v(Pe,{open:o,onOpenChange:n,children:[l(Ee,{render:l("button",{type:"button",className:"inline-flex items-center gap-1 rounded-sm"}),"aria-label":e,onClick:()=>n(r=>!r),children:t}),l(Re,{children:e})]})}var yI=pe(function({footer:t,timestampFormat:o,copyText:n,identity:r}){let{t:a}=Ne(),{formatCountedDuration:s}=_o(),i=LU(a,s,t.waitingForYouMs,t.approvalWaitMs),d=t.state,c=d==="error"?a("timeline.error"):d==="interrupted"?a("timeline.interrupted"):null;return v("div",{"data-turn-summary":t.turnId,className:"chat-process-meta flex min-w-0 select-none items-center gap-2 px-1 text-muted-foreground",children:[v("div",{className:"flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1",children:[c!==null?v(kp,{label:c,children:[d==="error"?l(dt,{className:"size-icon-1 text-destructive-foreground","aria-hidden":!0}):l(fd,{className:"size-3","aria-hidden":!0}),l("span",{className:"sr-only",children:c})]}):null,t.workingElapsedMs!==void 0?l(kp,{label:a("timeline.workingTime",{duration:s(t.workingElapsedMs)}),children:s(t.workingElapsedMs)}):null,i!==null?v(oe,{children:[" ",l(kp,{label:i,children:i})]}):null,(t.workingElapsedMs!==void 0||i!==null)&&t.outputTokens!==void 0?" ":null,t.outputTokens!==void 0?l(rp,{text:String(t.outputTokens),label:a("copyButton.copyTokenCount"),children:l(kp,{label:`${a("timeline.outputTokens")}: ${t.outputTokens.toLocaleString()}`,children:a("timeline.outputTokenCount",{count:t.outputTokens,value:Sp(t.outputTokens)})})}):null]}),l(hI,{badge:r?.badge??null,startedAt:r?.createdAt,completedAt:t.completedAt,waitingLabel:i??void 0,timestampFormat:o}),n?l(ea,{text:n,variant:"ghost",size:"icon-xs",className:"shrink-0",toastAnchor:"below"}):null]})});function Od({plugins:e,environmentId:t}){let{t:o}=z(),n=Xn(t,e[0]??"");return l("span",{className:"chat-process-meta text-muted-foreground",children:o(e.length===1?"toolCall.rewrittenByOne":"toolCall.rewrittenByMany",{plugin:n??o("toolCall.unknownPlugin"),count:e.length})})}$();function PU(e){return e.toolLifecycleStatus==="interrupted"}function RU(e){let t=e?.stoppedByUser===!0;return e?.continuedAfterStop===!0?t?"toolGroup.interruptedByYouKeptRunning":"toolGroup.interruptedKeptRunning":e?.terminationConfirmed===!0?t?"toolGroup.interruptedByYou":"toolGroup.interrupted":t?"toolGroup.interruptedByYouMayStillRun":"toolGroup.interruptedMayStillRun"}function oh(e,t,o){if(!PU(e))return null;let n=e.toolInterrupt,r=t(RU(n)),a=[n?.durationMs===void 0?null:o(n.durationMs),e.toolIo?.exitCode===void 0?null:t("toolGroup.exitCode",{code:e.toolIo.exitCode})].filter(s=>s!==null);return a.length===0?r:`${r}, ${a.join(", ")}`}$();function nh(e){if(e<1e3)return String(e);if(e<1e6){let o=e/1e3;return`${o<10?o.toFixed(1).replace(/\.0$/,""):Math.round(o)}k`}if(e<1e9){let o=e/1e6;return`${o<10?o.toFixed(1).replace(/\.0$/,""):Math.round(o)}m`}let t=e/1e9;return`${t<10?t.toFixed(1).replace(/\.0$/,""):Math.round(t)}b`}function vI({additions:e,deletions:t,className:o,showParentheses:n=!1,layout:r="aligned",disabled:a=!1,showZero:s=!0,cn:i,t:d,language:c}){let u=s||e!==0,m=s||t!==0;if(!u&&!m)return null;let p=[];u&&p.push(d("changedFiles.additions",{count:e})),m&&p.push(d("changedFiles.deletions",{count:t}));let f=new Intl.ListFormat(c,{type:"unit"}).format(p),g=a?"text-[var(--control-disabled-foreground)]":null;return v(oe,{children:[n&&l("span",{className:"text-muted-foreground/70",children:"("}),v("span",{"aria-label":f,className:i(r==="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",o),"data-slot":"diff-stat",role:"group",children:[u?v("span",{"aria-hidden":"true",className:i("font-mono",g??"text-diff-addition"),children:["+",nh(e)]}):null,m?v("span",{"aria-hidden":"true",className:i("font-mono",g??"text-diff-deletion"),children:["-",nh(t)]}):null]}),n&&l("span",{className:"text-muted-foreground/70",children:")"})]})}var CI=pe(function(t){let{t:o}=Ne();return l(vI,{...t,cn:V,t:o,language:void 0})});function xI(e){return e==="failed"?"failed":e==="running"?"running":"idle"}function bI(e){return e.includes("failed")?"failed":e.includes("running")?"running":"idle"}function EU(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 rh(e,t){let o=new Map;for(let n of e){let r=t(n);o.set(r,(o.get(r)??0)+1)}return Array.from(o,([n,r])=>({action:n,icon:EU(n),count:r}))}function ah(e,t){let o;for(let n of rh(e,t))(!o||n.count>o.count)&&(o=n);return o?.icon??"wrench"}$();function wI({entries:e,failed:t,derive:o}){let{t:n}=Ne(),r=W(()=>rh(e,o.toolGroupAction),[e,o]),a=r.length===1;return a&&r[0].count<2?null:l("span",{className:"chat-process-meta flex shrink-0 items-center gap-2 tabular-nums","aria-label":n("toolGroup.calls",{count:e.length}),children:r.map(({action:s,icon:i,count:d})=>v("span",{"aria-hidden":!0,className:"flex items-center gap-1",children:[a?null:l(Vs,{name:i,className:V("size-icon-1 shrink-0 stroke-[1.8] opacity-70",t?"text-destructive-foreground":"text-icon-muted")}),d]},s))})}function MU(e){switch(e){case"command":return"command";case"edit":return"edit";case"read":return"read";case"search":case"code-search":return"search";default:return"other"}}function AU(e){return e.changedFiles&&e.changedFiles.length>0?e.changedFiles:e.toolLabel?.path?[e.toolLabel.path]:[]}function TI(e,t){let o=[],n=new Map,r=new Map,a=new Map;for(let p of e){let f=MU(t(p));if(o.includes(f)||o.push(f),n.set(f,(n.get(f)??0)+1),f!=="edit"&&f!=="read")continue;let g=AU(p);if(g.length===0){a.set(f,(a.get(f)??0)+1);continue}let h=r.get(f)??new Set;for(let y of g)h.add(y);r.set(f,h)}let i=o.map(p=>({kind:p,count:p==="edit"||p==="read"?(r.get(p)?.size??0)+(a.get(p)??0):n.get(p)??0})).filter(p=>p.count>0).slice().sort((p,f)=>f.count-p.count||o.indexOf(p.kind)-o.indexOf(f.kind)),d=i.slice(0,2),c=i.slice(2);if(c.length===0)return d;let u=c.reduce((p,f)=>p+(n.get(f.kind)??0),0),m=d.map(p=>p.kind==="other"?{kind:"other",count:p.count+u}:p);return d.some(p=>p.kind==="other")||m.push({kind:"other",count:u}),m}function II(e){return typeof e.toolData=="object"&&e.toolData!==null&&!Array.isArray(e.toolData)?e.toolData:null}function SI(e,t,o,n){if(t===void 0||o===void 0||o.length===0)return e;let r=e.trim();for(let a of[`mcp__ycodium__${t}`,`ycodium_${t}`,`ycodium ${t}`,t]){if(r===a)return o;if(!r.startsWith(`${a} `))continue;let s=r.slice(a.length).trim();return s.length===0?o:n!==void 0&&s.toLowerCase()==="started"?n(o):`${o} ${s}`}return e}function ta(e){return Ip(e)}function Lp(e,t,o,n,r,a){let s=e.toolLabel,i=o.resolveToolCommand(e);if(i&&s?.descriptive&&!s.path&&s.detail?.trim())return s.detail.replace(/\s+/g," ").trim();for(let y of[e.rawCommand,e.command]){let x=o.parseToolCommandInput(y)?.description;if(x)return x.replace(/\s+/g," ").trim()}if(i)return i.replace(/\s+/g," ").trim();let d=II(e),c=typeof d?.toolName=="string"?d.toolName:typeof d?.name=="string"?d.name:void 0,u=e.builtinMcpTool||void 0,m=a??SI(s?.name??c??e.toolTitle??e.label,u,u===void 0?void 0:n?.get(u),r),p=s?.path??e.changedFiles?.[0],f=p?dp(p,t):void 0,g=[m.trim().toLowerCase()==="tool"?void 0:m,f,e.toolMetadata?.source==="ycodium"?void 0:s?.detail??e.detail],h=[];for(let y of g){let x=y?.replace(/\s+/g," ").trim();x&&!h.some(C=>C.toLowerCase()===x.toLowerCase())&&h.push(x)}return h.join(" ")||null}$();function Fd(e){let t=xe(Fe)?.toolPresentation;return e===void 0||t===void 0?null:t(e)}function kI(e){let t=xe(Fe)?.toolPresentation;return W(()=>{if(t===void 0||e.length===0)return null;let o=t(e[0]);if(o===null)return null;let n=e.map(r=>t(r));return n.every(r=>r?.groupKey===o.groupKey)?o:n.every(r=>r?.familyKey===o.familyKey)?{...o,groupName:o.familyName,origin:o.origin.kind==="ycodium"?{kind:"ycodium",area:"general"}:o.origin}:null},[e,t])}function sh({presentation:e,className:t}){let o=xe(Fe),n=o.ToolSourceIcon;return n===void 0?null:l(n,{environmentId:o.activeThreadEnvironmentId,origin:e.origin,className:t})}function Bd({presentation:e,fallback:t,environmentId:o}){return v(oe,{children:[e.sourceName!==null?v(oe,{children:[l("span",{className:"font-medium text-foreground","data-tool-source-name":"",children:e.sourceName}),l("span",{"aria-hidden":!0,className:"px-1 text-muted-foreground",children:"\xB7"})]}):null,e.declared?l("span",{children:e.title}):t,e.declared&&e.summary!==null?l(LI,{text:e.summary}):null,e.declared&&e.summary===null&&e.entity?l(NU,{entity:e.entity,environmentId:o}):null,e.declared&&e.experienceId?l(DU,{experienceId:e.experienceId}):null]})}function NU({entity:e,environmentId:t}){let o=xe(Fe),n=t??o?.activeThreadEnvironmentId??"",r=e.kind==="machine"?e.environmentId:e.environmentId??n;return v(oe,{children:[l("span",{"aria-hidden":!0,className:"px-1 text-muted-foreground",children:"\xB7"}),l("span",{className:"inline-flex min-w-0 tabular-nums","data-tool-entity":e.kind,children:e.kind==="thread"?l(yd,{threadRef:{environmentId:r,threadId:e.threadId},fallbackName:e.fallbackName,showStatus:!1}):e.kind==="machine"?l(gb,{environmentId:r,fallbackName:e.fallbackName}):e.kind==="project"?l(hb,{projectRef:{environmentId:r,projectId:e.projectId},fallbackName:e.fallbackName}):l(yb,{environmentId:r,instanceId:e.instanceId,fallbackName:e.fallbackName})})]})}function LI({text:e}){return v(oe,{children:[l("span",{"aria-hidden":!0,className:"px-1 text-muted-foreground",children:"\xB7"}),l("span",{className:"tabular-nums",children:e})]})}function DU({experienceId:e}){let t=ci(),o=t?.data.useMemoryExperience;return!t||!o?null:l(_U,{readExperience:o,target:t.target,experienceId:e})}function _U({readExperience:e,target:t,experienceId:o}){let{title:n}=e(t,o);return n===null?null:l(LI,{text:n})}var hi=20,OU={failed:"toolGroup.showFailure",declined:"toolGroup.showDeclined",stopped:"toolGroup.showCancelled"},FU={command:"toolGroup.semanticCommands",edit:"toolGroup.semanticEdits",read:"toolGroup.semanticReads",search:"toolGroup.semanticSearches",other:"toolGroup.semanticOther"};function PI({entry:e,presentation:t}){let o=e.toolLabel?.diffStat;return!o||t==="failed"||t==="declined"||t==="stopped"?null:l(CI,{...o,layout:"inline",className:"chat-process-meta ms-2 shrink-0"})}function RI({toolIcon:e,glyphClassName:t}){let o=xe(Fe),n=o.SiteIcon;return e.pageUrl!==void 0&&n!==void 0?l(n,{threadRef:o.threadRef,pageUrl:e.pageUrl,className:"size-3.5 shrink-0 rounded-sm object-contain"}):l(Vs,{name:"globe",className:t})}function BU({entry:e,failed:t=!1,derive:o}){let n=xe(Fe),r=Fd(e);return t?l(eo,{"aria-hidden":!0,className:"size-icon-1 shrink-0 text-destructive-foreground"}):e.toolIcon!==void 0?l(RI,{toolIcon:e.toolIcon,glyphClassName:"size-icon-1 shrink-0 stroke-[1.8] text-muted-foreground opacity-70"}):r!==null&&n.ToolSourceIcon!==void 0?l(sh,{presentation:r,className:"size-icon-1"}):l(Vs,{name:ah([e],o.toolGroupAction),className:"size-icon-1 shrink-0 stroke-[1.8] text-muted-foreground opacity-70"})}function EI({entry:e}){let t=xe(Fe),o=e.detail??e.command??e.rawCommand??e.toolLabel?.detail,n=JSON.stringify([e.id,e.sourceActivityKind,e.toolLifecycleStatus]),r=Fd(e),a=t.renderToolCallDetail?.({entry:e,threadRef:t.threadRef,threadKey:t.threadKey,workspaceRoot:t.workspaceRoot,revision:n,onOpenFileDiff:t.onOpenFileDiff});return v("div",{className:"min-w-0 space-y-2 p-3",children:[r!==null?l("p",{className:"chat-process-meta text-muted-foreground","data-tool-source-line":"",children:r.sourceLine}):null,a!==void 0?l(oe,{children:a}):l("pre",{className:"chat-tool-body overflow-x-auto rounded-md bg-muted/40 p-2",children:o??""})]})}var HU=pe(function(t){let{entry:o,threadKey:n,workspaceRoot:r,onDisclosureChange:a}=t,s=xe(Fe),i=s.derive,{t:d}=Ne(),{formatDuration:c}=_o(),[u,m]=$t(n,`call:${ta(o)}`,!1),p=i.toolPresentationStatus(o),f=Fd(o),g=f?.declared===!0?null:Lp(o,r,i,s.declaredToolTitles,k=>d("toolGroup.declaredStarted",{title:k}),f?.title)??d("toolGroup.calls",{count:1}),h=p==="failed",y=p==="declined",x=p==="stopped",C=x?oh(o,d,c):null,b=i.resolveWorkEntryStatus(o),L=b==="failed"||b==="running"?b:null,w=ho();return v("div",{"data-tool-call-id":o.toolCallId??o.id,"data-tool-identity":ta(o),className:"border-b border-border/50 last:border-b-0",children:[v("button",{type:"button","aria-expanded":u,"aria-controls":w,onClick:()=>{a?.(),m(!u)},className:V("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",h?"text-destructive-foreground":"text-muted-foreground"),children:[l(Cd,{status:L}),l(vd,{children:l(BU,{entry:o,failed:h,derive:i})}),v("span",{className:"flex min-w-0 flex-1 items-center",children:[l("span",{className:"truncate",children:f!==null?l(Bd,{presentation:f,fallback:g}):g}),l(PI,{entry:o,presentation:p})]}),h||y||x||o.statusInferred?l("span",{className:"chat-process-meta shrink-0",children:o.statusInferred?d("toolGroup.statusUnknown"):h?d("toolGroup.failed",{count:1}):y?d("toolGroup.declined",{count:1}):C??d("toolGroup.cancelled",{count:1})}):null,o.rewrittenBy?.length?l(Od,{plugins:o.rewrittenBy,environmentId:s.threadRef?.environmentId??null}):null,l(Tt,{"aria-hidden":!0,className:V("size-icon-1 shrink-0",!u&&"-rotate-90")})]}),u?l("div",{id:w,children:l(EI,{entry:o})}):null]})});function UU({threadKey:e,stateKey:t,maxHeight:o,children:n}){let r=E(null);return fe(()=>{let a=r.current;if(!a)return;a.scrollTop=$g(e,`${t}:scroll`,0);let s=()=>{Ld(e,`${t}:scroll`,a.scrollTop,!1)};return a.addEventListener("scroll",s,{passive:!0}),()=>a.removeEventListener("scroll",s)},[e,t]),l("div",{ref:r,"data-slot":"scroll-area-viewport",className:"min-w-0 overflow-y-auto overscroll-y-contain",style:{maxHeight:o},children:n})}var MI=pe(function({entries:t,groupId:o,threadKey:n,workspaceRoot:r,onDisclosureChange:a}){let s=xe(Fe),i=s.derive,{t:d}=Ne(),{formatDuration:c}=_o(),[u,m]=$t(n,`group:${o}`,!1),[p,f]=$t(n,`group-page:${o}`,0),g=ho(),h=E(null),[y,x]=q(null),C=t.at(-1),{failedCount:b,declinedCount:L,stoppedCount:w,issue:k,runningCount:I,unknownCount:T}=W(()=>({...i.summarizeToolGroup(t),unknownCount:t.filter(ne=>ne.statusInferred).length,runningCount:t.filter(ne=>i.toolPresentationStatus(ne)==="running").length}),[t,i]),S=k?.entry??C,P=Math.max(0,Math.ceil(t.length/hi)-1),A=Math.min(p,P),N=A*hi,B=t.slice(N,N+hi),O=t.length>1,j=t.every(ne=>i.toolPresentationStatus(ne)==="completed"),D=W(()=>O&&j&&k===null?TI(t,i.toolGroupAction):null,[t,i,O,j,k])?.map(ne=>d(FU[ne.kind],{count:ne.count})).join(" \xB7 ")??null,J=kI(O?t:[]),G=Fd(O?void 0:C),M=O?J:G;if(fe(()=>{if(!y)return;let ne=h.current,Z=Array.from(ne?.querySelectorAll("[data-tool-identity]")??[]).find(he=>he.dataset.toolIdentity===y.id);if(!Z)return;let ve=Z.closest('[data-slot="scroll-area-viewport"]');ve&&(ve.scrollTop+=Z.getBoundingClientRect().top-ve.getBoundingClientRect().top),Z.querySelector("button")?.focus({preventScroll:!0})},[y]),!C||!S)return null;let X=I>0&&k===null?t.find(ne=>i.toolPresentationStatus(ne)==="running")??S:S,F=D??Lp(X,r,i,s.declaredToolTitles,ne=>d("toolGroup.declaredStarted",{title:ne}),G?.title)??d("toolGroup.calls",{count:1}),ee=ne=>{a?.(),f(ne)},Y={threadKey:n,workspaceRoot:r,onDisclosureChange:a},ae=bI(t.map(ne=>xI(i.resolveWorkEntryStatus(ne)))),te=ah(t,i.toolGroupAction),de=O?null:oh(C,d,c),ge=ae==="failed"?"failed":ae==="running"?"running":L+w===t.length?null:"success";return l(Nu,{state:ae,variant:"tool",children:v("section",{ref:h,"data-tool-group-id":o,className:"min-w-0",children:[v("div",{className:"flex min-w-0 items-center",children:[v("button",{type:"button","aria-expanded":u,"aria-controls":g,onClick:()=>{a?.(),m(!u),!O&&!u&&Ld(n,`call:${ta(C)}`,!0)},className:V(li,"flex-1",b>0?"text-destructive-foreground":"text-muted-foreground"),children:[l(Cd,{status:ge}),l(vd,{children:M!==null&&s.ToolSourceIcon!==void 0&&b===0&&(O||C.toolIcon===void 0)?l(sh,{presentation:M,className:"size-icon-1"}):!O&&C.toolIcon!==void 0&&b===0?l(RI,{toolIcon:C.toolIcon,glyphClassName:"size-icon-1 shrink-0 stroke-[1.8] opacity-70 text-icon-muted"}):l(Vs,{name:te,className:V("size-icon-1 shrink-0 stroke-[1.8] opacity-70",b>0?"text-destructive-foreground":"text-icon-muted")})}),v("span",{className:V("flex min-w-0 flex-1 items-center",u&&O?"chat-process-text":"chat-tool-summary"),children:[l("span",{className:"truncate",children:J!==null?d("toolGroup.namedCalls",{name:J.groupName,count:t.length}):u&&O?d("toolGroup.calls",{count:t.length}):G!==null?l(Bd,{presentation:G,fallback:F}):F}),u&&O?null:D===null?l(PI,{entry:S,presentation:i.toolPresentationStatus(S)}):null]}),t.length===1&&S.rewrittenBy?.length?l(Od,{plugins:S.rewrittenBy,environmentId:s.threadRef?.environmentId??null}):null,T>0?l("span",{className:"chat-process-meta shrink-0",children:d("toolGroup.statusUnknown")}):null,I>0?l("span",{className:"chat-process-meta shrink-0 tabular-nums text-info-foreground",children:d("toolGroup.running",{count:I})}):null,b>0?l("span",{className:"chat-process-meta shrink-0 tabular-nums",children:d("toolGroup.failed",{count:b})}):null,L>0?l("span",{className:"chat-process-meta shrink-0 tabular-nums",children:d("toolGroup.declined",{count:L})}):null,w>0?l("span",{className:"chat-process-meta shrink-0 tabular-nums",children:d("toolGroup.cancelled",{count:w})}):null,u&&O?null:D===null&&J===null?l(wI,{entries:t,failed:b>0,derive:i}):null,l(Tt,{"aria-hidden":!0,className:V("size-icon-1 shrink-0",!u&&"-rotate-90")})]}),k&&O?l("button",{type:"button",className:V("chat-process-meta me-2 min-h-8 shrink-0 rounded-control-4 px-1 underline [@media(pointer:coarse)]:min-h-11",k.kind==="failed"?"text-destructive-foreground":"text-muted-foreground"),onClick:()=>{a?.(),m(!0),f(Math.floor(t.indexOf(k.entry)/hi)),Ld(n,`call:${ta(k.entry)}`,!0),x({id:ta(k.entry)})},children:d(OU[k.kind])}):null]}),u?l("div",{id:g,className:"border-t border-border/50",children:O?v(oe,{children:[t.length>hi?v("div",{className:"chat-process-meta flex items-center gap-1 border-b border-border/40 px-2 py-1 text-muted-foreground",children:[l("span",{className:"min-w-0 flex-1 tabular-nums",children:d("toolGroup.pageRange",{from:N+1,to:Math.min(N+hi,t.length),count:t.length})}),[{label:d("toolGroup.firstPage"),target:0,disabled:A===0,Icon:Ul},{label:d("toolGroup.previousPage"),target:A-1,disabled:A===0,Icon:Hl},{label:d("toolGroup.nextPage"),target:A+1,disabled:A===P,Icon:yo},{label:d("toolGroup.lastPage"),target:P,disabled:A===P,Icon:$l}].map(({label:ne,target:Z,disabled:ve,Icon:he})=>l("button",{type:"button","aria-label":ne,disabled:ve,onClick:()=>ee(Z),className:"flex size-7 items-center justify-center rounded-control-3 disabled:opacity-64 [@media(pointer:coarse)]:size-11",children:l(he,{"aria-hidden":!0,className:"size-icon-1"})},ne))]}):null,l(UU,{threadKey:n,stateKey:`group-scroll:${o}:${A}`,maxHeight:"min(320px, 50dvh)",children:l("div",{className:"space-y-0.5 py-1",children:B.map(ne=>l(HU,{entry:ne,...Y},ta(ne)))})})]}):v(oe,{children:[de?l("p",{className:"chat-process-meta px-3 pt-3 text-muted-foreground",children:l("span",{children:de})}):null,l(EI,{entry:C})]})}):null]})})});$();function AI(e){return e instanceof Error?e.message:void 0}function Pp(e,t){return t!==void 0&&t.length>0?`${e}: ${t}`:e}function NI(e){return{error:(t,o,n)=>{let r=n?.description??AI(o);e(Pp(t,r),"error",r)},warning:(t,o,n)=>{let r=n?.description??AI(o);e(Pp(t,r),"warning",r)},success:(t,o,n)=>{let r=o??n?.description;e(Pp(t,r),"success",r)},info:(t,o,n)=>{let r=o??n?.description;e(Pp(t,r),"info",r)}}}function DI(){let e=Nt();return NI((t,o,n)=>e.notify(t,o,n))}function yi(e){let t=e.match(/^\s{0,3}#{1,6}\s+(.+)$/m)?.[1]?.trim();return t&&t.length>0?t:null}function ih(e){let t=e.trimEnd().split(/\r?\n/),o=t[0]&&/^\s{0,3}#{1,6}\s+/.test(t[0])?t.slice(1):[...t];for(;o[0]?.trim().length===0;)o.shift();if(o[0]?.match(/^\s{0,3}#{1,6}\s+(.+)$/)?.[1]?.trim().toLowerCase()==="summary")for(o.shift();o[0]?.trim().length===0;)o.shift();return o.join(`
3538
- `)}function _I(e,t,o){let n=o?.maxLines??8,r=ih(e).trimEnd().split(/\r?\n/).map(d=>d.trimEnd()),a=[],s=0,i=!1;for(let d of r){let c=d.trim().length>0;if(c&&s>=n){i=!0;break}a.push(d),c&&(s+=1)}for(;a.length>0&&a.at(-1)?.trim().length===0;)a.pop();return a.length===0?yi(e)??t("proposedPlan.previewUnavailable"):(i&&a.push("","..."),a.join(`
3539
- `))}function $U(e){let t=e.toLowerCase().replace(/[`'".,!?()[\]{}]+/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"");return t.length>0?t:"plan"}function OI(e){let t=yi(e);return`${$U(t??"plan")}.md`}function FI(e){return`${e.trimEnd()}
3540
- `}function BI(e,t){let o=new Blob([t],{type:"text/markdown;charset=utf-8"}),n=URL.createObjectURL(o),r=document.createElement("a");r.href=n,r.download=e,r.click(),window.setTimeout(()=>{URL.revokeObjectURL(n)},0)}function Rp(e,t,o="duration"){let n=`<${o}></${o}>`,r=`<${o}/>`,a=i=>{let d=e.indexOf(i);return d<0?null:[e.slice(0,d),e.slice(d+i.length)]},s=a(n)??a(r);return s===null?v(oe,{children:[e,t]}):v(oe,{children:[s[0],t,s[1]]})}var Ep=1024,HI=pe(function({planMarkdown:t,threadKey:o,rowId:n,environmentId:r,threadRef:a,cwd:s,workspaceRoot:i,onSavePlanToWorkspace:d}){let{t:c}=Ne(),u=DI(),[m,p]=$t(o,`proposed-plan:${n}:expanded`,!1),[f,g]=q(!1),[h,y]=$t(o,`proposed-plan:${n}:save-path`,""),[x,C]=q(!1);Gs(n,f||x);let b=E(!1),L=E(!1);fe(()=>(b.current=!0,()=>{b.current=!1}),[]);let{copyToClipboard:w,isCopied:k}=np({target:"plan",onError:G=>{u.error(c("proposedPlan.couldNotCopy"),G,{description:c("proposedPlan.copyErrorDescription")})}}),I=ho(),T=yi(t)??c("proposedPlan.defaultTitle"),S=t.split(`
3541
- `).length,P=t.length>900||S>20,A=ih(t),N=P?_I(t,c,{maxLines:10}):null,B=OI(t),O=FI(t),j=()=>{BI(B,O)},U=()=>{w(O)},D=()=>{if(!i){u.error(c("proposedPlan.workspacePathUnavailable"),c("proposedPlan.workspacePathUnavailableDescription"));return}h.length===0&&y(B.slice(0,Ep)),g(!0)},J=()=>{if(L.current)return;let G=h.trim();if(!(!i||d===null)){if(!G){u.warning(c("proposedPlan.enterWorkspacePath"));return}if(G.length>Ep){u.warning(c("proposedPlan.pathTooLong"));return}L.current=!0,C(!0),(async()=>{try{let M=await d({environmentId:r,workspaceRoot:i,relativePath:G,contents:O});if(!b.current)return;M.ok?(g(!1),u.success(c("proposedPlan.savedToWorkspace"),M.relativePath)):u.error(c("proposedPlan.couldNotSave"),void 0,{description:c("proposedPlan.saveErrorDescription")})}catch(M){b.current&&u.error(c("proposedPlan.couldNotSave"),M,{description:c("proposedPlan.saveErrorDescription")})}finally{L.current=!1,b.current&&C(!1)}})()}};return v("div",{className:"rounded-[24px] border border-border/80 bg-card/70 p-4 sm:p-5",children:[v("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[v("div",{className:"flex min-w-0 items-center gap-2",children:[l(jr,{variant:"secondary",children:c("proposedPlan.badge")}),l("p",{className:"truncate text-sm font-medium text-foreground",children:T})]}),v(Ao,{children:[l(Do,{render:l(K,{"aria-label":c("proposedPlan.actions"),size:"icon-xs",variant:"outline"}),children:l(Eo,{"aria-hidden":"true",className:"size-4"})}),v(No,{align:"end",children:[l(vo,{onClick:U,children:c(k?"proposedPlan.copied":"proposedPlan.copyToClipboard")}),l(vo,{onClick:j,children:c("proposedPlan.downloadAsMarkdown")}),d!==null?l(vo,{onClick:D,disabled:!i||x,children:c("proposedPlan.saveToWorkspace")}):null]})]})]}),v("div",{className:"mt-4",children:[v("div",{className:V("relative",P&&!m&&"max-h-104 overflow-hidden"),children:[P&&!m?l(wo,{disclosureKey:`proposed-plan:${n}:plan`,text:N??"",cwd:s,threadRef:a,isStreaming:!1}):l(wo,{disclosureKey:`proposed-plan:${n}:plan`,text:A,cwd:s,threadRef:a,isStreaming:!1}),P&&!m?l("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]}),P?l("div",{className:"mt-4 flex justify-center",children:l(K,{size:"sm",variant:"outline","data-scroll-anchor-ignore":!0,onClick:()=>p(!m),children:c(m?"proposedPlan.collapse":"proposedPlan.expand")})}):null]}),l(Js,{open:f,onOpenChange:G=>{x||g(G)},children:v(ei,{className:"max-w-xl",children:[v(Hu,{children:[l(ti,{children:c("proposedPlan.saveToWorkspace")}),l(Zs,{children:Rp(c("proposedPlan.pathHint"),l("code",{children:i??c("proposedPlan.theWorkspace")}),"path")})]}),l(Lb,{className:"space-y-3",children:v("label",{htmlFor:I,className:"grid gap-1.5",children:[l("span",{className:"text-xs font-medium text-foreground",children:c("proposedPlan.workspacePath")}),l(Vr,{id:I,value:h,maxLength:Ep,onChange:G=>y(G.target.value.slice(0,Ep)),placeholder:B,spellCheck:!1,disabled:x})]})}),v(Bu,{children:[l(K,{variant:"outline",size:"sm",onClick:()=>g(!1),disabled:x,children:c("proposedPlan.cancel")}),l(K,{size:"sm",onClick:()=>{J()},disabled:x,children:c(x?"proposedPlan.saving":"proposedPlan.save")})]})]})})]})});$();var vi=class extends ur{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 UI(e){return l(bb,{error:e})}$();var lh=qe(void 0);function $I(){return xe(lh)}function zI(e){let t=e.threadRef;if(typeof t=="object"&&t!==null&&"threadId"in t){let n=t.threadId;if(typeof n=="string"&&n.length>0)return n}let o=`${e.environmentId}:`;return e.threadKey.startsWith(o)&&e.threadKey.length>o.length?e.threadKey.slice(o.length):e.threadKey}$();function qI({row:e}){let{workingStepLabel:t,waitingFor:o,liveOutputTokens:n,stall:r,retry:a}=xe(op),{t:s}=Ne(),i=E(null),d=e.compacting?s("activity.compacting"):o==="approval"?s("activity.waitingForApproval"):o==="userInput"?s("activity.waitingForAnswer"):t;return v("div",{className:"border-b border-border/60 pb-2 pt-1",children:[v("div",{className:"working-status 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:[v("span",{ref:i,className:"working-glyph","data-waiting":o!==null?"":void 0,...o===null?{role:"img","aria-label":s("activity.working")}:{"aria-hidden":!0},children:[l("span",{}),l("span",{}),l("span",{})]}),d?l("span",{"data-working-part":"",className:"min-w-0",children:d}):null,e.createdAt?l(jU,{createdAt:e.createdAt,runSegments:e.runSegments,waitSpans:e.waitSpans,glyphRef:i}):null,n!==null?l("span",{"data-working-part":"",children:s("timeline.outputTokenCount",{count:n,value:Sp(n)})}):null]}),a?l(zU,{retry:a}):r&&!e.compacting?l(qU,{stall:r}):null]})}function zU({retry:e}){let{t}=Ne(),o=xe(Fe);return v(bd,{variant:"warning",className:"mt-2 px-2 py-1.5 text-chat-row",children:[l(Uu,{children:o.derive.providerRetryMessage(e,(n,r)=>t(n,r))}),o.onInterrupt?l(wd,{children:l(K,{onClick:o.onInterrupt,disabled:o.stopping===!0,size:"sm",variant:"ghost",title:t("stall.interruptHint"),children:o.stopping===!0?t("stall.stopping"):t("stall.interrupt")})}):null]})}var KU={childThread:"stall.reasonChildThread",tool:"stall.reasonTool",approval:"stall.reasonApproval",userInput:"stall.reasonUserInput",model:"stall.reasonModel"};function qU({stall:e}){let{t}=Ne(),{onInterrupt:o,stopping:n}=xe(Fe),r=t(KU[e.reason]);return v("div",{className:"mt-1 flex items-center gap-2 px-1 text-chat-row text-muted-foreground/70",children:[l("span",{className:"tabular-nums",children:Rp(t("stall.noOutputForLive"),l(GU,{since:e.since}))})," ",l("span",{children:r}),o?l(K,{className:"h-5 px-1.5 text-chat-row",onClick:o,disabled:n===!0,size:"sm",title:t("stall.interruptHint"),variant:"ghost",children:t(n===!0?"stall.stopping":"stall.interrupt")}):null]})}function WU(e,t,o){let n=Cn(),{workingClock:r}=xe(Fe).derive;H(()=>{let a=()=>{t.current&&(t.current.textContent=GI(e,o,r))};if(a(),!n)return;let s=setInterval(a,1e3);return document.addEventListener("visibilitychange",a),()=>{clearInterval(s),document.removeEventListener("visibilitychange",a)}},[n,e,t,o,r])}function GU({since:e}){let t=E(null),{units:o}=_o(),{workingClock:n}=xe(Fe).derive;return WU(e,t,o),l("span",{className:"timeline-timer tabular-nums",ref:t,children:GI(e,o,n)})}function jU({createdAt:e,waitSpans:t,runSegments:o,glyphRef:n}){let r=E(null),a=Cn(),{units:s}=_o(),{workingClock:i}=xe(Fe).derive,{paused:d}=i({startedAt:e,nowIso:new Date().toISOString(),waitSpans:t,runSegments:o});return H(()=>{let c=()=>{let m=KI(i,{createdAt:e,nowIso:new Date().toISOString(),waitSpans:t,runSegments:o},s);r.current&&(r.current.textContent=m.text),n.current&&(n.current.dataset.tick=String(m.elapsedSeconds%3))};if(c(),!a||d)return;let u=setInterval(c,1e3);return document.addEventListener("visibilitychange",c),()=>{clearInterval(u),document.removeEventListener("visibilitychange",c)}},[e,n,a,d,o,s,t,i]),l("span",{ref:r,"data-working-part":"",className:"timeline-timer tabular-nums",children:KI(i,{createdAt:e,nowIso:new Date().toISOString(),waitSpans:t,runSegments:o},s).text})}function WI(e,t){if(!Number.isFinite(e)||e<0)return t.seconds("0");let o=Math.floor(e/1e3);return o<60?t.seconds(String(o)):Td(o*1e3,t)}function KI(e,t,o){let n=e({startedAt:t.createdAt,nowIso:t.nowIso,waitSpans:t.waitSpans,runSegments:t.runSegments}),r=n.elapsedMs??0,a=Number.isFinite(r)?Math.max(0,Math.floor(r/1e3)):0;return{text:a<1?"":WI(r,o),paused:n.paused,elapsedSeconds:a}}function GI(e,t,o){return WI(o({startedAt:e,nowIso:new Date().toISOString(),waitSpans:void 0,runSegments:void 0}).elapsedMs??0,t)}$();function jI({children:e}){let{t}=z(),[o,n]=q(!1);return v("div",{className:"py-2","data-context-compaction-divider":!0,children:[v("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[l("span",{className:"h-px min-w-2 flex-1 bg-border"}),v(K,{size:"xs",variant:"ghost",className:"shrink-0 gap-1.5","aria-expanded":o,title:t("turnOverview.compressionDetails"),onClick:()=>n(r=>!r),children:[l(Oa,{className:"size-3","aria-hidden":!0}),t("turnOverview.compaction"),o?l(Tt,{className:"size-3","aria-hidden":!0}):l(yo,{className:"size-3","aria-hidden":!0})]}),l("span",{className:"h-px min-w-2 flex-1 bg-border"})]}),o?l("div",{className:"mt-1",children:e}):null]})}var VI=pe(function({rowsStore:t,rowId:o}){let n=yw(t,o),r=$I(),a=xe(Fe),{t:s}=Ne();if(n===void 0)return null;let i=zI({threadKey:a.threadKey,environmentId:a.activeThreadEnvironmentId,threadRef:a.threadRef});return l(Gr,{value:n.id,children:l("div",{className:V("relative",n.kind==="message"&&n.message.role==="user"?"pb-6":n.kind==="message"&&n.message.role==="assistant"?n.copyInFooter?"pb-1 group/assistant":"pb-4 group/assistant":n.kind==="turn-summary"?"pb-2 empty:pb-0":"pb-2"),"data-timeline-row-id":n.id,"data-timeline-row-kind":n.kind,"data-message-id":n.kind==="message"?n.message.id:void 0,"data-message-role":n.kind==="message"?n.message.role:void 0,children:v(vi,{resetKey:n.id,fallback:UI,children:[n.kind==="turn-summary"?v(oe,{children:[r?.renderDeliverableTools?.({turnId:n.footer.turnId,environmentId:a.activeThreadEnvironmentId,threadId:i}),n.cardAnchor===!0?null:l(yI,{footer:n.footer,copyText:n.copyText,timestampFormat:a.timestampFormat,identity:n.identity}),r?.renderSlot("conversation.chat.turnTail",{turnId:n.footer.turnId,environmentId:a.activeThreadEnvironmentId,threadId:i})]}):null,n.kind==="tool-group"?l(MI,{entries:n.entries,groupId:n.groupId,threadKey:a.threadKey,workspaceRoot:a.workspaceRoot,onDisclosureChange:()=>a.onProcessDisclosureChange?.(n.id)}):null,n.kind==="work"?l(VU,{row:n}):null,n.kind==="model-switch"?l(Jg,{row:n}):null,n.kind==="turn-identity"?l("div",{"data-turn-identity":n.turnId,role:"group","aria-label":s("timeline.answeredBy",{name:n.badge.providerDisplayName??n.badge.modelLabel}),className:"chat-process-meta flex min-w-0 select-none items-center gap-2 px-1 text-muted-foreground",children:l(gi,{badge:n.badge,compact:!0})}):null,n.kind==="message"&&n.message.role==="user"?l(Cp,{row:n}):null,n.kind==="message"&&n.message.role==="assistant"?l(WT,{row:n}):null,n.kind==="proposed-plan"?l(XU,{row:n}):null,n.kind==="turn-plan"?l(YU,{row:n}):null,n.kind==="working"?l(qI,{row:n}):null,n.kind==="continuation-check"?l(kT,{row:n}):null]})})})});function VU({row:e}){let t=xe(Fe),o=Cn(),n=t.renderWorkGroup?.({row:e,threadRef:t.threadRef,visible:o});return e.groupedEntries.some(r=>r.sourceActivityKind==="context-compaction")?l(jI,{children:n!==void 0?n:e.groupedEntries.map(r=>l("pre",{className:"max-h-72 overflow-auto text-xs whitespace-pre-wrap",children:r.detail??r.label},r.id))}):n!==void 0?l(oe,{children:n}):l("div",{className:"min-w-0 space-y-px py-0.5",children:e.groupedEntries.map(r=>l(QU,{entry:r},r.id))})}function QU({entry:e}){let t=xe(Fe),[o,n]=$t(t.threadKey,`work-fallback:${Ip(e)}`,!1),r=e.detail??e.command??e.rawCommand??e.toolLabel?.detail,a=e.toolMetadata?.source==="ycodium"?e.toolTitle??e.toolLabel?.name??e.label:e.label;return v("div",{children:[v("button",{type:"button","aria-expanded":o,className:V(li,e.tone==="error"?"text-destructive-foreground":"text-muted-foreground"),onClick:()=>n(!o),disabled:r===void 0,children:[l("span",{"aria-hidden":!0,className:V("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")}),l("span",{className:"chat-process-text min-w-0 flex-1 truncate",children:a}),r!==void 0?l(Tt,{"aria-hidden":!0,className:V("size-icon-1 shrink-0",!o&&"-rotate-90")}):null]}),o&&r!==void 0?l("pre",{className:"chat-tool-body mx-2 overflow-x-auto rounded-md bg-muted/40 p-2",children:r}):null]})}function XU({row:e}){let t=xe(Fe);return l("div",{className:"min-w-0 px-1 py-0.5",children:l(HI,{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 YU=pe(function({row:t}){let o=xe(Fe),{t:n}=Ne(),[r,a]=$t(o.threadKey,`turn-plan:${t.id}`,!1),{steps:s}=t.turnPlan.plan,i=s.filter(m=>m.status==="completed").length,d=i===s.length,c=s.find(m=>m.status==="inProgress")?.step??s.find(m=>m.status==="pending")?.step??s.at(-1)?.step??n("proposedPlan.badge");return v("div",{className:"min-w-0 px-1 py-0.5",children:[v("button",{type:"button",className:"relative flex w-full min-w-0 cursor-[var(--control-cursor)] items-center gap-2 rounded-md px-0.5 py-0.5 text-left text-control-1 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:[l(r?Tt:yo,{className:"size-icon-1 shrink-0 text-muted-foreground/65"}),s.length>1?l("span",{"aria-hidden":!0,className:"flex shrink-0 items-center gap-0.5",children:s.map(m=>l("span",{className:V("h-[3px] w-2.5 rounded-full",m.status==="completed"?"bg-success":m.status==="inProgress"?"bg-primary":"bg-muted-foreground/25")},m.step))}):null,l("span",{className:V("min-w-0 truncate",d?"text-muted-foreground/65":"font-medium text-foreground/85"),children:c}),s.length>1?v("span",{className:"shrink-0 text-muted-foreground/50 tabular-nums",children:[i,"/",s.length]}):null]}),r?l("div",{className:"mt-0.5 space-y-px pl-6",children:s.map(m=>v("div",{className:"flex items-baseline gap-2 text-ui-sm",children:[l("span",{className:V("w-3 shrink-0 text-center font-mono text-chat-meta",m.status==="completed"?"text-success":m.status==="inProgress"?"text-primary":"text-muted-foreground/40"),"aria-hidden":!0,children:m.status==="completed"?"\u2713":m.status==="inProgress"?"\u25CF":"\u25CB"}),l("span",{className:V("min-w-0",m.status==="completed"?"text-muted-foreground/55":m.status==="inProgress"?"text-foreground/90":"text-muted-foreground/70"),children:m.step})]},m.step))}):null]})});$();var JU=e=>{let{latestTurn:t,latestReplyAt:o,continuationCheck:n}=e.getMeta().status;return n!=null?null:o||(t?.state==="completed"?t.completedAt:null)},ZU=e=>e.getMeta().status.latestAssistantMessageId??null,e$=e=>e.getMeta().finalAssistantMessageReceived,QI=pe(function({rowsStore:t,useVisibleThreadCompletion:o,viewport:n,viewActive:r,threadKey:a,settledView:s,bottomInset:i}){let d=Wt(t,JU),c=Wt(t,ZU),u=Wt(t,e$);return o({viewport:n,viewActive:r,threadKey:a,completedAt:s&&u?d:null,messageId:c,bottomInset:i}),null});$();var t$=[];function o$(){let e=Nt().i18n.usePluginTranslation();return R(t=>{let o=t.attachment;return o===void 0?t.text:o.count===1?o.name:e("forkRelations.attachmentPreview",o)},[e])}function XI({rowsStore:e,derive:t,paneVisible:o,routeThreadKey:n}){let r=R(u=>o?YT(u,t):t$,[t,o]),a=Wt(e,r,JT),s=E(a);s.current=a;let i=$e(n,null,{namespace:"timeline-active-header"}),d=a.at(-1)??null,c=o$();return{turnHeaders:a,turnHeadersRef:s,activeTurnHeaderKeyRef:i,initialTurnHeader:d,headerLabel:c,hasTurnHeaders:d!==null,pinnedTurnHeaderRef:E(null),pinnedTurnHeaderTextRef:E(null)}}function YI({turnHeadersRef:e,activeTurnHeaderKeyRef:t,pinnedTurnHeaderRef:o,pinnedTurnHeaderTextRef:n,headerLabel:r,jumpToTurnSection:a}){let s=E(!1),i=R(()=>{let f=t.current;return f===null?void 0:e.current.find(g=>g.sectionKey===f)},[t,e]),d=R(()=>{let f=o.current;if(!f)return;let g=i();f.dataset.visible=g!==void 0&&(g.inherited||s.current)?"true":"false"},[i,o]),c=R(()=>{let f=i();f&&n.current&&(n.current.textContent=r(f)),d()},[i,d,r,n]),u=R(f=>{f===null||f===t.current||(t.current=f,c())},[t,c]),m=R(f=>{s.current=f,d()},[d]),p=R(()=>{let f=i();f&&a({anchorRowId:f.anchorRowId})},[i,a]);return{applyActiveSection:u,applyActiveStartHidden:m,jumpToActiveTurn:p,writeActiveHeader:c}}function JI({paneVisible:e,turnHeaders:t,writeActiveHeader:o}){fe(()=>{e&&o()},[e,t,o])}$();function n$(e,t,o){let n=o-t;if(Math.abs(n)<1)return null;let r=Math.max(0,Math.min(e.scrollHeight-e.clientHeight,e.scrollTop+n));return Math.abs(r-e.scrollTop)<1?null:r}function ZI(e){let{viewport:t,anchor:o,row:n,scrollToOffset:r}=e,a=o.getBoundingClientRect().top,s=!0,i=null,d=()=>{if(i=null,!s||!o.isConnected||!t.contains(o))return;let m=n$(t,a,o.getBoundingClientRect().top);m!==null&&r(m),a=o.getBoundingClientRect().top},c=()=>{s&&i===null&&(i=requestAnimationFrame(d))},u=typeof ResizeObserver>"u"?null:new ResizeObserver(c);return u?.observe(n),c(),{schedule:c,stop:()=>{s=!1,u?.disconnect(),i!==null&&cancelAnimationFrame(i),i=null}}}function eS(e){return Ge(e,!1,{namespace:"timeline-disclosure-reading"})}function tS({routeThreadKey:e,listRef:t,liveFollowEnabled:o,onDisclosureNavigation:n,rowsStore:r,setDisclosureReading:a}){let s=Xo(e,null),i=Xo(e,null),d=Xo(e,null);H(()=>()=>{i.current?.stop()},[]);let c=R(()=>{i.current?.stop(),i.current=null,s.current=null,a(!1)},[s,i,a]),u=R(f=>{n(),s.current=f,a(!0),i.current?.stop();let g=t.current?.node??null;if(!g)return;let h=Array.from(g.querySelectorAll("[data-timeline-row-id]")).find(x=>x.dataset.timelineRowId===f);if(!h)return;let y=d.current;i.current=ZI({viewport:g,row:h,anchor:y&&h.contains(y)?y:h,scrollToOffset:x=>{g.scrollTop=x}})},[n]),m=$e(e,o,{namespace:"timeline-live-follow-previous"});fe(()=>{o&&!m.current&&c(),m.current=o},[o,c]);let p=R(f=>{let g=r.getRows().find(h=>h.id===f||h.kind==="work"&&h.groupedEntries.some(y=>y.id===f)||h.kind==="tool-group"&&h.entries.some(y=>y.id===f));u(g?.id??f)},[r,u]);return{disclosureButtonRef:d,releaseDisclosureAnchor:c,onProcessDisclosureChange:p}}$();var dh=1e4;function oS({routeThreadKey:e,routeThreadKeyRef:t,pagingBlockedRef:o,pagingBlockedByInteraction:n,loadEarlier:r,loadLater:a,hasHiddenOlder:s,visibleTurnSections:i,capturePrependAnchor:d,revealWindowRef:c,pendingNetworkPrependRef:u,turnSectionsRef:m}){let p=R(()=>{d(),c.current.revealOlder()},[d]),f=E(p);f.current=p;let g=E(s);g.current=s;let h=E(null),y=R(()=>{if(o.current||t.current!==e||r===null||r.loading)return;let C=i[0]?.key;C!==void 0&&(d(C),u.current={firstMountedSectionKey:C,loadingObserved:!1,sectionsWhileLoading:m.current,until:Date.now()+dh},r.onLoadEarlier())},[d,r,u,e,i]);h.current=r===null||r.loading||n?null:y;let x=R(()=>{o.current||t.current!==e||(d(),a?.onLoadLater())},[d,a,e]);return{revealOlderTurns:p,revealOlderTurnsRef:f,hasHiddenOlderRef:g,loadEarlierRef:h,handleLoadEarlier:y,handleLoadLater:x}}$();$();var Ya=3,ch=Ya;function nS(e){let[t,o]=Ge(e,Ya,{namespace:"timeline-reveal-window"}),n=R(()=>{o(i=>i+ch)},[o]),r=R(i=>{o(d=>i>d?i:d)},[o]),a=R(()=>{o(Ya)},[o]),s=R(i=>{o(d=>Math.min(d,Math.max(Ya,i)))},[o]);return{revealedCount:t,revealOlder:n,revealAtLeast:r,compactTo:s,reset:a}}$();function aS(e){return e!==null&&"tagName"in e&&"closest"in e}function er(e){return aS(e)?e.tagName==="INPUT"||e.tagName==="TEXTAREA"?!0:e.closest('[contenteditable]:not([contenteditable="false"])')!==null:!1}function sS(e){return aS(e)&&e.closest('button, a[href], summary, [role="button"], [role="menuitem"]')!==null}function Hd(e,t){if(!/^[1-9]$/.test(e))return null;let o=Number(e)-1;return o<t?o:null}function rS(e,t){let o=e.findIndex(n=>n.decision===t);return o===-1?null:{type:"respond",index:o}}function iS(e,t){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return null;switch(e.key){case"Enter":return rS(t,"accept");case"Escape":return rS(t,"cancel");case"ArrowDown":case"ArrowRight":return{type:"move",delta:1};case"ArrowUp":case"ArrowLeft":return{type:"move",delta:-1};default:{let o=Hd(e.key,t.length);return o===null?null:{type:"respond",index:o}}}}var Ci="h-4 min-w-3 bg-transparent px-0 text-ui-xs tabular-nums text-current opacity-70 pointer-coarse:hidden";var Ud=600;function uh(e,t){if(typeof Element>"u"||!(e instanceof Element))return!1;if(t===null||!t.contains(e))return!0;for(let o=e;o&&o!==t;){if(o instanceof HTMLElement&&o.scrollHeight>o.clientHeight&&o.scrollTop>0)return!0;o=o.parentElement}return!1}function lS({routeThreadKey:e,routeThreadKeyRef:t,paneVisibleRef:o,pagingBlockedRef:n,scrollRestorePendingRef:r,listRef:a,topRevealArmedRef:s,hasHiddenOlderRef:i,revealOlderTurnsRef:d,loadEarlierRef:c,networkPrependAwaitingUserNavigationRef:u,networkPrependScrollTopRef:m,topRevealTouchStartYRef:p,topRevealUserNavigationFrameRef:f}){let g=R(C=>{if(C>Ud){s.current=!0;return}if(s.current){if(s.current=!1,i.current){d.current();return}c.current?.()}},[s]),h=R(()=>{u.current&&(u.current=!1,m.current=null,s.current=!0)},[u,m,s]),y=R(()=>{if(f.current!==null||n.current||!o.current||t.current!==e||r.current)return!1;let C=a.current?.measure();return!C||C.scroll>2||C.contentLength-C.scrollLength-C.scroll<=2||!i.current&&c.current===null?!1:(u.current=!1,m.current=null,s.current=!0,f.current=requestAnimationFrame(()=>{f.current=null}),g(C.scroll),!0)},[g,u,m,e,r,s,f]);return{maybeRevealOlderOnScroll:g,rearmNetworkPrependForUserNavigation:h,continueTopRevealAtTopForUserNavigation:y,contentGestureHandlers:{onWheel:C=>{C.defaultPrevented||C.deltaY>=0||er(C.target)||uh(C.target,a.current?.node??null)||y()},onTouchStartCapture:C=>{p.current=C.touches[0]?.clientY??null},onTouchMove:C=>{let b=C.touches[0],L=p.current;C.defaultPrevented||er(C.target)||uh(C.target,a.current?.node??null)||b===void 0||L===null||b.clientY<=L||y()&&(p.current=null)},onTouchEndCapture:()=>{p.current=null},onTouchCancelCapture:()=>{p.current=null},onKeyDown:C=>{C.defaultPrevented||C.repeat||C.metaKey||C.ctrlKey||C.altKey||C.shiftKey||er(C.target)||uh(C.target,a.current?.node??null)||!["ArrowUp","PageUp","Home"].includes(C.key)||y()}}}}function dS({paneVisible:e,paneVisibleRef:t,loadLater:o,liveFollowEnabled:n,disclosureReading:r,restoreInProgress:a,loadEarlier:s,scrollNode:i,revealWindow:d,turnSections:c,followEnabledRef:u,compactionStateRef:m,compactionRef:p,prependAnchorRef:f,interactionRowsRef:g,revealWindowRef:h,topRevealArmedRef:y,capturePrependAnchor:x}){let C=e&&o===null&&n&&!r&&!a;return u.current=C,m.current={followEnabled:C,restoreInProgress:a,loadEarlier:s},H(()=>{if(!i||!e)return;let b=dw({root:i,minimumCount:Ya,keepAbovePx:Ud,canCompact:()=>{let L=m.current,w=f.current;return L.followEnabled&&g.current.length===0&&!L.restoreInProgress&&!L.loadEarlier?.loading&&!(w&&w.until>Date.now())&&h.current.revealedCount>Ya},onCompact:L=>{y.current=!0,x(),h.current.compactTo(L)}});return p.current=b,()=>{b.disconnect(),p.current=null}},[x,e,i]),H(()=>{p.current?.schedule()},[C,s?.loading,d.revealedCount,c.length]),H(()=>{if(!i||!e||typeof ResizeObserver>"u")return;let b=()=>{if(!t.current||!u.current)return;let k=i.scrollHeight-i.clientHeight;Math.abs(i.scrollTop-k)>.5&&(i.scrollTop=k)},L=new ResizeObserver(b);L.observe(i);let w=i.firstElementChild;return w&&L.observe(w),()=>L.disconnect()},[e,i]),{followEnabled:C}}$();function cS({hasHiddenOlder:e,loadEarlier:t,pagingBlockedByInteraction:o,topFadeEnabled:n,revealOlderTurns:r,handleLoadEarlier:a}){return W(()=>e?l(pI,{onReveal:r,fade:n}):t!==null?l(cI,{loading:t.loading,blocked:o,onLoadEarlier:a,fade:n}):n?dI:lI,[a,e,t,o,r,n])}$();$();function uS(e,t,o){let n=$e(e,o,{namespace:"timeline-last-requested-reveal"});return fe(()=>{n.current=o}),t&&o>=n.current}function pS(e,t,o,n){if(t<e.revealedCount)e.compactTo(t);else{if(t<=e.revealedCount)return;o?requestAnimationFrame(()=>setTimeout(()=>{n()&&e.revealAtLeast(t)},0)):e.revealAtLeast(t)}}function mS(e,t){return t.prefixMounted?"mounted":t.loading===null||t.now>e.until?"abandoned":t.loading?(e.loadingObserved=!0,e.sectionsWhileLoading=t.sections,"waiting"):e.loadingObserved?t.sections===e.sectionsWhileLoading?"waiting":"landed":"waiting"}var r$=new Set;function fS({routeThreadKey:e,routeThreadKeyRef:t,paneVisible:o,paneVisibleRef:n,listRef:r,scrollSnapshotRef:a,structure:s,loadLater:i,loadEarlier:d,liveFollowEnabled:c,disclosureReading:u,nativeSelectionRef:m,interactionRowsRef:p}){let f=s.sections,g=nS(e),h=E(g);h.current=g;let y=$e(e,!0,{namespace:"timeline-top-reveal-armed"}),x=$e(e,!1,{namespace:"timeline-network-prepend-awaiting-navigation"}),C=E(null),b=E(null);fe(()=>()=>{b.current!==null&&(cancelAnimationFrame(b.current),b.current=null)},[e,o]);let L=$e(e,null,{namespace:"timeline-network-prepend-scroll-top"}),w=$e(e,r$,{namespace:"timeline-mounted-section-keys",limit:3}),k=Xo(e,null),I=k.current,T=I===null?-1:f.findIndex(F=>F.key===I.firstMountedSectionKey),S=T>0?f.length-Math.max(0,T-ch):g.revealedCount,P=T>0?S:g.revealedCount,A=i!==null||!c||u||m.current||p.current.length>0,N=uS(e,c,P),B=rw(f.map(F=>F.key),w.current,P,A||N),{startIndex:O,hasHiddenOlder:j}=gw(f.length,B),U=W(()=>f.slice(O),[O,f]),D=I!==null&&T>0&&O<T,J=E(f);J.current=f,fe(()=>{if(!o)return;if(w.current=new Set(U.map(ee=>ee.key)),I!==null){let ee=mS(I,{prefixMounted:D,loading:d===null?null:d.loading,sections:f,now:Date.now()});ee!=="waiting"&&(k.current=null),ee==="mounted"&&(x.current=!0)}let F=e;pS(h.current,B,!A,()=>t.current===F)},[x,d,o,I,D,k,w,A,B,e,f,U]);let G=Xo(e,null),M=R((F=null)=>{if(!n.current)return;let ee=r.current?.node;ee&&(G.current={scrollHeight:ee.scrollHeight,scrollTop:ee.scrollTop,row:r.current?.measure()?.rowAtScroll()??null,firstMountedSectionKey:F,until:Date.now()+dh})},[G]),X=R(()=>{let F=G.current;if(F===null||F.firstMountedSectionKey===null||Date.now()>F.until)return;let ee=r.current?.node;if(!ee)return;let Y=a.current;F.scrollHeight=ee.scrollHeight,F.scrollTop=ee.scrollTop,F.row=Y?.threadKey===e?Y.anchor:null},[G,e,a]);return fe(()=>{if(!o)return;let F=G.current;if(!F)return;if(Date.now()>F.until){G.current=null;return}if(F.firstMountedSectionKey!==null&&k.current!==null)return;G.current=null;let ee=r.current?.node;if(ee){if(F.row){xp(ee,F.row.rowId);let Y=r.current?.measure()?.topOf(F.row.rowId);Y!=null&&(ee.scrollTop=Y+F.row.offsetPx)}else ee.scrollTop=F.scrollTop+(ee.scrollHeight-F.scrollHeight);D&&(L.current=ee.scrollTop)}},[L,o,I,D,O,s]),{revealWindow:g,revealWindowRef:h,topRevealArmedRef:y,networkPrependAwaitingUserNavigationRef:x,topRevealTouchStartYRef:C,topRevealUserNavigationFrameRef:b,networkPrependScrollTopRef:L,pendingNetworkPrependRef:k,hasHiddenOlder:j,visibleTurnSections:U,turnSectionsRef:J,prependAnchorRef:G,capturePrependAnchor:M,refreshPendingPrependAnchor:X}}$();function a$(e,t){let o=c=>c.replace(/\s+/g,""),n=o(t.text);if(n.length===0)return null;let r=(c,u)=>e.slice(Math.max(0,c-t.prefix.length),c)===t.prefix&&e.slice(u,u+t.suffix.length)===t.suffix;if(t.start<t.end&&t.end<=e.length&&o(e.slice(t.start,t.end))===n&&r(t.start,t.end))return{start:t.start,end:t.end};let a=Sd(t.text).trim(),s=[];for(let c=e.indexOf(a);c>=0;c=e.indexOf(a,c+1))s.push(c);let i=s.filter(c=>r(c,c+a.length)),d=i.length===1?i[0]:i.length===0&&s.length===1?s[0]:null;return d===null?null:{start:d,end:d+a.length}}function hS(e,t){let o=e.querySelector("[data-assistant-quote-body]")??Qu(e);if(o===null)return null;let n=[],r="",a=document.createTreeWalker(o,NodeFilter.SHOW_TEXT);for(let u=a.nextNode();u;u=a.nextNode()){let m=u.data;for(let p=0;p<m.length;p+=1){let f=/\s/.test(m[p]);f&&r.endsWith(" ")||(r+=f?" ":m[p],n.push({node:u,offset:p}))}}let s=a$(r,t);if(s===null)return null;let i=n[s.start],d=n[s.end-1];if(!i||!d)return null;let c=document.createRange();return c.setStart(i.node,i.offset),c.setEnd(d.node,d.offset+1),c}var ph="assistant-quote",gS=2400;function yS(e){let t=globalThis.CSS?.highlights,o=globalThis.Highlight;if(t&&o){let r=new o(e);t.set(ph,r),setTimeout(()=>{t.get(ph)===r&&t.delete(ph)},gS);return}let n=document.getSelection();n&&(n.removeAllRanges(),n.addRange(e),setTimeout(()=>{let r=n.rangeCount>0?n.getRangeAt(0):null;r&&r.compareBoundaryPoints(Range.START_TO_START,e)===0&&n.removeAllRanges()},gS))}var s$=20;function vS({routeThreadKey:e,routeThreadKeyRef:t,paneVisible:o,derive:n,rowsStore:r,structure:a,loadEarlier:s,loadEarlierRef:i,listRef:d,revealWindowRef:c,turnSectionsRef:u,scrollToRowWithRevealRef:m,onManualNavigation:p,releaseDisclosureAnchor:f,revealMessageRequest:g,onRevealMessageHandled:h,revealQuoteRequest:y,onRevealQuoteDone:x,messageReveal:C=null,onMessageRevealMissing:b,loadLater:L=null,onReturnToLatest:w,restoringHistory:k=!1,pagingBlockedByInteraction:I=!1,revealTurnRequest:T}){let S=E(!0);H(()=>(S.current=!0,()=>{S.current=!1}),[]);let P=E(o);P.current=o;let A=E(C?.request?.id??null);A.current=C?.request?.id??null;let N=E(null);H(()=>{let U=C?.request;if(!U||!C||!o)return;N.current?.id!==U.id&&(N.current={id:U.id,prepared:!1,latestRequested:!1,done:!1});let D=N.current;if(D.done)return;let G=r.getRows().some(X=>X.id===U.messageId);if(!D.prepared){if(C.pending||k||s?.loading||L?.loading||I)return;if(!G&&L!==null&&!C.unavailable){D.latestRequested||(D.latestRequested=!0,w?.());return}D.prepared=!0}let M=C.advance({found:G,ready:!C.pending&&!k,loading:s?.loading===!0,blocked:I,hasEarlier:!C.unavailable&&s!==null,windowKey:a.rowIds[0]??"empty"});if(M!=="wait"){if(f(),p(),M==="earlier"){i.current?.();return}if(D.done=!0,M==="missing"){b?.(),C.onHandled(U.id);return}c.current.revealAtLeast(ja(u.current,U.messageId,c.current.revealedCount)),requestAnimationFrame(()=>{if(S.current&&!(t.current!==e||N.current!==D)){if(!P.current||A.current!==U.id){D.done=!1;return}m.current(U.messageId,24),C.onHandled(U.id)}})}},[C,o,a,s,L,k,I,w,r,e,p,f,b]);let B=R(U=>{f(),p(),c.current.revealAtLeast(ja(u.current,U.anchorRowId,c.current.revealedCount));let D=e;requestAnimationFrame(()=>{t.current===D&&m.current(U.anchorRowId,24)})},[p,f,e]),O=E(void 0);H(()=>{if(!o||!T||O.current===T)return;let D=a.sections.find(J=>J.turnId===T.turnId)?.rowIds[0];D&&(O.current=T,B({anchorRowId:D}),T.onHandled?.())},[o,T,a,B]),H(()=>{if(g===null||!o)return;f(),p();let U=n.resolveToolGroupRevealRowId(r.getRows(),g.rowId);c.current.revealAtLeast(ja(u.current,U,c.current.revealedCount));let D=requestAnimationFrame(()=>{t.current===e&&(m.current(U,24),h?.())});return()=>cancelAnimationFrame(D)},[g,o,p,f,h,n,e,r]);let j=E(null);return H(()=>{if(y===null||!o)return;let U=j.current;if((U===null||U.request!==y)&&(U={request:y,pages:0,done:!1},j.current=U),U.done)return;let{quote:D}=y,J=D.messageId;if(!r.getRows().some(G=>G.id===J)){if(s?.loading)return;let G=i.current;if(G!==null&&U.pages<s$){U.pages+=1,G();return}U.done=!0,x?.("message-missing");return}U.done=!0,f(),p(),c.current.revealAtLeast(ja(u.current,J,c.current.revealedCount)),requestAnimationFrame(()=>{t.current===e&&(m.current(J,24),requestAnimationFrame(()=>{let G=d.current?.node?.querySelector(`[data-timeline-row-id="${CSS.escape(J)}"]`),M=G?hS(G,D):null,X=d.current?.node;if(M&&X){let F=M.getBoundingClientRect().top-X.getBoundingClientRect().top-X.clientHeight/3;d.current?.scrollToOffset(X.scrollTop+F)}M&&yS(M),x?.(M?"found":"passage-missing")}))})},[y,o,a,s,r,x,p,f,e]),{jumpToTurnSection:B}}$();function CS({timestampFormat:e,routeThreadKey:t,threadRef:o,markdownCwd:n,resolvedTheme:r,workspaceRoot:a,skills:s,environmentId:i,onForkFromUserMessage:d,onRestoreUnsentMessage:c,selfUserId:u,ownsUnsignedMessages:m,onImageExpand:p,onAttachmentDocumentOpen:f,onOpenFileDiff:g,onProcessDisclosureChange:h,agentPanelModel:y,onOpenAgents:x,onInterrupt:C,stopping:b,onRespondToDecision:L,scheduledWakes:w,onCancelScheduledWake:k,derive:I,SiteIcon:T,threadReferences:S,renderWorkGroup:P,renderToolCallDetail:A,onSavePlanToWorkspace:N,declaredToolTitles:B,toolPresentation:O,ToolSourceIcon:j,SessionMessageCard:U}){let D=W(()=>cp(s),[s]);return W(()=>({timestampFormat:e,threadKey:t,threadRef:o,markdownCwd:n,resolvedTheme:r,workspaceRoot:a,skills:s,skillIndex:D,activeThreadEnvironmentId:i,onForkFromUserMessage:d,onRestoreUnsentMessage:c,selfUserId:u,ownsUnsignedMessages:m,onImageExpand:p,onAttachmentDocumentOpen:f,onOpenFileDiff:g,onProcessDisclosureChange:h,agentPanelModel:y,onOpenAgents:x,onInterrupt:C,stopping:b,onRespondToDecision:L,scheduledWakes:w,onCancelScheduledWake:k,derive:I,SiteIcon:T,threadReferences:S,renderWorkGroup:P,renderToolCallDetail:A,onSavePlanToWorkspace:N,declaredToolTitles:B,toolPresentation:O,ToolSourceIcon:j,SessionMessageCard:U}),[e,t,o,n,r,a,s,D,i,d,c,u,m,p,f,g,h,y,x,C,b,L,w,k,I,T,S,P,A,N,B,O,j,U])}$();var i$=200;function xS({routeThreadKey:e,routeThreadKeyRef:t,paneVisible:o,paneVisibleRef:n,listRef:r,derive:a,contentInsetEndAdjustment:s,onIsAtEndChange:i,loadLater:d,restoreInProgress:c,rowCount:u,followingEndRef:m,scrollRestorePendingRef:p,laterLoadArmedRef:f,pagingBlockedRef:g,lastScrollAnchorSaveAtRef:h,networkPrependAwaitingUserNavigationRef:y,networkPrependScrollTopRef:x,cacheScrollSnapshot:C,persistScrollSnapshot:b,refreshPendingPrependAnchor:L,maybeRevealOlderOnScroll:w,rearmNetworkPrependForUserNavigation:k,handleLoadLater:I}){let T=R(()=>{if(!n.current||t.current!==e)return;let S=r.current?.measure();if(!S||p.current)return;C(S);let P=x.current;y.current&&P!==null&&Math.abs(S.scroll-P)>.5&&k(),L();let A=a.resolveIsAtEnd({contentLength:S.contentLength,scroll:S.scroll,scrollLength:S.scrollLength},s);A!==void 0&&i(d===null&&A);let N=S.contentLength-S.scrollLength-S.scroll;!m.current&&N>2&&w(S.scroll),N>Ud?f.current=!0:f.current&&d&&!d.loading&&!g.current&&(f.current=!1,I());let B=Date.now();B-h.current>=i$&&(h.current=B,b())},[C,s,a,w,i,b,L,e,d,f,I,y,x,k,p]);return H(()=>{if(!o)return;let S=requestAnimationFrame(T);return()=>cancelAnimationFrame(S)},[T,o,c,u]),{handleScroll:T}}$();function bS({routeThreadKey:e,routeThreadKeyRef:t,paneVisible:o,paneVisibleRef:n,revealRequestRef:r,listRef:a,scrollSnapshotRef:s,rowCount:i,structure:d,loadScrollAnchor:c,loadLater:u,restoringHistory:m,onManualNavigation:p,onIsAtEndChange:f,revealWindowRef:g,turnSectionsRef:h,followingEndRef:y,followEnabledRef:x,compactionStateRef:C,scrollRestorePendingRef:b,persistScrollSnapshot:L,captureFinalScrollSnapshot:w}){let k=$e(e,"cold",{namespace:"timeline-scroll-restore"});if(k.current===void 0||k.current==="cold"){let O=c(e);k.current=k.current==="cold"&&O===null?null:{anchor:O}}let[,I]=Na(O=>O+1,0),T=E(()=>{}),S=E(w);S.current=w;let P=$e(e,0,{namespace:"timeline-last-anchor-save"}),A=m||k.current!==null,N=k.current;b.current=A,fe(()=>{if(o)return()=>{t.current!==e?L():w(),k.current=void 0}},[o,e]),fe(()=>{if(!o||N==null)return;let O=N,j=()=>{let X=s.current,F=a.current?.node?.clientWidth;X?.threadKey===e&&F!==void 0&&(s.current={...X,viewportWidth:F}),k.current=null,b.current=!1,I()};if(r.current!==null){j();return}let U=null,D=null,J=()=>{!n.current||t.current!==e||(a.current?.scrollToEnd(),j(),y.current=u===null,x.current=u===null,C.current={...C.current,followEnabled:!0,restoreInProgress:!1},f(u===null))},G=O.anchor,M=G!==null&&h.current.some(X=>X.rowIds.includes(G.rowId));return G===null?U=requestAnimationFrame(J):M?U=requestAnimationFrame(()=>{!n.current||t.current!==e||(p(),g.current.revealAtLeast(ja(h.current,G.rowId,g.current.revealedCount)),D=requestAnimationFrame(()=>{!n.current||t.current!==e||(T.current(G.rowId,-G.offsetPx),j())}))}):i>0&&!m&&(U=requestAnimationFrame(J)),()=>{U!==null&&cancelAnimationFrame(U),D!==null&&cancelAnimationFrame(D)}},[c,u,f,p,o,N,e,i,m,d]),fe(()=>{if(!o||typeof ResizeObserver>"u")return;let O=a.current?.node;if(!O)return;let j=!0,U=O.clientWidth,D=new ResizeObserver(()=>{if(!j||!n.current||t.current!==e)return;let J=O.clientWidth;if(!(J>0)||J===U)return;U=J;let G=s.current;G===null||G.threadKey!==e||(s.current={...G,viewportWidth:J},!(b.current||y.current||G.anchor===null)&&(T.current(G.anchor.rowId,-G.anchor.offsetPx),S.current()))});return D.observe(O),()=>{j=!1,D.disconnect()}},[o,e]);let B=R((O,j)=>{if(!n.current)return;let U=a.current?.node;U&&(xp(U,O),a.current?.scrollToRow(O,{viewOffset:j}))},[]);return T.current=B,{restoreInProgress:A,lastScrollAnchorSaveAtRef:P,scrollToRowWithRevealRef:T}}$();function wS({routeThreadKey:e,listRef:t,followingEndRef:o,scrollRestorePendingRef:n,paneVisible:r,rowCount:a,derive:s,contentInsetEndAdjustment:i,saveScrollAnchor:d}){let c=$e(e,null,{namespace:"timeline-scroll-snapshot"}),u=$e(e,null,{namespace:"timeline-last-measured-scroll"}),m=R((g,h=o.current)=>{if(g.scrollLength<=0)return;let y=t.current?.node?.clientWidth,x=c.current;y!==void 0&&y>0&&x?.viewportWidth!==void 0&&x.viewportWidth>0&&y!==x.viewportWidth||(u.current=g.scroll,c.current={threadKey:e,anchor:aI({measurement:g,followingEnd:h}),...y===void 0?{}:{viewportWidth:y}})},[o,u,t,e,c]),p=R(()=>{let g=c.current;g&&d(g.threadKey,g.anchor)},[d,c]),f=R(()=>{if(!r||n.current)return;if(a===0){p();return}let g=t.current?.measure();if(g&&g.scrollLength>0){let h=u.current,y=h!==null&&Math.abs(g.scroll-h)>.5;m(g,o.current&&!(y&&s.resolveIsAtEnd(g,i)===!1)),p()}},[m,i,s,o,u,r,p,n,a]);return{scrollSnapshotRef:c,cacheScrollSnapshot:m,persistScrollSnapshot:p,captureFinalScrollSnapshot:f}}var mh="ycodium-select-all-copy";$();function l$(e,t){let o=e.detail;o===null||typeof o!="object"||!("text"in o)||(o.text=t)}function d$(e,t){let o=n=>{l$(n,t())};return e.addEventListener(mh,o),()=>e.removeEventListener(mh,o)}function TS({rowsStore:e}){let t=E(e);t.current=e;let o=E(null);return H(()=>{let n=o.current?.closest("[data-select-all-scope]");if(n!=null)return d$(n,()=>t.current.getMeta().exportApi.markdown())},[]),l("span",{ref:o,hidden:!0})}var IS=[],SS=()=>{},kS=()=>{};var LS=pe(function({derive:t,rowsStore:o,data:n,target:r,threadKey:a,threadRef:s,environmentId:i,onInterrupt:d=null,stopping:c=!1,onRespondToDecision:u=null,onCancelScheduledWake:m=null,agentPanelModel:p,onOpenAgents:f=SS,onOpenFileDiff:g,onForkFromUserMessage:h,onRestoreUnsentMessage:y=null,selfUserId:x=null,ownsUnsignedMessages:C=!0,onImageExpand:b,onAttachmentDocumentOpen:L,revealTurnRequest:w,markdownCwd:k,resolvedTheme:I,timestampFormat:T,workspaceRoot:S,skills:P=IS,onRowsChange:A,contentInsetEndAdjustment:N,liveFollowEnabled:B,awaitingUserDecision:O=!1,onIsAtEndChange:j,onManualNavigation:U,onDisclosureNavigation:D=U,topFadeEnabled:J=!1,scrollerRef:G,loadEarlier:M=null,loadLater:X=null,restoringHistory:F=!1,pagingBlockedByInteraction:ee=!1,onReturnToLatest:Y=null,onVisibleTurnRangeChange:ae=null,revealMessageRequest:te=null,messageReveal:de=null,onMessageRevealMissing:ge,onRevealMessageHandled:ne,revealQuoteRequest:Z=null,onRevealQuoteDone:ve,renderWorkGroup:he,renderToolCallDetail:Ae,loadScrollAnchor:De,saveScrollAnchor:je,useVisibleThreadCompletion:ot,onSavePlanToWorkspace:me,paneActive:Me,onTurnNavigatorChange:ue,declaredToolTitles:ce,threadSwitchStage:Ze=null}){let pt=Wt(o,fI),ze=Cn(),et=E(ze);et.current=ze;let Et=E(te);Et.current=te;let[ft,Ct]=eS(a),gt=E(a);gt.current=a;let Dt=E(ee);Dt.current=ee;let Mt=$e(a,!0,{namespace:"timeline-following-end"});Mt.current=X===null&&B;let se=$e(a,!1,{namespace:"timeline-scroll-restore-pending"}),Le=$e(a,N,{namespace:"timeline-content-inset"}),be=E(null),Xe=Xo(a,[]),xt=Xo(a,!1),tt=E(null),It=E(null),po=R(()=>Xe.current,[Xe]),Ko=R(ht=>{Xe.current=ht,tt.current?.(),It.current?.schedule()},[Xe]),Qt=R(ht=>{xt.current=ht,It.current?.schedule()},[xt]),hn=R(ht=>{ht!==null&&(be.current=ht),G(ht)},[G]);fe(()=>{nI({timeline:be.current,previousOverlayHeight:Le.current,overlayHeight:N,followingEnd:ze&&X===null&&B&&!ft}),Le.current=N},[N,ft,B,X,ze]);let{disclosureButtonRef:At,releaseDisclosureAnchor:St,onProcessDisclosureChange:bt}=tS({routeThreadKey:a,listRef:be,liveFollowEnabled:B,onDisclosureNavigation:D,rowsStore:o,setDisclosureReading:Ct}),mo=gI(X!==null,ze),kt=tp(o),_t=kt.sections,Xt=kt.rowIds.length,nt=W(()=>si(o),[kt,o]),{scrollSnapshotRef:lt,cacheScrollSnapshot:Bt,persistScrollSnapshot:Ht,captureFinalScrollSnapshot:Yt}=wS({routeThreadKey:a,listRef:be,followingEndRef:Mt,scrollRestorePendingRef:se,paneVisible:ze,rowCount:Xt,derive:t,contentInsetEndAdjustment:N,saveScrollAnchor:je}),{revealWindow:qo,revealWindowRef:fo,topRevealArmedRef:go,networkPrependAwaitingUserNavigationRef:Jt,topRevealTouchStartYRef:Un,topRevealUserNavigationFrameRef:Ce,networkPrependScrollTopRef:Ue,pendingNetworkPrependRef:rt,hasHiddenOlder:Lt,visibleTurnSections:wt,turnSectionsRef:Ot,prependAnchorRef:Ro,capturePrependAnchor:nn,refreshPendingPrependAnchor:Fr}=fS({routeThreadKey:a,routeThreadKeyRef:gt,paneVisible:ze,paneVisibleRef:et,listRef:be,scrollSnapshotRef:lt,structure:kt,loadLater:X,loadEarlier:M,liveFollowEnabled:B,disclosureReading:ft,nativeSelectionRef:xt,interactionRowsRef:Xe}),{revealOlderTurns:ka,revealOlderTurnsRef:As,hasHiddenOlderRef:dg,loadEarlierRef:ru,handleLoadEarlier:cg,handleLoadLater:au}=oS({routeThreadKey:a,routeThreadKeyRef:gt,pagingBlockedRef:Dt,pagingBlockedByInteraction:ee,loadEarlier:M,loadLater:X,hasHiddenOlder:Lt,visibleTurnSections:wt,capturePrependAnchor:nn,revealWindowRef:fo,pendingNetworkPrependRef:rt,turnSectionsRef:Ot}),bl=E(!1),wl=E({followEnabled:!1,restoreInProgress:!1,loadEarlier:M}),{restoreInProgress:yn,lastScrollAnchorSaveAtRef:ug,scrollToRowWithRevealRef:Tl}=bS({routeThreadKey:a,routeThreadKeyRef:gt,paneVisible:ze,paneVisibleRef:et,revealRequestRef:Et,listRef:be,scrollSnapshotRef:lt,rowCount:Xt,structure:kt,loadScrollAnchor:De,loadLater:X,restoringHistory:F,onManualNavigation:U,onIsAtEndChange:j,revealWindowRef:fo,turnSectionsRef:Ot,followingEndRef:Mt,followEnabledRef:bl,compactionStateRef:wl,scrollRestorePendingRef:se,persistScrollSnapshot:Ht,captureFinalScrollSnapshot:Yt}),{jumpToTurnSection:Il}=vS({routeThreadKey:a,routeThreadKeyRef:gt,paneVisible:ze,derive:t,rowsStore:o,structure:kt,loadEarlier:M,loadEarlierRef:ru,listRef:be,revealWindowRef:fo,turnSectionsRef:Ot,scrollToRowWithRevealRef:Tl,onManualNavigation:U,releaseDisclosureAnchor:St,revealMessageRequest:te,messageReveal:de,onMessageRevealMissing:ge,loadLater:X,onReturnToLatest:Y,restoringHistory:yn||Ze!==null,pagingBlockedByInteraction:ee,onRevealMessageHandled:ne,revealQuoteRequest:Z,onRevealQuoteDone:ve,revealTurnRequest:w}),{turnHeaders:su,turnHeadersRef:pg,activeTurnHeaderKeyRef:iu,initialTurnHeader:lu,headerLabel:du,hasTurnHeaders:mg,pinnedTurnHeaderRef:Sl,pinnedTurnHeaderTextRef:$n}=XI({rowsStore:o,derive:t,paneVisible:ze,routeThreadKey:a}),[cu,Ns]=q(null),[kl,Ds]=q(null),{followEnabled:fg}=dS({paneVisible:ze,paneVisibleRef:et,loadLater:X,liveFollowEnabled:B,disclosureReading:ft,restoreInProgress:yn,loadEarlier:M,scrollNode:kl,revealWindow:qo,turnSections:_t,followEnabledRef:bl,compactionStateRef:wl,compactionRef:It,prependAnchorRef:Ro,interactionRowsRef:Xe,revealWindowRef:fo,topRevealArmedRef:go,capturePrependAnchor:nn}),uu=kt.rowIds.at(-1)??null;H(()=>{A?.(uu)},[uu,A,a]);let Ll=$e(a,!0,{namespace:"timeline-later-load-armed"}),{maybeRevealOlderOnScroll:Pl,rearmNetworkPrependForUserNavigation:pu,continueTopRevealAtTopForUserNavigation:mu,contentGestureHandlers:gg}=lS({routeThreadKey:a,routeThreadKeyRef:gt,paneVisibleRef:et,pagingBlockedRef:Dt,scrollRestorePendingRef:se,listRef:be,topRevealArmedRef:go,hasHiddenOlderRef:dg,revealOlderTurnsRef:As,loadEarlierRef:ru,networkPrependAwaitingUserNavigationRef:Jt,networkPrependScrollTopRef:Ue,topRevealTouchStartYRef:Un,topRevealUserNavigationFrameRef:Ce}),{applyActiveSection:fu,applyActiveStartHidden:_s,jumpToActiveTurn:gu,writeActiveHeader:hu}=YI({turnHeadersRef:pg,activeTurnHeaderKeyRef:iu,pinnedTurnHeaderRef:Sl,pinnedTurnHeaderTextRef:$n,headerLabel:du,jumpToTurnSection:Il}),La=cw({root:kl,topInsetPx:Zg,onActiveSectionChange:fu,onActiveStartHiddenChange:_s,active:ze}),Pa=W(()=>nw(_t),[_t]),hg=iw({root:kl,inputKey:a,visible:ze,index:Pa,topInset:mg?Zg:0,bottomInset:N,interactionRows:po,onRangeChange:ae,onSelectionChange:Qt});tt.current=hg,H(()=>{if(!ze){Ht();return}let ht=requestAnimationFrame(()=>{if(!et.current)return;let Fs=be.current?.node;Fs&&bl.current&&(Fs.scrollTop=Fs.scrollHeight-Fs.clientHeight),La.refresh()});return()=>cancelAnimationFrame(ht)},[Ht,La,ze]),JI({paneVisible:ze,turnHeaders:su,writeActiveHeader:hu});let Os=cS({hasHiddenOlder:Lt,loadEarlier:M,pagingBlockedByInteraction:ee,topFadeEnabled:J,revealOlderTurns:ka,handleLoadEarlier:cg}),{handleScroll:yu}=xS({routeThreadKey:a,routeThreadKeyRef:gt,paneVisible:ze,paneVisibleRef:et,listRef:be,derive:t,contentInsetEndAdjustment:N,onIsAtEndChange:j,loadLater:X,restoreInProgress:yn,rowCount:Xt,followingEndRef:Mt,scrollRestorePendingRef:se,laterLoadArmedRef:Ll,pagingBlockedRef:Dt,lastScrollAnchorSaveAtRef:ug,networkPrependAwaitingUserNavigationRef:Jt,networkPrependScrollTopRef:Ue,cacheScrollSnapshot:Bt,persistScrollSnapshot:Ht,refreshPendingPrependAnchor:Fr,maybeRevealOlderOnScroll:Pl,rearmNetworkPrependForUserNavigation:pu,handleLoadLater:au}),vu=n.useToolPresentation??kS,Ra=CS({timestampFormat:T,routeThreadKey:a,threadRef:s,markdownCwd:k,resolvedTheme:I,workspaceRoot:S,skills:P,environmentId:i,onForkFromUserMessage:h,onRestoreUnsentMessage:y,selfUserId:x,ownsUnsignedMessages:C,onImageExpand:b,onAttachmentDocumentOpen:L,onOpenFileDiff:g,onProcessDisclosureChange:bt,agentPanelModel:p,onOpenAgents:f,onInterrupt:d,stopping:c,onRespondToDecision:u,scheduledWakes:pt,onCancelScheduledWake:m,derive:t,SiteIcon:n.SiteIcon,toolPresentation:vu(r),ToolSourceIcon:n.ToolSourceIcon,SessionMessageCard:n.SessionMessageCard,threadReferences:n.threadReferences,renderWorkGroup:he,renderToolCallDetail:Ae,onSavePlanToWorkspace:me,declaredToolTitles:ce}),yg=R(ht=>l(VI,{rowsStore:o,rowId:ht}),[o]);return l(_w,{data:n,target:r,children:l(Fe,{value:Ra,children:v(sI,{rowsStore:o,historyWindow:mo,children:[l(tI,{rowsStore:o,derive:t,paneVisible:ze,bottomInset:N,onSelect:Il,onTurnNavigatorChange:ue}),l(QI,{rowsStore:o,useVisibleThreadCompletion:ot,viewport:cu,viewActive:Me&&ze,threadKey:a,settledView:X===null&&!yn,bottomInset:N}),v("div",{ref:Ns,onClickCapture:ht=>{At.current=ht.target instanceof Element?ht.target.closest("button"):null},onWheelCapture:St,onTouchMoveCapture:St,onPointerDownCapture:ht=>{ht.target===be.current?.node&&(St(),mu())},onKeyDownCapture:ht=>{["ArrowUp","ArrowDown","PageUp","PageDown","Home","End"].includes(ht.key)&&St()},className:"chat-timeline relative h-full min-h-0",inert:Ze!==null,"aria-busy":Ze!==null?!0:void 0,"data-timeline-switch-hold":Ze??void 0,"data-awaiting-user-decision":O?"true":"false","data-disclosure-reading":ft?"true":void 0,"data-timeline-follow-end":fg?"true":"false","data-timeline-end-inset":N,children:[l(sw,{inputKey:a,onBeforeInputChange:Yt,handleRef:hn,onAttach:Ds,onInteractionRowsChange:Ko,onScroll:yu,className:V("scrollbar-gutter-both h-full min-h-0 overflow-y-auto overflow-x-hidden overscroll-y-contain px-3 sm:px-5",J&&"topbar-scroll-fade"),children:v("div",{"data-select-all-scope":"",style:{paddingBottom:N},...gg,children:[l(TS,{rowsStore:o}),Os,wt.map(ht=>l(lw,{sectionKey:ht.key,rowKeyPrefix:a,rowIds:ht.rowIds,renderRow:yg,sectionRef:La.observeSection(ht.key)},`${a}:${ht.key}`)),X?l(uI,{loading:X.loading,blocked:ee,onLoadLater:au,onReturnToLatest:Y}):null,mI]})}),Ze==="covered"?l(th,{}):nt?null:l(iI,{data:n,target:r}),lu!==null?l(qT,{ref:Sl,textRef:$n,initialText:du(lu),onJump:gu}):null]})]})})})});$();function PS(e){let[t,o]=q(null),n=E(null),r=t!==null&&t.toKey===e.threadKey?t:null;if(r===null&&!si(e.rowsStore)){let c=n.current;t!==null&&t.stage==="covered"?r={toKey:e.threadKey,stage:"covered"}:c!==null&&c.threadKey!==e.threadKey&&si(c.rowsStore)&&(r={toKey:e.threadKey,stage:"held",props:c})}r!==t&&o(r);let a=r!==null&&r.stage==="held"?r:null,s=a===null?e:a.props;fe(()=>{n.current=s});let i=R(()=>o(c=>c===null||c.stage!=="held"?c:{toKey:c.toKey,stage:"covered"}),[]),d=R(()=>o(c=>c===null||c.stage==="released"?c:{toKey:c.toKey,stage:"released"}),[]);return{props:s,stage:r===null||r.stage==="released"?null:r.stage,onSkeleton:i,onRelease:d}}function RS(e){let{onSkeleton:t,onRelease:o}=e,n=e.data.useThreadSyncPhase(e.target);tp(e.rowsStore);let r=n!=="loading"||si(e.rowsStore);return fe(()=>{r&&o()},[r,o]),H(()=>{if(r)return;let a=globalThis.setTimeout(t,wp);return()=>globalThis.clearTimeout(a)},[r,t]),null}$();var c$=new Set;function ES({data:e,target:t,threadKey:o,visible:n,rowsStore:r,derive:a,resolveModelBadge:s,disclosure:i,historyWindow:d}){let c=e.useChatTimeline({target:t,threadKey:o,visible:n}),u=e.useTurnStatus({target:t,threadKey:o,visible:n}),m=Cn(),p=i.usePersistedExpandedTurnIds(o),[f,g]=Ge(o,c$,{namespace:"timeline-auto-expanded-turns"}),h=W(()=>a.resolveExpandedTurnIds(p??[],f),[f,a,p]),{latestTurn:y}=u,x=$e(o,y,{namespace:"timeline-latest-turn-previous"});H(()=>{let b=x.current;if(x.current=y,!(!y||b?.turnId===void 0)){if(y.turnId===b.turnId){b.state==="running"&&y.state==="interrupted"&&g(L=>{let w=new Set(L);return w.add(y.turnId),w});return}g(L=>{if(!L.has(b.turnId))return L;let w=new Set(L);return w.delete(b.turnId),w})}},[y]);let C=W(()=>({derive:a,timelineEntries:c.timelineEntries,activities:c.activities,turnSummaries:c.turnSummaries,status:u,expandedTurnIds:h,resolveModelBadge:s,historyWindow:d,usageByTurnId:c.usageByTurnId,exportApi:c.export}),[c.activities,c.export,c.timelineEntries,c.turnSummaries,c.usageByTurnId,a,h,d,s,u]);return(m||!r.hasInputs())&&r.setInputs(C),fe(()=>{r.flush()}),null}var MS=pe(function({data:t,target:o,threadKey:n,visible:r,...a}){let s=$e(n,null,{namespace:"timeline-rows-store",limit:3});s.current??=hw();let i=s.current,d=PS({...a,threadKey:n,rowsStore:i,data:t,target:o});return v(oe,{children:[l(ES,{data:t,target:o,threadKey:n,visible:r,rowsStore:i,derive:a.derive,resolveModelBadge:a.resolveModelBadge,disclosure:a.disclosure,historyWindow:(a.loadLater??null)!==null}),l(LS,{...d.props,threadSwitchStage:d.stage}),d.stage===null?null:l(RS,{data:t,target:o,rowsStore:i,onSkeleton:d.onSkeleton,onRelease:d.onRelease},n)]})});function AS({phase:e}){let{t}=z(),o=t(bp(e));return v("div",{"aria-label":o,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:[l(qr,{"aria-hidden":!0,className:"size-icon-2 shrink-0 text-muted-foreground"}),l("span",{className:"truncate",children:o})]})}function NS({data:e,target:t,bottomInset:o,showScrollToEnd:n,onScrollToEnd:r}){let{t:a}=z(),s=Tp(e.useThreadSyncPhase(t));return s===null&&!n?null:v("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:o+4},children:[s!==null?l(AS,{phase:s}):null,n?v(K,{onClick:r,className:"pointer-events-auto gap-1.5 rounded-full px-3 text-muted-foreground hover:text-foreground",size:"xs",variant:"glass",children:[l(Tt,{}),a("timeline.scrollToEnd")]}):null]})}$();function DS(){let e=!1;return{lock:()=>{e=!0},resume:()=>{e=!1},navigate:t=>!t||!e?!1:(e=!1,!0),isLocked:()=>e}}function _S(e){return e.requestedGeneration===e.currentGeneration&&e.mode==="following-end"&&!e.readingLocked}var u$=150,p$=16;function OS(e,t){typeof e=="function"?e(t):e&&(e.current=t)}function FS({inputKey:e,visible:t,endInset:o,derive:n,onReturnToLatest:r,controlRef:a}){let[s,i]=Ge(e,!0,{namespace:"timeline-live-follow-enabled"}),[d,c]=Ge(e,!1,{namespace:"timeline-show-scroll-to-end"}),u=Xo(e,null),[m,p]=Xb(e,null),f=R(F=>{u.current=F;let ee=F?.node??null;p(Y=>Y===ee?Y:ee)},[u,p]),g=$e(e,!0,{namespace:"timeline-is-at-end"}),h=Xo(e,null),y=R(()=>{h.current!==null&&clearTimeout(h.current),h.current=null},[h]),x=R(()=>{y(),h.current=setTimeout(()=>{h.current=null,c(!0)},u$)},[y,c,h]);H(()=>y,[y]);let C=R(()=>{let F=u.current?.measure();return F==null?void 0:{contentLength:F.contentLength,scroll:F.scroll,scrollLength:F.scrollLength}},[u]),b=$e(e,"following-end",{namespace:"timeline-scroll-mode"}),L=Zr(t);fe(()=>()=>L.cancel(),[L,e]);let w=$e(e,0,{namespace:"timeline-user-scroll-generation"}),k=$e(e,0,{namespace:"timeline-live-follow-generation"}),I=$e(e,DS,{namespace:"timeline-disclosure-reading-lock"}),T=$e(e,null,{namespace:"timeline-last-row-id"}),S=R(()=>{L.cancel(),w.current+=1,b.current="free-scrolling",k.current=null,i(!1)},[L,k,b,i,w]),P=R(()=>{I.current.lock(),S(),g.current=!1,y(),c(!0)},[y,g,S,I,c]),A=E(S);A.current=S;let N=R(()=>{let F=u.current?.measure(),ee=T.current;if(!F||ee===null)return!1;let Y=rI(F,ee);return Y===null?!1:Y>Math.max(0,F.scrollLength-o-p$)},[o,u,T]),B=R(F=>{I.current.resume();let ee=++w.current;g.current=!0,b.current="following-end",k.current=w.current,i(!0),y(),c(!1),L.request(()=>{_S({requestedGeneration:ee,currentGeneration:w.current,mode:b.current,readingLocked:I.current.isLocked()})&&u.current?.scrollToEnd({animated:F})})},[y,L,u,g,k,I,b,i,c,w]),O=E(r);O.current=r;let j=R((F=!1)=>{let ee=O.current;if(ee){ee(()=>B(F));return}B(F)},[B]),U=R(()=>j(!0),[j]),D=R(()=>{I.current.navigate(!0)&&(g.current=!1,n.resolveIsAtEnd(C(),o)===!0&&j())},[n,o,g,C,I,j]);H(()=>{if(!t||m===null)return;let F=null,ee=requestAnimationFrame(()=>{let Y=()=>{A.current()},ae=ue=>{let ce=ue instanceof Element?ue:null;for(;ce&&ce!==m;){if(ce instanceof HTMLElement&&ce.scrollHeight>ce.clientHeight+1&&ce.scrollTop+ce.clientHeight<ce.scrollHeight-1&&/auto|scroll/u.test(getComputedStyle(ce).overflowY))return!1;ce=ce.parentElement}return ce===m},te=ue=>{I.current.isLocked()&&ae(ue)&&D()},de=null,ge=!1,ne=m.scrollTop,Z=ue=>{de=ue.touches[0]?.clientY??null},ve=()=>{de=null,ge=!1},he=()=>{let ue=m.scrollTop;ge&&ue>ne&&te(m),ne=ue},Ae=()=>N(),De=()=>n.resolveIsAtEnd(C(),o)===!1,je=ue=>{ue.deltaY>0&&te(ue.target),ue.deltaY<0&&Ae()&&Y()},ot=ue=>{let ce=ue.touches[0]?.clientY??null,Ze=de!==null&&ce!==null&&ce<de;de=ce,De()&&Y(),Ze&&te(ue.target)},me=ue=>{if(ue.target===m){ge=!0,ne=m.scrollTop,Ae()&&Y();return}De()&&Y()},Me=ue=>{if(!(ue.target instanceof Element?ue.target:null)?.closest("input, textarea, select, [contenteditable='true'], button, [role='button']"))switch(ue.key){case"PageUp":case"Home":case"ArrowUp":Ae()&&Y();break;case"PageDown":case"End":case"ArrowDown":te(ue.target);break;case" ":ue.shiftKey||te(ue.target);break;default:break}};m.addEventListener("wheel",je,{passive:!0}),m.addEventListener("touchmove",ot,{passive:!0}),m.addEventListener("touchstart",Z,{passive:!0}),m.addEventListener("touchend",ve,{passive:!0}),m.addEventListener("touchcancel",ve,{passive:!0}),m.addEventListener("scroll",he,{passive:!0}),window.addEventListener("pointerup",ve,{passive:!0}),window.addEventListener("pointercancel",ve,{passive:!0}),m.addEventListener("pointerdown",me,{passive:!0}),m.addEventListener("keydown",Me),F=()=>{m.removeEventListener("wheel",je),m.removeEventListener("touchmove",ot),m.removeEventListener("touchstart",Z),m.removeEventListener("touchend",ve),m.removeEventListener("touchcancel",ve),m.removeEventListener("scroll",he),window.removeEventListener("pointerup",ve),window.removeEventListener("pointercancel",ve),m.removeEventListener("pointerdown",me),m.removeEventListener("keydown",Me)}});return()=>{cancelAnimationFrame(ee),F?.()}},[N,n,o,e,C,I,D,m,t]);let J=R(F=>{T.current=F},[T]),G=R(F=>{if(I.current.isLocked()){g.current=!1,y(),c(!0);return}if(!F&&k.current===w.current){y(),c(!1);return}g.current!==F&&(g.current=F,F?(b.current="following-end",k.current=w.current,i(!0),y(),c(!1)):(b.current="free-scrolling",k.current=null,x()))},[y,g,k,I,x,b,i,c,w]),M=E(j);M.current=j;let X=W(()=>({followEnd:F=>M.current(F?.animated??!1)}),[]);return fe(()=>(OS(a,X),()=>OS(a,null)),[X,a]),{liveFollowEnabled:s,showScrollToEnd:d,bindTimelineHandle:f,onRowsChange:J,onIsAtEndChange:G,onManualNavigation:S,onDisclosureNavigation:P,returnToEnd:U}}$();$();$();var BS=pe(function({group:t,expanded:o,onToggle:n,disabled:r,highlighted:a,callCounts:s,sourceFiltered:i=!1,...d}){let{t:c}=z(),u=t.items.flatMap(p=>p.kind==="step"?[p.row]:p.rows).find(p=>p.kind==="user-message"),m=t.summary?.state;return l(Gr,{value:t.id,children:l(Jr,{"data-trajectory-row-id":t.id,"data-timeline-row-id":t.id,"data-turn-group-header":t.turnId??"unassigned",tabIndex:-1,className:V("bg-muted/25 hover:bg-muted/25",a&&"outline-2 outline-primary"),children:v(bn,{colSpan:6,className:"whitespace-normal px-2 py-2",children:[v("div",{className:"flex min-w-0 items-start gap-2",children:[v(K,{variant:"ghost",size:"sm",className:"h-auto min-w-0 flex-1 justify-start px-1 py-1 text-left whitespace-normal",disabled:r,"aria-expanded":o,onClick:()=>n(t.id),title:c(o?"turnOverview.collapseTurn":"turnOverview.expandTurn"),children:[o?l(Tt,{className:"size-4 shrink-0","aria-hidden":!0}):l(yo,{className:"size-4 shrink-0","aria-hidden":!0}),l("span",{className:"min-w-0",children:u?.summary||c(t.turnId===null?"turnOverview.unassigned":"turnOverview.turn")})]}),t.summary?l(ju,{summary:t.summary}):null,m==="error"||m==="interrupted"?l("span",{className:"shrink-0 py-1 text-xs text-destructive-foreground",children:c(m==="error"?"trajectory.status.failed":"trajectory.status.stopped")}):null]}),v("div",{className:"flex flex-wrap gap-x-3 gap-y-1 pl-5 text-xs text-muted-foreground","data-trajectory-call-counts":!0,children:[s?v(oe,{children:[l("span",{children:i?c("trajectory.sourceFilter.matchedCalls",{matched:s.matchedCalls,total:s.totalCalls}):c("trajectory.sourceFilter.totalCalls",{count:s.totalCalls})}),l("span",{children:i?c("trajectory.sourceFilter.matchedFailedCalls",{count:s.matchedFailedCalls}):c("trajectory.sourceFilter.failedCalls",{count:s.failedCalls})})]}):null,i?l("span",{children:c("trajectory.sourceFilter.hiddenSteps")}):null]}),t.summary?l("div",{className:"pl-5",children:l(Gu,{summary:t.summary,...d})}):null]})})})});function HS({id:e,count:t,expanded:o,onToggle:n,disabled:r}){let{t:a}=z();return l(Jr,{"data-trajectory-row-id":e,"data-timeline-row-id":e,tabIndex:-1,"data-routine-group":e,children:l(bn,{colSpan:6,className:"px-3 py-1",children:v(K,{variant:"ghost",size:"xs","aria-expanded":o,disabled:r,onClick:n,children:[o?l(Tt,{"aria-hidden":!0}):l(yo,{"aria-hidden":!0}),a("turnOverview.routineSteps",{count:t})]})})})}$();$();var fh="max-h-80 overflow-auto rounded-md bg-muted/40 p-3 font-mono text-xs break-words whitespace-pre-wrap";function $S({useToolCallDetail:e,threadRef:t,toolCallId:o,turnId:n,fallback:r,revision:a,rewritten:s}){let{t:i}=z(),[d,c]=q(!1),u=e===void 0?null:e({threadRef:t,toolCallId:o,turnId:n??null,revision:a??r??"initial",...d?{original:!0}:{}}),m=u===null?[]:[u.input,u.output].filter(f=>f!==void 0&&f.length>0),p=u?.input!==void 0&&u?.output!==void 0?m.join(`
3536
+ ${vT}`,tU=new RegExp(`^${hp}\\n<preset-prefix id="([^"]*)">\\n([\\s\\S]*?)\\n</preset-prefix>\\n${vT}(?:\\n\\n([\\s\\S]*))?$`),TT=e=>{if(e.split(wT).length!==2)return null;let t=tU.exec(e);if(t===null)return null;let[,o,n,r]=t;return o?{presetId:o,prefix:n??"",body:r??""}:null},IT=e=>Xa(e)?TT(e)?.body||null:e,oU=["work","check-in","instructions","notice","continue"];var nU=new RegExp(`${Xg}<plugin-wake plugin="([^"]+)" reason="([^"]+)"(?: item="([^"]+)")?(?: round="(\\d+)" limit="(\\d+)")? ${bT}>\\n([\\s\\S]*?)\\n</plugin-wake>`),ST=e=>{let t=nU.exec(e);if(t===null)return null;let[,o,n,r,a,s,i]=t;if(!o||!n)return null;let d=oU.find(c=>c===Nd(n));return{pluginId:Nd(o),reason:d??"notice",...r?{item:Nd(r)}:{},...d==="continue"&&a&&s?{continuation:{round:Number(a),limit:Number(s),body:Nd(i??"")}}:{}}},kT=e=>{switch(e.reason){case"work":return e.item===void 0?{key:"work"}:{key:"workItem",item:e.item};case"check-in":return{key:"checkIn"};case"instructions":return{key:"instructions"};case"notice":return{key:"notice"};case"continue":return e.continuation===void 0?{key:"notice"}:{key:"continue",round:e.continuation.round,limit:e.continuation.limit}}};$();function LT({wake:e,blockKey:t}){let{t:o}=Ne(),{activeThreadEnvironmentId:n,threadKey:r}=xe(Fe),a=kT(e),[s,i]=$t(r,`plugin-wake:${t}`,!1),d=e.continuation?.body;return v("div",{className:"flex flex-col items-center gap-1 py-1","data-plugin-wake":e.pluginId,children:[v("p",{className:"flex max-w-[80%] flex-wrap items-center justify-center gap-x-1.5 text-center text-chat-row text-muted-foreground",children:[l(Mo,{environmentId:n,pluginId:e.pluginId}),l("span",{children:o(`pluginWake.${a.key}`,{item:a.item,round:a.round,limit:a.limit})}),d!==void 0&&d.length>0?l(K,{type:"button",variant:"link",size:"xs","aria-expanded":s,onClick:()=>i(!s),children:o(s?"pluginWake.hideReceived":"pluginWake.showReceived")}):null]}),s&&d!==void 0?l("p",{className:"max-w-[80%] whitespace-pre-wrap rounded-lg border border-border/60 bg-muted/30 px-3 py-2 text-chat-row text-muted-foreground",children:d}):null]})}function PT({row:e}){let{t}=Ne(),{activeThreadEnvironmentId:o}=xe(Fe),n=t("turnContinuation.nameSeparator");return v("p",{className:"flex flex-wrap items-center gap-x-1 px-1 pb-2 pt-1 text-chat-row text-muted-foreground","data-testid":"continuation-check-row",children:[e.pluginIds.map((r,a)=>v("span",{className:"inline-flex items-center",children:[a>0?n:null,l(Mo,{environmentId:o,pluginId:r})]},r)),l("span",{children:t("turnContinuation.checking")})]})}var rU=new RegExp(`${Xg}<plugin-instruction>\\n([\\s\\S]*?)\\n<\\/plugin-instruction>`);function RT(e){let t=e.match(rU)?.[1];if(t===void 0)return null;try{let o=JSON.parse(t);if(o===null||typeof o!="object"||Array.isArray(o))return null;let n=o;return typeof n.pluginId!="string"||typeof n.title!="string"||typeof n.body!="string"?null:{pluginId:n.pluginId,title:n.title,body:n.body}}catch{return null}}$();var ET=window.__ycodiumPluginHost.modules?.["@ycodium-ai/plugin-api"];if(!ET)throw new Error("This plugin needs a newer Ycodium app. Update the app.");var{COMMUNICATION_RECORDS_READ_LIMIT:WZ,HOST_TEAM_VIEW_PREFIX:GZ,MAX_PLUGIN_SESSION_PROJECTION_BYTES:jZ,MAX_PLUGIN_SKILL_COMPANION_FILE_BYTES:VZ,MAX_PLUGIN_SKILL_COMPANION_TOTAL_BYTES:QZ,MAX_PLUGIN_STREAM_BUFFER:XZ,MAX_PLUGIN_TOOL_PRESENTATION_BYTES:YZ,MAX_PLUGIN_WORKSPACE_WRITE_BYTES:JZ,MEMBER_INSTRUCTIONS_MAX_BYTES:ZZ,MEMBER_NAME_MAX:eee,MEMBER_RESPONSIBILITY_MAX:tee,MEMBER_TITLE_MAX:oee,MIN_PLUGIN_INTERVAL_MS:nee,PLUGIN_API_MIN_VERSION:ree,PLUGIN_API_VERSION:aee,PLUGIN_PROXY_DIRECT:see,PluginSignInRequiredError:iee,PluginSignInUnavailableError:lee,REASONING_OPTION_LABEL:dee,REQUEST_RESOLVED_TRIGGER_KIND:cee,TEAM_VIEW_KEY_PATTERN:uee,THREAD_ACTIVITIES_LIST_LIMIT:pee,THREAD_MESSAGES_LIST_LIMIT:mee,TOOL_LIFECYCLE_ACTIVITY_KINDS:fee,TURN_PROGRESS_TRIGGER_KIND:gee,USER_INPUT_PENDING_TRIGGER_KIND:hee,acceptPluginToolPresentation:yee,definePlugin:vee,defineTeamView:Cee,effortText:MT,findReasoningEffortDescriptor:xee,getDisplayModelName:bee,getTriggerDisplayModelName:AT,hasModelTraitControls:NT,holdKeyedSubscriber:wee,isProviderSelectionAvailable:_d,isReadOnlyModelChoice:DT,isReasoningEffortOptionId:Tee,isTeamViewKey:Iee,isThreadNotFound:See,isWithinProviderSelectionLock:yp,knownEffortLevel:kee,mergeLaunchEnv:Lee,modelCatalogNoticeOf:Pee,modelChoiceTraitDescriptors:_T,modelOptionLabelKind:Ree,modelOptionTitle:OT,modelOptionsAfterChange:Eee,modelSelectionStringOption:Mee,modelTraitDescriptors:Aee,nearestEffortLevel:Nee,parseRetryAfterMs:Dee,pluginJsonByteLength:_ee,projectOrNull:Oee,readRequestResolved:Fee,readThreadFailed:Bee,readTurnProgress:Hee,readUserInputPending:Uee,reasoningEffortLevel:FT,reasoningEffortShortLabel:$ee,relabelModelOptionDescriptors:zee,resolveModelChoice:Kee,resolveModelOptions:qee,resolveProviderDriverKindForInstanceSelection:BT,sortProviderInstanceEntries:HT,threadMessagesNewestFirst:Wee,threadOrNull:Gee}=ET;var aU={effort:"traits.savedOption.effort",reasoningEffort:"traits.savedOption.reasoningEffort",variant:"traits.savedOption.variant",fastMode:"traits.savedOption.fastMode",agent:"traits.savedOption.agent",serviceTier:"traits.savedOption.serviceTier"},sU=e=>`traits.optionValue.${e}`;function UT(e,t){return OT(t,o=>e(aU[o]))}function Yg(e,t){return t.effortDisplayKind==="standard-tier"?e("traits.standardTier"):MT(t,o=>e(sU(o)))}function gi({badge:e,compact:t=!1}){let{t:o}=Ne(),n=Yg(o,e);return v(oe,{children:[e.driverKind?l("span",{className:t?"flex size-5 shrink-0 items-center justify-center":"flex size-7 shrink-0 items-center justify-center rounded-lg border border-border/60 bg-card","aria-label":e.providerDisplayName??void 0,children:l(js,{driver:e.driverKind,displayName:e.providerDisplayName,accentColor:e.accentColor,className:"size-5",iconClassName:"size-4"})}):null,v("span",{className:"flex min-w-0 flex-wrap items-baseline gap-x-2 gap-y-0.5",children:[e.driverKind?l("span",{className:"font-medium text-foreground",children:e.providerDisplayName}):null,t?l("span",{className:"min-w-0 truncate text-muted-foreground",children:e.modelLabel}):l(rp,{text:e.modelLabel,label:o("copyButton.copyModelName"),children:l("span",{className:"min-w-0 truncate text-muted-foreground",children:e.modelLabel})}),n?v(oe,{children:[" ",l("span",{children:n})]}):null]})]})}function $T({badge:e,createdAt:t}){let o=xe(Fe),{t:n}=Ne();return v("div",{className:"mb-3 flex min-w-0 select-none flex-wrap items-center gap-x-2.5 gap-y-1 text-chat-dense text-muted-foreground","data-testid":"assistant-model-header",children:[l(gi,{badge:e})," ",v(Pe,{children:[l(Ee,{render:l("span",{className:"shrink-0 tabular-nums"}),children:Jn(t,o.timestampFormat,n)}),l(Re,{children:wn(t,o.timestampFormat,n)})]})]})}function Jg({row:e}){let{t}=Ne(),o=Yg(t,e.badge),n=o?`${e.badge.modelLabel} (${o})`:e.badge.modelLabel,r=[e.badge.providerDisplayName,n].filter(s=>typeof s=="string"&&s.length>0).join(" "),a=e.pending?t("timeline.modelSwitchPending",{model:r}):t("timeline.modelSwitched",{model:r});return v("div",{role:"separator","aria-label":a,"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:[l("span",{"aria-hidden":!0,className:"h-px min-w-4 flex-1 bg-border/60"}),v("span",{className:"flex min-w-0 shrink items-center gap-1.5",children:[e.badge.driverKind?l(js,{driver:e.badge.driverKind,displayName:e.badge.providerDisplayName,accentColor:e.badge.accentColor,className:"size-icon-1",iconClassName:"size-icon-1"}):null,l("span",{className:"truncate",children:a})]}),l("span",{"aria-hidden":!0,className:"h-px min-w-4 flex-1 bg-border/60"})]})}function Cp({row:e}){let t=xe(Fe).derive;if(e.message.rewrite){let o=t.parsePresetPrefixText(e.message.rewrite.original);return o?v(oe,{children:[l(zT,{parsed:o}),l(Cp,{row:{...e,message:{...e.message,rewrite:{...e.message.rewrite,original:o.body}}}})]}):l(Qg,{row:e,text:e.message.rewrite.original})}if(Xa(e.message.text)){let o=t.parsePresetPrefixText(e.message.text);return o?v(oe,{children:[l(zT,{parsed:o}),o.body.length>0||(e.message.attachments?.length??0)>0?l(Cp,{row:{...e,message:{...e.message,text:o.body}}}):null]}):l(dU,{row:e})}return l(Qg,{row:e,text:e.message.text})}var iU={"child.settled":{tone:"success",label:"childThread.state.settled"},"child.failed":{tone:"error",label:"childThread.state.failed"},"child.approval":{tone:"attention",label:"childThread.state.approval"},"child.question":{tone:"attention",label:"childThread.state.question"},"child.stopped":{tone:"neutral",label:"childThread.state.stopped"},"child.resolved":{tone:"success",label:"childThread.state.resolved"}};function vp({children:e}){return l("div",{className:"flex justify-center py-1",children:l("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 zT({parsed:e}){let{t}=Ne();return v(vp,{children:[l("p",{className:"font-medium text-foreground/80",children:t("preset.systemBlockTitle",{name:e.presetId})}),e.prefix.trim().length>0?l("p",{className:"mt-1 whitespace-pre-wrap",children:e.prefix}):null]})}var lU={"child.settled":"childThread.notification.settled","child.failed":"childThread.notification.failed","child.approval":"childThread.notification.approval","child.question":"childThread.notification.question","child.stopped":"childThread.notification.stopped","child.resolved":"childThread.notification.resolved","plugin.notice":"childThread.notification.pluginNotice","selfdev.resolved":"childThread.notification.selfdevResolved","cookie-import.resolved":"childThread.notification.cookieImportResolved"};function dU({row:e}){let{t}=Ne(),o=Nt(),{derive:n,activeThreadEnvironmentId:r}=xe(Fe),a=xe(Fe).SessionMessageCard,s=e.message.attachments??[],i=s.filter(m=>Cr(m)),d=s.filter(m=>!Cr(m)),c=(m,p)=>{let f=ST(m);if(f)return l(LT,{wake:f,blockKey:`${e.message.id}:${p}`});let g=RT(m);if(g)return v(vp,{children:[l("p",{className:"font-medium text-foreground/80",children:g.title}),g.body.length>0?l("p",{className:"mt-1 whitespace-pre-wrap",children:g.body}):null]});let h=n.parseThreadHandoverText(m);if(h)return v(vp,{children:[l("p",{className:"font-medium text-foreground/80",children:t("continuation.systemBlockTitle")}),l("p",{className:"mt-1",children:t("continuation.systemBlockTurns",{count:h.includedTurns})}),l("p",{className:"mt-1 whitespace-pre-wrap",children:h.body})]});let y=n.parseSystemNotificationText(m);if(!y||y.recordId!==void 0)return null;let x=y.childThreadId&&n.notificationOpensChildThread(y.kind),C=()=>{y.childThreadId!==void 0&&o.openThread({environmentId:r,threadId:y.childThreadId})},b=iU[y.kind];if(a!==void 0&&b!==void 0&&y.childThreadId){let w=[y.kind==="child.resolved"&&y.resolution!==void 0?t(`childThread.resolution.${y.resolution}`):null,y.summary.trim()].filter(k=>k).join(`
3537
+ `);return l(a,{environmentId:r,threadId:y.childThreadId,fallbackName:y.title,status:{tone:b.tone,label:t(b.label)},text:w.length>0?w:t(b.label),action:x?{label:t("childThread.open"),onPress:C}:void 0})}return v(vp,{children:[l("p",{className:"font-medium text-foreground/80",children:t(lU[y.kind],{title:y.title})}),y.kind==="child.resolved"&&y.resolution!==void 0?l("p",{className:"mt-1",children:t(`childThread.resolution.${y.resolution}`)}):null,y.summary.trim().length>0?l("p",{className:"mt-1 whitespace-pre-wrap",children:y.summary}):null,x?l(K,{type:"button",size:"xs",variant:"outline",className:"relative mt-2 pointer-coarse:after:absolute pointer-coarse:after:inset-0 pointer-coarse:after:min-h-11",onClick:C,children:t("childThread.open")}):null]})},u=xT(e.message.text).map(c).filter(m=>m!==null);return u.length===0&&s.length===0?null:v(oe,{children:[u.map((m,p)=>l(Aa,{children:m},p)),s.length>0?v("div",{className:"min-w-0 px-3 py-2",children:[l(Pd,{images:i}),d.map(m=>l(Rd,{attachment:m},m.id))]}):null]})}function KT(e,t){let o=t.parsePresetPrefixText(e??"")?.body??null;if(o===null&&Xa(e??""))return null;let r=ui(o??e??"").visibleText;for(;;){let i=pi(r);if(!i.annotation)break;r=i.promptText}let a=Qa(r).promptText,s=mi(a).map(i=>i.kind==="text"?t.messageLinksToPreviewText(i.text):i.comment.text).join(" ").replace(/\s+/g," ").trim();return s.length>0?s:null}var qT=30,WT=8,Zg=qT+WT,GT=pe(function({ref:t,textRef:o,initialText:n,onJump:r}){let{t:a}=Ne(),s=a("timeline.pinnedTurnHeaderJump");return l("div",{ref:t,className:"pointer-events-none absolute inset-x-0 top-0 z-10 px-3 data-[visible=false]:hidden sm:px-5","data-timeline-turn-header":"true","data-visible":"false",children:l("div",{className:"transcript-col-wide",style:{paddingTop:WT},children:l("div",{className:"rounded-control-3 bg-background",children:v(K,{type:"button",variant:"outline",size:"sm",title:s,onClick:r,className:"pointer-events-auto w-full min-w-0 justify-start gap-2 bg-background px-2.5 text-xs font-normal text-muted-foreground shadow-xs hover:text-foreground",style:{height:qT},children:[l(_l,{"aria-hidden":!0,className:"size-icon-2 shrink-0"}),l("span",{className:"sr-only",children:s}),l("span",{ref:o,className:"min-w-0 flex-1 truncate text-left",children:n})]})})})})});function jT({row:e}){let t=xe(Fe),{t:o}=Ne(),[n,r]=$t(t.threadKey,`message:${e.message.id}`,!1);if(e.message.text.trim().length===0&&(e.message.attachments?.length??0)>0)return l(qg,{rowId:e.id,messageId:e.message.id,attachments:e.message.attachments},e.message.id);if(e.presentation==="compact"&&!n)return l(Nu,{state:"idle",children:v("button",{type:"button",className:V(li,"chat-process-text cursor-[var(--control-cursor)] text-secondary-label hover:bg-accent/20"),"aria-expanded":!1,"aria-label":o("timeline.expandMessage"),onClick:()=>{t.onProcessDisclosureChange?.(e.id),r(!0)},children:[l(Cd,{status:null}),l(vd,{children:l(hr,{className:"size-icon-1","aria-hidden":!0})}),l("span",{className:"min-w-0 flex-1 truncate",children:t.derive.reasoningPreviewText(e.message.text)}),l(Tt,{className:"size-icon-1 shrink-0 -rotate-90","aria-hidden":!0})]})});let s=e.message.attachments??[],i=e.message.text||(e.message.streaming||s.length>0?"":o("timeline.emptyResponse"));return l(oe,{children:v("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"?v("div",{className:"mb-1 flex items-center gap-2",children:[l("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:o("timeline.collapseMessage")}),e.copyInFooter?null:l(ea,{text:e.message.text,variant:"ghost"})]}):null,e.modelBadge?l($T,{badge:e.modelBadge,createdAt:e.message.createdAt}):null,i.trim().length>0?l("div",{"data-assistant-quote-body":"",children:l(wo,{disclosureKey:`message:${e.message.id}:assistant`,text:i,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(i),skills:t.skills,onImageExpand:t.onImageExpand,artifactTurnId:e.message.turnId})}):null,l(qg,{rowId:e.id,messageId:e.message.id,attachments:s},e.message.id),e.showAssistantMeta||e.showAssistantCopyButton&&!e.assistantCopyStreaming&&e.message.text.trim().length>0?v("div",{className:"mt-1.5 flex select-none 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 [@media(pointer:coarse)]:opacity-100",children:[l(cU,{row:e}),e.showAssistantMeta&&!e.message.streaming&&e.modelBadge===null&&v(Pe,{children:[l(Ee,{render:l("p",{className:"text-muted-foreground text-chat-row tabular-nums"}),children:Jn(e.message.updatedAt,t.timestampFormat,o)}),l(Re,{children:wn(e.message.updatedAt,t.timestampFormat,o)})]})]}):null]})})}function cU({row:e}){let o=xe(Fe).derive.resolveAssistantMessageCopyState({text:e.message.text??null,showCopyButton:e.showAssistantCopyButton,streaming:e.assistantCopyStreaming});return o.visible?l(ea,{text:o.text??"",variant:"ghost"}):null}var eh=240,uU=/\s/u;function VT(e){if(!e)return null;let t=[],o=0,n=!1,r=()=>{for(;o>eh-1;)o-=t.pop()?.length??0;for(;t.at(-1)===" ";)t.pop(),o-=1;return t.push("\u2026"),t.join("")};for(let a of e){if(uU.test(a)){n=t.length>0;continue}if(n&&(t.push(" "),o+=1,n=!1,o>eh)||(t.push(a),o+=a.length,o>eh))return r()}return t.length>0?t.join(""):null}function pU(e,t,o){let n=t.find(p=>p.kind==="message"&&p.message.role==="user"),r=n?.kind==="message"?n.message:null,a=r?.rewrite?.original??r?.text??"",s=null;for(let p of t)p.kind==="message"&&p.message.role==="assistant"&&(s=p.message.text.trim()?p.message.text:(p.message.attachments??[]).map(f=>f.source?._tag==="agent-artifact"&&f.source.title?`${f.name} \u2014 ${f.source.title}`:f.name).join(", "));let i=r?.attachments??[],d=r!==null&&!a.trim()&&i[0]?{name:i[0].name,count:i.length}:void 0,c=r!==null&&Xa(a)&&o.parsePresetPrefixText(a)===null,u=r===null?null:KT(a,o),m=u===null&&!c&&i[0]?{name:i[0].name,count:i.length}:void 0;return{...d===void 0?{}:{attachmentPreview:d},...m===void 0?{}:{headerAttachment:m},...c?{isSystemMessage:!0}:{},id:e,sectionKey:e,anchorRowId:n?.id??t[0]?.id??e,userText:r===null?null:VT(o.parseSystemNotificationText(a)?.summary??o.parseThreadHandoverText(a)?.body??o.messageLinksToPreviewText(o.parsePresetPrefixText(a)?.body??a))??(d===void 0?null:""),assistantText:VT(s),headerText:u}}function mU(e){for(let t of e){let o=t.kind==="message"?t.message.turnId??null:t.kind==="turn-summary"?t.footer.turnId:null;if(o!==null)return o}return null}function fU(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&&e.isSystemMessage===t.isSystemMessage&&e.attachmentPreview?.name===t.attachmentPreview?.name&&e.attachmentPreview?.count===t.attachmentPreview?.count}function gU(e,t,o){for(let n=0;n<e.length;n+=1)if(e[n]!==o[t.firstRowIndex+n])return!1;return!0}function hU(e,t){if(e.length!==t.length)return!1;for(let o=0;o<e.length;o+=1)if(e[o]!==t[o])return!1;return!0}function yU(e){let t=new Map,o=null;return n=>{let r=n.getVersion();if(o!==null&&o.store===n&&o.version===r)return o.entries;let a=new Map,s=[],i=n.getRows();for(let c of n.getStructure().sections){let u=t.get(c.key);if(u!==void 0&&u.rowIds===c.rowIds&&gU(u.rows,c,i)){a.set(c.key,u),s.push(u.entry);continue}let m=i.slice(c.firstRowIndex,c.firstRowIndex+c.rowIds.length),p=pU(c.key,m,e),{headerAttachment:f,...g}=p,h={...g,turnId:mU(m)},y=u?.entry.summary.headerAttachment,x=u!==void 0&&fU(u.entry.item,h)&&y?.name===f?.name&&y?.count===f?.count?u.entry:{summary:p,item:h};a.set(c.key,{rowIds:c.rowIds,rows:m,entry:x}),s.push(x)}t=a;let d=o!==null&&hU(o.entries,s)?o.entries:s;return o={store:n,version:r,entries:d},d}}var QT=new WeakMap;function JT(e,t){let o=QT.get(e);return(o===void 0||o.derive!==t)&&(o={derive:t,read:yU(t)},QT.set(e,o)),o.read(e)}var XT=new WeakMap;function ZT(e,t){let o=JT(e,t),n=XT.get(o);if(n===void 0){let r=null;n=o.flatMap(({summary:a})=>{if(a.isSystemMessage===!0)return r===null?[]:[{...r,sectionKey:a.sectionKey,inherited:!0}];let s=a.headerAttachment;return a.headerText===null&&s===void 0?(r=null,[]):(r={sectionKey:a.sectionKey,text:a.headerText??"",...s===void 0?{}:{attachment:s},anchorRowId:a.anchorRowId,inherited:!1},[r])}),XT.set(o,n)}return n}function eI(e,t){return e===t?!0:e.length!==t.length?!1:e.every((o,n)=>{let r=t[n];return o.sectionKey===r.sectionKey&&o.text===r.text&&o.anchorRowId===r.anchorRowId&&o.attachment?.name===r.attachment?.name&&o.attachment?.count===r.attachment?.count&&o.inherited===r.inherited})}var YT=new WeakMap;function tI(e,t){let o=JT(e,t),n=YT.get(o);return n===void 0&&(n=o.filter(({summary:r})=>r.userText!==null).map(({item:r})=>r),YT.set(o,n)),n}function oI(e,t){return e===t?!0:e.length!==t.length?!1:e.every((o,n)=>o===t[n])}var vU=[],CU=e=>e.getMeta().usageByTurnId,xU=e=>e.getMeta().exportApi,bU=e=>e.getMeta().status.totalTurnCount??null,nI=pe(function({rowsStore:t,derive:o,paneVisible:n,bottomInset:r,onSelect:a,onTurnNavigatorChange:s}){let i=R(f=>n?tI(f,o):vU,[o,n]),d=Wt(t,i,oI),c=Wt(t,CU),u=Wt(t,xU),m=Wt(t,bU),p=W(()=>n?{items:d,totalTurnCount:m,bottomInset:r,usageByTurnId:c,onSelect:a,exportMarkdown:u.markdown,onDownload:u.download}:null,[r,u,d,a,n,m,c]);return H(()=>{p!==null&&s(p)},[s,p]),H(()=>{if(n)return()=>s(null)},[s,n]),null});function aI({timeline:e,previousOverlayHeight:t,overlayHeight:o,followingEnd:n}){e&&n&&o>t&&e.scrollToEnd({animated:!1})}function sI(e,t){let o=e.topOf(t),n=e.heightOf(t);return typeof o!="number"||typeof n!="number"||!Number.isFinite(o)||!Number.isFinite(n)?null:o+Math.max(1,n)}function iI({measurement:e,followingEnd:t}){return t?null:e.rowAtScroll()}var rI="--chat-frozen-block-visibility";function xp(e,t){let o=Array.from(e.querySelectorAll("[data-timeline-turn-section]")),n=o.findIndex(a=>a.querySelector(`[data-timeline-row-id="${CSS.escape(t)}"]`)),r=n<0?o:o.slice(0,n+1);for(let a of r)a.style.contentVisibility="visible",a.style.setProperty(rI,"visible");e.offsetHeight,requestAnimationFrame(()=>{for(let a of r)a.style.removeProperty("content-visibility"),a.style.removeProperty(rI)})}$();var wU=e=>e.getMeta().status.workingStepLabel??null,TU=e=>e.getMeta().status.waitingFor??null,IU=e=>e.getMeta().status.liveOutputTokens??null,SU=e=>e.getMeta().status.stall??null,kU=e=>e.getMeta().status.retry??null,lI=pe(function({rowsStore:t,historyWindow:o,children:n}){let r=Wt(t,wU),a=Wt(t,TU),s=Wt(t,IU),i=Wt(t,SU),d=Wt(t,kU),c=W(()=>o?{workingStepLabel:null,waitingFor:null,liveOutputTokens:null,stall:null,retry:null}:{workingStepLabel:r,waitingFor:a,liveOutputTokens:s,stall:i,retry:d},[o,s,d,i,a,r]);return l(op,{value:c,children:n})});$();function bp(e){return e==="loading"?"threadSync.loading":"threadSync.syncing"}var LU=1e3,wp=150;function Tp(e,t=LU){let[o,n]=q(null);return H(()=>{if(e===null){n(null);return}let r=globalThis.setTimeout(()=>{n(e)},t);return()=>{globalThis.clearTimeout(r)}},[e,t]),o}var PU=5;function dI(e){let t=e.data.useThreadSyncPhase(e.target);return Tp(t,wp)==="loading"?l(th,{}):null}function th(){let{t:e}=z();return v("div",{className:"pointer-events-none absolute inset-0 overflow-hidden bg-background px-3 pt-4 sm:px-5","data-timeline-loading-skeleton":"",role:"status",children:[l("span",{className:"sr-only",children:e(bp("loading"))}),l("div",{className:"transcript-col flex flex-col gap-6",children:Array.from({length:PU},(t,o)=>v("div",{"aria-hidden":"true",className:"flex flex-col gap-3",children:[l("div",{className:"h-9 self-end rounded-[18px] bg-muted-foreground/15",style:{width:`${44-o%2*14}%`}}),[92,84,61].map((n,r)=>l("div",{className:"h-3 rounded-control-1 bg-muted-foreground/15",style:{width:`${n-o%3*6}%`}},r))]},o))})]})}var cI=l("div",{className:"h-3 sm:h-4"}),uI=l("div",{className:"h-10 sm:h-12"});function pI({loading:e,blocked:t,onLoadEarlier:o,fade:n}){let{t:r}=Ne();return l("div",{className:n?"pt-10 sm:pt-12":"pt-3 sm:pt-4",children:l("div",{className:"transcript-col pb-2",children:l("button",{type:"button","data-timeline-load-earlier":"",onClick:o,disabled:e||t,className:"relative w-full select-none 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 mI({loading:e,blocked:t,onLoadLater:o,onReturnToLatest:n}){let{t:r}=Ne();return v("div",{className:"transcript-col flex items-center justify-center gap-2 py-2",children:[l(K,{variant:"ghost",size:"sm",onClick:o,disabled:e||t,children:r(e?"timeline.loadingLater":"timeline.loadLater")}),n?l(K,{variant:"ghost",size:"sm",onClick:n,children:r("timeline.returnToLatest")}):null]})}function fI({onReveal:e,fade:t}){let{t:o}=Ne();return l("div",{className:t?"pt-10 sm:pt-12":"pt-3 sm:pt-4",children:l("div",{className:"transcript-col pb-2",children:l("button",{type:"button","data-timeline-load-earlier":"",onClick:e,className:"relative w-full select-none 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:o("timeline.loadEarlier")})})})}var gI=l("div",{className:"h-3 sm:h-4"});$();var RU=Object.freeze([]),hI=e=>e.getMeta().status.scheduledWakes??RU;function yI(e,t){let o=E(e);return t&&(o.current=e),o.current}$();function Ip(e){return JSON.stringify([e.turnId??null,e.toolCallId?"tool":"entry",e.toolCallId||e.id])}$();function Sp(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 vI({badge:e,startedAt:t,completedAt:o,waitingLabel:n,timestampFormat:r}){let{t:a}=Ne();if(e===null&&t===void 0)return null;let s=a("timeline.turnInfo");return v(nn,{children:[l(an,{openOnHover:!0,delay:250,render:l(K,{type:"button",size:"icon-xs",variant:"ghost","data-turn-info":"","aria-label":s,className:"shrink-0 text-muted-foreground"}),children:l(Jl,{className:"size-3.5","aria-hidden":!0})}),l(rn,{side:"top",align:"start",className:"max-w-80",children:v("div",{className:"flex flex-col gap-2 text-chat-dense",children:[e!==null?l("div",{className:"flex min-w-0 items-center gap-2",children:l(gi,{badge:e})}):null,t!==void 0?l("div",{className:"text-muted-foreground tabular-nums",children:a("timeline.turnStarted",{time:wn(t,r,a)})}):null,o!==void 0?l("div",{className:"text-muted-foreground tabular-nums",children:a("timeline.turnFinished",{time:wn(o,r,a)})}):null,n!==void 0?l("div",{className:"text-muted-foreground tabular-nums",children:n}):null]})})]})}function EU(e,t,o,n){if(o===void 0||o<=0)return null;let r=t(o);return n!==void 0&&n>0?e("timeline.waitingWithApprovals",{waiting:r,approvals:t(n)}):e("timeline.waiting",{waiting:r})}function kp({label:e,children:t}){let[o,n]=q(!1);return v(Pe,{open:o,onOpenChange:n,children:[l(Ee,{render:l("button",{type:"button",className:"inline-flex items-center gap-1 rounded-sm"}),"aria-label":e,onClick:()=>n(r=>!r),children:t}),l(Re,{children:e})]})}var CI=pe(function({footer:t,timestampFormat:o,copyText:n,identity:r}){let{t:a}=Ne(),{formatCountedDuration:s}=_o(),i=EU(a,s,t.waitingForYouMs,t.approvalWaitMs),d=t.state,c=d==="error"?a("timeline.error"):d==="interrupted"?a("timeline.interrupted"):null;return v("div",{"data-turn-summary":t.turnId,className:"chat-process-meta flex min-w-0 select-none items-center gap-2 px-1 text-muted-foreground",children:[v("div",{className:"flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1",children:[c!==null?v(kp,{label:c,children:[d==="error"?l(dt,{className:"size-icon-1 text-destructive-foreground","aria-hidden":!0}):l(fd,{className:"size-3","aria-hidden":!0}),l("span",{className:"sr-only",children:c})]}):null,t.workingElapsedMs!==void 0?l(kp,{label:a("timeline.workingTime",{duration:s(t.workingElapsedMs)}),children:s(t.workingElapsedMs)}):null,i!==null?v(oe,{children:[" ",l(kp,{label:i,children:i})]}):null,(t.workingElapsedMs!==void 0||i!==null)&&t.outputTokens!==void 0?" ":null,t.outputTokens!==void 0?l(rp,{text:String(t.outputTokens),label:a("copyButton.copyTokenCount"),children:l(kp,{label:`${a("timeline.outputTokens")}: ${t.outputTokens.toLocaleString()}`,children:a("timeline.outputTokenCount",{count:t.outputTokens,value:Sp(t.outputTokens)})})}):null]}),l(vI,{badge:r?.badge??null,startedAt:r?.createdAt,completedAt:t.completedAt,waitingLabel:i??void 0,timestampFormat:o}),n?l(ea,{text:n,variant:"ghost",size:"icon-xs",className:"shrink-0",toastAnchor:"below"}):null]})});function Od({plugins:e,environmentId:t}){let{t:o}=z(),n=Xn(t,e[0]??"");return l("span",{className:"chat-process-meta text-muted-foreground",children:o(e.length===1?"toolCall.rewrittenByOne":"toolCall.rewrittenByMany",{plugin:n??o("toolCall.unknownPlugin"),count:e.length})})}$();function MU(e){return e.toolLifecycleStatus==="interrupted"}function AU(e){let t=e?.stoppedByUser===!0;return e?.continuedAfterStop===!0?t?"toolGroup.interruptedByYouKeptRunning":"toolGroup.interruptedKeptRunning":e?.terminationConfirmed===!0?t?"toolGroup.interruptedByYou":"toolGroup.interrupted":t?"toolGroup.interruptedByYouMayStillRun":"toolGroup.interruptedMayStillRun"}function oh(e,t,o){if(!MU(e))return null;let n=e.toolInterrupt,r=t(AU(n)),a=[n?.durationMs===void 0?null:o(n.durationMs),e.toolIo?.exitCode===void 0?null:t("toolGroup.exitCode",{code:e.toolIo.exitCode})].filter(s=>s!==null);return a.length===0?r:`${r}, ${a.join(", ")}`}$();function nh(e){if(e<1e3)return String(e);if(e<1e6){let o=e/1e3;return`${o<10?o.toFixed(1).replace(/\.0$/,""):Math.round(o)}k`}if(e<1e9){let o=e/1e6;return`${o<10?o.toFixed(1).replace(/\.0$/,""):Math.round(o)}m`}let t=e/1e9;return`${t<10?t.toFixed(1).replace(/\.0$/,""):Math.round(t)}b`}function xI({additions:e,deletions:t,className:o,showParentheses:n=!1,layout:r="aligned",disabled:a=!1,showZero:s=!0,cn:i,t:d,language:c}){let u=s||e!==0,m=s||t!==0;if(!u&&!m)return null;let p=[];u&&p.push(d("changedFiles.additions",{count:e})),m&&p.push(d("changedFiles.deletions",{count:t}));let f=new Intl.ListFormat(c,{type:"unit"}).format(p),g=a?"text-[var(--control-disabled-foreground)]":null;return v(oe,{children:[n&&l("span",{className:"text-muted-foreground/70",children:"("}),v("span",{"aria-label":f,className:i(r==="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",o),"data-slot":"diff-stat",role:"group",children:[u?v("span",{"aria-hidden":"true",className:i("font-mono",g??"text-diff-addition"),children:["+",nh(e)]}):null,m?v("span",{"aria-hidden":"true",className:i("font-mono",g??"text-diff-deletion"),children:["-",nh(t)]}):null]}),n&&l("span",{className:"text-muted-foreground/70",children:")"})]})}var bI=pe(function(t){let{t:o}=Ne();return l(xI,{...t,cn:V,t:o,language:void 0})});function wI(e){return e==="failed"?"failed":e==="running"?"running":"idle"}function TI(e){return e.includes("failed")?"failed":e.includes("running")?"running":"idle"}function NU(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 rh(e,t){let o=new Map;for(let n of e){let r=t(n);o.set(r,(o.get(r)??0)+1)}return Array.from(o,([n,r])=>({action:n,icon:NU(n),count:r}))}function ah(e,t){let o;for(let n of rh(e,t))(!o||n.count>o.count)&&(o=n);return o?.icon??"wrench"}$();function II({entries:e,failed:t,derive:o}){let{t:n}=Ne(),r=W(()=>rh(e,o.toolGroupAction),[e,o]),a=r.length===1;return a&&r[0].count<2?null:l("span",{className:"chat-process-meta flex shrink-0 items-center gap-2 tabular-nums","aria-label":n("toolGroup.calls",{count:e.length}),children:r.map(({action:s,icon:i,count:d})=>v("span",{"aria-hidden":!0,className:"flex items-center gap-1",children:[a?null:l(Vs,{name:i,className:V("size-icon-1 shrink-0 stroke-[1.8] opacity-70",t?"text-destructive-foreground":"text-icon-muted")}),d]},s))})}function DU(e){switch(e){case"command":return"command";case"edit":return"edit";case"read":return"read";case"search":case"code-search":return"search";default:return"other"}}function _U(e){return e.changedFiles&&e.changedFiles.length>0?e.changedFiles:e.toolLabel?.path?[e.toolLabel.path]:[]}function SI(e,t){let o=[],n=new Map,r=new Map,a=new Map;for(let p of e){let f=DU(t(p));if(o.includes(f)||o.push(f),n.set(f,(n.get(f)??0)+1),f!=="edit"&&f!=="read")continue;let g=_U(p);if(g.length===0){a.set(f,(a.get(f)??0)+1);continue}let h=r.get(f)??new Set;for(let y of g)h.add(y);r.set(f,h)}let i=o.map(p=>({kind:p,count:p==="edit"||p==="read"?(r.get(p)?.size??0)+(a.get(p)??0):n.get(p)??0})).filter(p=>p.count>0).slice().sort((p,f)=>f.count-p.count||o.indexOf(p.kind)-o.indexOf(f.kind)),d=i.slice(0,2),c=i.slice(2);if(c.length===0)return d;let u=c.reduce((p,f)=>p+(n.get(f.kind)??0),0),m=d.map(p=>p.kind==="other"?{kind:"other",count:p.count+u}:p);return d.some(p=>p.kind==="other")||m.push({kind:"other",count:u}),m}function kI(e){return typeof e.toolData=="object"&&e.toolData!==null&&!Array.isArray(e.toolData)?e.toolData:null}function LI(e,t,o,n){if(t===void 0||o===void 0||o.length===0)return e;let r=e.trim();for(let a of[`mcp__ycodium__${t}`,`ycodium_${t}`,`ycodium ${t}`,t]){if(r===a)return o;if(!r.startsWith(`${a} `))continue;let s=r.slice(a.length).trim();return s.length===0?o:n!==void 0&&s.toLowerCase()==="started"?n(o):`${o} ${s}`}return e}function ta(e){return Ip(e)}function Lp(e,t,o,n,r,a){let s=e.toolLabel,i=o.resolveToolCommand(e);if(i&&s?.descriptive&&!s.path&&s.detail?.trim())return s.detail.replace(/\s+/g," ").trim();for(let y of[e.rawCommand,e.command]){let x=o.parseToolCommandInput(y)?.description;if(x)return x.replace(/\s+/g," ").trim()}if(i)return i.replace(/\s+/g," ").trim();let d=kI(e),c=typeof d?.toolName=="string"?d.toolName:typeof d?.name=="string"?d.name:void 0,u=e.builtinMcpTool||void 0,m=a??LI(s?.name??c??e.toolTitle??e.label,u,u===void 0?void 0:n?.get(u),r),p=s?.path??e.changedFiles?.[0],f=p?dp(p,t):void 0,g=[m.trim().toLowerCase()==="tool"?void 0:m,f,e.toolMetadata?.source==="ycodium"?void 0:s?.detail??e.detail],h=[];for(let y of g){let x=y?.replace(/\s+/g," ").trim();x&&!h.some(C=>C.toLowerCase()===x.toLowerCase())&&h.push(x)}return h.join(" ")||null}$();function Fd(e){let t=xe(Fe)?.toolPresentation;return e===void 0||t===void 0?null:t(e)}function PI(e){let t=xe(Fe)?.toolPresentation;return W(()=>{if(t===void 0||e.length===0)return null;let o=t(e[0]);if(o===null)return null;let n=e.map(r=>t(r));return n.every(r=>r?.groupKey===o.groupKey)?o:n.every(r=>r?.familyKey===o.familyKey)?{...o,groupName:o.familyName,origin:o.origin.kind==="ycodium"?{kind:"ycodium",area:"general"}:o.origin}:null},[e,t])}function sh({presentation:e,className:t}){let o=xe(Fe),n=o.ToolSourceIcon;return n===void 0?null:l(n,{environmentId:o.activeThreadEnvironmentId,origin:e.origin,className:t})}function Bd({presentation:e,fallback:t,environmentId:o}){return v(oe,{children:[e.sourceName!==null?v(oe,{children:[l("span",{className:"font-medium text-foreground","data-tool-source-name":"",children:e.sourceName}),l("span",{"aria-hidden":!0,className:"px-1 text-muted-foreground",children:"\xB7"})]}):null,e.declared?l("span",{children:e.title}):t,e.declared&&e.summary!==null?l(RI,{text:e.summary}):null,e.declared&&e.summary===null&&e.entity?l(OU,{entity:e.entity,environmentId:o}):null,e.declared&&e.experienceId?l(FU,{experienceId:e.experienceId}):null]})}function OU({entity:e,environmentId:t}){let o=xe(Fe),n=t??o?.activeThreadEnvironmentId??"",r=e.kind==="machine"?e.environmentId:e.environmentId??n;return v(oe,{children:[l("span",{"aria-hidden":!0,className:"px-1 text-muted-foreground",children:"\xB7"}),l("span",{className:"inline-flex min-w-0 tabular-nums","data-tool-entity":e.kind,children:e.kind==="thread"?l(yd,{threadRef:{environmentId:r,threadId:e.threadId},fallbackName:e.fallbackName,showStatus:!1}):e.kind==="machine"?l(gb,{environmentId:r,fallbackName:e.fallbackName}):e.kind==="project"?l(hb,{projectRef:{environmentId:r,projectId:e.projectId},fallbackName:e.fallbackName}):l(yb,{environmentId:r,instanceId:e.instanceId,fallbackName:e.fallbackName})})]})}function RI({text:e}){return v(oe,{children:[l("span",{"aria-hidden":!0,className:"px-1 text-muted-foreground",children:"\xB7"}),l("span",{className:"tabular-nums",children:e})]})}function FU({experienceId:e}){let t=ci(),o=t?.data.useMemoryExperience;return!t||!o?null:l(BU,{readExperience:o,target:t.target,experienceId:e})}function BU({readExperience:e,target:t,experienceId:o}){let{title:n}=e(t,o);return n===null?null:l(RI,{text:n})}var hi=20,HU={failed:"toolGroup.showFailure",declined:"toolGroup.showDeclined",stopped:"toolGroup.showCancelled"},UU={command:"toolGroup.semanticCommands",edit:"toolGroup.semanticEdits",read:"toolGroup.semanticReads",search:"toolGroup.semanticSearches",other:"toolGroup.semanticOther"};function EI({entry:e,presentation:t}){let o=e.toolLabel?.diffStat;return!o||t==="failed"||t==="declined"||t==="stopped"?null:l(bI,{...o,layout:"inline",className:"chat-process-meta ms-2 shrink-0"})}function MI({toolIcon:e,glyphClassName:t}){let o=xe(Fe),n=o.SiteIcon;return e.pageUrl!==void 0&&n!==void 0?l(n,{threadRef:o.threadRef,pageUrl:e.pageUrl,className:"size-3.5 shrink-0 rounded-sm object-contain"}):l(Vs,{name:"globe",className:t})}function $U({entry:e,failed:t=!1,derive:o}){let n=xe(Fe),r=Fd(e);return t?l(eo,{"aria-hidden":!0,className:"size-icon-1 shrink-0 text-destructive-foreground"}):e.toolIcon!==void 0?l(MI,{toolIcon:e.toolIcon,glyphClassName:"size-icon-1 shrink-0 stroke-[1.8] text-muted-foreground opacity-70"}):r!==null&&n.ToolSourceIcon!==void 0?l(sh,{presentation:r,className:"size-icon-1"}):l(Vs,{name:ah([e],o.toolGroupAction),className:"size-icon-1 shrink-0 stroke-[1.8] text-muted-foreground opacity-70"})}function AI({entry:e}){let t=xe(Fe),o=e.detail??e.command??e.rawCommand??e.toolLabel?.detail,n=JSON.stringify([e.id,e.sourceActivityKind,e.toolLifecycleStatus]),r=Fd(e),a=t.renderToolCallDetail?.({entry:e,threadRef:t.threadRef,threadKey:t.threadKey,workspaceRoot:t.workspaceRoot,revision:n,onOpenFileDiff:t.onOpenFileDiff});return v("div",{className:"min-w-0 space-y-2 p-3",children:[r!==null?l("p",{className:"chat-process-meta text-muted-foreground","data-tool-source-line":"",children:r.sourceLine}):null,a!==void 0?l(oe,{children:a}):l("pre",{className:"chat-tool-body overflow-x-auto rounded-md bg-muted/40 p-2",children:o??""})]})}var zU=pe(function(t){let{entry:o,threadKey:n,workspaceRoot:r,onDisclosureChange:a}=t,s=xe(Fe),i=s.derive,{t:d}=Ne(),{formatDuration:c}=_o(),[u,m]=$t(n,`call:${ta(o)}`,!1),p=i.toolPresentationStatus(o),f=Fd(o),g=f?.declared===!0?null:Lp(o,r,i,s.declaredToolTitles,k=>d("toolGroup.declaredStarted",{title:k}),f?.title)??d("toolGroup.calls",{count:1}),h=p==="failed",y=p==="declined",x=p==="stopped",C=x?oh(o,d,c):null,b=i.resolveWorkEntryStatus(o),L=b==="failed"||b==="running"?b:null,w=ho();return v("div",{"data-tool-call-id":o.toolCallId??o.id,"data-tool-identity":ta(o),className:"border-b border-border/50 last:border-b-0",children:[v("button",{type:"button","aria-expanded":u,"aria-controls":w,onClick:()=>{a?.(),m(!u)},className:V("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",h?"text-destructive-foreground":"text-muted-foreground"),children:[l(Cd,{status:L}),l(vd,{children:l($U,{entry:o,failed:h,derive:i})}),v("span",{className:"flex min-w-0 flex-1 items-center",children:[l("span",{className:"truncate",children:f!==null?l(Bd,{presentation:f,fallback:g}):g}),l(EI,{entry:o,presentation:p})]}),h||y||x||o.statusInferred?l("span",{className:"chat-process-meta shrink-0",children:o.statusInferred?d("toolGroup.statusUnknown"):h?d("toolGroup.failed",{count:1}):y?d("toolGroup.declined",{count:1}):C??d("toolGroup.cancelled",{count:1})}):null,o.rewrittenBy?.length?l(Od,{plugins:o.rewrittenBy,environmentId:s.threadRef?.environmentId??null}):null,l(Tt,{"aria-hidden":!0,className:V("size-icon-1 shrink-0",!u&&"-rotate-90")})]}),u?l("div",{id:w,children:l(AI,{entry:o})}):null]})});function KU({threadKey:e,stateKey:t,maxHeight:o,children:n}){let r=E(null);return fe(()=>{let a=r.current;if(!a)return;a.scrollTop=$g(e,`${t}:scroll`,0);let s=()=>{Ld(e,`${t}:scroll`,a.scrollTop,!1)};return a.addEventListener("scroll",s,{passive:!0}),()=>a.removeEventListener("scroll",s)},[e,t]),l("div",{ref:r,"data-slot":"scroll-area-viewport",className:"min-w-0 overflow-y-auto overscroll-y-contain",style:{maxHeight:o},children:n})}var NI=pe(function({entries:t,groupId:o,threadKey:n,workspaceRoot:r,onDisclosureChange:a}){let s=xe(Fe),i=s.derive,{t:d}=Ne(),{formatDuration:c}=_o(),[u,m]=$t(n,`group:${o}`,!1),[p,f]=$t(n,`group-page:${o}`,0),g=ho(),h=E(null),[y,x]=q(null),C=t.at(-1),{failedCount:b,declinedCount:L,stoppedCount:w,issue:k,runningCount:I,unknownCount:T}=W(()=>({...i.summarizeToolGroup(t),unknownCount:t.filter(ne=>ne.statusInferred).length,runningCount:t.filter(ne=>i.toolPresentationStatus(ne)==="running").length}),[t,i]),S=k?.entry??C,P=Math.max(0,Math.ceil(t.length/hi)-1),A=Math.min(p,P),N=A*hi,B=t.slice(N,N+hi),O=t.length>1,j=t.every(ne=>i.toolPresentationStatus(ne)==="completed"),D=W(()=>O&&j&&k===null?SI(t,i.toolGroupAction):null,[t,i,O,j,k])?.map(ne=>d(UU[ne.kind],{count:ne.count})).join(" \xB7 ")??null,J=PI(O?t:[]),G=Fd(O?void 0:C),M=O?J:G;if(fe(()=>{if(!y)return;let ne=h.current,Z=Array.from(ne?.querySelectorAll("[data-tool-identity]")??[]).find(he=>he.dataset.toolIdentity===y.id);if(!Z)return;let ve=Z.closest('[data-slot="scroll-area-viewport"]');ve&&(ve.scrollTop+=Z.getBoundingClientRect().top-ve.getBoundingClientRect().top),Z.querySelector("button")?.focus({preventScroll:!0})},[y]),!C||!S)return null;let X=I>0&&k===null?t.find(ne=>i.toolPresentationStatus(ne)==="running")??S:S,F=D??Lp(X,r,i,s.declaredToolTitles,ne=>d("toolGroup.declaredStarted",{title:ne}),G?.title)??d("toolGroup.calls",{count:1}),ee=ne=>{a?.(),f(ne)},Y={threadKey:n,workspaceRoot:r,onDisclosureChange:a},ae=TI(t.map(ne=>wI(i.resolveWorkEntryStatus(ne)))),te=ah(t,i.toolGroupAction),de=O?null:oh(C,d,c),ge=ae==="failed"?"failed":ae==="running"?"running":L+w===t.length?null:"success";return l(Nu,{state:ae,variant:"tool",children:v("section",{ref:h,"data-tool-group-id":o,className:"min-w-0",children:[v("div",{className:"flex min-w-0 items-center",children:[v("button",{type:"button","aria-expanded":u,"aria-controls":g,onClick:()=>{a?.(),m(!u),!O&&!u&&Ld(n,`call:${ta(C)}`,!0)},className:V(li,"flex-1",b>0?"text-destructive-foreground":"text-muted-foreground"),children:[l(Cd,{status:ge}),l(vd,{children:M!==null&&s.ToolSourceIcon!==void 0&&b===0&&(O||C.toolIcon===void 0)?l(sh,{presentation:M,className:"size-icon-1"}):!O&&C.toolIcon!==void 0&&b===0?l(MI,{toolIcon:C.toolIcon,glyphClassName:"size-icon-1 shrink-0 stroke-[1.8] opacity-70 text-icon-muted"}):l(Vs,{name:te,className:V("size-icon-1 shrink-0 stroke-[1.8] opacity-70",b>0?"text-destructive-foreground":"text-icon-muted")})}),v("span",{className:V("flex min-w-0 flex-1 items-center",u&&O?"chat-process-text":"chat-tool-summary"),children:[l("span",{className:"truncate",children:J!==null?d("toolGroup.namedCalls",{name:J.groupName,count:t.length}):u&&O?d("toolGroup.calls",{count:t.length}):G!==null?l(Bd,{presentation:G,fallback:F}):F}),u&&O?null:D===null?l(EI,{entry:S,presentation:i.toolPresentationStatus(S)}):null]}),t.length===1&&S.rewrittenBy?.length?l(Od,{plugins:S.rewrittenBy,environmentId:s.threadRef?.environmentId??null}):null,T>0?l("span",{className:"chat-process-meta shrink-0",children:d("toolGroup.statusUnknown")}):null,I>0?l("span",{className:"chat-process-meta shrink-0 tabular-nums text-info-foreground",children:d("toolGroup.running",{count:I})}):null,b>0?l("span",{className:"chat-process-meta shrink-0 tabular-nums",children:d("toolGroup.failed",{count:b})}):null,L>0?l("span",{className:"chat-process-meta shrink-0 tabular-nums",children:d("toolGroup.declined",{count:L})}):null,w>0?l("span",{className:"chat-process-meta shrink-0 tabular-nums",children:d("toolGroup.cancelled",{count:w})}):null,u&&O?null:D===null&&J===null?l(II,{entries:t,failed:b>0,derive:i}):null,l(Tt,{"aria-hidden":!0,className:V("size-icon-1 shrink-0",!u&&"-rotate-90")})]}),k&&O?l("button",{type:"button",className:V("chat-process-meta me-2 min-h-8 shrink-0 rounded-control-4 px-1 underline [@media(pointer:coarse)]:min-h-11",k.kind==="failed"?"text-destructive-foreground":"text-muted-foreground"),onClick:()=>{a?.(),m(!0),f(Math.floor(t.indexOf(k.entry)/hi)),Ld(n,`call:${ta(k.entry)}`,!0),x({id:ta(k.entry)})},children:d(HU[k.kind])}):null]}),u?l("div",{id:g,className:"border-t border-border/50",children:O?v(oe,{children:[t.length>hi?v("div",{className:"chat-process-meta flex items-center gap-1 border-b border-border/40 px-2 py-1 text-muted-foreground",children:[l("span",{className:"min-w-0 flex-1 tabular-nums",children:d("toolGroup.pageRange",{from:N+1,to:Math.min(N+hi,t.length),count:t.length})}),[{label:d("toolGroup.firstPage"),target:0,disabled:A===0,Icon:Ul},{label:d("toolGroup.previousPage"),target:A-1,disabled:A===0,Icon:Hl},{label:d("toolGroup.nextPage"),target:A+1,disabled:A===P,Icon:yo},{label:d("toolGroup.lastPage"),target:P,disabled:A===P,Icon:$l}].map(({label:ne,target:Z,disabled:ve,Icon:he})=>l("button",{type:"button","aria-label":ne,disabled:ve,onClick:()=>ee(Z),className:"flex size-7 items-center justify-center rounded-control-3 disabled:opacity-64 [@media(pointer:coarse)]:size-11",children:l(he,{"aria-hidden":!0,className:"size-icon-1"})},ne))]}):null,l(KU,{threadKey:n,stateKey:`group-scroll:${o}:${A}`,maxHeight:"min(320px, 50dvh)",children:l("div",{className:"space-y-0.5 py-1",children:B.map(ne=>l(zU,{entry:ne,...Y},ta(ne)))})})]}):v(oe,{children:[de?l("p",{className:"chat-process-meta px-3 pt-3 text-muted-foreground",children:l("span",{children:de})}):null,l(AI,{entry:C})]})}):null]})})});$();function DI(e){return e instanceof Error?e.message:void 0}function Pp(e,t){return t!==void 0&&t.length>0?`${e}: ${t}`:e}function _I(e){return{error:(t,o,n)=>{let r=n?.description??DI(o);e(Pp(t,r),"error",r)},warning:(t,o,n)=>{let r=n?.description??DI(o);e(Pp(t,r),"warning",r)},success:(t,o,n)=>{let r=o??n?.description;e(Pp(t,r),"success",r)},info:(t,o,n)=>{let r=o??n?.description;e(Pp(t,r),"info",r)}}}function OI(){let e=Nt();return _I((t,o,n)=>e.notify(t,o,n))}function yi(e){let t=e.match(/^\s{0,3}#{1,6}\s+(.+)$/m)?.[1]?.trim();return t&&t.length>0?t:null}function ih(e){let t=e.trimEnd().split(/\r?\n/),o=t[0]&&/^\s{0,3}#{1,6}\s+/.test(t[0])?t.slice(1):[...t];for(;o[0]?.trim().length===0;)o.shift();if(o[0]?.match(/^\s{0,3}#{1,6}\s+(.+)$/)?.[1]?.trim().toLowerCase()==="summary")for(o.shift();o[0]?.trim().length===0;)o.shift();return o.join(`
3538
+ `)}function FI(e,t,o){let n=o?.maxLines??8,r=ih(e).trimEnd().split(/\r?\n/).map(d=>d.trimEnd()),a=[],s=0,i=!1;for(let d of r){let c=d.trim().length>0;if(c&&s>=n){i=!0;break}a.push(d),c&&(s+=1)}for(;a.length>0&&a.at(-1)?.trim().length===0;)a.pop();return a.length===0?yi(e)??t("proposedPlan.previewUnavailable"):(i&&a.push("","..."),a.join(`
3539
+ `))}function qU(e){let t=e.toLowerCase().replace(/[`'".,!?()[\]{}]+/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"");return t.length>0?t:"plan"}function BI(e){let t=yi(e);return`${qU(t??"plan")}.md`}function HI(e){return`${e.trimEnd()}
3540
+ `}function UI(e,t){let o=new Blob([t],{type:"text/markdown;charset=utf-8"}),n=URL.createObjectURL(o),r=document.createElement("a");r.href=n,r.download=e,r.click(),window.setTimeout(()=>{URL.revokeObjectURL(n)},0)}function Rp(e,t,o="duration"){let n=`<${o}></${o}>`,r=`<${o}/>`,a=i=>{let d=e.indexOf(i);return d<0?null:[e.slice(0,d),e.slice(d+i.length)]},s=a(n)??a(r);return s===null?v(oe,{children:[e,t]}):v(oe,{children:[s[0],t,s[1]]})}var Ep=1024,$I=pe(function({planMarkdown:t,threadKey:o,rowId:n,environmentId:r,threadRef:a,cwd:s,workspaceRoot:i,onSavePlanToWorkspace:d}){let{t:c}=Ne(),u=OI(),[m,p]=$t(o,`proposed-plan:${n}:expanded`,!1),[f,g]=q(!1),[h,y]=$t(o,`proposed-plan:${n}:save-path`,""),[x,C]=q(!1);Gs(n,f||x);let b=E(!1),L=E(!1);fe(()=>(b.current=!0,()=>{b.current=!1}),[]);let{copyToClipboard:w,isCopied:k}=np({target:"plan",onError:G=>{u.error(c("proposedPlan.couldNotCopy"),G,{description:c("proposedPlan.copyErrorDescription")})}}),I=ho(),T=yi(t)??c("proposedPlan.defaultTitle"),S=t.split(`
3541
+ `).length,P=t.length>900||S>20,A=ih(t),N=P?FI(t,c,{maxLines:10}):null,B=BI(t),O=HI(t),j=()=>{UI(B,O)},U=()=>{w(O)},D=()=>{if(!i){u.error(c("proposedPlan.workspacePathUnavailable"),c("proposedPlan.workspacePathUnavailableDescription"));return}h.length===0&&y(B.slice(0,Ep)),g(!0)},J=()=>{if(L.current)return;let G=h.trim();if(!(!i||d===null)){if(!G){u.warning(c("proposedPlan.enterWorkspacePath"));return}if(G.length>Ep){u.warning(c("proposedPlan.pathTooLong"));return}L.current=!0,C(!0),(async()=>{try{let M=await d({environmentId:r,workspaceRoot:i,relativePath:G,contents:O});if(!b.current)return;M.ok?(g(!1),u.success(c("proposedPlan.savedToWorkspace"),M.relativePath)):u.error(c("proposedPlan.couldNotSave"),void 0,{description:c("proposedPlan.saveErrorDescription")})}catch(M){b.current&&u.error(c("proposedPlan.couldNotSave"),M,{description:c("proposedPlan.saveErrorDescription")})}finally{L.current=!1,b.current&&C(!1)}})()}};return v("div",{className:"rounded-[24px] border border-border/80 bg-card/70 p-4 sm:p-5",children:[v("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[v("div",{className:"flex min-w-0 items-center gap-2",children:[l(jr,{variant:"secondary",children:c("proposedPlan.badge")}),l("p",{className:"truncate text-sm font-medium text-foreground",children:T})]}),v(Ao,{children:[l(Do,{render:l(K,{"aria-label":c("proposedPlan.actions"),size:"icon-xs",variant:"outline"}),children:l(Eo,{"aria-hidden":"true",className:"size-4"})}),v(No,{align:"end",children:[l(bo,{onClick:U,children:c(k?"proposedPlan.copied":"proposedPlan.copyToClipboard")}),l(bo,{onClick:j,children:c("proposedPlan.downloadAsMarkdown")}),d!==null?l(bo,{onClick:D,disabled:!i||x,children:c("proposedPlan.saveToWorkspace")}):null]})]})]}),v("div",{className:"mt-4",children:[v("div",{className:V("relative",P&&!m&&"max-h-104 overflow-hidden"),children:[P&&!m?l(wo,{disclosureKey:`proposed-plan:${n}:plan`,text:N??"",cwd:s,threadRef:a,isStreaming:!1}):l(wo,{disclosureKey:`proposed-plan:${n}:plan`,text:A,cwd:s,threadRef:a,isStreaming:!1}),P&&!m?l("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]}),P?l("div",{className:"mt-4 flex justify-center",children:l(K,{size:"sm",variant:"outline","data-scroll-anchor-ignore":!0,onClick:()=>p(!m),children:c(m?"proposedPlan.collapse":"proposedPlan.expand")})}):null]}),l(Js,{open:f,onOpenChange:G=>{x||g(G)},children:v(ei,{className:"max-w-xl",children:[v(Hu,{children:[l(ti,{children:c("proposedPlan.saveToWorkspace")}),l(Zs,{children:Rp(c("proposedPlan.pathHint"),l("code",{children:i??c("proposedPlan.theWorkspace")}),"path")})]}),l(Lb,{className:"space-y-3",children:v("label",{htmlFor:I,className:"grid gap-1.5",children:[l("span",{className:"text-xs font-medium text-foreground",children:c("proposedPlan.workspacePath")}),l(Vr,{id:I,value:h,maxLength:Ep,onChange:G=>y(G.target.value.slice(0,Ep)),placeholder:B,spellCheck:!1,disabled:x})]})}),v(Bu,{children:[l(K,{variant:"outline",size:"sm",onClick:()=>g(!1),disabled:x,children:c("proposedPlan.cancel")}),l(K,{size:"sm",onClick:()=>{J()},disabled:x,children:c(x?"proposedPlan.saving":"proposedPlan.save")})]})]})})]})});$();var vi=class extends ur{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 zI(e){return l(bb,{error:e})}$();var lh=qe(void 0);function KI(){return xe(lh)}function qI(e){let t=e.threadRef;if(typeof t=="object"&&t!==null&&"threadId"in t){let n=t.threadId;if(typeof n=="string"&&n.length>0)return n}let o=`${e.environmentId}:`;return e.threadKey.startsWith(o)&&e.threadKey.length>o.length?e.threadKey.slice(o.length):e.threadKey}$();function GI({row:e}){let{workingStepLabel:t,waitingFor:o,liveOutputTokens:n,stall:r,retry:a}=xe(op),{t:s}=Ne(),i=E(null),d=e.compacting?s("activity.compacting"):o==="approval"?s("activity.waitingForApproval"):o==="userInput"?s("activity.waitingForAnswer"):t;return v("div",{className:"border-b border-border/60 pb-2 pt-1",children:[v("div",{className:"working-status 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:[v("span",{ref:i,className:"working-glyph","data-waiting":o!==null?"":void 0,...o===null?{role:"img","aria-label":s("activity.working")}:{"aria-hidden":!0},children:[l("span",{}),l("span",{}),l("span",{})]}),d?l("span",{"data-working-part":"",className:"min-w-0",children:d}):null,e.createdAt?l(XU,{createdAt:e.createdAt,runSegments:e.runSegments,waitSpans:e.waitSpans,glyphRef:i}):null,n!==null?l("span",{"data-working-part":"",children:s("timeline.outputTokenCount",{count:n,value:Sp(n)})}):null]}),a?l(WU,{retry:a}):r&&!e.compacting?l(jU,{stall:r}):null]})}function WU({retry:e}){let{t}=Ne(),o=xe(Fe);return v(bd,{variant:"warning",className:"mt-2 px-2 py-1.5 text-chat-row",children:[l(Uu,{children:o.derive.providerRetryMessage(e,(n,r)=>t(n,r))}),o.onInterrupt?l(wd,{children:l(K,{onClick:o.onInterrupt,disabled:o.stopping===!0,size:"sm",variant:"ghost",title:t("stall.interruptHint"),children:o.stopping===!0?t("stall.stopping"):t("stall.interrupt")})}):null]})}var GU={childThread:"stall.reasonChildThread",tool:"stall.reasonTool",approval:"stall.reasonApproval",userInput:"stall.reasonUserInput",model:"stall.reasonModel"};function jU({stall:e}){let{t}=Ne(),{onInterrupt:o,stopping:n}=xe(Fe),r=t(GU[e.reason]);return v("div",{className:"mt-1 flex items-center gap-2 px-1 text-chat-row text-muted-foreground/70",children:[l("span",{className:"tabular-nums",children:Rp(t("stall.noOutputForLive"),l(QU,{since:e.since}))})," ",l("span",{children:r}),o?l(K,{className:"h-5 px-1.5 text-chat-row",onClick:o,disabled:n===!0,size:"sm",title:t("stall.interruptHint"),variant:"ghost",children:t(n===!0?"stall.stopping":"stall.interrupt")}):null]})}function VU(e,t,o){let n=vn(),{workingClock:r}=xe(Fe).derive;H(()=>{let a=()=>{t.current&&(t.current.textContent=VI(e,o,r))};if(a(),!n)return;let s=setInterval(a,1e3);return document.addEventListener("visibilitychange",a),()=>{clearInterval(s),document.removeEventListener("visibilitychange",a)}},[n,e,t,o,r])}function QU({since:e}){let t=E(null),{units:o}=_o(),{workingClock:n}=xe(Fe).derive;return VU(e,t,o),l("span",{className:"timeline-timer tabular-nums",ref:t,children:VI(e,o,n)})}function XU({createdAt:e,waitSpans:t,runSegments:o,glyphRef:n}){let r=E(null),a=vn(),{units:s}=_o(),{workingClock:i}=xe(Fe).derive,{paused:d}=i({startedAt:e,nowIso:new Date().toISOString(),waitSpans:t,runSegments:o});return H(()=>{let c=()=>{let m=WI(i,{createdAt:e,nowIso:new Date().toISOString(),waitSpans:t,runSegments:o},s);r.current&&(r.current.textContent=m.text),n.current&&(n.current.dataset.tick=String(m.elapsedSeconds%3))};if(c(),!a||d)return;let u=setInterval(c,1e3);return document.addEventListener("visibilitychange",c),()=>{clearInterval(u),document.removeEventListener("visibilitychange",c)}},[e,n,a,d,o,s,t,i]),l("span",{ref:r,"data-working-part":"",className:"timeline-timer tabular-nums",children:WI(i,{createdAt:e,nowIso:new Date().toISOString(),waitSpans:t,runSegments:o},s).text})}function jI(e,t){if(!Number.isFinite(e)||e<0)return t.seconds("0");let o=Math.floor(e/1e3);return o<60?t.seconds(String(o)):Td(o*1e3,t)}function WI(e,t,o){let n=e({startedAt:t.createdAt,nowIso:t.nowIso,waitSpans:t.waitSpans,runSegments:t.runSegments}),r=n.elapsedMs??0,a=Number.isFinite(r)?Math.max(0,Math.floor(r/1e3)):0;return{text:a<1?"":jI(r,o),paused:n.paused,elapsedSeconds:a}}function VI(e,t,o){return jI(o({startedAt:e,nowIso:new Date().toISOString(),waitSpans:void 0,runSegments:void 0}).elapsedMs??0,t)}$();function QI({children:e}){let{t}=z(),[o,n]=q(!1);return v("div",{className:"py-2","data-context-compaction-divider":!0,children:[v("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[l("span",{className:"h-px min-w-2 flex-1 bg-border"}),v(K,{size:"xs",variant:"ghost",className:"shrink-0 gap-1.5","aria-expanded":o,title:t("turnOverview.compressionDetails"),onClick:()=>n(r=>!r),children:[l(Oa,{className:"size-3","aria-hidden":!0}),t("turnOverview.compaction"),o?l(Tt,{className:"size-3","aria-hidden":!0}):l(yo,{className:"size-3","aria-hidden":!0})]}),l("span",{className:"h-px min-w-2 flex-1 bg-border"})]}),o?l("div",{className:"mt-1",children:e}):null]})}var XI=pe(function({rowsStore:t,rowId:o}){let n=vw(t,o),r=KI(),a=xe(Fe),{t:s}=Ne();if(n===void 0)return null;let i=qI({threadKey:a.threadKey,environmentId:a.activeThreadEnvironmentId,threadRef:a.threadRef});return l(Gr,{value:n.id,children:l("div",{className:V("relative",n.kind==="message"&&n.message.role==="user"?"pb-6":n.kind==="message"&&n.message.role==="assistant"?n.copyInFooter?"pb-1 group/assistant":"pb-4 group/assistant":n.kind==="turn-summary"?"pb-2 empty:pb-0":"pb-2"),"data-timeline-row-id":n.id,"data-timeline-row-kind":n.kind,"data-message-id":n.kind==="message"?n.message.id:void 0,"data-message-role":n.kind==="message"?n.message.role:void 0,children:v(vi,{resetKey:n.id,fallback:zI,children:[n.kind==="turn-summary"?v(oe,{children:[r?.renderDeliverableTools?.({turnId:n.footer.turnId,environmentId:a.activeThreadEnvironmentId,threadId:i}),n.cardAnchor===!0?null:l(CI,{footer:n.footer,copyText:n.copyText,timestampFormat:a.timestampFormat,identity:n.identity}),r?.renderSlot("conversation.chat.turnTail",{turnId:n.footer.turnId,environmentId:a.activeThreadEnvironmentId,threadId:i})]}):null,n.kind==="tool-group"?l(NI,{entries:n.entries,groupId:n.groupId,threadKey:a.threadKey,workspaceRoot:a.workspaceRoot,onDisclosureChange:()=>a.onProcessDisclosureChange?.(n.id)}):null,n.kind==="work"?l(YU,{row:n}):null,n.kind==="model-switch"?l(Jg,{row:n}):null,n.kind==="turn-identity"?l("div",{"data-turn-identity":n.turnId,role:"group","aria-label":s("timeline.answeredBy",{name:n.badge.providerDisplayName??n.badge.modelLabel}),className:"chat-process-meta flex min-w-0 select-none items-center gap-2 px-1 text-muted-foreground",children:l(gi,{badge:n.badge,compact:!0})}):null,n.kind==="message"&&n.message.role==="user"?l(Cp,{row:n}):null,n.kind==="message"&&n.message.role==="assistant"?l(jT,{row:n}):null,n.kind==="proposed-plan"?l(ZU,{row:n}):null,n.kind==="turn-plan"?l(e$,{row:n}):null,n.kind==="working"?l(GI,{row:n}):null,n.kind==="continuation-check"?l(PT,{row:n}):null]})})})});function YU({row:e}){let t=xe(Fe),o=vn(),n=t.renderWorkGroup?.({row:e,threadRef:t.threadRef,visible:o});return e.groupedEntries.some(r=>r.sourceActivityKind==="context-compaction")?l(QI,{children:n!==void 0?n:e.groupedEntries.map(r=>l("pre",{className:"max-h-72 overflow-auto text-xs whitespace-pre-wrap",children:r.detail??r.label},r.id))}):n!==void 0?l(oe,{children:n}):l("div",{className:"min-w-0 space-y-px py-0.5",children:e.groupedEntries.map(r=>l(JU,{entry:r},r.id))})}function JU({entry:e}){let t=xe(Fe),[o,n]=$t(t.threadKey,`work-fallback:${Ip(e)}`,!1),r=e.detail??e.command??e.rawCommand??e.toolLabel?.detail,a=e.toolMetadata?.source==="ycodium"?e.toolTitle??e.toolLabel?.name??e.label:e.label;return v("div",{children:[v("button",{type:"button","aria-expanded":o,className:V(li,e.tone==="error"?"text-destructive-foreground":"text-muted-foreground"),onClick:()=>n(!o),disabled:r===void 0,children:[l("span",{"aria-hidden":!0,className:V("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")}),l("span",{className:"chat-process-text min-w-0 flex-1 truncate",children:a}),r!==void 0?l(Tt,{"aria-hidden":!0,className:V("size-icon-1 shrink-0",!o&&"-rotate-90")}):null]}),o&&r!==void 0?l("pre",{className:"chat-tool-body mx-2 overflow-x-auto rounded-md bg-muted/40 p-2",children:r}):null]})}function ZU({row:e}){let t=xe(Fe);return l("div",{className:"min-w-0 px-1 py-0.5",children:l($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 e$=pe(function({row:t}){let o=xe(Fe),{t:n}=Ne(),[r,a]=$t(o.threadKey,`turn-plan:${t.id}`,!1),{steps:s}=t.turnPlan.plan,i=s.filter(m=>m.status==="completed").length,d=i===s.length,c=s.find(m=>m.status==="inProgress")?.step??s.find(m=>m.status==="pending")?.step??s.at(-1)?.step??n("proposedPlan.badge");return v("div",{className:"min-w-0 px-1 py-0.5",children:[v("button",{type:"button",className:"relative flex w-full min-w-0 cursor-[var(--control-cursor)] items-center gap-2 rounded-md px-0.5 py-0.5 text-left text-control-1 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:[l(r?Tt:yo,{className:"size-icon-1 shrink-0 text-muted-foreground/65"}),s.length>1?l("span",{"aria-hidden":!0,className:"flex shrink-0 items-center gap-0.5",children:s.map(m=>l("span",{className:V("h-[3px] w-2.5 rounded-full",m.status==="completed"?"bg-success":m.status==="inProgress"?"bg-primary":"bg-muted-foreground/25")},m.step))}):null,l("span",{className:V("min-w-0 truncate",d?"text-muted-foreground/65":"font-medium text-foreground/85"),children:c}),s.length>1?v("span",{className:"shrink-0 text-muted-foreground/50 tabular-nums",children:[i,"/",s.length]}):null]}),r?l("div",{className:"mt-0.5 space-y-px pl-6",children:s.map(m=>v("div",{className:"flex items-baseline gap-2 text-ui-sm",children:[l("span",{className:V("w-3 shrink-0 text-center font-mono text-chat-meta",m.status==="completed"?"text-success":m.status==="inProgress"?"text-primary":"text-muted-foreground/40"),"aria-hidden":!0,children:m.status==="completed"?"\u2713":m.status==="inProgress"?"\u25CF":"\u25CB"}),l("span",{className:V("min-w-0",m.status==="completed"?"text-muted-foreground/55":m.status==="inProgress"?"text-foreground/90":"text-muted-foreground/70"),children:m.step})]},m.step))}):null]})});$();var t$=e=>{let{latestTurn:t,latestReplyAt:o,continuationCheck:n}=e.getMeta().status;return n!=null?null:o||(t?.state==="completed"?t.completedAt:null)},o$=e=>e.getMeta().status.latestAssistantMessageId??null,n$=e=>e.getMeta().finalAssistantMessageReceived,YI=pe(function({rowsStore:t,useVisibleThreadCompletion:o,viewport:n,viewActive:r,threadKey:a,settledView:s,bottomInset:i}){let d=Wt(t,t$),c=Wt(t,o$),u=Wt(t,n$);return o({viewport:n,viewActive:r,threadKey:a,completedAt:s&&u?d:null,messageId:c,bottomInset:i}),null});$();var r$=[];function a$(){let e=Nt().i18n.usePluginTranslation();return R(t=>{let o=t.attachment;return o===void 0?t.text:o.count===1?o.name:e("forkRelations.attachmentPreview",o)},[e])}function JI({rowsStore:e,derive:t,paneVisible:o,routeThreadKey:n}){let r=R(u=>o?ZT(u,t):r$,[t,o]),a=Wt(e,r,eI),s=E(a);s.current=a;let i=$e(n,null,{namespace:"timeline-active-header"}),d=a.at(-1)??null,c=a$();return{turnHeaders:a,turnHeadersRef:s,activeTurnHeaderKeyRef:i,initialTurnHeader:d,headerLabel:c,hasTurnHeaders:d!==null,pinnedTurnHeaderRef:E(null),pinnedTurnHeaderTextRef:E(null)}}function ZI({turnHeadersRef:e,activeTurnHeaderKeyRef:t,pinnedTurnHeaderRef:o,pinnedTurnHeaderTextRef:n,headerLabel:r,jumpToTurnSection:a}){let s=E(!1),i=R(()=>{let f=t.current;return f===null?void 0:e.current.find(g=>g.sectionKey===f)},[t,e]),d=R(()=>{let f=o.current;if(!f)return;let g=i();f.dataset.visible=g!==void 0&&(g.inherited||s.current)?"true":"false"},[i,o]),c=R(()=>{let f=i();f&&n.current&&(n.current.textContent=r(f)),d()},[i,d,r,n]),u=R(f=>{f===null||f===t.current||(t.current=f,c())},[t,c]),m=R(f=>{s.current=f,d()},[d]),p=R(()=>{let f=i();f&&a({anchorRowId:f.anchorRowId})},[i,a]);return{applyActiveSection:u,applyActiveStartHidden:m,jumpToActiveTurn:p,writeActiveHeader:c}}function eS({paneVisible:e,turnHeaders:t,writeActiveHeader:o}){fe(()=>{e&&o()},[e,t,o])}$();function s$(e,t,o){let n=o-t;if(Math.abs(n)<1)return null;let r=Math.max(0,Math.min(e.scrollHeight-e.clientHeight,e.scrollTop+n));return Math.abs(r-e.scrollTop)<1?null:r}function tS(e){let{viewport:t,anchor:o,row:n,scrollToOffset:r}=e,a=o.getBoundingClientRect().top,s=!0,i=null,d=()=>{if(i=null,!s||!o.isConnected||!t.contains(o))return;let m=s$(t,a,o.getBoundingClientRect().top);m!==null&&r(m),a=o.getBoundingClientRect().top},c=()=>{s&&i===null&&(i=requestAnimationFrame(d))},u=typeof ResizeObserver>"u"?null:new ResizeObserver(c);return u?.observe(n),c(),{schedule:c,stop:()=>{s=!1,u?.disconnect(),i!==null&&cancelAnimationFrame(i),i=null}}}function oS(e){return Ge(e,!1,{namespace:"timeline-disclosure-reading"})}function nS({routeThreadKey:e,listRef:t,liveFollowEnabled:o,onDisclosureNavigation:n,rowsStore:r,setDisclosureReading:a}){let s=Qo(e,null),i=Qo(e,null),d=Qo(e,null);H(()=>()=>{i.current?.stop()},[]);let c=R(()=>{i.current?.stop(),i.current=null,s.current=null,a(!1)},[s,i,a]),u=R(f=>{n(),s.current=f,a(!0),i.current?.stop();let g=t.current?.node??null;if(!g)return;let h=Array.from(g.querySelectorAll("[data-timeline-row-id]")).find(x=>x.dataset.timelineRowId===f);if(!h)return;let y=d.current;i.current=tS({viewport:g,row:h,anchor:y&&h.contains(y)?y:h,scrollToOffset:x=>{g.scrollTop=x}})},[n]),m=$e(e,o,{namespace:"timeline-live-follow-previous"});fe(()=>{o&&!m.current&&c(),m.current=o},[o,c]);let p=R(f=>{let g=r.getRows().find(h=>h.id===f||h.kind==="work"&&h.groupedEntries.some(y=>y.id===f)||h.kind==="tool-group"&&h.entries.some(y=>y.id===f));u(g?.id??f)},[r,u]);return{disclosureButtonRef:d,releaseDisclosureAnchor:c,onProcessDisclosureChange:p}}$();var dh=1e4;function rS({routeThreadKey:e,routeThreadKeyRef:t,pagingBlockedRef:o,pagingBlockedByInteraction:n,loadEarlier:r,loadLater:a,hasHiddenOlder:s,visibleTurnSections:i,capturePrependAnchor:d,revealWindowRef:c,pendingNetworkPrependRef:u,turnSectionsRef:m}){let p=R(()=>{d(),c.current.revealOlder()},[d]),f=E(p);f.current=p;let g=E(s);g.current=s;let h=E(null),y=R(()=>{if(o.current||t.current!==e||r===null||r.loading)return;let C=i[0]?.key;C!==void 0&&(d(C),u.current={firstMountedSectionKey:C,loadingObserved:!1,sectionsWhileLoading:m.current,until:Date.now()+dh},r.onLoadEarlier())},[d,r,u,e,i]);h.current=r===null||r.loading||n?null:y;let x=R(()=>{o.current||t.current!==e||(d(),a?.onLoadLater())},[d,a,e]);return{revealOlderTurns:p,revealOlderTurnsRef:f,hasHiddenOlderRef:g,loadEarlierRef:h,handleLoadEarlier:y,handleLoadLater:x}}$();$();var Ya=3,ch=Ya;function aS(e){let[t,o]=Ge(e,Ya,{namespace:"timeline-reveal-window"}),n=R(()=>{o(i=>i+ch)},[o]),r=R(i=>{o(d=>i>d?i:d)},[o]),a=R(()=>{o(Ya)},[o]),s=R(i=>{o(d=>Math.min(d,Math.max(Ya,i)))},[o]);return{revealedCount:t,revealOlder:n,revealAtLeast:r,compactTo:s,reset:a}}$();function iS(e){return e!==null&&"tagName"in e&&"closest"in e}function er(e){return iS(e)?e.tagName==="INPUT"||e.tagName==="TEXTAREA"?!0:e.closest('[contenteditable]:not([contenteditable="false"])')!==null:!1}function lS(e){return iS(e)&&e.closest('button, a[href], summary, [role="button"], [role="menuitem"]')!==null}function Hd(e,t){if(!/^[1-9]$/.test(e))return null;let o=Number(e)-1;return o<t?o:null}function sS(e,t){let o=e.findIndex(n=>n.decision===t);return o===-1?null:{type:"respond",index:o}}function dS(e,t){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return null;switch(e.key){case"Enter":return sS(t,"accept");case"Escape":return sS(t,"cancel");case"ArrowDown":case"ArrowRight":return{type:"move",delta:1};case"ArrowUp":case"ArrowLeft":return{type:"move",delta:-1};default:{let o=Hd(e.key,t.length);return o===null?null:{type:"respond",index:o}}}}var Ci="h-4 min-w-3 bg-transparent px-0 text-ui-xs tabular-nums text-current opacity-70 pointer-coarse:hidden";var Ud=600;function uh(e,t){if(typeof Element>"u"||!(e instanceof Element))return!1;if(t===null||!t.contains(e))return!0;for(let o=e;o&&o!==t;){if(o instanceof HTMLElement&&o.scrollHeight>o.clientHeight&&o.scrollTop>0)return!0;o=o.parentElement}return!1}function cS({routeThreadKey:e,routeThreadKeyRef:t,paneVisibleRef:o,pagingBlockedRef:n,scrollRestorePendingRef:r,listRef:a,topRevealArmedRef:s,hasHiddenOlderRef:i,revealOlderTurnsRef:d,loadEarlierRef:c,networkPrependAwaitingUserNavigationRef:u,networkPrependScrollTopRef:m,topRevealTouchStartYRef:p,topRevealUserNavigationFrameRef:f}){let g=R(C=>{if(C>Ud){s.current=!0;return}if(s.current){if(s.current=!1,i.current){d.current();return}c.current?.()}},[s]),h=R(()=>{u.current&&(u.current=!1,m.current=null,s.current=!0)},[u,m,s]),y=R(()=>{if(f.current!==null||n.current||!o.current||t.current!==e||r.current)return!1;let C=a.current?.measure();return!C||C.scroll>2||C.contentLength-C.scrollLength-C.scroll<=2||!i.current&&c.current===null?!1:(u.current=!1,m.current=null,s.current=!0,f.current=requestAnimationFrame(()=>{f.current=null}),g(C.scroll),!0)},[g,u,m,e,r,s,f]);return{maybeRevealOlderOnScroll:g,rearmNetworkPrependForUserNavigation:h,continueTopRevealAtTopForUserNavigation:y,contentGestureHandlers:{onWheel:C=>{C.defaultPrevented||C.deltaY>=0||er(C.target)||uh(C.target,a.current?.node??null)||y()},onTouchStartCapture:C=>{p.current=C.touches[0]?.clientY??null},onTouchMove:C=>{let b=C.touches[0],L=p.current;C.defaultPrevented||er(C.target)||uh(C.target,a.current?.node??null)||b===void 0||L===null||b.clientY<=L||y()&&(p.current=null)},onTouchEndCapture:()=>{p.current=null},onTouchCancelCapture:()=>{p.current=null},onKeyDown:C=>{C.defaultPrevented||C.repeat||C.metaKey||C.ctrlKey||C.altKey||C.shiftKey||er(C.target)||uh(C.target,a.current?.node??null)||!["ArrowUp","PageUp","Home"].includes(C.key)||y()}}}}function uS({paneVisible:e,paneVisibleRef:t,loadLater:o,liveFollowEnabled:n,disclosureReading:r,restoreInProgress:a,loadEarlier:s,scrollNode:i,revealWindow:d,turnSections:c,followEnabledRef:u,compactionStateRef:m,compactionRef:p,prependAnchorRef:f,interactionRowsRef:g,revealWindowRef:h,topRevealArmedRef:y,capturePrependAnchor:x}){let C=e&&o===null&&n&&!r&&!a;return u.current=C,m.current={followEnabled:C,restoreInProgress:a,loadEarlier:s},H(()=>{if(!i||!e)return;let b=cw({root:i,minimumCount:Ya,keepAbovePx:Ud,canCompact:()=>{let L=m.current,w=f.current;return L.followEnabled&&g.current.length===0&&!L.restoreInProgress&&!L.loadEarlier?.loading&&!(w&&w.until>Date.now())&&h.current.revealedCount>Ya},onCompact:L=>{y.current=!0,x(),h.current.compactTo(L)}});return p.current=b,()=>{b.disconnect(),p.current=null}},[x,e,i]),H(()=>{p.current?.schedule()},[C,s?.loading,d.revealedCount,c.length]),H(()=>{if(!i||!e||typeof ResizeObserver>"u")return;let b=()=>{if(!t.current||!u.current)return;let k=i.scrollHeight-i.clientHeight;Math.abs(i.scrollTop-k)>.5&&(i.scrollTop=k)},L=new ResizeObserver(b);L.observe(i);let w=i.firstElementChild;return w&&L.observe(w),()=>L.disconnect()},[e,i]),{followEnabled:C}}$();function pS({hasHiddenOlder:e,loadEarlier:t,pagingBlockedByInteraction:o,topFadeEnabled:n,revealOlderTurns:r,handleLoadEarlier:a}){return W(()=>e?l(fI,{onReveal:r,fade:n}):t!==null?l(pI,{loading:t.loading,blocked:o,onLoadEarlier:a,fade:n}):n?uI:cI,[a,e,t,o,r,n])}$();$();function mS(e,t,o){let n=$e(e,o,{namespace:"timeline-last-requested-reveal"});return fe(()=>{n.current=o}),t&&o>=n.current}function fS(e,t,o,n){if(t<e.revealedCount)e.compactTo(t);else{if(t<=e.revealedCount)return;o?requestAnimationFrame(()=>setTimeout(()=>{n()&&e.revealAtLeast(t)},0)):e.revealAtLeast(t)}}function gS(e,t){return t.prefixMounted?"mounted":t.loading===null||t.now>e.until?"abandoned":t.loading?(e.loadingObserved=!0,e.sectionsWhileLoading=t.sections,"waiting"):e.loadingObserved?t.sections===e.sectionsWhileLoading?"waiting":"landed":"waiting"}var i$=new Set;function hS({routeThreadKey:e,routeThreadKeyRef:t,paneVisible:o,paneVisibleRef:n,listRef:r,scrollSnapshotRef:a,structure:s,loadLater:i,loadEarlier:d,liveFollowEnabled:c,disclosureReading:u,nativeSelectionRef:m,interactionRowsRef:p}){let f=s.sections,g=aS(e),h=E(g);h.current=g;let y=$e(e,!0,{namespace:"timeline-top-reveal-armed"}),x=$e(e,!1,{namespace:"timeline-network-prepend-awaiting-navigation"}),C=E(null),b=E(null);fe(()=>()=>{b.current!==null&&(cancelAnimationFrame(b.current),b.current=null)},[e,o]);let L=$e(e,null,{namespace:"timeline-network-prepend-scroll-top"}),w=$e(e,i$,{namespace:"timeline-mounted-section-keys",limit:3}),k=Qo(e,null),I=k.current,T=I===null?-1:f.findIndex(F=>F.key===I.firstMountedSectionKey),S=T>0?f.length-Math.max(0,T-ch):g.revealedCount,P=T>0?S:g.revealedCount,A=i!==null||!c||u||m.current||p.current.length>0,N=mS(e,c,P),B=aw(f.map(F=>F.key),w.current,P,A||N),{startIndex:O,hasHiddenOlder:j}=hw(f.length,B),U=W(()=>f.slice(O),[O,f]),D=I!==null&&T>0&&O<T,J=E(f);J.current=f,fe(()=>{if(!o)return;if(w.current=new Set(U.map(ee=>ee.key)),I!==null){let ee=gS(I,{prefixMounted:D,loading:d===null?null:d.loading,sections:f,now:Date.now()});ee!=="waiting"&&(k.current=null),ee==="mounted"&&(x.current=!0)}let F=e;fS(h.current,B,!A,()=>t.current===F)},[x,d,o,I,D,k,w,A,B,e,f,U]);let G=Qo(e,null),M=R((F=null)=>{if(!n.current)return;let ee=r.current?.node;ee&&(G.current={scrollHeight:ee.scrollHeight,scrollTop:ee.scrollTop,row:r.current?.measure()?.rowAtScroll()??null,firstMountedSectionKey:F,until:Date.now()+dh})},[G]),X=R(()=>{let F=G.current;if(F===null||F.firstMountedSectionKey===null||Date.now()>F.until)return;let ee=r.current?.node;if(!ee)return;let Y=a.current;F.scrollHeight=ee.scrollHeight,F.scrollTop=ee.scrollTop,F.row=Y?.threadKey===e?Y.anchor:null},[G,e,a]);return fe(()=>{if(!o)return;let F=G.current;if(!F)return;if(Date.now()>F.until){G.current=null;return}if(F.firstMountedSectionKey!==null&&k.current!==null)return;G.current=null;let ee=r.current?.node;if(ee){if(F.row){xp(ee,F.row.rowId);let Y=r.current?.measure()?.topOf(F.row.rowId);Y!=null&&(ee.scrollTop=Y+F.row.offsetPx)}else ee.scrollTop=F.scrollTop+(ee.scrollHeight-F.scrollHeight);D&&(L.current=ee.scrollTop)}},[L,o,I,D,O,s]),{revealWindow:g,revealWindowRef:h,topRevealArmedRef:y,networkPrependAwaitingUserNavigationRef:x,topRevealTouchStartYRef:C,topRevealUserNavigationFrameRef:b,networkPrependScrollTopRef:L,pendingNetworkPrependRef:k,hasHiddenOlder:j,visibleTurnSections:U,turnSectionsRef:J,prependAnchorRef:G,capturePrependAnchor:M,refreshPendingPrependAnchor:X}}$();function l$(e,t){let o=c=>c.replace(/\s+/g,""),n=o(t.text);if(n.length===0)return null;let r=(c,u)=>e.slice(Math.max(0,c-t.prefix.length),c)===t.prefix&&e.slice(u,u+t.suffix.length)===t.suffix;if(t.start<t.end&&t.end<=e.length&&o(e.slice(t.start,t.end))===n&&r(t.start,t.end))return{start:t.start,end:t.end};let a=Sd(t.text).trim(),s=[];for(let c=e.indexOf(a);c>=0;c=e.indexOf(a,c+1))s.push(c);let i=s.filter(c=>r(c,c+a.length)),d=i.length===1?i[0]:i.length===0&&s.length===1?s[0]:null;return d===null?null:{start:d,end:d+a.length}}function vS(e,t){let o=e.querySelector("[data-assistant-quote-body]")??Qu(e);if(o===null)return null;let n=[],r="",a=document.createTreeWalker(o,NodeFilter.SHOW_TEXT);for(let u=a.nextNode();u;u=a.nextNode()){let m=u.data;for(let p=0;p<m.length;p+=1){let f=/\s/.test(m[p]);f&&r.endsWith(" ")||(r+=f?" ":m[p],n.push({node:u,offset:p}))}}let s=l$(r,t);if(s===null)return null;let i=n[s.start],d=n[s.end-1];if(!i||!d)return null;let c=document.createRange();return c.setStart(i.node,i.offset),c.setEnd(d.node,d.offset+1),c}var ph="assistant-quote",yS=2400;function CS(e){let t=globalThis.CSS?.highlights,o=globalThis.Highlight;if(t&&o){let r=new o(e);t.set(ph,r),setTimeout(()=>{t.get(ph)===r&&t.delete(ph)},yS);return}let n=document.getSelection();n&&(n.removeAllRanges(),n.addRange(e),setTimeout(()=>{let r=n.rangeCount>0?n.getRangeAt(0):null;r&&r.compareBoundaryPoints(Range.START_TO_START,e)===0&&n.removeAllRanges()},yS))}var d$=20;function xS({routeThreadKey:e,routeThreadKeyRef:t,paneVisible:o,derive:n,rowsStore:r,structure:a,loadEarlier:s,loadEarlierRef:i,listRef:d,revealWindowRef:c,turnSectionsRef:u,scrollToRowWithRevealRef:m,onManualNavigation:p,releaseDisclosureAnchor:f,revealMessageRequest:g,onRevealMessageHandled:h,revealQuoteRequest:y,onRevealQuoteDone:x,messageReveal:C=null,onMessageRevealMissing:b,loadLater:L=null,onReturnToLatest:w,restoringHistory:k=!1,pagingBlockedByInteraction:I=!1,revealTurnRequest:T}){let S=E(!0);H(()=>(S.current=!0,()=>{S.current=!1}),[]);let P=E(o);P.current=o;let A=E(C?.request?.id??null);A.current=C?.request?.id??null;let N=E(null);H(()=>{let U=C?.request;if(!U||!C||!o)return;N.current?.id!==U.id&&(N.current={id:U.id,prepared:!1,latestRequested:!1,done:!1});let D=N.current;if(D.done)return;let G=r.getRows().some(X=>X.id===U.messageId);if(!D.prepared){if(C.pending||k||s?.loading||L?.loading||I)return;if(!G&&L!==null&&!C.unavailable){D.latestRequested||(D.latestRequested=!0,w?.());return}D.prepared=!0}let M=C.advance({found:G,ready:!C.pending&&!k,loading:s?.loading===!0,blocked:I,hasEarlier:!C.unavailable&&s!==null,windowKey:a.rowIds[0]??"empty"});if(M!=="wait"){if(f(),p(),M==="earlier"){i.current?.();return}if(D.done=!0,M==="missing"){b?.(),C.onHandled(U.id);return}c.current.revealAtLeast(ja(u.current,U.messageId,c.current.revealedCount)),requestAnimationFrame(()=>{if(S.current&&!(t.current!==e||N.current!==D)){if(!P.current||A.current!==U.id){D.done=!1;return}m.current(U.messageId,24),C.onHandled(U.id)}})}},[C,o,a,s,L,k,I,w,r,e,p,f,b]);let B=R(U=>{f(),p(),c.current.revealAtLeast(ja(u.current,U.anchorRowId,c.current.revealedCount));let D=e;requestAnimationFrame(()=>{t.current===D&&m.current(U.anchorRowId,24)})},[p,f,e]),O=E(void 0);H(()=>{if(!o||!T||O.current===T)return;let D=a.sections.find(J=>J.turnId===T.turnId)?.rowIds[0];D&&(O.current=T,B({anchorRowId:D}),T.onHandled?.())},[o,T,a,B]),H(()=>{if(g===null||!o)return;f(),p();let U=n.resolveToolGroupRevealRowId(r.getRows(),g.rowId);c.current.revealAtLeast(ja(u.current,U,c.current.revealedCount));let D=requestAnimationFrame(()=>{t.current===e&&(m.current(U,24),h?.())});return()=>cancelAnimationFrame(D)},[g,o,p,f,h,n,e,r]);let j=E(null);return H(()=>{if(y===null||!o)return;let U=j.current;if((U===null||U.request!==y)&&(U={request:y,pages:0,done:!1},j.current=U),U.done)return;let{quote:D}=y,J=D.messageId;if(!r.getRows().some(G=>G.id===J)){if(s?.loading)return;let G=i.current;if(G!==null&&U.pages<d$){U.pages+=1,G();return}U.done=!0,x?.("message-missing");return}U.done=!0,f(),p(),c.current.revealAtLeast(ja(u.current,J,c.current.revealedCount)),requestAnimationFrame(()=>{t.current===e&&(m.current(J,24),requestAnimationFrame(()=>{let G=d.current?.node?.querySelector(`[data-timeline-row-id="${CSS.escape(J)}"]`),M=G?vS(G,D):null,X=d.current?.node;if(M&&X){let F=M.getBoundingClientRect().top-X.getBoundingClientRect().top-X.clientHeight/3;d.current?.scrollToOffset(X.scrollTop+F)}M&&CS(M),x?.(M?"found":"passage-missing")}))})},[y,o,a,s,r,x,p,f,e]),{jumpToTurnSection:B}}$();function bS({timestampFormat:e,routeThreadKey:t,threadRef:o,markdownCwd:n,resolvedTheme:r,workspaceRoot:a,skills:s,environmentId:i,onForkFromUserMessage:d,onRestoreUnsentMessage:c,selfUserId:u,ownsUnsignedMessages:m,onImageExpand:p,onAttachmentDocumentOpen:f,onOpenFileDiff:g,onProcessDisclosureChange:h,agentPanelModel:y,onOpenAgents:x,onInterrupt:C,stopping:b,onRespondToDecision:L,scheduledWakes:w,onCancelScheduledWake:k,derive:I,SiteIcon:T,threadReferences:S,renderWorkGroup:P,renderToolCallDetail:A,onSavePlanToWorkspace:N,declaredToolTitles:B,toolPresentation:O,ToolSourceIcon:j,SessionMessageCard:U}){let D=W(()=>cp(s),[s]);return W(()=>({timestampFormat:e,threadKey:t,threadRef:o,markdownCwd:n,resolvedTheme:r,workspaceRoot:a,skills:s,skillIndex:D,activeThreadEnvironmentId:i,onForkFromUserMessage:d,onRestoreUnsentMessage:c,selfUserId:u,ownsUnsignedMessages:m,onImageExpand:p,onAttachmentDocumentOpen:f,onOpenFileDiff:g,onProcessDisclosureChange:h,agentPanelModel:y,onOpenAgents:x,onInterrupt:C,stopping:b,onRespondToDecision:L,scheduledWakes:w,onCancelScheduledWake:k,derive:I,SiteIcon:T,threadReferences:S,renderWorkGroup:P,renderToolCallDetail:A,onSavePlanToWorkspace:N,declaredToolTitles:B,toolPresentation:O,ToolSourceIcon:j,SessionMessageCard:U}),[e,t,o,n,r,a,s,D,i,d,c,u,m,p,f,g,h,y,x,C,b,L,w,k,I,T,S,P,A,N,B,O,j,U])}$();var c$=200;function wS({routeThreadKey:e,routeThreadKeyRef:t,paneVisible:o,paneVisibleRef:n,listRef:r,derive:a,contentInsetEndAdjustment:s,onIsAtEndChange:i,loadLater:d,restoreInProgress:c,rowCount:u,followingEndRef:m,scrollRestorePendingRef:p,laterLoadArmedRef:f,pagingBlockedRef:g,lastScrollAnchorSaveAtRef:h,networkPrependAwaitingUserNavigationRef:y,networkPrependScrollTopRef:x,cacheScrollSnapshot:C,persistScrollSnapshot:b,refreshPendingPrependAnchor:L,maybeRevealOlderOnScroll:w,rearmNetworkPrependForUserNavigation:k,handleLoadLater:I}){let T=R(()=>{if(!n.current||t.current!==e)return;let S=r.current?.measure();if(!S||p.current)return;C(S);let P=x.current;y.current&&P!==null&&Math.abs(S.scroll-P)>.5&&k(),L();let A=a.resolveIsAtEnd({contentLength:S.contentLength,scroll:S.scroll,scrollLength:S.scrollLength},s);A!==void 0&&i(d===null&&A);let N=S.contentLength-S.scrollLength-S.scroll;!m.current&&N>2&&w(S.scroll),N>Ud?f.current=!0:f.current&&d&&!d.loading&&!g.current&&(f.current=!1,I());let B=Date.now();B-h.current>=c$&&(h.current=B,b())},[C,s,a,w,i,b,L,e,d,f,I,y,x,k,p]);return H(()=>{if(!o)return;let S=requestAnimationFrame(T);return()=>cancelAnimationFrame(S)},[T,o,c,u]),{handleScroll:T}}$();function TS({routeThreadKey:e,routeThreadKeyRef:t,paneVisible:o,paneVisibleRef:n,revealRequestRef:r,listRef:a,scrollSnapshotRef:s,rowCount:i,structure:d,loadScrollAnchor:c,loadLater:u,restoringHistory:m,onManualNavigation:p,onIsAtEndChange:f,revealWindowRef:g,turnSectionsRef:h,followingEndRef:y,followEnabledRef:x,compactionStateRef:C,scrollRestorePendingRef:b,persistScrollSnapshot:L,captureFinalScrollSnapshot:w}){let k=$e(e,"cold",{namespace:"timeline-scroll-restore"});if(k.current===void 0||k.current==="cold"){let O=c(e);k.current=k.current==="cold"&&O===null?null:{anchor:O}}let[,I]=Na(O=>O+1,0),T=E(()=>{}),S=E(w);S.current=w;let P=$e(e,0,{namespace:"timeline-last-anchor-save"}),A=m||k.current!==null,N=k.current;b.current=A,fe(()=>{if(o)return()=>{t.current!==e?L():w(),k.current=void 0}},[o,e]),fe(()=>{if(!o||N==null)return;let O=N,j=()=>{let X=s.current,F=a.current?.node?.clientWidth;X?.threadKey===e&&F!==void 0&&(s.current={...X,viewportWidth:F}),k.current=null,b.current=!1,I()};if(r.current!==null){j();return}let U=null,D=null,J=()=>{!n.current||t.current!==e||(a.current?.scrollToEnd(),j(),y.current=u===null,x.current=u===null,C.current={...C.current,followEnabled:!0,restoreInProgress:!1},f(u===null))},G=O.anchor,M=G!==null&&h.current.some(X=>X.rowIds.includes(G.rowId));return G===null?U=requestAnimationFrame(J):M?U=requestAnimationFrame(()=>{!n.current||t.current!==e||(p(),g.current.revealAtLeast(ja(h.current,G.rowId,g.current.revealedCount)),D=requestAnimationFrame(()=>{!n.current||t.current!==e||(T.current(G.rowId,-G.offsetPx),j())}))}):i>0&&!m&&(U=requestAnimationFrame(J)),()=>{U!==null&&cancelAnimationFrame(U),D!==null&&cancelAnimationFrame(D)}},[c,u,f,p,o,N,e,i,m,d]),fe(()=>{if(!o||typeof ResizeObserver>"u")return;let O=a.current?.node;if(!O)return;let j=!0,U=O.clientWidth,D=new ResizeObserver(()=>{if(!j||!n.current||t.current!==e)return;let J=O.clientWidth;if(!(J>0)||J===U)return;U=J;let G=s.current;G===null||G.threadKey!==e||(s.current={...G,viewportWidth:J},!(b.current||y.current||G.anchor===null)&&(T.current(G.anchor.rowId,-G.anchor.offsetPx),S.current()))});return D.observe(O),()=>{j=!1,D.disconnect()}},[o,e]);let B=R((O,j)=>{if(!n.current)return;let U=a.current?.node;U&&(xp(U,O),a.current?.scrollToRow(O,{viewOffset:j}))},[]);return T.current=B,{restoreInProgress:A,lastScrollAnchorSaveAtRef:P,scrollToRowWithRevealRef:T}}$();function IS({routeThreadKey:e,listRef:t,followingEndRef:o,scrollRestorePendingRef:n,paneVisible:r,rowCount:a,derive:s,contentInsetEndAdjustment:i,saveScrollAnchor:d}){let c=$e(e,null,{namespace:"timeline-scroll-snapshot"}),u=$e(e,null,{namespace:"timeline-last-measured-scroll"}),m=R((g,h=o.current)=>{if(g.scrollLength<=0)return;let y=t.current?.node?.clientWidth,x=c.current;y!==void 0&&y>0&&x?.viewportWidth!==void 0&&x.viewportWidth>0&&y!==x.viewportWidth||(u.current=g.scroll,c.current={threadKey:e,anchor:iI({measurement:g,followingEnd:h}),...y===void 0?{}:{viewportWidth:y}})},[o,u,t,e,c]),p=R(()=>{let g=c.current;g&&d(g.threadKey,g.anchor)},[d,c]),f=R(()=>{if(!r||n.current)return;if(a===0){p();return}let g=t.current?.measure();if(g&&g.scrollLength>0){let h=u.current,y=h!==null&&Math.abs(g.scroll-h)>.5;m(g,o.current&&!(y&&s.resolveIsAtEnd(g,i)===!1)),p()}},[m,i,s,o,u,r,p,n,a]);return{scrollSnapshotRef:c,cacheScrollSnapshot:m,persistScrollSnapshot:p,captureFinalScrollSnapshot:f}}var mh="ycodium-select-all-copy";$();function u$(e,t){let o=e.detail;o===null||typeof o!="object"||!("text"in o)||(o.text=t)}function p$(e,t){let o=n=>{u$(n,t())};return e.addEventListener(mh,o),()=>e.removeEventListener(mh,o)}function SS({rowsStore:e}){let t=E(e);t.current=e;let o=E(null);return H(()=>{let n=o.current?.closest("[data-select-all-scope]");if(n!=null)return p$(n,()=>t.current.getMeta().exportApi.markdown())},[]),l("span",{ref:o,hidden:!0})}var kS=[],LS=()=>{},PS=()=>{};var RS=pe(function({derive:t,rowsStore:o,data:n,target:r,threadKey:a,threadRef:s,environmentId:i,onInterrupt:d=null,stopping:c=!1,onRespondToDecision:u=null,onCancelScheduledWake:m=null,agentPanelModel:p,onOpenAgents:f=LS,onOpenFileDiff:g,onForkFromUserMessage:h,onRestoreUnsentMessage:y=null,selfUserId:x=null,ownsUnsignedMessages:C=!0,onImageExpand:b,onAttachmentDocumentOpen:L,revealTurnRequest:w,markdownCwd:k,resolvedTheme:I,timestampFormat:T,workspaceRoot:S,skills:P=kS,onRowsChange:A,contentInsetEndAdjustment:N,liveFollowEnabled:B,awaitingUserDecision:O=!1,onIsAtEndChange:j,onManualNavigation:U,onDisclosureNavigation:D=U,topFadeEnabled:J=!1,scrollerRef:G,loadEarlier:M=null,loadLater:X=null,restoringHistory:F=!1,pagingBlockedByInteraction:ee=!1,onReturnToLatest:Y=null,onVisibleTurnRangeChange:ae=null,revealMessageRequest:te=null,messageReveal:de=null,onMessageRevealMissing:ge,onRevealMessageHandled:ne,revealQuoteRequest:Z=null,onRevealQuoteDone:ve,renderWorkGroup:he,renderToolCallDetail:Ae,loadScrollAnchor:De,saveScrollAnchor:je,useVisibleThreadCompletion:ot,onSavePlanToWorkspace:me,paneActive:Me,onTurnNavigatorChange:ue,declaredToolTitles:ce,threadSwitchStage:Ze=null}){let pt=Wt(o,hI),ze=vn(),et=E(ze);et.current=ze;let Et=E(te);Et.current=te;let[ft,Ct]=oS(a),gt=E(a);gt.current=a;let Dt=E(ee);Dt.current=ee;let Mt=$e(a,!0,{namespace:"timeline-following-end"});Mt.current=X===null&&B;let se=$e(a,!1,{namespace:"timeline-scroll-restore-pending"}),Le=$e(a,N,{namespace:"timeline-content-inset"}),be=E(null),Xe=Qo(a,[]),xt=Qo(a,!1),tt=E(null),It=E(null),po=R(()=>Xe.current,[Xe]),Ko=R(ht=>{Xe.current=ht,tt.current?.(),It.current?.schedule()},[Xe]),Qt=R(ht=>{xt.current=ht,It.current?.schedule()},[xt]),gn=R(ht=>{ht!==null&&(be.current=ht),G(ht)},[G]);fe(()=>{aI({timeline:be.current,previousOverlayHeight:Le.current,overlayHeight:N,followingEnd:ze&&X===null&&B&&!ft}),Le.current=N},[N,ft,B,X,ze]);let{disclosureButtonRef:At,releaseDisclosureAnchor:St,onProcessDisclosureChange:bt}=nS({routeThreadKey:a,listRef:be,liveFollowEnabled:B,onDisclosureNavigation:D,rowsStore:o,setDisclosureReading:Ct}),mo=yI(X!==null,ze),kt=tp(o),_t=kt.sections,Xt=kt.rowIds.length,nt=W(()=>si(o),[kt,o]),{scrollSnapshotRef:lt,cacheScrollSnapshot:Bt,persistScrollSnapshot:Ht,captureFinalScrollSnapshot:Yt}=IS({routeThreadKey:a,listRef:be,followingEndRef:Mt,scrollRestorePendingRef:se,paneVisible:ze,rowCount:Xt,derive:t,contentInsetEndAdjustment:N,saveScrollAnchor:je}),{revealWindow:qo,revealWindowRef:fo,topRevealArmedRef:go,networkPrependAwaitingUserNavigationRef:Jt,topRevealTouchStartYRef:Un,topRevealUserNavigationFrameRef:Ce,networkPrependScrollTopRef:Ue,pendingNetworkPrependRef:rt,hasHiddenOlder:Lt,visibleTurnSections:wt,turnSectionsRef:Ot,prependAnchorRef:Ro,capturePrependAnchor:on,refreshPendingPrependAnchor:Fr}=hS({routeThreadKey:a,routeThreadKeyRef:gt,paneVisible:ze,paneVisibleRef:et,listRef:be,scrollSnapshotRef:lt,structure:kt,loadLater:X,loadEarlier:M,liveFollowEnabled:B,disclosureReading:ft,nativeSelectionRef:xt,interactionRowsRef:Xe}),{revealOlderTurns:ka,revealOlderTurnsRef:As,hasHiddenOlderRef:dg,loadEarlierRef:ru,handleLoadEarlier:cg,handleLoadLater:au}=rS({routeThreadKey:a,routeThreadKeyRef:gt,pagingBlockedRef:Dt,pagingBlockedByInteraction:ee,loadEarlier:M,loadLater:X,hasHiddenOlder:Lt,visibleTurnSections:wt,capturePrependAnchor:on,revealWindowRef:fo,pendingNetworkPrependRef:rt,turnSectionsRef:Ot}),bl=E(!1),wl=E({followEnabled:!1,restoreInProgress:!1,loadEarlier:M}),{restoreInProgress:hn,lastScrollAnchorSaveAtRef:ug,scrollToRowWithRevealRef:Tl}=TS({routeThreadKey:a,routeThreadKeyRef:gt,paneVisible:ze,paneVisibleRef:et,revealRequestRef:Et,listRef:be,scrollSnapshotRef:lt,rowCount:Xt,structure:kt,loadScrollAnchor:De,loadLater:X,restoringHistory:F,onManualNavigation:U,onIsAtEndChange:j,revealWindowRef:fo,turnSectionsRef:Ot,followingEndRef:Mt,followEnabledRef:bl,compactionStateRef:wl,scrollRestorePendingRef:se,persistScrollSnapshot:Ht,captureFinalScrollSnapshot:Yt}),{jumpToTurnSection:Il}=xS({routeThreadKey:a,routeThreadKeyRef:gt,paneVisible:ze,derive:t,rowsStore:o,structure:kt,loadEarlier:M,loadEarlierRef:ru,listRef:be,revealWindowRef:fo,turnSectionsRef:Ot,scrollToRowWithRevealRef:Tl,onManualNavigation:U,releaseDisclosureAnchor:St,revealMessageRequest:te,messageReveal:de,onMessageRevealMissing:ge,loadLater:X,onReturnToLatest:Y,restoringHistory:hn||Ze!==null,pagingBlockedByInteraction:ee,onRevealMessageHandled:ne,revealQuoteRequest:Z,onRevealQuoteDone:ve,revealTurnRequest:w}),{turnHeaders:su,turnHeadersRef:pg,activeTurnHeaderKeyRef:iu,initialTurnHeader:lu,headerLabel:du,hasTurnHeaders:mg,pinnedTurnHeaderRef:Sl,pinnedTurnHeaderTextRef:$n}=JI({rowsStore:o,derive:t,paneVisible:ze,routeThreadKey:a}),[cu,Ns]=q(null),[kl,Ds]=q(null),{followEnabled:fg}=uS({paneVisible:ze,paneVisibleRef:et,loadLater:X,liveFollowEnabled:B,disclosureReading:ft,restoreInProgress:hn,loadEarlier:M,scrollNode:kl,revealWindow:qo,turnSections:_t,followEnabledRef:bl,compactionStateRef:wl,compactionRef:It,prependAnchorRef:Ro,interactionRowsRef:Xe,revealWindowRef:fo,topRevealArmedRef:go,capturePrependAnchor:on}),uu=kt.rowIds.at(-1)??null;H(()=>{A?.(uu)},[uu,A,a]);let Ll=$e(a,!0,{namespace:"timeline-later-load-armed"}),{maybeRevealOlderOnScroll:Pl,rearmNetworkPrependForUserNavigation:pu,continueTopRevealAtTopForUserNavigation:mu,contentGestureHandlers:gg}=cS({routeThreadKey:a,routeThreadKeyRef:gt,paneVisibleRef:et,pagingBlockedRef:Dt,scrollRestorePendingRef:se,listRef:be,topRevealArmedRef:go,hasHiddenOlderRef:dg,revealOlderTurnsRef:As,loadEarlierRef:ru,networkPrependAwaitingUserNavigationRef:Jt,networkPrependScrollTopRef:Ue,topRevealTouchStartYRef:Un,topRevealUserNavigationFrameRef:Ce}),{applyActiveSection:fu,applyActiveStartHidden:_s,jumpToActiveTurn:gu,writeActiveHeader:hu}=ZI({turnHeadersRef:pg,activeTurnHeaderKeyRef:iu,pinnedTurnHeaderRef:Sl,pinnedTurnHeaderTextRef:$n,headerLabel:du,jumpToTurnSection:Il}),La=uw({root:kl,topInsetPx:Zg,onActiveSectionChange:fu,onActiveStartHiddenChange:_s,active:ze}),Pa=W(()=>rw(_t),[_t]),hg=lw({root:kl,inputKey:a,visible:ze,index:Pa,topInset:mg?Zg:0,bottomInset:N,interactionRows:po,onRangeChange:ae,onSelectionChange:Qt});tt.current=hg,H(()=>{if(!ze){Ht();return}let ht=requestAnimationFrame(()=>{if(!et.current)return;let Fs=be.current?.node;Fs&&bl.current&&(Fs.scrollTop=Fs.scrollHeight-Fs.clientHeight),La.refresh()});return()=>cancelAnimationFrame(ht)},[Ht,La,ze]),eS({paneVisible:ze,turnHeaders:su,writeActiveHeader:hu});let Os=pS({hasHiddenOlder:Lt,loadEarlier:M,pagingBlockedByInteraction:ee,topFadeEnabled:J,revealOlderTurns:ka,handleLoadEarlier:cg}),{handleScroll:yu}=wS({routeThreadKey:a,routeThreadKeyRef:gt,paneVisible:ze,paneVisibleRef:et,listRef:be,derive:t,contentInsetEndAdjustment:N,onIsAtEndChange:j,loadLater:X,restoreInProgress:hn,rowCount:Xt,followingEndRef:Mt,scrollRestorePendingRef:se,laterLoadArmedRef:Ll,pagingBlockedRef:Dt,lastScrollAnchorSaveAtRef:ug,networkPrependAwaitingUserNavigationRef:Jt,networkPrependScrollTopRef:Ue,cacheScrollSnapshot:Bt,persistScrollSnapshot:Ht,refreshPendingPrependAnchor:Fr,maybeRevealOlderOnScroll:Pl,rearmNetworkPrependForUserNavigation:pu,handleLoadLater:au}),vu=n.useToolPresentation??PS,Ra=bS({timestampFormat:T,routeThreadKey:a,threadRef:s,markdownCwd:k,resolvedTheme:I,workspaceRoot:S,skills:P,environmentId:i,onForkFromUserMessage:h,onRestoreUnsentMessage:y,selfUserId:x,ownsUnsignedMessages:C,onImageExpand:b,onAttachmentDocumentOpen:L,onOpenFileDiff:g,onProcessDisclosureChange:bt,agentPanelModel:p,onOpenAgents:f,onInterrupt:d,stopping:c,onRespondToDecision:u,scheduledWakes:pt,onCancelScheduledWake:m,derive:t,SiteIcon:n.SiteIcon,toolPresentation:vu(r),ToolSourceIcon:n.ToolSourceIcon,SessionMessageCard:n.SessionMessageCard,threadReferences:n.threadReferences,renderWorkGroup:he,renderToolCallDetail:Ae,onSavePlanToWorkspace:me,declaredToolTitles:ce}),yg=R(ht=>l(XI,{rowsStore:o,rowId:ht}),[o]);return l(Fw,{data:n,target:r,children:l(Fe,{value:Ra,children:v(lI,{rowsStore:o,historyWindow:mo,children:[l(nI,{rowsStore:o,derive:t,paneVisible:ze,bottomInset:N,onSelect:Il,onTurnNavigatorChange:ue}),l(YI,{rowsStore:o,useVisibleThreadCompletion:ot,viewport:cu,viewActive:Me&&ze,threadKey:a,settledView:X===null&&!hn,bottomInset:N}),v("div",{ref:Ns,onClickCapture:ht=>{At.current=ht.target instanceof Element?ht.target.closest("button"):null},onWheelCapture:St,onTouchMoveCapture:St,onPointerDownCapture:ht=>{ht.target===be.current?.node&&(St(),mu())},onKeyDownCapture:ht=>{["ArrowUp","ArrowDown","PageUp","PageDown","Home","End"].includes(ht.key)&&St()},className:"chat-timeline relative h-full min-h-0",inert:Ze!==null,"aria-busy":Ze!==null?!0:void 0,"data-timeline-switch-hold":Ze??void 0,"data-awaiting-user-decision":O?"true":"false","data-disclosure-reading":ft?"true":void 0,"data-timeline-follow-end":fg?"true":"false","data-timeline-end-inset":N,children:[l(iw,{inputKey:a,onBeforeInputChange:Yt,handleRef:gn,onAttach:Ds,onInteractionRowsChange:Ko,onScroll:yu,className:V("scrollbar-gutter-both h-full min-h-0 overflow-y-auto overflow-x-hidden overscroll-y-contain px-3 sm:px-5",J&&"topbar-scroll-fade"),children:v("div",{"data-select-all-scope":"",style:{paddingBottom:N},...gg,children:[l(SS,{rowsStore:o}),Os,wt.map(ht=>l(dw,{sectionKey:ht.key,rowKeyPrefix:a,rowIds:ht.rowIds,renderRow:yg,sectionRef:La.observeSection(ht.key)},`${a}:${ht.key}`)),X?l(mI,{loading:X.loading,blocked:ee,onLoadLater:au,onReturnToLatest:Y}):null,gI]})}),Ze==="covered"?l(th,{}):nt?null:l(dI,{data:n,target:r}),lu!==null?l(GT,{ref:Sl,textRef:$n,initialText:du(lu),onJump:gu}):null]})]})})})});$();function ES(e){let[t,o]=q(null),n=E(null),r=t!==null&&t.toKey===e.threadKey?t:null;if(r===null&&!si(e.rowsStore)){let c=n.current;t!==null&&t.stage==="covered"?r={toKey:e.threadKey,stage:"covered"}:c!==null&&c.threadKey!==e.threadKey&&si(c.rowsStore)&&(r={toKey:e.threadKey,stage:"held",props:c})}r!==t&&o(r);let a=r!==null&&r.stage==="held"?r:null,s=a===null?e:a.props;fe(()=>{n.current=s});let i=R(()=>o(c=>c===null||c.stage!=="held"?c:{toKey:c.toKey,stage:"covered"}),[]),d=R(()=>o(c=>c===null||c.stage==="released"?c:{toKey:c.toKey,stage:"released"}),[]);return{props:s,stage:r===null||r.stage==="released"?null:r.stage,onSkeleton:i,onRelease:d}}function MS(e){let{onSkeleton:t,onRelease:o}=e,n=e.data.useThreadSyncPhase(e.target);tp(e.rowsStore);let r=n!=="loading"||si(e.rowsStore);return fe(()=>{r&&o()},[r,o]),H(()=>{if(r)return;let a=globalThis.setTimeout(t,wp);return()=>globalThis.clearTimeout(a)},[r,t]),null}$();var m$=new Set;function AS({data:e,target:t,threadKey:o,visible:n,rowsStore:r,derive:a,resolveModelBadge:s,disclosure:i,historyWindow:d}){let c=e.useChatTimeline({target:t,threadKey:o,visible:n}),u=e.useTurnStatus({target:t,threadKey:o,visible:n}),m=vn(),p=i.usePersistedExpandedTurnIds(o),[f,g]=Ge(o,m$,{namespace:"timeline-auto-expanded-turns"}),h=W(()=>a.resolveExpandedTurnIds(p??[],f),[f,a,p]),{latestTurn:y}=u,x=$e(o,y,{namespace:"timeline-latest-turn-previous"});H(()=>{let b=x.current;if(x.current=y,!(!y||b?.turnId===void 0)){if(y.turnId===b.turnId){b.state==="running"&&y.state==="interrupted"&&g(L=>{let w=new Set(L);return w.add(y.turnId),w});return}g(L=>{if(!L.has(b.turnId))return L;let w=new Set(L);return w.delete(b.turnId),w})}},[y]);let C=W(()=>({derive:a,timelineEntries:c.timelineEntries,activities:c.activities,turnSummaries:c.turnSummaries,status:u,expandedTurnIds:h,resolveModelBadge:s,historyWindow:d,usageByTurnId:c.usageByTurnId,exportApi:c.export}),[c.activities,c.export,c.timelineEntries,c.turnSummaries,c.usageByTurnId,a,h,d,s,u]);return(m||!r.hasInputs())&&r.setInputs(C),fe(()=>{r.flush()}),null}var NS=pe(function({data:t,target:o,threadKey:n,visible:r,...a}){let s=$e(n,null,{namespace:"timeline-rows-store",limit:3});s.current??=yw();let i=s.current,d=ES({...a,threadKey:n,rowsStore:i,data:t,target:o});return v(oe,{children:[l(AS,{data:t,target:o,threadKey:n,visible:r,rowsStore:i,derive:a.derive,resolveModelBadge:a.resolveModelBadge,disclosure:a.disclosure,historyWindow:(a.loadLater??null)!==null}),l(RS,{...d.props,threadSwitchStage:d.stage}),d.stage===null?null:l(MS,{data:t,target:o,rowsStore:i,onSkeleton:d.onSkeleton,onRelease:d.onRelease},n)]})});function DS({phase:e}){let{t}=z(),o=t(bp(e));return v("div",{"aria-label":o,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:[l(qr,{"aria-hidden":!0,className:"size-icon-2 shrink-0 text-muted-foreground"}),l("span",{className:"truncate",children:o})]})}function _S({data:e,target:t,bottomInset:o,showScrollToEnd:n,onScrollToEnd:r}){let{t:a}=z(),s=Tp(e.useThreadSyncPhase(t));return s===null&&!n?null:v("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:o+4},children:[s!==null?l(DS,{phase:s}):null,n?v(K,{onClick:r,className:"pointer-events-auto gap-1.5 rounded-full px-3 text-muted-foreground hover:text-foreground",size:"xs",variant:"glass",children:[l(Tt,{}),a("timeline.scrollToEnd")]}):null]})}$();function OS(){let e=!1;return{lock:()=>{e=!0},resume:()=>{e=!1},navigate:t=>!t||!e?!1:(e=!1,!0),isLocked:()=>e}}function FS(e){return e.requestedGeneration===e.currentGeneration&&e.mode==="following-end"&&!e.readingLocked}var f$=150,g$=16;function BS(e,t){typeof e=="function"?e(t):e&&(e.current=t)}function HS({inputKey:e,visible:t,endInset:o,derive:n,onReturnToLatest:r,controlRef:a}){let[s,i]=Ge(e,!0,{namespace:"timeline-live-follow-enabled"}),[d,c]=Ge(e,!1,{namespace:"timeline-show-scroll-to-end"}),u=Qo(e,null),[m,p]=Yb(e,null),f=R(F=>{u.current=F;let ee=F?.node??null;p(Y=>Y===ee?Y:ee)},[u,p]),g=$e(e,!0,{namespace:"timeline-is-at-end"}),h=Qo(e,null),y=R(()=>{h.current!==null&&clearTimeout(h.current),h.current=null},[h]),x=R(()=>{y(),h.current=setTimeout(()=>{h.current=null,c(!0)},f$)},[y,c,h]);H(()=>y,[y]);let C=R(()=>{let F=u.current?.measure();return F==null?void 0:{contentLength:F.contentLength,scroll:F.scroll,scrollLength:F.scrollLength}},[u]),b=$e(e,"following-end",{namespace:"timeline-scroll-mode"}),L=Zr(t);fe(()=>()=>L.cancel(),[L,e]);let w=$e(e,0,{namespace:"timeline-user-scroll-generation"}),k=$e(e,0,{namespace:"timeline-live-follow-generation"}),I=$e(e,OS,{namespace:"timeline-disclosure-reading-lock"}),T=$e(e,null,{namespace:"timeline-last-row-id"}),S=R(()=>{L.cancel(),w.current+=1,b.current="free-scrolling",k.current=null,i(!1)},[L,k,b,i,w]),P=R(()=>{I.current.lock(),S(),g.current=!1,y(),c(!0)},[y,g,S,I,c]),A=E(S);A.current=S;let N=R(()=>{let F=u.current?.measure(),ee=T.current;if(!F||ee===null)return!1;let Y=sI(F,ee);return Y===null?!1:Y>Math.max(0,F.scrollLength-o-g$)},[o,u,T]),B=R(F=>{I.current.resume();let ee=++w.current;g.current=!0,b.current="following-end",k.current=w.current,i(!0),y(),c(!1),L.request(()=>{FS({requestedGeneration:ee,currentGeneration:w.current,mode:b.current,readingLocked:I.current.isLocked()})&&u.current?.scrollToEnd({animated:F})})},[y,L,u,g,k,I,b,i,c,w]),O=E(r);O.current=r;let j=R((F=!1)=>{let ee=O.current;if(ee){ee(()=>B(F));return}B(F)},[B]),U=R(()=>j(!0),[j]),D=R(()=>{I.current.navigate(!0)&&(g.current=!1,n.resolveIsAtEnd(C(),o)===!0&&j())},[n,o,g,C,I,j]);H(()=>{if(!t||m===null)return;let F=null,ee=requestAnimationFrame(()=>{let Y=()=>{A.current()},ae=ue=>{let ce=ue instanceof Element?ue:null;for(;ce&&ce!==m;){if(ce instanceof HTMLElement&&ce.scrollHeight>ce.clientHeight+1&&ce.scrollTop+ce.clientHeight<ce.scrollHeight-1&&/auto|scroll/u.test(getComputedStyle(ce).overflowY))return!1;ce=ce.parentElement}return ce===m},te=ue=>{I.current.isLocked()&&ae(ue)&&D()},de=null,ge=!1,ne=m.scrollTop,Z=ue=>{de=ue.touches[0]?.clientY??null},ve=()=>{de=null,ge=!1},he=()=>{let ue=m.scrollTop;ge&&ue>ne&&te(m),ne=ue},Ae=()=>N(),De=()=>n.resolveIsAtEnd(C(),o)===!1,je=ue=>{ue.deltaY>0&&te(ue.target),ue.deltaY<0&&Ae()&&Y()},ot=ue=>{let ce=ue.touches[0]?.clientY??null,Ze=de!==null&&ce!==null&&ce<de;de=ce,De()&&Y(),Ze&&te(ue.target)},me=ue=>{if(ue.target===m){ge=!0,ne=m.scrollTop,Ae()&&Y();return}De()&&Y()},Me=ue=>{if(!(ue.target instanceof Element?ue.target:null)?.closest("input, textarea, select, [contenteditable='true'], button, [role='button']"))switch(ue.key){case"PageUp":case"Home":case"ArrowUp":Ae()&&Y();break;case"PageDown":case"End":case"ArrowDown":te(ue.target);break;case" ":ue.shiftKey||te(ue.target);break;default:break}};m.addEventListener("wheel",je,{passive:!0}),m.addEventListener("touchmove",ot,{passive:!0}),m.addEventListener("touchstart",Z,{passive:!0}),m.addEventListener("touchend",ve,{passive:!0}),m.addEventListener("touchcancel",ve,{passive:!0}),m.addEventListener("scroll",he,{passive:!0}),window.addEventListener("pointerup",ve,{passive:!0}),window.addEventListener("pointercancel",ve,{passive:!0}),m.addEventListener("pointerdown",me,{passive:!0}),m.addEventListener("keydown",Me),F=()=>{m.removeEventListener("wheel",je),m.removeEventListener("touchmove",ot),m.removeEventListener("touchstart",Z),m.removeEventListener("touchend",ve),m.removeEventListener("touchcancel",ve),m.removeEventListener("scroll",he),window.removeEventListener("pointerup",ve),window.removeEventListener("pointercancel",ve),m.removeEventListener("pointerdown",me),m.removeEventListener("keydown",Me)}});return()=>{cancelAnimationFrame(ee),F?.()}},[N,n,o,e,C,I,D,m,t]);let J=R(F=>{T.current=F},[T]),G=R(F=>{if(I.current.isLocked()){g.current=!1,y(),c(!0);return}if(!F&&k.current===w.current){y(),c(!1);return}g.current!==F&&(g.current=F,F?(b.current="following-end",k.current=w.current,i(!0),y(),c(!1)):(b.current="free-scrolling",k.current=null,x()))},[y,g,k,I,x,b,i,c,w]),M=E(j);M.current=j;let X=W(()=>({followEnd:F=>M.current(F?.animated??!1)}),[]);return fe(()=>(BS(a,X),()=>BS(a,null)),[X,a]),{liveFollowEnabled:s,showScrollToEnd:d,bindTimelineHandle:f,onRowsChange:J,onIsAtEndChange:G,onManualNavigation:S,onDisclosureNavigation:P,returnToEnd:U}}$();$();$();var US=pe(function({group:t,expanded:o,onToggle:n,disabled:r,highlighted:a,callCounts:s,sourceFiltered:i=!1,...d}){let{t:c}=z(),u=t.items.flatMap(p=>p.kind==="step"?[p.row]:p.rows).find(p=>p.kind==="user-message"),m=t.summary?.state;return l(Gr,{value:t.id,children:l(Jr,{"data-trajectory-row-id":t.id,"data-timeline-row-id":t.id,"data-turn-group-header":t.turnId??"unassigned",tabIndex:-1,className:V("bg-muted/25 hover:bg-muted/25",a&&"outline-2 outline-primary"),children:v(bn,{colSpan:6,className:"whitespace-normal px-2 py-2",children:[v("div",{className:"flex min-w-0 items-start gap-2",children:[v(K,{variant:"ghost",size:"sm",className:"h-auto min-w-0 flex-1 justify-start px-1 py-1 text-left whitespace-normal",disabled:r,"aria-expanded":o,onClick:()=>n(t.id),title:c(o?"turnOverview.collapseTurn":"turnOverview.expandTurn"),children:[o?l(Tt,{className:"size-4 shrink-0","aria-hidden":!0}):l(yo,{className:"size-4 shrink-0","aria-hidden":!0}),l("span",{className:"min-w-0",children:u?.summary||c(t.turnId===null?"turnOverview.unassigned":"turnOverview.turn")})]}),t.summary?l(ju,{summary:t.summary}):null,m==="error"||m==="interrupted"?l("span",{className:"shrink-0 py-1 text-xs text-destructive-foreground",children:c(m==="error"?"trajectory.status.failed":"trajectory.status.stopped")}):null]}),v("div",{className:"flex flex-wrap gap-x-3 gap-y-1 pl-5 text-xs text-muted-foreground","data-trajectory-call-counts":!0,children:[s?v(oe,{children:[l("span",{children:i?c("trajectory.sourceFilter.matchedCalls",{matched:s.matchedCalls,total:s.totalCalls}):c("trajectory.sourceFilter.totalCalls",{count:s.totalCalls})}),l("span",{children:i?c("trajectory.sourceFilter.matchedFailedCalls",{count:s.matchedFailedCalls}):c("trajectory.sourceFilter.failedCalls",{count:s.failedCalls})})]}):null,i?l("span",{children:c("trajectory.sourceFilter.hiddenSteps")}):null]}),t.summary?l("div",{className:"pl-5",children:l(Gu,{summary:t.summary,...d})}):null]})})})});function $S({id:e,count:t,expanded:o,onToggle:n,disabled:r}){let{t:a}=z();return l(Jr,{"data-trajectory-row-id":e,"data-timeline-row-id":e,tabIndex:-1,"data-routine-group":e,children:l(bn,{colSpan:6,className:"px-3 py-1",children:v(K,{variant:"ghost",size:"xs","aria-expanded":o,disabled:r,onClick:n,children:[o?l(Tt,{"aria-hidden":!0}):l(yo,{"aria-hidden":!0}),a("turnOverview.routineSteps",{count:t})]})})})}$();$();var fh="max-h-80 overflow-auto rounded-md bg-muted/40 p-3 font-mono text-xs break-words whitespace-pre-wrap";function KS({useToolCallDetail:e,threadRef:t,toolCallId:o,turnId:n,fallback:r,revision:a,rewritten:s}){let{t:i}=z(),[d,c]=q(!1),u=e===void 0?null:e({threadRef:t,toolCallId:o,turnId:n??null,revision:a??r??"initial",...d?{original:!0}:{}}),m=u===null?[]:[u.input,u.output].filter(f=>f!==void 0&&f.length>0),p=u?.input!==void 0&&u?.output!==void 0?m.join(`
3542
3542
 
3543
3543
  `):[r,...m].filter(Boolean).join(`
3544
3544
 
3545
- `);return p.length===0&&!s?null:v("div",{className:"space-y-2",children:[s?v(Fu,{value:[d?"original":"received"],onValueChange:f=>{f[0]&&c(f[0]==="original")},"aria-label":i("toolCall.output"),children:[l(Xr,{value:"received",children:i("toolCall.agentReceived")}),l(Xr,{value:"original",children:i("toolCall.originalResult")})]}):null,l("pre",{className:fh,children:d?u?.original:p}),d&&u?.originalLoading?l("p",{role:"status",children:i("toolCall.originalLoading")}):null,d&&u?.originalTruncated?l("p",{children:i("toolCall.originalRetained")}):null,d&&u?.originalFailed?l("p",{role:"alert",children:i("toolCall.originalLoadFailed")}):null,d&&u?.loadMoreOriginal?l(K,{size:"sm",onClick:u.loadMoreOriginal,children:i("toolCall.originalMore")}):null]})}function zS({row:e,environmentId:t,presentation:o}){let{t:n}=z();if(e.childThread!==void 0)return l(yd,{threadRef:{environmentId:t,threadId:e.childThread.threadId},fallbackName:e.childThread.fallbackName,showStatus:!1});let r=e.communication?.to;if(e.communication===void 0)return e.kind==="communication"?l("span",{className:"break-words",children:n("trajectory.communication.sentTo",{name:n("trajectory.communication.unknownRecipient")})}):o!=null?l(Bd,{presentation:o,fallback:e.summary,environmentId:t}):l("span",{className:"break-words",children:e.kind==="tool-call"&&(e.source==="ycodium"||e.builtinMcpTool!==void 0)?e.toolName??n("trajectory.kinds.tool-call"):e.summary});if(r?.kind==="thread"){let[s="",i=""]=n("trajectory.communication.sentTo",{name:""}).split("");return v("span",{className:"break-words",children:[s,l(yd,{threadRef:{environmentId:t,threadId:r.threadId},fallbackName:r.title??void 0,showStatus:!1}),i]})}let a=r==null?n("trajectory.communication.unknownRecipient"):r.kind==="work-item"?n("trajectory.communication.workItem"):r.displayName;return l("span",{className:"break-words",children:n("trajectory.communication.sentTo",{name:a})})}var m$={replied:"trajectory.communication.phase.replied","picked-up":"trajectory.communication.phase.pickedUp",processed:"trajectory.communication.phase.processed",waiting:"trajectory.communication.phase.waiting",unknown:"trajectory.communication.phase.unknown",recorded:"trajectory.communication.phase.recorded",withdrawn:"trajectory.communication.phase.withdrawn",deleted:"trajectory.communication.phase.deleted"},US={withdrawn:"trajectory.communication.body.withdrawn",deleted:"trajectory.communication.body.deleted",unavailable:"trajectory.communication.body.unavailable"};function KS({useCommunicationRecord:e,recordId:t,fallback:o,timestampFormat:n}){let{t:r}=z(),a=e===void 0?null:e(t);if(a===null)return o===void 0?null:l("pre",{className:fh,children:o});if(typeof a=="string")return l("span",{className:"px-1 text-xs text-muted-foreground","data-trajectory-communication":a,children:r(a==="unreadable"?US.unavailable:a==="environment-outdated"?"trajectory.communication.environmentOutdated":a==="client-outdated"?"trajectory.communication.updateRequired":"trajectory.communication.notReceived")});let s=r(m$[a.phase]);return v("div",{className:"flex flex-col gap-1.5","data-trajectory-communication":a.recordId,children:[a.incomplete?l("span",{className:"px-1 text-xs text-muted-foreground",children:r("trajectory.communication.incomplete")}):null,a.bodyState==="present"?l("pre",{className:fh,children:a.text}):l("span",{className:"px-1 text-xs text-muted-foreground",children:r(US[a.bodyState])}),l("span",{className:"px-1 text-xs text-muted-foreground",children:a.phaseAt===null?s:`${s} ${Jn(a.phaseAt,n,r)}`})]})}var qS=pe(function({environmentId:t,toolPresentation:o,row:n,inputKey:r,expanded:a,highlighted:s,toggleExpanded:i,resolveChatAnchorMessageId:d,onOpenInChat:c,timestampFormat:u,threadRef:m,useToolCallDetail:p,useCommunicationRecord:f}){let{t:g}=z(),{formatDuration:h}=_o(),y=W(()=>n.kind==="tool-call"?{toolMetadata:{source:n.source??"unknown",toolName:n.toolName,pluginId:n.pluginId,mcpServer:n.mcpServer,action:n.action,skillName:n.skillName},builtinMcpTool:n.builtinMcpTool,toolArgs:n.toolArgs}:void 0,[n]),x=y===void 0?null:o?.(y)??null,C=n.detail!==void 0||n.toolCallId!==void 0,b=d(n);return l(Gr,{value:n.id,children:[v(Jr,{"data-trajectory-row-id":n.id,"data-timeline-row-id":n.id,tabIndex:-1,className:V(C&&"cursor-pointer",s&&"outline-2 outline-primary"),onClick:C?()=>i(n.id):void 0,children:[l(bn,{className:"whitespace-nowrap text-muted-foreground",title:wn(n.createdAt,u,g),children:Jn(n.createdAt,u,g)}),l(bn,{className:"whitespace-nowrap",children:g(`trajectory.kinds.${n.kind}`)}),v(bn,{className:"max-w-0 whitespace-normal",children:[v("span",{className:"inline-flex items-start gap-1",children:[C?l(K,{size:"xs",variant:"ghost",className:"mt-0.5 size-4 min-w-4 shrink-0 px-0","aria-label":g(a?"trajectory.collapseRow":"trajectory.expandRow"),"aria-expanded":a,onClick:L=>{L.stopPropagation(),i(n.id)},children:a?l(Tt,{"aria-hidden":!0}):l(yo,{"aria-hidden":!0})}):null,l(zS,{row:n,environmentId:t,presentation:x})]}),n.kind==="tool-call"?v("span",{className:"ml-2 inline-flex flex-wrap gap-x-2 text-xs text-muted-foreground","data-trajectory-source":!0,children:[l("span",{children:g(`trajectory.sources.${n.source??"unknown"}`)}),n.source==="plugin"&&n.pluginId?l(Mo,{environmentId:t,pluginId:n.pluginId,iconClassName:"size-3"}):null,n.source==="mcp"&&n.mcpServer?l("span",{children:n.mcpServer}):null,n.action==="skill-read"?l("span",{children:n.skillName?g("trajectory.sourceFilter.skillReadNamed",{name:n.skillName}):g("trajectory.sourceFilter.skillRead")}):null]}):null]}),v(bn,{className:"whitespace-nowrap",children:[g(`trajectory.status.${n.status}`),n.rewrittenBy?.length?l(Od,{plugins:n.rewrittenBy,environmentId:t}):null]}),l(bn,{className:"whitespace-nowrap text-muted-foreground",children:n.durationMs!==void 0?h(n.durationMs):g("trajectory.valueUnknown")}),l(bn,{className:"whitespace-nowrap",children:b!==null?v(Pe,{children:[l(Ee,{render:l(K,{size:"xs",variant:"ghost","aria-label":g("trajectory.openInChat"),onClick:L=>{L.stopPropagation(),c(b)}}),children:l($a,{"aria-hidden":!0})}),l(Re,{side:"top",children:g("trajectory.openInChat")})]}):null})]},`${r}:${n.id}`),a&&C?l(Jr,{className:"hover:bg-transparent","data-trajectory-detail-row":n.id,"data-timeline-row-id":n.id,children:v(bn,{colSpan:6,className:"whitespace-normal",children:[l("div",{className:"px-2 py-1 text-xs font-medium text-muted-foreground",children:g("trajectory.detailTitle")}),n.kind==="tool-call"&&n.toolCallId!==void 0?l($S,{threadRef:m,rewritten:(n.rewrittenBy?.length??0)>0,useToolCallDetail:p,toolCallId:n.toolCallId,turnId:n.turnId,fallback:n.detail,revision:`${n.status}:${n.updatedActivityId??n.activityId??n.id}`}):n.communication!==void 0?l(KS,{useCommunicationRecord:f,recordId:n.communication.recordId,fallback:n.detail,timestampFormat:u}):n.detail!==void 0?l("pre",{className:"max-h-80 overflow-auto rounded-md bg-muted/40 p-3 font-mono text-xs break-words whitespace-pre-wrap",children:n.detail}):null]})},`${r}:${n.id}:detail`):null]},`${r}:${n.id}:owner`)});var WS=["user-message","assistant-message","reasoning","tool-call","approval","user-input","compaction","retry","session","turn-intent","scheduled-wake","communication","delegation","task","event"];$();var Mp=class extends ur{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 gh(e){let t=e.getBoundingClientRect();if(e.clientHeight<=0||t.height<=0)return[];let o=e.querySelector("thead"),n=t.top+(o?.getBoundingClientRect().height??0),r=e.querySelectorAll("[data-trajectory-chunk]"),a=Ga(r,n),s=[];if(a<0)return s;for(let i=a;i<r.length;i+=1){let d=r[i];if(d.getBoundingClientRect().top>=t.bottom)break;let c=d.querySelectorAll("[data-timeline-row-id]"),u=Ga(c,n);if(!(u<0))for(let m=u;m<c.length;m++){let p=c[m];if(p.getBoundingClientRect().top>=t.bottom)break;s.push(p)}}return s}function Ap(e){return e?.source!==void 0||e?.pluginId!==void 0||e?.mcpServer!==void 0}function GS(e,t){if(t==="all")return e;let o=new Set(e.filter(n=>n.kind===t).map(n=>n.turnId??null));return e.filter(n=>n.kind===t||o.has(n.turnId??null)&&(n.kind==="user-message"||n.kind==="assistant-message"))}var f$=["native","ycodium","plugin","mcp","unknown"];function jS(e){let{t}=z(),o=Xn(e.environmentId,e.detail);return e.source!=="plugin"?l(oe,{children:e.detail}):o===null?l(oe,{children:t("trajectory.sources.plugin")}):l(Mo,{environmentId:e.environmentId,pluginId:e.detail})}function VS({environmentId:e,filter:t,query:o,onChange:n}){let{t:r}=z(),a=Ap(t),s=t?.source,i=s==="plugin"?"pluginId":s==="mcp"?"mcpServer":null,d=i===null?void 0:t?.[i],c=i===null?[]:[...new Set(o.sources.flatMap(u=>u.source===s&&u[i]!==void 0?[u[i]]:[]))];return d!==void 0&&!c.includes(d)&&c.push(d),v("div",{className:"flex flex-wrap items-center gap-1 border-b border-border px-3 py-1.5",children:[v("div",{role:"group","aria-label":r("trajectory.sourceFilter.label"),className:"flex flex-wrap items-center gap-1",children:[l(K,{size:"xs",variant:a?"ghost":"secondary","aria-pressed":!a,onClick:()=>n({}),children:r("trajectory.sourceFilter.all")}),f$.filter(u=>u===s||o.sources.some(m=>m.source===u)).map(u=>l(K,{size:"xs",variant:s===u?"secondary":"ghost","aria-pressed":s===u,onClick:()=>n({source:u}),children:r(`trajectory.sources.${u}`)},u))]}),i!==null?v(Xs,{value:d===void 0?"all":`detail:${d}`,onValueChange:u=>{u===null||s===void 0||n(u==="all"?{source:s}:{source:s,[i]:u.slice(7)})},children:[l(kb,{size:"xs",className:"max-w-full","aria-label":r(s==="plugin"?"trajectory.sourceFilter.plugin":"trajectory.sourceFilter.mcp"),children:d!==void 0&&s!==void 0?l(jS,{environmentId:e,source:s,detail:d}):r(s==="plugin"?"trajectory.sourceFilter.allPlugins":"trajectory.sourceFilter.allMcp")}),v(Ys,{children:[l(qa,{value:"all",children:r(s==="plugin"?"trajectory.sourceFilter.allPlugins":"trajectory.sourceFilter.allMcp")}),c.map(u=>l(qa,{value:`detail:${u}`,children:s===void 0?u:l(jS,{environmentId:e,source:s,detail:u})},u))]})]}):null,a?l(K,{size:"xs",variant:"ghost",onClick:()=>n({}),children:r("trajectory.sourceFilter.clear")}):null,o.loading?l("span",{role:"status",className:"text-xs text-muted-foreground",children:r("trajectory.sourceFilter.loading")}):null,o.error!==null?v("div",{role:"alert",className:"flex flex-wrap items-center gap-1 text-xs text-destructive-foreground",children:[l("span",{children:r("trajectory.sourceFilter.error",{error:o.error})}),l(K,{size:"xs",variant:"outline",disabled:o.loading,onClick:()=>o.retry(),children:r("trajectory.sourceFilter.retry")})]}):null]})}var QS=50,g$=32;function h$(e){let t=[];for(let o=0;o<e.length;o+=QS)t.push(e.slice(o,o+QS));return t}var XS=pe(function({environmentId:t="",toolPresentation:o,inputKey:n,rows:r,groupRows:a,sourceQuery:s,toolFilter:i,onToolFilterChange:d,onOpenFileDiff:c,loadEarlier:u,loadLater:m=null,pagingBlockedByInteraction:p=!1,onReturnToLatest:f=null,onVisibleTurnRangeChange:g=null,timestampFormat:h,contentInsetEndAdjustment:y=0,paneVisible:x,useToolCallDetail:C,useCommunicationRecord:b,threadRef:L,resolveChatAnchorMessageId:w,onOpenInChat:k}){let{t:I}=z(),T=Ap(i),S=T?JSON.stringify([n,i?.source,i?.pluginId,i?.mcpServer]):n,[P,A]=Ge(n,"all",{namespace:"trajectory-kind-filter"}),[N,B]=Ge(n,()=>new Set,{namespace:"trajectory-expanded-rows"}),[O,j]=Ge(n,!0,{namespace:"trajectory-follow-latest"}),U=W(()=>{let se=new Set(r.map(Le=>Le.kind));return WS.filter(Le=>se.has(Le))},[r]),D=W(()=>GS(r,P),[r,P]),J=E(null),G=E(!1);fe(()=>{G.current=!1},[S]);let M=R(()=>{A("all"),T&&d?.({})},[A,T,d]),X=Yb({inputKey:n,rows:D,groupRows:a,paneVisible:x,resetFilter:M}),F=X.rows,ee=W(()=>h$(F),[F]),Y=se=>B(Le=>{let be=new Set(Le);return be.has(se)?be.delete(se):be.add(se),be}),ae=E(null),te=R(se=>{J.current=se,se&&(ae.current=se)},[]),de=$e(S,!0,{namespace:"trajectory-at-end"}),ge=$e(S,0,{namespace:"trajectory-scroll-top"}),ne=$e(S,null,{namespace:"trajectory-row-anchor"}),Z=E({viewportKey:S,paneVisible:x,pagingBlockedByInteraction:p});Z.current={viewportKey:S,paneVisible:x,pagingBlockedByInteraction:p};let ve=E(null);fe(()=>{if(ve.current=null,!!x)return()=>{ve.current=null,g?.(null)}},[S,x,g]);let he=W(()=>({inputKey:n,store:hd()}),[n]),Ae=E(he);Ae.current=he;let De=E(()=>{}),je=R(se=>{let Le=Ae.current;return Le.store.acquire(se,()=>{Ae.current===Le&&De.current()})},[]),ot=W(()=>{let se=F.map((Le,be)=>({key:Le.id,turnId:Le.turnId??null,firstRowIndex:be,endRowIndex:be+1}));return{sections:se,bySectionKey:new Map(se.map(Le=>[Le.key,Le])),byRowId:new Map(se.map(Le=>[Le.key,{turnId:Le.turnId,index:Le.firstRowIndex}]))}},[F]),me=R((se,Le)=>Array.from(se.querySelectorAll("[data-trajectory-row-id]")).find(be=>be.dataset.trajectoryRowId===Le),[]),Me=R((se,Le)=>{let be=Le[0]?.dataset.timelineRowId,Xe=be===void 0?void 0:me(se,be);Xe&&be!==void 0&&(ne.current={rowId:be,offset:se.getBoundingClientRect().top-Xe.getBoundingClientRect().top})},[me,ne]),ue=R(()=>{if(!x)return;let se=J.current??ae.current;se&&(ge.current=se.scrollTop,de.current=se.scrollHeight-se.scrollTop-se.clientHeight<=g$,F.length>0&&Me(se,gh(se)))},[de,F.length,x,Me,ge]),ce=R(()=>Z.current.viewportKey===S&&Z.current.paneVisible,[S]),Ze=R(()=>{if(!ce()||g===null)return;let se=J.current;if(!se||se.clientHeight<=0)return;let Le=gh(se);Me(se,Le);let be=he.store.rows(),Xe=se.ownerDocument.activeElement;if(ai(Xe)){let It=ri(Xe,se);It&&be.push(It)}let xt=Ju({index:ot,visibleSectionKeys:Le.flatMap(It=>{let po=It.dataset.timelineRowId;return po===void 0?[]:[po]}),protectedRowIds:be,selectionRows:Zu(se)}),tt=JSON.stringify(xt);ve.current!==tt&&(ve.current=tt,g(xt))},[he,ce,g,ot,Me]),pt=Zr(x),ze=R(()=>{ce()&&g!==null&&pt.request(Ze)},[ce,g,pt,Ze]);De.current=ze;let et=R(se=>{let Le=ne.current,be=Le===null?void 0:me(se,Le.rowId),Xe=be?.closest("[data-trajectory-chunk]"),xt=Xe?.style.contentVisibility;Xe&&(Xe.style.contentVisibility="visible");try{se.scrollTop=be===void 0?T?0:ge.current:se.scrollTop+be.getBoundingClientRect().top-se.getBoundingClientRect().top+Le.offset}finally{Xe&&(Xe.style.contentVisibility=xt??"")}},[me,ne,ge,T]),Et=R(()=>{ce()&&(ue(),ze())},[ue,ce,ze]),ft=R(()=>{!ce()||Z.current.pagingBlockedByInteraction||u?.loading||(ue(),T&&(G.current=!0),u?.onLoadEarlier())},[ue,ce,u,T]),Ct=R(()=>{!ce()||Z.current.pagingBlockedByInteraction||m?.loading||(ue(),T&&(G.current=!0),m?.onLoadLater())},[ue,ce,m,T]),gt=R(()=>{ce()&&f?.(()=>{if(!ce())return;de.current=!0,j(!0);let se=J.current;se&&(se.scrollTop=se.scrollHeight)})},[ce,f,de,j]),Dt=se=>{if(!(!ce()||T)){if(se&&m!==null){gt();return}se&&(de.current=!0),j(se)}},Mt=R(se=>{if(T&&G.current){se.scrollTop=0,ge.current=0,ne.current=null,s?.loading||(G.current=!1);return}let Le=X.request;if(Le!==null){de.current=!1,j(!1);let be=F.some(Xe=>Xe.id===Le.rowId)?me(se,Le.rowId):void 0;if(!be)return;be.scrollIntoView({block:"center"}),be.focus({preventScroll:!0}),ge.current=se.scrollTop,Me(se,[be]),X.completeReveal(Le);return}!T&&O&&de.current&&m===null?se.scrollTop=se.scrollHeight:et(se)},[X.request,X.completeReveal,de,j,F,me,ge,Me,O,T,s?.loading,ne,m,et]);return fe(()=>{if(!ce())return;let se=J.current;se&&(Mt(se),ze())},[Mt,y,de,N,F,O,n,ce,m,x,ze,et]),fe(()=>{let se=J.current;if(!ce()||g===null||!se)return;let Le=!0,be=()=>{Le&&ce()&&ze()},Xe=()=>{!Le||!ce()||(Mt(se),be())},xt=typeof ResizeObserver>"u"?null:new ResizeObserver(Xe);xt?.observe(se);let tt=se.querySelector("table");return tt&&xt?.observe(tt),se.addEventListener("focusin",be),se.addEventListener("focusout",be),se.ownerDocument.addEventListener("selectionchange",be),be(),()=>{Le=!1,pt.cancel(),xt?.disconnect(),se.removeEventListener("focusin",be),se.removeEventListener("focusout",be),se.ownerDocument.removeEventListener("selectionchange",be)}},[n,ce,g,x,pt,ze,Mt]),l(Mp,{inputKey:S,visible:x,rows:F,expandedRows:N,capture:ue,children:l(gd,{value:je,children:v("div",{className:"flex min-h-0 flex-1 flex-col","data-trajectory-view":!0,children:[v("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1 border-b border-border px-3 py-1.5",children:[v("div",{role:"group","aria-label":I("trajectory.filterLabel"),className:"flex flex-wrap items-center gap-1",children:[l(K,{size:"xs",variant:P==="all"?"secondary":"ghost","aria-pressed":P==="all",onClick:()=>A("all"),children:I("trajectory.filterAll")}),U.map(se=>l(K,{size:"xs",variant:P===se?"secondary":"ghost","aria-pressed":P===se,onClick:()=>A(se),children:I(`trajectory.kinds.${se}`)},se))]}),a?l(Xr,{size:"xs",variant:"outline",pressed:X.expandAll,disabled:p,onPressedChange:X.setExpandAll,children:I("turnOverview.expandAll")}):null,l(Xr,{className:"ml-auto",size:"xs",variant:"outline",pressed:!T&&O,disabled:T,onPressedChange:Dt,"aria-label":I("trajectory.followLatest"),children:I("trajectory.followLatest")})]}),s&&d?l(VS,{environmentId:t,filter:i,query:s,onChange:d}):null,v("div",{ref:te,className:"min-h-0 flex-1 overflow-auto",onScroll:Et,style:{paddingBottom:y},"data-trajectory-scroll":!0,children:[u!==null?v("div",{className:"flex items-center justify-between gap-2 border-b border-border px-3 py-2 text-xs text-muted-foreground",children:[l("span",{children:I("trajectory.loadEarlier")}),l(K,{size:"xs",variant:"outline",disabled:u.loading||p,onClick:ft,children:u.loading?I("trajectory.loadingEarlier"):I("trajectory.loadEarlierAction")})]}):null,F.length===0?l("div",{className:"flex h-full items-center justify-center p-6 text-sm text-muted-foreground",children:s?.loading?I("trajectory.sourceFilter.loading"):s?.error?I("trajectory.sourceFilter.unavailable"):I(T||P!=="all"?"trajectory.sourceFilter.empty":"trajectory.empty")}):v(Rb,{children:[l(Mb,{className:"sticky top-0 z-10 bg-background",children:v(Jr,{className:"hover:bg-transparent",children:[l(Wa,{className:"w-px whitespace-nowrap",children:I("trajectory.columnTime")}),l(Wa,{className:"w-px whitespace-nowrap",children:I("trajectory.columnType")}),l(Wa,{children:I("trajectory.columnSummary")}),l(Wa,{className:"w-px whitespace-nowrap",children:I("trajectory.columnStatus")}),l(Wa,{className:"w-px whitespace-nowrap",children:I("trajectory.columnDuration")}),l(Wa,{className:"w-px",children:l("span",{className:"sr-only",children:I("trajectory.openInChat")})})]})}),ee.map((se,Le)=>l(Eb,{className:"trajectory-chunk [&_tr:last-child]:border-b","data-trajectory-chunk":se[0]?.id??Le,children:se.map(be=>{let Xe=X.headers.get(be.id);if(Xe)return l(BS,{...Xe,callCounts:s?.turnCounts.get(Xe.group.turnId),sourceFiltered:T,disabled:p,highlighted:X.highlighted===be.id,onToggle:X.toggleTurn,onLocate:X.locate,onOpenFileDiff:c},be.id);let xt=X.routines.get(be.id);return xt?l(HS,{id:be.id,...xt,disabled:p,onToggle:()=>X.toggleRoutine(be.id)},be.id):l(qS,{environmentId:t,toolPresentation:o,row:be,inputKey:n,expanded:N.has(be.id),highlighted:X.highlighted===be.id,toggleExpanded:Y,resolveChatAnchorMessageId:w,onOpenInChat:k,timestampFormat:h,threadRef:L,useToolCallDetail:C,useCommunicationRecord:b},`${n}:${be.id}`)})},`${n}:${se[0]?.id??Le}`))]}),m!==null?v("div",{className:"flex justify-center gap-2 px-3 py-2",children:[l(K,{size:"xs",variant:"outline",disabled:m.loading||p,onClick:Ct,children:m.loading?I("timeline.loadingLater"):I("timeline.loadLater")}),f===null?null:l(K,{size:"xs",variant:"ghost",onClick:gt,children:I("timeline.returnToLatest")})]}):null]})]})})})});function YS({data:e,target:t,inputKey:o,paneVisible:n,timestampFormat:r,contentInsetEndAdjustment:a=0,onOpenInChat:s,onOpenFileDiff:i}){let[d,c]=Ge(o,{},{namespace:"trajectory-source-filter"}),u=e.useTrajectory({target:t,threadKey:o,visible:n,toolFilter:d}),m=e.useToolPresentation?.(t),p=R(g=>e.useToolCallDetail(t,{toolCallId:g.toolCallId,turnId:g.turnId,revision:g.revision,...g.original===void 0?{}:{original:g.original}}),[e,t]),f=R(g=>e.useCommunicationRecord(t,g),[e,t]);return l(XS,{inputKey:o,environmentId:t.environmentId,toolPresentation:m,rows:u.rows,groupRows:u.groupRows,toolFilter:d,onToolFilterChange:c,sourceQuery:u.sourceQuery,onOpenFileDiff:i,loadEarlier:u.loadEarlier,loadLater:u.loadLater,pagingBlockedByInteraction:u.pagingBlockedByInteraction,onReturnToLatest:u.onReturnToLatest,onVisibleTurnRangeChange:u.onVisibleTurnRangeChange,timestampFormat:r,contentInsetEndAdjustment:a,paneVisible:n,threadRef:t,useToolCallDetail:p,useCommunicationRecord:f,resolveChatAnchorMessageId:u.resolveChatAnchorMessageId,onOpenInChat:s})}$();$();var hh=qe(null),Np=hh.Provider;function Ho(){let e=Pt(hh);if(e===null)throw new Error("Composer thread data has not been provided.");return e}function Co(){return Pt(hh)}$();var ns=Px(yh());$();function nk(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];return W(()=>n=>{t.forEach(r=>r(n))},t)}var zd=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Ja(e){let t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function _p(e){return"nodeType"in e}function So(e){var t,o;return e?Ja(e)?e:_p(e)&&(t=(o=e.ownerDocument)==null?void 0:o.defaultView)!=null?t:window:window}function Op(e){let{Document:t}=So(e);return e instanceof t}function xi(e){return Ja(e)?!1:e instanceof So(e).HTMLElement}function Ch(e){return e instanceof So(e).SVGElement}function Za(e){return e?Ja(e)?e.document:_p(e)?Op(e)?e:xi(e)||Ch(e)?e.ownerDocument:document:document:document}var dn=zd?fe:H;function Fp(e){let t=E(e);return dn(()=>{t.current=e}),R(function(){for(var o=arguments.length,n=new Array(o),r=0;r<o;r++)n[r]=arguments[r];return t.current==null?void 0:t.current(...n)},[])}function rk(){let e=E(null),t=R((n,r)=>{e.current=setInterval(n,r)},[]),o=R(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,o]}function bi(e,t){t===void 0&&(t=[e]);let o=E(e);return dn(()=>{o.current!==e&&(o.current=e)},t),o}function wi(e,t){let o=E();return W(()=>{let n=e(o.current);return o.current=n,n},[...t])}function Kd(e){let t=Fp(e),o=E(null),n=R(r=>{r!==o.current&&t?.(r,o.current),o.current=r},[]);return[o,n]}function Bp(e){let t=E();return H(()=>{t.current=e},[e]),t.current}var vh={};function es(e,t){return W(()=>{if(t)return t;let o=vh[e]==null?0:vh[e]+1;return vh[e]=o,e+"-"+o},[e,t])}function ak(e){return function(t){for(var o=arguments.length,n=new Array(o>1?o-1:0),r=1;r<o;r++)n[r-1]=arguments[r];return n.reduce((a,s)=>{let i=Object.entries(s);for(let[d,c]of i){let u=a[d];u!=null&&(a[d]=u+e*c)}return a},{...t})}}var ts=ak(1),os=ak(-1);function x$(e){return"clientX"in e&&"clientY"in e}function qd(e){if(!e)return!1;let{KeyboardEvent:t}=So(e.target);return t&&e instanceof t}function b$(e){if(!e)return!1;let{TouchEvent:t}=So(e.target);return t&&e instanceof t}function Wd(e){if(b$(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:o}=e.touches[0];return{x:t,y:o}}else if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:o}=e.changedTouches[0];return{x:t,y:o}}}return x$(e)?{x:e.clientX,y:e.clientY}:null}var na=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:o}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(o?Math.round(o):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:o}=e;return"scaleX("+t+") scaleY("+o+")"}},Transform:{toString(e){if(e)return[na.Translate.toString(e),na.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:o,easing:n}=e;return t+" "+o+"ms "+n}}}),ok="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function sk(e){return e.matches(ok)?e:e.querySelector(ok)}$();var w$={display:"none"};function ik(e){let{id:t,value:o}=e;return Zt.createElement("div",{id:t,style:w$},o)}function lk(e){let{id:t,announcement:o,ariaLiveType:n="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 Zt.createElement("div",{id:t,style:r,role:"status","aria-live":n,"aria-atomic":!0},o)}function dk(){let[e,t]=q("");return{announce:R(n=>{n!=null&&t(n)},[]),announcement:e}}var wk=qe(null);function T$(e){let t=Pt(wk);H(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function I$(){let[e]=q(()=>new Set),t=R(n=>(e.add(n),()=>e.delete(n)),[e]);return[R(n=>{let{type:r,event:a}=n;e.forEach(s=>{var i;return(i=s[r])==null?void 0:i.call(s,a)})},[e]),t]}var S$={draggable:`
3545
+ `);return p.length===0&&!s?null:v("div",{className:"space-y-2",children:[s?v(Fu,{value:[d?"original":"received"],onValueChange:f=>{f[0]&&c(f[0]==="original")},"aria-label":i("toolCall.output"),children:[l(Xr,{value:"received",children:i("toolCall.agentReceived")}),l(Xr,{value:"original",children:i("toolCall.originalResult")})]}):null,l("pre",{className:fh,children:d?u?.original:p}),d&&u?.originalLoading?l("p",{role:"status",children:i("toolCall.originalLoading")}):null,d&&u?.originalTruncated?l("p",{children:i("toolCall.originalRetained")}):null,d&&u?.originalFailed?l("p",{role:"alert",children:i("toolCall.originalLoadFailed")}):null,d&&u?.loadMoreOriginal?l(K,{size:"sm",onClick:u.loadMoreOriginal,children:i("toolCall.originalMore")}):null]})}function qS({row:e,environmentId:t,presentation:o}){let{t:n}=z();if(e.childThread!==void 0)return l(yd,{threadRef:{environmentId:t,threadId:e.childThread.threadId},fallbackName:e.childThread.fallbackName,showStatus:!1});let r=e.communication?.to;if(e.communication===void 0)return e.kind==="communication"?l("span",{className:"break-words",children:n("trajectory.communication.sentTo",{name:n("trajectory.communication.unknownRecipient")})}):o!=null?l(Bd,{presentation:o,fallback:e.summary,environmentId:t}):l("span",{className:"break-words",children:e.kind==="tool-call"&&(e.source==="ycodium"||e.builtinMcpTool!==void 0)?e.toolName??n("trajectory.kinds.tool-call"):e.summary});if(r?.kind==="thread"){let[s="",i=""]=n("trajectory.communication.sentTo",{name:""}).split("");return v("span",{className:"break-words",children:[s,l(yd,{threadRef:{environmentId:t,threadId:r.threadId},fallbackName:r.title??void 0,showStatus:!1}),i]})}let a=r==null?n("trajectory.communication.unknownRecipient"):r.kind==="work-item"?n("trajectory.communication.workItem"):r.displayName;return l("span",{className:"break-words",children:n("trajectory.communication.sentTo",{name:a})})}var h$={replied:"trajectory.communication.phase.replied","picked-up":"trajectory.communication.phase.pickedUp",processed:"trajectory.communication.phase.processed",waiting:"trajectory.communication.phase.waiting",unknown:"trajectory.communication.phase.unknown",recorded:"trajectory.communication.phase.recorded",withdrawn:"trajectory.communication.phase.withdrawn",deleted:"trajectory.communication.phase.deleted"},zS={withdrawn:"trajectory.communication.body.withdrawn",deleted:"trajectory.communication.body.deleted",unavailable:"trajectory.communication.body.unavailable"};function WS({useCommunicationRecord:e,recordId:t,fallback:o,timestampFormat:n}){let{t:r}=z(),a=e===void 0?null:e(t);if(a===null)return o===void 0?null:l("pre",{className:fh,children:o});if(typeof a=="string")return l("span",{className:"px-1 text-xs text-muted-foreground","data-trajectory-communication":a,children:r(a==="unreadable"?zS.unavailable:a==="environment-outdated"?"trajectory.communication.environmentOutdated":a==="client-outdated"?"trajectory.communication.updateRequired":"trajectory.communication.notReceived")});let s=r(h$[a.phase]);return v("div",{className:"flex flex-col gap-1.5","data-trajectory-communication":a.recordId,children:[a.incomplete?l("span",{className:"px-1 text-xs text-muted-foreground",children:r("trajectory.communication.incomplete")}):null,a.bodyState==="present"?l("pre",{className:fh,children:a.text}):l("span",{className:"px-1 text-xs text-muted-foreground",children:r(zS[a.bodyState])}),l("span",{className:"px-1 text-xs text-muted-foreground",children:a.phaseAt===null?s:`${s} ${Jn(a.phaseAt,n,r)}`})]})}var GS=pe(function({environmentId:t,toolPresentation:o,row:n,inputKey:r,expanded:a,highlighted:s,toggleExpanded:i,resolveChatAnchorMessageId:d,onOpenInChat:c,timestampFormat:u,threadRef:m,useToolCallDetail:p,useCommunicationRecord:f}){let{t:g}=z(),{formatDuration:h}=_o(),y=W(()=>n.kind==="tool-call"?{toolMetadata:{source:n.source??"unknown",toolName:n.toolName,pluginId:n.pluginId,mcpServer:n.mcpServer,action:n.action,skillName:n.skillName},builtinMcpTool:n.builtinMcpTool,toolArgs:n.toolArgs}:void 0,[n]),x=y===void 0?null:o?.(y)??null,C=n.detail!==void 0||n.toolCallId!==void 0,b=d(n);return l(Gr,{value:n.id,children:[v(Jr,{"data-trajectory-row-id":n.id,"data-timeline-row-id":n.id,tabIndex:-1,className:V(C&&"cursor-pointer",s&&"outline-2 outline-primary"),onClick:C?()=>i(n.id):void 0,children:[l(bn,{className:"whitespace-nowrap text-muted-foreground",title:wn(n.createdAt,u,g),children:Jn(n.createdAt,u,g)}),l(bn,{className:"whitespace-nowrap",children:g(`trajectory.kinds.${n.kind}`)}),v(bn,{className:"max-w-0 whitespace-normal",children:[v("span",{className:"inline-flex items-start gap-1",children:[C?l(K,{size:"xs",variant:"ghost",className:"mt-0.5 size-4 min-w-4 shrink-0 px-0","aria-label":g(a?"trajectory.collapseRow":"trajectory.expandRow"),"aria-expanded":a,onClick:L=>{L.stopPropagation(),i(n.id)},children:a?l(Tt,{"aria-hidden":!0}):l(yo,{"aria-hidden":!0})}):null,l(qS,{row:n,environmentId:t,presentation:x})]}),n.kind==="tool-call"?v("span",{className:"ml-2 inline-flex flex-wrap gap-x-2 text-xs text-muted-foreground","data-trajectory-source":!0,children:[l("span",{children:g(`trajectory.sources.${n.source??"unknown"}`)}),n.source==="plugin"&&n.pluginId?l(Mo,{environmentId:t,pluginId:n.pluginId,iconClassName:"size-3"}):null,n.source==="mcp"&&n.mcpServer?l("span",{children:n.mcpServer}):null,n.action==="skill-read"?l("span",{children:n.skillName?g("trajectory.sourceFilter.skillReadNamed",{name:n.skillName}):g("trajectory.sourceFilter.skillRead")}):null]}):null]}),v(bn,{className:"whitespace-nowrap",children:[g(`trajectory.status.${n.status}`),n.rewrittenBy?.length?l(Od,{plugins:n.rewrittenBy,environmentId:t}):null]}),l(bn,{className:"whitespace-nowrap text-muted-foreground",children:n.durationMs!==void 0?h(n.durationMs):g("trajectory.valueUnknown")}),l(bn,{className:"whitespace-nowrap",children:b!==null?v(Pe,{children:[l(Ee,{render:l(K,{size:"xs",variant:"ghost","aria-label":g("trajectory.openInChat"),onClick:L=>{L.stopPropagation(),c(b)}}),children:l($a,{"aria-hidden":!0})}),l(Re,{side:"top",children:g("trajectory.openInChat")})]}):null})]},`${r}:${n.id}`),a&&C?l(Jr,{className:"hover:bg-transparent","data-trajectory-detail-row":n.id,"data-timeline-row-id":n.id,children:v(bn,{colSpan:6,className:"whitespace-normal",children:[l("div",{className:"px-2 py-1 text-xs font-medium text-muted-foreground",children:g("trajectory.detailTitle")}),n.kind==="tool-call"&&n.toolCallId!==void 0?l(KS,{threadRef:m,rewritten:(n.rewrittenBy?.length??0)>0,useToolCallDetail:p,toolCallId:n.toolCallId,turnId:n.turnId,fallback:n.detail,revision:`${n.status}:${n.updatedActivityId??n.activityId??n.id}`}):n.communication!==void 0?l(WS,{useCommunicationRecord:f,recordId:n.communication.recordId,fallback:n.detail,timestampFormat:u}):n.detail!==void 0?l("pre",{className:"max-h-80 overflow-auto rounded-md bg-muted/40 p-3 font-mono text-xs break-words whitespace-pre-wrap",children:n.detail}):null]})},`${r}:${n.id}:detail`):null]},`${r}:${n.id}:owner`)});var jS=["user-message","assistant-message","reasoning","tool-call","approval","user-input","compaction","retry","session","turn-intent","scheduled-wake","communication","delegation","task","event"];$();var Mp=class extends ur{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 gh(e){let t=e.getBoundingClientRect();if(e.clientHeight<=0||t.height<=0)return[];let o=e.querySelector("thead"),n=t.top+(o?.getBoundingClientRect().height??0),r=e.querySelectorAll("[data-trajectory-chunk]"),a=Ga(r,n),s=[];if(a<0)return s;for(let i=a;i<r.length;i+=1){let d=r[i];if(d.getBoundingClientRect().top>=t.bottom)break;let c=d.querySelectorAll("[data-timeline-row-id]"),u=Ga(c,n);if(!(u<0))for(let m=u;m<c.length;m++){let p=c[m];if(p.getBoundingClientRect().top>=t.bottom)break;s.push(p)}}return s}function Ap(e){return e?.source!==void 0||e?.pluginId!==void 0||e?.mcpServer!==void 0}function VS(e,t){if(t==="all")return e;let o=new Set(e.filter(n=>n.kind===t).map(n=>n.turnId??null));return e.filter(n=>n.kind===t||o.has(n.turnId??null)&&(n.kind==="user-message"||n.kind==="assistant-message"))}var y$=["native","ycodium","plugin","mcp","unknown"];function QS(e){let{t}=z(),o=Xn(e.environmentId,e.detail);return e.source!=="plugin"?l(oe,{children:e.detail}):o===null?l(oe,{children:t("trajectory.sources.plugin")}):l(Mo,{environmentId:e.environmentId,pluginId:e.detail})}function XS({environmentId:e,filter:t,query:o,onChange:n}){let{t:r}=z(),a=Ap(t),s=t?.source,i=s==="plugin"?"pluginId":s==="mcp"?"mcpServer":null,d=i===null?void 0:t?.[i],c=i===null?[]:[...new Set(o.sources.flatMap(u=>u.source===s&&u[i]!==void 0?[u[i]]:[]))];return d!==void 0&&!c.includes(d)&&c.push(d),v("div",{className:"flex flex-wrap items-center gap-1 border-b border-border px-3 py-1.5",children:[v("div",{role:"group","aria-label":r("trajectory.sourceFilter.label"),className:"flex flex-wrap items-center gap-1",children:[l(K,{size:"xs",variant:a?"ghost":"secondary","aria-pressed":!a,onClick:()=>n({}),children:r("trajectory.sourceFilter.all")}),y$.filter(u=>u===s||o.sources.some(m=>m.source===u)).map(u=>l(K,{size:"xs",variant:s===u?"secondary":"ghost","aria-pressed":s===u,onClick:()=>n({source:u}),children:r(`trajectory.sources.${u}`)},u))]}),i!==null?v(Xs,{value:d===void 0?"all":`detail:${d}`,onValueChange:u=>{u===null||s===void 0||n(u==="all"?{source:s}:{source:s,[i]:u.slice(7)})},children:[l(kb,{size:"xs",className:"max-w-full","aria-label":r(s==="plugin"?"trajectory.sourceFilter.plugin":"trajectory.sourceFilter.mcp"),children:d!==void 0&&s!==void 0?l(QS,{environmentId:e,source:s,detail:d}):r(s==="plugin"?"trajectory.sourceFilter.allPlugins":"trajectory.sourceFilter.allMcp")}),v(Ys,{children:[l(qa,{value:"all",children:r(s==="plugin"?"trajectory.sourceFilter.allPlugins":"trajectory.sourceFilter.allMcp")}),c.map(u=>l(qa,{value:`detail:${u}`,children:s===void 0?u:l(QS,{environmentId:e,source:s,detail:u})},u))]})]}):null,a?l(K,{size:"xs",variant:"ghost",onClick:()=>n({}),children:r("trajectory.sourceFilter.clear")}):null,o.loading?l("span",{role:"status",className:"text-xs text-muted-foreground",children:r("trajectory.sourceFilter.loading")}):null,o.error!==null?v("div",{role:"alert",className:"flex flex-wrap items-center gap-1 text-xs text-destructive-foreground",children:[l("span",{children:r("trajectory.sourceFilter.error",{error:o.error})}),l(K,{size:"xs",variant:"outline",disabled:o.loading,onClick:()=>o.retry(),children:r("trajectory.sourceFilter.retry")})]}):null]})}var YS=50,v$=32;function C$(e){let t=[];for(let o=0;o<e.length;o+=YS)t.push(e.slice(o,o+YS));return t}var JS=pe(function({environmentId:t="",toolPresentation:o,inputKey:n,rows:r,groupRows:a,sourceQuery:s,toolFilter:i,onToolFilterChange:d,onOpenFileDiff:c,loadEarlier:u,loadLater:m=null,pagingBlockedByInteraction:p=!1,onReturnToLatest:f=null,onVisibleTurnRangeChange:g=null,timestampFormat:h,contentInsetEndAdjustment:y=0,paneVisible:x,useToolCallDetail:C,useCommunicationRecord:b,threadRef:L,resolveChatAnchorMessageId:w,onOpenInChat:k}){let{t:I}=z(),T=Ap(i),S=T?JSON.stringify([n,i?.source,i?.pluginId,i?.mcpServer]):n,[P,A]=Ge(n,"all",{namespace:"trajectory-kind-filter"}),[N,B]=Ge(n,()=>new Set,{namespace:"trajectory-expanded-rows"}),[O,j]=Ge(n,!0,{namespace:"trajectory-follow-latest"}),U=W(()=>{let se=new Set(r.map(Le=>Le.kind));return jS.filter(Le=>se.has(Le))},[r]),D=W(()=>VS(r,P),[r,P]),J=E(null),G=E(!1);fe(()=>{G.current=!1},[S]);let M=R(()=>{A("all"),T&&d?.({})},[A,T,d]),X=Jb({inputKey:n,rows:D,groupRows:a,paneVisible:x,resetFilter:M}),F=X.rows,ee=W(()=>C$(F),[F]),Y=se=>B(Le=>{let be=new Set(Le);return be.has(se)?be.delete(se):be.add(se),be}),ae=E(null),te=R(se=>{J.current=se,se&&(ae.current=se)},[]),de=$e(S,!0,{namespace:"trajectory-at-end"}),ge=$e(S,0,{namespace:"trajectory-scroll-top"}),ne=$e(S,null,{namespace:"trajectory-row-anchor"}),Z=E({viewportKey:S,paneVisible:x,pagingBlockedByInteraction:p});Z.current={viewportKey:S,paneVisible:x,pagingBlockedByInteraction:p};let ve=E(null);fe(()=>{if(ve.current=null,!!x)return()=>{ve.current=null,g?.(null)}},[S,x,g]);let he=W(()=>({inputKey:n,store:hd()}),[n]),Ae=E(he);Ae.current=he;let De=E(()=>{}),je=R(se=>{let Le=Ae.current;return Le.store.acquire(se,()=>{Ae.current===Le&&De.current()})},[]),ot=W(()=>{let se=F.map((Le,be)=>({key:Le.id,turnId:Le.turnId??null,firstRowIndex:be,endRowIndex:be+1}));return{sections:se,bySectionKey:new Map(se.map(Le=>[Le.key,Le])),byRowId:new Map(se.map(Le=>[Le.key,{turnId:Le.turnId,index:Le.firstRowIndex}]))}},[F]),me=R((se,Le)=>Array.from(se.querySelectorAll("[data-trajectory-row-id]")).find(be=>be.dataset.trajectoryRowId===Le),[]),Me=R((se,Le)=>{let be=Le[0]?.dataset.timelineRowId,Xe=be===void 0?void 0:me(se,be);Xe&&be!==void 0&&(ne.current={rowId:be,offset:se.getBoundingClientRect().top-Xe.getBoundingClientRect().top})},[me,ne]),ue=R(()=>{if(!x)return;let se=J.current??ae.current;se&&(ge.current=se.scrollTop,de.current=se.scrollHeight-se.scrollTop-se.clientHeight<=v$,F.length>0&&Me(se,gh(se)))},[de,F.length,x,Me,ge]),ce=R(()=>Z.current.viewportKey===S&&Z.current.paneVisible,[S]),Ze=R(()=>{if(!ce()||g===null)return;let se=J.current;if(!se||se.clientHeight<=0)return;let Le=gh(se);Me(se,Le);let be=he.store.rows(),Xe=se.ownerDocument.activeElement;if(ai(Xe)){let It=ri(Xe,se);It&&be.push(It)}let xt=Ju({index:ot,visibleSectionKeys:Le.flatMap(It=>{let po=It.dataset.timelineRowId;return po===void 0?[]:[po]}),protectedRowIds:be,selectionRows:Zu(se)}),tt=JSON.stringify(xt);ve.current!==tt&&(ve.current=tt,g(xt))},[he,ce,g,ot,Me]),pt=Zr(x),ze=R(()=>{ce()&&g!==null&&pt.request(Ze)},[ce,g,pt,Ze]);De.current=ze;let et=R(se=>{let Le=ne.current,be=Le===null?void 0:me(se,Le.rowId),Xe=be?.closest("[data-trajectory-chunk]"),xt=Xe?.style.contentVisibility;Xe&&(Xe.style.contentVisibility="visible");try{se.scrollTop=be===void 0?T?0:ge.current:se.scrollTop+be.getBoundingClientRect().top-se.getBoundingClientRect().top+Le.offset}finally{Xe&&(Xe.style.contentVisibility=xt??"")}},[me,ne,ge,T]),Et=R(()=>{ce()&&(ue(),ze())},[ue,ce,ze]),ft=R(()=>{!ce()||Z.current.pagingBlockedByInteraction||u?.loading||(ue(),T&&(G.current=!0),u?.onLoadEarlier())},[ue,ce,u,T]),Ct=R(()=>{!ce()||Z.current.pagingBlockedByInteraction||m?.loading||(ue(),T&&(G.current=!0),m?.onLoadLater())},[ue,ce,m,T]),gt=R(()=>{ce()&&f?.(()=>{if(!ce())return;de.current=!0,j(!0);let se=J.current;se&&(se.scrollTop=se.scrollHeight)})},[ce,f,de,j]),Dt=se=>{if(!(!ce()||T)){if(se&&m!==null){gt();return}se&&(de.current=!0),j(se)}},Mt=R(se=>{if(T&&G.current){se.scrollTop=0,ge.current=0,ne.current=null,s?.loading||(G.current=!1);return}let Le=X.request;if(Le!==null){de.current=!1,j(!1);let be=F.some(Xe=>Xe.id===Le.rowId)?me(se,Le.rowId):void 0;if(!be)return;be.scrollIntoView({block:"center"}),be.focus({preventScroll:!0}),ge.current=se.scrollTop,Me(se,[be]),X.completeReveal(Le);return}!T&&O&&de.current&&m===null?se.scrollTop=se.scrollHeight:et(se)},[X.request,X.completeReveal,de,j,F,me,ge,Me,O,T,s?.loading,ne,m,et]);return fe(()=>{if(!ce())return;let se=J.current;se&&(Mt(se),ze())},[Mt,y,de,N,F,O,n,ce,m,x,ze,et]),fe(()=>{let se=J.current;if(!ce()||g===null||!se)return;let Le=!0,be=()=>{Le&&ce()&&ze()},Xe=()=>{!Le||!ce()||(Mt(se),be())},xt=typeof ResizeObserver>"u"?null:new ResizeObserver(Xe);xt?.observe(se);let tt=se.querySelector("table");return tt&&xt?.observe(tt),se.addEventListener("focusin",be),se.addEventListener("focusout",be),se.ownerDocument.addEventListener("selectionchange",be),be(),()=>{Le=!1,pt.cancel(),xt?.disconnect(),se.removeEventListener("focusin",be),se.removeEventListener("focusout",be),se.ownerDocument.removeEventListener("selectionchange",be)}},[n,ce,g,x,pt,ze,Mt]),l(Mp,{inputKey:S,visible:x,rows:F,expandedRows:N,capture:ue,children:l(gd,{value:je,children:v("div",{className:"flex min-h-0 flex-1 flex-col","data-trajectory-view":!0,children:[v("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1 border-b border-border px-3 py-1.5",children:[v("div",{role:"group","aria-label":I("trajectory.filterLabel"),className:"flex flex-wrap items-center gap-1",children:[l(K,{size:"xs",variant:P==="all"?"secondary":"ghost","aria-pressed":P==="all",onClick:()=>A("all"),children:I("trajectory.filterAll")}),U.map(se=>l(K,{size:"xs",variant:P===se?"secondary":"ghost","aria-pressed":P===se,onClick:()=>A(se),children:I(`trajectory.kinds.${se}`)},se))]}),a?l(Xr,{size:"xs",variant:"outline",pressed:X.expandAll,disabled:p,onPressedChange:X.setExpandAll,children:I("turnOverview.expandAll")}):null,l(Xr,{className:"ml-auto",size:"xs",variant:"outline",pressed:!T&&O,disabled:T,onPressedChange:Dt,"aria-label":I("trajectory.followLatest"),children:I("trajectory.followLatest")})]}),s&&d?l(XS,{environmentId:t,filter:i,query:s,onChange:d}):null,v("div",{ref:te,className:"min-h-0 flex-1 overflow-auto",onScroll:Et,style:{paddingBottom:y},"data-trajectory-scroll":!0,children:[u!==null?v("div",{className:"flex items-center justify-between gap-2 border-b border-border px-3 py-2 text-xs text-muted-foreground",children:[l("span",{children:I("trajectory.loadEarlier")}),l(K,{size:"xs",variant:"outline",disabled:u.loading||p,onClick:ft,children:u.loading?I("trajectory.loadingEarlier"):I("trajectory.loadEarlierAction")})]}):null,F.length===0?l("div",{className:"flex h-full items-center justify-center p-6 text-sm text-muted-foreground",children:s?.loading?I("trajectory.sourceFilter.loading"):s?.error?I("trajectory.sourceFilter.unavailable"):I(T||P!=="all"?"trajectory.sourceFilter.empty":"trajectory.empty")}):v(Eb,{children:[l(Ab,{className:"sticky top-0 z-10 bg-background",children:v(Jr,{className:"hover:bg-transparent",children:[l(Wa,{className:"w-px whitespace-nowrap",children:I("trajectory.columnTime")}),l(Wa,{className:"w-px whitespace-nowrap",children:I("trajectory.columnType")}),l(Wa,{children:I("trajectory.columnSummary")}),l(Wa,{className:"w-px whitespace-nowrap",children:I("trajectory.columnStatus")}),l(Wa,{className:"w-px whitespace-nowrap",children:I("trajectory.columnDuration")}),l(Wa,{className:"w-px",children:l("span",{className:"sr-only",children:I("trajectory.openInChat")})})]})}),ee.map((se,Le)=>l(Mb,{className:"trajectory-chunk [&_tr:last-child]:border-b","data-trajectory-chunk":se[0]?.id??Le,children:se.map(be=>{let Xe=X.headers.get(be.id);if(Xe)return l(US,{...Xe,callCounts:s?.turnCounts.get(Xe.group.turnId),sourceFiltered:T,disabled:p,highlighted:X.highlighted===be.id,onToggle:X.toggleTurn,onLocate:X.locate,onOpenFileDiff:c},be.id);let xt=X.routines.get(be.id);return xt?l($S,{id:be.id,...xt,disabled:p,onToggle:()=>X.toggleRoutine(be.id)},be.id):l(GS,{environmentId:t,toolPresentation:o,row:be,inputKey:n,expanded:N.has(be.id),highlighted:X.highlighted===be.id,toggleExpanded:Y,resolveChatAnchorMessageId:w,onOpenInChat:k,timestampFormat:h,threadRef:L,useToolCallDetail:C,useCommunicationRecord:b},`${n}:${be.id}`)})},`${n}:${se[0]?.id??Le}`))]}),m!==null?v("div",{className:"flex justify-center gap-2 px-3 py-2",children:[l(K,{size:"xs",variant:"outline",disabled:m.loading||p,onClick:Ct,children:m.loading?I("timeline.loadingLater"):I("timeline.loadLater")}),f===null?null:l(K,{size:"xs",variant:"ghost",onClick:gt,children:I("timeline.returnToLatest")})]}):null]})]})})})});function ZS({data:e,target:t,inputKey:o,paneVisible:n,timestampFormat:r,contentInsetEndAdjustment:a=0,onOpenInChat:s,onOpenFileDiff:i}){let[d,c]=Ge(o,{},{namespace:"trajectory-source-filter"}),u=e.useTrajectory({target:t,threadKey:o,visible:n,toolFilter:d}),m=e.useToolPresentation?.(t),p=R(g=>e.useToolCallDetail(t,{toolCallId:g.toolCallId,turnId:g.turnId,revision:g.revision,...g.original===void 0?{}:{original:g.original}}),[e,t]),f=R(g=>e.useCommunicationRecord(t,g),[e,t]);return l(JS,{inputKey:o,environmentId:t.environmentId,toolPresentation:m,rows:u.rows,groupRows:u.groupRows,toolFilter:d,onToolFilterChange:c,sourceQuery:u.sourceQuery,onOpenFileDiff:i,loadEarlier:u.loadEarlier,loadLater:u.loadLater,pagingBlockedByInteraction:u.pagingBlockedByInteraction,onReturnToLatest:u.onReturnToLatest,onVisibleTurnRangeChange:u.onVisibleTurnRangeChange,timestampFormat:r,contentInsetEndAdjustment:a,paneVisible:n,threadRef:t,useToolCallDetail:p,useCommunicationRecord:f,resolveChatAnchorMessageId:u.resolveChatAnchorMessageId,onOpenInChat:s})}$();$();var hh=qe(null),Np=hh.Provider;function Ho(){let e=Pt(hh);if(e===null)throw new Error("Composer thread data has not been provided.");return e}function vo(){return Pt(hh)}$();var ns=Px(yh());$();function ak(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];return W(()=>n=>{t.forEach(r=>r(n))},t)}var zd=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Ja(e){let t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function _p(e){return"nodeType"in e}function So(e){var t,o;return e?Ja(e)?e:_p(e)&&(t=(o=e.ownerDocument)==null?void 0:o.defaultView)!=null?t:window:window}function Op(e){let{Document:t}=So(e);return e instanceof t}function xi(e){return Ja(e)?!1:e instanceof So(e).HTMLElement}function Ch(e){return e instanceof So(e).SVGElement}function Za(e){return e?Ja(e)?e.document:_p(e)?Op(e)?e:xi(e)||Ch(e)?e.ownerDocument:document:document:document}var ln=zd?fe:H;function Fp(e){let t=E(e);return ln(()=>{t.current=e}),R(function(){for(var o=arguments.length,n=new Array(o),r=0;r<o;r++)n[r]=arguments[r];return t.current==null?void 0:t.current(...n)},[])}function sk(){let e=E(null),t=R((n,r)=>{e.current=setInterval(n,r)},[]),o=R(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,o]}function bi(e,t){t===void 0&&(t=[e]);let o=E(e);return ln(()=>{o.current!==e&&(o.current=e)},t),o}function wi(e,t){let o=E();return W(()=>{let n=e(o.current);return o.current=n,n},[...t])}function Kd(e){let t=Fp(e),o=E(null),n=R(r=>{r!==o.current&&t?.(r,o.current),o.current=r},[]);return[o,n]}function Bp(e){let t=E();return H(()=>{t.current=e},[e]),t.current}var vh={};function es(e,t){return W(()=>{if(t)return t;let o=vh[e]==null?0:vh[e]+1;return vh[e]=o,e+"-"+o},[e,t])}function ik(e){return function(t){for(var o=arguments.length,n=new Array(o>1?o-1:0),r=1;r<o;r++)n[r-1]=arguments[r];return n.reduce((a,s)=>{let i=Object.entries(s);for(let[d,c]of i){let u=a[d];u!=null&&(a[d]=u+e*c)}return a},{...t})}}var ts=ik(1),os=ik(-1);function T$(e){return"clientX"in e&&"clientY"in e}function qd(e){if(!e)return!1;let{KeyboardEvent:t}=So(e.target);return t&&e instanceof t}function I$(e){if(!e)return!1;let{TouchEvent:t}=So(e.target);return t&&e instanceof t}function Wd(e){if(I$(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:o}=e.touches[0];return{x:t,y:o}}else if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:o}=e.changedTouches[0];return{x:t,y:o}}}return T$(e)?{x:e.clientX,y:e.clientY}:null}var na=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:o}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(o?Math.round(o):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:o}=e;return"scaleX("+t+") scaleY("+o+")"}},Transform:{toString(e){if(e)return[na.Translate.toString(e),na.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:o,easing:n}=e;return t+" "+o+"ms "+n}}}),rk="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function lk(e){return e.matches(rk)?e:e.querySelector(rk)}$();var S$={display:"none"};function dk(e){let{id:t,value:o}=e;return Zt.createElement("div",{id:t,style:S$},o)}function ck(e){let{id:t,announcement:o,ariaLiveType:n="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 Zt.createElement("div",{id:t,style:r,role:"status","aria-live":n,"aria-atomic":!0},o)}function uk(){let[e,t]=q("");return{announce:R(n=>{n!=null&&t(n)},[]),announcement:e}}var Ik=qe(null);function k$(e){let t=Pt(Ik);H(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function L$(){let[e]=q(()=>new Set),t=R(n=>(e.add(n),()=>e.delete(n)),[e]);return[R(n=>{let{type:r,event:a}=n;e.forEach(s=>{var i;return(i=s[r])==null?void 0:i.call(s,a)})},[e]),t]}var P$={draggable:`
3546
3546
  To pick up a draggable item, press the space bar.
3547
3547
  While dragging, use the arrow keys to move the item.
3548
3548
  Press space again to drop the item in its new position, or press escape to cancel.
3549
- `},k$={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:o}=e;return o?"Draggable item "+t.id+" was moved over droppable area "+o.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:o}=e;return o?"Draggable item "+t.id+" was dropped over droppable area "+o.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function L$(e){let{announcements:t=k$,container:o,hiddenTextDescribedById:n,screenReaderInstructions:r=S$}=e,{announce:a,announcement:s}=dk(),i=es("DndLiveRegion"),[d,c]=q(!1);if(H(()=>{c(!0)},[]),T$(W(()=>({onDragStart(m){let{active:p}=m;a(t.onDragStart({active:p}))},onDragMove(m){let{active:p,over:f}=m;t.onDragMove&&a(t.onDragMove({active:p,over:f}))},onDragOver(m){let{active:p,over:f}=m;a(t.onDragOver({active:p,over:f}))},onDragEnd(m){let{active:p,over:f}=m;a(t.onDragEnd({active:p,over:f}))},onDragCancel(m){let{active:p,over:f}=m;a(t.onDragCancel({active:p,over:f}))}}),[a,t])),!d)return null;let u=Zt.createElement(Zt.Fragment,null,Zt.createElement(ik,{id:n,value:r.draggable}),Zt.createElement(lk,{id:i,announcement:s}));return o?(0,ns.createPortal)(u,o):u}var Gt;(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"})(Gt||(Gt={}));function Up(){}function Ph(e,t){return W(()=>({sensor:e,options:t??{}}),[e,t])}function Tk(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];return W(()=>[...t].filter(n=>n!=null),[...t])}var In=Object.freeze({x:0,y:0});function Ik(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Sk(e,t){let{data:{value:o}}=e,{data:{value:n}}=t;return o-n}function P$(e,t){let{data:{value:o}}=e,{data:{value:n}}=t;return n-o}function ck(e){let{left:t,top:o,height:n,width:r}=e;return[{x:t,y:o},{x:t+r,y:o},{x:t,y:o+n},{x:t+r,y:o+n}]}function Rh(e,t){if(!e||e.length===0)return null;let[o]=e;return t?o[t]:o}function uk(e,t,o){return t===void 0&&(t=e.left),o===void 0&&(o=e.top),{x:t+e.width*.5,y:o+e.height*.5}}var kk=e=>{let{collisionRect:t,droppableRects:o,droppableContainers:n}=e,r=uk(t,t.left,t.top),a=[];for(let s of n){let{id:i}=s,d=o.get(i);if(d){let c=Ik(uk(d),r);a.push({id:i,data:{droppableContainer:s,value:c}})}}return a.sort(Sk)},Lk=e=>{let{collisionRect:t,droppableRects:o,droppableContainers:n}=e,r=ck(t),a=[];for(let s of n){let{id:i}=s,d=o.get(i);if(d){let c=ck(d),u=r.reduce((p,f,g)=>p+Ik(c[g],f),0),m=Number((u/4).toFixed(4));a.push({id:i,data:{droppableContainer:s,value:m}})}}return a.sort(Sk)};function R$(e,t){let o=Math.max(t.top,e.top),n=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),s=r-n,i=a-o;if(n<r&&o<a){let d=t.width*t.height,c=e.width*e.height,u=s*i,m=u/(d+c-u);return Number(m.toFixed(4))}return 0}var E$=e=>{let{collisionRect:t,droppableRects:o,droppableContainers:n}=e,r=[];for(let a of n){let{id:s}=a,i=o.get(s);if(i){let d=R$(i,t);d>0&&r.push({id:s,data:{droppableContainer:a,value:d}})}}return r.sort(P$)};function M$(e,t,o){return{...e,scaleX:t&&o?t.width/o.width:1,scaleY:t&&o?t.height/o.height:1}}function Pk(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:In}function A$(e){return function(o){for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];return r.reduce((s,i)=>({...s,top:s.top+e*i.y,bottom:s.bottom+e*i.y,left:s.left+e*i.x,right:s.right+e*i.x}),{...o})}}var N$=A$(1);function D$(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 _$(e,t,o){let n=D$(t);if(!n)return e;let{scaleX:r,scaleY:a,x:s,y:i}=n,d=e.left-s-(1-r)*parseFloat(o),c=e.top-i-(1-a)*parseFloat(o.slice(o.indexOf(" ")+1)),u=r?e.width/r:e.width,m=a?e.height/a:e.height;return{width:u,height:m,top:c,right:d+u,bottom:c+m,left:d}}var O$={ignoreTransform:!1};function ss(e,t){t===void 0&&(t=O$);let o=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:c,transformOrigin:u}=So(e).getComputedStyle(e);c&&(o=_$(o,c,u))}let{top:n,left:r,width:a,height:s,bottom:i,right:d}=o;return{top:n,left:r,width:a,height:s,bottom:i,right:d}}function pk(e){return ss(e,{ignoreTransform:!0})}function F$(e){let t=e.innerWidth,o=e.innerHeight;return{top:0,left:0,right:t,bottom:o,width:t,height:o}}function B$(e,t){return t===void 0&&(t=So(e).getComputedStyle(e)),t.position==="fixed"}function H$(e,t){t===void 0&&(t=So(e).getComputedStyle(e));let o=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(r=>{let a=t[r];return typeof a=="string"?o.test(a):!1})}function Xd(e,t){let o=[];function n(r){if(t!=null&&o.length>=t||!r)return o;if(Op(r)&&r.scrollingElement!=null&&!o.includes(r.scrollingElement))return o.push(r.scrollingElement),o;if(!xi(r)||Ch(r)||o.includes(r))return o;let a=So(e).getComputedStyle(r);return r!==e&&H$(r,a)&&o.push(r),B$(r,a)?o:n(r.parentNode)}return e?n(e):o}function Rk(e){let[t]=Xd(e,1);return t??null}function xh(e){return!zd||!e?null:Ja(e)?e:_p(e)?Op(e)||e===Za(e).scrollingElement?window:xi(e)?e:null:null}function Ek(e){return Ja(e)?e.scrollX:e.scrollLeft}function Mk(e){return Ja(e)?e.scrollY:e.scrollTop}function Th(e){return{x:Ek(e),y:Mk(e)}}var to;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(to||(to={}));function Ak(e){return!zd||!e?!1:e===document.scrollingElement}function Nk(e){let t={x:0,y:0},o=Ak(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},n={x:e.scrollWidth-o.width,y:e.scrollHeight-o.height},r=e.scrollTop<=t.y,a=e.scrollLeft<=t.x,s=e.scrollTop>=n.y,i=e.scrollLeft>=n.x;return{isTop:r,isLeft:a,isBottom:s,isRight:i,maxScroll:n,minScroll:t}}var U$={x:.2,y:.2};function $$(e,t,o,n,r){let{top:a,left:s,right:i,bottom:d}=o;n===void 0&&(n=10),r===void 0&&(r=U$);let{isTop:c,isBottom:u,isLeft:m,isRight:p}=Nk(e),f={x:0,y:0},g={x:0,y:0},h={height:t.height*r.y,width:t.width*r.x};return!c&&a<=t.top+h.height?(f.y=to.Backward,g.y=n*Math.abs((t.top+h.height-a)/h.height)):!u&&d>=t.bottom-h.height&&(f.y=to.Forward,g.y=n*Math.abs((t.bottom-h.height-d)/h.height)),!p&&i>=t.right-h.width?(f.x=to.Forward,g.x=n*Math.abs((t.right-h.width-i)/h.width)):!m&&s<=t.left+h.width&&(f.x=to.Backward,g.x=n*Math.abs((t.left+h.width-s)/h.width)),{direction:f,speed:g}}function z$(e){if(e===document.scrollingElement){let{innerWidth:a,innerHeight:s}=window;return{top:0,left:0,right:a,bottom:s,width:a,height:s}}let{top:t,left:o,right:n,bottom:r}=e.getBoundingClientRect();return{top:t,left:o,right:n,bottom:r,width:e.clientWidth,height:e.clientHeight}}function Dk(e){return e.reduce((t,o)=>ts(t,Th(o)),In)}function K$(e){return e.reduce((t,o)=>t+Ek(o),0)}function q$(e){return e.reduce((t,o)=>t+Mk(o),0)}function W$(e,t){if(t===void 0&&(t=ss),!e)return;let{top:o,left:n,bottom:r,right:a}=t(e);Rk(e)&&(r<=0||a<=0||o>=window.innerHeight||n>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}var G$=[["x",["left","right"],K$],["y",["top","bottom"],q$]],jd=class{constructor(t,o){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 n=Xd(o),r=Dk(n);this.rect={...t},this.width=t.width,this.height=t.height;for(let[a,s,i]of G$)for(let d of s)Object.defineProperty(this,d,{get:()=>{let c=i(n),u=r[a]-c;return this.rect[d]+u},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}},rs=class{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(o=>{var n;return(n=this.target)==null?void 0:n.removeEventListener(...o)})},this.target=t}add(t,o,n){var r;(r=this.target)==null||r.addEventListener(t,o,n),this.listeners.push([t,o,n])}};function j$(e){let{EventTarget:t}=So(e);return e instanceof t?e:Za(e)}function bh(e,t){let o=Math.abs(e.x),n=Math.abs(e.y);return typeof t=="number"?Math.sqrt(o**2+n**2)>t:"x"in t&&"y"in t?o>t.x&&n>t.y:"x"in t?o>t.x:"y"in t?n>t.y:!1}var cn;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(cn||(cn={}));function mk(e){e.preventDefault()}function V$(e){e.stopPropagation()}var Ve;(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"})(Ve||(Ve={}));var _k={start:[Ve.Space,Ve.Enter],cancel:[Ve.Esc],end:[Ve.Space,Ve.Enter,Ve.Tab]},Q$=(e,t)=>{let{currentCoordinates:o}=t;switch(e.code){case Ve.Right:return{...o,x:o.x+25};case Ve.Left:return{...o,x:o.x-25};case Ve.Down:return{...o,y:o.y+25};case Ve.Up:return{...o,y:o.y-25}}},Ti=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:o}}=t;this.props=t,this.listeners=new rs(Za(o)),this.windowListeners=new rs(So(o)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(cn.Resize,this.handleCancel),this.windowListeners.add(cn.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(cn.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:t,onStart:o}=this.props,n=t.node.current;n&&W$(n),o(In)}handleKeyDown(t){if(qd(t)){let{active:o,context:n,options:r}=this.props,{keyboardCodes:a=_k,coordinateGetter:s=Q$,scrollBehavior:i="smooth"}=r,{code:d}=t;if(a.end.includes(d)){this.handleEnd(t);return}if(a.cancel.includes(d)){this.handleCancel(t);return}let{collisionRect:c}=n.current,u=c?{x:c.left,y:c.top}:In;this.referenceCoordinates||(this.referenceCoordinates=u);let m=s(t,{active:o,context:n.current,currentCoordinates:u});if(m){let p=os(m,u),f={x:0,y:0},{scrollableAncestors:g}=n.current;for(let h of g){let y=t.code,{isTop:x,isRight:C,isLeft:b,isBottom:L,maxScroll:w,minScroll:k}=Nk(h),I=z$(h),T={x:Math.min(y===Ve.Right?I.right-I.width/2:I.right,Math.max(y===Ve.Right?I.left:I.left+I.width/2,m.x)),y:Math.min(y===Ve.Down?I.bottom-I.height/2:I.bottom,Math.max(y===Ve.Down?I.top:I.top+I.height/2,m.y))},S=y===Ve.Right&&!C||y===Ve.Left&&!b,P=y===Ve.Down&&!L||y===Ve.Up&&!x;if(S&&T.x!==m.x){let A=h.scrollLeft+p.x,N=y===Ve.Right&&A<=w.x||y===Ve.Left&&A>=k.x;if(N&&!p.y){h.scrollTo({left:A,behavior:i});return}N?f.x=h.scrollLeft-A:f.x=y===Ve.Right?h.scrollLeft-w.x:h.scrollLeft-k.x,f.x&&h.scrollBy({left:-f.x,behavior:i});break}else if(P&&T.y!==m.y){let A=h.scrollTop+p.y,N=y===Ve.Down&&A<=w.y||y===Ve.Up&&A>=k.y;if(N&&!p.x){h.scrollTo({top:A,behavior:i});return}N?f.y=h.scrollTop-A:f.y=y===Ve.Down?h.scrollTop-w.y:h.scrollTop-k.y,f.y&&h.scrollBy({top:-f.y,behavior:i});break}}this.handleMove(t,ts(os(m,this.referenceCoordinates),f))}}}handleMove(t,o){let{onMove:n}=this.props;t.preventDefault(),n(o)}handleEnd(t){let{onEnd:o}=this.props;t.preventDefault(),this.detach(),o()}handleCancel(t){let{onCancel:o}=this.props;t.preventDefault(),this.detach(),o()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}};Ti.activators=[{eventName:"onKeyDown",handler:(e,t,o)=>{let{keyboardCodes:n=_k,onActivation:r}=t,{active:a}=o,{code:s}=e.nativeEvent;if(n.start.includes(s)){let i=a.activatorNode.current;return i&&e.target!==i?!1:(e.preventDefault(),r?.({event:e.nativeEvent}),!0)}return!1}}];function fk(e){return!!(e&&"distance"in e)}function gk(e){return!!(e&&"delay"in e)}var Vd=class{constructor(t,o,n){var r;n===void 0&&(n=j$(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=o;let{event:a}=t,{target:s}=a;this.props=t,this.events=o,this.document=Za(s),this.documentListeners=new rs(this.document),this.listeners=new rs(n),this.windowListeners=new rs(So(s)),this.initialCoordinates=(r=Wd(a))!=null?r:In,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:o,bypassActivationConstraint:n}}}=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(cn.Resize,this.handleCancel),this.windowListeners.add(cn.DragStart,mk),this.windowListeners.add(cn.VisibilityChange,this.handleCancel),this.windowListeners.add(cn.ContextMenu,mk),this.documentListeners.add(cn.Keydown,this.handleKeydown),o){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(gk(o)){this.timeoutId=setTimeout(this.handleStart,o.delay),this.handlePending(o);return}if(fk(o)){this.handlePending(o);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,o){let{active:n,onPending:r}=this.props;r(n,t,this.initialCoordinates,o)}handleStart(){let{initialCoordinates:t}=this,{onStart:o}=this.props;t&&(this.activated=!0,this.documentListeners.add(cn.Click,V$,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(cn.SelectionChange,this.removeTextSelection),o(t))}handleMove(t){var o;let{activated:n,initialCoordinates:r,props:a}=this,{onMove:s,options:{activationConstraint:i}}=a;if(!r)return;let d=(o=Wd(t))!=null?o:In,c=os(r,d);if(!n&&i){if(fk(i)){if(i.tolerance!=null&&bh(c,i.tolerance))return this.handleCancel();if(bh(c,i.distance))return this.handleStart()}if(gk(i)&&bh(c,i.tolerance))return this.handleCancel();this.handlePending(i,c);return}t.cancelable&&t.preventDefault(),s(d)}handleEnd(){let{onAbort:t,onEnd:o}=this.props;this.detach(),this.activated||t(this.props.active),o()}handleCancel(){let{onAbort:t,onCancel:o}=this.props;this.detach(),this.activated||t(this.props.active),o()}handleKeydown(t){t.code===Ve.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}},X$={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}},Ii=class extends Vd{constructor(t){let{event:o}=t,n=Za(o.target);super(t,X$,n)}};Ii.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:o}=e,{onActivation:n}=t;return!o.isPrimary||o.button!==0?!1:(n?.({event:o}),!0)}}];var Y$={move:{name:"mousemove"},end:{name:"mouseup"}},Ih;(function(e){e[e.RightClick=2]="RightClick"})(Ih||(Ih={}));var Sh=class extends Vd{constructor(t){super(t,Y$,Za(t.event.target))}};Sh.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:o}=e,{onActivation:n}=t;return o.button===Ih.RightClick?!1:(n?.({event:o}),!0)}}];var wh={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}},kh=class extends Vd{constructor(t){super(t,wh)}static setup(){return window.addEventListener(wh.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(wh.move.name,t)};function t(){}}};kh.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:o}=e,{onActivation:n}=t,{touches:r}=o;return r.length>1?!1:(n?.({event:o}),!0)}}];var Gd;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Gd||(Gd={}));var $p;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})($p||($p={}));function J$(e){let{acceleration:t,activator:o=Gd.Pointer,canScroll:n,draggingRect:r,enabled:a,interval:s=5,order:i=$p.TreeOrder,pointerCoordinates:d,scrollableAncestors:c,scrollableAncestorRects:u,delta:m,threshold:p}=e,f=ez({delta:m,disabled:!a}),[g,h]=rk(),y=E({x:0,y:0}),x=E({x:0,y:0}),C=W(()=>{switch(o){case Gd.Pointer:return d?{top:d.y,bottom:d.y,left:d.x,right:d.x}:null;case Gd.DraggableRect:return r}},[o,r,d]),b=E(null),L=R(()=>{let k=b.current;if(!k)return;let I=y.current.x*x.current.x,T=y.current.y*x.current.y;k.scrollBy(I,T)},[]),w=W(()=>i===$p.TreeOrder?[...c].reverse():c,[i,c]);H(()=>{if(!a||!c.length||!C){h();return}for(let k of w){if(n?.(k)===!1)continue;let I=c.indexOf(k),T=u[I];if(!T)continue;let{direction:S,speed:P}=$$(k,T,C,t,p);for(let A of["x","y"])f[A][S[A]]||(P[A]=0,S[A]=0);if(P.x>0||P.y>0){h(),b.current=k,g(L,s),y.current=P,x.current=S;return}}y.current={x:0,y:0},x.current={x:0,y:0},h()},[t,L,n,h,a,s,JSON.stringify(C),JSON.stringify(f),g,c,w,u,JSON.stringify(p)])}var Z$={x:{[to.Backward]:!1,[to.Forward]:!1},y:{[to.Backward]:!1,[to.Forward]:!1}};function ez(e){let{delta:t,disabled:o}=e,n=Bp(t);return wi(r=>{if(o||!n||!r)return Z$;let a={x:Math.sign(t.x-n.x),y:Math.sign(t.y-n.y)};return{x:{[to.Backward]:r.x[to.Backward]||a.x===-1,[to.Forward]:r.x[to.Forward]||a.x===1},y:{[to.Backward]:r.y[to.Backward]||a.y===-1,[to.Forward]:r.y[to.Forward]||a.y===1}}},[o,t,n])}function tz(e,t){let o=t!=null?e.get(t):void 0,n=o?o.node.current:null;return wi(r=>{var a;return t==null?null:(a=n??r)!=null?a:null},[n,t])}function oz(e,t){return W(()=>e.reduce((o,n)=>{let{sensor:r}=n,a=r.activators.map(s=>({eventName:s.eventName,handler:t(s.handler,n)}));return[...o,...a]},[]),[e,t])}var Qd;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Qd||(Qd={}));var Lh;(function(e){e.Optimized="optimized"})(Lh||(Lh={}));var hk=new Map;function nz(e,t){let{dragging:o,dependencies:n,config:r}=t,[a,s]=q(null),{frequency:i,measure:d,strategy:c}=r,u=E(e),m=y(),p=bi(m),f=R(function(x){x===void 0&&(x=[]),!p.current&&s(C=>C===null?x:C.concat(x.filter(b=>!C.includes(b))))},[p]),g=E(null),h=wi(x=>{if(m&&!o)return hk;if(!x||x===hk||u.current!==e||a!=null){let C=new Map;for(let b of e){if(!b)continue;if(a&&a.length>0&&!a.includes(b.id)&&b.rect.current){C.set(b.id,b.rect.current);continue}let L=b.node.current,w=L?new jd(d(L),L):null;b.rect.current=w,w&&C.set(b.id,w)}return C}return x},[e,a,o,m,d]);return H(()=>{u.current=e},[e]),H(()=>{m||f()},[o,m]),H(()=>{a&&a.length>0&&s(null)},[JSON.stringify(a)]),H(()=>{m||typeof i!="number"||g.current!==null||(g.current=setTimeout(()=>{f(),g.current=null},i))},[i,m,f,...n]),{droppableRects:h,measureDroppableContainers:f,measuringScheduled:a!=null};function y(){switch(c){case Qd.Always:return!1;case Qd.BeforeDragging:return o;default:return!o}}}function Ok(e,t){return wi(o=>e?o||(typeof t=="function"?t(e):e):null,[t,e])}function rz(e,t){return Ok(e,t)}function az(e){let{callback:t,disabled:o}=e,n=Fp(t),r=W(()=>{if(o||typeof window>"u"||typeof window.MutationObserver>"u")return;let{MutationObserver:a}=window;return new a(n)},[n,o]);return H(()=>()=>r?.disconnect(),[r]),r}function zp(e){let{callback:t,disabled:o}=e,n=Fp(t),r=W(()=>{if(o||typeof window>"u"||typeof window.ResizeObserver>"u")return;let{ResizeObserver:a}=window;return new a(n)},[o]);return H(()=>()=>r?.disconnect(),[r]),r}function sz(e){return new jd(ss(e),e)}function yk(e,t,o){t===void 0&&(t=sz);let[n,r]=q(null);function a(){r(d=>{if(!e)return null;if(e.isConnected===!1){var c;return(c=d??o)!=null?c:null}let u=t(e);return JSON.stringify(d)===JSON.stringify(u)?d:u})}let s=az({callback(d){if(e)for(let c of d){let{type:u,target:m}=c;if(u==="childList"&&m instanceof HTMLElement&&m.contains(e)){a();break}}}}),i=zp({callback:a});return dn(()=>{a(),e?(i?.observe(e),s?.observe(document.body,{childList:!0,subtree:!0})):(i?.disconnect(),s?.disconnect())},[e]),n}function iz(e){let t=Ok(e);return Pk(e,t)}var vk=[];function lz(e){let t=E(e),o=wi(n=>e?n&&n!==vk&&e&&t.current&&e.parentNode===t.current.parentNode?n:Xd(e):vk,[e]);return H(()=>{t.current=e},[e]),o}function dz(e){let[t,o]=q(null),n=E(e),r=R(a=>{let s=xh(a.target);s&&o(i=>i?(i.set(s,Th(s)),new Map(i)):null)},[]);return H(()=>{let a=n.current;if(e!==a){s(a);let i=e.map(d=>{let c=xh(d);return c?(c.addEventListener("scroll",r,{passive:!0}),[c,Th(c)]):null}).filter(d=>d!=null);o(i.length?new Map(i):null),n.current=e}return()=>{s(e),s(a)};function s(i){i.forEach(d=>{let c=xh(d);c?.removeEventListener("scroll",r)})}},[r,e]),W(()=>e.length?t?Array.from(t.values()).reduce((a,s)=>ts(a,s),In):Dk(e):In,[e,t])}function Ck(e,t){t===void 0&&(t=[]);let o=E(null);return H(()=>{o.current=null},t),H(()=>{let n=e!==In;n&&!o.current&&(o.current=e),!n&&o.current&&(o.current=null)},[e]),o.current?os(e,o.current):In}function cz(e){H(()=>{if(!zd)return;let t=e.map(o=>{let{sensor:n}=o;return n.setup==null?void 0:n.setup()});return()=>{for(let o of t)o?.()}},e.map(t=>{let{sensor:o}=t;return o}))}function uz(e,t){return W(()=>e.reduce((o,n)=>{let{eventName:r,handler:a}=n;return o[r]=s=>{a(s,t)},o},{}),[e,t])}function Fk(e){return W(()=>e?F$(e):null,[e])}var xk=[];function pz(e,t){t===void 0&&(t=ss);let[o]=e,n=Fk(o?So(o):null),[r,a]=q(xk);function s(){a(()=>e.length?e.map(d=>Ak(d)?n:new jd(t(d),d)):xk)}let i=zp({callback:s});return dn(()=>{i?.disconnect(),s(),e.forEach(d=>i?.observe(d))},[e]),r}function mz(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return xi(t)?t:e}function fz(e){let{measure:t}=e,[o,n]=q(null),r=R(c=>{for(let{target:u}of c)if(xi(u)){n(m=>{let p=t(u);return m?{...m,width:p.width,height:p.height}:p});break}},[t]),a=zp({callback:r}),s=R(c=>{let u=mz(c);a?.disconnect(),u&&a?.observe(u),n(u?t(u):null)},[t,a]),[i,d]=Kd(s);return W(()=>({nodeRef:i,rect:o,setRef:d}),[o,i,d])}var gz=[{sensor:Ii,options:{}},{sensor:Ti,options:{}}],hz={current:{}},Hp={draggable:{measure:pk},droppable:{measure:pk,strategy:Qd.WhileDragging,frequency:Lh.Optimized},dragOverlay:{measure:ss}},as=class extends Map{get(t){var o;return t!=null&&(o=super.get(t))!=null?o:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:o}=t;return!o})}getNodeFor(t){var o,n;return(o=(n=this.get(t))==null?void 0:n.node.current)!=null?o:void 0}},yz={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new as,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Up},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Hp,measureDroppableContainers:Up,windowRect:null,measuringScheduled:!1},vz={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Up,draggableNodes:new Map,over:null,measureDroppableContainers:Up},Kp=qe(vz),Bk=qe(yz);function Cz(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new as}}}function xz(e,t){switch(t.type){case Gt.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Gt.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 Gt.DragEnd:case Gt.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Gt.RegisterDroppable:{let{element:o}=t,{id:n}=o,r=new as(e.droppable.containers);return r.set(n,o),{...e,droppable:{...e.droppable,containers:r}}}case Gt.SetDroppableDisabled:{let{id:o,key:n,disabled:r}=t,a=e.droppable.containers.get(o);if(!a||n!==a.key)return e;let s=new as(e.droppable.containers);return s.set(o,{...a,disabled:r}),{...e,droppable:{...e.droppable,containers:s}}}case Gt.UnregisterDroppable:{let{id:o,key:n}=t,r=e.droppable.containers.get(o);if(!r||n!==r.key)return e;let a=new as(e.droppable.containers);return a.delete(o),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function bz(e){let{disabled:t}=e,{active:o,activatorEvent:n,draggableNodes:r}=Pt(Kp),a=Bp(n),s=Bp(o?.id);return H(()=>{if(!t&&!n&&a&&s!=null){if(!qd(a)||document.activeElement===a.target)return;let i=r.get(s);if(!i)return;let{activatorNode:d,node:c}=i;if(!d.current&&!c.current)return;requestAnimationFrame(()=>{for(let u of[d.current,c.current]){if(!u)continue;let m=sk(u);if(m){m.focus();break}}})}},[n,t,r,s,a]),null}function wz(e,t){let{transform:o,...n}=t;return e!=null&&e.length?e.reduce((r,a)=>a({transform:r,...n}),o):o}function Tz(e){return W(()=>({draggable:{...Hp.draggable,...e?.draggable},droppable:{...Hp.droppable,...e?.droppable},dragOverlay:{...Hp.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Iz(e){let{activeNode:t,measure:o,initialRect:n,config:r=!0}=e,a=E(!1),{x:s,y:i}=typeof r=="boolean"?{x:r,y:r}:r;dn(()=>{if(!s&&!i||!t){a.current=!1;return}if(a.current||!n)return;let c=t?.node.current;if(!c||c.isConnected===!1)return;let u=o(c),m=Pk(u,n);if(s||(m.x=0),i||(m.y=0),a.current=!0,Math.abs(m.x)>0||Math.abs(m.y)>0){let p=Rk(c);p&&p.scrollBy({top:m.y,left:m.x})}},[t,s,i,n,o])}var Hk=qe({...In,scaleX:1,scaleY:1}),ra;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(ra||(ra={}));var Uk=pe(function(t){var o,n,r,a;let{id:s,accessibility:i,autoScroll:d=!0,children:c,sensors:u=gz,collisionDetection:m=E$,measuring:p,modifiers:f,...g}=t,h=Na(xz,void 0,Cz),[y,x]=h,[C,b]=I$(),[L,w]=q(ra.Uninitialized),k=L===ra.Initialized,{draggable:{active:I,nodes:T,translate:S},droppable:{containers:P}}=y,A=I!=null?T.get(I):null,N=E({initial:null,translated:null}),B=W(()=>{var At;return I!=null?{id:I,data:(At=A?.data)!=null?At:hz,rect:N}:null},[I,A]),O=E(null),[j,U]=q(null),[D,J]=q(null),G=bi(g,Object.values(g)),M=es("DndDescribedBy",s),X=W(()=>P.getEnabled(),[P]),F=Tz(p),{droppableRects:ee,measureDroppableContainers:Y,measuringScheduled:ae}=nz(X,{dragging:k,dependencies:[S.x,S.y],config:F.droppable}),te=tz(T,I),de=W(()=>D?Wd(D):null,[D]),ge=hn(),ne=rz(te,F.draggable.measure);Iz({activeNode:I!=null?T.get(I):null,config:ge.layoutShiftCompensation,initialRect:ne,measure:F.draggable.measure});let Z=yk(te,F.draggable.measure,ne),ve=yk(te?te.parentElement:null),he=E({activatorEvent:null,active:null,activeNode:te,collisionRect:null,collisions:null,droppableRects:ee,draggableNodes:T,draggingNode:null,draggingNodeRect:null,droppableContainers:P,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Ae=P.getNodeFor((o=he.current.over)==null?void 0:o.id),De=fz({measure:F.dragOverlay.measure}),je=(n=De.nodeRef.current)!=null?n:te,ot=k?(r=De.rect)!=null?r:Z:null,me=!!(De.nodeRef.current&&De.rect),Me=iz(me?null:Z),ue=Fk(je?So(je):null),ce=lz(k?Ae??te:null),Ze=pz(ce),pt=wz(f,{transform:{x:S.x-Me.x,y:S.y-Me.y,scaleX:1,scaleY:1},activatorEvent:D,active:B,activeNodeRect:Z,containerNodeRect:ve,draggingNodeRect:ot,over:he.current.over,overlayNodeRect:De.rect,scrollableAncestors:ce,scrollableAncestorRects:Ze,windowRect:ue}),ze=de?ts(de,S):null,et=dz(ce),Et=Ck(et),ft=Ck(et,[Z]),Ct=ts(pt,Et),gt=ot?N$(ot,pt):null,Dt=B&&gt?m({active:B,collisionRect:gt,droppableRects:ee,droppableContainers:X,pointerCoordinates:ze}):null,Mt=Rh(Dt,"id"),[se,Le]=q(null),be=me?pt:ts(pt,ft),Xe=M$(be,(a=se?.rect)!=null?a:null,Z),xt=E(null),tt=R((At,St)=>{let{sensor:bt,options:mo}=St;if(O.current==null)return;let kt=T.get(O.current);if(!kt)return;let _t=At.nativeEvent,Xt=new bt({active:O.current,activeNode:kt,event:_t,options:mo,context:he,onAbort(lt){if(!T.get(lt))return;let{onDragAbort:Ht}=G.current,Yt={id:lt};Ht?.(Yt),C({type:"onDragAbort",event:Yt})},onPending(lt,Bt,Ht,Yt){if(!T.get(lt))return;let{onDragPending:fo}=G.current,go={id:lt,constraint:Bt,initialCoordinates:Ht,offset:Yt};fo?.(go),C({type:"onDragPending",event:go})},onStart(lt){let Bt=O.current;if(Bt==null)return;let Ht=T.get(Bt);if(!Ht)return;let{onDragStart:Yt}=G.current,qo={activatorEvent:_t,active:{id:Bt,data:Ht.data,rect:N}};(0,ns.unstable_batchedUpdates)(()=>{Yt?.(qo),w(ra.Initializing),x({type:Gt.DragStart,initialCoordinates:lt,active:Bt}),C({type:"onDragStart",event:qo}),U(xt.current),J(_t)})},onMove(lt){x({type:Gt.DragMove,coordinates:lt})},onEnd:nt(Gt.DragEnd),onCancel:nt(Gt.DragCancel)});xt.current=Xt;function nt(lt){return async function(){let{active:Ht,collisions:Yt,over:qo,scrollAdjustedTranslate:fo}=he.current,go=null;if(Ht&&fo){let{cancelDrop:Jt}=G.current;go={activatorEvent:_t,active:Ht,collisions:Yt,delta:fo,over:qo},lt===Gt.DragEnd&&typeof Jt=="function"&&await Promise.resolve(Jt(go))&&(lt=Gt.DragCancel)}O.current=null,(0,ns.unstable_batchedUpdates)(()=>{x({type:lt}),w(ra.Uninitialized),Le(null),U(null),J(null),xt.current=null;let Jt=lt===Gt.DragEnd?"onDragEnd":"onDragCancel";if(go){let Un=G.current[Jt];Un?.(go),C({type:Jt,event:go})}})}}},[T]),It=R((At,St)=>(bt,mo)=>{let kt=bt.nativeEvent,_t=T.get(mo);if(O.current!==null||!_t||kt.dndKit||kt.defaultPrevented)return;let Xt={active:_t};At(bt,St.options,Xt)===!0&&(kt.dndKit={capturedBy:St.sensor},O.current=mo,tt(bt,St))},[T,tt]),po=oz(u,It);cz(u),dn(()=>{Z&&L===ra.Initializing&&w(ra.Initialized)},[Z,L]),H(()=>{let{onDragMove:At}=G.current,{active:St,activatorEvent:bt,collisions:mo,over:kt}=he.current;if(!St||!bt)return;let _t={active:St,activatorEvent:bt,collisions:mo,delta:{x:Ct.x,y:Ct.y},over:kt};(0,ns.unstable_batchedUpdates)(()=>{At?.(_t),C({type:"onDragMove",event:_t})})},[Ct.x,Ct.y]),H(()=>{let{active:At,activatorEvent:St,collisions:bt,droppableContainers:mo,scrollAdjustedTranslate:kt}=he.current;if(!At||O.current==null||!St||!kt)return;let{onDragOver:_t}=G.current,Xt=mo.get(Mt),nt=Xt&&Xt.rect.current?{id:Xt.id,rect:Xt.rect.current,data:Xt.data,disabled:Xt.disabled}:null,lt={active:At,activatorEvent:St,collisions:bt,delta:{x:kt.x,y:kt.y},over:nt};(0,ns.unstable_batchedUpdates)(()=>{Le(nt),_t?.(lt),C({type:"onDragOver",event:lt})})},[Mt]),dn(()=>{he.current={activatorEvent:D,active:B,activeNode:te,collisionRect:gt,collisions:Dt,droppableRects:ee,draggableNodes:T,draggingNode:je,draggingNodeRect:ot,droppableContainers:P,over:se,scrollableAncestors:ce,scrollAdjustedTranslate:Ct},N.current={initial:ot,translated:gt}},[B,te,Dt,gt,T,je,ot,ee,P,se,ce,Ct]),J$({...ge,delta:S,draggingRect:gt,pointerCoordinates:ze,scrollableAncestors:ce,scrollableAncestorRects:Ze});let Ko=W(()=>({active:B,activeNode:te,activeNodeRect:Z,activatorEvent:D,collisions:Dt,containerNodeRect:ve,dragOverlay:De,draggableNodes:T,droppableContainers:P,droppableRects:ee,over:se,measureDroppableContainers:Y,scrollableAncestors:ce,scrollableAncestorRects:Ze,measuringConfiguration:F,measuringScheduled:ae,windowRect:ue}),[B,te,Z,D,Dt,ve,De,T,P,ee,se,Y,ce,Ze,F,ae,ue]),Qt=W(()=>({activatorEvent:D,activators:po,active:B,activeNodeRect:Z,ariaDescribedById:{draggable:M},dispatch:x,draggableNodes:T,over:se,measureDroppableContainers:Y}),[D,po,B,Z,x,M,T,se,Y]);return Zt.createElement(wk.Provider,{value:b},Zt.createElement(Kp.Provider,{value:Qt},Zt.createElement(Bk.Provider,{value:Ko},Zt.createElement(Hk.Provider,{value:Xe},c)),Zt.createElement(bz,{disabled:i?.restoreFocus===!1})),Zt.createElement(L$,{...i,hiddenTextDescribedById:M}));function hn(){let At=j?.autoScrollEnabled===!1,St=typeof d=="object"?d.enabled===!1:d===!1,bt=k&&!At&&!St;return typeof d=="object"?{...d,enabled:bt}:{enabled:bt}}}),Sz=qe(null),bk="button",kz="Draggable";function $k(e){let{id:t,data:o,disabled:n=!1,attributes:r}=e,a=es(kz),{activators:s,activatorEvent:i,active:d,activeNodeRect:c,ariaDescribedById:u,draggableNodes:m,over:p}=Pt(Kp),{role:f=bk,roleDescription:g="draggable",tabIndex:h=0}=r??{},y=d?.id===t,x=Pt(y?Hk:Sz),[C,b]=Kd(),[L,w]=Kd(),k=uz(s,t),I=bi(o);dn(()=>(m.set(t,{id:t,key:a,node:C,activatorNode:L,data:I}),()=>{let S=m.get(t);S&&S.key===a&&m.delete(t)}),[m,t]);let T=W(()=>({role:f,tabIndex:h,"aria-disabled":n,"aria-pressed":y&&f===bk?!0:void 0,"aria-roledescription":g,"aria-describedby":u.draggable}),[n,f,h,y,g,u.draggable]);return{active:d,activatorEvent:i,activeNodeRect:c,attributes:T,isDragging:y,listeners:n?void 0:k,node:C,over:p,setNodeRef:b,setActivatorNodeRef:w,transform:x}}function zk(){return Pt(Bk)}var Lz="Droppable",Pz={timeout:25};function Kk(e){let{data:t,disabled:o=!1,id:n,resizeObserverConfig:r}=e,a=es(Lz),{active:s,dispatch:i,over:d,measureDroppableContainers:c}=Pt(Kp),u=E({disabled:o}),m=E(!1),p=E(null),f=E(null),{disabled:g,updateMeasurementsFor:h,timeout:y}={...Pz,...r},x=bi(h??n),C=R(()=>{if(!m.current){m.current=!0;return}f.current!=null&&clearTimeout(f.current),f.current=setTimeout(()=>{c(Array.isArray(x.current)?x.current:[x.current]),f.current=null},y)},[y]),b=zp({callback:C,disabled:g||!s}),L=R((T,S)=>{b&&(S&&(b.unobserve(S),m.current=!1),T&&b.observe(T))},[b]),[w,k]=Kd(L),I=bi(t);return H(()=>{!b||!w.current||(b.disconnect(),m.current=!1,b.observe(w.current))},[w,b]),H(()=>(i({type:Gt.RegisterDroppable,element:{id:n,key:a,disabled:o,node:w,rect:p,data:I}}),()=>i({type:Gt.UnregisterDroppable,key:a,id:n})),[n]),H(()=>{o!==u.current.disabled&&(i({type:Gt.SetDroppableDisabled,id:n,key:a,disabled:o}),u.current.disabled=o)},[n,a,o,i]),{active:s,rect:p,isOver:d?.id===n,node:w,over:d,setNodeRef:k}}$();function qk(e,t,o){let n=e.slice();return n.splice(o<0?n.length+o:o,0,n.splice(t,1)[0]),n}function Rz(e,t){return e.reduce((o,n,r)=>{let a=t.get(n);return a&&(o[r]=a),o},Array(e.length))}function qp(e){return e!==null&&e>=0}function Ez(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let o=0;o<e.length;o++)if(e[o]!==t[o])return!1;return!0}function Mz(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}var Wk=e=>{let{rects:t,activeIndex:o,overIndex:n,index:r}=e,a=qk(t,n,o),s=t[r],i=a[r];return!i||!s?null:{x:i.left-s.left,y:i.top-s.top,scaleX:i.width/s.width,scaleY:i.height/s.height}};var Wp={scaleX:1,scaleY:1},Gk=e=>{var t;let{activeIndex:o,activeNodeRect:n,index:r,rects:a,overIndex:s}=e,i=(t=a[o])!=null?t:n;if(!i)return null;if(r===o){let c=a[s];return c?{x:0,y:o<s?c.top+c.height-(i.top+i.height):c.top-i.top,...Wp}:null}let d=Az(a,r,o);return r>o&&r<=s?{x:0,y:-i.height-d,...Wp}:r<o&&r>=s?{x:0,y:i.height+d,...Wp}:{x:0,y:0,...Wp}};function Az(e,t,o){let n=e[t],r=e[t-1],a=e[t+1];return n?o<t?r?n.top-(r.top+r.height):a?a.top-(n.top+n.height):0:a?a.top-(n.top+n.height):r?n.top-(r.top+r.height):0:0}var jk="Sortable",Vk=Zt.createContext({activeIndex:-1,containerId:jk,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Wk,disabled:{draggable:!1,droppable:!1}});function Qk(e){let{children:t,id:o,items:n,strategy:r=Wk,disabled:a=!1}=e,{active:s,dragOverlay:i,droppableRects:d,over:c,measureDroppableContainers:u}=zk(),m=es(jk,o),p=i.rect!==null,f=W(()=>n.map(k=>typeof k=="object"&&"id"in k?k.id:k),[n]),g=s!=null,h=s?f.indexOf(s.id):-1,y=c?f.indexOf(c.id):-1,x=E(f),C=!Ez(f,x.current),b=y!==-1&&h===-1||C,L=Mz(a);dn(()=>{C&&g&&u(f)},[C,f,g,u]),H(()=>{x.current=f},[f]);let w=W(()=>({activeIndex:h,containerId:m,disabled:L,disableTransforms:b,items:f,overIndex:y,useDragOverlay:p,sortedRects:Rz(f,d),strategy:r}),[h,m,L.draggable,L.droppable,b,f,y,d,p,r]);return Zt.createElement(Vk.Provider,{value:w},t)}var Nz=e=>{let{id:t,items:o,activeIndex:n,overIndex:r}=e;return qk(o,n,r).indexOf(t)},Dz=e=>{let{containerId:t,isSorting:o,wasDragging:n,index:r,items:a,newIndex:s,previousItems:i,previousContainerId:d,transition:c}=e;return!c||!n||i!==a&&r===s?!1:o?!0:s!==r&&t===d},_z={duration:200,easing:"ease"},Xk="transform",Oz=na.Transition.toString({property:Xk,duration:0,easing:"linear"}),Fz={roleDescription:"sortable"};function Bz(e){let{disabled:t,index:o,node:n,rect:r}=e,[a,s]=q(null),i=E(o);return dn(()=>{if(!t&&o!==i.current&&n.current){let d=r.current;if(d){let c=ss(n.current,{ignoreTransform:!0}),u={x:d.left-c.left,y:d.top-c.top,scaleX:d.width/c.width,scaleY:d.height/c.height};(u.x||u.y)&&s(u)}}o!==i.current&&(i.current=o)},[t,o,n,r]),H(()=>{a&&s(null)},[a]),a}function Yk(e){let{animateLayoutChanges:t=Dz,attributes:o,disabled:n,data:r,getNewIndex:a=Nz,id:s,strategy:i,resizeObserverConfig:d,transition:c=_z}=e,{items:u,containerId:m,activeIndex:p,disabled:f,disableTransforms:g,sortedRects:h,overIndex:y,useDragOverlay:x,strategy:C}=Pt(Vk),b=Hz(n,f),L=u.indexOf(s),w=W(()=>({sortable:{containerId:m,index:L,items:u},...r}),[m,r,L,u]),k=W(()=>u.slice(u.indexOf(s)),[u,s]),{rect:I,node:T,isOver:S,setNodeRef:P}=Kk({id:s,data:w,disabled:b.droppable,resizeObserverConfig:{updateMeasurementsFor:k,...d}}),{active:A,activatorEvent:N,activeNodeRect:B,attributes:O,setNodeRef:j,listeners:U,isDragging:D,over:J,setActivatorNodeRef:G,transform:M}=$k({id:s,data:w,attributes:{...Fz,...o},disabled:b.draggable}),X=nk(P,j),F=!!A,ee=F&&!g&&qp(p)&&qp(y),Y=!x&&D,ae=Y&&ee?M:null,de=ee?ae??(i??C)({rects:h,activeNodeRect:B,activeIndex:p,overIndex:y,index:L}):null,ge=qp(p)&&qp(y)?a({id:s,items:u,activeIndex:p,overIndex:y}):L,ne=A?.id,Z=E({activeId:ne,items:u,newIndex:ge,containerId:m}),ve=u!==Z.current.items,he=t({active:A,containerId:m,isDragging:D,isSorting:F,id:s,index:L,items:u,newIndex:Z.current.newIndex,previousItems:Z.current.items,previousContainerId:Z.current.containerId,transition:c,wasDragging:Z.current.activeId!=null}),Ae=Bz({disabled:!he,index:L,node:T,rect:I});return H(()=>{F&&Z.current.newIndex!==ge&&(Z.current.newIndex=ge),m!==Z.current.containerId&&(Z.current.containerId=m),u!==Z.current.items&&(Z.current.items=u)},[F,ge,m,u]),H(()=>{if(ne===Z.current.activeId)return;if(ne!=null&&Z.current.activeId==null){Z.current.activeId=ne;return}let je=setTimeout(()=>{Z.current.activeId=ne},50);return()=>clearTimeout(je)},[ne]),{active:A,activeIndex:p,attributes:O,data:w,rect:I,index:L,newIndex:ge,items:u,isOver:S,isSorting:F,isDragging:D,listeners:U,node:T,overIndex:y,over:J,setNodeRef:X,setActivatorNodeRef:G,setDroppableNodeRef:P,setDraggableNodeRef:j,transform:Ae??de,transition:De()};function De(){if(Ae||ve&&Z.current.newIndex===L)return Oz;if(!(Y&&!qd(N)||!c)&&(F||he))return na.Transition.toString({...c,property:Xk})}}function Hz(e,t){var o,n;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(o=e?.draggable)!=null?o:t.draggable,droppable:(n=e?.droppable)!=null?n:t.droppable}}function Gp(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 Uz=[Ve.Down,Ve.Right,Ve.Up,Ve.Left],Jk=(e,t)=>{let{context:{active:o,collisionRect:n,droppableRects:r,droppableContainers:a,over:s,scrollableAncestors:i}}=t;if(Uz.includes(e.code)){if(e.preventDefault(),!o||!n)return;let d=[];a.getEnabled().forEach(m=>{if(!m||m!=null&&m.disabled)return;let p=r.get(m.id);if(p)switch(e.code){case Ve.Down:n.top<p.top&&d.push(m);break;case Ve.Up:n.top>p.top&&d.push(m);break;case Ve.Left:n.left>p.left&&d.push(m);break;case Ve.Right:n.left<p.left&&d.push(m);break}});let c=Lk({active:o,collisionRect:n,droppableRects:r,droppableContainers:d,pointerCoordinates:null}),u=Rh(c,"id");if(u===s?.id&&c.length>1&&(u=c[1].id),u!=null){let m=a.get(o.id),p=a.get(u),f=p?r.get(p.id):null,g=p?.node.current;if(g&&f&&m&&p){let y=Xd(g).some((k,I)=>i[I]!==k),x=Zk(m,p),C=$z(m,p),b=y||!x?{x:0,y:0}:{x:C?n.width-f.width:0,y:C?n.height-f.height:0},L={x:f.left,y:f.top};return b.x&&b.y?L:os(L,b)}}}};function Zk(e,t){return!Gp(e)||!Gp(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function $z(e,t){return!Gp(e)||!Gp(t)||!Zk(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}function zz(e,t,o){let n={...e};return t.top+e.y<=o.top?n.y=o.top-t.top:t.bottom+e.y>=o.top+o.height&&(n.y=o.top+o.height-t.bottom),t.left+e.x<=o.left?n.x=o.left-t.left:t.right+e.x>=o.left+o.width&&(n.x=o.left+o.width-t.right),n}var e0=e=>{let{draggingNodeRect:t,transform:o,scrollableAncestorRects:n}=e,r=n[0];return!t||!r?o:zz(o,t,r)},t0=e=>{let{transform:t}=e;return{...t,x:0}};$();$();var jp={"2xl":1536,"3xl":1600,"4xl":2e3,lg:1024,md:768,sm:640,xl:1280};function o0(e){return`(min-width: ${typeof e=="number"?e:jp[e]}px)`}function n0(e){return`(max-width: ${(typeof e=="number"?e:jp[e])-1}px)`}function Kz(e){if(typeof e!="string"){let o=[];return e.min!=null&&o.push(o0(e.min)),e.max!=null&&o.push(n0(e.max)),e.pointer==="coarse"&&o.push("(pointer: coarse)"),e.pointer==="fine"&&o.push("(pointer: fine)"),o.length===0?"(min-width: 0px)":o.join(" and ")}if(e.startsWith("("))return e;let t=[];for(let o of e.split(":"))if(o.startsWith("max-")){let n=o.slice(4);n in jp&&t.push(n0(n))}else o in jp&&t.push(o0(o));return t.length>0?t.join(" and "):e}function qz(){return!1}function Vp(e){let t=Kz(e),o=R(r=>{if(typeof window>"u")return()=>{};let a=window.matchMedia(t);return a.addEventListener("change",r),()=>a.removeEventListener("change",r)},[t]),n=R(()=>typeof window>"u"?!1:window.matchMedia(t).matches,[t]);return Go(o,n,qz)}function Yd(e){return e.source?.kind==="user"?!1:e.source?.kind==="scheduled-wake"?e.management===void 0:!0}var Si=e=>(e??"").split(`
3550
- `).map(t=>t.trim()).find(t=>t!=="")??"";function r0(e,t){let o=new Date(e);return Number.isNaN(o.getTime())?e:new Intl.DateTimeFormat(t,{...o.toDateString()===new Date().toDateString()?{}:{dateStyle:"short"},timeStyle:"short"}).format(o)}var Qp={user:"turnQueue.sourceUser",schedule:"turnQueue.sourceSchedule","scheduled-wake":"turnQueue.sourceScheduledWake",record:"turnQueue.sourceSession",session:"turnQueue.sourceSession",reply:"turnQueue.sourceReply","child-report":"turnQueue.sourceChildReport","plugin-wake":"turnQueue.sourcePluginWake","board-dispatch":"turnQueue.sourceBoardDispatch","plugin-notice":"turnQueue.sourcePluginNotice","home-machine":"turnQueue.sourceHomeMachine","restart-resume":"turnQueue.sourceRestartResume"};function a0({environmentId:e,pluginId:t,label:o}){let n=Xn(e,t??"");return t===void 0||n===null?l(oe,{children:o}):l(Mo,{environmentId:e,pluginId:t})}function Eh({source:e,environmentId:t}){let{t:o}=z();return e===void 0?null:l(jr,{variant:e.kind==="user"?"outline":e.kind==="scheduled-wake"?"info":"muted",size:"sm","data-queue-source":e.kind,children:e.kind==="person"?e.displayName:e.kind==="scheduled-wake"||e.kind==="schedule"?v(oe,{children:[o(Qp[e.kind]),e.pluginId===void 0?null:l(a0,{environmentId:t,pluginId:e.pluginId,label:""})]}):e.kind==="plugin-wake"||e.kind==="plugin-notice"?l(a0,{environmentId:t,pluginId:e.pluginId,label:o(Qp[e.kind])}):o(Qp[e.kind])})}function Xp(e,t,o){let n=wb(t===null?null:{environmentId:e,threadId:t},o??void 0);return t===null?null:n??o}function Mh({title:e,text:t}){let{t:o}=z();return e===null||e===""?l(oe,{children:t}):l(oe,{children:t===""?o("turnQueue.titleOnly",{title:e}):o("turnQueue.sessionLine",{sender:e,text:t})})}function Wz({recordId:e,readRecord:t,environmentId:o}){let{t:n}=z(),r=t(e),a=r===null||typeof r=="string"?null:r,s=a?.from,i=Xp(o,s?.kind==="thread"?s.threadId:null,s?.kind==="thread"?s.title:null);if(r===null)return l(oe,{children:"\u2026"});if(a===null||a.text===null)return l(oe,{children:n("turnQueue.messageUnavailable")});let d=s===void 0?null:s.kind==="thread"?i:s.displayName;return l(Mh,{title:d,text:Si(Dd(a.text))})}function Gz({recordId:e,readRecord:t,environmentId:o}){let n=t(e),r=n===null||typeof n=="string"?null:n,a=t(r?.replyRecordId??null),s=a===null||typeof a=="string"?null:a,i=s?.from??r?.to,d=Xp(o,i?.kind==="thread"?i.threadId:null,i?.kind==="thread"?i.title:null),c=i===void 0?null:i.kind==="thread"?d:i.displayName,u=s?.text==null?"":Si(Dd(s.text));return c===null&&u===""?null:l(Mh,{title:c,text:u})}function jz(e){let t=Xp(e.environmentId,e.threadId,e.threadTitle);return l(Mh,{title:t,text:e.text})}function Vz(e){let{t}=z(),{source:o}=e,n=Xp(e.environmentId,o.childThreadId,o.childTitle);return l(oe,{children:t(o.outcome==="settled"?"turnQueue.childReportSettled":o.outcome==="failed"?"turnQueue.childReportFailed":"turnQueue.childReportLine",{title:n??"",text:e.text})})}function s0({entry:e,readRecord:t,environmentId:o}){let{t:n}=z(),r=e.source;switch(r?.kind){case"scheduled-wake":return l(oe,{children:n("turnQueue.wakeLine",{time:r0(r.dueAt),note:e.text??""})});case"record":return t===void 0?null:l(Wz,{recordId:r.recordId,readRecord:t,environmentId:o});case"reply":return t===void 0?null:l(Gz,{recordId:r.recordId,readRecord:t,environmentId:o});case"session":return l(jz,{environmentId:o,threadId:r.threadId,threadTitle:r.threadTitle,text:Si(e.text)});case"child-report":return l(Vz,{environmentId:o,source:r,text:Si(e.text)});case"plugin-wake":case"person":case"board-dispatch":case"plugin-notice":case"home-machine":case"restart-resume":return l(oe,{children:Si(e.text)});default:return l(oe,{children:e.text||n("turnQueue.attachmentsOnly")})}}$();var Ah={};Ut(Ah,{LexicalComposerContext:()=>i0,createLexicalComposerContext:()=>Qz,useLexicalComposerContext:()=>Xz});$();var i0=qe(null);function Qz(e,t){let o=null;return e!=null&&(o=e[1]),{getTheme:function(){return t??(o!=null?o.getTheme():null)}}}function Xz(){let e=Pt(i0);return e==null&&(function(t,...o){let n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",t);for(let a of o)r.append("v",a);throw n.search=r.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)})(8),e}var Nh=Ah,l0=Nh.LexicalComposerContext,d0=Nh.createLexicalComposerContext,ct=Nh.useLexicalComposerContext;var lv={};Ut(lv,{$addUpdateTag:()=>_m,$applyNodeReplacement:()=>wc,$caretFromPoint:()=>fa,$caretRangeFromSelection:()=>xy,$cloneWithProperties:()=>tv,$cloneWithPropertiesEphemeral:()=>N5,$comparePointCaretNext:()=>av,$copyNode:()=>Zy,$create:()=>_5,$createLineBreakNode:()=>Di,$createNodeSelection:()=>By,$createParagraphNode:()=>Lr,$createPoint:()=>En,$createRangeSelection:()=>ZL,$createRangeSelectionFromDom:()=>l5,$createTabNode:()=>Rm,$createTextNode:()=>oo,$extendCaretToRange:()=>nv,$findMatchingParent:()=>nc,$getAdjacentChildCaret:()=>zi,$getAdjacentNode:()=>CP,$getAdjacentSiblingOrParentSiblingCaret:()=>K5,$getCaretInDirection:()=>ga,$getCaretRange:()=>ma,$getCaretRangeInDirection:()=>iv,$getCharacterOffsets:()=>py,$getChildCaret:()=>Rr,$getChildCaretAtIndex:()=>DP,$getChildCaretOrSelf:()=>RP,$getCollapsedCaretRange:()=>EP,$getCommonAncestor:()=>rc,$getCommonAncestorResultBranchOrder:()=>sv,$getEditor:()=>ev,$getNearestNodeFromDOMNode:()=>Dm,$getNearestRootOrShadowRoot:()=>wP,$getNodeByKey:()=>Vt,$getNodeByKeyOrThrow:()=>TP,$getNodeFromDOMNode:()=>Gy,$getPreviousSelection:()=>ys,$getRoot:()=>Yo,$getSelection:()=>Je,$getSiblingCaret:()=>io,$getState:()=>lm,$getStateChange:()=>PK,$getTextContent:()=>u5,$getTextNodeOffset:()=>Rn,$getTextPointCaret:()=>pa,$getTextPointCaretSlice:()=>vy,$getWritableNodeState:()=>Iy,$hasAncestor:()=>Tm,$hasUpdateTag:()=>P5,$insertNodes:()=>c5,$isBlockElementNode:()=>i5,$isChildCaret:()=>Pn,$isDecoratorNode:()=>yt,$isEditorState:()=>g5,$isElementNode:()=>re,$isExtendableTextPointCaret:()=>NP,$isInlineElementOrDecoratorNode:()=>R5,$isLeafNode:()=>S5,$isLineBreakNode:()=>cs,$isNodeCaret:()=>B5,$isNodeSelection:()=>vc,$isParagraphNode:()=>sP,$isRangeSelection:()=>Oe,$isRootNode:()=>lo,$isRootOrShadowRoot:()=>pn,$isSiblingCaret:()=>hs,$isTabNode:()=>Fy,$isTextNode:()=>ke,$isTextPointCaret:()=>Pr,$isTextPointCaretSlice:()=>z5,$isTokenOrSegmented:()=>Ir,$isTokenOrTab:()=>ia,$nodesOfType:()=>L5,$normalizeCaret:()=>kn,$normalizeSelection__EXPERIMENTAL:()=>dm,$onUpdate:()=>bP,$parseSerializedNode:()=>f5,$removeTextFromCaretRange:()=>AP,$rewindSiblingCaret:()=>Gi,$selectAll:()=>k5,$setCompositionKey:()=>ro,$setPointFromCaret:()=>Ki,$setSelection:()=>$o,$setSelectionFromCaretRange:()=>MP,$setState:()=>RK,$splitAtPointCaretNext:()=>G5,$splitNode:()=>E5,$updateRangeSelectionFromCaretRange:()=>ac,ArtificialNode__DO_NOT_USE:()=>bm,BEFORE_INPUT_COMMAND:()=>ky,BLUR_COMMAND:()=>AL,CAN_REDO_COMMAND:()=>$K,CAN_UNDO_COMMAND:()=>zK,CLEAR_EDITOR_COMMAND:()=>HK,CLEAR_HISTORY_COMMAND:()=>UK,CLICK_COMMAND:()=>gL,COLLABORATION_TAG:()=>KL,COMMAND_PRIORITY_CRITICAL:()=>x5,COMMAND_PRIORITY_EDITOR:()=>Pi,COMMAND_PRIORITY_HIGH:()=>C5,COMMAND_PRIORITY_LOW:()=>y5,COMMAND_PRIORITY_NORMAL:()=>v5,COMPOSITION_END_COMMAND:()=>Ry,COMPOSITION_END_TAG:()=>jL,COMPOSITION_START_COMMAND:()=>Py,COMPOSITION_START_TAG:()=>GL,CONTROLLED_TEXT_INSERTION_COMMAND:()=>Ei,COPY_COMMAND:()=>Dy,CUT_COMMAND:()=>_y,DELETE_CHARACTER_COMMAND:()=>dc,DELETE_LINE_COMMAND:()=>uc,DELETE_WORD_COMMAND:()=>cc,DRAGEND_COMMAND:()=>EL,DRAGOVER_COMMAND:()=>RL,DRAGSTART_COMMAND:()=>PL,DROP_COMMAND:()=>LL,DecoratorNode:()=>mc,ElementNode:()=>ca,FOCUS_COMMAND:()=>ML,FORMAT_ELEMENT_COMMAND:()=>BK,FORMAT_TEXT_COMMAND:()=>aa,HISTORIC_TAG:()=>XK,HISTORY_MERGE_TAG:()=>am,HISTORY_PUSH_TAG:()=>YK,INDENT_CONTENT_COMMAND:()=>OK,INPUT_COMMAND:()=>Ly,INSERT_LINE_BREAK_COMMAND:()=>ec,INSERT_PARAGRAPH_COMMAND:()=>oy,INSERT_TAB_COMMAND:()=>_K,INTERNAL_$isBlock:()=>kr,IS_ALL_FORMATTING:()=>dK,IS_BOLD:()=>oK,IS_CODE:()=>sK,IS_HIGHLIGHT:()=>by,IS_ITALIC:()=>nK,IS_STRIKETHROUGH:()=>rK,IS_SUBSCRIPT:()=>iK,IS_SUPERSCRIPT:()=>lK,IS_UNDERLINE:()=>aK,KEY_ARROW_DOWN_COMMAND:()=>bL,KEY_ARROW_LEFT_COMMAND:()=>vL,KEY_ARROW_RIGHT_COMMAND:()=>hL,KEY_ARROW_UP_COMMAND:()=>xL,KEY_BACKSPACE_COMMAND:()=>TL,KEY_DELETE_COMMAND:()=>SL,KEY_DOWN_COMMAND:()=>Ny,KEY_ENTER_COMMAND:()=>fm,KEY_ESCAPE_COMMAND:()=>IL,KEY_MODIFIER_COMMAND:()=>NL,KEY_SPACE_COMMAND:()=>wL,KEY_TAB_COMMAND:()=>kL,LineBreakNode:()=>Ni,MOVE_TO_END:()=>yL,MOVE_TO_START:()=>CL,NODE_STATE_KEY:()=>wK,OUTDENT_CONTENT_COMMAND:()=>FK,PASTE_COMMAND:()=>Ey,PASTE_TAG:()=>JK,ParagraphNode:()=>Fi,REDO_COMMAND:()=>Ay,REMOVE_TEXT_COMMAND:()=>ny,RootNode:()=>Oi,SELECTION_CHANGE_COMMAND:()=>Sy,SELECTION_INSERT_CLIPBOARD_NODES_COMMAND:()=>DK,SELECT_ALL_COMMAND:()=>ry,SKIP_COLLAB_TAG:()=>ZK,SKIP_DOM_SELECTION_TAG:()=>WL,SKIP_SCROLL_INTO_VIEW_TAG:()=>qL,SKIP_SELECTION_FOCUS_TAG:()=>cy,TEXT_TYPE_TO_FORMAT:()=>xo,TabNode:()=>_i,TextNode:()=>ms,UNDO_COMMAND:()=>My,addClassNamesToElement:()=>J5,buildImportMap:()=>QK,configExtension:()=>V5,createCommand:()=>He,createEditor:()=>b5,createSharedNodeState:()=>dL,createState:()=>LK,declarePeerDependency:()=>Q5,defineExtension:()=>j5,flipDirection:()=>ha,getDOMOwnerDocument:()=>Yy,getDOMSelection:()=>An,getDOMSelectionFromTarget:()=>IP,getDOMTextNode:()=>gs,getEditorPropertyFromDOMNode:()=>xc,getNearestEditorFromDOMNode:()=>Wy,getRegisteredNode:()=>Ky,getRegisteredNodeOrThrow:()=>zy,getStaticNodeConfig:()=>Tc,getTextDirection:()=>I5,getTransformSetFromKlass:()=>lP,isBlockDomNode:()=>hy,isCurrentlyReadOnlyMode:()=>qi,isDOMDocumentNode:()=>uP,isDOMNode:()=>Wi,isDOMTextNode:()=>nr,isDOMUnmanaged:()=>PP,isDocumentFragment:()=>SP,isExactShortcutMatch:()=>at,isHTMLAnchorElement:()=>M5,isHTMLElement:()=>ko,isInlineDomNode:()=>kP,isLexicalEditor:()=>Am,isModifierMatch:()=>vP,isSelectionCapturedInDecoratorInput:()=>qy,isSelectionWithinEditor:()=>Cc,makeStepwiseIterator:()=>rv,mergeRegister:()=>eq,normalizeClassNames:()=>Ic,removeClassNamesFromElement:()=>Z5,removeFromParent:()=>la,resetRandomKey:()=>w5,safeCast:()=>X5,setDOMUnmanaged:()=>D5,setNodeIndentFromDOM:()=>LP,shallowMergeConfig:()=>Y5,toggleTextFormatType:()=>gc});function le(e,...t){let o=new URL("https://lexical.dev/docs/error"),n=new URLSearchParams;n.append("code",e);for(let r of t)n.append("v",r);throw o.search=n.toString(),Error(`Minified Lexical error #${e}; visit ${o.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function tL(e,...t){let o=new URL("https://lexical.dev/docs/error"),n=new URLSearchParams;n.append("code",e);for(let r of t)n.append("v",r);o.search=n.toString(),console.warn(`Minified Lexical warning #${e}; visit ${o.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var Mn=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,Yz=Mn&&"documentMode"in document?document.documentMode:null,Sn=Mn&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),da=Mn&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),im=!(!Mn||!("InputEvent"in window)||Yz)&&"getTargetRanges"in new window.InputEvent("input"),Sm=Mn&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),yc=Mn&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Jz=Mn&&/Android/.test(navigator.userAgent),oL=Mn&&/^(?=.*Chrome).*/i.test(navigator.userAgent),qh=Mn&&Jz&&oL,km=Mn&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&Sn&&!oL,Zz=0,eK=1,tK=2,oK=1,nK=2,rK=4,aK=8,sK=16,iK=32,lK=64,by=128,dK=2047,cK=1,uK=2,pK=3,mK=4,fK=5,gK=6,sc=Sm||yc||km?"\xA0":"\u200B",Lm=`
3549
+ `},R$={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:o}=e;return o?"Draggable item "+t.id+" was moved over droppable area "+o.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:o}=e;return o?"Draggable item "+t.id+" was dropped over droppable area "+o.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function E$(e){let{announcements:t=R$,container:o,hiddenTextDescribedById:n,screenReaderInstructions:r=P$}=e,{announce:a,announcement:s}=uk(),i=es("DndLiveRegion"),[d,c]=q(!1);if(H(()=>{c(!0)},[]),k$(W(()=>({onDragStart(m){let{active:p}=m;a(t.onDragStart({active:p}))},onDragMove(m){let{active:p,over:f}=m;t.onDragMove&&a(t.onDragMove({active:p,over:f}))},onDragOver(m){let{active:p,over:f}=m;a(t.onDragOver({active:p,over:f}))},onDragEnd(m){let{active:p,over:f}=m;a(t.onDragEnd({active:p,over:f}))},onDragCancel(m){let{active:p,over:f}=m;a(t.onDragCancel({active:p,over:f}))}}),[a,t])),!d)return null;let u=Zt.createElement(Zt.Fragment,null,Zt.createElement(dk,{id:n,value:r.draggable}),Zt.createElement(ck,{id:i,announcement:s}));return o?(0,ns.createPortal)(u,o):u}var Gt;(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"})(Gt||(Gt={}));function Up(){}function Ph(e,t){return W(()=>({sensor:e,options:t??{}}),[e,t])}function Sk(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];return W(()=>[...t].filter(n=>n!=null),[...t])}var In=Object.freeze({x:0,y:0});function kk(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Lk(e,t){let{data:{value:o}}=e,{data:{value:n}}=t;return o-n}function M$(e,t){let{data:{value:o}}=e,{data:{value:n}}=t;return n-o}function pk(e){let{left:t,top:o,height:n,width:r}=e;return[{x:t,y:o},{x:t+r,y:o},{x:t,y:o+n},{x:t+r,y:o+n}]}function Rh(e,t){if(!e||e.length===0)return null;let[o]=e;return t?o[t]:o}function mk(e,t,o){return t===void 0&&(t=e.left),o===void 0&&(o=e.top),{x:t+e.width*.5,y:o+e.height*.5}}var Pk=e=>{let{collisionRect:t,droppableRects:o,droppableContainers:n}=e,r=mk(t,t.left,t.top),a=[];for(let s of n){let{id:i}=s,d=o.get(i);if(d){let c=kk(mk(d),r);a.push({id:i,data:{droppableContainer:s,value:c}})}}return a.sort(Lk)},Rk=e=>{let{collisionRect:t,droppableRects:o,droppableContainers:n}=e,r=pk(t),a=[];for(let s of n){let{id:i}=s,d=o.get(i);if(d){let c=pk(d),u=r.reduce((p,f,g)=>p+kk(c[g],f),0),m=Number((u/4).toFixed(4));a.push({id:i,data:{droppableContainer:s,value:m}})}}return a.sort(Lk)};function A$(e,t){let o=Math.max(t.top,e.top),n=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),s=r-n,i=a-o;if(n<r&&o<a){let d=t.width*t.height,c=e.width*e.height,u=s*i,m=u/(d+c-u);return Number(m.toFixed(4))}return 0}var N$=e=>{let{collisionRect:t,droppableRects:o,droppableContainers:n}=e,r=[];for(let a of n){let{id:s}=a,i=o.get(s);if(i){let d=A$(i,t);d>0&&r.push({id:s,data:{droppableContainer:a,value:d}})}}return r.sort(M$)};function D$(e,t,o){return{...e,scaleX:t&&o?t.width/o.width:1,scaleY:t&&o?t.height/o.height:1}}function Ek(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:In}function _$(e){return function(o){for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];return r.reduce((s,i)=>({...s,top:s.top+e*i.y,bottom:s.bottom+e*i.y,left:s.left+e*i.x,right:s.right+e*i.x}),{...o})}}var O$=_$(1);function F$(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 B$(e,t,o){let n=F$(t);if(!n)return e;let{scaleX:r,scaleY:a,x:s,y:i}=n,d=e.left-s-(1-r)*parseFloat(o),c=e.top-i-(1-a)*parseFloat(o.slice(o.indexOf(" ")+1)),u=r?e.width/r:e.width,m=a?e.height/a:e.height;return{width:u,height:m,top:c,right:d+u,bottom:c+m,left:d}}var H$={ignoreTransform:!1};function ss(e,t){t===void 0&&(t=H$);let o=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:c,transformOrigin:u}=So(e).getComputedStyle(e);c&&(o=B$(o,c,u))}let{top:n,left:r,width:a,height:s,bottom:i,right:d}=o;return{top:n,left:r,width:a,height:s,bottom:i,right:d}}function fk(e){return ss(e,{ignoreTransform:!0})}function U$(e){let t=e.innerWidth,o=e.innerHeight;return{top:0,left:0,right:t,bottom:o,width:t,height:o}}function $$(e,t){return t===void 0&&(t=So(e).getComputedStyle(e)),t.position==="fixed"}function z$(e,t){t===void 0&&(t=So(e).getComputedStyle(e));let o=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(r=>{let a=t[r];return typeof a=="string"?o.test(a):!1})}function Xd(e,t){let o=[];function n(r){if(t!=null&&o.length>=t||!r)return o;if(Op(r)&&r.scrollingElement!=null&&!o.includes(r.scrollingElement))return o.push(r.scrollingElement),o;if(!xi(r)||Ch(r)||o.includes(r))return o;let a=So(e).getComputedStyle(r);return r!==e&&z$(r,a)&&o.push(r),$$(r,a)?o:n(r.parentNode)}return e?n(e):o}function Mk(e){let[t]=Xd(e,1);return t??null}function xh(e){return!zd||!e?null:Ja(e)?e:_p(e)?Op(e)||e===Za(e).scrollingElement?window:xi(e)?e:null:null}function Ak(e){return Ja(e)?e.scrollX:e.scrollLeft}function Nk(e){return Ja(e)?e.scrollY:e.scrollTop}function Th(e){return{x:Ak(e),y:Nk(e)}}var to;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(to||(to={}));function Dk(e){return!zd||!e?!1:e===document.scrollingElement}function _k(e){let t={x:0,y:0},o=Dk(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},n={x:e.scrollWidth-o.width,y:e.scrollHeight-o.height},r=e.scrollTop<=t.y,a=e.scrollLeft<=t.x,s=e.scrollTop>=n.y,i=e.scrollLeft>=n.x;return{isTop:r,isLeft:a,isBottom:s,isRight:i,maxScroll:n,minScroll:t}}var K$={x:.2,y:.2};function q$(e,t,o,n,r){let{top:a,left:s,right:i,bottom:d}=o;n===void 0&&(n=10),r===void 0&&(r=K$);let{isTop:c,isBottom:u,isLeft:m,isRight:p}=_k(e),f={x:0,y:0},g={x:0,y:0},h={height:t.height*r.y,width:t.width*r.x};return!c&&a<=t.top+h.height?(f.y=to.Backward,g.y=n*Math.abs((t.top+h.height-a)/h.height)):!u&&d>=t.bottom-h.height&&(f.y=to.Forward,g.y=n*Math.abs((t.bottom-h.height-d)/h.height)),!p&&i>=t.right-h.width?(f.x=to.Forward,g.x=n*Math.abs((t.right-h.width-i)/h.width)):!m&&s<=t.left+h.width&&(f.x=to.Backward,g.x=n*Math.abs((t.left+h.width-s)/h.width)),{direction:f,speed:g}}function W$(e){if(e===document.scrollingElement){let{innerWidth:a,innerHeight:s}=window;return{top:0,left:0,right:a,bottom:s,width:a,height:s}}let{top:t,left:o,right:n,bottom:r}=e.getBoundingClientRect();return{top:t,left:o,right:n,bottom:r,width:e.clientWidth,height:e.clientHeight}}function Ok(e){return e.reduce((t,o)=>ts(t,Th(o)),In)}function G$(e){return e.reduce((t,o)=>t+Ak(o),0)}function j$(e){return e.reduce((t,o)=>t+Nk(o),0)}function V$(e,t){if(t===void 0&&(t=ss),!e)return;let{top:o,left:n,bottom:r,right:a}=t(e);Mk(e)&&(r<=0||a<=0||o>=window.innerHeight||n>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}var Q$=[["x",["left","right"],G$],["y",["top","bottom"],j$]],jd=class{constructor(t,o){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 n=Xd(o),r=Ok(n);this.rect={...t},this.width=t.width,this.height=t.height;for(let[a,s,i]of Q$)for(let d of s)Object.defineProperty(this,d,{get:()=>{let c=i(n),u=r[a]-c;return this.rect[d]+u},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}},rs=class{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(o=>{var n;return(n=this.target)==null?void 0:n.removeEventListener(...o)})},this.target=t}add(t,o,n){var r;(r=this.target)==null||r.addEventListener(t,o,n),this.listeners.push([t,o,n])}};function X$(e){let{EventTarget:t}=So(e);return e instanceof t?e:Za(e)}function bh(e,t){let o=Math.abs(e.x),n=Math.abs(e.y);return typeof t=="number"?Math.sqrt(o**2+n**2)>t:"x"in t&&"y"in t?o>t.x&&n>t.y:"x"in t?o>t.x:"y"in t?n>t.y:!1}var dn;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(dn||(dn={}));function gk(e){e.preventDefault()}function Y$(e){e.stopPropagation()}var Ve;(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"})(Ve||(Ve={}));var Fk={start:[Ve.Space,Ve.Enter],cancel:[Ve.Esc],end:[Ve.Space,Ve.Enter,Ve.Tab]},J$=(e,t)=>{let{currentCoordinates:o}=t;switch(e.code){case Ve.Right:return{...o,x:o.x+25};case Ve.Left:return{...o,x:o.x-25};case Ve.Down:return{...o,y:o.y+25};case Ve.Up:return{...o,y:o.y-25}}},Ti=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:o}}=t;this.props=t,this.listeners=new rs(Za(o)),this.windowListeners=new rs(So(o)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(dn.Resize,this.handleCancel),this.windowListeners.add(dn.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(dn.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:t,onStart:o}=this.props,n=t.node.current;n&&V$(n),o(In)}handleKeyDown(t){if(qd(t)){let{active:o,context:n,options:r}=this.props,{keyboardCodes:a=Fk,coordinateGetter:s=J$,scrollBehavior:i="smooth"}=r,{code:d}=t;if(a.end.includes(d)){this.handleEnd(t);return}if(a.cancel.includes(d)){this.handleCancel(t);return}let{collisionRect:c}=n.current,u=c?{x:c.left,y:c.top}:In;this.referenceCoordinates||(this.referenceCoordinates=u);let m=s(t,{active:o,context:n.current,currentCoordinates:u});if(m){let p=os(m,u),f={x:0,y:0},{scrollableAncestors:g}=n.current;for(let h of g){let y=t.code,{isTop:x,isRight:C,isLeft:b,isBottom:L,maxScroll:w,minScroll:k}=_k(h),I=W$(h),T={x:Math.min(y===Ve.Right?I.right-I.width/2:I.right,Math.max(y===Ve.Right?I.left:I.left+I.width/2,m.x)),y:Math.min(y===Ve.Down?I.bottom-I.height/2:I.bottom,Math.max(y===Ve.Down?I.top:I.top+I.height/2,m.y))},S=y===Ve.Right&&!C||y===Ve.Left&&!b,P=y===Ve.Down&&!L||y===Ve.Up&&!x;if(S&&T.x!==m.x){let A=h.scrollLeft+p.x,N=y===Ve.Right&&A<=w.x||y===Ve.Left&&A>=k.x;if(N&&!p.y){h.scrollTo({left:A,behavior:i});return}N?f.x=h.scrollLeft-A:f.x=y===Ve.Right?h.scrollLeft-w.x:h.scrollLeft-k.x,f.x&&h.scrollBy({left:-f.x,behavior:i});break}else if(P&&T.y!==m.y){let A=h.scrollTop+p.y,N=y===Ve.Down&&A<=w.y||y===Ve.Up&&A>=k.y;if(N&&!p.x){h.scrollTo({top:A,behavior:i});return}N?f.y=h.scrollTop-A:f.y=y===Ve.Down?h.scrollTop-w.y:h.scrollTop-k.y,f.y&&h.scrollBy({top:-f.y,behavior:i});break}}this.handleMove(t,ts(os(m,this.referenceCoordinates),f))}}}handleMove(t,o){let{onMove:n}=this.props;t.preventDefault(),n(o)}handleEnd(t){let{onEnd:o}=this.props;t.preventDefault(),this.detach(),o()}handleCancel(t){let{onCancel:o}=this.props;t.preventDefault(),this.detach(),o()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}};Ti.activators=[{eventName:"onKeyDown",handler:(e,t,o)=>{let{keyboardCodes:n=Fk,onActivation:r}=t,{active:a}=o,{code:s}=e.nativeEvent;if(n.start.includes(s)){let i=a.activatorNode.current;return i&&e.target!==i?!1:(e.preventDefault(),r?.({event:e.nativeEvent}),!0)}return!1}}];function hk(e){return!!(e&&"distance"in e)}function yk(e){return!!(e&&"delay"in e)}var Vd=class{constructor(t,o,n){var r;n===void 0&&(n=X$(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=o;let{event:a}=t,{target:s}=a;this.props=t,this.events=o,this.document=Za(s),this.documentListeners=new rs(this.document),this.listeners=new rs(n),this.windowListeners=new rs(So(s)),this.initialCoordinates=(r=Wd(a))!=null?r:In,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:o,bypassActivationConstraint:n}}}=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(dn.Resize,this.handleCancel),this.windowListeners.add(dn.DragStart,gk),this.windowListeners.add(dn.VisibilityChange,this.handleCancel),this.windowListeners.add(dn.ContextMenu,gk),this.documentListeners.add(dn.Keydown,this.handleKeydown),o){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(yk(o)){this.timeoutId=setTimeout(this.handleStart,o.delay),this.handlePending(o);return}if(hk(o)){this.handlePending(o);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,o){let{active:n,onPending:r}=this.props;r(n,t,this.initialCoordinates,o)}handleStart(){let{initialCoordinates:t}=this,{onStart:o}=this.props;t&&(this.activated=!0,this.documentListeners.add(dn.Click,Y$,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(dn.SelectionChange,this.removeTextSelection),o(t))}handleMove(t){var o;let{activated:n,initialCoordinates:r,props:a}=this,{onMove:s,options:{activationConstraint:i}}=a;if(!r)return;let d=(o=Wd(t))!=null?o:In,c=os(r,d);if(!n&&i){if(hk(i)){if(i.tolerance!=null&&bh(c,i.tolerance))return this.handleCancel();if(bh(c,i.distance))return this.handleStart()}if(yk(i)&&bh(c,i.tolerance))return this.handleCancel();this.handlePending(i,c);return}t.cancelable&&t.preventDefault(),s(d)}handleEnd(){let{onAbort:t,onEnd:o}=this.props;this.detach(),this.activated||t(this.props.active),o()}handleCancel(){let{onAbort:t,onCancel:o}=this.props;this.detach(),this.activated||t(this.props.active),o()}handleKeydown(t){t.code===Ve.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}},Z$={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}},Ii=class extends Vd{constructor(t){let{event:o}=t,n=Za(o.target);super(t,Z$,n)}};Ii.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:o}=e,{onActivation:n}=t;return!o.isPrimary||o.button!==0?!1:(n?.({event:o}),!0)}}];var ez={move:{name:"mousemove"},end:{name:"mouseup"}},Ih;(function(e){e[e.RightClick=2]="RightClick"})(Ih||(Ih={}));var Sh=class extends Vd{constructor(t){super(t,ez,Za(t.event.target))}};Sh.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:o}=e,{onActivation:n}=t;return o.button===Ih.RightClick?!1:(n?.({event:o}),!0)}}];var wh={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}},kh=class extends Vd{constructor(t){super(t,wh)}static setup(){return window.addEventListener(wh.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(wh.move.name,t)};function t(){}}};kh.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:o}=e,{onActivation:n}=t,{touches:r}=o;return r.length>1?!1:(n?.({event:o}),!0)}}];var Gd;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Gd||(Gd={}));var $p;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})($p||($p={}));function tz(e){let{acceleration:t,activator:o=Gd.Pointer,canScroll:n,draggingRect:r,enabled:a,interval:s=5,order:i=$p.TreeOrder,pointerCoordinates:d,scrollableAncestors:c,scrollableAncestorRects:u,delta:m,threshold:p}=e,f=nz({delta:m,disabled:!a}),[g,h]=sk(),y=E({x:0,y:0}),x=E({x:0,y:0}),C=W(()=>{switch(o){case Gd.Pointer:return d?{top:d.y,bottom:d.y,left:d.x,right:d.x}:null;case Gd.DraggableRect:return r}},[o,r,d]),b=E(null),L=R(()=>{let k=b.current;if(!k)return;let I=y.current.x*x.current.x,T=y.current.y*x.current.y;k.scrollBy(I,T)},[]),w=W(()=>i===$p.TreeOrder?[...c].reverse():c,[i,c]);H(()=>{if(!a||!c.length||!C){h();return}for(let k of w){if(n?.(k)===!1)continue;let I=c.indexOf(k),T=u[I];if(!T)continue;let{direction:S,speed:P}=q$(k,T,C,t,p);for(let A of["x","y"])f[A][S[A]]||(P[A]=0,S[A]=0);if(P.x>0||P.y>0){h(),b.current=k,g(L,s),y.current=P,x.current=S;return}}y.current={x:0,y:0},x.current={x:0,y:0},h()},[t,L,n,h,a,s,JSON.stringify(C),JSON.stringify(f),g,c,w,u,JSON.stringify(p)])}var oz={x:{[to.Backward]:!1,[to.Forward]:!1},y:{[to.Backward]:!1,[to.Forward]:!1}};function nz(e){let{delta:t,disabled:o}=e,n=Bp(t);return wi(r=>{if(o||!n||!r)return oz;let a={x:Math.sign(t.x-n.x),y:Math.sign(t.y-n.y)};return{x:{[to.Backward]:r.x[to.Backward]||a.x===-1,[to.Forward]:r.x[to.Forward]||a.x===1},y:{[to.Backward]:r.y[to.Backward]||a.y===-1,[to.Forward]:r.y[to.Forward]||a.y===1}}},[o,t,n])}function rz(e,t){let o=t!=null?e.get(t):void 0,n=o?o.node.current:null;return wi(r=>{var a;return t==null?null:(a=n??r)!=null?a:null},[n,t])}function az(e,t){return W(()=>e.reduce((o,n)=>{let{sensor:r}=n,a=r.activators.map(s=>({eventName:s.eventName,handler:t(s.handler,n)}));return[...o,...a]},[]),[e,t])}var Qd;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Qd||(Qd={}));var Lh;(function(e){e.Optimized="optimized"})(Lh||(Lh={}));var vk=new Map;function sz(e,t){let{dragging:o,dependencies:n,config:r}=t,[a,s]=q(null),{frequency:i,measure:d,strategy:c}=r,u=E(e),m=y(),p=bi(m),f=R(function(x){x===void 0&&(x=[]),!p.current&&s(C=>C===null?x:C.concat(x.filter(b=>!C.includes(b))))},[p]),g=E(null),h=wi(x=>{if(m&&!o)return vk;if(!x||x===vk||u.current!==e||a!=null){let C=new Map;for(let b of e){if(!b)continue;if(a&&a.length>0&&!a.includes(b.id)&&b.rect.current){C.set(b.id,b.rect.current);continue}let L=b.node.current,w=L?new jd(d(L),L):null;b.rect.current=w,w&&C.set(b.id,w)}return C}return x},[e,a,o,m,d]);return H(()=>{u.current=e},[e]),H(()=>{m||f()},[o,m]),H(()=>{a&&a.length>0&&s(null)},[JSON.stringify(a)]),H(()=>{m||typeof i!="number"||g.current!==null||(g.current=setTimeout(()=>{f(),g.current=null},i))},[i,m,f,...n]),{droppableRects:h,measureDroppableContainers:f,measuringScheduled:a!=null};function y(){switch(c){case Qd.Always:return!1;case Qd.BeforeDragging:return o;default:return!o}}}function Bk(e,t){return wi(o=>e?o||(typeof t=="function"?t(e):e):null,[t,e])}function iz(e,t){return Bk(e,t)}function lz(e){let{callback:t,disabled:o}=e,n=Fp(t),r=W(()=>{if(o||typeof window>"u"||typeof window.MutationObserver>"u")return;let{MutationObserver:a}=window;return new a(n)},[n,o]);return H(()=>()=>r?.disconnect(),[r]),r}function zp(e){let{callback:t,disabled:o}=e,n=Fp(t),r=W(()=>{if(o||typeof window>"u"||typeof window.ResizeObserver>"u")return;let{ResizeObserver:a}=window;return new a(n)},[o]);return H(()=>()=>r?.disconnect(),[r]),r}function dz(e){return new jd(ss(e),e)}function Ck(e,t,o){t===void 0&&(t=dz);let[n,r]=q(null);function a(){r(d=>{if(!e)return null;if(e.isConnected===!1){var c;return(c=d??o)!=null?c:null}let u=t(e);return JSON.stringify(d)===JSON.stringify(u)?d:u})}let s=lz({callback(d){if(e)for(let c of d){let{type:u,target:m}=c;if(u==="childList"&&m instanceof HTMLElement&&m.contains(e)){a();break}}}}),i=zp({callback:a});return ln(()=>{a(),e?(i?.observe(e),s?.observe(document.body,{childList:!0,subtree:!0})):(i?.disconnect(),s?.disconnect())},[e]),n}function cz(e){let t=Bk(e);return Ek(e,t)}var xk=[];function uz(e){let t=E(e),o=wi(n=>e?n&&n!==xk&&e&&t.current&&e.parentNode===t.current.parentNode?n:Xd(e):xk,[e]);return H(()=>{t.current=e},[e]),o}function pz(e){let[t,o]=q(null),n=E(e),r=R(a=>{let s=xh(a.target);s&&o(i=>i?(i.set(s,Th(s)),new Map(i)):null)},[]);return H(()=>{let a=n.current;if(e!==a){s(a);let i=e.map(d=>{let c=xh(d);return c?(c.addEventListener("scroll",r,{passive:!0}),[c,Th(c)]):null}).filter(d=>d!=null);o(i.length?new Map(i):null),n.current=e}return()=>{s(e),s(a)};function s(i){i.forEach(d=>{let c=xh(d);c?.removeEventListener("scroll",r)})}},[r,e]),W(()=>e.length?t?Array.from(t.values()).reduce((a,s)=>ts(a,s),In):Ok(e):In,[e,t])}function bk(e,t){t===void 0&&(t=[]);let o=E(null);return H(()=>{o.current=null},t),H(()=>{let n=e!==In;n&&!o.current&&(o.current=e),!n&&o.current&&(o.current=null)},[e]),o.current?os(e,o.current):In}function mz(e){H(()=>{if(!zd)return;let t=e.map(o=>{let{sensor:n}=o;return n.setup==null?void 0:n.setup()});return()=>{for(let o of t)o?.()}},e.map(t=>{let{sensor:o}=t;return o}))}function fz(e,t){return W(()=>e.reduce((o,n)=>{let{eventName:r,handler:a}=n;return o[r]=s=>{a(s,t)},o},{}),[e,t])}function Hk(e){return W(()=>e?U$(e):null,[e])}var wk=[];function gz(e,t){t===void 0&&(t=ss);let[o]=e,n=Hk(o?So(o):null),[r,a]=q(wk);function s(){a(()=>e.length?e.map(d=>Dk(d)?n:new jd(t(d),d)):wk)}let i=zp({callback:s});return ln(()=>{i?.disconnect(),s(),e.forEach(d=>i?.observe(d))},[e]),r}function hz(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return xi(t)?t:e}function yz(e){let{measure:t}=e,[o,n]=q(null),r=R(c=>{for(let{target:u}of c)if(xi(u)){n(m=>{let p=t(u);return m?{...m,width:p.width,height:p.height}:p});break}},[t]),a=zp({callback:r}),s=R(c=>{let u=hz(c);a?.disconnect(),u&&a?.observe(u),n(u?t(u):null)},[t,a]),[i,d]=Kd(s);return W(()=>({nodeRef:i,rect:o,setRef:d}),[o,i,d])}var vz=[{sensor:Ii,options:{}},{sensor:Ti,options:{}}],Cz={current:{}},Hp={draggable:{measure:fk},droppable:{measure:fk,strategy:Qd.WhileDragging,frequency:Lh.Optimized},dragOverlay:{measure:ss}},as=class extends Map{get(t){var o;return t!=null&&(o=super.get(t))!=null?o:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:o}=t;return!o})}getNodeFor(t){var o,n;return(o=(n=this.get(t))==null?void 0:n.node.current)!=null?o:void 0}},xz={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new as,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Up},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Hp,measureDroppableContainers:Up,windowRect:null,measuringScheduled:!1},bz={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Up,draggableNodes:new Map,over:null,measureDroppableContainers:Up},Kp=qe(bz),Uk=qe(xz);function wz(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new as}}}function Tz(e,t){switch(t.type){case Gt.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Gt.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 Gt.DragEnd:case Gt.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Gt.RegisterDroppable:{let{element:o}=t,{id:n}=o,r=new as(e.droppable.containers);return r.set(n,o),{...e,droppable:{...e.droppable,containers:r}}}case Gt.SetDroppableDisabled:{let{id:o,key:n,disabled:r}=t,a=e.droppable.containers.get(o);if(!a||n!==a.key)return e;let s=new as(e.droppable.containers);return s.set(o,{...a,disabled:r}),{...e,droppable:{...e.droppable,containers:s}}}case Gt.UnregisterDroppable:{let{id:o,key:n}=t,r=e.droppable.containers.get(o);if(!r||n!==r.key)return e;let a=new as(e.droppable.containers);return a.delete(o),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function Iz(e){let{disabled:t}=e,{active:o,activatorEvent:n,draggableNodes:r}=Pt(Kp),a=Bp(n),s=Bp(o?.id);return H(()=>{if(!t&&!n&&a&&s!=null){if(!qd(a)||document.activeElement===a.target)return;let i=r.get(s);if(!i)return;let{activatorNode:d,node:c}=i;if(!d.current&&!c.current)return;requestAnimationFrame(()=>{for(let u of[d.current,c.current]){if(!u)continue;let m=lk(u);if(m){m.focus();break}}})}},[n,t,r,s,a]),null}function Sz(e,t){let{transform:o,...n}=t;return e!=null&&e.length?e.reduce((r,a)=>a({transform:r,...n}),o):o}function kz(e){return W(()=>({draggable:{...Hp.draggable,...e?.draggable},droppable:{...Hp.droppable,...e?.droppable},dragOverlay:{...Hp.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Lz(e){let{activeNode:t,measure:o,initialRect:n,config:r=!0}=e,a=E(!1),{x:s,y:i}=typeof r=="boolean"?{x:r,y:r}:r;ln(()=>{if(!s&&!i||!t){a.current=!1;return}if(a.current||!n)return;let c=t?.node.current;if(!c||c.isConnected===!1)return;let u=o(c),m=Ek(u,n);if(s||(m.x=0),i||(m.y=0),a.current=!0,Math.abs(m.x)>0||Math.abs(m.y)>0){let p=Mk(c);p&&p.scrollBy({top:m.y,left:m.x})}},[t,s,i,n,o])}var $k=qe({...In,scaleX:1,scaleY:1}),ra;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(ra||(ra={}));var zk=pe(function(t){var o,n,r,a;let{id:s,accessibility:i,autoScroll:d=!0,children:c,sensors:u=vz,collisionDetection:m=N$,measuring:p,modifiers:f,...g}=t,h=Na(Tz,void 0,wz),[y,x]=h,[C,b]=L$(),[L,w]=q(ra.Uninitialized),k=L===ra.Initialized,{draggable:{active:I,nodes:T,translate:S},droppable:{containers:P}}=y,A=I!=null?T.get(I):null,N=E({initial:null,translated:null}),B=W(()=>{var At;return I!=null?{id:I,data:(At=A?.data)!=null?At:Cz,rect:N}:null},[I,A]),O=E(null),[j,U]=q(null),[D,J]=q(null),G=bi(g,Object.values(g)),M=es("DndDescribedBy",s),X=W(()=>P.getEnabled(),[P]),F=kz(p),{droppableRects:ee,measureDroppableContainers:Y,measuringScheduled:ae}=sz(X,{dragging:k,dependencies:[S.x,S.y],config:F.droppable}),te=rz(T,I),de=W(()=>D?Wd(D):null,[D]),ge=gn(),ne=iz(te,F.draggable.measure);Lz({activeNode:I!=null?T.get(I):null,config:ge.layoutShiftCompensation,initialRect:ne,measure:F.draggable.measure});let Z=Ck(te,F.draggable.measure,ne),ve=Ck(te?te.parentElement:null),he=E({activatorEvent:null,active:null,activeNode:te,collisionRect:null,collisions:null,droppableRects:ee,draggableNodes:T,draggingNode:null,draggingNodeRect:null,droppableContainers:P,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Ae=P.getNodeFor((o=he.current.over)==null?void 0:o.id),De=yz({measure:F.dragOverlay.measure}),je=(n=De.nodeRef.current)!=null?n:te,ot=k?(r=De.rect)!=null?r:Z:null,me=!!(De.nodeRef.current&&De.rect),Me=cz(me?null:Z),ue=Hk(je?So(je):null),ce=uz(k?Ae??te:null),Ze=gz(ce),pt=Sz(f,{transform:{x:S.x-Me.x,y:S.y-Me.y,scaleX:1,scaleY:1},activatorEvent:D,active:B,activeNodeRect:Z,containerNodeRect:ve,draggingNodeRect:ot,over:he.current.over,overlayNodeRect:De.rect,scrollableAncestors:ce,scrollableAncestorRects:Ze,windowRect:ue}),ze=de?ts(de,S):null,et=pz(ce),Et=bk(et),ft=bk(et,[Z]),Ct=ts(pt,Et),gt=ot?O$(ot,pt):null,Dt=B&&gt?m({active:B,collisionRect:gt,droppableRects:ee,droppableContainers:X,pointerCoordinates:ze}):null,Mt=Rh(Dt,"id"),[se,Le]=q(null),be=me?pt:ts(pt,ft),Xe=D$(be,(a=se?.rect)!=null?a:null,Z),xt=E(null),tt=R((At,St)=>{let{sensor:bt,options:mo}=St;if(O.current==null)return;let kt=T.get(O.current);if(!kt)return;let _t=At.nativeEvent,Xt=new bt({active:O.current,activeNode:kt,event:_t,options:mo,context:he,onAbort(lt){if(!T.get(lt))return;let{onDragAbort:Ht}=G.current,Yt={id:lt};Ht?.(Yt),C({type:"onDragAbort",event:Yt})},onPending(lt,Bt,Ht,Yt){if(!T.get(lt))return;let{onDragPending:fo}=G.current,go={id:lt,constraint:Bt,initialCoordinates:Ht,offset:Yt};fo?.(go),C({type:"onDragPending",event:go})},onStart(lt){let Bt=O.current;if(Bt==null)return;let Ht=T.get(Bt);if(!Ht)return;let{onDragStart:Yt}=G.current,qo={activatorEvent:_t,active:{id:Bt,data:Ht.data,rect:N}};(0,ns.unstable_batchedUpdates)(()=>{Yt?.(qo),w(ra.Initializing),x({type:Gt.DragStart,initialCoordinates:lt,active:Bt}),C({type:"onDragStart",event:qo}),U(xt.current),J(_t)})},onMove(lt){x({type:Gt.DragMove,coordinates:lt})},onEnd:nt(Gt.DragEnd),onCancel:nt(Gt.DragCancel)});xt.current=Xt;function nt(lt){return async function(){let{active:Ht,collisions:Yt,over:qo,scrollAdjustedTranslate:fo}=he.current,go=null;if(Ht&&fo){let{cancelDrop:Jt}=G.current;go={activatorEvent:_t,active:Ht,collisions:Yt,delta:fo,over:qo},lt===Gt.DragEnd&&typeof Jt=="function"&&await Promise.resolve(Jt(go))&&(lt=Gt.DragCancel)}O.current=null,(0,ns.unstable_batchedUpdates)(()=>{x({type:lt}),w(ra.Uninitialized),Le(null),U(null),J(null),xt.current=null;let Jt=lt===Gt.DragEnd?"onDragEnd":"onDragCancel";if(go){let Un=G.current[Jt];Un?.(go),C({type:Jt,event:go})}})}}},[T]),It=R((At,St)=>(bt,mo)=>{let kt=bt.nativeEvent,_t=T.get(mo);if(O.current!==null||!_t||kt.dndKit||kt.defaultPrevented)return;let Xt={active:_t};At(bt,St.options,Xt)===!0&&(kt.dndKit={capturedBy:St.sensor},O.current=mo,tt(bt,St))},[T,tt]),po=az(u,It);mz(u),ln(()=>{Z&&L===ra.Initializing&&w(ra.Initialized)},[Z,L]),H(()=>{let{onDragMove:At}=G.current,{active:St,activatorEvent:bt,collisions:mo,over:kt}=he.current;if(!St||!bt)return;let _t={active:St,activatorEvent:bt,collisions:mo,delta:{x:Ct.x,y:Ct.y},over:kt};(0,ns.unstable_batchedUpdates)(()=>{At?.(_t),C({type:"onDragMove",event:_t})})},[Ct.x,Ct.y]),H(()=>{let{active:At,activatorEvent:St,collisions:bt,droppableContainers:mo,scrollAdjustedTranslate:kt}=he.current;if(!At||O.current==null||!St||!kt)return;let{onDragOver:_t}=G.current,Xt=mo.get(Mt),nt=Xt&&Xt.rect.current?{id:Xt.id,rect:Xt.rect.current,data:Xt.data,disabled:Xt.disabled}:null,lt={active:At,activatorEvent:St,collisions:bt,delta:{x:kt.x,y:kt.y},over:nt};(0,ns.unstable_batchedUpdates)(()=>{Le(nt),_t?.(lt),C({type:"onDragOver",event:lt})})},[Mt]),ln(()=>{he.current={activatorEvent:D,active:B,activeNode:te,collisionRect:gt,collisions:Dt,droppableRects:ee,draggableNodes:T,draggingNode:je,draggingNodeRect:ot,droppableContainers:P,over:se,scrollableAncestors:ce,scrollAdjustedTranslate:Ct},N.current={initial:ot,translated:gt}},[B,te,Dt,gt,T,je,ot,ee,P,se,ce,Ct]),tz({...ge,delta:S,draggingRect:gt,pointerCoordinates:ze,scrollableAncestors:ce,scrollableAncestorRects:Ze});let Ko=W(()=>({active:B,activeNode:te,activeNodeRect:Z,activatorEvent:D,collisions:Dt,containerNodeRect:ve,dragOverlay:De,draggableNodes:T,droppableContainers:P,droppableRects:ee,over:se,measureDroppableContainers:Y,scrollableAncestors:ce,scrollableAncestorRects:Ze,measuringConfiguration:F,measuringScheduled:ae,windowRect:ue}),[B,te,Z,D,Dt,ve,De,T,P,ee,se,Y,ce,Ze,F,ae,ue]),Qt=W(()=>({activatorEvent:D,activators:po,active:B,activeNodeRect:Z,ariaDescribedById:{draggable:M},dispatch:x,draggableNodes:T,over:se,measureDroppableContainers:Y}),[D,po,B,Z,x,M,T,se,Y]);return Zt.createElement(Ik.Provider,{value:b},Zt.createElement(Kp.Provider,{value:Qt},Zt.createElement(Uk.Provider,{value:Ko},Zt.createElement($k.Provider,{value:Xe},c)),Zt.createElement(Iz,{disabled:i?.restoreFocus===!1})),Zt.createElement(E$,{...i,hiddenTextDescribedById:M}));function gn(){let At=j?.autoScrollEnabled===!1,St=typeof d=="object"?d.enabled===!1:d===!1,bt=k&&!At&&!St;return typeof d=="object"?{...d,enabled:bt}:{enabled:bt}}}),Pz=qe(null),Tk="button",Rz="Draggable";function Kk(e){let{id:t,data:o,disabled:n=!1,attributes:r}=e,a=es(Rz),{activators:s,activatorEvent:i,active:d,activeNodeRect:c,ariaDescribedById:u,draggableNodes:m,over:p}=Pt(Kp),{role:f=Tk,roleDescription:g="draggable",tabIndex:h=0}=r??{},y=d?.id===t,x=Pt(y?$k:Pz),[C,b]=Kd(),[L,w]=Kd(),k=fz(s,t),I=bi(o);ln(()=>(m.set(t,{id:t,key:a,node:C,activatorNode:L,data:I}),()=>{let S=m.get(t);S&&S.key===a&&m.delete(t)}),[m,t]);let T=W(()=>({role:f,tabIndex:h,"aria-disabled":n,"aria-pressed":y&&f===Tk?!0:void 0,"aria-roledescription":g,"aria-describedby":u.draggable}),[n,f,h,y,g,u.draggable]);return{active:d,activatorEvent:i,activeNodeRect:c,attributes:T,isDragging:y,listeners:n?void 0:k,node:C,over:p,setNodeRef:b,setActivatorNodeRef:w,transform:x}}function qk(){return Pt(Uk)}var Ez="Droppable",Mz={timeout:25};function Wk(e){let{data:t,disabled:o=!1,id:n,resizeObserverConfig:r}=e,a=es(Ez),{active:s,dispatch:i,over:d,measureDroppableContainers:c}=Pt(Kp),u=E({disabled:o}),m=E(!1),p=E(null),f=E(null),{disabled:g,updateMeasurementsFor:h,timeout:y}={...Mz,...r},x=bi(h??n),C=R(()=>{if(!m.current){m.current=!0;return}f.current!=null&&clearTimeout(f.current),f.current=setTimeout(()=>{c(Array.isArray(x.current)?x.current:[x.current]),f.current=null},y)},[y]),b=zp({callback:C,disabled:g||!s}),L=R((T,S)=>{b&&(S&&(b.unobserve(S),m.current=!1),T&&b.observe(T))},[b]),[w,k]=Kd(L),I=bi(t);return H(()=>{!b||!w.current||(b.disconnect(),m.current=!1,b.observe(w.current))},[w,b]),H(()=>(i({type:Gt.RegisterDroppable,element:{id:n,key:a,disabled:o,node:w,rect:p,data:I}}),()=>i({type:Gt.UnregisterDroppable,key:a,id:n})),[n]),H(()=>{o!==u.current.disabled&&(i({type:Gt.SetDroppableDisabled,id:n,key:a,disabled:o}),u.current.disabled=o)},[n,a,o,i]),{active:s,rect:p,isOver:d?.id===n,node:w,over:d,setNodeRef:k}}$();function Gk(e,t,o){let n=e.slice();return n.splice(o<0?n.length+o:o,0,n.splice(t,1)[0]),n}function Az(e,t){return e.reduce((o,n,r)=>{let a=t.get(n);return a&&(o[r]=a),o},Array(e.length))}function qp(e){return e!==null&&e>=0}function Nz(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let o=0;o<e.length;o++)if(e[o]!==t[o])return!1;return!0}function Dz(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}var jk=e=>{let{rects:t,activeIndex:o,overIndex:n,index:r}=e,a=Gk(t,n,o),s=t[r],i=a[r];return!i||!s?null:{x:i.left-s.left,y:i.top-s.top,scaleX:i.width/s.width,scaleY:i.height/s.height}};var Wp={scaleX:1,scaleY:1},Vk=e=>{var t;let{activeIndex:o,activeNodeRect:n,index:r,rects:a,overIndex:s}=e,i=(t=a[o])!=null?t:n;if(!i)return null;if(r===o){let c=a[s];return c?{x:0,y:o<s?c.top+c.height-(i.top+i.height):c.top-i.top,...Wp}:null}let d=_z(a,r,o);return r>o&&r<=s?{x:0,y:-i.height-d,...Wp}:r<o&&r>=s?{x:0,y:i.height+d,...Wp}:{x:0,y:0,...Wp}};function _z(e,t,o){let n=e[t],r=e[t-1],a=e[t+1];return n?o<t?r?n.top-(r.top+r.height):a?a.top-(n.top+n.height):0:a?a.top-(n.top+n.height):r?n.top-(r.top+r.height):0:0}var Qk="Sortable",Xk=Zt.createContext({activeIndex:-1,containerId:Qk,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:jk,disabled:{draggable:!1,droppable:!1}});function Yk(e){let{children:t,id:o,items:n,strategy:r=jk,disabled:a=!1}=e,{active:s,dragOverlay:i,droppableRects:d,over:c,measureDroppableContainers:u}=qk(),m=es(Qk,o),p=i.rect!==null,f=W(()=>n.map(k=>typeof k=="object"&&"id"in k?k.id:k),[n]),g=s!=null,h=s?f.indexOf(s.id):-1,y=c?f.indexOf(c.id):-1,x=E(f),C=!Nz(f,x.current),b=y!==-1&&h===-1||C,L=Dz(a);ln(()=>{C&&g&&u(f)},[C,f,g,u]),H(()=>{x.current=f},[f]);let w=W(()=>({activeIndex:h,containerId:m,disabled:L,disableTransforms:b,items:f,overIndex:y,useDragOverlay:p,sortedRects:Az(f,d),strategy:r}),[h,m,L.draggable,L.droppable,b,f,y,d,p,r]);return Zt.createElement(Xk.Provider,{value:w},t)}var Oz=e=>{let{id:t,items:o,activeIndex:n,overIndex:r}=e;return Gk(o,n,r).indexOf(t)},Fz=e=>{let{containerId:t,isSorting:o,wasDragging:n,index:r,items:a,newIndex:s,previousItems:i,previousContainerId:d,transition:c}=e;return!c||!n||i!==a&&r===s?!1:o?!0:s!==r&&t===d},Bz={duration:200,easing:"ease"},Jk="transform",Hz=na.Transition.toString({property:Jk,duration:0,easing:"linear"}),Uz={roleDescription:"sortable"};function $z(e){let{disabled:t,index:o,node:n,rect:r}=e,[a,s]=q(null),i=E(o);return ln(()=>{if(!t&&o!==i.current&&n.current){let d=r.current;if(d){let c=ss(n.current,{ignoreTransform:!0}),u={x:d.left-c.left,y:d.top-c.top,scaleX:d.width/c.width,scaleY:d.height/c.height};(u.x||u.y)&&s(u)}}o!==i.current&&(i.current=o)},[t,o,n,r]),H(()=>{a&&s(null)},[a]),a}function Zk(e){let{animateLayoutChanges:t=Fz,attributes:o,disabled:n,data:r,getNewIndex:a=Oz,id:s,strategy:i,resizeObserverConfig:d,transition:c=Bz}=e,{items:u,containerId:m,activeIndex:p,disabled:f,disableTransforms:g,sortedRects:h,overIndex:y,useDragOverlay:x,strategy:C}=Pt(Xk),b=zz(n,f),L=u.indexOf(s),w=W(()=>({sortable:{containerId:m,index:L,items:u},...r}),[m,r,L,u]),k=W(()=>u.slice(u.indexOf(s)),[u,s]),{rect:I,node:T,isOver:S,setNodeRef:P}=Wk({id:s,data:w,disabled:b.droppable,resizeObserverConfig:{updateMeasurementsFor:k,...d}}),{active:A,activatorEvent:N,activeNodeRect:B,attributes:O,setNodeRef:j,listeners:U,isDragging:D,over:J,setActivatorNodeRef:G,transform:M}=Kk({id:s,data:w,attributes:{...Uz,...o},disabled:b.draggable}),X=ak(P,j),F=!!A,ee=F&&!g&&qp(p)&&qp(y),Y=!x&&D,ae=Y&&ee?M:null,de=ee?ae??(i??C)({rects:h,activeNodeRect:B,activeIndex:p,overIndex:y,index:L}):null,ge=qp(p)&&qp(y)?a({id:s,items:u,activeIndex:p,overIndex:y}):L,ne=A?.id,Z=E({activeId:ne,items:u,newIndex:ge,containerId:m}),ve=u!==Z.current.items,he=t({active:A,containerId:m,isDragging:D,isSorting:F,id:s,index:L,items:u,newIndex:Z.current.newIndex,previousItems:Z.current.items,previousContainerId:Z.current.containerId,transition:c,wasDragging:Z.current.activeId!=null}),Ae=$z({disabled:!he,index:L,node:T,rect:I});return H(()=>{F&&Z.current.newIndex!==ge&&(Z.current.newIndex=ge),m!==Z.current.containerId&&(Z.current.containerId=m),u!==Z.current.items&&(Z.current.items=u)},[F,ge,m,u]),H(()=>{if(ne===Z.current.activeId)return;if(ne!=null&&Z.current.activeId==null){Z.current.activeId=ne;return}let je=setTimeout(()=>{Z.current.activeId=ne},50);return()=>clearTimeout(je)},[ne]),{active:A,activeIndex:p,attributes:O,data:w,rect:I,index:L,newIndex:ge,items:u,isOver:S,isSorting:F,isDragging:D,listeners:U,node:T,overIndex:y,over:J,setNodeRef:X,setActivatorNodeRef:G,setDroppableNodeRef:P,setDraggableNodeRef:j,transform:Ae??de,transition:De()};function De(){if(Ae||ve&&Z.current.newIndex===L)return Hz;if(!(Y&&!qd(N)||!c)&&(F||he))return na.Transition.toString({...c,property:Jk})}}function zz(e,t){var o,n;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(o=e?.draggable)!=null?o:t.draggable,droppable:(n=e?.droppable)!=null?n:t.droppable}}function Gp(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 Kz=[Ve.Down,Ve.Right,Ve.Up,Ve.Left],e0=(e,t)=>{let{context:{active:o,collisionRect:n,droppableRects:r,droppableContainers:a,over:s,scrollableAncestors:i}}=t;if(Kz.includes(e.code)){if(e.preventDefault(),!o||!n)return;let d=[];a.getEnabled().forEach(m=>{if(!m||m!=null&&m.disabled)return;let p=r.get(m.id);if(p)switch(e.code){case Ve.Down:n.top<p.top&&d.push(m);break;case Ve.Up:n.top>p.top&&d.push(m);break;case Ve.Left:n.left>p.left&&d.push(m);break;case Ve.Right:n.left<p.left&&d.push(m);break}});let c=Rk({active:o,collisionRect:n,droppableRects:r,droppableContainers:d,pointerCoordinates:null}),u=Rh(c,"id");if(u===s?.id&&c.length>1&&(u=c[1].id),u!=null){let m=a.get(o.id),p=a.get(u),f=p?r.get(p.id):null,g=p?.node.current;if(g&&f&&m&&p){let y=Xd(g).some((k,I)=>i[I]!==k),x=t0(m,p),C=qz(m,p),b=y||!x?{x:0,y:0}:{x:C?n.width-f.width:0,y:C?n.height-f.height:0},L={x:f.left,y:f.top};return b.x&&b.y?L:os(L,b)}}}};function t0(e,t){return!Gp(e)||!Gp(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function qz(e,t){return!Gp(e)||!Gp(t)||!t0(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}function Wz(e,t,o){let n={...e};return t.top+e.y<=o.top?n.y=o.top-t.top:t.bottom+e.y>=o.top+o.height&&(n.y=o.top+o.height-t.bottom),t.left+e.x<=o.left?n.x=o.left-t.left:t.right+e.x>=o.left+o.width&&(n.x=o.left+o.width-t.right),n}var o0=e=>{let{draggingNodeRect:t,transform:o,scrollableAncestorRects:n}=e,r=n[0];return!t||!r?o:Wz(o,t,r)},n0=e=>{let{transform:t}=e;return{...t,x:0}};$();$();var jp={"2xl":1536,"3xl":1600,"4xl":2e3,lg:1024,md:768,sm:640,xl:1280};function r0(e){return`(min-width: ${typeof e=="number"?e:jp[e]}px)`}function a0(e){return`(max-width: ${(typeof e=="number"?e:jp[e])-1}px)`}function Gz(e){if(typeof e!="string"){let o=[];return e.min!=null&&o.push(r0(e.min)),e.max!=null&&o.push(a0(e.max)),e.pointer==="coarse"&&o.push("(pointer: coarse)"),e.pointer==="fine"&&o.push("(pointer: fine)"),o.length===0?"(min-width: 0px)":o.join(" and ")}if(e.startsWith("("))return e;let t=[];for(let o of e.split(":"))if(o.startsWith("max-")){let n=o.slice(4);n in jp&&t.push(a0(n))}else o in jp&&t.push(r0(o));return t.length>0?t.join(" and "):e}function jz(){return!1}function Vp(e){let t=Gz(e),o=R(r=>{if(typeof window>"u")return()=>{};let a=window.matchMedia(t);return a.addEventListener("change",r),()=>a.removeEventListener("change",r)},[t]),n=R(()=>typeof window>"u"?!1:window.matchMedia(t).matches,[t]);return Go(o,n,jz)}function Yd(e){return e.source?.kind==="user"?!1:e.source?.kind==="scheduled-wake"?e.management===void 0:!0}var Si=e=>(e??"").split(`
3550
+ `).map(t=>t.trim()).find(t=>t!=="")??"";function s0(e,t){let o=new Date(e);return Number.isNaN(o.getTime())?e:new Intl.DateTimeFormat(t,{...o.toDateString()===new Date().toDateString()?{}:{dateStyle:"short"},timeStyle:"short"}).format(o)}var Qp={user:"turnQueue.sourceUser",schedule:"turnQueue.sourceSchedule","scheduled-wake":"turnQueue.sourceScheduledWake",record:"turnQueue.sourceSession",session:"turnQueue.sourceSession",reply:"turnQueue.sourceReply","child-report":"turnQueue.sourceChildReport","plugin-wake":"turnQueue.sourcePluginWake","board-dispatch":"turnQueue.sourceBoardDispatch","plugin-notice":"turnQueue.sourcePluginNotice","home-machine":"turnQueue.sourceHomeMachine","restart-resume":"turnQueue.sourceRestartResume"};function i0({environmentId:e,pluginId:t,label:o}){let n=Xn(e,t??"");return t===void 0||n===null?l(oe,{children:o}):l(Mo,{environmentId:e,pluginId:t})}function Eh({source:e,environmentId:t}){let{t:o}=z();return e===void 0?null:l(jr,{variant:e.kind==="user"?"outline":e.kind==="scheduled-wake"?"info":"muted",size:"sm","data-queue-source":e.kind,children:e.kind==="person"?e.displayName:e.kind==="scheduled-wake"||e.kind==="schedule"?v(oe,{children:[o(Qp[e.kind]),e.pluginId===void 0?null:l(i0,{environmentId:t,pluginId:e.pluginId,label:""})]}):e.kind==="plugin-wake"||e.kind==="plugin-notice"?l(i0,{environmentId:t,pluginId:e.pluginId,label:o(Qp[e.kind])}):o(Qp[e.kind])})}function Xp(e,t,o){let n=wb(t===null?null:{environmentId:e,threadId:t},o??void 0);return t===null?null:n??o}function Mh({title:e,text:t}){let{t:o}=z();return e===null||e===""?l(oe,{children:t}):l(oe,{children:t===""?o("turnQueue.titleOnly",{title:e}):o("turnQueue.sessionLine",{sender:e,text:t})})}function Vz({recordId:e,readRecord:t,environmentId:o}){let{t:n}=z(),r=t(e),a=r===null||typeof r=="string"?null:r,s=a?.from,i=Xp(o,s?.kind==="thread"?s.threadId:null,s?.kind==="thread"?s.title:null);if(r===null)return l(oe,{children:"\u2026"});if(a===null||a.text===null)return l(oe,{children:n("turnQueue.messageUnavailable")});let d=s===void 0?null:s.kind==="thread"?i:s.displayName;return l(Mh,{title:d,text:Si(Dd(a.text))})}function Qz({recordId:e,readRecord:t,environmentId:o}){let n=t(e),r=n===null||typeof n=="string"?null:n,a=t(r?.replyRecordId??null),s=a===null||typeof a=="string"?null:a,i=s?.from??r?.to,d=Xp(o,i?.kind==="thread"?i.threadId:null,i?.kind==="thread"?i.title:null),c=i===void 0?null:i.kind==="thread"?d:i.displayName,u=s?.text==null?"":Si(Dd(s.text));return c===null&&u===""?null:l(Mh,{title:c,text:u})}function Xz(e){let t=Xp(e.environmentId,e.threadId,e.threadTitle);return l(Mh,{title:t,text:e.text})}function Yz(e){let{t}=z(),{source:o}=e,n=Xp(e.environmentId,o.childThreadId,o.childTitle);return l(oe,{children:t(o.outcome==="settled"?"turnQueue.childReportSettled":o.outcome==="failed"?"turnQueue.childReportFailed":"turnQueue.childReportLine",{title:n??"",text:e.text})})}function l0({entry:e,readRecord:t,environmentId:o}){let{t:n}=z(),r=e.source;switch(r?.kind){case"scheduled-wake":return l(oe,{children:n("turnQueue.wakeLine",{time:s0(r.dueAt),note:e.text??""})});case"record":return t===void 0?null:l(Vz,{recordId:r.recordId,readRecord:t,environmentId:o});case"reply":return t===void 0?null:l(Qz,{recordId:r.recordId,readRecord:t,environmentId:o});case"session":return l(Xz,{environmentId:o,threadId:r.threadId,threadTitle:r.threadTitle,text:Si(e.text)});case"child-report":return l(Yz,{environmentId:o,source:r,text:Si(e.text)});case"plugin-wake":case"person":case"board-dispatch":case"plugin-notice":case"home-machine":case"restart-resume":return l(oe,{children:Si(e.text)});default:return l(oe,{children:e.text||n("turnQueue.attachmentsOnly")})}}$();var Ah={};Ut(Ah,{LexicalComposerContext:()=>d0,createLexicalComposerContext:()=>Jz,useLexicalComposerContext:()=>Zz});$();var d0=qe(null);function Jz(e,t){let o=null;return e!=null&&(o=e[1]),{getTheme:function(){return t??(o!=null?o.getTheme():null)}}}function Zz(){let e=Pt(d0);return e==null&&(function(t,...o){let n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",t);for(let a of o)r.append("v",a);throw n.search=r.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)})(8),e}var Nh=Ah,c0=Nh.LexicalComposerContext,u0=Nh.createLexicalComposerContext,ct=Nh.useLexicalComposerContext;var lv={};Ut(lv,{$addUpdateTag:()=>_m,$applyNodeReplacement:()=>wc,$caretFromPoint:()=>fa,$caretRangeFromSelection:()=>xy,$cloneWithProperties:()=>tv,$cloneWithPropertiesEphemeral:()=>O5,$comparePointCaretNext:()=>av,$copyNode:()=>Zy,$create:()=>B5,$createLineBreakNode:()=>Di,$createNodeSelection:()=>By,$createParagraphNode:()=>Lr,$createPoint:()=>En,$createRangeSelection:()=>tP,$createRangeSelectionFromDom:()=>u5,$createTabNode:()=>Rm,$createTextNode:()=>oo,$extendCaretToRange:()=>nv,$findMatchingParent:()=>nc,$getAdjacentChildCaret:()=>zi,$getAdjacentNode:()=>bP,$getAdjacentSiblingOrParentSiblingCaret:()=>G5,$getCaretInDirection:()=>ga,$getCaretRange:()=>ma,$getCaretRangeInDirection:()=>iv,$getCharacterOffsets:()=>py,$getChildCaret:()=>Rr,$getChildCaretAtIndex:()=>OP,$getChildCaretOrSelf:()=>MP,$getCollapsedCaretRange:()=>AP,$getCommonAncestor:()=>rc,$getCommonAncestorResultBranchOrder:()=>sv,$getEditor:()=>ev,$getNearestNodeFromDOMNode:()=>Dm,$getNearestRootOrShadowRoot:()=>IP,$getNodeByKey:()=>Vt,$getNodeByKeyOrThrow:()=>SP,$getNodeFromDOMNode:()=>Gy,$getPreviousSelection:()=>ys,$getRoot:()=>Xo,$getSelection:()=>Je,$getSiblingCaret:()=>io,$getState:()=>lm,$getStateChange:()=>MK,$getTextContent:()=>f5,$getTextNodeOffset:()=>Rn,$getTextPointCaret:()=>pa,$getTextPointCaretSlice:()=>vy,$getWritableNodeState:()=>Iy,$hasAncestor:()=>Tm,$hasUpdateTag:()=>M5,$insertNodes:()=>m5,$isBlockElementNode:()=>c5,$isChildCaret:()=>Pn,$isDecoratorNode:()=>yt,$isEditorState:()=>v5,$isElementNode:()=>re,$isExtendableTextPointCaret:()=>_P,$isInlineElementOrDecoratorNode:()=>A5,$isLeafNode:()=>P5,$isLineBreakNode:()=>cs,$isNodeCaret:()=>$5,$isNodeSelection:()=>vc,$isParagraphNode:()=>lP,$isRangeSelection:()=>Oe,$isRootNode:()=>lo,$isRootOrShadowRoot:()=>un,$isSiblingCaret:()=>hs,$isTabNode:()=>Fy,$isTextNode:()=>ke,$isTextPointCaret:()=>Pr,$isTextPointCaretSlice:()=>W5,$isTokenOrSegmented:()=>Ir,$isTokenOrTab:()=>ia,$nodesOfType:()=>E5,$normalizeCaret:()=>kn,$normalizeSelection__EXPERIMENTAL:()=>dm,$onUpdate:()=>TP,$parseSerializedNode:()=>y5,$removeTextFromCaretRange:()=>DP,$rewindSiblingCaret:()=>Gi,$selectAll:()=>R5,$setCompositionKey:()=>ro,$setPointFromCaret:()=>Ki,$setSelection:()=>$o,$setSelectionFromCaretRange:()=>NP,$setState:()=>AK,$splitAtPointCaretNext:()=>Q5,$splitNode:()=>N5,$updateRangeSelectionFromCaretRange:()=>ac,ArtificialNode__DO_NOT_USE:()=>bm,BEFORE_INPUT_COMMAND:()=>ky,BLUR_COMMAND:()=>DL,CAN_REDO_COMMAND:()=>qK,CAN_UNDO_COMMAND:()=>WK,CLEAR_EDITOR_COMMAND:()=>zK,CLEAR_HISTORY_COMMAND:()=>KK,CLICK_COMMAND:()=>yL,COLLABORATION_TAG:()=>WL,COMMAND_PRIORITY_CRITICAL:()=>T5,COMMAND_PRIORITY_EDITOR:()=>Pi,COMMAND_PRIORITY_HIGH:()=>w5,COMMAND_PRIORITY_LOW:()=>x5,COMMAND_PRIORITY_NORMAL:()=>b5,COMPOSITION_END_COMMAND:()=>Ry,COMPOSITION_END_TAG:()=>QL,COMPOSITION_START_COMMAND:()=>Py,COMPOSITION_START_TAG:()=>VL,CONTROLLED_TEXT_INSERTION_COMMAND:()=>Ei,COPY_COMMAND:()=>Dy,CUT_COMMAND:()=>_y,DELETE_CHARACTER_COMMAND:()=>dc,DELETE_LINE_COMMAND:()=>uc,DELETE_WORD_COMMAND:()=>cc,DRAGEND_COMMAND:()=>AL,DRAGOVER_COMMAND:()=>ML,DRAGSTART_COMMAND:()=>EL,DROP_COMMAND:()=>RL,DecoratorNode:()=>mc,ElementNode:()=>ca,FOCUS_COMMAND:()=>NL,FORMAT_ELEMENT_COMMAND:()=>$K,FORMAT_TEXT_COMMAND:()=>aa,HISTORIC_TAG:()=>ZK,HISTORY_MERGE_TAG:()=>am,HISTORY_PUSH_TAG:()=>e5,INDENT_CONTENT_COMMAND:()=>HK,INPUT_COMMAND:()=>Ly,INSERT_LINE_BREAK_COMMAND:()=>ec,INSERT_PARAGRAPH_COMMAND:()=>oy,INSERT_TAB_COMMAND:()=>BK,INTERNAL_$isBlock:()=>kr,IS_ALL_FORMATTING:()=>pK,IS_BOLD:()=>aK,IS_CODE:()=>dK,IS_HIGHLIGHT:()=>by,IS_ITALIC:()=>sK,IS_STRIKETHROUGH:()=>iK,IS_SUBSCRIPT:()=>cK,IS_SUPERSCRIPT:()=>uK,IS_UNDERLINE:()=>lK,KEY_ARROW_DOWN_COMMAND:()=>TL,KEY_ARROW_LEFT_COMMAND:()=>xL,KEY_ARROW_RIGHT_COMMAND:()=>vL,KEY_ARROW_UP_COMMAND:()=>wL,KEY_BACKSPACE_COMMAND:()=>SL,KEY_DELETE_COMMAND:()=>LL,KEY_DOWN_COMMAND:()=>Ny,KEY_ENTER_COMMAND:()=>fm,KEY_ESCAPE_COMMAND:()=>kL,KEY_MODIFIER_COMMAND:()=>_L,KEY_SPACE_COMMAND:()=>IL,KEY_TAB_COMMAND:()=>PL,LineBreakNode:()=>Ni,MOVE_TO_END:()=>CL,MOVE_TO_START:()=>bL,NODE_STATE_KEY:()=>SK,OUTDENT_CONTENT_COMMAND:()=>UK,PASTE_COMMAND:()=>Ey,PASTE_TAG:()=>t5,ParagraphNode:()=>Fi,REDO_COMMAND:()=>Ay,REMOVE_TEXT_COMMAND:()=>ny,RootNode:()=>Oi,SELECTION_CHANGE_COMMAND:()=>Sy,SELECTION_INSERT_CLIPBOARD_NODES_COMMAND:()=>FK,SELECT_ALL_COMMAND:()=>ry,SKIP_COLLAB_TAG:()=>o5,SKIP_DOM_SELECTION_TAG:()=>jL,SKIP_SCROLL_INTO_VIEW_TAG:()=>GL,SKIP_SELECTION_FOCUS_TAG:()=>cy,TEXT_TYPE_TO_FORMAT:()=>Co,TabNode:()=>_i,TextNode:()=>ms,UNDO_COMMAND:()=>My,addClassNamesToElement:()=>tq,buildImportMap:()=>JK,configExtension:()=>Y5,createCommand:()=>He,createEditor:()=>I5,createSharedNodeState:()=>uL,createState:()=>EK,declarePeerDependency:()=>J5,defineExtension:()=>X5,flipDirection:()=>ha,getDOMOwnerDocument:()=>Yy,getDOMSelection:()=>An,getDOMSelectionFromTarget:()=>kP,getDOMTextNode:()=>gs,getEditorPropertyFromDOMNode:()=>xc,getNearestEditorFromDOMNode:()=>Wy,getRegisteredNode:()=>Ky,getRegisteredNodeOrThrow:()=>zy,getStaticNodeConfig:()=>Tc,getTextDirection:()=>L5,getTransformSetFromKlass:()=>cP,isBlockDomNode:()=>hy,isCurrentlyReadOnlyMode:()=>qi,isDOMDocumentNode:()=>mP,isDOMNode:()=>Wi,isDOMTextNode:()=>nr,isDOMUnmanaged:()=>EP,isDocumentFragment:()=>LP,isExactShortcutMatch:()=>at,isHTMLAnchorElement:()=>D5,isHTMLElement:()=>ko,isInlineDomNode:()=>PP,isLexicalEditor:()=>Am,isModifierMatch:()=>xP,isSelectionCapturedInDecoratorInput:()=>qy,isSelectionWithinEditor:()=>Cc,makeStepwiseIterator:()=>rv,mergeRegister:()=>nq,normalizeClassNames:()=>Ic,removeClassNamesFromElement:()=>oq,removeFromParent:()=>la,resetRandomKey:()=>S5,safeCast:()=>Z5,setDOMUnmanaged:()=>F5,setNodeIndentFromDOM:()=>RP,shallowMergeConfig:()=>eq,toggleTextFormatType:()=>gc});function le(e,...t){let o=new URL("https://lexical.dev/docs/error"),n=new URLSearchParams;n.append("code",e);for(let r of t)n.append("v",r);throw o.search=n.toString(),Error(`Minified Lexical error #${e}; visit ${o.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function nL(e,...t){let o=new URL("https://lexical.dev/docs/error"),n=new URLSearchParams;n.append("code",e);for(let r of t)n.append("v",r);o.search=n.toString(),console.warn(`Minified Lexical warning #${e}; visit ${o.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var Mn=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,eK=Mn&&"documentMode"in document?document.documentMode:null,Sn=Mn&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),da=Mn&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),im=!(!Mn||!("InputEvent"in window)||eK)&&"getTargetRanges"in new window.InputEvent("input"),Sm=Mn&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),yc=Mn&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,tK=Mn&&/Android/.test(navigator.userAgent),rL=Mn&&/^(?=.*Chrome).*/i.test(navigator.userAgent),qh=Mn&&tK&&rL,km=Mn&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&Sn&&!rL,oK=0,nK=1,rK=2,aK=1,sK=2,iK=4,lK=8,dK=16,cK=32,uK=64,by=128,pK=2047,mK=1,fK=2,gK=3,hK=4,yK=5,vK=6,sc=Sm||yc||km?"\xA0":"\u200B",Lm=`
3551
3551
 
3552
- `,wy=da?"\xA0":sc,nL="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",rL="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",hK=new RegExp("^[^"+rL+"]*["+nL+"]"),yK=new RegExp("^[^"+nL+"]*["+rL+"]"),xo={bold:1,capitalize:1024,code:16,highlight:by,italic:2,lowercase:256,strikethrough:4,subscript:32,superscript:64,underline:8,uppercase:512},vK={directionless:1,unmergeable:2},Wh={center:2,end:6,justify:4,left:1,right:3,start:5},CK={[uK]:"center",[gK]:"end",[mK]:"justify",[cK]:"left",[pK]:"right",[fK]:"start"},xK={normal:0,segmented:2,token:1},bK={[Zz]:"normal",[tK]:"segmented",[eK]:"token"},wK="$",c0="$config";function aL(e,t,o,n,r,a){let s=e.getFirstChild();for(;s!==null;){let i=s.__key;s.__parent===t&&(re(s)&&aL(s,i,o,n,r,a),o.has(i)||a.delete(i),r.push(i)),s=s.getNextSibling()}}var Gh=!1,Ty=0;function TK(e){Ty=e.timeStamp}function Dh(e,t,o){let n=e.nodeName==="BR",r=t.__lexicalLineBreak;return r&&(e===r||n&&e.previousSibling===r)||n&&Nm(e,o)!==void 0}function IK(e,t,o){let n=An(Jo(o)),r=null,a=null;n!==null&&n.anchorNode===e&&(r=n.anchorOffset,a=n.focusOffset);let s=e.nodeValue;s!==null&&Qy(t,s,r,a,!1)}function SK(e,t,o){if(Oe(e)){let n=e.anchor.getNode();if(n.is(o)&&e.format!==n.getFormat())return!1}return nr(t)&&o.isAttached()}function kK(e,t,o,n){for(let r=e;r&&!PP(r);r=bc(r)){let a=Nm(r,t);if(a!==void 0){let s=Vt(a,o);if(s)return yt(s)||!ko(r)?void 0:[r,s]}else if(r===n)return[n,fP(o)]}}function sL(e,t,o){Gh=!0;let n=performance.now()-Ty>100;try{or(e,()=>{let r=Je()||(function(p){return p.getEditorState().read(()=>{let f=Je();return f!==null?f.clone():null})})(e),a=new Map,s=e.getRootElement(),i=e._editorState,d=e._blockCursorElement,c=!1,u="";for(let p=0;p<t.length;p++){let f=t[p],g=f.type,h=f.target,y=kK(h,e,i,s);if(!y)continue;let[x,C]=y;if(g==="characterData")n&&ke(C)&&nr(h)&&SK(r,h,C)&&IK(h,C,e);else if(g==="childList"){c=!0;let b=f.addedNodes;for(let k=0;k<b.length;k++){let I=b[k],T=Gy(I),S=I.parentNode;if(S!=null&&I!==d&&T===null&&!Dh(I,S,e)){if(da){let P=(ko(I)?I.innerText:null)||I.nodeValue;P&&(u+=P)}S.removeChild(I)}}let L=f.removedNodes,w=L.length;if(w>0){let k=0;for(let I=0;I<w;I++){let T=L[I];(Dh(T,h,e)||d===T)&&(h.appendChild(T),k++)}w!==k&&a.set(x,C)}}}if(a.size>0)for(let[p,f]of a)f.reconcileObservedMutation(p,e);let m=o.takeRecords();if(m.length>0){for(let p=0;p<m.length;p++){let f=m[p],g=f.addedNodes,h=f.target;for(let y=0;y<g.length;y++){let x=g[y],C=x.parentNode;C==null||x.nodeName!=="BR"||Dh(x,h,e)||C.removeChild(x)}}o.takeRecords()}r!==null&&(c&&$o(r),da&&xP(e)&&r.insertRawText(u))})}finally{Gh=!1}}function iL(e){let t=e._observer;t!==null&&sL(e,t.takeRecords(),t)}function lL(e){(function(t){Ty===0&&Jo(t).addEventListener("textInput",TK,!0)})(e),e._observer=new MutationObserver((t,o)=>{sL(e,t,o)})}var jh=class{key;parse;unparse;isEqual;defaultValue;constructor(t,o){this.key=t,this.parse=o.parse.bind(o),this.unparse=(o.unparse||EK).bind(o),this.isEqual=(o.isEqual||Object.is).bind(o),this.defaultValue=this.parse(void 0)}};function LK(e,t){return new jh(e,t)}function lm(e,t,o="latest"){let n=(o==="latest"?e.getLatest():e).__state;return n?n.getValue(t):t.defaultValue}function PK(e,t,o){let n=lm(e,o,"direct"),r=lm(t,o,"direct");return o.isEqual(n,r)?null:[n,r]}function RK(e,t,o){let n;if(no(),typeof o=="function"){let a=e.getLatest(),s=lm(a,t);if(n=o(s),t.isEqual(s,n))return a}else n=o;let r=e.getWritable();return Iy(r).updateFromKnown(t,n),r}function dL(e){let t=new Map,o=new Set;for(let n=typeof e=="function"?e:e.replace;n.prototype&&n.prototype.getType!==void 0;n=Object.getPrototypeOf(n)){let{ownNodeConfig:r}=Tc(n);if(r&&r.stateConfigs)for(let a of r.stateConfigs){let s;"stateConfig"in a?(s=a.stateConfig,a.flat&&o.add(s.key)):s=a,t.set(s.key,s)}}return{flatKeys:o,sharedConfigMap:t}}var Vh=class e{node;knownState;unknownState;sharedNodeState;size;constructor(t,o,n=void 0,r=new Map,a=void 0){this.node=t,this.sharedNodeState=o,this.unknownState=n,this.knownState=r;let{sharedConfigMap:s}=this.sharedNodeState,i=a!==void 0?a:(function(d,c,u){let m=u.size;if(c)for(let p in c){let f=d.get(p);f&&u.has(f)||m++}return m})(s,n,r);this.size=i}getValue(t){let o=this.knownState.get(t);if(o!==void 0)return o;this.sharedNodeState.sharedConfigMap.set(t.key,t);let n=t.defaultValue;if(this.unknownState&&t.key in this.unknownState){let r=this.unknownState[t.key];r!==void 0&&(n=t.parse(r)),this.updateFromKnown(t,n)}return n}getInternalState(){return[this.unknownState,this.knownState]}toJSON(){let t={...this.unknownState},o={};for(let[n,r]of this.knownState)n.isEqual(r,n.defaultValue)?delete t[n.key]:t[n.key]=n.unparse(r);for(let n of this.sharedNodeState.flatKeys)n in t&&(o[n]=t[n],delete t[n]);return u0(t)&&(o.$=t),o}getWritable(t){if(this.node===t)return this;let{sharedNodeState:o,unknownState:n}=this,r=new Map(this.knownState);return new e(t,o,(function(a,s,i){let d;if(i)for(let[c,u]of Object.entries(i)){let m=a.get(c);m?s.has(m)||s.set(m,m.parse(u)):(d=d||{},d[c]=u)}return d})(o.sharedConfigMap,r,n),r,this.size)}updateFromKnown(t,o){let n=t.key;this.sharedNodeState.sharedConfigMap.set(n,t);let{knownState:r,unknownState:a}=this;r.has(t)||a&&n in a||(a&&(delete a[n],this.unknownState=u0(a)),this.size++),r.set(t,o)}updateFromUnknown(t,o){let n=this.sharedNodeState.sharedConfigMap.get(t);n?this.updateFromKnown(n,n.parse(o)):(this.unknownState=this.unknownState||{},t in this.unknownState||this.size++,this.unknownState[t]=o)}updateFromJSON(t){let{knownState:o}=this;for(let n of o.keys())o.set(n,n.defaultValue);if(this.size=o.size,this.unknownState=void 0,t)for(let[n,r]of Object.entries(t))this.updateFromUnknown(n,r)}};function Iy(e){let t=e.getWritable(),o=t.__state?t.__state.getWritable(t):new Vh(t,cL(t));return t.__state=o,o}function cL(e){return e.__state?e.__state.sharedNodeState:zy(ev(),e.getType()).sharedNodeState}function u0(e){if(e)for(let t in e)return e}function EK(e){return e}function p0(e,t,o){for(let[n,r]of t.knownState){if(e.has(n.key))continue;e.add(n.key);let a=o?o.getValue(n):n.defaultValue;if(a!==r&&!n.isEqual(a,r))return!0}return!1}function m0(e,t,o){let{unknownState:n}=t,r=o?o.unknownState:void 0;if(n){for(let[a,s]of Object.entries(n))if(!e.has(a)&&(e.add(a),s!==(r?r[a]:void 0)))return!0}return!1}function f0(e,t){let o=e.__state;return o&&o.node===e?o.getWritable(t):o}function g0(e,t){let o=e.__mode,n=e.__format,r=e.__style,a=t.__mode,s=t.__format,i=t.__style,d=e.__state,c=t.__state;return(o===null||o===a)&&(n===null||n===s)&&(r===null||r===i)&&(e.__state===null||d===c||(function(u,m){if(u===m)return!0;if(u&&m&&u.size!==m.size)return!1;let p=new Set;return!(u&&p0(p,u,m)||m&&p0(p,m,u)||u&&m0(p,u,m)||m&&m0(p,m,u))})(d,c))}function h0(e,t){let o=e.mergeWithSibling(t),n=mt()._normalizedNodes;return n.add(e.__key),n.add(t.__key),o}function y0(e){let t,o,n=e;if(n.__text!==""||!n.isSimpleText()||n.isUnmergeable()){for(;(t=n.getPreviousSibling())!==null&&ke(t)&&t.isSimpleText()&&!t.isUnmergeable();){if(t.__text!==""){if(g0(t,n)){n=h0(t,n);break}break}t.remove()}for(;(o=n.getNextSibling())!==null&&ke(o)&&o.isSimpleText()&&!o.isUnmergeable();){if(o.__text!==""){if(g0(n,o)){n=h0(n,o);break}break}o.remove()}}else n.remove()}function dm(e){return v0(e.anchor),v0(e.focus),e}function v0(e){for(;e.type==="element";){let t=e.getNode(),o=e.offset,n,r;if(o===t.getChildrenSize()?(n=t.getChildAtIndex(o-1),r=!0):(n=t.getChildAtIndex(o),r=!1),ke(n)){e.set(n.__key,r?n.getTextContentSize():0,"text",!0);break}if(!re(n))break;e.set(n.__key,r?n.getChildrenSize():0,"element",!0)}}var us,co,ic,Pm,Qh,Xh,ps,Ln,Yh,lc,jt="",tr=null,ls=null,ki=!1,cm=!1;function um(e,t){let o=ps.get(e);if(t!==null){let n=ty(e);n.parentNode===t&&t.removeChild(n)}if(Ln.has(e)||co._keyToDOMMap.delete(e),re(o)){let n=mm(o,ps);Jh(n,0,n.length-1,null)}o!==void 0&&Xy(lc,ic,Pm,o,"destroyed")}function Jh(e,t,o,n){for(let r=t;r<=o;++r){let a=e[r];a!==void 0&&um(a,n)}}function is(e,t){e.setProperty("text-align",t)}var MK="40px";function uL(e,t){let o=us.theme.indent;if(typeof o=="string"){let r=e.classList.contains(o);t>0&&!r?e.classList.add(o):t<1&&r&&e.classList.remove(o)}if(t===0)return void e.style.setProperty("padding-inline-start","");let n=getComputedStyle(co._rootElement||e).getPropertyValue("--lexical-indent-base-value")||MK;e.style.setProperty("padding-inline-start",`calc(${t} * ${n})`)}function pL(e,t){let o=e.style;t===0?is(o,""):t===1?is(o,"left"):t===2?is(o,"center"):t===3?is(o,"right"):t===4?is(o,"justify"):t===5?is(o,"start"):t===6&&is(o,"end")}function Zh(e,t){let o=(function(n){let r=n.__dir;if(r!==null)return r;if(lo(n))return null;let a=n.getParentOrThrow();return lo(a)&&a.__dir===null?"auto":null})(t);o!==null?e.dir=o:e.removeAttribute("dir")}function pm(e,t){let o=Ln.get(e);o===void 0&&le(60);let n=o.createDOM(us,co);if((function(r,a,s){let i=s._keyToDOMMap;(function(d,c,u){let m=`__lexicalKey_${c._key}`;d[m]=u})(a,s,r),i.set(r,a)})(e,n,co),ke(o)?n.setAttribute("data-lexical-text","true"):yt(o)&&n.setAttribute("data-lexical-decorator","true"),re(o)){let r=o.__indent,a=o.__size;if(Zh(n,o),r!==0&&uL(n,r),a!==0){let i=a-1;ey(mm(o,Ln),o,0,i,o.getDOMSlot(n))}let s=o.__format;s!==0&&pL(n,s),o.isInline()||mL(null,o,n)}else{let r=o.getTextContent();if(yt(o)){let a=o.decorate(co,us);a!==null&&fL(e,a),n.contentEditable="false"}jt+=r}return t!==null&&t.insertChild(n),Xy(lc,ic,Pm,o,"created"),n}function ey(e,t,o,n,r){let a=jt;jt="";let s=o;for(;s<=n;++s){pm(e[s],r);let i=Ln.get(e[s]);i!==null&&ke(i)?tr===null&&(tr=i.getFormat(),ls=i.getStyle()):re(i)&&s<n&&!i.isInline()&&(jt+=Lm)}r.element.__lexicalTextContent=jt,jt=a+jt}function C0(e,t){if(e){let o=e.__last;if(o){let n=t.get(o);if(n)return cs(n)?"line-break":yt(n)&&n.isInline()?"decorator":null}return"empty"}return null}function mL(e,t,o){let n=C0(e,ps),r=C0(t,Ln);n!==r&&t.getDOMSlot(o).setManagedLineBreak(r)}function AK(e,t,o){var n;tr=null,ls=null,(function(r,a,s){let i=jt,d=r.__size,c=a.__size;jt="";let u=s.element;if(d===1&&c===1){let m=r.__first,p=a.__first;if(m===p)tm(m,u);else{let g=ty(m),h=pm(p,null);try{u.replaceChild(h,g)}catch(y){if(typeof y=="object"&&y!=null){let x=`${y.toString()} Parent: ${u.tagName}, new child: {tag: ${h.tagName} key: ${p}}, old child: {tag: ${g.tagName}, key: ${m}}.`;throw new Error(x)}throw y}um(m,null)}let f=Ln.get(p);ke(f)&&tr===null&&(tr=f.getFormat(),ls=f.getStyle())}else{let m=mm(r,ps),p=mm(a,Ln);if(m.length!==d&&le(227),p.length!==c&&le(228),d===0)c!==0&&ey(p,0,0,c-1,s);else if(c===0){if(d!==0){let f=s.after==null&&s.before==null&&s.element.__lexicalLineBreak==null;Jh(m,0,d-1,f?null:u),f&&(u.textContent="")}}else(function(f,g,h,y,x,C){let b=y-1,L=x-1,w,k,I=C.getFirstChild(),T=0,S=0;for(;T<=b&&S<=L;){let N=g[T],B=h[S];if(N===B)I=_h(tm(B,C.element)),T++,S++;else{if(k===void 0&&(k=x0(h,S)),w===void 0)w=x0(g,T);else if(!w.has(N)){T++;continue}if(!k.has(N)){I=_h(ty(N)),um(N,C.element),T++,w.delete(N);continue}if(w.has(B)){let j=Bi(co,B);j!==I&&C.withBefore(I).insertChild(j),I=_h(tm(B,C.element)),T++,S++}else pm(B,C.withBefore(I)),S++}let O=Ln.get(B);O!==null&&ke(O)?tr===null&&(tr=O.getFormat(),ls=O.getStyle()):re(O)&&S<=L&&!O.isInline()&&(jt+=Lm)}let P=T>b,A=S>L;if(P&&!A){let N=h[L+1],B=N===void 0?null:co.getElementByKey(N);ey(h,0,S,L,C.withBefore(B))}else A&&!P&&Jh(g,T,b,C.element)})(0,m,p,d,c,s)}u.__lexicalTextContent=jt,jt=i+jt})(e,t,t.getDOMSlot(o)),n=t,tr==null||tr===n.__textFormat||cm||n.setTextFormat(tr),(function(r){ls==null||ls===r.__textStyle||cm||r.setTextStyle(ls)})(t)}function mm(e,t){let o=[],n=e.__first;for(;n!==null;){let r=t.get(n);r===void 0&&le(101),o.push(n),n=r.__next}return o}function tm(e,t){let o=ps.get(e),n=Ln.get(e);o!==void 0&&n!==void 0||le(61);let r=ki||Xh.has(e)||Qh.has(e),a=Bi(co,e);if(o===n&&!r){let s;if(re(o)){let i=a.__lexicalTextContent;typeof i=="string"?s=i:(s=o.getTextContent(),a.__lexicalTextContent=s)}else s=o.getTextContent();return jt+=s,a}if(o!==n&&r&&Xy(lc,ic,Pm,n,"updated"),n.updateDOM(o,a,us)){let s=pm(e,null);return t===null&&le(62),t.replaceChild(s,a),um(e,null),s}if(re(o)){re(n)||le(334,e);let s=n.__indent;(ki||s!==o.__indent)&&uL(a,s);let i=n.__format;if((ki||i!==o.__format)&&pL(a,i),r)AK(o,n,a),lo(n)||n.isInline()||mL(o,n,a);else{let d=a.__lexicalTextContent,c;typeof d=="string"?c=d:(c=o.getTextContent(),a.__lexicalTextContent=c),jt+=c}if((ki||n.__dir!==o.__dir)&&(Zh(a,n),lo(n)&&!ki))for(let d of n.getChildren())re(d)&&Zh(Bi(co,d.getKey()),d)}else{let s=n.getTextContent();if(yt(n)){let i=n.decorate(co,us);i!==null&&fL(e,i)}jt+=s}if(!cm&&lo(n)&&n.__cachedText!==jt){let s=n.getWritable();s.__cachedText=jt,n=s}return a}function fL(e,t){let o=co._pendingDecorators,n=co._decorators;if(o===null){if(n[e]===t)return;o=mP(co)}o[e]=t}function _h(e){let t=e.nextSibling;return t!==null&&t===co._blockCursorElement&&(t=t.nextSibling),t}function x0(e,t){let o=new Set;for(let n=t;n<e.length;n++)o.add(e[n]);return o}function NK(e,t,o,n,r,a){jt="",ki=n===2,co=o,us=o._config,ic=o._nodes,Pm=co._listeners.mutation,Qh=r,Xh=a,ps=e._nodeMap,Ln=t._nodeMap,cm=t._readOnly,Yh=new Map(o._keyToDOMMap);let s=new Map;return lc=s,tm("root",null),co=void 0,ic=void 0,Qh=void 0,Xh=void 0,ps=void 0,Ln=void 0,us=void 0,Yh=void 0,lc=void 0,s}function ty(e){let t=Yh.get(e);return t===void 0&&le(75,e),t}function He(e){return{type:e}}var Sy=He("SELECTION_CHANGE_COMMAND"),DK=He("SELECTION_INSERT_CLIPBOARD_NODES_COMMAND"),gL=He("CLICK_COMMAND"),ky=He("BEFORE_INPUT_COMMAND"),Ly=He("INPUT_COMMAND"),Py=He("COMPOSITION_START_COMMAND"),Ry=He("COMPOSITION_END_COMMAND"),dc=He("DELETE_CHARACTER_COMMAND"),ec=He("INSERT_LINE_BREAK_COMMAND"),oy=He("INSERT_PARAGRAPH_COMMAND"),Ei=He("CONTROLLED_TEXT_INSERTION_COMMAND"),Ey=He("PASTE_COMMAND"),ny=He("REMOVE_TEXT_COMMAND"),cc=He("DELETE_WORD_COMMAND"),uc=He("DELETE_LINE_COMMAND"),aa=He("FORMAT_TEXT_COMMAND"),My=He("UNDO_COMMAND"),Ay=He("REDO_COMMAND"),Ny=He("KEYDOWN_COMMAND"),hL=He("KEY_ARROW_RIGHT_COMMAND"),yL=He("MOVE_TO_END"),vL=He("KEY_ARROW_LEFT_COMMAND"),CL=He("MOVE_TO_START"),xL=He("KEY_ARROW_UP_COMMAND"),bL=He("KEY_ARROW_DOWN_COMMAND"),fm=He("KEY_ENTER_COMMAND"),wL=He("KEY_SPACE_COMMAND"),TL=He("KEY_BACKSPACE_COMMAND"),IL=He("KEY_ESCAPE_COMMAND"),SL=He("KEY_DELETE_COMMAND"),kL=He("KEY_TAB_COMMAND"),_K=He("INSERT_TAB_COMMAND"),OK=He("INDENT_CONTENT_COMMAND"),FK=He("OUTDENT_CONTENT_COMMAND"),LL=He("DROP_COMMAND"),BK=He("FORMAT_ELEMENT_COMMAND"),PL=He("DRAGSTART_COMMAND"),RL=He("DRAGOVER_COMMAND"),EL=He("DRAGEND_COMMAND"),Dy=He("COPY_COMMAND"),_y=He("CUT_COMMAND"),ry=He("SELECT_ALL_COMMAND"),HK=He("CLEAR_EDITOR_COMMAND"),UK=He("CLEAR_HISTORY_COMMAND"),$K=He("CAN_REDO_COMMAND"),zK=He("CAN_UNDO_COMMAND"),ML=He("FOCUS_COMMAND"),AL=He("BLUR_COMMAND"),NL=He("KEY_MODIFIER_COMMAND"),br=Object.freeze({}),ay=[["keydown",function(e,t){pc=e.timeStamp,DL=e.key,!t.isComposing()&&we(t,Ny,e)}],["pointerdown",function(e,t){let o=e.target,n=e.pointerType;Wi(o)&&n!=="touch"&&n!=="pen"&&e.button===0&&or(t,()=>{cP(o)||(ly=!0)})}],["compositionstart",function(e,t){we(t,Py,e)}],["compositionend",function(e,t){da?Zd=!0:yc||!Sm&&!km?we(t,Ry,e):(om=!0,nm=e.data)}],["input",function(e,t){e.stopPropagation(),or(t,()=>{t.dispatchCommand(Ly,e)},{event:e}),Li=null}],["click",function(e,t){or(t,()=>{let o=Je(),n=An(Jo(t)),r=ys();if(n){if(Oe(o)){let a=o.anchor,s=a.getNode();if(a.type==="element"&&a.offset===0&&o.isCollapsed()&&!lo(s)&&Yo().getChildrenSize()===1&&s.getTopLevelElementOrThrow().isEmpty()&&r!==null&&o.is(r))n.removeAllRanges(),o.dirty=!0;else if(e.detail===3&&!o.isCollapsed()&&s!==o.focus.getNode()){let i=nc(s,d=>re(d)&&!d.isInline());re(i)&&i.select(0)}}else if(e.pointerType==="touch"||e.pointerType==="pen"){let a=n.anchorNode;(ko(a)||nr(a))&&$o(Em(r,n,t,e))}}we(t,gL,e)})}],["cut",br],["copy",br],["dragstart",br],["dragover",br],["dragend",br],["paste",br],["focus",br],["blur",br],["drop",br]];im&&ay.push(["beforeinput",(e,t)=>(function(o,n){let r=o.inputType;r==="deleteCompositionText"||da&&xP(n)||r!=="insertCompositionText"&&we(n,ky,o)})(e,t)]);var pc=0,DL=null,_L=0,Li=null,sy=new WeakMap,gm=new WeakMap,iy=!1,ly=!1,tc=!1,Zd=!1,om=!1,nm="",ds=null,OL=[0,"",0,"root",0];function FL(e,t,o,n,r){let a=e.anchor,s=e.focus,i=a.getNode(),d=mt(),c=An(Jo(d)),u=c!==null?c.anchorNode:null,m=a.key,p=d.getElementByKey(m),f=o.length;return m!==s.key||!ke(i)||(!r&&(!im||_L<n+50)||i.isDirty()&&f<2||gP(o))&&a.offset!==s.offset&&!i.isComposing()||Ir(i)||i.isDirty()&&f>1||(r||!im)&&p!==null&&!i.isComposing()&&u!==gs(p)||c!==null&&t!==null&&(!t.collapsed||t.startContainer!==c.anchorNode||t.startOffset!==c.anchorOffset)||!i.isComposing()&&(i.getFormat()!==e.format||i.getStyle()!==e.style)||(function(g,h){if(h.isSegmented())return!0;if(!g.isCollapsed())return!1;let y=g.anchor.offset,x=h.getParentOrThrow(),C=ia(h);return y===0?!h.canInsertTextBefore()||!x.canInsertTextBefore()&&!h.isComposing()||C||(function(b){let L=b.getPreviousSibling();return(ke(L)||re(L)&&L.isInline())&&!L.canInsertTextAfter()})(h):y===h.getTextContentSize()&&(!h.canInsertTextAfter()||!x.canInsertTextAfter()&&!h.isComposing()||C)})(e,i)}function b0(e,t){return nr(e)&&e.nodeValue!==null&&t!==0&&t!==e.nodeValue.length}function w0(e,t,o){let{anchorNode:n,anchorOffset:r,focusNode:a,focusOffset:s}=e;iy&&(iy=!1,b0(n,r)&&b0(a,s)&&!ds)||or(t,()=>{if(!o)return void $o(null);if(!Cc(t,n,a))return;let i=Je();if(ds&&Oe(i)&&i.isCollapsed()){let d=i.anchor,c=ds.anchor;(d.key===c.key&&d.offset===c.offset+1||d.offset===1&&c.getNode().is(d.getNode().getPreviousSibling()))&&(i=ds.clone(),$o(i))}if(ds=null,Oe(i)){let d=i.anchor,c=d.getNode();if(i.isCollapsed()){e.type==="Range"&&e.anchorNode===e.focusNode&&(i.dirty=!0);let u=Jo(t).event,m=u?u.timeStamp:performance.now(),[p,f,g,h,y]=OL,x=Yo(),C=t.isComposing()===!1&&x.getTextContent()==="";if(m<y+200&&d.offset===g&&d.key===h)rm(i,p,f);else if(d.type==="text")ke(c)||le(141),BL(i,c);else if(d.type==="element"&&!C){re(c)||le(259);let b=d.getNode();b.isEmpty()?(function(L,w){let k=w.getTextFormat(),I=w.getTextStyle();rm(L,k,I)})(i,b):rm(i,0,"")}}else{let u=d.key,m=i.focus.key,p=i.getNodes(),f=p.length,g=i.isBackward(),h=g?s:r,y=g?r:s,x=g?m:u,C=g?u:m,b=2047,L=!1;for(let w=0;w<f;w++){let k=p[w],I=k.getTextContentSize();if(ke(k)&&I!==0&&!(w===0&&k.__key===x&&h===I||w===f-1&&k.__key===C&&y===0)&&(L=!0,b&=k.getFormat(),b===0))break}i.format=L?b:0}}we(t,Sy,void 0)})}function rm(e,t,o){e.format===t&&e.style===o||(e.format=t,e.style=o,e.dirty=!0)}function BL(e,t){rm(e,t.getFormat(),t.getStyle())}function HL(e){if(!e.getTargetRanges)return null;let t=e.getTargetRanges();return t.length===0?null:t[0]}function KK(e){let t=e.inputType,o=HL(e),n=mt(),r=Je();if(t==="deleteContentBackward"){if(r===null){let m=ys();if(!Oe(m))return!0;$o(m.clone())}if(Oe(r)){let m=r.anchor.key===r.focus.key;if(a=e.timeStamp,DL==="MediaLast"&&a<pc+30&&n.isComposing()&&m){if(ro(null),pc=0,setTimeout(()=>{or(n,()=>{ro(null)})},30),Oe(r)){let p=r.anchor.getNode();p.markDirty(),ke(p)||le(142),BL(r,p)}}else{ro(null),e.preventDefault();let p=r.anchor.getNode(),f=p.getTextContent(),g=p.canInsertTextAfter(),h=r.anchor.offset===0&&r.focus.offset===f.length,y=qh&&m&&!h&&g;if(y&&r.isCollapsed()&&(y=!yt(CP(r.anchor,!0))),!y){we(n,dc,!0);let x=Je();qh&&Oe(x)&&x.isCollapsed()&&(ds=x,setTimeout(()=>ds=null))}}return!0}}var a;if(!Oe(r))return!0;let s=e.data;Li!==null&&Vy(!1,n,Li),r.dirty&&Li===null||!r.isCollapsed()||lo(r.anchor.getNode())||o===null||r.applyDOMRange(o),Li=null;let i=r.anchor,d=r.focus,c=i.getNode(),u=d.getNode();if(t==="insertText"||t==="insertTranspose"){if(s===`
3553
- `)e.preventDefault(),we(n,ec,!1);else if(s===Lm)e.preventDefault(),we(n,oy,void 0);else if(s==null&&e.dataTransfer){let m=e.dataTransfer.getData("text/plain");e.preventDefault(),r.insertRawText(m)}else s!=null&&FL(r,o,s,e.timeStamp,!0)?(e.preventDefault(),we(n,Ei,s)):Li=s;return _L=e.timeStamp,!0}switch(e.preventDefault(),t){case"insertFromYank":case"insertFromDrop":case"insertReplacementText":we(n,Ei,e);break;case"insertFromComposition":ro(null),we(n,Ei,e);break;case"insertLineBreak":ro(null),we(n,ec,!1);break;case"insertParagraph":ro(null),tc&&!yc?(tc=!1,we(n,ec,!1)):we(n,oy,void 0);break;case"insertFromPaste":case"insertFromPasteAsQuotation":we(n,Ey,e);break;case"deleteByComposition":(function(m,p){return m!==p||re(m)||re(p)||!ia(m)||!ia(p)})(c,u)&&we(n,ny,e);break;case"deleteByDrag":case"deleteByCut":we(n,ny,e);break;case"deleteContent":we(n,dc,!1);break;case"deleteWordBackward":we(n,cc,!0);break;case"deleteWordForward":we(n,cc,!1);break;case"deleteHardLineBackward":case"deleteSoftLineBackward":we(n,uc,!0);break;case"deleteContentForward":case"deleteHardLineForward":case"deleteSoftLineForward":we(n,uc,!1);break;case"formatStrikeThrough":we(n,aa,"strikethrough");break;case"formatBold":we(n,aa,"bold");break;case"formatItalic":we(n,aa,"italic");break;case"formatUnderline":we(n,aa,"underline");break;case"historyUndo":we(n,My,void 0);break;case"historyRedo":we(n,Ay,void 0)}return!0}function qK(e){if(ko(e.target)&&cP(e.target))return!0;let t=mt(),o=Je(),n=e.data,r=HL(e);if(n!=null&&Oe(o)&&FL(o,r,n,e.timeStamp,!1)){Zd&&(hm(t,n),Zd=!1);let a=o.anchor.getNode(),s=An(Jo(t));if(s===null)return!0;let i=o.isBackward(),d=i?o.anchor.offset:o.focus.offset,c=i?o.focus.offset:o.anchor.offset;im&&!o.isCollapsed()&&ke(a)&&s.anchorNode!==null&&a.getTextContent().slice(0,d)+n+a.getTextContent().slice(d+c)===yP(s.anchorNode)||we(t,Ei,n);let u=n.length;da&&u>1&&e.inputType==="insertCompositionText"&&!t.isComposing()&&(o.anchor.offset-=u),qh&&t.isComposing()&&(pc=0,ro(null))}else Vy(!1,t,n!==null?n:void 0),Zd&&(hm(t,n||void 0),Zd=!1);return(function(){no();let a=mt();iL(a)})(),!0}function WK(e){let t=mt(),o=Je();if(Oe(o)&&!t.isComposing()){let n=o.anchor,r=o.anchor.getNode();ro(n.key),_m(GL),(e.timeStamp<pc+30||n.type==="element"||!o.isCollapsed()||r.getFormat()!==o.format||ke(r)&&r.getStyle()!==o.style)&&we(t,Ei,wy)}return!0}function GK(e){return hm(mt(),e.data),_m(jL),!0}function hm(e,t){let o=e._compositionKey;if(ro(null),o!==null&&t!=null){if(t===""){let n=Vt(o),r=gs(e.getElementByKey(o));if(r!==null&&r.nodeValue!==null&&ke(n)){let a=An(Jo(e)),s=null,i=null;a!==null&&a.anchorNode===r&&(s=a.anchorOffset,i=a.focusOffset),Qy(n,r.nodeValue,s,i,!0)}return}if(t[t.length-1]===`
3554
- `){let n=Je();if(Oe(n)||vc(n)){if(Oe(n)){let r=n.focus;n.anchor.set(r.key,r.offset,r.type)}return void we(e,fm,null)}}}Vy(!0,e,t)}function jK(e){let t=mt();if(e.key==null)return!0;if(om){if(Q0(e))return or(t,()=>{hm(t,nm)}),om=!1,nm="",!0;om=!1,nm=""}if((function(o){return at(o,"ArrowRight",{shiftKey:"any"})})(e))we(t,hL,e);else if((function(o){return at(o,"ArrowRight",Tr)})(e))we(t,yL,e);else if((function(o){return at(o,"ArrowLeft",{shiftKey:"any"})})(e))we(t,vL,e);else if((function(o){return at(o,"ArrowLeft",Tr)})(e))we(t,CL,e);else if((function(o){return at(o,"ArrowUp",{altKey:"any",shiftKey:"any"})})(e))we(t,xL,e);else if((function(o){return at(o,"ArrowDown",{altKey:"any",shiftKey:"any"})})(e))we(t,bL,e);else if((function(o){return at(o,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any",shiftKey:!0})})(e))tc=!0,we(t,fm,e);else if((function(o){return o.key===" "})(e))we(t,wL,e);else if((function(o){return Sn&&at(o,"o",{ctrlKey:!0})})(e))e.preventDefault(),tc=!0,we(t,ec,!0);else if((function(o){return at(o,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any"})})(e))tc=!1,we(t,fm,e);else if((function(o){return at(o,"Backspace",{shiftKey:"any"})||Sn&&at(o,"h",{ctrlKey:!0})})(e))Q0(e)?we(t,TL,e):(e.preventDefault(),we(t,dc,!0));else if((function(o){return o.key==="Escape"})(e))we(t,IL,e);else if((function(o){return at(o,"Delete",{})||Sn&&at(o,"d",{ctrlKey:!0})})(e))(function(o){return o.key==="Delete"})(e)?we(t,SL,e):(e.preventDefault(),we(t,dc,!1));else if((function(o){return at(o,"Backspace",V0)})(e))e.preventDefault(),we(t,cc,!0);else if((function(o){return at(o,"Delete",V0)})(e))e.preventDefault(),we(t,cc,!1);else if((function(o){return Sn&&at(o,"Backspace",{metaKey:!0})})(e))e.preventDefault(),we(t,uc,!0);else if((function(o){return Sn&&(at(o,"Delete",{metaKey:!0})||at(o,"k",{ctrlKey:!0}))})(e))e.preventDefault(),we(t,uc,!1);else if((function(o){return at(o,"b",Tr)})(e))e.preventDefault(),we(t,aa,"bold");else if((function(o){return at(o,"u",Tr)})(e))e.preventDefault(),we(t,aa,"underline");else if((function(o){return at(o,"i",Tr)})(e))e.preventDefault(),we(t,aa,"italic");else if((function(o){return at(o,"Tab",{shiftKey:"any"})})(e))we(t,kL,e);else if((function(o){return at(o,"z",Tr)})(e))e.preventDefault(),we(t,My,void 0);else if((function(o){return Sn?at(o,"z",{metaKey:!0,shiftKey:!0}):at(o,"y",{ctrlKey:!0})||at(o,"z",{ctrlKey:!0,shiftKey:!0})})(e))e.preventDefault(),we(t,Ay,void 0);else{let o=t._editorState._selection;o===null||Oe(o)?X0(e)&&(e.preventDefault(),we(t,ry,e)):(function(n){return at(n,"c",Tr)})(e)?(e.preventDefault(),we(t,Dy,e)):(function(n){return at(n,"x",Tr)})(e)?(e.preventDefault(),we(t,_y,e)):X0(e)&&(e.preventDefault(),we(t,ry,e))}return(function(o){return o.ctrlKey||o.shiftKey||o.altKey||o.metaKey})(e)&&t.dispatchCommand(NL,e),!0}function UL(e){let t=e.__lexicalEventHandles;return t===void 0&&(t=[],e.__lexicalEventHandles=t),t}var Mi=new Map;function $L(e){let t=IP(e.target);if(t===null)return;let o=Wy(t.anchorNode);if(o===null)return;ly&&(ly=!1,or(o,()=>{let d=ys(),c=t.anchorNode;(ko(c)||nr(c))&&$o(Em(d,t,o,e))}));let n=jy(o),r=n[n.length-1],a=r._key,s=Mi.get(a),i=s||r;i!==o&&w0(t,i,!1),w0(t,o,!0),o!==r?Mi.set(a,o):s&&Mi.delete(a)}function T0(e){e._lexicalHandled=!0}function I0(e){return e._lexicalHandled===!0}var S0=()=>{};function VK(e){let t=sy.get(e);if(t===void 0)return void S0();let o=gm.get(t);if(o===void 0)return void S0();let n=o-1;n>=0||le(164),sy.delete(e),gm.set(t,n),n===0&&t.removeEventListener("selectionchange",$L);let r=xc(e);Am(r)?((function(s){if(s._parentEditor!==null){let i=jy(s),d=i[i.length-1]._key;Mi.get(d)===s&&Mi.delete(d)}else Mi.delete(s._key)})(r),e.__lexicalEditor=null):r&&le(198);let a=UL(e);for(let s=0;s<a.length;s++)a[s]();e.__lexicalEventHandles=[]}function dy(e,t,o){no();let n=e.__key,r=e.getParent();if(r===null)return;let a=(function(i){let d=Je();if(!Oe(d)||!re(i))return d;let{anchor:c,focus:u}=d,m=c.getNode(),p=u.getNode();return Tm(m,i)&&c.set(i.__key,0,"element"),Tm(p,i)&&u.set(i.__key,0,"element"),d})(e),s=!1;if(Oe(a)&&t){let i=a.anchor,d=a.focus;i.key===n&&(xm(i,e,r,e.getPreviousSibling(),e.getNextSibling()),s=!0),d.key===n&&(xm(d,e,r,e.getPreviousSibling(),e.getNextSibling()),s=!0)}else vc(a)&&t&&e.isSelected()&&e.selectPrevious();if(Oe(a)&&t&&!s){let i=e.getIndexWithinParent();la(e),Cm(a,r,i,-1)}else la(e);o||pn(r)||r.canBeEmpty()||!r.isEmpty()||dy(r,t),t&&a&&lo(r)&&r.isEmpty()&&r.selectEnd()}function QK(e){return e}var zL=Symbol.for("ephemeral");function ym(e){return e[zL]||!1}var un=class{__type;__key;__parent;__prev;__next;__state;static getType(){let{ownNodeType:t}=Tc(this);return t===void 0&&le(64,this.name),t}static clone(t){le(65,this.name)}$config(){return{}}config(t,o){let n=o.extends||Object.getPrototypeOf(this.constructor);return Object.assign(o,{extends:n,type:t}),{[t]:o}}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}),pP(this,t)}getType(){return this.__type}isInline(){le(137,this.constructor.name)}isAttached(){let t=this.__key;for(;t!==null;){if(t==="root")return!0;let o=Vt(t);if(o===null)break;t=o.__parent}return!1}isSelected(t){let o=t||Je();if(o==null)return!1;let n=o.getNodes().some(r=>r.__key===this.__key);if(ke(this))return n;if(Oe(o)&&o.anchor.type==="element"&&o.focus.type==="element"){if(o.isCollapsed())return!1;let r=this.getParent();if(yt(this)&&this.isInline()&&r){let a=o.isBackward()?o.focus:o.anchor;if(r.is(a.getNode())&&a.offset===r.getChildrenSize()&&this.is(r.getLastChild()))return!1}}return n}getKey(){return this.__key}getIndexWithinParent(){let t=this.getParent();if(t===null)return-1;let o=t.getFirstChild(),n=0;for(;o!==null;){if(this.is(o))return n;n++,o=o.getNextSibling()}return-1}getParent(){let t=this.getLatest().__parent;return t===null?null:Vt(t)}getParentOrThrow(){let t=this.getParent();return t===null&&le(66,this.__key),t}getTopLevelElement(){let t=this;for(;t!==null;){let o=t.getParent();if(pn(o))return re(t)||t===this&&yt(t)||le(194),t;t=o}return null}getTopLevelElementOrThrow(){let t=this.getTopLevelElement();return t===null&&le(67,this.__key),t}getParents(){let t=[],o=this.getParent();for(;o!==null;)t.push(o),o=o.getParent();return t}getParentKeys(){let t=[],o=this.getParent();for(;o!==null;)t.push(o.__key),o=o.getParent();return t}getPreviousSibling(){let t=this.getLatest().__prev;return t===null?null:Vt(t)}getPreviousSiblings(){let t=[],o=this.getParent();if(o===null)return t;let n=o.getFirstChild();for(;n!==null&&!n.is(this);)t.push(n),n=n.getNextSibling();return t}getNextSibling(){let t=this.getLatest().__next;return t===null?null:Vt(t)}getNextSiblings(){let t=[],o=this.getNextSibling();for(;o!==null;)t.push(o),o=o.getNextSibling();return t}getCommonAncestor(t){let o=re(this)?this:this.getParent(),n=re(t)?t:t.getParent(),r=o&&n?rc(o,n):null;return r?r.commonAncestor:null}is(t){return t!=null&&this.__key===t.__key}isBefore(t){let o=rc(this,t);return o!==null&&(o.type==="descendant"||(o.type==="branch"?sv(o)===-1:(o.type!=="same"&&o.type!=="ancestor"&&le(279),!1)))}isParentOf(t){let o=rc(this,t);return o!==null&&o.type==="ancestor"}getNodesBetween(t){let o=this.isBefore(t),n=[],r=new Set,a=this;for(;a!==null;){let s=a.__key;if(r.has(s)||(r.add(s),n.push(a)),a===t)break;let i=re(a)?o?a.getFirstChild():a.getLastChild():null;if(i!==null){a=i;continue}let d=o?a.getNextSibling():a.getPreviousSibling();if(d!==null){a=d;continue}let c=a.getParentOrThrow();if(r.has(c.__key)||n.push(c),c===t)break;let u=null,m=c;do{if(m===null&&le(68),u=o?m.getNextSibling():m.getPreviousSibling(),m=m.getParent(),m===null)break;u!==null||r.has(m.__key)||n.push(m)}while(u===null);a=u}return o||n.reverse(),n}isDirty(){let t=mt()._dirtyLeaves;return t!==null&&t.has(this.__key)}getLatest(){if(ym(this))return this;let t=Vt(this.__key);return t===null&&le(113),t}getWritable(){if(ym(this))return this;no();let t=Er(),o=mt(),n=t._nodeMap,r=this.__key,a=this.getLatest(),s=o._cloneNotNeeded,i=Je();if(i!==null&&i.setCachedNodes(null),s.has(r))return wm(a),a;let d=tv(a);return s.add(r),wm(d),n.set(r,d),d}getTextContent(){return""}getTextContentSize(){return this.getTextContent().length}createDOM(t,o){le(70)}updateDOM(t,o,n){le(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){le(18,this.name)}updateFromJSON(t){return(function(o,n){let r=o.getWritable(),a=n.$,s=a;for(let i of cL(r).flatKeys)i in n&&(s!==void 0&&s!==a||(s={...a}),s[i]=n[i]);return(r.__state||s)&&Iy(o).updateFromJSON(s),r})(this,t)}static transform(){return null}remove(t){dy(this,!0,t)}replace(t,o){no();let n=Je();n!==null&&(n=n.clone()),$h(this,t);let r=this.getLatest(),a=this.__key,s=t.__key,i=t.getWritable(),d=this.getParentOrThrow().getWritable(),c=d.__size;la(i);let u=r.getPreviousSibling(),m=r.getNextSibling(),p=r.__prev,f=r.__next,g=r.__parent;if(dy(r,!1,!0),u===null?d.__first=s:u.getWritable().__next=s,i.__prev=p,m===null?d.__last=s:m.getWritable().__prev=s,i.__next=f,i.__parent=g,d.__size=c,o&&(re(this)&&re(i)||le(139),this.getChildren().forEach(h=>{i.append(h)})),Oe(n)){$o(n);let h=n.anchor,y=n.focus;h.key===a&&R0(h,i),y.key===a&&R0(y,i)}return sa()===a&&ro(s),i}insertAfter(t,o=!0){no(),$h(this,t);let n=this.getWritable(),r=t.getWritable(),a=r.getParent(),s=Je(),i=!1,d=!1;if(a!==null){let f=t.getIndexWithinParent();if(la(r),Oe(s)){let g=a.__key,h=s.anchor,y=s.focus;i=h.type==="element"&&h.key===g&&h.offset===f+1,d=y.type==="element"&&y.key===g&&y.offset===f+1}}let c=this.getNextSibling(),u=this.getParentOrThrow().getWritable(),m=r.__key,p=n.__next;if(c===null?u.__last=m:c.getWritable().__prev=m,u.__size++,n.__next=m,r.__next=p,r.__prev=n.__key,r.__parent=n.__parent,o&&Oe(s)){let f=this.getIndexWithinParent();Cm(s,u,f+1);let g=u.__key;i&&s.anchor.set(g,f+2,"element"),d&&s.focus.set(g,f+2,"element")}return t}insertBefore(t,o=!0){no(),$h(this,t);let n=this.getWritable(),r=t.getWritable(),a=r.__key;la(r);let s=this.getPreviousSibling(),i=this.getParentOrThrow().getWritable(),d=n.__prev,c=this.getIndexWithinParent();s===null?i.__first=a:s.getWritable().__next=a,i.__size++,n.__prev=a,r.__prev=d,r.__next=n.__key,r.__parent=n.__parent;let u=Je();return o&&Oe(u)&&Cm(u,this.getParentOrThrow(),c),t}isParentRequired(){return!1}createParentElementNode(){return Lr()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(t,o){no();let n=this.getPreviousSibling(),r=this.getParentOrThrow();if(n===null)return r.select(0,0);if(re(n))return n.select();if(!ke(n)){let a=n.getIndexWithinParent()+1;return r.select(a,a)}return n.select(t,o)}selectNext(t,o){no();let n=this.getNextSibling(),r=this.getParentOrThrow();if(n===null)return r.select();if(re(n))return n.select(0,0);if(!ke(n)){let a=n.getIndexWithinParent();return r.select(a,a)}return n.select(t,o)}markDirty(){this.getWritable()}reconcileObservedMutation(t,o){this.markDirty()}},XK="historic",YK="history-push",am="history-merge",JK="paste",KL="collaboration",ZK="skip-collab",qL="skip-scroll-into-view",WL="skip-dom-selection",cy="skip-selection-focus",GL="composition-start",jL="composition-end",Ni=class e extends un{static getType(){return"linebreak"}static clone(t){return new e(t.__key)}constructor(t){super(t)}getTextContent(){return`
3555
- `}createDOM(){return document.createElement("br")}updateDOM(){return!1}isInline(){return!0}static importDOM(){return{br:t=>(function(o){let n=o.parentElement;if(n!==null&&hy(n)){let r=n.firstChild;if(r===o||r.nextSibling===o&&Yp(r)){let a=n.lastChild;if(a===o||a.previousSibling===o&&Yp(a))return!0}}return!1})(t)||(function(o){let n=o.parentElement;if(n!==null&&hy(n)){let r=n.firstChild;if(r===o||r.nextSibling===o&&Yp(r))return!1;let a=n.lastChild;if(a===o||a.previousSibling===o&&Yp(a))return!0}return!1})(t)?null:{conversion:e5,priority:0}}}static importJSON(t){return Di().updateFromJSON(t)}};function e5(e){return{node:Di()}}function Di(){return wc(new Ni)}function cs(e){return e instanceof Ni}function Yp(e){return nr(e)&&/^( |\t|\r?\n)+$/.test(e.textContent||"")}function Oh(e,t){return 16&t?"code":t&by?"mark":32&t?"sub":64&t?"sup":null}function Fh(e,t){return 1&t?"strong":2&t?"em":"span"}function VL(e,t,o,n,r){let a=n.classList,s=Ai(r,"base");s!==void 0&&a.add(...s),s=Ai(r,"underlineStrikethrough");let i=!1,d=8&t&&4&t;s!==void 0&&(8&o&&4&o?(i=!0,d||a.add(...s)):d&&a.remove(...s));for(let c in xo){let u=xo[c];if(s=Ai(r,c),s!==void 0)if(o&u){if(i&&(c==="underline"||c==="strikethrough")){t&u&&a.remove(...s);continue}((t&u)===0||d&&c==="underline"||c==="strikethrough")&&a.add(...s)}else t&u&&a.remove(...s)}}function QL(e,t,o){let n=t.firstChild,r=o.isComposing(),a=e+(r?sc:"");if(n==null)t.textContent=a;else{let s=n.nodeValue;if(s!==a)if(r||da){let[i,d,c]=(function(u,m){let p=u.length,f=m.length,g=0,h=0;for(;g<p&&g<f&&u[g]===m[g];)g++;for(;h+g<p&&h+g<f&&u[p-h-1]===m[f-h-1];)h++;return[g,p-g-h,m.slice(g,f-h)]})(s,a);d!==0&&n.deleteData(i,d),n.insertData(i,c)}else n.nodeValue=a}}function k0(e,t,o,n,r,a){QL(r,e,t);let s=a.theme.text;s!==void 0&&VL(0,0,n,e,s)}function Jp(e,t){let o=document.createElement(t);return o.appendChild(e),o}var ms=class e extends un{__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="",o){super(o),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 bK[t.__mode]}getStyle(){return this.getLatest().__style}isToken(){return this.getLatest().__mode===1}isComposing(){return this.__key===sa()}isSegmented(){return this.getLatest().__mode===2}isDirectionless(){return!!(1&this.getLatest().__detail)}isUnmergeable(){return!!(2&this.getLatest().__detail)}hasFormat(t){let o=xo[t];return(this.getFormat()&o)!==0}isSimpleText(){return this.__type==="text"&&this.__mode===0}getTextContent(){return this.getLatest().__text}getFormatFlags(t,o){return gc(this.getLatest().__format,t,o)}canHaveFormat(){return!0}isInline(){return!0}createDOM(t,o){let n=this.__format,r=Oh(0,n),a=Fh(0,n),s=r===null?a:r,i=document.createElement(s),d=i;this.hasFormat("code")&&i.setAttribute("spellcheck","false"),r!==null&&(d=document.createElement(a),i.appendChild(d)),k0(d,this,0,n,this.__text,t);let c=this.__style;return c!==""&&(i.style.cssText=c),i}updateDOM(t,o,n){let r=this.__text,a=t.__format,s=this.__format,i=Oh(0,a),d=Oh(0,s),c=Fh(0,a),u=Fh(0,s);if((i===null?c:i)!==(d===null?u:d))return!0;if(i===d&&c!==u){let h=o.firstChild;h==null&&le(48);let y=document.createElement(u);return k0(y,this,0,s,r,n),o.replaceChild(y,h),!1}let m=o;d!==null&&i!==null&&(m=o.firstChild,m==null&&le(49)),QL(r,m,this);let p=n.theme.text;p!==void 0&&a!==s&&VL(0,a,s,m,p);let f=t.__style,g=this.__style;return f!==g&&(o.style.cssText=g),!1}static importDOM(){return{"#text":()=>({conversion:r5,priority:0}),b:()=>({conversion:o5,priority:0}),code:()=>({conversion:wr,priority:0}),em:()=>({conversion:wr,priority:0}),i:()=>({conversion:wr,priority:0}),mark:()=>({conversion:wr,priority:0}),s:()=>({conversion:wr,priority:0}),span:()=>({conversion:t5,priority:0}),strong:()=>({conversion:wr,priority:0}),sub:()=>({conversion:wr,priority:0}),sup:()=>({conversion:wr,priority:0}),u:()=>({conversion:wr,priority:0})}}static importJSON(t){return oo().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:o}=super.exportDOM(t);return ko(o)||le(132),o.style.whiteSpace="pre-wrap",this.hasFormat("lowercase")?o.style.textTransform="lowercase":this.hasFormat("uppercase")?o.style.textTransform="uppercase":this.hasFormat("capitalize")&&(o.style.textTransform="capitalize"),this.hasFormat("bold")&&(o=Jp(o,"b")),this.hasFormat("italic")&&(o=Jp(o,"i")),this.hasFormat("strikethrough")&&(o=Jp(o,"s")),this.hasFormat("underline")&&(o=Jp(o,"u")),{element:o}}exportJSON(){return{detail:this.getDetail(),format:this.getFormat(),mode:this.getMode(),style:this.getStyle(),text:this.getTextContent(),...super.exportJSON()}}selectionTransform(t,o){}setFormat(t){let o=this.getWritable();return o.__format=typeof t=="string"?xo[t]:t,o}setDetail(t){let o=this.getWritable();return o.__detail=typeof t=="string"?vK[t]:t,o}setStyle(t){let o=this.getWritable();return o.__style=t,o}toggleFormat(t){let o=gc(this.getFormat(),t,null);return this.setFormat(o)}toggleDirectionless(){let t=this.getWritable();return t.__detail^=1,t}toggleUnmergeable(){let t=this.getWritable();return t.__detail^=2,t}setMode(t){let o=xK[t];if(this.__mode===o)return this;let n=this.getWritable();return n.__mode=o,n}setTextContent(t){if(this.__text===t)return this;let o=this.getWritable();return o.__text=t,o}select(t,o){no();let n=t,r=o,a=Je(),s=this.getTextContent(),i=this.__key;if(typeof s=="string"){let d=s.length;n===void 0&&(n=d),r===void 0&&(r=d)}else n=0,r=0;if(!Oe(a))return JL(i,n,i,r,"text","text");{let d=sa();d!==a.anchor.key&&d!==a.focus.key||ro(i),a.setTextNodeRange(this,n,this,r)}return a}selectStart(){return this.select(0,0)}selectEnd(){let t=this.getTextContentSize();return this.select(t,t)}spliceText(t,o,n,r){let a=this.getWritable(),s=a.__text,i=n.length,d=t;d<0&&(d=i+d,d<0&&(d=0));let c=Je();if(r&&Oe(c)){let m=t+i;c.setTextNodeRange(a,m,a,m)}let u=s.slice(0,d)+n+s.slice(d+o);return a.__text=u,a}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...t){no();let o=this.getLatest(),n=o.getTextContent();if(n==="")return[];let r=o.__key,a=sa(),s=n.length;t.sort((T,S)=>T-S),t.push(s);let i=[],d=t.length;for(let T=0,S=0;T<s&&S<=d;S++){let P=t[S];P>T&&(i.push(n.slice(T,P)),T=P)}let c=i.length;if(c===1)return[o];let u=i[0],m=o.getParent(),p,f=o.getFormat(),g=o.getStyle(),h=o.__detail,y=!1,x=null,C=null,b=Je();if(Oe(b)){let[T,S]=b.isBackward()?[b.focus,b.anchor]:[b.anchor,b.focus];T.type==="text"&&T.key===r&&(x=T),S.type==="text"&&S.key===r&&(C=S)}o.isSegmented()?(p=oo(u),p.__format=f,p.__style=g,p.__detail=h,p.__state=f0(o,p),y=!0):p=o.setTextContent(u);let L=[p];for(let T=1;T<c;T++){let S=oo(i[T]);S.__format=f,S.__style=g,S.__detail=h,S.__state=f0(o,S);let P=S.__key;a===r&&ro(P),L.push(S)}let w=x?x.offset:null,k=C?C.offset:null,I=0;for(let T of L){if(!x&&!C)break;let S=I+T.getTextContentSize();if(x!==null&&w!==null&&w<=S&&w>=I&&(x.set(T.getKey(),w-I,"text"),w<S&&(x=null)),C!==null&&k!==null&&k<=S&&k>=I){C.set(T.getKey(),k-I,"text");break}I=S}if(m!==null){(function(P){let A=P.getPreviousSibling(),N=P.getNextSibling();A!==null&&wm(A),N!==null&&wm(N)})(this);let T=m.getWritable(),S=this.getIndexWithinParent();y?(T.splice(S,0,L),this.remove()):T.splice(S,1,L),Oe(b)&&Cm(b,m,S,c-1)}return L}mergeWithSibling(t){let o=t===this.getPreviousSibling();o||t===this.getNextSibling()||le(50);let n=this.__key,r=t.__key,a=this.__text,s=a.length;sa()===r&&ro(n);let i=Je();if(Oe(i)){let m=i.anchor,p=i.focus;m!==null&&m.key===r&&O0(m,o,n,t,s),p!==null&&p.key===r&&O0(p,o,n,t,s)}let d=t.__text,c=o?d+a:a+d;this.setTextContent(c);let u=this.getWritable();return t.remove(),u}isTextEntity(){return!1}};function t5(e){return{forChild:Oy(e.style),node:null}}function o5(e){let t=e,o=t.style.fontWeight==="normal";return{forChild:Oy(t.style,o?void 0:"bold"),node:null}}var L0=new WeakMap;function n5(e){if(!ko(e))return!1;if(e.nodeName==="PRE")return!0;let t=e.style.whiteSpace;return typeof t=="string"&&t.startsWith("pre")}function r5(e){let t=e;e.parentElement===null&&le(129);let o=t.textContent||"";if((function(n){let r,a=n.parentNode,s=[n];for(;a!==null&&(r=L0.get(a))===void 0&&!n5(a);)s.push(a),a=a.parentNode;let i=r===void 0?a:r;for(let d=0;d<s.length;d++)L0.set(s[d],i);return i})(t)!==null){let n=o.split(/(\r?\n|\t)/),r=[],a=n.length;for(let s=0;s<a;s++){let i=n[s];i===`
3552
+ `,wy=da?"\xA0":sc,aL="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",sL="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",CK=new RegExp("^[^"+sL+"]*["+aL+"]"),xK=new RegExp("^[^"+aL+"]*["+sL+"]"),Co={bold:1,capitalize:1024,code:16,highlight:by,italic:2,lowercase:256,strikethrough:4,subscript:32,superscript:64,underline:8,uppercase:512},bK={directionless:1,unmergeable:2},Wh={center:2,end:6,justify:4,left:1,right:3,start:5},wK={[fK]:"center",[vK]:"end",[hK]:"justify",[mK]:"left",[gK]:"right",[yK]:"start"},TK={normal:0,segmented:2,token:1},IK={[oK]:"normal",[rK]:"segmented",[nK]:"token"},SK="$",p0="$config";function iL(e,t,o,n,r,a){let s=e.getFirstChild();for(;s!==null;){let i=s.__key;s.__parent===t&&(re(s)&&iL(s,i,o,n,r,a),o.has(i)||a.delete(i),r.push(i)),s=s.getNextSibling()}}var Gh=!1,Ty=0;function kK(e){Ty=e.timeStamp}function Dh(e,t,o){let n=e.nodeName==="BR",r=t.__lexicalLineBreak;return r&&(e===r||n&&e.previousSibling===r)||n&&Nm(e,o)!==void 0}function LK(e,t,o){let n=An(Yo(o)),r=null,a=null;n!==null&&n.anchorNode===e&&(r=n.anchorOffset,a=n.focusOffset);let s=e.nodeValue;s!==null&&Qy(t,s,r,a,!1)}function PK(e,t,o){if(Oe(e)){let n=e.anchor.getNode();if(n.is(o)&&e.format!==n.getFormat())return!1}return nr(t)&&o.isAttached()}function RK(e,t,o,n){for(let r=e;r&&!EP(r);r=bc(r)){let a=Nm(r,t);if(a!==void 0){let s=Vt(a,o);if(s)return yt(s)||!ko(r)?void 0:[r,s]}else if(r===n)return[n,hP(o)]}}function lL(e,t,o){Gh=!0;let n=performance.now()-Ty>100;try{or(e,()=>{let r=Je()||(function(p){return p.getEditorState().read(()=>{let f=Je();return f!==null?f.clone():null})})(e),a=new Map,s=e.getRootElement(),i=e._editorState,d=e._blockCursorElement,c=!1,u="";for(let p=0;p<t.length;p++){let f=t[p],g=f.type,h=f.target,y=RK(h,e,i,s);if(!y)continue;let[x,C]=y;if(g==="characterData")n&&ke(C)&&nr(h)&&PK(r,h,C)&&LK(h,C,e);else if(g==="childList"){c=!0;let b=f.addedNodes;for(let k=0;k<b.length;k++){let I=b[k],T=Gy(I),S=I.parentNode;if(S!=null&&I!==d&&T===null&&!Dh(I,S,e)){if(da){let P=(ko(I)?I.innerText:null)||I.nodeValue;P&&(u+=P)}S.removeChild(I)}}let L=f.removedNodes,w=L.length;if(w>0){let k=0;for(let I=0;I<w;I++){let T=L[I];(Dh(T,h,e)||d===T)&&(h.appendChild(T),k++)}w!==k&&a.set(x,C)}}}if(a.size>0)for(let[p,f]of a)f.reconcileObservedMutation(p,e);let m=o.takeRecords();if(m.length>0){for(let p=0;p<m.length;p++){let f=m[p],g=f.addedNodes,h=f.target;for(let y=0;y<g.length;y++){let x=g[y],C=x.parentNode;C==null||x.nodeName!=="BR"||Dh(x,h,e)||C.removeChild(x)}}o.takeRecords()}r!==null&&(c&&$o(r),da&&wP(e)&&r.insertRawText(u))})}finally{Gh=!1}}function dL(e){let t=e._observer;t!==null&&lL(e,t.takeRecords(),t)}function cL(e){(function(t){Ty===0&&Yo(t).addEventListener("textInput",kK,!0)})(e),e._observer=new MutationObserver((t,o)=>{lL(e,t,o)})}var jh=class{key;parse;unparse;isEqual;defaultValue;constructor(t,o){this.key=t,this.parse=o.parse.bind(o),this.unparse=(o.unparse||NK).bind(o),this.isEqual=(o.isEqual||Object.is).bind(o),this.defaultValue=this.parse(void 0)}};function EK(e,t){return new jh(e,t)}function lm(e,t,o="latest"){let n=(o==="latest"?e.getLatest():e).__state;return n?n.getValue(t):t.defaultValue}function MK(e,t,o){let n=lm(e,o,"direct"),r=lm(t,o,"direct");return o.isEqual(n,r)?null:[n,r]}function AK(e,t,o){let n;if(no(),typeof o=="function"){let a=e.getLatest(),s=lm(a,t);if(n=o(s),t.isEqual(s,n))return a}else n=o;let r=e.getWritable();return Iy(r).updateFromKnown(t,n),r}function uL(e){let t=new Map,o=new Set;for(let n=typeof e=="function"?e:e.replace;n.prototype&&n.prototype.getType!==void 0;n=Object.getPrototypeOf(n)){let{ownNodeConfig:r}=Tc(n);if(r&&r.stateConfigs)for(let a of r.stateConfigs){let s;"stateConfig"in a?(s=a.stateConfig,a.flat&&o.add(s.key)):s=a,t.set(s.key,s)}}return{flatKeys:o,sharedConfigMap:t}}var Vh=class e{node;knownState;unknownState;sharedNodeState;size;constructor(t,o,n=void 0,r=new Map,a=void 0){this.node=t,this.sharedNodeState=o,this.unknownState=n,this.knownState=r;let{sharedConfigMap:s}=this.sharedNodeState,i=a!==void 0?a:(function(d,c,u){let m=u.size;if(c)for(let p in c){let f=d.get(p);f&&u.has(f)||m++}return m})(s,n,r);this.size=i}getValue(t){let o=this.knownState.get(t);if(o!==void 0)return o;this.sharedNodeState.sharedConfigMap.set(t.key,t);let n=t.defaultValue;if(this.unknownState&&t.key in this.unknownState){let r=this.unknownState[t.key];r!==void 0&&(n=t.parse(r)),this.updateFromKnown(t,n)}return n}getInternalState(){return[this.unknownState,this.knownState]}toJSON(){let t={...this.unknownState},o={};for(let[n,r]of this.knownState)n.isEqual(r,n.defaultValue)?delete t[n.key]:t[n.key]=n.unparse(r);for(let n of this.sharedNodeState.flatKeys)n in t&&(o[n]=t[n],delete t[n]);return m0(t)&&(o.$=t),o}getWritable(t){if(this.node===t)return this;let{sharedNodeState:o,unknownState:n}=this,r=new Map(this.knownState);return new e(t,o,(function(a,s,i){let d;if(i)for(let[c,u]of Object.entries(i)){let m=a.get(c);m?s.has(m)||s.set(m,m.parse(u)):(d=d||{},d[c]=u)}return d})(o.sharedConfigMap,r,n),r,this.size)}updateFromKnown(t,o){let n=t.key;this.sharedNodeState.sharedConfigMap.set(n,t);let{knownState:r,unknownState:a}=this;r.has(t)||a&&n in a||(a&&(delete a[n],this.unknownState=m0(a)),this.size++),r.set(t,o)}updateFromUnknown(t,o){let n=this.sharedNodeState.sharedConfigMap.get(t);n?this.updateFromKnown(n,n.parse(o)):(this.unknownState=this.unknownState||{},t in this.unknownState||this.size++,this.unknownState[t]=o)}updateFromJSON(t){let{knownState:o}=this;for(let n of o.keys())o.set(n,n.defaultValue);if(this.size=o.size,this.unknownState=void 0,t)for(let[n,r]of Object.entries(t))this.updateFromUnknown(n,r)}};function Iy(e){let t=e.getWritable(),o=t.__state?t.__state.getWritable(t):new Vh(t,pL(t));return t.__state=o,o}function pL(e){return e.__state?e.__state.sharedNodeState:zy(ev(),e.getType()).sharedNodeState}function m0(e){if(e)for(let t in e)return e}function NK(e){return e}function f0(e,t,o){for(let[n,r]of t.knownState){if(e.has(n.key))continue;e.add(n.key);let a=o?o.getValue(n):n.defaultValue;if(a!==r&&!n.isEqual(a,r))return!0}return!1}function g0(e,t,o){let{unknownState:n}=t,r=o?o.unknownState:void 0;if(n){for(let[a,s]of Object.entries(n))if(!e.has(a)&&(e.add(a),s!==(r?r[a]:void 0)))return!0}return!1}function h0(e,t){let o=e.__state;return o&&o.node===e?o.getWritable(t):o}function y0(e,t){let o=e.__mode,n=e.__format,r=e.__style,a=t.__mode,s=t.__format,i=t.__style,d=e.__state,c=t.__state;return(o===null||o===a)&&(n===null||n===s)&&(r===null||r===i)&&(e.__state===null||d===c||(function(u,m){if(u===m)return!0;if(u&&m&&u.size!==m.size)return!1;let p=new Set;return!(u&&f0(p,u,m)||m&&f0(p,m,u)||u&&g0(p,u,m)||m&&g0(p,m,u))})(d,c))}function v0(e,t){let o=e.mergeWithSibling(t),n=mt()._normalizedNodes;return n.add(e.__key),n.add(t.__key),o}function C0(e){let t,o,n=e;if(n.__text!==""||!n.isSimpleText()||n.isUnmergeable()){for(;(t=n.getPreviousSibling())!==null&&ke(t)&&t.isSimpleText()&&!t.isUnmergeable();){if(t.__text!==""){if(y0(t,n)){n=v0(t,n);break}break}t.remove()}for(;(o=n.getNextSibling())!==null&&ke(o)&&o.isSimpleText()&&!o.isUnmergeable();){if(o.__text!==""){if(y0(n,o)){n=v0(n,o);break}break}o.remove()}}else n.remove()}function dm(e){return x0(e.anchor),x0(e.focus),e}function x0(e){for(;e.type==="element";){let t=e.getNode(),o=e.offset,n,r;if(o===t.getChildrenSize()?(n=t.getChildAtIndex(o-1),r=!0):(n=t.getChildAtIndex(o),r=!1),ke(n)){e.set(n.__key,r?n.getTextContentSize():0,"text",!0);break}if(!re(n))break;e.set(n.__key,r?n.getChildrenSize():0,"element",!0)}}var us,co,ic,Pm,Qh,Xh,ps,Ln,Yh,lc,jt="",tr=null,ls=null,ki=!1,cm=!1;function um(e,t){let o=ps.get(e);if(t!==null){let n=ty(e);n.parentNode===t&&t.removeChild(n)}if(Ln.has(e)||co._keyToDOMMap.delete(e),re(o)){let n=mm(o,ps);Jh(n,0,n.length-1,null)}o!==void 0&&Xy(lc,ic,Pm,o,"destroyed")}function Jh(e,t,o,n){for(let r=t;r<=o;++r){let a=e[r];a!==void 0&&um(a,n)}}function is(e,t){e.setProperty("text-align",t)}var DK="40px";function mL(e,t){let o=us.theme.indent;if(typeof o=="string"){let r=e.classList.contains(o);t>0&&!r?e.classList.add(o):t<1&&r&&e.classList.remove(o)}if(t===0)return void e.style.setProperty("padding-inline-start","");let n=getComputedStyle(co._rootElement||e).getPropertyValue("--lexical-indent-base-value")||DK;e.style.setProperty("padding-inline-start",`calc(${t} * ${n})`)}function fL(e,t){let o=e.style;t===0?is(o,""):t===1?is(o,"left"):t===2?is(o,"center"):t===3?is(o,"right"):t===4?is(o,"justify"):t===5?is(o,"start"):t===6&&is(o,"end")}function Zh(e,t){let o=(function(n){let r=n.__dir;if(r!==null)return r;if(lo(n))return null;let a=n.getParentOrThrow();return lo(a)&&a.__dir===null?"auto":null})(t);o!==null?e.dir=o:e.removeAttribute("dir")}function pm(e,t){let o=Ln.get(e);o===void 0&&le(60);let n=o.createDOM(us,co);if((function(r,a,s){let i=s._keyToDOMMap;(function(d,c,u){let m=`__lexicalKey_${c._key}`;d[m]=u})(a,s,r),i.set(r,a)})(e,n,co),ke(o)?n.setAttribute("data-lexical-text","true"):yt(o)&&n.setAttribute("data-lexical-decorator","true"),re(o)){let r=o.__indent,a=o.__size;if(Zh(n,o),r!==0&&mL(n,r),a!==0){let i=a-1;ey(mm(o,Ln),o,0,i,o.getDOMSlot(n))}let s=o.__format;s!==0&&fL(n,s),o.isInline()||gL(null,o,n)}else{let r=o.getTextContent();if(yt(o)){let a=o.decorate(co,us);a!==null&&hL(e,a),n.contentEditable="false"}jt+=r}return t!==null&&t.insertChild(n),Xy(lc,ic,Pm,o,"created"),n}function ey(e,t,o,n,r){let a=jt;jt="";let s=o;for(;s<=n;++s){pm(e[s],r);let i=Ln.get(e[s]);i!==null&&ke(i)?tr===null&&(tr=i.getFormat(),ls=i.getStyle()):re(i)&&s<n&&!i.isInline()&&(jt+=Lm)}r.element.__lexicalTextContent=jt,jt=a+jt}function b0(e,t){if(e){let o=e.__last;if(o){let n=t.get(o);if(n)return cs(n)?"line-break":yt(n)&&n.isInline()?"decorator":null}return"empty"}return null}function gL(e,t,o){let n=b0(e,ps),r=b0(t,Ln);n!==r&&t.getDOMSlot(o).setManagedLineBreak(r)}function _K(e,t,o){var n;tr=null,ls=null,(function(r,a,s){let i=jt,d=r.__size,c=a.__size;jt="";let u=s.element;if(d===1&&c===1){let m=r.__first,p=a.__first;if(m===p)tm(m,u);else{let g=ty(m),h=pm(p,null);try{u.replaceChild(h,g)}catch(y){if(typeof y=="object"&&y!=null){let x=`${y.toString()} Parent: ${u.tagName}, new child: {tag: ${h.tagName} key: ${p}}, old child: {tag: ${g.tagName}, key: ${m}}.`;throw new Error(x)}throw y}um(m,null)}let f=Ln.get(p);ke(f)&&tr===null&&(tr=f.getFormat(),ls=f.getStyle())}else{let m=mm(r,ps),p=mm(a,Ln);if(m.length!==d&&le(227),p.length!==c&&le(228),d===0)c!==0&&ey(p,0,0,c-1,s);else if(c===0){if(d!==0){let f=s.after==null&&s.before==null&&s.element.__lexicalLineBreak==null;Jh(m,0,d-1,f?null:u),f&&(u.textContent="")}}else(function(f,g,h,y,x,C){let b=y-1,L=x-1,w,k,I=C.getFirstChild(),T=0,S=0;for(;T<=b&&S<=L;){let N=g[T],B=h[S];if(N===B)I=_h(tm(B,C.element)),T++,S++;else{if(k===void 0&&(k=w0(h,S)),w===void 0)w=w0(g,T);else if(!w.has(N)){T++;continue}if(!k.has(N)){I=_h(ty(N)),um(N,C.element),T++,w.delete(N);continue}if(w.has(B)){let j=Bi(co,B);j!==I&&C.withBefore(I).insertChild(j),I=_h(tm(B,C.element)),T++,S++}else pm(B,C.withBefore(I)),S++}let O=Ln.get(B);O!==null&&ke(O)?tr===null&&(tr=O.getFormat(),ls=O.getStyle()):re(O)&&S<=L&&!O.isInline()&&(jt+=Lm)}let P=T>b,A=S>L;if(P&&!A){let N=h[L+1],B=N===void 0?null:co.getElementByKey(N);ey(h,0,S,L,C.withBefore(B))}else A&&!P&&Jh(g,T,b,C.element)})(0,m,p,d,c,s)}u.__lexicalTextContent=jt,jt=i+jt})(e,t,t.getDOMSlot(o)),n=t,tr==null||tr===n.__textFormat||cm||n.setTextFormat(tr),(function(r){ls==null||ls===r.__textStyle||cm||r.setTextStyle(ls)})(t)}function mm(e,t){let o=[],n=e.__first;for(;n!==null;){let r=t.get(n);r===void 0&&le(101),o.push(n),n=r.__next}return o}function tm(e,t){let o=ps.get(e),n=Ln.get(e);o!==void 0&&n!==void 0||le(61);let r=ki||Xh.has(e)||Qh.has(e),a=Bi(co,e);if(o===n&&!r){let s;if(re(o)){let i=a.__lexicalTextContent;typeof i=="string"?s=i:(s=o.getTextContent(),a.__lexicalTextContent=s)}else s=o.getTextContent();return jt+=s,a}if(o!==n&&r&&Xy(lc,ic,Pm,n,"updated"),n.updateDOM(o,a,us)){let s=pm(e,null);return t===null&&le(62),t.replaceChild(s,a),um(e,null),s}if(re(o)){re(n)||le(334,e);let s=n.__indent;(ki||s!==o.__indent)&&mL(a,s);let i=n.__format;if((ki||i!==o.__format)&&fL(a,i),r)_K(o,n,a),lo(n)||n.isInline()||gL(o,n,a);else{let d=a.__lexicalTextContent,c;typeof d=="string"?c=d:(c=o.getTextContent(),a.__lexicalTextContent=c),jt+=c}if((ki||n.__dir!==o.__dir)&&(Zh(a,n),lo(n)&&!ki))for(let d of n.getChildren())re(d)&&Zh(Bi(co,d.getKey()),d)}else{let s=n.getTextContent();if(yt(n)){let i=n.decorate(co,us);i!==null&&hL(e,i)}jt+=s}if(!cm&&lo(n)&&n.__cachedText!==jt){let s=n.getWritable();s.__cachedText=jt,n=s}return a}function hL(e,t){let o=co._pendingDecorators,n=co._decorators;if(o===null){if(n[e]===t)return;o=gP(co)}o[e]=t}function _h(e){let t=e.nextSibling;return t!==null&&t===co._blockCursorElement&&(t=t.nextSibling),t}function w0(e,t){let o=new Set;for(let n=t;n<e.length;n++)o.add(e[n]);return o}function OK(e,t,o,n,r,a){jt="",ki=n===2,co=o,us=o._config,ic=o._nodes,Pm=co._listeners.mutation,Qh=r,Xh=a,ps=e._nodeMap,Ln=t._nodeMap,cm=t._readOnly,Yh=new Map(o._keyToDOMMap);let s=new Map;return lc=s,tm("root",null),co=void 0,ic=void 0,Qh=void 0,Xh=void 0,ps=void 0,Ln=void 0,us=void 0,Yh=void 0,lc=void 0,s}function ty(e){let t=Yh.get(e);return t===void 0&&le(75,e),t}function He(e){return{type:e}}var Sy=He("SELECTION_CHANGE_COMMAND"),FK=He("SELECTION_INSERT_CLIPBOARD_NODES_COMMAND"),yL=He("CLICK_COMMAND"),ky=He("BEFORE_INPUT_COMMAND"),Ly=He("INPUT_COMMAND"),Py=He("COMPOSITION_START_COMMAND"),Ry=He("COMPOSITION_END_COMMAND"),dc=He("DELETE_CHARACTER_COMMAND"),ec=He("INSERT_LINE_BREAK_COMMAND"),oy=He("INSERT_PARAGRAPH_COMMAND"),Ei=He("CONTROLLED_TEXT_INSERTION_COMMAND"),Ey=He("PASTE_COMMAND"),ny=He("REMOVE_TEXT_COMMAND"),cc=He("DELETE_WORD_COMMAND"),uc=He("DELETE_LINE_COMMAND"),aa=He("FORMAT_TEXT_COMMAND"),My=He("UNDO_COMMAND"),Ay=He("REDO_COMMAND"),Ny=He("KEYDOWN_COMMAND"),vL=He("KEY_ARROW_RIGHT_COMMAND"),CL=He("MOVE_TO_END"),xL=He("KEY_ARROW_LEFT_COMMAND"),bL=He("MOVE_TO_START"),wL=He("KEY_ARROW_UP_COMMAND"),TL=He("KEY_ARROW_DOWN_COMMAND"),fm=He("KEY_ENTER_COMMAND"),IL=He("KEY_SPACE_COMMAND"),SL=He("KEY_BACKSPACE_COMMAND"),kL=He("KEY_ESCAPE_COMMAND"),LL=He("KEY_DELETE_COMMAND"),PL=He("KEY_TAB_COMMAND"),BK=He("INSERT_TAB_COMMAND"),HK=He("INDENT_CONTENT_COMMAND"),UK=He("OUTDENT_CONTENT_COMMAND"),RL=He("DROP_COMMAND"),$K=He("FORMAT_ELEMENT_COMMAND"),EL=He("DRAGSTART_COMMAND"),ML=He("DRAGOVER_COMMAND"),AL=He("DRAGEND_COMMAND"),Dy=He("COPY_COMMAND"),_y=He("CUT_COMMAND"),ry=He("SELECT_ALL_COMMAND"),zK=He("CLEAR_EDITOR_COMMAND"),KK=He("CLEAR_HISTORY_COMMAND"),qK=He("CAN_REDO_COMMAND"),WK=He("CAN_UNDO_COMMAND"),NL=He("FOCUS_COMMAND"),DL=He("BLUR_COMMAND"),_L=He("KEY_MODIFIER_COMMAND"),br=Object.freeze({}),ay=[["keydown",function(e,t){pc=e.timeStamp,OL=e.key,!t.isComposing()&&we(t,Ny,e)}],["pointerdown",function(e,t){let o=e.target,n=e.pointerType;Wi(o)&&n!=="touch"&&n!=="pen"&&e.button===0&&or(t,()=>{pP(o)||(ly=!0)})}],["compositionstart",function(e,t){we(t,Py,e)}],["compositionend",function(e,t){da?Zd=!0:yc||!Sm&&!km?we(t,Ry,e):(om=!0,nm=e.data)}],["input",function(e,t){e.stopPropagation(),or(t,()=>{t.dispatchCommand(Ly,e)},{event:e}),Li=null}],["click",function(e,t){or(t,()=>{let o=Je(),n=An(Yo(t)),r=ys();if(n){if(Oe(o)){let a=o.anchor,s=a.getNode();if(a.type==="element"&&a.offset===0&&o.isCollapsed()&&!lo(s)&&Xo().getChildrenSize()===1&&s.getTopLevelElementOrThrow().isEmpty()&&r!==null&&o.is(r))n.removeAllRanges(),o.dirty=!0;else if(e.detail===3&&!o.isCollapsed()&&s!==o.focus.getNode()){let i=nc(s,d=>re(d)&&!d.isInline());re(i)&&i.select(0)}}else if(e.pointerType==="touch"||e.pointerType==="pen"){let a=n.anchorNode;(ko(a)||nr(a))&&$o(Em(r,n,t,e))}}we(t,yL,e)})}],["cut",br],["copy",br],["dragstart",br],["dragover",br],["dragend",br],["paste",br],["focus",br],["blur",br],["drop",br]];im&&ay.push(["beforeinput",(e,t)=>(function(o,n){let r=o.inputType;r==="deleteCompositionText"||da&&wP(n)||r!=="insertCompositionText"&&we(n,ky,o)})(e,t)]);var pc=0,OL=null,FL=0,Li=null,sy=new WeakMap,gm=new WeakMap,iy=!1,ly=!1,tc=!1,Zd=!1,om=!1,nm="",ds=null,BL=[0,"",0,"root",0];function HL(e,t,o,n,r){let a=e.anchor,s=e.focus,i=a.getNode(),d=mt(),c=An(Yo(d)),u=c!==null?c.anchorNode:null,m=a.key,p=d.getElementByKey(m),f=o.length;return m!==s.key||!ke(i)||(!r&&(!im||FL<n+50)||i.isDirty()&&f<2||yP(o))&&a.offset!==s.offset&&!i.isComposing()||Ir(i)||i.isDirty()&&f>1||(r||!im)&&p!==null&&!i.isComposing()&&u!==gs(p)||c!==null&&t!==null&&(!t.collapsed||t.startContainer!==c.anchorNode||t.startOffset!==c.anchorOffset)||!i.isComposing()&&(i.getFormat()!==e.format||i.getStyle()!==e.style)||(function(g,h){if(h.isSegmented())return!0;if(!g.isCollapsed())return!1;let y=g.anchor.offset,x=h.getParentOrThrow(),C=ia(h);return y===0?!h.canInsertTextBefore()||!x.canInsertTextBefore()&&!h.isComposing()||C||(function(b){let L=b.getPreviousSibling();return(ke(L)||re(L)&&L.isInline())&&!L.canInsertTextAfter()})(h):y===h.getTextContentSize()&&(!h.canInsertTextAfter()||!x.canInsertTextAfter()&&!h.isComposing()||C)})(e,i)}function T0(e,t){return nr(e)&&e.nodeValue!==null&&t!==0&&t!==e.nodeValue.length}function I0(e,t,o){let{anchorNode:n,anchorOffset:r,focusNode:a,focusOffset:s}=e;iy&&(iy=!1,T0(n,r)&&T0(a,s)&&!ds)||or(t,()=>{if(!o)return void $o(null);if(!Cc(t,n,a))return;let i=Je();if(ds&&Oe(i)&&i.isCollapsed()){let d=i.anchor,c=ds.anchor;(d.key===c.key&&d.offset===c.offset+1||d.offset===1&&c.getNode().is(d.getNode().getPreviousSibling()))&&(i=ds.clone(),$o(i))}if(ds=null,Oe(i)){let d=i.anchor,c=d.getNode();if(i.isCollapsed()){e.type==="Range"&&e.anchorNode===e.focusNode&&(i.dirty=!0);let u=Yo(t).event,m=u?u.timeStamp:performance.now(),[p,f,g,h,y]=BL,x=Xo(),C=t.isComposing()===!1&&x.getTextContent()==="";if(m<y+200&&d.offset===g&&d.key===h)rm(i,p,f);else if(d.type==="text")ke(c)||le(141),UL(i,c);else if(d.type==="element"&&!C){re(c)||le(259);let b=d.getNode();b.isEmpty()?(function(L,w){let k=w.getTextFormat(),I=w.getTextStyle();rm(L,k,I)})(i,b):rm(i,0,"")}}else{let u=d.key,m=i.focus.key,p=i.getNodes(),f=p.length,g=i.isBackward(),h=g?s:r,y=g?r:s,x=g?m:u,C=g?u:m,b=2047,L=!1;for(let w=0;w<f;w++){let k=p[w],I=k.getTextContentSize();if(ke(k)&&I!==0&&!(w===0&&k.__key===x&&h===I||w===f-1&&k.__key===C&&y===0)&&(L=!0,b&=k.getFormat(),b===0))break}i.format=L?b:0}}we(t,Sy,void 0)})}function rm(e,t,o){e.format===t&&e.style===o||(e.format=t,e.style=o,e.dirty=!0)}function UL(e,t){rm(e,t.getFormat(),t.getStyle())}function $L(e){if(!e.getTargetRanges)return null;let t=e.getTargetRanges();return t.length===0?null:t[0]}function GK(e){let t=e.inputType,o=$L(e),n=mt(),r=Je();if(t==="deleteContentBackward"){if(r===null){let m=ys();if(!Oe(m))return!0;$o(m.clone())}if(Oe(r)){let m=r.anchor.key===r.focus.key;if(a=e.timeStamp,OL==="MediaLast"&&a<pc+30&&n.isComposing()&&m){if(ro(null),pc=0,setTimeout(()=>{or(n,()=>{ro(null)})},30),Oe(r)){let p=r.anchor.getNode();p.markDirty(),ke(p)||le(142),UL(r,p)}}else{ro(null),e.preventDefault();let p=r.anchor.getNode(),f=p.getTextContent(),g=p.canInsertTextAfter(),h=r.anchor.offset===0&&r.focus.offset===f.length,y=qh&&m&&!h&&g;if(y&&r.isCollapsed()&&(y=!yt(bP(r.anchor,!0))),!y){we(n,dc,!0);let x=Je();qh&&Oe(x)&&x.isCollapsed()&&(ds=x,setTimeout(()=>ds=null))}}return!0}}var a;if(!Oe(r))return!0;let s=e.data;Li!==null&&Vy(!1,n,Li),r.dirty&&Li===null||!r.isCollapsed()||lo(r.anchor.getNode())||o===null||r.applyDOMRange(o),Li=null;let i=r.anchor,d=r.focus,c=i.getNode(),u=d.getNode();if(t==="insertText"||t==="insertTranspose"){if(s===`
3553
+ `)e.preventDefault(),we(n,ec,!1);else if(s===Lm)e.preventDefault(),we(n,oy,void 0);else if(s==null&&e.dataTransfer){let m=e.dataTransfer.getData("text/plain");e.preventDefault(),r.insertRawText(m)}else s!=null&&HL(r,o,s,e.timeStamp,!0)?(e.preventDefault(),we(n,Ei,s)):Li=s;return FL=e.timeStamp,!0}switch(e.preventDefault(),t){case"insertFromYank":case"insertFromDrop":case"insertReplacementText":we(n,Ei,e);break;case"insertFromComposition":ro(null),we(n,Ei,e);break;case"insertLineBreak":ro(null),we(n,ec,!1);break;case"insertParagraph":ro(null),tc&&!yc?(tc=!1,we(n,ec,!1)):we(n,oy,void 0);break;case"insertFromPaste":case"insertFromPasteAsQuotation":we(n,Ey,e);break;case"deleteByComposition":(function(m,p){return m!==p||re(m)||re(p)||!ia(m)||!ia(p)})(c,u)&&we(n,ny,e);break;case"deleteByDrag":case"deleteByCut":we(n,ny,e);break;case"deleteContent":we(n,dc,!1);break;case"deleteWordBackward":we(n,cc,!0);break;case"deleteWordForward":we(n,cc,!1);break;case"deleteHardLineBackward":case"deleteSoftLineBackward":we(n,uc,!0);break;case"deleteContentForward":case"deleteHardLineForward":case"deleteSoftLineForward":we(n,uc,!1);break;case"formatStrikeThrough":we(n,aa,"strikethrough");break;case"formatBold":we(n,aa,"bold");break;case"formatItalic":we(n,aa,"italic");break;case"formatUnderline":we(n,aa,"underline");break;case"historyUndo":we(n,My,void 0);break;case"historyRedo":we(n,Ay,void 0)}return!0}function jK(e){if(ko(e.target)&&pP(e.target))return!0;let t=mt(),o=Je(),n=e.data,r=$L(e);if(n!=null&&Oe(o)&&HL(o,r,n,e.timeStamp,!1)){Zd&&(hm(t,n),Zd=!1);let a=o.anchor.getNode(),s=An(Yo(t));if(s===null)return!0;let i=o.isBackward(),d=i?o.anchor.offset:o.focus.offset,c=i?o.focus.offset:o.anchor.offset;im&&!o.isCollapsed()&&ke(a)&&s.anchorNode!==null&&a.getTextContent().slice(0,d)+n+a.getTextContent().slice(d+c)===CP(s.anchorNode)||we(t,Ei,n);let u=n.length;da&&u>1&&e.inputType==="insertCompositionText"&&!t.isComposing()&&(o.anchor.offset-=u),qh&&t.isComposing()&&(pc=0,ro(null))}else Vy(!1,t,n!==null?n:void 0),Zd&&(hm(t,n||void 0),Zd=!1);return(function(){no();let a=mt();dL(a)})(),!0}function VK(e){let t=mt(),o=Je();if(Oe(o)&&!t.isComposing()){let n=o.anchor,r=o.anchor.getNode();ro(n.key),_m(VL),(e.timeStamp<pc+30||n.type==="element"||!o.isCollapsed()||r.getFormat()!==o.format||ke(r)&&r.getStyle()!==o.style)&&we(t,Ei,wy)}return!0}function QK(e){return hm(mt(),e.data),_m(QL),!0}function hm(e,t){let o=e._compositionKey;if(ro(null),o!==null&&t!=null){if(t===""){let n=Vt(o),r=gs(e.getElementByKey(o));if(r!==null&&r.nodeValue!==null&&ke(n)){let a=An(Yo(e)),s=null,i=null;a!==null&&a.anchorNode===r&&(s=a.anchorOffset,i=a.focusOffset),Qy(n,r.nodeValue,s,i,!0)}return}if(t[t.length-1]===`
3554
+ `){let n=Je();if(Oe(n)||vc(n)){if(Oe(n)){let r=n.focus;n.anchor.set(r.key,r.offset,r.type)}return void we(e,fm,null)}}}Vy(!0,e,t)}function XK(e){let t=mt();if(e.key==null)return!0;if(om){if(Y0(e))return or(t,()=>{hm(t,nm)}),om=!1,nm="",!0;om=!1,nm=""}if((function(o){return at(o,"ArrowRight",{shiftKey:"any"})})(e))we(t,vL,e);else if((function(o){return at(o,"ArrowRight",Tr)})(e))we(t,CL,e);else if((function(o){return at(o,"ArrowLeft",{shiftKey:"any"})})(e))we(t,xL,e);else if((function(o){return at(o,"ArrowLeft",Tr)})(e))we(t,bL,e);else if((function(o){return at(o,"ArrowUp",{altKey:"any",shiftKey:"any"})})(e))we(t,wL,e);else if((function(o){return at(o,"ArrowDown",{altKey:"any",shiftKey:"any"})})(e))we(t,TL,e);else if((function(o){return at(o,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any",shiftKey:!0})})(e))tc=!0,we(t,fm,e);else if((function(o){return o.key===" "})(e))we(t,IL,e);else if((function(o){return Sn&&at(o,"o",{ctrlKey:!0})})(e))e.preventDefault(),tc=!0,we(t,ec,!0);else if((function(o){return at(o,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any"})})(e))tc=!1,we(t,fm,e);else if((function(o){return at(o,"Backspace",{shiftKey:"any"})||Sn&&at(o,"h",{ctrlKey:!0})})(e))Y0(e)?we(t,SL,e):(e.preventDefault(),we(t,dc,!0));else if((function(o){return o.key==="Escape"})(e))we(t,kL,e);else if((function(o){return at(o,"Delete",{})||Sn&&at(o,"d",{ctrlKey:!0})})(e))(function(o){return o.key==="Delete"})(e)?we(t,LL,e):(e.preventDefault(),we(t,dc,!1));else if((function(o){return at(o,"Backspace",X0)})(e))e.preventDefault(),we(t,cc,!0);else if((function(o){return at(o,"Delete",X0)})(e))e.preventDefault(),we(t,cc,!1);else if((function(o){return Sn&&at(o,"Backspace",{metaKey:!0})})(e))e.preventDefault(),we(t,uc,!0);else if((function(o){return Sn&&(at(o,"Delete",{metaKey:!0})||at(o,"k",{ctrlKey:!0}))})(e))e.preventDefault(),we(t,uc,!1);else if((function(o){return at(o,"b",Tr)})(e))e.preventDefault(),we(t,aa,"bold");else if((function(o){return at(o,"u",Tr)})(e))e.preventDefault(),we(t,aa,"underline");else if((function(o){return at(o,"i",Tr)})(e))e.preventDefault(),we(t,aa,"italic");else if((function(o){return at(o,"Tab",{shiftKey:"any"})})(e))we(t,PL,e);else if((function(o){return at(o,"z",Tr)})(e))e.preventDefault(),we(t,My,void 0);else if((function(o){return Sn?at(o,"z",{metaKey:!0,shiftKey:!0}):at(o,"y",{ctrlKey:!0})||at(o,"z",{ctrlKey:!0,shiftKey:!0})})(e))e.preventDefault(),we(t,Ay,void 0);else{let o=t._editorState._selection;o===null||Oe(o)?J0(e)&&(e.preventDefault(),we(t,ry,e)):(function(n){return at(n,"c",Tr)})(e)?(e.preventDefault(),we(t,Dy,e)):(function(n){return at(n,"x",Tr)})(e)?(e.preventDefault(),we(t,_y,e)):J0(e)&&(e.preventDefault(),we(t,ry,e))}return(function(o){return o.ctrlKey||o.shiftKey||o.altKey||o.metaKey})(e)&&t.dispatchCommand(_L,e),!0}function zL(e){let t=e.__lexicalEventHandles;return t===void 0&&(t=[],e.__lexicalEventHandles=t),t}var Mi=new Map;function KL(e){let t=kP(e.target);if(t===null)return;let o=Wy(t.anchorNode);if(o===null)return;ly&&(ly=!1,or(o,()=>{let d=ys(),c=t.anchorNode;(ko(c)||nr(c))&&$o(Em(d,t,o,e))}));let n=jy(o),r=n[n.length-1],a=r._key,s=Mi.get(a),i=s||r;i!==o&&I0(t,i,!1),I0(t,o,!0),o!==r?Mi.set(a,o):s&&Mi.delete(a)}function S0(e){e._lexicalHandled=!0}function k0(e){return e._lexicalHandled===!0}var L0=()=>{};function YK(e){let t=sy.get(e);if(t===void 0)return void L0();let o=gm.get(t);if(o===void 0)return void L0();let n=o-1;n>=0||le(164),sy.delete(e),gm.set(t,n),n===0&&t.removeEventListener("selectionchange",KL);let r=xc(e);Am(r)?((function(s){if(s._parentEditor!==null){let i=jy(s),d=i[i.length-1]._key;Mi.get(d)===s&&Mi.delete(d)}else Mi.delete(s._key)})(r),e.__lexicalEditor=null):r&&le(198);let a=zL(e);for(let s=0;s<a.length;s++)a[s]();e.__lexicalEventHandles=[]}function dy(e,t,o){no();let n=e.__key,r=e.getParent();if(r===null)return;let a=(function(i){let d=Je();if(!Oe(d)||!re(i))return d;let{anchor:c,focus:u}=d,m=c.getNode(),p=u.getNode();return Tm(m,i)&&c.set(i.__key,0,"element"),Tm(p,i)&&u.set(i.__key,0,"element"),d})(e),s=!1;if(Oe(a)&&t){let i=a.anchor,d=a.focus;i.key===n&&(xm(i,e,r,e.getPreviousSibling(),e.getNextSibling()),s=!0),d.key===n&&(xm(d,e,r,e.getPreviousSibling(),e.getNextSibling()),s=!0)}else vc(a)&&t&&e.isSelected()&&e.selectPrevious();if(Oe(a)&&t&&!s){let i=e.getIndexWithinParent();la(e),Cm(a,r,i,-1)}else la(e);o||un(r)||r.canBeEmpty()||!r.isEmpty()||dy(r,t),t&&a&&lo(r)&&r.isEmpty()&&r.selectEnd()}function JK(e){return e}var qL=Symbol.for("ephemeral");function ym(e){return e[qL]||!1}var cn=class{__type;__key;__parent;__prev;__next;__state;static getType(){let{ownNodeType:t}=Tc(this);return t===void 0&&le(64,this.name),t}static clone(t){le(65,this.name)}$config(){return{}}config(t,o){let n=o.extends||Object.getPrototypeOf(this.constructor);return Object.assign(o,{extends:n,type:t}),{[t]:o}}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}),fP(this,t)}getType(){return this.__type}isInline(){le(137,this.constructor.name)}isAttached(){let t=this.__key;for(;t!==null;){if(t==="root")return!0;let o=Vt(t);if(o===null)break;t=o.__parent}return!1}isSelected(t){let o=t||Je();if(o==null)return!1;let n=o.getNodes().some(r=>r.__key===this.__key);if(ke(this))return n;if(Oe(o)&&o.anchor.type==="element"&&o.focus.type==="element"){if(o.isCollapsed())return!1;let r=this.getParent();if(yt(this)&&this.isInline()&&r){let a=o.isBackward()?o.focus:o.anchor;if(r.is(a.getNode())&&a.offset===r.getChildrenSize()&&this.is(r.getLastChild()))return!1}}return n}getKey(){return this.__key}getIndexWithinParent(){let t=this.getParent();if(t===null)return-1;let o=t.getFirstChild(),n=0;for(;o!==null;){if(this.is(o))return n;n++,o=o.getNextSibling()}return-1}getParent(){let t=this.getLatest().__parent;return t===null?null:Vt(t)}getParentOrThrow(){let t=this.getParent();return t===null&&le(66,this.__key),t}getTopLevelElement(){let t=this;for(;t!==null;){let o=t.getParent();if(un(o))return re(t)||t===this&&yt(t)||le(194),t;t=o}return null}getTopLevelElementOrThrow(){let t=this.getTopLevelElement();return t===null&&le(67,this.__key),t}getParents(){let t=[],o=this.getParent();for(;o!==null;)t.push(o),o=o.getParent();return t}getParentKeys(){let t=[],o=this.getParent();for(;o!==null;)t.push(o.__key),o=o.getParent();return t}getPreviousSibling(){let t=this.getLatest().__prev;return t===null?null:Vt(t)}getPreviousSiblings(){let t=[],o=this.getParent();if(o===null)return t;let n=o.getFirstChild();for(;n!==null&&!n.is(this);)t.push(n),n=n.getNextSibling();return t}getNextSibling(){let t=this.getLatest().__next;return t===null?null:Vt(t)}getNextSiblings(){let t=[],o=this.getNextSibling();for(;o!==null;)t.push(o),o=o.getNextSibling();return t}getCommonAncestor(t){let o=re(this)?this:this.getParent(),n=re(t)?t:t.getParent(),r=o&&n?rc(o,n):null;return r?r.commonAncestor:null}is(t){return t!=null&&this.__key===t.__key}isBefore(t){let o=rc(this,t);return o!==null&&(o.type==="descendant"||(o.type==="branch"?sv(o)===-1:(o.type!=="same"&&o.type!=="ancestor"&&le(279),!1)))}isParentOf(t){let o=rc(this,t);return o!==null&&o.type==="ancestor"}getNodesBetween(t){let o=this.isBefore(t),n=[],r=new Set,a=this;for(;a!==null;){let s=a.__key;if(r.has(s)||(r.add(s),n.push(a)),a===t)break;let i=re(a)?o?a.getFirstChild():a.getLastChild():null;if(i!==null){a=i;continue}let d=o?a.getNextSibling():a.getPreviousSibling();if(d!==null){a=d;continue}let c=a.getParentOrThrow();if(r.has(c.__key)||n.push(c),c===t)break;let u=null,m=c;do{if(m===null&&le(68),u=o?m.getNextSibling():m.getPreviousSibling(),m=m.getParent(),m===null)break;u!==null||r.has(m.__key)||n.push(m)}while(u===null);a=u}return o||n.reverse(),n}isDirty(){let t=mt()._dirtyLeaves;return t!==null&&t.has(this.__key)}getLatest(){if(ym(this))return this;let t=Vt(this.__key);return t===null&&le(113),t}getWritable(){if(ym(this))return this;no();let t=Er(),o=mt(),n=t._nodeMap,r=this.__key,a=this.getLatest(),s=o._cloneNotNeeded,i=Je();if(i!==null&&i.setCachedNodes(null),s.has(r))return wm(a),a;let d=tv(a);return s.add(r),wm(d),n.set(r,d),d}getTextContent(){return""}getTextContentSize(){return this.getTextContent().length}createDOM(t,o){le(70)}updateDOM(t,o,n){le(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){le(18,this.name)}updateFromJSON(t){return(function(o,n){let r=o.getWritable(),a=n.$,s=a;for(let i of pL(r).flatKeys)i in n&&(s!==void 0&&s!==a||(s={...a}),s[i]=n[i]);return(r.__state||s)&&Iy(o).updateFromJSON(s),r})(this,t)}static transform(){return null}remove(t){dy(this,!0,t)}replace(t,o){no();let n=Je();n!==null&&(n=n.clone()),$h(this,t);let r=this.getLatest(),a=this.__key,s=t.__key,i=t.getWritable(),d=this.getParentOrThrow().getWritable(),c=d.__size;la(i);let u=r.getPreviousSibling(),m=r.getNextSibling(),p=r.__prev,f=r.__next,g=r.__parent;if(dy(r,!1,!0),u===null?d.__first=s:u.getWritable().__next=s,i.__prev=p,m===null?d.__last=s:m.getWritable().__prev=s,i.__next=f,i.__parent=g,d.__size=c,o&&(re(this)&&re(i)||le(139),this.getChildren().forEach(h=>{i.append(h)})),Oe(n)){$o(n);let h=n.anchor,y=n.focus;h.key===a&&M0(h,i),y.key===a&&M0(y,i)}return sa()===a&&ro(s),i}insertAfter(t,o=!0){no(),$h(this,t);let n=this.getWritable(),r=t.getWritable(),a=r.getParent(),s=Je(),i=!1,d=!1;if(a!==null){let f=t.getIndexWithinParent();if(la(r),Oe(s)){let g=a.__key,h=s.anchor,y=s.focus;i=h.type==="element"&&h.key===g&&h.offset===f+1,d=y.type==="element"&&y.key===g&&y.offset===f+1}}let c=this.getNextSibling(),u=this.getParentOrThrow().getWritable(),m=r.__key,p=n.__next;if(c===null?u.__last=m:c.getWritable().__prev=m,u.__size++,n.__next=m,r.__next=p,r.__prev=n.__key,r.__parent=n.__parent,o&&Oe(s)){let f=this.getIndexWithinParent();Cm(s,u,f+1);let g=u.__key;i&&s.anchor.set(g,f+2,"element"),d&&s.focus.set(g,f+2,"element")}return t}insertBefore(t,o=!0){no(),$h(this,t);let n=this.getWritable(),r=t.getWritable(),a=r.__key;la(r);let s=this.getPreviousSibling(),i=this.getParentOrThrow().getWritable(),d=n.__prev,c=this.getIndexWithinParent();s===null?i.__first=a:s.getWritable().__next=a,i.__size++,n.__prev=a,r.__prev=d,r.__next=n.__key,r.__parent=n.__parent;let u=Je();return o&&Oe(u)&&Cm(u,this.getParentOrThrow(),c),t}isParentRequired(){return!1}createParentElementNode(){return Lr()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(t,o){no();let n=this.getPreviousSibling(),r=this.getParentOrThrow();if(n===null)return r.select(0,0);if(re(n))return n.select();if(!ke(n)){let a=n.getIndexWithinParent()+1;return r.select(a,a)}return n.select(t,o)}selectNext(t,o){no();let n=this.getNextSibling(),r=this.getParentOrThrow();if(n===null)return r.select();if(re(n))return n.select(0,0);if(!ke(n)){let a=n.getIndexWithinParent();return r.select(a,a)}return n.select(t,o)}markDirty(){this.getWritable()}reconcileObservedMutation(t,o){this.markDirty()}},ZK="historic",e5="history-push",am="history-merge",t5="paste",WL="collaboration",o5="skip-collab",GL="skip-scroll-into-view",jL="skip-dom-selection",cy="skip-selection-focus",VL="composition-start",QL="composition-end",Ni=class e extends cn{static getType(){return"linebreak"}static clone(t){return new e(t.__key)}constructor(t){super(t)}getTextContent(){return`
3555
+ `}createDOM(){return document.createElement("br")}updateDOM(){return!1}isInline(){return!0}static importDOM(){return{br:t=>(function(o){let n=o.parentElement;if(n!==null&&hy(n)){let r=n.firstChild;if(r===o||r.nextSibling===o&&Yp(r)){let a=n.lastChild;if(a===o||a.previousSibling===o&&Yp(a))return!0}}return!1})(t)||(function(o){let n=o.parentElement;if(n!==null&&hy(n)){let r=n.firstChild;if(r===o||r.nextSibling===o&&Yp(r))return!1;let a=n.lastChild;if(a===o||a.previousSibling===o&&Yp(a))return!0}return!1})(t)?null:{conversion:n5,priority:0}}}static importJSON(t){return Di().updateFromJSON(t)}};function n5(e){return{node:Di()}}function Di(){return wc(new Ni)}function cs(e){return e instanceof Ni}function Yp(e){return nr(e)&&/^( |\t|\r?\n)+$/.test(e.textContent||"")}function Oh(e,t){return 16&t?"code":t&by?"mark":32&t?"sub":64&t?"sup":null}function Fh(e,t){return 1&t?"strong":2&t?"em":"span"}function XL(e,t,o,n,r){let a=n.classList,s=Ai(r,"base");s!==void 0&&a.add(...s),s=Ai(r,"underlineStrikethrough");let i=!1,d=8&t&&4&t;s!==void 0&&(8&o&&4&o?(i=!0,d||a.add(...s)):d&&a.remove(...s));for(let c in Co){let u=Co[c];if(s=Ai(r,c),s!==void 0)if(o&u){if(i&&(c==="underline"||c==="strikethrough")){t&u&&a.remove(...s);continue}((t&u)===0||d&&c==="underline"||c==="strikethrough")&&a.add(...s)}else t&u&&a.remove(...s)}}function YL(e,t,o){let n=t.firstChild,r=o.isComposing(),a=e+(r?sc:"");if(n==null)t.textContent=a;else{let s=n.nodeValue;if(s!==a)if(r||da){let[i,d,c]=(function(u,m){let p=u.length,f=m.length,g=0,h=0;for(;g<p&&g<f&&u[g]===m[g];)g++;for(;h+g<p&&h+g<f&&u[p-h-1]===m[f-h-1];)h++;return[g,p-g-h,m.slice(g,f-h)]})(s,a);d!==0&&n.deleteData(i,d),n.insertData(i,c)}else n.nodeValue=a}}function P0(e,t,o,n,r,a){YL(r,e,t);let s=a.theme.text;s!==void 0&&XL(0,0,n,e,s)}function Jp(e,t){let o=document.createElement(t);return o.appendChild(e),o}var ms=class e extends cn{__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="",o){super(o),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 IK[t.__mode]}getStyle(){return this.getLatest().__style}isToken(){return this.getLatest().__mode===1}isComposing(){return this.__key===sa()}isSegmented(){return this.getLatest().__mode===2}isDirectionless(){return!!(1&this.getLatest().__detail)}isUnmergeable(){return!!(2&this.getLatest().__detail)}hasFormat(t){let o=Co[t];return(this.getFormat()&o)!==0}isSimpleText(){return this.__type==="text"&&this.__mode===0}getTextContent(){return this.getLatest().__text}getFormatFlags(t,o){return gc(this.getLatest().__format,t,o)}canHaveFormat(){return!0}isInline(){return!0}createDOM(t,o){let n=this.__format,r=Oh(0,n),a=Fh(0,n),s=r===null?a:r,i=document.createElement(s),d=i;this.hasFormat("code")&&i.setAttribute("spellcheck","false"),r!==null&&(d=document.createElement(a),i.appendChild(d)),P0(d,this,0,n,this.__text,t);let c=this.__style;return c!==""&&(i.style.cssText=c),i}updateDOM(t,o,n){let r=this.__text,a=t.__format,s=this.__format,i=Oh(0,a),d=Oh(0,s),c=Fh(0,a),u=Fh(0,s);if((i===null?c:i)!==(d===null?u:d))return!0;if(i===d&&c!==u){let h=o.firstChild;h==null&&le(48);let y=document.createElement(u);return P0(y,this,0,s,r,n),o.replaceChild(y,h),!1}let m=o;d!==null&&i!==null&&(m=o.firstChild,m==null&&le(49)),YL(r,m,this);let p=n.theme.text;p!==void 0&&a!==s&&XL(0,a,s,m,p);let f=t.__style,g=this.__style;return f!==g&&(o.style.cssText=g),!1}static importDOM(){return{"#text":()=>({conversion:i5,priority:0}),b:()=>({conversion:a5,priority:0}),code:()=>({conversion:wr,priority:0}),em:()=>({conversion:wr,priority:0}),i:()=>({conversion:wr,priority:0}),mark:()=>({conversion:wr,priority:0}),s:()=>({conversion:wr,priority:0}),span:()=>({conversion:r5,priority:0}),strong:()=>({conversion:wr,priority:0}),sub:()=>({conversion:wr,priority:0}),sup:()=>({conversion:wr,priority:0}),u:()=>({conversion:wr,priority:0})}}static importJSON(t){return oo().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:o}=super.exportDOM(t);return ko(o)||le(132),o.style.whiteSpace="pre-wrap",this.hasFormat("lowercase")?o.style.textTransform="lowercase":this.hasFormat("uppercase")?o.style.textTransform="uppercase":this.hasFormat("capitalize")&&(o.style.textTransform="capitalize"),this.hasFormat("bold")&&(o=Jp(o,"b")),this.hasFormat("italic")&&(o=Jp(o,"i")),this.hasFormat("strikethrough")&&(o=Jp(o,"s")),this.hasFormat("underline")&&(o=Jp(o,"u")),{element:o}}exportJSON(){return{detail:this.getDetail(),format:this.getFormat(),mode:this.getMode(),style:this.getStyle(),text:this.getTextContent(),...super.exportJSON()}}selectionTransform(t,o){}setFormat(t){let o=this.getWritable();return o.__format=typeof t=="string"?Co[t]:t,o}setDetail(t){let o=this.getWritable();return o.__detail=typeof t=="string"?bK[t]:t,o}setStyle(t){let o=this.getWritable();return o.__style=t,o}toggleFormat(t){let o=gc(this.getFormat(),t,null);return this.setFormat(o)}toggleDirectionless(){let t=this.getWritable();return t.__detail^=1,t}toggleUnmergeable(){let t=this.getWritable();return t.__detail^=2,t}setMode(t){let o=TK[t];if(this.__mode===o)return this;let n=this.getWritable();return n.__mode=o,n}setTextContent(t){if(this.__text===t)return this;let o=this.getWritable();return o.__text=t,o}select(t,o){no();let n=t,r=o,a=Je(),s=this.getTextContent(),i=this.__key;if(typeof s=="string"){let d=s.length;n===void 0&&(n=d),r===void 0&&(r=d)}else n=0,r=0;if(!Oe(a))return eP(i,n,i,r,"text","text");{let d=sa();d!==a.anchor.key&&d!==a.focus.key||ro(i),a.setTextNodeRange(this,n,this,r)}return a}selectStart(){return this.select(0,0)}selectEnd(){let t=this.getTextContentSize();return this.select(t,t)}spliceText(t,o,n,r){let a=this.getWritable(),s=a.__text,i=n.length,d=t;d<0&&(d=i+d,d<0&&(d=0));let c=Je();if(r&&Oe(c)){let m=t+i;c.setTextNodeRange(a,m,a,m)}let u=s.slice(0,d)+n+s.slice(d+o);return a.__text=u,a}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...t){no();let o=this.getLatest(),n=o.getTextContent();if(n==="")return[];let r=o.__key,a=sa(),s=n.length;t.sort((T,S)=>T-S),t.push(s);let i=[],d=t.length;for(let T=0,S=0;T<s&&S<=d;S++){let P=t[S];P>T&&(i.push(n.slice(T,P)),T=P)}let c=i.length;if(c===1)return[o];let u=i[0],m=o.getParent(),p,f=o.getFormat(),g=o.getStyle(),h=o.__detail,y=!1,x=null,C=null,b=Je();if(Oe(b)){let[T,S]=b.isBackward()?[b.focus,b.anchor]:[b.anchor,b.focus];T.type==="text"&&T.key===r&&(x=T),S.type==="text"&&S.key===r&&(C=S)}o.isSegmented()?(p=oo(u),p.__format=f,p.__style=g,p.__detail=h,p.__state=h0(o,p),y=!0):p=o.setTextContent(u);let L=[p];for(let T=1;T<c;T++){let S=oo(i[T]);S.__format=f,S.__style=g,S.__detail=h,S.__state=h0(o,S);let P=S.__key;a===r&&ro(P),L.push(S)}let w=x?x.offset:null,k=C?C.offset:null,I=0;for(let T of L){if(!x&&!C)break;let S=I+T.getTextContentSize();if(x!==null&&w!==null&&w<=S&&w>=I&&(x.set(T.getKey(),w-I,"text"),w<S&&(x=null)),C!==null&&k!==null&&k<=S&&k>=I){C.set(T.getKey(),k-I,"text");break}I=S}if(m!==null){(function(P){let A=P.getPreviousSibling(),N=P.getNextSibling();A!==null&&wm(A),N!==null&&wm(N)})(this);let T=m.getWritable(),S=this.getIndexWithinParent();y?(T.splice(S,0,L),this.remove()):T.splice(S,1,L),Oe(b)&&Cm(b,m,S,c-1)}return L}mergeWithSibling(t){let o=t===this.getPreviousSibling();o||t===this.getNextSibling()||le(50);let n=this.__key,r=t.__key,a=this.__text,s=a.length;sa()===r&&ro(n);let i=Je();if(Oe(i)){let m=i.anchor,p=i.focus;m!==null&&m.key===r&&B0(m,o,n,t,s),p!==null&&p.key===r&&B0(p,o,n,t,s)}let d=t.__text,c=o?d+a:a+d;this.setTextContent(c);let u=this.getWritable();return t.remove(),u}isTextEntity(){return!1}};function r5(e){return{forChild:Oy(e.style),node:null}}function a5(e){let t=e,o=t.style.fontWeight==="normal";return{forChild:Oy(t.style,o?void 0:"bold"),node:null}}var R0=new WeakMap;function s5(e){if(!ko(e))return!1;if(e.nodeName==="PRE")return!0;let t=e.style.whiteSpace;return typeof t=="string"&&t.startsWith("pre")}function i5(e){let t=e;e.parentElement===null&&le(129);let o=t.textContent||"";if((function(n){let r,a=n.parentNode,s=[n];for(;a!==null&&(r=R0.get(a))===void 0&&!s5(a);)s.push(a),a=a.parentNode;let i=r===void 0?a:r;for(let d=0;d<s.length;d++)R0.set(s[d],i);return i})(t)!==null){let n=o.split(/(\r?\n|\t)/),r=[],a=n.length;for(let s=0;s<a;s++){let i=n[s];i===`
3556
3556
  `||i===`\r
3557
- `?r.push(Di()):i===" "?r.push(Rm()):i!==""&&r.push(oo(i))}return{node:r}}if(o=o.replace(/\r/g,"").replace(/[ \t\n]+/g," "),o==="")return{node:null};if(o[0]===" "){let n=t,r=!0;for(;n!==null&&(n=P0(n,!1))!==null;){let a=n.textContent||"";if(a.length>0){/[ \t\n]$/.test(a)&&(o=o.slice(1)),r=!1;break}}r&&(o=o.slice(1))}if(o[o.length-1]===" "){let n=t,r=!0;for(;n!==null&&(n=P0(n,!0))!==null;)if((n.textContent||"").replace(/^( |\t|\r?\n)+/,"").length>0){r=!1;break}r&&(o=o.slice(0,o.length-1))}return o===""?{node:null}:{node:oo(o)}}function P0(e,t){let o=e;for(;;){let n;for(;(n=t?o.nextSibling:o.previousSibling)===null;){let a=o.parentElement;if(a===null)return null;o=a}if(o=n,ko(o)){let a=o.style.display;if(a===""&&!kP(o)||a!==""&&!a.startsWith("inline"))return null}let r=o;for(;(r=t?o.firstChild:o.lastChild)!==null;)o=r;if(nr(o))return o;if(o.nodeName==="BR")return null}}var a5={code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};function wr(e){let t=a5[e.nodeName.toLowerCase()];return t===void 0?{node:null}:{forChild:Oy(e.style,t),node:null}}function oo(e=""){return wc(new ms(e))}function ke(e){return e instanceof ms}function Oy(e,t){let o=e.fontWeight,n=e.textDecoration.split(" "),r=o==="700"||o==="bold",a=n.includes("line-through"),s=e.fontStyle==="italic",i=n.includes("underline"),d=e.verticalAlign;return c=>(ke(c)&&(r&&!c.hasFormat("bold")&&c.toggleFormat("bold"),a&&!c.hasFormat("strikethrough")&&c.toggleFormat("strikethrough"),s&&!c.hasFormat("italic")&&c.toggleFormat("italic"),i&&!c.hasFormat("underline")&&c.toggleFormat("underline"),d!=="sub"||c.hasFormat("subscript")||c.toggleFormat("subscript"),d!=="super"||c.hasFormat("superscript")||c.toggleFormat("superscript"),t&&!c.hasFormat(t)&&c.toggleFormat(t)),c)}var _i=class e extends ms{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 o=super.createDOM(t),n=Ai(t.theme,"tab");return n!==void 0&&o.classList.add(...n),o}static importJSON(t){return Rm().updateFromJSON(t)}setTextContent(t){return t!==" "&&t!==""&&tL(126),super.setTextContent(" ")}spliceText(t,o,n,r){return n===""&&o===0||n===" "&&o===1||le(286),this}setDetail(t){return t!==2&&le(127),this}setMode(t){return t!=="normal"&&le(128),this}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}};function Rm(){return wc(new _i)}function Fy(e){return e instanceof _i}var uy=class{key;offset;type;_selection;constructor(t,o,n){this._selection=null,this.key=t,this.offset=o,this.type=n}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:av(kn(fa(this,"next")),kn(fa(t,"next")))<0}getNode(){let t=Vt(this.key);return t===null&&le(20),t}set(t,o,n,r){let a=this._selection,s=this.key;r&&this.key===t&&this.offset===o&&this.type===n||(this.key=t,this.offset=o,this.type=n,qi()||(sa()===s&&ro(t),a!==null&&(a.setCachedNodes(null),a.dirty=!0)))}};function En(e,t,o){return new uy(e,t,o)}function Bh(e,t){let o=t.__key,n=e.offset,r="element";if(ke(t)){r="text";let a=t.getTextContentSize();n>a&&(n=a)}else if(!re(t)){let a=t.getNextSibling();if(ke(a))o=a.__key,n=0,r="text";else{let s=t.getParent();s&&(o=s.__key,n=t.getIndexWithinParent()+1)}}e.set(o,n,r)}function R0(e,t){if(re(t)){let o=t.getLastDescendant();re(o)||ke(o)?Bh(e,o):Bh(e,t)}else Bh(e,t)}var vm=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(!vc(t))return!1;let o=this._nodes,n=t._nodes;return o.size===n.size&&Array.from(o).every(r=>n.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 o=this.getNodes(),n=o.length,r=o[n-1],a;if(ke(r))a=r.select();else{let s=r.getIndexWithinParent()+1;a=r.getParentOrThrow().select(s,s)}a.insertNodes(t);for(let s=0;s<n;s++)o[s].remove()}getNodes(){let t=this._cachedNodes;if(t!==null)return t;let o=this._nodes,n=[];for(let r of o){let a=Vt(r);a!==null&&n.push(a)}return qi()||(this._cachedNodes=n),n}getTextContent(){let t=this.getNodes(),o="";for(let n=0;n<t.length;n++)o+=t[n].getTextContent();return o}deleteNodes(){let t=this.getNodes();if((Je()||ys())===this&&t[0]){let o=io(t[0],"next");MP(ma(o,o))}for(let o of t)o.remove()}};function Oe(e){return e instanceof fs}var fs=class e{format;style;anchor;focus;_cachedNodes;dirty;constructor(t,o,n,r){this.anchor=t,this.focus=o,t._selection=this,o._selection=this,this._cachedNodes=null,this.format=n,this.style=r,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(t){this._cachedNodes=t}is(t){return!!Oe(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 o=(function(n){let r=[],[a,s]=n.getTextSlices();a&&r.push(a.caret.origin);let i=new Set,d=new Set;for(let c of n)if(Pn(c)){let{origin:u}=c;r.length===0?i.add(u):(d.add(u),r.push(u))}else{let{origin:u}=c;re(u)&&d.has(u)||r.push(u)}if(s&&r.push(s.caret.origin),hs(n.focus)&&re(n.focus.origin)&&n.focus.getNodeAtCaret()===null)for(let c=Rr(n.focus.origin,"previous");Pn(c)&&i.has(c.origin)&&!c.origin.isEmpty()&&c.origin.is(r[r.length-1]);c=zi(c))i.delete(c.origin),r.pop();for(;r.length>1;){let c=r[r.length-1];if(!re(c)||d.has(c)||c.isEmpty()||i.has(c))break;r.pop()}if(r.length===0&&n.isCollapsed()){let c=kn(n.anchor),u=kn(n.anchor.getFlipped()),m=f=>Pr(f)?f.origin:f.getNodeAtCaret(),p=m(c)||m(u)||(n.anchor.getNodeAtCaret()?c.origin:u.origin);r.push(p)}return r})(iv(xy(this),"next"));return qi()||(this._cachedNodes=o),o}setTextNodeRange(t,o,n,r){this.anchor.set(t.__key,o,"text"),this.focus.set(n.__key,r,"text")}getTextContent(){let t=this.getNodes();if(t.length===0)return"";let o=t[0],n=t[t.length-1],r=this.anchor,a=this.focus,s=r.isBefore(a),[i,d]=py(this),c="",u=!0;for(let m=0;m<t.length;m++){let p=t[m];if(re(p)&&!p.isInline())u||(c+=`
3558
- `),u=!p.isEmpty();else if(u=!1,ke(p)){let f=p.getTextContent();p===o?p===n?r.type==="element"&&a.type==="element"&&a.offset!==r.offset||(f=i<d?f.slice(i,d):f.slice(d,i)):f=s?f.slice(i):f.slice(d):p===n&&(f=s?f.slice(0,d):f.slice(0,i)),c+=f}else!yt(p)&&!cs(p)||p===n&&this.isCollapsed()||(c+=p.getTextContent())}return c}applyDOMRange(t){let o=mt(),n=o.getEditorState()._selection,r=YL(t.startContainer,t.startOffset,t.endContainer,t.endOffset,o,n);if(r===null)return;let[a,s]=r;this.anchor.set(a.key,a.offset,a.type,!0),this.focus.set(s.key,s.offset,s.type,!0),dm(this)}clone(){let t=this.anchor,o=this.focus;return new e(En(t.key,t.offset,t.type),En(o.key,o.offset,o.type),this.format,this.style)}toggleFormat(t){this.format=gc(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 o=xo[t];return(this.format&o)!==0}insertRawText(t){let o=t.split(/(\r?\n|\t)/),n=[],r=o.length;for(let a=0;a<r;a++){let s=o[a];s===`
3557
+ `?r.push(Di()):i===" "?r.push(Rm()):i!==""&&r.push(oo(i))}return{node:r}}if(o=o.replace(/\r/g,"").replace(/[ \t\n]+/g," "),o==="")return{node:null};if(o[0]===" "){let n=t,r=!0;for(;n!==null&&(n=E0(n,!1))!==null;){let a=n.textContent||"";if(a.length>0){/[ \t\n]$/.test(a)&&(o=o.slice(1)),r=!1;break}}r&&(o=o.slice(1))}if(o[o.length-1]===" "){let n=t,r=!0;for(;n!==null&&(n=E0(n,!0))!==null;)if((n.textContent||"").replace(/^( |\t|\r?\n)+/,"").length>0){r=!1;break}r&&(o=o.slice(0,o.length-1))}return o===""?{node:null}:{node:oo(o)}}function E0(e,t){let o=e;for(;;){let n;for(;(n=t?o.nextSibling:o.previousSibling)===null;){let a=o.parentElement;if(a===null)return null;o=a}if(o=n,ko(o)){let a=o.style.display;if(a===""&&!PP(o)||a!==""&&!a.startsWith("inline"))return null}let r=o;for(;(r=t?o.firstChild:o.lastChild)!==null;)o=r;if(nr(o))return o;if(o.nodeName==="BR")return null}}var l5={code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};function wr(e){let t=l5[e.nodeName.toLowerCase()];return t===void 0?{node:null}:{forChild:Oy(e.style,t),node:null}}function oo(e=""){return wc(new ms(e))}function ke(e){return e instanceof ms}function Oy(e,t){let o=e.fontWeight,n=e.textDecoration.split(" "),r=o==="700"||o==="bold",a=n.includes("line-through"),s=e.fontStyle==="italic",i=n.includes("underline"),d=e.verticalAlign;return c=>(ke(c)&&(r&&!c.hasFormat("bold")&&c.toggleFormat("bold"),a&&!c.hasFormat("strikethrough")&&c.toggleFormat("strikethrough"),s&&!c.hasFormat("italic")&&c.toggleFormat("italic"),i&&!c.hasFormat("underline")&&c.toggleFormat("underline"),d!=="sub"||c.hasFormat("subscript")||c.toggleFormat("subscript"),d!=="super"||c.hasFormat("superscript")||c.toggleFormat("superscript"),t&&!c.hasFormat(t)&&c.toggleFormat(t)),c)}var _i=class e extends ms{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 o=super.createDOM(t),n=Ai(t.theme,"tab");return n!==void 0&&o.classList.add(...n),o}static importJSON(t){return Rm().updateFromJSON(t)}setTextContent(t){return t!==" "&&t!==""&&nL(126),super.setTextContent(" ")}spliceText(t,o,n,r){return n===""&&o===0||n===" "&&o===1||le(286),this}setDetail(t){return t!==2&&le(127),this}setMode(t){return t!=="normal"&&le(128),this}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}};function Rm(){return wc(new _i)}function Fy(e){return e instanceof _i}var uy=class{key;offset;type;_selection;constructor(t,o,n){this._selection=null,this.key=t,this.offset=o,this.type=n}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:av(kn(fa(this,"next")),kn(fa(t,"next")))<0}getNode(){let t=Vt(this.key);return t===null&&le(20),t}set(t,o,n,r){let a=this._selection,s=this.key;r&&this.key===t&&this.offset===o&&this.type===n||(this.key=t,this.offset=o,this.type=n,qi()||(sa()===s&&ro(t),a!==null&&(a.setCachedNodes(null),a.dirty=!0)))}};function En(e,t,o){return new uy(e,t,o)}function Bh(e,t){let o=t.__key,n=e.offset,r="element";if(ke(t)){r="text";let a=t.getTextContentSize();n>a&&(n=a)}else if(!re(t)){let a=t.getNextSibling();if(ke(a))o=a.__key,n=0,r="text";else{let s=t.getParent();s&&(o=s.__key,n=t.getIndexWithinParent()+1)}}e.set(o,n,r)}function M0(e,t){if(re(t)){let o=t.getLastDescendant();re(o)||ke(o)?Bh(e,o):Bh(e,t)}else Bh(e,t)}var vm=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(!vc(t))return!1;let o=this._nodes,n=t._nodes;return o.size===n.size&&Array.from(o).every(r=>n.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 o=this.getNodes(),n=o.length,r=o[n-1],a;if(ke(r))a=r.select();else{let s=r.getIndexWithinParent()+1;a=r.getParentOrThrow().select(s,s)}a.insertNodes(t);for(let s=0;s<n;s++)o[s].remove()}getNodes(){let t=this._cachedNodes;if(t!==null)return t;let o=this._nodes,n=[];for(let r of o){let a=Vt(r);a!==null&&n.push(a)}return qi()||(this._cachedNodes=n),n}getTextContent(){let t=this.getNodes(),o="";for(let n=0;n<t.length;n++)o+=t[n].getTextContent();return o}deleteNodes(){let t=this.getNodes();if((Je()||ys())===this&&t[0]){let o=io(t[0],"next");NP(ma(o,o))}for(let o of t)o.remove()}};function Oe(e){return e instanceof fs}var fs=class e{format;style;anchor;focus;_cachedNodes;dirty;constructor(t,o,n,r){this.anchor=t,this.focus=o,t._selection=this,o._selection=this,this._cachedNodes=null,this.format=n,this.style=r,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(t){this._cachedNodes=t}is(t){return!!Oe(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 o=(function(n){let r=[],[a,s]=n.getTextSlices();a&&r.push(a.caret.origin);let i=new Set,d=new Set;for(let c of n)if(Pn(c)){let{origin:u}=c;r.length===0?i.add(u):(d.add(u),r.push(u))}else{let{origin:u}=c;re(u)&&d.has(u)||r.push(u)}if(s&&r.push(s.caret.origin),hs(n.focus)&&re(n.focus.origin)&&n.focus.getNodeAtCaret()===null)for(let c=Rr(n.focus.origin,"previous");Pn(c)&&i.has(c.origin)&&!c.origin.isEmpty()&&c.origin.is(r[r.length-1]);c=zi(c))i.delete(c.origin),r.pop();for(;r.length>1;){let c=r[r.length-1];if(!re(c)||d.has(c)||c.isEmpty()||i.has(c))break;r.pop()}if(r.length===0&&n.isCollapsed()){let c=kn(n.anchor),u=kn(n.anchor.getFlipped()),m=f=>Pr(f)?f.origin:f.getNodeAtCaret(),p=m(c)||m(u)||(n.anchor.getNodeAtCaret()?c.origin:u.origin);r.push(p)}return r})(iv(xy(this),"next"));return qi()||(this._cachedNodes=o),o}setTextNodeRange(t,o,n,r){this.anchor.set(t.__key,o,"text"),this.focus.set(n.__key,r,"text")}getTextContent(){let t=this.getNodes();if(t.length===0)return"";let o=t[0],n=t[t.length-1],r=this.anchor,a=this.focus,s=r.isBefore(a),[i,d]=py(this),c="",u=!0;for(let m=0;m<t.length;m++){let p=t[m];if(re(p)&&!p.isInline())u||(c+=`
3558
+ `),u=!p.isEmpty();else if(u=!1,ke(p)){let f=p.getTextContent();p===o?p===n?r.type==="element"&&a.type==="element"&&a.offset!==r.offset||(f=i<d?f.slice(i,d):f.slice(d,i)):f=s?f.slice(i):f.slice(d):p===n&&(f=s?f.slice(0,d):f.slice(0,i)),c+=f}else!yt(p)&&!cs(p)||p===n&&this.isCollapsed()||(c+=p.getTextContent())}return c}applyDOMRange(t){let o=mt(),n=o.getEditorState()._selection,r=ZL(t.startContainer,t.startOffset,t.endContainer,t.endOffset,o,n);if(r===null)return;let[a,s]=r;this.anchor.set(a.key,a.offset,a.type,!0),this.focus.set(s.key,s.offset,s.type,!0),dm(this)}clone(){let t=this.anchor,o=this.focus;return new e(En(t.key,t.offset,t.type),En(o.key,o.offset,o.type),this.format,this.style)}toggleFormat(t){this.format=gc(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 o=Co[t];return(this.format&o)!==0}insertRawText(t){let o=t.split(/(\r?\n|\t)/),n=[],r=o.length;for(let a=0;a<r;a++){let s=o[a];s===`
3559
3559
  `||s===`\r
3560
- `?n.push(Di()):s===" "?n.push(Rm()):n.push(oo(s))}this.insertNodes(n)}insertText(t){let o=this.anchor,n=this.focus,r=this.format,a=this.style,s=o,i=n;!this.isCollapsed()&&n.isBefore(o)&&(s=n,i=o),s.type==="element"&&(function(y,x,C,b){let L=y.getNode(),w=L.getChildAtIndex(y.offset),k=oo();if(k.setFormat(C),k.setStyle(b),sP(w))w.splice(0,0,[k]);else{let I=lo(L)?Lr().append(k):k;w===null?L.append(I):w.insertBefore(I)}y.is(x)&&x.set(k.__key,0,"text"),y.set(k.__key,0,"text")})(s,i,r,a),i.type==="element"&&Ki(i,kn(fa(i,"next")));let d=s.offset,c=i.offset,u=this.getNodes(),m=u.length,p=u[0];ke(p)||le(26);let f=p.getTextContent().length,g=p.getParentOrThrow(),h=u[m-1];if(m===1&&i.type==="element"&&(c=f,i.set(s.key,c,"text")),this.isCollapsed()&&d===f&&(Ir(p)||!p.canInsertTextAfter()||!g.canInsertTextAfter()&&p.getNextSibling()===null)){let y=p.getNextSibling();if(ke(y)&&y.canInsertTextBefore()&&!Ir(y)||(y=oo(),y.setFormat(r),y.setStyle(a),g.canInsertTextAfter()?p.insertAfter(y):g.insertAfter(y)),y.select(0,0),p=y,t!=="")return void this.insertText(t)}else if(this.isCollapsed()&&d===0&&(Ir(p)||!p.canInsertTextBefore()||!g.canInsertTextBefore()&&p.getPreviousSibling()===null)){let y=p.getPreviousSibling();if(ke(y)&&!Ir(y)||(y=oo(),y.setFormat(r),g.canInsertTextBefore()?p.insertBefore(y):g.insertBefore(y)),y.select(),p=y,t!=="")return void this.insertText(t)}else if(p.isSegmented()&&d!==f){let y=oo(p.getTextContent());y.setFormat(r),p.replace(y),p=y}else if(!this.isCollapsed()&&t!==""){let y=h.getParent();if(!g.canInsertTextBefore()||!g.canInsertTextAfter()||re(y)&&(!y.canInsertTextBefore()||!y.canInsertTextAfter()))return this.insertText(""),XL(this.anchor,this.focus),void this.insertText(t)}if(m===1){if(ia(p)){let b=oo(t);return b.select(),void p.replace(b)}let y=p.getFormat(),x=p.getStyle();if(d!==c||y===r&&x===a){if(Fy(p)){let b=oo(t);return b.setFormat(r),b.setStyle(a),b.select(),void p.replace(b)}}else{if(p.getTextContent()!==""){let b=oo(t);if(b.setFormat(r),b.setStyle(a),b.select(),d===0)p.insertBefore(b,!1);else{let[L]=p.splitText(d);L.insertAfter(b,!1)}return void(b.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=t.length))}p.setFormat(r),p.setStyle(a)}let C=c-d;p=p.spliceText(d,C,t,!0),p.getTextContent()===""?p.remove():this.anchor.type==="text"&&(this.format=y,this.style=x,p.isComposing()&&(this.anchor.offset-=t.length))}else{let y=new Set([...p.getParentKeys(),...h.getParentKeys()]),x=re(p)?p:p.getParentOrThrow(),C=re(h)?h:h.getParentOrThrow(),b=h;if(!x.is(C)&&C.isInline())do b=C,C=C.getParentOrThrow();while(C.isInline());if(i.type==="text"&&(c!==0||h.getTextContent()==="")||i.type==="element"&&h.getIndexWithinParent()<c)if(ke(h)&&!ia(h)&&c!==h.getTextContentSize()){if(h.isSegmented()){let T=oo(h.getTextContent());h.replace(T),h=T}lo(i.getNode())||i.type!=="text"||(h=h.spliceText(0,c,"")),y.add(h.__key)}else{let T=h.getParentOrThrow();T.canBeEmpty()||T.getChildrenSize()!==1?h.remove():T.remove()}else y.add(h.__key);let L=C.getChildren(),w=new Set(u),k=x.is(C),I=x.isInline()&&p.getNextSibling()===null?x:p;for(let T=L.length-1;T>=0;T--){let S=L[T];if(S.is(p)||re(S)&&S.isParentOf(p))break;S.isAttached()&&(!w.has(S)||S.is(b)?k||I.insertAfter(S,!1):S.remove())}if(!k){let T=C,S=null;for(;T!==null;){let P=T.getChildren(),A=P.length;(A===0||P[A-1].is(S))&&(y.delete(T.__key),S=T),T=T.getParent()}}if(ia(p))if(d===f)p.select();else{let T=oo(t);T.select(),p.replace(T)}else p=p.spliceText(d,f-d,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 T=1;T<m;T++){let S=u[T],P=S.__key;y.has(P)||S.remove()}}}removeText(){let t=Je()===this;ac(this,AP(xy(this))),t&&Je()!==this&&$o(this)}formatText(t,o=null){if(this.isCollapsed())return this.toggleFormat(t),void ro(null);let n=this.getNodes(),r=[];for(let L of n)ke(L)&&r.push(L);let a=L=>{n.forEach(w=>{if(re(w)){let k=w.getFormatFlags(t,L);w.setTextFormat(k)}})},s=r.length;if(s===0)return this.toggleFormat(t),ro(null),void a(o);let i=this.anchor,d=this.focus,c=this.isBackward(),u=c?d:i,m=c?i:d,p=0,f=r[0],g=u.type==="element"?0:u.offset;if(u.type==="text"&&g===f.getTextContentSize()&&(p=1,f=r[1],g=0),f==null)return;let h=f.getFormatFlags(t,o);a(h);let y=s-1,x=r[y],C=m.type==="text"?m.offset:x.getTextContentSize();if(f.is(x)){if(g===C)return;if(Ir(f)||g===0&&C===f.getTextContentSize())f.setFormat(h);else{let L=f.splitText(g,C),w=g===0?L[0]:L[1];w.setFormat(h),u.type==="text"&&u.set(w.__key,0,"text"),m.type==="text"&&m.set(w.__key,C-g,"text")}return void(this.format=h)}g===0||Ir(f)||([,f]=f.splitText(g),g=0),f.setFormat(h);let b=x.getFormatFlags(t,h);C>0&&(C===x.getTextContentSize()||Ir(x)||([x]=x.splitText(C)),x.setFormat(b));for(let L=p+1;L<y;L++){let w=r[L],k=w.getFormatFlags(t,b);w.setFormat(k)}u.type==="text"&&u.set(f.__key,g,"text"),m.type==="text"&&m.set(x.__key,C,"text"),this.format=h|b}insertNodes(t){if(t.length===0)return;if(this.isCollapsed()||this.removeText(),this.anchor.key==="root"){this.insertParagraph();let g=Je();return Oe(g)||le(134),g.insertNodes(t)}let o=(this.isBackward()?this.focus:this.anchor).getNode(),n=nc(o,kr),r=t[t.length-1];if(re(n)&&"__language"in n){if("__language"in t[0])this.insertText(t[0].getTextContent());else{let g=Hh(this);n.splice(g,0,t),r.selectEnd()}return}if(!t.some(g=>(re(g)||yt(g))&&!g.isInline())){re(n)||le(211,o.constructor.name,o.getType());let g=Hh(this);return n.splice(g,0,t),void r.selectEnd()}let a=(function(g){let h=Lr(),y=null;for(let x=0;x<g.length;x++){let C=g[x],b=cs(C);if(b||yt(C)&&C.isInline()||re(C)&&C.isInline()||ke(C)||C.isParentRequired()){if(y===null&&(y=C.createParentElementNode(),h.append(y),b))continue;y!==null&&y.append(C)}else h.append(C),y=null}return h})(t),s=a.getLastDescendant(),i=a.getChildren(),d=!re(n)||!n.isEmpty()?this.insertParagraph():null,c=i[i.length-1],u=i[0];var m;re(m=u)&&kr(m)&&!m.isEmpty()&&re(n)&&(!n.isEmpty()||n.canMergeWhenEmpty())&&(re(n)||le(211,o.constructor.name,o.getType()),n.append(...u.getChildren()),u=i[1]),u&&(n===null&&le(212,o.constructor.name,o.getType()),(function(g,h){let y=h.getParentOrThrow().getLastChild(),x=h,C=[h];for(;x!==y;)x.getNextSibling()||le(140),x=x.getNextSibling(),C.push(x);let b=g;for(let L of C)b=b.insertAfter(L)})(n,u));let p=nc(s,kr);d&&re(p)&&(d.canMergeWhenEmpty()||kr(c))&&(p.append(...d.getChildren()),d.remove()),re(n)&&n.isEmpty()&&n.remove(),s.selectEnd();let f=re(n)?n.getLastChild():null;cs(f)&&p!==n&&f.remove()}insertParagraph(){if(this.anchor.key==="root"){let s=Lr();return Yo().splice(this.anchor.offset,0,[s]),s.select(),s}let t=Hh(this),o=nc(this.anchor.getNode(),kr);re(o)||le(213);let n=o.getChildAtIndex(t),r=n?[n,...n.getNextSiblings()]:[],a=o.insertNewAfter(this,!1);return a?(a.append(...r),a.selectStart(),a):null}insertLineBreak(t){let o=Di();if(this.insertNodes([o]),t){let n=o.getParentOrThrow(),r=o.getIndexWithinParent();n.select(r,r)}}extract(){let t=[...this.getNodes()],o=t.length,n=t[0],r=t[o-1],[a,s]=py(this),i=this.isBackward(),[d,c]=i?[this.focus,this.anchor]:[this.anchor,this.focus],[u,m]=i?[s,a]:[a,s];if(o===0)return[];if(o===1){if(ke(n)&&!this.isCollapsed()){let p=n.splitText(u,m),f=u===0?p[0]:p[1];return f?(d.set(f.getKey(),0,"text"),c.set(f.getKey(),f.getTextContentSize(),"text"),[f]):[]}return[n]}if(ke(n)&&(u===n.getTextContentSize()?t.shift():u!==0&&([,n]=n.splitText(u),t[0]=n,d.set(n.getKey(),0,"text"))),ke(r)){let p=r.getTextContent().length;m===0?t.pop():m!==p&&([r]=r.splitText(m),t[t.length-1]=r,c.set(r.getKey(),r.getTextContentSize(),"text"))}return t}modify(t,o,n){if(B0(this,t,o,n))return;let r=t==="move",a=mt(),s=An(Jo(a));if(!s)return;let i=a._blockCursorElement,d=a._rootElement,c=this.focus.getNode();if(d===null||i===null||!re(c)||c.isInline()||c.canBeEmpty()||gy(i,a,d),this.dirty){let u=Bi(a,this.anchor.key),m=Bi(a,this.focus.key);this.anchor.type==="text"&&(u=gs(u)),this.focus.type==="text"&&(m=gs(m)),u&&m&&eP(s,u,this.anchor.offset,m,this.focus.offset)}if((function(u,m,p,f){u.modify(m,p,f)})(s,t,o?"backward":"forward",n),s.rangeCount>0){let u=s.getRangeAt(0),m=this.anchor.getNode(),p=lo(m)?m:wP(m);if(this.applyDOMRange(u),this.dirty=!0,!r){let f=this.getNodes(),g=[],h=!1;for(let y=0;y<f.length;y++){let x=f[y];Tm(x,p)?g.push(x):h=!0}if(h&&g.length>0)if(o){let y=g[0];re(y)?y.selectStart():y.getParentOrThrow().selectStart()}else{let y=g[g.length-1];re(y)?y.selectEnd():y.getParentOrThrow().selectEnd()}s.anchorNode===u.startContainer&&s.anchorOffset===u.startOffset||(function(y){let x=y.focus,C=y.anchor,b=C.key,L=C.offset,w=C.type;C.set(x.key,x.offset,x.type,!0),x.set(b,L,w,!0)})(this)}}n==="lineboundary"&&B0(this,t,o,n,"decorators")}forwardDeletion(t,o,n){if(!n&&(t.type==="element"&&re(o)&&t.offset===o.getChildrenSize()||t.type==="text"&&t.offset===o.getTextContentSize())){let r=o.getParent(),a=o.getNextSibling()||(r===null?null:r.getNextSibling());if(re(a)&&a.isShadowRoot())return!0}return!1}deleteCharacter(t){let o=this.isCollapsed();if(this.isCollapsed()){let n=this.anchor,r=n.getNode();if(this.forwardDeletion(n,r,t))return;let a=nv(fa(n,t?"previous":"next"));if(a.getTextSlices().every(i=>i===null||i.distance===0)){let i={type:"initial"};for(let d of a.iterNodeCarets("shadowRoot"))if(Pn(d)){if(!d.origin.isInline()){if(d.origin.isShadowRoot()){if(i.type==="merge-block")break;if(re(a.anchor.origin)&&a.anchor.origin.isEmpty()){let c=kn(d);ac(this,ma(c,c)),a.anchor.origin.remove()}return}i.type!=="merge-next-block"&&i.type!=="merge-block"||(i={block:i.block,caret:d,type:"merge-block"})}}else{if(i.type==="merge-block")break;if(hs(d)){if(re(d.origin)){if(d.origin.isInline()){if(!d.origin.isParentOf(a.anchor.origin))break}else i={block:d.origin,type:"merge-next-block"};continue}if(yt(d.origin)){if(!d.origin.isIsolated())if(i.type==="merge-next-block"&&(d.origin.isKeyboardSelectable()||!d.origin.isInline())&&re(a.anchor.origin)&&a.anchor.origin.isEmpty()){a.anchor.origin.remove();let c=By();c.add(d.origin.getKey()),$o(c)}else d.origin.remove();return}break}}if(i.type==="merge-block"){let{caret:d,block:c}=i;return ac(this,ma(!d.origin.isEmpty()&&c.isEmpty()?Gi(io(c,d.direction)):a.anchor,d)),this.removeText()}}let s=this.focus;if(this.modify("extend",t,"character"),this.isCollapsed()){if(t&&n.offset===0&&M0(this,n.getNode()))return}else{let i=s.type==="text"?s.getNode():null;if(r=n.type==="text"?n.getNode():null,i!==null&&i.isSegmented()){let d=s.offset,c=i.getTextContentSize();if(i.is(r)||t&&d!==c||!t&&d!==0)return void A0(i,t,d)}else if(r!==null&&r.isSegmented()){let d=n.offset,c=r.getTextContentSize();if(r.is(i)||t&&d!==0||!t&&d!==c)return void A0(r,t,d)}(function(d,c){let u=d.anchor,m=d.focus,p=u.getNode(),f=m.getNode();if(p===f&&u.type==="text"&&m.type==="text"){let g=u.offset,h=m.offset,y=g<h,x=y?g:h,C=y?h:g,b=C-1;x!==b&&(function(L){return!(gP(L)||s5(L))})(p.getTextContent().slice(x,C))&&(c?m.set(m.key,b,m.type):u.set(u.key,b,u.type))}})(this,t)}}if(this.removeText(),t&&!o&&this.isCollapsed()&&this.anchor.type==="element"&&this.anchor.offset===0){let n=this.anchor.getNode();n.isEmpty()&&lo(n.getParent())&&n.getPreviousSibling()===null&&M0(this,n)}}deleteLine(t){this.isCollapsed()&&this.modify("extend",t,"lineboundary"),this.isCollapsed()?this.deleteCharacter(t):this.removeText()}deleteWord(t){if(this.isCollapsed()){let o=this.anchor,n=o.getNode();if(this.forwardDeletion(o,n,t))return;this.modify("extend",t,"word")}this.removeText()}isBackward(){return this.focus.isBefore(this.anchor)}getStartEndPoints(){return[this.anchor,this.focus]}};function vc(e){return e instanceof vm}function E0(e){let t=e.offset;if(e.type==="text")return t;let o=e.getNode();return t===o.getChildrenSize()?o.getTextContent().length:0}function py(e){let t=e.getStartEndPoints();if(t===null)return[0,0];let[o,n]=t;return o.type==="element"&&n.type==="element"&&o.key===n.key&&o.offset===n.offset?[0,0]:[E0(o),E0(n)]}function M0(e,t){for(let o=t;o;o=o.getParent()){if(re(o)){if(o.collapseAtStart(e))return!0;if(pn(o))break}if(o.getPreviousSibling())break}return!1}var s5=(()=>{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 A0(e,t,o){let n=e,r=n.getTextContent().split(/(?=\s)/g),a=r.length,s=0,i=0;for(let c=0;c<a;c++){let u=c===a-1;if(i=s,s+=r[c].length,t&&s===o||s>o||u){r.splice(c,1),u&&(i=void 0);break}}let d=r.join("").trim();d===""?n.remove():(n.setTextContent(d),n.select(i,i))}function N0(e,t,o,n){let r,a=t;if(ko(e)){let s=!1,i=e.childNodes,d=i.length,c=n._blockCursorElement;a===d&&(s=!0,a=d-1);let u=i[a],m=!1;if(u===c)u=i[a+1],m=!0;else if(c!==null){let p=c.parentNode;e===p&&t>Array.prototype.indexOf.call(p.children,c)&&a--}if(r=Ri(u),ke(r))a=Rn(r,s?"next":"previous");else{let p=Ri(e);if(p===null)return null;if(re(p)){let f=n.getElementByKey(p.getKey());f===null&&le(214),[p,a]=p.getDOMSlot(f).resolveChildIndex(p,f,e,t),re(p)||le(215),s&&a>=p.getChildrenSize()&&(a=Math.max(0,p.getChildrenSize()-1));let h=p.getChildAtIndex(a);if(re(h)&&(function(y,x,C){let b=y.getParent();return C===null||b===null||!b.canBeEmpty()||b!==C.getNode()})(h,0,o)){let y=s?h.getLastDescendant():h.getFirstDescendant();y===null?p=h:(h=y,p=re(h)?h:h.getParentOrThrow()),a=0}ke(h)?(r=h,p=null,a=Rn(h,s?"next":"previous")):h!==p&&s&&!m&&(re(p)||le(216),a=Math.min(p.getChildrenSize(),a+1))}else{let f=p.getIndexWithinParent();a=t===0&&yt(p)&&Ri(e)===p?f:f+1,p=p.getParentOrThrow()}if(re(p))return En(p.__key,a,"element")}}else r=Ri(e);return ke(r)?En(r.__key,Rn(r,a,"clamp"),"text"):null}function D0(e,t,o){let n=e.offset,r=e.getNode();if(n===0){let a=r.getPreviousSibling(),s=r.getParent();if(t){if((o||!t)&&a===null&&re(s)&&s.isInline()){let i=s.getPreviousSibling();ke(i)&&e.set(i.__key,i.getTextContent().length,"text")}}else re(a)&&!o&&a.isInline()?e.set(a.__key,a.getChildrenSize(),"element"):ke(a)&&e.set(a.__key,a.getTextContent().length,"text")}else if(n===r.getTextContent().length){let a=r.getNextSibling(),s=r.getParent();if(t&&re(a)&&a.isInline())e.set(a.__key,0,"element");else if((o||t)&&a===null&&re(s)&&s.isInline()&&!s.canInsertTextAfter()){let i=s.getNextSibling();ke(i)&&e.set(i.__key,0,"text")}}}function XL(e,t,o){if(e.type==="text"&&t.type==="text"){let n=e.isBefore(t),r=e.is(t);D0(e,n,r),D0(t,!n,r),r&&t.set(e.key,e.offset,e.type)}}function YL(e,t,o,n,r,a){if(e===null||o===null||!Cc(r,e,o))return null;let s=N0(e,t,Oe(a)?a.anchor:null,r);if(s===null)return null;let i=N0(o,n,Oe(a)?a.focus:null,r);if(i===null)return null;if(s.type==="element"&&i.type==="element"){let d=Ri(e),c=Ri(o);if(yt(d)&&yt(c))return null}return XL(s,i),[s,i]}function i5(e){return re(e)&&!e.isInline()}function JL(e,t,o,n,r,a){let s=Er(),i=new fs(En(e,t,r),En(o,n,a),0,"");return i.dirty=!0,s._selection=i,i}function ZL(){let e=En("root",0,"element"),t=En("root",0,"element");return new fs(e,t,0,"")}function By(){return new vm(new Set)}function l5(e,t){return Em(null,e,t,null)}function Em(e,t,o,n){let r=o._window;if(r===null)return null;let a=n||r.event,s=a?a.type:void 0,i=s==="selectionchange",d=!Gh&&(i||s==="beforeinput"||s==="compositionstart"||s==="compositionend"||s==="click"&&a&&a.detail===3||s==="drop"||s===void 0),c,u,m,p;if(Oe(e)&&!d)return e.clone();if(t===null)return null;if(c=t.anchorNode,u=t.focusNode,m=t.anchorOffset,p=t.focusOffset,(i||s===void 0)&&Oe(e)&&!Cc(o,c,u))return e.clone();let f=YL(c,m,u,p,o,e);if(f===null)return null;let[g,h]=f,y=0,x="";if(Oe(e)){let C=e.anchor;if(g.key===C.key)y=e.format,x=e.style;else{let b=g.getNode();ke(b)?(y=b.getFormat(),x=b.getStyle()):re(b)&&(y=b.getTextFormat(),x=b.getTextStyle())}}return new fs(g,h,y,x)}function Je(){return Er()._selection}function ys(){return mt()._editorState._selection}function Cm(e,t,o,n=1){let r=e.anchor,a=e.focus,s=r.getNode(),i=a.getNode();if(!t.is(s)&&!t.is(i))return;let d=t.__key;if(e.isCollapsed()){let c=r.offset;if(o<=c&&n>0||o<c&&n<0){let u=Math.max(0,c+n);r.set(d,u,"element"),a.set(d,u,"element"),_0(e)}}else{let c=e.isBackward(),u=c?a:r,m=u.getNode(),p=c?r:a,f=p.getNode();if(t.is(m)){let g=u.offset;(o<=g&&n>0||o<g&&n<0)&&u.set(d,Math.max(0,g+n),"element")}if(t.is(f)){let g=p.offset;(o<=g&&n>0||o<g&&n<0)&&p.set(d,Math.max(0,g+n),"element")}}_0(e)}function _0(e){let t=e.anchor,o=t.offset,n=e.focus,r=n.offset,a=t.getNode(),s=n.getNode();if(e.isCollapsed()){if(!re(a))return;let i=a.getChildrenSize(),d=o>=i,c=d?a.getChildAtIndex(i-1):a.getChildAtIndex(o);if(ke(c)){let u=0;d&&(u=c.getTextContentSize()),t.set(c.__key,u,"text"),n.set(c.__key,u,"text")}return}if(re(a)){let i=a.getChildrenSize(),d=o>=i,c=d?a.getChildAtIndex(i-1):a.getChildAtIndex(o);if(ke(c)){let u=0;d&&(u=c.getTextContentSize()),t.set(c.__key,u,"text")}}if(re(s)){let i=s.getChildrenSize(),d=r>=i,c=d?s.getChildAtIndex(i-1):s.getChildAtIndex(r);if(ke(c)){let u=0;d&&(u=c.getTextContentSize()),n.set(c.__key,u,"text")}}}function xm(e,t,o,n,r){let a=null,s=0,i=null;n!==null?(a=n.__key,ke(n)?(s=n.getTextContentSize(),i="text"):re(n)&&(s=n.getChildrenSize(),i="element")):r!==null&&(a=r.__key,ke(r)?i="text":re(r)&&(i="element")),a!==null&&i!==null?e.set(a,s,i):(s=t.getIndexWithinParent(),s===-1&&(s=o.getChildrenSize()),e.set(o.__key,s,"element"))}function O0(e,t,o,n,r){e.type==="text"?e.set(o,e.offset+(t?0:r),"text"):e.offset>n.getIndexWithinParent()&&e.set(e.key,e.offset-1,"element")}function eP(e,t,o,n,r){try{e.setBaseAndExtent(t,o,n,r)}catch{}}function F0(e,t,o){let n=Bi(e,t.getKey());if(re(t)){let r=t.getDOMSlot(n);return[r.element,o+r.getFirstChildOffset()]}return[n,o]}function d5(e,t,o,n,r,a,s){let i=n.anchorNode,d=n.focusNode,c=n.anchorOffset,u=n.focusOffset,m=document.activeElement;if(r.has(KL)&&m!==a||m!==null&&qy(m))return;if(!Oe(t))return void(e!==null&&Cc(o,i,d)&&n.removeAllRanges());let p=t.anchor,f=t.focus,g=p.getNode(),h=f.getNode(),[y,x]=F0(o,g,p.offset),[C,b]=F0(o,h,f.offset),L=t.format,w=t.style,k=t.isCollapsed(),I=y,T=C,S=!1;var P,A,N,B,O;if(p.type==="text"?(I=gs(y),S=g.getFormat()!==L||g.getStyle()!==w):Oe(e)&&e.anchor.type==="text"&&(S=!0),f.type==="text"&&(T=gs(C)),I!==null&&T!==null&&(k&&(e===null||S||Oe(e)&&(e.format!==L||e.style!==w))&&(P=L,A=w,N=x,B=p.key,O=performance.now(),OL=[P,A,N,B,O]),c!==x||u!==b||i!==I||d!==T||n.type==="Range"&&k||(m!==null&&a.contains(m)||r.has(cy)||a.focus({preventScroll:!0}),p.type==="element"))){if(eP(n,I,x,T,b),!da||!t.isCollapsed()||a===null||r.has(cy)||document.activeElement!==null&&a.contains(document.activeElement)||a.focus({preventScroll:!0}),!r.has(qL)&&t.isCollapsed()&&a!==null&&a===document.activeElement){let j=Oe(t)&&t.anchor.type==="element"?I.childNodes[x]||null:n.rangeCount>0?n.getRangeAt(0):null;if(j!==null){let U;if(j instanceof Text){let D=document.createRange();D.selectNode(j),U=D.getBoundingClientRect()}else U=j.getBoundingClientRect();(function(D,J,G){let M=Yy(G),X=Jy(M);if(M===null||X===null)return;let{top:F,bottom:ee}=J,Y=0,ae=0,te=G;for(;te!==null;){let de=te===M.body;if(de)Y=0,ae=Jo(D).innerHeight;else{let ne=te.getBoundingClientRect();Y=ne.top,ae=ne.bottom}let ge=0;if(F<Y?ge=-(Y-F):ee>ae&&(ge=ee-ae),ge!==0)if(de)X.scrollBy(0,ge);else{let ne=te.scrollTop;te.scrollTop+=ge;let Z=te.scrollTop-ne;F-=Z,ee-=Z}if(de)break;te=bc(te)}})(o,U,a)}}iy=!0}}function c5(e){let t=Je()||ys();t===null&&(t=Yo().selectEnd()),t.insertNodes(e)}function u5(){let e=Je();return e===null?"":e.getTextContent()}function Hh(e){let t=e;e.isCollapsed()||t.removeText();let o=Je();Oe(o)&&(t=o),Oe(t)||le(161);let n=t.anchor,r=n.getNode(),a=n.offset;for(;!kr(r);){let s=r;if([r,a]=p5(r,a),s.is(r))break}return a}function p5(e,t){let o=e.getParent();if(!o){let r=Lr();return Yo().append(r),r.select(),[Yo(),0]}if(ke(e)){let r=e.splitText(t);if(r.length===0)return[o,e.getIndexWithinParent()];let a=t===0?0:1;return[o,r[0].getIndexWithinParent()+a]}if(!re(e)||t===0)return[o,e.getIndexWithinParent()];let n=e.getChildAtIndex(t);if(n){let r=new fs(En(e.__key,t,"element"),En(e.__key,t,"element"),0,""),a=e.insertNewAfter(r);a&&a.append(n,...n.getNextSiblings())}return[o,e.getIndexWithinParent()+1]}function B0(e,t,o,n,r="decorators-and-blocks"){if(t==="move"&&n==="character"&&!e.isCollapsed()){let[u,m]=o===e.isBackward()?[e.focus,e.anchor]:[e.anchor,e.focus];return m.set(u.key,u.offset,u.type),!0}let a=fa(e.focus,o?"previous":"next"),s=n==="lineboundary",i=t==="move",d=a,c=r==="decorators-and-blocks";if(!NP(d)){for(let u of d){c=!1;let{origin:m}=u;if(!yt(m)||m.isIsolated()||(d=u,!s||!m.isInline()))break}if(c)for(let u of nv(a).iterNodeCarets(t==="extend"?"shadowRoot":"root")){if(Pn(u))u.origin.isInline()||(d=u);else{if(re(u.origin))continue;yt(u.origin)&&!u.origin.isInline()&&(d=u)}break}}if(d===a)return!1;if(i&&!s&&yt(d.origin)&&d.origin.isKeyboardSelectable()){let u=By();return u.add(d.origin.getKey()),$o(u),!0}return d=kn(d),i&&Ki(e.anchor,d),Ki(e.focus,d),c||!s}var ao=null,so=null,Uo=!1,Uh=!1,sm=0,H0={characterData:!0,childList:!0,subtree:!0};function qi(){return Uo||ao!==null&&ao._readOnly}function no(){Uo&&le(13)}function tP(){sm>99&&le(14)}function Er(){return ao===null&&le(195,oP()),ao}function mt(){return so===null&&le(196,oP()),so}function oP(){let e=0,t=new Set,o=ua.version;if(typeof window<"u")for(let r of document.querySelectorAll("[contenteditable]")){let a=xc(r);if(Am(a))e++;else if(a){let s=String(a.constructor.version||"<0.17.1");s===o&&(s+=" (separately built, likely a bundler configuration issue)"),t.add(s)}}let n=` Detected on the page: ${e} compatible editor(s) with version ${o}`;return t.size&&(n+=` and incompatible editors with versions ${Array.from(t).join(", ")}`),n}function m5(){return so}function U0(e,t,o){let n=t.__type,r=zy(e,n),a=o.get(n);a===void 0&&(a=Array.from(r.transforms),o.set(n,a));let s=a.length;for(let i=0;i<s&&(a[i](t),t.isAttached());i++);}function $0(e,t){return e!==void 0&&e.__key!==t&&e.isAttached()}function nP(e,t){if(!t)return;let o=e._updateTags,n=t;Array.isArray(t)||(n=[t]);for(let r of n)o.add(r)}function f5(e){return Hy(e,mt()._nodes)}function Hy(e,t){let o=e.type,n=t.get(o);n===void 0&&le(17,o);let r=n.klass;e.type!==r.getType()&&le(18,r.name);let a=r.importJSON(e),s=e.children;if(re(a)&&Array.isArray(s))for(let i=0;i<s.length;i++){let d=Hy(s[i],t);a.append(d)}return a}function z0(e,t,o){let n=ao,r=Uo,a=so;ao=t,Uo=!0,so=e;try{return o()}finally{ao=n,Uo=r,so=a}}function Sr(e,t){let o=e._pendingEditorState,n=e._rootElement,r=e._headless||n===null;if(o===null)return;let a=e._editorState,s=a._selection,i=o._selection,d=e._dirtyType!==0,c=ao,u=Uo,m=so,p=e._updating,f=e._observer,g=null;if(e._pendingEditorState=null,e._editorState=o,!r&&d&&f!==null){so=e,ao=o,Uo=!1,e._updating=!0;try{let k=e._dirtyType,I=e._dirtyElements,T=e._dirtyLeaves;f.disconnect(),g=NK(a,o,e,k,I,T)}catch(k){if(k instanceof Error&&e._onError(k),Uh)throw k;return iP(e,null,n,o),lL(e),e._dirtyType=2,Uh=!0,Sr(e,a),void(Uh=!1)}finally{f.observe(n,H0),e._updating=p,ao=c,Uo=u,so=m}}o._readOnly||(o._readOnly=!0);let h=e._dirtyLeaves,y=e._dirtyElements,x=e._normalizedNodes,C=e._updateTags,b=e._deferred;d&&(e._dirtyType=0,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements=new Map,e._normalizedNodes=new Set,e._updateTags=new Set),(function(k,I){let T=k._decorators,S=k._pendingDecorators||T,P=I._nodeMap,A;for(A in S)P.has(A)||(S===T&&(S=mP(k)),delete S[A])})(e,o);let L=r?null:An(Jo(e));if(e._editable&&L!==null&&(d||i===null||i.dirty||!i.is(s))&&n!==null&&!C.has(WL)){so=e,ao=o;try{if(f!==null&&f.disconnect(),d||i===null||i.dirty){let k=e._blockCursorElement;k!==null&&gy(k,e,n),d5(s,i,e,L,C,n)}(function(k,I,T){let S=k._blockCursorElement;if(Oe(T)&&T.isCollapsed()&&T.anchor.type==="element"&&I.contains(document.activeElement)){let P=T.anchor,A=P.getNode(),N=P.offset,B=!1,O=null;if(N===A.getChildrenSize())zh(A.getChildAtIndex(N-1))&&(B=!0);else{let j=A.getChildAtIndex(N);if(j!==null&&zh(j)){let U=j.getPreviousSibling();(U===null||zh(U))&&(B=!0,O=k.getElementByKey(j.__key))}}if(B){let j=k.getElementByKey(A.__key);return S===null&&(k._blockCursorElement=S=(function(U){let D=U.theme,J=document.createElement("div");J.contentEditable="false",J.setAttribute("data-lexical-cursor","true");let G=D.blockCursor;if(G!==void 0){if(typeof G=="string"){let M=Ic(G);G=D.blockCursor=M}G!==void 0&&J.classList.add(...G)}return J})(k._config)),I.style.caretColor="transparent",void(O===null?j.appendChild(S):j.insertBefore(S,O))}}S!==null&&gy(S,k,I)})(e,n,i)}finally{f!==null&&f.observe(n,H0),so=m,ao=c}}g!==null&&(function(k,I,T,S,P){let A=Array.from(k._listeners.mutation),N=A.length;for(let B=0;B<N;B++){let[O,j]=A[B];for(let U of j){let D=I.get(U);D!==void 0&&O(D,{dirtyLeaves:S,prevEditorState:P,updateTags:T})}}})(e,g,C,h,a),Oe(i)||i===null||s!==null&&s.is(i)||e.dispatchCommand(Sy,void 0);let w=e._pendingDecorators;w!==null&&(e._decorators=w,e._pendingDecorators=null,oc("decorator",e,!0,w)),(function(k,I,T){let S=G0(I),P=G0(T);S!==P&&oc("textcontent",k,!0,P)})(e,t||a,o),oc("update",e,!0,{dirtyElements:y,dirtyLeaves:h,editorState:o,mutatedNodes:g,normalizedNodes:x,prevEditorState:t||a,tags:C}),(function(k,I){if(k._deferred=[],I.length!==0){let T=k._updating;k._updating=!0;try{for(let S=0;S<I.length;S++)I[S]()}finally{k._updating=T}}})(e,b),(function(k){let I=k._updates;if(I.length!==0){let T=I.shift();if(T){let[S,P]=T;Mm(k,S,P)}}})(e)}function oc(e,t,o,...n){let r=t._updating;t._updating=o;try{let a=Array.from(t._listeners[e]);for(let s=0;s<a.length;s++)a[s].apply(null,n)}finally{t._updating=r}}function K0(e,t){let o=e._updates,n=t||!1;for(;o.length!==0;){let r=o.shift();if(r){let[a,s]=r,i=e._pendingEditorState,d;s!==void 0&&(d=s.onUpdate,s.skipTransforms&&(n=!0),s.discrete&&(i===null&&le(191),i._flushSync=!0),d&&e._deferred.push(d),nP(e,s.tag)),i==null?Mm(e,a,s):a()}}return n}function Mm(e,t,o){let n=e._updateTags,r,a=!1,s=!1;o!==void 0&&(r=o.onUpdate,nP(e,o.tag),a=o.skipTransforms||!1,s=o.discrete||!1),r&&e._deferred.push(r);let i=e._editorState,d=e._pendingEditorState,c=!1;(d===null||d._readOnly)&&(d=e._pendingEditorState=rP(d||i),c=!0),d._flushSync=s;let u=ao,m=Uo,p=so,f=e._updating;ao=d,Uo=!1,e._updating=!0,so=e;let g=e._headless||e.getRootElement()===null;$y(null);try{c&&(g?i._selection!==null&&(d._selection=i._selection.clone()):d._selection=(function(C,b){let L=C.getEditorState()._selection,w=An(Jo(C));return Oe(L)||L==null?Em(L,w,C,b):L.clone()})(e,o&&o.event||null));let y=e._compositionKey;t(),a=K0(e,a),(function(C,b){let L=b.getEditorState()._selection,w=C._selection;if(Oe(w)){let k=w.anchor,I=w.focus,T;if(k.type==="text"&&(T=k.getNode(),T.selectionTransform(L,w)),I.type==="text"){let S=I.getNode();T!==S&&S.selectionTransform(L,w)}}})(d,e),e._dirtyType!==0&&(a?(function(C,b){let L=b._dirtyLeaves,w=C._nodeMap;for(let k of L){let I=w.get(k);ke(I)&&I.isAttached()&&I.isSimpleText()&&!I.isUnmergeable()&&y0(I)}})(d,e):(function(C,b){let L=b._dirtyLeaves,w=b._dirtyElements,k=C._nodeMap,I=sa(),T=new Map,S=L,P=S.size,A=w,N=A.size;for(;P>0||N>0;){if(P>0){b._dirtyLeaves=new Set;for(let B of S){let O=k.get(B);ke(O)&&O.isAttached()&&O.isSimpleText()&&!O.isUnmergeable()&&y0(O),O!==void 0&&$0(O,I)&&U0(b,O,T),L.add(B)}if(S=b._dirtyLeaves,P=S.size,P>0){sm++;continue}}b._dirtyLeaves=new Set,b._dirtyElements=new Map,A.delete("root")&&A.set("root",!0);for(let B of A){let O=B[0],j=B[1];if(w.set(O,j),!j)continue;let U=k.get(O);U!==void 0&&$0(U,I)&&U0(b,U,T)}S=b._dirtyLeaves,P=S.size,A=b._dirtyElements,N=A.size,sm++}b._dirtyLeaves=L,b._dirtyElements=w})(d,e),K0(e),(function(C,b,L,w){let k=C._nodeMap,I=b._nodeMap,T=[];for(let[S]of w){let P=I.get(S);P!==void 0&&(P.isAttached()||(re(P)&&aL(P,S,k,I,T,w),k.has(S)||w.delete(S),T.push(S)))}for(let S of T)I.delete(S);for(let S of L){let P=I.get(S);P===void 0||P.isAttached()||(k.has(S)||L.delete(S),I.delete(S))}})(i,d,e._dirtyLeaves,e._dirtyElements)),y!==e._compositionKey&&(d._flushSync=!0);let x=d._selection;if(Oe(x)){let C=d._nodeMap,b=x.anchor.key,L=x.focus.key;C.get(b)!==void 0&&C.get(L)!==void 0||le(19)}else vc(x)&&x._nodes.size===0&&(d._selection=null)}catch(y){return y instanceof Error&&e._onError(y),e._pendingEditorState=i,e._dirtyType=2,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements.clear(),void Sr(e)}finally{ao=u,Uo=m,so=p,e._updating=f,sm=0}e._dirtyType!==0||e._deferred.length>0||(function(y,x){let C=x.getEditorState()._selection,b=y._selection;if(b!==null){if(b.dirty||!b.is(C))return!0}else if(C!==null)return!0;return!1})(d,e)?d._flushSync?(d._flushSync=!1,Sr(e)):c&&T5(()=>{Sr(e)}):(d._flushSync=!1,c&&(n.clear(),e._deferred=[],e._pendingEditorState=null))}function or(e,t,o){so===e&&o===void 0?t():Mm(e,t,o)}var my=class e{element;before;after;constructor(t,o,n){this.element=t,this.before=o||null,this.after=n||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 o=this.before||this.getManagedLineBreak();return o!==null&&o.parentElement!==this.element&&le(222),this.element.insertBefore(t,o),this}removeChild(t){return t.parentElement!==this.element&&le(223),this.element.removeChild(t),this}replaceChild(t,o){return o.parentElement!==this.element&&le(224),this.element.replaceChild(t,o),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 o=t==="decorator"&&(km||yc||Sm);this.insertManagedLineBreak(o)}}removeManagedLineBreak(){let t=this.getManagedLineBreak();if(t){let o=this.element,n=t.nodeName==="IMG"?t.nextSibling:null;n&&o.removeChild(n),o.removeChild(t),o.__lexicalLineBreak=void 0}}insertManagedLineBreak(t){let o=this.getManagedLineBreak();if(o){if(t===(o.nodeName==="IMG"))return;this.removeManagedLineBreak()}let n=this.element,r=this.before,a=document.createElement("br");if(n.insertBefore(a,r),t){let s=document.createElement("img");s.setAttribute("data-lexical-linebreak","true"),s.style.cssText="display: inline !important; border: 0px !important; margin: 0px !important;",s.alt="",n.insertBefore(s,a),n.__lexicalLineBreak=s}else n.__lexicalLineBreak=a}getFirstChildOffset(){let t=0;for(let o=this.after;o!==null;o=o.previousSibling)t++;return t}resolveChildIndex(t,o,n,r){if(n===this.element){let d=this.getFirstChildOffset();return[t,Math.min(d+t.getChildrenSize(),Math.max(d,r))]}let a=q0(o,n);a.push(r);let s=q0(o,this.element),i=t.getIndexWithinParent();for(let d=0;d<s.length;d++){let c=a[d],u=s[d];if(c===void 0||c<u)break;if(c>u){i+=1;break}}return[t.getParentOrThrow(),i]}};function q0(e,t){let o=[],n=t;for(;n!==e&&n!==null;n=n.parentNode){let r=0;for(let a=n.previousSibling;a!==null;a=a.previousSibling)r++;o.push(r)}return n!==e&&le(225),o.reverse()}var ca=class extends un{__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 CK[t]||""}getStyle(){return this.getLatest().__style}getIndent(){return this.getLatest().__indent}getChildren(){let t=[],o=this.getFirstChild();for(;o!==null;)t.push(o),o=o.getNextSibling();return t}getChildrenKeys(){let t=[],o=this.getFirstChild();for(;o!==null;)t.push(o.__key),o=o.getNextSibling();return t}getChildrenSize(){return this.getLatest().__size}isEmpty(){return this.getChildrenSize()===0}isDirty(){let t=mt()._dirtyElements;return t!==null&&t.has(this.__key)}isLastChild(){let t=this.getLatest(),o=this.getParentOrThrow().getLastChild();return o!==null&&o.is(t)}getAllTextNodes(){let t=[],o=this.getFirstChild();for(;o!==null;){if(ke(o)&&t.push(o),re(o)){let n=o.getAllTextNodes();t.push(...n)}o=o.getNextSibling()}return t}getFirstDescendant(){let t=this.getFirstChild();for(;re(t);){let o=t.getFirstChild();if(o===null)break;t=o}return t}getLastDescendant(){let t=this.getLastChild();for(;re(t);){let o=t.getLastChild();if(o===null)break;t=o}return t}getDescendantByIndex(t){let o=this.getChildren(),n=o.length;if(t>=n){let a=o[n-1];return re(a)&&a.getLastDescendant()||a||null}let r=o[t];return re(r)&&r.getFirstDescendant()||r||null}getFirstChild(){let t=this.getLatest().__first;return t===null?null:Vt(t)}getFirstChildOrThrow(){let t=this.getFirstChild();return t===null&&le(45,this.__key),t}getLastChild(){let t=this.getLatest().__last;return t===null?null:Vt(t)}getLastChildOrThrow(){let t=this.getLastChild();return t===null&&le(96,this.__key),t}getChildAtIndex(t){let o=this.getChildrenSize(),n,r;if(t<o/2){for(n=this.getFirstChild(),r=0;n!==null&&r<=t;){if(r===t)return n;n=n.getNextSibling(),r++}return null}for(n=this.getLastChild(),r=o-1;n!==null&&r>=t;){if(r===t)return n;n=n.getPreviousSibling(),r--}return null}getTextContent(){let t="",o=this.getChildren(),n=o.length;for(let r=0;r<n;r++){let a=o[r];t+=a.getTextContent(),re(a)&&r!==n-1&&!a.isInline()&&(t+=Lm)}return t}getTextContentSize(){let t=0,o=this.getChildren(),n=o.length;for(let r=0;r<n;r++){let a=o[r];t+=a.getTextContentSize(),re(a)&&r!==n-1&&!a.isInline()&&(t+=2)}return t}getDirection(){return this.getLatest().__dir}getTextFormat(){return this.getLatest().__textFormat}hasFormat(t){if(t!==""){let o=Wh[t];return(this.getFormat()&o)!==0}return!1}hasTextFormat(t){let o=xo[t];return(this.getTextFormat()&o)!==0}getFormatFlags(t,o){return gc(this.getLatest().__textFormat,t,o)}getTextStyle(){return this.getLatest().__textStyle}select(t,o){no();let n=Je(),r=t,a=o,s=this.getChildrenSize();if(!this.canBeEmpty()){if(t===0&&o===0){let d=this.getFirstChild();if(ke(d)||re(d))return d.select(0,0)}else if(!(t!==void 0&&t!==s||o!==void 0&&o!==s)){let d=this.getLastChild();if(ke(d)||re(d))return d.select()}}r===void 0&&(r=s),a===void 0&&(a=s);let i=this.__key;return Oe(n)?(n.anchor.set(i,r,"element"),n.focus.set(i,a,"element"),n.dirty=!0,n):JL(i,r,i,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(o=>o.remove()),t}append(...t){return this.splice(this.getChildrenSize(),0,t)}setDirection(t){let o=this.getWritable();return o.__dir=t,o}setFormat(t){return this.getWritable().__format=t!==""?Wh[t]:0,this}setStyle(t){return this.getWritable().__style=t||"",this}setTextFormat(t){let o=this.getWritable();return o.__textFormat=t,o}setTextStyle(t){let o=this.getWritable();return o.__textStyle=t,o}setIndent(t){return this.getWritable().__indent=t,this}splice(t,o,n){ym(this)&&le(324,this.__key,this.__type);let r=this.getChildrenSize(),a=this.getWritable();t+o<=r||le(226,String(t),String(o),String(r));let s=a.__key,i=[],d=[],c=this.getChildAtIndex(t+o),u=null,m=r-o+n.length;if(t!==0)if(t===r)u=this.getLastChild();else{let f=this.getChildAtIndex(t);f!==null&&(u=f.getPreviousSibling())}if(o>0){let f=u===null?this.getFirstChild():u.getNextSibling();for(let g=0;g<o;g++){f===null&&le(100);let h=f.getNextSibling(),y=f.__key;la(f.getWritable()),d.push(y),f=h}}let p=u;for(let f of n){p!==null&&f.is(p)&&(u=p=p.getPreviousSibling());let g=f.getWritable();g.__parent===s&&m--,la(g);let h=f.__key;if(p===null)a.__first=h,g.__prev=null;else{let y=p.getWritable();y.__next=h,g.__prev=y.__key}f.__key===s&&le(76),g.__parent=s,i.push(h),p=f}if(t+o===r)p!==null&&(p.getWritable().__next=null,a.__last=p.__key);else if(c!==null){let f=c.getWritable();if(p!==null){let g=p.getWritable();f.__prev=p.__key,g.__next=c.__key}else f.__prev=null}if(a.__size=m,d.length){let f=Je();if(Oe(f)){let g=new Set(d),h=new Set(i),{anchor:y,focus:x}=f;W0(y,g,h)&&xm(y,y.getNode(),this,u,c),W0(x,g,h)&&xm(x,x.getNode(),this,u,c),m!==0||this.canBeEmpty()||pn(this)||this.remove()}}return a}getDOMSlot(t){return new my(t)}exportDOM(t){let{element:o}=super.exportDOM(t);if(ko(o)){let n=this.getIndent();n>0&&(o.style.paddingInlineStart=40*n+"px");let r=this.getDirection();r&&(o.dir=r)}return{element:o}}exportJSON(){let t={children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),...super.exportJSON()},o=this.getTextFormat(),n=this.getTextStyle();return o===0&&n===""||pn(this)||this.getChildren().some(ke)||(o!==0&&(t.textFormat=o),n!==""&&(t.textStyle=n)),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,o){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,o,n){return!1}canMergeWhenEmpty(){return!1}reconcileObservedMutation(t,o){let n=this.getDOMSlot(t),r=n.getFirstChild();for(let a=this.getFirstChild();a;a=a.getNextSibling()){let s=o.getElementByKey(a.getKey());s!==null&&(r==null?(n.insertChild(s),r=s):r!==s&&n.replaceChild(s,r),r=r.nextSibling)}}};function re(e){return e instanceof ca}function W0(e,t,o){let n=e.getNode();for(;n;){let r=n.__key;if(t.has(r)&&!o.has(r))return!0;n=n.getParent()}return!1}var mc=class extends un{decorate(t,o){return null}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}};function yt(e){return e instanceof mc}var Oi=class e extends ca{__cachedText;static getType(){return"root"}static clone(){return new e}constructor(){super("root"),this.__cachedText=null}getTopLevelElementOrThrow(){le(51)}getTextContent(){let t=this.__cachedText;return!qi()&&mt()._dirtyType!==0||t===null?super.getTextContent():t}remove(){le(52)}replace(t){le(53)}insertBefore(t){le(54)}insertAfter(t){le(55)}updateDOM(t,o){return!1}splice(t,o,n){for(let r of n)re(r)||yt(r)||le(282);return super.splice(t,o,n)}static importJSON(t){return Yo().updateFromJSON(t)}collapseAtStart(){return!0}};function lo(e){return e instanceof Oi}function rP(e){return new fc(new Map(e._nodeMap))}function Uy(){return new fc(new Map([["root",new Oi]]))}function aP(e){let t=e.exportJSON(),o=e.constructor;if(t.type!==o.getType()&&le(130,o.name),re(e)){let n=t.children;Array.isArray(n)||le(59,o.name);let r=e.getChildren();for(let a=0;a<r.length;a++){let s=aP(r[a]);n.push(s)}}return t}function g5(e){return e instanceof fc}var fc=class e{_nodeMap;_selection;_flushSync;_readOnly;constructor(t,o){this._nodeMap=t,this._selection=o||null,this._flushSync=!1,this._readOnly=!1}isEmpty(){return this._nodeMap.size===1&&this._selection===null}read(t,o){return z0(o&&o.editor||null,this,t)}clone(t){let o=new e(this._nodeMap,t===void 0?this._selection:t);return o._readOnly=!0,o}toJSON(){return z0(null,this,()=>({root:aP(Yo())}))}},bm=class extends ca{static getType(){return"artificial"}createDOM(t){return document.createElement("div")}},Fi=class e extends ca{static getType(){return"paragraph"}static clone(t){return new e(t.__key)}createDOM(t){let o=document.createElement("p"),n=Ai(t.theme,"paragraph");return n!==void 0&&o.classList.add(...n),o}updateDOM(t,o,n){return!1}static importDOM(){return{p:t=>({conversion:h5,priority:0})}}exportDOM(t){let{element:o}=super.exportDOM(t);if(ko(o)){this.isEmpty()&&o.append(document.createElement("br"));let n=this.getFormatType();n&&(o.style.textAlign=n)}return{element:o}}static importJSON(t){return Lr().updateFromJSON(t)}exportJSON(){let t=super.exportJSON();if(t.textFormat===void 0||t.textStyle===void 0){let o=this.getChildren().find(ke);o?(t.textFormat=o.getFormat(),t.textStyle=o.getStyle()):(t.textFormat=this.getTextFormat(),t.textStyle=this.getTextStyle())}return t}insertNewAfter(t,o){let n=Lr();n.setTextFormat(t.format),n.setTextStyle(t.style);let r=this.getDirection();return n.setDirection(r),n.setFormat(this.getFormatType()),n.setStyle(this.getStyle()),this.insertAfter(n,o),n}collapseAtStart(){let t=this.getChildren();if(t.length===0||ke(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 h5(e){let t=Lr();if(e.style&&(t.setFormat(e.style.textAlign),LP(e,t)),t.getFormatType()===""){let o=e.getAttribute("align");o&&o&&o in Wh&&t.setFormat(o)}return{node:t}}function Lr(){return wc(new Fi)}function sP(e){return e instanceof Fi}var Pi=0,y5=1,v5=2,C5=3,x5=4;function iP(e,t,o,n){let r=e._keyToDOMMap;r.clear(),e._editorState=Uy(),e._pendingEditorState=n,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=""),o!==null&&(o.textContent="",r.set("root",o))}function lP(e){let t=new Set,o=new Set,n=e;for(;n;){let{ownNodeConfig:r}=Tc(n),a=n.transform;if(!o.has(a)){o.add(a);let s=n.transform();s&&t.add(s)}if(r){let s=r.$transform;s&&t.add(s),n=r.extends}else{let s=Object.getPrototypeOf(n);n=s.prototype instanceof un&&s!==un?s:void 0}}return t}function b5(e){let t=e||{},o=m5(),n=t.theme||{},r=e===void 0?o:t.parentEditor||null,a=t.disableEvents||!1,s=Uy(),i=t.namespace||(r!==null?r._config.namespace:hP()),d=t.editorState,c=[Oi,ms,Ni,_i,Fi,bm,...t.nodes||[]],{onError:u,html:m}=t,p=t.editable===void 0||t.editable,f;if(e===void 0&&o!==null)f=o._nodes;else{f=new Map;for(let h=0;h<c.length;h++){let y=c[h],x=null,C=null;if(typeof y!="function"){let w=y;y=w.replace,x=w.with,C=w.withKlass||null}Tc(y);let b=y.getType(),L=lP(y);f.set(b,{exportDOM:m&&m.export?m.export.get(y):void 0,klass:y,replace:x,replaceWithKlass:C,sharedNodeState:dL(c[h]),transforms:L})}}let g=new ua(s,r,f,{disableEvents:a,namespace:i,theme:n},u||console.error,(function(h,y){let x=new Map,C=new Set,b=L=>{Object.keys(L).forEach(w=>{let k=x.get(w);k===void 0&&(k=[],x.set(w,k)),k.push(L[w])})};return h.forEach(L=>{let w=L.klass.importDOM;if(w==null||C.has(w))return;C.add(w);let k=w.call(L.klass);k!==null&&b(k)}),y&&b(y),x})(f,m?m.import:void 0),p,e);return d!==void 0&&(g._pendingEditorState=d,g._dirtyType=2),(function(h){h.registerCommand(ky,KK,Pi),h.registerCommand(Ly,qK,Pi),h.registerCommand(Py,WK,Pi),h.registerCommand(Ry,GK,Pi),h.registerCommand(Ny,jK,Pi)})(g),g}var ua=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,o,n,r,a,s,i,d){this._createEditorArgs=d,this._parentEditor=o,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=n,this._decorators={},this._pendingDecorators=null,this._dirtyType=0,this._cloneNotNeeded=new Set,this._dirtyLeaves=new Set,this._dirtyElements=new Map,this._normalizedNodes=new Set,this._updateTags=new Set,this._observer=null,this._key=hP(),this._onError=a,this._htmlConversions=s,this._editable=i,this._headless=o!==null&&o._headless,this._window=null,this._blockCursorElement=null}isComposing(){return this._compositionKey!=null}registerUpdateListener(t){let o=this._listeners.update;return o.add(t),()=>{o.delete(t)}}registerEditableListener(t){let o=this._listeners.editable;return o.add(t),()=>{o.delete(t)}}registerDecoratorListener(t){let o=this._listeners.decorator;return o.add(t),()=>{o.delete(t)}}registerTextContentListener(t){let o=this._listeners.textcontent;return o.add(t),()=>{o.delete(t)}}registerRootListener(t){let o=this._listeners.root;return t(this._rootElement,null),o.add(t),()=>{t(null,this._rootElement),o.delete(t)}}registerCommand(t,o,n){n===void 0&&le(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&&le(36,String(t));let s=a[n];return s.add(o),()=>{s.delete(o),a.every(i=>i.size===0)&&r.delete(t)}}registerMutationListener(t,o,n){let r=this.resolveRegisteredNodeAfterReplacements(this.getRegisteredNode(t)).klass,a=this._listeners.mutation,s=a.get(o);s===void 0&&(s=new Set,a.set(o,s)),s.add(r);let i=n&&n.skipInitialization;return i!==void 0&&i||this.initializeMutationListener(o,r),()=>{s.delete(r),s.size===0&&a.delete(o)}}getRegisteredNode(t){let o=this._nodes.get(t.getType());return o===void 0&&le(37,t.name),o}resolveRegisteredNodeAfterReplacements(t){for(;t.replaceWithKlass;)t=this.getRegisteredNode(t.replaceWithKlass);return t}initializeMutationListener(t,o){let n=this._editorState,r=yy(n).get(o.getType());if(!r)return;let a=new Map;for(let s of r.keys())a.set(s,"created");a.size>0&&t(a,{dirtyLeaves:new Set,prevEditorState:n,updateTags:new Set(["registerMutationListener"])})}registerNodeTransformToKlass(t,o){let n=this.getRegisteredNode(t);return n.transforms.add(o),n}registerNodeTransform(t,o){let n=this.registerNodeTransformToKlass(t,o),r=[n],a=n.replaceWithKlass;if(a!=null){let s=this.registerNodeTransformToKlass(a,o);r.push(s)}return(function(s,i){let d=yy(s.getEditorState()),c=[];for(let u of i){let m=d.get(u);m&&c.push(m)}c.length!==0&&s.update(()=>{for(let u of c)for(let m of u.keys()){let p=Vt(m);p&&p.markDirty()}},s._pendingEditorState===null?{tag:am}:void 0)})(this,r.map(s=>s.klass.getType())),()=>{r.forEach(s=>s.transforms.delete(o))}}hasNode(t){return this._nodes.has(t.getType())}hasNodes(t){return t.every(this.hasNode.bind(this))}dispatchCommand(t,o){return we(this,t,o)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(t){let o=this._rootElement;if(t!==o){let n=Ai(this._config.theme,"root"),r=this._pendingEditorState||this._editorState;if(this._rootElement=t,iP(this,o,t,r),o!==null&&(this._config.disableEvents||VK(o),n!=null&&o.classList.remove(...n)),t!==null){let a=Jy(t),s=t.style;s.userSelect="text",s.whiteSpace="pre-wrap",s.wordBreak="break-word",t.setAttribute("data-lexical-editor","true"),this._window=a,this._dirtyType=2,lL(this),this._updateTags.add(am),Sr(this),this._config.disableEvents||(function(i,d){let c=i.ownerDocument;sy.set(i,c);let u=gm.get(c)??0;u<1&&c.addEventListener("selectionchange",$L),gm.set(c,u+1),i.__lexicalEditor=d;let m=UL(i);for(let p=0;p<ay.length;p++){let[f,g]=ay[p],h=typeof g=="function"?y=>{I0(y)||(T0(y),(d.isEditable()||f==="click")&&g(y,d))}:y=>{if(I0(y))return;T0(y);let x=d.isEditable();switch(f){case"cut":return x&&we(d,_y,y);case"copy":return we(d,Dy,y);case"paste":return x&&we(d,Ey,y);case"dragstart":return x&&we(d,PL,y);case"dragover":return x&&we(d,RL,y);case"dragend":return x&&we(d,EL,y);case"focus":return x&&we(d,ML,y);case"blur":return x&&we(d,AL,y);case"drop":return x&&we(d,LL,y)}};i.addEventListener(f,h),m.push(()=>{i.removeEventListener(f,h)})}})(t,this),n!=null&&t.classList.add(...n)}else this._window=null,this._updateTags.add(am),Sr(this);oc("root",this,!1,t,o)}}getElementByKey(t){return this._keyToDOMMap.get(t)||null}getEditorState(){return this._editorState}setEditorState(t,o){t.isEmpty()&&le(38);let n=t;n._readOnly&&(n=rP(t),n._selection=t._selection?t._selection.clone():null),iL(this);let r=this._pendingEditorState,a=this._updateTags,s=o!==void 0?o.tag:null;r===null||r.isEmpty()||(s!=null&&a.add(s),Sr(this)),this._pendingEditorState=n,this._dirtyType=2,this._dirtyElements.set("root",!1),this._compositionKey=null,s!=null&&a.add(s),this._updating||Sr(this)}parseEditorState(t,o){return(function(n,r,a){let s=Uy(),i=ao,d=Uo,c=so,u=r._dirtyElements,m=r._dirtyLeaves,p=r._cloneNotNeeded,f=r._dirtyType;r._dirtyElements=new Map,r._dirtyLeaves=new Set,r._cloneNotNeeded=new Set,r._dirtyType=0,ao=s,Uo=!1,so=r,$y(null);try{let g=r._nodes;Hy(n.root,g),a&&a(),s._readOnly=!0}catch(g){g instanceof Error&&r._onError(g)}finally{r._dirtyElements=u,r._dirtyLeaves=m,r._cloneNotNeeded=p,r._dirtyType=f,ao=i,Uo=d,so=c}return s})(typeof t=="string"?JSON.parse(t):t,this,o)}read(t){return Sr(this),this.getEditorState().read(t,{editor:this})}update(t,o){(function(n,r,a){n._updating?n._updates.push([r,a]):Mm(n,r,a)})(this,t,o)}focus(t,o={}){let n=this._rootElement;n!==null&&(n.setAttribute("autocapitalize","off"),or(this,()=>{let r=Je(),a=Yo();r!==null?r.dirty||$o(r.clone()):a.getChildrenSize()!==0&&(o.defaultSelection==="rootStart"?a.selectStart():a.selectEnd()),_m("focus"),bP(()=>{n.removeAttribute("autocapitalize"),t&&t()})}),this._pendingEditorState===null&&n.removeAttribute("autocapitalize"))}blur(){let t=this._rootElement;t!==null&&t.blur();let o=An(this._window);o!==null&&o.removeAllRanges()}isEditable(){return this._editable}setEditable(t){this._editable!==t&&(this._editable=t,oc("editable",this,!0,t))}toJSON(){return{editorState:this._editorState.toJSON()}}};ua.version="0.41.0+prod.esm";var fy=null;function $y(e){fy=e}var dP=1;function w5(){dP=1}function zy(e,t){let o=Ky(e,t);return o===void 0&&le(30,t),o}function Ky(e,t){return e._nodes.get(t)}var T5=typeof queueMicrotask=="function"?queueMicrotask:e=>{Promise.resolve().then(e)};function cP(e){return yt(Dm(e))}function qy(e){let t=document.activeElement;if(!ko(t))return!1;let o=t.nodeName;return yt(Dm(e))&&(o==="INPUT"||o==="TEXTAREA"||t.contentEditable==="true"&&xc(t)==null)}function Cc(e,t,o){let n=e.getRootElement();try{return n!==null&&n.contains(t)&&n.contains(o)&&t!==null&&!qy(t)&&Wy(t)===e}catch{return!1}}function Am(e){return e instanceof ua}function Wy(e){let t=e;for(;t!=null;){let o=xc(t);if(Am(o))return o;t=bc(t)}return null}function xc(e){return e?e.__lexicalEditor:null}function I5(e){return hK.test(e)?"rtl":yK.test(e)?"ltr":null}function ia(e){return Fy(e)||e.isToken()}function Ir(e){return ia(e)||e.isSegmented()}function nr(e){return Wi(e)&&e.nodeType===3}function uP(e){return Wi(e)&&e.nodeType===9}function gs(e){let t=e;for(;t!=null;){if(nr(t))return t;t=t.firstChild}return null}function gc(e,t,o){let n=xo[t];if(o!==null&&(e&n)===(o&n))return e;let r=e^n;return t==="subscript"?r&=~xo.superscript:t==="superscript"?r&=~xo.subscript:t==="lowercase"?(r&=~xo.uppercase,r&=~xo.capitalize):t==="uppercase"?(r&=~xo.lowercase,r&=~xo.capitalize):t==="capitalize"&&(r&=~xo.lowercase,r&=~xo.uppercase),r}function S5(e){return ke(e)||cs(e)||yt(e)}function pP(e,t){let o=(function(){let s=fy;return fy=null,s})();if((t=t||o&&o.__key)!=null)return void(e.__key=t);no(),tP();let n=mt(),r=Er(),a=""+dP++;r._nodeMap.set(a,e),re(e)?n._dirtyElements.set(a,!0):n._dirtyLeaves.add(a),n._cloneNotNeeded.add(a),n._dirtyType=1,e.__key=a}function la(e){let t=e.getParent();if(t!==null){let o=e.getWritable(),n=t.getWritable(),r=e.getPreviousSibling(),a=e.getNextSibling(),s=a!==null?a.__key:null,i=r!==null?r.__key:null,d=r!==null?r.getWritable():null,c=a!==null?a.getWritable():null;r===null&&(n.__first=s),a===null&&(n.__last=i),d!==null&&(d.__next=s),c!==null&&(c.__prev=i),o.__prev=null,o.__next=null,o.__parent=null,n.__size--}}function wm(e){tP(),ym(e)&&le(323,e.__key,e.__type);let t=e.getLatest(),o=t.__parent,n=Er(),r=mt(),a=n._nodeMap,s=r._dirtyElements;o!==null&&(function(d,c,u){let m=d;for(;m!==null;){if(u.has(m))return;let p=c.get(m);if(p===void 0)break;u.set(m,!1),m=p.__parent}})(o,a,s);let i=t.__key;r._dirtyType=1,re(e)?s.set(i,!0):r._dirtyLeaves.add(i)}function ro(e){no();let t=mt(),o=t._compositionKey;if(e!==o){if(t._compositionKey=e,o!==null){let n=Vt(o);n!==null&&n.getWritable()}if(e!==null){let n=Vt(e);n!==null&&n.getWritable()}}}function sa(){return qi()?null:mt()._compositionKey}function Vt(e,t){let o=(t||Er())._nodeMap.get(e);return o===void 0?null:o}function Gy(e,t){let o=Nm(e,mt());return o!==void 0?Vt(o,t):null}function Nm(e,t){return e[`__lexicalKey_${t._key}`]}function Dm(e,t){let o=e;for(;o!=null;){let n=Gy(o,t);if(n!==null)return n;o=bc(o)}return null}function mP(e){let t=e._decorators,o=Object.assign({},t);return e._pendingDecorators=o,o}function G0(e){return e.read(()=>Yo().getTextContent())}function Yo(){return fP(Er())}function fP(e){return e._nodeMap.get("root")}function $o(e){no();let t=Er();e!==null&&(e.dirty=!0,e.setCachedNodes(null)),t._selection=e}function Ri(e){let t=mt(),o=(function(n,r){let a=n;for(;a!=null;){let s=Nm(a,r);if(s!==void 0)return s;a=bc(a)}return null})(e,t);return o===null?e===t.getRootElement()?Vt("root"):null:Vt(o)}function gP(e){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(e)}function jy(e){let t=[],o=e;for(;o!==null;)t.push(o),o=o._parentEditor;return t}function hP(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,5)}function yP(e){return nr(e)?e.nodeValue:null}function Vy(e,t,o){let n=An(Jo(t));if(n===null)return;let r=n.anchorNode,{anchorOffset:a,focusOffset:s}=n;if(r!==null){let i=yP(r),d=Dm(r);if(i!==null&&ke(d)){if((i===sc||i===wy)&&o){let c=o.length;i=o,a=c,s=c}i!==null&&Qy(d,i,a,s,e)}}}function Qy(e,t,o,n,r){let a=e;if(a.isAttached()&&(r||!a.isDirty())){let s=a.isComposing(),i=t;if((s||r)&&(t.endsWith(sc)&&(i=t.slice(0,-sc.length)),r)){let c=wy,u;for(;(u=i.indexOf(c))!==-1;)i=i.slice(0,u)+i.slice(u+c.length),o!==null&&o>u&&(o=Math.max(u,o-c.length)),n!==null&&n>u&&(n=Math.max(u,n-c.length))}let d=a.getTextContent();if(r||i!==d){if(i===""){if(ro(null),Sm||yc||km)a.remove();else{let h=mt();setTimeout(()=>{h.update(()=>{a.isAttached()&&a.remove()})},20)}return}let c=a.getParent(),u=ys(),m=a.getTextContentSize(),p=sa(),f=a.getKey();if(a.isToken()||p!==null&&f===p&&!s||Oe(u)&&(c!==null&&!c.canInsertTextBefore()&&u.anchor.offset===0||u.anchor.key===e.__key&&u.anchor.offset===0&&!a.canInsertTextBefore()&&!s||u.focus.key===e.__key&&u.focus.offset===m&&!a.canInsertTextAfter()&&!s))return void a.markDirty();let g=Je();if(!Oe(g)||o===null||n===null)return void j0(a,i,g);if(g.setTextNodeRange(a,o,a,n),a.isSegmented()){let h=oo(a.getTextContent());a.replace(h),a=h}j0(a,i,g)}}}function j0(e,t,o){if(e.setTextContent(t),Oe(o)){let n=e.getKey();for(let r of["anchor","focus"]){let a=o[r];a.type==="text"&&a.key===n&&(a.offset=Rn(e,a.offset,"clamp"))}}}function Zp(e,t,o){let n=t[o]||!1;return n==="any"||n===e[o]}function vP(e,t){return Zp(e,t,"altKey")&&Zp(e,t,"ctrlKey")&&Zp(e,t,"shiftKey")&&Zp(e,t,"metaKey")}function at(e,t,o){if(!vP(e,o))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 n="Key"+t.toUpperCase();return e.code===n}var Tr={ctrlKey:!Sn,metaKey:Sn},V0={altKey:Sn,ctrlKey:!Sn};function Q0(e){return e.key==="Backspace"}function X0(e){return at(e,"a",Tr)}function k5(e){let t=Yo();if(Oe(e)){let o=e.anchor,n=e.focus,r=o.getNode().getTopLevelElementOrThrow().getParentOrThrow();return o.set(r.getKey(),0,"element"),n.set(r.getKey(),r.getChildrenSize(),"element"),dm(e),e}{let o=t.select(0,t.getChildrenSize());return $o(dm(o)),o}}function Ai(e,t){e.__lexicalClassNameCache===void 0&&(e.__lexicalClassNameCache={});let o=e.__lexicalClassNameCache,n=o[t];if(n!==void 0)return n;let r=e[t];if(typeof r=="string"){let a=Ic(r);return o[t]=a,a}return r}function Xy(e,t,o,n,r){if(o.size===0)return;let a=n.__type,s=n.__key,i=t.get(a);i===void 0&&le(33,a);let d=i.klass,c=e.get(d);c===void 0&&(c=new Map,e.set(d,c));let u=c.get(s),m=u==="destroyed"&&r==="created";(u===void 0||m)&&c.set(s,m?"updated":r)}function L5(e){let t=e.getType(),o=Er();if(o._readOnly){let a=yy(o).get(t);return a?Array.from(a.values()):[]}let n=o._nodeMap,r=[];for(let[,a]of n)a instanceof e&&a.__type===t&&a.isAttached()&&r.push(a);return r}function Y0(e,t,o){let n=e.getParent(),r=o,a=e;return n!==null&&(t&&o===0?(r=a.getIndexWithinParent(),a=n):t||o!==a.getChildrenSize()||(r=a.getIndexWithinParent()+1,a=n)),a.getChildAtIndex(t?r-1:r)}function CP(e,t){let o=e.offset;if(e.type==="element")return Y0(e.getNode(),t,o);{let n=e.getNode();if(t&&o===0||!t&&o===n.getTextContentSize()){let r=t?n.getPreviousSibling():n.getNextSibling();return r===null?Y0(n.getParentOrThrow(),t,n.getIndexWithinParent()+(t?0:1)):r}}return null}function xP(e){let t=Jo(e).event,o=t&&t.inputType;return o==="insertFromPaste"||o==="insertFromPasteAsQuotation"}function we(e,t,o){return(function(n,r,a){let s=jy(n);for(let i=4;i>=0;i--)for(let d=0;d<s.length;d++){let c=s[d],u=c._commands.get(r);if(u!==void 0){let m=u[i];if(m!==void 0){let p=Array.from(m),f=p.length,g=!1;if(or(c,()=>{for(let h=0;h<f;h++)if(p[h](a,n))return void(g=!0)}),g)return g}}}return!1})(e,t,o)}function Bi(e,t){let o=e._keyToDOMMap.get(t);return o===void 0&&le(75,t),o}function bc(e){let t=e.assignedSlot||e.parentElement;return SP(t)?t.host:t}function Yy(e){return uP(e)?e:ko(e)?e.ownerDocument:null}function P5(e){return mt()._updateTags.has(e)}function _m(e){no(),mt()._updateTags.add(e)}function bP(e){no(),mt()._deferred.push(e)}function Tm(e,t){let o=e.getParent();for(;o!==null;){if(o.is(t))return!0;o=o.getParent()}return!1}function Jy(e){let t=Yy(e);return t?t.defaultView:null}function Jo(e){let t=e._window;return t===null&&le(78),t}function R5(e){return re(e)&&e.isInline()||yt(e)&&e.isInline()}function wP(e){let t=e.getParentOrThrow();for(;t!==null;){if(pn(t))return t;t=t.getParentOrThrow()}return t}function pn(e){return lo(e)||re(e)&&e.isShadowRoot()}function Zy(e){let t=e.constructor.clone(e);return pP(t,null),t.afterCloneFrom(e),t}function wc(e){let t=mt(),o=e.getType(),n=Ky(t,o);n===void 0&&le(200,e.constructor.name,o);let{replace:r,replaceWithKlass:a}=n;if(r!==null){let s=r(e),i=s.constructor;return a!==null?s instanceof a||le(201,a.name,a.getType(),i.name,i.getType(),e.constructor.name,o):s instanceof e.constructor&&i!==e.constructor||le(202,i.name,i.getType(),e.constructor.name,o),s.__key===e.__key&&le(203,e.constructor.name,o,i.name,i.getType()),s}return e}function $h(e,t){!lo(e.getParent())||re(t)||yt(t)||le(99)}function TP(e){let t=Vt(e);return t===null&&le(63,e),t}function zh(e){return(yt(e)||re(e)&&!e.canBeEmpty())&&!e.isInline()}function gy(e,t,o){o.style.removeProperty("caret-color"),t._blockCursorElement=null;let n=e.parentElement;n!==null&&n.removeChild(e)}function An(e){return Mn?(e||window).getSelection():null}function IP(e){let t=Jy(e);return t?t.getSelection():null}function E5(e,t){let o=e.getChildAtIndex(t);o==null&&(o=e),pn(e)&&le(102);let n=s=>{let i=s.getParentOrThrow(),d=pn(i),c=s!==o||d?Zy(s):s;if(d)return re(s)&&re(c)||le(133),s.insertAfter(c),[s,c,c];{let[u,m,p]=n(i),f=s.getNextSiblings();return p.append(c,...f),[u,m,c]}},[r,a]=n(o);return[r,a]}function M5(e){return ko(e)&&e.tagName==="A"}function ko(e){return Wi(e)&&e.nodeType===1}function Wi(e){return typeof e=="object"&&e!==null&&"nodeType"in e&&typeof e.nodeType=="number"}function SP(e){return Wi(e)&&e.nodeType===11}function kP(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 hy(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 kr(e){if(yt(e)&&!e.isInline())return!0;if(!re(e)||pn(e))return!1;let t=e.getFirstChild(),o=t===null||cs(t)||ke(t)||t.isInline();return!e.isInline()&&e.canBeEmpty()!==!1&&o}function ev(){return mt()}var J0=new WeakMap,A5=new Map;function yy(e){if(!e._readOnly&&e.isEmpty())return A5;e._readOnly||le(192);let t=J0.get(e);return t||(t=(function(o){let n=new Map;for(let[r,a]of o._nodeMap){let s=a.__type,i=n.get(s);i||(i=new Map,n.set(s,i)),i.set(r,a)}return n})(e),J0.set(e,t)),t}function tv(e){let t=e.constructor.clone(e);return t.afterCloneFrom(e),t}function N5(e){return(t=tv(e))[zL]=!0,t;var t}function LP(e,t){let o=parseInt(e.style.paddingInlineStart,10)||0,n=Math.round(o/40);t.setIndent(n)}function D5(e){e.__lexicalUnmanaged=!0}function PP(e){return e.__lexicalUnmanaged===!0}function Jd(e,t){return(function(o,n){return Object.prototype.hasOwnProperty.call(o,n)})(e,t)&&e[t]!==un[t]}function Tc(e){let t=c0 in e.prototype?e.prototype[c0]():void 0,o=(function(s){if(!(s===un||s.prototype instanceof un)){let i="<unknown>",d="<unknown>";try{i=s.getType()}catch{}try{ua.version&&(d=JSON.parse(ua.version))}catch{}le(290,s.name,i,d)}return s===mc||s===ca||s===un})(e),n=!o&&Jd(e,"getType")?e.getType():void 0,r,a=n;if(t)if(n)r=t[n];else for(let[s,i]of Object.entries(t))a=s,r=i;if(!o&&a&&(Jd(e,"getType")||(e.getType=()=>a),Jd(e,"clone")||(e.clone=s=>($y(s),new e)),Jd(e,"importJSON")||(e.importJSON=r&&r.$importJSON||(s=>new e().updateFromJSON(s))),!Jd(e,"importDOM")&&r)){let{importDOM:s}=r;s&&(e.importDOM=()=>s)}return{ownNodeConfig:r,ownNodeType:a}}function _5(e){let t=ev();return no(),new(t.resolveRegisteredNodeAfterReplacements(t.getRegisteredNode(e))).klass}var nc=(e,t)=>{let o=e;for(;o!=null&&!lo(o);){if(t(o))return o;o=o.getParent()}return null},O5={next:"previous",previous:"next"},Hi=class{origin;constructor(t){this.origin=t}[Symbol.iterator](){return rv({hasNext:hs,initial:this.getAdjacentCaret(),map:t=>t,step:t=>t.getAdjacentCaret()})}getAdjacentCaret(){return io(this.getNodeAtCaret(),this.direction)}getSiblingCaret(){return io(this.origin,this.direction)}remove(){let t=this.getNodeAtCaret();return t&&t.remove(),this}replaceOrInsert(t,o){let n=this.getNodeAtCaret();return t.is(this.origin)||t.is(n)||(n===null?this.insert(t):n.replace(t,o)),this}splice(t,o,n="next"){let r=n===this.direction?o:Array.from(o).reverse(),a=this,s=this.getParentAtCaret(),i=new Map;for(let d=a.getAdjacentCaret();d!==null&&i.size<t;d=d.getAdjacentCaret()){let c=d.origin.getWritable();i.set(c.getKey(),c)}for(let d of r){if(i.size>0){let c=a.getNodeAtCaret();if(c){if(i.delete(c.getKey()),i.delete(d.getKey()),!(c.is(d)||a.origin.is(d))){let u=d.getParent();u&&u.is(s)&&d.remove(),c.replace(d)}}else c===null&&le(263,Array.from(i).join(" "))}else a.insert(d);a=io(d,this.direction)}for(let d of i.values())d.remove();return this}},hc=class e extends Hi{type="child";getLatest(){let t=this.origin.getLatest();return t===this.origin?this:Rr(t,this.direction)}getParentCaret(t="root"){return io(ov(this.getParentAtCaret(),t),this.direction)}getFlipped(){let t=ha(this.direction);return io(this.getNodeAtCaret(),t)||Rr(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)}},F5={root:lo,shadowRoot:pn};function ha(e){return O5[e]}function ov(e,t="root"){return F5[t](e)?null:e}var Ui=class e extends Hi{type="sibling";getLatest(){let t=this.origin.getLatest();return t===this.origin?this:io(t,this.direction)}getSiblingCaret(){return this}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return re(this.origin)?Rr(this.origin,this.direction):null}getParentCaret(t="root"){return io(ov(this.getParentAtCaret(),t),this.direction)}getFlipped(){let t=ha(this.direction);return io(this.getNodeAtCaret(),t)||Rr(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 $i)&&this.direction===t.direction&&this.origin.is(t.origin)}},$i=class e extends Hi{type="text";offset;constructor(t,o){super(t),this.offset=o}getLatest(){let t=this.origin.getLatest();return t===this.origin?this:pa(t,this.direction,this.offset)}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return null}getParentCaret(t="root"){return io(ov(this.getParentAtCaret(),t),this.direction)}getFlipped(){return pa(this.origin,ha(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 Ui||t instanceof e)&&this.direction===t.direction&&this.origin.is(t.origin)}getSiblingCaret(){return io(this.origin,this.direction)}};function Pr(e){return e instanceof $i}function B5(e){return e instanceof Hi}function hs(e){return e instanceof Ui}function Pn(e){return e instanceof hc}var H5={next:class extends $i{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends $i{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},U5={next:class extends Ui{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends Ui{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},$5={next:class extends hc{direction="next";getNodeAtCaret(){return this.origin.getFirstChild()}insert(e){return this.origin.splice(0,0,[e]),this}},previous:class extends hc{direction="previous";getNodeAtCaret(){return this.origin.getLastChild()}insert(e){return this.origin.splice(this.origin.getChildrenSize(),0,[e]),this}}};function io(e,t){return e?new U5[t](e):null}function pa(e,t,o){return e?new H5[t](e,Rn(e,o)):null}function Rn(e,t,o="error"){let n=e.getTextContentSize(),r=t==="next"?n:t==="previous"?0:t;return(r<0||r>n)&&(o!=="clamp"&&tL(284,String(t),String(n),e.getKey()),r=r<0?0:n),r}function vy(e,t){return new Im(e,t)}function Rr(e,t){return re(e)?new $5[t](e):null}function RP(e){return e&&e.getChildCaret()||e}function zi(e){return e&&RP(e.getAdjacentCaret())}var Cy=class e{type="node-caret-range";direction;anchor;focus;constructor(t,o,n){this.anchor=t,this.focus=o,this.direction=n}getLatest(){let t=this.anchor.getLatest(),o=this.focus.getLatest();return t===this.anchor&&o===this.focus?this:new e(t,o,this.direction)}isCollapsed(){return this.anchor.isSamePointCaret(this.focus)}getTextSlices(){let t=r=>{let a=this[r].getLatest();return Pr(a)?(function(s,i){let{direction:d,origin:c}=s,u=Rn(c,i==="focus"?ha(d):d);return vy(s,u-s.offset)})(a,r):null},o=t("anchor"),n=t("focus");if(o&&n){let{caret:r}=o,{caret:a}=n;if(r.isSameNodeCaret(a))return[vy(r,a.offset-r.offset),null]}return[o,n]}iterNodeCarets(t="root"){let o=Pr(this.anchor)?this.anchor.getSiblingCaret():this.anchor.getLatest(),n=this.focus.getLatest(),r=Pr(n),a=s=>s.isSameNodeCaret(n)?null:zi(s)||s.getParentCaret(t);return rv({hasNext:s=>s!==null&&!(r&&n.isSameNodeCaret(s)),initial:o.isSameNodeCaret(n)?null:a(o),map:s=>s,step:a})}[Symbol.iterator](){return this.iterNodeCarets("root")}},Im=class{type="slice";caret;distance;constructor(t,o){this.caret=t,this.distance=o}getSliceIndices(){let{distance:t,caret:{offset:o}}=this,n=o+t;return n<o?[n,o]:[o,n]}getTextContent(){let[t,o]=this.getSliceIndices();return this.caret.origin.getTextContent().slice(t,o)}getTextContentSize(){return Math.abs(this.distance)}removeTextSlice(){let{caret:{origin:t,direction:o}}=this,[n,r]=this.getSliceIndices(),a=t.getTextContent();return pa(t.setTextContent(a.slice(0,n)+a.slice(r)),o,n)}};function z5(e){return e instanceof Im}function nv(e){return ma(e,io(Yo(),e.direction))}function EP(e){return ma(e,e)}function ma(e,t){return e.direction!==t.direction&&le(265),new Cy(e,t,e.direction)}function rv(e){let{initial:t,hasNext:o,step:n,map:r}=e,a=t;return{[Symbol.iterator](){return this},next(){if(!o(a))return{done:!0,value:void 0};let s={done:!1,value:r(a)};return a=n(a),s}}}function av(e,t){let o=rc(e.origin,t.origin);switch(o===null&&le(275,e.origin.getKey(),t.origin.getKey()),o.type){case"same":{let n=e.type==="text",r=t.type==="text";return n&&r?(function(a,s){return Math.sign(a-s)})(e.offset,t.offset):e.type===t.type?0:n?-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 sv(o)}}function sv(e){let{a:t,b:o}=e,n=t.__key,r=o.__key,a=t,s=o;for(;a&&s;a=a.getNextSibling(),s=s.getNextSibling()){if(a.__key===r)return-1;if(s.__key===n)return 1}return a===null?1:-1}function em(e,t){return t.is(e)}function Z0(e){return re(e)?[e.getLatest(),null]:[e.getParent(),e.getLatest()]}function rc(e,t){if(e.is(t))return{commonAncestor:e,type:"same"};let o=new Map;for(let[n,r]=Z0(e);n;r=n,n=n.getParent())o.set(n,r);for(let[n,r]=Z0(t);n;r=n,n=n.getParent()){let a=o.get(n);if(a!==void 0)return a===null?(em(e,n)||le(276),{commonAncestor:n,type:"ancestor"}):r===null?(em(t,n)||le(277),{commonAncestor:n,type:"descendant"}):((re(a)||em(e,a))&&(re(r)||em(t,r))&&n.is(a.getParent())&&n.is(r.getParent())||le(278),{a,b:r,commonAncestor:n,type:"branch"})}return null}function fa(e,t){let{type:o,key:n,offset:r}=e,a=TP(e.key);return o==="text"?(ke(a)||le(266,a.getType(),n),pa(a,t,r)):(re(a)||le(267,a.getType(),n),DP(a,e.offset,t))}function Ki(e,t){let{origin:o,direction:n}=t,r=n==="next";Pr(t)?e.set(o.getKey(),t.offset,"text"):hs(t)?ke(o)?e.set(o.getKey(),Rn(o,n),"text"):e.set(o.getParentOrThrow().getKey(),o.getIndexWithinParent()+(r?1:0),"element"):(Pn(t)&&re(o)||le(268),e.set(o.getKey(),r?0:o.getChildrenSize(),"element"))}function MP(e){let t=Je(),o=Oe(t)?t:ZL();return ac(o,e),$o(o),o}function ac(e,t){Ki(e.anchor,t.anchor),Ki(e.focus,t.focus)}function xy(e){let{anchor:t,focus:o}=e,n=fa(t,"next"),r=fa(o,"next"),a=av(n,r)<=0?"next":"previous";return ma(ga(n,a),ga(r,a))}function Gi(e){let{direction:t,origin:o}=e,n=io(o,ha(t)).getNodeAtCaret();return n?io(n,t):Rr(o.getParentOrThrow(),t)}function eL(e,t="root"){let o=[e];for(let n=Pn(e)?e.getParentCaret(t):e.getSiblingCaret();n!==null;n=n.getParentCaret(t))o.push(Gi(n));return o}function Kh(e){return!!e&&e.origin.isAttached()}function AP(e,t="removeEmptySlices"){if(e.isCollapsed())return e;let o="root",n="next",r=t,a=iv(e,n),s=eL(a.anchor,o),i=eL(a.focus.getFlipped(),o),d=new Set,c=[];for(let g of a.iterNodeCarets(o))if(Pn(g))d.add(g.origin.getKey());else if(hs(g)){let{origin:h}=g;re(h)&&!d.has(h.getKey())||c.push(h)}for(let g of c)g.remove();for(let g of a.getTextSlices()){if(!g)continue;let{origin:h}=g.caret,y=h.getTextContentSize(),x=Gi(io(h,n)),C=h.getMode();if(Math.abs(g.distance)===y&&r==="removeEmptySlices"||C==="token"&&g.distance!==0)x.remove();else if(g.distance!==0){r="removeEmptySlices";let b=g.removeTextSlice(),L=g.caret.origin;if(C==="segmented"){let w=b.origin,k=oo(w.getTextContent()).setStyle(w.getStyle()).setFormat(w.getFormat());x.replaceOrInsert(k),b=pa(k,n,b.offset)}L.is(s[0].origin)&&(s[0]=b),L.is(i[0].origin)&&(i[0]=b.getFlipped())}}let u,m;for(let g of s)if(Kh(g)){u=kn(g);break}for(let g of i)if(Kh(g)){m=kn(g);break}let p=(function(g,h,y){if(!g||!h)return null;let x=g.getParentAtCaret(),C=h.getParentAtCaret();if(!x||!C)return null;let b=x.getParents().reverse();b.push(x);let L=C.getParents().reverse();L.push(C);let w=Math.min(b.length,L.length),k;for(k=0;k<w&&b[k]===L[k];k++);let I=(P,A)=>{let N;for(let B=k;B<P.length;B++){let O=P[B];if(pn(O))return;!N&&A(O)&&(N=O)}return N},T=I(b,kr),S=T&&I(L,P=>y.has(P.getKey())&&kr(P));return T&&S?[T,S]:null})(u,m,d);if(p){let[g,h]=p;Rr(g,"previous").splice(0,h.getChildren());let y=h.getParent();for(h.remove(!0);y&&y.isEmpty();){let x=y;y=y.getParent(),x.remove(!0)}}let f=[u,m,...s,...i].find(Kh);if(f)return EP(ga(kn(f),e.direction));le(269,JSON.stringify(s.map(g=>g.origin.__key)))}function kn(e){let t=(function(r){let a=r;for(;Pn(a);){let s=zi(a);if(!Pn(s))break;a=s}return a})(e.getLatest()),{direction:o}=t;if(ke(t.origin))return Pr(t)?t:pa(t.origin,o,o);let n=t.getAdjacentCaret();return hs(n)&&ke(n.origin)?pa(n.origin,o,ha(o)):t}function NP(e){return Pr(e)&&e.offset!==Rn(e.origin,e.direction)}function ga(e,t){return e.direction===t?e:e.getFlipped()}function iv(e,t){return e.direction===t?e:ma(ga(e.focus,t),ga(e.anchor,t))}function DP(e,t,o){let n=Rr(e,"next");for(let r=0;r<t;r++){let a=n.getAdjacentCaret();if(a===null)break;n=a}return ga(n,o)}function K5(e,t="root"){let o=0,n=e,r=zi(n);for(;r===null;){if(o--,r=n.getParentCaret(t),!r)return null;n=r,r=zi(n)}return r&&[r,o]}function q5(e){let{origin:t,offset:o,direction:n}=e;if(o===Rn(t,n))return e.getSiblingCaret();if(o===Rn(t,ha(n)))return Gi(e.getSiblingCaret());let[r]=t.splitText(o);return ke(r)||le(281),ga(io(r,"next"),n)}function W5(e,t){return!0}function G5(e,{$copyElementNode:t=Zy,$splitTextPointCaretNext:o=q5,rootMode:n="shadowRoot",$shouldSplit:r=W5}={}){if(Pr(e))return o(e);let a=e.getParentCaret(n);if(a){let{origin:s}=a;if(Pn(e)&&(!s.canBeEmpty()||!r(s,"first")))return Gi(a);let i=(function(d){let c=[];for(let u=d.getAdjacentCaret();u;u=u.getAdjacentCaret())c.push(u.origin);return c})(e);(i.length>0||s.canBeEmpty()&&r(s,"last"))&&a.insert(t(s).splice(0,0,i))}return a}function j5(e){return e}function V5(...e){return e}function Q5(e,t){return[e,t]}function X5(e){return e}function Y5(e,t){if(!t||e===t)return e;for(let o in t)if(e[o]!==t[o])return{...e,...t};return e}function Ic(...e){let t=[];for(let o of e)if(o&&typeof o=="string")for(let[n]of o.matchAll(/\S+/g))t.push(n);return t}function J5(e,...t){let o=Ic(...t);o.length>0&&e.classList.add(...o)}function Z5(e,...t){let o=Ic(...t);o.length>0&&e.classList.remove(...o)}function eq(...e){return()=>{for(let t=e.length-1;t>=0;t--)e[t]();e.length=0}}var _=lv,dde=_.$addUpdateTag,ya=_.$applyNodeReplacement,ji=_.$caretFromPoint,_P=_.$caretRangeFromSelection,Om=_.$cloneWithProperties,OP=_.$cloneWithPropertiesEphemeral,cde=_.$comparePointCaretNext,ude=_.$copyNode,FP=_.$create,vs=_.$createLineBreakNode,BP=_.$createNodeSelection,mn=_.$createParagraphNode,pde=_.$createPoint,Cs=_.$createRangeSelection,HP=_.$createRangeSelectionFromDom,UP=_.$createTabNode,Nn=_.$createTextNode,$P=_.$extendCaretToRange,Mr=_.$findMatchingParent,dv=_.$getAdjacentChildCaret,mde=_.$getAdjacentNode,xs=_.$getAdjacentSiblingOrParentSiblingCaret,cv=_.$getCaretInDirection,zP=_.$getCaretRange,fde=_.$getCaretRangeInDirection,KP=_.$getCharacterOffsets,va=_.$getChildCaret,gde=_.$getChildCaretAtIndex,uv=_.$getChildCaretOrSelf,qP=_.$getCollapsedCaretRange,hde=_.$getCommonAncestor,yde=_.$getCommonAncestorResultBranchOrder,Fm=_.$getEditor,vde=_.$getNearestNodeFromDOMNode,Cde=_.$getNearestRootOrShadowRoot,Ca=_.$getNodeByKey,xde=_.$getNodeByKeyOrThrow,WP=_.$getNodeFromDOMNode,Sc=_.$getPreviousSelection,Ye=_.$getRoot,Te=_.$getSelection,Ar=_.$getSiblingCaret,Bm=_.$getState,bde=_.$getStateChange,wde=_.$getTextContent,Tde=_.$getTextNodeOffset,Ide=_.$getTextPointCaret,Sde=_.$getTextPointCaretSlice,kde=_.$getWritableNodeState,GP=_.$hasAncestor,Lde=_.$hasUpdateTag,Pde=_.$insertNodes,Vi=_.$isBlockElementNode,kc=_.$isChildCaret,Hm=_.$isDecoratorNode,jP=_.$isEditorState,_e=_.$isElementNode,VP=_.$isExtendableTextPointCaret,Rde=_.$isInlineElementOrDecoratorNode,QP=_.$isLeafNode,Lc=_.$isLineBreakNode,Ede=_.$isNodeCaret,pv=_.$isNodeSelection,XP=_.$isParagraphNode,ye=_.$isRangeSelection,Pc=_.$isRootNode,bs=_.$isRootOrShadowRoot,YP=_.$isSiblingCaret,Mde=_.$isTabNode,Ke=_.$isTextNode,Um=_.$isTextPointCaret,Ade=_.$isTextPointCaretSlice,mv=_.$isTokenOrSegmented,Nde=_.$isTokenOrTab,Dde=_.$nodesOfType,JP=_.$normalizeCaret,ZP=_.$normalizeSelection__EXPERIMENTAL,_de=_.$onUpdate,eR=_.$parseSerializedNode,Ode=_.$removeTextFromCaretRange,tR=_.$rewindSiblingCaret,$m=_.$selectAll,Fde=_.$setCompositionKey,Bde=_.$setPointFromCaret,fn=_.$setSelection,oR=_.$setSelectionFromCaretRange,zm=_.$setState,nR=_.$splitAtPointCaretNext,rR=_.$splitNode,Hde=_.$updateRangeSelectionFromCaretRange,fv=_.ArtificialNode__DO_NOT_USE,Ude=_.BEFORE_INPUT_COMMAND,aR=_.BLUR_COMMAND,Rc=_.CAN_REDO_COMMAND,Ec=_.CAN_UNDO_COMMAND,Km=_.CLEAR_EDITOR_COMMAND,sR=_.CLEAR_HISTORY_COMMAND,iR=_.CLICK_COMMAND,$de=_.COLLABORATION_TAG,qm=_.COMMAND_PRIORITY_CRITICAL,vt=_.COMMAND_PRIORITY_EDITOR,Zo=_.COMMAND_PRIORITY_HIGH,Qi=_.COMMAND_PRIORITY_LOW,zde=_.COMMAND_PRIORITY_NORMAL,Kde=_.COMPOSITION_END_COMMAND,lR=_.COMPOSITION_END_TAG,qde=_.COMPOSITION_START_COMMAND,dR=_.COMPOSITION_START_TAG,cR=_.CONTROLLED_TEXT_INSERTION_COMMAND,Wm=_.COPY_COMMAND,uR=_.CUT_COMMAND,Gm=_.DELETE_CHARACTER_COMMAND,pR=_.DELETE_LINE_COMMAND,mR=_.DELETE_WORD_COMMAND,Wde=_.DRAGEND_COMMAND,Gde=_.DRAGOVER_COMMAND,fR=_.DRAGSTART_COMMAND,gR=_.DROP_COMMAND,xa=_.DecoratorNode,jde=_.ElementNode,hR=_.FOCUS_COMMAND,Vde=_.FORMAT_ELEMENT_COMMAND,yR=_.FORMAT_TEXT_COMMAND,jm=_.HISTORIC_TAG,zo=_.HISTORY_MERGE_TAG,vR=_.HISTORY_PUSH_TAG,gv=_.INDENT_CONTENT_COMMAND,Qde=_.INPUT_COMMAND,hv=_.INSERT_LINE_BREAK_COMMAND,CR=_.INSERT_PARAGRAPH_COMMAND,xR=_.INSERT_TAB_COMMAND,Mc=_.INTERNAL_$isBlock,Xde=_.IS_ALL_FORMATTING,Yde=_.IS_BOLD,Jde=_.IS_CODE,Zde=_.IS_HIGHLIGHT,ece=_.IS_ITALIC,tce=_.IS_STRIKETHROUGH,oce=_.IS_SUBSCRIPT,nce=_.IS_SUPERSCRIPT,rce=_.IS_UNDERLINE,bR=_.KEY_ARROW_DOWN_COMMAND,Vm=_.KEY_ARROW_LEFT_COMMAND,Qm=_.KEY_ARROW_RIGHT_COMMAND,wR=_.KEY_ARROW_UP_COMMAND,Xm=_.KEY_BACKSPACE_COMMAND,Ym=_.KEY_DELETE_COMMAND,TR=_.KEY_DOWN_COMMAND,Jm=_.KEY_ENTER_COMMAND,IR=_.KEY_ESCAPE_COMMAND,ace=_.KEY_MODIFIER_COMMAND,sce=_.KEY_SPACE_COMMAND,Zm=_.KEY_TAB_COMMAND,SR=_.LineBreakNode,ice=_.MOVE_TO_END,lce=_.MOVE_TO_START,dce=_.NODE_STATE_KEY,kR=_.OUTDENT_CONTENT_COMMAND,ef=_.PASTE_COMMAND,LR=_.PASTE_TAG,PR=_.ParagraphNode,RR=_.REDO_COMMAND,ER=_.REMOVE_TEXT_COMMAND,MR=_.RootNode,cce=_.SELECTION_CHANGE_COMMAND,AR=_.SELECTION_INSERT_CLIPBOARD_NODES_COMMAND,NR=_.SELECT_ALL_COMMAND,uce=_.SKIP_COLLAB_TAG,DR=_.SKIP_DOM_SELECTION_TAG,yv=_.SKIP_SCROLL_INTO_VIEW_TAG,pce=_.SKIP_SELECTION_FOCUS_TAG,_R=_.TEXT_TYPE_TO_FORMAT,OR=_.TabNode,tf=_.TextNode,FR=_.UNDO_COMMAND,Ac=_.addClassNamesToElement,mce=_.buildImportMap,of=_.configExtension,BR=_.createCommand,nf=_.createEditor,fce=_.createSharedNodeState,HR=_.createState,UR=_.declarePeerDependency,zt=_.defineExtension,gce=_.flipDirection,hce=_.getDOMOwnerDocument,vv=_.getDOMSelection,yce=_.getDOMSelectionFromTarget,$R=_.getDOMTextNode,vce=_.getEditorPropertyFromDOMNode,Cce=_.getNearestEditorFromDOMNode,zR=_.getRegisteredNode,xce=_.getRegisteredNodeOrThrow,bce=_.getStaticNodeConfig,wce=_.getTextDirection,Tce=_.getTransformSetFromKlass,KR=_.isBlockDomNode,Ice=_.isCurrentlyReadOnlyMode,qR=_.isDOMDocumentNode,WR=_.isDOMNode,Sce=_.isDOMTextNode,kce=_.isDOMUnmanaged,Cv=_.isDocumentFragment,Lce=_.isExactShortcutMatch,GR=_.isHTMLAnchorElement,rf=_.isHTMLElement,Nc=_.isInlineDomNode,Pce=_.isLexicalEditor,Rce=_.isModifierMatch,Ece=_.isSelectionCapturedInDecoratorInput,jR=_.isSelectionWithinEditor,xv=_.makeStepwiseIterator,rr=_.mergeRegister,Mce=_.normalizeClassNames,af=_.removeClassNamesFromElement,Ace=_.removeFromParent,Nce=_.resetRandomKey,Dn=_.safeCast,Dce=_.setDOMUnmanaged,_ce=_.setNodeIndentFromDOM,sf=_.shallowMergeConfig,bv=_.toggleTextFormatType;var wv={};Ut(wv,{LexicalComposer:()=>oq});$();var VR=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,tq=VR?fe:H,lf={tag:zo};function oq({initialConfig:e,children:t}){let o=W(()=>{let{theme:n,namespace:r,nodes:a,onError:s,editorState:i,html:d}=e,c=d0(null,n),u=nf({editable:e.editable,html:d,namespace:r,nodes:a,onError:m=>s(m,u),theme:n});return(function(m,p){if(p!==null){if(p===void 0)m.update(()=>{let f=Ye();if(f.isEmpty()){let g=mn();f.append(g);let h=VR?document.activeElement:null;(Te()!==null||h!==null&&h===m.getRootElement())&&g.select()}},lf);else if(p!==null)switch(typeof p){case"string":{let f=m.parseEditorState(p);m.setEditorState(f,lf);break}case"object":m.setEditorState(p,lf);break;case"function":m.update(()=>{Ye().isEmpty()&&p(m)},lf)}}})(u,i),[u,c]},[]);return tq(()=>{let n=e.editable,[r]=o;r.setEditable(n===void 0||n)},[]),l(l0.Provider,{value:o,children:t})}var nq=wv,QR=nq.LexicalComposer;var Iv={};Ut(Iv,{$canShowPlaceholder:()=>YR,$canShowPlaceholderCurry:()=>aq,$findTextIntersectionFromCharacters:()=>sq,$isRootTextContentEmpty:()=>Tv,$isRootTextContentEmptyCurry:()=>rq,$rootTextContent:()=>XR,registerLexicalTextEntity:()=>lq});function XR(){return Ye().getTextContent()}function Tv(e,t=!0){if(e)return!1;let o=XR();return t&&(o=o.trim()),o===""}function rq(e,t){return()=>Tv(e,t)}function YR(e){if(!Tv(e,!1))return!1;let t=Ye().getChildren(),o=t.length;if(o>1)return!1;for(let n=0;n<o;n++){let r=t[n];if(Hm(r))return!1;if(_e(r)){if(!XP(r)||r.__indent!==0)return!1;let a=r.getChildren(),s=a.length;for(let i=0;i<s;i++){let d=a[n];if(!Ke(d))return!1}}}return!0}function aq(e){return()=>YR(e)}function sq(e,t){let o=e.getFirstChild(),n=0;e:for(;o!==null;){if(_e(o)){let s=o.getFirstChild();if(s!==null){o=s;continue}}else if(Ke(o)){let s=o.getTextContentSize();if(n+s>t)return{node:o,offset:t-n};n+=s}let r=o.getNextSibling();if(r!==null){o=r;continue}let a=o.getParent();for(;a!==null;){let s=a.getNextSibling();if(s!==null){o=s;continue e}a=a.getParent()}break}return null}function iq(e,...t){let o=new URL("https://lexical.dev/docs/error"),n=new URLSearchParams;n.append("code",e);for(let r of t)n.append("v",r);throw o.search=n.toString(),Error(`Minified Lexical error #${e}; visit ${o.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function lq(e,t,o,n){let r=s=>s instanceof o,a=s=>{let i=Nn(s.getTextContent());i.setFormat(s.getFormat()),s.replace(i)};return[e.registerNodeTransform(tf,s=>{if(!s.isSimpleText())return;let i,d=s.getPreviousSibling(),c=s.getTextContent(),u=s;if(Ke(d)){let p=d.getTextContent(),f=t(p+c);if(r(d)){if(f===null||(g=>g.getLatest().__mode)(d)!==0)return void a(d);{let g=f.end-p.length;if(g>0){let h=p+c.slice(0,g);if(d.select(),d.setTextContent(h),g===c.length)s.remove();else{let y=c.slice(g);s.setTextContent(y)}return}}}else if(f===null||f.start<p.length)return}let m=0;for(;;){i=t(c);let p,f=i===null?"":c.slice(i.end);if(c=f,f===""){let h=u.getNextSibling();if(Ke(h)){f=u.getTextContent()+h.getTextContent();let y=t(f);if(y===null)return void(r(h)?a(h):h.markDirty());if(y.start!==0)return}}if(i===null)return;if(i.start===0&&Ke(d)&&d.isTextEntity()){m+=i.end;continue}i.start===0?[p,u]=u.splitText(i.end):[,p,u]=u.splitText(i.start+m,i.end+m),p===void 0&&iq(165,"nodeToReplace");let g=n(p);if(g.setFormat(p.getFormat()),p.replace(g),u==null)return;m=0,d=g}}),e.registerNodeTransform(o,s=>{let i=s.getTextContent(),d=t(i);if(d===null||d.start!==0)return void a(s);if(i.length>d.end)return void s.splitText(d.end);let c=s.getPreviousSibling();Ke(c)&&c.isTextEntity()&&(a(c),a(s));let u=s.getNextSibling();Ke(u)&&u.isTextEntity()&&(a(u),r(s)&&a(s))})]}var ws=Iv,Kce=ws.$canShowPlaceholder,df=ws.$canShowPlaceholderCurry,qce=ws.$findTextIntersectionFromCharacters,Wce=ws.$isRootTextContentEmpty,Gce=ws.$isRootTextContentEmptyCurry,jce=ws.$rootTextContent,Vce=ws.registerLexicalTextEntity;var Ev={};Ut(Ev,{$addNodeStyle:()=>fq,$cloneWithProperties:()=>Om,$copyBlockFormatIndent:()=>sE,$ensureForwardRangeSelection:()=>aE,$forEachSelectedTextNode:()=>rE,$getComputedStyleForElement:()=>Lv,$getComputedStyleForParent:()=>Pv,$getSelectionStyleValueForProperty:()=>wq,$isAtNodeEnd:()=>mq,$isParentElementRTL:()=>Rv,$isParentRTL:()=>uq,$moveCaretSelection:()=>dE,$moveCharacter:()=>xq,$patchStyleText:()=>gq,$selectAll:()=>$m,$setBlocksType:()=>hq,$shouldOverrideDefaultCharacterSelection:()=>Cq,$sliceSelectedTextNodeContent:()=>pq,$trimTextContentFromAnchor:()=>nE,$wrapNodes:()=>vq,createDOMRange:()=>dq,createRectsFromDOMRange:()=>cq,getCSSFromStyleObject:()=>oE,getStyleObjectFromCSS:()=>pf,trimTextContentFromAnchor:()=>Tq});function kv(e,...t){let o=new URL("https://lexical.dev/docs/error"),n=new URLSearchParams;n.append("code",e);for(let r of t)n.append("v",r);throw o.search=n.toString(),Error(`Minified Lexical error #${e}; visit ${o.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var uf=new Map;function JR(e){let t=e;for(;t!=null;){if(t.nodeType===Node.TEXT_NODE)return t;t=t.firstChild}return null}function ZR(e){let t=e.parentNode;if(t==null)throw new Error("Should never happen");return[t,Array.from(t.childNodes).indexOf(e)]}function dq(e,t,o,n,r){let a=t.getKey(),s=n.getKey(),i=document.createRange(),d=e.getElementByKey(a),c=e.getElementByKey(s),u=o,m=r;if(Ke(t)&&(d=JR(d)),Ke(n)&&(c=JR(c)),t===void 0||n===void 0||d===null||c===null)return null;d.nodeName==="BR"&&([d,u]=ZR(d)),c.nodeName==="BR"&&([c,m]=ZR(c));let p=d.firstChild;d===c&&p!=null&&p.nodeName==="BR"&&u===0&&m===0&&(m=1);try{i.setStart(d,u),i.setEnd(c,m)}catch{return null}return!i.collapsed||u===m&&a===s||(i.setStart(c,m),i.setEnd(d,u)),i}function cq(e,t){let o=e.getRootElement();if(o===null)return[];let n=o.getBoundingClientRect(),r=getComputedStyle(o),a=parseFloat(r.paddingLeft)+parseFloat(r.paddingRight),s=Array.from(t.getClientRects()),i,d=s.length;s.sort((c,u)=>{let m=c.top-u.top;return Math.abs(m)<=3?c.left-u.left:m});for(let c=0;c<d;c++){let u=s[c],m=i&&i.top<=u.top&&i.top+i.height>u.top&&i.left+i.width>u.left,p=u.width+a===n.width;m||p?(s.splice(c--,1),d--):i=u}return s}function tE(e){let t={};if(!e)return t;let o=e.split(";");for(let n of o)if(n!==""){let[r,a]=n.split(/:([^]+)/);r&&a&&(t[r.trim()]=a.trim())}return t}function pf(e){let t=uf.get(e);return t===void 0&&(t=tE(e),uf.set(e,t)),t}function oE(e){let t="";for(let o in e)o&&(t+=`${o}: ${e[o]};`);return t}function Lv(e){let t=Fm().getElementByKey(e.getKey());if(t===null)return null;let o=t.ownerDocument.defaultView;return o===null?null:o.getComputedStyle(t)}function Pv(e){return Lv(Pc(e)?e:e.getParentOrThrow())}function uq(e){let t=Pv(e);return t!==null&&t.direction==="rtl"}function pq(e,t,o="self"){let n=e.getStartEndPoints();if(t.isSelected(e)&&!mv(t)&&n!==null){let[r,a]=n,s=e.isBackward(),i=r.getNode(),d=a.getNode(),c=t.is(i),u=t.is(d);if(c||u){let[m,p]=KP(e),f=i.is(d),g=t.is(s?d:i),h=t.is(s?i:d),y,x=0;f?(x=m>p?p:m,y=m>p?m:p):g?(x=s?p:m,y=void 0):h&&(x=0,y=s?m:p);let C=t.__text.slice(x,y);C!==t.__text&&(o==="clone"&&(t=OP(t)),t.__text=C)}}return t}function mq(e){if(e.type==="text")return e.offset===e.getNode().getTextContentSize();let t=e.getNode();return _e(t)||kv(177),e.offset===t.getChildrenSize()}function nE(e,t,o){let n=t.getNode(),r=o;if(_e(n)){let a=n.getDescendantByIndex(t.offset);a!==null&&(n=a)}for(;r>0&&n!==null;){if(_e(n)){let c=n.getLastDescendant();c!==null&&(n=c)}let a=n.getPreviousSibling(),s=0;if(a===null){let c=n.getParentOrThrow(),u=c.getPreviousSibling();for(;u===null;){if(c=c.getParent(),c===null){a=null;break}u=c.getPreviousSibling()}c!==null&&(s=c.isInline()?0:2,a=u)}let i=n.getTextContent();i===""&&_e(n)&&!n.isInline()&&(i=`
3560
+ `?n.push(Di()):s===" "?n.push(Rm()):n.push(oo(s))}this.insertNodes(n)}insertText(t){let o=this.anchor,n=this.focus,r=this.format,a=this.style,s=o,i=n;!this.isCollapsed()&&n.isBefore(o)&&(s=n,i=o),s.type==="element"&&(function(y,x,C,b){let L=y.getNode(),w=L.getChildAtIndex(y.offset),k=oo();if(k.setFormat(C),k.setStyle(b),lP(w))w.splice(0,0,[k]);else{let I=lo(L)?Lr().append(k):k;w===null?L.append(I):w.insertBefore(I)}y.is(x)&&x.set(k.__key,0,"text"),y.set(k.__key,0,"text")})(s,i,r,a),i.type==="element"&&Ki(i,kn(fa(i,"next")));let d=s.offset,c=i.offset,u=this.getNodes(),m=u.length,p=u[0];ke(p)||le(26);let f=p.getTextContent().length,g=p.getParentOrThrow(),h=u[m-1];if(m===1&&i.type==="element"&&(c=f,i.set(s.key,c,"text")),this.isCollapsed()&&d===f&&(Ir(p)||!p.canInsertTextAfter()||!g.canInsertTextAfter()&&p.getNextSibling()===null)){let y=p.getNextSibling();if(ke(y)&&y.canInsertTextBefore()&&!Ir(y)||(y=oo(),y.setFormat(r),y.setStyle(a),g.canInsertTextAfter()?p.insertAfter(y):g.insertAfter(y)),y.select(0,0),p=y,t!=="")return void this.insertText(t)}else if(this.isCollapsed()&&d===0&&(Ir(p)||!p.canInsertTextBefore()||!g.canInsertTextBefore()&&p.getPreviousSibling()===null)){let y=p.getPreviousSibling();if(ke(y)&&!Ir(y)||(y=oo(),y.setFormat(r),g.canInsertTextBefore()?p.insertBefore(y):g.insertBefore(y)),y.select(),p=y,t!=="")return void this.insertText(t)}else if(p.isSegmented()&&d!==f){let y=oo(p.getTextContent());y.setFormat(r),p.replace(y),p=y}else if(!this.isCollapsed()&&t!==""){let y=h.getParent();if(!g.canInsertTextBefore()||!g.canInsertTextAfter()||re(y)&&(!y.canInsertTextBefore()||!y.canInsertTextAfter()))return this.insertText(""),JL(this.anchor,this.focus),void this.insertText(t)}if(m===1){if(ia(p)){let b=oo(t);return b.select(),void p.replace(b)}let y=p.getFormat(),x=p.getStyle();if(d!==c||y===r&&x===a){if(Fy(p)){let b=oo(t);return b.setFormat(r),b.setStyle(a),b.select(),void p.replace(b)}}else{if(p.getTextContent()!==""){let b=oo(t);if(b.setFormat(r),b.setStyle(a),b.select(),d===0)p.insertBefore(b,!1);else{let[L]=p.splitText(d);L.insertAfter(b,!1)}return void(b.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=t.length))}p.setFormat(r),p.setStyle(a)}let C=c-d;p=p.spliceText(d,C,t,!0),p.getTextContent()===""?p.remove():this.anchor.type==="text"&&(this.format=y,this.style=x,p.isComposing()&&(this.anchor.offset-=t.length))}else{let y=new Set([...p.getParentKeys(),...h.getParentKeys()]),x=re(p)?p:p.getParentOrThrow(),C=re(h)?h:h.getParentOrThrow(),b=h;if(!x.is(C)&&C.isInline())do b=C,C=C.getParentOrThrow();while(C.isInline());if(i.type==="text"&&(c!==0||h.getTextContent()==="")||i.type==="element"&&h.getIndexWithinParent()<c)if(ke(h)&&!ia(h)&&c!==h.getTextContentSize()){if(h.isSegmented()){let T=oo(h.getTextContent());h.replace(T),h=T}lo(i.getNode())||i.type!=="text"||(h=h.spliceText(0,c,"")),y.add(h.__key)}else{let T=h.getParentOrThrow();T.canBeEmpty()||T.getChildrenSize()!==1?h.remove():T.remove()}else y.add(h.__key);let L=C.getChildren(),w=new Set(u),k=x.is(C),I=x.isInline()&&p.getNextSibling()===null?x:p;for(let T=L.length-1;T>=0;T--){let S=L[T];if(S.is(p)||re(S)&&S.isParentOf(p))break;S.isAttached()&&(!w.has(S)||S.is(b)?k||I.insertAfter(S,!1):S.remove())}if(!k){let T=C,S=null;for(;T!==null;){let P=T.getChildren(),A=P.length;(A===0||P[A-1].is(S))&&(y.delete(T.__key),S=T),T=T.getParent()}}if(ia(p))if(d===f)p.select();else{let T=oo(t);T.select(),p.replace(T)}else p=p.spliceText(d,f-d,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 T=1;T<m;T++){let S=u[T],P=S.__key;y.has(P)||S.remove()}}}removeText(){let t=Je()===this;ac(this,DP(xy(this))),t&&Je()!==this&&$o(this)}formatText(t,o=null){if(this.isCollapsed())return this.toggleFormat(t),void ro(null);let n=this.getNodes(),r=[];for(let L of n)ke(L)&&r.push(L);let a=L=>{n.forEach(w=>{if(re(w)){let k=w.getFormatFlags(t,L);w.setTextFormat(k)}})},s=r.length;if(s===0)return this.toggleFormat(t),ro(null),void a(o);let i=this.anchor,d=this.focus,c=this.isBackward(),u=c?d:i,m=c?i:d,p=0,f=r[0],g=u.type==="element"?0:u.offset;if(u.type==="text"&&g===f.getTextContentSize()&&(p=1,f=r[1],g=0),f==null)return;let h=f.getFormatFlags(t,o);a(h);let y=s-1,x=r[y],C=m.type==="text"?m.offset:x.getTextContentSize();if(f.is(x)){if(g===C)return;if(Ir(f)||g===0&&C===f.getTextContentSize())f.setFormat(h);else{let L=f.splitText(g,C),w=g===0?L[0]:L[1];w.setFormat(h),u.type==="text"&&u.set(w.__key,0,"text"),m.type==="text"&&m.set(w.__key,C-g,"text")}return void(this.format=h)}g===0||Ir(f)||([,f]=f.splitText(g),g=0),f.setFormat(h);let b=x.getFormatFlags(t,h);C>0&&(C===x.getTextContentSize()||Ir(x)||([x]=x.splitText(C)),x.setFormat(b));for(let L=p+1;L<y;L++){let w=r[L],k=w.getFormatFlags(t,b);w.setFormat(k)}u.type==="text"&&u.set(f.__key,g,"text"),m.type==="text"&&m.set(x.__key,C,"text"),this.format=h|b}insertNodes(t){if(t.length===0)return;if(this.isCollapsed()||this.removeText(),this.anchor.key==="root"){this.insertParagraph();let g=Je();return Oe(g)||le(134),g.insertNodes(t)}let o=(this.isBackward()?this.focus:this.anchor).getNode(),n=nc(o,kr),r=t[t.length-1];if(re(n)&&"__language"in n){if("__language"in t[0])this.insertText(t[0].getTextContent());else{let g=Hh(this);n.splice(g,0,t),r.selectEnd()}return}if(!t.some(g=>(re(g)||yt(g))&&!g.isInline())){re(n)||le(211,o.constructor.name,o.getType());let g=Hh(this);return n.splice(g,0,t),void r.selectEnd()}let a=(function(g){let h=Lr(),y=null;for(let x=0;x<g.length;x++){let C=g[x],b=cs(C);if(b||yt(C)&&C.isInline()||re(C)&&C.isInline()||ke(C)||C.isParentRequired()){if(y===null&&(y=C.createParentElementNode(),h.append(y),b))continue;y!==null&&y.append(C)}else h.append(C),y=null}return h})(t),s=a.getLastDescendant(),i=a.getChildren(),d=!re(n)||!n.isEmpty()?this.insertParagraph():null,c=i[i.length-1],u=i[0];var m;re(m=u)&&kr(m)&&!m.isEmpty()&&re(n)&&(!n.isEmpty()||n.canMergeWhenEmpty())&&(re(n)||le(211,o.constructor.name,o.getType()),n.append(...u.getChildren()),u=i[1]),u&&(n===null&&le(212,o.constructor.name,o.getType()),(function(g,h){let y=h.getParentOrThrow().getLastChild(),x=h,C=[h];for(;x!==y;)x.getNextSibling()||le(140),x=x.getNextSibling(),C.push(x);let b=g;for(let L of C)b=b.insertAfter(L)})(n,u));let p=nc(s,kr);d&&re(p)&&(d.canMergeWhenEmpty()||kr(c))&&(p.append(...d.getChildren()),d.remove()),re(n)&&n.isEmpty()&&n.remove(),s.selectEnd();let f=re(n)?n.getLastChild():null;cs(f)&&p!==n&&f.remove()}insertParagraph(){if(this.anchor.key==="root"){let s=Lr();return Xo().splice(this.anchor.offset,0,[s]),s.select(),s}let t=Hh(this),o=nc(this.anchor.getNode(),kr);re(o)||le(213);let n=o.getChildAtIndex(t),r=n?[n,...n.getNextSiblings()]:[],a=o.insertNewAfter(this,!1);return a?(a.append(...r),a.selectStart(),a):null}insertLineBreak(t){let o=Di();if(this.insertNodes([o]),t){let n=o.getParentOrThrow(),r=o.getIndexWithinParent();n.select(r,r)}}extract(){let t=[...this.getNodes()],o=t.length,n=t[0],r=t[o-1],[a,s]=py(this),i=this.isBackward(),[d,c]=i?[this.focus,this.anchor]:[this.anchor,this.focus],[u,m]=i?[s,a]:[a,s];if(o===0)return[];if(o===1){if(ke(n)&&!this.isCollapsed()){let p=n.splitText(u,m),f=u===0?p[0]:p[1];return f?(d.set(f.getKey(),0,"text"),c.set(f.getKey(),f.getTextContentSize(),"text"),[f]):[]}return[n]}if(ke(n)&&(u===n.getTextContentSize()?t.shift():u!==0&&([,n]=n.splitText(u),t[0]=n,d.set(n.getKey(),0,"text"))),ke(r)){let p=r.getTextContent().length;m===0?t.pop():m!==p&&([r]=r.splitText(m),t[t.length-1]=r,c.set(r.getKey(),r.getTextContentSize(),"text"))}return t}modify(t,o,n){if(U0(this,t,o,n))return;let r=t==="move",a=mt(),s=An(Yo(a));if(!s)return;let i=a._blockCursorElement,d=a._rootElement,c=this.focus.getNode();if(d===null||i===null||!re(c)||c.isInline()||c.canBeEmpty()||gy(i,a,d),this.dirty){let u=Bi(a,this.anchor.key),m=Bi(a,this.focus.key);this.anchor.type==="text"&&(u=gs(u)),this.focus.type==="text"&&(m=gs(m)),u&&m&&oP(s,u,this.anchor.offset,m,this.focus.offset)}if((function(u,m,p,f){u.modify(m,p,f)})(s,t,o?"backward":"forward",n),s.rangeCount>0){let u=s.getRangeAt(0),m=this.anchor.getNode(),p=lo(m)?m:IP(m);if(this.applyDOMRange(u),this.dirty=!0,!r){let f=this.getNodes(),g=[],h=!1;for(let y=0;y<f.length;y++){let x=f[y];Tm(x,p)?g.push(x):h=!0}if(h&&g.length>0)if(o){let y=g[0];re(y)?y.selectStart():y.getParentOrThrow().selectStart()}else{let y=g[g.length-1];re(y)?y.selectEnd():y.getParentOrThrow().selectEnd()}s.anchorNode===u.startContainer&&s.anchorOffset===u.startOffset||(function(y){let x=y.focus,C=y.anchor,b=C.key,L=C.offset,w=C.type;C.set(x.key,x.offset,x.type,!0),x.set(b,L,w,!0)})(this)}}n==="lineboundary"&&U0(this,t,o,n,"decorators")}forwardDeletion(t,o,n){if(!n&&(t.type==="element"&&re(o)&&t.offset===o.getChildrenSize()||t.type==="text"&&t.offset===o.getTextContentSize())){let r=o.getParent(),a=o.getNextSibling()||(r===null?null:r.getNextSibling());if(re(a)&&a.isShadowRoot())return!0}return!1}deleteCharacter(t){let o=this.isCollapsed();if(this.isCollapsed()){let n=this.anchor,r=n.getNode();if(this.forwardDeletion(n,r,t))return;let a=nv(fa(n,t?"previous":"next"));if(a.getTextSlices().every(i=>i===null||i.distance===0)){let i={type:"initial"};for(let d of a.iterNodeCarets("shadowRoot"))if(Pn(d)){if(!d.origin.isInline()){if(d.origin.isShadowRoot()){if(i.type==="merge-block")break;if(re(a.anchor.origin)&&a.anchor.origin.isEmpty()){let c=kn(d);ac(this,ma(c,c)),a.anchor.origin.remove()}return}i.type!=="merge-next-block"&&i.type!=="merge-block"||(i={block:i.block,caret:d,type:"merge-block"})}}else{if(i.type==="merge-block")break;if(hs(d)){if(re(d.origin)){if(d.origin.isInline()){if(!d.origin.isParentOf(a.anchor.origin))break}else i={block:d.origin,type:"merge-next-block"};continue}if(yt(d.origin)){if(!d.origin.isIsolated())if(i.type==="merge-next-block"&&(d.origin.isKeyboardSelectable()||!d.origin.isInline())&&re(a.anchor.origin)&&a.anchor.origin.isEmpty()){a.anchor.origin.remove();let c=By();c.add(d.origin.getKey()),$o(c)}else d.origin.remove();return}break}}if(i.type==="merge-block"){let{caret:d,block:c}=i;return ac(this,ma(!d.origin.isEmpty()&&c.isEmpty()?Gi(io(c,d.direction)):a.anchor,d)),this.removeText()}}let s=this.focus;if(this.modify("extend",t,"character"),this.isCollapsed()){if(t&&n.offset===0&&N0(this,n.getNode()))return}else{let i=s.type==="text"?s.getNode():null;if(r=n.type==="text"?n.getNode():null,i!==null&&i.isSegmented()){let d=s.offset,c=i.getTextContentSize();if(i.is(r)||t&&d!==c||!t&&d!==0)return void D0(i,t,d)}else if(r!==null&&r.isSegmented()){let d=n.offset,c=r.getTextContentSize();if(r.is(i)||t&&d!==0||!t&&d!==c)return void D0(r,t,d)}(function(d,c){let u=d.anchor,m=d.focus,p=u.getNode(),f=m.getNode();if(p===f&&u.type==="text"&&m.type==="text"){let g=u.offset,h=m.offset,y=g<h,x=y?g:h,C=y?h:g,b=C-1;x!==b&&(function(L){return!(yP(L)||d5(L))})(p.getTextContent().slice(x,C))&&(c?m.set(m.key,b,m.type):u.set(u.key,b,u.type))}})(this,t)}}if(this.removeText(),t&&!o&&this.isCollapsed()&&this.anchor.type==="element"&&this.anchor.offset===0){let n=this.anchor.getNode();n.isEmpty()&&lo(n.getParent())&&n.getPreviousSibling()===null&&N0(this,n)}}deleteLine(t){this.isCollapsed()&&this.modify("extend",t,"lineboundary"),this.isCollapsed()?this.deleteCharacter(t):this.removeText()}deleteWord(t){if(this.isCollapsed()){let o=this.anchor,n=o.getNode();if(this.forwardDeletion(o,n,t))return;this.modify("extend",t,"word")}this.removeText()}isBackward(){return this.focus.isBefore(this.anchor)}getStartEndPoints(){return[this.anchor,this.focus]}};function vc(e){return e instanceof vm}function A0(e){let t=e.offset;if(e.type==="text")return t;let o=e.getNode();return t===o.getChildrenSize()?o.getTextContent().length:0}function py(e){let t=e.getStartEndPoints();if(t===null)return[0,0];let[o,n]=t;return o.type==="element"&&n.type==="element"&&o.key===n.key&&o.offset===n.offset?[0,0]:[A0(o),A0(n)]}function N0(e,t){for(let o=t;o;o=o.getParent()){if(re(o)){if(o.collapseAtStart(e))return!0;if(un(o))break}if(o.getPreviousSibling())break}return!1}var d5=(()=>{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 D0(e,t,o){let n=e,r=n.getTextContent().split(/(?=\s)/g),a=r.length,s=0,i=0;for(let c=0;c<a;c++){let u=c===a-1;if(i=s,s+=r[c].length,t&&s===o||s>o||u){r.splice(c,1),u&&(i=void 0);break}}let d=r.join("").trim();d===""?n.remove():(n.setTextContent(d),n.select(i,i))}function _0(e,t,o,n){let r,a=t;if(ko(e)){let s=!1,i=e.childNodes,d=i.length,c=n._blockCursorElement;a===d&&(s=!0,a=d-1);let u=i[a],m=!1;if(u===c)u=i[a+1],m=!0;else if(c!==null){let p=c.parentNode;e===p&&t>Array.prototype.indexOf.call(p.children,c)&&a--}if(r=Ri(u),ke(r))a=Rn(r,s?"next":"previous");else{let p=Ri(e);if(p===null)return null;if(re(p)){let f=n.getElementByKey(p.getKey());f===null&&le(214),[p,a]=p.getDOMSlot(f).resolveChildIndex(p,f,e,t),re(p)||le(215),s&&a>=p.getChildrenSize()&&(a=Math.max(0,p.getChildrenSize()-1));let h=p.getChildAtIndex(a);if(re(h)&&(function(y,x,C){let b=y.getParent();return C===null||b===null||!b.canBeEmpty()||b!==C.getNode()})(h,0,o)){let y=s?h.getLastDescendant():h.getFirstDescendant();y===null?p=h:(h=y,p=re(h)?h:h.getParentOrThrow()),a=0}ke(h)?(r=h,p=null,a=Rn(h,s?"next":"previous")):h!==p&&s&&!m&&(re(p)||le(216),a=Math.min(p.getChildrenSize(),a+1))}else{let f=p.getIndexWithinParent();a=t===0&&yt(p)&&Ri(e)===p?f:f+1,p=p.getParentOrThrow()}if(re(p))return En(p.__key,a,"element")}}else r=Ri(e);return ke(r)?En(r.__key,Rn(r,a,"clamp"),"text"):null}function O0(e,t,o){let n=e.offset,r=e.getNode();if(n===0){let a=r.getPreviousSibling(),s=r.getParent();if(t){if((o||!t)&&a===null&&re(s)&&s.isInline()){let i=s.getPreviousSibling();ke(i)&&e.set(i.__key,i.getTextContent().length,"text")}}else re(a)&&!o&&a.isInline()?e.set(a.__key,a.getChildrenSize(),"element"):ke(a)&&e.set(a.__key,a.getTextContent().length,"text")}else if(n===r.getTextContent().length){let a=r.getNextSibling(),s=r.getParent();if(t&&re(a)&&a.isInline())e.set(a.__key,0,"element");else if((o||t)&&a===null&&re(s)&&s.isInline()&&!s.canInsertTextAfter()){let i=s.getNextSibling();ke(i)&&e.set(i.__key,0,"text")}}}function JL(e,t,o){if(e.type==="text"&&t.type==="text"){let n=e.isBefore(t),r=e.is(t);O0(e,n,r),O0(t,!n,r),r&&t.set(e.key,e.offset,e.type)}}function ZL(e,t,o,n,r,a){if(e===null||o===null||!Cc(r,e,o))return null;let s=_0(e,t,Oe(a)?a.anchor:null,r);if(s===null)return null;let i=_0(o,n,Oe(a)?a.focus:null,r);if(i===null)return null;if(s.type==="element"&&i.type==="element"){let d=Ri(e),c=Ri(o);if(yt(d)&&yt(c))return null}return JL(s,i),[s,i]}function c5(e){return re(e)&&!e.isInline()}function eP(e,t,o,n,r,a){let s=Er(),i=new fs(En(e,t,r),En(o,n,a),0,"");return i.dirty=!0,s._selection=i,i}function tP(){let e=En("root",0,"element"),t=En("root",0,"element");return new fs(e,t,0,"")}function By(){return new vm(new Set)}function u5(e,t){return Em(null,e,t,null)}function Em(e,t,o,n){let r=o._window;if(r===null)return null;let a=n||r.event,s=a?a.type:void 0,i=s==="selectionchange",d=!Gh&&(i||s==="beforeinput"||s==="compositionstart"||s==="compositionend"||s==="click"&&a&&a.detail===3||s==="drop"||s===void 0),c,u,m,p;if(Oe(e)&&!d)return e.clone();if(t===null)return null;if(c=t.anchorNode,u=t.focusNode,m=t.anchorOffset,p=t.focusOffset,(i||s===void 0)&&Oe(e)&&!Cc(o,c,u))return e.clone();let f=ZL(c,m,u,p,o,e);if(f===null)return null;let[g,h]=f,y=0,x="";if(Oe(e)){let C=e.anchor;if(g.key===C.key)y=e.format,x=e.style;else{let b=g.getNode();ke(b)?(y=b.getFormat(),x=b.getStyle()):re(b)&&(y=b.getTextFormat(),x=b.getTextStyle())}}return new fs(g,h,y,x)}function Je(){return Er()._selection}function ys(){return mt()._editorState._selection}function Cm(e,t,o,n=1){let r=e.anchor,a=e.focus,s=r.getNode(),i=a.getNode();if(!t.is(s)&&!t.is(i))return;let d=t.__key;if(e.isCollapsed()){let c=r.offset;if(o<=c&&n>0||o<c&&n<0){let u=Math.max(0,c+n);r.set(d,u,"element"),a.set(d,u,"element"),F0(e)}}else{let c=e.isBackward(),u=c?a:r,m=u.getNode(),p=c?r:a,f=p.getNode();if(t.is(m)){let g=u.offset;(o<=g&&n>0||o<g&&n<0)&&u.set(d,Math.max(0,g+n),"element")}if(t.is(f)){let g=p.offset;(o<=g&&n>0||o<g&&n<0)&&p.set(d,Math.max(0,g+n),"element")}}F0(e)}function F0(e){let t=e.anchor,o=t.offset,n=e.focus,r=n.offset,a=t.getNode(),s=n.getNode();if(e.isCollapsed()){if(!re(a))return;let i=a.getChildrenSize(),d=o>=i,c=d?a.getChildAtIndex(i-1):a.getChildAtIndex(o);if(ke(c)){let u=0;d&&(u=c.getTextContentSize()),t.set(c.__key,u,"text"),n.set(c.__key,u,"text")}return}if(re(a)){let i=a.getChildrenSize(),d=o>=i,c=d?a.getChildAtIndex(i-1):a.getChildAtIndex(o);if(ke(c)){let u=0;d&&(u=c.getTextContentSize()),t.set(c.__key,u,"text")}}if(re(s)){let i=s.getChildrenSize(),d=r>=i,c=d?s.getChildAtIndex(i-1):s.getChildAtIndex(r);if(ke(c)){let u=0;d&&(u=c.getTextContentSize()),n.set(c.__key,u,"text")}}}function xm(e,t,o,n,r){let a=null,s=0,i=null;n!==null?(a=n.__key,ke(n)?(s=n.getTextContentSize(),i="text"):re(n)&&(s=n.getChildrenSize(),i="element")):r!==null&&(a=r.__key,ke(r)?i="text":re(r)&&(i="element")),a!==null&&i!==null?e.set(a,s,i):(s=t.getIndexWithinParent(),s===-1&&(s=o.getChildrenSize()),e.set(o.__key,s,"element"))}function B0(e,t,o,n,r){e.type==="text"?e.set(o,e.offset+(t?0:r),"text"):e.offset>n.getIndexWithinParent()&&e.set(e.key,e.offset-1,"element")}function oP(e,t,o,n,r){try{e.setBaseAndExtent(t,o,n,r)}catch{}}function H0(e,t,o){let n=Bi(e,t.getKey());if(re(t)){let r=t.getDOMSlot(n);return[r.element,o+r.getFirstChildOffset()]}return[n,o]}function p5(e,t,o,n,r,a,s){let i=n.anchorNode,d=n.focusNode,c=n.anchorOffset,u=n.focusOffset,m=document.activeElement;if(r.has(WL)&&m!==a||m!==null&&qy(m))return;if(!Oe(t))return void(e!==null&&Cc(o,i,d)&&n.removeAllRanges());let p=t.anchor,f=t.focus,g=p.getNode(),h=f.getNode(),[y,x]=H0(o,g,p.offset),[C,b]=H0(o,h,f.offset),L=t.format,w=t.style,k=t.isCollapsed(),I=y,T=C,S=!1;var P,A,N,B,O;if(p.type==="text"?(I=gs(y),S=g.getFormat()!==L||g.getStyle()!==w):Oe(e)&&e.anchor.type==="text"&&(S=!0),f.type==="text"&&(T=gs(C)),I!==null&&T!==null&&(k&&(e===null||S||Oe(e)&&(e.format!==L||e.style!==w))&&(P=L,A=w,N=x,B=p.key,O=performance.now(),BL=[P,A,N,B,O]),c!==x||u!==b||i!==I||d!==T||n.type==="Range"&&k||(m!==null&&a.contains(m)||r.has(cy)||a.focus({preventScroll:!0}),p.type==="element"))){if(oP(n,I,x,T,b),!da||!t.isCollapsed()||a===null||r.has(cy)||document.activeElement!==null&&a.contains(document.activeElement)||a.focus({preventScroll:!0}),!r.has(GL)&&t.isCollapsed()&&a!==null&&a===document.activeElement){let j=Oe(t)&&t.anchor.type==="element"?I.childNodes[x]||null:n.rangeCount>0?n.getRangeAt(0):null;if(j!==null){let U;if(j instanceof Text){let D=document.createRange();D.selectNode(j),U=D.getBoundingClientRect()}else U=j.getBoundingClientRect();(function(D,J,G){let M=Yy(G),X=Jy(M);if(M===null||X===null)return;let{top:F,bottom:ee}=J,Y=0,ae=0,te=G;for(;te!==null;){let de=te===M.body;if(de)Y=0,ae=Yo(D).innerHeight;else{let ne=te.getBoundingClientRect();Y=ne.top,ae=ne.bottom}let ge=0;if(F<Y?ge=-(Y-F):ee>ae&&(ge=ee-ae),ge!==0)if(de)X.scrollBy(0,ge);else{let ne=te.scrollTop;te.scrollTop+=ge;let Z=te.scrollTop-ne;F-=Z,ee-=Z}if(de)break;te=bc(te)}})(o,U,a)}}iy=!0}}function m5(e){let t=Je()||ys();t===null&&(t=Xo().selectEnd()),t.insertNodes(e)}function f5(){let e=Je();return e===null?"":e.getTextContent()}function Hh(e){let t=e;e.isCollapsed()||t.removeText();let o=Je();Oe(o)&&(t=o),Oe(t)||le(161);let n=t.anchor,r=n.getNode(),a=n.offset;for(;!kr(r);){let s=r;if([r,a]=g5(r,a),s.is(r))break}return a}function g5(e,t){let o=e.getParent();if(!o){let r=Lr();return Xo().append(r),r.select(),[Xo(),0]}if(ke(e)){let r=e.splitText(t);if(r.length===0)return[o,e.getIndexWithinParent()];let a=t===0?0:1;return[o,r[0].getIndexWithinParent()+a]}if(!re(e)||t===0)return[o,e.getIndexWithinParent()];let n=e.getChildAtIndex(t);if(n){let r=new fs(En(e.__key,t,"element"),En(e.__key,t,"element"),0,""),a=e.insertNewAfter(r);a&&a.append(n,...n.getNextSiblings())}return[o,e.getIndexWithinParent()+1]}function U0(e,t,o,n,r="decorators-and-blocks"){if(t==="move"&&n==="character"&&!e.isCollapsed()){let[u,m]=o===e.isBackward()?[e.focus,e.anchor]:[e.anchor,e.focus];return m.set(u.key,u.offset,u.type),!0}let a=fa(e.focus,o?"previous":"next"),s=n==="lineboundary",i=t==="move",d=a,c=r==="decorators-and-blocks";if(!_P(d)){for(let u of d){c=!1;let{origin:m}=u;if(!yt(m)||m.isIsolated()||(d=u,!s||!m.isInline()))break}if(c)for(let u of nv(a).iterNodeCarets(t==="extend"?"shadowRoot":"root")){if(Pn(u))u.origin.isInline()||(d=u);else{if(re(u.origin))continue;yt(u.origin)&&!u.origin.isInline()&&(d=u)}break}}if(d===a)return!1;if(i&&!s&&yt(d.origin)&&d.origin.isKeyboardSelectable()){let u=By();return u.add(d.origin.getKey()),$o(u),!0}return d=kn(d),i&&Ki(e.anchor,d),Ki(e.focus,d),c||!s}var ao=null,so=null,Uo=!1,Uh=!1,sm=0,$0={characterData:!0,childList:!0,subtree:!0};function qi(){return Uo||ao!==null&&ao._readOnly}function no(){Uo&&le(13)}function nP(){sm>99&&le(14)}function Er(){return ao===null&&le(195,rP()),ao}function mt(){return so===null&&le(196,rP()),so}function rP(){let e=0,t=new Set,o=ua.version;if(typeof window<"u")for(let r of document.querySelectorAll("[contenteditable]")){let a=xc(r);if(Am(a))e++;else if(a){let s=String(a.constructor.version||"<0.17.1");s===o&&(s+=" (separately built, likely a bundler configuration issue)"),t.add(s)}}let n=` Detected on the page: ${e} compatible editor(s) with version ${o}`;return t.size&&(n+=` and incompatible editors with versions ${Array.from(t).join(", ")}`),n}function h5(){return so}function z0(e,t,o){let n=t.__type,r=zy(e,n),a=o.get(n);a===void 0&&(a=Array.from(r.transforms),o.set(n,a));let s=a.length;for(let i=0;i<s&&(a[i](t),t.isAttached());i++);}function K0(e,t){return e!==void 0&&e.__key!==t&&e.isAttached()}function aP(e,t){if(!t)return;let o=e._updateTags,n=t;Array.isArray(t)||(n=[t]);for(let r of n)o.add(r)}function y5(e){return Hy(e,mt()._nodes)}function Hy(e,t){let o=e.type,n=t.get(o);n===void 0&&le(17,o);let r=n.klass;e.type!==r.getType()&&le(18,r.name);let a=r.importJSON(e),s=e.children;if(re(a)&&Array.isArray(s))for(let i=0;i<s.length;i++){let d=Hy(s[i],t);a.append(d)}return a}function q0(e,t,o){let n=ao,r=Uo,a=so;ao=t,Uo=!0,so=e;try{return o()}finally{ao=n,Uo=r,so=a}}function Sr(e,t){let o=e._pendingEditorState,n=e._rootElement,r=e._headless||n===null;if(o===null)return;let a=e._editorState,s=a._selection,i=o._selection,d=e._dirtyType!==0,c=ao,u=Uo,m=so,p=e._updating,f=e._observer,g=null;if(e._pendingEditorState=null,e._editorState=o,!r&&d&&f!==null){so=e,ao=o,Uo=!1,e._updating=!0;try{let k=e._dirtyType,I=e._dirtyElements,T=e._dirtyLeaves;f.disconnect(),g=OK(a,o,e,k,I,T)}catch(k){if(k instanceof Error&&e._onError(k),Uh)throw k;return dP(e,null,n,o),cL(e),e._dirtyType=2,Uh=!0,Sr(e,a),void(Uh=!1)}finally{f.observe(n,$0),e._updating=p,ao=c,Uo=u,so=m}}o._readOnly||(o._readOnly=!0);let h=e._dirtyLeaves,y=e._dirtyElements,x=e._normalizedNodes,C=e._updateTags,b=e._deferred;d&&(e._dirtyType=0,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements=new Map,e._normalizedNodes=new Set,e._updateTags=new Set),(function(k,I){let T=k._decorators,S=k._pendingDecorators||T,P=I._nodeMap,A;for(A in S)P.has(A)||(S===T&&(S=gP(k)),delete S[A])})(e,o);let L=r?null:An(Yo(e));if(e._editable&&L!==null&&(d||i===null||i.dirty||!i.is(s))&&n!==null&&!C.has(jL)){so=e,ao=o;try{if(f!==null&&f.disconnect(),d||i===null||i.dirty){let k=e._blockCursorElement;k!==null&&gy(k,e,n),p5(s,i,e,L,C,n)}(function(k,I,T){let S=k._blockCursorElement;if(Oe(T)&&T.isCollapsed()&&T.anchor.type==="element"&&I.contains(document.activeElement)){let P=T.anchor,A=P.getNode(),N=P.offset,B=!1,O=null;if(N===A.getChildrenSize())zh(A.getChildAtIndex(N-1))&&(B=!0);else{let j=A.getChildAtIndex(N);if(j!==null&&zh(j)){let U=j.getPreviousSibling();(U===null||zh(U))&&(B=!0,O=k.getElementByKey(j.__key))}}if(B){let j=k.getElementByKey(A.__key);return S===null&&(k._blockCursorElement=S=(function(U){let D=U.theme,J=document.createElement("div");J.contentEditable="false",J.setAttribute("data-lexical-cursor","true");let G=D.blockCursor;if(G!==void 0){if(typeof G=="string"){let M=Ic(G);G=D.blockCursor=M}G!==void 0&&J.classList.add(...G)}return J})(k._config)),I.style.caretColor="transparent",void(O===null?j.appendChild(S):j.insertBefore(S,O))}}S!==null&&gy(S,k,I)})(e,n,i)}finally{f!==null&&f.observe(n,$0),so=m,ao=c}}g!==null&&(function(k,I,T,S,P){let A=Array.from(k._listeners.mutation),N=A.length;for(let B=0;B<N;B++){let[O,j]=A[B];for(let U of j){let D=I.get(U);D!==void 0&&O(D,{dirtyLeaves:S,prevEditorState:P,updateTags:T})}}})(e,g,C,h,a),Oe(i)||i===null||s!==null&&s.is(i)||e.dispatchCommand(Sy,void 0);let w=e._pendingDecorators;w!==null&&(e._decorators=w,e._pendingDecorators=null,oc("decorator",e,!0,w)),(function(k,I,T){let S=V0(I),P=V0(T);S!==P&&oc("textcontent",k,!0,P)})(e,t||a,o),oc("update",e,!0,{dirtyElements:y,dirtyLeaves:h,editorState:o,mutatedNodes:g,normalizedNodes:x,prevEditorState:t||a,tags:C}),(function(k,I){if(k._deferred=[],I.length!==0){let T=k._updating;k._updating=!0;try{for(let S=0;S<I.length;S++)I[S]()}finally{k._updating=T}}})(e,b),(function(k){let I=k._updates;if(I.length!==0){let T=I.shift();if(T){let[S,P]=T;Mm(k,S,P)}}})(e)}function oc(e,t,o,...n){let r=t._updating;t._updating=o;try{let a=Array.from(t._listeners[e]);for(let s=0;s<a.length;s++)a[s].apply(null,n)}finally{t._updating=r}}function W0(e,t){let o=e._updates,n=t||!1;for(;o.length!==0;){let r=o.shift();if(r){let[a,s]=r,i=e._pendingEditorState,d;s!==void 0&&(d=s.onUpdate,s.skipTransforms&&(n=!0),s.discrete&&(i===null&&le(191),i._flushSync=!0),d&&e._deferred.push(d),aP(e,s.tag)),i==null?Mm(e,a,s):a()}}return n}function Mm(e,t,o){let n=e._updateTags,r,a=!1,s=!1;o!==void 0&&(r=o.onUpdate,aP(e,o.tag),a=o.skipTransforms||!1,s=o.discrete||!1),r&&e._deferred.push(r);let i=e._editorState,d=e._pendingEditorState,c=!1;(d===null||d._readOnly)&&(d=e._pendingEditorState=sP(d||i),c=!0),d._flushSync=s;let u=ao,m=Uo,p=so,f=e._updating;ao=d,Uo=!1,e._updating=!0,so=e;let g=e._headless||e.getRootElement()===null;$y(null);try{c&&(g?i._selection!==null&&(d._selection=i._selection.clone()):d._selection=(function(C,b){let L=C.getEditorState()._selection,w=An(Yo(C));return Oe(L)||L==null?Em(L,w,C,b):L.clone()})(e,o&&o.event||null));let y=e._compositionKey;t(),a=W0(e,a),(function(C,b){let L=b.getEditorState()._selection,w=C._selection;if(Oe(w)){let k=w.anchor,I=w.focus,T;if(k.type==="text"&&(T=k.getNode(),T.selectionTransform(L,w)),I.type==="text"){let S=I.getNode();T!==S&&S.selectionTransform(L,w)}}})(d,e),e._dirtyType!==0&&(a?(function(C,b){let L=b._dirtyLeaves,w=C._nodeMap;for(let k of L){let I=w.get(k);ke(I)&&I.isAttached()&&I.isSimpleText()&&!I.isUnmergeable()&&C0(I)}})(d,e):(function(C,b){let L=b._dirtyLeaves,w=b._dirtyElements,k=C._nodeMap,I=sa(),T=new Map,S=L,P=S.size,A=w,N=A.size;for(;P>0||N>0;){if(P>0){b._dirtyLeaves=new Set;for(let B of S){let O=k.get(B);ke(O)&&O.isAttached()&&O.isSimpleText()&&!O.isUnmergeable()&&C0(O),O!==void 0&&K0(O,I)&&z0(b,O,T),L.add(B)}if(S=b._dirtyLeaves,P=S.size,P>0){sm++;continue}}b._dirtyLeaves=new Set,b._dirtyElements=new Map,A.delete("root")&&A.set("root",!0);for(let B of A){let O=B[0],j=B[1];if(w.set(O,j),!j)continue;let U=k.get(O);U!==void 0&&K0(U,I)&&z0(b,U,T)}S=b._dirtyLeaves,P=S.size,A=b._dirtyElements,N=A.size,sm++}b._dirtyLeaves=L,b._dirtyElements=w})(d,e),W0(e),(function(C,b,L,w){let k=C._nodeMap,I=b._nodeMap,T=[];for(let[S]of w){let P=I.get(S);P!==void 0&&(P.isAttached()||(re(P)&&iL(P,S,k,I,T,w),k.has(S)||w.delete(S),T.push(S)))}for(let S of T)I.delete(S);for(let S of L){let P=I.get(S);P===void 0||P.isAttached()||(k.has(S)||L.delete(S),I.delete(S))}})(i,d,e._dirtyLeaves,e._dirtyElements)),y!==e._compositionKey&&(d._flushSync=!0);let x=d._selection;if(Oe(x)){let C=d._nodeMap,b=x.anchor.key,L=x.focus.key;C.get(b)!==void 0&&C.get(L)!==void 0||le(19)}else vc(x)&&x._nodes.size===0&&(d._selection=null)}catch(y){return y instanceof Error&&e._onError(y),e._pendingEditorState=i,e._dirtyType=2,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements.clear(),void Sr(e)}finally{ao=u,Uo=m,so=p,e._updating=f,sm=0}e._dirtyType!==0||e._deferred.length>0||(function(y,x){let C=x.getEditorState()._selection,b=y._selection;if(b!==null){if(b.dirty||!b.is(C))return!0}else if(C!==null)return!0;return!1})(d,e)?d._flushSync?(d._flushSync=!1,Sr(e)):c&&k5(()=>{Sr(e)}):(d._flushSync=!1,c&&(n.clear(),e._deferred=[],e._pendingEditorState=null))}function or(e,t,o){so===e&&o===void 0?t():Mm(e,t,o)}var my=class e{element;before;after;constructor(t,o,n){this.element=t,this.before=o||null,this.after=n||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 o=this.before||this.getManagedLineBreak();return o!==null&&o.parentElement!==this.element&&le(222),this.element.insertBefore(t,o),this}removeChild(t){return t.parentElement!==this.element&&le(223),this.element.removeChild(t),this}replaceChild(t,o){return o.parentElement!==this.element&&le(224),this.element.replaceChild(t,o),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 o=t==="decorator"&&(km||yc||Sm);this.insertManagedLineBreak(o)}}removeManagedLineBreak(){let t=this.getManagedLineBreak();if(t){let o=this.element,n=t.nodeName==="IMG"?t.nextSibling:null;n&&o.removeChild(n),o.removeChild(t),o.__lexicalLineBreak=void 0}}insertManagedLineBreak(t){let o=this.getManagedLineBreak();if(o){if(t===(o.nodeName==="IMG"))return;this.removeManagedLineBreak()}let n=this.element,r=this.before,a=document.createElement("br");if(n.insertBefore(a,r),t){let s=document.createElement("img");s.setAttribute("data-lexical-linebreak","true"),s.style.cssText="display: inline !important; border: 0px !important; margin: 0px !important;",s.alt="",n.insertBefore(s,a),n.__lexicalLineBreak=s}else n.__lexicalLineBreak=a}getFirstChildOffset(){let t=0;for(let o=this.after;o!==null;o=o.previousSibling)t++;return t}resolveChildIndex(t,o,n,r){if(n===this.element){let d=this.getFirstChildOffset();return[t,Math.min(d+t.getChildrenSize(),Math.max(d,r))]}let a=G0(o,n);a.push(r);let s=G0(o,this.element),i=t.getIndexWithinParent();for(let d=0;d<s.length;d++){let c=a[d],u=s[d];if(c===void 0||c<u)break;if(c>u){i+=1;break}}return[t.getParentOrThrow(),i]}};function G0(e,t){let o=[],n=t;for(;n!==e&&n!==null;n=n.parentNode){let r=0;for(let a=n.previousSibling;a!==null;a=a.previousSibling)r++;o.push(r)}return n!==e&&le(225),o.reverse()}var ca=class extends cn{__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 wK[t]||""}getStyle(){return this.getLatest().__style}getIndent(){return this.getLatest().__indent}getChildren(){let t=[],o=this.getFirstChild();for(;o!==null;)t.push(o),o=o.getNextSibling();return t}getChildrenKeys(){let t=[],o=this.getFirstChild();for(;o!==null;)t.push(o.__key),o=o.getNextSibling();return t}getChildrenSize(){return this.getLatest().__size}isEmpty(){return this.getChildrenSize()===0}isDirty(){let t=mt()._dirtyElements;return t!==null&&t.has(this.__key)}isLastChild(){let t=this.getLatest(),o=this.getParentOrThrow().getLastChild();return o!==null&&o.is(t)}getAllTextNodes(){let t=[],o=this.getFirstChild();for(;o!==null;){if(ke(o)&&t.push(o),re(o)){let n=o.getAllTextNodes();t.push(...n)}o=o.getNextSibling()}return t}getFirstDescendant(){let t=this.getFirstChild();for(;re(t);){let o=t.getFirstChild();if(o===null)break;t=o}return t}getLastDescendant(){let t=this.getLastChild();for(;re(t);){let o=t.getLastChild();if(o===null)break;t=o}return t}getDescendantByIndex(t){let o=this.getChildren(),n=o.length;if(t>=n){let a=o[n-1];return re(a)&&a.getLastDescendant()||a||null}let r=o[t];return re(r)&&r.getFirstDescendant()||r||null}getFirstChild(){let t=this.getLatest().__first;return t===null?null:Vt(t)}getFirstChildOrThrow(){let t=this.getFirstChild();return t===null&&le(45,this.__key),t}getLastChild(){let t=this.getLatest().__last;return t===null?null:Vt(t)}getLastChildOrThrow(){let t=this.getLastChild();return t===null&&le(96,this.__key),t}getChildAtIndex(t){let o=this.getChildrenSize(),n,r;if(t<o/2){for(n=this.getFirstChild(),r=0;n!==null&&r<=t;){if(r===t)return n;n=n.getNextSibling(),r++}return null}for(n=this.getLastChild(),r=o-1;n!==null&&r>=t;){if(r===t)return n;n=n.getPreviousSibling(),r--}return null}getTextContent(){let t="",o=this.getChildren(),n=o.length;for(let r=0;r<n;r++){let a=o[r];t+=a.getTextContent(),re(a)&&r!==n-1&&!a.isInline()&&(t+=Lm)}return t}getTextContentSize(){let t=0,o=this.getChildren(),n=o.length;for(let r=0;r<n;r++){let a=o[r];t+=a.getTextContentSize(),re(a)&&r!==n-1&&!a.isInline()&&(t+=2)}return t}getDirection(){return this.getLatest().__dir}getTextFormat(){return this.getLatest().__textFormat}hasFormat(t){if(t!==""){let o=Wh[t];return(this.getFormat()&o)!==0}return!1}hasTextFormat(t){let o=Co[t];return(this.getTextFormat()&o)!==0}getFormatFlags(t,o){return gc(this.getLatest().__textFormat,t,o)}getTextStyle(){return this.getLatest().__textStyle}select(t,o){no();let n=Je(),r=t,a=o,s=this.getChildrenSize();if(!this.canBeEmpty()){if(t===0&&o===0){let d=this.getFirstChild();if(ke(d)||re(d))return d.select(0,0)}else if(!(t!==void 0&&t!==s||o!==void 0&&o!==s)){let d=this.getLastChild();if(ke(d)||re(d))return d.select()}}r===void 0&&(r=s),a===void 0&&(a=s);let i=this.__key;return Oe(n)?(n.anchor.set(i,r,"element"),n.focus.set(i,a,"element"),n.dirty=!0,n):eP(i,r,i,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(o=>o.remove()),t}append(...t){return this.splice(this.getChildrenSize(),0,t)}setDirection(t){let o=this.getWritable();return o.__dir=t,o}setFormat(t){return this.getWritable().__format=t!==""?Wh[t]:0,this}setStyle(t){return this.getWritable().__style=t||"",this}setTextFormat(t){let o=this.getWritable();return o.__textFormat=t,o}setTextStyle(t){let o=this.getWritable();return o.__textStyle=t,o}setIndent(t){return this.getWritable().__indent=t,this}splice(t,o,n){ym(this)&&le(324,this.__key,this.__type);let r=this.getChildrenSize(),a=this.getWritable();t+o<=r||le(226,String(t),String(o),String(r));let s=a.__key,i=[],d=[],c=this.getChildAtIndex(t+o),u=null,m=r-o+n.length;if(t!==0)if(t===r)u=this.getLastChild();else{let f=this.getChildAtIndex(t);f!==null&&(u=f.getPreviousSibling())}if(o>0){let f=u===null?this.getFirstChild():u.getNextSibling();for(let g=0;g<o;g++){f===null&&le(100);let h=f.getNextSibling(),y=f.__key;la(f.getWritable()),d.push(y),f=h}}let p=u;for(let f of n){p!==null&&f.is(p)&&(u=p=p.getPreviousSibling());let g=f.getWritable();g.__parent===s&&m--,la(g);let h=f.__key;if(p===null)a.__first=h,g.__prev=null;else{let y=p.getWritable();y.__next=h,g.__prev=y.__key}f.__key===s&&le(76),g.__parent=s,i.push(h),p=f}if(t+o===r)p!==null&&(p.getWritable().__next=null,a.__last=p.__key);else if(c!==null){let f=c.getWritable();if(p!==null){let g=p.getWritable();f.__prev=p.__key,g.__next=c.__key}else f.__prev=null}if(a.__size=m,d.length){let f=Je();if(Oe(f)){let g=new Set(d),h=new Set(i),{anchor:y,focus:x}=f;j0(y,g,h)&&xm(y,y.getNode(),this,u,c),j0(x,g,h)&&xm(x,x.getNode(),this,u,c),m!==0||this.canBeEmpty()||un(this)||this.remove()}}return a}getDOMSlot(t){return new my(t)}exportDOM(t){let{element:o}=super.exportDOM(t);if(ko(o)){let n=this.getIndent();n>0&&(o.style.paddingInlineStart=40*n+"px");let r=this.getDirection();r&&(o.dir=r)}return{element:o}}exportJSON(){let t={children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),...super.exportJSON()},o=this.getTextFormat(),n=this.getTextStyle();return o===0&&n===""||un(this)||this.getChildren().some(ke)||(o!==0&&(t.textFormat=o),n!==""&&(t.textStyle=n)),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,o){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,o,n){return!1}canMergeWhenEmpty(){return!1}reconcileObservedMutation(t,o){let n=this.getDOMSlot(t),r=n.getFirstChild();for(let a=this.getFirstChild();a;a=a.getNextSibling()){let s=o.getElementByKey(a.getKey());s!==null&&(r==null?(n.insertChild(s),r=s):r!==s&&n.replaceChild(s,r),r=r.nextSibling)}}};function re(e){return e instanceof ca}function j0(e,t,o){let n=e.getNode();for(;n;){let r=n.__key;if(t.has(r)&&!o.has(r))return!0;n=n.getParent()}return!1}var mc=class extends cn{decorate(t,o){return null}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}};function yt(e){return e instanceof mc}var Oi=class e extends ca{__cachedText;static getType(){return"root"}static clone(){return new e}constructor(){super("root"),this.__cachedText=null}getTopLevelElementOrThrow(){le(51)}getTextContent(){let t=this.__cachedText;return!qi()&&mt()._dirtyType!==0||t===null?super.getTextContent():t}remove(){le(52)}replace(t){le(53)}insertBefore(t){le(54)}insertAfter(t){le(55)}updateDOM(t,o){return!1}splice(t,o,n){for(let r of n)re(r)||yt(r)||le(282);return super.splice(t,o,n)}static importJSON(t){return Xo().updateFromJSON(t)}collapseAtStart(){return!0}};function lo(e){return e instanceof Oi}function sP(e){return new fc(new Map(e._nodeMap))}function Uy(){return new fc(new Map([["root",new Oi]]))}function iP(e){let t=e.exportJSON(),o=e.constructor;if(t.type!==o.getType()&&le(130,o.name),re(e)){let n=t.children;Array.isArray(n)||le(59,o.name);let r=e.getChildren();for(let a=0;a<r.length;a++){let s=iP(r[a]);n.push(s)}}return t}function v5(e){return e instanceof fc}var fc=class e{_nodeMap;_selection;_flushSync;_readOnly;constructor(t,o){this._nodeMap=t,this._selection=o||null,this._flushSync=!1,this._readOnly=!1}isEmpty(){return this._nodeMap.size===1&&this._selection===null}read(t,o){return q0(o&&o.editor||null,this,t)}clone(t){let o=new e(this._nodeMap,t===void 0?this._selection:t);return o._readOnly=!0,o}toJSON(){return q0(null,this,()=>({root:iP(Xo())}))}},bm=class extends ca{static getType(){return"artificial"}createDOM(t){return document.createElement("div")}},Fi=class e extends ca{static getType(){return"paragraph"}static clone(t){return new e(t.__key)}createDOM(t){let o=document.createElement("p"),n=Ai(t.theme,"paragraph");return n!==void 0&&o.classList.add(...n),o}updateDOM(t,o,n){return!1}static importDOM(){return{p:t=>({conversion:C5,priority:0})}}exportDOM(t){let{element:o}=super.exportDOM(t);if(ko(o)){this.isEmpty()&&o.append(document.createElement("br"));let n=this.getFormatType();n&&(o.style.textAlign=n)}return{element:o}}static importJSON(t){return Lr().updateFromJSON(t)}exportJSON(){let t=super.exportJSON();if(t.textFormat===void 0||t.textStyle===void 0){let o=this.getChildren().find(ke);o?(t.textFormat=o.getFormat(),t.textStyle=o.getStyle()):(t.textFormat=this.getTextFormat(),t.textStyle=this.getTextStyle())}return t}insertNewAfter(t,o){let n=Lr();n.setTextFormat(t.format),n.setTextStyle(t.style);let r=this.getDirection();return n.setDirection(r),n.setFormat(this.getFormatType()),n.setStyle(this.getStyle()),this.insertAfter(n,o),n}collapseAtStart(){let t=this.getChildren();if(t.length===0||ke(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 C5(e){let t=Lr();if(e.style&&(t.setFormat(e.style.textAlign),RP(e,t)),t.getFormatType()===""){let o=e.getAttribute("align");o&&o&&o in Wh&&t.setFormat(o)}return{node:t}}function Lr(){return wc(new Fi)}function lP(e){return e instanceof Fi}var Pi=0,x5=1,b5=2,w5=3,T5=4;function dP(e,t,o,n){let r=e._keyToDOMMap;r.clear(),e._editorState=Uy(),e._pendingEditorState=n,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=""),o!==null&&(o.textContent="",r.set("root",o))}function cP(e){let t=new Set,o=new Set,n=e;for(;n;){let{ownNodeConfig:r}=Tc(n),a=n.transform;if(!o.has(a)){o.add(a);let s=n.transform();s&&t.add(s)}if(r){let s=r.$transform;s&&t.add(s),n=r.extends}else{let s=Object.getPrototypeOf(n);n=s.prototype instanceof cn&&s!==cn?s:void 0}}return t}function I5(e){let t=e||{},o=h5(),n=t.theme||{},r=e===void 0?o:t.parentEditor||null,a=t.disableEvents||!1,s=Uy(),i=t.namespace||(r!==null?r._config.namespace:vP()),d=t.editorState,c=[Oi,ms,Ni,_i,Fi,bm,...t.nodes||[]],{onError:u,html:m}=t,p=t.editable===void 0||t.editable,f;if(e===void 0&&o!==null)f=o._nodes;else{f=new Map;for(let h=0;h<c.length;h++){let y=c[h],x=null,C=null;if(typeof y!="function"){let w=y;y=w.replace,x=w.with,C=w.withKlass||null}Tc(y);let b=y.getType(),L=cP(y);f.set(b,{exportDOM:m&&m.export?m.export.get(y):void 0,klass:y,replace:x,replaceWithKlass:C,sharedNodeState:uL(c[h]),transforms:L})}}let g=new ua(s,r,f,{disableEvents:a,namespace:i,theme:n},u||console.error,(function(h,y){let x=new Map,C=new Set,b=L=>{Object.keys(L).forEach(w=>{let k=x.get(w);k===void 0&&(k=[],x.set(w,k)),k.push(L[w])})};return h.forEach(L=>{let w=L.klass.importDOM;if(w==null||C.has(w))return;C.add(w);let k=w.call(L.klass);k!==null&&b(k)}),y&&b(y),x})(f,m?m.import:void 0),p,e);return d!==void 0&&(g._pendingEditorState=d,g._dirtyType=2),(function(h){h.registerCommand(ky,GK,Pi),h.registerCommand(Ly,jK,Pi),h.registerCommand(Py,VK,Pi),h.registerCommand(Ry,QK,Pi),h.registerCommand(Ny,XK,Pi)})(g),g}var ua=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,o,n,r,a,s,i,d){this._createEditorArgs=d,this._parentEditor=o,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=n,this._decorators={},this._pendingDecorators=null,this._dirtyType=0,this._cloneNotNeeded=new Set,this._dirtyLeaves=new Set,this._dirtyElements=new Map,this._normalizedNodes=new Set,this._updateTags=new Set,this._observer=null,this._key=vP(),this._onError=a,this._htmlConversions=s,this._editable=i,this._headless=o!==null&&o._headless,this._window=null,this._blockCursorElement=null}isComposing(){return this._compositionKey!=null}registerUpdateListener(t){let o=this._listeners.update;return o.add(t),()=>{o.delete(t)}}registerEditableListener(t){let o=this._listeners.editable;return o.add(t),()=>{o.delete(t)}}registerDecoratorListener(t){let o=this._listeners.decorator;return o.add(t),()=>{o.delete(t)}}registerTextContentListener(t){let o=this._listeners.textcontent;return o.add(t),()=>{o.delete(t)}}registerRootListener(t){let o=this._listeners.root;return t(this._rootElement,null),o.add(t),()=>{t(null,this._rootElement),o.delete(t)}}registerCommand(t,o,n){n===void 0&&le(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&&le(36,String(t));let s=a[n];return s.add(o),()=>{s.delete(o),a.every(i=>i.size===0)&&r.delete(t)}}registerMutationListener(t,o,n){let r=this.resolveRegisteredNodeAfterReplacements(this.getRegisteredNode(t)).klass,a=this._listeners.mutation,s=a.get(o);s===void 0&&(s=new Set,a.set(o,s)),s.add(r);let i=n&&n.skipInitialization;return i!==void 0&&i||this.initializeMutationListener(o,r),()=>{s.delete(r),s.size===0&&a.delete(o)}}getRegisteredNode(t){let o=this._nodes.get(t.getType());return o===void 0&&le(37,t.name),o}resolveRegisteredNodeAfterReplacements(t){for(;t.replaceWithKlass;)t=this.getRegisteredNode(t.replaceWithKlass);return t}initializeMutationListener(t,o){let n=this._editorState,r=yy(n).get(o.getType());if(!r)return;let a=new Map;for(let s of r.keys())a.set(s,"created");a.size>0&&t(a,{dirtyLeaves:new Set,prevEditorState:n,updateTags:new Set(["registerMutationListener"])})}registerNodeTransformToKlass(t,o){let n=this.getRegisteredNode(t);return n.transforms.add(o),n}registerNodeTransform(t,o){let n=this.registerNodeTransformToKlass(t,o),r=[n],a=n.replaceWithKlass;if(a!=null){let s=this.registerNodeTransformToKlass(a,o);r.push(s)}return(function(s,i){let d=yy(s.getEditorState()),c=[];for(let u of i){let m=d.get(u);m&&c.push(m)}c.length!==0&&s.update(()=>{for(let u of c)for(let m of u.keys()){let p=Vt(m);p&&p.markDirty()}},s._pendingEditorState===null?{tag:am}:void 0)})(this,r.map(s=>s.klass.getType())),()=>{r.forEach(s=>s.transforms.delete(o))}}hasNode(t){return this._nodes.has(t.getType())}hasNodes(t){return t.every(this.hasNode.bind(this))}dispatchCommand(t,o){return we(this,t,o)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(t){let o=this._rootElement;if(t!==o){let n=Ai(this._config.theme,"root"),r=this._pendingEditorState||this._editorState;if(this._rootElement=t,dP(this,o,t,r),o!==null&&(this._config.disableEvents||YK(o),n!=null&&o.classList.remove(...n)),t!==null){let a=Jy(t),s=t.style;s.userSelect="text",s.whiteSpace="pre-wrap",s.wordBreak="break-word",t.setAttribute("data-lexical-editor","true"),this._window=a,this._dirtyType=2,cL(this),this._updateTags.add(am),Sr(this),this._config.disableEvents||(function(i,d){let c=i.ownerDocument;sy.set(i,c);let u=gm.get(c)??0;u<1&&c.addEventListener("selectionchange",KL),gm.set(c,u+1),i.__lexicalEditor=d;let m=zL(i);for(let p=0;p<ay.length;p++){let[f,g]=ay[p],h=typeof g=="function"?y=>{k0(y)||(S0(y),(d.isEditable()||f==="click")&&g(y,d))}:y=>{if(k0(y))return;S0(y);let x=d.isEditable();switch(f){case"cut":return x&&we(d,_y,y);case"copy":return we(d,Dy,y);case"paste":return x&&we(d,Ey,y);case"dragstart":return x&&we(d,EL,y);case"dragover":return x&&we(d,ML,y);case"dragend":return x&&we(d,AL,y);case"focus":return x&&we(d,NL,y);case"blur":return x&&we(d,DL,y);case"drop":return x&&we(d,RL,y)}};i.addEventListener(f,h),m.push(()=>{i.removeEventListener(f,h)})}})(t,this),n!=null&&t.classList.add(...n)}else this._window=null,this._updateTags.add(am),Sr(this);oc("root",this,!1,t,o)}}getElementByKey(t){return this._keyToDOMMap.get(t)||null}getEditorState(){return this._editorState}setEditorState(t,o){t.isEmpty()&&le(38);let n=t;n._readOnly&&(n=sP(t),n._selection=t._selection?t._selection.clone():null),dL(this);let r=this._pendingEditorState,a=this._updateTags,s=o!==void 0?o.tag:null;r===null||r.isEmpty()||(s!=null&&a.add(s),Sr(this)),this._pendingEditorState=n,this._dirtyType=2,this._dirtyElements.set("root",!1),this._compositionKey=null,s!=null&&a.add(s),this._updating||Sr(this)}parseEditorState(t,o){return(function(n,r,a){let s=Uy(),i=ao,d=Uo,c=so,u=r._dirtyElements,m=r._dirtyLeaves,p=r._cloneNotNeeded,f=r._dirtyType;r._dirtyElements=new Map,r._dirtyLeaves=new Set,r._cloneNotNeeded=new Set,r._dirtyType=0,ao=s,Uo=!1,so=r,$y(null);try{let g=r._nodes;Hy(n.root,g),a&&a(),s._readOnly=!0}catch(g){g instanceof Error&&r._onError(g)}finally{r._dirtyElements=u,r._dirtyLeaves=m,r._cloneNotNeeded=p,r._dirtyType=f,ao=i,Uo=d,so=c}return s})(typeof t=="string"?JSON.parse(t):t,this,o)}read(t){return Sr(this),this.getEditorState().read(t,{editor:this})}update(t,o){(function(n,r,a){n._updating?n._updates.push([r,a]):Mm(n,r,a)})(this,t,o)}focus(t,o={}){let n=this._rootElement;n!==null&&(n.setAttribute("autocapitalize","off"),or(this,()=>{let r=Je(),a=Xo();r!==null?r.dirty||$o(r.clone()):a.getChildrenSize()!==0&&(o.defaultSelection==="rootStart"?a.selectStart():a.selectEnd()),_m("focus"),TP(()=>{n.removeAttribute("autocapitalize"),t&&t()})}),this._pendingEditorState===null&&n.removeAttribute("autocapitalize"))}blur(){let t=this._rootElement;t!==null&&t.blur();let o=An(this._window);o!==null&&o.removeAllRanges()}isEditable(){return this._editable}setEditable(t){this._editable!==t&&(this._editable=t,oc("editable",this,!0,t))}toJSON(){return{editorState:this._editorState.toJSON()}}};ua.version="0.41.0+prod.esm";var fy=null;function $y(e){fy=e}var uP=1;function S5(){uP=1}function zy(e,t){let o=Ky(e,t);return o===void 0&&le(30,t),o}function Ky(e,t){return e._nodes.get(t)}var k5=typeof queueMicrotask=="function"?queueMicrotask:e=>{Promise.resolve().then(e)};function pP(e){return yt(Dm(e))}function qy(e){let t=document.activeElement;if(!ko(t))return!1;let o=t.nodeName;return yt(Dm(e))&&(o==="INPUT"||o==="TEXTAREA"||t.contentEditable==="true"&&xc(t)==null)}function Cc(e,t,o){let n=e.getRootElement();try{return n!==null&&n.contains(t)&&n.contains(o)&&t!==null&&!qy(t)&&Wy(t)===e}catch{return!1}}function Am(e){return e instanceof ua}function Wy(e){let t=e;for(;t!=null;){let o=xc(t);if(Am(o))return o;t=bc(t)}return null}function xc(e){return e?e.__lexicalEditor:null}function L5(e){return CK.test(e)?"rtl":xK.test(e)?"ltr":null}function ia(e){return Fy(e)||e.isToken()}function Ir(e){return ia(e)||e.isSegmented()}function nr(e){return Wi(e)&&e.nodeType===3}function mP(e){return Wi(e)&&e.nodeType===9}function gs(e){let t=e;for(;t!=null;){if(nr(t))return t;t=t.firstChild}return null}function gc(e,t,o){let n=Co[t];if(o!==null&&(e&n)===(o&n))return e;let r=e^n;return t==="subscript"?r&=~Co.superscript:t==="superscript"?r&=~Co.subscript:t==="lowercase"?(r&=~Co.uppercase,r&=~Co.capitalize):t==="uppercase"?(r&=~Co.lowercase,r&=~Co.capitalize):t==="capitalize"&&(r&=~Co.lowercase,r&=~Co.uppercase),r}function P5(e){return ke(e)||cs(e)||yt(e)}function fP(e,t){let o=(function(){let s=fy;return fy=null,s})();if((t=t||o&&o.__key)!=null)return void(e.__key=t);no(),nP();let n=mt(),r=Er(),a=""+uP++;r._nodeMap.set(a,e),re(e)?n._dirtyElements.set(a,!0):n._dirtyLeaves.add(a),n._cloneNotNeeded.add(a),n._dirtyType=1,e.__key=a}function la(e){let t=e.getParent();if(t!==null){let o=e.getWritable(),n=t.getWritable(),r=e.getPreviousSibling(),a=e.getNextSibling(),s=a!==null?a.__key:null,i=r!==null?r.__key:null,d=r!==null?r.getWritable():null,c=a!==null?a.getWritable():null;r===null&&(n.__first=s),a===null&&(n.__last=i),d!==null&&(d.__next=s),c!==null&&(c.__prev=i),o.__prev=null,o.__next=null,o.__parent=null,n.__size--}}function wm(e){nP(),ym(e)&&le(323,e.__key,e.__type);let t=e.getLatest(),o=t.__parent,n=Er(),r=mt(),a=n._nodeMap,s=r._dirtyElements;o!==null&&(function(d,c,u){let m=d;for(;m!==null;){if(u.has(m))return;let p=c.get(m);if(p===void 0)break;u.set(m,!1),m=p.__parent}})(o,a,s);let i=t.__key;r._dirtyType=1,re(e)?s.set(i,!0):r._dirtyLeaves.add(i)}function ro(e){no();let t=mt(),o=t._compositionKey;if(e!==o){if(t._compositionKey=e,o!==null){let n=Vt(o);n!==null&&n.getWritable()}if(e!==null){let n=Vt(e);n!==null&&n.getWritable()}}}function sa(){return qi()?null:mt()._compositionKey}function Vt(e,t){let o=(t||Er())._nodeMap.get(e);return o===void 0?null:o}function Gy(e,t){let o=Nm(e,mt());return o!==void 0?Vt(o,t):null}function Nm(e,t){return e[`__lexicalKey_${t._key}`]}function Dm(e,t){let o=e;for(;o!=null;){let n=Gy(o,t);if(n!==null)return n;o=bc(o)}return null}function gP(e){let t=e._decorators,o=Object.assign({},t);return e._pendingDecorators=o,o}function V0(e){return e.read(()=>Xo().getTextContent())}function Xo(){return hP(Er())}function hP(e){return e._nodeMap.get("root")}function $o(e){no();let t=Er();e!==null&&(e.dirty=!0,e.setCachedNodes(null)),t._selection=e}function Ri(e){let t=mt(),o=(function(n,r){let a=n;for(;a!=null;){let s=Nm(a,r);if(s!==void 0)return s;a=bc(a)}return null})(e,t);return o===null?e===t.getRootElement()?Vt("root"):null:Vt(o)}function yP(e){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(e)}function jy(e){let t=[],o=e;for(;o!==null;)t.push(o),o=o._parentEditor;return t}function vP(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,5)}function CP(e){return nr(e)?e.nodeValue:null}function Vy(e,t,o){let n=An(Yo(t));if(n===null)return;let r=n.anchorNode,{anchorOffset:a,focusOffset:s}=n;if(r!==null){let i=CP(r),d=Dm(r);if(i!==null&&ke(d)){if((i===sc||i===wy)&&o){let c=o.length;i=o,a=c,s=c}i!==null&&Qy(d,i,a,s,e)}}}function Qy(e,t,o,n,r){let a=e;if(a.isAttached()&&(r||!a.isDirty())){let s=a.isComposing(),i=t;if((s||r)&&(t.endsWith(sc)&&(i=t.slice(0,-sc.length)),r)){let c=wy,u;for(;(u=i.indexOf(c))!==-1;)i=i.slice(0,u)+i.slice(u+c.length),o!==null&&o>u&&(o=Math.max(u,o-c.length)),n!==null&&n>u&&(n=Math.max(u,n-c.length))}let d=a.getTextContent();if(r||i!==d){if(i===""){if(ro(null),Sm||yc||km)a.remove();else{let h=mt();setTimeout(()=>{h.update(()=>{a.isAttached()&&a.remove()})},20)}return}let c=a.getParent(),u=ys(),m=a.getTextContentSize(),p=sa(),f=a.getKey();if(a.isToken()||p!==null&&f===p&&!s||Oe(u)&&(c!==null&&!c.canInsertTextBefore()&&u.anchor.offset===0||u.anchor.key===e.__key&&u.anchor.offset===0&&!a.canInsertTextBefore()&&!s||u.focus.key===e.__key&&u.focus.offset===m&&!a.canInsertTextAfter()&&!s))return void a.markDirty();let g=Je();if(!Oe(g)||o===null||n===null)return void Q0(a,i,g);if(g.setTextNodeRange(a,o,a,n),a.isSegmented()){let h=oo(a.getTextContent());a.replace(h),a=h}Q0(a,i,g)}}}function Q0(e,t,o){if(e.setTextContent(t),Oe(o)){let n=e.getKey();for(let r of["anchor","focus"]){let a=o[r];a.type==="text"&&a.key===n&&(a.offset=Rn(e,a.offset,"clamp"))}}}function Zp(e,t,o){let n=t[o]||!1;return n==="any"||n===e[o]}function xP(e,t){return Zp(e,t,"altKey")&&Zp(e,t,"ctrlKey")&&Zp(e,t,"shiftKey")&&Zp(e,t,"metaKey")}function at(e,t,o){if(!xP(e,o))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 n="Key"+t.toUpperCase();return e.code===n}var Tr={ctrlKey:!Sn,metaKey:Sn},X0={altKey:Sn,ctrlKey:!Sn};function Y0(e){return e.key==="Backspace"}function J0(e){return at(e,"a",Tr)}function R5(e){let t=Xo();if(Oe(e)){let o=e.anchor,n=e.focus,r=o.getNode().getTopLevelElementOrThrow().getParentOrThrow();return o.set(r.getKey(),0,"element"),n.set(r.getKey(),r.getChildrenSize(),"element"),dm(e),e}{let o=t.select(0,t.getChildrenSize());return $o(dm(o)),o}}function Ai(e,t){e.__lexicalClassNameCache===void 0&&(e.__lexicalClassNameCache={});let o=e.__lexicalClassNameCache,n=o[t];if(n!==void 0)return n;let r=e[t];if(typeof r=="string"){let a=Ic(r);return o[t]=a,a}return r}function Xy(e,t,o,n,r){if(o.size===0)return;let a=n.__type,s=n.__key,i=t.get(a);i===void 0&&le(33,a);let d=i.klass,c=e.get(d);c===void 0&&(c=new Map,e.set(d,c));let u=c.get(s),m=u==="destroyed"&&r==="created";(u===void 0||m)&&c.set(s,m?"updated":r)}function E5(e){let t=e.getType(),o=Er();if(o._readOnly){let a=yy(o).get(t);return a?Array.from(a.values()):[]}let n=o._nodeMap,r=[];for(let[,a]of n)a instanceof e&&a.__type===t&&a.isAttached()&&r.push(a);return r}function Z0(e,t,o){let n=e.getParent(),r=o,a=e;return n!==null&&(t&&o===0?(r=a.getIndexWithinParent(),a=n):t||o!==a.getChildrenSize()||(r=a.getIndexWithinParent()+1,a=n)),a.getChildAtIndex(t?r-1:r)}function bP(e,t){let o=e.offset;if(e.type==="element")return Z0(e.getNode(),t,o);{let n=e.getNode();if(t&&o===0||!t&&o===n.getTextContentSize()){let r=t?n.getPreviousSibling():n.getNextSibling();return r===null?Z0(n.getParentOrThrow(),t,n.getIndexWithinParent()+(t?0:1)):r}}return null}function wP(e){let t=Yo(e).event,o=t&&t.inputType;return o==="insertFromPaste"||o==="insertFromPasteAsQuotation"}function we(e,t,o){return(function(n,r,a){let s=jy(n);for(let i=4;i>=0;i--)for(let d=0;d<s.length;d++){let c=s[d],u=c._commands.get(r);if(u!==void 0){let m=u[i];if(m!==void 0){let p=Array.from(m),f=p.length,g=!1;if(or(c,()=>{for(let h=0;h<f;h++)if(p[h](a,n))return void(g=!0)}),g)return g}}}return!1})(e,t,o)}function Bi(e,t){let o=e._keyToDOMMap.get(t);return o===void 0&&le(75,t),o}function bc(e){let t=e.assignedSlot||e.parentElement;return LP(t)?t.host:t}function Yy(e){return mP(e)?e:ko(e)?e.ownerDocument:null}function M5(e){return mt()._updateTags.has(e)}function _m(e){no(),mt()._updateTags.add(e)}function TP(e){no(),mt()._deferred.push(e)}function Tm(e,t){let o=e.getParent();for(;o!==null;){if(o.is(t))return!0;o=o.getParent()}return!1}function Jy(e){let t=Yy(e);return t?t.defaultView:null}function Yo(e){let t=e._window;return t===null&&le(78),t}function A5(e){return re(e)&&e.isInline()||yt(e)&&e.isInline()}function IP(e){let t=e.getParentOrThrow();for(;t!==null;){if(un(t))return t;t=t.getParentOrThrow()}return t}function un(e){return lo(e)||re(e)&&e.isShadowRoot()}function Zy(e){let t=e.constructor.clone(e);return fP(t,null),t.afterCloneFrom(e),t}function wc(e){let t=mt(),o=e.getType(),n=Ky(t,o);n===void 0&&le(200,e.constructor.name,o);let{replace:r,replaceWithKlass:a}=n;if(r!==null){let s=r(e),i=s.constructor;return a!==null?s instanceof a||le(201,a.name,a.getType(),i.name,i.getType(),e.constructor.name,o):s instanceof e.constructor&&i!==e.constructor||le(202,i.name,i.getType(),e.constructor.name,o),s.__key===e.__key&&le(203,e.constructor.name,o,i.name,i.getType()),s}return e}function $h(e,t){!lo(e.getParent())||re(t)||yt(t)||le(99)}function SP(e){let t=Vt(e);return t===null&&le(63,e),t}function zh(e){return(yt(e)||re(e)&&!e.canBeEmpty())&&!e.isInline()}function gy(e,t,o){o.style.removeProperty("caret-color"),t._blockCursorElement=null;let n=e.parentElement;n!==null&&n.removeChild(e)}function An(e){return Mn?(e||window).getSelection():null}function kP(e){let t=Jy(e);return t?t.getSelection():null}function N5(e,t){let o=e.getChildAtIndex(t);o==null&&(o=e),un(e)&&le(102);let n=s=>{let i=s.getParentOrThrow(),d=un(i),c=s!==o||d?Zy(s):s;if(d)return re(s)&&re(c)||le(133),s.insertAfter(c),[s,c,c];{let[u,m,p]=n(i),f=s.getNextSiblings();return p.append(c,...f),[u,m,c]}},[r,a]=n(o);return[r,a]}function D5(e){return ko(e)&&e.tagName==="A"}function ko(e){return Wi(e)&&e.nodeType===1}function Wi(e){return typeof e=="object"&&e!==null&&"nodeType"in e&&typeof e.nodeType=="number"}function LP(e){return Wi(e)&&e.nodeType===11}function PP(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 hy(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 kr(e){if(yt(e)&&!e.isInline())return!0;if(!re(e)||un(e))return!1;let t=e.getFirstChild(),o=t===null||cs(t)||ke(t)||t.isInline();return!e.isInline()&&e.canBeEmpty()!==!1&&o}function ev(){return mt()}var eL=new WeakMap,_5=new Map;function yy(e){if(!e._readOnly&&e.isEmpty())return _5;e._readOnly||le(192);let t=eL.get(e);return t||(t=(function(o){let n=new Map;for(let[r,a]of o._nodeMap){let s=a.__type,i=n.get(s);i||(i=new Map,n.set(s,i)),i.set(r,a)}return n})(e),eL.set(e,t)),t}function tv(e){let t=e.constructor.clone(e);return t.afterCloneFrom(e),t}function O5(e){return(t=tv(e))[qL]=!0,t;var t}function RP(e,t){let o=parseInt(e.style.paddingInlineStart,10)||0,n=Math.round(o/40);t.setIndent(n)}function F5(e){e.__lexicalUnmanaged=!0}function EP(e){return e.__lexicalUnmanaged===!0}function Jd(e,t){return(function(o,n){return Object.prototype.hasOwnProperty.call(o,n)})(e,t)&&e[t]!==cn[t]}function Tc(e){let t=p0 in e.prototype?e.prototype[p0]():void 0,o=(function(s){if(!(s===cn||s.prototype instanceof cn)){let i="<unknown>",d="<unknown>";try{i=s.getType()}catch{}try{ua.version&&(d=JSON.parse(ua.version))}catch{}le(290,s.name,i,d)}return s===mc||s===ca||s===cn})(e),n=!o&&Jd(e,"getType")?e.getType():void 0,r,a=n;if(t)if(n)r=t[n];else for(let[s,i]of Object.entries(t))a=s,r=i;if(!o&&a&&(Jd(e,"getType")||(e.getType=()=>a),Jd(e,"clone")||(e.clone=s=>($y(s),new e)),Jd(e,"importJSON")||(e.importJSON=r&&r.$importJSON||(s=>new e().updateFromJSON(s))),!Jd(e,"importDOM")&&r)){let{importDOM:s}=r;s&&(e.importDOM=()=>s)}return{ownNodeConfig:r,ownNodeType:a}}function B5(e){let t=ev();return no(),new(t.resolveRegisteredNodeAfterReplacements(t.getRegisteredNode(e))).klass}var nc=(e,t)=>{let o=e;for(;o!=null&&!lo(o);){if(t(o))return o;o=o.getParent()}return null},H5={next:"previous",previous:"next"},Hi=class{origin;constructor(t){this.origin=t}[Symbol.iterator](){return rv({hasNext:hs,initial:this.getAdjacentCaret(),map:t=>t,step:t=>t.getAdjacentCaret()})}getAdjacentCaret(){return io(this.getNodeAtCaret(),this.direction)}getSiblingCaret(){return io(this.origin,this.direction)}remove(){let t=this.getNodeAtCaret();return t&&t.remove(),this}replaceOrInsert(t,o){let n=this.getNodeAtCaret();return t.is(this.origin)||t.is(n)||(n===null?this.insert(t):n.replace(t,o)),this}splice(t,o,n="next"){let r=n===this.direction?o:Array.from(o).reverse(),a=this,s=this.getParentAtCaret(),i=new Map;for(let d=a.getAdjacentCaret();d!==null&&i.size<t;d=d.getAdjacentCaret()){let c=d.origin.getWritable();i.set(c.getKey(),c)}for(let d of r){if(i.size>0){let c=a.getNodeAtCaret();if(c){if(i.delete(c.getKey()),i.delete(d.getKey()),!(c.is(d)||a.origin.is(d))){let u=d.getParent();u&&u.is(s)&&d.remove(),c.replace(d)}}else c===null&&le(263,Array.from(i).join(" "))}else a.insert(d);a=io(d,this.direction)}for(let d of i.values())d.remove();return this}},hc=class e extends Hi{type="child";getLatest(){let t=this.origin.getLatest();return t===this.origin?this:Rr(t,this.direction)}getParentCaret(t="root"){return io(ov(this.getParentAtCaret(),t),this.direction)}getFlipped(){let t=ha(this.direction);return io(this.getNodeAtCaret(),t)||Rr(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)}},U5={root:lo,shadowRoot:un};function ha(e){return H5[e]}function ov(e,t="root"){return U5[t](e)?null:e}var Ui=class e extends Hi{type="sibling";getLatest(){let t=this.origin.getLatest();return t===this.origin?this:io(t,this.direction)}getSiblingCaret(){return this}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return re(this.origin)?Rr(this.origin,this.direction):null}getParentCaret(t="root"){return io(ov(this.getParentAtCaret(),t),this.direction)}getFlipped(){let t=ha(this.direction);return io(this.getNodeAtCaret(),t)||Rr(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 $i)&&this.direction===t.direction&&this.origin.is(t.origin)}},$i=class e extends Hi{type="text";offset;constructor(t,o){super(t),this.offset=o}getLatest(){let t=this.origin.getLatest();return t===this.origin?this:pa(t,this.direction,this.offset)}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return null}getParentCaret(t="root"){return io(ov(this.getParentAtCaret(),t),this.direction)}getFlipped(){return pa(this.origin,ha(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 Ui||t instanceof e)&&this.direction===t.direction&&this.origin.is(t.origin)}getSiblingCaret(){return io(this.origin,this.direction)}};function Pr(e){return e instanceof $i}function $5(e){return e instanceof Hi}function hs(e){return e instanceof Ui}function Pn(e){return e instanceof hc}var z5={next:class extends $i{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends $i{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},K5={next:class extends Ui{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends Ui{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},q5={next:class extends hc{direction="next";getNodeAtCaret(){return this.origin.getFirstChild()}insert(e){return this.origin.splice(0,0,[e]),this}},previous:class extends hc{direction="previous";getNodeAtCaret(){return this.origin.getLastChild()}insert(e){return this.origin.splice(this.origin.getChildrenSize(),0,[e]),this}}};function io(e,t){return e?new K5[t](e):null}function pa(e,t,o){return e?new z5[t](e,Rn(e,o)):null}function Rn(e,t,o="error"){let n=e.getTextContentSize(),r=t==="next"?n:t==="previous"?0:t;return(r<0||r>n)&&(o!=="clamp"&&nL(284,String(t),String(n),e.getKey()),r=r<0?0:n),r}function vy(e,t){return new Im(e,t)}function Rr(e,t){return re(e)?new q5[t](e):null}function MP(e){return e&&e.getChildCaret()||e}function zi(e){return e&&MP(e.getAdjacentCaret())}var Cy=class e{type="node-caret-range";direction;anchor;focus;constructor(t,o,n){this.anchor=t,this.focus=o,this.direction=n}getLatest(){let t=this.anchor.getLatest(),o=this.focus.getLatest();return t===this.anchor&&o===this.focus?this:new e(t,o,this.direction)}isCollapsed(){return this.anchor.isSamePointCaret(this.focus)}getTextSlices(){let t=r=>{let a=this[r].getLatest();return Pr(a)?(function(s,i){let{direction:d,origin:c}=s,u=Rn(c,i==="focus"?ha(d):d);return vy(s,u-s.offset)})(a,r):null},o=t("anchor"),n=t("focus");if(o&&n){let{caret:r}=o,{caret:a}=n;if(r.isSameNodeCaret(a))return[vy(r,a.offset-r.offset),null]}return[o,n]}iterNodeCarets(t="root"){let o=Pr(this.anchor)?this.anchor.getSiblingCaret():this.anchor.getLatest(),n=this.focus.getLatest(),r=Pr(n),a=s=>s.isSameNodeCaret(n)?null:zi(s)||s.getParentCaret(t);return rv({hasNext:s=>s!==null&&!(r&&n.isSameNodeCaret(s)),initial:o.isSameNodeCaret(n)?null:a(o),map:s=>s,step:a})}[Symbol.iterator](){return this.iterNodeCarets("root")}},Im=class{type="slice";caret;distance;constructor(t,o){this.caret=t,this.distance=o}getSliceIndices(){let{distance:t,caret:{offset:o}}=this,n=o+t;return n<o?[n,o]:[o,n]}getTextContent(){let[t,o]=this.getSliceIndices();return this.caret.origin.getTextContent().slice(t,o)}getTextContentSize(){return Math.abs(this.distance)}removeTextSlice(){let{caret:{origin:t,direction:o}}=this,[n,r]=this.getSliceIndices(),a=t.getTextContent();return pa(t.setTextContent(a.slice(0,n)+a.slice(r)),o,n)}};function W5(e){return e instanceof Im}function nv(e){return ma(e,io(Xo(),e.direction))}function AP(e){return ma(e,e)}function ma(e,t){return e.direction!==t.direction&&le(265),new Cy(e,t,e.direction)}function rv(e){let{initial:t,hasNext:o,step:n,map:r}=e,a=t;return{[Symbol.iterator](){return this},next(){if(!o(a))return{done:!0,value:void 0};let s={done:!1,value:r(a)};return a=n(a),s}}}function av(e,t){let o=rc(e.origin,t.origin);switch(o===null&&le(275,e.origin.getKey(),t.origin.getKey()),o.type){case"same":{let n=e.type==="text",r=t.type==="text";return n&&r?(function(a,s){return Math.sign(a-s)})(e.offset,t.offset):e.type===t.type?0:n?-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 sv(o)}}function sv(e){let{a:t,b:o}=e,n=t.__key,r=o.__key,a=t,s=o;for(;a&&s;a=a.getNextSibling(),s=s.getNextSibling()){if(a.__key===r)return-1;if(s.__key===n)return 1}return a===null?1:-1}function em(e,t){return t.is(e)}function tL(e){return re(e)?[e.getLatest(),null]:[e.getParent(),e.getLatest()]}function rc(e,t){if(e.is(t))return{commonAncestor:e,type:"same"};let o=new Map;for(let[n,r]=tL(e);n;r=n,n=n.getParent())o.set(n,r);for(let[n,r]=tL(t);n;r=n,n=n.getParent()){let a=o.get(n);if(a!==void 0)return a===null?(em(e,n)||le(276),{commonAncestor:n,type:"ancestor"}):r===null?(em(t,n)||le(277),{commonAncestor:n,type:"descendant"}):((re(a)||em(e,a))&&(re(r)||em(t,r))&&n.is(a.getParent())&&n.is(r.getParent())||le(278),{a,b:r,commonAncestor:n,type:"branch"})}return null}function fa(e,t){let{type:o,key:n,offset:r}=e,a=SP(e.key);return o==="text"?(ke(a)||le(266,a.getType(),n),pa(a,t,r)):(re(a)||le(267,a.getType(),n),OP(a,e.offset,t))}function Ki(e,t){let{origin:o,direction:n}=t,r=n==="next";Pr(t)?e.set(o.getKey(),t.offset,"text"):hs(t)?ke(o)?e.set(o.getKey(),Rn(o,n),"text"):e.set(o.getParentOrThrow().getKey(),o.getIndexWithinParent()+(r?1:0),"element"):(Pn(t)&&re(o)||le(268),e.set(o.getKey(),r?0:o.getChildrenSize(),"element"))}function NP(e){let t=Je(),o=Oe(t)?t:tP();return ac(o,e),$o(o),o}function ac(e,t){Ki(e.anchor,t.anchor),Ki(e.focus,t.focus)}function xy(e){let{anchor:t,focus:o}=e,n=fa(t,"next"),r=fa(o,"next"),a=av(n,r)<=0?"next":"previous";return ma(ga(n,a),ga(r,a))}function Gi(e){let{direction:t,origin:o}=e,n=io(o,ha(t)).getNodeAtCaret();return n?io(n,t):Rr(o.getParentOrThrow(),t)}function oL(e,t="root"){let o=[e];for(let n=Pn(e)?e.getParentCaret(t):e.getSiblingCaret();n!==null;n=n.getParentCaret(t))o.push(Gi(n));return o}function Kh(e){return!!e&&e.origin.isAttached()}function DP(e,t="removeEmptySlices"){if(e.isCollapsed())return e;let o="root",n="next",r=t,a=iv(e,n),s=oL(a.anchor,o),i=oL(a.focus.getFlipped(),o),d=new Set,c=[];for(let g of a.iterNodeCarets(o))if(Pn(g))d.add(g.origin.getKey());else if(hs(g)){let{origin:h}=g;re(h)&&!d.has(h.getKey())||c.push(h)}for(let g of c)g.remove();for(let g of a.getTextSlices()){if(!g)continue;let{origin:h}=g.caret,y=h.getTextContentSize(),x=Gi(io(h,n)),C=h.getMode();if(Math.abs(g.distance)===y&&r==="removeEmptySlices"||C==="token"&&g.distance!==0)x.remove();else if(g.distance!==0){r="removeEmptySlices";let b=g.removeTextSlice(),L=g.caret.origin;if(C==="segmented"){let w=b.origin,k=oo(w.getTextContent()).setStyle(w.getStyle()).setFormat(w.getFormat());x.replaceOrInsert(k),b=pa(k,n,b.offset)}L.is(s[0].origin)&&(s[0]=b),L.is(i[0].origin)&&(i[0]=b.getFlipped())}}let u,m;for(let g of s)if(Kh(g)){u=kn(g);break}for(let g of i)if(Kh(g)){m=kn(g);break}let p=(function(g,h,y){if(!g||!h)return null;let x=g.getParentAtCaret(),C=h.getParentAtCaret();if(!x||!C)return null;let b=x.getParents().reverse();b.push(x);let L=C.getParents().reverse();L.push(C);let w=Math.min(b.length,L.length),k;for(k=0;k<w&&b[k]===L[k];k++);let I=(P,A)=>{let N;for(let B=k;B<P.length;B++){let O=P[B];if(un(O))return;!N&&A(O)&&(N=O)}return N},T=I(b,kr),S=T&&I(L,P=>y.has(P.getKey())&&kr(P));return T&&S?[T,S]:null})(u,m,d);if(p){let[g,h]=p;Rr(g,"previous").splice(0,h.getChildren());let y=h.getParent();for(h.remove(!0);y&&y.isEmpty();){let x=y;y=y.getParent(),x.remove(!0)}}let f=[u,m,...s,...i].find(Kh);if(f)return AP(ga(kn(f),e.direction));le(269,JSON.stringify(s.map(g=>g.origin.__key)))}function kn(e){let t=(function(r){let a=r;for(;Pn(a);){let s=zi(a);if(!Pn(s))break;a=s}return a})(e.getLatest()),{direction:o}=t;if(ke(t.origin))return Pr(t)?t:pa(t.origin,o,o);let n=t.getAdjacentCaret();return hs(n)&&ke(n.origin)?pa(n.origin,o,ha(o)):t}function _P(e){return Pr(e)&&e.offset!==Rn(e.origin,e.direction)}function ga(e,t){return e.direction===t?e:e.getFlipped()}function iv(e,t){return e.direction===t?e:ma(ga(e.focus,t),ga(e.anchor,t))}function OP(e,t,o){let n=Rr(e,"next");for(let r=0;r<t;r++){let a=n.getAdjacentCaret();if(a===null)break;n=a}return ga(n,o)}function G5(e,t="root"){let o=0,n=e,r=zi(n);for(;r===null;){if(o--,r=n.getParentCaret(t),!r)return null;n=r,r=zi(n)}return r&&[r,o]}function j5(e){let{origin:t,offset:o,direction:n}=e;if(o===Rn(t,n))return e.getSiblingCaret();if(o===Rn(t,ha(n)))return Gi(e.getSiblingCaret());let[r]=t.splitText(o);return ke(r)||le(281),ga(io(r,"next"),n)}function V5(e,t){return!0}function Q5(e,{$copyElementNode:t=Zy,$splitTextPointCaretNext:o=j5,rootMode:n="shadowRoot",$shouldSplit:r=V5}={}){if(Pr(e))return o(e);let a=e.getParentCaret(n);if(a){let{origin:s}=a;if(Pn(e)&&(!s.canBeEmpty()||!r(s,"first")))return Gi(a);let i=(function(d){let c=[];for(let u=d.getAdjacentCaret();u;u=u.getAdjacentCaret())c.push(u.origin);return c})(e);(i.length>0||s.canBeEmpty()&&r(s,"last"))&&a.insert(t(s).splice(0,0,i))}return a}function X5(e){return e}function Y5(...e){return e}function J5(e,t){return[e,t]}function Z5(e){return e}function eq(e,t){if(!t||e===t)return e;for(let o in t)if(e[o]!==t[o])return{...e,...t};return e}function Ic(...e){let t=[];for(let o of e)if(o&&typeof o=="string")for(let[n]of o.matchAll(/\S+/g))t.push(n);return t}function tq(e,...t){let o=Ic(...t);o.length>0&&e.classList.add(...o)}function oq(e,...t){let o=Ic(...t);o.length>0&&e.classList.remove(...o)}function nq(...e){return()=>{for(let t=e.length-1;t>=0;t--)e[t]();e.length=0}}var _=lv,pde=_.$addUpdateTag,ya=_.$applyNodeReplacement,ji=_.$caretFromPoint,FP=_.$caretRangeFromSelection,Om=_.$cloneWithProperties,BP=_.$cloneWithPropertiesEphemeral,mde=_.$comparePointCaretNext,fde=_.$copyNode,HP=_.$create,vs=_.$createLineBreakNode,UP=_.$createNodeSelection,pn=_.$createParagraphNode,gde=_.$createPoint,Cs=_.$createRangeSelection,$P=_.$createRangeSelectionFromDom,zP=_.$createTabNode,Nn=_.$createTextNode,KP=_.$extendCaretToRange,Mr=_.$findMatchingParent,dv=_.$getAdjacentChildCaret,hde=_.$getAdjacentNode,xs=_.$getAdjacentSiblingOrParentSiblingCaret,cv=_.$getCaretInDirection,qP=_.$getCaretRange,yde=_.$getCaretRangeInDirection,WP=_.$getCharacterOffsets,va=_.$getChildCaret,vde=_.$getChildCaretAtIndex,uv=_.$getChildCaretOrSelf,GP=_.$getCollapsedCaretRange,Cde=_.$getCommonAncestor,xde=_.$getCommonAncestorResultBranchOrder,Fm=_.$getEditor,bde=_.$getNearestNodeFromDOMNode,wde=_.$getNearestRootOrShadowRoot,Ca=_.$getNodeByKey,Tde=_.$getNodeByKeyOrThrow,jP=_.$getNodeFromDOMNode,Sc=_.$getPreviousSelection,Ye=_.$getRoot,Te=_.$getSelection,Ar=_.$getSiblingCaret,Bm=_.$getState,Ide=_.$getStateChange,Sde=_.$getTextContent,kde=_.$getTextNodeOffset,Lde=_.$getTextPointCaret,Pde=_.$getTextPointCaretSlice,Rde=_.$getWritableNodeState,VP=_.$hasAncestor,Ede=_.$hasUpdateTag,Mde=_.$insertNodes,Vi=_.$isBlockElementNode,kc=_.$isChildCaret,Hm=_.$isDecoratorNode,QP=_.$isEditorState,_e=_.$isElementNode,XP=_.$isExtendableTextPointCaret,Ade=_.$isInlineElementOrDecoratorNode,YP=_.$isLeafNode,Lc=_.$isLineBreakNode,Nde=_.$isNodeCaret,pv=_.$isNodeSelection,JP=_.$isParagraphNode,ye=_.$isRangeSelection,Pc=_.$isRootNode,bs=_.$isRootOrShadowRoot,ZP=_.$isSiblingCaret,Dde=_.$isTabNode,Ke=_.$isTextNode,Um=_.$isTextPointCaret,_de=_.$isTextPointCaretSlice,mv=_.$isTokenOrSegmented,Ode=_.$isTokenOrTab,Fde=_.$nodesOfType,eR=_.$normalizeCaret,tR=_.$normalizeSelection__EXPERIMENTAL,Bde=_.$onUpdate,oR=_.$parseSerializedNode,Hde=_.$removeTextFromCaretRange,nR=_.$rewindSiblingCaret,$m=_.$selectAll,Ude=_.$setCompositionKey,$de=_.$setPointFromCaret,mn=_.$setSelection,rR=_.$setSelectionFromCaretRange,zm=_.$setState,aR=_.$splitAtPointCaretNext,sR=_.$splitNode,zde=_.$updateRangeSelectionFromCaretRange,fv=_.ArtificialNode__DO_NOT_USE,Kde=_.BEFORE_INPUT_COMMAND,iR=_.BLUR_COMMAND,Rc=_.CAN_REDO_COMMAND,Ec=_.CAN_UNDO_COMMAND,Km=_.CLEAR_EDITOR_COMMAND,lR=_.CLEAR_HISTORY_COMMAND,dR=_.CLICK_COMMAND,qde=_.COLLABORATION_TAG,qm=_.COMMAND_PRIORITY_CRITICAL,vt=_.COMMAND_PRIORITY_EDITOR,Jo=_.COMMAND_PRIORITY_HIGH,Qi=_.COMMAND_PRIORITY_LOW,Wde=_.COMMAND_PRIORITY_NORMAL,Gde=_.COMPOSITION_END_COMMAND,cR=_.COMPOSITION_END_TAG,jde=_.COMPOSITION_START_COMMAND,uR=_.COMPOSITION_START_TAG,pR=_.CONTROLLED_TEXT_INSERTION_COMMAND,Wm=_.COPY_COMMAND,mR=_.CUT_COMMAND,Gm=_.DELETE_CHARACTER_COMMAND,fR=_.DELETE_LINE_COMMAND,gR=_.DELETE_WORD_COMMAND,Vde=_.DRAGEND_COMMAND,Qde=_.DRAGOVER_COMMAND,hR=_.DRAGSTART_COMMAND,yR=_.DROP_COMMAND,xa=_.DecoratorNode,Xde=_.ElementNode,vR=_.FOCUS_COMMAND,Yde=_.FORMAT_ELEMENT_COMMAND,CR=_.FORMAT_TEXT_COMMAND,jm=_.HISTORIC_TAG,zo=_.HISTORY_MERGE_TAG,xR=_.HISTORY_PUSH_TAG,gv=_.INDENT_CONTENT_COMMAND,Jde=_.INPUT_COMMAND,hv=_.INSERT_LINE_BREAK_COMMAND,bR=_.INSERT_PARAGRAPH_COMMAND,wR=_.INSERT_TAB_COMMAND,Mc=_.INTERNAL_$isBlock,Zde=_.IS_ALL_FORMATTING,ece=_.IS_BOLD,tce=_.IS_CODE,oce=_.IS_HIGHLIGHT,nce=_.IS_ITALIC,rce=_.IS_STRIKETHROUGH,ace=_.IS_SUBSCRIPT,sce=_.IS_SUPERSCRIPT,ice=_.IS_UNDERLINE,TR=_.KEY_ARROW_DOWN_COMMAND,Vm=_.KEY_ARROW_LEFT_COMMAND,Qm=_.KEY_ARROW_RIGHT_COMMAND,IR=_.KEY_ARROW_UP_COMMAND,Xm=_.KEY_BACKSPACE_COMMAND,Ym=_.KEY_DELETE_COMMAND,SR=_.KEY_DOWN_COMMAND,Jm=_.KEY_ENTER_COMMAND,kR=_.KEY_ESCAPE_COMMAND,lce=_.KEY_MODIFIER_COMMAND,dce=_.KEY_SPACE_COMMAND,Zm=_.KEY_TAB_COMMAND,LR=_.LineBreakNode,cce=_.MOVE_TO_END,uce=_.MOVE_TO_START,pce=_.NODE_STATE_KEY,PR=_.OUTDENT_CONTENT_COMMAND,ef=_.PASTE_COMMAND,RR=_.PASTE_TAG,ER=_.ParagraphNode,MR=_.REDO_COMMAND,AR=_.REMOVE_TEXT_COMMAND,NR=_.RootNode,mce=_.SELECTION_CHANGE_COMMAND,DR=_.SELECTION_INSERT_CLIPBOARD_NODES_COMMAND,_R=_.SELECT_ALL_COMMAND,fce=_.SKIP_COLLAB_TAG,OR=_.SKIP_DOM_SELECTION_TAG,yv=_.SKIP_SCROLL_INTO_VIEW_TAG,gce=_.SKIP_SELECTION_FOCUS_TAG,FR=_.TEXT_TYPE_TO_FORMAT,BR=_.TabNode,tf=_.TextNode,HR=_.UNDO_COMMAND,Ac=_.addClassNamesToElement,hce=_.buildImportMap,of=_.configExtension,UR=_.createCommand,nf=_.createEditor,yce=_.createSharedNodeState,$R=_.createState,zR=_.declarePeerDependency,zt=_.defineExtension,vce=_.flipDirection,Cce=_.getDOMOwnerDocument,vv=_.getDOMSelection,xce=_.getDOMSelectionFromTarget,KR=_.getDOMTextNode,bce=_.getEditorPropertyFromDOMNode,wce=_.getNearestEditorFromDOMNode,qR=_.getRegisteredNode,Tce=_.getRegisteredNodeOrThrow,Ice=_.getStaticNodeConfig,Sce=_.getTextDirection,kce=_.getTransformSetFromKlass,WR=_.isBlockDomNode,Lce=_.isCurrentlyReadOnlyMode,GR=_.isDOMDocumentNode,jR=_.isDOMNode,Pce=_.isDOMTextNode,Rce=_.isDOMUnmanaged,Cv=_.isDocumentFragment,Ece=_.isExactShortcutMatch,VR=_.isHTMLAnchorElement,rf=_.isHTMLElement,Nc=_.isInlineDomNode,Mce=_.isLexicalEditor,Ace=_.isModifierMatch,Nce=_.isSelectionCapturedInDecoratorInput,QR=_.isSelectionWithinEditor,xv=_.makeStepwiseIterator,rr=_.mergeRegister,Dce=_.normalizeClassNames,af=_.removeClassNamesFromElement,_ce=_.removeFromParent,Oce=_.resetRandomKey,Dn=_.safeCast,Fce=_.setDOMUnmanaged,Bce=_.setNodeIndentFromDOM,sf=_.shallowMergeConfig,bv=_.toggleTextFormatType;var wv={};Ut(wv,{LexicalComposer:()=>aq});$();var XR=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,rq=XR?fe:H,lf={tag:zo};function aq({initialConfig:e,children:t}){let o=W(()=>{let{theme:n,namespace:r,nodes:a,onError:s,editorState:i,html:d}=e,c=u0(null,n),u=nf({editable:e.editable,html:d,namespace:r,nodes:a,onError:m=>s(m,u),theme:n});return(function(m,p){if(p!==null){if(p===void 0)m.update(()=>{let f=Ye();if(f.isEmpty()){let g=pn();f.append(g);let h=XR?document.activeElement:null;(Te()!==null||h!==null&&h===m.getRootElement())&&g.select()}},lf);else if(p!==null)switch(typeof p){case"string":{let f=m.parseEditorState(p);m.setEditorState(f,lf);break}case"object":m.setEditorState(p,lf);break;case"function":m.update(()=>{Ye().isEmpty()&&p(m)},lf)}}})(u,i),[u,c]},[]);return rq(()=>{let n=e.editable,[r]=o;r.setEditable(n===void 0||n)},[]),l(c0.Provider,{value:o,children:t})}var sq=wv,YR=sq.LexicalComposer;var Iv={};Ut(Iv,{$canShowPlaceholder:()=>ZR,$canShowPlaceholderCurry:()=>lq,$findTextIntersectionFromCharacters:()=>dq,$isRootTextContentEmpty:()=>Tv,$isRootTextContentEmptyCurry:()=>iq,$rootTextContent:()=>JR,registerLexicalTextEntity:()=>uq});function JR(){return Ye().getTextContent()}function Tv(e,t=!0){if(e)return!1;let o=JR();return t&&(o=o.trim()),o===""}function iq(e,t){return()=>Tv(e,t)}function ZR(e){if(!Tv(e,!1))return!1;let t=Ye().getChildren(),o=t.length;if(o>1)return!1;for(let n=0;n<o;n++){let r=t[n];if(Hm(r))return!1;if(_e(r)){if(!JP(r)||r.__indent!==0)return!1;let a=r.getChildren(),s=a.length;for(let i=0;i<s;i++){let d=a[n];if(!Ke(d))return!1}}}return!0}function lq(e){return()=>ZR(e)}function dq(e,t){let o=e.getFirstChild(),n=0;e:for(;o!==null;){if(_e(o)){let s=o.getFirstChild();if(s!==null){o=s;continue}}else if(Ke(o)){let s=o.getTextContentSize();if(n+s>t)return{node:o,offset:t-n};n+=s}let r=o.getNextSibling();if(r!==null){o=r;continue}let a=o.getParent();for(;a!==null;){let s=a.getNextSibling();if(s!==null){o=s;continue e}a=a.getParent()}break}return null}function cq(e,...t){let o=new URL("https://lexical.dev/docs/error"),n=new URLSearchParams;n.append("code",e);for(let r of t)n.append("v",r);throw o.search=n.toString(),Error(`Minified Lexical error #${e}; visit ${o.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function uq(e,t,o,n){let r=s=>s instanceof o,a=s=>{let i=Nn(s.getTextContent());i.setFormat(s.getFormat()),s.replace(i)};return[e.registerNodeTransform(tf,s=>{if(!s.isSimpleText())return;let i,d=s.getPreviousSibling(),c=s.getTextContent(),u=s;if(Ke(d)){let p=d.getTextContent(),f=t(p+c);if(r(d)){if(f===null||(g=>g.getLatest().__mode)(d)!==0)return void a(d);{let g=f.end-p.length;if(g>0){let h=p+c.slice(0,g);if(d.select(),d.setTextContent(h),g===c.length)s.remove();else{let y=c.slice(g);s.setTextContent(y)}return}}}else if(f===null||f.start<p.length)return}let m=0;for(;;){i=t(c);let p,f=i===null?"":c.slice(i.end);if(c=f,f===""){let h=u.getNextSibling();if(Ke(h)){f=u.getTextContent()+h.getTextContent();let y=t(f);if(y===null)return void(r(h)?a(h):h.markDirty());if(y.start!==0)return}}if(i===null)return;if(i.start===0&&Ke(d)&&d.isTextEntity()){m+=i.end;continue}i.start===0?[p,u]=u.splitText(i.end):[,p,u]=u.splitText(i.start+m,i.end+m),p===void 0&&cq(165,"nodeToReplace");let g=n(p);if(g.setFormat(p.getFormat()),p.replace(g),u==null)return;m=0,d=g}}),e.registerNodeTransform(o,s=>{let i=s.getTextContent(),d=t(i);if(d===null||d.start!==0)return void a(s);if(i.length>d.end)return void s.splitText(d.end);let c=s.getPreviousSibling();Ke(c)&&c.isTextEntity()&&(a(c),a(s));let u=s.getNextSibling();Ke(u)&&u.isTextEntity()&&(a(u),r(s)&&a(s))})]}var ws=Iv,Gce=ws.$canShowPlaceholder,df=ws.$canShowPlaceholderCurry,jce=ws.$findTextIntersectionFromCharacters,Vce=ws.$isRootTextContentEmpty,Qce=ws.$isRootTextContentEmptyCurry,Xce=ws.$rootTextContent,Yce=ws.registerLexicalTextEntity;var Ev={};Ut(Ev,{$addNodeStyle:()=>yq,$cloneWithProperties:()=>Om,$copyBlockFormatIndent:()=>lE,$ensureForwardRangeSelection:()=>iE,$forEachSelectedTextNode:()=>sE,$getComputedStyleForElement:()=>Lv,$getComputedStyleForParent:()=>Pv,$getSelectionStyleValueForProperty:()=>Sq,$isAtNodeEnd:()=>hq,$isParentElementRTL:()=>Rv,$isParentRTL:()=>fq,$moveCaretSelection:()=>uE,$moveCharacter:()=>Tq,$patchStyleText:()=>vq,$selectAll:()=>$m,$setBlocksType:()=>Cq,$shouldOverrideDefaultCharacterSelection:()=>wq,$sliceSelectedTextNodeContent:()=>gq,$trimTextContentFromAnchor:()=>aE,$wrapNodes:()=>bq,createDOMRange:()=>pq,createRectsFromDOMRange:()=>mq,getCSSFromStyleObject:()=>rE,getStyleObjectFromCSS:()=>pf,trimTextContentFromAnchor:()=>kq});function kv(e,...t){let o=new URL("https://lexical.dev/docs/error"),n=new URLSearchParams;n.append("code",e);for(let r of t)n.append("v",r);throw o.search=n.toString(),Error(`Minified Lexical error #${e}; visit ${o.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var uf=new Map;function eE(e){let t=e;for(;t!=null;){if(t.nodeType===Node.TEXT_NODE)return t;t=t.firstChild}return null}function tE(e){let t=e.parentNode;if(t==null)throw new Error("Should never happen");return[t,Array.from(t.childNodes).indexOf(e)]}function pq(e,t,o,n,r){let a=t.getKey(),s=n.getKey(),i=document.createRange(),d=e.getElementByKey(a),c=e.getElementByKey(s),u=o,m=r;if(Ke(t)&&(d=eE(d)),Ke(n)&&(c=eE(c)),t===void 0||n===void 0||d===null||c===null)return null;d.nodeName==="BR"&&([d,u]=tE(d)),c.nodeName==="BR"&&([c,m]=tE(c));let p=d.firstChild;d===c&&p!=null&&p.nodeName==="BR"&&u===0&&m===0&&(m=1);try{i.setStart(d,u),i.setEnd(c,m)}catch{return null}return!i.collapsed||u===m&&a===s||(i.setStart(c,m),i.setEnd(d,u)),i}function mq(e,t){let o=e.getRootElement();if(o===null)return[];let n=o.getBoundingClientRect(),r=getComputedStyle(o),a=parseFloat(r.paddingLeft)+parseFloat(r.paddingRight),s=Array.from(t.getClientRects()),i,d=s.length;s.sort((c,u)=>{let m=c.top-u.top;return Math.abs(m)<=3?c.left-u.left:m});for(let c=0;c<d;c++){let u=s[c],m=i&&i.top<=u.top&&i.top+i.height>u.top&&i.left+i.width>u.left,p=u.width+a===n.width;m||p?(s.splice(c--,1),d--):i=u}return s}function nE(e){let t={};if(!e)return t;let o=e.split(";");for(let n of o)if(n!==""){let[r,a]=n.split(/:([^]+)/);r&&a&&(t[r.trim()]=a.trim())}return t}function pf(e){let t=uf.get(e);return t===void 0&&(t=nE(e),uf.set(e,t)),t}function rE(e){let t="";for(let o in e)o&&(t+=`${o}: ${e[o]};`);return t}function Lv(e){let t=Fm().getElementByKey(e.getKey());if(t===null)return null;let o=t.ownerDocument.defaultView;return o===null?null:o.getComputedStyle(t)}function Pv(e){return Lv(Pc(e)?e:e.getParentOrThrow())}function fq(e){let t=Pv(e);return t!==null&&t.direction==="rtl"}function gq(e,t,o="self"){let n=e.getStartEndPoints();if(t.isSelected(e)&&!mv(t)&&n!==null){let[r,a]=n,s=e.isBackward(),i=r.getNode(),d=a.getNode(),c=t.is(i),u=t.is(d);if(c||u){let[m,p]=WP(e),f=i.is(d),g=t.is(s?d:i),h=t.is(s?i:d),y,x=0;f?(x=m>p?p:m,y=m>p?m:p):g?(x=s?p:m,y=void 0):h&&(x=0,y=s?m:p);let C=t.__text.slice(x,y);C!==t.__text&&(o==="clone"&&(t=BP(t)),t.__text=C)}}return t}function hq(e){if(e.type==="text")return e.offset===e.getNode().getTextContentSize();let t=e.getNode();return _e(t)||kv(177),e.offset===t.getChildrenSize()}function aE(e,t,o){let n=t.getNode(),r=o;if(_e(n)){let a=n.getDescendantByIndex(t.offset);a!==null&&(n=a)}for(;r>0&&n!==null;){if(_e(n)){let c=n.getLastDescendant();c!==null&&(n=c)}let a=n.getPreviousSibling(),s=0;if(a===null){let c=n.getParentOrThrow(),u=c.getPreviousSibling();for(;u===null;){if(c=c.getParent(),c===null){a=null;break}u=c.getPreviousSibling()}c!==null&&(s=c.isInline()?0:2,a=u)}let i=n.getTextContent();i===""&&_e(n)&&!n.isInline()&&(i=`
3561
3561
 
3562
- `);let d=i.length;if(!Ke(n)||r>=d){let c=n.getParent();n.remove(),c==null||c.getChildrenSize()!==0||Pc(c)||c.remove(),r-=d+s,n=a}else{let c=n.getKey(),u=e.getEditorState().read(()=>{let f=Ca(c);return Ke(f)&&f.isSimpleText()?f.getTextContent():null}),m=d-r,p=i.slice(0,m);if(u!==null&&u!==i){let f=Sc(),g=n;if(n.isSimpleText())n.setTextContent(u);else{let h=Nn(u);n.replace(h),g=h}if(ye(f)&&f.isCollapsed()){let h=f.anchor.offset;g.select(h,h)}}else if(n.isSimpleText()){let f=t.key===c,g=t.offset;g<r&&(g=d);let h=f?g-r:0,y=f?g:m;if(f&&h===0){let[x]=n.splitText(h,y);x.remove()}else{let[,x]=n.splitText(h,y);x.remove()}}else{let f=Nn(p);n.replace(f)}r=0}}}function fq(e){let t=e.getStyle(),o=tE(t);uf.set(t,o)}function cf(e,t){(ye(e)?e.isCollapsed():Ke(e)||_e(e))||kv(280);let o=pf(ye(e)?e.style:Ke(e)?e.getStyle():e.getTextStyle()),n=Object.entries(t).reduce((a,[s,i])=>(typeof i=="function"?a[s]=i(o[s],e):i===null?delete a[s]:a[s]=i,a),{...o}),r=oE(n);ye(e)||Ke(e)?e.setStyle(r):e.setTextStyle(r),uf.set(r,n)}function gq(e,t){if(ye(e)&&e.isCollapsed()){cf(e,t);let n=e.anchor.getNode();_e(n)&&n.isEmpty()&&cf(n,t)}rE(n=>{cf(n,t)});let o=e.getNodes();if(o.length>0){let n=new Set;for(let r of o){if(!_e(r)||!r.canBeEmpty()||r.getChildrenSize()!==0)continue;let a=r.getKey();n.has(a)||(n.add(a),cf(r,t))}}}function rE(e){let t=Te();if(!t)return;let o=new Map,n=a=>o.get(a.getKey())||[0,a.getTextContentSize()];if(ye(t))for(let a of _P(t).getTextSlices())a&&o.set(a.caret.origin.getKey(),a.getSliceIndices());let r=t.getNodes();for(let a of r){if(!Ke(a)||!a.canHaveFormat())continue;let[s,i]=n(a);i!==s&&(mv(a)||s===0&&i===a.getTextContentSize()?e(a):e(a.splitText(s,i)[s===0?0:1]))}ye(t)&&t.anchor.type==="text"&&t.focus.type==="text"&&t.anchor.key===t.focus.key&&aE(t)}function aE(e){if(e.isBackward()){let{anchor:t,focus:o}=e,{key:n,offset:r,type:a}=t;t.set(o.key,o.offset,o.type),o.set(n,r,a)}}function sE(e,t){let o=e.getFormatType(),n=e.getIndent();o!==t.getFormatType()&&t.setFormat(o),n!==t.getIndent()&&t.setIndent(n)}function hq(e,t,o=sE){if(e===null)return;let n=e.getStartEndPoints(),r=new Map,a=null;if(n){let[s,i]=n;a=Cs(),a.anchor.set(s.key,s.offset,s.type),a.focus.set(i.key,i.offset,i.type);let d=Mr(s.getNode(),Mc),c=Mr(i.getNode(),Mc);_e(d)&&r.set(d.getKey(),d),_e(c)&&r.set(c.getKey(),c)}for(let s of e.getNodes())if(_e(s)&&Mc(s))r.set(s.getKey(),s);else if(n===null){let i=Mr(s,Mc);_e(i)&&r.set(i.getKey(),i)}for(let[s,i]of r){let d=t();o(i,d),i.replace(d,!0),a&&(s===a.anchor.key&&a.anchor.set(d.getKey(),a.anchor.offset,a.anchor.type),s===a.focus.key&&a.focus.set(d.getKey(),a.focus.offset,a.focus.type))}a&&e.is(Te())&&fn(a)}function eE(e){return e.getNode().isAttached()}function yq(e){let t=e;for(;t!==null&&!bs(t);){let o=t.getLatest(),n=t.getParent();o.getChildrenSize()===0&&t.remove(!0),t=n}}function vq(e,t,o=null){let n=e.getStartEndPoints(),r=n?n[0]:null,a=e.getNodes(),s=a.length;if(r!==null&&(s===0||s===1&&r.type==="element"&&r.getNode().getChildrenSize()===0)){let c=r.type==="text"?r.getNode().getParentOrThrow():r.getNode(),u=c.getChildren(),m=t();return m.setFormat(c.getFormatType()),m.setIndent(c.getIndent()),u.forEach(p=>m.append(p)),o&&(m=o.append(m)),void c.replace(m)}let i=null,d=[];for(let c=0;c<s;c++){let u=a[c];bs(u)?(Sv(e,d,d.length,t,o),d=[],i=u):i===null||i!==null&&GP(u,i)?d.push(u):(Sv(e,d,d.length,t,o),d=[u])}Sv(e,d,d.length,t,o)}function Sv(e,t,o,n,r=null){if(t.length===0)return;let a=t[0],s=new Map,i=[],d=_e(a)?a:a.getParentOrThrow();d.isInline()&&(d=d.getParentOrThrow());let c=!1;for(;d!==null;){let g=d.getPreviousSibling();if(g!==null){d=g,c=!0;break}if(d=d.getParentOrThrow(),bs(d))break}let u=new Set;for(let g=0;g<o;g++){let h=t[g];_e(h)&&h.getChildrenSize()===0&&u.add(h.getKey())}let m=new Set;for(let g=0;g<o;g++){let h=t[g],y=h.getParent();if(y!==null&&y.isInline()&&(y=y.getParent()),y!==null&&QP(h)&&!m.has(h.getKey())){let x=y.getKey();if(s.get(x)===void 0){let C=n();C.setFormat(y.getFormatType()),C.setIndent(y.getIndent()),i.push(C),s.set(x,C),y.getChildren().forEach(b=>{C.append(b),m.add(b.getKey()),_e(b)&&b.getChildrenKeys().forEach(L=>m.add(L))}),yq(y)}}else if(u.has(h.getKey())){_e(h)||kv(179);let x=n();x.setFormat(h.getFormatType()),x.setIndent(h.getIndent()),i.push(x),h.remove(!0)}}if(r!==null)for(let g=0;g<i.length;g++){let h=i[g];r.append(h)}let p=null;if(bs(d))if(c)if(r!==null)d.insertAfter(r);else for(let g=i.length-1;g>=0;g--){let h=i[g];d.insertAfter(h)}else{let g=d.getFirstChild();if(_e(g)&&(d=g),g===null)if(r)d.append(r);else for(let h=0;h<i.length;h++){let y=i[h];d.append(y),p=y}else if(r!==null)g.insertBefore(r);else for(let h=0;h<i.length;h++){let y=i[h];g.insertBefore(y),p=y}}else if(r)d.insertAfter(r);else for(let g=i.length-1;g>=0;g--){let h=i[g];d.insertAfter(h),p=h}let f=Sc();ye(f)&&eE(f.anchor)&&eE(f.focus)?fn(f.clone()):p!==null?p.selectEnd():e.dirty=!0}function iE(e){let t=lE(e);return t!==null&&t.writingMode==="vertical-rl"}function lE(e){let t=e.anchor.getNode();return _e(t)?Lv(t):Pv(t)}function Cq(e,t){let o=iE(e)?!t:t;Rv(e)&&(o=!o);let n=ji(e.focus,o?"previous":"next");if(VP(n))return!1;for(let r of $P(n)){if(kc(r))return!r.origin.isInline();if(!_e(r.origin)){if(Hm(r.origin))return!0;break}}return!1}function dE(e,t,o,n){e.modify(t?"extend":"move",o,n)}function Rv(e){let t=lE(e);return t!==null&&t.direction==="rtl"}function xq(e,t,o){let n=Rv(e),r;r=iE(e)||n?!o:o,dE(e,t,r,"character")}function bq(e,t,o){let n=pf(e.getStyle());return n!==null&&n[t]||o}function wq(e,t,o=""){let n=null,r=e.getNodes(),a=e.anchor,s=e.focus,i=e.isBackward(),d=i?s.offset:a.offset,c=i?s.getNode():a.getNode();if(ye(e)&&e.isCollapsed()&&e.style!==""){let u=pf(e.style);if(u!==null&&t in u)return u[t]}for(let u=0;u<r.length;u++){let m=r[u];if((u===0||d!==0||!m.is(c))&&Ke(m)){let p=bq(m,t,o);if(n===null)n=p;else if(n!==p){n="";break}}}return n===null?o:n}var Tq=nE;var Rt=Ev,cE=Rt.$addNodeStyle,Jce=Rt.$cloneWithProperties,Zce=Rt.$copyBlockFormatIndent,eue=Rt.$ensureForwardRangeSelection,tue=Rt.$forEachSelectedTextNode,oue=Rt.$getComputedStyleForElement,nue=Rt.$getComputedStyleForParent,rue=Rt.$getSelectionStyleValueForProperty,aue=Rt.$isAtNodeEnd,sue=Rt.$isParentElementRTL,iue=Rt.$isParentRTL,lue=Rt.$moveCaretSelection,Mv=Rt.$moveCharacter,due=Rt.$patchStyleText,cue=Rt.$selectAll,uue=Rt.$setBlocksType,Av=Rt.$shouldOverrideDefaultCharacterSelection,mf=Rt.$sliceSelectedTextNodeContent,pue=Rt.$trimTextContentFromAnchor,mue=Rt.$wrapNodes,fue=Rt.createDOMRange,uE=Rt.createRectsFromDOMRange,gue=Rt.getCSSFromStyleObject,hue=Rt.getStyleObjectFromCSS,yue=Rt.trimTextContentFromAnchor;var Ov={};Ut(Ov,{$descendantsMatching:()=>s4,$dfs:()=>zq,$dfsIterator:()=>bE,$filter:()=>e4,$findMatchingParent:()=>Mr,$firstToLastIterator:()=>i4,$getAdjacentCaret:()=>Kq,$getAdjacentSiblingOrParentSiblingCaret:()=>xs,$getDepth:()=>TE,$getNearestBlockElementAncestorOrThrow:()=>Vq,$getNearestNodeOfType:()=>jq,$getNextRightPreorderNode:()=>Gq,$getNextSiblingOrParentSibling:()=>Wq,$handleIndentAndOutdent:()=>t4,$insertFirst:()=>o4,$insertNodeToNearestRoot:()=>Yq,$insertNodeToNearestRootAtCaret:()=>SE,$isEditorIsNestedEditor:()=>r4,$lastToFirstIterator:()=>_v,$restoreEditorState:()=>Xq,$reverseDfs:()=>qq,$reverseDfsIterator:()=>IE,$splitNode:()=>rR,$unwrapAndFilterDescendants:()=>a4,$unwrapNode:()=>l4,$wrapNodeInElement:()=>Jq,CAN_USE_BEFORE_INPUT:()=>Nq,CAN_USE_DOM:()=>vE,IS_ANDROID:()=>Dq,IS_ANDROID_CHROME:()=>_q,IS_APPLE:()=>Oq,IS_APPLE_WEBKIT:()=>Fq,IS_CHROME:()=>Bq,IS_FIREFOX:()=>CE,IS_IOS:()=>Hq,IS_SAFARI:()=>Uq,addClassNamesToElement:()=>Ac,calculateZoomLevel:()=>n4,isBlockDomNode:()=>KR,isHTMLAnchorElement:()=>GR,isHTMLElement:()=>rf,isInlineDomNode:()=>Nc,isMimeType:()=>xE,makeStateWrapper:()=>d4,markSelection:()=>yE,mediaFileReader:()=>$q,mergeRegister:()=>rr,objectKlassEquals:()=>Zq,positionNodeOnRange:()=>hE,registerNestedElementResolver:()=>Qq,removeClassNamesFromElement:()=>af,selectionAlwaysOnDisplay:()=>Aq});function ff(e,...t){let o=new URL("https://lexical.dev/docs/error"),n=new URLSearchParams;n.append("code",e);for(let r of t)n.append("v",r);throw o.search=n.toString(),Error(`Minified Lexical error #${e}; visit ${o.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var _n=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,Iq=_n&&"documentMode"in document?document.documentMode:null,fE=_n&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Sq=_n&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),kq=!(!_n||!("InputEvent"in window)||Iq)&&"getTargetRanges"in new window.InputEvent("input"),Lq=_n&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),Pq=_n&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,gE=_n&&/Android/.test(navigator.userAgent),Dv=_n&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Rq=_n&&gE&&Dv,Eq=_n&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&fE&&!Dv;function ar(e){return`${e}px`}var Mq={attributes:!0,characterData:!0,childList:!0,subtree:!0};function hE(e,t,o){let n=null,r=null,a=null,s=[],i=document.createElement("div");function d(){n===null&&ff(182),r===null&&ff(183);let{left:m,top:p}=r.getBoundingClientRect(),f=uE(e,t);var g,h;i.isConnected||(h=i,(g=r).insertBefore(h,g.firstChild));let y=!1;for(let x=0;x<f.length;x++){let C=f[x],b=s[x]||document.createElement("div"),L=b.style;L.position!=="absolute"&&(L.position="absolute",y=!0);let w=ar(C.left-m);L.left!==w&&(L.left=w,y=!0);let k=ar(C.top-p);L.top!==k&&(b.style.top=k,y=!0);let I=ar(C.width);L.width!==I&&(b.style.width=I,y=!0);let T=ar(C.height);L.height!==T&&(b.style.height=T,y=!0),b.parentNode!==i&&(i.append(b),y=!0),s[x]=b}for(;s.length>f.length;)s.pop();y&&o(s)}function c(){r=null,n=null,a!==null&&a.disconnect(),a=null,i.remove();for(let m of s)m.remove();s=[]}i.style.position="relative";let u=e.registerRootListener(function m(){let p=e.getRootElement();if(p===null)return c();let f=p.parentElement;if(!rf(f))return c();c(),n=p,r=f,a=new MutationObserver(g=>{let h=e.getRootElement(),y=h&&h.parentElement;if(h!==n||y!==r)return m();for(let x of g)if(!i.contains(x.target))return d()}),a.observe(f,Mq),d()});return()=>{u(),c()}}function pE(e,t,o){if(e.type!=="text"&&_e(t)){let n=t.getDOMSlot(o);return[n.element,n.getFirstChildOffset()+e.offset]}return[$R(o)||o,e.offset]}function yE(e,t){let o=null,n=null,r=null,a=null,s=null,i=null,d=()=>{};function c(u){u.read(()=>{let m=Te();if(!ye(m))return o=null,r=null,a=null,i=null,d(),void(d=()=>{});let[p,f]=(function(T){let S=T.getStartEndPoints();return T.isBackward()?[S[1],S[0]]:S})(m),g=p.getNode(),h=g.getKey(),y=p.offset,x=f.getNode(),C=x.getKey(),b=f.offset,L=e.getElementByKey(h),w=e.getElementByKey(C),k=o===null||L!==n||y!==r||h!==o.getKey(),I=a===null||w!==s||b!==i||C!==a.getKey();if((k||I)&&L!==null&&w!==null){let T=(function(S,P,A,N,B,O,j){let U=(S._window?S._window.document:document).createRange();return U.setStart(...pE(P,A,N)),U.setEnd(...pE(B,O,j)),U})(e,p,g,L,f,x,w);d(),d=hE(e,T,S=>{if(t===void 0)for(let P of S){let A=P.style;A.background!=="Highlight"&&(A.background="Highlight"),A.color!=="HighlightText"&&(A.color="HighlightText"),A.marginTop!==ar(-1.5)&&(A.marginTop=ar(-1.5)),A.paddingTop!==ar(4)&&(A.paddingTop=ar(4)),A.paddingBottom!==ar(0)&&(A.paddingBottom=ar(0))}else t(S)})}o=g,n=L,r=y,a=x,s=w,i=b})}return c(e.getEditorState()),rr(e.registerUpdateListener(({editorState:u})=>c(u)),()=>{d()})}function Aq(e,t){let o=null,n=()=>{let r=getSelection(),a=r&&r.anchorNode,s=e.getRootElement();a!==null&&s!==null&&s.contains(a)?o!==null&&(o(),o=null):o===null&&(o=yE(e,t))};return document.addEventListener("selectionchange",n),()=>{o!==null&&o(),document.removeEventListener("selectionchange",n)}}var Nq=kq,vE=_n,Dq=gE,_q=Rq,Oq=fE,Fq=Eq,Bq=Dv,CE=Sq,Hq=Pq,Uq=Lq;function xE(e,t){for(let o of t)if(e.type.startsWith(o))return!0;return!1}function $q(e,t){let o=e[Symbol.iterator]();return new Promise((n,r)=>{let a=[],s=()=>{let{done:i,value:d}=o.next();if(i)return n(a);let c=new FileReader;c.addEventListener("error",r),c.addEventListener("load",()=>{let u=c.result;typeof u=="string"&&a.push({file:d,result:u}),s()}),xE(d,t)?c.readAsDataURL(d):s()};s()})}function zq(e,t){return Array.from(bE(e,t))}function Kq(e){return e?e.getAdjacentCaret():null}function qq(e,t){return Array.from(IE(e,t))}function bE(e,t){return wE("next",e,t)}function mE(e,t){let o=xs(Ar(e,t));return o&&o[0]}function wE(e,t,o){let n=Ye(),r=t||n,a=_e(r)?va(r,e):Ar(r,e),s=TE(r),i=o?dv(uv(Ar(o,e)))||mE(o,e):mE(r,e),d=s;return xv({hasNext:c=>c!==null,initial:a,map:c=>({depth:d,node:c.origin}),step:c=>{if(c.isSameNodeCaret(i))return null;kc(c)&&d++;let u=xs(c);return!u||u[0].isSameNodeCaret(i)?null:(d+=u[1],u[0])}})}function Wq(e){let t=xs(Ar(e,"next"));return t&&[t[0].origin,t[1]]}function TE(e){let t=-1;for(let o=e;o!==null;o=o.getParent())t++;return t}function Gq(e){let t=uv(Ar(e,"previous")),o=xs(t,"root");return o&&o[0].origin}function IE(e,t){return wE("previous",e,t)}function jq(e,t){let o=e;for(;o!=null;){if(o instanceof t)return o;o=o.getParent()}return null}function Vq(e){let t=Mr(e,o=>_e(o)&&!o.isInline());return _e(t)||ff(4,e.__key),t}function Qq(e,t,o,n){let r=a=>a instanceof t;return e.registerNodeTransform(t,a=>{let s=(i=>{let d=i.getChildren();for(let m=0;m<d.length;m++){let p=d[m];if(r(p))return null}let c=i,u=i;for(;c!==null;)if(u=c,c=c.getParent(),r(c))return{child:u,parent:c};return null})(a);if(s!==null){let{child:i,parent:d}=s;if(i.is(a)){n(d,a);let c=i.getNextSiblings(),u=c.length;if(d.insertAfter(i),u!==0){let m=o(d);i.insertAfter(m);for(let p=0;p<u;p++)m.append(c[p])}d.canBeEmpty()||d.getChildrenSize()!==0||d.remove()}}})}function Xq(e,t){let o=new Map,n=e._pendingEditorState;for(let[a,s]of t._nodeMap)o.set(a,Om(s));n&&(n._nodeMap=o),e._dirtyType=2;let r=t._selection;fn(r===null?null:r.clone())}function Yq(e){let t=Te()||Sc(),o;if(ye(t))o=ji(t.focus,"next");else{if(t!=null){let s=t.getNodes(),i=s[s.length-1];i&&(o=Ar(i,"next"))}o=o||va(Ye(),"previous").getFlipped().insert(mn())}let n=SE(e,o),r=dv(n),a=kc(r)?JP(r):n;return oR(qP(a)),e.getLatest()}function SE(e,t,o){let n=cv(t,"next");for(let r=n;r;r=nR(r,o))n=r;return Um(n)&&ff(283),n.insert(e.isInline()?mn().append(e):e),cv(Ar(e.getLatest(),"next"),t.direction)}function Jq(e,t){let o=t();return e.replace(o),o.append(e),o}function Zq(e,t){return e!==null&&Object.getPrototypeOf(e).constructor.name===t.name}function e4(e,t){let o=[];for(let n=0;n<e.length;n++){let r=t(e[n]);r!==null&&o.push(r)}return o}function t4(e){let t=Te();if(!ye(t))return!1;let o=new Set,n=t.getNodes();for(let r=0;r<n.length;r++){let a=n[r],s=a.getKey();if(o.has(s))continue;let i=Mr(a,c=>_e(c)&&!c.isInline());if(i===null)continue;let d=i.getKey();i.canIndent()&&!o.has(d)&&(o.add(d),e(i))}return o.size>0}function o4(e,t){va(e,"next").insert(t)}var Nv=!(CE||!vE)&&void 0;function n4(e,t=!1){let o=1;if((function(){if(Nv===void 0){let n=document.createElement("div");n.style.cssText="position: absolute; opacity: 0; width: 100px; left: -1000px;",document.body.appendChild(n);let r=n.getBoundingClientRect();n.style.setProperty("zoom","2"),Nv=n.getBoundingClientRect().width===r.width,document.body.removeChild(n)}return Nv})()||t)for(;e;)o*=Number(window.getComputedStyle(e).getPropertyValue("zoom")),e=e.parentElement;return o}function r4(e){return e._parentEditor!==null}function a4(e,t){return kE(e,t,null)}function kE(e,t,o){let n=!1;for(let r of _v(e))t(r)?o!==null&&o(r):(n=!0,_e(r)&&kE(r,t,o||(a=>r.insertAfter(a))),r.remove());return n}function s4(e,t){let o=[],n=Array.from(e).reverse();for(let r=n.pop();r!==void 0;r=n.pop())if(t(r))o.push(r);else if(_e(r))for(let a of _v(r))n.push(a);return o}function i4(e){return LE(va(e,"next"))}function _v(e){return LE(va(e,"previous"))}function LE(e){return xv({hasNext:YP,initial:e.getAdjacentCaret(),map:t=>t.origin.getLatest(),step:t=>t.getAdjacentCaret()})}function l4(e){tR(Ar(e,"next")).splice(1,e.getChildren())}function d4(e){let t=n=>Bm(n,e),o=(n,r)=>zm(n,e,r);return{$get:t,$set:o,accessors:[t,o],makeGetterMethod:()=>function(){return t(this)},makeSetterMethod:()=>function(n){return o(this,n)},stateConfig:e}}var Be=Ov,wue=Be.$descendantsMatching,Tue=Be.$dfs,Iue=Be.$dfsIterator,Sue=Be.$filter,kue=Be.$findMatchingParent,Lue=Be.$firstToLastIterator,Pue=Be.$getAdjacentCaret,Rue=Be.$getAdjacentSiblingOrParentSiblingCaret,Eue=Be.$getDepth,PE=Be.$getNearestBlockElementAncestorOrThrow,Mue=Be.$getNearestNodeOfType,Aue=Be.$getNextRightPreorderNode,Nue=Be.$getNextSiblingOrParentSibling,RE=Be.$handleIndentAndOutdent,Due=Be.$insertFirst,_ue=Be.$insertNodeToNearestRoot,Oue=Be.$insertNodeToNearestRootAtCaret,Fue=Be.$isEditorIsNestedEditor,Bue=Be.$lastToFirstIterator,Hue=Be.$restoreEditorState,Uue=Be.$reverseDfs,$ue=Be.$reverseDfsIterator,zue=Be.$splitNode,Kue=Be.$unwrapAndFilterDescendants,que=Be.$unwrapNode,Wue=Be.$wrapNodeInElement,Gue=Be.CAN_USE_BEFORE_INPUT,jue=Be.CAN_USE_DOM,Vue=Be.IS_ANDROID,Que=Be.IS_ANDROID_CHROME,Xue=Be.IS_APPLE,Yue=Be.IS_APPLE_WEBKIT,Jue=Be.IS_CHROME,Zue=Be.IS_FIREFOX,epe=Be.IS_IOS,tpe=Be.IS_SAFARI,ope=Be.addClassNamesToElement,npe=Be.calculateZoomLevel,Fv=Be.isBlockDomNode,rpe=Be.isHTMLAnchorElement,EE=Be.isHTMLElement,ape=Be.isInlineDomNode,spe=Be.isMimeType,ipe=Be.makeStateWrapper,lpe=Be.markSelection,dpe=Be.mediaFileReader,Nr=Be.mergeRegister,Dc=Be.objectKlassEquals,cpe=Be.positionNodeOnRange,upe=Be.registerNestedElementResolver,ppe=Be.removeClassNamesFromElement,mpe=Be.selectionAlwaysOnDisplay;var Bv={};Ut(Bv,{ContentEditable:()=>u4,ContentEditableElement:()=>NE});$();var AE=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?fe:H;function c4({editor:e,ariaActiveDescendant:t,ariaAutoComplete:o,ariaControls:n,ariaDescribedBy:r,ariaErrorMessage:a,ariaExpanded:s,ariaInvalid:i,ariaLabel:d,ariaLabelledBy:c,ariaMultiline:u,ariaOwns:m,ariaRequired:p,autoCapitalize:f,className:g,id:h,role:y="textbox",spellCheck:x=!0,style:C,tabIndex:b,"data-testid":L,...w},k){let[I,T]=q(e.isEditable()),S=R(A=>{A&&A.ownerDocument&&A.ownerDocument.defaultView?e.setRootElement(A):e.setRootElement(null)},[e]),P=W(()=>(function(...A){return N=>{for(let B of A)typeof B=="function"?B(N):B!=null&&(B.current=N)}})(k,S),[S,k]);return AE(()=>(T(e.isEditable()),e.registerEditableListener(A=>{T(A)})),[e]),l("div",{"aria-activedescendant":I?t:void 0,"aria-autocomplete":I?o:"none","aria-controls":I?n:void 0,"aria-describedby":r,...a!=null?{"aria-errormessage":a}:{},"aria-expanded":I&&y==="combobox"?!!s:void 0,...i!=null?{"aria-invalid":i}:{},"aria-label":d,"aria-labelledby":c,"aria-multiline":u,"aria-owns":I?m:void 0,"aria-readonly":!I||void 0,"aria-required":p,autoCapitalize:f,className:g,contentEditable:I,"data-testid":L,id:h,ref:P,role:y,spellCheck:x,style:C,tabIndex:b,...w})}var NE=zn(c4);function ME(e){return e.getEditorState().read(df(e.isComposing()))}var u4=zn(p4);function p4(e,t){let{placeholder:o,...n}=e,[r]=ct();return v(oe,{children:[l(NE,{editor:r,...n,ref:t}),o!=null&&l(m4,{editor:r,content:o})]})}function m4({content:e,editor:t}){let o=(function(s){let[i,d]=q(()=>ME(s));return AE(()=>{function c(){let u=ME(s);d(u)}return c(),Nr(s.registerUpdateListener(()=>{c()}),s.registerEditableListener(()=>{c()}))},[s]),i})(t),[n,r]=q(t.isEditable());if(fe(()=>(r(t.isEditable()),t.registerEditableListener(s=>{r(s)})),[t]),!o)return null;let a=null;return typeof e=="function"?a=e(n):e!==null&&(a=e),a===null?null:l("div",{"aria-hidden":!0,children:a})}var DE=Bv,_E=DE.ContentEditable,xpe=DE.ContentEditableElement;$();var f4=qe(null),Hv={didCatch:!1,error:null},gf=class extends ur{constructor(t){super(t),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=Hv}static getDerivedStateFromError(t){return{didCatch:!0,error:t}}resetErrorBoundary(...t){let{error:o}=this.state;o!==null&&(this.props.onReset?.({args:t,reason:"imperative-api"}),this.setState(Hv))}componentDidCatch(t,o){this.props.onError?.(t,o)}componentDidUpdate(t,o){let{didCatch:n}=this.state,{resetKeys:r}=this.props;n&&o.error!==null&&g4(t.resetKeys,r)&&(this.props.onReset?.({next:r,prev:t.resetKeys,reason:"keys"}),this.setState(Hv))}render(){let{children:t,fallbackRender:o,FallbackComponent:n,fallback:r}=this.props,{didCatch:a,error:s}=this.state,i=t;if(a){let d={error:s,resetErrorBoundary:this.resetErrorBoundary};if(typeof o=="function")i=o(d);else if(n)i=vn(n,d);else if(r!==void 0)i=r;else throw s}return vn(f4.Provider,{value:{didCatch:a,error:s,resetErrorBoundary:this.resetErrorBoundary}},i)}};function g4(e=[],t=[]){return e.length!==t.length||e.some((o,n)=>!Object.is(o,t[n]))}var Uv={};Ut(Uv,{LexicalErrorBoundary:()=>h4});function h4({children:e,onError:t}){return l(gf,{fallback:l("div",{style:{border:"1px solid #f00",color:"#f00",padding:"8px"},children:"An error was thrown."}),onError:t,children:e})}var y4=Uv,OE=y4.LexicalErrorBoundary;var tC={};Ut(tC,{$createHorizontalRuleNode:()=>eC,$isDecoratorTextNode:()=>XE,$isHorizontalRuleNode:()=>oM,AutoFocusExtension:()=>x4,ClearEditorExtension:()=>b4,DecoratorTextExtension:()=>L4,DecoratorTextNode:()=>Fc,EditorStateExtension:()=>Cf,HorizontalRuleExtension:()=>B4,HorizontalRuleNode:()=>Is,INSERT_HORIZONTAL_RULE_COMMAND:()=>O4,InitialStateExtension:()=>eM,LexicalBuilder:()=>Zi,NodeSelectionExtension:()=>Xv,TabIndentationExtension:()=>H4,applyFormatFromStyle:()=>T4,applyFormatToDom:()=>I4,batch:()=>zE,buildEditorFromExtensions:()=>M4,computed:()=>WE,configExtension:()=>of,declarePeerDependency:()=>UR,defineExtension:()=>zt,effect:()=>wa,getExtensionDependencyFromEditor:()=>N4,getKnownTypesAndNodes:()=>w4,getPeerDependencyFromEditor:()=>tM,getPeerDependencyFromEditorOrThrow:()=>D4,namedSignals:()=>bf,registerClearEditor:()=>VE,registerTabIndentation:()=>rM,safeCast:()=>Dn,shallowMergeConfig:()=>sf,signal:()=>Ji,untracked:()=>Gv,watchedSignal:()=>Jv});var v4=Symbol.for("preact-signals");function xf(){if(ba>1)return void ba--;let e,t=!1;for(;Oc!==void 0;){let o=Oc;for(Oc=void 0,jv++;o!==void 0;){let n=o.o;if(o.o=void 0,o.f&=-3,!(8&o.f)&&KE(o))try{o.c()}catch(r){t||(e=r,t=!0)}o=n}}if(jv=0,ba--,t)throw e}function zE(e){if(ba>0)return e();ba++;try{return e()}finally{xf()}}var st,Oc;function Gv(e){let t=st;st=void 0;try{return e()}finally{st=t}}var ba=0,jv=0,vf=0;function FE(e){if(st===void 0)return;let t=e.n;return t===void 0||t.t!==st?(t={i:0,S:e,p:st.s,n:void 0,t:st,e:void 0,x:void 0,r:t},st.s!==void 0&&(st.s.n=t),st.s=t,e.n=t,32&st.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=st.s,t.n=void 0,st.s.n=t,st.s=t),t):void 0}function Lo(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 Ji(e,t){return new Lo(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 o=t.S.n;if(o!==void 0&&(t.r=o),t.S.n=t,t.i=-1,t.n===void 0){e.s=t;break}}}function qE(e){let t,o=e.s;for(;o!==void 0;){let n=o.p;o.i===-1?(o.S.U(o),n!==void 0&&(n.n=o.n),o.n!==void 0&&(o.n.p=n)):t=o,o.S.n=o.r,o.r!==void 0&&(o.r=void 0),o=n}e.s=t}function Ts(e,t){Lo.call(this,void 0),this.x=e,this.s=void 0,this.g=vf-1,this.f=4,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}function WE(e,t){return new Ts(e,t)}function GE(e){let t=e.u;if(e.u=void 0,typeof t=="function"){ba++;let o=st;st=void 0;try{t()}catch(n){throw e.f&=-2,e.f|=8,Yv(e),n}finally{st=o,xf()}}}function Yv(e){for(let t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,GE(e)}function C4(e){if(st!==this)throw new Error("Out-of-order effect");qE(this),st=e,this.f&=-2,8&this.f&&Yv(this),xf()}function Yi(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 wa(e,t){let o=new Yi(e,t);try{o.c()}catch(r){throw o.d(),r}let n=o.d.bind(o);return n[Symbol.dispose]=n,n}function bf(e,t={}){let o={};for(let n in e){let r=t[n],a=Ji(r===void 0?e[n]:r);o[n]=a}return o}Lo.prototype.brand=v4,Lo.prototype.h=function(){return!0},Lo.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:Gv(()=>{var o;(o=this.W)==null||o.call(this)}))},Lo.prototype.U=function(e){if(this.t!==void 0){let t=e.e,o=e.x;t!==void 0&&(t.x=o,e.e=void 0),o!==void 0&&(o.e=t,e.x=void 0),e===this.t&&(this.t=o,o===void 0&&Gv(()=>{var n;(n=this.Z)==null||n.call(this)}))}},Lo.prototype.subscribe=function(e){return wa(()=>{let t=this.value,o=st;st=void 0;try{e(t)}finally{st=o}},{name:"sub"})},Lo.prototype.valueOf=function(){return this.value},Lo.prototype.toString=function(){return this.value+""},Lo.prototype.toJSON=function(){return this.value},Lo.prototype.peek=function(){let e=st;st=void 0;try{return this.value}finally{st=e}},Object.defineProperty(Lo.prototype,"value",{get(){let e=FE(this);return e!==void 0&&(e.i=this.i),this.v},set(e){if(e!==this.v){if(jv>100)throw new Error("Cycle detected");this.v=e,this.i++,vf++,ba++;try{for(let t=this.t;t!==void 0;t=t.x)t.t.N()}finally{xf()}}}}),Ts.prototype=new Lo,Ts.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===vf))return!0;if(this.g=vf,this.f|=1,this.i>0&&!KE(this))return this.f&=-2,!0;let e=st;try{BE(this),st=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 st=e,qE(this),this.f&=-2,!0},Ts.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)}Lo.prototype.S.call(this,e)},Ts.prototype.U=function(e){if(this.t!==void 0&&(Lo.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)}},Ts.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(Ts.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}}),Yi.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()}},Yi.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,GE(this),BE(this),ba++;let e=st;return st=this,C4.bind(this,e)},Yi.prototype.N=function(){2&this.f||(this.f|=2,this.o=Oc,Oc=this)},Yi.prototype.d=function(){this.f|=8,1&this.f||Yv(this)},Yi.prototype.dispose=function(){this.d()};var x4=zt({build:(e,t,o)=>bf(t),config:Dn({defaultSelection:"rootEnd",disabled:!1}),name:"@lexical/extension/AutoFocus",register(e,t,o){let n=o.getOutput();return wa(()=>n.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:n.defaultSelection.peek()})}))}});function jE(){let e=Ye(),t=Te(),o=mn();e.clear(),e.append(o),t!==null&&o.select(),ye(t)&&(t.format=0)}function VE(e,t=jE){return e.registerCommand(Km,o=>(e.update(t),!0),vt)}var b4=zt({build:(e,t,o)=>bf(t),config:Dn({$onClear:jE}),name:"@lexical/extension/ClearEditor",register(e,t,o){let{$onClear:n}=o.getOutput();return wa(()=>VE(e,n.value))}});function w4(e){let t=new Set,o=new Set;for(let n of QE(e)){let r=typeof n=="function"?n:n.replace;t.add(r.getType()),o.add(r)}return{nodes:o,types:t}}function QE(e){return(typeof e.nodes=="function"?e.nodes():e.nodes)||[]}var $v=HR("format",{parse:e=>typeof e=="number"?e:0}),Fc=class extends xa{$config(){return this.config("decorator-text",{extends:xa,stateConfigs:[{flat:!0,stateConfig:$v}]})}getFormat(){return Bm(this,$v)}getFormatFlags(t,o){return bv(this.getFormat(),t,o)}hasFormat(t){let o=_R[t];return(this.getFormat()&o)!==0}setFormat(t){return zm(this,$v,t)}toggleFormat(t){let o=this.getFormat(),n=bv(o,t,null);return this.setFormat(n)}isInline(){return!0}createDOM(){return document.createElement("span")}updateDOM(){return!1}};function XE(e){return e instanceof Fc}function T4(e,t,o){let n=t.fontWeight,r=t.textDecoration.split(" "),a=n==="700"||n==="bold",s=r.includes("line-through"),i=t.fontStyle==="italic",d=r.includes("underline"),c=t.verticalAlign;return a&&!e.hasFormat("bold")&&e.toggleFormat("bold"),s&&!e.hasFormat("strikethrough")&&e.toggleFormat("strikethrough"),i&&!e.hasFormat("italic")&&e.toggleFormat("italic"),d&&!e.hasFormat("underline")&&e.toggleFormat("underline"),c!=="sub"||e.hasFormat("subscript")||e.toggleFormat("subscript"),c!=="super"||e.hasFormat("superscript")||e.toggleFormat("superscript"),o&&!e.hasFormat(o)&&e.toggleFormat(o),e}function I4(e,t,o=k4){for(let[n,r]of Object.entries(o))e.hasFormat(r)&&(t=S4(t,n));return t}function S4(e,t){let o=document.createElement(t);return o.appendChild(e),o}var k4={b:"bold",code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"},L4=zt({name:"@lexical/extension/DecoratorText",nodes:()=>[Fc],register:(e,t,o)=>e.registerCommand(yR,n=>{let r=Te();if(pv(r)||ye(r))for(let a of r.getNodes())XE(a)&&a.toggleFormat(n);return!1},Qi)});function Jv(e,t){let o;return Ji(e(),{unwatched(){o&&(o(),o=void 0)},watched(){this.value=e(),o=t(this)}})}var Cf=zt({build:e=>Jv(()=>e.getEditorState(),t=>e.registerUpdateListener(o=>{t.value=o.editorState})),name:"@lexical/extension/EditorState"});function ut(e,...t){let o=new URL("https://lexical.dev/docs/error"),n=new URLSearchParams;n.append("code",e);for(let r of t)n.append("v",r);throw o.search=n.toString(),Error(`Minified Lexical error #${e}; visit ${o.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 o=e,n=t;for(let r in n)o[r]=YE(o[r],n[r]);return e}return t}var Zv=0,Vv=1,JE=2,zv=3,hf=4,Xi=5,Kv=6,_c=7;function qv(e){return e.id===Zv}function ZE(e){return e.id===JE}function P4(e){return(function(t){return t.id===Vv})(e)||ut(305,String(e.id),String(Vv)),Object.assign(e,{id:JE})}var R4=new Set,Qv=class{builder;configs;_dependency;_peerNameSet;extension;state;_signal;constructor(t,o){this.builder=t,this.extension=o,this.configs=new Set,this.state={id:Zv}}mergeConfigs(){let t=this.extension.config||{},o=this.extension.mergeConfig?this.extension.mergeConfig.bind(this.extension):sf;for(let n of this.configs)t=o(t,n);return t}init(t){let o=this.state;ZE(o)||ut(306,String(o.id));let n={getDependency:this.getInitDependency.bind(this),getDirectDependentNames:this.getDirectDependentNames.bind(this),getPeer:this.getInitPeer.bind(this),getPeerNameSet:this.getPeerNameSet.bind(this)},r={...n,getDependency:this.getDependency.bind(this),getInitResult:this.getInitResult.bind(this),getPeer:this.getPeer.bind(this)},a=(function(i,d,c){return Object.assign(i,{config:d,id:zv,registerState:c})})(o,this.mergeConfigs(),n),s;this.state=a,this.extension.init&&(s=this.extension.init(t,a.config,n)),this.state=(function(i,d,c){return Object.assign(i,{id:hf,initResult:d,registerState:c})})(a,s,r)}build(t){let o=this.state,n;o.id!==hf&&ut(307,String(o.id),String(Xi)),this.extension.build&&(n=this.extension.build(t,o.config,o.registerState));let r={...o.registerState,getOutput:()=>n,getSignal:this.getSignal.bind(this)};this.state=(function(a,s,i){return Object.assign(a,{id:Xi,output:s,registerState:i})})(o,n,r)}register(t,o){this._signal=o;let n=this.state;n.id!==Xi&&ut(308,String(n.id),String(Xi));let r=this.extension.register&&this.extension.register(t,n.config,n.registerState);return this.state=(function(a){return Object.assign(a,{id:Kv})})(n),()=>{let a=this.state;a.id!==_c&&ut(309,String(n.id),String(_c)),this.state=(function(s){return Object.assign(s,{id:Xi})})(a),r&&r()}}afterRegistration(t){let o=this.state,n;return o.id!==Kv&&ut(310,String(o.id),String(Kv)),this.extension.afterRegistration&&(n=this.extension.afterRegistration(t,o.config,o.registerState)),this.state=(function(r){return Object.assign(r,{id:_c})})(o),n}getSignal(){return this._signal===void 0&&ut(311),this._signal}getInitResult(){this.extension.init===void 0&&ut(312,this.extension.name);let t=this.state;return(function(o){return o.id>=hf})(t)||ut(313,String(t.id),String(hf)),t.initResult}getInitPeer(t){let o=this.builder.extensionNameMap.get(t);return o?o.getExtensionInitDependency():void 0}getExtensionInitDependency(){let t=this.state;return(function(o){return o.id>=zv})(t)||ut(314,String(t.id),String(zv)),{config:t.config}}getPeer(t){let o=this.builder.extensionNameMap.get(t);return o?o.getExtensionDependency():void 0}getInitDependency(t){let o=this.builder.getExtensionRep(t);return o===void 0&&ut(315,this.extension.name,t.name),o.getExtensionInitDependency()}getDependency(t){let o=this.builder.getExtensionRep(t);return o===void 0&&ut(315,this.extension.name,t.name),o.getExtensionDependency()}getState(){let t=this.state;return(function(o){return o.id>=_c})(t)||ut(316,String(t.id),String(_c)),t}getDirectDependentNames(){return this.builder.incomingEdges.get(this.extension.name)||R4}getPeerNameSet(){let t=this._peerNameSet;return t||(t=new Set((this.extension.peerDependencies||[]).map(([o])=>o)),this._peerNameSet=t),t}getExtensionDependency(){if(!this._dependency){let t=this.state;(function(o){return o.id>=Xi})(t)||ut(317,this.extension.name),this._dependency={config:t.config,init:t.initResult,output:t.output}}return this._dependency}},HE={tag:zo};function E4(){let e=Ye();e.isEmpty()&&e.append(mn())}var eM=zt({config:Dn({setOptions:HE,updateOptions:HE}),init:({$initialEditorState:e=E4})=>({$initialEditorState:e,initialized:!1}),afterRegistration(e,{updateOptions:t,setOptions:o},n){let r=n.getInitResult();if(!r.initialized){r.initialized=!0;let{$initialEditorState:a}=r;if(jP(a))e.setEditorState(a,o);else if(typeof a=="function")e.update(()=>{a(e)},t);else if(a&&(typeof a=="string"||typeof a=="object")){let s=e.parseEditorState(a);e.setEditorState(s,o)}}return()=>{}},name:"@lexical/extension/InitialState",nodes:[MR,tf,SR,OR,PR]}),UE=Symbol.for("@lexical/extension/LexicalBuilder");function M4(...e){return Zi.fromExtensions(e).buildEditor()}function $E(){}function A4(e){throw e}function yf(e){return Array.isArray(e)?e:[e]}var Wv="0.41.0+prod.esm",Zi=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=Wv,this.roots=t;for(let o of t)this.addExtension(o)}static fromExtensions(t){let o=[yf(eM)];for(let n of t)o.push(yf(n));return new e(o)}static maybeFromEditor(t){let o=t[UE];return o&&(o.PACKAGE_VERSION!==Wv&&ut(292,o.PACKAGE_VERSION,Wv),o instanceof e||ut(293)),o}static fromEditor(t){let o=e.maybeFromEditor(t);return o===void 0&&ut(294),o}constructEditor(){let{$initialEditorState:t,onError:o,...n}=this.buildCreateEditorArgs(),r=Object.assign(nf({...n,...o?{onError:a=>{o(a,r)}}:{}}),{[UE]:this});for(let a of this.sortedExtensionReps())a.build(r);return r}buildEditor(){let t=$E;function o(){try{t()}finally{t=$E}}let n=Object.assign(this.constructEditor(),{dispose:o,[Symbol.dispose]:o});return t=rr(this.registerEditor(n),()=>n.setRootElement(null)),n}hasExtensionByName(t){return this.extensionNameMap.has(t)}getExtensionRep(t){let o=this.extensionNameMap.get(t.name);if(o)return o.extension!==t&&ut(295,t.name),o}addEdge(t,o,n){let r=this.outgoingConfigEdges.get(t);r?r.set(o,n):this.outgoingConfigEdges.set(t,new Map([[o,n]]));let a=this.incomingEdges.get(o);a?a.add(t):this.incomingEdges.set(o,new Set([t]))}addExtension(t){this._sortedExtensionReps!==void 0&&ut(296);let o=yf(t),[n]=o;typeof n.name!="string"&&ut(297,typeof n.name);let r=this.extensionNameMap.get(n.name);if(r!==void 0&&r.extension!==n&&ut(298,n.name),!r){r=new Qv(this,n),this.extensionNameMap.set(n.name,r);let a=this.conflicts.get(n.name);typeof a=="string"&&ut(299,n.name,a);for(let s of n.conflictsWith||[])this.extensionNameMap.has(s)&&ut(299,n.name,s),this.conflicts.set(s,n.name);for(let s of n.dependencies||[]){let i=yf(s);this.addEdge(n.name,i[0].name,i.slice(1)),this.addExtension(i)}for(let[s,i]of n.peerDependencies||[])this.addEdge(n.name,s,i?[i]:[])}}sortedExtensionReps(){if(this._sortedExtensionReps)return this._sortedExtensionReps;let t=[],o=(n,r)=>{let a=n.state;if(ZE(a))return;let s=n.extension.name;var i;qv(a)||ut(300,s,r||"[unknown]"),qv(i=a)||ut(304,String(i.id),String(Zv)),a=Object.assign(i,{id:Vv}),n.state=a;let d=this.outgoingConfigEdges.get(s);if(d)for(let c of d.keys()){let u=this.extensionNameMap.get(c);u&&o(u,s)}a=P4(a),n.state=a,t.push(n)};for(let n of this.extensionNameMap.values())qv(n.state)&&o(n);for(let n of t)for(let[r,a]of this.outgoingConfigEdges.get(n.extension.name)||[])if(a.length>0){let s=this.extensionNameMap.get(r);if(s)for(let i of a)s.configs.add(i)}for(let[n,...r]of this.roots)if(r.length>0){let a=this.extensionNameMap.get(n.name);a===void 0&&ut(301,n.name);for(let s of r)a.configs.add(s)}return this._sortedExtensionReps=t,this._sortedExtensionReps}registerEditor(t){let o=this.sortedExtensionReps(),n=new AbortController,r=[()=>n.abort()],a=n.signal;for(let s of o){let i=s.register(t,a);i&&r.push(i)}for(let s of o){let i=s.afterRegistration(t);i&&r.push(i)}return rr(...r)}buildCreateEditorArgs(){let t={},o=new Set,n=new Map,r=new Map,a={},s={},i=this.sortedExtensionReps();for(let u of i){let{extension:m}=u;if(m.onError!==void 0&&(t.onError=m.onError),m.disableEvents!==void 0&&(t.disableEvents=m.disableEvents),m.parentEditor!==void 0&&(t.parentEditor=m.parentEditor),m.editable!==void 0&&(t.editable=m.editable),m.namespace!==void 0&&(t.namespace=m.namespace),m.$initialEditorState!==void 0&&(t.$initialEditorState=m.$initialEditorState),m.nodes)for(let p of QE(m)){if(typeof p!="function"){let f=n.get(p.replace);f&&ut(302,m.name,p.replace.name,f.extension.name),n.set(p.replace,u)}o.add(p)}if(m.html){if(m.html.export)for(let[p,f]of m.html.export.entries())r.set(p,f);m.html.import&&Object.assign(a,m.html.import)}m.theme&&YE(s,m.theme)}Object.keys(s).length>0&&(t.theme=s),o.size&&(t.nodes=[...o]);let d=Object.keys(a).length>0,c=r.size>0;(d||c)&&(t.html={},d&&(t.html.import=a),c&&(t.html.export=r));for(let u of i)u.init(t);return t.onError||(t.onError=A4),t}};function N4(e,t){let o=Zi.fromEditor(e).getExtensionRep(t);return o===void 0&&ut(303,t.name),o.getExtensionDependency()}function tM(e,t){let o=Zi.fromEditor(e).extensionNameMap.get(t);return o?o.getExtensionDependency():void 0}function D4(e,t){let o=tM(e,t);return o===void 0&&ut(291,t),o}var _4=new Set,Xv=zt({build(e,t,o){let n=o.getDependency(Cf).output,r=Ji({watchedNodeKeys:new Map}),a=Jv(()=>{},()=>wa(()=>{let s=a.peek(),{watchedNodeKeys:i}=r.value,d,c=!1;n.value.read(()=>{if(Te())for(let[u,m]of i.entries()){if(m.size===0){i.delete(u);continue}let p=Ca(u),f=p&&p.isSelected()||!1;c=c||f!==(!!s&&s.has(u)),f&&(d=d||new Set,d.add(u))}}),!c&&d&&s&&d.size===s.size||(a.value=d)}));return{watchNodeKey:function(s){let i=WE(()=>(a.value||_4).has(s)),{watchedNodeKeys:d}=r.peek(),c=d.get(s),u=c!==void 0;return c=c||new Set,c.add(i),u||(d.set(s,c),r.value={watchedNodeKeys:d}),i}}},dependencies:[Cf],name:"@lexical/extension/NodeSelection"}),O4=BR("INSERT_HORIZONTAL_RULE_COMMAND"),Is=class e extends xa{static getType(){return"horizontalrule"}static clone(t){return new e(t.__key)}static importJSON(t){return eC().updateFromJSON(t)}static importDOM(){return{hr:()=>({conversion:F4,priority:0})}}exportDOM(){return{element:document.createElement("hr")}}createDOM(t){let o=document.createElement("hr");return Ac(o,t.theme.hr),o}getTextContent(){return`
3563
- `}isInline(){return!1}updateDOM(){return!1}};function F4(){return{node:eC()}}function eC(){return FP(Is)}function oM(e){return e instanceof Is}var B4=zt({dependencies:[Cf,Xv],name:"@lexical/extension/HorizontalRule",nodes:()=>[Is],register(e,t,o){let{watchNodeKey:n}=o.getDependency(Xv).output,r=Ji({nodeSelections:new Map}),a=e._config.theme.hrSelected??"selected";return rr(e.registerCommand(iR,s=>{if(WR(s.target)){let i=WP(s.target);if(oM(i))return(function(d,c=!1){let u=Te(),m=d.isSelected(),p=d.getKey(),f;c&&pv(u)?f=u:(f=BP(),fn(f)),m?f.delete(p):f.add(p)})(i,s.shiftKey),!0}return!1},Qi),e.registerMutationListener(Is,(s,i)=>{zE(()=>{let d=!1,{nodeSelections:c}=r.peek();for(let[u,m]of s.entries())if(m==="destroyed")c.delete(u),d=!0;else{let p=c.get(u),f=e.getElementByKey(u);p?p.domNode.value=f:(d=!0,c.set(u,{domNode:Ji(f),selectedSignal:n(u)}))}d&&(r.value={nodeSelections:c})})}),wa(()=>{let s=[];for(let{domNode:i,selectedSignal:d}of r.value.nodeSelections.values())s.push(wa(()=>{let c=i.value;c&&(d.value?Ac(c,a):af(c,a))}));return rr(...s)}))}});function nM(e){return e.canBeEmpty()}function rM(e,t,o=nM){return rr(e.registerCommand(Zm,n=>{let r=Te();if(!ye(r))return!1;n.preventDefault();let a=(function(s){if(s.getNodes().filter(p=>Vi(p)&&p.canIndent()).length>0)return!0;let i=s.anchor,d=s.focus,c=d.isBefore(i)?d:i,u=c.getNode(),m=PE(u);if(m.canIndent()){let p=m.getKey(),f=Cs();if(f.anchor.set(p,0,"element"),f.focus.set(p,0,"element"),f=ZP(f),f.anchor.is(c))return!0}return!1})(r)?n.shiftKey?kR:gv:xR;return e.dispatchCommand(a,void 0)},vt),e.registerCommand(gv,()=>{let n=typeof t=="number"?t:t?t.peek():null,r=Te();if(!ye(r))return!1;let a=typeof o=="function"?o:o.peek();return RE(s=>{if(a(s)){let i=s.getIndent()+1;(!n||i<n)&&s.setIndent(i)}})},qm))}var H4=zt({build:(e,t,o)=>bf(t),config:Dn({$canIndent:nM,disabled:!1,maxIndent:null}),name:"@lexical/extension/TabIndentation",register(e,t,o){let{disabled:n,maxIndent:r,$canIndent:a}=o.getOutput();return wa(()=>{if(!n.value)return rM(e,r,a)})}});var Qe=tC,Epe=Qe.$createHorizontalRuleNode,Mpe=Qe.$isDecoratorTextNode,Ape=Qe.$isHorizontalRuleNode,Npe=Qe.AutoFocusExtension,Dpe=Qe.ClearEditorExtension,_pe=Qe.DecoratorTextExtension,Ope=Qe.DecoratorTextNode,Fpe=Qe.EditorStateExtension,Bpe=Qe.HorizontalRuleExtension,Hpe=Qe.HorizontalRuleNode,Upe=Qe.INSERT_HORIZONTAL_RULE_COMMAND,$pe=Qe.InitialStateExtension,aM=Qe.LexicalBuilder,zpe=Qe.NodeSelectionExtension,Kpe=Qe.TabIndentationExtension,qpe=Qe.applyFormatFromStyle,Wpe=Qe.applyFormatToDom,sM=Qe.batch,Gpe=Qe.buildEditorFromExtensions,jpe=Qe.computed,Vpe=Qe.configExtension,Qpe=Qe.declarePeerDependency,Xpe=Qe.defineExtension,Bc=Qe.effect,Ype=Qe.getExtensionDependencyFromEditor,Jpe=Qe.getKnownTypesAndNodes,iM=Qe.getPeerDependencyFromEditor,Zpe=Qe.getPeerDependencyFromEditorOrThrow,wf=Qe.namedSignals,eme=Qe.registerClearEditor,tme=Qe.registerTabIndentation,ome=Qe.safeCast,nme=Qe.shallowMergeConfig,rme=Qe.signal,ame=Qe.untracked,sme=Qe.watchedSignal;var oC={};Ut(oC,{HistoryExtension:()=>Tf,SharedHistoryExtension:()=>z4,createEmptyHistoryState:()=>cM,registerHistory:()=>dM});function U4(e,t,o,n,r){if(e===null||o.size===0&&n.size===0&&!r)return 0;let a=t._selection,s=e._selection;if(r)return 1;if(!(ye(a)&&ye(s)&&s.isCollapsed()&&a.isCollapsed()))return 0;let i=(function(x,C,b){let L=x._nodeMap,w=[];for(let k of C){let I=L.get(k);I!==void 0&&w.push(I)}for(let[k,I]of b){if(!I)continue;let T=L.get(k);T===void 0||Pc(T)||w.push(T)}return w})(t,o,n);if(i.length===0)return 0;if(i.length>1){let x=t._nodeMap,C=x.get(a.anchor.key),b=x.get(s.anchor.key);return C&&b&&!e._nodeMap.has(C.__key)&&Ke(C)&&C.__text.length===1&&a.anchor.offset===1?2:0}let d=i[0],c=e._nodeMap.get(d.__key);if(!Ke(c)||!Ke(d)||c.__mode!==d.__mode)return 0;let u=c.__text,m=d.__text;if(u===m)return 0;let p=a.anchor,f=s.anchor;if(p.key!==f.key||p.type!=="text")return 0;let g=p.offset,h=f.offset,y=m.length-u.length;return y===1&&h===g-1?2:y===-1&&h===g+1?3:y===-1&&h===g?4:0}function $4(e,t){let o=Date.now(),n=0,r=Date.now(),a=0,s=null;return(i,d,c,u,m,p)=>{let f=Date.now();if(p.has(dR)&&(r=o,a=n,s=i),p.has(jm))return n=0,o=f,2;p.has(lR)&&s&&(o=r,n=a,i=s);let g=U4(i,d,u,m,e.isComposing()),h=(()=>{let y=c===null||c.editor===e,x=p.has(vR);if(!x&&y&&p.has(zo))return 0;if(g===1)return 2;if(i===null)return 1;let C=d._selection;if(!(u.size>0||m.size>0))return C!==null?0:2;let b=typeof t=="number"?t:t.peek();return x===!1&&g!==0&&g===n&&f<o+b&&y||u.size===1&&(function(L,w,k){let I=w._nodeMap.get(L),T=k._nodeMap.get(L),S=w._selection,P=k._selection;return!(ye(S)&&ye(P)&&S.anchor.type==="element"&&S.focus.type==="element"&&P.anchor.type==="text"&&P.focus.type==="text"||!Ke(I)||!Ke(T)||I.__parent!==T.__parent)&&JSON.stringify(w.read(()=>I.exportJSON()))===JSON.stringify(k.read(()=>T.exportJSON()))})(Array.from(u)[0],i,d)?0:1})();return o=f,n=g,h}}function lM(e){e.undoStack=[],e.redoStack=[],e.current=null}function dM(e,t,o){let n=$4(e,o);return Nr(e.registerCommand(FR,()=>((function(a,s){let i=s.redoStack,d=s.undoStack;if(d.length!==0){let c=s.current,u=d.pop();c!==null&&(i.push(c),a.dispatchCommand(Rc,!0)),d.length===0&&a.dispatchCommand(Ec,!1),s.current=u||null,u&&u.editor.setEditorState(u.editorState,{tag:jm})}})(e,t),!0),vt),e.registerCommand(RR,()=>((function(a,s){let i=s.redoStack,d=s.undoStack;if(i.length!==0){let c=s.current;c!==null&&(d.push(c),a.dispatchCommand(Ec,!0));let u=i.pop();i.length===0&&a.dispatchCommand(Rc,!1),s.current=u||null,u&&u.editor.setEditorState(u.editorState,{tag:jm})}})(e,t),!0),vt),e.registerCommand(Km,()=>(lM(t),!1),vt),e.registerCommand(sR,()=>(lM(t),e.dispatchCommand(Rc,!1),e.dispatchCommand(Ec,!1),!0),vt),e.registerUpdateListener(({editorState:a,prevEditorState:s,dirtyLeaves:i,dirtyElements:d,tags:c})=>{let u=t.current,m=t.redoStack,p=t.undoStack,f=u===null?null:u.editorState;if(u!==null&&a===f)return;let g=n(s,a,u,i,d,c);if(g===1)m.length!==0&&(t.redoStack=[],e.dispatchCommand(Rc,!1)),u!==null&&(p.push({...u}),e.dispatchCommand(Ec,!0));else if(g===2)return;t.current={editor:e,editorState:a}}))}function cM(){return{current:null,redoStack:[],undoStack:[]}}var Tf=zt({build:(e,{delay:t,createInitialHistoryState:o,disabled:n})=>wf({delay:t,disabled:n,historyState:o(e)}),config:Dn({createInitialHistoryState:cM,delay:300,disabled:typeof window>"u"}),name:"@lexical/history/History",register:(e,t,o)=>{let n=o.getOutput();return Bc(()=>n.disabled.value?void 0:dM(e,n.historyState.value,n.delay))}}),z4=zt({dependencies:[of(Tf,{createInitialHistoryState:()=>{throw new Error("SharedHistory did not inherit parent history")},disabled:!0})],name:"@lexical/history/SharedHistory",register(e,t,o){let{output:n}=o.getDependency(Tf),r=(function(s){return s?iM(s,Tf.name):null})(e._parentEditor);if(!r)return()=>{};let a=r.output;return Bc(()=>sM(()=>{n.delay.value=a.delay.value,n.historyState.value=a.historyState.value,n.disabled.value=a.disabled.value}))}});var If=oC,ume=If.HistoryExtension,pme=If.SharedHistoryExtension,Sf=If.createEmptyHistoryState,uM=If.registerHistory;var nC={};Ut(nC,{HistoryPlugin:()=>K4,createEmptyHistoryState:()=>Sf});$();function K4({delay:e,externalHistoryState:t}){let[o]=ct();return(function(n,r,a=1e3){let s=W(()=>r||Sf(),[r]);H(()=>uM(n,s,a),[a,n,s])})(o,t,e),null}var pM=nC,mM=pM.HistoryPlugin,fM=pM.createEmptyHistoryState;var rC={};Ut(rC,{OnChangePlugin:()=>W4});$();var q4=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?fe:H;function W4({ignoreHistoryMergeTagChange:e=!0,ignoreSelectionChange:t=!1,onChange:o}){let[n]=ct();return q4(()=>{if(o)return n.registerUpdateListener(({editorState:r,dirtyElements:a,dirtyLeaves:s,prevEditorState:i,tags:d})=>{t&&a.size===0&&s.size===0||e&&d.has(zo)||i.isEmpty()||o(r,n,d)})},[n,e,t,o]),null}var G4=rC,gM=G4.OnChangePlugin;var aC={};Ut(aC,{useLexicalEditable:()=>Q4});$();var j4=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?fe:H;function V4(e){return{initialValueFn:()=>e.isEditable(),subscribe:t=>e.registerEditableListener(t)}}function Q4(){return(function(e){let[t]=ct(),o=W(()=>e(t),[t,e]),[n,r]=q(()=>o.initialValueFn()),a=E(n);return j4(()=>{let{initialValueFn:s,subscribe:i}=o,d=s();return a.current!==d&&(a.current=d,r(d)),i(c=>{a.current=c,r(c)})},[o,e]),n})(V4)}var X4=aC,kf=X4.useLexicalEditable;var sC={};Ut(sC,{ReactProviderExtension:()=>Y4});var Y4=zt({name:"@lexical/react/ReactProvider"});var J4=sC,hM=J4.ReactProviderExtension;var iC={};Ut(iC,{DragonExtension:()=>Z4,registerDragonSupport:()=>yM});function yM(e){let t=window.location.origin,o=n=>{if(n.origin!==t)return;let r=e.getRootElement();if(document.activeElement!==r)return;let a=n.data;if(typeof a=="string"){let s;try{s=JSON.parse(a)}catch{return}if(s&&s.protocol==="nuanria_messaging"&&s.type==="request"){let i=s.payload;if(i&&i.functionId==="makeChanges"){let d=i.args;if(d){let[c,u,m,p,f]=d;e.update(()=>{let g=Te();if(ye(g)){let h=g.anchor,y=h.getNode(),x=0,C=0;if(Ke(y)&&c>=0&&u>=0&&(x=c,C=c+u,g.setTextNodeRange(y,x,y,C)),x===C&&m===""||(g.insertRawText(m),y=h.getNode()),Ke(y)){x=p,C=p+f;let b=y.getTextContentSize();x=x>b?b:x,C=C>b?b:C,g.setTextNodeRange(y,x,y,C)}n.stopImmediatePropagation()}})}}}}};return window.addEventListener("message",o,!0),()=>{window.removeEventListener("message",o,!0)}}var Z4=zt({build:(e,t,o)=>wf(t),config:Dn({disabled:typeof window>"u"}),name:"@lexical/dragon",register:(e,t,o)=>Bc(()=>o.getOutput().disabled.value?void 0:yM(e))});var vM=iC,CM=vM.DragonExtension,xM=vM.registerDragonSupport;var lC={};Ut(lC,{$generateHtmlFromNodes:()=>t3,$generateNodesFromDOM:()=>e3});function e3(e,t){let o=qR(t)?t.body.childNodes:t.childNodes,n=[],r=[];for(let a of o)if(!wM.has(a.nodeName)){let s=TM(a,e,r,!1);s!==null&&(n=n.concat(s))}return(function(a){for(let s of a)s.getNextSibling()instanceof fv&&s.insertAfter(vs());for(let s of a){let i=s.getChildren();for(let d of i)s.insertBefore(d);s.remove()}})(r),n}function t3(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 o=document.createElement("div"),n=Ye().getChildren();for(let r=0;r<n.length;r++)bM(e,n[r],o,t);return o.innerHTML}function bM(e,t,o,n=null){let r=n===null||t.isSelected(n),a=_e(t)&&t.excludeFromCopy("html"),s=t;n!==null&&Ke(t)&&(s=mf(n,t,"clone"));let i=_e(s)?s.getChildren():[],d=zR(e,s.getType()),c;c=d&&d.exportDOM!==void 0?d.exportDOM(e,s):s.exportDOM(e);let{element:u,after:m}=c;if(!u)return!1;let p=document.createDocumentFragment();for(let f=0;f<i.length;f++){let g=i[f],h=bM(e,g,p,n);!r&&_e(t)&&h&&t.extractWithChild(g,n,"html")&&(r=!0)}if(r&&!a){if((EE(u)||Cv(u))&&u.append(p),o.append(u),m){let f=m.call(s,u);f&&(Cv(u)?u.replaceChildren(f):u.replaceWith(f))}}else o.append(p);return r}var wM=new Set(["STYLE","SCRIPT"]);function TM(e,t,o,n,r=new Map,a){let s=[];if(wM.has(e.nodeName))return s;let i=null,d=(function(g,h){let{nodeName:y}=g,x=h._htmlConversions.get(y.toLowerCase()),C=null;if(x!==void 0)for(let b of x){let L=b(g);L!==null&&(C===null||(C.priority||0)<=(L.priority||0))&&(C=L)}return C!==null?C.conversion:null})(e,t),c=d?d(e):null,u=null;if(c!==null){u=c.after;let g=c.node;if(i=Array.isArray(g)?g[g.length-1]:g,i!==null){for(let[,h]of r)if(i=h(i,a),!i)break;i&&s.push(...Array.isArray(g)?g:[i])}c.forChild!=null&&r.set(e.nodeName,c.forChild)}let m=e.childNodes,p=[],f=(i==null||!bs(i))&&(i!=null&&Vi(i)||n);for(let g=0;g<m.length;g++)p.push(...TM(m[g],t,o,f,new Map(r),i));return u!=null&&(p=u(p)),Fv(e)&&(p=o3(e,p,f?()=>{let g=new fv;return o.push(g),g}:mn)),i==null?p.length>0?s=s.concat(p):Fv(e)&&(function(g){return g.nextSibling==null||g.previousSibling==null?!1:Nc(g.nextSibling)&&Nc(g.previousSibling)})(e)&&(s=s.concat(vs())):_e(i)&&i.append(...p),s}function o3(e,t,o){let n=e.style.textAlign,r=[],a=[];for(let s=0;s<t.length;s++){let i=t[s];if(Vi(i))n&&!i.getFormat()&&i.setFormat(n),r.push(i);else if(a.push(i),s===t.length-1||s<t.length-1&&Vi(t[s+1])){let d=o();d.setFormat(n),d.append(...a),r.push(d),a=[]}}return r}var IM=lC,SM=IM.$generateHtmlFromNodes,kM=IM.$generateNodesFromDOM;var cC={};Ut(cC,{$generateJSONFromSelectedNodes:()=>MM,$generateNodesFromSerializedNodes:()=>AM,$getClipboardDataFromSelection:()=>DM,$getHtmlContent:()=>PM,$getLexicalContent:()=>RM,$insertDataTransferForPlainText:()=>n3,$insertDataTransferForRichText:()=>r3,$insertGeneratedNodes:()=>dC,copyToClipboard:()=>a3,setLexicalClipboardDataTransfer:()=>_M});function Lf(e,...t){let o=new URL("https://lexical.dev/docs/error"),n=new URLSearchParams;n.append("code",e);for(let r of t)n.append("v",r);throw o.search=n.toString(),Error(`Minified Lexical error #${e}; visit ${o.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function PM(e,t=Te()){return t==null&&Lf(166),ye(t)&&t.isCollapsed()||t.getNodes().length===0?"":SM(e,t)}function RM(e,t=Te()){return t==null&&Lf(166),ye(t)&&t.isCollapsed()||t.getNodes().length===0?null:JSON.stringify(MM(e,t))}function n3(e,t){let o=e.getData("text/plain")||e.getData("text/uri-list");o!=null&&t.insertRawText(o)}function r3(e,t,o){let n=e.getData("application/x-lexical-editor");if(n)try{let i=JSON.parse(n);if(i.namespace===o._config.namespace&&Array.isArray(i.nodes))return dC(o,AM(i.nodes),t)}catch(i){console.error(i)}let r=e.getData("text/html"),a=e.getData("text/plain");if(r&&a!==r)try{let i=new DOMParser().parseFromString((function(d){return window.trustedTypes&&window.trustedTypes.createPolicy?window.trustedTypes.createPolicy("lexical",{createHTML:c=>c}).createHTML(d):d})(r),"text/html");return dC(o,kM(o,i),t)}catch(i){console.error(i)}let s=a||e.getData("text/uri-list");if(s!=null)if(ye(t)){let i=s.split(/(\r?\n|\t)/);i[i.length-1]===""&&i.pop();for(let d=0;d<i.length;d++){let c=Te();if(ye(c)){let u=i[d];u===`
3562
+ `);let d=i.length;if(!Ke(n)||r>=d){let c=n.getParent();n.remove(),c==null||c.getChildrenSize()!==0||Pc(c)||c.remove(),r-=d+s,n=a}else{let c=n.getKey(),u=e.getEditorState().read(()=>{let f=Ca(c);return Ke(f)&&f.isSimpleText()?f.getTextContent():null}),m=d-r,p=i.slice(0,m);if(u!==null&&u!==i){let f=Sc(),g=n;if(n.isSimpleText())n.setTextContent(u);else{let h=Nn(u);n.replace(h),g=h}if(ye(f)&&f.isCollapsed()){let h=f.anchor.offset;g.select(h,h)}}else if(n.isSimpleText()){let f=t.key===c,g=t.offset;g<r&&(g=d);let h=f?g-r:0,y=f?g:m;if(f&&h===0){let[x]=n.splitText(h,y);x.remove()}else{let[,x]=n.splitText(h,y);x.remove()}}else{let f=Nn(p);n.replace(f)}r=0}}}function yq(e){let t=e.getStyle(),o=nE(t);uf.set(t,o)}function cf(e,t){(ye(e)?e.isCollapsed():Ke(e)||_e(e))||kv(280);let o=pf(ye(e)?e.style:Ke(e)?e.getStyle():e.getTextStyle()),n=Object.entries(t).reduce((a,[s,i])=>(typeof i=="function"?a[s]=i(o[s],e):i===null?delete a[s]:a[s]=i,a),{...o}),r=rE(n);ye(e)||Ke(e)?e.setStyle(r):e.setTextStyle(r),uf.set(r,n)}function vq(e,t){if(ye(e)&&e.isCollapsed()){cf(e,t);let n=e.anchor.getNode();_e(n)&&n.isEmpty()&&cf(n,t)}sE(n=>{cf(n,t)});let o=e.getNodes();if(o.length>0){let n=new Set;for(let r of o){if(!_e(r)||!r.canBeEmpty()||r.getChildrenSize()!==0)continue;let a=r.getKey();n.has(a)||(n.add(a),cf(r,t))}}}function sE(e){let t=Te();if(!t)return;let o=new Map,n=a=>o.get(a.getKey())||[0,a.getTextContentSize()];if(ye(t))for(let a of FP(t).getTextSlices())a&&o.set(a.caret.origin.getKey(),a.getSliceIndices());let r=t.getNodes();for(let a of r){if(!Ke(a)||!a.canHaveFormat())continue;let[s,i]=n(a);i!==s&&(mv(a)||s===0&&i===a.getTextContentSize()?e(a):e(a.splitText(s,i)[s===0?0:1]))}ye(t)&&t.anchor.type==="text"&&t.focus.type==="text"&&t.anchor.key===t.focus.key&&iE(t)}function iE(e){if(e.isBackward()){let{anchor:t,focus:o}=e,{key:n,offset:r,type:a}=t;t.set(o.key,o.offset,o.type),o.set(n,r,a)}}function lE(e,t){let o=e.getFormatType(),n=e.getIndent();o!==t.getFormatType()&&t.setFormat(o),n!==t.getIndent()&&t.setIndent(n)}function Cq(e,t,o=lE){if(e===null)return;let n=e.getStartEndPoints(),r=new Map,a=null;if(n){let[s,i]=n;a=Cs(),a.anchor.set(s.key,s.offset,s.type),a.focus.set(i.key,i.offset,i.type);let d=Mr(s.getNode(),Mc),c=Mr(i.getNode(),Mc);_e(d)&&r.set(d.getKey(),d),_e(c)&&r.set(c.getKey(),c)}for(let s of e.getNodes())if(_e(s)&&Mc(s))r.set(s.getKey(),s);else if(n===null){let i=Mr(s,Mc);_e(i)&&r.set(i.getKey(),i)}for(let[s,i]of r){let d=t();o(i,d),i.replace(d,!0),a&&(s===a.anchor.key&&a.anchor.set(d.getKey(),a.anchor.offset,a.anchor.type),s===a.focus.key&&a.focus.set(d.getKey(),a.focus.offset,a.focus.type))}a&&e.is(Te())&&mn(a)}function oE(e){return e.getNode().isAttached()}function xq(e){let t=e;for(;t!==null&&!bs(t);){let o=t.getLatest(),n=t.getParent();o.getChildrenSize()===0&&t.remove(!0),t=n}}function bq(e,t,o=null){let n=e.getStartEndPoints(),r=n?n[0]:null,a=e.getNodes(),s=a.length;if(r!==null&&(s===0||s===1&&r.type==="element"&&r.getNode().getChildrenSize()===0)){let c=r.type==="text"?r.getNode().getParentOrThrow():r.getNode(),u=c.getChildren(),m=t();return m.setFormat(c.getFormatType()),m.setIndent(c.getIndent()),u.forEach(p=>m.append(p)),o&&(m=o.append(m)),void c.replace(m)}let i=null,d=[];for(let c=0;c<s;c++){let u=a[c];bs(u)?(Sv(e,d,d.length,t,o),d=[],i=u):i===null||i!==null&&VP(u,i)?d.push(u):(Sv(e,d,d.length,t,o),d=[u])}Sv(e,d,d.length,t,o)}function Sv(e,t,o,n,r=null){if(t.length===0)return;let a=t[0],s=new Map,i=[],d=_e(a)?a:a.getParentOrThrow();d.isInline()&&(d=d.getParentOrThrow());let c=!1;for(;d!==null;){let g=d.getPreviousSibling();if(g!==null){d=g,c=!0;break}if(d=d.getParentOrThrow(),bs(d))break}let u=new Set;for(let g=0;g<o;g++){let h=t[g];_e(h)&&h.getChildrenSize()===0&&u.add(h.getKey())}let m=new Set;for(let g=0;g<o;g++){let h=t[g],y=h.getParent();if(y!==null&&y.isInline()&&(y=y.getParent()),y!==null&&YP(h)&&!m.has(h.getKey())){let x=y.getKey();if(s.get(x)===void 0){let C=n();C.setFormat(y.getFormatType()),C.setIndent(y.getIndent()),i.push(C),s.set(x,C),y.getChildren().forEach(b=>{C.append(b),m.add(b.getKey()),_e(b)&&b.getChildrenKeys().forEach(L=>m.add(L))}),xq(y)}}else if(u.has(h.getKey())){_e(h)||kv(179);let x=n();x.setFormat(h.getFormatType()),x.setIndent(h.getIndent()),i.push(x),h.remove(!0)}}if(r!==null)for(let g=0;g<i.length;g++){let h=i[g];r.append(h)}let p=null;if(bs(d))if(c)if(r!==null)d.insertAfter(r);else for(let g=i.length-1;g>=0;g--){let h=i[g];d.insertAfter(h)}else{let g=d.getFirstChild();if(_e(g)&&(d=g),g===null)if(r)d.append(r);else for(let h=0;h<i.length;h++){let y=i[h];d.append(y),p=y}else if(r!==null)g.insertBefore(r);else for(let h=0;h<i.length;h++){let y=i[h];g.insertBefore(y),p=y}}else if(r)d.insertAfter(r);else for(let g=i.length-1;g>=0;g--){let h=i[g];d.insertAfter(h),p=h}let f=Sc();ye(f)&&oE(f.anchor)&&oE(f.focus)?mn(f.clone()):p!==null?p.selectEnd():e.dirty=!0}function dE(e){let t=cE(e);return t!==null&&t.writingMode==="vertical-rl"}function cE(e){let t=e.anchor.getNode();return _e(t)?Lv(t):Pv(t)}function wq(e,t){let o=dE(e)?!t:t;Rv(e)&&(o=!o);let n=ji(e.focus,o?"previous":"next");if(XP(n))return!1;for(let r of KP(n)){if(kc(r))return!r.origin.isInline();if(!_e(r.origin)){if(Hm(r.origin))return!0;break}}return!1}function uE(e,t,o,n){e.modify(t?"extend":"move",o,n)}function Rv(e){let t=cE(e);return t!==null&&t.direction==="rtl"}function Tq(e,t,o){let n=Rv(e),r;r=dE(e)||n?!o:o,uE(e,t,r,"character")}function Iq(e,t,o){let n=pf(e.getStyle());return n!==null&&n[t]||o}function Sq(e,t,o=""){let n=null,r=e.getNodes(),a=e.anchor,s=e.focus,i=e.isBackward(),d=i?s.offset:a.offset,c=i?s.getNode():a.getNode();if(ye(e)&&e.isCollapsed()&&e.style!==""){let u=pf(e.style);if(u!==null&&t in u)return u[t]}for(let u=0;u<r.length;u++){let m=r[u];if((u===0||d!==0||!m.is(c))&&Ke(m)){let p=Iq(m,t,o);if(n===null)n=p;else if(n!==p){n="";break}}}return n===null?o:n}var kq=aE;var Rt=Ev,pE=Rt.$addNodeStyle,tue=Rt.$cloneWithProperties,oue=Rt.$copyBlockFormatIndent,nue=Rt.$ensureForwardRangeSelection,rue=Rt.$forEachSelectedTextNode,aue=Rt.$getComputedStyleForElement,sue=Rt.$getComputedStyleForParent,iue=Rt.$getSelectionStyleValueForProperty,lue=Rt.$isAtNodeEnd,due=Rt.$isParentElementRTL,cue=Rt.$isParentRTL,uue=Rt.$moveCaretSelection,Mv=Rt.$moveCharacter,pue=Rt.$patchStyleText,mue=Rt.$selectAll,fue=Rt.$setBlocksType,Av=Rt.$shouldOverrideDefaultCharacterSelection,mf=Rt.$sliceSelectedTextNodeContent,gue=Rt.$trimTextContentFromAnchor,hue=Rt.$wrapNodes,yue=Rt.createDOMRange,mE=Rt.createRectsFromDOMRange,vue=Rt.getCSSFromStyleObject,Cue=Rt.getStyleObjectFromCSS,xue=Rt.trimTextContentFromAnchor;var Ov={};Ut(Ov,{$descendantsMatching:()=>d4,$dfs:()=>Wq,$dfsIterator:()=>TE,$filter:()=>n4,$findMatchingParent:()=>Mr,$firstToLastIterator:()=>c4,$getAdjacentCaret:()=>Gq,$getAdjacentSiblingOrParentSiblingCaret:()=>xs,$getDepth:()=>SE,$getNearestBlockElementAncestorOrThrow:()=>Yq,$getNearestNodeOfType:()=>Xq,$getNextRightPreorderNode:()=>Qq,$getNextSiblingOrParentSibling:()=>Vq,$handleIndentAndOutdent:()=>r4,$insertFirst:()=>a4,$insertNodeToNearestRoot:()=>e4,$insertNodeToNearestRootAtCaret:()=>LE,$isEditorIsNestedEditor:()=>i4,$lastToFirstIterator:()=>_v,$restoreEditorState:()=>Zq,$reverseDfs:()=>jq,$reverseDfsIterator:()=>kE,$splitNode:()=>sR,$unwrapAndFilterDescendants:()=>l4,$unwrapNode:()=>u4,$wrapNodeInElement:()=>t4,CAN_USE_BEFORE_INPUT:()=>Oq,CAN_USE_DOM:()=>xE,IS_ANDROID:()=>Fq,IS_ANDROID_CHROME:()=>Bq,IS_APPLE:()=>Hq,IS_APPLE_WEBKIT:()=>Uq,IS_CHROME:()=>$q,IS_FIREFOX:()=>bE,IS_IOS:()=>zq,IS_SAFARI:()=>Kq,addClassNamesToElement:()=>Ac,calculateZoomLevel:()=>s4,isBlockDomNode:()=>WR,isHTMLAnchorElement:()=>VR,isHTMLElement:()=>rf,isInlineDomNode:()=>Nc,isMimeType:()=>wE,makeStateWrapper:()=>p4,markSelection:()=>CE,mediaFileReader:()=>qq,mergeRegister:()=>rr,objectKlassEquals:()=>o4,positionNodeOnRange:()=>vE,registerNestedElementResolver:()=>Jq,removeClassNamesFromElement:()=>af,selectionAlwaysOnDisplay:()=>_q});function ff(e,...t){let o=new URL("https://lexical.dev/docs/error"),n=new URLSearchParams;n.append("code",e);for(let r of t)n.append("v",r);throw o.search=n.toString(),Error(`Minified Lexical error #${e}; visit ${o.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var _n=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,Lq=_n&&"documentMode"in document?document.documentMode:null,hE=_n&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Pq=_n&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Rq=!(!_n||!("InputEvent"in window)||Lq)&&"getTargetRanges"in new window.InputEvent("input"),Eq=_n&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),Mq=_n&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,yE=_n&&/Android/.test(navigator.userAgent),Dv=_n&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Aq=_n&&yE&&Dv,Nq=_n&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&hE&&!Dv;function ar(e){return`${e}px`}var Dq={attributes:!0,characterData:!0,childList:!0,subtree:!0};function vE(e,t,o){let n=null,r=null,a=null,s=[],i=document.createElement("div");function d(){n===null&&ff(182),r===null&&ff(183);let{left:m,top:p}=r.getBoundingClientRect(),f=mE(e,t);var g,h;i.isConnected||(h=i,(g=r).insertBefore(h,g.firstChild));let y=!1;for(let x=0;x<f.length;x++){let C=f[x],b=s[x]||document.createElement("div"),L=b.style;L.position!=="absolute"&&(L.position="absolute",y=!0);let w=ar(C.left-m);L.left!==w&&(L.left=w,y=!0);let k=ar(C.top-p);L.top!==k&&(b.style.top=k,y=!0);let I=ar(C.width);L.width!==I&&(b.style.width=I,y=!0);let T=ar(C.height);L.height!==T&&(b.style.height=T,y=!0),b.parentNode!==i&&(i.append(b),y=!0),s[x]=b}for(;s.length>f.length;)s.pop();y&&o(s)}function c(){r=null,n=null,a!==null&&a.disconnect(),a=null,i.remove();for(let m of s)m.remove();s=[]}i.style.position="relative";let u=e.registerRootListener(function m(){let p=e.getRootElement();if(p===null)return c();let f=p.parentElement;if(!rf(f))return c();c(),n=p,r=f,a=new MutationObserver(g=>{let h=e.getRootElement(),y=h&&h.parentElement;if(h!==n||y!==r)return m();for(let x of g)if(!i.contains(x.target))return d()}),a.observe(f,Dq),d()});return()=>{u(),c()}}function fE(e,t,o){if(e.type!=="text"&&_e(t)){let n=t.getDOMSlot(o);return[n.element,n.getFirstChildOffset()+e.offset]}return[KR(o)||o,e.offset]}function CE(e,t){let o=null,n=null,r=null,a=null,s=null,i=null,d=()=>{};function c(u){u.read(()=>{let m=Te();if(!ye(m))return o=null,r=null,a=null,i=null,d(),void(d=()=>{});let[p,f]=(function(T){let S=T.getStartEndPoints();return T.isBackward()?[S[1],S[0]]:S})(m),g=p.getNode(),h=g.getKey(),y=p.offset,x=f.getNode(),C=x.getKey(),b=f.offset,L=e.getElementByKey(h),w=e.getElementByKey(C),k=o===null||L!==n||y!==r||h!==o.getKey(),I=a===null||w!==s||b!==i||C!==a.getKey();if((k||I)&&L!==null&&w!==null){let T=(function(S,P,A,N,B,O,j){let U=(S._window?S._window.document:document).createRange();return U.setStart(...fE(P,A,N)),U.setEnd(...fE(B,O,j)),U})(e,p,g,L,f,x,w);d(),d=vE(e,T,S=>{if(t===void 0)for(let P of S){let A=P.style;A.background!=="Highlight"&&(A.background="Highlight"),A.color!=="HighlightText"&&(A.color="HighlightText"),A.marginTop!==ar(-1.5)&&(A.marginTop=ar(-1.5)),A.paddingTop!==ar(4)&&(A.paddingTop=ar(4)),A.paddingBottom!==ar(0)&&(A.paddingBottom=ar(0))}else t(S)})}o=g,n=L,r=y,a=x,s=w,i=b})}return c(e.getEditorState()),rr(e.registerUpdateListener(({editorState:u})=>c(u)),()=>{d()})}function _q(e,t){let o=null,n=()=>{let r=getSelection(),a=r&&r.anchorNode,s=e.getRootElement();a!==null&&s!==null&&s.contains(a)?o!==null&&(o(),o=null):o===null&&(o=CE(e,t))};return document.addEventListener("selectionchange",n),()=>{o!==null&&o(),document.removeEventListener("selectionchange",n)}}var Oq=Rq,xE=_n,Fq=yE,Bq=Aq,Hq=hE,Uq=Nq,$q=Dv,bE=Pq,zq=Mq,Kq=Eq;function wE(e,t){for(let o of t)if(e.type.startsWith(o))return!0;return!1}function qq(e,t){let o=e[Symbol.iterator]();return new Promise((n,r)=>{let a=[],s=()=>{let{done:i,value:d}=o.next();if(i)return n(a);let c=new FileReader;c.addEventListener("error",r),c.addEventListener("load",()=>{let u=c.result;typeof u=="string"&&a.push({file:d,result:u}),s()}),wE(d,t)?c.readAsDataURL(d):s()};s()})}function Wq(e,t){return Array.from(TE(e,t))}function Gq(e){return e?e.getAdjacentCaret():null}function jq(e,t){return Array.from(kE(e,t))}function TE(e,t){return IE("next",e,t)}function gE(e,t){let o=xs(Ar(e,t));return o&&o[0]}function IE(e,t,o){let n=Ye(),r=t||n,a=_e(r)?va(r,e):Ar(r,e),s=SE(r),i=o?dv(uv(Ar(o,e)))||gE(o,e):gE(r,e),d=s;return xv({hasNext:c=>c!==null,initial:a,map:c=>({depth:d,node:c.origin}),step:c=>{if(c.isSameNodeCaret(i))return null;kc(c)&&d++;let u=xs(c);return!u||u[0].isSameNodeCaret(i)?null:(d+=u[1],u[0])}})}function Vq(e){let t=xs(Ar(e,"next"));return t&&[t[0].origin,t[1]]}function SE(e){let t=-1;for(let o=e;o!==null;o=o.getParent())t++;return t}function Qq(e){let t=uv(Ar(e,"previous")),o=xs(t,"root");return o&&o[0].origin}function kE(e,t){return IE("previous",e,t)}function Xq(e,t){let o=e;for(;o!=null;){if(o instanceof t)return o;o=o.getParent()}return null}function Yq(e){let t=Mr(e,o=>_e(o)&&!o.isInline());return _e(t)||ff(4,e.__key),t}function Jq(e,t,o,n){let r=a=>a instanceof t;return e.registerNodeTransform(t,a=>{let s=(i=>{let d=i.getChildren();for(let m=0;m<d.length;m++){let p=d[m];if(r(p))return null}let c=i,u=i;for(;c!==null;)if(u=c,c=c.getParent(),r(c))return{child:u,parent:c};return null})(a);if(s!==null){let{child:i,parent:d}=s;if(i.is(a)){n(d,a);let c=i.getNextSiblings(),u=c.length;if(d.insertAfter(i),u!==0){let m=o(d);i.insertAfter(m);for(let p=0;p<u;p++)m.append(c[p])}d.canBeEmpty()||d.getChildrenSize()!==0||d.remove()}}})}function Zq(e,t){let o=new Map,n=e._pendingEditorState;for(let[a,s]of t._nodeMap)o.set(a,Om(s));n&&(n._nodeMap=o),e._dirtyType=2;let r=t._selection;mn(r===null?null:r.clone())}function e4(e){let t=Te()||Sc(),o;if(ye(t))o=ji(t.focus,"next");else{if(t!=null){let s=t.getNodes(),i=s[s.length-1];i&&(o=Ar(i,"next"))}o=o||va(Ye(),"previous").getFlipped().insert(pn())}let n=LE(e,o),r=dv(n),a=kc(r)?eR(r):n;return rR(GP(a)),e.getLatest()}function LE(e,t,o){let n=cv(t,"next");for(let r=n;r;r=aR(r,o))n=r;return Um(n)&&ff(283),n.insert(e.isInline()?pn().append(e):e),cv(Ar(e.getLatest(),"next"),t.direction)}function t4(e,t){let o=t();return e.replace(o),o.append(e),o}function o4(e,t){return e!==null&&Object.getPrototypeOf(e).constructor.name===t.name}function n4(e,t){let o=[];for(let n=0;n<e.length;n++){let r=t(e[n]);r!==null&&o.push(r)}return o}function r4(e){let t=Te();if(!ye(t))return!1;let o=new Set,n=t.getNodes();for(let r=0;r<n.length;r++){let a=n[r],s=a.getKey();if(o.has(s))continue;let i=Mr(a,c=>_e(c)&&!c.isInline());if(i===null)continue;let d=i.getKey();i.canIndent()&&!o.has(d)&&(o.add(d),e(i))}return o.size>0}function a4(e,t){va(e,"next").insert(t)}var Nv=!(bE||!xE)&&void 0;function s4(e,t=!1){let o=1;if((function(){if(Nv===void 0){let n=document.createElement("div");n.style.cssText="position: absolute; opacity: 0; width: 100px; left: -1000px;",document.body.appendChild(n);let r=n.getBoundingClientRect();n.style.setProperty("zoom","2"),Nv=n.getBoundingClientRect().width===r.width,document.body.removeChild(n)}return Nv})()||t)for(;e;)o*=Number(window.getComputedStyle(e).getPropertyValue("zoom")),e=e.parentElement;return o}function i4(e){return e._parentEditor!==null}function l4(e,t){return PE(e,t,null)}function PE(e,t,o){let n=!1;for(let r of _v(e))t(r)?o!==null&&o(r):(n=!0,_e(r)&&PE(r,t,o||(a=>r.insertAfter(a))),r.remove());return n}function d4(e,t){let o=[],n=Array.from(e).reverse();for(let r=n.pop();r!==void 0;r=n.pop())if(t(r))o.push(r);else if(_e(r))for(let a of _v(r))n.push(a);return o}function c4(e){return RE(va(e,"next"))}function _v(e){return RE(va(e,"previous"))}function RE(e){return xv({hasNext:ZP,initial:e.getAdjacentCaret(),map:t=>t.origin.getLatest(),step:t=>t.getAdjacentCaret()})}function u4(e){nR(Ar(e,"next")).splice(1,e.getChildren())}function p4(e){let t=n=>Bm(n,e),o=(n,r)=>zm(n,e,r);return{$get:t,$set:o,accessors:[t,o],makeGetterMethod:()=>function(){return t(this)},makeSetterMethod:()=>function(n){return o(this,n)},stateConfig:e}}var Be=Ov,Sue=Be.$descendantsMatching,kue=Be.$dfs,Lue=Be.$dfsIterator,Pue=Be.$filter,Rue=Be.$findMatchingParent,Eue=Be.$firstToLastIterator,Mue=Be.$getAdjacentCaret,Aue=Be.$getAdjacentSiblingOrParentSiblingCaret,Nue=Be.$getDepth,EE=Be.$getNearestBlockElementAncestorOrThrow,Due=Be.$getNearestNodeOfType,_ue=Be.$getNextRightPreorderNode,Oue=Be.$getNextSiblingOrParentSibling,ME=Be.$handleIndentAndOutdent,Fue=Be.$insertFirst,Bue=Be.$insertNodeToNearestRoot,Hue=Be.$insertNodeToNearestRootAtCaret,Uue=Be.$isEditorIsNestedEditor,$ue=Be.$lastToFirstIterator,zue=Be.$restoreEditorState,Kue=Be.$reverseDfs,que=Be.$reverseDfsIterator,Wue=Be.$splitNode,Gue=Be.$unwrapAndFilterDescendants,jue=Be.$unwrapNode,Vue=Be.$wrapNodeInElement,Que=Be.CAN_USE_BEFORE_INPUT,Xue=Be.CAN_USE_DOM,Yue=Be.IS_ANDROID,Jue=Be.IS_ANDROID_CHROME,Zue=Be.IS_APPLE,epe=Be.IS_APPLE_WEBKIT,tpe=Be.IS_CHROME,ope=Be.IS_FIREFOX,npe=Be.IS_IOS,rpe=Be.IS_SAFARI,ape=Be.addClassNamesToElement,spe=Be.calculateZoomLevel,Fv=Be.isBlockDomNode,ipe=Be.isHTMLAnchorElement,AE=Be.isHTMLElement,lpe=Be.isInlineDomNode,dpe=Be.isMimeType,cpe=Be.makeStateWrapper,upe=Be.markSelection,ppe=Be.mediaFileReader,Nr=Be.mergeRegister,Dc=Be.objectKlassEquals,mpe=Be.positionNodeOnRange,fpe=Be.registerNestedElementResolver,gpe=Be.removeClassNamesFromElement,hpe=Be.selectionAlwaysOnDisplay;var Bv={};Ut(Bv,{ContentEditable:()=>f4,ContentEditableElement:()=>_E});$();var DE=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?fe:H;function m4({editor:e,ariaActiveDescendant:t,ariaAutoComplete:o,ariaControls:n,ariaDescribedBy:r,ariaErrorMessage:a,ariaExpanded:s,ariaInvalid:i,ariaLabel:d,ariaLabelledBy:c,ariaMultiline:u,ariaOwns:m,ariaRequired:p,autoCapitalize:f,className:g,id:h,role:y="textbox",spellCheck:x=!0,style:C,tabIndex:b,"data-testid":L,...w},k){let[I,T]=q(e.isEditable()),S=R(A=>{A&&A.ownerDocument&&A.ownerDocument.defaultView?e.setRootElement(A):e.setRootElement(null)},[e]),P=W(()=>(function(...A){return N=>{for(let B of A)typeof B=="function"?B(N):B!=null&&(B.current=N)}})(k,S),[S,k]);return DE(()=>(T(e.isEditable()),e.registerEditableListener(A=>{T(A)})),[e]),l("div",{"aria-activedescendant":I?t:void 0,"aria-autocomplete":I?o:"none","aria-controls":I?n:void 0,"aria-describedby":r,...a!=null?{"aria-errormessage":a}:{},"aria-expanded":I&&y==="combobox"?!!s:void 0,...i!=null?{"aria-invalid":i}:{},"aria-label":d,"aria-labelledby":c,"aria-multiline":u,"aria-owns":I?m:void 0,"aria-readonly":!I||void 0,"aria-required":p,autoCapitalize:f,className:g,contentEditable:I,"data-testid":L,id:h,ref:P,role:y,spellCheck:x,style:C,tabIndex:b,...w})}var _E=zn(m4);function NE(e){return e.getEditorState().read(df(e.isComposing()))}var f4=zn(g4);function g4(e,t){let{placeholder:o,...n}=e,[r]=ct();return v(oe,{children:[l(_E,{editor:r,...n,ref:t}),o!=null&&l(h4,{editor:r,content:o})]})}function h4({content:e,editor:t}){let o=(function(s){let[i,d]=q(()=>NE(s));return DE(()=>{function c(){let u=NE(s);d(u)}return c(),Nr(s.registerUpdateListener(()=>{c()}),s.registerEditableListener(()=>{c()}))},[s]),i})(t),[n,r]=q(t.isEditable());if(fe(()=>(r(t.isEditable()),t.registerEditableListener(s=>{r(s)})),[t]),!o)return null;let a=null;return typeof e=="function"?a=e(n):e!==null&&(a=e),a===null?null:l("div",{"aria-hidden":!0,children:a})}var OE=Bv,FE=OE.ContentEditable,Tpe=OE.ContentEditableElement;$();var y4=qe(null),Hv={didCatch:!1,error:null},gf=class extends ur{constructor(t){super(t),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=Hv}static getDerivedStateFromError(t){return{didCatch:!0,error:t}}resetErrorBoundary(...t){let{error:o}=this.state;o!==null&&(this.props.onReset?.({args:t,reason:"imperative-api"}),this.setState(Hv))}componentDidCatch(t,o){this.props.onError?.(t,o)}componentDidUpdate(t,o){let{didCatch:n}=this.state,{resetKeys:r}=this.props;n&&o.error!==null&&v4(t.resetKeys,r)&&(this.props.onReset?.({next:r,prev:t.resetKeys,reason:"keys"}),this.setState(Hv))}render(){let{children:t,fallbackRender:o,FallbackComponent:n,fallback:r}=this.props,{didCatch:a,error:s}=this.state,i=t;if(a){let d={error:s,resetErrorBoundary:this.resetErrorBoundary};if(typeof o=="function")i=o(d);else if(n)i=yn(n,d);else if(r!==void 0)i=r;else throw s}return yn(y4.Provider,{value:{didCatch:a,error:s,resetErrorBoundary:this.resetErrorBoundary}},i)}};function v4(e=[],t=[]){return e.length!==t.length||e.some((o,n)=>!Object.is(o,t[n]))}var Uv={};Ut(Uv,{LexicalErrorBoundary:()=>C4});function C4({children:e,onError:t}){return l(gf,{fallback:l("div",{style:{border:"1px solid #f00",color:"#f00",padding:"8px"},children:"An error was thrown."}),onError:t,children:e})}var x4=Uv,BE=x4.LexicalErrorBoundary;var tC={};Ut(tC,{$createHorizontalRuleNode:()=>eC,$isDecoratorTextNode:()=>JE,$isHorizontalRuleNode:()=>rM,AutoFocusExtension:()=>T4,ClearEditorExtension:()=>I4,DecoratorTextExtension:()=>E4,DecoratorTextNode:()=>Fc,EditorStateExtension:()=>Cf,HorizontalRuleExtension:()=>$4,HorizontalRuleNode:()=>Is,INSERT_HORIZONTAL_RULE_COMMAND:()=>H4,InitialStateExtension:()=>oM,LexicalBuilder:()=>Zi,NodeSelectionExtension:()=>Xv,TabIndentationExtension:()=>z4,applyFormatFromStyle:()=>k4,applyFormatToDom:()=>L4,batch:()=>qE,buildEditorFromExtensions:()=>D4,computed:()=>jE,configExtension:()=>of,declarePeerDependency:()=>zR,defineExtension:()=>zt,effect:()=>wa,getExtensionDependencyFromEditor:()=>O4,getKnownTypesAndNodes:()=>S4,getPeerDependencyFromEditor:()=>nM,getPeerDependencyFromEditorOrThrow:()=>F4,namedSignals:()=>bf,registerClearEditor:()=>XE,registerTabIndentation:()=>sM,safeCast:()=>Dn,shallowMergeConfig:()=>sf,signal:()=>Ji,untracked:()=>Gv,watchedSignal:()=>Jv});var b4=Symbol.for("preact-signals");function xf(){if(ba>1)return void ba--;let e,t=!1;for(;Oc!==void 0;){let o=Oc;for(Oc=void 0,jv++;o!==void 0;){let n=o.o;if(o.o=void 0,o.f&=-3,!(8&o.f)&&WE(o))try{o.c()}catch(r){t||(e=r,t=!0)}o=n}}if(jv=0,ba--,t)throw e}function qE(e){if(ba>0)return e();ba++;try{return e()}finally{xf()}}var st,Oc;function Gv(e){let t=st;st=void 0;try{return e()}finally{st=t}}var ba=0,jv=0,vf=0;function HE(e){if(st===void 0)return;let t=e.n;return t===void 0||t.t!==st?(t={i:0,S:e,p:st.s,n:void 0,t:st,e:void 0,x:void 0,r:t},st.s!==void 0&&(st.s.n=t),st.s=t,e.n=t,32&st.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=st.s,t.n=void 0,st.s.n=t,st.s=t),t):void 0}function Lo(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 Ji(e,t){return new Lo(e,t)}function WE(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 o=t.S.n;if(o!==void 0&&(t.r=o),t.S.n=t,t.i=-1,t.n===void 0){e.s=t;break}}}function GE(e){let t,o=e.s;for(;o!==void 0;){let n=o.p;o.i===-1?(o.S.U(o),n!==void 0&&(n.n=o.n),o.n!==void 0&&(o.n.p=n)):t=o,o.S.n=o.r,o.r!==void 0&&(o.r=void 0),o=n}e.s=t}function Ts(e,t){Lo.call(this,void 0),this.x=e,this.s=void 0,this.g=vf-1,this.f=4,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}function jE(e,t){return new Ts(e,t)}function VE(e){let t=e.u;if(e.u=void 0,typeof t=="function"){ba++;let o=st;st=void 0;try{t()}catch(n){throw e.f&=-2,e.f|=8,Yv(e),n}finally{st=o,xf()}}}function Yv(e){for(let t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,VE(e)}function w4(e){if(st!==this)throw new Error("Out-of-order effect");GE(this),st=e,this.f&=-2,8&this.f&&Yv(this),xf()}function Yi(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 wa(e,t){let o=new Yi(e,t);try{o.c()}catch(r){throw o.d(),r}let n=o.d.bind(o);return n[Symbol.dispose]=n,n}function bf(e,t={}){let o={};for(let n in e){let r=t[n],a=Ji(r===void 0?e[n]:r);o[n]=a}return o}Lo.prototype.brand=b4,Lo.prototype.h=function(){return!0},Lo.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:Gv(()=>{var o;(o=this.W)==null||o.call(this)}))},Lo.prototype.U=function(e){if(this.t!==void 0){let t=e.e,o=e.x;t!==void 0&&(t.x=o,e.e=void 0),o!==void 0&&(o.e=t,e.x=void 0),e===this.t&&(this.t=o,o===void 0&&Gv(()=>{var n;(n=this.Z)==null||n.call(this)}))}},Lo.prototype.subscribe=function(e){return wa(()=>{let t=this.value,o=st;st=void 0;try{e(t)}finally{st=o}},{name:"sub"})},Lo.prototype.valueOf=function(){return this.value},Lo.prototype.toString=function(){return this.value+""},Lo.prototype.toJSON=function(){return this.value},Lo.prototype.peek=function(){let e=st;st=void 0;try{return this.value}finally{st=e}},Object.defineProperty(Lo.prototype,"value",{get(){let e=HE(this);return e!==void 0&&(e.i=this.i),this.v},set(e){if(e!==this.v){if(jv>100)throw new Error("Cycle detected");this.v=e,this.i++,vf++,ba++;try{for(let t=this.t;t!==void 0;t=t.x)t.t.N()}finally{xf()}}}}),Ts.prototype=new Lo,Ts.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===vf))return!0;if(this.g=vf,this.f|=1,this.i>0&&!WE(this))return this.f&=-2,!0;let e=st;try{UE(this),st=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 st=e,GE(this),this.f&=-2,!0},Ts.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)}Lo.prototype.S.call(this,e)},Ts.prototype.U=function(e){if(this.t!==void 0&&(Lo.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)}},Ts.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(Ts.prototype,"value",{get(){if(1&this.f)throw new Error("Cycle detected");let e=HE(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}}),Yi.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()}},Yi.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,VE(this),UE(this),ba++;let e=st;return st=this,w4.bind(this,e)},Yi.prototype.N=function(){2&this.f||(this.f|=2,this.o=Oc,Oc=this)},Yi.prototype.d=function(){this.f|=8,1&this.f||Yv(this)},Yi.prototype.dispose=function(){this.d()};var T4=zt({build:(e,t,o)=>bf(t),config:Dn({defaultSelection:"rootEnd",disabled:!1}),name:"@lexical/extension/AutoFocus",register(e,t,o){let n=o.getOutput();return wa(()=>n.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:n.defaultSelection.peek()})}))}});function QE(){let e=Ye(),t=Te(),o=pn();e.clear(),e.append(o),t!==null&&o.select(),ye(t)&&(t.format=0)}function XE(e,t=QE){return e.registerCommand(Km,o=>(e.update(t),!0),vt)}var I4=zt({build:(e,t,o)=>bf(t),config:Dn({$onClear:QE}),name:"@lexical/extension/ClearEditor",register(e,t,o){let{$onClear:n}=o.getOutput();return wa(()=>XE(e,n.value))}});function S4(e){let t=new Set,o=new Set;for(let n of YE(e)){let r=typeof n=="function"?n:n.replace;t.add(r.getType()),o.add(r)}return{nodes:o,types:t}}function YE(e){return(typeof e.nodes=="function"?e.nodes():e.nodes)||[]}var $v=$R("format",{parse:e=>typeof e=="number"?e:0}),Fc=class extends xa{$config(){return this.config("decorator-text",{extends:xa,stateConfigs:[{flat:!0,stateConfig:$v}]})}getFormat(){return Bm(this,$v)}getFormatFlags(t,o){return bv(this.getFormat(),t,o)}hasFormat(t){let o=FR[t];return(this.getFormat()&o)!==0}setFormat(t){return zm(this,$v,t)}toggleFormat(t){let o=this.getFormat(),n=bv(o,t,null);return this.setFormat(n)}isInline(){return!0}createDOM(){return document.createElement("span")}updateDOM(){return!1}};function JE(e){return e instanceof Fc}function k4(e,t,o){let n=t.fontWeight,r=t.textDecoration.split(" "),a=n==="700"||n==="bold",s=r.includes("line-through"),i=t.fontStyle==="italic",d=r.includes("underline"),c=t.verticalAlign;return a&&!e.hasFormat("bold")&&e.toggleFormat("bold"),s&&!e.hasFormat("strikethrough")&&e.toggleFormat("strikethrough"),i&&!e.hasFormat("italic")&&e.toggleFormat("italic"),d&&!e.hasFormat("underline")&&e.toggleFormat("underline"),c!=="sub"||e.hasFormat("subscript")||e.toggleFormat("subscript"),c!=="super"||e.hasFormat("superscript")||e.toggleFormat("superscript"),o&&!e.hasFormat(o)&&e.toggleFormat(o),e}function L4(e,t,o=R4){for(let[n,r]of Object.entries(o))e.hasFormat(r)&&(t=P4(t,n));return t}function P4(e,t){let o=document.createElement(t);return o.appendChild(e),o}var R4={b:"bold",code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"},E4=zt({name:"@lexical/extension/DecoratorText",nodes:()=>[Fc],register:(e,t,o)=>e.registerCommand(CR,n=>{let r=Te();if(pv(r)||ye(r))for(let a of r.getNodes())JE(a)&&a.toggleFormat(n);return!1},Qi)});function Jv(e,t){let o;return Ji(e(),{unwatched(){o&&(o(),o=void 0)},watched(){this.value=e(),o=t(this)}})}var Cf=zt({build:e=>Jv(()=>e.getEditorState(),t=>e.registerUpdateListener(o=>{t.value=o.editorState})),name:"@lexical/extension/EditorState"});function ut(e,...t){let o=new URL("https://lexical.dev/docs/error"),n=new URLSearchParams;n.append("code",e);for(let r of t)n.append("v",r);throw o.search=n.toString(),Error(`Minified Lexical error #${e}; visit ${o.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 o=e,n=t;for(let r in n)o[r]=ZE(o[r],n[r]);return e}return t}var Zv=0,Vv=1,eM=2,zv=3,hf=4,Xi=5,Kv=6,_c=7;function qv(e){return e.id===Zv}function tM(e){return e.id===eM}function M4(e){return(function(t){return t.id===Vv})(e)||ut(305,String(e.id),String(Vv)),Object.assign(e,{id:eM})}var A4=new Set,Qv=class{builder;configs;_dependency;_peerNameSet;extension;state;_signal;constructor(t,o){this.builder=t,this.extension=o,this.configs=new Set,this.state={id:Zv}}mergeConfigs(){let t=this.extension.config||{},o=this.extension.mergeConfig?this.extension.mergeConfig.bind(this.extension):sf;for(let n of this.configs)t=o(t,n);return t}init(t){let o=this.state;tM(o)||ut(306,String(o.id));let n={getDependency:this.getInitDependency.bind(this),getDirectDependentNames:this.getDirectDependentNames.bind(this),getPeer:this.getInitPeer.bind(this),getPeerNameSet:this.getPeerNameSet.bind(this)},r={...n,getDependency:this.getDependency.bind(this),getInitResult:this.getInitResult.bind(this),getPeer:this.getPeer.bind(this)},a=(function(i,d,c){return Object.assign(i,{config:d,id:zv,registerState:c})})(o,this.mergeConfigs(),n),s;this.state=a,this.extension.init&&(s=this.extension.init(t,a.config,n)),this.state=(function(i,d,c){return Object.assign(i,{id:hf,initResult:d,registerState:c})})(a,s,r)}build(t){let o=this.state,n;o.id!==hf&&ut(307,String(o.id),String(Xi)),this.extension.build&&(n=this.extension.build(t,o.config,o.registerState));let r={...o.registerState,getOutput:()=>n,getSignal:this.getSignal.bind(this)};this.state=(function(a,s,i){return Object.assign(a,{id:Xi,output:s,registerState:i})})(o,n,r)}register(t,o){this._signal=o;let n=this.state;n.id!==Xi&&ut(308,String(n.id),String(Xi));let r=this.extension.register&&this.extension.register(t,n.config,n.registerState);return this.state=(function(a){return Object.assign(a,{id:Kv})})(n),()=>{let a=this.state;a.id!==_c&&ut(309,String(n.id),String(_c)),this.state=(function(s){return Object.assign(s,{id:Xi})})(a),r&&r()}}afterRegistration(t){let o=this.state,n;return o.id!==Kv&&ut(310,String(o.id),String(Kv)),this.extension.afterRegistration&&(n=this.extension.afterRegistration(t,o.config,o.registerState)),this.state=(function(r){return Object.assign(r,{id:_c})})(o),n}getSignal(){return this._signal===void 0&&ut(311),this._signal}getInitResult(){this.extension.init===void 0&&ut(312,this.extension.name);let t=this.state;return(function(o){return o.id>=hf})(t)||ut(313,String(t.id),String(hf)),t.initResult}getInitPeer(t){let o=this.builder.extensionNameMap.get(t);return o?o.getExtensionInitDependency():void 0}getExtensionInitDependency(){let t=this.state;return(function(o){return o.id>=zv})(t)||ut(314,String(t.id),String(zv)),{config:t.config}}getPeer(t){let o=this.builder.extensionNameMap.get(t);return o?o.getExtensionDependency():void 0}getInitDependency(t){let o=this.builder.getExtensionRep(t);return o===void 0&&ut(315,this.extension.name,t.name),o.getExtensionInitDependency()}getDependency(t){let o=this.builder.getExtensionRep(t);return o===void 0&&ut(315,this.extension.name,t.name),o.getExtensionDependency()}getState(){let t=this.state;return(function(o){return o.id>=_c})(t)||ut(316,String(t.id),String(_c)),t}getDirectDependentNames(){return this.builder.incomingEdges.get(this.extension.name)||A4}getPeerNameSet(){let t=this._peerNameSet;return t||(t=new Set((this.extension.peerDependencies||[]).map(([o])=>o)),this._peerNameSet=t),t}getExtensionDependency(){if(!this._dependency){let t=this.state;(function(o){return o.id>=Xi})(t)||ut(317,this.extension.name),this._dependency={config:t.config,init:t.initResult,output:t.output}}return this._dependency}},$E={tag:zo};function N4(){let e=Ye();e.isEmpty()&&e.append(pn())}var oM=zt({config:Dn({setOptions:$E,updateOptions:$E}),init:({$initialEditorState:e=N4})=>({$initialEditorState:e,initialized:!1}),afterRegistration(e,{updateOptions:t,setOptions:o},n){let r=n.getInitResult();if(!r.initialized){r.initialized=!0;let{$initialEditorState:a}=r;if(QP(a))e.setEditorState(a,o);else if(typeof a=="function")e.update(()=>{a(e)},t);else if(a&&(typeof a=="string"||typeof a=="object")){let s=e.parseEditorState(a);e.setEditorState(s,o)}}return()=>{}},name:"@lexical/extension/InitialState",nodes:[NR,tf,LR,BR,ER]}),zE=Symbol.for("@lexical/extension/LexicalBuilder");function D4(...e){return Zi.fromExtensions(e).buildEditor()}function KE(){}function _4(e){throw e}function yf(e){return Array.isArray(e)?e:[e]}var Wv="0.41.0+prod.esm",Zi=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=Wv,this.roots=t;for(let o of t)this.addExtension(o)}static fromExtensions(t){let o=[yf(oM)];for(let n of t)o.push(yf(n));return new e(o)}static maybeFromEditor(t){let o=t[zE];return o&&(o.PACKAGE_VERSION!==Wv&&ut(292,o.PACKAGE_VERSION,Wv),o instanceof e||ut(293)),o}static fromEditor(t){let o=e.maybeFromEditor(t);return o===void 0&&ut(294),o}constructEditor(){let{$initialEditorState:t,onError:o,...n}=this.buildCreateEditorArgs(),r=Object.assign(nf({...n,...o?{onError:a=>{o(a,r)}}:{}}),{[zE]:this});for(let a of this.sortedExtensionReps())a.build(r);return r}buildEditor(){let t=KE;function o(){try{t()}finally{t=KE}}let n=Object.assign(this.constructEditor(),{dispose:o,[Symbol.dispose]:o});return t=rr(this.registerEditor(n),()=>n.setRootElement(null)),n}hasExtensionByName(t){return this.extensionNameMap.has(t)}getExtensionRep(t){let o=this.extensionNameMap.get(t.name);if(o)return o.extension!==t&&ut(295,t.name),o}addEdge(t,o,n){let r=this.outgoingConfigEdges.get(t);r?r.set(o,n):this.outgoingConfigEdges.set(t,new Map([[o,n]]));let a=this.incomingEdges.get(o);a?a.add(t):this.incomingEdges.set(o,new Set([t]))}addExtension(t){this._sortedExtensionReps!==void 0&&ut(296);let o=yf(t),[n]=o;typeof n.name!="string"&&ut(297,typeof n.name);let r=this.extensionNameMap.get(n.name);if(r!==void 0&&r.extension!==n&&ut(298,n.name),!r){r=new Qv(this,n),this.extensionNameMap.set(n.name,r);let a=this.conflicts.get(n.name);typeof a=="string"&&ut(299,n.name,a);for(let s of n.conflictsWith||[])this.extensionNameMap.has(s)&&ut(299,n.name,s),this.conflicts.set(s,n.name);for(let s of n.dependencies||[]){let i=yf(s);this.addEdge(n.name,i[0].name,i.slice(1)),this.addExtension(i)}for(let[s,i]of n.peerDependencies||[])this.addEdge(n.name,s,i?[i]:[])}}sortedExtensionReps(){if(this._sortedExtensionReps)return this._sortedExtensionReps;let t=[],o=(n,r)=>{let a=n.state;if(tM(a))return;let s=n.extension.name;var i;qv(a)||ut(300,s,r||"[unknown]"),qv(i=a)||ut(304,String(i.id),String(Zv)),a=Object.assign(i,{id:Vv}),n.state=a;let d=this.outgoingConfigEdges.get(s);if(d)for(let c of d.keys()){let u=this.extensionNameMap.get(c);u&&o(u,s)}a=M4(a),n.state=a,t.push(n)};for(let n of this.extensionNameMap.values())qv(n.state)&&o(n);for(let n of t)for(let[r,a]of this.outgoingConfigEdges.get(n.extension.name)||[])if(a.length>0){let s=this.extensionNameMap.get(r);if(s)for(let i of a)s.configs.add(i)}for(let[n,...r]of this.roots)if(r.length>0){let a=this.extensionNameMap.get(n.name);a===void 0&&ut(301,n.name);for(let s of r)a.configs.add(s)}return this._sortedExtensionReps=t,this._sortedExtensionReps}registerEditor(t){let o=this.sortedExtensionReps(),n=new AbortController,r=[()=>n.abort()],a=n.signal;for(let s of o){let i=s.register(t,a);i&&r.push(i)}for(let s of o){let i=s.afterRegistration(t);i&&r.push(i)}return rr(...r)}buildCreateEditorArgs(){let t={},o=new Set,n=new Map,r=new Map,a={},s={},i=this.sortedExtensionReps();for(let u of i){let{extension:m}=u;if(m.onError!==void 0&&(t.onError=m.onError),m.disableEvents!==void 0&&(t.disableEvents=m.disableEvents),m.parentEditor!==void 0&&(t.parentEditor=m.parentEditor),m.editable!==void 0&&(t.editable=m.editable),m.namespace!==void 0&&(t.namespace=m.namespace),m.$initialEditorState!==void 0&&(t.$initialEditorState=m.$initialEditorState),m.nodes)for(let p of YE(m)){if(typeof p!="function"){let f=n.get(p.replace);f&&ut(302,m.name,p.replace.name,f.extension.name),n.set(p.replace,u)}o.add(p)}if(m.html){if(m.html.export)for(let[p,f]of m.html.export.entries())r.set(p,f);m.html.import&&Object.assign(a,m.html.import)}m.theme&&ZE(s,m.theme)}Object.keys(s).length>0&&(t.theme=s),o.size&&(t.nodes=[...o]);let d=Object.keys(a).length>0,c=r.size>0;(d||c)&&(t.html={},d&&(t.html.import=a),c&&(t.html.export=r));for(let u of i)u.init(t);return t.onError||(t.onError=_4),t}};function O4(e,t){let o=Zi.fromEditor(e).getExtensionRep(t);return o===void 0&&ut(303,t.name),o.getExtensionDependency()}function nM(e,t){let o=Zi.fromEditor(e).extensionNameMap.get(t);return o?o.getExtensionDependency():void 0}function F4(e,t){let o=nM(e,t);return o===void 0&&ut(291,t),o}var B4=new Set,Xv=zt({build(e,t,o){let n=o.getDependency(Cf).output,r=Ji({watchedNodeKeys:new Map}),a=Jv(()=>{},()=>wa(()=>{let s=a.peek(),{watchedNodeKeys:i}=r.value,d,c=!1;n.value.read(()=>{if(Te())for(let[u,m]of i.entries()){if(m.size===0){i.delete(u);continue}let p=Ca(u),f=p&&p.isSelected()||!1;c=c||f!==(!!s&&s.has(u)),f&&(d=d||new Set,d.add(u))}}),!c&&d&&s&&d.size===s.size||(a.value=d)}));return{watchNodeKey:function(s){let i=jE(()=>(a.value||B4).has(s)),{watchedNodeKeys:d}=r.peek(),c=d.get(s),u=c!==void 0;return c=c||new Set,c.add(i),u||(d.set(s,c),r.value={watchedNodeKeys:d}),i}}},dependencies:[Cf],name:"@lexical/extension/NodeSelection"}),H4=UR("INSERT_HORIZONTAL_RULE_COMMAND"),Is=class e extends xa{static getType(){return"horizontalrule"}static clone(t){return new e(t.__key)}static importJSON(t){return eC().updateFromJSON(t)}static importDOM(){return{hr:()=>({conversion:U4,priority:0})}}exportDOM(){return{element:document.createElement("hr")}}createDOM(t){let o=document.createElement("hr");return Ac(o,t.theme.hr),o}getTextContent(){return`
3563
+ `}isInline(){return!1}updateDOM(){return!1}};function U4(){return{node:eC()}}function eC(){return HP(Is)}function rM(e){return e instanceof Is}var $4=zt({dependencies:[Cf,Xv],name:"@lexical/extension/HorizontalRule",nodes:()=>[Is],register(e,t,o){let{watchNodeKey:n}=o.getDependency(Xv).output,r=Ji({nodeSelections:new Map}),a=e._config.theme.hrSelected??"selected";return rr(e.registerCommand(dR,s=>{if(jR(s.target)){let i=jP(s.target);if(rM(i))return(function(d,c=!1){let u=Te(),m=d.isSelected(),p=d.getKey(),f;c&&pv(u)?f=u:(f=UP(),mn(f)),m?f.delete(p):f.add(p)})(i,s.shiftKey),!0}return!1},Qi),e.registerMutationListener(Is,(s,i)=>{qE(()=>{let d=!1,{nodeSelections:c}=r.peek();for(let[u,m]of s.entries())if(m==="destroyed")c.delete(u),d=!0;else{let p=c.get(u),f=e.getElementByKey(u);p?p.domNode.value=f:(d=!0,c.set(u,{domNode:Ji(f),selectedSignal:n(u)}))}d&&(r.value={nodeSelections:c})})}),wa(()=>{let s=[];for(let{domNode:i,selectedSignal:d}of r.value.nodeSelections.values())s.push(wa(()=>{let c=i.value;c&&(d.value?Ac(c,a):af(c,a))}));return rr(...s)}))}});function aM(e){return e.canBeEmpty()}function sM(e,t,o=aM){return rr(e.registerCommand(Zm,n=>{let r=Te();if(!ye(r))return!1;n.preventDefault();let a=(function(s){if(s.getNodes().filter(p=>Vi(p)&&p.canIndent()).length>0)return!0;let i=s.anchor,d=s.focus,c=d.isBefore(i)?d:i,u=c.getNode(),m=EE(u);if(m.canIndent()){let p=m.getKey(),f=Cs();if(f.anchor.set(p,0,"element"),f.focus.set(p,0,"element"),f=tR(f),f.anchor.is(c))return!0}return!1})(r)?n.shiftKey?PR:gv:wR;return e.dispatchCommand(a,void 0)},vt),e.registerCommand(gv,()=>{let n=typeof t=="number"?t:t?t.peek():null,r=Te();if(!ye(r))return!1;let a=typeof o=="function"?o:o.peek();return ME(s=>{if(a(s)){let i=s.getIndent()+1;(!n||i<n)&&s.setIndent(i)}})},qm))}var z4=zt({build:(e,t,o)=>bf(t),config:Dn({$canIndent:aM,disabled:!1,maxIndent:null}),name:"@lexical/extension/TabIndentation",register(e,t,o){let{disabled:n,maxIndent:r,$canIndent:a}=o.getOutput();return wa(()=>{if(!n.value)return sM(e,r,a)})}});var Qe=tC,Npe=Qe.$createHorizontalRuleNode,Dpe=Qe.$isDecoratorTextNode,_pe=Qe.$isHorizontalRuleNode,Ope=Qe.AutoFocusExtension,Fpe=Qe.ClearEditorExtension,Bpe=Qe.DecoratorTextExtension,Hpe=Qe.DecoratorTextNode,Upe=Qe.EditorStateExtension,$pe=Qe.HorizontalRuleExtension,zpe=Qe.HorizontalRuleNode,Kpe=Qe.INSERT_HORIZONTAL_RULE_COMMAND,qpe=Qe.InitialStateExtension,iM=Qe.LexicalBuilder,Wpe=Qe.NodeSelectionExtension,Gpe=Qe.TabIndentationExtension,jpe=Qe.applyFormatFromStyle,Vpe=Qe.applyFormatToDom,lM=Qe.batch,Qpe=Qe.buildEditorFromExtensions,Xpe=Qe.computed,Ype=Qe.configExtension,Jpe=Qe.declarePeerDependency,Zpe=Qe.defineExtension,Bc=Qe.effect,eme=Qe.getExtensionDependencyFromEditor,tme=Qe.getKnownTypesAndNodes,dM=Qe.getPeerDependencyFromEditor,ome=Qe.getPeerDependencyFromEditorOrThrow,wf=Qe.namedSignals,nme=Qe.registerClearEditor,rme=Qe.registerTabIndentation,ame=Qe.safeCast,sme=Qe.shallowMergeConfig,ime=Qe.signal,lme=Qe.untracked,dme=Qe.watchedSignal;var oC={};Ut(oC,{HistoryExtension:()=>Tf,SharedHistoryExtension:()=>W4,createEmptyHistoryState:()=>pM,registerHistory:()=>uM});function K4(e,t,o,n,r){if(e===null||o.size===0&&n.size===0&&!r)return 0;let a=t._selection,s=e._selection;if(r)return 1;if(!(ye(a)&&ye(s)&&s.isCollapsed()&&a.isCollapsed()))return 0;let i=(function(x,C,b){let L=x._nodeMap,w=[];for(let k of C){let I=L.get(k);I!==void 0&&w.push(I)}for(let[k,I]of b){if(!I)continue;let T=L.get(k);T===void 0||Pc(T)||w.push(T)}return w})(t,o,n);if(i.length===0)return 0;if(i.length>1){let x=t._nodeMap,C=x.get(a.anchor.key),b=x.get(s.anchor.key);return C&&b&&!e._nodeMap.has(C.__key)&&Ke(C)&&C.__text.length===1&&a.anchor.offset===1?2:0}let d=i[0],c=e._nodeMap.get(d.__key);if(!Ke(c)||!Ke(d)||c.__mode!==d.__mode)return 0;let u=c.__text,m=d.__text;if(u===m)return 0;let p=a.anchor,f=s.anchor;if(p.key!==f.key||p.type!=="text")return 0;let g=p.offset,h=f.offset,y=m.length-u.length;return y===1&&h===g-1?2:y===-1&&h===g+1?3:y===-1&&h===g?4:0}function q4(e,t){let o=Date.now(),n=0,r=Date.now(),a=0,s=null;return(i,d,c,u,m,p)=>{let f=Date.now();if(p.has(uR)&&(r=o,a=n,s=i),p.has(jm))return n=0,o=f,2;p.has(cR)&&s&&(o=r,n=a,i=s);let g=K4(i,d,u,m,e.isComposing()),h=(()=>{let y=c===null||c.editor===e,x=p.has(xR);if(!x&&y&&p.has(zo))return 0;if(g===1)return 2;if(i===null)return 1;let C=d._selection;if(!(u.size>0||m.size>0))return C!==null?0:2;let b=typeof t=="number"?t:t.peek();return x===!1&&g!==0&&g===n&&f<o+b&&y||u.size===1&&(function(L,w,k){let I=w._nodeMap.get(L),T=k._nodeMap.get(L),S=w._selection,P=k._selection;return!(ye(S)&&ye(P)&&S.anchor.type==="element"&&S.focus.type==="element"&&P.anchor.type==="text"&&P.focus.type==="text"||!Ke(I)||!Ke(T)||I.__parent!==T.__parent)&&JSON.stringify(w.read(()=>I.exportJSON()))===JSON.stringify(k.read(()=>T.exportJSON()))})(Array.from(u)[0],i,d)?0:1})();return o=f,n=g,h}}function cM(e){e.undoStack=[],e.redoStack=[],e.current=null}function uM(e,t,o){let n=q4(e,o);return Nr(e.registerCommand(HR,()=>((function(a,s){let i=s.redoStack,d=s.undoStack;if(d.length!==0){let c=s.current,u=d.pop();c!==null&&(i.push(c),a.dispatchCommand(Rc,!0)),d.length===0&&a.dispatchCommand(Ec,!1),s.current=u||null,u&&u.editor.setEditorState(u.editorState,{tag:jm})}})(e,t),!0),vt),e.registerCommand(MR,()=>((function(a,s){let i=s.redoStack,d=s.undoStack;if(i.length!==0){let c=s.current;c!==null&&(d.push(c),a.dispatchCommand(Ec,!0));let u=i.pop();i.length===0&&a.dispatchCommand(Rc,!1),s.current=u||null,u&&u.editor.setEditorState(u.editorState,{tag:jm})}})(e,t),!0),vt),e.registerCommand(Km,()=>(cM(t),!1),vt),e.registerCommand(lR,()=>(cM(t),e.dispatchCommand(Rc,!1),e.dispatchCommand(Ec,!1),!0),vt),e.registerUpdateListener(({editorState:a,prevEditorState:s,dirtyLeaves:i,dirtyElements:d,tags:c})=>{let u=t.current,m=t.redoStack,p=t.undoStack,f=u===null?null:u.editorState;if(u!==null&&a===f)return;let g=n(s,a,u,i,d,c);if(g===1)m.length!==0&&(t.redoStack=[],e.dispatchCommand(Rc,!1)),u!==null&&(p.push({...u}),e.dispatchCommand(Ec,!0));else if(g===2)return;t.current={editor:e,editorState:a}}))}function pM(){return{current:null,redoStack:[],undoStack:[]}}var Tf=zt({build:(e,{delay:t,createInitialHistoryState:o,disabled:n})=>wf({delay:t,disabled:n,historyState:o(e)}),config:Dn({createInitialHistoryState:pM,delay:300,disabled:typeof window>"u"}),name:"@lexical/history/History",register:(e,t,o)=>{let n=o.getOutput();return Bc(()=>n.disabled.value?void 0:uM(e,n.historyState.value,n.delay))}}),W4=zt({dependencies:[of(Tf,{createInitialHistoryState:()=>{throw new Error("SharedHistory did not inherit parent history")},disabled:!0})],name:"@lexical/history/SharedHistory",register(e,t,o){let{output:n}=o.getDependency(Tf),r=(function(s){return s?dM(s,Tf.name):null})(e._parentEditor);if(!r)return()=>{};let a=r.output;return Bc(()=>lM(()=>{n.delay.value=a.delay.value,n.historyState.value=a.historyState.value,n.disabled.value=a.disabled.value}))}});var If=oC,fme=If.HistoryExtension,gme=If.SharedHistoryExtension,Sf=If.createEmptyHistoryState,mM=If.registerHistory;var nC={};Ut(nC,{HistoryPlugin:()=>G4,createEmptyHistoryState:()=>Sf});$();function G4({delay:e,externalHistoryState:t}){let[o]=ct();return(function(n,r,a=1e3){let s=W(()=>r||Sf(),[r]);H(()=>mM(n,s,a),[a,n,s])})(o,t,e),null}var fM=nC,gM=fM.HistoryPlugin,hM=fM.createEmptyHistoryState;var rC={};Ut(rC,{OnChangePlugin:()=>V4});$();var j4=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?fe:H;function V4({ignoreHistoryMergeTagChange:e=!0,ignoreSelectionChange:t=!1,onChange:o}){let[n]=ct();return j4(()=>{if(o)return n.registerUpdateListener(({editorState:r,dirtyElements:a,dirtyLeaves:s,prevEditorState:i,tags:d})=>{t&&a.size===0&&s.size===0||e&&d.has(zo)||i.isEmpty()||o(r,n,d)})},[n,e,t,o]),null}var Q4=rC,yM=Q4.OnChangePlugin;var aC={};Ut(aC,{useLexicalEditable:()=>J4});$();var X4=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?fe:H;function Y4(e){return{initialValueFn:()=>e.isEditable(),subscribe:t=>e.registerEditableListener(t)}}function J4(){return(function(e){let[t]=ct(),o=W(()=>e(t),[t,e]),[n,r]=q(()=>o.initialValueFn()),a=E(n);return X4(()=>{let{initialValueFn:s,subscribe:i}=o,d=s();return a.current!==d&&(a.current=d,r(d)),i(c=>{a.current=c,r(c)})},[o,e]),n})(Y4)}var Z4=aC,kf=Z4.useLexicalEditable;var sC={};Ut(sC,{ReactProviderExtension:()=>e3});var e3=zt({name:"@lexical/react/ReactProvider"});var t3=sC,vM=t3.ReactProviderExtension;var iC={};Ut(iC,{DragonExtension:()=>o3,registerDragonSupport:()=>CM});function CM(e){let t=window.location.origin,o=n=>{if(n.origin!==t)return;let r=e.getRootElement();if(document.activeElement!==r)return;let a=n.data;if(typeof a=="string"){let s;try{s=JSON.parse(a)}catch{return}if(s&&s.protocol==="nuanria_messaging"&&s.type==="request"){let i=s.payload;if(i&&i.functionId==="makeChanges"){let d=i.args;if(d){let[c,u,m,p,f]=d;e.update(()=>{let g=Te();if(ye(g)){let h=g.anchor,y=h.getNode(),x=0,C=0;if(Ke(y)&&c>=0&&u>=0&&(x=c,C=c+u,g.setTextNodeRange(y,x,y,C)),x===C&&m===""||(g.insertRawText(m),y=h.getNode()),Ke(y)){x=p,C=p+f;let b=y.getTextContentSize();x=x>b?b:x,C=C>b?b:C,g.setTextNodeRange(y,x,y,C)}n.stopImmediatePropagation()}})}}}}};return window.addEventListener("message",o,!0),()=>{window.removeEventListener("message",o,!0)}}var o3=zt({build:(e,t,o)=>wf(t),config:Dn({disabled:typeof window>"u"}),name:"@lexical/dragon",register:(e,t,o)=>Bc(()=>o.getOutput().disabled.value?void 0:CM(e))});var xM=iC,bM=xM.DragonExtension,wM=xM.registerDragonSupport;var lC={};Ut(lC,{$generateHtmlFromNodes:()=>r3,$generateNodesFromDOM:()=>n3});function n3(e,t){let o=GR(t)?t.body.childNodes:t.childNodes,n=[],r=[];for(let a of o)if(!IM.has(a.nodeName)){let s=SM(a,e,r,!1);s!==null&&(n=n.concat(s))}return(function(a){for(let s of a)s.getNextSibling()instanceof fv&&s.insertAfter(vs());for(let s of a){let i=s.getChildren();for(let d of i)s.insertBefore(d);s.remove()}})(r),n}function r3(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 o=document.createElement("div"),n=Ye().getChildren();for(let r=0;r<n.length;r++)TM(e,n[r],o,t);return o.innerHTML}function TM(e,t,o,n=null){let r=n===null||t.isSelected(n),a=_e(t)&&t.excludeFromCopy("html"),s=t;n!==null&&Ke(t)&&(s=mf(n,t,"clone"));let i=_e(s)?s.getChildren():[],d=qR(e,s.getType()),c;c=d&&d.exportDOM!==void 0?d.exportDOM(e,s):s.exportDOM(e);let{element:u,after:m}=c;if(!u)return!1;let p=document.createDocumentFragment();for(let f=0;f<i.length;f++){let g=i[f],h=TM(e,g,p,n);!r&&_e(t)&&h&&t.extractWithChild(g,n,"html")&&(r=!0)}if(r&&!a){if((AE(u)||Cv(u))&&u.append(p),o.append(u),m){let f=m.call(s,u);f&&(Cv(u)?u.replaceChildren(f):u.replaceWith(f))}}else o.append(p);return r}var IM=new Set(["STYLE","SCRIPT"]);function SM(e,t,o,n,r=new Map,a){let s=[];if(IM.has(e.nodeName))return s;let i=null,d=(function(g,h){let{nodeName:y}=g,x=h._htmlConversions.get(y.toLowerCase()),C=null;if(x!==void 0)for(let b of x){let L=b(g);L!==null&&(C===null||(C.priority||0)<=(L.priority||0))&&(C=L)}return C!==null?C.conversion:null})(e,t),c=d?d(e):null,u=null;if(c!==null){u=c.after;let g=c.node;if(i=Array.isArray(g)?g[g.length-1]:g,i!==null){for(let[,h]of r)if(i=h(i,a),!i)break;i&&s.push(...Array.isArray(g)?g:[i])}c.forChild!=null&&r.set(e.nodeName,c.forChild)}let m=e.childNodes,p=[],f=(i==null||!bs(i))&&(i!=null&&Vi(i)||n);for(let g=0;g<m.length;g++)p.push(...SM(m[g],t,o,f,new Map(r),i));return u!=null&&(p=u(p)),Fv(e)&&(p=a3(e,p,f?()=>{let g=new fv;return o.push(g),g}:pn)),i==null?p.length>0?s=s.concat(p):Fv(e)&&(function(g){return g.nextSibling==null||g.previousSibling==null?!1:Nc(g.nextSibling)&&Nc(g.previousSibling)})(e)&&(s=s.concat(vs())):_e(i)&&i.append(...p),s}function a3(e,t,o){let n=e.style.textAlign,r=[],a=[];for(let s=0;s<t.length;s++){let i=t[s];if(Vi(i))n&&!i.getFormat()&&i.setFormat(n),r.push(i);else if(a.push(i),s===t.length-1||s<t.length-1&&Vi(t[s+1])){let d=o();d.setFormat(n),d.append(...a),r.push(d),a=[]}}return r}var kM=lC,LM=kM.$generateHtmlFromNodes,PM=kM.$generateNodesFromDOM;var cC={};Ut(cC,{$generateJSONFromSelectedNodes:()=>NM,$generateNodesFromSerializedNodes:()=>DM,$getClipboardDataFromSelection:()=>OM,$getHtmlContent:()=>EM,$getLexicalContent:()=>MM,$insertDataTransferForPlainText:()=>s3,$insertDataTransferForRichText:()=>i3,$insertGeneratedNodes:()=>dC,copyToClipboard:()=>l3,setLexicalClipboardDataTransfer:()=>FM});function Lf(e,...t){let o=new URL("https://lexical.dev/docs/error"),n=new URLSearchParams;n.append("code",e);for(let r of t)n.append("v",r);throw o.search=n.toString(),Error(`Minified Lexical error #${e}; visit ${o.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function EM(e,t=Te()){return t==null&&Lf(166),ye(t)&&t.isCollapsed()||t.getNodes().length===0?"":LM(e,t)}function MM(e,t=Te()){return t==null&&Lf(166),ye(t)&&t.isCollapsed()||t.getNodes().length===0?null:JSON.stringify(NM(e,t))}function s3(e,t){let o=e.getData("text/plain")||e.getData("text/uri-list");o!=null&&t.insertRawText(o)}function i3(e,t,o){let n=e.getData("application/x-lexical-editor");if(n)try{let i=JSON.parse(n);if(i.namespace===o._config.namespace&&Array.isArray(i.nodes))return dC(o,DM(i.nodes),t)}catch(i){console.error(i)}let r=e.getData("text/html"),a=e.getData("text/plain");if(r&&a!==r)try{let i=new DOMParser().parseFromString((function(d){return window.trustedTypes&&window.trustedTypes.createPolicy?window.trustedTypes.createPolicy("lexical",{createHTML:c=>c}).createHTML(d):d})(r),"text/html");return dC(o,PM(o,i),t)}catch(i){console.error(i)}let s=a||e.getData("text/uri-list");if(s!=null)if(ye(t)){let i=s.split(/(\r?\n|\t)/);i[i.length-1]===""&&i.pop();for(let d=0;d<i.length;d++){let c=Te();if(ye(c)){let u=i[d];u===`
3564
3564
  `||u===`\r
3565
- `?c.insertParagraph():u===" "?c.insertNodes([UP()]):c.insertText(u)}}}else t.insertRawText(s)}function dC(e,t,o){e.dispatchCommand(AR,{nodes:t,selection:o})||(o.insertNodes(t),(function(n){if(ye(n)&&n.isCollapsed()){let r=n.anchor,a=null,s=ji(r,"previous");if(s)if(Um(s))a=s.origin;else{let i=zP(s,va(Ye(),"next").getFlipped());for(let d of i){if(Ke(d.origin)){a=d.origin;break}if(_e(d.origin)&&!d.origin.isInline())break}}if(a&&Ke(a)){let i=a.getFormat(),d=a.getStyle();n.format===i&&n.style===d||(n.format=i,n.style=d,n.dirty=!0)}}})(o))}function EM(e,t,o,n=[]){let r=t===null||o.isSelected(t),a=_e(o)&&o.excludeFromCopy("html"),s=o;t!==null&&Ke(s)&&(s=mf(t,s,"clone"));let i=_e(s)?s.getChildren():[],d=(function(c){let u=c.exportJSON(),m=c.constructor;if(u.type!==m.getType()&&Lf(58,m.name),_e(c)){let p=u.children;Array.isArray(p)||Lf(59,m.name)}return u})(s);Ke(s)&&s.getTextContentSize()===0&&(r=!1);for(let c=0;c<i.length;c++){let u=i[c],m=EM(e,t,u,d.children);!r&&_e(o)&&m&&o.extractWithChild(u,t,"clone")&&(r=!0)}if(r&&!a)n.push(d);else if(Array.isArray(d.children))for(let c=0;c<d.children.length;c++){let u=d.children[c];n.push(u)}return r}function MM(e,t){let o=[],n=Ye().getChildren();for(let r=0;r<n.length;r++)EM(e,t,n[r],o);return{namespace:e._config.namespace,nodes:o}}function AM(e){let t=[];for(let o=0;o<e.length;o++){let n=e[o],r=eR(n);Ke(r)&&cE(r),t.push(r)}return t}var el=null;async function a3(e,t,o){if(el!==null)return!1;if(t!==null)return new Promise((c,u)=>{e.update(()=>{c(LM(e,t,o))})});let n=e.getRootElement(),r=e._window||window,a=r.document,s=vv(r);if(n===null||s===null)return!1;let i=a.createElement("span");i.style.cssText="position: fixed; top: -1000px;",i.append(a.createTextNode("#")),n.append(i);let d=new Range;return d.setStart(i,0),d.setEnd(i,1),s.removeAllRanges(),s.addRange(d),new Promise((c,u)=>{let m=e.registerCommand(Wm,p=>(Dc(p,ClipboardEvent)&&(m(),el!==null&&(r.clearTimeout(el),el=null),c(LM(e,p,o))),!0),qm);el=r.setTimeout(()=>{m(),el=null,c(!1)},50),a.execCommand("copy"),i.remove()})}function LM(e,t,o){if(o===void 0){let r=vv(e._window),a=Te();if(!a||a.isCollapsed()||!r)return!1;let s=r.anchorNode,i=r.focusNode;if(s!==null&&i!==null&&!jR(e,s,i))return!1;o=DM(a)}t.preventDefault();let n=t.clipboardData;return n!==null&&(_M(n,o),!0)}var NM=[["text/html",PM],["application/x-lexical-editor",RM]];function DM(e=Te()){let t={"text/plain":e?e.getTextContent():""};if(e){let o=Fm();for(let[n,r]of NM){let a=r(o,e);a!==null&&(t[n]=a)}}return t}function _M(e,t){for(let[o]of NM)t[o]===void 0&&e.setData(o,"");for(let o in t){let n=t[o];n!==void 0&&e.setData(o,n)}}var sr=cC,Hme=sr.$generateJSONFromSelectedNodes,Ume=sr.$generateNodesFromSerializedNodes,$me=sr.$getClipboardDataFromSelection,OM=sr.$getHtmlContent,zme=sr.$getLexicalContent,uC=sr.$insertDataTransferForPlainText,Kme=sr.$insertDataTransferForRichText,qme=sr.$insertGeneratedNodes,Wme=sr.copyToClipboard,Gme=sr.setLexicalClipboardDataTransfer;var pC={};Ut(pC,{PlainTextExtension:()=>p3,registerPlainText:()=>HM});var Ss=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,s3=Ss&&"documentMode"in document?document.documentMode:null,i3=Ss&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),l3=!(!Ss||!("InputEvent"in window)||s3)&&"getTargetRanges"in new window.InputEvent("input"),d3=Ss&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),FM=Ss&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,c3=Ss&&/^(?=.*Chrome).*/i.test(navigator.userAgent),u3=Ss&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&i3&&!c3;function BM(e,t){t.update(()=>{if(e!==null){let o=Dc(e,KeyboardEvent)?null:e.clipboardData,n=Te();if(n!==null&&!n.isCollapsed()&&o!=null){e.preventDefault();let r=OM(t);r!==null&&o.setData("text/html",r),o.setData("text/plain",n.getTextContent())}}})}function HM(e){return Nr(e.registerCommand(Gm,t=>{let o=Te();return!!ye(o)&&(o.deleteCharacter(t),!0)},vt),e.registerCommand(mR,t=>{let o=Te();return!!ye(o)&&(o.deleteWord(t),!0)},vt),e.registerCommand(pR,t=>{let o=Te();return!!ye(o)&&(o.deleteLine(t),!0)},vt),e.registerCommand(cR,t=>{let o=Te();if(!ye(o))return!1;if(typeof t=="string")o.insertText(t);else{let n=t.dataTransfer;if(n!=null)uC(n,o);else{let r=t.data;r&&o.insertText(r)}}return!0},vt),e.registerCommand(ER,()=>{let t=Te();return!!ye(t)&&(t.removeText(),!0)},vt),e.registerCommand(hv,t=>{let o=Te();return!!ye(o)&&(o.insertLineBreak(t),!0)},vt),e.registerCommand(CR,()=>{let t=Te();return!!ye(t)&&(t.insertLineBreak(),!0)},vt),e.registerCommand(Vm,t=>{let o=Te();if(!ye(o))return!1;let n=t,r=n.shiftKey;return!!Av(o,!0)&&(n.preventDefault(),Mv(o,r,!0),!0)},vt),e.registerCommand(Qm,t=>{let o=Te();if(!ye(o))return!1;let n=t,r=n.shiftKey;return!!Av(o,!1)&&(n.preventDefault(),Mv(o,r,!1),!0)},vt),e.registerCommand(Xm,t=>{let o=Te();return!!ye(o)&&(!FM||navigator.language!=="ko-KR")&&(t.preventDefault(),e.dispatchCommand(Gm,!0))},vt),e.registerCommand(Ym,t=>{let o=Te();return!!ye(o)&&(t.preventDefault(),e.dispatchCommand(Gm,!1))},vt),e.registerCommand(Jm,t=>{let o=Te();if(!ye(o))return!1;if(t!==null){if((FM||d3||u3)&&l3)return!1;t.preventDefault()}return e.dispatchCommand(hv,!1)},vt),e.registerCommand(NR,()=>($m(),!0),vt),e.registerCommand(Wm,t=>{let o=Te();return!!ye(o)&&(BM(t,e),!0)},vt),e.registerCommand(uR,t=>{let o=Te();return!!ye(o)&&((function(n,r){BM(n,r),r.update(()=>{let a=Te();ye(a)&&a.removeText()})})(t,e),!0)},vt),e.registerCommand(ef,t=>{let o=Te();return!!ye(o)&&((function(n,r){n.preventDefault(),r.update(()=>{let a=Te(),s=Dc(n,ClipboardEvent)?n.clipboardData:null;s!=null&&ye(a)&&uC(s,a)},{tag:LR})})(t,e),!0)},vt),e.registerCommand(gR,t=>{let o=Te();return!!ye(o)&&(t.preventDefault(),!0)},vt),e.registerCommand(fR,t=>{let o=Te();return!!ye(o)&&(t.preventDefault(),!0)},vt))}var p3=zt({conflictsWith:["@lexical/rich-text"],dependencies:[CM],name:"@lexical/plain-text",register:HM});var UM=pC,Zme=UM.PlainTextExtension,$M=UM.registerPlainText;var fC={};Ut(fC,{PlainTextPlugin:()=>h3});$();var Pf=Px(yh(),1);function m3(e,...t){let o=new URL("https://lexical.dev/docs/error"),n=new URLSearchParams;n.append("code",e);for(let r of t)n.append("v",r);throw o.search=n.toString(),Error(`Minified Lexical error #${e}; visit ${o.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var mC=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?fe:H;function f3({editor:e,ErrorBoundary:t}){return(function(o,n){let[r,a]=q(()=>o.getDecorators());return mC(()=>o.registerDecoratorListener(s=>{(0,Pf.flushSync)(()=>{a(s)})}),[o]),H(()=>{a(o.getDecorators())},[o]),W(()=>{let s=[],i=Object.keys(r);for(let d=0;d<i.length;d++){let c=i[d],u=l(n,{onError:p=>o._onError(p),children:l(Cg,{fallback:null,children:r[c]})}),m=o.getElementByKey(c);m!==null&&s.push((0,Pf.createPortal)(u,m,c))}return s},[n,r,o])})(e,t)}function g3({editor:e,ErrorBoundary:t}){return(function(o){let n=aM.maybeFromEditor(o);if(n&&n.hasExtensionByName(hM.name)){for(let r of["@lexical/plain-text","@lexical/rich-text"])n.hasExtensionByName(r)&&m3(320,r);return!0}return!1})(e)?null:l(f3,{editor:e,ErrorBoundary:t})}function zM(e){return e.getEditorState().read(df(e.isComposing()))}function h3({contentEditable:e,placeholder:t=null,ErrorBoundary:o}){let[n]=ct();return(function(r){mC(()=>Nr($M(r),xM(r)),[r])})(n),v(oe,{children:[e,l(y3,{content:t}),l(g3,{editor:n,ErrorBoundary:o})]})}function y3({content:e}){let[t]=ct(),o=(function(r){let[a,s]=q(()=>zM(r));return mC(()=>{function i(){let d=zM(r);s(d)}return i(),Nr(r.registerUpdateListener(()=>{i()}),r.registerEditableListener(()=>{i()}))},[r]),a})(t),n=kf();return o?typeof e=="function"?e(n):e:null}var v3=fC,KM=v3.PlainTextPlugin;$();var C3=/(^|\s)@(?:"((?:\\.|[^"\\])*)"|([^\s@"]+))(?=\s)/g,x3=512,b3=new RegExp(`(^|\\s)\\[((?:\\\\.|[^\\]\\\\]){0,${x3}})\\]\\(([^)\\s]+)\\)(?=\\s)`,"g"),w3=/^[A-Za-z][A-Za-z0-9+.-]*:/,T3=/^[A-Za-z]:[\\/]/,I3=/^[a-z0-9][a-z0-9._-]*\/[a-z0-9][a-z0-9._-]*(?:\/[^\s@"]+)*$/;function S3(e){let t=[];for(let o of e.matchAll(b3)){let n=o[0],r=o[1]??"",a=(o[2]??"").replace(/\\(.)/g,"$1"),s=o[3]??"",i=s;try{i=decodeURIComponent(s)}catch{}let d=Math.max(i.lastIndexOf("/"),i.lastIndexOf("\\")),c=d>=0?i.slice(d+1):i,u=w3.test(i)&&!T3.test(i);if(!i||u||a!==c)continue;let m=(o.index??0)+r.length,p=m+n.length-r.length;t.push({type:"mention",value:i,source:e.slice(m,p),start:m,end:p})}for(let o of e.matchAll(C3)){let n=o[0],r=o[1]??"",a=o[2],s=a!==void 0?a.replace(/\\(.)/g,"$1"):o[3]??"";if(!s||a===void 0&&I3.test(s))continue;let i=(o.index??0)+r.length,d=i+n.length-r.length;t.push({type:"mention",value:s,source:e.slice(i,d),start:i,end:d})}return t}function Hc(e,t={}){let o=S3(e);for(let n of jg(e))n.sigil!=="$"||n.end>=e.length||o.push({type:"skill",value:n.name,source:e.slice(n.start,n.end),start:n.start,end:n.end});for(let n of t.preserveTrailingFrom??[])n.end===e.length&&e.slice(n.start,n.end)===n.source&&!o.some(r=>r.type===n.type&&r.start===n.start&&r.end===n.end)&&o.push(n);return[...o].sort((n,r)=>n.start-r.start)}function qM(e,t,o){return e<=o&&o<t}function WM(e,t){if(!t)return;let o=e[e.length-1];if(o&&o.type==="text"){o.text+=t;return}e.push({type:"text",text:t})}function GM(e,t){let o=0;for(let n=0;n<e.length;n+=1)if(e[n]===mr){if(n>o&&t({type:"text",text:e.slice(o,n),promptOffset:o})===!0||t({type:"terminal-context",promptOffset:n})===!0)return!0;o=n+1}return o<e.length&&t({type:"text",text:e.slice(o),promptOffset:o})===!0}function k3(e,t){return GM(e,o=>o.type!=="text"?!1:t(o.text,o.promptOffset))}function L3(e,t){return k3(e,(o,n)=>{for(let r of Hc(o))if(r.type==="mention"&&t(r,n)===!0)return!0;return!1})}function P3(e){let t=[];if(!e)return t;let o=Hc(e),n=0;for(let r of o)r.start<n||(r.start>n&&WM(t,e.slice(n,r.start)),r.type==="mention"?t.push({type:"mention",path:r.value,source:r.source}):t.push({type:"skill",name:r.value}),n=r.end);return n<e.length&&WM(t,e.slice(n)),t}function gC(e,t,o){return!e||t>=o?!1:L3(e,(n,r)=>{let a=r+n.start,s=r+n.end,i=a-1,d=s;return!!(i>=0&&/\s/.test(e[i]??"")&&qM(t,o,i)||d<e.length&&/\s/.test(e[d]??"")&&qM(t,o,d))})}function Dr(e,t=[]){if(!e)return[];let o=[],n=0;return GM(e,r=>r.type==="text"?(o.push(...P3(r.text)),!1):(o.push({type:"terminal-context",context:t[n]??null}),n+=1,!1)),o}var R3=new RegExp(`^(?:${Md})?$`);function E3(e,t){return Number.isFinite(t)?Math.max(0,Math.min(e.length,Math.floor(t))):e.length}function jM(e,t,o=fi){let n=E3(e,t),r=e.lastIndexOf(`
3566
- `,Math.max(0,n-1))+1,a=/^\/(\S*)$/.exec(e.slice(r,n));if(a)return{kind:"slash-command",query:a[1]??"",rangeStart:r,rangeEnd:n};let s=n;for(;s>0&&!o(e[s-1]??"");)s-=1;let i=e.slice(s,n),d={query:i.slice(1),rangeStart:s,rangeEnd:n};if(i.startsWith("$"))return{kind:"skill",...d};if(i.startsWith("@"))return{kind:"path",...d};if(!i.startsWith("/"))return null;let c=n;for(;c<e.length&&!o(e[c]??"");)c+=1;return R3.test(e.slice(s+1,c))?{kind:"slash-skill",...d}:null}function QM(e){return e.isMobileViewport?null:e.modifierKey&&e.shiftKey?e.isDraftThread?"background":null:e.shiftKey?null:e.modifierKey?"steer":"foreground"}var VM=e=>e.type!=="text";function XM(e,t){return Number.isFinite(t)?Math.max(0,Math.min(e.length,Math.floor(t))):e.length}function hC(e){return fi(e)||e===mr}function en(e,t){let o=XM(e,t),n=Dr(e);if(n.length===0)return o;let r=o,a=0;for(let s of n){if(s.type==="mention"){let d=s.source.length;if(r<=1)return a+(r===0?0:d);r-=1,a+=d;continue}if(s.type==="skill"){let d=s.name.length+1;if(r<=1)return a+(r===0?0:d);r-=1,a+=d;continue}if(s.type==="terminal-context"){if(r<=1)return a+r;r-=1,a+=1;continue}let i=s.text.length;if(r<=i)return a+r;r-=i,a+=i}return a}function YM(e){return e.type==="text"?e.text.length:1}function JM(e,t){let o=e.reduce((n,r)=>n+YM(r),0);return Number.isFinite(t)?Math.max(0,Math.min(o,Math.floor(t))):o}function ir(e,t){return JM(Dr(e),t)}function uo(e,t){let o=XM(e,t),n=Dr(e);if(n.length===0)return o;let r=o,a=0;for(let s of n){if(s.type==="mention"){let d=s.source.length;if(r===0)return a;if(r<=d)return a+1;r-=d,a+=1;continue}if(s.type==="skill"){let d=s.name.length+1;if(r===0)return a;if(r<=d)return a+1;r-=d,a+=1;continue}if(s.type==="terminal-context"){if(r<=1)return a+r;r-=1,a+=1;continue}let i=s.text.length;if(r<=i)return a+r;r-=i,a+=i}return a}function tl(e,t,o){let n=Dr(e);if(!n.some(VM))return!1;let r=JM(n,t),a=0;for(let s of n){if(VM(s)&&(o==="left"&&r===a+1||o==="right"&&r===a))return!0;a+=YM(s)}return!1}function Po(e,t){return jM(e,t,hC)}function ZM(e,t,o,n){let r=Math.max(0,Math.min(e.length,t)),a=Math.max(r,Math.min(e.length,o));return{text:`${e.slice(0,r)}${n}${e.slice(a)}`,cursor:r+n.length}}function M3(e,t){return e.lineStart===e.lineEnd?t("pendingContext.terminalLine",{line:e.lineStart}):t("pendingContext.terminalLines",{start:e.lineStart,end:e.lineEnd})}function Rf(e,t){return t("pendingContext.terminalLabel",{terminal:e.terminalLabel,range:M3(e,t)})}function eA(e){return e.map(t=>[t.id,t.threadId,t.terminalId,t.terminalLabel,t.lineStart,t.lineEnd,t.createdAt,t.text].join("")).join("")}function tA(e){return e.map(t=>[t.name,t.displayName??"",t.shortDescription??"",t.description??"",t.path,t.scope??"",t.enabled?"1":"0"].join("")).join("")}function oA(e){let t=0;return e.getEditorState().read(()=>{let o=Te();ye(o)&&!o.isCollapsed()&&(t=o.getTextContent().length)}),t}function nA(e,t){let o=e.getRootElement(),n=o?.ownerDocument.getSelection();if(!o||!n?.isCollapsed||!n.anchorNode||!o.contains(n.anchorNode))return!1;let r=o.ownerDocument.createRange();if(r.selectNodeContents(o),t==="start"?r.setEnd(n.anchorNode,n.anchorOffset):r.setStart(n.anchorNode,n.anchorOffset),r.toString()==="")return!0;let a=r.getClientRects(),s=a[0],i=a[a.length-1];return s===void 0||i===void 0||i.top<s.bottom}function rA(e){e.update(()=>{let t=Te();ye(t)&&!t.isCollapsed()&&t.removeText()})}$();$();var lr=class extends xa{createDOM(){let t=document.createElement("span");return t.className=Ad,t}updateDOM(){return!1}isInline(){return!0}};var A3="group/composer-chip relative inline-flex [&:hover>*:first-child>*:first-child]:opacity-0 pointer-coarse:[&>*:first-child>*:first-child]:opacity-0",N3="absolute top-1/2 left-[calc(0.5em*0.86+1px)] inline-flex size-[calc(1.17em*0.86)] -translate-y-1/2 cursor-[var(--control-cursor)] items-center justify-center rounded-sm text-muted-foreground opacity-0 hover:bg-foreground/10 hover:text-foreground group-hover/composer-chip:opacity-100 pointer-coarse:opacity-100 pointer-coarse:after:absolute pointer-coarse:after:inset-0 pointer-coarse:after:m-auto pointer-coarse:after:min-h-8 pointer-coarse:after:min-w-8";function Ta(e){let{t}=z(),[o]=ct();if(!kf())return e.children;let r=()=>{let a=o.getRootElement()?.contains(document.activeElement)??!1;o.update(()=>{let s=Ca(e.nodeKey);s!==null&&(a&&s.selectPrevious(),s.remove())}),e.onRemoved?.()};return v("span",{className:A3,children:[e.children,l("button",{type:"button",contentEditable:!1,tabIndex:-1,"aria-label":t("composer.removeChip",{label:e.label}),className:N3,onMouseDown:a=>a.preventDefault(),onClick:a=>{a.preventDefault(),a.stopPropagation(),r()},children:l(dt,{"aria-hidden":"true",className:"size-[calc(0.86em*0.86)]"})})]})}function D3(e){return(e.comment??e.text).replace(/\s+/g," ").trim()}var ol=class e extends lr{__quote;__source;static getType(){return"composer-quote"}static clone(t){return new e(t.__quote,t.__source,t.__key)}static importJSON(t){return Ef(t.quote,t.source).updateFromJSON(t)}constructor(t,o,n){super(n),this.__quote=t,this.__source=o}exportJSON(){return{...super.exportJSON(),quote:this.__quote,source:this.__source,type:"composer-quote",version:1}}getTextContent(){return this.__source}decorate(){return l(_3,{nodeKey:this.getKey(),quote:this.__quote,source:this.__source})}};function Ef(e,t){return ya(new ol(e,t))}function _3(e){let{t}=z(),[o]=ct(),n=Co(),r=n?.data.assistantQuotes??null,[a,s]=q(!1),[i,d]=q(e.quote.comment??""),[c,u]=Ge(n?.threadKey??"",null,{namespace:Yu});H(()=>{c===null||c!==e.source||(u(null),d(e.quote.comment??""),s(!0))},[c,e.quote.comment,e.source,u]);let m=D3(e.quote),p=()=>{if(s(!1),r===null)return;let f=r.withComment(e.quote,i),g=r.serialize(f);g!==null&&o.update(()=>{let h=Ca(e.nodeKey);h instanceof ol&&h.replace(Ef(f,g))})};return l(Ta,{nodeKey:e.nodeKey,label:m,children:v(rn,{open:a,onOpenChange:f=>{f&&d(e.quote.comment??""),s(f)},children:[l(sn,{render:v("span",{className:ln,contentEditable:!1,spellCheck:!1,role:"button",tabIndex:-1,"data-composer-quote-chip":"true","aria-label":t("composer.quote.chipLabel",{text:m}),children:[l(hr,{"aria-hidden":"true",className:Fo}),l("span",{className:Bo,children:m})]})}),l(an,{side:"top",align:"start",className:"w-96 max-w-[calc(100vw-2rem)]",children:v("div",{className:"flex flex-col gap-2",children:[l("div",{className:"line-clamp-6 whitespace-pre-wrap border-l-2 border-border ps-2 text-muted-foreground text-sm",children:e.quote.text}),l(Sb,{value:i,autoFocus:!0,rows:3,placeholder:t("composer.quote.commentPlaceholder"),"aria-label":t("composer.quote.commentLabel"),onChange:f=>d(f.target.value),onKeyDown:f=>{f.key==="Enter"&&(f.metaKey||f.ctrlKey)&&(f.preventDefault(),p())}}),v("div",{className:"flex justify-end gap-2",children:[l(K,{size:"sm",variant:"ghost",onClick:()=>s(!1),children:t("composer.cancel")}),l(K,{size:"sm",onClick:p,disabled:r===null,children:t("composer.quote.saveComment")})]})]})})]})})}var Uc=class e extends lr{__reference;__source;static getType(){return"composer-thread-reference"}static clone(t){return new e(t.__reference,t.__source,t.__key)}static importJSON(t){return yC(t.reference,t.source).updateFromJSON(t)}constructor(t,o,n){super(n),this.__reference=t,this.__source=o}exportJSON(){return{...super.exportJSON(),reference:this.__reference,source:this.__source,type:"composer-thread-reference",version:1}}getTextContent(){return this.__source}decorate(){return l(O3,{nodeKey:this.getKey(),reference:this.__reference})}};function yC(e,t){return ya(new Uc(e,t))}function O3(e){let{t}=z(),o=Co(),r=Zn()(e.reference.title),a=v("span",{className:ln,contentEditable:!1,spellCheck:!1,"data-composer-thread-reference-chip":"true","aria-label":t("composer.threadReference.chipLabel",{title:r}),children:[l(gr,{"aria-hidden":"true",className:Fo}),l("span",{className:Bo,children:r})]});return l(Ta,{nodeKey:e.nodeKey,label:r,children:v(Pe,{children:[l(Ee,{render:a}),l(Re,{side:"top",className:"max-w-120 whitespace-normal leading-tight",children:l(lp,{reference:e.reference,useMachineLabel:o?.data.threadReferences?.useMachineLabel})})]})})}var vC=[ol,Uc];function Mf(e){return vC.some(t=>e instanceof t)}function F3(e){return{collect:t=>[...e.assistantQuotes.collect(t).map(o=>({start:o.start,end:o.end,createNode:()=>Ef(o.quote,o.source)})),...(e.threadReferences?.collect(t)??[]).map(o=>({start:o.start,end:o.end,createNode:()=>yC(o.reference,o.source)}))].toSorted((o,n)=>o.start-n.start)}}function ks(){let e=Co()?.data??null,t=W(()=>e===null?null:F3(e),[e]),o=E(t);return o.current=t,o}var nl=new Map,B3=32;function aA(e,t){for(nl.delete(e),nl.set(e,t);nl.size>B3;){let o=nl.keys().next().value;if(o===void 0)break;nl.delete(o)}}function H3(e){return{anchor:e.length,focus:e.length}}function _r(e,t,o){let n=nl.get(e);if(n)return aA(e,n),n;let r={cursor:o?.cursor??t.length,expandedCursor:o?.expandedCursor??t.length,selection:o?{anchor:o.cursor,focus:o.cursor}:H3(t),history:fM()};return aA(e,r),r}function rl(e,t,o){let n=_r(e,t);n.cursor=o.cursor,n.expandedCursor=o.expandedCursor,n.selection=o.selection}function sA(e,t,o,n){let r=_r(e,t);r.cursor=o,r.expandedCursor=n}function iA(e,t){let o=e.current,n=[...e.undoStack],r=[...e.redoStack];t(),e.current=o,e.undoStack.splice(0,e.undoStack.length,...n),e.redoStack.splice(0,e.redoStack.length,...r)}function U3(e){let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t>=0?e.slice(t+1):e}function $3(e){return e.replaceAll("\\","\\\\").replaceAll("[","\\[").replaceAll("]","\\]")}function z3(e){return encodeURI(e).replaceAll("(","%28").replaceAll(")","%29").replaceAll("#","%23").replaceAll("?","%3F").replaceAll("\\","%5C")}function Ls(e){return`[${$3(U3(e))}](${z3(e)})`}$();function $c(e){let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t===-1?e:e.slice(t+1)}function lA(e){let t=$c(e);return t.startsWith(".")&&!t.slice(1).includes(".")?"directory":t.includes(".")?"file":"directory"}$();var dA=qe(null),al=dA.Provider;function it(){let e=Pt(dA);if(e===null)throw new Error("Composer API has not been provided.");return e}var Af=Gw({cn:V,usePierreIcons:()=>{let e=it().pierreIcons;return{ready:e.useSpriteReady(),ensureSprite:e.ensureSprite,resolveForEntry:e.resolveForEntry}}});var cA=ln;var uA=jw({EntryIcon:Af,inferEntryKindFromPath:lA,iconClassName:Fo,labelClassName:Bo,selectableLabelClassName:rT});function Nf(e){return l("span",{className:cA,contentEditable:!1,spellCheck:!1,"data-composer-mention-chip":"true",children:l(uA,{path:e.path,label:$c(e.path),theme:e.theme})})}function Df(e){return v("span",{className:aT,contentEditable:!1,spellCheck:!1,"data-composer-skill-chip":"true",children:[l("span",{"aria-hidden":"true",className:Fo,dangerouslySetInnerHTML:{__html:sT}}),l("span",{className:Bo,children:e.label})]})}function pA(e){let{label:t,tooltipText:o,expired:n=!1}=e;return v(Pe,{children:[l(Ee,{render:v("span",{className:V(ln,n&&"border-destructive/35 bg-destructive/8 text-destructive-foreground"),"data-terminal-context-expired":n?"true":void 0,children:[l(Qo,{className:V(Fo,"size-icon-1",n&&"opacity-100")}),l("span",{className:Bo,children:t})]})}),l(Re,{side:"top",className:"max-w-80 whitespace-pre-wrap leading-tight",children:o})]})}function mA({context:e}){let{t}=z(),o=Rf(e,t),n=$w(e),r=n?t("pendingContext.terminalExpired",{label:o}):e.text;return l(pA,{label:o,tooltipText:r,expired:n})}function K3(e){let t=[];for(let o of e.split(/[\s:_-]+/))o.length!==0&&t.push(o.charAt(0).toUpperCase()+o.slice(1));return t.join(" ")}function q3(e){return e.replaceAll("\\","/")}function tn(e){let t=e.displayName?.trim();return t||K3(e.name)}function fA(e,t){return t?e.filter(xr):[]}function gA(e){let t=q3(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"}}var zc=qe({onRemoveTerminalContext:()=>{}});function W3(e){let t=l(Nf,{path:e.path,theme:Q3()});return l(Ta,{nodeKey:e.nodeKey,label:$c(e.path),children:v(Pe,{children:[l(Ee,{render:t}),l(Re,{side:"top",className:"max-w-120 whitespace-normal leading-tight wrap-anywhere",children:e.path})]})})}var Ps=class e extends lr{__path;__source;static getType(){return"composer-mention"}static clone(t){return new e(t.__path,t.__source,t.__key)}static importJSON(t){return Kc(t.path,t.source).updateFromJSON(t)}constructor(t,o=Ls(t),n){super(n),this.__path=t,this.__source=o}exportJSON(){return{...super.exportJSON(),path:this.__path,source:this.__source,type:"composer-mention",version:1}}getTextContent(){return this.__source}decorate(){return l(W3,{nodeKey:this.getKey(),path:this.__path})}};function Kc(e,t){return ya(new Ps(e,t))}function G3(e){let t=e.shortDescription?.trim();return t||e.description?.trim()||null}function Rs(e){return new Map(e.map(t=>[t.name,{label:tn(t),description:G3(t)}]))}function j3(e){let t=l(Df,{label:e.skillLabel});return l(Ta,{nodeKey:e.nodeKey,label:e.skillLabel,children:e.skillDescription?v(Pe,{children:[l(Ee,{render:t}),l(Re,{side:"top",className:"max-w-120 whitespace-normal leading-tight",children:e.skillDescription})]}):t})}var sl=class e extends lr{__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 CC(t.skillName,t.skillLabel??t.skillName,t.skillDescription??null).updateFromJSON(t)}constructor(t,o,n,r){super(r);let a=t.startsWith("$")?t.slice(1):t;this.__skillName=a,this.__skillLabel=o,this.__skillDescription=n}exportJSON(){return{...super.exportJSON(),skillName:this.__skillName,skillLabel:this.__skillLabel,...this.__skillDescription?{skillDescription:this.__skillDescription}:{},type:"composer-skill",version:1}}getTextContent(){return`$${this.__skillName}`}decorate(){return l(j3,{nodeKey:this.getKey(),skillLabel:this.__skillLabel,skillDescription:this.__skillDescription})}};function CC(e,t,o){return ya(new sl(e,t,o))}function V3(e){let{t}=z(),{onRemoveTerminalContext:o}=xe(zc);return l(Ta,{nodeKey:e.nodeKey,label:Rf(e.context,t),onRemoved:()=>o(e.context.id),children:l(mA,{context:e.context})})}var dr=class e extends lr{__context;static getType(){return"composer-terminal-context"}static clone(t){return new e(t.__context,t.__key)}static importJSON(t){return xC(t.context)}constructor(t,o){super(o),this.__context=t}exportJSON(){return{...super.exportJSON(),context:this.__context,type:"composer-terminal-context",version:1}}getTextContent(){return mr}decorate(){return l(V3,{nodeKey:this.getKey(),context:this.__context})}};function xC(e){return ya(new dr(e))}function gn(e){return e instanceof Ps||e instanceof sl||e instanceof dr||Mf(e)}function Q3(){return document.documentElement.classList.contains("dark")?"dark":"light"}function bC(e,t){return Number.isFinite(t)?Math.max(0,Math.min(e.length,Math.floor(t))):e.length}function _f(e){return Mf(e)?e.getTextContentSize():1}function yA(e){return e.getTextContentSize()}function X3(e,t,o){return t+(o>0?_f(e):0)}function Y3(e,t,o){return t+(o>0?yA(e):0)}function J3(e,t){let o=e.getParent();if(!o||!_e(o))return null;let n=e.getIndexWithinParent();return t.value===0?{key:o.getKey(),offset:n,type:"element"}:t.value===_f(e)?{key:o.getKey(),offset:n+1,type:"element"}:(t.value-=_f(e),null)}function wC(e){return gn(e)?_f(e):Ke(e)?e.getTextContentSize():Lc(e)?1:_e(e)?e.getChildren().reduce((t,o)=>t+wC(o),0):0}function vA(e){return gn(e)?yA(e):Ke(e)?e.getTextContentSize():Lc(e)?1:_e(e)?e.getChildren().reduce((t,o)=>t+vA(o),0):0}function CA(e,t,o,n){let r=0,a=e;for(;a;){let s=a.getParent();if(!s||!_e(s))break;let i=s.getChildren(),d=a.getIndexWithinParent();for(let c=0;c<d;c+=1){let u=i[c];u&&(r+=o(u))}a=s}if(Ke(e))return r+Math.min(t,e.getTextContentSize());if(gn(e))return n(e,r,t);if(Lc(e))return r+Math.min(t,1);if(_e(e)){let s=e.getChildren(),i=Math.max(0,Math.min(t,s.length));for(let d=0;d<i;d+=1){let c=s[d];c&&(r+=o(c))}return r}return r}function il(e,t){return CA(e,t,wC,X3)}function qc(e,t){return CA(e,t,vA,Y3)}function Of(e,t){if(gn(e))return J3(e,t);if(Ke(e)){let o=e.getTextContentSize();return t.value<=o?{key:e.getKey(),offset:t.value,type:"text"}:(t.value-=o,null)}if(Lc(e)){let o=e.getParent();if(!o)return null;let n=e.getIndexWithinParent();return t.value===0?{key:o.getKey(),offset:n,type:"element"}:t.value===1?{key:o.getKey(),offset:n+1,type:"element"}:(t.value-=1,null)}if(_e(e)){let o=e.getChildren();for(let n of o){let r=Of(n,t);if(r)return r}if(t.value===0)return{key:e.getKey(),offset:o.length,type:"element"}}return null}function Wc(){return Ye().getChildren().reduce((o,n)=>o+wC(n),0)}function Ia(e){let t=Ye(),o=Wc(),r={value:Math.max(0,Math.min(e,o))},a=Of(t,r)??{key:t.getKey(),offset:t.getChildren().length,type:"element"},s=Cs();s.anchor.set(a.key,a.offset,a.type),s.focus.set(a.key,a.offset,a.type),fn(s)}function ll(e,t){let o=Ye(),n=Wc(),r=Math.max(0,Math.min(e,n)),a=Math.max(0,Math.min(t,n)),s={value:r},i={value:a},d=Of(o,s)??{key:o.getKey(),offset:o.getChildren().length,type:"element"},c=Of(o,i)??{key:o.getKey(),offset:o.getChildren().length,type:"element"},u=Cs();u.anchor.set(d.key,d.offset,d.type),u.focus.set(c.key,c.offset,c.type),fn(u)}function TC(e){if(!ye(e))return null;let t=e.anchor.getNode(),o=e.focus.getNode(),n=qc(t,e.anchor.offset),r=qc(o,e.focus.offset);return{start:Math.min(n,r),end:Math.max(n,r)}}function IC(e){return ye(e)?e.getNodes().some(t=>gn(t)):!1}function dl(e){let t=Te();if(!ye(t)||!t.isCollapsed())return e;let o=t.anchor.getNode(),n=il(o,t.anchor.offset),r=Wc();return Math.max(0,Math.min(n,r))}function xA(e){let t=Te();if(!ye(t)||!t.isCollapsed())return e;let o=t.anchor.getNode(),n=qc(o,t.anchor.offset),r=Ye().getTextContent().length;return Math.max(0,Math.min(n,r))}function SC(e){let t=Te();return ye(t)?{anchor:il(t.anchor.getNode(),t.anchor.offset),focus:il(t.focus.getNode(),t.focus.offset)}:e}function hA(e,t){let o=t.split(`
3567
- `);for(let n=0;n<o.length;n+=1){let r=o[n]??"";r.length>0&&e.append(Nn(r)),n<o.length-1&&e.append(vs())}}function Z3(e,t,o){let n=0;for(let r of o?.collect(t)??[])hA(e,t.slice(n,r.start)),e.append(r.createNode()),n=r.end;hA(e,t.slice(n))}function Gc(e,t,o,n){let r=Ye();r.clear();let a=mn();r.append(a);let s=Dr(e,t);for(let i of s){if(i.type==="mention"){a.append(Kc(i.path,i.source));continue}if(i.type==="skill"){let d=o.get(i.name);a.append(CC(i.name,d?.label??tn({name:i.name}),d?.description??null));continue}if(i.type==="terminal-context"){i.context&&a.append(xC(i.context));continue}Z3(a,i.text,n)}}function kC(e){return e instanceof dr?[e.__context.id]:_e(e)?e.getChildren().flatMap(t=>kC(t)):[]}$();function cl(e){return/mac|iphone|ipad|ipod/i.test(e)}function Es(){let e=globalThis.crypto.getRandomValues(new Uint8Array(16));e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t="";for(let o of e)t+=o.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 bA(e,t){return e.registerCommand(ef,o=>{if(!(o instanceof ClipboardEvent)||o.clipboardData===null||o.clipboardData.files.length>0)return!1;let n=o.clipboardData.getData("text/plain");if(n.length===0)return!1;let r=t.readLinkChips?.()?.collect(n)??[],a=Hc(`${n}
3565
+ `?c.insertParagraph():u===" "?c.insertNodes([zP()]):c.insertText(u)}}}else t.insertRawText(s)}function dC(e,t,o){e.dispatchCommand(DR,{nodes:t,selection:o})||(o.insertNodes(t),(function(n){if(ye(n)&&n.isCollapsed()){let r=n.anchor,a=null,s=ji(r,"previous");if(s)if(Um(s))a=s.origin;else{let i=qP(s,va(Ye(),"next").getFlipped());for(let d of i){if(Ke(d.origin)){a=d.origin;break}if(_e(d.origin)&&!d.origin.isInline())break}}if(a&&Ke(a)){let i=a.getFormat(),d=a.getStyle();n.format===i&&n.style===d||(n.format=i,n.style=d,n.dirty=!0)}}})(o))}function AM(e,t,o,n=[]){let r=t===null||o.isSelected(t),a=_e(o)&&o.excludeFromCopy("html"),s=o;t!==null&&Ke(s)&&(s=mf(t,s,"clone"));let i=_e(s)?s.getChildren():[],d=(function(c){let u=c.exportJSON(),m=c.constructor;if(u.type!==m.getType()&&Lf(58,m.name),_e(c)){let p=u.children;Array.isArray(p)||Lf(59,m.name)}return u})(s);Ke(s)&&s.getTextContentSize()===0&&(r=!1);for(let c=0;c<i.length;c++){let u=i[c],m=AM(e,t,u,d.children);!r&&_e(o)&&m&&o.extractWithChild(u,t,"clone")&&(r=!0)}if(r&&!a)n.push(d);else if(Array.isArray(d.children))for(let c=0;c<d.children.length;c++){let u=d.children[c];n.push(u)}return r}function NM(e,t){let o=[],n=Ye().getChildren();for(let r=0;r<n.length;r++)AM(e,t,n[r],o);return{namespace:e._config.namespace,nodes:o}}function DM(e){let t=[];for(let o=0;o<e.length;o++){let n=e[o],r=oR(n);Ke(r)&&pE(r),t.push(r)}return t}var el=null;async function l3(e,t,o){if(el!==null)return!1;if(t!==null)return new Promise((c,u)=>{e.update(()=>{c(RM(e,t,o))})});let n=e.getRootElement(),r=e._window||window,a=r.document,s=vv(r);if(n===null||s===null)return!1;let i=a.createElement("span");i.style.cssText="position: fixed; top: -1000px;",i.append(a.createTextNode("#")),n.append(i);let d=new Range;return d.setStart(i,0),d.setEnd(i,1),s.removeAllRanges(),s.addRange(d),new Promise((c,u)=>{let m=e.registerCommand(Wm,p=>(Dc(p,ClipboardEvent)&&(m(),el!==null&&(r.clearTimeout(el),el=null),c(RM(e,p,o))),!0),qm);el=r.setTimeout(()=>{m(),el=null,c(!1)},50),a.execCommand("copy"),i.remove()})}function RM(e,t,o){if(o===void 0){let r=vv(e._window),a=Te();if(!a||a.isCollapsed()||!r)return!1;let s=r.anchorNode,i=r.focusNode;if(s!==null&&i!==null&&!QR(e,s,i))return!1;o=OM(a)}t.preventDefault();let n=t.clipboardData;return n!==null&&(FM(n,o),!0)}var _M=[["text/html",EM],["application/x-lexical-editor",MM]];function OM(e=Te()){let t={"text/plain":e?e.getTextContent():""};if(e){let o=Fm();for(let[n,r]of _M){let a=r(o,e);a!==null&&(t[n]=a)}}return t}function FM(e,t){for(let[o]of _M)t[o]===void 0&&e.setData(o,"");for(let o in t){let n=t[o];n!==void 0&&e.setData(o,n)}}var sr=cC,zme=sr.$generateJSONFromSelectedNodes,Kme=sr.$generateNodesFromSerializedNodes,qme=sr.$getClipboardDataFromSelection,BM=sr.$getHtmlContent,Wme=sr.$getLexicalContent,uC=sr.$insertDataTransferForPlainText,Gme=sr.$insertDataTransferForRichText,jme=sr.$insertGeneratedNodes,Vme=sr.copyToClipboard,Qme=sr.setLexicalClipboardDataTransfer;var pC={};Ut(pC,{PlainTextExtension:()=>g3,registerPlainText:()=>$M});var Ss=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,d3=Ss&&"documentMode"in document?document.documentMode:null,c3=Ss&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),u3=!(!Ss||!("InputEvent"in window)||d3)&&"getTargetRanges"in new window.InputEvent("input"),p3=Ss&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),HM=Ss&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,m3=Ss&&/^(?=.*Chrome).*/i.test(navigator.userAgent),f3=Ss&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&c3&&!m3;function UM(e,t){t.update(()=>{if(e!==null){let o=Dc(e,KeyboardEvent)?null:e.clipboardData,n=Te();if(n!==null&&!n.isCollapsed()&&o!=null){e.preventDefault();let r=BM(t);r!==null&&o.setData("text/html",r),o.setData("text/plain",n.getTextContent())}}})}function $M(e){return Nr(e.registerCommand(Gm,t=>{let o=Te();return!!ye(o)&&(o.deleteCharacter(t),!0)},vt),e.registerCommand(gR,t=>{let o=Te();return!!ye(o)&&(o.deleteWord(t),!0)},vt),e.registerCommand(fR,t=>{let o=Te();return!!ye(o)&&(o.deleteLine(t),!0)},vt),e.registerCommand(pR,t=>{let o=Te();if(!ye(o))return!1;if(typeof t=="string")o.insertText(t);else{let n=t.dataTransfer;if(n!=null)uC(n,o);else{let r=t.data;r&&o.insertText(r)}}return!0},vt),e.registerCommand(AR,()=>{let t=Te();return!!ye(t)&&(t.removeText(),!0)},vt),e.registerCommand(hv,t=>{let o=Te();return!!ye(o)&&(o.insertLineBreak(t),!0)},vt),e.registerCommand(bR,()=>{let t=Te();return!!ye(t)&&(t.insertLineBreak(),!0)},vt),e.registerCommand(Vm,t=>{let o=Te();if(!ye(o))return!1;let n=t,r=n.shiftKey;return!!Av(o,!0)&&(n.preventDefault(),Mv(o,r,!0),!0)},vt),e.registerCommand(Qm,t=>{let o=Te();if(!ye(o))return!1;let n=t,r=n.shiftKey;return!!Av(o,!1)&&(n.preventDefault(),Mv(o,r,!1),!0)},vt),e.registerCommand(Xm,t=>{let o=Te();return!!ye(o)&&(!HM||navigator.language!=="ko-KR")&&(t.preventDefault(),e.dispatchCommand(Gm,!0))},vt),e.registerCommand(Ym,t=>{let o=Te();return!!ye(o)&&(t.preventDefault(),e.dispatchCommand(Gm,!1))},vt),e.registerCommand(Jm,t=>{let o=Te();if(!ye(o))return!1;if(t!==null){if((HM||p3||f3)&&u3)return!1;t.preventDefault()}return e.dispatchCommand(hv,!1)},vt),e.registerCommand(_R,()=>($m(),!0),vt),e.registerCommand(Wm,t=>{let o=Te();return!!ye(o)&&(UM(t,e),!0)},vt),e.registerCommand(mR,t=>{let o=Te();return!!ye(o)&&((function(n,r){UM(n,r),r.update(()=>{let a=Te();ye(a)&&a.removeText()})})(t,e),!0)},vt),e.registerCommand(ef,t=>{let o=Te();return!!ye(o)&&((function(n,r){n.preventDefault(),r.update(()=>{let a=Te(),s=Dc(n,ClipboardEvent)?n.clipboardData:null;s!=null&&ye(a)&&uC(s,a)},{tag:RR})})(t,e),!0)},vt),e.registerCommand(yR,t=>{let o=Te();return!!ye(o)&&(t.preventDefault(),!0)},vt),e.registerCommand(hR,t=>{let o=Te();return!!ye(o)&&(t.preventDefault(),!0)},vt))}var g3=zt({conflictsWith:["@lexical/rich-text"],dependencies:[bM],name:"@lexical/plain-text",register:$M});var zM=pC,ofe=zM.PlainTextExtension,KM=zM.registerPlainText;var fC={};Ut(fC,{PlainTextPlugin:()=>C3});$();var Pf=Px(yh(),1);function h3(e,...t){let o=new URL("https://lexical.dev/docs/error"),n=new URLSearchParams;n.append("code",e);for(let r of t)n.append("v",r);throw o.search=n.toString(),Error(`Minified Lexical error #${e}; visit ${o.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var mC=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?fe:H;function y3({editor:e,ErrorBoundary:t}){return(function(o,n){let[r,a]=q(()=>o.getDecorators());return mC(()=>o.registerDecoratorListener(s=>{(0,Pf.flushSync)(()=>{a(s)})}),[o]),H(()=>{a(o.getDecorators())},[o]),W(()=>{let s=[],i=Object.keys(r);for(let d=0;d<i.length;d++){let c=i[d],u=l(n,{onError:p=>o._onError(p),children:l(Cg,{fallback:null,children:r[c]})}),m=o.getElementByKey(c);m!==null&&s.push((0,Pf.createPortal)(u,m,c))}return s},[n,r,o])})(e,t)}function v3({editor:e,ErrorBoundary:t}){return(function(o){let n=iM.maybeFromEditor(o);if(n&&n.hasExtensionByName(vM.name)){for(let r of["@lexical/plain-text","@lexical/rich-text"])n.hasExtensionByName(r)&&h3(320,r);return!0}return!1})(e)?null:l(y3,{editor:e,ErrorBoundary:t})}function qM(e){return e.getEditorState().read(df(e.isComposing()))}function C3({contentEditable:e,placeholder:t=null,ErrorBoundary:o}){let[n]=ct();return(function(r){mC(()=>Nr(KM(r),wM(r)),[r])})(n),v(oe,{children:[e,l(x3,{content:t}),l(v3,{editor:n,ErrorBoundary:o})]})}function x3({content:e}){let[t]=ct(),o=(function(r){let[a,s]=q(()=>qM(r));return mC(()=>{function i(){let d=qM(r);s(d)}return i(),Nr(r.registerUpdateListener(()=>{i()}),r.registerEditableListener(()=>{i()}))},[r]),a})(t),n=kf();return o?typeof e=="function"?e(n):e:null}var b3=fC,WM=b3.PlainTextPlugin;$();var w3=/(^|\s)@(?:"((?:\\.|[^"\\])*)"|([^\s@"]+))(?=\s)/g,T3=512,I3=new RegExp(`(^|\\s)\\[((?:\\\\.|[^\\]\\\\]){0,${T3}})\\]\\(([^)\\s]+)\\)(?=\\s)`,"g"),S3=/^[A-Za-z][A-Za-z0-9+.-]*:/,k3=/^[A-Za-z]:[\\/]/,L3=/^[a-z0-9][a-z0-9._-]*\/[a-z0-9][a-z0-9._-]*(?:\/[^\s@"]+)*$/;function P3(e){let t=[];for(let o of e.matchAll(I3)){let n=o[0],r=o[1]??"",a=(o[2]??"").replace(/\\(.)/g,"$1"),s=o[3]??"",i=s;try{i=decodeURIComponent(s)}catch{}let d=Math.max(i.lastIndexOf("/"),i.lastIndexOf("\\")),c=d>=0?i.slice(d+1):i,u=S3.test(i)&&!k3.test(i);if(!i||u||a!==c)continue;let m=(o.index??0)+r.length,p=m+n.length-r.length;t.push({type:"mention",value:i,source:e.slice(m,p),start:m,end:p})}for(let o of e.matchAll(w3)){let n=o[0],r=o[1]??"",a=o[2],s=a!==void 0?a.replace(/\\(.)/g,"$1"):o[3]??"";if(!s||a===void 0&&L3.test(s))continue;let i=(o.index??0)+r.length,d=i+n.length-r.length;t.push({type:"mention",value:s,source:e.slice(i,d),start:i,end:d})}return t}function Hc(e,t={}){let o=P3(e);for(let n of jg(e))n.sigil!=="$"||n.end>=e.length||o.push({type:"skill",value:n.name,source:e.slice(n.start,n.end),start:n.start,end:n.end});for(let n of t.preserveTrailingFrom??[])n.end===e.length&&e.slice(n.start,n.end)===n.source&&!o.some(r=>r.type===n.type&&r.start===n.start&&r.end===n.end)&&o.push(n);return[...o].sort((n,r)=>n.start-r.start)}function GM(e,t,o){return e<=o&&o<t}function jM(e,t){if(!t)return;let o=e[e.length-1];if(o&&o.type==="text"){o.text+=t;return}e.push({type:"text",text:t})}function VM(e,t){let o=0;for(let n=0;n<e.length;n+=1)if(e[n]===mr){if(n>o&&t({type:"text",text:e.slice(o,n),promptOffset:o})===!0||t({type:"terminal-context",promptOffset:n})===!0)return!0;o=n+1}return o<e.length&&t({type:"text",text:e.slice(o),promptOffset:o})===!0}function R3(e,t){return VM(e,o=>o.type!=="text"?!1:t(o.text,o.promptOffset))}function E3(e,t){return R3(e,(o,n)=>{for(let r of Hc(o))if(r.type==="mention"&&t(r,n)===!0)return!0;return!1})}function M3(e){let t=[];if(!e)return t;let o=Hc(e),n=0;for(let r of o)r.start<n||(r.start>n&&jM(t,e.slice(n,r.start)),r.type==="mention"?t.push({type:"mention",path:r.value,source:r.source}):t.push({type:"skill",name:r.value}),n=r.end);return n<e.length&&jM(t,e.slice(n)),t}function gC(e,t,o){return!e||t>=o?!1:E3(e,(n,r)=>{let a=r+n.start,s=r+n.end,i=a-1,d=s;return!!(i>=0&&/\s/.test(e[i]??"")&&GM(t,o,i)||d<e.length&&/\s/.test(e[d]??"")&&GM(t,o,d))})}function Dr(e,t=[]){if(!e)return[];let o=[],n=0;return VM(e,r=>r.type==="text"?(o.push(...M3(r.text)),!1):(o.push({type:"terminal-context",context:t[n]??null}),n+=1,!1)),o}var A3=new RegExp(`^(?:${Md})?$`);function N3(e,t){return Number.isFinite(t)?Math.max(0,Math.min(e.length,Math.floor(t))):e.length}function QM(e,t,o=fi){let n=N3(e,t),r=e.lastIndexOf(`
3566
+ `,Math.max(0,n-1))+1,a=/^\/(\S*)$/.exec(e.slice(r,n));if(a)return{kind:"slash-command",query:a[1]??"",rangeStart:r,rangeEnd:n};let s=n;for(;s>0&&!o(e[s-1]??"");)s-=1;let i=e.slice(s,n),d={query:i.slice(1),rangeStart:s,rangeEnd:n};if(i.startsWith("$"))return{kind:"skill",...d};if(i.startsWith("@"))return{kind:"path",...d};if(!i.startsWith("/"))return null;let c=n;for(;c<e.length&&!o(e[c]??"");)c+=1;return A3.test(e.slice(s+1,c))?{kind:"slash-skill",...d}:null}function YM(e){return e.isMobileViewport?null:e.modifierKey&&e.shiftKey?e.isDraftThread?"background":null:e.shiftKey?null:e.modifierKey?"steer":"foreground"}var XM=e=>e.type!=="text";function JM(e,t){return Number.isFinite(t)?Math.max(0,Math.min(e.length,Math.floor(t))):e.length}function hC(e){return fi(e)||e===mr}function Zo(e,t){let o=JM(e,t),n=Dr(e);if(n.length===0)return o;let r=o,a=0;for(let s of n){if(s.type==="mention"){let d=s.source.length;if(r<=1)return a+(r===0?0:d);r-=1,a+=d;continue}if(s.type==="skill"){let d=s.name.length+1;if(r<=1)return a+(r===0?0:d);r-=1,a+=d;continue}if(s.type==="terminal-context"){if(r<=1)return a+r;r-=1,a+=1;continue}let i=s.text.length;if(r<=i)return a+r;r-=i,a+=i}return a}function ZM(e){return e.type==="text"?e.text.length:1}function eA(e,t){let o=e.reduce((n,r)=>n+ZM(r),0);return Number.isFinite(t)?Math.max(0,Math.min(o,Math.floor(t))):o}function ir(e,t){return eA(Dr(e),t)}function uo(e,t){let o=JM(e,t),n=Dr(e);if(n.length===0)return o;let r=o,a=0;for(let s of n){if(s.type==="mention"){let d=s.source.length;if(r===0)return a;if(r<=d)return a+1;r-=d,a+=1;continue}if(s.type==="skill"){let d=s.name.length+1;if(r===0)return a;if(r<=d)return a+1;r-=d,a+=1;continue}if(s.type==="terminal-context"){if(r<=1)return a+r;r-=1,a+=1;continue}let i=s.text.length;if(r<=i)return a+r;r-=i,a+=i}return a}function tl(e,t,o){let n=Dr(e);if(!n.some(XM))return!1;let r=eA(n,t),a=0;for(let s of n){if(XM(s)&&(o==="left"&&r===a+1||o==="right"&&r===a))return!0;a+=ZM(s)}return!1}function Po(e,t){return QM(e,t,hC)}function tA(e,t,o,n){let r=Math.max(0,Math.min(e.length,t)),a=Math.max(r,Math.min(e.length,o));return{text:`${e.slice(0,r)}${n}${e.slice(a)}`,cursor:r+n.length}}function D3(e,t){return e.lineStart===e.lineEnd?t("pendingContext.terminalLine",{line:e.lineStart}):t("pendingContext.terminalLines",{start:e.lineStart,end:e.lineEnd})}function Rf(e,t){return t("pendingContext.terminalLabel",{terminal:e.terminalLabel,range:D3(e,t)})}function oA(e){return e.map(t=>[t.id,t.threadId,t.terminalId,t.terminalLabel,t.lineStart,t.lineEnd,t.createdAt,t.text].join("")).join("")}function nA(e){return e.map(t=>[t.name,t.displayName??"",t.shortDescription??"",t.description??"",t.path,t.scope??"",t.enabled?"1":"0"].join("")).join("")}function rA(e){let t=0;return e.getEditorState().read(()=>{let o=Te();ye(o)&&!o.isCollapsed()&&(t=o.getTextContent().length)}),t}function aA(e,t){let o=e.getRootElement(),n=o?.ownerDocument.getSelection();if(!o||!n?.isCollapsed||!n.anchorNode||!o.contains(n.anchorNode))return!1;let r=o.ownerDocument.createRange();if(r.selectNodeContents(o),t==="start"?r.setEnd(n.anchorNode,n.anchorOffset):r.setStart(n.anchorNode,n.anchorOffset),r.toString()==="")return!0;let a=r.getClientRects(),s=a[0],i=a[a.length-1];return s===void 0||i===void 0||i.top<s.bottom}function sA(e){e.update(()=>{let t=Te();ye(t)&&!t.isCollapsed()&&t.removeText()})}$();$();var lr=class extends xa{createDOM(){let t=document.createElement("span");return t.className=Ad,t}updateDOM(){return!1}isInline(){return!0}};var _3="group/composer-chip relative inline-flex [&:hover>*:first-child>*:first-child]:opacity-0 pointer-coarse:[&>*:first-child>*:first-child]:opacity-0",O3="absolute top-1/2 left-[calc(0.5em*0.86+1px)] inline-flex size-[calc(1.17em*0.86)] -translate-y-1/2 cursor-[var(--control-cursor)] items-center justify-center rounded-sm text-muted-foreground opacity-0 hover:bg-foreground/10 hover:text-foreground group-hover/composer-chip:opacity-100 pointer-coarse:opacity-100 pointer-coarse:after:absolute pointer-coarse:after:inset-0 pointer-coarse:after:m-auto pointer-coarse:after:min-h-8 pointer-coarse:after:min-w-8";function Ta(e){let{t}=z(),[o]=ct();if(!kf())return e.children;let r=()=>{let a=o.getRootElement()?.contains(document.activeElement)??!1;o.update(()=>{let s=Ca(e.nodeKey);s!==null&&(a&&s.selectPrevious(),s.remove())}),e.onRemoved?.()};return v("span",{className:_3,children:[e.children,l("button",{type:"button",contentEditable:!1,tabIndex:-1,"aria-label":t("composer.removeChip",{label:e.label}),className:O3,onMouseDown:a=>a.preventDefault(),onClick:a=>{a.preventDefault(),a.stopPropagation(),r()},children:l(dt,{"aria-hidden":"true",className:"size-[calc(0.86em*0.86)]"})})]})}function F3(e){return(e.comment??e.text).replace(/\s+/g," ").trim()}var ol=class e extends lr{__quote;__source;static getType(){return"composer-quote"}static clone(t){return new e(t.__quote,t.__source,t.__key)}static importJSON(t){return Ef(t.quote,t.source).updateFromJSON(t)}constructor(t,o,n){super(n),this.__quote=t,this.__source=o}exportJSON(){return{...super.exportJSON(),quote:this.__quote,source:this.__source,type:"composer-quote",version:1}}getTextContent(){return this.__source}decorate(){return l(B3,{nodeKey:this.getKey(),quote:this.__quote,source:this.__source})}};function Ef(e,t){return ya(new ol(e,t))}function B3(e){let{t}=z(),[o]=ct(),n=vo(),r=n?.data.assistantQuotes??null,[a,s]=q(!1),[i,d]=q(e.quote.comment??""),[c,u]=Ge(n?.threadKey??"",null,{namespace:Yu});H(()=>{c===null||c!==e.source||(u(null),d(e.quote.comment??""),s(!0))},[c,e.quote.comment,e.source,u]);let m=F3(e.quote),p=()=>{if(s(!1),r===null)return;let f=r.withComment(e.quote,i),g=r.serialize(f);g!==null&&o.update(()=>{let h=Ca(e.nodeKey);h instanceof ol&&h.replace(Ef(f,g))})};return l(Ta,{nodeKey:e.nodeKey,label:m,children:v(nn,{open:a,onOpenChange:f=>{f&&d(e.quote.comment??""),s(f)},children:[l(an,{render:v("span",{className:sn,contentEditable:!1,spellCheck:!1,role:"button",tabIndex:-1,"data-composer-quote-chip":"true","aria-label":t("composer.quote.chipLabel",{text:m}),children:[l(hr,{"aria-hidden":"true",className:Fo}),l("span",{className:Bo,children:m})]})}),l(rn,{side:"top",align:"start",className:"w-96 max-w-[calc(100vw-2rem)]",children:v("div",{className:"flex flex-col gap-2",children:[l("div",{className:"line-clamp-6 whitespace-pre-wrap border-l-2 border-border ps-2 text-muted-foreground text-sm",children:e.quote.text}),l(Sb,{value:i,autoFocus:!0,rows:3,placeholder:t("composer.quote.commentPlaceholder"),"aria-label":t("composer.quote.commentLabel"),onChange:f=>d(f.target.value),onKeyDown:f=>{f.key==="Enter"&&(f.metaKey||f.ctrlKey)&&(f.preventDefault(),p())}}),v("div",{className:"flex justify-end gap-2",children:[l(K,{size:"sm",variant:"ghost",onClick:()=>s(!1),children:t("composer.cancel")}),l(K,{size:"sm",onClick:p,disabled:r===null,children:t("composer.quote.saveComment")})]})]})})]})})}var Uc=class e extends lr{__reference;__source;static getType(){return"composer-thread-reference"}static clone(t){return new e(t.__reference,t.__source,t.__key)}static importJSON(t){return yC(t.reference,t.source).updateFromJSON(t)}constructor(t,o,n){super(n),this.__reference=t,this.__source=o}exportJSON(){return{...super.exportJSON(),reference:this.__reference,source:this.__source,type:"composer-thread-reference",version:1}}getTextContent(){return this.__source}decorate(){return l(H3,{nodeKey:this.getKey(),reference:this.__reference})}};function yC(e,t){return ya(new Uc(e,t))}function H3(e){let{t}=z(),o=vo(),r=Zn()(e.reference.title),a=v("span",{className:sn,contentEditable:!1,spellCheck:!1,"data-composer-thread-reference-chip":"true","aria-label":t("composer.threadReference.chipLabel",{title:r}),children:[l(gr,{"aria-hidden":"true",className:Fo}),l("span",{className:Bo,children:r})]});return l(Ta,{nodeKey:e.nodeKey,label:r,children:v(Pe,{children:[l(Ee,{render:a}),l(Re,{side:"top",className:"max-w-120 whitespace-normal leading-tight",children:l(lp,{reference:e.reference,useMachineLabel:o?.data.threadReferences?.useMachineLabel})})]})})}var vC=[ol,Uc];function Mf(e){return vC.some(t=>e instanceof t)}function U3(e){return{collect:t=>[...e.assistantQuotes.collect(t).map(o=>({start:o.start,end:o.end,createNode:()=>Ef(o.quote,o.source)})),...(e.threadReferences?.collect(t)??[]).map(o=>({start:o.start,end:o.end,createNode:()=>yC(o.reference,o.source)}))].toSorted((o,n)=>o.start-n.start)}}function ks(){let e=vo()?.data??null,t=W(()=>e===null?null:U3(e),[e]),o=E(t);return o.current=t,o}var nl=new Map,$3=32;function iA(e,t){for(nl.delete(e),nl.set(e,t);nl.size>$3;){let o=nl.keys().next().value;if(o===void 0)break;nl.delete(o)}}function z3(e){return{anchor:e.length,focus:e.length}}function _r(e,t,o){let n=nl.get(e);if(n)return iA(e,n),n;let r={cursor:o?.cursor??t.length,expandedCursor:o?.expandedCursor??t.length,selection:o?{anchor:o.cursor,focus:o.cursor}:z3(t),history:hM()};return iA(e,r),r}function rl(e,t,o){let n=_r(e,t);n.cursor=o.cursor,n.expandedCursor=o.expandedCursor,n.selection=o.selection}function lA(e,t,o,n){let r=_r(e,t);r.cursor=o,r.expandedCursor=n}function dA(e,t){let o=e.current,n=[...e.undoStack],r=[...e.redoStack];t(),e.current=o,e.undoStack.splice(0,e.undoStack.length,...n),e.redoStack.splice(0,e.redoStack.length,...r)}function K3(e){let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t>=0?e.slice(t+1):e}function q3(e){return e.replaceAll("\\","\\\\").replaceAll("[","\\[").replaceAll("]","\\]")}function W3(e){return encodeURI(e).replaceAll("(","%28").replaceAll(")","%29").replaceAll("#","%23").replaceAll("?","%3F").replaceAll("\\","%5C")}function Ls(e){return`[${q3(K3(e))}](${W3(e)})`}$();function $c(e){let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t===-1?e:e.slice(t+1)}function cA(e){let t=$c(e);return t.startsWith(".")&&!t.slice(1).includes(".")?"directory":t.includes(".")?"file":"directory"}$();var uA=qe(null),al=uA.Provider;function it(){let e=Pt(uA);if(e===null)throw new Error("Composer API has not been provided.");return e}var Af=Vw({cn:V,usePierreIcons:()=>{let e=it().pierreIcons;return{ready:e.useSpriteReady(),ensureSprite:e.ensureSprite,resolveForEntry:e.resolveForEntry}}});var pA=sn;var mA=Qw({EntryIcon:Af,inferEntryKindFromPath:cA,iconClassName:Fo,labelClassName:Bo,selectableLabelClassName:sT});function Nf(e){return l("span",{className:pA,contentEditable:!1,spellCheck:!1,"data-composer-mention-chip":"true",children:l(mA,{path:e.path,label:$c(e.path),theme:e.theme})})}function Df(e){return v("span",{className:iT,contentEditable:!1,spellCheck:!1,"data-composer-skill-chip":"true",children:[l("span",{"aria-hidden":"true",className:Fo,dangerouslySetInnerHTML:{__html:lT}}),l("span",{className:Bo,children:e.label})]})}function fA(e){let{label:t,tooltipText:o,expired:n=!1}=e;return v(Pe,{children:[l(Ee,{render:v("span",{className:V(sn,n&&"border-destructive/35 bg-destructive/8 text-destructive-foreground"),"data-terminal-context-expired":n?"true":void 0,children:[l(Vo,{className:V(Fo,"size-icon-1",n&&"opacity-100")}),l("span",{className:Bo,children:t})]})}),l(Re,{side:"top",className:"max-w-80 whitespace-pre-wrap leading-tight",children:o})]})}function gA({context:e}){let{t}=z(),o=Rf(e,t),n=Kw(e),r=n?t("pendingContext.terminalExpired",{label:o}):e.text;return l(fA,{label:o,tooltipText:r,expired:n})}function G3(e){let t=[];for(let o of e.split(/[\s:_-]+/))o.length!==0&&t.push(o.charAt(0).toUpperCase()+o.slice(1));return t.join(" ")}function j3(e){return e.replaceAll("\\","/")}function en(e){let t=e.displayName?.trim();return t||G3(e.name)}function hA(e,t){return t?e.filter(xr):[]}function yA(e){let t=j3(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"}}var zc=qe({onRemoveTerminalContext:()=>{}});function V3(e){let t=l(Nf,{path:e.path,theme:J3()});return l(Ta,{nodeKey:e.nodeKey,label:$c(e.path),children:v(Pe,{children:[l(Ee,{render:t}),l(Re,{side:"top",className:"max-w-120 whitespace-normal leading-tight wrap-anywhere",children:e.path})]})})}var Ps=class e extends lr{__path;__source;static getType(){return"composer-mention"}static clone(t){return new e(t.__path,t.__source,t.__key)}static importJSON(t){return Kc(t.path,t.source).updateFromJSON(t)}constructor(t,o=Ls(t),n){super(n),this.__path=t,this.__source=o}exportJSON(){return{...super.exportJSON(),path:this.__path,source:this.__source,type:"composer-mention",version:1}}getTextContent(){return this.__source}decorate(){return l(V3,{nodeKey:this.getKey(),path:this.__path})}};function Kc(e,t){return ya(new Ps(e,t))}function Q3(e){let t=e.shortDescription?.trim();return t||e.description?.trim()||null}function Rs(e){return new Map(e.map(t=>[t.name,{label:en(t),description:Q3(t)}]))}function X3(e){let t=l(Df,{label:e.skillLabel});return l(Ta,{nodeKey:e.nodeKey,label:e.skillLabel,children:e.skillDescription?v(Pe,{children:[l(Ee,{render:t}),l(Re,{side:"top",className:"max-w-120 whitespace-normal leading-tight",children:e.skillDescription})]}):t})}var sl=class e extends lr{__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 CC(t.skillName,t.skillLabel??t.skillName,t.skillDescription??null).updateFromJSON(t)}constructor(t,o,n,r){super(r);let a=t.startsWith("$")?t.slice(1):t;this.__skillName=a,this.__skillLabel=o,this.__skillDescription=n}exportJSON(){return{...super.exportJSON(),skillName:this.__skillName,skillLabel:this.__skillLabel,...this.__skillDescription?{skillDescription:this.__skillDescription}:{},type:"composer-skill",version:1}}getTextContent(){return`$${this.__skillName}`}decorate(){return l(X3,{nodeKey:this.getKey(),skillLabel:this.__skillLabel,skillDescription:this.__skillDescription})}};function CC(e,t,o){return ya(new sl(e,t,o))}function Y3(e){let{t}=z(),{onRemoveTerminalContext:o}=xe(zc);return l(Ta,{nodeKey:e.nodeKey,label:Rf(e.context,t),onRemoved:()=>o(e.context.id),children:l(gA,{context:e.context})})}var dr=class e extends lr{__context;static getType(){return"composer-terminal-context"}static clone(t){return new e(t.__context,t.__key)}static importJSON(t){return xC(t.context)}constructor(t,o){super(o),this.__context=t}exportJSON(){return{...super.exportJSON(),context:this.__context,type:"composer-terminal-context",version:1}}getTextContent(){return mr}decorate(){return l(Y3,{nodeKey:this.getKey(),context:this.__context})}};function xC(e){return ya(new dr(e))}function fn(e){return e instanceof Ps||e instanceof sl||e instanceof dr||Mf(e)}function J3(){return document.documentElement.classList.contains("dark")?"dark":"light"}function bC(e,t){return Number.isFinite(t)?Math.max(0,Math.min(e.length,Math.floor(t))):e.length}function _f(e){return Mf(e)?e.getTextContentSize():1}function CA(e){return e.getTextContentSize()}function Z3(e,t,o){return t+(o>0?_f(e):0)}function eW(e,t,o){return t+(o>0?CA(e):0)}function tW(e,t){let o=e.getParent();if(!o||!_e(o))return null;let n=e.getIndexWithinParent();return t.value===0?{key:o.getKey(),offset:n,type:"element"}:t.value===_f(e)?{key:o.getKey(),offset:n+1,type:"element"}:(t.value-=_f(e),null)}function wC(e){return fn(e)?_f(e):Ke(e)?e.getTextContentSize():Lc(e)?1:_e(e)?e.getChildren().reduce((t,o)=>t+wC(o),0):0}function xA(e){return fn(e)?CA(e):Ke(e)?e.getTextContentSize():Lc(e)?1:_e(e)?e.getChildren().reduce((t,o)=>t+xA(o),0):0}function bA(e,t,o,n){let r=0,a=e;for(;a;){let s=a.getParent();if(!s||!_e(s))break;let i=s.getChildren(),d=a.getIndexWithinParent();for(let c=0;c<d;c+=1){let u=i[c];u&&(r+=o(u))}a=s}if(Ke(e))return r+Math.min(t,e.getTextContentSize());if(fn(e))return n(e,r,t);if(Lc(e))return r+Math.min(t,1);if(_e(e)){let s=e.getChildren(),i=Math.max(0,Math.min(t,s.length));for(let d=0;d<i;d+=1){let c=s[d];c&&(r+=o(c))}return r}return r}function il(e,t){return bA(e,t,wC,Z3)}function qc(e,t){return bA(e,t,xA,eW)}function Of(e,t){if(fn(e))return tW(e,t);if(Ke(e)){let o=e.getTextContentSize();return t.value<=o?{key:e.getKey(),offset:t.value,type:"text"}:(t.value-=o,null)}if(Lc(e)){let o=e.getParent();if(!o)return null;let n=e.getIndexWithinParent();return t.value===0?{key:o.getKey(),offset:n,type:"element"}:t.value===1?{key:o.getKey(),offset:n+1,type:"element"}:(t.value-=1,null)}if(_e(e)){let o=e.getChildren();for(let n of o){let r=Of(n,t);if(r)return r}if(t.value===0)return{key:e.getKey(),offset:o.length,type:"element"}}return null}function Wc(){return Ye().getChildren().reduce((o,n)=>o+wC(n),0)}function Ia(e){let t=Ye(),o=Wc(),r={value:Math.max(0,Math.min(e,o))},a=Of(t,r)??{key:t.getKey(),offset:t.getChildren().length,type:"element"},s=Cs();s.anchor.set(a.key,a.offset,a.type),s.focus.set(a.key,a.offset,a.type),mn(s)}function ll(e,t){let o=Ye(),n=Wc(),r=Math.max(0,Math.min(e,n)),a=Math.max(0,Math.min(t,n)),s={value:r},i={value:a},d=Of(o,s)??{key:o.getKey(),offset:o.getChildren().length,type:"element"},c=Of(o,i)??{key:o.getKey(),offset:o.getChildren().length,type:"element"},u=Cs();u.anchor.set(d.key,d.offset,d.type),u.focus.set(c.key,c.offset,c.type),mn(u)}function TC(e){if(!ye(e))return null;let t=e.anchor.getNode(),o=e.focus.getNode(),n=qc(t,e.anchor.offset),r=qc(o,e.focus.offset);return{start:Math.min(n,r),end:Math.max(n,r)}}function IC(e){return ye(e)?e.getNodes().some(t=>fn(t)):!1}function dl(e){let t=Te();if(!ye(t)||!t.isCollapsed())return e;let o=t.anchor.getNode(),n=il(o,t.anchor.offset),r=Wc();return Math.max(0,Math.min(n,r))}function wA(e){let t=Te();if(!ye(t)||!t.isCollapsed())return e;let o=t.anchor.getNode(),n=qc(o,t.anchor.offset),r=Ye().getTextContent().length;return Math.max(0,Math.min(n,r))}function SC(e){let t=Te();return ye(t)?{anchor:il(t.anchor.getNode(),t.anchor.offset),focus:il(t.focus.getNode(),t.focus.offset)}:e}function vA(e,t){let o=t.split(`
3567
+ `);for(let n=0;n<o.length;n+=1){let r=o[n]??"";r.length>0&&e.append(Nn(r)),n<o.length-1&&e.append(vs())}}function oW(e,t,o){let n=0;for(let r of o?.collect(t)??[])vA(e,t.slice(n,r.start)),e.append(r.createNode()),n=r.end;vA(e,t.slice(n))}function Gc(e,t,o,n){let r=Ye();r.clear();let a=pn();r.append(a);let s=Dr(e,t);for(let i of s){if(i.type==="mention"){a.append(Kc(i.path,i.source));continue}if(i.type==="skill"){let d=o.get(i.name);a.append(CC(i.name,d?.label??en({name:i.name}),d?.description??null));continue}if(i.type==="terminal-context"){i.context&&a.append(xC(i.context));continue}oW(a,i.text,n)}}function kC(e){return e instanceof dr?[e.__context.id]:_e(e)?e.getChildren().flatMap(t=>kC(t)):[]}$();function cl(e){return/mac|iphone|ipad|ipod/i.test(e)}function Es(){let e=globalThis.crypto.getRandomValues(new Uint8Array(16));e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t="";for(let o of e)t+=o.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 TA(e,t){return e.registerCommand(ef,o=>{if(!(o instanceof ClipboardEvent)||o.clipboardData===null||o.clipboardData.files.length>0)return!1;let n=o.clipboardData.getData("text/plain");if(n.length===0)return!1;let r=t.readLinkChips?.()?.collect(n)??[],a=Hc(`${n}
3568
3568
  `).filter(p=>p.type==="mention"&&p.end<=n.length&&!r.some(f=>p.start<f.end&&f.start<p.end));if(a.length===0&&r.length===0)return!1;let s=[...a.map(p=>({start:p.start,end:p.end,isMention:!0,create:()=>t.createMentionNode(p.value,p.source)})),...r.map(p=>({start:p.start,end:p.end,isMention:!1,create:()=>p.createNode()}))].sort((p,f)=>p.start-f.start),i=Te();if(!ye(i))return!1;let d=[],c=p=>{let f=p.split(`
3569
- `);for(let g=0;g<f.length;g+=1){let h=f[g]??"";h.length>0&&d.push(Nn(h)),g<f.length-1&&d.push(vs())}},u=s[0];if(u?.isMention&&u.start===0){let p=i.isBackward()?i.focus:i.anchor,f=t.getExpandedAbsoluteOffsetForPoint(p.getNode(),p.offset),g=Ye().getTextContent().slice(f-1,f);g.length>0&&!/\s/.test(g)&&d.push(Nn(" "))}let m=0;for(let p of s)p.start<m||(p.start>m&&c(n.slice(m,p.start)),d.push(p.create()),m=p.end);return m<n.length?c(n.slice(m)):s.at(-1)?.isMention&&d.push(Nn(" ")),i.insertNodes(d),o.preventDefault(),!0},Zo)}function wA(){let[e]=ct();return H(()=>{let t=r=>{if(r.inputType!=="insertText"||!r.data||r.isComposing)return;let a=r.data;e.getEditorState().read(()=>{let i=Te();if(!ye(i)||!i.isCollapsed()||i.anchor.type!=="element")return!1;let d=i.anchor.getNode();return _e(d)&&gn(d.getChildAtIndex(i.anchor.offset))})&&(r.preventDefault(),r.stopImmediatePropagation(),e.update(()=>{let i=Te();ye(i)&&i.insertText(a)},{discrete:!0}))},o=null,n=e.registerRootListener((r,a)=>{a?.removeEventListener("beforeinput",t,!0),r?.addEventListener("beforeinput",t,!0),o=r});return()=>{o?.removeEventListener("beforeinput",t,!0),n()}},[e]),null}function TA(e){let[t]=ct();return H(()=>{let o=(d,c)=>{if(!e.onCommandKeyDown||!c)return!1;if(d==="Enter"&&(c.isComposing||c.keyCode===229))return c.stopPropagation(),!0;let u=e.onCommandKeyDown(d,c);return u&&(c.preventDefault(),c.stopPropagation()),u},n=t.registerCommand(bR,d=>o("ArrowDown",d),Zo),r=t.registerCommand(wR,d=>o("ArrowUp",d),Zo),a=t.registerCommand(Jm,d=>o("Enter",d),Zo),s=t.registerCommand(Zm,d=>o("Tab",d),Zo),i=t.registerCommand(IR,d=>o("Escape",d),Zo);return()=>{n(),r(),a(),s(),i()}},[t,e]),null}function IA(){let[e]=ct();return H(()=>{let t=e.registerCommand(Vm,n=>{let r=null;if(e.getEditorState().read(()=>{let s=Te();if(!ye(s)||!s.isCollapsed())return;let i=dl(0);if(i<=0)return;let d=Ye().getTextContent();tl(d,i,"left")&&(r=i-1)}),r===null)return!1;let a=r;return n?.preventDefault(),n?.stopPropagation(),e.update(()=>{Ia(a)}),!0},Zo),o=e.registerCommand(Qm,n=>{let r=null;if(e.getEditorState().read(()=>{let s=Te();if(!ye(s)||!s.isCollapsed())return;let i=dl(0),d=Wc();if(i>=d)return;let c=Ye().getTextContent();tl(c,i,"right")&&(r=i+1)}),r===null)return!1;let a=r;return n?.preventDefault(),n?.stopPropagation(),e.update(()=>{Ia(a)}),!0},Zo);return()=>{t(),o()}},[e]),null}function SA(){let[e]=ct();return H(()=>e.registerCommand(TR,t=>{if(!cl(navigator.platform)||t.key!=="Home"&&t.key!=="End"||t.altKey||t.metaKey||t.ctrlKey||t.isComposing)return!1;let o=e.getRootElement(),n=window.getSelection(),r=n?.anchorNode;return!o||!n||!r||!o.contains(r)||n.rangeCount===0||typeof n.modify!="function"?!1:(t.preventDefault(),t.stopPropagation(),n.modify(t.shiftKey?"extend":"move",t.key==="Home"?"backward":"forward","lineboundary"),e.update(()=>{fn(HP(n,e))}),!0)},Zo),[e]),null}function kA(){let[e]=ct();return H(()=>e.registerUpdateListener(({editorState:t})=>{let o=null;t.read(()=>{let n=Te();if(!ye(n)||!n.isCollapsed())return;let r=n.anchor.getNode();if(!gn(r)||n.anchor.offset===0)return;o=il(r,0)+1}),o!==null&&queueMicrotask(()=>{e.update(()=>{Ia(o)})})}),[e]),null}function LA(e,t,o){if(!gn(e))return!1;let n=il(e,0),r=e instanceof dr;return e.remove(),r&&o(e.__context.id),Ia(t(n,r)),!0}function eW(){let e=Te();if(!ye(e)||!e.isCollapsed())return null;let t=e.anchor.getNode(),o=e.anchor.offset,n=gn(t)?o===0?t:t.getNextSibling():Ke(t)?o===t.getTextContentSize()?t.getNextSibling():null:_e(t)?t.getChildAtIndex(o):null;return gn(n)?n:null}function tW(e){return LA(eW(),t=>t,e)}function PA(){let[e]=ct(),{onRemoveTerminalContext:t}=xe(zc);return H(()=>{let o=e.registerCommand(Xm,r=>{let a=Te();if(!ye(a)||!a.isCollapsed())return!1;let s=a.anchor.getNode(),i=dl(0),d=c=>{let u=LA(c,(m,p)=>p?i:m,t);return u&&r?.preventDefault(),u};if(d(s))return!0;if(Ke(s)){if(a.anchor.offset>0)return!1;if(d(s.getPreviousSibling()))return!0;let c=s.getParent();if(_e(c)){let u=s.getIndexWithinParent();if(u>0&&d(c.getChildAtIndex(u-1)))return!0}return!1}if(_e(s)){let c=a.anchor.offset-1;if(c>=0&&d(s.getChildAtIndex(c)))return!0}return!1},Zo),n=e.registerCommand(Ym,r=>{let a=tW(t);return a&&r?.preventDefault(),a},Zo);return()=>{o(),n()}},[e,t]),null}function RA(){let[e]=ct();return H(()=>{let t=new Set,o=e.getRootElement()===document.activeElement,n=d=>{for(let c of t)d.has(c)||e.getElementByKey(c)?.removeAttribute("data-composer-chip-selected");for(let c of d)e.getElementByKey(c)?.setAttribute("data-composer-chip-selected","true");t=d},r=()=>{let d=new Set;return e.getEditorState().read(()=>{let c=Te();if(ye(c)&&!c.isCollapsed())for(let u of c.getNodes())u instanceof xa&&d.add(u.getKey())}),d},a=e.registerUpdateListener(()=>{n(o?r():new Set)}),s=e.registerCommand(hR,()=>(o=!0,n(r()),!1),Qi),i=e.registerCommand(aR,()=>(o=!1,n(new Set),!1),Qi);return()=>{a(),s(),i()}},[e]),null}function EA(){let[e]=ct(),t=ks();return H(()=>bA(e,{createMentionNode:Kc,getExpandedAbsoluteOffsetForPoint:qc,readLinkChips:()=>t.current}),[e]),null}$();var oW=[["(",")"],["[","]"],["{","}"],["'","'"],['"','"'],["\u201C","\u201D"],["`","`"],["<",">"],["\xAB","\xBB"],["*","*"],["_","_"]],AA=new Map(oW),MA=AA.get("`")??null;function NA(e){let[t]=ct(),o=E(e.terminalContexts),n=E(Rs(e.skills)),r=ks(),a=E(null),s=E(null);H(()=>{o.current=e.terminalContexts},[e.terminalContexts]),H(()=>{n.current=Rs(e.skills)},[e.skills]);let i=xg(d=>{let c=AA.get(d),u=a.current;if(!c)return a.current=null,!1;let m=!1;return t.update(()=>{let p=u??(()=>{let y=Te();if(!ye(y)||y.isCollapsed()||IC(y))return null;let x=TC(y);if(!x||x.start===x.end)return null;let C=Ye().getTextContent();return gC(C,x.start,x.end)?null:{value:C,expandedStart:x.start,expandedEnd:x.end}})();if(!p||!c)return;let f=p.value.slice(p.expandedStart,p.expandedEnd),g=`${p.value.slice(0,p.expandedStart)}${d}${f}${c}${p.value.slice(p.expandedEnd)}`;Gc(g,o.current,n.current,r.current);let h=uo(g,p.expandedStart);ll(h+d.length,h+d.length+f.length),m=!0,a.current=null}),m});return H(()=>{let d=h=>{if(s.current){if(h.key==="Dead"||h.key===" "||h.code==="Space")return;s.current=null}if(h.defaultPrevented||h.isComposing||h.metaKey||h.ctrlKey){a.current=null,s.current=null;return}t.getEditorState().read(()=>{let y=Te();if(!ye(y)||y.isCollapsed()){a.current=null,s.current=null;return}if(IC(y)){a.current=null,s.current=null;return}let x=TC(y);if(!x||x.start===x.end){a.current=null,s.current=null;return}let C=Ye().getTextContent();if(gC(C,x.start,x.end)){a.current=null,s.current=null;return}let b={value:C,expandedStart:x.start,expandedEnd:x.end};a.current=b,s.current=null})},c=h=>{if(h.inputType==="insertCompositionText"&&h.data==="`"&&MA!==null&&a.current){s.current=a.current;return}if(s.current||h.inputType==="insertCompositionText")return;if(typeof h.data!="string"){a.current=null;return}let y=h.inputType==="insertText"?h.data:null;if(!y||y.length!==1){a.current=null;return}i(y)&&(h.preventDefault(),h.stopPropagation(),h.stopImmediatePropagation())},u=h=>{queueMicrotask(()=>{t.update(()=>{let y=s.current;if(!y)return;let x=Ye().getTextContent(),C=MA;if(C===null){s.current=null;return}let b=`${y.value.slice(0,y.expandedStart)}\`${y.value.slice(y.expandedEnd)}`;if(x!==b){h?.finalAttempt&&(a.current=null,s.current=null);return}let L=y.value.slice(y.expandedStart,y.expandedEnd),w=uo(x,y.expandedStart);ll(w,w+1);let k=Te();if(!ye(k)){a.current=null,s.current=null;return}k.insertText(`\`${L}${C}`),ll(w+1,w+1+L.length),a.current=null,s.current=null},{tag:zo})})},m=h=>{let y=h;(y.inputType==="insertText"||y.inputType==="insertCompositionText")&&u()},p=()=>{u({finalAttempt:!0})},f=null,g=t.registerRootListener((h,y)=>{y?.removeEventListener("keydown",d),y?.removeEventListener("beforeinput",c,!0),y?.removeEventListener("input",m),y?.removeEventListener("compositionend",p),h?.addEventListener("keydown",d),h?.addEventListener("beforeinput",c,!0),h?.addEventListener("input",m),h?.addEventListener("compositionend",p),f=h});return()=>{f&&(f.removeEventListener("keydown",d),f.removeEventListener("beforeinput",c,!0),f.removeEventListener("input",m),f.removeEventListener("compositionend",p)),g()}},[t]),null}var nW=`composer-editor-${Math.random().toString(36).slice(2)}`,LC="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)]",PC="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";function DA(e){let t=Ye().getTextContent(),o=ir(t,e.cursor),n=bC(t,e.expandedCursor);return{value:t,cursor:ir(t,dl(o)),expandedCursor:bC(t,xA(n)),selection:SC(e.selection),terminalContextIds:kC(Ye())}}function rW({documentKey:e,value:t,cursor:o,terminalContexts:n,skills:r,disabled:a,placeholder:s,className:i,ariaLabel:d,onRemoveTerminalContext:c,onChange:u,onCommandKeyDown:m,onPaste:p,editorRef:f}){let[g]=ct(),h=E(u);h.current=u;let y=ir(t,o),x=_r(e,t,{cursor:y,expandedCursor:en(t,y)}),C=ir(t,x.cursor),b=eA(n),L=E(b),w=tA(r),k=E(w),I=E(Rs(r)),T=ks(),S=E({value:t,cursor:C,expandedCursor:x.expandedCursor,selection:x.selection,terminalContextIds:n.map(D=>D.id)}),P=E(e),A=x.history,N=E(!1),B=W(()=>({onRemoveTerminalContext:c}),[c]);fe(()=>{I.current=Rs(r)},[r]),H(()=>{g.setEditable(!a)},[a,g]),fe(()=>{let D=ir(t,o),J=S.current,G=P.current,M=G!==e,X=L.current!==b,F=k.current!==w;if(!M&&J.value===t&&J.cursor===D&&!X&&!F)return;if(M){let Z=J.selection;g.getEditorState().read(()=>{Z=SC(Z)}),rl(G,J.value,{cursor:J.cursor,expandedCursor:J.expandedCursor,selection:Z})}let ee=_r(e,t),Y=M?ee.selection:{anchor:D,focus:D};S.current={value:t,cursor:M?ee.cursor:D,expandedCursor:M?ee.expandedCursor:en(t,D),selection:Y,terminalContextIds:n.map(Z=>Z.id)},P.current=e,L.current=b,k.current=w;let ae=g.getRootElement(),te=!!(ae&&document.activeElement===ae);if(!M&&J.value===t&&!X&&!F&&!te)return;let de=M?_r(G,J.value).history:null;N.current=!0;let ge=t==="",ne=()=>g.update(()=>{let Z=M||J.value!==t||X||F;Z&&Gc(t,n,I.current,T.current),M?ll(Y.anchor,Y.focus):(Z||te)&&Ia(D)},{discrete:!0,tag:ge?[zo,yv,DR]:zo});de?iA(de,ne):ne(),ge&&te&&requestAnimationFrame(()=>setTimeout(()=>{document.activeElement===g.getRootElement()&&g.update(()=>{let Z=Te();ye(Z)&&(Z.dirty=!0)},{tag:[zo,yv]})},0)),rl(e,t,S.current),queueMicrotask(()=>{N.current=!1})},[o,e,g,w,n,b,t]);let O=R(D=>{let J=g.getRootElement();if(!J)return;let G=ir(S.current.value,D);J.focus({preventScroll:!0}),g.update(()=>{Ia(G)}),S.current={value:S.current.value,cursor:G,expandedCursor:en(S.current.value,G),selection:{anchor:G,focus:G},terminalContextIds:S.current.terminalContextIds},rl(P.current,S.current.value,{cursor:S.current.cursor,expandedCursor:S.current.expandedCursor,selection:S.current.selection}),h.current(S.current.value,G,S.current.expandedCursor,!1,S.current.terminalContextIds)},[g]),j=R(()=>{let D=S.current;return g.getEditorState().read(()=>{D=DA(S.current)}),S.current=D,rl(P.current,D.value,D),D},[g]);pr(f,()=>({focus:()=>{O(S.current.cursor)},focusAt:O,focusAtEnd:()=>{O(uo(S.current.value,S.current.value.length))},readSnapshot:j,readSelectedTextLength:()=>oA(g),removeSelectedText:()=>rA(g),isCaretOnVisualEdge:D=>nA(g,D)}),[g,O,j]);let U=R(D=>{D.read(()=>{let J=DA(S.current),{value:G,cursor:M,expandedCursor:X,selection:F,terminalContextIds:ee}=J,Y=S.current;if(Y.value===G&&Y.cursor===M&&Y.expandedCursor===X&&Y.selection.anchor===F.anchor&&Y.selection.focus===F.focus&&Y.terminalContextIds.length===ee.length&&Y.terminalContextIds.every((te,de)=>te===ee[de])||N.current)return;S.current=J,rl(P.current,G,{cursor:M,expandedCursor:X,selection:F});let ae=tl(G,M,"left")||tl(G,M,"right");h.current(G,M,X,ae,ee)})},[]);return l(zc,{value:B,children:v("div",{className:V(LC,"grid"),children:[l(KM,{contentEditable:l(_E,{className:V(PC,"col-start-1 row-start-1 min-w-0",i),"data-testid":"composer-editor","data-composer-prompt":"true",spellCheck:!1,autoCorrect:"off",autoCapitalize:"off","aria-placeholder":s,...d?{"aria-label":d}:{},placeholder:l("span",{}),onPasteCapture:p}),placeholder:n.length>0?null:l("div",{className:"pointer-events-none col-start-1 row-start-1 min-w-0 select-none whitespace-pre-wrap wrap-break-word leading-relaxed text-placeholder",children:s}),ErrorBoundary:OE}),l(gM,{onChange:U}),l(TA,{...m?{onCommandKeyDown:m}:{}}),l(wA,{}),l(NA,{terminalContexts:n,skills:r}),l(SA,{}),l(IA,{}),l(kA,{}),l(PA,{}),l(EA,{}),l(RA,{}),l(mM,{externalHistoryState:A},e)]})})}function aW(e){let[t]=ct(),o=E(e),n=E(e),[r,a]=q(e.documentKey);r===e.documentKey&&(o.current=e),n.current=e,fe(()=>{r===e.documentKey||t.isComposing()||a(e.documentKey)},[r,t,e.documentKey]),H(()=>{let i=null,d=()=>{let u=n.current.documentKey;a(m=>m===u?m:u)},c=t.registerRootListener((u,m)=>{m?.removeEventListener("compositionend",d),u?.addEventListener("compositionend",d),i=u});return()=>{i?.removeEventListener("compositionend",d),c()}},[t]);let s=r===e.documentKey?e:o.current;return l(rW,{...s})}function ul({documentKey:e,value:t,cursor:o,terminalContexts:n,skills:r,disabled:a,placeholder:s,className:i,ariaLabel:d,onRemoveTerminalContext:c,onChange:u,onCommandKeyDown:m,onPaste:p,editorRef:f}){let g=E(t),h=E(n),y=E(Rs(r)),x=E(ks().current),C=W(()=>({namespace:"ycodium-composer-editor",editable:!0,nodes:[Ps,sl,dr,...vC],editorState:()=>{Gc(g.current,h.current,y.current,x.current)},onError:b=>{throw b}}),[]);return l(QR,{initialConfig:C,children:l(aW,{documentKey:e,value:t,cursor:o,terminalContexts:n,skills:r,disabled:a,placeholder:s,onRemoveTerminalContext:c,onChange:u,onPaste:p,editorRef:f,...m?{onCommandKeyDown:m}:{},...i?{className:i}:{},...d?{ariaLabel:d}:{}})},nW)}function _A(e){return typeof e=="object"&&e!==null&&"then"in e&&typeof e.then=="function"}function OA(e){return _A(e)?Promise.resolve(e).then(OA):e===!1?!1:e==null?!0:e.accepted}function jc(e,t,o){let n=e.trim().length-t;return n<=0?null:o("composer.promptTooLong",{count:n,excess:n.toLocaleString("en-US"),max:t.toLocaleString("en-US")})}function RC(e){return e.submissionTarget==="provider-turn"?jc(e.providerInput??e.prompt,e.maxInputChars,e.t):null}function FA(e){return _A(e)}function BA(e){let t=RC(e);if(t)return e.event?.preventDefault(),{validationMessage:t,didDispatch:!1};let o=OA(e.onSend(e.event));return typeof o!="boolean"?o.then(n=>(n||e.event?.preventDefault(),{validationMessage:null,didDispatch:n})):(o||e.event?.preventDefault(),{validationMessage:null,didDispatch:o})}var bo=new Map;function sW(e,t,o){return`${e}\0${t}\0${o??"none"}`}function EC(e,t){bo.delete(e),bo.set(e,t)}function pl(e,t){if(bo.get(e)===t){if(t.operationLeases>0){t.disposeRequested=!0;return}t.releaseAuthorityWatch?.(),t.releaseAuthorityWatch=void 0,bo.delete(e);for(let o of t.state.added)t.releaseUpload(o.id),URL.revokeObjectURL(o.previewUrl);for(let o of t.listeners)o()}}function iW(e){if(bo.size<=100)return;let t=Array.from(bo);for(let[o,n]of t){if(bo.size<=100)return;o===e||n.committed||n.listeners.size>0||n.operationLeases>0||pl(o,n)}for(let[o,n]of t){if(bo.size<=100)return;o===e||n.listeners.size>0||n.operationLeases>0||pl(o,n)}}function Ff(){queueMicrotask(()=>iW())}function HA(e,t,o,n,r=void 0){let a=o.management?.revision??null,s=sW(e,o.intentId,a),i=bo.get(s);if(i)return i.releaseUpload=n.releaseUpload,i.watchAuthority=r,i.state;let d={key:s,inputKey:e,environmentId:t,intentId:o.intentId,revision:a,text:o.management?.text??o.text??"",retained:o.management?.attachments??[],added:[],saving:!1,error:null},c={state:d,listeners:new Set,releaseUpload:n.releaseUpload,operationLeases:0,committed:!1,disposeRequested:!1,watchAuthority:r,releaseAuthorityWatch:void 0};return bo.set(s,c),d}function UA(e,t){let o=bo.get(e);return o?(o.releaseAuthorityWatch===void 0&&o.watchAuthority!==void 0&&(o.releaseAuthorityWatch=o.watchAuthority({threadKey:o.state.inputKey,intentId:o.state.intentId,revision:o.state.revision,onInvalid:()=>pl(e,o)})),o.committed=!0,EC(e,o),o.listeners.add(t),Ff(),()=>{o.listeners.delete(t),Ff()}):()=>{}}function Ms(e,t){let o=bo.get(e);if(!o)return;o.committed=!0;let n=t(o.state);if(n!==o.state){o.state=n,EC(e,o);for(let r of o.listeners)r()}}function Bf(e){return bo.get(e)?.state}function $A(e){let t=bo.get(e);if(!t)return null;t.committed=!0,t.operationLeases+=1,EC(e,t);let o=!1;return()=>{if(!o){if(o=!0,t.operationLeases=Math.max(0,t.operationLeases-1),t.operationLeases===0&&t.disposeRequested){pl(e,t);return}Ff()}}}function Hf(e){let t=bo.get(e);t&&pl(e,t)}function zA(e,t){let o=new Map(t.flatMap(n=>n.waiting&&n.management!==void 0?[[n.intentId,n.management.revision]]:[]));for(let[n,r]of bo)r.state.inputKey===e&&o.get(r.state.intentId)!==r.state.revision&&pl(n,r);Ff()}var lW=[],dW=[],cW=()=>{};function KA({entry:e,current:t,inputKey:o,environmentId:n,unavailable:r,attachments:a,watchEditorAuthority:s,onEdit:i,onClose:d}){let{t:c}=z(),u=HA(o,n,e,a,s),m=Go(D=>UA(u.key,D),()=>Bf(u.key)??u,()=>Bf(u.key)??u),{key:p,text:f,retained:g,added:h,saving:y,error:x}=m,C=E(null),[b,L]=q(()=>f.length),w=Co()?.data.assistantQuotes??null,k=D=>jc(w?w.expandForProvider(D):D,a.limits.maxInputChars,c),I=k(f),T=E(null),S=a.useUploadStatuses(),P=W(()=>g.map(D=>D.id),[g]),A=a.useAssetUrls(n,P),N=!t?.management||t.management.revision!==e.management?.revision;H(()=>{t===void 0&&(Hf(p),d())},[t,p,d]);let B=()=>{y||(Hf(p),d())},O=D=>{if(y||r||N)return;let J=null,G=[...h];for(let M of D){let X=M.type||"application/octet-stream";if(M.size===0){J=c("attachments.empty",{name:M.name});continue}let F=a.makeImageAttachment({id:a.randomUUID(),name:M.name,mimeType:X,sizeBytes:M.size,file:M});G.push(F),a.startUpload({environmentId:n,image:F})}Ms(p,M=>({...M,added:G,error:J}))},j=async()=>{let D=Bf(p);if(!D||D.saving||r||N||!D.text.trim()&&D.retained.length+D.added.length===0||k(D.text)!==null)return;let J=$A(p);if(J!==null){Ms(p,G=>({...G,saving:!0,error:null}));try{await a.awaitUploads(D.added.map(M=>M.id));let G=a.getUploadedAttachments({environmentId:n,images:D.added});if(!G)throw new Error(c("turnQueue.uploadFailed"));await i(e,{text:D.text,attachments:[...D.retained,...G]}),Hf(p),d()}catch(G){Ms(p,M=>({...M,saving:!1,error:G instanceof Error?G.message:c("turnQueue.actionFailed")}))}finally{J()}}},U=[...g.map((D,J)=>({...D,previewUrl:A[J],added:!1})).filter(D=>D.source?._tag!=="thread-reference"),...h.map(D=>({...D,added:!0}))];return l(Js,{open:!0,onOpenChange:D=>{D||B()},children:v(ei,{className:"max-w-2xl","data-queued-message-editor":!0,initialFocus:()=>(C.current?.focusAtEnd(),!1),children:[v(Hu,{children:[l(ti,{children:c("turnQueue.editTitle")}),l(Zs,{children:c("turnQueue.editDescription")})]}),v("div",{className:"max-h-[60dvh] space-y-3 overflow-y-auto px-6 pb-4",onDragOver:D=>{D.dataTransfer.types.includes("Files")&&D.preventDefault()},onDrop:D=>{D.dataTransfer.files.length&&(D.preventDefault(),D.stopPropagation(),O(Array.from(D.dataTransfer.files)))},children:[l("div",{className:"rounded-lg border border-input bg-background px-3 py-2 focus-within:border-ring focus-within:ring-[3px] focus-within:ring-ring/24",children:l(ul,{editorRef:C,documentKey:`queue-editor\0${p}`,value:f,cursor:b,terminalContexts:lW,skills:dW,disabled:y,placeholder:c("turnQueue.editText"),ariaLabel:c("turnQueue.editText"),className:"max-h-[40dvh]",onRemoveTerminalContext:cW,onChange:(D,J)=>{L(J),Ms(p,G=>({...G,text:D}))},onCommandKeyDown:(D,J)=>D!=="Enter"||!(J.metaKey||J.ctrlKey)?!1:(j(),!0),onPaste:D=>{D.clipboardData.files.length&&(D.preventDefault(),O(Array.from(D.clipboardData.files)))}})}),I?l("p",{role:"alert",className:"text-sm text-destructive-foreground",children:I}):null,l("ul",{className:"flex flex-wrap gap-2",children:U.map(D=>v("li",{className:"flex max-w-full items-center gap-2 rounded-md border border-border px-2 py-1.5",children:[D.type==="image"&&D.previewUrl?l("img",{src:D.previewUrl,alt:D.name,className:"size-12 rounded object-cover"}):l(Vo,{className:"size-4 shrink-0"}),v("div",{className:"min-w-0 text-xs",children:[l("p",{className:"max-w-48 break-words",children:D.name}),l("p",{className:"text-muted-foreground",children:a.formatAttachmentSize(D.sizeBytes)}),D.added&&S.get(D.id)!=="ready"?l("p",{children:c(S.get(D.id)==="failed"?"turnQueue.uploadFailed":"turnQueue.uploading")}):null,D.added&&S.get(D.id)==="failed"?l(K,{size:"xs",variant:"ghost",disabled:y||r||N,onClick:()=>{let J=h.find(G=>G.id===D.id);J&&a.retryUpload({environmentId:n,image:J})},children:c("turnQueue.retryUpload")}):null]}),l(K,{size:"icon-xs",variant:"ghost","aria-label":c("turnQueue.removeAttachment",{name:D.name}),disabled:y||N,onClick:()=>{D.added?(a.releaseUpload(D.id),D.previewUrl&&URL.revokeObjectURL(D.previewUrl),Ms(p,J=>({...J,added:J.added.filter(G=>G.id!==D.id)}))):Ms(p,J=>({...J,retained:J.retained.filter(G=>G.id!==D.id)}))},children:l(dt,{className:"size-3.5"})})]},D.id))}),l("input",{ref:T,type:"file",multiple:!0,className:"hidden","aria-label":c("turnQueue.addAttachments"),onChange:D=>{O(Array.from(D.target.files??[])),D.target.value=""}}),v(K,{size:"sm",variant:"outline",disabled:y||r||N,onClick:()=>T.current?.click(),children:[l(Vo,{className:"size-4"}),c("turnQueue.addAttachments")]}),N?l("p",{role:"alert",className:"text-sm text-muted-foreground",children:c("turnQueue.editStale")}):null,x?l("p",{role:"alert",className:"text-sm text-destructive-foreground",children:x}):null]}),v(Bu,{children:[l(K,{variant:"ghost",disabled:y,onClick:B,children:c("turnQueue.discardEdit")}),l(K,{disabled:y||r||N||I!==null||!f.trim()&&U.length===0,onClick:()=>{j()},children:c(y?"turnQueue.saving":"turnQueue.saveEdit")})]})]})})}$();var On=["approval-required","auto-accept-edits","auto","full-access"];var uW={"approval-required":od,"auto-accept-edits":Gn,auto:jn,"full-access":Wr},pW={"approval-required":"approvalRequired","auto-accept-edits":"autoAcceptEdits",auto:"auto","full-access":"fullAccess"};function ml(){let{t:e}=z();return R(t=>{let o=pW[t];return{mode:t,label:e(`runtimeMode.${o}`),description:e(`runtimeMode.${o}Description`),icon:uW[t]}},[e])}function qA(e){let{t}=z(),o=ml(),{interactionMode:n,runtimeMode:r,nativeModeName:a}=e.sentWith,s=[n===void 0?null:t(n==="plan"?"turnQueue.sentWithPlan":"turnQueue.sentWithNoPlan"),a??(r===void 0?null:o(r).label)].filter(i=>i!=null);return l("p",{className:"text-muted-foreground","data-queued-sent-with":!0,children:t("turnQueue.sentWith",{modes:s.join(", ")})})}function WA(e,t){let o=e.find(a=>a.intentId===t.intentId);if(!o)return e;let n=e.filter(a=>a.intentId!==t.intentId),r=t.beforeIntentId===null?n.length:n.findIndex(a=>a.intentId===t.beforeIntentId);return r<0?e:(n.splice(r,0,o),n)}function GA(e,t,o){if(t===o)return null;let n={intentId:t,beforeIntentId:o,previousOrder:e.map(a=>a.intentId)};return WA(e,n).every((a,s)=>a.intentId===e[s]?.intentId)?null:n}function jA(e,t){if(!e.find(d=>d.intentId===t.intentId)?.management?.canReorder||t.beforeIntentId!==null&&!e.some(d=>d.intentId===t.beforeIntentId))return{entries:e,settled:!0};let n=new Set(e.map(d=>d.intentId)),r=new Set(t.previousOrder),a=t.previousOrder.filter(d=>n.has(d));return e.filter(d=>r.has(d.intentId)).some((d,c)=>d.intentId!==a[c])?{entries:e,settled:!0}:{entries:WA(e,t),settled:!1}}$();$();function mW({entry:e,unavailable:t,onCancel:o}){let{t:n}=z(),r=E(!1),[a,s]=q(!1),[i,d]=q(!1),[c,u]=q(!1);H(()=>{u(!1),d(!1)},[e.status,e.deliveryCertainty]);let m=async()=>{if(!(r.current||t||e.action===null)){r.current=!0,s(!0),d(!1);try{await o(e),u(!1)}catch{d(!0)}finally{r.current=!1,s(!1)}}};return v("li",{className:"space-y-2 border-t border-border py-2","data-turn-queue-message":!0,children:[l("p",{className:"text-muted-foreground",children:n(e.deliveryCertainty==="unknown"?"turnQueue.itemUnknown":e.waitingForCapacity===!0?"turnQueue.itemCapacity":e.status==="queued"?"turnQueue.itemQueued":e.status==="blocked"||e.status==="reconciling"?"turnQueue.itemBlocked":"turnQueue.itemRunning")}),l("p",{className:"whitespace-pre-wrap break-words [overflow-wrap:anywhere]",children:e.text??n("turnQueue.messageUnavailable")}),e.attachmentNames.length>0?l("p",{className:"break-words text-muted-foreground",children:e.attachmentNames.join(", ")}):null,e.action!==null?c&&e.action==="abandon"?v("div",{className:"space-y-2",children:[l("p",{children:n("turnQueue.abandonDescription")}),v("div",{className:"flex flex-wrap gap-2",children:[l(K,{size:"xs",variant:"outline",disabled:a||t,onClick:()=>{m()},children:n("turnQueue.confirmAbandon")}),l(K,{size:"xs",variant:"ghost",disabled:a,onClick:()=>u(!1),children:n("turnQueue.keepWaiting")})]})]}):l(K,{size:"xs",variant:"outline",disabled:a||t,onClick:()=>e.action==="abandon"?u(!0):void m(),children:n(a?"turnQueue.cancelling":e.action==="abandon"?"turnQueue.stopWaiting":"turnQueue.cancelMessage")}):null,i?l("p",{role:"alert",className:"text-destructive-foreground",children:n("turnQueue.actionFailed")}):null]})}function VA({entries:e,unavailable:t,onCancel:o,autoExpand:n=!1}){let{t:r}=z(),[a,s]=q(null),i=a??n,d=ho();return e.length===0?null:v("div",{className:"min-w-0 basis-full space-y-2",children:[l(K,{size:"xs",variant:"ghost","aria-expanded":i,"aria-controls":d,onClick:()=>s(!i),children:r(i?"turnQueue.hideMessages":"turnQueue.showMessages")}),i?l("ol",{id:d,className:"max-h-64 overflow-y-auto overscroll-contain",children:e.map(c=>l(mW,{entry:c,unavailable:t,onCancel:o},c.intentId))}):null]})}function MC({queue:e,environmentId:t=null,unavailable:o=!1,onResume:n,entries:r,onCancel:a}){let{t:s}=z(),i=E(!1),[d,c]=q(!1),[u,m]=q(!1);H(()=>{e.paused||m(!1)},[e.paused]);let p=e.waitingForCapacity??null,g=Nt().useProviderName?.(t,p?.instanceId??"",p?.instanceId?p.agentName:void 0)??s("turnQueue.unknownProvider"),h=e.deliveryUncertain||e.blocked||e.reconciling||p!==null;if(!e.paused&&!h)return null;let y=r?.[0]?.action==="abandon"&&(e.reconciling||e.deliveryUncertain),x=e.paused?s("turnQueue.pausedTitle"):e.deliveryUncertain?s("turnQueue.uncertainTitle"):e.blocked?s("turnQueue.blockedTitle"):e.reconciling?s("turnQueue.reconcilingTitle"):s(p!==null?"turnQueue.capacityTitle":"turnQueue.queuedTitle"),C=e.deliveryUncertain?s("turnQueue.uncertainDescription"):e.blocked?s("turnQueue.blockedDescription"):e.reconciling?s("turnQueue.reconcilingDescription"):e.paused?s("turnQueue.pausedDescription"):p!==null?p.maxProcesses===null?s("turnQueue.capacityDescriptionNoLimit",{agent:g}):s("turnQueue.capacityDescription",{agent:g,count:p.maxProcesses}):null,b=async()=>{if(!(i.current||o||!e.paused)){i.current=!0,c(!0),m(!1);try{await n()}catch{m(!0)}finally{i.current=!1,c(!1)}}};return v("div",{className:V("mx-auto mb-2 flex w-full max-w-3xl select-none flex-wrap items-start gap-2 rounded-md border bg-background px-3 py-2 text-xs text-foreground",p!==null&&!e.paused?"border-border":"border-warning/40"),"data-turn-queue-banner":!0,role:"status",children:[v("div",{className:"min-w-0 flex-1 basis-48 space-y-1",children:[l("p",{className:"font-medium",children:x}),C===null?null:l("p",{className:"text-muted-foreground",children:C}),e.paused&&h?l("p",{className:"text-muted-foreground",children:s("turnQueue.pausedUncertainDescription")}):null,o?l("p",{className:"text-muted-foreground",children:s("turnQueue.disconnected")}):null,u&&e.paused?l("p",{className:"text-destructive-foreground",role:"alert",children:s("turnQueue.resumeFailed")}):null]}),e.paused?l(K,{size:"xs",variant:"outline",disabled:d,softDisabled:o,onClick:()=>{b()},children:s(d?"turnQueue.resuming":"turnQueue.resume")}):null,a&&r?l(VA,{entries:r.filter(L=>L.status!=="queued"),unavailable:o,onCancel:a,autoExpand:y}):null]})}var fW=[t0,e0],gW=[],hW={kind:"user"};function yW({submission:e,environmentId:t}){let{t:o}=z();return v("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:[l("span",{"aria-hidden":"true",className:"grid size-6 shrink-0 place-items-center",children:l("span",{className:"size-1.5 rounded-full bg-muted-foreground/60"})}),l(Eh,{source:hW,environmentId:t}),v("div",{className:"min-w-0 flex-1",children:[l("p",{className:"line-clamp-2 whitespace-pre-wrap break-words [overflow-wrap:anywhere]",children:Dd(e.text)||o("turnQueue.attachmentsOnly")}),e.attachmentNames.length?v("p",{className:"flex items-center gap-1 text-muted-foreground",children:[l(Vo,{className:"size-3 shrink-0"}),l("span",{className:"truncate",children:e.attachmentNames.join(", ")})]}):null]}),l("span",{role:"status",className:"w-[5.25rem] shrink-0 text-end text-muted-foreground",children:o("primaryActions.sendingButtonLabel")})]})}function vW({entry:e,disabled:t,dropPosition:o,dragPosition:n,feedback:r,reducedMotion:a,locked:s,children:i}){let{t:d}=z(),{attributes:c,listeners:u,setNodeRef:m,setActivatorNodeRef:p,transform:f,transition:g,isDragging:h}=Yk({id:e.intentId,disabled:t,transition:a?null:{duration:160,easing:"ease-out"}});return v("li",{ref:m,"data-queue-intent":e.intentId,"data-queue-dragging":h||void 0,"data-queue-feedback":r,style:{transform:na.Transform.toString(f),transition:g},className:V("relative flex items-center gap-1.5 border-t border-border/50 px-2 py-1.5",s?"bg-muted/60":"bg-background hover:bg-accent",h&&"z-10 shadow-md ring-1 ring-primary/50 ring-inset [background:linear-gradient(var(--accent),var(--accent)),var(--background)]",r==="saved"&&"bg-primary/10 ring-1 ring-primary/30 ring-inset",r==="failed"&&"bg-destructive/10"),children:[o?l("span",{"aria-hidden":"true","data-queue-drop-position":o,className:V("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",o==="before"?"top-0":"bottom-0")}):null,s?l("span",{"aria-hidden":"true",className:"size-6 shrink-0"}):l(K,{ref:p,size:"icon-xs",variant:"ghost",className:V("shrink-0 touch-none cursor-grab text-muted-foreground active:cursor-grabbing",(h||r==="saved")&&"bg-primary/10 text-primary"),...c,...u,"aria-label":d("turnQueue.reorderMessage"),title:d("turnQueue.reorderMessage"),softDisabled:t,children:r==="saved"?l(jo,{className:"size-3.5"}):l(Xl,{className:"size-3.5"})}),i,h&&n?l("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:n}):null]})}function QA({inputKey:e,entries:t,pendingSubmissions:o=gW,environmentId:n,unavailable:r,attachments:a,actions:s,onCancel:i,readRecord:d}){let{t:c}=z(),u=Vp("(prefers-reduced-motion: reduce)"),[m,p]=Ge(e,null,{namespace:"turn-queue:editing"}),[f,g]=Ge(e,!1,{namespace:"turn-queue:pending"}),h=$e(e,!1,{namespace:"turn-queue:pending-ref"}),[y,x]=Ge(e,null,{namespace:"turn-queue:error"}),[C,b]=Ge(e,null,{namespace:"turn-queue:drag"}),[L,w]=Ge(e,null,{namespace:"turn-queue:move"}),k=$e(e,!1,{namespace:"turn-queue:reorder-ref"}),[I,T]=Ge(e,null,{namespace:"turn-queue:feedback"}),S=Tk(Ph(Ii,{activationConstraint:{distance:5}}),Ph(Ti,{coordinateGetter:Jk,scrollBehavior:u?"auto":"smooth"})),P=W(()=>t.filter(M=>M.waiting),[t]),A=L?jA(P,L.preview):null,N=A?.entries??P,B=N.length+o.length,O=r||f||L!==null,j=N.findIndex(M=>M.intentId===C?.activeId),U=N.findIndex(M=>M.intentId===C?.overId);H(()=>{zA(e,t)},[t,e]),H(()=>{L!==null&&(r||L.acknowledged&&A?.settled)&&(k.current=!1,w(null),!r&&P.some(M=>M.intentId===L.preview.intentId)&&T({intentId:L.preview.intentId,kind:"saved"}))},[P,L,A?.settled,r]),H(()=>{if(I===null||I.kind==="failed")return;let M=window.setTimeout(()=>T(X=>X===I?null:X),1600);return()=>window.clearTimeout(M)},[I]);let D=async M=>{if(!(h.current||k.current||r)){h.current=!0,g(!0),x(null),T(null);try{await M()}catch(X){x(X instanceof Error?X.message:c("turnQueue.actionFailed"))}finally{h.current=!1,g(!1)}}},J=(M,X)=>D(async()=>{let F=GA(P,M.intentId,X);if(!(F===null||!M.management?.canReorder)){k.current=!0,w({preview:F,acknowledged:!1});try{await s.onReorder(M,X),w(ee=>ee?.preview===F?{...ee,acknowledged:!0}:ee)}catch(ee){throw k.current=!1,w(null),T({intentId:M.intentId,kind:"failed"}),ee}}}),G=r?c("turnQueue.disconnected"):L!==null?c("turnQueue.saving"):C!==null?`${c("turnQueue.dragStarted")} ${U+1}/${N.length}`:I?.kind==="saved"?c("common.action.done"):I?.kind==="cancelled"?c("turnQueue.dragCancelled"):"";return v(oe,{children:[B>0?v("section",{"aria-label":c("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:[v("div",{className:"flex h-7 items-center justify-between gap-3 px-3 py-1.5 text-muted-foreground",children:[l("span",{className:"shrink-0",children:c("turnQueue.queued",{count:B})}),l("span",{role:"status","aria-live":C===null?"polite":"off","data-queue-reorder-status":L?"saving":I?.kind,className:V("min-w-0 truncate",I?.kind==="saved"&&"text-primary"),children:G})]}),l(Uk,{sensors:S,collisionDetection:kk,modifiers:fW,accessibility:{screenReaderInstructions:{draggable:c("turnQueue.dragInstructions")},announcements:{onDragStart:()=>c("turnQueue.dragStarted"),onDragOver:({over:M})=>{let X=N.findIndex(F=>F.intentId===M?.id);return X<0?void 0:`${c("turnQueue.dragStarted")} ${X+1}/${N.length}`},onDragEnd:()=>c("turnQueue.dragFinished"),onDragCancel:()=>c("turnQueue.dragCancelled")}},onDragStart:({active:M})=>{let X=N.find(F=>F.intentId===M.id);!X?.management?.canReorder||O||(x(null),T(null),b({activeId:X.intentId,overId:X.intentId}))},onDragOver:({over:M})=>{let X=N.find(F=>F.intentId===M?.id);X&&b(F=>F&&{...F,overId:X.intentId})},onDragCancel:()=>{C&&T({intentId:C.activeId,kind:"cancelled"}),b(null)},onDragEnd:({active:M,over:X})=>{if(b(null),!X||M.id===X.id)return;let F=N.findIndex(te=>te.intentId===M.id),ee=N.findIndex(te=>te.intentId===X.id),Y=N[F];if(!Y?.management?.canReorder||ee<0)return;let ae=N[ee+(F<ee?1:0)]?.intentId??null;J(Y,ae)},children:l(Qk,{items:N.map(M=>M.intentId),strategy:Gk,children:v("ol",{className:"max-h-52 overflow-x-hidden overflow-y-auto overscroll-contain [scrollbar-gutter:stable]",children:[N.map((M,X)=>v(vW,{entry:M,disabled:!M.management?.canReorder||O,locked:Yd(M),reducedMotion:u,feedback:I?.intentId===M.intentId?I.kind:void 0,dropPosition:M.intentId===C?.overId&&j!==U?j<U?"after":"before":void 0,dragPosition:M.intentId===C?.activeId?`${U+1}/${N.length}`:void 0,children:[l(Eh,{source:M.source,environmentId:n}),v("div",{className:"min-w-0 flex-1",children:[l("p",{className:"line-clamp-2 whitespace-pre-wrap break-words [overflow-wrap:anywhere]",children:l(s0,{entry:M,readRecord:d,environmentId:n})}),l(ip,{environmentId:n,rewrite:M.rewrite,text:M.rewrittenText??""}),M.attachmentNames.length?v("p",{className:"flex items-center gap-1 text-muted-foreground",children:[l(Vo,{className:"size-3 shrink-0"}),l("span",{className:"truncate",children:M.attachmentNames.join(", ")})]}):null,M.pendingAction?l("p",{className:"text-muted-foreground",children:c(M.pendingAction==="steer"?"turnQueue.steering":"turnQueue.interrupting")}):null,M.sentWith?l(qA,{sentWith:M.sentWith}):null,M.failure?l("p",{role:"alert",className:"text-destructive-foreground",children:M.failure}):null]}),v("div",{className:V("flex shrink-0 items-center gap-0.5",M.intentId===C?.activeId&&"invisible"),children:[Yd(M)?null:l(K,{size:"icon-xs",variant:"ghost",disabled:!M.management||O||C!==null,"aria-label":c("turnQueue.editMessage"),title:c("turnQueue.editMessage"),onClick:()=>p(M),children:l(ld,{className:"size-3.5"})}),M.management?.canSteer?l(K,{size:"icon-xs",variant:"ghost",disabled:O||C!==null,"data-turn-queue-steer":"","aria-label":c("turnQueue.steer"),title:c("turnQueue.steerDescription"),onClick:()=>{D(()=>s.onRun(M,"steer"))},children:l(pd,{className:"size-3.5"})}):null,v(Ao,{children:[l(Do,{render:l(K,{size:"icon-xs",variant:"ghost",disabled:O||!M.management&&!Yd(M)&&M.action!=="cancel"||C!==null,"aria-label":c("turnQueue.messageActions")}),children:l(Eo,{className:"size-4"})}),v(No,{align:"end",children:[Yd(M)?null:v(oe,{children:[v(vo,{disabled:!M.management?.canReorder||X===0,onClick:()=>{J(M,N[X-1].intentId)},children:[l(Ol,{className:"size-4"}),c("turnQueue.moveUp")]}),v(vo,{disabled:!M.management?.canReorder||X===N.length-1,onClick:()=>{J(M,N[X+2]?.intentId??null)},children:[l(Dl,{className:"size-4"}),c("turnQueue.moveDown")]}),M.management?.canSteer?l(vo,{onClick:()=>{D(()=>s.onRun(M,"steer"))},children:c("turnQueue.steer")}):null,l(vo,{disabled:!M.management?.canRun,onClick:()=>{D(()=>s.onRun(M,"interrupt"))},children:c(M.management?.expectedTurnId?"turnQueue.interruptAndRun":"turnQueue.sendNext")}),l(xd,{})]}),l(vo,{disabled:M.action!=="cancel",onClick:()=>{D(()=>i(M))},children:c("turnQueue.cancelMessage")})]})]})]})]},M.intentId)),o.map(M=>l(yW,{submission:M,environmentId:n},M.messageId))]})})},e),y?l("p",{role:"alert",className:"px-3 py-2 text-destructive-foreground",children:y}):null]}):null,m?l(KA,{entry:m,current:t.find(M=>M.intentId===m.intentId),inputKey:e,environmentId:n,unavailable:O,attachments:a,watchEditorAuthority:s.watchEditorAuthority,onEdit:s.onEdit,onClose:()=>p(null)},`${e}\0${m.intentId}\0${m.management?.revision??"none"}`):null]})}function XA({data:e,target:t,inputKey:o,attachments:n}){let r=e.useQueue({target:t,threadKey:o}),a=e.useCommandFailureText?.(),{environmentId:s,threadId:i}=t,d=e.queue,c=p=>e.useCommunicationRecord(t,p),u=W(()=>{let p={environmentId:s,threadId:i};return{actions:{onEdit:async(g,h)=>{try{await d.edit(p,g,h)}catch(y){let x=a?.(y);throw x?new Error(x):y}},onReorder:(g,h)=>d.reorder(p,g,h),onRun:(g,h)=>d.run(p,g,h),watchEditorAuthority:d.watchEditorAuthority},onCancel:g=>d.cancel(p,g),onResume:()=>d.resume(p)}},[d,s,a,i]),m=W(()=>({data:e,target:t,threadKey:`${o}\0queue-editor`}),[e,t,o]);return v(oe,{children:[l(Np,{value:m,children:l(QA,{inputKey:o,actions:u.actions,attachments:n,entries:r.entries,pendingSubmissions:r.pendingSubmissions,environmentId:s,onCancel:u.onCancel,readRecord:c,unavailable:r.unavailable})}),l(MC,{environmentId:s,entries:r.entries,onCancel:u.onCancel,onResume:u.onResume,queue:r.state,unavailable:r.unavailable})]})}$();$();$();function fl({unavailableReason:e=null,disabled:t,className:o,children:n,...r}){let a=ho(),s=t===!0&&e!==null;return v(oe,{children:[v(Pe,{disabled:!s,children:[l(Ee,{"aria-describedby":s?a:void 0,render:l(K,{...r,disabled:t&&!s,softDisabled:s,className:V("rounded-full shadow-none! inset-shadow-none! ease-out before:rounded-full sm:rounded-full",o)}),children:n}),l(Re,{side:"top",className:"max-w-72",children:e})]}),s?l("span",{id:a,hidden:!0,children:e}):null]})}var Vc="not-disabled:not-aria-disabled:border-message-action not-disabled:not-aria-disabled:bg-message-action not-disabled:not-aria-disabled:text-message-action-foreground not-disabled:not-aria-disabled:hover:bg-message-action-hover",Qc=(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"),CW=e=>{e.preventDefault()},gl=pe(function({compact:t,pendingAction:o,isRunning:n,showPlanFollowUpPrompt:r,promptHasText:a,isSendBusy:s,sendDisabledReason:i,isEnvironmentUnavailable:d,hasSendableContent:c,preserveComposerFocusOnPointerDown:u=!1,showSendWhileRunning:m=!1,onInterrupt:p,interruptArmed:f=!1,stopping:g=!1,cancelsCheck:h=!1,onImplementPlanInNewThread:y,shellCommandMode:x=!1,shellCommandUnavailableReason:C=null}){let{t:b}=z(),L=it(),w=u?{onPointerDown:CW}:void 0,k=L.settings.useEnvironmentIdentificationMode(),I=i!==null,T=s?null:i??(d?b("primaryActions.environmentDisconnected"):null),S=L.devBackdrop.useVisible(k==="artwork"),P=O=>l(fl,{type:"button",variant:"destructive",size:g||f?"sm":"icon",className:V(g?"h-8 px-3 text-xs sm:h-8 sm:text-xs":f?"h-8 px-3 text-xs ring-2 ring-destructive-solid/60 sm:h-8 sm:text-xs":O?"size-8 sm:size-7":m&&c?"size-9 sm:size-8":"size-8 sm:h-8 sm:w-8"),...w,onClick:p,disabled:g,"data-interrupt-armed":f&&!g?"":void 0,"aria-label":b(g?"primaryActions.stopping":f?"primaryActions.confirmStopEsc":h?"primaryActions.cancelCheck":"primaryActions.stopGeneration"),children:g?b("primaryActions.stopping"):f?b("primaryActions.confirmStopEsc"):l("svg",{className:"size-3",viewBox:"0 0 12 12",fill:"currentColor","aria-hidden":"true",children:l("rect",{x:"2",y:"2",width:"8",height:"8",rx:"1.5"})})});if(o)return v("div",{className:V("flex items-center justify-end",t?"gap-1.5":"gap-2"),children:[n?P(!0):null,l(K,{type:"submit",size:"sm",className:V("rounded-full bg-message-action text-message-action-foreground hover:bg-message-action-hover",t?"px-3":"px-4"),...w,disabled:d||o.isResponding||(o.isLastQuestion?!o.isComplete:!o.canAdvance),children:Qc(b,{compact:t,isLastQuestion:o.isLastQuestion,isResponding:o.isResponding,questionIndex:o.questionIndex})})]});if(x){let O=l(fl,{type:"submit",variant:"secondary",size:"icon","data-shell-command-run":"true",className:V("size-9 sm:size-8",Vc),...w,disabled:C!==null||!c,unavailableReason:C,"aria-label":b("primaryActions.runInTerminal"),children:l(Qo,{"aria-hidden":"true",className:"size-4"})});return n?v(oe,{children:[P(!1),O]}):O}if(r)return a?l(fl,{type:"submit",size:"sm",className:V(Vc,t?"h-9 px-3 sm:h-8":"h-9 px-4 sm:h-8"),...w,disabled:s||I||d,unavailableReason:T,children:b(s?"primaryActions.sendingButtonLabel":"primaryActions.refine")}):v("div",{"data-chat-composer-implement-actions":"true",className:"flex items-center justify-end",children:[l(fl,{type:"submit",size:"sm",className:V("h-9 rounded-r-none px-4 before:rounded-r-none sm:h-8 sm:rounded-r-none",Vc),...w,disabled:s||I||d,unavailableReason:T,children:b(s?"primaryActions.sendingButtonLabel":"primaryActions.implement")}),v(Ao,{children:[l(Do,{render:l(K,{size:"sm",variant:"default",className:V("h-9 rounded-l-none rounded-r-full border-l-message-action-foreground/20 px-2 sm:h-8",Vc),"aria-label":b("primaryActions.implementationActions"),disabled:s||I||d}),children:l(Tt,{})}),l(No,{align:"end",side:"top",children:l(vo,{disabled:s||I||d,onClick:()=>{y()},children:b("primaryActions.implementInNewThread")})})]})]});let A=s||I||d||!c,N=S&&!A,B=v(fl,{type:"submit",variant:"secondary",size:"icon",className:V("isolate size-9 sm:size-8",N?"bg-transparent text-white":Vc),...w,disabled:A,unavailableReason:T,"aria-label":b(s?"primaryActions.sendingAriaLabel":"primaryActions.sendMessage"),children:[N?l("span",{className:"pointer-events-none absolute inset-0 -z-10 overflow-hidden rounded-full","aria-hidden":"true",children:l(Nb,{compact:!0})}):null,s?l(Qs,{className:"size-3.5","aria-hidden":"true"}):l("svg",{className:"size-4",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:l("path",{d:"M7 11.5V2.5M7 2.5L3 6.5M7 2.5L11 6.5",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})})]});return n?v(oe,{children:[P(!1),m&&c?B:null]}):B});function Sa(e){return e.id??e.label}function Uf(e,t){return Array.from(new Set((t??[]).flatMap(o=>{let n=e.options.find(r=>r.id!==void 0?r.id===o:r.label===o.trim());return n?[Sa(n)]:[]})))}function xW(e){if(typeof e!="string")return null;let t=e.trim();return t.length>0?t:null}function hl(e,t){if(t?.attachmentsBlocked)return null;let o=xW(t?.customAnswer);if(e.allowFreeform!==!1&&o)return o;let n=Uf(e,t?.selectedOptionLabels),r=e.allowFreeform!==!1&&(t?.attachmentCount??0)>0;return e.multiSelect?n.length>0?n:r?"":null:n[0]??(r?"":null)}function YA(e,t){let o=t.trim().length>0?void 0:e?.selectedOptionLabels;return{customAnswer:t,...o&&o.length>0?{selectedOptionLabels:o}:{}}}function JA(e,t,o){let n=Uf(e,[o])[0];if(n===void 0)return t??{};if(e.multiSelect){let r=Uf(e,t?.selectedOptionLabels),a=r.includes(n)?r.filter(s=>s!==n):[...r,n];return{customAnswer:"",...a.length>0?{selectedOptionLabels:a}:{}}}return{customAnswer:"",selectedOptionLabels:[n]}}function AC(e,t){let o={};for(let n of e){let r=hl(n,t[n.id]);if(r===null)return null;o[n.id]=r}return o}function bW(e,t){return e.reduce((o,n)=>hl(n,t[n.id])!==null?o+1:o,0)}function $f(e,t,o){let n=e.length===0?0:Math.max(0,Math.min(o,e.length-1)),r=e[n]??null,a=r?t[r.id]:void 0,s=r?hl(r,a):null,i=r?.allowFreeform===!1?"":a?.customAnswer??"",d=bW(e,t),c=e.length===0?!0:n>=e.length-1;return{questionIndex:n,activeQuestion:r,activeDraft:a,selectedOptionLabels:r?Uf(r,a?.selectedOptionLabels):[],customAnswer:i,resolvedAnswer:s,usingCustomAnswer:i.trim().length>0,answeredQuestionCount:d,isLastQuestion:c,isComplete:AC(e,t)!==null,canAdvance:s!==null}}var wW={approve:{label:"pendingUserInput.planApprove",description:"pendingUserInput.planApproveHint"},revise:{label:"pendingUserInput.planRevise",description:"pendingUserInput.planReviseHint"},stop:{label:"pendingUserInput.planStop",description:"pendingUserInput.planStopHint"}};function yl(e,t,o){if(o.displayKind==="acknowledge")return{label:e("pendingUserInput.acknowledge"),description:e("pendingUserInput.continueHint")};let n=t.kind==="plan"&&o.planAction!==void 0?wW[o.planAction]:void 0;return n===void 0?{label:o.label,description:o.description??""}:{label:e(n.label),description:e(n.description)}}function zf(e){let{t}=z();return e.questions.length<2?null:l("div",{className:"flex flex-wrap items-center gap-1","data-pending-user-input-steps":!0,children:e.questions.map((o,n)=>{let r=n===e.currentIndex,a=hl(o,e.answers[o.id])!==null;return v(K,{size:"xs",variant:r?"outline":"ghost","aria-current":r?"step":void 0,"aria-label":t("pendingUserInput.goToQuestion",{index:n+1,question:o.header}),disabled:e.disabled,"data-pending-user-input-step":n,onClick:()=>e.onGoTo(n),children:[a?l(jo,{"aria-hidden":!0}):null,n+1]},o.id)})})}function Kf(e){let{t}=z();return e.questions.length<2||e.currentIndex<e.questions.length-1?null:l("ul",{className:"flex flex-col border-t border-border/60 pt-1","data-pending-user-input-summary":!0,children:e.questions.slice(0,-1).map((o,n)=>{let r=hl(o,e.answers[o.id]),a=i=>{let d=o.options.find(c=>Sa(c)===i);return d?yl(t,o,d).label:i},s=r===null?t("pendingUserInput.unanswered"):r===""?t("pendingUserInput.attachmentsOnly"):(Array.isArray(r)?r:[r]).map(a).join(", ");return l("li",{children:v("button",{type:"button",disabled:e.disabled,"data-pending-user-input-summary-row":n,className:"flex w-full min-w-0 cursor-[var(--control-cursor)] items-baseline gap-2 rounded-md px-2 py-1 text-left text-chat-row transition-colors duration-(--control-duration) hover:bg-accent disabled:pointer-events-none pointer-coarse:min-h-11",onClick:()=>e.onGoTo(n),children:[l("span",{className:"max-w-[45%] shrink-0 truncate text-muted-foreground",children:o.header}),l("span",{className:r===null?"min-w-0 truncate text-warning-foreground":"min-w-0 truncate text-foreground",children:s})]})},o.id)})})}var ZA=pe(function(t){let o=t.data.useQuestions(t.target);return o.pending.length===0?null:l("div",{"data-async-question-stack":!0,className:"mx-auto mb-2 flex max-h-[45vh] w-full max-w-3xl flex-col gap-2 overflow-y-auto overscroll-contain",children:o.pending.toReversed().map(n=>l(TW,{pending:n,actions:o},n.requestId))})}),TW=pe(function(t){let{pending:o,actions:n}=t,{t:r}=z(),[a,s]=q({}),[i,d]=q(0),[c,u]=q(!1),[m,p]=q(null),f=E(null);H(()=>()=>{f.current!==null&&window.clearTimeout(f.current)},[]);let g=o.questions,h=$f(g,a,i),y=h.activeQuestion;if(!y)return null;let x=AC(g,a),C=I=>{u(!0),p(null),I().then(T=>{u(!1),p(T)})},b=I=>{f.current!==null&&window.clearTimeout(f.current),f.current=null,d(Math.min(Math.max(I,0),g.length-1))},L=()=>{if(!c){if(!h.isLastQuestion){h.canAdvance&&b(h.questionIndex+1);return}x!==null&&C(()=>n.answer(o.requestId,x))}},w=I=>{if(s(S=>({...S,[y.id]:JA(y,S[y.id],I)})),y.multiSelect||h.isLastQuestion)return;f.current!==null&&window.clearTimeout(f.current);let T=h.questionIndex+1;f.current=window.setTimeout(()=>{f.current=null,b(T)},200)},k=y.header===y.question?r("asyncQuestion.title"):y.header;return l("section",{"data-async-question":o.requestId,"aria-label":r("asyncQuestion.title"),className:"overflow-hidden rounded-xl border border-border/60 bg-background/95 px-3 py-2 shadow-xs sm:px-4",children:v(vr,{state:"pending",icon:l(qn,{}),title:k,actions:v(oe,{children:[l(K,{size:"sm",variant:"ghost",className:"me-auto text-muted-foreground hover:text-foreground",disabled:c,onClick:()=>C(()=>n.dismiss(o.requestId)),children:r("asyncQuestion.dismiss")}),l(K,{size:"sm","data-async-question-submit":"",disabled:c||(h.isLastQuestion?x===null:!h.canAdvance),onClick:L,children:Qc(r,{compact:!1,isLastQuestion:h.isLastQuestion,isResponding:c,questionIndex:h.questionIndex})})]}),children:[l(zf,{questions:g,answers:a,currentIndex:h.questionIndex,disabled:c,onGoTo:b}),l("p",{className:"whitespace-pre-wrap break-words text-chat font-medium text-foreground","data-async-question-item":y.id,children:y.question}),y.multiSelect?l("p",{className:"text-chat-row text-muted-foreground",children:r("pendingUserInput.selectOneOrMore")}):null,y.options.length>0?l($u,{mode:y.multiSelect?"multiple":"single","aria-label":k,disabled:c,selected:h.usingCustomAnswer?[]:h.selectedOptionLabels,onToggle:w,onReselect:w,options:y.options.map(I=>{let T=yl(r,y,I);return{value:Sa(I),label:T.label,...T.description&&T.description!==T.label?{description:T.description}:{}}})},y.id):null,y.allowFreeform===!1?null:l(Vr,{type:"text",size:"sm",value:h.customAnswer,disabled:c,placeholder:r("asyncQuestion.answerPlaceholder"),"aria-label":r("asyncQuestion.answerLabel",{question:y.question}),onChange:I=>{let T=I.target.value;s(S=>({...S,[y.id]:YA(S[y.id],T)}))},onKeyDown:I=>{I.key!=="Enter"||I.nativeEvent.isComposing||(I.preventDefault(),L())}}),l(Kf,{questions:g,answers:a,currentIndex:h.questionIndex,disabled:c,onGoTo:b}),m?l("p",{role:"alert",className:"text-chat-row text-destructive-foreground",children:m}):null]})})});$();var NC=220,IW={opacity:0,transform:"translate3d(0, 4rem, 0)"},SW={opacity:0,transform:"translate3d(0, 7rem, 0)"},eN={opacity:1,transform:"none"},tN={transition:`transform ${NC}ms ease-in, opacity ${NC}ms ease-in`},kW={default:"border-[var(--chat-composer-attached-outline)]",error:"border-destructive/24",info:"border-info/24",success:"border-success/24",warning:"border-warning/24"};function nN({className:e,items:t}){let{t:o}=z(),[n,r]=q(null),a=E(null),s=n!==null&&t.some(f=>f.id===n)?n:null;if(H(()=>()=>{a.current&&clearTimeout(a.current)},[]),t.length===0)return null;let i=t[0];if(!i)return null;let d=t.slice(1),c=d.length>0,u=c&&s!==i.id,m=d[0],p=f=>{!f.onDismiss||s||(r(f.id),a.current&&clearTimeout(a.current),a.current=setTimeout(()=>{a.current=null,f.onDismiss?.()},NC))};return l("div",{className:V("group/banner-stack chat-composer-drawer-slot",e),"data-composer-banner-drawer":"true",children:v("div",{className:V("relative flex flex-col-reverse",c?"group-hover/banner-stack:z-50 group-focus-within/banner-stack:z-50":null),children:[u&&m?l("div",{className:V("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)]",kW[m.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,l("div",{className:V("relative z-10",s===i.id?"pointer-events-none":null),style:{...tN,...s===i.id?IW:eN},children:l(oN,{item:i,attached:!0,exiting:s===i.id,onDismissRequest:()=>p(i)})}),c?l("div",{"data-composer-banner-stack-expanded-items":"true",className:V("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:l("div",{className:"min-h-0 overflow-hidden",children:l("div",{className:V("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:d.map(f=>l("div",{className:V(s===f.id?"pointer-events-none":null),style:{...tN,...s===f.id?SW:eN},children:l(oN,{item:f,attached:!1,exiting:s===f.id,onDismissRequest:()=>p(f)})},f.id))})})}):null]})})}function oN({item:e,attached:t,exiting:o,onDismissRequest:n}){let{t:r}=z(),a=e.onDismiss&&!e.actions;return e.presentation==="compact"?v(bd,{variant:e.variant,role:"status",className:V("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-composer py-1.5",e.className),"data-composer-banner-presentation":"compact","data-composer-banner-id":e.id,"data-variant":e.variant,children:[e.icon,v(Ag,{className:"flex min-w-0 items-baseline gap-1.5 font-normal leading-5",children:[l("span",{className:"shrink-0 font-medium text-foreground",children:e.title}),e.description?l("span",{className:"min-w-0 truncate text-muted-foreground",children:e.description}):null]}),e.actions||e.onDismiss?v(wd,{className:V("shrink-0",e.actionClassName),children:[e.actions,e.onDismiss?l(K,{size:"icon-xs",variant:"ghost","aria-label":e.dismissLabel??r("composer.dismissNotice"),disabled:o,onClick:n,children:l(dt,{})}):null]}):null]}):v(bd,{variant:e.variant,className:V(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-composer",e.className),"data-composer-banner-id":e.id,"data-variant":e.variant,children:[e.icon,l(Ag,{children:e.title}),e.description?l(Uu,{children:e.description}):null,e.actions||e.onDismiss?v(wd,{className:V(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?l(K,{size:"icon-xs",variant:"ghost","aria-label":e.dismissLabel??r("composer.dismissWarning"),disabled:o,onClick:n,children:l(dt,{})}):null]}):null]})}$();var rN=qe(!1),aN=rN.Provider;function sN(){return Pt(rN)}$();var iN=qe(null),lN=iN;function dN(){let[e,t]=q(0),o=R(n=>{t(r=>Math.max(0,r+(n?1:-1)))},[]);return[e>0,o]}function cN(){let e=xe(iN);fe(()=>(e?.(!0),()=>e?.(!1)),[e])}function LW({api:e,draftId:t,environmentId:o,slots:n,threadId:r}){let a=e.presets.useDraftPresetId(t),s=t!==null;return n?.renderSlot("conversation.hero.agentPreset",{environmentId:o,threadId:r,draftId:t,presetId:a,selectable:s,onSelectPreset:s&&t!==null?i=>e.presets.setDraftPresetId(t,i):void 0})}function uN({api:e,belowSlot:t,teamDock:o,composer:n,data:r,draftHero:a,draftId:s,environmentId:i,onOverlayElementChange:d,queue:c,questions:u,slots:m,target:p,threadId:f,threadKey:g}){let h=r.useComposerBanners({target:p,threadKey:g}),y=l(nN,{className:"relative z-0",items:h.items}),[x,C]=dN();return v("div",{ref:d,"data-chat-composer-overlay":"true",className:a.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:[v("div",{ref:a.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:[v("div",{className:"pointer-events-auto relative z-10",children:[c,u,a.active?v("div",{className:"absolute inset-x-0 bottom-full z-0",children:[e===void 0?m?.renderSlot("conversation.hero.agentPreset",{environmentId:i,threadId:f}):l(LW,{api:e,draftId:s??null,environmentId:i,slots:m,threadId:f}),l("div",{"aria-hidden":x||void 0,className:V("pb-8 transition-opacity duration-150 motion-reduce:transition-none",x&&"pointer-events-none select-none opacity-0"),style:{viewTransitionName:a.headlineTransitionName},children:a.headline}),y]},`${g}:${s??""}`):y,o==null?null:l("div",{"data-chat-composer-team-dock":"true",className:"mx-auto mb-2 w-full max-w-3xl",children:o}),v("div",{"data-chat-composer-stack":"true",className:"chat-composer-glass-shell relative mx-auto w-full max-w-3xl",style:{viewTransitionName:a.composerTransitionName},children:[l("div",{className:"chat-composer-glass-host relative z-10 w-full rounded-composer",children:l("div",{ref:a.composerAnchorRef,className:"relative z-10",children:l(aN,{value:h.items.length>0,children:l(lN,{value:C,children:n})})})}),l("div",{className:"min-h-0",children:t})]}),l("div",{"data-chat-composer-dock":"true",className:"mx-auto mt-2 w-full max-w-3xl empty:hidden",children:m?.renderSlot("conversation.input.dock",{environmentId:i,threadId:f})})]}),l("div",{"aria-hidden":!0,className:"h-[calc(env(safe-area-inset-bottom)+1rem)] sm:h-[calc(env(safe-area-inset-bottom)+1.25rem)]"})]}),h.overlay]})}function qf(e,t){let o=e.trim();return o?t?.trimLeadingPattern?o.replace(t.trimLeadingPattern,"").toLowerCase():o.toLowerCase():""}function PW(e,t){if(!t)return 0;let o=0,n=-1,r=-1,a=0;for(let s=0;s<e.length;s+=1)if(e[s]===t[o]&&(n===-1&&(n=s),r!==-1&&(a+=s-r-1),r=s,o+=1,o===t.length)){let i=s-n+1-t.length,d=Math.min(64,e.length-t.length);return n*2+a*3+i+d}return null}function DC(e,t){return Math.min(64,Math.max(0,e.length-t.length))}function RW(e,t,o){let n=null;for(let r of o){let a=e.indexOf(`${r}${t}`);if(a===-1)continue;let s=a+r.length;(n===null||s<n)&&(n=s)}return n}function Fn(e){let{value:t,query:o}=e;if(!t||!o)return null;if(t===o)return e.exactBase;if(e.prefixBase!==void 0&&t.startsWith(o))return e.prefixBase+DC(t,o);if(e.boundaryBase!==void 0){let n=RW(t,o,e.boundaryMarkers??[" ","-","_","/"]);if(n!==null)return e.boundaryBase+n*2+DC(t,o)}if(e.includesBase!==void 0){let n=t.indexOf(o);if(n!==-1)return e.includesBase+n*2+DC(t,o)}if(e.fuzzyBase!==void 0){let n=PW(t,o);if(n!==null)return e.fuzzyBase+n}return null}function EW(e,t){let o=e.score-t.score;return o!==0?o:e.tieBreaker.localeCompare(t.tieBreaker)}function MW(e,t){let o=0,n=e.length;for(;o<n;){let r=o+Math.floor((n-o)/2),a=e[r];if(!a)break;EW(t,a)<0?n=r:o=r+1}return o}function pN(e,t,o){if(o<=0)return;let n=MW(e,t);if(e.length<o){e.splice(n,0,t);return}n>=o||(e.splice(n,0,t),e.pop())}var Xc=(e,t,o=0)=>Fn({value:e.toLowerCase(),query:t,exactBase:o,prefixBase:o+2,boundaryBase:o+4,includesBase:o+6,...o<20?{fuzzyBase:o+100}:{},boundaryMarkers:[" ","-","_","/"]});function AW(e,t,o=[]){let n=t.trim().replace(/^\/+/,"").toLowerCase();return n?e.flatMap(r=>{let a=r.type==="slash-command"?r.command:r.type==="skill"?r.skill.name:r.command.name,s=r.type==="skill"&&n.startsWith("skill:")?n.slice(6):n,i=[Xc(a,s),Xc(r.description,s,20)];r.type==="skill"&&(i.push(Xc(r.skill.displayName??r.skill.name.replace(/[-_]/g," "),s,1)),i.push(Xc(r.skill.description??"",s,30)),i.push(Xc(r.skill.scope??"",s,40)),"skill".startsWith(n)&&i.push(n==="skill"?0:Number.MAX_SAFE_INTEGER));let d=i.filter(u=>u!==null);if(!d.length)return[];let c=r.type==="slash-command"?0:r.type==="provider-slash-command"?1:r.type==="skill"?2:3;return[{item:r,score:Math.min(...d)-(o.includes(r.id)?1:0),key:`${c}\0${a}\0${r.id}`}]}).sort((r,a)=>r.score-a.score||r.key.localeCompare(a.key)).map(({item:r})=>r):[...e]}function NW(e,t){let o=new Map(e.map(a=>[a.id,a])),n=[...new Set(t)].flatMap(a=>{let s=o.get(a);return s?[{...s,section:"recent"}]:[]}).slice(0,3),r=new Set(n.map(a=>a.id));return[...n,...e.filter(a=>!r.has(a.id)).map(a=>({...a,section:a.type==="slash-command"?"builtIn":a.type==="skill"?"skills":a.type==="plugin-slash-command"?"plugins":"provider"}))]}function mN(e){let t=new Set(e.skills.map(a=>a.name.trim().toLowerCase())),o=new Set(e.builtIns.map(a=>a.command)),n=[...e.builtIns.map(a=>({...a,id:`slash:${a.command}`,type:"slash-command",label:`/${a.command}`})),...e.commands.filter(a=>!t.has(a.name.toLowerCase())&&!o.has(a.name)).map(a=>({id:`provider-slash-command:${e.provider}:${a.name}`,type:"provider-slash-command",provider:e.provider,command:a,label:`/${a.name}`,description:a.description??a.input?.hint??e.providerDescription})),...(e.showSkills?e.skills.filter(xr):[]).map(a=>({id:`skill:${e.provider}:${a.name}`,type:"skill",provider:e.provider,skill:a,label:`/skill:${a.name}`,description:a.shortDescription??a.description??""})),...(e.plugins??[]).map(a=>({id:`plugin-slash:${a.pluginId}:${a.name}`,type:"plugin-slash-command",pluginId:a.pluginId,command:a,label:`/${a.name}`,description:a.description??a.argumentHint??""}))];return _C(`/${e.query.trim()}`,{builtIns:e.builtIns.map(a=>a.command),skills:e.skills,commands:e.commands,plugins:e.plugins})?.kind==="ambiguous"?n.filter(a=>a.type==="plugin-slash-command"&&a.command.name===e.query.trim()):e.query.trim()?AW(n,e.query,e.recentIds):NW(n,e.recentIds??[])}function _C(e,t){let o=/^\/([^\s]+)(?:\s|$)/.exec(e)?.[1];if(!o)return null;if(t.binding?.name===o){let r=t.plugins?.find(a=>a.pluginId===t.binding.pluginId&&a.name===o);return r?{kind:"plugin",command:r}:{kind:"unavailable",binding:t.binding}}if(t.builtIns.includes(o))return{kind:"builtIn",name:o};if(t.skills.some(r=>r.name===o&&xr(r)))return{kind:"skill",name:o};if(t.commands.some(r=>r.name===o))return{kind:"provider",name:o};let n=t.plugins?.filter(r=>r.name===o)??[];return n.length===1?{kind:"plugin",command:n[0]}:n.length>1?{kind:"ambiguous",commands:n}:null}var DW=()=>[];function fN(e){let{api:t,target:o}=e,n=(t.slashCommands?.useCommands??DW)(e.environmentId,o);return t.draft.useThreadDraftSelector(o,r=>{if(n.length===0)return!1;let a=_C(r.prompt,{builtIns:["model",...e.planModeEnabled?["plan","default"]:[]],skills:e.provider?.skills??[],commands:e.provider?.slashCommands??[],plugins:n,binding:t.slashCommands?.readBinding(o)});return a?.kind==="plugin"&&a.command.kind==="action"})}function gN(e,t){let o=e!==null&&e!=="plan-follow-up";return{showTopDrawer:e!==null&&(o||!t),showCollapsedPromptRow:t&&!o,hasBlocking:o}}function OC(e){return typeof e=="string"?e:`${e.environmentId}\0${e.threadId}`}var hN=(e,t)=>`${e}\0${OC(t)}`;$();var _W={"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 Wf(e,t){let o=e.code===void 0?void 0:_W[e.code];return o===void 0?e.reason:t(o,{status:e.httpStatus??""})}function yN(e,t){let o=0,n=0;for(let r of e.imageIds){let a=e.uploadsByImageId[r];a?.status==="failed"&&a.environmentId===e.environmentId?n+=1:(a?.status!=="ready"||a.environmentId!==e.environmentId)&&(o+=1)}return n>0?t("attachments.retryOrRemoveFailed",{count:n}):o>0?t("attachments.stillUploading",{count:o}):null}function Gf(e){let t=Math.max(0,Math.min(1,Number.isFinite(e)?e:0));return`${Math.floor(t*100)}%`}$();function vN(e,t){let o=t?.hasWideActions?780:620;return e!==null&&e<o}function CN(e,t){return t?.hasWideActions?e!==null&&e<780:!1}function xN(e,t){let o=it().pane.useVisible(),[n,r]=q(null);fe(()=>{if(!o)return;let s=e.current;if(!s)return;let i=!0;if(typeof ResizeObserver<"u"){let u=new ResizeObserver(m=>{if(!i)return;let p=m.find(y=>y.target===s);if(!p)return;let f=window.getComputedStyle(s),g=Number.parseFloat(f.paddingLeft)||0,h=Number.parseFloat(f.paddingRight)||0;r(Math.round(p.contentRect.width+g+h))});return u.observe(s),()=>{i=!1,u.disconnect()}}let d=null,c=()=>{d===null&&(d=window.requestAnimationFrame(()=>{d=null,i&&r(s.clientWidth)}))};return c(),window.addEventListener("resize",c),()=>{i=!1,window.removeEventListener("resize",c),d!==null&&window.cancelAnimationFrame(d)}},[e,o]);let a=vN(n,{hasWideActions:t});return{isComposerFooterCompact:a,isComposerPrimaryActionsCompact:a&&CN(n,{hasWideActions:t})}}$();function bN(e,t){let o=[],n=[];for(let r of e){let a=t(r);if(a.kind==="remote")return{paths:[],remote:!0,unavailableNames:[]};a.kind==="path"?o.push(a.path):n.push(r.name)}return{paths:o,remote:!1,unavailableNames:n}}function wN(e){let t=bN(e.folders,e.resolve);t.remote&&e.notifyError(e.t("attachments.folderRemote"));for(let o of t.unavailableNames)e.notifyError(e.t("attachments.folderPathUnavailable",{name:o}),e.t("attachments.folderPathUnavailableDetail"));for(let o of t.paths)e.insertText(`${Ls(o)} `)}var FC="ycodium:paste-as-text",TN=new TextEncoder;function IN(e,t){return e.key.toLowerCase()==="v"&&e.shiftKey&&!e.altKey&&(t?e.metaKey&&!e.ctrlKey:e.ctrlKey&&!e.metaKey)}function OW(e){return e.bypassAutoAttachment||!e.canAttach||e.text.length===0?"inline":e.wouldExceedInputLimit||e.text.length>=32768||TN.encode(e.text).byteLength>=32768?"attachment":"inline"}function FW(e){let t=new Set(e.map(o=>o.toLowerCase()));if(!t.has("pasted-text.txt"))return"pasted-text.txt";for(let o=2;;o+=1){let n=`pasted-text-${o}.txt`;if(!t.has(n))return n}}function BW(e){let t=Math.max(0,Math.min(e.valueLength,e.selectedLength));return e.valueLength-t+e.textLength>e.maxLength}function SN(e){let t=BW({valueLength:e.valueLength,selectedLength:e.selectedLength,textLength:e.text.length,maxLength:e.maxInputChars});if(OW({text:e.text,bypassAutoAttachment:e.bypassAutoAttachment,wouldExceedInputLimit:t,canAttach:!0})!=="attachment")return{kind:"inline"};let o=TN.encode(e.text).byteLength;return e.maxFileBytes!==null&&o>e.maxFileBytes?t?{kind:"reject",reason:"file-too-large"}:{kind:"inline"}:{kind:"fold",fileName:FW(e.existingNames),sizeBytes:o}}function kN(e,t,o){if(e.blocked)return!1;let{editor:n,registry:r,t:a}=e;r.documentKey!==e.documentKey&&(r.documentKey=e.documentKey,r.names.clear());for(let i of e.existingImageNames)r.names.add(i);let s=SN({text:t,bypassAutoAttachment:o,valueLength:e.promptLength,selectedLength:n?.readSelectedTextLength()??0,maxInputChars:e.maxInputChars,maxFileBytes:e.maxFileBytes,existingNames:[...r.names]});return s.kind==="inline"?!1:s.kind==="reject"?(e.notify.error(a("attachments.pastedTooLargeToAttach"),a("attachments.pastedTooLargeToAttachDetail")),!0):(r.names.add(s.fileName),n?.removeSelectedText(),e.addFoldedFile(new File([t],s.fileName,{type:"text/plain;charset=utf-8"})),e.notify.info(a("attachments.pastedAttached",{name:s.fileName}),a("attachments.pastedAttachedDetail",{size:di(s.sizeBytes),shortcut:cl(navigator.platform)?"\u2318\u21E7V":"Ctrl+Shift+V"})),!0)}$();var LN="application/x-ycodium-composer-mention";function BC(e){return e.includes(LN)}function PN(e){let t=o=>BC(o.dataTransfer.types)?(o.preventDefault(),o.stopPropagation(),o.nativeEvent.stopPropagation(),!0):!1;return{onDragEnter(o){t(o)&&e.setDragActive(!0)},onDragOver(o){t(o)&&(o.dataTransfer.dropEffect="move",e.setDragActive(!0))},onDrop(o){if(!t(o))return;e.setDragActive(!1);let n=o.dataTransfer.getData(LN);n.length!==0&&(e.insertMentionAtEnd(`${n} `)||e.onInsertRejected())}}}function RN({documentKey:e,insertMentionAtEnd:t,onInsertRejected:o}){let[n,r]=q(!1),a=PN({insertMentionAtEnd:t,setDragActive:r,onInsertRejected:o}),s=i=>{if(!BC(i.dataTransfer.types))return;i.stopPropagation();let d=i.relatedTarget;d instanceof Node&&i.currentTarget.contains(d)||r(!1)};return fe(()=>{r(!1)},[e]),H(()=>{if(!n)return;let i=()=>{r(!1)};return window.addEventListener("dragend",i),()=>window.removeEventListener("dragend",i)},[n]),{isDragOverComposer:n,composerMentionDragHandlers:a,onComposerMentionDragLeaveCapture:s}}$();function EN(e){let t=E(0);return H(()=>{let o=()=>{t.current=Date.now()+1e3},n=s=>{s.target instanceof Node&&e.current?.contains(s.target)&&IN(s,cl(navigator.platform))&&o()},r=()=>{t.current=0},a=()=>{let s=document.activeElement;s instanceof Node&&e.current?.contains(s)&&o()};return window.addEventListener(FC,a),window.addEventListener("keydown",n,!0),window.addEventListener("blur",r),()=>{window.removeEventListener(FC,a),window.removeEventListener("keydown",n,!0),window.removeEventListener("blur",r)}},[e]),R(()=>{let o=Date.now()<=t.current;return t.current=0,o},[])}function MN(e){let{api:t,attachments:o,t:n,addComposerImages:r,promptRef:a,promptInputRef:s,composerEditorRef:i,composerFormRef:d,composerThreadKey:c,attachmentDocumentKey:u,attachmentImagesRef:m,limits:p,supportsAttachmentUploads:f,attachmentUploadsCapabilityKnown:g,composerDocumentKey:h,isComposerApprovalState:y,pasteBlocked:x,hasPendingUserInputs:C,projectSelectionRequired:b,environmentId:L}=e,w=EN(d),k=E({documentKey:"",names:new Set}),I=(j,U)=>kN({blocked:x,editor:i.current,documentKey:u,registry:k.current,existingImageNames:m.current.map(D=>D.name),promptLength:a.current.length,maxInputChars:p.maxInputChars,maxFileBytes:!g||f?null:p.inlineAttachmentMaxBytes,t:n,notify:t.notify,addFoldedFile:D=>{r([D],{source:{_tag:"pasted-text"}})}},j,U),T=j=>{let U=Array.from(j.clipboardData.files);if(U.length>0){j.preventDefault(),r(U);return}let D=j.clipboardData.getData("text/plain");I(D,w())&&(j.preventDefault(),j.stopPropagation())},S=(j,U)=>{if(j.length===0||y||C||b)return!1;let D=a.current,J=(U?.ensureLeadingBoundary??!1)&&D.length>0&&!/\s$/.test(D);return s.current?.applyPromptReplacement(D.length,D.length,J?` ${j}`:j)??!1},P=$e(c,null,{namespace:Xu});P.current=j=>{if(y||C||b)return!1;let U=a.current,D=Math.max(0,Math.min(U.length,s.current?.readSnapshot().expandedCursor??U.length)),J=U.slice(0,D),G=U.slice(D),M=`${J.length>0&&!/\s$/.test(J)?" ":""}${j}${/^\s/.test(G)?"":" "}`;return s.current?.applyPromptReplacement(D,D,M)??!1};let{isDragOverComposer:A,composerMentionDragHandlers:N,onComposerMentionDragLeaveCapture:B}=RN({documentKey:h,insertMentionAtEnd:j=>S(j,{ensureLeadingBoundary:!0}),onInsertRejected:()=>{t.notify.error(n("composer.unableToAddToChat"),n("composer.composerBusy"))}});return{onComposerPaste:T,insertComposerTextAtEnd:S,addDroppedFolders:j=>{wN({folders:j,resolve:U=>o.resolveDroppedFolder({environmentId:L,folder:U}),t:n,notifyError:(U,D)=>t.notify.error(U,D),insertText:U=>S(U,{ensureLeadingBoundary:!0})})},isDragOverComposer:A,composerMentionDragHandlers:N,onComposerMentionDragLeaveCapture:B}}$();function AN(e){let{api:t,t:o,limits:n,promptRef:r,promptInputRef:a,composerEditorRef:s,composerImagesRef:i,composerDraftTarget:d,setComposerDraftPrompt:c,addComposerDraftImages:u,clearComposerDraftPromptAndImages:m,setIsStashMenuOpen:p,setStashPulse:f,isComposerCollapsedMobile:g,expandMobileComposer:h,keybindings:y,terminalOpen:x,isComposerModelPickerOpen:C,hasPendingUserInputs:b,isComposerApprovalState:L,projectSelectionRequired:w,answeringQuestion:k}=e,I=E(0),T=E(null),S=E(new Set),P=t.stash.useStore,A=P(F=>F.entries),N=P(F=>F.stashEntry),B=P(F=>F.takeEntry),O=P(F=>F.finalizeEntryImages);H(()=>()=>{T.current!==null&&window.clearTimeout(T.current)},[]);let j=R(()=>{I.current+=1,f({key:I.current,active:!0}),T.current!==null&&window.clearTimeout(T.current),T.current=window.setTimeout(()=>{T.current=null,f(F=>({...F,active:!1}))},1200)},[]),U=R(F=>{let{entry:ee,durable:Y}=B(F.id);if(!ee)return;Y||t.notify.warning(o("composer.stashReappear"),o("composer.storageRejectedKeep")),p(!1);let ae=r.current,te=F.prompt.length===0?ae:ae.trim().length?`${ae.replace(/\s+$/,"")}
3569
+ `);for(let g=0;g<f.length;g+=1){let h=f[g]??"";h.length>0&&d.push(Nn(h)),g<f.length-1&&d.push(vs())}},u=s[0];if(u?.isMention&&u.start===0){let p=i.isBackward()?i.focus:i.anchor,f=t.getExpandedAbsoluteOffsetForPoint(p.getNode(),p.offset),g=Ye().getTextContent().slice(f-1,f);g.length>0&&!/\s/.test(g)&&d.push(Nn(" "))}let m=0;for(let p of s)p.start<m||(p.start>m&&c(n.slice(m,p.start)),d.push(p.create()),m=p.end);return m<n.length?c(n.slice(m)):s.at(-1)?.isMention&&d.push(Nn(" ")),i.insertNodes(d),o.preventDefault(),!0},Jo)}function IA(){let[e]=ct();return H(()=>{let t=r=>{if(r.inputType!=="insertText"||!r.data||r.isComposing)return;let a=r.data;e.getEditorState().read(()=>{let i=Te();if(!ye(i)||!i.isCollapsed()||i.anchor.type!=="element")return!1;let d=i.anchor.getNode();return _e(d)&&fn(d.getChildAtIndex(i.anchor.offset))})&&(r.preventDefault(),r.stopImmediatePropagation(),e.update(()=>{let i=Te();ye(i)&&i.insertText(a)},{discrete:!0}))},o=null,n=e.registerRootListener((r,a)=>{a?.removeEventListener("beforeinput",t,!0),r?.addEventListener("beforeinput",t,!0),o=r});return()=>{o?.removeEventListener("beforeinput",t,!0),n()}},[e]),null}function SA(e){let[t]=ct();return H(()=>{let o=(d,c)=>{if(!e.onCommandKeyDown||!c)return!1;if(d==="Enter"&&(c.isComposing||c.keyCode===229))return c.stopPropagation(),!0;let u=e.onCommandKeyDown(d,c);return u&&(c.preventDefault(),c.stopPropagation()),u},n=t.registerCommand(TR,d=>o("ArrowDown",d),Jo),r=t.registerCommand(IR,d=>o("ArrowUp",d),Jo),a=t.registerCommand(Jm,d=>o("Enter",d),Jo),s=t.registerCommand(Zm,d=>o("Tab",d),Jo),i=t.registerCommand(kR,d=>o("Escape",d),Jo);return()=>{n(),r(),a(),s(),i()}},[t,e]),null}function kA(){let[e]=ct();return H(()=>{let t=e.registerCommand(Vm,n=>{let r=null;if(e.getEditorState().read(()=>{let s=Te();if(!ye(s)||!s.isCollapsed())return;let i=dl(0);if(i<=0)return;let d=Ye().getTextContent();tl(d,i,"left")&&(r=i-1)}),r===null)return!1;let a=r;return n?.preventDefault(),n?.stopPropagation(),e.update(()=>{Ia(a)}),!0},Jo),o=e.registerCommand(Qm,n=>{let r=null;if(e.getEditorState().read(()=>{let s=Te();if(!ye(s)||!s.isCollapsed())return;let i=dl(0),d=Wc();if(i>=d)return;let c=Ye().getTextContent();tl(c,i,"right")&&(r=i+1)}),r===null)return!1;let a=r;return n?.preventDefault(),n?.stopPropagation(),e.update(()=>{Ia(a)}),!0},Jo);return()=>{t(),o()}},[e]),null}function LA(){let[e]=ct();return H(()=>e.registerCommand(SR,t=>{if(!cl(navigator.platform)||t.key!=="Home"&&t.key!=="End"||t.altKey||t.metaKey||t.ctrlKey||t.isComposing)return!1;let o=e.getRootElement(),n=window.getSelection(),r=n?.anchorNode;return!o||!n||!r||!o.contains(r)||n.rangeCount===0||typeof n.modify!="function"?!1:(t.preventDefault(),t.stopPropagation(),n.modify(t.shiftKey?"extend":"move",t.key==="Home"?"backward":"forward","lineboundary"),e.update(()=>{mn($P(n,e))}),!0)},Jo),[e]),null}function PA(){let[e]=ct();return H(()=>e.registerUpdateListener(({editorState:t})=>{let o=null;t.read(()=>{let n=Te();if(!ye(n)||!n.isCollapsed())return;let r=n.anchor.getNode();if(!fn(r)||n.anchor.offset===0)return;o=il(r,0)+1}),o!==null&&queueMicrotask(()=>{e.update(()=>{Ia(o)})})}),[e]),null}function RA(e,t,o){if(!fn(e))return!1;let n=il(e,0),r=e instanceof dr;return e.remove(),r&&o(e.__context.id),Ia(t(n,r)),!0}function nW(){let e=Te();if(!ye(e)||!e.isCollapsed())return null;let t=e.anchor.getNode(),o=e.anchor.offset,n=fn(t)?o===0?t:t.getNextSibling():Ke(t)?o===t.getTextContentSize()?t.getNextSibling():null:_e(t)?t.getChildAtIndex(o):null;return fn(n)?n:null}function rW(e){return RA(nW(),t=>t,e)}function EA(){let[e]=ct(),{onRemoveTerminalContext:t}=xe(zc);return H(()=>{let o=e.registerCommand(Xm,r=>{let a=Te();if(!ye(a)||!a.isCollapsed())return!1;let s=a.anchor.getNode(),i=dl(0),d=c=>{let u=RA(c,(m,p)=>p?i:m,t);return u&&r?.preventDefault(),u};if(d(s))return!0;if(Ke(s)){if(a.anchor.offset>0)return!1;if(d(s.getPreviousSibling()))return!0;let c=s.getParent();if(_e(c)){let u=s.getIndexWithinParent();if(u>0&&d(c.getChildAtIndex(u-1)))return!0}return!1}if(_e(s)){let c=a.anchor.offset-1;if(c>=0&&d(s.getChildAtIndex(c)))return!0}return!1},Jo),n=e.registerCommand(Ym,r=>{let a=rW(t);return a&&r?.preventDefault(),a},Jo);return()=>{o(),n()}},[e,t]),null}function MA(){let[e]=ct();return H(()=>{let t=new Set,o=e.getRootElement()===document.activeElement,n=d=>{for(let c of t)d.has(c)||e.getElementByKey(c)?.removeAttribute("data-composer-chip-selected");for(let c of d)e.getElementByKey(c)?.setAttribute("data-composer-chip-selected","true");t=d},r=()=>{let d=new Set;return e.getEditorState().read(()=>{let c=Te();if(ye(c)&&!c.isCollapsed())for(let u of c.getNodes())u instanceof xa&&d.add(u.getKey())}),d},a=e.registerUpdateListener(()=>{n(o?r():new Set)}),s=e.registerCommand(vR,()=>(o=!0,n(r()),!1),Qi),i=e.registerCommand(iR,()=>(o=!1,n(new Set),!1),Qi);return()=>{a(),s(),i()}},[e]),null}function AA(){let[e]=ct(),t=ks();return H(()=>TA(e,{createMentionNode:Kc,getExpandedAbsoluteOffsetForPoint:qc,readLinkChips:()=>t.current}),[e]),null}$();var aW=[["(",")"],["[","]"],["{","}"],["'","'"],['"','"'],["\u201C","\u201D"],["`","`"],["<",">"],["\xAB","\xBB"],["*","*"],["_","_"]],DA=new Map(aW),NA=DA.get("`")??null;function _A(e){let[t]=ct(),o=E(e.terminalContexts),n=E(Rs(e.skills)),r=ks(),a=E(null),s=E(null);H(()=>{o.current=e.terminalContexts},[e.terminalContexts]),H(()=>{n.current=Rs(e.skills)},[e.skills]);let i=xg(d=>{let c=DA.get(d),u=a.current;if(!c)return a.current=null,!1;let m=!1;return t.update(()=>{let p=u??(()=>{let y=Te();if(!ye(y)||y.isCollapsed()||IC(y))return null;let x=TC(y);if(!x||x.start===x.end)return null;let C=Ye().getTextContent();return gC(C,x.start,x.end)?null:{value:C,expandedStart:x.start,expandedEnd:x.end}})();if(!p||!c)return;let f=p.value.slice(p.expandedStart,p.expandedEnd),g=`${p.value.slice(0,p.expandedStart)}${d}${f}${c}${p.value.slice(p.expandedEnd)}`;Gc(g,o.current,n.current,r.current);let h=uo(g,p.expandedStart);ll(h+d.length,h+d.length+f.length),m=!0,a.current=null}),m});return H(()=>{let d=h=>{if(s.current){if(h.key==="Dead"||h.key===" "||h.code==="Space")return;s.current=null}if(h.defaultPrevented||h.isComposing||h.metaKey||h.ctrlKey){a.current=null,s.current=null;return}t.getEditorState().read(()=>{let y=Te();if(!ye(y)||y.isCollapsed()){a.current=null,s.current=null;return}if(IC(y)){a.current=null,s.current=null;return}let x=TC(y);if(!x||x.start===x.end){a.current=null,s.current=null;return}let C=Ye().getTextContent();if(gC(C,x.start,x.end)){a.current=null,s.current=null;return}let b={value:C,expandedStart:x.start,expandedEnd:x.end};a.current=b,s.current=null})},c=h=>{if(h.inputType==="insertCompositionText"&&h.data==="`"&&NA!==null&&a.current){s.current=a.current;return}if(s.current||h.inputType==="insertCompositionText")return;if(typeof h.data!="string"){a.current=null;return}let y=h.inputType==="insertText"?h.data:null;if(!y||y.length!==1){a.current=null;return}i(y)&&(h.preventDefault(),h.stopPropagation(),h.stopImmediatePropagation())},u=h=>{queueMicrotask(()=>{t.update(()=>{let y=s.current;if(!y)return;let x=Ye().getTextContent(),C=NA;if(C===null){s.current=null;return}let b=`${y.value.slice(0,y.expandedStart)}\`${y.value.slice(y.expandedEnd)}`;if(x!==b){h?.finalAttempt&&(a.current=null,s.current=null);return}let L=y.value.slice(y.expandedStart,y.expandedEnd),w=uo(x,y.expandedStart);ll(w,w+1);let k=Te();if(!ye(k)){a.current=null,s.current=null;return}k.insertText(`\`${L}${C}`),ll(w+1,w+1+L.length),a.current=null,s.current=null},{tag:zo})})},m=h=>{let y=h;(y.inputType==="insertText"||y.inputType==="insertCompositionText")&&u()},p=()=>{u({finalAttempt:!0})},f=null,g=t.registerRootListener((h,y)=>{y?.removeEventListener("keydown",d),y?.removeEventListener("beforeinput",c,!0),y?.removeEventListener("input",m),y?.removeEventListener("compositionend",p),h?.addEventListener("keydown",d),h?.addEventListener("beforeinput",c,!0),h?.addEventListener("input",m),h?.addEventListener("compositionend",p),f=h});return()=>{f&&(f.removeEventListener("keydown",d),f.removeEventListener("beforeinput",c,!0),f.removeEventListener("input",m),f.removeEventListener("compositionend",p)),g()}},[t]),null}var sW=`composer-editor-${Math.random().toString(36).slice(2)}`,LC="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)]",PC="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";function OA(e){let t=Ye().getTextContent(),o=ir(t,e.cursor),n=bC(t,e.expandedCursor);return{value:t,cursor:ir(t,dl(o)),expandedCursor:bC(t,wA(n)),selection:SC(e.selection),terminalContextIds:kC(Ye())}}function iW({documentKey:e,value:t,cursor:o,terminalContexts:n,skills:r,disabled:a,placeholder:s,className:i,ariaLabel:d,onRemoveTerminalContext:c,onChange:u,onCommandKeyDown:m,onPaste:p,editorRef:f}){let[g]=ct(),h=E(u);h.current=u;let y=ir(t,o),x=_r(e,t,{cursor:y,expandedCursor:Zo(t,y)}),C=ir(t,x.cursor),b=oA(n),L=E(b),w=nA(r),k=E(w),I=E(Rs(r)),T=ks(),S=E({value:t,cursor:C,expandedCursor:x.expandedCursor,selection:x.selection,terminalContextIds:n.map(D=>D.id)}),P=E(e),A=x.history,N=E(!1),B=W(()=>({onRemoveTerminalContext:c}),[c]);fe(()=>{I.current=Rs(r)},[r]),H(()=>{g.setEditable(!a)},[a,g]),fe(()=>{let D=ir(t,o),J=S.current,G=P.current,M=G!==e,X=L.current!==b,F=k.current!==w;if(!M&&J.value===t&&J.cursor===D&&!X&&!F)return;if(M){let Z=J.selection;g.getEditorState().read(()=>{Z=SC(Z)}),rl(G,J.value,{cursor:J.cursor,expandedCursor:J.expandedCursor,selection:Z})}let ee=_r(e,t),Y=M?ee.selection:{anchor:D,focus:D};S.current={value:t,cursor:M?ee.cursor:D,expandedCursor:M?ee.expandedCursor:Zo(t,D),selection:Y,terminalContextIds:n.map(Z=>Z.id)},P.current=e,L.current=b,k.current=w;let ae=g.getRootElement(),te=!!(ae&&document.activeElement===ae);if(!M&&J.value===t&&!X&&!F&&!te)return;let de=M?_r(G,J.value).history:null;N.current=!0;let ge=t==="",ne=()=>g.update(()=>{let Z=M||J.value!==t||X||F;Z&&Gc(t,n,I.current,T.current),M?ll(Y.anchor,Y.focus):(Z||te)&&Ia(D)},{discrete:!0,tag:ge?[zo,yv,OR]:zo});de?dA(de,ne):ne(),ge&&te&&requestAnimationFrame(()=>setTimeout(()=>{document.activeElement===g.getRootElement()&&g.update(()=>{let Z=Te();ye(Z)&&(Z.dirty=!0)},{tag:[zo,yv]})},0)),rl(e,t,S.current),queueMicrotask(()=>{N.current=!1})},[o,e,g,w,n,b,t]);let O=R(D=>{let J=g.getRootElement();if(!J)return;let G=ir(S.current.value,D);J.focus({preventScroll:!0}),g.update(()=>{Ia(G)}),S.current={value:S.current.value,cursor:G,expandedCursor:Zo(S.current.value,G),selection:{anchor:G,focus:G},terminalContextIds:S.current.terminalContextIds},rl(P.current,S.current.value,{cursor:S.current.cursor,expandedCursor:S.current.expandedCursor,selection:S.current.selection}),h.current(S.current.value,G,S.current.expandedCursor,!1,S.current.terminalContextIds)},[g]),j=R(()=>{let D=S.current;return g.getEditorState().read(()=>{D=OA(S.current)}),S.current=D,rl(P.current,D.value,D),D},[g]);pr(f,()=>({focus:()=>{O(S.current.cursor)},focusAt:O,focusAtEnd:()=>{O(uo(S.current.value,S.current.value.length))},readSnapshot:j,readSelectedTextLength:()=>rA(g),removeSelectedText:()=>sA(g),isCaretOnVisualEdge:D=>aA(g,D)}),[g,O,j]);let U=R(D=>{D.read(()=>{let J=OA(S.current),{value:G,cursor:M,expandedCursor:X,selection:F,terminalContextIds:ee}=J,Y=S.current;if(Y.value===G&&Y.cursor===M&&Y.expandedCursor===X&&Y.selection.anchor===F.anchor&&Y.selection.focus===F.focus&&Y.terminalContextIds.length===ee.length&&Y.terminalContextIds.every((te,de)=>te===ee[de])||N.current)return;S.current=J,rl(P.current,G,{cursor:M,expandedCursor:X,selection:F});let ae=tl(G,M,"left")||tl(G,M,"right");h.current(G,M,X,ae,ee)})},[]);return l(zc,{value:B,children:v("div",{className:V(LC,"grid"),children:[l(WM,{contentEditable:l(FE,{className:V(PC,"col-start-1 row-start-1 min-w-0",i),"data-testid":"composer-editor","data-composer-prompt":"true",spellCheck:!1,autoCorrect:"off",autoCapitalize:"off","aria-placeholder":s,...d?{"aria-label":d}:{},placeholder:l("span",{}),onPasteCapture:p}),placeholder:n.length>0?null:l("div",{className:"pointer-events-none col-start-1 row-start-1 min-w-0 select-none whitespace-pre-wrap wrap-break-word leading-relaxed text-placeholder",children:s}),ErrorBoundary:BE}),l(yM,{onChange:U}),l(SA,{...m?{onCommandKeyDown:m}:{}}),l(IA,{}),l(_A,{terminalContexts:n,skills:r}),l(LA,{}),l(kA,{}),l(PA,{}),l(EA,{}),l(AA,{}),l(MA,{}),l(gM,{externalHistoryState:A},e)]})})}function lW(e){let[t]=ct(),o=E(e),n=E(e),[r,a]=q(e.documentKey);r===e.documentKey&&(o.current=e),n.current=e,fe(()=>{r===e.documentKey||t.isComposing()||a(e.documentKey)},[r,t,e.documentKey]),H(()=>{let i=null,d=()=>{let u=n.current.documentKey;a(m=>m===u?m:u)},c=t.registerRootListener((u,m)=>{m?.removeEventListener("compositionend",d),u?.addEventListener("compositionend",d),i=u});return()=>{i?.removeEventListener("compositionend",d),c()}},[t]);let s=r===e.documentKey?e:o.current;return l(iW,{...s})}function ul({documentKey:e,value:t,cursor:o,terminalContexts:n,skills:r,disabled:a,placeholder:s,className:i,ariaLabel:d,onRemoveTerminalContext:c,onChange:u,onCommandKeyDown:m,onPaste:p,editorRef:f}){let g=E(t),h=E(n),y=E(Rs(r)),x=E(ks().current),C=W(()=>({namespace:"ycodium-composer-editor",editable:!0,nodes:[Ps,sl,dr,...vC],editorState:()=>{Gc(g.current,h.current,y.current,x.current)},onError:b=>{throw b}}),[]);return l(YR,{initialConfig:C,children:l(lW,{documentKey:e,value:t,cursor:o,terminalContexts:n,skills:r,disabled:a,placeholder:s,onRemoveTerminalContext:c,onChange:u,onPaste:p,editorRef:f,...m?{onCommandKeyDown:m}:{},...i?{className:i}:{},...d?{ariaLabel:d}:{}})},sW)}function FA(e){return typeof e=="object"&&e!==null&&"then"in e&&typeof e.then=="function"}function BA(e){return FA(e)?Promise.resolve(e).then(BA):e===!1?!1:e==null?!0:e.accepted}function jc(e,t,o){let n=e.trim().length-t;return n<=0?null:o("composer.promptTooLong",{count:n,excess:n.toLocaleString("en-US"),max:t.toLocaleString("en-US")})}function RC(e){return e.submissionTarget==="provider-turn"?jc(e.providerInput??e.prompt,e.maxInputChars,e.t):null}function HA(e){return FA(e)}function UA(e){let t=RC(e);if(t)return e.event?.preventDefault(),{validationMessage:t,didDispatch:!1};let o=BA(e.onSend(e.event));return typeof o!="boolean"?o.then(n=>(n||e.event?.preventDefault(),{validationMessage:null,didDispatch:n})):(o||e.event?.preventDefault(),{validationMessage:null,didDispatch:o})}var xo=new Map;function dW(e,t,o){return`${e}\0${t}\0${o??"none"}`}function EC(e,t){xo.delete(e),xo.set(e,t)}function pl(e,t){if(xo.get(e)===t){if(t.operationLeases>0){t.disposeRequested=!0;return}t.releaseAuthorityWatch?.(),t.releaseAuthorityWatch=void 0,xo.delete(e);for(let o of t.state.added)t.releaseUpload(o.id),URL.revokeObjectURL(o.previewUrl);for(let o of t.listeners)o()}}function cW(e){if(xo.size<=100)return;let t=Array.from(xo);for(let[o,n]of t){if(xo.size<=100)return;o===e||n.committed||n.listeners.size>0||n.operationLeases>0||pl(o,n)}for(let[o,n]of t){if(xo.size<=100)return;o===e||n.listeners.size>0||n.operationLeases>0||pl(o,n)}}function Ff(){queueMicrotask(()=>cW())}function $A(e,t,o,n,r=void 0){let a=o.management?.revision??null,s=dW(e,o.intentId,a),i=xo.get(s);if(i)return i.releaseUpload=n.releaseUpload,i.watchAuthority=r,i.state;let d={key:s,inputKey:e,environmentId:t,intentId:o.intentId,revision:a,text:o.management?.text??o.text??"",retained:o.management?.attachments??[],added:[],saving:!1,error:null},c={state:d,listeners:new Set,releaseUpload:n.releaseUpload,operationLeases:0,committed:!1,disposeRequested:!1,watchAuthority:r,releaseAuthorityWatch:void 0};return xo.set(s,c),d}function zA(e,t){let o=xo.get(e);return o?(o.releaseAuthorityWatch===void 0&&o.watchAuthority!==void 0&&(o.releaseAuthorityWatch=o.watchAuthority({threadKey:o.state.inputKey,intentId:o.state.intentId,revision:o.state.revision,onInvalid:()=>pl(e,o)})),o.committed=!0,EC(e,o),o.listeners.add(t),Ff(),()=>{o.listeners.delete(t),Ff()}):()=>{}}function Ms(e,t){let o=xo.get(e);if(!o)return;o.committed=!0;let n=t(o.state);if(n!==o.state){o.state=n,EC(e,o);for(let r of o.listeners)r()}}function Bf(e){return xo.get(e)?.state}function KA(e){let t=xo.get(e);if(!t)return null;t.committed=!0,t.operationLeases+=1,EC(e,t);let o=!1;return()=>{if(!o){if(o=!0,t.operationLeases=Math.max(0,t.operationLeases-1),t.operationLeases===0&&t.disposeRequested){pl(e,t);return}Ff()}}}function Hf(e){let t=xo.get(e);t&&pl(e,t)}function qA(e,t){let o=new Map(t.flatMap(n=>n.waiting&&n.management!==void 0?[[n.intentId,n.management.revision]]:[]));for(let[n,r]of xo)r.state.inputKey===e&&o.get(r.state.intentId)!==r.state.revision&&pl(n,r);Ff()}var uW=[],pW=[],mW=()=>{};function WA({entry:e,current:t,inputKey:o,environmentId:n,unavailable:r,attachments:a,watchEditorAuthority:s,onEdit:i,onClose:d}){let{t:c}=z(),u=$A(o,n,e,a,s),m=Go(D=>zA(u.key,D),()=>Bf(u.key)??u,()=>Bf(u.key)??u),{key:p,text:f,retained:g,added:h,saving:y,error:x}=m,C=E(null),[b,L]=q(()=>f.length),w=vo()?.data.assistantQuotes??null,k=D=>jc(w?w.expandForProvider(D):D,a.limits.maxInputChars,c),I=k(f),T=E(null),S=a.useUploadStatuses(),P=W(()=>g.map(D=>D.id),[g]),A=a.useAssetUrls(n,P),N=!t?.management||t.management.revision!==e.management?.revision;H(()=>{t===void 0&&(Hf(p),d())},[t,p,d]);let B=()=>{y||(Hf(p),d())},O=D=>{if(y||r||N)return;let J=null,G=[...h];for(let M of D){let X=M.type||"application/octet-stream";if(M.size===0){J=c("attachments.empty",{name:M.name});continue}let F=a.makeImageAttachment({id:a.randomUUID(),name:M.name,mimeType:X,sizeBytes:M.size,file:M});G.push(F),a.startUpload({environmentId:n,image:F})}Ms(p,M=>({...M,added:G,error:J}))},j=async()=>{let D=Bf(p);if(!D||D.saving||r||N||!D.text.trim()&&D.retained.length+D.added.length===0||k(D.text)!==null)return;let J=KA(p);if(J!==null){Ms(p,G=>({...G,saving:!0,error:null}));try{await a.awaitUploads(D.added.map(M=>M.id));let G=a.getUploadedAttachments({environmentId:n,images:D.added});if(!G)throw new Error(c("turnQueue.uploadFailed"));await i(e,{text:D.text,attachments:[...D.retained,...G]}),Hf(p),d()}catch(G){Ms(p,M=>({...M,saving:!1,error:G instanceof Error?G.message:c("turnQueue.actionFailed")}))}finally{J()}}},U=[...g.map((D,J)=>({...D,previewUrl:A[J],added:!1})).filter(D=>D.source?._tag!=="thread-reference"),...h.map(D=>({...D,added:!0}))];return l(Js,{open:!0,onOpenChange:D=>{D||B()},children:v(ei,{className:"max-w-2xl","data-queued-message-editor":!0,initialFocus:()=>(C.current?.focusAtEnd(),!1),children:[v(Hu,{children:[l(ti,{children:c("turnQueue.editTitle")}),l(Zs,{children:c("turnQueue.editDescription")})]}),v("div",{className:"max-h-[60dvh] space-y-3 overflow-y-auto px-6 pb-4",onDragOver:D=>{D.dataTransfer.types.includes("Files")&&D.preventDefault()},onDrop:D=>{D.dataTransfer.files.length&&(D.preventDefault(),D.stopPropagation(),O(Array.from(D.dataTransfer.files)))},children:[l("div",{className:"rounded-lg border border-input bg-background px-3 py-2 focus-within:border-ring focus-within:ring-[3px] focus-within:ring-ring/24",children:l(ul,{editorRef:C,documentKey:`queue-editor\0${p}`,value:f,cursor:b,terminalContexts:uW,skills:pW,disabled:y,placeholder:c("turnQueue.editText"),ariaLabel:c("turnQueue.editText"),className:"max-h-[40dvh]",onRemoveTerminalContext:mW,onChange:(D,J)=>{L(J),Ms(p,G=>({...G,text:D}))},onCommandKeyDown:(D,J)=>D!=="Enter"||!(J.metaKey||J.ctrlKey)?!1:(j(),!0),onPaste:D=>{D.clipboardData.files.length&&(D.preventDefault(),O(Array.from(D.clipboardData.files)))}})}),I?l("p",{role:"alert",className:"text-sm text-destructive-foreground",children:I}):null,l("ul",{className:"flex flex-wrap gap-2",children:U.map(D=>v("li",{className:"flex max-w-full items-center gap-2 rounded-md border border-border px-2 py-1.5",children:[D.type==="image"&&D.previewUrl?l("img",{src:D.previewUrl,alt:D.name,className:"size-12 rounded object-cover"}):l(jo,{className:"size-4 shrink-0"}),v("div",{className:"min-w-0 text-xs",children:[l("p",{className:"max-w-48 break-words",children:D.name}),l("p",{className:"text-muted-foreground",children:a.formatAttachmentSize(D.sizeBytes)}),D.added&&S.get(D.id)!=="ready"?l("p",{children:c(S.get(D.id)==="failed"?"turnQueue.uploadFailed":"turnQueue.uploading")}):null,D.added&&S.get(D.id)==="failed"?l(K,{size:"xs",variant:"ghost",disabled:y||r||N,onClick:()=>{let J=h.find(G=>G.id===D.id);J&&a.retryUpload({environmentId:n,image:J})},children:c("turnQueue.retryUpload")}):null]}),l(K,{size:"icon-xs",variant:"ghost","aria-label":c("turnQueue.removeAttachment",{name:D.name}),disabled:y||N,onClick:()=>{D.added?(a.releaseUpload(D.id),D.previewUrl&&URL.revokeObjectURL(D.previewUrl),Ms(p,J=>({...J,added:J.added.filter(G=>G.id!==D.id)}))):Ms(p,J=>({...J,retained:J.retained.filter(G=>G.id!==D.id)}))},children:l(dt,{className:"size-3.5"})})]},D.id))}),l("input",{ref:T,type:"file",multiple:!0,className:"hidden","aria-label":c("turnQueue.addAttachments"),onChange:D=>{O(Array.from(D.target.files??[])),D.target.value=""}}),v(K,{size:"sm",variant:"outline",disabled:y||r||N,onClick:()=>T.current?.click(),children:[l(jo,{className:"size-4"}),c("turnQueue.addAttachments")]}),N?l("p",{role:"alert",className:"text-sm text-muted-foreground",children:c("turnQueue.editStale")}):null,x?l("p",{role:"alert",className:"text-sm text-destructive-foreground",children:x}):null]}),v(Bu,{children:[l(K,{variant:"ghost",disabled:y,onClick:B,children:c("turnQueue.discardEdit")}),l(K,{disabled:y||r||N||I!==null||!f.trim()&&U.length===0,onClick:()=>{j()},children:c(y?"turnQueue.saving":"turnQueue.saveEdit")})]})]})})}$();var On=["approval-required","auto-accept-edits","auto","full-access"];var fW={"approval-required":od,"auto-accept-edits":Gn,auto:jn,"full-access":Wr},gW={"approval-required":"approvalRequired","auto-accept-edits":"autoAcceptEdits",auto:"auto","full-access":"fullAccess"};function ml(){let{t:e}=z();return R(t=>{let o=gW[t];return{mode:t,label:e(`runtimeMode.${o}`),description:e(`runtimeMode.${o}Description`),icon:fW[t]}},[e])}function GA(e){let{t}=z(),o=ml(),{interactionMode:n,runtimeMode:r,nativeModeName:a}=e.sentWith,s=[n===void 0?null:t(n==="plan"?"turnQueue.sentWithPlan":"turnQueue.sentWithNoPlan"),a??(r===void 0?null:o(r).label)].filter(i=>i!=null);return l("p",{className:"text-muted-foreground","data-queued-sent-with":!0,children:t("turnQueue.sentWith",{modes:s.join(", ")})})}function jA(e,t){let o=e.find(a=>a.intentId===t.intentId);if(!o)return e;let n=e.filter(a=>a.intentId!==t.intentId),r=t.beforeIntentId===null?n.length:n.findIndex(a=>a.intentId===t.beforeIntentId);return r<0?e:(n.splice(r,0,o),n)}function VA(e,t,o){if(t===o)return null;let n={intentId:t,beforeIntentId:o,previousOrder:e.map(a=>a.intentId)};return jA(e,n).every((a,s)=>a.intentId===e[s]?.intentId)?null:n}function QA(e,t){if(!e.find(d=>d.intentId===t.intentId)?.management?.canReorder||t.beforeIntentId!==null&&!e.some(d=>d.intentId===t.beforeIntentId))return{entries:e,settled:!0};let n=new Set(e.map(d=>d.intentId)),r=new Set(t.previousOrder),a=t.previousOrder.filter(d=>n.has(d));return e.filter(d=>r.has(d.intentId)).some((d,c)=>d.intentId!==a[c])?{entries:e,settled:!0}:{entries:jA(e,t),settled:!1}}$();$();function hW({entry:e,unavailable:t,onCancel:o}){let{t:n}=z(),r=E(!1),[a,s]=q(!1),[i,d]=q(!1),[c,u]=q(!1);H(()=>{u(!1),d(!1)},[e.status,e.deliveryCertainty]);let m=async()=>{if(!(r.current||t||e.action===null)){r.current=!0,s(!0),d(!1);try{await o(e),u(!1)}catch{d(!0)}finally{r.current=!1,s(!1)}}};return v("li",{className:"space-y-2 border-t border-border py-2","data-turn-queue-message":!0,children:[l("p",{className:"text-muted-foreground",children:n(e.deliveryCertainty==="unknown"?"turnQueue.itemUnknown":e.waitingForCapacity===!0?"turnQueue.itemCapacity":e.status==="queued"?"turnQueue.itemQueued":e.status==="blocked"||e.status==="reconciling"?"turnQueue.itemBlocked":"turnQueue.itemRunning")}),l("p",{className:"whitespace-pre-wrap break-words [overflow-wrap:anywhere]",children:e.text??n("turnQueue.messageUnavailable")}),e.attachmentNames.length>0?l("p",{className:"break-words text-muted-foreground",children:e.attachmentNames.join(", ")}):null,e.action!==null?c&&e.action==="abandon"?v("div",{className:"space-y-2",children:[l("p",{children:n("turnQueue.abandonDescription")}),v("div",{className:"flex flex-wrap gap-2",children:[l(K,{size:"xs",variant:"outline",disabled:a||t,onClick:()=>{m()},children:n("turnQueue.confirmAbandon")}),l(K,{size:"xs",variant:"ghost",disabled:a,onClick:()=>u(!1),children:n("turnQueue.keepWaiting")})]})]}):l(K,{size:"xs",variant:"outline",disabled:a||t,onClick:()=>e.action==="abandon"?u(!0):void m(),children:n(a?"turnQueue.cancelling":e.action==="abandon"?"turnQueue.stopWaiting":"turnQueue.cancelMessage")}):null,i?l("p",{role:"alert",className:"text-destructive-foreground",children:n("turnQueue.actionFailed")}):null]})}function XA({entries:e,unavailable:t,onCancel:o,autoExpand:n=!1}){let{t:r}=z(),[a,s]=q(null),i=a??n,d=ho();return e.length===0?null:v("div",{className:"min-w-0 basis-full space-y-2",children:[l(K,{size:"xs",variant:"ghost","aria-expanded":i,"aria-controls":d,onClick:()=>s(!i),children:r(i?"turnQueue.hideMessages":"turnQueue.showMessages")}),i?l("ol",{id:d,className:"max-h-64 overflow-y-auto overscroll-contain",children:e.map(c=>l(hW,{entry:c,unavailable:t,onCancel:o},c.intentId))}):null]})}function MC({queue:e,environmentId:t=null,unavailable:o=!1,onResume:n,entries:r,onCancel:a}){let{t:s}=z(),i=E(!1),[d,c]=q(!1),[u,m]=q(!1);H(()=>{e.paused||m(!1)},[e.paused]);let p=e.waitingForCapacity??null,g=Nt().useProviderName?.(t,p?.instanceId??"",p?.instanceId?p.agentName:void 0)??s("turnQueue.unknownProvider"),h=e.deliveryUncertain||e.blocked||e.reconciling||p!==null;if(!e.paused&&!h)return null;let y=r?.[0]?.action==="abandon"&&(e.reconciling||e.deliveryUncertain),x=e.paused?s("turnQueue.pausedTitle"):e.deliveryUncertain?s("turnQueue.uncertainTitle"):e.blocked?s("turnQueue.blockedTitle"):e.reconciling?s("turnQueue.reconcilingTitle"):s(p!==null?"turnQueue.capacityTitle":"turnQueue.queuedTitle"),C=e.deliveryUncertain?s("turnQueue.uncertainDescription"):e.blocked?s("turnQueue.blockedDescription"):e.reconciling?s("turnQueue.reconcilingDescription"):e.paused?s("turnQueue.pausedDescription"):p!==null?p.maxProcesses===null?s("turnQueue.capacityDescriptionNoLimit",{agent:g}):s("turnQueue.capacityDescription",{agent:g,count:p.maxProcesses}):null,b=async()=>{if(!(i.current||o||!e.paused)){i.current=!0,c(!0),m(!1);try{await n()}catch{m(!0)}finally{i.current=!1,c(!1)}}};return v("div",{className:V("mx-auto mb-2 flex w-full max-w-3xl select-none flex-wrap items-start gap-2 rounded-md border bg-background px-3 py-2 text-xs text-foreground",p!==null&&!e.paused?"border-border":"border-warning/40"),"data-turn-queue-banner":!0,role:"status",children:[v("div",{className:"min-w-0 flex-1 basis-48 space-y-1",children:[l("p",{className:"font-medium",children:x}),C===null?null:l("p",{className:"text-muted-foreground",children:C}),e.paused&&h?l("p",{className:"text-muted-foreground",children:s("turnQueue.pausedUncertainDescription")}):null,o?l("p",{className:"text-muted-foreground",children:s("turnQueue.disconnected")}):null,u&&e.paused?l("p",{className:"text-destructive-foreground",role:"alert",children:s("turnQueue.resumeFailed")}):null]}),e.paused?l(K,{size:"xs",variant:"outline",disabled:d,softDisabled:o,onClick:()=>{b()},children:s(d?"turnQueue.resuming":"turnQueue.resume")}):null,a&&r?l(XA,{entries:r.filter(L=>L.status!=="queued"),unavailable:o,onCancel:a,autoExpand:y}):null]})}var yW=[n0,o0],vW=[],CW={kind:"user"};function xW({submission:e,environmentId:t}){let{t:o}=z();return v("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:[l("span",{"aria-hidden":"true",className:"grid size-6 shrink-0 place-items-center",children:l("span",{className:"size-1.5 rounded-full bg-muted-foreground/60"})}),l(Eh,{source:CW,environmentId:t}),v("div",{className:"min-w-0 flex-1",children:[l("p",{className:"line-clamp-2 whitespace-pre-wrap break-words [overflow-wrap:anywhere]",children:Dd(e.text)||o("turnQueue.attachmentsOnly")}),e.attachmentNames.length?v("p",{className:"flex items-center gap-1 text-muted-foreground",children:[l(jo,{className:"size-3 shrink-0"}),l("span",{className:"truncate",children:e.attachmentNames.join(", ")})]}):null]}),l("span",{role:"status",className:"w-[5.25rem] shrink-0 text-end text-muted-foreground",children:o("primaryActions.sendingButtonLabel")})]})}function bW({entry:e,disabled:t,dropPosition:o,dragPosition:n,feedback:r,reducedMotion:a,locked:s,children:i}){let{t:d}=z(),{attributes:c,listeners:u,setNodeRef:m,setActivatorNodeRef:p,transform:f,transition:g,isDragging:h}=Zk({id:e.intentId,disabled:t,transition:a?null:{duration:160,easing:"ease-out"}});return v("li",{ref:m,"data-queue-intent":e.intentId,"data-queue-dragging":h||void 0,"data-queue-feedback":r,style:{transform:na.Transform.toString(f),transition:g},className:V("relative flex items-center gap-1.5 border-t border-border/50 px-2 py-1.5",s?"bg-muted/60":"bg-background hover:bg-accent",h&&"z-10 shadow-md ring-1 ring-primary/50 ring-inset [background:linear-gradient(var(--accent),var(--accent)),var(--background)]",r==="saved"&&"bg-primary/10 ring-1 ring-primary/30 ring-inset",r==="failed"&&"bg-destructive/10"),children:[o?l("span",{"aria-hidden":"true","data-queue-drop-position":o,className:V("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",o==="before"?"top-0":"bottom-0")}):null,s?l("span",{"aria-hidden":"true",className:"size-6 shrink-0"}):l(K,{ref:p,size:"icon-xs",variant:"ghost",className:V("shrink-0 touch-none cursor-grab text-muted-foreground active:cursor-grabbing",(h||r==="saved")&&"bg-primary/10 text-primary"),...c,...u,"aria-label":d("turnQueue.reorderMessage"),title:d("turnQueue.reorderMessage"),softDisabled:t,children:r==="saved"?l(Cn,{className:"size-3.5"}):l(Xl,{className:"size-3.5"})}),i,h&&n?l("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:n}):null]})}function YA({inputKey:e,entries:t,pendingSubmissions:o=vW,environmentId:n,unavailable:r,attachments:a,actions:s,onCancel:i,readRecord:d}){let{t:c}=z(),u=Vp("(prefers-reduced-motion: reduce)"),[m,p]=Ge(e,null,{namespace:"turn-queue:editing"}),[f,g]=Ge(e,!1,{namespace:"turn-queue:pending"}),h=$e(e,!1,{namespace:"turn-queue:pending-ref"}),[y,x]=Ge(e,null,{namespace:"turn-queue:error"}),[C,b]=Ge(e,null,{namespace:"turn-queue:drag"}),[L,w]=Ge(e,null,{namespace:"turn-queue:move"}),k=$e(e,!1,{namespace:"turn-queue:reorder-ref"}),[I,T]=Ge(e,null,{namespace:"turn-queue:feedback"}),S=Sk(Ph(Ii,{activationConstraint:{distance:5}}),Ph(Ti,{coordinateGetter:e0,scrollBehavior:u?"auto":"smooth"})),P=W(()=>t.filter(M=>M.waiting),[t]),A=L?QA(P,L.preview):null,N=A?.entries??P,B=N.length+o.length,O=r||f||L!==null,j=N.findIndex(M=>M.intentId===C?.activeId),U=N.findIndex(M=>M.intentId===C?.overId);H(()=>{qA(e,t)},[t,e]),H(()=>{L!==null&&(r||L.acknowledged&&A?.settled)&&(k.current=!1,w(null),!r&&P.some(M=>M.intentId===L.preview.intentId)&&T({intentId:L.preview.intentId,kind:"saved"}))},[P,L,A?.settled,r]),H(()=>{if(I===null||I.kind==="failed")return;let M=window.setTimeout(()=>T(X=>X===I?null:X),1600);return()=>window.clearTimeout(M)},[I]);let D=async M=>{if(!(h.current||k.current||r)){h.current=!0,g(!0),x(null),T(null);try{await M()}catch(X){x(X instanceof Error?X.message:c("turnQueue.actionFailed"))}finally{h.current=!1,g(!1)}}},J=(M,X)=>D(async()=>{let F=VA(P,M.intentId,X);if(!(F===null||!M.management?.canReorder)){k.current=!0,w({preview:F,acknowledged:!1});try{await s.onReorder(M,X),w(ee=>ee?.preview===F?{...ee,acknowledged:!0}:ee)}catch(ee){throw k.current=!1,w(null),T({intentId:M.intentId,kind:"failed"}),ee}}}),G=r?c("turnQueue.disconnected"):L!==null?c("turnQueue.saving"):C!==null?`${c("turnQueue.dragStarted")} ${U+1}/${N.length}`:I?.kind==="saved"?c("common.action.done"):I?.kind==="cancelled"?c("turnQueue.dragCancelled"):"";return v(oe,{children:[B>0?v("section",{"aria-label":c("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:[v("div",{className:"flex h-7 items-center justify-between gap-3 px-3 py-1.5 text-muted-foreground",children:[l("span",{className:"shrink-0",children:c("turnQueue.queued",{count:B})}),l("span",{role:"status","aria-live":C===null?"polite":"off","data-queue-reorder-status":L?"saving":I?.kind,className:V("min-w-0 truncate",I?.kind==="saved"&&"text-primary"),children:G})]}),l(zk,{sensors:S,collisionDetection:Pk,modifiers:yW,accessibility:{screenReaderInstructions:{draggable:c("turnQueue.dragInstructions")},announcements:{onDragStart:()=>c("turnQueue.dragStarted"),onDragOver:({over:M})=>{let X=N.findIndex(F=>F.intentId===M?.id);return X<0?void 0:`${c("turnQueue.dragStarted")} ${X+1}/${N.length}`},onDragEnd:()=>c("turnQueue.dragFinished"),onDragCancel:()=>c("turnQueue.dragCancelled")}},onDragStart:({active:M})=>{let X=N.find(F=>F.intentId===M.id);!X?.management?.canReorder||O||(x(null),T(null),b({activeId:X.intentId,overId:X.intentId}))},onDragOver:({over:M})=>{let X=N.find(F=>F.intentId===M?.id);X&&b(F=>F&&{...F,overId:X.intentId})},onDragCancel:()=>{C&&T({intentId:C.activeId,kind:"cancelled"}),b(null)},onDragEnd:({active:M,over:X})=>{if(b(null),!X||M.id===X.id)return;let F=N.findIndex(te=>te.intentId===M.id),ee=N.findIndex(te=>te.intentId===X.id),Y=N[F];if(!Y?.management?.canReorder||ee<0)return;let ae=N[ee+(F<ee?1:0)]?.intentId??null;J(Y,ae)},children:l(Yk,{items:N.map(M=>M.intentId),strategy:Vk,children:v("ol",{className:"max-h-52 overflow-x-hidden overflow-y-auto overscroll-contain [scrollbar-gutter:stable]",children:[N.map((M,X)=>v(bW,{entry:M,disabled:!M.management?.canReorder||O,locked:Yd(M),reducedMotion:u,feedback:I?.intentId===M.intentId?I.kind:void 0,dropPosition:M.intentId===C?.overId&&j!==U?j<U?"after":"before":void 0,dragPosition:M.intentId===C?.activeId?`${U+1}/${N.length}`:void 0,children:[l(Eh,{source:M.source,environmentId:n}),v("div",{className:"min-w-0 flex-1",children:[l("p",{className:"line-clamp-2 whitespace-pre-wrap break-words [overflow-wrap:anywhere]",children:l(l0,{entry:M,readRecord:d,environmentId:n})}),l(ip,{environmentId:n,rewrite:M.rewrite,text:M.rewrittenText??""}),M.attachmentNames.length?v("p",{className:"flex items-center gap-1 text-muted-foreground",children:[l(jo,{className:"size-3 shrink-0"}),l("span",{className:"truncate",children:M.attachmentNames.join(", ")})]}):null,M.pendingAction?l("p",{className:"text-muted-foreground",children:c(M.pendingAction==="steer"?"turnQueue.steering":"turnQueue.interrupting")}):null,M.sentWith?l(GA,{sentWith:M.sentWith}):null,M.failure?l("p",{role:"alert",className:"text-destructive-foreground",children:M.failure}):null]}),v("div",{className:V("flex shrink-0 items-center gap-0.5",M.intentId===C?.activeId&&"invisible"),children:[Yd(M)?null:l(K,{size:"icon-xs",variant:"ghost",disabled:!M.management||O||C!==null,"aria-label":c("turnQueue.editMessage"),title:c("turnQueue.editMessage"),onClick:()=>p(M),children:l(ld,{className:"size-3.5"})}),M.management?.canSteer?l(K,{size:"icon-xs",variant:"ghost",disabled:O||C!==null,"data-turn-queue-steer":"","aria-label":c("turnQueue.steer"),title:c("turnQueue.steerDescription"),onClick:()=>{D(()=>s.onRun(M,"steer"))},children:l(pd,{className:"size-3.5"})}):null,v(Ao,{children:[l(Do,{render:l(K,{size:"icon-xs",variant:"ghost",disabled:O||!M.management&&!Yd(M)&&M.action!=="cancel"||C!==null,"aria-label":c("turnQueue.messageActions")}),children:l(Eo,{className:"size-4"})}),v(No,{align:"end",children:[Yd(M)?null:v(oe,{children:[v(bo,{disabled:!M.management?.canReorder||X===0,onClick:()=>{J(M,N[X-1].intentId)},children:[l(Ol,{className:"size-4"}),c("turnQueue.moveUp")]}),v(bo,{disabled:!M.management?.canReorder||X===N.length-1,onClick:()=>{J(M,N[X+2]?.intentId??null)},children:[l(Dl,{className:"size-4"}),c("turnQueue.moveDown")]}),M.management?.canSteer?l(bo,{onClick:()=>{D(()=>s.onRun(M,"steer"))},children:c("turnQueue.steer")}):null,l(bo,{disabled:!M.management?.canRun,onClick:()=>{D(()=>s.onRun(M,"interrupt"))},children:c(M.management?.expectedTurnId?"turnQueue.interruptAndRun":"turnQueue.sendNext")}),l(xd,{})]}),l(bo,{disabled:M.action!=="cancel",onClick:()=>{D(()=>i(M))},children:c("turnQueue.cancelMessage")})]})]})]})]},M.intentId)),o.map(M=>l(xW,{submission:M,environmentId:n},M.messageId))]})})},e),y?l("p",{role:"alert",className:"px-3 py-2 text-destructive-foreground",children:y}):null]}):null,m?l(WA,{entry:m,current:t.find(M=>M.intentId===m.intentId),inputKey:e,environmentId:n,unavailable:O,attachments:a,watchEditorAuthority:s.watchEditorAuthority,onEdit:s.onEdit,onClose:()=>p(null)},`${e}\0${m.intentId}\0${m.management?.revision??"none"}`):null]})}function JA({data:e,target:t,inputKey:o,attachments:n}){let r=e.useQueue({target:t,threadKey:o}),a=e.useCommandFailureText?.(),{environmentId:s,threadId:i}=t,d=e.queue,c=p=>e.useCommunicationRecord(t,p),u=W(()=>{let p={environmentId:s,threadId:i};return{actions:{onEdit:async(g,h)=>{try{await d.edit(p,g,h)}catch(y){let x=a?.(y);throw x?new Error(x):y}},onReorder:(g,h)=>d.reorder(p,g,h),onRun:(g,h)=>d.run(p,g,h),watchEditorAuthority:d.watchEditorAuthority},onCancel:g=>d.cancel(p,g),onResume:()=>d.resume(p)}},[d,s,a,i]),m=W(()=>({data:e,target:t,threadKey:`${o}\0queue-editor`}),[e,t,o]);return v(oe,{children:[l(Np,{value:m,children:l(YA,{inputKey:o,actions:u.actions,attachments:n,entries:r.entries,pendingSubmissions:r.pendingSubmissions,environmentId:s,onCancel:u.onCancel,readRecord:c,unavailable:r.unavailable})}),l(MC,{environmentId:s,entries:r.entries,onCancel:u.onCancel,onResume:u.onResume,queue:r.state,unavailable:r.unavailable})]})}$();$();$();function fl({unavailableReason:e=null,disabled:t,className:o,children:n,...r}){let a=ho(),s=t===!0&&e!==null;return v(oe,{children:[v(Pe,{disabled:!s,children:[l(Ee,{"aria-describedby":s?a:void 0,render:l(K,{...r,disabled:t&&!s,softDisabled:s,className:V("rounded-full shadow-none! inset-shadow-none! ease-out before:rounded-full sm:rounded-full",o)}),children:n}),l(Re,{side:"top",className:"max-w-72",children:e})]}),s?l("span",{id:a,hidden:!0,children:e}):null]})}var Vc="not-disabled:not-aria-disabled:border-message-action not-disabled:not-aria-disabled:bg-message-action not-disabled:not-aria-disabled:text-message-action-foreground not-disabled:not-aria-disabled:hover:bg-message-action-hover",Qc=(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"),wW=e=>{e.preventDefault()},gl=pe(function({compact:t,pendingAction:o,isRunning:n,showPlanFollowUpPrompt:r,promptHasText:a,isSendBusy:s,sendDisabledReason:i,isEnvironmentUnavailable:d,hasSendableContent:c,preserveComposerFocusOnPointerDown:u=!1,showSendWhileRunning:m=!1,onInterrupt:p,interruptArmed:f=!1,stopping:g=!1,cancelsCheck:h=!1,onImplementPlanInNewThread:y,shellCommandMode:x=!1,shellCommandUnavailableReason:C=null}){let{t:b}=z(),L=it(),w=u?{onPointerDown:wW}:void 0,k=L.settings.useEnvironmentIdentificationMode(),I=i!==null,T=s?null:i??(d?b("primaryActions.environmentDisconnected"):null),S=L.devBackdrop.useVisible(k==="artwork"),P=O=>l(fl,{type:"button",variant:"destructive",size:g||f?"sm":"icon",className:V(g?"h-8 px-3 text-xs sm:h-8 sm:text-xs":f?"h-8 px-3 text-xs ring-2 ring-destructive-solid/60 sm:h-8 sm:text-xs":O?"size-8 sm:size-7":m&&c?"size-9 sm:size-8":"size-8 sm:h-8 sm:w-8"),...w,onClick:p,disabled:g,"data-interrupt-armed":f&&!g?"":void 0,"aria-label":b(g?"primaryActions.stopping":f?"primaryActions.confirmStopEsc":h?"primaryActions.cancelCheck":"primaryActions.stopGeneration"),children:g?b("primaryActions.stopping"):f?b("primaryActions.confirmStopEsc"):l("svg",{className:"size-3",viewBox:"0 0 12 12",fill:"currentColor","aria-hidden":"true",children:l("rect",{x:"2",y:"2",width:"8",height:"8",rx:"1.5"})})});if(o)return v("div",{className:V("flex items-center justify-end",t?"gap-1.5":"gap-2"),children:[n?P(!0):null,l(K,{type:"submit",size:"sm",className:V("rounded-full bg-message-action text-message-action-foreground hover:bg-message-action-hover",t?"px-3":"px-4"),...w,disabled:d||o.isResponding||(o.isLastQuestion?!o.isComplete:!o.canAdvance),children:Qc(b,{compact:t,isLastQuestion:o.isLastQuestion,isResponding:o.isResponding,questionIndex:o.questionIndex})})]});if(x){let O=l(fl,{type:"submit",variant:"secondary",size:"icon","data-shell-command-run":"true",className:V("size-9 sm:size-8",Vc),...w,disabled:C!==null||!c,unavailableReason:C,"aria-label":b("primaryActions.runInTerminal"),children:l(Vo,{"aria-hidden":"true",className:"size-4"})});return n?v(oe,{children:[P(!1),O]}):O}if(r)return a?l(fl,{type:"submit",size:"sm",className:V(Vc,t?"h-9 px-3 sm:h-8":"h-9 px-4 sm:h-8"),...w,disabled:s||I||d,unavailableReason:T,children:b(s?"primaryActions.sendingButtonLabel":"primaryActions.refine")}):v("div",{"data-chat-composer-implement-actions":"true",className:"flex items-center justify-end",children:[l(fl,{type:"submit",size:"sm",className:V("h-9 rounded-r-none px-4 before:rounded-r-none sm:h-8 sm:rounded-r-none",Vc),...w,disabled:s||I||d,unavailableReason:T,children:b(s?"primaryActions.sendingButtonLabel":"primaryActions.implement")}),v(Ao,{children:[l(Do,{render:l(K,{size:"sm",variant:"default",className:V("h-9 rounded-l-none rounded-r-full border-l-message-action-foreground/20 px-2 sm:h-8",Vc),"aria-label":b("primaryActions.implementationActions"),disabled:s||I||d}),children:l(Tt,{})}),l(No,{align:"end",side:"top",children:l(bo,{disabled:s||I||d,onClick:()=>{y()},children:b("primaryActions.implementInNewThread")})})]})]});let A=s||I||d||!c,N=S&&!A,B=v(fl,{type:"submit",variant:"secondary",size:"icon",className:V("isolate size-9 sm:size-8",N?"bg-transparent text-white":Vc),...w,disabled:A,unavailableReason:T,"aria-label":b(s?"primaryActions.sendingAriaLabel":"primaryActions.sendMessage"),children:[N?l("span",{className:"pointer-events-none absolute inset-0 -z-10 overflow-hidden rounded-full","aria-hidden":"true",children:l(Db,{compact:!0})}):null,s?l(Qs,{className:"size-3.5","aria-hidden":"true"}):l("svg",{className:"size-4",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:l("path",{d:"M7 11.5V2.5M7 2.5L3 6.5M7 2.5L11 6.5",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})})]});return n?v(oe,{children:[P(!1),m&&c?B:null]}):B});function Sa(e){return e.id??e.label}function Uf(e,t){return Array.from(new Set((t??[]).flatMap(o=>{let n=e.options.find(r=>r.id!==void 0?r.id===o:r.label===o.trim());return n?[Sa(n)]:[]})))}function TW(e){if(typeof e!="string")return null;let t=e.trim();return t.length>0?t:null}function hl(e,t){if(t?.attachmentsBlocked)return null;let o=TW(t?.customAnswer);if(e.allowFreeform!==!1&&o)return o;let n=Uf(e,t?.selectedOptionLabels),r=e.allowFreeform!==!1&&(t?.attachmentCount??0)>0;return e.multiSelect?n.length>0?n:r?"":null:n[0]??(r?"":null)}function ZA(e,t){let o=t.trim().length>0?void 0:e?.selectedOptionLabels;return{customAnswer:t,...o&&o.length>0?{selectedOptionLabels:o}:{}}}function eN(e,t,o){let n=Uf(e,[o])[0];if(n===void 0)return t??{};if(e.multiSelect){let r=Uf(e,t?.selectedOptionLabels),a=r.includes(n)?r.filter(s=>s!==n):[...r,n];return{customAnswer:"",...a.length>0?{selectedOptionLabels:a}:{}}}return{customAnswer:"",selectedOptionLabels:[n]}}function AC(e,t){let o={};for(let n of e){let r=hl(n,t[n.id]);if(r===null)return null;o[n.id]=r}return o}function IW(e,t){return e.reduce((o,n)=>hl(n,t[n.id])!==null?o+1:o,0)}function $f(e,t,o){let n=e.length===0?0:Math.max(0,Math.min(o,e.length-1)),r=e[n]??null,a=r?t[r.id]:void 0,s=r?hl(r,a):null,i=r?.allowFreeform===!1?"":a?.customAnswer??"",d=IW(e,t),c=e.length===0?!0:n>=e.length-1;return{questionIndex:n,activeQuestion:r,activeDraft:a,selectedOptionLabels:r?Uf(r,a?.selectedOptionLabels):[],customAnswer:i,resolvedAnswer:s,usingCustomAnswer:i.trim().length>0,answeredQuestionCount:d,isLastQuestion:c,isComplete:AC(e,t)!==null,canAdvance:s!==null}}var SW={approve:{label:"pendingUserInput.planApprove",description:"pendingUserInput.planApproveHint"},revise:{label:"pendingUserInput.planRevise",description:"pendingUserInput.planReviseHint"},stop:{label:"pendingUserInput.planStop",description:"pendingUserInput.planStopHint"}};function yl(e,t,o){if(o.displayKind==="acknowledge")return{label:e("pendingUserInput.acknowledge"),description:e("pendingUserInput.continueHint")};let n=t.kind==="plan"&&o.planAction!==void 0?SW[o.planAction]:void 0;return n===void 0?{label:o.label,description:o.description??""}:{label:e(n.label),description:e(n.description)}}function zf(e){let{t}=z();return e.questions.length<2?null:l("div",{className:"flex flex-wrap items-center gap-1","data-pending-user-input-steps":!0,children:e.questions.map((o,n)=>{let r=n===e.currentIndex,a=hl(o,e.answers[o.id])!==null;return v(K,{size:"xs",variant:r?"outline":"ghost","aria-current":r?"step":void 0,"aria-label":t("pendingUserInput.goToQuestion",{index:n+1,question:o.header}),disabled:e.disabled,"data-pending-user-input-step":n,onClick:()=>e.onGoTo(n),children:[a?l(Cn,{"aria-hidden":!0}):null,n+1]},o.id)})})}function Kf(e){let{t}=z();return e.questions.length<2||e.currentIndex<e.questions.length-1?null:l("ul",{className:"flex flex-col border-t border-border/60 pt-1","data-pending-user-input-summary":!0,children:e.questions.slice(0,-1).map((o,n)=>{let r=hl(o,e.answers[o.id]),a=i=>{let d=o.options.find(c=>Sa(c)===i);return d?yl(t,o,d).label:i},s=r===null?t("pendingUserInput.unanswered"):r===""?t("pendingUserInput.attachmentsOnly"):(Array.isArray(r)?r:[r]).map(a).join(", ");return l("li",{children:v("button",{type:"button",disabled:e.disabled,"data-pending-user-input-summary-row":n,className:"flex w-full min-w-0 cursor-[var(--control-cursor)] items-baseline gap-2 rounded-md px-2 py-1 text-left text-chat-row transition-colors duration-(--control-duration) hover:bg-accent disabled:pointer-events-none pointer-coarse:min-h-11",onClick:()=>e.onGoTo(n),children:[l("span",{className:"max-w-[45%] shrink-0 truncate text-muted-foreground",children:o.header}),l("span",{className:r===null?"min-w-0 truncate text-warning-foreground":"min-w-0 truncate text-foreground",children:s})]})},o.id)})})}var tN=pe(function(t){let o=t.data.useQuestions(t.target);return o.pending.length===0?null:l("div",{"data-async-question-stack":!0,className:"mx-auto mb-2 flex max-h-[45vh] w-full max-w-3xl flex-col gap-2 overflow-y-auto overscroll-contain",children:o.pending.toReversed().map(n=>l(kW,{pending:n,actions:o},n.requestId))})}),kW=pe(function(t){let{pending:o,actions:n}=t,{t:r}=z(),[a,s]=q({}),[i,d]=q(0),[c,u]=q(!1),[m,p]=q(null),f=E(null);H(()=>()=>{f.current!==null&&window.clearTimeout(f.current)},[]);let g=o.questions,h=$f(g,a,i),y=h.activeQuestion;if(!y)return null;let x=AC(g,a),C=I=>{u(!0),p(null),I().then(T=>{u(!1),p(T)})},b=I=>{f.current!==null&&window.clearTimeout(f.current),f.current=null,d(Math.min(Math.max(I,0),g.length-1))},L=()=>{if(!c){if(!h.isLastQuestion){h.canAdvance&&b(h.questionIndex+1);return}x!==null&&C(()=>n.answer(o.requestId,x))}},w=I=>{if(s(S=>({...S,[y.id]:eN(y,S[y.id],I)})),y.multiSelect||h.isLastQuestion)return;f.current!==null&&window.clearTimeout(f.current);let T=h.questionIndex+1;f.current=window.setTimeout(()=>{f.current=null,b(T)},200)},k=y.header===y.question?r("asyncQuestion.title"):y.header;return l("section",{"data-async-question":o.requestId,"aria-label":r("asyncQuestion.title"),className:"overflow-hidden rounded-xl border border-border/60 bg-background/95 px-3 py-2 shadow-xs sm:px-4",children:v(vr,{state:"pending",icon:l(qn,{}),title:k,actions:v(oe,{children:[l(K,{size:"sm",variant:"ghost",className:"me-auto text-muted-foreground hover:text-foreground",disabled:c,onClick:()=>C(()=>n.dismiss(o.requestId)),children:r("asyncQuestion.dismiss")}),l(K,{size:"sm","data-async-question-submit":"",disabled:c||(h.isLastQuestion?x===null:!h.canAdvance),onClick:L,children:Qc(r,{compact:!1,isLastQuestion:h.isLastQuestion,isResponding:c,questionIndex:h.questionIndex})})]}),children:[l(zf,{questions:g,answers:a,currentIndex:h.questionIndex,disabled:c,onGoTo:b}),l("p",{className:"whitespace-pre-wrap break-words text-chat font-medium text-foreground","data-async-question-item":y.id,children:y.question}),y.multiSelect?l("p",{className:"text-chat-row text-muted-foreground",children:r("pendingUserInput.selectOneOrMore")}):null,y.options.length>0?l($u,{mode:y.multiSelect?"multiple":"single","aria-label":k,disabled:c,selected:h.usingCustomAnswer?[]:h.selectedOptionLabels,onToggle:w,onReselect:w,options:y.options.map(I=>{let T=yl(r,y,I);return{value:Sa(I),label:T.label,...T.description&&T.description!==T.label?{description:T.description}:{}}})},y.id):null,y.allowFreeform===!1?null:l(Vr,{type:"text",size:"sm",value:h.customAnswer,disabled:c,placeholder:r("asyncQuestion.answerPlaceholder"),"aria-label":r("asyncQuestion.answerLabel",{question:y.question}),onChange:I=>{let T=I.target.value;s(S=>({...S,[y.id]:ZA(S[y.id],T)}))},onKeyDown:I=>{I.key!=="Enter"||I.nativeEvent.isComposing||(I.preventDefault(),L())}}),l(Kf,{questions:g,answers:a,currentIndex:h.questionIndex,disabled:c,onGoTo:b}),m?l("p",{role:"alert",className:"text-chat-row text-destructive-foreground",children:m}):null]})})});$();var NC=220,LW={opacity:0,transform:"translate3d(0, 4rem, 0)"},PW={opacity:0,transform:"translate3d(0, 7rem, 0)"},oN={opacity:1,transform:"none"},nN={transition:`transform ${NC}ms ease-in, opacity ${NC}ms ease-in`},RW={default:"border-[var(--chat-composer-attached-outline)]",error:"border-destructive/24",info:"border-info/24",success:"border-success/24",warning:"border-warning/24"};function aN({className:e,items:t}){let{t:o}=z(),[n,r]=q(null),a=E(null),s=n!==null&&t.some(f=>f.id===n)?n:null;if(H(()=>()=>{a.current&&clearTimeout(a.current)},[]),t.length===0)return null;let i=t[0];if(!i)return null;let d=t.slice(1),c=d.length>0,u=c&&s!==i.id,m=d[0],p=f=>{!f.onDismiss||s||(r(f.id),a.current&&clearTimeout(a.current),a.current=setTimeout(()=>{a.current=null,f.onDismiss?.()},NC))};return l("div",{className:V("group/banner-stack chat-composer-drawer-slot",e),"data-composer-banner-drawer":"true",children:v("div",{className:V("relative flex flex-col-reverse",c?"group-hover/banner-stack:z-50 group-focus-within/banner-stack:z-50":null),children:[u&&m?l("div",{className:V("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)]",RW[m.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,l("div",{className:V("relative z-10",s===i.id?"pointer-events-none":null),style:{...nN,...s===i.id?LW:oN},children:l(rN,{item:i,attached:!0,exiting:s===i.id,onDismissRequest:()=>p(i)})}),c?l("div",{"data-composer-banner-stack-expanded-items":"true",className:V("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:l("div",{className:"min-h-0 overflow-hidden",children:l("div",{className:V("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:d.map(f=>l("div",{className:V(s===f.id?"pointer-events-none":null),style:{...nN,...s===f.id?PW:oN},children:l(rN,{item:f,attached:!1,exiting:s===f.id,onDismissRequest:()=>p(f)})},f.id))})})}):null]})})}function rN({item:e,attached:t,exiting:o,onDismissRequest:n}){let{t:r}=z(),a=e.onDismiss&&!e.actions;return e.presentation==="compact"?v(bd,{variant:e.variant,role:"status",className:V("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-composer py-1.5",e.className),"data-composer-banner-presentation":"compact","data-composer-banner-id":e.id,"data-variant":e.variant,children:[e.icon,v(Ag,{className:"flex min-w-0 items-baseline gap-1.5 font-normal leading-5",children:[l("span",{className:"shrink-0 font-medium text-foreground",children:e.title}),e.description?l("span",{className:"min-w-0 truncate text-muted-foreground",children:e.description}):null]}),e.actions||e.onDismiss?v(wd,{className:V("shrink-0",e.actionClassName),children:[e.actions,e.onDismiss?l(K,{size:"icon-xs",variant:"ghost","aria-label":e.dismissLabel??r("composer.dismissNotice"),disabled:o,onClick:n,children:l(dt,{})}):null]}):null]}):v(bd,{variant:e.variant,className:V(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-composer",e.className),"data-composer-banner-id":e.id,"data-variant":e.variant,children:[e.icon,l(Ag,{children:e.title}),e.description?l(Uu,{children:e.description}):null,e.actions||e.onDismiss?v(wd,{className:V(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?l(K,{size:"icon-xs",variant:"ghost","aria-label":e.dismissLabel??r("composer.dismissWarning"),disabled:o,onClick:n,children:l(dt,{})}):null]}):null]})}$();var sN=qe(!1),iN=sN.Provider;function lN(){return Pt(sN)}$();var dN=qe(null),cN=dN;function uN(){let[e,t]=q(0),o=R(n=>{t(r=>Math.max(0,r+(n?1:-1)))},[]);return[e>0,o]}function pN(){let e=xe(dN);fe(()=>(e?.(!0),()=>e?.(!1)),[e])}function EW({api:e,draftId:t,environmentId:o,slots:n,threadId:r}){let a=e.presets.useDraftPresetId(t),s=t!==null;return n?.renderSlot("conversation.hero.agentPreset",{environmentId:o,threadId:r,draftId:t,presetId:a,selectable:s,onSelectPreset:s&&t!==null?i=>e.presets.setDraftPresetId(t,i):void 0})}function mN({api:e,belowSlot:t,teamDock:o,composer:n,data:r,draftHero:a,draftId:s,environmentId:i,onOverlayElementChange:d,queue:c,questions:u,slots:m,target:p,threadId:f,threadKey:g}){let h=r.useComposerBanners({target:p,threadKey:g}),y=l(aN,{className:"relative z-0",items:h.items}),[x,C]=uN();return v("div",{ref:d,"data-chat-composer-overlay":"true",className:a.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:[v("div",{ref:a.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:[v("div",{className:"pointer-events-auto relative z-10",children:[c,u,a.active?v("div",{className:"absolute inset-x-0 bottom-full z-0",children:[e===void 0?m?.renderSlot("conversation.hero.agentPreset",{environmentId:i,threadId:f}):l(EW,{api:e,draftId:s??null,environmentId:i,slots:m,threadId:f}),l("div",{"aria-hidden":x||void 0,className:V("pb-8 transition-opacity duration-150 motion-reduce:transition-none",x&&"pointer-events-none select-none opacity-0"),style:{viewTransitionName:a.headlineTransitionName},children:a.headline}),y]},`${g}:${s??""}`):y,o==null?null:l("div",{"data-chat-composer-team-dock":"true",className:"mx-auto mb-2 w-full max-w-3xl",children:o}),v("div",{"data-chat-composer-stack":"true",className:"chat-composer-glass-shell relative mx-auto w-full max-w-3xl",style:{viewTransitionName:a.composerTransitionName},children:[l("div",{className:"chat-composer-glass-host relative z-10 w-full rounded-composer",children:l("div",{ref:a.composerAnchorRef,className:"relative z-10",children:l(iN,{value:h.items.length>0,children:l(cN,{value:C,children:n})})})}),l("div",{className:"min-h-0",children:t})]}),l("div",{"data-chat-composer-dock":"true",className:"mx-auto mt-2 w-full max-w-3xl empty:hidden",children:m?.renderSlot("conversation.input.dock",{environmentId:i,threadId:f})})]}),l("div",{"aria-hidden":!0,className:"h-[calc(env(safe-area-inset-bottom)+1rem)] sm:h-[calc(env(safe-area-inset-bottom)+1.25rem)]"})]}),h.overlay]})}function qf(e,t){let o=e.trim();return o?t?.trimLeadingPattern?o.replace(t.trimLeadingPattern,"").toLowerCase():o.toLowerCase():""}function MW(e,t){if(!t)return 0;let o=0,n=-1,r=-1,a=0;for(let s=0;s<e.length;s+=1)if(e[s]===t[o]&&(n===-1&&(n=s),r!==-1&&(a+=s-r-1),r=s,o+=1,o===t.length)){let i=s-n+1-t.length,d=Math.min(64,e.length-t.length);return n*2+a*3+i+d}return null}function DC(e,t){return Math.min(64,Math.max(0,e.length-t.length))}function AW(e,t,o){let n=null;for(let r of o){let a=e.indexOf(`${r}${t}`);if(a===-1)continue;let s=a+r.length;(n===null||s<n)&&(n=s)}return n}function Fn(e){let{value:t,query:o}=e;if(!t||!o)return null;if(t===o)return e.exactBase;if(e.prefixBase!==void 0&&t.startsWith(o))return e.prefixBase+DC(t,o);if(e.boundaryBase!==void 0){let n=AW(t,o,e.boundaryMarkers??[" ","-","_","/"]);if(n!==null)return e.boundaryBase+n*2+DC(t,o)}if(e.includesBase!==void 0){let n=t.indexOf(o);if(n!==-1)return e.includesBase+n*2+DC(t,o)}if(e.fuzzyBase!==void 0){let n=MW(t,o);if(n!==null)return e.fuzzyBase+n}return null}function NW(e,t){let o=e.score-t.score;return o!==0?o:e.tieBreaker.localeCompare(t.tieBreaker)}function DW(e,t){let o=0,n=e.length;for(;o<n;){let r=o+Math.floor((n-o)/2),a=e[r];if(!a)break;NW(t,a)<0?n=r:o=r+1}return o}function fN(e,t,o){if(o<=0)return;let n=DW(e,t);if(e.length<o){e.splice(n,0,t);return}n>=o||(e.splice(n,0,t),e.pop())}var Xc=(e,t,o=0)=>Fn({value:e.toLowerCase(),query:t,exactBase:o,prefixBase:o+2,boundaryBase:o+4,includesBase:o+6,...o<20?{fuzzyBase:o+100}:{},boundaryMarkers:[" ","-","_","/"]});function _W(e,t,o=[]){let n=t.trim().replace(/^\/+/,"").toLowerCase();return n?e.flatMap(r=>{let a=r.type==="slash-command"?r.command:r.type==="skill"?r.skill.name:r.command.name,s=r.type==="skill"&&n.startsWith("skill:")?n.slice(6):n,i=[Xc(a,s),Xc(r.description,s,20)];r.type==="skill"&&(i.push(Xc(r.skill.displayName??r.skill.name.replace(/[-_]/g," "),s,1)),i.push(Xc(r.skill.description??"",s,30)),i.push(Xc(r.skill.scope??"",s,40)),"skill".startsWith(n)&&i.push(n==="skill"?0:Number.MAX_SAFE_INTEGER));let d=i.filter(u=>u!==null);if(!d.length)return[];let c=r.type==="slash-command"?0:r.type==="provider-slash-command"?1:r.type==="skill"?2:3;return[{item:r,score:Math.min(...d)-(o.includes(r.id)?1:0),key:`${c}\0${a}\0${r.id}`}]}).sort((r,a)=>r.score-a.score||r.key.localeCompare(a.key)).map(({item:r})=>r):[...e]}function OW(e,t){let o=new Map(e.map(a=>[a.id,a])),n=[...new Set(t)].flatMap(a=>{let s=o.get(a);return s?[{...s,section:"recent"}]:[]}).slice(0,3),r=new Set(n.map(a=>a.id));return[...n,...e.filter(a=>!r.has(a.id)).map(a=>({...a,section:a.type==="slash-command"?"builtIn":a.type==="skill"?"skills":a.type==="plugin-slash-command"?"plugins":"provider"}))]}function gN(e){let t=new Set(e.skills.map(a=>a.name.trim().toLowerCase())),o=new Set(e.builtIns.map(a=>a.command)),n=[...e.builtIns.map(a=>({...a,id:`slash:${a.command}`,type:"slash-command",label:`/${a.command}`})),...e.commands.filter(a=>!t.has(a.name.toLowerCase())&&!o.has(a.name)).map(a=>({id:`provider-slash-command:${e.provider}:${a.name}`,type:"provider-slash-command",provider:e.provider,command:a,label:`/${a.name}`,description:a.description??a.input?.hint??e.providerDescription})),...(e.showSkills?e.skills.filter(xr):[]).map(a=>({id:`skill:${e.provider}:${a.name}`,type:"skill",provider:e.provider,skill:a,label:`/skill:${a.name}`,description:a.shortDescription??a.description??""})),...(e.plugins??[]).map(a=>({id:`plugin-slash:${a.pluginId}:${a.name}`,type:"plugin-slash-command",pluginId:a.pluginId,command:a,label:`/${a.name}`,description:a.description??a.argumentHint??""}))];return _C(`/${e.query.trim()}`,{builtIns:e.builtIns.map(a=>a.command),skills:e.skills,commands:e.commands,plugins:e.plugins})?.kind==="ambiguous"?n.filter(a=>a.type==="plugin-slash-command"&&a.command.name===e.query.trim()):e.query.trim()?_W(n,e.query,e.recentIds):OW(n,e.recentIds??[])}function _C(e,t){let o=/^\/([^\s]+)(?:\s|$)/.exec(e)?.[1];if(!o)return null;if(t.binding?.name===o){let r=t.plugins?.find(a=>a.pluginId===t.binding.pluginId&&a.name===o);return r?{kind:"plugin",command:r}:{kind:"unavailable",binding:t.binding}}if(t.builtIns.includes(o))return{kind:"builtIn",name:o};if(t.skills.some(r=>r.name===o&&xr(r)))return{kind:"skill",name:o};if(t.commands.some(r=>r.name===o))return{kind:"provider",name:o};let n=t.plugins?.filter(r=>r.name===o)??[];return n.length===1?{kind:"plugin",command:n[0]}:n.length>1?{kind:"ambiguous",commands:n}:null}var FW=()=>[];function hN(e){let{api:t,target:o}=e,n=(t.slashCommands?.useCommands??FW)(e.environmentId,o);return t.draft.useThreadDraftSelector(o,r=>{if(n.length===0)return!1;let a=_C(r.prompt,{builtIns:["model",...e.planModeEnabled?["plan","default"]:[]],skills:e.provider?.skills??[],commands:e.provider?.slashCommands??[],plugins:n,binding:t.slashCommands?.readBinding(o)});return a?.kind==="plugin"&&a.command.kind==="action"})}function yN(e,t){let o=e!==null&&e!=="plan-follow-up";return{showTopDrawer:e!==null&&(o||!t),showCollapsedPromptRow:t&&!o,hasBlocking:o}}function OC(e){return typeof e=="string"?e:`${e.environmentId}\0${e.threadId}`}var vN=(e,t)=>`${e}\0${OC(t)}`;$();var BW={"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 Wf(e,t){let o=e.code===void 0?void 0:BW[e.code];return o===void 0?e.reason:t(o,{status:e.httpStatus??""})}function CN(e,t){let o=0,n=0;for(let r of e.imageIds){let a=e.uploadsByImageId[r];a?.status==="failed"&&a.environmentId===e.environmentId?n+=1:(a?.status!=="ready"||a.environmentId!==e.environmentId)&&(o+=1)}return n>0?t("attachments.retryOrRemoveFailed",{count:n}):o>0?t("attachments.stillUploading",{count:o}):null}function Gf(e){let t=Math.max(0,Math.min(1,Number.isFinite(e)?e:0));return`${Math.floor(t*100)}%`}$();function xN(e,t){let o=t?.hasWideActions?780:620;return e!==null&&e<o}function bN(e,t){return t?.hasWideActions?e!==null&&e<780:!1}function wN(e,t){let o=it().pane.useVisible(),[n,r]=q(null);fe(()=>{if(!o)return;let s=e.current;if(!s)return;let i=!0;if(typeof ResizeObserver<"u"){let u=new ResizeObserver(m=>{if(!i)return;let p=m.find(y=>y.target===s);if(!p)return;let f=window.getComputedStyle(s),g=Number.parseFloat(f.paddingLeft)||0,h=Number.parseFloat(f.paddingRight)||0;r(Math.round(p.contentRect.width+g+h))});return u.observe(s),()=>{i=!1,u.disconnect()}}let d=null,c=()=>{d===null&&(d=window.requestAnimationFrame(()=>{d=null,i&&r(s.clientWidth)}))};return c(),window.addEventListener("resize",c),()=>{i=!1,window.removeEventListener("resize",c),d!==null&&window.cancelAnimationFrame(d)}},[e,o]);let a=xN(n,{hasWideActions:t});return{isComposerFooterCompact:a,isComposerPrimaryActionsCompact:a&&bN(n,{hasWideActions:t})}}$();function TN(e,t){let o=[],n=[];for(let r of e){let a=t(r);if(a.kind==="remote")return{paths:[],remote:!0,unavailableNames:[]};a.kind==="path"?o.push(a.path):n.push(r.name)}return{paths:o,remote:!1,unavailableNames:n}}function IN(e){let t=TN(e.folders,e.resolve);t.remote&&e.notifyError(e.t("attachments.folderRemote"));for(let o of t.unavailableNames)e.notifyError(e.t("attachments.folderPathUnavailable",{name:o}),e.t("attachments.folderPathUnavailableDetail"));for(let o of t.paths)e.insertText(`${Ls(o)} `)}var FC="ycodium:paste-as-text",SN=new TextEncoder;function kN(e,t){return e.key.toLowerCase()==="v"&&e.shiftKey&&!e.altKey&&(t?e.metaKey&&!e.ctrlKey:e.ctrlKey&&!e.metaKey)}function HW(e){return e.bypassAutoAttachment||!e.canAttach||e.text.length===0?"inline":e.wouldExceedInputLimit||e.text.length>=32768||SN.encode(e.text).byteLength>=32768?"attachment":"inline"}function UW(e){let t=new Set(e.map(o=>o.toLowerCase()));if(!t.has("pasted-text.txt"))return"pasted-text.txt";for(let o=2;;o+=1){let n=`pasted-text-${o}.txt`;if(!t.has(n))return n}}function $W(e){let t=Math.max(0,Math.min(e.valueLength,e.selectedLength));return e.valueLength-t+e.textLength>e.maxLength}function LN(e){let t=$W({valueLength:e.valueLength,selectedLength:e.selectedLength,textLength:e.text.length,maxLength:e.maxInputChars});if(HW({text:e.text,bypassAutoAttachment:e.bypassAutoAttachment,wouldExceedInputLimit:t,canAttach:!0})!=="attachment")return{kind:"inline"};let o=SN.encode(e.text).byteLength;return e.maxFileBytes!==null&&o>e.maxFileBytes?t?{kind:"reject",reason:"file-too-large"}:{kind:"inline"}:{kind:"fold",fileName:UW(e.existingNames),sizeBytes:o}}function PN(e,t,o){if(e.blocked)return!1;let{editor:n,registry:r,t:a}=e;r.documentKey!==e.documentKey&&(r.documentKey=e.documentKey,r.names.clear());for(let i of e.existingImageNames)r.names.add(i);let s=LN({text:t,bypassAutoAttachment:o,valueLength:e.promptLength,selectedLength:n?.readSelectedTextLength()??0,maxInputChars:e.maxInputChars,maxFileBytes:e.maxFileBytes,existingNames:[...r.names]});return s.kind==="inline"?!1:s.kind==="reject"?(e.notify.error(a("attachments.pastedTooLargeToAttach"),a("attachments.pastedTooLargeToAttachDetail")),!0):(r.names.add(s.fileName),n?.removeSelectedText(),e.addFoldedFile(new File([t],s.fileName,{type:"text/plain;charset=utf-8"})),e.notify.info(a("attachments.pastedAttached",{name:s.fileName}),a("attachments.pastedAttachedDetail",{size:di(s.sizeBytes),shortcut:cl(navigator.platform)?"\u2318\u21E7V":"Ctrl+Shift+V"})),!0)}$();var RN="application/x-ycodium-composer-mention";function BC(e){return e.includes(RN)}function EN(e){let t=o=>BC(o.dataTransfer.types)?(o.preventDefault(),o.stopPropagation(),o.nativeEvent.stopPropagation(),!0):!1;return{onDragEnter(o){t(o)&&e.setDragActive(!0)},onDragOver(o){t(o)&&(o.dataTransfer.dropEffect="move",e.setDragActive(!0))},onDrop(o){if(!t(o))return;e.setDragActive(!1);let n=o.dataTransfer.getData(RN);n.length!==0&&(e.insertMentionAtEnd(`${n} `)||e.onInsertRejected())}}}function MN({documentKey:e,insertMentionAtEnd:t,onInsertRejected:o}){let[n,r]=q(!1),a=EN({insertMentionAtEnd:t,setDragActive:r,onInsertRejected:o}),s=i=>{if(!BC(i.dataTransfer.types))return;i.stopPropagation();let d=i.relatedTarget;d instanceof Node&&i.currentTarget.contains(d)||r(!1)};return fe(()=>{r(!1)},[e]),H(()=>{if(!n)return;let i=()=>{r(!1)};return window.addEventListener("dragend",i),()=>window.removeEventListener("dragend",i)},[n]),{isDragOverComposer:n,composerMentionDragHandlers:a,onComposerMentionDragLeaveCapture:s}}$();function AN(e){let t=E(0);return H(()=>{let o=()=>{t.current=Date.now()+1e3},n=s=>{s.target instanceof Node&&e.current?.contains(s.target)&&kN(s,cl(navigator.platform))&&o()},r=()=>{t.current=0},a=()=>{let s=document.activeElement;s instanceof Node&&e.current?.contains(s)&&o()};return window.addEventListener(FC,a),window.addEventListener("keydown",n,!0),window.addEventListener("blur",r),()=>{window.removeEventListener(FC,a),window.removeEventListener("keydown",n,!0),window.removeEventListener("blur",r)}},[e]),R(()=>{let o=Date.now()<=t.current;return t.current=0,o},[])}function NN(e){let{api:t,attachments:o,t:n,addComposerImages:r,promptRef:a,promptInputRef:s,composerEditorRef:i,composerFormRef:d,composerThreadKey:c,attachmentDocumentKey:u,attachmentImagesRef:m,limits:p,supportsAttachmentUploads:f,attachmentUploadsCapabilityKnown:g,composerDocumentKey:h,isComposerApprovalState:y,pasteBlocked:x,hasPendingUserInputs:C,projectSelectionRequired:b,environmentId:L}=e,w=AN(d),k=E({documentKey:"",names:new Set}),I=(j,U)=>PN({blocked:x,editor:i.current,documentKey:u,registry:k.current,existingImageNames:m.current.map(D=>D.name),promptLength:a.current.length,maxInputChars:p.maxInputChars,maxFileBytes:!g||f?null:p.inlineAttachmentMaxBytes,t:n,notify:t.notify,addFoldedFile:D=>{r([D],{source:{_tag:"pasted-text"}})}},j,U),T=j=>{let U=Array.from(j.clipboardData.files);if(U.length>0){j.preventDefault(),r(U);return}let D=j.clipboardData.getData("text/plain");I(D,w())&&(j.preventDefault(),j.stopPropagation())},S=(j,U)=>{if(j.length===0||y||C||b)return!1;let D=a.current,J=(U?.ensureLeadingBoundary??!1)&&D.length>0&&!/\s$/.test(D);return s.current?.applyPromptReplacement(D.length,D.length,J?` ${j}`:j)??!1},P=$e(c,null,{namespace:Xu});P.current=j=>{if(y||C||b)return!1;let U=a.current,D=Math.max(0,Math.min(U.length,s.current?.readSnapshot().expandedCursor??U.length)),J=U.slice(0,D),G=U.slice(D),M=`${J.length>0&&!/\s$/.test(J)?" ":""}${j}${/^\s/.test(G)?"":" "}`;return s.current?.applyPromptReplacement(D,D,M)??!1};let{isDragOverComposer:A,composerMentionDragHandlers:N,onComposerMentionDragLeaveCapture:B}=MN({documentKey:h,insertMentionAtEnd:j=>S(j,{ensureLeadingBoundary:!0}),onInsertRejected:()=>{t.notify.error(n("composer.unableToAddToChat"),n("composer.composerBusy"))}});return{onComposerPaste:T,insertComposerTextAtEnd:S,addDroppedFolders:j=>{IN({folders:j,resolve:U=>o.resolveDroppedFolder({environmentId:L,folder:U}),t:n,notifyError:(U,D)=>t.notify.error(U,D),insertText:U=>S(U,{ensureLeadingBoundary:!0})})},isDragOverComposer:A,composerMentionDragHandlers:N,onComposerMentionDragLeaveCapture:B}}$();function DN(e){let{api:t,t:o,limits:n,promptRef:r,promptInputRef:a,composerEditorRef:s,composerImagesRef:i,composerDraftTarget:d,setComposerDraftPrompt:c,addComposerDraftImages:u,clearComposerDraftPromptAndImages:m,setIsStashMenuOpen:p,setStashPulse:f,isComposerCollapsedMobile:g,expandMobileComposer:h,keybindings:y,terminalOpen:x,isComposerModelPickerOpen:C,hasPendingUserInputs:b,isComposerApprovalState:L,projectSelectionRequired:w,answeringQuestion:k}=e,I=E(0),T=E(null),S=E(new Set),P=t.stash.useStore,A=P(F=>F.entries),N=P(F=>F.stashEntry),B=P(F=>F.takeEntry),O=P(F=>F.finalizeEntryImages);H(()=>()=>{T.current!==null&&window.clearTimeout(T.current)},[]);let j=R(()=>{I.current+=1,f({key:I.current,active:!0}),T.current!==null&&window.clearTimeout(T.current),T.current=window.setTimeout(()=>{T.current=null,f(F=>({...F,active:!1}))},1200)},[]),U=R(F=>{let{entry:ee,durable:Y}=B(F.id);if(!ee)return;Y||t.notify.warning(o("composer.stashReappear"),o("composer.storageRejectedKeep")),p(!1);let ae=r.current,te=F.prompt.length===0?ae:ae.trim().length?`${ae.replace(/\s+$/,"")}
3570
3570
 
3571
- ${F.prompt}`:F.prompt,de=te!==ae;if(de&&(r.current=te,c(d,te),a.current?.syncCursor(uo(te,te.length),null)),F.attachments.length>0){let ne=new Set(i.current.map(Ae=>Ae.id)),Z=new Set(i.current.map(Ae=>`${Ae.mimeType}\0${Ae.sizeBytes}\0${Ae.name}`)),ve=F.attachments.filter(Ae=>!ne.has(Ae.id)&&!Z.has(`${Ae.mimeType}\0${Ae.sizeBytes}\0${Ae.name}`)),he=t.draft.hydrateImagesFromPersisted(ve);he.length>0&&u(d,he)}let ge=[];F.droppedImageNames.length>0&&ge.push(o("composer.stashImagesTooLarge",{names:F.droppedImageNames.join(", ")})),F.unreadableImageNames&&F.unreadableImageNames.length>0&&ge.push(o("composer.stashImagesUnreadable",{names:F.unreadableImageNames.join(", ")})),ge.length>0&&t.notify.warning(o("composer.someImagesNotRestored"),ge.join(" ")),de&&window.requestAnimationFrame(()=>{s.current?.focusAtEnd()})},[u,d,i,r,c,o,B]),D=R(F=>{let{durable:ee}=B(F.id);ee||t.notify.warning(o("composer.stashEntryMayReturn"),o("composer.storageRejectedDelete"))},[o,B]),J=R(async()=>{let F=r.current.split(mr).join("").trim(),ee=[...i.current];if(F.length===0&&ee.length===0){p(de=>!de);return}let Y=`${OC(d)}\0${F}\0${ee.map(de=>de.id).join(",")}`;if(S.current.has(Y))return;S.current.add(Y);let ae=d,te=Es();try{let{evicted:de,written:ge,durable:ne}=N({id:te,createdAt:new Date().toISOString(),prompt:F,attachments:[],droppedImageNames:[],unreadableImageNames:[],pendingImageCount:ee.length});if(!ge){t.notify.error(o("composer.couldNotStash"),o("composer.storageRejectedWrite"));return}ne||t.notify.warning(o("composer.stashNotSurvive"),o("composer.storageUnavailableMemory")),r.current="",m(ae);for(let me of ee)t.uploads.release(me.id);a.current?.syncCursor(0,null),j(),de&&t.notify.warning(o("composer.oldestStashDiscarded"),o("composer.oldestStashDiscardedDetail",{count:t.stash.maxEntries}));let Z=[],ve=[],he=[];for(let me of ee){let Me=await t.imageCompression.compressForStash(me.file);if(!Me.ok){(Me.reason==="too-large"?ve:he).push(me.name);continue}Z.push({id:me.id,name:me.name,mimeType:Me.image.mimeType,sizeBytes:Me.image.sizeBytes,dataUrl:Me.image.dataUrl})}let{kept:Ae,droppedNames:De}=t.stash.partitionAttachments(Z),{attached:je,durable:ot}=O(te,{attachments:Ae,droppedImageNames:[...ve,...De],unreadableImageNames:he});je?!ot&&ne&&ee.length>0&&t.notify.warning(o("composer.stashImagesNotSaved"),o("composer.stashImagesMissingOnReload")):Ae.length>0&&t.notify.warning(o("composer.stashImagesDidNotAttach"),o("composer.stashImagesDidNotAttachDetail",{count:Ae.length}))}finally{S.current.delete(Y)}},[m,d,i,O,r,j,N,o]),G=R(()=>{p(F=>!F)},[]),M=R(()=>{if(g){h(),p(!0);return}G()},[h,g,G]),X=R(()=>{p(!1)},[]);return t.pane.useKeydown(F=>{if(t.keybindings.resolveShortcutCommand(F,y,{context:{terminalFocus:t.terminalFocus.getOwner()!==null,terminalOpen:x,modelPickerOpen:C}})==="composer.stash"&&(F.preventDefault(),F.stopPropagation(),!t.commandPalette.isOpen())){if(b&&!L){p(Y=>!Y);return}L||w||k||J()}},{capture:!0}),{stashQueue:A,restoreStashEntry:U,deleteStashEntry:D,toggleStashMenu:G,toggleInlineStashMenu:M,closeStashMenu:X}}$();function HW(e,t,o){return{...Kg({id:Es(),name:t.name||e.t("attachments.defaultFileName"),mimeType:t.type||"application/octet-stream",sizeBytes:t.size,...o?{source:o}:{}}),previewUrl:URL.createObjectURL(t),file:t}}async function NN(e,t,o){let{t:n,supportsAttachmentUploads:r,inlineAttachmentMaxBytes:a}=e;if(!e.activeThreadId||t.length===0)return;if(e.answerQuestionsFirst){e.notifyError(n("attachments.answerQuestionsFirst"));return}let s=e.activeThreadId,i=e.attachmentDocumentKey,d=e.pendingCompressions,c=d.get(i)??0,u=[],m=null;for(let p of t){if(p.size<=0){m=n("attachments.empty",{name:p.name});continue}u.push(p)}if(e.setThreadError(s,m),u.length!==0){d.set(i,c+u.length);try{let p=[],f=null;for(let g of u){let h=await e.imageCompression.prepareFileForAttachment(g,e.attachmentUploadsCapabilityKnown&&!r?a:Number.POSITIVE_INFINITY);if(!h.ok){let x=e.imageCompression.attachmentPreparationError(h,g.name);f=n(x.key,x.values);continue}if(h.kind!=="image"){p.push(HW(e,h.file,h.kind==="file"?o?.source:void 0));continue}let y=h.file;p.push({...Kg({id:Es(),name:y.name||n("attachments.defaultImageName"),mimeType:y.type,sizeBytes:y.size}),previewUrl:URL.createObjectURL(y),file:y})}p.length===1&&p[0]?e.addImage(p[0]):p.length>1&&e.addImages(p),f!==null&&e.setThreadError(s,f)}finally{let p=(d.get(i)??0)-u.length;p>0?d.set(i,p):d.delete(i)}}}function DN(e){let{api:t,t:o,limits:n,setThreadError:r,activeThreadId:a,answerQuestionsFirst:s,attachmentTarget:i,attachmentDocumentKey:d,supportsAttachmentUploads:c,attachmentUploadsCapabilityKnown:u,pendingImageCompressionsRef:m,addComposerDraftImage:p,addComposerDraftImages:f,removeComposerDraftImage:g}=e,h=R(w=>{p(i,w)},[i,p]),y=R(w=>{f(i,w)},[i,f]),x=R(w=>{t.uploads.release(w),g(i,w)},[t.uploads,i,g]),C=(w,k)=>NN({activeThreadId:a,answerQuestionsFirst:s,notifyError:I=>t.notify.error(I),t:o,setThreadError:r,attachmentDocumentKey:d,pendingCompressions:m.current,supportsAttachmentUploads:c,attachmentUploadsCapabilityKnown:u,inlineAttachmentMaxBytes:n.inlineAttachmentMaxBytes,imageCompression:t.imageCompression,addImage:h,addImages:y},w,k);return{addComposerImages:C,removeComposerImage:w=>{x(w)},onComposerAttachmentInputChange:w=>{let k=Array.from(w.target.files??[]);w.target.value="",k.length!==0&&C(k)}}}$();var _N=e=>({images:e.images,nonPersistedImageIds:e.nonPersistedImageIds});function UW(e){let{supported:t,attachments:o,environmentId:n,threadId:r,requestId:a,question:s,responding:i}=e,d=s?.id,c=s?.allowFreeform;return W(()=>t&&a!==null&&d!==void 0&&c!==!1&&!i&&r?o.questionDraftTarget({environmentId:n,threadId:r,requestId:a,questionId:d}):null,[c,o,n,d,a,i,t,r])}function ON(e){let t=UW(e),o=t??e.composerDraftTarget,n=t?[e.environmentId,e.composerDraftTarget,"question",t].join("\0"):[e.environmentId,e.composerDraftTarget].join("\0");return{questionAttachmentTarget:t,attachmentTarget:o,attachmentDocumentKey:n}}$();function FN(e,t){let o=On.indexOf(e);if(o===-1)return On[0];let n=(o+t+On.length)%On.length;return On[n]??On[0]}function BN(e){let{composerRef:t,sendContextRef:o,api:n,t:r,limits:a,composerData:s,refs:i,composerDraftTarget:d,activeThread:c,addComposerImages:u,addDroppedFolders:m,focusComposer:p,insertComposerTextAtEnd:f,insertComposerDraftTerminalContext:g,composerBrowserAnnotations:h,composerReviewComments:y,isComposerApprovalState:x,pendingUserInputCount:C,projectSelectionRequired:b,noProviderAvailable:L,modelState:w,handleRuntimeModeChange:k,runtimeMode:I,setIsComposerModelPickerOpen:T,setProviderInputSubmissionError:S}=e,{composerEditorRef:P,promptInputRef:A,promptRef:N,composerImagesRef:B,composerTerminalContextsRef:O,composerElementContextsRef:j}=i,{selectedModel:U,selectedModelOptionsForDispatch:D,selectedModelSelection:J,selectedModelStatus:G,selectedNativeModeId:M,selectedProvider:X,selectedProviderEntry:F,selectedProviderModels:ee,composerNativeMode:Y,canSwitchNativeMode:ae,handleComposerNativeModeChange:te}=w,de=R(()=>A.current?.readSnapshot()??{value:N.current,cursor:uo(N.current,N.current.length),expandedCursor:N.current.length,terminalContextIds:O.current.map(ne=>ne.id)},[O,N]),ge=()=>({prompt:N.current,slashSources:{builtIns:["model",...w.planModeUiEnabled?["plan","default"]:[]],skills:w.selectedProviderStatus?.skills??[],commands:w.selectedProviderStatus?.slashCommands??[]},images:B.current,terminalContexts:O.current,elementContexts:j.current,browserAnnotations:h,reviewComments:y,selectedModelOptionsForDispatch:D,selectedModelSelection:J,...M?{selectedNativeModeId:M}:{},providerAvailable:F!==void 0,selectedProvider:X,selectedModel:U,selectedModelStatus:G,selectedProviderModels:ee});o.current=ge,pr(t,()=>({focusAtEnd:()=>{P.current?.focusAtEnd()},focusAt:Z=>{P.current?.focusAt(Z)},addDroppedFiles:Z=>{u(Z),p()},addDroppedFolders:Z=>{m(Z),p()},insertTextAtEnd:f,toggleModelPicker:()=>{T(Z=>!Z)},cyclePermissionMode:Z=>{if(Y===null){k(FN(I,Z));return}let{modes:ve,current:he}=Y;if(!ae||ve.length<2)return;let Ae=ve.findIndex(je=>je.id===he.id),De=ve[(Ae+Z+ve.length)%ve.length];De!==void 0&&te(De.id)},readSnapshot:de,resetCursorState:Z=>{A.current?.resetCursorState(Z)},addTerminalContext:Z=>{if(!c)return;let ve=de(),he=n.terminalContext.insertInlinePlaceholder(ve.value,ve.expandedCursor),Ae=uo(he.prompt,he.cursor);g(d,he.prompt,{id:Es(),threadId:c.id,createdAt:new Date().toISOString(),...Z},he.contextIndex)&&(N.current=he.prompt,A.current?.syncCursor(Ae,Po(he.prompt,he.cursor)),window.requestAnimationFrame(()=>{P.current?.focusAt(Ae)}))},readSendIdentity:()=>({prompt:N.current}),getSendContext:ge,validateProviderInput:Z=>{let ve=RC({prompt:N.current,providerInput:s.assistantQuotes.expandForProvider(Z),submissionTarget:"provider-turn",maxInputChars:a.maxInputChars,t:r});return S(ve),ve===null}}),[c,u,d,g,N,B,O,j,h,y,p,x,C,b,de,U,D,J,M,L,X,ee,s,ge,o,a.maxInputChars,Y,ae,te,k,I,r])}$();function HN(e){let{composerImages:t,composerImagesRef:o,composerTerminalContexts:n,composerTerminalContextsRef:r,composerElementContexts:a,composerElementContextsRef:s}=e;fe(()=>{o.current=t},[t,o]),fe(()=>{r.current=n},[n,r]),fe(()=>{s.current=a},[a,s])}$();var $W=['[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 zW(e){return e.closest($W)!==null}function UN(e){let{isMobileViewport:t,forceExpandedOnMobile:o,composerEditorRef:n,composerSurfaceRef:r,composerFormRef:a}=e,[s,i]=q(!1),d=t&&!o&&!s,c=E(null),u=E(null),m=E(null),p=E(!1),f=R(()=>{if(!t)return;c.current!==null&&(window.cancelAnimationFrame(c.current),c.current=null);let x=document.activeElement;x instanceof HTMLElement&&x.blur(),i(!1)},[t]),g=R(()=>{c.current!==null&&(window.cancelAnimationFrame(c.current),c.current=null),u.current!==null&&window.cancelAnimationFrame(u.current),m.current!==null&&window.cancelAnimationFrame(m.current),p.current=!0,i(!0),u.current=window.requestAnimationFrame(()=>{u.current=null,n.current?.focusAtEnd(),m.current=window.requestAnimationFrame(()=>{m.current=null,p.current=!1})})},[]),h=R(()=>{t&&(p.current||(c.current!==null&&window.cancelAnimationFrame(c.current),c.current=window.requestAnimationFrame(()=>{if(c.current=null,p.current)return;let x=r.current,C=a.current,b=document.activeElement;b instanceof Element&&zW(b)||b instanceof Node&&(x&&x.contains(b)||C&&C.contains(b))||i(!1)})))},[t]);return H(()=>()=>{c.current!==null&&window.cancelAnimationFrame(c.current),u.current!==null&&window.cancelAnimationFrame(u.current),m.current!==null&&window.cancelAnimationFrame(m.current)},[]),{isComposerCollapsedMobile:d,blurMobileComposerAfterSend:f,expandMobileComposer:g,scheduleComposerCollapseCheck:h,handleFormFocusCapture:x=>{let C=x.target;d&&C instanceof HTMLElement&&C.closest('[data-chat-composer-collapsed-controls="true"]')||(c.current!==null&&(window.cancelAnimationFrame(c.current),c.current=null),i(!0))}}}$();function $N(e){let{t,threadId:o,setThreadError:n,promptRef:r,promptInputRef:a,respondToApproval:s,respondToDecision:i,selectUserInputOption:d,activePendingProgress:c,activePendingIsResponding:u,activePendingResolvedAnswers:m}=e,p=W(()=>c?{questionIndex:c.questionIndex,isLastQuestion:c.isLastQuestion,canAdvance:c.canAdvance,isResponding:u,isComplete:!!m}:null,[u,c,m]),f=R((y,x)=>{d(y,x),r.current="",a.current?.resetCursorState({cursor:0})},[r,d]),g=R(async(y,x,C)=>{try{await s(y,x,C)}catch(b){n(o,b instanceof Error?b.message:t("approval.respondFailed"))}},[o,s,n,t]),h=R((y,x)=>i(y,x).then(C=>{C!==null&&n(o,C)}),[o,i,n]);return{pendingPrimaryAction:p,onSelectActivePendingUserInputOption:f,onRespondToApproval:g,onRespondToComposerDecision:h}}$();function zN(e){return e.startsWith("!")}function KN(e){return e.slice(1).trim()}function qN(e){return e.length===0?"empty":/[\r\n]/.test(e)?"multiline":null}function KW(){return null}function WN(){let{data:e,target:t,threadKey:o}=Ho();return(e.useShellCommand??KW)({target:t,threadKey:o})}$();function jf(e){return e.activeThreadId!==null&&!e.isLocalDraftThread&&!e.isComposerApprovalState&&!e.hasPendingProgress&&!e.hasPendingAction&&!e.shellCommandMode}function Vf(e,t,o){return e&&t!==void 0?t:o}function Qf(e){let t=e.environmentUnavailable?e.labels.environmentDisconnected:e.projectSelectionRequired?e.labels.chooseProjectToStart:e.pluginAction?null:e.noProviderAvailable&&!e.groupSend?e.labels.enableProviderToSend:Vf(e.groupSend,e.groupSendDisabledReason,e.sendDisabledReason);return{disabled:t!==null,reason:t}}function GN({promptRef:e,maxInputChars:t,noProviderAvailable:o,sendDisabledReason:n,groupSendDisabledReason:r,isGroupSend:a,isModelSendBlocked:s,onModelSendBlocked:i,onDispatched:d,activeThreadId:c,activePendingProgress:u,composerDocumentKey:m,pendingImageCompressionsRef:p,onSend:f,onStillCompressing:g,shouldBlurMobileComposerOnSubmit:h,blurMobileComposerAfterSend:y}){let{t:x}=z(),[C,b]=q(null),[L,w]=q(!1),k=E(0);H(()=>{k.current+=1,b(null),w(!1)},[m]),H(()=>{n===null&&w(!1)},[n]);let I=R(S=>{b(P=>P===null?P:jc(S,t,x))},[t,x]),T=R((S,P="foreground")=>{let A=a();if(o&&!A){S?.preventDefault();return}if(Vf(A,r,n)!==null){S?.preventDefault(),w(!0);return}if(s&&!A){S?.preventDefault(),i();return}if(c&&(p.current.get(m)??0)>0){S?.preventDefault(),g();return}let B=k.current,O=BA({prompt:e.current,submissionTarget:u?"pending-user-input":"provider-turn",maxInputChars:t,t:x,event:S,onSend:U=>f(U,P)}),j=U=>{B===k.current&&(b(U.validationMessage),U.didDispatch&&(d(),h()&&y()))};if(FA(O))return O.then(j);j(O)},[u,c,y,m,s,a,r,t,o,i,d,f,g,p,e,n,h,x]);return{composerSubmissionError:C??(L?Vf(a(),r,n):null),setComposerSubmissionError:b,revalidatePromptLength:I,submitComposer:T}}function jN(e){let{api:t,t:o,limits:n,composerDraftTarget:r,composerDraft:a,composerDocumentKey:s,promptRef:i,promptInputRef:d,pendingImageCompressionsRef:c,setComposerDraftPrompt:u,setModelSendBlockShown:m,onSend:p,onCompactContext:f,blurMobileComposerAfterSend:g,isMobileViewport:h,isComposerApprovalState:y,activePendingApproval:x,activePendingProgress:C,activePendingResolvedAnswers:b,pendingUserInputCount:L,activeThreadId:w,phase:k,isSendBusy:I,environmentUnavailable:T,compactDisabled:S,noProviderAvailable:P,isSendDisabled:A,sendDisabledReason:N,groupSendDisabledReason:B,isGroupSend:O,isModelSendBlocked:j,showPlanFollowUpPrompt:U}=e,D=!e.pluginAction&&P,J=!e.pluginAction&&A,G=e.pluginAction?null:N,M=!e.pluginAction&&j,X=WN(),F=t.draft.useThreadDraftSelector(r,De=>zN(De.prompt)),ee=X!==null&&F&&!y&&C===null,Y=R(()=>!h||I||J||D||T!==null||k==="running"?!1:C?C.isLastQuestion&&!!b:U||a.hasSendableContent,[C,b,a.hasSendableContent,T,h,I,J,D,k,U]),{composerSubmissionError:ae,setComposerSubmissionError:te,revalidatePromptLength:de,submitComposer:ge}=GN({promptRef:i,maxInputChars:n.maxInputChars,noProviderAvailable:D,sendDisabledReason:G,groupSendDisabledReason:B,isGroupSend:O,isModelSendBlocked:M,onModelSendBlocked:()=>{m(!0)},onDispatched:()=>{m(!1)},activeThreadId:w,activePendingProgress:C,composerDocumentKey:s,pendingImageCompressionsRef:c,onSend:p,onStillCompressing:()=>{t.notify.info(o("composer.stillCompressing"),o("composer.sendAgainThumbnail"))},shouldBlurMobileComposerOnSubmit:Y,blurMobileComposerAfterSend:g}),ne=E(!1),Z=R(De=>{if(De?.preventDefault(),X===null||ne.current)return;if(X.unavailableReason!==null){te(X.unavailableReason);return}let je=i.current,ot=KN(je),me=qN(ot);if(me==="empty")return;if(me==="multiline"){te(o("composer.shellCommand.singleLine"));return}te(null),ne.current=!0;let Me=r;X.run(ot).then(ue=>{!ue||i.current!==je||(i.current="",u(Me,""),d.current?.syncCursor(0,null))}).finally(()=>{ne.current=!1})},[r,X,i,u,te,o]),ve=R((De,je)=>{if(ee){Z(De);return}ge(De,je)},[Z,ee,ge]),he=R(()=>{if(!ee)return!1;let De=i.current.slice(1);return i.current=De,u(r,De),d.current?.resetCursorState({prompt:De,cursor:De.length}),!0},[r,i,u,ee]),Ae=R(()=>{S||D||x!==null||L>0||k==="running"||I||!w||f()},[x,w,S,I,D,f,L,k]);return{composerSubmissionError:ae,revalidatePromptLength:de,submitComposerOrShellCommand:ve,exitShellCommandMode:he,compactThreadContext:Ae,hostShellCommand:X,shellCommandMode:ee}}$();function HC(){let e=it(),{data:t,target:o}=Ho(),n=e.draft.useThreadDraftSelector(o,a=>a.prompt),r=t.memberMentions?.useMatches({target:o,text:n.trim()});return r===void 0||r.status==="ready"&&r.matches.length===0?"unsupported":r.status}function qW(){return HC()==="ready"}function Xf(e){let t=qW();return e&&t}function VN(e){return R(()=>jf({activeThreadId:e.activeThreadId,isLocalDraftThread:e.isLocalDraftThread,isComposerApprovalState:e.isComposerApprovalState,hasPendingProgress:e.hasPendingProgress,hasPendingAction:e.hasPendingAction,shellCommandMode:!1})&&(e.memberMentions?.collect(e.target,e.promptRef.current.trim()).length??0)>0,[e.activeThreadId,e.isLocalDraftThread,e.isComposerApprovalState,e.hasPendingProgress,e.hasPendingAction,e.memberMentions,e.target,e.promptRef])}$();$();var Yf=pe(function(t){let{t:o}=z();if(t.count===0)return null;let n=t.placement==="inline",r=l("span",{className:V("text-ui-2xs font-medium 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 n?v(K,{size:"micro",variant:"ghost-muted","data-prompt-stash-badge":"true","aria-label":o("stash.ariaLabel",{count:t.count}),"aria-expanded":t.menuOpen,className:V("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:[l($s,{className:"size-3 shrink-0","aria-hidden":"true"}),r]}):v("button",{type:"button","data-prompt-stash-badge":"true","aria-label":o("stash.ariaLabel",{count:t.count}),"aria-expanded":t.menuOpen,className:V("chat-composer-shoulder-tab chat-composer-stash-tab absolute -top-7 right-4 z-0 inline-flex h-8 cursor-[var(--control-cursor)] 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:[l($s,{className:"size-3 shrink-0","aria-hidden":"true"}),o("stash.label"),r]})});$();function XN(e){let t=new Map;return e.map(o=>{let n=t.get(o.step)??0;return t.set(o.step,n+1),{key:`${o.step}:${n}`,step:o}})}function QN({className:e,steps:t}){return t.length<=1?null:l("span",{"aria-hidden":!0,className:V("flex w-10 shrink-0 items-center gap-0.5",e),children:XN(t).map(({key:o,step:n})=>l("span",{className:V("h-[3px] min-w-0 flex-1 rounded-full",n.status==="completed"?"bg-success":n.status==="inProgress"?"bg-primary":"bg-muted-foreground/25")},o))})}var Jf=pe(function({expanded:t,hasTrailingShoulder:o=!1,onDismiss:n,onToggle:r,placement:a="tab",progress:s,steps:i}){let{t:d}=z();if(s.totalSteps<=0)return null;let c=s.completedSteps>=s.totalSteps,u=d("tasksBadge.ariaLabel",{completed:s.completedSteps,total:s.totalSteps,step:s.step});return a==="inline"?v("span",{className:"inline-flex shrink-0 items-center gap-0.5","data-composer-tasks-badge":"true",children:[v(K,{size:"micro",variant:"ghost-muted","aria-expanded":t,"aria-label":u,className:"shrink-0 gap-1 px-1.5",onClick:r,onPointerDown:m=>m.preventDefault(),children:[l(Ua,{"aria-hidden":!0,className:"size-3 shrink-0"}),l("span",{children:d("tasksBadge.label")}),l(QN,{steps:i}),v("span",{className:V("font-medium tabular-nums",c?"text-success":"text-muted-foreground"),children:[s.completedSteps,"/",s.totalSteps]})]}),l(K,{size:"icon-micro",variant:"ghost-muted","aria-label":d("tasksBadge.dismissLabel"),className:"shrink-0",onClick:n,onPointerDown:m=>m.preventDefault(),children:l(dt,{"aria-hidden":!0,className:"size-2.5"})})]}):v("div",{className:V("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",o?"right-28":"right-4",c&&"text-foreground"),"data-composer-tasks-badge":"true",children:[v("button",{type:"button","aria-expanded":t,"aria-label":u,className:"flex min-w-0 flex-1 cursor-[var(--control-cursor)] items-center gap-2 self-stretch text-muted-foreground hover:text-foreground",onClick:r,onPointerDown:m=>m.preventDefault(),children:[l(Ua,{"aria-hidden":!0,className:"size-icon-1 shrink-0"}),l("span",{className:"shrink-0",children:d("tasksBadge.label")}),l("span",{className:"min-w-0 flex-1 truncate text-left font-medium text-foreground/80","data-composer-task-current":"true",children:s.step}),v("span",{className:V("shrink-0 font-medium tabular-nums",c?"text-success":"text-muted-foreground"),children:[s.completedSteps,"/",s.totalSteps]}),l(QN,{className:"w-20",steps:i})]}),l(K,{size:"icon-micro",variant:"ghost-muted","aria-label":d("tasksBadge.dismissLabel"),className:"shrink-0",onClick:n,onPointerDown:m=>m.preventDefault(),children:l(dt,{"aria-hidden":!0,className:"size-3"})})]})}),YN=pe(function({onDismiss:t,onCollapse:o,progress:n,steps:r}){let{t:a}=z(),{formatDuration:s}=_o();return v("div",{className:"chat-composer-top-drawer","data-chat-composer-tasks-drawer":"true",children:[v("div",{className:"flex items-center gap-1 px-3 py-1.5 sm:px-4",children:[v("button",{type:"button","aria-expanded":"true",className:"flex min-w-0 flex-1 cursor-[var(--control-cursor)] items-center gap-2 self-stretch text-left text-xs text-muted-foreground hover:text-foreground",onClick:o,onPointerDown:i=>i.preventDefault(),children:[l(Ua,{"aria-hidden":!0,className:"size-icon-1 shrink-0"}),l("span",{className:"font-medium text-foreground",children:a("tasksBadge.label")}),v("span",{className:"tabular-nums",children:[n.completedSteps,"/",n.totalSteps]})]}),l(K,{size:"icon-micro",variant:"ghost-muted","aria-label":a("tasksBadge.dismissLabel"),className:"shrink-0",onClick:t,onPointerDown:i=>i.preventDefault(),children:l(dt,{"aria-hidden":!0,className:"size-3"})})]}),l("div",{className:"space-y-px px-3 pb-4 sm:px-4",role:"list",children:XN(r).map(({key:i,step:d})=>v("div",{className:"flex items-baseline gap-2 text-xs leading-5",role:"listitem",children:[l("span",{"aria-hidden":!0,className:V("w-3 shrink-0 text-center font-mono text-ui-2xs",d.status==="completed"?"text-success":d.status==="inProgress"?"text-primary":"text-muted-foreground/40"),children:d.status==="completed"?"\u2713":d.status==="inProgress"?"\u25CF":"\u25CB"}),l("span",{className:V("min-w-0 flex-1",d.status==="completed"?"text-muted-foreground/55":d.status==="inProgress"?"text-foreground/90":"text-muted-foreground/70"),children:d.step}),l("span",{className:"ml-auto w-10 shrink-0 text-right text-ui-2xs text-muted-foreground/45 tabular-nums","data-composer-task-duration":"true",children:d.durationMs!==void 0?s(d.durationMs):d.status==="inProgress"?a("tasksBadge.now"):null})]},i))})]})});function JN(e){let{activeThreadId:t,activeThread:o,activeTasksProgress:n,activeTaskSteps:r,isTasksDrawerOpen:a,setIsTasksDrawerOpen:s,dismissedTasksTurnId:i,setDismissedTasksTurnId:d,stashQueue:c,isStashMenuOpen:u,stashPulse:m,toggleInlineStashMenu:p,isComposerApprovalState:f,externalDrawerAttached:g,showComposerTopDrawer:h,isComposerCollapsedMobile:y,hasBlockingComposerTopDrawer:x}=e,C=R(()=>{s(O=>!O)},[]),b=o?.latestTurn?.turnId??null,L=b!==null&&i===b,w=L?null:n,k=L?null:r,I=R(()=>{b!==null&&d(b),s(!1)},[b]),S=c.length>0&&!f&&(g||h||a||y)?l(Yf,{count:c.length,menuOpen:u,placement:"inline",pulseKey:m.key,pulsing:m.active,onToggleMenu:p}):null,A=w!==null&&k!==null&&!a&&!x&&(g||h||y)?l(Jf,{expanded:!1,onDismiss:I,onToggle:C,placement:"inline",progress:w,steps:k}):null,N=!g&&!h&&!a&&!y,B=N&&(c.length>0||w!==null&&k!==null&&w.totalSteps>0);return H(()=>{(w===null||k===null)&&s(!1)},[k,w]),H(()=>{x&&s(!1)},[x]),H(()=>{s(!1)},[t]),{toggleTasksDrawer:C,dismissTasks:I,visibleTasksProgress:w,visibleTaskSteps:k,inlineStashBadge:S,inlineTasksBadge:A,showShoulderTabs:N,hasShoulderTab:B}}$();function ZN(e,t){if(!e)return null;let o=t.get(e.instanceId)?.find(n=>n.slug===e.model);return o?ET(o):e.model}function eD(e,t,o){return typeof o=="number"&&o>0?e("contextWindow.compactsAtThreshold",{threshold:o.toLocaleString()}):t?e("contextWindow.compactsForModel",{model:t}):e("contextWindow.compactsWhenNeeded")}$();function UC(e,t){if(!e)return t("composer.agentPickerLabel");let o=e.agentName?.trim(),n=e.displayName.trim();return o?!n||n===o?o:`${o} (${n})`:n}function $C(e,t){return e.filter(o=>_d(o)&&yp(o,t))}var zC=pe(function(t){let{t:o}=z(),n=t.instanceEntries.filter(_d),r=t.unavailableInstanceId??null,a=r===null?null:t.instanceEntries.find(h=>h.instanceId===r)??null,s=t.notChosen===!0&&r===null,i=r!==null||s?null:n.find(h=>h.instanceId===t.activeInstanceId)??null,d=t.lockedProvider!=null&&t.lockedProvider.length>0,c=$C(t.instanceEntries,t),u=c.some(h=>h.instanceId!==t.activeInstanceId),m=t.disabled||!d?null:r!==null?c.length===0?o("composer.agentUnavailableNoChoice"):null:u?null:o("composer.agentSwitchUnavailable"),p=ho(),f=V("min-w-0 justify-between whitespace-nowrap",t.compact?"max-w-36 shrink-0":"max-w-44 shrink"),g=v(oe,{children:[r!==null?l(eo,{"aria-hidden":"true",className:"size-4 shrink-0 text-warning"}):s?null:i?l(js,{driver:i.driverKind,displayName:i.displayName,accentColor:i.accentColor,className:"size-4",iconClassName:"size-4",indicatorBackground:"var(--contrast-input)"}):null,r!==null?v("span",{className:"min-w-0 truncate text-warning","data-composer-agent-unavailable":"true",children:[a===null?o("composer.agentUnknown"):UC(a,o)," ",o("composer.agentUnavailableBadge")]}):s?l("span",{className:"min-w-0 truncate","data-composer-agent-not-chosen":"true",children:o("composer.agentChoosePlaceholder")}):l("span",{className:"min-w-0 truncate",children:UC(i,o)})]});return m!==null?v(Pe,{children:[v(Ee,{render:l(Vn,{"aria-label":o("composer.agentPickerLabel"),"aria-describedby":p,"data-composer-agent-picker":"true",softDisabled:!0,className:f}),children:[g,l("span",{id:p,className:"sr-only",children:m})]}),l(Re,{side:"top",align:"start",className:"max-w-80 leading-snug",children:m})]}):v(Ao,{children:[v(Do,{render:l(Vn,{"aria-label":o("composer.agentPickerLabel"),"data-composer-agent-picker":"true",disabled:t.disabled||c.length===0,className:f}),children:[g,l(Mu,{})]}),l(No,{align:"start",children:l(Yr,{value:r!==null||s?"":t.activeInstanceId,onValueChange:h=>{!h||r===null&&!s&&h===t.activeInstanceId||t.onInstanceChange(h)},children:c.map(h=>l(Yn,{value:h.instanceId,children:v("span",{className:"flex min-w-0 items-center gap-2",children:[l(js,{driver:h.driverKind,displayName:h.displayName,accentColor:h.accentColor,className:"size-4",iconClassName:"size-4"}),l("span",{className:"min-w-0 truncate",children:UC(h,o)})]})},h.instanceId))})})]})});function tD(e){return l(zC,{...e})}function oD(e){return e.submissionTarget==="provider-turn"&&e.status!=="known"}function nD(e){if(!e.blockedOnSend||e.submissionTarget!=="provider-turn")return null;switch(e.status){case"probing":return{blockKey:"composer.modelFetching",canChooseModel:!1};case"missing":return{blockKey:"composer.modelMissing",canChooseModel:!0};case"unavailable":return{blockKey:"composer.modelUnavailable",canChooseModel:!0};default:return{blockKey:"composer.modelReady",canChooseModel:!1}}}function rD(e){return(e?.hints??[]).filter(t=>t.kind==="model-replaced"||t.kind==="option-unsupported"||t.kind==="effort-moved")}function KC(e,t){if(typeof t=="boolean")return e(t?"traits.on":"traits.off");if(t===void 0)return"";let o=_T(t);return o===void 0?t:e(`traits.optionValue.${o}`)}function aD(e,t){switch(t.kind){case"model-replaced":return t.to===null?e("modelNote.replacedNoDefault",{from:t.from}):e("modelNote.replaced",{from:t.from,to:t.to});case"option-unsupported":return e("modelNote.optionUnsupported",{option:BT(e,t.optionId),value:KC(e,t.stored)});case"effort-moved":return e("modelNote.effortMoved",{from:KC(e,t.from),to:KC(e,t.to)})}}function sD(e){if(e===null||"blocked"in e.dispatch)return;let t=e.dispatch.options;return t.length>0?t:void 0}$();function iD(e){let{threadId:t,isLocalDraftThread:o,selection:n,selectionsEqual:r,onChosen:a}=e,s=E(null);H(()=>{let i=s.current,d=n.model.trim()===""?null:n;if(i===null||i.threadId!==t){s.current={threadId:t,selection:d};return}d!==null&&(s.current={threadId:t,selection:d},!(o||i.selection===null)&&(r(i.selection,d)||a?.(d)))},[t,o,n,r,a])}$();function lD(e){let{api:t,providerStatus:o,instanceId:n,environmentId:r,cwd:a,threadId:s}=e,i=t.providerInventory.useWorkspaceInventory({environmentId:r,instanceId:n,cwd:a,threadId:s});return W(()=>o===null||i===null?o:{...o,slashCommands:i.slashCommands,skills:i.skills},[o,i])}function dD(e){let{api:t,t:o,settings:n,composerDraft:r,composerDraftTarget:a,environmentId:s,gitCwd:i,routeKind:d,threadId:c,activeThread:u,isLocalDraftThread:m,unavailableAgentInstanceId:p,agentNotChosen:f,runtimeMode:g,lockedProvider:h,providerStatuses:y,projectId:x,activeProjectDefaultModelSelection:C,activeThreadModelSelection:b,actualModel:L,compactDisabledReason:w,externalSendDisabledReason:k,attachmentBlockReason:I,answeringQuestion:T,setComposerDraftNativeMode:S,handleNativeModeChange:P,onProviderInstanceSelect:A,onModelSelectionChosen:N}=e,B=W(()=>FT(t.model.applyInstanceSettings(t.model.deriveInstanceEntries(y),n)),[t.model,y,n]),O=r.activeProvider??null,j=u?.session?.providerInstanceId??b?.instanceId??C?.instanceId??null,D=OT(B,O??j)??t.model.makeDriverKind("unconfigured"),J=h??D,G=W(()=>{if(!h||!u)return null;let tt=u.session?.providerInstanceId??b?.instanceId;return tt?B.find(It=>It.instanceId===tt)?.continuationGroupKey??null:null},[u,b?.instanceId,h,B]),M=W(()=>{if(p!==null)return p;let tt=[r.activeProvider,u?.session?.providerInstanceId,b?.instanceId,C?.instanceId];for(let It of tt){if(!It)continue;let po=B.find(Ko=>Ko.instanceId===It&&_d(Ko));if(po&&yp(po,{lockedProvider:h,lockedContinuationGroupKey:G}))return po.instanceId}return t.model.noProviderSelection.instanceId},[C?.instanceId,u?.session?.providerInstanceId,b?.instanceId,r.activeProvider,G,h,B,p]),X=p!==null,F=W(()=>X||f?void 0:B.find(tt=>tt.instanceId===M),[f,X,B,M]),ee=F===void 0&&!X&&!f,Y=X&&$C(B,{lockedProvider:h,lockedContinuationGroupKey:G}).length===0,ae=w??(ee?o("composer.compactingUnavailable"):null),te=F?.driverKind??J,{modelOptions:de,selectedModel:ge,selectedModelStatus:ne,choice:Z}=t.draft.useEffectiveModelState({threadRef:a,providers:y,selectedProvider:te,selectedInstanceId:M,threadModelSelection:b,projectModelSelection:C,settings:n,purpose:m?"create":"display",actualModel:L}),ve=W(()=>F?.snapshot??null,[F]),he=lD({api:t,providerStatus:ve,instanceId:F?.instanceId??null,environmentId:s,cwd:i,threadId:d==="server"?c:null}),Ae=W(()=>F?.models??[],[F]),De=W(()=>sD(Z),[Z]),je=W(()=>rD(Z),[Z]),ot=Z?.selected.kind==="model"&&Z.selected.unconfirmed,me=n.planModeEnabled,Me=W(()=>({showInteractionModeToggle:me&&t.model.getInteractionModeToggle(y,te),runtimeModeSwitch:he?.runtimeModeSwitch??"next-turn"}),[me,y,te,he]),ue=he?.supportsNativeModeSwitch===!0,ce=m&&ue?r.nativeModeByProvider?.[M]??null:null,Ze=W(()=>t.model.resolveNativeMode(he,{runtimeMode:g,nativeModeId:m?ce:u?.nativeModeId??null}),[t.model,u?.nativeModeId,he,g,m,ce]),pt=ce&&Ze?.current.id===ce?ce:void 0,ze=R(tt=>{m&&S(a,M,tt),P(tt)},[m,S,a,M,P]),et=W(()=>t.model.createSelection(M,ge,De),[t.model,M,ge,De]);iD({threadId:u?.id??null,isLocalDraftThread:m,selection:et,selectionsEqual:t.model.selectionsEqual,onChosen:X||f?void 0:N});let Et=R(tt=>A(tt,et),[A,et]),ft=Z?.selected.kind==="model"?Z.selected.slug:ge,Ct=W(()=>{let tt=new Map;for(let It of B)tt.set(It.instanceId,t.model.getAppModelOptionsForInstance(n,It,It.instanceId===M?ft:null));return tt},[t.model,B,M,ft,n]),gt=W(()=>(Ct.get(M)??[]).some(It=>It.slug===ft)?ft:t.model.normalizeSlug(ft)??ft,[t.model,Ct,M,ft,te]),Dt=k??(T?null:I),Mt=Dt!==null,[se,Le]=q(!1);H(()=>{Le(!1)},[M]);let be=oD({status:ne,submissionTarget:T?"pending-user-input":"provider-turn"}),Xe=nD({blockedOnSend:se,status:ne,submissionTarget:T?"pending-user-input":"provider-turn"}),xt=W(()=>ZN(b,Ct),[b,Ct]);return{providerInstanceEntries:B,lockedContinuationGroupKey:G,selectedInstanceId:M,agentUnavailable:X,selectedProviderEntry:F,noProviderAvailable:ee,agentUnavailableNoChoice:Y,resolvedCompactDisabledReason:ae,selectedProvider:te,composerModelOptions:de,selectedModel:ge,selectedModelStatus:ne,selectedProviderStatus:he,selectedProviderModels:Ae,selectedModelChoice:Z,modelNotes:je,selectedModelUnconfirmed:ot,selectedModelOptionsForDispatch:De,planModeUiEnabled:me,composerProviderControls:Me,canSwitchNativeMode:ue,composerNativeMode:Ze,selectedNativeModeId:pt,handleComposerNativeModeChange:ze,selectedModelSelection:et,onAgentInstanceChange:Et,modelOptionsByInstance:Ct,selectedModelForPickerWithCustomFallback:gt,sendDisabledReason:Dt,isSendDisabled:Mt,setModelSendBlockShown:Le,isModelSendBlocked:be,modelSendBlock:Xe,activeThreadModelDisplayName:xt}}function cD(e,t){let{provider:o,instanceId:n,threadRef:r,draftId:a,model:s,choice:i}=t,d=r!==void 0||a!==void 0,c=NT(i,u=>u);return!d||!MT(c,AT(i))?null:l(e,{provider:o,...n?{instanceId:n}:{},...r?{threadRef:r}:{},...a?{draftId:a}:{},model:s,choice:i})}function uD(e){return cD(xb,e)}function pD(e){return cD(Cb,e)}function mD(e){let{routeKind:t,routeThreadRef:o,draftId:n,selectedProvider:r,selectedInstanceId:a,selectedModel:s,selectedModelChoice:i}=e,d={provider:r,instanceId:a,...t==="server"?{threadRef:o}:{},...t==="draft"&&n?{draftId:n}:{},model:s,choice:i};return{providerTraitsMenuContent:uD(d),providerTraitsPicker:pD(d)}}$();$();var qC="ycodium:status-bar-usage-surface";var fD=pe(function(t){let{data:o,target:n}=Ho(),r=lb(),a=o.useAccountUsageInstance(n),s=`${n.environmentId}:${n.threadId}`;return H(()=>{if(r)return window.dispatchEvent(new CustomEvent(qC,{detail:{owner:s,environmentId:n.environmentId,instanceId:a?.instanceId??null,instanceLabel:a?.instanceLabel??null,decisionOccupiesComposer:t.decisionOccupiesComposer,clear:!1}})),()=>{window.dispatchEvent(new CustomEvent(qC,{detail:{owner:s,clear:!0}}))}},[r,a?.instanceId,a?.instanceLabel,s,t.decisionOccupiesComposer,n.environmentId]),null});function WW(e,t,o){let n=[];n.push(t(e));let r=o(e);return r&&n.push(r),e.pageUrl&&n.push(e.pageUrl),e.selector&&n.push(e.selector),e.htmlPreview.trim().length>0&&(n.push(""),n.push(e.htmlPreview.trim().slice(0,600))),n.join(`
3572
- `)}function GW({context:e,onRemove:t}){let{t:o}=z(),n=it().elementContext,r=n.formatLabel(e),a=n.formatSourceLabel(e);return v(Pe,{children:[l(Ee,{render:v("span",{className:V(ln,"pr-1"),children:[l(Wn,{className:V(Fo,"size-icon-1")}),l("span",{className:Bo,children:r}),a?l("span",{className:"select-none text-ui-2xs font-normal text-muted-foreground/85",children:a}):null,l("button",{type:"button","aria-label":o("pendingContext.removeElement",{label:r}),className:fp,onClick:s=>{s.preventDefault(),s.stopPropagation(),t(e.id)},children:l(dt,{className:"size-3","aria-hidden":!0})})]})}),l(Re,{side:"top",className:"max-w-96 whitespace-pre-wrap leading-tight",children:WW(e,n.formatLabel,n.formatSourceLabel)})]})}function gD({contexts:e,onRemove:t,className:o}){return e.length===0?null:l("div",{className:V("flex flex-wrap gap-1.5",o),children:e.map(n=>l(GW,{context:n,onRemove:t},n.id))})}function hD({comments:e,onRemove:t,className:o}){let{t:n}=z();return e.length===0?null:l("div",{className:V("flex flex-wrap gap-1.5",o),children:e.map(r=>{let a=`${r.filePath} ${r.rangeLabel}`,s=v("span",{className:V(ln,"pr-1"),children:[l(nd,{className:V(Fo,"size-icon-1")}),l("span",{className:Bo,children:a}),l("button",{type:"button","aria-label":n("pendingContext.removeReviewComment",{label:a}),className:fp,onClick:i=>{i.preventDefault(),i.stopPropagation(),t(r.id)},children:l(dt,{className:"size-3","aria-hidden":!0})})]},r.id);return r.text.length===0?s:v(Pe,{children:[l(Ee,{render:s}),l(Re,{side:"top",className:"max-w-96 whitespace-pre-wrap leading-tight",children:r.text})]},r.id)})})}function Zf(e){let{t}=z(),o=t(e.tooltipKey,{count:e.count});return v(Pe,{children:[l(Ee,{render:v("span",{className:"inline-flex items-center gap-1 text-ui-2xs font-medium text-muted-foreground",children:[e.icon,e.count]})}),l(Re,{side:"top",children:o})]})}function yD({annotations:e,images:t,onRemove:o,onExpandImage:n,uploadsByImageId:r,onRetryUpload:a,className:s}){let{t:i}=z(),d=it().elementContext;if(e.length===0)return null;let c=new Map(t.map(u=>[u.id,u]));return l("div",{className:V("flex flex-wrap gap-1.5",s),children:e.map(u=>{let m=c.get(u.id),p=m?r?.[m.id]:void 0,f=u.elements.flatMap(g=>{let h=d.normalizeSelection(g.element);return h?[{id:g.id,label:d.formatLabel(h)}]:[]});return v("section",{className:"group/browser-annotation relative flex min-w-0 max-w-full items-center overflow-hidden rounded-lg border border-border/80 bg-background/72",children:[m?.previewUrl?l("button",{type:"button","aria-label":i("browserAnnotation.previewImage",{name:m.name}),className:"size-14 shrink-0 cursor-zoom-in overflow-hidden border-r border-border/70 bg-muted",onClick:()=>n(m.id),children:l("img",{src:m.previewUrl,alt:i("browserAnnotation.cropAlt"),className:"size-full object-cover transition-transform duration-(--control-duration) group-hover/browser-annotation:scale-[1.03]"})}):l("span",{className:"grid size-10 shrink-0 place-items-center border-r border-border/70 text-message-action",children:l(Wn,{className:"size-icon-2"})}),v("div",{className:"min-w-0 px-2.5 py-2 pr-8",children:[u.comment.trim()?l("p",{className:"max-w-80 truncate text-foreground text-xs font-medium",children:u.comment.trim()}):null,v("div",{className:V("flex min-w-0 items-center gap-2",u.comment.trim()&&"mt-1"),children:[f.length>0?v("div",{className:"flex min-w-0 items-center gap-1",children:[f.slice(0,2).map(({id:g,label:h})=>l("span",{className:"max-w-40 truncate font-mono text-secondary-label text-ui-2xs",children:h},g)),f.length>2?v("span",{className:"text-secondary-label text-ui-2xs",children:["+",f.length-2]}):null]}):null,v("div",{className:"flex shrink-0 items-center gap-2",children:[u.elements.length>0?l(Zf,{icon:l(Wn,{className:"size-3"}),count:u.elements.length,tooltipKey:"browserAnnotation.elementCount"}):null,u.regions.length>0?l(Zf,{icon:l(Gl,{className:"size-3"}),count:u.regions.length,tooltipKey:"browserAnnotation.regionCount"}):null,u.strokes.length>0?l(Zf,{icon:l(Gn,{className:"size-3"}),count:u.strokes.length,tooltipKey:"browserAnnotation.drawingCount"}):null,u.styleChanges.length>0?l(Zf,{icon:l(za,{className:"size-3"}),count:u.styleChanges.length,tooltipKey:"browserAnnotation.styleChangeCount"}):null,p?.status==="uploading"?l("span",{className:"text-ui-2xs text-secondary-label",children:Gf(p.progress)}):null,p?.status==="failed"&&m&&a?v(Pe,{children:[l(Ee,{render:l(K,{size:"icon-micro",variant:"ghost-muted","aria-label":i("attachments.retryUpload",{name:m.name}),onClick:()=>a(m)}),children:l(Ka,{className:"size-3"})}),l(Re,{side:"top",children:Wf(p,i)})]}):null]})]})]}),l(K,{size:"icon-micro",variant:"ghost-muted","aria-label":i("browserAnnotation.remove"),className:"absolute right-1.5 top-1.5 [--control-icon-color:currentColor] rounded text-icon-muted hover:bg-muted",onClick:()=>o(u.id),children:l(dt,{className:"size-3"})})]},u.id)})})}function WC(e,t){let o=e.flatMap(r=>r.previewUrl?[{id:r.id,src:r.previewUrl,name:r.name,source:r.source}]:[]);if(o.length===0)return null;let n=o.findIndex(r=>r.id===t);return n<0?null:{images:o.map(r=>({src:r.src,name:r.name,...r.source===void 0?{}:{source:r.source}})),index:n}}function vD(e){let{t}=z(),{api:o,environmentId:n,composerDraftTarget:r,isComposerCollapsedMobile:a,isComposerApprovalState:s,hasPendingUserInputs:i,supportsAttachmentUploads:d,uploadsByImageId:c,composerImages:u,composerPreviewableImages:m,composerBrowserAnnotations:p,composerReviewComments:f,composerElementContexts:g,nonPersistedComposerImageIdSet:h,removeComposerDraftBrowserAnnotation:y,removeComposerDraftReviewComment:x,removeComposerDraftElementContext:C,removeComposerImage:b,onExpandImage:L}=e;return v(oe,{children:[!a&&!s&&!i&&p.length>0&&l(yD,{annotations:p,images:u,...d?{uploadsByImageId:c,onRetryUpload:w=>o.uploads.retry({environmentId:n,image:w})}:{},onRemove:w=>{o.uploads.release(w),y(r,w)},onExpandImage:w=>{let k=WC(m,w);k&&L(k)},className:"mb-3"}),!a&&!s&&!i&&f.length>0&&l(hD,{comments:f,onRemove:w=>x(r,w),className:"mb-3"}),!a&&!s&&!i&&g.length>0&&l(gD,{contexts:g,onRemove:w=>C(r,w),className:"mb-3"}),!a&&!s&&!i&&u.some(w=>!p.some(k=>k.id===w.id))&&l("div",{className:"mb-3 flex flex-wrap gap-2",children:u.filter(w=>!p.some(k=>k.id===w.id)).map(w=>{let k=d?c[w.id]:void 0,I=Tn(w),T=sp(I),S=I==="image"&&!!w.previewUrl;return v("div",{"data-composer-attachment-id":w.id,className:V("relative h-16 overflow-hidden rounded-lg border border-border/80 bg-background",S?"w-16":"w-44 max-w-full"),children:[S?l("button",{type:"button",className:"h-full w-full cursor-zoom-in","aria-label":t("attachments.preview",{name:w.name}),onClick:()=>{let P=WC(m,w.id);P&&L(P)},children:l("img",{src:w.previewUrl,alt:w.name,className:"h-full w-full object-cover"})}):v("a",{href:w.previewUrl,target:"_blank",rel:"noreferrer",className:"flex h-full w-full items-center gap-2 px-2 pe-7 text-start","aria-label":t("attachments.open",{name:w.name}),children:[l(T,{className:"size-4 shrink-0 text-secondary-label"}),v("span",{className:"min-w-0",children:[l("span",{className:"block truncate text-ui-xs text-foreground",children:w.name}),l("span",{className:"block text-ui-2xs text-secondary-label",children:di(w.sizeBytes)})]})]}),h.has(w.id)&&v(Pe,{children:[l(Ee,{render:l("span",{role:"img","aria-label":t("attachments.draftMayNotPersist"),className:"absolute left-1 top-1 inline-flex items-center justify-center rounded bg-background/85 p-0.5 text-warning-foreground",children:l(eo,{className:"size-3"})})}),l(Re,{side:"top",className:"max-w-64 whitespace-normal leading-tight",children:t("attachments.draftMayNotPersistDetail")})]}),k?.status==="uploading"&&l("span",{className:"pointer-events-none absolute inset-x-0 bottom-0 bg-background/85 px-1 text-center text-ui-2xs text-foreground",children:Gf(k.progress)}),k?.status==="failed"&&v(Pe,{children:[l(Ee,{render:l(K,{variant:"ghost",size:"icon-xs",className:"absolute bottom-1 left-1 bg-background/85 hover:bg-background/90",onClick:()=>o.uploads.retry({environmentId:n,image:w}),"aria-label":t("attachments.retryUpload",{name:w.name})}),children:l(Ka,{})}),l(Re,{side:"top",className:"max-w-64 whitespace-normal leading-tight",children:Wf(k,t)})]}),l(K,{variant:"ghost",size:"icon-xs",className:"absolute right-1 top-1 bg-background/80 hover:bg-background/90",onClick:()=>b(w.id),"aria-label":t("attachments.remove",{name:w.name}),children:l(dt,{})})]},w.id)})})]})}function CD(e){return e.machineUnavailable?"machineDisconnected":e.sessionStarted&&e.sessionDisconnected?"settled":"default"}function xD(e){switch(e){case"machineDisconnected":return"composer.disconnectedPlaceholder";case"settled":return"composer.idlePlaceholder";case"default":return null}}function bD(e){return e.isComposerApprovalState?e.t("composer.resolveApprovalToContinue"):e.activePendingProgress?e.t("composer.typeOwnAnswer"):e.showPlanFollowUpPrompt?e.t("composer.addFeedbackRefinePlan"):e.projectSelectionRequired?e.t("composer.chooseProjectToStart"):e.noProviderAvailable?e.t("composer.enableProviderToSend"):e.t(e.tailPlaceholderKey??"composer.askAnything")}$();$();var wD=pe(function(t){let{t:o}=z(),n=ml();return v(Ao,{children:[l(Do,{render:l(K,{size:"sm",variant:"ghost",className:"shrink-0 px-2 text-muted-foreground/70 hover:text-foreground/80","aria-label":o("composer.moreComposerControls")}),children:l(Eo,{"aria-hidden":"true",className:"size-4"})}),v(No,{align:"start",children:[t.traitsMenuContent?v(oe,{children:[t.traitsMenuContent,l(xd,{})]}):null,t.showInteractionModeToggle&&t.nativeMode===null?v(oe,{children:[l("div",{className:"px-2 py-1.5 font-medium text-muted-foreground text-xs",children:o("composer.modeMenuTitle")}),v(Yr,{value:t.interactionMode,onValueChange:r=>{!r||r===t.interactionMode||t.onToggleInteractionMode()},children:[l(Yn,{value:"default",children:o("composer.interactionModeChat")}),l(Yn,{value:"plan",children:o("composer.interactionModePlan")})]}),l(xd,{})]}):null,t.nativeMode===null?v(oe,{children:[l("div",{className:"px-2 py-1.5 font-medium text-muted-foreground text-xs",children:o("composer.accessMenuTitle")}),l(Yr,{value:t.runtimeMode,onValueChange:r=>{!r||r===t.runtimeMode||t.onRuntimeModeChange(r)},children:On.map(r=>l(Yn,{value:r,children:n(r).label},r))}),t.runtimeModeSwitch==="next-turn"?l("div",{className:"px-2 pb-1.5 text-muted-foreground text-xs leading-4",children:o("runtimeMode.appliesNextTurnHint")}):null]}):v(oe,{children:[l("div",{className:"px-2 py-1.5 font-medium text-muted-foreground text-xs",children:o("composer.accessMenuTitle")}),t.canSwitchNativeMode&&t.nativeMode.modes.length>1?v(oe,{children:[l(Yr,{value:t.nativeMode.current.id,onValueChange:r=>{t.onNativeModeChange(String(r))},children:t.nativeMode.modes.map(r=>l(Yn,{value:r.id,children:r.name},r.id))}),t.runtimeModeSwitch==="next-turn"?l("div",{className:"px-2 pb-1.5 text-muted-foreground text-xs leading-4",children:o("runtimeMode.appliesNextTurnHint")}):null]}):l("div",{className:"px-2 pb-1.5 text-foreground text-sm","data-composer-native-mode":t.nativeMode.current.id,children:t.nativeMode.current.name})]})]})]})});function TD(e){let{t}=z(),o=it().environment.useScopedEnvironmentId();return l(vb,{...e,hideInstanceRail:!0,showInstanceOnTrigger:!1,emptyLabel:t("composer.chooseModel"),...o===null?{}:{environmentId:o}})}function ID(e){let{slots:t,...o}=e,n=l(TD,{...o}),r=t?.renderSlot("conversation.input.model",o,n);return l("span",{"data-conversation-slot":"conversation.input.model",children:r??n})}function SD(e){return l(TD,{...e})}$();function kD(e){return e.description??e.name}var LD=pe(function(t){let{t:o}=z(),{current:n,modes:r}=t.nativeMode,a=kD(n);return!t.canSwitch||r.length<2?v(Pe,{children:[v(Ee,{render:l(Vn,{className:"shrink-0 cursor-default whitespace-nowrap font-medium",type:"button",disabled:!0,"data-composer-native-mode":n.id,"aria-label":o("composer.agentModeLabel",{name:n.name})}),children:[l(Qn,{icon:qs}),l("span",{children:n.name})]}),v(Re,{side:"top",children:[l("span",{className:"block font-medium",children:a}),r.length>1?l("span",{className:"mt-1 block text-muted-foreground text-xs",children:o("composer.agentModesList",{modes:r.map(s=>s.name).join(", ")})}):null]})]}):l(oe,{children:v(Pe,{children:[v(Xs,{value:n.id,onValueChange:s=>t.onNativeModeChange(s),children:[v(Ee,{render:l(Au,{className:"shrink-0 whitespace-nowrap font-medium","data-composer-native-mode":n.id,"aria-label":o("composer.agentModeLabel",{name:n.name})}),children:[l(Qn,{icon:qs}),l(Ou,{children:n.name})]}),l(Ys,{alignItemWithTrigger:!1,children:r.map(s=>l(qa,{value:s.id,hideIndicator:!0,className:"min-w-56 py-2",children:v("div",{className:"grid min-w-0 gap-0.5",children:[l("span",{className:"font-medium text-foreground",children:s.name}),s.description?l("span",{className:"text-muted-foreground text-xs leading-4",children:s.description}):null]})},s.id))})]}),l(Re,{side:"top",children:t.appliesNextTurn?`${a} ${o("runtimeMode.appliesNextTurnHint")}`:a})]})})});function GC(e){let{t}=z(),o=ml();if(e.nativeMode)return l(LD,{nativeMode:e.nativeMode,canSwitch:e.canSwitchNativeMode,appliesNextTurn:e.runtimeModeSwitch==="next-turn",onNativeModeChange:e.onNativeModeChange});let n=o(e.runtimeMode),r=n.icon,a=e.runtimeModeSwitch==="next-turn";return l(oe,{children:v(Pe,{children:[v(Xs,{value:e.runtimeMode,onValueChange:s=>e.onRuntimeModeChange(s),children:[v(Ee,{render:l(Au,{"data-composer-permission":"true",className:"font-medium","aria-label":t("composer.runtimeMode")}),children:[l(Qn,{icon:r}),l(Ou,{children:n.label})]}),l(Ys,{alignItemWithTrigger:!1,children:On.map(s=>{let i=o(s),d=i.icon;return l(qa,{value:s,hideIndicator:!0,className:"min-w-64 py-2","data-runtime-mode":s,children:v("span",{className:"flex items-center gap-2",children:[l(d,{className:"size-4"}),i.label]})},s)})})]}),l(Re,{side:"top",children:a?t("runtimeMode.appliesNextTurnHint"):n.label})]})})}function PD(e){return l(GC,{...e})}function jC(e){let{t}=z();if(!e.showInteractionModeToggle)return null;let o=e.interactionMode==="plan",n=t(o?"composer.planModeTooltip":"composer.defaultModeTooltip");return v(Pe,{children:[v(Ee,{render:l(Vn,{"data-composer-plan-toggle":"true",className:V("shrink-0 whitespace-nowrap",o?"bg-accent text-accent-foreground hover:bg-accent/90":"text-secondary-label hover:text-foreground"),type:"button",onClick:e.onToggleInteractionMode,"aria-label":n}),children:[o?l(Qn,{icon:id,className:"text-current opacity-100"}):l(Qn,{icon:Bl,opticalSize:"large"}),l("span",{className:"sr-only sm:not-sr-only",children:t(o?"composer.interactionModePlan":"composer.interactionModeBuild")})]}),l(Re,{side:"top",className:"sm:hidden",children:n})]})}function RD(e){return l(jC,{...e})}function Yc(e){let t=e.slots?.renderSlot(e.name,e.owner??{},e.fallback);return l("span",{"data-conversation-slot":e.name,children:t??e.fallback})}function Or(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 jW(e){return e===null||!Number.isFinite(e)?null:e<10?`${e.toFixed(1).replace(/\.0$/,"")}%`:`${Math.round(e)}%`}function ED(e){let{t}=z(),o=ho(),{usage:n,breakdown:r,modelDisplayName:a,onCompact:s,compactDisabled:i,compactDisabledReason:d}=e,c=jW(n.usedPercentage),u=n.usedPercentage??0,m=n.usedPercentage===null?null:100,p=n.totalProcessedTokens??null,f=p!==null&&p>0;return v(rn,{children:[l(sn,{openOnHover:!0,delay:150,closeDelay:s?150:0,render:l(K,{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&&c?t("contextWindow.usedPercentAria",{percentage:c}):t("contextWindow.usedTokensAria",{tokens:Or(n.usedTokens)}),children:l(Eg,{"aria-hidden":!0,"aria-label":t("contextWindow.usage"),limit:m,shape:"ring",used:u})})}),l(an,{tooltipStyle:!0,side:"top",align:"end",viewportClassName:"overflow-y-auto p-0",className:"w-72 text-left whitespace-normal",children:v("div",{className:"flex flex-col gap-2 p-[var(--floating-content-inset)]",children:[v("div",{className:"flex flex-wrap items-center justify-between gap-x-3 gap-y-1",children:[l("div",{className:"font-medium text-muted-foreground text-xs",children:t("contextWindow.title")}),n.maxTokens!==null&&c?v("div",{className:"flex items-center gap-2 text-secondary-label text-ui-sm tabular-nums",children:[l("span",{children:c})," ",v("span",{children:[Or(n.usedTokens),"/",Or(n.maxTokens??null)]})]}):l("div",{className:"flex items-center gap-2 text-secondary-label text-ui-sm tabular-nums",children:Or(n.usedTokens)})]}),n.maxTokens!==null?l(Eg,{"aria-label":t("contextWindow.usage"),limit:m,shape:"bar",used:u}):null,r?v("div",{className:"flex flex-col gap-1","data-context-breakdown":"true",children:[v("div",{className:"flex items-center justify-between gap-3 text-ui-sm leading-4","data-context-breakdown-row":"system",children:[l("span",{className:"text-secondary-label",children:t("contextWindow.system")}),l("span",{className:"font-medium tabular-nums text-secondary-label",children:Or(r.systemTokens)})]}),v("div",{className:"flex items-center justify-between gap-3 text-ui-sm leading-4","data-context-breakdown-row":"tools",children:[l("span",{className:"text-secondary-label",children:t("contextWindow.tools")}),l("span",{className:"font-medium tabular-nums text-secondary-label",children:Or(r.toolsTokens)})]}),v("div",{className:"flex items-center justify-between gap-3 text-ui-sm leading-4","data-context-breakdown-row":"messages",children:[l("span",{className:"text-secondary-label",children:t("contextWindow.messages")}),l("span",{className:"font-medium tabular-nums text-secondary-label",children:Or(r.messageTokens)})]})]}):null,f?v("div",{className:"flex items-center justify-between gap-3 text-ui-sm leading-4",children:[l("span",{className:"text-secondary-label",children:t("contextWindow.totalProcessed")}),l("span",{className:"font-medium tabular-nums text-secondary-label",children:Or(p)})]}):null,n.compactsAutomatically?l("div",{className:"mt-1 text-pretty text-secondary-label text-ui-sm font-medium",children:eD(t,a,n.autoCompactThreshold)}):null,s?v(oe,{children:[v(K,{size:"xs",variant:"outline",className:"mt-1 w-full justify-center",disabled:i,"aria-describedby":i&&d?o:void 0,onClick:s,children:[l(rd,{"aria-hidden":"true"}),t("contextWindow.compactContext")]}),i&&d?l("div",{id:o,className:"text-pretty text-secondary-label text-ui-sm",children:d}):null]}):null]})})]})}function VC(e,t){return t==null?void 0:e.find(o=>o.presetId===t)}$();function MD(e){if(e.useDraftPresetId===void 0||e.setDraftPresetId===void 0)throw new Error("missing draft preset api: useDraftPresetId and setDraftPresetId");return{useDraftPresetId:e.useDraftPresetId,setDraftPresetId:e.setDraftPresetId}}var QC="__none__",AD=pe(function({environmentId:t,draftId:o,threadPresetId:n,compact:r}){let{t:a}=z(),s=it().presets,i=MD(s),d=s.useThreadPresets(t),c=i.useDraftPresetId(o);if(o===null){let f=VC(d,n)?.displayName??n;return f===null?null:l(VW,{compact:r,label:f,applied:a("preset.appliedLabel",{name:f}),disabled:!0})}if(d.length===0)return null;let m=VC(d,c)?.displayName??a("preset.none");return v(Ao,{children:[v(Do,{render:l(Vn,{variant:"ghost","aria-label":a("preset.triggerLabel"),className:"max-w-40 min-w-0 shrink"}),children:[l(ND,{compact:r,label:m,applied:a("preset.appliedLabel",{name:m})}),l(Mu,{})]}),l(No,{align:"start",children:v(Pb,{children:[l("div",{className:"px-2 pt-1.5 pb-1 font-medium text-muted-foreground text-xs",children:a("preset.menuTitle")}),v(Yr,{value:c??QC,onValueChange:p=>{i.setDraftPresetId(o,p===QC?null:p)},children:[l(Yn,{value:QC,hideIndicator:!0,closeOnClick:!0,children:l("span",{className:"min-w-0 truncate",children:a("preset.none")})}),d.map(p=>l(Yn,{value:p.presetId,hideIndicator:!0,closeOnClick:!0,children:v("span",{className:"flex w-full min-w-0 flex-col",children:[l("span",{className:"min-w-0 truncate",children:p.displayName}),p.description?l("span",{className:"max-w-56 text-pretty text-muted-foreground/80 text-xs",children:p.description}):null]})},p.presetId))]})]})})]})});function VW(e){return l(Vn,{variant:"ghost",disabled:e.disabled,"aria-label":e.applied,className:"max-w-40 min-w-0 shrink",children:l(ND,{compact:e.compact,label:e.label,applied:e.applied})})}function ND(e){return v(Pe,{children:[v(Ee,{render:l("span",{className:"flex min-w-0 items-center gap-1.5"}),children:[l(Qn,{icon:Kr}),e.compact?null:l("span",{className:"min-w-0 truncate",children:e.label})]}),l(Re,{side:"top",children:e.applied})]})}var QW=pe(function(t){let{data:o,target:n}=Ho(),r=o.useContextUsage(n);return r?.window==null?null:l(ED,{usage:r.window,breakdown:r.breakdown,modelDisplayName:t.modelDisplayName,onCompact:t.onCompact,compactDisabled:t.compactDisabled,compactDisabledReason:t.compactDisabledReason})}),XW=pe(function(t){let{t:o}=z(),n=Xf(t.groupSendEligible),r=Qf({pluginAction:t.pluginAction,groupSend:n,groupSendDisabledReason:t.groupSendDisabledReason,sendDisabledReason:t.sendDisabledReason,noProviderAvailable:t.noProviderAvailable,environmentUnavailable:t.environmentUnavailable,projectSelectionRequired:t.projectSelectionRequired,labels:{environmentDisconnected:o("primaryActions.environmentDisconnected"),chooseProjectToStart:o("composer.chooseProjectToStart"),enableProviderToSend:o("composer.enableProviderToSend")}}).reason;return v(oe,{children:[l(QW,{modelDisplayName:t.activeThreadModelDisplayName,onCompact:t.onCompactContext,compactDisabled:t.compactDisabled,compactDisabledReason:t.compactDisabledReason}),l(gl,{compact:t.compact,pendingAction:t.pendingAction,isRunning:t.isRunning,showPlanFollowUpPrompt:t.showPlanFollowUpPrompt&&!t.pluginAction,promptHasText:t.promptHasText,isSendBusy:t.isSendBusy,sendDisabledReason:r,isEnvironmentUnavailable:t.environmentUnavailable||t.noProviderAvailable&&!n&&!t.pluginAction||t.projectSelectionRequired,hasSendableContent:t.hasSendableContent,preserveComposerFocusOnPointerDown:t.preserveComposerFocusOnPointerDown??!1,showSendWhileRunning:!!(t.showSendWhileRunning||t.pluginAction),onInterrupt:t.onInterrupt,interruptArmed:t.interruptArmed,stopping:t.stopping,cancelsCheck:t.cancelsCheck,onImplementPlanInNewThread:t.onImplementPlanInNewThread,shellCommandMode:t.shellCommandMode,shellCommandUnavailableReason:t.shellCommandUnavailableReason})]})});function DD(e){let{t}=z(),{isComposerFooterCompact:o,isComposerPrimaryActionsCompact:n,isMobileViewport:r,showMobilePendingAnswerActions:a,hasPendingUserInputs:s,projectSelectionRequired:i,noProviderAvailable:d,composerAttachmentInputRef:c,onComposerAttachmentInputChange:u,slots:m,selectedInstanceId:p,unavailableAgentInstanceId:f,agentNotChosen:g,agentUnavailable:h,providerInstanceEntries:y,lockedProvider:x,lockedContinuationGroupKey:C,onAgentInstanceChange:b,selectedModelForPickerWithCustomFallback:L,selectedModelStatus:w,selectedModelUnconfirmed:k,keybindings:I,modelOptionsByInstance:T,terminalOpen:S,isComposerModelPickerOpen:P,setIsComposerModelPickerOpen:A,getModelDisabledReason:N,getModelContinuationLabel:B,onContinueInModel:O,onProviderModelSelect:j,environmentId:U,routeKind:D,draftId:J,activeThread:G,interactionMode:M,runtimeMode:X,composerProviderControls:F,composerNativeMode:ee,canSwitchNativeMode:Y,providerTraitsMenuContent:ae,providerTraitsPicker:te,toggleInteractionMode:de,handleRuntimeModeChange:ge,handleComposerNativeModeChange:ne,inlineTasksBadge:Z,inlineStashBadge:ve,activeThreadModelDisplayName:he,pendingPrimaryAction:Ae,phase:De,continuationChecking:je,showPlanFollowUpPrompt:ot,composerDraft:me,isSendBusy:Me,sendDisabledReason:ue,groupSendDisabledReason:ce,groupSendEligible:Ze,environmentUnavailable:pt,handleInterruptPrimaryAction:ze,interruptArmed:et,stopping:Et,handleImplementPlanInNewThreadPrimaryAction:ft,shellCommandMode:Ct,shellCommandUnavailableReason:gt,compactDisabled:Dt,resolvedCompactDisabledReason:Mt,compactThreadContext:se}=e;return v("div",{"data-chat-composer-footer":"true","data-chat-composer-footer-compact":o?"true":"false",className:V("flex min-w-0 select-none flex-nowrap items-center justify-between gap-2 overflow-visible px-3 pb-3 sm:px-4 sm:pb-4",s&&"pt-2",o?"gap-1.5":"gap-2 sm:gap-0",a&&"hidden sm:flex"),children:[v("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:[l("input",{ref:c,type:"file",multiple:!0,className:"hidden",tabIndex:-1,"aria-hidden":"true",onChange:u}),v(Pe,{children:[l(Ee,{render:l(K,{type:"button",variant:"ghost",size:"icon-sm","data-chat-composer-attach":"true",className:"shrink-0",disabled:i||s,"aria-label":t("attachments.add"),onClick:()=>c.current?.click()}),children:l(Vo,{})}),l(Re,{side:"top",children:t("attachments.add")})]}),d?v(K,{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:[l(eo,{className:"size-4"}),t("composer.noProviderAvailable")]}):v(oe,{children:[l(Yc,{name:"conversation.input.agent",...m===void 0?{}:{slots:m},owner:{activeInstanceId:p,unavailableInstanceId:f,notChosen:g,instanceEntries:y,lockedProvider:x,lockedContinuationGroupKey:C,compact:o,onInstanceChange:b},fallback:l(zC,{activeInstanceId:p,unavailableInstanceId:f,notChosen:g,instanceEntries:y,lockedProvider:x,lockedContinuationGroupKey:C,compact:o,onInstanceChange:b})}),h||g?null:l(ID,{...m===void 0?{}:{slots:m},compact:o,hideInstanceRail:!0,showInstanceOnTrigger:!1,activeInstanceId:p,model:L,modelStatus:w,modelUnconfirmed:k,lockedProvider:x,lockedContinuationGroupKey:C,instanceEntries:y,keybindings:I,modelOptionsByInstance:T,terminalOpen:S,open:P,onOpenChange:Le=>{A(Le)},getModelDisabledReason:N,getModelContinuationLabel:B,onContinueInModel:O,onInstanceModelChange:j})]}),v(oe,{children:[l(AD,{environmentId:U,draftId:D==="draft"?J:null,threadPresetId:G?.presetId??null,compact:o},D==="draft"?J:G?.id??"thread"),o?l(wD,{interactionMode:M,runtimeMode:X,runtimeModeSwitch:F.runtimeModeSwitch,nativeMode:ee,canSwitchNativeMode:Y,showInteractionModeToggle:F.showInteractionModeToggle,traitsMenuContent:ae,onToggleInteractionMode:de,onRuntimeModeChange:ge,onNativeModeChange:ne}):v(oe,{children:[te?l(Yc,{name:"conversation.input.effort",...m===void 0?{}:{slots:m},fallback:te}):null,ee===null&&F.showInteractionModeToggle?l(Yc,{name:"conversation.input.plan",...m===void 0?{}:{slots:m},owner:{interactionMode:M,showInteractionModeToggle:F.showInteractionModeToggle,onToggleInteractionMode:de},fallback:l(jC,{interactionMode:M,showInteractionModeToggle:F.showInteractionModeToggle,onToggleInteractionMode:de})}):null,l(Yc,{name:"conversation.input.permission",...m===void 0?{}:{slots:m},owner:{runtimeMode:X,runtimeModeSwitch:F.runtimeModeSwitch,nativeMode:ee,canSwitchNativeMode:Y,onRuntimeModeChange:ge,onNativeModeChange:ne},fallback:l(GC,{runtimeMode:X,runtimeModeSwitch:F.runtimeModeSwitch,nativeMode:ee,canSwitchNativeMode:Y,onRuntimeModeChange:ge,onNativeModeChange:ne})})]})]})]}),v("div",{"data-chat-composer-actions":"right","data-chat-composer-primary-actions-compact":n?"true":"false",className:"flex shrink-0 flex-nowrap items-center justify-end gap-2",children:[a?null:Z,a?null:ve,l(XW,{pluginAction:e.pluginAction,compact:n,activeThreadModelDisplayName:he,pendingAction:Ae,isRunning:De==="running"||je,cancelsCheck:je&&De!=="running",showPlanFollowUpPrompt:!s&&ot,promptHasText:me.promptHasText,isSendBusy:Me,sendDisabledReason:ue,groupSendDisabledReason:ce,groupSendEligible:Ze,noProviderAvailable:d,environmentUnavailable:pt!==null,projectSelectionRequired:i,hasSendableContent:me.hasSendableContent,preserveComposerFocusOnPointerDown:r,showSendWhileRunning:r,onInterrupt:ze,interruptArmed:et,stopping:Et,onImplementPlanInNewThread:ft,shellCommandMode:Ct,shellCommandUnavailableReason:gt,compactDisabled:Dt||d||Me,compactDisabledReason:Mt,onCompactContext:se})]})]})}var YW=e=>e.prompt.trim();function JW(e){let{t}=z(),o=e.api.draft.useThreadDraftSelector(e.composerDraftTarget,YW),n=e.pendingCustomAnswer!==null;return l("button",{type:"button",className:V("min-w-0 flex-1 truncate bg-transparent p-0 text-left text-control-3",(n?e.pendingCustomAnswer:o)?"text-foreground":"text-placeholder"),onPointerDown:r=>r.preventDefault(),onClick:e.onExpand,"aria-label":t("composer.expandComposer"),children:n?e.pendingCustomAnswer||t("composer.typeOwnAnswer"):o||(e.noProviderAvailable?t("composer.enableProviderSettings"):t("composer.askAnything"))})}function _D(e){let{api:t,composerDraftTarget:o,pendingCustomAnswer:n,noProviderAvailable:r,onExpand:a,inlineTasksBadge:s,inlineStashBadge:i,submitDisabled:d,submitLabel:c,onSubmit:u}=e,{t:m}=z(),p=Xf(e.groupSendEligible),f=Qf({pluginAction:e.pluginAction,groupSend:p,groupSendDisabledReason:e.groupSendDisabledReason,sendDisabledReason:e.modelSendDisabledReason,noProviderAvailable:e.noProviderAvailable,environmentUnavailable:e.environmentUnavailable,projectSelectionRequired:e.projectSelectionRequired,labels:{environmentDisconnected:m("primaryActions.environmentDisconnected"),chooseProjectToStart:m("composer.chooseProjectToStart"),enableProviderToSend:m("composer.enableProviderToSend")}});return v("div",{className:"flex items-center justify-between gap-2 px-3 py-2",children:[l(JW,{api:t,composerDraftTarget:o,pendingCustomAnswer:n,noProviderAvailable:!p&&!e.pluginAction&&r,onExpand:a}),s,i,l("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:d||f.disabled,"aria-label":c,onPointerDown:g=>g.preventDefault(),onClick:g=>{g.stopPropagation(),u()},children:l("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:l("path",{d:"M8 3L8 13M8 3L4 7M8 3L12 7",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]})}$();$();var OD={plugins:"slashMenu.sections.plugins",recent:"slashMenu.sections.recent",builtIn:"slashMenu.sections.builtIn",provider:"slashMenu.sections.provider",skills:"slashMenu.sections.skills",files:"slashMenu.sections.files","members-team":"slashMenu.sections.membersTeam","members-project":"slashMenu.sections.membersProject",threads:"slashMenu.sections.threads"},BD=pe(function(t){let{t:o}=z(),n=E(null),r=Co()?.data.threadReferences!==void 0,a=Co()?.data.memberMentions!==void 0;return fe(()=>{if(!t.activeItemId||!n.current)return;n.current.querySelector(`[data-composer-item-id="${CSS.escape(t.activeItemId)}"]`)?.scrollIntoView({block:"nearest"})},[t.activeItemId]),l(zu,{autoHighlight:!1,mode:"none",onItemHighlighted:s=>{t.onHighlightedItemChange(typeof s=="string"?s:null)},children:v("div",{ref:n,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>1&&t.items.every(s=>s.type==="plugin-slash-command"&&s.command.name===t.items[0].command.name)?l("p",{className:"px-5 pt-2 text-xs text-muted-foreground",children:o("slash.ambiguous",{command:t.items[0].command.name})}):null,t.items.length>0?l(Wu,{className:"max-h-72 scroll-pb-6",children:l(Ku,{children:t.items.map((s,i)=>l(ZW,{sectionTitle:s.section!==void 0&&t.items[i-1]?.section!==s.section?s.section:null,sectionLabel:s.type==="path"?s.sectionLabel:void 0,item:s,environmentId:t.environmentId,triggerKind:t.triggerKind,resolvedTheme:t.resolvedTheme,isActive:t.activeItemId===s.id,onHighlight:t.onHighlightedItemChange,onSelect:t.onSelect},s.id))})}):l("div",{className:"px-5 pt-3.5 pb-7",children:l("p",{className:"text-secondary-label text-xs",children:t.isLoading?FD(t.triggerKind)?o("composer.searchingSkills"):o("composer.searchingFiles"):FD(t.triggerKind)?o("composer.noSkillsFound"):t.triggerKind==="path"?o(a?"composer.noMatchingFilesThreadsOrMembers":r?"composer.noMatchingFilesOrThreads":"composer.noMatchingFiles"):o("composer.noMatchingCommand")})})]})})});function FD(e){return e==="skill"||e==="slash-skill"}var ZW=pe(function(t){let{t:o}=z(),n=Co()?.target,r=t.item.type==="skill"?gA(t.item.skill):null,a=t.triggerKind==="slash-command"&&t.item.type==="skill"?t.item.skill:null;return v(oe,{children:[t.sectionTitle!==null?l("div",{role:"presentation","data-composer-menu-section":t.sectionTitle,className:"px-3 pt-2 pb-1 text-xs text-secondary-label",children:t.sectionLabel??o(OD[t.sectionTitle]??OD.recent)}):null,v(qu,{value:t.item.id,"data-composer-item-id":t.item.id,className:V("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:s=>{s.preventDefault()},onClick:()=>{t.onSelect(t.item)},children:[t.item.type==="path"?l(Af,{pathValue:t.item.path,kind:t.item.pathKind,theme:t.resolvedTheme}):null,t.item.type==="thread"?l(gr,{"aria-hidden":"true",className:"size-4 shrink-0 text-secondary-label"}):null,t.item.type==="member"?l(yr,{"aria-hidden":"true",className:"size-4 shrink-0 text-secondary-label"}):null,v("span",{className:"flex min-w-0 flex-1 items-center gap-2",children:[l("span",{className:"min-w-0 max-w-[45%] shrink-0 truncate font-sans text-xs font-medium",children:a?v(oe,{children:[l("span",{className:"text-secondary-label",children:"/skill:"}),tn(a)]}):t.item.label}),l("span",{className:"min-w-0 max-w-[48ch] flex-1 truncate text-left text-secondary-label text-xs",children:t.item.description}),t.item.type==="plugin-slash-command"?l(Mo,{environmentId:t.environmentId??n?.environmentId??"",pluginId:t.item.pluginId}):null,t.item.type==="skill"&&t.item.skill.pluginId?l(Mo,{environmentId:t.environmentId??n?.environmentId??"",pluginId:t.item.skill.pluginId}):r?l(oG,{kind:r}):null]})]})]})}),eG={app:Fa,repo:zr,project:zr,personal:yr,system:md,other:sd},tG={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 oG(e){let{t}=z(),o=eG[e.kind];return v(jr,{className:"ms-auto",variant:"secondary",children:[l(o,{"aria-hidden":"true",className:"text-current"}),t(tG[e.kind])]})}$();function nG(e){let t=new Date(e);return Number.isNaN(t.getTime())?null:t}function HD(e,t){let o=nG(e);if(!o)return"";let n=Date.now()-o.getTime();if(n<0)return t("relativeTime.justNow");let r=Math.floor(n/1e3);if(r<60)return t("relativeTime.justNow");let a=Math.floor(r/60);if(a<60)return t("relativeTime.minutesAgo",{count:a});let s=Math.floor(a/60);return s<24?t("relativeTime.hoursAgo",{count:s}):t("relativeTime.daysAgo",{count:Math.floor(s/24)})}var UD=90;function $D(e){return e.droppedImageNames.length+(e.unreadableImageNames?.length??0)}function rG(e,t){let o=e.prompt.trim().replace(/\s+/g," ");if(o.length>0)return o.length>UD?`${o.slice(0,UD)}\u2026`:o;let n=e.attachments.length+e.droppedImageNames.length;return n>0?t("stash.imageCountLabel",{count:n}):t("stash.emptyEntry")}var zD=pe(function(t){let{entries:o,onRestore:n,onDelete:r,onClose:a}=t,{t:s}=z(),i=it(),d=E(null),[c,u]=q(o[0]?.id??null),m=o.find(p=>p.id===c)??o[0];return H(()=>{let p=f=>{let g=d.current;g&&f.composedPath().includes(g)||f.target instanceof Element&&f.target.closest('[data-prompt-stash-badge="true"]')||a()};return document.addEventListener("pointerdown",p,!0),()=>document.removeEventListener("pointerdown",p,!0)},[a]),H(()=>{o.length!==0&&(o.some(p=>p.id===c)||u(o[0]?.id??null))},[o,c]),i.pane.useKeydown(p=>{if(p.key==="Escape"){p.preventDefault(),p.stopPropagation(),a();return}if(p.key==="ArrowDown"||p.key==="ArrowUp"){if(o.length===0)return;p.preventDefault(),p.stopPropagation();let f=o.findIndex(x=>x.id===c),g=p.key==="ArrowDown"?1:-1,y=((f>=0?f:g===1?-1:0)+g+o.length)%o.length;u(o[y]?.id??null);return}if(p.key==="Enter"){if(p.target instanceof HTMLElement&&p.target.closest("button[aria-label]")||!m)return;p.preventDefault(),p.stopPropagation(),n(m);return}if(p.key==="Backspace"&&(p.metaKey||p.ctrlKey)){if(!m)return;p.preventDefault(),p.stopPropagation(),r(m)}},{capture:!0}),l(zu,{autoHighlight:!1,mode:"none",children:v("div",{ref:d,className:"chat-composer-drawer-surface chat-composer-drawer-attached relative w-full overflow-hidden","data-composer-stash-drawer":"true",children:[l("div",{className:"flex h-7 items-center justify-end px-2 pt-1",children:l(K,{variant:"ghost-muted",size:"icon-micro","aria-label":s("stash.closeLabel"),onPointerDown:p=>p.preventDefault(),onClick:a,children:l(dt,{className:"size-3"})})}),l(Wu,{className:"max-h-64 scroll-pb-6",children:l(Ku,{children:o.length===0?l("p",{className:"px-3 py-1.5 text-secondary-label text-xs",children:s("stash.empty")}):o.map(p=>v(qu,{value:p.id,className:V("group/stash relative cursor-[var(--control-cursor)] 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",c===p.id&&"bg-accent! text-accent-foreground!"),onMouseMove:()=>{c!==p.id&&u(p.id)},onMouseDown:f=>{f.preventDefault()},onClick:()=>{n(p)},children:[l("span",{className:"min-w-0 flex-1 truncate text-xs",children:rG(p,s)}),p.pendingImageCount?l("span",{className:"shrink-0 text-ui-sm text-secondary-label",children:s("stash.savingImage",{count:p.pendingImageCount})}):$D(p)>0?l("span",{className:"shrink-0 text-ui-sm text-warning-foreground",children:s("stash.imagesDropped",{count:$D(p)})}):null,p.attachments.length>0?l("span",{className:"flex shrink-0 items-center -space-x-1.5",children:p.attachments.slice(0,3).map(f=>l("img",{src:f.dataUrl,alt:"","aria-hidden":"true",className:"size-5 rounded border border-border/70 object-cover"},f.id))}):null,l("span",{className:"shrink-0 text-secondary-label text-xs max-sm:hidden",children:HD(p.createdAt,s)}),l(K,{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":s("stash.deleteLabel"),onClick:f=>{f.stopPropagation(),r(p)},children:l(dt,{className:"stroke-2"})})]},p.id))})})]})})});$();function aG(e,t){return e.bottom===t.bottom&&e.left===t.left&&e.maxHeight===t.maxHeight&&e.width===t.width&&e.overlap===t.overlap}function XC(e){let t=it(),o=bu(),n=t.pane.useActive(),[r,a]=q(null);return fe(()=>{if(!n)return;let s=e.anchor;if(!s){a(null);return}let i=!0,d=()=>{if(!i)return;let u=s.closest('[data-chat-composer-form="true"]'),p=(u?.querySelector('[data-chat-composer-main-surface="true"]')??u??s).getBoundingClientRect(),f=Number.parseFloat(window.getComputedStyle(document.documentElement).fontSize)||16,h=(Number.parseFloat(window.getComputedStyle(u??s).getPropertyValue("--chat-composer-drawer-inset"))||1.375)*f,y=f+1,x={bottom:window.innerHeight-p.top-y,left:p.left+h,maxHeight:Math.max(96,p.top-24+y),width:Math.max(0,p.width-h*2),overlap:y};a(C=>C&&aG(C,x)?C:x)};d(),window.addEventListener("resize",d),window.addEventListener("scroll",d,!0);let c=typeof ResizeObserver>"u"?null:new ResizeObserver(d);if(c){c.observe(s);for(let u=s.parentElement;u;u=u.parentElement)c.observe(u)}return()=>{i=!1,c?.disconnect(),window.removeEventListener("resize",d),window.removeEventListener("scroll",d,!0)}},[e.anchor,n]),!n||!r?null:t.createPortal(v("div",{className:o,"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:[l(sG,{}),e.children]}),document.body)}function sG(){return cN(),null}$();function iG(e){let t=wT(e);if(t===null)return"";let o=ui(t).visibleText;for(;;){let n=pi(o);if(!n.annotation)break;o=n.promptText}return o=Qa(o).promptText,mi(o).flatMap(n=>n.kind==="text"?[n.text]:[]).join("").trim()}function KD(e){let t=[];for(let o of e){let n=iG(o.text);n!==""&&(t.at(-1)?.prompt===n&&t.pop(),t.push({id:o.id,prompt:n}))}return t}function qD(e){let{direction:t,entries:o,position:n,draft:r}=e,a=-1;if(n!==null&&n.recalled===r&&(a=o.findIndex(i=>i.id===n.id),a<0&&(a=o.findLastIndex(i=>i.prompt===n.recalled))),a<0&&(t==="forward"||r!==""))return null;let s=t==="forward"?o[a+1]:o[(a<0?o.length:a)-1];return s!==void 0?{position:{id:s.id,recalled:s.prompt},prompt:s.prompt}:t==="forward"?{position:null,prompt:""}:null}function WD(e){let{documentKey:t,promptRef:o,editorRef:n,blocked:r,readSentMessages:a,show:s}=e,i=E(null);return(d,c)=>{if(r||c.shiftKey||c.altKey||c.metaKey||c.ctrlKey||c.isComposing||c.keyCode===229)return!1;let u=o.current,m=i.current,p=m?.documentKey===t?m.position:null,f=d==="ArrowUp"?"back":"forward";if(p?.recalled!==u&&(f==="forward"||u!=="")||n.current?.isCaretOnVisualEdge(f==="back"?"start":"end")!==!0)return!1;let g=qD({direction:f,entries:KD(a()),position:p,draft:u});return g===null?!1:(i.current=g.position===null?null:{documentKey:t,position:g.position},s(g.prompt),!0)}}$();function lG(e,t){let o=e.name.toLowerCase(),n=tn(e).toLowerCase(),r=e.shortDescription?.toLowerCase()??"",a=e.description?.toLowerCase()??"",s=e.scope?.toLowerCase()??"",i=[Fn({value:o,query:t,exactBase:0,prefixBase:2,boundaryBase:4,includesBase:6,fuzzyBase:100,boundaryMarkers:["-","_","/"]}),Fn({value:n,query:t,exactBase:1,prefixBase:3,boundaryBase:5,includesBase:7,fuzzyBase:110}),Fn({value:r,query:t,exactBase:20,prefixBase:22,boundaryBase:24,includesBase:26}),Fn({value:a,query:t,exactBase:30,prefixBase:32,boundaryBase:34,includesBase:36}),Fn({value:s,query:t,exactBase:40,prefixBase:42,includesBase:44})].filter(d=>d!==null);return i.length===0?null:Math.min(...i)}function GD(e,t,o=Number.POSITIVE_INFINITY){let n=e.filter(xr),r=qf(t,{trimLeadingPattern:/^\$+/});if(!r)return n;let a=[];for(let s of n){let i=lG(s,r);i!==null&&pN(a,{item:s,score:i,tieBreaker:`${tn(s).toLowerCase()}\0${s.name}`},o)}return a.map(s=>s.item)}var jD=[],VD=[],vl=Object.freeze({environmentId:"",threadId:""}),QD=e=>e.prompt,XD=e=>e.images.length>0||e.persistedAttachments.length>0||e.terminalContexts.length>0||e.elementContexts.length>0||e.browserAnnotations.length>0||e.reviewComments.length>0,dG=()=>[],YD=e=>dG,JD=(e,t)=>{let o=new Map(e.map(n=>[n.id,n]));return t.flatMap(n=>{let r=o.get(n);return r?[r]:[]})},ZD=(e,t)=>e.length===t.length&&e.every((o,n)=>o.id===t[n]);function YC(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 cG=1e4;function uG(e,t){if(t==="")return 0;let o=e.toLowerCase(),n=o.slice(o.lastIndexOf("/")+1),r=Fn({value:n,query:t,exactBase:0,prefixBase:100,boundaryBase:200,includesBase:300,fuzzyBase:400});return r!==null?r:Fn({value:o,query:t,exactBase:1e3,prefixBase:1100,boundaryBase:1200,includesBase:1300,fuzzyBase:1400})??cG}function e_(e){let t=qf(e.query),o=[];e.folders.forEach((a,s)=>{e.groups.find(d=>d.cwd===a.cwd)?.entries.forEach((d,c)=>{o.push({hit:{folder:a,entry:d},quality:uG(d.path,t),position:c,folderIndex:s})})});let n=o.toSorted((a,s)=>a.quality-s.quality||a.position-s.position||a.folderIndex-s.folderIndex).slice(0,Ox),r=[];for(let{hit:a}of n)r.includes(a.folder.id)||r.push(a.folder.id);return r.flatMap(a=>n.filter(({hit:s})=>s.folder.id===a).map(({hit:s})=>s))}function t_(e){return e.map(t=>({id:`member:${t.memberId}`,type:"member",candidate:t,label:t.name,description:[t.title,t.machineLabel].filter(o=>o!==null).join(" / "),section:t.inTeam?"members-team":"members-project"}))}var o_=(e,t,o)=>o.endsWith(" ")&&e[t]===" "?t+1:t,pG=Object.freeze([]),mG=Object.freeze([]),fG=()=>mG,gG=()=>pG,hG=Object.freeze([]),yG=Object.freeze([]),vG=()=>hG,CG=Object.freeze({groups:Object.freeze([]),isPending:!1}),xG=()=>CG,bG=(e,t)=>`${e.replace(/[\\/]+$/,"")}/${t}`;function Jc(e){return e===null?null:`${e.kind}:${e.rangeStart}:${e.rangeEnd}:${e.query}`}function r_({prompt:e,pluginCommands:t=[],onSelectPluginCommand:o,selectedProvider:n,selectedProviderStatus:r,planModeUiEnabled:a,showSkillsInSlashMenu:s,recentSlashCommandIds:i,environmentId:d,gitCwd:c,useComposerPathSearch:u,useComposerPathSearchAcross:m,readComposerSnapshot:p,applyPromptReplacement:f,onInteractionModeChange:g,onOpenModelPicker:h,onSlashCommandUsed:y}){let{t:x}=z(),C=Zn(),[b,L]=q(()=>Po(e,e.length)),[w,k]=q(null),[I,T]=q(null),[S,P]=q(null),A=w!==null&&Jc(b)===w?null:b,N=A?.kind==="path"?A.query:"",B=A?.kind==="path",O=Co(),j=(O?.data.useThreadFolders??vG)(O?.target??vl),U=j.length>1&&m!==void 0,D=W(()=>U&&B?j.map(me=>me.cwd):yG,[j,B,U]),J=u({environmentId:d,cwd:B&&!U?c:null,query:B&&!U?N:null}),G=(m??xG)({environmentId:d,cwds:D,query:D.length>0?N:null}),M=W(()=>D.length>0?e_({query:N,folders:j,groups:G.groups}):[],[G.groups,D,j,N]),X=U?G.isPending:J.isPending,F=O?.data.threadReferences,ee=(F?.useCandidates??gG)({target:O?.target??vl,query:B?N:null}),Y=O?.data.memberMentions,ae=(Y?.useCandidates??fG)({target:O?.target??vl,query:B?N:null}),te=W(()=>{if(!A)return[];if(A.kind==="path"){let me=ue=>ee.length>0||ae.length>0?{section:ue}:{},Me=U?M.map(({folder:ue,entry:ce})=>({id:`path:${ce.kind}:${ue.id}:${ce.path}`,type:"path",path:ce.path,linkPath:bG(ue.cwd,ce.path),pathKind:ce.kind,label:n_(ce.path),description:ce.path.slice(0,Math.max(0,ce.path.lastIndexOf("/"))),section:`folder:${ue.id}`,sectionLabel:ue.name})):J.entries.map(ue=>({id:`path:${ue.kind}:${ue.path}`,type:"path",path:ue.path,pathKind:ue.kind,label:n_(ue.path),description:ue.path.slice(0,Math.max(0,ue.path.lastIndexOf("/"))),...me("files")}));return[...t_(ae),...Me,...ee.map(ue=>({id:`thread:${ue.reference.environmentId}:${ue.reference.threadId}`,type:"thread",reference:ue.reference,label:C(ue.reference.title),description:[ue.projectLabel,ue.machineLabel].filter(ce=>ce!==null).join(" / "),...me("threads")}))]}if(A.kind==="slash-command"){let me=[{id:"slash:model",type:"slash-command",command:"model",label:"/model",description:x("composer.switchModelDesc")},...a?[{id:"slash:plan",type:"slash-command",command:"plan",label:"/plan",description:x("composer.planDesc")},{id:"slash:default",type:"slash-command",command:"default",label:"/default",description:x("composer.defaultDesc")}]:[]];return mN({builtIns:me,plugins:t,provider:n,commands:r?.slashCommands??[],skills:r?.skills??[],showSkills:s,query:A.query,recentIds:i,providerDescription:x("composer.runProviderCommand")})}if(A.kind==="skill"||A.kind==="slash-skill"){let me=A.kind==="skill"?r?.skills??[]:fA(r?.skills??[],s);return GD(me,A.query).map(Me=>({id:`skill:${n}:${Me.name}`,type:"skill",provider:n,skill:Me,label:tn(Me),description:Me.shortDescription??Me.description??""}))}return[]},[C,t,A,a,i,n,r,s,x,ee,ae,M,U,J.entries]),de=A!==null&&!(A.kind==="slash-skill"&&te.length===0),ge=A?`${A.kind}:${A.query.trim().toLowerCase()}`:null,ne=W(()=>{let me=YC({items:te,highlightedItemId:I,currentSearchKey:ge,highlightedSearchKey:S});return te.find(Me=>Me.id===me)??null},[te,I,ge,S]),Z=R(()=>{let me=p(),Me=Po(me.value,me.expandedCursor),ue=w!==null&&Jc(Me)===w?null:Me;return{snapshot:me,trigger:ue}},[p,w]),ve=R(me=>{let{snapshot:Me,trigger:ue}=Z();if(!ue)return;if((me.type==="slash-command"||me.type==="provider-slash-command"||me.type==="plugin-slash-command"||me.type==="skill")&&y?.(me.id),me.type==="path"||me.type==="thread"||me.type==="member"){let ze=me.type==="path"?Ls(me.linkPath??me.path):me.type==="thread"?F?.serialize(me.reference)??null:Y?.serialize(me.candidate)??null;if(ze===null)return;let et=`${ze} `,Et=o_(Me.value,ue.rangeEnd,et);f(ue.rangeStart,Et,et,{expectedText:Me.value.slice(ue.rangeStart,Et)})&&T(null);return}if(me.type==="slash-command"){if(me.command==="model"){f(ue.rangeStart,ue.rangeEnd,"",{expectedText:Me.value.slice(ue.rangeStart,ue.rangeEnd),focusEditorAfterReplace:!1})&&(T(null),h());return}g(me.command==="plan"?"plan":"default"),f(ue.rangeStart,ue.rangeEnd,"",{expectedText:Me.value.slice(ue.rangeStart,ue.rangeEnd)})&&T(null);return}let ce=me.type==="provider-slash-command"||me.type==="plugin-slash-command"?`/${me.command.name} `:`$${me.skill.name} `,Ze=o_(Me.value,ue.rangeEnd,ce);f(ue.rangeStart,Ze,ce,{expectedText:Me.value.slice(ue.rangeStart,Ze)})&&(T(null),me.type==="plugin-slash-command"&&o?.({pluginId:me.pluginId,name:me.command.name}))},[f,g,h,y,o,Z,F,Y]);H(()=>{if(!de){T(null),P(null);return}let me=YC({items:te,highlightedItemId:I,currentSearchKey:ge,highlightedSearchKey:S});T(Me=>Me===me?Me:me),P(Me=>Me===ge?Me:ge)},[I,S,te,de,ge]);let he=R(me=>{T(me),P(ge)},[ge]),Ae=R(()=>{let{trigger:me}=Z();return me===null||me.kind==="slash-skill"&&!de?!1:(k(Jc(me)),T(null),!0)},[de,Z]),De=R(me=>{k(Jc(Po(me,me.length))),L(null),T(null)},[]),je=R((me,Me)=>{let ue=en(me,Me),ce=Po(me,ue);L(ce);let Ze=Jc(ce);k(pt=>pt!==null&&pt!==Ze?null:pt),T(null),P(null)},[]),ot=R(()=>{T(null)},[]);return{composerTrigger:b,menuTrigger:A,composerMenuItems:te,composerMenuOpen:de,composerMenuSearchKey:ge,activeComposerMenuItem:ne,resolveActiveComposerTrigger:Z,onSelectComposerItem:ve,onComposerMenuItemHighlighted:he,onMenuEscape:Ae,resetForDocumentChange:je,dismissTrigger:ot,dismissTriggerIn:De,pathSearchPending:X,highlightedItemId:I,setTrigger:L,setHighlightedItemId:T,setHighlightedSearchKey:P}}function n_(e){let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t>=0?e.slice(t+1):e}$();function a_(e,t){let o=W(()=>cp((e??[]).filter(xr)),[e]);return R((n,r)=>{let a=Jw(n,r,o,hC);a!==null&&t(a.start,a.end,a.replacement,{expectedText:r.slice(a.start,a.end)})},[t,o])}var s_=pe(function(t){let{handleRef:o,api:n,composerDraftTarget:r,composerDocumentKey:a,promptRef:s,editorRef:i,menuAnchor:d,resolvedTheme:c,selectedProvider:u,selectedProviderStatus:m,planModeUiEnabled:p,showSkillsInSlashMenu:f,recentSlashCommandIds:g,environmentId:h,gitCwd:y,onSlashCommandUsed:x,onOpenModelPicker:C,onInteractionModeChange:b,onToggleInteractionMode:L,activePendingProgress:w,activePendingRequestId:k,hasPendingUserInputs:I,changeUserInputCustomAnswer:T,terminalContexts:S,showTerminalContexts:P,showEditor:A,isApprovalState:N,editorClassName:B,placeholder:O,disabled:j,onPaste:U,onSubmit:D,isMobileViewport:J,isDraftRoute:G,stashMenuOpen:M,stashEntries:X,onRestoreStashEntry:F,onDeleteStashEntry:ee,onCloseStashMenu:Y,onPromptEdited:ae,onUnclaimedEscape:te}=t,de=n.draft.useThreadDraftSelector(r,QD),ge=n.draft.useThreadDraftSelector(r,XD),ne=Co(),Z=(ne?.data.useSentMessagesReader??YD)(ne?.target??vl),ve=n.draft.useStore,he=ve(Ce=>Ce.setPrompt),Ae=ve(Ce=>Ce.setTerminalContexts),De=ve(Ce=>Ce.removeTerminalContext),je=uo(de,de.length),ot=_r(a,de,{cursor:je,expandedCursor:de.length}),[me,Me]=q(()=>({documentKey:a,cursor:ot.cursor})),ue=me.documentKey===a?me.cursor:ot.cursor,ce=R(Ce=>{Me(Ue=>{let rt=Ue.documentKey===a?Ue.cursor:_r(a,s.current).cursor,Lt=typeof Ce=="function"?Ce(rt):Ce,wt=s.current,Ot=en(wt,Lt);return sA(a,wt,Lt,Ot),Ue.documentKey===a&&Ue.cursor===Lt?Ue:{documentKey:a,cursor:Lt}})},[a,s]),Ze=E(!1),pt=E(!1),ze=E([]),et=E(null),Et=R(Ce=>{he(r,Ce)},[r,he]),ft=R((Ce,Ue,rt,Lt,wt)=>{T(Ce,Ue,rt,Lt,wt),s.current=Ue},[T,s]),Ct=R((Ce,Ue,rt,Lt)=>{let wt=s.current,Ot=Math.max(0,Math.min(wt.length,Ce)),Ro=Math.max(Ot,Math.min(wt.length,Ue));if(Lt?.expectedText!==void 0&&wt.slice(Ot,Ro)!==Lt.expectedText)return!1;let nn=ZM(s.current,Ce,Ue,rt),Fr=uo(nn.text,nn.cursor),ka=en(nn.text,Fr);s.current=nn.text;let As=w?.activeQuestion;return As&&I?ft(As.id,nn.text,Fr,ka,!1):Et(nn.text),ce(Fr),Qt(Po(nn.text,ka)),Lt?.focusEditorAfterReplace!==!1&&window.requestAnimationFrame(()=>{i.current?.focusAt(Fr)}),!0},[w?.activeQuestion,i,I,ft,s,ce,Et]),gt=R(()=>{let Ce=i.current?.readSnapshot();return Ce||{value:s.current,cursor:ue,expandedCursor:en(s.current,ue),terminalContextIds:S.map(Ue=>Ue.id)}},[ue,i,s,S]),Dt=(n.slashCommands?.useCommands??(()=>[]))(h,r),Mt=r_({pluginCommands:Dt,onSelectPluginCommand:Ce=>n.slashCommands?.select(r,Ce),prompt:de,selectedProvider:u,selectedProviderStatus:m,planModeUiEnabled:p,showSkillsInSlashMenu:f,recentSlashCommandIds:g,environmentId:h,gitCwd:y,useComposerPathSearch:n.pathSearch.useComposerPathSearch,useComposerPathSearchAcross:n.pathSearch.useComposerPathSearchAcross,readComposerSnapshot:gt,applyPromptReplacement:Ct,onInteractionModeChange:b,onOpenModelPicker:C,onSlashCommandUsed:x}),{composerTrigger:se,composerMenuItems:Le,composerMenuOpen:be,activeComposerMenuItem:Xe,resolveActiveComposerTrigger:xt,onComposerMenuItemHighlighted:tt,onMenuEscape:It,pathSearchPending:po,highlightedItemId:Ko,setTrigger:Qt,setHighlightedItemId:hn}=Mt,At=se?.kind??null,St=se?.kind==="path"?se.query:"",bt=w?w.customAnswer:de,mo=N?"":bt,kt=Mt.resetForDocumentChange;H(()=>{kt(bt,ue)},[a,kt,bt,ue]),pt.current=be,ze.current=Le,et.current=Xe;let _t=At==="path"&&St.length>0&&po===!0,Xt=R(Ce=>{let Ue=S.findIndex(wt=>wt.id===Ce);if(Ue<0)return;let rt=n.terminalContext.removeInlinePlaceholder(s.current,Ue);s.current=rt.prompt,Et(rt.prompt),De(r,Ce);let Lt=uo(rt.prompt,rt.cursor);ce(Lt),Qt(Po(rt.prompt,rt.cursor))},[n.terminalContext,r,s,De,ce,Et,S,Qt]);fe(()=>{s.current=de,ce(Ce=>ir(de,Ce))},[a,de,s,ce]),H(()=>{ae(de)},[ae,de]),H(()=>{be&&Y()},[be,Y]);let nt=E(null);H(()=>{let Ce=w?.customAnswer;if(typeof Ce!="string"){if(nt.current!==null){s.current=de;let Ro=uo(de,de.length);ce(Ro),Qt(Po(de,en(de,Ro)))}nt.current=null;return}let Ue=k,rt=w?.activeQuestion?.id??null,Lt=nt.current?.requestId!==Ue||nt.current?.questionId!==rt,wt=s.current!==Ce;if(nt.current={requestId:Ue,questionId:rt},!Lt&&!wt)return;s.current=Ce;let Ot=uo(Ce,Ce.length);ce(Ot),Qt(Po(Ce,en(Ce,Ot))),hn(null)},[w?.customAnswer,w?.activeQuestion?.id,k,de,s]);let lt=a_(m?.skills,Ct),Bt=R((Ce,Ue,rt,Lt,wt)=>{if(w?.activeQuestion&&I){if(w.activeQuestion.allowFreeform===!1)return;ce(Ue),Qt(Lt?null:Po(Ce,rt)),ft(w.activeQuestion.id,Ce,Ue,rt,Lt);return}let Ot=s.current;s.current=Ce,Et(Ce),ZD(S,wt)||Ae(r,JD(S,wt)),ce(Ue),Qt(Lt?null:Po(Ce,rt)),n.slashCommands?.readBinding(r)||lt(Ot,Ce)},[w?.activeQuestion,lt,I,ft,s,ce,Et,r,S,Ae,Qt]),Ht=Mt.onSelectComposerItem,Yt=R(Ce=>{Ze.current||(Ze.current=!0,window.requestAnimationFrame(()=>{Ze.current=!1}),Ht(Ce))},[Ht]),qo=R(Ce=>{if(Le.length===0)return;let Ue=Le.findIndex(Ro=>Ro.id===Ko),wt=((Ue>=0?Ue:Ce==="ArrowDown"?-1:0)+(Ce==="ArrowDown"?1:-1)+Le.length)%Le.length,Ot=Le[wt];hn(Ot?.id??null)},[Ko,Le,hn]),fo=Mt.dismissTriggerIn,go=R(Ce=>{s.current=Ce,Et(Ce),ce(uo(Ce,Ce.length)),fo(Ce)},[fo,s,ce,Et]),Jt=WD({documentKey:a,promptRef:s,editorRef:i,blocked:ge||I||N||j||M,readSentMessages:Z,show:go}),Un=(Ce,Ue)=>{if(Ce==="Escape")return Ue.isComposing||Ue.keyCode===229?!1:It()||(te?.()??!1);if(Ce==="Tab"&&Ue.shiftKey)return p?(L(),!0):!1;if((Ce==="ArrowUp"||Ce==="ArrowDown")&&Jt(Ce,Ue))return!0;let{trigger:rt}=xt();if(pt.current||rt!==null){let Ot=ze.current,Ro=et.current??Ot[0];if(Ce==="ArrowDown"&&Ot.length>0)return qo("ArrowDown"),!0;if(Ce==="ArrowUp"&&Ot.length>0)return qo("ArrowUp"),!0;if((Ce==="Enter"||Ce==="Tab")&&Ro)return Yt(Ro),!0}let wt=Ce==="Enter"?QM({isMobileViewport:J,shiftKey:Ue.shiftKey,modifierKey:Ue.metaKey||Ue.ctrlKey,isDraftThread:G}):null;return wt?(D(void 0,wt),!0):!1};return pr(o,()=>({readSnapshot:gt,readDraftPrompt:()=>de,applyPromptReplacement:Ct,syncCursor:(Ce,Ue)=>{ce(Ce),Qt(Ue)},resetCursorState:Ce=>{let Ue=Ce?.prompt??s.current,rt=ir(Ue,Ce?.cursor??0);hn(null),ce(rt),Qt(Ce?.detectTrigger?Po(Ue,en(Ue,rt)):null)}}),[Ct,de,s,gt,ce,hn,Qt]),v(oe,{children:[M&&!be&&!N&&l(XC,{anchor:d,children:l(zD,{entries:X,onRestore:F,onDelete:ee,onClose:Y})}),be&&!N&&l(XC,{anchor:d,children:l(BD,{environmentId:h,items:Le,resolvedTheme:c,isLoading:_t,triggerKind:At,activeItemId:Xe?.id??null,onHighlightedItemChange:tt,onSelect:Yt})}),A?l(ul,{editorRef:i,documentKey:a,value:mo,cursor:ue,terminalContexts:P?S:jD,skills:m?.skills??VD,...B?{className:B}:{},onRemoveTerminalContext:Xt,onChange:Bt,onCommandKeyDown:Un,onPaste:U,placeholder:O,disabled:j}):null]})});function i_({message:e}){return e?l("p",{role:"alert",className:"px-3 pb-2 text-xs text-destructive-foreground sm:px-4","data-chat-composer-validation":"prompt-length",children:e}):null}function l_(e){let{t}=z(),{message:o,agentNotChosen:n,agentUnavailable:r,agentUnavailableNoChoice:a,modelSendBlock:s,selectedModelStatus:i,modelNotes:d,onChooseModel:c}=e;return v(oe,{children:[l(i_,{message:o}),n?l("p",{role:"status",className:"px-3 pb-2 text-xs text-muted-foreground sm:px-4","data-chat-composer-agent-not-chosen":"true",children:t("composer.agentNotChosen")}):null,r?l("p",{role:"status",className:"px-3 pb-2 text-xs text-warning sm:px-4","data-chat-composer-agent-unavailable":"true",children:t(a?"composer.agentUnavailableNoChoice":"composer.agentUnavailable")}):null,d.map(u=>l("p",{role:"status",className:"px-3 pb-2 text-xs text-muted-foreground sm:px-4","data-chat-composer-model-note":u.kind,children:aD(t,u)},`${u.kind}:${u.kind==="option-unsupported"?u.optionId:""}`)),s===null?null:v("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":i,children:[t(s.blockKey),s.canChooseModel?l(K,{type:"button",size:"sm",variant:"ghost",className:"h-6 px-2 text-xs","data-chat-composer-choose-model":"true",onClick:()=>{c()},children:t("composer.chooseModel")}):null]})]})}function d_(e){let{t}=z(),o=HC();return!e.eligible||o==="unsupported"?null:l("p",{className:"px-3 pb-2 text-xs text-muted-foreground sm:px-4","data-chat-composer-group-send":"true","data-chat-composer-group-send-state":o,children:t(o==="ready"?"composer.groupSendHint":o==="error"?"composer.groupSendRosterFailed":"composer.groupSendRosterWaiting")})}function c_(e){let{t}=z();if(!e.mode)return null;let o=e.unavailableReason??t(e.isMobileViewport?"composer.shellCommand.touchHint":"composer.shellCommand.hint");return v("div",{"data-composer-shell-command-mode":"true",className:"flex min-w-0 items-start gap-1.5 px-1 pb-1 text-xs",children:[l(Qo,{"aria-hidden":"true",className:"mt-0.5 size-3.5 shrink-0 text-primary"}),l("span",{className:"shrink-0 font-medium text-primary",children:t("composer.shellCommand.mode")}),l("span",{className:"min-w-0 flex-1 wrap-break-word text-muted-foreground",children:o})]})}var wG=[];function u_(e){let{t}=z(),{props:o,model:n,status:r,submit:a,badges:s,traits:i,composerDraft:d}=e,c=e.pendingUserInputs.length>0,u=W(()=>e.composerImages.filter(b=>Tn(b)==="image"),[e.composerImages]),m=W(()=>new Set(e.nonPersistedComposerImageIds),[e.nonPersistedComposerImageIds]),p=e.isMobileViewport&&!e.isComposerCollapsedMobile&&e.pendingPrimaryAction!==null,f=r.phase==="running"&&!e.pluginAction||r.isSendBusy||r.projectSelectionRequired||r.environmentUnavailable!==null||!d.hasSendableContent,g=!e.isComposerCollapsedMobile&&!e.isComposerApprovalState,h=jf({activeThreadId:r.activeThread?.id??null,isLocalDraftThread:o.routeKind==="draft",isComposerApprovalState:e.isComposerApprovalState,hasPendingProgress:e.activePendingProgress!==null,hasPendingAction:e.pendingPrimaryAction!==null,shellCommandMode:a.shellCommandMode}),y=CD({machineUnavailable:r.environmentUnavailable!==null,sessionStarted:r.activeThread?.session!=null,sessionDisconnected:r.phase==="disconnected"}),x=xD(y),C=bD({t,tailPlaceholderKey:x,isComposerApprovalState:e.isComposerApprovalState,activePendingProgress:e.activePendingProgress!==null,showPlanFollowUpPrompt:e.showPlanFollowUpPrompt,projectSelectionRequired:r.projectSelectionRequired,noProviderAvailable:n.noProviderAvailable});return l("div",{"data-chat-composer-main-surface":"true",className:"group relative z-10 rounded-composer p-px transition-colors duration-200",children:v("div",{ref:e.surfaceRef,"data-chat-composer-surface":"true","data-chat-composer-mobile-collapsed":e.isComposerCollapsedMobile?"true":"false",className:V("rounded-[20px] transition-[background-color] duration-200",e.isDragOverComposer?"bg-accent/45 ring-1 ring-primary/70":null,r.projectSelectionRequired?"opacity-75":null),children:[o.firstRow?l("div",{className:"@container/composer-first-row flex select-none items-center gap-2 px-3 pt-2 sm:px-4","data-conversation-card-first-row":!0,"data-chat-composer-collapsed-controls":"true",children:o.firstRow}):null,l(fD,{decisionOccupiesComposer:e.isComposerApprovalState}),e.showCollapsedMobilePromptRow?l(_D,{pluginAction:e.pluginAction,api:o.api,composerDraftTarget:o.composerDraftTarget,pendingCustomAnswer:e.activePendingProgress?e.activePendingProgress.customAnswer:null,noProviderAvailable:n.noProviderAvailable,groupSendEligible:h,modelSendDisabledReason:n.sendDisabledReason,groupSendDisabledReason:r.groupSendDisabledReason,environmentUnavailable:r.environmentUnavailable!==null,projectSelectionRequired:r.projectSelectionRequired,onExpand:e.expandMobileComposer,inlineTasksBadge:s.inlineTasksBadge,inlineStashBadge:s.inlineStashBadge,submitDisabled:f,submitLabel:t("composer.sendMessage"),onSubmit:()=>a.submitComposerOrShellCommand()}):null,l(TG,{input:e,pendingUserInputs:c,showMobilePendingAnswerActions:p,composerPreviewableImages:u,nonPersistedComposerImageIdSet:m,composerPlaceholder:C}),l(l_,{message:e.providerInputSubmissionError??a.composerSubmissionError,agentNotChosen:r.agentNotChosen,agentUnavailable:n.agentUnavailable,agentUnavailableNoChoice:n.agentUnavailableNoChoice,modelSendBlock:n.modelSendBlock,selectedModelStatus:n.selectedModelStatus,modelNotes:n.modelNotes,onChooseModel:e.openModelPicker}),l(d_,{eligible:h}),g?l(DD,{pluginAction:e.pluginAction,isComposerFooterCompact:e.isComposerFooterCompact,isComposerPrimaryActionsCompact:e.isComposerPrimaryActionsCompact,isMobileViewport:e.isMobileViewport,showMobilePendingAnswerActions:p,hasPendingUserInputs:c,projectSelectionRequired:r.projectSelectionRequired,noProviderAvailable:n.noProviderAvailable,composerAttachmentInputRef:e.composerAttachmentInputRef,onComposerAttachmentInputChange:e.onComposerAttachmentInputChange,slots:o.slots,selectedInstanceId:n.selectedInstanceId,unavailableAgentInstanceId:r.unavailableAgentInstanceId,agentNotChosen:r.agentNotChosen,agentUnavailable:n.agentUnavailable,providerInstanceEntries:n.providerInstanceEntries,lockedProvider:r.lockedProvider,lockedContinuationGroupKey:n.lockedContinuationGroupKey,onAgentInstanceChange:n.onAgentInstanceChange,selectedModelForPickerWithCustomFallback:n.selectedModelForPickerWithCustomFallback,selectedModelStatus:n.selectedModelStatus,selectedModelUnconfirmed:n.selectedModelUnconfirmed,keybindings:o.keybindings,modelOptionsByInstance:n.modelOptionsByInstance,terminalOpen:o.terminalOpen,isComposerModelPickerOpen:e.isComposerModelPickerOpen,setIsComposerModelPickerOpen:e.setIsComposerModelPickerOpen,getModelDisabledReason:o.getModelDisabledReason,getModelContinuationLabel:o.getModelContinuationLabel,onContinueInModel:o.onContinueInModel,onProviderModelSelect:o.onProviderModelSelect,environmentId:o.environmentId,routeKind:o.routeKind,draftId:o.draftId,activeThread:r.activeThread,interactionMode:r.interactionMode,runtimeMode:r.runtimeMode,composerProviderControls:n.composerProviderControls,composerNativeMode:n.composerNativeMode,canSwitchNativeMode:n.canSwitchNativeMode,providerTraitsMenuContent:i.providerTraitsMenuContent,providerTraitsPicker:i.providerTraitsPicker,toggleInteractionMode:o.toggleInteractionMode,handleRuntimeModeChange:o.handleRuntimeModeChange,handleComposerNativeModeChange:n.handleComposerNativeModeChange,inlineTasksBadge:s.inlineTasksBadge,inlineStashBadge:s.inlineStashBadge,activeThreadModelDisplayName:n.activeThreadModelDisplayName,pendingPrimaryAction:e.pendingPrimaryAction,phase:r.phase,continuationChecking:r.continuationChecking,showPlanFollowUpPrompt:e.showPlanFollowUpPrompt,composerDraft:d,isSendBusy:r.isSendBusy,sendDisabledReason:n.sendDisabledReason,groupSendDisabledReason:r.groupSendDisabledReason,groupSendEligible:h,environmentUnavailable:r.environmentUnavailable,handleInterruptPrimaryAction:e.actions.handleInterruptPrimaryAction,interruptArmed:r.interruptArmed,stopping:r.stopping,handleImplementPlanInNewThreadPrimaryAction:e.actions.handleImplementPlanInNewThreadPrimaryAction,shellCommandMode:a.shellCommandMode,shellCommandUnavailableReason:a.hostShellCommand?.unavailableReason??null,compactDisabled:e.compactDisabled,resolvedCompactDisabledReason:n.resolvedCompactDisabledReason,compactThreadContext:e.compactThreadContext}):null]})})}function TG(e){let{input:t,pendingUserInputs:o,showMobilePendingAnswerActions:n}=e,{props:r,model:a,status:s,submit:i,stash:d,composerDraft:c}=t,u=t.activePendingProgress?.activeQuestion?.allowFreeform===!1;return v("div",{ref:t.setComposerMenuAnchor,className:V("relative px-3 pb-2 sm:px-4","pt-3.5 sm:pt-4",t.isComposerApprovalState&&"pb-3 sm:pb-4",t.isComposerCollapsedMobile&&"hidden"),children:[l(vD,{api:r.api,environmentId:r.environmentId,composerDraftTarget:r.composerDraftTarget,isComposerCollapsedMobile:t.isComposerCollapsedMobile,isComposerApprovalState:t.isComposerApprovalState,hasPendingUserInputs:o,supportsAttachmentUploads:r.supportsAttachmentUploads,uploadsByImageId:t.uploadsByImageId,composerImages:t.composerImages,composerPreviewableImages:e.composerPreviewableImages,composerBrowserAnnotations:c.browserAnnotations,composerReviewComments:c.reviewComments,composerElementContexts:c.elementContexts,nonPersistedComposerImageIdSet:e.nonPersistedComposerImageIdSet,removeComposerDraftBrowserAnnotation:t.removeComposerDraftBrowserAnnotation,removeComposerDraftReviewComment:t.removeComposerDraftReviewComment,removeComposerDraftElementContext:t.removeComposerDraftElementContext,removeComposerImage:t.removeComposerImage,onExpandImage:r.onExpandImage}),l(c_,{mode:i.shellCommandMode,isMobileViewport:t.isMobileViewport,unavailableReason:i.hostShellCommand?.unavailableReason??null}),v("div",{className:"relative",children:[l(s_,{handleRef:t.promptInputRef,api:r.api,composerDraftTarget:r.composerDraftTarget,composerDocumentKey:t.composerDocumentKey,promptRef:r.promptRef,editorRef:t.composerEditorRef,menuAnchor:t.composerMenuAnchor,resolvedTheme:r.resolvedTheme,selectedProvider:a.selectedProvider,selectedProviderStatus:a.selectedProviderStatus,planModeUiEnabled:a.planModeUiEnabled,showSkillsInSlashMenu:r.settings.showSkillsInSlashMenu,recentSlashCommandIds:r.recentSlashCommandIds??wG,environmentId:r.environmentId,gitCwd:r.gitCwd,onSlashCommandUsed:r.onSlashCommandUsed,onOpenModelPicker:t.openModelPicker,onInteractionModeChange:t.switchInteractionMode,onToggleInteractionMode:r.toggleInteractionMode,activePendingProgress:t.activePendingProgress,activePendingRequestId:t.pendingUserInputs[0]?.requestId??null,hasPendingUserInputs:o,changeUserInputCustomAnswer:t.changeUserInputCustomAnswer,terminalContexts:c.terminalContexts,showTerminalContexts:!t.isComposerApprovalState&&!o,showEditor:!u,isApprovalState:t.isComposerApprovalState,editorClassName:n?"max-sm:pb-11":void 0,placeholder:e.composerPlaceholder,disabled:t.isComposerApprovalState||s.projectSelectionRequired,onPaste:t.handleComposerPaste,onSubmit:t.handleComposerSubmit,isMobileViewport:t.isMobileViewport,isDraftRoute:r.routeKind==="draft",stashMenuOpen:t.isStashMenuOpen,stashEntries:d.stashQueue,onRestoreStashEntry:d.restoreStashEntry,onDeleteStashEntry:d.deleteStashEntry,onCloseStashMenu:d.closeStashMenu,onPromptEdited:t.onPromptEdited,onUnclaimedEscape:t.handleUnclaimedEscape}),n?l(IG,{input:t}):null]})]})}function IG(e){let{input:t}=e,{model:o,status:n,badges:r}=t;return v("div",{"data-chat-composer-mobile-pending-actions":"true",className:"absolute bottom-0 right-0 flex items-center justify-end gap-1",children:[r.inlineTasksBadge,r.inlineStashBadge,l(gl,{compact:!0,pendingAction:t.pendingPrimaryAction,isRunning:!1,showPlanFollowUpPrompt:!1,promptHasText:!1,isSendBusy:n.isSendBusy,sendDisabledReason:o.sendDisabledReason,isEnvironmentUnavailable:n.environmentUnavailable!==null||o.noProviderAvailable||n.projectSelectionRequired,hasSendableContent:!1,preserveComposerFocusOnPointerDown:!0,onInterrupt:t.actions.handleInterruptPrimaryAction,interruptArmed:n.interruptArmed,stopping:n.stopping,onImplementPlanInNewThread:t.actions.handleImplementPlanInNewThreadPrimaryAction})]})}function p_(e){let{formRef:t,onSubmit:o,onFocusCapture:n,onBlurCapture:r,dragHandlers:a,onDragLeaveCapture:s,badges:i,stashQueueLength:d,isStashMenuOpen:c,stashPulse:u,toggleStashMenu:m,drawers:p,children:f}=e;return v("form",{ref:t,onSubmit:o,onFocusCapture:n,onBlurCapture:r,onDragEnterCapture:a.onDragEnter,onDragOverCapture:a.onDragOver,onDragLeaveCapture:s,onDropCapture:a.onDrop,className:V("mx-auto w-full min-w-0 max-w-3xl",i.hasShoulderTab&&"pt-7"),"data-chat-composer-form":"true",children:[p,v("div",{className:"relative",children:[i.showShoulderTabs&&i.visibleTasksProgress&&i.visibleTaskSteps?l(Jf,{expanded:!1,hasTrailingShoulder:d>0,onDismiss:i.dismissTasks,onToggle:i.toggleTasksDrawer,progress:i.visibleTasksProgress,steps:i.visibleTaskSteps}):null,i.showShoulderTabs?l(Yf,{count:d,menuOpen:c,pulseKey:u.key,pulsing:u.active,onToggleMenu:m}):null,f]})]})}function m_(e){let{t}=z(),n=(e.activePendingProgress?.activeQuestion?.multiSelect??!1)||(e.pendingPrimaryAction?.isLastQuestion??!1);return l("div",{className:"px-3 pb-3 sm:px-4",children:v("div",{"data-chat-composer-mobile-pending-compact":"true",className:V("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:l("button",{type:"button",className:V("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:r=>r.preventDefault(),onClick:e.expandMobileComposer,"aria-label":t("composer.writeCustomAnswer"),children:e.activePendingProgress?.customAnswer||t("composer.writeCustomAnswer")}),e.inlineTasksBadge,e.inlineStashBadge,n?l(gl,{compact:!0,pendingAction:e.pendingPrimaryAction,isRunning:!1,showPlanFollowUpPrompt:!1,promptHasText:!1,isSendBusy:e.isSendBusy,sendDisabledReason:e.sendDisabledReason,isEnvironmentUnavailable:e.isEnvironmentUnavailable,hasSendableContent:!1,preserveComposerFocusOnPointerDown:!0,onInterrupt:e.handleInterruptPrimaryAction,onImplementPlanInNewThread:e.handleImplementPlanInNewThreadPrimaryAction}):null]})})}var f_={accept:0,acceptForSession:1,acceptAlways:2,decline:3,cancel:4};function g_(e){return e.map((t,o)=>({option:t,index:o})).toSorted((t,o)=>f_[t.option.decision]-f_[o.option.decision]||t.index-o.index).map(t=>t.option)}function h_(e){return{leading:e.filter(t=>t.decision==="cancel"),trailing:e.filter(t=>t.decision!=="cancel").toReversed()}}function y_(e){return[...e.filter(t=>t.tone!=="primary"),...e.filter(t=>t.tone==="primary")]}$();var SG=2e3,kG="min-h-8 max-w-full py-1.5 whitespace-normal text-start pointer-coarse:min-h-11 pointer-coarse:min-w-11",LG=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 PG(e,t){if(e.displayKind!=="standard")return e.label;switch(e.decision){case"cancel":return t("composer.cancel");case"decline":return t("composer.decline");case"acceptForSession":return t("composer.alwaysAllowSession");case"acceptAlways":return t("composer.alwaysAllow");case"accept":return t("composer.approve");default:return e.label}}function RG(e,t){let o=[];return t<9&&o.push(String(t+1)),e==="accept"&&o.push("Enter"),e==="cancel"&&o.push("Escape"),o.length>0?o.join(" "):void 0}var eg=pe(function({requestId:t,isResponding:o,options:n,keybindings:r,declineReasonRelay:a,shortcuts:s=!0,onRespondToApproval:i}){let{t:d}=z(),c=g_(n??LG(d)),u=it(),m=(a==="native"||a==="queued")&&c.some(T=>T.decision==="decline"),[p,f]=q(!1),[g,h]=q(""),y=E([]);H(()=>{h(""),f(!1)},[t]);let x=R(T=>{let S=T==="decline"?g.trim():"";i(t,T,S.length>0?S:void 0)},[g,i,t]),C=R(T=>{if(T==="decline"&&m&&!p){f(!0);return}x(T)},[m,p,x]),b=R(T=>{let S=y.current.filter(N=>N!==null);if(S.length===0)return;let P=S.findIndex(N=>N===document.activeElement),A=P===-1?T===1?0:S.length-1:(P+T+S.length)%S.length;S[A]?.focus()},[]);if(u.pane.useKeydown(T=>{if(!s||o||T.defaultPrevented||u.terminalFocus.getOwner()!==null||T.isComposing||T.keyCode===229||T.key==="Enter"&&!T.metaKey&&!T.ctrlKey&&!T.altKey&&!T.shiftKey&&sS(T.target))return;let S=er(T.target);if(r&&(!S||T.metaKey||T.ctrlKey||T.altKey)){let N=u.keybindings.approvalDecisionFromCommand(u.keybindings.resolveShortcutCommand(T,r));if(N!==null&&c.some(B=>B.decision===N)){T.preventDefault(),x(N);return}}if(S)return;let P=iS(T,c);if(P===null)return;if(T.preventDefault(),P.type==="move"){b(P.delta);return}let A=c[P.index];A&&C(A.decision)},{target:"document"}),p)return v("div",{className:"flex w-full min-w-0 flex-col gap-1.5",children:[v("div",{className:"flex min-w-0 items-center gap-1",children:[l(Vr,{type:"text",value:g,autoFocus:!0,disabled:o,maxLength:SG,placeholder:d("approval.declineReasonPlaceholder"),"aria-label":d("approval.declineReasonLabel"),"data-approval-decline-reason":"true",className:"h-8 min-w-0 flex-1 pointer-coarse:min-h-11",onChange:T=>h(T.target.value),onKeyDown:T=>{if(!(T.nativeEvent.isComposing||T.nativeEvent.keyCode===229)){if(T.key==="Enter"){T.preventDefault(),x("decline");return}T.key==="Escape"&&(T.preventDefault(),g.length>0?h(""):f(!1))}}}),l(K,{size:"sm",variant:"ghost",className:"text-muted-foreground hover:text-foreground",disabled:o,onClick:()=>f(!1),children:d("approval.actions.back")}),l(K,{size:"sm","data-approval-decision":"decline",disabled:o,onClick:()=>x("decline"),children:d("composer.decline")})]}),a==="queued"?l("p",{className:"text-chat-row text-muted-foreground",children:d("approval.declineReasonQueuedNote")}):null]});let{leading:L,trailing:w}=h_(c),k=[...L,...w];y.current.length=k.length;let I=T=>{let S=c.indexOf(T),P=k.indexOf(T),A=s&&S<9?S+1:null,N=T.decision==="accept";return v(K,{ref:B=>{y.current[P]=B},size:"sm",variant:N?"default":"ghost",style:{height:"auto"},"data-approval-decision":T.decision,"aria-keyshortcuts":s?RG(T.decision,S):void 0,className:V(kG,!N&&"text-muted-foreground hover:text-foreground"),disabled:o,onClick:()=>C(T.decision),children:[l("span",{className:"min-w-0 wrap-anywhere",children:PG(T,d)}),A===null?null:l(oi,{className:Ci,children:A})]},T.decision)};return v("div",{className:"flex w-full min-w-0 flex-wrap items-center gap-1",children:[L.map(I),l("span",{className:"flex-1"}),w.map(I)]})});$();function C_(e){let t=e.content;if(t===void 0)return null;if(t.kind==="unified")return t.diff.length>0?t.diff:null;let o=v_(t.oldText??""),n=v_(t.newText);if(o.length===0&&n.length===0)return null;let r=`--- a/${e.path}
3571
+ ${F.prompt}`:F.prompt,de=te!==ae;if(de&&(r.current=te,c(d,te),a.current?.syncCursor(uo(te,te.length),null)),F.attachments.length>0){let ne=new Set(i.current.map(Ae=>Ae.id)),Z=new Set(i.current.map(Ae=>`${Ae.mimeType}\0${Ae.sizeBytes}\0${Ae.name}`)),ve=F.attachments.filter(Ae=>!ne.has(Ae.id)&&!Z.has(`${Ae.mimeType}\0${Ae.sizeBytes}\0${Ae.name}`)),he=t.draft.hydrateImagesFromPersisted(ve);he.length>0&&u(d,he)}let ge=[];F.droppedImageNames.length>0&&ge.push(o("composer.stashImagesTooLarge",{names:F.droppedImageNames.join(", ")})),F.unreadableImageNames&&F.unreadableImageNames.length>0&&ge.push(o("composer.stashImagesUnreadable",{names:F.unreadableImageNames.join(", ")})),ge.length>0&&t.notify.warning(o("composer.someImagesNotRestored"),ge.join(" ")),de&&window.requestAnimationFrame(()=>{s.current?.focusAtEnd()})},[u,d,i,r,c,o,B]),D=R(F=>{let{durable:ee}=B(F.id);ee||t.notify.warning(o("composer.stashEntryMayReturn"),o("composer.storageRejectedDelete"))},[o,B]),J=R(async()=>{let F=r.current.split(mr).join("").trim(),ee=[...i.current];if(F.length===0&&ee.length===0){p(de=>!de);return}let Y=`${OC(d)}\0${F}\0${ee.map(de=>de.id).join(",")}`;if(S.current.has(Y))return;S.current.add(Y);let ae=d,te=Es();try{let{evicted:de,written:ge,durable:ne}=N({id:te,createdAt:new Date().toISOString(),prompt:F,attachments:[],droppedImageNames:[],unreadableImageNames:[],pendingImageCount:ee.length});if(!ge){t.notify.error(o("composer.couldNotStash"),o("composer.storageRejectedWrite"));return}ne||t.notify.warning(o("composer.stashNotSurvive"),o("composer.storageUnavailableMemory")),r.current="",m(ae);for(let me of ee)t.uploads.release(me.id);a.current?.syncCursor(0,null),j(),de&&t.notify.warning(o("composer.oldestStashDiscarded"),o("composer.oldestStashDiscardedDetail",{count:t.stash.maxEntries}));let Z=[],ve=[],he=[];for(let me of ee){let Me=await t.imageCompression.compressForStash(me.file);if(!Me.ok){(Me.reason==="too-large"?ve:he).push(me.name);continue}Z.push({id:me.id,name:me.name,mimeType:Me.image.mimeType,sizeBytes:Me.image.sizeBytes,dataUrl:Me.image.dataUrl})}let{kept:Ae,droppedNames:De}=t.stash.partitionAttachments(Z),{attached:je,durable:ot}=O(te,{attachments:Ae,droppedImageNames:[...ve,...De],unreadableImageNames:he});je?!ot&&ne&&ee.length>0&&t.notify.warning(o("composer.stashImagesNotSaved"),o("composer.stashImagesMissingOnReload")):Ae.length>0&&t.notify.warning(o("composer.stashImagesDidNotAttach"),o("composer.stashImagesDidNotAttachDetail",{count:Ae.length}))}finally{S.current.delete(Y)}},[m,d,i,O,r,j,N,o]),G=R(()=>{p(F=>!F)},[]),M=R(()=>{if(g){h(),p(!0);return}G()},[h,g,G]),X=R(()=>{p(!1)},[]);return t.pane.useKeydown(F=>{if(t.keybindings.resolveShortcutCommand(F,y,{context:{terminalFocus:t.terminalFocus.getOwner()!==null,terminalOpen:x,modelPickerOpen:C}})==="composer.stash"&&(F.preventDefault(),F.stopPropagation(),!t.commandPalette.isOpen())){if(b&&!L){p(Y=>!Y);return}L||w||k||J()}},{capture:!0}),{stashQueue:A,restoreStashEntry:U,deleteStashEntry:D,toggleStashMenu:G,toggleInlineStashMenu:M,closeStashMenu:X}}$();function zW(e,t,o){return{...Kg({id:Es(),name:t.name||e.t("attachments.defaultFileName"),mimeType:t.type||"application/octet-stream",sizeBytes:t.size,...o?{source:o}:{}}),previewUrl:URL.createObjectURL(t),file:t}}async function _N(e,t,o){let{t:n,supportsAttachmentUploads:r,inlineAttachmentMaxBytes:a}=e;if(!e.activeThreadId||t.length===0)return;if(e.answerQuestionsFirst){e.notifyError(n("attachments.answerQuestionsFirst"));return}let s=e.activeThreadId,i=e.attachmentDocumentKey,d=e.pendingCompressions,c=d.get(i)??0,u=[],m=null;for(let p of t){if(p.size<=0){m=n("attachments.empty",{name:p.name});continue}u.push(p)}if(e.setThreadError(s,m),u.length!==0){d.set(i,c+u.length);try{let p=[],f=null;for(let g of u){let h=await e.imageCompression.prepareFileForAttachment(g,e.attachmentUploadsCapabilityKnown&&!r?a:Number.POSITIVE_INFINITY);if(!h.ok){let x=e.imageCompression.attachmentPreparationError(h,g.name);f=n(x.key,x.values);continue}if(h.kind!=="image"){p.push(zW(e,h.file,h.kind==="file"?o?.source:void 0));continue}let y=h.file;p.push({...Kg({id:Es(),name:y.name||n("attachments.defaultImageName"),mimeType:y.type,sizeBytes:y.size}),previewUrl:URL.createObjectURL(y),file:y})}p.length===1&&p[0]?e.addImage(p[0]):p.length>1&&e.addImages(p),f!==null&&e.setThreadError(s,f)}finally{let p=(d.get(i)??0)-u.length;p>0?d.set(i,p):d.delete(i)}}}function ON(e){let{api:t,t:o,limits:n,setThreadError:r,activeThreadId:a,answerQuestionsFirst:s,attachmentTarget:i,attachmentDocumentKey:d,supportsAttachmentUploads:c,attachmentUploadsCapabilityKnown:u,pendingImageCompressionsRef:m,addComposerDraftImage:p,addComposerDraftImages:f,removeComposerDraftImage:g}=e,h=R(w=>{p(i,w)},[i,p]),y=R(w=>{f(i,w)},[i,f]),x=R(w=>{t.uploads.release(w),g(i,w)},[t.uploads,i,g]),C=(w,k)=>_N({activeThreadId:a,answerQuestionsFirst:s,notifyError:I=>t.notify.error(I),t:o,setThreadError:r,attachmentDocumentKey:d,pendingCompressions:m.current,supportsAttachmentUploads:c,attachmentUploadsCapabilityKnown:u,inlineAttachmentMaxBytes:n.inlineAttachmentMaxBytes,imageCompression:t.imageCompression,addImage:h,addImages:y},w,k);return{addComposerImages:C,removeComposerImage:w=>{x(w)},onComposerAttachmentInputChange:w=>{let k=Array.from(w.target.files??[]);w.target.value="",k.length!==0&&C(k)}}}$();var FN=e=>({images:e.images,nonPersistedImageIds:e.nonPersistedImageIds});function KW(e){let{supported:t,attachments:o,environmentId:n,threadId:r,requestId:a,question:s,responding:i}=e,d=s?.id,c=s?.allowFreeform;return W(()=>t&&a!==null&&d!==void 0&&c!==!1&&!i&&r?o.questionDraftTarget({environmentId:n,threadId:r,requestId:a,questionId:d}):null,[c,o,n,d,a,i,t,r])}function BN(e){let t=KW(e),o=t??e.composerDraftTarget,n=t?[e.environmentId,e.composerDraftTarget,"question",t].join("\0"):[e.environmentId,e.composerDraftTarget].join("\0");return{questionAttachmentTarget:t,attachmentTarget:o,attachmentDocumentKey:n}}$();function HN(e,t){let o=On.indexOf(e);if(o===-1)return On[0];let n=(o+t+On.length)%On.length;return On[n]??On[0]}function UN(e){let{composerRef:t,sendContextRef:o,api:n,t:r,limits:a,composerData:s,refs:i,composerDraftTarget:d,activeThread:c,addComposerImages:u,addDroppedFolders:m,focusComposer:p,insertComposerTextAtEnd:f,insertComposerDraftTerminalContext:g,composerBrowserAnnotations:h,composerReviewComments:y,isComposerApprovalState:x,pendingUserInputCount:C,projectSelectionRequired:b,noProviderAvailable:L,modelState:w,handleRuntimeModeChange:k,runtimeMode:I,setIsComposerModelPickerOpen:T,setProviderInputSubmissionError:S}=e,{composerEditorRef:P,promptInputRef:A,promptRef:N,composerImagesRef:B,composerTerminalContextsRef:O,composerElementContextsRef:j}=i,{selectedModel:U,selectedModelOptionsForDispatch:D,selectedModelSelection:J,selectedModelStatus:G,selectedNativeModeId:M,selectedProvider:X,selectedProviderEntry:F,selectedProviderModels:ee,composerNativeMode:Y,canSwitchNativeMode:ae,handleComposerNativeModeChange:te}=w,de=R(()=>A.current?.readSnapshot()??{value:N.current,cursor:uo(N.current,N.current.length),expandedCursor:N.current.length,terminalContextIds:O.current.map(ne=>ne.id)},[O,N]),ge=()=>({prompt:N.current,slashSources:{builtIns:["model",...w.planModeUiEnabled?["plan","default"]:[]],skills:w.selectedProviderStatus?.skills??[],commands:w.selectedProviderStatus?.slashCommands??[]},images:B.current,terminalContexts:O.current,elementContexts:j.current,browserAnnotations:h,reviewComments:y,selectedModelOptionsForDispatch:D,selectedModelSelection:J,...M?{selectedNativeModeId:M}:{},providerAvailable:F!==void 0,selectedProvider:X,selectedModel:U,selectedModelStatus:G,selectedProviderModels:ee});o.current=ge,pr(t,()=>({focusAtEnd:()=>{P.current?.focusAtEnd()},focusAt:Z=>{P.current?.focusAt(Z)},addDroppedFiles:Z=>{u(Z),p()},addDroppedFolders:Z=>{m(Z),p()},insertTextAtEnd:f,toggleModelPicker:()=>{T(Z=>!Z)},cyclePermissionMode:Z=>{if(Y===null){k(HN(I,Z));return}let{modes:ve,current:he}=Y;if(!ae||ve.length<2)return;let Ae=ve.findIndex(je=>je.id===he.id),De=ve[(Ae+Z+ve.length)%ve.length];De!==void 0&&te(De.id)},readSnapshot:de,resetCursorState:Z=>{A.current?.resetCursorState(Z)},addTerminalContext:Z=>{if(!c)return;let ve=de(),he=n.terminalContext.insertInlinePlaceholder(ve.value,ve.expandedCursor),Ae=uo(he.prompt,he.cursor);g(d,he.prompt,{id:Es(),threadId:c.id,createdAt:new Date().toISOString(),...Z},he.contextIndex)&&(N.current=he.prompt,A.current?.syncCursor(Ae,Po(he.prompt,he.cursor)),window.requestAnimationFrame(()=>{P.current?.focusAt(Ae)}))},readSendIdentity:()=>({prompt:N.current}),getSendContext:ge,validateProviderInput:Z=>{let ve=RC({prompt:N.current,providerInput:s.assistantQuotes.expandForProvider(Z),submissionTarget:"provider-turn",maxInputChars:a.maxInputChars,t:r});return S(ve),ve===null}}),[c,u,d,g,N,B,O,j,h,y,p,x,C,b,de,U,D,J,M,L,X,ee,s,ge,o,a.maxInputChars,Y,ae,te,k,I,r])}$();function $N(e){let{composerImages:t,composerImagesRef:o,composerTerminalContexts:n,composerTerminalContextsRef:r,composerElementContexts:a,composerElementContextsRef:s}=e;fe(()=>{o.current=t},[t,o]),fe(()=>{r.current=n},[n,r]),fe(()=>{s.current=a},[a,s])}$();var qW=['[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 WW(e){return e.closest(qW)!==null}function zN(e){let{isMobileViewport:t,forceExpandedOnMobile:o,composerEditorRef:n,composerSurfaceRef:r,composerFormRef:a}=e,[s,i]=q(!1),d=t&&!o&&!s,c=E(null),u=E(null),m=E(null),p=E(!1),f=R(()=>{if(!t)return;c.current!==null&&(window.cancelAnimationFrame(c.current),c.current=null);let x=document.activeElement;x instanceof HTMLElement&&x.blur(),i(!1)},[t]),g=R(()=>{c.current!==null&&(window.cancelAnimationFrame(c.current),c.current=null),u.current!==null&&window.cancelAnimationFrame(u.current),m.current!==null&&window.cancelAnimationFrame(m.current),p.current=!0,i(!0),u.current=window.requestAnimationFrame(()=>{u.current=null,n.current?.focusAtEnd(),m.current=window.requestAnimationFrame(()=>{m.current=null,p.current=!1})})},[]),h=R(()=>{t&&(p.current||(c.current!==null&&window.cancelAnimationFrame(c.current),c.current=window.requestAnimationFrame(()=>{if(c.current=null,p.current)return;let x=r.current,C=a.current,b=document.activeElement;b instanceof Element&&WW(b)||b instanceof Node&&(x&&x.contains(b)||C&&C.contains(b))||i(!1)})))},[t]);return H(()=>()=>{c.current!==null&&window.cancelAnimationFrame(c.current),u.current!==null&&window.cancelAnimationFrame(u.current),m.current!==null&&window.cancelAnimationFrame(m.current)},[]),{isComposerCollapsedMobile:d,blurMobileComposerAfterSend:f,expandMobileComposer:g,scheduleComposerCollapseCheck:h,handleFormFocusCapture:x=>{let C=x.target;d&&C instanceof HTMLElement&&C.closest('[data-chat-composer-collapsed-controls="true"]')||(c.current!==null&&(window.cancelAnimationFrame(c.current),c.current=null),i(!0))}}}$();function KN(e){let{t,threadId:o,setThreadError:n,promptRef:r,promptInputRef:a,respondToApproval:s,respondToDecision:i,selectUserInputOption:d,activePendingProgress:c,activePendingIsResponding:u,activePendingResolvedAnswers:m}=e,p=W(()=>c?{questionIndex:c.questionIndex,isLastQuestion:c.isLastQuestion,canAdvance:c.canAdvance,isResponding:u,isComplete:!!m}:null,[u,c,m]),f=R((y,x)=>{d(y,x),r.current="",a.current?.resetCursorState({cursor:0})},[r,d]),g=R(async(y,x,C)=>{try{await s(y,x,C)}catch(b){n(o,b instanceof Error?b.message:t("approval.respondFailed"))}},[o,s,n,t]),h=R((y,x)=>i(y,x).then(C=>{C!==null&&n(o,C)}),[o,i,n]);return{pendingPrimaryAction:p,onSelectActivePendingUserInputOption:f,onRespondToApproval:g,onRespondToComposerDecision:h}}$();function qN(e){return e.startsWith("!")}function WN(e){return e.slice(1).trim()}function GN(e){return e.length===0?"empty":/[\r\n]/.test(e)?"multiline":null}function GW(){return null}function jN(){let{data:e,target:t,threadKey:o}=Ho();return(e.useShellCommand??GW)({target:t,threadKey:o})}$();function jf(e){return e.activeThreadId!==null&&!e.isLocalDraftThread&&!e.isComposerApprovalState&&!e.hasPendingProgress&&!e.hasPendingAction&&!e.shellCommandMode}function Vf(e,t,o){return e&&t!==void 0?t:o}function Qf(e){let t=e.environmentUnavailable?e.labels.environmentDisconnected:e.projectSelectionRequired?e.labels.chooseProjectToStart:e.pluginAction?null:e.noProviderAvailable&&!e.groupSend?e.labels.enableProviderToSend:Vf(e.groupSend,e.groupSendDisabledReason,e.sendDisabledReason);return{disabled:t!==null,reason:t}}function VN({promptRef:e,maxInputChars:t,noProviderAvailable:o,sendDisabledReason:n,groupSendDisabledReason:r,isGroupSend:a,isModelSendBlocked:s,onModelSendBlocked:i,onDispatched:d,activeThreadId:c,activePendingProgress:u,composerDocumentKey:m,pendingImageCompressionsRef:p,onSend:f,onStillCompressing:g,shouldBlurMobileComposerOnSubmit:h,blurMobileComposerAfterSend:y}){let{t:x}=z(),[C,b]=q(null),[L,w]=q(!1),k=E(0);H(()=>{k.current+=1,b(null),w(!1)},[m]),H(()=>{n===null&&w(!1)},[n]);let I=R(S=>{b(P=>P===null?P:jc(S,t,x))},[t,x]),T=R((S,P="foreground")=>{let A=a();if(o&&!A){S?.preventDefault();return}if(Vf(A,r,n)!==null){S?.preventDefault(),w(!0);return}if(s&&!A){S?.preventDefault(),i();return}if(c&&(p.current.get(m)??0)>0){S?.preventDefault(),g();return}let B=k.current,O=UA({prompt:e.current,submissionTarget:u?"pending-user-input":"provider-turn",maxInputChars:t,t:x,event:S,onSend:U=>f(U,P)}),j=U=>{B===k.current&&(b(U.validationMessage),U.didDispatch&&(d(),h()&&y()))};if(HA(O))return O.then(j);j(O)},[u,c,y,m,s,a,r,t,o,i,d,f,g,p,e,n,h,x]);return{composerSubmissionError:C??(L?Vf(a(),r,n):null),setComposerSubmissionError:b,revalidatePromptLength:I,submitComposer:T}}function QN(e){let{api:t,t:o,limits:n,composerDraftTarget:r,composerDraft:a,composerDocumentKey:s,promptRef:i,promptInputRef:d,pendingImageCompressionsRef:c,setComposerDraftPrompt:u,setModelSendBlockShown:m,onSend:p,onCompactContext:f,blurMobileComposerAfterSend:g,isMobileViewport:h,isComposerApprovalState:y,activePendingApproval:x,activePendingProgress:C,activePendingResolvedAnswers:b,pendingUserInputCount:L,activeThreadId:w,phase:k,isSendBusy:I,environmentUnavailable:T,compactDisabled:S,noProviderAvailable:P,isSendDisabled:A,sendDisabledReason:N,groupSendDisabledReason:B,isGroupSend:O,isModelSendBlocked:j,showPlanFollowUpPrompt:U}=e,D=!e.pluginAction&&P,J=!e.pluginAction&&A,G=e.pluginAction?null:N,M=!e.pluginAction&&j,X=jN(),F=t.draft.useThreadDraftSelector(r,De=>qN(De.prompt)),ee=X!==null&&F&&!y&&C===null,Y=R(()=>!h||I||J||D||T!==null||k==="running"?!1:C?C.isLastQuestion&&!!b:U||a.hasSendableContent,[C,b,a.hasSendableContent,T,h,I,J,D,k,U]),{composerSubmissionError:ae,setComposerSubmissionError:te,revalidatePromptLength:de,submitComposer:ge}=VN({promptRef:i,maxInputChars:n.maxInputChars,noProviderAvailable:D,sendDisabledReason:G,groupSendDisabledReason:B,isGroupSend:O,isModelSendBlocked:M,onModelSendBlocked:()=>{m(!0)},onDispatched:()=>{m(!1)},activeThreadId:w,activePendingProgress:C,composerDocumentKey:s,pendingImageCompressionsRef:c,onSend:p,onStillCompressing:()=>{t.notify.info(o("composer.stillCompressing"),o("composer.sendAgainThumbnail"))},shouldBlurMobileComposerOnSubmit:Y,blurMobileComposerAfterSend:g}),ne=E(!1),Z=R(De=>{if(De?.preventDefault(),X===null||ne.current)return;if(X.unavailableReason!==null){te(X.unavailableReason);return}let je=i.current,ot=WN(je),me=GN(ot);if(me==="empty")return;if(me==="multiline"){te(o("composer.shellCommand.singleLine"));return}te(null),ne.current=!0;let Me=r;X.run(ot).then(ue=>{!ue||i.current!==je||(i.current="",u(Me,""),d.current?.syncCursor(0,null))}).finally(()=>{ne.current=!1})},[r,X,i,u,te,o]),ve=R((De,je)=>{if(ee){Z(De);return}ge(De,je)},[Z,ee,ge]),he=R(()=>{if(!ee)return!1;let De=i.current.slice(1);return i.current=De,u(r,De),d.current?.resetCursorState({prompt:De,cursor:De.length}),!0},[r,i,u,ee]),Ae=R(()=>{S||D||x!==null||L>0||k==="running"||I||!w||f()},[x,w,S,I,D,f,L,k]);return{composerSubmissionError:ae,revalidatePromptLength:de,submitComposerOrShellCommand:ve,exitShellCommandMode:he,compactThreadContext:Ae,hostShellCommand:X,shellCommandMode:ee}}$();function HC(){let e=it(),{data:t,target:o}=Ho(),n=e.draft.useThreadDraftSelector(o,a=>a.prompt),r=t.memberMentions?.useMatches({target:o,text:n.trim()});return r===void 0||r.status==="ready"&&r.matches.length===0?"unsupported":r.status}function jW(){return HC()==="ready"}function Xf(e){let t=jW();return e&&t}function XN(e){return R(()=>jf({activeThreadId:e.activeThreadId,isLocalDraftThread:e.isLocalDraftThread,isComposerApprovalState:e.isComposerApprovalState,hasPendingProgress:e.hasPendingProgress,hasPendingAction:e.hasPendingAction,shellCommandMode:!1})&&(e.memberMentions?.collect(e.target,e.promptRef.current.trim()).length??0)>0,[e.activeThreadId,e.isLocalDraftThread,e.isComposerApprovalState,e.hasPendingProgress,e.hasPendingAction,e.memberMentions,e.target,e.promptRef])}$();$();var Yf=pe(function(t){let{t:o}=z();if(t.count===0)return null;let n=t.placement==="inline",r=l("span",{className:V("text-ui-2xs font-medium 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 n?v(K,{size:"micro",variant:"ghost-muted","data-prompt-stash-badge":"true","aria-label":o("stash.ariaLabel",{count:t.count}),"aria-expanded":t.menuOpen,className:V("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:[l($s,{className:"size-3 shrink-0","aria-hidden":"true"}),r]}):v("button",{type:"button","data-prompt-stash-badge":"true","aria-label":o("stash.ariaLabel",{count:t.count}),"aria-expanded":t.menuOpen,className:V("chat-composer-shoulder-tab chat-composer-stash-tab absolute -top-7 right-4 z-0 inline-flex h-8 cursor-[var(--control-cursor)] 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:[l($s,{className:"size-3 shrink-0","aria-hidden":"true"}),o("stash.label"),r]})});$();function JN(e){let t=new Map;return e.map(o=>{let n=t.get(o.step)??0;return t.set(o.step,n+1),{key:`${o.step}:${n}`,step:o}})}function YN({className:e,steps:t}){return t.length<=1?null:l("span",{"aria-hidden":!0,className:V("flex w-10 shrink-0 items-center gap-0.5",e),children:JN(t).map(({key:o,step:n})=>l("span",{className:V("h-[3px] min-w-0 flex-1 rounded-full",n.status==="completed"?"bg-success":n.status==="inProgress"?"bg-primary":"bg-muted-foreground/25")},o))})}var Jf=pe(function({expanded:t,hasTrailingShoulder:o=!1,onDismiss:n,onToggle:r,placement:a="tab",progress:s,steps:i}){let{t:d}=z();if(s.totalSteps<=0)return null;let c=s.completedSteps>=s.totalSteps,u=d("tasksBadge.ariaLabel",{completed:s.completedSteps,total:s.totalSteps,step:s.step});return a==="inline"?v("span",{className:"inline-flex shrink-0 items-center gap-0.5","data-composer-tasks-badge":"true",children:[v(K,{size:"micro",variant:"ghost-muted","aria-expanded":t,"aria-label":u,className:"shrink-0 gap-1 px-1.5",onClick:r,onPointerDown:m=>m.preventDefault(),children:[l(Ua,{"aria-hidden":!0,className:"size-3 shrink-0"}),l("span",{children:d("tasksBadge.label")}),l(YN,{steps:i}),v("span",{className:V("font-medium tabular-nums",c?"text-success":"text-muted-foreground"),children:[s.completedSteps,"/",s.totalSteps]})]}),l(K,{size:"icon-micro",variant:"ghost-muted","aria-label":d("tasksBadge.dismissLabel"),className:"shrink-0",onClick:n,onPointerDown:m=>m.preventDefault(),children:l(dt,{"aria-hidden":!0,className:"size-2.5"})})]}):v("div",{className:V("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",o?"right-28":"right-4",c&&"text-foreground"),"data-composer-tasks-badge":"true",children:[v("button",{type:"button","aria-expanded":t,"aria-label":u,className:"flex min-w-0 flex-1 cursor-[var(--control-cursor)] items-center gap-2 self-stretch text-muted-foreground hover:text-foreground",onClick:r,onPointerDown:m=>m.preventDefault(),children:[l(Ua,{"aria-hidden":!0,className:"size-icon-1 shrink-0"}),l("span",{className:"shrink-0",children:d("tasksBadge.label")}),l("span",{className:"min-w-0 flex-1 truncate text-left font-medium text-foreground/80","data-composer-task-current":"true",children:s.step}),v("span",{className:V("shrink-0 font-medium tabular-nums",c?"text-success":"text-muted-foreground"),children:[s.completedSteps,"/",s.totalSteps]}),l(YN,{className:"w-20",steps:i})]}),l(K,{size:"icon-micro",variant:"ghost-muted","aria-label":d("tasksBadge.dismissLabel"),className:"shrink-0",onClick:n,onPointerDown:m=>m.preventDefault(),children:l(dt,{"aria-hidden":!0,className:"size-3"})})]})}),ZN=pe(function({onDismiss:t,onCollapse:o,progress:n,steps:r}){let{t:a}=z(),{formatDuration:s}=_o();return v("div",{className:"chat-composer-top-drawer","data-chat-composer-tasks-drawer":"true",children:[v("div",{className:"flex items-center gap-1 px-3 py-1.5 sm:px-4",children:[v("button",{type:"button","aria-expanded":"true",className:"flex min-w-0 flex-1 cursor-[var(--control-cursor)] items-center gap-2 self-stretch text-left text-xs text-muted-foreground hover:text-foreground",onClick:o,onPointerDown:i=>i.preventDefault(),children:[l(Ua,{"aria-hidden":!0,className:"size-icon-1 shrink-0"}),l("span",{className:"font-medium text-foreground",children:a("tasksBadge.label")}),v("span",{className:"tabular-nums",children:[n.completedSteps,"/",n.totalSteps]})]}),l(K,{size:"icon-micro",variant:"ghost-muted","aria-label":a("tasksBadge.dismissLabel"),className:"shrink-0",onClick:t,onPointerDown:i=>i.preventDefault(),children:l(dt,{"aria-hidden":!0,className:"size-3"})})]}),l("div",{className:"space-y-px px-3 pb-4 sm:px-4",role:"list",children:JN(r).map(({key:i,step:d})=>v("div",{className:"flex items-baseline gap-2 text-xs leading-5",role:"listitem",children:[l("span",{"aria-hidden":!0,className:V("w-3 shrink-0 text-center font-mono text-ui-2xs",d.status==="completed"?"text-success":d.status==="inProgress"?"text-primary":"text-muted-foreground/40"),children:d.status==="completed"?"\u2713":d.status==="inProgress"?"\u25CF":"\u25CB"}),l("span",{className:V("min-w-0 flex-1",d.status==="completed"?"text-muted-foreground/55":d.status==="inProgress"?"text-foreground/90":"text-muted-foreground/70"),children:d.step}),l("span",{className:"ml-auto w-10 shrink-0 text-right text-ui-2xs text-muted-foreground/45 tabular-nums","data-composer-task-duration":"true",children:d.durationMs!==void 0?s(d.durationMs):d.status==="inProgress"?a("tasksBadge.now"):null})]},i))})]})});function eD(e){let{activeThreadId:t,activeThread:o,activeTasksProgress:n,activeTaskSteps:r,isTasksDrawerOpen:a,setIsTasksDrawerOpen:s,dismissedTasksTurnId:i,setDismissedTasksTurnId:d,stashQueue:c,isStashMenuOpen:u,stashPulse:m,toggleInlineStashMenu:p,isComposerApprovalState:f,externalDrawerAttached:g,showComposerTopDrawer:h,isComposerCollapsedMobile:y,hasBlockingComposerTopDrawer:x}=e,C=R(()=>{s(O=>!O)},[]),b=o?.latestTurn?.turnId??null,L=b!==null&&i===b,w=L?null:n,k=L?null:r,I=R(()=>{b!==null&&d(b),s(!1)},[b]),S=c.length>0&&!f&&(g||h||a||y)?l(Yf,{count:c.length,menuOpen:u,placement:"inline",pulseKey:m.key,pulsing:m.active,onToggleMenu:p}):null,A=w!==null&&k!==null&&!a&&!x&&(g||h||y)?l(Jf,{expanded:!1,onDismiss:I,onToggle:C,placement:"inline",progress:w,steps:k}):null,N=!g&&!h&&!a&&!y,B=N&&(c.length>0||w!==null&&k!==null&&w.totalSteps>0);return H(()=>{(w===null||k===null)&&s(!1)},[k,w]),H(()=>{x&&s(!1)},[x]),H(()=>{s(!1)},[t]),{toggleTasksDrawer:C,dismissTasks:I,visibleTasksProgress:w,visibleTaskSteps:k,inlineStashBadge:S,inlineTasksBadge:A,showShoulderTabs:N,hasShoulderTab:B}}$();function tD(e,t){if(!e)return null;let o=t.get(e.instanceId)?.find(n=>n.slug===e.model);return o?AT(o):e.model}function oD(e,t,o){return typeof o=="number"&&o>0?e("contextWindow.compactsAtThreshold",{threshold:o.toLocaleString()}):t?e("contextWindow.compactsForModel",{model:t}):e("contextWindow.compactsWhenNeeded")}$();function UC(e,t){if(!e)return t("composer.agentPickerLabel");let o=e.agentName?.trim(),n=e.displayName.trim();return o?!n||n===o?o:`${o} (${n})`:n}function $C(e,t){return e.filter(o=>_d(o)&&yp(o,t))}var zC=pe(function(t){let{t:o}=z(),n=t.instanceEntries.filter(_d),r=t.unavailableInstanceId??null,a=r===null?null:t.instanceEntries.find(h=>h.instanceId===r)??null,s=t.notChosen===!0&&r===null,i=r!==null||s?null:n.find(h=>h.instanceId===t.activeInstanceId)??null,d=t.lockedProvider!=null&&t.lockedProvider.length>0,c=$C(t.instanceEntries,t),u=c.some(h=>h.instanceId!==t.activeInstanceId),m=t.disabled||!d?null:r!==null?c.length===0?o("composer.agentUnavailableNoChoice"):null:u?null:o("composer.agentSwitchUnavailable"),p=ho(),f=V("min-w-0 justify-between whitespace-nowrap",t.compact?"max-w-36 shrink-0":"max-w-44 shrink"),g=v(oe,{children:[r!==null?l(eo,{"aria-hidden":"true",className:"size-4 shrink-0 text-warning"}):s?null:i?l(js,{driver:i.driverKind,displayName:i.displayName,accentColor:i.accentColor,className:"size-4",iconClassName:"size-4",indicatorBackground:"var(--contrast-input)"}):null,r!==null?v("span",{className:"min-w-0 truncate text-warning","data-composer-agent-unavailable":"true",children:[a===null?o("composer.agentUnknown"):UC(a,o)," ",o("composer.agentUnavailableBadge")]}):s?l("span",{className:"min-w-0 truncate","data-composer-agent-not-chosen":"true",children:o("composer.agentChoosePlaceholder")}):l("span",{className:"min-w-0 truncate",children:UC(i,o)})]});return m!==null?v(Pe,{children:[v(Ee,{render:l(Vn,{"aria-label":o("composer.agentPickerLabel"),"aria-describedby":p,"data-composer-agent-picker":"true",softDisabled:!0,className:f}),children:[g,l("span",{id:p,className:"sr-only",children:m})]}),l(Re,{side:"top",align:"start",className:"max-w-80 leading-snug",children:m})]}):v(Ao,{children:[v(Do,{render:l(Vn,{"aria-label":o("composer.agentPickerLabel"),"data-composer-agent-picker":"true",disabled:t.disabled||c.length===0,className:f}),children:[g,l(Mu,{})]}),l(No,{align:"start",children:l(Yr,{value:r!==null||s?"":t.activeInstanceId,onValueChange:h=>{!h||r===null&&!s&&h===t.activeInstanceId||t.onInstanceChange(h)},children:c.map(h=>l(Yn,{value:h.instanceId,children:v("span",{className:"flex min-w-0 items-center gap-2",children:[l(js,{driver:h.driverKind,displayName:h.displayName,accentColor:h.accentColor,className:"size-4",iconClassName:"size-4"}),l("span",{className:"min-w-0 truncate",children:UC(h,o)})]})},h.instanceId))})})]})});function nD(e){return l(zC,{...e})}function rD(e){return e.submissionTarget==="provider-turn"&&e.status!=="known"}function aD(e){if(!e.blockedOnSend||e.submissionTarget!=="provider-turn")return null;switch(e.status){case"probing":return{blockKey:"composer.modelFetching",canChooseModel:!1};case"missing":return{blockKey:"composer.modelMissing",canChooseModel:!0};case"unavailable":return{blockKey:"composer.modelUnavailable",canChooseModel:!0};default:return{blockKey:"composer.modelReady",canChooseModel:!1}}}function sD(e){return(e?.hints??[]).filter(t=>t.kind==="model-replaced"||t.kind==="option-unsupported"||t.kind==="effort-moved")}function KC(e,t){if(typeof t=="boolean")return e(t?"traits.on":"traits.off");if(t===void 0)return"";let o=FT(t);return o===void 0?t:e(`traits.optionValue.${o}`)}function iD(e,t){switch(t.kind){case"model-replaced":return t.to===null?e("modelNote.replacedNoDefault",{from:t.from}):e("modelNote.replaced",{from:t.from,to:t.to});case"option-unsupported":return e("modelNote.optionUnsupported",{option:UT(e,t.optionId),value:KC(e,t.stored)});case"effort-moved":return e("modelNote.effortMoved",{from:KC(e,t.from),to:KC(e,t.to)})}}function lD(e){if(e===null||"blocked"in e.dispatch)return;let t=e.dispatch.options;return t.length>0?t:void 0}$();function dD(e){let{threadId:t,isLocalDraftThread:o,selection:n,selectionsEqual:r,onChosen:a}=e,s=E(null);H(()=>{let i=s.current,d=n.model.trim()===""?null:n;if(i===null||i.threadId!==t){s.current={threadId:t,selection:d};return}d!==null&&(s.current={threadId:t,selection:d},!(o||i.selection===null)&&(r(i.selection,d)||a?.(d)))},[t,o,n,r,a])}$();function cD(e){let{api:t,providerStatus:o,instanceId:n,environmentId:r,cwd:a,threadId:s}=e,i=t.providerInventory.useWorkspaceInventory({environmentId:r,instanceId:n,cwd:a,threadId:s});return W(()=>o===null||i===null?o:{...o,slashCommands:i.slashCommands,skills:i.skills},[o,i])}function uD(e){let{api:t,t:o,settings:n,composerDraft:r,composerDraftTarget:a,environmentId:s,gitCwd:i,routeKind:d,threadId:c,activeThread:u,isLocalDraftThread:m,unavailableAgentInstanceId:p,agentNotChosen:f,runtimeMode:g,lockedProvider:h,providerStatuses:y,projectId:x,activeProjectDefaultModelSelection:C,activeThreadModelSelection:b,actualModel:L,compactDisabledReason:w,externalSendDisabledReason:k,attachmentBlockReason:I,answeringQuestion:T,setComposerDraftNativeMode:S,handleNativeModeChange:P,onProviderInstanceSelect:A,onModelSelectionChosen:N}=e,B=W(()=>HT(t.model.applyInstanceSettings(t.model.deriveInstanceEntries(y),n)),[t.model,y,n]),O=r.activeProvider??null,j=u?.session?.providerInstanceId??b?.instanceId??C?.instanceId??null,D=BT(B,O??j)??t.model.makeDriverKind("unconfigured"),J=h??D,G=W(()=>{if(!h||!u)return null;let tt=u.session?.providerInstanceId??b?.instanceId;return tt?B.find(It=>It.instanceId===tt)?.continuationGroupKey??null:null},[u,b?.instanceId,h,B]),M=W(()=>{if(p!==null)return p;let tt=[r.activeProvider,u?.session?.providerInstanceId,b?.instanceId,C?.instanceId];for(let It of tt){if(!It)continue;let po=B.find(Ko=>Ko.instanceId===It&&_d(Ko));if(po&&yp(po,{lockedProvider:h,lockedContinuationGroupKey:G}))return po.instanceId}return t.model.noProviderSelection.instanceId},[C?.instanceId,u?.session?.providerInstanceId,b?.instanceId,r.activeProvider,G,h,B,p]),X=p!==null,F=W(()=>X||f?void 0:B.find(tt=>tt.instanceId===M),[f,X,B,M]),ee=F===void 0&&!X&&!f,Y=X&&$C(B,{lockedProvider:h,lockedContinuationGroupKey:G}).length===0,ae=w??(ee?o("composer.compactingUnavailable"):null),te=F?.driverKind??J,{modelOptions:de,selectedModel:ge,selectedModelStatus:ne,choice:Z}=t.draft.useEffectiveModelState({threadRef:a,providers:y,selectedProvider:te,selectedInstanceId:M,threadModelSelection:b,projectModelSelection:C,settings:n,purpose:m?"create":"display",actualModel:L}),ve=W(()=>F?.snapshot??null,[F]),he=cD({api:t,providerStatus:ve,instanceId:F?.instanceId??null,environmentId:s,cwd:i,threadId:d==="server"?c:null}),Ae=W(()=>F?.models??[],[F]),De=W(()=>lD(Z),[Z]),je=W(()=>sD(Z),[Z]),ot=Z?.selected.kind==="model"&&Z.selected.unconfirmed,me=n.planModeEnabled,Me=W(()=>({showInteractionModeToggle:me&&t.model.getInteractionModeToggle(y,te),runtimeModeSwitch:he?.runtimeModeSwitch??"next-turn"}),[me,y,te,he]),ue=he?.supportsNativeModeSwitch===!0,ce=m&&ue?r.nativeModeByProvider?.[M]??null:null,Ze=W(()=>t.model.resolveNativeMode(he,{runtimeMode:g,nativeModeId:m?ce:u?.nativeModeId??null}),[t.model,u?.nativeModeId,he,g,m,ce]),pt=ce&&Ze?.current.id===ce?ce:void 0,ze=R(tt=>{m&&S(a,M,tt),P(tt)},[m,S,a,M,P]),et=W(()=>t.model.createSelection(M,ge,De),[t.model,M,ge,De]);dD({threadId:u?.id??null,isLocalDraftThread:m,selection:et,selectionsEqual:t.model.selectionsEqual,onChosen:X||f?void 0:N});let Et=R(tt=>A(tt,et),[A,et]),ft=Z?.selected.kind==="model"?Z.selected.slug:ge,Ct=W(()=>{let tt=new Map;for(let It of B)tt.set(It.instanceId,t.model.getAppModelOptionsForInstance(n,It,It.instanceId===M?ft:null));return tt},[t.model,B,M,ft,n]),gt=W(()=>(Ct.get(M)??[]).some(It=>It.slug===ft)?ft:t.model.normalizeSlug(ft)??ft,[t.model,Ct,M,ft,te]),Dt=k??(T?null:I),Mt=Dt!==null,[se,Le]=q(!1);H(()=>{Le(!1)},[M]);let be=rD({status:ne,submissionTarget:T?"pending-user-input":"provider-turn"}),Xe=aD({blockedOnSend:se,status:ne,submissionTarget:T?"pending-user-input":"provider-turn"}),xt=W(()=>tD(b,Ct),[b,Ct]);return{providerInstanceEntries:B,lockedContinuationGroupKey:G,selectedInstanceId:M,agentUnavailable:X,selectedProviderEntry:F,noProviderAvailable:ee,agentUnavailableNoChoice:Y,resolvedCompactDisabledReason:ae,selectedProvider:te,composerModelOptions:de,selectedModel:ge,selectedModelStatus:ne,selectedProviderStatus:he,selectedProviderModels:Ae,selectedModelChoice:Z,modelNotes:je,selectedModelUnconfirmed:ot,selectedModelOptionsForDispatch:De,planModeUiEnabled:me,composerProviderControls:Me,canSwitchNativeMode:ue,composerNativeMode:Ze,selectedNativeModeId:pt,handleComposerNativeModeChange:ze,selectedModelSelection:et,onAgentInstanceChange:Et,modelOptionsByInstance:Ct,selectedModelForPickerWithCustomFallback:gt,sendDisabledReason:Dt,isSendDisabled:Mt,setModelSendBlockShown:Le,isModelSendBlocked:be,modelSendBlock:Xe,activeThreadModelDisplayName:xt}}function pD(e,t){let{provider:o,instanceId:n,threadRef:r,draftId:a,model:s,choice:i}=t,d=r!==void 0||a!==void 0,c=_T(i,u=>u);return!d||!NT(c,DT(i))?null:l(e,{provider:o,...n?{instanceId:n}:{},...r?{threadRef:r}:{},...a?{draftId:a}:{},model:s,choice:i})}function mD(e){return pD(xb,e)}function fD(e){return pD(Cb,e)}function gD(e){let{routeKind:t,routeThreadRef:o,draftId:n,selectedProvider:r,selectedInstanceId:a,selectedModel:s,selectedModelChoice:i}=e,d={provider:r,instanceId:a,...t==="server"?{threadRef:o}:{},...t==="draft"&&n?{draftId:n}:{},model:s,choice:i};return{providerTraitsMenuContent:mD(d),providerTraitsPicker:fD(d)}}$();$();var qC="ycodium:status-bar-usage-surface";var hD=pe(function(t){let{data:o,target:n}=Ho(),r=lb(),a=o.useAccountUsageInstance(n),s=`${n.environmentId}:${n.threadId}`;return H(()=>{if(r)return window.dispatchEvent(new CustomEvent(qC,{detail:{owner:s,environmentId:n.environmentId,instanceId:a?.instanceId??null,instanceLabel:a?.instanceLabel??null,decisionOccupiesComposer:t.decisionOccupiesComposer,clear:!1}})),()=>{window.dispatchEvent(new CustomEvent(qC,{detail:{owner:s,clear:!0}}))}},[r,a?.instanceId,a?.instanceLabel,s,t.decisionOccupiesComposer,n.environmentId]),null});function VW(e,t,o){let n=[];n.push(t(e));let r=o(e);return r&&n.push(r),e.pageUrl&&n.push(e.pageUrl),e.selector&&n.push(e.selector),e.htmlPreview.trim().length>0&&(n.push(""),n.push(e.htmlPreview.trim().slice(0,600))),n.join(`
3572
+ `)}function QW({context:e,onRemove:t}){let{t:o}=z(),n=it().elementContext,r=n.formatLabel(e),a=n.formatSourceLabel(e);return v(Pe,{children:[l(Ee,{render:v("span",{className:V(sn,"pr-1"),children:[l(Wn,{className:V(Fo,"size-icon-1")}),l("span",{className:Bo,children:r}),a?l("span",{className:"select-none text-ui-2xs font-normal text-muted-foreground/85",children:a}):null,l("button",{type:"button","aria-label":o("pendingContext.removeElement",{label:r}),className:fp,onClick:s=>{s.preventDefault(),s.stopPropagation(),t(e.id)},children:l(dt,{className:"size-3","aria-hidden":!0})})]})}),l(Re,{side:"top",className:"max-w-96 whitespace-pre-wrap leading-tight",children:VW(e,n.formatLabel,n.formatSourceLabel)})]})}function yD({contexts:e,onRemove:t,className:o}){return e.length===0?null:l("div",{className:V("flex flex-wrap gap-1.5",o),children:e.map(n=>l(QW,{context:n,onRemove:t},n.id))})}function vD({comments:e,onRemove:t,className:o}){let{t:n}=z();return e.length===0?null:l("div",{className:V("flex flex-wrap gap-1.5",o),children:e.map(r=>{let a=`${r.filePath} ${r.rangeLabel}`,s=v("span",{className:V(sn,"pr-1"),children:[l(nd,{className:V(Fo,"size-icon-1")}),l("span",{className:Bo,children:a}),l("button",{type:"button","aria-label":n("pendingContext.removeReviewComment",{label:a}),className:fp,onClick:i=>{i.preventDefault(),i.stopPropagation(),t(r.id)},children:l(dt,{className:"size-3","aria-hidden":!0})})]},r.id);return r.text.length===0?s:v(Pe,{children:[l(Ee,{render:s}),l(Re,{side:"top",className:"max-w-96 whitespace-pre-wrap leading-tight",children:r.text})]},r.id)})})}function Zf(e){let{t}=z(),o=t(e.tooltipKey,{count:e.count});return v(Pe,{children:[l(Ee,{render:v("span",{className:"inline-flex items-center gap-1 text-ui-2xs font-medium text-muted-foreground",children:[e.icon,e.count]})}),l(Re,{side:"top",children:o})]})}function CD({annotations:e,images:t,onRemove:o,onExpandImage:n,uploadsByImageId:r,onRetryUpload:a,className:s}){let{t:i}=z(),d=it().elementContext;if(e.length===0)return null;let c=new Map(t.map(u=>[u.id,u]));return l("div",{className:V("flex flex-wrap gap-1.5",s),children:e.map(u=>{let m=c.get(u.id),p=m?r?.[m.id]:void 0,f=u.elements.flatMap(g=>{let h=d.normalizeSelection(g.element);return h?[{id:g.id,label:d.formatLabel(h)}]:[]});return v("section",{className:"group/browser-annotation relative flex min-w-0 max-w-full items-center overflow-hidden rounded-lg border border-border/80 bg-background/72",children:[m?.previewUrl?l("button",{type:"button","aria-label":i("browserAnnotation.previewImage",{name:m.name}),className:"size-14 shrink-0 cursor-zoom-in overflow-hidden border-r border-border/70 bg-muted",onClick:()=>n(m.id),children:l("img",{src:m.previewUrl,alt:i("browserAnnotation.cropAlt"),className:"size-full object-cover transition-transform duration-(--control-duration) group-hover/browser-annotation:scale-[1.03]"})}):l("span",{className:"grid size-10 shrink-0 place-items-center border-r border-border/70 text-message-action",children:l(Wn,{className:"size-icon-2"})}),v("div",{className:"min-w-0 px-2.5 py-2 pr-8",children:[u.comment.trim()?l("p",{className:"max-w-80 truncate text-foreground text-xs font-medium",children:u.comment.trim()}):null,v("div",{className:V("flex min-w-0 items-center gap-2",u.comment.trim()&&"mt-1"),children:[f.length>0?v("div",{className:"flex min-w-0 items-center gap-1",children:[f.slice(0,2).map(({id:g,label:h})=>l("span",{className:"max-w-40 truncate font-mono text-secondary-label text-ui-2xs",children:h},g)),f.length>2?v("span",{className:"text-secondary-label text-ui-2xs",children:["+",f.length-2]}):null]}):null,v("div",{className:"flex shrink-0 items-center gap-2",children:[u.elements.length>0?l(Zf,{icon:l(Wn,{className:"size-3"}),count:u.elements.length,tooltipKey:"browserAnnotation.elementCount"}):null,u.regions.length>0?l(Zf,{icon:l(Gl,{className:"size-3"}),count:u.regions.length,tooltipKey:"browserAnnotation.regionCount"}):null,u.strokes.length>0?l(Zf,{icon:l(Gn,{className:"size-3"}),count:u.strokes.length,tooltipKey:"browserAnnotation.drawingCount"}):null,u.styleChanges.length>0?l(Zf,{icon:l(za,{className:"size-3"}),count:u.styleChanges.length,tooltipKey:"browserAnnotation.styleChangeCount"}):null,p?.status==="uploading"?l("span",{className:"text-ui-2xs text-secondary-label",children:Gf(p.progress)}):null,p?.status==="failed"&&m&&a?v(Pe,{children:[l(Ee,{render:l(K,{size:"icon-micro",variant:"ghost-muted","aria-label":i("attachments.retryUpload",{name:m.name}),onClick:()=>a(m)}),children:l(Ka,{className:"size-3"})}),l(Re,{side:"top",children:Wf(p,i)})]}):null]})]})]}),l(K,{size:"icon-micro",variant:"ghost-muted","aria-label":i("browserAnnotation.remove"),className:"absolute right-1.5 top-1.5 [--control-icon-color:currentColor] rounded text-icon-muted hover:bg-muted",onClick:()=>o(u.id),children:l(dt,{className:"size-3"})})]},u.id)})})}function WC(e,t){let o=e.flatMap(r=>r.previewUrl?[{id:r.id,src:r.previewUrl,name:r.name,source:r.source}]:[]);if(o.length===0)return null;let n=o.findIndex(r=>r.id===t);return n<0?null:{images:o.map(r=>({src:r.src,name:r.name,...r.source===void 0?{}:{source:r.source}})),index:n}}function xD(e){let{t}=z(),{api:o,environmentId:n,composerDraftTarget:r,isComposerCollapsedMobile:a,isComposerApprovalState:s,hasPendingUserInputs:i,supportsAttachmentUploads:d,uploadsByImageId:c,composerImages:u,composerPreviewableImages:m,composerBrowserAnnotations:p,composerReviewComments:f,composerElementContexts:g,nonPersistedComposerImageIdSet:h,removeComposerDraftBrowserAnnotation:y,removeComposerDraftReviewComment:x,removeComposerDraftElementContext:C,removeComposerImage:b,onExpandImage:L}=e;return v(oe,{children:[!a&&!s&&!i&&p.length>0&&l(CD,{annotations:p,images:u,...d?{uploadsByImageId:c,onRetryUpload:w=>o.uploads.retry({environmentId:n,image:w})}:{},onRemove:w=>{o.uploads.release(w),y(r,w)},onExpandImage:w=>{let k=WC(m,w);k&&L(k)},className:"mb-3"}),!a&&!s&&!i&&f.length>0&&l(vD,{comments:f,onRemove:w=>x(r,w),className:"mb-3"}),!a&&!s&&!i&&g.length>0&&l(yD,{contexts:g,onRemove:w=>C(r,w),className:"mb-3"}),!a&&!s&&!i&&u.some(w=>!p.some(k=>k.id===w.id))&&l("div",{className:"mb-3 flex flex-wrap gap-2",children:u.filter(w=>!p.some(k=>k.id===w.id)).map(w=>{let k=d?c[w.id]:void 0,I=Tn(w),T=sp(I),S=I==="image"&&!!w.previewUrl;return v("div",{"data-composer-attachment-id":w.id,className:V("relative h-16 overflow-hidden rounded-lg border border-border/80 bg-background",S?"w-16":"w-44 max-w-full"),children:[S?l("button",{type:"button",className:"h-full w-full cursor-zoom-in","aria-label":t("attachments.preview",{name:w.name}),onClick:()=>{let P=WC(m,w.id);P&&L(P)},children:l("img",{src:w.previewUrl,alt:w.name,className:"h-full w-full object-cover"})}):v("a",{href:w.previewUrl,target:"_blank",rel:"noreferrer",className:"flex h-full w-full items-center gap-2 px-2 pe-7 text-start","aria-label":t("attachments.open",{name:w.name}),children:[l(T,{className:"size-4 shrink-0 text-secondary-label"}),v("span",{className:"min-w-0",children:[l("span",{className:"block truncate text-ui-xs text-foreground",children:w.name}),l("span",{className:"block text-ui-2xs text-secondary-label",children:di(w.sizeBytes)})]})]}),h.has(w.id)&&v(Pe,{children:[l(Ee,{render:l("span",{role:"img","aria-label":t("attachments.draftMayNotPersist"),className:"absolute left-1 top-1 inline-flex items-center justify-center rounded bg-background/85 p-0.5 text-warning-foreground",children:l(eo,{className:"size-3"})})}),l(Re,{side:"top",className:"max-w-64 whitespace-normal leading-tight",children:t("attachments.draftMayNotPersistDetail")})]}),k?.status==="uploading"&&l("span",{className:"pointer-events-none absolute inset-x-0 bottom-0 bg-background/85 px-1 text-center text-ui-2xs text-foreground",children:Gf(k.progress)}),k?.status==="failed"&&v(Pe,{children:[l(Ee,{render:l(K,{variant:"ghost",size:"icon-xs",className:"absolute bottom-1 left-1 bg-background/85 hover:bg-background/90",onClick:()=>o.uploads.retry({environmentId:n,image:w}),"aria-label":t("attachments.retryUpload",{name:w.name})}),children:l(Ka,{})}),l(Re,{side:"top",className:"max-w-64 whitespace-normal leading-tight",children:Wf(k,t)})]}),l(K,{variant:"ghost",size:"icon-xs",className:"absolute right-1 top-1 bg-background/80 hover:bg-background/90",onClick:()=>b(w.id),"aria-label":t("attachments.remove",{name:w.name}),children:l(dt,{})})]},w.id)})})]})}function bD(e){return e.machineUnavailable?"machineDisconnected":e.sessionStarted&&e.sessionDisconnected?"settled":"default"}function wD(e){switch(e){case"machineDisconnected":return"composer.disconnectedPlaceholder";case"settled":return"composer.idlePlaceholder";case"default":return null}}function TD(e){return e.isComposerApprovalState?e.t("composer.resolveApprovalToContinue"):e.activePendingProgress?e.t("composer.typeOwnAnswer"):e.showPlanFollowUpPrompt?e.t("composer.addFeedbackRefinePlan"):e.projectSelectionRequired?e.t("composer.chooseProjectToStart"):e.noProviderAvailable?e.t("composer.enableProviderToSend"):e.t(e.tailPlaceholderKey??"composer.askAnything")}$();$();var ID=pe(function(t){let{t:o}=z(),n=ml();return v(Ao,{children:[l(Do,{render:l(K,{size:"sm",variant:"ghost",className:"shrink-0 px-2 text-muted-foreground/70 hover:text-foreground/80","aria-label":o("composer.moreComposerControls")}),children:l(Eo,{"aria-hidden":"true",className:"size-4"})}),v(No,{align:"start",children:[t.traitsMenuContent?v(oe,{children:[t.traitsMenuContent,l(xd,{})]}):null,t.showInteractionModeToggle&&t.nativeMode===null?v(oe,{children:[l("div",{className:"px-2 py-1.5 font-medium text-muted-foreground text-xs",children:o("composer.modeMenuTitle")}),v(Yr,{value:t.interactionMode,onValueChange:r=>{!r||r===t.interactionMode||t.onToggleInteractionMode()},children:[l(Yn,{value:"default",children:o("composer.interactionModeChat")}),l(Yn,{value:"plan",children:o("composer.interactionModePlan")})]}),l(xd,{})]}):null,t.nativeMode===null?v(oe,{children:[l("div",{className:"px-2 py-1.5 font-medium text-muted-foreground text-xs",children:o("composer.accessMenuTitle")}),l(Yr,{value:t.runtimeMode,onValueChange:r=>{!r||r===t.runtimeMode||t.onRuntimeModeChange(r)},children:On.map(r=>l(Yn,{value:r,children:n(r).label},r))}),t.runtimeModeSwitch==="next-turn"?l("div",{className:"px-2 pb-1.5 text-muted-foreground text-xs leading-4",children:o("runtimeMode.appliesNextTurnHint")}):null]}):v(oe,{children:[l("div",{className:"px-2 py-1.5 font-medium text-muted-foreground text-xs",children:o("composer.accessMenuTitle")}),t.canSwitchNativeMode&&t.nativeMode.modes.length>1?v(oe,{children:[l(Yr,{value:t.nativeMode.current.id,onValueChange:r=>{t.onNativeModeChange(String(r))},children:t.nativeMode.modes.map(r=>l(Yn,{value:r.id,children:r.name},r.id))}),t.runtimeModeSwitch==="next-turn"?l("div",{className:"px-2 pb-1.5 text-muted-foreground text-xs leading-4",children:o("runtimeMode.appliesNextTurnHint")}):null]}):l("div",{className:"px-2 pb-1.5 text-foreground text-sm","data-composer-native-mode":t.nativeMode.current.id,children:t.nativeMode.current.name})]})]})]})});function SD(e){let{t}=z(),o=it().environment.useScopedEnvironmentId();return l(vb,{...e,hideInstanceRail:!0,showInstanceOnTrigger:!1,emptyLabel:t("composer.chooseModel"),...o===null?{}:{environmentId:o}})}function kD(e){let{slots:t,...o}=e,n=l(SD,{...o}),r=t?.renderSlot("conversation.input.model",o,n);return l("span",{"data-conversation-slot":"conversation.input.model",children:r??n})}function LD(e){return l(SD,{...e})}$();function PD(e){return e.description??e.name}var RD=pe(function(t){let{t:o}=z(),{current:n,modes:r}=t.nativeMode,a=PD(n);return!t.canSwitch||r.length<2?v(Pe,{children:[v(Ee,{render:l(Vn,{className:"shrink-0 cursor-default whitespace-nowrap font-medium",type:"button",disabled:!0,"data-composer-native-mode":n.id,"aria-label":o("composer.agentModeLabel",{name:n.name})}),children:[l(Qn,{icon:qs}),l("span",{children:n.name})]}),v(Re,{side:"top",children:[l("span",{className:"block font-medium",children:a}),r.length>1?l("span",{className:"mt-1 block text-muted-foreground text-xs",children:o("composer.agentModesList",{modes:r.map(s=>s.name).join(", ")})}):null]})]}):l(oe,{children:v(Pe,{children:[v(Xs,{value:n.id,onValueChange:s=>t.onNativeModeChange(s),children:[v(Ee,{render:l(Au,{className:"shrink-0 whitespace-nowrap font-medium","data-composer-native-mode":n.id,"aria-label":o("composer.agentModeLabel",{name:n.name})}),children:[l(Qn,{icon:qs}),l(Ou,{children:n.name})]}),l(Ys,{alignItemWithTrigger:!1,children:r.map(s=>l(qa,{value:s.id,hideIndicator:!0,className:"min-w-56 py-2",children:v("div",{className:"grid min-w-0 gap-0.5",children:[l("span",{className:"font-medium text-foreground",children:s.name}),s.description?l("span",{className:"text-muted-foreground text-xs leading-4",children:s.description}):null]})},s.id))})]}),l(Re,{side:"top",children:t.appliesNextTurn?`${a} ${o("runtimeMode.appliesNextTurnHint")}`:a})]})})});function GC(e){let{t}=z(),o=ml();if(e.nativeMode)return l(RD,{nativeMode:e.nativeMode,canSwitch:e.canSwitchNativeMode,appliesNextTurn:e.runtimeModeSwitch==="next-turn",onNativeModeChange:e.onNativeModeChange});let n=o(e.runtimeMode),r=n.icon,a=e.runtimeModeSwitch==="next-turn";return l(oe,{children:v(Pe,{children:[v(Xs,{value:e.runtimeMode,onValueChange:s=>e.onRuntimeModeChange(s),children:[v(Ee,{render:l(Au,{"data-composer-permission":"true",className:"font-medium","aria-label":t("composer.runtimeMode")}),children:[l(Qn,{icon:r}),l(Ou,{children:n.label})]}),l(Ys,{alignItemWithTrigger:!1,children:On.map(s=>{let i=o(s),d=i.icon;return l(qa,{value:s,hideIndicator:!0,className:"min-w-64 py-2","data-runtime-mode":s,children:v("span",{className:"flex items-center gap-2",children:[l(d,{className:"size-4"}),i.label]})},s)})})]}),l(Re,{side:"top",children:a?t("runtimeMode.appliesNextTurnHint"):n.label})]})})}function ED(e){return l(GC,{...e})}function jC(e){let{t}=z();if(!e.showInteractionModeToggle)return null;let o=e.interactionMode==="plan",n=t(o?"composer.planModeTooltip":"composer.defaultModeTooltip");return v(Pe,{children:[v(Ee,{render:l(Vn,{"data-composer-plan-toggle":"true",className:V("shrink-0 whitespace-nowrap",o?"bg-accent text-accent-foreground hover:bg-accent/90":"text-secondary-label hover:text-foreground"),type:"button",onClick:e.onToggleInteractionMode,"aria-label":n}),children:[o?l(Qn,{icon:id,className:"text-current opacity-100"}):l(Qn,{icon:Bl,opticalSize:"large"}),l("span",{className:"sr-only sm:not-sr-only",children:t(o?"composer.interactionModePlan":"composer.interactionModeBuild")})]}),l(Re,{side:"top",className:"sm:hidden",children:n})]})}function MD(e){return l(jC,{...e})}function Yc(e){let t=e.slots?.renderSlot(e.name,e.owner??{},e.fallback);return l("span",{"data-conversation-slot":e.name,children:t??e.fallback})}function Or(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 XW(e){return e===null||!Number.isFinite(e)?null:e<10?`${e.toFixed(1).replace(/\.0$/,"")}%`:`${Math.round(e)}%`}function AD(e){let{t}=z(),o=ho(),{usage:n,breakdown:r,modelDisplayName:a,onCompact:s,compactDisabled:i,compactDisabledReason:d}=e,c=XW(n.usedPercentage),u=n.usedPercentage??0,m=n.usedPercentage===null?null:100,p=n.totalProcessedTokens??null,f=p!==null&&p>0;return v(nn,{children:[l(an,{openOnHover:!0,delay:150,closeDelay:s?150:0,render:l(K,{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&&c?t("contextWindow.usedPercentAria",{percentage:c}):t("contextWindow.usedTokensAria",{tokens:Or(n.usedTokens)}),children:l(Eg,{"aria-hidden":!0,"aria-label":t("contextWindow.usage"),limit:m,shape:"ring",used:u})})}),l(rn,{tooltipStyle:!0,side:"top",align:"end",viewportClassName:"overflow-y-auto p-0",className:"w-72 text-left whitespace-normal",children:v("div",{className:"flex flex-col gap-2 p-[var(--floating-content-inset)]",children:[v("div",{className:"flex flex-wrap items-center justify-between gap-x-3 gap-y-1",children:[l("div",{className:"font-medium text-muted-foreground text-xs",children:t("contextWindow.title")}),n.maxTokens!==null&&c?v("div",{className:"flex items-center gap-2 text-secondary-label text-ui-sm tabular-nums",children:[l("span",{children:c})," ",v("span",{children:[Or(n.usedTokens),"/",Or(n.maxTokens??null)]})]}):l("div",{className:"flex items-center gap-2 text-secondary-label text-ui-sm tabular-nums",children:Or(n.usedTokens)})]}),n.maxTokens!==null?l(Eg,{"aria-label":t("contextWindow.usage"),limit:m,shape:"bar",used:u}):null,r?v("div",{className:"flex flex-col gap-1","data-context-breakdown":"true",children:[v("div",{className:"flex items-center justify-between gap-3 text-ui-sm leading-4","data-context-breakdown-row":"system",children:[l("span",{className:"text-secondary-label",children:t("contextWindow.system")}),l("span",{className:"font-medium tabular-nums text-secondary-label",children:Or(r.systemTokens)})]}),v("div",{className:"flex items-center justify-between gap-3 text-ui-sm leading-4","data-context-breakdown-row":"tools",children:[l("span",{className:"text-secondary-label",children:t("contextWindow.tools")}),l("span",{className:"font-medium tabular-nums text-secondary-label",children:Or(r.toolsTokens)})]}),v("div",{className:"flex items-center justify-between gap-3 text-ui-sm leading-4","data-context-breakdown-row":"messages",children:[l("span",{className:"text-secondary-label",children:t("contextWindow.messages")}),l("span",{className:"font-medium tabular-nums text-secondary-label",children:Or(r.messageTokens)})]})]}):null,f?v("div",{className:"flex items-center justify-between gap-3 text-ui-sm leading-4",children:[l("span",{className:"text-secondary-label",children:t("contextWindow.totalProcessed")}),l("span",{className:"font-medium tabular-nums text-secondary-label",children:Or(p)})]}):null,n.compactsAutomatically?l("div",{className:"mt-1 text-pretty text-secondary-label text-ui-sm font-medium",children:oD(t,a,n.autoCompactThreshold)}):null,s?v(oe,{children:[v(K,{size:"xs",variant:"outline",className:"mt-1 w-full justify-center",disabled:i,"aria-describedby":i&&d?o:void 0,onClick:s,children:[l(rd,{"aria-hidden":"true"}),t("contextWindow.compactContext")]}),i&&d?l("div",{id:o,className:"text-pretty text-secondary-label text-ui-sm",children:d}):null]}):null]})})]})}function VC(e,t){return t==null?void 0:e.find(o=>o.presetId===t)}$();function ND(e){if(e.useDraftPresetId===void 0||e.setDraftPresetId===void 0)throw new Error("missing draft preset api: useDraftPresetId and setDraftPresetId");return{useDraftPresetId:e.useDraftPresetId,setDraftPresetId:e.setDraftPresetId}}var QC="__none__",DD=pe(function({environmentId:t,draftId:o,threadPresetId:n,compact:r}){let{t:a}=z(),s=it().presets,i=ND(s),d=s.useThreadPresets(t),c=i.useDraftPresetId(o);if(o===null){let f=VC(d,n)?.displayName??n;return f===null?null:l(YW,{compact:r,label:f,applied:a("preset.appliedLabel",{name:f}),disabled:!0})}if(d.length===0)return null;let m=VC(d,c)?.displayName??a("preset.none");return v(Ao,{children:[v(Do,{render:l(Vn,{variant:"ghost","aria-label":a("preset.triggerLabel"),className:"max-w-40 min-w-0 shrink"}),children:[l(_D,{compact:r,label:m,applied:a("preset.appliedLabel",{name:m})}),l(Mu,{})]}),l(No,{align:"start",children:v(Pb,{children:[l("div",{className:"px-2 pt-1.5 pb-1 font-medium text-muted-foreground text-xs",children:a("preset.menuTitle")}),v(Yr,{value:c??QC,onValueChange:p=>{i.setDraftPresetId(o,p===QC?null:p)},children:[l(Yn,{value:QC,hideIndicator:!0,closeOnClick:!0,children:l("span",{className:"min-w-0 truncate",children:a("preset.none")})}),d.map(p=>l(Yn,{value:p.presetId,hideIndicator:!0,closeOnClick:!0,children:v("span",{className:"flex w-full min-w-0 flex-col",children:[l("span",{className:"min-w-0 truncate",children:p.displayName}),p.description?l("span",{className:"max-w-56 text-pretty text-muted-foreground/80 text-xs",children:p.description}):null]})},p.presetId))]})]})})]})});function YW(e){return l(Vn,{variant:"ghost",disabled:e.disabled,"aria-label":e.applied,className:"max-w-40 min-w-0 shrink",children:l(_D,{compact:e.compact,label:e.label,applied:e.applied})})}function _D(e){return v(Pe,{children:[v(Ee,{render:l("span",{className:"flex min-w-0 items-center gap-1.5"}),children:[l(Qn,{icon:Kr}),e.compact?null:l("span",{className:"min-w-0 truncate",children:e.label})]}),l(Re,{side:"top",children:e.applied})]})}var JW=pe(function(t){let{data:o,target:n}=Ho(),r=o.useContextUsage(n);return r?.window==null?null:l(AD,{usage:r.window,breakdown:r.breakdown,modelDisplayName:t.modelDisplayName,onCompact:t.onCompact,compactDisabled:t.compactDisabled,compactDisabledReason:t.compactDisabledReason})}),ZW=pe(function(t){let{t:o}=z(),n=Xf(t.groupSendEligible),r=Qf({pluginAction:t.pluginAction,groupSend:n,groupSendDisabledReason:t.groupSendDisabledReason,sendDisabledReason:t.sendDisabledReason,noProviderAvailable:t.noProviderAvailable,environmentUnavailable:t.environmentUnavailable,projectSelectionRequired:t.projectSelectionRequired,labels:{environmentDisconnected:o("primaryActions.environmentDisconnected"),chooseProjectToStart:o("composer.chooseProjectToStart"),enableProviderToSend:o("composer.enableProviderToSend")}}).reason;return v(oe,{children:[l(JW,{modelDisplayName:t.activeThreadModelDisplayName,onCompact:t.onCompactContext,compactDisabled:t.compactDisabled,compactDisabledReason:t.compactDisabledReason}),l(gl,{compact:t.compact,pendingAction:t.pendingAction,isRunning:t.isRunning,showPlanFollowUpPrompt:t.showPlanFollowUpPrompt&&!t.pluginAction,promptHasText:t.promptHasText,isSendBusy:t.isSendBusy,sendDisabledReason:r,isEnvironmentUnavailable:t.environmentUnavailable||t.noProviderAvailable&&!n&&!t.pluginAction||t.projectSelectionRequired,hasSendableContent:t.hasSendableContent,preserveComposerFocusOnPointerDown:t.preserveComposerFocusOnPointerDown??!1,showSendWhileRunning:!!(t.showSendWhileRunning||t.pluginAction),onInterrupt:t.onInterrupt,interruptArmed:t.interruptArmed,stopping:t.stopping,cancelsCheck:t.cancelsCheck,onImplementPlanInNewThread:t.onImplementPlanInNewThread,shellCommandMode:t.shellCommandMode,shellCommandUnavailableReason:t.shellCommandUnavailableReason})]})});function OD(e){let{t}=z(),{isComposerFooterCompact:o,isComposerPrimaryActionsCompact:n,isMobileViewport:r,showMobilePendingAnswerActions:a,hasPendingUserInputs:s,projectSelectionRequired:i,noProviderAvailable:d,composerAttachmentInputRef:c,onComposerAttachmentInputChange:u,slots:m,selectedInstanceId:p,unavailableAgentInstanceId:f,agentNotChosen:g,agentUnavailable:h,providerInstanceEntries:y,lockedProvider:x,lockedContinuationGroupKey:C,onAgentInstanceChange:b,selectedModelForPickerWithCustomFallback:L,selectedModelStatus:w,selectedModelUnconfirmed:k,keybindings:I,modelOptionsByInstance:T,terminalOpen:S,isComposerModelPickerOpen:P,setIsComposerModelPickerOpen:A,getModelDisabledReason:N,getModelContinuationLabel:B,onContinueInModel:O,onProviderModelSelect:j,environmentId:U,routeKind:D,draftId:J,activeThread:G,interactionMode:M,runtimeMode:X,composerProviderControls:F,composerNativeMode:ee,canSwitchNativeMode:Y,providerTraitsMenuContent:ae,providerTraitsPicker:te,toggleInteractionMode:de,handleRuntimeModeChange:ge,handleComposerNativeModeChange:ne,inlineTasksBadge:Z,inlineStashBadge:ve,activeThreadModelDisplayName:he,pendingPrimaryAction:Ae,phase:De,continuationChecking:je,showPlanFollowUpPrompt:ot,composerDraft:me,isSendBusy:Me,sendDisabledReason:ue,groupSendDisabledReason:ce,groupSendEligible:Ze,environmentUnavailable:pt,handleInterruptPrimaryAction:ze,interruptArmed:et,stopping:Et,handleImplementPlanInNewThreadPrimaryAction:ft,shellCommandMode:Ct,shellCommandUnavailableReason:gt,compactDisabled:Dt,resolvedCompactDisabledReason:Mt,compactThreadContext:se}=e;return v("div",{"data-chat-composer-footer":"true","data-chat-composer-footer-compact":o?"true":"false",className:V("flex min-w-0 select-none flex-nowrap items-center justify-between gap-2 overflow-visible px-3 pb-3 sm:px-4 sm:pb-4",s&&"pt-2",o?"gap-1.5":"gap-2 sm:gap-0",a&&"hidden sm:flex"),children:[v("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:[l("input",{ref:c,type:"file",multiple:!0,className:"hidden",tabIndex:-1,"aria-hidden":"true",onChange:u}),v(Pe,{children:[l(Ee,{render:l(K,{type:"button",variant:"ghost",size:"icon-sm","data-chat-composer-attach":"true",className:"shrink-0",disabled:i||s,"aria-label":t("attachments.add"),onClick:()=>c.current?.click()}),children:l(jo,{})}),l(Re,{side:"top",children:t("attachments.add")})]}),d?v(K,{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:[l(eo,{className:"size-4"}),t("composer.noProviderAvailable")]}):v(oe,{children:[l(Yc,{name:"conversation.input.agent",...m===void 0?{}:{slots:m},owner:{activeInstanceId:p,unavailableInstanceId:f,notChosen:g,instanceEntries:y,lockedProvider:x,lockedContinuationGroupKey:C,compact:o,onInstanceChange:b},fallback:l(zC,{activeInstanceId:p,unavailableInstanceId:f,notChosen:g,instanceEntries:y,lockedProvider:x,lockedContinuationGroupKey:C,compact:o,onInstanceChange:b})}),h||g?null:l(kD,{...m===void 0?{}:{slots:m},compact:o,hideInstanceRail:!0,showInstanceOnTrigger:!1,activeInstanceId:p,model:L,modelStatus:w,modelUnconfirmed:k,lockedProvider:x,lockedContinuationGroupKey:C,instanceEntries:y,keybindings:I,modelOptionsByInstance:T,terminalOpen:S,open:P,onOpenChange:Le=>{A(Le)},getModelDisabledReason:N,getModelContinuationLabel:B,onContinueInModel:O,onInstanceModelChange:j})]}),v(oe,{children:[l(DD,{environmentId:U,draftId:D==="draft"?J:null,threadPresetId:G?.presetId??null,compact:o},D==="draft"?J:G?.id??"thread"),o?l(ID,{interactionMode:M,runtimeMode:X,runtimeModeSwitch:F.runtimeModeSwitch,nativeMode:ee,canSwitchNativeMode:Y,showInteractionModeToggle:F.showInteractionModeToggle,traitsMenuContent:ae,onToggleInteractionMode:de,onRuntimeModeChange:ge,onNativeModeChange:ne}):v(oe,{children:[te?l(Yc,{name:"conversation.input.effort",...m===void 0?{}:{slots:m},fallback:te}):null,ee===null&&F.showInteractionModeToggle?l(Yc,{name:"conversation.input.plan",...m===void 0?{}:{slots:m},owner:{interactionMode:M,showInteractionModeToggle:F.showInteractionModeToggle,onToggleInteractionMode:de},fallback:l(jC,{interactionMode:M,showInteractionModeToggle:F.showInteractionModeToggle,onToggleInteractionMode:de})}):null,l(Yc,{name:"conversation.input.permission",...m===void 0?{}:{slots:m},owner:{runtimeMode:X,runtimeModeSwitch:F.runtimeModeSwitch,nativeMode:ee,canSwitchNativeMode:Y,onRuntimeModeChange:ge,onNativeModeChange:ne},fallback:l(GC,{runtimeMode:X,runtimeModeSwitch:F.runtimeModeSwitch,nativeMode:ee,canSwitchNativeMode:Y,onRuntimeModeChange:ge,onNativeModeChange:ne})})]})]})]}),v("div",{"data-chat-composer-actions":"right","data-chat-composer-primary-actions-compact":n?"true":"false",className:"flex shrink-0 flex-nowrap items-center justify-end gap-2",children:[a?null:Z,a?null:ve,l(ZW,{pluginAction:e.pluginAction,compact:n,activeThreadModelDisplayName:he,pendingAction:Ae,isRunning:De==="running"||je,cancelsCheck:je&&De!=="running",showPlanFollowUpPrompt:!s&&ot,promptHasText:me.promptHasText,isSendBusy:Me,sendDisabledReason:ue,groupSendDisabledReason:ce,groupSendEligible:Ze,noProviderAvailable:d,environmentUnavailable:pt!==null,projectSelectionRequired:i,hasSendableContent:me.hasSendableContent,preserveComposerFocusOnPointerDown:r,showSendWhileRunning:r,onInterrupt:ze,interruptArmed:et,stopping:Et,onImplementPlanInNewThread:ft,shellCommandMode:Ct,shellCommandUnavailableReason:gt,compactDisabled:Dt||d||Me,compactDisabledReason:Mt,onCompactContext:se})]})]})}var eG=e=>e.prompt.trim();function tG(e){let{t}=z(),o=e.api.draft.useThreadDraftSelector(e.composerDraftTarget,eG),n=e.pendingCustomAnswer!==null;return l("button",{type:"button",className:V("min-w-0 flex-1 truncate bg-transparent p-0 text-left text-control-3",(n?e.pendingCustomAnswer:o)?"text-foreground":"text-placeholder"),onPointerDown:r=>r.preventDefault(),onClick:e.onExpand,"aria-label":t("composer.expandComposer"),children:n?e.pendingCustomAnswer||t("composer.typeOwnAnswer"):o||(e.noProviderAvailable?t("composer.enableProviderSettings"):t("composer.askAnything"))})}function FD(e){let{api:t,composerDraftTarget:o,pendingCustomAnswer:n,noProviderAvailable:r,onExpand:a,inlineTasksBadge:s,inlineStashBadge:i,submitDisabled:d,submitLabel:c,onSubmit:u}=e,{t:m}=z(),p=Xf(e.groupSendEligible),f=Qf({pluginAction:e.pluginAction,groupSend:p,groupSendDisabledReason:e.groupSendDisabledReason,sendDisabledReason:e.modelSendDisabledReason,noProviderAvailable:e.noProviderAvailable,environmentUnavailable:e.environmentUnavailable,projectSelectionRequired:e.projectSelectionRequired,labels:{environmentDisconnected:m("primaryActions.environmentDisconnected"),chooseProjectToStart:m("composer.chooseProjectToStart"),enableProviderToSend:m("composer.enableProviderToSend")}});return v("div",{className:"flex items-center justify-between gap-2 px-3 py-2",children:[l(tG,{api:t,composerDraftTarget:o,pendingCustomAnswer:n,noProviderAvailable:!p&&!e.pluginAction&&r,onExpand:a}),s,i,l("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:d||f.disabled,"aria-label":c,onPointerDown:g=>g.preventDefault(),onClick:g=>{g.stopPropagation(),u()},children:l("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:l("path",{d:"M8 3L8 13M8 3L4 7M8 3L12 7",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]})}$();$();var BD={plugins:"slashMenu.sections.plugins",recent:"slashMenu.sections.recent",builtIn:"slashMenu.sections.builtIn",provider:"slashMenu.sections.provider",skills:"slashMenu.sections.skills",files:"slashMenu.sections.files","members-team":"slashMenu.sections.membersTeam","members-project":"slashMenu.sections.membersProject",threads:"slashMenu.sections.threads"},UD=pe(function(t){let{t:o}=z(),n=E(null),r=vo()?.data.threadReferences!==void 0,a=vo()?.data.memberMentions!==void 0;return fe(()=>{if(!t.activeItemId||!n.current)return;n.current.querySelector(`[data-composer-item-id="${CSS.escape(t.activeItemId)}"]`)?.scrollIntoView({block:"nearest"})},[t.activeItemId]),l(zu,{autoHighlight:!1,mode:"none",onItemHighlighted:s=>{t.onHighlightedItemChange(typeof s=="string"?s:null)},children:v("div",{ref:n,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>1&&t.items.every(s=>s.type==="plugin-slash-command"&&s.command.name===t.items[0].command.name)?l("p",{className:"px-5 pt-2 text-xs text-muted-foreground",children:o("slash.ambiguous",{command:t.items[0].command.name})}):null,t.items.length>0?l(Wu,{className:"max-h-72 scroll-pb-6",children:l(Ku,{children:t.items.map((s,i)=>l(oG,{sectionTitle:s.section!==void 0&&t.items[i-1]?.section!==s.section?s.section:null,sectionLabel:s.type==="path"?s.sectionLabel:void 0,item:s,environmentId:t.environmentId,triggerKind:t.triggerKind,resolvedTheme:t.resolvedTheme,isActive:t.activeItemId===s.id,onHighlight:t.onHighlightedItemChange,onSelect:t.onSelect},s.id))})}):l("div",{className:"px-5 pt-3.5 pb-7",children:l("p",{className:"text-secondary-label text-xs",children:t.isLoading?HD(t.triggerKind)?o("composer.searchingSkills"):o("composer.searchingFiles"):HD(t.triggerKind)?o("composer.noSkillsFound"):t.triggerKind==="path"?o(a?"composer.noMatchingFilesThreadsOrMembers":r?"composer.noMatchingFilesOrThreads":"composer.noMatchingFiles"):o("composer.noMatchingCommand")})})]})})});function HD(e){return e==="skill"||e==="slash-skill"}var oG=pe(function(t){let{t:o}=z(),n=vo()?.target,r=t.item.type==="skill"?yA(t.item.skill):null,a=t.triggerKind==="slash-command"&&t.item.type==="skill"?t.item.skill:null;return v(oe,{children:[t.sectionTitle!==null?l("div",{role:"presentation","data-composer-menu-section":t.sectionTitle,className:"px-3 pt-2 pb-1 text-xs text-secondary-label",children:t.sectionLabel??o(BD[t.sectionTitle]??BD.recent)}):null,v(qu,{value:t.item.id,"data-composer-item-id":t.item.id,className:V("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:s=>{s.preventDefault()},onClick:()=>{t.onSelect(t.item)},children:[t.item.type==="path"?l(Af,{pathValue:t.item.path,kind:t.item.pathKind,theme:t.resolvedTheme}):null,t.item.type==="thread"?l(gr,{"aria-hidden":"true",className:"size-4 shrink-0 text-secondary-label"}):null,t.item.type==="member"?l(yr,{"aria-hidden":"true",className:"size-4 shrink-0 text-secondary-label"}):null,v("span",{className:"flex min-w-0 flex-1 items-center gap-2",children:[l("span",{className:"min-w-0 max-w-[45%] shrink-0 truncate font-sans text-xs font-medium",children:a?v(oe,{children:[l("span",{className:"text-secondary-label",children:"/skill:"}),en(a)]}):t.item.label}),l("span",{className:"min-w-0 max-w-[48ch] flex-1 truncate text-left text-secondary-label text-xs",children:t.item.description}),t.item.type==="plugin-slash-command"?l(Mo,{environmentId:t.environmentId??n?.environmentId??"",pluginId:t.item.pluginId}):null,t.item.type==="skill"&&t.item.skill.pluginId?l(Mo,{environmentId:t.environmentId??n?.environmentId??"",pluginId:t.item.skill.pluginId}):r?l(aG,{kind:r}):null]})]})]})}),nG={app:Fa,repo:zr,project:zr,personal:yr,system:md,other:sd},rG={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 aG(e){let{t}=z(),o=nG[e.kind];return v(jr,{className:"ms-auto",variant:"secondary",children:[l(o,{"aria-hidden":"true",className:"text-current"}),t(rG[e.kind])]})}$();function sG(e){let t=new Date(e);return Number.isNaN(t.getTime())?null:t}function $D(e,t){let o=sG(e);if(!o)return"";let n=Date.now()-o.getTime();if(n<0)return t("relativeTime.justNow");let r=Math.floor(n/1e3);if(r<60)return t("relativeTime.justNow");let a=Math.floor(r/60);if(a<60)return t("relativeTime.minutesAgo",{count:a});let s=Math.floor(a/60);return s<24?t("relativeTime.hoursAgo",{count:s}):t("relativeTime.daysAgo",{count:Math.floor(s/24)})}var zD=90;function KD(e){return e.droppedImageNames.length+(e.unreadableImageNames?.length??0)}function iG(e,t){let o=e.prompt.trim().replace(/\s+/g," ");if(o.length>0)return o.length>zD?`${o.slice(0,zD)}\u2026`:o;let n=e.attachments.length+e.droppedImageNames.length;return n>0?t("stash.imageCountLabel",{count:n}):t("stash.emptyEntry")}var qD=pe(function(t){let{entries:o,onRestore:n,onDelete:r,onClose:a}=t,{t:s}=z(),i=it(),d=E(null),[c,u]=q(o[0]?.id??null),m=o.find(p=>p.id===c)??o[0];return H(()=>{let p=f=>{let g=d.current;g&&f.composedPath().includes(g)||f.target instanceof Element&&f.target.closest('[data-prompt-stash-badge="true"]')||a()};return document.addEventListener("pointerdown",p,!0),()=>document.removeEventListener("pointerdown",p,!0)},[a]),H(()=>{o.length!==0&&(o.some(p=>p.id===c)||u(o[0]?.id??null))},[o,c]),i.pane.useKeydown(p=>{if(p.key==="Escape"){p.preventDefault(),p.stopPropagation(),a();return}if(p.key==="ArrowDown"||p.key==="ArrowUp"){if(o.length===0)return;p.preventDefault(),p.stopPropagation();let f=o.findIndex(x=>x.id===c),g=p.key==="ArrowDown"?1:-1,y=((f>=0?f:g===1?-1:0)+g+o.length)%o.length;u(o[y]?.id??null);return}if(p.key==="Enter"){if(p.target instanceof HTMLElement&&p.target.closest("button[aria-label]")||!m)return;p.preventDefault(),p.stopPropagation(),n(m);return}if(p.key==="Backspace"&&(p.metaKey||p.ctrlKey)){if(!m)return;p.preventDefault(),p.stopPropagation(),r(m)}},{capture:!0}),l(zu,{autoHighlight:!1,mode:"none",children:v("div",{ref:d,className:"chat-composer-drawer-surface chat-composer-drawer-attached relative w-full overflow-hidden","data-composer-stash-drawer":"true",children:[l("div",{className:"flex h-7 items-center justify-end px-2 pt-1",children:l(K,{variant:"ghost-muted",size:"icon-micro","aria-label":s("stash.closeLabel"),onPointerDown:p=>p.preventDefault(),onClick:a,children:l(dt,{className:"size-3"})})}),l(Wu,{className:"max-h-64 scroll-pb-6",children:l(Ku,{children:o.length===0?l("p",{className:"px-3 py-1.5 text-secondary-label text-xs",children:s("stash.empty")}):o.map(p=>v(qu,{value:p.id,className:V("group/stash relative cursor-[var(--control-cursor)] 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",c===p.id&&"bg-accent! text-accent-foreground!"),onMouseMove:()=>{c!==p.id&&u(p.id)},onMouseDown:f=>{f.preventDefault()},onClick:()=>{n(p)},children:[l("span",{className:"min-w-0 flex-1 truncate text-xs",children:iG(p,s)}),p.pendingImageCount?l("span",{className:"shrink-0 text-ui-sm text-secondary-label",children:s("stash.savingImage",{count:p.pendingImageCount})}):KD(p)>0?l("span",{className:"shrink-0 text-ui-sm text-warning-foreground",children:s("stash.imagesDropped",{count:KD(p)})}):null,p.attachments.length>0?l("span",{className:"flex shrink-0 items-center -space-x-1.5",children:p.attachments.slice(0,3).map(f=>l("img",{src:f.dataUrl,alt:"","aria-hidden":"true",className:"size-5 rounded border border-border/70 object-cover"},f.id))}):null,l("span",{className:"shrink-0 text-secondary-label text-xs max-sm:hidden",children:$D(p.createdAt,s)}),l(K,{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":s("stash.deleteLabel"),onClick:f=>{f.stopPropagation(),r(p)},children:l(dt,{className:"stroke-2"})})]},p.id))})})]})})});$();function lG(e,t){return e.bottom===t.bottom&&e.left===t.left&&e.maxHeight===t.maxHeight&&e.width===t.width&&e.overlap===t.overlap}function XC(e){let t=it(),o=bu(),n=t.pane.useActive(),[r,a]=q(null);return fe(()=>{if(!n)return;let s=e.anchor;if(!s){a(null);return}let i=!0,d=()=>{if(!i)return;let u=s.closest('[data-chat-composer-form="true"]'),p=(u?.querySelector('[data-chat-composer-main-surface="true"]')??u??s).getBoundingClientRect(),f=Number.parseFloat(window.getComputedStyle(document.documentElement).fontSize)||16,h=(Number.parseFloat(window.getComputedStyle(u??s).getPropertyValue("--chat-composer-drawer-inset"))||1.375)*f,y=f+1,x={bottom:window.innerHeight-p.top-y,left:p.left+h,maxHeight:Math.max(96,p.top-24+y),width:Math.max(0,p.width-h*2),overlap:y};a(C=>C&&lG(C,x)?C:x)};d(),window.addEventListener("resize",d),window.addEventListener("scroll",d,!0);let c=typeof ResizeObserver>"u"?null:new ResizeObserver(d);if(c){c.observe(s);for(let u=s.parentElement;u;u=u.parentElement)c.observe(u)}return()=>{i=!1,c?.disconnect(),window.removeEventListener("resize",d),window.removeEventListener("scroll",d,!0)}},[e.anchor,n]),!n||!r?null:t.createPortal(v("div",{className:o,"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:[l(dG,{}),e.children]}),document.body)}function dG(){return pN(),null}$();function cG(e){let t=IT(e);if(t===null)return"";let o=ui(t).visibleText;for(;;){let n=pi(o);if(!n.annotation)break;o=n.promptText}return o=Qa(o).promptText,mi(o).flatMap(n=>n.kind==="text"?[n.text]:[]).join("").trim()}function WD(e){let t=[];for(let o of e){let n=cG(o.text);n!==""&&(t.at(-1)?.prompt===n&&t.pop(),t.push({id:o.id,prompt:n}))}return t}function GD(e){let{direction:t,entries:o,position:n,draft:r}=e,a=-1;if(n!==null&&n.recalled===r&&(a=o.findIndex(i=>i.id===n.id),a<0&&(a=o.findLastIndex(i=>i.prompt===n.recalled))),a<0&&(t==="forward"||r!==""))return null;let s=t==="forward"?o[a+1]:o[(a<0?o.length:a)-1];return s!==void 0?{position:{id:s.id,recalled:s.prompt},prompt:s.prompt}:t==="forward"?{position:null,prompt:""}:null}function jD(e){let{documentKey:t,promptRef:o,editorRef:n,blocked:r,readSentMessages:a,show:s}=e,i=E(null);return(d,c)=>{if(r||c.shiftKey||c.altKey||c.metaKey||c.ctrlKey||c.isComposing||c.keyCode===229)return!1;let u=o.current,m=i.current,p=m?.documentKey===t?m.position:null,f=d==="ArrowUp"?"back":"forward";if(p?.recalled!==u&&(f==="forward"||u!=="")||n.current?.isCaretOnVisualEdge(f==="back"?"start":"end")!==!0)return!1;let g=GD({direction:f,entries:WD(a()),position:p,draft:u});return g===null?!1:(i.current=g.position===null?null:{documentKey:t,position:g.position},s(g.prompt),!0)}}$();function uG(e,t){let o=e.name.toLowerCase(),n=en(e).toLowerCase(),r=e.shortDescription?.toLowerCase()??"",a=e.description?.toLowerCase()??"",s=e.scope?.toLowerCase()??"",i=[Fn({value:o,query:t,exactBase:0,prefixBase:2,boundaryBase:4,includesBase:6,fuzzyBase:100,boundaryMarkers:["-","_","/"]}),Fn({value:n,query:t,exactBase:1,prefixBase:3,boundaryBase:5,includesBase:7,fuzzyBase:110}),Fn({value:r,query:t,exactBase:20,prefixBase:22,boundaryBase:24,includesBase:26}),Fn({value:a,query:t,exactBase:30,prefixBase:32,boundaryBase:34,includesBase:36}),Fn({value:s,query:t,exactBase:40,prefixBase:42,includesBase:44})].filter(d=>d!==null);return i.length===0?null:Math.min(...i)}function VD(e,t,o=Number.POSITIVE_INFINITY){let n=e.filter(xr),r=qf(t,{trimLeadingPattern:/^\$+/});if(!r)return n;let a=[];for(let s of n){let i=uG(s,r);i!==null&&fN(a,{item:s,score:i,tieBreaker:`${en(s).toLowerCase()}\0${s.name}`},o)}return a.map(s=>s.item)}var QD=[],XD=[],vl=Object.freeze({environmentId:"",threadId:""}),YD=e=>e.prompt,JD=e=>e.images.length>0||e.persistedAttachments.length>0||e.terminalContexts.length>0||e.elementContexts.length>0||e.browserAnnotations.length>0||e.reviewComments.length>0,pG=()=>[],ZD=e=>pG,e_=(e,t)=>{let o=new Map(e.map(n=>[n.id,n]));return t.flatMap(n=>{let r=o.get(n);return r?[r]:[]})},t_=(e,t)=>e.length===t.length&&e.every((o,n)=>o.id===t[n]);function YC(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 mG=1e4;function fG(e,t){if(t==="")return 0;let o=e.toLowerCase(),n=o.slice(o.lastIndexOf("/")+1),r=Fn({value:n,query:t,exactBase:0,prefixBase:100,boundaryBase:200,includesBase:300,fuzzyBase:400});return r!==null?r:Fn({value:o,query:t,exactBase:1e3,prefixBase:1100,boundaryBase:1200,includesBase:1300,fuzzyBase:1400})??mG}function o_(e){let t=qf(e.query),o=[];e.folders.forEach((a,s)=>{e.groups.find(d=>d.cwd===a.cwd)?.entries.forEach((d,c)=>{o.push({hit:{folder:a,entry:d},quality:fG(d.path,t),position:c,folderIndex:s})})});let n=o.toSorted((a,s)=>a.quality-s.quality||a.position-s.position||a.folderIndex-s.folderIndex).slice(0,Ox),r=[];for(let{hit:a}of n)r.includes(a.folder.id)||r.push(a.folder.id);return r.flatMap(a=>n.filter(({hit:s})=>s.folder.id===a).map(({hit:s})=>s))}function n_(e){return e.map(t=>({id:`member:${t.memberId}`,type:"member",candidate:t,label:t.name,description:[t.title,t.machineLabel].filter(o=>o!==null).join(" / "),section:t.inTeam?"members-team":"members-project"}))}var r_=(e,t,o)=>o.endsWith(" ")&&e[t]===" "?t+1:t,gG=Object.freeze([]),hG=Object.freeze([]),yG=()=>hG,vG=()=>gG,CG=Object.freeze([]),xG=Object.freeze([]),bG=()=>CG,wG=Object.freeze({groups:Object.freeze([]),isPending:!1}),TG=()=>wG,IG=(e,t)=>`${e.replace(/[\\/]+$/,"")}/${t}`;function Jc(e){return e===null?null:`${e.kind}:${e.rangeStart}:${e.rangeEnd}:${e.query}`}function s_({prompt:e,pluginCommands:t=[],onSelectPluginCommand:o,selectedProvider:n,selectedProviderStatus:r,planModeUiEnabled:a,showSkillsInSlashMenu:s,recentSlashCommandIds:i,environmentId:d,gitCwd:c,useComposerPathSearch:u,useComposerPathSearchAcross:m,readComposerSnapshot:p,applyPromptReplacement:f,onInteractionModeChange:g,onOpenModelPicker:h,onSlashCommandUsed:y}){let{t:x}=z(),C=Zn(),[b,L]=q(()=>Po(e,e.length)),[w,k]=q(null),[I,T]=q(null),[S,P]=q(null),A=w!==null&&Jc(b)===w?null:b,N=A?.kind==="path"?A.query:"",B=A?.kind==="path",O=vo(),j=(O?.data.useThreadFolders??bG)(O?.target??vl),U=j.length>1&&m!==void 0,D=W(()=>U&&B?j.map(me=>me.cwd):xG,[j,B,U]),J=u({environmentId:d,cwd:B&&!U?c:null,query:B&&!U?N:null}),G=(m??TG)({environmentId:d,cwds:D,query:D.length>0?N:null}),M=W(()=>D.length>0?o_({query:N,folders:j,groups:G.groups}):[],[G.groups,D,j,N]),X=U?G.isPending:J.isPending,F=O?.data.threadReferences,ee=(F?.useCandidates??vG)({target:O?.target??vl,query:B?N:null}),Y=O?.data.memberMentions,ae=(Y?.useCandidates??yG)({target:O?.target??vl,query:B?N:null}),te=W(()=>{if(!A)return[];if(A.kind==="path"){let me=ue=>ee.length>0||ae.length>0?{section:ue}:{},Me=U?M.map(({folder:ue,entry:ce})=>({id:`path:${ce.kind}:${ue.id}:${ce.path}`,type:"path",path:ce.path,linkPath:IG(ue.cwd,ce.path),pathKind:ce.kind,label:a_(ce.path),description:ce.path.slice(0,Math.max(0,ce.path.lastIndexOf("/"))),section:`folder:${ue.id}`,sectionLabel:ue.name})):J.entries.map(ue=>({id:`path:${ue.kind}:${ue.path}`,type:"path",path:ue.path,pathKind:ue.kind,label:a_(ue.path),description:ue.path.slice(0,Math.max(0,ue.path.lastIndexOf("/"))),...me("files")}));return[...n_(ae),...Me,...ee.map(ue=>({id:`thread:${ue.reference.environmentId}:${ue.reference.threadId}`,type:"thread",reference:ue.reference,label:C(ue.reference.title),description:[ue.projectLabel,ue.machineLabel].filter(ce=>ce!==null).join(" / "),...me("threads")}))]}if(A.kind==="slash-command"){let me=[{id:"slash:model",type:"slash-command",command:"model",label:"/model",description:x("composer.switchModelDesc")},...a?[{id:"slash:plan",type:"slash-command",command:"plan",label:"/plan",description:x("composer.planDesc")},{id:"slash:default",type:"slash-command",command:"default",label:"/default",description:x("composer.defaultDesc")}]:[]];return gN({builtIns:me,plugins:t,provider:n,commands:r?.slashCommands??[],skills:r?.skills??[],showSkills:s,query:A.query,recentIds:i,providerDescription:x("composer.runProviderCommand")})}if(A.kind==="skill"||A.kind==="slash-skill"){let me=A.kind==="skill"?r?.skills??[]:hA(r?.skills??[],s);return VD(me,A.query).map(Me=>({id:`skill:${n}:${Me.name}`,type:"skill",provider:n,skill:Me,label:en(Me),description:Me.shortDescription??Me.description??""}))}return[]},[C,t,A,a,i,n,r,s,x,ee,ae,M,U,J.entries]),de=A!==null&&!(A.kind==="slash-skill"&&te.length===0),ge=A?`${A.kind}:${A.query.trim().toLowerCase()}`:null,ne=W(()=>{let me=YC({items:te,highlightedItemId:I,currentSearchKey:ge,highlightedSearchKey:S});return te.find(Me=>Me.id===me)??null},[te,I,ge,S]),Z=R(()=>{let me=p(),Me=Po(me.value,me.expandedCursor),ue=w!==null&&Jc(Me)===w?null:Me;return{snapshot:me,trigger:ue}},[p,w]),ve=R(me=>{let{snapshot:Me,trigger:ue}=Z();if(!ue)return;if((me.type==="slash-command"||me.type==="provider-slash-command"||me.type==="plugin-slash-command"||me.type==="skill")&&y?.(me.id),me.type==="path"||me.type==="thread"||me.type==="member"){let ze=me.type==="path"?Ls(me.linkPath??me.path):me.type==="thread"?F?.serialize(me.reference)??null:Y?.serialize(me.candidate)??null;if(ze===null)return;let et=`${ze} `,Et=r_(Me.value,ue.rangeEnd,et);f(ue.rangeStart,Et,et,{expectedText:Me.value.slice(ue.rangeStart,Et)})&&T(null);return}if(me.type==="slash-command"){if(me.command==="model"){f(ue.rangeStart,ue.rangeEnd,"",{expectedText:Me.value.slice(ue.rangeStart,ue.rangeEnd),focusEditorAfterReplace:!1})&&(T(null),h());return}g(me.command==="plan"?"plan":"default"),f(ue.rangeStart,ue.rangeEnd,"",{expectedText:Me.value.slice(ue.rangeStart,ue.rangeEnd)})&&T(null);return}let ce=me.type==="provider-slash-command"||me.type==="plugin-slash-command"?`/${me.command.name} `:`$${me.skill.name} `,Ze=r_(Me.value,ue.rangeEnd,ce);f(ue.rangeStart,Ze,ce,{expectedText:Me.value.slice(ue.rangeStart,Ze)})&&(T(null),me.type==="plugin-slash-command"&&o?.({pluginId:me.pluginId,name:me.command.name}))},[f,g,h,y,o,Z,F,Y]);H(()=>{if(!de){T(null),P(null);return}let me=YC({items:te,highlightedItemId:I,currentSearchKey:ge,highlightedSearchKey:S});T(Me=>Me===me?Me:me),P(Me=>Me===ge?Me:ge)},[I,S,te,de,ge]);let he=R(me=>{T(me),P(ge)},[ge]),Ae=R(()=>{let{trigger:me}=Z();return me===null||me.kind==="slash-skill"&&!de?!1:(k(Jc(me)),T(null),!0)},[de,Z]),De=R(me=>{k(Jc(Po(me,me.length))),L(null),T(null)},[]),je=R((me,Me)=>{let ue=Zo(me,Me),ce=Po(me,ue);L(ce);let Ze=Jc(ce);k(pt=>pt!==null&&pt!==Ze?null:pt),T(null),P(null)},[]),ot=R(()=>{T(null)},[]);return{composerTrigger:b,menuTrigger:A,composerMenuItems:te,composerMenuOpen:de,composerMenuSearchKey:ge,activeComposerMenuItem:ne,resolveActiveComposerTrigger:Z,onSelectComposerItem:ve,onComposerMenuItemHighlighted:he,onMenuEscape:Ae,resetForDocumentChange:je,dismissTrigger:ot,dismissTriggerIn:De,pathSearchPending:X,highlightedItemId:I,setTrigger:L,setHighlightedItemId:T,setHighlightedSearchKey:P}}function a_(e){let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t>=0?e.slice(t+1):e}$();function i_(e,t){let o=W(()=>cp((e??[]).filter(xr)),[e]);return R((n,r)=>{let a=eT(n,r,o,hC);a!==null&&t(a.start,a.end,a.replacement,{expectedText:r.slice(a.start,a.end)})},[t,o])}var l_=pe(function(t){let{handleRef:o,api:n,composerDraftTarget:r,composerDocumentKey:a,promptRef:s,editorRef:i,menuAnchor:d,resolvedTheme:c,selectedProvider:u,selectedProviderStatus:m,planModeUiEnabled:p,showSkillsInSlashMenu:f,recentSlashCommandIds:g,environmentId:h,gitCwd:y,onSlashCommandUsed:x,onOpenModelPicker:C,onInteractionModeChange:b,onToggleInteractionMode:L,activePendingProgress:w,activePendingRequestId:k,hasPendingUserInputs:I,changeUserInputCustomAnswer:T,terminalContexts:S,showTerminalContexts:P,showEditor:A,isApprovalState:N,editorClassName:B,placeholder:O,disabled:j,onPaste:U,onSubmit:D,isMobileViewport:J,isDraftRoute:G,stashMenuOpen:M,stashEntries:X,onRestoreStashEntry:F,onDeleteStashEntry:ee,onCloseStashMenu:Y,onPromptEdited:ae,onUnclaimedEscape:te}=t,de=n.draft.useThreadDraftSelector(r,YD),ge=n.draft.useThreadDraftSelector(r,JD),ne=vo(),Z=(ne?.data.useSentMessagesReader??ZD)(ne?.target??vl),ve=n.draft.useStore,he=ve(Ce=>Ce.setPrompt),Ae=ve(Ce=>Ce.setTerminalContexts),De=ve(Ce=>Ce.removeTerminalContext),je=uo(de,de.length),ot=_r(a,de,{cursor:je,expandedCursor:de.length}),[me,Me]=q(()=>({documentKey:a,cursor:ot.cursor})),ue=me.documentKey===a?me.cursor:ot.cursor,ce=R(Ce=>{Me(Ue=>{let rt=Ue.documentKey===a?Ue.cursor:_r(a,s.current).cursor,Lt=typeof Ce=="function"?Ce(rt):Ce,wt=s.current,Ot=Zo(wt,Lt);return lA(a,wt,Lt,Ot),Ue.documentKey===a&&Ue.cursor===Lt?Ue:{documentKey:a,cursor:Lt}})},[a,s]),Ze=E(!1),pt=E(!1),ze=E([]),et=E(null),Et=R(Ce=>{he(r,Ce)},[r,he]),ft=R((Ce,Ue,rt,Lt,wt)=>{T(Ce,Ue,rt,Lt,wt),s.current=Ue},[T,s]),Ct=R((Ce,Ue,rt,Lt)=>{let wt=s.current,Ot=Math.max(0,Math.min(wt.length,Ce)),Ro=Math.max(Ot,Math.min(wt.length,Ue));if(Lt?.expectedText!==void 0&&wt.slice(Ot,Ro)!==Lt.expectedText)return!1;let on=tA(s.current,Ce,Ue,rt),Fr=uo(on.text,on.cursor),ka=Zo(on.text,Fr);s.current=on.text;let As=w?.activeQuestion;return As&&I?ft(As.id,on.text,Fr,ka,!1):Et(on.text),ce(Fr),Qt(Po(on.text,ka)),Lt?.focusEditorAfterReplace!==!1&&window.requestAnimationFrame(()=>{i.current?.focusAt(Fr)}),!0},[w?.activeQuestion,i,I,ft,s,ce,Et]),gt=R(()=>{let Ce=i.current?.readSnapshot();return Ce||{value:s.current,cursor:ue,expandedCursor:Zo(s.current,ue),terminalContextIds:S.map(Ue=>Ue.id)}},[ue,i,s,S]),Dt=(n.slashCommands?.useCommands??(()=>[]))(h,r),Mt=s_({pluginCommands:Dt,onSelectPluginCommand:Ce=>n.slashCommands?.select(r,Ce),prompt:de,selectedProvider:u,selectedProviderStatus:m,planModeUiEnabled:p,showSkillsInSlashMenu:f,recentSlashCommandIds:g,environmentId:h,gitCwd:y,useComposerPathSearch:n.pathSearch.useComposerPathSearch,useComposerPathSearchAcross:n.pathSearch.useComposerPathSearchAcross,readComposerSnapshot:gt,applyPromptReplacement:Ct,onInteractionModeChange:b,onOpenModelPicker:C,onSlashCommandUsed:x}),{composerTrigger:se,composerMenuItems:Le,composerMenuOpen:be,activeComposerMenuItem:Xe,resolveActiveComposerTrigger:xt,onComposerMenuItemHighlighted:tt,onMenuEscape:It,pathSearchPending:po,highlightedItemId:Ko,setTrigger:Qt,setHighlightedItemId:gn}=Mt,At=se?.kind??null,St=se?.kind==="path"?se.query:"",bt=w?w.customAnswer:de,mo=N?"":bt,kt=Mt.resetForDocumentChange;H(()=>{kt(bt,ue)},[a,kt,bt,ue]),pt.current=be,ze.current=Le,et.current=Xe;let _t=At==="path"&&St.length>0&&po===!0,Xt=R(Ce=>{let Ue=S.findIndex(wt=>wt.id===Ce);if(Ue<0)return;let rt=n.terminalContext.removeInlinePlaceholder(s.current,Ue);s.current=rt.prompt,Et(rt.prompt),De(r,Ce);let Lt=uo(rt.prompt,rt.cursor);ce(Lt),Qt(Po(rt.prompt,rt.cursor))},[n.terminalContext,r,s,De,ce,Et,S,Qt]);fe(()=>{s.current=de,ce(Ce=>ir(de,Ce))},[a,de,s,ce]),H(()=>{ae(de)},[ae,de]),H(()=>{be&&Y()},[be,Y]);let nt=E(null);H(()=>{let Ce=w?.customAnswer;if(typeof Ce!="string"){if(nt.current!==null){s.current=de;let Ro=uo(de,de.length);ce(Ro),Qt(Po(de,Zo(de,Ro)))}nt.current=null;return}let Ue=k,rt=w?.activeQuestion?.id??null,Lt=nt.current?.requestId!==Ue||nt.current?.questionId!==rt,wt=s.current!==Ce;if(nt.current={requestId:Ue,questionId:rt},!Lt&&!wt)return;s.current=Ce;let Ot=uo(Ce,Ce.length);ce(Ot),Qt(Po(Ce,Zo(Ce,Ot))),gn(null)},[w?.customAnswer,w?.activeQuestion?.id,k,de,s]);let lt=i_(m?.skills,Ct),Bt=R((Ce,Ue,rt,Lt,wt)=>{if(w?.activeQuestion&&I){if(w.activeQuestion.allowFreeform===!1)return;ce(Ue),Qt(Lt?null:Po(Ce,rt)),ft(w.activeQuestion.id,Ce,Ue,rt,Lt);return}let Ot=s.current;s.current=Ce,Et(Ce),t_(S,wt)||Ae(r,e_(S,wt)),ce(Ue),Qt(Lt?null:Po(Ce,rt)),n.slashCommands?.readBinding(r)||lt(Ot,Ce)},[w?.activeQuestion,lt,I,ft,s,ce,Et,r,S,Ae,Qt]),Ht=Mt.onSelectComposerItem,Yt=R(Ce=>{Ze.current||(Ze.current=!0,window.requestAnimationFrame(()=>{Ze.current=!1}),Ht(Ce))},[Ht]),qo=R(Ce=>{if(Le.length===0)return;let Ue=Le.findIndex(Ro=>Ro.id===Ko),wt=((Ue>=0?Ue:Ce==="ArrowDown"?-1:0)+(Ce==="ArrowDown"?1:-1)+Le.length)%Le.length,Ot=Le[wt];gn(Ot?.id??null)},[Ko,Le,gn]),fo=Mt.dismissTriggerIn,go=R(Ce=>{s.current=Ce,Et(Ce),ce(uo(Ce,Ce.length)),fo(Ce)},[fo,s,ce,Et]),Jt=jD({documentKey:a,promptRef:s,editorRef:i,blocked:ge||I||N||j||M,readSentMessages:Z,show:go}),Un=(Ce,Ue)=>{if(Ce==="Escape")return Ue.isComposing||Ue.keyCode===229?!1:It()||(te?.()??!1);if(Ce==="Tab"&&Ue.shiftKey)return p?(L(),!0):!1;if((Ce==="ArrowUp"||Ce==="ArrowDown")&&Jt(Ce,Ue))return!0;let{trigger:rt}=xt();if(pt.current||rt!==null){let Ot=ze.current,Ro=et.current??Ot[0];if(Ce==="ArrowDown"&&Ot.length>0)return qo("ArrowDown"),!0;if(Ce==="ArrowUp"&&Ot.length>0)return qo("ArrowUp"),!0;if((Ce==="Enter"||Ce==="Tab")&&Ro)return Yt(Ro),!0}let wt=Ce==="Enter"?YM({isMobileViewport:J,shiftKey:Ue.shiftKey,modifierKey:Ue.metaKey||Ue.ctrlKey,isDraftThread:G}):null;return wt?(D(void 0,wt),!0):!1};return pr(o,()=>({readSnapshot:gt,readDraftPrompt:()=>de,applyPromptReplacement:Ct,syncCursor:(Ce,Ue)=>{ce(Ce),Qt(Ue)},resetCursorState:Ce=>{let Ue=Ce?.prompt??s.current,rt=ir(Ue,Ce?.cursor??0);gn(null),ce(rt),Qt(Ce?.detectTrigger?Po(Ue,Zo(Ue,rt)):null)}}),[Ct,de,s,gt,ce,gn,Qt]),v(oe,{children:[M&&!be&&!N&&l(XC,{anchor:d,children:l(qD,{entries:X,onRestore:F,onDelete:ee,onClose:Y})}),be&&!N&&l(XC,{anchor:d,children:l(UD,{environmentId:h,items:Le,resolvedTheme:c,isLoading:_t,triggerKind:At,activeItemId:Xe?.id??null,onHighlightedItemChange:tt,onSelect:Yt})}),A?l(ul,{editorRef:i,documentKey:a,value:mo,cursor:ue,terminalContexts:P?S:QD,skills:m?.skills??XD,...B?{className:B}:{},onRemoveTerminalContext:Xt,onChange:Bt,onCommandKeyDown:Un,onPaste:U,placeholder:O,disabled:j}):null]})});function d_({message:e}){return e?l("p",{role:"alert",className:"px-3 pb-2 text-xs text-destructive-foreground sm:px-4","data-chat-composer-validation":"prompt-length",children:e}):null}function c_(e){let{t}=z(),{message:o,agentNotChosen:n,agentUnavailable:r,agentUnavailableNoChoice:a,modelSendBlock:s,selectedModelStatus:i,modelNotes:d,onChooseModel:c}=e;return v(oe,{children:[l(d_,{message:o}),n?l("p",{role:"status",className:"px-3 pb-2 text-xs text-muted-foreground sm:px-4","data-chat-composer-agent-not-chosen":"true",children:t("composer.agentNotChosen")}):null,r?l("p",{role:"status",className:"px-3 pb-2 text-xs text-warning sm:px-4","data-chat-composer-agent-unavailable":"true",children:t(a?"composer.agentUnavailableNoChoice":"composer.agentUnavailable")}):null,d.map(u=>l("p",{role:"status",className:"px-3 pb-2 text-xs text-muted-foreground sm:px-4","data-chat-composer-model-note":u.kind,children:iD(t,u)},`${u.kind}:${u.kind==="option-unsupported"?u.optionId:""}`)),s===null?null:v("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":i,children:[t(s.blockKey),s.canChooseModel?l(K,{type:"button",size:"sm",variant:"ghost",className:"h-6 px-2 text-xs","data-chat-composer-choose-model":"true",onClick:()=>{c()},children:t("composer.chooseModel")}):null]})]})}function u_(e){let{t}=z(),o=HC();return!e.eligible||o==="unsupported"?null:l("p",{className:"px-3 pb-2 text-xs text-muted-foreground sm:px-4","data-chat-composer-group-send":"true","data-chat-composer-group-send-state":o,children:t(o==="ready"?"composer.groupSendHint":o==="error"?"composer.groupSendRosterFailed":"composer.groupSendRosterWaiting")})}function p_(e){let{t}=z();if(!e.mode)return null;let o=e.unavailableReason??t(e.isMobileViewport?"composer.shellCommand.touchHint":"composer.shellCommand.hint");return v("div",{"data-composer-shell-command-mode":"true",className:"flex min-w-0 items-start gap-1.5 px-1 pb-1 text-xs",children:[l(Vo,{"aria-hidden":"true",className:"mt-0.5 size-3.5 shrink-0 text-primary"}),l("span",{className:"shrink-0 font-medium text-primary",children:t("composer.shellCommand.mode")}),l("span",{className:"min-w-0 flex-1 wrap-break-word text-muted-foreground",children:o})]})}var SG=[];function m_(e){let{t}=z(),{props:o,model:n,status:r,submit:a,badges:s,traits:i,composerDraft:d}=e,c=e.pendingUserInputs.length>0,u=W(()=>e.composerImages.filter(b=>Tn(b)==="image"),[e.composerImages]),m=W(()=>new Set(e.nonPersistedComposerImageIds),[e.nonPersistedComposerImageIds]),p=e.isMobileViewport&&!e.isComposerCollapsedMobile&&e.pendingPrimaryAction!==null,f=r.phase==="running"&&!e.pluginAction||r.isSendBusy||r.projectSelectionRequired||r.environmentUnavailable!==null||!d.hasSendableContent,g=!e.isComposerCollapsedMobile&&!e.isComposerApprovalState,h=jf({activeThreadId:r.activeThread?.id??null,isLocalDraftThread:o.routeKind==="draft",isComposerApprovalState:e.isComposerApprovalState,hasPendingProgress:e.activePendingProgress!==null,hasPendingAction:e.pendingPrimaryAction!==null,shellCommandMode:a.shellCommandMode}),y=bD({machineUnavailable:r.environmentUnavailable!==null,sessionStarted:r.activeThread?.session!=null,sessionDisconnected:r.phase==="disconnected"}),x=wD(y),C=TD({t,tailPlaceholderKey:x,isComposerApprovalState:e.isComposerApprovalState,activePendingProgress:e.activePendingProgress!==null,showPlanFollowUpPrompt:e.showPlanFollowUpPrompt,projectSelectionRequired:r.projectSelectionRequired,noProviderAvailable:n.noProviderAvailable});return l("div",{"data-chat-composer-main-surface":"true",className:"group relative z-10 rounded-composer p-px transition-colors duration-200",children:v("div",{ref:e.surfaceRef,"data-chat-composer-surface":"true","data-chat-composer-mobile-collapsed":e.isComposerCollapsedMobile?"true":"false",className:V("rounded-[20px] transition-[background-color] duration-200",e.isDragOverComposer?"bg-accent/45 ring-1 ring-primary/70":null,r.projectSelectionRequired?"opacity-75":null),children:[o.firstRow?l("div",{className:"@container/composer-first-row flex select-none items-center gap-2 px-3 pt-2 sm:px-4","data-conversation-card-first-row":!0,"data-chat-composer-collapsed-controls":"true",children:o.firstRow}):null,l(hD,{decisionOccupiesComposer:e.isComposerApprovalState}),e.showCollapsedMobilePromptRow?l(FD,{pluginAction:e.pluginAction,api:o.api,composerDraftTarget:o.composerDraftTarget,pendingCustomAnswer:e.activePendingProgress?e.activePendingProgress.customAnswer:null,noProviderAvailable:n.noProviderAvailable,groupSendEligible:h,modelSendDisabledReason:n.sendDisabledReason,groupSendDisabledReason:r.groupSendDisabledReason,environmentUnavailable:r.environmentUnavailable!==null,projectSelectionRequired:r.projectSelectionRequired,onExpand:e.expandMobileComposer,inlineTasksBadge:s.inlineTasksBadge,inlineStashBadge:s.inlineStashBadge,submitDisabled:f,submitLabel:t("composer.sendMessage"),onSubmit:()=>a.submitComposerOrShellCommand()}):null,l(kG,{input:e,pendingUserInputs:c,showMobilePendingAnswerActions:p,composerPreviewableImages:u,nonPersistedComposerImageIdSet:m,composerPlaceholder:C}),l(c_,{message:e.providerInputSubmissionError??a.composerSubmissionError,agentNotChosen:r.agentNotChosen,agentUnavailable:n.agentUnavailable,agentUnavailableNoChoice:n.agentUnavailableNoChoice,modelSendBlock:n.modelSendBlock,selectedModelStatus:n.selectedModelStatus,modelNotes:n.modelNotes,onChooseModel:e.openModelPicker}),l(u_,{eligible:h}),g?l(OD,{pluginAction:e.pluginAction,isComposerFooterCompact:e.isComposerFooterCompact,isComposerPrimaryActionsCompact:e.isComposerPrimaryActionsCompact,isMobileViewport:e.isMobileViewport,showMobilePendingAnswerActions:p,hasPendingUserInputs:c,projectSelectionRequired:r.projectSelectionRequired,noProviderAvailable:n.noProviderAvailable,composerAttachmentInputRef:e.composerAttachmentInputRef,onComposerAttachmentInputChange:e.onComposerAttachmentInputChange,slots:o.slots,selectedInstanceId:n.selectedInstanceId,unavailableAgentInstanceId:r.unavailableAgentInstanceId,agentNotChosen:r.agentNotChosen,agentUnavailable:n.agentUnavailable,providerInstanceEntries:n.providerInstanceEntries,lockedProvider:r.lockedProvider,lockedContinuationGroupKey:n.lockedContinuationGroupKey,onAgentInstanceChange:n.onAgentInstanceChange,selectedModelForPickerWithCustomFallback:n.selectedModelForPickerWithCustomFallback,selectedModelStatus:n.selectedModelStatus,selectedModelUnconfirmed:n.selectedModelUnconfirmed,keybindings:o.keybindings,modelOptionsByInstance:n.modelOptionsByInstance,terminalOpen:o.terminalOpen,isComposerModelPickerOpen:e.isComposerModelPickerOpen,setIsComposerModelPickerOpen:e.setIsComposerModelPickerOpen,getModelDisabledReason:o.getModelDisabledReason,getModelContinuationLabel:o.getModelContinuationLabel,onContinueInModel:o.onContinueInModel,onProviderModelSelect:o.onProviderModelSelect,environmentId:o.environmentId,routeKind:o.routeKind,draftId:o.draftId,activeThread:r.activeThread,interactionMode:r.interactionMode,runtimeMode:r.runtimeMode,composerProviderControls:n.composerProviderControls,composerNativeMode:n.composerNativeMode,canSwitchNativeMode:n.canSwitchNativeMode,providerTraitsMenuContent:i.providerTraitsMenuContent,providerTraitsPicker:i.providerTraitsPicker,toggleInteractionMode:o.toggleInteractionMode,handleRuntimeModeChange:o.handleRuntimeModeChange,handleComposerNativeModeChange:n.handleComposerNativeModeChange,inlineTasksBadge:s.inlineTasksBadge,inlineStashBadge:s.inlineStashBadge,activeThreadModelDisplayName:n.activeThreadModelDisplayName,pendingPrimaryAction:e.pendingPrimaryAction,phase:r.phase,continuationChecking:r.continuationChecking,showPlanFollowUpPrompt:e.showPlanFollowUpPrompt,composerDraft:d,isSendBusy:r.isSendBusy,sendDisabledReason:n.sendDisabledReason,groupSendDisabledReason:r.groupSendDisabledReason,groupSendEligible:h,environmentUnavailable:r.environmentUnavailable,handleInterruptPrimaryAction:e.actions.handleInterruptPrimaryAction,interruptArmed:r.interruptArmed,stopping:r.stopping,handleImplementPlanInNewThreadPrimaryAction:e.actions.handleImplementPlanInNewThreadPrimaryAction,shellCommandMode:a.shellCommandMode,shellCommandUnavailableReason:a.hostShellCommand?.unavailableReason??null,compactDisabled:e.compactDisabled,resolvedCompactDisabledReason:n.resolvedCompactDisabledReason,compactThreadContext:e.compactThreadContext}):null]})})}function kG(e){let{input:t,pendingUserInputs:o,showMobilePendingAnswerActions:n}=e,{props:r,model:a,status:s,submit:i,stash:d,composerDraft:c}=t,u=t.activePendingProgress?.activeQuestion?.allowFreeform===!1;return v("div",{ref:t.setComposerMenuAnchor,className:V("relative px-3 pb-2 sm:px-4","pt-3.5 sm:pt-4",t.isComposerApprovalState&&"pb-3 sm:pb-4",t.isComposerCollapsedMobile&&"hidden"),children:[l(xD,{api:r.api,environmentId:r.environmentId,composerDraftTarget:r.composerDraftTarget,isComposerCollapsedMobile:t.isComposerCollapsedMobile,isComposerApprovalState:t.isComposerApprovalState,hasPendingUserInputs:o,supportsAttachmentUploads:r.supportsAttachmentUploads,uploadsByImageId:t.uploadsByImageId,composerImages:t.composerImages,composerPreviewableImages:e.composerPreviewableImages,composerBrowserAnnotations:c.browserAnnotations,composerReviewComments:c.reviewComments,composerElementContexts:c.elementContexts,nonPersistedComposerImageIdSet:e.nonPersistedComposerImageIdSet,removeComposerDraftBrowserAnnotation:t.removeComposerDraftBrowserAnnotation,removeComposerDraftReviewComment:t.removeComposerDraftReviewComment,removeComposerDraftElementContext:t.removeComposerDraftElementContext,removeComposerImage:t.removeComposerImage,onExpandImage:r.onExpandImage}),l(p_,{mode:i.shellCommandMode,isMobileViewport:t.isMobileViewport,unavailableReason:i.hostShellCommand?.unavailableReason??null}),v("div",{className:"relative",children:[l(l_,{handleRef:t.promptInputRef,api:r.api,composerDraftTarget:r.composerDraftTarget,composerDocumentKey:t.composerDocumentKey,promptRef:r.promptRef,editorRef:t.composerEditorRef,menuAnchor:t.composerMenuAnchor,resolvedTheme:r.resolvedTheme,selectedProvider:a.selectedProvider,selectedProviderStatus:a.selectedProviderStatus,planModeUiEnabled:a.planModeUiEnabled,showSkillsInSlashMenu:r.settings.showSkillsInSlashMenu,recentSlashCommandIds:r.recentSlashCommandIds??SG,environmentId:r.environmentId,gitCwd:r.gitCwd,onSlashCommandUsed:r.onSlashCommandUsed,onOpenModelPicker:t.openModelPicker,onInteractionModeChange:t.switchInteractionMode,onToggleInteractionMode:r.toggleInteractionMode,activePendingProgress:t.activePendingProgress,activePendingRequestId:t.pendingUserInputs[0]?.requestId??null,hasPendingUserInputs:o,changeUserInputCustomAnswer:t.changeUserInputCustomAnswer,terminalContexts:c.terminalContexts,showTerminalContexts:!t.isComposerApprovalState&&!o,showEditor:!u,isApprovalState:t.isComposerApprovalState,editorClassName:n?"max-sm:pb-11":void 0,placeholder:e.composerPlaceholder,disabled:t.isComposerApprovalState||s.projectSelectionRequired,onPaste:t.handleComposerPaste,onSubmit:t.handleComposerSubmit,isMobileViewport:t.isMobileViewport,isDraftRoute:r.routeKind==="draft",stashMenuOpen:t.isStashMenuOpen,stashEntries:d.stashQueue,onRestoreStashEntry:d.restoreStashEntry,onDeleteStashEntry:d.deleteStashEntry,onCloseStashMenu:d.closeStashMenu,onPromptEdited:t.onPromptEdited,onUnclaimedEscape:t.handleUnclaimedEscape}),n?l(LG,{input:t}):null]})]})}function LG(e){let{input:t}=e,{model:o,status:n,badges:r}=t;return v("div",{"data-chat-composer-mobile-pending-actions":"true",className:"absolute bottom-0 right-0 flex items-center justify-end gap-1",children:[r.inlineTasksBadge,r.inlineStashBadge,l(gl,{compact:!0,pendingAction:t.pendingPrimaryAction,isRunning:!1,showPlanFollowUpPrompt:!1,promptHasText:!1,isSendBusy:n.isSendBusy,sendDisabledReason:o.sendDisabledReason,isEnvironmentUnavailable:n.environmentUnavailable!==null||o.noProviderAvailable||n.projectSelectionRequired,hasSendableContent:!1,preserveComposerFocusOnPointerDown:!0,onInterrupt:t.actions.handleInterruptPrimaryAction,interruptArmed:n.interruptArmed,stopping:n.stopping,onImplementPlanInNewThread:t.actions.handleImplementPlanInNewThreadPrimaryAction})]})}function f_(e){let{formRef:t,onSubmit:o,onFocusCapture:n,onBlurCapture:r,dragHandlers:a,onDragLeaveCapture:s,badges:i,stashQueueLength:d,isStashMenuOpen:c,stashPulse:u,toggleStashMenu:m,drawers:p,children:f}=e;return v("form",{ref:t,onSubmit:o,onFocusCapture:n,onBlurCapture:r,onDragEnterCapture:a.onDragEnter,onDragOverCapture:a.onDragOver,onDragLeaveCapture:s,onDropCapture:a.onDrop,className:V("mx-auto w-full min-w-0 max-w-3xl",i.hasShoulderTab&&"pt-7"),"data-chat-composer-form":"true",children:[p,v("div",{className:"relative",children:[i.showShoulderTabs&&i.visibleTasksProgress&&i.visibleTaskSteps?l(Jf,{expanded:!1,hasTrailingShoulder:d>0,onDismiss:i.dismissTasks,onToggle:i.toggleTasksDrawer,progress:i.visibleTasksProgress,steps:i.visibleTaskSteps}):null,i.showShoulderTabs?l(Yf,{count:d,menuOpen:c,pulseKey:u.key,pulsing:u.active,onToggleMenu:m}):null,f]})]})}function g_(e){let{t}=z(),n=(e.activePendingProgress?.activeQuestion?.multiSelect??!1)||(e.pendingPrimaryAction?.isLastQuestion??!1);return l("div",{className:"px-3 pb-3 sm:px-4",children:v("div",{"data-chat-composer-mobile-pending-compact":"true",className:V("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:l("button",{type:"button",className:V("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:r=>r.preventDefault(),onClick:e.expandMobileComposer,"aria-label":t("composer.writeCustomAnswer"),children:e.activePendingProgress?.customAnswer||t("composer.writeCustomAnswer")}),e.inlineTasksBadge,e.inlineStashBadge,n?l(gl,{compact:!0,pendingAction:e.pendingPrimaryAction,isRunning:!1,showPlanFollowUpPrompt:!1,promptHasText:!1,isSendBusy:e.isSendBusy,sendDisabledReason:e.sendDisabledReason,isEnvironmentUnavailable:e.isEnvironmentUnavailable,hasSendableContent:!1,preserveComposerFocusOnPointerDown:!0,onInterrupt:e.handleInterruptPrimaryAction,onImplementPlanInNewThread:e.handleImplementPlanInNewThreadPrimaryAction}):null]})})}var h_={accept:0,acceptForSession:1,acceptAlways:2,decline:3,cancel:4};function y_(e){return e.map((t,o)=>({option:t,index:o})).toSorted((t,o)=>h_[t.option.decision]-h_[o.option.decision]||t.index-o.index).map(t=>t.option)}function v_(e){return{leading:e.filter(t=>t.decision==="cancel"),trailing:e.filter(t=>t.decision!=="cancel").toReversed()}}function C_(e){return[...e.filter(t=>t.tone!=="primary"),...e.filter(t=>t.tone==="primary")]}$();var PG=2e3,RG="min-h-8 max-w-full py-1.5 whitespace-normal text-start pointer-coarse:min-h-11 pointer-coarse:min-w-11",EG=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 MG(e,t){if(e.displayKind!=="standard")return e.label;switch(e.decision){case"cancel":return t("composer.cancel");case"decline":return t("composer.decline");case"acceptForSession":return t("composer.alwaysAllowSession");case"acceptAlways":return t("composer.alwaysAllow");case"accept":return t("composer.approve");default:return e.label}}function AG(e,t){let o=[];return t<9&&o.push(String(t+1)),e==="accept"&&o.push("Enter"),e==="cancel"&&o.push("Escape"),o.length>0?o.join(" "):void 0}var eg=pe(function({requestId:t,isResponding:o,options:n,keybindings:r,declineReasonRelay:a,shortcuts:s=!0,onRespondToApproval:i}){let{t:d}=z(),c=y_(n??EG(d)),u=it(),m=(a==="native"||a==="queued")&&c.some(T=>T.decision==="decline"),[p,f]=q(!1),[g,h]=q(""),y=E([]);H(()=>{h(""),f(!1)},[t]);let x=R(T=>{let S=T==="decline"?g.trim():"";i(t,T,S.length>0?S:void 0)},[g,i,t]),C=R(T=>{if(T==="decline"&&m&&!p){f(!0);return}x(T)},[m,p,x]),b=R(T=>{let S=y.current.filter(N=>N!==null);if(S.length===0)return;let P=S.findIndex(N=>N===document.activeElement),A=P===-1?T===1?0:S.length-1:(P+T+S.length)%S.length;S[A]?.focus()},[]);if(u.pane.useKeydown(T=>{if(!s||o||T.defaultPrevented||u.terminalFocus.getOwner()!==null||T.isComposing||T.keyCode===229||T.key==="Enter"&&!T.metaKey&&!T.ctrlKey&&!T.altKey&&!T.shiftKey&&lS(T.target))return;let S=er(T.target);if(r&&(!S||T.metaKey||T.ctrlKey||T.altKey)){let N=u.keybindings.approvalDecisionFromCommand(u.keybindings.resolveShortcutCommand(T,r));if(N!==null&&c.some(B=>B.decision===N)){T.preventDefault(),x(N);return}}if(S)return;let P=dS(T,c);if(P===null)return;if(T.preventDefault(),P.type==="move"){b(P.delta);return}let A=c[P.index];A&&C(A.decision)},{target:"document"}),p)return v("div",{className:"flex w-full min-w-0 flex-col gap-1.5",children:[v("div",{className:"flex min-w-0 items-center gap-1",children:[l(Vr,{type:"text",value:g,autoFocus:!0,disabled:o,maxLength:PG,placeholder:d("approval.declineReasonPlaceholder"),"aria-label":d("approval.declineReasonLabel"),"data-approval-decline-reason":"true",className:"h-8 min-w-0 flex-1 pointer-coarse:min-h-11",onChange:T=>h(T.target.value),onKeyDown:T=>{if(!(T.nativeEvent.isComposing||T.nativeEvent.keyCode===229)){if(T.key==="Enter"){T.preventDefault(),x("decline");return}T.key==="Escape"&&(T.preventDefault(),g.length>0?h(""):f(!1))}}}),l(K,{size:"sm",variant:"ghost",className:"text-muted-foreground hover:text-foreground",disabled:o,onClick:()=>f(!1),children:d("approval.actions.back")}),l(K,{size:"sm","data-approval-decision":"decline",disabled:o,onClick:()=>x("decline"),children:d("composer.decline")})]}),a==="queued"?l("p",{className:"text-chat-row text-muted-foreground",children:d("approval.declineReasonQueuedNote")}):null]});let{leading:L,trailing:w}=v_(c),k=[...L,...w];y.current.length=k.length;let I=T=>{let S=c.indexOf(T),P=k.indexOf(T),A=s&&S<9?S+1:null,N=T.decision==="accept";return v(K,{ref:B=>{y.current[P]=B},size:"sm",variant:N?"default":"ghost",style:{height:"auto"},"data-approval-decision":T.decision,"aria-keyshortcuts":s?AG(T.decision,S):void 0,className:V(RG,!N&&"text-muted-foreground hover:text-foreground"),disabled:o,onClick:()=>C(T.decision),children:[l("span",{className:"min-w-0 wrap-anywhere",children:MG(T,d)}),A===null?null:l(oi,{className:Ci,children:A})]},T.decision)};return v("div",{className:"flex w-full min-w-0 flex-wrap items-center gap-1",children:[L.map(I),l("span",{className:"flex-1"}),w.map(I)]})});$();function b_(e){let t=e.content;if(t===void 0)return null;if(t.kind==="unified")return t.diff.length>0?t.diff:null;let o=x_(t.oldText??""),n=x_(t.newText);if(o.length===0&&n.length===0)return null;let r=`--- a/${e.path}
3573
3573
  +++ b/${e.path}
3574
3574
  `,a=`@@ -${o.length===0?"0,0":`1,${o.length}`} +${n.length===0?"0,0":`1,${n.length}`} @@
3575
3575
  `,s=[...o.map(i=>`-${i}`),...n.map(i=>`+${i}`)];return`${r}${a}${s.join(`
3576
3576
  `)}
3577
- `}function v_(e){if(e.length===0)return[];let t=e.split(`
3578
- `);return t.at(-1)===""?t.slice(0,-1):t}function x_(e){let t=new Map;return e.map(o=>{let n=t.get(o.path)??0;return t.set(o.path,n+1),n===0?o.path:`${o.path}#${n}`})}function b_(e){return{additions:e.additions??0,deletions:e.deletions??0}}var EG={"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"},MG={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"},AG={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"},NG={command:"approval.commandDetailLabel",path:"approval.body.pathLabel",url:"approval.body.urlLabel",query:"approval.body.queryLabel",text:"approval.body.detailLabel"};function JC(e,t){if(e.headline!==null)return e.headline;let o=e.subject!==null?EG[e.kind]:void 0;return o!==void 0?t(o,{name:e.subject}):t(MG[e.kind])}function ZC(e,t){return t(AG[e])}function w_(e,t){return t(NG[e])}$();$();var T_={light:"vscode-light-modern",dark:"vscode-dark-modern"};function I_(e){return e==="dark"?T_.dark:T_.light}function Zc(e,t){return e-(t===0?0:1)}function tx(e,t){return Zc(e,t)+t}function ox(e,...t){return`ck1:${JSON.stringify([e,...t])}`}function nx(e){let t=e.length;return e.charCodeAt(t-1)===10&&(t--,e.charCodeAt(t-1)===13&&t--),e.slice(0,t)}var _G=new TextEncoder,OG=new TextDecoder("utf-8",{ignoreBOM:!0}),FG=/[\uD800-\uDFFF]/,rx=1024,Cl=new Uint8Array(rx);function R_(){Cl.length!==rx&&(Cl=new Uint8Array(rx))}function Kt(e){if(e.length===0)return e;if(FG.test(e))return JSON.parse(JSON.stringify(e));let t=e.length*3;Cl.length<t&&(Cl=new Uint8Array(t));let{written:o}=_G.encodeInto(e,Cl);return OG.decode(Cl.subarray(0,o))}P_();var BG=new TextDecoder("utf-8",{ignoreBOM:!0}),HG={'"':'"',"\\":"\\",a:"\x07",b:"\b",t:" ",n:`
3579
- `,v:"\v",f:"\f",r:"\r"};function E_(e){if(e[0]!=='"')return;let t="",o=1;for(;o<e.length;){let n=e[o];if(n==='"')return{fileName:t,rawLength:o+1};if(n!=="\\"){t+=n,o++;continue}let r=HG[e[o+1]];if(r!=null){t+=r,o+=2;continue}let a=[];do{let s=UG(e,o+1);if(s==null)return;a.push(s),o+=4}while(e[o]==="\\"&&e[o+1]>="0"&&e[o+1]<="7");t+=BG.decode(new Uint8Array(a))}}function UG(e,t){let o=e.charCodeAt(t)-48,n=e.charCodeAt(t+1)-48,r=e.charCodeAt(t+2)-48;if(o>=0&&o<=3&&n>=0&&n<=7&&r>=0&&r<=7)return o*64+n*8+r}function A_(e){for(let t of e.hunks)for(let o=0;o<t.hunkContent.length;o++){let n=t.hunkContent[o];if(n.type!=="change")continue;let r=$G(e,n);r!=null&&(t.hunkContent.splice(o,1,...r),o+=r.length-1)}}function $G(e,t){let{deletions:o,additions:n,deletionLineIndex:r,additionLineIndex:a}=t,s=Math.min(o,n),i=Math.abs(n-o);if(s===0||i===0||s*(i+1)>4096)return null;let d=[];for(let h=0;h<o;h++)d.push(M_(e.deletionLines[r+h]??""));let c=[];for(let h=0;h<n;h++)c.push(M_(e.additionLines[a+h]??""));let u=n>o,m=0,p=-1;for(let h=0;h<=i;h++){let y=0;for(let x=0;x<s;x++)y+=KG(d[x+(u?0:h)],c[x+(u?h:0)]);h===0?p=y+s*.5:y>p&&(p=y,m=h)}if(m===0)return null;let f=[],g=(h,y,x,C)=>{(h>0||y>0)&&f.push({type:"change",deletions:h,additions:y,deletionLineIndex:x,additionLineIndex:C})};return u?(g(0,m,r,a),g(s,s,r,a+m),g(0,n-s-m,r+s,a+m+s)):(g(m,0,r,a),g(s,s,r+m,a),g(o-s-m,0,r+m+s,a+s)),f}var zG=/\s+/g;function M_(e){return e.replace(zG,"")}function KG(e,t){if(e===t)return 1;let o=Math.max(e.length,t.length),n=Math.min(e.length,t.length);if(n===0)return 0;let r=0;for(;r<n&&e[r]===t[r];)r++;let a=0;for(;a<n-r&&e[e.length-1-a]===t[t.length-1-a];)a++;return(r+a)/o}var qG=/^diff --git ("a\/(?:[^"\\]|\\.)*"|a\/.+?) ("b\/(?:[^"\\]|\\.)*"|b\/.+?)$/;function WG(e,{cacheKeyPrefix:t,disableLineMatching:o,throwOnError:n=!1}={},r){let a=ej(e),s=a?VG(e):QG(e),i=o===!0?"patch-file-raw":"patch-file",d,c=[];for(let u of s){if(a&&!ex.test(u)){if(d==null)d=Kt(u);else{if(n)throw Error("parsePatchContent: unknown file blob");console.error("parsePatchContent: unknown file blob:",u)}continue}else if(!a&&!XG(u)){if(d==null)d=Kt(u);else{if(n)throw Error("parsePatchContent: unknown file blob");console.error("parsePatchContent: unknown file blob:",u)}continue}let m=GG(u,{cacheKey:t!=null?r==null?ox(i,t,String(c.length)):ox(i,t,String(r),String(c.length)):void 0,isGitDiff:a,disableLineMatching:o,throwOnError:n});m!=null&&c.push(m)}return{patchMetadata:d,files:c}}function GG(e,{cacheKey:t,disableLineMatching:o=!1,isGitDiff:n=ex.test(e),oldFile:r,newFile:a,throwOnError:s=!1}={}){let i=0,d=U_(e,"@@ "),c,u=r==null||a==null,m=0,p=0;for(let f of d){let g=F_(f),h=g[0];if(h==null){if(s)throw Error("parsePatchContent: invalid hunk");console.error("parsePatchContent: invalid hunk",f);continue}let y=H_(h),x=0,C=0;if(y==null||c==null){if(c!=null){if(s)throw Error("parsePatchContent: Invalid hunk");console.error("parsePatchContent: Invalid hunk",f);continue}c={name:"",type:"change",hunks:[],splitLineCount:0,unifiedLineCount:0,isPartial:u,additionLines:!u&&r!=null&&a!=null?N_(a.contents):[],deletionLines:!u&&r!=null&&a!=null?N_(r.contents):[],additionCharacterCount:!u&&r!=null&&a!=null?a.contents.length:0,deletionCharacterCount:!u&&r!=null&&a!=null?r.contents.length:0,cacheKey:O_(t)},c.additionLines.length===1&&a?.contents===""&&(c.additionLines.length=0),c.deletionLines.length===1&&r?.contents===""&&(c.deletionLines.length=0);for(let P of g){if(P.startsWith("diff --git")){let N=P.trim().match(qG);if(N==null){if(s)throw Error("parsePatchContent: invalid git diff header");console.error("parsePatchContent: invalid git diff header",P);continue}let B=eu(N[1],!0),O=eu(N[2],!0);c.name=Kt(O),B!==O&&(c.prevName=Kt(B));continue}let A=P.startsWith("---")||P.startsWith("+++")?P.match(k_):null;if(A!=null){let[,N,B]=A,O=eu(B,n);if(N==="---"&&O!=="/dev/null"){let j=Kt(O);c.prevName=j,c.name=j}else N==="+++"&&O!=="/dev/null"&&(c.name=Kt(O))}else if(n){if(P.startsWith("new mode ")&&(c.mode=Kt(P.slice(8).trim())),P.startsWith("old mode ")&&(c.prevMode=Kt(P.slice(8).trim())),P.startsWith("new file mode")&&(c.type="new",c.mode=Kt(P.slice(13).trim())),P.startsWith("deleted file mode")&&(c.type="deleted",c.mode=Kt(P.slice(17).trim())),P.startsWith("similarity index")&&(P.startsWith("similarity index 100%")?c.type="rename-pure":c.type="rename-changed"),P.startsWith("index ")){let[,N,B,O]=P.trim().match(L_)??[];N!=null&&(c.prevObjectId=Kt(N)),B!=null&&(c.newObjectId=Kt(B)),O!=null&&(c.mode=Kt(O))}(P.startsWith("rename from ")||P.startsWith("copy from "))&&(c.prevName=Kt(eu(P.slice(P.startsWith("rename")?12:10)))),(P.startsWith("rename to ")||P.startsWith("copy to "))&&(c.name=Kt(eu(P.slice(P.startsWith("rename")?10:8))))}}continue}let b,L;for(;g.length>0&&(g[g.length-1]===`
3577
+ `}function x_(e){if(e.length===0)return[];let t=e.split(`
3578
+ `);return t.at(-1)===""?t.slice(0,-1):t}function w_(e){let t=new Map;return e.map(o=>{let n=t.get(o.path)??0;return t.set(o.path,n+1),n===0?o.path:`${o.path}#${n}`})}function T_(e){return{additions:e.additions??0,deletions:e.deletions??0}}var NG={"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"},DG={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"},_G={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"},OG={command:"approval.commandDetailLabel",path:"approval.body.pathLabel",url:"approval.body.urlLabel",query:"approval.body.queryLabel",text:"approval.body.detailLabel"};function JC(e,t){if(e.headline!==null)return e.headline;let o=e.subject!==null?NG[e.kind]:void 0;return o!==void 0?t(o,{name:e.subject}):t(DG[e.kind])}function ZC(e,t){return t(_G[e])}function I_(e,t){return t(OG[e])}$();$();var S_={light:"vscode-light-modern",dark:"vscode-dark-modern"};function k_(e){return e==="dark"?S_.dark:S_.light}function Zc(e,t){return e-(t===0?0:1)}function tx(e,t){return Zc(e,t)+t}function ox(e,...t){return`ck1:${JSON.stringify([e,...t])}`}function nx(e){let t=e.length;return e.charCodeAt(t-1)===10&&(t--,e.charCodeAt(t-1)===13&&t--),e.slice(0,t)}var BG=new TextEncoder,HG=new TextDecoder("utf-8",{ignoreBOM:!0}),UG=/[\uD800-\uDFFF]/,rx=1024,Cl=new Uint8Array(rx);function M_(){Cl.length!==rx&&(Cl=new Uint8Array(rx))}function Kt(e){if(e.length===0)return e;if(UG.test(e))return JSON.parse(JSON.stringify(e));let t=e.length*3;Cl.length<t&&(Cl=new Uint8Array(t));let{written:o}=BG.encodeInto(e,Cl);return HG.decode(Cl.subarray(0,o))}E_();var $G=new TextDecoder("utf-8",{ignoreBOM:!0}),zG={'"':'"',"\\":"\\",a:"\x07",b:"\b",t:" ",n:`
3579
+ `,v:"\v",f:"\f",r:"\r"};function A_(e){if(e[0]!=='"')return;let t="",o=1;for(;o<e.length;){let n=e[o];if(n==='"')return{fileName:t,rawLength:o+1};if(n!=="\\"){t+=n,o++;continue}let r=zG[e[o+1]];if(r!=null){t+=r,o+=2;continue}let a=[];do{let s=KG(e,o+1);if(s==null)return;a.push(s),o+=4}while(e[o]==="\\"&&e[o+1]>="0"&&e[o+1]<="7");t+=$G.decode(new Uint8Array(a))}}function KG(e,t){let o=e.charCodeAt(t)-48,n=e.charCodeAt(t+1)-48,r=e.charCodeAt(t+2)-48;if(o>=0&&o<=3&&n>=0&&n<=7&&r>=0&&r<=7)return o*64+n*8+r}function D_(e){for(let t of e.hunks)for(let o=0;o<t.hunkContent.length;o++){let n=t.hunkContent[o];if(n.type!=="change")continue;let r=qG(e,n);r!=null&&(t.hunkContent.splice(o,1,...r),o+=r.length-1)}}function qG(e,t){let{deletions:o,additions:n,deletionLineIndex:r,additionLineIndex:a}=t,s=Math.min(o,n),i=Math.abs(n-o);if(s===0||i===0||s*(i+1)>4096)return null;let d=[];for(let h=0;h<o;h++)d.push(N_(e.deletionLines[r+h]??""));let c=[];for(let h=0;h<n;h++)c.push(N_(e.additionLines[a+h]??""));let u=n>o,m=0,p=-1;for(let h=0;h<=i;h++){let y=0;for(let x=0;x<s;x++)y+=GG(d[x+(u?0:h)],c[x+(u?h:0)]);h===0?p=y+s*.5:y>p&&(p=y,m=h)}if(m===0)return null;let f=[],g=(h,y,x,C)=>{(h>0||y>0)&&f.push({type:"change",deletions:h,additions:y,deletionLineIndex:x,additionLineIndex:C})};return u?(g(0,m,r,a),g(s,s,r,a+m),g(0,n-s-m,r+s,a+m+s)):(g(m,0,r,a),g(s,s,r+m,a),g(o-s-m,0,r+m+s,a+s)),f}var WG=/\s+/g;function N_(e){return e.replace(WG,"")}function GG(e,t){if(e===t)return 1;let o=Math.max(e.length,t.length),n=Math.min(e.length,t.length);if(n===0)return 0;let r=0;for(;r<n&&e[r]===t[r];)r++;let a=0;for(;a<n-r&&e[e.length-1-a]===t[t.length-1-a];)a++;return(r+a)/o}var jG=/^diff --git ("a\/(?:[^"\\]|\\.)*"|a\/.+?) ("b\/(?:[^"\\]|\\.)*"|b\/.+?)$/;function VG(e,{cacheKeyPrefix:t,disableLineMatching:o,throwOnError:n=!1}={},r){let a=nj(e),s=a?YG(e):JG(e),i=o===!0?"patch-file-raw":"patch-file",d,c=[];for(let u of s){if(a&&!ex.test(u)){if(d==null)d=Kt(u);else{if(n)throw Error("parsePatchContent: unknown file blob");console.error("parsePatchContent: unknown file blob:",u)}continue}else if(!a&&!ZG(u)){if(d==null)d=Kt(u);else{if(n)throw Error("parsePatchContent: unknown file blob");console.error("parsePatchContent: unknown file blob:",u)}continue}let m=QG(u,{cacheKey:t!=null?r==null?ox(i,t,String(c.length)):ox(i,t,String(r),String(c.length)):void 0,isGitDiff:a,disableLineMatching:o,throwOnError:n});m!=null&&c.push(m)}return{patchMetadata:d,files:c}}function QG(e,{cacheKey:t,disableLineMatching:o=!1,isGitDiff:n=ex.test(e),oldFile:r,newFile:a,throwOnError:s=!1}={}){let i=0,d=z_(e,"@@ "),c,u=r==null||a==null,m=0,p=0;for(let f of d){let g=H_(f),h=g[0];if(h==null){if(s)throw Error("parsePatchContent: invalid hunk");console.error("parsePatchContent: invalid hunk",f);continue}let y=$_(h),x=0,C=0;if(y==null||c==null){if(c!=null){if(s)throw Error("parsePatchContent: Invalid hunk");console.error("parsePatchContent: Invalid hunk",f);continue}c={name:"",type:"change",hunks:[],splitLineCount:0,unifiedLineCount:0,isPartial:u,additionLines:!u&&r!=null&&a!=null?__(a.contents):[],deletionLines:!u&&r!=null&&a!=null?__(r.contents):[],additionCharacterCount:!u&&r!=null&&a!=null?a.contents.length:0,deletionCharacterCount:!u&&r!=null&&a!=null?r.contents.length:0,cacheKey:B_(t)},c.additionLines.length===1&&a?.contents===""&&(c.additionLines.length=0),c.deletionLines.length===1&&r?.contents===""&&(c.deletionLines.length=0);for(let P of g){if(P.startsWith("diff --git")){let N=P.trim().match(jG);if(N==null){if(s)throw Error("parsePatchContent: invalid git diff header");console.error("parsePatchContent: invalid git diff header",P);continue}let B=eu(N[1],!0),O=eu(N[2],!0);c.name=Kt(O),B!==O&&(c.prevName=Kt(B));continue}let A=P.startsWith("---")||P.startsWith("+++")?P.match(P_):null;if(A!=null){let[,N,B]=A,O=eu(B,n);if(N==="---"&&O!=="/dev/null"){let j=Kt(O);c.prevName=j,c.name=j}else N==="+++"&&O!=="/dev/null"&&(c.name=Kt(O))}else if(n){if(P.startsWith("new mode ")&&(c.mode=Kt(P.slice(8).trim())),P.startsWith("old mode ")&&(c.prevMode=Kt(P.slice(8).trim())),P.startsWith("new file mode")&&(c.type="new",c.mode=Kt(P.slice(13).trim())),P.startsWith("deleted file mode")&&(c.type="deleted",c.mode=Kt(P.slice(17).trim())),P.startsWith("similarity index")&&(P.startsWith("similarity index 100%")?c.type="rename-pure":c.type="rename-changed"),P.startsWith("index ")){let[,N,B,O]=P.trim().match(R_)??[];N!=null&&(c.prevObjectId=Kt(N)),B!=null&&(c.newObjectId=Kt(B)),O!=null&&(c.mode=Kt(O))}(P.startsWith("rename from ")||P.startsWith("copy from "))&&(c.prevName=Kt(eu(P.slice(P.startsWith("rename")?12:10)))),(P.startsWith("rename to ")||P.startsWith("copy to "))&&(c.name=Kt(eu(P.slice(P.startsWith("rename")?10:8))))}}continue}let b,L;for(;g.length>0&&(g[g.length-1]===`
3580
3580
  `||g[g.length-1]==="\r"||g[g.length-1]===`\r
3581
- `||g[g.length-1]==="");)g.pop();let{additionStart:w,deletionStart:k}=y;m=u?m:k-1,p=u?p:w-1;let I={collapsedBefore:0,splitLineCount:0,splitLineStart:0,unifiedLineCount:0,unifiedLineStart:0,additionCount:y.additionCount,additionStart:w,additionLines:x,deletionCount:y.deletionCount,deletionStart:k,deletionLines:C,deletionLineIndex:m,additionLineIndex:p,hunkContent:[],hunkContext:O_(y.hunkContext),hunkSpecs:Kt(h),noEOFCRAdditions:!1,noEOFCRDeletions:!1},T=0,S=0;for(let P=1;P<g.length;P++){let A=g[P];if(T>=I.additionCount&&S>=I.deletionCount&&!A.startsWith("\\")){if(!(YG(A)&&!JG(A)))break;if(s)throw Error("parsePatchContent: hunk has more lines than expected")}let N=A[0];if(N!=="+"&&N!=="-"&&N!==" "&&N!=="\\"){if(s)throw Error("parsePatchContent: invalid hunk line");console.error(`parseLineType: Invalid firstChar: "${N}", full line: "${A}"`),console.error("processFile: invalid rawLine:",A);continue}let B=tj(N);if(B==="addition"){if(s&&T>=I.additionCount)throw Error("parsePatchContent: hunk has too many addition lines");let O=ax(A);(b==null||b.type!=="change")&&(b=sx("change",m,p),I.hunkContent.push(b)),p++,T++,u&&(c.additionLines.push(O),c.additionCharacterCount+=O.length),b.additions++,x++,L="addition"}else if(B==="deletion"){if(s&&S>=I.deletionCount)throw Error("parsePatchContent: hunk has too many deletion lines");let O=ax(A);(b==null||b.type!=="change")&&(b=sx("change",m,p),I.hunkContent.push(b)),m++,S++,u&&(c.deletionLines.push(O),c.deletionCharacterCount+=O.length),b.deletions++,C++,L="deletion"}else if(B==="context"){if(s&&(S>=I.deletionCount||T>=I.additionCount))throw Error("parsePatchContent: hunk has too many context lines");let O=ax(A);(b==null||b.type!=="context")&&(b=sx("context",m,p),I.hunkContent.push(b)),p++,m++,T++,S++,u&&(c.deletionLines.push(O),c.additionLines.push(O),c.deletionCharacterCount+=O.length,c.additionCharacterCount+=O.length),b.lines++,L="context"}else if(B==="metadata"&&b!=null){if(b.type==="context"?(I.noEOFCRAdditions=!0,I.noEOFCRDeletions=!0):L==="deletion"?I.noEOFCRDeletions=!0:L==="addition"&&(I.noEOFCRAdditions=!0),u&&(L==="addition"||L==="context")){let O=c.additionLines.length-1;if(O>=0){let j=c.additionLines[O],U=nx(j);c.additionLines[O]=U,c.additionCharacterCount+=U.length-j.length}}if(u&&(L==="deletion"||L==="context")){let O=c.deletionLines.length-1;if(O>=0){let j=c.deletionLines[O],U=nx(j);c.deletionLines[O]=U,c.deletionCharacterCount+=U.length-j.length}}}}if(T!==I.additionCount||S!==I.deletionCount){if(s)throw Error("parsePatchContent: hunk line count mismatch");console.error(`parsePatchContent: hunk line count mismatch: "${h.trimEnd()}", declared old/new ${I.deletionCount}/${I.additionCount}, parsed old/new ${S}/${T}`);let P=Zc(I.additionStart,I.additionCount)+(T===0?0:1),A=Zc(I.deletionStart,I.deletionCount)+(S===0?0:1);if(!u){let N=P-I.additionStart,B=A-I.deletionStart;I.additionLineIndex+=N,I.deletionLineIndex+=B;for(let O of I.hunkContent)O.additionLineIndex+=N,O.deletionLineIndex+=B}I.additionStart=P,I.deletionStart=A,I.additionCount=T,I.deletionCount=S}I.additionLines=x,I.deletionLines=C,I.collapsedBefore=Math.max(Zc(I.additionStart,I.additionCount)-i,0),c.hunks.push(I),i=tx(I.additionStart,I.additionCount);for(let P of I.hunkContent)P.type==="context"?(I.splitLineCount+=P.lines,I.unifiedLineCount+=P.lines):(I.splitLineCount+=Math.max(P.additions,P.deletions),I.unifiedLineCount+=P.deletions+P.additions);I.splitLineStart=c.splitLineCount+I.collapsedBefore,I.unifiedLineStart=c.unifiedLineCount+I.collapsedBefore,c.splitLineCount+=I.collapsedBefore+I.splitLineCount,c.unifiedLineCount+=I.collapsedBefore+I.unifiedLineCount}if(c!=null){if(s&&u&&!n&&c.hunks.length===0)throw Error("parsePatchContent: unified file has no hunks");if(c.hunks.length>0&&!u&&c.additionLines.length>0&&c.deletionLines.length>0){let f=c.hunks[c.hunks.length-1],g=tx(f.additionStart,f.additionCount),h=c.additionLines.length,y=Math.max(h-g,0);c.splitLineCount+=y,c.unifiedLineCount+=y}return n||(c.prevName!=null&&c.name!==c.prevName?c.hunks.length>0?c.type="rename-changed":c.type="rename-pure":(r==null||r.contents==="")&&a!=null&&a.contents!==""?c.type="new":r!=null&&r.contents!==""&&(a==null||a.contents==="")&&(c.type="deleted")),c.type!=="rename-pure"&&c.type!=="rename-changed"&&(c.prevName=void 0),o||A_(c),c}}function lx(e,t={}){let{cacheKeyPrefix:o,throwOnError:n=!1}=t,r=[],a=jG(e)?e.split(S_):[e];for(let s of a)try{r.push(WG(s,t,o!=null?r.length:void 0))}catch(i){if(n)throw i;console.error(i)}finally{R_()}return r}function eu(e,t=!1){let o=e.trim(),n=o.startsWith('"')?E_(o)?.fileName??o:o;return t&&(n.startsWith("a/")||n.startsWith("b/"))?n.slice(2):n}function jG(e){return e.startsWith("From ")||e.includes(`
3582
- From `)}function N_(e){let t=F_(e);for(let o=0;o<t.length;o++)t[o]=Kt(t[o]);return t}function F_(e){if(e.length===0)return[""];let t=[],o=0;for(;;){let n=e.indexOf(`
3583
- `,o);if(n===-1)break;t.push(e.slice(o,n+1)),o=n+1}return o<e.length&&t.push(e.slice(o)),t}function VG(e){return U_(e,"diff --git")}function QG(e){if(e.length===0)return[""];let t=[],o=0,n=0,r=0,a=0,s=!1;for(;n<e.length;){let i=ix(e,n);if(r<=0&&a<=0){if(B_(e,n)){n>o&&t.push(e.slice(o,n)),o=n,s=!0,n=ix(e,i);continue}if(s&&e.startsWith("@@ -",n)){let c=H_(e.slice(n,i));c!=null&&(r=c.deletionCount,a=c.additionCount)}n=i;continue}let d=e[n];if(d==="\\"){n=i;continue}d===" "?(r=Math.max(r-1,0),a=Math.max(a-1,0)):d==="-"?r=Math.max(r-1,0):d==="+"&&(a=Math.max(a-1,0)),n=i}return t.push(e.slice(o)),t}function XG(e){return B_(e,0)}function B_(e,t){let o=ix(e,t);return D_(e,t,"---")&&D_(e,o,"+++")}function D_(e,t,o){if(!e.startsWith(o,t))return!1;let n=e[t+o.length];if(n!==" "&&n!==" ")return!1;for(let r=t+o.length+1;r<e.length;r++){let a=e[r];if(a===`
3581
+ `||g[g.length-1]==="");)g.pop();let{additionStart:w,deletionStart:k}=y;m=u?m:k-1,p=u?p:w-1;let I={collapsedBefore:0,splitLineCount:0,splitLineStart:0,unifiedLineCount:0,unifiedLineStart:0,additionCount:y.additionCount,additionStart:w,additionLines:x,deletionCount:y.deletionCount,deletionStart:k,deletionLines:C,deletionLineIndex:m,additionLineIndex:p,hunkContent:[],hunkContext:B_(y.hunkContext),hunkSpecs:Kt(h),noEOFCRAdditions:!1,noEOFCRDeletions:!1},T=0,S=0;for(let P=1;P<g.length;P++){let A=g[P];if(T>=I.additionCount&&S>=I.deletionCount&&!A.startsWith("\\")){if(!(ej(A)&&!tj(A)))break;if(s)throw Error("parsePatchContent: hunk has more lines than expected")}let N=A[0];if(N!=="+"&&N!=="-"&&N!==" "&&N!=="\\"){if(s)throw Error("parsePatchContent: invalid hunk line");console.error(`parseLineType: Invalid firstChar: "${N}", full line: "${A}"`),console.error("processFile: invalid rawLine:",A);continue}let B=rj(N);if(B==="addition"){if(s&&T>=I.additionCount)throw Error("parsePatchContent: hunk has too many addition lines");let O=ax(A);(b==null||b.type!=="change")&&(b=sx("change",m,p),I.hunkContent.push(b)),p++,T++,u&&(c.additionLines.push(O),c.additionCharacterCount+=O.length),b.additions++,x++,L="addition"}else if(B==="deletion"){if(s&&S>=I.deletionCount)throw Error("parsePatchContent: hunk has too many deletion lines");let O=ax(A);(b==null||b.type!=="change")&&(b=sx("change",m,p),I.hunkContent.push(b)),m++,S++,u&&(c.deletionLines.push(O),c.deletionCharacterCount+=O.length),b.deletions++,C++,L="deletion"}else if(B==="context"){if(s&&(S>=I.deletionCount||T>=I.additionCount))throw Error("parsePatchContent: hunk has too many context lines");let O=ax(A);(b==null||b.type!=="context")&&(b=sx("context",m,p),I.hunkContent.push(b)),p++,m++,T++,S++,u&&(c.deletionLines.push(O),c.additionLines.push(O),c.deletionCharacterCount+=O.length,c.additionCharacterCount+=O.length),b.lines++,L="context"}else if(B==="metadata"&&b!=null){if(b.type==="context"?(I.noEOFCRAdditions=!0,I.noEOFCRDeletions=!0):L==="deletion"?I.noEOFCRDeletions=!0:L==="addition"&&(I.noEOFCRAdditions=!0),u&&(L==="addition"||L==="context")){let O=c.additionLines.length-1;if(O>=0){let j=c.additionLines[O],U=nx(j);c.additionLines[O]=U,c.additionCharacterCount+=U.length-j.length}}if(u&&(L==="deletion"||L==="context")){let O=c.deletionLines.length-1;if(O>=0){let j=c.deletionLines[O],U=nx(j);c.deletionLines[O]=U,c.deletionCharacterCount+=U.length-j.length}}}}if(T!==I.additionCount||S!==I.deletionCount){if(s)throw Error("parsePatchContent: hunk line count mismatch");console.error(`parsePatchContent: hunk line count mismatch: "${h.trimEnd()}", declared old/new ${I.deletionCount}/${I.additionCount}, parsed old/new ${S}/${T}`);let P=Zc(I.additionStart,I.additionCount)+(T===0?0:1),A=Zc(I.deletionStart,I.deletionCount)+(S===0?0:1);if(!u){let N=P-I.additionStart,B=A-I.deletionStart;I.additionLineIndex+=N,I.deletionLineIndex+=B;for(let O of I.hunkContent)O.additionLineIndex+=N,O.deletionLineIndex+=B}I.additionStart=P,I.deletionStart=A,I.additionCount=T,I.deletionCount=S}I.additionLines=x,I.deletionLines=C,I.collapsedBefore=Math.max(Zc(I.additionStart,I.additionCount)-i,0),c.hunks.push(I),i=tx(I.additionStart,I.additionCount);for(let P of I.hunkContent)P.type==="context"?(I.splitLineCount+=P.lines,I.unifiedLineCount+=P.lines):(I.splitLineCount+=Math.max(P.additions,P.deletions),I.unifiedLineCount+=P.deletions+P.additions);I.splitLineStart=c.splitLineCount+I.collapsedBefore,I.unifiedLineStart=c.unifiedLineCount+I.collapsedBefore,c.splitLineCount+=I.collapsedBefore+I.splitLineCount,c.unifiedLineCount+=I.collapsedBefore+I.unifiedLineCount}if(c!=null){if(s&&u&&!n&&c.hunks.length===0)throw Error("parsePatchContent: unified file has no hunks");if(c.hunks.length>0&&!u&&c.additionLines.length>0&&c.deletionLines.length>0){let f=c.hunks[c.hunks.length-1],g=tx(f.additionStart,f.additionCount),h=c.additionLines.length,y=Math.max(h-g,0);c.splitLineCount+=y,c.unifiedLineCount+=y}return n||(c.prevName!=null&&c.name!==c.prevName?c.hunks.length>0?c.type="rename-changed":c.type="rename-pure":(r==null||r.contents==="")&&a!=null&&a.contents!==""?c.type="new":r!=null&&r.contents!==""&&(a==null||a.contents==="")&&(c.type="deleted")),c.type!=="rename-pure"&&c.type!=="rename-changed"&&(c.prevName=void 0),o||D_(c),c}}function lx(e,t={}){let{cacheKeyPrefix:o,throwOnError:n=!1}=t,r=[],a=XG(e)?e.split(L_):[e];for(let s of a)try{r.push(VG(s,t,o!=null?r.length:void 0))}catch(i){if(n)throw i;console.error(i)}finally{M_()}return r}function eu(e,t=!1){let o=e.trim(),n=o.startsWith('"')?A_(o)?.fileName??o:o;return t&&(n.startsWith("a/")||n.startsWith("b/"))?n.slice(2):n}function XG(e){return e.startsWith("From ")||e.includes(`
3582
+ From `)}function __(e){let t=H_(e);for(let o=0;o<t.length;o++)t[o]=Kt(t[o]);return t}function H_(e){if(e.length===0)return[""];let t=[],o=0;for(;;){let n=e.indexOf(`
3583
+ `,o);if(n===-1)break;t.push(e.slice(o,n+1)),o=n+1}return o<e.length&&t.push(e.slice(o)),t}function YG(e){return z_(e,"diff --git")}function JG(e){if(e.length===0)return[""];let t=[],o=0,n=0,r=0,a=0,s=!1;for(;n<e.length;){let i=ix(e,n);if(r<=0&&a<=0){if(U_(e,n)){n>o&&t.push(e.slice(o,n)),o=n,s=!0,n=ix(e,i);continue}if(s&&e.startsWith("@@ -",n)){let c=$_(e.slice(n,i));c!=null&&(r=c.deletionCount,a=c.additionCount)}n=i;continue}let d=e[n];if(d==="\\"){n=i;continue}d===" "?(r=Math.max(r-1,0),a=Math.max(a-1,0)):d==="-"?r=Math.max(r-1,0):d==="+"&&(a=Math.max(a-1,0)),n=i}return t.push(e.slice(o)),t}function ZG(e){return U_(e,0)}function U_(e,t){let o=ix(e,t);return O_(e,t,"---")&&O_(e,o,"+++")}function O_(e,t,o){if(!e.startsWith(o,t))return!1;let n=e[t+o.length];if(n!==" "&&n!==" ")return!1;for(let r=t+o.length+1;r<e.length;r++){let a=e[r];if(a===`
3584
3584
  `||a==="\r")break;if(a!==" "&&a!==" ")return!0}return!1}function ix(e,t){let o=e.indexOf(`
3585
- `,t);return o===-1?e.length:o+1}function YG(e){let t=e[0];return t==="+"||t==="-"||t===" "}function JG(e){if(!e.startsWith("--"))return!1;for(let t=2;t<e.length;t++){let o=e[t];if(o!==" "&&o!==" "&&o!==`
3586
- `&&o!=="\r")return!1}return!0}function H_(e){if(!e.startsWith("@@ -"))return;let t=4,o=tg(e,t);if(o==null)return;let n=o.value;t=o.endIndex;let r=1;if(e[t]===","){let u=tg(e,t+1);if(u==null)return;r=u.value,t=u.endIndex}if(e[t]!==" "||e[t+1]!=="+")return;t+=2;let a=tg(e,t);if(a==null)return;let s=a.value;t=a.endIndex;let i=1;if(e[t]===","){let u=tg(e,t+1);if(u==null)return;i=u.value,t=u.endIndex}if(e[t]!==" "||e[t+1]!=="@"||e[t+2]!=="@")return;let d,c=t+3;return e[c]===" "&&(d=ZG(e.slice(c+1))),{additionCount:i,additionStart:s,deletionCount:r,deletionStart:n,hunkContext:d}}function tg(e,t){let o=t,n=0;for(;o<e.length;o++){let r=e.charCodeAt(o)-48;if(r<0||r>9)break;n=n*10+r}if(o!==t)return{value:n,endIndex:o}}function ZG(e){return e.endsWith(`\r
3585
+ `,t);return o===-1?e.length:o+1}function ej(e){let t=e[0];return t==="+"||t==="-"||t===" "}function tj(e){if(!e.startsWith("--"))return!1;for(let t=2;t<e.length;t++){let o=e[t];if(o!==" "&&o!==" "&&o!==`
3586
+ `&&o!=="\r")return!1}return!0}function $_(e){if(!e.startsWith("@@ -"))return;let t=4,o=tg(e,t);if(o==null)return;let n=o.value;t=o.endIndex;let r=1;if(e[t]===","){let u=tg(e,t+1);if(u==null)return;r=u.value,t=u.endIndex}if(e[t]!==" "||e[t+1]!=="+")return;t+=2;let a=tg(e,t);if(a==null)return;let s=a.value;t=a.endIndex;let i=1;if(e[t]===","){let u=tg(e,t+1);if(u==null)return;i=u.value,t=u.endIndex}if(e[t]!==" "||e[t+1]!=="@"||e[t+2]!=="@")return;let d,c=t+3;return e[c]===" "&&(d=oj(e.slice(c+1))),{additionCount:i,additionStart:s,deletionCount:r,deletionStart:n,hunkContext:d}}function tg(e,t){let o=t,n=0;for(;o<e.length;o++){let r=e.charCodeAt(o)-48;if(r<0||r>9)break;n=n*10+r}if(o!==t)return{value:n,endIndex:o}}function oj(e){return e.endsWith(`\r
3587
3587
  `)?e.slice(0,-2):e.endsWith(`
3588
- `)?e.slice(0,-1):e}function ej(e){return e.startsWith("diff --git")||e.includes(`
3589
- diff --git`)}function U_(e,t){if(e.length===0)return[""];let o=`
3590
- ${t}`,n=e.startsWith(t)?0:__(e,o,0);if(n===-1)return[e];let r=[];n>0&&r.push(e.slice(0,n));let a=n;for(;;){let s=__(e,o,a+1);if(s===-1)break;r.push(e.slice(a,s)),a=s}return r.push(e.slice(a)),r}function __(e,t,o){let n=e.indexOf(t,o);return n===-1?-1:n+1}function O_(e){return e==null?e:Kt(e)}function tj(e){return e===" "?"context":e==="\\"?"metadata":e==="+"?"addition":"deletion"}function ax(e){let t=e.slice(1);return Kt(t===""?`
3591
- `:t)}function sx(e,t,o){return e==="change"?{type:"change",additions:0,deletions:0,additionLineIndex:o,deletionLineIndex:t}:{type:"context",lines:0,additionLineIndex:o,deletionLineIndex:t}}var z_=2166136261,K_=16777619,oj=2654435769,nj=2246822507;function $_(e,t=z_,o=K_){let n=t>>>0;for(let r=0;r<e.length;r+=1)n^=e.charCodeAt(r),n=Math.imul(n,o)>>>0;return n>>>0}function rj(e,t="diff-panel"){let o=e.trim(),n=$_(o,z_,K_).toString(36),r=$_(o,oj,nj).toString(36);return`${t}:${o.length}:${n}:${r}`}function dx(e){if(!e.isPartial)return e;let t=0,o=0,n=e.hunks.map(r=>{let a={...r,splitLineStart:t,unifiedLineStart:o};return t+=r.splitLineCount,o+=r.unifiedLineCount,a});return{...e,hunks:n,splitLineCount:t,unifiedLineCount:o,...e.cacheKey?{cacheKey:`${e.cacheKey}:compact-partial`}:{}}}function q_(e,t="diff-panel",o={}){if(!e)return null;let n=e.trim();if(n.length===0)return null;try{let a=lx(n,{cacheKeyPrefix:rj(n,t)}).flatMap(s=>o.compactPartialHunkOffsets?s.files.map(dx):s.files);return a.length>0?{kind:"files",files:a}:{kind:"raw",text:n,reason:"Unsupported diff format. Showing raw patch."}}catch{return{kind:"raw",text:n,reason:"Failed to parse patch. Showing raw patch."}}}function W_(e){let t=e.cacheKey;return t?t.endsWith(":hydrated")?t.slice(0,-9):t:`${e.prevName??"none"}:${e.name}:${e.type}`}function G_({fileChange:e,onOpenDiff:t}){let{t:o}=z(),[n,r]=q(!1),a=W(()=>C_(e),[e]),s=b_(e);return v("div",{className:"min-w-0",children:[v("div",{className:"flex min-w-0 flex-wrap items-center gap-1",children:[l("span",{className:"min-w-0 shrink truncate font-mono text-ui-sm text-foreground/85",children:e.path}),l("span",{className:"shrink-0 font-mono text-ui-sm text-muted-foreground tabular-nums",children:o("approval.diff.stat",{additions:s.additions,deletions:s.deletions})}),a===null?l("span",{className:"text-ui-sm text-muted-foreground",children:e.omitted==="too-large"?o("approval.diff.tooLarge"):o("approval.diff.unavailable")}):v(K,{size:"micro",variant:"ghost-muted",className:"font-normal","aria-expanded":n,onClick:()=>r(i=>!i),children:[n?l(Tt,{className:"size-3 shrink-0"}):l(yo,{className:"size-3 shrink-0"}),l("span",{children:o(n?"approval.diff.hide":"approval.diff.show")})]}),t?l(K,{size:"micro",variant:"ghost-muted",className:"font-normal",onClick:()=>t(e.path),children:o("approval.diff.open")}):null]}),n&&a!==null?l(aj,{path:e.path,unifiedDiff:a}):null]})}function aj({path:e,unifiedDiff:t}){let o=it().theme.useResolvedTheme(),n=W(()=>{let r=q_(t,`approval:${o}`,{compactPartialHunkOffsets:!0});return r?.kind==="files"?r.files.map(a=>({id:W_(dx(a)),type:"diff",fileDiff:a,collapsed:!1})):[]},[o,t]);return n.length===0?l("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-ui-sm leading-relaxed text-muted-foreground/90 [scrollbar-width:thin]",tabIndex:0,children:t}):l("div",{className:"mt-1 overflow-hidden rounded-md border border-border/60",children:l(Ab,{className:"max-h-56 overflow-auto [scrollbar-gutter:stable]",items:n,options:{diffStyle:"unified",lineDiffType:"none",overflow:"wrap",theme:I_(o),themeType:o,stickyHeaders:!1}})})}var sj={command:l(Qo,{}),"file-read":l(Ha,{}),"file-change":l(Ur,{}),"web-fetch":l(Ql,{}),"web-search":l(ud,{}),skill:l(jn,{}),"mcp-tool":l(Ws,{}),tool:l(Ws,{}),"mcp-elicitation":l(Nl,{})};function j_(e){return sj[e]}var ij=4,lj=300,dj="min-w-0 rounded-md bg-muted px-2.5 py-2",cj="min-w-0 font-mono text-chat-code text-foreground/90 [font-variant-ligatures:none]";function uj(e){return[...e.matchAll(/\S+|\s+/g)].map(t=>/^\s/.test(t[0])?t[0]:l("span",{className:"inline-block max-w-full [overflow-wrap:anywhere]",children:t[0]},t.index))}function pj(e){let{t}=z(),[o,n]=q(!1),r=e.text.split(`
3592
- `).length,a=e.text.split(/\r?\n/,1)[0]??"",s=e.command?!0:!e.singleLine&&(r>ij||e.text.length>lj),i=e.command&&!o,d=i?a:e.text;return v("div",{className:"flex min-w-0 flex-col gap-1",children:[e.hidePreview&&!o?null:l("div",{className:dj,children:l("code",{"aria-label":e.label,className:V(cj,e.singleLine||i?"block truncate whitespace-pre":"whitespace-pre-wrap [overflow-wrap:anywhere]",e.singleLine||i?"block":s&&!o?"line-clamp-4":"block"),"data-approval-detail":i?"preview":"complete",tabIndex:0,children:e.singleLine||i?d:uj(d)})}),s?l(K,{type:"button",variant:"ghost",size:"xs",className:"w-fit text-chat-row text-muted-foreground","aria-expanded":o,onClick:()=>n(c=>!c),children:e.command?t(o?"approval.body.hideCommand":"approval.body.showCommand"):t(o?"approval.body.showLess":"approval.body.showAll")}):null]})}var V_=pe(function({approval:t,pendingCount:o,onOpenDiff:n,actions:r,className:a}){let{t:s}=z(),i=t.presentation;if(i===void 0)return l(vr,{state:"pending",className:a,icon:j_(t.requestKind),title:ZC(t.requestKind,s),actions:r,children:t.detail?l("p",{className:"whitespace-pre-wrap text-chat-row",children:t.detail}):null});let{body:d}=i,c=x_(i.fileChanges),u=i.headline===null?i.description:null,m=i.outsideSandbox||u||i.justification?v("span",{className:"inline-flex flex-wrap gap-x-2 gap-y-1",children:[i.outsideSandbox?l("span",{className:"text-warning-foreground",children:s("approval.outsideSandbox")}):null,u?l("span",{children:u}):null,i.justification?l("span",{children:i.justification}):null]}):void 0;return l(vr,{state:"pending",className:a,icon:j_(i.kind),title:i.headlineIsCommand?l("span",{className:"block truncate font-mono [font-variant-ligatures:none]",children:JC(i,s)}):JC(i,s),subtitle:m,meta:o>1?`1/${o}`:void 0,actions:r,children:v("div",{"aria-label":ZC(i.kind,s),className:"flex min-w-0 flex-col gap-2",role:"group",children:[d.shape==="none"?null:l(pj,{command:d.shape==="command",hidePreview:i.headlineIsCommand,label:w_(d.shape,s),singleLine:d.shape==="path"||d.shape==="url",text:d.shape==="command"?d.command:d.shape==="path"?d.path:d.shape==="url"?d.url:d.shape==="query"?d.query:d.text},t.requestId),i.fileChanges.map((p,f)=>l(G_,{fileChange:p,onOpenDiff:n},c[f])),i.detailArgs.length===0?null:v("details",{className:"min-w-0","data-approval-args":"true",children:[l("summary",{className:"cursor-[var(--control-cursor)] text-chat-row text-muted-foreground",children:s("approval.body.detailsSummary")}),l("dl",{"aria-label":s("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 bg-muted p-2 text-ui-sm [scrollbar-width:thin]",tabIndex:0,children:i.detailArgs.map(p=>v("div",{className:"col-span-2 grid grid-cols-subgrid",children:[l("dt",{className:"font-mono text-muted-foreground",children:p.name}),l("dd",{className:"min-w-0 font-mono whitespace-pre-wrap wrap-break-word text-foreground/85",children:p.value})]},p.name))})]})]})})});var tu=pe(function(t){return l(V_,{...t})});$();function mj(e){return[...e.filter(t=>t.tone==="primary"),...e.filter(t=>t.tone!=="primary")]}var ou=pe(function(t){let{t:o}=z(),n=it(),{shortcuts:r=!0}=t,[a,s]=q(!1),[i,d]=q(!1),c=E(!1),u=t.decision,m=u.requestId,p=mj(u.options),{onRespond:f}=t,g=R(L=>{m===null||c.current||(c.current=!0,d(!0),Promise.resolve(f(m,L)).finally(()=>{c.current=!1,d(!1)}))},[f,m]);if(n.pane.useKeydown(L=>{if(!r||m===null||c.current||L.defaultPrevented||n.terminalFocus.getOwner()!==null||L.isComposing||L.keyCode===229||L.metaKey||L.ctrlKey||L.altKey||L.shiftKey||er(L.target))return;let w=Hd(L.key,p.length);if(w===null)return;let k=p[w];k&&(L.preventDefault(),g(k.id))},{target:"document"}),m===null)return null;let h=L=>L.key===void 0?L.text:o(L.key,{...L.params,defaultValue:L.text}),y=u.askedBy.kind==="plugin"?u.askedBy.pluginId:null,[x,...C]=u.body,b=L=>{let w=p.indexOf(L),k=L.tone==="primary";return v(K,{size:"sm",variant:k?"default":"ghost",className:V(!k&&(L.tone==="danger"?"text-destructive-foreground hover:text-destructive-foreground":"text-muted-foreground hover:text-foreground")),disabled:i,onClick:()=>g(L.id),children:[h(L.label),r&&w<9?l(oi,{className:Ci,children:w+1}):null]},L.id)};return l(vr,{state:"pending",className:V("px-3 py-2 sm:px-4",t.className),icon:y===null?l(Fa,{}):l(cd,{}),title:h(u.title),subtitle:x===void 0?void 0:h(x),meta:y===null?void 0:l(Mo,{environmentId:t.environmentId,pluginId:y,iconClassName:"size-3"}),actions:v(oe,{children:[u.detail===null?null:l(K,{size:"sm",variant:"ghost",className:"me-auto text-muted-foreground hover:text-foreground","aria-expanded":a,onClick:()=>s(L=>!L),children:o(a?"decision.hideDetail":"decision.showDetail")}),y_(u.options).map(b)]}),children:v("div",{className:"contents","data-composer-pending-decision":"true",children:[C.map((L,w)=>l("p",{className:"min-w-0 text-chat-row text-muted-foreground",children:h(L)},`${String(w)}:${L.key??L.text}`)),u.detail!==null&&a?l("pre",{className:"max-h-60 min-w-0 overflow-auto rounded-md bg-muted px-2.5 py-2 font-mono text-chat-code whitespace-pre-wrap text-foreground/90 [font-variant-ligatures:none] [overflow-wrap:anywhere]",children:u.detail.text.slice(0,4e3)}):null]})})});$();var og=pe(function({pendingUserInputs:t,respondingRequestIds:o,answers:n,questionIndex:r,onToggleOption:a,onGoToQuestion:s,shortcuts:i=!0}){if(t.length===0)return null;let d=t[0];return d?l(fj,{prompt:d,isResponding:o.includes(d.requestId),answers:n,questionIndex:r,onToggleOption:a,onGoToQuestion:s,shortcuts:i},d.requestId):null}),fj=pe(function({prompt:t,isResponding:o,answers:n,questionIndex:r,onToggleOption:a,onGoToQuestion:s,shortcuts:i}){let{t:d}=z(),c=it(),u=$f(t.questions,n,r),m=u.activeQuestion,p=E(null),f=E(s),[g,h]=q(null),[y,x]=q(null),C=y!==null&&y===m?.id;H(()=>{f.current=s},[s]),H(()=>{if(!(!m||m.multiSelect||!g)){if(g.questionId!==m.id){h(null);return}u.customAnswer.trim().length===0&&u.selectedOptionLabels.includes(g.optionLabel)&&h(null)}},[m,g,u.customAnswer,u.selectedOptionLabels]);let b=R(()=>{p.current!==null&&(window.clearTimeout(p.current),p.current=null)},[]);H(()=>b,[b]);let L=R(S=>{b(),s(S)},[b,s]),w=R((S,P)=>{if(m?.multiSelect){a(S,P);return}if(h({questionId:S,optionLabel:P}),a(S,P),b(),u.isLastQuestion)return;let A=u.questionIndex+1;p.current=window.setTimeout(()=>{p.current=null,f.current(A)},200)},[m,b,a,u.isLastQuestion,u.questionIndex]);if(c.pane.useKeydown(S=>{if(!i||!m||o||C||S.metaKey||S.ctrlKey||S.altKey||S.isComposing||S.keyCode===229||er(S.target))return;let P=Hd(S.key,m.options.length);if(P===null)return;let A=m.options[P];A&&(S.preventDefault(),w(m.id,Sa(A)))},{target:"document"}),!m)return null;let k=u.customAnswer.trim().length>0,I=g?.questionId===m.id?g.optionLabel:null,T=I!==null?[I]:k?[]:u.selectedOptionLabels;return v(vr,{state:"pending",className:"px-3 py-2 sm:px-4",icon:m.kind==="plan"?l(Zl,{}):l(qn,{}),title:m.header,meta:C&&t.questions.length>1?`${u.questionIndex+1}/${t.questions.length}`:void 0,collapse:{collapsed:C,onCollapsedChange:S=>{x(S?m.id:null)},hint:m.question,toggleLabel:d(C?"pendingUserInput.showQuestion":"pendingUserInput.hideQuestion")},children:[l(zf,{questions:t.questions,answers:n,currentIndex:u.questionIndex,disabled:o,onGoTo:L}),l("div",{className:"max-h-[min(45vh,28rem)] overflow-y-auto overscroll-contain break-words text-chat text-foreground","data-pending-user-input-body":m.kind??"question",tabIndex:0,children:m.kind==="plan"?l(wo,{text:m.question,cwd:void 0,isStreaming:!1}):l("p",{className:"whitespace-pre-wrap font-medium",children:m.question})}),m.multiSelect?l("p",{className:"text-chat-row text-muted-foreground",children:d("pendingUserInput.selectOneOrMore")}):null,l($u,{mode:m.multiSelect?"multiple":"single","aria-label":m.header,disabled:o,selected:T,onToggle:S=>{w(m.id,S)},onReselect:S=>{w(m.id,S)},options:m.options.map((S,P)=>{let A=yl(d,m,S);return{value:Sa(S),label:A.label,...A.description&&A.description!==A.label?{description:A.description}:{},...i&&P<9?{trailing:l(oi,{className:Ci,children:P+1})}:{}}})},m.id),l(Kf,{questions:t.questions,answers:n,currentIndex:u.questionIndex,disabled:o,onGoTo:L})]})});$();var Q_=pe(function({planTitle:t}){let{t:o}=z();return l("div",{className:"px-3 py-2 sm:px-4",children:v("div",{className:"flex flex-wrap items-center gap-2",children:[l("span",{className:"text-xs font-medium text-muted-foreground",children:o("plan.ready")}),t?l("span",{className:"min-w-0 flex-1 truncate text-xs text-foreground/85",children:t}):null]})})});function X_(e){if(e.occupant.kind!=="approval")return null;let{approval:t}=e.occupant;return l(eg,{requestId:t.requestId,isResponding:e.respondingRequestIds.includes(t.requestId),options:t.options,keybindings:e.keybindings,declineReasonRelay:t.declineReasonRelay,onRespondToApproval:e.onRespondToApproval})}function Y_(e){return e.occupant.kind!=="user-input"?null:l(og,{pendingUserInputs:[e.occupant.userInput],respondingRequestIds:e.respondingRequestIds,answers:e.activePendingDraftAnswers,questionIndex:e.activePendingQuestionIndex,onToggleOption:e.onSelectActivePendingUserInputOption,onGoToQuestion:e.onGoToActivePendingUserInputQuestion})}var J_={approval:{expanded:e=>e.occupant.kind!=="approval"?null:l(tu,{approval:e.occupant.approval,pendingCount:e.occupant.pendingCount,actions:X_(e),className:"px-3 py-2 sm:px-4"}),collapsed:e=>e.occupant.kind!=="approval"?null:l("div",{"data-chat-composer-collapsed-controls":"true",children:l(tu,{approval:e.occupant.approval,pendingCount:e.occupant.pendingCount,actions:X_(e),className:"px-3 pt-2 pb-3 sm:px-4"})})},decision:{expanded:e=>e.occupant.kind!=="decision"?null:l(ou,{decision:e.occupant.decision.card,environmentId:e.environmentId,onRespond:e.onRespondToDecision}),collapsed:e=>e.occupant.kind!=="decision"?null:l("div",{"data-chat-composer-collapsed-controls":"true",children:l(ou,{decision:e.occupant.decision.card,environmentId:e.environmentId,onRespond:e.onRespondToDecision,className:"pt-2 pb-3"})})},"user-input":{expanded:Y_,collapsed:e=>v("div",{"data-chat-composer-collapsed-controls":"true",children:[Y_(e),e.collapsedPendingRow]})},"plan-follow-up":{expanded:e=>e.activeProposedPlan===null?null:l(Q_,{planTitle:yi(e.activeProposedPlan.planMarkdown)??null},e.activeProposedPlan.id),collapsed:null}};function Z_(e,t){let o=J_[e.occupant.kind],n=t?o.collapsed:o.expanded;return n===null?null:n(e)}var pLe=Object.keys(J_);function e1(e){let{composerOccupant:t,showComposerTopDrawer:o,hasBlockingComposerTopDrawer:n,isTasksDrawerOpen:r,isComposerCollapsedMobile:a,respondingRequestIds:s,keybindings:i,onRespondToApproval:d,onRespondToDecision:c,environmentId:u,activePendingDraftAnswers:m,activePendingQuestionIndex:p,onSelectActivePendingUserInputOption:f,activeProposedPlan:g,activePendingProgress:h,isPendingUserInputChoiceOnly:y,expandMobileComposer:x,badges:C,pendingPrimaryAction:b,isSendBusy:L,sendDisabledReason:w,environmentUnavailable:k,noProviderAvailable:I,projectSelectionRequired:T,onGoToActivePendingUserInputQuestion:S,handleInterruptPrimaryAction:P,handleImplementPlanInNewThreadPrimaryAction:A}=e,{inlineTasksBadge:N,inlineStashBadge:B,visibleTasksProgress:O,visibleTaskSteps:j,dismissTasks:U,toggleTasksDrawer:D}=C;return v(oe,{children:[o&&(!r||n)?l("div",{className:"chat-composer-top-drawer","data-chat-composer-top-drawer":"true","data-occupant":t?.kind??"none",children:t===null?null:Z_({occupant:t,respondingRequestIds:s,keybindings:i,onRespondToApproval:d,onRespondToDecision:c,environmentId:u,activePendingDraftAnswers:m,activePendingQuestionIndex:p,onSelectActivePendingUserInputOption:f,onGoToActivePendingUserInputQuestion:S,activeProposedPlan:g,collapsedPendingRow:l(m_,{activePendingProgress:h,isPendingUserInputChoiceOnly:y,expandMobileComposer:x,inlineTasksBadge:N,inlineStashBadge:B,pendingPrimaryAction:b,isSendBusy:L,sendDisabledReason:w,isEnvironmentUnavailable:k!==null||I||T,handleInterruptPrimaryAction:P,handleImplementPlanInNewThreadPrimaryAction:A})},a)}):null,r&&!n&&O&&j?l(YN,{onDismiss:U,onCollapse:D,progress:O,steps:j}):null]})}function t1(e,t){return{images:e.images,terminalContexts:e.terminalContexts,elementContexts:e.elementContexts,browserAnnotations:e.browserAnnotations,reviewComments:e.reviewComments,nonPersistedImageIds:e.nonPersistedImageIds,activeProvider:e.activeProvider,nativeModeByProvider:e.nativeModeByProvider,promptHasText:e.prompt.trim().length>0,hasSendableContent:t({prompt:e.prompt,imageCount:e.images.length,terminalContexts:e.terminalContexts,elementContextCount:e.elementContexts.length+e.browserAnnotations.length+e.reviewComments.length}).hasSendableContent}}function o1(e){let t=e.draft.useStore;return{setComposerDraftPrompt:t(o=>o.setPrompt),setComposerDraftNativeMode:t(o=>o.setNativeMode),addComposerDraftImage:t(o=>o.addImage),addComposerDraftImages:t(o=>o.addImages),removeComposerDraftImage:t(o=>o.removeImage),insertComposerDraftTerminalContext:t(o=>o.insertTerminalContext),removeComposerDraftElementContext:t(o=>o.removeElementContext),removeComposerDraftBrowserAnnotation:t(o=>o.removeBrowserAnnotation),removeComposerDraftReviewComment:t(o=>o.removeReviewComment),clearComposerDraftPromptAndImages:t(o=>o.clearComposerPromptAndImages)}}$();function n1(e){let{onComposerPaste:t,submitComposer:o,exitShellCommandMode:n}=e,r=E({onComposerPaste:t,submitComposer:o,exitShellCommandMode:n});r.current={onComposerPaste:t,submitComposer:o,exitShellCommandMode:n};let a=R(d=>{r.current.onComposerPaste(d)},[]),s=R((d,c)=>{r.current.submitComposer(d,c)},[]),i=R(()=>r.current.exitShellCommandMode(),[]);return{handleComposerPaste:a,handleComposerSubmit:s,handleUnclaimedEscape:i}}$();var r1=qe(null);function a1({children:e}){let{data:t,target:o,threadKey:n}=Ho(),r=t.useComposerStatus({target:o,threadKey:n});return l(r1.Provider,{value:r,children:e})}function s1(){let e=Pt(r1);if(e===null)throw new Error("Composer status has not been provided.");return e}var i1=pe(function(t){let o=sN(),{data:n,target:r,threadKey:a}=Ho(),{activePendingApproval:s,pendingUserInputs:i,activePendingProgress:d,activePendingResolvedAnswers:c,activePendingIsResponding:u,activePendingDraftAnswers:m,activePendingQuestionIndex:p,questionAttachmentsSupported:f,respondingRequestIds:g,occupants:h,respondToApproval:y,respondToDecision:x,selectUserInputOption:C,changeUserInputCustomAnswer:b,goToUserInputQuestion:L}=n.useComposerPending({target:r,threadKey:a}),{runtimeMode:w,interactionMode:k,lockedProvider:I,providerStatuses:T,activeProjectDefaultModelSelection:S,projectId:P,activeThreadModelSelection:A,activeThreadActualModel:N}=n.useComposerModelContext(r),{activeThreadId:B,activeThread:O,isLocalDraftThread:j,projectSelectionRequired:U,phase:D,isSendBusy:J,continuationChecking:G=!1,sendDisabledReason:M,groupSendDisabledReason:X,unavailableAgentInstanceId:F=null,noAgentChosen:ee=!1,environmentUnavailable:Y,compactDisabled:ae,compactDisabledReason:te}=s1(),{t:de}=z(),{composerDraftTarget:ge,environmentId:ne,attachmentUploadsCapabilityKnown:Z,supportsAttachmentUploads:ve,routeKind:he,routeThreadRef:Ae,draftId:De,forceExpandedOnMobile:je,settings:ot,keybindings:me,terminalOpen:Me,gitCwd:ue,promptRef:ce,composerRef:Ze,composerImagesRef:pt,composerTerminalContextsRef:ze,composerElementContextsRef:et,sendContextRef:Et,onSend:ft,onInterrupt:Ct,interruptArmed:gt=!1,stopping:Dt=!1,onCompactContext:Mt,onImplementPlanInNewThread:se,onProviderInstanceSelect:Le,onModelSelectionChosen:be,handleRuntimeModeChange:Xe,handleInteractionModeChange:xt,handleNativeModeChange:tt,focusComposer:It,setThreadError:po}=t,Ko=n.useComposerPlan(r),Qt=Ko.proposedPlan,hn=Ko.tasksProgress,At=Ko.taskSteps,St=i.length===0&&k==="plan"&&Qt!==null,bt=E(null),{pendingPrimaryAction:mo,onSelectActivePendingUserInputOption:kt,onRespondToApproval:_t,onRespondToComposerDecision:Xt}=$N({t:de,threadId:r.threadId,setThreadError:po,promptRef:ce,promptInputRef:bt,respondToApproval:y,respondToDecision:x,selectUserInputOption:C,activePendingProgress:d,activePendingIsResponding:u,activePendingResolvedAnswers:c}),nt=t.api,{limits:lt}=t.attachments,Bt=nt.draft.useThreadDraftSelector(ge,Wo=>t1(Wo,nt.chat.deriveComposerSendState)),Ht=i[0]??null,{questionAttachmentTarget:Yt,attachmentTarget:qo,attachmentDocumentKey:fo}=ON({supported:f,attachments:t.attachments,environmentId:ne,threadId:B,requestId:Ht?.requestId??null,question:d?.activeQuestion??null,responding:u,composerDraftTarget:ge}),go=nt.draft.useThreadDraftSelector(qo,_N),Jt=go.images,Un=Bt.terminalContexts,Ce=Bt.elementContexts,Ue=Bt.browserAnnotations,rt=Bt.reviewComments,Lt=go.nonPersistedImageIds,wt=nt.uploads.useStore(Wo=>Wo.uploadsByImageId),Ot=!Z&&Jt.length>0?de("attachments.capabilityUnknown"):ve?yN({imageIds:Jt.map(Wo=>Wo.id),uploadsByImageId:wt,environmentId:ne},de):null,{setComposerDraftPrompt:Ro,setComposerDraftNativeMode:nn,addComposerDraftImage:Fr,addComposerDraftImages:ka,removeComposerDraftImage:As,insertComposerDraftTerminalContext:dg,removeComposerDraftElementContext:ru,removeComposerDraftBrowserAnnotation:cg,removeComposerDraftReviewComment:au,clearComposerDraftPromptAndImages:bl}=o1(nt);H(()=>{if(Z){if(!ve){for(let Wo of Jt)nt.uploads.release(Wo.id);return}nt.draft.restoreAttachments();for(let Wo of Jt)nt.uploads.start({environmentId:ne,image:Wo})}},[Z,Jt,ne,ve]);let wl=d!==null,yn=dD({api:nt,t:de,settings:ot,composerDraft:Bt,composerDraftTarget:ge,environmentId:ne,gitCwd:ue,routeKind:he,threadId:r.threadId,activeThread:O,isLocalDraftThread:j,unavailableAgentInstanceId:F,agentNotChosen:ee,runtimeMode:w,lockedProvider:I,providerStatuses:T,projectId:P,activeProjectDefaultModelSelection:S,activeThreadModelSelection:A,actualModel:N,compactDisabledReason:te,externalSendDisabledReason:M,attachmentBlockReason:Ot,answeringQuestion:wl,setComposerDraftNativeMode:nn,handleNativeModeChange:tt,onProviderInstanceSelect:Le,onModelSelectionChosen:be}),{selectedInstanceId:ug,noProviderAvailable:Tl,selectedProvider:Il,selectedModel:su,selectedModelChoice:pg,sendDisabledReason:iu,isSendDisabled:lu,setModelSendBlockShown:du,isModelSendBlocked:mg}=yn,Sl=fN({api:nt,environmentId:ne,target:ge,provider:yn.selectedProviderStatus,planModeEnabled:yn.planModeUiEnabled}),$n=hN(ne,ge),[cu,Ns]=q(!1),[kl,Ds]=q(null),[fg,uu]=q(null),[Ll,Pl]=q(!1),[pu,mu]=q(!1),[gg,fu]=q(null),[_s,gu]=q({key:0,active:!1}),hu=E($n);fe(()=>{hu.current!==$n&&(hu.current=$n,Ns(!1),Ds(null),Pl(!1),mu(!1),fu(null),gu({key:_s.key,active:!1}))},[$n,_s.key]);let La=Vp("max-sm"),Pa=E(null),hg=E(null),Os=E(null),yu=E(null),vu=E(new Map),{isComposerCollapsedMobile:Ra,blurMobileComposerAfterSend:yg,expandMobileComposer:ht,scheduleComposerCollapseCheck:Fs,handleFormFocusCapture:oO}=UN({isMobileViewport:La,forceExpandedOnMobile:je,composerEditorRef:Pa,composerSurfaceRef:yu,composerFormRef:Os}),nO=R(()=>{Ns(!0)},[]),rO=R(Wo=>{xt(Wo)},[xt]),Ea=s!==null,aO=d?.activeQuestion?.allowFreeform===!1,Cx=h[0]??null,{showTopDrawer:xx,showCollapsedPromptRow:sO,hasBlocking:bx}=gN(Cx?.kind??null,Ra),iO=St||d!==null,{isComposerFooterCompact:lO,isComposerPrimaryActionsCompact:dO}=xN(Os,iO),cO=mD({routeKind:he,routeThreadRef:Ae,draftId:De,selectedProvider:Il,selectedInstanceId:ug,selectedModel:su,selectedModelChoice:pg});H(()=>{Ds(null)},[Ce,Ue,rt,Un,su,yn.selectedModelOptionsForDispatch,Il]),HN({composerImages:Jt,composerImagesRef:pt,composerTerminalContexts:Un,composerTerminalContextsRef:ze,composerElementContexts:Ce,composerElementContextsRef:et});let uO=VN({activeThreadId:B,isLocalDraftThread:j,isComposerApprovalState:Ea,hasPendingProgress:d!==null,hasPendingAction:mo!==null,memberMentions:n.memberMentions,target:r,promptRef:ce}),Ma=jN({pluginAction:Sl,api:nt,t:de,limits:lt,composerDraftTarget:ge,composerDraft:Bt,composerDocumentKey:$n,promptRef:ce,promptInputRef:bt,pendingImageCompressionsRef:vu,setComposerDraftPrompt:Ro,setModelSendBlockShown:du,onSend:ft,onCompactContext:Mt,blurMobileComposerAfterSend:yg,isMobileViewport:La,isComposerApprovalState:Ea,activePendingApproval:s,activePendingProgress:d,activePendingResolvedAnswers:c,pendingUserInputCount:i.length,activeThreadId:B,phase:D,isSendBusy:J,environmentUnavailable:Y,compactDisabled:ae,noProviderAvailable:Tl,isSendDisabled:lu,sendDisabledReason:iu,groupSendDisabledReason:X,isGroupSend:uO,isModelSendBlocked:mg,showPlanFollowUpPrompt:St}),Rl=AN({api:nt,t:de,limits:lt,promptRef:ce,promptInputRef:bt,composerEditorRef:Pa,composerImagesRef:pt,composerDraftTarget:ge,setComposerDraftPrompt:Ro,addComposerDraftImages:ka,clearComposerDraftPromptAndImages:bl,setIsStashMenuOpen:Pl,setStashPulse:gu,isComposerCollapsedMobile:Ra,expandMobileComposer:ht,keybindings:me,terminalOpen:Me,isComposerModelPickerOpen:cu,hasPendingUserInputs:i.length>0,isComposerApprovalState:Ea,projectSelectionRequired:U,answeringQuestion:wl}),vg=JN({activeThreadId:B,activeThread:O,activeTasksProgress:hn,activeTaskSteps:At,isTasksDrawerOpen:pu,setIsTasksDrawerOpen:mu,dismissedTasksTurnId:gg,setDismissedTasksTurnId:fu,stashQueue:Rl.stashQueue,isStashMenuOpen:Ll,stashPulse:_s,toggleInlineStashMenu:Rl.toggleInlineStashMenu,isComposerApprovalState:Ea,externalDrawerAttached:o,showComposerTopDrawer:xx,isComposerCollapsedMobile:Ra,hasBlockingComposerTopDrawer:bx}),pO=R(Wo=>{Ds(null),Ma.revalidatePromptLength(Wo),Pl(!1)},[Ma.revalidatePromptLength]),{addComposerImages:wx,removeComposerImage:mO,onComposerAttachmentInputChange:fO}=DN({api:nt,t:de,limits:lt,setThreadError:po,activeThreadId:B,answerQuestionsFirst:i.length>0&&Yt===null,attachmentTarget:qo,attachmentDocumentKey:fo,supportsAttachmentUploads:ve,attachmentUploadsCapabilityKnown:Z,pendingImageCompressionsRef:vu,addComposerDraftImage:Fr,addComposerDraftImages:ka,removeComposerDraftImage:As}),{onComposerPaste:gO,insertComposerTextAtEnd:hO,addDroppedFolders:yO,isDragOverComposer:vO,composerMentionDragHandlers:CO,onComposerMentionDragLeaveCapture:xO}=MN({api:nt,t:de,addComposerImages:wx,attachments:t.attachments,promptRef:ce,promptInputRef:bt,composerEditorRef:Pa,composerFormRef:Os,composerThreadKey:a,attachmentDocumentKey:fo,attachmentImagesRef:pt,limits:lt,supportsAttachmentUploads:ve,attachmentUploadsCapabilityKnown:Z,composerDocumentKey:$n,isComposerApprovalState:Ea,pasteBlocked:i.length>0&&Yt===null,hasPendingUserInputs:i.length>0,projectSelectionRequired:U,environmentId:ne}),Tx=R(()=>{Ct()},[Ct]),Ix=R(()=>{se()},[se]),{handleComposerPaste:bO,handleComposerSubmit:wO,handleUnclaimedEscape:TO}=n1({onComposerPaste:gO,submitComposer:Ma.submitComposerOrShellCommand,exitShellCommandMode:Ma.exitShellCommandMode});return BN({composerRef:Ze,sendContextRef:Et,api:nt,t:de,limits:lt,composerData:n,refs:{composerEditorRef:Pa,promptInputRef:bt,promptRef:ce,composerImagesRef:pt,composerTerminalContextsRef:ze,composerElementContextsRef:et},composerDraftTarget:ge,activeThread:O,addComposerImages:wx,addDroppedFolders:yO,focusComposer:It,insertComposerTextAtEnd:hO,insertComposerDraftTerminalContext:dg,composerBrowserAnnotations:Ue,composerReviewComments:rt,isComposerApprovalState:Ea,pendingUserInputCount:i.length,projectSelectionRequired:U,noProviderAvailable:Tl,modelState:yn,handleRuntimeModeChange:Xe,runtimeMode:w,setIsComposerModelPickerOpen:Ns,setProviderInputSubmissionError:Ds}),l(p_,{formRef:Os,onSubmit:Ma.submitComposerOrShellCommand,onFocusCapture:oO,onBlurCapture:Fs,dragHandlers:CO,onDragLeaveCapture:xO,badges:vg,stashQueueLength:Rl.stashQueue.length,isStashMenuOpen:Ll,stashPulse:_s,toggleStashMenu:Rl.toggleStashMenu,drawers:l(e1,{composerOccupant:Cx,showComposerTopDrawer:xx,hasBlockingComposerTopDrawer:bx,isTasksDrawerOpen:pu,isComposerCollapsedMobile:Ra,respondingRequestIds:g,keybindings:me,onRespondToApproval:_t,onRespondToDecision:Xt,environmentId:ne,activePendingDraftAnswers:m,activePendingQuestionIndex:p,onSelectActivePendingUserInputOption:kt,activeProposedPlan:Qt,activePendingProgress:d,isPendingUserInputChoiceOnly:aO,expandMobileComposer:ht,badges:vg,pendingPrimaryAction:mo,isSendBusy:J,sendDisabledReason:iu,environmentUnavailable:Y,noProviderAvailable:Tl,projectSelectionRequired:U,onGoToActivePendingUserInputQuestion:L,handleInterruptPrimaryAction:Tx,handleImplementPlanInNewThreadPrimaryAction:Ix}),children:l(u_,{pluginAction:Sl,props:t,composerDraft:Bt,model:yn,traits:cO,submit:Ma,stash:Rl,badges:vg,uploadsByImageId:wt,composerImages:Jt,nonPersistedComposerImageIds:Lt,removeComposerImage:mO,removeComposerDraftBrowserAnnotation:cg,removeComposerDraftReviewComment:au,removeComposerDraftElementContext:ru,onComposerAttachmentInputChange:fO,surfaceRef:yu,composerAttachmentInputRef:hg,promptInputRef:bt,composerEditorRef:Pa,composerMenuAnchor:fg,setComposerMenuAnchor:uu,composerDocumentKey:$n,isComposerCollapsedMobile:Ra,expandMobileComposer:ht,isDragOverComposer:vO,isComposerApprovalState:Ea,showCollapsedMobilePromptRow:sO,activePendingProgress:d,pendingUserInputs:i,changeUserInputCustomAnswer:b,pendingPrimaryAction:mo,handleComposerPaste:bO,handleComposerSubmit:wO,onPromptEdited:pO,handleUnclaimedEscape:TO,openModelPicker:nO,switchInteractionMode:rO,providerInputSubmissionError:kl,isStashMenuOpen:Ll,isComposerFooterCompact:lO,isComposerPrimaryActionsCompact:dO,isMobileViewport:La,isComposerModelPickerOpen:cu,setIsComposerModelPickerOpen:Ns,showPlanFollowUpPrompt:St,compactDisabled:ae,compactThreadContext:Ma.compactThreadContext,status:{projectSelectionRequired:U,groupSendDisabledReason:X,isSendBusy:J,environmentUnavailable:Y,interruptArmed:gt,stopping:Dt,agentNotChosen:ee,unavailableAgentInstanceId:F,lockedProvider:I,phase:D,continuationChecking:G,activeThread:O,interactionMode:k,runtimeMode:w},actions:{handleInterruptPrimaryAction:Tx,handleImplementPlanInNewThreadPrimaryAction:Ix}})})});function l1(e){let{composerRef:t,...o}=e;return l(al,{value:o.api,children:l(i1,{...o,composerRef:t})})}function xl({section:e,resetKey:t,children:o}){return l(vi,{resetKey:t,fallback:n=>gj(e,n),children:o})}function gj(e,t){return l(hj,{section:e,error:t})}function hj({section:e,error:t}){let{t:o}=Ne();return v("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:[l(eo,{"aria-hidden":!0,className:"size-4 shrink-0 text-destructive-foreground"}),v("div",{className:"min-w-0",children:[l("p",{className:"font-medium text-foreground",children:o(`timeline.sectionUnavailable.${e}`)}),l("p",{className:"whitespace-pre-wrap break-words text-muted-foreground",children:o("timeline.sectionUnavailableHint",{reason:t.message})})]})]})}function d1({hostVersion:e,scopeClass:t}){let{t:o}=Ne();return v("div",{role:"status","data-conversation-host-data-mismatch":!0,className:V("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:[l(eo,{"aria-hidden":!0,className:"size-5 text-destructive-foreground"}),l("p",{className:"font-medium text-foreground",children:o("timeline.hostDataMismatchTitle")}),l("p",{className:"max-w-md text-muted-foreground",children:o("timeline.hostDataMismatchDescription",{host:e??0,plugin:Ml})})]})}$();function c1(e){let t=Nt();H(()=>{let o=e.current;if(!o)return;let n=r=>{let a=r.detail?.reference;a&&t.openThread({environmentId:a.environmentId,threadId:a.threadId})};return o.addEventListener(Hs,n),()=>o.removeEventListener(Hs,n)},[t,e])}function u1({data:e,target:t,slots:o,children:n}){return l(zb,{data:e,target:t,children:l(lh,{value:o,children:n})})}function p1(e){let{data:t}=e;return t?.version!==Ml?l(d1,{hostVersion:t?.version??null,scopeClass:e.scopeClass}):l(Ru.Provider,{value:e.scope.active,children:l(Cj,{...e,data:t})})}var yj=pe(function({threadKey:t,onModeChange:o,summaryContext:n}){let[r]=Ge(t,null,{namespace:"turn-navigator"}),a=R(s=>{o("chat"),r?.onSelect(s)},[o,r]);return r===null?null:l(ew,{...r,placement:"inline",onSelect:a,summaryContext:n})});function vj({slots:e,children:t}){let{data:o,target:n,threadKey:r}=Ho(),a=o.useComposerPending({target:n,threadKey:r});return e?.renderSlotChain("conversation.composer",{occupants:a.occupants},t)??t}function Cj(e){let{scope:t,mode:o,timeline:n,trajectory:r,composer:a,data:s}=e,[,i]=Ge(t.threadKey,null,{namespace:"turn-navigator"}),d=a.draftHero.active,c=a.sessionActions,u=a.terminalControl,m=a.agentsControl,{mode:p,onModeChange:f}=o,g=W(()=>({data:s,target:{environmentId:t.environmentId,threadId:t.threadId},threadKey:t.threadKey,openTrajectory:()=>f("trajectory"),onOpenFileDiff:n.onOpenFileDiff}),[s,t.environmentId,t.threadId,t.threadKey,f,n.onOpenFileDiff]),h=W(()=>d?v(oe,{children:[c,l("div",{className:"min-w-0 flex-1"}),u]}):v(oe,{children:[c,l(Fb,{mode:p,onModeChange:f}),l("div",{className:"min-w-0 flex-1"}),u,m,l(yj,{threadKey:t.threadKey,onModeChange:f,summaryContext:g})]}),[d,c,u,m,p,f,t.threadKey,g]),{belowSlot:y,teamDock:x,draftHero:C,onOverlayElementChange:b,sessionActions:L,terminalControl:w,agentsControl:k,contextStrip:I,...T}=a,S=l(l1,{...T,attachments:e.attachments,firstRow:h}),P=W(()=>({environmentId:t.environmentId,threadId:t.threadId}),[t.environmentId,t.threadId]),[A,N]=q(null),B=R(he=>N(he?{key:t.threadKey,value:he}:null),[t.threadKey]),O=A?.key===t.threadKey?A.value:null,[j,U]=Ge(t.threadKey,null,{namespace:"trajectory-reveal"}),D=R(he=>{o.onModeChange("chat"),U(Ae=>({rowId:he,nonce:(Ae?.nonce??0)+1}))},[o,U]),J=R(()=>U(null),[U]),G=E(null);c1(G);let{t:M}=z(),X=E(a.api);X.current=a.api;let F=R(he=>X.current.notify.warning(M(`timeline.quote.${he}`)),[M]),ee=R(()=>X.current.notify.warning(M("forkRelations.messageMissing")),[M]),[Y,ae]=Ge(t.threadKey,null,{namespace:"timeline-quote-reveal"});H(()=>{let he=G.current;if(!he)return;let Ae=De=>{let je=De.detail?.quote;if(je){if(je.environmentId!==P.environmentId||je.threadId!==P.threadId){F("otherThread");return}o.onModeChange("chat"),ae({quote:je})}};return he.addEventListener(wu,Ae),()=>he.removeEventListener(wu,Ae)},[o,ae,P.environmentId,P.threadId,F]);let te=R(he=>{ae(null),he==="message-missing"&&F("messageMissing"),he==="passage-missing"&&F("passageMissing")},[ae,F]),de=W(()=>({data:s,target:P,threadKey:t.threadKey}),[s,P,t.threadKey]),{controlRef:ge,...ne}=n,Z=s.useChatWindow({target:P,threadKey:t.threadKey,visible:t.visible&&o.mode==="chat"}),ve=FS({inputKey:t.threadKey,visible:t.visible,endInset:n.contentInsetEndAdjustment,derive:e.derive,onReturnToLatest:Z.onReturnToLatest,controlRef:ge});return l(u1,{slots:a.slots,data:s,target:P,children:v("div",{ref:G,className:V("relative flex min-h-0 min-w-0 flex-1 flex-col",e.scopeClass),"data-conversation-surface":!0,children:[s.useMessageReveal?l(xj,{read:s.useMessageReveal,target:P,onChange:B,active:t.active&&t.visible,onModeChange:o.onModeChange},t.threadKey):null,l(bj,{data:s,target:P,threadKey:t.threadKey,environmentId:t.environmentId,threadId:t.threadId,slots:a.slots}),l(ow,{data:s,target:P,threadKey:t.threadKey,surfaceRef:G}),l(Bb,{chat:v(xl,{section:"chat",resetKey:t.threadKey,children:[l(MS,{data:s,target:P,visible:t.visible,...ne,paneActive:t.active,liveFollowEnabled:ve.liveFollowEnabled,scrollerRef:ve.bindTimelineHandle,onRowsChange:ve.onRowsChange,onIsAtEndChange:ve.onIsAtEndChange,onManualNavigation:ve.onManualNavigation,onDisclosureNavigation:ve.onDisclosureNavigation,loadEarlier:Z.loadEarlier,loadLater:Z.loadLater,pagingBlockedByInteraction:Z.pagingBlockedByInteraction,restoringHistory:Z.restoringHistory??!1,onVisibleTurnRangeChange:Z.onVisibleTurnRangeChange,onReturnToLatest:Z.loadLater===null?null:ve.returnToEnd,onTurnNavigatorChange:i,revealMessageRequest:j,messageReveal:t.active?O:null,onMessageRevealMissing:ee,revealQuoteRequest:Y,onRevealQuoteDone:te,onRevealMessageHandled:J}),l(NS,{data:s,target:P,bottomInset:n.contentInsetEndAdjustment,showScrollToEnd:ve.showScrollToEnd,onScrollToEnd:ve.returnToEnd})]},"chat"),mode:o.mode,trajectory:l(xl,{section:"trajectory",resetKey:t.threadKey,children:l(YS,{data:s,target:P,inputKey:t.threadKey,paneVisible:t.visible&&o.mode==="trajectory",timestampFormat:r.timestampFormat,contentInsetEndAdjustment:n.contentInsetEndAdjustment,onOpenInChat:D,onOpenFileDiff:n.onOpenFileDiff})},"trajectory"),visible:t.visible}),l(uN,{api:a.api,data:s,draftId:a.draftId,target:P,threadKey:t.threadKey,belowSlot:a.belowSlot,teamDock:a.teamDock,composer:l(xl,{section:"composer",resetKey:t.threadKey,children:l(Np,{value:de,children:l(a1,{children:l(vj,{slots:a.slots,children:S})})})}),draftHero:a.draftHero,slots:a.slots,environmentId:t.environmentId,threadId:t.threadId,onOverlayElementChange:a.onOverlayElementChange,questions:l(xl,{section:"composer",resetKey:t.threadKey,children:l(ZA,{data:s,target:P})}),queue:l(xl,{section:"queue",resetKey:t.threadKey,children:l(XA,{data:s,target:P,inputKey:t.threadKey,attachments:e.attachments})})})]})})}function xj({read:e,target:t,onChange:o,active:n,onModeChange:r}){let a=e(t);return H(()=>{o(a)},[a,o]),H(()=>()=>o(null),[o]),H(()=>{n&&a.request&&r("chat")},[n,a.request,r]),null}function bj(e){let o=e.data.useComposerStatus({target:e.target,threadKey:e.threadKey}).activeThread?.presetId??null;return l("div",{className:"max-h-[min(280px,36vh)] min-h-0 shrink overflow-y-auto empty:hidden","data-conversation-views":!0,children:e.slots?.renderSlot("conversation.view",{environmentId:e.environmentId,threadId:e.threadId,presetId:o})},e.threadKey)}$();$();function cx(e){return e.turnOutline??e.turns.map((t,o)=>({messageId:t.messageId,ordinal:Math.max(e.turnCount,e.turns.length)-e.turns.length+o+1,...t.error!==null?{failed:!0}:{},...o===e.turns.length-1&&e.status==="waiting"?{waiting:!0}:{}}))}function m1(e,t,o){let n=cx(e),r=[],a=[],s=()=>{if(a.length>=3)r.push({kind:"group",turns:a});else for(let i of a)r.push({kind:"turn",turn:i});a=[]};return n.forEach((i,d)=>{d===0||d===n.length-1||i.failed||i.waiting||i.forkSource||t.has(i.messageId)||o.has(`${e.threadId}:${i.messageId}`)?(s(),r.push({kind:"turn",turn:i})):a.push(i)}),s(),r}var Bn=264,cr=136,ng=20,f1=16,g1=16,wj=(Bn+ng)/3,Tj=Bn/2,Ij={cards:[],edges:[],ticks:[],width:0,height:0};function ux(e){return`${e}:thread`}function rg(e,t){return`${e}:turn:${t}`}function h1(e){if(e.threads.length===0)return Ij;let t=[...e.threads].sort((C,b)=>C.createdAt.localeCompare(b.createdAt)||C.threadId.localeCompare(b.threadId)),o=new Map,n=[],r=0,a=null;t.forEach((C,b)=>{let L=e.dayOf(C.createdAt);if(b>0&&(r+=wj+(L===a?0:Tj)),L!==a){let w=t[b-1],k=w===void 0?0:Date.parse(C.createdAt)-Date.parse(w.createdAt);n.push({x:r,at:C.createdAt,...k>864e5?{gapDays:Math.floor(k/864e5)}:{}})}a=L,o.set(C.threadId,r)});let s=new Map(t.map(C=>[C.threadId,C])),i=new Map;for(let C of t){if(C.forkedFrom===null)continue;let b=i.get(C.forkedFrom.sourceThreadId)??new Set;b.add(C.forkedFrom.sourceMessageId),i.set(C.forkedFrom.sourceThreadId,b)}let d=new Map(t.map(C=>[C.threadId,m1(C,i.get(C.threadId)??new Set,e.revealed??new Set)])),c=new Map,u=[],m=new Map,p=0,f=[];for(let C of t){let b=o.get(C.threadId)??0,L=Sj(C,e.expanded,d.get(C.threadId)??[]),w=C.forkedFrom===null?void 0:s.get(C.forkedFrom.sourceThreadId),k=w!==void 0?c.get(w.threadId):void 0,I=k===void 0?0:k+1;for(;I<f.length&&(f[I]??0)+ng>b;)I+=1;f[I]=b+L,c.set(C.threadId,I),p=Math.max(p,b+L)}let g=Math.max(1,f.length),h=g1*2+g*cr+(g-1)*f1;for(let C of t){let b=g1+(c.get(C.threadId)??0)*(cr+f1),L=o.get(C.threadId)??0,w=kj(C,e.expanded,d.get(C.threadId)??[],L,b);u.push(...w),w[0]!==void 0&&m.set(C.threadId,w[0])}let y=[],x=new Map(u.map(C=>[C.id,C]));for(let C of t){let b=C.forkedFrom,L=m.get(C.threadId);if(b===null||L===void 0)continue;let w=x.get(rg(b.sourceThreadId,b.sourceMessageId))??m.get(b.sourceThreadId);w!==void 0&&y.push({id:`${w.id}->${L.id}`,path:Lj(w,L),sourceThreadId:b.sourceThreadId,childThreadId:C.threadId})}return{cards:u,edges:y,ticks:n,width:p,height:h}}function y1(e,t){return t.has(e.threadId)&&cx(e).length>0}function Sj(e,t,o){let n=y1(e,t)?o.length:1;return n*Bn+(n-1)*ng}function kj(e,t,o,n,r){return y1(e,t)?o.map((a,s)=>{let i=a.kind==="turn"?a.turn:a.turns[0];if(i===void 0)throw new Error("Empty turn group");return{id:a.kind==="group"?`${e.threadId}:group:${i.messageId}`:rg(e.threadId,i.messageId),kind:a.kind,threadId:e.threadId,turnIndex:i.ordinal-1,messageId:i.messageId,...a.kind==="group"?{groupedMessageIds:a.turns.map(d=>d.messageId)}:{},x:n+s*(Bn+ng),y:r}}):[{id:ux(e.threadId),kind:"thread",threadId:e.threadId,turnIndex:-1,x:n,y:r}]}function Lj(e,t){let o=e.x+Bn/2,n=e.y+cr,r=t.x,a=t.y+cr/2,s=Math.max(24,(a-n)/2);return`M ${o} ${n} C ${o} ${n+s}, ${r-s} ${a}, ${r} ${a}`}function v1(e,t,o,n=240){if(o.width===0||o.height===0)return!1;let r=e.x*t.scale+t.x,a=e.y*t.scale+t.y;return r+Bn*t.scale>=-n&&a+cr*t.scale>=-n&&r<=o.width+n&&a<=o.height+n}var Hn=24;function nu(e){return{left:0,top:36}}function px(e,t,o=1){let n=nu(t),r=t.width-n.left-Hn*2,a=e.cards.at(-1),s=a===void 0?e.width:a.x+Bn,i=s*o<=r?n.left+Hn:t.width-Hn-s*o,d=Math.min(n.top+Hn/2,t.height-Hn-(a===void 0?0:a.y+cr)*o);return{x:i,y:d,scale:o}}function x1(e,t,o){return{...e,x:e.x+(o.width-t.width)/2,y:e.y+(o.height-t.height)/2}}function b1(e,t){let o=nu(t);if(e.width===0||t.width===0)return{x:o.left+Hn,y:o.top+Hn/2,scale:1};let n=k1(Math.min((t.width-o.left-Hn*2)/e.width,(t.height-o.top-Hn*2)/Math.max(1,e.height)),.25,1);return{x:o.left+Hn,y:o.top+Hn/2,scale:n}}function w1(e,t,o){let n=nu(o),r=n.left+(o.width-n.left)/2,a=n.top+(o.height-n.top)/2;return{scale:t.scale,x:r-(e.x+Bn/2)*t.scale,y:a-(e.y+cr/2)*t.scale}}function ag(e,t,o){let n=k1(e.scale*t,.25,4),r=(o.x-e.x)/e.scale,a=(o.y-e.y)/e.scale;return{scale:n,x:o.x-r*n,y:o.y-a*n}}function T1(e){return e.ctrlKey||e.metaKey}function I1(e,t,o=48){switch(t){case"ArrowLeft":return{...e,x:e.x+o};case"ArrowRight":return{...e,x:e.x-o};case"ArrowUp":return{...e,y:e.y+o};case"ArrowDown":return{...e,y:e.y-o};default:return null}}function mx(e,t){return t?e<=.55:e<.5}function S1(e,t,o){return{...e,x:e.x+(t.x-o.x)*e.scale,y:e.y+(t.y-o.y)*e.scale}}function k1(e,t,o){return Number.isFinite(e)?Math.min(o,Math.max(t,e)):t}$();function fx(e){return e.archived?"map.status.archived":Rj[e.status]}var Rj={running:"map.status.running",waiting:"map.status.waiting",failed:"map.status.failed",done:"map.status.done"};function L1(e,t){return{"data-selected":e.selected?"":void 0,"data-matched":e.matched?"":void 0,"data-current-match":e.current?"":void 0,"data-dimmed":e.dimmed?"":void 0,onPointerEnter:()=>e.onHover(t),onPointerLeave:()=>e.onHover(null),onFocus:()=>e.onHover(t),onBlur:()=>e.onHover(null),tabIndex:0}}function P1(e,t){return{style:{left:e.card.x,top:e.card.y},onPointerDown:o=>o.stopPropagation(),onClick:()=>e.onSelect(t),onKeyDown:o=>{o.target===o.currentTarget&&(o.key!=="Enter"&&o.key!==" "||(o.preventDefault(),e.onSelect(t)))}}}function Ej(e){return e===void 0?"":(e.answer||e.error||e.question).trim()}var R1=pe(function(t){let{t:o,thread:n}=t,r=t.formatTitle?.(n.title)??n.title,a=Ej(n.turns.at(-1)),s=n.loaded?n.turns.length>0:n.turnCount>0;return v("article",{className:"session-map-card","data-status":n.archived?"archived":n.status,...L1(t,n.threadId),"aria-label":r||o("settings.hiddenUntitled"),...P1(t,n.threadId),children:[v("header",{children:[l("span",{className:"session-map-dot","aria-hidden":!0}),l("strong",{children:r||o("settings.hiddenUntitled")})]}),t.forkCount>0?l("span",{className:"session-map-forks",children:o("map.forks",{count:t.forkCount})}):null,v("p",{className:"session-map-meta",children:[l("span",{className:"session-map-status",children:o(fx(n))}),n.loaded?l("span",{children:o("map.turns",{count:n.turnCount})}):null,l("span",{children:t.updatedLabel})]}),n.loaded?l("p",{className:"session-map-preview",children:a||o("map.noReply")}):l("p",{className:"session-map-preview","data-pending":"","aria-hidden":!0}),v("footer",{onClick:i=>i.stopPropagation(),children:[s?l(K,{type:"button",size:"xs",variant:"ghost",onClick:()=>t.onExpand(t.card),children:o("map.expand")}):null,l(K,{type:"button",size:"xs",variant:"outline",onClick:()=>t.onOpen(n.threadId),children:o("map.open")}),v(Pe,{children:[l(Ee,{render:l(K,{type:"button",size:"icon-xs",variant:"ghost","aria-label":o("map.hide"),onClick:()=>t.onHide(n.threadId)}),children:l(zl,{})}),l(Re,{side:"top",children:o("map.hide")})]})]})]})}),E1=pe(function(t){let{t:o,thread:n,card:r}=t,a=t.formatTitle?.(n.title)??n.title,s=n.turns.find(u=>u.messageId===r.messageId),i=n.turnOutline?.find(u=>u.messageId===r.messageId),d=r.turnIndex+1,c=(s?.answer||s?.error||"").trim();return v("article",{className:"session-map-card","data-turn":"","data-status":n.archived?"archived":i?.failed?"failed":i?.waiting?"waiting":d===n.turnCount?n.status:"done",...L1(t,n.threadId),"aria-label":o("map.turnLabel",{index:d,title:a}),...P1(t,n.threadId),children:[v("header",{children:[l("span",{className:"session-map-dot","aria-hidden":!0}),l("span",{className:"session-map-ordinal",children:o("map.turnOrdinal",{index:d})}),v("strong",{children:[l("span",{className:"session-map-turn-question",children:s?.question||o(s===void 0?"map.loading":"map.noQuestion")}),l("span",{className:"session-map-compact-title",children:a||o("settings.hiddenUntitled")})]})]}),t.forkCount>0?l("span",{className:"session-map-forks",children:o("map.forks",{count:t.forkCount})}):null,l("p",{className:"session-map-preview","data-error":s?.error!=null&&s.answer.length===0?"":void 0,"data-pending":s===void 0?"":void 0,children:s===void 0?null:c||o("map.noReply")}),v("footer",{onClick:u=>u.stopPropagation(),children:[r.turnIndex===0?l(K,{type:"button",size:"xs",variant:"ghost",onClick:()=>t.onCollapse(r),children:o("map.collapse")}):null,v(K,{type:"button",size:"xs",variant:"ghost",onClick:()=>{r.messageId!==void 0&&t.onFork(n.threadId,r.messageId)},children:[l(Vl,{}),o("map.fork")]})]})]})}),M1=pe(function(t){return v("article",{className:"session-map-card session-map-group",tabIndex:0,"aria-label":t.t("map.otherTurns",{count:t.card.groupedMessageIds?.length??0}),onClick:()=>t.onReveal(t.card),onKeyDown:o=>{o.target===o.currentTarget&&(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),t.onReveal(t.card))},"data-status":t.thread.archived?"archived":"done","data-dimmed":t.dimmed?"":void 0,"data-selected":t.selected?"":void 0,onPointerDown:o=>o.stopPropagation(),onPointerEnter:()=>t.onHover(t.thread.threadId),onPointerLeave:()=>t.onHover(null),onFocus:()=>t.onHover(t.thread.threadId),onBlur:()=>t.onHover(null),style:{left:t.card.x,top:t.card.y},children:[v("header",{children:[l("span",{className:"session-map-dot","aria-hidden":!0}),l("strong",{children:(t.formatTitle?.(t.thread.title)??t.thread.title)||t.t("settings.hiddenUntitled")})]}),l(K,{type:"button",size:"sm",variant:"ghost",onClick:o=>{o.stopPropagation(),t.onReveal(t.card)},children:t.t("map.otherTurns",{count:t.card.groupedMessageIds?.length??0})})]})});function A1({text:e}){return e.length===0?null:l(wo,{className:"session-map-md",text:e})}var Mj=3;function N1(e){let{t,thread:o}=e,n=e.formatTitle?.(o.title)??o.title,a=(e.fuller??o).turns.slice(-Mj);return v("aside",{className:"session-map-panel","aria-label":n||t("settings.hiddenUntitled"),children:[v("header",{children:[l("strong",{children:n||t("settings.hiddenUntitled")}),l(K,{type:"button",size:"icon-xs",variant:"ghost","aria-label":t("map.closePanel"),onClick:e.onClose,children:l(dt,{})})]}),v("p",{className:"session-map-meta","data-status":o.archived?"archived":o.status,children:[l("span",{className:"session-map-dot","aria-hidden":!0}),l("span",{className:"session-map-status",children:t(fx(o))})]}),v("p",{className:"session-map-meta",children:[l("span",{children:t("map.created",{time:e.formatTime(o.createdAt)})}),l("span",{children:t("map.updated",{time:e.formatTime(o.updatedAt)})}),o.loaded?l("span",{children:t("map.turns",{count:o.turnCount})}):null]}),l(K,{type:"button",size:"sm",onClick:()=>e.onOpen(o.threadId),children:t("map.open")}),l("h3",{children:t("map.recent")}),e.notice!==null?l(Qr,{title:e.notice}):null,!o.loaded&&e.fuller===null?l(Qs,{"aria-label":t("map.loading")}):a.length===0?l(Qr,{title:t("map.noTurns")}):l("ol",{className:"session-map-turns",children:a.map(s=>v("li",{children:[l("p",{className:"session-map-question",children:s.question}),s.answer.length>0?l(A1,{text:s.answer}):s.error!==null?l("p",{className:"session-map-error",children:s.error}):l("p",{className:"session-map-muted",children:t("map.noReply")}),s.answerTruncated||s.questionTruncated?l("p",{className:"session-map-muted",children:t("map.truncated")}):null]},s.messageId))})]})}$();function D1(e){let t=new Map,o=new Map;for(let n of e){if(n.forkedFrom===null)continue;let r=n.forkedFrom.sourceThreadId;t.set(n.threadId,r);let a=o.get(r)??new Set;a.add(n.threadId),o.set(r,a)}return{count:n=>o.get(n)?.size??0,family:n=>{if(n===null)return new Set;let r=t.get(n);return new Set([n,...r===void 0?[]:[r],...o.get(n)??[]])}}}function _1(e,t,o,n,r){return t!==null&&!o.has(e)||n&&!r.has(e)}function O1(e,t,o){if(e.ticks.length===0)return[];let n=0;for(let s=1;s<e.ticks.length&&!(e.ticks[s].x*t.scale+t.x>0);s+=1)n=s;let r=e.ticks[n],a=e.ticks[n+1];return[{...r,gapDays:void 0,sticky:!0,left:Math.min(0,a===void 0?0:a.x*t.scale+t.x-112)},...e.ticks.slice(n+1).flatMap(s=>{let i=s.x*t.scale+t.x;return i<=o.width?[{...s,sticky:!1,left:i}]:[]})]}function F1(e){let t=E(null),o=E(null),n=E(!1),[r,a]=q(null),s=W(()=>D1(Array.from(e.threads.values())),[e.threads]),i=W(()=>s.family(e.selectedThreadId),[s,e.selectedThreadId]),d=E(e.camera),c=E(e.onCamera),u=E(e.onFrame);d.current=e.camera,c.current=e.onCamera,u.current=e.onFrame;let m=E(()=>{}),p=E(null);H(()=>{let w=t.current;if(w===null)return;let k=null,I=0,T=()=>{I=0;let B=k;k=null,B!==null&&c.current(B)},S=B=>{d.current=B,k=B;let O=o.current;O!==null&&(O.style.transform=gx(B),O.style.setProperty("--map-scale",String(B.scale)),n.current=mx(B.scale,n.current),O.toggleAttribute("data-compact",n.current)),I===0&&(I=window.requestAnimationFrame(T))};m.current=S;let P=B=>{B.preventDefault();let O=d.current;if(!T1(B)){S({...O,x:O.x-B.deltaX,y:O.y-B.deltaY});return}let j=w.getBoundingClientRect();S(ag(O,B.deltaY<0?1.08:.92,{x:B.clientX-j.left,y:B.clientY-j.top}))},A=()=>u.current({width:w.clientWidth,height:w.clientHeight});A();let N=new ResizeObserver(A);return N.observe(w),w.addEventListener("wheel",P,{passive:!1}),()=>{N.disconnect(),w.removeEventListener("wheel",P),I!==0&&window.cancelAnimationFrame(I)}},[]),H(()=>{if(p.current!==null)return;let w=o.current;w!==null&&(w.style.transform=gx(e.camera),w.style.setProperty("--map-scale",String(e.camera.scale)),n.current=mx(e.camera.scale,n.current),w.toggleAttribute("data-compact",n.current))},[e.camera]);let f=W(()=>e.layout.cards.filter(w=>v1(w,e.camera,e.frame)),[e.layout,e.camera,e.frame]),g=W(()=>{let w=new Set;for(let k of f)e.threads.get(k.threadId)?.loaded===!1&&w.add(k.threadId);return[...w].sort().join(`
3588
+ `)?e.slice(0,-1):e}function nj(e){return e.startsWith("diff --git")||e.includes(`
3589
+ diff --git`)}function z_(e,t){if(e.length===0)return[""];let o=`
3590
+ ${t}`,n=e.startsWith(t)?0:F_(e,o,0);if(n===-1)return[e];let r=[];n>0&&r.push(e.slice(0,n));let a=n;for(;;){let s=F_(e,o,a+1);if(s===-1)break;r.push(e.slice(a,s)),a=s}return r.push(e.slice(a)),r}function F_(e,t,o){let n=e.indexOf(t,o);return n===-1?-1:n+1}function B_(e){return e==null?e:Kt(e)}function rj(e){return e===" "?"context":e==="\\"?"metadata":e==="+"?"addition":"deletion"}function ax(e){let t=e.slice(1);return Kt(t===""?`
3591
+ `:t)}function sx(e,t,o){return e==="change"?{type:"change",additions:0,deletions:0,additionLineIndex:o,deletionLineIndex:t}:{type:"context",lines:0,additionLineIndex:o,deletionLineIndex:t}}var q_=2166136261,W_=16777619,aj=2654435769,sj=2246822507;function K_(e,t=q_,o=W_){let n=t>>>0;for(let r=0;r<e.length;r+=1)n^=e.charCodeAt(r),n=Math.imul(n,o)>>>0;return n>>>0}function ij(e,t="diff-panel"){let o=e.trim(),n=K_(o,q_,W_).toString(36),r=K_(o,aj,sj).toString(36);return`${t}:${o.length}:${n}:${r}`}function dx(e){if(!e.isPartial)return e;let t=0,o=0,n=e.hunks.map(r=>{let a={...r,splitLineStart:t,unifiedLineStart:o};return t+=r.splitLineCount,o+=r.unifiedLineCount,a});return{...e,hunks:n,splitLineCount:t,unifiedLineCount:o,...e.cacheKey?{cacheKey:`${e.cacheKey}:compact-partial`}:{}}}function G_(e,t="diff-panel",o={}){if(!e)return null;let n=e.trim();if(n.length===0)return null;try{let a=lx(n,{cacheKeyPrefix:ij(n,t)}).flatMap(s=>o.compactPartialHunkOffsets?s.files.map(dx):s.files);return a.length>0?{kind:"files",files:a}:{kind:"raw",text:n,reason:"Unsupported diff format. Showing raw patch."}}catch{return{kind:"raw",text:n,reason:"Failed to parse patch. Showing raw patch."}}}function j_(e){let t=e.cacheKey;return t?t.endsWith(":hydrated")?t.slice(0,-9):t:`${e.prevName??"none"}:${e.name}:${e.type}`}function V_({fileChange:e,onOpenDiff:t}){let{t:o}=z(),[n,r]=q(!1),a=W(()=>b_(e),[e]),s=T_(e);return v("div",{className:"min-w-0",children:[v("div",{className:"flex min-w-0 flex-wrap items-center gap-1",children:[l("span",{className:"min-w-0 shrink truncate font-mono text-ui-sm text-foreground/85",children:e.path}),l("span",{className:"shrink-0 font-mono text-ui-sm text-muted-foreground tabular-nums",children:o("approval.diff.stat",{additions:s.additions,deletions:s.deletions})}),a===null?l("span",{className:"text-ui-sm text-muted-foreground",children:e.omitted==="too-large"?o("approval.diff.tooLarge"):o("approval.diff.unavailable")}):v(K,{size:"micro",variant:"ghost-muted",className:"font-normal","aria-expanded":n,onClick:()=>r(i=>!i),children:[n?l(Tt,{className:"size-3 shrink-0"}):l(yo,{className:"size-3 shrink-0"}),l("span",{children:o(n?"approval.diff.hide":"approval.diff.show")})]}),t?l(K,{size:"micro",variant:"ghost-muted",className:"font-normal",onClick:()=>t(e.path),children:o("approval.diff.open")}):null]}),n&&a!==null?l(lj,{path:e.path,unifiedDiff:a}):null]})}function lj({path:e,unifiedDiff:t}){let o=it().theme.useResolvedTheme(),n=W(()=>{let r=G_(t,`approval:${o}`,{compactPartialHunkOffsets:!0});return r?.kind==="files"?r.files.map(a=>({id:j_(dx(a)),type:"diff",fileDiff:a,collapsed:!1})):[]},[o,t]);return n.length===0?l("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-ui-sm leading-relaxed text-muted-foreground/90 [scrollbar-width:thin]",tabIndex:0,children:t}):l("div",{className:"mt-1 overflow-hidden rounded-md border border-border/60",children:l(Nb,{className:"max-h-56 overflow-auto [scrollbar-gutter:stable]",items:n,options:{diffStyle:"unified",lineDiffType:"none",overflow:"wrap",theme:k_(o),themeType:o,stickyHeaders:!1}})})}var dj={command:l(Vo,{}),"file-read":l(Ha,{}),"file-change":l(Ur,{}),"web-fetch":l(Ql,{}),"web-search":l(ud,{}),skill:l(jn,{}),"mcp-tool":l(Ws,{}),tool:l(Ws,{}),"mcp-elicitation":l(Nl,{})};function Q_(e){return dj[e]}var cj=4,uj=300,pj="min-w-0 rounded-md bg-muted px-2.5 py-2",mj="min-w-0 font-mono text-chat-code text-foreground/90 [font-variant-ligatures:none]";function fj(e){return[...e.matchAll(/\S+|\s+/g)].map(t=>/^\s/.test(t[0])?t[0]:l("span",{className:"inline-block max-w-full [overflow-wrap:anywhere]",children:t[0]},t.index))}function gj(e){let{t}=z(),[o,n]=q(!1),r=e.text.split(`
3592
+ `).length,a=e.text.split(/\r?\n/,1)[0]??"",s=e.command?!0:!e.singleLine&&(r>cj||e.text.length>uj),i=e.command&&!o,d=i?a:e.text;return v("div",{className:"flex min-w-0 flex-col gap-1",children:[e.hidePreview&&!o?null:l("div",{className:pj,children:l("code",{"aria-label":e.label,className:V(mj,e.singleLine||i?"block truncate whitespace-pre":"whitespace-pre-wrap [overflow-wrap:anywhere]",e.singleLine||i?"block":s&&!o?"line-clamp-4":"block"),"data-approval-detail":i?"preview":"complete",tabIndex:0,children:e.singleLine||i?d:fj(d)})}),s?l(K,{type:"button",variant:"ghost",size:"xs",className:"w-fit text-chat-row text-muted-foreground","aria-expanded":o,onClick:()=>n(c=>!c),children:e.command?t(o?"approval.body.hideCommand":"approval.body.showCommand"):t(o?"approval.body.showLess":"approval.body.showAll")}):null]})}var X_=pe(function({approval:t,pendingCount:o,onOpenDiff:n,actions:r,className:a}){let{t:s}=z(),i=t.presentation;if(i===void 0)return l(vr,{state:"pending",className:a,icon:Q_(t.requestKind),title:ZC(t.requestKind,s),actions:r,children:t.detail?l("p",{className:"whitespace-pre-wrap text-chat-row",children:t.detail}):null});let{body:d}=i,c=w_(i.fileChanges),u=i.headline===null?i.description:null,m=i.outsideSandbox||u||i.justification?v("span",{className:"inline-flex flex-wrap gap-x-2 gap-y-1",children:[i.outsideSandbox?l("span",{className:"text-warning-foreground",children:s("approval.outsideSandbox")}):null,u?l("span",{children:u}):null,i.justification?l("span",{children:i.justification}):null]}):void 0;return l(vr,{state:"pending",className:a,icon:Q_(i.kind),title:i.headlineIsCommand?l("span",{className:"block truncate font-mono [font-variant-ligatures:none]",children:JC(i,s)}):JC(i,s),subtitle:m,meta:o>1?`1/${o}`:void 0,actions:r,children:v("div",{"aria-label":ZC(i.kind,s),className:"flex min-w-0 flex-col gap-2",role:"group",children:[d.shape==="none"?null:l(gj,{command:d.shape==="command",hidePreview:i.headlineIsCommand,label:I_(d.shape,s),singleLine:d.shape==="path"||d.shape==="url",text:d.shape==="command"?d.command:d.shape==="path"?d.path:d.shape==="url"?d.url:d.shape==="query"?d.query:d.text},t.requestId),i.fileChanges.map((p,f)=>l(V_,{fileChange:p,onOpenDiff:n},c[f])),i.detailArgs.length===0?null:v("details",{className:"min-w-0","data-approval-args":"true",children:[l("summary",{className:"cursor-[var(--control-cursor)] text-chat-row text-muted-foreground",children:s("approval.body.detailsSummary")}),l("dl",{"aria-label":s("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 bg-muted p-2 text-ui-sm [scrollbar-width:thin]",tabIndex:0,children:i.detailArgs.map(p=>v("div",{className:"col-span-2 grid grid-cols-subgrid",children:[l("dt",{className:"font-mono text-muted-foreground",children:p.name}),l("dd",{className:"min-w-0 font-mono whitespace-pre-wrap wrap-break-word text-foreground/85",children:p.value})]},p.name))})]})]})})});var tu=pe(function(t){return l(X_,{...t})});$();function hj(e){return[...e.filter(t=>t.tone==="primary"),...e.filter(t=>t.tone!=="primary")]}var ou=pe(function(t){let{t:o}=z(),n=it(),{shortcuts:r=!0}=t,[a,s]=q(!1),[i,d]=q(!1),c=E(!1),u=t.decision,m=u.requestId,p=hj(u.options),{onRespond:f}=t,g=R(L=>{m===null||c.current||(c.current=!0,d(!0),Promise.resolve(f(m,L)).finally(()=>{c.current=!1,d(!1)}))},[f,m]);if(n.pane.useKeydown(L=>{if(!r||m===null||c.current||L.defaultPrevented||n.terminalFocus.getOwner()!==null||L.isComposing||L.keyCode===229||L.metaKey||L.ctrlKey||L.altKey||L.shiftKey||er(L.target))return;let w=Hd(L.key,p.length);if(w===null)return;let k=p[w];k&&(L.preventDefault(),g(k.id))},{target:"document"}),m===null)return null;let h=L=>L.key===void 0?L.text:o(L.key,{...L.params,defaultValue:L.text}),y=u.askedBy.kind==="plugin"?u.askedBy.pluginId:null,[x,...C]=u.body,b=L=>{let w=p.indexOf(L),k=L.tone==="primary";return v(K,{size:"sm",variant:k?"default":"ghost",className:V(!k&&(L.tone==="danger"?"text-destructive-foreground hover:text-destructive-foreground":"text-muted-foreground hover:text-foreground")),disabled:i,onClick:()=>g(L.id),children:[h(L.label),r&&w<9?l(oi,{className:Ci,children:w+1}):null]},L.id)};return l(vr,{state:"pending",className:V("px-3 py-2 sm:px-4",t.className),icon:y===null?l(Fa,{}):l(cd,{}),title:h(u.title),subtitle:x===void 0?void 0:h(x),meta:y===null?void 0:l(Mo,{environmentId:t.environmentId,pluginId:y,iconClassName:"size-3"}),actions:v(oe,{children:[u.detail===null?null:l(K,{size:"sm",variant:"ghost",className:"me-auto text-muted-foreground hover:text-foreground","aria-expanded":a,onClick:()=>s(L=>!L),children:o(a?"decision.hideDetail":"decision.showDetail")}),C_(u.options).map(b)]}),children:v("div",{className:"contents","data-composer-pending-decision":"true",children:[C.map((L,w)=>l("p",{className:"min-w-0 text-chat-row text-muted-foreground",children:h(L)},`${String(w)}:${L.key??L.text}`)),u.detail!==null&&a?l("pre",{className:"max-h-60 min-w-0 overflow-auto rounded-md bg-muted px-2.5 py-2 font-mono text-chat-code whitespace-pre-wrap text-foreground/90 [font-variant-ligatures:none] [overflow-wrap:anywhere]",children:u.detail.text.slice(0,4e3)}):null]})})});$();var og=pe(function({pendingUserInputs:t,respondingRequestIds:o,answers:n,questionIndex:r,onToggleOption:a,onGoToQuestion:s,shortcuts:i=!0}){if(t.length===0)return null;let d=t[0];return d?l(yj,{prompt:d,isResponding:o.includes(d.requestId),answers:n,questionIndex:r,onToggleOption:a,onGoToQuestion:s,shortcuts:i},d.requestId):null}),yj=pe(function({prompt:t,isResponding:o,answers:n,questionIndex:r,onToggleOption:a,onGoToQuestion:s,shortcuts:i}){let{t:d}=z(),c=it(),u=$f(t.questions,n,r),m=u.activeQuestion,p=E(null),f=E(s),[g,h]=q(null),[y,x]=q(null),C=y!==null&&y===m?.id;H(()=>{f.current=s},[s]),H(()=>{if(!(!m||m.multiSelect||!g)){if(g.questionId!==m.id){h(null);return}u.customAnswer.trim().length===0&&u.selectedOptionLabels.includes(g.optionLabel)&&h(null)}},[m,g,u.customAnswer,u.selectedOptionLabels]);let b=R(()=>{p.current!==null&&(window.clearTimeout(p.current),p.current=null)},[]);H(()=>b,[b]);let L=R(S=>{b(),s(S)},[b,s]),w=R((S,P)=>{if(m?.multiSelect){a(S,P);return}if(h({questionId:S,optionLabel:P}),a(S,P),b(),u.isLastQuestion)return;let A=u.questionIndex+1;p.current=window.setTimeout(()=>{p.current=null,f.current(A)},200)},[m,b,a,u.isLastQuestion,u.questionIndex]);if(c.pane.useKeydown(S=>{if(!i||!m||o||C||S.metaKey||S.ctrlKey||S.altKey||S.isComposing||S.keyCode===229||er(S.target))return;let P=Hd(S.key,m.options.length);if(P===null)return;let A=m.options[P];A&&(S.preventDefault(),w(m.id,Sa(A)))},{target:"document"}),!m)return null;let k=u.customAnswer.trim().length>0,I=g?.questionId===m.id?g.optionLabel:null,T=I!==null?[I]:k?[]:u.selectedOptionLabels;return v(vr,{state:"pending",className:"px-3 py-2 sm:px-4",icon:m.kind==="plan"?l(Zl,{}):l(qn,{}),title:m.header,meta:C&&t.questions.length>1?`${u.questionIndex+1}/${t.questions.length}`:void 0,collapse:{collapsed:C,onCollapsedChange:S=>{x(S?m.id:null)},hint:m.question,toggleLabel:d(C?"pendingUserInput.showQuestion":"pendingUserInput.hideQuestion")},children:[l(zf,{questions:t.questions,answers:n,currentIndex:u.questionIndex,disabled:o,onGoTo:L}),l("div",{className:"max-h-[min(45vh,28rem)] overflow-y-auto overscroll-contain break-words text-chat text-foreground","data-pending-user-input-body":m.kind??"question",tabIndex:0,children:m.kind==="plan"?l(wo,{text:m.question,cwd:void 0,isStreaming:!1}):l("p",{className:"whitespace-pre-wrap font-medium",children:m.question})}),m.multiSelect?l("p",{className:"text-chat-row text-muted-foreground",children:d("pendingUserInput.selectOneOrMore")}):null,l($u,{mode:m.multiSelect?"multiple":"single","aria-label":m.header,disabled:o,selected:T,onToggle:S=>{w(m.id,S)},onReselect:S=>{w(m.id,S)},options:m.options.map((S,P)=>{let A=yl(d,m,S);return{value:Sa(S),label:A.label,...A.description&&A.description!==A.label?{description:A.description}:{},...i&&P<9?{trailing:l(oi,{className:Ci,children:P+1})}:{}}})},m.id),l(Kf,{questions:t.questions,answers:n,currentIndex:u.questionIndex,disabled:o,onGoTo:L})]})});$();var Y_=pe(function({planTitle:t}){let{t:o}=z();return l("div",{className:"px-3 py-2 sm:px-4",children:v("div",{className:"flex flex-wrap items-center gap-2",children:[l("span",{className:"text-xs font-medium text-muted-foreground",children:o("plan.ready")}),t?l("span",{className:"min-w-0 flex-1 truncate text-xs text-foreground/85",children:t}):null]})})});function J_(e){if(e.occupant.kind!=="approval")return null;let{approval:t}=e.occupant;return l(eg,{requestId:t.requestId,isResponding:e.respondingRequestIds.includes(t.requestId),options:t.options,keybindings:e.keybindings,declineReasonRelay:t.declineReasonRelay,onRespondToApproval:e.onRespondToApproval})}function Z_(e){return e.occupant.kind!=="user-input"?null:l(og,{pendingUserInputs:[e.occupant.userInput],respondingRequestIds:e.respondingRequestIds,answers:e.activePendingDraftAnswers,questionIndex:e.activePendingQuestionIndex,onToggleOption:e.onSelectActivePendingUserInputOption,onGoToQuestion:e.onGoToActivePendingUserInputQuestion})}var e1={approval:{expanded:e=>e.occupant.kind!=="approval"?null:l(tu,{approval:e.occupant.approval,pendingCount:e.occupant.pendingCount,actions:J_(e),className:"px-3 py-2 sm:px-4"}),collapsed:e=>e.occupant.kind!=="approval"?null:l("div",{"data-chat-composer-collapsed-controls":"true",children:l(tu,{approval:e.occupant.approval,pendingCount:e.occupant.pendingCount,actions:J_(e),className:"px-3 pt-2 pb-3 sm:px-4"})})},decision:{expanded:e=>e.occupant.kind!=="decision"?null:l(ou,{decision:e.occupant.decision.card,environmentId:e.environmentId,onRespond:e.onRespondToDecision}),collapsed:e=>e.occupant.kind!=="decision"?null:l("div",{"data-chat-composer-collapsed-controls":"true",children:l(ou,{decision:e.occupant.decision.card,environmentId:e.environmentId,onRespond:e.onRespondToDecision,className:"pt-2 pb-3"})})},"user-input":{expanded:Z_,collapsed:e=>v("div",{"data-chat-composer-collapsed-controls":"true",children:[Z_(e),e.collapsedPendingRow]})},"plan-follow-up":{expanded:e=>e.activeProposedPlan===null?null:l(Y_,{planTitle:yi(e.activeProposedPlan.planMarkdown)??null},e.activeProposedPlan.id),collapsed:null}};function t1(e,t){let o=e1[e.occupant.kind],n=t?o.collapsed:o.expanded;return n===null?null:n(e)}var gLe=Object.keys(e1);function o1(e){let{composerOccupant:t,showComposerTopDrawer:o,hasBlockingComposerTopDrawer:n,isTasksDrawerOpen:r,isComposerCollapsedMobile:a,respondingRequestIds:s,keybindings:i,onRespondToApproval:d,onRespondToDecision:c,environmentId:u,activePendingDraftAnswers:m,activePendingQuestionIndex:p,onSelectActivePendingUserInputOption:f,activeProposedPlan:g,activePendingProgress:h,isPendingUserInputChoiceOnly:y,expandMobileComposer:x,badges:C,pendingPrimaryAction:b,isSendBusy:L,sendDisabledReason:w,environmentUnavailable:k,noProviderAvailable:I,projectSelectionRequired:T,onGoToActivePendingUserInputQuestion:S,handleInterruptPrimaryAction:P,handleImplementPlanInNewThreadPrimaryAction:A}=e,{inlineTasksBadge:N,inlineStashBadge:B,visibleTasksProgress:O,visibleTaskSteps:j,dismissTasks:U,toggleTasksDrawer:D}=C;return v(oe,{children:[o&&(!r||n)?l("div",{className:"chat-composer-top-drawer","data-chat-composer-top-drawer":"true","data-occupant":t?.kind??"none",children:t===null?null:t1({occupant:t,respondingRequestIds:s,keybindings:i,onRespondToApproval:d,onRespondToDecision:c,environmentId:u,activePendingDraftAnswers:m,activePendingQuestionIndex:p,onSelectActivePendingUserInputOption:f,onGoToActivePendingUserInputQuestion:S,activeProposedPlan:g,collapsedPendingRow:l(g_,{activePendingProgress:h,isPendingUserInputChoiceOnly:y,expandMobileComposer:x,inlineTasksBadge:N,inlineStashBadge:B,pendingPrimaryAction:b,isSendBusy:L,sendDisabledReason:w,isEnvironmentUnavailable:k!==null||I||T,handleInterruptPrimaryAction:P,handleImplementPlanInNewThreadPrimaryAction:A})},a)}):null,r&&!n&&O&&j?l(ZN,{onDismiss:U,onCollapse:D,progress:O,steps:j}):null]})}function n1(e,t){return{images:e.images,terminalContexts:e.terminalContexts,elementContexts:e.elementContexts,browserAnnotations:e.browserAnnotations,reviewComments:e.reviewComments,nonPersistedImageIds:e.nonPersistedImageIds,activeProvider:e.activeProvider,nativeModeByProvider:e.nativeModeByProvider,promptHasText:e.prompt.trim().length>0,hasSendableContent:t({prompt:e.prompt,imageCount:e.images.length,terminalContexts:e.terminalContexts,elementContextCount:e.elementContexts.length+e.browserAnnotations.length+e.reviewComments.length}).hasSendableContent}}function r1(e){let t=e.draft.useStore;return{setComposerDraftPrompt:t(o=>o.setPrompt),setComposerDraftNativeMode:t(o=>o.setNativeMode),addComposerDraftImage:t(o=>o.addImage),addComposerDraftImages:t(o=>o.addImages),removeComposerDraftImage:t(o=>o.removeImage),insertComposerDraftTerminalContext:t(o=>o.insertTerminalContext),removeComposerDraftElementContext:t(o=>o.removeElementContext),removeComposerDraftBrowserAnnotation:t(o=>o.removeBrowserAnnotation),removeComposerDraftReviewComment:t(o=>o.removeReviewComment),clearComposerDraftPromptAndImages:t(o=>o.clearComposerPromptAndImages)}}$();function a1(e){let{onComposerPaste:t,submitComposer:o,exitShellCommandMode:n}=e,r=E({onComposerPaste:t,submitComposer:o,exitShellCommandMode:n});r.current={onComposerPaste:t,submitComposer:o,exitShellCommandMode:n};let a=R(d=>{r.current.onComposerPaste(d)},[]),s=R((d,c)=>{r.current.submitComposer(d,c)},[]),i=R(()=>r.current.exitShellCommandMode(),[]);return{handleComposerPaste:a,handleComposerSubmit:s,handleUnclaimedEscape:i}}$();var s1=qe(null);function i1({children:e}){let{data:t,target:o,threadKey:n}=Ho(),r=t.useComposerStatus({target:o,threadKey:n});return l(s1.Provider,{value:r,children:e})}function l1(){let e=Pt(s1);if(e===null)throw new Error("Composer status has not been provided.");return e}var d1=pe(function(t){let o=lN(),{data:n,target:r,threadKey:a}=Ho(),{activePendingApproval:s,pendingUserInputs:i,activePendingProgress:d,activePendingResolvedAnswers:c,activePendingIsResponding:u,activePendingDraftAnswers:m,activePendingQuestionIndex:p,questionAttachmentsSupported:f,respondingRequestIds:g,occupants:h,respondToApproval:y,respondToDecision:x,selectUserInputOption:C,changeUserInputCustomAnswer:b,goToUserInputQuestion:L}=n.useComposerPending({target:r,threadKey:a}),{runtimeMode:w,interactionMode:k,lockedProvider:I,providerStatuses:T,activeProjectDefaultModelSelection:S,projectId:P,activeThreadModelSelection:A,activeThreadActualModel:N}=n.useComposerModelContext(r),{activeThreadId:B,activeThread:O,isLocalDraftThread:j,projectSelectionRequired:U,phase:D,isSendBusy:J,continuationChecking:G=!1,sendDisabledReason:M,groupSendDisabledReason:X,unavailableAgentInstanceId:F=null,noAgentChosen:ee=!1,environmentUnavailable:Y,compactDisabled:ae,compactDisabledReason:te}=l1(),{t:de}=z(),{composerDraftTarget:ge,environmentId:ne,attachmentUploadsCapabilityKnown:Z,supportsAttachmentUploads:ve,routeKind:he,routeThreadRef:Ae,draftId:De,forceExpandedOnMobile:je,settings:ot,keybindings:me,terminalOpen:Me,gitCwd:ue,promptRef:ce,composerRef:Ze,composerImagesRef:pt,composerTerminalContextsRef:ze,composerElementContextsRef:et,sendContextRef:Et,onSend:ft,onInterrupt:Ct,interruptArmed:gt=!1,stopping:Dt=!1,onCompactContext:Mt,onImplementPlanInNewThread:se,onProviderInstanceSelect:Le,onModelSelectionChosen:be,handleRuntimeModeChange:Xe,handleInteractionModeChange:xt,handleNativeModeChange:tt,focusComposer:It,setThreadError:po}=t,Ko=n.useComposerPlan(r),Qt=Ko.proposedPlan,gn=Ko.tasksProgress,At=Ko.taskSteps,St=i.length===0&&k==="plan"&&Qt!==null,bt=E(null),{pendingPrimaryAction:mo,onSelectActivePendingUserInputOption:kt,onRespondToApproval:_t,onRespondToComposerDecision:Xt}=KN({t:de,threadId:r.threadId,setThreadError:po,promptRef:ce,promptInputRef:bt,respondToApproval:y,respondToDecision:x,selectUserInputOption:C,activePendingProgress:d,activePendingIsResponding:u,activePendingResolvedAnswers:c}),nt=t.api,{limits:lt}=t.attachments,Bt=nt.draft.useThreadDraftSelector(ge,Wo=>n1(Wo,nt.chat.deriveComposerSendState)),Ht=i[0]??null,{questionAttachmentTarget:Yt,attachmentTarget:qo,attachmentDocumentKey:fo}=BN({supported:f,attachments:t.attachments,environmentId:ne,threadId:B,requestId:Ht?.requestId??null,question:d?.activeQuestion??null,responding:u,composerDraftTarget:ge}),go=nt.draft.useThreadDraftSelector(qo,FN),Jt=go.images,Un=Bt.terminalContexts,Ce=Bt.elementContexts,Ue=Bt.browserAnnotations,rt=Bt.reviewComments,Lt=go.nonPersistedImageIds,wt=nt.uploads.useStore(Wo=>Wo.uploadsByImageId),Ot=!Z&&Jt.length>0?de("attachments.capabilityUnknown"):ve?CN({imageIds:Jt.map(Wo=>Wo.id),uploadsByImageId:wt,environmentId:ne},de):null,{setComposerDraftPrompt:Ro,setComposerDraftNativeMode:on,addComposerDraftImage:Fr,addComposerDraftImages:ka,removeComposerDraftImage:As,insertComposerDraftTerminalContext:dg,removeComposerDraftElementContext:ru,removeComposerDraftBrowserAnnotation:cg,removeComposerDraftReviewComment:au,clearComposerDraftPromptAndImages:bl}=r1(nt);H(()=>{if(Z){if(!ve){for(let Wo of Jt)nt.uploads.release(Wo.id);return}nt.draft.restoreAttachments();for(let Wo of Jt)nt.uploads.start({environmentId:ne,image:Wo})}},[Z,Jt,ne,ve]);let wl=d!==null,hn=uD({api:nt,t:de,settings:ot,composerDraft:Bt,composerDraftTarget:ge,environmentId:ne,gitCwd:ue,routeKind:he,threadId:r.threadId,activeThread:O,isLocalDraftThread:j,unavailableAgentInstanceId:F,agentNotChosen:ee,runtimeMode:w,lockedProvider:I,providerStatuses:T,projectId:P,activeProjectDefaultModelSelection:S,activeThreadModelSelection:A,actualModel:N,compactDisabledReason:te,externalSendDisabledReason:M,attachmentBlockReason:Ot,answeringQuestion:wl,setComposerDraftNativeMode:on,handleNativeModeChange:tt,onProviderInstanceSelect:Le,onModelSelectionChosen:be}),{selectedInstanceId:ug,noProviderAvailable:Tl,selectedProvider:Il,selectedModel:su,selectedModelChoice:pg,sendDisabledReason:iu,isSendDisabled:lu,setModelSendBlockShown:du,isModelSendBlocked:mg}=hn,Sl=hN({api:nt,environmentId:ne,target:ge,provider:hn.selectedProviderStatus,planModeEnabled:hn.planModeUiEnabled}),$n=vN(ne,ge),[cu,Ns]=q(!1),[kl,Ds]=q(null),[fg,uu]=q(null),[Ll,Pl]=q(!1),[pu,mu]=q(!1),[gg,fu]=q(null),[_s,gu]=q({key:0,active:!1}),hu=E($n);fe(()=>{hu.current!==$n&&(hu.current=$n,Ns(!1),Ds(null),Pl(!1),mu(!1),fu(null),gu({key:_s.key,active:!1}))},[$n,_s.key]);let La=Vp("max-sm"),Pa=E(null),hg=E(null),Os=E(null),yu=E(null),vu=E(new Map),{isComposerCollapsedMobile:Ra,blurMobileComposerAfterSend:yg,expandMobileComposer:ht,scheduleComposerCollapseCheck:Fs,handleFormFocusCapture:rO}=zN({isMobileViewport:La,forceExpandedOnMobile:je,composerEditorRef:Pa,composerSurfaceRef:yu,composerFormRef:Os}),aO=R(()=>{Ns(!0)},[]),sO=R(Wo=>{xt(Wo)},[xt]),Ea=s!==null,iO=d?.activeQuestion?.allowFreeform===!1,Cx=h[0]??null,{showTopDrawer:xx,showCollapsedPromptRow:lO,hasBlocking:bx}=yN(Cx?.kind??null,Ra),dO=St||d!==null,{isComposerFooterCompact:cO,isComposerPrimaryActionsCompact:uO}=wN(Os,dO),pO=gD({routeKind:he,routeThreadRef:Ae,draftId:De,selectedProvider:Il,selectedInstanceId:ug,selectedModel:su,selectedModelChoice:pg});H(()=>{Ds(null)},[Ce,Ue,rt,Un,su,hn.selectedModelOptionsForDispatch,Il]),$N({composerImages:Jt,composerImagesRef:pt,composerTerminalContexts:Un,composerTerminalContextsRef:ze,composerElementContexts:Ce,composerElementContextsRef:et});let mO=XN({activeThreadId:B,isLocalDraftThread:j,isComposerApprovalState:Ea,hasPendingProgress:d!==null,hasPendingAction:mo!==null,memberMentions:n.memberMentions,target:r,promptRef:ce}),Ma=QN({pluginAction:Sl,api:nt,t:de,limits:lt,composerDraftTarget:ge,composerDraft:Bt,composerDocumentKey:$n,promptRef:ce,promptInputRef:bt,pendingImageCompressionsRef:vu,setComposerDraftPrompt:Ro,setModelSendBlockShown:du,onSend:ft,onCompactContext:Mt,blurMobileComposerAfterSend:yg,isMobileViewport:La,isComposerApprovalState:Ea,activePendingApproval:s,activePendingProgress:d,activePendingResolvedAnswers:c,pendingUserInputCount:i.length,activeThreadId:B,phase:D,isSendBusy:J,environmentUnavailable:Y,compactDisabled:ae,noProviderAvailable:Tl,isSendDisabled:lu,sendDisabledReason:iu,groupSendDisabledReason:X,isGroupSend:mO,isModelSendBlocked:mg,showPlanFollowUpPrompt:St}),Rl=DN({api:nt,t:de,limits:lt,promptRef:ce,promptInputRef:bt,composerEditorRef:Pa,composerImagesRef:pt,composerDraftTarget:ge,setComposerDraftPrompt:Ro,addComposerDraftImages:ka,clearComposerDraftPromptAndImages:bl,setIsStashMenuOpen:Pl,setStashPulse:gu,isComposerCollapsedMobile:Ra,expandMobileComposer:ht,keybindings:me,terminalOpen:Me,isComposerModelPickerOpen:cu,hasPendingUserInputs:i.length>0,isComposerApprovalState:Ea,projectSelectionRequired:U,answeringQuestion:wl}),vg=eD({activeThreadId:B,activeThread:O,activeTasksProgress:gn,activeTaskSteps:At,isTasksDrawerOpen:pu,setIsTasksDrawerOpen:mu,dismissedTasksTurnId:gg,setDismissedTasksTurnId:fu,stashQueue:Rl.stashQueue,isStashMenuOpen:Ll,stashPulse:_s,toggleInlineStashMenu:Rl.toggleInlineStashMenu,isComposerApprovalState:Ea,externalDrawerAttached:o,showComposerTopDrawer:xx,isComposerCollapsedMobile:Ra,hasBlockingComposerTopDrawer:bx}),fO=R(Wo=>{Ds(null),Ma.revalidatePromptLength(Wo),Pl(!1)},[Ma.revalidatePromptLength]),{addComposerImages:wx,removeComposerImage:gO,onComposerAttachmentInputChange:hO}=ON({api:nt,t:de,limits:lt,setThreadError:po,activeThreadId:B,answerQuestionsFirst:i.length>0&&Yt===null,attachmentTarget:qo,attachmentDocumentKey:fo,supportsAttachmentUploads:ve,attachmentUploadsCapabilityKnown:Z,pendingImageCompressionsRef:vu,addComposerDraftImage:Fr,addComposerDraftImages:ka,removeComposerDraftImage:As}),{onComposerPaste:yO,insertComposerTextAtEnd:vO,addDroppedFolders:CO,isDragOverComposer:xO,composerMentionDragHandlers:bO,onComposerMentionDragLeaveCapture:wO}=NN({api:nt,t:de,addComposerImages:wx,attachments:t.attachments,promptRef:ce,promptInputRef:bt,composerEditorRef:Pa,composerFormRef:Os,composerThreadKey:a,attachmentDocumentKey:fo,attachmentImagesRef:pt,limits:lt,supportsAttachmentUploads:ve,attachmentUploadsCapabilityKnown:Z,composerDocumentKey:$n,isComposerApprovalState:Ea,pasteBlocked:i.length>0&&Yt===null,hasPendingUserInputs:i.length>0,projectSelectionRequired:U,environmentId:ne}),Tx=R(()=>{Ct()},[Ct]),Ix=R(()=>{se()},[se]),{handleComposerPaste:TO,handleComposerSubmit:IO,handleUnclaimedEscape:SO}=a1({onComposerPaste:yO,submitComposer:Ma.submitComposerOrShellCommand,exitShellCommandMode:Ma.exitShellCommandMode});return UN({composerRef:Ze,sendContextRef:Et,api:nt,t:de,limits:lt,composerData:n,refs:{composerEditorRef:Pa,promptInputRef:bt,promptRef:ce,composerImagesRef:pt,composerTerminalContextsRef:ze,composerElementContextsRef:et},composerDraftTarget:ge,activeThread:O,addComposerImages:wx,addDroppedFolders:CO,focusComposer:It,insertComposerTextAtEnd:vO,insertComposerDraftTerminalContext:dg,composerBrowserAnnotations:Ue,composerReviewComments:rt,isComposerApprovalState:Ea,pendingUserInputCount:i.length,projectSelectionRequired:U,noProviderAvailable:Tl,modelState:hn,handleRuntimeModeChange:Xe,runtimeMode:w,setIsComposerModelPickerOpen:Ns,setProviderInputSubmissionError:Ds}),l(f_,{formRef:Os,onSubmit:Ma.submitComposerOrShellCommand,onFocusCapture:rO,onBlurCapture:Fs,dragHandlers:bO,onDragLeaveCapture:wO,badges:vg,stashQueueLength:Rl.stashQueue.length,isStashMenuOpen:Ll,stashPulse:_s,toggleStashMenu:Rl.toggleStashMenu,drawers:l(o1,{composerOccupant:Cx,showComposerTopDrawer:xx,hasBlockingComposerTopDrawer:bx,isTasksDrawerOpen:pu,isComposerCollapsedMobile:Ra,respondingRequestIds:g,keybindings:me,onRespondToApproval:_t,onRespondToDecision:Xt,environmentId:ne,activePendingDraftAnswers:m,activePendingQuestionIndex:p,onSelectActivePendingUserInputOption:kt,activeProposedPlan:Qt,activePendingProgress:d,isPendingUserInputChoiceOnly:iO,expandMobileComposer:ht,badges:vg,pendingPrimaryAction:mo,isSendBusy:J,sendDisabledReason:iu,environmentUnavailable:Y,noProviderAvailable:Tl,projectSelectionRequired:U,onGoToActivePendingUserInputQuestion:L,handleInterruptPrimaryAction:Tx,handleImplementPlanInNewThreadPrimaryAction:Ix}),children:l(m_,{pluginAction:Sl,props:t,composerDraft:Bt,model:hn,traits:pO,submit:Ma,stash:Rl,badges:vg,uploadsByImageId:wt,composerImages:Jt,nonPersistedComposerImageIds:Lt,removeComposerImage:gO,removeComposerDraftBrowserAnnotation:cg,removeComposerDraftReviewComment:au,removeComposerDraftElementContext:ru,onComposerAttachmentInputChange:hO,surfaceRef:yu,composerAttachmentInputRef:hg,promptInputRef:bt,composerEditorRef:Pa,composerMenuAnchor:fg,setComposerMenuAnchor:uu,composerDocumentKey:$n,isComposerCollapsedMobile:Ra,expandMobileComposer:ht,isDragOverComposer:xO,isComposerApprovalState:Ea,showCollapsedMobilePromptRow:lO,activePendingProgress:d,pendingUserInputs:i,changeUserInputCustomAnswer:b,pendingPrimaryAction:mo,handleComposerPaste:TO,handleComposerSubmit:IO,onPromptEdited:fO,handleUnclaimedEscape:SO,openModelPicker:aO,switchInteractionMode:sO,providerInputSubmissionError:kl,isStashMenuOpen:Ll,isComposerFooterCompact:cO,isComposerPrimaryActionsCompact:uO,isMobileViewport:La,isComposerModelPickerOpen:cu,setIsComposerModelPickerOpen:Ns,showPlanFollowUpPrompt:St,compactDisabled:ae,compactThreadContext:Ma.compactThreadContext,status:{projectSelectionRequired:U,groupSendDisabledReason:X,isSendBusy:J,environmentUnavailable:Y,interruptArmed:gt,stopping:Dt,agentNotChosen:ee,unavailableAgentInstanceId:F,lockedProvider:I,phase:D,continuationChecking:G,activeThread:O,interactionMode:k,runtimeMode:w},actions:{handleInterruptPrimaryAction:Tx,handleImplementPlanInNewThreadPrimaryAction:Ix}})})});function c1(e){let{composerRef:t,...o}=e;return l(al,{value:o.api,children:l(d1,{...o,composerRef:t})})}function xl({section:e,resetKey:t,children:o}){return l(vi,{resetKey:t,fallback:n=>vj(e,n),children:o})}function vj(e,t){return l(Cj,{section:e,error:t})}function Cj({section:e,error:t}){let{t:o}=Ne();return v("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:[l(eo,{"aria-hidden":!0,className:"size-4 shrink-0 text-destructive-foreground"}),v("div",{className:"min-w-0",children:[l("p",{className:"font-medium text-foreground",children:o(`timeline.sectionUnavailable.${e}`)}),l("p",{className:"whitespace-pre-wrap break-words text-muted-foreground",children:o("timeline.sectionUnavailableHint",{reason:t.message})})]})]})}function u1({hostVersion:e,scopeClass:t}){let{t:o}=Ne();return v("div",{role:"status","data-conversation-host-data-mismatch":!0,className:V("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:[l(eo,{"aria-hidden":!0,className:"size-5 text-destructive-foreground"}),l("p",{className:"font-medium text-foreground",children:o("timeline.hostDataMismatchTitle")}),l("p",{className:"max-w-md text-muted-foreground",children:o("timeline.hostDataMismatchDescription",{host:e??0,plugin:Ml})})]})}$();function p1(e){let t=Nt();H(()=>{let o=e.current;if(!o)return;let n=r=>{let a=r.detail?.reference;a&&t.openThread({environmentId:a.environmentId,threadId:a.threadId})};return o.addEventListener(Hs,n),()=>o.removeEventListener(Hs,n)},[t,e])}function m1({data:e,target:t,slots:o,children:n}){return l(Kb,{data:e,target:t,children:l(lh,{value:o,children:n})})}function f1(e){let{data:t}=e;return t?.version!==Ml?l(u1,{hostVersion:t?.version??null,scopeClass:e.scopeClass}):l(Ru.Provider,{value:e.scope.active,children:l(wj,{...e,data:t})})}var xj=pe(function({threadKey:t,onModeChange:o,summaryContext:n}){let[r]=Ge(t,null,{namespace:"turn-navigator"}),a=R(s=>{o("chat"),r?.onSelect(s)},[o,r]);return r===null?null:l(tw,{...r,placement:"inline",onSelect:a,summaryContext:n})});function bj({slots:e,children:t}){let{data:o,target:n,threadKey:r}=Ho(),a=o.useComposerPending({target:n,threadKey:r});return e?.renderSlotChain("conversation.composer",{occupants:a.occupants},t)??t}function wj(e){let{scope:t,mode:o,timeline:n,trajectory:r,composer:a,data:s}=e,[,i]=Ge(t.threadKey,null,{namespace:"turn-navigator"}),d=a.draftHero.active,c=a.sessionActions,u=a.terminalControl,m=a.agentsControl,{mode:p,onModeChange:f}=o,g=W(()=>({data:s,target:{environmentId:t.environmentId,threadId:t.threadId},threadKey:t.threadKey,openTrajectory:()=>f("trajectory"),onOpenFileDiff:n.onOpenFileDiff}),[s,t.environmentId,t.threadId,t.threadKey,f,n.onOpenFileDiff]),h=W(()=>d?v(oe,{children:[c,l("div",{className:"min-w-0 flex-1"}),u]}):v(oe,{children:[c,l(Bb,{mode:p,onModeChange:f}),l("div",{className:"min-w-0 flex-1"}),u,m,l(xj,{threadKey:t.threadKey,onModeChange:f,summaryContext:g})]}),[d,c,u,m,p,f,t.threadKey,g]),{belowSlot:y,teamDock:x,draftHero:C,onOverlayElementChange:b,sessionActions:L,terminalControl:w,agentsControl:k,contextStrip:I,...T}=a,S=l(c1,{...T,attachments:e.attachments,firstRow:h}),P=W(()=>({environmentId:t.environmentId,threadId:t.threadId}),[t.environmentId,t.threadId]),[A,N]=q(null),B=R(he=>N(he?{key:t.threadKey,value:he}:null),[t.threadKey]),O=A?.key===t.threadKey?A.value:null,[j,U]=Ge(t.threadKey,null,{namespace:"trajectory-reveal"}),D=R(he=>{o.onModeChange("chat"),U(Ae=>({rowId:he,nonce:(Ae?.nonce??0)+1}))},[o,U]),J=R(()=>U(null),[U]),G=E(null);p1(G);let{t:M}=z(),X=E(a.api);X.current=a.api;let F=R(he=>X.current.notify.warning(M(`timeline.quote.${he}`)),[M]),ee=R(()=>X.current.notify.warning(M("forkRelations.messageMissing")),[M]),[Y,ae]=Ge(t.threadKey,null,{namespace:"timeline-quote-reveal"});H(()=>{let he=G.current;if(!he)return;let Ae=De=>{let je=De.detail?.quote;if(je){if(je.environmentId!==P.environmentId||je.threadId!==P.threadId){F("otherThread");return}o.onModeChange("chat"),ae({quote:je})}};return he.addEventListener(wu,Ae),()=>he.removeEventListener(wu,Ae)},[o,ae,P.environmentId,P.threadId,F]);let te=R(he=>{ae(null),he==="message-missing"&&F("messageMissing"),he==="passage-missing"&&F("passageMissing")},[ae,F]),de=W(()=>({data:s,target:P,threadKey:t.threadKey}),[s,P,t.threadKey]),{controlRef:ge,...ne}=n,Z=s.useChatWindow({target:P,threadKey:t.threadKey,visible:t.visible&&o.mode==="chat"}),ve=HS({inputKey:t.threadKey,visible:t.visible,endInset:n.contentInsetEndAdjustment,derive:e.derive,onReturnToLatest:Z.onReturnToLatest,controlRef:ge});return l(m1,{slots:a.slots,data:s,target:P,children:v("div",{ref:G,className:V("relative flex min-h-0 min-w-0 flex-1 flex-col",e.scopeClass),"data-conversation-surface":!0,children:[s.useMessageReveal?l(Tj,{read:s.useMessageReveal,target:P,onChange:B,active:t.active&&t.visible,onModeChange:o.onModeChange},t.threadKey):null,l(Ij,{data:s,target:P,threadKey:t.threadKey,environmentId:t.environmentId,threadId:t.threadId,slots:a.slots}),l(nw,{data:s,target:P,threadKey:t.threadKey,surfaceRef:G}),l(Hb,{chat:v(xl,{section:"chat",resetKey:t.threadKey,children:[l(NS,{data:s,target:P,visible:t.visible,...ne,paneActive:t.active,liveFollowEnabled:ve.liveFollowEnabled,scrollerRef:ve.bindTimelineHandle,onRowsChange:ve.onRowsChange,onIsAtEndChange:ve.onIsAtEndChange,onManualNavigation:ve.onManualNavigation,onDisclosureNavigation:ve.onDisclosureNavigation,loadEarlier:Z.loadEarlier,loadLater:Z.loadLater,pagingBlockedByInteraction:Z.pagingBlockedByInteraction,restoringHistory:Z.restoringHistory??!1,onVisibleTurnRangeChange:Z.onVisibleTurnRangeChange,onReturnToLatest:Z.loadLater===null?null:ve.returnToEnd,onTurnNavigatorChange:i,revealMessageRequest:j,messageReveal:t.active?O:null,onMessageRevealMissing:ee,revealQuoteRequest:Y,onRevealQuoteDone:te,onRevealMessageHandled:J}),l(_S,{data:s,target:P,bottomInset:n.contentInsetEndAdjustment,showScrollToEnd:ve.showScrollToEnd,onScrollToEnd:ve.returnToEnd})]},"chat"),mode:o.mode,trajectory:l(xl,{section:"trajectory",resetKey:t.threadKey,children:l(ZS,{data:s,target:P,inputKey:t.threadKey,paneVisible:t.visible&&o.mode==="trajectory",timestampFormat:r.timestampFormat,contentInsetEndAdjustment:n.contentInsetEndAdjustment,onOpenInChat:D,onOpenFileDiff:n.onOpenFileDiff})},"trajectory"),visible:t.visible}),l(mN,{api:a.api,data:s,draftId:a.draftId,target:P,threadKey:t.threadKey,belowSlot:a.belowSlot,teamDock:a.teamDock,composer:l(xl,{section:"composer",resetKey:t.threadKey,children:l(Np,{value:de,children:l(i1,{children:l(bj,{slots:a.slots,children:S})})})}),draftHero:a.draftHero,slots:a.slots,environmentId:t.environmentId,threadId:t.threadId,onOverlayElementChange:a.onOverlayElementChange,questions:l(xl,{section:"composer",resetKey:t.threadKey,children:l(tN,{data:s,target:P})}),queue:l(xl,{section:"queue",resetKey:t.threadKey,children:l(JA,{data:s,target:P,inputKey:t.threadKey,attachments:e.attachments})})})]})})}function Tj({read:e,target:t,onChange:o,active:n,onModeChange:r}){let a=e(t);return H(()=>{o(a)},[a,o]),H(()=>()=>o(null),[o]),H(()=>{n&&a.request&&r("chat")},[n,a.request,r]),null}function Ij(e){let o=e.data.useComposerStatus({target:e.target,threadKey:e.threadKey}).activeThread?.presetId??null;return l("div",{className:"max-h-[min(280px,36vh)] min-h-0 shrink overflow-y-auto empty:hidden","data-conversation-views":!0,children:e.slots?.renderSlot("conversation.view",{environmentId:e.environmentId,threadId:e.threadId,presetId:o})},e.threadKey)}$();$();function cx(e){return e.turnOutline??e.turns.map((t,o)=>({messageId:t.messageId,ordinal:Math.max(e.turnCount,e.turns.length)-e.turns.length+o+1,...t.error!==null?{failed:!0}:{},...o===e.turns.length-1&&e.status==="waiting"?{waiting:!0}:{}}))}function g1(e,t,o){let n=cx(e),r=[],a=[],s=()=>{if(a.length>=3)r.push({kind:"group",turns:a});else for(let i of a)r.push({kind:"turn",turn:i});a=[]};return n.forEach((i,d)=>{d===0||d===n.length-1||i.failed||i.waiting||i.forkSource||t.has(i.messageId)||o.has(`${e.threadId}:${i.messageId}`)?(s(),r.push({kind:"turn",turn:i})):a.push(i)}),s(),r}var Bn=264,cr=136,ng=20,h1=16,y1=16,Sj=(Bn+ng)/3,kj=Bn/2,Lj={cards:[],edges:[],ticks:[],width:0,height:0};function ux(e){return`${e}:thread`}function rg(e,t){return`${e}:turn:${t}`}function v1(e){if(e.threads.length===0)return Lj;let t=[...e.threads].sort((C,b)=>C.createdAt.localeCompare(b.createdAt)||C.threadId.localeCompare(b.threadId)),o=new Map,n=[],r=0,a=null;t.forEach((C,b)=>{let L=e.dayOf(C.createdAt);if(b>0&&(r+=Sj+(L===a?0:kj)),L!==a){let w=t[b-1],k=w===void 0?0:Date.parse(C.createdAt)-Date.parse(w.createdAt);n.push({x:r,at:C.createdAt,...k>864e5?{gapDays:Math.floor(k/864e5)}:{}})}a=L,o.set(C.threadId,r)});let s=new Map(t.map(C=>[C.threadId,C])),i=new Map;for(let C of t){if(C.forkedFrom===null)continue;let b=i.get(C.forkedFrom.sourceThreadId)??new Set;b.add(C.forkedFrom.sourceMessageId),i.set(C.forkedFrom.sourceThreadId,b)}let d=new Map(t.map(C=>[C.threadId,g1(C,i.get(C.threadId)??new Set,e.revealed??new Set)])),c=new Map,u=[],m=new Map,p=0,f=[];for(let C of t){let b=o.get(C.threadId)??0,L=Pj(C,e.expanded,d.get(C.threadId)??[]),w=C.forkedFrom===null?void 0:s.get(C.forkedFrom.sourceThreadId),k=w!==void 0?c.get(w.threadId):void 0,I=k===void 0?0:k+1;for(;I<f.length&&(f[I]??0)+ng>b;)I+=1;f[I]=b+L,c.set(C.threadId,I),p=Math.max(p,b+L)}let g=Math.max(1,f.length),h=y1*2+g*cr+(g-1)*h1;for(let C of t){let b=y1+(c.get(C.threadId)??0)*(cr+h1),L=o.get(C.threadId)??0,w=Rj(C,e.expanded,d.get(C.threadId)??[],L,b);u.push(...w),w[0]!==void 0&&m.set(C.threadId,w[0])}let y=[],x=new Map(u.map(C=>[C.id,C]));for(let C of t){let b=C.forkedFrom,L=m.get(C.threadId);if(b===null||L===void 0)continue;let w=x.get(rg(b.sourceThreadId,b.sourceMessageId))??m.get(b.sourceThreadId);w!==void 0&&y.push({id:`${w.id}->${L.id}`,path:Ej(w,L),sourceThreadId:b.sourceThreadId,childThreadId:C.threadId})}return{cards:u,edges:y,ticks:n,width:p,height:h}}function C1(e,t){return t.has(e.threadId)&&cx(e).length>0}function Pj(e,t,o){let n=C1(e,t)?o.length:1;return n*Bn+(n-1)*ng}function Rj(e,t,o,n,r){return C1(e,t)?o.map((a,s)=>{let i=a.kind==="turn"?a.turn:a.turns[0];if(i===void 0)throw new Error("Empty turn group");return{id:a.kind==="group"?`${e.threadId}:group:${i.messageId}`:rg(e.threadId,i.messageId),kind:a.kind,threadId:e.threadId,turnIndex:i.ordinal-1,messageId:i.messageId,...a.kind==="group"?{groupedMessageIds:a.turns.map(d=>d.messageId)}:{},x:n+s*(Bn+ng),y:r}}):[{id:ux(e.threadId),kind:"thread",threadId:e.threadId,turnIndex:-1,x:n,y:r}]}function Ej(e,t){let o=e.x+Bn/2,n=e.y+cr,r=t.x,a=t.y+cr/2,s=Math.max(24,(a-n)/2);return`M ${o} ${n} C ${o} ${n+s}, ${r-s} ${a}, ${r} ${a}`}function x1(e,t,o,n=240){if(o.width===0||o.height===0)return!1;let r=e.x*t.scale+t.x,a=e.y*t.scale+t.y;return r+Bn*t.scale>=-n&&a+cr*t.scale>=-n&&r<=o.width+n&&a<=o.height+n}var Hn=24;function nu(e){return{left:0,top:36}}function px(e,t,o=1){let n=nu(t),r=t.width-n.left-Hn*2,a=e.cards.at(-1),s=a===void 0?e.width:a.x+Bn,i=s*o<=r?n.left+Hn:t.width-Hn-s*o,d=Math.min(n.top+Hn/2,t.height-Hn-(a===void 0?0:a.y+cr)*o);return{x:i,y:d,scale:o}}function w1(e,t,o){return{...e,x:e.x+(o.width-t.width)/2,y:e.y+(o.height-t.height)/2}}function T1(e,t){let o=nu(t);if(e.width===0||t.width===0)return{x:o.left+Hn,y:o.top+Hn/2,scale:1};let n=P1(Math.min((t.width-o.left-Hn*2)/e.width,(t.height-o.top-Hn*2)/Math.max(1,e.height)),.25,1);return{x:o.left+Hn,y:o.top+Hn/2,scale:n}}function I1(e,t,o){let n=nu(o),r=n.left+(o.width-n.left)/2,a=n.top+(o.height-n.top)/2;return{scale:t.scale,x:r-(e.x+Bn/2)*t.scale,y:a-(e.y+cr/2)*t.scale}}function ag(e,t,o){let n=P1(e.scale*t,.25,4),r=(o.x-e.x)/e.scale,a=(o.y-e.y)/e.scale;return{scale:n,x:o.x-r*n,y:o.y-a*n}}function S1(e){return e.ctrlKey||e.metaKey}function k1(e,t,o=48){switch(t){case"ArrowLeft":return{...e,x:e.x+o};case"ArrowRight":return{...e,x:e.x-o};case"ArrowUp":return{...e,y:e.y+o};case"ArrowDown":return{...e,y:e.y-o};default:return null}}function mx(e,t){return t?e<=.55:e<.5}function L1(e,t,o){return{...e,x:e.x+(t.x-o.x)*e.scale,y:e.y+(t.y-o.y)*e.scale}}function P1(e,t,o){return Number.isFinite(e)?Math.min(o,Math.max(t,e)):t}$();function fx(e){return e.archived?"map.status.archived":Aj[e.status]}var Aj={running:"map.status.running",waiting:"map.status.waiting",failed:"map.status.failed",done:"map.status.done"};function R1(e,t){return{"data-selected":e.selected?"":void 0,"data-matched":e.matched?"":void 0,"data-current-match":e.current?"":void 0,"data-dimmed":e.dimmed?"":void 0,onPointerEnter:()=>e.onHover(t),onPointerLeave:()=>e.onHover(null),onFocus:()=>e.onHover(t),onBlur:()=>e.onHover(null),tabIndex:0}}function E1(e,t){return{style:{left:e.card.x,top:e.card.y},onPointerDown:o=>o.stopPropagation(),onClick:()=>e.onSelect(t),onKeyDown:o=>{o.target===o.currentTarget&&(o.key!=="Enter"&&o.key!==" "||(o.preventDefault(),e.onSelect(t)))}}}function Nj(e){return e===void 0?"":(e.answer||e.error||e.question).trim()}var M1=pe(function(t){let{t:o,thread:n}=t,r=t.formatTitle?.(n.title)??n.title,a=Nj(n.turns.at(-1)),s=n.loaded?n.turns.length>0:n.turnCount>0;return v("article",{className:"session-map-card","data-status":n.archived?"archived":n.status,...R1(t,n.threadId),"aria-label":r||o("settings.hiddenUntitled"),...E1(t,n.threadId),children:[v("header",{children:[l("span",{className:"session-map-dot","aria-hidden":!0}),l("strong",{children:r||o("settings.hiddenUntitled")})]}),t.forkCount>0?l("span",{className:"session-map-forks",children:o("map.forks",{count:t.forkCount})}):null,v("p",{className:"session-map-meta",children:[l("span",{className:"session-map-status",children:o(fx(n))}),n.loaded?l("span",{children:o("map.turns",{count:n.turnCount})}):null,l("span",{children:t.updatedLabel})]}),n.loaded?l("p",{className:"session-map-preview",children:a||o("map.noReply")}):l("p",{className:"session-map-preview","data-pending":"","aria-hidden":!0}),v("footer",{onClick:i=>i.stopPropagation(),children:[s?l(K,{type:"button",size:"xs",variant:"ghost",onClick:()=>t.onExpand(t.card),children:o("map.expand")}):null,l(K,{type:"button",size:"xs",variant:"outline",onClick:()=>t.onOpen(n.threadId),children:o("map.open")}),v(Pe,{children:[l(Ee,{render:l(K,{type:"button",size:"icon-xs",variant:"ghost","aria-label":o("map.hide"),onClick:()=>t.onHide(n.threadId)}),children:l(zl,{})}),l(Re,{side:"top",children:o("map.hide")})]})]})]})}),A1=pe(function(t){let{t:o,thread:n,card:r}=t,a=t.formatTitle?.(n.title)??n.title,s=n.turns.find(u=>u.messageId===r.messageId),i=n.turnOutline?.find(u=>u.messageId===r.messageId),d=r.turnIndex+1,c=(s?.answer||s?.error||"").trim();return v("article",{className:"session-map-card","data-turn":"","data-status":n.archived?"archived":i?.failed?"failed":i?.waiting?"waiting":d===n.turnCount?n.status:"done",...R1(t,n.threadId),"aria-label":o("map.turnLabel",{index:d,title:a}),...E1(t,n.threadId),children:[v("header",{children:[l("span",{className:"session-map-dot","aria-hidden":!0}),l("span",{className:"session-map-ordinal",children:o("map.turnOrdinal",{index:d})}),v("strong",{children:[l("span",{className:"session-map-turn-question",children:s?.question||o(s===void 0?"map.loading":"map.noQuestion")}),l("span",{className:"session-map-compact-title",children:a||o("settings.hiddenUntitled")})]})]}),t.forkCount>0?l("span",{className:"session-map-forks",children:o("map.forks",{count:t.forkCount})}):null,l("p",{className:"session-map-preview","data-error":s?.error!=null&&s.answer.length===0?"":void 0,"data-pending":s===void 0?"":void 0,children:s===void 0?null:c||o("map.noReply")}),v("footer",{onClick:u=>u.stopPropagation(),children:[r.turnIndex===0?l(K,{type:"button",size:"xs",variant:"ghost",onClick:()=>t.onCollapse(r),children:o("map.collapse")}):null,v(K,{type:"button",size:"xs",variant:"ghost",onClick:()=>{r.messageId!==void 0&&t.onFork(n.threadId,r.messageId)},children:[l(Vl,{}),o("map.fork")]})]})]})}),N1=pe(function(t){return v("article",{className:"session-map-card session-map-group",tabIndex:0,"aria-label":t.t("map.otherTurns",{count:t.card.groupedMessageIds?.length??0}),onClick:()=>t.onReveal(t.card),onKeyDown:o=>{o.target===o.currentTarget&&(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),t.onReveal(t.card))},"data-status":t.thread.archived?"archived":"done","data-dimmed":t.dimmed?"":void 0,"data-selected":t.selected?"":void 0,onPointerDown:o=>o.stopPropagation(),onPointerEnter:()=>t.onHover(t.thread.threadId),onPointerLeave:()=>t.onHover(null),onFocus:()=>t.onHover(t.thread.threadId),onBlur:()=>t.onHover(null),style:{left:t.card.x,top:t.card.y},children:[v("header",{children:[l("span",{className:"session-map-dot","aria-hidden":!0}),l("strong",{children:(t.formatTitle?.(t.thread.title)??t.thread.title)||t.t("settings.hiddenUntitled")})]}),l(K,{type:"button",size:"sm",variant:"ghost",onClick:o=>{o.stopPropagation(),t.onReveal(t.card)},children:t.t("map.otherTurns",{count:t.card.groupedMessageIds?.length??0})})]})});function D1({text:e}){return e.length===0?null:l(wo,{className:"session-map-md",text:e})}var Dj=3;function _1(e){let{t,thread:o}=e,n=e.formatTitle?.(o.title)??o.title,a=(e.fuller??o).turns.slice(-Dj);return v("aside",{className:"session-map-panel","aria-label":n||t("settings.hiddenUntitled"),children:[v("header",{children:[l("strong",{children:n||t("settings.hiddenUntitled")}),l(K,{type:"button",size:"icon-xs",variant:"ghost","aria-label":t("map.closePanel"),onClick:e.onClose,children:l(dt,{})})]}),v("p",{className:"session-map-meta","data-status":o.archived?"archived":o.status,children:[l("span",{className:"session-map-dot","aria-hidden":!0}),l("span",{className:"session-map-status",children:t(fx(o))})]}),v("p",{className:"session-map-meta",children:[l("span",{children:t("map.created",{time:e.formatTime(o.createdAt)})}),l("span",{children:t("map.updated",{time:e.formatTime(o.updatedAt)})}),o.loaded?l("span",{children:t("map.turns",{count:o.turnCount})}):null]}),l(K,{type:"button",size:"sm",onClick:()=>e.onOpen(o.threadId),children:t("map.open")}),l("h3",{children:t("map.recent")}),e.notice!==null?l(Qr,{title:e.notice}):null,!o.loaded&&e.fuller===null?l(Qs,{"aria-label":t("map.loading")}):a.length===0?l(Qr,{title:t("map.noTurns")}):l("ol",{className:"session-map-turns",children:a.map(s=>v("li",{children:[l("p",{className:"session-map-question",children:s.question}),s.answer.length>0?l(D1,{text:s.answer}):s.error!==null?l("p",{className:"session-map-error",children:s.error}):l("p",{className:"session-map-muted",children:t("map.noReply")}),s.answerTruncated||s.questionTruncated?l("p",{className:"session-map-muted",children:t("map.truncated")}):null]},s.messageId))})]})}$();function O1(e){let t=new Map,o=new Map;for(let n of e){if(n.forkedFrom===null)continue;let r=n.forkedFrom.sourceThreadId;t.set(n.threadId,r);let a=o.get(r)??new Set;a.add(n.threadId),o.set(r,a)}return{count:n=>o.get(n)?.size??0,family:n=>{if(n===null)return new Set;let r=t.get(n);return new Set([n,...r===void 0?[]:[r],...o.get(n)??[]])}}}function F1(e,t,o,n,r){return t!==null&&!o.has(e)||n&&!r.has(e)}function B1(e,t,o){if(e.ticks.length===0)return[];let n=0;for(let s=1;s<e.ticks.length&&!(e.ticks[s].x*t.scale+t.x>0);s+=1)n=s;let r=e.ticks[n],a=e.ticks[n+1];return[{...r,gapDays:void 0,sticky:!0,left:Math.min(0,a===void 0?0:a.x*t.scale+t.x-112)},...e.ticks.slice(n+1).flatMap(s=>{let i=s.x*t.scale+t.x;return i<=o.width?[{...s,sticky:!1,left:i}]:[]})]}function H1(e){let t=E(null),o=E(null),n=E(!1),[r,a]=q(null),s=W(()=>O1(Array.from(e.threads.values())),[e.threads]),i=W(()=>s.family(e.selectedThreadId),[s,e.selectedThreadId]),d=E(e.camera),c=E(e.onCamera),u=E(e.onFrame);d.current=e.camera,c.current=e.onCamera,u.current=e.onFrame;let m=E(()=>{}),p=E(null);H(()=>{let w=t.current;if(w===null)return;let k=null,I=0,T=()=>{I=0;let B=k;k=null,B!==null&&c.current(B)},S=B=>{d.current=B,k=B;let O=o.current;O!==null&&(O.style.transform=gx(B),O.style.setProperty("--map-scale",String(B.scale)),n.current=mx(B.scale,n.current),O.toggleAttribute("data-compact",n.current)),I===0&&(I=window.requestAnimationFrame(T))};m.current=S;let P=B=>{B.preventDefault();let O=d.current;if(!S1(B)){S({...O,x:O.x-B.deltaX,y:O.y-B.deltaY});return}let j=w.getBoundingClientRect();S(ag(O,B.deltaY<0?1.08:.92,{x:B.clientX-j.left,y:B.clientY-j.top}))},A=()=>u.current({width:w.clientWidth,height:w.clientHeight});A();let N=new ResizeObserver(A);return N.observe(w),w.addEventListener("wheel",P,{passive:!1}),()=>{N.disconnect(),w.removeEventListener("wheel",P),I!==0&&window.cancelAnimationFrame(I)}},[]),H(()=>{if(p.current!==null)return;let w=o.current;w!==null&&(w.style.transform=gx(e.camera),w.style.setProperty("--map-scale",String(e.camera.scale)),n.current=mx(e.camera.scale,n.current),w.toggleAttribute("data-compact",n.current))},[e.camera]);let f=W(()=>e.layout.cards.filter(w=>x1(w,e.camera,e.frame)),[e.layout,e.camera,e.frame]),g=W(()=>{let w=new Set;for(let k of f)e.threads.get(k.threadId)?.loaded===!1&&w.add(k.threadId);return[...w].sort().join(`
3593
3593
  `)},[f,e.threads]),h=E(e.onVisible);h.current=e.onVisible,H(()=>{g.length>0&&h.current(g.split(`
3594
- `))},[g]);let y=W(()=>{let w=new Map;for(let k of f){if(k.kind!=="turn"||k.messageId===void 0||e.threads.get(k.threadId)?.turns.some(T=>T.messageId===k.messageId))continue;let I=w.get(k.threadId)??[];I.push(k.messageId),w.set(k.threadId,I)}return w},[f,e.threads]),x=JSON.stringify(Array.from(y)),C=E(e.onVisibleTurns);C.current=e.onVisibleTurns,H(()=>{for(let[w,k]of y)C.current(w,k)},[x]);let b=nu(e.frame),{camera:L}=e;return v("div",{ref:t,className:"session-map-stage",tabIndex:0,"aria-label":e.t("map.pan"),onKeyDown:w=>{if(w.target!==w.currentTarget)return;let k=I1(d.current,w.key);k!==null&&(w.preventDefault(),e.onCamera(k))},onPointerDown:w=>{w.button===0&&(p.current={x:d.current.x,y:d.current.y,px:w.clientX,py:w.clientY},w.currentTarget.setPointerCapture(w.pointerId))},onPointerMove:w=>{let k=p.current;k!==null&&m.current({...d.current,x:k.x+w.clientX-k.px,y:k.y+w.clientY-k.py})},onPointerUp:w=>{p.current=null,w.currentTarget.hasPointerCapture(w.pointerId)&&w.currentTarget.releasePointerCapture(w.pointerId)},children:[v("div",{ref:o,className:"session-map-world","data-compact":n.current?"":void 0,style:{transform:gx(L),"--map-scale":L.scale},children:[l("svg",{className:"session-map-edges",width:"1",height:"1","aria-hidden":!0,children:e.layout.edges.filter(w=>[e.selectedThreadId,r].some(k=>k!==null&&(w.sourceThreadId===k||w.childThreadId===k))).map(w=>l("path",{d:w.path},w.id))}),f.map(w=>{let k=e.threads.get(w.threadId);if(k===void 0)return null;let I={formatTitle:e.formatTitle,selected:e.selectedThreadId===k.threadId,matched:e.matches.has(k.threadId),current:e.currentMatch===k.threadId,dimmed:_1(k.threadId,e.selectedThreadId,i,e.searching,e.matches),forkCount:s.count(k.threadId),onHover:a};return w.kind==="group"?l(M1,{...I,t:e.t,card:w,thread:k,onReveal:e.onReveal},w.id):w.kind==="thread"?l(R1,{...I,t:e.t,card:w,thread:k,updatedLabel:e.formatTime(k.updatedAt),onSelect:e.onSelect,onExpand:e.onExpand,onOpen:e.onOpen,onHide:e.onHide},w.id):l(E1,{...I,t:e.t,card:w,thread:k,onSelect:e.onSelect,onCollapse:e.onCollapse,onFork:e.onFork},w.id)})]}),l("div",{className:"session-map-ruler",style:{left:b.left,height:b.top},"aria-hidden":!0,children:O1(e.layout,L,e.frame).map(w=>v("span",{"data-sticky-day":w.sticky?"":void 0,style:{left:w.left,...w.sticky?{width:112}:{}},children:[w.gapDays===void 0?null:l("small",{className:"session-map-gap",children:e.t("map.gapDays",{count:w.gapDays})}),e.formatDay(w.at)]},w.at))}),e.children]})}function gx(e){return`translate(${e.x}px, ${e.y}px) scale(${e.scale})`}function B1(e){let{t}=e,o=e.width<720;return v("header",{className:"session-map-bar",children:[l("span",{className:"session-map-count","aria-live":"polite",children:e.pending?t("map.loading"):t("map.sessions",{count:e.count})}),v("div",{className:"session-map-actions",children:[v("div",{className:"session-map-search",children:[l(Ib,{value:e.query,size:"sm","aria-label":t("map.search"),placeholder:t("map.search"),onValueChange:e.onQuery,onKeyDown:n=>{n.key!=="Enter"||e.matches===0||(n.preventDefault(),e.onNextMatch(n.shiftKey))}}),e.query.trim()?l("span",{className:"session-map-muted","aria-live":"polite",children:e.matches===0?t("map.searchNone"):t("map.searchCount",{index:e.matchIndex%e.matches+1,count:e.matches})}):null]}),o?null:v(Du,{className:"session-map-check",children:[l(_u,{checked:e.showArchived,"aria-label":t("map.showArchived"),onCheckedChange:e.onShowArchived}),l("span",{children:t("map.showArchived")})]}),v("div",{className:"session-map-zoom",children:[l(K,{type:"button",size:"icon-sm",variant:"ghost","aria-label":t("map.zoomOut"),onClick:()=>e.onZoom(1/1.2),children:l(ad,{})}),v("span",{"aria-label":t("map.zoom",{percent:Math.round(e.scale*100)}),children:[Math.round(e.scale*100),"%"]}),l(K,{type:"button",size:"icon-sm",variant:"ghost","aria-label":t("map.zoomIn"),onClick:()=>e.onZoom(1.2),children:l(dd,{})})]}),o?v(Ao,{children:[l(Do,{render:l(K,{type:"button",size:"icon-sm",variant:"ghost","aria-label":t("map.more")}),children:l(Eo,{})}),v(No,{align:"end",children:[v(vo,{role:"menuitemcheckbox","aria-checked":e.showArchived,onClick:()=>e.onShowArchived(!e.showArchived),children:[e.showArchived?l(jo,{}):null,t("map.showArchived")]}),v(vo,{onClick:e.onFit,children:[l(zs,{}),t("map.fit")]}),v(vo,{onClick:e.onLatest,children:[l(Ks,{}),t("map.latest")]})]})]}):[{key:"map.fit",icon:l(zs,{}),click:e.onFit},{key:"map.latest",icon:l(Ks,{}),click:e.onLatest}].map(n=>v(Pe,{children:[l(Ee,{render:l(K,{type:"button",size:"icon-sm",variant:"ghost","aria-label":t(n.key),onClick:n.click}),children:n.icon}),l(Re,{children:t(n.key)})]},n.key))]})]})}function H1(e,t,o){let n=t.trim().toLocaleLowerCase();return n.length===0?[]:e.filter(r=>{let a=r.turns.at(-1);return`${r.title}
3594
+ `))},[g]);let y=W(()=>{let w=new Map;for(let k of f){if(k.kind!=="turn"||k.messageId===void 0||e.threads.get(k.threadId)?.turns.some(T=>T.messageId===k.messageId))continue;let I=w.get(k.threadId)??[];I.push(k.messageId),w.set(k.threadId,I)}return w},[f,e.threads]),x=JSON.stringify(Array.from(y)),C=E(e.onVisibleTurns);C.current=e.onVisibleTurns,H(()=>{for(let[w,k]of y)C.current(w,k)},[x]);let b=nu(e.frame),{camera:L}=e;return v("div",{ref:t,className:"session-map-stage",tabIndex:0,"aria-label":e.t("map.pan"),onKeyDown:w=>{if(w.target!==w.currentTarget)return;let k=k1(d.current,w.key);k!==null&&(w.preventDefault(),e.onCamera(k))},onPointerDown:w=>{w.button===0&&(p.current={x:d.current.x,y:d.current.y,px:w.clientX,py:w.clientY},w.currentTarget.setPointerCapture(w.pointerId))},onPointerMove:w=>{let k=p.current;k!==null&&m.current({...d.current,x:k.x+w.clientX-k.px,y:k.y+w.clientY-k.py})},onPointerUp:w=>{p.current=null,w.currentTarget.hasPointerCapture(w.pointerId)&&w.currentTarget.releasePointerCapture(w.pointerId)},children:[v("div",{ref:o,className:"session-map-world","data-compact":n.current?"":void 0,style:{transform:gx(L),"--map-scale":L.scale},children:[l("svg",{className:"session-map-edges",width:"1",height:"1","aria-hidden":!0,children:e.layout.edges.filter(w=>[e.selectedThreadId,r].some(k=>k!==null&&(w.sourceThreadId===k||w.childThreadId===k))).map(w=>l("path",{d:w.path},w.id))}),f.map(w=>{let k=e.threads.get(w.threadId);if(k===void 0)return null;let I={formatTitle:e.formatTitle,selected:e.selectedThreadId===k.threadId,matched:e.matches.has(k.threadId),current:e.currentMatch===k.threadId,dimmed:F1(k.threadId,e.selectedThreadId,i,e.searching,e.matches),forkCount:s.count(k.threadId),onHover:a};return w.kind==="group"?l(N1,{...I,t:e.t,card:w,thread:k,onReveal:e.onReveal},w.id):w.kind==="thread"?l(M1,{...I,t:e.t,card:w,thread:k,updatedLabel:e.formatTime(k.updatedAt),onSelect:e.onSelect,onExpand:e.onExpand,onOpen:e.onOpen,onHide:e.onHide},w.id):l(A1,{...I,t:e.t,card:w,thread:k,onSelect:e.onSelect,onCollapse:e.onCollapse,onFork:e.onFork},w.id)})]}),l("div",{className:"session-map-ruler",style:{left:b.left,height:b.top},"aria-hidden":!0,children:B1(e.layout,L,e.frame).map(w=>v("span",{"data-sticky-day":w.sticky?"":void 0,style:{left:w.left,...w.sticky?{width:112}:{}},children:[w.gapDays===void 0?null:l("small",{className:"session-map-gap",children:e.t("map.gapDays",{count:w.gapDays})}),e.formatDay(w.at)]},w.at))}),e.children]})}function gx(e){return`translate(${e.x}px, ${e.y}px) scale(${e.scale})`}function U1(e){let{t}=e,o=e.width<720;return v("header",{className:"session-map-bar",children:[l("span",{className:"session-map-count","aria-live":"polite",children:e.pending?t("map.loading"):t("map.sessions",{count:e.count})}),v("div",{className:"session-map-actions",children:[v("div",{className:"session-map-search",children:[l(Ib,{value:e.query,size:"sm","aria-label":t("map.search"),placeholder:t("map.search"),onValueChange:e.onQuery,onKeyDown:n=>{n.key!=="Enter"||e.matches===0||(n.preventDefault(),e.onNextMatch(n.shiftKey))}}),e.query.trim()?l("span",{className:"session-map-muted","aria-live":"polite",children:e.matches===0?t("map.searchNone"):t("map.searchCount",{index:e.matchIndex%e.matches+1,count:e.matches})}):null]}),o?null:v(Du,{className:"session-map-check",children:[l(_u,{checked:e.showArchived,"aria-label":t("map.showArchived"),onCheckedChange:e.onShowArchived}),l("span",{children:t("map.showArchived")})]}),v("div",{className:"session-map-zoom",children:[l(K,{type:"button",size:"icon-sm",variant:"ghost","aria-label":t("map.zoomOut"),onClick:()=>e.onZoom(1/1.2),children:l(ad,{})}),v("span",{"aria-label":t("map.zoom",{percent:Math.round(e.scale*100)}),children:[Math.round(e.scale*100),"%"]}),l(K,{type:"button",size:"icon-sm",variant:"ghost","aria-label":t("map.zoomIn"),onClick:()=>e.onZoom(1.2),children:l(dd,{})})]}),o?v(Ao,{children:[l(Do,{render:l(K,{type:"button",size:"icon-sm",variant:"ghost","aria-label":t("map.more")}),children:l(Eo,{})}),v(No,{align:"end",children:[l(Rb,{checked:e.showArchived,onCheckedChange:n=>e.onShowArchived(n),children:t("map.showArchived")}),v(bo,{onClick:e.onFit,children:[l(zs,{}),t("map.fit")]}),v(bo,{onClick:e.onLatest,children:[l(Ks,{}),t("map.latest")]})]})]}):[{key:"map.fit",icon:l(zs,{}),click:e.onFit},{key:"map.latest",icon:l(Ks,{}),click:e.onLatest}].map(n=>v(Pe,{children:[l(Ee,{render:l(K,{type:"button",size:"icon-sm",variant:"ghost","aria-label":t(n.key),onClick:n.click}),children:n.icon}),l(Re,{children:t(n.key)})]},n.key))]})]})}function $1(e,t,o){let n=t.trim().toLocaleLowerCase();return n.length===0?[]:e.filter(r=>{let a=r.turns.at(-1);return`${r.title}
3595
3595
  ${o?.(r.title)??r.title}
3596
3596
  ${a?.question??""}
3597
3597
  ${a?.answer??""}`.toLocaleLowerCase().includes(n)}).sort((r,a)=>r.createdAt.localeCompare(a.createdAt)||r.threadId.localeCompare(a.threadId)).map(r=>r.threadId)}var sg=`
@@ -3823,4 +3823,4 @@ ${a?.answer??""}`.toLocaleLowerCase().includes(n)}).sort((r,a)=>r.createdAt.loca
3823
3823
  .session-map-settings h2 { margin: 0 0 8px; font-size: 14px; font-weight: 600; }
3824
3824
  .session-map-settings h3 { margin: 4px 0 0; font-size: 13px; font-weight: 600; }
3825
3825
  .session-map-hidden { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
3826
- `;function U1(e){let{t,board:o}=e,[n,r]=q(""),[a,s]=q(0),[i,d]=q(()=>new Set),[c,u]=q(()=>new Set),m=E(null),p=E(!1),f=R(Y=>{m.current=Y,d(ae=>new Set(ae).add(Y.threadId))},[]),g=R(Y=>{m.current=Y,d(ae=>{let te=new Set(ae);return te.delete(Y.threadId),te})},[]),h=R(Y=>{m.current=Y,u(ae=>{let te=new Set(ae);for(let de of Y.groupedMessageIds??[])te.add(`${Y.threadId}:${de}`);return te})},[]),[y,x]=q({x:0,y:0,scale:1}),[C,b]=q({width:0,height:0}),[L,w]=q(null),k=E(!1),I=E(null),T=W(()=>o?.threads??[],[o]),S=W(()=>{let Y=new Map;for(let ae of o?.threads??[])Y.set(ae.threadId,ae);return Y},[o]),P=R(Y=>{w({threadId:Y,title:S.get(Y)?.title||t("settings.hiddenUntitled")}),e.selectedThreadId===Y&&e.onSelect(null),e.onHide(Y)},[S,t,e.selectedThreadId,e.onSelect,e.onHide]),A=W(()=>h1({threads:T,expanded:i,revealed:c,dayOf:Lw}),[T,i,c]);fe(()=>{let Y=m.current;if(Y===null)return;let ae=A.cards.find(te=>te.id===Y.id)??(Y.messageId===void 0?void 0:A.cards.find(te=>te.id===rg(Y.threadId,Y.messageId)))??A.cards.find(te=>te.threadId===Y.threadId);m.current=ae??null,ae!==void 0&&(Y.x!==ae.x||Y.y!==ae.y)&&x(te=>S1(te,Y,ae))},[A]);let N=W(()=>H1(T,n,e.formatTitle),[T,n,e.formatTitle]),B=W(()=>new Set(N),[N]),O=N.length===0?null:N[a%N.length]??null,j=C.width>0&&C.height>0;fe(()=>{if(!j||A.cards.length===0)return;let Y=I.current,ae=Y!==null&&(Y.width!==C.width||Y.height!==C.height);I.current=C,!k.current||ae&&!p.current?(k.current=!0,x(px(A,C))):ae&&Y!==null&&x(te=>x1(te,Y,C))},[A,C,j]),H(()=>s(0),[n]),H(()=>{if(O===null||!j)return;let Y=A.cards.find(ae=>ae.id===ux(O))??A.cards.find(ae=>ae.threadId===O);m.current=null,p.current=!0,Y!==void 0&&x(ae=>w1(Y,ae,C))},[O,a]);let U=E(new Set),D=E(null),J=E(new Set),G=E(e.onLoad);G.current=e.onLoad,H(()=>()=>{D.current!==null&&clearTimeout(D.current)},[]);let M=R(Y=>{for(let ae of Y)U.current.has(ae)||J.current.add(ae);J.current.size===0||D.current!==null||(D.current=setTimeout(()=>{D.current=null;let ae=[...J.current];J.current.clear();for(let te of ae)U.current.add(te);G.current(ae)},200))},[]),X=R(Y=>{m.current=null,p.current=!0,x(Y)},[]),F=e.selectedThreadId===null?void 0:S.get(e.selectedThreadId),ee={x:C.width/2,y:C.height/2};return v("section",{className:"ycodium-session-map",children:[l("style",{children:sg}),l(B1,{t,width:C.width,query:n,onQuery:r,pending:e.pending&&o===null,count:T.length,matches:N.length,matchIndex:a,onNextMatch:Y=>s(ae=>(ae+(Y?N.length-1:1))%Math.max(1,N.length)),showArchived:o?.showArchived??!1,onShowArchived:e.onShowArchived,scale:y.scale,onZoom:Y=>X(ag(y,Y,ee)),onFit:()=>X(b1(A,C)),onLatest:()=>X(px(A,C,y.scale))}),L===null?null:v("div",{className:"session-map-undo",role:"status",children:[l("span",{children:t("map.hiddenNotice",{title:e.formatTitle?.(L.title)??L.title})}),l(K,{type:"button",size:"xs",variant:"outline",onClick:()=>{e.onRestore(L.threadId),w(null)},children:t("map.undo")})]}),v("div",{className:"session-map-body",children:[l(F1,{t,layout:A,threads:S,camera:y,frame:C,selectedThreadId:e.selectedThreadId,matches:B,currentMatch:O,searching:n.trim().length>0,formatDay:kw,formatTime:e.formatTime,formatTitle:e.formatTitle,onCamera:X,onFrame:b,onVisible:M,onSelect:e.onSelect,onExpand:f,onCollapse:g,onReveal:h,onVisibleTurns:e.onLoadTurns,onOpen:e.onOpenThread,onHide:P,onFork:e.onFork,children:o===null?l("div",{className:"session-map-empty",children:l(Qr,{title:e.pending?t("map.loading"):t("map.noMachine")})}):A.cards.length===0?v("div",{className:"session-map-empty",children:[l("strong",{children:t("map.empty")}),l("p",{className:"session-map-muted",children:t("map.emptyHint")})]}):null}),F===void 0?null:l(N1,{t,thread:F,fuller:e.fuller?.threadId===F.threadId?e.fuller:null,notice:e.panelNotice,formatTime:e.formatTime,formatTitle:e.formatTitle,onOpen:e.onOpenThread,onClose:()=>e.onSelect(null)})]})]})}$();function on(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Ft(e){return typeof e=="string"?e:""}function $1(e){return!on(e)||!Array.isArray(e.threads)||!Array.isArray(e.projects)?null:{projects:e.projects.flatMap(t=>{if(!on(t))return[];let o=Ft(t.projectId);return o.length===0?[]:[{projectId:o,title:Ft(t.title),workspaceRoot:Ft(t.workspaceRoot),archived:t.archived===!0}]}),threads:e.threads.flatMap(t=>{let o=ig(t);return o===null?[]:[o]}),hiddenThreadIds:hx(e.hiddenThreadIds),hiddenThreads:Oj(e.hiddenThreads),showArchived:e.showArchived===!0}}function yx(e,t){if(!on(t))return e;if(t.patch!==!0)return $1(t)??e;if(e===null)return null;let o=new Set(hx(t.removedThreadIds)),n=t.hiddenThreadIds!==void 0?hx(t.hiddenThreadIds):e.hiddenThreadIds,r=new Set(n),a=t.showArchived!==void 0?t.showArchived===!0:e.showArchived,s=new Map(e.threads.map(d=>[d.threadId,d]));for(let d of o)s.delete(d);if(Array.isArray(t.threads))for(let d of t.threads){let c=ig(d);if(c!==null){if(o.has(c.threadId)||r.has(c.threadId)){s.delete(c.threadId);continue}if(!a&&c.archived){s.delete(c.threadId);continue}s.set(c.threadId,c)}}if(t.hiddenThreadIds!==void 0||t.showArchived!==void 0)for(let[d,c]of s)(r.has(d)||!a&&c.archived)&&s.delete(d);let i=$1({projects:t.projects??e.projects,threads:[],hiddenThreadIds:n,hiddenThreads:t.hiddenThreads??e.hiddenThreads,showArchived:a});return i===null?{...e,threads:[...s.values()]}:{...i,threads:[...s.values()]}}function z1(e){return on(e)?"present"in e?e.present===!0?ig(e.value):null:ig(e):null}function K1(e){return on(e)?{ok:e.ok===!0,threadId:Ft(e.threadId),walkedBack:e.walkedBack===!0,code:Ft(e.code)}:{ok:!1,threadId:"",walkedBack:!1,code:"empty"}}function ig(e){if(!on(e))return null;let t=Ft(e.threadId);if(t.length===0)return null;let o=on(e.forkedFrom)?e.forkedFrom:null,n=o===null?"":Ft(o.sourceThreadId),r=o===null?"":Ft(o.sourceMessageId);return{threadId:t,projectId:Ft(e.projectId),title:Ft(e.title),createdAt:Ft(e.createdAt),updatedAt:Ft(e.updatedAt),archived:e.archived===!0,running:e.running===!0,status:Dj(e.status,e.running===!0),turnCount:typeof e.turnCount=="number"&&Number.isInteger(e.turnCount)&&e.turnCount>0?e.turnCount:0,loaded:e.loaded===!0,forkedFrom:n.length>0&&r.length>0?{sourceThreadId:n,sourceMessageId:r}:null,inheritedMessageCount:typeof e.inheritedMessageCount=="number"?e.inheritedMessageCount:0,cutWalkedBack:e.cutWalkedBack===!0,turns:Array.isArray(e.turns)?e.turns.flatMap(W1):[],...Array.isArray(e.turnOutline)?{turnOutline:e.turnOutline.flatMap(Nj)}:{}}}function Nj(e){return!on(e)||typeof e.messageId!="string"||typeof e.ordinal!="number"?[]:[{messageId:e.messageId,ordinal:e.ordinal,...e.failed===!0?{failed:!0}:{},...e.waiting===!0?{waiting:!0}:{},...e.forkSource===!0?{forkSource:!0}:{}}]}function q1(e,t){return!on(e)||e.threadId!==t||!Array.isArray(e.turns)?[]:e.turns.flatMap(W1)}function Dj(e,t){return e==="running"||e==="waiting"||e==="failed"||e==="done"?e:t?"running":"done"}function W1(e){if(!on(e))return[];let t=Ft(e.messageId);return t.length===0?[]:[{messageId:t,question:Ft(e.question),questionTruncated:e.questionTruncated===!0,answer:Ft(e.answer),answerTruncated:e.answerTruncated===!0,error:typeof e.error=="string"?e.error:null,tools:Array.isArray(e.tools)?e.tools.flatMap(_j):[],running:e.running===!0}]}function _j(e){if(!on(e))return[];let t=Ft(e.callId);return t.length===0?[]:[{callId:t,title:Ft(e.title),status:Ft(e.status)}]}function Oj(e){return Array.isArray(e)?e.flatMap(t=>{if(!on(t))return[];let o=Ft(t.threadId);return o.length===0?[]:[{threadId:o,title:Ft(t.title)}]}):[]}function hx(e){return Array.isArray(e)?e.flatMap(t=>typeof t=="string"&&t.length>0?[t]:[]):[]}function lg(e){let[t,o]=q(()=>({data:e,board:yx(null,e)}));return t.data!==e&&o({data:e,board:yx(t.board,e)}),t.board}$();function G1(e){let{bridge:t,environmentId:o,threadId:n,onResult:r}=e,a=t.sessionProjections.useProjection("card",n,{environmentId:o});return H(()=>{let s=!0;return t.commands.invoke("focus",{threadId:n},{environmentId:o}).catch(()=>{s&&r({threadId:n,thread:null,notice:"projection.readFailed"})}),()=>{s=!1}},[t,o,n,r]),H(()=>{let s=z1(a);s!==null&&s.threadId!==n||r({threadId:n,thread:s,notice:a.isUnavailable?"projection.unavailable":a.error!==null?"projection.readFailed":null})},[a.present,a.value,a.isUnavailable,a.error,n,r]),null}$();function j1(e,t,o){let[n,r]=q(()=>new Map),a=E(new Set),s=E(!0);H(()=>(s.current=!0,()=>{s.current=!1}),[]);let i=R((c,u)=>{let m=u.filter(p=>!a.current.has(`${c}:${p}`)).slice(0,60);if(m.length!==0){for(let p of m)a.current.add(`${c}:${p}`);e.commands.invoke("turns",{threadId:c,messageIds:m},{environmentId:t}).then(p=>{if(!s.current)return;let f=q1(p,c);r(g=>{let h=new Map(g),y=new Map(h.get(c));for(let x of f)y.set(x.messageId,x);return h.set(c,y),h})},()=>{for(let p of m)a.current.delete(`${c}:${p}`)})}},[e,t]);return{board:W(()=>o===null?null:{...o,threads:o.threads.map(c=>{let u=n.get(c.threadId);if(u===void 0)return c;let m=new Map(u);for(let p of c.turns)m.set(p.messageId,p);return{...c,turns:[...m.values()]}})},[o,n]),load:i}}function Q1(e){let{bridge:t,environmentId:o,projectId:n}=e,r={environmentId:o},a=t.commands.useSubscription("live",{projectId:n},r),s=lg(a.data),i=j1(t,o,s),d=t.i18n.usePluginTranslation(),c=t.useFormatTimestamp(),u=t.useThreadDisplayTitle?.()??Ed,[m,p]=q(null),[f,g]=q(null),h=f?.threadId===m?f:null;return v(oe,{children:[l(U1,{t:d,board:i.board,pending:a.isPending,selectedThreadId:m,fuller:h?.thread??null,panelNotice:h?.notice==null?null:d(h.notice),formatTime:c,formatTitle:u,onSelect:p,onOpenThread:y=>{t.openThread({environmentId:o,threadId:y})},onHide:y=>{t.commands.invoke("hide",{threadId:y},r)},onRestore:y=>{t.commands.invoke("restore",{threadId:y},r)},onShowArchived:y=>{t.commands.invoke("preferences",{patch:{showArchived:y}},r)},onLoad:y=>{for(let x=0;x<y.length;x+=60)t.commands.invoke("load",{threadIds:y.slice(x,x+60)},r)},onLoadTurns:i.load,onFork:(y,x)=>{t.commands.invoke("fork",{threadId:y,messageId:x},r).then(C=>{let b=K1(C);if(!b.ok){t.notify(d(Fj(b.code)),"warning");return}b.walkedBack&&t.notify(d("map.forkWalkedBack"),"info"),t.openThread({environmentId:o,threadId:b.threadId})},()=>t.notify(d("map.forkFailed"),"warning"))}}),m===null?null:l(G1,{bridge:t,environmentId:o,threadId:m,onResult:g},`${o}:${n}:${m}`)]})}function Fj(e){switch(e){case"missing-thread":return"map.forkMissing";case"no-user-message":return"map.forkNoUser";default:return"map.forkFailed"}}function X1(e){let t=e.bridge.i18n.usePluginTranslation(),o=e.bridge.useThreadDisplayTitle?.()??Ed,n=e.environmentId,r=n===null?{}:{environmentId:n},a=e.bridge.commands.useSubscription("live",{},r),s=lg(a.data);return v("section",{className:"session-map-chrome session-map-settings",children:[l("style",{children:sg}),l("h2",{children:t("settings.title")}),s===null?l(Qr,{title:a.isPending?t("map.loading"):t("map.noMachine")}):v(oe,{children:[v(Du,{className:"session-map-check",children:[l(_u,{checked:s.showArchived,"aria-label":t("settings.archived"),onCheckedChange:i=>{e.bridge.commands.invoke("preferences",{patch:{showArchived:i}},r)}}),l("span",{children:t("settings.archived")})]}),l("h3",{children:t("settings.hidden")}),s.hiddenThreads.length===0?l(Qr,{title:t("settings.noneHidden")}):null,s.hiddenThreads.map(i=>v("div",{className:"session-map-hidden",children:[l("span",{children:o(i.title)||t("settings.hiddenUntitled")}),l(K,{type:"button",size:"xs",variant:"outline",onClick:()=>{e.bridge.commands.invoke("restore",{threadId:i.threadId},r)},children:t("settings.restore")})]},i.threadId))]})]})}$();function Y1(e){let{t}=z(),{pending:o}=e,[n,r]=q(null),{api:a}=e,s=R(p=>{r(p),a.notify.error(p)},[a]),i=R(async(...p)=>{r(null);try{await o.respondToApproval(...p)}catch(f){s(f instanceof Error?f.message:t("approval.respondFailed"))}},[o,t,s]),d=R((p,f)=>(r(null),o.respondToDecision(p,f).then(g=>{g!==null&&s(g)})),[o,s]),c=R(()=>{r(null),o.advanceUserInput().then(p=>{p!==null&&s(p)})},[o,s]),u=o.activePendingProgress,m=u?.activeQuestion??null;return l(al,{value:e.api,children:v("div",{className:"flex min-w-0 flex-col","data-pending-requests":e.threadId,children:[o.pendingApprovals.map(p=>l(tu,{approval:p,pendingCount:o.pendingApprovals.length,className:"px-3 py-2 sm:px-4",actions:l(eg,{requestId:p.requestId,isResponding:o.respondingRequestIds.includes(p.requestId),options:p.options,declineReasonRelay:p.declineReasonRelay,shortcuts:!1,onRespondToApproval:i})},p.requestId)),o.pendingDecisions.map(p=>l(ou,{decision:p,environmentId:e.environmentId,onRespond:d,shortcuts:!1},p.requestId??p.title.text)),l(og,{pendingUserInputs:o.pendingUserInputs,respondingRequestIds:o.respondingRequestIds,answers:o.activePendingDraftAnswers,questionIndex:o.activePendingQuestionIndex,shortcuts:!1,onToggleOption:o.selectUserInputOption,onGoToQuestion:p=>o.goToUserInputQuestion(p)}),u===null||m===null?null:v("div",{className:"flex min-w-0 flex-col gap-2 px-3 pb-2 sm:px-4","data-pending-answer-controls":!0,children:[m.allowFreeform===!1?null:l(Vr,{type:"text",size:"sm","aria-label":t("composer.writeCustomAnswer"),placeholder:t("composer.writeCustomAnswer"),value:u.customAnswer,disabled:o.activePendingIsResponding,onChange:p=>{let f=p.target.value;o.changeUserInputCustomAnswer(m.id,f,f.length,f.length,!1)}}),l("div",{className:"flex min-w-0 items-center justify-end gap-2",children:l(K,{size:"xs",disabled:o.activePendingIsResponding||(u.isLastQuestion?o.activePendingResolvedAnswers===null:!u.canAdvance),onClick:c,children:Qc(t,{compact:!1,isLastQuestion:u.isLastQuestion,isResponding:o.activePendingIsResponding,questionIndex:u.questionIndex})})})]}),n===null?null:l("p",{role:"alert",className:"px-3 pb-2 text-ui-xs text-destructive-foreground sm:px-4",children:n})]})})}$();var Bj=[],Hj=[],Uj="prompt-font-preview",J1="max-h-40 min-h-12";function Z1(){}function $j(e){let t=0;return Dr(e).map(o=>{let n=t;return t+=o.type==="text"?o.text.length:o.type==="mention"?o.source.length:o.type==="skill"?o.name.length+1:1,{key:n,segment:o}})}function zj(e){return l("div",{className:LC,children:l("div",{"aria-multiline":"true","aria-placeholder":e.placeholder,className:V(PC,e.className),"data-composer-prompt-static":"true",onFocus:e.onActivate,onPointerDown:e.onActivate,role:"textbox",tabIndex:0,children:l("p",{children:$j(e.prompt).map(({key:t,segment:o})=>o.type==="mention"?l("span",{className:Ad,children:l(Nf,{path:o.path,theme:e.theme})},t):o.type==="skill"?l("span",{className:Ad,children:l(Df,{label:tn({name:o.name})})},t):o.type==="text"?l("span",{children:o.text},t):null)})})})}function eO(){let{t:e}=z(),t=e("composer.idlePlaceholder"),o=it().theme.useResolvedTheme()==="dark"?"dark":"light",n=e("composer.fontPreviewSample"),r=E(null),[a,s]=q(null),i=a?.prompt??n,d=a?.cursor??n.length,[c,u]=q(!1),m=R((f,g)=>{s({prompt:f,cursor:g})},[]),p=R(()=>u(!0),[]);return H(()=>{c&&r.current?.focusAtEnd()},[c]),l("div",{className:"mt-1 mb-2 rounded-lg border border-border bg-background px-3 py-2",children:c?l(ul,{documentKey:Uj,editorRef:r,value:i,cursor:d,terminalContexts:Bj,skills:Hj,disabled:!1,placeholder:t,className:J1,onRemoveTerminalContext:Z1,onChange:m,onPaste:Z1}):l(zj,{className:J1,onActivate:p,placeholder:t,prompt:i,theme:o})})}function Kj(e){return`__ycodium${e.split("-").map(o=>o.charAt(0).toUpperCase()+o.slice(1)).join("")}Scope`}function qj(e){let t=globalThis,o=Kj(e),n=(t[o]??0)+1;return t[o]=n,`ycodium-${e}-ui-${n}`}function tO(e,t){let o=qj(t),n=e.replaceAll(`.ycodium-${t}-ui`,`.${o}`),r=0,a=null;return{scopeClass:o,retain(){return typeof document>"u"?()=>{}:(r===0&&(a=document.createElement("style"),a.setAttribute("data-ycodium-plugin-css",t),a.textContent=n,document.head.appendChild(a)),r+=1,()=>{r-=1,r===0&&a!==null&&(a.remove(),a=null)})}}}function Wj(e){let t=tO(Rx,"conversation");return{views:{[Tu]:Gj(t,e),[bg]:jj(t,e),[Tg]:Vj(t,e)},viewCapabilities:{[Tu]:[wg,_x]},slots:[{name:"project.workbench.tab",needsWidePanel:!0,titleKey:"map.title",icon:"./thread-map.svg",component(o){return l(Bs,{value:e,children:l(Q1,{bridge:e,...o},`${o.environmentId}:${o.projectId}`)})}},{name:"conversation.input.agent",order:0,component:tD},{name:"conversation.input.model",order:0,component:SD},{name:"conversation.input.plan",order:0,component:RD},{name:"conversation.input.permission",order:0,component:PD},{name:"settings.section",order:0,component(o){return l(Bs,{value:e,children:l(X1,{bridge:e,environmentId:o.environmentId??null})})}}]}}function Gj(e,t){return function(n){let a=n[Iu]??t,s={...n};return delete s[Iu],v(Bs,{value:a,children:[l(vx,{retain:e.retain}),l(xu,{value:e.scopeClass,children:l(p1,{...s,scopeClass:e.scopeClass})})]})}}function jj(e,t){return function(n){return v(Bs,{value:t,children:[l(vx,{retain:e.retain}),l(xu,{value:e.scopeClass,children:l(al,{value:n.api,children:l("div",{className:e.scopeClass,children:l(eO,{})})})})]})}}function Vj(e,t){return function(n){return v(Bs,{value:t,children:[l(vx,{retain:e.retain}),l(xu,{value:e.scopeClass,children:l("div",{className:e.scopeClass,children:l(Y1,{...n})})})]})}}function vx({retain:e}){return El(()=>e(),[e]),null}export{Wj as default};
3826
+ `;function z1(e){let{t,board:o}=e,[n,r]=q(""),[a,s]=q(0),[i,d]=q(()=>new Set),[c,u]=q(()=>new Set),m=E(null),p=E(!1),f=R(Y=>{m.current=Y,d(ae=>new Set(ae).add(Y.threadId))},[]),g=R(Y=>{m.current=Y,d(ae=>{let te=new Set(ae);return te.delete(Y.threadId),te})},[]),h=R(Y=>{m.current=Y,u(ae=>{let te=new Set(ae);for(let de of Y.groupedMessageIds??[])te.add(`${Y.threadId}:${de}`);return te})},[]),[y,x]=q({x:0,y:0,scale:1}),[C,b]=q({width:0,height:0}),[L,w]=q(null),k=E(!1),I=E(null),T=W(()=>o?.threads??[],[o]),S=W(()=>{let Y=new Map;for(let ae of o?.threads??[])Y.set(ae.threadId,ae);return Y},[o]),P=R(Y=>{w({threadId:Y,title:S.get(Y)?.title||t("settings.hiddenUntitled")}),e.selectedThreadId===Y&&e.onSelect(null),e.onHide(Y)},[S,t,e.selectedThreadId,e.onSelect,e.onHide]),A=W(()=>v1({threads:T,expanded:i,revealed:c,dayOf:Pw}),[T,i,c]);fe(()=>{let Y=m.current;if(Y===null)return;let ae=A.cards.find(te=>te.id===Y.id)??(Y.messageId===void 0?void 0:A.cards.find(te=>te.id===rg(Y.threadId,Y.messageId)))??A.cards.find(te=>te.threadId===Y.threadId);m.current=ae??null,ae!==void 0&&(Y.x!==ae.x||Y.y!==ae.y)&&x(te=>L1(te,Y,ae))},[A]);let N=W(()=>$1(T,n,e.formatTitle),[T,n,e.formatTitle]),B=W(()=>new Set(N),[N]),O=N.length===0?null:N[a%N.length]??null,j=C.width>0&&C.height>0;fe(()=>{if(!j||A.cards.length===0)return;let Y=I.current,ae=Y!==null&&(Y.width!==C.width||Y.height!==C.height);I.current=C,!k.current||ae&&!p.current?(k.current=!0,x(px(A,C))):ae&&Y!==null&&x(te=>w1(te,Y,C))},[A,C,j]),H(()=>s(0),[n]),H(()=>{if(O===null||!j)return;let Y=A.cards.find(ae=>ae.id===ux(O))??A.cards.find(ae=>ae.threadId===O);m.current=null,p.current=!0,Y!==void 0&&x(ae=>I1(Y,ae,C))},[O,a]);let U=E(new Set),D=E(null),J=E(new Set),G=E(e.onLoad);G.current=e.onLoad,H(()=>()=>{D.current!==null&&clearTimeout(D.current)},[]);let M=R(Y=>{for(let ae of Y)U.current.has(ae)||J.current.add(ae);J.current.size===0||D.current!==null||(D.current=setTimeout(()=>{D.current=null;let ae=[...J.current];J.current.clear();for(let te of ae)U.current.add(te);G.current(ae)},200))},[]),X=R(Y=>{m.current=null,p.current=!0,x(Y)},[]),F=e.selectedThreadId===null?void 0:S.get(e.selectedThreadId),ee={x:C.width/2,y:C.height/2};return v("section",{className:"ycodium-session-map",children:[l("style",{children:sg}),l(U1,{t,width:C.width,query:n,onQuery:r,pending:e.pending&&o===null,count:T.length,matches:N.length,matchIndex:a,onNextMatch:Y=>s(ae=>(ae+(Y?N.length-1:1))%Math.max(1,N.length)),showArchived:o?.showArchived??!1,onShowArchived:e.onShowArchived,scale:y.scale,onZoom:Y=>X(ag(y,Y,ee)),onFit:()=>X(T1(A,C)),onLatest:()=>X(px(A,C,y.scale))}),L===null?null:v("div",{className:"session-map-undo",role:"status",children:[l("span",{children:t("map.hiddenNotice",{title:e.formatTitle?.(L.title)??L.title})}),l(K,{type:"button",size:"xs",variant:"outline",onClick:()=>{e.onRestore(L.threadId),w(null)},children:t("map.undo")})]}),v("div",{className:"session-map-body",children:[l(H1,{t,layout:A,threads:S,camera:y,frame:C,selectedThreadId:e.selectedThreadId,matches:B,currentMatch:O,searching:n.trim().length>0,formatDay:Lw,formatTime:e.formatTime,formatTitle:e.formatTitle,onCamera:X,onFrame:b,onVisible:M,onSelect:e.onSelect,onExpand:f,onCollapse:g,onReveal:h,onVisibleTurns:e.onLoadTurns,onOpen:e.onOpenThread,onHide:P,onFork:e.onFork,children:o===null?l("div",{className:"session-map-empty",children:l(Qr,{title:e.pending?t("map.loading"):t("map.noMachine")})}):A.cards.length===0?v("div",{className:"session-map-empty",children:[l("strong",{children:t("map.empty")}),l("p",{className:"session-map-muted",children:t("map.emptyHint")})]}):null}),F===void 0?null:l(_1,{t,thread:F,fuller:e.fuller?.threadId===F.threadId?e.fuller:null,notice:e.panelNotice,formatTime:e.formatTime,formatTitle:e.formatTitle,onOpen:e.onOpenThread,onClose:()=>e.onSelect(null)})]})]})}$();function tn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Ft(e){return typeof e=="string"?e:""}function K1(e){return!tn(e)||!Array.isArray(e.threads)||!Array.isArray(e.projects)?null:{projects:e.projects.flatMap(t=>{if(!tn(t))return[];let o=Ft(t.projectId);return o.length===0?[]:[{projectId:o,title:Ft(t.title),workspaceRoot:Ft(t.workspaceRoot),archived:t.archived===!0}]}),threads:e.threads.flatMap(t=>{let o=ig(t);return o===null?[]:[o]}),hiddenThreadIds:hx(e.hiddenThreadIds),hiddenThreads:Hj(e.hiddenThreads),showArchived:e.showArchived===!0}}function yx(e,t){if(!tn(t))return e;if(t.patch!==!0)return K1(t)??e;if(e===null)return null;let o=new Set(hx(t.removedThreadIds)),n=t.hiddenThreadIds!==void 0?hx(t.hiddenThreadIds):e.hiddenThreadIds,r=new Set(n),a=t.showArchived!==void 0?t.showArchived===!0:e.showArchived,s=new Map(e.threads.map(d=>[d.threadId,d]));for(let d of o)s.delete(d);if(Array.isArray(t.threads))for(let d of t.threads){let c=ig(d);if(c!==null){if(o.has(c.threadId)||r.has(c.threadId)){s.delete(c.threadId);continue}if(!a&&c.archived){s.delete(c.threadId);continue}s.set(c.threadId,c)}}if(t.hiddenThreadIds!==void 0||t.showArchived!==void 0)for(let[d,c]of s)(r.has(d)||!a&&c.archived)&&s.delete(d);let i=K1({projects:t.projects??e.projects,threads:[],hiddenThreadIds:n,hiddenThreads:t.hiddenThreads??e.hiddenThreads,showArchived:a});return i===null?{...e,threads:[...s.values()]}:{...i,threads:[...s.values()]}}function q1(e){return tn(e)?"present"in e?e.present===!0?ig(e.value):null:ig(e):null}function W1(e){return tn(e)?{ok:e.ok===!0,threadId:Ft(e.threadId),walkedBack:e.walkedBack===!0,code:Ft(e.code)}:{ok:!1,threadId:"",walkedBack:!1,code:"empty"}}function ig(e){if(!tn(e))return null;let t=Ft(e.threadId);if(t.length===0)return null;let o=tn(e.forkedFrom)?e.forkedFrom:null,n=o===null?"":Ft(o.sourceThreadId),r=o===null?"":Ft(o.sourceMessageId);return{threadId:t,projectId:Ft(e.projectId),title:Ft(e.title),createdAt:Ft(e.createdAt),updatedAt:Ft(e.updatedAt),archived:e.archived===!0,running:e.running===!0,status:Fj(e.status,e.running===!0),turnCount:typeof e.turnCount=="number"&&Number.isInteger(e.turnCount)&&e.turnCount>0?e.turnCount:0,loaded:e.loaded===!0,forkedFrom:n.length>0&&r.length>0?{sourceThreadId:n,sourceMessageId:r}:null,inheritedMessageCount:typeof e.inheritedMessageCount=="number"?e.inheritedMessageCount:0,cutWalkedBack:e.cutWalkedBack===!0,turns:Array.isArray(e.turns)?e.turns.flatMap(j1):[],...Array.isArray(e.turnOutline)?{turnOutline:e.turnOutline.flatMap(Oj)}:{}}}function Oj(e){return!tn(e)||typeof e.messageId!="string"||typeof e.ordinal!="number"?[]:[{messageId:e.messageId,ordinal:e.ordinal,...e.failed===!0?{failed:!0}:{},...e.waiting===!0?{waiting:!0}:{},...e.forkSource===!0?{forkSource:!0}:{}}]}function G1(e,t){return!tn(e)||e.threadId!==t||!Array.isArray(e.turns)?[]:e.turns.flatMap(j1)}function Fj(e,t){return e==="running"||e==="waiting"||e==="failed"||e==="done"?e:t?"running":"done"}function j1(e){if(!tn(e))return[];let t=Ft(e.messageId);return t.length===0?[]:[{messageId:t,question:Ft(e.question),questionTruncated:e.questionTruncated===!0,answer:Ft(e.answer),answerTruncated:e.answerTruncated===!0,error:typeof e.error=="string"?e.error:null,tools:Array.isArray(e.tools)?e.tools.flatMap(Bj):[],running:e.running===!0}]}function Bj(e){if(!tn(e))return[];let t=Ft(e.callId);return t.length===0?[]:[{callId:t,title:Ft(e.title),status:Ft(e.status)}]}function Hj(e){return Array.isArray(e)?e.flatMap(t=>{if(!tn(t))return[];let o=Ft(t.threadId);return o.length===0?[]:[{threadId:o,title:Ft(t.title)}]}):[]}function hx(e){return Array.isArray(e)?e.flatMap(t=>typeof t=="string"&&t.length>0?[t]:[]):[]}function lg(e){let[t,o]=q(()=>({data:e,board:yx(null,e)}));return t.data!==e&&o({data:e,board:yx(t.board,e)}),t.board}$();function V1(e){let{bridge:t,environmentId:o,threadId:n,onResult:r}=e,a=t.sessionProjections.useProjection("card",n,{environmentId:o});return H(()=>{let s=!0;return t.commands.invoke("focus",{threadId:n},{environmentId:o}).catch(()=>{s&&r({threadId:n,thread:null,notice:"projection.readFailed"})}),()=>{s=!1}},[t,o,n,r]),H(()=>{let s=q1(a);s!==null&&s.threadId!==n||r({threadId:n,thread:s,notice:a.isUnavailable?"projection.unavailable":a.error!==null?"projection.readFailed":null})},[a.present,a.value,a.isUnavailable,a.error,n,r]),null}$();function Q1(e,t,o){let[n,r]=q(()=>new Map),a=E(new Set),s=E(!0);H(()=>(s.current=!0,()=>{s.current=!1}),[]);let i=R((c,u)=>{let m=u.filter(p=>!a.current.has(`${c}:${p}`)).slice(0,60);if(m.length!==0){for(let p of m)a.current.add(`${c}:${p}`);e.commands.invoke("turns",{threadId:c,messageIds:m},{environmentId:t}).then(p=>{if(!s.current)return;let f=G1(p,c);r(g=>{let h=new Map(g),y=new Map(h.get(c));for(let x of f)y.set(x.messageId,x);return h.set(c,y),h})},()=>{for(let p of m)a.current.delete(`${c}:${p}`)})}},[e,t]);return{board:W(()=>o===null?null:{...o,threads:o.threads.map(c=>{let u=n.get(c.threadId);if(u===void 0)return c;let m=new Map(u);for(let p of c.turns)m.set(p.messageId,p);return{...c,turns:[...m.values()]}})},[o,n]),load:i}}function Y1(e){let{bridge:t,environmentId:o,projectId:n}=e,r={environmentId:o},a=t.commands.useSubscription("live",{projectId:n},r),s=lg(a.data),i=Q1(t,o,s),d=t.i18n.usePluginTranslation(),c=t.useFormatTimestamp(),u=t.useThreadDisplayTitle?.()??Ed,[m,p]=q(null),[f,g]=q(null),h=f?.threadId===m?f:null;return v(oe,{children:[l(z1,{t:d,board:i.board,pending:a.isPending,selectedThreadId:m,fuller:h?.thread??null,panelNotice:h?.notice==null?null:d(h.notice),formatTime:c,formatTitle:u,onSelect:p,onOpenThread:y=>{t.openThread({environmentId:o,threadId:y})},onHide:y=>{t.commands.invoke("hide",{threadId:y},r)},onRestore:y=>{t.commands.invoke("restore",{threadId:y},r)},onShowArchived:y=>{t.commands.invoke("preferences",{patch:{showArchived:y}},r)},onLoad:y=>{for(let x=0;x<y.length;x+=60)t.commands.invoke("load",{threadIds:y.slice(x,x+60)},r)},onLoadTurns:i.load,onFork:(y,x)=>{t.commands.invoke("fork",{threadId:y,messageId:x},r).then(C=>{let b=W1(C);if(!b.ok){t.notify(d(Uj(b.code)),"warning");return}b.walkedBack&&t.notify(d("map.forkWalkedBack"),"info"),t.openThread({environmentId:o,threadId:b.threadId})},()=>t.notify(d("map.forkFailed"),"warning"))}}),m===null?null:l(V1,{bridge:t,environmentId:o,threadId:m,onResult:g},`${o}:${n}:${m}`)]})}function Uj(e){switch(e){case"missing-thread":return"map.forkMissing";case"no-user-message":return"map.forkNoUser";default:return"map.forkFailed"}}function J1(e){let t=e.bridge.i18n.usePluginTranslation(),o=e.bridge.useThreadDisplayTitle?.()??Ed,n=e.environmentId,r=n===null?{}:{environmentId:n},a=e.bridge.commands.useSubscription("live",{},r),s=lg(a.data);return v("section",{className:"session-map-chrome session-map-settings",children:[l("style",{children:sg}),l("h2",{children:t("settings.title")}),s===null?l(Qr,{title:a.isPending?t("map.loading"):t("map.noMachine")}):v(oe,{children:[v(Du,{className:"session-map-check",children:[l(_u,{checked:s.showArchived,"aria-label":t("settings.archived"),onCheckedChange:i=>{e.bridge.commands.invoke("preferences",{patch:{showArchived:i}},r)}}),l("span",{children:t("settings.archived")})]}),l("h3",{children:t("settings.hidden")}),s.hiddenThreads.length===0?l(Qr,{title:t("settings.noneHidden")}):null,s.hiddenThreads.map(i=>v("div",{className:"session-map-hidden",children:[l("span",{children:o(i.title)||t("settings.hiddenUntitled")}),l(K,{type:"button",size:"xs",variant:"outline",onClick:()=>{e.bridge.commands.invoke("restore",{threadId:i.threadId},r)},children:t("settings.restore")})]},i.threadId))]})]})}$();function Z1(e){let{t}=z(),{pending:o}=e,[n,r]=q(null),{api:a}=e,s=R(p=>{r(p),a.notify.error(p)},[a]),i=R(async(...p)=>{r(null);try{await o.respondToApproval(...p)}catch(f){s(f instanceof Error?f.message:t("approval.respondFailed"))}},[o,t,s]),d=R((p,f)=>(r(null),o.respondToDecision(p,f).then(g=>{g!==null&&s(g)})),[o,s]),c=R(()=>{r(null),o.advanceUserInput().then(p=>{p!==null&&s(p)})},[o,s]),u=o.activePendingProgress,m=u?.activeQuestion??null;return l(al,{value:e.api,children:v("div",{className:"flex min-w-0 flex-col","data-pending-requests":e.threadId,children:[o.pendingApprovals.map(p=>l(tu,{approval:p,pendingCount:o.pendingApprovals.length,className:"px-3 py-2 sm:px-4",actions:l(eg,{requestId:p.requestId,isResponding:o.respondingRequestIds.includes(p.requestId),options:p.options,declineReasonRelay:p.declineReasonRelay,shortcuts:!1,onRespondToApproval:i})},p.requestId)),o.pendingDecisions.map(p=>l(ou,{decision:p,environmentId:e.environmentId,onRespond:d,shortcuts:!1},p.requestId??p.title.text)),l(og,{pendingUserInputs:o.pendingUserInputs,respondingRequestIds:o.respondingRequestIds,answers:o.activePendingDraftAnswers,questionIndex:o.activePendingQuestionIndex,shortcuts:!1,onToggleOption:o.selectUserInputOption,onGoToQuestion:p=>o.goToUserInputQuestion(p)}),u===null||m===null?null:v("div",{className:"flex min-w-0 flex-col gap-2 px-3 pb-2 sm:px-4","data-pending-answer-controls":!0,children:[m.allowFreeform===!1?null:l(Vr,{type:"text",size:"sm","aria-label":t("composer.writeCustomAnswer"),placeholder:t("composer.writeCustomAnswer"),value:u.customAnswer,disabled:o.activePendingIsResponding,onChange:p=>{let f=p.target.value;o.changeUserInputCustomAnswer(m.id,f,f.length,f.length,!1)}}),l("div",{className:"flex min-w-0 items-center justify-end gap-2",children:l(K,{size:"xs",disabled:o.activePendingIsResponding||(u.isLastQuestion?o.activePendingResolvedAnswers===null:!u.canAdvance),onClick:c,children:Qc(t,{compact:!1,isLastQuestion:u.isLastQuestion,isResponding:o.activePendingIsResponding,questionIndex:u.questionIndex})})})]}),n===null?null:l("p",{role:"alert",className:"px-3 pb-2 text-ui-xs text-destructive-foreground sm:px-4",children:n})]})})}$();var $j=[],zj=[],Kj="prompt-font-preview",eO="max-h-40 min-h-12";function tO(){}function qj(e){let t=0;return Dr(e).map(o=>{let n=t;return t+=o.type==="text"?o.text.length:o.type==="mention"?o.source.length:o.type==="skill"?o.name.length+1:1,{key:n,segment:o}})}function Wj(e){return l("div",{className:LC,children:l("div",{"aria-multiline":"true","aria-placeholder":e.placeholder,className:V(PC,e.className),"data-composer-prompt-static":"true",onFocus:e.onActivate,onPointerDown:e.onActivate,role:"textbox",tabIndex:0,children:l("p",{children:qj(e.prompt).map(({key:t,segment:o})=>o.type==="mention"?l("span",{className:Ad,children:l(Nf,{path:o.path,theme:e.theme})},t):o.type==="skill"?l("span",{className:Ad,children:l(Df,{label:en({name:o.name})})},t):o.type==="text"?l("span",{children:o.text},t):null)})})})}function oO(){let{t:e}=z(),t=e("composer.idlePlaceholder"),o=it().theme.useResolvedTheme()==="dark"?"dark":"light",n=e("composer.fontPreviewSample"),r=E(null),[a,s]=q(null),i=a?.prompt??n,d=a?.cursor??n.length,[c,u]=q(!1),m=R((f,g)=>{s({prompt:f,cursor:g})},[]),p=R(()=>u(!0),[]);return H(()=>{c&&r.current?.focusAtEnd()},[c]),l("div",{className:"mt-1 mb-2 rounded-lg border border-border bg-background px-3 py-2",children:c?l(ul,{documentKey:Kj,editorRef:r,value:i,cursor:d,terminalContexts:$j,skills:zj,disabled:!1,placeholder:t,className:eO,onRemoveTerminalContext:tO,onChange:m,onPaste:tO}):l(Wj,{className:eO,onActivate:p,placeholder:t,prompt:i,theme:o})})}function Gj(e){return`__ycodium${e.split("-").map(o=>o.charAt(0).toUpperCase()+o.slice(1)).join("")}Scope`}function jj(e){let t=globalThis,o=Gj(e),n=(t[o]??0)+1;return t[o]=n,`ycodium-${e}-ui-${n}`}function nO(e,t){let o=jj(t),n=e.replaceAll(`.ycodium-${t}-ui`,`.${o}`),r=0,a=null;return{scopeClass:o,retain(){return typeof document>"u"?()=>{}:(r===0&&(a=document.createElement("style"),a.setAttribute("data-ycodium-plugin-css",t),a.textContent=n,document.head.appendChild(a)),r+=1,()=>{r-=1,r===0&&a!==null&&(a.remove(),a=null)})}}}function Vj(e){let t=nO(Rx,"conversation");return{views:{[Tu]:Qj(t,e),[bg]:Xj(t,e),[Tg]:Yj(t,e)},viewCapabilities:{[Tu]:[wg,_x]},slots:[{name:"project.workbench.tab",needsWidePanel:!0,titleKey:"map.title",icon:"./thread-map.svg",component(o){return l(Bs,{value:e,children:l(Y1,{bridge:e,...o},`${o.environmentId}:${o.projectId}`)})}},{name:"conversation.input.agent",order:0,component:nD},{name:"conversation.input.model",order:0,component:LD},{name:"conversation.input.plan",order:0,component:MD},{name:"conversation.input.permission",order:0,component:ED},{name:"settings.section",order:0,component(o){return l(Bs,{value:e,children:l(J1,{bridge:e,environmentId:o.environmentId??null})})}}]}}function Qj(e,t){return function(n){let a=n[Iu]??t,s={...n};return delete s[Iu],v(Bs,{value:a,children:[l(vx,{retain:e.retain}),l(xu,{value:e.scopeClass,children:l(f1,{...s,scopeClass:e.scopeClass})})]})}}function Xj(e,t){return function(n){return v(Bs,{value:t,children:[l(vx,{retain:e.retain}),l(xu,{value:e.scopeClass,children:l(al,{value:n.api,children:l("div",{className:e.scopeClass,children:l(oO,{})})})})]})}}function Yj(e,t){return function(n){return v(Bs,{value:t,children:[l(vx,{retain:e.retain}),l(xu,{value:e.scopeClass,children:l("div",{className:e.scopeClass,children:l(Z1,{...n})})})]})}}function vx({retain:e}){return El(()=>e(),[e]),null}export{Vj as default};