@cuongtran001/kanna 1.95.0 → 1.97.0
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/dist/client/assets/{BoardsPage-DYLH4CnT.js → BoardsPage-D3TlgAZ_.js} +1 -1
- package/dist/client/assets/{BoardsRoutePage-C-9i-aRF.js → BoardsRoutePage-VkxV-IFk.js} +1 -1
- package/dist/client/assets/{ChatPage-BRFYC5UH.js → ChatPage-Dscf_7rF.js} +3 -3
- package/dist/client/assets/{CronJobsPage-C-gjzAu1.js → CronJobsPage-CRkUkXat.js} +1 -1
- package/dist/client/assets/{FilePreviewSheet-NvVL2JG6.js → FilePreviewSheet-DeowWf5y.js} +1 -1
- package/dist/client/assets/{FlowSurface-Bikh4YLq.js → FlowSurface-CWsaGLfa.js} +1 -1
- package/dist/client/assets/{GenUIBlock-B3DisBjQ.js → GenUIBlock-Bv-OFgT5.js} +2 -2
- package/dist/client/assets/{InboundHandlerFields-UbdPgHQ5.js → InboundHandlerFields-Bz-crPWC.js} +1 -1
- package/dist/client/assets/{InboxPage-DvkzNCfr.js → InboxPage-Cx2I-D9G.js} +1 -1
- package/dist/client/assets/{LocalProjectsPage-J0x7G0l4.js → LocalProjectsPage-Lx4uBsJV.js} +1 -1
- package/dist/client/assets/SettingsPage-QUQTA-qY.js +17 -0
- package/dist/client/assets/{StackBoardsRoutePage-Dj1jG4vG.js → StackBoardsRoutePage-Uy6E-3Gl.js} +1 -1
- package/dist/client/assets/{ToolCallMessage-DZTR1W1v.js → ToolCallMessage-DEfxdq5H.js} +1 -1
- package/dist/client/assets/{VChartSurface-BTKWM6nl.js → VChartSurface-UFK0UlX-.js} +1 -1
- package/dist/client/assets/{WebhooksPage-CvZbgQwk.js → WebhooksPage-6ALLVh_l.js} +1 -1
- package/dist/client/assets/{WorkflowsPage-Dbt_ju8E.js → WorkflowsPage-1i5hmCxm.js} +1 -1
- package/dist/client/assets/{appSettingsStore-BgLKcwVW.js → appSettingsStore-DhpIEBz2.js} +1 -1
- package/dist/client/assets/{arrow-left-B9MpdBtg.js → arrow-left-Bto85Swe.js} +1 -1
- package/dist/client/assets/{beacon-alias-k72gNh9f.js → beacon-alias-HmDCskK6.js} +3 -3
- package/dist/client/assets/{code-xml-0ltzEz2X.js → code-xml-DVVP_fVN.js} +1 -1
- package/dist/client/assets/commandFeedback-2cA8d_WY.js +1 -0
- package/dist/client/assets/{contextWindow-C-20_tVh.js → contextWindow-B9Tu0rKj.js} +1 -1
- package/dist/client/assets/{copyFeedbackStore-Bw_-4aam.js → copyFeedbackStore-CNP3tyq0.js} +1 -1
- package/dist/client/assets/{createScopedStore-L_qmwTAu.js → createScopedStore-jAn6kJBy.js} +1 -1
- package/dist/client/assets/{cronJobsStore-CHZ3jprN.js → cronJobsStore-OUyVs58Z.js} +1 -1
- package/dist/client/assets/{file-plus-corner-DMWk1Kix.js → file-plus-corner-DY_1K1Ne.js} +1 -1
- package/dist/client/assets/{inboxStore-BQwc6qjp.js → inboxStore-q-JHTh--.js} +1 -1
- package/dist/client/assets/{index-BLMXLYEb.js → index-DUJdXxNz.js} +3 -3
- package/dist/client/assets/{info-DC1K4zUR.js → info-BcA9_4Qg.js} +1 -1
- package/dist/client/assets/{input-_et6sDdl.js → input-DbE6EzUB.js} +1 -1
- package/dist/client/assets/{log-CJGZbJ9_.js → log-CFGrfkV1.js} +1 -1
- package/dist/client/assets/minus-jIhdwm1f.js +1 -0
- package/dist/client/assets/{monitor-BnslMj28.js → monitor-Bd61vIbY.js} +1 -1
- package/dist/client/assets/{pencil-CT-2s_oA.js → pencil-Kx3rEkBI.js} +1 -1
- package/dist/client/assets/{pendingActionsStore-CwUFtQGR.js → pendingActionsStore-C6o78Bki.js} +1 -1
- package/dist/client/assets/{plus-BEiLnjKx.js → plus-D5yDJAY3.js} +1 -1
- package/dist/client/assets/{refresh-cw-Z4F-mVpF.js → refresh-cw-CxKjA56k.js} +1 -1
- package/dist/client/assets/runDetached-138oevj9.js +1 -0
- package/dist/client/assets/{search-D-PyMvIQ.js → search-mHZVZKtE.js} +1 -1
- package/dist/client/assets/{searchable-select-CBdJ9FND.js → searchable-select-B47fAmOU.js} +1 -1
- package/dist/client/assets/{segmented-control-BSVd0-R_.js → segmented-control--alEtfTe.js} +1 -1
- package/dist/client/assets/{select-DoKKeQr6.js → select-BO0FDRBe.js} +1 -1
- package/dist/client/assets/{settings-header-button-DuU-Cs7B.js → settings-header-button-j3Rd0uOx.js} +1 -1
- package/dist/client/assets/{state-mark-vOaDe8bG.js → state-mark-Wim8WKu4.js} +1 -1
- package/dist/client/assets/{terminal-CCsdLV7K.js → terminal-BLkQOd9o.js} +1 -1
- package/dist/client/assets/{timer.adapter-DpluAhJm.js → timer.adapter-DTTP0Zuq.js} +1 -1
- package/dist/client/assets/{tools-Bp5T17Iw.js → tools-BxqpIPAt.js} +1 -1
- package/dist/client/assets/{triangle-alert-DQWxYfS8.js → triangle-alert-B3zlPujO.js} +1 -1
- package/dist/client/assets/{useAppGlobalState-B6yOUSp4.js → useAppGlobalState-BkMT4XZb.js} +1 -1
- package/dist/client/assets/{useProviderCatalog-BL2w91DB.js → useProviderCatalog-BlO4bNcc.js} +1 -1
- package/dist/client/assets/{useTheme-BH9ZneWq.js → useTheme-DqpsYqBt.js} +1 -1
- package/dist/client/index.html +31 -31
- package/package.json +1 -1
- package/src/server/inbound/deliver-inbound.test.ts +7 -0
- package/src/server/inbound/deliver-inbound.ts +2 -0
- package/src/server/inbox/inbox-boot.test.ts +1 -0
- package/src/server/inbox/inbox-registry.ts +2 -1
- package/src/server/mcp-oauth.adapter.ts +13 -7
- package/src/server/mcp-oauth.test.ts +5 -3
- package/src/server/mcp-sources/mcp-source-client.adapter.test.ts +134 -15
- package/src/server/mcp-sources/mcp-source-client.adapter.ts +38 -12
- package/src/server/mcp-sources/mcp-source-fetch.ts +78 -0
- package/src/server/mcp-sources/mcp-source-runner.test.ts +175 -6
- package/src/server/mcp-sources/mcp-source-runner.ts +90 -47
- package/src/server/mcp-sources-settings.test.ts +24 -0
- package/src/server/mcp-sources-settings.ts +20 -4
- package/src/server/mcp-validator.test.ts +49 -0
- package/src/server/mcp-validator.ts +23 -1
- package/src/shared/mcp-sources/presets.ts +16 -25
- package/src/shared/mcp-sources/types.schema.ts +20 -2
- package/src/shared/mcp-sources/types.ts +14 -1
- package/src/shared/mcp-sources/validate.test.ts +12 -17
- package/src/shared/mcp-sources/validate.ts +1 -1
- package/dist/client/assets/SettingsPage-B80IUZQz.js +0 -16
- package/dist/client/assets/commandFeedback-CxHXOC78.js +0 -1
- package/dist/client/assets/minus-BzIzkqpx.js +0 -1
- package/dist/client/assets/runDetached-eg1AfjiJ.js +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/GenUIBlock-
|
|
2
|
-
import{o as e}from"./rolldown-runtime-BCiCTKAo.js";import{t}from"./react-BWPDF9mI.js";import{t as n}from"./jsx-runtime-BB9-612F.js";import{d as r,f as i,h as a,l as o}from"./pendingActionsStore-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/GenUIBlock-Bv-OFgT5.js","assets/rolldown-runtime-BCiCTKAo.js","assets/react-BWPDF9mI.js","assets/jsx-runtime-BB9-612F.js","assets/pendingActionsStore-C6o78Bki.js","assets/log-CFGrfkV1.js","assets/code-xml-DVVP_fVN.js","assets/select-BO0FDRBe.js","assets/react-dom-2r3XOwTS.js","assets/copyFeedbackStore-CNP3tyq0.js","assets/timer.adapter-DTTP0Zuq.js","assets/focusOverlay-BNpERJzs.js","assets/dist-DQaZwNEz.js","assets/segmented-control--alEtfTe.js","assets/index-DUJdXxNz.js","assets/chunk-6KYCQHYJ-C0N1h4Su.js","assets/useAppGlobalState-BkMT4XZb.js","assets/contextWindow-B9Tu0rKj.js","assets/useProviderCatalog-BlO4bNcc.js","assets/input-DbE6EzUB.js","assets/core-types-Ds7PFmZN.js","assets/appSettingsStore-DhpIEBz2.js","assets/tool-call-types-CtytAxam.js","assets/createScopedStore-jAn6kJBy.js","assets/useTheme-DqpsYqBt.js","assets/dom.adapter-C26vNdMA.js","assets/pathUtils-DTWwEzHK.js","assets/runDetached-138oevj9.js","assets/commandFeedback-2cA8d_WY.js","assets/storage.adapter-DafyA8In.js","assets/inboxStore-q-JHTh--.js","assets/state-mark-Wim8WKu4.js","assets/cronJobsStore-OUyVs58Z.js","assets/ToolCallMessage-DEfxdq5H.js","assets/FilePreviewSheet-DeowWf5y.js","assets/minus-jIhdwm1f.js","assets/plus-D5yDJAY3.js","assets/refresh-cw-CxKjA56k.js","assets/triangle-alert-B3zlPujO.js","assets/preload-helper-BLdHbfdN.js","assets/file-plus-corner-DY_1K1Ne.js","assets/pencil-Kx3rEkBI.js","assets/search-mHZVZKtE.js","assets/terminal-BLkQOd9o.js","assets/formatDuration-BbWTR_M_.js","assets/tools-BxqpIPAt.js","assets/index-D_XO3fZ-.css","assets/info-BcA9_4Qg.js","assets/dist-Bk41vfIT.js","assets/dist-BkGNwYRA.js","assets/lib-BlOM_ItO.js","assets/engine-javascript-Dg4SYqUU.js","assets/dist-Bi13CDSi.js","assets/langs-Co02r6ba.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{o as e}from"./rolldown-runtime-BCiCTKAo.js";import{t}from"./react-BWPDF9mI.js";import{t as n}from"./jsx-runtime-BB9-612F.js";import{d as r,f as i,h as a,l as o}from"./pendingActionsStore-C6o78Bki.js";import{a as s,o as c,r as l}from"./copyFeedbackStore-CNP3tyq0.js";import{t as u}from"./log-CFGrfkV1.js";import{n as d,t as f}from"./createScopedStore-jAn6kJBy.js";import{t as p}from"./preload-helper-BLdHbfdN.js";import{F as m,I as h,L as g,P as _,R as v,n as y,o as ee}from"./useTheme-DqpsYqBt.js";import{t as b}from"./runDetached-138oevj9.js";import{t as te}from"./dom.adapter-C26vNdMA.js";var ne={name:`brain`,size:24,node:[[`path`,{d:`M12 18V5`,key:`adv99a`}],[`path`,{d:`M15 13a4.17 4.17 0 01-3-4 4.17 4.17 0 01-3 4`,key:`5nuw1p`}],[`path`,{d:`M17.707 6.294A3 3 0 1012 5a3 3 0 10-5.707 1.294`,key:`18ldcf`}],[`path`,{d:`M17.996 5.125a4 4 0 012.526 5.77`,key:`1sdu8q`}],[`path`,{d:`M18 18a4 4 0 002-7.465`,key:`7xqqvr`}],[`path`,{d:`M19.967 17.482a4 4 0 11-7.967.517 4 4 0 11-7.967-.517`,key:`t46ysz`}],[`path`,{d:`M6 18a4 4 0 01-2-7.465`,key:`1y2m15`}],[`path`,{d:`M6.004 5.125a4 4 0 00-2.526 5.77`,key:`3cw1ss`}]]};ne.node;var re=a(ne),ie={name:`layout-dashboard`,size:24,node:[[`rect`,{width:`7`,height:`9`,x:`3`,y:`3`,rx:`1`,key:`10lvy0`}],[`rect`,{width:`7`,height:`5`,x:`14`,y:`3`,rx:`1`,key:`16une8`}],[`rect`,{width:`7`,height:`9`,x:`14`,y:`12`,rx:`1`,key:`1hutg5`}],[`rect`,{width:`7`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`ldoo1y`}]]};ie.node;var ae=a(ie);function oe(e){let t={};return e.forEach((e,n)=>{t[n]=e}),t}async function se(e){let t=await e.text();return t?JSON.parse(t):null}var ce={async getJson(e,t={}){let n=await fetch(e,{method:`GET`,signal:t.signal,cache:t.cache,headers:{Accept:`application/json`,...t.headers}}),r=await se(n);return{ok:n.ok,status:n.status,data:r,headers:oe(n.headers)}},async postJson(e,t,n={}){let r=await fetch(e,{method:`POST`,signal:n.signal,cache:n.cache,headers:{"Content-Type":`application/json`,Accept:`application/json`,...n.headers},body:JSON.stringify(t)}),i=await se(r);return{ok:r.ok,status:r.status,data:i,headers:oe(r.headers)}},async postJsonBody(e,t,n={}){let r=await fetch(e,{method:`POST`,signal:n.signal,cache:n.cache,headers:{"Content-Type":`application/json`,Accept:`application/json`,...n.headers},body:JSON.stringify(t)}),i=await se(r);return{ok:r.ok,status:r.status,data:i,headers:oe(r.headers)}},async head(e,t={}){let n=await fetch(e,{method:`HEAD`,signal:t.signal,headers:t.headers});return{ok:n.ok,status:n.status,headers:oe(n.headers)}},async del(e,t={}){let n=await fetch(e,{method:`DELETE`,signal:t.signal,headers:t.headers});return{ok:n.ok,status:n.status}},async streamBytes(e,t={}){let n=await fetch(e,{method:`GET`,signal:t.signal,headers:t.headers});return{body:n.body,ok:n.ok,status:n.status}}},le=e(t(),1);function ue(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);return n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function x(e,...t){throw ue(e,...t)}function de(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);n.search=r.toString(),console.warn(`Minified Lexical warning #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function fe(){return typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0}var pe=fe();function me(){return pe&&`documentMode`in document?document.documentMode:null}var he=me();function ge(e){return pe&&e.test(navigator.platform)}function _e(e){return pe&&e.test(navigator.userAgent)}var ve=ge(/Mac|iPod|iPhone|iPad/),ye=_e(/^(?!.*Seamonkey)(?=.*Firefox).*/i);function be(){return!(!pe||!(`InputEvent`in window)||he)&&`getTargetRanges`in new window.InputEvent(`input`)}var xe=be();function Se(){return pe&&!window.MSStream&&(/iPad|iPhone|iPod/.test(navigator.userAgent)||/Macintosh/.test(navigator.userAgent)&&navigator.maxTouchPoints>1)}var Ce=Se(),we=_e(/Android/),Te=_e(/Version\/[\d.]+.*Safari/)&&!we,Ee=_e(/^(?=.*Chrome).*/i),De=pe&&we&&Ee,Oe=_e(/AppleWebKit\/[\d.]+/)&&ve&&!Ee;function ke(){return 2047}var Ae=ke(),je=Te||Ce||Oe?`\xA0`:``,Me=`
|
|
3
3
|
|
|
4
4
|
`,Ne=ye?`\xA0`:je,Pe={bold:1,capitalize:1024,code:16,highlight:128,italic:2,lowercase:256,strikethrough:4,subscript:32,superscript:64,underline:8,uppercase:512},Fe={directionless:1,unmergeable:2},Ie={center:2,end:6,justify:4,left:1,right:3,start:5};function Le(e){let t={};for(let n of Object.keys(e))t[e[n]]=n;return t}var Re=Le(Ie),ze={normal:0,segmented:2,token:1},Be=Le(ze),Ve=Symbol.for(`@lexical/ctrlOrOtherKey`),He=`$config`;function Ue(){return q()._blockCursorElement}function We(e){return e!==null&&e.nodeType===1&&e.hasAttribute(`data-lexical-slot`)}var Ge=Oe||Ce||Te;function Ke(){let e=G().createElement(`img`);e.setAttribute(`data-lexical-decorator-boundary`,`true`),e.alt=``;for(let[t,n]of[[`position`,`absolute`],[`width`,`0px`],[`height`,`0px`],[`border`,`0px`],[`margin`,`0px`],[`padding`,`0px`]])e.style.setProperty(t,n,`important`);return e}function qe(e){return e!==null&&e.nodeType===1&&e.hasAttribute(`data-lexical-decorator-boundary`)}var Je=class e{element;before;after;constructor(e,t,n){this.element=e,this.before=t||null,this.after=n||null}withBefore(t){return new e(this.element,t,this.after)}withAfter(t){return new e(this.element,this.before,t)}withElement(t){return this.element===t?this:new e(t,this.before,this.after)}insertChild(e){let t=this.getInsertionAnchor();return t!==null&&t.parentElement!==this.element&&x(357),this.element.insertBefore(e,t),this}removeChild(e){return e.parentElement!==this.element&&x(358),this.element.removeChild(e),this}replaceChild(e,t){return t.parentElement!==this.element&&x(359),this.element.replaceChild(e,t),this}getFirstChild(){let e=this.getFirstChildAnchor(),t=e?e.nextSibling:this.element.firstChild;return t===this.getInsertionAnchor()?null:t}getFirstChildAnchor(){return this.after}resolveLeafPosition(e,t,n){if(this.element===e)return t===e&&n===0?`before`:`after`;let r=Ye(e,this.element);if(r===null)return`after`;let i=Array.prototype.indexOf.call(e.childNodes,r);if(i<0)return`after`;if(t===e)return n<=i?`before`:`after`;let a=Ye(e,t);if(a===null)return`after`;let o=Array.prototype.indexOf.call(e.childNodes,a);return o>=0&&o<=i?`before`:`after`}getInsertionAnchor(){return this.before}};function Ye(e,t){let n=t;for(;n!==null&&n.parentNode!==e;)n=n.parentNode;return n}var Xe=class e extends Je{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)}getInsertionAnchor(){return super.getInsertionAnchor()||this.getManagedLineBreak()||this.getDecoratorBoundaryAnchor(`trailing`)}getFirstChildAnchor(){let e=super.getFirstChildAnchor(),t=e?e.nextSibling:this.element.firstChild;for(;We(t);)e=t,t=t.nextSibling;qe(t)&&(e=t,t=t.nextSibling);let n=e?e.nextSibling:this.element.firstChild;return n!==null&&n===Ue()?n:e}getDecoratorBoundaryAnchor(e){let t;if(e===`leading`){let e=super.getFirstChildAnchor();for(t=e?e.nextSibling:this.element.firstChild;We(t);)t=t.nextSibling}else t=this.before?this.before.previousSibling:this.element.lastChild,t!==null&&t===Ue()&&(t=t.previousSibling);return qe(t)?t:null}setDecoratorBoundaryAnchor(e,t){let n=this.getDecoratorBoundaryAnchor(e);if(t!==(n!==null)){if(n!==null)this.element.removeChild(n);else if(e===`leading`){let e=this.getFirstChildAnchor();this.element.insertBefore(Ke(),e?e.nextSibling:this.element.firstChild)}else this.element.insertBefore(Ke(),this.before)}}getManagedLineBreak(){return this.element.__lexicalLineBreak||null}setManagedLineBreak(e){let t=this.element,n=this.after===null?t.firstChild:this.after.nextSibling,r=e===`empty`&&We(n)?null:e;if(t.__lexicalLastChildKind!==r){if(t.__lexicalLastChildKind=r,r===null)this.removeManagedLineBreak();else{let e=r===`decorator`&&Ge;this.insertManagedLineBreak(e)}}}removeManagedLineBreak(){let e=this.getManagedLineBreak();if(e){let t=this.element,n=e.nodeName===`IMG`?e.nextSibling:null;n&&t.removeChild(n),t.removeChild(e),t.__lexicalLineBreak=void 0}}insertManagedLineBreak(e){let t=this.getManagedLineBreak();if(t){if(e===(t.nodeName===`IMG`))return;this.removeManagedLineBreak()}let n=this.element,r=this.before||this.getDecoratorBoundaryAnchor(`trailing`),i=G().createElement(`br`);if(i.setAttribute(`data-lexical-managed-linebreak`,`true`),n.insertBefore(i,r),e){let e=G().createElement(`img`);e.setAttribute(`data-lexical-managed-linebreak`,`true`),e.style.setProperty(`display`,`inline`,`important`),e.style.setProperty(`border`,`0px`,`important`),e.style.setProperty(`margin`,`0px`,`important`),e.alt=``,n.insertBefore(e,i),n.__lexicalLineBreak=e}else n.__lexicalLineBreak=i}getFirstChildOffset(){let e=this.getFirstChild(),t=this.getInsertionAnchor(),n=0;for(let r=this.element.firstChild;r!==null&&r!==e&&r!==t;r=r.nextSibling)n++;return n}resolveChildIndex(e,t,n,r){if(n===this.element){let t=this.getFirstChildOffset(),n=Ue(),i=this.element.childNodes,a=Math.min(r,i.length),o=0;for(let e=t;e<a;e++)i[e]!==n&&o++;return[e,Math.min(o,e.getChildrenSize())]}let i=Ze(t,n);i.push(r);let a=Ze(t,this.element),o=e.getIndexWithinParent();for(let e=0;e<a.length;e++){let t=i[e],n=a[e];if(t===void 0||t<n)break;if(t>n){o+=1;break}}return[e.getParentOrThrow(),o]}};function Ze(e,t){let n=[],r=t;for(;r!==e&&r!==null;r=r.parentNode){let e=0;for(let t=r.previousSibling;t!==null;t=t.previousSibling)e++;n.push(e)}return r!==e&&x(225),n.reverse()}function Qe(){let e;try{e=`0.52.0+prod.esm`}catch{}return e??`"<unknown>+source"`}var $e=Qe(),et=class{_front=new Set;_back=new Set;_cache;get size(){return this._front.size+this._back.size}addBack(e){return delete this._cache,this._front.has(e)||this._back.add(e),this}addFront(e){return delete this._cache,this._back.has(e)||this._front.add(e),this}delete(e){return delete this._cache,this._front.delete(e)||this._back.delete(e)}toArray(){let e=Array.from(this._front).reverse();for(let t of this._back)e.push(t);return e}toReadonlyArray(){return this._cache=this._cache||this.toArray(),this._cache}[Symbol.iterator](){return this.toReadonlyArray()[Symbol.iterator]()}},tt=null;function nt(e,t=1e3){return e instanceof rt?e.clone():e.size<t?new Map(e):new rt().init(new Map(e),void 0,e.size)}var rt=class e{_mutable=!1;_old=void 0;_nursery=void 0;_size=0;clone(){return this._mutable=!1,new e().init(this._old,this._nursery,this._size)}init(e,t,n){return this._old=e,this._nursery=t,this._size=n,this}get size(){return this._size}has(e){return this.get(e)!==void 0}getWithTombstone(e){let t=this._nursery&&this._nursery.get(e);return t===void 0?this._old&&this._old.get(e):t}get(e){let t=this.getWithTombstone(e);return t===tt?void 0:t}shouldCompact(){return this._nursery!==void 0&&2*this._nursery.size>this._size}getNursery(){return this._mutable&&this._nursery||(this.compact(),this._nursery=new Map(this._nursery),this._mutable=!0),this._nursery}compact(e=!1){if(this._nursery&&this._nursery.size>0&&(e||this.shouldCompact())){let e=new Map(this._old);for(let[t,n]of this._nursery)n===tt?e.delete(t):e.set(t,n);this._old=e,this._nursery=void 0}return this._mutable=!1,this}set(e,t){let n=this.getWithTombstone(e);if(n===t)return this;let r=this.getNursery();return n!==tt&&n!==void 0||(this._size++,n===tt&&r.delete(e)),r.set(e,t),this}delete(e){let t=this.has(e);return t&&(this.getNursery().set(e,tt),this._size--),t}getOrInsert(e,t){let n=this.get(e);return n===void 0?(this.set(e,t),t):n}getOrInsertComputed(e,t){let n=this.get(e);if(n!==void 0)return n;let r=t(e);return this.set(e,r),r}clear(){this._mutable=!1,this._old=void 0,this._nursery=void 0,this._size=0}*keys(){for(let e of this.entries())yield e[0]}*values(){for(let e of this.entries())yield e[1]}*entries(){let e=this._nursery,t=this._old;if(e){if(t)for(let n of t){let t=n[0],r=e.get(t);r!==tt&&(r!==void 0&&(n[1]=r),yield n)}for(let n of e)n[1]===tt||t&&t.has(n[0])||(yield n)}else t&&(yield*t)}forEach(e,t){t!==void 0&&(e=e.bind(t));for(let[t,n]of this.entries())e(n,t,this)}get[Symbol.toStringTag](){return`GenMap`}[Symbol.iterator](){return this.entries()}},it=!1;function at(e,t,...n){let r=it,i;try{it=e,i=t()}finally{it=r}var a;return(a=i)===null||typeof a!=`object`&&typeof a!=`function`||typeof a.then!=`function`||x(421),i}function ot(){return it}function st(e){let t=e.exportJSON(it),n=e.constructor;return t.type!==n.getType()&&x(130,n.name),I(e)&&!Array.isArray(t.children)&&x(59,n.name),t}function ct(e,t,n,r,i,a){if(I(e)){let o=e.getFirstChild();for(;o!==null;){let e=o.__key;o.__parent===t&&((I(o)||Qu(o)&&o.__slots!==null)&&ct(o,e,n,r,i,a),n.has(e)||a.delete(e),i.push(e)),o=o.getNextSibling()}}for(let o of Qu(e)&&e.__slots!==null?e.__slots.values():[]){let e=r.get(o);e!==void 0&&$u(e)&&e.__slotHost===t&&((I(e)||Qu(e)&&e.__slots!==null)&&ct(e,o,n,r,i,a),n.has(o)||a.delete(o),i.push(o))}}var lt=!1,ut=0;function dt(e){ut=e.timeStamp}function ft(e,t,n){let r=e.nodeName===`BR`,i=t.__lexicalLineBreak;return i&&(e===i||r&&e.previousSibling===i)||r&&Gc(e,n)!==void 0}function pt(e,t,n){let r=Fl(Tl(n)),i=r&&Wl(r,n._rootElement),a=null,o=null;i!==null&&i.anchorNode===e&&(a=i.anchorOffset,o=i.focusOffset);let s=e.nodeValue;s!==null&&il(t,s,a,o,!1)}function mt(e,t,n){if(A(e)){let t=e.anchor.getNode();if(t.is(n)&&e.format!==t.getFormat())return!1}return Pc(t)&&n.isAttached()}function ht(e,t,n){for(let r=e;r&&!vu(r);r=_l(r)){let e=Gc(r,t);if(e!==void 0){let t=V(e,n);if(t)return L(t)||!K(r)?void 0:[r,t]}}}function gt(e,t,n){lt=!0;let r=performance.now()-ut>100;try{Cs(e,()=>{let i=M()||function(e){return e.read(`latest`,()=>{let e=M();return e===null?null:e.clone()})}(e),a=new Map,o=e._editorState,s=e._blockCursorElement,c=!1,l=``;for(let n=0;n<t.length;n++){let u=t[n],d=u.type,f=u.target,p=ht(f,e,o);if(!p)continue;let[m,h]=p;if(d===`characterData`)r&&k(h)&&Pc(f)&&mt(i,f,h)&&pt(f,h,e);else if(d===`childList`){c=!0;let t=u.addedNodes;for(let n=0;n<t.length;n++){let r=t[n],i=Uc(r),a=r.parentNode;if(!(a==null||r===s||i!==null||ft(r,a,e)||qe(r)||e._slotsUsed&&K(r)&&r.hasAttribute(`data-lexical-slot`)||vu(r))){if(ye){let e=(K(r)?r.innerText:null)||r.nodeValue;e&&(l+=e)}a.removeChild(r)}}let n=u.removedNodes,r=n.length;if(r>0){let t=0;for(let i=0;i<r;i++){let r=n[i];ft(r,f,e)||s===r?(f.appendChild(r),t++):qe(r)&&t++}r!==t&&a.set(m,h)}}}if(a.size>0)for(let[t,n]of a)n.reconcileObservedMutation(t,e);let u=n.takeRecords();if(u.length>0){for(let t=0;t<u.length;t++){let n=u[t],r=n.addedNodes,i=n.target;for(let t=0;t<r.length;t++){let n=r[t],a=n.parentNode;a==null||n.nodeName!==`BR`||ft(n,i,e)||a.removeChild(n)}}n.takeRecords()}i!==null&&(c&&Xc(i),ye&&hl(e)&&i.insertRawText(l))})}finally{lt=!1}}function _t(e){let t=e._observer;t!==null&>(e,t.takeRecords(),t)}function vt(e){(function(e){ut===0&&Tl(e).addEventListener(`textInput`,dt,!0)})(e),e._observer=new MutationObserver((t,n)=>{gt(e,t,n)})}function yt(e,t,n){let{isEqual:r}=e;return t===n||r!==void 0&&r(t,n)}function bt(e,t){return yt(e,t,e.defaultValue)}function xt(e){return typeof e==`object`&&!!e}function St(e,t){let n=Dt(e,t).getter;return xt(n)&&n.getterTable!==void 0||x(405,t),Et(n.getterTable)}function Ct(e,t){let n=Dt(e,t).setter;return xt(n)&&n.setterTable!==void 0||x(406,t),Et(n.setterTable)}function wt(e,t,n){let{meta:r}=Dt(e,t);for(let e=0;;)if(r.kind===`aliased`){if(e===n)return Et(r.aliases);e++,r=r.inner.meta}else r.kind===`nullable`||r.kind===`optional`?r=r.inner.meta:r.kind===`array`?r=r.item.meta:x(407,t,String(n))}function Tt(e,t){let n=Dt(e,t),{setter:r}=n;xt(r)&&r.setterTable!==void 0||x(408,t);let i=String(n.defaultValue);return It(r.setterTable,i)||x(409,t,i),r.setterTable[i]}function Et(e){return Object.assign(Object.create(null),e)}function Dt(e,t){let n=e.get(t);return n===void 0&&x(410,t),n}function Ot(e,t,n,r,i){i!==void 0&&kt.add(i);let a=n===void 0,o=a?e(void 0):n;return a&&Mt(o),Object.assign(e,{accepts:i,defaultValue:o,isEqual:r,meta:t})}var kt=new WeakSet,At=new WeakSet;function jt(e){return typeof e==`object`&&e&&At.add(e),e}function Mt(e){if(typeof e==`object`&&e&&!Object.isFrozen(e)&&!At.has(e)){Object.freeze(e);for(let t of Object.values(e))Mt(t)}}function Nt(e){let{isEqual:t}=e;return t===void 0?void 0:(e,n)=>e==null||n==null?e===n:t(e,n)}function Pt(e,t){return n=>t(n)||Ft(e,n)}function Ft(e,t){let{accepts:n}=e;return n===void 0?function(e,t){let{accepts:n}=e;if(n!==void 0)return Ft(e,t)?{parsed:e(t)}:void 0;let r=e(t);return bt(e,r)&&t!==e.defaultValue?void 0:{parsed:r}}(e,t)!==void 0:n.call(e,t)}function It(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Lt(e=``){return Ot(t=>typeof t==`string`?t:e,{kind:`string`},void 0,void 0,e=>typeof e==`string`)}var Rt=/^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$/;function zt(e=0,t={}){let{integer:n,clamp:r}=t,i=n&&t.min!==void 0?Math.ceil(t.min):t.min,a=n&&t.max!==void 0?Math.floor(t.max):t.max,o=e=>typeof e==`string`&&Rt.test(e)?Number(e):e,s=e=>typeof e==`number`&&Number.isFinite(e)&&(!n||Number.isInteger(e)),c=e=>s(e)&&(i===void 0||e>=i)&&(a===void 0||e<=a);return Ot(t=>{let n=o(t);return r&&s(n)?i!==void 0&&n<i?i:a!==void 0&&n>a?a:n:c(n)?n:e},{clamp:r,integer:n,kind:`number`,max:a,min:i},void 0,void 0,e=>r?s(o(e)):c(o(e)))}function Bt(e=!1){return Ot(t=>typeof t==`boolean`?t:e,{kind:`boolean`},void 0,void 0,e=>typeof e==`boolean`)}function Vt(e,...t){let n=jt(t.length===0?e[0]:t[0]),r=new Set(e);return Ot(e=>e!==void 0&&r.has(e)?e:n,{kind:`enum`,values:e},n,void 0,e=>r.has(e)&&(e!==void 0||n===void 0))}function Ht(e,t={}){let{defaultAsNull:n}=t;return Ot(t=>{if(t==null)return null;let r=e(t);return n&&bt(e,r)?null:r},{defaultAsNull:n,inner:e,kind:`nullable`},void 0,Nt(e),Pt(e,e=>e==null))}function Ut(e,t={}){let{omitDefault:n}=t;return Ot(t=>{if(t===void 0)return;let r=e(t);return n&&bt(e,r)?void 0:r},{inner:e,kind:`optional`,omitDefault:n},void 0,Nt(e),Pt(e,e=>e===void 0))}function Wt(){return e=>function(e){return{meta:{fields:e,kind:`node`}}}(e)}function Gt(e,t){let n=e=>typeof e==`string`&&It(t,e);return Ot(r=>n(r)?t[r]:e(r),{aliases:t,inner:e,kind:`aliased`},e.defaultValue,e.isEqual,t=>n(t)||Ft(e,t))}function Kt(e){return Ot(t=>{if(!Array.isArray(t))return[];let n=Array(t.length);for(let r=0;r<t.length;r++)n[r]=e(t[r]);return n},{item:e,kind:`array`},void 0,(t,n)=>{if(!Array.isArray(t)||!Array.isArray(n)||t.length!==n.length)return!1;for(let r=0;r<t.length;r++)if(!yt(e,t[r],n[r]))return!1;return!0},e=>Array.isArray(e))}function S(e,t){return Jt(0,e,{getter:{field:t.field,getterTable:t.getterTable,method:t.getter,when:t.when},setter:{field:t.field,method:t.setter,setterTable:t.setterTable}})}function qt(e,t){return Jt(0,e,t)}function Jt(e,t,n){return Object.assign(e=>t(e),{accepts:t.accepts,defaultValue:t.defaultValue,getter:n.getter,isEqual:t.isEqual,meta:t.meta,setter:n.setter})}var Yt=`latest`,Xt=class{key;parse;unparse;isEqual;defaultValue;resetOnCopyNode;schema;constructor(e,t){this.key=e;let n=`meta`in(r=t.parse)&&typeof r.meta==`object`&&r.meta!==null&&`kind`in r.meta&&typeof r.meta.kind==`string`&&`defaultValue`in r?t.parse:void 0;var r;this.schema=n,this.parse=t.parse.bind(t),this.unparse=(t.unparse||sn).bind(t),this.isEqual=t.isEqual?t.isEqual.bind(t):n!==void 0&&n.isEqual!==void 0?(e,t)=>yt(n,e,t):Object.is,this.defaultValue=n===void 0?this.parse(void 0):n.defaultValue,this.resetOnCopyNode=t.resetOnCopyNode||!1}};function Zt(e,t){return new Xt(e,t)}function Qt(e,t,n=Yt){let r=(n===`latest`?e.getLatest():e).__state;return r?r.getValue(t):t.defaultValue}function $t(e,t,n){let r;if(ns(),typeof n==`function`){let i=e.getLatest(),a=Qt(i,t);if(r=n(a),t.isEqual(a,r))return i}else r=n;let i=e.getWritable();return rn(i).updateFromKnown(t,r),i}function en(e){let t=new Map,n=new Set;for(let{ownNodeConfig:r}of Ku(typeof e==`function`?e:e.replace))if(r&&r.stateConfigs)for(let e of r.stateConfigs){let r;`stateConfig`in e?(r=e.stateConfig,e.flat&&n.add(r.key)):r=e,t.set(r.key,r)}return{flatKeys:n,sharedConfigMap:t}}var tn=new Set([`__proto__`,`constructor`,`prototype`]),nn=class e{node;knownState;unknownState;sharedNodeState;size;constructor(e,t,n=void 0,r=new Map,i=void 0){this.node=e,this.sharedNodeState=t,this.unknownState=n,this.knownState=r;let{sharedConfigMap:a}=this.sharedNodeState,o=i===void 0?function(e,t,n){let r=n.size;if(t)for(let i in t){let t=e.get(i);t&&n.has(t)||r++}return r}(a,n,r):i;this.size=o}getValue(e){let t=this.knownState.get(e);if(t!==void 0)return t;this.sharedNodeState.sharedConfigMap.set(e.key,e);let n=e.defaultValue;if(this.unknownState&&e.key in this.unknownState){let t=this.unknownState[e.key];t!==void 0&&(n=e.parse(t)),this.updateFromKnown(e,n)}return n}getInternalState(){return[this.unknownState,this.knownState]}toJSON(){let e={...this.unknownState},t={};for(let[t,n]of this.knownState)t.isEqual(n,t.defaultValue)?delete e[t.key]:e[t.key]=t.unparse(n);for(let n of this.sharedNodeState.flatKeys)n in e&&(t[n]=e[n],delete e[n]);return on(e)&&(t.$=e),t}getWritable(t){if(this.node===t)return this;let{sharedNodeState:n,unknownState:r}=this,i=new Map(this.knownState);return new e(t,n,function(e,t,n){let r;if(n)for(let[i,a]of Object.entries(n)){if(tn.has(i))continue;let n=e.get(i);n?t.has(n)||t.set(n,n.parse(a)):(r||={},r[i]=a)}return r}(n.sharedConfigMap,i,r),i,this.size)}resetOnCopyNode(){for(let e of this.knownState.keys())e.resetOnCopyNode&&this.knownState.set(e,e.defaultValue);return this}updateFromKnown(e,t){let n=e.key;this.sharedNodeState.sharedConfigMap.set(n,e);let{knownState:r,unknownState:i}=this;r.has(e)||i&&n in i||(i&&(delete i[n],this.unknownState=on(i)),this.size++),r.set(e,t)}updateFromUnknown(e,t){if(tn.has(e))return;let n=this.sharedNodeState.sharedConfigMap.get(e);n?this.updateFromKnown(n,n.parse(t)):(this.unknownState=this.unknownState||{},e in this.unknownState||this.size++,this.unknownState[e]=t)}updateFromJSON(e){let{knownState:t}=this;for(let e of t.keys())t.set(e,e.defaultValue);if(this.size=t.size,this.unknownState=void 0,e)for(let[t,n]of Object.entries(e))this.updateFromUnknown(t,n)}};function rn(e){let t=e.getWritable(),n=t.__state?t.__state.getWritable(t):new nn(t,function(e){return e.__state?e.__state.sharedNodeState:wc(q(),e.getType()).sharedNodeState}(t));return t.__state=n,n}function an(e,t){let n=e.getWritable(),r=t.$;return(n.__state||r)&&rn(e).updateFromJSON(r),n}function on(e){if(e)for(let t in e)return e}function sn(e){return e}function cn(e,t,n){for(let[r,i]of t.knownState){if(e.has(r.key))continue;e.add(r.key);let t=n?n.getValue(r):r.defaultValue;if(t!==i&&!r.isEqual(t,i))return!0}return!1}function ln(e,t,n){let{unknownState:r}=t,i=n?n.unknownState:void 0;if(r){for(let[t,n]of Object.entries(r))if(!e.has(t)&&(e.add(t),n!==(i?i[t]:void 0)))return!0}return!1}function un(e,t){let n=e.__state;return n&&n.node===e?n.getWritable(t):n}function dn(e,t){let n=e.__mode,r=e.__format,i=e.__style,a=t.__mode,o=t.__format,s=t.__style,c=e.__state,l=t.__state;return(n===null||n===a)&&(r===null||r===o)&&(i===null||i===s)&&(e.__state===null||c===l||function(e,t){if(e===t)return!0;let n=new Set;return!(e&&cn(n,e,t)||t&&cn(n,t,e)||e&&ln(n,e,t)||t&&ln(n,t,e))}(c,l))}function fn(e,t){let n=e.mergeWithSibling(t),r=P()._normalizedNodes;return r.add(e.__key),r.add(t.__key),n}function pn(e){let t,n,r=e;if(r.__text!==``||!r.isSimpleText()||r.isUnmergeable()){for(;(t=r.getPreviousSibling())!==null&&k(t)&&t.isSimpleText()&&!t.isUnmergeable();){if(t.__text!==``){if(dn(t,r)){r=fn(t,r);break}break}t.remove()}for(;(n=r.getNextSibling())!==null&&k(n)&&n.isSimpleText()&&!n.isUnmergeable();){if(n.__text!==``){if(dn(r,n)){r=fn(r,n);break}break}n.remove()}}else r.remove()}function mn(e){return hn(e.anchor),hn(e.focus),e}function hn(e){for(;e.type===`element`;){let t=e.getNode(),n=e.offset,r,i;if(n===t.getChildrenSize()?(r=t.getChildAtIndex(n-1),i=!0):(r=t.getChildAtIndex(n),i=!1),k(r)){e.set(r.__key,i?r.getTextContentSize():0,`text`,!0);break}if(!I(r))break;e.set(r.__key,i?r.getChildrenSize():0,`element`,!0)}}var gn=Symbol.for(`@lexical/CachedTextSize`);function _n(e,t){return jn.read(()=>{let n=0,r=e;for(let e=0;e<t&&r!==null;e++){let i=An.get(r);if(i===void 0&&x(345,r),I(i)){let a=E.get(r);if(a!==void 0&&I(a)&&a.__parent!==i.__parent)n+=i.getTextContentSize();else{let e=Mn.get(r),t=e&&e.__lexicalTextContent;typeof t!=`string`&&x(346,i.getType()),n+=t.length}e<t-1&&!i.isInline()&&(n+=2)}else{let e=i[gn];e===void 0&&x(347,i.getType(),r),n+=e}r=i.__next}return n},{editor:C})}function vn(e){I(e)||e[gn]===void 0&&(e[gn]=k(e)?e.__text.length:e.getTextContentSize())}var yn=4,bn,C,xn,w=``,T=null,Sn=null,Cn=null;function wn(){return{firstTextKey:Cn,format:T,style:Sn}}function Tn(e){e.firstTextKey!==null&&(T=e.format,Sn=e.style,Cn=e.firstTextKey)}function En(e){if(Cn!==null)return;let t=e.__lexicalFirstTextKey;if(t===void 0&&x(348),t===null)return;let n=E.get(t);k(n)&&(T=n.getFormat(),Sn=n.getStyle(),Cn=t)}var Dn,On,kn,An,jn,E,Mn,Nn,Pn,Fn,In=!1,Ln=!1;function Rn(e,t){let n=An.get(e),r=E.has(e);if(t!==null){let n=lr(e);n.parentNode===t&&t.removeChild(n)}if(!r){if(C._keyToDOMMap.delete(e),I(n)){let e=Yu(n,An);zn(e,0,e.length-1,null)}if(n!==void 0){for(let e of Jn(n).values()){let t=Xn(e);Rn(e,null),t!==null&&t.remove()}dl(Pn,xn,Dn,n,`destroyed`)}}}function zn(e,t,n,r){for(let i=t;i<=n;++i){let t=e[i];t!==void 0&&Rn(t,r)}}function Bn(e,t){e.setProperty(`text-align`,t)}var Vn=`40px`;function Hn(e,t){let n=bn.theme.indent;if(typeof n==`string`){let r=e.classList.contains(n);t>0&&!r?e.classList.add(n):t<1&&r&&e.classList.remove(n)}e.style.setProperty(`padding-inline-start`,t===0?``:`calc(${t} * var(--lexical-indent-base-value, ${Vn}))`),ll(e,`class`),ll(e,`style`)}function Un(e,t){let n=e.style;t===0?Bn(n,``):t===1?Bn(n,`left`):t===2?Bn(n,`center`):t===3?Bn(n,`right`):t===4?Bn(n,`justify`):t===5?Bn(n,`start`):t===6&&Bn(n,`end`),ll(e,`style`)}function Wn(e,t){let n=function(e){let t=e.__dir;if(t!==null)return t;if(R(e))return null;let n=e.getParent();return n===null||W(n)&&n.__dir===null?`auto`:null}(t);n===null?e.removeAttribute(`dir`):e.dir=n}function Gn(e){let t=G().createElement(`div`);return t.setAttribute(`data-lexical-slot`,e),t.style.display=`none`,t}function Kn(e,t,n){t||e.contentEditable===`false`?yu(n,C):n.removeAttribute(`contenteditable`)}function qn(e,t,n){let r=w,i=wn();w=``;let a=``,o=L(e);for(let[r,i]of n){let n=Gn(r);Kn(t,o,n),t.appendChild(n),w=``;let s=wn();Qn(i,ou(e,n,C)),Tn(s),Yn(e,r,t,n),a+=w}return Tn(i),w=r,a}function Jn(e){return Qu(e)&&e.__slots!==null?e.__slots:Zu}function Yn(e,t,n,r){let i=Fn.$getSlotTargetElement(e,t,n,C);i!==null&&(r.parentElement!==i&&i.appendChild(r),r.style.display=``)}function Xn(e){let t=Mn.get(e);return t===void 0?null:t.parentElement}function Zn(e,t,n){let r=Jn(e),i=Jn(t);for(let[e,t]of r)if(!i.has(e)){let e=Xn(t);Rn(t,null),e!==null&&e.remove()}let a=w,o=wn(),s=``,c=null,l=L(t);for(let[e,a]of i){let i=r.get(e),o=i===void 0?null:Xn(i);w=``;let u=wn();if(o===null){o=Gn(e);let r=null;for(let e of n.children)if(!e.hasAttribute(`data-lexical-slot`)){r=e;break}n.insertBefore(o,r),Qn(a,ou(t,o,C))}else i===a?ir(a,o):(i!==void 0&&Rn(i,o),Qn(a,ou(t,o,C)));if(Tn(u),Kn(n,l,o),Yn(t,e,n,o),s+=w,o.parentElement===n){let e=c===null?n.firstChild:c.nextSibling;e!==o&&n.insertBefore(o,e),c=o}}return Tn(o),w=a,s}function Qn(e,t){let n=E.get(e);if(n===void 0&&x(60),t!==null){let r=An.get(e);if(r!==void 0){let i=Mn.get(e);if(i!==void 0){let a=$u(r)?r.__slotHost:null,o=$u(n)?n.__slotHost:null,s=r.__parent!==n.__parent||a!==o,c=o!==null&&i.parentElement!==t.element;if(s||c)return t.insertChild(i),ir(e,t.element)}}}let r=Fn.$createDOM(n,C);if(function(e,t,n){let r=n._keyToDOMMap;Wc(t,n,e),r.set(e,t)}(e,r,C),k(n)?r.setAttribute(`data-lexical-text`,`true`):L(n)&&(r.setAttribute(`data-lexical-decorator`,`true`),_u(r,{captureSelection:!0})),I(n)){let e=n.__indent,t=n.__size;Wn(r,n),e!==0&&Hn(r,e);let i=Jn(n),a=i.size>0?qn(n,r,i):``;if(t===0)r.__lexicalTextContent=a,r.__lexicalFirstTextKey=null,w+=a,i.size>0&&(r.__lexicalSlotTextLength=a.length);else{let e=w,o=t-1;if($n(Yu(n,E),n,0,o,ou(n,r,C)),a!==``){let t=r.__lexicalTextContent||``;r.__lexicalTextContent=a+t,w=e+a+t}i.size>0&&(r.__lexicalSlotTextLength=a.length)}let o=n.__format;o!==0&&Un(r,o),n.isInline()||(nr(0,n,r),tr(n,r))}else{let t=n.getTextContent();if(L(n)){let t=n.decorate(C,bn);t!==null&&ar(e,t),r.contentEditable=`false`;let i=Jn(n);i.size>0&&qn(n,r,i)}w+=t}return t!==null&&t.insertChild(r),Fn.$decorateDOM(n,null,r,C),vn(n),dl(Pn,xn,Dn,n,`created`),r}function $n(e,t,n,r,i){let a=w,o=wn();w=``,T=null,Sn=null,Cn=null;let s=n;for(;s<=r;++s){let t=wn();Qn(e[s],i);let n=E.get(e[s]);n!==null&&k(n)?T===null&&(T=n.getFormat(),Sn=n.getStyle(),Cn=n.__key):I(n)&&s<r&&!n.isInline()&&(w+=Me),Tn(t)}let c=C._keyToDOMMap.get(t.__key);c===void 0&&x(349,t.__key),c.__lexicalTextContent=w,c.__lexicalFirstTextKey=Cn,w=a+w,Tn(o)}function er(e,t){if(!e)return!1;let n=t.get(e);return L(n)&&!n.isInline()}function tr(e,t){let n=ou(e,t,C);n.setDecoratorBoundaryAnchor(`leading`,er(e.__first,E)),n.setDecoratorBoundaryAnchor(`trailing`,er(e.__last,E))}function nr(e,t,n){let r=ou(t,n,C),i=function(e,t){if(e){let n=e.__last;if(n){let e=t.get(n);if(e)return z(e)?`line-break`:L(e)&&e.isInline()?`decorator`:null}return`empty`}return null}(t,E);r.setManagedLineBreak(i)}function rr(e,t,n){let r=t.__lexicalFirstTextKey;if(r!=null){let t=e.__key,i=r;for(;i!==null;){let e=E.get(i);if(e===void 0){i=null;break}if(e.__parent===t)break;i=e.__parent}if(i!==null&&!n.has(i)){let e=E.get(r);if(k(e))return T=e.getFormat(),void(Sn=e.getStyle())}}t.__lexicalFirstTextKey=Cn}function ir(e,t){let n=An.get(e),r=E.get(e);n!==void 0&&r!==void 0||x(61);let i=In||kn.has(e)||On.has(e),a=gl(C,e);if(n===r&&!i){let e;if(I(n)){let t=a.__lexicalTextContent;typeof t!=`string`&&x(355,n.getType()),e=t,En(a)}else e=n.getTextContent();return w+=e,a}if(n!==r&&i&&dl(Pn,xn,Dn,r,`updated`),Fn.$updateDOM(r,n,a,C)){let n=Qn(e,null);return t===null&&x(62),t.replaceChild(n,a),Rn(e,null),n}if(I(n)){I(r)||x(334,e);let t=r.__indent;(In||t!==n.__indent)&&Hn(a,t);let o=r.__format;(In||o!==n.__format)&&Un(a,o);let s=i&&(Jn(r).size>0||Jn(n).size>0)?Zn(n,r,a):``;if(i){let e=w;if(function(e,t,n){var r;T=null,Sn=null,Cn=null,function(e,t,n){let r=w,i=e.__size,a=t.__size;w=``;let o=n.element,s=C._keyToDOMMap.get(t.__key);s===void 0&&x(351,t.__key);let c=a-i;if(!In&&Math.abs(c)<=1&&i>=yn&&e.__first===t.__first&&(c!==0||!C._cloneNotNeeded.has(e.__key))){let i=s.__lexicalTextContent,l=Nn.get(e.__key);if(!In&&typeof i==`string`&&l!==void 0){let a=function(e,t){let n=t.size;if(n===0||n>=e.__size)return null;let r=e.__last,i=null,a=0;for(;r!==null&&a<n;){if(!t.has(r))return null;i=r;let e=E.get(r);if(e===void 0)return null;r=e.__prev,a++}return a!==n||r!==null&&t.has(r)?null:i}(t,l);if(a!==null){let u=l.size;if(c===0){let e=_n(a,u),n=a,c=0;for(;n!==null&&c<u;){let e=E.get(n);if(e===void 0)break;let t=wn();ir(n,o),k(e)&&T===null&&(T=e.getFormat(),Sn=e.getStyle(),Cn=e.__key),Tn(t),n=e.__next,c++}let d=``;for(n=a,c=0;n!==null&&c<u;){let e=E.get(n);if(e===void 0)break;let t;if(I(e)){let r=C._keyToDOMMap.get(n),i=r&&r.__lexicalTextContent;typeof i!=`string`&&x(352,e.getType()),t=i}else t=e.getTextContent();d+=t,c<u-1&&I(e)&&!e.isInline()&&(d+=Me),n=e.__next,c++}let f=s.__lexicalSlotTextLength||0,p=f>0?i.slice(f):i,m=p.slice(0,p.length-e)+d;s.__lexicalTextContent=m,w=r+m,rr(t,s,l);return}if(function(e,t,n,r,i,a,o,s){if(s!==1&&s!==-1||o!==(s===1?2:1))return!1;let c=o-s,l=e.__last;for(let e=0;e<c-1;e++){if(l===null)return!1;let e=An.get(l);if(e===void 0)return!1;l=e.__prev}if(l===null)return!1;let u=E.get(a),d=An.get(l);if(u===void 0||d===void 0||u.__prev!==d.__prev)return!1;let f=[],p=a;for(let e=0;e<o;e++){if(p===null)return!1;f.push(p);let e=E.get(p);p=e?e.__next:null}let m=[];p=l;for(let e=0;e<c;e++){if(p===null)return!1;m.push(p);let e=An.get(p);p=e?e.__next:null}let h=new Set(m),g=new Set(f),_=[],v=0,y=0;for(;v<c&&y<o;)if(f[y]===m[v])_.push({key:f[y],kind:`reconcile`}),v++,y++;else if(g.has(m[v])){if(h.has(f[y]))return!1;_.push({key:f[y],kind:`create`,nextIndex:y}),y++}else _.push({key:m[v],kind:`destroy`}),v++;for(;v<c;)_.push({key:m[v++],kind:`destroy`});for(;y<o;)_.push({key:f[y],kind:`create`,nextIndex:y}),y++;let ee=_n(l,c);for(let e of _){let t=wn();if(e.kind===`reconcile`)ir(e.key,n.element);else if(e.kind===`destroy`)Rn(e.key,n.element);else{let t=null;for(let n=e.nextIndex+1;n<o;n++){let e=C._keyToDOMMap.get(f[n]);if(e!==void 0){t=e;break}}Qn(e.key,n.withBefore(t??n.before))}if(e.kind!==`destroy`){let t=E.get(e.key);t&&k(t)&&T===null&&(T=t.getFormat(),Sn=t.getStyle(),Cn=t.__key)}Tn(t)}let b=``;for(let e=0;e<o;e++){let t=E.get(f[e]);if(t===void 0)return!1;let n;if(I(t)){let r=C._keyToDOMMap.get(f[e]),i=r&&r.__lexicalTextContent;typeof i!=`string`&&x(350,t.getType()),n=i}else n=t.getTextContent();b+=n,e<o-1&&I(t)&&!t.isInline()&&(b+=Me)}let te=r.__lexicalSlotTextLength||0,ne=te>0?i.slice(te):i;return r.__lexicalTextContent=ne.slice(0,ne.length-ee)+b,!0}(e,0,n,s,i,a,u,c)){let e=s.__lexicalTextContent;typeof e!=`string`&&x(353),w=r+e,rr(t,s,l);return}}}if(c===0){let t=e.__first,n=0;for(;t!==null;){let e=E.get(t);if(e===void 0)break;let r=In||kn.has(t)||On.has(t),i=wn();if(r)ir(t,o);else{let n,r;if(I(e)){r=Mn.get(t);let i=r&&r.__lexicalTextContent;typeof i!=`string`&&x(354,e.getType()),n=i}else n=e.getTextContent();w+=n,r!==void 0&&En(r)}k(e)?T===null&&(T=e.getFormat(),Sn=e.getStyle(),Cn=e.__key):I(e)&&n<a-1&&!e.isInline()&&(w+=Me),Tn(i),t=e.__next,n++}s.__lexicalTextContent=w,s.__lexicalFirstTextKey=Cn,w=r+w;return}}if(i===1&&a===1){let r=e.__first,i=t.__first;if(r===i)ir(r,o);else{let e=lr(r),t=Qn(i,null);try{e.parentNode===o?o.replaceChild(t,e):n.insertChild(t)}catch(n){if(typeof n==`object`&&n){let a=`${n.toString()} Parent: ${o.tagName}, new child: {tag: ${t.tagName} key: ${i}}, old child: {tag: ${e.tagName}, key: ${r}}.`;throw Error(a)}throw n}Rn(r,null)}let a=E.get(i);k(a)&&T===null&&(T=a.getFormat(),Sn=a.getStyle(),Cn=a.__key)}else{let r=Yu(e,An),s=Yu(t,E);if(r.length!==i&&x(227),s.length!==a&&x(228),i===0)a!==0&&$n(s,t,0,a-1,n);else if(a===0){if(i!==0){let e=n.after==null&&n.before==null&&Jn(t).size===0&&n.element.__lexicalLineBreak==null;zn(r,0,i-1,e?null:o),e&&(o.textContent=``)}}else(function(e,t,n,r,i,a){let o=r-1,s=i-1,c,l,u=a.getFirstChild(),d=0,f=0;for(;d<=o&&f<=s;){let e=t[d],r=n[f],i=wn();if(e===r)u=or(ir(r,a.element)),d++,f++;else{if(l===void 0&&(l=sr(n,f)),c===void 0)c=sr(t,d);else if(!c.has(e)){d++,Tn(i);continue}if(!l.has(e)){u=or(lr(e)),Rn(e,a.element),d++,c.delete(e),Tn(i);continue}if(c.has(r)){let e=gl(C,r);e!==u&&a.withBefore(u??a.before).insertChild(e),u=or(ir(r,a.element)),d++,f++}else Qn(r,a.withBefore(u??a.before)),f++}let o=E.get(r);o!==null&&k(o)?T===null&&(T=o.getFormat(),Sn=o.getStyle(),Cn=o.__key):I(o)&&f<=s&&!o.isInline()&&(w+=Me),Tn(i)}let p=d>o,m=f>s;if(p&&!m){let t=n[s+1],r=t===void 0?null:C.getElementByKey(t);$n(n,e,f,s,a.withBefore(r??a.before))}else m&&!p&&zn(t,d,o,a.element)})(t,r,s,i,a,n)}s.__lexicalTextContent=w,s.__lexicalFirstTextKey=Cn,w=r+w}(e,t,ou(t,n,C)),W(t)||(r=t,T==null||T===r.__textFormat||Ln||r.setTextFormat(T),function(e){Sn==null||Sn===e.__textStyle||Ln||e.setTextStyle(Sn)}(t))}(n,r,a),r.isInline()||(R(r)||nr(0,r,a),tr(r,a)),s!==``){let t=a.__lexicalTextContent||``;a.__lexicalTextContent=s+t,w=e+s+t,a.__lexicalSlotTextLength=s.length}else(Jn(r).size>0||Jn(n).size>0)&&(a.__lexicalSlotTextLength=0)}else{let e=a.__lexicalTextContent;typeof e!=`string`&&x(356,n.getType()),w+=e,En(a)}if((In||r.__dir!==n.__dir||r.__parent!==n.__parent)&&(Wn(a,r),R(r)&&!In))for(let e of r.getChildren())I(e)&&Wn(gl(C,e.getKey()),e)}else{let t=r.getTextContent();if(L(r)){let t=r.decorate(C,bn);t!==null&&ar(e,t),i&&(Jn(r).size>0||Jn(n).size>0)&&Zn(n,r,a)}w+=t}if(!Ln&&R(r)){let e=r.getLatest();if(e.__cachedText!==w){let t=e.getWritable();t.__cachedText=w,r=t}}return Fn.$decorateDOM(r,n,a,C),vn(r),a}function ar(e,t){let n=C._pendingDecorators,r=C._decorators;if(n===null){if(r[e]===t)return;n=qc(C)}n[e]=t}function or(e){let t=e.nextSibling;return t!==null&&t===C._blockCursorElement&&(t=t.nextSibling),t}function sr(e,t){let n=new Set;for(let r=t;r<e.length;r++)n.add(e[r]);return n}function cr(e,t,n,r,i,a){w=``,T=null,Sn=null,Cn=null,In=r===2,C=n,bn=n._config,Fn=n._config.dom||hc,xn=n._nodes,Dn=C._listeners.mutation,On=i,kn=a,An=e._nodeMap,jn=e,E=t._nodeMap,Ln=t._readOnly,Mn=nt(n._keyToDOMMap),Nn=function(){let e=new Map,t=t=>{for(let n of t){let t=E.get(n);if(t===void 0)continue;let r=t.__parent;if(r===null)continue;let i=e.get(r);i===void 0&&(i=new Set,e.set(r,i)),i.add(n)}};return t(On.keys()),t(kn),e}();let o=new Map;return Pn=o,ir(`root`,null),C=void 0,xn=void 0,On=void 0,kn=void 0,An=void 0,jn=void 0,E=void 0,bn=void 0,Mn=void 0,Nn=void 0,Pn=void 0,Fn=hc,o}function lr(e){let t=Mn.get(e);return t===void 0&&x(75,e),t}function ur(e){return()=>{}}function D(e){return{type:e}}var dr=D(`SELECTION_CHANGE_COMMAND`),fr=D(`SELECTION_INSERT_CLIPBOARD_NODES_COMMAND`),pr=D(`CLICK_COMMAND`),mr=D(`BEFORE_INPUT_COMMAND`),hr=D(`INPUT_COMMAND`),gr=D(`COMPOSITION_START_COMMAND`),_r=D(`COMPOSITION_END_COMMAND`),vr=D(`DELETE_CHARACTER_COMMAND`),yr=D(`INSERT_LINE_BREAK_COMMAND`),br=D(`INSERT_PARAGRAPH_COMMAND`),xr=D(`CONTROLLED_TEXT_INSERTION_COMMAND`),Sr=D(`PASTE_COMMAND`),Cr=D(`REMOVE_TEXT_COMMAND`),wr=D(`DELETE_WORD_COMMAND`),Tr=D(`DELETE_LINE_COMMAND`),Er=D(`FORMAT_TEXT_COMMAND`),Dr=D(`SET_TEXT_FORMAT_COMMAND`),Or=D(`UNDO_COMMAND`),kr=D(`REDO_COMMAND`),Ar=D(`KEYDOWN_COMMAND`),jr=D(`KEY_ARROW_RIGHT_COMMAND`),Mr=D(`MOVE_TO_END`),Nr=D(`KEY_ARROW_LEFT_COMMAND`),Pr=D(`MOVE_TO_START`),Fr=D(`KEY_ARROW_UP_COMMAND`),Ir=D(`KEY_ARROW_DOWN_COMMAND`),Lr=D(`KEY_ENTER_COMMAND`),Rr=D(`KEY_SPACE_COMMAND`),zr=D(`KEY_BACKSPACE_COMMAND`),Br=D(`KEY_ESCAPE_COMMAND`),Vr=D(`KEY_DELETE_COMMAND`),Hr=D(`KEY_TAB_COMMAND`),Ur=D(`INSERT_TAB_COMMAND`),Wr=D(`INDENT_CONTENT_COMMAND`),Gr=D(`OUTDENT_CONTENT_COMMAND`),Kr=D(`DROP_COMMAND`),qr=D(`FORMAT_ELEMENT_COMMAND`),Jr=D(`DRAGSTART_COMMAND`),Yr=D(`DRAGOVER_COMMAND`),Xr=D(`DRAGEND_COMMAND`),Zr=D(`COPY_COMMAND`),Qr=D(`CUT_COMMAND`),$r=D(`SELECT_ALL_COMMAND`),ei=D(`CLEAR_EDITOR_COMMAND`),ti=D(`CLEAR_HISTORY_COMMAND`),ni=D(`CAN_REDO_COMMAND`),ri=D(`CAN_UNDO_COMMAND`),ii=D(`FOCUS_COMMAND`),ai=D(`BLUR_COMMAND`),oi=D(`KEY_MODIFIER_COMMAND`);function si(e,t){return{...t,[Ve]:e}}var ci=si(`metaKey`,{ctrlKey:!ve,metaKey:ve}),li=si(`altKey`,{altKey:ve,ctrlKey:!ve}),ui=[[`altKey`,1],[`ctrlKey`,2],[`metaKey`,4],[`shiftKey`,8]];function di(e,t,n){let r=e.get(t);r?r.push(n):e.set(t,[n])}var fi=class{byKey=new Map;byCode=new Map;add(e){let{key:t,modifiers:n={}}=e;t.length>0||x(399);let r=t.toLowerCase();for(let i of function(e){let t=[0];for(let[n,r]of ui){let i=e[n]||!1;i===`any`?t=t.concat(t.map(e=>e|r)):i&&(t=t.map(e=>e|r))}return t}(n))di(this.byKey,`${i}:${r}`,e),t.length===1&&(/[0-9]/.test(t)?di(this.byCode,`${i}:Digit${t}`,e):/[a-z]/.test(r)&&di(this.byCode,`${i}:Key${r.toUpperCase()}`,e));return this}matches(e){let t=e.key;if(!t)return[];let n=function(e){let t=0;for(let[n,r]of ui)e[n]&&(t|=r);return t}(e),r=this.byKey.get(`${n}:${t.toLowerCase()}`),i=r?r.slice():[];if(this.byCode.size>0&&!(t.length===1&&t.charCodeAt(0)<=127)){let t=this.byCode.get(`${n}:${e.code}`);t&&i.push(...t)}return i}match(e){return this.matches(e)[0]}};function pi(e){let t=new fi;for(let n of e)t.add(n);return t}function mi(e){let t=new Map;return{dispose(){for(let e of t.values())e.dispose();t.clear()},register(n,r){let i=t.get(n);i===void 0&&(i={dispose:e(n,r),holders:new Set},t.set(n,i));let a=()=>{let e=t.get(n);e&&e.holders.delete(a)&&e.holders.size===0&&(t.delete(n),e.dispose())};return i.holders.add(a),a}}}function hi(e,t,n,r){return e.addEventListener(t,n,r),e.removeEventListener.bind(e,t,n,r)}var gi=Object.freeze({}),_i,vi=new WeakMap,yi=new WeakMap,bi=mi(e=>(e.addEventListener(`selectionchange`,Zi),()=>e.removeEventListener(`selectionchange`,Zi)));function xi(e,t,n,r,i,a){let o=e.anchor,s=e.focus,c=o.getNode(),l=P(),u;if(a!==void 0)u=a;else{let e=Fl(Tl(l));u=e===null?null:Wl(e,l._rootElement)}let d=u===null?null:u.anchorNode,f=o.key,p=l.getElementByKey(f),m=n.length;return f!==s.key||!k(c)||(!i&&(!xe||l._inputState.lastBeforeInputInsertTextTimeStamp<r+50)||c.isDirty()&&m<2||$c(n))&&o.offset!==s.offset&&!c.isComposing()||Nc(c)||c.isDirty()&&m>1||(i||!xe)&&p!==null&&!c.isComposing()&&d!==cu(c,p,l)||u!==null&&t!==null&&(!t.collapsed||t.startContainer!==u.anchorNode||t.startOffset!==u.anchorOffset)||!c.isComposing()&&(c.getFormat()!==e.format||c.getStyle()!==e.style)||function(e,t){if(t.isSegmented())return!0;if(!e.isCollapsed())return!1;let n=e.anchor.offset,r=t.getParentOrThrow(),i=Mc(t);return n===0?!t.canInsertTextBefore()||!r.canInsertTextBefore()&&!t.isComposing()||i||function(e){let t=e.getPreviousSibling();return(k(t)||I(t)&&t.isInline())&&!t.canInsertTextAfter()}(t):n===t.getTextContentSize()&&(!t.canInsertTextAfter()||!r.canInsertTextAfter()&&!t.isComposing()||i)}(e,c)}function Si(e,t){return Pc(e)&&e.nodeValue!==null&&t!==0&&t!==e.nodeValue.length}function Ci(e,t,n){let{anchorNode:r,anchorOffset:i,focusNode:a,focusOffset:o}=Wl(e,t._rootElement),s=t._inputState;if(s.isSelectionChangeFromDOMUpdate){s.isSelectionChangeFromDOMUpdate=!1;let e=s.selectionChangeFromDOMUpdatePoints;if(s.selectionChangeFromDOMUpdatePoints=null,Si(r,i)&&Si(a,o)&&!s.postDeleteSelectionToRestore&&(e===null||e.anchorNode===r&&e.anchorOffset===i&&e.focusNode===a&&e.focusOffset===o))return}Cs(t,()=>{if(!n)return void Xc(null);if(!Oc(t,r,a))return;let c=M();if(s.postDeleteSelectionToRestore&&A(c)&&c.isCollapsed()){let e=c.anchor,t=s.postDeleteSelectionToRestore.anchor;(e.key===t.key&&e.offset===t.offset+1||e.offset===1&&t.getNode().is(e.getNode().getPreviousSibling()))&&(c=s.postDeleteSelectionToRestore.clone(),Xc(c))}if(s.postDeleteSelectionToRestore=null,A(c)){let n=c.anchor,l=n.getNode();if(c.isCollapsed()){e.type===`Range`&&r===a&&(c.dirty=!0);let i=Tl(t).event,o=i?i.timeStamp:performance.now(),{format:u,style:d,offset:f,key:p,timeStamp:m}=s.collapsedSelectionFormat,h=H(),g=!1===t.isComposing()&&h.getTextContent()===``;if(o<m+200&&n.offset===f&&n.key===p)wi(c,u,d);else if(n.type===`text`)k(l)||x(141),Ti(c,l);else if(n.type===`element`&&!g){I(l)||x(259);let e=n.getNode();e.isEmpty()?function(e,t){wi(e,t.getTextFormat(),t.getTextStyle())}(c,e):wi(c,c.format,``)}}else{let e=n.key,t=c.focus.key,r=c.getNodes(),a=r.length,s=c.isBackward(),l=s?o:i,u=s?i:o,d=s?t:e,f=s?e:t,p=Ae,m=!1;for(let e=0;e<a;e++){let t=r[e],n=t.getTextContentSize();if(k(t)&&n!==0&&!(e===0&&t.__key===d&&l===n||e===a-1&&t.__key===f&&u===0)&&(m=!0,p&=t.getFormat(),p===0))break}c.format=m?p:0}}(function(e,t,n=!1){(n||_s(e,t))&&e.dispatchCommand(dr)})(t,c,c!==null&&(c.dirty||!A(c)))})}function wi(e,t,n){e.format===t&&e.style===n||(e.format=t,e.style=n,e.dirty=!0)}function Ti(e,t){wi(e,t.getFormat(),t.getStyle())}function Ei(e,t){Cs(t,()=>{let n=M(),r=Fl(Tl(t)),i=ko();if(r){if(A(n)){let e=n.anchor,t=e.getNode();e.type===`element`&&e.offset===0&&n.isCollapsed()&&!R(t)&&H().getChildrenSize()===1&&t.getTopLevelElementOrThrow().isEmpty()&&i!==null&&n.is(i)&&(r.removeAllRanges(),n.dirty=!0)}else if(e.pointerType===`touch`||e.pointerType===`pen`){let n=Wl(r,t._rootElement).anchorNode;(K(n)||Pc(n))&&Xc(Oo(i,r,t,e))}}if(ye&&r!==null&&r.rangeCount===0){let n=t._rootElement;if(n!==null&&e.target===n){let a=e.clientY,o=n.childNodes.length;for(let e=0;e<n.childNodes.length;e++){let t=n.childNodes[e];if(K(t)){let n=t.getBoundingClientRect();if(a<=(n.top+n.bottom)/2){o=e;break}}}r.setBaseAndExtent(n,o,n,o);let s=Oo(i,r,t,e);s===null?r.removeAllRanges():Xc(s)}}U(t,pr,e)})}function Di(e,t){let n=Xl(e),r=e.pointerType;Ql(n)&&r!==`touch`&&r!==`pen`&&e.button===0&&Cs(t,()=>{bu(n,t)||(t._inputState.isSelectionChangeFromMouseDown=!0)})}function Oi(e){if(!e.getTargetRanges)return null;let t=e.getTargetRanges();return t.length===0?null:t[0]}function ki(e){let{lastKeyCode:t}=P()._inputState;if(e==null||e.length<=1||t==null)return;let n=t.length===1?t:t===`Enter`?`
|
|
5
5
|
`:t===`Tab`?` `:null;if(!n)return;let r=M();if(!A(r)||!r.isCollapsed())return;let i=r.anchor.getNode();if(!k(i))return;let{offset:a}=r.anchor;if(i.getTextContentSize()===a){let e=i.getNextSibling();if(n===`
|
|
@@ -21,5 +21,5 @@ import{o as e}from"./rolldown-runtime-BCiCTKAo.js";import{t}from"./react-BWPDF9m
|
|
|
21
21
|
`),s=o.length;(function(e){let n=Kg,c=qg;Kg=[],qg=e;try{return(()=>{for(let e=0;e<s;e++){let n=o[e],[s,c]=E_(o,e,i.multilineElement,t);s?e=c:D_(n,t,i.element,a,i.textMatch,r)}})()}finally{Kg=n,qg=c}})(!r);let c=t.getChildren();for(let e of c)if(!r&&bg(e)&&t.getChildrenSize()>1)e.remove();else if(I(e))for(let t of e.getAllTextNodes())O_(t)}function E_(e,t,n,r){for(let i of n){let{handleImportAfterStartMatch:n,regExpEnd:a,regExpStart:o,replace:s}=i,c=e[t].match(o);if(!c)continue;if(n){let a=n({lines:e,rootNode:r,startLineIndex:t,startMatch:c,transformer:i});if(a===null)continue;if(a)return a}let l=typeof a==`object`&&`regExp`in a?a.regExp:a,u=a&&typeof a==`object`&&`optional`in a?a.optional:!a,d=t,f=e.length;for(;d<f;){let n=l?e[d].match(l):null;if(!n&&(!u||u&&d<f-1)||n&&t===d&&n.index===c.index){d++;continue}let i=[];if(n&&t===d)i.push(e[t].slice(c[0].length,-n[0].length));else for(let r=t;r<=d;r++)if(r===t){let t=e[r].slice(c[0].length);i.push(t)}else if(r===d&&n){let t=e[r].slice(0,-n[0].length);i.push(t)}else i.push(e[r]);if(!1!==s(r,null,c,n,i,!0))return[!0,d];break}}return[!1,t]}function D_(e,t,n,r,i,a){let o=O(e),s=B();s.append(o),t.append(s);for(let{regExp:t,replace:r}of n){let n=e.match(t);if(n&&(o.setTextContent(e.slice(n[0].length)),!1!==r(s,[o],n,!0)))break}if(w_(o,r,i),s.getParent()!==null&&e.length>0){let e=s.getPreviousSibling();if(!a&&(dc(e)||Wh(e)||Q(e))){let t=e;if(Q(e)){let n=e.getLastDescendant();t=n==null?null:Ju(n,Z)}t!=null&&t.getTextContentSize()>0&&(t.splice(t.getChildrenSize(),0,[Bg(t),...s.getChildren()]),s.remove())}}}function O_(e){if(Ja(e))return;let t=e.getTextContent();if(!t.includes(` `))return;let n=e.getFormat(),r=e.getStyle(),i=[],a=0;for(let e=t.indexOf(` `);e!==-1;e=t.indexOf(` `,e+1))e>a&&i.push(O(t.slice(a,e)).setFormat(n).setStyle(r)),i.push(qa()),a=e+1;a<t.length&&i.push(O(t.slice(a)).setFormat(n).setStyle(r)),e.getParentOrThrow().splice(e.getIndexWithinParent(),1,i)}function k_(e,t=y_,n,r=!1,i=!1){let a=r?e:b_(e,i),o=n||H();o.clear(),T_(a,o,t,r),M()!==null&&o.selectStart()}var A_=/^(\d+(?:\.\d+)?)px$/,j_=/^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$/;function M_(e,t){if(typeof e==`number`)return Number.isFinite(e)?e:t;if(typeof e!=`string`||!j_.test(e))return t;let n=Number(e);return Number.isFinite(n)?n:t}function N_(e,t,n,r,i){let a=M_(e,t);return a>=n&&a<=r&&Number.isInteger(a)?a:t}function P_(e,t){e.__colWidths=t.__colWidths,e.__frozenColumnCount=t.__frozenColumnCount,e.__frozenRowCount=t.__frozenRowCount,e.__rowStriping=t.__rowStriping}var F_=e=>{let t=St(e,`format`),n=Ct(e,`format`),r=Tt(e,`format`);return{exportJSON:function(e){let n=e.__textFormat,r=e.__textStyle,i=(n!==0||r!==``)&&e.shouldSerializeTextStyles();return{children:[],colWidths:e.__colWidths,frozenColumnCount:e.getSerializedFrozenColumnCount(),frozenRowCount:e.getSerializedFrozenRowCount(),rowStriping:e.getSerializedRowStriping(),direction:e.__dir,format:t[e.__format],indent:e.__indent,textFormat:n!==0&&i?n:void 0,textStyle:r!==``&&i?r:void 0,type:e.__type,version:1}},exportCompactJSON:function(e){let n=e.__textFormat,r=e.__textStyle,i=(n!==0||r!==``)&&e.shouldSerializeTextStyles(),a={type:e.__type,children:[]},o=e.__colWidths;o!==void 0&&(a.colWidths=o);let s=e.getSerializedFrozenColumnCount();s!==void 0&&s!==0&&(a.frozenColumnCount=s);let c=e.getSerializedFrozenRowCount();c!==void 0&&c!==0&&(a.frozenRowCount=c);let l=e.getSerializedRowStriping();l!==void 0&&!1!==l&&(a.rowStriping=l);let u=e.__dir;u!=null&&(a.direction=u);let d=t[e.__format];d!==void 0&&d!==``&&(a.format=d);let f=e.__indent;return f!==void 0&&f!==0&&(a.indent=f),n!==void 0&&n!==0&&i&&(a.textFormat=n),r!==void 0&&r!==``&&i&&(a.textStyle=r),a},updateFromJSON:function(e,t){let i=t.direction;e.__dir=i===null||i===`ltr`||i===`rtl`?i:null;let a=t.format;e.__format=typeof a==`string`&&a in n?n[a]:r,e.__indent=N_(t.indent,0,0,1/0),e.__textFormat=M_(t.textFormat,0);let o=t.textStyle;e.__textStyle=typeof o==`string`?o:``;let s=t.colWidths;e.setColWidths(s===void 0?void 0:Array.isArray(s)?Array.from(s,e=>M_(e,0)):[]),e.__frozenColumnCount=M_(t.frozenColumnCount,0),e.__frozenRowCount=M_(t.frozenRowCount,0);let c=t.rowStriping;return e.__rowStriping=typeof c==`boolean`&&c,e},afterCloneFrom:P_}};function I_(e,t){e.__height=t.__height}var L_=e=>{let t=St(e,`format`),n=Ct(e,`format`),r=Tt(e,`format`);return{exportJSON:function(e){let n=e.__textFormat,r=e.__textStyle,i=(n!==0||r!==``)&&e.shouldSerializeTextStyles();return{children:[],height:e.__height,direction:e.__dir,format:t[e.__format],indent:e.__indent,textFormat:n!==0&&i?n:void 0,textStyle:r!==``&&i?r:void 0,type:e.__type,version:1}},exportCompactJSON:function(e){let n=e.__textFormat,r=e.__textStyle,i=(n!==0||r!==``)&&e.shouldSerializeTextStyles(),a={type:e.__type,children:[]},o=e.__height;o!==void 0&&(a.height=o);let s=e.__dir;s!=null&&(a.direction=s);let c=t[e.__format];c!==void 0&&c!==``&&(a.format=c);let l=e.__indent;return l!==void 0&&l!==0&&(a.indent=l),n!==void 0&&n!==0&&i&&(a.textFormat=n),r!==void 0&&r!==``&&i&&(a.textStyle=r),a},updateFromJSON:function(e,t){let i=t.direction;e.__dir=i===null||i===`ltr`||i===`rtl`?i:null;let a=t.format;e.__format=typeof a==`string`&&a in n?n[a]:r,e.__indent=N_(t.indent,0,0,1/0),e.__textFormat=M_(t.textFormat,0);let o=t.textStyle;e.__textStyle=typeof o==`string`?o:``;let s=t.height;return e.__height=s===void 0?void 0:M_(s,0),e},afterCloneFrom:I_}};function R_(e,t){e.__backgroundColor=t.__backgroundColor,e.__colSpan=t.__colSpan,e.__headerState=t.__headerState,e.__rowSpan=t.__rowSpan,e.__verticalAlign=t.__verticalAlign,e.__width=t.__width}var z_=e=>{let t=St(e,`format`),n=Ct(e,`format`),r=Tt(e,`format`);return{exportJSON:function(e){let n=e.__textFormat,r=e.__textStyle,i=(n!==0||r!==``)&&e.shouldSerializeTextStyles();return{children:[],backgroundColor:e.__backgroundColor,colSpan:e.__colSpan,headerState:e.__headerState,rowSpan:e.__rowSpan,verticalAlign:e.getSerializedVerticalAlign(),width:e.__width,direction:e.__dir,format:t[e.__format],indent:e.__indent,textFormat:n!==0&&i?n:void 0,textStyle:r!==``&&i?r:void 0,type:e.__type,version:1}},exportCompactJSON:function(e){let n=e.__textFormat,r=e.__textStyle,i=(n!==0||r!==``)&&e.shouldSerializeTextStyles(),a={type:e.__type,children:[]},o=e.__backgroundColor;o!=null&&(a.backgroundColor=o);let s=e.__colSpan;s!==void 0&&s!==1&&(a.colSpan=s);let c=e.__headerState;c!==void 0&&c!==0&&(a.headerState=c);let l=e.__rowSpan;l!==void 0&&l!==1&&(a.rowSpan=l);let u=e.getSerializedVerticalAlign();u!==void 0&&(a.verticalAlign=u);let d=e.__width;d!==void 0&&(a.width=d);let f=e.__dir;f!=null&&(a.direction=f);let p=t[e.__format];p!==void 0&&p!==``&&(a.format=p);let m=e.__indent;return m!==void 0&&m!==0&&(a.indent=m),n!==void 0&&n!==0&&i&&(a.textFormat=n),r!==void 0&&r!==``&&i&&(a.textStyle=r),a},updateFromJSON:function(e,t){let i=t.direction;e.__dir=i===null||i===`ltr`||i===`rtl`?i:null;let a=t.format;e.__format=typeof a==`string`&&a in n?n[a]:r,e.__indent=N_(t.indent,0,0,1/0),e.__textFormat=M_(t.textFormat,0);let o=t.textStyle;e.__textStyle=typeof o==`string`?o:``;let s=t.backgroundColor;e.__backgroundColor=typeof s==`string`&&s!==``?s:null,e.__colSpan=N_(t.colSpan,1,1,1/0),e.setHeaderStyles(M_(t.headerState,0)),e.__rowSpan=N_(t.rowSpan,1,1,1/0);let c=t.verticalAlign;e.__verticalAlign=c===`middle`||c===`bottom`?c:void 0;let l=t.width;return e.__width=l===void 0||M_(l,0)===0?void 0:M_(l,0),e},afterCloneFrom:R_}},B_={BOTH:3,COLUMN:2,NO_STATUS:0,ROW:1},V_=Wt()({backgroundColor:S(Ht(Lt(),{defaultAsNull:!0}),{field:`__backgroundColor`}),colSpan:S(zt(1,{integer:!0,min:1}),{field:`__colSpan`}),headerState:qt(zt(0),{getter:{field:`__headerState`,method:`getHeaderStyles`},setter:`setHeaderStyles`}),rowSpan:S(zt(1,{integer:!0,min:1}),{field:`__rowSpan`}),verticalAlign:qt(Vt([void 0,`middle`,`bottom`]),{getter:`getSerializedVerticalAlign`,setter:{field:`__verticalAlign`}}),width:S(Ut(zt(),{omitDefault:!0}),{field:`__width`})}),H_=class extends F{__colSpan;__rowSpan;__headerState;__width;__backgroundColor;__verticalAlign;$config(){return this.config(`tablecell`,{extends:F,generated:z_,importDOM:{td:()=>({conversion:W_,priority:0}),th:()=>({conversion:W_,priority:0})},json:V_})}constructor(e=B_.NO_STATUS,t=1,n,r){super(r),this.__colSpan=t,this.__rowSpan=1,this.__headerState=e,this.__width=n,this.__backgroundColor=null,this.__verticalAlign=void 0}createDOM(e){let t=G().createElement(this.getTag());return this.__width&&(t.style.width=`${this.__width}px`),this.__colSpan>1&&(t.colSpan=this.__colSpan),this.__rowSpan>1&&(t.rowSpan=this.__rowSpan),this.__backgroundColor!==null&&(t.style.backgroundColor=this.__backgroundColor),U_(this.__verticalAlign)&&(t.style.verticalAlign=this.__verticalAlign),Qd(t,e.theme.tableCell,this.hasHeader()&&e.theme.tableCellHeader),t}exportDOM(e){let t=super.exportDOM(e);if(K(t.element)){let e=t.element;e.setAttribute(`data-temporary-table-cell-lexical-key`,this.getKey()),e.style.border=`1px solid black`,this.__colSpan>1&&(e.colSpan=this.__colSpan),this.__rowSpan>1&&(e.rowSpan=this.__rowSpan),e.style.width=`${this.getWidth()||75}px`,e.style.verticalAlign=this.getVerticalAlign()||`top`,e.style.textAlign=`start`,this.__backgroundColor===null&&this.hasHeader()&&(e.style.backgroundColor=`#f2f3f5`)}return t}getColSpan(){return this.getLatest().__colSpan}setColSpan(e){let t=this.getWritable();return t.__colSpan=e,t}getRowSpan(){return this.getLatest().__rowSpan}setRowSpan(e){let t=this.getWritable();return t.__rowSpan=e,t}getTag(){return this.hasHeader()?`th`:`td`}setHeaderStyles(e,t=B_.BOTH){let n=this.getWritable();return n.__headerState=e&t|n.__headerState&~t,n}getHeaderStyles(){return this.getLatest().__headerState}setWidth(e){let t=this.getWritable();return t.__width=e,t}getWidth(){return this.getLatest().__width}getSerializedVerticalAlign(){let e=this.getLatest().__verticalAlign;return U_(e)?e:void 0}getBackgroundColor(){return this.getLatest().__backgroundColor}setBackgroundColor(e){let t=this.getWritable();return t.__backgroundColor=e,t}getVerticalAlign(){return this.getLatest().__verticalAlign}setVerticalAlign(e){let t=this.getWritable();return t.__verticalAlign=e||void 0,t}toggleHeaderStyle(e){let t=this.getWritable();return(t.__headerState&e)===e?t.__headerState&=~e:t.__headerState|=e,t}hasHeaderState(e){return(this.getHeaderStyles()&e)===e}hasHeader(){return this.getLatest().__headerState!==B_.NO_STATUS}updateDOM(e){return e.__headerState!==this.__headerState||e.__width!==this.__width||e.__colSpan!==this.__colSpan||e.__rowSpan!==this.__rowSpan||e.__backgroundColor!==this.__backgroundColor||e.__verticalAlign!==this.__verticalAlign}isShadowRoot(){return!0}collapseAtStart(){return!0}canBeEmpty(){return!1}canIndent(){return!1}};function U_(e){return e===`middle`||e===`bottom`}function W_(e){let t=e,n=e.nodeName.toLowerCase(),r;A_.test(t.style.width)&&(r=parseFloat(t.style.width));let i=B_.NO_STATUS;if(n===`th`){let e=t.getAttribute(`scope`);if(e===`col`)i=B_.COLUMN;else if(e===`row`)i=B_.ROW;else{let e=t.parentElement,n=K(e)&&e.nodeName.toLowerCase()===`tr`&&K(e.parentElement)&&(e.parentElement.nodeName.toLowerCase()===`thead`||e.rowIndex===0),r=t.cellIndex===0;n&&(i|=B_.ROW),r&&(i|=B_.COLUMN),i===B_.NO_STATUS&&(i=B_.ROW)}}let a=G_(i,t.colSpan,r);a.__rowSpan=t.rowSpan;let o=t.style.backgroundColor;o!==``&&(a.__backgroundColor=o);let s=t.style.verticalAlign;U_(s)&&(a.__verticalAlign=s),hu(a,t);let c=t.style,l=(c&&c.textDecoration||``).split(` `),u=c.fontWeight===`700`||c.fontWeight===`bold`,d=l.includes(`line-through`),f=c.fontStyle===`italic`,p=l.includes(`underline`),m=c.color;return{after:e=>{let t=[],n=null,r=()=>{if(n){let e=n.getFirstChild();z(e)&&n.getChildrenSize()===1&&e.remove()}};for(let i of e)if(El(i)||k(i)||z(i)){if(k(i)&&(u&&i.toggleFormat(`bold`),d&&i.toggleFormat(`strikethrough`),f&&i.toggleFormat(`italic`),p&&i.toggleFormat(`underline`),m)){let e=i.getStyle();e.includes(`color:`)||i.setStyle(e+`color: ${m};`)}n?n.append(i):(n=B().append(i),t.push(n))}else t.push(i),r(),n=null;return r(),t.length===0&&t.push(B()),t},node:a}}function G_(e=B_.NO_STATUS,t=1,n){return Al(new H_(e,t,n))}function K_(e){return e instanceof H_}function q_(e,...t){throw function(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);return n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(e,...t)}var J_=Wt()({height:S(Ut(zt()),{field:`__height`})}),Y_=class extends F{__height;$config(){return this.config(`tablerow`,{extends:F,generated:L_,importDOM:{tr:()=>({conversion:X_,priority:0})},json:J_})}constructor(e=void 0,t){super(t),this.__height=e}createDOM(e){let t=G().createElement(`tr`);return this.__height&&(t.style.height=`${this.__height}px`),Qd(t,e.theme.tableRow),t}extractWithChild(e,t,n){return n===`html`}isShadowRoot(){return!0}setHeight(e){let t=this.getWritable();return t.__height=e,t}getHeight(){return this.getLatest().__height}updateDOM(e){return e.__height!==this.__height}canBeEmpty(){return!1}canIndent(){return!1}};function X_(e){let t=e,n;return A_.test(t.style.height)&&(n=parseFloat(t.style.height)),{after:e=>yf(e,K_),node:hu(Z_(n),t)}}function Z_(e){return Al(new Y_(e))}function Q_(e){return e instanceof Y_}function $_(e,t,n){let r=[],i=null,a=null;function o(e){let t=r[e];return t===void 0&&(r[e]=t=[]),t}let s=e.getChildren();for(let e=0;e<s.length;e++){let r=s[e];Q_(r)||q_(209);let c=o(e);for(let l=r.getFirstChild(),u=0;l!=null;l=l.getNextSibling()){for(K_(l)||q_(147);c[u]!==void 0;)u++;let r={cell:l,startColumn:u,startRow:e},{__rowSpan:d,__colSpan:f}=l;for(let t=0;t<d&&!(e+t>=s.length);t++){let n=o(e+t);for(let e=0;e<f;e++)n[u+e]=r}t!==null&&i===null&&t.is(l)&&(i=r),n!==null&&a===null&&n.is(l)&&(a=r)}}return[r,i,a]}function ev(e){return K(e)&&e.nodeName===`TABLE`}function tv(e,t){if(!t)return t;let n=ev(t)?t:t.querySelector(`table`);return ev(n)||q_(341,e.constructor.name,e.getType(),e.getKey(),t.nodeName),n}function nv(e,t){for(let n=t,r=null;n!==null;n=n.getParent()){if(e.is(n))return r;K_(n)&&(r=n)}return null}function rv(e,t,n){return nv(e,Kc(t,n))}function iv(e){return K(e)&&e.nodeName===`DIV`}var av=Wt()({colWidths:qt(Ut(Kt(zt())),{getter:{field:`__colWidths`}}),frozenColumnCount:qt(zt(),{getter:`getSerializedFrozenColumnCount`,setter:{field:`__frozenColumnCount`,method:`setFrozenColumns`}}),frozenRowCount:qt(zt(),{getter:`getSerializedFrozenRowCount`,setter:{field:`__frozenRowCount`,method:`setFrozenRows`}}),rowStriping:qt(Bt(),{getter:`getSerializedRowStriping`,setter:{field:`__rowStriping`}})});function ov(e,t,n){let r=e.querySelector(`:scope > colgroup`);if(!n)return void(r&&r.remove());r||(r=G().createElement(`colgroup`),_u(r),e.insertBefore(r,e.firstChild));let i=[];for(let e=0;e<t;e++){let t=G().createElement(`col`),r=n[e];r&&(t.style.width=`${r}px`),i.push(t)}r.replaceChildren(...i)}function sv(e,t,n){if(!t.theme.tableAlignment)return;let r=[],i=[];for(let e of[`center`,`right`]){let a=t.theme.tableAlignment[e];a&&(e===n?i:r).push(a)}$d(e,...r),Qd(e,...i)}var cv=new WeakSet;function lv(e=q()){return cv.has(e)}function uv(e=q()){let t=Bf(e,`@lexical/table/Table`);return!!t&&t.output.hasStickyScrollbar.peek()&&t.output.hasHorizontalScroll.peek()}var dv=class extends F{__rowStriping=!1;__frozenColumnCount=0;__frozenRowCount=0;__colWidths=void 0;$config(){return this.config(`table`,{extends:F,generated:F_,importDOM:{table:()=>({conversion:fv,priority:1})},json:av})}getSerializedFrozenColumnCount(){return this.getLatest().__frozenColumnCount||void 0}getSerializedFrozenRowCount(){return this.getLatest().__frozenRowCount||void 0}getSerializedRowStriping(){return this.getLatest().__rowStriping||void 0}getColWidths(){return this.getLatest().__colWidths}setColWidths(e){let t=this.getWritable();return t.__colWidths=e,t}extractWithChild(e,t,n){return n===`html`}getDOMSlot(e){let t=ev(e)?e:e.querySelector(`table`);return ev(t)||q_(229),super.getDOMSlot(e).withElement(t).withAfter(t.querySelector(`:scope > colgroup`))}createDOM(e,t){let n=G().createElement(`table`);if(this.__style&&Ea(n.style,this.__style),this.getColWidths()){let e=G().createElement(`colgroup`);n.appendChild(e),_u(e)}if(Qd(n,e.theme.table),this.updateTableElement(null,n,e),lv(t)){let r=uv(t),i=function(e,t,n){let r=G().createElement(`div`),i=t.theme.tableScrollableWrapper;return i?Qd(r,i):r.style.overflowX=`auto`,n&&(r.style.scrollbarWidth=`none`),r.appendChild(e),r}(n,e,r);if(this.updateTableWrapper(null,i,n,e),r){let t=function(e){let t=G(),n=t.createElement(`div`),r=e.theme.tableStickyScrollbar;r?Qd(n,r):(n.style.position=`sticky`,n.style.bottom=`0`,n.style.overflowX=`scroll`,n.style.overflowY=`hidden`),n.style.display=`none`,n.setAttribute(`aria-hidden`,`true`),n.tabIndex=-1;let i=t.createElement(`div`);return i.style.height=`1px`,i.style.width=`0px`,n.appendChild(i),n}(e),n=G().createElement(`div`);return n.setAttribute(`data-lexical-sticky-scrollbar`,`true`),n.appendChild(i),n.appendChild(t),_u(t),n}return i}return n}updateTableWrapper(e,t,n,r){this.__frozenColumnCount!==(e?e.__frozenColumnCount:0)&&function(e,t,n,r){r>0?(Qd(e,n.theme.tableFrozenColumn),t.setAttribute(`data-lexical-frozen-column`,`true`)):($d(e,n.theme.tableFrozenColumn),t.removeAttribute(`data-lexical-frozen-column`))}(t,n,r,this.__frozenColumnCount),this.__frozenRowCount!==(e?e.__frozenRowCount:0)&&function(e,t,n,r){r>0?(Qd(e,n.theme.tableFrozenRow),t.setAttribute(`data-lexical-frozen-row`,`true`)):($d(e,n.theme.tableFrozenRow),t.removeAttribute(`data-lexical-frozen-row`))}(t,n,r,this.__frozenRowCount)}updateTableElement(e,t,n){this.__style!==(e?e.__style:``)&&Ea(t.style,this.__style,e?e.__style:``),this.__rowStriping!==(!!e&&e.__rowStriping)&&function(e,t,n){n?(Qd(e,t.theme.tableRowStriping),e.setAttribute(`data-lexical-row-striping`,`true`)):($d(e,t.theme.tableRowStriping),e.removeAttribute(`data-lexical-row-striping`))}(t,n,this.__rowStriping);let r=e?e.getColumnCount():0,i=e?e.__colWidths:void 0;this.getColumnCount()===r&&this.getColWidths()===i||ov(t,this.getColumnCount(),this.getColWidths()),sv(t,n,this.getFormatType())}updateDOM(e,t,n){let r=tv(this,t);if(t===r===lv())return!0;if(iv(t)){if(t.hasAttribute(`data-lexical-sticky-scrollbar`)!==uv())return!0;let i=r.parentElement;iv(i)&&this.updateTableWrapper(e,i,r,n)}return this.updateTableElement(e,r,n),!1}scaleDOMColWidths(e,t){let n=this.getColWidths();n&&ov(tv(this,e),this.getColumnCount(),n.map(e=>e*t))}exportDOM(e){let t=super.exportDOM(e),{element:n}=t,r=!ev(n)&&K(n)?n.querySelector(`table`):n;if(K(n)&&ev(r)&&r!==n){n.dir&&(r.dir=n.dir);let{paddingInlineStart:e}=n.style;e&&(r.style.paddingInlineStart=e);let t=n.getAttribute(`data-lexical-indent`);t!==null&&r.setAttribute(`data-lexical-indent`,t)}return{after:n=>{if(t.after&&(n=t.after(n)),!ev(n)&&K(n)&&(n=n.querySelector(`table`)),!ev(n))return null;sv(n,e._config,this.getFormatType());let[r]=$_(this,null,null),i=new Map;for(let e of r)for(let t of e){let e=t.cell.getKey();i.has(e)||i.set(e,{colSpan:t.cell.getColSpan(),startColumn:t.startColumn})}let a=new Set;for(let e of n.querySelectorAll(`:scope > tr > [data-temporary-table-cell-lexical-key]`)){let t=e.getAttribute(`data-temporary-table-cell-lexical-key`);if(t){let n=i.get(t);if(e.removeAttribute(`data-temporary-table-cell-lexical-key`),n){i.delete(t);for(let e=0;e<n.colSpan;e++)a.add(e+n.startColumn)}}}let o=n.querySelector(`:scope > colgroup`);if(o){let e=Array.from(n.querySelectorAll(`:scope > colgroup > col`)).filter((e,t)=>a.has(t));o.replaceChildren(...e)}let s=n.querySelectorAll(`:scope > tr`);if(s.length>0){let e=G().createElement(`tbody`);for(let t of s)e.appendChild(t);n.append(e)}return n},element:r}}canBeEmpty(){return!1}isShadowRoot(){return!0}getCordsFromCellNode(e,t){let{rows:n,domRows:r}=t;for(let t=0;t<n;t++){let n=r[t];if(n!=null)for(let r=0;r<n.length;r++){let i=n[r];if(i==null)continue;let{elem:a}=i,o=rv(this,a);if(o!==null&&e.is(o))return{x:r,y:t}}}throw Error(`Cell not found in table.`)}getDOMCellFromCords(e,t,n){let{domRows:r}=n,i=r[t];return i==null?null:i[e<i.length?e:i.length-1]??null}getDOMCellFromCordsOrThrow(e,t,n){let r=this.getDOMCellFromCords(e,t,n);if(!r)throw Error(`Cell not found at cords.`);return r}getCellNodeFromCords(e,t,n){let r=this.getDOMCellFromCords(e,t,n);if(r==null)return null;let i=Kc(r.elem);return K_(i)?i:null}getCellNodeFromCordsOrThrow(e,t,n){let r=this.getCellNodeFromCords(e,t,n);if(!r)throw Error(`Node at cords not TableCellNode.`);return r}getRowStriping(){return!!this.getLatest().__rowStriping}setRowStriping(e){let t=this.getWritable();return t.__rowStriping=e,t}setFrozenColumns(e){let t=this.getWritable();return t.__frozenColumnCount=e,t}getFrozenColumns(){return this.getLatest().__frozenColumnCount}setFrozenRows(e){let t=this.getWritable();return t.__frozenRowCount=e,t}getFrozenRows(){return this.getLatest().__frozenRowCount}canSelectBefore(){return!0}canIndent(){return!1}getColumnCount(){let e=this.getFirstChild();if(!Q_(e))return 0;let t=0;return e.getChildren().forEach(e=>{K_(e)&&(t+=e.getColSpan())}),t}};function fv(e){let t=pv();e.hasAttribute(`data-lexical-row-striping`)&&t.setRowStriping(!0),e.hasAttribute(`data-lexical-frozen-column`)&&t.setFrozenColumns(1),e.hasAttribute(`data-lexical-frozen-row`)&&t.setFrozenRows(1);let n=e.querySelector(`:scope > colgroup`);if(n){let e=[];for(let t of n.querySelectorAll(`:scope > col`)){let n=t.style.width||``;if(!A_.test(n)&&(n=t.getAttribute(`width`)||``,!/^\d+$/.test(n))){e=void 0;break}e.push(parseFloat(n))}e&&t.setColWidths(e)}return hu(t,e),{after:e=>yf(e,Q_),node:t}}function pv(){return Al(new dv)}function mv(e){return e instanceof dv}function hv(e){let t=e.trim(),n=t.startsWith(`|`)?t.slice(1):t;return(n.endsWith(`|`)?n.slice(0,-1):n).split(`|`).map(e=>e.trim())}function gv(e){let t=hv(e);return t.length>0&&t.every(e=>/^:?-+:?$/.test(e.trim())&&e.trim().length>=1)}var _v=[{type:`multiline-element`,dependencies:[dv,Y_,H_],regExpStart:/^\|?[^|]*\|.*$/,regExpEnd:{optional:!0,regExp:/^\x00$/},handleImportAfterStartMatch({lines:e,rootNode:t,startLineIndex:n}){let r=e[n];if(r===void 0)return null;let i=e[n+1];if(i===void 0||!gv(i))return null;let a=hv(r),o=a.length,s=[],c=n+1;for(let t=n+2;t<e.length;t++){let n=e[t];if(n===void 0||!n.trim().includes(`|`)&&n.trim()!==``||n.trim()===``)break;s.push(hv(n)),c=t}let l=pv(),u=Z_();for(let e=0;e<o;e++){let t=G_(B_.ROW),n=B(),r=a[e]??``;n.append(O(r)),t.append(n),u.append(t)}l.append(u);for(let e of s){let t=Z_();for(let n=0;n<o;n++){let r=G_(B_.NO_STATUS),i=B(),a=e[n]??``;i.append(O(a)),r.append(i),t.append(r)}l.append(t)}return t.append(l),[!0,c]},replace(e,t,n,r,i,a){return!1},export(e,t){if(!mv(e))return null;let n=e.getChildren();if(n.length===0)return null;let r=[];return n.forEach((e,n)=>{if(!Q_(e))return;let i=e.getChildren(),a=i.map(e=>K_(e)?t(e).trim():``);r.push(`| ${a.join(` | `)} |`),n===0&&r.push(`| ${i.map(()=>`---`).join(` | `)} |`)}),r.join(`
|
|
22
22
|
`)}},t_,...y_],vv=/^[ \t]*`{3,}[ \t]*$/;function yv(e){return RegExp(`^[ \\t]*\`{${String(e)},}[ \\t]*$`)}function bv(e,t,n){let r=yv(n.length),i=[],a=t;for(let n=t+1;n<e.length;n++){let t=e[n];if(t===void 0)break;if(a=n,r.test(t))return{source:i.join(`
|
|
23
23
|
`),lastLineIndex:a,closed:!0};i.push(t)}return{source:i.join(`
|
|
24
|
-
`),lastLineIndex:a,closed:!1}}var $=e(n(),1),xv=(0,le.lazy)(()=>p(()=>import(`./GenUIBlock-
|
|
24
|
+
`),lastLineIndex:a,closed:!1}}var $=e(n(),1),xv=(0,le.lazy)(()=>p(()=>import(`./GenUIBlock-Bv-OFgT5.js`).then(e=>e.t),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47])));function Sv({label:e}){return(0,$.jsxs)(`div`,{className:`not-prose my-3 flex min-h-24 items-center justify-center gap-2 rounded-lg border border-dashed border-border text-sm text-muted-foreground`,role:`status`,children:[(0,$.jsx)(ae,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,$.jsx)(r,{}),e]})}function Cv({source:e,closed:t}){return t?(0,$.jsx)(le.Suspense,{fallback:(0,$.jsx)(Sv,{label:`Loading view…`}),children:(0,$.jsx)(xv,{source:e})}):(0,$.jsx)(Sv,{label:`Building view…`})}function wv({source:e}){let{label:t,context:n}=(0,le.useMemo)(()=>ee(e),[e]);return(0,$.jsxs)(`details`,{className:`not-prose my-1 w-fit max-w-full rounded-md border border-border px-2 py-1 text-xs text-muted-foreground`,children:[(0,$.jsxs)(`summary`,{className:`flex cursor-pointer select-none items-center gap-1.5`,children:[(0,$.jsx)(ae,{className:`h-3.5 w-3.5`,"aria-hidden":`true`}),t]}),n?(0,$.jsx)(`pre`,{className:`mt-1 max-h-48 overflow-auto whitespace-pre-wrap break-words font-mono`,children:JSON.stringify(n,null,2)}):null]})}var Tv=class e extends js{__source;__closed;__intent;__dom;constructor(e,t,n,r,i=te){super(r),this.__source=e,this.__closed=t,this.__intent=n,this.__dom=i}static getType(){return _}static clone(t){return new e(t.__source,t.__closed,t.__intent,t.__key,t.__dom)}static importJSON(e){return Ev(e.source,e.closed,e.intent)}exportJSON(){return{type:e.getType(),version:1,source:this.__source,closed:this.__closed,intent:this.__intent}}createDOM(e,t){return this.__dom.createElement(`div`)}updateDOM(){return!1}isInline(){return!1}getTextContent(){return this.__source}isIntent(){return this.__intent}isClosed(){return this.__closed}decorate(e,t){return this.__intent?(0,$.jsx)(wv,{source:this.__source}):(0,$.jsx)(Cv,{source:this.__source,closed:this.__closed})}};function Ev(e,t,n){return Al(new Tv(e,t,n))}function Dv(e,t){return{type:`multiline-element`,dependencies:[Tv],regExpStart:e,regExpEnd:{optional:!0,regExp:vv},handleImportAfterStartMatch({lines:e,rootNode:n,startLineIndex:r,startMatch:i}){let{source:a,lastLineIndex:o,closed:s}=bv(e,r,i[1]??"```");return n.append(Ev(a,s,t)),[!0,o]},replace(){return!1},export(e){return!(e instanceof Tv)||e.isIntent()!==t?null:v(t?h:_,e.getTextContent())}}}var Ov=Dv(m,!1),kv=Dv(g,!0),Av=`font-normal leading-tight mt-5 mb-3 first:mt-0 last:mb-0`,jv={h1:`text-20 ${Av}`,h2:`text-18 ${Av}`,h3:`text-16 ${Av}`,h4:`text-16 ${Av}`,h5:`text-16 ${Av}`,h6:`text-16 ${Av}`},Mv={paragraph:`break-words mt-5 mb-3 first:mt-0 last:mb-0`,quote:`my-2 mt-5 mb-3 first:mt-0 last:mb-0 border-l-2 border-border/80 pl-2 text-muted-foreground`,ul:`list-disc ml-5 my-2`,ol:`list-decimal ml-5 my-2`,listitem:`my-0.5`,bold:`font-semibold`,italic:`italic`,strikethrough:`line-through`,inlineCode:`break-all px-1 bg-border/60 py-0.5 rounded text-sm`},Nv={paragraph:Mv.paragraph,quote:Mv.quote,heading:jv,list:{ul:Mv.ul,ol:Mv.ol,listitem:Mv.listitem,nested:{listitem:`list-none`}},link:`text-primary underline underline-offset-2`,text:{bold:Mv.bold,italic:Mv.italic,strikethrough:Mv.strikethrough,code:Mv.inlineCode},code:`block text-xs whitespace-pre`};function Pv(e){throw e}function Fv(e){return{namespace:e.namespace,theme:Nv,nodes:[...e.nodes],editable:e.editable??!0,onError:Pv}}var Iv=f(`ShikiHtml`,()=>e=>({highlighted:null,setHighlighted:t=>e({highlighted:t})})),Lv=204800,Rv={ts:`typescript`,typescript:`typescript`,tsx:`tsx`,js:`javascript`,javascript:`javascript`,jsx:`jsx`,py:`python`,python:`python`,go:`go`,golang:`go`,rs:`rust`,rust:`rust`,java:`java`,rb:`ruby`,ruby:`ruby`,sh:`bash`,bash:`bash`,zsh:`bash`,shell:`bash`,yml:`yaml`,yaml:`yaml`,css:`css`,scss:`scss`,html:`html`,xml:`xml`,json:`json`,json5:`json5`,md:`markdown`,markdown:`markdown`,sql:`sql`,cpp:`cpp`,"c++":`cpp`,c:`c`,h:`c`,swift:`swift`,kt:`kotlin`,kotlin:`kotlin`,php:`php`,toml:`toml`,dockerfile:`dockerfile`,diff:`diff`,patch:`diff`,vue:`vue`,svelte:`svelte`};function zv(e){return Rv[e.toLowerCase()]??null}function Bv(e){let t=e.lastIndexOf(`.`);return zv(t<0?e:e.slice(t+1))}var Vv=/^<pre[^>]*>/,Hv=/<\/pre>\s*$/,Uv=/^<code[^>]*>/,Wv=/<\/code>\s*$/;function Gv(e){return e.replace(Vv,``).replace(Hv,``).replace(Uv,``).replace(Wv,``)}function Kv(e,t){let n=y()===`dark`?`github-dark`:`github-light`,r=t!==null&&e.length<=Lv,i=Iv.useScopedStore(e=>e.highlighted),a=Iv.useScopedStore(e=>e.setHighlighted);return(0,le.useEffect)(()=>{if(!r||t===null)return;let i=!1;return p(()=>import(`./dist-Bk41vfIT.js`).then(async r=>{if(i)return;let o=await r.codeToHtml(e,{lang:t,theme:n});i||a({source:e,theme:n,lang:t,html:o})}),__vite__mapDeps([48,39,49,50,1,51,52,53])).catch(()=>{u.warn(`[transcript] Shiki unavailable; falling back to plain code`)}),()=>{i=!0}},[r,e,t,n,a]),i!==null&&i.source===e&&i.theme===n&&i.lang===t?i.html:null}function qv({source:e,lang:t}){let n=zv(t),r=Kv(e,n),i=n??t.toLowerCase();return r===null?(0,$.jsx)(`code`,{className:`block text-xs whitespace-pre language-${i}`,children:e}):(0,$.jsx)(`code`,{className:`block text-xs whitespace-pre language-${i} shiki-highlighted`,dangerouslySetInnerHTML:{__html:Gv(r)}})}var Jv=d(Iv,qv);function Yv({source:e,lang:t,ports:n}){let{copied:r,copy:a}=l(n),u=(0,le.useCallback)(()=>{b(`copy code block`,a(e))},[a,e]);return(0,$.jsxs)(`div`,{className:`relative overflow-x-auto max-w-full min-w-0 no-code-highlight group/pre`,children:[(0,$.jsx)(`pre`,{className:`min-w-0 rounded-xl py-2.5 px-3.5`,children:t?(0,$.jsx)(Jv,{source:e,lang:t}):(0,$.jsx)(`code`,{className:`block text-xs whitespace-pre`,children:e})}),(0,$.jsx)(o,{variant:`ghost`,size:`icon`,"aria-label":r?`Copied`:`Copy code`,className:i(`absolute top-[35px] -translate-y-[50%] -translate-x-[1px] rounded-md right-1.5 h-11 w-11 md:h-8 md:w-8 text-muted-foreground opacity-100 md:opacity-0 md:group-hover/pre:opacity-100 transition-opacity [@media(hover:none)]:!opacity-100`,!r&&`hover:text-foreground`,r&&`hover:!bg-transparent hover:!border-transparent`),onClick:u,children:r?(0,$.jsx)(c,{className:`h-4 w-4 text-success-text`}):(0,$.jsx)(s,{className:`h-4 w-4`})})]})}var Xv=`transition-colors underline decoration-2 text-logo decoration-logo/50 hover:text-logo/70 dark:text-logo dark:decoration-logo/70 dark:hover:text-logo/60 dark:hover:decoration-logo/40`,Zv=[Kh,Hh,Qm,Gm,Xp,sm,bm,Tm,dv,Y_,H_],Qv={namespace:`kanna-md-renderer`,nodes:[...Zv,Tv],transformers:[kv,Ov,..._v]};function $v(e,t,n){switch(e){case`h1`:return(0,$.jsx)(`h1`,{className:jv.h1,children:n},t);case`h2`:return(0,$.jsx)(`h2`,{className:jv.h2,children:n},t);case`h3`:return(0,$.jsx)(`h3`,{className:jv.h3,children:n},t);case`h4`:return(0,$.jsx)(`h4`,{className:jv.h4,children:n},t);case`h5`:return(0,$.jsx)(`h5`,{className:jv.h5,children:n},t);case`h6`:return(0,$.jsx)(`h6`,{className:jv.h6,children:n},t);default:return(0,$.jsx)(`h6`,{className:jv.h1,children:n},t)}}function ey(e){return e.getChildren().map(e=>k(e)||um(e)?e.getTextContent():z(e)?`
|
|
25
25
|
`:``).join(``)}function ty(e){return e!==void 0&&Q_(e)&&e.getChildren().every(e=>K_(e)&&(e.getHeaderStyles()&B_.ROW)!==0)}function ny(e,t){let n=e.getChildren(),r=n[0],i=ty(r)?r:void 0,a=i===void 0?n:n.slice(1);return(0,$.jsx)(`div`,{className:`border border-border rounded-xl overflow-x-auto`,children:(0,$.jsxs)(`table`,{className:`table-auto min-w-full divide-y divide-border bg-background`,children:[i!==void 0&&(0,$.jsx)(`thead`,{children:(0,$.jsx)(`tr`,{children:i.getChildren().map(e=>(0,$.jsx)(`th`,{className:`text-left text-xs text-muted-foreground tracking-wider p-2 pl-0 first:pl-3 bg-muted dark:bg-card [&_*]:font-semibold`,children:cy(e,t)},t.nextKey()))})}),(0,$.jsx)(`tbody`,{className:`divide-y divide-border`,children:a.map(e=>Q_(e)?(0,$.jsx)(`tr`,{children:e.getChildren().map(e=>K_(e)?(0,$.jsx)(`td`,{className:`text-left p-2 pl-0 first:pl-3 [&_*]:font-normal`,children:cy(e,t)},t.nextKey()):null)},t.nextKey()):null)})]})},t.nextKey())}function ry(e,t){let n=e.getChecked(),r=cy(e,t),i=t.nextKey();return n===void 0?(0,$.jsx)(`li`,{className:Mv.listitem,children:r},i):(0,$.jsxs)(`li`,{className:`my-0.5 list-none flex items-start gap-1.5`,children:[(0,$.jsx)(`input`,{type:`checkbox`,readOnly:!0,checked:n,className:`mt-[3px] shrink-0`}),(0,$.jsx)(`span`,{children:r})]},i)}function iy(e){return L(e)}function ay(e,t){if(iy(e)){let n=t.renderDecorator?.(e)??null;return n===null?(0,$.jsx)(`span`,{children:e.decorate(t.editor,t.config)},t.nextKey()):(0,$.jsx)(`span`,{children:n},t.nextKey())}if(Zh(e)){let n=cy(e,t);return $v(e.getTag(),t.nextKey(),n)}if(Wh(e))return(0,$.jsx)(`blockquote`,{className:Mv.quote,children:cy(e,t)},t.nextKey());if(dc(e))return(0,$.jsx)(`p`,{className:Mv.paragraph,children:cy(e,t)},t.nextKey());if(Qp(e))return(0,$.jsx)(Yv,{source:ey(e),lang:e.getLanguage()??``},t.nextKey());if(Q(e)){let n=cy(e,t),r=t.nextKey();return e.getListType()===`number`?(0,$.jsx)(`ol`,{className:Mv.ol,children:n},r):(0,$.jsx)(`ul`,{className:Mv.ul,children:n},r)}if(Z(e))return ry(e,t);if(Cm(e)||Em(e))return(0,$.jsx)(`a`,{href:e.getURL(),className:Xv,target:`_blank`,rel:`noopener noreferrer`,children:cy(e,t)},t.nextKey());if(mv(e))return ny(e,t);if(z(e))return(0,$.jsx)(`br`,{},t.nextKey());if(k(e))return sy(e,t);if(um(e))return(0,$.jsx)(`code`,{className:Mv.inlineCode,children:e.getTextContent()},t.nextKey());let n=e.getTextContent();return n?(0,$.jsx)(`span`,{children:n},t.nextKey()):null}function oy(e,t,n){let r=n.caret;if(r===null||r.key!==e.getKey())return t;let i=Math.min(r.ghostLength,t.length),a=t.length-i;return(0,$.jsxs)(le.Fragment,{children:[t.slice(0,a),r.renderTail(t.slice(a))]},n.nextKey())}function sy(e,t){let n=e.getFormat(),r=oy(e,e.getTextContent(),t);return n&16?(0,$.jsx)(`code`,{className:Mv.inlineCode,children:r},t.nextKey()):(n&4&&(r=(0,$.jsx)(`del`,{className:Mv.strikethrough,children:r},t.nextKey())),n&2&&(r=(0,$.jsx)(`em`,{className:Mv.italic,children:r},t.nextKey())),n&1&&(r=(0,$.jsx)(`strong`,{className:Mv.bold,children:r},t.nextKey())),r)}function cy(e,t){return e.getChildren().map(e=>ay(e,t))}function ly(e){if(e===void 0)return null;let t=H().getLastDescendant();return!k(t)||um(t)?null:{...e,key:t.getKey()}}function uy(e,t,n){let r=Fv({namespace:t.namespace,nodes:t.nodes,editable:!1}),i=tf(r);return i.update(()=>{k_(e,t.transformers,void 0,!0)},{discrete:!0}),i.getEditorState().read(()=>{let e=0,a={nextKey:()=>String(e++),editor:i,config:r,caret:ly(n),renderDecorator:t.renderDecorator};return cy(H(),a)})}function dy(e){return(0,$.jsx)($.Fragment,{children:uy(e,Qv)})}var fy=[`B`,`KB`,`MB`,`GB`,`TB`];function py(e){let t=e,n=0;for(;t>=1024&&n<fy.length-1;)t/=1024,n+=1;let r=n===0||t>=100?0:1;return`${t.toFixed(r).replace(/\.0$/,``)} ${fy[n]}`}var my=RegExp(`^[a-z0-9][a-z0-9_-]{0,39}$`),hy=`beacon/`,gy=`(^|[\\s\\n\\t])@${hy}([A-Za-z0-9][A-Za-z0-9_-]*)`;function _y(){return new RegExp(gy,`g`)}function vy(e){return e.length===0?`Short name is required`:e.length>40?`Short name must be at most 40 characters`:my.test(e)?null:`Use lowercase letters, digits, - and _, starting with a letter or digit`}function yy(e){return e.alias??e.label}var by=/[^a-z0-9_-]+/g,xy=/^[-_]+|[-_]+$/g;function Sy(e){let t=e.toLowerCase().replace(by,`-`).replace(xy,``).slice(0,40).replace(xy,``);return t.length>0?t:`beacon`}function Cy(e,t){if(!t.has(e))return e;let n=2;for(;t.has(`${e}-${n}`);)n+=1;return`${e}-${n}`}function wy(e){let t=[...e].sort((e,t)=>e.id.localeCompare(t.id)),n=new Map,r=new Map;for(let e of t)e.alias!==void 0&&e.alias!==null&&(r.has(e.alias)||(n.set(e.id,e.alias),r.set(e.alias,e.id)));for(let e of t){if(n.has(e.id))continue;let t=Cy(Sy(e.label),r);n.set(e.id,t),r.set(t,e.id)}return{handleByBeaconId:n,beaconIdByHandle:r}}function Ty(e){let t=[];for(let n of e.matchAll(_y())){let e=n[2];e!==void 0&&t.push(e.toLowerCase())}return t}function Ey(e,t){let n=Ty(e);if(n.length===0)return{beacons:[],unresolvedHandles:[]};let{beaconIdByHandle:r}=wy(t),i=new Map(t.map(e=>[e.id,e])),a=[],o=[],s=new Set;for(let e of n){let t=r.get(e),n=t===void 0?void 0:i.get(t);n===void 0?o.includes(e)||o.push(e):s.has(n.id)||(s.add(n.id),a.push(n))}return{beacons:a,unresolvedHandles:o}}export{Hr as $,z as A,kc as B,$f as C,ce as Ct,Ro as D,Yr as E,jc as F,pa as G,Fl as H,ua as I,Or as J,ma as K,fl as L,Sr as M,D as N,ni as O,la as P,M as Q,ei as R,cp as S,da as St,mf as T,L as U,ca as V,K as W,Wl as X,Lr as Y,Br as Z,Tv as _,gc as _t,vy as a,zl as at,_v as b,ef as bt,uy as c,H as ct,Kv as d,Fr as dt,Yl as et,Iv as f,kr as ft,kv as g,ti as gt,Ov as h,R as ht,Ey as i,Kr as it,Al as j,_l as k,dy as l,dc as lt,Fv as m,O as mt,yy as n,k as nt,py as o,B as ot,Mv as p,Ll as pt,hi as q,wy as r,Ir as rt,Zv as s,pe as st,hy as t,Jl as tt,Bv as u,Vl as ut,vv as v,js as vt,zf as w,re as wt,mg as x,A as xt,bv as y,I as yt,ri as z};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h as e}from"./pendingActionsStore-
|
|
1
|
+
import{h as e}from"./pendingActionsStore-C6o78Bki.js";var t={name:`chevron-right`,size:24,node:[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]};t.node;var n=e(t),r={name:`code-xml`,size:24,node:[[`path`,{d:`m18 16 4-4-4-4`,key:`1inbqp`}],[`path`,{d:`m6 8-4 4 4 4`,key:`15zrgr`}],[`path`,{d:`m14.5 4-5 16`,key:`e7oirm`}]],aliases:[`code-2`]};r.node;var i=e(r);export{n,i as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BCiCTKAo.js";import{t}from"./react-BWPDF9mI.js";import{t as n}from"./jsx-runtime-BB9-612F.js";import{f as r,p as i}from"./pendingActionsStore-C6o78Bki.js";import{t as a}from"./timer.adapter-DTTP0Zuq.js";import{a as o,c as s,o as c,s as l}from"./segmented-control--alEtfTe.js";import{a as u,f as ee,l as te,n as d,t as f}from"./log-CFGrfkV1.js";import{t as ne}from"./core-types-Ds7PFmZN.js";import{u as re}from"./pathUtils-DTWwEzHK.js";import{t as p}from"./runDetached-138oevj9.js";import{t as m}from"./dom.adapter-C26vNdMA.js";import{n as h,t as g}from"./storage.adapter-DafyA8In.js";var _=e(t(),1),ie={CONNECTING:WebSocket.CONNECTING,OPEN:WebSocket.OPEN,CLOSING:WebSocket.CLOSING,CLOSED:WebSocket.CLOSED,create(e){return new WebSocket(e)}},ae=25e3,v=15e3,y=4e3,b=750,x=5e3,S=class{url;ws=null;started=!1;reconnectTimer=null;reconnectDelayMs=b;subscriptions=new Map;pending=new Map;outboundQueue=[];statusListeners=new Set;heartbeatTimer=null;pingTimeoutTimer=null;pingPromise=null;lastOpenAt=0;lastMessageAt=0;reconnectImmediatelyOnClose=!1;dom;timer;wsBridge;onFrame;handleWindowFocus=()=>{p(`socket.ensureHealthyConnection`,this.ensureHealthyConnection())};handleVisibilityChange=()=>{this.dom.getVisibilityState()===`visible`?(this.startHeartbeat(),p(`socket.ensureHealthyConnection`,this.ensureHealthyConnection())):this.stopHeartbeat()};handleOnline=()=>{p(`socket.ensureHealthyConnection`,this.ensureHealthyConnection())};constructor(e,t={}){this.url=e,this.dom=t.dom??m,this.timer=t.timer??a,this.wsBridge=t.webSocket??ie,this.onFrame=t.onFrame}start(){this.started||(this.started=!0,this.dom.addWindowListener(`focus`,this.handleWindowFocus),this.dom.addWindowListener(`online`,this.handleOnline),this.dom.addDocumentListener(`visibilitychange`,this.handleVisibilityChange),this.connect())}dispose(){this.started=!1,this.reconnectTimer&&=(this.timer.clearTimeout(this.reconnectTimer),null),this.stopHeartbeat(),this.clearPingState(),this.ws?.close(),this.ws=null;for(let e of this.pending.values())e.reject(Error(`Socket disposed`));this.pending.clear()}onStatus(e){return this.statusListeners.add(e),e(this.getStatus()),()=>{this.statusListeners.delete(e)}}subscribe(e,t,n){let r=i(),a={topic:e,listener:t,eventListener:n};return this.subscriptions.set(r,a),this.enqueue({v:1,type:`subscribe`,id:r,topic:e}),()=>{this.subscriptions.delete(r),this.enqueue({v:1,type:`unsubscribe`,id:r})}}command(e){let t=i(),n={v:1,type:`command`,id:t,command:e};return new Promise((e,r)=>{this.pending.set(t,{resolve:e,reject:r}),this.enqueue(n)})}notify(e){this.enqueue({v:1,type:`command`,id:i(),command:e})}ensureHealthyConnection(){let e=this.wsBridge;return!this.ws||this.ws.readyState===e.CLOSED||this.ws.readyState===e.CLOSING?(this.reconnectNow(),Promise.resolve()):this.ws.readyState===e.CONNECTING||!this.isConnectionStale()?Promise.resolve():this.sendPing()}connect(){this.started&&(this.emitStatus(`connecting`),this.ws=this.wsBridge.create(this.url),this.ws.addEventListener(`open`,()=>{this.reconnectDelayMs=b,this.reconnectImmediatelyOnClose=!1,this.lastOpenAt=Date.now(),this.lastMessageAt=this.lastOpenAt,this.emitStatus(`connected`),this.startHeartbeat();for(let[e,t]of this.subscriptions.entries())this.sendNow({v:1,type:`subscribe`,id:e,topic:t.topic});for(;this.outboundQueue.length>0;){let e=this.outboundQueue.shift();e&&this.sendNow(e)}}),this.ws.addEventListener(`message`,e=>{this.lastMessageAt=Date.now();let t=performance.now(),n=e instanceof MessageEvent?e.data:void 0,r=String(n),i;try{i=JSON.parse(r)}catch{return}if(this.onFrame?.(i,{receivedAt:t,bytes:r.length}),i.type===`snapshot`)this.subscriptions.get(i.id)?.listener(i.snapshot.data);else if(i.type===`event`)this.subscriptions.get(i.id)?.eventListener?.(i.event);else if(i.type===`ack`){let e=this.pending.get(i.id);if(!e)return;this.pending.delete(i.id),e.resolve(i.result)}else if(i.type===`error`){if(!i.id){f.error(te,i.message);return}let e=this.pending.get(i.id);if(!e)return;this.pending.delete(i.id),e.reject(Error(i.message))}}),this.ws.addEventListener(`close`,()=>{if(!this.started)return;let e=this.reconnectImmediatelyOnClose;this.reconnectImmediatelyOnClose=!1,this.stopHeartbeat(),this.clearPingState(),this.emitStatus(`disconnected`);for(let e of this.pending.values())e.reject(Error(`Disconnected`));this.pending.clear(),e?this.connect():this.scheduleReconnect()}))}scheduleReconnect(){this.reconnectTimer===null&&(this.reconnectTimer=this.timer.setTimeout(()=>{this.reconnectTimer=null,this.connect(),this.reconnectDelayMs=Math.min(this.reconnectDelayMs*2,x)},this.reconnectDelayMs))}getStatus(){let e=this.wsBridge;return this.ws?.readyState===e.OPEN?`connected`:this.ws?.readyState===e.CONNECTING?`connecting`:`disconnected`}emitStatus(e){for(let t of this.statusListeners)t(e)}isConnectionStale(){let e=Math.max(this.lastMessageAt,this.lastOpenAt);return e>0&&Date.now()-e>=ae}sendPing(){if(this.pingPromise)return this.pingPromise;let e=this.command({type:`system.ping`}).then(()=>{this.clearPingState()}).catch(e=>{throw this.clearPingState(),this.reconnectNow(),e});return this.pingTimeoutTimer=this.timer.setTimeout(()=>{this.clearPingState(),this.reconnectNow()},y),this.pingPromise=e,e}reconnectNow(){let e=this.wsBridge;this.reconnectTimer!==null&&(this.timer.clearTimeout(this.reconnectTimer),this.reconnectTimer=null),!this.ws||this.ws.readyState===e.CLOSED?this.connect():this.ws.readyState!==e.CONNECTING&&(this.reconnectImmediatelyOnClose=!0,this.ws.close())}startHeartbeat(){this.dom.getVisibilityState()===`visible`&&this.heartbeatTimer===null&&(this.heartbeatTimer=this.timer.setInterval(()=>{if(this.dom.getVisibilityState()!==`visible`){this.stopHeartbeat();return}let e=this.wsBridge;this.ws?.readyState===e.OPEN&&p(`socket.ensureHealthyConnection`,this.ensureHealthyConnection())},v))}stopHeartbeat(){this.heartbeatTimer!==null&&(this.timer.clearInterval(this.heartbeatTimer),this.heartbeatTimer=null)}clearPingState(){this.pingTimeoutTimer!==null&&(this.timer.clearTimeout(this.pingTimeoutTimer),this.pingTimeoutTimer=null),this.pingPromise=null}enqueue(e){let t=this.wsBridge;this.ws?.readyState===t.OPEN?this.sendNow(e):this.outboundQueue.push(e)}sendNow(e){this.ws?.send(JSON.stringify(e))}},C=`kanna:profile-send-to-starting`,oe=`[kanna/send->starting][client]`,w=`[kanna/send->starting][client-ws]`;function se(e){let t=new Map;function n(){try{return e.some(e=>e.getItem(C)===`1`)}catch{return!1}}function r(e){let n;for(let r of t.values())r.serverChatId===e&&(!n||r.startedAt>n.startedAt)&&(n=r);return n}function i(e){return Number((performance.now()-e.startedAt).toFixed(1))}function a(e,t,n){f.debug(oe,{traceId:e.traceId,stage:t,elapsedMs:i(e),serverChatId:e.serverChatId,routeChatIdAtSend:e.routeChatIdAtSend,...n})}return{begin({traceId:e,chatId:r,details:i}){if(!n())return;let o={traceId:e,startedAt:performance.now(),serverChatId:r,routeChatIdAtSend:r,stages:new Set};t.set(e,o),a(o,`handle_send_called`,i)},note(e,n,r){let i=t.get(e);i&&a(i,n,r)},acknowledge(e,n,r){let i=t.get(e);i&&(i.serverChatId=n,a(i,`chat_send_ack_received`,{resultChatId:n,...r}))},fail(e,n){let r=t.get(e);r&&(a(r,`handle_send_failed`,{error:n}),t.delete(e))},mark(e,t,n){let i=r(e);i&&!i.stages.has(t)&&(i.stages.add(t),a(i,t,n))},end(e,n,o){let s=r(e);s&&(a(s,n,{...o,totalMs:i(s)}),t.delete(s.traceId))},observeFrame(e,t){n()&&(e.type===`snapshot`&&e.snapshot.type===`chat`&&e.snapshot.data?.runtime.status===`starting`&&f.debug(w,{stage:`socket_message_received`,receivedAt:t.receivedAt,payloadBytes:t.bytes,chatId:e.snapshot.data.runtime.chatId,status:e.snapshot.data.runtime.status,messageCount:e.snapshot.data.messages.length}),e.type===`ack`&&f.debug(w,{stage:`socket_ack_received`,receivedAt:t.receivedAt,payloadBytes:t.bytes,commandId:e.id}))}}}var T=se([h,g]),E=e(n(),1),D=(0,_.createContext)(null);function ce(e){let t=e.getHref();return`${t.startsWith(`https://`)?`wss:`:`ws:`}//${new URL(t).host}${re.websocket.path}`}function le({children:e,socket:t,ports:n}){let r=n?.dom??m,i=(0,_.useMemo)(()=>t?null:new S(ce(r),{onFrame:T.observeFrame,...n}),[]),a=t??i;return(0,_.useEffect)(()=>{if(i)return i.start(),()=>{i.dispose()}},[i]),(0,E.jsx)(D.Provider,{value:a,children:e})}function O(){return(0,_.useContext)(D)}function k({tooltip:e,children:t,className:n,inline:i=!1,side:a}){let u=r(`truncate`,n);return(0,E.jsx)(l,{children:(0,E.jsxs)(o,{children:[(0,E.jsx)(s,{asChild:!0,children:i?(0,E.jsx)(`span`,{className:u,children:t}):(0,E.jsx)(`div`,{className:u,children:t})}),(0,E.jsx)(c,{side:a,children:e})]})})}function A({label:e,children:t,side:n,contentClassName:r}){return(0,E.jsx)(l,{children:(0,E.jsxs)(o,{children:[(0,E.jsx)(s,{asChild:!0,children:t}),(0,E.jsx)(c,{side:n,className:r,children:e})]})})}var j=_.forwardRef(({className:e,...t},n)=>(0,E.jsx)(`textarea`,{"data-gramm":`false`,"data-gramm_editor":`false`,"data-enable-grammarly":`false`,"data-1p-ignore":!0,autoComplete:`off`,className:r(`flex w-full rounded-lg border border-border bg-background px-2.5 py-2 text-sm placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50`,e),ref:n,...t}));j.displayName=`Textarea`;function M(e,t){return e===t}function N(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function P(e,t){return Object.is(e,t)?!0:Array.isArray(e)&&Array.isArray(t)?e.length===t.length&&e.every((e,n)=>P(e,t[n])):N(e)&&N(t)?F(e,t):!1}function F(e,t,n=[]){if(e===t)return!0;let r=0;for(let i in e)if(!n.includes(i)&&(r+=1,!(i in t)||!P(e[i],t[i])))return!1;let i=0;for(let e in t)n.includes(e)||(i+=1);return r===i}function I(e,t,n){for(let r in e)if(!e[r](t[r],n[r]))return!1;return!0}function L(e,t){return ne.every(n=>e[n]===t[n])}function R(e,t){return e===t||e.length===t.length&&e.every((e,n)=>{let r=t[n];return r!==void 0&&e.id===r.id&&e.taskType===r.taskType&&e.description===r.description&&e.startedAt===r.startedAt})}var z={chatId:M,projectId:M,localPath:M,title:M,status:M,isDraining:M,provider:M,planMode:M,sessionTokensByProvider:L,timings:()=>!0,policyOverride:()=>!0,sessionState:()=>!0,backgroundTasks:R};function B(e,t){return e===t?!0:!e||!t?!1:I(z,e,t)}function V(e,t){return e===t||e.length===t.length&&e.every((e,n)=>{let r=t[n];return!!r&&e.path===r.path&&e.changeType===r.changeType&&e.isUntracked===r.isUntracked&&e.additions===r.additions&&e.deletions===r.deletions&&e.patchDigest===r.patchDigest&&e.mimeType===r.mimeType&&e.size===r.size})}function H(e,t){let n=e?.entries??[],r=t?.entries??[];return n.length===r.length&&n.every((e,t)=>{let n=r[t];return!!n&&e.sha===n.sha&&e.summary===n.summary&&e.description===n.description&&e.authorName===n.authorName&&e.authoredAt===n.authoredAt&&e.githubUrl===n.githubUrl&&e.tags.length===n.tags.length&&e.tags.every((e,t)=>e===n.tags[t])})}var U={status:M,files:V,branchHistory:H,branchName:M,defaultBranchName:M,hasOriginRemote:M,originRepoSlug:M,hasUpstream:M,aheadCount:M,behindCount:M,lastFetchedAt:M};function W(e,t){return e===t?!0:!e||!t?!1:I(U,e,t)}function ue(e,t){return e===t?!0:!e||!t||e.length!==t.length?!1:e.every((e,n)=>e._id===t[n]?._id)}function de(e,t){return e===t?!0:!e||!t||e.length!==t.length?!1:e.every((e,n)=>e.id===t[n]?.id)}function fe(e,t){return e===t?!0:!e||!t?!1:e.hasOlder===t.hasOlder&&e.olderCursor===t.olderCursor&&e.recentLimit===t.recentLimit}function pe(e,t){return e.id===t.id&&e.content===t.content&&e.createdAt===t.createdAt&&e.provider===t.provider&&e.model===t.model&&e.planMode===t.planMode&&JSON.stringify(e.modelOptions)===JSON.stringify(t.modelOptions)&&me(e.attachments,t.attachments)}function me(e,t){return e===t||e.length===t.length&&e.every((e,n)=>{let r=t[n];return!!r&&e.id===r.id&&e.kind===r.kind&&e.displayName===r.displayName&&e.absolutePath===r.absolutePath&&e.relativePath===r.relativePath&&e.contentUrl===r.contentUrl&&e.mimeType===r.mimeType&&e.size===r.size})}function he(e,t){return e===t?!0:!e||!t||e.length!==t.length?!1:e.every((e,n)=>pe(e,t[n]))}function ge(e,t){if(e===t)return!0;if(!e||!t)return!1;let n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(n=>{let r=e[n],i=t[n];return!r||!i?!1:r.state===i.state&&r.scheduledAt===i.scheduledAt&&r.resetAt===i.resetAt&&r.detectedAt===i.detectedAt&&r.tz===i.tz})}function _e(e,t){if(e===t)return!0;if(!e||!t)return!1;let n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(n=>{let r=e[n],i=t[n];return!r||!i?!1:r.state===i.state&&r.url===i.url&&r.error===i.error&&r.port===i.port&&r.activatedAt===i.activatedAt&&r.stoppedAt===i.stoppedAt})}function ve(e,t){if(e===t)return!0;if(!e||!t)return!1;let n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(n=>{let r=e[n],i=t[n];return!r||!i?!1:r.status===i.status&&r.entries.length===i.entries.length&&(r.finalText??``)===(i.finalText??``)&&(r.pendingTool?.toolUseId??null)===(i.pendingTool?.toolUseId??null)&&(r.usage?.outputTokens??null)===(i.usage?.outputTokens??null)&&r.finishedAt===i.finishedAt&&(r.error?.code??null)===(i.error?.code??null)})}function ye(e,t){if(e===t)return!0;if(e.armed!==t.armed||e.rows.length!==t.rows.length||!e.rows.every((e,n)=>{let r=t.rows[n];return r!=null&&e.runId===r.runId&&e.status===r.status&&e.label===r.label}))return!1;let n=e.rateLimit,r=t.rateLimit;return n==null==(r==null)?n&&r?n.resetAt===r.resetAt&&n.scheduled===r.scheduled:!0:!1}function be(e,t){return e===t?!0:!e||!t?!1:B(e.runtime,t.runtime)&&he(e.queuedMessages,t.queuedMessages)&&ue(e.messages,t.messages)&&fe(e.history,t.history)&&de(e.availableProviders,t.availableProviders)&&ge(e.schedules,t.schedules)&&e.liveScheduleId===t.liveScheduleId&&_e(e.tunnels,t.tunnels)&&e.liveTunnelId===t.liveTunnelId&&ve(e.subagentRuns,t.subagentRuns)&&ye(e.loopProgress,t.loopProgress)}function xe(e,t){return!!(e&&e.status!==`unknown`&&t&&t.status===`unknown`&&t.files.length===0)}var G=`kanna:ui-update-restart`,K=`kanna:last-update-reload-request`;function q(e){let t=e.getItem(G);return t===`awaiting_disconnect`||t===`awaiting_server_ready`?t:`idle`}function J(e,t){return t===`updating`||t===`restart_pending`?{active:!0,label:`Installing update`}:e===`awaiting_disconnect`||e===`awaiting_server_ready`?{active:!0,label:`Re-deploying Kanna`}:{active:!1,label:``}}function Se(e,t){switch(t.kind){case`reload_requested`:return String(t.reloadRequestedAt)===t.lastHandled?e:`awaiting_disconnect`;case`update_initiated`:return`awaiting_disconnect`;case`connection_status_changed`:return t.connectionStatus===`disconnected`&&e===`awaiting_disconnect`?`awaiting_server_ready`:e;case`server_ready`:return`idle`;case`aborted`:return`idle`;case`update_status_changed`:return e}}var Ce=class{deps;phase;updateStatus=null;pollCancelled=!1;pollTimeoutId=null;isServerReady;constructor(e,t){this.deps=e,this.isServerReady=t.isServerReady,this.phase=q(e.storage),this.phase===`awaiting_server_ready`&&this.startPolling()}getSnapshot(){return{phase:this.phase,activity:J(this.phase,this.updateStatus)}}emit(){this.deps.onSnapshot(this.getSnapshot())}setPhase(e){e!==this.phase&&(this.phase=e,e===`idle`?this.deps.storage.removeItem(G):this.deps.storage.setItem(G,e),this.emit())}dispatch(e){if(e.kind===`update_status_changed`){let t=this.updateStatus;this.updateStatus=e.updateStatus,t!==this.updateStatus&&this.emit();return}let t=Se(this.phase,e);e.kind===`reload_requested`&&t===`awaiting_disconnect`&&this.deps.storage.setItem(K,String(e.reloadRequestedAt)),this.setPhase(t),t===`awaiting_server_ready`&&this.startPolling()}startPolling(){this.pollCancelled=!1,p(`appRuntime.poll`,this.poll())}async poll(){try{if(await this.isServerReady()){if(this.pollCancelled)return;this.setPhase(`idle`),this.deps.dom.reload();return}}catch{}this.pollCancelled||(this.pollTimeoutId=this.deps.timer.setTimeout(()=>{p(`appRuntime.poll`,this.poll())},500))}close(){this.pollCancelled=!0,this.pollTimeoutId!==null&&(this.deps.timer.clearTimeout(this.pollTimeoutId),this.pollTimeoutId=null)}static getLastHandledReloadRequest(e){return e.getItem(K)}},we=[],Te={};function Ee(e,t){return t??e}var De={starredProjectGroups:[],projectGroups:[],stacks:[]},Y=ee()(e=>({sidebarData:De,optimisticSidebarProjectOrder:null,localProjects:null,updateSnapshot:null,uiRestartPhase:q(h),diffSnapshotsByKey:Te,keybindings:null,pushConfig:null,llmProvider:null,connectionStatus:`connecting`,sidebarReady:!1,localProjectsReady:!1,selectedProjectId:null,sidebarOpen:!1,sidebarCollapsed:!1,addProjectModalOpen:!1,commandError:null,startingLocalPath:null,pendingChatId:null,optimisticUserPrompts:we,focusEpoch:0,setSidebarData:t=>e({sidebarData:t}),setOptimisticSidebarProjectOrder:t=>e(e=>({optimisticSidebarProjectOrder:typeof t==`function`?t(e.optimisticSidebarProjectOrder):t})),setLocalProjects:t=>e({localProjects:t}),setUpdateSnapshot:t=>e({updateSnapshot:t}),setUiRestartPhase:t=>e({uiRestartPhase:t}),setDiffSnapshotsByKey:t=>e(e=>({diffSnapshotsByKey:typeof t==`function`?t(e.diffSnapshotsByKey):t})),setKeybindings:t=>e({keybindings:t}),setPushConfig:t=>e({pushConfig:t}),setLlmProvider:t=>e({llmProvider:t}),setConnectionStatus:t=>e({connectionStatus:t}),setSidebarReady:t=>e({sidebarReady:t}),setLocalProjectsReady:t=>e({localProjectsReady:t}),setSelectedProjectId:t=>e({selectedProjectId:t}),setSidebarOpen:t=>e({sidebarOpen:t}),setSidebarCollapsed:t=>e({sidebarCollapsed:t}),setAddProjectModalOpen:t=>e({addProjectModalOpen:t}),setCommandError:t=>e({commandError:t}),setStartingLocalPath:t=>e({startingLocalPath:t}),setPendingChatId:t=>e({pendingChatId:t}),setOptimisticUserPrompts:t=>e(e=>({optimisticUserPrompts:typeof t==`function`?t(e.optimisticUserPrompts):t})),incrementFocusEpoch:()=>e(e=>({focusEpoch:e.focusEpoch+1}))})),Oe=`Not connected to the Kanna server`;function X(){Y.getState().setCommandError(null)}function Z(e){Y.getState().setCommandError(e.message)}async function Q(e){try{let t=await e();return X(),{ok:!0,value:t}}catch(e){let t=u(e);return Z(t),{ok:!1,error:t}}}async function $(e){let t=await Q(e);if(!t.ok)throw t.error;return t.value}async function ke(e){let t=await Q(e);return t.ok?t.value:void 0}async function Ae(e,t){return await $(async()=>{if(!e)throw Error(Oe);return await e.command(t)})}async function je(e,t){e(null);try{await t()}catch(t){e(d(t))}}export{k as _,je as a,T as b,Y as c,xe as d,be as f,A as g,j as h,ke as i,Ce as l,F as m,Z as n,$ as o,W as p,Ae as r,Ee as s,X as t,J as u,le as v,O as y};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BCiCTKAo.js";import{t}from"./react-BWPDF9mI.js";import{h as n}from"./pendingActionsStore-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BCiCTKAo.js";import{t}from"./react-BWPDF9mI.js";import{h as n}from"./pendingActionsStore-C6o78Bki.js";import{r}from"./log-CFGrfkV1.js";var i={name:`list-todo`,size:24,node:[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`rect`,{x:`3`,y:`4`,width:`6`,height:`6`,rx:`1`,key:`cif1o7`}]]};i.node;var a=n(i);function o(e){if(e==null)return null;switch(typeof e){case`string`:case`boolean`:return e;case`number`:return Number.isFinite(e)?e:null}if(Array.isArray(e))return e.map(e=>o(e));if(r(e)){let t={};for(let[n,r]of Object.entries(e))r!==void 0&&(t[n]=o(r));return t}return null}var s=e(t(),1),c=e=>Symbol.iterator in e,l=e=>`entries`in e,u=(e,t)=>{let n=e instanceof Map?e:new Map(e.entries()),r=t instanceof Map?t:new Map(t.entries());if(n.size!==r.size)return!1;for(let[e,t]of n)if(!r.has(e)||!Object.is(t,r.get(e)))return!1;return!0},d=(e,t)=>{let n=e[Symbol.iterator](),r=t[Symbol.iterator](),i=n.next(),a=r.next();for(;!i.done&&!a.done;){if(!Object.is(i.value,a.value))return!1;i=n.next(),a=r.next()}return!!i.done&&!!a.done};function f(e,t){return Object.is(e,t)?!0:typeof e!=`object`||!e||typeof t!=`object`||!t||Object.getPrototypeOf(e)!==Object.getPrototypeOf(t)?!1:c(e)&&c(t)?l(e)&&l(t)?u(e,t):d(e,t):u({entries:()=>Object.entries(e)},{entries:()=>Object.entries(t)})}function p(e){let t=s.useRef(void 0);return n=>{let r=e(n);return f(t.current,r)?t.current:t.current=r}}function m(e,t,n){let r=typeof e.maxTokens==`number`&&Number.isFinite(e.maxTokens)?e.maxTokens:null,i=r&&r>0?Math.min(100,e.usedTokens/r*100):null,a=r===null?null:Math.max(0,Math.round(r-e.usedTokens)),o=i===null?null:Math.max(0,100-i);return{...e,compactsAutomatically:e.compactsAutomatically||n,maxTokens:r??void 0,remainingTokens:a,usedPercentage:i,remainingPercentage:o,updatedAt:t}}function h(e){let t=e.some(e=>e.kind===`compact_boundary`||e.kind===`compact_summary`||e.kind===`context_cleared`);for(let n=e.length-1;n>=0;--n){let r=e[n];if(r&&!(r.kind!==`context_window_updated`||r.usage.usedTokens<=0))return m(r.usage,new Date(r.createdAt).toISOString(),t)}return null}function g(e,t){return!e||t===null||!Number.isFinite(t)||t<=0?e:m({...e,maxTokens:t},e.updatedAt,e.compactsAutomatically)}function _(e){return e===void 0||!Number.isFinite(e)||e<0?0:e}function v(e,t){let n=0,r=0,i=0,a=0;for(let t of e){if(t.kind!==`result`)continue;let e=t.usage;e&&(n+=_(e.inputTokens),r+=_(e.outputTokens),i+=_(e.cachedInputTokens)),a+=_(t.costUsd??e?.costUsd)}for(let e of t){let t=e.usage;t&&(n+=_(t.inputTokens),r+=_(t.outputTokens),i+=_(t.cachedInputTokens),a+=_(t.costUsd))}if(n===0&&r===0&&i===0&&a===0)return null;let o=n>0?i/n*100:null;return{inputTokens:n,outputTokens:r,cachedTokens:i,costUsd:a,cacheHitPercentage:o}}function y(e){return!Number.isFinite(e)||e<=0?`$0.00`:e<.01?`<$0.01`:`$${e.toFixed(2)}`}function b(e){return e==null||!Number.isFinite(e)?`0`:e<1e3?`${Math.round(e)}`:e<1e4?`${(e/1e3).toFixed(1).replace(/\.0$/,``)}k`:e<1e6?`${Math.round(e/1e3)}k`:`${(e/1e6).toFixed(1).replace(/\.0$/,``)}m`}function x(e){return e<10?`${e.toFixed(1).replace(/\.0$/,``)}%`:`${Math.round(e)}%`}export{x as a,o as c,y as i,a as l,h as n,g as o,b as r,p as s,v as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BCiCTKAo.js";import{t}from"./react-BWPDF9mI.js";import{h as n,s as r}from"./pendingActionsStore-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BCiCTKAo.js";import{t}from"./react-BWPDF9mI.js";import{h as n,s as r}from"./pendingActionsStore-C6o78Bki.js";import{t as i}from"./timer.adapter-DTTP0Zuq.js";import{f as a}from"./log-CFGrfkV1.js";var o={name:`check`,size:24,node:[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]};o.node;var s=n(o),c={name:`copy`,size:24,node:[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]};c.node;var l=n(c),u=e(t(),1),d={writeText(e){return typeof navigator>`u`||!navigator.clipboard?Promise.reject(Error(`Clipboard API not available`)):navigator.clipboard.writeText(e)},readText(){return typeof navigator>`u`||!navigator.clipboard?Promise.reject(Error(`Clipboard API not available`)):navigator.clipboard.readText()}},f=2e3,p={},m=a()((e,t)=>({copiedTokens:p,nextToken:1,markCopied:n=>{let r=t().nextToken;return e(e=>({nextToken:r+1,copiedTokens:{...e.copiedTokens,[n]:r}})),r},clearCopied:(n,i)=>{let{copiedTokens:a}=t();a[n]===i&&e({copiedTokens:r(a,n,p)})}}));async function h(e,t,n=i){await t();let r=m.getState().markCopied(e);n.setTimeout(()=>m.getState().clearCopied(e,r),f)}function g(e){return m(t=>t.copiedTokens[e]!==void 0)}var _=0;function v(){return _+=1,`copy:${_}`}function y(e={}){let t=(0,u.useMemo)(v,[]),n=g(t),r=e.clipboard??d,a=e.timer??i;return{copied:n,copy:(0,u.useCallback)(e=>h(t,()=>r.writeText(e),a),[r,t,a])}}export{l as a,d as i,g as n,s as o,y as r,h as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BCiCTKAo.js";import{t}from"./react-BWPDF9mI.js";import{t as n}from"./jsx-runtime-BB9-612F.js";import{m as r,p as i}from"./log-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BCiCTKAo.js";import{t}from"./react-BWPDF9mI.js";import{t as n}from"./jsx-runtime-BB9-612F.js";import{m as r,p as i}from"./log-CFGrfkV1.js";var a=e(t(),1),o=e(n(),1);function s(e,t){let n=(0,a.createContext)(null);function s({init:e,children:i}){let s=(0,a.useRef)(null);return s.current===null&&(s.current=r(t(e))),(0,o.jsx)(n.Provider,{value:s.current,children:i})}function c(){let t=(0,a.useContext)(n);if(t===null)throw Error(`${e}: useScopedStore must be used inside its Provider`);return t}function l(e){return i(c(),e)}return{Provider:s,useScopedStore:l,useScopedStoreApi:c}}function c(e,t,n){return function(r){return(0,o.jsx)(e.Provider,{init:n(r),children:(0,o.jsx)(t,{...r})})}}function l(e,t){return c(e,t,()=>void 0)}export{l as n,c as r,s as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BCiCTKAo.js";import{t}from"./react-BWPDF9mI.js";import{t as n}from"./timer.adapter-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BCiCTKAo.js";import{t}from"./react-BWPDF9mI.js";import{t as n}from"./timer.adapter-DTTP0Zuq.js";import{f as r}from"./log-CFGrfkV1.js";var i=e(t(),1),a={timer:n};function o(e=1e3,t){let{timer:n}=t??a,[r,o]=(0,i.useState)(()=>Date.now()),s=(0,i.useRef)(e);return(0,i.useLayoutEffect)(()=>{s.current=e}),(0,i.useEffect)(()=>{let e=n.setInterval(()=>{o(Date.now())},s.current);return()=>n.clearInterval(e)},[n]),r}var s=[],c=r()(e=>({rows:s,setRows:t=>e({rows:t.length>0?t:s})}));export{o as n,c as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h as e}from"./pendingActionsStore-
|
|
1
|
+
import{h as e}from"./pendingActionsStore-C6o78Bki.js";var t={name:`file-pen`,size:24,node:[[`path`,{d:`M12.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v9.34`,key:`o6klzx`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10.378 12.622a1 1 0 0 1 3 3.003L8.36 20.637a2 2 0 0 1-.854.506l-2.867.837a.5.5 0 0 1-.62-.62l.836-2.869a2 2 0 0 1 .506-.853z`,key:`zhnas1`}]],aliases:[`file-edit`]};t.node;var n=e(t),r={name:`file-plus-corner`,size:24,node:[[`path`,{d:`M11.35 22H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v5.35`,key:`17jvcc`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M14 19h6`,key:`bvotb8`}],[`path`,{d:`M17 16v6`,key:`18yu1i`}]],aliases:[`file-plus-2`]};r.node;var i=e(r);export{n,i as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as e}from"./pendingActionsStore-
|
|
1
|
+
import{s as e}from"./pendingActionsStore-C6o78Bki.js";import{f as t}from"./log-CFGrfkV1.js";import{N as n,P as r}from"./appSettingsStore-DhpIEBz2.js";var i={projectOpened:`project.opened`,projectRemoved:`project.removed`,projectDeleted:`project.deleted`,projectStarred:`project.starred`,projectInstructions:`project.instructions`,chatCreated:`chat.created`,chatProjectsAttached:`chat.projectsAttached`,chatRenamed:`chat.renamed`,chatDeleted:`chat.deleted`,chatArchived:`chat.archived`,chatUnarchived:`chat.unarchived`,chatPinned:`chat.pinned`,chatProvider:`chat.provider`,chatModel:`chat.model`,chatPlanMode:`chat.planMode`,chatPolicy:`chat.policy`,queueEnqueued:`queue.enqueued`,queueRemoved:`queue.removed`,turnStarted:`turn.started`,turnFinished:`turn.finished`,turnFailed:`turn.failed`,turnCancelled:`turn.cancelled`,stackAdded:`stack.added`,stackRemoved:`stack.removed`,stackRenamed:`stack.renamed`,stackProjectAdded:`stack.projectAdded`,stackProjectRemoved:`stack.projectRemoved`,stackInstructions:`stack.instructions`,subagentStarted:`subagent.started`,subagentCompleted:`subagent.completed`,subagentFailed:`subagent.failed`,subagentCancelled:`subagent.cancelled`,subagentToolPending:`subagent.toolPending`,subagentToolResolved:`subagent.toolResolved`,toolRequestPut:`toolRequest.put`,toolRequestResolved:`toolRequest.resolved`,autocontinueProposed:`autocontinue.proposed`,autocontinueAccepted:`autocontinue.accepted`,autocontinueRescheduled:`autocontinue.rescheduled`,autocontinueCancelled:`autocontinue.cancelled`,autocontinueFired:`autocontinue.fired`,loopArmed:`loop.armed`,loopRunOutcome:`loop.runOutcome`,loopDisarmed:`loop.disarmed`,cronArmed:`cron.armed`,cronDisarmed:`cron.disarmed`,cronPaused:`cron.paused`,cronResumed:`cron.resumed`,cronRunStarted:`cron.runStarted`,cronRunOutcome:`cron.runOutcome`,cronRunSkipped:`cron.runSkipped`,taskCreated:`task.created`,taskUpdated:`task.updated`,taskDeleted:`task.deleted`,taskClaimed:`task.claimed`,taskRunBound:`task.runBound`,taskSettled:`task.settled`,taskIntegrated:`task.integrated`,taskNote:`task.note`,taskEpochAdvanced:`task.epochAdvanced`,taskNativeSynced:`task.nativeSynced`};`${n}`;function a(e){return r(...e.split(`.`))}function o(e){return a(i[e])}function s(e){return e.split(`.`)[1]??``}o(`toolRequestPut`),o(`toolRequestResolved`);var c=new Set([o(`cronRunOutcome`),o(`loopRunOutcome`)]);[o(`turnFailed`),o(`subagentFailed`),...c];function l(e){return`messages`in e?e.state===`new`||e.state===`needs_you`||e.state===`fyi`:e.attention}var u={};function d(e){return{kind:`thread`,id:e.id,ts:e.lastMessageAt,unread:e.unread,thread:e}}function f(e){return{kind:`item`,id:e.id,ts:e.ts,unread:e.unread,item:e}}function p(e){return e.projectId===void 0}function m(e,t){return!(!p(t)||t.sourceKind!==void 0&&e.sourceKind!==t.sourceKind||t.chatId!==void 0&&e.chatId!==t.chatId||t.attentionOnly===!0&&e.state!==`needs_you`&&e.state!==`new`)}function h(e,t){return!(t.sourceKind!==void 0&&e.source.kind!==t.sourceKind||t.projectId!==void 0&&e.projectId!==t.projectId||t.chatId!==void 0&&e.chatId!==t.chatId||t.attentionOnly===!0&&!e.attention)}function g(e,t){return e.unread===t.unread?t.ts-e.ts:e.unread?-1:1}function _(e,t){return t.ts-e.ts}function v(e,t,n,r){let i=e===`inbox`;return[...t.filter(e=>(!i||l(e))&&m(e,r)).map(d),...n.filter(e=>(!i||l(e))&&h(e,r)).map(f)].sort(i?g:_)}function y(e){let t=new Date(e);return new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime()}var b=864e5;function x(e,t){let n=Math.round((t-e)/b);return n<=0?`Today`:n===1?`Yesterday`:new Date(e).toLocaleDateString(void 0,{weekday:`short`,month:`short`,day:`numeric`})}function S(e,t){let n=y(t),r=[];for(let t of e){let e=y(t.ts),n=r[r.length-1];n!==void 0&&n.dayStart===e?n.records.push(t):r.push({dayStart:e,records:[t]})}return r.map(e=>({key:String(e.dayStart),label:x(e.dayStart,n),records:e.records}))}function C(e){let t=null;for(let n of e)(t===null||n.ts<t)&&(t=n.ts);return t}function w(e,t,n){let r=C(e.filter(e=>m(e,n)).map(d)),i=C(t.filter(e=>h(e,n)).map(f));return{threadBefore:r??2**53-1,itemBefore:i??2**53-1}}var T=[],E=[],D={},O={};function k(e,t){return e.length>0?e:t}function A(e,t,n){if(t.length===0)return[];let r=new Set(t.map(e=>e.id)),i=Math.min(...t.map(n));return e.filter(e=>!r.has(e.id)&&n(e)<i)}function j(e,t){if(t.length===0)return e;let n=new Set(t.map(e=>e.id));return[...e.filter(e=>!n.has(e.id)),...t]}function M(e,t){return{filter:{...e.filter,...t},olderExhausted:!1}}var N=e=>e.lastMessageAt,P=e=>e.ts,F=t()(t=>({threads:T,items:E,unreadCount:0,total:0,snapshotAt:0,tab:`inbox`,filter:u,selectedThreadId:null,replyDrafts:D,olderExhausted:!1,rawOpen:O,applySnapshot:e=>t(t=>({threads:k([...e.threads,...A(t.threads,e.threads,N)],T),items:k([...e.items,...A(t.items,e.items,P)],E),unreadCount:e.unreadCount,total:e.total,snapshotAt:Date.now()})),appendPage:e=>t(t=>({threads:k(j(t.threads,e.threads),T),items:k(j(t.items,e.items),E),olderExhausted:e.threads.length===0&&e.items.length===0})),setTab:e=>t({tab:e}),setFilter:e=>t({filter:e,olderExhausted:!1}),toggleAttentionOnly:()=>t(e=>M(e,{attentionOnly:e.filter.attentionOnly!==!0||void 0})),toggleSourceKind:e=>t(t=>M(t,{sourceKind:t.filter.sourceKind===e?void 0:e})),setProjectFilter:e=>t(t=>M(t,{projectId:e??void 0})),setChatFilter:e=>t(t=>M(t,{chatId:e??void 0})),select:e=>t({selectedThreadId:e}),setReplyDraft:(e,n)=>t(t=>({replyDrafts:{...t.replyDrafts,[e]:n}})),clearReplyDraft:e=>t(t=>({replyDrafts:{...t.replyDrafts,[e]:``}})),toggleRaw:n=>t(t=>t.rawOpen[n]?{rawOpen:e(t.rawOpen,n,O)}:{rawOpen:{...t.rawOpen,[n]:!0}})})),I=e=>e.unreadCount,L=e=>e.threads,R=e=>e.items,z=e=>e.total,B=e=>e.snapshotAt,V=e=>e.tab,H=e=>e.filter,U=e=>e.olderExhausted;function W(e){let t=e.selectedThreadId;return t===null?null:e.threads.find(e=>e.id===t)??null}export{z as a,W as c,u as d,S as f,s as g,o as h,L as i,B as l,v as m,R as n,I as o,w as p,V as r,U as s,H as t,F as u};
|