@cuongtran001/kanna 1.94.2 → 1.96.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-CcEgSKEH.js → BoardsPage-J03IilS6.js} +1 -1
- package/dist/client/assets/{BoardsRoutePage-DYG2WpTB.js → BoardsRoutePage-C9ruZTAp.js} +1 -1
- package/dist/client/assets/ChatPage-Br846W9n.js +35 -0
- package/dist/client/assets/{CronJobsPage-LCRBV65t.js → CronJobsPage-VpFQ8to7.js} +1 -1
- package/dist/client/assets/{FilePreviewSheet-DK4JlQ4b.js → FilePreviewSheet-CfrHVm3Z.js} +2 -2
- package/dist/client/assets/{FlowSurface-B34Ui27C.js → FlowSurface-CwMymdE7.js} +1 -1
- package/dist/client/assets/{GenUIBlock-B90q9Hoz.js → GenUIBlock-BNjeGZYW.js} +2 -2
- package/dist/client/assets/{InboundHandlerFields-CrbQcRFr.js → InboundHandlerFields-CxNZ0mLE.js} +1 -1
- package/dist/client/assets/{InboxPage-CcU-wMdJ.js → InboxPage-dS7nGsdx.js} +1 -1
- package/dist/client/assets/{LocalProjectsPage-Csj-YWVf.js → LocalProjectsPage-CuTu5jpZ.js} +1 -1
- package/dist/client/assets/SettingsPage-BCV0w9Vi.js +17 -0
- package/dist/client/assets/{StackBoardsRoutePage-qh4CMVbO.js → StackBoardsRoutePage-7wFhv0_e.js} +1 -1
- package/dist/client/assets/{ToolCallMessage-36Dj7xkk.js → ToolCallMessage-BdnXHucS.js} +1 -1
- package/dist/client/assets/{VChartSurface-CcMrzPBy.js → VChartSurface-Cstkrqkr.js} +1 -1
- package/dist/client/assets/{WebhooksPage-5KNcw-Vz.js → WebhooksPage-vMuFDMp6.js} +1 -1
- package/dist/client/assets/{WorkflowsPage-DNYcsvtV.js → WorkflowsPage-CKSmQTVr.js} +1 -1
- package/dist/client/assets/{appSettingsStore-LgzUNvfd.js → appSettingsStore-fU_N20LE.js} +1 -1
- package/dist/client/assets/{arrow-left-BIWqzCsH.js → arrow-left-CMvFX3PN.js} +1 -1
- package/dist/client/assets/{beacon-alias-DxONetqC.js → beacon-alias-BLR2AbFH.js} +3 -3
- package/dist/client/assets/{chunk-OB3PAWPO-zund-gx-.js → chunk-6KYCQHYJ-C0N1h4Su.js} +1 -1
- package/dist/client/assets/{code-xml-BfYZcKk2.js → code-xml-Bz3Pw469.js} +1 -1
- package/dist/client/assets/{commandFeedback-yC5d0Ae6.js → commandFeedback-CJUPA0qJ.js} +1 -1
- package/dist/client/assets/{contextWindow-pvBJBrsH.js → contextWindow-DOCh4Cvd.js} +1 -1
- package/dist/client/assets/{copyFeedbackStore-BpFUDutm.js → copyFeedbackStore-CA3R4Lkw.js} +1 -1
- package/dist/client/assets/{createScopedStore-Ba9K_10X.js → createScopedStore-Bwg_GPUf.js} +1 -1
- package/dist/client/assets/{cronJobsStore-Dehc4edG.js → cronJobsStore-BLB0Vehu.js} +1 -1
- package/dist/client/assets/{file-plus-corner-DWHF_kbn.js → file-plus-corner-D_lIlmxu.js} +1 -1
- package/dist/client/assets/{github-dark-default-adAWTKmX.js → github-dark-default-CM8LCIj6.js} +1 -1
- package/dist/client/assets/highlights-BNrfEgy9.js +3 -0
- package/dist/client/assets/{inboxStore-BxT26bsM.js → inboxStore-YuvJrOoh.js} +1 -1
- package/dist/client/assets/index-DSzVkIcK.js +85 -0
- package/dist/client/assets/{index-JXlKTAWE.css → index-D_XO3fZ-.css} +1 -1
- package/dist/client/assets/{info-Ba70747-.js → info-QOQ2TnKq.js} +1 -1
- package/dist/client/assets/{input-BY7tE022.js → input-SQ_NQ4i3.js} +1 -1
- package/dist/client/assets/{loader-BxIVfMhW.js → loader-Dbltcnnq.js} +1 -1
- package/dist/client/assets/{log-DxnWb_y2.js → log-CSvFzOgk.js} +1 -1
- package/dist/client/assets/minus-4P2PfMQ9.js +1 -0
- package/dist/client/assets/{monitor-ByZxj7H9.js → monitor-Cq4Xva5_.js} +1 -1
- package/dist/client/assets/{pencil-41SXT97L.js → pencil-KyJnUAFc.js} +1 -1
- package/dist/client/assets/{pendingActionsStore-BEJnZIRD.js → pendingActionsStore-BAMMp6is.js} +1 -1
- package/dist/client/assets/{plus-CVyLwE7_.js → plus-CD0ryc0u.js} +1 -1
- package/dist/client/assets/{react-CZBv4gq-.js → react-B_ssCuNh.js} +4 -4
- package/dist/client/assets/{refresh-cw-CLCXCzaY.js → refresh-cw-BZhFl6k9.js} +1 -1
- package/dist/client/assets/runDetached-6EapWBGL.js +1 -0
- package/dist/client/assets/{search-BabRSZmb.js → search-C00xf7Dr.js} +1 -1
- package/dist/client/assets/{searchable-select-prsU5V9D.js → searchable-select-Bb-64ppm.js} +1 -1
- package/dist/client/assets/{segmented-control-BdqpOGH3.js → segmented-control-WauTv4kI.js} +1 -1
- package/dist/client/assets/{select-BuN3bPMQ.js → select-aSIMmCY4.js} +1 -1
- package/dist/client/assets/{settings-header-button-BkDztcVR.js → settings-header-button-HRGFRld7.js} +1 -1
- package/dist/client/assets/{shiki-CCur_AjT.js → shiki-Dr1ftTui.js} +1 -1
- package/dist/client/assets/{state-mark-BoV1BBc0.js → state-mark-D2ronAPV.js} +1 -1
- package/dist/client/assets/{stream-tokenizer-B5Lrlknv.js → stream-tokenizer-Dusn-8y-.js} +1 -1
- package/dist/client/assets/{terminal-uWEJ91yR.js → terminal-CE7sC7nZ.js} +1 -1
- package/dist/client/assets/{themes-B2qJmig7.js → themes-Bahc5xK2.js} +1 -1
- package/dist/client/assets/{timer.adapter-BX7ibpTi.js → timer.adapter-obf6icc9.js} +1 -1
- package/dist/client/assets/{tools-B59RcrVm.js → tools-DE7C49T-.js} +1 -1
- package/dist/client/assets/{triangle-alert-D3aY6mGU.js → triangle-alert-DgVGhRHG.js} +1 -1
- package/dist/client/assets/useAppGlobalState-DZp5teQX.js +1 -0
- package/dist/client/assets/{useProviderCatalog-BJE2nJJQ.js → useProviderCatalog-Bm7q2MH2.js} +1 -1
- package/dist/client/assets/{useTheme-CuVmsdqy.js → useTheme-BU3AlCLI.js} +1 -1
- package/dist/client/index.html +33 -33
- package/package.json +10 -10
- package/src/server/event-store-transcript-write.adapter.ts +3 -0
- package/src/server/event-store.test.ts +16 -0
- package/src/server/event-store.ts +1 -0
- 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-sources/mcp-source-client.adapter.test.ts +134 -15
- package/src/server/mcp-sources/mcp-source-client.adapter.ts +57 -11
- 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/uploads.test.ts +7 -3
- package/src/server/ws-router-abandoned-chat.test.ts +93 -0
- package/src/server/ws-router-broadcast.ts +45 -1
- package/src/server/ws-router.ts +6 -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/ChatPage-CUa9Mlv0.js +0 -35
- package/dist/client/assets/SettingsPage-BFnBY3op.js +0 -16
- package/dist/client/assets/highlights-CFT8RIMY.js +0 -3
- package/dist/client/assets/index-CRk0GD4y.js +0 -93
- package/dist/client/assets/minus-DpkN1lgU.js +0 -1
- package/dist/client/assets/runDetached-K6ggut3D.js +0 -1
- package/dist/client/assets/useAppGlobalState-vHoqoq7W.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-BNjeGZYW.js","assets/rolldown-runtime-BCiCTKAo.js","assets/react-BWPDF9mI.js","assets/jsx-runtime-BB9-612F.js","assets/pendingActionsStore-BAMMp6is.js","assets/log-CSvFzOgk.js","assets/code-xml-Bz3Pw469.js","assets/select-aSIMmCY4.js","assets/react-dom-2r3XOwTS.js","assets/copyFeedbackStore-CA3R4Lkw.js","assets/timer.adapter-obf6icc9.js","assets/focusOverlay-BNpERJzs.js","assets/dist-DQaZwNEz.js","assets/segmented-control-WauTv4kI.js","assets/index-DSzVkIcK.js","assets/chunk-6KYCQHYJ-C0N1h4Su.js","assets/useAppGlobalState-DZp5teQX.js","assets/contextWindow-DOCh4Cvd.js","assets/useProviderCatalog-Bm7q2MH2.js","assets/input-SQ_NQ4i3.js","assets/core-types-Ds7PFmZN.js","assets/appSettingsStore-fU_N20LE.js","assets/tool-call-types-CtytAxam.js","assets/createScopedStore-Bwg_GPUf.js","assets/useTheme-BU3AlCLI.js","assets/dom.adapter-C26vNdMA.js","assets/pathUtils-DTWwEzHK.js","assets/runDetached-6EapWBGL.js","assets/commandFeedback-CJUPA0qJ.js","assets/storage.adapter-DafyA8In.js","assets/inboxStore-YuvJrOoh.js","assets/state-mark-D2ronAPV.js","assets/cronJobsStore-BLB0Vehu.js","assets/ToolCallMessage-BdnXHucS.js","assets/FilePreviewSheet-CfrHVm3Z.js","assets/minus-4P2PfMQ9.js","assets/plus-CD0ryc0u.js","assets/refresh-cw-BZhFl6k9.js","assets/triangle-alert-DgVGhRHG.js","assets/preload-helper-BLdHbfdN.js","assets/file-plus-corner-D_lIlmxu.js","assets/pencil-KyJnUAFc.js","assets/search-C00xf7Dr.js","assets/terminal-CE7sC7nZ.js","assets/formatDuration-BbWTR_M_.js","assets/tools-DE7C49T-.js","assets/index-D_XO3fZ-.css","assets/info-QOQ2TnKq.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-BAMMp6is.js";import{a as s,o as c,r as l}from"./copyFeedbackStore-CA3R4Lkw.js";import{t as u}from"./log-CSvFzOgk.js";import{n as d,t as f}from"./createScopedStore-Bwg_GPUf.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-BU3AlCLI.js";import{t as b}from"./runDetached-6EapWBGL.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-BNjeGZYW.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,3 +1,3 @@
|
|
|
1
1
|
import{o as e}from"./rolldown-runtime-BCiCTKAo.js";import{t}from"./react-BWPDF9mI.js";var n=e(t(),1),r=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,i=/^[\\/]{2}/;function a(e,t){return t+e.replace(/\\/g,`/`)}var o=`popstate`;function s(e){return typeof e==`object`&&!!e&&`pathname`in e&&`search`in e&&`hash`in e&&`state`in e&&`key`in e}function c(e={}){function t(e,t){let n=t.state?.masked,{pathname:r,search:i,hash:a}=n||e.location;return p(``,{pathname:r,search:i,hash:a},t.state&&t.state.usr||null,t.state&&t.state.key||`default`,n?{pathname:e.location.pathname,search:e.location.search,hash:e.location.hash}:void 0)}function n(e,t){return typeof t==`string`?t:m(t)}return g(t,n,null,e)}function l(e,t){if(e===!1||e==null)throw Error(t)}function u(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function d(){return Math.random().toString(36).substring(2,10)}function f(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function p(e,t,n=null,r,i){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?h(t):t,state:n,key:t&&t.key||r||d(),mask:i}}function m({pathname:e=`/`,search:t=``,hash:n=``}){return t&&t!==`?`&&(e+=t.charAt(0)===`?`?t:`?`+t),n&&n!==`#`&&(e+=n.charAt(0)===`#`?n:`#`+n),e}function h(e){let t={};if(e){let n=e.indexOf(`#`);n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf(`?`);r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function g(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:a=!1}=r,c=i.history,l=`POP`,u=null,d=m();d??(d=0,c.replaceState({...c.state,idx:d},``));function m(){return(c.state||{idx:null}).idx}function h(){l=`POP`;let e=m(),t=e==null?null:e-d;d=e,u&&u({action:l,location:b.location,delta:t})}function g(e,t){l=`PUSH`;let r=s(e)?e:p(b.location,e,t);n&&n(r,e),d=m()+1;let o=f(r,d),h=b.createHref(r.mask||r);try{c.pushState(o,``,h)}catch(e){if(e instanceof DOMException&&e.name===`DataCloneError`)throw e;i.location.assign(h)}a&&u&&u({action:l,location:b.location,delta:1})}function v(e,t){l=`REPLACE`;let r=s(e)?e:p(b.location,e,t);n&&n(r,e),d=m();let i=f(r,d),o=b.createHref(r.mask||r);c.replaceState(i,``,o),a&&u&&u({action:l,location:b.location,delta:0})}function y(e){return _(i,e)}let b={get action(){return l},get location(){return e(i,c)},listen(e){if(u)throw Error(`A history only accepts one active listener`);return i.addEventListener(o,h),u=e,()=>{i.removeEventListener(o,h),u=null}},createHref(e){return t(i,e)},createURL:y,encodeLocation(e){let t=y(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:g,replace:v,go(e){return c.go(e)}};return b}function _(e,t,n=!1){let r=`http://localhost`;e&&(r=e.location.origin===`null`?e.location.href:e.location.origin),l(r,`No window.location.(origin|href) available to create URL`);let a=typeof t==`string`?t:m(t);return a=a.replace(/ $/,`%20`),!n&&i.test(a)&&(a=r+a),new URL(a,r)}function v(e,t,n=`/`){return y(e,t,n,!1)}function y(e,t,n,r,i){let a=A((typeof t==`string`?h(t):t).pathname||`/`,n);if(a==null)return null;let o=i??b(e),s=null,c=se(a);for(let e=0;s==null&&e<o.length;++e)s=ie(o[e],c,r);return s}function b(e){let t=x(e);return C(t),t}function x(e,t=[],n=[],r=``,i=!1){let a=(e,a,o=i,s)=>{let c={relativePath:s===void 0?e.path||``:s,caseSensitive:e.caseSensitive===!0,childrenIndex:a,route:e};if(c.relativePath.startsWith(`/`)){if(!c.relativePath.startsWith(r)&&o)return;l(c.relativePath.startsWith(r),`Absolute route path "${c.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),c.relativePath=c.relativePath.slice(r.length)}let u=P([r,c.relativePath]),d=n.concat(c);e.children&&e.children.length>0&&(l(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${u}".`),x(e.children,t,d,u,o)),(e.path!=null||e.index)&&t.push({path:u,score:O(u,e.index),routesMeta:d.map((e,t)=>{let[n,r]=oe(e.relativePath,e.caseSensitive,t===d.length-1);return{...e,matcher:n,compiledParams:r}})})};return e.forEach((e,t)=>{if(e.path===``||!e.path?.includes(`?`))a(e,t);else for(let n of S(e.path))a(e,t,!0,n)}),t}function S(e){let t=e.split(`/`);if(t.length===0)return[];let[n,...r]=t,i=n.endsWith(`?`),a=n.replace(/\?$/,``);if(r.length===0)return i?[a,``]:[a];let o=S(r.join(`/`)),s=[];return s.push(...o.map(e=>e===``?a:[a,e].join(`/`))),i&&s.push(...o),s.map(t=>e.startsWith(`/`)&&t===``?`/`:t)}function C(e){e.sort((e,t)=>e.score===t.score?re(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var w=/^:[\w-]+$/,T=3,E=2,ee=1,te=10,ne=-2,D=e=>e===`*`;function O(e,t){let n=e.split(`/`),r=n.length;return n.some(D)&&(r+=ne),t&&(r+=E),n.filter(e=>!D(e)).reduce((e,t)=>e+(w.test(t)?T:t===``?ee:te),r)}function re(e,t){return e.length===t.length&&e.slice(0,-1).every((e,n)=>e===t[n])?e[e.length-1]-t[t.length-1]:0}function ie(e,t,n=!1){let{routesMeta:r}=e,i={},a=`/`,o=[];for(let e=0;e<r.length;++e){let s=r[e],c=e===r.length-1,l=a===`/`?t:t.slice(a.length)||`/`,u={path:s.relativePath,caseSensitive:s.caseSensitive,end:c},d=s.matcher&&s.compiledParams?ae(u,l,s.matcher,s.compiledParams):k(u,l),f=s.route;if(!d&&c&&n&&!r[r.length-1].route.index&&(d=k({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!d)return null;Object.assign(i,d.params),o.push({params:i,pathname:P([a,d.pathname]),pathnameBase:fe(P([a,d.pathnameBase])),route:f}),d.pathnameBase!==`/`&&(a=P([a,d.pathnameBase]))}return o}function k(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=oe(e.path,e.caseSensitive,e.end);return ae(e,t,n,r)}function ae(e,t,n,r){let i=t.match(n);if(!i)return null;let a=i[0],o=F(a,1),s=i.slice(1);return{params:r.reduce((e,{paramName:t,isOptional:n},r)=>{if(t===`*`){let e=s[r]||``;o=F(a.slice(0,a.length-e.length),1)}let i=s[r];return e[t]=n&&!i?void 0:(i||``).replace(/%2F/g,`/`),e},{}),pathname:a,pathnameBase:o,pattern:e}}function oe(e,t=!1,n=!0){u(e===`*`||!e.endsWith(`*`)||e.endsWith(`/*`),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,`/*`)}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,`/*`)}".`);let r=[],i=`^`+e.replace(/\/*\*?$/,``).replace(/^\/*/,`/`).replace(/[\\.*+^${}|()[\]]/g,`\\$&`).replace(/\/:([\w-]+)(\?)?/g,(e,t,n,i,a)=>{if(r.push({paramName:t,isOptional:n!=null}),n){let t=a.charAt(i+e.length);return t&&t!==`/`?`/([^\\/]*)`:`(?:/([^\\/]*))?`}return`/([^\\/]+)`}).replace(/\/([\w-]+)\?(\/|$)/g,`(/$1)?$2`);return e.endsWith(`*`)?(r.push({paramName:`*`}),i+=e===`*`||e===`/*`?`(.*)$`:`(?:\\/(.+)|\\/*)$`):n?i+=`\\/*$`:e!==``&&e!==`/`&&(i+=`(?:(?=\\/|$))`),[new RegExp(i,t?void 0:`i`),r]}function se(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return u(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function A(e,t){if(t===`/`)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith(`/`)?t.length-1:t.length,r=e.charAt(n);return r&&r!==`/`?null:e.slice(n)||`/`}function ce(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?h(e):e,a;return n?(n=de(n),a=n.startsWith(`/`)||n.startsWith(`\\`)?le(n.substring(1),`/`):le(n,t)):a=t,{pathname:a,search:pe(r),hash:me(i)}}function le(e,t){let n=F(t).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function j(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function ue(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function M(e){let t=ue(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function N(e,t,n,r=!1){let i;typeof e==`string`?i=h(e):(i={...e},l(!i.pathname||!i.pathname.includes(`?`),j(`?`,`pathname`,`search`,i)),l(!i.pathname||!i.pathname.includes(`#`),j(`#`,`pathname`,`hash`,i)),l(!i.search||!i.search.includes(`#`),j(`#`,`search`,`hash`,i)));let a=e===``||i.pathname===``,o=a?`/`:i.pathname,s;if(o==null)s=n;else{let e=t.length-1;if(!r&&o.startsWith(`..`)){let t=o.split(`/`);for(;t[0]===`..`;)t.shift(),--e;i.pathname=t.join(`/`)}s=e>=0?t[e]:`/`}let c=ce(i,s),u=o&&o!==`/`&&o.endsWith(`/`),d=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(u||d)&&(c.pathname+=`/`),c}var de=e=>e.replace(/[\\/]{2,}/g,`/`),P=e=>de(e.join(`/`));function F(e,t=0){let n=e.length;for(;n>t&&e.charCodeAt(n-1)===47;)n--;return n===e.length?e:e.slice(0,n)}var fe=e=>F(e).replace(/^\/*/,`/`),pe=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,me=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,he=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||``,this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function ge(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function _e(e){return P(e.map(e=>e.route.path).filter(Boolean))||`/`}var ve=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function ye(e,t){let n=e;if(typeof n!=`string`||!r.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let o=n,s=!1;if(ve)try{let e=new URL(window.location.href),r=i.test(n)?new URL(a(n,e.protocol)):new URL(n),o=A(r.pathname,t);r.origin===e.origin&&o!=null?n=o+r.search+r.hash:s=!0}catch{u(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:o,isExternal:s,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);var be=new URL(`http://localhost`);function I(e){if(e.createURL)return e.createURL(`/`);try{return new URL(e.createHref(`/`),be)}catch{return be}}function xe(e,t){return e.origin===t.origin&&(e.origin!==`null`||e.protocol===t.protocol&&e.host===t.host)}function Se(e,t){if(e.startsWith(`//`))return!0;let n=t.protocol.toLowerCase();return e.toLowerCase().startsWith(n)?t.host===``||e.slice(n.length).startsWith(`//`):!1}function L(e,t,n,r){let i=null;try{i=e==null?null:new URL(e,n)}catch{}let a=new URL(t,n),o=i!=null&&!xe(i,n),s=!xe(a,n);if(r===`reject`){if(o||s)throw Error(`External navigation is not allowed`)}else if(s&&(i==null||!Se(e,i)||!xe(i,a)))throw Error(`External navigation is not allowed`)}var Ce=[`POST`,`PUT`,`PATCH`,`DELETE`];new Set(Ce);var we=[`GET`,...Ce];new Set(we);var Te=[`about:`,`blob:`,`chrome:`,`chrome-untrusted:`,`content:`,`data:`,`devtools:`,`file:`,`filesystem:`,`javascript:`];function Ee(e){try{return Te.includes(new URL(e).protocol)}catch{return!1}}var R=n.createContext(null);R.displayName=`DataRouter`;var z=n.createContext(null);z.displayName=`DataRouterState`;var De=n.createContext(!1);function Oe(){return n.useContext(De)}var ke=n.createContext({isTransitioning:!1});ke.displayName=`ViewTransition`;var Ae=n.createContext(new Map);Ae.displayName=`Fetchers`;var je=n.createContext(null);je.displayName=`Await`;var B=n.createContext(null);B.displayName=`Navigation`;var V=n.createContext(null);V.displayName=`Location`;var H=n.createContext({outlet:null,matches:[],isDataRoute:!1});H.displayName=`Route`;var U=n.createContext(null);U.displayName=`RouteError`;var Me=`REACT_ROUTER_ERROR`,Ne=`REDIRECT`,Pe=`ROUTE_ERROR_RESPONSE`;function Fe(e){if(e.startsWith(`${Me}:${Ne}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`&&typeof t.location==`string`&&typeof t.reloadDocument==`boolean`&&typeof t.replace==`boolean`)return t}catch{}}function Ie(e){if(e.startsWith(`${Me}:${Pe}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new he(t.status,t.statusText,t.data)}catch{}}function Le(e,{relative:t}={}){l(W(),`useHref() may be used only in the context of a <Router> component.`);let{basename:r,navigator:i}=n.useContext(B),{hash:a,pathname:o,search:s}=q(e,{relative:t}),c=o;return r!==`/`&&(c=o===`/`?r:P([r,o])),i.createHref({pathname:c,search:s,hash:a})}function W(){return n.useContext(V)!=null}function G(){return l(W(),`useLocation() may be used only in the context of a <Router> component.`),n.useContext(V).location}var Re=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function ze(e){n.useContext(B).static||n.useLayoutEffect(e)}function K(){let{isDataRoute:e}=n.useContext(H);return e?st():Be()}function Be(){l(W(),`useNavigate() may be used only in the context of a <Router> component.`);let e=n.useContext(R),{basename:t,navigator:r}=n.useContext(B),{matches:i}=n.useContext(H),{pathname:a}=G(),o=JSON.stringify(M(i)),s=n.useRef(!1);return ze(()=>{s.current=!0}),n.useCallback((n,i={})=>{if(u(s.current,Re),!s.current)return;if(typeof n==`number`){r.go(n);return}let c=N(n,JSON.parse(o),a,i.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:P([t,c.pathname])),L(typeof n==`string`?n:m(n),r.createHref(c),I(r),`reject`),(i.replace?r.replace:r.push)(c,i.state,i)},[t,r,o,a,e])}var Ve=n.createContext(null);function He(){return n.useContext(Ve)}function Ue(e){let t=n.useContext(H).outlet;return n.useMemo(()=>t&&n.createElement(Ve.Provider,{value:e},t),[t,e])}function We(){let{matches:e}=n.useContext(H);return e[e.length-1]?.params??{}}function q(e,{relative:t}={}){let{matches:r}=n.useContext(H),{pathname:i}=G(),a=JSON.stringify(M(r));return n.useMemo(()=>N(e,JSON.parse(a),i,t===`path`),[e,a,i,t])}function Ge(e,t){return Ke(e,t)}function Ke(e,t,r){l(W(),`useRoutes() may be used only in the context of a <Router> component.`);let{navigator:i}=n.useContext(B),{matches:a}=n.useContext(H),o=a[a.length-1],s=o?o.params:{},c=o?o.pathname:`/`,d=o?o.pathnameBase:`/`,f=o&&o.route;{let e=f&&f.path||``;lt(c,!f||e.endsWith(`*`)||e.endsWith(`*?`),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${c}" (under <Route path="${e}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
2
2
|
|
|
3
|
-
Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}/*`}">.`)}let p=G(),m;if(t){let e=typeof t==`string`?h(t):t;l(d===`/`||e.pathname?.startsWith(d),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${d}" but pathname "${e.pathname}" was given in the \`location\` prop.`),m=e}else m=p;let g=m.pathname||`/`,_=g;if(d!==`/`){let e=d.replace(/^\//,``).split(`/`);_=`/`+g.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let y=r&&r.state.matches.length?r.state.matches.map(e=>Object.assign(e,{route:r.manifest[e.route.id]||e.route})):v(e,{pathname:_});u(f||y!=null,`No routes matched location "${m.pathname}${m.search}${m.hash}" `),u(y==null||y[y.length-1].route.element!==void 0||y[y.length-1].route.Component!==void 0||y[y.length-1].route.lazy!==void 0,`Matched leaf route at location "${m.pathname}${m.search}${m.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let b=$e(y&&y.map(e=>Object.assign({},e,{params:Object.assign({},s,e.params),pathname:P([d,i.encodeLocation?i.encodeLocation(e.pathname.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?d:P([d,i.encodeLocation?i.encodeLocation(e.pathnameBase.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),a,r);return t&&b?n.createElement(V.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,mask:void 0,...m},navigationType:`POP`}},b):b}function qe(){let e=ot(),t=ge(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,i=`rgba(200,200,200, 0.5)`,a={padding:`0.5rem`,backgroundColor:i},o={padding:`2px 4px`,backgroundColor:i},s=null;return console.error(`Error handled by React Router default ErrorBoundary:`,e),s=n.createElement(n.Fragment,null,n.createElement(`p`,null,`💿 Hey developer 👋`),n.createElement(`p`,null,`You can provide a way better UX than this when your app throws errors by providing your own `,n.createElement(`code`,{style:o},`ErrorBoundary`),` or`,` `,n.createElement(`code`,{style:o},`errorElement`),` prop on your route.`)),n.createElement(n.Fragment,null,n.createElement(`h2`,null,`Unexpected Application Error!`),n.createElement(`h3`,{style:{fontStyle:`italic`}},t),r?n.createElement(`pre`,{style:a},r):null,s)}var Je=n.createElement(qe,null),Ye=class extends n.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!==`idle`&&e.revalidation===`idle`?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error===void 0?t.error:e.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error(`React Router caught the following error during render`,e)}render(){let e=this.state.error;if(this.context&&typeof e==`object`&&e&&`digest`in e&&typeof e.digest==`string`){let t=Ie(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:n.createElement(H.Provider,{value:this.props.routeContext},n.createElement(U.Provider,{value:e,children:this.props.component}));return this.context?n.createElement(Ze,{error:e},t):t}};Ye.contextType=De;var Xe=new WeakMap;function Ze({children:e,error:t}){let{basename:r,navigator:i}=n.useContext(B);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=Fe(t.digest);if(e){let a=Xe.get(t);if(a)throw a;let o=ye(e.location,r),s=o.absoluteURL||o.to;if(L(e.location,s,I(i),`allow-explicit`),Ee(s))throw Error(`Invalid redirect location`);if(ve&&!Xe.get(t)){if(o.isExternal||e.reloadDocument)window.location.href=s;else{let n=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(o.to,{replace:e.replace}));throw Xe.set(t,n),n}}return n.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${s}`})}}return e}function Qe({routeContext:e,match:t,children:r}){let i=n.useContext(R);return i&&i.static&&i.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=t.route.id),n.createElement(H.Provider,{value:e},r)}function $e(e,t=[],r){let i=r?.state;if(e==null){if(!i)return null;if(i.errors)e=i.matches;else if(t.length===0&&!i.initialized&&i.matches.length>0)e=i.matches;else return null}let a=e,o=i?.errors;if(o!=null){let e=a.findIndex(e=>e.route.id&&o?.[e.route.id]!==void 0);l(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(`,`)}`),a=a.slice(0,Math.min(a.length,e+1))}let s=!1,c=-1;if(r&&i){s=i.renderFallback;for(let e=0;e<a.length;e++){let t=a[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(c=e),t.route.id){let{loaderData:e,errors:n}=i,o=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!n||n[t.route.id]===void 0);if(t.route.lazy||o){r.isStatic&&(s=!0),a=c>=0?a.slice(0,c+1):[a[0]];break}}}}let u=r?.onError,d=i&&u?(e,t)=>{u(e,{location:i.location,params:i.matches?.[0]?.params??{},pattern:_e(i.matches),errorInfo:t})}:void 0;return a.reduceRight((e,r,l)=>{let u,f=!1,p=null,m=null;i&&(u=o&&r.route.id?o[r.route.id]:void 0,p=r.route.errorElement||Je,s&&(c<0&&l===0?(lt(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),f=!0,m=null):c===l&&(f=!0,m=r.route.hydrateFallbackElement||null)));let h=t.concat(a.slice(0,l+1)),g=()=>{let t;return t=u?p:f?m:r.route.Component?n.createElement(r.route.Component,null):r.route.element?r.route.element:e,n.createElement(Qe,{match:r,routeContext:{outlet:e,matches:h,isDataRoute:i!=null},children:t})};return i&&(r.route.ErrorBoundary||r.route.errorElement||l===0)?n.createElement(Ye,{location:i.location,revalidation:i.revalidation,component:p,error:u,children:g(),routeContext:{outlet:null,matches:h,isDataRoute:!0},onError:d}):g()},null)}function et(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function tt(e){let t=n.useContext(R);return l(t,et(e)),t}function nt(e){let t=n.useContext(z);return l(t,et(e)),t}function rt(e){let t=n.useContext(H);return l(t,et(e)),t}function it(e){let t=rt(e),n=t.matches[t.matches.length-1];return l(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function at(){return it(`useRouteId`)}function ot(){let e=n.useContext(U),t=nt(`useRouteError`),r=it(`useRouteError`);return e===void 0?t.errors?.[r]:e}function st(){let{router:e}=tt(`useNavigate`),t=it(`useNavigate`),r=n.useRef(!1);return ze(()=>{r.current=!0}),n.useCallback(async(n,i={})=>{u(r.current,Re),r.current&&(typeof n==`number`?await e.navigate(n):await e.navigate(n,{fromRouteId:t,...i}))},[e,t])}var ct={};function lt(e,t,n){!t&&!ct[e]&&(ct[e]=!0,u(!1,n))}n.memo(ut);function ut({routes:e,manifest:t,future:n,state:r,isStatic:i,onError:a}){return Ke(e,void 0,{manifest:t,state:r,isStatic:i,onError:a,future:n})}function dt({to:e,replace:t,state:r,relative:i}){l(W(),`<Navigate> may be used only in the context of a <Router> component.`);let{static:a,navigator:o}=n.useContext(B);u(!a,`<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.`);let{matches:s}=n.useContext(H),{pathname:c}=G(),d=K(),f=N(e,M(s),c,i===`path`);L(typeof e==`string`?e:m(e),o.createHref(f),I(o),`reject`);let p=JSON.stringify(f);return n.useEffect(()=>{d(JSON.parse(p),{replace:t,state:r,relative:i})},[d,p,i,t,r]),null}function ft(e){return Ue(e.context)}function pt(e){l(!1,`A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.`)}function mt({basename:e=`/`,children:t=null,location:r,navigationType:i=`POP`,navigator:a,static:o=!1,useTransitions:s}){l(!W(),`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`);let c=e.replace(/^\/*/,`/`),d=n.useMemo(()=>({basename:c,navigator:a,static:o,useTransitions:s,future:{}}),[c,a,o,s]);typeof r==`string`&&(r=h(r));let{pathname:f=`/`,search:p=``,hash:m=``,state:g=null,key:_=`default`,mask:v}=r,y=n.useMemo(()=>{let e=A(f,c);return e==null?null:{location:{pathname:e,search:p,hash:m,state:g,key:_,mask:v},navigationType:i}},[c,f,p,m,g,_,i,v]);return u(y!=null,`<Router basename="${c}"> is not able to match the URL "${f}${p}${m}" because it does not start with the basename, so the <Router> won't render anything.`),y==null?null:n.createElement(B.Provider,{value:d},n.createElement(V.Provider,{children:t,value:y}))}function ht({children:e,location:t}){return Ge(gt(e),t)}n.Component;function gt(e,t=[]){let r=[];return n.Children.forEach(e,(e,i)=>{if(!n.isValidElement(e))return;let a=[...t,i];if(e.type===n.Fragment){r.push.apply(r,gt(e.props.children,a));return}l(e.type===pt,`[${typeof e.type==`string`?e.type:e.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),l(!e.props.index||!e.props.children,`An index route cannot have child routes.`);let o={id:e.props.id||a.join(`-`),caseSensitive:e.props.caseSensitive,element:e.props.element,Component:e.props.Component,index:e.props.index,path:e.props.path,middleware:e.props.middleware,loader:e.props.loader,action:e.props.action,hydrateFallbackElement:e.props.hydrateFallbackElement,HydrateFallback:e.props.HydrateFallback,errorElement:e.props.errorElement,ErrorBoundary:e.props.ErrorBoundary,hasErrorBoundary:e.props.hasErrorBoundary===!0||e.props.ErrorBoundary!=null||e.props.errorElement!=null,shouldRevalidate:e.props.shouldRevalidate,handle:e.props.handle,lazy:e.props.lazy};e.props.children&&(o.children=gt(e.props.children,a)),r.push(o)}),r}var J=`get`,Y=`application/x-www-form-urlencoded`;function X(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function _t(e){return X(e)&&e.tagName.toLowerCase()===`button`}function vt(e){return X(e)&&e.tagName.toLowerCase()===`form`}function yt(e){return X(e)&&e.tagName.toLowerCase()===`input`}function bt(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function xt(e,t){return e.button===0&&(!t||t===`_self`)&&!bt(e)}var Z=null;function St(){if(Z===null)try{new FormData(document.createElement(`form`),0),Z=!1}catch{Z=!0}return Z}var Ct=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function wt(e){return e!=null&&!Ct.has(e)?(u(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Y}"`),null):e}function Tt(e,t){let n,r,i,a,o;if(vt(e)){let o=e.getAttribute(`action`);r=o?A(o,t):null,n=e.getAttribute(`method`)||J,i=wt(e.getAttribute(`enctype`))||Y,a=new FormData(e)}else if(_t(e)||yt(e)&&(e.type===`submit`||e.type===`image`)){let o=e.form;if(o==null)throw Error(`Cannot submit a <button> or <input type="submit"> without a <form>`);let s=e.getAttribute(`formaction`)||o.getAttribute(`action`);if(r=s?A(s,t):null,n=e.getAttribute(`formmethod`)||o.getAttribute(`method`)||J,i=wt(e.getAttribute(`formenctype`))||wt(o.getAttribute(`enctype`))||Y,a=new FormData(o,e),!St()){let{name:t,type:n,value:r}=e;if(n===`image`){let e=t?`${t}.`:``;a.append(`${e}x`,`0`),a.append(`${e}y`,`0`)}else t&&a.append(t,r)}}else if(X(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=J,r=null,i=Y,o=e;return a&&i===`text/plain`&&(o=a,a=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:a,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);function Et(e,t){if(e===!1||e==null)throw Error(t)}function Dt(e,t,n,r){let i=typeof e==`string`?new URL(e,typeof window>`u`?`server://singlefetch/`:window.location.origin):e;return i.pathname=n?i.pathname.endsWith(`/`)?`${i.pathname}_.${r}`:`${i.pathname}.${r}`:i.pathname===`/`?`_root.${r}`:t&&A(i.pathname,t)===`/`?`${F(t)}/_root.${r}`:`${F(i.pathname)}.${r}`,i}async function Ot(e,t){if(e.id in t)return t[e.id];try{let n=await import(e.module);return t[e.id]=n,n}catch(t){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function kt(e){return e!=null&&typeof e.page==`string`}function At(e){return e==null?!1:e.href==null?e.rel===`preload`&&typeof e.imageSrcSet==`string`&&typeof e.imageSizes==`string`:typeof e.rel==`string`&&typeof e.href==`string`}async function jt(e,t,n){return It((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await Ot(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(At).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function Mt(e,t,n,r,i,a){let o=(e,t)=>!n[t]||e.route.id!==n[t].route.id,s=(e,t)=>n[t].pathname!==e.pathname||n[t].route.path?.endsWith(`*`)&&n[t].params[`*`]!==e.params[`*`];return a===`assets`?t.filter((e,t)=>o(e,t)||s(e,t)):a===`data`?t.filter((t,a)=>{let c=r.routes[t.route.id];if(!c||!c.hasLoader)return!1;if(o(t,a)||s(t,a))return!0;if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:t.params,defaultShouldRevalidate:!0});if(typeof r==`boolean`)return r}return!0}):[]}function Nt(e,t,{includeHydrateFallback:n}={}){return Pt(e.map(e=>{let r=t.routes[e.route.id];if(!r)return[];let i=[r.module];return r.clientActionModule&&(i=i.concat(r.clientActionModule)),r.clientLoaderModule&&(i=i.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(i=i.concat(r.hydrateFallbackModule)),r.imports&&(i=i.concat(r.imports)),i}).flat(1))}function Pt(e){return[...new Set(e)]}function Ft(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function It(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!kt(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(Ft(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}function Lt(){let e=n.useContext(R);return Et(e,`You must render this element inside a <DataRouterContext.Provider> element`),e}function Rt(){let e=n.useContext(z);return Et(e,`You must render this element inside a <DataRouterStateContext.Provider> element`),e}var zt=n.createContext(void 0);zt.displayName=`FrameworkContext`;function Q(){let e=n.useContext(zt);return Et(e,`You must render this element inside a <HydratedRouter> element`),e}function Bt(e,t){let r=n.useContext(zt),[i,a]=n.useState(!1),[o,s]=n.useState(!1),{onFocus:c,onBlur:l,onMouseEnter:u,onMouseLeave:d,onTouchStart:f}=t,p=n.useRef(null);n.useEffect(()=>{if(e===`render`&&s(!0),e===`viewport`){let e=new IntersectionObserver(e=>{e.forEach(e=>{s(e.isIntersecting)})},{threshold:.5});return p.current&&e.observe(p.current),()=>{e.disconnect()}}},[e]),n.useEffect(()=>{if(i){let e=setTimeout(()=>{s(!0)},100);return()=>{clearTimeout(e)}}},[i]);let m=()=>{a(!0)},h=()=>{a(!1),s(!1)};return r?e===`intent`?[o,p,{onFocus:$(c,m),onBlur:$(l,h),onMouseEnter:$(u,m),onMouseLeave:$(d,h),onTouchStart:$(f,m)}]:[o,p,{}]:[!1,p,{}]}function $(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function Vt({page:e,...t}){let r=Oe(),{nonce:i}=Q(),{router:a}=Lt(),o=n.useMemo(()=>v(a.routes,e,a.basename),[a.routes,e,a.basename]);return o?(t.nonce==null&&i&&(t={...t,nonce:i}),r?n.createElement(Ut,{page:e,matches:o,...t}):n.createElement(Wt,{page:e,matches:o,...t})):null}function Ht(e){let{manifest:t,routeModules:r}=Q(),[i,a]=n.useState([]);return n.useEffect(()=>{let n=!1;return jt(e,t,r).then(e=>{n||a(e)}),()=>{n=!0}},[e,t,r]),i}function Ut({page:e,matches:t,...r}){let i=G(),{future:a}=Q(),{basename:o}=Lt(),s=n.useMemo(()=>{if(e===i.pathname+i.search+i.hash)return[];let n=Dt(e,o,a.v8_trailingSlashAwareDataRequests,`rsc`),r=!1,s=[];for(let e of t)typeof e.route.shouldRevalidate==`function`?r=!0:s.push(e.route.id);return r&&s.length>0&&n.searchParams.set(`_routes`,s.join(`,`)),[n.pathname+n.search]},[o,a.v8_trailingSlashAwareDataRequests,e,i,t]);return n.createElement(n.Fragment,null,s.map(e=>n.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...r})))}function Wt({page:e,matches:t,...r}){let i=G(),{future:a,manifest:o,routeModules:s}=Q(),{basename:c}=Lt(),{loaderData:l,matches:u}=Rt(),d=n.useMemo(()=>Mt(e,t,u,o,i,`data`),[e,t,u,o,i]),f=n.useMemo(()=>Mt(e,t,u,o,i,`assets`),[e,t,u,o,i]),p=n.useMemo(()=>{if(e===i.pathname+i.search+i.hash)return[];let n=new Set,r=!1;if(t.forEach(e=>{let t=o.routes[e.route.id];t&&t.hasLoader&&(!d.some(t=>t.route.id===e.route.id)&&e.route.id in l&&s[e.route.id]?.shouldRevalidate||t.hasClientLoader?r=!0:n.add(e.route.id))}),n.size===0)return[];let u=Dt(e,c,a.v8_trailingSlashAwareDataRequests,`data`);return r&&n.size>0&&u.searchParams.set(`_routes`,t.filter(e=>n.has(e.route.id)).map(e=>e.route.id).join(`,`)),[u.pathname+u.search]},[c,a.v8_trailingSlashAwareDataRequests,l,i,o,d,t,e,s]),m=n.useMemo(()=>Nt(f,o),[f,o]),h=Ht(f);return n.createElement(n.Fragment,null,p.map(e=>n.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...r})),m.map(e=>n.createElement(`link`,{key:e,rel:`modulepreload`,href:e,...r})),h.map(({key:e,link:t})=>n.createElement(`link`,{key:e,nonce:r.nonce,...t,crossOrigin:t.crossOrigin??r.crossOrigin})))}function Gt(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}n.Component;var Kt=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{Kt&&(window.__reactRouterVersion=`7.18.4`)}catch{}function qt({basename:e,children:t,useTransitions:r,window:i}){let a=n.useRef();a.current??=c({window:i,v5Compat:!0});let o=a.current,[s,l]=n.useState({action:o.action,location:o.location}),u=n.useCallback(e=>{r===!1?l(e):n.startTransition(()=>l(e))},[r]);return n.useLayoutEffect(()=>o.listen(u),[o,u]),n.createElement(mt,{basename:e,children:t,location:s.location,navigationType:s.action,navigator:o,useTransitions:r})}var Jt=n.forwardRef(function({onClick:e,discover:t=`render`,prefetch:i=`none`,relative:a,reloadDocument:o,replace:s,mask:c,state:l,target:u,to:d,preventScrollReset:f,viewTransition:p,defaultShouldRevalidate:m,...h},g){let{basename:_,navigator:v,useTransitions:y}=n.useContext(B),b=typeof d==`string`&&r.test(d),x=ye(d,_);d=x.to;let S=Le(d,{relative:a}),C=G(),w=null;if(c){let e=N(c,[],C.mask?C.mask.pathname:`/`,!0);_!==`/`&&(e.pathname=e.pathname===`/`?_:P([_,e.pathname])),w=v.createHref(e)}let[T,E,ee]=Bt(i,h),te=$t(d,{replace:s,mask:c,state:l,target:u,preventScrollReset:f,relative:a,viewTransition:p,defaultShouldRevalidate:m,useTransitions:y});function ne(t){e&&e(t),t.defaultPrevented||te(t)}let D=!(x.isExternal||o),O=n.createElement(`a`,{...h,...ee,href:(D?w:void 0)||x.absoluteURL||S,onClick:D?ne:e,ref:Gt(g,E),target:u,"data-discover":!b&&t===`render`?`true`:void 0});return T&&!b?n.createElement(n.Fragment,null,O,n.createElement(Vt,{page:S})):O});Jt.displayName=`Link`;var Yt=n.forwardRef(function({"aria-current":e=`page`,caseSensitive:t=!1,className:r=``,end:i=!1,style:a,to:o,viewTransition:s,children:c,...l},u){let d=q(o,{relative:l.relative}),f=G(),p=n.useContext(z),{navigator:m,basename:h}=n.useContext(B),g=p!=null&&an(d)&&s===!0,_=m.encodeLocation?m.encodeLocation(d).pathname:d.pathname,v=f.pathname,y=p&&p.navigation&&p.navigation.location?p.navigation.location.pathname:null;t||(v=v.toLowerCase(),y=y?y.toLowerCase():null,_=_.toLowerCase()),y&&h&&(y=A(y,h)||y);let b=_!==`/`&&_.endsWith(`/`)?_.length-1:_.length,x=v===_||!i&&v.startsWith(_)&&v.charAt(b)===`/`,S=y!=null&&(y===_||!i&&y.startsWith(_)&&y.charAt(_.length)===`/`),C={isActive:x,isPending:S,isTransitioning:g},w=x?e:void 0,T;T=typeof r==`function`?r(C):[r,x?`active`:null,S?`pending`:null,g?`transitioning`:null].filter(Boolean).join(` `);let E=typeof a==`function`?a(C):a;return n.createElement(Jt,{...l,"aria-current":w,className:T,ref:u,style:E,to:o,viewTransition:s},typeof c==`function`?c(C):c)});Yt.displayName=`NavLink`;var Xt=n.forwardRef(({discover:e=`render`,fetcherKey:t,navigate:i,reloadDocument:a,replace:o,state:s,method:c=J,action:l,onSubmit:u,relative:d,preventScrollReset:f,viewTransition:p,defaultShouldRevalidate:m,...h},g)=>{let{useTransitions:_}=n.useContext(B),v=nn(),y=rn(l,{relative:d}),b=c.toLowerCase()===`get`?`get`:`post`,x=typeof l==`string`&&r.test(l);return n.createElement(`form`,{ref:g,method:b,action:y,onSubmit:a?u:e=>{if(u&&u(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,a=r?.getAttribute(`formmethod`)||c,l=()=>v(r||e.currentTarget,{fetcherKey:t,method:a,navigate:i,replace:o,state:s,relative:d,preventScrollReset:f,viewTransition:p,defaultShouldRevalidate:m});_&&i!==!1?n.startTransition(()=>l()):l()},...h,"data-discover":!x&&e===`render`?`true`:void 0})});Xt.displayName=`Form`;function Zt(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Qt(e){let t=n.useContext(R);return l(t,Zt(e)),t}function $t(e,{target:t,replace:r,mask:i,state:a,preventScrollReset:o,relative:s,viewTransition:c,defaultShouldRevalidate:l,useTransitions:u}={}){let d=K(),f=G(),p=q(e,{relative:s});return n.useCallback(h=>{if(xt(h,t)){h.preventDefault();let t=r===void 0?m(f)===m(p):r,g=()=>d(e,{replace:t,mask:i,state:a,preventScrollReset:o,relative:s,viewTransition:c,defaultShouldRevalidate:l});u?n.startTransition(()=>g()):g()}},[f,d,p,r,i,a,t,e,o,s,c,l,u])}var en=0,tn=()=>`__${String(++en)}__`;function nn(){let{router:e}=Qt(`useSubmit`),{basename:t}=n.useContext(B),r=at(),i=e.fetch,a=e.navigate;return n.useCallback(async(e,n={})=>{let{action:o,method:s,encType:c,formData:l,body:u}=Tt(e,t);if(n.navigate===!1){let e=n.fetcherKey||tn();await i(e,r,n.action||o,{defaultShouldRevalidate:n.defaultShouldRevalidate,preventScrollReset:n.preventScrollReset,formData:l,body:u,formMethod:n.method||s,formEncType:n.encType||c,flushSync:n.flushSync})}else await a(n.action||o,{defaultShouldRevalidate:n.defaultShouldRevalidate,preventScrollReset:n.preventScrollReset,formData:l,body:u,formMethod:n.method||s,formEncType:n.encType||c,replace:n.replace,state:n.state,fromRouteId:r,flushSync:n.flushSync,viewTransition:n.viewTransition})},[i,a,t,r])}function rn(e,{relative:t}={}){let{basename:r}=n.useContext(B),i=n.useContext(H);l(i,`useFormAction must be used inside a RouteContext`);let[a]=i.matches.slice(-1),o={...q(e||`.`,{relative:t})},s=G();if(e==null){o.search=s.search;let e=new URLSearchParams(o.search),t=e.getAll(`index`);if(t.some(e=>e===``)){e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();o.search=n?`?${n}`:``}}return(!e||e===`.`)&&a.route.index&&(o.search=o.search?o.search.replace(/^\?/,`?index&`):`?index`),r!==`/`&&(o.pathname=o.pathname===`/`?r:P([r,o.pathname])),m(o)}function an(e,{relative:t}={}){let r=n.useContext(ke);l(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:i}=Qt(`useViewTransitionState`),a=q(e,{relative:t});if(!r.isTransitioning)return!1;let o=A(r.currentLocation.pathname,i)||r.currentLocation.pathname,s=A(r.nextLocation.pathname,i)||r.nextLocation.pathname;return k(a.pathname,s)!=null||k(a.pathname,o)!=null}export{pt as a,G as c,We as d,ft as i,K as l,Jt as n,ht as o,dt as r,k as s,qt as t,He as u};
|
|
3
|
+
Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}/*`}">.`)}let p=G(),m;if(t){let e=typeof t==`string`?h(t):t;l(d===`/`||e.pathname?.startsWith(d),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${d}" but pathname "${e.pathname}" was given in the \`location\` prop.`),m=e}else m=p;let g=m.pathname||`/`,_=g;if(d!==`/`){let e=d.replace(/^\//,``).split(`/`);_=`/`+g.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let y=r&&r.state.matches.length?r.state.matches.map(e=>Object.assign(e,{route:r.manifest[e.route.id]||e.route})):v(e,{pathname:_});u(f||y!=null,`No routes matched location "${m.pathname}${m.search}${m.hash}" `),u(y==null||y[y.length-1].route.element!==void 0||y[y.length-1].route.Component!==void 0||y[y.length-1].route.lazy!==void 0,`Matched leaf route at location "${m.pathname}${m.search}${m.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let b=$e(y&&y.map(e=>Object.assign({},e,{params:Object.assign({},s,e.params),pathname:P([d,i.encodeLocation?i.encodeLocation(e.pathname.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?d:P([d,i.encodeLocation?i.encodeLocation(e.pathnameBase.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),a,r);return t&&b?n.createElement(V.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,mask:void 0,...m},navigationType:`POP`}},b):b}function qe(){let e=ot(),t=ge(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,i=`rgba(200,200,200, 0.5)`,a={padding:`0.5rem`,backgroundColor:i},o={padding:`2px 4px`,backgroundColor:i},s=null;return console.error(`Error handled by React Router default ErrorBoundary:`,e),s=n.createElement(n.Fragment,null,n.createElement(`p`,null,`💿 Hey developer 👋`),n.createElement(`p`,null,`You can provide a way better UX than this when your app throws errors by providing your own `,n.createElement(`code`,{style:o},`ErrorBoundary`),` or`,` `,n.createElement(`code`,{style:o},`errorElement`),` prop on your route.`)),n.createElement(n.Fragment,null,n.createElement(`h2`,null,`Unexpected Application Error!`),n.createElement(`h3`,{style:{fontStyle:`italic`}},t),r?n.createElement(`pre`,{style:a},r):null,s)}var Je=n.createElement(qe,null),Ye=class extends n.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!==`idle`&&e.revalidation===`idle`?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error===void 0?t.error:e.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error(`React Router caught the following error during render`,e)}render(){let e=this.state.error;if(this.context&&typeof e==`object`&&e&&`digest`in e&&typeof e.digest==`string`){let t=Ie(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:n.createElement(H.Provider,{value:this.props.routeContext},n.createElement(U.Provider,{value:e,children:this.props.component}));return this.context?n.createElement(Ze,{error:e},t):t}};Ye.contextType=De;var Xe=new WeakMap;function Ze({children:e,error:t}){let{basename:r,navigator:i}=n.useContext(B);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=Fe(t.digest);if(e){let a=Xe.get(t);if(a)throw a;let o=ye(e.location,r),s=o.absoluteURL||o.to;if(L(e.location,s,I(i),`allow-explicit`),Ee(s))throw Error(`Invalid redirect location`);if(ve&&!Xe.get(t)){if(o.isExternal||e.reloadDocument)window.location.href=s;else{let n=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(o.to,{replace:e.replace}));throw Xe.set(t,n),n}}return n.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${s}`})}}return e}function Qe({routeContext:e,match:t,children:r}){let i=n.useContext(R);return i&&i.static&&i.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=t.route.id),n.createElement(H.Provider,{value:e},r)}function $e(e,t=[],r){let i=r?.state;if(e==null){if(!i)return null;if(i.errors)e=i.matches;else if(t.length===0&&!i.initialized&&i.matches.length>0)e=i.matches;else return null}let a=e,o=i?.errors;if(o!=null){let e=a.findIndex(e=>e.route.id&&o?.[e.route.id]!==void 0);l(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(`,`)}`),a=a.slice(0,Math.min(a.length,e+1))}let s=!1,c=-1;if(r&&i){s=i.renderFallback;for(let e=0;e<a.length;e++){let t=a[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(c=e),t.route.id){let{loaderData:e,errors:n}=i,o=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!n||n[t.route.id]===void 0);if(t.route.lazy||o){r.isStatic&&(s=!0),a=c>=0?a.slice(0,c+1):[a[0]];break}}}}let u=r?.onError,d=i&&u?(e,t)=>{u(e,{location:i.location,params:i.matches?.[0]?.params??{},pattern:_e(i.matches),errorInfo:t})}:void 0;return a.reduceRight((e,r,l)=>{let u,f=!1,p=null,m=null;i&&(u=o&&r.route.id?o[r.route.id]:void 0,p=r.route.errorElement||Je,s&&(c<0&&l===0?(lt(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),f=!0,m=null):c===l&&(f=!0,m=r.route.hydrateFallbackElement||null)));let h=t.concat(a.slice(0,l+1)),g=()=>{let t;return t=u?p:f?m:r.route.Component?n.createElement(r.route.Component,null):r.route.element?r.route.element:e,n.createElement(Qe,{match:r,routeContext:{outlet:e,matches:h,isDataRoute:i!=null},children:t})};return i&&(r.route.ErrorBoundary||r.route.errorElement||l===0)?n.createElement(Ye,{location:i.location,revalidation:i.revalidation,component:p,error:u,children:g(),routeContext:{outlet:null,matches:h,isDataRoute:!0},onError:d}):g()},null)}function et(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function tt(e){let t=n.useContext(R);return l(t,et(e)),t}function nt(e){let t=n.useContext(z);return l(t,et(e)),t}function rt(e){let t=n.useContext(H);return l(t,et(e)),t}function it(e){let t=rt(e),n=t.matches[t.matches.length-1];return l(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function at(){return it(`useRouteId`)}function ot(){let e=n.useContext(U),t=nt(`useRouteError`),r=it(`useRouteError`);return e===void 0?t.errors?.[r]:e}function st(){let{router:e}=tt(`useNavigate`),t=it(`useNavigate`),r=n.useRef(!1);return ze(()=>{r.current=!0}),n.useCallback(async(n,i={})=>{u(r.current,Re),r.current&&(typeof n==`number`?await e.navigate(n):await e.navigate(n,{fromRouteId:t,...i}))},[e,t])}var ct={};function lt(e,t,n){!t&&!ct[e]&&(ct[e]=!0,u(!1,n))}n.memo(ut);function ut({routes:e,manifest:t,future:n,state:r,isStatic:i,onError:a}){return Ke(e,void 0,{manifest:t,state:r,isStatic:i,onError:a,future:n})}function dt({to:e,replace:t,state:r,relative:i}){l(W(),`<Navigate> may be used only in the context of a <Router> component.`);let{static:a,navigator:o}=n.useContext(B);u(!a,`<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.`);let{matches:s}=n.useContext(H),{pathname:c}=G(),d=K(),f=N(e,M(s),c,i===`path`);L(typeof e==`string`?e:m(e),o.createHref(f),I(o),`reject`);let p=JSON.stringify(f);return n.useEffect(()=>{d(JSON.parse(p),{replace:t,state:r,relative:i})},[d,p,i,t,r]),null}function ft(e){return Ue(e.context)}function pt(e){l(!1,`A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.`)}function mt({basename:e=`/`,children:t=null,location:r,navigationType:i=`POP`,navigator:a,static:o=!1,useTransitions:s}){l(!W(),`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`);let c=e.replace(/^\/*/,`/`),d=n.useMemo(()=>({basename:c,navigator:a,static:o,useTransitions:s,future:{}}),[c,a,o,s]);typeof r==`string`&&(r=h(r));let{pathname:f=`/`,search:p=``,hash:m=``,state:g=null,key:_=`default`,mask:v}=r,y=n.useMemo(()=>{let e=A(f,c);return e==null?null:{location:{pathname:e,search:p,hash:m,state:g,key:_,mask:v},navigationType:i}},[c,f,p,m,g,_,i,v]);return u(y!=null,`<Router basename="${c}"> is not able to match the URL "${f}${p}${m}" because it does not start with the basename, so the <Router> won't render anything.`),y==null?null:n.createElement(B.Provider,{value:d},n.createElement(V.Provider,{children:t,value:y}))}function ht({children:e,location:t}){return Ge(gt(e),t)}n.Component;function gt(e,t=[]){let r=[];return n.Children.forEach(e,(e,i)=>{if(!n.isValidElement(e))return;let a=[...t,i];if(e.type===n.Fragment){r.push.apply(r,gt(e.props.children,a));return}l(e.type===pt,`[${typeof e.type==`string`?e.type:e.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),l(!e.props.index||!e.props.children,`An index route cannot have child routes.`);let o={id:e.props.id||a.join(`-`),caseSensitive:e.props.caseSensitive,element:e.props.element,Component:e.props.Component,index:e.props.index,path:e.props.path,middleware:e.props.middleware,loader:e.props.loader,action:e.props.action,hydrateFallbackElement:e.props.hydrateFallbackElement,HydrateFallback:e.props.HydrateFallback,errorElement:e.props.errorElement,ErrorBoundary:e.props.ErrorBoundary,hasErrorBoundary:e.props.hasErrorBoundary===!0||e.props.ErrorBoundary!=null||e.props.errorElement!=null,shouldRevalidate:e.props.shouldRevalidate,handle:e.props.handle,lazy:e.props.lazy};e.props.children&&(o.children=gt(e.props.children,a)),r.push(o)}),r}var J=`get`,Y=`application/x-www-form-urlencoded`;function X(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function _t(e){return X(e)&&e.tagName.toLowerCase()===`button`}function vt(e){return X(e)&&e.tagName.toLowerCase()===`form`}function yt(e){return X(e)&&e.tagName.toLowerCase()===`input`}function bt(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function xt(e,t){return e.button===0&&(!t||t===`_self`)&&!bt(e)}var Z=null;function St(){if(Z===null)try{new FormData(document.createElement(`form`),0),Z=!1}catch{Z=!0}return Z}var Ct=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function wt(e){return e!=null&&!Ct.has(e)?(u(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Y}"`),null):e}function Tt(e,t){let n,r,i,a,o;if(vt(e)){let o=e.getAttribute(`action`);r=o?A(o,t):null,n=e.getAttribute(`method`)||J,i=wt(e.getAttribute(`enctype`))||Y,a=new FormData(e)}else if(_t(e)||yt(e)&&(e.type===`submit`||e.type===`image`)){let o=e.form;if(o==null)throw Error(`Cannot submit a <button> or <input type="submit"> without a <form>`);let s=e.getAttribute(`formaction`)||o.getAttribute(`action`);if(r=s?A(s,t):null,n=e.getAttribute(`formmethod`)||o.getAttribute(`method`)||J,i=wt(e.getAttribute(`formenctype`))||wt(o.getAttribute(`enctype`))||Y,a=new FormData(o,e),!St()){let{name:t,type:n,value:r}=e;if(n===`image`){let e=t?`${t}.`:``;a.append(`${e}x`,`0`),a.append(`${e}y`,`0`)}else t&&a.append(t,r)}}else if(X(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=J,r=null,i=Y,o=e;return a&&i===`text/plain`&&(o=a,a=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:a,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);function Et(e,t){if(e===!1||e==null)throw Error(t)}function Dt(e,t,n,r){let i=typeof e==`string`?new URL(e,typeof window>`u`?`server://singlefetch/`:window.location.origin):e;return i.pathname=n?i.pathname.endsWith(`/`)?`${i.pathname}_.${r}`:`${i.pathname}.${r}`:i.pathname===`/`?`_root.${r}`:t&&A(i.pathname,t)===`/`?`${F(t)}/_root.${r}`:`${F(i.pathname)}.${r}`,i}async function Ot(e,t){if(e.id in t)return t[e.id];try{let n=await import(e.module);return t[e.id]=n,n}catch(t){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function kt(e){return e!=null&&typeof e.page==`string`}function At(e){return e==null?!1:e.href==null?e.rel===`preload`&&typeof e.imageSrcSet==`string`&&typeof e.imageSizes==`string`:typeof e.rel==`string`&&typeof e.href==`string`}async function jt(e,t,n){return It((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await Ot(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(At).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function Mt(e,t,n,r,i,a){let o=(e,t)=>!n[t]||e.route.id!==n[t].route.id,s=(e,t)=>n[t].pathname!==e.pathname||n[t].route.path?.endsWith(`*`)&&n[t].params[`*`]!==e.params[`*`];return a===`assets`?t.filter((e,t)=>o(e,t)||s(e,t)):a===`data`?t.filter((t,a)=>{let c=r.routes[t.route.id];if(!c||!c.hasLoader)return!1;if(o(t,a)||s(t,a))return!0;if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:t.params,defaultShouldRevalidate:!0});if(typeof r==`boolean`)return r}return!0}):[]}function Nt(e,t,{includeHydrateFallback:n}={}){return Pt(e.map(e=>{let r=t.routes[e.route.id];if(!r)return[];let i=[r.module];return r.clientActionModule&&(i=i.concat(r.clientActionModule)),r.clientLoaderModule&&(i=i.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(i=i.concat(r.hydrateFallbackModule)),r.imports&&(i=i.concat(r.imports)),i}).flat(1))}function Pt(e){return[...new Set(e)]}function Ft(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function It(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!kt(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(Ft(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}function Lt(){let e=n.useContext(R);return Et(e,`You must render this element inside a <DataRouterContext.Provider> element`),e}function Rt(){let e=n.useContext(z);return Et(e,`You must render this element inside a <DataRouterStateContext.Provider> element`),e}var zt=n.createContext(void 0);zt.displayName=`FrameworkContext`;function Q(){let e=n.useContext(zt);return Et(e,`You must render this element inside a <HydratedRouter> element`),e}function Bt(e,t){let r=n.useContext(zt),[i,a]=n.useState(!1),[o,s]=n.useState(!1),{onFocus:c,onBlur:l,onMouseEnter:u,onMouseLeave:d,onTouchStart:f}=t,p=n.useRef(null);n.useEffect(()=>{if(e===`render`&&s(!0),e===`viewport`){let e=new IntersectionObserver(e=>{e.forEach(e=>{s(e.isIntersecting)})},{threshold:.5});return p.current&&e.observe(p.current),()=>{e.disconnect()}}},[e]),n.useEffect(()=>{if(i){let e=setTimeout(()=>{s(!0)},100);return()=>{clearTimeout(e)}}},[i]);let m=()=>{a(!0)},h=()=>{a(!1),s(!1)};return r?e===`intent`?[o,p,{onFocus:$(c,m),onBlur:$(l,h),onMouseEnter:$(u,m),onMouseLeave:$(d,h),onTouchStart:$(f,m)}]:[o,p,{}]:[!1,p,{}]}function $(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function Vt({page:e,...t}){let r=Oe(),{nonce:i}=Q(),{router:a}=Lt(),o=n.useMemo(()=>v(a.routes,e,a.basename),[a.routes,e,a.basename]);return o?(t.nonce==null&&i&&(t={...t,nonce:i}),r?n.createElement(Ut,{page:e,matches:o,...t}):n.createElement(Wt,{page:e,matches:o,...t})):null}function Ht(e){let{manifest:t,routeModules:r}=Q(),[i,a]=n.useState([]);return n.useEffect(()=>{let n=!1;return jt(e,t,r).then(e=>{n||a(e)}),()=>{n=!0}},[e,t,r]),i}function Ut({page:e,matches:t,...r}){let i=G(),{future:a}=Q(),{basename:o}=Lt(),s=n.useMemo(()=>{if(e===i.pathname+i.search+i.hash)return[];let n=Dt(e,o,a.v8_trailingSlashAwareDataRequests,`rsc`),r=!1,s=[];for(let e of t)typeof e.route.shouldRevalidate==`function`?r=!0:s.push(e.route.id);return r&&s.length>0&&n.searchParams.set(`_routes`,s.join(`,`)),[n.pathname+n.search]},[o,a.v8_trailingSlashAwareDataRequests,e,i,t]);return n.createElement(n.Fragment,null,s.map(e=>n.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...r})))}function Wt({page:e,matches:t,...r}){let i=G(),{future:a,manifest:o,routeModules:s}=Q(),{basename:c}=Lt(),{loaderData:l,matches:u}=Rt(),d=n.useMemo(()=>Mt(e,t,u,o,i,`data`),[e,t,u,o,i]),f=n.useMemo(()=>Mt(e,t,u,o,i,`assets`),[e,t,u,o,i]),p=n.useMemo(()=>{if(e===i.pathname+i.search+i.hash)return[];let n=new Set,r=!1;if(t.forEach(e=>{let t=o.routes[e.route.id];t&&t.hasLoader&&(!d.some(t=>t.route.id===e.route.id)&&e.route.id in l&&s[e.route.id]?.shouldRevalidate||t.hasClientLoader?r=!0:n.add(e.route.id))}),n.size===0)return[];let u=Dt(e,c,a.v8_trailingSlashAwareDataRequests,`data`);return r&&n.size>0&&u.searchParams.set(`_routes`,t.filter(e=>n.has(e.route.id)).map(e=>e.route.id).join(`,`)),[u.pathname+u.search]},[c,a.v8_trailingSlashAwareDataRequests,l,i,o,d,t,e,s]),m=n.useMemo(()=>Nt(f,o),[f,o]),h=Ht(f);return n.createElement(n.Fragment,null,p.map(e=>n.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...r})),m.map(e=>n.createElement(`link`,{key:e,rel:`modulepreload`,href:e,...r})),h.map(({key:e,link:t})=>n.createElement(`link`,{key:e,nonce:r.nonce,...t,crossOrigin:t.crossOrigin??r.crossOrigin})))}function Gt(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}n.Component;var Kt=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{Kt&&(window.__reactRouterVersion=`7.18.5`)}catch{}function qt({basename:e,children:t,useTransitions:r,window:i}){let a=n.useRef();a.current??=c({window:i,v5Compat:!0});let o=a.current,[s,l]=n.useState({action:o.action,location:o.location}),u=n.useCallback(e=>{r===!1?l(e):n.startTransition(()=>l(e))},[r]);return n.useLayoutEffect(()=>o.listen(u),[o,u]),n.createElement(mt,{basename:e,children:t,location:s.location,navigationType:s.action,navigator:o,useTransitions:r})}var Jt=n.forwardRef(function({onClick:e,discover:t=`render`,prefetch:i=`none`,relative:a,reloadDocument:o,replace:s,mask:c,state:l,target:u,to:d,preventScrollReset:f,viewTransition:p,defaultShouldRevalidate:m,...h},g){let{basename:_,navigator:v,useTransitions:y}=n.useContext(B),b=typeof d==`string`&&r.test(d),x=ye(d,_);d=x.to;let S=Le(d,{relative:a}),C=G(),w=null;if(c){let e=N(c,[],C.mask?C.mask.pathname:`/`,!0);_!==`/`&&(e.pathname=e.pathname===`/`?_:P([_,e.pathname])),w=v.createHref(e)}let[T,E,ee]=Bt(i,h),te=$t(d,{replace:s,mask:c,state:l,target:u,preventScrollReset:f,relative:a,viewTransition:p,defaultShouldRevalidate:m,useTransitions:y});function ne(t){e&&e(t),t.defaultPrevented||te(t)}let D=!(x.isExternal||o),O=n.createElement(`a`,{...h,...ee,href:(D?w:void 0)||x.absoluteURL||S,onClick:D?ne:e,ref:Gt(g,E),target:u,"data-discover":!b&&t===`render`?`true`:void 0});return T&&!b?n.createElement(n.Fragment,null,O,n.createElement(Vt,{page:S})):O});Jt.displayName=`Link`;var Yt=n.forwardRef(function({"aria-current":e=`page`,caseSensitive:t=!1,className:r=``,end:i=!1,style:a,to:o,viewTransition:s,children:c,...l},u){let d=q(o,{relative:l.relative}),f=G(),p=n.useContext(z),{navigator:m,basename:h}=n.useContext(B),g=p!=null&&an(d)&&s===!0,_=m.encodeLocation?m.encodeLocation(d).pathname:d.pathname,v=f.pathname,y=p&&p.navigation&&p.navigation.location?p.navigation.location.pathname:null;t||(v=v.toLowerCase(),y=y?y.toLowerCase():null,_=_.toLowerCase()),y&&h&&(y=A(y,h)||y);let b=_!==`/`&&_.endsWith(`/`)?_.length-1:_.length,x=v===_||!i&&v.startsWith(_)&&v.charAt(b)===`/`,S=y!=null&&(y===_||!i&&y.startsWith(_)&&y.charAt(_.length)===`/`),C={isActive:x,isPending:S,isTransitioning:g},w=x?e:void 0,T;T=typeof r==`function`?r(C):[r,x?`active`:null,S?`pending`:null,g?`transitioning`:null].filter(Boolean).join(` `);let E=typeof a==`function`?a(C):a;return n.createElement(Jt,{...l,"aria-current":w,className:T,ref:u,style:E,to:o,viewTransition:s},typeof c==`function`?c(C):c)});Yt.displayName=`NavLink`;var Xt=n.forwardRef(({discover:e=`render`,fetcherKey:t,navigate:i,reloadDocument:a,replace:o,state:s,method:c=J,action:l,onSubmit:u,relative:d,preventScrollReset:f,viewTransition:p,defaultShouldRevalidate:m,...h},g)=>{let{useTransitions:_}=n.useContext(B),v=nn(),y=rn(l,{relative:d}),b=c.toLowerCase()===`get`?`get`:`post`,x=typeof l==`string`&&r.test(l);return n.createElement(`form`,{ref:g,method:b,action:y,onSubmit:a?u:e=>{if(u&&u(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,a=r?.getAttribute(`formmethod`)||c,l=()=>v(r||e.currentTarget,{fetcherKey:t,method:a,navigate:i,replace:o,state:s,relative:d,preventScrollReset:f,viewTransition:p,defaultShouldRevalidate:m});_&&i!==!1?n.startTransition(()=>l()):l()},...h,"data-discover":!x&&e===`render`?`true`:void 0})});Xt.displayName=`Form`;function Zt(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Qt(e){let t=n.useContext(R);return l(t,Zt(e)),t}function $t(e,{target:t,replace:r,mask:i,state:a,preventScrollReset:o,relative:s,viewTransition:c,defaultShouldRevalidate:l,useTransitions:u}={}){let d=K(),f=G(),p=q(e,{relative:s});return n.useCallback(h=>{if(xt(h,t)){h.preventDefault();let t=r===void 0?m(f)===m(p):r,g=()=>d(e,{replace:t,mask:i,state:a,preventScrollReset:o,relative:s,viewTransition:c,defaultShouldRevalidate:l});u?n.startTransition(()=>g()):g()}},[f,d,p,r,i,a,t,e,o,s,c,l,u])}var en=0,tn=()=>`__${String(++en)}__`;function nn(){let{router:e}=Qt(`useSubmit`),{basename:t}=n.useContext(B),r=at(),i=e.fetch,a=e.navigate;return n.useCallback(async(e,n={})=>{let{action:o,method:s,encType:c,formData:l,body:u}=Tt(e,t);if(n.navigate===!1){let e=n.fetcherKey||tn();await i(e,r,n.action||o,{defaultShouldRevalidate:n.defaultShouldRevalidate,preventScrollReset:n.preventScrollReset,formData:l,body:u,formMethod:n.method||s,formEncType:n.encType||c,flushSync:n.flushSync})}else await a(n.action||o,{defaultShouldRevalidate:n.defaultShouldRevalidate,preventScrollReset:n.preventScrollReset,formData:l,body:u,formMethod:n.method||s,formEncType:n.encType||c,replace:n.replace,state:n.state,fromRouteId:r,flushSync:n.flushSync,viewTransition:n.viewTransition})},[i,a,t,r])}function rn(e,{relative:t}={}){let{basename:r}=n.useContext(B),i=n.useContext(H);l(i,`useFormAction must be used inside a RouteContext`);let[a]=i.matches.slice(-1),o={...q(e||`.`,{relative:t})},s=G();if(e==null){o.search=s.search;let e=new URLSearchParams(o.search),t=e.getAll(`index`);if(t.some(e=>e===``)){e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();o.search=n?`?${n}`:``}}return(!e||e===`.`)&&a.route.index&&(o.search=o.search?o.search.replace(/^\?/,`?index&`):`?index`),r!==`/`&&(o.pathname=o.pathname===`/`?r:P([r,o.pathname])),m(o)}function an(e,{relative:t}={}){let r=n.useContext(ke);l(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:i}=Qt(`useViewTransitionState`),a=q(e,{relative:t});if(!r.isTransitioning)return!1;let o=A(r.currentLocation.pathname,i)||r.currentLocation.pathname,s=A(r.nextLocation.pathname,i)||r.nextLocation.pathname;return k(a.pathname,s)!=null||k(a.pathname,o)!=null}export{pt as a,G as c,We as d,ft as i,K as l,Jt as n,ht as o,dt as r,k as s,qt as t,He as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h as e}from"./pendingActionsStore-
|
|
1
|
+
import{h as e}from"./pendingActionsStore-BAMMp6is.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};
|
|
@@ -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{f as r,p as i}from"./pendingActionsStore-BEJnZIRD.js";import{t as a}from"./timer.adapter-BX7ibpTi.js";import{a as o,c as s,o as c,s as l}from"./segmented-control-BdqpOGH3.js";import{a as u,f as ee,l as te,n as d,t as f}from"./log-DxnWb_y2.js";import{t as ne}from"./core-types-Ds7PFmZN.js";import{u as re}from"./pathUtils-DTWwEzHK.js";import{t as p}from"./runDetached-K6ggut3D.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}){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,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
|
+
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-BAMMp6is.js";import{t as a}from"./timer.adapter-obf6icc9.js";import{a as o,c as s,o as c,s as l}from"./segmented-control-WauTv4kI.js";import{a as u,f as ee,l as te,n as d,t as f}from"./log-CSvFzOgk.js";import{t as ne}from"./core-types-Ds7PFmZN.js";import{u as re}from"./pathUtils-DTWwEzHK.js";import{t as p}from"./runDetached-6EapWBGL.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}){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,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-BAMMp6is.js";import{r}from"./log-CSvFzOgk.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-BAMMp6is.js";import{t as i}from"./timer.adapter-obf6icc9.js";import{f as a}from"./log-CSvFzOgk.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-CSvFzOgk.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-obf6icc9.js";import{f as r}from"./log-CSvFzOgk.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-BAMMp6is.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};
|
package/dist/client/assets/{github-dark-default-adAWTKmX.js → github-dark-default-CM8LCIj6.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e={name:`GitHub Dark Default`,appearance:`dark`,style:{background:`#0d1117`,text:`#e6edf3`,"editor.background":`#0d1117`,"editor.foreground":`#e6edf3`,"editor.active_line.background":`#6e76811a`,players:[],warning:`#fbe557`,hint:`#7d8590`,created:`#3fb950`,deleted:`#f85149`,modified:`#d29922`,"terminal.ansi.green":`#3fb950`,"terminal.ansi.red":`#ff7b72`,"terminal.ansi.blue":`#58a6ff`,syntax:{boolean:{color:`#79c0ff`},comment:{color:`#8b949e`},"comment.doc":{color:`#8b949e`},constant:{color:`#79c0ff`},constructor:{color:`#7ee787`},emphasis:{color:`#e6edf3`,font_style:`italic`},"emphasis.strong":{color:`#e6edf3`,font_weight:700},function:{color:`#d2a8ff`},keyword:{color:`#ff7b72`},label:{color:`#ffa657`},link_text:{color:`#a5d6ff`},link_uri:{color:`#a5d6ff`},number:{color:`#79c0ff`},string:{color:`#a5d6ff`},"string.escape":{color:`#ff7b72`},"string.regex":{color:`#a5d6ff`},"string.special":{color:`#a5d6ff`},"string.special.symbol":{color:`#a5d6ff`},tag:{color:`#7ee787`},"text.literal":{color:`#a5d6ff`},title:{color:`#ffa657`},variable:{color:`#e6edf3`},type:{color:`#79c0ff`},"variable.special":{color:`#79c0ff`},attribute:{color:`#79C0FF`},embedded:{color:`#e6edf3`},namespace:{color:`#FFA657`},operator:{color:`#FF7B72`},predictive:{color:`#8b949e`},preproc:{color:`#ff7b72`},primary:{color:`#e6edf3`},property:{color:`#
|
|
1
|
+
var e={name:`GitHub Dark Default`,appearance:`dark`,style:{background:`#0d1117`,text:`#e6edf3`,"editor.background":`#0d1117`,"editor.foreground":`#e6edf3`,"editor.active_line.background":`#6e76811a`,players:[],warning:`#fbe557`,hint:`#7d8590`,created:`#3fb950`,deleted:`#f85149`,modified:`#d29922`,"terminal.ansi.green":`#3fb950`,"terminal.ansi.red":`#ff7b72`,"terminal.ansi.blue":`#58a6ff`,syntax:{boolean:{color:`#79c0ff`},comment:{color:`#8b949e`},"comment.doc":{color:`#8b949e`},constant:{color:`#79c0ff`},constructor:{color:`#7ee787`},emphasis:{color:`#e6edf3`,font_style:`italic`},"emphasis.strong":{color:`#e6edf3`,font_weight:700},function:{color:`#d2a8ff`},keyword:{color:`#ff7b72`},label:{color:`#ffa657`},link_text:{color:`#a5d6ff`},link_uri:{color:`#a5d6ff`},number:{color:`#79c0ff`},string:{color:`#a5d6ff`},"string.escape":{color:`#ff7b72`},"string.regex":{color:`#a5d6ff`},"string.special":{color:`#a5d6ff`},"string.special.symbol":{color:`#a5d6ff`},tag:{color:`#7ee787`},"text.literal":{color:`#a5d6ff`},title:{color:`#ffa657`},variable:{color:`#e6edf3`},type:{color:`#79c0ff`},"variable.special":{color:`#79c0ff`},attribute:{color:`#79C0FF`},embedded:{color:`#e6edf3`},namespace:{color:`#FFA657`},operator:{color:`#FF7B72`},predictive:{color:`#8b949e`},preproc:{color:`#ff7b72`},primary:{color:`#e6edf3`},property:{color:`#e6edf3`},punctuation:{color:`#e6edf3`},selector:{color:`#7EE787`},enum:{color:`#FFA657`},hint:{color:`#7d8590`},variant:{color:`#79C0FF`},"diff.minus":{color:`#FFA198`},"diff.plus":{color:`#7EE787`},"property.json_key":{color:`#7EE787`},"punctuation.list_marker":{color:`#FFA657`},"punctuation.special":{color:`#FF7B72`},"selector.class":{color:`#79C0FF`},"selector.id":{color:`#79C0FF`},"selector.pseudo":{color:`#79C0FF`},"punctuation.delimiter.jsx":{color:`#FF7B72`},"variable.parameter":{color:`#FFA657`}}}};export{e as default};
|