@ycodium-ai/plugin-conversation 0.2.2996 → 0.2.3000
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 +8 -8
- package/dist/index.js +12 -9
- package/package.json +2 -2
package/assets/ui.js
CHANGED
|
@@ -4115,10 +4115,10 @@ ${w}
|
|
|
4115
4115
|
.session-map-inspector { max-height: 58vh; border: 0; border-top: 1px solid var(--map-border); }
|
|
4116
4116
|
.session-map-transcript { min-height: 9rem; max-height: 36vh; }
|
|
4117
4117
|
}
|
|
4118
|
-
`;function UT(e){let[t,n]=W(""),[o,r]=W("all"),[a]=W(()=>cp(e.memoryScope)),s=M(a.camera!==null&&a.focusThreadId===e.focusThreadId),[i,l]=W(s.current?a.selectedId:null),[d,u]=W(s.current&&a.camera!==null?a.camera:{x:24,y:24,scale:1}),[f,p]=W({}),[m,h]=W(a.draft);U(()=>{Rv(e.memoryScope,{focusThreadId:e.focusThreadId,camera:d,selectedId:i,draft:m})},[e.memoryScope,e.focusThreadId,d,i,m]),U(()=>()=>Av(e.memoryScope),[e.memoryScope]);let[g,v]=W(null),C=M(null),y=K(()=>e.board===null?null:IT(e.board,e.fuller),[e.board,e.fuller]),x=K(()=>{let w=new Map;if(y===null)return w;for(let L of y.threads)w.set(L.threadId,L);return w},[y]),b=K(()=>{if(y===null)return{cards:[],childCounts:new Map,descendantCounts:new Map};let w=Cv(yv(y.threads),y.anchors);return mT(w,e.collapsed)},[y,e.collapsed]),I=b.cards.filter(w=>{let L=x.get(w.threadId);return L===void 0||o!=="all"&&L.projectId!==o?!1:t.trim().length===0?!0:`${L.title} ${w.question} ${w.answer}`.toLowerCase().includes(t.trim().toLowerCase())}),T=b.cards.find(w=>w.id===i)??I.find(w=>w.threadId===e.focusThreadId)??null,P=o==="all"?e.t("map.projectAll"):y?.projects.find(w=>w.projectId===o)?.title??e.t("map.projectAll"),k=e.focusThreadId!==null&&x.has(e.focusThreadId);return U(()=>{if(!k||e.focusThreadId===null||y===null)return;let w=Cv(yv(y.threads),y.anchors),L=k3(w,e.focusThreadId,e.collapsed);if(L.length===e.collapsed.size&&L.every(A=>e.collapsed.has(A))||e.onCollapsed(L),s.current){s.current=!1;return}let N=w.findLast(A=>A.threadId===e.focusThreadId);N!==void 0&&l(N.id)},[e.focusThreadId,e.locateToken,k]),S("section",{ref:C,className:"ycodium-session-map","data-pane":e.fill==="pane"?"":void 0,"data-page":e.fill==="page"?"":void 0,children:[c("style",{children:up}),S("header",{className:"session-map-bar",children:[S("div",{className:"session-map-title",children:[c("strong",{children:y?.workspaceTitle||e.t("map.title")}),c("span",{children:e.pending&&y===null?e.t("map.loading"):e.t("map.sessions",{count:y?.threads.length??0})})]}),S("div",{className:"session-map-actions",children:[e.viewSwitch,S("div",{className:"session-map-zoom",children:[c(ee,{type:"button",size:"icon-xs",variant:"outline","aria-label":e.t("map.zoomOut"),onClick:()=>u(BT(d,1/1.15)),children:c(Rs,{})}),c("span",{children:e.t("map.zoom",{percent:Math.round(d.scale*100)})}),c(ee,{type:"button",size:"icon-xs",variant:"outline","aria-label":e.t("map.zoomIn"),onClick:()=>u(BT(d,1.15)),children:c(Qd,{})}),c(ee,{type:"button",size:"xs",variant:"outline",onClick:()=>{let L=C.current?.querySelector(".session-map-stage")?.getBoundingClientRect(),R=y===null?[]:I.map(N=>wc(N,y.positions,f));u(vT(R,L?.width??800,L?.height??600)),p({})},children:e.t("map.fit")})]}),c(ee,{type:"button",size:"xs",variant:"outline",onClick:e.onLocate,children:e.t("map.locate")}),c(ee,{type:"button",size:"xs",variant:"ghost",onClick:()=>{p({}),e.onTidy()},children:e.t("map.tidy")}),e.viewSwitch!=null||e.onClose===null?null:c(ee,{type:"button",size:"xs",variant:"ghost",onClick:e.onClose,children:e.t("map.close")})]})]}),g===null?null:S("div",{className:"session-map-undo",children:[c("span",{children:e.t("map.hiddenNotice",{title:g.title})}),c(ee,{type:"button",size:"xs",variant:"outline",onClick:()=>{e.onRestore(g.threadId),v(null)},children:e.t("map.undo")})]}),y===null?null:S("div",{className:"session-map-body",children:[S("aside",{className:"session-map-side",children:[c(iS,{className:"session-map-search",value:t,size:"sm",variant:"ghost","aria-label":e.t("map.search"),placeholder:e.t("map.search"),onValueChange:n}),S("div",{className:"session-map-actions",style:{marginTop:8},children:[c(ee,{type:"button",size:"xs",onClick:()=>h({kind:"new"}),children:e.t("map.new")}),S(Yr,{value:o,onValueChange:w=>r(w??"all"),children:[c(Bs,{size:"xs","aria-label":e.t("map.projectAll"),children:c(Zr,{children:P})}),S(Jr,{children:[c(rr,{value:"all",children:e.t("map.projectAll")}),y.projects.map(w=>c(rr,{value:w.projectId,children:w.title||w.workspaceRoot},w.projectId))]})]})]}),y.threads.length===0?c(Fs,{title:e.t("map.empty")}):null,c(I3,{t:e.t,board:y,focusThreadId:e.focusThreadId,onOpen:w=>{let L=b.cards.findLast(R=>R.threadId===w);L!==void 0&&l(L.id),e.onOpenThread(w)}})]}),c(AT,{t:e.t,board:y,cards:I,childCounts:b.childCounts,descendantCounts:b.descendantCounts,collapsed:e.collapsed,focusThreadId:e.focusThreadId,selectedId:T?.id??null,optimistic:f,camera:d,resumeCamera:a.camera!==null&&a.focusThreadId===e.focusThreadId,locateToken:e.locateToken,onCamera:u,onSelect:w=>l(w.id),onMove:e.onMove,onOptimistic:(w,L,R)=>p(N=>({...N,[w]:{x:L,y:R}})),onToggleCollapse:w=>{let L=new Set(e.collapsed);L.has(w)?L.delete(w):L.add(w),e.onCollapsed([...L])},onContinue:w=>{l(w.id),h({kind:"continue",threadId:w.threadId})},onBranch:w=>{l(w.id),h({kind:"branch",threadId:w.threadId,messageId:w.messageId})},onHide:w=>{let L=x.get(w)?.title??e.t("settings.hiddenUntitled");v({threadId:w,title:L}),e.onHide(w)},onOpen:e.onOpenThread}),c(FT,{t:e.t,board:y,cards:b.cards,selected:T,detail:e.detail,detailThreadId:e.detailThreadId,phrases:e.phrases,draft:m,savedText:w=>{let L=cp(e.memoryScope);return L.textTarget===w?L.text:""},onText:(w,L)=>Rv(e.memoryScope,{textTarget:w,text:L}),onDraft:h,onPhrases:e.onPhrases,onAnchor:e.onAnchor,onLoadDetail:e.onLoadDetail,onOpen:e.onOpenThread,formatTime:e.formatTime,onSend:e.onSend})]})]})}function I3(e){let t=M(null),n=K(()=>T3(e.board,e.t),[e.board,e.t]),o=n.findIndex(r=>r.kind==="thread"&&r.thread.threadId===e.focusThreadId);return U(()=>{o<0||t.current?.scrollIndexIntoView({index:o,animated:!1})},[e.focusThreadId,o]),c("div",{className:"session-map-sessions",children:c(op,{ref:t,data:n,estimatedItemSize:36,keyExtractor:r=>r.key,extraData:e.focusThreadId,style:{height:"100%"},renderItem:({item:r})=>r.kind==="header"?c("div",{className:"session-map-project",children:r.title}):c(lS,{className:"session-map-session",label:r.thread.title||e.t("card.empty"),pressed:r.thread.threadId===e.focusThreadId,trailing:r.thread.running?c("span",{className:"session-map-running",children:e.t("map.running")}):void 0,onClick:()=>e.onOpen(r.thread.threadId)})})})}function T3(e,t){let n=new Map;for(let s of e.threads){let i=n.get(s.projectId)??[];i.push(s),n.set(s.projectId,i)}let o=new Set(e.projects.map(s=>s.projectId)),r=[];for(let s of e.projects){let i=n.get(s.projectId)??[];if(i.length!==0){r.push({kind:"header",key:`project:${s.projectId}`,title:s.title||s.workspaceRoot});for(let l of i)r.push({kind:"thread",key:l.threadId,thread:l})}}let a=e.threads.filter(s=>!o.has(s.projectId));if(a.length>0){r.push({kind:"header",key:"project:none",title:t("map.ungrouped")});for(let s of a)r.push({kind:"thread",key:s.threadId,thread:s})}return r}function BT(e,t){let n=Math.min(4,Math.max(.25,e.scale*t));return{...e,scale:n}}function k3(e,t,n){return[...gT(e,t,n)]}var Ev="ycodium-session-map:phrases",Mv="ycodium-session-map:collapsed",HT="ycodium-session-map:phrases",KT="ycodium-session-map:collapsed";function $T(e,t,n){let o=r=>{r.key===e&&n()};return window.addEventListener("storage",o),window.addEventListener(t,n),()=>{window.removeEventListener("storage",o),window.removeEventListener(t,n)}}var Xs=[];function VT(){return XT(Ev)}function qT(e){YT(Ev,JSON.stringify(e)),window.dispatchEvent(new Event(HT))}function WT(e){return $T(Ev,HT,e)}function jT(){return XT(Mv)}function GT(e){YT(Mv,JSON.stringify(e)),window.dispatchEvent(new Event(KT))}function QT(e){return $T(Mv,KT,e)}var zT=new Map;function XT(e){let t=L3(e),n=zT.get(e);if(n!==void 0&&n.raw===t)return n.value;let o=P3(t);return zT.set(e,{raw:t,value:o}),o}function P3(e){if(e===null)return Xs;try{let t=JSON.parse(e);if(!Array.isArray(t))return Xs;let n=t.filter(o=>typeof o=="string");return n.length===0?Xs:n}catch{return Xs}}function L3(e){try{return localStorage.getItem(e)}catch{return null}}function YT(e,t){try{localStorage.setItem(e,t)}catch{}}Y();function fp(e){let[t,n]=W(()=>({data:e,board:wv(null,e)}));return t.data!==e&&n({data:e,board:wv(t.board,e)}),t.board}function pp(e){let t=Bn(WT,VT,()=>Xs),n=Bn(QT,jT,()=>Xs),o=K(()=>new Set(n),[n]),[r,a]=W(null),s=M(0),[i,l]=W(0),d=e.environmentId,u=e.threadId,f=d===null?{}:{environmentId:d},p=e.bridge.commands.useSubscription("live",{},f),m=e.bridge.commands.useSubscription("ycodium.sessionProjection",{name:"card",threadId:u!==null&&u.length>0?u:"_"},f),h=e.bridge.i18n.usePluginTranslation(),g=e.bridge.useFormatTimestamp(),v=fp(p.data);U(()=>{u===null||u.length===0||e.bridge.commands.invoke("focus",{threadId:u},f)},[u,d,e.bridge]);let C=u===null?null:TT(m.data);return c(UT,{t:h,board:v,pending:p.isPending,focusThreadId:u,fuller:C,detail:r?.view??null,detailThreadId:r?.threadId??null,phrases:Sc(t),collapsed:o,fill:e.fill,locateToken:e.locateToken+i,memoryScope:d??"",viewSwitch:e.viewSwitch??null,formatTime:g,onClose:e.onClose,onOpenThread:y=>{d!==null&&e.bridge.openThread({environmentId:d,threadId:y})},onLocate:()=>l(y=>y+1),onPhrases:qT,onCollapsed:GT,onMove:(y,x,b)=>{e.bridge.commands.invoke("move",{cardId:y,x,y:b},f)},onTidy:()=>{e.bridge.commands.invoke("tidy",{},f)},onHide:y=>{e.bridge.commands.invoke("hide",{threadId:y},f)},onRestore:y=>{e.bridge.commands.invoke("restore",{threadId:y},f)},onAnchor:(y,x)=>{e.bridge.commands.invoke("preferences",{patch:{anchor:{threadId:y,cardId:x}}},f)},onLoadDetail:y=>{let x=s.current+1;s.current=x,e.bridge.commands.invoke("detail",{threadId:y},f).then(b=>{s.current===x&&a({threadId:y,view:kT(b)})})},onSend:async(y,x,b)=>{let I=PT(await R3(e.bridge,y,x,b,f));return I.ok&&I.walkedBack?e.bridge.notify(h("card.walkedBack"),"info"):I.ok&&e.bridge.notify(h("draft.sent"),"success"),I}})}async function R3(e,t,n,o,r){switch(t.kind){case"continue":return e.commands.invoke("send",{threadId:t.threadId,text:n},r);case"branch":return e.commands.invoke("fork",{threadId:t.threadId,messageId:t.messageId,text:n},r);case"new":return e.commands.invoke("create",{projectId:o,text:n},r);default:return t}}Y();function sn(){return{t:Un().i18n.usePluginTranslation()}}function JT(e){if(e.cacheDisjoint!==!0)return null;let t=e.cachedInputTokens,n=e.inputTokens;if(t===void 0||n===void 0)return null;let o=t+n;if(o<=0)return null;if(t>=o)return"100%";let r=t/o*100;for(let a=0;a<=3;a+=1){let s=r.toFixed(a);if(Number.parseFloat(s)<100)return`${s}%`}return"99.9%"}function ZT(e){let t,n,o,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&&(n=(n??0)+s.inputTokens),s.cachedInputTokens!==void 0&&(o=(o??0)+s.cachedInputTokens));if(!(t===void 0&&n===void 0&&o===void 0))return{...a&&r?{cacheDisjoint:!0}:{},...t!==void 0?{outputTokens:t}:{},...n!==void 0?{inputTokens:n}:{},...o!==void 0?{cachedInputTokens:o}:{}}}function Ic(e){return e<1e3?String(Math.round(e)):e<1e6?`${(e/1e3).toFixed(1).replace(/\.0$/,"")}k`:`${(e/1e6).toFixed(1).replace(/\.0$/,"")}m`}var A3=ce(function({item:t,ordinal:n,usage:o,onSelect:r}){return S("button",{type:"button","data-turn-navigator-row":t.sectionKey,onClick:()=>r(t),className:"flex w-full cursor-pointer items-start gap-2.5 rounded-md px-2 py-1.5 text-left transition-colors hover:bg-accent",children:[c("span",{className:"shrink-0 pt-px font-mono text-[10px] text-muted-foreground tabular-nums",children:n}),S("span",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[c("span",{className:"line-clamp-2 min-w-0 font-medium text-chat leading-snug",children:t.userText}),t.assistantText?S("span",{className:"flex items-baseline gap-2",children:[c("span",{className:"line-clamp-1 min-w-0 flex-1 text-[11px] text-muted-foreground leading-snug",children:t.assistantText}),o?.outputTokens!==void 0?c("span",{className:"shrink-0 font-mono text-[9px] text-muted-foreground tabular-nums",children:Ic(o.outputTokens)}):null]}):null]})]})});function E3({totals:e}){let{t}=sn();if(!e)return null;let n=JT(e),o=[e.outputTokens===void 0?null:{label:t("turnNavigator.usageOutput"),value:Ic(e.outputTokens)},e.inputTokens===void 0?null:{label:t("turnNavigator.usageInput"),value:Ic(e.inputTokens)},e.cachedInputTokens===void 0?null:{label:t("turnNavigator.usageCacheRead"),value:n===null?Ic(e.cachedInputTokens):`${Ic(e.cachedInputTokens)} (${n})`}].filter(r=>r!==null);return o.length===0?null:S("div",{className:"flex items-baseline gap-2 border-t px-2 py-1.5",children:[c("span",{className:"flex-1 font-mono text-[10px] text-muted-foreground uppercase tracking-[0.14em]",children:t("turnNavigator.usage")}),o.map(r=>S("span",{className:"shrink-0 font-mono text-[10px] text-muted-foreground tabular-nums",children:[r.label," ",r.value]},r.label))]})}var M3=ce(function({getText:t,size:n="xs",variant:o="outline",className:r}){let{t:a}=sn(),s=Un().writeClipboard,[i,l]=W(!1),d=a("turnNavigator.copyMarkdown");return S(ze,{children:[c(Ke,{render:c(ee,{"aria-label":d,disabled:i,onClick:()=>{s(t()).then(()=>{l(!0),window.setTimeout(()=>l(!1),1e3)})},type:"button",size:n,variant:o,className:j("text-muted-foreground hover:text-foreground",r)}),children:i?c(Qn,{className:"size-3 text-primary"}):c(Ts,{className:"size-3"})}),c(He,{children:c("p",{children:d})})]})});function e0({items:e,totalTurnCount:t,bottomInset:n,usageByTurnId:o,onSelect:r,exportMarkdown:a,onDownload:s,placement:i="float"}){let{t:l}=sn(),[d,u]=W(!1),f=K(()=>e.map((g,v)=>({item:g,ordinal:v+1})).reverse(),[e]),p=K(()=>ZT(f.map(({item:g})=>g.turnId===null?void 0:o.get(g.turnId))),[f,o]);if(e.length===0)return null;let m=t??e.length,h=l("turnNavigator.open",{count:m});return S(Ho,{onOpenChange:u,open:d,children:[S(Ar,{render:c(ee,{"aria-label":h,className:j("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:n+12}:void 0,title:h,variant:"glass"}),children:[c(Kd,{"aria-hidden":!0}),c("span",{className:"font-mono font-semibold text-[11px] tabular-nums",children:m})]}),c(Ko,{align:"end",className:"w-80 flex-col",side:"top",children:S("div",{className:"flex max-h-[min(60vh,26rem)] flex-col",children:[S("div",{className:"flex items-center gap-1.5 border-b px-2 py-1.5",children:[c("span",{className:"flex-1 font-mono text-[10px] text-muted-foreground uppercase tracking-[0.14em]",children:l("turnNavigator.title")}),c("span",{className:"font-mono text-[10px] text-muted-foreground tabular-nums",children:m})]}),c("div",{className:j("min-h-0 flex-1 overflow-y-auto overflow-x-hidden p-1"),children:f.map(({item:g,ordinal:v})=>c(A3,{item:g,onSelect:C=>{u(!1),r(C)},ordinal:v,usage:g.turnId===null?void 0:o.get(g.turnId)},g.sectionKey))}),c(E3,{totals:p}),S("div",{className:"flex items-center gap-1 border-t px-2 py-1.5",children:[c("span",{className:"flex-1 font-mono text-[10px] text-muted-foreground uppercase tracking-[0.14em]",children:l("turnNavigator.export")}),c(M3,{size:"icon-xs",getText:a,variant:"ghost"}),c(ee,{"aria-label":l("turnNavigator.downloadMarkdown"),onClick:()=>s("md"),size:"xs",title:l("turnNavigator.downloadMarkdown"),variant:"ghost",children:c("span",{className:"font-mono text-[10px]",children:".md"})}),c(ee,{"aria-label":l("turnNavigator.downloadJson"),onClick:()=>s("json"),size:"xs",title:l("turnNavigator.downloadJson"),variant:"ghost",children:c("span",{className:"font-mono text-[10px]",children:".json"})})]})]})})]})}Y();function Tc(e){return e.replace(/\s+/g," ")}function N3(e,t){let n=e.slice(Math.max(0,e.length-t));return/^[\uDC00-\uDFFF]/.test(n)&&(n=n.slice(1)),n}function _3(e,t){let n=e.slice(0,t);return/[\uD800-\uDBFF]$/.test(n)&&(n=n.slice(0,-1)),n}function mp(e){let n=(e instanceof Element?e:e?.parentElement??null)?.closest("[data-assistant-quote-body]")??null;return n?.closest('[data-message-role="assistant"]')?n:null}function t0(e){if(!e||e.isCollapsed||e.rangeCount===0)return null;let t=e.getRangeAt(0),n=mp(t.startContainer);if(n===null||mp(t.endContainer)!==n)return null;let o=n.closest("[data-message-id]")?.dataset.messageId;if(!o)return null;let r=e.toString().trim();if(r.length===0)return null;let a=document.createRange();a.selectNodeContents(n),a.setEnd(t.startContainer,t.startOffset);let s=document.createRange();s.selectNodeContents(n),s.setStart(t.endContainer,t.endOffset);let i=Tc(t.toString()),l=i.length>i.trimStart().length?" ":"",d=i.length>i.trimEnd().length?" ":"",u=Tc(a.toString()+l),f=Tc(d+s.toString()),p=u.length,m=p+i.trim().length,h=t.getClientRects(),g=h[0]??t.getBoundingClientRect(),v=h[h.length-1]??g;return{messageId:o,text:r,start:p,end:m,prefix:N3(u,32),suffix:_3(f,32),anchor:{x:v.right,top:g.top,bottom:v.bottom}}}var gp="assistant-quote-inserter",hp="assistant-quote-open-comment";Y();var o0=100,D3=new Map,n0=new Map,vp=e=>typeof e=="function"?e():e,r0=(e,t)=>typeof t=="function"?t(e):t;function O3(e,t,n){let o=e.get(t);return o===void 0&&(o={values:new Map,limit:Math.max(1,n)},e.set(t,o)),o}function F3(e,t){let n=n0.get(e);return n===void 0&&(n={values:new Map,limit:Math.max(1,t)},n0.set(e,n)),n}function B3(e,t){if(!(e.values.size<=e.limit)){for(let[n,o]of e.values){if(e.values.size<=e.limit)return;o===t||o.committed||o.leases>0||(e.values.delete(n),o.alive=!1,o.subscribers.clear())}for(let[n,o]of e.values){if(e.values.size<=e.limit)return;o===t||o.leases>0||(e.values.delete(n),o.alive=!1,o.subscribers.clear())}}}function Nv(e,t,n){e.values.get(t)===n&&(e.values.delete(t),e.values.set(t,n))}function a0(e,t,n){let o=e.values.get(t);return o===void 0&&(o={value:vp(n),subscribers:new Set,leases:0,alive:!0,committed:!1},e.values.set(t,o)),o}function kc(e){queueMicrotask(()=>B3(e))}function Pt(e,t,n,o=o0){let r=Math.max(1,o),a=O3(D3,e,r),s=a0(a,t,n),i=E(f=>s.alive?(a.limit=r,s.committed=!0,Nv(a,t,s),s.leases+=1,s.subscribers.add(f),kc(a),()=>{s.subscribers.delete(f),s.leases=Math.max(0,s.leases-1),kc(a)}):()=>{},[r,s,a,t]),l=E(()=>s.value,[s]),d=Bn(i,l,l),u=E(f=>{if(!s.alive||a.values.get(t)!==s)return;let p=s.value,m=r0(p,f);if(!Object.is(m,p)){s.value=m,Nv(a,t,s);for(let h of s.subscribers)h();kc(a)}},[s,a,t]);return[d,u]}function s0(e,t){let n=M(null);(n.current===null||n.current.key!==e)&&(n.current={key:e,value:vp(t)});let[,o]=Wr(a=>a+1,0),r=E(a=>{let s=n.current;if(s===null||s.key!==e)return;let i=r0(s.value,a);Object.is(i,s.value)||(s.value=i,o())},[e]);return[n.current.value,r]}function ot(e,t,n,o=o0){let r=Math.max(1,o),a=F3(e,r),s=a0(a,t,()=>({current:vp(n)}));return U(()=>{if(!(!s.alive||a.values.get(t)!==s))return a.limit=r,s.committed=!0,Nv(a,t,s),s.leases+=1,kc(a),()=>{s.leases=Math.max(0,s.leases-1),kc(a)}},[r,s,a,t]),s.value}function Ao(e,t){let n=M(null);return(n.current===null||n.current.key!==e)&&(n.current={key:e,ref:{current:vp(t)}}),n.current.ref}var U3=300;function i0(e){let{data:t,target:n,threadKey:o,surfaceRef:r}=e,{t:a}=ie(),s=ot(gp,o,null),[,i]=Pt(hp,o,null),[l,d]=W(null),u=M(null);if(U(()=>{let g,v=()=>{let T=r.current,P=document.getSelection(),k=P&&P.rangeCount>0?P.getRangeAt(0):null;if(!T||!k||!T.contains(k.commonAncestorContainer)){d(null);return}let w=t0(P);if(w===null){d(null);return}let L=t.assistantQuotes.serialize({version:1,environmentId:n.environmentId,threadId:n.threadId,messageId:w.messageId,text:w.text,start:w.start,end:w.end,prefix:w.prefix,suffix:w.suffix});d({source:L,...w.anchor})},C=T=>{u.current?.contains(T.target)||(clearTimeout(g),g=setTimeout(v,U3))},y=T=>{u.current?.contains(T.target)||(clearTimeout(g),d(null))},x=()=>d(null),b=T=>{T.key==="Escape"&&d(null)},I=()=>{(document.getSelection()?.isCollapsed??!0)&&d(null)};return document.addEventListener("pointerup",C,!0),document.addEventListener("keyup",C,!0),document.addEventListener("pointerdown",y,!0),document.addEventListener("keydown",b,!0),document.addEventListener("selectionchange",I),window.addEventListener("scroll",x,!0),()=>{clearTimeout(g),document.removeEventListener("pointerup",C,!0),document.removeEventListener("keyup",C,!0),document.removeEventListener("pointerdown",y,!0),document.removeEventListener("keydown",b,!0),document.removeEventListener("selectionchange",I),window.removeEventListener("scroll",x,!0)}},[t,r,n.environmentId,n.threadId]),l===null)return null;let f=l.source,p=Math.max(8,Math.min(window.innerWidth-200,l.x-12)),m=l.bottom+6,h=m+40<=window.innerHeight?m:Math.max(8,l.top-40);return c("div",{ref:u,className:"fixed z-50",style:{left:p,top:h},"data-assistant-quote-toolbar":"",children:S(ee,{size:"sm",variant:"outline",className:"shadow-md",disabled:f===null,title:f===null?a("timeline.quote.tooLong"):void 0,onMouseDown:g=>g.preventDefault(),onClick:()=>{f!==null&&s.current?.(f)===!0&&(i(f),document.getSelection()?.removeAllRanges(),d(null))},children:[c(Xr,{"aria-hidden":"true"}),a("timeline.quote.cite")]})})}Y();Y();function l0(e){let t=e.map(o=>({key:o.key,turnId:o.turnId,firstRowIndex:o.firstRowIndex,endRowIndex:o.firstRowIndex+o.rowIds.length})),n=new Map;for(let o of e)for(let[r,a]of o.rowIds.entries())n.set(a,{turnId:o.turnId,index:o.firstRowIndex+r});return{sections:t,bySectionKey:new Map(t.map(o=>[o.key,o])),byRowId:n}}function yp({index:e,visibleSectionKeys:t,protectedRowIds:n,selectionRows:o}){let r=t.flatMap(d=>{let u=e.bySectionKey.get(d)?.turnId;return u==null?[]:[u]}),a=n.flatMap(d=>{let u=e.byRowId.get(d)?.turnId;return u==null?[]:[u]}),s=o?e.byRowId.get(o.firstRowId)?.index:void 0,i=o?e.byRowId.get(o.lastRowId)?.index:void 0,l=s===void 0||i===void 0?[]:e.sections.flatMap(d=>d.turnId!==null&&d.endRowIndex>Math.min(s,i)&&d.firstRowIndex<=Math.max(s,i)?[d.turnId]:[]);return{firstTurnId:r[0]??null,lastTurnId:r.at(-1)??null,protectedTurnIds:[...new Set(a)],selectionTurnRange:l.length>0?{firstTurnId:l[0],lastTurnId:l.at(-1)}:null}}function d0(e,t,n,o){if(!o)return n;let r=e.findIndex(a=>t.has(a));return r<0?n:Math.max(n,e.length-r)}Y();Y();function _v(e,t){for(let n of e.querySelectorAll("[data-timeline-row-id]"))if(n.dataset.timelineRowId===t)return n;return null}function Ys(e,t){let n=0,o=e.length,r=-1;for(;n<o;){let a=Math.floor((n+o)/2),i=e[a].getBoundingClientRect();Math.max(i.bottom,i.top+1)>t?(r=a,o=a):n=a+1}return r}function z3(e){let t=e.getBoundingClientRect().top,n=e.querySelectorAll("[data-timeline-turn-section]"),o=a=>{let s=a.querySelectorAll("[data-timeline-row-id]"),i=Ys(s,t),l=i<0?void 0:s[i],d=l?.dataset.timelineRowId;return!l||d===void 0?null:{rowId:d,offsetPx:Math.round(t-l.getBoundingClientRect().top)}};if(n.length===0)return o(e);let r=Ys(n,t);if(r<0)return null;for(let a=r;a<n.length;a+=1){let s=o(n[a]);if(s)return s}return null}function c0(e,t){let n=0,o=e;for(;o&&o!==t;)n+=o.offsetTop,o=o.offsetParent;return n}var Dv=class extends Vr{getSnapshotBeforeUpdate(t){return t.inputKey!==this.props.inputKey&&t.onBeforeInputChange(),null}componentDidUpdate(){}componentWillUnmount(){this.props.onBeforeInputChange()}render(){return this.props.children}};function u0({inputKey:e,onBeforeInputChange:t,handleRef:n,onAttach:o,className:r,children:a,onScroll:s,onInteractionRowsChange:i}){let l=M(null),d=M({inputKey:e,store:nc()});d.current.inputKey!==e&&(d.current={inputKey:e,store:nc()});let u=M(i);u.current=i;let f=E(m=>{let h=d.current;return h.store.acquire(m,()=>{d.current===h&&u.current?.(h.store.rows())})},[]);pe(()=>{i?.(d.current.store.rows())},[e,i]),Fo(n,()=>({get node(){return l.current},measure:()=>{let m=l.current;return m?{scroll:m.scrollTop,scrollLength:m.clientHeight,contentLength:m.scrollHeight,topOf:h=>{let g=_v(m,h);return g===null?null:c0(g,m)},heightOf:h=>{let g=_v(m,h);return g===null?null:g.offsetHeight},rowAtScroll:()=>z3(m)}:null},scrollToEnd:m=>{let h=l.current;if(h){if(m?.animated){h.scrollTo({top:h.scrollHeight,behavior:"smooth"});return}h.scrollTop=h.scrollHeight-h.clientHeight}},scrollToRow:(m,h)=>{let g=l.current;if(!g)return!1;let v=_v(g,m);return v?(g.scrollTop=Math.max(0,c0(v,g)-(h?.viewOffset??0)),!0):!1},scrollToOffset:m=>{let h=l.current;h&&(h.scrollTop=Math.max(0,m))}}),[]);let p=E(m=>{l.current=m,o(m)},[o]);return c(Dv,{inputKey:e,onBeforeInputChange:t,children:c(tc,{value:f,children:c("div",{ref:p,className:r,style:{position:"relative"},onScroll:s,children:a})})})}function ll(e){if(!e)return!1;let t=e.tagName?.toLowerCase(),n=e.getAttribute?.("contenteditable");if(t==="textarea"||n==="true"||n===""||n==="plaintext-only"||"isContentEditable"in e&&e.isContentEditable===!0)return!0;if(t==="input"){let o=e.getAttribute?.("type")?.toLowerCase()??"text";if(!["button","submit","reset","image","checkbox","radio"].includes(o))return!0}return e.matches?.(":focus-visible")??!1}function il(e,t){let o=(e?.nodeType===1?e:e?.parentElement)?.closest("[data-timeline-row-id]");return o&&t.contains(o)?o.dataset.timelineRowId??null:null}function Cp(e){let t=e.ownerDocument.getSelection?.();if(!t||t.isCollapsed)return null;let n=null,o=null;for(let d=0;d<t.rangeCount;d+=1){let u=t.getRangeAt(d);u.intersectsNode(e)&&(n??=u,o=u)}if(!n||!o)return null;let r=il(n.startContainer,e),a=il(o.endContainer,e);if(r&&a)return{firstRowId:r,lastRowId:a};let s=e.querySelectorAll("[data-timeline-row-id]"),i=s[0]?.dataset.timelineRowId,l=s[s.length-1]?.dataset.timelineRowId;return i&&l?{firstRowId:r??i,lastRowId:a??l}:null}function Pc(e){let t=e.ownerDocument.getSelection?.();if(!t||t.isCollapsed)return!1;for(let n=0;n<t.rangeCount;n+=1)if(t.getRangeAt(n).intersectsNode(e))return!0;return!1}Y();function qa(e){let t=M(e);t.current=e;let n=M(!1),o=M(null),r=M(null),a=M(0),s=E(()=>{a.current+=1,r.current!==null&&cancelAnimationFrame(r.current),r.current=null},[]),i=E(()=>{if(!n.current||!t.current||r.current!==null||o.current===null)return;let u=++a.current;r.current=requestAnimationFrame(f=>{if(u!==a.current||(r.current=null,!n.current||!t.current))return;let p=o.current;o.current=null,p?.(f)})},[]),l=E(u=>{o.current=u,i()},[i]),d=E(()=>{o.current=null,s()},[s]);return pe(()=>(n.current=!0,i(),()=>{n.current=!1,s()}),[e,s,i]),K(()=>({request:l,cancel:d}),[l,d])}function f0({root:e,inputKey:t,visible:n,index:o,topInset:r,bottomInset:a,interactionRows:s,onRangeChange:i,onSelectionChange:l}){let d=M({inputKey:t,visible:n,index:o,topInset:r,bottomInset:a,interactionRows:s,onRangeChange:i,onSelectionChange:l});d.current={inputKey:t,visible:n,index:o,topInset:r,bottomInset:a,interactionRows:s,onRangeChange:i,onSelectionChange:l};let u=qa(n),f=M(null),p=E(()=>{let h=d.current;if(!e||!h.visible||e.clientHeight<=0)return;let g=e.getBoundingClientRect();if(g.height<=0)return;let v=g.top+h.topInset,C=g.bottom-h.bottomInset,y=e.querySelectorAll("[data-timeline-turn-section]"),x=Ys(y,v),b=[];if(x>=0)for(let w=x;w<y.length;w+=1){let L=y[w];if(L.getBoundingClientRect().top>=C)break;L.dataset.timelineTurnSection!==void 0&&b.push(L.dataset.timelineTurnSection)}let I=[...h.interactionRows()],T=e.ownerDocument.activeElement;if(ll(T)){let w=il(T,e);w&&I.push(w)}let P=yp({index:h.index,visibleSectionKeys:b,protectedRowIds:I,selectionRows:Cp(e)}),k=`${h.inputKey}:${JSON.stringify(P)}`;k!==f.current&&(f.current=k,h.onRangeChange?.(P))},[e]),m=E(()=>u.request(p),[u,p]);return pe(()=>{if(f.current=null,!n||!e)return;let h=t,g=!0,v=()=>{!g||d.current.inputKey!==h||!d.current.visible||(d.current.onSelectionChange(Pc(e)),m())};e.addEventListener("scroll",v,{passive:!0}),e.addEventListener("focusin",v),e.addEventListener("focusout",v),e.ownerDocument.addEventListener("selectionchange",v);let C=typeof ResizeObserver>"u"?null:new ResizeObserver(v);return C?.observe(e),e.firstElementChild&&C?.observe(e.firstElementChild),v(),()=>{g=!1,u.cancel(),C?.disconnect(),e.removeEventListener("scroll",v),e.removeEventListener("focusin",v),e.removeEventListener("focusout",v),e.ownerDocument.removeEventListener("selectionchange",v),i?.(null)}},[u,t,i,m,e,n]),pe(()=>{n&&m()},[o,m,n]),m}Y();var p0=ce(function({sectionKey:t,rowKeyPrefix:n,rowIds:o,renderRow:r,sectionRef:a}){return c("div",{className:"session-turn","data-timeline-turn-section":t,ref:a,children:o.map(s=>c("div",{className:"transcript-col min-w-0 overflow-x-clip",children:r(s)},`${n}:${s}`))})});var H3=400;function m0({root:e,minimumCount:t,keepAbovePx:n=0,canCompact:o,onCompact:r}){let a=e.ownerDocument,s=new Set,i,l=!1,d=()=>e.scrollHeight-e.clientHeight-e.scrollTop<=2,u=()=>{if(i=void 0,a.hidden||s.size>0||!o()||e.clientHeight<=0||!d()||Pc(e))return;let b=e.querySelectorAll("[data-timeline-turn-section]"),I=e.getBoundingClientRect().top-32-n,T=0,P=Math.max(0,b.length-t);for(;T<P;){let w=Math.floor((T+P)/2),L=b[w].getBoundingClientRect().bottom;if(!Number.isFinite(L))return;L<=I?T=w+1:P=w}if(T===0)return;let k=a.activeElement;if(k&&ll(k)){for(let w=0;w<T;w+=1)if(b[w].contains(k))return}r(b.length-T)},f=!1,p=()=>{if(a.hidden||s.size>0||!o()||f){clearTimeout(i),i=void 0;return}i===void 0&&(i=setTimeout(u,H3))},m=()=>{clearTimeout(i),i=void 0,p()},h=()=>{let b=d();!b||!l?m():p(),l=b},g=b=>{s.add(b.pointerId),m()},v=b=>{s.delete(b.pointerId),m()},C=()=>{f=Pc(e),m()},y=()=>{s.clear(),m()},x=["wheel","keydown","focusin","focusout"];for(let b of x)e.addEventListener(b,m,{passive:!0});return e.addEventListener("scroll",h,{passive:!0}),e.addEventListener("pointerdown",g,!0),a.addEventListener("pointerup",v,!0),a.addEventListener("pointercancel",v,!0),a.addEventListener("selectionchange",C),a.addEventListener("visibilitychange",p),a.defaultView?.addEventListener("blur",y),p(),{schedule:p,disconnect:()=>{clearTimeout(i);for(let b of x)e.removeEventListener(b,m);e.removeEventListener("scroll",h),e.removeEventListener("pointerdown",g,!0),a.removeEventListener("pointerup",v,!0),a.removeEventListener("pointercancel",v,!0),a.removeEventListener("selectionchange",C),a.removeEventListener("visibilitychange",p),a.defaultView?.removeEventListener("blur",y)}}}Y();function g0({root:e,topInsetPx:t,onActiveSectionChange:n,active:o}){let r=M(o);r.current=o;let a=qa(o),s=M(new Map),i=M(null),l=M(null),d=M(n);d.current=n;let u=E(()=>{if(!r.current||!e)return;let g=e.scrollTop+t,v=null,C=Number.NEGATIVE_INFINITY,y=null,x=Number.POSITIVE_INFINITY;for(let[I,T]of s.current){if(!T.isConnected)continue;let P=T.offsetTop;P<x&&(x=P,y=I),P<=g&&P>=C&&(C=P,v=I)}let b=v??y;b!==l.current&&(l.current=b,d.current(b))},[e,t]),f=E(()=>{r.current&&a.request(u)},[a,u]);U(()=>{if(!o||!e||typeof IntersectionObserver>"u")return;let g=!0,v=new IntersectionObserver(()=>{!g||!r.current||f()},{root:e,rootMargin:`-${t}px 0px 0px 0px`,threshold:0});i.current=v;for(let C of s.current.values())v.observe(C);return f(),()=>{g=!1,v.disconnect(),i.current=null,a.cancel()}},[o,a,f,e,t]);let p=M(new Map),m=E(g=>{let v=p.current.get(g);if(v)return v;let C=y=>{let x=s.current.get(g);x&&x!==y&&(i.current?.unobserve(x),s.current.delete(g)),y?(s.current.set(g,y),i.current?.observe(y)):p.current.get(g)===C&&p.current.delete(g)};return p.current.set(g,C),C},[]),h=E(()=>{r.current&&(l.current=null,f())},[f]);return K(()=>({observeSection:m,refresh:h}),[m,h])}Y();function h0(e){return Bn(e.subscribe,e.getStructure,e.getStructure)}function v0(e,t){let n=E(r=>e.subscribeRow(t,r),[e,t]),o=E(()=>e.getRow(t),[e,t]);return Bn(n,o,o)}function In(e,t,n=Object.is){let o=M(null),r=E(()=>{let a=e.getVersion(),s=o.current;if(s!==null&&s.store===e&&s.select===t&&s.version===a)return s.value;let i=t(e),l=s!==null&&s.store===e&&n(s.value,i)?s.value:i;return o.current={store:e,select:t,version:a,value:l},l},[e,t,n]);return Bn(e.subscribe,r,r)}Y();Y();function K3(e,t){let n={hour:"numeric",minute:"2-digit",...t?{second:"2-digit"}:{}};return e==="locale"?n:{...n,hour12:e==="12-hour"}}function $3(e){let t=e?.trim();if(t)try{return Intl.DateTimeFormat.supportedLocalesOf([t]),t}catch{return}}function V3(){return typeof window>"u"?null:window.desktopBridge?.getSystemLocale?.()??null}var Ov=$3(V3()),y0=new Map;function C0(e,t){let n=`${e}:${t?"seconds":"minutes"}`,o=y0.get(n);if(o)return o;let r=new Intl.DateTimeFormat(Ov,K3(e,t));return y0.set(n,r),r}function Fv(e){let t=new Date(e);return Number.isNaN(t.getTime())?null:t}var q3=new Intl.DateTimeFormat(void 0,{month:"long"});function W3(e){let t=e%100;if(t>=11&&t<=13)return"th";switch(e%10){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}}function j3(e,t){let n=Fv(e);return n?C0(t,!1).format(n):""}function Mr(e,t){let n=Fv(e);if(!n)return"";let o=j3(e,t),r=n.getDate(),a=q3.format(n),s=n.getFullYear();return`${o}, ${r}${W3(r)} ${a} ${s}`}var G3=new Intl.DateTimeFormat(Ov,{month:"numeric",day:"numeric"}),Q3=new Intl.DateTimeFormat(Ov,{month:"numeric",day:"numeric",year:"numeric"});function ia(e,t,n,o=Date.now()){let r=Fv(e);if(!r)return"";let a=C0(t,!1).format(r),s=new Date(o),i=new Date(s.getFullYear(),s.getMonth(),s.getDate()).getTime(),l=new Date(r.getFullYear(),r.getMonth(),r.getDate()).getTime(),d=Math.round((i-l)/864e5);return d<=0?a:d===1?n("relativeTime.yesterdayAt",{time:a}):`${(r.getFullYear()===s.getFullYear()?G3:Q3).format(r)} ${a}`}Y();var It=ct(null),xp=ct(null);Y();var dl=new Map,x0=24,X3=4e3,Y3=1024,b0=16384;function Bv(e){let t=dl.get(e);if(t)return t;let n={values:new Map,listeners:new Set,stringLength:0};if(dl.set(e,n),dl.size>x0){for(let[o,r]of dl)if(r.listeners.size===0&&o!==e&&(dl.delete(o),dl.size<=x0))break}return n}function Uv(e,t,n){return Bv(e).values.get(t)??n}function Lc(e,t,n,o=!0){let r=Bv(e);if(typeof n=="string"&&(n=n.slice(0,Y3)),r.values.get(t)===n)return;let a=r.values.get(t);if(typeof a=="string"&&(r.stringLength-=a.length),r.values.delete(t),r.values.set(t,n),typeof n=="string"&&(r.stringLength+=n.length),r.stringLength>b0){for(let[s,i]of r.values)if(!(typeof i!="string"||s===t)&&(r.values.delete(s),r.stringLength-=i.length,r.stringLength<=b0))break}if(r.values.size>X3){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)}}o&&r.listeners.forEach(s=>s())}function go(e,t,n){let o=E(i=>{let l=Bv(e);return l.listeners.add(i),()=>l.listeners.delete(i)},[e]),r=E(()=>Uv(e,t,n),[e,t,n]),a=Bn(o,r,r),s=E(i=>Lc(e,t,i),[e,t]);return[a,s]}function We(){let e=Un().i18n.usePluginTranslation();return{t:(t,n)=>e(t,n)}}var w0=window.__ycodiumPluginHost.modules?.["@ycodium-ai/plugin-api"];if(!w0)throw new Error("This plugin needs a newer Ycodium app. Update the app.");var{COMMUNICATION_RECORDS_READ_LIMIT:sae,MAX_PLUGIN_SESSION_PROJECTION_BYTES:iae,MAX_PLUGIN_SKILL_COMPANION_FILE_BYTES:lae,MAX_PLUGIN_SKILL_COMPANION_TOTAL_BYTES:dae,MAX_PLUGIN_STREAM_BUFFER:cae,MAX_PLUGIN_TOOL_PRESENTATION_BYTES:uae,MAX_PLUGIN_WORKSPACE_WRITE_BYTES:fae,MIN_PLUGIN_INTERVAL_MS:pae,PLUGIN_API_MIN_VERSION:mae,PLUGIN_API_VERSION:gae,PLUGIN_PROXY_DIRECT:hae,PLUGIN_SESSION_PROJECTION_COMMAND:vae,REASONING_OPTION_LABEL:yae,REQUEST_RESOLVED_TRIGGER_KIND:Cae,TURN_PROGRESS_TRIGGER_KIND:xae,USER_INPUT_PENDING_TRIGGER_KIND:bae,acceptPluginToolPresentation:wae,definePlugin:Sae,effortText:S0,knownEffortLevel:Iae,mergeLaunchEnv:Tae,modelOptionLabelKind:I0,modelSelectionStringOption:kae,parseRetryAfterMs:Pae,pluginJsonByteLength:Lae,readRequestResolved:Rae,readTurnProgress:Aae,readUserInputPending:Eae,reasoningEffortLevel:Mae,reasoningEffortShortLabel:Nae,relabelModelOptionDescriptors:T0}=w0;function bp(e,t,n){if(e!=="opencode"||t.length===0)return!1;let o=n?.trim();return o?!t.some(r=>r.slug===o):!1}function wp(e,t){if(e)return t?e:e.filter(n=>n.id!=="agent"||n.value!=="plan")}var k0={effort:"traits.savedOption.effort",reasoningEffort:"traits.savedOption.reasoningEffort",variant:"traits.savedOption.variant"},P0=e=>`traits.optionValue.${e}`;function J3(e){let t=e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").toLowerCase();return t.charAt(0).toUpperCase()+t.slice(1)}function L0(e,t){if(t==="agent")return e("traits.savedOption.agent");let n=I0(t);return n===void 0?J3(t):e(k0[n])}function zv(e,t){return T0(t,{kind:n=>e(k0[n]),level:n=>e(P0(n))})}function Hv(e,t){return S0(t,n=>e(P0(n)))}function R0(e,t){return(e??[]).map(n=>typeof n.value=="boolean"?{id:n.id,label:t(n.id),type:"boolean",currentValue:n.value}:{id:n.id,label:t(n.id),type:"select",options:[{id:n.value,label:n.value}],currentValue:n.value})}function A0(e){return e==="failed"?"failed":e==="running"?"running":"idle"}function E0(e){return e.includes("failed")?"failed":e.includes("running")?"running":"idle"}var Sp="chat-process-row flex w-full min-w-0 select-none items-center gap-1.5 px-2 text-left";function Rc({children:e}){return c("span",{"aria-hidden":!0,className:"flex size-4 shrink-0 items-center justify-center",children:e})}function Ac({status:e}){return c("span",{"aria-hidden":!0,className:"flex size-2 shrink-0 items-center justify-center",children:e===null?null:c("span",{className:j("block size-2 rounded-full",e==="failed"?"bg-destructive":e==="success"?"bg-success":"border border-muted-foreground/60")})})}function Ip({state:e,variant:t="inline",className:n,children:o}){return S("div",{"data-process-state":e,"data-process-kind":t,className:j("chat-process-shell relative min-w-0 overflow-hidden",t==="tool"?"rounded-lg bg-card":"rounded-md",n),children:[e==="running"?c("span",{"aria-hidden":!0,className:"chat-process-shell-pulse animate-status-pulse"}):null,o]})}Y();Y();var cl=class extends Error{reason;constructor(t,n,o){super(n,o),this.reason=t}};function Z3(e){if(typeof document>"u"||typeof document.execCommand!="function")return!1;let t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.setAttribute("aria-hidden","true"),t.style.position="fixed",t.style.top="0",t.style.left="0",t.style.opacity="0",t.style.fontSize="16px";let n=document.activeElement;document.body.appendChild(t);try{return t.focus({preventScroll:!0}),t.select(),t.setSelectionRange(0,e.length),document.execCommand("copy")}catch{return!1}finally{t.remove();let o=n?.focus;typeof o=="function"&&o.call(n)}}async function eV(e,t){let n=()=>new cl("unavailable",`Clipboard API is unavailable while copying ${t}.`);if(typeof window>"u")throw n();if(!e)return!1;if(typeof navigator>"u"||!navigator.clipboard?.writeText){if(Z3(e))return!0;throw n()}try{return await navigator.clipboard.writeText(e),!0}catch(o){throw new cl("write-failed",`Failed to copy ${t} to the clipboard.`,{cause:o})}}function Tp({timeout:e=2e3,target:t="text",onCopy:n,onError:o}={}){let[r,a]=W(!1),s=M(null),i=M(n),l=M(o),d=M(t),u=M(e);i.current=n,l.current=o,d.current=t,u.current=e;let f=E((p,m)=>{eV(p,d.current).then(h=>{h&&(s.current&&clearTimeout(s.current),a(!0),i.current?.(m),u.current!==0&&(s.current=setTimeout(()=>{a(!1),s.current=null},u.current)))},h=>{l.current?.(h instanceof Error?h:new Error(String(h)),m)})},[]);return U(()=>()=>{s.current&&clearTimeout(s.current)},[]),{copyToClipboard:f,isCopied:r}}var M0=1e3,tV={unavailable:"copyButton.clipboardUnavailable","write-failed":"copyButton.copyFailedDetail"};function nV({title:e,description:t}){return S("span",{role:"status",className:"dropdown-glass pointer-events-none fixed z-100 rounded-md px-2 py-1 text-pretty text-popover-foreground text-xs shadow-xl shadow-black/25",children:[e,t?c("span",{className:"block text-muted-foreground",children:t}):null]})}var Wa=ce(function({text:t,size:n="xs",variant:o="outline",className:r,toastAnchor:a="above",label:s}){let{t:i}=We(),l=s??i("copyButton.copyToClipboard"),d=M(null),[u,f]=W(null),p=M(null),m=(v,C)=>{let y=d.current?.getBoundingClientRect();y&&(p.current&&clearTimeout(p.current),f({top:a==="above"?Math.max(4,y.top-(C===void 0?26:40)):Math.min(window.innerHeight-26,y.bottom+4),left:Math.max(4,y.left+y.width/2),title:v,description:C}),p.current=setTimeout(()=>f(null),M0))};U(()=>()=>{p.current&&clearTimeout(p.current)},[]);let{copyToClipboard:h,isCopied:g}=Tp({onCopy:()=>m(i("copyButton.copied")),onError:v=>m(i("copyButton.failedToCopy"),v instanceof cl?i(tV[v.reason]):v.message),timeout:M0});return S(ze,{children:[c(Ke,{render:c(ee,{"aria-label":l,disabled:g,onClick:()=>h(t),ref:d,type:"button",size:n,variant:o,className:j("text-muted-foreground hover:text-foreground",r)}),children:g?c(Qn,{className:"size-3 text-primary"}):c(Ts,{className:"size-3"})}),c(He,{children:c("p",{children:l})}),u?c("span",{"aria-hidden":!0,className:"pointer-events-none fixed",style:{top:u.top,left:u.left},children:c("span",{className:"relative block -translate-x-1/2",children:c(nV,{title:u.title,description:u.description})})}):null]})});function kp({text:e,label:t,children:n}){return S("span",{className:"group/hover-copy inline-flex min-w-0 items-center gap-0.5",children:[n,c("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:c(Wa,{text:e,label:t,variant:"ghost",size:"icon-xs",className:"shrink-0",toastAnchor:"below"})})]})}Y();var oV=[".m4v",".mov",".mp4",".ogv",".webm"],rV=[".aac",".flac",".m4a",".mp3",".oga",".ogg",".opus",".wav",".weba"];function N0(e){let t=e.name.lastIndexOf(".");if(t<=0)return null;let n=e.name.slice(t).toLowerCase();return oV.includes(n)?"video":rV.includes(n)?"audio":null}var aV=["image/gif","image/jpeg","image/png","image/webp"],sV=new Set(aV);function Kv(e){return sV.has(e.toLowerCase())}function iV(e){return Kv(e)?"image":"file"}var lV=new Set(["application/json","application/xml","application/x-yaml","application/yaml"]),dV=[".doc",".docx",".odt",".ppt",".pptx",".odp",".xls",".xlsx",".ods"];function Nr(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 n=N0(e);if(n)return n;let o=e.name.lastIndexOf(".");return o>0&&dV.includes(e.name.slice(o).toLowerCase())?"office":t.startsWith("text/")||lV.has(t)?"text":"file"}function ja(e){let t=Nr(e);return t==="image"||t==="svg"}function Ga(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 $v(e){let t={id:e.id,name:e.name,mimeType:e.mimeType,sizeBytes:e.sizeBytes};return iV(e.mimeType)==="image"?{type:"image",...t}:{type:"file",...t,...e.source?{source:e.source}:{}}}function Pp(e,t){let n=e.flatMap(r=>r.previewUrl?[{...r,src:r.previewUrl}]:[]);if(n.length===0)return null;let o=n.findIndex(r=>r.id===t);return o<0?null:{images:n.map(r=>({src:r.src,name:r.name,attachmentId:r.id,...r.source===void 0?{}:{source:r.source},...r.type!==void 0&&r.mimeType!==void 0&&Nr({type:r.type,mimeType:r.mimeType,name:r.name})==="svg"?{svg:!0}:{}})),index:o}}function Lp(e){switch(e){case"image":case"svg":return Ud;case"video":return _a;case"audio":return nr;case"pdf":return Ed;case"office":return Md;case"text":return Ad;case"file":return To}}function Ec({images:e}){let t=Ye(It),{t:n}=We();return e.length===0?null:c("div",{className:"mb-2 grid max-w-[420px] grid-cols-2 gap-2",children:e.map(o=>c("div",{className:"overflow-hidden rounded-lg border border-border/80 bg-background/70",children:o.previewUrl?c("button",{type:"button",className:"h-full w-full cursor-zoom-in","data-attachment-action":"preview","data-attachment-name":o.name,"aria-label":n("attachments.preview",{name:o.name}),onClick:()=>{let r=Pp(e,o.id);r&&t.onImageExpand(r)},children:c("img",{src:o.previewUrl,alt:o.name,loading:"lazy",decoding:"async",className:Nr(o)==="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"})}):c("div",{className:"flex min-h-[72px] items-center justify-center px-2 py-3 text-center text-secondary-label text-chat-dense",children:o.name})},o.id))})}function Mc(e){let{t}=We(),n=Ye(It).onAttachmentDocumentOpen,o=Nr(e.attachment),r=Lp(o),a=t("attachments.open",{name:e.attachment.name}),s=S(he,{children:[c(r,{className:"size-4 shrink-0 text-secondary-label"}),S("span",{className:"min-w-0 flex-1",children:[c("span",{className:"block truncate font-medium text-foreground text-chat-row",children:e.attachment.name}),c("span",{className:"block text-secondary-label text-chat-meta",children:Ga(e.attachment.sizeBytes)})]})]});return e.attachment.previewUrl&&(o==="video"||o==="audio")?S("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:[c("a",{href:e.attachment.previewUrl,target:"_blank",rel:"noreferrer","aria-label":a,className:"flex items-center gap-2 hover:underline",children:s}),c(IS,{kind:o,src:e.attachment.previewUrl,title:e.attachment.name})]}):(o==="pdf"||o==="office")&&n?c("button",{type:"button","data-attachment-action":"open","data-attachment-name":e.attachment.name,"aria-label":a,onClick:()=>n({attachmentId:e.attachment.id,name:e.attachment.name}),className:"flex w-full cursor-pointer 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?c("a",{href:e.attachment.previewUrl,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}):c("div",{className:"flex items-center gap-2 rounded-sm border border-border/70 bg-background/70 px-2.5 py-2",children:s})}Y();Y();var cV=Object.freeze([]),uV=()=>cV;function _0(e){return e.type==="file"&&e.source?._tag==="thread-reference"}function fV(e){return e.omitted===null?e.carried:S(he,{children:[c("span",{className:"inline-block max-w-full",children:`${e.carried} \xB7`})," ",c("span",{className:"inline-block max-w-full",children:e.omitted})]})}function D0(e){let t=Ye(It),{t:n}=We(),r=(t.threadReferences?.useDeliveries??uV)(t.activeThreadEnvironmentId,e).filter(a=>a.status!=="unreadable");return r.length===0?null:c("ul",{"aria-label":n("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=>S("li",{"data-thread-reference-delivery":a.status,className:"flex min-w-0 items-start gap-1",children:[c("span",{className:"flex h-lh shrink-0 items-center",children:c(Qr,{"aria-hidden":"true",className:"size-3.5"})}),S("span",{className:"flex min-w-0 flex-1 flex-wrap gap-x-1",children:[c("span",{className:"max-w-max min-w-0 grow basis-24 truncate",children:n("threadReference.title",{title:a.reference.title})}),c("span",{className:"max-w-full",children:a.status==="carried"?c(fV,{carried:n("threadReference.carried",{count:a.carriedMessages}),omitted:a.omittedMessages>0?n("threadReference.omitted",{count:a.omittedMessages}):null}):a.status==="missing"?n("threadReference.missing"):n("threadReference.loading")})]})]},`${a.reference.environmentId}:${a.reference.threadId}`))})}Y();function pV(e){let t=e.match(/:(\d+)$/);if(!t?.[1])return{path:e,line:void 0,column:void 0};let n=e.slice(0,-t[0].length),o=n.match(/:(\d+)$/);return o?.[1]?{path:n.slice(0,-o[0].length),line:o[1],column:t[1]}:{path:n,line:t[1],column:void 0}}function Vv(e){return e.replaceAll("\\","/")}function qv(e){return/^\/[A-Za-z]:\//.test(e)?e.slice(1):e}function mV(e){return qv(Vv(e.replace(/[\\/]+$/,"")))}function gV(e){return e.slice(e.lastIndexOf("/")+1)}function hV(e){return e.startsWith("/")||/^[A-Za-z]:\//.test(e)}function vV(e){return e.startsWith("\\\\")||/^[A-Za-z]:([/\\]|$)/.test(qv(Vv(e)))}function Rp(e,t){let{path:n,line:o,column:r}=pV(e),a=qv(Vv(n)),s=a;if(t){let i=mV(t),l=gV(i),d=vV(t)?p=>p.toLowerCase():p=>p,u=d(a),f=d(i);if(u===f)s=l;else if(u.startsWith(`${f}/`))s=`${l}/${a.slice(i.length+1)}`;else if(!hV(a)){let p=a.replace(/^\.\/+/,"").replace(/^\/+/,"");s=u.startsWith(`${d(l)}/`)?a:`${l}/${p}`}}return o?`${s}:${o}${r?`:${r}`:""}`:s}var yV=/<review_comment\b([^>]*)>\s*([\s\S]*?)<\/review_comment>/g,CV=/([a-zA-Z][a-zA-Z0-9_-]*)="([^"]*)"/g,xV=/(`{3,})([^\s`]*)[^\n]*\n([\s\S]*?)\n\1/g;function bV(e){return e.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/&/g,"&")}function wV(e){let t={};for(let n of e.matchAll(CV))t[n[1]]=bV(n[2]??"");return t}function O0(e){return e===void 0||!/^\d+$/.test(e)?null:Number(e)}function SV(e){let n=Array.from(e.matchAll(xV)).at(-1),o=n?.index;return{text:e.slice(0,o??e.length).trim(),language:n?.[2]?.trim()||"diff",contents:n?.[3]??""}}function IV(e,t,n){let o=wV(e),r=O0(o.startIndex),a=O0(o.endIndex),s=o.filePath?.trim(),i=o.sectionId?.trim();if(!s||!i||r===null||a===null)return null;let l=SV(t);return{id:`review-comment:${n}:${i}:${s}:${r}:${a}`,sectionId:i,sectionTitle:o.sectionTitle?.trim()||null,filePath:s,startIndex:Math.min(r,a),endIndex:Math.max(r,a),rangeLabel:o.rangeLabel?.trim()||null,text:l.text,diff:l.contents,fenceLanguage:l.language}}function Ap(e){let t=[],n=0,o=0;for(let a of e.matchAll(yV)){let s=a.index??0,i=e.slice(n,s);i.length>0&&t.push({kind:"text",id:`review-comment-text:${n}`,text:i});let l=IV(a[1]??"",a[2]??"",o);l?(t.push({kind:"review-comment",comment:l}),o+=1):t.push({kind:"text",id:`review-comment-invalid:${s}`,text:a[0]}),n=s+a[0].length}let r=e.slice(n);return r.length>0&&t.push({kind:"text",id:`review-comment-text:${n}`,text:r}),t}function F0(e,t){let n=Math.max(0,...Array.from(t.matchAll(/`+/g),r=>r[0].length)),o="`".repeat(Math.max(3,n+1));return[`${o}${e}`,t.trimEnd(),o].join(`
|
|
4118
|
+
`;function UT(e){let[t,n]=W(""),[o,r]=W("all"),[a]=W(()=>cp(e.memoryScope)),s=M(a.camera!==null&&a.focusThreadId===e.focusThreadId),[i,l]=W(s.current?a.selectedId:null),[d,u]=W(s.current&&a.camera!==null?a.camera:{x:24,y:24,scale:1}),[f,p]=W({}),[m,h]=W(a.draft);U(()=>{Rv(e.memoryScope,{focusThreadId:e.focusThreadId,camera:d,selectedId:i,draft:m})},[e.memoryScope,e.focusThreadId,d,i,m]),U(()=>()=>Av(e.memoryScope),[e.memoryScope]);let[g,v]=W(null),C=M(null),y=K(()=>e.board===null?null:IT(e.board,e.fuller),[e.board,e.fuller]),x=K(()=>{let w=new Map;if(y===null)return w;for(let L of y.threads)w.set(L.threadId,L);return w},[y]),b=K(()=>{if(y===null)return{cards:[],childCounts:new Map,descendantCounts:new Map};let w=Cv(yv(y.threads),y.anchors);return mT(w,e.collapsed)},[y,e.collapsed]),I=b.cards.filter(w=>{let L=x.get(w.threadId);return L===void 0||o!=="all"&&L.projectId!==o?!1:t.trim().length===0?!0:`${L.title} ${w.question} ${w.answer}`.toLowerCase().includes(t.trim().toLowerCase())}),T=b.cards.find(w=>w.id===i)??I.find(w=>w.threadId===e.focusThreadId)??null,P=o==="all"?e.t("map.projectAll"):y?.projects.find(w=>w.projectId===o)?.title??e.t("map.projectAll"),k=e.focusThreadId!==null&&x.has(e.focusThreadId);return U(()=>{if(!k||e.focusThreadId===null||y===null)return;let w=Cv(yv(y.threads),y.anchors),L=k3(w,e.focusThreadId,e.collapsed);if(L.length===e.collapsed.size&&L.every(A=>e.collapsed.has(A))||e.onCollapsed(L),s.current){s.current=!1;return}let N=w.findLast(A=>A.threadId===e.focusThreadId);N!==void 0&&l(N.id)},[e.focusThreadId,e.locateToken,k]),S("section",{ref:C,className:"ycodium-session-map","data-pane":e.fill==="pane"?"":void 0,"data-page":e.fill==="page"?"":void 0,children:[c("style",{children:up}),S("header",{className:"session-map-bar",children:[S("div",{className:"session-map-title",children:[c("strong",{children:y?.workspaceTitle||e.t("map.title")}),c("span",{children:e.pending&&y===null?e.t("map.loading"):e.t("map.sessions",{count:y?.threads.length??0})})]}),S("div",{className:"session-map-actions",children:[e.viewSwitch,S("div",{className:"session-map-zoom",children:[c(ee,{type:"button",size:"icon-xs",variant:"outline","aria-label":e.t("map.zoomOut"),onClick:()=>u(BT(d,1/1.15)),children:c(Rs,{})}),c("span",{children:e.t("map.zoom",{percent:Math.round(d.scale*100)})}),c(ee,{type:"button",size:"icon-xs",variant:"outline","aria-label":e.t("map.zoomIn"),onClick:()=>u(BT(d,1.15)),children:c(Qd,{})}),c(ee,{type:"button",size:"xs",variant:"outline",onClick:()=>{let L=C.current?.querySelector(".session-map-stage")?.getBoundingClientRect(),R=y===null?[]:I.map(N=>wc(N,y.positions,f));u(vT(R,L?.width??800,L?.height??600)),p({})},children:e.t("map.fit")})]}),c(ee,{type:"button",size:"xs",variant:"outline",onClick:e.onLocate,children:e.t("map.locate")}),c(ee,{type:"button",size:"xs",variant:"ghost",onClick:()=>{p({}),e.onTidy()},children:e.t("map.tidy")}),e.viewSwitch!=null||e.onClose===null?null:c(ee,{type:"button",size:"xs",variant:"ghost",onClick:e.onClose,children:e.t("map.close")})]})]}),g===null?null:S("div",{className:"session-map-undo",children:[c("span",{children:e.t("map.hiddenNotice",{title:g.title})}),c(ee,{type:"button",size:"xs",variant:"outline",onClick:()=>{e.onRestore(g.threadId),v(null)},children:e.t("map.undo")})]}),y===null?null:S("div",{className:"session-map-body",children:[S("aside",{className:"session-map-side",children:[c(iS,{className:"session-map-search",value:t,size:"sm",variant:"ghost","aria-label":e.t("map.search"),placeholder:e.t("map.search"),onValueChange:n}),S("div",{className:"session-map-actions",style:{marginTop:8},children:[c(ee,{type:"button",size:"xs",onClick:()=>h({kind:"new"}),children:e.t("map.new")}),S(Yr,{value:o,onValueChange:w=>r(w??"all"),children:[c(Bs,{size:"xs","aria-label":e.t("map.projectAll"),children:c(Zr,{children:P})}),S(Jr,{children:[c(rr,{value:"all",children:e.t("map.projectAll")}),y.projects.map(w=>c(rr,{value:w.projectId,children:w.title||w.workspaceRoot},w.projectId))]})]})]}),y.threads.length===0?c(Fs,{title:e.t("map.empty")}):null,c(I3,{t:e.t,board:y,focusThreadId:e.focusThreadId,onOpen:w=>{let L=b.cards.findLast(R=>R.threadId===w);L!==void 0&&l(L.id),e.onOpenThread(w)}})]}),c(AT,{t:e.t,board:y,cards:I,childCounts:b.childCounts,descendantCounts:b.descendantCounts,collapsed:e.collapsed,focusThreadId:e.focusThreadId,selectedId:T?.id??null,optimistic:f,camera:d,resumeCamera:a.camera!==null&&a.focusThreadId===e.focusThreadId,locateToken:e.locateToken,onCamera:u,onSelect:w=>l(w.id),onMove:e.onMove,onOptimistic:(w,L,R)=>p(N=>({...N,[w]:{x:L,y:R}})),onToggleCollapse:w=>{let L=new Set(e.collapsed);L.has(w)?L.delete(w):L.add(w),e.onCollapsed([...L])},onContinue:w=>{l(w.id),h({kind:"continue",threadId:w.threadId})},onBranch:w=>{l(w.id),h({kind:"branch",threadId:w.threadId,messageId:w.messageId})},onHide:w=>{let L=x.get(w)?.title??e.t("settings.hiddenUntitled");v({threadId:w,title:L}),e.onHide(w)},onOpen:e.onOpenThread}),c(FT,{t:e.t,board:y,cards:b.cards,selected:T,detail:e.detail,detailThreadId:e.detailThreadId,phrases:e.phrases,draft:m,savedText:w=>{let L=cp(e.memoryScope);return L.textTarget===w?L.text:""},onText:(w,L)=>Rv(e.memoryScope,{textTarget:w,text:L}),onDraft:h,onPhrases:e.onPhrases,onAnchor:e.onAnchor,onLoadDetail:e.onLoadDetail,onOpen:e.onOpenThread,formatTime:e.formatTime,onSend:e.onSend})]})]})}function I3(e){let t=M(null),n=K(()=>T3(e.board,e.t),[e.board,e.t]),o=n.findIndex(r=>r.kind==="thread"&&r.thread.threadId===e.focusThreadId);return U(()=>{o<0||t.current?.scrollIndexIntoView({index:o,animated:!1})},[e.focusThreadId,o]),c("div",{className:"session-map-sessions",children:c(op,{ref:t,data:n,estimatedItemSize:36,keyExtractor:r=>r.key,extraData:e.focusThreadId,style:{height:"100%"},renderItem:({item:r})=>r.kind==="header"?c("div",{className:"session-map-project",children:r.title}):c(lS,{className:"session-map-session",label:r.thread.title||e.t("card.empty"),pressed:r.thread.threadId===e.focusThreadId,trailing:r.thread.running?c("span",{className:"session-map-running",children:e.t("map.running")}):void 0,onClick:()=>e.onOpen(r.thread.threadId)})})})}function T3(e,t){let n=new Map;for(let s of e.threads){let i=n.get(s.projectId)??[];i.push(s),n.set(s.projectId,i)}let o=new Set(e.projects.map(s=>s.projectId)),r=[];for(let s of e.projects){let i=n.get(s.projectId)??[];if(i.length!==0){r.push({kind:"header",key:`project:${s.projectId}`,title:s.title||s.workspaceRoot});for(let l of i)r.push({kind:"thread",key:l.threadId,thread:l})}}let a=e.threads.filter(s=>!o.has(s.projectId));if(a.length>0){r.push({kind:"header",key:"project:none",title:t("map.ungrouped")});for(let s of a)r.push({kind:"thread",key:s.threadId,thread:s})}return r}function BT(e,t){let n=Math.min(4,Math.max(.25,e.scale*t));return{...e,scale:n}}function k3(e,t,n){return[...gT(e,t,n)]}var Ev="ycodium-session-map:phrases",Mv="ycodium-session-map:collapsed",HT="ycodium-session-map:phrases",KT="ycodium-session-map:collapsed";function $T(e,t,n){let o=r=>{r.key===e&&n()};return window.addEventListener("storage",o),window.addEventListener(t,n),()=>{window.removeEventListener("storage",o),window.removeEventListener(t,n)}}var Xs=[];function VT(){return XT(Ev)}function qT(e){YT(Ev,JSON.stringify(e)),window.dispatchEvent(new Event(HT))}function WT(e){return $T(Ev,HT,e)}function jT(){return XT(Mv)}function GT(e){YT(Mv,JSON.stringify(e)),window.dispatchEvent(new Event(KT))}function QT(e){return $T(Mv,KT,e)}var zT=new Map;function XT(e){let t=L3(e),n=zT.get(e);if(n!==void 0&&n.raw===t)return n.value;let o=P3(t);return zT.set(e,{raw:t,value:o}),o}function P3(e){if(e===null)return Xs;try{let t=JSON.parse(e);if(!Array.isArray(t))return Xs;let n=t.filter(o=>typeof o=="string");return n.length===0?Xs:n}catch{return Xs}}function L3(e){try{return localStorage.getItem(e)}catch{return null}}function YT(e,t){try{localStorage.setItem(e,t)}catch{}}Y();function fp(e){let[t,n]=W(()=>({data:e,board:wv(null,e)}));return t.data!==e&&n({data:e,board:wv(t.board,e)}),t.board}function pp(e){let t=Bn(WT,VT,()=>Xs),n=Bn(QT,jT,()=>Xs),o=K(()=>new Set(n),[n]),[r,a]=W(null),s=M(0),[i,l]=W(0),d=e.environmentId,u=e.threadId,f=d===null?{}:{environmentId:d},p=e.bridge.commands.useSubscription("live",{},f),m=e.bridge.commands.useSubscription("ycodium.sessionProjection",{name:"card",threadId:u!==null&&u.length>0?u:"_"},f),h=e.bridge.i18n.usePluginTranslation(),g=e.bridge.useFormatTimestamp(),v=fp(p.data);U(()=>{u===null||u.length===0||e.bridge.commands.invoke("focus",{threadId:u},f)},[u,d,e.bridge]);let C=u===null?null:TT(m.data);return c(UT,{t:h,board:v,pending:p.isPending,focusThreadId:u,fuller:C,detail:r?.view??null,detailThreadId:r?.threadId??null,phrases:Sc(t),collapsed:o,fill:e.fill,locateToken:e.locateToken+i,memoryScope:d??"",viewSwitch:e.viewSwitch??null,formatTime:g,onClose:e.onClose,onOpenThread:y=>{d!==null&&e.bridge.openThread({environmentId:d,threadId:y})},onLocate:()=>l(y=>y+1),onPhrases:qT,onCollapsed:GT,onMove:(y,x,b)=>{e.bridge.commands.invoke("move",{cardId:y,x,y:b},f)},onTidy:()=>{e.bridge.commands.invoke("tidy",{},f)},onHide:y=>{e.bridge.commands.invoke("hide",{threadId:y},f)},onRestore:y=>{e.bridge.commands.invoke("restore",{threadId:y},f)},onAnchor:(y,x)=>{e.bridge.commands.invoke("preferences",{patch:{anchor:{threadId:y,cardId:x}}},f)},onLoadDetail:y=>{let x=s.current+1;s.current=x,e.bridge.commands.invoke("detail",{threadId:y},f).then(b=>{s.current===x&&a({threadId:y,view:kT(b)})})},onSend:async(y,x,b)=>{let I=PT(await R3(e.bridge,y,x,b,f));return I.ok&&I.walkedBack?e.bridge.notify(h("card.walkedBack"),"info"):I.ok&&e.bridge.notify(h("draft.sent"),"success"),I}})}async function R3(e,t,n,o,r){switch(t.kind){case"continue":return e.commands.invoke("send",{threadId:t.threadId,text:n},r);case"branch":return e.commands.invoke("fork",{threadId:t.threadId,messageId:t.messageId,text:n},r);case"new":return e.commands.invoke("create",{projectId:o,text:n},r);default:return t}}Y();function sn(){return{t:Un().i18n.usePluginTranslation()}}function JT(e){if(e.cacheDisjoint!==!0)return null;let t=e.cachedInputTokens,n=e.inputTokens;if(t===void 0||n===void 0)return null;let o=t+n;if(o<=0)return null;if(t>=o)return"100%";let r=t/o*100;for(let a=0;a<=3;a+=1){let s=r.toFixed(a);if(Number.parseFloat(s)<100)return`${s}%`}return"99.9%"}function ZT(e){let t,n,o,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&&(n=(n??0)+s.inputTokens),s.cachedInputTokens!==void 0&&(o=(o??0)+s.cachedInputTokens));if(!(t===void 0&&n===void 0&&o===void 0))return{...a&&r?{cacheDisjoint:!0}:{},...t!==void 0?{outputTokens:t}:{},...n!==void 0?{inputTokens:n}:{},...o!==void 0?{cachedInputTokens:o}:{}}}function Ic(e){return e<1e3?String(Math.round(e)):e<1e6?`${(e/1e3).toFixed(1).replace(/\.0$/,"")}k`:`${(e/1e6).toFixed(1).replace(/\.0$/,"")}m`}var A3=ce(function({item:t,ordinal:n,usage:o,onSelect:r}){return S("button",{type:"button","data-turn-navigator-row":t.sectionKey,onClick:()=>r(t),className:"flex w-full cursor-pointer items-start gap-2.5 rounded-md px-2 py-1.5 text-left transition-colors hover:bg-accent",children:[c("span",{className:"shrink-0 pt-px font-mono text-[10px] text-muted-foreground tabular-nums",children:n}),S("span",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[c("span",{className:"line-clamp-2 min-w-0 font-medium text-chat leading-snug",children:t.userText}),t.assistantText?S("span",{className:"flex items-baseline gap-2",children:[c("span",{className:"line-clamp-1 min-w-0 flex-1 text-[11px] text-muted-foreground leading-snug",children:t.assistantText}),o?.outputTokens!==void 0?c("span",{className:"shrink-0 font-mono text-[9px] text-muted-foreground tabular-nums",children:Ic(o.outputTokens)}):null]}):null]})]})});function E3({totals:e}){let{t}=sn();if(!e)return null;let n=JT(e),o=[e.outputTokens===void 0?null:{label:t("turnNavigator.usageOutput"),value:Ic(e.outputTokens)},e.inputTokens===void 0?null:{label:t("turnNavigator.usageInput"),value:Ic(e.inputTokens)},e.cachedInputTokens===void 0?null:{label:t("turnNavigator.usageCacheRead"),value:n===null?Ic(e.cachedInputTokens):`${Ic(e.cachedInputTokens)} (${n})`}].filter(r=>r!==null);return o.length===0?null:S("div",{className:"flex items-baseline gap-2 border-t px-2 py-1.5",children:[c("span",{className:"flex-1 font-mono text-[10px] text-muted-foreground uppercase tracking-[0.14em]",children:t("turnNavigator.usage")}),o.map(r=>S("span",{className:"shrink-0 font-mono text-[10px] text-muted-foreground tabular-nums",children:[r.label," ",r.value]},r.label))]})}var M3=ce(function({getText:t,size:n="xs",variant:o="outline",className:r}){let{t:a}=sn(),s=Un().writeClipboard,[i,l]=W(!1),d=a("turnNavigator.copyMarkdown");return S(ze,{children:[c(Ke,{render:c(ee,{"aria-label":d,disabled:i,onClick:()=>{s(t()).then(()=>{l(!0),window.setTimeout(()=>l(!1),1e3)})},type:"button",size:n,variant:o,className:j("text-muted-foreground hover:text-foreground",r)}),children:i?c(Qn,{className:"size-3 text-primary"}):c(Ts,{className:"size-3"})}),c(He,{children:c("p",{children:d})})]})});function e0({items:e,totalTurnCount:t,bottomInset:n,usageByTurnId:o,onSelect:r,exportMarkdown:a,onDownload:s,placement:i="float"}){let{t:l}=sn(),[d,u]=W(!1),f=K(()=>e.map((g,v)=>({item:g,ordinal:v+1})).reverse(),[e]),p=K(()=>ZT(f.map(({item:g})=>g.turnId===null?void 0:o.get(g.turnId))),[f,o]);if(e.length===0)return null;let m=t??e.length,h=l("turnNavigator.open",{count:m});return S(Ho,{onOpenChange:u,open:d,children:[S(Ar,{render:c(ee,{"aria-label":h,className:j("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:n+12}:void 0,title:h,variant:"glass"}),children:[c(Kd,{"aria-hidden":!0}),c("span",{className:"font-mono font-semibold text-[11px] tabular-nums",children:m})]}),c(Ko,{align:"end",className:"w-80 flex-col",side:"top",children:S("div",{className:"flex max-h-[min(60vh,26rem)] flex-col",children:[S("div",{className:"flex items-center gap-1.5 border-b px-2 py-1.5",children:[c("span",{className:"flex-1 font-mono text-[10px] text-muted-foreground uppercase tracking-[0.14em]",children:l("turnNavigator.title")}),c("span",{className:"font-mono text-[10px] text-muted-foreground tabular-nums",children:m})]}),c("div",{className:j("min-h-0 flex-1 overflow-y-auto overflow-x-hidden p-1"),children:f.map(({item:g,ordinal:v})=>c(A3,{item:g,onSelect:C=>{u(!1),r(C)},ordinal:v,usage:g.turnId===null?void 0:o.get(g.turnId)},g.sectionKey))}),c(E3,{totals:p}),S("div",{className:"flex items-center gap-1 border-t px-2 py-1.5",children:[c("span",{className:"flex-1 font-mono text-[10px] text-muted-foreground uppercase tracking-[0.14em]",children:l("turnNavigator.export")}),c(M3,{size:"icon-xs",getText:a,variant:"ghost"}),c(ee,{"aria-label":l("turnNavigator.downloadMarkdown"),onClick:()=>s("md"),size:"xs",title:l("turnNavigator.downloadMarkdown"),variant:"ghost",children:c("span",{className:"font-mono text-[10px]",children:".md"})}),c(ee,{"aria-label":l("turnNavigator.downloadJson"),onClick:()=>s("json"),size:"xs",title:l("turnNavigator.downloadJson"),variant:"ghost",children:c("span",{className:"font-mono text-[10px]",children:".json"})})]})]})})]})}Y();function Tc(e){return e.replace(/\s+/g," ")}function N3(e,t){let n=e.slice(Math.max(0,e.length-t));return/^[\uDC00-\uDFFF]/.test(n)&&(n=n.slice(1)),n}function _3(e,t){let n=e.slice(0,t);return/[\uD800-\uDBFF]$/.test(n)&&(n=n.slice(0,-1)),n}function mp(e){let n=(e instanceof Element?e:e?.parentElement??null)?.closest("[data-assistant-quote-body]")??null;return n?.closest('[data-message-role="assistant"]')?n:null}function t0(e){if(!e||e.isCollapsed||e.rangeCount===0)return null;let t=e.getRangeAt(0),n=mp(t.startContainer);if(n===null||mp(t.endContainer)!==n)return null;let o=n.closest("[data-message-id]")?.dataset.messageId;if(!o)return null;let r=e.toString().trim();if(r.length===0)return null;let a=document.createRange();a.selectNodeContents(n),a.setEnd(t.startContainer,t.startOffset);let s=document.createRange();s.selectNodeContents(n),s.setStart(t.endContainer,t.endOffset);let i=Tc(t.toString()),l=i.length>i.trimStart().length?" ":"",d=i.length>i.trimEnd().length?" ":"",u=Tc(a.toString()+l),f=Tc(d+s.toString()),p=u.length,m=p+i.trim().length,h=t.getClientRects(),g=h[0]??t.getBoundingClientRect(),v=h[h.length-1]??g;return{messageId:o,text:r,start:p,end:m,prefix:N3(u,32),suffix:_3(f,32),anchor:{x:v.right,top:g.top,bottom:v.bottom}}}var gp="assistant-quote-inserter",hp="assistant-quote-open-comment";Y();var o0=100,D3=new Map,n0=new Map,vp=e=>typeof e=="function"?e():e,r0=(e,t)=>typeof t=="function"?t(e):t;function O3(e,t,n){let o=e.get(t);return o===void 0&&(o={values:new Map,limit:Math.max(1,n)},e.set(t,o)),o}function F3(e,t){let n=n0.get(e);return n===void 0&&(n={values:new Map,limit:Math.max(1,t)},n0.set(e,n)),n}function B3(e,t){if(!(e.values.size<=e.limit)){for(let[n,o]of e.values){if(e.values.size<=e.limit)return;o===t||o.committed||o.leases>0||(e.values.delete(n),o.alive=!1,o.subscribers.clear())}for(let[n,o]of e.values){if(e.values.size<=e.limit)return;o===t||o.leases>0||(e.values.delete(n),o.alive=!1,o.subscribers.clear())}}}function Nv(e,t,n){e.values.get(t)===n&&(e.values.delete(t),e.values.set(t,n))}function a0(e,t,n){let o=e.values.get(t);return o===void 0&&(o={value:vp(n),subscribers:new Set,leases:0,alive:!0,committed:!1},e.values.set(t,o)),o}function kc(e){queueMicrotask(()=>B3(e))}function Pt(e,t,n,o=o0){let r=Math.max(1,o),a=O3(D3,e,r),s=a0(a,t,n),i=E(f=>s.alive?(a.limit=r,s.committed=!0,Nv(a,t,s),s.leases+=1,s.subscribers.add(f),kc(a),()=>{s.subscribers.delete(f),s.leases=Math.max(0,s.leases-1),kc(a)}):()=>{},[r,s,a,t]),l=E(()=>s.value,[s]),d=Bn(i,l,l),u=E(f=>{if(!s.alive||a.values.get(t)!==s)return;let p=s.value,m=r0(p,f);if(!Object.is(m,p)){s.value=m,Nv(a,t,s);for(let h of s.subscribers)h();kc(a)}},[s,a,t]);return[d,u]}function s0(e,t){let n=M(null);(n.current===null||n.current.key!==e)&&(n.current={key:e,value:vp(t)});let[,o]=Wr(a=>a+1,0),r=E(a=>{let s=n.current;if(s===null||s.key!==e)return;let i=r0(s.value,a);Object.is(i,s.value)||(s.value=i,o())},[e]);return[n.current.value,r]}function ot(e,t,n,o=o0){let r=Math.max(1,o),a=F3(e,r),s=a0(a,t,()=>({current:vp(n)}));return U(()=>{if(!(!s.alive||a.values.get(t)!==s))return a.limit=r,s.committed=!0,Nv(a,t,s),s.leases+=1,kc(a),()=>{s.leases=Math.max(0,s.leases-1),kc(a)}},[r,s,a,t]),s.value}function Ao(e,t){let n=M(null);return(n.current===null||n.current.key!==e)&&(n.current={key:e,ref:{current:vp(t)}}),n.current.ref}var U3=300;function i0(e){let{data:t,target:n,threadKey:o,surfaceRef:r}=e,{t:a}=ie(),s=ot(gp,o,null),[,i]=Pt(hp,o,null),[l,d]=W(null),u=M(null);if(U(()=>{let g,v=()=>{let T=r.current,P=document.getSelection(),k=P&&P.rangeCount>0?P.getRangeAt(0):null;if(!T||!k||!T.contains(k.commonAncestorContainer)){d(null);return}let w=t0(P);if(w===null){d(null);return}let L=t.assistantQuotes.serialize({version:1,environmentId:n.environmentId,threadId:n.threadId,messageId:w.messageId,text:w.text,start:w.start,end:w.end,prefix:w.prefix,suffix:w.suffix});d({source:L,...w.anchor})},C=T=>{u.current?.contains(T.target)||(clearTimeout(g),g=setTimeout(v,U3))},y=T=>{u.current?.contains(T.target)||(clearTimeout(g),d(null))},x=()=>d(null),b=T=>{T.key==="Escape"&&d(null)},I=()=>{(document.getSelection()?.isCollapsed??!0)&&d(null)};return document.addEventListener("pointerup",C,!0),document.addEventListener("keyup",C,!0),document.addEventListener("pointerdown",y,!0),document.addEventListener("keydown",b,!0),document.addEventListener("selectionchange",I),window.addEventListener("scroll",x,!0),()=>{clearTimeout(g),document.removeEventListener("pointerup",C,!0),document.removeEventListener("keyup",C,!0),document.removeEventListener("pointerdown",y,!0),document.removeEventListener("keydown",b,!0),document.removeEventListener("selectionchange",I),window.removeEventListener("scroll",x,!0)}},[t,r,n.environmentId,n.threadId]),l===null)return null;let f=l.source,p=Math.max(8,Math.min(window.innerWidth-200,l.x-12)),m=l.bottom+6,h=m+40<=window.innerHeight?m:Math.max(8,l.top-40);return c("div",{ref:u,className:"fixed z-50",style:{left:p,top:h},"data-assistant-quote-toolbar":"",children:S(ee,{size:"sm",variant:"outline",className:"shadow-md",disabled:f===null,title:f===null?a("timeline.quote.tooLong"):void 0,onMouseDown:g=>g.preventDefault(),onClick:()=>{f!==null&&s.current?.(f)===!0&&(i(f),document.getSelection()?.removeAllRanges(),d(null))},children:[c(Xr,{"aria-hidden":"true"}),a("timeline.quote.cite")]})})}Y();Y();function l0(e){let t=e.map(o=>({key:o.key,turnId:o.turnId,firstRowIndex:o.firstRowIndex,endRowIndex:o.firstRowIndex+o.rowIds.length})),n=new Map;for(let o of e)for(let[r,a]of o.rowIds.entries())n.set(a,{turnId:o.turnId,index:o.firstRowIndex+r});return{sections:t,bySectionKey:new Map(t.map(o=>[o.key,o])),byRowId:n}}function yp({index:e,visibleSectionKeys:t,protectedRowIds:n,selectionRows:o}){let r=t.flatMap(d=>{let u=e.bySectionKey.get(d)?.turnId;return u==null?[]:[u]}),a=n.flatMap(d=>{let u=e.byRowId.get(d)?.turnId;return u==null?[]:[u]}),s=o?e.byRowId.get(o.firstRowId)?.index:void 0,i=o?e.byRowId.get(o.lastRowId)?.index:void 0,l=s===void 0||i===void 0?[]:e.sections.flatMap(d=>d.turnId!==null&&d.endRowIndex>Math.min(s,i)&&d.firstRowIndex<=Math.max(s,i)?[d.turnId]:[]);return{firstTurnId:r[0]??null,lastTurnId:r.at(-1)??null,protectedTurnIds:[...new Set(a)],selectionTurnRange:l.length>0?{firstTurnId:l[0],lastTurnId:l.at(-1)}:null}}function d0(e,t,n,o){if(!o)return n;let r=e.findIndex(a=>t.has(a));return r<0?n:Math.max(n,e.length-r)}Y();Y();function _v(e,t){for(let n of e.querySelectorAll("[data-timeline-row-id]"))if(n.dataset.timelineRowId===t)return n;return null}function Ys(e,t){let n=0,o=e.length,r=-1;for(;n<o;){let a=Math.floor((n+o)/2),i=e[a].getBoundingClientRect();Math.max(i.bottom,i.top+1)>t?(r=a,o=a):n=a+1}return r}function z3(e){let t=e.getBoundingClientRect().top,n=e.querySelectorAll("[data-timeline-turn-section]"),o=a=>{let s=a.querySelectorAll("[data-timeline-row-id]"),i=Ys(s,t),l=i<0?void 0:s[i],d=l?.dataset.timelineRowId;return!l||d===void 0?null:{rowId:d,offsetPx:Math.round(t-l.getBoundingClientRect().top)}};if(n.length===0)return o(e);let r=Ys(n,t);if(r<0)return null;for(let a=r;a<n.length;a+=1){let s=o(n[a]);if(s)return s}return null}function c0(e,t){let n=0,o=e;for(;o&&o!==t;)n+=o.offsetTop,o=o.offsetParent;return n}var Dv=class extends Vr{getSnapshotBeforeUpdate(t){return t.inputKey!==this.props.inputKey&&t.onBeforeInputChange(),null}componentDidUpdate(){}componentWillUnmount(){this.props.onBeforeInputChange()}render(){return this.props.children}};function u0({inputKey:e,onBeforeInputChange:t,handleRef:n,onAttach:o,className:r,children:a,onScroll:s,onInteractionRowsChange:i}){let l=M(null),d=M({inputKey:e,store:nc()});d.current.inputKey!==e&&(d.current={inputKey:e,store:nc()});let u=M(i);u.current=i;let f=E(m=>{let h=d.current;return h.store.acquire(m,()=>{d.current===h&&u.current?.(h.store.rows())})},[]);pe(()=>{i?.(d.current.store.rows())},[e,i]),Fo(n,()=>({get node(){return l.current},measure:()=>{let m=l.current;return m?{scroll:m.scrollTop,scrollLength:m.clientHeight,contentLength:m.scrollHeight,topOf:h=>{let g=_v(m,h);return g===null?null:c0(g,m)},heightOf:h=>{let g=_v(m,h);return g===null?null:g.offsetHeight},rowAtScroll:()=>z3(m)}:null},scrollToEnd:m=>{let h=l.current;if(h){if(m?.animated){h.scrollTo({top:h.scrollHeight,behavior:"smooth"});return}h.scrollTop=h.scrollHeight-h.clientHeight}},scrollToRow:(m,h)=>{let g=l.current;if(!g)return!1;let v=_v(g,m);return v?(g.scrollTop=Math.max(0,c0(v,g)-(h?.viewOffset??0)),!0):!1},scrollToOffset:m=>{let h=l.current;h&&(h.scrollTop=Math.max(0,m))}}),[]);let p=E(m=>{l.current=m,o(m)},[o]);return c(Dv,{inputKey:e,onBeforeInputChange:t,children:c(tc,{value:f,children:c("div",{ref:p,className:r,style:{position:"relative"},onScroll:s,children:a})})})}function ll(e){if(!e)return!1;let t=e.tagName?.toLowerCase(),n=e.getAttribute?.("contenteditable");if(t==="textarea"||n==="true"||n===""||n==="plaintext-only"||"isContentEditable"in e&&e.isContentEditable===!0)return!0;if(t==="input"){let o=e.getAttribute?.("type")?.toLowerCase()??"text";if(!["button","submit","reset","image","checkbox","radio"].includes(o))return!0}return e.matches?.(":focus-visible")??!1}function il(e,t){let o=(e?.nodeType===1?e:e?.parentElement)?.closest("[data-timeline-row-id]");return o&&t.contains(o)?o.dataset.timelineRowId??null:null}function Cp(e){let t=e.ownerDocument.getSelection?.();if(!t||t.isCollapsed)return null;let n=null,o=null;for(let d=0;d<t.rangeCount;d+=1){let u=t.getRangeAt(d);u.intersectsNode(e)&&(n??=u,o=u)}if(!n||!o)return null;let r=il(n.startContainer,e),a=il(o.endContainer,e);if(r&&a)return{firstRowId:r,lastRowId:a};let s=e.querySelectorAll("[data-timeline-row-id]"),i=s[0]?.dataset.timelineRowId,l=s[s.length-1]?.dataset.timelineRowId;return i&&l?{firstRowId:r??i,lastRowId:a??l}:null}function Pc(e){let t=e.ownerDocument.getSelection?.();if(!t||t.isCollapsed)return!1;for(let n=0;n<t.rangeCount;n+=1)if(t.getRangeAt(n).intersectsNode(e))return!0;return!1}Y();function qa(e){let t=M(e);t.current=e;let n=M(!1),o=M(null),r=M(null),a=M(0),s=E(()=>{a.current+=1,r.current!==null&&cancelAnimationFrame(r.current),r.current=null},[]),i=E(()=>{if(!n.current||!t.current||r.current!==null||o.current===null)return;let u=++a.current;r.current=requestAnimationFrame(f=>{if(u!==a.current||(r.current=null,!n.current||!t.current))return;let p=o.current;o.current=null,p?.(f)})},[]),l=E(u=>{o.current=u,i()},[i]),d=E(()=>{o.current=null,s()},[s]);return pe(()=>(n.current=!0,i(),()=>{n.current=!1,s()}),[e,s,i]),K(()=>({request:l,cancel:d}),[l,d])}function f0({root:e,inputKey:t,visible:n,index:o,topInset:r,bottomInset:a,interactionRows:s,onRangeChange:i,onSelectionChange:l}){let d=M({inputKey:t,visible:n,index:o,topInset:r,bottomInset:a,interactionRows:s,onRangeChange:i,onSelectionChange:l});d.current={inputKey:t,visible:n,index:o,topInset:r,bottomInset:a,interactionRows:s,onRangeChange:i,onSelectionChange:l};let u=qa(n),f=M(null),p=E(()=>{let h=d.current;if(!e||!h.visible||e.clientHeight<=0)return;let g=e.getBoundingClientRect();if(g.height<=0)return;let v=g.top+h.topInset,C=g.bottom-h.bottomInset,y=e.querySelectorAll("[data-timeline-turn-section]"),x=Ys(y,v),b=[];if(x>=0)for(let w=x;w<y.length;w+=1){let L=y[w];if(L.getBoundingClientRect().top>=C)break;L.dataset.timelineTurnSection!==void 0&&b.push(L.dataset.timelineTurnSection)}let I=[...h.interactionRows()],T=e.ownerDocument.activeElement;if(ll(T)){let w=il(T,e);w&&I.push(w)}let P=yp({index:h.index,visibleSectionKeys:b,protectedRowIds:I,selectionRows:Cp(e)}),k=`${h.inputKey}:${JSON.stringify(P)}`;k!==f.current&&(f.current=k,h.onRangeChange?.(P))},[e]),m=E(()=>u.request(p),[u,p]);return pe(()=>{if(f.current=null,!n||!e)return;let h=t,g=!0,v=()=>{!g||d.current.inputKey!==h||!d.current.visible||(d.current.onSelectionChange(Pc(e)),m())};e.addEventListener("scroll",v,{passive:!0}),e.addEventListener("focusin",v),e.addEventListener("focusout",v),e.ownerDocument.addEventListener("selectionchange",v);let C=typeof ResizeObserver>"u"?null:new ResizeObserver(v);return C?.observe(e),e.firstElementChild&&C?.observe(e.firstElementChild),v(),()=>{g=!1,u.cancel(),C?.disconnect(),e.removeEventListener("scroll",v),e.removeEventListener("focusin",v),e.removeEventListener("focusout",v),e.ownerDocument.removeEventListener("selectionchange",v),i?.(null)}},[u,t,i,m,e,n]),pe(()=>{n&&m()},[o,m,n]),m}Y();var p0=ce(function({sectionKey:t,rowKeyPrefix:n,rowIds:o,renderRow:r,sectionRef:a}){return c("div",{className:"session-turn","data-timeline-turn-section":t,ref:a,children:o.map(s=>c("div",{className:"transcript-col min-w-0 overflow-x-clip",children:r(s)},`${n}:${s}`))})});var H3=400;function m0({root:e,minimumCount:t,keepAbovePx:n=0,canCompact:o,onCompact:r}){let a=e.ownerDocument,s=new Set,i,l=!1,d=()=>e.scrollHeight-e.clientHeight-e.scrollTop<=2,u=()=>{if(i=void 0,a.hidden||s.size>0||!o()||e.clientHeight<=0||!d()||Pc(e))return;let b=e.querySelectorAll("[data-timeline-turn-section]"),I=e.getBoundingClientRect().top-32-n,T=0,P=Math.max(0,b.length-t);for(;T<P;){let w=Math.floor((T+P)/2),L=b[w].getBoundingClientRect().bottom;if(!Number.isFinite(L))return;L<=I?T=w+1:P=w}if(T===0)return;let k=a.activeElement;if(k&&ll(k)){for(let w=0;w<T;w+=1)if(b[w].contains(k))return}r(b.length-T)},f=!1,p=()=>{if(a.hidden||s.size>0||!o()||f){clearTimeout(i),i=void 0;return}i===void 0&&(i=setTimeout(u,H3))},m=()=>{clearTimeout(i),i=void 0,p()},h=()=>{let b=d();!b||!l?m():p(),l=b},g=b=>{s.add(b.pointerId),m()},v=b=>{s.delete(b.pointerId),m()},C=()=>{f=Pc(e),m()},y=()=>{s.clear(),m()},x=["wheel","keydown","focusin","focusout"];for(let b of x)e.addEventListener(b,m,{passive:!0});return e.addEventListener("scroll",h,{passive:!0}),e.addEventListener("pointerdown",g,!0),a.addEventListener("pointerup",v,!0),a.addEventListener("pointercancel",v,!0),a.addEventListener("selectionchange",C),a.addEventListener("visibilitychange",p),a.defaultView?.addEventListener("blur",y),p(),{schedule:p,disconnect:()=>{clearTimeout(i);for(let b of x)e.removeEventListener(b,m);e.removeEventListener("scroll",h),e.removeEventListener("pointerdown",g,!0),a.removeEventListener("pointerup",v,!0),a.removeEventListener("pointercancel",v,!0),a.removeEventListener("selectionchange",C),a.removeEventListener("visibilitychange",p),a.defaultView?.removeEventListener("blur",y)}}}Y();function g0({root:e,topInsetPx:t,onActiveSectionChange:n,active:o}){let r=M(o);r.current=o;let a=qa(o),s=M(new Map),i=M(null),l=M(null),d=M(n);d.current=n;let u=E(()=>{if(!r.current||!e)return;let g=e.scrollTop+t,v=null,C=Number.NEGATIVE_INFINITY,y=null,x=Number.POSITIVE_INFINITY;for(let[I,T]of s.current){if(!T.isConnected)continue;let P=T.offsetTop;P<x&&(x=P,y=I),P<=g&&P>=C&&(C=P,v=I)}let b=v??y;b!==l.current&&(l.current=b,d.current(b))},[e,t]),f=E(()=>{r.current&&a.request(u)},[a,u]);U(()=>{if(!o||!e||typeof IntersectionObserver>"u")return;let g=!0,v=new IntersectionObserver(()=>{!g||!r.current||f()},{root:e,rootMargin:`-${t}px 0px 0px 0px`,threshold:0});i.current=v;for(let C of s.current.values())v.observe(C);return f(),()=>{g=!1,v.disconnect(),i.current=null,a.cancel()}},[o,a,f,e,t]);let p=M(new Map),m=E(g=>{let v=p.current.get(g);if(v)return v;let C=y=>{let x=s.current.get(g);x&&x!==y&&(i.current?.unobserve(x),s.current.delete(g)),y?(s.current.set(g,y),i.current?.observe(y)):p.current.get(g)===C&&p.current.delete(g)};return p.current.set(g,C),C},[]),h=E(()=>{r.current&&(l.current=null,f())},[f]);return K(()=>({observeSection:m,refresh:h}),[m,h])}Y();function h0(e){return Bn(e.subscribe,e.getStructure,e.getStructure)}function v0(e,t){let n=E(r=>e.subscribeRow(t,r),[e,t]),o=E(()=>e.getRow(t),[e,t]);return Bn(n,o,o)}function In(e,t,n=Object.is){let o=M(null),r=E(()=>{let a=e.getVersion(),s=o.current;if(s!==null&&s.store===e&&s.select===t&&s.version===a)return s.value;let i=t(e),l=s!==null&&s.store===e&&n(s.value,i)?s.value:i;return o.current={store:e,select:t,version:a,value:l},l},[e,t,n]);return Bn(e.subscribe,r,r)}Y();Y();function K3(e,t){let n={hour:"numeric",minute:"2-digit",...t?{second:"2-digit"}:{}};return e==="locale"?n:{...n,hour12:e==="12-hour"}}function $3(e){let t=e?.trim();if(t)try{return Intl.DateTimeFormat.supportedLocalesOf([t]),t}catch{return}}function V3(){return typeof window>"u"?null:window.desktopBridge?.getSystemLocale?.()??null}var Ov=$3(V3()),y0=new Map;function C0(e,t){let n=`${e}:${t?"seconds":"minutes"}`,o=y0.get(n);if(o)return o;let r=new Intl.DateTimeFormat(Ov,K3(e,t));return y0.set(n,r),r}function Fv(e){let t=new Date(e);return Number.isNaN(t.getTime())?null:t}var q3=new Intl.DateTimeFormat(void 0,{month:"long"});function W3(e){let t=e%100;if(t>=11&&t<=13)return"th";switch(e%10){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}}function j3(e,t){let n=Fv(e);return n?C0(t,!1).format(n):""}function Mr(e,t){let n=Fv(e);if(!n)return"";let o=j3(e,t),r=n.getDate(),a=q3.format(n),s=n.getFullYear();return`${o}, ${r}${W3(r)} ${a} ${s}`}var G3=new Intl.DateTimeFormat(Ov,{month:"numeric",day:"numeric"}),Q3=new Intl.DateTimeFormat(Ov,{month:"numeric",day:"numeric",year:"numeric"});function ia(e,t,n,o=Date.now()){let r=Fv(e);if(!r)return"";let a=C0(t,!1).format(r),s=new Date(o),i=new Date(s.getFullYear(),s.getMonth(),s.getDate()).getTime(),l=new Date(r.getFullYear(),r.getMonth(),r.getDate()).getTime(),d=Math.round((i-l)/864e5);return d<=0?a:d===1?n("relativeTime.yesterdayAt",{time:a}):`${(r.getFullYear()===s.getFullYear()?G3:Q3).format(r)} ${a}`}Y();var It=ct(null),xp=ct(null);Y();var dl=new Map,x0=24,X3=4e3,Y3=1024,b0=16384;function Bv(e){let t=dl.get(e);if(t)return t;let n={values:new Map,listeners:new Set,stringLength:0};if(dl.set(e,n),dl.size>x0){for(let[o,r]of dl)if(r.listeners.size===0&&o!==e&&(dl.delete(o),dl.size<=x0))break}return n}function Uv(e,t,n){return Bv(e).values.get(t)??n}function Lc(e,t,n,o=!0){let r=Bv(e);if(typeof n=="string"&&(n=n.slice(0,Y3)),r.values.get(t)===n)return;let a=r.values.get(t);if(typeof a=="string"&&(r.stringLength-=a.length),r.values.delete(t),r.values.set(t,n),typeof n=="string"&&(r.stringLength+=n.length),r.stringLength>b0){for(let[s,i]of r.values)if(!(typeof i!="string"||s===t)&&(r.values.delete(s),r.stringLength-=i.length,r.stringLength<=b0))break}if(r.values.size>X3){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)}}o&&r.listeners.forEach(s=>s())}function go(e,t,n){let o=E(i=>{let l=Bv(e);return l.listeners.add(i),()=>l.listeners.delete(i)},[e]),r=E(()=>Uv(e,t,n),[e,t,n]),a=Bn(o,r,r),s=E(i=>Lc(e,t,i),[e,t]);return[a,s]}function We(){let e=Un().i18n.usePluginTranslation();return{t:(t,n)=>e(t,n)}}var w0=window.__ycodiumPluginHost.modules?.["@ycodium-ai/plugin-api"];if(!w0)throw new Error("This plugin needs a newer Ycodium app. Update the app.");var{COMMUNICATION_RECORDS_READ_LIMIT:sae,MAX_PLUGIN_SESSION_PROJECTION_BYTES:iae,MAX_PLUGIN_SKILL_COMPANION_FILE_BYTES:lae,MAX_PLUGIN_SKILL_COMPANION_TOTAL_BYTES:dae,MAX_PLUGIN_STREAM_BUFFER:cae,MAX_PLUGIN_TOOL_PRESENTATION_BYTES:uae,MAX_PLUGIN_WORKSPACE_WRITE_BYTES:fae,MIN_PLUGIN_INTERVAL_MS:pae,PLUGIN_API_MIN_VERSION:mae,PLUGIN_API_VERSION:gae,PLUGIN_PROXY_DIRECT:hae,PLUGIN_SESSION_PROJECTION_COMMAND:vae,REASONING_OPTION_LABEL:yae,REQUEST_RESOLVED_TRIGGER_KIND:Cae,TURN_PROGRESS_TRIGGER_KIND:xae,USER_INPUT_PENDING_TRIGGER_KIND:bae,acceptPluginToolPresentation:wae,definePlugin:Sae,effortText:S0,knownEffortLevel:Iae,mergeLaunchEnv:Tae,modelOptionLabelKind:I0,modelSelectionStringOption:kae,parseRetryAfterMs:Pae,pluginJsonByteLength:Lae,projectOrNull:Rae,readRequestResolved:Aae,readTurnProgress:Eae,readUserInputPending:Mae,reasoningEffortLevel:Nae,reasoningEffortShortLabel:_ae,relabelModelOptionDescriptors:T0}=w0;function bp(e,t,n){if(e!=="opencode"||t.length===0)return!1;let o=n?.trim();return o?!t.some(r=>r.slug===o):!1}function wp(e,t){if(e)return t?e:e.filter(n=>n.id!=="agent"||n.value!=="plan")}var k0={effort:"traits.savedOption.effort",reasoningEffort:"traits.savedOption.reasoningEffort",variant:"traits.savedOption.variant"},P0=e=>`traits.optionValue.${e}`;function J3(e){let t=e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").toLowerCase();return t.charAt(0).toUpperCase()+t.slice(1)}function L0(e,t){if(t==="agent")return e("traits.savedOption.agent");let n=I0(t);return n===void 0?J3(t):e(k0[n])}function zv(e,t){return T0(t,{kind:n=>e(k0[n]),level:n=>e(P0(n))})}function Hv(e,t){return S0(t,n=>e(P0(n)))}function R0(e,t){return(e??[]).map(n=>typeof n.value=="boolean"?{id:n.id,label:t(n.id),type:"boolean",currentValue:n.value}:{id:n.id,label:t(n.id),type:"select",options:[{id:n.value,label:n.value}],currentValue:n.value})}function A0(e){return e==="failed"?"failed":e==="running"?"running":"idle"}function E0(e){return e.includes("failed")?"failed":e.includes("running")?"running":"idle"}var Sp="chat-process-row flex w-full min-w-0 select-none items-center gap-1.5 px-2 text-left";function Rc({children:e}){return c("span",{"aria-hidden":!0,className:"flex size-4 shrink-0 items-center justify-center",children:e})}function Ac({status:e}){return c("span",{"aria-hidden":!0,className:"flex size-2 shrink-0 items-center justify-center",children:e===null?null:c("span",{className:j("block size-2 rounded-full",e==="failed"?"bg-destructive":e==="success"?"bg-success":"border border-muted-foreground/60")})})}function Ip({state:e,variant:t="inline",className:n,children:o}){return S("div",{"data-process-state":e,"data-process-kind":t,className:j("chat-process-shell relative min-w-0 overflow-hidden",t==="tool"?"rounded-lg bg-card":"rounded-md",n),children:[e==="running"?c("span",{"aria-hidden":!0,className:"chat-process-shell-pulse animate-status-pulse"}):null,o]})}Y();Y();var cl=class extends Error{reason;constructor(t,n,o){super(n,o),this.reason=t}};function Z3(e){if(typeof document>"u"||typeof document.execCommand!="function")return!1;let t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.setAttribute("aria-hidden","true"),t.style.position="fixed",t.style.top="0",t.style.left="0",t.style.opacity="0",t.style.fontSize="16px";let n=document.activeElement;document.body.appendChild(t);try{return t.focus({preventScroll:!0}),t.select(),t.setSelectionRange(0,e.length),document.execCommand("copy")}catch{return!1}finally{t.remove();let o=n?.focus;typeof o=="function"&&o.call(n)}}async function eV(e,t){let n=()=>new cl("unavailable",`Clipboard API is unavailable while copying ${t}.`);if(typeof window>"u")throw n();if(!e)return!1;if(typeof navigator>"u"||!navigator.clipboard?.writeText){if(Z3(e))return!0;throw n()}try{return await navigator.clipboard.writeText(e),!0}catch(o){throw new cl("write-failed",`Failed to copy ${t} to the clipboard.`,{cause:o})}}function Tp({timeout:e=2e3,target:t="text",onCopy:n,onError:o}={}){let[r,a]=W(!1),s=M(null),i=M(n),l=M(o),d=M(t),u=M(e);i.current=n,l.current=o,d.current=t,u.current=e;let f=E((p,m)=>{eV(p,d.current).then(h=>{h&&(s.current&&clearTimeout(s.current),a(!0),i.current?.(m),u.current!==0&&(s.current=setTimeout(()=>{a(!1),s.current=null},u.current)))},h=>{l.current?.(h instanceof Error?h:new Error(String(h)),m)})},[]);return U(()=>()=>{s.current&&clearTimeout(s.current)},[]),{copyToClipboard:f,isCopied:r}}var M0=1e3,tV={unavailable:"copyButton.clipboardUnavailable","write-failed":"copyButton.copyFailedDetail"};function nV({title:e,description:t}){return S("span",{role:"status",className:"dropdown-glass pointer-events-none fixed z-100 rounded-md px-2 py-1 text-pretty text-popover-foreground text-xs shadow-xl shadow-black/25",children:[e,t?c("span",{className:"block text-muted-foreground",children:t}):null]})}var Wa=ce(function({text:t,size:n="xs",variant:o="outline",className:r,toastAnchor:a="above",label:s}){let{t:i}=We(),l=s??i("copyButton.copyToClipboard"),d=M(null),[u,f]=W(null),p=M(null),m=(v,C)=>{let y=d.current?.getBoundingClientRect();y&&(p.current&&clearTimeout(p.current),f({top:a==="above"?Math.max(4,y.top-(C===void 0?26:40)):Math.min(window.innerHeight-26,y.bottom+4),left:Math.max(4,y.left+y.width/2),title:v,description:C}),p.current=setTimeout(()=>f(null),M0))};U(()=>()=>{p.current&&clearTimeout(p.current)},[]);let{copyToClipboard:h,isCopied:g}=Tp({onCopy:()=>m(i("copyButton.copied")),onError:v=>m(i("copyButton.failedToCopy"),v instanceof cl?i(tV[v.reason]):v.message),timeout:M0});return S(ze,{children:[c(Ke,{render:c(ee,{"aria-label":l,disabled:g,onClick:()=>h(t),ref:d,type:"button",size:n,variant:o,className:j("text-muted-foreground hover:text-foreground",r)}),children:g?c(Qn,{className:"size-3 text-primary"}):c(Ts,{className:"size-3"})}),c(He,{children:c("p",{children:l})}),u?c("span",{"aria-hidden":!0,className:"pointer-events-none fixed",style:{top:u.top,left:u.left},children:c("span",{className:"relative block -translate-x-1/2",children:c(nV,{title:u.title,description:u.description})})}):null]})});function kp({text:e,label:t,children:n}){return S("span",{className:"group/hover-copy inline-flex min-w-0 items-center gap-0.5",children:[n,c("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:c(Wa,{text:e,label:t,variant:"ghost",size:"icon-xs",className:"shrink-0",toastAnchor:"below"})})]})}Y();var oV=[".m4v",".mov",".mp4",".ogv",".webm"],rV=[".aac",".flac",".m4a",".mp3",".oga",".ogg",".opus",".wav",".weba"];function N0(e){let t=e.name.lastIndexOf(".");if(t<=0)return null;let n=e.name.slice(t).toLowerCase();return oV.includes(n)?"video":rV.includes(n)?"audio":null}var aV=["image/gif","image/jpeg","image/png","image/webp"],sV=new Set(aV);function Kv(e){return sV.has(e.toLowerCase())}function iV(e){return Kv(e)?"image":"file"}var lV=new Set(["application/json","application/xml","application/x-yaml","application/yaml"]),dV=[".doc",".docx",".odt",".ppt",".pptx",".odp",".xls",".xlsx",".ods"];function Nr(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 n=N0(e);if(n)return n;let o=e.name.lastIndexOf(".");return o>0&&dV.includes(e.name.slice(o).toLowerCase())?"office":t.startsWith("text/")||lV.has(t)?"text":"file"}function ja(e){let t=Nr(e);return t==="image"||t==="svg"}function Ga(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 $v(e){let t={id:e.id,name:e.name,mimeType:e.mimeType,sizeBytes:e.sizeBytes};return iV(e.mimeType)==="image"?{type:"image",...t}:{type:"file",...t,...e.source?{source:e.source}:{}}}function Pp(e,t){let n=e.flatMap(r=>r.previewUrl?[{...r,src:r.previewUrl}]:[]);if(n.length===0)return null;let o=n.findIndex(r=>r.id===t);return o<0?null:{images:n.map(r=>({src:r.src,name:r.name,attachmentId:r.id,...r.source===void 0?{}:{source:r.source},...r.type!==void 0&&r.mimeType!==void 0&&Nr({type:r.type,mimeType:r.mimeType,name:r.name})==="svg"?{svg:!0}:{}})),index:o}}function Lp(e){switch(e){case"image":case"svg":return Ud;case"video":return _a;case"audio":return nr;case"pdf":return Ed;case"office":return Md;case"text":return Ad;case"file":return To}}function Ec({images:e}){let t=Ye(It),{t:n}=We();return e.length===0?null:c("div",{className:"mb-2 grid max-w-[420px] grid-cols-2 gap-2",children:e.map(o=>c("div",{className:"overflow-hidden rounded-lg border border-border/80 bg-background/70",children:o.previewUrl?c("button",{type:"button",className:"h-full w-full cursor-zoom-in","data-attachment-action":"preview","data-attachment-name":o.name,"aria-label":n("attachments.preview",{name:o.name}),onClick:()=>{let r=Pp(e,o.id);r&&t.onImageExpand(r)},children:c("img",{src:o.previewUrl,alt:o.name,loading:"lazy",decoding:"async",className:Nr(o)==="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"})}):c("div",{className:"flex min-h-[72px] items-center justify-center px-2 py-3 text-center text-secondary-label text-chat-dense",children:o.name})},o.id))})}function Mc(e){let{t}=We(),n=Ye(It).onAttachmentDocumentOpen,o=Nr(e.attachment),r=Lp(o),a=t("attachments.open",{name:e.attachment.name}),s=S(he,{children:[c(r,{className:"size-4 shrink-0 text-secondary-label"}),S("span",{className:"min-w-0 flex-1",children:[c("span",{className:"block truncate font-medium text-foreground text-chat-row",children:e.attachment.name}),c("span",{className:"block text-secondary-label text-chat-meta",children:Ga(e.attachment.sizeBytes)})]})]});return e.attachment.previewUrl&&(o==="video"||o==="audio")?S("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:[c("a",{href:e.attachment.previewUrl,target:"_blank",rel:"noreferrer","aria-label":a,className:"flex items-center gap-2 hover:underline",children:s}),c(IS,{kind:o,src:e.attachment.previewUrl,title:e.attachment.name})]}):(o==="pdf"||o==="office")&&n?c("button",{type:"button","data-attachment-action":"open","data-attachment-name":e.attachment.name,"aria-label":a,onClick:()=>n({attachmentId:e.attachment.id,name:e.attachment.name}),className:"flex w-full cursor-pointer 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?c("a",{href:e.attachment.previewUrl,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}):c("div",{className:"flex items-center gap-2 rounded-sm border border-border/70 bg-background/70 px-2.5 py-2",children:s})}Y();Y();var cV=Object.freeze([]),uV=()=>cV;function _0(e){return e.type==="file"&&e.source?._tag==="thread-reference"}function fV(e){return e.omitted===null?e.carried:S(he,{children:[c("span",{className:"inline-block max-w-full",children:`${e.carried} \xB7`})," ",c("span",{className:"inline-block max-w-full",children:e.omitted})]})}function D0(e){let t=Ye(It),{t:n}=We(),r=(t.threadReferences?.useDeliveries??uV)(t.activeThreadEnvironmentId,e).filter(a=>a.status!=="unreadable");return r.length===0?null:c("ul",{"aria-label":n("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=>S("li",{"data-thread-reference-delivery":a.status,className:"flex min-w-0 items-start gap-1",children:[c("span",{className:"flex h-lh shrink-0 items-center",children:c(Qr,{"aria-hidden":"true",className:"size-3.5"})}),S("span",{className:"flex min-w-0 flex-1 flex-wrap gap-x-1",children:[c("span",{className:"max-w-max min-w-0 grow basis-24 truncate",children:n("threadReference.title",{title:a.reference.title})}),c("span",{className:"max-w-full",children:a.status==="carried"?c(fV,{carried:n("threadReference.carried",{count:a.carriedMessages}),omitted:a.omittedMessages>0?n("threadReference.omitted",{count:a.omittedMessages}):null}):a.status==="missing"?n("threadReference.missing"):n("threadReference.loading")})]})]},`${a.reference.environmentId}:${a.reference.threadId}`))})}Y();function pV(e){let t=e.match(/:(\d+)$/);if(!t?.[1])return{path:e,line:void 0,column:void 0};let n=e.slice(0,-t[0].length),o=n.match(/:(\d+)$/);return o?.[1]?{path:n.slice(0,-o[0].length),line:o[1],column:t[1]}:{path:n,line:t[1],column:void 0}}function Vv(e){return e.replaceAll("\\","/")}function qv(e){return/^\/[A-Za-z]:\//.test(e)?e.slice(1):e}function mV(e){return qv(Vv(e.replace(/[\\/]+$/,"")))}function gV(e){return e.slice(e.lastIndexOf("/")+1)}function hV(e){return e.startsWith("/")||/^[A-Za-z]:\//.test(e)}function vV(e){return e.startsWith("\\\\")||/^[A-Za-z]:([/\\]|$)/.test(qv(Vv(e)))}function Rp(e,t){let{path:n,line:o,column:r}=pV(e),a=qv(Vv(n)),s=a;if(t){let i=mV(t),l=gV(i),d=vV(t)?p=>p.toLowerCase():p=>p,u=d(a),f=d(i);if(u===f)s=l;else if(u.startsWith(`${f}/`))s=`${l}/${a.slice(i.length+1)}`;else if(!hV(a)){let p=a.replace(/^\.\/+/,"").replace(/^\/+/,"");s=u.startsWith(`${d(l)}/`)?a:`${l}/${p}`}}return o?`${s}:${o}${r?`:${r}`:""}`:s}var yV=/<review_comment\b([^>]*)>\s*([\s\S]*?)<\/review_comment>/g,CV=/([a-zA-Z][a-zA-Z0-9_-]*)="([^"]*)"/g,xV=/(`{3,})([^\s`]*)[^\n]*\n([\s\S]*?)\n\1/g;function bV(e){return e.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/&/g,"&")}function wV(e){let t={};for(let n of e.matchAll(CV))t[n[1]]=bV(n[2]??"");return t}function O0(e){return e===void 0||!/^\d+$/.test(e)?null:Number(e)}function SV(e){let n=Array.from(e.matchAll(xV)).at(-1),o=n?.index;return{text:e.slice(0,o??e.length).trim(),language:n?.[2]?.trim()||"diff",contents:n?.[3]??""}}function IV(e,t,n){let o=wV(e),r=O0(o.startIndex),a=O0(o.endIndex),s=o.filePath?.trim(),i=o.sectionId?.trim();if(!s||!i||r===null||a===null)return null;let l=SV(t);return{id:`review-comment:${n}:${i}:${s}:${r}:${a}`,sectionId:i,sectionTitle:o.sectionTitle?.trim()||null,filePath:s,startIndex:Math.min(r,a),endIndex:Math.max(r,a),rangeLabel:o.rangeLabel?.trim()||null,text:l.text,diff:l.contents,fenceLanguage:l.language}}function Ap(e){let t=[],n=0,o=0;for(let a of e.matchAll(yV)){let s=a.index??0,i=e.slice(n,s);i.length>0&&t.push({kind:"text",id:`review-comment-text:${n}`,text:i});let l=IV(a[1]??"",a[2]??"",o);l?(t.push({kind:"review-comment",comment:l}),o+=1):t.push({kind:"text",id:`review-comment-invalid:${s}`,text:a[0]}),n=s+a[0].length}let r=e.slice(n);return r.length>0&&t.push({kind:"text",id:`review-comment-text:${n}`,text:r}),t}function F0(e,t){let n=Math.max(0,...Array.from(t.matchAll(/`+/g),r=>r[0].length)),o="`".repeat(Math.max(3,n+1));return[`${o}${e}`,t.trimEnd(),o].join(`
|
|
4119
4119
|
`)}function B0(e){if((e.fenceLanguage??"diff")!=="diff")return"";let t=e.diff.trim();if(t.length===0)return"";if(t.startsWith("diff --git "))return t;let n=e.filePath.replaceAll("\\","/");return[`diff --git a/${n} b/${n}`,`--- a/${n}`,`+++ b/${n}`,t].join(`
|
|
4120
4120
|
`)}var Nc="[a-zA-Z][a-zA-Z0-9:_-]*";function ul(e){return e===" "||e===`
|
|
4121
|
-
`||e===" "||e==="\r"}function fl(e){return e.enabled&&e.userInvocable!==!1}var z0="ycodium",U0=`${z0}:`,TV=new RegExp(String.raw`(^|\s)([$/])(${Nc})(?=\s|$)`,"g");function Wv(e){return[...e.matchAll(TV)].map(t=>{let n=(t.index??0)+(t[1]?.length??0),o=t[3]??"";return{sigil:t[2],name:o,start:n,end:n+o.length+1}})}var
|
|
4121
|
+
`||e===" "||e==="\r"}function fl(e){return e.enabled&&e.userInvocable!==!1}var z0="ycodium",U0=`${z0}:`,TV=new RegExp(String.raw`(^|\s)([$/])(${Nc})(?=\s|$)`,"g");function Wv(e){return[...e.matchAll(TV)].map(t=>{let n=(t.index??0)+(t[1]?.length??0),o=t[3]??"";return{sigil:t[2],name:o,start:n,end:n+o.length+1}})}var bse=new RegExp(String.raw`([$/])(${Nc})(?=\s|$)`,"y");function H0(e,t){let n=t.get(e);if(n!==void 0)return n;if(!e.startsWith(U0))return;let o=t.get(e.slice(U0.length));return o?.scope===z0?o:void 0}function K0(e,t,n,o=ul){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(!ul(a)||r<e.length&&o(e.charAt(r))||t.slice(r+1)!==e.slice(r))return null;let s=r;for(;s>0&&!o(t.charAt(s-1));)s-=1;let l=kV.exec(t.slice(s,r))?.[1];return l===void 0||H0(l,n)===void 0?null:{start:s,end:r+1,replacement:`$${l}${a}`}}var kV=new RegExp(String.raw`^/(${Nc})$`);function Ep(e){return new Map(e.map(t=>[t.name,t]))}function $0(e,t){return t.size===0?[]:Wv(e).flatMap(n=>{let o=H0(n.name,t);return o===void 0?[]:[{...n,skill:o}]})}var PV="inline-flex h-[1.41em] max-w-full items-center gap-[0.33em] rounded-[0.5em] px-[0.5em] font-medium leading-none align-middle",LV=`${PV} border border-border/70 bg-accent/40 text-foreground`,Mp=`${LV} text-[12px]`,Np="block size-[1.17em] shrink-0 self-center opacity-85 [&>svg]:block",_p="truncate leading-tight",V0='<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 q0="inline-flex h-[1.41em] max-w-full items-center gap-[0.33em] rounded-[0.5em] px-[0.5em] font-medium leading-none align-middle",W0=`${q0} border border-border/70 bg-accent/40 text-foreground`,RV=`${W0} text-[12px]`,qo=`${W0} text-[0.86em] select-none`,lr="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-['']",ho="block size-[1.17em] shrink-0 self-center opacity-85 [&>svg]:block",j0="truncate leading-tight",vo="block self-center truncate leading-tight select-none",jv="border-skill-chip-border bg-skill-chip text-skill-chip-foreground",G0=`${q0} select-none border ${jv} text-[0.86em]`,Q0='<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>',Dp="ml-[0.17em] inline-flex size-[1.17em] shrink-0 cursor-pointer items-center justify-center rounded-sm text-muted-foreground/72 transition-colors hover:bg-foreground/10 hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring";function AV(e){return e.split(/[\s_-]+/).filter(t=>t.length>0).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}function EV(e){let t=e.displayName?.trim();return t||AV(e.name)}function X0(e){let t=[],n=0;for(let o of $0(e.text,e.index))o.start>n&&t.push(e.text.slice(n,o.start)),t.push(c(MV,{skill:o.skill,rawText:e.text.slice(o.start,o.end)},`${o.start}:${o.name}`)),n=o.end;return n===0?c(he,{children:e.text}):(n<e.text.length&&t.push(e.text.slice(n)),c(he,{children:t}))}function MV(e){return c("span",{className:"inline-flex align-middle leading-none","data-markdown-copy":e.rawText,children:S("span",{className:j(Mp,jv),children:[c("span",{"aria-hidden":"true",className:Np,dangerouslySetInnerHTML:{__html:V0}}),c("span",{className:_p,children:EV(e.skill)})]})})}function Y0(e){let{label:t,tooltipText:n,expired:o=!1}=e;return S(ze,{children:[S(Ke,{render:c("span",{className:j(Mp,o&&"border-destructive/35 bg-destructive/8 text-destructive-foreground"),"data-terminal-context-expired":o?"true":void 0}),children:[c(ko,{className:j(Np,"size-icon-1",o&&"opacity-100")}),c("span",{className:_p,children:t})]}),c(He,{side:"top",className:"max-w-80 whitespace-pre-wrap leading-tight",children:n})]})}var NV=/\n*<element_context>\n([\s\S]*?)\n<\/element_context>\s*$/;function pl(e){let t=NV.exec(e);if(!t)return{promptText:e,contextCount:0,contexts:[]};let n=e.slice(0,t.index).replace(/\n+$/,""),o=_V(t[1]??"");return{promptText:n,contextCount:o.length,contexts:o}}function _V(e){let t=[],n=null,o=()=>{n&&(t.push({header:n.header,body:n.bodyLines.join(`
|
|
4122
4122
|
`).trimEnd()}),n=null)};for(let r of e.split(`
|
|
4123
4123
|
`)){let a=/^- (.+):$/.exec(r);if(a){o(),n={header:a[1],bodyLines:[]};continue}n&&(r.startsWith(" ")?n.bodyLines.push(r.slice(2)):r.length===0&&n.bodyLines.push(""))}return o(),t}var DV=/\n*<terminal_context>\n([\s\S]*?)\n<\/terminal_context>\s*$/;function OV(e){let t=[],n=null,o=()=>{n&&(t.push({header:n.header,body:n.bodyLines.join(`
|
|
4124
4124
|
`).trimEnd()}),n=null)};for(let r of e.split(`
|
|
@@ -4153,12 +4153,12 @@ ${t.context.body}`:t.context.header;return S(ze,{children:[S(Ke,{render:c("span"
|
|
|
4153
4153
|
`?r.push(Al()):i===" "?r.push(Km()):i!==""&&r.push(kn(i))}return{node:r}}if(n=n.replace(/\r/g,"").replace(/[ \t\n]+/g," "),n==="")return{node:null};if(n[0]===" "){let o=t,r=!0;for(;o!==null&&(o=RR(o,!1))!==null;){let a=o.textContent||"";if(a.length>0){/[ \t\n]$/.test(a)&&(n=n.slice(1)),r=!1;break}}r&&(n=n.slice(1))}if(n[n.length-1]===" "){let o=t,r=!0;for(;o!==null&&(o=RR(o,!0))!==null;)if((o.textContent||"").replace(/^( |\t|\r?\n)+/,"").length>0){r=!1;break}r&&(n=n.slice(0,n.length-1))}return n===""?{node:null}:{node:kn(n)}}function RR(e,t){let n=e;for(;;){let o;for(;(o=t?n.nextSibling:n.previousSibling)===null;){let a=n.parentElement;if(a===null)return null;n=a}if(n=o,no(n)){let a=n.style.display;if(a===""&&!PE(n)||a!==""&&!a.startsWith("inline"))return null}let r=n;for(;(r=t?n.firstChild:n.lastChild)!==null;)n=r;if(Fr(n))return n;if(n.nodeName==="BR")return null}}var Zj={code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};function da(e){let t=Zj[e.nodeName.toLowerCase()];return t===void 0?{node:null}:{forChild:RC(e.style,t),node:null}}function kn(e=""){return yu(new gi(e))}function Oe(e){return e instanceof gi}function RC(e,t){let n=e.fontWeight,o=e.textDecoration.split(" "),r=n==="700"||n==="bold",a=o.includes("line-through"),s=e.fontStyle==="italic",i=o.includes("underline"),l=e.verticalAlign;return d=>(Oe(d)&&(r&&!d.hasFormat("bold")&&d.toggleFormat("bold"),a&&!d.hasFormat("strikethrough")&&d.toggleFormat("strikethrough"),s&&!d.hasFormat("italic")&&d.toggleFormat("italic"),i&&!d.hasFormat("underline")&&d.toggleFormat("underline"),l!=="sub"||d.hasFormat("subscript")||d.toggleFormat("subscript"),l!=="super"||d.hasFormat("superscript")||d.toggleFormat("superscript"),t&&!d.hasFormat(t)&&d.toggleFormat(t)),d)}var El=class e extends gi{static getType(){return"tab"}static clone(t){return new e(t.__key)}constructor(t){super(" ",t),this.__detail=2}static importDOM(){return null}createDOM(t){let n=super.createDOM(t),o=Ll(t.theme,"tab");return o!==void 0&&n.classList.add(...o),n}static importJSON(t){return Km().updateFromJSON(t)}setTextContent(t){return t!==" "&&t!==""&&nA(126),super.setTextContent(" ")}spliceText(t,n,o,r){return o===""&&n===0||o===" "&&n===1||ge(286),this}setDetail(t){return t!==2&&ge(127),this}setMode(t){return t!=="normal"&&ge(128),this}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}};function Km(){return yu(new El)}function AC(e){return e instanceof El}var rC=class{key;offset;type;_selection;constructor(t,n,o){this._selection=null,this.key=t,this.offset=n,this.type=o}is(t){return this.key===t.key&&this.offset===t.offset&&this.type===t.type}isBefore(t){return this.key===t.key?this.offset<t.offset:JC(fr(is(this,"next")),fr(is(t,"next")))<0}getNode(){let t=yn(this.key);return t===null&&ge(20),t}set(t,n,o,r){let a=this._selection,s=this.key;r&&this.key===t&&this.offset===n&&this.type===o||(this.key=t,this.offset=n,this.type=o,zl()||(Za()===s&&Ln(t),a!==null&&(a.setCachedNodes(null),a.dirty=!0)))}};function hr(e,t,n){return new rC(e,t,n)}function Ey(e,t){let n=t.__key,o=e.offset,r="element";if(Oe(t)){r="text";let a=t.getTextContentSize();o>a&&(o=a)}else if(!fe(t)){let a=t.getNextSibling();if(Oe(a))n=a.__key,o=0,r="text";else{let s=t.getParent();s&&(n=s.__key,o=t.getIndexWithinParent()+1)}}e.set(n,o,r)}function AR(e,t){if(fe(t)){let n=t.getLastDescendant();fe(n)||Oe(n)?Ey(e,n):Ey(e,t)}else Ey(e,t)}var Em=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(!mu(t))return!1;let n=this._nodes,o=t._nodes;return n.size===o.size&&Array.from(n).every(r=>o.has(r))}isCollapsed(){return!1}isBackward(){return!1}getStartEndPoints(){return null}add(t){this.dirty=!0,this._nodes.add(t),this._cachedNodes=null}delete(t){this.dirty=!0,this._nodes.delete(t),this._cachedNodes=null}clear(){this.dirty=!0,this._nodes.clear(),this._cachedNodes=null}has(t){return this._nodes.has(t)}clone(){return new e(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(t){}insertText(){}insertNodes(t){let n=this.getNodes(),o=n.length,r=n[o-1],a;if(Oe(r))a=r.select();else{let s=r.getIndexWithinParent()+1;a=r.getParentOrThrow().select(s,s)}a.insertNodes(t);for(let s=0;s<o;s++)n[s].remove()}getNodes(){let t=this._cachedNodes;if(t!==null)return t;let n=this._nodes,o=[];for(let r of n){let a=yn(r);a!==null&&o.push(a)}return zl()||(this._cachedNodes=o),o}getTextContent(){let t=this.getNodes(),n="";for(let o=0;o<t.length;o++)n+=t[o].getTextContent();return n}deleteNodes(){let t=this.getNodes();if((Rt()||Ci())===this&&t[0]){let n=En(t[0],"next");ME(ss(n,n))}for(let n of t)n.remove()}};function je(e){return e instanceof hi}var hi=class e{format;style;anchor;focus;_cachedNodes;dirty;constructor(t,n,o,r){this.anchor=t,this.focus=n,t._selection=this,n._selection=this,this._cachedNodes=null,this.format=o,this.style=r,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(t){this._cachedNodes=t}is(t){return!!je(t)&&this.anchor.is(t.anchor)&&this.focus.is(t.focus)&&this.format===t.format&&this.style===t.style}isCollapsed(){return this.anchor.is(this.focus)}getNodes(){let t=this._cachedNodes;if(t!==null)return t;let n=(function(o){let r=[],[a,s]=o.getTextSlices();a&&r.push(a.caret.origin);let i=new Set,l=new Set;for(let d of o)if(mr(d)){let{origin:u}=d;r.length===0?i.add(u):(l.add(u),r.push(u))}else{let{origin:u}=d;fe(u)&&l.has(u)||r.push(u)}if(s&&r.push(s.caret.origin),yi(o.focus)&&fe(o.focus.origin)&&o.focus.getNodeAtCaret()===null)for(let d=ha(o.focus.origin,"previous");mr(d)&&i.has(d.origin)&&!d.origin.isEmpty()&&d.origin.is(r[r.length-1]);d=Bl(d))i.delete(d.origin),r.pop();for(;r.length>1;){let d=r[r.length-1];if(!fe(d)||l.has(d)||d.isEmpty()||i.has(d))break;r.pop()}if(r.length===0&&o.isCollapsed()){let d=fr(o.anchor),u=fr(o.anchor.getFlipped()),f=m=>ga(m)?m.origin:m.getNodeAtCaret(),p=f(d)||f(u)||(o.anchor.getNodeAtCaret()?d.origin:u.origin);r.push(p)}return r})(ex(pC(this),"next"));return zl()||(this._cachedNodes=n),n}setTextNodeRange(t,n,o,r){this.anchor.set(t.__key,n,"text"),this.focus.set(o.__key,r,"text")}getTextContent(){let t=this.getNodes();if(t.length===0)return"";let n=t[0],o=t[t.length-1],r=this.anchor,a=this.focus,s=r.isBefore(a),[i,l]=aC(this),d="",u=!0;for(let f=0;f<t.length;f++){let p=t[f];if(fe(p)&&!p.isInline())u||(d+=`
|
|
4154
4154
|
`),u=!p.isEmpty();else if(u=!1,Oe(p)){let m=p.getTextContent();p===n?p===o?r.type==="element"&&a.type==="element"&&a.offset!==r.offset||(m=i<l?m.slice(i,l):m.slice(l,i)):m=s?m.slice(i):m.slice(l):p===o&&(m=s?m.slice(0,l):m.slice(0,i)),d+=m}else!Wt(p)&&!fi(p)||p===o&&this.isCollapsed()||(d+=p.getTextContent())}return d}applyDOMRange(t){let n=Ut(),o=n.getEditorState()._selection,r=JA(t.startContainer,t.startOffset,t.endContainer,t.endOffset,n,o);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),wm(this)}clone(){let t=this.anchor,n=this.focus;return new e(hr(t.key,t.offset,t.type),hr(n.key,n.offset,n.type),this.format,this.style)}toggleFormat(t){this.format=uu(this.format,t,null),this.dirty=!0}setFormat(t){this.format=t,this.dirty=!0}setStyle(t){this.style=t,this.dirty=!0}hasFormat(t){let n=Kn[t];return(this.format&n)!==0}insertRawText(t){let n=t.split(/(\r?\n|\t)/),o=[],r=n.length;for(let a=0;a<r;a++){let s=n[a];s===`
|
|
4155
4155
|
`||s===`\r
|
|
4156
|
-
`?o.push(Al()):s===" "?o.push(Km()):o.push(kn(s))}this.insertNodes(o)}insertText(t){let n=this.anchor,o=this.focus,r=this.format,a=this.style,s=n,i=o;!this.isCollapsed()&&o.isBefore(n)&&(s=o,i=n),s.type==="element"&&(function(v,C,y,x){let b=v.getNode(),I=b.getChildAtIndex(v.offset),T=kn();if(T.setFormat(y),T.setStyle(x),iE(I))I.splice(0,0,[T]);else{let P=Nn(b)?ma().append(T):T;I===null?b.append(P):I.insertBefore(P)}v.is(C)&&C.set(T.__key,0,"text"),v.set(T.__key,0,"text")})(s,i,r,a),i.type==="element"&&Ul(i,fr(is(i,"next")));let l=s.offset,d=i.offset,u=this.getNodes(),f=u.length,p=u[0];Oe(p)||ge(26);let m=p.getTextContent().length,h=p.getParentOrThrow(),g=u[f-1];if(f===1&&i.type==="element"&&(d=m,i.set(s.key,d,"text")),this.isCollapsed()&&l===m&&(ua(p)||!p.canInsertTextAfter()||!h.canInsertTextAfter()&&p.getNextSibling()===null)){let v=p.getNextSibling();if(Oe(v)&&v.canInsertTextBefore()&&!ua(v)||(v=kn(),v.setFormat(r),v.setStyle(a),h.canInsertTextAfter()?p.insertAfter(v):h.insertAfter(v)),v.select(0,0),p=v,t!=="")return void this.insertText(t)}else if(this.isCollapsed()&&l===0&&(ua(p)||!p.canInsertTextBefore()||!h.canInsertTextBefore()&&p.getPreviousSibling()===null)){let v=p.getPreviousSibling();if(Oe(v)&&!ua(v)||(v=kn(),v.setFormat(r),h.canInsertTextBefore()?p.insertBefore(v):h.insertBefore(v)),v.select(),p=v,t!=="")return void this.insertText(t)}else if(p.isSegmented()&&l!==m){let v=kn(p.getTextContent());v.setFormat(r),p.replace(v),p=v}else if(!this.isCollapsed()&&t!==""){let v=g.getParent();if(!h.canInsertTextBefore()||!h.canInsertTextAfter()||fe(v)&&(!v.canInsertTextBefore()||!v.canInsertTextAfter()))return this.insertText(""),YA(this.anchor,this.focus),void this.insertText(t)}if(f===1){if(es(p)){let x=kn(t);return x.select(),void p.replace(x)}let v=p.getFormat(),C=p.getStyle();if(l!==d||v===r&&C===a){if(AC(p)){let x=kn(t);return x.setFormat(r),x.setStyle(a),x.select(),void p.replace(x)}}else{if(p.getTextContent()!==""){let x=kn(t);if(x.setFormat(r),x.setStyle(a),x.select(),l===0)p.insertBefore(x,!1);else{let[b]=p.splitText(l);b.insertAfter(x,!1)}return void(x.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=t.length))}p.setFormat(r),p.setStyle(a)}let y=d-l;p=p.spliceText(l,y,t,!0),p.getTextContent()===""?p.remove():this.anchor.type==="text"&&(this.format=v,this.style=C,p.isComposing()&&(this.anchor.offset-=t.length))}else{let v=new Set([...p.getParentKeys(),...g.getParentKeys()]),C=fe(p)?p:p.getParentOrThrow(),y=fe(g)?g:g.getParentOrThrow(),x=g;if(!C.is(y)&&y.isInline())do x=y,y=y.getParentOrThrow();while(y.isInline());if(i.type==="text"&&(d!==0||g.getTextContent()==="")||i.type==="element"&&g.getIndexWithinParent()<d)if(Oe(g)&&!es(g)&&d!==g.getTextContentSize()){if(g.isSegmented()){let k=kn(g.getTextContent());g.replace(k),g=k}Nn(i.getNode())||i.type!=="text"||(g=g.spliceText(0,d,"")),v.add(g.__key)}else{let k=g.getParentOrThrow();k.canBeEmpty()||k.getChildrenSize()!==1?g.remove():k.remove()}else v.add(g.__key);let b=y.getChildren(),I=new Set(u),T=C.is(y),P=C.isInline()&&p.getNextSibling()===null?C:p;for(let k=b.length-1;k>=0;k--){let w=b[k];if(w.is(p)||fe(w)&&w.isParentOf(p))break;w.isAttached()&&(!I.has(w)||w.is(x)?T||P.insertAfter(w,!1):w.remove())}if(!T){let k=y,w=null;for(;k!==null;){let L=k.getChildren(),R=L.length;(R===0||L[R-1].is(w))&&(v.delete(k.__key),w=k),k=k.getParent()}}if(es(p))if(l===m)p.select();else{let k=kn(t);k.select(),p.replace(k)}else p=p.spliceText(l,m-l,t,!0),p.getTextContent()===""?p.remove():this.anchor.type==="text"&&(this.format=p.getFormat(),this.style=p.getStyle(),p.isComposing()&&(this.anchor.offset-=t.length));for(let k=1;k<f;k++){let w=u[k],L=w.__key;v.has(L)||w.remove()}}}removeText(){let t=Rt()===this;tu(this,NE(pC(this))),t&&Rt()!==this&&xo(this)}formatText(t,n=null){if(this.isCollapsed())return this.toggleFormat(t),void Ln(null);let o=this.getNodes(),r=[];for(let b of o)Oe(b)&&r.push(b);let a=b=>{o.forEach(I=>{if(fe(I)){let T=I.getFormatFlags(t,b);I.setTextFormat(T)}})},s=r.length;if(s===0)return this.toggleFormat(t),Ln(null),void a(n);let i=this.anchor,l=this.focus,d=this.isBackward(),u=d?l:i,f=d?i:l,p=0,m=r[0],h=u.type==="element"?0:u.offset;if(u.type==="text"&&h===m.getTextContentSize()&&(p=1,m=r[1],h=0),m==null)return;let g=m.getFormatFlags(t,n);a(g);let v=s-1,C=r[v],y=f.type==="text"?f.offset:C.getTextContentSize();if(m.is(C)){if(h===y)return;if(ua(m)||h===0&&y===m.getTextContentSize())m.setFormat(g);else{let b=m.splitText(h,y),I=h===0?b[0]:b[1];I.setFormat(g),u.type==="text"&&u.set(I.__key,0,"text"),f.type==="text"&&f.set(I.__key,y-h,"text")}return void(this.format=g)}h===0||ua(m)||([,m]=m.splitText(h),h=0),m.setFormat(g);let x=C.getFormatFlags(t,g);y>0&&(y===C.getTextContentSize()||ua(C)||([C]=C.splitText(y)),C.setFormat(x));for(let b=p+1;b<v;b++){let I=r[b],T=I.getFormatFlags(t,x);I.setFormat(T)}u.type==="text"&&u.set(m.__key,h,"text"),f.type==="text"&&f.set(C.__key,y,"text"),this.format=g|x}insertNodes(t){if(t.length===0)return;if(this.isCollapsed()||this.removeText(),this.anchor.key==="root"){this.insertParagraph();let h=Rt();return je(h)||ge(134),h.insertNodes(t)}let n=(this.isBackward()?this.focus:this.anchor).getNode(),o=Zc(n,pa),r=t[t.length-1];if(fe(o)&&"__language"in o){if("__language"in t[0])this.insertText(t[0].getTextContent());else{let h=My(this);o.splice(h,0,t),r.selectEnd()}return}if(!t.some(h=>(fe(h)||Wt(h))&&!h.isInline())){fe(o)||ge(211,n.constructor.name,n.getType());let h=My(this);return o.splice(h,0,t),void r.selectEnd()}let a=(function(h){let g=ma(),v=null;for(let C=0;C<h.length;C++){let y=h[C],x=fi(y);if(x||Wt(y)&&y.isInline()||fe(y)&&y.isInline()||Oe(y)||y.isParentRequired()){if(v===null&&(v=y.createParentElementNode(),g.append(v),x))continue;v!==null&&v.append(y)}else g.append(y),v=null}return g})(t),s=a.getLastDescendant(),i=a.getChildren(),l=!fe(o)||!o.isEmpty()?this.insertParagraph():null,d=i[i.length-1],u=i[0];var f;fe(f=u)&&pa(f)&&!f.isEmpty()&&fe(o)&&(!o.isEmpty()||o.canMergeWhenEmpty())&&(fe(o)||ge(211,n.constructor.name,n.getType()),o.append(...u.getChildren()),u=i[1]),u&&(o===null&&ge(212,n.constructor.name,n.getType()),(function(h,g){let v=g.getParentOrThrow().getLastChild(),C=g,y=[g];for(;C!==v;)C.getNextSibling()||ge(140),C=C.getNextSibling(),y.push(C);let x=h;for(let b of y)x=x.insertAfter(b)})(o,u));let p=Zc(s,pa);l&&fe(p)&&(l.canMergeWhenEmpty()||pa(d))&&(p.append(...l.getChildren()),l.remove()),fe(o)&&o.isEmpty()&&o.remove(),s.selectEnd();let m=fe(o)?o.getLastChild():null;fi(m)&&p!==o&&m.remove()}insertParagraph(){if(this.anchor.key==="root"){let s=ma();return Eo().splice(this.anchor.offset,0,[s]),s.select(),s}let t=My(this),n=Zc(this.anchor.getNode(),pa);fe(n)||ge(213);let o=n.getChildAtIndex(t),r=o?[o,...o.getNextSiblings()]:[],a=n.insertNewAfter(this,!1);return a?(a.append(...r),a.selectStart(),a):null}insertLineBreak(t){let n=Al();if(this.insertNodes([n]),t){let o=n.getParentOrThrow(),r=n.getIndexWithinParent();o.select(r,r)}}extract(){let t=[...this.getNodes()],n=t.length,o=t[0],r=t[n-1],[a,s]=aC(this),i=this.isBackward(),[l,d]=i?[this.focus,this.anchor]:[this.anchor,this.focus],[u,f]=i?[s,a]:[a,s];if(n===0)return[];if(n===1){if(Oe(o)&&!this.isCollapsed()){let p=o.splitText(u,f),m=u===0?p[0]:p[1];return m?(l.set(m.getKey(),0,"text"),d.set(m.getKey(),m.getTextContentSize(),"text"),[m]):[]}return[o]}if(Oe(o)&&(u===o.getTextContentSize()?t.shift():u!==0&&([,o]=o.splitText(u),t[0]=o,l.set(o.getKey(),0,"text"))),Oe(r)){let p=r.getTextContent().length;f===0?t.pop():f!==p&&([r]=r.splitText(f),t[t.length-1]=r,d.set(r.getKey(),r.getTextContentSize(),"text"))}return t}modify(t,n,o){if(UR(this,t,n,o))return;let r=t==="move",a=Ut(),s=yr(Mo(a));if(!s)return;let i=a._blockCursorElement,l=a._rootElement,d=this.focus.getNode();if(l===null||i===null||!fe(d)||d.isInline()||d.canBeEmpty()||lC(i,a,l),this.dirty){let u=_l(a,this.anchor.key),f=_l(a,this.focus.key);this.anchor.type==="text"&&(u=vi(u)),this.focus.type==="text"&&(f=vi(f)),u&&f&&tE(s,u,this.anchor.offset,f,this.focus.offset)}if((function(u,f,p,m){u.modify(f,p,m)})(s,t,n?"backward":"forward",o),s.rangeCount>0){let u=s.getRangeAt(0),f=this.anchor.getNode(),p=Nn(f)?f:SE(f);if(this.applyDOMRange(u),this.dirty=!0,!r){let m=this.getNodes(),h=[],g=!1;for(let v=0;v<m.length;v++){let C=m[v];Om(C,p)?h.push(C):g=!0}if(g&&h.length>0)if(n){let v=h[0];fe(v)?v.selectStart():v.getParentOrThrow().selectStart()}else{let v=h[h.length-1];fe(v)?v.selectEnd():v.getParentOrThrow().selectEnd()}s.anchorNode===u.startContainer&&s.anchorOffset===u.startOffset||(function(v){let C=v.focus,y=v.anchor,x=y.key,b=y.offset,I=y.type;y.set(C.key,C.offset,C.type,!0),C.set(x,b,I,!0)})(this)}}o==="lineboundary"&&UR(this,t,n,o,"decorators")}forwardDeletion(t,n,o){if(!o&&(t.type==="element"&&fe(n)&&t.offset===n.getChildrenSize()||t.type==="text"&&t.offset===n.getTextContentSize())){let r=n.getParent(),a=n.getNextSibling()||(r===null?null:r.getNextSibling());if(fe(a)&&a.isShadowRoot())return!0}return!1}deleteCharacter(t){let n=this.isCollapsed();if(this.isCollapsed()){let o=this.anchor,r=o.getNode();if(this.forwardDeletion(o,r,t))return;let a=XC(is(o,t?"previous":"next"));if(a.getTextSlices().every(i=>i===null||i.distance===0)){let i={type:"initial"};for(let l of a.iterNodeCarets("shadowRoot"))if(mr(l)){if(!l.origin.isInline()){if(l.origin.isShadowRoot()){if(i.type==="merge-block")break;if(fe(a.anchor.origin)&&a.anchor.origin.isEmpty()){let d=fr(l);tu(this,ss(d,d)),a.anchor.origin.remove()}return}i.type!=="merge-next-block"&&i.type!=="merge-block"||(i={block:i.block,caret:l,type:"merge-block"})}}else{if(i.type==="merge-block")break;if(yi(l)){if(fe(l.origin)){if(l.origin.isInline()){if(!l.origin.isParentOf(a.anchor.origin))break}else i={block:l.origin,type:"merge-next-block"};continue}if(Wt(l.origin)){if(!l.origin.isIsolated())if(i.type==="merge-next-block"&&(l.origin.isKeyboardSelectable()||!l.origin.isInline())&&fe(a.anchor.origin)&&a.anchor.origin.isEmpty()){a.anchor.origin.remove();let d=EC();d.add(l.origin.getKey()),xo(d)}else l.origin.remove();return}break}}if(i.type==="merge-block"){let{caret:l,block:d}=i;return tu(this,ss(!l.origin.isEmpty()&&d.isEmpty()?Kl(En(d,l.direction)):a.anchor,l)),this.removeText()}}let s=this.focus;if(this.modify("extend",t,"character"),this.isCollapsed()){if(t&&o.offset===0&&MR(this,o.getNode()))return}else{let i=s.type==="text"?s.getNode():null;if(r=o.type==="text"?o.getNode():null,i!==null&&i.isSegmented()){let l=s.offset,d=i.getTextContentSize();if(i.is(r)||t&&l!==d||!t&&l!==0)return void NR(i,t,l)}else if(r!==null&&r.isSegmented()){let l=o.offset,d=r.getTextContentSize();if(r.is(i)||t&&l!==0||!t&&l!==d)return void NR(r,t,l)}(function(l,d){let u=l.anchor,f=l.focus,p=u.getNode(),m=f.getNode();if(p===m&&u.type==="text"&&f.type==="text"){let h=u.offset,g=f.offset,v=h<g,C=v?h:g,y=v?g:h,x=y-1;C!==x&&(function(b){return!(hE(b)||eG(b))})(p.getTextContent().slice(C,y))&&(d?f.set(f.key,x,f.type):u.set(u.key,x,u.type))}})(this,t)}}if(this.removeText(),t&&!n&&this.isCollapsed()&&this.anchor.type==="element"&&this.anchor.offset===0){let o=this.anchor.getNode();o.isEmpty()&&Nn(o.getParent())&&o.getPreviousSibling()===null&&MR(this,o)}}deleteLine(t){this.isCollapsed()&&this.modify("extend",t,"lineboundary"),this.isCollapsed()?this.deleteCharacter(t):this.removeText()}deleteWord(t){if(this.isCollapsed()){let n=this.anchor,o=n.getNode();if(this.forwardDeletion(n,o,t))return;this.modify("extend",t,"word")}this.removeText()}isBackward(){return this.focus.isBefore(this.anchor)}getStartEndPoints(){return[this.anchor,this.focus]}};function mu(e){return e instanceof Em}function ER(e){let t=e.offset;if(e.type==="text")return t;let n=e.getNode();return t===n.getChildrenSize()?n.getTextContent().length:0}function aC(e){let t=e.getStartEndPoints();if(t===null)return[0,0];let[n,o]=t;return n.type==="element"&&o.type==="element"&&n.key===o.key&&n.offset===o.offset?[0,0]:[ER(n),ER(o)]}function MR(e,t){for(let n=t;n;n=n.getParent()){if(fe(n)){if(n.collapseAtStart(e))return!0;if(Qo(n))break}if(n.getPreviousSibling())break}return!1}var eG=(()=>{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 NR(e,t,n){let o=e,r=o.getTextContent().split(/(?=\s)/g),a=r.length,s=0,i=0;for(let d=0;d<a;d++){let u=d===a-1;if(i=s,s+=r[d].length,t&&s===n||s>n||u){r.splice(d,1),u&&(i=void 0);break}}let l=r.join("").trim();l===""?o.remove():(o.setTextContent(l),o.select(i,i))}function _R(e,t,n,o){let r,a=t;if(no(e)){let s=!1,i=e.childNodes,l=i.length,d=o._blockCursorElement;a===l&&(s=!0,a=l-1);let u=i[a],f=!1;if(u===d)u=i[a+1],f=!0;else if(d!==null){let p=d.parentNode;e===p&&t>Array.prototype.indexOf.call(p.children,d)&&a--}if(r=Tl(u),Oe(r))a=gr(r,s?"next":"previous");else{let p=Tl(e);if(p===null)return null;if(fe(p)){let m=o.getElementByKey(p.getKey());m===null&&ge(214),[p,a]=p.getDOMSlot(m).resolveChildIndex(p,m,e,t),fe(p)||ge(215),s&&a>=p.getChildrenSize()&&(a=Math.max(0,p.getChildrenSize()-1));let g=p.getChildAtIndex(a);if(fe(g)&&(function(v,C,y){let x=v.getParent();return y===null||x===null||!x.canBeEmpty()||x!==y.getNode()})(g,0,n)){let v=s?g.getLastDescendant():g.getFirstDescendant();v===null?p=g:(g=v,p=fe(g)?g:g.getParentOrThrow()),a=0}Oe(g)?(r=g,p=null,a=gr(g,s?"next":"previous")):g!==p&&s&&!f&&(fe(p)||ge(216),a=Math.min(p.getChildrenSize(),a+1))}else{let m=p.getIndexWithinParent();a=t===0&&Wt(p)&&Tl(e)===p?m:m+1,p=p.getParentOrThrow()}if(fe(p))return hr(p.__key,a,"element")}}else r=Tl(e);return Oe(r)?hr(r.__key,gr(r,a,"clamp"),"text"):null}function DR(e,t,n){let o=e.offset,r=e.getNode();if(o===0){let a=r.getPreviousSibling(),s=r.getParent();if(t){if((n||!t)&&a===null&&fe(s)&&s.isInline()){let i=s.getPreviousSibling();Oe(i)&&e.set(i.__key,i.getTextContent().length,"text")}}else fe(a)&&!n&&a.isInline()?e.set(a.__key,a.getChildrenSize(),"element"):Oe(a)&&e.set(a.__key,a.getTextContent().length,"text")}else if(o===r.getTextContent().length){let a=r.getNextSibling(),s=r.getParent();if(t&&fe(a)&&a.isInline())e.set(a.__key,0,"element");else if((n||t)&&a===null&&fe(s)&&s.isInline()&&!s.canInsertTextAfter()){let i=s.getNextSibling();Oe(i)&&e.set(i.__key,0,"text")}}}function YA(e,t,n){if(e.type==="text"&&t.type==="text"){let o=e.isBefore(t),r=e.is(t);DR(e,o,r),DR(t,!o,r),r&&t.set(e.key,e.offset,e.type)}}function JA(e,t,n,o,r,a){if(e===null||n===null||!gu(r,e,n))return null;let s=_R(e,t,je(a)?a.anchor:null,r);if(s===null)return null;let i=_R(n,o,je(a)?a.focus:null,r);if(i===null)return null;if(s.type==="element"&&i.type==="element"){let l=Tl(e),d=Tl(n);if(Wt(l)&&Wt(d))return null}return YA(s,i),[s,i]}function tG(e){return fe(e)&&!e.isInline()}function ZA(e,t,n,o,r,a){let s=va(),i=new hi(hr(e,t,r),hr(n,o,a),0,"");return i.dirty=!0,s._selection=i,i}function eE(){let e=hr("root",0,"element"),t=hr("root",0,"element");return new hi(e,t,0,"")}function EC(){return new Em(new Set)}function nG(e,t){return $m(null,e,t,null)}function $m(e,t,n,o){let r=n._window;if(r===null)return null;let a=o||r.event,s=a?a.type:void 0,i=s==="selectionchange",l=!Uy&&(i||s==="beforeinput"||s==="compositionstart"||s==="compositionend"||s==="click"&&a&&a.detail===3||s==="drop"||s===void 0),d,u,f,p;if(je(e)&&!l)return e.clone();if(t===null)return null;if(d=t.anchorNode,u=t.focusNode,f=t.anchorOffset,p=t.focusOffset,(i||s===void 0)&&je(e)&&!gu(n,d,u))return e.clone();let m=JA(d,f,u,p,n,e);if(m===null)return null;let[h,g]=m,v=0,C="";if(je(e)){let y=e.anchor;if(h.key===y.key)v=e.format,C=e.style;else{let x=h.getNode();Oe(x)?(v=x.getFormat(),C=x.getStyle()):fe(x)&&(v=x.getTextFormat(),C=x.getTextStyle())}}return new hi(h,g,v,C)}function Rt(){return va()._selection}function Ci(){return Ut()._editorState._selection}function Mm(e,t,n,o=1){let r=e.anchor,a=e.focus,s=r.getNode(),i=a.getNode();if(!t.is(s)&&!t.is(i))return;let l=t.__key;if(e.isCollapsed()){let d=r.offset;if(n<=d&&o>0||n<d&&o<0){let u=Math.max(0,d+o);r.set(l,u,"element"),a.set(l,u,"element"),OR(e)}}else{let d=e.isBackward(),u=d?a:r,f=u.getNode(),p=d?r:a,m=p.getNode();if(t.is(f)){let h=u.offset;(n<=h&&o>0||n<h&&o<0)&&u.set(l,Math.max(0,h+o),"element")}if(t.is(m)){let h=p.offset;(n<=h&&o>0||n<h&&o<0)&&p.set(l,Math.max(0,h+o),"element")}}OR(e)}function OR(e){let t=e.anchor,n=t.offset,o=e.focus,r=o.offset,a=t.getNode(),s=o.getNode();if(e.isCollapsed()){if(!fe(a))return;let i=a.getChildrenSize(),l=n>=i,d=l?a.getChildAtIndex(i-1):a.getChildAtIndex(n);if(Oe(d)){let u=0;l&&(u=d.getTextContentSize()),t.set(d.__key,u,"text"),o.set(d.__key,u,"text")}return}if(fe(a)){let i=a.getChildrenSize(),l=n>=i,d=l?a.getChildAtIndex(i-1):a.getChildAtIndex(n);if(Oe(d)){let u=0;l&&(u=d.getTextContentSize()),t.set(d.__key,u,"text")}}if(fe(s)){let i=s.getChildrenSize(),l=r>=i,d=l?s.getChildAtIndex(i-1):s.getChildAtIndex(r);if(Oe(d)){let u=0;l&&(u=d.getTextContentSize()),o.set(d.__key,u,"text")}}}function Nm(e,t,n,o,r){let a=null,s=0,i=null;o!==null?(a=o.__key,Oe(o)?(s=o.getTextContentSize(),i="text"):fe(o)&&(s=o.getChildrenSize(),i="element")):r!==null&&(a=r.__key,Oe(r)?i="text":fe(r)&&(i="element")),a!==null&&i!==null?e.set(a,s,i):(s=t.getIndexWithinParent(),s===-1&&(s=n.getChildrenSize()),e.set(n.__key,s,"element"))}function FR(e,t,n,o,r){e.type==="text"?e.set(n,e.offset+(t?0:r),"text"):e.offset>o.getIndexWithinParent()&&e.set(e.key,e.offset-1,"element")}function tE(e,t,n,o,r){try{e.setBaseAndExtent(t,n,o,r)}catch{}}function BR(e,t,n){let o=_l(e,t.getKey());if(fe(t)){let r=t.getDOMSlot(o);return[r.element,n+r.getFirstChildOffset()]}return[o,n]}function oG(e,t,n,o,r,a,s){let i=o.anchorNode,l=o.focusNode,d=o.anchorOffset,u=o.focusOffset,f=document.activeElement;if(r.has(VA)&&f!==a||f!==null&&FC(f))return;if(!je(t))return void(e!==null&&gu(n,i,l)&&o.removeAllRanges());let p=t.anchor,m=t.focus,h=p.getNode(),g=m.getNode(),[v,C]=BR(n,h,p.offset),[y,x]=BR(n,g,m.offset),b=t.format,I=t.style,T=t.isCollapsed(),P=v,k=y,w=!1;var L,R,N,A,D;if(p.type==="text"?(P=vi(v),w=h.getFormat()!==b||h.getStyle()!==I):je(e)&&e.anchor.type==="text"&&(w=!0),m.type==="text"&&(k=vi(y)),P!==null&&k!==null&&(T&&(e===null||w||je(e)&&(e.format!==b||e.style!==I))&&(L=b,R=I,N=C,A=p.key,D=performance.now(),FA=[L,R,N,A,D]),d!==C||u!==x||i!==P||l!==k||o.type==="Range"&&T||(f!==null&&a.contains(f)||r.has(oC)||a.focus({preventScroll:!0}),p.type==="element"))){if(tE(o,P,C,k,x),!ns||!t.isCollapsed()||a===null||r.has(oC)||document.activeElement!==null&&a.contains(document.activeElement)||a.focus({preventScroll:!0}),!r.has(qA)&&t.isCollapsed()&&a!==null&&a===document.activeElement){let q=je(t)&&t.anchor.type==="element"?P.childNodes[C]||null:o.rangeCount>0?o.getRangeAt(0):null;if(q!==null){let H;if(q instanceof Text){let F=document.createRange();F.selectNode(q),H=F.getBoundingClientRect()}else H=q.getBoundingClientRect();(function(F,V,_){let z=VC(_),Ce=qC(z);if(z===null||Ce===null)return;let{top:B,bottom:ae}=V,X=0,G=0,Q=_;for(;Q!==null;){let oe=Q===z.body;if(oe)X=0,G=Mo(F).innerHeight;else{let J=Q.getBoundingClientRect();X=J.top,G=J.bottom}let de=0;if(B<X?de=-(X-B):ae>G&&(de=ae-G),de!==0)if(oe)Ce.scrollBy(0,de);else{let J=Q.scrollTop;Q.scrollTop+=de;let se=Q.scrollTop-J;B-=se,ae-=se}if(oe)break;Q=vu(Q)}})(n,H,a)}}eC=!0}}function rG(e){let t=Rt()||Ci();t===null&&(t=Eo().selectEnd()),t.insertNodes(e)}function aG(){let e=Rt();return e===null?"":e.getTextContent()}function My(e){let t=e;e.isCollapsed()||t.removeText();let n=Rt();je(n)&&(t=n),je(t)||ge(161);let o=t.anchor,r=o.getNode(),a=o.offset;for(;!pa(r);){let s=r;if([r,a]=sG(r,a),s.is(r))break}return a}function sG(e,t){let n=e.getParent();if(!n){let r=ma();return Eo().append(r),r.select(),[Eo(),0]}if(Oe(e)){let r=e.splitText(t);if(r.length===0)return[n,e.getIndexWithinParent()];let a=t===0?0:1;return[n,r[0].getIndexWithinParent()+a]}if(!fe(e)||t===0)return[n,e.getIndexWithinParent()];let o=e.getChildAtIndex(t);if(o){let r=new hi(hr(e.__key,t,"element"),hr(e.__key,t,"element"),0,""),a=e.insertNewAfter(r);a&&a.append(o,...o.getNextSiblings())}return[n,e.getIndexWithinParent()+1]}function UR(e,t,n,o,r="decorators-and-blocks"){if(t==="move"&&o==="character"&&!e.isCollapsed()){let[u,f]=n===e.isBackward()?[e.focus,e.anchor]:[e.anchor,e.focus];return f.set(u.key,u.offset,u.type),!0}let a=is(e.focus,n?"previous":"next"),s=o==="lineboundary",i=t==="move",l=a,d=r==="decorators-and-blocks";if(!_E(l)){for(let u of l){d=!1;let{origin:f}=u;if(!Wt(f)||f.isIsolated()||(l=u,!s||!f.isInline()))break}if(d)for(let u of XC(a).iterNodeCarets(t==="extend"?"shadowRoot":"root")){if(mr(u))u.origin.isInline()||(l=u);else{if(fe(u.origin))continue;Wt(u.origin)&&!u.origin.isInline()&&(l=u)}break}}if(l===a)return!1;if(i&&!s&&Wt(l.origin)&&l.origin.isKeyboardSelectable()){let u=EC();return u.add(l.origin.getKey()),xo(u),!0}return l=fr(l),i&&Ul(e.anchor,l),Ul(e.focus,l),d||!s}var Rn=null,An=null,Co=!1,Ny=!1,Cm=0,zR={characterData:!0,childList:!0,subtree:!0};function zl(){return Co||Rn!==null&&Rn._readOnly}function Pn(){Co&&ge(13)}function nE(){Cm>99&&ge(14)}function va(){return Rn===null&&ge(195,oE()),Rn}function Ut(){return An===null&&ge(196,oE()),An}function oE(){let e=0,t=new Set,n=rs.version;if(typeof window<"u")for(let r of document.querySelectorAll("[contenteditable]")){let a=hu(r);if(qm(a))e++;else if(a){let s=String(a.constructor.version||"<0.17.1");s===n&&(s+=" (separately built, likely a bundler configuration issue)"),t.add(s)}}let o=` Detected on the page: ${e} compatible editor(s) with version ${n}`;return t.size&&(o+=` and incompatible editors with versions ${Array.from(t).join(", ")}`),o}function iG(){return An}function HR(e,t,n){let o=t.__type,r=DC(e,o),a=n.get(o);a===void 0&&(a=Array.from(r.transforms),n.set(o,a));let s=a.length;for(let i=0;i<s&&(a[i](t),t.isAttached());i++);}function KR(e,t){return e!==void 0&&e.__key!==t&&e.isAttached()}function rE(e,t){if(!t)return;let n=e._updateTags,o=t;Array.isArray(t)||(o=[t]);for(let r of o)n.add(r)}function lG(e){return MC(e,Ut()._nodes)}function MC(e,t){let n=e.type,o=t.get(n);o===void 0&&ge(17,n);let r=o.klass;e.type!==r.getType()&&ge(18,r.name);let a=r.importJSON(e),s=e.children;if(fe(a)&&Array.isArray(s))for(let i=0;i<s.length;i++){let l=MC(s[i],t);a.append(l)}return a}function $R(e,t,n){let o=Rn,r=Co,a=An;Rn=t,Co=!0,An=e;try{return n()}finally{Rn=o,Co=r,An=a}}function fa(e,t){let n=e._pendingEditorState,o=e._rootElement,r=e._headless||o===null;if(n===null)return;let a=e._editorState,s=a._selection,i=n._selection,l=e._dirtyType!==0,d=Rn,u=Co,f=An,p=e._updating,m=e._observer,h=null;if(e._pendingEditorState=null,e._editorState=n,!r&&l&&m!==null){An=e,Rn=n,Co=!1,e._updating=!0;try{let T=e._dirtyType,P=e._dirtyElements,k=e._dirtyLeaves;m.disconnect(),h=Pj(a,n,e,T,P,k)}catch(T){if(T instanceof Error&&e._onError(T),Ny)throw T;return lE(e,null,o,n),dA(e),e._dirtyType=2,Ny=!0,fa(e,a),void(Ny=!1)}finally{m.observe(o,zR),e._updating=p,Rn=d,Co=u,An=f}}n._readOnly||(n._readOnly=!0);let g=e._dirtyLeaves,v=e._dirtyElements,C=e._normalizedNodes,y=e._updateTags,x=e._deferred;l&&(e._dirtyType=0,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements=new Map,e._normalizedNodes=new Set,e._updateTags=new Set),(function(T,P){let k=T._decorators,w=T._pendingDecorators||k,L=P._nodeMap,R;for(R in w)L.has(R)||(w===k&&(w=mE(T)),delete w[R])})(e,n);let b=r?null:yr(Mo(e));if(e._editable&&b!==null&&(l||i===null||i.dirty||!i.is(s))&&o!==null&&!y.has(WA)){An=e,Rn=n;try{if(m!==null&&m.disconnect(),l||i===null||i.dirty){let T=e._blockCursorElement;T!==null&&lC(T,e,o),oG(s,i,e,b,y,o)}(function(T,P,k){let w=T._blockCursorElement;if(je(k)&&k.isCollapsed()&&k.anchor.type==="element"&&P.contains(document.activeElement)){let L=k.anchor,R=L.getNode(),N=L.offset,A=!1,D=null;if(N===R.getChildrenSize())Dy(R.getChildAtIndex(N-1))&&(A=!0);else{let q=R.getChildAtIndex(N);if(q!==null&&Dy(q)){let H=q.getPreviousSibling();(H===null||Dy(H))&&(A=!0,D=T.getElementByKey(q.__key))}}if(A){let q=T.getElementByKey(R.__key);return w===null&&(T._blockCursorElement=w=(function(H){let F=H.theme,V=document.createElement("div");V.contentEditable="false",V.setAttribute("data-lexical-cursor","true");let _=F.blockCursor;if(_!==void 0){if(typeof _=="string"){let z=xu(_);_=F.blockCursor=z}_!==void 0&&V.classList.add(..._)}return V})(T._config)),P.style.caretColor="transparent",void(D===null?q.appendChild(w):q.insertBefore(w,D))}}w!==null&&lC(w,T,P)})(e,o,i)}finally{m!==null&&m.observe(o,zR),An=f,Rn=d}}h!==null&&(function(T,P,k,w,L){let R=Array.from(T._listeners.mutation),N=R.length;for(let A=0;A<N;A++){let[D,q]=R[A];for(let H of q){let F=P.get(H);F!==void 0&&D(F,{dirtyLeaves:w,prevEditorState:L,updateTags:k})}}})(e,h,y,g,a),je(i)||i===null||s!==null&&s.is(i)||e.dispatchCommand(yC,void 0);let I=e._pendingDecorators;I!==null&&(e._decorators=I,e._pendingDecorators=null,Jc("decorator",e,!0,I)),(function(T,P,k){let w=jR(P),L=jR(k);w!==L&&Jc("textcontent",T,!0,L)})(e,t||a,n),Jc("update",e,!0,{dirtyElements:v,dirtyLeaves:g,editorState:n,mutatedNodes:h,normalizedNodes:C,prevEditorState:t||a,tags:y}),(function(T,P){if(T._deferred=[],P.length!==0){let k=T._updating;T._updating=!0;try{for(let w=0;w<P.length;w++)P[w]()}finally{T._updating=k}}})(e,x),(function(T){let P=T._updates;if(P.length!==0){let k=P.shift();if(k){let[w,L]=k;Vm(T,w,L)}}})(e)}function Jc(e,t,n,...o){let r=t._updating;t._updating=n;try{let a=Array.from(t._listeners[e]);for(let s=0;s<a.length;s++)a[s].apply(null,o)}finally{t._updating=r}}function VR(e,t){let n=e._updates,o=t||!1;for(;n.length!==0;){let r=n.shift();if(r){let[a,s]=r,i=e._pendingEditorState,l;s!==void 0&&(l=s.onUpdate,s.skipTransforms&&(o=!0),s.discrete&&(i===null&&ge(191),i._flushSync=!0),l&&e._deferred.push(l),rE(e,s.tag)),i==null?Vm(e,a,s):a()}}return o}function Vm(e,t,n){let o=e._updateTags,r,a=!1,s=!1;n!==void 0&&(r=n.onUpdate,rE(e,n.tag),a=n.skipTransforms||!1,s=n.discrete||!1),r&&e._deferred.push(r);let i=e._editorState,l=e._pendingEditorState,d=!1;(l===null||l._readOnly)&&(l=e._pendingEditorState=aE(l||i),d=!0),l._flushSync=s;let u=Rn,f=Co,p=An,m=e._updating;Rn=l,Co=!1,e._updating=!0,An=e;let h=e._headless||e.getRootElement()===null;_C(null);try{d&&(h?i._selection!==null&&(l._selection=i._selection.clone()):l._selection=(function(y,x){let b=y.getEditorState()._selection,I=yr(Mo(y));return je(b)||b==null?$m(b,I,y,x):b.clone()})(e,n&&n.event||null));let v=e._compositionKey;t(),a=VR(e,a),(function(y,x){let b=x.getEditorState()._selection,I=y._selection;if(je(I)){let T=I.anchor,P=I.focus,k;if(T.type==="text"&&(k=T.getNode(),k.selectionTransform(b,I)),P.type==="text"){let w=P.getNode();k!==w&&w.selectionTransform(b,I)}}})(l,e),e._dirtyType!==0&&(a?(function(y,x){let b=x._dirtyLeaves,I=y._nodeMap;for(let T of b){let P=I.get(T);Oe(P)&&P.isAttached()&&P.isSimpleText()&&!P.isUnmergeable()&&yR(P)}})(l,e):(function(y,x){let b=x._dirtyLeaves,I=x._dirtyElements,T=y._nodeMap,P=Za(),k=new Map,w=b,L=w.size,R=I,N=R.size;for(;L>0||N>0;){if(L>0){x._dirtyLeaves=new Set;for(let A of w){let D=T.get(A);Oe(D)&&D.isAttached()&&D.isSimpleText()&&!D.isUnmergeable()&&yR(D),D!==void 0&&KR(D,P)&&HR(x,D,k),b.add(A)}if(w=x._dirtyLeaves,L=w.size,L>0){Cm++;continue}}x._dirtyLeaves=new Set,x._dirtyElements=new Map,R.delete("root")&&R.set("root",!0);for(let A of R){let D=A[0],q=A[1];if(I.set(D,q),!q)continue;let H=T.get(D);H!==void 0&&KR(H,P)&&HR(x,H,k)}w=x._dirtyLeaves,L=w.size,R=x._dirtyElements,N=R.size,Cm++}x._dirtyLeaves=b,x._dirtyElements=I})(l,e),VR(e),(function(y,x,b,I){let T=y._nodeMap,P=x._nodeMap,k=[];for(let[w]of I){let L=P.get(w);L!==void 0&&(L.isAttached()||(fe(L)&&sA(L,w,T,P,k,I),T.has(w)||I.delete(w),k.push(w)))}for(let w of k)P.delete(w);for(let w of b){let L=P.get(w);L===void 0||L.isAttached()||(T.has(w)||b.delete(w),P.delete(w))}})(i,l,e._dirtyLeaves,e._dirtyElements)),v!==e._compositionKey&&(l._flushSync=!0);let C=l._selection;if(je(C)){let y=l._nodeMap,x=C.anchor.key,b=C.focus.key;y.get(x)!==void 0&&y.get(b)!==void 0||ge(19)}else mu(C)&&C._nodes.size===0&&(l._selection=null)}catch(v){return v instanceof Error&&e._onError(v),e._pendingEditorState=i,e._dirtyType=2,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements.clear(),void fa(e)}finally{Rn=u,Co=f,An=p,e._updating=m,Cm=0}e._dirtyType!==0||e._deferred.length>0||(function(v,C){let y=C.getEditorState()._selection,x=v._selection;if(x!==null){if(x.dirty||!x.is(y))return!0}else if(y!==null)return!0;return!1})(l,e)?l._flushSync?(l._flushSync=!1,fa(e)):d&&vG(()=>{fa(e)}):(l._flushSync=!1,d&&(o.clear(),e._deferred=[],e._pendingEditorState=null))}function Or(e,t,n){An===e&&n===void 0?t():Vm(e,t,n)}var sC=class e{element;before;after;constructor(t,n,o){this.element=t,this.before=n||null,this.after=o||null}withBefore(t){return new e(this.element,t,this.after)}withAfter(t){return new e(this.element,this.before,t)}withElement(t){return this.element===t?this:new e(t,this.before,this.after)}insertChild(t){let n=this.before||this.getManagedLineBreak();return n!==null&&n.parentElement!==this.element&&ge(222),this.element.insertBefore(t,n),this}removeChild(t){return t.parentElement!==this.element&&ge(223),this.element.removeChild(t),this}replaceChild(t,n){return n.parentElement!==this.element&&ge(224),this.element.replaceChild(t,n),this}getFirstChild(){let t=this.after?this.after.nextSibling:this.element.firstChild;return t===this.before||t===this.getManagedLineBreak()?null:t}getManagedLineBreak(){return this.element.__lexicalLineBreak||null}setManagedLineBreak(t){if(t===null)this.removeManagedLineBreak();else{let n=t==="decorator"&&(Um||pu||Bm);this.insertManagedLineBreak(n)}}removeManagedLineBreak(){let t=this.getManagedLineBreak();if(t){let n=this.element,o=t.nodeName==="IMG"?t.nextSibling:null;o&&n.removeChild(o),n.removeChild(t),n.__lexicalLineBreak=void 0}}insertManagedLineBreak(t){let n=this.getManagedLineBreak();if(n){if(t===(n.nodeName==="IMG"))return;this.removeManagedLineBreak()}let o=this.element,r=this.before,a=document.createElement("br");if(o.insertBefore(a,r),t){let s=document.createElement("img");s.setAttribute("data-lexical-linebreak","true"),s.style.cssText="display: inline !important; border: 0px !important; margin: 0px !important;",s.alt="",o.insertBefore(s,a),o.__lexicalLineBreak=s}else o.__lexicalLineBreak=a}getFirstChildOffset(){let t=0;for(let n=this.after;n!==null;n=n.previousSibling)t++;return t}resolveChildIndex(t,n,o,r){if(o===this.element){let l=this.getFirstChildOffset();return[t,Math.min(l+t.getChildrenSize(),Math.max(l,r))]}let a=qR(n,o);a.push(r);let s=qR(n,this.element),i=t.getIndexWithinParent();for(let l=0;l<s.length;l++){let d=a[l],u=s[l];if(d===void 0||d<u)break;if(d>u){i+=1;break}}return[t.getParentOrThrow(),i]}};function qR(e,t){let n=[],o=t;for(;o!==e&&o!==null;o=o.parentNode){let r=0;for(let a=o.previousSibling;a!==null;a=a.previousSibling)r++;n.push(r)}return o!==e&&ge(225),n.reverse()}var os=class extends Go{__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 pj[t]||""}getStyle(){return this.getLatest().__style}getIndent(){return this.getLatest().__indent}getChildren(){let t=[],n=this.getFirstChild();for(;n!==null;)t.push(n),n=n.getNextSibling();return t}getChildrenKeys(){let t=[],n=this.getFirstChild();for(;n!==null;)t.push(n.__key),n=n.getNextSibling();return t}getChildrenSize(){return this.getLatest().__size}isEmpty(){return this.getChildrenSize()===0}isDirty(){let t=Ut()._dirtyElements;return t!==null&&t.has(this.__key)}isLastChild(){let t=this.getLatest(),n=this.getParentOrThrow().getLastChild();return n!==null&&n.is(t)}getAllTextNodes(){let t=[],n=this.getFirstChild();for(;n!==null;){if(Oe(n)&&t.push(n),fe(n)){let o=n.getAllTextNodes();t.push(...o)}n=n.getNextSibling()}return t}getFirstDescendant(){let t=this.getFirstChild();for(;fe(t);){let n=t.getFirstChild();if(n===null)break;t=n}return t}getLastDescendant(){let t=this.getLastChild();for(;fe(t);){let n=t.getLastChild();if(n===null)break;t=n}return t}getDescendantByIndex(t){let n=this.getChildren(),o=n.length;if(t>=o){let a=n[o-1];return fe(a)&&a.getLastDescendant()||a||null}let r=n[t];return fe(r)&&r.getFirstDescendant()||r||null}getFirstChild(){let t=this.getLatest().__first;return t===null?null:yn(t)}getFirstChildOrThrow(){let t=this.getFirstChild();return t===null&&ge(45,this.__key),t}getLastChild(){let t=this.getLatest().__last;return t===null?null:yn(t)}getLastChildOrThrow(){let t=this.getLastChild();return t===null&&ge(96,this.__key),t}getChildAtIndex(t){let n=this.getChildrenSize(),o,r;if(t<n/2){for(o=this.getFirstChild(),r=0;o!==null&&r<=t;){if(r===t)return o;o=o.getNextSibling(),r++}return null}for(o=this.getLastChild(),r=n-1;o!==null&&r>=t;){if(r===t)return o;o=o.getPreviousSibling(),r--}return null}getTextContent(){let t="",n=this.getChildren(),o=n.length;for(let r=0;r<o;r++){let a=n[r];t+=a.getTextContent(),fe(a)&&r!==o-1&&!a.isInline()&&(t+=zm)}return t}getTextContentSize(){let t=0,n=this.getChildren(),o=n.length;for(let r=0;r<o;r++){let a=n[r];t+=a.getTextContentSize(),fe(a)&&r!==o-1&&!a.isInline()&&(t+=2)}return t}getDirection(){return this.getLatest().__dir}getTextFormat(){return this.getLatest().__textFormat}hasFormat(t){if(t!==""){let n=By[t];return(this.getFormat()&n)!==0}return!1}hasTextFormat(t){let n=Kn[t];return(this.getTextFormat()&n)!==0}getFormatFlags(t,n){return uu(this.getLatest().__textFormat,t,n)}getTextStyle(){return this.getLatest().__textStyle}select(t,n){Pn();let o=Rt(),r=t,a=n,s=this.getChildrenSize();if(!this.canBeEmpty()){if(t===0&&n===0){let l=this.getFirstChild();if(Oe(l)||fe(l))return l.select(0,0)}else if(!(t!==void 0&&t!==s||n!==void 0&&n!==s)){let l=this.getLastChild();if(Oe(l)||fe(l))return l.select()}}r===void 0&&(r=s),a===void 0&&(a=s);let i=this.__key;return je(o)?(o.anchor.set(i,r,"element"),o.focus.set(i,a,"element"),o.dirty=!0,o):ZA(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(n=>n.remove()),t}append(...t){return this.splice(this.getChildrenSize(),0,t)}setDirection(t){let n=this.getWritable();return n.__dir=t,n}setFormat(t){return this.getWritable().__format=t!==""?By[t]:0,this}setStyle(t){return this.getWritable().__style=t||"",this}setTextFormat(t){let n=this.getWritable();return n.__textFormat=t,n}setTextStyle(t){let n=this.getWritable();return n.__textStyle=t,n}setIndent(t){return this.getWritable().__indent=t,this}splice(t,n,o){Am(this)&&ge(324,this.__key,this.__type);let r=this.getChildrenSize(),a=this.getWritable();t+n<=r||ge(226,String(t),String(n),String(r));let s=a.__key,i=[],l=[],d=this.getChildAtIndex(t+n),u=null,f=r-n+o.length;if(t!==0)if(t===r)u=this.getLastChild();else{let m=this.getChildAtIndex(t);m!==null&&(u=m.getPreviousSibling())}if(n>0){let m=u===null?this.getFirstChild():u.getNextSibling();for(let h=0;h<n;h++){m===null&&ge(100);let g=m.getNextSibling(),v=m.__key;ts(m.getWritable()),l.push(v),m=g}}let p=u;for(let m of o){p!==null&&m.is(p)&&(u=p=p.getPreviousSibling());let h=m.getWritable();h.__parent===s&&f--,ts(h);let g=m.__key;if(p===null)a.__first=g,h.__prev=null;else{let v=p.getWritable();v.__next=g,h.__prev=v.__key}m.__key===s&&ge(76),h.__parent=s,i.push(g),p=m}if(t+n===r)p!==null&&(p.getWritable().__next=null,a.__last=p.__key);else if(d!==null){let m=d.getWritable();if(p!==null){let h=p.getWritable();m.__prev=p.__key,h.__next=d.__key}else m.__prev=null}if(a.__size=f,l.length){let m=Rt();if(je(m)){let h=new Set(l),g=new Set(i),{anchor:v,focus:C}=m;WR(v,h,g)&&Nm(v,v.getNode(),this,u,d),WR(C,h,g)&&Nm(C,C.getNode(),this,u,d),f!==0||this.canBeEmpty()||Qo(this)||this.remove()}}return a}getDOMSlot(t){return new sC(t)}exportDOM(t){let{element:n}=super.exportDOM(t);if(no(n)){let o=this.getIndent();o>0&&(n.style.paddingInlineStart=40*o+"px");let r=this.getDirection();r&&(n.dir=r)}return{element:n}}exportJSON(){let t={children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),...super.exportJSON()},n=this.getTextFormat(),o=this.getTextStyle();return n===0&&o===""||Qo(this)||this.getChildren().some(Oe)||(n!==0&&(t.textFormat=n),o!==""&&(t.textStyle=o)),t}updateFromJSON(t){return super.updateFromJSON(t).setFormat(t.format).setIndent(t.indent).setDirection(t.direction).setTextFormat(t.textFormat||0).setTextStyle(t.textStyle||"")}insertNewAfter(t,n){return null}canIndent(){return!0}collapseAtStart(t){return!1}excludeFromCopy(t){return!1}canReplaceWith(t){return!0}canInsertAfter(t){return!0}canBeEmpty(){return!0}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}isInline(){return!1}isShadowRoot(){return!1}canMergeWith(t){return!1}extractWithChild(t,n,o){return!1}canMergeWhenEmpty(){return!1}reconcileObservedMutation(t,n){let o=this.getDOMSlot(t),r=o.getFirstChild();for(let a=this.getFirstChild();a;a=a.getNextSibling()){let s=n.getElementByKey(a.getKey());s!==null&&(r==null?(o.insertChild(s),r=s):r!==s&&o.replaceChild(s,r),r=r.nextSibling)}}};function fe(e){return e instanceof os}function WR(e,t,n){let o=e.getNode();for(;o;){let r=o.__key;if(t.has(r)&&!n.has(r))return!0;o=o.getParent()}return!1}var du=class extends Go{decorate(t,n){return null}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}};function Wt(e){return e instanceof du}var Ml=class e extends os{__cachedText;static getType(){return"root"}static clone(){return new e}constructor(){super("root"),this.__cachedText=null}getTopLevelElementOrThrow(){ge(51)}getTextContent(){let t=this.__cachedText;return!zl()&&Ut()._dirtyType!==0||t===null?super.getTextContent():t}remove(){ge(52)}replace(t){ge(53)}insertBefore(t){ge(54)}insertAfter(t){ge(55)}updateDOM(t,n){return!1}splice(t,n,o){for(let r of o)fe(r)||Wt(r)||ge(282);return super.splice(t,n,o)}static importJSON(t){return Eo().updateFromJSON(t)}collapseAtStart(){return!0}};function Nn(e){return e instanceof Ml}function aE(e){return new cu(new Map(e._nodeMap))}function NC(){return new cu(new Map([["root",new Ml]]))}function sE(e){let t=e.exportJSON(),n=e.constructor;if(t.type!==n.getType()&&ge(130,n.name),fe(e)){let o=t.children;Array.isArray(o)||ge(59,n.name);let r=e.getChildren();for(let a=0;a<r.length;a++){let s=sE(r[a]);o.push(s)}}return t}function dG(e){return e instanceof cu}var cu=class e{_nodeMap;_selection;_flushSync;_readOnly;constructor(t,n){this._nodeMap=t,this._selection=n||null,this._flushSync=!1,this._readOnly=!1}isEmpty(){return this._nodeMap.size===1&&this._selection===null}read(t,n){return $R(n&&n.editor||null,this,t)}clone(t){let n=new e(this._nodeMap,t===void 0?this._selection:t);return n._readOnly=!0,n}toJSON(){return $R(null,this,()=>({root:sE(Eo())}))}},_m=class extends os{static getType(){return"artificial"}createDOM(t){return document.createElement("div")}},Nl=class e extends os{static getType(){return"paragraph"}static clone(t){return new e(t.__key)}createDOM(t){let n=document.createElement("p"),o=Ll(t.theme,"paragraph");return o!==void 0&&n.classList.add(...o),n}updateDOM(t,n,o){return!1}static importDOM(){return{p:t=>({conversion:cG,priority:0})}}exportDOM(t){let{element:n}=super.exportDOM(t);if(no(n)){this.isEmpty()&&n.append(document.createElement("br"));let o=this.getFormatType();o&&(n.style.textAlign=o)}return{element:n}}static importJSON(t){return ma().updateFromJSON(t)}exportJSON(){let t=super.exportJSON();if(t.textFormat===void 0||t.textStyle===void 0){let n=this.getChildren().find(Oe);n?(t.textFormat=n.getFormat(),t.textStyle=n.getStyle()):(t.textFormat=this.getTextFormat(),t.textStyle=this.getTextStyle())}return t}insertNewAfter(t,n){let o=ma();o.setTextFormat(t.format),o.setTextStyle(t.style);let r=this.getDirection();return o.setDirection(r),o.setFormat(this.getFormatType()),o.setStyle(this.getStyle()),this.insertAfter(o,n),o}collapseAtStart(){let t=this.getChildren();if(t.length===0||Oe(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 cG(e){let t=ma();if(e.style&&(t.setFormat(e.style.textAlign),LE(e,t)),t.getFormatType()===""){let n=e.getAttribute("align");n&&n&&n in By&&t.setFormat(n)}return{node:t}}function ma(){return yu(new Nl)}function iE(e){return e instanceof Nl}var Il=0,uG=1,fG=2,pG=3,mG=4;function lE(e,t,n,o){let r=e._keyToDOMMap;r.clear(),e._editorState=NC(),e._pendingEditorState=o,e._compositionKey=null,e._dirtyType=0,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements.clear(),e._normalizedNodes=new Set,e._updateTags=new Set,e._updates=[],e._blockCursorElement=null;let a=e._observer;a!==null&&(a.disconnect(),e._observer=null),t!==null&&(t.textContent=""),n!==null&&(n.textContent="",r.set("root",n))}function dE(e){let t=new Set,n=new Set,o=e;for(;o;){let{ownNodeConfig:r}=Cu(o),a=o.transform;if(!n.has(a)){n.add(a);let s=o.transform();s&&t.add(s)}if(r){let s=r.$transform;s&&t.add(s),o=r.extends}else{let s=Object.getPrototypeOf(o);o=s.prototype instanceof Go&&s!==Go?s:void 0}}return t}function gG(e){let t=e||{},n=iG(),o=t.theme||{},r=e===void 0?n:t.parentEditor||null,a=t.disableEvents||!1,s=NC(),i=t.namespace||(r!==null?r._config.namespace:vE()),l=t.editorState,d=[Ml,gi,Rl,El,Nl,_m,...t.nodes||[]],{onError:u,html:f}=t,p=t.editable===void 0||t.editable,m;if(e===void 0&&n!==null)m=n._nodes;else{m=new Map;for(let g=0;g<d.length;g++){let v=d[g],C=null,y=null;if(typeof v!="function"){let I=v;v=I.replace,C=I.with,y=I.withKlass||null}Cu(v);let x=v.getType(),b=dE(v);m.set(x,{exportDOM:f&&f.export?f.export.get(v):void 0,klass:v,replace:C,replaceWithKlass:y,sharedNodeState:cA(d[g]),transforms:b})}}let h=new rs(s,r,m,{disableEvents:a,namespace:i,theme:o},u||console.error,(function(g,v){let C=new Map,y=new Set,x=b=>{Object.keys(b).forEach(I=>{let T=C.get(I);T===void 0&&(T=[],C.set(I,T)),T.push(b[I])})};return g.forEach(b=>{let I=b.klass.importDOM;if(I==null||y.has(I))return;y.add(I);let T=I.call(b.klass);T!==null&&x(T)}),v&&x(v),C})(m,f?f.import:void 0),p,e);return l!==void 0&&(h._pendingEditorState=l,h._dirtyType=2),(function(g){g.registerCommand(CC,Fj,Il),g.registerCommand(xC,Bj,Il),g.registerCommand(bC,Uj,Il),g.registerCommand(wC,zj,Il),g.registerCommand(kC,Hj,Il)})(h),h}var rs=class{static version;_headless;_parentEditor;_rootElement;_editorState;_pendingEditorState;_compositionKey;_deferred;_keyToDOMMap;_updates;_updating;_listeners;_commands;_nodes;_decorators;_pendingDecorators;_config;_dirtyType;_cloneNotNeeded;_dirtyLeaves;_dirtyElements;_normalizedNodes;_updateTags;_observer;_key;_onError;_htmlConversions;_window;_editable;_blockCursorElement;_createEditorArgs;constructor(t,n,o,r,a,s,i,l){this._createEditorArgs=l,this._parentEditor=n,this._rootElement=null,this._editorState=t,this._pendingEditorState=null,this._compositionKey=null,this._deferred=[],this._keyToDOMMap=new Map,this._updates=[],this._updating=!1,this._listeners={decorator:new Set,editable:new Set,mutation:new Map,root:new Set,textcontent:new Set,update:new Set},this._commands=new Map,this._config=r,this._nodes=o,this._decorators={},this._pendingDecorators=null,this._dirtyType=0,this._cloneNotNeeded=new Set,this._dirtyLeaves=new Set,this._dirtyElements=new Map,this._normalizedNodes=new Set,this._updateTags=new Set,this._observer=null,this._key=vE(),this._onError=a,this._htmlConversions=s,this._editable=i,this._headless=n!==null&&n._headless,this._window=null,this._blockCursorElement=null}isComposing(){return this._compositionKey!=null}registerUpdateListener(t){let n=this._listeners.update;return n.add(t),()=>{n.delete(t)}}registerEditableListener(t){let n=this._listeners.editable;return n.add(t),()=>{n.delete(t)}}registerDecoratorListener(t){let n=this._listeners.decorator;return n.add(t),()=>{n.delete(t)}}registerTextContentListener(t){let n=this._listeners.textcontent;return n.add(t),()=>{n.delete(t)}}registerRootListener(t){let n=this._listeners.root;return t(this._rootElement,null),n.add(t),()=>{t(null,this._rootElement),n.delete(t)}}registerCommand(t,n,o){o===void 0&&ge(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&&ge(36,String(t));let s=a[o];return s.add(n),()=>{s.delete(n),a.every(i=>i.size===0)&&r.delete(t)}}registerMutationListener(t,n,o){let r=this.resolveRegisteredNodeAfterReplacements(this.getRegisteredNode(t)).klass,a=this._listeners.mutation,s=a.get(n);s===void 0&&(s=new Set,a.set(n,s)),s.add(r);let i=o&&o.skipInitialization;return i!==void 0&&i||this.initializeMutationListener(n,r),()=>{s.delete(r),s.size===0&&a.delete(n)}}getRegisteredNode(t){let n=this._nodes.get(t.getType());return n===void 0&&ge(37,t.name),n}resolveRegisteredNodeAfterReplacements(t){for(;t.replaceWithKlass;)t=this.getRegisteredNode(t.replaceWithKlass);return t}initializeMutationListener(t,n){let o=this._editorState,r=cC(o).get(n.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:o,updateTags:new Set(["registerMutationListener"])})}registerNodeTransformToKlass(t,n){let o=this.getRegisteredNode(t);return o.transforms.add(n),o}registerNodeTransform(t,n){let o=this.registerNodeTransformToKlass(t,n),r=[o],a=o.replaceWithKlass;if(a!=null){let s=this.registerNodeTransformToKlass(a,n);r.push(s)}return(function(s,i){let l=cC(s.getEditorState()),d=[];for(let u of i){let f=l.get(u);f&&d.push(f)}d.length!==0&&s.update(()=>{for(let u of d)for(let f of u.keys()){let p=yn(f);p&&p.markDirty()}},s._pendingEditorState===null?{tag:ym}:void 0)})(this,r.map(s=>s.klass.getType())),()=>{r.forEach(s=>s.transforms.delete(n))}}hasNode(t){return this._nodes.has(t.getType())}hasNodes(t){return t.every(this.hasNode.bind(this))}dispatchCommand(t,n){return Le(this,t,n)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(t){let n=this._rootElement;if(t!==n){let o=Ll(this._config.theme,"root"),r=this._pendingEditorState||this._editorState;if(this._rootElement=t,lE(this,n,t,r),n!==null&&(this._config.disableEvents||Kj(n),o!=null&&n.classList.remove(...o)),t!==null){let a=qC(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,dA(this),this._updateTags.add(ym),fa(this),this._config.disableEvents||(function(i,l){let d=i.ownerDocument;Zy.set(i,d);let u=Lm.get(d)??0;u<1&&d.addEventListener("selectionchange",KA),Lm.set(d,u+1),i.__lexicalEditor=l;let f=HA(i);for(let p=0;p<Jy.length;p++){let[m,h]=Jy[p],g=typeof h=="function"?v=>{TR(v)||(IR(v),(l.isEditable()||m==="click")&&h(v,l))}:v=>{if(TR(v))return;IR(v);let C=l.isEditable();switch(m){case"cut":return C&&Le(l,LC,v);case"copy":return Le(l,PC,v);case"paste":return C&&Le(l,SC,v);case"dragstart":return C&&Le(l,RA,v);case"dragover":return C&&Le(l,AA,v);case"dragend":return C&&Le(l,EA,v);case"focus":return C&&Le(l,MA,v);case"blur":return C&&Le(l,NA,v);case"drop":return C&&Le(l,LA,v)}};i.addEventListener(m,g),f.push(()=>{i.removeEventListener(m,g)})}})(t,this),o!=null&&t.classList.add(...o)}else this._window=null,this._updateTags.add(ym),fa(this);Jc("root",this,!1,t,n)}}getElementByKey(t){return this._keyToDOMMap.get(t)||null}getEditorState(){return this._editorState}setEditorState(t,n){t.isEmpty()&&ge(38);let o=t;o._readOnly&&(o=aE(t),o._selection=t._selection?t._selection.clone():null),lA(this);let r=this._pendingEditorState,a=this._updateTags,s=n!==void 0?n.tag:null;r===null||r.isEmpty()||(s!=null&&a.add(s),fa(this)),this._pendingEditorState=o,this._dirtyType=2,this._dirtyElements.set("root",!1),this._compositionKey=null,s!=null&&a.add(s),this._updating||fa(this)}parseEditorState(t,n){return(function(o,r,a){let s=NC(),i=Rn,l=Co,d=An,u=r._dirtyElements,f=r._dirtyLeaves,p=r._cloneNotNeeded,m=r._dirtyType;r._dirtyElements=new Map,r._dirtyLeaves=new Set,r._cloneNotNeeded=new Set,r._dirtyType=0,Rn=s,Co=!1,An=r,_C(null);try{let h=r._nodes;MC(o.root,h),a&&a(),s._readOnly=!0}catch(h){h instanceof Error&&r._onError(h)}finally{r._dirtyElements=u,r._dirtyLeaves=f,r._cloneNotNeeded=p,r._dirtyType=m,Rn=i,Co=l,An=d}return s})(typeof t=="string"?JSON.parse(t):t,this,n)}read(t){return fa(this),this.getEditorState().read(t,{editor:this})}update(t,n){(function(o,r,a){o._updating?o._updates.push([r,a]):Vm(o,r,a)})(this,t,n)}focus(t,n={}){let o=this._rootElement;o!==null&&(o.setAttribute("autocapitalize","off"),Or(this,()=>{let r=Rt(),a=Eo();r!==null?r.dirty||xo(r.clone()):a.getChildrenSize()!==0&&(n.defaultSelection==="rootStart"?a.selectStart():a.selectEnd()),Gm("focus"),wE(()=>{o.removeAttribute("autocapitalize"),t&&t()})}),this._pendingEditorState===null&&o.removeAttribute("autocapitalize"))}blur(){let t=this._rootElement;t!==null&&t.blur();let n=yr(this._window);n!==null&&n.removeAllRanges()}isEditable(){return this._editable}setEditable(t){this._editable!==t&&(this._editable=t,Jc("editable",this,!0,t))}toJSON(){return{editorState:this._editorState.toJSON()}}};rs.version="0.41.0+prod.esm";var iC=null;function _C(e){iC=e}var cE=1;function hG(){cE=1}function DC(e,t){let n=OC(e,t);return n===void 0&&ge(30,t),n}function OC(e,t){return e._nodes.get(t)}var vG=typeof queueMicrotask=="function"?queueMicrotask:e=>{Promise.resolve().then(e)};function uE(e){return Wt(jm(e))}function FC(e){let t=document.activeElement;if(!no(t))return!1;let n=t.nodeName;return Wt(jm(e))&&(n==="INPUT"||n==="TEXTAREA"||t.contentEditable==="true"&&hu(t)==null)}function gu(e,t,n){let o=e.getRootElement();try{return o!==null&&o.contains(t)&&o.contains(n)&&t!==null&&!FC(t)&&BC(t)===e}catch{return!1}}function qm(e){return e instanceof rs}function BC(e){let t=e;for(;t!=null;){let n=hu(t);if(qm(n))return n;t=vu(t)}return null}function hu(e){return e?e.__lexicalEditor:null}function yG(e){return cj.test(e)?"rtl":uj.test(e)?"ltr":null}function es(e){return AC(e)||e.isToken()}function ua(e){return es(e)||e.isSegmented()}function Fr(e){return Hl(e)&&e.nodeType===3}function fE(e){return Hl(e)&&e.nodeType===9}function vi(e){let t=e;for(;t!=null;){if(Fr(t))return t;t=t.firstChild}return null}function uu(e,t,n){let o=Kn[t];if(n!==null&&(e&o)===(n&o))return e;let r=e^o;return t==="subscript"?r&=~Kn.superscript:t==="superscript"?r&=~Kn.subscript:t==="lowercase"?(r&=~Kn.uppercase,r&=~Kn.capitalize):t==="uppercase"?(r&=~Kn.lowercase,r&=~Kn.capitalize):t==="capitalize"&&(r&=~Kn.lowercase,r&=~Kn.uppercase),r}function CG(e){return Oe(e)||fi(e)||Wt(e)}function pE(e,t){let n=(function(){let s=iC;return iC=null,s})();if((t=t||n&&n.__key)!=null)return void(e.__key=t);Pn(),nE();let o=Ut(),r=va(),a=""+cE++;r._nodeMap.set(a,e),fe(e)?o._dirtyElements.set(a,!0):o._dirtyLeaves.add(a),o._cloneNotNeeded.add(a),o._dirtyType=1,e.__key=a}function ts(e){let t=e.getParent();if(t!==null){let n=e.getWritable(),o=t.getWritable(),r=e.getPreviousSibling(),a=e.getNextSibling(),s=a!==null?a.__key:null,i=r!==null?r.__key:null,l=r!==null?r.getWritable():null,d=a!==null?a.getWritable():null;r===null&&(o.__first=s),a===null&&(o.__last=i),l!==null&&(l.__next=s),d!==null&&(d.__prev=i),n.__prev=null,n.__next=null,n.__parent=null,o.__size--}}function Dm(e){nE(),Am(e)&&ge(323,e.__key,e.__type);let t=e.getLatest(),n=t.__parent,o=va(),r=Ut(),a=o._nodeMap,s=r._dirtyElements;n!==null&&(function(l,d,u){let f=l;for(;f!==null;){if(u.has(f))return;let p=d.get(f);if(p===void 0)break;u.set(f,!1),f=p.__parent}})(n,a,s);let i=t.__key;r._dirtyType=1,fe(e)?s.set(i,!0):r._dirtyLeaves.add(i)}function Ln(e){Pn();let t=Ut(),n=t._compositionKey;if(e!==n){if(t._compositionKey=e,n!==null){let o=yn(n);o!==null&&o.getWritable()}if(e!==null){let o=yn(e);o!==null&&o.getWritable()}}}function Za(){return zl()?null:Ut()._compositionKey}function yn(e,t){let n=(t||va())._nodeMap.get(e);return n===void 0?null:n}function UC(e,t){let n=Wm(e,Ut());return n!==void 0?yn(n,t):null}function Wm(e,t){return e[`__lexicalKey_${t._key}`]}function jm(e,t){let n=e;for(;n!=null;){let o=UC(n,t);if(o!==null)return o;n=vu(n)}return null}function mE(e){let t=e._decorators,n=Object.assign({},t);return e._pendingDecorators=n,n}function jR(e){return e.read(()=>Eo().getTextContent())}function Eo(){return gE(va())}function gE(e){return e._nodeMap.get("root")}function xo(e){Pn();let t=va();e!==null&&(e.dirty=!0,e.setCachedNodes(null)),t._selection=e}function Tl(e){let t=Ut(),n=(function(o,r){let a=o;for(;a!=null;){let s=Wm(a,r);if(s!==void 0)return s;a=vu(a)}return null})(e,t);return n===null?e===t.getRootElement()?yn("root"):null:yn(n)}function hE(e){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(e)}function zC(e){let t=[],n=e;for(;n!==null;)t.push(n),n=n._parentEditor;return t}function vE(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,5)}function yE(e){return Fr(e)?e.nodeValue:null}function HC(e,t,n){let o=yr(Mo(t));if(o===null)return;let r=o.anchorNode,{anchorOffset:a,focusOffset:s}=o;if(r!==null){let i=yE(r),l=jm(r);if(i!==null&&Oe(l)){if((i===nu||i===gC)&&n){let d=n.length;i=n,a=d,s=d}i!==null&&KC(l,i,a,s,e)}}}function KC(e,t,n,o,r){let a=e;if(a.isAttached()&&(r||!a.isDirty())){let s=a.isComposing(),i=t;if((s||r)&&(t.endsWith(nu)&&(i=t.slice(0,-nu.length)),r)){let d=gC,u;for(;(u=i.indexOf(d))!==-1;)i=i.slice(0,u)+i.slice(u+d.length),n!==null&&n>u&&(n=Math.max(u,n-d.length)),o!==null&&o>u&&(o=Math.max(u,o-d.length))}let l=a.getTextContent();if(r||i!==l){if(i===""){if(Ln(null),Bm||pu||Um)a.remove();else{let g=Ut();setTimeout(()=>{g.update(()=>{a.isAttached()&&a.remove()})},20)}return}let d=a.getParent(),u=Ci(),f=a.getTextContentSize(),p=Za(),m=a.getKey();if(a.isToken()||p!==null&&m===p&&!s||je(u)&&(d!==null&&!d.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===f&&!a.canInsertTextAfter()&&!s))return void a.markDirty();let h=Rt();if(!je(h)||n===null||o===null)return void GR(a,i,h);if(h.setTextNodeRange(a,n,a,o),a.isSegmented()){let g=kn(a.getTextContent());a.replace(g),a=g}GR(a,i,h)}}}function GR(e,t,n){if(e.setTextContent(t),je(n)){let o=e.getKey();for(let r of["anchor","focus"]){let a=n[r];a.type==="text"&&a.key===o&&(a.offset=gr(e,a.offset,"clamp"))}}}function fm(e,t,n){let o=t[n]||!1;return o==="any"||o===e[n]}function CE(e,t){return fm(e,t,"altKey")&&fm(e,t,"ctrlKey")&&fm(e,t,"shiftKey")&&fm(e,t,"metaKey")}function Mt(e,t,n){if(!CE(e,n))return!1;if(e.key.toLowerCase()===t.toLowerCase())return!0;if(t.length>1||e.key.length===1&&e.key.charCodeAt(0)<=127)return!1;let o="Key"+t.toUpperCase();return e.code===o}var ca={ctrlKey:!ur,metaKey:ur},QR={altKey:ur,ctrlKey:!ur};function XR(e){return e.key==="Backspace"}function YR(e){return Mt(e,"a",ca)}function xG(e){let t=Eo();if(je(e)){let n=e.anchor,o=e.focus,r=n.getNode().getTopLevelElementOrThrow().getParentOrThrow();return n.set(r.getKey(),0,"element"),o.set(r.getKey(),r.getChildrenSize(),"element"),wm(e),e}{let n=t.select(0,t.getChildrenSize());return xo(wm(n)),n}}function Ll(e,t){e.__lexicalClassNameCache===void 0&&(e.__lexicalClassNameCache={});let n=e.__lexicalClassNameCache,o=n[t];if(o!==void 0)return o;let r=e[t];if(typeof r=="string"){let a=xu(r);return n[t]=a,a}return r}function $C(e,t,n,o,r){if(n.size===0)return;let a=o.__type,s=o.__key,i=t.get(a);i===void 0&&ge(33,a);let l=i.klass,d=e.get(l);d===void 0&&(d=new Map,e.set(l,d));let u=d.get(s),f=u==="destroyed"&&r==="created";(u===void 0||f)&&d.set(s,f?"updated":r)}function bG(e){let t=e.getType(),n=va();if(n._readOnly){let a=cC(n).get(t);return a?Array.from(a.values()):[]}let o=n._nodeMap,r=[];for(let[,a]of o)a instanceof e&&a.__type===t&&a.isAttached()&&r.push(a);return r}function JR(e,t,n){let o=e.getParent(),r=n,a=e;return o!==null&&(t&&n===0?(r=a.getIndexWithinParent(),a=o):t||n!==a.getChildrenSize()||(r=a.getIndexWithinParent()+1,a=o)),a.getChildAtIndex(t?r-1:r)}function xE(e,t){let n=e.offset;if(e.type==="element")return JR(e.getNode(),t,n);{let o=e.getNode();if(t&&n===0||!t&&n===o.getTextContentSize()){let r=t?o.getPreviousSibling():o.getNextSibling();return r===null?JR(o.getParentOrThrow(),t,o.getIndexWithinParent()+(t?0:1)):r}}return null}function bE(e){let t=Mo(e).event,n=t&&t.inputType;return n==="insertFromPaste"||n==="insertFromPasteAsQuotation"}function Le(e,t,n){return(function(o,r,a){let s=zC(o);for(let i=4;i>=0;i--)for(let l=0;l<s.length;l++){let d=s[l],u=d._commands.get(r);if(u!==void 0){let f=u[i];if(f!==void 0){let p=Array.from(f),m=p.length,h=!1;if(Or(d,()=>{for(let g=0;g<m;g++)if(p[g](a,o))return void(h=!0)}),h)return h}}}return!1})(e,t,n)}function _l(e,t){let n=e._keyToDOMMap.get(t);return n===void 0&&ge(75,t),n}function vu(e){let t=e.assignedSlot||e.parentElement;return kE(t)?t.host:t}function VC(e){return fE(e)?e:no(e)?e.ownerDocument:null}function wG(e){return Ut()._updateTags.has(e)}function Gm(e){Pn(),Ut()._updateTags.add(e)}function wE(e){Pn(),Ut()._deferred.push(e)}function Om(e,t){let n=e.getParent();for(;n!==null;){if(n.is(t))return!0;n=n.getParent()}return!1}function qC(e){let t=VC(e);return t?t.defaultView:null}function Mo(e){let t=e._window;return t===null&&ge(78),t}function SG(e){return fe(e)&&e.isInline()||Wt(e)&&e.isInline()}function SE(e){let t=e.getParentOrThrow();for(;t!==null;){if(Qo(t))return t;t=t.getParentOrThrow()}return t}function Qo(e){return Nn(e)||fe(e)&&e.isShadowRoot()}function WC(e){let t=e.constructor.clone(e);return pE(t,null),t.afterCloneFrom(e),t}function yu(e){let t=Ut(),n=e.getType(),o=OC(t,n);o===void 0&&ge(200,e.constructor.name,n);let{replace:r,replaceWithKlass:a}=o;if(r!==null){let s=r(e),i=s.constructor;return a!==null?s instanceof a||ge(201,a.name,a.getType(),i.name,i.getType(),e.constructor.name,n):s instanceof e.constructor&&i!==e.constructor||ge(202,i.name,i.getType(),e.constructor.name,n),s.__key===e.__key&&ge(203,e.constructor.name,n,i.name,i.getType()),s}return e}function _y(e,t){!Nn(e.getParent())||fe(t)||Wt(t)||ge(99)}function IE(e){let t=yn(e);return t===null&&ge(63,e),t}function Dy(e){return(Wt(e)||fe(e)&&!e.canBeEmpty())&&!e.isInline()}function lC(e,t,n){n.style.removeProperty("caret-color"),t._blockCursorElement=null;let o=e.parentElement;o!==null&&o.removeChild(e)}function yr(e){return vr?(e||window).getSelection():null}function TE(e){let t=qC(e);return t?t.getSelection():null}function IG(e,t){let n=e.getChildAtIndex(t);n==null&&(n=e),Qo(e)&&ge(102);let o=s=>{let i=s.getParentOrThrow(),l=Qo(i),d=s!==n||l?WC(s):s;if(l)return fe(s)&&fe(d)||ge(133),s.insertAfter(d),[s,d,d];{let[u,f,p]=o(i),m=s.getNextSiblings();return p.append(d,...m),[u,f,d]}},[r,a]=o(n);return[r,a]}function TG(e){return no(e)&&e.tagName==="A"}function no(e){return Hl(e)&&e.nodeType===1}function Hl(e){return typeof e=="object"&&e!==null&&"nodeType"in e&&typeof e.nodeType=="number"}function kE(e){return Hl(e)&&e.nodeType===11}function PE(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 dC(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 pa(e){if(Wt(e)&&!e.isInline())return!0;if(!fe(e)||Qo(e))return!1;let t=e.getFirstChild(),n=t===null||fi(t)||Oe(t)||t.isInline();return!e.isInline()&&e.canBeEmpty()!==!1&&n}function jC(){return Ut()}var ZR=new WeakMap,kG=new Map;function cC(e){if(!e._readOnly&&e.isEmpty())return kG;e._readOnly||ge(192);let t=ZR.get(e);return t||(t=(function(n){let o=new Map;for(let[r,a]of n._nodeMap){let s=a.__type,i=o.get(s);i||(i=new Map,o.set(s,i)),i.set(r,a)}return o})(e),ZR.set(e,t)),t}function GC(e){let t=e.constructor.clone(e);return t.afterCloneFrom(e),t}function PG(e){return(t=GC(e))[$A]=!0,t;var t}function LE(e,t){let n=parseInt(e.style.paddingInlineStart,10)||0,o=Math.round(n/40);t.setIndent(o)}function LG(e){e.__lexicalUnmanaged=!0}function RE(e){return e.__lexicalUnmanaged===!0}function Gc(e,t){return(function(n,o){return Object.prototype.hasOwnProperty.call(n,o)})(e,t)&&e[t]!==Go[t]}function Cu(e){let t=uR in e.prototype?e.prototype[uR]():void 0,n=(function(s){if(!(s===Go||s.prototype instanceof Go)){let i="<unknown>",l="<unknown>";try{i=s.getType()}catch{}try{rs.version&&(l=JSON.parse(rs.version))}catch{}ge(290,s.name,i,l)}return s===du||s===os||s===Go})(e),o=!n&&Gc(e,"getType")?e.getType():void 0,r,a=o;if(t)if(o)r=t[o];else for(let[s,i]of Object.entries(t))a=s,r=i;if(!n&&a&&(Gc(e,"getType")||(e.getType=()=>a),Gc(e,"clone")||(e.clone=s=>(_C(s),new e)),Gc(e,"importJSON")||(e.importJSON=r&&r.$importJSON||(s=>new e().updateFromJSON(s))),!Gc(e,"importDOM")&&r)){let{importDOM:s}=r;s&&(e.importDOM=()=>s)}return{ownNodeConfig:r,ownNodeType:a}}function RG(e){let t=jC();return Pn(),new(t.resolveRegisteredNodeAfterReplacements(t.getRegisteredNode(e))).klass}var Zc=(e,t)=>{let n=e;for(;n!=null&&!Nn(n);){if(t(n))return n;n=n.getParent()}return null},AG={next:"previous",previous:"next"},Dl=class{origin;constructor(t){this.origin=t}[Symbol.iterator](){return YC({hasNext:yi,initial:this.getAdjacentCaret(),map:t=>t,step:t=>t.getAdjacentCaret()})}getAdjacentCaret(){return En(this.getNodeAtCaret(),this.direction)}getSiblingCaret(){return En(this.origin,this.direction)}remove(){let t=this.getNodeAtCaret();return t&&t.remove(),this}replaceOrInsert(t,n){let o=this.getNodeAtCaret();return t.is(this.origin)||t.is(o)||(o===null?this.insert(t):o.replace(t,n)),this}splice(t,n,o="next"){let r=o===this.direction?n:Array.from(n).reverse(),a=this,s=this.getParentAtCaret(),i=new Map;for(let l=a.getAdjacentCaret();l!==null&&i.size<t;l=l.getAdjacentCaret()){let d=l.origin.getWritable();i.set(d.getKey(),d)}for(let l of r){if(i.size>0){let d=a.getNodeAtCaret();if(d){if(i.delete(d.getKey()),i.delete(l.getKey()),!(d.is(l)||a.origin.is(l))){let u=l.getParent();u&&u.is(s)&&l.remove(),d.replace(l)}}else d===null&&ge(263,Array.from(i).join(" "))}else a.insert(l);a=En(l,this.direction)}for(let l of i.values())l.remove();return this}},fu=class e extends Dl{type="child";getLatest(){let t=this.origin.getLatest();return t===this.origin?this:ha(t,this.direction)}getParentCaret(t="root"){return En(QC(this.getParentAtCaret(),t),this.direction)}getFlipped(){let t=ds(this.direction);return En(this.getNodeAtCaret(),t)||ha(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)}},EG={root:Nn,shadowRoot:Qo};function ds(e){return AG[e]}function QC(e,t="root"){return EG[t](e)?null:e}var Ol=class e extends Dl{type="sibling";getLatest(){let t=this.origin.getLatest();return t===this.origin?this:En(t,this.direction)}getSiblingCaret(){return this}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return fe(this.origin)?ha(this.origin,this.direction):null}getParentCaret(t="root"){return En(QC(this.getParentAtCaret(),t),this.direction)}getFlipped(){let t=ds(this.direction);return En(this.getNodeAtCaret(),t)||ha(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 Fl)&&this.direction===t.direction&&this.origin.is(t.origin)}},Fl=class e extends Dl{type="text";offset;constructor(t,n){super(t),this.offset=n}getLatest(){let t=this.origin.getLatest();return t===this.origin?this:as(t,this.direction,this.offset)}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return null}getParentCaret(t="root"){return En(QC(this.getParentAtCaret(),t),this.direction)}getFlipped(){return as(this.origin,ds(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 Ol||t instanceof e)&&this.direction===t.direction&&this.origin.is(t.origin)}getSiblingCaret(){return En(this.origin,this.direction)}};function ga(e){return e instanceof Fl}function MG(e){return e instanceof Dl}function yi(e){return e instanceof Ol}function mr(e){return e instanceof fu}var NG={next:class extends Fl{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends Fl{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},_G={next:class extends Ol{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends Ol{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},DG={next:class extends fu{direction="next";getNodeAtCaret(){return this.origin.getFirstChild()}insert(e){return this.origin.splice(0,0,[e]),this}},previous:class extends fu{direction="previous";getNodeAtCaret(){return this.origin.getLastChild()}insert(e){return this.origin.splice(this.origin.getChildrenSize(),0,[e]),this}}};function En(e,t){return e?new _G[t](e):null}function as(e,t,n){return e?new NG[t](e,gr(e,n)):null}function gr(e,t,n="error"){let o=e.getTextContentSize(),r=t==="next"?o:t==="previous"?0:t;return(r<0||r>o)&&(n!=="clamp"&&nA(284,String(t),String(o),e.getKey()),r=r<0?0:o),r}function uC(e,t){return new Fm(e,t)}function ha(e,t){return fe(e)?new DG[t](e):null}function AE(e){return e&&e.getChildCaret()||e}function Bl(e){return e&&AE(e.getAdjacentCaret())}var fC=class e{type="node-caret-range";direction;anchor;focus;constructor(t,n,o){this.anchor=t,this.focus=n,this.direction=o}getLatest(){let t=this.anchor.getLatest(),n=this.focus.getLatest();return t===this.anchor&&n===this.focus?this:new e(t,n,this.direction)}isCollapsed(){return this.anchor.isSamePointCaret(this.focus)}getTextSlices(){let t=r=>{let a=this[r].getLatest();return ga(a)?(function(s,i){let{direction:l,origin:d}=s,u=gr(d,i==="focus"?ds(l):l);return uC(s,u-s.offset)})(a,r):null},n=t("anchor"),o=t("focus");if(n&&o){let{caret:r}=n,{caret:a}=o;if(r.isSameNodeCaret(a))return[uC(r,a.offset-r.offset),null]}return[n,o]}iterNodeCarets(t="root"){let n=ga(this.anchor)?this.anchor.getSiblingCaret():this.anchor.getLatest(),o=this.focus.getLatest(),r=ga(o),a=s=>s.isSameNodeCaret(o)?null:Bl(s)||s.getParentCaret(t);return YC({hasNext:s=>s!==null&&!(r&&o.isSameNodeCaret(s)),initial:n.isSameNodeCaret(o)?null:a(n),map:s=>s,step:a})}[Symbol.iterator](){return this.iterNodeCarets("root")}},Fm=class{type="slice";caret;distance;constructor(t,n){this.caret=t,this.distance=n}getSliceIndices(){let{distance:t,caret:{offset:n}}=this,o=n+t;return o<n?[o,n]:[n,o]}getTextContent(){let[t,n]=this.getSliceIndices();return this.caret.origin.getTextContent().slice(t,n)}getTextContentSize(){return Math.abs(this.distance)}removeTextSlice(){let{caret:{origin:t,direction:n}}=this,[o,r]=this.getSliceIndices(),a=t.getTextContent();return as(t.setTextContent(a.slice(0,o)+a.slice(r)),n,o)}};function OG(e){return e instanceof Fm}function XC(e){return ss(e,En(Eo(),e.direction))}function EE(e){return ss(e,e)}function ss(e,t){return e.direction!==t.direction&&ge(265),new fC(e,t,e.direction)}function YC(e){let{initial:t,hasNext:n,step:o,map:r}=e,a=t;return{[Symbol.iterator](){return this},next(){if(!n(a))return{done:!0,value:void 0};let s={done:!1,value:r(a)};return a=o(a),s}}}function JC(e,t){let n=eu(e.origin,t.origin);switch(n===null&&ge(275,e.origin.getKey(),t.origin.getKey()),n.type){case"same":{let o=e.type==="text",r=t.type==="text";return o&&r?(function(a,s){return Math.sign(a-s)})(e.offset,t.offset):e.type===t.type?0:o?-1:r?1:e.type==="child"?-1:1}case"ancestor":return e.type==="child"?-1:1;case"descendant":return t.type==="child"?1:-1;case"branch":return ZC(n)}}function ZC(e){let{a:t,b:n}=e,o=t.__key,r=n.__key,a=t,s=n;for(;a&&s;a=a.getNextSibling(),s=s.getNextSibling()){if(a.__key===r)return-1;if(s.__key===o)return 1}return a===null?1:-1}function pm(e,t){return t.is(e)}function eA(e){return fe(e)?[e.getLatest(),null]:[e.getParent(),e.getLatest()]}function eu(e,t){if(e.is(t))return{commonAncestor:e,type:"same"};let n=new Map;for(let[o,r]=eA(e);o;r=o,o=o.getParent())n.set(o,r);for(let[o,r]=eA(t);o;r=o,o=o.getParent()){let a=n.get(o);if(a!==void 0)return a===null?(pm(e,o)||ge(276),{commonAncestor:o,type:"ancestor"}):r===null?(pm(t,o)||ge(277),{commonAncestor:o,type:"descendant"}):((fe(a)||pm(e,a))&&(fe(r)||pm(t,r))&&o.is(a.getParent())&&o.is(r.getParent())||ge(278),{a,b:r,commonAncestor:o,type:"branch"})}return null}function is(e,t){let{type:n,key:o,offset:r}=e,a=IE(e.key);return n==="text"?(Oe(a)||ge(266,a.getType(),o),as(a,t,r)):(fe(a)||ge(267,a.getType(),o),DE(a,e.offset,t))}function Ul(e,t){let{origin:n,direction:o}=t,r=o==="next";ga(t)?e.set(n.getKey(),t.offset,"text"):yi(t)?Oe(n)?e.set(n.getKey(),gr(n,o),"text"):e.set(n.getParentOrThrow().getKey(),n.getIndexWithinParent()+(r?1:0),"element"):(mr(t)&&fe(n)||ge(268),e.set(n.getKey(),r?0:n.getChildrenSize(),"element"))}function ME(e){let t=Rt(),n=je(t)?t:eE();return tu(n,e),xo(n),n}function tu(e,t){Ul(e.anchor,t.anchor),Ul(e.focus,t.focus)}function pC(e){let{anchor:t,focus:n}=e,o=is(t,"next"),r=is(n,"next"),a=JC(o,r)<=0?"next":"previous";return ss(ls(o,a),ls(r,a))}function Kl(e){let{direction:t,origin:n}=e,o=En(n,ds(t)).getNodeAtCaret();return o?En(o,t):ha(n.getParentOrThrow(),t)}function tA(e,t="root"){let n=[e];for(let o=mr(e)?e.getParentCaret(t):e.getSiblingCaret();o!==null;o=o.getParentCaret(t))n.push(Kl(o));return n}function Oy(e){return!!e&&e.origin.isAttached()}function NE(e,t="removeEmptySlices"){if(e.isCollapsed())return e;let n="root",o="next",r=t,a=ex(e,o),s=tA(a.anchor,n),i=tA(a.focus.getFlipped(),n),l=new Set,d=[];for(let h of a.iterNodeCarets(n))if(mr(h))l.add(h.origin.getKey());else if(yi(h)){let{origin:g}=h;fe(g)&&!l.has(g.getKey())||d.push(g)}for(let h of d)h.remove();for(let h of a.getTextSlices()){if(!h)continue;let{origin:g}=h.caret,v=g.getTextContentSize(),C=Kl(En(g,o)),y=g.getMode();if(Math.abs(h.distance)===v&&r==="removeEmptySlices"||y==="token"&&h.distance!==0)C.remove();else if(h.distance!==0){r="removeEmptySlices";let x=h.removeTextSlice(),b=h.caret.origin;if(y==="segmented"){let I=x.origin,T=kn(I.getTextContent()).setStyle(I.getStyle()).setFormat(I.getFormat());C.replaceOrInsert(T),x=as(T,o,x.offset)}b.is(s[0].origin)&&(s[0]=x),b.is(i[0].origin)&&(i[0]=x.getFlipped())}}let u,f;for(let h of s)if(Oy(h)){u=fr(h);break}for(let h of i)if(Oy(h)){f=fr(h);break}let p=(function(h,g,v){if(!h||!g)return null;let C=h.getParentAtCaret(),y=g.getParentAtCaret();if(!C||!y)return null;let x=C.getParents().reverse();x.push(C);let b=y.getParents().reverse();b.push(y);let I=Math.min(x.length,b.length),T;for(T=0;T<I&&x[T]===b[T];T++);let P=(L,R)=>{let N;for(let A=T;A<L.length;A++){let D=L[A];if(Qo(D))return;!N&&R(D)&&(N=D)}return N},k=P(x,pa),w=k&&P(b,L=>v.has(L.getKey())&&pa(L));return k&&w?[k,w]:null})(u,f,l);if(p){let[h,g]=p;ha(h,"previous").splice(0,g.getChildren());let v=g.getParent();for(g.remove(!0);v&&v.isEmpty();){let C=v;v=v.getParent(),C.remove(!0)}}let m=[u,f,...s,...i].find(Oy);if(m)return EE(ls(fr(m),e.direction));ge(269,JSON.stringify(s.map(h=>h.origin.__key)))}function fr(e){let t=(function(r){let a=r;for(;mr(a);){let s=Bl(a);if(!mr(s))break;a=s}return a})(e.getLatest()),{direction:n}=t;if(Oe(t.origin))return ga(t)?t:as(t.origin,n,n);let o=t.getAdjacentCaret();return yi(o)&&Oe(o.origin)?as(o.origin,n,ds(n)):t}function _E(e){return ga(e)&&e.offset!==gr(e.origin,e.direction)}function ls(e,t){return e.direction===t?e:e.getFlipped()}function ex(e,t){return e.direction===t?e:ss(ls(e.focus,t),ls(e.anchor,t))}function DE(e,t,n){let o=ha(e,"next");for(let r=0;r<t;r++){let a=o.getAdjacentCaret();if(a===null)break;o=a}return ls(o,n)}function FG(e,t="root"){let n=0,o=e,r=Bl(o);for(;r===null;){if(n--,r=o.getParentCaret(t),!r)return null;o=r,r=Bl(o)}return r&&[r,n]}function BG(e){let{origin:t,offset:n,direction:o}=e;if(n===gr(t,o))return e.getSiblingCaret();if(n===gr(t,ds(o)))return Kl(e.getSiblingCaret());let[r]=t.splitText(n);return Oe(r)||ge(281),ls(En(r,"next"),o)}function UG(e,t){return!0}function zG(e,{$copyElementNode:t=WC,$splitTextPointCaretNext:n=BG,rootMode:o="shadowRoot",$shouldSplit:r=UG}={}){if(ga(e))return n(e);let a=e.getParentCaret(o);if(a){let{origin:s}=a;if(mr(e)&&(!s.canBeEmpty()||!r(s,"first")))return Kl(a);let i=(function(l){let d=[];for(let u=l.getAdjacentCaret();u;u=u.getAdjacentCaret())d.push(u.origin);return d})(e);(i.length>0||s.canBeEmpty()&&r(s,"last"))&&a.insert(t(s).splice(0,0,i))}return a}function HG(e){return e}function KG(...e){return e}function $G(e,t){return[e,t]}function VG(e){return e}function qG(e,t){if(!t||e===t)return e;for(let n in t)if(e[n]!==t[n])return{...e,...t};return e}function xu(...e){let t=[];for(let n of e)if(n&&typeof n=="string")for(let[o]of n.matchAll(/\S+/g))t.push(o);return t}function WG(e,...t){let n=xu(...t);n.length>0&&e.classList.add(...n)}function jG(e,...t){let n=xu(...t);n.length>0&&e.classList.remove(...n)}function GG(...e){return()=>{for(let t=e.length-1;t>=0;t--)e[t]();e.length=0}}var O=tx,$pe=O.$addUpdateTag,cs=O.$applyNodeReplacement,$l=O.$caretFromPoint,OE=O.$caretRangeFromSelection,Qm=O.$cloneWithProperties,FE=O.$cloneWithPropertiesEphemeral,Vpe=O.$comparePointCaretNext,qpe=O.$copyNode,BE=O.$create,xi=O.$createLineBreakNode,UE=O.$createNodeSelection,Xo=O.$createParagraphNode,Wpe=O.$createPoint,bi=O.$createRangeSelection,zE=O.$createRangeSelectionFromDom,HE=O.$createTabNode,Cr=O.$createTextNode,KE=O.$extendCaretToRange,ya=O.$findMatchingParent,nx=O.$getAdjacentChildCaret,jpe=O.$getAdjacentNode,wi=O.$getAdjacentSiblingOrParentSiblingCaret,ox=O.$getCaretInDirection,$E=O.$getCaretRange,Gpe=O.$getCaretRangeInDirection,VE=O.$getCharacterOffsets,us=O.$getChildCaret,Qpe=O.$getChildCaretAtIndex,rx=O.$getChildCaretOrSelf,qE=O.$getCollapsedCaretRange,Xpe=O.$getCommonAncestor,Ype=O.$getCommonAncestorResultBranchOrder,Xm=O.$getEditor,Jpe=O.$getNearestNodeFromDOMNode,Zpe=O.$getNearestRootOrShadowRoot,Vl=O.$getNodeByKey,eme=O.$getNodeByKeyOrThrow,WE=O.$getNodeFromDOMNode,bu=O.$getPreviousSelection,Tt=O.$getRoot,De=O.$getSelection,Ca=O.$getSiblingCaret,Ym=O.$getState,tme=O.$getStateChange,nme=O.$getTextContent,ome=O.$getTextNodeOffset,rme=O.$getTextPointCaret,ame=O.$getTextPointCaretSlice,sme=O.$getWritableNodeState,jE=O.$hasAncestor,ime=O.$hasUpdateTag,lme=O.$insertNodes,ql=O.$isBlockElementNode,wu=O.$isChildCaret,Jm=O.$isDecoratorNode,GE=O.$isEditorState,qe=O.$isElementNode,QE=O.$isExtendableTextPointCaret,dme=O.$isInlineElementOrDecoratorNode,XE=O.$isLeafNode,Wl=O.$isLineBreakNode,cme=O.$isNodeCaret,ax=O.$isNodeSelection,YE=O.$isParagraphNode,ke=O.$isRangeSelection,Su=O.$isRootNode,Si=O.$isRootOrShadowRoot,JE=O.$isSiblingCaret,ume=O.$isTabNode,it=O.$isTextNode,Zm=O.$isTextPointCaret,fme=O.$isTextPointCaretSlice,sx=O.$isTokenOrSegmented,pme=O.$isTokenOrTab,mme=O.$nodesOfType,ZE=O.$normalizeCaret,eM=O.$normalizeSelection__EXPERIMENTAL,gme=O.$onUpdate,tM=O.$parseSerializedNode,hme=O.$removeTextFromCaretRange,nM=O.$rewindSiblingCaret,eg=O.$selectAll,vme=O.$setCompositionKey,yme=O.$setPointFromCaret,xr=O.$setSelection,oM=O.$setSelectionFromCaretRange,tg=O.$setState,rM=O.$splitAtPointCaretNext,aM=O.$splitNode,Cme=O.$updateRangeSelectionFromCaretRange,ix=O.ArtificialNode__DO_NOT_USE,xme=O.BEFORE_INPUT_COMMAND,sM=O.BLUR_COMMAND,Iu=O.CAN_REDO_COMMAND,Tu=O.CAN_UNDO_COMMAND,ng=O.CLEAR_EDITOR_COMMAND,iM=O.CLEAR_HISTORY_COMMAND,lM=O.CLICK_COMMAND,bme=O.COLLABORATION_TAG,og=O.COMMAND_PRIORITY_CRITICAL,jt=O.COMMAND_PRIORITY_EDITOR,Yo=O.COMMAND_PRIORITY_HIGH,jl=O.COMMAND_PRIORITY_LOW,wme=O.COMMAND_PRIORITY_NORMAL,Sme=O.COMPOSITION_END_COMMAND,dM=O.COMPOSITION_END_TAG,Ime=O.COMPOSITION_START_COMMAND,cM=O.COMPOSITION_START_TAG,uM=O.CONTROLLED_TEXT_INSERTION_COMMAND,rg=O.COPY_COMMAND,fM=O.CUT_COMMAND,ag=O.DELETE_CHARACTER_COMMAND,pM=O.DELETE_LINE_COMMAND,mM=O.DELETE_WORD_COMMAND,Tme=O.DRAGEND_COMMAND,kme=O.DRAGOVER_COMMAND,gM=O.DRAGSTART_COMMAND,hM=O.DROP_COMMAND,No=O.DecoratorNode,Pme=O.ElementNode,vM=O.FOCUS_COMMAND,Lme=O.FORMAT_ELEMENT_COMMAND,yM=O.FORMAT_TEXT_COMMAND,sg=O.HISTORIC_TAG,_o=O.HISTORY_MERGE_TAG,CM=O.HISTORY_PUSH_TAG,lx=O.INDENT_CONTENT_COMMAND,Rme=O.INPUT_COMMAND,dx=O.INSERT_LINE_BREAK_COMMAND,xM=O.INSERT_PARAGRAPH_COMMAND,bM=O.INSERT_TAB_COMMAND,ku=O.INTERNAL_$isBlock,Ame=O.IS_ALL_FORMATTING,Eme=O.IS_BOLD,Mme=O.IS_CODE,Nme=O.IS_HIGHLIGHT,_me=O.IS_ITALIC,Dme=O.IS_STRIKETHROUGH,Ome=O.IS_SUBSCRIPT,Fme=O.IS_SUPERSCRIPT,Bme=O.IS_UNDERLINE,wM=O.KEY_ARROW_DOWN_COMMAND,ig=O.KEY_ARROW_LEFT_COMMAND,lg=O.KEY_ARROW_RIGHT_COMMAND,SM=O.KEY_ARROW_UP_COMMAND,dg=O.KEY_BACKSPACE_COMMAND,IM=O.KEY_DELETE_COMMAND,TM=O.KEY_DOWN_COMMAND,cg=O.KEY_ENTER_COMMAND,kM=O.KEY_ESCAPE_COMMAND,Ume=O.KEY_MODIFIER_COMMAND,zme=O.KEY_SPACE_COMMAND,ug=O.KEY_TAB_COMMAND,PM=O.LineBreakNode,Hme=O.MOVE_TO_END,Kme=O.MOVE_TO_START,$me=O.NODE_STATE_KEY,LM=O.OUTDENT_CONTENT_COMMAND,fg=O.PASTE_COMMAND,RM=O.PASTE_TAG,AM=O.ParagraphNode,EM=O.REDO_COMMAND,MM=O.REMOVE_TEXT_COMMAND,NM=O.RootNode,Vme=O.SELECTION_CHANGE_COMMAND,_M=O.SELECTION_INSERT_CLIPBOARD_NODES_COMMAND,DM=O.SELECT_ALL_COMMAND,qme=O.SKIP_COLLAB_TAG,OM=O.SKIP_DOM_SELECTION_TAG,cx=O.SKIP_SCROLL_INTO_VIEW_TAG,Wme=O.SKIP_SELECTION_FOCUS_TAG,FM=O.TEXT_TYPE_TO_FORMAT,BM=O.TabNode,pg=O.TextNode,UM=O.UNDO_COMMAND,Pu=O.addClassNamesToElement,jme=O.buildImportMap,mg=O.configExtension,zM=O.createCommand,gg=O.createEditor,Gme=O.createSharedNodeState,HM=O.createState,KM=O.declarePeerDependency,un=O.defineExtension,Qme=O.flipDirection,Xme=O.getDOMOwnerDocument,ux=O.getDOMSelection,Yme=O.getDOMSelectionFromTarget,$M=O.getDOMTextNode,Jme=O.getEditorPropertyFromDOMNode,Zme=O.getNearestEditorFromDOMNode,VM=O.getRegisteredNode,ege=O.getRegisteredNodeOrThrow,tge=O.getStaticNodeConfig,nge=O.getTextDirection,oge=O.getTransformSetFromKlass,qM=O.isBlockDomNode,rge=O.isCurrentlyReadOnlyMode,WM=O.isDOMDocumentNode,jM=O.isDOMNode,age=O.isDOMTextNode,sge=O.isDOMUnmanaged,fx=O.isDocumentFragment,ige=O.isExactShortcutMatch,GM=O.isHTMLAnchorElement,hg=O.isHTMLElement,Lu=O.isInlineDomNode,lge=O.isLexicalEditor,dge=O.isModifierMatch,cge=O.isSelectionCapturedInDecoratorInput,QM=O.isSelectionWithinEditor,px=O.makeStepwiseIterator,Br=O.mergeRegister,uge=O.normalizeClassNames,vg=O.removeClassNamesFromElement,fge=O.removeFromParent,pge=O.resetRandomKey,br=O.safeCast,mge=O.setDOMUnmanaged,gge=O.setNodeIndentFromDOM,yg=O.shallowMergeConfig,mx=O.toggleTextFormatType;var gx={};cn(gx,{LexicalComposer:()=>XG});Y();var XM=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,QG=XM?pe:U,Cg={tag:_o};function XG({initialConfig:e,children:t}){let n=K(()=>{let{theme:o,namespace:r,nodes:a,onError:s,editorState:i,html:l}=e,d=cR(null,o),u=gg({editable:e.editable,html:l,namespace:r,nodes:a,onError:f=>s(f,u),theme:o});return(function(f,p){if(p!==null){if(p===void 0)f.update(()=>{let m=Tt();if(m.isEmpty()){let h=Xo();m.append(h);let g=XM?document.activeElement:null;(De()!==null||g!==null&&g===f.getRootElement())&&h.select()}},Cg);else if(p!==null)switch(typeof p){case"string":{let m=f.parseEditorState(p);f.setEditorState(m,Cg);break}case"object":f.setEditorState(p,Cg);break;case"function":f.update(()=>{Tt().isEmpty()&&p(f)},Cg)}}})(u,i),[u,d]},[]);return QG(()=>{let o=e.editable,[r]=n;r.setEditable(o===void 0||o)},[]),c(dR.Provider,{value:n,children:t})}var YG=gx,YM=YG.LexicalComposer;var vx={};cn(vx,{$canShowPlaceholder:()=>ZM,$canShowPlaceholderCurry:()=>ZG,$findTextIntersectionFromCharacters:()=>e8,$isRootTextContentEmpty:()=>hx,$isRootTextContentEmptyCurry:()=>JG,$rootTextContent:()=>JM,registerLexicalTextEntity:()=>n8});function JM(){return Tt().getTextContent()}function hx(e,t=!0){if(e)return!1;let n=JM();return t&&(n=n.trim()),n===""}function JG(e,t){return()=>hx(e,t)}function ZM(e){if(!hx(e,!1))return!1;let t=Tt().getChildren(),n=t.length;if(n>1)return!1;for(let o=0;o<n;o++){let r=t[o];if(Jm(r))return!1;if(qe(r)){if(!YE(r)||r.__indent!==0)return!1;let a=r.getChildren(),s=a.length;for(let i=0;i<s;i++){let l=a[o];if(!it(l))return!1}}}return!0}function ZG(e){return()=>ZM(e)}function e8(e,t){let n=e.getFirstChild(),o=0;e:for(;n!==null;){if(qe(n)){let s=n.getFirstChild();if(s!==null){n=s;continue}}else if(it(n)){let s=n.getTextContentSize();if(o+s>t)return{node:n,offset:t-o};o+=s}let r=n.getNextSibling();if(r!==null){n=r;continue}let a=n.getParent();for(;a!==null;){let s=a.getNextSibling();if(s!==null){n=s;continue e}a=a.getParent()}break}return null}function t8(e,...t){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(let r of t)o.append("v",r);throw n.search=o.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function n8(e,t,n,o){let r=s=>s instanceof n,a=s=>{let i=Cr(s.getTextContent());i.setFormat(s.getFormat()),s.replace(i)};return[e.registerNodeTransform(pg,s=>{if(!s.isSimpleText())return;let i,l=s.getPreviousSibling(),d=s.getTextContent(),u=s;if(it(l)){let p=l.getTextContent(),m=t(p+d);if(r(l)){if(m===null||(h=>h.getLatest().__mode)(l)!==0)return void a(l);{let h=m.end-p.length;if(h>0){let g=p+d.slice(0,h);if(l.select(),l.setTextContent(g),h===d.length)s.remove();else{let v=d.slice(h);s.setTextContent(v)}return}}}else if(m===null||m.start<p.length)return}let f=0;for(;;){i=t(d);let p,m=i===null?"":d.slice(i.end);if(d=m,m===""){let g=u.getNextSibling();if(it(g)){m=u.getTextContent()+g.getTextContent();let v=t(m);if(v===null)return void(r(g)?a(g):g.markDirty());if(v.start!==0)return}}if(i===null)return;if(i.start===0&&it(l)&&l.isTextEntity()){f+=i.end;continue}i.start===0?[p,u]=u.splitText(i.end):[,p,u]=u.splitText(i.start+f,i.end+f),p===void 0&&t8(165,"nodeToReplace");let h=o(p);if(h.setFormat(p.getFormat()),p.replace(h),u==null)return;f=0,l=h}}),e.registerNodeTransform(n,s=>{let i=s.getTextContent(),l=t(i);if(l===null||l.start!==0)return void a(s);if(i.length>l.end)return void s.splitText(l.end);let d=s.getPreviousSibling();it(d)&&d.isTextEntity()&&(a(d),a(s));let u=s.getNextSibling();it(u)&&u.isTextEntity()&&(a(u),r(s)&&a(s))})]}var Ii=vx,Sge=Ii.$canShowPlaceholder,xg=Ii.$canShowPlaceholderCurry,Ige=Ii.$findTextIntersectionFromCharacters,Tge=Ii.$isRootTextContentEmpty,kge=Ii.$isRootTextContentEmptyCurry,Pge=Ii.$rootTextContent,Lge=Ii.registerLexicalTextEntity;var Sx={};cn(Sx,{$addNodeStyle:()=>l8,$cloneWithProperties:()=>Qm,$copyBlockFormatIndent:()=>lN,$ensureForwardRangeSelection:()=>iN,$forEachSelectedTextNode:()=>sN,$getComputedStyleForElement:()=>xx,$getComputedStyleForParent:()=>bx,$getSelectionStyleValueForProperty:()=>h8,$isAtNodeEnd:()=>i8,$isParentElementRTL:()=>wx,$isParentRTL:()=>a8,$moveCaretSelection:()=>uN,$moveCharacter:()=>m8,$patchStyleText:()=>d8,$selectAll:()=>eg,$setBlocksType:()=>c8,$shouldOverrideDefaultCharacterSelection:()=>p8,$sliceSelectedTextNodeContent:()=>s8,$trimTextContentFromAnchor:()=>aN,$wrapNodes:()=>f8,createDOMRange:()=>o8,createRectsFromDOMRange:()=>r8,getCSSFromStyleObject:()=>rN,getStyleObjectFromCSS:()=>Sg,trimTextContentFromAnchor:()=>v8});function Cx(e,...t){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(let r of t)o.append("v",r);throw n.search=o.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var wg=new Map;function eN(e){let t=e;for(;t!=null;){if(t.nodeType===Node.TEXT_NODE)return t;t=t.firstChild}return null}function tN(e){let t=e.parentNode;if(t==null)throw new Error("Should never happen");return[t,Array.from(t.childNodes).indexOf(e)]}function o8(e,t,n,o,r){let a=t.getKey(),s=o.getKey(),i=document.createRange(),l=e.getElementByKey(a),d=e.getElementByKey(s),u=n,f=r;if(it(t)&&(l=eN(l)),it(o)&&(d=eN(d)),t===void 0||o===void 0||l===null||d===null)return null;l.nodeName==="BR"&&([l,u]=tN(l)),d.nodeName==="BR"&&([d,f]=tN(d));let p=l.firstChild;l===d&&p!=null&&p.nodeName==="BR"&&u===0&&f===0&&(f=1);try{i.setStart(l,u),i.setEnd(d,f)}catch{return null}return!i.collapsed||u===f&&a===s||(i.setStart(d,f),i.setEnd(l,u)),i}function r8(e,t){let n=e.getRootElement();if(n===null)return[];let o=n.getBoundingClientRect(),r=getComputedStyle(n),a=parseFloat(r.paddingLeft)+parseFloat(r.paddingRight),s=Array.from(t.getClientRects()),i,l=s.length;s.sort((d,u)=>{let f=d.top-u.top;return Math.abs(f)<=3?d.left-u.left:f});for(let d=0;d<l;d++){let u=s[d],f=i&&i.top<=u.top&&i.top+i.height>u.top&&i.left+i.width>u.left,p=u.width+a===o.width;f||p?(s.splice(d--,1),l--):i=u}return s}function oN(e){let t={};if(!e)return t;let n=e.split(";");for(let o of n)if(o!==""){let[r,a]=o.split(/:([^]+)/);r&&a&&(t[r.trim()]=a.trim())}return t}function Sg(e){let t=wg.get(e);return t===void 0&&(t=oN(e),wg.set(e,t)),t}function rN(e){let t="";for(let n in e)n&&(t+=`${n}: ${e[n]};`);return t}function xx(e){let t=Xm().getElementByKey(e.getKey());if(t===null)return null;let n=t.ownerDocument.defaultView;return n===null?null:n.getComputedStyle(t)}function bx(e){return xx(Su(e)?e:e.getParentOrThrow())}function a8(e){let t=bx(e);return t!==null&&t.direction==="rtl"}function s8(e,t,n="self"){let o=e.getStartEndPoints();if(t.isSelected(e)&&!sx(t)&&o!==null){let[r,a]=o,s=e.isBackward(),i=r.getNode(),l=a.getNode(),d=t.is(i),u=t.is(l);if(d||u){let[f,p]=VE(e),m=i.is(l),h=t.is(s?l:i),g=t.is(s?i:l),v,C=0;m?(C=f>p?p:f,v=f>p?f:p):h?(C=s?p:f,v=void 0):g&&(C=0,v=s?f:p);let y=t.__text.slice(C,v);y!==t.__text&&(n==="clone"&&(t=FE(t)),t.__text=y)}}return t}function i8(e){if(e.type==="text")return e.offset===e.getNode().getTextContentSize();let t=e.getNode();return qe(t)||Cx(177),e.offset===t.getChildrenSize()}function aN(e,t,n){let o=t.getNode(),r=n;if(qe(o)){let a=o.getDescendantByIndex(t.offset);a!==null&&(o=a)}for(;r>0&&o!==null;){if(qe(o)){let d=o.getLastDescendant();d!==null&&(o=d)}let a=o.getPreviousSibling(),s=0;if(a===null){let d=o.getParentOrThrow(),u=d.getPreviousSibling();for(;u===null;){if(d=d.getParent(),d===null){a=null;break}u=d.getPreviousSibling()}d!==null&&(s=d.isInline()?0:2,a=u)}let i=o.getTextContent();i===""&&qe(o)&&!o.isInline()&&(i=`
|
|
4156
|
+
`?o.push(Al()):s===" "?o.push(Km()):o.push(kn(s))}this.insertNodes(o)}insertText(t){let n=this.anchor,o=this.focus,r=this.format,a=this.style,s=n,i=o;!this.isCollapsed()&&o.isBefore(n)&&(s=o,i=n),s.type==="element"&&(function(v,C,y,x){let b=v.getNode(),I=b.getChildAtIndex(v.offset),T=kn();if(T.setFormat(y),T.setStyle(x),iE(I))I.splice(0,0,[T]);else{let P=Nn(b)?ma().append(T):T;I===null?b.append(P):I.insertBefore(P)}v.is(C)&&C.set(T.__key,0,"text"),v.set(T.__key,0,"text")})(s,i,r,a),i.type==="element"&&Ul(i,fr(is(i,"next")));let l=s.offset,d=i.offset,u=this.getNodes(),f=u.length,p=u[0];Oe(p)||ge(26);let m=p.getTextContent().length,h=p.getParentOrThrow(),g=u[f-1];if(f===1&&i.type==="element"&&(d=m,i.set(s.key,d,"text")),this.isCollapsed()&&l===m&&(ua(p)||!p.canInsertTextAfter()||!h.canInsertTextAfter()&&p.getNextSibling()===null)){let v=p.getNextSibling();if(Oe(v)&&v.canInsertTextBefore()&&!ua(v)||(v=kn(),v.setFormat(r),v.setStyle(a),h.canInsertTextAfter()?p.insertAfter(v):h.insertAfter(v)),v.select(0,0),p=v,t!=="")return void this.insertText(t)}else if(this.isCollapsed()&&l===0&&(ua(p)||!p.canInsertTextBefore()||!h.canInsertTextBefore()&&p.getPreviousSibling()===null)){let v=p.getPreviousSibling();if(Oe(v)&&!ua(v)||(v=kn(),v.setFormat(r),h.canInsertTextBefore()?p.insertBefore(v):h.insertBefore(v)),v.select(),p=v,t!=="")return void this.insertText(t)}else if(p.isSegmented()&&l!==m){let v=kn(p.getTextContent());v.setFormat(r),p.replace(v),p=v}else if(!this.isCollapsed()&&t!==""){let v=g.getParent();if(!h.canInsertTextBefore()||!h.canInsertTextAfter()||fe(v)&&(!v.canInsertTextBefore()||!v.canInsertTextAfter()))return this.insertText(""),YA(this.anchor,this.focus),void this.insertText(t)}if(f===1){if(es(p)){let x=kn(t);return x.select(),void p.replace(x)}let v=p.getFormat(),C=p.getStyle();if(l!==d||v===r&&C===a){if(AC(p)){let x=kn(t);return x.setFormat(r),x.setStyle(a),x.select(),void p.replace(x)}}else{if(p.getTextContent()!==""){let x=kn(t);if(x.setFormat(r),x.setStyle(a),x.select(),l===0)p.insertBefore(x,!1);else{let[b]=p.splitText(l);b.insertAfter(x,!1)}return void(x.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=t.length))}p.setFormat(r),p.setStyle(a)}let y=d-l;p=p.spliceText(l,y,t,!0),p.getTextContent()===""?p.remove():this.anchor.type==="text"&&(this.format=v,this.style=C,p.isComposing()&&(this.anchor.offset-=t.length))}else{let v=new Set([...p.getParentKeys(),...g.getParentKeys()]),C=fe(p)?p:p.getParentOrThrow(),y=fe(g)?g:g.getParentOrThrow(),x=g;if(!C.is(y)&&y.isInline())do x=y,y=y.getParentOrThrow();while(y.isInline());if(i.type==="text"&&(d!==0||g.getTextContent()==="")||i.type==="element"&&g.getIndexWithinParent()<d)if(Oe(g)&&!es(g)&&d!==g.getTextContentSize()){if(g.isSegmented()){let k=kn(g.getTextContent());g.replace(k),g=k}Nn(i.getNode())||i.type!=="text"||(g=g.spliceText(0,d,"")),v.add(g.__key)}else{let k=g.getParentOrThrow();k.canBeEmpty()||k.getChildrenSize()!==1?g.remove():k.remove()}else v.add(g.__key);let b=y.getChildren(),I=new Set(u),T=C.is(y),P=C.isInline()&&p.getNextSibling()===null?C:p;for(let k=b.length-1;k>=0;k--){let w=b[k];if(w.is(p)||fe(w)&&w.isParentOf(p))break;w.isAttached()&&(!I.has(w)||w.is(x)?T||P.insertAfter(w,!1):w.remove())}if(!T){let k=y,w=null;for(;k!==null;){let L=k.getChildren(),R=L.length;(R===0||L[R-1].is(w))&&(v.delete(k.__key),w=k),k=k.getParent()}}if(es(p))if(l===m)p.select();else{let k=kn(t);k.select(),p.replace(k)}else p=p.spliceText(l,m-l,t,!0),p.getTextContent()===""?p.remove():this.anchor.type==="text"&&(this.format=p.getFormat(),this.style=p.getStyle(),p.isComposing()&&(this.anchor.offset-=t.length));for(let k=1;k<f;k++){let w=u[k],L=w.__key;v.has(L)||w.remove()}}}removeText(){let t=Rt()===this;tu(this,NE(pC(this))),t&&Rt()!==this&&xo(this)}formatText(t,n=null){if(this.isCollapsed())return this.toggleFormat(t),void Ln(null);let o=this.getNodes(),r=[];for(let b of o)Oe(b)&&r.push(b);let a=b=>{o.forEach(I=>{if(fe(I)){let T=I.getFormatFlags(t,b);I.setTextFormat(T)}})},s=r.length;if(s===0)return this.toggleFormat(t),Ln(null),void a(n);let i=this.anchor,l=this.focus,d=this.isBackward(),u=d?l:i,f=d?i:l,p=0,m=r[0],h=u.type==="element"?0:u.offset;if(u.type==="text"&&h===m.getTextContentSize()&&(p=1,m=r[1],h=0),m==null)return;let g=m.getFormatFlags(t,n);a(g);let v=s-1,C=r[v],y=f.type==="text"?f.offset:C.getTextContentSize();if(m.is(C)){if(h===y)return;if(ua(m)||h===0&&y===m.getTextContentSize())m.setFormat(g);else{let b=m.splitText(h,y),I=h===0?b[0]:b[1];I.setFormat(g),u.type==="text"&&u.set(I.__key,0,"text"),f.type==="text"&&f.set(I.__key,y-h,"text")}return void(this.format=g)}h===0||ua(m)||([,m]=m.splitText(h),h=0),m.setFormat(g);let x=C.getFormatFlags(t,g);y>0&&(y===C.getTextContentSize()||ua(C)||([C]=C.splitText(y)),C.setFormat(x));for(let b=p+1;b<v;b++){let I=r[b],T=I.getFormatFlags(t,x);I.setFormat(T)}u.type==="text"&&u.set(m.__key,h,"text"),f.type==="text"&&f.set(C.__key,y,"text"),this.format=g|x}insertNodes(t){if(t.length===0)return;if(this.isCollapsed()||this.removeText(),this.anchor.key==="root"){this.insertParagraph();let h=Rt();return je(h)||ge(134),h.insertNodes(t)}let n=(this.isBackward()?this.focus:this.anchor).getNode(),o=Zc(n,pa),r=t[t.length-1];if(fe(o)&&"__language"in o){if("__language"in t[0])this.insertText(t[0].getTextContent());else{let h=My(this);o.splice(h,0,t),r.selectEnd()}return}if(!t.some(h=>(fe(h)||Wt(h))&&!h.isInline())){fe(o)||ge(211,n.constructor.name,n.getType());let h=My(this);return o.splice(h,0,t),void r.selectEnd()}let a=(function(h){let g=ma(),v=null;for(let C=0;C<h.length;C++){let y=h[C],x=fi(y);if(x||Wt(y)&&y.isInline()||fe(y)&&y.isInline()||Oe(y)||y.isParentRequired()){if(v===null&&(v=y.createParentElementNode(),g.append(v),x))continue;v!==null&&v.append(y)}else g.append(y),v=null}return g})(t),s=a.getLastDescendant(),i=a.getChildren(),l=!fe(o)||!o.isEmpty()?this.insertParagraph():null,d=i[i.length-1],u=i[0];var f;fe(f=u)&&pa(f)&&!f.isEmpty()&&fe(o)&&(!o.isEmpty()||o.canMergeWhenEmpty())&&(fe(o)||ge(211,n.constructor.name,n.getType()),o.append(...u.getChildren()),u=i[1]),u&&(o===null&&ge(212,n.constructor.name,n.getType()),(function(h,g){let v=g.getParentOrThrow().getLastChild(),C=g,y=[g];for(;C!==v;)C.getNextSibling()||ge(140),C=C.getNextSibling(),y.push(C);let x=h;for(let b of y)x=x.insertAfter(b)})(o,u));let p=Zc(s,pa);l&&fe(p)&&(l.canMergeWhenEmpty()||pa(d))&&(p.append(...l.getChildren()),l.remove()),fe(o)&&o.isEmpty()&&o.remove(),s.selectEnd();let m=fe(o)?o.getLastChild():null;fi(m)&&p!==o&&m.remove()}insertParagraph(){if(this.anchor.key==="root"){let s=ma();return Eo().splice(this.anchor.offset,0,[s]),s.select(),s}let t=My(this),n=Zc(this.anchor.getNode(),pa);fe(n)||ge(213);let o=n.getChildAtIndex(t),r=o?[o,...o.getNextSiblings()]:[],a=n.insertNewAfter(this,!1);return a?(a.append(...r),a.selectStart(),a):null}insertLineBreak(t){let n=Al();if(this.insertNodes([n]),t){let o=n.getParentOrThrow(),r=n.getIndexWithinParent();o.select(r,r)}}extract(){let t=[...this.getNodes()],n=t.length,o=t[0],r=t[n-1],[a,s]=aC(this),i=this.isBackward(),[l,d]=i?[this.focus,this.anchor]:[this.anchor,this.focus],[u,f]=i?[s,a]:[a,s];if(n===0)return[];if(n===1){if(Oe(o)&&!this.isCollapsed()){let p=o.splitText(u,f),m=u===0?p[0]:p[1];return m?(l.set(m.getKey(),0,"text"),d.set(m.getKey(),m.getTextContentSize(),"text"),[m]):[]}return[o]}if(Oe(o)&&(u===o.getTextContentSize()?t.shift():u!==0&&([,o]=o.splitText(u),t[0]=o,l.set(o.getKey(),0,"text"))),Oe(r)){let p=r.getTextContent().length;f===0?t.pop():f!==p&&([r]=r.splitText(f),t[t.length-1]=r,d.set(r.getKey(),r.getTextContentSize(),"text"))}return t}modify(t,n,o){if(UR(this,t,n,o))return;let r=t==="move",a=Ut(),s=yr(Mo(a));if(!s)return;let i=a._blockCursorElement,l=a._rootElement,d=this.focus.getNode();if(l===null||i===null||!fe(d)||d.isInline()||d.canBeEmpty()||lC(i,a,l),this.dirty){let u=_l(a,this.anchor.key),f=_l(a,this.focus.key);this.anchor.type==="text"&&(u=vi(u)),this.focus.type==="text"&&(f=vi(f)),u&&f&&tE(s,u,this.anchor.offset,f,this.focus.offset)}if((function(u,f,p,m){u.modify(f,p,m)})(s,t,n?"backward":"forward",o),s.rangeCount>0){let u=s.getRangeAt(0),f=this.anchor.getNode(),p=Nn(f)?f:SE(f);if(this.applyDOMRange(u),this.dirty=!0,!r){let m=this.getNodes(),h=[],g=!1;for(let v=0;v<m.length;v++){let C=m[v];Om(C,p)?h.push(C):g=!0}if(g&&h.length>0)if(n){let v=h[0];fe(v)?v.selectStart():v.getParentOrThrow().selectStart()}else{let v=h[h.length-1];fe(v)?v.selectEnd():v.getParentOrThrow().selectEnd()}s.anchorNode===u.startContainer&&s.anchorOffset===u.startOffset||(function(v){let C=v.focus,y=v.anchor,x=y.key,b=y.offset,I=y.type;y.set(C.key,C.offset,C.type,!0),C.set(x,b,I,!0)})(this)}}o==="lineboundary"&&UR(this,t,n,o,"decorators")}forwardDeletion(t,n,o){if(!o&&(t.type==="element"&&fe(n)&&t.offset===n.getChildrenSize()||t.type==="text"&&t.offset===n.getTextContentSize())){let r=n.getParent(),a=n.getNextSibling()||(r===null?null:r.getNextSibling());if(fe(a)&&a.isShadowRoot())return!0}return!1}deleteCharacter(t){let n=this.isCollapsed();if(this.isCollapsed()){let o=this.anchor,r=o.getNode();if(this.forwardDeletion(o,r,t))return;let a=XC(is(o,t?"previous":"next"));if(a.getTextSlices().every(i=>i===null||i.distance===0)){let i={type:"initial"};for(let l of a.iterNodeCarets("shadowRoot"))if(mr(l)){if(!l.origin.isInline()){if(l.origin.isShadowRoot()){if(i.type==="merge-block")break;if(fe(a.anchor.origin)&&a.anchor.origin.isEmpty()){let d=fr(l);tu(this,ss(d,d)),a.anchor.origin.remove()}return}i.type!=="merge-next-block"&&i.type!=="merge-block"||(i={block:i.block,caret:l,type:"merge-block"})}}else{if(i.type==="merge-block")break;if(yi(l)){if(fe(l.origin)){if(l.origin.isInline()){if(!l.origin.isParentOf(a.anchor.origin))break}else i={block:l.origin,type:"merge-next-block"};continue}if(Wt(l.origin)){if(!l.origin.isIsolated())if(i.type==="merge-next-block"&&(l.origin.isKeyboardSelectable()||!l.origin.isInline())&&fe(a.anchor.origin)&&a.anchor.origin.isEmpty()){a.anchor.origin.remove();let d=EC();d.add(l.origin.getKey()),xo(d)}else l.origin.remove();return}break}}if(i.type==="merge-block"){let{caret:l,block:d}=i;return tu(this,ss(!l.origin.isEmpty()&&d.isEmpty()?Kl(En(d,l.direction)):a.anchor,l)),this.removeText()}}let s=this.focus;if(this.modify("extend",t,"character"),this.isCollapsed()){if(t&&o.offset===0&&MR(this,o.getNode()))return}else{let i=s.type==="text"?s.getNode():null;if(r=o.type==="text"?o.getNode():null,i!==null&&i.isSegmented()){let l=s.offset,d=i.getTextContentSize();if(i.is(r)||t&&l!==d||!t&&l!==0)return void NR(i,t,l)}else if(r!==null&&r.isSegmented()){let l=o.offset,d=r.getTextContentSize();if(r.is(i)||t&&l!==0||!t&&l!==d)return void NR(r,t,l)}(function(l,d){let u=l.anchor,f=l.focus,p=u.getNode(),m=f.getNode();if(p===m&&u.type==="text"&&f.type==="text"){let h=u.offset,g=f.offset,v=h<g,C=v?h:g,y=v?g:h,x=y-1;C!==x&&(function(b){return!(hE(b)||eG(b))})(p.getTextContent().slice(C,y))&&(d?f.set(f.key,x,f.type):u.set(u.key,x,u.type))}})(this,t)}}if(this.removeText(),t&&!n&&this.isCollapsed()&&this.anchor.type==="element"&&this.anchor.offset===0){let o=this.anchor.getNode();o.isEmpty()&&Nn(o.getParent())&&o.getPreviousSibling()===null&&MR(this,o)}}deleteLine(t){this.isCollapsed()&&this.modify("extend",t,"lineboundary"),this.isCollapsed()?this.deleteCharacter(t):this.removeText()}deleteWord(t){if(this.isCollapsed()){let n=this.anchor,o=n.getNode();if(this.forwardDeletion(n,o,t))return;this.modify("extend",t,"word")}this.removeText()}isBackward(){return this.focus.isBefore(this.anchor)}getStartEndPoints(){return[this.anchor,this.focus]}};function mu(e){return e instanceof Em}function ER(e){let t=e.offset;if(e.type==="text")return t;let n=e.getNode();return t===n.getChildrenSize()?n.getTextContent().length:0}function aC(e){let t=e.getStartEndPoints();if(t===null)return[0,0];let[n,o]=t;return n.type==="element"&&o.type==="element"&&n.key===o.key&&n.offset===o.offset?[0,0]:[ER(n),ER(o)]}function MR(e,t){for(let n=t;n;n=n.getParent()){if(fe(n)){if(n.collapseAtStart(e))return!0;if(Qo(n))break}if(n.getPreviousSibling())break}return!1}var eG=(()=>{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 NR(e,t,n){let o=e,r=o.getTextContent().split(/(?=\s)/g),a=r.length,s=0,i=0;for(let d=0;d<a;d++){let u=d===a-1;if(i=s,s+=r[d].length,t&&s===n||s>n||u){r.splice(d,1),u&&(i=void 0);break}}let l=r.join("").trim();l===""?o.remove():(o.setTextContent(l),o.select(i,i))}function _R(e,t,n,o){let r,a=t;if(no(e)){let s=!1,i=e.childNodes,l=i.length,d=o._blockCursorElement;a===l&&(s=!0,a=l-1);let u=i[a],f=!1;if(u===d)u=i[a+1],f=!0;else if(d!==null){let p=d.parentNode;e===p&&t>Array.prototype.indexOf.call(p.children,d)&&a--}if(r=Tl(u),Oe(r))a=gr(r,s?"next":"previous");else{let p=Tl(e);if(p===null)return null;if(fe(p)){let m=o.getElementByKey(p.getKey());m===null&&ge(214),[p,a]=p.getDOMSlot(m).resolveChildIndex(p,m,e,t),fe(p)||ge(215),s&&a>=p.getChildrenSize()&&(a=Math.max(0,p.getChildrenSize()-1));let g=p.getChildAtIndex(a);if(fe(g)&&(function(v,C,y){let x=v.getParent();return y===null||x===null||!x.canBeEmpty()||x!==y.getNode()})(g,0,n)){let v=s?g.getLastDescendant():g.getFirstDescendant();v===null?p=g:(g=v,p=fe(g)?g:g.getParentOrThrow()),a=0}Oe(g)?(r=g,p=null,a=gr(g,s?"next":"previous")):g!==p&&s&&!f&&(fe(p)||ge(216),a=Math.min(p.getChildrenSize(),a+1))}else{let m=p.getIndexWithinParent();a=t===0&&Wt(p)&&Tl(e)===p?m:m+1,p=p.getParentOrThrow()}if(fe(p))return hr(p.__key,a,"element")}}else r=Tl(e);return Oe(r)?hr(r.__key,gr(r,a,"clamp"),"text"):null}function DR(e,t,n){let o=e.offset,r=e.getNode();if(o===0){let a=r.getPreviousSibling(),s=r.getParent();if(t){if((n||!t)&&a===null&&fe(s)&&s.isInline()){let i=s.getPreviousSibling();Oe(i)&&e.set(i.__key,i.getTextContent().length,"text")}}else fe(a)&&!n&&a.isInline()?e.set(a.__key,a.getChildrenSize(),"element"):Oe(a)&&e.set(a.__key,a.getTextContent().length,"text")}else if(o===r.getTextContent().length){let a=r.getNextSibling(),s=r.getParent();if(t&&fe(a)&&a.isInline())e.set(a.__key,0,"element");else if((n||t)&&a===null&&fe(s)&&s.isInline()&&!s.canInsertTextAfter()){let i=s.getNextSibling();Oe(i)&&e.set(i.__key,0,"text")}}}function YA(e,t,n){if(e.type==="text"&&t.type==="text"){let o=e.isBefore(t),r=e.is(t);DR(e,o,r),DR(t,!o,r),r&&t.set(e.key,e.offset,e.type)}}function JA(e,t,n,o,r,a){if(e===null||n===null||!gu(r,e,n))return null;let s=_R(e,t,je(a)?a.anchor:null,r);if(s===null)return null;let i=_R(n,o,je(a)?a.focus:null,r);if(i===null)return null;if(s.type==="element"&&i.type==="element"){let l=Tl(e),d=Tl(n);if(Wt(l)&&Wt(d))return null}return YA(s,i),[s,i]}function tG(e){return fe(e)&&!e.isInline()}function ZA(e,t,n,o,r,a){let s=va(),i=new hi(hr(e,t,r),hr(n,o,a),0,"");return i.dirty=!0,s._selection=i,i}function eE(){let e=hr("root",0,"element"),t=hr("root",0,"element");return new hi(e,t,0,"")}function EC(){return new Em(new Set)}function nG(e,t){return $m(null,e,t,null)}function $m(e,t,n,o){let r=n._window;if(r===null)return null;let a=o||r.event,s=a?a.type:void 0,i=s==="selectionchange",l=!Uy&&(i||s==="beforeinput"||s==="compositionstart"||s==="compositionend"||s==="click"&&a&&a.detail===3||s==="drop"||s===void 0),d,u,f,p;if(je(e)&&!l)return e.clone();if(t===null)return null;if(d=t.anchorNode,u=t.focusNode,f=t.anchorOffset,p=t.focusOffset,(i||s===void 0)&&je(e)&&!gu(n,d,u))return e.clone();let m=JA(d,f,u,p,n,e);if(m===null)return null;let[h,g]=m,v=0,C="";if(je(e)){let y=e.anchor;if(h.key===y.key)v=e.format,C=e.style;else{let x=h.getNode();Oe(x)?(v=x.getFormat(),C=x.getStyle()):fe(x)&&(v=x.getTextFormat(),C=x.getTextStyle())}}return new hi(h,g,v,C)}function Rt(){return va()._selection}function Ci(){return Ut()._editorState._selection}function Mm(e,t,n,o=1){let r=e.anchor,a=e.focus,s=r.getNode(),i=a.getNode();if(!t.is(s)&&!t.is(i))return;let l=t.__key;if(e.isCollapsed()){let d=r.offset;if(n<=d&&o>0||n<d&&o<0){let u=Math.max(0,d+o);r.set(l,u,"element"),a.set(l,u,"element"),OR(e)}}else{let d=e.isBackward(),u=d?a:r,f=u.getNode(),p=d?r:a,m=p.getNode();if(t.is(f)){let h=u.offset;(n<=h&&o>0||n<h&&o<0)&&u.set(l,Math.max(0,h+o),"element")}if(t.is(m)){let h=p.offset;(n<=h&&o>0||n<h&&o<0)&&p.set(l,Math.max(0,h+o),"element")}}OR(e)}function OR(e){let t=e.anchor,n=t.offset,o=e.focus,r=o.offset,a=t.getNode(),s=o.getNode();if(e.isCollapsed()){if(!fe(a))return;let i=a.getChildrenSize(),l=n>=i,d=l?a.getChildAtIndex(i-1):a.getChildAtIndex(n);if(Oe(d)){let u=0;l&&(u=d.getTextContentSize()),t.set(d.__key,u,"text"),o.set(d.__key,u,"text")}return}if(fe(a)){let i=a.getChildrenSize(),l=n>=i,d=l?a.getChildAtIndex(i-1):a.getChildAtIndex(n);if(Oe(d)){let u=0;l&&(u=d.getTextContentSize()),t.set(d.__key,u,"text")}}if(fe(s)){let i=s.getChildrenSize(),l=r>=i,d=l?s.getChildAtIndex(i-1):s.getChildAtIndex(r);if(Oe(d)){let u=0;l&&(u=d.getTextContentSize()),o.set(d.__key,u,"text")}}}function Nm(e,t,n,o,r){let a=null,s=0,i=null;o!==null?(a=o.__key,Oe(o)?(s=o.getTextContentSize(),i="text"):fe(o)&&(s=o.getChildrenSize(),i="element")):r!==null&&(a=r.__key,Oe(r)?i="text":fe(r)&&(i="element")),a!==null&&i!==null?e.set(a,s,i):(s=t.getIndexWithinParent(),s===-1&&(s=n.getChildrenSize()),e.set(n.__key,s,"element"))}function FR(e,t,n,o,r){e.type==="text"?e.set(n,e.offset+(t?0:r),"text"):e.offset>o.getIndexWithinParent()&&e.set(e.key,e.offset-1,"element")}function tE(e,t,n,o,r){try{e.setBaseAndExtent(t,n,o,r)}catch{}}function BR(e,t,n){let o=_l(e,t.getKey());if(fe(t)){let r=t.getDOMSlot(o);return[r.element,n+r.getFirstChildOffset()]}return[o,n]}function oG(e,t,n,o,r,a,s){let i=o.anchorNode,l=o.focusNode,d=o.anchorOffset,u=o.focusOffset,f=document.activeElement;if(r.has(VA)&&f!==a||f!==null&&FC(f))return;if(!je(t))return void(e!==null&&gu(n,i,l)&&o.removeAllRanges());let p=t.anchor,m=t.focus,h=p.getNode(),g=m.getNode(),[v,C]=BR(n,h,p.offset),[y,x]=BR(n,g,m.offset),b=t.format,I=t.style,T=t.isCollapsed(),P=v,k=y,w=!1;var L,R,N,A,D;if(p.type==="text"?(P=vi(v),w=h.getFormat()!==b||h.getStyle()!==I):je(e)&&e.anchor.type==="text"&&(w=!0),m.type==="text"&&(k=vi(y)),P!==null&&k!==null&&(T&&(e===null||w||je(e)&&(e.format!==b||e.style!==I))&&(L=b,R=I,N=C,A=p.key,D=performance.now(),FA=[L,R,N,A,D]),d!==C||u!==x||i!==P||l!==k||o.type==="Range"&&T||(f!==null&&a.contains(f)||r.has(oC)||a.focus({preventScroll:!0}),p.type==="element"))){if(tE(o,P,C,k,x),!ns||!t.isCollapsed()||a===null||r.has(oC)||document.activeElement!==null&&a.contains(document.activeElement)||a.focus({preventScroll:!0}),!r.has(qA)&&t.isCollapsed()&&a!==null&&a===document.activeElement){let q=je(t)&&t.anchor.type==="element"?P.childNodes[C]||null:o.rangeCount>0?o.getRangeAt(0):null;if(q!==null){let H;if(q instanceof Text){let F=document.createRange();F.selectNode(q),H=F.getBoundingClientRect()}else H=q.getBoundingClientRect();(function(F,V,_){let z=VC(_),Ce=qC(z);if(z===null||Ce===null)return;let{top:B,bottom:ae}=V,X=0,G=0,Q=_;for(;Q!==null;){let oe=Q===z.body;if(oe)X=0,G=Mo(F).innerHeight;else{let J=Q.getBoundingClientRect();X=J.top,G=J.bottom}let de=0;if(B<X?de=-(X-B):ae>G&&(de=ae-G),de!==0)if(oe)Ce.scrollBy(0,de);else{let J=Q.scrollTop;Q.scrollTop+=de;let se=Q.scrollTop-J;B-=se,ae-=se}if(oe)break;Q=vu(Q)}})(n,H,a)}}eC=!0}}function rG(e){let t=Rt()||Ci();t===null&&(t=Eo().selectEnd()),t.insertNodes(e)}function aG(){let e=Rt();return e===null?"":e.getTextContent()}function My(e){let t=e;e.isCollapsed()||t.removeText();let n=Rt();je(n)&&(t=n),je(t)||ge(161);let o=t.anchor,r=o.getNode(),a=o.offset;for(;!pa(r);){let s=r;if([r,a]=sG(r,a),s.is(r))break}return a}function sG(e,t){let n=e.getParent();if(!n){let r=ma();return Eo().append(r),r.select(),[Eo(),0]}if(Oe(e)){let r=e.splitText(t);if(r.length===0)return[n,e.getIndexWithinParent()];let a=t===0?0:1;return[n,r[0].getIndexWithinParent()+a]}if(!fe(e)||t===0)return[n,e.getIndexWithinParent()];let o=e.getChildAtIndex(t);if(o){let r=new hi(hr(e.__key,t,"element"),hr(e.__key,t,"element"),0,""),a=e.insertNewAfter(r);a&&a.append(o,...o.getNextSiblings())}return[n,e.getIndexWithinParent()+1]}function UR(e,t,n,o,r="decorators-and-blocks"){if(t==="move"&&o==="character"&&!e.isCollapsed()){let[u,f]=n===e.isBackward()?[e.focus,e.anchor]:[e.anchor,e.focus];return f.set(u.key,u.offset,u.type),!0}let a=is(e.focus,n?"previous":"next"),s=o==="lineboundary",i=t==="move",l=a,d=r==="decorators-and-blocks";if(!_E(l)){for(let u of l){d=!1;let{origin:f}=u;if(!Wt(f)||f.isIsolated()||(l=u,!s||!f.isInline()))break}if(d)for(let u of XC(a).iterNodeCarets(t==="extend"?"shadowRoot":"root")){if(mr(u))u.origin.isInline()||(l=u);else{if(fe(u.origin))continue;Wt(u.origin)&&!u.origin.isInline()&&(l=u)}break}}if(l===a)return!1;if(i&&!s&&Wt(l.origin)&&l.origin.isKeyboardSelectable()){let u=EC();return u.add(l.origin.getKey()),xo(u),!0}return l=fr(l),i&&Ul(e.anchor,l),Ul(e.focus,l),d||!s}var Rn=null,An=null,Co=!1,Ny=!1,Cm=0,zR={characterData:!0,childList:!0,subtree:!0};function zl(){return Co||Rn!==null&&Rn._readOnly}function Pn(){Co&&ge(13)}function nE(){Cm>99&&ge(14)}function va(){return Rn===null&&ge(195,oE()),Rn}function Ut(){return An===null&&ge(196,oE()),An}function oE(){let e=0,t=new Set,n=rs.version;if(typeof window<"u")for(let r of document.querySelectorAll("[contenteditable]")){let a=hu(r);if(qm(a))e++;else if(a){let s=String(a.constructor.version||"<0.17.1");s===n&&(s+=" (separately built, likely a bundler configuration issue)"),t.add(s)}}let o=` Detected on the page: ${e} compatible editor(s) with version ${n}`;return t.size&&(o+=` and incompatible editors with versions ${Array.from(t).join(", ")}`),o}function iG(){return An}function HR(e,t,n){let o=t.__type,r=DC(e,o),a=n.get(o);a===void 0&&(a=Array.from(r.transforms),n.set(o,a));let s=a.length;for(let i=0;i<s&&(a[i](t),t.isAttached());i++);}function KR(e,t){return e!==void 0&&e.__key!==t&&e.isAttached()}function rE(e,t){if(!t)return;let n=e._updateTags,o=t;Array.isArray(t)||(o=[t]);for(let r of o)n.add(r)}function lG(e){return MC(e,Ut()._nodes)}function MC(e,t){let n=e.type,o=t.get(n);o===void 0&&ge(17,n);let r=o.klass;e.type!==r.getType()&&ge(18,r.name);let a=r.importJSON(e),s=e.children;if(fe(a)&&Array.isArray(s))for(let i=0;i<s.length;i++){let l=MC(s[i],t);a.append(l)}return a}function $R(e,t,n){let o=Rn,r=Co,a=An;Rn=t,Co=!0,An=e;try{return n()}finally{Rn=o,Co=r,An=a}}function fa(e,t){let n=e._pendingEditorState,o=e._rootElement,r=e._headless||o===null;if(n===null)return;let a=e._editorState,s=a._selection,i=n._selection,l=e._dirtyType!==0,d=Rn,u=Co,f=An,p=e._updating,m=e._observer,h=null;if(e._pendingEditorState=null,e._editorState=n,!r&&l&&m!==null){An=e,Rn=n,Co=!1,e._updating=!0;try{let T=e._dirtyType,P=e._dirtyElements,k=e._dirtyLeaves;m.disconnect(),h=Pj(a,n,e,T,P,k)}catch(T){if(T instanceof Error&&e._onError(T),Ny)throw T;return lE(e,null,o,n),dA(e),e._dirtyType=2,Ny=!0,fa(e,a),void(Ny=!1)}finally{m.observe(o,zR),e._updating=p,Rn=d,Co=u,An=f}}n._readOnly||(n._readOnly=!0);let g=e._dirtyLeaves,v=e._dirtyElements,C=e._normalizedNodes,y=e._updateTags,x=e._deferred;l&&(e._dirtyType=0,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements=new Map,e._normalizedNodes=new Set,e._updateTags=new Set),(function(T,P){let k=T._decorators,w=T._pendingDecorators||k,L=P._nodeMap,R;for(R in w)L.has(R)||(w===k&&(w=mE(T)),delete w[R])})(e,n);let b=r?null:yr(Mo(e));if(e._editable&&b!==null&&(l||i===null||i.dirty||!i.is(s))&&o!==null&&!y.has(WA)){An=e,Rn=n;try{if(m!==null&&m.disconnect(),l||i===null||i.dirty){let T=e._blockCursorElement;T!==null&&lC(T,e,o),oG(s,i,e,b,y,o)}(function(T,P,k){let w=T._blockCursorElement;if(je(k)&&k.isCollapsed()&&k.anchor.type==="element"&&P.contains(document.activeElement)){let L=k.anchor,R=L.getNode(),N=L.offset,A=!1,D=null;if(N===R.getChildrenSize())Dy(R.getChildAtIndex(N-1))&&(A=!0);else{let q=R.getChildAtIndex(N);if(q!==null&&Dy(q)){let H=q.getPreviousSibling();(H===null||Dy(H))&&(A=!0,D=T.getElementByKey(q.__key))}}if(A){let q=T.getElementByKey(R.__key);return w===null&&(T._blockCursorElement=w=(function(H){let F=H.theme,V=document.createElement("div");V.contentEditable="false",V.setAttribute("data-lexical-cursor","true");let _=F.blockCursor;if(_!==void 0){if(typeof _=="string"){let z=xu(_);_=F.blockCursor=z}_!==void 0&&V.classList.add(..._)}return V})(T._config)),P.style.caretColor="transparent",void(D===null?q.appendChild(w):q.insertBefore(w,D))}}w!==null&&lC(w,T,P)})(e,o,i)}finally{m!==null&&m.observe(o,zR),An=f,Rn=d}}h!==null&&(function(T,P,k,w,L){let R=Array.from(T._listeners.mutation),N=R.length;for(let A=0;A<N;A++){let[D,q]=R[A];for(let H of q){let F=P.get(H);F!==void 0&&D(F,{dirtyLeaves:w,prevEditorState:L,updateTags:k})}}})(e,h,y,g,a),je(i)||i===null||s!==null&&s.is(i)||e.dispatchCommand(yC,void 0);let I=e._pendingDecorators;I!==null&&(e._decorators=I,e._pendingDecorators=null,Jc("decorator",e,!0,I)),(function(T,P,k){let w=jR(P),L=jR(k);w!==L&&Jc("textcontent",T,!0,L)})(e,t||a,n),Jc("update",e,!0,{dirtyElements:v,dirtyLeaves:g,editorState:n,mutatedNodes:h,normalizedNodes:C,prevEditorState:t||a,tags:y}),(function(T,P){if(T._deferred=[],P.length!==0){let k=T._updating;T._updating=!0;try{for(let w=0;w<P.length;w++)P[w]()}finally{T._updating=k}}})(e,x),(function(T){let P=T._updates;if(P.length!==0){let k=P.shift();if(k){let[w,L]=k;Vm(T,w,L)}}})(e)}function Jc(e,t,n,...o){let r=t._updating;t._updating=n;try{let a=Array.from(t._listeners[e]);for(let s=0;s<a.length;s++)a[s].apply(null,o)}finally{t._updating=r}}function VR(e,t){let n=e._updates,o=t||!1;for(;n.length!==0;){let r=n.shift();if(r){let[a,s]=r,i=e._pendingEditorState,l;s!==void 0&&(l=s.onUpdate,s.skipTransforms&&(o=!0),s.discrete&&(i===null&&ge(191),i._flushSync=!0),l&&e._deferred.push(l),rE(e,s.tag)),i==null?Vm(e,a,s):a()}}return o}function Vm(e,t,n){let o=e._updateTags,r,a=!1,s=!1;n!==void 0&&(r=n.onUpdate,rE(e,n.tag),a=n.skipTransforms||!1,s=n.discrete||!1),r&&e._deferred.push(r);let i=e._editorState,l=e._pendingEditorState,d=!1;(l===null||l._readOnly)&&(l=e._pendingEditorState=aE(l||i),d=!0),l._flushSync=s;let u=Rn,f=Co,p=An,m=e._updating;Rn=l,Co=!1,e._updating=!0,An=e;let h=e._headless||e.getRootElement()===null;_C(null);try{d&&(h?i._selection!==null&&(l._selection=i._selection.clone()):l._selection=(function(y,x){let b=y.getEditorState()._selection,I=yr(Mo(y));return je(b)||b==null?$m(b,I,y,x):b.clone()})(e,n&&n.event||null));let v=e._compositionKey;t(),a=VR(e,a),(function(y,x){let b=x.getEditorState()._selection,I=y._selection;if(je(I)){let T=I.anchor,P=I.focus,k;if(T.type==="text"&&(k=T.getNode(),k.selectionTransform(b,I)),P.type==="text"){let w=P.getNode();k!==w&&w.selectionTransform(b,I)}}})(l,e),e._dirtyType!==0&&(a?(function(y,x){let b=x._dirtyLeaves,I=y._nodeMap;for(let T of b){let P=I.get(T);Oe(P)&&P.isAttached()&&P.isSimpleText()&&!P.isUnmergeable()&&yR(P)}})(l,e):(function(y,x){let b=x._dirtyLeaves,I=x._dirtyElements,T=y._nodeMap,P=Za(),k=new Map,w=b,L=w.size,R=I,N=R.size;for(;L>0||N>0;){if(L>0){x._dirtyLeaves=new Set;for(let A of w){let D=T.get(A);Oe(D)&&D.isAttached()&&D.isSimpleText()&&!D.isUnmergeable()&&yR(D),D!==void 0&&KR(D,P)&&HR(x,D,k),b.add(A)}if(w=x._dirtyLeaves,L=w.size,L>0){Cm++;continue}}x._dirtyLeaves=new Set,x._dirtyElements=new Map,R.delete("root")&&R.set("root",!0);for(let A of R){let D=A[0],q=A[1];if(I.set(D,q),!q)continue;let H=T.get(D);H!==void 0&&KR(H,P)&&HR(x,H,k)}w=x._dirtyLeaves,L=w.size,R=x._dirtyElements,N=R.size,Cm++}x._dirtyLeaves=b,x._dirtyElements=I})(l,e),VR(e),(function(y,x,b,I){let T=y._nodeMap,P=x._nodeMap,k=[];for(let[w]of I){let L=P.get(w);L!==void 0&&(L.isAttached()||(fe(L)&&sA(L,w,T,P,k,I),T.has(w)||I.delete(w),k.push(w)))}for(let w of k)P.delete(w);for(let w of b){let L=P.get(w);L===void 0||L.isAttached()||(T.has(w)||b.delete(w),P.delete(w))}})(i,l,e._dirtyLeaves,e._dirtyElements)),v!==e._compositionKey&&(l._flushSync=!0);let C=l._selection;if(je(C)){let y=l._nodeMap,x=C.anchor.key,b=C.focus.key;y.get(x)!==void 0&&y.get(b)!==void 0||ge(19)}else mu(C)&&C._nodes.size===0&&(l._selection=null)}catch(v){return v instanceof Error&&e._onError(v),e._pendingEditorState=i,e._dirtyType=2,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements.clear(),void fa(e)}finally{Rn=u,Co=f,An=p,e._updating=m,Cm=0}e._dirtyType!==0||e._deferred.length>0||(function(v,C){let y=C.getEditorState()._selection,x=v._selection;if(x!==null){if(x.dirty||!x.is(y))return!0}else if(y!==null)return!0;return!1})(l,e)?l._flushSync?(l._flushSync=!1,fa(e)):d&&vG(()=>{fa(e)}):(l._flushSync=!1,d&&(o.clear(),e._deferred=[],e._pendingEditorState=null))}function Or(e,t,n){An===e&&n===void 0?t():Vm(e,t,n)}var sC=class e{element;before;after;constructor(t,n,o){this.element=t,this.before=n||null,this.after=o||null}withBefore(t){return new e(this.element,t,this.after)}withAfter(t){return new e(this.element,this.before,t)}withElement(t){return this.element===t?this:new e(t,this.before,this.after)}insertChild(t){let n=this.before||this.getManagedLineBreak();return n!==null&&n.parentElement!==this.element&&ge(222),this.element.insertBefore(t,n),this}removeChild(t){return t.parentElement!==this.element&&ge(223),this.element.removeChild(t),this}replaceChild(t,n){return n.parentElement!==this.element&&ge(224),this.element.replaceChild(t,n),this}getFirstChild(){let t=this.after?this.after.nextSibling:this.element.firstChild;return t===this.before||t===this.getManagedLineBreak()?null:t}getManagedLineBreak(){return this.element.__lexicalLineBreak||null}setManagedLineBreak(t){if(t===null)this.removeManagedLineBreak();else{let n=t==="decorator"&&(Um||pu||Bm);this.insertManagedLineBreak(n)}}removeManagedLineBreak(){let t=this.getManagedLineBreak();if(t){let n=this.element,o=t.nodeName==="IMG"?t.nextSibling:null;o&&n.removeChild(o),n.removeChild(t),n.__lexicalLineBreak=void 0}}insertManagedLineBreak(t){let n=this.getManagedLineBreak();if(n){if(t===(n.nodeName==="IMG"))return;this.removeManagedLineBreak()}let o=this.element,r=this.before,a=document.createElement("br");if(o.insertBefore(a,r),t){let s=document.createElement("img");s.setAttribute("data-lexical-linebreak","true"),s.style.cssText="display: inline !important; border: 0px !important; margin: 0px !important;",s.alt="",o.insertBefore(s,a),o.__lexicalLineBreak=s}else o.__lexicalLineBreak=a}getFirstChildOffset(){let t=0;for(let n=this.after;n!==null;n=n.previousSibling)t++;return t}resolveChildIndex(t,n,o,r){if(o===this.element){let l=this.getFirstChildOffset();return[t,Math.min(l+t.getChildrenSize(),Math.max(l,r))]}let a=qR(n,o);a.push(r);let s=qR(n,this.element),i=t.getIndexWithinParent();for(let l=0;l<s.length;l++){let d=a[l],u=s[l];if(d===void 0||d<u)break;if(d>u){i+=1;break}}return[t.getParentOrThrow(),i]}};function qR(e,t){let n=[],o=t;for(;o!==e&&o!==null;o=o.parentNode){let r=0;for(let a=o.previousSibling;a!==null;a=a.previousSibling)r++;n.push(r)}return o!==e&&ge(225),n.reverse()}var os=class extends Go{__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 pj[t]||""}getStyle(){return this.getLatest().__style}getIndent(){return this.getLatest().__indent}getChildren(){let t=[],n=this.getFirstChild();for(;n!==null;)t.push(n),n=n.getNextSibling();return t}getChildrenKeys(){let t=[],n=this.getFirstChild();for(;n!==null;)t.push(n.__key),n=n.getNextSibling();return t}getChildrenSize(){return this.getLatest().__size}isEmpty(){return this.getChildrenSize()===0}isDirty(){let t=Ut()._dirtyElements;return t!==null&&t.has(this.__key)}isLastChild(){let t=this.getLatest(),n=this.getParentOrThrow().getLastChild();return n!==null&&n.is(t)}getAllTextNodes(){let t=[],n=this.getFirstChild();for(;n!==null;){if(Oe(n)&&t.push(n),fe(n)){let o=n.getAllTextNodes();t.push(...o)}n=n.getNextSibling()}return t}getFirstDescendant(){let t=this.getFirstChild();for(;fe(t);){let n=t.getFirstChild();if(n===null)break;t=n}return t}getLastDescendant(){let t=this.getLastChild();for(;fe(t);){let n=t.getLastChild();if(n===null)break;t=n}return t}getDescendantByIndex(t){let n=this.getChildren(),o=n.length;if(t>=o){let a=n[o-1];return fe(a)&&a.getLastDescendant()||a||null}let r=n[t];return fe(r)&&r.getFirstDescendant()||r||null}getFirstChild(){let t=this.getLatest().__first;return t===null?null:yn(t)}getFirstChildOrThrow(){let t=this.getFirstChild();return t===null&&ge(45,this.__key),t}getLastChild(){let t=this.getLatest().__last;return t===null?null:yn(t)}getLastChildOrThrow(){let t=this.getLastChild();return t===null&&ge(96,this.__key),t}getChildAtIndex(t){let n=this.getChildrenSize(),o,r;if(t<n/2){for(o=this.getFirstChild(),r=0;o!==null&&r<=t;){if(r===t)return o;o=o.getNextSibling(),r++}return null}for(o=this.getLastChild(),r=n-1;o!==null&&r>=t;){if(r===t)return o;o=o.getPreviousSibling(),r--}return null}getTextContent(){let t="",n=this.getChildren(),o=n.length;for(let r=0;r<o;r++){let a=n[r];t+=a.getTextContent(),fe(a)&&r!==o-1&&!a.isInline()&&(t+=zm)}return t}getTextContentSize(){let t=0,n=this.getChildren(),o=n.length;for(let r=0;r<o;r++){let a=n[r];t+=a.getTextContentSize(),fe(a)&&r!==o-1&&!a.isInline()&&(t+=2)}return t}getDirection(){return this.getLatest().__dir}getTextFormat(){return this.getLatest().__textFormat}hasFormat(t){if(t!==""){let n=By[t];return(this.getFormat()&n)!==0}return!1}hasTextFormat(t){let n=Kn[t];return(this.getTextFormat()&n)!==0}getFormatFlags(t,n){return uu(this.getLatest().__textFormat,t,n)}getTextStyle(){return this.getLatest().__textStyle}select(t,n){Pn();let o=Rt(),r=t,a=n,s=this.getChildrenSize();if(!this.canBeEmpty()){if(t===0&&n===0){let l=this.getFirstChild();if(Oe(l)||fe(l))return l.select(0,0)}else if(!(t!==void 0&&t!==s||n!==void 0&&n!==s)){let l=this.getLastChild();if(Oe(l)||fe(l))return l.select()}}r===void 0&&(r=s),a===void 0&&(a=s);let i=this.__key;return je(o)?(o.anchor.set(i,r,"element"),o.focus.set(i,a,"element"),o.dirty=!0,o):ZA(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(n=>n.remove()),t}append(...t){return this.splice(this.getChildrenSize(),0,t)}setDirection(t){let n=this.getWritable();return n.__dir=t,n}setFormat(t){return this.getWritable().__format=t!==""?By[t]:0,this}setStyle(t){return this.getWritable().__style=t||"",this}setTextFormat(t){let n=this.getWritable();return n.__textFormat=t,n}setTextStyle(t){let n=this.getWritable();return n.__textStyle=t,n}setIndent(t){return this.getWritable().__indent=t,this}splice(t,n,o){Am(this)&&ge(324,this.__key,this.__type);let r=this.getChildrenSize(),a=this.getWritable();t+n<=r||ge(226,String(t),String(n),String(r));let s=a.__key,i=[],l=[],d=this.getChildAtIndex(t+n),u=null,f=r-n+o.length;if(t!==0)if(t===r)u=this.getLastChild();else{let m=this.getChildAtIndex(t);m!==null&&(u=m.getPreviousSibling())}if(n>0){let m=u===null?this.getFirstChild():u.getNextSibling();for(let h=0;h<n;h++){m===null&&ge(100);let g=m.getNextSibling(),v=m.__key;ts(m.getWritable()),l.push(v),m=g}}let p=u;for(let m of o){p!==null&&m.is(p)&&(u=p=p.getPreviousSibling());let h=m.getWritable();h.__parent===s&&f--,ts(h);let g=m.__key;if(p===null)a.__first=g,h.__prev=null;else{let v=p.getWritable();v.__next=g,h.__prev=v.__key}m.__key===s&&ge(76),h.__parent=s,i.push(g),p=m}if(t+n===r)p!==null&&(p.getWritable().__next=null,a.__last=p.__key);else if(d!==null){let m=d.getWritable();if(p!==null){let h=p.getWritable();m.__prev=p.__key,h.__next=d.__key}else m.__prev=null}if(a.__size=f,l.length){let m=Rt();if(je(m)){let h=new Set(l),g=new Set(i),{anchor:v,focus:C}=m;WR(v,h,g)&&Nm(v,v.getNode(),this,u,d),WR(C,h,g)&&Nm(C,C.getNode(),this,u,d),f!==0||this.canBeEmpty()||Qo(this)||this.remove()}}return a}getDOMSlot(t){return new sC(t)}exportDOM(t){let{element:n}=super.exportDOM(t);if(no(n)){let o=this.getIndent();o>0&&(n.style.paddingInlineStart=40*o+"px");let r=this.getDirection();r&&(n.dir=r)}return{element:n}}exportJSON(){let t={children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),...super.exportJSON()},n=this.getTextFormat(),o=this.getTextStyle();return n===0&&o===""||Qo(this)||this.getChildren().some(Oe)||(n!==0&&(t.textFormat=n),o!==""&&(t.textStyle=o)),t}updateFromJSON(t){return super.updateFromJSON(t).setFormat(t.format).setIndent(t.indent).setDirection(t.direction).setTextFormat(t.textFormat||0).setTextStyle(t.textStyle||"")}insertNewAfter(t,n){return null}canIndent(){return!0}collapseAtStart(t){return!1}excludeFromCopy(t){return!1}canReplaceWith(t){return!0}canInsertAfter(t){return!0}canBeEmpty(){return!0}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}isInline(){return!1}isShadowRoot(){return!1}canMergeWith(t){return!1}extractWithChild(t,n,o){return!1}canMergeWhenEmpty(){return!1}reconcileObservedMutation(t,n){let o=this.getDOMSlot(t),r=o.getFirstChild();for(let a=this.getFirstChild();a;a=a.getNextSibling()){let s=n.getElementByKey(a.getKey());s!==null&&(r==null?(o.insertChild(s),r=s):r!==s&&o.replaceChild(s,r),r=r.nextSibling)}}};function fe(e){return e instanceof os}function WR(e,t,n){let o=e.getNode();for(;o;){let r=o.__key;if(t.has(r)&&!n.has(r))return!0;o=o.getParent()}return!1}var du=class extends Go{decorate(t,n){return null}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}};function Wt(e){return e instanceof du}var Ml=class e extends os{__cachedText;static getType(){return"root"}static clone(){return new e}constructor(){super("root"),this.__cachedText=null}getTopLevelElementOrThrow(){ge(51)}getTextContent(){let t=this.__cachedText;return!zl()&&Ut()._dirtyType!==0||t===null?super.getTextContent():t}remove(){ge(52)}replace(t){ge(53)}insertBefore(t){ge(54)}insertAfter(t){ge(55)}updateDOM(t,n){return!1}splice(t,n,o){for(let r of o)fe(r)||Wt(r)||ge(282);return super.splice(t,n,o)}static importJSON(t){return Eo().updateFromJSON(t)}collapseAtStart(){return!0}};function Nn(e){return e instanceof Ml}function aE(e){return new cu(new Map(e._nodeMap))}function NC(){return new cu(new Map([["root",new Ml]]))}function sE(e){let t=e.exportJSON(),n=e.constructor;if(t.type!==n.getType()&&ge(130,n.name),fe(e)){let o=t.children;Array.isArray(o)||ge(59,n.name);let r=e.getChildren();for(let a=0;a<r.length;a++){let s=sE(r[a]);o.push(s)}}return t}function dG(e){return e instanceof cu}var cu=class e{_nodeMap;_selection;_flushSync;_readOnly;constructor(t,n){this._nodeMap=t,this._selection=n||null,this._flushSync=!1,this._readOnly=!1}isEmpty(){return this._nodeMap.size===1&&this._selection===null}read(t,n){return $R(n&&n.editor||null,this,t)}clone(t){let n=new e(this._nodeMap,t===void 0?this._selection:t);return n._readOnly=!0,n}toJSON(){return $R(null,this,()=>({root:sE(Eo())}))}},_m=class extends os{static getType(){return"artificial"}createDOM(t){return document.createElement("div")}},Nl=class e extends os{static getType(){return"paragraph"}static clone(t){return new e(t.__key)}createDOM(t){let n=document.createElement("p"),o=Ll(t.theme,"paragraph");return o!==void 0&&n.classList.add(...o),n}updateDOM(t,n,o){return!1}static importDOM(){return{p:t=>({conversion:cG,priority:0})}}exportDOM(t){let{element:n}=super.exportDOM(t);if(no(n)){this.isEmpty()&&n.append(document.createElement("br"));let o=this.getFormatType();o&&(n.style.textAlign=o)}return{element:n}}static importJSON(t){return ma().updateFromJSON(t)}exportJSON(){let t=super.exportJSON();if(t.textFormat===void 0||t.textStyle===void 0){let n=this.getChildren().find(Oe);n?(t.textFormat=n.getFormat(),t.textStyle=n.getStyle()):(t.textFormat=this.getTextFormat(),t.textStyle=this.getTextStyle())}return t}insertNewAfter(t,n){let o=ma();o.setTextFormat(t.format),o.setTextStyle(t.style);let r=this.getDirection();return o.setDirection(r),o.setFormat(this.getFormatType()),o.setStyle(this.getStyle()),this.insertAfter(o,n),o}collapseAtStart(){let t=this.getChildren();if(t.length===0||Oe(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 cG(e){let t=ma();if(e.style&&(t.setFormat(e.style.textAlign),LE(e,t)),t.getFormatType()===""){let n=e.getAttribute("align");n&&n&&n in By&&t.setFormat(n)}return{node:t}}function ma(){return yu(new Nl)}function iE(e){return e instanceof Nl}var Il=0,uG=1,fG=2,pG=3,mG=4;function lE(e,t,n,o){let r=e._keyToDOMMap;r.clear(),e._editorState=NC(),e._pendingEditorState=o,e._compositionKey=null,e._dirtyType=0,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements.clear(),e._normalizedNodes=new Set,e._updateTags=new Set,e._updates=[],e._blockCursorElement=null;let a=e._observer;a!==null&&(a.disconnect(),e._observer=null),t!==null&&(t.textContent=""),n!==null&&(n.textContent="",r.set("root",n))}function dE(e){let t=new Set,n=new Set,o=e;for(;o;){let{ownNodeConfig:r}=Cu(o),a=o.transform;if(!n.has(a)){n.add(a);let s=o.transform();s&&t.add(s)}if(r){let s=r.$transform;s&&t.add(s),o=r.extends}else{let s=Object.getPrototypeOf(o);o=s.prototype instanceof Go&&s!==Go?s:void 0}}return t}function gG(e){let t=e||{},n=iG(),o=t.theme||{},r=e===void 0?n:t.parentEditor||null,a=t.disableEvents||!1,s=NC(),i=t.namespace||(r!==null?r._config.namespace:vE()),l=t.editorState,d=[Ml,gi,Rl,El,Nl,_m,...t.nodes||[]],{onError:u,html:f}=t,p=t.editable===void 0||t.editable,m;if(e===void 0&&n!==null)m=n._nodes;else{m=new Map;for(let g=0;g<d.length;g++){let v=d[g],C=null,y=null;if(typeof v!="function"){let I=v;v=I.replace,C=I.with,y=I.withKlass||null}Cu(v);let x=v.getType(),b=dE(v);m.set(x,{exportDOM:f&&f.export?f.export.get(v):void 0,klass:v,replace:C,replaceWithKlass:y,sharedNodeState:cA(d[g]),transforms:b})}}let h=new rs(s,r,m,{disableEvents:a,namespace:i,theme:o},u||console.error,(function(g,v){let C=new Map,y=new Set,x=b=>{Object.keys(b).forEach(I=>{let T=C.get(I);T===void 0&&(T=[],C.set(I,T)),T.push(b[I])})};return g.forEach(b=>{let I=b.klass.importDOM;if(I==null||y.has(I))return;y.add(I);let T=I.call(b.klass);T!==null&&x(T)}),v&&x(v),C})(m,f?f.import:void 0),p,e);return l!==void 0&&(h._pendingEditorState=l,h._dirtyType=2),(function(g){g.registerCommand(CC,Fj,Il),g.registerCommand(xC,Bj,Il),g.registerCommand(bC,Uj,Il),g.registerCommand(wC,zj,Il),g.registerCommand(kC,Hj,Il)})(h),h}var rs=class{static version;_headless;_parentEditor;_rootElement;_editorState;_pendingEditorState;_compositionKey;_deferred;_keyToDOMMap;_updates;_updating;_listeners;_commands;_nodes;_decorators;_pendingDecorators;_config;_dirtyType;_cloneNotNeeded;_dirtyLeaves;_dirtyElements;_normalizedNodes;_updateTags;_observer;_key;_onError;_htmlConversions;_window;_editable;_blockCursorElement;_createEditorArgs;constructor(t,n,o,r,a,s,i,l){this._createEditorArgs=l,this._parentEditor=n,this._rootElement=null,this._editorState=t,this._pendingEditorState=null,this._compositionKey=null,this._deferred=[],this._keyToDOMMap=new Map,this._updates=[],this._updating=!1,this._listeners={decorator:new Set,editable:new Set,mutation:new Map,root:new Set,textcontent:new Set,update:new Set},this._commands=new Map,this._config=r,this._nodes=o,this._decorators={},this._pendingDecorators=null,this._dirtyType=0,this._cloneNotNeeded=new Set,this._dirtyLeaves=new Set,this._dirtyElements=new Map,this._normalizedNodes=new Set,this._updateTags=new Set,this._observer=null,this._key=vE(),this._onError=a,this._htmlConversions=s,this._editable=i,this._headless=n!==null&&n._headless,this._window=null,this._blockCursorElement=null}isComposing(){return this._compositionKey!=null}registerUpdateListener(t){let n=this._listeners.update;return n.add(t),()=>{n.delete(t)}}registerEditableListener(t){let n=this._listeners.editable;return n.add(t),()=>{n.delete(t)}}registerDecoratorListener(t){let n=this._listeners.decorator;return n.add(t),()=>{n.delete(t)}}registerTextContentListener(t){let n=this._listeners.textcontent;return n.add(t),()=>{n.delete(t)}}registerRootListener(t){let n=this._listeners.root;return t(this._rootElement,null),n.add(t),()=>{t(null,this._rootElement),n.delete(t)}}registerCommand(t,n,o){o===void 0&&ge(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&&ge(36,String(t));let s=a[o];return s.add(n),()=>{s.delete(n),a.every(i=>i.size===0)&&r.delete(t)}}registerMutationListener(t,n,o){let r=this.resolveRegisteredNodeAfterReplacements(this.getRegisteredNode(t)).klass,a=this._listeners.mutation,s=a.get(n);s===void 0&&(s=new Set,a.set(n,s)),s.add(r);let i=o&&o.skipInitialization;return i!==void 0&&i||this.initializeMutationListener(n,r),()=>{s.delete(r),s.size===0&&a.delete(n)}}getRegisteredNode(t){let n=this._nodes.get(t.getType());return n===void 0&&ge(37,t.name),n}resolveRegisteredNodeAfterReplacements(t){for(;t.replaceWithKlass;)t=this.getRegisteredNode(t.replaceWithKlass);return t}initializeMutationListener(t,n){let o=this._editorState,r=cC(o).get(n.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:o,updateTags:new Set(["registerMutationListener"])})}registerNodeTransformToKlass(t,n){let o=this.getRegisteredNode(t);return o.transforms.add(n),o}registerNodeTransform(t,n){let o=this.registerNodeTransformToKlass(t,n),r=[o],a=o.replaceWithKlass;if(a!=null){let s=this.registerNodeTransformToKlass(a,n);r.push(s)}return(function(s,i){let l=cC(s.getEditorState()),d=[];for(let u of i){let f=l.get(u);f&&d.push(f)}d.length!==0&&s.update(()=>{for(let u of d)for(let f of u.keys()){let p=yn(f);p&&p.markDirty()}},s._pendingEditorState===null?{tag:ym}:void 0)})(this,r.map(s=>s.klass.getType())),()=>{r.forEach(s=>s.transforms.delete(n))}}hasNode(t){return this._nodes.has(t.getType())}hasNodes(t){return t.every(this.hasNode.bind(this))}dispatchCommand(t,n){return Le(this,t,n)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(t){let n=this._rootElement;if(t!==n){let o=Ll(this._config.theme,"root"),r=this._pendingEditorState||this._editorState;if(this._rootElement=t,lE(this,n,t,r),n!==null&&(this._config.disableEvents||Kj(n),o!=null&&n.classList.remove(...o)),t!==null){let a=qC(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,dA(this),this._updateTags.add(ym),fa(this),this._config.disableEvents||(function(i,l){let d=i.ownerDocument;Zy.set(i,d);let u=Lm.get(d)??0;u<1&&d.addEventListener("selectionchange",KA),Lm.set(d,u+1),i.__lexicalEditor=l;let f=HA(i);for(let p=0;p<Jy.length;p++){let[m,h]=Jy[p],g=typeof h=="function"?v=>{TR(v)||(IR(v),(l.isEditable()||m==="click")&&h(v,l))}:v=>{if(TR(v))return;IR(v);let C=l.isEditable();switch(m){case"cut":return C&&Le(l,LC,v);case"copy":return Le(l,PC,v);case"paste":return C&&Le(l,SC,v);case"dragstart":return C&&Le(l,RA,v);case"dragover":return C&&Le(l,AA,v);case"dragend":return C&&Le(l,EA,v);case"focus":return C&&Le(l,MA,v);case"blur":return C&&Le(l,NA,v);case"drop":return C&&Le(l,LA,v)}};i.addEventListener(m,g),f.push(()=>{i.removeEventListener(m,g)})}})(t,this),o!=null&&t.classList.add(...o)}else this._window=null,this._updateTags.add(ym),fa(this);Jc("root",this,!1,t,n)}}getElementByKey(t){return this._keyToDOMMap.get(t)||null}getEditorState(){return this._editorState}setEditorState(t,n){t.isEmpty()&&ge(38);let o=t;o._readOnly&&(o=aE(t),o._selection=t._selection?t._selection.clone():null),lA(this);let r=this._pendingEditorState,a=this._updateTags,s=n!==void 0?n.tag:null;r===null||r.isEmpty()||(s!=null&&a.add(s),fa(this)),this._pendingEditorState=o,this._dirtyType=2,this._dirtyElements.set("root",!1),this._compositionKey=null,s!=null&&a.add(s),this._updating||fa(this)}parseEditorState(t,n){return(function(o,r,a){let s=NC(),i=Rn,l=Co,d=An,u=r._dirtyElements,f=r._dirtyLeaves,p=r._cloneNotNeeded,m=r._dirtyType;r._dirtyElements=new Map,r._dirtyLeaves=new Set,r._cloneNotNeeded=new Set,r._dirtyType=0,Rn=s,Co=!1,An=r,_C(null);try{let h=r._nodes;MC(o.root,h),a&&a(),s._readOnly=!0}catch(h){h instanceof Error&&r._onError(h)}finally{r._dirtyElements=u,r._dirtyLeaves=f,r._cloneNotNeeded=p,r._dirtyType=m,Rn=i,Co=l,An=d}return s})(typeof t=="string"?JSON.parse(t):t,this,n)}read(t){return fa(this),this.getEditorState().read(t,{editor:this})}update(t,n){(function(o,r,a){o._updating?o._updates.push([r,a]):Vm(o,r,a)})(this,t,n)}focus(t,n={}){let o=this._rootElement;o!==null&&(o.setAttribute("autocapitalize","off"),Or(this,()=>{let r=Rt(),a=Eo();r!==null?r.dirty||xo(r.clone()):a.getChildrenSize()!==0&&(n.defaultSelection==="rootStart"?a.selectStart():a.selectEnd()),Gm("focus"),wE(()=>{o.removeAttribute("autocapitalize"),t&&t()})}),this._pendingEditorState===null&&o.removeAttribute("autocapitalize"))}blur(){let t=this._rootElement;t!==null&&t.blur();let n=yr(this._window);n!==null&&n.removeAllRanges()}isEditable(){return this._editable}setEditable(t){this._editable!==t&&(this._editable=t,Jc("editable",this,!0,t))}toJSON(){return{editorState:this._editorState.toJSON()}}};rs.version="0.41.0+prod.esm";var iC=null;function _C(e){iC=e}var cE=1;function hG(){cE=1}function DC(e,t){let n=OC(e,t);return n===void 0&&ge(30,t),n}function OC(e,t){return e._nodes.get(t)}var vG=typeof queueMicrotask=="function"?queueMicrotask:e=>{Promise.resolve().then(e)};function uE(e){return Wt(jm(e))}function FC(e){let t=document.activeElement;if(!no(t))return!1;let n=t.nodeName;return Wt(jm(e))&&(n==="INPUT"||n==="TEXTAREA"||t.contentEditable==="true"&&hu(t)==null)}function gu(e,t,n){let o=e.getRootElement();try{return o!==null&&o.contains(t)&&o.contains(n)&&t!==null&&!FC(t)&&BC(t)===e}catch{return!1}}function qm(e){return e instanceof rs}function BC(e){let t=e;for(;t!=null;){let n=hu(t);if(qm(n))return n;t=vu(t)}return null}function hu(e){return e?e.__lexicalEditor:null}function yG(e){return cj.test(e)?"rtl":uj.test(e)?"ltr":null}function es(e){return AC(e)||e.isToken()}function ua(e){return es(e)||e.isSegmented()}function Fr(e){return Hl(e)&&e.nodeType===3}function fE(e){return Hl(e)&&e.nodeType===9}function vi(e){let t=e;for(;t!=null;){if(Fr(t))return t;t=t.firstChild}return null}function uu(e,t,n){let o=Kn[t];if(n!==null&&(e&o)===(n&o))return e;let r=e^o;return t==="subscript"?r&=~Kn.superscript:t==="superscript"?r&=~Kn.subscript:t==="lowercase"?(r&=~Kn.uppercase,r&=~Kn.capitalize):t==="uppercase"?(r&=~Kn.lowercase,r&=~Kn.capitalize):t==="capitalize"&&(r&=~Kn.lowercase,r&=~Kn.uppercase),r}function CG(e){return Oe(e)||fi(e)||Wt(e)}function pE(e,t){let n=(function(){let s=iC;return iC=null,s})();if((t=t||n&&n.__key)!=null)return void(e.__key=t);Pn(),nE();let o=Ut(),r=va(),a=""+cE++;r._nodeMap.set(a,e),fe(e)?o._dirtyElements.set(a,!0):o._dirtyLeaves.add(a),o._cloneNotNeeded.add(a),o._dirtyType=1,e.__key=a}function ts(e){let t=e.getParent();if(t!==null){let n=e.getWritable(),o=t.getWritable(),r=e.getPreviousSibling(),a=e.getNextSibling(),s=a!==null?a.__key:null,i=r!==null?r.__key:null,l=r!==null?r.getWritable():null,d=a!==null?a.getWritable():null;r===null&&(o.__first=s),a===null&&(o.__last=i),l!==null&&(l.__next=s),d!==null&&(d.__prev=i),n.__prev=null,n.__next=null,n.__parent=null,o.__size--}}function Dm(e){nE(),Am(e)&&ge(323,e.__key,e.__type);let t=e.getLatest(),n=t.__parent,o=va(),r=Ut(),a=o._nodeMap,s=r._dirtyElements;n!==null&&(function(l,d,u){let f=l;for(;f!==null;){if(u.has(f))return;let p=d.get(f);if(p===void 0)break;u.set(f,!1),f=p.__parent}})(n,a,s);let i=t.__key;r._dirtyType=1,fe(e)?s.set(i,!0):r._dirtyLeaves.add(i)}function Ln(e){Pn();let t=Ut(),n=t._compositionKey;if(e!==n){if(t._compositionKey=e,n!==null){let o=yn(n);o!==null&&o.getWritable()}if(e!==null){let o=yn(e);o!==null&&o.getWritable()}}}function Za(){return zl()?null:Ut()._compositionKey}function yn(e,t){let n=(t||va())._nodeMap.get(e);return n===void 0?null:n}function UC(e,t){let n=Wm(e,Ut());return n!==void 0?yn(n,t):null}function Wm(e,t){return e[`__lexicalKey_${t._key}`]}function jm(e,t){let n=e;for(;n!=null;){let o=UC(n,t);if(o!==null)return o;n=vu(n)}return null}function mE(e){let t=e._decorators,n=Object.assign({},t);return e._pendingDecorators=n,n}function jR(e){return e.read(()=>Eo().getTextContent())}function Eo(){return gE(va())}function gE(e){return e._nodeMap.get("root")}function xo(e){Pn();let t=va();e!==null&&(e.dirty=!0,e.setCachedNodes(null)),t._selection=e}function Tl(e){let t=Ut(),n=(function(o,r){let a=o;for(;a!=null;){let s=Wm(a,r);if(s!==void 0)return s;a=vu(a)}return null})(e,t);return n===null?e===t.getRootElement()?yn("root"):null:yn(n)}function hE(e){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(e)}function zC(e){let t=[],n=e;for(;n!==null;)t.push(n),n=n._parentEditor;return t}function vE(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,5)}function yE(e){return Fr(e)?e.nodeValue:null}function HC(e,t,n){let o=yr(Mo(t));if(o===null)return;let r=o.anchorNode,{anchorOffset:a,focusOffset:s}=o;if(r!==null){let i=yE(r),l=jm(r);if(i!==null&&Oe(l)){if((i===nu||i===gC)&&n){let d=n.length;i=n,a=d,s=d}i!==null&&KC(l,i,a,s,e)}}}function KC(e,t,n,o,r){let a=e;if(a.isAttached()&&(r||!a.isDirty())){let s=a.isComposing(),i=t;if((s||r)&&(t.endsWith(nu)&&(i=t.slice(0,-nu.length)),r)){let d=gC,u;for(;(u=i.indexOf(d))!==-1;)i=i.slice(0,u)+i.slice(u+d.length),n!==null&&n>u&&(n=Math.max(u,n-d.length)),o!==null&&o>u&&(o=Math.max(u,o-d.length))}let l=a.getTextContent();if(r||i!==l){if(i===""){if(Ln(null),Bm||pu||Um)a.remove();else{let g=Ut();setTimeout(()=>{g.update(()=>{a.isAttached()&&a.remove()})},20)}return}let d=a.getParent(),u=Ci(),f=a.getTextContentSize(),p=Za(),m=a.getKey();if(a.isToken()||p!==null&&m===p&&!s||je(u)&&(d!==null&&!d.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===f&&!a.canInsertTextAfter()&&!s))return void a.markDirty();let h=Rt();if(!je(h)||n===null||o===null)return void GR(a,i,h);if(h.setTextNodeRange(a,n,a,o),a.isSegmented()){let g=kn(a.getTextContent());a.replace(g),a=g}GR(a,i,h)}}}function GR(e,t,n){if(e.setTextContent(t),je(n)){let o=e.getKey();for(let r of["anchor","focus"]){let a=n[r];a.type==="text"&&a.key===o&&(a.offset=gr(e,a.offset,"clamp"))}}}function fm(e,t,n){let o=t[n]||!1;return o==="any"||o===e[n]}function CE(e,t){return fm(e,t,"altKey")&&fm(e,t,"ctrlKey")&&fm(e,t,"shiftKey")&&fm(e,t,"metaKey")}function Mt(e,t,n){if(!CE(e,n))return!1;if(e.key.toLowerCase()===t.toLowerCase())return!0;if(t.length>1||e.key.length===1&&e.key.charCodeAt(0)<=127)return!1;let o="Key"+t.toUpperCase();return e.code===o}var ca={ctrlKey:!ur,metaKey:ur},QR={altKey:ur,ctrlKey:!ur};function XR(e){return e.key==="Backspace"}function YR(e){return Mt(e,"a",ca)}function xG(e){let t=Eo();if(je(e)){let n=e.anchor,o=e.focus,r=n.getNode().getTopLevelElementOrThrow().getParentOrThrow();return n.set(r.getKey(),0,"element"),o.set(r.getKey(),r.getChildrenSize(),"element"),wm(e),e}{let n=t.select(0,t.getChildrenSize());return xo(wm(n)),n}}function Ll(e,t){e.__lexicalClassNameCache===void 0&&(e.__lexicalClassNameCache={});let n=e.__lexicalClassNameCache,o=n[t];if(o!==void 0)return o;let r=e[t];if(typeof r=="string"){let a=xu(r);return n[t]=a,a}return r}function $C(e,t,n,o,r){if(n.size===0)return;let a=o.__type,s=o.__key,i=t.get(a);i===void 0&&ge(33,a);let l=i.klass,d=e.get(l);d===void 0&&(d=new Map,e.set(l,d));let u=d.get(s),f=u==="destroyed"&&r==="created";(u===void 0||f)&&d.set(s,f?"updated":r)}function bG(e){let t=e.getType(),n=va();if(n._readOnly){let a=cC(n).get(t);return a?Array.from(a.values()):[]}let o=n._nodeMap,r=[];for(let[,a]of o)a instanceof e&&a.__type===t&&a.isAttached()&&r.push(a);return r}function JR(e,t,n){let o=e.getParent(),r=n,a=e;return o!==null&&(t&&n===0?(r=a.getIndexWithinParent(),a=o):t||n!==a.getChildrenSize()||(r=a.getIndexWithinParent()+1,a=o)),a.getChildAtIndex(t?r-1:r)}function xE(e,t){let n=e.offset;if(e.type==="element")return JR(e.getNode(),t,n);{let o=e.getNode();if(t&&n===0||!t&&n===o.getTextContentSize()){let r=t?o.getPreviousSibling():o.getNextSibling();return r===null?JR(o.getParentOrThrow(),t,o.getIndexWithinParent()+(t?0:1)):r}}return null}function bE(e){let t=Mo(e).event,n=t&&t.inputType;return n==="insertFromPaste"||n==="insertFromPasteAsQuotation"}function Le(e,t,n){return(function(o,r,a){let s=zC(o);for(let i=4;i>=0;i--)for(let l=0;l<s.length;l++){let d=s[l],u=d._commands.get(r);if(u!==void 0){let f=u[i];if(f!==void 0){let p=Array.from(f),m=p.length,h=!1;if(Or(d,()=>{for(let g=0;g<m;g++)if(p[g](a,o))return void(h=!0)}),h)return h}}}return!1})(e,t,n)}function _l(e,t){let n=e._keyToDOMMap.get(t);return n===void 0&&ge(75,t),n}function vu(e){let t=e.assignedSlot||e.parentElement;return kE(t)?t.host:t}function VC(e){return fE(e)?e:no(e)?e.ownerDocument:null}function wG(e){return Ut()._updateTags.has(e)}function Gm(e){Pn(),Ut()._updateTags.add(e)}function wE(e){Pn(),Ut()._deferred.push(e)}function Om(e,t){let n=e.getParent();for(;n!==null;){if(n.is(t))return!0;n=n.getParent()}return!1}function qC(e){let t=VC(e);return t?t.defaultView:null}function Mo(e){let t=e._window;return t===null&&ge(78),t}function SG(e){return fe(e)&&e.isInline()||Wt(e)&&e.isInline()}function SE(e){let t=e.getParentOrThrow();for(;t!==null;){if(Qo(t))return t;t=t.getParentOrThrow()}return t}function Qo(e){return Nn(e)||fe(e)&&e.isShadowRoot()}function WC(e){let t=e.constructor.clone(e);return pE(t,null),t.afterCloneFrom(e),t}function yu(e){let t=Ut(),n=e.getType(),o=OC(t,n);o===void 0&&ge(200,e.constructor.name,n);let{replace:r,replaceWithKlass:a}=o;if(r!==null){let s=r(e),i=s.constructor;return a!==null?s instanceof a||ge(201,a.name,a.getType(),i.name,i.getType(),e.constructor.name,n):s instanceof e.constructor&&i!==e.constructor||ge(202,i.name,i.getType(),e.constructor.name,n),s.__key===e.__key&&ge(203,e.constructor.name,n,i.name,i.getType()),s}return e}function _y(e,t){!Nn(e.getParent())||fe(t)||Wt(t)||ge(99)}function IE(e){let t=yn(e);return t===null&&ge(63,e),t}function Dy(e){return(Wt(e)||fe(e)&&!e.canBeEmpty())&&!e.isInline()}function lC(e,t,n){n.style.removeProperty("caret-color"),t._blockCursorElement=null;let o=e.parentElement;o!==null&&o.removeChild(e)}function yr(e){return vr?(e||window).getSelection():null}function TE(e){let t=qC(e);return t?t.getSelection():null}function IG(e,t){let n=e.getChildAtIndex(t);n==null&&(n=e),Qo(e)&&ge(102);let o=s=>{let i=s.getParentOrThrow(),l=Qo(i),d=s!==n||l?WC(s):s;if(l)return fe(s)&&fe(d)||ge(133),s.insertAfter(d),[s,d,d];{let[u,f,p]=o(i),m=s.getNextSiblings();return p.append(d,...m),[u,f,d]}},[r,a]=o(n);return[r,a]}function TG(e){return no(e)&&e.tagName==="A"}function no(e){return Hl(e)&&e.nodeType===1}function Hl(e){return typeof e=="object"&&e!==null&&"nodeType"in e&&typeof e.nodeType=="number"}function kE(e){return Hl(e)&&e.nodeType===11}function PE(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 dC(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 pa(e){if(Wt(e)&&!e.isInline())return!0;if(!fe(e)||Qo(e))return!1;let t=e.getFirstChild(),n=t===null||fi(t)||Oe(t)||t.isInline();return!e.isInline()&&e.canBeEmpty()!==!1&&n}function jC(){return Ut()}var ZR=new WeakMap,kG=new Map;function cC(e){if(!e._readOnly&&e.isEmpty())return kG;e._readOnly||ge(192);let t=ZR.get(e);return t||(t=(function(n){let o=new Map;for(let[r,a]of n._nodeMap){let s=a.__type,i=o.get(s);i||(i=new Map,o.set(s,i)),i.set(r,a)}return o})(e),ZR.set(e,t)),t}function GC(e){let t=e.constructor.clone(e);return t.afterCloneFrom(e),t}function PG(e){return(t=GC(e))[$A]=!0,t;var t}function LE(e,t){let n=parseInt(e.style.paddingInlineStart,10)||0,o=Math.round(n/40);t.setIndent(o)}function LG(e){e.__lexicalUnmanaged=!0}function RE(e){return e.__lexicalUnmanaged===!0}function Gc(e,t){return(function(n,o){return Object.prototype.hasOwnProperty.call(n,o)})(e,t)&&e[t]!==Go[t]}function Cu(e){let t=uR in e.prototype?e.prototype[uR]():void 0,n=(function(s){if(!(s===Go||s.prototype instanceof Go)){let i="<unknown>",l="<unknown>";try{i=s.getType()}catch{}try{rs.version&&(l=JSON.parse(rs.version))}catch{}ge(290,s.name,i,l)}return s===du||s===os||s===Go})(e),o=!n&&Gc(e,"getType")?e.getType():void 0,r,a=o;if(t)if(o)r=t[o];else for(let[s,i]of Object.entries(t))a=s,r=i;if(!n&&a&&(Gc(e,"getType")||(e.getType=()=>a),Gc(e,"clone")||(e.clone=s=>(_C(s),new e)),Gc(e,"importJSON")||(e.importJSON=r&&r.$importJSON||(s=>new e().updateFromJSON(s))),!Gc(e,"importDOM")&&r)){let{importDOM:s}=r;s&&(e.importDOM=()=>s)}return{ownNodeConfig:r,ownNodeType:a}}function RG(e){let t=jC();return Pn(),new(t.resolveRegisteredNodeAfterReplacements(t.getRegisteredNode(e))).klass}var Zc=(e,t)=>{let n=e;for(;n!=null&&!Nn(n);){if(t(n))return n;n=n.getParent()}return null},AG={next:"previous",previous:"next"},Dl=class{origin;constructor(t){this.origin=t}[Symbol.iterator](){return YC({hasNext:yi,initial:this.getAdjacentCaret(),map:t=>t,step:t=>t.getAdjacentCaret()})}getAdjacentCaret(){return En(this.getNodeAtCaret(),this.direction)}getSiblingCaret(){return En(this.origin,this.direction)}remove(){let t=this.getNodeAtCaret();return t&&t.remove(),this}replaceOrInsert(t,n){let o=this.getNodeAtCaret();return t.is(this.origin)||t.is(o)||(o===null?this.insert(t):o.replace(t,n)),this}splice(t,n,o="next"){let r=o===this.direction?n:Array.from(n).reverse(),a=this,s=this.getParentAtCaret(),i=new Map;for(let l=a.getAdjacentCaret();l!==null&&i.size<t;l=l.getAdjacentCaret()){let d=l.origin.getWritable();i.set(d.getKey(),d)}for(let l of r){if(i.size>0){let d=a.getNodeAtCaret();if(d){if(i.delete(d.getKey()),i.delete(l.getKey()),!(d.is(l)||a.origin.is(l))){let u=l.getParent();u&&u.is(s)&&l.remove(),d.replace(l)}}else d===null&&ge(263,Array.from(i).join(" "))}else a.insert(l);a=En(l,this.direction)}for(let l of i.values())l.remove();return this}},fu=class e extends Dl{type="child";getLatest(){let t=this.origin.getLatest();return t===this.origin?this:ha(t,this.direction)}getParentCaret(t="root"){return En(QC(this.getParentAtCaret(),t),this.direction)}getFlipped(){let t=ds(this.direction);return En(this.getNodeAtCaret(),t)||ha(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)}},EG={root:Nn,shadowRoot:Qo};function ds(e){return AG[e]}function QC(e,t="root"){return EG[t](e)?null:e}var Ol=class e extends Dl{type="sibling";getLatest(){let t=this.origin.getLatest();return t===this.origin?this:En(t,this.direction)}getSiblingCaret(){return this}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return fe(this.origin)?ha(this.origin,this.direction):null}getParentCaret(t="root"){return En(QC(this.getParentAtCaret(),t),this.direction)}getFlipped(){let t=ds(this.direction);return En(this.getNodeAtCaret(),t)||ha(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 Fl)&&this.direction===t.direction&&this.origin.is(t.origin)}},Fl=class e extends Dl{type="text";offset;constructor(t,n){super(t),this.offset=n}getLatest(){let t=this.origin.getLatest();return t===this.origin?this:as(t,this.direction,this.offset)}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return null}getParentCaret(t="root"){return En(QC(this.getParentAtCaret(),t),this.direction)}getFlipped(){return as(this.origin,ds(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 Ol||t instanceof e)&&this.direction===t.direction&&this.origin.is(t.origin)}getSiblingCaret(){return En(this.origin,this.direction)}};function ga(e){return e instanceof Fl}function MG(e){return e instanceof Dl}function yi(e){return e instanceof Ol}function mr(e){return e instanceof fu}var NG={next:class extends Fl{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends Fl{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},_G={next:class extends Ol{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends Ol{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},DG={next:class extends fu{direction="next";getNodeAtCaret(){return this.origin.getFirstChild()}insert(e){return this.origin.splice(0,0,[e]),this}},previous:class extends fu{direction="previous";getNodeAtCaret(){return this.origin.getLastChild()}insert(e){return this.origin.splice(this.origin.getChildrenSize(),0,[e]),this}}};function En(e,t){return e?new _G[t](e):null}function as(e,t,n){return e?new NG[t](e,gr(e,n)):null}function gr(e,t,n="error"){let o=e.getTextContentSize(),r=t==="next"?o:t==="previous"?0:t;return(r<0||r>o)&&(n!=="clamp"&&nA(284,String(t),String(o),e.getKey()),r=r<0?0:o),r}function uC(e,t){return new Fm(e,t)}function ha(e,t){return fe(e)?new DG[t](e):null}function AE(e){return e&&e.getChildCaret()||e}function Bl(e){return e&&AE(e.getAdjacentCaret())}var fC=class e{type="node-caret-range";direction;anchor;focus;constructor(t,n,o){this.anchor=t,this.focus=n,this.direction=o}getLatest(){let t=this.anchor.getLatest(),n=this.focus.getLatest();return t===this.anchor&&n===this.focus?this:new e(t,n,this.direction)}isCollapsed(){return this.anchor.isSamePointCaret(this.focus)}getTextSlices(){let t=r=>{let a=this[r].getLatest();return ga(a)?(function(s,i){let{direction:l,origin:d}=s,u=gr(d,i==="focus"?ds(l):l);return uC(s,u-s.offset)})(a,r):null},n=t("anchor"),o=t("focus");if(n&&o){let{caret:r}=n,{caret:a}=o;if(r.isSameNodeCaret(a))return[uC(r,a.offset-r.offset),null]}return[n,o]}iterNodeCarets(t="root"){let n=ga(this.anchor)?this.anchor.getSiblingCaret():this.anchor.getLatest(),o=this.focus.getLatest(),r=ga(o),a=s=>s.isSameNodeCaret(o)?null:Bl(s)||s.getParentCaret(t);return YC({hasNext:s=>s!==null&&!(r&&o.isSameNodeCaret(s)),initial:n.isSameNodeCaret(o)?null:a(n),map:s=>s,step:a})}[Symbol.iterator](){return this.iterNodeCarets("root")}},Fm=class{type="slice";caret;distance;constructor(t,n){this.caret=t,this.distance=n}getSliceIndices(){let{distance:t,caret:{offset:n}}=this,o=n+t;return o<n?[o,n]:[n,o]}getTextContent(){let[t,n]=this.getSliceIndices();return this.caret.origin.getTextContent().slice(t,n)}getTextContentSize(){return Math.abs(this.distance)}removeTextSlice(){let{caret:{origin:t,direction:n}}=this,[o,r]=this.getSliceIndices(),a=t.getTextContent();return as(t.setTextContent(a.slice(0,o)+a.slice(r)),n,o)}};function OG(e){return e instanceof Fm}function XC(e){return ss(e,En(Eo(),e.direction))}function EE(e){return ss(e,e)}function ss(e,t){return e.direction!==t.direction&&ge(265),new fC(e,t,e.direction)}function YC(e){let{initial:t,hasNext:n,step:o,map:r}=e,a=t;return{[Symbol.iterator](){return this},next(){if(!n(a))return{done:!0,value:void 0};let s={done:!1,value:r(a)};return a=o(a),s}}}function JC(e,t){let n=eu(e.origin,t.origin);switch(n===null&&ge(275,e.origin.getKey(),t.origin.getKey()),n.type){case"same":{let o=e.type==="text",r=t.type==="text";return o&&r?(function(a,s){return Math.sign(a-s)})(e.offset,t.offset):e.type===t.type?0:o?-1:r?1:e.type==="child"?-1:1}case"ancestor":return e.type==="child"?-1:1;case"descendant":return t.type==="child"?1:-1;case"branch":return ZC(n)}}function ZC(e){let{a:t,b:n}=e,o=t.__key,r=n.__key,a=t,s=n;for(;a&&s;a=a.getNextSibling(),s=s.getNextSibling()){if(a.__key===r)return-1;if(s.__key===o)return 1}return a===null?1:-1}function pm(e,t){return t.is(e)}function eA(e){return fe(e)?[e.getLatest(),null]:[e.getParent(),e.getLatest()]}function eu(e,t){if(e.is(t))return{commonAncestor:e,type:"same"};let n=new Map;for(let[o,r]=eA(e);o;r=o,o=o.getParent())n.set(o,r);for(let[o,r]=eA(t);o;r=o,o=o.getParent()){let a=n.get(o);if(a!==void 0)return a===null?(pm(e,o)||ge(276),{commonAncestor:o,type:"ancestor"}):r===null?(pm(t,o)||ge(277),{commonAncestor:o,type:"descendant"}):((fe(a)||pm(e,a))&&(fe(r)||pm(t,r))&&o.is(a.getParent())&&o.is(r.getParent())||ge(278),{a,b:r,commonAncestor:o,type:"branch"})}return null}function is(e,t){let{type:n,key:o,offset:r}=e,a=IE(e.key);return n==="text"?(Oe(a)||ge(266,a.getType(),o),as(a,t,r)):(fe(a)||ge(267,a.getType(),o),DE(a,e.offset,t))}function Ul(e,t){let{origin:n,direction:o}=t,r=o==="next";ga(t)?e.set(n.getKey(),t.offset,"text"):yi(t)?Oe(n)?e.set(n.getKey(),gr(n,o),"text"):e.set(n.getParentOrThrow().getKey(),n.getIndexWithinParent()+(r?1:0),"element"):(mr(t)&&fe(n)||ge(268),e.set(n.getKey(),r?0:n.getChildrenSize(),"element"))}function ME(e){let t=Rt(),n=je(t)?t:eE();return tu(n,e),xo(n),n}function tu(e,t){Ul(e.anchor,t.anchor),Ul(e.focus,t.focus)}function pC(e){let{anchor:t,focus:n}=e,o=is(t,"next"),r=is(n,"next"),a=JC(o,r)<=0?"next":"previous";return ss(ls(o,a),ls(r,a))}function Kl(e){let{direction:t,origin:n}=e,o=En(n,ds(t)).getNodeAtCaret();return o?En(o,t):ha(n.getParentOrThrow(),t)}function tA(e,t="root"){let n=[e];for(let o=mr(e)?e.getParentCaret(t):e.getSiblingCaret();o!==null;o=o.getParentCaret(t))n.push(Kl(o));return n}function Oy(e){return!!e&&e.origin.isAttached()}function NE(e,t="removeEmptySlices"){if(e.isCollapsed())return e;let n="root",o="next",r=t,a=ex(e,o),s=tA(a.anchor,n),i=tA(a.focus.getFlipped(),n),l=new Set,d=[];for(let h of a.iterNodeCarets(n))if(mr(h))l.add(h.origin.getKey());else if(yi(h)){let{origin:g}=h;fe(g)&&!l.has(g.getKey())||d.push(g)}for(let h of d)h.remove();for(let h of a.getTextSlices()){if(!h)continue;let{origin:g}=h.caret,v=g.getTextContentSize(),C=Kl(En(g,o)),y=g.getMode();if(Math.abs(h.distance)===v&&r==="removeEmptySlices"||y==="token"&&h.distance!==0)C.remove();else if(h.distance!==0){r="removeEmptySlices";let x=h.removeTextSlice(),b=h.caret.origin;if(y==="segmented"){let I=x.origin,T=kn(I.getTextContent()).setStyle(I.getStyle()).setFormat(I.getFormat());C.replaceOrInsert(T),x=as(T,o,x.offset)}b.is(s[0].origin)&&(s[0]=x),b.is(i[0].origin)&&(i[0]=x.getFlipped())}}let u,f;for(let h of s)if(Oy(h)){u=fr(h);break}for(let h of i)if(Oy(h)){f=fr(h);break}let p=(function(h,g,v){if(!h||!g)return null;let C=h.getParentAtCaret(),y=g.getParentAtCaret();if(!C||!y)return null;let x=C.getParents().reverse();x.push(C);let b=y.getParents().reverse();b.push(y);let I=Math.min(x.length,b.length),T;for(T=0;T<I&&x[T]===b[T];T++);let P=(L,R)=>{let N;for(let A=T;A<L.length;A++){let D=L[A];if(Qo(D))return;!N&&R(D)&&(N=D)}return N},k=P(x,pa),w=k&&P(b,L=>v.has(L.getKey())&&pa(L));return k&&w?[k,w]:null})(u,f,l);if(p){let[h,g]=p;ha(h,"previous").splice(0,g.getChildren());let v=g.getParent();for(g.remove(!0);v&&v.isEmpty();){let C=v;v=v.getParent(),C.remove(!0)}}let m=[u,f,...s,...i].find(Oy);if(m)return EE(ls(fr(m),e.direction));ge(269,JSON.stringify(s.map(h=>h.origin.__key)))}function fr(e){let t=(function(r){let a=r;for(;mr(a);){let s=Bl(a);if(!mr(s))break;a=s}return a})(e.getLatest()),{direction:n}=t;if(Oe(t.origin))return ga(t)?t:as(t.origin,n,n);let o=t.getAdjacentCaret();return yi(o)&&Oe(o.origin)?as(o.origin,n,ds(n)):t}function _E(e){return ga(e)&&e.offset!==gr(e.origin,e.direction)}function ls(e,t){return e.direction===t?e:e.getFlipped()}function ex(e,t){return e.direction===t?e:ss(ls(e.focus,t),ls(e.anchor,t))}function DE(e,t,n){let o=ha(e,"next");for(let r=0;r<t;r++){let a=o.getAdjacentCaret();if(a===null)break;o=a}return ls(o,n)}function FG(e,t="root"){let n=0,o=e,r=Bl(o);for(;r===null;){if(n--,r=o.getParentCaret(t),!r)return null;o=r,r=Bl(o)}return r&&[r,n]}function BG(e){let{origin:t,offset:n,direction:o}=e;if(n===gr(t,o))return e.getSiblingCaret();if(n===gr(t,ds(o)))return Kl(e.getSiblingCaret());let[r]=t.splitText(n);return Oe(r)||ge(281),ls(En(r,"next"),o)}function UG(e,t){return!0}function zG(e,{$copyElementNode:t=WC,$splitTextPointCaretNext:n=BG,rootMode:o="shadowRoot",$shouldSplit:r=UG}={}){if(ga(e))return n(e);let a=e.getParentCaret(o);if(a){let{origin:s}=a;if(mr(e)&&(!s.canBeEmpty()||!r(s,"first")))return Kl(a);let i=(function(l){let d=[];for(let u=l.getAdjacentCaret();u;u=u.getAdjacentCaret())d.push(u.origin);return d})(e);(i.length>0||s.canBeEmpty()&&r(s,"last"))&&a.insert(t(s).splice(0,0,i))}return a}function HG(e){return e}function KG(...e){return e}function $G(e,t){return[e,t]}function VG(e){return e}function qG(e,t){if(!t||e===t)return e;for(let n in t)if(e[n]!==t[n])return{...e,...t};return e}function xu(...e){let t=[];for(let n of e)if(n&&typeof n=="string")for(let[o]of n.matchAll(/\S+/g))t.push(o);return t}function WG(e,...t){let n=xu(...t);n.length>0&&e.classList.add(...n)}function jG(e,...t){let n=xu(...t);n.length>0&&e.classList.remove(...n)}function GG(...e){return()=>{for(let t=e.length-1;t>=0;t--)e[t]();e.length=0}}var O=tx,Vpe=O.$addUpdateTag,cs=O.$applyNodeReplacement,$l=O.$caretFromPoint,OE=O.$caretRangeFromSelection,Qm=O.$cloneWithProperties,FE=O.$cloneWithPropertiesEphemeral,qpe=O.$comparePointCaretNext,Wpe=O.$copyNode,BE=O.$create,xi=O.$createLineBreakNode,UE=O.$createNodeSelection,Xo=O.$createParagraphNode,jpe=O.$createPoint,bi=O.$createRangeSelection,zE=O.$createRangeSelectionFromDom,HE=O.$createTabNode,Cr=O.$createTextNode,KE=O.$extendCaretToRange,ya=O.$findMatchingParent,nx=O.$getAdjacentChildCaret,Gpe=O.$getAdjacentNode,wi=O.$getAdjacentSiblingOrParentSiblingCaret,ox=O.$getCaretInDirection,$E=O.$getCaretRange,Qpe=O.$getCaretRangeInDirection,VE=O.$getCharacterOffsets,us=O.$getChildCaret,Xpe=O.$getChildCaretAtIndex,rx=O.$getChildCaretOrSelf,qE=O.$getCollapsedCaretRange,Ype=O.$getCommonAncestor,Jpe=O.$getCommonAncestorResultBranchOrder,Xm=O.$getEditor,Zpe=O.$getNearestNodeFromDOMNode,eme=O.$getNearestRootOrShadowRoot,Vl=O.$getNodeByKey,tme=O.$getNodeByKeyOrThrow,WE=O.$getNodeFromDOMNode,bu=O.$getPreviousSelection,Tt=O.$getRoot,De=O.$getSelection,Ca=O.$getSiblingCaret,Ym=O.$getState,nme=O.$getStateChange,ome=O.$getTextContent,rme=O.$getTextNodeOffset,ame=O.$getTextPointCaret,sme=O.$getTextPointCaretSlice,ime=O.$getWritableNodeState,jE=O.$hasAncestor,lme=O.$hasUpdateTag,dme=O.$insertNodes,ql=O.$isBlockElementNode,wu=O.$isChildCaret,Jm=O.$isDecoratorNode,GE=O.$isEditorState,qe=O.$isElementNode,QE=O.$isExtendableTextPointCaret,cme=O.$isInlineElementOrDecoratorNode,XE=O.$isLeafNode,Wl=O.$isLineBreakNode,ume=O.$isNodeCaret,ax=O.$isNodeSelection,YE=O.$isParagraphNode,ke=O.$isRangeSelection,Su=O.$isRootNode,Si=O.$isRootOrShadowRoot,JE=O.$isSiblingCaret,fme=O.$isTabNode,it=O.$isTextNode,Zm=O.$isTextPointCaret,pme=O.$isTextPointCaretSlice,sx=O.$isTokenOrSegmented,mme=O.$isTokenOrTab,gme=O.$nodesOfType,ZE=O.$normalizeCaret,eM=O.$normalizeSelection__EXPERIMENTAL,hme=O.$onUpdate,tM=O.$parseSerializedNode,vme=O.$removeTextFromCaretRange,nM=O.$rewindSiblingCaret,eg=O.$selectAll,yme=O.$setCompositionKey,Cme=O.$setPointFromCaret,xr=O.$setSelection,oM=O.$setSelectionFromCaretRange,tg=O.$setState,rM=O.$splitAtPointCaretNext,aM=O.$splitNode,xme=O.$updateRangeSelectionFromCaretRange,ix=O.ArtificialNode__DO_NOT_USE,bme=O.BEFORE_INPUT_COMMAND,sM=O.BLUR_COMMAND,Iu=O.CAN_REDO_COMMAND,Tu=O.CAN_UNDO_COMMAND,ng=O.CLEAR_EDITOR_COMMAND,iM=O.CLEAR_HISTORY_COMMAND,lM=O.CLICK_COMMAND,wme=O.COLLABORATION_TAG,og=O.COMMAND_PRIORITY_CRITICAL,jt=O.COMMAND_PRIORITY_EDITOR,Yo=O.COMMAND_PRIORITY_HIGH,jl=O.COMMAND_PRIORITY_LOW,Sme=O.COMMAND_PRIORITY_NORMAL,Ime=O.COMPOSITION_END_COMMAND,dM=O.COMPOSITION_END_TAG,Tme=O.COMPOSITION_START_COMMAND,cM=O.COMPOSITION_START_TAG,uM=O.CONTROLLED_TEXT_INSERTION_COMMAND,rg=O.COPY_COMMAND,fM=O.CUT_COMMAND,ag=O.DELETE_CHARACTER_COMMAND,pM=O.DELETE_LINE_COMMAND,mM=O.DELETE_WORD_COMMAND,kme=O.DRAGEND_COMMAND,Pme=O.DRAGOVER_COMMAND,gM=O.DRAGSTART_COMMAND,hM=O.DROP_COMMAND,No=O.DecoratorNode,Lme=O.ElementNode,vM=O.FOCUS_COMMAND,Rme=O.FORMAT_ELEMENT_COMMAND,yM=O.FORMAT_TEXT_COMMAND,sg=O.HISTORIC_TAG,_o=O.HISTORY_MERGE_TAG,CM=O.HISTORY_PUSH_TAG,lx=O.INDENT_CONTENT_COMMAND,Ame=O.INPUT_COMMAND,dx=O.INSERT_LINE_BREAK_COMMAND,xM=O.INSERT_PARAGRAPH_COMMAND,bM=O.INSERT_TAB_COMMAND,ku=O.INTERNAL_$isBlock,Eme=O.IS_ALL_FORMATTING,Mme=O.IS_BOLD,Nme=O.IS_CODE,_me=O.IS_HIGHLIGHT,Dme=O.IS_ITALIC,Ome=O.IS_STRIKETHROUGH,Fme=O.IS_SUBSCRIPT,Bme=O.IS_SUPERSCRIPT,Ume=O.IS_UNDERLINE,wM=O.KEY_ARROW_DOWN_COMMAND,ig=O.KEY_ARROW_LEFT_COMMAND,lg=O.KEY_ARROW_RIGHT_COMMAND,SM=O.KEY_ARROW_UP_COMMAND,dg=O.KEY_BACKSPACE_COMMAND,IM=O.KEY_DELETE_COMMAND,TM=O.KEY_DOWN_COMMAND,cg=O.KEY_ENTER_COMMAND,kM=O.KEY_ESCAPE_COMMAND,zme=O.KEY_MODIFIER_COMMAND,Hme=O.KEY_SPACE_COMMAND,ug=O.KEY_TAB_COMMAND,PM=O.LineBreakNode,Kme=O.MOVE_TO_END,$me=O.MOVE_TO_START,Vme=O.NODE_STATE_KEY,LM=O.OUTDENT_CONTENT_COMMAND,fg=O.PASTE_COMMAND,RM=O.PASTE_TAG,AM=O.ParagraphNode,EM=O.REDO_COMMAND,MM=O.REMOVE_TEXT_COMMAND,NM=O.RootNode,qme=O.SELECTION_CHANGE_COMMAND,_M=O.SELECTION_INSERT_CLIPBOARD_NODES_COMMAND,DM=O.SELECT_ALL_COMMAND,Wme=O.SKIP_COLLAB_TAG,OM=O.SKIP_DOM_SELECTION_TAG,cx=O.SKIP_SCROLL_INTO_VIEW_TAG,jme=O.SKIP_SELECTION_FOCUS_TAG,FM=O.TEXT_TYPE_TO_FORMAT,BM=O.TabNode,pg=O.TextNode,UM=O.UNDO_COMMAND,Pu=O.addClassNamesToElement,Gme=O.buildImportMap,mg=O.configExtension,zM=O.createCommand,gg=O.createEditor,Qme=O.createSharedNodeState,HM=O.createState,KM=O.declarePeerDependency,un=O.defineExtension,Xme=O.flipDirection,Yme=O.getDOMOwnerDocument,ux=O.getDOMSelection,Jme=O.getDOMSelectionFromTarget,$M=O.getDOMTextNode,Zme=O.getEditorPropertyFromDOMNode,ege=O.getNearestEditorFromDOMNode,VM=O.getRegisteredNode,tge=O.getRegisteredNodeOrThrow,nge=O.getStaticNodeConfig,oge=O.getTextDirection,rge=O.getTransformSetFromKlass,qM=O.isBlockDomNode,age=O.isCurrentlyReadOnlyMode,WM=O.isDOMDocumentNode,jM=O.isDOMNode,sge=O.isDOMTextNode,ige=O.isDOMUnmanaged,fx=O.isDocumentFragment,lge=O.isExactShortcutMatch,GM=O.isHTMLAnchorElement,hg=O.isHTMLElement,Lu=O.isInlineDomNode,dge=O.isLexicalEditor,cge=O.isModifierMatch,uge=O.isSelectionCapturedInDecoratorInput,QM=O.isSelectionWithinEditor,px=O.makeStepwiseIterator,Br=O.mergeRegister,fge=O.normalizeClassNames,vg=O.removeClassNamesFromElement,pge=O.removeFromParent,mge=O.resetRandomKey,br=O.safeCast,gge=O.setDOMUnmanaged,hge=O.setNodeIndentFromDOM,yg=O.shallowMergeConfig,mx=O.toggleTextFormatType;var gx={};cn(gx,{LexicalComposer:()=>XG});Y();var XM=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,QG=XM?pe:U,Cg={tag:_o};function XG({initialConfig:e,children:t}){let n=K(()=>{let{theme:o,namespace:r,nodes:a,onError:s,editorState:i,html:l}=e,d=cR(null,o),u=gg({editable:e.editable,html:l,namespace:r,nodes:a,onError:f=>s(f,u),theme:o});return(function(f,p){if(p!==null){if(p===void 0)f.update(()=>{let m=Tt();if(m.isEmpty()){let h=Xo();m.append(h);let g=XM?document.activeElement:null;(De()!==null||g!==null&&g===f.getRootElement())&&h.select()}},Cg);else if(p!==null)switch(typeof p){case"string":{let m=f.parseEditorState(p);f.setEditorState(m,Cg);break}case"object":f.setEditorState(p,Cg);break;case"function":f.update(()=>{Tt().isEmpty()&&p(f)},Cg)}}})(u,i),[u,d]},[]);return QG(()=>{let o=e.editable,[r]=n;r.setEditable(o===void 0||o)},[]),c(dR.Provider,{value:n,children:t})}var YG=gx,YM=YG.LexicalComposer;var vx={};cn(vx,{$canShowPlaceholder:()=>ZM,$canShowPlaceholderCurry:()=>ZG,$findTextIntersectionFromCharacters:()=>e8,$isRootTextContentEmpty:()=>hx,$isRootTextContentEmptyCurry:()=>JG,$rootTextContent:()=>JM,registerLexicalTextEntity:()=>n8});function JM(){return Tt().getTextContent()}function hx(e,t=!0){if(e)return!1;let n=JM();return t&&(n=n.trim()),n===""}function JG(e,t){return()=>hx(e,t)}function ZM(e){if(!hx(e,!1))return!1;let t=Tt().getChildren(),n=t.length;if(n>1)return!1;for(let o=0;o<n;o++){let r=t[o];if(Jm(r))return!1;if(qe(r)){if(!YE(r)||r.__indent!==0)return!1;let a=r.getChildren(),s=a.length;for(let i=0;i<s;i++){let l=a[o];if(!it(l))return!1}}}return!0}function ZG(e){return()=>ZM(e)}function e8(e,t){let n=e.getFirstChild(),o=0;e:for(;n!==null;){if(qe(n)){let s=n.getFirstChild();if(s!==null){n=s;continue}}else if(it(n)){let s=n.getTextContentSize();if(o+s>t)return{node:n,offset:t-o};o+=s}let r=n.getNextSibling();if(r!==null){n=r;continue}let a=n.getParent();for(;a!==null;){let s=a.getNextSibling();if(s!==null){n=s;continue e}a=a.getParent()}break}return null}function t8(e,...t){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(let r of t)o.append("v",r);throw n.search=o.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function n8(e,t,n,o){let r=s=>s instanceof n,a=s=>{let i=Cr(s.getTextContent());i.setFormat(s.getFormat()),s.replace(i)};return[e.registerNodeTransform(pg,s=>{if(!s.isSimpleText())return;let i,l=s.getPreviousSibling(),d=s.getTextContent(),u=s;if(it(l)){let p=l.getTextContent(),m=t(p+d);if(r(l)){if(m===null||(h=>h.getLatest().__mode)(l)!==0)return void a(l);{let h=m.end-p.length;if(h>0){let g=p+d.slice(0,h);if(l.select(),l.setTextContent(g),h===d.length)s.remove();else{let v=d.slice(h);s.setTextContent(v)}return}}}else if(m===null||m.start<p.length)return}let f=0;for(;;){i=t(d);let p,m=i===null?"":d.slice(i.end);if(d=m,m===""){let g=u.getNextSibling();if(it(g)){m=u.getTextContent()+g.getTextContent();let v=t(m);if(v===null)return void(r(g)?a(g):g.markDirty());if(v.start!==0)return}}if(i===null)return;if(i.start===0&&it(l)&&l.isTextEntity()){f+=i.end;continue}i.start===0?[p,u]=u.splitText(i.end):[,p,u]=u.splitText(i.start+f,i.end+f),p===void 0&&t8(165,"nodeToReplace");let h=o(p);if(h.setFormat(p.getFormat()),p.replace(h),u==null)return;f=0,l=h}}),e.registerNodeTransform(n,s=>{let i=s.getTextContent(),l=t(i);if(l===null||l.start!==0)return void a(s);if(i.length>l.end)return void s.splitText(l.end);let d=s.getPreviousSibling();it(d)&&d.isTextEntity()&&(a(d),a(s));let u=s.getNextSibling();it(u)&&u.isTextEntity()&&(a(u),r(s)&&a(s))})]}var Ii=vx,Ige=Ii.$canShowPlaceholder,xg=Ii.$canShowPlaceholderCurry,Tge=Ii.$findTextIntersectionFromCharacters,kge=Ii.$isRootTextContentEmpty,Pge=Ii.$isRootTextContentEmptyCurry,Lge=Ii.$rootTextContent,Rge=Ii.registerLexicalTextEntity;var Sx={};cn(Sx,{$addNodeStyle:()=>l8,$cloneWithProperties:()=>Qm,$copyBlockFormatIndent:()=>lN,$ensureForwardRangeSelection:()=>iN,$forEachSelectedTextNode:()=>sN,$getComputedStyleForElement:()=>xx,$getComputedStyleForParent:()=>bx,$getSelectionStyleValueForProperty:()=>h8,$isAtNodeEnd:()=>i8,$isParentElementRTL:()=>wx,$isParentRTL:()=>a8,$moveCaretSelection:()=>uN,$moveCharacter:()=>m8,$patchStyleText:()=>d8,$selectAll:()=>eg,$setBlocksType:()=>c8,$shouldOverrideDefaultCharacterSelection:()=>p8,$sliceSelectedTextNodeContent:()=>s8,$trimTextContentFromAnchor:()=>aN,$wrapNodes:()=>f8,createDOMRange:()=>o8,createRectsFromDOMRange:()=>r8,getCSSFromStyleObject:()=>rN,getStyleObjectFromCSS:()=>Sg,trimTextContentFromAnchor:()=>v8});function Cx(e,...t){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(let r of t)o.append("v",r);throw n.search=o.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var wg=new Map;function eN(e){let t=e;for(;t!=null;){if(t.nodeType===Node.TEXT_NODE)return t;t=t.firstChild}return null}function tN(e){let t=e.parentNode;if(t==null)throw new Error("Should never happen");return[t,Array.from(t.childNodes).indexOf(e)]}function o8(e,t,n,o,r){let a=t.getKey(),s=o.getKey(),i=document.createRange(),l=e.getElementByKey(a),d=e.getElementByKey(s),u=n,f=r;if(it(t)&&(l=eN(l)),it(o)&&(d=eN(d)),t===void 0||o===void 0||l===null||d===null)return null;l.nodeName==="BR"&&([l,u]=tN(l)),d.nodeName==="BR"&&([d,f]=tN(d));let p=l.firstChild;l===d&&p!=null&&p.nodeName==="BR"&&u===0&&f===0&&(f=1);try{i.setStart(l,u),i.setEnd(d,f)}catch{return null}return!i.collapsed||u===f&&a===s||(i.setStart(d,f),i.setEnd(l,u)),i}function r8(e,t){let n=e.getRootElement();if(n===null)return[];let o=n.getBoundingClientRect(),r=getComputedStyle(n),a=parseFloat(r.paddingLeft)+parseFloat(r.paddingRight),s=Array.from(t.getClientRects()),i,l=s.length;s.sort((d,u)=>{let f=d.top-u.top;return Math.abs(f)<=3?d.left-u.left:f});for(let d=0;d<l;d++){let u=s[d],f=i&&i.top<=u.top&&i.top+i.height>u.top&&i.left+i.width>u.left,p=u.width+a===o.width;f||p?(s.splice(d--,1),l--):i=u}return s}function oN(e){let t={};if(!e)return t;let n=e.split(";");for(let o of n)if(o!==""){let[r,a]=o.split(/:([^]+)/);r&&a&&(t[r.trim()]=a.trim())}return t}function Sg(e){let t=wg.get(e);return t===void 0&&(t=oN(e),wg.set(e,t)),t}function rN(e){let t="";for(let n in e)n&&(t+=`${n}: ${e[n]};`);return t}function xx(e){let t=Xm().getElementByKey(e.getKey());if(t===null)return null;let n=t.ownerDocument.defaultView;return n===null?null:n.getComputedStyle(t)}function bx(e){return xx(Su(e)?e:e.getParentOrThrow())}function a8(e){let t=bx(e);return t!==null&&t.direction==="rtl"}function s8(e,t,n="self"){let o=e.getStartEndPoints();if(t.isSelected(e)&&!sx(t)&&o!==null){let[r,a]=o,s=e.isBackward(),i=r.getNode(),l=a.getNode(),d=t.is(i),u=t.is(l);if(d||u){let[f,p]=VE(e),m=i.is(l),h=t.is(s?l:i),g=t.is(s?i:l),v,C=0;m?(C=f>p?p:f,v=f>p?f:p):h?(C=s?p:f,v=void 0):g&&(C=0,v=s?f:p);let y=t.__text.slice(C,v);y!==t.__text&&(n==="clone"&&(t=FE(t)),t.__text=y)}}return t}function i8(e){if(e.type==="text")return e.offset===e.getNode().getTextContentSize();let t=e.getNode();return qe(t)||Cx(177),e.offset===t.getChildrenSize()}function aN(e,t,n){let o=t.getNode(),r=n;if(qe(o)){let a=o.getDescendantByIndex(t.offset);a!==null&&(o=a)}for(;r>0&&o!==null;){if(qe(o)){let d=o.getLastDescendant();d!==null&&(o=d)}let a=o.getPreviousSibling(),s=0;if(a===null){let d=o.getParentOrThrow(),u=d.getPreviousSibling();for(;u===null;){if(d=d.getParent(),d===null){a=null;break}u=d.getPreviousSibling()}d!==null&&(s=d.isInline()?0:2,a=u)}let i=o.getTextContent();i===""&&qe(o)&&!o.isInline()&&(i=`
|
|
4157
4157
|
|
|
4158
|
-
`);let l=i.length;if(!it(o)||r>=l){let d=o.getParent();o.remove(),d==null||d.getChildrenSize()!==0||Su(d)||d.remove(),r-=l+s,o=a}else{let d=o.getKey(),u=e.getEditorState().read(()=>{let m=Vl(d);return it(m)&&m.isSimpleText()?m.getTextContent():null}),f=l-r,p=i.slice(0,f);if(u!==null&&u!==i){let m=bu(),h=o;if(o.isSimpleText())o.setTextContent(u);else{let g=Cr(u);o.replace(g),h=g}if(ke(m)&&m.isCollapsed()){let g=m.anchor.offset;h.select(g,g)}}else if(o.isSimpleText()){let m=t.key===d,h=t.offset;h<r&&(h=l);let g=m?h-r:0,v=m?h:f;if(m&&g===0){let[C]=o.splitText(g,v);C.remove()}else{let[,C]=o.splitText(g,v);C.remove()}}else{let m=Cr(p);o.replace(m)}r=0}}}function l8(e){let t=e.getStyle(),n=oN(t);wg.set(t,n)}function bg(e,t){(ke(e)?e.isCollapsed():it(e)||qe(e))||Cx(280);let n=Sg(ke(e)?e.style:it(e)?e.getStyle():e.getTextStyle()),o=Object.entries(t).reduce((a,[s,i])=>(typeof i=="function"?a[s]=i(n[s],e):i===null?delete a[s]:a[s]=i,a),{...n}),r=rN(o);ke(e)||it(e)?e.setStyle(r):e.setTextStyle(r),wg.set(r,o)}function d8(e,t){if(ke(e)&&e.isCollapsed()){bg(e,t);let o=e.anchor.getNode();qe(o)&&o.isEmpty()&&bg(o,t)}sN(o=>{bg(o,t)});let n=e.getNodes();if(n.length>0){let o=new Set;for(let r of n){if(!qe(r)||!r.canBeEmpty()||r.getChildrenSize()!==0)continue;let a=r.getKey();o.has(a)||(o.add(a),bg(r,t))}}}function sN(e){let t=De();if(!t)return;let n=new Map,o=a=>n.get(a.getKey())||[0,a.getTextContentSize()];if(ke(t))for(let a of OE(t).getTextSlices())a&&n.set(a.caret.origin.getKey(),a.getSliceIndices());let r=t.getNodes();for(let a of r){if(!it(a)||!a.canHaveFormat())continue;let[s,i]=o(a);i!==s&&(sx(a)||s===0&&i===a.getTextContentSize()?e(a):e(a.splitText(s,i)[s===0?0:1]))}ke(t)&&t.anchor.type==="text"&&t.focus.type==="text"&&t.anchor.key===t.focus.key&&iN(t)}function iN(e){if(e.isBackward()){let{anchor:t,focus:n}=e,{key:o,offset:r,type:a}=t;t.set(n.key,n.offset,n.type),n.set(o,r,a)}}function lN(e,t){let n=e.getFormatType(),o=e.getIndent();n!==t.getFormatType()&&t.setFormat(n),o!==t.getIndent()&&t.setIndent(o)}function c8(e,t,n=lN){if(e===null)return;let o=e.getStartEndPoints(),r=new Map,a=null;if(o){let[s,i]=o;a=bi(),a.anchor.set(s.key,s.offset,s.type),a.focus.set(i.key,i.offset,i.type);let l=ya(s.getNode(),ku),d=ya(i.getNode(),ku);qe(l)&&r.set(l.getKey(),l),qe(d)&&r.set(d.getKey(),d)}for(let s of e.getNodes())if(qe(s)&&ku(s))r.set(s.getKey(),s);else if(o===null){let i=ya(s,ku);qe(i)&&r.set(i.getKey(),i)}for(let[s,i]of r){let l=t();n(i,l),i.replace(l,!0),a&&(s===a.anchor.key&&a.anchor.set(l.getKey(),a.anchor.offset,a.anchor.type),s===a.focus.key&&a.focus.set(l.getKey(),a.focus.offset,a.focus.type))}a&&e.is(De())&&xr(a)}function nN(e){return e.getNode().isAttached()}function u8(e){let t=e;for(;t!==null&&!Si(t);){let n=t.getLatest(),o=t.getParent();n.getChildrenSize()===0&&t.remove(!0),t=o}}function f8(e,t,n=null){let o=e.getStartEndPoints(),r=o?o[0]:null,a=e.getNodes(),s=a.length;if(r!==null&&(s===0||s===1&&r.type==="element"&&r.getNode().getChildrenSize()===0)){let d=r.type==="text"?r.getNode().getParentOrThrow():r.getNode(),u=d.getChildren(),f=t();return f.setFormat(d.getFormatType()),f.setIndent(d.getIndent()),u.forEach(p=>f.append(p)),n&&(f=n.append(f)),void d.replace(f)}let i=null,l=[];for(let d=0;d<s;d++){let u=a[d];Si(u)?(yx(e,l,l.length,t,n),l=[],i=u):i===null||i!==null&&jE(u,i)?l.push(u):(yx(e,l,l.length,t,n),l=[u])}yx(e,l,l.length,t,n)}function yx(e,t,n,o,r=null){if(t.length===0)return;let a=t[0],s=new Map,i=[],l=qe(a)?a:a.getParentOrThrow();l.isInline()&&(l=l.getParentOrThrow());let d=!1;for(;l!==null;){let h=l.getPreviousSibling();if(h!==null){l=h,d=!0;break}if(l=l.getParentOrThrow(),Si(l))break}let u=new Set;for(let h=0;h<n;h++){let g=t[h];qe(g)&&g.getChildrenSize()===0&&u.add(g.getKey())}let f=new Set;for(let h=0;h<n;h++){let g=t[h],v=g.getParent();if(v!==null&&v.isInline()&&(v=v.getParent()),v!==null&&XE(g)&&!f.has(g.getKey())){let C=v.getKey();if(s.get(C)===void 0){let y=o();y.setFormat(v.getFormatType()),y.setIndent(v.getIndent()),i.push(y),s.set(C,y),v.getChildren().forEach(x=>{y.append(x),f.add(x.getKey()),qe(x)&&x.getChildrenKeys().forEach(b=>f.add(b))}),u8(v)}}else if(u.has(g.getKey())){qe(g)||Cx(179);let C=o();C.setFormat(g.getFormatType()),C.setIndent(g.getIndent()),i.push(C),g.remove(!0)}}if(r!==null)for(let h=0;h<i.length;h++){let g=i[h];r.append(g)}let p=null;if(Si(l))if(d)if(r!==null)l.insertAfter(r);else for(let h=i.length-1;h>=0;h--){let g=i[h];l.insertAfter(g)}else{let h=l.getFirstChild();if(qe(h)&&(l=h),h===null)if(r)l.append(r);else for(let g=0;g<i.length;g++){let v=i[g];l.append(v),p=v}else if(r!==null)h.insertBefore(r);else for(let g=0;g<i.length;g++){let v=i[g];h.insertBefore(v),p=v}}else if(r)l.insertAfter(r);else for(let h=i.length-1;h>=0;h--){let g=i[h];l.insertAfter(g),p=g}let m=bu();ke(m)&&nN(m.anchor)&&nN(m.focus)?xr(m.clone()):p!==null?p.selectEnd():e.dirty=!0}function dN(e){let t=cN(e);return t!==null&&t.writingMode==="vertical-rl"}function cN(e){let t=e.anchor.getNode();return qe(t)?xx(t):bx(t)}function p8(e,t){let n=dN(e)?!t:t;wx(e)&&(n=!n);let o=$l(e.focus,n?"previous":"next");if(QE(o))return!1;for(let r of KE(o)){if(wu(r))return!r.origin.isInline();if(!qe(r.origin)){if(Jm(r.origin))return!0;break}}return!1}function uN(e,t,n,o){e.modify(t?"extend":"move",n,o)}function wx(e){let t=cN(e);return t!==null&&t.direction==="rtl"}function m8(e,t,n){let o=wx(e),r;r=dN(e)||o?!n:n,uN(e,t,r,"character")}function g8(e,t,n){let o=Sg(e.getStyle());return o!==null&&o[t]||n}function h8(e,t,n=""){let o=null,r=e.getNodes(),a=e.anchor,s=e.focus,i=e.isBackward(),l=i?s.offset:a.offset,d=i?s.getNode():a.getNode();if(ke(e)&&e.isCollapsed()&&e.style!==""){let u=Sg(e.style);if(u!==null&&t in u)return u[t]}for(let u=0;u<r.length;u++){let f=r[u];if((u===0||l!==0||!f.is(d))&&it(f)){let p=g8(f,t,n);if(o===null)o=p;else if(o!==p){o="";break}}}return o===null?n:o}var v8=aN;var Zt=Sx,fN=Zt.$addNodeStyle,Mge=Zt.$cloneWithProperties,Nge=Zt.$copyBlockFormatIndent,_ge=Zt.$ensureForwardRangeSelection,Dge=Zt.$forEachSelectedTextNode,Oge=Zt.$getComputedStyleForElement,Fge=Zt.$getComputedStyleForParent,Bge=Zt.$getSelectionStyleValueForProperty,Uge=Zt.$isAtNodeEnd,zge=Zt.$isParentElementRTL,Hge=Zt.$isParentRTL,Kge=Zt.$moveCaretSelection,Ix=Zt.$moveCharacter,$ge=Zt.$patchStyleText,Vge=Zt.$selectAll,qge=Zt.$setBlocksType,Tx=Zt.$shouldOverrideDefaultCharacterSelection,Ig=Zt.$sliceSelectedTextNodeContent,Wge=Zt.$trimTextContentFromAnchor,jge=Zt.$wrapNodes,Gge=Zt.createDOMRange,pN=Zt.createRectsFromDOMRange,Qge=Zt.getCSSFromStyleObject,Xge=Zt.getStyleObjectFromCSS,Yge=Zt.trimTextContentFromAnchor;var Rx={};cn(Rx,{$descendantsMatching:()=>e6,$dfs:()=>O8,$dfsIterator:()=>SN,$filter:()=>G8,$findMatchingParent:()=>ya,$firstToLastIterator:()=>t6,$getAdjacentCaret:()=>F8,$getAdjacentSiblingOrParentSiblingCaret:()=>wi,$getDepth:()=>TN,$getNearestBlockElementAncestorOrThrow:()=>K8,$getNearestNodeOfType:()=>H8,$getNextRightPreorderNode:()=>z8,$getNextSiblingOrParentSibling:()=>U8,$handleIndentAndOutdent:()=>Q8,$insertFirst:()=>X8,$insertNodeToNearestRoot:()=>q8,$insertNodeToNearestRootAtCaret:()=>PN,$isEditorIsNestedEditor:()=>J8,$lastToFirstIterator:()=>Lx,$restoreEditorState:()=>V8,$reverseDfs:()=>B8,$reverseDfsIterator:()=>kN,$splitNode:()=>aM,$unwrapAndFilterDescendants:()=>Z8,$unwrapNode:()=>n6,$wrapNodeInElement:()=>W8,CAN_USE_BEFORE_INPUT:()=>P8,CAN_USE_DOM:()=>xN,IS_ANDROID:()=>L8,IS_ANDROID_CHROME:()=>R8,IS_APPLE:()=>A8,IS_APPLE_WEBKIT:()=>E8,IS_CHROME:()=>M8,IS_FIREFOX:()=>bN,IS_IOS:()=>N8,IS_SAFARI:()=>_8,addClassNamesToElement:()=>Pu,calculateZoomLevel:()=>Y8,isBlockDomNode:()=>qM,isHTMLAnchorElement:()=>GM,isHTMLElement:()=>hg,isInlineDomNode:()=>Lu,isMimeType:()=>wN,makeStateWrapper:()=>o6,markSelection:()=>CN,mediaFileReader:()=>D8,mergeRegister:()=>Br,objectKlassEquals:()=>j8,positionNodeOnRange:()=>yN,registerNestedElementResolver:()=>$8,removeClassNamesFromElement:()=>vg,selectionAlwaysOnDisplay:()=>k8});function Tg(e,...t){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(let r of t)o.append("v",r);throw n.search=o.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var wr=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,y8=wr&&"documentMode"in document?document.documentMode:null,hN=wr&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),C8=wr&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),x8=!(!wr||!("InputEvent"in window)||y8)&&"getTargetRanges"in new window.InputEvent("input"),b8=wr&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),w8=wr&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,vN=wr&&/Android/.test(navigator.userAgent),Px=wr&&/^(?=.*Chrome).*/i.test(navigator.userAgent),S8=wr&&vN&&Px,I8=wr&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&hN&&!Px;function Ur(e){return`${e}px`}var T8={attributes:!0,characterData:!0,childList:!0,subtree:!0};function yN(e,t,n){let o=null,r=null,a=null,s=[],i=document.createElement("div");function l(){o===null&&Tg(182),r===null&&Tg(183);let{left:f,top:p}=r.getBoundingClientRect(),m=pN(e,t);var h,g;i.isConnected||(g=i,(h=r).insertBefore(g,h.firstChild));let v=!1;for(let C=0;C<m.length;C++){let y=m[C],x=s[C]||document.createElement("div"),b=x.style;b.position!=="absolute"&&(b.position="absolute",v=!0);let I=Ur(y.left-f);b.left!==I&&(b.left=I,v=!0);let T=Ur(y.top-p);b.top!==T&&(x.style.top=T,v=!0);let P=Ur(y.width);b.width!==P&&(x.style.width=P,v=!0);let k=Ur(y.height);b.height!==k&&(x.style.height=k,v=!0),x.parentNode!==i&&(i.append(x),v=!0),s[C]=x}for(;s.length>m.length;)s.pop();v&&n(s)}function d(){r=null,o=null,a!==null&&a.disconnect(),a=null,i.remove();for(let f of s)f.remove();s=[]}i.style.position="relative";let u=e.registerRootListener(function f(){let p=e.getRootElement();if(p===null)return d();let m=p.parentElement;if(!hg(m))return d();d(),o=p,r=m,a=new MutationObserver(h=>{let g=e.getRootElement(),v=g&&g.parentElement;if(g!==o||v!==r)return f();for(let C of h)if(!i.contains(C.target))return l()}),a.observe(m,T8),l()});return()=>{u(),d()}}function mN(e,t,n){if(e.type!=="text"&&qe(t)){let o=t.getDOMSlot(n);return[o.element,o.getFirstChildOffset()+e.offset]}return[$M(n)||n,e.offset]}function CN(e,t){let n=null,o=null,r=null,a=null,s=null,i=null,l=()=>{};function d(u){u.read(()=>{let f=De();if(!ke(f))return n=null,r=null,a=null,i=null,l(),void(l=()=>{});let[p,m]=(function(k){let w=k.getStartEndPoints();return k.isBackward()?[w[1],w[0]]:w})(f),h=p.getNode(),g=h.getKey(),v=p.offset,C=m.getNode(),y=C.getKey(),x=m.offset,b=e.getElementByKey(g),I=e.getElementByKey(y),T=n===null||b!==o||v!==r||g!==n.getKey(),P=a===null||I!==s||x!==i||y!==a.getKey();if((T||P)&&b!==null&&I!==null){let k=(function(w,L,R,N,A,D,q){let H=(w._window?w._window.document:document).createRange();return H.setStart(...mN(L,R,N)),H.setEnd(...mN(A,D,q)),H})(e,p,h,b,m,C,I);l(),l=yN(e,k,w=>{if(t===void 0)for(let L of w){let R=L.style;R.background!=="Highlight"&&(R.background="Highlight"),R.color!=="HighlightText"&&(R.color="HighlightText"),R.marginTop!==Ur(-1.5)&&(R.marginTop=Ur(-1.5)),R.paddingTop!==Ur(4)&&(R.paddingTop=Ur(4)),R.paddingBottom!==Ur(0)&&(R.paddingBottom=Ur(0))}else t(w)})}n=h,o=b,r=v,a=C,s=I,i=x})}return d(e.getEditorState()),Br(e.registerUpdateListener(({editorState:u})=>d(u)),()=>{l()})}function k8(e,t){let n=null,o=()=>{let r=getSelection(),a=r&&r.anchorNode,s=e.getRootElement();a!==null&&s!==null&&s.contains(a)?n!==null&&(n(),n=null):n===null&&(n=CN(e,t))};return document.addEventListener("selectionchange",o),()=>{n!==null&&n(),document.removeEventListener("selectionchange",o)}}var P8=x8,xN=wr,L8=vN,R8=S8,A8=hN,E8=I8,M8=Px,bN=C8,N8=w8,_8=b8;function wN(e,t){for(let n of t)if(e.type.startsWith(n))return!0;return!1}function D8(e,t){let n=e[Symbol.iterator]();return new Promise((o,r)=>{let a=[],s=()=>{let{done:i,value:l}=n.next();if(i)return o(a);let d=new FileReader;d.addEventListener("error",r),d.addEventListener("load",()=>{let u=d.result;typeof u=="string"&&a.push({file:l,result:u}),s()}),wN(l,t)?d.readAsDataURL(l):s()};s()})}function O8(e,t){return Array.from(SN(e,t))}function F8(e){return e?e.getAdjacentCaret():null}function B8(e,t){return Array.from(kN(e,t))}function SN(e,t){return IN("next",e,t)}function gN(e,t){let n=wi(Ca(e,t));return n&&n[0]}function IN(e,t,n){let o=Tt(),r=t||o,a=qe(r)?us(r,e):Ca(r,e),s=TN(r),i=n?nx(rx(Ca(n,e)))||gN(n,e):gN(r,e),l=s;return px({hasNext:d=>d!==null,initial:a,map:d=>({depth:l,node:d.origin}),step:d=>{if(d.isSameNodeCaret(i))return null;wu(d)&&l++;let u=wi(d);return!u||u[0].isSameNodeCaret(i)?null:(l+=u[1],u[0])}})}function U8(e){let t=wi(Ca(e,"next"));return t&&[t[0].origin,t[1]]}function TN(e){let t=-1;for(let n=e;n!==null;n=n.getParent())t++;return t}function z8(e){let t=rx(Ca(e,"previous")),n=wi(t,"root");return n&&n[0].origin}function kN(e,t){return IN("previous",e,t)}function H8(e,t){let n=e;for(;n!=null;){if(n instanceof t)return n;n=n.getParent()}return null}function K8(e){let t=ya(e,n=>qe(n)&&!n.isInline());return qe(t)||Tg(4,e.__key),t}function $8(e,t,n,o){let r=a=>a instanceof t;return e.registerNodeTransform(t,a=>{let s=(i=>{let l=i.getChildren();for(let f=0;f<l.length;f++){let p=l[f];if(r(p))return null}let d=i,u=i;for(;d!==null;)if(u=d,d=d.getParent(),r(d))return{child:u,parent:d};return null})(a);if(s!==null){let{child:i,parent:l}=s;if(i.is(a)){o(l,a);let d=i.getNextSiblings(),u=d.length;if(l.insertAfter(i),u!==0){let f=n(l);i.insertAfter(f);for(let p=0;p<u;p++)f.append(d[p])}l.canBeEmpty()||l.getChildrenSize()!==0||l.remove()}}})}function V8(e,t){let n=new Map,o=e._pendingEditorState;for(let[a,s]of t._nodeMap)n.set(a,Qm(s));o&&(o._nodeMap=n),e._dirtyType=2;let r=t._selection;xr(r===null?null:r.clone())}function q8(e){let t=De()||bu(),n;if(ke(t))n=$l(t.focus,"next");else{if(t!=null){let s=t.getNodes(),i=s[s.length-1];i&&(n=Ca(i,"next"))}n=n||us(Tt(),"previous").getFlipped().insert(Xo())}let o=PN(e,n),r=nx(o),a=wu(r)?ZE(r):o;return oM(qE(a)),e.getLatest()}function PN(e,t,n){let o=ox(t,"next");for(let r=o;r;r=rM(r,n))o=r;return Zm(o)&&Tg(283),o.insert(e.isInline()?Xo().append(e):e),ox(Ca(e.getLatest(),"next"),t.direction)}function W8(e,t){let n=t();return e.replace(n),n.append(e),n}function j8(e,t){return e!==null&&Object.getPrototypeOf(e).constructor.name===t.name}function G8(e,t){let n=[];for(let o=0;o<e.length;o++){let r=t(e[o]);r!==null&&n.push(r)}return n}function Q8(e){let t=De();if(!ke(t))return!1;let n=new Set,o=t.getNodes();for(let r=0;r<o.length;r++){let a=o[r],s=a.getKey();if(n.has(s))continue;let i=ya(a,d=>qe(d)&&!d.isInline());if(i===null)continue;let l=i.getKey();i.canIndent()&&!n.has(l)&&(n.add(l),e(i))}return n.size>0}function X8(e,t){us(e,"next").insert(t)}var kx=!(bN||!xN)&&void 0;function Y8(e,t=!1){let n=1;if((function(){if(kx===void 0){let o=document.createElement("div");o.style.cssText="position: absolute; opacity: 0; width: 100px; left: -1000px;",document.body.appendChild(o);let r=o.getBoundingClientRect();o.style.setProperty("zoom","2"),kx=o.getBoundingClientRect().width===r.width,document.body.removeChild(o)}return kx})()||t)for(;e;)n*=Number(window.getComputedStyle(e).getPropertyValue("zoom")),e=e.parentElement;return n}function J8(e){return e._parentEditor!==null}function Z8(e,t){return LN(e,t,null)}function LN(e,t,n){let o=!1;for(let r of Lx(e))t(r)?n!==null&&n(r):(o=!0,qe(r)&&LN(r,t,n||(a=>r.insertAfter(a))),r.remove());return o}function e6(e,t){let n=[],o=Array.from(e).reverse();for(let r=o.pop();r!==void 0;r=o.pop())if(t(r))n.push(r);else if(qe(r))for(let a of Lx(r))o.push(a);return n}function t6(e){return RN(us(e,"next"))}function Lx(e){return RN(us(e,"previous"))}function RN(e){return px({hasNext:JE,initial:e.getAdjacentCaret(),map:t=>t.origin.getLatest(),step:t=>t.getAdjacentCaret()})}function n6(e){nM(Ca(e,"next")).splice(1,e.getChildren())}function o6(e){let t=o=>Ym(o,e),n=(o,r)=>tg(o,e,r);return{$get:t,$set:n,accessors:[t,n],makeGetterMethod:()=>function(){return t(this)},makeSetterMethod:()=>function(o){return n(this,o)},stateConfig:e}}var Ge=Rx,nhe=Ge.$descendantsMatching,ohe=Ge.$dfs,rhe=Ge.$dfsIterator,ahe=Ge.$filter,she=Ge.$findMatchingParent,ihe=Ge.$firstToLastIterator,lhe=Ge.$getAdjacentCaret,dhe=Ge.$getAdjacentSiblingOrParentSiblingCaret,che=Ge.$getDepth,AN=Ge.$getNearestBlockElementAncestorOrThrow,uhe=Ge.$getNearestNodeOfType,fhe=Ge.$getNextRightPreorderNode,phe=Ge.$getNextSiblingOrParentSibling,EN=Ge.$handleIndentAndOutdent,mhe=Ge.$insertFirst,ghe=Ge.$insertNodeToNearestRoot,hhe=Ge.$insertNodeToNearestRootAtCaret,vhe=Ge.$isEditorIsNestedEditor,yhe=Ge.$lastToFirstIterator,Che=Ge.$restoreEditorState,xhe=Ge.$reverseDfs,bhe=Ge.$reverseDfsIterator,whe=Ge.$splitNode,She=Ge.$unwrapAndFilterDescendants,Ihe=Ge.$unwrapNode,The=Ge.$wrapNodeInElement,khe=Ge.CAN_USE_BEFORE_INPUT,Phe=Ge.CAN_USE_DOM,Lhe=Ge.IS_ANDROID,Rhe=Ge.IS_ANDROID_CHROME,Ahe=Ge.IS_APPLE,Ehe=Ge.IS_APPLE_WEBKIT,Mhe=Ge.IS_CHROME,Nhe=Ge.IS_FIREFOX,_he=Ge.IS_IOS,Dhe=Ge.IS_SAFARI,Ohe=Ge.addClassNamesToElement,Fhe=Ge.calculateZoomLevel,Ax=Ge.isBlockDomNode,Bhe=Ge.isHTMLAnchorElement,MN=Ge.isHTMLElement,Uhe=Ge.isInlineDomNode,zhe=Ge.isMimeType,Hhe=Ge.makeStateWrapper,Khe=Ge.markSelection,$he=Ge.mediaFileReader,xa=Ge.mergeRegister,Ru=Ge.objectKlassEquals,Vhe=Ge.positionNodeOnRange,qhe=Ge.registerNestedElementResolver,Whe=Ge.removeClassNamesFromElement,jhe=Ge.selectionAlwaysOnDisplay;var Ex={};cn(Ex,{ContentEditable:()=>a6,ContentEditableElement:()=>DN});Y();var _N=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?pe:U;function r6({editor:e,ariaActiveDescendant:t,ariaAutoComplete:n,ariaControls:o,ariaDescribedBy:r,ariaErrorMessage:a,ariaExpanded:s,ariaInvalid:i,ariaLabel:l,ariaLabelledBy:d,ariaMultiline:u,ariaOwns:f,ariaRequired:p,autoCapitalize:m,className:h,id:g,role:v="textbox",spellCheck:C=!0,style:y,tabIndex:x,"data-testid":b,...I},T){let[P,k]=W(e.isEditable()),w=E(R=>{R&&R.ownerDocument&&R.ownerDocument.defaultView?e.setRootElement(R):e.setRootElement(null)},[e]),L=K(()=>(function(...R){return N=>{for(let A of R)typeof A=="function"?A(N):A!=null&&(A.current=N)}})(T,w),[w,T]);return _N(()=>(k(e.isEditable()),e.registerEditableListener(R=>{k(R)})),[e]),c("div",{"aria-activedescendant":P?t:void 0,"aria-autocomplete":P?n:"none","aria-controls":P?o:void 0,"aria-describedby":r,...a!=null?{"aria-errormessage":a}:{},"aria-expanded":P&&v==="combobox"?!!s:void 0,...i!=null?{"aria-invalid":i}:{},"aria-label":l,"aria-labelledby":d,"aria-multiline":u,"aria-owns":P?f:void 0,"aria-readonly":!P||void 0,"aria-required":p,autoCapitalize:m,className:h,contentEditable:P,"data-testid":b,id:g,ref:L,role:v,spellCheck:C,style:y,tabIndex:x,...I})}var DN=Sn(r6);function NN(e){return e.getEditorState().read(xg(e.isComposing()))}var a6=Sn(s6);function s6(e,t){let{placeholder:n,...o}=e,[r]=Jt();return S(he,{children:[c(DN,{editor:r,...o,ref:t}),n!=null&&c(i6,{editor:r,content:n})]})}function i6({content:e,editor:t}){let n=(function(s){let[i,l]=W(()=>NN(s));return _N(()=>{function d(){let u=NN(s);l(u)}return d(),xa(s.registerUpdateListener(()=>{d()}),s.registerEditableListener(()=>{d()}))},[s]),i})(t),[o,r]=W(t.isEditable());if(pe(()=>(r(t.isEditable()),t.registerEditableListener(s=>{r(s)})),[t]),!n)return null;let a=null;return typeof e=="function"?a=e(o):e!==null&&(a=e),a===null?null:c("div",{"aria-hidden":!0,children:a})}var ON=Ex,FN=ON.ContentEditable,eve=ON.ContentEditableElement;Y();var l6=ct(null),Mx={didCatch:!1,error:null},kg=class extends Vr{constructor(t){super(t),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=Mx}static getDerivedStateFromError(t){return{didCatch:!0,error:t}}resetErrorBoundary(...t){let{error:n}=this.state;n!==null&&(this.props.onReset?.({args:t,reason:"imperative-api"}),this.setState(Mx))}componentDidCatch(t,n){this.props.onError?.(t,n)}componentDidUpdate(t,n){let{didCatch:o}=this.state,{resetKeys:r}=this.props;o&&n.error!==null&&d6(t.resetKeys,r)&&(this.props.onReset?.({next:r,prev:t.resetKeys,reason:"keys"}),this.setState(Mx))}render(){let{children:t,fallbackRender:n,FallbackComponent:o,fallback:r}=this.props,{didCatch:a,error:s}=this.state,i=t;if(a){let l={error:s,resetErrorBoundary:this.resetErrorBoundary};if(typeof n=="function")i=n(l);else if(o)i=Ae(o,l);else if(r!==void 0)i=r;else throw s}return Ae(l6.Provider,{value:{didCatch:a,error:s,resetErrorBoundary:this.resetErrorBoundary}},i)}};function d6(e=[],t=[]){return e.length!==t.length||e.some((n,o)=>!Object.is(n,t[o]))}var Nx={};cn(Nx,{LexicalErrorBoundary:()=>c6});function c6({children:e,onError:t}){return c(kg,{fallback:c("div",{style:{border:"1px solid #f00",color:"#f00",padding:"8px"},children:"An error was thrown."}),onError:t,children:e})}var u6=Nx,BN=u6.LexicalErrorBoundary;var Gx={};cn(Gx,{$createHorizontalRuleNode:()=>jx,$isDecoratorTextNode:()=>JN,$isHorizontalRuleNode:()=>r_,AutoFocusExtension:()=>m6,ClearEditorExtension:()=>g6,DecoratorTextExtension:()=>b6,DecoratorTextNode:()=>Mu,EditorStateExtension:()=>Ag,HorizontalRuleExtension:()=>M6,HorizontalRuleNode:()=>ki,INSERT_HORIZONTAL_RULE_COMMAND:()=>A6,InitialStateExtension:()=>n_,LexicalBuilder:()=>Yl,NodeSelectionExtension:()=>$x,TabIndentationExtension:()=>N6,applyFormatFromStyle:()=>v6,applyFormatToDom:()=>y6,batch:()=>VN,buildEditorFromExtensions:()=>T6,computed:()=>jN,configExtension:()=>mg,declarePeerDependency:()=>KM,defineExtension:()=>un,effect:()=>ps,getExtensionDependencyFromEditor:()=>P6,getKnownTypesAndNodes:()=>h6,getPeerDependencyFromEditor:()=>o_,getPeerDependencyFromEditorOrThrow:()=>L6,namedSignals:()=>Mg,registerClearEditor:()=>XN,registerTabIndentation:()=>s_,safeCast:()=>br,shallowMergeConfig:()=>yg,signal:()=>Xl,untracked:()=>Ux,watchedSignal:()=>qx});var f6=Symbol.for("preact-signals");function Eg(){if(fs>1)return void fs--;let e,t=!1;for(;Eu!==void 0;){let n=Eu;for(Eu=void 0,zx++;n!==void 0;){let o=n.o;if(n.o=void 0,n.f&=-3,!(8&n.f)&&qN(n))try{n.c()}catch(r){t||(e=r,t=!0)}n=o}}if(zx=0,fs--,t)throw e}function VN(e){if(fs>0)return e();fs++;try{return e()}finally{Eg()}}var Nt,Eu;function Ux(e){let t=Nt;Nt=void 0;try{return e()}finally{Nt=t}}var fs=0,zx=0,Rg=0;function UN(e){if(Nt===void 0)return;let t=e.n;return t===void 0||t.t!==Nt?(t={i:0,S:e,p:Nt.s,n:void 0,t:Nt,e:void 0,x:void 0,r:t},Nt.s!==void 0&&(Nt.s.n=t),Nt.s=t,e.n=t,32&Nt.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=Nt.s,t.n=void 0,Nt.s.n=t,Nt.s=t),t):void 0}function oo(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 Xl(e,t){return new oo(e,t)}function qN(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 zN(e){for(let t=e.s;t!==void 0;t=t.n){let n=t.S.n;if(n!==void 0&&(t.r=n),t.S.n=t,t.i=-1,t.n===void 0){e.s=t;break}}}function WN(e){let t,n=e.s;for(;n!==void 0;){let o=n.p;n.i===-1?(n.S.U(n),o!==void 0&&(o.n=n.n),n.n!==void 0&&(n.n.p=o)):t=n,n.S.n=n.r,n.r!==void 0&&(n.r=void 0),n=o}e.s=t}function Ti(e,t){oo.call(this,void 0),this.x=e,this.s=void 0,this.g=Rg-1,this.f=4,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}function jN(e,t){return new Ti(e,t)}function GN(e){let t=e.u;if(e.u=void 0,typeof t=="function"){fs++;let n=Nt;Nt=void 0;try{t()}catch(o){throw e.f&=-2,e.f|=8,Vx(e),o}finally{Nt=n,Eg()}}}function Vx(e){for(let t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,GN(e)}function p6(e){if(Nt!==this)throw new Error("Out-of-order effect");WN(this),Nt=e,this.f&=-2,8&this.f&&Vx(this),Eg()}function Ql(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 ps(e,t){let n=new Ql(e,t);try{n.c()}catch(r){throw n.d(),r}let o=n.d.bind(n);return o[Symbol.dispose]=o,o}function Mg(e,t={}){let n={};for(let o in e){let r=t[o],a=Xl(r===void 0?e[o]:r);n[o]=a}return n}oo.prototype.brand=f6,oo.prototype.h=function(){return!0},oo.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:Ux(()=>{var n;(n=this.W)==null||n.call(this)}))},oo.prototype.U=function(e){if(this.t!==void 0){let t=e.e,n=e.x;t!==void 0&&(t.x=n,e.e=void 0),n!==void 0&&(n.e=t,e.x=void 0),e===this.t&&(this.t=n,n===void 0&&Ux(()=>{var o;(o=this.Z)==null||o.call(this)}))}},oo.prototype.subscribe=function(e){return ps(()=>{let t=this.value,n=Nt;Nt=void 0;try{e(t)}finally{Nt=n}},{name:"sub"})},oo.prototype.valueOf=function(){return this.value},oo.prototype.toString=function(){return this.value+""},oo.prototype.toJSON=function(){return this.value},oo.prototype.peek=function(){let e=Nt;Nt=void 0;try{return this.value}finally{Nt=e}},Object.defineProperty(oo.prototype,"value",{get(){let e=UN(this);return e!==void 0&&(e.i=this.i),this.v},set(e){if(e!==this.v){if(zx>100)throw new Error("Cycle detected");this.v=e,this.i++,Rg++,fs++;try{for(let t=this.t;t!==void 0;t=t.x)t.t.N()}finally{Eg()}}}}),Ti.prototype=new oo,Ti.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===Rg))return!0;if(this.g=Rg,this.f|=1,this.i>0&&!qN(this))return this.f&=-2,!0;let e=Nt;try{zN(this),Nt=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 Nt=e,WN(this),this.f&=-2,!0},Ti.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)}oo.prototype.S.call(this,e)},Ti.prototype.U=function(e){if(this.t!==void 0&&(oo.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)}},Ti.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(Ti.prototype,"value",{get(){if(1&this.f)throw new Error("Cycle detected");let e=UN(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}}),Ql.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()}},Ql.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,GN(this),zN(this),fs++;let e=Nt;return Nt=this,p6.bind(this,e)},Ql.prototype.N=function(){2&this.f||(this.f|=2,this.o=Eu,Eu=this)},Ql.prototype.d=function(){this.f|=8,1&this.f||Vx(this)},Ql.prototype.dispose=function(){this.d()};var m6=un({build:(e,t,n)=>Mg(t),config:br({defaultSelection:"rootEnd",disabled:!1}),name:"@lexical/extension/AutoFocus",register(e,t,n){let o=n.getOutput();return ps(()=>o.disabled.value?void 0:e.registerRootListener(r=>{e.focus(()=>{let a=document.activeElement;r===null||a!==null&&r.contains(a)||r.focus({preventScroll:!0})},{defaultSelection:o.defaultSelection.peek()})}))}});function QN(){let e=Tt(),t=De(),n=Xo();e.clear(),e.append(n),t!==null&&n.select(),ke(t)&&(t.format=0)}function XN(e,t=QN){return e.registerCommand(ng,n=>(e.update(t),!0),jt)}var g6=un({build:(e,t,n)=>Mg(t),config:br({$onClear:QN}),name:"@lexical/extension/ClearEditor",register(e,t,n){let{$onClear:o}=n.getOutput();return ps(()=>XN(e,o.value))}});function h6(e){let t=new Set,n=new Set;for(let o of YN(e)){let r=typeof o=="function"?o:o.replace;t.add(r.getType()),n.add(r)}return{nodes:n,types:t}}function YN(e){return(typeof e.nodes=="function"?e.nodes():e.nodes)||[]}var _x=HM("format",{parse:e=>typeof e=="number"?e:0}),Mu=class extends No{$config(){return this.config("decorator-text",{extends:No,stateConfigs:[{flat:!0,stateConfig:_x}]})}getFormat(){return Ym(this,_x)}getFormatFlags(t,n){return mx(this.getFormat(),t,n)}hasFormat(t){let n=FM[t];return(this.getFormat()&n)!==0}setFormat(t){return tg(this,_x,t)}toggleFormat(t){let n=this.getFormat(),o=mx(n,t,null);return this.setFormat(o)}isInline(){return!0}createDOM(){return document.createElement("span")}updateDOM(){return!1}};function JN(e){return e instanceof Mu}function v6(e,t,n){let o=t.fontWeight,r=t.textDecoration.split(" "),a=o==="700"||o==="bold",s=r.includes("line-through"),i=t.fontStyle==="italic",l=r.includes("underline"),d=t.verticalAlign;return a&&!e.hasFormat("bold")&&e.toggleFormat("bold"),s&&!e.hasFormat("strikethrough")&&e.toggleFormat("strikethrough"),i&&!e.hasFormat("italic")&&e.toggleFormat("italic"),l&&!e.hasFormat("underline")&&e.toggleFormat("underline"),d!=="sub"||e.hasFormat("subscript")||e.toggleFormat("subscript"),d!=="super"||e.hasFormat("superscript")||e.toggleFormat("superscript"),n&&!e.hasFormat(n)&&e.toggleFormat(n),e}function y6(e,t,n=x6){for(let[o,r]of Object.entries(n))e.hasFormat(r)&&(t=C6(t,o));return t}function C6(e,t){let n=document.createElement(t);return n.appendChild(e),n}var x6={b:"bold",code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"},b6=un({name:"@lexical/extension/DecoratorText",nodes:()=>[Mu],register:(e,t,n)=>e.registerCommand(yM,o=>{let r=De();if(ax(r)||ke(r))for(let a of r.getNodes())JN(a)&&a.toggleFormat(o);return!1},jl)});function qx(e,t){let n;return Xl(e(),{unwatched(){n&&(n(),n=void 0)},watched(){this.value=e(),n=t(this)}})}var Ag=un({build:e=>qx(()=>e.getEditorState(),t=>e.registerUpdateListener(n=>{t.value=n.editorState})),name:"@lexical/extension/EditorState"});function Ot(e,...t){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(let r of t)o.append("v",r);throw n.search=o.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function ZN(e,t){if(e&&t&&!Array.isArray(t)&&typeof e=="object"&&typeof t=="object"){let n=e,o=t;for(let r in o)n[r]=ZN(n[r],o[r]);return e}return t}var Wx=0,Hx=1,e_=2,Dx=3,Pg=4,Gl=5,Ox=6,Au=7;function Fx(e){return e.id===Wx}function t_(e){return e.id===e_}function w6(e){return(function(t){return t.id===Hx})(e)||Ot(305,String(e.id),String(Hx)),Object.assign(e,{id:e_})}var S6=new Set,Kx=class{builder;configs;_dependency;_peerNameSet;extension;state;_signal;constructor(t,n){this.builder=t,this.extension=n,this.configs=new Set,this.state={id:Wx}}mergeConfigs(){let t=this.extension.config||{},n=this.extension.mergeConfig?this.extension.mergeConfig.bind(this.extension):yg;for(let o of this.configs)t=n(t,o);return t}init(t){let n=this.state;t_(n)||Ot(306,String(n.id));let o={getDependency:this.getInitDependency.bind(this),getDirectDependentNames:this.getDirectDependentNames.bind(this),getPeer:this.getInitPeer.bind(this),getPeerNameSet:this.getPeerNameSet.bind(this)},r={...o,getDependency:this.getDependency.bind(this),getInitResult:this.getInitResult.bind(this),getPeer:this.getPeer.bind(this)},a=(function(i,l,d){return Object.assign(i,{config:l,id:Dx,registerState:d})})(n,this.mergeConfigs(),o),s;this.state=a,this.extension.init&&(s=this.extension.init(t,a.config,o)),this.state=(function(i,l,d){return Object.assign(i,{id:Pg,initResult:l,registerState:d})})(a,s,r)}build(t){let n=this.state,o;n.id!==Pg&&Ot(307,String(n.id),String(Gl)),this.extension.build&&(o=this.extension.build(t,n.config,n.registerState));let r={...n.registerState,getOutput:()=>o,getSignal:this.getSignal.bind(this)};this.state=(function(a,s,i){return Object.assign(a,{id:Gl,output:s,registerState:i})})(n,o,r)}register(t,n){this._signal=n;let o=this.state;o.id!==Gl&&Ot(308,String(o.id),String(Gl));let r=this.extension.register&&this.extension.register(t,o.config,o.registerState);return this.state=(function(a){return Object.assign(a,{id:Ox})})(o),()=>{let a=this.state;a.id!==Au&&Ot(309,String(o.id),String(Au)),this.state=(function(s){return Object.assign(s,{id:Gl})})(a),r&&r()}}afterRegistration(t){let n=this.state,o;return n.id!==Ox&&Ot(310,String(n.id),String(Ox)),this.extension.afterRegistration&&(o=this.extension.afterRegistration(t,n.config,n.registerState)),this.state=(function(r){return Object.assign(r,{id:Au})})(n),o}getSignal(){return this._signal===void 0&&Ot(311),this._signal}getInitResult(){this.extension.init===void 0&&Ot(312,this.extension.name);let t=this.state;return(function(n){return n.id>=Pg})(t)||Ot(313,String(t.id),String(Pg)),t.initResult}getInitPeer(t){let n=this.builder.extensionNameMap.get(t);return n?n.getExtensionInitDependency():void 0}getExtensionInitDependency(){let t=this.state;return(function(n){return n.id>=Dx})(t)||Ot(314,String(t.id),String(Dx)),{config:t.config}}getPeer(t){let n=this.builder.extensionNameMap.get(t);return n?n.getExtensionDependency():void 0}getInitDependency(t){let n=this.builder.getExtensionRep(t);return n===void 0&&Ot(315,this.extension.name,t.name),n.getExtensionInitDependency()}getDependency(t){let n=this.builder.getExtensionRep(t);return n===void 0&&Ot(315,this.extension.name,t.name),n.getExtensionDependency()}getState(){let t=this.state;return(function(n){return n.id>=Au})(t)||Ot(316,String(t.id),String(Au)),t}getDirectDependentNames(){return this.builder.incomingEdges.get(this.extension.name)||S6}getPeerNameSet(){let t=this._peerNameSet;return t||(t=new Set((this.extension.peerDependencies||[]).map(([n])=>n)),this._peerNameSet=t),t}getExtensionDependency(){if(!this._dependency){let t=this.state;(function(n){return n.id>=Gl})(t)||Ot(317,this.extension.name),this._dependency={config:t.config,init:t.initResult,output:t.output}}return this._dependency}},HN={tag:_o};function I6(){let e=Tt();e.isEmpty()&&e.append(Xo())}var n_=un({config:br({setOptions:HN,updateOptions:HN}),init:({$initialEditorState:e=I6})=>({$initialEditorState:e,initialized:!1}),afterRegistration(e,{updateOptions:t,setOptions:n},o){let r=o.getInitResult();if(!r.initialized){r.initialized=!0;let{$initialEditorState:a}=r;if(GE(a))e.setEditorState(a,n);else if(typeof a=="function")e.update(()=>{a(e)},t);else if(a&&(typeof a=="string"||typeof a=="object")){let s=e.parseEditorState(a);e.setEditorState(s,n)}}return()=>{}},name:"@lexical/extension/InitialState",nodes:[NM,pg,PM,BM,AM]}),KN=Symbol.for("@lexical/extension/LexicalBuilder");function T6(...e){return Yl.fromExtensions(e).buildEditor()}function $N(){}function k6(e){throw e}function Lg(e){return Array.isArray(e)?e:[e]}var Bx="0.41.0+prod.esm",Yl=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=Bx,this.roots=t;for(let n of t)this.addExtension(n)}static fromExtensions(t){let n=[Lg(n_)];for(let o of t)n.push(Lg(o));return new e(n)}static maybeFromEditor(t){let n=t[KN];return n&&(n.PACKAGE_VERSION!==Bx&&Ot(292,n.PACKAGE_VERSION,Bx),n instanceof e||Ot(293)),n}static fromEditor(t){let n=e.maybeFromEditor(t);return n===void 0&&Ot(294),n}constructEditor(){let{$initialEditorState:t,onError:n,...o}=this.buildCreateEditorArgs(),r=Object.assign(gg({...o,...n?{onError:a=>{n(a,r)}}:{}}),{[KN]:this});for(let a of this.sortedExtensionReps())a.build(r);return r}buildEditor(){let t=$N;function n(){try{t()}finally{t=$N}}let o=Object.assign(this.constructEditor(),{dispose:n,[Symbol.dispose]:n});return t=Br(this.registerEditor(o),()=>o.setRootElement(null)),o}hasExtensionByName(t){return this.extensionNameMap.has(t)}getExtensionRep(t){let n=this.extensionNameMap.get(t.name);if(n)return n.extension!==t&&Ot(295,t.name),n}addEdge(t,n,o){let r=this.outgoingConfigEdges.get(t);r?r.set(n,o):this.outgoingConfigEdges.set(t,new Map([[n,o]]));let a=this.incomingEdges.get(n);a?a.add(t):this.incomingEdges.set(n,new Set([t]))}addExtension(t){this._sortedExtensionReps!==void 0&&Ot(296);let n=Lg(t),[o]=n;typeof o.name!="string"&&Ot(297,typeof o.name);let r=this.extensionNameMap.get(o.name);if(r!==void 0&&r.extension!==o&&Ot(298,o.name),!r){r=new Kx(this,o),this.extensionNameMap.set(o.name,r);let a=this.conflicts.get(o.name);typeof a=="string"&&Ot(299,o.name,a);for(let s of o.conflictsWith||[])this.extensionNameMap.has(s)&&Ot(299,o.name,s),this.conflicts.set(s,o.name);for(let s of o.dependencies||[]){let i=Lg(s);this.addEdge(o.name,i[0].name,i.slice(1)),this.addExtension(i)}for(let[s,i]of o.peerDependencies||[])this.addEdge(o.name,s,i?[i]:[])}}sortedExtensionReps(){if(this._sortedExtensionReps)return this._sortedExtensionReps;let t=[],n=(o,r)=>{let a=o.state;if(t_(a))return;let s=o.extension.name;var i;Fx(a)||Ot(300,s,r||"[unknown]"),Fx(i=a)||Ot(304,String(i.id),String(Wx)),a=Object.assign(i,{id:Hx}),o.state=a;let l=this.outgoingConfigEdges.get(s);if(l)for(let d of l.keys()){let u=this.extensionNameMap.get(d);u&&n(u,s)}a=w6(a),o.state=a,t.push(o)};for(let o of this.extensionNameMap.values())Fx(o.state)&&n(o);for(let o of t)for(let[r,a]of this.outgoingConfigEdges.get(o.extension.name)||[])if(a.length>0){let s=this.extensionNameMap.get(r);if(s)for(let i of a)s.configs.add(i)}for(let[o,...r]of this.roots)if(r.length>0){let a=this.extensionNameMap.get(o.name);a===void 0&&Ot(301,o.name);for(let s of r)a.configs.add(s)}return this._sortedExtensionReps=t,this._sortedExtensionReps}registerEditor(t){let n=this.sortedExtensionReps(),o=new AbortController,r=[()=>o.abort()],a=o.signal;for(let s of n){let i=s.register(t,a);i&&r.push(i)}for(let s of n){let i=s.afterRegistration(t);i&&r.push(i)}return Br(...r)}buildCreateEditorArgs(){let t={},n=new Set,o=new Map,r=new Map,a={},s={},i=this.sortedExtensionReps();for(let u of i){let{extension:f}=u;if(f.onError!==void 0&&(t.onError=f.onError),f.disableEvents!==void 0&&(t.disableEvents=f.disableEvents),f.parentEditor!==void 0&&(t.parentEditor=f.parentEditor),f.editable!==void 0&&(t.editable=f.editable),f.namespace!==void 0&&(t.namespace=f.namespace),f.$initialEditorState!==void 0&&(t.$initialEditorState=f.$initialEditorState),f.nodes)for(let p of YN(f)){if(typeof p!="function"){let m=o.get(p.replace);m&&Ot(302,f.name,p.replace.name,m.extension.name),o.set(p.replace,u)}n.add(p)}if(f.html){if(f.html.export)for(let[p,m]of f.html.export.entries())r.set(p,m);f.html.import&&Object.assign(a,f.html.import)}f.theme&&ZN(s,f.theme)}Object.keys(s).length>0&&(t.theme=s),n.size&&(t.nodes=[...n]);let l=Object.keys(a).length>0,d=r.size>0;(l||d)&&(t.html={},l&&(t.html.import=a),d&&(t.html.export=r));for(let u of i)u.init(t);return t.onError||(t.onError=k6),t}};function P6(e,t){let n=Yl.fromEditor(e).getExtensionRep(t);return n===void 0&&Ot(303,t.name),n.getExtensionDependency()}function o_(e,t){let n=Yl.fromEditor(e).extensionNameMap.get(t);return n?n.getExtensionDependency():void 0}function L6(e,t){let n=o_(e,t);return n===void 0&&Ot(291,t),n}var R6=new Set,$x=un({build(e,t,n){let o=n.getDependency(Ag).output,r=Xl({watchedNodeKeys:new Map}),a=qx(()=>{},()=>ps(()=>{let s=a.peek(),{watchedNodeKeys:i}=r.value,l,d=!1;o.value.read(()=>{if(De())for(let[u,f]of i.entries()){if(f.size===0){i.delete(u);continue}let p=Vl(u),m=p&&p.isSelected()||!1;d=d||m!==(!!s&&s.has(u)),m&&(l=l||new Set,l.add(u))}}),!d&&l&&s&&l.size===s.size||(a.value=l)}));return{watchNodeKey:function(s){let i=jN(()=>(a.value||R6).has(s)),{watchedNodeKeys:l}=r.peek(),d=l.get(s),u=d!==void 0;return d=d||new Set,d.add(i),u||(l.set(s,d),r.value={watchedNodeKeys:l}),i}}},dependencies:[Ag],name:"@lexical/extension/NodeSelection"}),A6=zM("INSERT_HORIZONTAL_RULE_COMMAND"),ki=class e extends No{static getType(){return"horizontalrule"}static clone(t){return new e(t.__key)}static importJSON(t){return jx().updateFromJSON(t)}static importDOM(){return{hr:()=>({conversion:E6,priority:0})}}exportDOM(){return{element:document.createElement("hr")}}createDOM(t){let n=document.createElement("hr");return Pu(n,t.theme.hr),n}getTextContent(){return`
|
|
4159
|
-
`}isInline(){return!1}updateDOM(){return!1}};function E6(){return{node:jx()}}function jx(){return BE(ki)}function r_(e){return e instanceof ki}var M6=un({dependencies:[Ag,$x],name:"@lexical/extension/HorizontalRule",nodes:()=>[ki],register(e,t,n){let{watchNodeKey:o}=n.getDependency($x).output,r=Xl({nodeSelections:new Map}),a=e._config.theme.hrSelected??"selected";return Br(e.registerCommand(lM,s=>{if(jM(s.target)){let i=WE(s.target);if(r_(i))return(function(l,d=!1){let u=De(),f=l.isSelected(),p=l.getKey(),m;d&&ax(u)?m=u:(m=UE(),xr(m)),f?m.delete(p):m.add(p)})(i,s.shiftKey),!0}return!1},jl),e.registerMutationListener(ki,(s,i)=>{VN(()=>{let l=!1,{nodeSelections:d}=r.peek();for(let[u,f]of s.entries())if(f==="destroyed")d.delete(u),l=!0;else{let p=d.get(u),m=e.getElementByKey(u);p?p.domNode.value=m:(l=!0,d.set(u,{domNode:Xl(m),selectedSignal:o(u)}))}l&&(r.value={nodeSelections:d})})}),ps(()=>{let s=[];for(let{domNode:i,selectedSignal:l}of r.value.nodeSelections.values())s.push(ps(()=>{let d=i.value;d&&(l.value?Pu(d,a):vg(d,a))}));return Br(...s)}))}});function a_(e){return e.canBeEmpty()}function s_(e,t,n=a_){return Br(e.registerCommand(ug,o=>{let r=De();if(!ke(r))return!1;o.preventDefault();let a=(function(s){if(s.getNodes().filter(p=>ql(p)&&p.canIndent()).length>0)return!0;let i=s.anchor,l=s.focus,d=l.isBefore(i)?l:i,u=d.getNode(),f=AN(u);if(f.canIndent()){let p=f.getKey(),m=bi();if(m.anchor.set(p,0,"element"),m.focus.set(p,0,"element"),m=eM(m),m.anchor.is(d))return!0}return!1})(r)?o.shiftKey?LM:lx:bM;return e.dispatchCommand(a,void 0)},jt),e.registerCommand(lx,()=>{let o=typeof t=="number"?t:t?t.peek():null,r=De();if(!ke(r))return!1;let a=typeof n=="function"?n:n.peek();return EN(s=>{if(a(s)){let i=s.getIndent()+1;(!o||i<o)&&s.setIndent(i)}})},og))}var N6=un({build:(e,t,n)=>Mg(t),config:br({$canIndent:a_,disabled:!1,maxIndent:null}),name:"@lexical/extension/TabIndentation",register(e,t,n){let{disabled:o,maxIndent:r,$canIndent:a}=n.getOutput();return ps(()=>{if(!o.value)return s_(e,r,a)})}});var bt=Gx,cve=bt.$createHorizontalRuleNode,uve=bt.$isDecoratorTextNode,fve=bt.$isHorizontalRuleNode,pve=bt.AutoFocusExtension,mve=bt.ClearEditorExtension,gve=bt.DecoratorTextExtension,hve=bt.DecoratorTextNode,vve=bt.EditorStateExtension,yve=bt.HorizontalRuleExtension,Cve=bt.HorizontalRuleNode,xve=bt.INSERT_HORIZONTAL_RULE_COMMAND,bve=bt.InitialStateExtension,i_=bt.LexicalBuilder,wve=bt.NodeSelectionExtension,Sve=bt.TabIndentationExtension,Ive=bt.applyFormatFromStyle,Tve=bt.applyFormatToDom,l_=bt.batch,kve=bt.buildEditorFromExtensions,Pve=bt.computed,Lve=bt.configExtension,Rve=bt.declarePeerDependency,Ave=bt.defineExtension,Nu=bt.effect,Eve=bt.getExtensionDependencyFromEditor,Mve=bt.getKnownTypesAndNodes,d_=bt.getPeerDependencyFromEditor,Nve=bt.getPeerDependencyFromEditorOrThrow,Ng=bt.namedSignals,_ve=bt.registerClearEditor,Dve=bt.registerTabIndentation,Ove=bt.safeCast,Fve=bt.shallowMergeConfig,Bve=bt.signal,Uve=bt.untracked,zve=bt.watchedSignal;var Qx={};cn(Qx,{HistoryExtension:()=>_g,SharedHistoryExtension:()=>O6,createEmptyHistoryState:()=>f_,registerHistory:()=>u_});function _6(e,t,n,o,r){if(e===null||n.size===0&&o.size===0&&!r)return 0;let a=t._selection,s=e._selection;if(r)return 1;if(!(ke(a)&&ke(s)&&s.isCollapsed()&&a.isCollapsed()))return 0;let i=(function(C,y,x){let b=C._nodeMap,I=[];for(let T of y){let P=b.get(T);P!==void 0&&I.push(P)}for(let[T,P]of x){if(!P)continue;let k=b.get(T);k===void 0||Su(k)||I.push(k)}return I})(t,n,o);if(i.length===0)return 0;if(i.length>1){let C=t._nodeMap,y=C.get(a.anchor.key),x=C.get(s.anchor.key);return y&&x&&!e._nodeMap.has(y.__key)&&it(y)&&y.__text.length===1&&a.anchor.offset===1?2:0}let l=i[0],d=e._nodeMap.get(l.__key);if(!it(d)||!it(l)||d.__mode!==l.__mode)return 0;let u=d.__text,f=l.__text;if(u===f)return 0;let p=a.anchor,m=s.anchor;if(p.key!==m.key||p.type!=="text")return 0;let h=p.offset,g=m.offset,v=f.length-u.length;return v===1&&g===h-1?2:v===-1&&g===h+1?3:v===-1&&g===h?4:0}function D6(e,t){let n=Date.now(),o=0,r=Date.now(),a=0,s=null;return(i,l,d,u,f,p)=>{let m=Date.now();if(p.has(cM)&&(r=n,a=o,s=i),p.has(sg))return o=0,n=m,2;p.has(dM)&&s&&(n=r,o=a,i=s);let h=_6(i,l,u,f,e.isComposing()),g=(()=>{let v=d===null||d.editor===e,C=p.has(CM);if(!C&&v&&p.has(_o))return 0;if(h===1)return 2;if(i===null)return 1;let y=l._selection;if(!(u.size>0||f.size>0))return y!==null?0:2;let x=typeof t=="number"?t:t.peek();return C===!1&&h!==0&&h===o&&m<n+x&&v||u.size===1&&(function(b,I,T){let P=I._nodeMap.get(b),k=T._nodeMap.get(b),w=I._selection,L=T._selection;return!(ke(w)&&ke(L)&&w.anchor.type==="element"&&w.focus.type==="element"&&L.anchor.type==="text"&&L.focus.type==="text"||!it(P)||!it(k)||P.__parent!==k.__parent)&&JSON.stringify(I.read(()=>P.exportJSON()))===JSON.stringify(T.read(()=>k.exportJSON()))})(Array.from(u)[0],i,l)?0:1})();return n=m,o=h,g}}function c_(e){e.undoStack=[],e.redoStack=[],e.current=null}function u_(e,t,n){let o=D6(e,n);return xa(e.registerCommand(UM,()=>((function(a,s){let i=s.redoStack,l=s.undoStack;if(l.length!==0){let d=s.current,u=l.pop();d!==null&&(i.push(d),a.dispatchCommand(Iu,!0)),l.length===0&&a.dispatchCommand(Tu,!1),s.current=u||null,u&&u.editor.setEditorState(u.editorState,{tag:sg})}})(e,t),!0),jt),e.registerCommand(EM,()=>((function(a,s){let i=s.redoStack,l=s.undoStack;if(i.length!==0){let d=s.current;d!==null&&(l.push(d),a.dispatchCommand(Tu,!0));let u=i.pop();i.length===0&&a.dispatchCommand(Iu,!1),s.current=u||null,u&&u.editor.setEditorState(u.editorState,{tag:sg})}})(e,t),!0),jt),e.registerCommand(ng,()=>(c_(t),!1),jt),e.registerCommand(iM,()=>(c_(t),e.dispatchCommand(Iu,!1),e.dispatchCommand(Tu,!1),!0),jt),e.registerUpdateListener(({editorState:a,prevEditorState:s,dirtyLeaves:i,dirtyElements:l,tags:d})=>{let u=t.current,f=t.redoStack,p=t.undoStack,m=u===null?null:u.editorState;if(u!==null&&a===m)return;let h=o(s,a,u,i,l,d);if(h===1)f.length!==0&&(t.redoStack=[],e.dispatchCommand(Iu,!1)),u!==null&&(p.push({...u}),e.dispatchCommand(Tu,!0));else if(h===2)return;t.current={editor:e,editorState:a}}))}function f_(){return{current:null,redoStack:[],undoStack:[]}}var _g=un({build:(e,{delay:t,createInitialHistoryState:n,disabled:o})=>Ng({delay:t,disabled:o,historyState:n(e)}),config:br({createInitialHistoryState:f_,delay:300,disabled:typeof window>"u"}),name:"@lexical/history/History",register:(e,t,n)=>{let o=n.getOutput();return Nu(()=>o.disabled.value?void 0:u_(e,o.historyState.value,o.delay))}}),O6=un({dependencies:[mg(_g,{createInitialHistoryState:()=>{throw new Error("SharedHistory did not inherit parent history")},disabled:!0})],name:"@lexical/history/SharedHistory",register(e,t,n){let{output:o}=n.getDependency(_g),r=(function(s){return s?d_(s,_g.name):null})(e._parentEditor);if(!r)return()=>{};let a=r.output;return Nu(()=>l_(()=>{o.delay.value=a.delay.value,o.historyState.value=a.historyState.value,o.disabled.value=a.disabled.value}))}});var Dg=Qx,qve=Dg.HistoryExtension,Wve=Dg.SharedHistoryExtension,Og=Dg.createEmptyHistoryState,p_=Dg.registerHistory;var Xx={};cn(Xx,{HistoryPlugin:()=>F6,createEmptyHistoryState:()=>Og});Y();function F6({delay:e,externalHistoryState:t}){let[n]=Jt();return(function(o,r,a=1e3){let s=K(()=>r||Og(),[r]);U(()=>p_(o,s,a),[a,o,s])})(n,t,e),null}var m_=Xx,g_=m_.HistoryPlugin,h_=m_.createEmptyHistoryState;var Yx={};cn(Yx,{OnChangePlugin:()=>U6});Y();var B6=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?pe:U;function U6({ignoreHistoryMergeTagChange:e=!0,ignoreSelectionChange:t=!1,onChange:n}){let[o]=Jt();return B6(()=>{if(n)return o.registerUpdateListener(({editorState:r,dirtyElements:a,dirtyLeaves:s,prevEditorState:i,tags:l})=>{t&&a.size===0&&s.size===0||e&&l.has(_o)||i.isEmpty()||n(r,o,l)})},[o,e,t,n]),null}var z6=Yx,v_=z6.OnChangePlugin;var Jx={};cn(Jx,{useLexicalEditable:()=>$6});Y();var H6=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?pe:U;function K6(e){return{initialValueFn:()=>e.isEditable(),subscribe:t=>e.registerEditableListener(t)}}function $6(){return(function(e){let[t]=Jt(),n=K(()=>e(t),[t,e]),[o,r]=W(()=>n.initialValueFn()),a=M(o);return H6(()=>{let{initialValueFn:s,subscribe:i}=n,l=s();return a.current!==l&&(a.current=l,r(l)),i(d=>{a.current=d,r(d)})},[n,e]),o})(K6)}var V6=Jx,y_=V6.useLexicalEditable;var Zx={};cn(Zx,{ReactProviderExtension:()=>q6});var q6=un({name:"@lexical/react/ReactProvider"});var W6=Zx,C_=W6.ReactProviderExtension;var eb={};cn(eb,{DragonExtension:()=>j6,registerDragonSupport:()=>x_});function x_(e){let t=window.location.origin,n=o=>{if(o.origin!==t)return;let r=e.getRootElement();if(document.activeElement!==r)return;let a=o.data;if(typeof a=="string"){let 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 l=i.args;if(l){let[d,u,f,p,m]=l;e.update(()=>{let h=De();if(ke(h)){let g=h.anchor,v=g.getNode(),C=0,y=0;if(it(v)&&d>=0&&u>=0&&(C=d,y=d+u,h.setTextNodeRange(v,C,v,y)),C===y&&f===""||(h.insertRawText(f),v=g.getNode()),it(v)){C=p,y=p+m;let x=v.getTextContentSize();C=C>x?x:C,y=y>x?x:y,h.setTextNodeRange(v,C,v,y)}o.stopImmediatePropagation()}})}}}}};return window.addEventListener("message",n,!0),()=>{window.removeEventListener("message",n,!0)}}var j6=un({build:(e,t,n)=>Ng(t),config:br({disabled:typeof window>"u"}),name:"@lexical/dragon",register:(e,t,n)=>Nu(()=>n.getOutput().disabled.value?void 0:x_(e))});var b_=eb,w_=b_.DragonExtension,S_=b_.registerDragonSupport;var tb={};cn(tb,{$generateHtmlFromNodes:()=>Q6,$generateNodesFromDOM:()=>G6});function G6(e,t){let n=WM(t)?t.body.childNodes:t.childNodes,o=[],r=[];for(let a of n)if(!T_.has(a.nodeName)){let s=k_(a,e,r,!1);s!==null&&(o=o.concat(s))}return(function(a){for(let s of a)s.getNextSibling()instanceof ix&&s.insertAfter(xi());for(let s of a){let i=s.getChildren();for(let l of i)s.insertBefore(l);s.remove()}})(r),o}function Q6(e,t){if(typeof document>"u"||typeof window>"u"&&global.window===void 0)throw new Error("To use $generateHtmlFromNodes in headless mode please initialize a headless browser implementation such as JSDom before calling this function.");let n=document.createElement("div"),o=Tt().getChildren();for(let r=0;r<o.length;r++)I_(e,o[r],n,t);return n.innerHTML}function I_(e,t,n,o=null){let r=o===null||t.isSelected(o),a=qe(t)&&t.excludeFromCopy("html"),s=t;o!==null&&it(t)&&(s=Ig(o,t,"clone"));let i=qe(s)?s.getChildren():[],l=VM(e,s.getType()),d;d=l&&l.exportDOM!==void 0?l.exportDOM(e,s):s.exportDOM(e);let{element:u,after:f}=d;if(!u)return!1;let p=document.createDocumentFragment();for(let m=0;m<i.length;m++){let h=i[m],g=I_(e,h,p,o);!r&&qe(t)&&g&&t.extractWithChild(h,o,"html")&&(r=!0)}if(r&&!a){if((MN(u)||fx(u))&&u.append(p),n.append(u),f){let m=f.call(s,u);m&&(fx(u)?u.replaceChildren(m):u.replaceWith(m))}}else n.append(p);return r}var T_=new Set(["STYLE","SCRIPT"]);function k_(e,t,n,o,r=new Map,a){let s=[];if(T_.has(e.nodeName))return s;let i=null,l=(function(h,g){let{nodeName:v}=h,C=g._htmlConversions.get(v.toLowerCase()),y=null;if(C!==void 0)for(let x of C){let b=x(h);b!==null&&(y===null||(y.priority||0)<=(b.priority||0))&&(y=b)}return y!==null?y.conversion:null})(e,t),d=l?l(e):null,u=null;if(d!==null){u=d.after;let h=d.node;if(i=Array.isArray(h)?h[h.length-1]:h,i!==null){for(let[,g]of r)if(i=g(i,a),!i)break;i&&s.push(...Array.isArray(h)?h:[i])}d.forChild!=null&&r.set(e.nodeName,d.forChild)}let f=e.childNodes,p=[],m=(i==null||!Si(i))&&(i!=null&&ql(i)||o);for(let h=0;h<f.length;h++)p.push(...k_(f[h],t,n,m,new Map(r),i));return u!=null&&(p=u(p)),Ax(e)&&(p=X6(e,p,m?()=>{let h=new ix;return n.push(h),h}:Xo)),i==null?p.length>0?s=s.concat(p):Ax(e)&&(function(h){return h.nextSibling==null||h.previousSibling==null?!1:Lu(h.nextSibling)&&Lu(h.previousSibling)})(e)&&(s=s.concat(xi())):qe(i)&&i.append(...p),s}function X6(e,t,n){let o=e.style.textAlign,r=[],a=[];for(let s=0;s<t.length;s++){let i=t[s];if(ql(i))o&&!i.getFormat()&&i.setFormat(o),r.push(i);else if(a.push(i),s===t.length-1||s<t.length-1&&ql(t[s+1])){let l=n();l.setFormat(o),l.append(...a),r.push(l),a=[]}}return r}var P_=tb,L_=P_.$generateHtmlFromNodes,R_=P_.$generateNodesFromDOM;var ob={};cn(ob,{$generateJSONFromSelectedNodes:()=>__,$generateNodesFromSerializedNodes:()=>D_,$getClipboardDataFromSelection:()=>F_,$getHtmlContent:()=>E_,$getLexicalContent:()=>M_,$insertDataTransferForPlainText:()=>Y6,$insertDataTransferForRichText:()=>J6,$insertGeneratedNodes:()=>nb,copyToClipboard:()=>Z6,setLexicalClipboardDataTransfer:()=>B_});function Fg(e,...t){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(let r of t)o.append("v",r);throw n.search=o.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function E_(e,t=De()){return t==null&&Fg(166),ke(t)&&t.isCollapsed()||t.getNodes().length===0?"":L_(e,t)}function M_(e,t=De()){return t==null&&Fg(166),ke(t)&&t.isCollapsed()||t.getNodes().length===0?null:JSON.stringify(__(e,t))}function Y6(e,t){let n=e.getData("text/plain")||e.getData("text/uri-list");n!=null&&t.insertRawText(n)}function J6(e,t,n){let o=e.getData("application/x-lexical-editor");if(o)try{let i=JSON.parse(o);if(i.namespace===n._config.namespace&&Array.isArray(i.nodes))return nb(n,D_(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(l){return window.trustedTypes&&window.trustedTypes.createPolicy?window.trustedTypes.createPolicy("lexical",{createHTML:d=>d}).createHTML(l):l})(r),"text/html");return nb(n,R_(n,i),t)}catch(i){console.error(i)}let s=a||e.getData("text/uri-list");if(s!=null)if(ke(t)){let i=s.split(/(\r?\n|\t)/);i[i.length-1]===""&&i.pop();for(let l=0;l<i.length;l++){let d=De();if(ke(d)){let u=i[l];u===`
|
|
4158
|
+
`);let l=i.length;if(!it(o)||r>=l){let d=o.getParent();o.remove(),d==null||d.getChildrenSize()!==0||Su(d)||d.remove(),r-=l+s,o=a}else{let d=o.getKey(),u=e.getEditorState().read(()=>{let m=Vl(d);return it(m)&&m.isSimpleText()?m.getTextContent():null}),f=l-r,p=i.slice(0,f);if(u!==null&&u!==i){let m=bu(),h=o;if(o.isSimpleText())o.setTextContent(u);else{let g=Cr(u);o.replace(g),h=g}if(ke(m)&&m.isCollapsed()){let g=m.anchor.offset;h.select(g,g)}}else if(o.isSimpleText()){let m=t.key===d,h=t.offset;h<r&&(h=l);let g=m?h-r:0,v=m?h:f;if(m&&g===0){let[C]=o.splitText(g,v);C.remove()}else{let[,C]=o.splitText(g,v);C.remove()}}else{let m=Cr(p);o.replace(m)}r=0}}}function l8(e){let t=e.getStyle(),n=oN(t);wg.set(t,n)}function bg(e,t){(ke(e)?e.isCollapsed():it(e)||qe(e))||Cx(280);let n=Sg(ke(e)?e.style:it(e)?e.getStyle():e.getTextStyle()),o=Object.entries(t).reduce((a,[s,i])=>(typeof i=="function"?a[s]=i(n[s],e):i===null?delete a[s]:a[s]=i,a),{...n}),r=rN(o);ke(e)||it(e)?e.setStyle(r):e.setTextStyle(r),wg.set(r,o)}function d8(e,t){if(ke(e)&&e.isCollapsed()){bg(e,t);let o=e.anchor.getNode();qe(o)&&o.isEmpty()&&bg(o,t)}sN(o=>{bg(o,t)});let n=e.getNodes();if(n.length>0){let o=new Set;for(let r of n){if(!qe(r)||!r.canBeEmpty()||r.getChildrenSize()!==0)continue;let a=r.getKey();o.has(a)||(o.add(a),bg(r,t))}}}function sN(e){let t=De();if(!t)return;let n=new Map,o=a=>n.get(a.getKey())||[0,a.getTextContentSize()];if(ke(t))for(let a of OE(t).getTextSlices())a&&n.set(a.caret.origin.getKey(),a.getSliceIndices());let r=t.getNodes();for(let a of r){if(!it(a)||!a.canHaveFormat())continue;let[s,i]=o(a);i!==s&&(sx(a)||s===0&&i===a.getTextContentSize()?e(a):e(a.splitText(s,i)[s===0?0:1]))}ke(t)&&t.anchor.type==="text"&&t.focus.type==="text"&&t.anchor.key===t.focus.key&&iN(t)}function iN(e){if(e.isBackward()){let{anchor:t,focus:n}=e,{key:o,offset:r,type:a}=t;t.set(n.key,n.offset,n.type),n.set(o,r,a)}}function lN(e,t){let n=e.getFormatType(),o=e.getIndent();n!==t.getFormatType()&&t.setFormat(n),o!==t.getIndent()&&t.setIndent(o)}function c8(e,t,n=lN){if(e===null)return;let o=e.getStartEndPoints(),r=new Map,a=null;if(o){let[s,i]=o;a=bi(),a.anchor.set(s.key,s.offset,s.type),a.focus.set(i.key,i.offset,i.type);let l=ya(s.getNode(),ku),d=ya(i.getNode(),ku);qe(l)&&r.set(l.getKey(),l),qe(d)&&r.set(d.getKey(),d)}for(let s of e.getNodes())if(qe(s)&&ku(s))r.set(s.getKey(),s);else if(o===null){let i=ya(s,ku);qe(i)&&r.set(i.getKey(),i)}for(let[s,i]of r){let l=t();n(i,l),i.replace(l,!0),a&&(s===a.anchor.key&&a.anchor.set(l.getKey(),a.anchor.offset,a.anchor.type),s===a.focus.key&&a.focus.set(l.getKey(),a.focus.offset,a.focus.type))}a&&e.is(De())&&xr(a)}function nN(e){return e.getNode().isAttached()}function u8(e){let t=e;for(;t!==null&&!Si(t);){let n=t.getLatest(),o=t.getParent();n.getChildrenSize()===0&&t.remove(!0),t=o}}function f8(e,t,n=null){let o=e.getStartEndPoints(),r=o?o[0]:null,a=e.getNodes(),s=a.length;if(r!==null&&(s===0||s===1&&r.type==="element"&&r.getNode().getChildrenSize()===0)){let d=r.type==="text"?r.getNode().getParentOrThrow():r.getNode(),u=d.getChildren(),f=t();return f.setFormat(d.getFormatType()),f.setIndent(d.getIndent()),u.forEach(p=>f.append(p)),n&&(f=n.append(f)),void d.replace(f)}let i=null,l=[];for(let d=0;d<s;d++){let u=a[d];Si(u)?(yx(e,l,l.length,t,n),l=[],i=u):i===null||i!==null&&jE(u,i)?l.push(u):(yx(e,l,l.length,t,n),l=[u])}yx(e,l,l.length,t,n)}function yx(e,t,n,o,r=null){if(t.length===0)return;let a=t[0],s=new Map,i=[],l=qe(a)?a:a.getParentOrThrow();l.isInline()&&(l=l.getParentOrThrow());let d=!1;for(;l!==null;){let h=l.getPreviousSibling();if(h!==null){l=h,d=!0;break}if(l=l.getParentOrThrow(),Si(l))break}let u=new Set;for(let h=0;h<n;h++){let g=t[h];qe(g)&&g.getChildrenSize()===0&&u.add(g.getKey())}let f=new Set;for(let h=0;h<n;h++){let g=t[h],v=g.getParent();if(v!==null&&v.isInline()&&(v=v.getParent()),v!==null&&XE(g)&&!f.has(g.getKey())){let C=v.getKey();if(s.get(C)===void 0){let y=o();y.setFormat(v.getFormatType()),y.setIndent(v.getIndent()),i.push(y),s.set(C,y),v.getChildren().forEach(x=>{y.append(x),f.add(x.getKey()),qe(x)&&x.getChildrenKeys().forEach(b=>f.add(b))}),u8(v)}}else if(u.has(g.getKey())){qe(g)||Cx(179);let C=o();C.setFormat(g.getFormatType()),C.setIndent(g.getIndent()),i.push(C),g.remove(!0)}}if(r!==null)for(let h=0;h<i.length;h++){let g=i[h];r.append(g)}let p=null;if(Si(l))if(d)if(r!==null)l.insertAfter(r);else for(let h=i.length-1;h>=0;h--){let g=i[h];l.insertAfter(g)}else{let h=l.getFirstChild();if(qe(h)&&(l=h),h===null)if(r)l.append(r);else for(let g=0;g<i.length;g++){let v=i[g];l.append(v),p=v}else if(r!==null)h.insertBefore(r);else for(let g=0;g<i.length;g++){let v=i[g];h.insertBefore(v),p=v}}else if(r)l.insertAfter(r);else for(let h=i.length-1;h>=0;h--){let g=i[h];l.insertAfter(g),p=g}let m=bu();ke(m)&&nN(m.anchor)&&nN(m.focus)?xr(m.clone()):p!==null?p.selectEnd():e.dirty=!0}function dN(e){let t=cN(e);return t!==null&&t.writingMode==="vertical-rl"}function cN(e){let t=e.anchor.getNode();return qe(t)?xx(t):bx(t)}function p8(e,t){let n=dN(e)?!t:t;wx(e)&&(n=!n);let o=$l(e.focus,n?"previous":"next");if(QE(o))return!1;for(let r of KE(o)){if(wu(r))return!r.origin.isInline();if(!qe(r.origin)){if(Jm(r.origin))return!0;break}}return!1}function uN(e,t,n,o){e.modify(t?"extend":"move",n,o)}function wx(e){let t=cN(e);return t!==null&&t.direction==="rtl"}function m8(e,t,n){let o=wx(e),r;r=dN(e)||o?!n:n,uN(e,t,r,"character")}function g8(e,t,n){let o=Sg(e.getStyle());return o!==null&&o[t]||n}function h8(e,t,n=""){let o=null,r=e.getNodes(),a=e.anchor,s=e.focus,i=e.isBackward(),l=i?s.offset:a.offset,d=i?s.getNode():a.getNode();if(ke(e)&&e.isCollapsed()&&e.style!==""){let u=Sg(e.style);if(u!==null&&t in u)return u[t]}for(let u=0;u<r.length;u++){let f=r[u];if((u===0||l!==0||!f.is(d))&&it(f)){let p=g8(f,t,n);if(o===null)o=p;else if(o!==p){o="";break}}}return o===null?n:o}var v8=aN;var Zt=Sx,fN=Zt.$addNodeStyle,Nge=Zt.$cloneWithProperties,_ge=Zt.$copyBlockFormatIndent,Dge=Zt.$ensureForwardRangeSelection,Oge=Zt.$forEachSelectedTextNode,Fge=Zt.$getComputedStyleForElement,Bge=Zt.$getComputedStyleForParent,Uge=Zt.$getSelectionStyleValueForProperty,zge=Zt.$isAtNodeEnd,Hge=Zt.$isParentElementRTL,Kge=Zt.$isParentRTL,$ge=Zt.$moveCaretSelection,Ix=Zt.$moveCharacter,Vge=Zt.$patchStyleText,qge=Zt.$selectAll,Wge=Zt.$setBlocksType,Tx=Zt.$shouldOverrideDefaultCharacterSelection,Ig=Zt.$sliceSelectedTextNodeContent,jge=Zt.$trimTextContentFromAnchor,Gge=Zt.$wrapNodes,Qge=Zt.createDOMRange,pN=Zt.createRectsFromDOMRange,Xge=Zt.getCSSFromStyleObject,Yge=Zt.getStyleObjectFromCSS,Jge=Zt.trimTextContentFromAnchor;var Rx={};cn(Rx,{$descendantsMatching:()=>e6,$dfs:()=>O8,$dfsIterator:()=>SN,$filter:()=>G8,$findMatchingParent:()=>ya,$firstToLastIterator:()=>t6,$getAdjacentCaret:()=>F8,$getAdjacentSiblingOrParentSiblingCaret:()=>wi,$getDepth:()=>TN,$getNearestBlockElementAncestorOrThrow:()=>K8,$getNearestNodeOfType:()=>H8,$getNextRightPreorderNode:()=>z8,$getNextSiblingOrParentSibling:()=>U8,$handleIndentAndOutdent:()=>Q8,$insertFirst:()=>X8,$insertNodeToNearestRoot:()=>q8,$insertNodeToNearestRootAtCaret:()=>PN,$isEditorIsNestedEditor:()=>J8,$lastToFirstIterator:()=>Lx,$restoreEditorState:()=>V8,$reverseDfs:()=>B8,$reverseDfsIterator:()=>kN,$splitNode:()=>aM,$unwrapAndFilterDescendants:()=>Z8,$unwrapNode:()=>n6,$wrapNodeInElement:()=>W8,CAN_USE_BEFORE_INPUT:()=>P8,CAN_USE_DOM:()=>xN,IS_ANDROID:()=>L8,IS_ANDROID_CHROME:()=>R8,IS_APPLE:()=>A8,IS_APPLE_WEBKIT:()=>E8,IS_CHROME:()=>M8,IS_FIREFOX:()=>bN,IS_IOS:()=>N8,IS_SAFARI:()=>_8,addClassNamesToElement:()=>Pu,calculateZoomLevel:()=>Y8,isBlockDomNode:()=>qM,isHTMLAnchorElement:()=>GM,isHTMLElement:()=>hg,isInlineDomNode:()=>Lu,isMimeType:()=>wN,makeStateWrapper:()=>o6,markSelection:()=>CN,mediaFileReader:()=>D8,mergeRegister:()=>Br,objectKlassEquals:()=>j8,positionNodeOnRange:()=>yN,registerNestedElementResolver:()=>$8,removeClassNamesFromElement:()=>vg,selectionAlwaysOnDisplay:()=>k8});function Tg(e,...t){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(let r of t)o.append("v",r);throw n.search=o.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var wr=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,y8=wr&&"documentMode"in document?document.documentMode:null,hN=wr&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),C8=wr&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),x8=!(!wr||!("InputEvent"in window)||y8)&&"getTargetRanges"in new window.InputEvent("input"),b8=wr&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),w8=wr&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,vN=wr&&/Android/.test(navigator.userAgent),Px=wr&&/^(?=.*Chrome).*/i.test(navigator.userAgent),S8=wr&&vN&&Px,I8=wr&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&hN&&!Px;function Ur(e){return`${e}px`}var T8={attributes:!0,characterData:!0,childList:!0,subtree:!0};function yN(e,t,n){let o=null,r=null,a=null,s=[],i=document.createElement("div");function l(){o===null&&Tg(182),r===null&&Tg(183);let{left:f,top:p}=r.getBoundingClientRect(),m=pN(e,t);var h,g;i.isConnected||(g=i,(h=r).insertBefore(g,h.firstChild));let v=!1;for(let C=0;C<m.length;C++){let y=m[C],x=s[C]||document.createElement("div"),b=x.style;b.position!=="absolute"&&(b.position="absolute",v=!0);let I=Ur(y.left-f);b.left!==I&&(b.left=I,v=!0);let T=Ur(y.top-p);b.top!==T&&(x.style.top=T,v=!0);let P=Ur(y.width);b.width!==P&&(x.style.width=P,v=!0);let k=Ur(y.height);b.height!==k&&(x.style.height=k,v=!0),x.parentNode!==i&&(i.append(x),v=!0),s[C]=x}for(;s.length>m.length;)s.pop();v&&n(s)}function d(){r=null,o=null,a!==null&&a.disconnect(),a=null,i.remove();for(let f of s)f.remove();s=[]}i.style.position="relative";let u=e.registerRootListener(function f(){let p=e.getRootElement();if(p===null)return d();let m=p.parentElement;if(!hg(m))return d();d(),o=p,r=m,a=new MutationObserver(h=>{let g=e.getRootElement(),v=g&&g.parentElement;if(g!==o||v!==r)return f();for(let C of h)if(!i.contains(C.target))return l()}),a.observe(m,T8),l()});return()=>{u(),d()}}function mN(e,t,n){if(e.type!=="text"&&qe(t)){let o=t.getDOMSlot(n);return[o.element,o.getFirstChildOffset()+e.offset]}return[$M(n)||n,e.offset]}function CN(e,t){let n=null,o=null,r=null,a=null,s=null,i=null,l=()=>{};function d(u){u.read(()=>{let f=De();if(!ke(f))return n=null,r=null,a=null,i=null,l(),void(l=()=>{});let[p,m]=(function(k){let w=k.getStartEndPoints();return k.isBackward()?[w[1],w[0]]:w})(f),h=p.getNode(),g=h.getKey(),v=p.offset,C=m.getNode(),y=C.getKey(),x=m.offset,b=e.getElementByKey(g),I=e.getElementByKey(y),T=n===null||b!==o||v!==r||g!==n.getKey(),P=a===null||I!==s||x!==i||y!==a.getKey();if((T||P)&&b!==null&&I!==null){let k=(function(w,L,R,N,A,D,q){let H=(w._window?w._window.document:document).createRange();return H.setStart(...mN(L,R,N)),H.setEnd(...mN(A,D,q)),H})(e,p,h,b,m,C,I);l(),l=yN(e,k,w=>{if(t===void 0)for(let L of w){let R=L.style;R.background!=="Highlight"&&(R.background="Highlight"),R.color!=="HighlightText"&&(R.color="HighlightText"),R.marginTop!==Ur(-1.5)&&(R.marginTop=Ur(-1.5)),R.paddingTop!==Ur(4)&&(R.paddingTop=Ur(4)),R.paddingBottom!==Ur(0)&&(R.paddingBottom=Ur(0))}else t(w)})}n=h,o=b,r=v,a=C,s=I,i=x})}return d(e.getEditorState()),Br(e.registerUpdateListener(({editorState:u})=>d(u)),()=>{l()})}function k8(e,t){let n=null,o=()=>{let r=getSelection(),a=r&&r.anchorNode,s=e.getRootElement();a!==null&&s!==null&&s.contains(a)?n!==null&&(n(),n=null):n===null&&(n=CN(e,t))};return document.addEventListener("selectionchange",o),()=>{n!==null&&n(),document.removeEventListener("selectionchange",o)}}var P8=x8,xN=wr,L8=vN,R8=S8,A8=hN,E8=I8,M8=Px,bN=C8,N8=w8,_8=b8;function wN(e,t){for(let n of t)if(e.type.startsWith(n))return!0;return!1}function D8(e,t){let n=e[Symbol.iterator]();return new Promise((o,r)=>{let a=[],s=()=>{let{done:i,value:l}=n.next();if(i)return o(a);let d=new FileReader;d.addEventListener("error",r),d.addEventListener("load",()=>{let u=d.result;typeof u=="string"&&a.push({file:l,result:u}),s()}),wN(l,t)?d.readAsDataURL(l):s()};s()})}function O8(e,t){return Array.from(SN(e,t))}function F8(e){return e?e.getAdjacentCaret():null}function B8(e,t){return Array.from(kN(e,t))}function SN(e,t){return IN("next",e,t)}function gN(e,t){let n=wi(Ca(e,t));return n&&n[0]}function IN(e,t,n){let o=Tt(),r=t||o,a=qe(r)?us(r,e):Ca(r,e),s=TN(r),i=n?nx(rx(Ca(n,e)))||gN(n,e):gN(r,e),l=s;return px({hasNext:d=>d!==null,initial:a,map:d=>({depth:l,node:d.origin}),step:d=>{if(d.isSameNodeCaret(i))return null;wu(d)&&l++;let u=wi(d);return!u||u[0].isSameNodeCaret(i)?null:(l+=u[1],u[0])}})}function U8(e){let t=wi(Ca(e,"next"));return t&&[t[0].origin,t[1]]}function TN(e){let t=-1;for(let n=e;n!==null;n=n.getParent())t++;return t}function z8(e){let t=rx(Ca(e,"previous")),n=wi(t,"root");return n&&n[0].origin}function kN(e,t){return IN("previous",e,t)}function H8(e,t){let n=e;for(;n!=null;){if(n instanceof t)return n;n=n.getParent()}return null}function K8(e){let t=ya(e,n=>qe(n)&&!n.isInline());return qe(t)||Tg(4,e.__key),t}function $8(e,t,n,o){let r=a=>a instanceof t;return e.registerNodeTransform(t,a=>{let s=(i=>{let l=i.getChildren();for(let f=0;f<l.length;f++){let p=l[f];if(r(p))return null}let d=i,u=i;for(;d!==null;)if(u=d,d=d.getParent(),r(d))return{child:u,parent:d};return null})(a);if(s!==null){let{child:i,parent:l}=s;if(i.is(a)){o(l,a);let d=i.getNextSiblings(),u=d.length;if(l.insertAfter(i),u!==0){let f=n(l);i.insertAfter(f);for(let p=0;p<u;p++)f.append(d[p])}l.canBeEmpty()||l.getChildrenSize()!==0||l.remove()}}})}function V8(e,t){let n=new Map,o=e._pendingEditorState;for(let[a,s]of t._nodeMap)n.set(a,Qm(s));o&&(o._nodeMap=n),e._dirtyType=2;let r=t._selection;xr(r===null?null:r.clone())}function q8(e){let t=De()||bu(),n;if(ke(t))n=$l(t.focus,"next");else{if(t!=null){let s=t.getNodes(),i=s[s.length-1];i&&(n=Ca(i,"next"))}n=n||us(Tt(),"previous").getFlipped().insert(Xo())}let o=PN(e,n),r=nx(o),a=wu(r)?ZE(r):o;return oM(qE(a)),e.getLatest()}function PN(e,t,n){let o=ox(t,"next");for(let r=o;r;r=rM(r,n))o=r;return Zm(o)&&Tg(283),o.insert(e.isInline()?Xo().append(e):e),ox(Ca(e.getLatest(),"next"),t.direction)}function W8(e,t){let n=t();return e.replace(n),n.append(e),n}function j8(e,t){return e!==null&&Object.getPrototypeOf(e).constructor.name===t.name}function G8(e,t){let n=[];for(let o=0;o<e.length;o++){let r=t(e[o]);r!==null&&n.push(r)}return n}function Q8(e){let t=De();if(!ke(t))return!1;let n=new Set,o=t.getNodes();for(let r=0;r<o.length;r++){let a=o[r],s=a.getKey();if(n.has(s))continue;let i=ya(a,d=>qe(d)&&!d.isInline());if(i===null)continue;let l=i.getKey();i.canIndent()&&!n.has(l)&&(n.add(l),e(i))}return n.size>0}function X8(e,t){us(e,"next").insert(t)}var kx=!(bN||!xN)&&void 0;function Y8(e,t=!1){let n=1;if((function(){if(kx===void 0){let o=document.createElement("div");o.style.cssText="position: absolute; opacity: 0; width: 100px; left: -1000px;",document.body.appendChild(o);let r=o.getBoundingClientRect();o.style.setProperty("zoom","2"),kx=o.getBoundingClientRect().width===r.width,document.body.removeChild(o)}return kx})()||t)for(;e;)n*=Number(window.getComputedStyle(e).getPropertyValue("zoom")),e=e.parentElement;return n}function J8(e){return e._parentEditor!==null}function Z8(e,t){return LN(e,t,null)}function LN(e,t,n){let o=!1;for(let r of Lx(e))t(r)?n!==null&&n(r):(o=!0,qe(r)&&LN(r,t,n||(a=>r.insertAfter(a))),r.remove());return o}function e6(e,t){let n=[],o=Array.from(e).reverse();for(let r=o.pop();r!==void 0;r=o.pop())if(t(r))n.push(r);else if(qe(r))for(let a of Lx(r))o.push(a);return n}function t6(e){return RN(us(e,"next"))}function Lx(e){return RN(us(e,"previous"))}function RN(e){return px({hasNext:JE,initial:e.getAdjacentCaret(),map:t=>t.origin.getLatest(),step:t=>t.getAdjacentCaret()})}function n6(e){nM(Ca(e,"next")).splice(1,e.getChildren())}function o6(e){let t=o=>Ym(o,e),n=(o,r)=>tg(o,e,r);return{$get:t,$set:n,accessors:[t,n],makeGetterMethod:()=>function(){return t(this)},makeSetterMethod:()=>function(o){return n(this,o)},stateConfig:e}}var Ge=Rx,ohe=Ge.$descendantsMatching,rhe=Ge.$dfs,ahe=Ge.$dfsIterator,she=Ge.$filter,ihe=Ge.$findMatchingParent,lhe=Ge.$firstToLastIterator,dhe=Ge.$getAdjacentCaret,che=Ge.$getAdjacentSiblingOrParentSiblingCaret,uhe=Ge.$getDepth,AN=Ge.$getNearestBlockElementAncestorOrThrow,fhe=Ge.$getNearestNodeOfType,phe=Ge.$getNextRightPreorderNode,mhe=Ge.$getNextSiblingOrParentSibling,EN=Ge.$handleIndentAndOutdent,ghe=Ge.$insertFirst,hhe=Ge.$insertNodeToNearestRoot,vhe=Ge.$insertNodeToNearestRootAtCaret,yhe=Ge.$isEditorIsNestedEditor,Che=Ge.$lastToFirstIterator,xhe=Ge.$restoreEditorState,bhe=Ge.$reverseDfs,whe=Ge.$reverseDfsIterator,She=Ge.$splitNode,Ihe=Ge.$unwrapAndFilterDescendants,The=Ge.$unwrapNode,khe=Ge.$wrapNodeInElement,Phe=Ge.CAN_USE_BEFORE_INPUT,Lhe=Ge.CAN_USE_DOM,Rhe=Ge.IS_ANDROID,Ahe=Ge.IS_ANDROID_CHROME,Ehe=Ge.IS_APPLE,Mhe=Ge.IS_APPLE_WEBKIT,Nhe=Ge.IS_CHROME,_he=Ge.IS_FIREFOX,Dhe=Ge.IS_IOS,Ohe=Ge.IS_SAFARI,Fhe=Ge.addClassNamesToElement,Bhe=Ge.calculateZoomLevel,Ax=Ge.isBlockDomNode,Uhe=Ge.isHTMLAnchorElement,MN=Ge.isHTMLElement,zhe=Ge.isInlineDomNode,Hhe=Ge.isMimeType,Khe=Ge.makeStateWrapper,$he=Ge.markSelection,Vhe=Ge.mediaFileReader,xa=Ge.mergeRegister,Ru=Ge.objectKlassEquals,qhe=Ge.positionNodeOnRange,Whe=Ge.registerNestedElementResolver,jhe=Ge.removeClassNamesFromElement,Ghe=Ge.selectionAlwaysOnDisplay;var Ex={};cn(Ex,{ContentEditable:()=>a6,ContentEditableElement:()=>DN});Y();var _N=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?pe:U;function r6({editor:e,ariaActiveDescendant:t,ariaAutoComplete:n,ariaControls:o,ariaDescribedBy:r,ariaErrorMessage:a,ariaExpanded:s,ariaInvalid:i,ariaLabel:l,ariaLabelledBy:d,ariaMultiline:u,ariaOwns:f,ariaRequired:p,autoCapitalize:m,className:h,id:g,role:v="textbox",spellCheck:C=!0,style:y,tabIndex:x,"data-testid":b,...I},T){let[P,k]=W(e.isEditable()),w=E(R=>{R&&R.ownerDocument&&R.ownerDocument.defaultView?e.setRootElement(R):e.setRootElement(null)},[e]),L=K(()=>(function(...R){return N=>{for(let A of R)typeof A=="function"?A(N):A!=null&&(A.current=N)}})(T,w),[w,T]);return _N(()=>(k(e.isEditable()),e.registerEditableListener(R=>{k(R)})),[e]),c("div",{"aria-activedescendant":P?t:void 0,"aria-autocomplete":P?n:"none","aria-controls":P?o:void 0,"aria-describedby":r,...a!=null?{"aria-errormessage":a}:{},"aria-expanded":P&&v==="combobox"?!!s:void 0,...i!=null?{"aria-invalid":i}:{},"aria-label":l,"aria-labelledby":d,"aria-multiline":u,"aria-owns":P?f:void 0,"aria-readonly":!P||void 0,"aria-required":p,autoCapitalize:m,className:h,contentEditable:P,"data-testid":b,id:g,ref:L,role:v,spellCheck:C,style:y,tabIndex:x,...I})}var DN=Sn(r6);function NN(e){return e.getEditorState().read(xg(e.isComposing()))}var a6=Sn(s6);function s6(e,t){let{placeholder:n,...o}=e,[r]=Jt();return S(he,{children:[c(DN,{editor:r,...o,ref:t}),n!=null&&c(i6,{editor:r,content:n})]})}function i6({content:e,editor:t}){let n=(function(s){let[i,l]=W(()=>NN(s));return _N(()=>{function d(){let u=NN(s);l(u)}return d(),xa(s.registerUpdateListener(()=>{d()}),s.registerEditableListener(()=>{d()}))},[s]),i})(t),[o,r]=W(t.isEditable());if(pe(()=>(r(t.isEditable()),t.registerEditableListener(s=>{r(s)})),[t]),!n)return null;let a=null;return typeof e=="function"?a=e(o):e!==null&&(a=e),a===null?null:c("div",{"aria-hidden":!0,children:a})}var ON=Ex,FN=ON.ContentEditable,tve=ON.ContentEditableElement;Y();var l6=ct(null),Mx={didCatch:!1,error:null},kg=class extends Vr{constructor(t){super(t),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=Mx}static getDerivedStateFromError(t){return{didCatch:!0,error:t}}resetErrorBoundary(...t){let{error:n}=this.state;n!==null&&(this.props.onReset?.({args:t,reason:"imperative-api"}),this.setState(Mx))}componentDidCatch(t,n){this.props.onError?.(t,n)}componentDidUpdate(t,n){let{didCatch:o}=this.state,{resetKeys:r}=this.props;o&&n.error!==null&&d6(t.resetKeys,r)&&(this.props.onReset?.({next:r,prev:t.resetKeys,reason:"keys"}),this.setState(Mx))}render(){let{children:t,fallbackRender:n,FallbackComponent:o,fallback:r}=this.props,{didCatch:a,error:s}=this.state,i=t;if(a){let l={error:s,resetErrorBoundary:this.resetErrorBoundary};if(typeof n=="function")i=n(l);else if(o)i=Ae(o,l);else if(r!==void 0)i=r;else throw s}return Ae(l6.Provider,{value:{didCatch:a,error:s,resetErrorBoundary:this.resetErrorBoundary}},i)}};function d6(e=[],t=[]){return e.length!==t.length||e.some((n,o)=>!Object.is(n,t[o]))}var Nx={};cn(Nx,{LexicalErrorBoundary:()=>c6});function c6({children:e,onError:t}){return c(kg,{fallback:c("div",{style:{border:"1px solid #f00",color:"#f00",padding:"8px"},children:"An error was thrown."}),onError:t,children:e})}var u6=Nx,BN=u6.LexicalErrorBoundary;var Gx={};cn(Gx,{$createHorizontalRuleNode:()=>jx,$isDecoratorTextNode:()=>JN,$isHorizontalRuleNode:()=>r_,AutoFocusExtension:()=>m6,ClearEditorExtension:()=>g6,DecoratorTextExtension:()=>b6,DecoratorTextNode:()=>Mu,EditorStateExtension:()=>Ag,HorizontalRuleExtension:()=>M6,HorizontalRuleNode:()=>ki,INSERT_HORIZONTAL_RULE_COMMAND:()=>A6,InitialStateExtension:()=>n_,LexicalBuilder:()=>Yl,NodeSelectionExtension:()=>$x,TabIndentationExtension:()=>N6,applyFormatFromStyle:()=>v6,applyFormatToDom:()=>y6,batch:()=>VN,buildEditorFromExtensions:()=>T6,computed:()=>jN,configExtension:()=>mg,declarePeerDependency:()=>KM,defineExtension:()=>un,effect:()=>ps,getExtensionDependencyFromEditor:()=>P6,getKnownTypesAndNodes:()=>h6,getPeerDependencyFromEditor:()=>o_,getPeerDependencyFromEditorOrThrow:()=>L6,namedSignals:()=>Mg,registerClearEditor:()=>XN,registerTabIndentation:()=>s_,safeCast:()=>br,shallowMergeConfig:()=>yg,signal:()=>Xl,untracked:()=>Ux,watchedSignal:()=>qx});var f6=Symbol.for("preact-signals");function Eg(){if(fs>1)return void fs--;let e,t=!1;for(;Eu!==void 0;){let n=Eu;for(Eu=void 0,zx++;n!==void 0;){let o=n.o;if(n.o=void 0,n.f&=-3,!(8&n.f)&&qN(n))try{n.c()}catch(r){t||(e=r,t=!0)}n=o}}if(zx=0,fs--,t)throw e}function VN(e){if(fs>0)return e();fs++;try{return e()}finally{Eg()}}var Nt,Eu;function Ux(e){let t=Nt;Nt=void 0;try{return e()}finally{Nt=t}}var fs=0,zx=0,Rg=0;function UN(e){if(Nt===void 0)return;let t=e.n;return t===void 0||t.t!==Nt?(t={i:0,S:e,p:Nt.s,n:void 0,t:Nt,e:void 0,x:void 0,r:t},Nt.s!==void 0&&(Nt.s.n=t),Nt.s=t,e.n=t,32&Nt.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=Nt.s,t.n=void 0,Nt.s.n=t,Nt.s=t),t):void 0}function oo(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 Xl(e,t){return new oo(e,t)}function qN(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 zN(e){for(let t=e.s;t!==void 0;t=t.n){let n=t.S.n;if(n!==void 0&&(t.r=n),t.S.n=t,t.i=-1,t.n===void 0){e.s=t;break}}}function WN(e){let t,n=e.s;for(;n!==void 0;){let o=n.p;n.i===-1?(n.S.U(n),o!==void 0&&(o.n=n.n),n.n!==void 0&&(n.n.p=o)):t=n,n.S.n=n.r,n.r!==void 0&&(n.r=void 0),n=o}e.s=t}function Ti(e,t){oo.call(this,void 0),this.x=e,this.s=void 0,this.g=Rg-1,this.f=4,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}function jN(e,t){return new Ti(e,t)}function GN(e){let t=e.u;if(e.u=void 0,typeof t=="function"){fs++;let n=Nt;Nt=void 0;try{t()}catch(o){throw e.f&=-2,e.f|=8,Vx(e),o}finally{Nt=n,Eg()}}}function Vx(e){for(let t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,GN(e)}function p6(e){if(Nt!==this)throw new Error("Out-of-order effect");WN(this),Nt=e,this.f&=-2,8&this.f&&Vx(this),Eg()}function Ql(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 ps(e,t){let n=new Ql(e,t);try{n.c()}catch(r){throw n.d(),r}let o=n.d.bind(n);return o[Symbol.dispose]=o,o}function Mg(e,t={}){let n={};for(let o in e){let r=t[o],a=Xl(r===void 0?e[o]:r);n[o]=a}return n}oo.prototype.brand=f6,oo.prototype.h=function(){return!0},oo.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:Ux(()=>{var n;(n=this.W)==null||n.call(this)}))},oo.prototype.U=function(e){if(this.t!==void 0){let t=e.e,n=e.x;t!==void 0&&(t.x=n,e.e=void 0),n!==void 0&&(n.e=t,e.x=void 0),e===this.t&&(this.t=n,n===void 0&&Ux(()=>{var o;(o=this.Z)==null||o.call(this)}))}},oo.prototype.subscribe=function(e){return ps(()=>{let t=this.value,n=Nt;Nt=void 0;try{e(t)}finally{Nt=n}},{name:"sub"})},oo.prototype.valueOf=function(){return this.value},oo.prototype.toString=function(){return this.value+""},oo.prototype.toJSON=function(){return this.value},oo.prototype.peek=function(){let e=Nt;Nt=void 0;try{return this.value}finally{Nt=e}},Object.defineProperty(oo.prototype,"value",{get(){let e=UN(this);return e!==void 0&&(e.i=this.i),this.v},set(e){if(e!==this.v){if(zx>100)throw new Error("Cycle detected");this.v=e,this.i++,Rg++,fs++;try{for(let t=this.t;t!==void 0;t=t.x)t.t.N()}finally{Eg()}}}}),Ti.prototype=new oo,Ti.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===Rg))return!0;if(this.g=Rg,this.f|=1,this.i>0&&!qN(this))return this.f&=-2,!0;let e=Nt;try{zN(this),Nt=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 Nt=e,WN(this),this.f&=-2,!0},Ti.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)}oo.prototype.S.call(this,e)},Ti.prototype.U=function(e){if(this.t!==void 0&&(oo.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)}},Ti.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(Ti.prototype,"value",{get(){if(1&this.f)throw new Error("Cycle detected");let e=UN(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}}),Ql.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()}},Ql.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,GN(this),zN(this),fs++;let e=Nt;return Nt=this,p6.bind(this,e)},Ql.prototype.N=function(){2&this.f||(this.f|=2,this.o=Eu,Eu=this)},Ql.prototype.d=function(){this.f|=8,1&this.f||Vx(this)},Ql.prototype.dispose=function(){this.d()};var m6=un({build:(e,t,n)=>Mg(t),config:br({defaultSelection:"rootEnd",disabled:!1}),name:"@lexical/extension/AutoFocus",register(e,t,n){let o=n.getOutput();return ps(()=>o.disabled.value?void 0:e.registerRootListener(r=>{e.focus(()=>{let a=document.activeElement;r===null||a!==null&&r.contains(a)||r.focus({preventScroll:!0})},{defaultSelection:o.defaultSelection.peek()})}))}});function QN(){let e=Tt(),t=De(),n=Xo();e.clear(),e.append(n),t!==null&&n.select(),ke(t)&&(t.format=0)}function XN(e,t=QN){return e.registerCommand(ng,n=>(e.update(t),!0),jt)}var g6=un({build:(e,t,n)=>Mg(t),config:br({$onClear:QN}),name:"@lexical/extension/ClearEditor",register(e,t,n){let{$onClear:o}=n.getOutput();return ps(()=>XN(e,o.value))}});function h6(e){let t=new Set,n=new Set;for(let o of YN(e)){let r=typeof o=="function"?o:o.replace;t.add(r.getType()),n.add(r)}return{nodes:n,types:t}}function YN(e){return(typeof e.nodes=="function"?e.nodes():e.nodes)||[]}var _x=HM("format",{parse:e=>typeof e=="number"?e:0}),Mu=class extends No{$config(){return this.config("decorator-text",{extends:No,stateConfigs:[{flat:!0,stateConfig:_x}]})}getFormat(){return Ym(this,_x)}getFormatFlags(t,n){return mx(this.getFormat(),t,n)}hasFormat(t){let n=FM[t];return(this.getFormat()&n)!==0}setFormat(t){return tg(this,_x,t)}toggleFormat(t){let n=this.getFormat(),o=mx(n,t,null);return this.setFormat(o)}isInline(){return!0}createDOM(){return document.createElement("span")}updateDOM(){return!1}};function JN(e){return e instanceof Mu}function v6(e,t,n){let o=t.fontWeight,r=t.textDecoration.split(" "),a=o==="700"||o==="bold",s=r.includes("line-through"),i=t.fontStyle==="italic",l=r.includes("underline"),d=t.verticalAlign;return a&&!e.hasFormat("bold")&&e.toggleFormat("bold"),s&&!e.hasFormat("strikethrough")&&e.toggleFormat("strikethrough"),i&&!e.hasFormat("italic")&&e.toggleFormat("italic"),l&&!e.hasFormat("underline")&&e.toggleFormat("underline"),d!=="sub"||e.hasFormat("subscript")||e.toggleFormat("subscript"),d!=="super"||e.hasFormat("superscript")||e.toggleFormat("superscript"),n&&!e.hasFormat(n)&&e.toggleFormat(n),e}function y6(e,t,n=x6){for(let[o,r]of Object.entries(n))e.hasFormat(r)&&(t=C6(t,o));return t}function C6(e,t){let n=document.createElement(t);return n.appendChild(e),n}var x6={b:"bold",code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"},b6=un({name:"@lexical/extension/DecoratorText",nodes:()=>[Mu],register:(e,t,n)=>e.registerCommand(yM,o=>{let r=De();if(ax(r)||ke(r))for(let a of r.getNodes())JN(a)&&a.toggleFormat(o);return!1},jl)});function qx(e,t){let n;return Xl(e(),{unwatched(){n&&(n(),n=void 0)},watched(){this.value=e(),n=t(this)}})}var Ag=un({build:e=>qx(()=>e.getEditorState(),t=>e.registerUpdateListener(n=>{t.value=n.editorState})),name:"@lexical/extension/EditorState"});function Ot(e,...t){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(let r of t)o.append("v",r);throw n.search=o.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function ZN(e,t){if(e&&t&&!Array.isArray(t)&&typeof e=="object"&&typeof t=="object"){let n=e,o=t;for(let r in o)n[r]=ZN(n[r],o[r]);return e}return t}var Wx=0,Hx=1,e_=2,Dx=3,Pg=4,Gl=5,Ox=6,Au=7;function Fx(e){return e.id===Wx}function t_(e){return e.id===e_}function w6(e){return(function(t){return t.id===Hx})(e)||Ot(305,String(e.id),String(Hx)),Object.assign(e,{id:e_})}var S6=new Set,Kx=class{builder;configs;_dependency;_peerNameSet;extension;state;_signal;constructor(t,n){this.builder=t,this.extension=n,this.configs=new Set,this.state={id:Wx}}mergeConfigs(){let t=this.extension.config||{},n=this.extension.mergeConfig?this.extension.mergeConfig.bind(this.extension):yg;for(let o of this.configs)t=n(t,o);return t}init(t){let n=this.state;t_(n)||Ot(306,String(n.id));let o={getDependency:this.getInitDependency.bind(this),getDirectDependentNames:this.getDirectDependentNames.bind(this),getPeer:this.getInitPeer.bind(this),getPeerNameSet:this.getPeerNameSet.bind(this)},r={...o,getDependency:this.getDependency.bind(this),getInitResult:this.getInitResult.bind(this),getPeer:this.getPeer.bind(this)},a=(function(i,l,d){return Object.assign(i,{config:l,id:Dx,registerState:d})})(n,this.mergeConfigs(),o),s;this.state=a,this.extension.init&&(s=this.extension.init(t,a.config,o)),this.state=(function(i,l,d){return Object.assign(i,{id:Pg,initResult:l,registerState:d})})(a,s,r)}build(t){let n=this.state,o;n.id!==Pg&&Ot(307,String(n.id),String(Gl)),this.extension.build&&(o=this.extension.build(t,n.config,n.registerState));let r={...n.registerState,getOutput:()=>o,getSignal:this.getSignal.bind(this)};this.state=(function(a,s,i){return Object.assign(a,{id:Gl,output:s,registerState:i})})(n,o,r)}register(t,n){this._signal=n;let o=this.state;o.id!==Gl&&Ot(308,String(o.id),String(Gl));let r=this.extension.register&&this.extension.register(t,o.config,o.registerState);return this.state=(function(a){return Object.assign(a,{id:Ox})})(o),()=>{let a=this.state;a.id!==Au&&Ot(309,String(o.id),String(Au)),this.state=(function(s){return Object.assign(s,{id:Gl})})(a),r&&r()}}afterRegistration(t){let n=this.state,o;return n.id!==Ox&&Ot(310,String(n.id),String(Ox)),this.extension.afterRegistration&&(o=this.extension.afterRegistration(t,n.config,n.registerState)),this.state=(function(r){return Object.assign(r,{id:Au})})(n),o}getSignal(){return this._signal===void 0&&Ot(311),this._signal}getInitResult(){this.extension.init===void 0&&Ot(312,this.extension.name);let t=this.state;return(function(n){return n.id>=Pg})(t)||Ot(313,String(t.id),String(Pg)),t.initResult}getInitPeer(t){let n=this.builder.extensionNameMap.get(t);return n?n.getExtensionInitDependency():void 0}getExtensionInitDependency(){let t=this.state;return(function(n){return n.id>=Dx})(t)||Ot(314,String(t.id),String(Dx)),{config:t.config}}getPeer(t){let n=this.builder.extensionNameMap.get(t);return n?n.getExtensionDependency():void 0}getInitDependency(t){let n=this.builder.getExtensionRep(t);return n===void 0&&Ot(315,this.extension.name,t.name),n.getExtensionInitDependency()}getDependency(t){let n=this.builder.getExtensionRep(t);return n===void 0&&Ot(315,this.extension.name,t.name),n.getExtensionDependency()}getState(){let t=this.state;return(function(n){return n.id>=Au})(t)||Ot(316,String(t.id),String(Au)),t}getDirectDependentNames(){return this.builder.incomingEdges.get(this.extension.name)||S6}getPeerNameSet(){let t=this._peerNameSet;return t||(t=new Set((this.extension.peerDependencies||[]).map(([n])=>n)),this._peerNameSet=t),t}getExtensionDependency(){if(!this._dependency){let t=this.state;(function(n){return n.id>=Gl})(t)||Ot(317,this.extension.name),this._dependency={config:t.config,init:t.initResult,output:t.output}}return this._dependency}},HN={tag:_o};function I6(){let e=Tt();e.isEmpty()&&e.append(Xo())}var n_=un({config:br({setOptions:HN,updateOptions:HN}),init:({$initialEditorState:e=I6})=>({$initialEditorState:e,initialized:!1}),afterRegistration(e,{updateOptions:t,setOptions:n},o){let r=o.getInitResult();if(!r.initialized){r.initialized=!0;let{$initialEditorState:a}=r;if(GE(a))e.setEditorState(a,n);else if(typeof a=="function")e.update(()=>{a(e)},t);else if(a&&(typeof a=="string"||typeof a=="object")){let s=e.parseEditorState(a);e.setEditorState(s,n)}}return()=>{}},name:"@lexical/extension/InitialState",nodes:[NM,pg,PM,BM,AM]}),KN=Symbol.for("@lexical/extension/LexicalBuilder");function T6(...e){return Yl.fromExtensions(e).buildEditor()}function $N(){}function k6(e){throw e}function Lg(e){return Array.isArray(e)?e:[e]}var Bx="0.41.0+prod.esm",Yl=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=Bx,this.roots=t;for(let n of t)this.addExtension(n)}static fromExtensions(t){let n=[Lg(n_)];for(let o of t)n.push(Lg(o));return new e(n)}static maybeFromEditor(t){let n=t[KN];return n&&(n.PACKAGE_VERSION!==Bx&&Ot(292,n.PACKAGE_VERSION,Bx),n instanceof e||Ot(293)),n}static fromEditor(t){let n=e.maybeFromEditor(t);return n===void 0&&Ot(294),n}constructEditor(){let{$initialEditorState:t,onError:n,...o}=this.buildCreateEditorArgs(),r=Object.assign(gg({...o,...n?{onError:a=>{n(a,r)}}:{}}),{[KN]:this});for(let a of this.sortedExtensionReps())a.build(r);return r}buildEditor(){let t=$N;function n(){try{t()}finally{t=$N}}let o=Object.assign(this.constructEditor(),{dispose:n,[Symbol.dispose]:n});return t=Br(this.registerEditor(o),()=>o.setRootElement(null)),o}hasExtensionByName(t){return this.extensionNameMap.has(t)}getExtensionRep(t){let n=this.extensionNameMap.get(t.name);if(n)return n.extension!==t&&Ot(295,t.name),n}addEdge(t,n,o){let r=this.outgoingConfigEdges.get(t);r?r.set(n,o):this.outgoingConfigEdges.set(t,new Map([[n,o]]));let a=this.incomingEdges.get(n);a?a.add(t):this.incomingEdges.set(n,new Set([t]))}addExtension(t){this._sortedExtensionReps!==void 0&&Ot(296);let n=Lg(t),[o]=n;typeof o.name!="string"&&Ot(297,typeof o.name);let r=this.extensionNameMap.get(o.name);if(r!==void 0&&r.extension!==o&&Ot(298,o.name),!r){r=new Kx(this,o),this.extensionNameMap.set(o.name,r);let a=this.conflicts.get(o.name);typeof a=="string"&&Ot(299,o.name,a);for(let s of o.conflictsWith||[])this.extensionNameMap.has(s)&&Ot(299,o.name,s),this.conflicts.set(s,o.name);for(let s of o.dependencies||[]){let i=Lg(s);this.addEdge(o.name,i[0].name,i.slice(1)),this.addExtension(i)}for(let[s,i]of o.peerDependencies||[])this.addEdge(o.name,s,i?[i]:[])}}sortedExtensionReps(){if(this._sortedExtensionReps)return this._sortedExtensionReps;let t=[],n=(o,r)=>{let a=o.state;if(t_(a))return;let s=o.extension.name;var i;Fx(a)||Ot(300,s,r||"[unknown]"),Fx(i=a)||Ot(304,String(i.id),String(Wx)),a=Object.assign(i,{id:Hx}),o.state=a;let l=this.outgoingConfigEdges.get(s);if(l)for(let d of l.keys()){let u=this.extensionNameMap.get(d);u&&n(u,s)}a=w6(a),o.state=a,t.push(o)};for(let o of this.extensionNameMap.values())Fx(o.state)&&n(o);for(let o of t)for(let[r,a]of this.outgoingConfigEdges.get(o.extension.name)||[])if(a.length>0){let s=this.extensionNameMap.get(r);if(s)for(let i of a)s.configs.add(i)}for(let[o,...r]of this.roots)if(r.length>0){let a=this.extensionNameMap.get(o.name);a===void 0&&Ot(301,o.name);for(let s of r)a.configs.add(s)}return this._sortedExtensionReps=t,this._sortedExtensionReps}registerEditor(t){let n=this.sortedExtensionReps(),o=new AbortController,r=[()=>o.abort()],a=o.signal;for(let s of n){let i=s.register(t,a);i&&r.push(i)}for(let s of n){let i=s.afterRegistration(t);i&&r.push(i)}return Br(...r)}buildCreateEditorArgs(){let t={},n=new Set,o=new Map,r=new Map,a={},s={},i=this.sortedExtensionReps();for(let u of i){let{extension:f}=u;if(f.onError!==void 0&&(t.onError=f.onError),f.disableEvents!==void 0&&(t.disableEvents=f.disableEvents),f.parentEditor!==void 0&&(t.parentEditor=f.parentEditor),f.editable!==void 0&&(t.editable=f.editable),f.namespace!==void 0&&(t.namespace=f.namespace),f.$initialEditorState!==void 0&&(t.$initialEditorState=f.$initialEditorState),f.nodes)for(let p of YN(f)){if(typeof p!="function"){let m=o.get(p.replace);m&&Ot(302,f.name,p.replace.name,m.extension.name),o.set(p.replace,u)}n.add(p)}if(f.html){if(f.html.export)for(let[p,m]of f.html.export.entries())r.set(p,m);f.html.import&&Object.assign(a,f.html.import)}f.theme&&ZN(s,f.theme)}Object.keys(s).length>0&&(t.theme=s),n.size&&(t.nodes=[...n]);let l=Object.keys(a).length>0,d=r.size>0;(l||d)&&(t.html={},l&&(t.html.import=a),d&&(t.html.export=r));for(let u of i)u.init(t);return t.onError||(t.onError=k6),t}};function P6(e,t){let n=Yl.fromEditor(e).getExtensionRep(t);return n===void 0&&Ot(303,t.name),n.getExtensionDependency()}function o_(e,t){let n=Yl.fromEditor(e).extensionNameMap.get(t);return n?n.getExtensionDependency():void 0}function L6(e,t){let n=o_(e,t);return n===void 0&&Ot(291,t),n}var R6=new Set,$x=un({build(e,t,n){let o=n.getDependency(Ag).output,r=Xl({watchedNodeKeys:new Map}),a=qx(()=>{},()=>ps(()=>{let s=a.peek(),{watchedNodeKeys:i}=r.value,l,d=!1;o.value.read(()=>{if(De())for(let[u,f]of i.entries()){if(f.size===0){i.delete(u);continue}let p=Vl(u),m=p&&p.isSelected()||!1;d=d||m!==(!!s&&s.has(u)),m&&(l=l||new Set,l.add(u))}}),!d&&l&&s&&l.size===s.size||(a.value=l)}));return{watchNodeKey:function(s){let i=jN(()=>(a.value||R6).has(s)),{watchedNodeKeys:l}=r.peek(),d=l.get(s),u=d!==void 0;return d=d||new Set,d.add(i),u||(l.set(s,d),r.value={watchedNodeKeys:l}),i}}},dependencies:[Ag],name:"@lexical/extension/NodeSelection"}),A6=zM("INSERT_HORIZONTAL_RULE_COMMAND"),ki=class e extends No{static getType(){return"horizontalrule"}static clone(t){return new e(t.__key)}static importJSON(t){return jx().updateFromJSON(t)}static importDOM(){return{hr:()=>({conversion:E6,priority:0})}}exportDOM(){return{element:document.createElement("hr")}}createDOM(t){let n=document.createElement("hr");return Pu(n,t.theme.hr),n}getTextContent(){return`
|
|
4159
|
+
`}isInline(){return!1}updateDOM(){return!1}};function E6(){return{node:jx()}}function jx(){return BE(ki)}function r_(e){return e instanceof ki}var M6=un({dependencies:[Ag,$x],name:"@lexical/extension/HorizontalRule",nodes:()=>[ki],register(e,t,n){let{watchNodeKey:o}=n.getDependency($x).output,r=Xl({nodeSelections:new Map}),a=e._config.theme.hrSelected??"selected";return Br(e.registerCommand(lM,s=>{if(jM(s.target)){let i=WE(s.target);if(r_(i))return(function(l,d=!1){let u=De(),f=l.isSelected(),p=l.getKey(),m;d&&ax(u)?m=u:(m=UE(),xr(m)),f?m.delete(p):m.add(p)})(i,s.shiftKey),!0}return!1},jl),e.registerMutationListener(ki,(s,i)=>{VN(()=>{let l=!1,{nodeSelections:d}=r.peek();for(let[u,f]of s.entries())if(f==="destroyed")d.delete(u),l=!0;else{let p=d.get(u),m=e.getElementByKey(u);p?p.domNode.value=m:(l=!0,d.set(u,{domNode:Xl(m),selectedSignal:o(u)}))}l&&(r.value={nodeSelections:d})})}),ps(()=>{let s=[];for(let{domNode:i,selectedSignal:l}of r.value.nodeSelections.values())s.push(ps(()=>{let d=i.value;d&&(l.value?Pu(d,a):vg(d,a))}));return Br(...s)}))}});function a_(e){return e.canBeEmpty()}function s_(e,t,n=a_){return Br(e.registerCommand(ug,o=>{let r=De();if(!ke(r))return!1;o.preventDefault();let a=(function(s){if(s.getNodes().filter(p=>ql(p)&&p.canIndent()).length>0)return!0;let i=s.anchor,l=s.focus,d=l.isBefore(i)?l:i,u=d.getNode(),f=AN(u);if(f.canIndent()){let p=f.getKey(),m=bi();if(m.anchor.set(p,0,"element"),m.focus.set(p,0,"element"),m=eM(m),m.anchor.is(d))return!0}return!1})(r)?o.shiftKey?LM:lx:bM;return e.dispatchCommand(a,void 0)},jt),e.registerCommand(lx,()=>{let o=typeof t=="number"?t:t?t.peek():null,r=De();if(!ke(r))return!1;let a=typeof n=="function"?n:n.peek();return EN(s=>{if(a(s)){let i=s.getIndent()+1;(!o||i<o)&&s.setIndent(i)}})},og))}var N6=un({build:(e,t,n)=>Mg(t),config:br({$canIndent:a_,disabled:!1,maxIndent:null}),name:"@lexical/extension/TabIndentation",register(e,t,n){let{disabled:o,maxIndent:r,$canIndent:a}=n.getOutput();return ps(()=>{if(!o.value)return s_(e,r,a)})}});var bt=Gx,uve=bt.$createHorizontalRuleNode,fve=bt.$isDecoratorTextNode,pve=bt.$isHorizontalRuleNode,mve=bt.AutoFocusExtension,gve=bt.ClearEditorExtension,hve=bt.DecoratorTextExtension,vve=bt.DecoratorTextNode,yve=bt.EditorStateExtension,Cve=bt.HorizontalRuleExtension,xve=bt.HorizontalRuleNode,bve=bt.INSERT_HORIZONTAL_RULE_COMMAND,wve=bt.InitialStateExtension,i_=bt.LexicalBuilder,Sve=bt.NodeSelectionExtension,Ive=bt.TabIndentationExtension,Tve=bt.applyFormatFromStyle,kve=bt.applyFormatToDom,l_=bt.batch,Pve=bt.buildEditorFromExtensions,Lve=bt.computed,Rve=bt.configExtension,Ave=bt.declarePeerDependency,Eve=bt.defineExtension,Nu=bt.effect,Mve=bt.getExtensionDependencyFromEditor,Nve=bt.getKnownTypesAndNodes,d_=bt.getPeerDependencyFromEditor,_ve=bt.getPeerDependencyFromEditorOrThrow,Ng=bt.namedSignals,Dve=bt.registerClearEditor,Ove=bt.registerTabIndentation,Fve=bt.safeCast,Bve=bt.shallowMergeConfig,Uve=bt.signal,zve=bt.untracked,Hve=bt.watchedSignal;var Qx={};cn(Qx,{HistoryExtension:()=>_g,SharedHistoryExtension:()=>O6,createEmptyHistoryState:()=>f_,registerHistory:()=>u_});function _6(e,t,n,o,r){if(e===null||n.size===0&&o.size===0&&!r)return 0;let a=t._selection,s=e._selection;if(r)return 1;if(!(ke(a)&&ke(s)&&s.isCollapsed()&&a.isCollapsed()))return 0;let i=(function(C,y,x){let b=C._nodeMap,I=[];for(let T of y){let P=b.get(T);P!==void 0&&I.push(P)}for(let[T,P]of x){if(!P)continue;let k=b.get(T);k===void 0||Su(k)||I.push(k)}return I})(t,n,o);if(i.length===0)return 0;if(i.length>1){let C=t._nodeMap,y=C.get(a.anchor.key),x=C.get(s.anchor.key);return y&&x&&!e._nodeMap.has(y.__key)&&it(y)&&y.__text.length===1&&a.anchor.offset===1?2:0}let l=i[0],d=e._nodeMap.get(l.__key);if(!it(d)||!it(l)||d.__mode!==l.__mode)return 0;let u=d.__text,f=l.__text;if(u===f)return 0;let p=a.anchor,m=s.anchor;if(p.key!==m.key||p.type!=="text")return 0;let h=p.offset,g=m.offset,v=f.length-u.length;return v===1&&g===h-1?2:v===-1&&g===h+1?3:v===-1&&g===h?4:0}function D6(e,t){let n=Date.now(),o=0,r=Date.now(),a=0,s=null;return(i,l,d,u,f,p)=>{let m=Date.now();if(p.has(cM)&&(r=n,a=o,s=i),p.has(sg))return o=0,n=m,2;p.has(dM)&&s&&(n=r,o=a,i=s);let h=_6(i,l,u,f,e.isComposing()),g=(()=>{let v=d===null||d.editor===e,C=p.has(CM);if(!C&&v&&p.has(_o))return 0;if(h===1)return 2;if(i===null)return 1;let y=l._selection;if(!(u.size>0||f.size>0))return y!==null?0:2;let x=typeof t=="number"?t:t.peek();return C===!1&&h!==0&&h===o&&m<n+x&&v||u.size===1&&(function(b,I,T){let P=I._nodeMap.get(b),k=T._nodeMap.get(b),w=I._selection,L=T._selection;return!(ke(w)&&ke(L)&&w.anchor.type==="element"&&w.focus.type==="element"&&L.anchor.type==="text"&&L.focus.type==="text"||!it(P)||!it(k)||P.__parent!==k.__parent)&&JSON.stringify(I.read(()=>P.exportJSON()))===JSON.stringify(T.read(()=>k.exportJSON()))})(Array.from(u)[0],i,l)?0:1})();return n=m,o=h,g}}function c_(e){e.undoStack=[],e.redoStack=[],e.current=null}function u_(e,t,n){let o=D6(e,n);return xa(e.registerCommand(UM,()=>((function(a,s){let i=s.redoStack,l=s.undoStack;if(l.length!==0){let d=s.current,u=l.pop();d!==null&&(i.push(d),a.dispatchCommand(Iu,!0)),l.length===0&&a.dispatchCommand(Tu,!1),s.current=u||null,u&&u.editor.setEditorState(u.editorState,{tag:sg})}})(e,t),!0),jt),e.registerCommand(EM,()=>((function(a,s){let i=s.redoStack,l=s.undoStack;if(i.length!==0){let d=s.current;d!==null&&(l.push(d),a.dispatchCommand(Tu,!0));let u=i.pop();i.length===0&&a.dispatchCommand(Iu,!1),s.current=u||null,u&&u.editor.setEditorState(u.editorState,{tag:sg})}})(e,t),!0),jt),e.registerCommand(ng,()=>(c_(t),!1),jt),e.registerCommand(iM,()=>(c_(t),e.dispatchCommand(Iu,!1),e.dispatchCommand(Tu,!1),!0),jt),e.registerUpdateListener(({editorState:a,prevEditorState:s,dirtyLeaves:i,dirtyElements:l,tags:d})=>{let u=t.current,f=t.redoStack,p=t.undoStack,m=u===null?null:u.editorState;if(u!==null&&a===m)return;let h=o(s,a,u,i,l,d);if(h===1)f.length!==0&&(t.redoStack=[],e.dispatchCommand(Iu,!1)),u!==null&&(p.push({...u}),e.dispatchCommand(Tu,!0));else if(h===2)return;t.current={editor:e,editorState:a}}))}function f_(){return{current:null,redoStack:[],undoStack:[]}}var _g=un({build:(e,{delay:t,createInitialHistoryState:n,disabled:o})=>Ng({delay:t,disabled:o,historyState:n(e)}),config:br({createInitialHistoryState:f_,delay:300,disabled:typeof window>"u"}),name:"@lexical/history/History",register:(e,t,n)=>{let o=n.getOutput();return Nu(()=>o.disabled.value?void 0:u_(e,o.historyState.value,o.delay))}}),O6=un({dependencies:[mg(_g,{createInitialHistoryState:()=>{throw new Error("SharedHistory did not inherit parent history")},disabled:!0})],name:"@lexical/history/SharedHistory",register(e,t,n){let{output:o}=n.getDependency(_g),r=(function(s){return s?d_(s,_g.name):null})(e._parentEditor);if(!r)return()=>{};let a=r.output;return Nu(()=>l_(()=>{o.delay.value=a.delay.value,o.historyState.value=a.historyState.value,o.disabled.value=a.disabled.value}))}});var Dg=Qx,Wve=Dg.HistoryExtension,jve=Dg.SharedHistoryExtension,Og=Dg.createEmptyHistoryState,p_=Dg.registerHistory;var Xx={};cn(Xx,{HistoryPlugin:()=>F6,createEmptyHistoryState:()=>Og});Y();function F6({delay:e,externalHistoryState:t}){let[n]=Jt();return(function(o,r,a=1e3){let s=K(()=>r||Og(),[r]);U(()=>p_(o,s,a),[a,o,s])})(n,t,e),null}var m_=Xx,g_=m_.HistoryPlugin,h_=m_.createEmptyHistoryState;var Yx={};cn(Yx,{OnChangePlugin:()=>U6});Y();var B6=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?pe:U;function U6({ignoreHistoryMergeTagChange:e=!0,ignoreSelectionChange:t=!1,onChange:n}){let[o]=Jt();return B6(()=>{if(n)return o.registerUpdateListener(({editorState:r,dirtyElements:a,dirtyLeaves:s,prevEditorState:i,tags:l})=>{t&&a.size===0&&s.size===0||e&&l.has(_o)||i.isEmpty()||n(r,o,l)})},[o,e,t,n]),null}var z6=Yx,v_=z6.OnChangePlugin;var Jx={};cn(Jx,{useLexicalEditable:()=>$6});Y();var H6=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?pe:U;function K6(e){return{initialValueFn:()=>e.isEditable(),subscribe:t=>e.registerEditableListener(t)}}function $6(){return(function(e){let[t]=Jt(),n=K(()=>e(t),[t,e]),[o,r]=W(()=>n.initialValueFn()),a=M(o);return H6(()=>{let{initialValueFn:s,subscribe:i}=n,l=s();return a.current!==l&&(a.current=l,r(l)),i(d=>{a.current=d,r(d)})},[n,e]),o})(K6)}var V6=Jx,y_=V6.useLexicalEditable;var Zx={};cn(Zx,{ReactProviderExtension:()=>q6});var q6=un({name:"@lexical/react/ReactProvider"});var W6=Zx,C_=W6.ReactProviderExtension;var eb={};cn(eb,{DragonExtension:()=>j6,registerDragonSupport:()=>x_});function x_(e){let t=window.location.origin,n=o=>{if(o.origin!==t)return;let r=e.getRootElement();if(document.activeElement!==r)return;let a=o.data;if(typeof a=="string"){let 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 l=i.args;if(l){let[d,u,f,p,m]=l;e.update(()=>{let h=De();if(ke(h)){let g=h.anchor,v=g.getNode(),C=0,y=0;if(it(v)&&d>=0&&u>=0&&(C=d,y=d+u,h.setTextNodeRange(v,C,v,y)),C===y&&f===""||(h.insertRawText(f),v=g.getNode()),it(v)){C=p,y=p+m;let x=v.getTextContentSize();C=C>x?x:C,y=y>x?x:y,h.setTextNodeRange(v,C,v,y)}o.stopImmediatePropagation()}})}}}}};return window.addEventListener("message",n,!0),()=>{window.removeEventListener("message",n,!0)}}var j6=un({build:(e,t,n)=>Ng(t),config:br({disabled:typeof window>"u"}),name:"@lexical/dragon",register:(e,t,n)=>Nu(()=>n.getOutput().disabled.value?void 0:x_(e))});var b_=eb,w_=b_.DragonExtension,S_=b_.registerDragonSupport;var tb={};cn(tb,{$generateHtmlFromNodes:()=>Q6,$generateNodesFromDOM:()=>G6});function G6(e,t){let n=WM(t)?t.body.childNodes:t.childNodes,o=[],r=[];for(let a of n)if(!T_.has(a.nodeName)){let s=k_(a,e,r,!1);s!==null&&(o=o.concat(s))}return(function(a){for(let s of a)s.getNextSibling()instanceof ix&&s.insertAfter(xi());for(let s of a){let i=s.getChildren();for(let l of i)s.insertBefore(l);s.remove()}})(r),o}function Q6(e,t){if(typeof document>"u"||typeof window>"u"&&global.window===void 0)throw new Error("To use $generateHtmlFromNodes in headless mode please initialize a headless browser implementation such as JSDom before calling this function.");let n=document.createElement("div"),o=Tt().getChildren();for(let r=0;r<o.length;r++)I_(e,o[r],n,t);return n.innerHTML}function I_(e,t,n,o=null){let r=o===null||t.isSelected(o),a=qe(t)&&t.excludeFromCopy("html"),s=t;o!==null&&it(t)&&(s=Ig(o,t,"clone"));let i=qe(s)?s.getChildren():[],l=VM(e,s.getType()),d;d=l&&l.exportDOM!==void 0?l.exportDOM(e,s):s.exportDOM(e);let{element:u,after:f}=d;if(!u)return!1;let p=document.createDocumentFragment();for(let m=0;m<i.length;m++){let h=i[m],g=I_(e,h,p,o);!r&&qe(t)&&g&&t.extractWithChild(h,o,"html")&&(r=!0)}if(r&&!a){if((MN(u)||fx(u))&&u.append(p),n.append(u),f){let m=f.call(s,u);m&&(fx(u)?u.replaceChildren(m):u.replaceWith(m))}}else n.append(p);return r}var T_=new Set(["STYLE","SCRIPT"]);function k_(e,t,n,o,r=new Map,a){let s=[];if(T_.has(e.nodeName))return s;let i=null,l=(function(h,g){let{nodeName:v}=h,C=g._htmlConversions.get(v.toLowerCase()),y=null;if(C!==void 0)for(let x of C){let b=x(h);b!==null&&(y===null||(y.priority||0)<=(b.priority||0))&&(y=b)}return y!==null?y.conversion:null})(e,t),d=l?l(e):null,u=null;if(d!==null){u=d.after;let h=d.node;if(i=Array.isArray(h)?h[h.length-1]:h,i!==null){for(let[,g]of r)if(i=g(i,a),!i)break;i&&s.push(...Array.isArray(h)?h:[i])}d.forChild!=null&&r.set(e.nodeName,d.forChild)}let f=e.childNodes,p=[],m=(i==null||!Si(i))&&(i!=null&&ql(i)||o);for(let h=0;h<f.length;h++)p.push(...k_(f[h],t,n,m,new Map(r),i));return u!=null&&(p=u(p)),Ax(e)&&(p=X6(e,p,m?()=>{let h=new ix;return n.push(h),h}:Xo)),i==null?p.length>0?s=s.concat(p):Ax(e)&&(function(h){return h.nextSibling==null||h.previousSibling==null?!1:Lu(h.nextSibling)&&Lu(h.previousSibling)})(e)&&(s=s.concat(xi())):qe(i)&&i.append(...p),s}function X6(e,t,n){let o=e.style.textAlign,r=[],a=[];for(let s=0;s<t.length;s++){let i=t[s];if(ql(i))o&&!i.getFormat()&&i.setFormat(o),r.push(i);else if(a.push(i),s===t.length-1||s<t.length-1&&ql(t[s+1])){let l=n();l.setFormat(o),l.append(...a),r.push(l),a=[]}}return r}var P_=tb,L_=P_.$generateHtmlFromNodes,R_=P_.$generateNodesFromDOM;var ob={};cn(ob,{$generateJSONFromSelectedNodes:()=>__,$generateNodesFromSerializedNodes:()=>D_,$getClipboardDataFromSelection:()=>F_,$getHtmlContent:()=>E_,$getLexicalContent:()=>M_,$insertDataTransferForPlainText:()=>Y6,$insertDataTransferForRichText:()=>J6,$insertGeneratedNodes:()=>nb,copyToClipboard:()=>Z6,setLexicalClipboardDataTransfer:()=>B_});function Fg(e,...t){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(let r of t)o.append("v",r);throw n.search=o.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function E_(e,t=De()){return t==null&&Fg(166),ke(t)&&t.isCollapsed()||t.getNodes().length===0?"":L_(e,t)}function M_(e,t=De()){return t==null&&Fg(166),ke(t)&&t.isCollapsed()||t.getNodes().length===0?null:JSON.stringify(__(e,t))}function Y6(e,t){let n=e.getData("text/plain")||e.getData("text/uri-list");n!=null&&t.insertRawText(n)}function J6(e,t,n){let o=e.getData("application/x-lexical-editor");if(o)try{let i=JSON.parse(o);if(i.namespace===n._config.namespace&&Array.isArray(i.nodes))return nb(n,D_(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(l){return window.trustedTypes&&window.trustedTypes.createPolicy?window.trustedTypes.createPolicy("lexical",{createHTML:d=>d}).createHTML(l):l})(r),"text/html");return nb(n,R_(n,i),t)}catch(i){console.error(i)}let s=a||e.getData("text/uri-list");if(s!=null)if(ke(t)){let i=s.split(/(\r?\n|\t)/);i[i.length-1]===""&&i.pop();for(let l=0;l<i.length;l++){let d=De();if(ke(d)){let u=i[l];u===`
|
|
4160
4160
|
`||u===`\r
|
|
4161
|
-
`?d.insertParagraph():u===" "?d.insertNodes([HE()]):d.insertText(u)}}}else t.insertRawText(s)}function nb(e,t,n){e.dispatchCommand(_M,{nodes:t,selection:n})||(n.insertNodes(t),(function(o){if(ke(o)&&o.isCollapsed()){let r=o.anchor,a=null,s=$l(r,"previous");if(s)if(Zm(s))a=s.origin;else{let i=$E(s,us(Tt(),"next").getFlipped());for(let l of i){if(it(l.origin)){a=l.origin;break}if(qe(l.origin)&&!l.origin.isInline())break}}if(a&&it(a)){let i=a.getFormat(),l=a.getStyle();o.format===i&&o.style===l||(o.format=i,o.style=l,o.dirty=!0)}}})(n))}function N_(e,t,n,o=[]){let r=t===null||n.isSelected(t),a=qe(n)&&n.excludeFromCopy("html"),s=n;t!==null&&it(s)&&(s=Ig(t,s,"clone"));let i=qe(s)?s.getChildren():[],l=(function(d){let u=d.exportJSON(),f=d.constructor;if(u.type!==f.getType()&&Fg(58,f.name),qe(d)){let p=u.children;Array.isArray(p)||Fg(59,f.name)}return u})(s);it(s)&&s.getTextContentSize()===0&&(r=!1);for(let d=0;d<i.length;d++){let u=i[d],f=N_(e,t,u,l.children);!r&&qe(n)&&f&&n.extractWithChild(u,t,"clone")&&(r=!0)}if(r&&!a)o.push(l);else if(Array.isArray(l.children))for(let d=0;d<l.children.length;d++){let u=l.children[d];o.push(u)}return r}function __(e,t){let n=[],o=Tt().getChildren();for(let r=0;r<o.length;r++)N_(e,t,o[r],n);return{namespace:e._config.namespace,nodes:n}}function D_(e){let t=[];for(let n=0;n<e.length;n++){let o=e[n],r=tM(o);it(r)&&fN(r),t.push(r)}return t}var Jl=null;async function Z6(e,t,n){if(Jl!==null)return!1;if(t!==null)return new Promise((d,u)=>{e.update(()=>{d(A_(e,t,n))})});let o=e.getRootElement(),r=e._window||window,a=r.document,s=ux(r);if(o===null||s===null)return!1;let i=a.createElement("span");i.style.cssText="position: fixed; top: -1000px;",i.append(a.createTextNode("#")),o.append(i);let l=new Range;return l.setStart(i,0),l.setEnd(i,1),s.removeAllRanges(),s.addRange(l),new Promise((d,u)=>{let f=e.registerCommand(rg,p=>(Ru(p,ClipboardEvent)&&(f(),Jl!==null&&(r.clearTimeout(Jl),Jl=null),d(A_(e,p,n))),!0),og);Jl=r.setTimeout(()=>{f(),Jl=null,d(!1)},50),a.execCommand("copy"),i.remove()})}function A_(e,t,n){if(n===void 0){let r=ux(e._window),a=De();if(!a||a.isCollapsed()||!r)return!1;let s=r.anchorNode,i=r.focusNode;if(s!==null&&i!==null&&!QM(e,s,i))return!1;n=F_(a)}t.preventDefault();let o=t.clipboardData;return o!==null&&(B_(o,n),!0)}var O_=[["text/html",E_],["application/x-lexical-editor",M_]];function F_(e=De()){let t={"text/plain":e?e.getTextContent():""};if(e){let n=Xm();for(let[o,r]of O_){let a=r(n,e);a!==null&&(t[o]=a)}}return t}function B_(e,t){for(let[n]of O_)t[n]===void 0&&e.setData(n,"");for(let n in t){let o=t[n];o!==void 0&&e.setData(n,o)}}var zr=ob,
|
|
4161
|
+
`?d.insertParagraph():u===" "?d.insertNodes([HE()]):d.insertText(u)}}}else t.insertRawText(s)}function nb(e,t,n){e.dispatchCommand(_M,{nodes:t,selection:n})||(n.insertNodes(t),(function(o){if(ke(o)&&o.isCollapsed()){let r=o.anchor,a=null,s=$l(r,"previous");if(s)if(Zm(s))a=s.origin;else{let i=$E(s,us(Tt(),"next").getFlipped());for(let l of i){if(it(l.origin)){a=l.origin;break}if(qe(l.origin)&&!l.origin.isInline())break}}if(a&&it(a)){let i=a.getFormat(),l=a.getStyle();o.format===i&&o.style===l||(o.format=i,o.style=l,o.dirty=!0)}}})(n))}function N_(e,t,n,o=[]){let r=t===null||n.isSelected(t),a=qe(n)&&n.excludeFromCopy("html"),s=n;t!==null&&it(s)&&(s=Ig(t,s,"clone"));let i=qe(s)?s.getChildren():[],l=(function(d){let u=d.exportJSON(),f=d.constructor;if(u.type!==f.getType()&&Fg(58,f.name),qe(d)){let p=u.children;Array.isArray(p)||Fg(59,f.name)}return u})(s);it(s)&&s.getTextContentSize()===0&&(r=!1);for(let d=0;d<i.length;d++){let u=i[d],f=N_(e,t,u,l.children);!r&&qe(n)&&f&&n.extractWithChild(u,t,"clone")&&(r=!0)}if(r&&!a)o.push(l);else if(Array.isArray(l.children))for(let d=0;d<l.children.length;d++){let u=l.children[d];o.push(u)}return r}function __(e,t){let n=[],o=Tt().getChildren();for(let r=0;r<o.length;r++)N_(e,t,o[r],n);return{namespace:e._config.namespace,nodes:n}}function D_(e){let t=[];for(let n=0;n<e.length;n++){let o=e[n],r=tM(o);it(r)&&fN(r),t.push(r)}return t}var Jl=null;async function Z6(e,t,n){if(Jl!==null)return!1;if(t!==null)return new Promise((d,u)=>{e.update(()=>{d(A_(e,t,n))})});let o=e.getRootElement(),r=e._window||window,a=r.document,s=ux(r);if(o===null||s===null)return!1;let i=a.createElement("span");i.style.cssText="position: fixed; top: -1000px;",i.append(a.createTextNode("#")),o.append(i);let l=new Range;return l.setStart(i,0),l.setEnd(i,1),s.removeAllRanges(),s.addRange(l),new Promise((d,u)=>{let f=e.registerCommand(rg,p=>(Ru(p,ClipboardEvent)&&(f(),Jl!==null&&(r.clearTimeout(Jl),Jl=null),d(A_(e,p,n))),!0),og);Jl=r.setTimeout(()=>{f(),Jl=null,d(!1)},50),a.execCommand("copy"),i.remove()})}function A_(e,t,n){if(n===void 0){let r=ux(e._window),a=De();if(!a||a.isCollapsed()||!r)return!1;let s=r.anchorNode,i=r.focusNode;if(s!==null&&i!==null&&!QM(e,s,i))return!1;n=F_(a)}t.preventDefault();let o=t.clipboardData;return o!==null&&(B_(o,n),!0)}var O_=[["text/html",E_],["application/x-lexical-editor",M_]];function F_(e=De()){let t={"text/plain":e?e.getTextContent():""};if(e){let n=Xm();for(let[o,r]of O_){let a=r(n,e);a!==null&&(t[o]=a)}}return t}function B_(e,t){for(let[n]of O_)t[n]===void 0&&e.setData(n,"");for(let n in t){let o=t[n];o!==void 0&&e.setData(n,o)}}var zr=ob,xye=zr.$generateJSONFromSelectedNodes,bye=zr.$generateNodesFromSerializedNodes,wye=zr.$getClipboardDataFromSelection,U_=zr.$getHtmlContent,Sye=zr.$getLexicalContent,rb=zr.$insertDataTransferForPlainText,Iye=zr.$insertDataTransferForRichText,Tye=zr.$insertGeneratedNodes,kye=zr.copyToClipboard,Pye=zr.setLexicalClipboardDataTransfer;var ab={};cn(ab,{PlainTextExtension:()=>sQ,registerPlainText:()=>K_});var Pi=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,eQ=Pi&&"documentMode"in document?document.documentMode:null,tQ=Pi&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),nQ=!(!Pi||!("InputEvent"in window)||eQ)&&"getTargetRanges"in new window.InputEvent("input"),oQ=Pi&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),z_=Pi&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,rQ=Pi&&/^(?=.*Chrome).*/i.test(navigator.userAgent),aQ=Pi&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&tQ&&!rQ;function H_(e,t){t.update(()=>{if(e!==null){let n=Ru(e,KeyboardEvent)?null:e.clipboardData,o=De();if(o!==null&&!o.isCollapsed()&&n!=null){e.preventDefault();let r=U_(t);r!==null&&n.setData("text/html",r),n.setData("text/plain",o.getTextContent())}}})}function K_(e){return xa(e.registerCommand(ag,t=>{let n=De();return!!ke(n)&&(n.deleteCharacter(t),!0)},jt),e.registerCommand(mM,t=>{let n=De();return!!ke(n)&&(n.deleteWord(t),!0)},jt),e.registerCommand(pM,t=>{let n=De();return!!ke(n)&&(n.deleteLine(t),!0)},jt),e.registerCommand(uM,t=>{let n=De();if(!ke(n))return!1;if(typeof t=="string")n.insertText(t);else{let o=t.dataTransfer;if(o!=null)rb(o,n);else{let r=t.data;r&&n.insertText(r)}}return!0},jt),e.registerCommand(MM,()=>{let t=De();return!!ke(t)&&(t.removeText(),!0)},jt),e.registerCommand(dx,t=>{let n=De();return!!ke(n)&&(n.insertLineBreak(t),!0)},jt),e.registerCommand(xM,()=>{let t=De();return!!ke(t)&&(t.insertLineBreak(),!0)},jt),e.registerCommand(ig,t=>{let n=De();if(!ke(n))return!1;let o=t,r=o.shiftKey;return!!Tx(n,!0)&&(o.preventDefault(),Ix(n,r,!0),!0)},jt),e.registerCommand(lg,t=>{let n=De();if(!ke(n))return!1;let o=t,r=o.shiftKey;return!!Tx(n,!1)&&(o.preventDefault(),Ix(n,r,!1),!0)},jt),e.registerCommand(dg,t=>{let n=De();return!!ke(n)&&(!z_||navigator.language!=="ko-KR")&&(t.preventDefault(),e.dispatchCommand(ag,!0))},jt),e.registerCommand(IM,t=>{let n=De();return!!ke(n)&&(t.preventDefault(),e.dispatchCommand(ag,!1))},jt),e.registerCommand(cg,t=>{let n=De();if(!ke(n))return!1;if(t!==null){if((z_||oQ||aQ)&&nQ)return!1;t.preventDefault()}return e.dispatchCommand(dx,!1)},jt),e.registerCommand(DM,()=>(eg(),!0),jt),e.registerCommand(rg,t=>{let n=De();return!!ke(n)&&(H_(t,e),!0)},jt),e.registerCommand(fM,t=>{let n=De();return!!ke(n)&&((function(o,r){H_(o,r),r.update(()=>{let a=De();ke(a)&&a.removeText()})})(t,e),!0)},jt),e.registerCommand(fg,t=>{let n=De();return!!ke(n)&&((function(o,r){o.preventDefault(),r.update(()=>{let a=De(),s=Ru(o,ClipboardEvent)?o.clipboardData:null;s!=null&&ke(a)&&rb(s,a)},{tag:RM})})(t,e),!0)},jt),e.registerCommand(hM,t=>{let n=De();return!!ke(n)&&(t.preventDefault(),!0)},jt),e.registerCommand(gM,t=>{let n=De();return!!ke(n)&&(t.preventDefault(),!0)},jt))}var sQ=un({conflictsWith:["@lexical/rich-text"],dependencies:[w_],name:"@lexical/plain-text",register:K_});var $_=ab,_ye=$_.PlainTextExtension,V_=$_.registerPlainText;var ib={};cn(ib,{PlainTextPlugin:()=>cQ});Y();var Bg=vd(ic(),1);function iQ(e,...t){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(let r of t)o.append("v",r);throw n.search=o.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var sb=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?pe:U;function lQ({editor:e,ErrorBoundary:t}){return(function(n,o){let[r,a]=W(()=>n.getDecorators());return sb(()=>n.registerDecoratorListener(s=>{(0,Bg.flushSync)(()=>{a(s)})}),[n]),U(()=>{a(n.getDecorators())},[n]),K(()=>{let s=[],i=Object.keys(r);for(let l=0;l<i.length;l++){let d=i[l],u=c(o,{onError:p=>n._onError(p),children:c(Ch,{fallback:null,children:r[d]})}),f=n.getElementByKey(d);f!==null&&s.push((0,Bg.createPortal)(u,f,d))}return s},[o,r,n])})(e,t)}function dQ({editor:e,ErrorBoundary:t}){return(function(n){let o=i_.maybeFromEditor(n);if(o&&o.hasExtensionByName(C_.name)){for(let r of["@lexical/plain-text","@lexical/rich-text"])o.hasExtensionByName(r)&&iQ(320,r);return!0}return!1})(e)?null:c(lQ,{editor:e,ErrorBoundary:t})}function q_(e){return e.getEditorState().read(xg(e.isComposing()))}function cQ({contentEditable:e,placeholder:t=null,ErrorBoundary:n}){let[o]=Jt();return(function(r){sb(()=>xa(V_(r),S_(r)),[r])})(o),S(he,{children:[e,c(uQ,{content:t}),c(dQ,{editor:o,ErrorBoundary:n})]})}function uQ({content:e}){let[t]=Jt(),n=(function(r){let[a,s]=W(()=>q_(r));return sb(()=>{function i(){let l=q_(r);s(l)}return i(),xa(r.registerUpdateListener(()=>{i()}),r.registerEditableListener(()=>{i()}))},[r]),a})(t),o=y_();return n?typeof e=="function"?e(o):e:null}var fQ=ib,W_=fQ.PlainTextPlugin;function pQ(e){let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t>=0?e.slice(t+1):e}function mQ(e){return e.replaceAll("\\","\\\\").replaceAll("[","\\[").replaceAll("]","\\]")}function gQ(e){return encodeURI(e).replaceAll("(","%28").replaceAll(")","%29").replaceAll("#","%23").replaceAll("?","%3F").replaceAll("\\","%5C")}function Li(e){return`[${mQ(pQ(e))}](${gQ(e)})`}Y();var hQ=new RegExp(`^(?:${Nc})?$`);function vQ(e,t){return Number.isFinite(t)?Math.max(0,Math.min(e.length,Math.floor(t))):e.length}function j_(e,t,n=ul){let o=vQ(e,t),r=e.lastIndexOf(`
|
|
4162
4162
|
`,Math.max(0,o-1))+1,a=/^\/(\S*)$/.exec(e.slice(r,o));if(a)return{kind:"slash-command",query:a[1]??"",rangeStart:r,rangeEnd:o};let s=o;for(;s>0&&!n(e[s-1]??"");)s-=1;let i=e.slice(s,o),l={query:i.slice(1),rangeStart:s,rangeEnd:o};if(i.startsWith("$"))return{kind:"skill",...l};if(i.startsWith("@"))return{kind:"path",...l};if(!i.startsWith("/"))return null;let d=o;for(;d<e.length&&!n(e[d]??"");)d+=1;return hQ.test(e.slice(s+1,d))?{kind:"slash-skill",...l}:null}var yQ=/(^|\s)@(?:"((?:\\.|[^"\\])*)"|([^\s@"]+))(?=\s)/g,CQ=512,xQ=new RegExp(`(^|\\s)\\[((?:\\\\.|[^\\]\\\\]){0,${CQ}})\\]\\(([^)\\s]+)\\)(?=\\s)`,"g"),bQ=/^[A-Za-z][A-Za-z0-9+.-]*:/,wQ=/^[A-Za-z]:[\\/]/,SQ=/^[a-z0-9][a-z0-9._-]*\/[a-z0-9][a-z0-9._-]*(?:\/[^\s@"]+)*$/;function IQ(e){let t=[];for(let n of e.matchAll(xQ)){let o=n[0],r=n[1]??"",a=(n[2]??"").replace(/\\(.)/g,"$1"),s=n[3]??"",i=s;try{i=decodeURIComponent(s)}catch{}let l=Math.max(i.lastIndexOf("/"),i.lastIndexOf("\\")),d=l>=0?i.slice(l+1):i,u=bQ.test(i)&&!wQ.test(i);if(!i||u||a!==d)continue;let f=(n.index??0)+r.length,p=f+o.length-r.length;t.push({type:"mention",value:i,source:e.slice(f,p),start:f,end:p})}for(let n of e.matchAll(yQ)){let o=n[0],r=n[1]??"",a=n[2],s=a!==void 0?a.replace(/\\(.)/g,"$1"):n[3]??"";if(!s||a===void 0&&SQ.test(s))continue;let i=(n.index??0)+r.length,l=i+o.length-r.length;t.push({type:"mention",value:s,source:e.slice(i,l),start:i,end:l})}return t}function _u(e,t={}){let n=IQ(e);for(let o of Wv(e))o.sigil!=="$"||o.end>=e.length||n.push({type:"skill",value:o.name,source:e.slice(o.start,o.end),start:o.start,end:o.end});for(let o of t.preserveTrailingFrom??[])o.end===e.length&&e.slice(o.start,o.end)===o.source&&!n.some(r=>r.type===o.type&&r.start===o.start&&r.end===o.end)&&n.push(o);return[...n].sort((o,r)=>o.start-r.start)}function TQ(e){return e.replace(/\r\n/g,`
|
|
4163
4163
|
`).replace(/^\n+|\n+$/g,"")}function kQ(e){return TQ(e.text).length>0}function G_(e){return!kQ(e)}function PQ(e,t){return e.lineStart===e.lineEnd?t("pendingContext.terminalLine",{line:e.lineStart}):t("pendingContext.terminalLines",{start:e.lineStart,end:e.lineEnd})}function Q_(e,t){return t("pendingContext.terminalLabel",{terminal:e.terminalLabel,range:PQ(e,t)})}function X_(e,t,n){return e<=n&&n<t}function Y_(e,t){if(!t)return;let n=e[e.length-1];if(n&&n.type==="text"){n.text+=t;return}e.push({type:"text",text:t})}function J_(e,t){let n=0;for(let o=0;o<e.length;o+=1)if(e[o]===jr){if(o>n&&t({type:"text",text:e.slice(n,o),promptOffset:n})===!0||t({type:"terminal-context",promptOffset:o})===!0)return!0;n=o+1}return n<e.length&&t({type:"text",text:e.slice(n),promptOffset:n})===!0}function LQ(e,t){return J_(e,n=>n.type!=="text"?!1:t(n.text,n.promptOffset))}function RQ(e,t){return LQ(e,(n,o)=>{for(let r of _u(n))if(r.type==="mention"&&t(r,o)===!0)return!0;return!1})}function AQ(e){let t=[];if(!e)return t;let n=_u(e),o=0;for(let r of n)r.start<o||(r.start>o&&Y_(t,e.slice(o,r.start)),r.type==="mention"?t.push({type:"mention",path:r.value,source:r.source}):t.push({type:"skill",name:r.value}),o=r.end);return o<e.length&&Y_(t,e.slice(o)),t}function lb(e,t,n){return!e||t>=n?!1:RQ(e,(o,r)=>{let a=r+o.start,s=r+o.end,i=a-1,l=s;return!!(i>=0&&/\s/.test(e[i]??"")&&X_(t,n,i)||l<e.length&&/\s/.test(e[l]??"")&&X_(t,n,l))})}function ba(e,t=[]){if(!e)return[];let n=[],o=0;return J_(e,r=>r.type==="text"?(n.push(...AQ(r.text)),!1):(n.push({type:"terminal-context",context:t[o]??null}),o+=1,!1)),n}function eD(e){return e.isMobileViewport?null:e.modifierKey&&e.shiftKey?e.isDraftThread?"background":null:e.shiftKey?null:e.modifierKey?"steer":"foreground"}var Z_=e=>e.type!=="text";function tD(e,t){return Number.isFinite(t)?Math.max(0,Math.min(e.length,Math.floor(t))):e.length}function db(e){return ul(e)||e===jr}function Do(e,t){let n=tD(e,t),o=ba(e);if(o.length===0)return n;let r=n,a=0;for(let s of o){if(s.type==="mention"){let l=s.source.length;if(r<=1)return a+(r===0?0:l);r-=1,a+=l;continue}if(s.type==="skill"){let l=s.name.length+1;if(r<=1)return a+(r===0?0:l);r-=1,a+=l;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 nD(e){return e.type==="text"?e.text.length:1}function oD(e,t){let n=e.reduce((o,r)=>o+nD(r),0);return Number.isFinite(t)?Math.max(0,Math.min(n,Math.floor(t))):n}function Jo(e,t){return oD(ba(e),t)}function ro(e,t){let n=tD(e,t),o=ba(e);if(o.length===0)return n;let r=n,a=0;for(let s of o){if(s.type==="mention"){let l=s.source.length;if(r===0)return a;if(r<=l)return a+1;r-=l,a+=1;continue}if(s.type==="skill"){let l=s.name.length+1;if(r===0)return a;if(r<=l)return a+1;r-=l,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 Du(e,t,n){let o=ba(e);if(!o.some(Z_))return!1;let r=oD(o,t),a=0;for(let s of o){if(Z_(s)&&(n==="left"&&r===a+1||n==="right"&&r===a))return!0;a+=nD(s)}return!1}function bo(e,t){return j_(e,t,db)}function rD(e,t,n,o){let r=Math.max(0,Math.min(e.length,t)),a=Math.max(r,Math.min(e.length,n));return{text:`${e.slice(0,r)}${o}${e.slice(a)}`,cursor:r+o.length}}function aD(e){return e.map(t=>[t.id,t.threadId,t.terminalId,t.terminalLabel,t.lineStart,t.lineEnd,t.createdAt,t.text].join("")).join("")}function sD(e){return e.map(t=>[t.name,t.displayName??"",t.shortDescription??"",t.description??"",t.path,t.scope??"",t.enabled?"1":"0"].join("")).join("")}function iD(e){let t=0;return e.getEditorState().read(()=>{let n=De();ke(n)&&!n.isCollapsed()&&(t=n.getTextContent().length)}),t}function lD(e){e.update(()=>{let t=De();ke(t)&&!t.isCollapsed()&&t.removeText()})}function Zl(e){return/mac|iphone|ipad|ipod/i.test(e)}function Ri(){let e=globalThis.crypto.getRandomValues(new Uint8Array(16));e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t="";for(let n of e)t+=n.toString(16).padStart(2,"0");return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}function cb(e){let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t===-1?e:e.slice(t+1)}function dD(e){let t=cb(e);return t.startsWith(".")&&!t.slice(1).includes(".")?"directory":t.includes(".")?"file":"directory"}Y();Y();var cD=ct(null),Ug=cD.Provider;function Lt(){let e=At(cD);if(e===null)throw new Error("Composer API has not been provided.");return e}var zg=ce(function(t){let n=Lt().pierreIcons,o=n.useSpriteReady();yd(n.ensureSprite,[n]);let r=K(()=>n.resolveForEntry(t.pathValue,t.kind),[n,t.kind,t.pathValue]);return o?c("svg",{"aria-hidden":"true","data-file-icon":r.symbolId,className:j("size-4 shrink-0",t.className),children:c("use",{href:`#${r.symbolId}`})}):t.kind==="directory"?c(Da,{className:j("size-4 shrink-0 text-icon-muted",t.className)}):c(Nd,{className:j("size-4 shrink-0 text-icon-muted",t.className)})});var uD=qo;function fD(e){return S(he,{children:[c(zg,{pathValue:e.path,kind:dD(e.path),theme:e.theme,className:ho}),c("span",{className:e.selectable?j0:vo,children:e.label})]})}function Hg(e){return c("span",{className:uD,contentEditable:!1,spellCheck:!1,"data-composer-mention-chip":"true",children:c(fD,{path:e.path,label:cb(e.path),theme:e.theme})})}function Kg(e){return S("span",{className:G0,contentEditable:!1,spellCheck:!1,"data-composer-skill-chip":"true",children:[c("span",{"aria-hidden":"true",className:ho,dangerouslySetInnerHTML:{__html:Q0}}),c("span",{className:vo,children:e.label})]})}function pD(e){let{label:t,tooltipText:n,expired:o=!1}=e;return S(ze,{children:[c(Ke,{render:S("span",{className:j(qo,o&&"border-destructive/35 bg-destructive/8 text-destructive-foreground"),"data-terminal-context-expired":o?"true":void 0,children:[c(ko,{className:j(ho,"size-icon-1",o&&"opacity-100")}),c("span",{className:vo,children:t})]})}),c(He,{side:"top",className:"max-w-80 whitespace-pre-wrap leading-tight",children:n})]})}function mD({context:e}){let{t}=ie(),n=Q_(e,t),o=G_(e),r=o?t("pendingContext.terminalExpired",{label:n}):e.text;return c(pD,{label:n,tooltipText:r,expired:o})}function EQ(e){let t=[];for(let n of e.split(/[\s:_-]+/))n.length!==0&&t.push(n.charAt(0).toUpperCase()+n.slice(1));return t.join(" ")}function MQ(e){return e.replaceAll("\\","/")}function Zo(e){let t=e.displayName?.trim();return t||EQ(e.name)}function ub(e,t){return t?e.filter(fl):[]}function gD(e,t){let n=new Set(t.map(o=>o.name.trim().toLowerCase()));return e.filter(o=>!n.has(o.name.trim().toLowerCase()))}function hD(e){let t=MQ(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"}}Y();Y();function NQ(e){return(e.comment??e.text).replace(/\s+/g," ").trim()}var ed=class e extends No{__quote;__source;static getType(){return"composer-quote"}static clone(t){return new e(t.__quote,t.__source,t.__key)}static importJSON(t){return $g(t.quote,t.source).updateFromJSON(t)}constructor(t,n,o){super(o),this.__quote=t,this.__source=n}exportJSON(){return{...super.exportJSON(),quote:this.__quote,source:this.__source,type:"composer-quote",version:1}}createDOM(){let t=document.createElement("span");return t.className=lr,t}updateDOM(){return!1}getTextContent(){return this.__source}isInline(){return!0}decorate(){return c(_Q,{nodeKey:this.getKey(),quote:this.__quote,source:this.__source})}};function $g(e,t){return cs(new ed(e,t))}function _Q(e){let{t}=ie(),[n]=Jt(),o=_r(),r=o?.data.assistantQuotes??null,[a,s]=W(!1),[i,l]=W(e.quote.comment??""),[d,u]=Pt(hp,o?.threadKey??"",null);U(()=>{d===null||d!==e.source||(u(null),l(e.quote.comment??""),s(!0))},[d,e.quote.comment,e.source,u]);let f=NQ(e.quote),p=()=>{if(s(!1),r===null)return;let m=r.withComment(e.quote,i),h=r.serialize(m);h!==null&&n.update(()=>{let g=Vl(e.nodeKey);g instanceof ed&&g.replace($g(m,h))})};return S(Ho,{open:a,onOpenChange:m=>{m&&l(e.quote.comment??""),s(m)},children:[c(Ar,{render:S("span",{className:qo,contentEditable:!1,spellCheck:!1,role:"button",tabIndex:-1,"data-composer-quote-chip":"true","aria-label":t("composer.quote.chipLabel",{text:f}),children:[c(Xr,{"aria-hidden":"true",className:ho}),c("span",{className:vo,children:f})]})}),c(Ko,{side:"top",align:"start",className:"w-96 max-w-[calc(100vw-2rem)]",children:S("div",{className:"flex flex-col gap-2",children:[c("div",{className:"line-clamp-6 whitespace-pre-wrap border-l-2 border-border ps-2 text-muted-foreground text-sm",children:e.quote.text}),c(mf,{value:i,autoFocus:!0,rows:3,placeholder:t("composer.quote.commentPlaceholder"),"aria-label":t("composer.quote.commentLabel"),onChange:m=>l(m.target.value),onKeyDown:m=>{m.key==="Enter"&&(m.metaKey||m.ctrlKey)&&(m.preventDefault(),p())}}),S("div",{className:"flex justify-end gap-2",children:[c(ee,{size:"sm",variant:"ghost",onClick:()=>s(!1),children:t("composer.cancel")}),c(ee,{size:"sm",onClick:p,disabled:r===null,children:t("composer.quote.saveComment")})]})]})})]})}var Ou=class e extends No{__reference;__source;static getType(){return"composer-thread-reference"}static clone(t){return new e(t.__reference,t.__source,t.__key)}static importJSON(t){return fb(t.reference,t.source).updateFromJSON(t)}constructor(t,n,o){super(o),this.__reference=t,this.__source=n}exportJSON(){return{...super.exportJSON(),reference:this.__reference,source:this.__source,type:"composer-thread-reference",version:1}}createDOM(){let t=document.createElement("span");return t.className=lr,t}updateDOM(){return!1}getTextContent(){return this.__source}isInline(){return!0}decorate(){return c(DQ,{title:this.__reference.title})}};function fb(e,t){return cs(new Ou(e,t))}function DQ(e){let{t}=ie();return S("span",{className:qo,contentEditable:!1,spellCheck:!1,"data-composer-thread-reference-chip":"true","aria-label":t("composer.threadReference.chipLabel",{title:e.title}),children:[c(Qr,{"aria-hidden":"true",className:ho}),c("span",{className:vo,children:e.title})]})}var pb=[ed,Ou];function mb(e){return pb.some(t=>e instanceof t)}function OQ(e){return{collect:t=>[...e.assistantQuotes.collect(t).map(n=>({start:n.start,end:n.end,createNode:()=>$g(n.quote,n.source)})),...(e.threadReferences?.collect(t)??[]).map(n=>({start:n.start,end:n.end,createNode:()=>fb(n.reference,n.source)}))].toSorted((n,o)=>n.start-o.start)}}function Fu(){let e=_r()?.data??null,t=K(()=>e===null?null:OQ(e),[e]),n=M(t);return n.current=t,n}function vD(e,t){return e.registerCommand(fg,n=>{if(!(n instanceof ClipboardEvent)||n.clipboardData===null||n.clipboardData.files.length>0)return!1;let o=n.clipboardData.getData("text/plain");if(o.length===0)return!1;let r=t.readLinkChips?.()?.collect(o)??[],a=_u(`${o}
|
|
4164
4164
|
`).filter(p=>p.type==="mention"&&p.end<=o.length&&!r.some(m=>p.start<m.end&&m.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,m)=>p.start-m.start),i=De();if(!ke(i))return!1;let l=[],d=p=>{let m=p.split(`
|
|
@@ -4172,7 +4172,7 @@ ${B.prompt}`:B.prompt,oe=Q!==G;if(oe&&(r.current=Q,d(l,Q),a.current?.syncCursor(
|
|
|
4172
4172
|
`,s=[...n.map(i=>`-${i}`),...o.map(i=>`+${i}`)];return`${r}${a}${s.join(`
|
|
4173
4173
|
`)}
|
|
4174
4174
|
`}function HF(e){if(e.length===0)return[];let t=e.split(`
|
|
4175
|
-
`);return t.at(-1)===""?t.slice(0,-1):t}function jF(e){let t=new Map;return e.map(n=>{let o=t.get(n.path)??0;return t.set(n.path,o+1),o===0?n.path:`${n.path}#${o}`})}function GF(e){return{additions:e.additions??0,deletions:e.deletions??0}}Y();Y();var
|
|
4175
|
+
`);return t.at(-1)===""?t.slice(0,-1):t}function jF(e){let t=new Map;return e.map(n=>{let o=t.get(n.path)??0;return t.set(n.path,o+1),o===0?n.path:`${n.path}#${o}`})}function GF(e){return{additions:e.additions??0,deletions:e.deletions??0}}Y();Y();var uAe=(()=>{try{return!1}catch{return!1}})(),QF=/(?=^From [a-f0-9]+ .+$)/m,lw=/(?=^diff --git)/gm;var XF=/^(---|\+\+\+)\s+([^\t\r\n]+)/,YF=/^(---|\+\+\+)\s+[ab]\/([^\t\r\n]+)/,JF=/^diff --git (?:"a\/(.+?)"|a\/(.+?)) (?:"b\/(.+?)"|b\/(.+?))$/,ZF=/^index ([0-9a-f]+)\.\.([0-9a-f]+)(?: (\d+))?$/i;var xX={hunkLineCount:50,lineHeight:20,diffHeaderHeight:44,spacing:8},fAe={...xX,hunkLineCount:1};var pAe=Object.freeze({fromStart:0,fromEnd:0});function dw(e){let t=e.length;return e.charCodeAt(t-1)===10&&(t--,e.charCodeAt(t-1)===13&&t--),e.slice(0,t)}var bX=new TextEncoder,wX=new TextDecoder("utf-8",{ignoreBOM:!0}),SX=/[\uD800-\uDFFF]/,cw=1024,cd=new Uint8Array(cw);function e2(){cd.length!==cw&&(cd=new Uint8Array(cw))}function fn(e){if(e.length===0)return e;if(SX.test(e))return JSON.parse(JSON.stringify(e));let t=e.length*3;cd.length<t&&(cd=new Uint8Array(t));let{written:n}=bX.encodeInto(e,cd);return wX.decode(cd.subarray(0,n))}function n2(e){for(let t of e.hunks){for(let n=0;n<t.hunkContent.length;n++){let o=t.hunkContent[n];if(o.type!=="change")continue;let r=TX(e,o);r!=null&&(t.hunkContent.splice(n,1,...r),n+=r.length-1)}IX(t,e)}}function IX(e,t){let{hunkContent:n}=e;for(let o=1;o<n.length;o++){let r=n[o],a=n[o-1];if(r.type!=="change"||r.additions>0&&r.deletions>0||a.type!=="context")continue;let s=r.additions>0,i=s?t.additionLines:t.deletionLines,l=s?r.additionLineIndex:r.deletionLineIndex,d=s?r.additions:r.deletions,u=i[l]??"";if(u.trim()!=="")continue;let f=!0;for(let v=1;v<d;v++)if(i[l+v]!==u){f=!1;break}if(!f)continue;let p=0;for(;p<a.lines&&t.additionLines[a.additionLineIndex+a.lines-1-p]===u;)p++;if(p===0)continue;r.additionLineIndex-=p,r.deletionLineIndex-=p;let m=r.additionLineIndex+r.additions,h=r.deletionLineIndex+r.deletions,g=n[o+1];g?.type==="context"?(g.lines+=p,g.additionLineIndex=m,g.deletionLineIndex=h):n.splice(o+1,0,{type:"context",lines:p,additionLineIndex:m,deletionLineIndex:h}),a.lines-=p,a.lines===0&&(n.splice(o-1,1),o--)}}function TX(e,t){let{deletions:n,additions:o,deletionLineIndex:r,additionLineIndex:a}=t,s=Math.min(n,o),i=Math.abs(o-n);if(s===0||i===0||s*(i+1)>4096)return null;let l=[];for(let g=0;g<n;g++)l.push(t2(e.deletionLines[r+g]??""));let d=[];for(let g=0;g<o;g++)d.push(t2(e.additionLines[a+g]??""));let u=o>n,f=0,p=-1;for(let g=0;g<=i;g++){let v=0;for(let C=0;C<s;C++)v+=PX(l[C+(u?0:g)],d[C+(u?g:0)]);g===0?p=v+s*.5:v>p&&(p=v,f=g)}if(f===0)return null;let m=[],h=(g,v,C,y)=>{(g>0||v>0)&&m.push({type:"change",deletions:g,additions:v,deletionLineIndex:C,additionLineIndex:y})};return u?(h(0,f,r,a),h(s,s,r,a+f),h(0,o-s-f,r+s,a+f+s)):(h(f,0,r,a),h(s,s,r+f,a),h(n-s-f,0,r+f+s,a+s)),m}var kX=/\s+/g;function t2(e){return e.replace(kX,"")}function PX(e,t){if(e===t)return 1;let n=Math.max(e.length,t.length),o=Math.min(e.length,t.length);if(o===0)return 0;let r=0;for(;r<o&&e[r]===t[r];)r++;let a=0;for(;a<o-r&&e[e.length-1-a]===t[t.length-1-a];)a++;return(r+a)/n}function LX(e,t,n){try{return RX(e,t,n)}finally{e2()}}function RX(e,t,n=!1){let o=BX(e),r=o?MX(e):NX(e),a,s=[];for(let i of r){if(o&&!lw.test(i)){if(a==null)a=fn(i);else{if(n)throw Error("parsePatchContent: unknown file blob");console.error("parsePatchContent: unknown file blob:",i)}continue}else if(!o&&!_X(i)){if(a==null)a=fn(i);else{if(n)throw Error("parsePatchContent: unknown file blob");console.error("parsePatchContent: unknown file blob:",i)}continue}let l=AX(i,{cacheKey:t!=null?`${t}-${s.length}`:void 0,isGitDiff:o,throwOnError:n});l!=null&&s.push(l)}return{patchMetadata:a,files:s}}function AX(e,{cacheKey:t,isGitDiff:n=lw.test(e),oldFile:o,newFile:r,throwOnError:a=!1}={}){let s=0,i=u2(e,"@@ "),l,d=o==null||r==null,u=0,f=0;for(let p of i){let m=l2(p),h=m[0];if(h==null){if(a)throw Error("parsePatchContent: invalid hunk");console.error("parsePatchContent: invalid hunk",p);continue}let g=c2(h),v=0,C=0;if(g==null||l==null){if(l!=null){if(a)throw Error("parsePatchContent: Invalid hunk");console.error("parsePatchContent: Invalid hunk",p);continue}l={name:"",type:"change",hunks:[],splitLineCount:0,unifiedLineCount:0,isPartial:d,additionLines:!d&&o!=null&&r!=null?o2(r.contents):[],deletionLines:!d&&o!=null&&r!=null?o2(o.contents):[],cacheKey:s2(t)},l.additionLines.length===1&&r?.contents===""&&(l.additionLines.length=0),l.deletionLines.length===1&&o?.contents===""&&(l.deletionLines.length=0);for(let w of m){if(w.startsWith("diff --git")){let R=w.trim().match(JF),N=R?.[1]??R?.[2],A=R?.[3]??R?.[4];if(N==null||A==null){if(a)throw Error("parsePatchContent: invalid git diff header");console.error("parsePatchContent: invalid git diff header",w);continue}l.name=fn(A.trim()),N!==A&&(l.prevName=fn(N.trim()));continue}let L=w.startsWith("---")||w.startsWith("+++")?w.match(n?YF:XF):null;if(L!=null){let[,R,N]=L;if(R==="---"&&N!=="/dev/null"){let A=fn(N.trim());l.prevName=A,l.name=A}else R==="+++"&&N!=="/dev/null"&&(l.name=fn(N.trim()))}else if(n){if(w.startsWith("new mode ")&&(l.mode=fn(w.slice(8).trim())),w.startsWith("old mode ")&&(l.prevMode=fn(w.slice(8).trim())),w.startsWith("new file mode")&&(l.type="new",l.mode=fn(w.slice(13).trim())),w.startsWith("deleted file mode")&&(l.type="deleted",l.mode=fn(w.slice(17).trim())),w.startsWith("similarity index")&&(w.startsWith("similarity index 100%")?l.type="rename-pure":l.type="rename-changed"),w.startsWith("index ")){let[,R,N,A]=w.trim().match(ZF)??[];R!=null&&(l.prevObjectId=fn(R)),N!=null&&(l.newObjectId=fn(N)),A!=null&&(l.mode=fn(A))}w.startsWith("rename from ")&&(l.prevName=fn(w.slice(12).trim())),w.startsWith("rename to ")&&(l.name=fn(w.slice(10).trim()))}}continue}let y,x;for(;m.length>0&&(m[m.length-1]===`
|
|
4176
4176
|
`||m[m.length-1]==="\r"||m[m.length-1]===`\r
|
|
4177
4177
|
`||m[m.length-1]==="");)m.pop();let{additionStart:b,deletionStart:I}=g;u=d?u:I-1,f=d?f:b-1;let T={collapsedBefore:0,splitLineCount:0,splitLineStart:0,unifiedLineCount:0,unifiedLineStart:0,additionCount:g.additionCount,additionStart:b,additionLines:v,deletionCount:g.deletionCount,deletionStart:I,deletionLines:C,deletionLineIndex:u,additionLineIndex:f,hunkContent:[],hunkContext:s2(g.hunkContext),hunkSpecs:fn(h),noEOFCRAdditions:!1,noEOFCRDeletions:!1},P=0,k=0;for(let w=1;w<m.length;w++){let L=m[w];if(P>=T.additionCount&&k>=T.deletionCount&&!L.startsWith("\\")){if(a&&DX(L)&&!OX(L))throw Error("parsePatchContent: hunk has more lines than expected");break}let R=L[0];if(R!=="+"&&R!=="-"&&R!==" "&&R!=="\\"){if(a)throw Error("parsePatchContent: invalid hunk line");console.error(`parseLineType: Invalid firstChar: "${R}", full line: "${L}"`),console.error("processFile: invalid rawLine:",L);continue}let N=UX(R);if(N==="addition"){if(a&&P>=T.additionCount)throw Error("parsePatchContent: hunk has too many addition lines");let A=uw(L);(y==null||y.type!=="change")&&(y=fw("change",u,f),T.hunkContent.push(y)),f++,P++,d&&l.additionLines.push(A),y.additions++,v++,x="addition"}else if(N==="deletion"){if(a&&k>=T.deletionCount)throw Error("parsePatchContent: hunk has too many deletion lines");let A=uw(L);(y==null||y.type!=="change")&&(y=fw("change",u,f),T.hunkContent.push(y)),u++,k++,d&&l.deletionLines.push(A),y.deletions++,C++,x="deletion"}else if(N==="context"){if(a&&(k>=T.deletionCount||P>=T.additionCount))throw Error("parsePatchContent: hunk has too many context lines");let A=uw(L);(y==null||y.type!=="context")&&(y=fw("context",u,f),T.hunkContent.push(y)),f++,u++,P++,k++,d&&(l.deletionLines.push(A),l.additionLines.push(A)),y.lines++,x="context"}else if(N==="metadata"&&y!=null){if(y.type==="context"?(T.noEOFCRAdditions=!0,T.noEOFCRDeletions=!0):x==="deletion"?T.noEOFCRDeletions=!0:x==="addition"&&(T.noEOFCRAdditions=!0),d&&(x==="addition"||x==="context")){let A=l.additionLines.length-1;A>=0&&(l.additionLines[A]=dw(l.additionLines[A]))}if(d&&(x==="deletion"||x==="context")){let A=l.deletionLines.length-1;A>=0&&(l.deletionLines[A]=dw(l.deletionLines[A]))}}}if(a&&(P!==T.additionCount||k!==T.deletionCount))throw Error("parsePatchContent: hunk line count mismatch");T.additionLines=v,T.deletionLines=C,T.collapsedBefore=Math.max(T.additionStart-1-s,0),l.hunks.push(T),s=T.additionStart+T.additionCount-1;for(let w of T.hunkContent)w.type==="context"?(T.splitLineCount+=w.lines,T.unifiedLineCount+=w.lines):(T.splitLineCount+=Math.max(w.additions,w.deletions),T.unifiedLineCount+=w.deletions+w.additions);T.splitLineStart=l.splitLineCount+T.collapsedBefore,T.unifiedLineStart=l.unifiedLineCount+T.collapsedBefore,l.splitLineCount+=T.collapsedBefore+T.splitLineCount,l.unifiedLineCount+=T.collapsedBefore+T.unifiedLineCount}if(l!=null){if(a&&d&&!n&&l.hunks.length===0)throw Error("parsePatchContent: unified file has no hunks");if(l.hunks.length>0&&!d&&l.additionLines.length>0&&l.deletionLines.length>0){let p=l.hunks[l.hunks.length-1],m=p.additionStart+p.additionCount-1,h=l.additionLines.length,g=Math.max(h-m,0);l.splitLineCount+=g,l.unifiedLineCount+=g}return n||(l.prevName!=null&&l.name!==l.prevName?l.hunks.length>0?l.type="rename-changed":l.type="rename-pure":(o==null||o.contents==="")&&r!=null&&r.contents!==""?l.type="new":o!=null&&o.contents!==""&&(r==null||r.contents==="")&&(l.type="deleted")),l.type!=="rename-pure"&&l.type!=="rename-changed"&&(l.prevName=void 0),n2(l),l}}function i2(e,t,n=!1){let o=[],r=EX(e)?e.split(QF):[e];for(let a of r)try{o.push(LX(a,t!=null?`${t}-${o.length}`:void 0,n))}catch(s){if(n)throw s;console.error(s)}return o}function EX(e){return e.startsWith("From ")||e.includes(`
|
|
4178
4178
|
From `)}function o2(e){let t=l2(e);for(let n=0;n<t.length;n++)t[n]=fn(t[n]);return t}function l2(e){if(e.length===0)return[""];let t=[],n=0;for(;;){let o=e.indexOf(`
|
|
@@ -4185,4 +4185,4 @@ From `)}function o2(e){let t=l2(e);for(let n=0;n<t.length;n++)t[n]=fn(t[n]);retu
|
|
|
4185
4185
|
diff --git`)}function u2(e,t){if(e.length===0)return[""];let n=`
|
|
4186
4186
|
${t}`,o=e.startsWith(t)?0:a2(e,n,0);if(o===-1)return[e];let r=[];o>0&&r.push(e.slice(0,o));let a=o;for(;;){let s=a2(e,n,a+1);if(s===-1)break;r.push(e.slice(a,s)),a=s}return r.push(e.slice(a)),r}function a2(e,t,n){let o=e.indexOf(t,n);return o===-1?-1:o+1}function s2(e){return e==null?e:fn(e)}function UX(e){return e===" "?"context":e==="\\"?"metadata":e==="+"?"addition":"deletion"}function uw(e){let t=e.slice(1);return fn(t===""?`
|
|
4187
4187
|
`:t)}function fw(e,t,n){return e==="change"?{type:"change",additions:0,deletions:0,additionLineIndex:n,deletionLineIndex:t}:{type:"context",lines:0,additionLineIndex:n,deletionLineIndex:t}}var f2={light:"vscode-light-modern",dark:"vscode-dark-modern"};function m2(e){return e==="dark"?f2.dark:f2.light}var g2=2166136261,h2=16777619,zX=2654435769,HX=2246822507;function p2(e,t=g2,n=h2){let o=t>>>0;for(let r=0;r<e.length;r+=1)o^=e.charCodeAt(r),o=Math.imul(o,n)>>>0;return o>>>0}function KX(e,t="diff-panel"){let n=e.trim(),o=p2(n,g2,h2).toString(36),r=p2(n,zX,HX).toString(36);return`${t}:${n.length}:${o}:${r}`}function mw(e){if(!e.isPartial)return e;let t=0,n=0,o=e.hunks.map(r=>{let a={...r,splitLineStart:t,unifiedLineStart:n};return t+=r.splitLineCount,n+=r.unifiedLineCount,a});return{...e,hunks:o,splitLineCount:t,unifiedLineCount:n,...e.cacheKey?{cacheKey:`${e.cacheKey}:compact-partial`}:{}}}function v2(e,t="diff-panel",n={}){if(!e)return null;let o=e.trim();if(o.length===0)return null;try{let a=i2(o,KX(o,t)).flatMap(s=>n.compactPartialHunkOffsets?s.files.map(mw):s.files);return a.length>0?{kind:"files",files:a}:{kind:"raw",text:o,reason:"Unsupported diff format. Showing raw patch."}}catch{return{kind:"raw",text:o,reason:"Failed to parse patch. Showing raw patch."}}}function y2(e){let t=e.cacheKey;return t?t.endsWith(":hydrated")?t.slice(0,-9):t:`${e.prevName??"none"}:${e.name}`}function C2({fileChange:e,onOpenDiff:t}){let{t:n}=ie(),[o,r]=W(!1),a=K(()=>WF(e),[e]),s=GF(e);return S("div",{className:"min-w-0",children:[S("div",{className:"flex min-w-0 flex-wrap items-center gap-1",children:[c("span",{className:"min-w-0 shrink truncate font-mono text-[11px] text-foreground/85",children:e.path}),c("span",{className:"shrink-0 font-mono text-[10px] text-muted-foreground tabular-nums",children:n("approval.diff.stat",{additions:s.additions,deletions:s.deletions})}),a===null?c("span",{className:"text-[11px] text-muted-foreground",children:e.omitted==="too-large"?n("approval.diff.tooLarge"):n("approval.diff.unavailable")}):S(ee,{size:"micro",variant:"ghost-muted",className:"font-normal","aria-expanded":o,onClick:()=>r(i=>!i),children:[o?c(tn,{className:"size-3 shrink-0"}):c(co,{className:"size-3 shrink-0"}),c("span",{children:n(o?"approval.diff.hide":"approval.diff.show")})]}),t?c(ee,{size:"micro",variant:"ghost-muted",className:"font-normal",onClick:()=>t(e.path),children:n("approval.diff.open")}):null]}),o&&a!==null?c($X,{path:e.path,unifiedDiff:a}):null]})}function $X({path:e,unifiedDiff:t}){let n=Lt().theme.useResolvedTheme(),o=K(()=>{let r=v2(t,`approval:${n}`,{compactPartialHunkOffsets:!0});return r?.kind==="files"?r.files.map(a=>({id:y2(mw(a)),type:"diff",fileDiff:a,collapsed:!1})):[]},[n,t]);return o.length===0?c("pre",{"aria-label":e,className:"mt-1 max-h-56 overflow-auto rounded-md border border-border/60 bg-background/60 p-2 font-mono text-[11px] leading-relaxed text-muted-foreground/90 [scrollbar-width:thin]",tabIndex:0,children:t}):c("div",{className:"mt-1 overflow-hidden rounded-md border border-border/60",children:c(bS,{className:"max-h-56 overflow-auto [scrollbar-gutter:stable]",items:o,options:{diffStyle:"unified",lineDiffType:"none",overflow:"wrap",theme:m2(n),themeType:n,stickyHeaders:!1}})})}var VX="block max-h-20 min-w-0 overflow-auto whitespace-pre font-mono text-[11px] text-foreground/85 [scrollbar-width:thin] [&::-webkit-scrollbar]:h-1.5",x2=ce(function({approval:t,pendingCount:n,onOpenDiff:o,actions:r,className:a}){let{t:s}=ie(),i=KF(t),{body:l}=i,d=jF(i.fileChanges);return c(Af,{state:"pending",className:a,title:$F(i,s),meta:n>1?`1/${n}`:void 0,actions:r,children:S("div",{"aria-label":VF(i.kind,s),className:"flex min-w-0 flex-col gap-1",role:"group",children:[l.shape==="none"?null:c("code",{"aria-label":qF(l.shape,s),className:j(VX,l.shape==="path"||l.shape==="url"?"truncate":null),"data-approval-detail":"complete",tabIndex:0,children:l.shape==="command"?l.command:l.shape==="path"?l.path:l.shape==="url"?l.url:l.shape==="query"?l.query:l.text}),i.description===null?null:c("span",{className:"min-w-0 text-[11px] text-muted-foreground",children:i.description}),i.fileChanges.map((u,f)=>c(C2,{fileChange:u,onOpenDiff:o},d[f])),i.args.length===0?null:S("details",{className:"min-w-0","data-approval-args":"true",children:[c("summary",{className:"cursor-pointer text-[11px] text-muted-foreground",children:s("approval.body.detailsSummary")}),c("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 border border-border/60 bg-background/60 p-2 text-[11px] [scrollbar-width:thin]",tabIndex:0,children:i.args.map(u=>S("div",{className:"col-span-2 grid grid-cols-subgrid",children:[c("dt",{className:"font-mono text-muted-foreground",children:u.name}),c("dd",{className:"min-w-0 font-mono whitespace-pre-wrap wrap-break-word text-foreground/85",children:u.value})]},u.name))})]})]})})});var gw=ce(function(t){return c(x2,{...t})});Y();var hw=ce(function(t){let{t:n}=ie(),[o,r]=W(!1),[a,s]=W(!1),i=t.decision,l=i.requestId;if(l===null)return null;let d=f=>f.key===void 0?f.text:n(f.key,{...f.params,defaultValue:f.text}),u=i.askedBy.kind==="plugin"?i.askedBy.pluginId:null;return S("div",{className:j("flex min-w-0 flex-col gap-1 px-3 py-1.5 sm:px-4",t.className),"data-composer-pending-decision":"true",children:[S("div",{className:"flex min-w-0 items-baseline gap-2",children:[c("span",{className:"min-w-0 flex-1 truncate text-[11px] font-medium text-foreground",children:d(i.title)}),u===null?null:c("span",{className:"shrink-0 font-mono text-[10px] text-muted-foreground",children:u})]}),i.body.map((f,p)=>c("span",{className:"min-w-0 text-[11px] text-muted-foreground",children:d(f)},`${String(p)}:${f.key??f.text}`)),i.detail===null?null:c("button",{type:"button",className:"min-w-0 truncate text-left font-mono text-[11px] text-muted-foreground",onClick:()=>r(f=>!f),children:o?i.detail.text.slice(0,4e3):i.detail.text.split(`
|
|
4188
|
-
`)[0]}),c("div",{className:"flex min-w-0 flex-wrap items-center gap-1 pt-0.5",children:i.options.map(f=>c(ee,{size:"xs",variant:f.tone==="primary"?"default":f.tone==="danger"?"destructive":"outline",disabled:a,onClick:()=>{s(!0),t.onRespond(l,f.id)},children:d(f.label)},f.id))})]})});function qX(e){if(typeof e!="string")return null;let t=e.trim();return t.length>0?t:null}function vw(e,t){if(t?.attachmentsBlocked)return null;let n=qX(t?.customAnswer);if(e.allowFreeform!==!1&&n)return n;let o=Tb(e,t?.selectedOptionLabels),r=e.allowFreeform!==!1&&(t?.attachmentCount??0)>0;return e.multiSelect?o.length>0?o:r?"":null:o[0]??(r?"":null)}function WX(e,t){let n={};for(let o of e){let r=vw(o,t[o.id]);if(r===null)return null;n[o.id]=r}return n}function jX(e,t){return e.reduce((n,o)=>vw(o,t[o.id])!==null?n+1:n,0)}function b2(e,t,n){let o=e.length===0?0:Math.max(0,Math.min(n,e.length-1)),r=e[o]??null,a=r?t[r.id]:void 0,s=r?vw(r,a):null,i=r?.allowFreeform===!1?"":a?.customAnswer??"",l=jX(e,t),d=e.length===0?!0:o>=e.length-1;return{questionIndex:o,activeQuestion:r,activeDraft:a,selectedOptionLabels:r?Tb(r,a?.selectedOptionLabels):[],customAnswer:i,resolvedAnswer:s,usingCustomAnswer:i.trim().length>0,answeredQuestionCount:l,isLastQuestion:d,isComplete:WX(e,t)!==null,canAdvance:s!==null}}var GX={approve:{label:"pendingUserInput.planApprove",description:"pendingUserInput.planApproveHint"},revise:{label:"pendingUserInput.planRevise",description:"pendingUserInput.planReviseHint"},stop:{label:"pendingUserInput.planStop",description:"pendingUserInput.planStopHint"}};function w2(e,t,n){let o=t.kind==="plan"&&n.planAction!==void 0?GX[n.planAction]:void 0;return o===void 0?{label:n.label,description:n.description??""}:{label:e(o.label),description:e(o.description)}}Y();var S2=ce(function({pendingUserInputs:t,respondingRequestIds:n,answers:o,questionIndex:r,onToggleOption:a,onAdvance:s}){if(t.length===0)return null;let i=t[0];return i?c(QX,{prompt:i,isResponding:n.includes(i.requestId),answers:o,questionIndex:r,onToggleOption:a,onAdvance:s},i.requestId):null}),QX=ce(function({prompt:t,isResponding:n,answers:o,questionIndex:r,onToggleOption:a,onAdvance:s}){let{t:i}=ie(),l=Lt(),d=b2(t.questions,o,r),u=d.activeQuestion,f=M(null),p=M(s),[m,h]=W(null),[g,v]=W(null),C=g!==null&&g===u?.id;U(()=>{p.current=s},[s]),U(()=>{if(!(!u||u.multiSelect||!m)){if(m.questionId!==u.id){h(null);return}d.customAnswer.trim().length===0&&d.selectedOptionLabels.includes(m.optionLabel)&&h(null)}},[u,m,d.customAnswer,d.selectedOptionLabels]),U(()=>()=>{f.current!==null&&window.clearTimeout(f.current)},[]);let y=E((T,P)=>{if(u?.multiSelect){a(T,P);return}h({questionId:T,optionLabel:P}),a(T,P),f.current!==null&&window.clearTimeout(f.current),f.current=window.setTimeout(()=>{f.current=null,p.current()},200)},[u,a]);if(l.pane.useKeydown(T=>{if(!u||n||C||T.metaKey||T.ctrlKey||T.altKey||T.isComposing||T.keyCode===229||Qa(T.target))return;let P=sy(T.key,u.options.length);if(P===null)return;let k=u.options[P];k&&(T.preventDefault(),y(u.id,sd(k)))},{target:"document"}),!u)return null;let x=d.customAnswer.trim().length>0,b=m?.questionId===u.id?m.optionLabel:null,I=b!==null?[b]:x?[]:d.selectedOptionLabels;return S(Af,{state:"pending",className:"px-3 py-2 sm:px-4",title:u.header,meta:t.questions.length>1?`${r+1}/${t.questions.length}`:void 0,collapse:{collapsed:C,onCollapsedChange:T=>{v(T?u.id:null)},hint:u.question,toggleLabel:i(C?"pendingUserInput.showQuestion":"pendingUserInput.hideQuestion")},children:[c("div",{className:"max-h-[min(45vh,28rem)] overflow-y-auto overscroll-contain break-words text-chat text-foreground","data-pending-user-input-body":u.kind??"question",tabIndex:0,children:u.kind==="plan"?c(Xn,{text:u.question,cwd:void 0,isStreaming:!1}):c("p",{className:"whitespace-pre-wrap font-medium",children:u.question})}),u.multiSelect?c("p",{className:"text-chat-row text-muted-foreground",children:i("pendingUserInput.selectOneOrMore")}):null,c(gS,{mode:u.multiSelect?"multiple":"single","aria-label":u.header,disabled:n,selected:I,onToggle:T=>{y(u.id,T)},onReselect:T=>{y(u.id,T)},options:u.options.map((T,P)=>{let k=w2(i,u,T);return{value:sd(T),label:k.label,...k.description&&k.description!==k.label?{description:k.description}:{},...P<9?{trailing:c(Ji,{children:P+1})}:{}}})},u.id)]})});Y();var I2=ce(function({planTitle:t}){let{t:n}=ie();return c("div",{className:"px-3 py-2 sm:px-4",children:S("div",{className:"flex flex-wrap items-center gap-2",children:[c("span",{className:"text-xs font-medium text-muted-foreground",children:n("plan.ready")}),t?c("span",{className:"min-w-0 flex-1 truncate text-xs text-foreground/85",children:t}):null]})})});function T2(e){if(e.occupant.kind!=="approval")return null;let{approval:t}=e.occupant;return c(BF,{requestId:t.requestId,isResponding:e.respondingRequestIds.includes(t.requestId),options:t.options,keybindings:e.keybindings,declineReasonRelay:t.declineReasonRelay,onRespondToApproval:e.onRespondToApproval})}function k2(e){return e.occupant.kind!=="user-input"?null:c(S2,{pendingUserInputs:[e.occupant.userInput],respondingRequestIds:e.respondingRequestIds,answers:e.activePendingDraftAnswers,questionIndex:e.activePendingQuestionIndex,onToggleOption:e.onSelectActivePendingUserInputOption,onAdvance:e.onAdvanceActivePendingUserInput})}var P2={approval:{expanded:e=>e.occupant.kind!=="approval"?null:c(gw,{approval:e.occupant.approval,pendingCount:e.occupant.pendingCount,actions:T2(e),className:"px-3 py-2 sm:px-4"}),collapsed:e=>e.occupant.kind!=="approval"?null:c("div",{"data-chat-composer-collapsed-controls":"true",children:c(gw,{approval:e.occupant.approval,pendingCount:e.occupant.pendingCount,actions:T2(e),className:"px-3 pt-2 pb-3 sm:px-4"})})},decision:{expanded:e=>e.occupant.kind!=="decision"?null:c(hw,{decision:e.occupant.decision.card,onRespond:e.onRespondToDecision}),collapsed:e=>e.occupant.kind!=="decision"?null:c("div",{"data-chat-composer-collapsed-controls":"true",children:c(hw,{decision:e.occupant.decision.card,onRespond:e.onRespondToDecision,className:"pt-2 pb-3"})})},"user-input":{expanded:k2,collapsed:e=>S("div",{"data-chat-composer-collapsed-controls":"true",children:[k2(e),e.collapsedPendingRow]})},"plan-follow-up":{expanded:e=>e.activeProposedPlan===null?null:c(I2,{planTitle:FF(e.activeProposedPlan.planMarkdown)??null},e.activeProposedPlan.id),collapsed:null}};function L2(e,t){let n=P2[e.occupant.kind],o=t?n.collapsed:n.expanded;return o===null?null:o(e)}var xEe=Object.keys(P2);function R2(e){let{composerOccupant:t,showComposerTopDrawer:n,hasBlockingComposerTopDrawer:o,isTasksDrawerOpen:r,isComposerCollapsedMobile:a,respondingRequestIds:s,keybindings:i,onRespondToApproval:l,onRespondToDecision:d,activePendingDraftAnswers:u,activePendingQuestionIndex:f,onSelectActivePendingUserInputOption:p,onAdvanceActivePendingUserInput:m,activeProposedPlan:h,activePendingProgress:g,isPendingUserInputChoiceOnly:v,expandMobileComposer:C,badges:y,pendingPrimaryAction:x,isSendBusy:b,sendDisabledReason:I,environmentUnavailable:T,noProviderAvailable:P,projectSelectionRequired:k,previousUserInputQuestion:w,handleInterruptPrimaryAction:L,handleImplementPlanInNewThreadPrimaryAction:R}=e,{inlineTasksBadge:N,inlineStashBadge:A,visibleTasksProgress:D,visibleTaskSteps:q,dismissTasks:H,toggleTasksDrawer:F}=y;return S(he,{children:[n&&(!r||o)?c("div",{className:"chat-composer-top-drawer","data-chat-composer-top-drawer":"true","data-variant":t?.kind==="approval"?"warning":"info","data-occupant":t?.kind??"none",children:t===null?null:L2({occupant:t,respondingRequestIds:s,keybindings:i,onRespondToApproval:l,onRespondToDecision:d,activePendingDraftAnswers:u,activePendingQuestionIndex:f,onSelectActivePendingUserInputOption:p,onAdvanceActivePendingUserInput:m,activeProposedPlan:h,collapsedPendingRow:c(OF,{activePendingProgress:g,isPendingUserInputChoiceOnly:v,expandMobileComposer:C,inlineTasksBadge:N,inlineStashBadge:A,pendingPrimaryAction:x,isSendBusy:b,sendDisabledReason:I,isEnvironmentUnavailable:T!==null||P||k,onPreviousActivePendingUserInputQuestion:w,handleInterruptPrimaryAction:L,handleImplementPlanInNewThreadPrimaryAction:R})},a)}):null,r&&!o&&D&&q?c(U1,{onDismiss:H,onCollapse:F,progress:D,steps:q}):null]})}function A2(e,t){return{images:e.images,terminalContexts:e.terminalContexts,elementContexts:e.elementContexts,previewAnnotations:e.previewAnnotations,reviewComments:e.reviewComments,nonPersistedImageIds:e.nonPersistedImageIds,activeProvider:e.activeProvider,nativeModeByProvider:e.nativeModeByProvider,selectedPluginActionKey:e.selectedPluginActionKey,promptHasText:e.prompt.trim().length>0,hasSendableContent:t({prompt:e.prompt,imageCount:e.images.length,terminalContexts:e.terminalContexts,elementContextCount:e.elementContexts.length+e.previewAnnotations.length+e.reviewComments.length}).hasSendableContent}}function E2(e){let t=e.draft.useStore;return{setComposerDraftPrompt:t(n=>n.setPrompt),setComposerDraftNativeMode:t(n=>n.setNativeMode),addComposerDraftImage:t(n=>n.addImage),addComposerDraftImages:t(n=>n.addImages),removeComposerDraftImage:t(n=>n.removeImage),insertComposerDraftTerminalContext:t(n=>n.insertTerminalContext),removeComposerDraftElementContext:t(n=>n.removeElementContext),removeComposerDraftPreviewAnnotation:t(n=>n.removePreviewAnnotation),removeComposerDraftReviewComment:t(n=>n.removeReviewComment),clearComposerDraftPromptAndImages:t(n=>n.clearComposerPromptAndImages)}}Y();function M2(e){let{onComposerPaste:t,submitComposer:n,exitShellCommandMode:o}=e,r=M({onComposerPaste:t,submitComposer:n,exitShellCommandMode:o});r.current={onComposerPaste:t,submitComposer:n,exitShellCommandMode:o};let a=E(l=>{r.current.onComposerPaste(l)},[]),s=E((l,d)=>{r.current.submitComposer(l,d)},[]),i=E(()=>r.current.exitShellCommandMode(),[]);return{handleComposerPaste:a,handleComposerSubmit:s,handleUnclaimedEscape:i}}Y();var N2=ct(null);function _2({children:e}){let{data:t,target:n,threadKey:o}=yo(),r=t.useComposerStatus({target:n,threadKey:o});return c(N2.Provider,{value:r,children:e})}function D2(){let e=At(N2);if(e===null)throw new Error("Composer status has not been provided.");return e}var O2=ce(function(t){let n=YD(),{data:o,target:r,threadKey:a}=yo(),{activePendingApproval:s,pendingUserInputs:i,activePendingProgress:l,activePendingResolvedAnswers:d,activePendingIsResponding:u,activePendingDraftAnswers:f,activePendingQuestionIndex:p,questionAttachmentsSupported:m,respondingRequestIds:h,occupants:g,respondToApproval:v,respondToDecision:C,selectUserInputOption:y,changeUserInputCustomAnswer:x,advanceUserInput:b,previousUserInputQuestion:I}=o.useComposerPending({target:r,threadKey:a}),{runtimeMode:T,interactionMode:P,lockedProvider:k,providerStatuses:w,activeProjectDefaultModelSelection:L,projectId:R,activeThreadModelSelection:N}=o.useComposerModelContext(r),{activeThreadId:A,activeThread:D,isLocalDraftThread:q,projectSelectionRequired:H,phase:F,isSendBusy:V,sendDisabledReason:_,unavailableAgentInstanceId:z=null,noAgentChosen:Ce=!1,isPreparingWorktree:B,worktreeSetup:ae=null,environmentUnavailable:X,compactDisabled:G,compactDisabledReason:Q}=D2(),{t:oe}=ie(),{composerDraftTarget:de,environmentId:J,attachmentUploadsCapabilityKnown:se,supportsAttachmentUploads:Te,routeKind:Me,routeThreadRef:xe,draftId:Re,forceExpandedOnMobile:Ze,settings:Z,keybindings:re,terminalOpen:te,gitCwd:ue,promptRef:ve,composerRef:$e,composerImagesRef:et,composerTerminalContextsRef:ut,composerElementContextsRef:rt,sendContextRef:Xt,onSend:tt,onInterrupt:pt,interruptArmed:ft=!1,onCompactContext:Ct,onImplementPlanInNewThread:Gt,onProviderInstanceSelect:zt,onModelSelectionChosen:ln,handleRuntimeModeChange:on,handleInteractionModeChange:Ft,handleNativeModeChange:Ht,focusComposer:St,setThreadError:Kt}=t,en=o.useComposerPlan(r),Bt=en.proposedPlan,mt=en.tasksProgress,Et=en.taskSteps,lt=i.length===0&&P==="plan"&&Bt!==null,vt=M(null),{pendingPrimaryAction:wt,onSelectActivePendingUserInputOption:$t,onRespondToApproval:$,onRespondToComposerDecision:le,onAdvanceActivePendingUserInput:ye}=A1({t:oe,threadId:r.threadId,setThreadError:Kt,promptRef:ve,promptInputRef:vt,respondToApproval:v,respondToDecision:C,selectUserInputOption:y,advanceUserInput:b,activePendingProgress:l,activePendingIsResponding:u,activePendingResolvedAnswers:d}),Se=t.api,{limits:Pe}=t.attachments,nt=Se.draft.useThreadDraftSelector(de,Io=>A2(Io,Se.chat.deriveComposerSendState)),Ie=i[0]??null,{questionAttachmentTarget:Fe,attachmentTarget:at,attachmentDocumentKey:Je}=T1({supported:m,attachments:t.attachments,environmentId:J,threadId:A,requestId:Ie?.requestId??null,question:l?.activeQuestion??null,responding:u,composerDraftTarget:de}),dt=Se.draft.useThreadDraftSelector(at,I1),st=dt.images,Qt=nt.terminalContexts,Vt=nt.elementContexts,pn=nt.previewAnnotations,ao=nt.reviewComments,Cn=dt.nonPersistedImageIds,So=Se.uploads.useStore(Io=>Io.uploadsByImageId),qn=Te?a1({imageIds:st.map(Io=>Io.id),uploadsByImageId:So,environmentId:J},oe):null,{setComposerDraftPrompt:so,setComposerDraftNativeMode:be,addComposerDraftImage:Xe,addComposerDraftImages:kt,removeComposerDraftImage:gt,insertComposerDraftTerminalContext:xn,removeComposerDraftElementContext:bn,removeComposerDraftPreviewAnnotation:dn,removeComposerDraftReviewComment:rn,clearComposerDraftPromptAndImages:io}=E2(Se);U(()=>{if(se){if(!Te){for(let Io of st)Se.uploads.release(Io.id);return}Se.draft.restoreAttachments();for(let Io of st)Se.uploads.start({environmentId:J,image:Io})}},[se,st,J,Te]);let an=l!==null,Dn=dO({api:Se,t:oe,settings:Z,composerDraft:nt,composerDraftTarget:de,environmentId:J,gitCwd:ue,routeKind:Me,threadId:r.threadId,activeThread:D,isLocalDraftThread:q,unavailableAgentInstanceId:z,agentNotChosen:Ce,runtimeMode:T,lockedProvider:k,providerStatuses:w,projectId:R,activeProjectDefaultModelSelection:L,activeThreadModelSelection:N,compactDisabledReason:Q,externalSendDisabledReason:_,attachmentBlockReason:qn,answeringQuestion:an,setComposerDraftNativeMode:be,handleNativeModeChange:Ht,onProviderInstanceSelect:zt,onModelSelectionChosen:ln}),{selectedInstanceId:ka,noProviderAvailable:tr,selectedProvider:ms,composerModelOptions:Be,selectedModel:Pa,selectedProviderModels:La,sendDisabledReason:Ra,isSendDisabled:gs,setModelSendBlockShown:hs,isModelSendBlocked:Oo}=Dn,Wn=r1(J,de),[vs,Kr]=W(!1),[Bi,On]=W(null),[$r,Ui]=W(null),[Ue,jn]=W(!1),[zi,Hi]=W(!1),[ud,Ki]=W(null),[Aa,ys]=W({key:0,active:!1}),$i=M(Wn);pe(()=>{$i.current!==Wn&&($i.current=Wn,Kr(!1),On(null),jn(!1),Hi(!1),Ki(null),ys({key:Aa.key,active:!1}))},[Wn,Aa.key]);let yt=dm("max-sm"),Gn=M(null),ph=M(null),Vi=M(null),fd=M(null),pd=M(!1),md=M(new Map),{isComposerCollapsedMobile:Ea,blurMobileComposerAfterSend:mh,expandMobileComposer:gd,scheduleComposerCollapseCheck:gh,handleFormFocusCapture:Cs}=R1({isMobileViewport:yt,forceExpandedOnMobile:Ze,composerEditorRef:Gn,composerSurfaceRef:fd,composerFormRef:Vi}),hh=E(()=>{Kr(!0)},[]),qi=E(Io=>{Ft(Io)},[Ft]),Ve=s!==null,_t=l?.activeQuestion?.allowFreeform===!1,mn=g[0]??null,{showTopDrawer:Fn,showCollapsedPromptRow:Qu,hasBlocking:yw}=o1(mn?.kind??null,Ea),j2=lt||l!==null,{isComposerFooterCompact:G2,isComposerPrimaryActionsCompact:Q2}=l1(Vi,j2),X2=cO({api:Se,settings:Z,routeKind:Me,routeThreadRef:xe,draftId:Re,selectedProvider:ms,selectedInstanceId:ka,selectedModel:Pa,selectedProviderModels:La,composerModelOptions:Be});U(()=>{On(null)},[Vt,pn,ao,Qt,Pa,Dn.selectedModelOptionsForDispatch,ms]),L1({composerImages:st,composerImagesRef:et,composerTerminalContexts:Qt,composerTerminalContextsRef:ut,composerElementContexts:Vt,composerElementContextsRef:rt});let xs=O1({api:Se,t:oe,limits:Pe,composerDraftTarget:de,composerDraft:nt,composerDocumentKey:Wn,promptRef:ve,promptInputRef:vt,providerInputRejectedRef:pd,pendingImageCompressionsRef:md,setComposerDraftPrompt:so,setModelSendBlockShown:hs,onSend:tt,onCompactContext:Ct,blurMobileComposerAfterSend:mh,isMobileViewport:yt,isComposerApprovalState:Ve,activePendingApproval:s,activePendingProgress:l,activePendingResolvedAnswers:d,pendingUserInputCount:i.length,activeThreadId:A,phase:F,isSendBusy:V,environmentUnavailable:X,compactDisabled:G,noProviderAvailable:tr,isSendDisabled:gs,sendDisabledReason:Ra,isModelSendBlocked:Oo,showPlanFollowUpPrompt:lt}),hd=x1({api:Se,t:oe,limits:Pe,promptRef:ve,promptInputRef:vt,composerEditorRef:Gn,composerImagesRef:et,composerDraftTarget:de,setComposerDraftPrompt:so,addComposerDraftImages:kt,clearComposerDraftPromptAndImages:io,setIsStashMenuOpen:jn,setStashPulse:ys,isComposerCollapsedMobile:Ea,expandMobileComposer:gd,keybindings:re,terminalOpen:te,isComposerModelPickerOpen:vs,hasPendingUserInputs:i.length>0,isComposerApprovalState:Ve,projectSelectionRequired:H,answeringQuestion:an}),vh=z1({activeThreadId:A,activeThread:D,activeTasksProgress:mt,activeTaskSteps:Et,isTasksDrawerOpen:zi,setIsTasksDrawerOpen:Hi,dismissedTasksTurnId:ud,setDismissedTasksTurnId:Ki,stashQueue:hd.stashQueue,isStashMenuOpen:Ue,stashPulse:Aa,toggleInlineStashMenu:hd.toggleInlineStashMenu,isComposerApprovalState:Ve,externalDrawerAttached:n,showComposerTopDrawer:Fn,isComposerCollapsedMobile:Ea,hasBlockingComposerTopDrawer:yw}),Y2=E(Io=>{On(null),xs.revalidatePromptLength(Io),jn(!1)},[xs.revalidatePromptLength]),{addComposerImages:Cw,removeComposerImage:J2,onComposerAttachmentInputChange:Z2}=S1({api:Se,t:oe,limits:Pe,setThreadError:Kt,activeThreadId:A,answerQuestionsFirst:i.length>0&&Fe===null,attachmentTarget:at,attachmentDocumentKey:Je,supportsAttachmentUploads:Te,pendingImageCompressionsRef:md,addComposerDraftImage:Xe,addComposerDraftImages:kt,removeComposerDraftImage:gt}),{onComposerPaste:eB,insertComposerTextAtEnd:tB,addDroppedFolders:nB,isDragOverComposer:oB,composerMentionDragHandlers:rB,onComposerMentionDragLeaveCapture:aB}=C1({api:Se,t:oe,addComposerImages:Cw,attachments:t.attachments,promptRef:ve,promptInputRef:vt,composerEditorRef:Gn,composerFormRef:Vi,composerThreadKey:a,attachmentDocumentKey:Je,attachmentImagesRef:et,limits:Pe,supportsAttachmentUploads:Te,composerDocumentKey:Wn,isComposerApprovalState:Ve,pasteBlocked:i.length>0&&Fe===null,hasPendingUserInputs:i.length>0,projectSelectionRequired:H,environmentId:J}),xw=E(()=>{pt()},[pt]),bw=E(()=>{Gt()},[Gt]),{handleComposerPaste:sB,handleComposerSubmit:iB,handleUnclaimedEscape:lB}=M2({onComposerPaste:eB,submitComposer:xs.submitComposerOrShellCommand,exitShellCommandMode:xs.exitShellCommandMode});return P1({composerRef:$e,sendContextRef:Xt,api:Se,t:oe,limits:Pe,composerData:o,refs:{composerEditorRef:Gn,promptInputRef:vt,promptRef:ve,composerImagesRef:et,composerTerminalContextsRef:ut,composerElementContextsRef:rt,providerInputRejectedRef:pd},composerDraftTarget:de,activeThread:D,addComposerImages:Cw,addDroppedFolders:nB,focusComposer:St,insertComposerTextAtEnd:tB,insertComposerDraftTerminalContext:xn,composerPreviewAnnotations:pn,composerReviewComments:ao,isComposerApprovalState:Ve,pendingUserInputCount:i.length,projectSelectionRequired:H,noProviderAvailable:tr,modelState:Dn,handleRuntimeModeChange:on,runtimeMode:T,setIsComposerModelPickerOpen:Kr,setProviderInputSubmissionError:On}),c(DF,{formRef:Vi,onSubmit:xs.submitComposerOrShellCommand,onFocusCapture:Cs,onBlurCapture:gh,dragHandlers:rB,onDragLeaveCapture:aB,badges:vh,stashQueueLength:hd.stashQueue.length,isStashMenuOpen:Ue,stashPulse:Aa,toggleStashMenu:hd.toggleStashMenu,drawers:c(R2,{composerOccupant:mn,showComposerTopDrawer:Fn,hasBlockingComposerTopDrawer:yw,isTasksDrawerOpen:zi,isComposerCollapsedMobile:Ea,respondingRequestIds:h,keybindings:re,onRespondToApproval:$,onRespondToDecision:le,activePendingDraftAnswers:f,activePendingQuestionIndex:p,onSelectActivePendingUserInputOption:$t,onAdvanceActivePendingUserInput:ye,activeProposedPlan:Bt,activePendingProgress:l,isPendingUserInputChoiceOnly:_t,expandMobileComposer:gd,badges:vh,pendingPrimaryAction:wt,isSendBusy:V,sendDisabledReason:Ra,environmentUnavailable:X,noProviderAvailable:tr,projectSelectionRequired:H,previousUserInputQuestion:I,handleInterruptPrimaryAction:xw,handleImplementPlanInNewThreadPrimaryAction:bw}),children:c(_F,{props:t,composerDraft:nt,model:Dn,traits:X2,submit:xs,stash:hd,badges:vh,uploadsByImageId:So,composerImages:st,nonPersistedComposerImageIds:Cn,removeComposerImage:J2,removeComposerDraftPreviewAnnotation:dn,removeComposerDraftReviewComment:rn,removeComposerDraftElementContext:bn,onComposerAttachmentInputChange:Z2,surfaceRef:fd,composerAttachmentInputRef:ph,promptInputRef:vt,composerEditorRef:Gn,composerMenuAnchor:$r,setComposerMenuAnchor:Ui,composerDocumentKey:Wn,isComposerCollapsedMobile:Ea,expandMobileComposer:gd,isDragOverComposer:oB,isComposerApprovalState:Ve,showCollapsedMobilePromptRow:Qu,activePendingProgress:l,pendingUserInputs:i,changeUserInputCustomAnswer:x,pendingPrimaryAction:wt,approvalDetail:s?.detail??null,handleComposerPaste:sB,handleComposerSubmit:iB,onPromptEdited:Y2,handleUnclaimedEscape:lB,openModelPicker:hh,switchInteractionMode:qi,providerInputSubmissionError:Bi,isStashMenuOpen:Ue,isComposerFooterCompact:G2,isComposerPrimaryActionsCompact:Q2,isMobileViewport:yt,isComposerModelPickerOpen:vs,setIsComposerModelPickerOpen:Kr,showPlanFollowUpPrompt:lt,compactDisabled:G,compactThreadContext:xs.compactThreadContext,status:{projectSelectionRequired:H,isSendBusy:V,environmentUnavailable:X,interruptArmed:ft,agentNotChosen:Ce,unavailableAgentInstanceId:z,lockedProvider:k,phase:F,isPreparingWorktree:B,worktreeSetup:ae,activeThread:D,interactionMode:P,runtimeMode:T},actions:{previousUserInputQuestion:I,handleInterruptPrimaryAction:xw,handleImplementPlanInNewThreadPrimaryAction:bw}})})});function F2(e){let{composerRef:t,...n}=e;return c(Ug,{value:n.api,children:c(O2,{...n,composerRef:t})})}function Fi({section:e,resetKey:t,children:n}){return c(hl,{resetKey:t,fallback:o=>XX(e,o),children:n})}function XX(e,t){return c(YX,{section:e,error:t})}function YX({section:e,error:t}){let{t:n}=We();return S("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:[c(nn,{"aria-hidden":!0,className:"size-4 shrink-0 text-destructive-foreground"}),S("div",{className:"min-w-0",children:[c("p",{className:"font-medium text-foreground",children:n(`timeline.sectionUnavailable.${e}`)}),c("p",{className:"whitespace-pre-wrap break-words text-muted-foreground",children:n("timeline.sectionUnavailableHint",{reason:t.message})})]})]})}function B2({hostVersion:e,scopeClass:t}){let{t:n}=We();return S("div",{role:"status","data-conversation-host-data-mismatch":!0,className:j("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:[c(nn,{"aria-hidden":!0,className:"size-5 text-destructive-foreground"}),c("p",{className:"font-medium text-foreground",children:n("timeline.hostDataMismatchTitle")}),c("p",{className:"max-w-md text-muted-foreground",children:n("timeline.hostDataMismatchDescription",{host:e??0,plugin:xd})})]})}Y();function U2(e){let t=Un();U(()=>{let n=e.current;if(!n)return;let o=r=>{let a=r.detail?.reference;a&&t.openThread({environmentId:a.environmentId,threadId:a.threadId})};return n.addEventListener(nf,o),()=>n.removeEventListener(nf,o)},[t,e])}function z2(e){let{data:t}=e;return t?.version!==xd?c(B2,{hostVersion:t?.version??null,scopeClass:e.scopeClass}):c(cf.Provider,{value:e.scope.active,children:c(eY,{...e,data:t})})}var JX=ce(function({threadKey:t,onModeChange:n}){let[o]=Pt("turn-navigator",t,null),r=E(a=>{n("chat"),o?.onSelect(a)},[n,o]);return o===null?null:c(e0,{...o,placement:"inline",onSelect:r})});function ZX({slots:e,children:t}){let{data:n,target:o,threadKey:r}=yo(),a=n.useComposerPending({target:o,threadKey:r});return e?.renderSlotChain("conversation.composer",{occupants:a.occupants},t)??t}function eY(e){let{scope:t,mode:n,timeline:o,trajectory:r,composer:a,data:s}=e,[,i]=Pt("turn-navigator",t.threadKey,null),l=a.draftHero.active,d=a.sessionActions,u=a.terminalControl,f=a.agentsControl,{mode:p,onModeChange:m}=n,h=Un(),g=K(()=>l?S(he,{children:[d,c("div",{className:"min-w-0 flex-1"}),u]}):S(he,{children:[d,c(Dh,{mode:p,onModeChange:m,labelsByFirstRowWidth:!0}),c("div",{className:"min-w-0 flex-1"}),u,f,c(JX,{threadKey:t.threadKey,onModeChange:m})]}),[l,d,u,f,p,m,t.threadKey]),{belowSlot:v,draftHero:C,onOverlayElementChange:y,sessionActions:x,terminalControl:b,agentsControl:I,contextStrip:T,...P}=a,k=c(F2,{...P,attachments:e.attachments,firstRow:g}),w=K(()=>({environmentId:t.environmentId,threadId:t.threadId}),[t.environmentId,t.threadId]),[L,R]=Pt("trajectory-reveal",t.threadKey,null),N=E(Q=>{n.onModeChange("chat"),R(oe=>({rowId:Q,nonce:(oe?.nonce??0)+1}))},[n,R]),A=E(()=>R(null),[R]),D=M(null);U2(D);let{t:q}=ie(),H=M(a.api);H.current=a.api;let F=E(Q=>H.current.notify.warning(q(`timeline.quote.${Q}`)),[q]),[V,_]=Pt("timeline-quote-reveal",t.threadKey,null);U(()=>{let Q=D.current;if(!Q)return;let oe=de=>{let J=de.detail?.quote;if(J){if(J.environmentId!==w.environmentId||J.threadId!==w.threadId){F("otherThread");return}n.onModeChange("chat"),_({quote:J})}};return Q.addEventListener(tf,oe),()=>Q.removeEventListener(tf,oe)},[n,_,w.environmentId,w.threadId,F]);let z=E(Q=>{_(null),Q==="message-missing"&&F("messageMissing"),Q==="passage-missing"&&F("passageMissing")},[_,F]),Ce=K(()=>({data:s,target:w,threadKey:t.threadKey}),[s,w,t.threadKey]),{controlRef:B,...ae}=o,X=s.useChatWindow({target:w,threadKey:t.threadKey,visible:t.visible&&n.mode==="chat"}),G=YP({inputKey:t.threadKey,visible:t.visible,endInset:o.contentInsetEndAdjustment,derive:e.derive,onReturnToLatest:X.onReturnToLatest,controlRef:B});return c(ny,{value:a.slots,children:S("div",{ref:D,className:j("relative flex min-h-0 min-w-0 flex-1 flex-col",e.scopeClass),"data-conversation-surface":!0,children:[c(tY,{data:s,target:w,threadKey:t.threadKey,environmentId:t.environmentId,threadId:t.threadId,slots:a.slots}),c(i0,{data:s,target:w,threadKey:t.threadKey,surfaceRef:D}),c(TS,{chat:S(Fi,{section:"chat",resetKey:t.threadKey,children:[c(qP,{data:s,target:w,visible:t.visible,...ae,paneActive:t.active,liveFollowEnabled:G.liveFollowEnabled,scrollerRef:G.bindTimelineHandle,onRowsChange:G.onRowsChange,onIsAtEndChange:G.onIsAtEndChange,onManualNavigation:G.onManualNavigation,onDisclosureNavigation:G.onDisclosureNavigation,loadEarlier:X.loadEarlier,loadLater:X.loadLater,pagingBlockedByInteraction:X.pagingBlockedByInteraction,onVisibleTurnRangeChange:X.onVisibleTurnRangeChange,onReturnToLatest:X.loadLater===null?null:G.returnToEnd,onTurnNavigatorChange:i,revealMessageRequest:L,revealQuoteRequest:V,onRevealQuoteDone:z,onRevealMessageHandled:A}),c(jP,{data:s,target:w,bottomInset:o.contentInsetEndAdjustment,showScrollToEnd:G.showScrollToEnd,onScrollToEnd:G.returnToEnd})]},"chat"),mode:n.mode,trajectory:c(Fi,{section:"trajectory",resetKey:t.threadKey,children:c(aL,{data:s,target:w,inputKey:t.threadKey,paneVisible:t.visible&&n.mode==="trajectory",timestampFormat:r.timestampFormat,onOpenInChat:N})},"trajectory"),map:c(Fi,{section:"map",resetKey:t.threadKey,children:c("div",{className:"flex min-h-0 flex-1 flex-col",children:c(pp,{bridge:h,environmentId:t.environmentId,threadId:t.threadId,locateToken:0,fill:"pane",viewSwitch:c(Dh,{mode:p,onModeChange:m}),onClose:()=>m("chat")})})},"map"),visible:t.visible}),kS(p)?c(n1,{api:a.api,data:s,draftId:a.draftId,target:w,threadKey:t.threadKey,belowSlot:a.belowSlot,composer:c(Fi,{section:"composer",resetKey:t.threadKey,children:c(Qp,{value:Ce,children:c(_2,{children:c(ZX,{slots:a.slots,children:k})})})}),draftHero:a.draftHero,slots:a.slots,environmentId:t.environmentId,threadId:t.threadId,onOverlayElementChange:a.onOverlayElementChange,questions:c(Fi,{section:"composer",resetKey:t.threadKey,children:c(VD,{data:s,target:w})}),queue:c(Fi,{section:"queue",resetKey:t.threadKey,children:c($D,{data:s,target:w,inputKey:t.threadKey,attachments:e.attachments})})}):null]})})}function tY(e){let n=e.data.useComposerStatus({target:e.target,threadKey:e.threadKey}).activeThread?.presetId??null;return c("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:n})},e.threadKey)}Y();function H2(e){let t=e.bridge.i18n.usePluginTranslation(),n=e.environmentId,o=n===null?{}:{environmentId:n},r=e.bridge.commands.useSubscription("live",{},o),a=fp(r.data),[s,i]=W(null),l=lo(),d=s??a?.workspaceTitle??"";return S("section",{className:"session-map-chrome session-map-settings",children:[c("style",{children:up}),c("h2",{children:t("settings.title")}),a===null?c(Fs,{title:r.isPending?t("map.loading"):t("map.noMachine")}):S(he,{children:[S(Os,{className:"session-map-check",children:[c(Mh,{checked:a.autoProjection,"aria-label":t("settings.auto"),onCheckedChange:u=>{e.bridge.commands.invoke("preferences",{patch:{autoProjection:u}},o)}}),S("span",{children:[t("settings.auto"),S("span",{className:"session-map-muted",children:[" ",t("settings.autoHint")]})]})]}),S("div",{className:"session-map-setting-field",children:[c(Os,{htmlFor:l,children:t("settings.heading")}),S("div",{className:"session-map-setting-input",children:[c(Rr,{id:l,value:d,placeholder:t("settings.headingPlaceholder"),onChange:u=>i(u.target.value)}),c(ee,{type:"button",size:"sm",variant:"outline",onClick:()=>{e.bridge.commands.invoke("preferences",{patch:{workspaceTitle:d}},o),i(null)},children:t("settings.save")})]})]}),S(Os,{className:"session-map-check",children:[c(Mh,{checked:a.showArchived,"aria-label":t("settings.archived"),onCheckedChange:u=>{e.bridge.commands.invoke("preferences",{patch:{showArchived:u}},o)}}),c("span",{children:t("settings.archived")})]}),c("h3",{children:t("settings.hidden")}),a.hiddenThreads.length===0?c(Fs,{title:t("settings.noneHidden")}):null,a.hiddenThreads.map(u=>S("div",{className:"session-map-hidden",children:[c("span",{children:u.title||t("settings.hiddenUntitled")}),c(ee,{type:"button",size:"xs",variant:"outline",onClick:()=>{e.bridge.commands.invoke("restore",{threadId:u.threadId},o)},children:t("settings.restore")})]},u.threadId))]})]})}Y();var nY=[],oY=[],rY="prompt-font-preview",K2="max-h-40 min-h-12";function $2(){}function aY(e){let t=0;return ba(e).map(n=>{let o=t;return t+=n.type==="text"?n.text.length:n.type==="mention"?n.source.length:n.type==="skill"?n.name.length+1:1,{key:o,segment:n}})}function sY(e){return c("div",{className:xb,children:c("div",{"aria-multiline":"true","aria-placeholder":e.placeholder,className:j(bb,e.className),"data-composer-prompt-static":"true",onFocus:e.onActivate,onPointerDown:e.onActivate,role:"textbox",tabIndex:0,children:c("p",{children:aY(e.prompt).map(({key:t,segment:n})=>n.type==="mention"?c("span",{className:lr,children:c(Hg,{path:n.path,theme:e.theme})},t):n.type==="skill"?c("span",{className:lr,children:c(Kg,{label:Zo({name:n.name})})},t):n.type==="text"?c("span",{children:n.text},t):null)})})})}function V2(){let{t:e}=ie(),t=e("composer.idlePlaceholder"),n=Lt().theme.useResolvedTheme()==="dark"?"dark":"light",o=e("composer.fontPreviewSample"),r=M(null),[a,s]=W(null),i=a?.prompt??o,l=a?.cursor??o.length,[d,u]=W(!1),f=E((m,h)=>{s({prompt:m,cursor:h})},[]),p=E(()=>u(!0),[]);return U(()=>{d&&r.current?.focusAtEnd()},[d]),c("div",{className:"mt-1 mb-2 rounded-lg border border-border bg-background px-3 py-2",children:d?c(od,{documentKey:rY,editorRef:r,value:i,cursor:l,terminalContexts:nY,skills:oY,disabled:!1,placeholder:t,className:K2,onRemoveTerminalContext:$2,onChange:f,onPaste:$2}):c(sY,{className:K2,onActivate:p,placeholder:t,prompt:i,theme:n})})}var iY=".ycodium-conversation-ui";function lY(){let e=globalThis,t=(e.__ycodiumConversationScope??0)+1;return e.__ycodiumConversationScope=t,`ycodium-conversation-ui-${t}`}function q2(e,t="conversation"){let n=lY(),o=e.replaceAll(iY,`.${n}`),r=0,a=null;return{scopeClass:n,retain(){return typeof document>"u"?()=>{}:(r===0&&(a=document.createElement("style"),a.setAttribute("data-ycodium-plugin-css",t),a.textContent=o,document.head.appendChild(a)),r+=1,()=>{r-=1,r===0&&a!==null&&(a.remove(),a=null)})}}}function dY(e){let t=q2(Iw);return{pages:{"session-map":function(o){return c(Cd,{value:e,children:c(pp,{bridge:e,environmentId:o.environmentId??null,threadId:o.threadId??null,locateToken:0,fill:"page",onClose:null})})}},views:{[of]:cY(t,e),[Sh]:uY(t,e)},viewCapabilities:{[of]:[Ih,Lw]},slots:[{name:"conversation.input.agent",order:0,component:X1},{name:"conversation.input.model",order:0,component:iF},{name:"conversation.input.plan",order:0,component:uF},{name:"conversation.input.permission",order:0,component:cF},{name:"settings.section",order:0,component(n){return c(Cd,{value:e,children:c(H2,{bridge:e,environmentId:n.environmentId??null})})}}]}}function cY(e,t){return function(o){let a=o[rf]??t,s={...o};return delete s[rf],S(Cd,{value:a,children:[c(W2,{retain:e.retain}),c(wh,{value:e.scopeClass,children:c(z2,{...s,scopeClass:e.scopeClass})})]})}}function uY(e,t){return function(o){return S(Cd,{value:t,children:[c(W2,{retain:e.retain}),c(wh,{value:e.scopeClass,children:c(Ug,{value:o.api,children:c("div",{className:e.scopeClass,children:c(V2,{})})})})]})}}function W2({retain:e}){return yd(()=>e(),[e]),null}export{dY as default};
|
|
4188
|
+
`)[0]}),c("div",{className:"flex min-w-0 flex-wrap items-center gap-1 pt-0.5",children:i.options.map(f=>c(ee,{size:"xs",variant:f.tone==="primary"?"default":f.tone==="danger"?"destructive":"outline",disabled:a,onClick:()=>{s(!0),t.onRespond(l,f.id)},children:d(f.label)},f.id))})]})});function qX(e){if(typeof e!="string")return null;let t=e.trim();return t.length>0?t:null}function vw(e,t){if(t?.attachmentsBlocked)return null;let n=qX(t?.customAnswer);if(e.allowFreeform!==!1&&n)return n;let o=Tb(e,t?.selectedOptionLabels),r=e.allowFreeform!==!1&&(t?.attachmentCount??0)>0;return e.multiSelect?o.length>0?o:r?"":null:o[0]??(r?"":null)}function WX(e,t){let n={};for(let o of e){let r=vw(o,t[o.id]);if(r===null)return null;n[o.id]=r}return n}function jX(e,t){return e.reduce((n,o)=>vw(o,t[o.id])!==null?n+1:n,0)}function b2(e,t,n){let o=e.length===0?0:Math.max(0,Math.min(n,e.length-1)),r=e[o]??null,a=r?t[r.id]:void 0,s=r?vw(r,a):null,i=r?.allowFreeform===!1?"":a?.customAnswer??"",l=jX(e,t),d=e.length===0?!0:o>=e.length-1;return{questionIndex:o,activeQuestion:r,activeDraft:a,selectedOptionLabels:r?Tb(r,a?.selectedOptionLabels):[],customAnswer:i,resolvedAnswer:s,usingCustomAnswer:i.trim().length>0,answeredQuestionCount:l,isLastQuestion:d,isComplete:WX(e,t)!==null,canAdvance:s!==null}}var GX={approve:{label:"pendingUserInput.planApprove",description:"pendingUserInput.planApproveHint"},revise:{label:"pendingUserInput.planRevise",description:"pendingUserInput.planReviseHint"},stop:{label:"pendingUserInput.planStop",description:"pendingUserInput.planStopHint"}};function w2(e,t,n){let o=t.kind==="plan"&&n.planAction!==void 0?GX[n.planAction]:void 0;return o===void 0?{label:n.label,description:n.description??""}:{label:e(o.label),description:e(o.description)}}Y();var S2=ce(function({pendingUserInputs:t,respondingRequestIds:n,answers:o,questionIndex:r,onToggleOption:a,onAdvance:s}){if(t.length===0)return null;let i=t[0];return i?c(QX,{prompt:i,isResponding:n.includes(i.requestId),answers:o,questionIndex:r,onToggleOption:a,onAdvance:s},i.requestId):null}),QX=ce(function({prompt:t,isResponding:n,answers:o,questionIndex:r,onToggleOption:a,onAdvance:s}){let{t:i}=ie(),l=Lt(),d=b2(t.questions,o,r),u=d.activeQuestion,f=M(null),p=M(s),[m,h]=W(null),[g,v]=W(null),C=g!==null&&g===u?.id;U(()=>{p.current=s},[s]),U(()=>{if(!(!u||u.multiSelect||!m)){if(m.questionId!==u.id){h(null);return}d.customAnswer.trim().length===0&&d.selectedOptionLabels.includes(m.optionLabel)&&h(null)}},[u,m,d.customAnswer,d.selectedOptionLabels]),U(()=>()=>{f.current!==null&&window.clearTimeout(f.current)},[]);let y=E((T,P)=>{if(u?.multiSelect){a(T,P);return}h({questionId:T,optionLabel:P}),a(T,P),f.current!==null&&window.clearTimeout(f.current),f.current=window.setTimeout(()=>{f.current=null,p.current()},200)},[u,a]);if(l.pane.useKeydown(T=>{if(!u||n||C||T.metaKey||T.ctrlKey||T.altKey||T.isComposing||T.keyCode===229||Qa(T.target))return;let P=sy(T.key,u.options.length);if(P===null)return;let k=u.options[P];k&&(T.preventDefault(),y(u.id,sd(k)))},{target:"document"}),!u)return null;let x=d.customAnswer.trim().length>0,b=m?.questionId===u.id?m.optionLabel:null,I=b!==null?[b]:x?[]:d.selectedOptionLabels;return S(Af,{state:"pending",className:"px-3 py-2 sm:px-4",title:u.header,meta:t.questions.length>1?`${r+1}/${t.questions.length}`:void 0,collapse:{collapsed:C,onCollapsedChange:T=>{v(T?u.id:null)},hint:u.question,toggleLabel:i(C?"pendingUserInput.showQuestion":"pendingUserInput.hideQuestion")},children:[c("div",{className:"max-h-[min(45vh,28rem)] overflow-y-auto overscroll-contain break-words text-chat text-foreground","data-pending-user-input-body":u.kind??"question",tabIndex:0,children:u.kind==="plan"?c(Xn,{text:u.question,cwd:void 0,isStreaming:!1}):c("p",{className:"whitespace-pre-wrap font-medium",children:u.question})}),u.multiSelect?c("p",{className:"text-chat-row text-muted-foreground",children:i("pendingUserInput.selectOneOrMore")}):null,c(gS,{mode:u.multiSelect?"multiple":"single","aria-label":u.header,disabled:n,selected:I,onToggle:T=>{y(u.id,T)},onReselect:T=>{y(u.id,T)},options:u.options.map((T,P)=>{let k=w2(i,u,T);return{value:sd(T),label:k.label,...k.description&&k.description!==k.label?{description:k.description}:{},...P<9?{trailing:c(Ji,{children:P+1})}:{}}})},u.id)]})});Y();var I2=ce(function({planTitle:t}){let{t:n}=ie();return c("div",{className:"px-3 py-2 sm:px-4",children:S("div",{className:"flex flex-wrap items-center gap-2",children:[c("span",{className:"text-xs font-medium text-muted-foreground",children:n("plan.ready")}),t?c("span",{className:"min-w-0 flex-1 truncate text-xs text-foreground/85",children:t}):null]})})});function T2(e){if(e.occupant.kind!=="approval")return null;let{approval:t}=e.occupant;return c(BF,{requestId:t.requestId,isResponding:e.respondingRequestIds.includes(t.requestId),options:t.options,keybindings:e.keybindings,declineReasonRelay:t.declineReasonRelay,onRespondToApproval:e.onRespondToApproval})}function k2(e){return e.occupant.kind!=="user-input"?null:c(S2,{pendingUserInputs:[e.occupant.userInput],respondingRequestIds:e.respondingRequestIds,answers:e.activePendingDraftAnswers,questionIndex:e.activePendingQuestionIndex,onToggleOption:e.onSelectActivePendingUserInputOption,onAdvance:e.onAdvanceActivePendingUserInput})}var P2={approval:{expanded:e=>e.occupant.kind!=="approval"?null:c(gw,{approval:e.occupant.approval,pendingCount:e.occupant.pendingCount,actions:T2(e),className:"px-3 py-2 sm:px-4"}),collapsed:e=>e.occupant.kind!=="approval"?null:c("div",{"data-chat-composer-collapsed-controls":"true",children:c(gw,{approval:e.occupant.approval,pendingCount:e.occupant.pendingCount,actions:T2(e),className:"px-3 pt-2 pb-3 sm:px-4"})})},decision:{expanded:e=>e.occupant.kind!=="decision"?null:c(hw,{decision:e.occupant.decision.card,onRespond:e.onRespondToDecision}),collapsed:e=>e.occupant.kind!=="decision"?null:c("div",{"data-chat-composer-collapsed-controls":"true",children:c(hw,{decision:e.occupant.decision.card,onRespond:e.onRespondToDecision,className:"pt-2 pb-3"})})},"user-input":{expanded:k2,collapsed:e=>S("div",{"data-chat-composer-collapsed-controls":"true",children:[k2(e),e.collapsedPendingRow]})},"plan-follow-up":{expanded:e=>e.activeProposedPlan===null?null:c(I2,{planTitle:FF(e.activeProposedPlan.planMarkdown)??null},e.activeProposedPlan.id),collapsed:null}};function L2(e,t){let n=P2[e.occupant.kind],o=t?n.collapsed:n.expanded;return o===null?null:o(e)}var bEe=Object.keys(P2);function R2(e){let{composerOccupant:t,showComposerTopDrawer:n,hasBlockingComposerTopDrawer:o,isTasksDrawerOpen:r,isComposerCollapsedMobile:a,respondingRequestIds:s,keybindings:i,onRespondToApproval:l,onRespondToDecision:d,activePendingDraftAnswers:u,activePendingQuestionIndex:f,onSelectActivePendingUserInputOption:p,onAdvanceActivePendingUserInput:m,activeProposedPlan:h,activePendingProgress:g,isPendingUserInputChoiceOnly:v,expandMobileComposer:C,badges:y,pendingPrimaryAction:x,isSendBusy:b,sendDisabledReason:I,environmentUnavailable:T,noProviderAvailable:P,projectSelectionRequired:k,previousUserInputQuestion:w,handleInterruptPrimaryAction:L,handleImplementPlanInNewThreadPrimaryAction:R}=e,{inlineTasksBadge:N,inlineStashBadge:A,visibleTasksProgress:D,visibleTaskSteps:q,dismissTasks:H,toggleTasksDrawer:F}=y;return S(he,{children:[n&&(!r||o)?c("div",{className:"chat-composer-top-drawer","data-chat-composer-top-drawer":"true","data-variant":t?.kind==="approval"?"warning":"info","data-occupant":t?.kind??"none",children:t===null?null:L2({occupant:t,respondingRequestIds:s,keybindings:i,onRespondToApproval:l,onRespondToDecision:d,activePendingDraftAnswers:u,activePendingQuestionIndex:f,onSelectActivePendingUserInputOption:p,onAdvanceActivePendingUserInput:m,activeProposedPlan:h,collapsedPendingRow:c(OF,{activePendingProgress:g,isPendingUserInputChoiceOnly:v,expandMobileComposer:C,inlineTasksBadge:N,inlineStashBadge:A,pendingPrimaryAction:x,isSendBusy:b,sendDisabledReason:I,isEnvironmentUnavailable:T!==null||P||k,onPreviousActivePendingUserInputQuestion:w,handleInterruptPrimaryAction:L,handleImplementPlanInNewThreadPrimaryAction:R})},a)}):null,r&&!o&&D&&q?c(U1,{onDismiss:H,onCollapse:F,progress:D,steps:q}):null]})}function A2(e,t){return{images:e.images,terminalContexts:e.terminalContexts,elementContexts:e.elementContexts,previewAnnotations:e.previewAnnotations,reviewComments:e.reviewComments,nonPersistedImageIds:e.nonPersistedImageIds,activeProvider:e.activeProvider,nativeModeByProvider:e.nativeModeByProvider,selectedPluginActionKey:e.selectedPluginActionKey,promptHasText:e.prompt.trim().length>0,hasSendableContent:t({prompt:e.prompt,imageCount:e.images.length,terminalContexts:e.terminalContexts,elementContextCount:e.elementContexts.length+e.previewAnnotations.length+e.reviewComments.length}).hasSendableContent}}function E2(e){let t=e.draft.useStore;return{setComposerDraftPrompt:t(n=>n.setPrompt),setComposerDraftNativeMode:t(n=>n.setNativeMode),addComposerDraftImage:t(n=>n.addImage),addComposerDraftImages:t(n=>n.addImages),removeComposerDraftImage:t(n=>n.removeImage),insertComposerDraftTerminalContext:t(n=>n.insertTerminalContext),removeComposerDraftElementContext:t(n=>n.removeElementContext),removeComposerDraftPreviewAnnotation:t(n=>n.removePreviewAnnotation),removeComposerDraftReviewComment:t(n=>n.removeReviewComment),clearComposerDraftPromptAndImages:t(n=>n.clearComposerPromptAndImages)}}Y();function M2(e){let{onComposerPaste:t,submitComposer:n,exitShellCommandMode:o}=e,r=M({onComposerPaste:t,submitComposer:n,exitShellCommandMode:o});r.current={onComposerPaste:t,submitComposer:n,exitShellCommandMode:o};let a=E(l=>{r.current.onComposerPaste(l)},[]),s=E((l,d)=>{r.current.submitComposer(l,d)},[]),i=E(()=>r.current.exitShellCommandMode(),[]);return{handleComposerPaste:a,handleComposerSubmit:s,handleUnclaimedEscape:i}}Y();var N2=ct(null);function _2({children:e}){let{data:t,target:n,threadKey:o}=yo(),r=t.useComposerStatus({target:n,threadKey:o});return c(N2.Provider,{value:r,children:e})}function D2(){let e=At(N2);if(e===null)throw new Error("Composer status has not been provided.");return e}var O2=ce(function(t){let n=YD(),{data:o,target:r,threadKey:a}=yo(),{activePendingApproval:s,pendingUserInputs:i,activePendingProgress:l,activePendingResolvedAnswers:d,activePendingIsResponding:u,activePendingDraftAnswers:f,activePendingQuestionIndex:p,questionAttachmentsSupported:m,respondingRequestIds:h,occupants:g,respondToApproval:v,respondToDecision:C,selectUserInputOption:y,changeUserInputCustomAnswer:x,advanceUserInput:b,previousUserInputQuestion:I}=o.useComposerPending({target:r,threadKey:a}),{runtimeMode:T,interactionMode:P,lockedProvider:k,providerStatuses:w,activeProjectDefaultModelSelection:L,projectId:R,activeThreadModelSelection:N}=o.useComposerModelContext(r),{activeThreadId:A,activeThread:D,isLocalDraftThread:q,projectSelectionRequired:H,phase:F,isSendBusy:V,sendDisabledReason:_,unavailableAgentInstanceId:z=null,noAgentChosen:Ce=!1,isPreparingWorktree:B,worktreeSetup:ae=null,environmentUnavailable:X,compactDisabled:G,compactDisabledReason:Q}=D2(),{t:oe}=ie(),{composerDraftTarget:de,environmentId:J,attachmentUploadsCapabilityKnown:se,supportsAttachmentUploads:Te,routeKind:Me,routeThreadRef:xe,draftId:Re,forceExpandedOnMobile:Ze,settings:Z,keybindings:re,terminalOpen:te,gitCwd:ue,promptRef:ve,composerRef:$e,composerImagesRef:et,composerTerminalContextsRef:ut,composerElementContextsRef:rt,sendContextRef:Xt,onSend:tt,onInterrupt:pt,interruptArmed:ft=!1,onCompactContext:Ct,onImplementPlanInNewThread:Gt,onProviderInstanceSelect:zt,onModelSelectionChosen:ln,handleRuntimeModeChange:on,handleInteractionModeChange:Ft,handleNativeModeChange:Ht,focusComposer:St,setThreadError:Kt}=t,en=o.useComposerPlan(r),Bt=en.proposedPlan,mt=en.tasksProgress,Et=en.taskSteps,lt=i.length===0&&P==="plan"&&Bt!==null,vt=M(null),{pendingPrimaryAction:wt,onSelectActivePendingUserInputOption:$t,onRespondToApproval:$,onRespondToComposerDecision:le,onAdvanceActivePendingUserInput:ye}=A1({t:oe,threadId:r.threadId,setThreadError:Kt,promptRef:ve,promptInputRef:vt,respondToApproval:v,respondToDecision:C,selectUserInputOption:y,advanceUserInput:b,activePendingProgress:l,activePendingIsResponding:u,activePendingResolvedAnswers:d}),Se=t.api,{limits:Pe}=t.attachments,nt=Se.draft.useThreadDraftSelector(de,Io=>A2(Io,Se.chat.deriveComposerSendState)),Ie=i[0]??null,{questionAttachmentTarget:Fe,attachmentTarget:at,attachmentDocumentKey:Je}=T1({supported:m,attachments:t.attachments,environmentId:J,threadId:A,requestId:Ie?.requestId??null,question:l?.activeQuestion??null,responding:u,composerDraftTarget:de}),dt=Se.draft.useThreadDraftSelector(at,I1),st=dt.images,Qt=nt.terminalContexts,Vt=nt.elementContexts,pn=nt.previewAnnotations,ao=nt.reviewComments,Cn=dt.nonPersistedImageIds,So=Se.uploads.useStore(Io=>Io.uploadsByImageId),qn=Te?a1({imageIds:st.map(Io=>Io.id),uploadsByImageId:So,environmentId:J},oe):null,{setComposerDraftPrompt:so,setComposerDraftNativeMode:be,addComposerDraftImage:Xe,addComposerDraftImages:kt,removeComposerDraftImage:gt,insertComposerDraftTerminalContext:xn,removeComposerDraftElementContext:bn,removeComposerDraftPreviewAnnotation:dn,removeComposerDraftReviewComment:rn,clearComposerDraftPromptAndImages:io}=E2(Se);U(()=>{if(se){if(!Te){for(let Io of st)Se.uploads.release(Io.id);return}Se.draft.restoreAttachments();for(let Io of st)Se.uploads.start({environmentId:J,image:Io})}},[se,st,J,Te]);let an=l!==null,Dn=dO({api:Se,t:oe,settings:Z,composerDraft:nt,composerDraftTarget:de,environmentId:J,gitCwd:ue,routeKind:Me,threadId:r.threadId,activeThread:D,isLocalDraftThread:q,unavailableAgentInstanceId:z,agentNotChosen:Ce,runtimeMode:T,lockedProvider:k,providerStatuses:w,projectId:R,activeProjectDefaultModelSelection:L,activeThreadModelSelection:N,compactDisabledReason:Q,externalSendDisabledReason:_,attachmentBlockReason:qn,answeringQuestion:an,setComposerDraftNativeMode:be,handleNativeModeChange:Ht,onProviderInstanceSelect:zt,onModelSelectionChosen:ln}),{selectedInstanceId:ka,noProviderAvailable:tr,selectedProvider:ms,composerModelOptions:Be,selectedModel:Pa,selectedProviderModels:La,sendDisabledReason:Ra,isSendDisabled:gs,setModelSendBlockShown:hs,isModelSendBlocked:Oo}=Dn,Wn=r1(J,de),[vs,Kr]=W(!1),[Bi,On]=W(null),[$r,Ui]=W(null),[Ue,jn]=W(!1),[zi,Hi]=W(!1),[ud,Ki]=W(null),[Aa,ys]=W({key:0,active:!1}),$i=M(Wn);pe(()=>{$i.current!==Wn&&($i.current=Wn,Kr(!1),On(null),jn(!1),Hi(!1),Ki(null),ys({key:Aa.key,active:!1}))},[Wn,Aa.key]);let yt=dm("max-sm"),Gn=M(null),ph=M(null),Vi=M(null),fd=M(null),pd=M(!1),md=M(new Map),{isComposerCollapsedMobile:Ea,blurMobileComposerAfterSend:mh,expandMobileComposer:gd,scheduleComposerCollapseCheck:gh,handleFormFocusCapture:Cs}=R1({isMobileViewport:yt,forceExpandedOnMobile:Ze,composerEditorRef:Gn,composerSurfaceRef:fd,composerFormRef:Vi}),hh=E(()=>{Kr(!0)},[]),qi=E(Io=>{Ft(Io)},[Ft]),Ve=s!==null,_t=l?.activeQuestion?.allowFreeform===!1,mn=g[0]??null,{showTopDrawer:Fn,showCollapsedPromptRow:Qu,hasBlocking:yw}=o1(mn?.kind??null,Ea),j2=lt||l!==null,{isComposerFooterCompact:G2,isComposerPrimaryActionsCompact:Q2}=l1(Vi,j2),X2=cO({api:Se,settings:Z,routeKind:Me,routeThreadRef:xe,draftId:Re,selectedProvider:ms,selectedInstanceId:ka,selectedModel:Pa,selectedProviderModels:La,composerModelOptions:Be});U(()=>{On(null)},[Vt,pn,ao,Qt,Pa,Dn.selectedModelOptionsForDispatch,ms]),L1({composerImages:st,composerImagesRef:et,composerTerminalContexts:Qt,composerTerminalContextsRef:ut,composerElementContexts:Vt,composerElementContextsRef:rt});let xs=O1({api:Se,t:oe,limits:Pe,composerDraftTarget:de,composerDraft:nt,composerDocumentKey:Wn,promptRef:ve,promptInputRef:vt,providerInputRejectedRef:pd,pendingImageCompressionsRef:md,setComposerDraftPrompt:so,setModelSendBlockShown:hs,onSend:tt,onCompactContext:Ct,blurMobileComposerAfterSend:mh,isMobileViewport:yt,isComposerApprovalState:Ve,activePendingApproval:s,activePendingProgress:l,activePendingResolvedAnswers:d,pendingUserInputCount:i.length,activeThreadId:A,phase:F,isSendBusy:V,environmentUnavailable:X,compactDisabled:G,noProviderAvailable:tr,isSendDisabled:gs,sendDisabledReason:Ra,isModelSendBlocked:Oo,showPlanFollowUpPrompt:lt}),hd=x1({api:Se,t:oe,limits:Pe,promptRef:ve,promptInputRef:vt,composerEditorRef:Gn,composerImagesRef:et,composerDraftTarget:de,setComposerDraftPrompt:so,addComposerDraftImages:kt,clearComposerDraftPromptAndImages:io,setIsStashMenuOpen:jn,setStashPulse:ys,isComposerCollapsedMobile:Ea,expandMobileComposer:gd,keybindings:re,terminalOpen:te,isComposerModelPickerOpen:vs,hasPendingUserInputs:i.length>0,isComposerApprovalState:Ve,projectSelectionRequired:H,answeringQuestion:an}),vh=z1({activeThreadId:A,activeThread:D,activeTasksProgress:mt,activeTaskSteps:Et,isTasksDrawerOpen:zi,setIsTasksDrawerOpen:Hi,dismissedTasksTurnId:ud,setDismissedTasksTurnId:Ki,stashQueue:hd.stashQueue,isStashMenuOpen:Ue,stashPulse:Aa,toggleInlineStashMenu:hd.toggleInlineStashMenu,isComposerApprovalState:Ve,externalDrawerAttached:n,showComposerTopDrawer:Fn,isComposerCollapsedMobile:Ea,hasBlockingComposerTopDrawer:yw}),Y2=E(Io=>{On(null),xs.revalidatePromptLength(Io),jn(!1)},[xs.revalidatePromptLength]),{addComposerImages:Cw,removeComposerImage:J2,onComposerAttachmentInputChange:Z2}=S1({api:Se,t:oe,limits:Pe,setThreadError:Kt,activeThreadId:A,answerQuestionsFirst:i.length>0&&Fe===null,attachmentTarget:at,attachmentDocumentKey:Je,supportsAttachmentUploads:Te,pendingImageCompressionsRef:md,addComposerDraftImage:Xe,addComposerDraftImages:kt,removeComposerDraftImage:gt}),{onComposerPaste:eB,insertComposerTextAtEnd:tB,addDroppedFolders:nB,isDragOverComposer:oB,composerMentionDragHandlers:rB,onComposerMentionDragLeaveCapture:aB}=C1({api:Se,t:oe,addComposerImages:Cw,attachments:t.attachments,promptRef:ve,promptInputRef:vt,composerEditorRef:Gn,composerFormRef:Vi,composerThreadKey:a,attachmentDocumentKey:Je,attachmentImagesRef:et,limits:Pe,supportsAttachmentUploads:Te,composerDocumentKey:Wn,isComposerApprovalState:Ve,pasteBlocked:i.length>0&&Fe===null,hasPendingUserInputs:i.length>0,projectSelectionRequired:H,environmentId:J}),xw=E(()=>{pt()},[pt]),bw=E(()=>{Gt()},[Gt]),{handleComposerPaste:sB,handleComposerSubmit:iB,handleUnclaimedEscape:lB}=M2({onComposerPaste:eB,submitComposer:xs.submitComposerOrShellCommand,exitShellCommandMode:xs.exitShellCommandMode});return P1({composerRef:$e,sendContextRef:Xt,api:Se,t:oe,limits:Pe,composerData:o,refs:{composerEditorRef:Gn,promptInputRef:vt,promptRef:ve,composerImagesRef:et,composerTerminalContextsRef:ut,composerElementContextsRef:rt,providerInputRejectedRef:pd},composerDraftTarget:de,activeThread:D,addComposerImages:Cw,addDroppedFolders:nB,focusComposer:St,insertComposerTextAtEnd:tB,insertComposerDraftTerminalContext:xn,composerPreviewAnnotations:pn,composerReviewComments:ao,isComposerApprovalState:Ve,pendingUserInputCount:i.length,projectSelectionRequired:H,noProviderAvailable:tr,modelState:Dn,handleRuntimeModeChange:on,runtimeMode:T,setIsComposerModelPickerOpen:Kr,setProviderInputSubmissionError:On}),c(DF,{formRef:Vi,onSubmit:xs.submitComposerOrShellCommand,onFocusCapture:Cs,onBlurCapture:gh,dragHandlers:rB,onDragLeaveCapture:aB,badges:vh,stashQueueLength:hd.stashQueue.length,isStashMenuOpen:Ue,stashPulse:Aa,toggleStashMenu:hd.toggleStashMenu,drawers:c(R2,{composerOccupant:mn,showComposerTopDrawer:Fn,hasBlockingComposerTopDrawer:yw,isTasksDrawerOpen:zi,isComposerCollapsedMobile:Ea,respondingRequestIds:h,keybindings:re,onRespondToApproval:$,onRespondToDecision:le,activePendingDraftAnswers:f,activePendingQuestionIndex:p,onSelectActivePendingUserInputOption:$t,onAdvanceActivePendingUserInput:ye,activeProposedPlan:Bt,activePendingProgress:l,isPendingUserInputChoiceOnly:_t,expandMobileComposer:gd,badges:vh,pendingPrimaryAction:wt,isSendBusy:V,sendDisabledReason:Ra,environmentUnavailable:X,noProviderAvailable:tr,projectSelectionRequired:H,previousUserInputQuestion:I,handleInterruptPrimaryAction:xw,handleImplementPlanInNewThreadPrimaryAction:bw}),children:c(_F,{props:t,composerDraft:nt,model:Dn,traits:X2,submit:xs,stash:hd,badges:vh,uploadsByImageId:So,composerImages:st,nonPersistedComposerImageIds:Cn,removeComposerImage:J2,removeComposerDraftPreviewAnnotation:dn,removeComposerDraftReviewComment:rn,removeComposerDraftElementContext:bn,onComposerAttachmentInputChange:Z2,surfaceRef:fd,composerAttachmentInputRef:ph,promptInputRef:vt,composerEditorRef:Gn,composerMenuAnchor:$r,setComposerMenuAnchor:Ui,composerDocumentKey:Wn,isComposerCollapsedMobile:Ea,expandMobileComposer:gd,isDragOverComposer:oB,isComposerApprovalState:Ve,showCollapsedMobilePromptRow:Qu,activePendingProgress:l,pendingUserInputs:i,changeUserInputCustomAnswer:x,pendingPrimaryAction:wt,approvalDetail:s?.detail??null,handleComposerPaste:sB,handleComposerSubmit:iB,onPromptEdited:Y2,handleUnclaimedEscape:lB,openModelPicker:hh,switchInteractionMode:qi,providerInputSubmissionError:Bi,isStashMenuOpen:Ue,isComposerFooterCompact:G2,isComposerPrimaryActionsCompact:Q2,isMobileViewport:yt,isComposerModelPickerOpen:vs,setIsComposerModelPickerOpen:Kr,showPlanFollowUpPrompt:lt,compactDisabled:G,compactThreadContext:xs.compactThreadContext,status:{projectSelectionRequired:H,isSendBusy:V,environmentUnavailable:X,interruptArmed:ft,agentNotChosen:Ce,unavailableAgentInstanceId:z,lockedProvider:k,phase:F,isPreparingWorktree:B,worktreeSetup:ae,activeThread:D,interactionMode:P,runtimeMode:T},actions:{previousUserInputQuestion:I,handleInterruptPrimaryAction:xw,handleImplementPlanInNewThreadPrimaryAction:bw}})})});function F2(e){let{composerRef:t,...n}=e;return c(Ug,{value:n.api,children:c(O2,{...n,composerRef:t})})}function Fi({section:e,resetKey:t,children:n}){return c(hl,{resetKey:t,fallback:o=>XX(e,o),children:n})}function XX(e,t){return c(YX,{section:e,error:t})}function YX({section:e,error:t}){let{t:n}=We();return S("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:[c(nn,{"aria-hidden":!0,className:"size-4 shrink-0 text-destructive-foreground"}),S("div",{className:"min-w-0",children:[c("p",{className:"font-medium text-foreground",children:n(`timeline.sectionUnavailable.${e}`)}),c("p",{className:"whitespace-pre-wrap break-words text-muted-foreground",children:n("timeline.sectionUnavailableHint",{reason:t.message})})]})]})}function B2({hostVersion:e,scopeClass:t}){let{t:n}=We();return S("div",{role:"status","data-conversation-host-data-mismatch":!0,className:j("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:[c(nn,{"aria-hidden":!0,className:"size-5 text-destructive-foreground"}),c("p",{className:"font-medium text-foreground",children:n("timeline.hostDataMismatchTitle")}),c("p",{className:"max-w-md text-muted-foreground",children:n("timeline.hostDataMismatchDescription",{host:e??0,plugin:xd})})]})}Y();function U2(e){let t=Un();U(()=>{let n=e.current;if(!n)return;let o=r=>{let a=r.detail?.reference;a&&t.openThread({environmentId:a.environmentId,threadId:a.threadId})};return n.addEventListener(nf,o),()=>n.removeEventListener(nf,o)},[t,e])}function z2(e){let{data:t}=e;return t?.version!==xd?c(B2,{hostVersion:t?.version??null,scopeClass:e.scopeClass}):c(cf.Provider,{value:e.scope.active,children:c(eY,{...e,data:t})})}var JX=ce(function({threadKey:t,onModeChange:n}){let[o]=Pt("turn-navigator",t,null),r=E(a=>{n("chat"),o?.onSelect(a)},[n,o]);return o===null?null:c(e0,{...o,placement:"inline",onSelect:r})});function ZX({slots:e,children:t}){let{data:n,target:o,threadKey:r}=yo(),a=n.useComposerPending({target:o,threadKey:r});return e?.renderSlotChain("conversation.composer",{occupants:a.occupants},t)??t}function eY(e){let{scope:t,mode:n,timeline:o,trajectory:r,composer:a,data:s}=e,[,i]=Pt("turn-navigator",t.threadKey,null),l=a.draftHero.active,d=a.sessionActions,u=a.terminalControl,f=a.agentsControl,{mode:p,onModeChange:m}=n,h=Un(),g=K(()=>l?S(he,{children:[d,c("div",{className:"min-w-0 flex-1"}),u]}):S(he,{children:[d,c(Dh,{mode:p,onModeChange:m,labelsByFirstRowWidth:!0}),c("div",{className:"min-w-0 flex-1"}),u,f,c(JX,{threadKey:t.threadKey,onModeChange:m})]}),[l,d,u,f,p,m,t.threadKey]),{belowSlot:v,draftHero:C,onOverlayElementChange:y,sessionActions:x,terminalControl:b,agentsControl:I,contextStrip:T,...P}=a,k=c(F2,{...P,attachments:e.attachments,firstRow:g}),w=K(()=>({environmentId:t.environmentId,threadId:t.threadId}),[t.environmentId,t.threadId]),[L,R]=Pt("trajectory-reveal",t.threadKey,null),N=E(Q=>{n.onModeChange("chat"),R(oe=>({rowId:Q,nonce:(oe?.nonce??0)+1}))},[n,R]),A=E(()=>R(null),[R]),D=M(null);U2(D);let{t:q}=ie(),H=M(a.api);H.current=a.api;let F=E(Q=>H.current.notify.warning(q(`timeline.quote.${Q}`)),[q]),[V,_]=Pt("timeline-quote-reveal",t.threadKey,null);U(()=>{let Q=D.current;if(!Q)return;let oe=de=>{let J=de.detail?.quote;if(J){if(J.environmentId!==w.environmentId||J.threadId!==w.threadId){F("otherThread");return}n.onModeChange("chat"),_({quote:J})}};return Q.addEventListener(tf,oe),()=>Q.removeEventListener(tf,oe)},[n,_,w.environmentId,w.threadId,F]);let z=E(Q=>{_(null),Q==="message-missing"&&F("messageMissing"),Q==="passage-missing"&&F("passageMissing")},[_,F]),Ce=K(()=>({data:s,target:w,threadKey:t.threadKey}),[s,w,t.threadKey]),{controlRef:B,...ae}=o,X=s.useChatWindow({target:w,threadKey:t.threadKey,visible:t.visible&&n.mode==="chat"}),G=YP({inputKey:t.threadKey,visible:t.visible,endInset:o.contentInsetEndAdjustment,derive:e.derive,onReturnToLatest:X.onReturnToLatest,controlRef:B});return c(ny,{value:a.slots,children:S("div",{ref:D,className:j("relative flex min-h-0 min-w-0 flex-1 flex-col",e.scopeClass),"data-conversation-surface":!0,children:[c(tY,{data:s,target:w,threadKey:t.threadKey,environmentId:t.environmentId,threadId:t.threadId,slots:a.slots}),c(i0,{data:s,target:w,threadKey:t.threadKey,surfaceRef:D}),c(TS,{chat:S(Fi,{section:"chat",resetKey:t.threadKey,children:[c(qP,{data:s,target:w,visible:t.visible,...ae,paneActive:t.active,liveFollowEnabled:G.liveFollowEnabled,scrollerRef:G.bindTimelineHandle,onRowsChange:G.onRowsChange,onIsAtEndChange:G.onIsAtEndChange,onManualNavigation:G.onManualNavigation,onDisclosureNavigation:G.onDisclosureNavigation,loadEarlier:X.loadEarlier,loadLater:X.loadLater,pagingBlockedByInteraction:X.pagingBlockedByInteraction,onVisibleTurnRangeChange:X.onVisibleTurnRangeChange,onReturnToLatest:X.loadLater===null?null:G.returnToEnd,onTurnNavigatorChange:i,revealMessageRequest:L,revealQuoteRequest:V,onRevealQuoteDone:z,onRevealMessageHandled:A}),c(jP,{data:s,target:w,bottomInset:o.contentInsetEndAdjustment,showScrollToEnd:G.showScrollToEnd,onScrollToEnd:G.returnToEnd})]},"chat"),mode:n.mode,trajectory:c(Fi,{section:"trajectory",resetKey:t.threadKey,children:c(aL,{data:s,target:w,inputKey:t.threadKey,paneVisible:t.visible&&n.mode==="trajectory",timestampFormat:r.timestampFormat,onOpenInChat:N})},"trajectory"),map:c(Fi,{section:"map",resetKey:t.threadKey,children:c("div",{className:"flex min-h-0 flex-1 flex-col",children:c(pp,{bridge:h,environmentId:t.environmentId,threadId:t.threadId,locateToken:0,fill:"pane",viewSwitch:c(Dh,{mode:p,onModeChange:m}),onClose:()=>m("chat")})})},"map"),visible:t.visible}),kS(p)?c(n1,{api:a.api,data:s,draftId:a.draftId,target:w,threadKey:t.threadKey,belowSlot:a.belowSlot,composer:c(Fi,{section:"composer",resetKey:t.threadKey,children:c(Qp,{value:Ce,children:c(_2,{children:c(ZX,{slots:a.slots,children:k})})})}),draftHero:a.draftHero,slots:a.slots,environmentId:t.environmentId,threadId:t.threadId,onOverlayElementChange:a.onOverlayElementChange,questions:c(Fi,{section:"composer",resetKey:t.threadKey,children:c(VD,{data:s,target:w})}),queue:c(Fi,{section:"queue",resetKey:t.threadKey,children:c($D,{data:s,target:w,inputKey:t.threadKey,attachments:e.attachments})})}):null]})})}function tY(e){let n=e.data.useComposerStatus({target:e.target,threadKey:e.threadKey}).activeThread?.presetId??null;return c("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:n})},e.threadKey)}Y();function H2(e){let t=e.bridge.i18n.usePluginTranslation(),n=e.environmentId,o=n===null?{}:{environmentId:n},r=e.bridge.commands.useSubscription("live",{},o),a=fp(r.data),[s,i]=W(null),l=lo(),d=s??a?.workspaceTitle??"";return S("section",{className:"session-map-chrome session-map-settings",children:[c("style",{children:up}),c("h2",{children:t("settings.title")}),a===null?c(Fs,{title:r.isPending?t("map.loading"):t("map.noMachine")}):S(he,{children:[S(Os,{className:"session-map-check",children:[c(Mh,{checked:a.autoProjection,"aria-label":t("settings.auto"),onCheckedChange:u=>{e.bridge.commands.invoke("preferences",{patch:{autoProjection:u}},o)}}),S("span",{children:[t("settings.auto"),S("span",{className:"session-map-muted",children:[" ",t("settings.autoHint")]})]})]}),S("div",{className:"session-map-setting-field",children:[c(Os,{htmlFor:l,children:t("settings.heading")}),S("div",{className:"session-map-setting-input",children:[c(Rr,{id:l,value:d,placeholder:t("settings.headingPlaceholder"),onChange:u=>i(u.target.value)}),c(ee,{type:"button",size:"sm",variant:"outline",onClick:()=>{e.bridge.commands.invoke("preferences",{patch:{workspaceTitle:d}},o),i(null)},children:t("settings.save")})]})]}),S(Os,{className:"session-map-check",children:[c(Mh,{checked:a.showArchived,"aria-label":t("settings.archived"),onCheckedChange:u=>{e.bridge.commands.invoke("preferences",{patch:{showArchived:u}},o)}}),c("span",{children:t("settings.archived")})]}),c("h3",{children:t("settings.hidden")}),a.hiddenThreads.length===0?c(Fs,{title:t("settings.noneHidden")}):null,a.hiddenThreads.map(u=>S("div",{className:"session-map-hidden",children:[c("span",{children:u.title||t("settings.hiddenUntitled")}),c(ee,{type:"button",size:"xs",variant:"outline",onClick:()=>{e.bridge.commands.invoke("restore",{threadId:u.threadId},o)},children:t("settings.restore")})]},u.threadId))]})]})}Y();var nY=[],oY=[],rY="prompt-font-preview",K2="max-h-40 min-h-12";function $2(){}function aY(e){let t=0;return ba(e).map(n=>{let o=t;return t+=n.type==="text"?n.text.length:n.type==="mention"?n.source.length:n.type==="skill"?n.name.length+1:1,{key:o,segment:n}})}function sY(e){return c("div",{className:xb,children:c("div",{"aria-multiline":"true","aria-placeholder":e.placeholder,className:j(bb,e.className),"data-composer-prompt-static":"true",onFocus:e.onActivate,onPointerDown:e.onActivate,role:"textbox",tabIndex:0,children:c("p",{children:aY(e.prompt).map(({key:t,segment:n})=>n.type==="mention"?c("span",{className:lr,children:c(Hg,{path:n.path,theme:e.theme})},t):n.type==="skill"?c("span",{className:lr,children:c(Kg,{label:Zo({name:n.name})})},t):n.type==="text"?c("span",{children:n.text},t):null)})})})}function V2(){let{t:e}=ie(),t=e("composer.idlePlaceholder"),n=Lt().theme.useResolvedTheme()==="dark"?"dark":"light",o=e("composer.fontPreviewSample"),r=M(null),[a,s]=W(null),i=a?.prompt??o,l=a?.cursor??o.length,[d,u]=W(!1),f=E((m,h)=>{s({prompt:m,cursor:h})},[]),p=E(()=>u(!0),[]);return U(()=>{d&&r.current?.focusAtEnd()},[d]),c("div",{className:"mt-1 mb-2 rounded-lg border border-border bg-background px-3 py-2",children:d?c(od,{documentKey:rY,editorRef:r,value:i,cursor:l,terminalContexts:nY,skills:oY,disabled:!1,placeholder:t,className:K2,onRemoveTerminalContext:$2,onChange:f,onPaste:$2}):c(sY,{className:K2,onActivate:p,placeholder:t,prompt:i,theme:n})})}var iY=".ycodium-conversation-ui";function lY(){let e=globalThis,t=(e.__ycodiumConversationScope??0)+1;return e.__ycodiumConversationScope=t,`ycodium-conversation-ui-${t}`}function q2(e,t="conversation"){let n=lY(),o=e.replaceAll(iY,`.${n}`),r=0,a=null;return{scopeClass:n,retain(){return typeof document>"u"?()=>{}:(r===0&&(a=document.createElement("style"),a.setAttribute("data-ycodium-plugin-css",t),a.textContent=o,document.head.appendChild(a)),r+=1,()=>{r-=1,r===0&&a!==null&&(a.remove(),a=null)})}}}function dY(e){let t=q2(Iw);return{pages:{"session-map":function(o){return c(Cd,{value:e,children:c(pp,{bridge:e,environmentId:o.environmentId??null,threadId:o.threadId??null,locateToken:0,fill:"page",onClose:null})})}},views:{[of]:cY(t,e),[Sh]:uY(t,e)},viewCapabilities:{[of]:[Ih,Lw]},slots:[{name:"conversation.input.agent",order:0,component:X1},{name:"conversation.input.model",order:0,component:iF},{name:"conversation.input.plan",order:0,component:uF},{name:"conversation.input.permission",order:0,component:cF},{name:"settings.section",order:0,component(n){return c(Cd,{value:e,children:c(H2,{bridge:e,environmentId:n.environmentId??null})})}}]}}function cY(e,t){return function(o){let a=o[rf]??t,s={...o};return delete s[rf],S(Cd,{value:a,children:[c(W2,{retain:e.retain}),c(wh,{value:e.scopeClass,children:c(z2,{...s,scopeClass:e.scopeClass})})]})}}function uY(e,t){return function(o){return S(Cd,{value:t,children:[c(W2,{retain:e.retain}),c(wh,{value:e.scopeClass,children:c(Ug,{value:o.api,children:c("div",{className:e.scopeClass,children:c(V2,{})})})})]})}}function W2({retain:e}){return yd(()=>e(),[e]),null}export{dY as default};
|