@codexhost/cli-darwin-x64 0.21.0 → 0.22.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/README.md +1 -1
- package/app/codexhost-distribution.json +1 -1
- package/app/console-server.mjs +1 -0
- package/app/console-web.js +1 -0
- package/app/desktop-controller.mjs +4 -1
- package/app/host-runtime.mjs +86 -21
- package/app/plugins/antigravity/plugin.mjs +1144 -1254
- package/app/plugins/claude-code/plugin.mjs +389 -84
- package/app/plugins/codebuddy/plugin.mjs +1 -0
- package/app/plugins/codex-usage/plugin.mjs +1 -0
- package/app/plugins/copilot/plugin.mjs +1 -0
- package/app/plugins/cursor-cli/plugin.mjs +1 -0
- package/app/plugins/deepseek-harness/plugin.mjs +1 -0
- package/app/plugins/devin/plugin.mjs +1 -0
- package/app/plugins/grok/plugin.mjs +192 -177
- package/app/plugins/hermes/plugin.mjs +1 -0
- package/app/plugins/kimi-code/plugin.mjs +1 -0
- package/app/plugins/kiro-cli/plugin.mjs +1 -0
- package/app/plugins/omp/plugin.mjs +108 -22
- package/app/plugins/opencode/plugin.mjs +1 -0
- package/app/plugins/pi/plugin.mjs +119 -23
- package/app/plugins/qoder/plugin.mjs +1 -0
- package/app/plugins/qoder-cn/plugin.mjs +1 -0
- package/app/plugins/qwen-code/plugin.mjs +1 -0
- package/app/plugins/workbuddy/plugin.mjs +1 -0
- package/app/plugins/zcode/plugin.mjs +1 -0
- package/app/renderer-extension.js +1 -0
- package/app/web/assets/index-CN4a4sj0.js +201 -0
- package/app/web/codexhost-settings.js +1 -0
- package/app/web/index.html +1 -1
- package/app/web/plugins/deepseek-ai__dsh-api-remotes/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-api-session-controller/client.js +6 -6
- package/app/web/plugins/deepseek-ai__dsh-client-ui-chat/client.js +69 -69
- package/app/web/plugins/deepseek-ai__dsh-client-ui-codexhost/client.js +2 -2
- package/app/web/plugins/deepseek-ai__dsh-client-ui-conversation/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-tool/client.js +1 -1
- package/app/web-modules/server.mjs +130 -74
- package/bin/codexhost +0 -0
- package/libexec/codexhost-shim +0 -0
- package/libexec/codexhost-updater +0 -0
- package/package.json +1 -1
- package/app/web/assets/index-BdmZfTRW.js +0 -201
|
@@ -152,7 +152,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
152
152
|
|
|
153
153
|
`)}return e}getTextContentSize(){let e=function(e){let t=0;for(let n of m_(e)){let r=h_(e,n);r!==null&&(t+=r.getTextContentSize())}return t}(this),t=this.getChildren(),n=t.length;for(let r=0;r<n;r++){let i=t[r];e+=i.getTextContentSize(),G(i)&&r!==n-1&&!i.isInline()&&(e+=2)}return e}getDirection(){return this.getLatest().__dir}getTextFormat(){return this.getLatest().__textFormat}hasFormat(e){if(e!==``){let t=dl[e];return(this.getFormat()&t)!==0}return!1}hasTextFormat(e){let t=ll[e];return(this.getTextFormat()&t)!==0}getFormatFlags(e,t){return dh(this.getLatest().__textFormat,e,t)}getTextStyle(){return this.getLatest().__textStyle}select(e,t){Qp();let n=U(),r=e,i=t,a=this.getChildrenSize();if(!this.canBeEmpty()){if(e===0&&t===0){let e=this.getFirstChild();if(V(e)||G(e))return e.select(0,0)}else if(!(e!==void 0&&e!==a||t!==void 0&&t!==a)){let e=this.getLastChild();if(V(e)||G(e))return e.select()}}r===void 0&&(r=a),i===void 0&&(i=a);let o=this.__key;return H(n)?(n.anchor.set(o,r,`element`),n.focus.set(o,i,`element`),n.dirty=!0,n):Cp(o,r,o,i,`element`,`element`)}selectStart(){let e=this.getFirstDescendant();return e?e.selectStart():this.select()}selectEnd(){let e=this.getLastDescendant();return e?e.selectEnd():this.select()}clear(){let e=this.getWritable();return this.getChildren().forEach(e=>e.remove()),e}append(...e){return this.splice(this.getChildrenSize(),0,e)}setDirection(e){let t=this.getWritable();return t.__dir=e,t}setFormat(e){return this.getWritable().__format=e!==``&&dl[e]||0,this}setStyle(e){return this.getWritable().__style=e||``,this}setTextFormat(e){let t=this.getWritable();return t.__textFormat=e,t}setTextStyle(e){let t=this.getWritable();return t.__textStyle=e,t}setIndent(e){return this.getWritable().__indent=e,this}splice(e,t,n){_f(this)&&L(324,this.__key,this.__type);let r=this.getChildrenSize(),i=this.getWritable();e+t<=r||L(226,String(e),String(t),String(r));for(let e of n);let a=i.__key,o=[],s=[],c=this.getChildAtIndex(e+t),l=null,u=r-t+n.length;if(e!==0){if(e===r)l=this.getLastChild();else{let t=this.getChildAtIndex(e);t!==null&&(l=t.getPreviousSibling())}}if(t>0){let e=l===null?this.getFirstChild():l.getNextSibling();for(let n=0;n<t;n++){e===null&&L(100);let t=e.getNextSibling(),n=e.__key;ph(e.getWritable()),s.push(n),e=t}}let d=l;for(let e of n){d!==null&&e.is(d)&&(l=d=d.getPreviousSibling());let t=e.getWritable();t.__parent===a&&u--,ph(t);let n=e.__key;if(d===null)i.__first=n,t.__prev=null;else{let e=d.getWritable();e.__next=n,t.__prev=e.__key}e.__key===a&&L(76),t.__parent=a,o.push(n),d=e}if(e+t===r)d!==null&&(d.getWritable().__next=null,i.__last=d.__key);else if(c!==null){let e=c.getWritable();if(d!==null){let t=d.getWritable();e.__prev=d.__key,t.__next=c.__key}else e.__prev=null}if(i.__size=u,s.length){let e=U();if(H(e)){let t=new Set(s),n=new Set(o),{anchor:r,focus:i}=e;ym(r,t,n)&&Ap(r,r.getNode(),this,l,c),ym(i,t,n)&&Ap(i,i.getNode(),this,l,c),u!==0||this.canBeEmpty()||rg(this)||this.remove()}}return i}getDOMSlot(e){return new bl(e)}exportDOM(e){let{element:t}=super.exportDOM(e);if(Y(t)){let e=this.getIndent();e>0&&(t.style.paddingInlineStart=40*e+`px`,t.setAttribute(`data-lexical-indent`,String(e)));let n=this.getDirection();n&&(t.dir=n)}return{element:t}}exportJSON(){let e={children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),...super.exportJSON()},t=this.getTextFormat(),n=this.getTextStyle();return t===0&&n===``||rg(this)||this.getChildren().some(V)||(t!==0&&(e.textFormat=t),n!==``&&(e.textStyle=n)),e}updateFromJSON(e){return super.updateFromJSON(e).setFormat(e.format).setIndent(e.indent).setDirection(e.direction).setTextFormat(e.textFormat||0).setTextStyle(e.textStyle||``)}insertNewAfter(e,t){return null}canIndent(){return!0}collapseAtStart(e){return!1}excludeFromCopy(e){return!1}canReplaceWith(e){return!0}canInsertAfter(e){return!0}canBeEmpty(){return!0}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}isInline(){return!1}isShadowRoot(){return!1}canMergeWith(e){return!1}extractWithChild(e,t,n){return!1}canMergeWhenEmpty(){return!1}reconcileObservedMutation(e,t){let n=Ig(this,e,t),r=n.getFirstChild();for(let e=this.getFirstChild();e;e=e.getNextSibling()){let i=t.getElementByKey(e.getKey());i!==null&&(r==null?(n.insertChild(i),r=i):r!==i&&n.replaceChild(i,r),r=r.nextSibling)}}};function G(e){return e instanceof vm}function ym(e,t,n){let r=e.getNode();for(;r;){let e=r.__key;if(t.has(e)&&!n.has(e))return!0;r=r.getParent()}return!1}var bm=class extends yf{__slotHost;__slots;constructor(e){super(e),this.__slotHost=null,this.__slots=null}afterCloneFrom(e){super.afterCloneFrom(e),this.__key===e.__key&&(this.__slotHost=e.__slotHost,this.__slotHost!==null&&this.__parent!==null&&L(383,this.__key,String(this.__slotHost),String(this.__parent)),this.__slots=e.__slots)}decorate(e,t){return null}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}};function K(e){return e instanceof bm}var xm=class extends vm{__cachedText;$config(){return this.config(`root`,{extends:vm})}constructor(){super(`root`),this.__cachedText=null}getTopLevelElementOrThrow(){L(51)}getTextContent(){let e=this.__cachedText;return e===null||!Zp()&&W()._dirtyType!==0?super.getTextContent():e}remove(){L(52)}replace(e){L(53)}insertBefore(e){L(54)}insertAfter(e){L(55)}updateDOM(e,t){return!1}splice(e,t,n){for(let e of n)G(e)||K(e)||L(282);return super.splice(e,t,n)}static importJSON(e){return wh().updateFromJSON(e)}collapseAtStart(){return!0}};function Sm(e){return e instanceof xm}function Cm(e){return new Dm(Tl(e._nodeMap),null,e._slotsUsed)}function wm(){return new Dm(/* @__PURE__ */ new Map([[`root`,new xm]]),null,!1)}function Tm(e){let t=e.exportJSON(),n=e.constructor;if(t.type!==n.getType()&&L(130,n.name),G(e)){let r=t.children;Array.isArray(r)||L(59,n.name);let i=e.getChildren();for(let e=0;e<i.length;e++){let t=Tm(i[e]);r.push(t)}}let r=m_(e);if(r.length>0){let i={};for(let t of r){let r=h_(e,t);r===null&&L(366,n.name,t),i[t]=Tm(r)}t.$slots=i}return t}function Em(e){return e instanceof Dm}var Dm=class e{_nodeMap;_selection;_flushSync;_readOnly;_parsed;_slotsUsed;constructor(e,t=null,n=!1){this._nodeMap=e,this._selection=t||null,this._flushSync=!1,this._readOnly=!1,this._parsed=!1,this._slotsUsed=n}isEmpty(){return this._nodeMap.size===1&&this._selection===null}read(e,t){return lm(t&&t.editor||null,this,e)}clone(t){let n=new e(this._nodeMap,t===void 0?this._selection:t,this._slotsUsed);return n._readOnly=!0,n}toJSON(){return lm(null,this,()=>({root:Tm(wh())}))}},Om=class extends vm{$config(){return this.config(`artificial`,{extends:vm})}createDOM(e){return _g().createElement(`div`)}},km=class extends yf{$config(){return this.config(`linebreak`,{importDOM:{br:e=>Nm(e)||Pm(e)?null:{conversion:Am,priority:0}}})}getTextContent(){return`
|
|
154
154
|
`}createDOM(){return _g().createElement(`br`)}updateDOM(){return!1}isInline(){return!0}};function Am(e){return{node:jm()}}function jm(){return ag(new km)}function Mm(e){return e instanceof km}function Nm(e){let t=e.parentElement;if(t!==null&&Mg(t)){let n=t.firstChild;if(n===e||n.nextSibling===e&&Fm(n)){let n=t.lastChild;if(n===e||n.previousSibling===e&&Fm(n))return!0}}return!1}function Pm(e){let t=e.parentElement;if(t!==null&&Mg(t)){let n=t.firstChild;if(n===e||n.nextSibling===e&&Fm(n))return!1;let r=t.lastChild;if(r===e||r.previousSibling===e&&Fm(r))return!0}return!1}function Fm(e){return ch(e)&&/^( |\t|\r?\n)+$/.test(e.textContent||``)}var Im=class extends vm{$config(){return this.config(`paragraph`,{extends:vm,importDOM:{p:()=>({conversion:Lm,priority:0})}})}createDOM(e){let t=_g().createElement(`p`),n=Vh(e.theme,`paragraph`);return n!==void 0&&t.classList.add(...n),t}updateDOM(e,t,n){return!1}exportDOM(e){let{element:t}=super.exportDOM(e);if(Y(t)){this.isEmpty()&&t.append(_g().createElement(`br`));let e=this.getFormatType();e&&(t.style.textAlign=e)}return{element:t}}exportJSON(){let e=super.exportJSON();if(e.textFormat===void 0||e.textStyle===void 0){let t=this.getChildren().find(V);t?(e.textFormat=t.getFormat(),e.textStyle=t.getStyle()):(e.textFormat=this.getTextFormat(),e.textStyle=this.getTextStyle())}return e}insertNewAfter(e,t){let n=Rm();n.setTextFormat(e.format),n.setTextStyle(e.style);let r=this.getDirection();return n.setDirection(r),n.setFormat(this.getFormatType()),n.setStyle(this.getStyle()),this.insertAfter(n,t),n}collapseAtStart(){let e=this.getChildren();if(e.length===0||V(e[0])&&e[0].getTextContent().trim()===``){if(this.getNextSibling()!==null)return this.selectNext(),this.remove(),!0;if(this.getPreviousSibling()!==null)return this.selectPrevious(),this.remove(),!0}return!1}};function Lm(e){let t=Rm();if(Kg(t,e),Wg(e,t),t.getFormatType()===``){let n=e.getAttribute(`align`);n&&n&&n in dl&&t.setFormat(n)}return Gg(t,e),{node:t}}function Rm(){return ag(new Im)}function zm(e){return e instanceof Im}function Bm(e){console.warn(e)}function Vm(e,t,n,r,i){let a=e._keyToDOMMap;a.clear(),e._editorState=wm(),e._pendingEditorState=r,e._compositionKey=null,e._dirtyType=0,e._cloneNotNeeded.clear(),e._dirtyLeaves=/* @__PURE__ */ new Set,e._dirtyElements.clear(),e._normalizedNodes=/* @__PURE__ */ new Set,i&&i.preserveUpdateQueue||(e._updateTags=/* @__PURE__ */ new Set,e._updates=[],e._cascadeCount=0),e._blockCursorElement=null,e._inputState.handledSelectionCommandTimeoutId!==null&&clearTimeout(e._inputState.handledSelectionCommandTimeoutId),e._inputState={collapsedSelectionFormat:{format:0,key:`root`,offset:0,style:``,timeStamp:0},compositionEndData:``,compositionPhase:`idle`,hadOrphanedCompositionEvents:!1,handledSelectionCommandTimeoutId:null,isInsertLineBreak:!1,isInsertTextAfterHandledSelectionCommand:!1,isSelectionChangeFromDOMUpdate:!1,isSelectionChangeFromMouseDown:!1,lastBeforeInputInsertTextTimeStamp:0,lastKeyCode:null,lastKeyDownTimeStamp:0,postDeleteSelectionToRestore:null,unprocessedBeforeInputData:null};let o=e._observer;o!==null&&(o.disconnect(),e._observer=null),t!==null&&(t.textContent=``,function(e,t){let n=`__lexicalKey_${t._key}`;delete e[n]}(t,e)),n!==null&&(n.textContent=``,a.set(`root`,n),yh(n,e,`root`))}function Hm(e){let t=/* @__PURE__ */ new Set,n=/* @__PURE__ */ new Set;for(let{klass:r,ownNodeConfig:i}of t_(e)){let e=r.transform;if(!n.has(e)){n.add(e);let i=r.transform();i&&t.add(i)}if(i){let e=i.$transform;e&&t.add(e)}}return t}let Um={$createDOM:(e,t)=>e.createDOM(t._config,t),$decorateDOM:(e,t,n,r)=>{},$exportDOM:(e,t)=>{let n=$m(t,e.getType());return n&&n.exportDOM!==void 0?n.exportDOM(t,e):e.exportDOM(t)},$extractWithChild:(e,t,n,r,i)=>G(e)&&e.extractWithChild(t,n,r),$getDOMSlot:(e,t,n)=>e.getDOMSlot(t),$getSlotTargetElement:(e,t,n,r)=>null,$shouldExclude:(e,t,n)=>G(e)&&e.excludeFromCopy(`html`),$shouldInclude:(e,t,n)=>!t||e.isSelected(t),$updateDOM:(e,t,n,r)=>e.updateDOM(t,n,r._config)};function Wm(e){let t=e||{},n=im(),r=t.theme||{},i=e===void 0?n:t.parentEditor||null,a=t.disableEvents||!1,o=wm(),s=t.namespace||(i===null?Ah():i._config.namespace),c=t.editorState,l=[xm,Ff,km,Kf,Im,Om,...t.nodes||[]],{onError:u,onWarn:d,html:f}=t,p=t.editable===void 0||t.editable,m;if(e===void 0&&n!==null)m=n._nodes;else{m=/* @__PURE__ */ new Map;for(let e=0;e<l.length;e++){let n=l[e],r=null,i=null;if(n&&typeof n==`object`){let e=n;n=e.replace,r=e.with,i=e.withKlass||null}if(typeof n!=`function`||!n.prototype||!(n===yf||n.prototype instanceof yf)){let r=`<unknown>`;try{r=JSON.parse(Cl)}catch{}L(365,String(e-l.length+(t.nodes?t.nodes.length:0)),typeof n==`function`?`${n.name}${typeof n.getType==`function`?` (type ${String(n.getType())})`:``}`:String(n),String(r))}e_(n);let a=n.getType(),o=Hm(n);m.set(a,{exportDOM:f&&f.export?f.export.get(n):void 0,klass:n,replace:r,replaceWithKlass:i,sharedNodeState:Bl(l[e]),transforms:o})}}let h=new qm(o,i,m,{disableEvents:a,dom:{...Um,...e&&e.dom},namespace:s,theme:r},u||console.error,d||Bm,function(e,t){let n=/* @__PURE__ */ new Map,r=/* @__PURE__ */ new Set,i=e=>{Object.keys(e).forEach(t=>{let r=n.get(t);r===void 0&&(r=[],n.set(t,r)),r.push(e[t])})};return e.forEach(e=>{let t=e.klass.importDOM;if(t==null||r.has(t))return;r.add(t);let n=t.call(e.klass);n!==null&&i(n)}),t&&i(t),n}(m,f?f.import:void 0),p,e);return c!==void 0&&(h._pendingEditorState=c,h._dirtyType=2),function(e){e.registerCommand(Xu,tf,0),e.registerCommand(Zu,nf,0),e.registerCommand(Qu,rf,0),e.registerCommand($u,af,0),e.registerCommand(dd,cf,0)}(h),h}function Gm(e,t){let n=e.get(t);e.delete(t),n&&n()}function Km(e,t,n){return e.set(t,n),Gm.bind(null,e,t)}var qm=class{static version;_headless;_parentEditor;_rootElement;_editorState;_pendingEditorState;_compositionKey;_deferred;_keyToDOMMap;_updates;_updating;_cascadeCount;_listeners;_commands;_nodes;_decorators;_pendingDecorators;_config;_dirtyType;_cloneNotNeeded;_dirtyLeaves;_dirtyElements;_normalizedNodes;_updateTags;_observer;_key;_onError;_onWarn;_htmlConversions;_window;_editable;_blockCursorElement;_slotsUsed;_inputState;_createEditorArgs;constructor(e,t,n,r,i,a,o,s,c){this._createEditorArgs=c,this._parentEditor=t,this._rootElement=null,this._editorState=e,this._pendingEditorState=null,this._compositionKey=null,this._deferred=[],this._keyToDOMMap=new El,this._updates=[],this._updating=!1,this._cascadeCount=0,this._listeners={decorator:/* @__PURE__ */ new Map,editable:/* @__PURE__ */ new Map,mutation:/* @__PURE__ */ new Map,root:/* @__PURE__ */ new Map,textcontent:/* @__PURE__ */ new Map,update:/* @__PURE__ */ new Map},this._commands=/* @__PURE__ */ new Map,this._config=r,this._nodes=n,this._decorators={},this._pendingDecorators=null,this._dirtyType=0,this._cloneNotNeeded=/* @__PURE__ */ new Set,this._dirtyLeaves=/* @__PURE__ */ new Set,this._dirtyElements=/* @__PURE__ */ new Map,this._normalizedNodes=/* @__PURE__ */ new Set,this._updateTags=/* @__PURE__ */ new Set,this._observer=null,this._key=Ah(),this._onError=i,this._onWarn=a,this._htmlConversions=o,this._editable=s,this._headless=t!==null&&t._headless,this._window=null,this._blockCursorElement=null,this._slotsUsed=!1,this._inputState={collapsedSelectionFormat:{format:0,key:`root`,offset:0,style:``,timeStamp:0},compositionEndData:``,compositionPhase:`idle`,hadOrphanedCompositionEvents:!1,handledSelectionCommandTimeoutId:null,isInsertLineBreak:!1,isInsertTextAfterHandledSelectionCommand:!1,isSelectionChangeFromDOMUpdate:!1,isSelectionChangeFromMouseDown:!1,lastBeforeInputInsertTextTimeStamp:0,lastKeyCode:null,lastKeyDownTimeStamp:0,postDeleteSelectionToRestore:null,unprocessedBeforeInputData:null}}isComposing(){return this._compositionKey!=null}registerUpdateListener(e){return Km(this._listeners.update,e)}registerEditableListener(e){return Km(this._listeners.editable,e)}registerDecoratorListener(e){return Km(this._listeners.decorator,e)}registerTextContentListener(e){return Km(this._listeners.textcontent,e)}registerRootListener(e){let t=this._listeners.root;return kv(Km(t,e,e(this._rootElement,null)||void 0),()=>function(e,t,n){let r=e.get(t);r&&r(),e.set(t,t(...n)||void 0)}(t,e,[null,this._rootElement]))}registerCommand(e,t,n){n===void 0&&L(35);let r=this._commands;r.has(e)||r.set(e,[new wl,new wl,new wl,new wl,new wl]);let i=r.get(e);i===void 0&&L(36,String(e));let a=function(e){return 7&e}(n),o=i[a];return a===n?o.addBack(t):o.addFront(t),()=>{o.delete(t),i.every(e=>e.size===0)&&r.delete(e)}}registerMutationListener(e,t,n){let r=this.resolveRegisteredNodeAfterReplacements(this.getRegisteredNode(e)).klass,i=this._listeners.mutation,a=i.get(t);a===void 0&&(a=/* @__PURE__ */ new Set,i.set(t,a)),a.add(r);let o=n&&n.skipInitialization;return o!==void 0&&o||this.initializeMutationListener(t,r),()=>{a.delete(r),a.size===0&&i.delete(t)}}getRegisteredNode(e){let t=this._nodes.get(e.getType());return t===void 0&&L(37,e.name),t}resolveRegisteredNodeAfterReplacements(e){for(;e.replaceWithKlass;)e=this.getRegisteredNode(e.replaceWithKlass);return e}initializeMutationListener(e,t){let n=this._editorState,r=Vg(n).get(t.getType());if(!r)return;let i=/* @__PURE__ */ new Map;for(let e of r.keys())i.set(e,`created`);i.size>0&&e(i,{dirtyLeaves:/* @__PURE__ */ new Set,prevEditorState:n,updateTags:/* @__PURE__ */ new Set([`registerMutationListener`])})}registerNodeTransformToKlass(e,t){let n=this.getRegisteredNode(e);return n.transforms.add(t),n}registerNodeTransform(e,t){let n=this.registerNodeTransformToKlass(e,t),r=[n],i=n.replaceWithKlass;if(i!=null){let e=this.registerNodeTransformToKlass(i,t);r.push(e)}return function(e,t){let n=Vg(e.getEditorState()),r=[];for(let e of t){let t=n.get(e);t&&r.push(t)}r.length!==0&&e.update(()=>{for(let e of r)for(let t of e.keys()){let e=_h(t);e&&e.markDirty()}},e._pendingEditorState===null?{tag:xf}:void 0)}(this,r.map(e=>e.klass.getType())),()=>{r.forEach(e=>e.transforms.delete(t))}}hasNode(e){return this._nodes.has(e.getType())}hasNodes(e){return e.every(this.hasNode.bind(this))}dispatchCommand(e,...t){return J(this,e,...t)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(e){let t=this._rootElement;if(e!==t){let n=Vh(this._config.theme,`root`),r=this._pendingEditorState||this._editorState;if(this._rootElement=e,Vm(this,t,e,r,{preserveUpdateQueue:!0}),t!==null&&(this._config.disableEvents||mf(t),n!=null&&t.classList.remove(...n)),e!==null){let t=Qh(e),r=e.style;r.userSelect=`text`,r.whiteSpace=`pre-wrap`,r.wordBreak=`break-word`,e.setAttribute(`data-lexical-editor`,`true`),this._window=t,this._dirtyType=2,Ll(this),this._updateTags.add(xf),um(this),this._config.disableEvents||function(e,t){let n=e.ownerDocument;Hd.set(e,n);let r=Ud.get(n);r===void 0&&(r={editors:/* @__PURE__ */ new Set,hasShadowEditor:void 0},Ud.set(n,r)),r.editors.add(t),r.hasShadowEditor=void 0,e.__lexicalEditor=t;let i=lf(e);i.push(Wd.register(n));for(let n=0;n<Vd.length;n++){let[r,a]=Vd[n],o=typeof a==`function`?e=>{pf(e)||(ff(e),(t.isEditable()||r===`click`)&&a(e,t))}:e=>{if(pf(e))return;ff(e);let n=t.isEditable();switch(r){case`cut`:return n&&J(t,kd,e);case`copy`:return J(t,Od,e);case`paste`:return n&&J(t,id,e);case`dragstart`:return n&&J(t,Td,e);case`dragover`:return n&&J(t,Ed,e);case`dragend`:return n&&J(t,Dd,e);case`focus`:return n&&J(t,Fd,e);case`blur`:return n&&J(t,Id,e);case`drop`:return n&&J(t,wd,e)}};i.push(zd(e,r,o))}}(e,this),n!=null&&e.classList.add(...n)}else this._window=null,this._updateTags.add(xf),um(this);dm(`root`,this,!1,e,t)}}getElementByKey(e){return this._keyToDOMMap.get(e)||null}getEditorState(){return this._editorState}setEditorState(e,t){e.isEmpty()&&L(38);let n=e;n._readOnly&&(n=Cm(e),n._selection=e._selection?e._selection.clone():null),Il(this);let r=this._pendingEditorState,i=t===void 0?null:t.tag;r===null||r.isEmpty()||(i!=null&&this._updateTags.add(i),um(this)),this._pendingEditorState=n,this._dirtyType=2,this._dirtyElements.set(`root`,!1),this._compositionKey=null,this._slotsUsed=this._slotsUsed||e._slotsUsed,gm(this,()=>{if(i&&this._updateTags.add(i),e._parsed)for(let[e,t]of n._nodeMap.entries())G(t)?this._dirtyElements.set(e,!0):this._dirtyLeaves.add(e)},{discrete:!this._updating||void 0})}parseEditorState(e,t){return function(e,t,n){let r=wm(),i=Up,a=Gp,o=Wp,s=t._dirtyElements,c=t._dirtyLeaves,l=t._cloneNotNeeded,u=t._dirtyType;t._dirtyElements=/* @__PURE__ */ new Map,t._dirtyLeaves=/* @__PURE__ */ new Set,t._cloneNotNeeded=/* @__PURE__ */ new Set,t._dirtyType=0,Up=r,Gp=!1,Wp=t,Ym(null);try{let i=t._nodes;cm(e.root,i),n&&n(),r._readOnly=!0,r._parsed=!0}catch(e){e instanceof Error&&t._onError(e)}finally{t._dirtyElements=s,t._dirtyLeaves=c,t._cloneNotNeeded=l,t._dirtyType=u,Up=i,Gp=a,Wp=o}return r}(typeof e==`string`?JSON.parse(e):e,this,t)}read(...e){let[t,n]=e.length===1?[`force-commit`,e[0]]:e;return t===`force-commit`&&um(this),(t===`pending`?this._pendingEditorState||this._editorState:this.getEditorState()).read(n,{editor:this})}update(e,t){(function(e,t,n){e._updating?e._updates.push([t,n]):hm(e,t,n)})(this,e,t)}focus(e,t={}){let n=this._rootElement;n!==null&&(n.setAttribute(`autocapitalize`,`off`),gm(this,()=>{let r=U(),i=wh();r===null?i.getChildrenSize()!==0&&(t.defaultSelection===`rootStart`?i.selectStart():i.selectEnd()):r.dirty||Th(r.clone()),Yh(`focus`),Xh(()=>{n.removeAttribute(`autocapitalize`),e&&e()})}),this._pendingEditorState===null&&n.removeAttribute(`autocapitalize`))}blur(){let e=this._rootElement;e!==null&&e.blur();let t=ug(this._window);t!==null&&t.removeAllRanges()}isEditable(){return this._editable}setEditable(e){this._editable!==e&&(this._editable=e,dm(`editable`,this,!0,e),this._slotsUsed&&this.update(()=>nm()))}toJSON(){return{editorState:this._editorState.toJSON()}}};qm.version=Cl;let Jm=null;function Ym(e){Jm=e}let Xm=Symbol(`INTERNAL_SKIP_AFTER_CLONE_FROM`),Zm=1;function Qm(e,t){let n=$m(e,t);return n===void 0&&L(30,t),n}function $m(e,t){return e._nodes.get(t)}let eh=typeof queueMicrotask==`function`?queueMicrotask:e=>{Promise.resolve().then(e)};function th(e,t){let n=t===void 0?(()=>{let t=e.getRootNode();return lh(t)||fg(t)?Tg(t):null})():t;if(!Y(n)||n.hasAttribute(`data-lexical-slot`))return!1;let r=xh(n),i=n.nodeName;return bf(r)&&(i===`INPUT`||i===`TEXTAREA`||n.contentEditable===`true`&&ah(n)==null)}function nh(e,t,n){let r=e.getRootElement();if(!r)return!1;try{if(!t||!r.contains(t)||!r.contains(n))return!1}catch{return!1}return ih(t)===e&&e.read(`latest`,()=>!th(t))}function rh(e){return e instanceof qm}function ih(e){let t=e;for(;t!=null;){let e=ah(t);if(rh(e))return e;t=qh(t)}return null}function ah(e){return e?e.__lexicalEditor:null}function oh(e){return Jf(e)||e.isToken()}function sh(e){return oh(e)||e.isSegmented()}function ch(e){return Dg(e)&&e.nodeType===3}function lh(e){return Dg(e)&&e.nodeType===9}function uh(e){let t=e;for(;t!=null;){if(ch(t))return t;t=t.firstChild}return null}function dh(e,t,n){let r=ll[t];if(n!==null&&(e&r)===(n&r))return e;let i=e^r;return t===`subscript`?i&=~ll.superscript:t===`superscript`?i&=~ll.subscript:t===`lowercase`?(i&=~ll.uppercase,i&=~ll.capitalize):t===`uppercase`?(i&=~ll.lowercase,i&=~ll.capitalize):t===`capitalize`&&(i&=~ll.lowercase,i&=~ll.uppercase),i}function fh(e,t){let n=function(){let e=Jm;return Jm=null,e}();if((t||=n&&n.__key)!=null)return void(e.__key=t);Qp(),$p();let r=W(),i=em(),a=``+Zm++;i._nodeMap.set(a,e),G(e)?r._dirtyElements.set(a,!0):r._dirtyLeaves.add(a),r._cloneNotNeeded.add(a),r._dirtyType===0&&(r._dirtyType=1),e.__key=a}function ph(e){l_(e)!==null&&L(380,e.__key,String(l_(e)));let t=e.getParent();if(t!==null){let n=e.getWritable(),r=t.getWritable(),i=e.getPreviousSibling(),a=e.getNextSibling(),o=a===null?null:a.__key,s=i===null?null:i.__key,c=i===null?null:i.getWritable(),l=a===null?null:a.getWritable();i===null&&(r.__first=o),a===null&&(r.__last=s),c!==null&&(c.__next=o),l!==null&&(l.__prev=s),n.__prev=null,n.__next=null,n.__parent=null,r.__size--}}function mh(e){$p(),_f(e)&&L(323,e.__key,e.__type);let t=e.getLatest(),n=t.__parent===null?c_(t)?t.__slotHost:null:t.__parent,r=em(),i=W(),a=r._nodeMap,o=i._dirtyElements;n!==null&&function(e,t,n){let r=e;for(;r!==null;){if(n.has(r))return;let e=t.get(r);if(e===void 0)break;n.set(r,!1),r=e.__parent===null?c_(e)?e.__slotHost:null:e.__parent}}(n,a,o);let s=t.__key;i._dirtyType===0&&(i._dirtyType=1),G(e)?o.set(s,!0):i._dirtyLeaves.add(s)}function hh(e){Qp();let t=W(),n=t._compositionKey;if(e!==n){if(t._compositionKey=e,n!==null){let e=_h(n);e!==null&&e.getWritable()}if(e!==null){let t=_h(e);t!==null&&t.getWritable()}}}function gh(){return Zp()?null:W()._compositionKey}function _h(e,t){let n=(t||em())._nodeMap.get(e);return n===void 0?null:n}function vh(e,t){let n=bh(e,W());return n===void 0?null:_h(n,t)}function yh(e,t,n){e[`__lexicalKey_${t._key}`]=n}function bh(e,t){return e[`__lexicalKey_${t._key}`]}function xh(e,t){let n=e;for(;n!=null;){let e=vh(n,t);if(e!==null)return e;n=qh(n)}return null}function Sh(e){let t=e._decorators,n=Object.assign({},t);return e._pendingDecorators=n,n}function Ch(e){return e.read(()=>wh().getTextContent())}function wh(){return em()._nodeMap.get(`root`)}function Th(e){Qp();let t=em();e!==null&&(e.dirty=!0,e.setCachedNodes(null),H(e)&&W()._slotsUsed&&bp(e)),t._selection=e}function Eh(){Qp(),Il(W())}function Dh(e){let t=function(e,t){let n=e;for(;n!=null;){let e=bh(n,t);if(e!==void 0)return e;n=qh(n)}return null}(e,W());return t===null?null:_h(t)}function Oh(e){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(e)}function kh(e){let t=[];for(let n=e;n!==null;n=n._parentEditor)t.push(n);return t}function Ah(){return Math.random().toString(36).replace(/[^a-z]+/g,``).substring(0,5)}function jh(e){return ch(e)?e.nodeValue:null}function Mh(e,t,n){let r=ug($h(t));if(r===null)return;let i=bg(r,t._rootElement),a=i.anchorNode,{anchorOffset:o,focusOffset:s}=i;if(a!==null){let t=jh(a),r=xh(a);if(t!==null&&V(r)){if((t===al||t===ol)&&n){let e=n.length;t=n,o=e,s=e}t!==null&&Nh(r,t,o,s,e)}}}function Nh(e,t,n,r,i){let a=e;if(a.isAttached()&&(i||!a.isDirty())){let o=a.isComposing();if(a.isToken()&&o)return;let s=t;if((o||i)&&(t.endsWith(al)&&(s=t.slice(0,-al.length)),i)){let e=ol,t;for(;(t=s.indexOf(e))!==-1;)s=s.slice(0,t)+s.slice(t+e.length),n!==null&&n>t&&(n=Math.max(t,n-e.length)),r!==null&&r>t&&(r=Math.max(t,r-e.length))}let c=a.getTextContent();if(i||s!==c){let t=U();if(s===``){if(hh(null),tl||$c||il)a.remove();else{let e=W();Ph(a,``,t),setTimeout(()=>{e.update(()=>{a.isAttached()&&a.getTextContent()===``&&a.remove()})},20)}return}let i=a.getParent(),c=Dp(),l=a.getTextContentSize(),u=gh(),d=a.getKey();if(a.isToken()&&!o||u!==null&&d===u&&!o||H(c)&&(i!==null&&!i.canInsertTextBefore()&&c.anchor.offset===0||c.anchor.key===e.__key&&c.anchor.offset===0&&!a.canInsertTextBefore()&&!o||c.focus.key===e.__key&&c.focus.offset===l&&!a.canInsertTextAfter()&&!o))return void a.markDirty();if(!H(t)||n===null||r===null)return void Ph(a,s,t);if(t.setTextNodeRange(a,n,a,r),a.isSegmented()){let e=Wf(a.getTextContent());a.replace(e),a=e}Ph(a,s,t)}}}function Ph(e,t,n){if(e.setTextContent(t),H(n)){let t=e.getKey(),r=!1;for(let i of[`anchor`,`focus`]){let a=n[i];a.type===`text`&&a.key===t&&(a.offset=W_(e,a.offset,`clamp`),r=!0)}r&&(n._cachedNodes=null,n._cachedIsBackward=null)}}function Fh(e,t,n){let r=t[n]||!1;return r===`any`||r===e[n]}function Ih(e,t){return Fh(e,t,`altKey`)&&Fh(e,t,`ctrlKey`)&&Fh(e,t,`shiftKey`)&&Fh(e,t,`metaKey`)}function q(e,t,n){if(!Ih(e,n))return!1;if(e.key.toLowerCase()===t.toLowerCase())return!0;if(t.length>1||e.key.length===1&&e.key.charCodeAt(0)<=127)return!1;if(e.code.startsWith(`Digit`)&&/^\d$/.test(t))return e.code===`Digit${t}`;let r=`Key`+t.toUpperCase();return e.code===r}let Lh={ctrlKey:!Xc,metaKey:Xc},Rh={altKey:Xc,ctrlKey:!Xc};function zh(e){return e.key===`Backspace`}function Bh(e){let t=wh();if(H(e)){let t=e.anchor,n=e.focus,r=t.getNode();if(Sm(r))return t.set(r.getKey(),0,`element`),n.set(r.getKey(),r.getChildrenSize(),`element`),$l(e),e;let i=r.getTopLevelElementOrThrow(),a=i.getParent();if(a===null)return G(i)&&(t.set(i.getKey(),0,`element`),n.set(i.getKey(),i.getChildrenSize(),`element`),$l(e)),e;let o=a;return t.set(o.getKey(),0,`element`),n.set(o.getKey(),o.getChildrenSize(),`element`),$l(e),e}{let e=t.select(0,t.getChildrenSize());return Th($l(e)),e}}function Vh(e,t){e.__lexicalClassNameCache===void 0&&(e.__lexicalClassNameCache={});let n=e.__lexicalClassNameCache,r=n[t];if(r!==void 0)return r;let i=e[t];if(typeof i==`string`){let e=Dv(i);return n[t]=e,e}return i}function Hh(e,t,n,r,i){if(n.size===0)return;let a=r.__type,o=r.__key,s=t.get(a);s===void 0&&L(33,a);let c=s.klass,l=e.get(c);l===void 0&&(l=/* @__PURE__ */ new Map,e.set(c,l));let u=l.get(o),d=u===`destroyed`&&i===`created`;(u===void 0||d)&&l.set(o,d?`updated`:i)}function Uh(e,t,n){let r=e.getParent(),i=n,a=e;return r!==null&&(t&&n===0?(i=a.getIndexWithinParent(),a=r):t||n!==a.getChildrenSize()||(i=a.getIndexWithinParent()+1,a=r)),a.getChildAtIndex(t?i-1:i)}function Wh(e,t){let n=e.offset;if(e.type===`element`)return Uh(e.getNode(),t,n);{let r=e.getNode();if(t&&n===0||!t&&n===r.getTextContentSize()){let e=t?r.getPreviousSibling():r.getNextSibling();return e===null?Uh(r.getParentOrThrow(),t,r.getIndexWithinParent()+ +!t):e}}return null}function Gh(e){let t=$h(e).event,n=t&&t.inputType;return n===`insertFromPaste`||n===`insertFromPasteAsQuotation`}function J(e,t,...n){return fm(e,t,n[0],e)}function Kh(e,t){let n=e._keyToDOMMap.get(t);return n===void 0&&L(75,t),n}function qh(e){let t=e.assignedSlot||e.parentElement;if(t!==null)return t;let n=e.parentNode;return fg(n)?n.host:null}function Jh(e){return lh(e)?e:Y(e)?e.ownerDocument:null}function Yh(e){Qp(),W()._updateTags.add(e)}function Xh(e){Qp(),W()._deferred.push(e)}function Zh(e,t){let n=e.getParent();for(;n!==null;){if(n.is(t))return!0;n=n.getParent()}return!1}function Qh(e){let t=Jh(e);return t?t.defaultView:null}function $h(e){let t=e._window;return t===null&&L(78),t}function eg(e){return G(e)&&e.isInline()||K(e)&&e.isInline()}function tg(e){let t=e.getLatest();for(;t!==null;){if(l_(t)!==null&&G(t))return t;let e=t.getParentOrThrow();if(rg(e))return e;t=e}return t}function ng(e){return G(e)&&e.isShadowRoot()}function rg(e){return Sm(e)||ng(e)}function ig(e,t=!1){let n=e.constructor.clone(e,Xm);return fh(n,null),n.afterCloneFrom(e),t||n.resetOnCopyNodeFrom(e),n}function ag(e){let t=W(),n=e.getType(),r=$m(t,n);r===void 0&&L(200,e.constructor.name,n);let{replace:i,replaceWithKlass:a}=r;if(i!==null){let t=i(e),r=t.constructor;return a===null?t instanceof e.constructor&&r!==e.constructor||L(202,r.name,r.getType(),e.constructor.name,n):t instanceof a||L(201,a.name,a.getType(),r.name,r.getType(),e.constructor.name,n),t.__key===e.__key&&L(203,e.constructor.name,n,r.name,r.getType()),t}return e}function og(e,t){!Sm(e.getParent())||G(t)||K(t)||L(99)}function sg(e){let t=_h(e);return t===null&&L(63,e),t}function cg(e){if(!e||e.isInline())return!1;if(K(e))return!0;if(G(e)){if(e.isShadowRoot()){let t=e.getParent();return!(G(t)&&t.isShadowRoot())}return!e.canBeEmpty()}return!1}function lg(e,t,n){n.style.removeProperty(`caret-color`),t._blockCursorElement=null;let r=e.parentElement;r!==null&&r.removeChild(e)}function ug(e){return Jc?(e||window).getSelection():null}function dg(e){let t=Qh(e);return t?t.getSelection():null}function fg(e){return Og(e)&&`host`in e}let pg=[];function mg(e){let t=e.getRootNode();if(t===e||!fg(t))return pg;let n=[t],r=t.host;for(;;){let e=r.getRootNode();if(e===r||!fg(e))break;n.push(e),r=e.host}return n}function*hg(e){let t=[e],n;for(;n=t.pop();){yield*n.querySelectorAll(`[data-lexical-editor="true"]`);let e=(lh(n)?n:n.ownerDocument).createTreeWalker(n,NodeFilter.SHOW_ELEMENT),r;for(;r=e.nextNode();)r.shadowRoot&&t.push(r.shadowRoot)}}function gg(e){return e===null?document:e.ownerDocument}function _g(){let e=im();return gg(e===null?null:e._rootElement)}function vg(e,t){if(t===null||typeof e.getComposedRanges!=`function`)return null;let n=mg(t);if(n.length===0)return null;let r=e.getComposedRanges;try{let t=r.call(e,{shadowRoots:n})[0];if(t!==void 0)return t}catch{}try{let t=r.apply(e,n)[0];if(t!==void 0)return t}catch{}return null}function yg(e,t){let n=vg(e,t);if(n!==null){let e=xg(n);if(e!==null)return e}return e.rangeCount>0?e.getRangeAt(0):null}function bg(e,t){let n=vg(e,t);return n===null?e:Sg(n,Cg(e))}function xg(e){let t=e.startContainer.ownerDocument;if(t===null)return null;let n=t.createRange();try{return n.setStart(e.startContainer,e.startOffset),n.setEnd(e.endContainer,e.endOffset),n}catch{return null}}function Sg(e,t){let{startContainer:n,startOffset:r,endContainer:i,endOffset:a}=e;return t===`backward`?{anchorNode:i,anchorOffset:a,direction:t,focusNode:n,focusOffset:r}:{anchorNode:n,anchorOffset:r,direction:t,focusNode:i,focusOffset:a}}function Cg(e){return e.direction}function wg(e){let t=e.getRootNode();return lh(t)||fg(t)?t.activeElement:null}function Tg(e){let t=e.activeElement;for(;t!==null&&t.shadowRoot!==null;){let e=t.shadowRoot.activeElement;if(e===null)break;t=e}return t}function Eg(e){let t=e.target;if(t!==null&&Y(t)&&t.shadowRoot!==null&&typeof e.composedPath==`function`){let t=e.composedPath();if(t.length>0)return t[0]}return t}function Y(e){return Dg(e)&&e.nodeType===1}function Dg(e){return typeof e==`object`&&!!e&&`nodeType`in e&&typeof e.nodeType==`number`}function Og(e){return Dg(e)&&e.nodeType===11}let kg=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|mark|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var|#text)$/i;function Ag(e){return!(!Y(e)||!e.style.display.startsWith(`inline`))||kg.test(e.nodeName)}let jg=/^(address|article|aside|blockquote|canvas|dd|div|dl|dt|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hr|li|main|nav|noscript|ol|p|pre|section|table|td|tfoot|ul|video)$/i;function Mg(e){return(!Y(e)||!e.style.display.startsWith(`inline`))&&jg.test(e.nodeName)}function Ng(e){if(K(e)&&!e.isInline())return!0;if(!G(e)||rg(e))return!1;let t=e.getFirstChild(),n=t===null||Mm(t)||V(t)||t.isInline();return!e.isInline()&&!1!==e.canBeEmpty()&&n}function Pg(){return W()}function Fg(e=Pg()){return e._config.dom||Um}function Ig(e,t,n=Pg()){let r=Fg(n).$getDOMSlot(e,t,n);return G(e)&&(Lg(r)||L(344,e.getKey(),e.getType())),r}function Lg(e){return e instanceof bl}function Rg(e,t,n=Pg()){return uh(Ig(e,t,n).element)}let zg=/* @__PURE__ */ new WeakMap,Bg=/* @__PURE__ */ new Map;function Vg(e){if(!e._readOnly&&e.isEmpty())return Bg;e._readOnly||L(192);let t=zg.get(e);return t||(t=function(e){let t=/* @__PURE__ */ new Map;for(let[n,r]of e._nodeMap){let e=r.__type,i=t.get(e);i||(i=/* @__PURE__ */ new Map,t.set(e,i)),i.set(n,r)}return t}(e),zg.set(e,t)),t}function Hg(e){let t=e.constructor.clone(e,Xm);return t.afterCloneFrom(e),t}function Ug(e){return(t=Hg(e))[gf]=!0,t;var t}function Wg(e,t){let n=e.getAttribute(`data-lexical-indent`);if(n!==null){let e=parseInt(n,10);if(Number.isFinite(e)&&e>=0)return void t.setIndent(e)}let r=parseInt(e.style.paddingInlineStart,10)||0,i=Math.round(r/40);t.setIndent(i)}function Gg(e,t){let n=t.getAttribute(`dir`);return n===`ltr`||n===`rtl`?e.setDirection(n):e}function Kg(e,t){let n=t.style.textAlign;return n&&n in dl?e.setFormat(n):e}function qg(e,t){e.__lexicalUnmanaged=!0,t&&t.captureSelection!==void 0&&(e.__lexicalCapturedSelection=t.captureSelection)}function Jg(e){return!0===e.__lexicalUnmanaged}function Yg(e,t=Pg()){let n=t.isEditable();e.contentEditable=n?`true`:`false`,n?e.__lexicalEditor=t:delete e.__lexicalEditor}function Xg(e,t){let n=e;for(;n!=null;){if(!0===n.__lexicalCapturedSelection)return!0;if(Y(n)&&n.hasAttribute(`data-lexical-slot`)||bh(n,t)!==void 0)return!1;n=qh(n)}return!1}function Zg(e,t){return function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}(e,t)&&e[t]!==yf[t]}let Qg=/* @__PURE__ */ new WeakMap,$g=Symbol(`lexical.synthesizedGetType`);function e_(e){let t=Qg.get(e);if(t)return t;let n=e.prototype!=null&&hl in e.prototype?e.prototype[hl]():void 0,r=function(e){if(!(e===yf||e.prototype instanceof yf)){let t=`<unknown>`,n=`<unknown>`;try{t=e.getType()}catch{}try{qm.version&&(n=JSON.parse(qm.version))}catch{}L(290,e.name,t,n)}return e===bm||e===vm||e===yf}(e),i=!r&&Zg(e,`getType`)?e.getType:void 0,a=i&&!($g in i)?i.call(e):void 0,o,s=a;if(n){if(a)o=n[a];else{for(let[e,t]of Object.entries(n))s=e,o=t;if(!o)for(let e of Object.getOwnPropertySymbols(n)){let t=n[e];if(t){o=t;break}}}}if(!r&&s){if(!Zg(e,`getType`)){let t=e,n=function(){return this===t?s:yf.getType.call(this)};n[$g]=!0,e.getType=n}if(Zg(e,`clone`)||(e.clone=(t,n)=>{Ym(t);let r=new e;return n!==Xm&&r.afterCloneFrom(t),r}),Zg(e,`importJSON`)||(e.importJSON=o&&o.$importJSON||(t=>new e().updateFromJSON(t))),!Zg(e,`importDOM`)&&o){let{importDOM:t}=o;t&&(e.importDOM=()=>t)}}let c={klass:e,ownNodeConfig:o,ownNodeType:s};return Qg.set(e,c),c}function*t_(e){for(let t=e;t&&(t===yf||bf(t.prototype));){let e=e_(t);yield e,t=e.ownNodeConfig&&e.ownNodeConfig.extends||a_(t)}}function n_(e){let t=Pg();return Qp(),new(t.resolveRegisteredNodeAfterReplacements(t.getRegisteredNode(e))).klass}let r_=(e,t)=>{let n=e;for(;n!=null&&!Sm(n);){if(t(n))return n;n=n.getParent()}return null};function i_(e,t){let n=[],r=e.__first;for(;r!==null;){let e=t===null?_h(r):t.get(r);e??L(174),n.push(r),r=e.__next}return n}function a_(e){let t=Object.getPrototypeOf(e);if(typeof t==`function`&&t!==Function.prototype)return t;let n=e.prototype&&Object.getPrototypeOf(e.prototype);return n?n.constructor:null}let o_=/* @__PURE__ */ new Map;function s_(e){return G(e)||K(e)}function c_(e){return G(e)||K(e)}function l_(e){let t=e.getLatest();return c_(t)?t.__slotHost:null}function u_(e){let t=l_(e);if(t===null)return null;let n=_h(t);return G(n)||K(n)||L(370),n}function d_(e){let t=u_(e);if(t===null)return null;let n=e.getLatest().__key;for(let[e,r]of p_(t))if(r===n)return e;return null}function f_(e){let t=e.getLatest();for(;t!==null;){if(l_(t)!==null)return t;t=t.getParent()}return null}function p_(e){let t=e.getLatest();return s_(t)&&t.__slots!==null?t.__slots:o_}function m_(e){return Array.from(p_(e).keys())}function h_(e,t){let n=p_(e).get(t);return n===void 0?null:_h(n)}let g_=[`__proto__`,`constructor`,`prototype`],__=Symbol(`slotMapOwner`);function v_(e){let t=e.__slots;return t!==null&&t[__]===e||(t=new Map(t),t[__]=e,e.__slots=t),t}let y_=/* @__PURE__ */ new WeakMap,b_=[];function x_(e){for(let{ownNodeConfig:t}of t_(e)){let e=t&&t.slots;if(e)return e}return b_}function S_(e){let t=``;for(let n of m_(e)){let r=h_(e,n);r!==null&&(t+=r.getTextContent())}return t}function C_(e,t,n){let r=n.get(e),i=n.get(t);return r===void 0?i===void 0?e<t?-1:+(e>t):1:i===void 0?-1:r-i}function w_(e){let t=e.__slots;if(t===null||t.size<2)return;let n=function(e){let t=y_.get(e);if(t===void 0){let n=x_(e),r=/* @__PURE__ */ new Map;for(let t of n)g_.includes(t)&&L(371,e.name,t),r.has(t)&&L(372,e.name,t),r.set(t,r.size);t=r,y_.set(e,t)}return t}(e.constructor),r=null,i=!0;for(let e of t.keys()){if(r!==null&&C_(r,e,n)>0){i=!1;break}r=e}if(i)return;let a=Array.from(t).sort(([e],[t])=>C_(e,t,n));t.clear();for(let[e,n]of a)t.set(e,n)}function T_(e,t,n){t!==`__proto__`&&t!==`constructor`&&t!==`prototype`||L(373,t);let r=e.getLatest();if(r.__slots!==null&&r.__slots.get(t)===n.getLatest().__key)return r;(!G(n)&&!K(n)||n.isInline())&&L(374,n.__key);let i=e.getWritable(),a=v_(i),o=a.get(t);o!==void 0&&D_(o);let s=n.getWritable(),c=u_(s);if(c!==null){let e=d_(s);e!==null&&v_(c.getWritable()).delete(e),s.__slotHost=null}return ph(s),s.__slotHost=i.__key,a.set(t,s.__key),w_(i),function(){let e=Pg();e._slotsUsed=!0,e._pendingEditorState&&(e._pendingEditorState._slotsUsed=!0)}(),i}function E_(e,t){let n=e.getWritable();if(n.__slots===null)return n;let r=n.__slots.get(t);return r!==void 0&&(D_(r),v_(n).delete(t)),n}function D_(e){let t=_h(e);if(t===null)return;let n=t.getWritable();c_(n)||L(377,e),n.__slotHost=null,n.remove()}let O_={next:`previous`,previous:`next`};var k_=class{origin;constructor(e){this.origin=e}[Symbol.iterator](){return ev({hasNext:L_,initial:this.getAdjacentCaret(),map:e=>e,step:e=>e.getAdjacentCaret()})}getAdjacentCaret(){return H_(this.getNodeAtCaret(),this.direction)}getSiblingCaret(){return H_(this.origin,this.direction)}remove(){let e=this.getNodeAtCaret();return e&&e.remove(),this}replaceOrInsert(e,t){let n=this.getNodeAtCaret();return e.is(this.origin)||e.is(n)||(n===null?this.insert(e):n.replace(e,t)),this}splice(e,t,n=`next`){let r=n===this.direction?t:Array.from(t).reverse(),i=this,a=this.getParentAtCaret(),o=/* @__PURE__ */ new Map;for(let t=i.getAdjacentCaret();t!==null&&o.size<e;t=t.getAdjacentCaret()){let e=t.origin.getWritable();o.set(e.getKey(),e)}for(let e of r){if(o.size>0){let t=i.getNodeAtCaret();if(t){if(o.delete(t.getKey()),o.delete(e.getKey()),!(t.is(e)||i.origin.is(e))){let n=e.getParent();n&&n.is(a)&&e.remove(),t.replace(e)}}else t===null&&L(263,Array.from(o).join(` `))}else i.insert(e);i=H_(e,this.direction)}for(let e of o.values())e.remove();return this}},A_=class e extends k_{type=`child`;getLatest(){let e=this.origin.getLatest();return e===this.origin?this:K_(e,this.direction)}getParentCaret(e=`root`){return H_(N_(this.getParentAtCaret(),e),this.direction)}getFlipped(){let e=M_(this.direction);return H_(this.getNodeAtCaret(),e)||K_(this.origin,e)}getParentAtCaret(){return this.origin}getChildCaret(){return this}isSameNodeCaret(t){return t instanceof e&&this.direction===t.direction&&this.origin.is(t.origin)}isSamePointCaret(e){return this.isSameNodeCaret(e)}};let j_={root:Sm,shadowRoot:rg};function M_(e){return O_[e]}function N_(e,t=`root`){return e===null||j_[t](e)?null:l_(e)===null?e:null}var P_=class e extends k_{type=`sibling`;getLatest(){let e=this.origin.getLatest();return e===this.origin?this:H_(e,this.direction)}getSiblingCaret(){return this}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return G(this.origin)?K_(this.origin,this.direction):null}getParentCaret(e=`root`){return H_(N_(this.getParentAtCaret(),e),this.direction)}getFlipped(){let e=M_(this.direction);return H_(this.getNodeAtCaret(),e)||K_(this.origin.getParentOrThrow(),e)}isSamePointCaret(t){return t instanceof e&&this.direction===t.direction&&this.origin.is(t.origin)}isSameNodeCaret(t){return(t instanceof e||t instanceof F_)&&this.direction===t.direction&&this.origin.is(t.origin)}},F_=class e extends k_{type=`text`;offset;constructor(e,t){super(e),this.offset=t}getLatest(){let e=this.origin.getLatest();return e===this.origin?this:U_(e,this.direction,this.offset)}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return null}getParentCaret(e=`root`){return H_(N_(this.getParentAtCaret(),e),this.direction)}getFlipped(){return U_(this.origin,M_(this.direction),this.offset)}isSamePointCaret(t){return t instanceof e&&this.direction===t.direction&&this.origin.is(t.origin)&&this.offset===t.offset}isSameNodeCaret(t){return(t instanceof P_||t instanceof e)&&this.direction===t.direction&&this.origin.is(t.origin)}getSiblingCaret(){return H_(this.origin,this.direction)}};function I_(e){return e instanceof F_}function L_(e){return e instanceof P_}function R_(e){return e instanceof A_}let z_={next:class extends F_{direction=`next`;getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends F_{direction=`previous`;getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},B_={next:class extends P_{direction=`next`;getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends P_{direction=`previous`;getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},V_={next:class extends A_{direction=`next`;getNodeAtCaret(){return this.origin.getFirstChild()}insert(e){return this.origin.splice(0,0,[e]),this}},previous:class extends A_{direction=`previous`;getNodeAtCaret(){return this.origin.getLastChild()}insert(e){return this.origin.splice(this.origin.getChildrenSize(),0,[e]),this}}};function H_(e,t){return e?new B_[t](e):null}function U_(e,t,n){return e?new z_[t](e,W_(e,n)):null}function W_(e,t,n=`error`){let r=e.getTextContentSize(),i=t===`next`?r:t===`previous`?0:t;return(i<0||i>r)&&(n!==`clamp`&&qc(284,String(t),String(r),e.getKey()),i=i<0?0:r),i}function G_(e,t){return new X_(e,t)}function K_(e,t){return G(e)?new V_[t](e):null}function q_(e){return e&&e.getChildCaret()||e}function J_(e){return e&&q_(e.getAdjacentCaret())}var Y_=class e{type=`node-caret-range`;direction;anchor;focus;constructor(e,t,n){this.anchor=e,this.focus=t,this.direction=n}getLatest(){let t=this.anchor.getLatest(),n=this.focus.getLatest();return t===this.anchor&&n===this.focus?this:new e(t,n,this.direction)}isCollapsed(){return this.anchor.isSamePointCaret(this.focus)}getTextSlices(){let e=e=>{let t=this[e].getLatest();return I_(t)?function(e,t){let{direction:n,origin:r}=e;return G_(e,W_(r,t===`focus`?M_(n):n)-e.offset)}(t,e):null},t=e(`anchor`),n=e(`focus`);if(t&&n){let{caret:e}=t,{caret:r}=n;if(e.isSameNodeCaret(r))return[G_(e,r.offset-e.offset),null]}return[t,n]}iterNodeCarets(e=`root`){let t=I_(this.anchor)?this.anchor.getSiblingCaret():this.anchor.getLatest(),n=this.focus.getLatest(),r=I_(n),i=t=>t.isSameNodeCaret(n)?null:J_(t)||t.getParentCaret(e);return ev({hasNext:e=>e!==null&&!(r&&n.isSameNodeCaret(e)),initial:t.isSameNodeCaret(n)?null:i(t),map:e=>e,step:i})}[Symbol.iterator](){return this.iterNodeCarets(`root`)}},X_=class{type=`slice`;caret;distance;constructor(e,t){this.caret=e,this.distance=t}getSliceIndices(){let{distance:e,caret:{offset:t}}=this,n=t+e;return n<t?[n,t]:[t,n]}getTextContent(){let[e,t]=this.getSliceIndices();return this.caret.origin.getTextContent().slice(e,t)}getTextContentSize(){return Math.abs(this.distance)}removeTextSlice(){let{caret:{origin:e,direction:t}}=this,[n,r]=this.getSliceIndices(),i=e.getTextContent();return U_(e.setTextContent(i.slice(0,n)+i.slice(r)),t,n)}};function Z_(e){return $_(e,H_(wh(),e.direction))}function Q_(e){return $_(e,e)}function $_(e,t){return e.direction!==t.direction&&L(265),new Y_(e,t,e.direction)}function ev(e){let{initial:t,hasNext:n,step:r,map:i}=e,a=t;return{[Symbol.iterator](){return this},next(){if(!n(a))return{done:!0,value:void 0};let e={done:!1,value:i(a)};return a=r(a),e}}}function tv(e,t){let n=av(e.origin,t.origin);switch(n===null&&L(275,e.origin.getKey(),t.origin.getKey()),n.type){case`same`:{let n=e.type===`text`,r=t.type===`text`;return n&&r?function(e,t){return Math.sign(e-t)}(e.offset,t.offset):e.type===t.type?0:n?-1:r?1:e.type===`child`?-1:1}case`ancestor`:return e.type===`child`?-1:1;case`descendant`:return t.type===`child`?1:-1;case`branch`:return nv(n)}}function nv(e){let{a:t,b:n}=e,r=t.__key,i=n.__key,a=t,o=n;for(;a&&o;a=a.getNextSibling(),o=o.getNextSibling()){if(a.__key===i)return-1;if(o.__key===r)return 1}return a===null?1:-1}function rv(e,t){return t.is(e)}function iv(e){return G(e)?[e.getLatest(),null]:[e.getParent(),e.getLatest()]}function av(e,t){if(e.is(t))return{commonAncestor:e,type:`same`};let n=/* @__PURE__ */ new Map;for(let[t,r]=iv(e);t;r=t,t=t.getParent())n.set(t,r);for(let[r,i]=iv(t);r;i=r,r=r.getParent()){let a=n.get(r);if(a!==void 0)return a===null?(rv(e,r)||L(276),{commonAncestor:r,type:`ancestor`}):i===null?(rv(t,r)||L(277),{commonAncestor:r,type:`descendant`}):((G(a)||rv(e,a))&&(G(i)||rv(t,i))&&r.is(a.getParent())&&r.is(i.getParent())||L(278),{a,b:i,commonAncestor:r,type:`branch`})}return null}function ov(e,t){let{type:n,key:r,offset:i}=e,a=sg(e.key);return n===`text`?(V(a)||L(266,a.getType(),r),U_(a,t,i)):(G(a)||L(267,a.getType(),r),yv(a,e.offset,t))}function sv(e,t){let{origin:n,direction:r}=t,i=r===`next`;I_(t)?e.set(n.getKey(),t.offset,`text`):L_(t)?V(n)?e.set(n.getKey(),W_(n,r),`text`):e.set(n.getParentOrThrow().getKey(),n.getIndexWithinParent()+ +!!i,`element`):(R_(t)&&G(n)||L(268),e.set(n.getKey(),i?0:n.getChildrenSize(),`element`))}function cv(e){let t=U(),n=H(t)?t:wp();return lv(n,e),Th(n),n}function lv(e,t){sv(e.anchor,t.anchor),sv(e.focus,t.focus)}function uv(e){let{anchor:t,focus:n}=e,r=ov(t,`next`),i=ov(n,`next`),a=tv(r,i)<=0?`next`:`previous`;return $_(_v(r,a),_v(i,a))}function dv(e){let{direction:t,origin:n}=e,r=H_(n,M_(t)).getNodeAtCaret();return r?H_(r,t):K_(n.getParentOrThrow(),t)}function fv(e,t=`root`){let n=[e];for(let r=R_(e)?e.getParentCaret(t):e.getSiblingCaret();r!==null;r=r.getParentCaret(t))n.push(dv(r));return n}function pv(e){return!!e&&e.origin.isAttached()}function mv(e,t=`removeEmptySlices`){if(e.isCollapsed())return e;let n=`root`,r=`next`,i=t,a=vv(e,r),o=fv(a.anchor,n),s=fv(a.focus.getFlipped(),n),c=/* @__PURE__ */ new Set,l=[];for(let e of a.iterNodeCarets(n))if(R_(e))c.add(e.origin.getKey());else if(L_(e)){let{origin:t}=e;G(t)&&!c.has(t.getKey())||l.push(t)}let u=/* @__PURE__ */ new Set;for(let e of l){let t=e.getParent();t===null||c.has(t.getKey())||u.add(t),ph(e)}for(let e of u)!e.canBeEmpty()&&!rg(e)&&e.isEmpty()&&e.isAttached()&&e.remove();for(let e of a.getTextSlices()){if(!e)continue;let{origin:t}=e.caret,n=t.getTextContentSize(),a=dv(H_(t,r)),c=t.getMode();if(Math.abs(e.distance)===n&&i===`removeEmptySlices`||c===`token`&&e.distance!==0)a.remove();else if(e.distance!==0){i=`removeEmptySlices`;let t=e.removeTextSlice(),n=e.caret.origin;if(c===`segmented`){let e=t.origin,n=Wf(e.getTextContent()).setStyle(e.getStyle()).setFormat(e.getFormat());a.replaceOrInsert(n),t=U_(n,r,t.offset)}n.is(o[0].origin)&&(o[0]=t),n.is(s[0].origin)&&(s[0]=t.getFlipped())}}let d,f;for(let e of o)if(pv(e)){d=hv(e);break}for(let e of s)if(pv(e)){f=hv(e);break}let p=function(e,t,n){if(!e||!t)return null;let r=e.getParentAtCaret(),i=t.getParentAtCaret();if(!r||!i)return null;let a=r.getParents().reverse();a.push(r);let o=i.getParents().reverse();o.push(i);let s=Math.min(a.length,o.length),c=0;for(;c<s&&a[c]===o[c];c++);let l=(e,t)=>{let n;for(let r=c;r<e.length;r++){let i=e[r];if(rg(i))return;!n&&t(i)&&(n=i)}return n},u=l(a,Ng),d=u&&l(o,e=>n.has(e.getKey())&&Ng(e));return d&&m_(d).length>0?null:u&&d?[u,d]:null}(d,f,c);if(p){let[e,t]=p;K_(e,`previous`).splice(0,t.getChildren());let n=t.getParent();for(t.remove(!0);n&&n.isEmpty();){let e=n;n=n.getParent(),e.remove(!0)}}else if(f){let e=function(e){if(R_(e)){let t=e.origin;if(Ng(t))return t}else{let t=e.getParentAtCaret();if(t&&Ng(t))return t}return null}(f),t=e&&e.getParent(),n=e&&e.getParents().findLast(ng);if(e&&t&&!Sm(t)&&e.isEmpty()&&c.has(e.getKey())&&m_(e).length===0&&(!n||c.has(n.getKey()))){e.remove(!0);let n=t;for(;n&&!Sm(n)&&n.isEmpty();){let e=n.getParent();if(e&&Sm(e)&&e.getChildrenSize()<=1)break;let t=n;n=e,t.remove(!0)}}}let m=[d,f,...o,...s].find(pv);if(m)return Q_(_v(hv(m),e.direction));L(269,JSON.stringify(o.map(e=>e.origin.__key)))}function hv(e){let t=function(e){let t=e;for(;R_(t);){let e=J_(t);if(!R_(e))break;t=e}return t}(e.getLatest()),{direction:n}=t;if(V(t.origin))return I_(t)?t:U_(t.origin,n,n);let r=t.getAdjacentCaret();return L_(r)&&V(r.origin)?U_(r.origin,n,M_(n)):t}function gv(e){return I_(e)&&e.offset!==W_(e.origin,e.direction)}function _v(e,t){return e.direction===t?e:e.getFlipped()}function vv(e,t){return e.direction===t?e:$_(_v(e.focus,t),_v(e.anchor,t))}function yv(e,t,n){let r=K_(e,`next`);for(let e=0;e<t;e++){let e=r.getAdjacentCaret();if(e===null)break;r=e}return _v(r,n)}function bv(e){let{origin:t,offset:n,direction:r}=e;if(n===W_(t,r))return e.getSiblingCaret();if(n===W_(t,M_(r)))return dv(e.getSiblingCaret());let[i]=t.splitText(n);return V(i)||L(281),_v(H_(i,`next`),r)}function xv(e,t){return!0}function Sv(e,{$copyElementNode:t=ig,$splitTextPointCaretNext:n=bv,rootMode:r=`shadowRoot`,$shouldSplit:i=xv,removeEmptyDestination:a=!1}={}){if(I_(e))return n(e);let o=e.getParentCaret(r);if(o){let{origin:n}=o;if(R_(e)){let e=dv(o);if(a&&n.isEmpty())return n.remove(),e;if(!n.canBeEmpty()||!i(n,`first`))return e}let r=function(e){let t=[];for(let n=e.getAdjacentCaret();n;n=n.getAdjacentCaret())t.push(n.origin);return t}(e);(r.length>0||!a&&n.canBeEmpty()&&i(n,`last`))&&o.insert(t(n).splice(0,0,r))}return o}function Cv(e,t,n){let r=_v(t,`next`);I_(r)&&(r.offset===0?r=H_(r.origin,`previous`).getFlipped():r.offset===r.origin.getTextContentSize()&&(r=H_(r.origin,`next`))),r.origin.is(e)&&(L_(r)||L(342,e.getKey(),e.getType()),r=dv(r)),(e.is(r.getNodeAtCaret())||e.is(r.getFlipped().getNodeAtCaret()))&&e.remove(!0);for(let e=r;e;e=Sv(e,n))r=e;return I_(r)&&L(283),r.insert(e.isInline()?Rm().append(e):e),_v(H_(e.getLatest(),`next`),t.direction)}function wv(e){return e}function Tv(e){return e}function Ev(e,t){if(!t||e===t)return e;for(let n in t)if(e[n]!==t[n])return{...e,...t};return e}function Dv(...e){let t=[];for(let n of e)if(n&&typeof n==`string`)for(let[e]of n.matchAll(/\S+/g))t.push(e);return t}function Ov(e,...t){let n=Dv(...t);n.length>0&&e.classList.add(...n)}function kv(...e){return()=>{for(let t=e.length-1;t>=0;t--)e[t]();e.length=0}}function Av(e){throw Error(`unreachable input event: ${JSON.stringify(e)}`)}function jv(e,t){let n=e.trimStart();if(n.startsWith(t))return n.slice(t.length);let r=t.trimEnd();if(n.startsWith(r)){let e=n.slice(r.length);return/^\s/.test(e)?e.slice(1):e}return``}function Mv(e,t){return e.startsWith(t)||e===t.trimEnd()}var Nv=class{phase=`plain`;claim;seq=0;inflight;detached=/* @__PURE__ */ new Map;get state(){let e=this.claim;return{phase:this.phase,...e?{claim:{name:e.name,token:e.token,...e.hint===void 0?{}:{hint:e.hint},...e.attachments===!0?{attachments:!0}:{}}}:{}}}dispatch(e){switch(e.type){case`draft-changed`:return this.onDraftChanged(e.draft);case`claim`:return this.onClaim(e.claim);case`enter`:return this.onEnter(e.mode,e.draft,e.annotated,e.submission);case`adjudicated`:return this.onAdjudicated(e.attempt,e.outcome);case`adjudication-failed`:return this.onAdjudicationFailed(e.attempt,e.message);case`submit-settled`:return this.onSubmitSettled(e);case`sink-settled`:return this.onSinkSettled(e);case`send-committed`:return this.onSendCommitted();case`release`:return this.onRelease();default:return Av(e)}}onDraftChanged(e){return this.phase===`claimed`&&this.claim!==void 0&&!Mv(e,this.claim.token)&&(this.phase=`plain`,this.claim=void 0),[]}onClaim(e){return this.phase!==`plain`&&this.phase!==`claimed`||(this.claim=e,this.phase=`claimed`),[]}mintAttempt(e,t,n){let r=new AbortController;return this.seq+=1,{attempt:{seq:this.seq,signal:r.signal,draftSnapshot:t,mode:e,...n===void 0?{}:{submission:n}},controller:r}}beginAttempt(e,t,n){let r=this.mintAttempt(e,t,n);return this.inflight=r,r.attempt}beginDetached(e,t,n){let r=this.mintAttempt(e,t,n);return this.detached.set(r.attempt.seq,r.controller),this.claim=void 0,this.phase=`plain`,r.attempt}detachedEffects(e){return[{type:`default-sink`,attempt:e,draft:e.draftSnapshot,mode:e.mode},{type:`commit-draft`,retainSuffixOf:e.draftSnapshot}]}onEnter(e,t,n,r){if(this.phase===`adjudicating`||this.phase===`submitting`)return[];if(this.phase===`claimed`&&this.claim!==void 0){let n=this.beginAttempt(e,t,r);return this.phase=`submitting`,[{type:`begin-submit`,attempt:n,claim:this.claim,args:jv(t,this.claim.token)}]}let i=t.trim();if(i===``&&!n)return[];if(i.startsWith(`/`)){let n=this.beginAttempt(e,t,r);return this.phase=`adjudicating`,[{type:`adjudicate`,attempt:n,draft:t}]}return this.detachedEffects(this.beginDetached(e,t,r))}onAdjudicated(e,t){let n=this.inflight;return this.phase!==`adjudicating`||n===void 0||n.attempt.seq!==e.seq?[]:t!==void 0&&t!==`handled`&&t!==`refresh`&&`claim`in t?(this.claim=t.claim,this.phase=`submitting`,[{type:`begin-submit`,attempt:e,claim:t.claim,args:jv(e.draftSnapshot,t.claim.token)}]):(this.inflight=void 0,this.phase=`plain`,t===void 0?(this.detached.set(e.seq,n.controller),this.detachedEffects(e)):[])}onAdjudicationFailed(e,t){return this.phase!==`adjudicating`||this.inflight?.attempt.seq!==e.seq?[]:(this.inflight=void 0,this.phase=`plain`,[{type:`notice`,level:`error`,text:t}])}onSubmitSettled(e){let t=this.inflight;if(this.phase!==`submitting`||t===void 0||t.attempt.seq!==e.attempt.seq)return[];if(this.inflight=void 0,e.ok){this.phase=`plain`,this.claim=void 0;let n=[{type:`commit-draft`,retainSuffixOf:t.attempt.draftSnapshot}];return e.outcome?.text!==void 0&&n.push({type:`notice`,level:e.outcome.kind===`error`?`error`:`info`,text:e.outcome.text}),n}let n=e.message??e.outcome?.text;return e.draft===t.attempt.draftSnapshot&&this.claim!==void 0&&Mv(e.draft,this.claim.token)?(this.phase=`claimed`,n===void 0?[]:[{type:`notice`,level:`error`,text:n}]):(this.phase=`plain`,this.claim=void 0,n===void 0?[]:[{type:`notice`,level:`error`,text:n}])}onSinkSettled(e){if(!this.detached.delete(e.attempt.seq))return[];let t=e.message??e.outcome?.text;return t===void 0?[]:[{type:`notice`,level:e.ok&&e.outcome?.kind!==`error`?`info`:`error`,text:t}]}onSendCommitted(){return this.phase===`plain`?(this.claim=void 0,[{type:`commit-draft`,retainSuffixOf:null}]):[]}onRelease(){this.inflight!==void 0&&(this.inflight.controller.abort(),this.inflight=void 0);for(let e of this.detached.values())e.abort();return this.detached.clear(),this.phase=`plain`,this.claim=void 0,[]}};function Pv(e){let t=Pg().getElementByKey(e.getKey());if(t===null)return null;let n=t.ownerDocument.defaultView;return n===null?null:n.getComputedStyle(t)}function Fv(e){return Pv(Sm(e)?e:e.getParentOrThrow())}function Iv(e,t,n=`self`){let r=e.getStartEndPoints();if(t.isSelected(e)&&!sh(t)&&r!==null){let[i,a]=r,o=e.isBackward(),s=i.getNode(),c=a.getNode(),l=t.is(s),u=t.is(c);if(l||u){let[r,i]=cp(e),a=s.is(c),l=t.is(o?c:s),u=t.is(o?s:c),d,f=0;a?(f=r>i?i:r,d=r>i?r:i):l?(f=o?i:r,d=void 0):u&&(f=0,d=o?r:i);let p=t.__text.slice(f,d);p!==t.__text&&(n===`clone`&&(t=Ug(t)),t.__text=p)}}return t}function Lv(e){let t=Rv(e);return t!==null&&t.writingMode===`vertical-rl`}function Rv(e){let t=e.anchor.getNode();return G(t)?Pv(t):Fv(t)}function zv(e,t){let n=Lv(e)?!t:t;Vv(e)&&(n=!n);let r=ov(e.focus,n?`previous`:`next`);if(gv(r))return!1;if(I_(r)&&!Jf(r.origin)&&r.origin.isUnmergeable()){let e=r.getNodeAtCaret();if(V(e)&&!Jf(e))return!0}for(let e of Z_(r)){if(R_(e))return!e.origin.isInline();if(!G(e.origin)){if(K(e.origin))return!0;break}}return!1}function Bv(e,t,n,r){e.modify(t?`extend`:`move`,n,r)}function Vv(e){let t=Rv(e);return t!==null&&t.direction===`rtl`}function Hv(e,t,n){let r=Vv(e),i;i=Lv(e)||r?!n:n,Bv(e,t,i,`character`)}function Uv(e,t){return e!==null&&Object.getPrototypeOf(e).constructor.name===t.name}let Wv=Symbol.for(`preact-signals`);function Gv(){if(Yv>1)return void Yv--;let e,t=!1;for(function(){let e=Jv;for(Jv=void 0;e!==void 0;)e.S.v===e.v&&(e.S.i=e.i),e=e.o}();Kv!==void 0;){let n=Kv;for(Kv=void 0,Xv++;n!==void 0;){let r=n.u;if(n.u=void 0,n.f&=-3,!(8&n.f)&&ey(n))try{n.c()}catch(n){t||=(e=n,!0)}n=r}}if(Xv=0,Yv--,t)throw e}let X,Kv;function qv(e){let t=X;X=void 0;try{return e()}finally{X=t}}let Jv,Yv=0,Xv=0,Zv=0;function Qv(e){if(X===void 0)return;let t=e.n;return t===void 0||t.t!==X?(t={i:0,S:e,p:X.s,n:void 0,t:X,e:void 0,x:void 0,r:t},X.s!==void 0&&(X.s.n=t),X.s=t,e.n=t,32&X.f&&e.S(t),t):t.i===-1?(t.i=0,t.n!==void 0&&(t.n.p=t.p,t.p!==void 0&&(t.p.n=t.n),t.p=X.s,t.n=void 0,X.s.n=t,X.s=t),t):void 0}function $v(e,t){this.v=e,this.i=0,this.n=void 0,this.t=void 0,this.l=0,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}function ey(e){for(let t=e.s;t!==void 0;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function ty(e){for(let t=e.s;t!==void 0;t=t.n){let n=t.S.n;if(n!==void 0&&(t.r=n),t.S.n=t,t.i=-1,t.n===void 0){e.s=t;break}}}function ny(e){let t,n=e.s;for(;n!==void 0;){let e=n.p;n.i===-1?(n.S.U(n),e!==void 0&&(e.n=n.n),n.n!==void 0&&(n.n.p=e)):t=n,n.S.n=n.r,n.r!==void 0&&(n.r=void 0),n=e}e.s=t}function ry(e,t){$v.call(this,void 0),this.x=e,this.s=void 0,this.g=Zv-1,this.f=4,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}function iy(e){let t=e.m;if(e.m=void 0,typeof t==`function`){Yv++;let n=X;X=void 0;try{t()}catch(t){throw e.f&=-2,e.f|=8,ay(e),t}finally{X=n,Gv()}}}function ay(e){for(let t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,iy(e)}function oy(e){if(X!==this)throw Error(`Out-of-order effect`);ny(this),X=e,this.f&=-2,8&this.f&&ay(this),Gv()}function sy(e,t){this.x=e,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=t?.name}function cy(e,t){let n=new sy(e,t);try{n.c()}catch(e){throw n.d(),e}let r=n.d.bind(n);return r[Symbol.dispose]=r,r}$v.prototype.brand=Wv,$v.prototype.h=function(){return!0},$v.prototype.S=function(e){let t=this.t;t!==e&&e.e===void 0&&(e.x=t,this.t=e,t===void 0?qv(()=>{var e;(e=this.W)==null||e.call(this)}):t.e=e)},$v.prototype.U=function(e){if(this.t!==void 0){let t=e.e,n=e.x;t!==void 0&&(t.x=n,e.e=void 0),n!==void 0&&(n.e=t,e.x=void 0),e===this.t&&(this.t=n,n===void 0&&qv(()=>{var e;(e=this.Z)==null||e.call(this)}))}},$v.prototype.subscribe=function(e){return cy(()=>{let t=this.value,n=X;X=void 0;try{e(t)}finally{X=n}},{name:`sub`})},$v.prototype.valueOf=function(){return this.value},$v.prototype.toString=function(){return this.value+``},$v.prototype.toJSON=function(){return this.value},$v.prototype.peek=function(){let e=X;X=void 0;try{return this.value}finally{X=e}},Object.defineProperty($v.prototype,"value",{get(){let e=Qv(this);return e!==void 0&&(e.i=this.i),this.v},set(e){if(e!==this.v){if(Xv>100)throw Error(`Cycle detected`);(function(e){Yv!==0&&Xv===0&&e.l!==0&&(e.l=0,Jv={S:e,v:e.v,i:e.i,o:Jv})})(this),this.v=e,this.i++,Zv++,Yv++;try{for(let e=this.t;e!==void 0;e=e.x)e.t.N()}finally{Gv()}}}}),ry.prototype=new $v,ry.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===Zv))return!0;if(this.g=Zv,this.f|=1,this.i>0&&!ey(this))return this.f&=-2,!0;let e=X;try{ty(this),X=this;let e=this.x();(16&this.f||this.v!==e||this.i===0)&&(this.v=e,this.f&=-17,this.i++)}catch(e){this.v=e,this.f|=16,this.i++}return X=e,ny(this),this.f&=-2,!0},ry.prototype.S=function(e){if(this.t===void 0){this.f|=36;for(let e=this.s;e!==void 0;e=e.n)e.S.S(e)}$v.prototype.S.call(this,e)},ry.prototype.U=function(e){if(this.t!==void 0&&($v.prototype.U.call(this,e),this.t===void 0)){this.f&=-33;for(let e=this.s;e!==void 0;e=e.n)e.S.U(e)}},ry.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(let e=this.t;e!==void 0;e=e.x)e.t.N()}},Object.defineProperty(ry.prototype,"value",{get(){if(1&this.f)throw Error(`Cycle detected`);let e=Qv(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}}),sy.prototype.c=function(){let e=this.S();try{if(8&this.f||this.x===void 0)return;let e=this.x();typeof e==`function`&&(this.m=e)}finally{e()}},sy.prototype.S=function(){if(1&this.f)throw Error(`Cycle detected`);this.f|=1,this.f&=-9,iy(this),ty(this),Yv++;let e=X;return X=this,oy.bind(this,e)},sy.prototype.N=function(){2&this.f||(this.f|=2,this.u=Kv,Kv=this)},sy.prototype.d=function(){this.f|=8,1&this.f||ay(this)},sy.prototype.dispose=function(){this.d()};function ly(e){return(typeof e.nodes==`function`?e.nodes():e.nodes)||[]}function Z(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);throw 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.`)}let uy;try{uy=`0.49.0+prod.esm`}catch{}let dy=uy??`"<unknown>+source"`,fy=/* @__PURE__ */ new Set([`__proto__`,`constructor`,`prototype`]);function py(e,t){if(e&&t&&!Array.isArray(t)&&typeof e==`object`&&typeof t==`object`){let n=e,r=t;for(let e in r)!fy.has(e)&&Object.prototype.hasOwnProperty.call(r,e)&&(n[e]=py(n[e],r[e]));return e}return t}function my(e){return e.id===0}function hy(e){return e.id===2}function gy(e){return function(e){return e.id===1}(e)||Z(305,String(e.id),`1`),Object.assign(e,{id:2})}let _y=/* @__PURE__ */ new Set;var vy=class{builder;configs;_dependency;_peerNameSet;extension;state;_signal;constructor(e,t){this.builder=e,this.extension=t,this.configs=/* @__PURE__ */ new Set,this.state={id:0}}mergeConfigs(){let e=this.extension.config||{},t=this.extension.mergeConfig?this.extension.mergeConfig.bind(this.extension):Ev;for(let n of this.configs)e=t(e,n);return e}init(e){let t=this.state;hy(t)||Z(306,String(t.id));let n={getDependency:this.getInitDependency.bind(this),getDirectDependentNames:this.getDirectDependentNames.bind(this),getPeer:this.getInitPeer.bind(this),getPeerNameSet:this.getPeerNameSet.bind(this)},r={...n,getDependency:this.getDependency.bind(this),getInitResult:this.getInitResult.bind(this),getPeer:this.getPeer.bind(this)},i=function(e,t,n){return Object.assign(e,{config:t,id:3,registerState:n})}(t,this.mergeConfigs(),n),a;this.state=i,this.extension.init&&(a=this.extension.init(e,i.config,n)),this.state=function(e,t,n){return Object.assign(e,{id:4,initResult:t,registerState:n})}(i,a,r)}build(e){let t=this.state,n;t.id!==4&&Z(307,String(t.id),`5`),this.extension.build&&(n=this.extension.build(e,t.config,t.registerState));let r={...t.registerState,getOutput:()=>n,getSignal:this.getSignal.bind(this)};this.state=function(e,t,n){return Object.assign(e,{id:5,output:t,registerState:n})}(t,n,r)}register(e,t){this._signal=t;let n=this.state;n.id!==5&&Z(308,String(n.id),`5`);let r=this.extension.register&&this.extension.register(e,n.config,n.registerState);return this.state=function(e){return Object.assign(e,{id:6})}(n),()=>{let e=this.state;e.id!==7&&Z(309,String(n.id),`7`),this.state=function(e){return Object.assign(e,{id:5})}(e),r&&r()}}afterRegistration(e){let t=this.state,n;return t.id!==6&&Z(310,String(t.id),`6`),this.extension.afterRegistration&&(n=this.extension.afterRegistration(e,t.config,t.registerState)),this.state=function(e){return Object.assign(e,{id:7})}(t),n}getSignal(){return this._signal===void 0&&Z(311),this._signal}getInitResult(){this.extension.init===void 0&&Z(312,this.extension.name);let e=this.state;return function(e){return e.id>=4}(e)||Z(313,String(e.id),`4`),e.initResult}getInitPeer(e){let t=this.builder.extensionNameMap.get(e);return t?t.getExtensionInitDependency():void 0}getExtensionInitDependency(){let e=this.state;return function(e){return e.id>=3}(e)||Z(314,String(e.id),`3`),{config:e.config}}getPeer(e){let t=this.builder.extensionNameMap.get(e);return t?t.getExtensionDependency():void 0}getInitDependency(e){let t=this.builder.getExtensionRep(e);return t===void 0&&Z(315,this.extension.name,e.name),t.getExtensionInitDependency()}getDependency(e){let t=this.builder.getExtensionRep(e);return t===void 0&&Z(315,this.extension.name,e.name),t.getExtensionDependency()}getState(){let e=this.state;return function(e){return e.id>=7}(e)||Z(316,String(e.id),`7`),e}getDirectDependentNames(){return this.builder.incomingEdges.get(this.extension.name)||_y}getPeerNameSet(){let e=this._peerNameSet;return e||(e=new Set((this.extension.peerDependencies||[]).map(([e])=>e)),this._peerNameSet=e),e}getExtensionDependency(){if(!this._dependency){let e=this.state;(function(e){return e.id>=5})(e)||Z(317,this.extension.name),this._dependency={config:e.config,init:e.initResult,output:e.output}}return this._dependency}};let yy={tag:xf};function by(){let e=wh();e.isEmpty()&&e.append(Rm())}let xy=/* @__PURE__ */ wv({config:/* @__PURE__ */ Tv({setOptions:yy,updateOptions:yy}),init:({$initialEditorState:e=by})=>({$initialEditorState:e,initialized:!1}),afterRegistration(e,{updateOptions:t,setOptions:n},r){let i=r.getInitResult();if(!i.initialized){i.initialized=!0;let{$initialEditorState:r}=i;if(Em(r))e.setEditorState(r,n);else if(typeof r==`function`)e.update(()=>{r(e)},t);else if(r&&(typeof r==`string`||typeof r==`object`)){let t=e.parseEditorState(r);e.setEditorState(t,n)}}return()=>{}},name:`@lexical/extension/InitialState`,nodes:[xm,Ff,km,Kf,Im]}),Sy=Symbol.for(`@lexical/extension/LexicalBuilder`);function Cy(){}function wy(e){throw e}function Ty(e){return Array.isArray(e)?e:[e]}let Ey=dy;var Dy=class e{roots;extensionNameMap;outgoingConfigEdges;incomingEdges;conflicts;_sortedExtensionReps;PACKAGE_VERSION;constructor(e){this.outgoingConfigEdges=/* @__PURE__ */ new Map,this.incomingEdges=/* @__PURE__ */ new Map,this.extensionNameMap=/* @__PURE__ */ new Map,this.conflicts=/* @__PURE__ */ new Map,this.PACKAGE_VERSION=Ey,this.roots=e;for(let t of e)this.addExtension(t)}static fromExtensions(t){let n=[Ty(xy)];for(let e of t)n.push(Ty(e));return new e(n)}static maybeFromEditor(t){let n=t[Sy];return n&&(n.PACKAGE_VERSION!==Ey&&Z(292,n.PACKAGE_VERSION,Ey),n instanceof e||Z(293)),n}static fromEditor(t){let n=e.maybeFromEditor(t);return n===void 0&&Z(294),n}constructEditor(){let{$initialEditorState:e,onError:t,onWarn:n,...r}=this.buildCreateEditorArgs(),i=Object.assign(Wm({...r,...t?{onError:e=>{t(e,i)}}:{},...n?{onWarn:e=>{n(e,i)}}:{}}),{[Sy]:this});for(let e of this.sortedExtensionReps())e.build(i);return i}buildEditor(){let e=Cy;function t(){try{e()}finally{e=Cy}}let n=Object.assign(this.constructEditor(),{dispose:t,[Symbol.dispose]:t});return e=kv(this.registerEditor(n),()=>n.setRootElement(null)),n}hasExtensionByName(e){return this.extensionNameMap.has(e)}getExtensionRep(e){let t=this.extensionNameMap.get(e.name);if(t)return t.extension!==e&&Z(295,e.name),t}addEdge(e,t,n){let r=this.outgoingConfigEdges.get(e);r?r.set(t,n):this.outgoingConfigEdges.set(e,/* @__PURE__ */ new Map([[t,n]]));let i=this.incomingEdges.get(t);i?i.add(e):this.incomingEdges.set(t,/* @__PURE__ */ new Set([e]))}addExtension(e){this._sortedExtensionReps!==void 0&&Z(296);let[t]=Ty(e);typeof t.name!=`string`&&Z(297,typeof t.name);let n=this.extensionNameMap.get(t.name);if(n!==void 0&&n.extension!==t&&Z(298,t.name),!n){n=new vy(this,t),this.extensionNameMap.set(t.name,n);let e=this.conflicts.get(t.name);typeof e==`string`&&Z(299,t.name,e);for(let e of t.conflictsWith||[])this.extensionNameMap.has(e)&&Z(299,t.name,e),this.conflicts.set(e,t.name);for(let e of t.dependencies||[]){let n=Ty(e);this.addEdge(t.name,n[0].name,n.slice(1)),this.addExtension(n)}for(let[e,n]of t.peerDependencies||[])this.addEdge(t.name,e,n?[n]:[])}}sortedExtensionReps(){if(this._sortedExtensionReps)return this._sortedExtensionReps;let e=[],t=(n,r)=>{let i=n.state;if(hy(i))return;let a=n.extension.name;var o;my(i)||Z(300,a,r||`[unknown]`),my(o=i)||Z(304,String(o.id),`0`),i=Object.assign(o,{id:1}),n.state=i;let s=this.outgoingConfigEdges.get(a);if(s)for(let e of s.keys()){let n=this.extensionNameMap.get(e);n&&t(n,a)}i=gy(i),n.state=i,e.push(n)};for(let e of this.extensionNameMap.values())my(e.state)&&t(e);for(let t of e)for(let[e,n]of this.outgoingConfigEdges.get(t.extension.name)||[])if(n.length>0){let t=this.extensionNameMap.get(e);if(t)for(let e of n)t.configs.add(e)}for(let[e,...t]of this.roots)if(t.length>0){let n=this.extensionNameMap.get(e.name);n===void 0&&Z(301,e.name);for(let e of t)n.configs.add(e)}return this._sortedExtensionReps=e,this._sortedExtensionReps}registerEditor(e){let t=this.sortedExtensionReps(),n=new AbortController,r=[()=>n.abort()],i=n.signal;for(let n of t){let t=n.register(e,i);t&&r.push(t)}for(let n of t){let t=n.afterRegistration(e);t&&r.push(t)}return kv(...r)}buildCreateEditorArgs(){let e={},t=/* @__PURE__ */ new Set,n=/* @__PURE__ */ new Map,r=/* @__PURE__ */ new Map,i={},a={},o=this.sortedExtensionReps();for(let s of o){let{extension:o}=s;if(o.onError!==void 0&&(e.onError=o.onError),o.onWarn!==void 0&&(e.onWarn=o.onWarn),o.disableEvents!==void 0&&(e.disableEvents=o.disableEvents),o.parentEditor!==void 0&&(e.parentEditor=o.parentEditor),o.editable!==void 0&&(e.editable=o.editable),o.namespace!==void 0&&(e.namespace=o.namespace),o.$initialEditorState!==void 0&&(e.$initialEditorState=o.$initialEditorState),o.nodes)for(let e of ly(o)){if(typeof e!=`function`){let t=n.get(e.replace);t&&Z(302,o.name,e.replace.name,t.extension.name),n.set(e.replace,s)}t.add(e)}if(o.html){if(o.html.export)for(let[e,t]of o.html.export.entries())r.set(e,t);o.html.import&&Object.assign(i,o.html.import)}o.theme&&py(a,o.theme)}Object.keys(a).length>0&&(e.theme=a),t.size&&(e.nodes=[...t]);let s=Object.keys(i).length>0,c=r.size>0;(s||c)&&(e.html={},s&&(e.html.import=i),c&&(e.html.export=r));for(let t of o)t.init(e);return e.onError||=wy,e}};function Oy(e,t){let n=Dy.maybeFromEditor(e);if(!n)return;let r=n.extensionNameMap.get(t);return r?r.getExtensionDependency():void 0}var ky=class extends bm{$config(){return this.config(`horizontalrule`,{importDOM:{hr:()=>({conversion:Ay,priority:0})}})}exportDOM(){return{element:_g().createElement(`hr`)}}createDOM(e){let t=_g().createElement(`hr`);return Ov(t,e.theme.hr),t}getTextContent(){return`
|
|
155
|
-
`}isInline(){return!1}updateDOM(){return!1}};function Ay(){return{node:jy()}}function jy(){return n_(ky)}Date.now;function My(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);throw 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.`)}let Ny;function Py(e,t){let{key:n}=t;return e&&n in e?e[n]:t.defaultValue}function Fy(e){return Ny&&Ny.editor===e?Ny:void 0}function Iy(e,t){if(`cfg`in t){let{cfg:n,updater:r}=t;return[n,r(Py(e,n))]}return t}function Ly(e,t){let n=t;for(let r of e){let[e,i]=Iy(n,r),a=e.key;if(n===t&&Py(n,e)===i)continue;let o=n===t||n===void 0?Ry(t):n;o[a]=i,n=o}return n}function Ry(e){return Object.create(e||null)}function zy(e,t){return[e,t]}function By(e,t,n,r=Pg()){let i=Ny,a=Fy(r);try{return Ny={...a,editor:r,[e]:t},n()}finally{Ny=i}}function Vy(e,t=()=>{}){return(n,r=Pg())=>i=>{let a=Fy(r),o=a&&a[e],s=Ly(n,o||t(r));return s&&s!==o?By(e,s,i,r):i()}}function Hy(e,t,n,r){return Object.assign(zl(Symbol(t),{isEqual:r,parse:n}),{[e]:!0})}let Uy=`@lexical/html/DOM`,Wy=Symbol.for(`@lexical/html/DOMExportContext`);function Gy(e,t,n){return Hy(Wy,e,t,n)}let Ky=/* @__PURE__ */ Gy(`isExport`,Boolean);function qy(e){let t=Oy(e,Uy);return t?t.output.defaults:void 0}function Jy(e){let t=Oy(e,Uy);return t?t.output.runtime:void 0}function Yy(e=Pg()){let t=Jy(e);return t?t.getSessionConfig():Fg(e)}let Xy=Vy(Wy,qy),Zy=Symbol.for(`@lexical/html/SelectorImpl`);function Qy(e,t){let n={kind:`element`,predicate:(r=t,r.length===0?Y:r.length===1?r[0]:(e,t)=>{for(let n of r)if(!n(e,t))return!1;return!0}),tags:e};var r;let i=n=>Qy(e,[...t,n]);return{[Zy]:n,attr:(e,t,n)=>i(tb(e,t,n)),classAll:(...e)=>i(eb(e)),classAny:(...e)=>i(function(e){let t=$y(e);return t.length===0?()=>!1:e=>{if(!Y(e))return!1;let n=e.classList;for(let e of t)if(n.contains(e))return!0;return!1}}(e)),styleAny:(e,t,n)=>i(function(e,t,n){if(typeof t==`string`)return n=>Y(n)&&n.style.getPropertyValue(e)===t;if(t instanceof RegExp){let r=n&&n.capture,i=t;return(t,n)=>{if(!Y(t))return!1;let a=t.style.getPropertyValue(e);if(!a)return!1;let o=a.match(i);return o!==null&&(r!==void 0&&(n[r]=o),!0)}}My(362,JSON.stringify(e))}(e,t,n))}}function $y(e){let t=[];for(let n of e)n&&t.push(n);return t}function eb(e){let t=$y(e);return t.length===0?()=>!0:e=>{if(!Y(e))return!1;let n=e.classList;for(let e of t)if(!n.contains(e))return!1;return!0}}function tb(e,t,n){if(!0===t)return t=>Y(t)&&t.hasAttribute(e);if(typeof t==`string`)return n=>Y(n)&&n.getAttribute(e)===t;if(t instanceof RegExp){let r=n&&n.capture,i=t;return(t,n)=>{if(!Y(t))return!1;let a=t.getAttribute(e);if(a==null)return!1;let o=a.match(i);return o!==null&&(r!==void 0&&(n[r]=o),!0)}}My(361,JSON.stringify(e))}let nb={kind:`text`,predicate:ch,tags:/* @__PURE__ */ new Set},rb={[Zy]:nb},ib={kind:`comment`,predicate:e=>e.nodeType===8,tags:/* @__PURE__ */ new Set},ab={[Zy]:ib},ob={any:()=>Qy(/* @__PURE__ */ new Set,[]),comment:()=>ab,tag(...e){e.length>0||My(363);let t=/* @__PURE__ */ new Set;for(let n of e)t.add(n.toUpperCase());return Qy(t,[])},text:()=>rb},sb=ob;sb.tag(`b`,`strong`,`em`,`i`,`code`,`mark`,`s`,`sub`,`sup`,`u`,`span`),sb.text(),sb.tag(`script`,`style`),sb.tag(`br`),sb.tag(`p`),sb.tag(`hr`),sb.any(),Object.freeze([]),Object.freeze({}),ob.any(),ob.any,ob.comment,ob.tag,ob.text;function cb(e,t=null,n=Pg()){return Xy([zy(Ky,!0)],n)(()=>{let r=wh(),i=Yy(n),a=H(t)?f_(t.anchor.getNode()):null,o=e.append.bind(e);for(let e of(G(a)?a:r).getChildren())ub(n,e,o,t,i);return e})}function lb(e,t=null){return(typeof document>`u`||typeof window>`u`&&global.window===void 0)&&My(338),tm(e),cb(_g().createElement(`div`),t,e).innerHTML}function ub(e,t,n,r=null,i=Fg(e)){let a=i.$shouldInclude(t,r,e),o=i.$shouldExclude(t,r,e),s=t;r!==null&&V(t)&&(s=Iv(r,t,`clone`));let{element:c,after:l,append:u,$getChildNodes:d}=i.$exportDOM(s,e);if(!c)return!1;let f=_g().createDocumentFragment(),p=d?d():G(s)?s.getChildren():[],m=a&&ip(r)&&G(t)?null:r,h=f.append.bind(f);for(let n of p){let o=ub(e,n,h,m,i);!a&&o&&i.$extractWithChild(t,n,r,`html`,e)&&(a=!0)}if(a&&!o){if((Y(c)||Og(c))&&(u?u(f):c.append(f)),n(c),l){let e=l.call(s,c);e&&(Og(c)?c.replaceChildren(e):c.replaceWith(e))}}else n(f);return a}function db(e,t,n=null){let r=gg(n),i=n?mg(n):[],a=n!==null&&i.length>0;if(a&&typeof r.caretPositionFromPoint==`function`){let a=r.caretPositionFromPoint(e,t,{shadowRoots:i});if(a!==null&&function(e,t){for(let n=e;n!==null;){if(n===t)return!0;n=qh(n)}return!1}(a.offsetNode,n))return{node:a.offsetNode,offset:a.offset}}if(a){let i=n.getRootNode();if(fg(i)){let a=i.elementFromPoint(e,t);if(a!==null&&n.contains(a)){let n=function(e,t,n,r){let i=r.createRange(),a=e=>t<e.top?e.top-t:t>e.bottom?t-e.bottom:0,o=t=>e<t.left?t.left-e:e>t.right?e-t.right:0,s=r.createTreeWalker(n,NodeFilter.SHOW_TEXT),c=null,l=1/0,u=1/0;for(let e=s.nextNode();e;e=s.nextNode()){i.selectNodeContents(e);for(let t of i.getClientRects()){let n=a(t),r=o(t);(n<l||n===l&&r<u)&&(l=n,u=r,c=e)}}if(c===null)return null;let d=0,f=1/0,p=1/0;for(let t=0;t<=c.length;t++){i.setStart(c,t),i.collapse(!0);let n=i.getBoundingClientRect(),r=a(n),o=Math.abs(e-n.left);(r<f||r===f&&o<p)&&(f=r,p=o,d=t)}return{node:c,offset:d}}(e,t,a,r);if(n!==null)return n}}}if(typeof r.caretRangeFromPoint==`function`){let n=r.caretRangeFromPoint(e,t);return n===null?null:{node:n.startContainer,offset:n.startOffset}}if(typeof r.caretPositionFromPoint==`function`){let n=r.caretPositionFromPoint(e,t);return n===null?null:{node:n.offsetNode,offset:n.offset}}return null}function fb(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);throw 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 pb(e,t=U()){return t??fb(166),H(t)&&t.isCollapsed()||t.getNodes().length===0?``:lb(e,t)}function mb(e,t){let n=e.getData(`text/plain`)||e.getData(`text/uri-list`);n!=null&&t.insertRawText(n)}let hb=`application/x-lexical-drag`;function gb(e,t){let n={editorKey:t.getKey()};e.setData(hb,JSON.stringify(n))}function _b(e,t,n){let r=e.dataTransfer;if(r===null)return!1;let i=function(e){let t=e.getData(hb);if(!t)return null;let n;try{n=JSON.parse(t)}catch{return null}return(r=n)!==null&&typeof r==`object`&&`editorKey`in r&&typeof r.editorKey==`string`?n:null;var r}(r);if(i===null)return!1;let a=function(e,t){let n=db(e.clientX,e.clientY,t.getRootElement());if(n===null)return null;let r=xh(n.node);if(r===null)return null;if(V(r))return U_(r,`next`,n.offset);if(G(r))return yv(r,n.offset,`next`);let i=r.getParent();return i===null?null:yv(i,r.getIndexWithinParent()+1,`next`)}(e,t);if(a===null)return!1;let o=Sv(a);if(o===null)return!1;let s=i.editorKey===t.getKey(),c=U();if(s){if(!H(c)||c.isCollapsed())return!1;if(function(e,t){let{anchor:n,focus:r}=vv(uv(t),`next`);return tv(n,e)<0&&tv(e,r)<0}(a,c))return e.preventDefault(),!0;c.removeText()}if(!o.origin.isAttached())return e.preventDefault(),!0;if(n(r,cv(Q_(o)),t),!s){let e=t.getRootElement(),n=e?e.ownerDocument:null,r=n?function(e,t){for(let n of hg(t)){let t=ah(n);if(rh(t)&&t.getKey()===e&&Y(n))return n}return null}(i.editorKey,n):null;r!==null&&r.dispatchEvent(new InputEvent(`beforeinput`,{bubbles:!0,cancelable:!0,inputType:`deleteByDrag`}))}return e.preventDefault(),!0}function vb(e,t){return _b(e,t,(e,t)=>mb(e,t))}function yb(e,t){t.update(()=>{if(e!==null){let n=Uv(e,KeyboardEvent)?null:e.clipboardData,r=U();if(r!==null&&!r.isCollapsed()&&n!=null){e.preventDefault();let i=pb(t);i!==null&&n.setData(`text/html`,i),n.setData(`text/plain`,r.getTextContent())}}})}function bb(e){return kv(e.registerCommand(ed,e=>{let t=U();return!!H(t)&&(t.deleteCharacter(e),!0)},0),e.registerCommand(od,e=>{let t=U();return!!H(t)&&(t.deleteWord(e),!0)},0),e.registerCommand(sd,e=>{let t=U();return!!H(t)&&(t.deleteLine(e),!0)},0),e.registerCommand(rd,e=>{let t=U();if(!H(t))return!1;if(typeof e==`string`)t.insertText(e);else{let n=e.dataTransfer;if(n!=null)mb(n,t);else{let n=e.data;n&&t.insertText(n)}}return!0},0),e.registerCommand(ad,()=>{let e=U();return!!H(e)&&(e.removeText(),!0)},0),e.registerCommand(td,e=>{let t=U();return!!H(t)&&(t.insertLineBreak(e),!0)},0),e.registerCommand(nd,()=>{let e=U();return!!H(e)&&(e.insertLineBreak(),!0)},0),e.registerCommand(md,e=>{let t=U();if(!H(t))return!1;let n=e,r=n.shiftKey;return!!zv(t,!0)&&(n.preventDefault(),Hv(t,r,!0),!0)},0),e.registerCommand(fd,e=>{let t=U();if(!H(t))return!1;let n=e,r=n.shiftKey;return!!zv(t,!1)&&(n.preventDefault(),Hv(t,r,!1),!0)},0),e.registerCommand(bd,t=>!!H(U())&&(!$c||!Qc)&&(t.preventDefault(),e.dispatchCommand(ed,!0)),0),e.registerCommand(Sd,t=>!!H(U())&&(t.preventDefault(),e.dispatchCommand(ed,!1)),0),e.registerCommand(vd,t=>{if(!H(U()))return!1;if(t!==null){if(($c||tl||il)&&Qc)return!1;t.preventDefault()}return e.dispatchCommand(td,!1)},0),e.registerCommand(Ad,()=>{let e=U();return Bh(H(e)&&f_(e.anchor.getNode())!==null?e:null),!0},0),e.registerCommand(Od,t=>!!H(U())&&(yb(t,e),!0),0),e.registerCommand(kd,t=>!!H(U())&&(function(e,t){yb(e,t),t.update(()=>{let e=U();H(e)&&e.removeText()},{tag:`cut`})}(t,e),!0),0),e.registerCommand(id,t=>!!H(U())&&(function(e,t){e.preventDefault(),t.update(()=>{let t=U(),n=Uv(e,ClipboardEvent)?e.clipboardData:null;n!=null&&H(t)&&mb(n,t)},{tag:`paste`})}(t,e),!0),0),e.registerCommand(wd,t=>vb(t,e),0),e.registerCommand(Td,t=>{let n=U();return!!H(n)&&(n.isCollapsed()||t.dataTransfer===null||gb(t.dataTransfer,e),!0)},0))}function xb(e,t,n,r,i){if(e===null||n.size===0&&r.size===0&&!i)return 0;let a=t._selection,o=e._selection;if(i)return 1;if(!(H(a)&&H(o)&&o.isCollapsed()&&a.isCollapsed()))return 0;let s=function(e,t,n){let r=e._nodeMap,i=[];for(let e of t){let t=r.get(e);t!==void 0&&i.push(t)}for(let[e,t]of n){if(!t)continue;let n=r.get(e);n===void 0||Sm(n)||i.push(n)}return i}(t,n,r);if(s.length===0)return 0;if(s.length>1){let n=t._nodeMap,r=n.get(a.anchor.key),i=n.get(o.anchor.key);return r&&i&&!e._nodeMap.has(r.__key)&&V(r)&&r.__text.length===1&&a.anchor.offset===1?2:0}let c=s[0],l=e._nodeMap.get(c.__key);if(!V(l)||!V(c)||l.__mode!==c.__mode)return 0;let u=l.__text,d=c.__text;if(u===d)return 0;let f=a.anchor,p=o.anchor;if(f.key!==p.key||f.type!==`text`)return 0;let m=f.offset,h=p.offset,g=d.length-u.length;return g===1&&h===m-1?2:g===-1&&h===m+1?3:g===-1&&h===m?4:0}function Sb(e,t,n){let r=n(),i=0,a=r,o=0,s=null;return(c,l,u,d,f,p)=>{let m=n();if(p.has(`composition-start`)&&(a=r,o=i,s=c),p.has(`historic`))return i=0,r=m,2;p.has(`composition-end`)&&s&&(r=a,i=o,c=s);let h=p.has(`paste`)||p.has(`cut`)?0:xb(c,l,d,f,e.isComposing()),g=(()=>{let n=u===null||u.editor===e,a=p.has(`history-push`);if(!a&&n&&p.has(`history-merge`))return 0;if(h===1)return 2;if(c===null)return 1;let o=l._selection;if(!(d.size>0||f.size>0))return o===null?2:0;let s=typeof t==`number`?t:t.peek();return!1===a&&h!==0&&h===i&&m<r+s&&n||d.size===1&&function(e,t,n){let r=t._nodeMap.get(e),i=n._nodeMap.get(e),a=t._selection,o=n._selection;return!(H(a)&&H(o)&&a.anchor.type===`element`&&a.focus.type===`element`&&o.anchor.type===`text`&&o.focus.type===`text`||!V(r)||!V(i)||r.__parent!==i.__parent)&&JSON.stringify(t.read(()=>r.exportJSON()))===JSON.stringify(n.read(()=>i.exportJSON()))}(Array.from(d)[0],c,l)?0:1})();return r=m,i=h,g}}function Cb(e,t){e.undoStack=[],e.redoStack=[],e.current=null,t&&t(e)}function wb(e,t,n,r=Date.now,i,a=null){let o=Sb(e,n,r),s=()=>{i&&i(t)};return s(),kv(e.registerCommand(ld,()=>(function(e,t,n){let r=t.redoStack,i=t.undoStack;if(i.length!==0){let a=t.current,o=i.pop();a!==null&&(r.push(a),e.dispatchCommand(Nd,!0)),i.length===0&&e.dispatchCommand(Pd,!1),t.current=o||null,n&&n(t),o&&o.editor.setEditorState(o.editorState,{tag:`historic`})}}(e,t,i),!0),0),e.registerCommand(ud,()=>(function(e,t,n){let r=t.redoStack,i=t.undoStack;if(r.length!==0){let a=t.current;a!==null&&(i.push(a),e.dispatchCommand(Pd,!0));let o=r.pop();r.length===0&&e.dispatchCommand(Nd,!1),t.current=o||null,n&&n(t),o&&o.editor.setEditorState(o.editorState,{tag:`historic`})}}(e,t,i),!0),0),e.registerCommand(jd,()=>(Cb(t,i),!1),0),e.registerCommand(Md,()=>(Cb(t,i),e.dispatchCommand(Nd,!1),e.dispatchCommand(Pd,!1),!0),0),e.registerUpdateListener(({editorState:n,prevEditorState:r,dirtyLeaves:i,dirtyElements:c,tags:l})=>{let u=t.current,d=t.redoStack,f=t.undoStack,p=u===null?null:u.editorState;if(u!==null&&n===p)return;let m=o(r,n,u,i,c,l);if(m===1){if(d.length!==0&&(t.redoStack=[],e.dispatchCommand(Nd,!1)),u!==null){f.push({...u});let t=typeof a==`number`||a===null?a:a.peek();t!==null&&f.length>t&&f.splice(0,f.length-t),e.dispatchCommand(Pd,!0)}}else if(m===2)return;t.current={editor:e,editorState:n},s()}))}function Tb(){return{current:null,redoStack:[],undoStack:[]}}Date.now;let Eb=`application/x-codexhost-thread-reference`;function Db(e){let t=e.projectionValues?.threadReference;if(!e.blank&&t?.hostId&&(t.hostId===`local`||/^remote-(?:ssh(?:-|:)|control:)/u.test(t.hostId)&&t.threadId))return{threadId:t.threadId??e.id,hostId:t.hostId,title:e.title?.replace(/[\s\u0000-\u001f\u007f]+/gu,` `).trim()||e.id.slice(0,8)}}function Ob(e){return`thread://${encodeURIComponent(e.threadId).replace(/[!'()*]/gu,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)}?hostId=${encodeURIComponent(e.hostId)}`}function kb(e){if(e.trim()!==e)return;let t=/^codex:\/\/threads\/([^/?#\s<>]+)$/u.exec(e)??/^thread:\/\/([^/?#\s<>]+)\?hostId=([^&#\s]+)$/u.exec(e);if(t?.[1]!==void 0)try{let e=decodeURIComponent(t[1]),n=decodeURIComponent(t[2]??`local`);if(!e||!n||/[\u0000-\u001f\u007f]/u.test(e+n))return;if(n===`local`)return e;if(!/^remote-(?:ssh(?:-|:)|control:)/u.test(n))return;let r=new TextEncoder().encode(JSON.stringify([n,e]));return`web-remote:`+btoa(Array.from(r,e=>String.fromCharCode(e)).join(``)).replaceAll(`+`,`-`).replaceAll(`/`,`_`).replace(/=+$/u,``)}catch{return}}function Ab(e){let t=`[@${e.title.replace(/[\\`*{}[\]()#+.!_<>|~-]/gu,e=>`\\${e}`)}](${Ob(e)})`;return{source:`codexhost-thread`,ref:t,label:e.title,appearance:`session`,clipboardText:t}}function jb(e){try{let t=JSON.parse(e);if(typeof t!=`object`||!t)return;let{threadId:n,hostId:r,title:i}=t;return typeof n!=`string`||!n||typeof r!=`string`||!r||r!==`local`&&!/^remote-(?:ssh(?:-|:)|control:)/u.test(r)||typeof i!=`string`?void 0:Db({id:n,blank:!1,title:i,projectionValues:{threadReference:{hostId:r,threadId:n}}})}catch{return}}function Mb(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`){if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=Mb(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function Nb(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=Mb(e))&&(r&&(r+=` `),r+=t);return r}let Pb=`@deepseek-ai/dsh-client-ui-conversation/ReferenceChip.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Pb)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-conversation`,e.dataset.pluginCss=Pb,e.textContent=`.HsYvBG_chip{max-width:240px;color:var(--dsw-alias-state-business-primary);user-select:none;align-items:baseline;gap:3px;display:inline-flex}.HsYvBG_marker{flex:none;font-weight:500}.HsYvBG_icon{flex:none;align-self:center}.HsYvBG_label{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.HsYvBG_invalid{color:var(--dsw-alias-state-error-primary);opacity:.7;text-decoration:line-through}`,document.head.appendChild(e)}var Fb={chip:`HsYvBG_chip`,icon:`HsYvBG_icon`,invalid:`HsYvBG_invalid`,label:`HsYvBG_label`,marker:`HsYvBG_marker`};let Ib=`@deepseek-ai/dsh-client-ui-conversation/composer-editor.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Ib)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-conversation`,e.dataset.pluginCss=Ib,e.textContent=`._06X5vW_reference{border-radius:var(--dsw-radius-sm);line-height:inherit;vertical-align:baseline;color:var(--dsw-alias-state-business-primary);-webkit-box-decoration-break:clone;box-decoration-break:clone;background:0 0;padding:0 4px}._06X5vW_reference:hover{background:var(--dsw-alias-state-business-tertiary)}._06X5vW_openable{cursor:pointer}._06X5vW_textRef{max-width:100%;display:inline-block}`,document.head.appendChild(e)}var Lb={openable:`_06X5vW_openable`,reference:`_06X5vW_reference`,textRef:`_06X5vW_textRef`};function Rb({label:e,reference:t,appearance:n,invalid:r}){return/* @__PURE__ */ (0,h.jsxs)(`span`,{className:Nb(Lb.reference,Fb.chip,n===`file`&&!r&&Lb.openable,r&&Fb.invalid),title:e,children:[n===void 0?/* @__PURE__ */ (0,h.jsx)(`span`,{className:Fb.marker,"aria-hidden":!0,children:`@`}):/* @__PURE__ */ (0,h.jsx)(d.ReferenceIconRegular,{kind:n,reference:t,size:14,className:Fb.icon}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:Fb.label,children:e})]})}var zb=class e extends bm{__source;__ref;__label;__appearance;__clipboardText;__invalid;static getType(){return`reference-chip`}static clone(t){return new e({source:t.__source,ref:t.__ref,label:t.__label,appearance:t.__appearance,clipboardText:t.__clipboardText},t.__invalid,t.__key)}static importJSON(t){return new e({source:t.source,ref:t.ref,label:t.label,appearance:t.appearance,clipboardText:t.clipboardText},t.invalid)}constructor(e,t=!1,n){super(n),this.__source=e.source,this.__ref=e.ref,this.__label=e.label,this.__appearance=e.appearance,this.__clipboardText=e.clipboardText,this.__invalid=t}exportJSON(){return{...super.exportJSON(),type:`reference-chip`,version:1,source:this.__source,ref:this.__ref,label:this.__label,...this.__appearance===void 0?{}:{appearance:this.__appearance},clipboardText:this.__clipboardText,invalid:this.__invalid}}createDOM(e){let t=document.createElement(`span`);return t.setAttribute(`data-composer-chip`,this.__source),t.setAttribute(`contenteditable`,`false`),t}updateDOM(){return!1}isInline(){return!0}isKeyboardSelectable(){return!1}getTextContent(){return this.__clipboardText}setInvalid(e){let t=this.getWritable();t.__invalid=e}isInvalid(){return this.getLatest().__invalid}getSource(){return this.getLatest().__source}getReference(){return this.getLatest().__ref}getLabel(){return this.getLatest().__label}getAppearance(){return this.getLatest().__appearance}decorate(){return/* @__PURE__ */ (0,h.jsx)(Rb,{label:this.__label,reference:this.__ref,appearance:this.__appearance,invalid:this.__invalid})}};function Bb(e){return new zb(e)}function Vb(e){return e instanceof zb}function Hb(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);throw 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 Ub(e,t,n,r){let i=e=>e instanceof n,a=e=>{let t=Wf(e.getTextContent());t.setFormat(e.getFormat()),e.replace(t)};return[e.registerNodeTransform(Ff,e=>{if(!e.isSimpleText())return;let n,o=e.getPreviousSibling(),s=e.getTextContent(),c=e;if(V(o)){let n=o.getTextContent(),r=t(n+s);if(i(o)){if(r===null||(e=>e.getLatest().__mode)(o)!==0)return void a(o);{let t=r.end-n.length;if(t>0){let r=n+s.slice(0,t);if(o.select(),o.setTextContent(r),t===s.length)e.remove();else{let n=s.slice(t);e.setTextContent(n)}return}}}else if(r===null||r.start<n.length)return}let l=0;for(;;){n=t(s);let e,u=n===null?``:s.slice(n.end);if(s=u,u===``){let e=c.getNextSibling();if(V(e)){u=c.getTextContent()+e.getTextContent();let n=t(u);if(n===null)return void(i(e)?a(e):e.markDirty());if(n.start!==0)return}}if(n===null)return;if(n.start===0&&V(o)&&o.isTextEntity()){l+=n.end;continue}n.start===0?[e,c]=c.splitText(n.end):[,e,c]=c.splitText(n.start+l,n.end+l),e===void 0&&Hb(165,`nodeToReplace`);let d=r(e);if(d.setFormat(e.getFormat()),e.replace(d),c==null)return;l=0,o=d}}),e.registerNodeTransform(n,e=>{let n=e.getTextContent(),r=t(n);if(r===null||r.start!==0)return void a(e);if(n.length>r.end)return void e.splitText(r.end);let o=e.getPreviousSibling();V(o)&&o.isTextEntity()&&(a(o),a(e));let s=e.getNextSibling();V(s)&&s.isTextEntity()&&(a(s),i(e)&&a(e))})]}let Wb=/(^|\s)([/@])([\w-]+)/g,Gb=/(^|\s)(@(?:"[^"\n]*"?|[^\s"]\S*))/g,Kb=/* @__PURE__ */ new Set(`.,;:!?,。;:!?`),qb=/^@.*[/\\.]/u;function Jb(e,t,n){if(!n.startsWith(`@"`)){let e=n.length;for(;Kb.has(n.charAt(e-1));)--e;return qb.test(n.slice(0,e))?t+e:void 0}if(n.length>3&&n.endsWith(`"`))return t+n.length;let r=n.lastIndexOf(`/`);if(r<0)return;let i=t+r+1;for(;Kb.has(e.charAt(i));)i+=1;return i===e.length||/\s/u.test(e.charAt(i))?t+r+1:void 0}let Yb=/^(?:\s|$)/;function Xb(e,t){if(e===``)return[];let n=[];Wb.lastIndex=0;let r;for(;(r=Wb.exec(e))!==null;){let i=r[2],a=r[3]??``;if((i!==`/`||Yb.test(e.slice(r.index+r[0].length)))&&t.get(i)?.includes(a)){let e=r.index+(r[1]?.length??0);n.push({start:e,end:e+1+a.length,trigger:i})}}Gb.lastIndex=0;let i;for(;(i=Gb.exec(e))!==null;){let t=i.index+(i[1]?.length??0),r=Jb(e,t,i[2]??``);r!==void 0&&!n.some(e=>e.start<r&&e.end>t)&&n.push({start:t,end:r,trigger:`@`})}return n.sort((e,t)=>e.start-t.start)}var Zb=class e extends Ff{static getType(){return`composer-text-ref`}static clone(t){return new e(t.__text,t.__key)}static importJSON(t){let n=new e(t.text);return n.setFormat(t.format),n.setDetail(t.detail),n.setMode(t.mode),n.setStyle(t.style),n}exportJSON(){return{...super.exportJSON(),type:`composer-text-ref`}}createDOM(e){let t=super.createDOM(e);return t.className=Nb(t.className,Lb.reference,Lb.textRef,this.getTextContent().startsWith(`/`)&&Lb.openable),t.setAttribute(`spellcheck`,`false`),t.setAttribute(`data-composer-text-ref`,``),t}isTextEntity(){return!0}canInsertTextBefore(){return!0}};function Qb(e,t,n){return kv(...Ub(e,e=>{let r=n();for(let n of Xb(e,t()))if(r===null||n.start!==0||e.slice(n.start,n.end)!==r.trimEnd())return{start:n.start,end:n.end};return null},Zb,e=>new Zb(e.getTextContent())))}function $b(e){e.update(()=>{for(let e of wh().getAllTextNodes())e.markDirty()},{tag:xf})}function ex(e,t){return e.registerCommand(Yu,e=>{if(e.target===null||e.button!==0||e.detail>1)return!1;let n=U();if(H(n)&&!n.isCollapsed())return!1;let r=xh(e.target);if(Vb(r)){if(r.isInvalid())return!1;let e=r.getAppearance();return t(r.getSource(),{ref:r.getReference(),...e===void 0?{}:{appearance:e}})}return r instanceof Zb&&t(void 0,{ref:r.getTextContent()})},1)}function tx(e){return(t,n)=>{for(let r of e)Object.hasOwn(t,r)&&t[r]===void 0&&n.addIssue({code:`custom`,path:[r],message:`Explicit undefined is not valid JSON`})}}let nx=Ls([k(),A(),j(),ks()]);function rx(e){let t=/* @__PURE__ */ new WeakSet,n=[{value:e,leaving:!1}];try{for(;n.length>0;){let e=n.pop();if(!e)break;if(e.leaving)t.delete(e.value);else if(typeof e.value==`object`&&e.value!==null){if(t.has(e.value))return!1;t.add(e.value),n.push({value:e.value,leaving:!0});for(let t of Object.values(e.value))n.push({value:t,leaving:!1})}}}catch{return!1}return!0}let ix=_c(rx,{message:`JSON value must not contain circular references`}),ax=hc(()=>Ls([nx,M(ax),Gs(k(),ax)])),ox=ix.pipe(ax);ix.pipe(M(ax));let sx=ix.pipe(Gs(k(),ax)),cx=P({code:k().min(1),message:k().min(1),retryable:j(),diagnostic:k().min(1).optional(),stage:k().min(1).optional(),durationMs:A().int().nonnegative().optional(),stderrTail:k().min(1).optional()}).superRefine(tx([`diagnostic`,`stage`,`durationMs`,`stderrTail`])),lx=k().max(64).regex(/^[a-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/u),ux=e=>k().min(1).max(e).refine(e=>e.trim().length>0),dx=Gs(lx,N({label:ux(256).optional(),description:ux(1024).optional()}).strict()).refine(e=>Object.keys(e).length<=16,`Too many locales`),fx=Gs(lx,ux(4096)).refine(e=>typeof e.en==`string`,`English fallback is required`).refine(e=>Object.keys(e).length<=16,`Too many locales`),px=k().refine(e=>e.trim().length>0,{message:`Identifier must not be empty or whitespace`}),mx=px.brand(),hx=px.brand(),gx=px.brand();px.brand(),px.brand();let _x=k().refine(e=>e.trim().length>0,{message:`Value must not be empty or whitespace`}),vx=_x.max(128).regex(/^[A-Za-z0-9._~:-]+$/u,`Permission Mode ID must use transport-safe characters`).brand(),yx=N({modes:M(N({id:vx,label:_x.max(256),description:_x.max(1024).optional(),dangerous:j().optional(),localizations:dx.optional()}).strict()).min(1).max(32),defaultModeId:vx}).strict().superRefine((e,t)=>{let n=/* @__PURE__ */ new Set;for(let[r,i]of e.modes.entries())n.has(i.id)&&t.addIssue({code:`custom`,message:`Permission Mode IDs must be unique`,path:[`modes`,r,`id`]}),n.add(i.id);n.has(e.defaultModeId)||t.addIssue({code:`custom`,message:`Default Permission Mode must exist in the catalog`,path:[`defaultModeId`]})});N({threadId:hx,permissionModeId:vx}).strict();let bx=A().int().safe().nonnegative(),xx=A().finite().nonnegative(),Sx=A().finite().min(0).max(100),Cx=N({version:Ls([I(3),I(4)]).optional(),requestId:k().min(1),turnId:k().min(1).max(1024),outputTokens:bx,startedAtMs:bx,completedAtMs:bx}).strict().refine(e=>e.completedAtMs>e.startedAtMs),wx=N({version:Ls([I(2),I(3),I(4)]).optional(),value:xx,turnId:k().min(1).max(1024),at:bx}).strict();N({outputTimings:M(Cx).transform(e=>e.filter(e=>e.version===4)).optional(),outputTokensPerSecond:wx.refine(e=>e.version===4).optional().catch(void 0),timeToFirstOutputMs:wx.extend({value:bx}).optional()}).strict();let Tx=e=>fx.refine(t=>Object.values(t).every(t=>t.length<=e)),Ex=N({composerIndicators:M(N({kind:I(`countdown`),id:k().min(1).max(64),expiresAtUnix:bx,label:Tx(256).optional(),tooltip:Tx(1024).optional()}).strict()).max(2).refine(e=>new Set(e.map(({id:e})=>e)).size===e.length,{message:`Composer indicator IDs must be unique`}).optional(),inputTokens:bx.optional(),cachedInputTokens:bx.optional(),cacheWriteInputTokens:bx.optional(),outputTokens:bx.optional(),outputTokensPerSecond:xx.optional(),sessionOutputTokensPerSecond:xx.optional(),apiOutputTokensPerSecond:xx.optional(),reasoningOutputTokens:bx.optional(),totalTokens:bx.optional(),totalCostUsd:xx.optional(),totalCredits:xx.optional(),contextUsagePercent:xx.optional(),cacheHitRatePercent:Sx.optional(),contextWindowTokens:bx.optional(),contextUsedTokens:bx.optional(),planFiveHourUsedPercent:Sx.optional(),planFiveHourResetsAtUnix:bx.optional(),planSevenDayUsedPercent:Sx.optional(),planSevenDayResetsAtUnix:bx.optional(),sessionCacheHitRatePercent:Sx.optional(),timeToFirstOutputMs:bx.optional(),costSource:F([`publicPrice`,`native`]).optional(),unpricedModels:M(k().min(1)).min(1).optional()}).strict().superRefine((e,t)=>{Object.keys(e).length===0&&t.addIssue({code:`custom`,message:`Thread Usage must contain a reliable field`});let n=e.contextUsedTokens!==void 0;n!==(e.contextWindowTokens!==void 0)&&t.addIssue({code:`custom`,message:`Thread Usage context fields must be provided together`,path:[n?`contextWindowTokens`:`contextUsedTokens`]}),e.contextWindowTokens===0&&t.addIssue({code:`custom`,message:`Thread Usage contextWindowTokens must be greater than zero`,path:[`contextWindowTokens`]}),e.costSource!==void 0&&e.totalCostUsd===void 0&&t.addIssue({code:`custom`,message:`Thread Usage costSource must be provided with totalCostUsd`,path:[`costSource`]}),e.unpricedModels!==void 0&&e.costSource!==`publicPrice`&&t.addIssue({code:`custom`,message:`Thread Usage unpricedModels must be provided with a publicPrice cost`,path:[`unpricedModels`]}),e.planFiveHourResetsAtUnix!==void 0&&e.planFiveHourUsedPercent===void 0&&t.addIssue({code:`custom`,message:`Thread Usage planFiveHourResetsAtUnix must be provided with planFiveHourUsedPercent`,path:[`planFiveHourResetsAtUnix`]}),e.planSevenDayResetsAtUnix!==void 0&&e.planSevenDayUsedPercent===void 0&&t.addIssue({code:`custom`,message:`Thread Usage planSevenDayResetsAtUnix must be provided with planSevenDayUsedPercent`,path:[`planSevenDayResetsAtUnix`]})}),Dx=A().finite().min(0).max(100),Ox=F([`weekly`,`monthly`,`five_hour`,`seven_day`,`unknown`]),kx=N({id:k().min(1).max(256),label:k().min(1).max(256),localizations:dx.optional()}).strict(),Ax=N({product:k().min(1),periodType:Ox.optional(),scope:kx.optional(),localizations:dx.optional(),used:A().finite().nonnegative().optional(),limit:A().finite().nonnegative().optional(),unit:k().min(1).max(32).optional(),usagePercent:Dx,resetsAt:k().min(1).optional()}).strict(),jx=N({availableCount:A().int().safe().positive(),nextExpiresAt:k().min(1).optional(),expiresAt:M(k().min(1)).min(1).max(32).optional()}).strict(),Mx=N({used:A().finite().nonnegative().optional(),limit:A().finite().nonnegative().optional(),unit:k().min(1).max(32).optional(),label:k().min(1).optional(),scope:kx.optional(),localizations:dx.optional(),usedPercent:Dx,resetsAt:k().min(1).optional(),periodType:Ox,productUsage:M(Ax).min(1).optional(),resetCredits:jx.optional()}).strict();N({threadId:hx,refresh:I(`exact`).optional()}).strict(),N({threadId:hx,usage:Ex.nullable(),accountCredits:Mx.optional(),accountCreditsSupported:j().optional()}).strict();let Nx=k().refine(e=>e.trim().length>0,{message:`Value must not be empty or whitespace`}),Px=N({id:Nx.max(512).regex(/^[A-Za-z0-9._~-]+$/u,`Model Ref must use transport-safe opaque characters`).brand()}).strict(),Fx=Nx.max(128).regex(/^[A-Za-z0-9._~-]+$/u,`Thinking option ID must use transport-safe characters`).brand(),Ix=Nx.max(256),Lx=N({id:Fx,label:Nx.max(256)}).strict(),Rx=N({ref:Px,label:Nx.max(256),resolvedModelLabel:Ix.optional(),fastModel:Px.optional(),supportedThinkingOptionIds:M(Fx).optional()}).strict(),zx=M(Lx).superRefine((e,t)=>{let n=/* @__PURE__ */ new Set;for(let[r,i]of e.entries())n.has(i.id)&&t.addIssue({code:`custom`,message:`Thinking option IDs must be unique`,path:[r,`id`]}),n.add(i.id)}),Bx=N({models:M(Rx),defaultModel:Px.optional(),thinkingOptions:zx,defaultThinkingOptionId:Fx.optional()}).strict().superRefine((e,t)=>{let n=/* @__PURE__ */ new Set,r=new Set(e.thinkingOptions.map(({id:e})=>e));for(let[i,a]of e.models.entries()){n.has(a.ref.id)&&t.addIssue({code:`custom`,message:`Model Catalog refs must be unique`,path:[`models`,i,`ref`,`id`]}),n.add(a.ref.id),a.fastModel&&((n.has(a.fastModel.id)||e.models.some(e=>e.ref.id===a.fastModel?.id))&&t.addIssue({code:`custom`,message:`Fast Model refs must be distinct and unique`,path:[`models`,i,`fastModel`]}),n.add(a.fastModel.id));let o=/* @__PURE__ */ new Set;for(let[e,n]of(a.supportedThinkingOptionIds??[]).entries())o.has(n)&&t.addIssue({code:`custom`,message:`Supported Thinking option IDs must be unique per Model`,path:[`models`,i,`supportedThinkingOptionIds`,e]}),o.add(n),r.has(n)||t.addIssue({code:`custom`,message:`Supported Thinking option must exist in the catalog`,path:[`models`,i,`supportedThinkingOptionIds`,e]})}e.defaultModel&&!n.has(e.defaultModel.id)&&t.addIssue({code:`custom`,message:`Default Model must exist in the Model Catalog`,path:[`defaultModel`,`id`]}),e.defaultThinkingOptionId&&!r.has(e.defaultThinkingOptionId)&&t.addIssue({code:`custom`,message:`Default Thinking option must exist in the catalog`,path:[`defaultThinkingOptionId`]})}),Vx=N({fork:j(),forkAcrossCwd:j(),rollbackLastTurn:j()}).strict().refine(e=>e.fork||!e.forkAcrossCwd,{path:[`forkAcrossCwd`],message:`Cross-cwd Fork requires exact history Fork support`}),Hx=F([`live`,`atCreate`]),Ux=N({configuration:N({selectModel:j(),selectThinkingOption:j(),selectPermissionMode:j(),permissionModeScope:Hx.default(`live`)}).strict(),history:Vx,subagents:N({observe:j(),readTranscript:j()}).strict().optional(),autonomousTurns:N({observe:j()}).strict().optional(),steer:j().optional()}).strict();N({effectiveModel:Px.optional(),resolvedModelLabel:Ix.optional(),effectiveThinkingOptionId:Fx.optional(),availableThinkingOptions:zx.optional(),effectivePermissionModeId:vx.optional()}).strict().superRefine((e,t)=>{e.effectiveThinkingOptionId&&e.availableThinkingOptions&&!e.availableThinkingOptions.some(({id:t})=>t===e.effectiveThinkingOptionId)&&t.addIssue({code:`custom`,message:`Effective Thinking option must be currently available`,path:[`effectiveThinkingOptionId`]})});let Wx=N({open:I(!0)}).strict();Ls([N({status:I(`ready`),catalog:Bx,permissionModes:yx.optional(),capabilities:Ux,webUi:Wx.optional()}).strict().superRefine((e,t)=>{let n=e.capabilities.configuration.selectPermissionMode;n!==!!e.permissionModes&&t.addIssue({code:`custom`,message:`Permission Mode catalog and capability must agree`,path:n?[`permissionModes`]:[`capabilities`,`configuration`,`selectPermissionMode`]})}),N({status:F([`notInstalled`,`unavailable`,`error`]),error:cx}).strict()]),N({harnessId:mx,cwd:Nx.max(16384).optional(),refresh:j().optional(),purpose:I(`availability`).optional()}).strict(),N({harnessId:mx}).strict(),N({}).strict(),N({threadId:hx,model:Px}).strict(),N({threadId:hx,thinkingOptionId:Fx}).strict(),N({threadId:hx,includeReferenceCapability:j().optional()}).strict(),zs(`owner`,[N({owner:I(`codex`),locked:j(),effectiveModel:Px.optional(),resolvedModelLabel:Ix.optional(),effectiveThinkingOptionId:Fx.optional(),effectivePermissionModeId:vx.optional(),history:Vx.optional(),supportsThreadReferences:I(!0).optional()}).strict(),N({owner:I(`external`),harnessId:Nx.max(256),transportModelId:Nx.max(1024),effectiveModel:Px.optional(),resolvedModelLabel:Ix.optional(),effectiveThinkingOptionId:Fx.optional(),availableThinkingOptions:zx.optional(),effectivePermissionModeId:vx.optional(),history:Vx,usage:Ex.optional(),locked:I(!0)}).strict()]),N({threadIds:M(hx).min(1).max(100)}).strict().superRefine(({threadIds:e},t)=>{let n=/* @__PURE__ */ new Set;for(let[r,i]of e.entries())n.has(i)&&t.addIssue({code:`custom`,message:`Thread ownership-list IDs must be unique`,path:[`threadIds`,r]}),n.add(i)});let Gx=zs(`owner`,[N({threadId:hx,owner:I(`codex`)}).strict(),N({threadId:hx,owner:I(`external`),harnessId:k().max(256).pipe(mx)}).strict()]);N({threads:M(Gx).min(1).max(100)}).strict().superRefine(({threads:e},t)=>{let n=/* @__PURE__ */ new Set;for(let[r,i]of e.entries())n.has(i.threadId)&&t.addIssue({code:`custom`,message:`Thread ownership-list results must be unique`,path:[`threads`,r,`threadId`]}),n.add(i.threadId)}),N({threadId:hx,text:k().optional()}).strict(),N({kind:I(`application`),value:k().transform((e,t)=>{try{return JSON.parse(e)}catch{return t.addIssue({code:`custom`,message:`Invalid steering context JSON`}),wt}}).pipe(N({expectedTurnId:gx,clientUserMessageId:k().min(1),delivery:F([`newTurn`,`activeTurn`])}).strict())}).strict().transform(e=>e.value),F([`activeTurn`,`newTurn`]),N({delivery:F([`official`,`activeTurn`,`newTurn`])}).strict(),N({threadId:hx}).strict(),N({confirmed:j()}).strict(),N({threadIds:M(k().min(1))}).strict(),N({threadId:k().min(1).max(1024),pinned:j()}).strict(),N({}).strict(),N({parents:Gs(k().min(1),k().min(1))}).strict(),N({prompt:k().max(16384).optional()}).strict(),N({projects:M(N({id:k(),name:k(),rootPaths:M(k())})),assignments:Gs(k(),k()),projectless:M(k()),pinned:M(k())});let Kx=Gs(k(),js()),qx=N({epoch:k().uuid(),sequence:A().int().nonnegative()});zs(`type`,[N({type:I(`skills-changed`),cursor:qx,cwd:k().optional()}),N({type:I(`harness-inspection-changed`),cursor:qx,harnessId:k().min(1)}),N({type:I(`display-settings-changed`),cursor:qx}),N({type:I(`preferences-changed`),cursor:qx,revision:A().int().nonnegative()}),N({type:I(`hello`),version:I(1),cursor:qx,reset:j()}),N({type:I(`changed`),cursor:qx,threadId:k().min(1),method:k().min(1)})]);let Jx=zs(`type`,[N({type:I(`text`),id:k(),prompt:k(),secret:j().optional(),optional:j().optional()}),N({type:I(`choice`),id:k(),prompt:k(),multiple:j(),allowOther:j(),optional:j().optional(),options:M(N({value:k(),label:k(),description:k().optional()}))})]),Yx=zs(`type`,[N({type:I(`approval`),title:k(),description:k().optional(),subject:js().optional(),actions:M(N({id:k(),label:k(),effect:k()}))}),N({type:I(`question`),title:k().optional(),questions:M(Jx)})]),Xx=N({requestId:Ls([k(),A().int()]),threadId:k(),kind:F([`approval`,`question`]),interaction:Yx,request:Kx}),Zx=N({id:k().min(1),clientUserMessageId:k().min(1),input:M(Kx),presentationInput:M(Kx).nullable().optional()}).passthrough();N({fields:M(N({path:M(Ls([k(),A().int().nonnegative()])),originalLength:A().int().nonnegative()}))});let Qx=N({id:k().min(1),status:k().min(1),codexhostTurnOutcome:N({status:I(`unknown`),reason:k()}).optional(),items:M(N({id:k().min(1),type:k().min(1)}).passthrough()),codexhostFileOperations:M(N({beforeItemId:k().nullable(),item:N({id:k().min(1),type:k().min(1)}).passthrough()})).optional(),error:N({message:k().optional()}).passthrough().nullable().optional(),fingerprint:k().min(1).optional(),unchanged:I(!0).optional()}).passthrough(),$x=N({id:k().min(1).max(512),fingerprint:k().min(1).max(128)});N({threadId:k().min(1),knownTurns:M($x).max(64).optional(),truncateToolOutput:j().optional()});let eS=N({harnessId:k().min(1),nativeSessionId:k().min(1)});N({cursor:qx,activeTurnId:k().min(1).nullable().optional(),command:N({name:k().min(1),turn:Qx,subsequentTurnId:k().min(1).optional()}).optional(),thread:N({id:k().min(1),cwd:k(),modelProvider:k().min(1),createdAt:A(),updatedAt:A(),status:N({type:k()}).passthrough(),name:k().nullable().optional(),preview:k().optional(),codexhostImportSource:eS.optional(),turns:M(Qx).length(0)}).passthrough(),turnsPage:N({data:M(Qx).max(5),nextCursor:k().nullable()}),configuration:N({native:N({model:k().min(1).max(1024).optional(),reasoningEffort:k().min(1).max(128).optional()}).optional(),effectiveModel:Px.optional(),effectiveThinkingOptionId:Fx.optional(),effectivePermissionModeId:vx.optional()}),queue:N({items:M(Zx),pausedReason:F([`interrupted`,`outcome-unknown`,`failed`]).nullable()}).optional(),interactions:M(Xx)}),N({version:I(1),owner:I(`service`).optional(),pid:A().int().positive(),port:A().int().min(1).max(65535),token:k().regex(/^[0-9a-f]{64}$/u),startedAt:A(),epoch:k().uuid()}),N({epoch:k().uuid(),threadId:k().min(1),requestId:Ls([k(),A().int()]),result:Kx}),N({includeArchived:j().optional(),officialCursor:N({live:k().nullable(),archived:k().nullable().optional()}).strict().optional()}).strict(),N({threads:M(sx),ownership:M(Gx),archivedThreadIds:M(hx),officialCursor:N({live:k().nullable(),archived:k().nullable().optional()}).strict().optional()}).strict();let tS=k().regex(/^audio\/[a-z0-9.+-]+(?:\s*;[^\r\n]*)?$/i);N({available:j()}).strict(),N({path:k().min(1),mimeType:tS}).strict();let nS=F([`credentials-unavailable`,`login-expired`,`rate-limited`,`service-rejected`,`host-incompatible`,`network`,`timeout`,`audio-empty`,`audio-too-large`,`audio-format`,`audio-invalid`]);zs(`ok`,[N({ok:I(!0),text:k()}).strict(),N({ok:I(!1),error:N({code:nS}).strict()}).strict()]),N({threadId:hx.optional(),cwd:k().min(1).optional()}).strict().refine(e=>!(e.threadId&&e.cwd),{message:`Specify threadId or cwd, not both`});let rS=N({name:k().min(1).regex(/^[^\s[\]]+$/u),description:k().optional(),path:k().min(1),scope:F([`project`,`global`]),source:k().min(1)}).strict();N({revision:A().int().nonnegative(),complete:j(),skills:M(rS),warnings:M(k()).optional()}).strict(),N({cwd:k().min(1).optional()}).strict();let iS=/\[\$([^\]\r\n]+)\]\((?:<([^<>\r\n]+)>|([^\s()]+))(?:[ \t]+(?:"[^"\r\n]*"|'[^'\r\n]*'))?\)/gu;function aS(e){return[...e.matchAll(iS)].flatMap(e=>{let t=e[2]??e[3]??``;return!/^(?:\/|[A-Za-z]:[\\/]|\\\\)/u.test(t)||!/[\\/]SKILL\.md$/u.test(t)?[]:[{start:e.index,end:e.index+e[0].length,name:e[1]??``,path:t,text:e[0]}]})}let oS=N({kind:F([`public`,`relay`,`tailscale-funnel`,`tailscale-https`,`tailscale`,`lan`,`virtual`]),url:k().min(1)}).strict(),sS=zs(`status`,[N({status:I(`not-installed`)}),N({status:I(`not-running`)}),N({status:I(`not-logged-in`)}),N({status:I(`https-disabled`)}),N({status:I(`not-serving`),command:k()}),N({status:I(`occupied`),target:k()}),N({status:I(`serving`),url:k(),funnel:j()}),N({status:I(`error`),message:k()})]);N({state:sS,error:k().optional()}).strict();let cS=zs(`status`,[N({status:I(`on`)}),N({status:I(`off`)}),N({status:I(`invalid`),reason:k()})]),lS=N({lan:j(),autostart:cS}).strict(),uS=N({expiresAt:k().optional(),issuing:j(),failure:N({detail:k().optional(),retryAt:k(),paused:j()}).optional()}),dS=zs(`status`,[N({status:I(`off`),reason:F([`invite`,`name-taken`,`banned`]).optional()}),N({status:I(`connecting`),reason:F([`full`,`unreachable`]).optional()}),N({status:I(`connected`),url:k(),certificate:uS}),N({status:I(`missing-certificate`),url:k(),certificate:uS}),N({status:I(`stopped`),reason:F([`replaced`,`rejected`,`unsupported-version`])})]);k().max(253).regex(/^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z](?:[a-z0-9-]{0,61}[a-z0-9])?$/i).transform(e=>e.toLowerCase()),k().regex(/^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)?$/);let fS=F([`official`,`self-hosted`]);N({secret:k().min(1),lastUsedAt:A().nullable(),networkUrls:M(oS),directCandidates:M(oS).optional(),tailscale:sS,background:lS.optional(),relay:N({state:dS,enabled:j(),kind:fS,officialHost:k(),customHost:k().optional(),officialHostname:k().optional(),customHostname:k().optional(),quotaUntil:k().optional()}).strict().optional()}).strict();let pS=P({threadId:k().min(1).max(1024),view:F([`result`,`messages`]),from:A().int().min(1).max(2**53-1).optional(),to:A().int().min(1).max(2**53-1).optional()}),mS=N({id:k().min(1).max(256),harnessId:k().min(1),label:k().min(1).max(512),provider:F([`openai-codex`,`xai`])}).strict(),hS=k().regex(/^[a-z][a-z0-9-]{0,47}$/),gS=N({name:hS,source:mS,importedAt:k()}).strict(),_S=zs(`action`,[N({action:I(`list`)}).strict(),N({action:I(`import`),sourceId:k().min(1).max(256),name:hS,confirmed:I(!0)}).strict(),N({action:I(`reimport`),sourceId:k().min(1).max(256),name:hS,confirmed:I(!0)}).strict(),N({action:I(`remove`),name:hS,confirmed:I(!0)}).strict()]),vS=N({provider:k().min(1).max(128),type:F([`oauth`,`api_key`,`unknown`]),label:k().min(1).max(512).optional(),vendor:F([`openai-codex`,`xai`]).optional()}).strict();N({sources:M(mS),targets:M(N({harnessId:k(),providers:M(F([`openai-codex`,`xai`])),imports:M(gS),others:M(vS).default([])}).strict())}).strict(),N({targetHarnessId:k().min(1).max(128).optional(),request:_S}).strict(),N({events:j()});let yS=M(P({agent:k().min(1).max(128),section:F([`main`,`more`,`auto`])})).max(256).refine(e=>new Set(e.map(e=>e.agent)).size===e.length,`Duplicate Harness IDs`);P({entries:yS.nullable()}),P({}),P({entries:yS,initializeOnly:j().optional()});let bS=P({enabled:j(),timeoutMinutes:A().int().min(5).max(1440)});Object.freeze({enabled:!1,timeoutMinutes:10});let xS=k().regex(/^external$/u),SS=mx.transform(e=>String(e)),CS=P({model:Px.optional(),thinkingOptionId:Fx.optional(),permissionModeId:vx.optional()}).refine(e=>!!(e.model||e.thinkingOptionId||e.permissionModeId),`A default configuration must contain a preference`),wS=P({lastHarness:mx.optional(),byHarness:Gs(SS,CS)}),TS=k().min(1).max(1024),ES=P({idleRelease:bS.optional(),favorites:Gs(SS,M(TS).max(2048)).default({}),newThread:wS.optional()});P({scope:xS,revision:A().int().nonnegative(),values:ES}),P({scope:xS.default(`external`)});let DS=zs(`kind`,[P({kind:I(`idleRelease`),value:bS}),P({kind:I(`favorite`),harnessId:mx,modelId:TS,enabled:j()}),P({kind:I(`favorites`),harnessId:mx,modelIds:M(TS).max(2048)}),P({kind:I(`newThread`),lastHarness:mx.optional(),harnessId:mx.optional(),configuration:CS.optional()})]);P({scope:xS.default(`external`),operations:M(DS).min(1).max(256),initializeOnly:j().optional(),expectedRevision:A().int().nonnegative().optional()}).superRefine((e,t)=>{for(let n of e.operations)n.kind===`newThread`&&(!n.lastHarness&&!n.configuration||!!n.harnessId!=!!n.configuration)&&t.addIssue({code:`custom`,message:`A default Harness or complete configuration is required`})}),P({version:I(1),revision:A().int().nonnegative(),scopes:Gs(xS,ES)});let OS=A().finite().nonnegative(),kS=P({input:OS,output:OS,cacheRead:OS.optional(),cacheWrite:OS.optional(),cacheWrite1h:OS.optional()}),AS=k().max(512).refine(e=>e.trim()===e&&e.length>0,`Model ID is required`);P({path:k(),entries:M(P({key:k(),price:kS})),error:k().nullable()}),P({}),P({key:AS,price:kS.nullable(),previousKey:AS.optional()}),P({model:AS});let jS=P({official:j().optional(),canonicalModelId:k().min(1).optional(),provider:k().min(1).max(512),model:k().min(1).max(512),price:kS});P({price:kS.nullable(),suggestions:M(jS).max(6).optional()});let MS=[`today`,`7d`,`30d`,`90d`,`all`],NS=A().int().min(0).max(2**53-1),PS=k().regex(/^\d{4}-\d{2}-\d{2}$/u),FS=k().min(1).max(128),IS=k().min(1).max(512),LS=k().min(1).max(4096);P({range:F(MS),timeZone:k().min(1).max(128).refine(e=>{try{return new Intl.DateTimeFormat(`en`,{timeZone:e}),!0}catch{return!1}},`Unsupported usage statistics timezone`).optional(),harness:FS.optional(),model:IS.nullable().optional(),project:LS.nullable().optional(),date:PS.optional()});let RS=P({requests:NS,inputTokens:NS,cachedInputTokens:NS,cacheWriteInputTokens:NS,cacheKnownInputTokens:NS,cacheHitCachedInputTokens:NS,cacheHitInputTokens:NS,outputTokens:NS,reasoningOutputTokens:NS,costUsd:A().finite().min(0),unpricedRequests:NS,unmeteredRequests:NS}),zS=RS.shape,BS=P({harness:FS,sessionId:k().min(1).max(512),project:LS.nullable(),title:k().min(1).max(200).optional(),models:M(IS).max(16),firstAtMs:NS,lastAtMs:NS,...zS});P({range:F(MS),from:PS.nullable(),to:PS,filters:P({harness:FS.nullable(),model:IS.nullable(),unknownModel:j(),project:LS.nullable(),unknownProject:j(),date:PS.nullable()}),reading:P({complete:j(),sources:NS,read:NS}),failures:M(P({harness:FS,message:k().max(2048)})).max(256),options:P({harnesses:M(FS).max(256),models:M(IS.nullable()).max(4096),projects:M(LS.nullable()).max(4096)}),modelLabels:M(P({harness:FS,model:IS,label:IS})).max(4096).optional(),credits:M(P({harness:FS,model:IS.nullable(),credits:A().finite().min(0),reportedRequests:NS,requests:NS})).max(4096).optional(),totals:RS,daily:M(P({date:PS,harness:FS,...zS})).max(2e5),hourly:M(P({weekday:A().int().min(0).max(6),hour:A().int().min(0).max(23),...zS})).max(168),byHarness:M(P({harness:FS,...zS})).max(256),byModel:M(P({model:IS.nullable(),...zS,harnessPricedRequests:NS})).max(4096),byProject:M(P({project:LS.nullable(),...zS})).max(4096),sessions:M(BS).max(100),recentSessions:M(BS).max(100).optional()}),N({threadId:hx}),N({discarded:j()});let VS=zs(`type`,[N({id:k().min(1),type:I(`choice`),prompt:k(),options:M(N({value:k().min(1),label:k(),description:k().optional()})).min(1),multiple:j(),allowOther:j(),optional:j()}),N({id:k().min(1),type:I(`text`),prompt:k(),multiline:j(),secret:I(!1),optional:j(),placeholder:k().optional(),prefill:k().optional()})]),HS=N({interactionId:k().min(1),turnId:k().min(1),title:k().optional(),questions:M(VS).min(1)}).refine(({questions:e})=>e.some(e=>e.type===`choice`&&e.multiple),{message:`Shared cards require at least one multi-select question`});P({threadId:k().min(1)}),N({questions:M(HS)}),P({threadId:k().min(1),turnId:k().min(1),interactionId:k().min(1),answers:Gs(k(),M(k())),cancelled:j().default(!1)}),N({accepted:I(!0)});let US=N({path:k(),oldText:k().nullable(),newText:k()});N({sessionId:k().min(1),turn:A().int().nonnegative(),path:k().min(1).optional()}),N({diffs:M(US)}),P({}),P({}),N({reference:N({sessionId:k().min(1),epoch:k().min(1),turn:A().int().nonnegative(),seq:A().int().nonnegative(),callId:k().min(1),part:A().int().nonnegative(),version:k().min(1)}),length:A().int().nonnegative(),bytes:A().int().nonnegative()}),P({title:k().trim().min(1).max(200),type:F([`info`,`warning`,`danger`]),body:k().trim().min(1).max(16384)}),P({}),P({url:k().max(2048).regex(/^http:\/\/(?:127\.0\.0\.1|localhost):\d{1,5}\/(?:\?.*)?$/u)}),Object.freeze(/* @__PURE__ */ `codexhost/console/remote-connections.codexhost/runtime/status.codexhost/remote/ssh-setup.codexhost/harness/plugins/list.codexhost/harness/display-settings/capabilities.codexhost/harness/display-settings/get.codexhost/harness/display-settings/set.codexhost/harness/inspect.codexhost/harness/installation.codexhost/harness/installation/start.codexhost/harness/installation/status.codexhost/harness/launch-settings/get.codexhost/harness/launch-settings/set.codexhost/harness/web-ui/open.codexhost/harness/accounts/sources.codexhost/harness/accounts/list.codexhost/harness/accounts/inspect.codexhost/harness/credential-imports.codexhost/harness/session-import/sources.codexhost/harness/session-import/list.codexhost/harness/session-import/import.codexhost/account/list.codexhost/account/refresh.codexhost/account/usage/inspect.codexhost/usage/model-prices/get.codexhost/usage/model-prices/set.codexhost/usage/model-prices/default.codexhost/usage/statistics/get.codexhost/update/check.codexhost/update/start.codexhost/update/status`.split(`.`));let WS=F([`idle`,`running`,`busy`,`closing`,`failed`,`blocked`]),GS=F([`none`,`disabled`,`timeout`,`operation`,`background`,`identity`,`persistence`,`closeFailed`]);P({threadId:k(),title:k(),harnessId:k(),state:WS,reason:GS,inactiveMs:A().nonnegative()}),P({threadId:hx,turnId:gx});let KS=N({amount:A().finite().nonnegative(),currency:k().trim().min(1).max(8),label:k().trim().min(1).max(128).optional()}).strict(),qS=N({email:k().trim().min(1).max(320).optional(),label:k().trim().min(1).max(256).optional(),plan:k().trim().min(1).max(128).optional(),credits:Mx.optional(),balance:KS.optional()}).strict();function JS(e){return e.refine(e=>{let t=e;return t.credits!==void 0||t.balance!==void 0},{message:`Account must report either credits or a balance`})}let YS=JS(qS),XS={harnessId:mx,harnessName:k().trim().min(1).max(128)},ZS=N(XS).strict();N({}).strict(),N({sources:M(ZS).max(128)}).strict(),N({harnessId:mx,refresh:j().optional()}).strict(),N({...XS,account:YS.nullable(),accounts:M(YS).max(8).optional()}).strict(),N({refresh:j().optional()}).strict(),N({accounts:M(JS(qS.extend(XS))).max(128)}).strict();let QS=k().min(1).max(128).regex(/^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/u).pipe(mx),$S=QS.refine(e=>e!==`codex`,`The official Codex identity is reserved`),eC=k().min(1).max(512).refine(e=>!/[\\\u0000:#?]/u.test(e)&&!e.startsWith(`/`)&&!e.split(`/`).some(e=>e===`..`||e===``),`Plugin resources must be relative paths inside the plugin`),tC=cs().refine(e=>/^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(e),`Plugin documentation links must be credential-free HTTPS URLs`),nC=N({en:k().max(4096),"zh-CN":k().max(4096).optional()}).strict(),rC=N({commands:M(N({terminal:k().max(256),command:k().max(4096)}).strict()).max(8),before:nC.optional(),after:nC.optional(),downloads:M(N({label:k().max(128),url:tC}).strict()).max(8).optional()}).strict(),iC={id:QS,name:k().trim().min(1).max(128),version:k().min(1).max(128),kind:I(`usage`).optional(),iconStyle:N({vector:N({viewBox:k().max(128).regex(/^-?\d+(?:\.\d+)?(?: +-?\d+(?:\.\d+)?){3}$/u),color:k().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu),paths:M(N({d:k().min(1).max(32768).regex(/^[MmLlHhVvCcSsQqTtAaZz\d.,+eE\s-]+$/u),fillRule:F([`evenodd`,`nonzero`]).optional(),fill:k().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu).optional()}).strict()).min(1).max(32)}).strict().optional(),background:k().regex(/^#[a-f0-9]{6}$/iu).optional(),borderRadius:A().min(0).max(50).optional(),paddingRatio:A().min(0).max(.25).optional()}).strict().optional(),installation:rC.optional(),notice:nC.optional(),launchCommand:I(!0).optional(),links:N({website:tC.optional(),documentation:tC.optional(),installation:tC.optional()}).strict().optional()};N({manifestVersion:I(1),...iC,adapterApiVersion:A().int().positive(),entry:eC,icon:eC.optional()}).strict();let aC=k().max(174828).regex(/^data:image\/(?:png|jpeg|webp|svg\+xml);base64,[A-Za-z0-9+/]+={0,2}$/u),oC=N({...iC,icon:aC.optional()}).strict();N({}).strict(),N({plugins:M(oC.extend({id:$S})).max(128)}).strict(),N({version:I(1),enabled:M(QS).max(128)}).strict().refine(e=>new Set(e.enabled).size===e.enabled.length,{message:`Enabled plugin IDs must be unique`,path:[`enabled`]}),N({harnessId:$S,model:Px.optional(),thinkingOptionId:Fx.optional(),permissionModeId:vx.optional(),prewarm:I(!0).optional()}).strict();let sC=k().trim().min(1).max(4096).refine(e=>!/[\u0000\r\n]/u.test(e),`Invalid entrypoint path`);N({harnessId:$S}).strict().extend({path:sC.nullable()}),N({path:sC.nullable(),restartRequired:j()}).strict(),N({harnessId:mx,action:F([`check`,`update`,`install`])}).strict();let cC=N({currentVersion:k().min(1).max(128),latestVersion:k().min(1).max(128),updateAvailable:j(),canUpdate:j(),versionKind:F([`cli`,`application`]).optional(),manualUpdateUrl:cs().max(2048).refine(e=>/^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(e),`Manual updates require a credential-free HTTPS URL`).optional(),message:k().max(2048).optional(),messageCode:k().min(1).max(128).optional(),notice:fx.optional(),latestVersionKind:F([`unknown`,`tracking-branch`]).optional()}).strict();N({taskId:k().uuid()}).strict(),zs(`status`,[N({taskId:k().uuid(),status:I(`running`)}).strict(),N({taskId:k().uuid(),status:I(`succeeded`),result:cC}).strict(),N({taskId:k().uuid(),status:I(`failed`),error:N({code:A().int(),message:k().min(1).max(2048)}).strict()}).strict()]);let lC=k().min(1).max(256).regex(/^[A-Za-z0-9._~-]+$/u),uC=k().trim().min(1),dC=F([`free`,`go`,`plus`,`pro`,`prolite`,`team`,`self_serve_business_prolite`,`self_serve_business_usage_based`,`business`,`ent26`,`enterprise_cbp_automation`,`enterprise_cbp_usage_based`,`enterprise`,`edu`,`edu_plus`,`edu_pro`,`unknown`]),fC=N({accountId:lC,label:uC.max(256),email:k().email().max(320).optional(),planType:dC.optional()}).strict(),pC=F([`ready`,`unavailable`]);N({version:I(2),currentAccountId:lC.nullable(),phase:pC,revision:A().int().nonnegative(),instanceId:uC.max(1024).optional(),accounts:M(fC).max(1)}).strict(),N({accountId:lC,refresh:j().optional()}).strict(),N({accountId:lC,usage:Ex.nullable(),accountCredits:Mx.optional(),freshness:F([`live`,`cached`]),observedAt:k().datetime().nullable()}).strict();let mC=1e3,hC=k().refine(e=>e.trim().length>0,`Value must not be empty or whitespace`).refine(e=>!e.includes(`\0`),`Value must not contain NUL`),gC=hC.max(1024),_C=N({nativeSessionId:gC,title:hC.max(4096).nullable(),updatedAt:A().int().nonnegative().max(864e13),cwd:hC.max(16384),running:j().nullable()}).strict();N({}).strict(),N({harnesses:M(N({harnessId:$S,name:hC.max(128)}).strict()).max(128)}).strict(),N({harnessId:$S,query:k().trim().max(4096).refine(e=>!e.includes(`\0`)).optional(),offset:A().int().nonnegative().safe().optional(),limit:A().int().min(1).max(mC).optional()}).strict(),N({candidates:M(_C).max(mC),total:A().int().nonnegative().safe()}).strict(),N({harnessId:$S,nativeSessionId:gC}).strict(),N({threadId:hC.max(1024).pipe(hx)}).strict();let vC=k().refine(e=>e.trim().length>0,`Value must not be empty or whitespace`).refine(e=>!e.includes(`\0`),`Value must not contain NUL`),yC=gC,bC=_C;N({}).strict(),N({candidates:M(bC).max(1e3)}).strict(),N({nativeSessionId:yC}).strict(),N({threadId:vC.max(1024).pipe(hx)}).strict(),N({threadId:hx,lastTurnId:gx}).strict(),N({threadId:hx}).strict();let xC=k().trim().min(1).max(128).regex(/^[A-Za-z0-9._:-]+$/u).brand();N({commands:M(N({id:xC,invocation:k().min(1).max(128),label:k().trim().min(1).max(128),description:k().trim().min(1).max(512).optional(),localizations:dx.optional(),argumentMode:F([`none`,`text`]),kind:F([`command`,`skill`]).optional()}).strict()),warnings:M(k().min(1)).optional(),source:F([`live`,`static`]).optional()}).strict().superRefine((e,t)=>{let n=/* @__PURE__ */ new Set;for(let[r,i]of e.commands.entries())n.has(i.id)&&t.addIssue({code:`custom`,message:`Harness command IDs must be unique`,path:[`commands`,r,`id`]}),n.add(i.id)}),N({harnessId:mx,cwd:k().min(1).optional()}).strict(),N({threadId:hx}).strict(),N({threadId:hx,commandId:xC,turnId:gx.optional(),arguments:sx.optional()}).strict(),N({accepted:I(!0),turnId:gx.optional()}).strict();let SC=I(`2.0`).optional(),CC=Ns().optional(),wC=k().min(1),TC=Ls([k(),A().int()]),EC=N({code:A().int(),message:k(),data:ox.optional()}).catchall(ox).superRefine(tx([`data`]));Ls([N({jsonrpc:SC,id:TC,method:wC,params:ox.optional(),result:CC,error:CC}).catchall(ox).superRefine(tx([`jsonrpc`,`params`,`result`,`error`])),N({jsonrpc:SC,id:CC,method:wC,params:ox.optional(),result:CC,error:CC}).catchall(ox).superRefine(tx([`jsonrpc`,`id`,`params`,`result`,`error`])),N({jsonrpc:SC,id:TC,method:CC,params:CC,result:ox,error:CC}).catchall(ox).superRefine(tx([`jsonrpc`,`method`,`params`,`error`])),N({jsonrpc:SC,id:TC,method:CC,params:CC,result:CC,error:EC}).catchall(ox).superRefine(tx([`jsonrpc`,`method`,`params`,`result`]))]);let DC=k().refine(e=>e.trim().length>0,{message:`Native identifier must not be empty or whitespace`});P({harnessId:mx,nativeSessionId:DC,locator:ox.optional(),formatVersion:I(1)}).superRefine(tx([`locator`])),P({harnessId:mx,nativeSessionId:DC,nativeTurnKey:DC,formatVersion:I(1)}),P({harnessId:mx,nativeSessionId:DC,checkpointId:DC,locator:ox.optional(),formatVersion:I(1)}).superRefine(tx([`locator`]));let OC=k().regex(/^\d+\.\d+\.\d+(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/u),kC=F([`npm`,`windows-installer`,`macos-dmg`]),AC=P({version:OC,installation:kC,phase:F([`prepared`,`downloading`,`waiting-for-exit`,`installing`,`restarting`,`succeeded`,`failed`]),updatedAt:A().int().nonnegative(),downloadedBytes:A().int().nonnegative().optional(),totalBytes:A().int().positive().optional(),error:k().min(1).max(500).nullable(),serviceStopOutput:k().optional()}).superRefine((e,t)=>{e.downloadedBytes!==void 0&&e.totalBytes!==void 0&&e.downloadedBytes>e.totalBytes&&t.addIssue({code:`custom`,path:[`downloadedBytes`],message:`downloadedBytes must not exceed totalBytes`})});P({});let jC=k().max(300).regex(/^https:\/\/github\.com\/BytePioneer-AI\/codex-host\/releases\/tag\/v[0-9A-Za-z.+-]+$/u,`release notes URL must identify a codexhost GitHub Release`);P({currentVersion:OC,installation:kC.nullable(),latestVersion:OC.nullable(),updateAvailable:j(),installationAvailable:j(),releaseNotes:k().min(1).max(2e4).nullable(),releaseNotesUrl:jC.nullable(),status:AC.nullable(),error:k().min(1).max(500).nullable()}),P({status:AC}),P({status:AC.nullable()}),RegExp(String.raw`^- \[([^\]\n]+)\]\(thread://([^\s()<>"?#/]+)\): `+`(${[`completed`,`failed`,`interrupted`,`needsInput`,`timedOut`,`unreadable`,`notFound`].join(`|`)})(?:\. (.+))?$`,`u`);function MC(e){if(e.length===0)return``;let t=e.map(({text:e,annotation:t})=>({text:e,...t===void 0?{}:{annotation:t}}));return`\n# Response annotations:\nEach item contains text selected from an earlier Codex response and may include a user comment. Treat items as Annotation 1, Annotation 2, and so on in array order. Use every selection as context and address every comment. For every annotation you address, include its inline directive \`:codex-annotation{index="N"}\`, where N is its one-based array position (for example, \`:codex-annotation{index="1"}\`). Do not use unstructured annotation labels.\n<response-annotations>\n${JSON.stringify(t)}\n</response-annotations>\n`}function NC(e,t){let n=MC(e);return n===``?t:`${n}\n## My request:\n${t}\n`}let PC=F([`idle`,`installing`,`restarting`,`succeeded`,`failed`]);N({runningVersion:k().nullable(),installedVersion:k().nullable(),restartRequired:j(),remote:j(),updateSupported:j(),update:N({phase:PC,targetVersion:k().nullable(),error:k().nullable()})});let FC=N({version:k().regex(/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/u)}).strict();N({hostname:k().min(1).max(1024).refine(e=>!e.startsWith(`-`)&&!/\s/u.test(e)),port:A().int().min(1).max(65535).nullable(),identity:k().max(4096).nullable(),action:F([`inspect`,`install`,`update`,`repair`,`uninstall`]),uninstallPackage:j().optional(),version:k().regex(/^\d+\.\d+\.\d+$/u).nullable()}).strict(),N({state:F([`installed`,`not-installed`])}).strict();let IC=k().min(1).max(1024),LC={hostId:IC.regex(/^remote-(?:ssh(?:-|:)|control:)/u)},RC={...LC,threadId:IC},zC=zs(`kind`,[P({kind:I(`hosts`)}),P({kind:I(`status`),...RC}),P({kind:I(`list`),...LC,cursor:k().nullable(),archived:j()}),P({kind:I(`read`),...RC,page:P({cursor:k().min(1).max(8192).nullable(),epoch:IC.optional(),sortDirection:F([`asc`,`desc`]).optional(),limit:A().int().min(1).max(20).optional()}).refine(e=>e.cursor===null||e.epoch!==void 0,{message:`A history continuation requires its connection epoch`}).optional()}),P({kind:I(`configure`),...RC,epoch:IC,modelId:IC.optional(),thinkingOptionId:IC.optional(),permissionModeId:IC.optional()}).refine(e=>[e.modelId,e.thinkingOptionId,e.permissionModeId].filter(e=>e!==void 0).length===1,`Select exactly one remote setting`),P({kind:I(`prompt`),...RC,epoch:IC,text:k().min(1).max(8e3),requestId:IC.optional()}),P({kind:I(`interrupt`),...RC,epoch:IC,turnId:IC}),P({kind:I(`rename`),...RC,epoch:IC,name:k().min(1).max(512)}),P({kind:I(`archive`),...RC,epoch:IC,archived:j()}),P({kind:I(`respond`),...RC,epoch:IC,requestId:Ls([IC,A().int()]),result:Gs(k(),js())})]),BC=k().min(1).max(1024),VC=N({hostId:BC,displayName:k().min(1).max(1024),source:F([`codex-managed`,`discovered`]),sshAlias:k().max(1024).nullable(),sshHost:k().min(1).max(1024),sshPort:A().int().min(1).max(65535).nullable(),identity:k().max(4096).nullable(),autoConnect:j(),connectionAnalyticsId:k().max(1024).optional()}),HC=P({displayName:k().min(1).max(1024),hostname:k().min(1).max(1024),sshPort:A().int().min(1).max(65535).nullable(),identity:k().max(4096).nullable()});zs(`action`,[P({action:I(`session`),operation:zC}),P({action:I(`list`)}),P({action:I(`catalog`)}),P({action:I(`read-thread`),hostId:BC.refine(e=>e!==`local`),input:pS}),P({action:I(`save`),draft:HC,previous:VC.nullable()}),P({action:I(`remove`),previous:VC}),P({action:I(`connect`),hostId:BC,enabled:j()}),P({action:I(`state`),hostId:BC}),P({action:I(`runtime`),hostId:BC}),P({action:I(`update`),hostId:BC.refine(e=>e!==`local`),version:FC.shape.version})]),Ls([P({result:ox}),P({error:P({code:A().int(),message:k()})})]),P({prompt:k().trim().min(1).max(2e3),cwd:k().max(4096).nullable()}),k().trim().min(1).max(60).nullable();let UC=k().max(214).regex(/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/u),WC=Ls([k(),N({en:k()}).catchall(k())]),GC=N({title:WC.optional(),description:WC.optional(),icon:k().max(349592).regex(/^data:image\/(?:svg\+xml|png|jpeg|webp);base64,[A-Za-z0-9+/]*={0,2}$/u).optional(),error:k().optional()});N({extensions:M(N({id:UC,name:k().min(1).max(214),version:k().min(1).max(128),format:I(`dsh`),supportedTargets:Us([I(`web`)]),enabledTargets:M(I(`web`)).max(1),source:k().min(1).max(4096),projectUrl:k().max(4096).url({protocol:/^https?$/u}).optional(),installedAt:k(),meta:GC.optional(),loadError:k().optional()})),loadedIds:M(UC),safeMode:j(),storeError:k().optional()});let KC=k().trim().max(2048).url({protocol:/^https?$/u,normalize:!0}).refine(e=>!/[\s\\?#]/u.test(e)&&!e.split(`/`)[2]?.includes(`@`),`Use an HTTP(S) registry URL without credentials, a query, or a fragment.`).transform(e=>e.endsWith(`/`)?e:`${e}/`);N({spec:k().trim().min(1).max(4096),registry:KC.optional()}).strict(),N({id:UC,enabled:j()}).strict(),N({id:UC}).strict(),I(1);function qC(e){return e.registerNodeTransform(Ff,e=>{let t=aS(e.getTextContent())[0];t&&e.splitText(t.start,t.end)[t.start===0?0:1]?.replace(new zb({source:`codexhost-skill`,ref:t.text,label:t.name,appearance:`skill`,clipboardText:t.text}))})}let JC=`color: var(--dsw-alias-state-business-primary)`;function YC(){let e=wh().getFirstChild();if(!G(e))return null;let t=e.getFirstChild();return V(t)?t:null}function XC(e,t){return e.registerNodeTransform(Ff,e=>{let n=YC();if(n===null||e.getKey()!==n.getKey()){e.getStyle()===JC&&e.setStyle(``);return}let r=e.getTextContent(),i=t(),a=r===i?.trimEnd()?r:i;if(a===null||!r.startsWith(a))e.getStyle()===JC&&e.setStyle(``);else if(r.length>a.length){let[t,n]=e.splitText(a.length);t!==void 0&&t.getStyle()!==JC&&t.setStyle(JC),n?.setStyle(``)}else e.getStyle()!==JC&&e.setStyle(JC)})}function ZC(e){e.update(()=>{YC()?.markDirty()})}function QC(){let e=[],t=/* @__PURE__ */ new Map,n=/* @__PURE__ */ new Map,r=/* @__PURE__ */ new Map,i=``,a=``,o=(n,r,o,s)=>{let c={kind:n,node:r,detectStart:i.length,detectLength:o.length,clipboardStart:a.length,clipboardLength:s.length};e.push(c),t.set(r.getKey(),c),i+=o,a+=s},s=e=>{let t=i.length,a=e.getChildren();n.set(e.getKey(),a.map(e=>e.getKey()));for(let e of a)if(Vb(e))o(`chip`,e,``,e.getTextContent());else if(V(e)){let t=e.getTextContent();o(`text`,e,t,t)}else Mm(e)?o(`linebreak`,e,`
|
|
155
|
+
`}isInline(){return!1}updateDOM(){return!1}};function Ay(){return{node:jy()}}function jy(){return n_(ky)}Date.now;function My(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);throw 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.`)}let Ny;function Py(e,t){let{key:n}=t;return e&&n in e?e[n]:t.defaultValue}function Fy(e){return Ny&&Ny.editor===e?Ny:void 0}function Iy(e,t){if(`cfg`in t){let{cfg:n,updater:r}=t;return[n,r(Py(e,n))]}return t}function Ly(e,t){let n=t;for(let r of e){let[e,i]=Iy(n,r),a=e.key;if(n===t&&Py(n,e)===i)continue;let o=n===t||n===void 0?Ry(t):n;o[a]=i,n=o}return n}function Ry(e){return Object.create(e||null)}function zy(e,t){return[e,t]}function By(e,t,n,r=Pg()){let i=Ny,a=Fy(r);try{return Ny={...a,editor:r,[e]:t},n()}finally{Ny=i}}function Vy(e,t=()=>{}){return(n,r=Pg())=>i=>{let a=Fy(r),o=a&&a[e],s=Ly(n,o||t(r));return s&&s!==o?By(e,s,i,r):i()}}function Hy(e,t,n,r){return Object.assign(zl(Symbol(t),{isEqual:r,parse:n}),{[e]:!0})}let Uy=`@lexical/html/DOM`,Wy=Symbol.for(`@lexical/html/DOMExportContext`);function Gy(e,t,n){return Hy(Wy,e,t,n)}let Ky=/* @__PURE__ */ Gy(`isExport`,Boolean);function qy(e){let t=Oy(e,Uy);return t?t.output.defaults:void 0}function Jy(e){let t=Oy(e,Uy);return t?t.output.runtime:void 0}function Yy(e=Pg()){let t=Jy(e);return t?t.getSessionConfig():Fg(e)}let Xy=Vy(Wy,qy),Zy=Symbol.for(`@lexical/html/SelectorImpl`);function Qy(e,t){let n={kind:`element`,predicate:(r=t,r.length===0?Y:r.length===1?r[0]:(e,t)=>{for(let n of r)if(!n(e,t))return!1;return!0}),tags:e};var r;let i=n=>Qy(e,[...t,n]);return{[Zy]:n,attr:(e,t,n)=>i(tb(e,t,n)),classAll:(...e)=>i(eb(e)),classAny:(...e)=>i(function(e){let t=$y(e);return t.length===0?()=>!1:e=>{if(!Y(e))return!1;let n=e.classList;for(let e of t)if(n.contains(e))return!0;return!1}}(e)),styleAny:(e,t,n)=>i(function(e,t,n){if(typeof t==`string`)return n=>Y(n)&&n.style.getPropertyValue(e)===t;if(t instanceof RegExp){let r=n&&n.capture,i=t;return(t,n)=>{if(!Y(t))return!1;let a=t.style.getPropertyValue(e);if(!a)return!1;let o=a.match(i);return o!==null&&(r!==void 0&&(n[r]=o),!0)}}My(362,JSON.stringify(e))}(e,t,n))}}function $y(e){let t=[];for(let n of e)n&&t.push(n);return t}function eb(e){let t=$y(e);return t.length===0?()=>!0:e=>{if(!Y(e))return!1;let n=e.classList;for(let e of t)if(!n.contains(e))return!1;return!0}}function tb(e,t,n){if(!0===t)return t=>Y(t)&&t.hasAttribute(e);if(typeof t==`string`)return n=>Y(n)&&n.getAttribute(e)===t;if(t instanceof RegExp){let r=n&&n.capture,i=t;return(t,n)=>{if(!Y(t))return!1;let a=t.getAttribute(e);if(a==null)return!1;let o=a.match(i);return o!==null&&(r!==void 0&&(n[r]=o),!0)}}My(361,JSON.stringify(e))}let nb={kind:`text`,predicate:ch,tags:/* @__PURE__ */ new Set},rb={[Zy]:nb},ib={kind:`comment`,predicate:e=>e.nodeType===8,tags:/* @__PURE__ */ new Set},ab={[Zy]:ib},ob={any:()=>Qy(/* @__PURE__ */ new Set,[]),comment:()=>ab,tag(...e){e.length>0||My(363);let t=/* @__PURE__ */ new Set;for(let n of e)t.add(n.toUpperCase());return Qy(t,[])},text:()=>rb},sb=ob;sb.tag(`b`,`strong`,`em`,`i`,`code`,`mark`,`s`,`sub`,`sup`,`u`,`span`),sb.text(),sb.tag(`script`,`style`),sb.tag(`br`),sb.tag(`p`),sb.tag(`hr`),sb.any(),Object.freeze([]),Object.freeze({}),ob.any(),ob.any,ob.comment,ob.tag,ob.text;function cb(e,t=null,n=Pg()){return Xy([zy(Ky,!0)],n)(()=>{let r=wh(),i=Yy(n),a=H(t)?f_(t.anchor.getNode()):null,o=e.append.bind(e);for(let e of(G(a)?a:r).getChildren())ub(n,e,o,t,i);return e})}function lb(e,t=null){return(typeof document>`u`||typeof window>`u`&&global.window===void 0)&&My(338),tm(e),cb(_g().createElement(`div`),t,e).innerHTML}function ub(e,t,n,r=null,i=Fg(e)){let a=i.$shouldInclude(t,r,e),o=i.$shouldExclude(t,r,e),s=t;r!==null&&V(t)&&(s=Iv(r,t,`clone`));let{element:c,after:l,append:u,$getChildNodes:d}=i.$exportDOM(s,e);if(!c)return!1;let f=_g().createDocumentFragment(),p=d?d():G(s)?s.getChildren():[],m=a&&ip(r)&&G(t)?null:r,h=f.append.bind(f);for(let n of p){let o=ub(e,n,h,m,i);!a&&o&&i.$extractWithChild(t,n,r,`html`,e)&&(a=!0)}if(a&&!o){if((Y(c)||Og(c))&&(u?u(f):c.append(f)),n(c),l){let e=l.call(s,c);e&&(Og(c)?c.replaceChildren(e):c.replaceWith(e))}}else n(f);return a}function db(e,t,n=null){let r=gg(n),i=n?mg(n):[],a=n!==null&&i.length>0;if(a&&typeof r.caretPositionFromPoint==`function`){let a=r.caretPositionFromPoint(e,t,{shadowRoots:i});if(a!==null&&function(e,t){for(let n=e;n!==null;){if(n===t)return!0;n=qh(n)}return!1}(a.offsetNode,n))return{node:a.offsetNode,offset:a.offset}}if(a){let i=n.getRootNode();if(fg(i)){let a=i.elementFromPoint(e,t);if(a!==null&&n.contains(a)){let n=function(e,t,n,r){let i=r.createRange(),a=e=>t<e.top?e.top-t:t>e.bottom?t-e.bottom:0,o=t=>e<t.left?t.left-e:e>t.right?e-t.right:0,s=r.createTreeWalker(n,NodeFilter.SHOW_TEXT),c=null,l=1/0,u=1/0;for(let e=s.nextNode();e;e=s.nextNode()){i.selectNodeContents(e);for(let t of i.getClientRects()){let n=a(t),r=o(t);(n<l||n===l&&r<u)&&(l=n,u=r,c=e)}}if(c===null)return null;let d=0,f=1/0,p=1/0;for(let t=0;t<=c.length;t++){i.setStart(c,t),i.collapse(!0);let n=i.getBoundingClientRect(),r=a(n),o=Math.abs(e-n.left);(r<f||r===f&&o<p)&&(f=r,p=o,d=t)}return{node:c,offset:d}}(e,t,a,r);if(n!==null)return n}}}if(typeof r.caretRangeFromPoint==`function`){let n=r.caretRangeFromPoint(e,t);return n===null?null:{node:n.startContainer,offset:n.startOffset}}if(typeof r.caretPositionFromPoint==`function`){let n=r.caretPositionFromPoint(e,t);return n===null?null:{node:n.offsetNode,offset:n.offset}}return null}function fb(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);throw 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 pb(e,t=U()){return t??fb(166),H(t)&&t.isCollapsed()||t.getNodes().length===0?``:lb(e,t)}function mb(e,t){let n=e.getData(`text/plain`)||e.getData(`text/uri-list`);n!=null&&t.insertRawText(n)}let hb=`application/x-lexical-drag`;function gb(e,t){let n={editorKey:t.getKey()};e.setData(hb,JSON.stringify(n))}function _b(e,t,n){let r=e.dataTransfer;if(r===null)return!1;let i=function(e){let t=e.getData(hb);if(!t)return null;let n;try{n=JSON.parse(t)}catch{return null}return(r=n)!==null&&typeof r==`object`&&`editorKey`in r&&typeof r.editorKey==`string`?n:null;var r}(r);if(i===null)return!1;let a=function(e,t){let n=db(e.clientX,e.clientY,t.getRootElement());if(n===null)return null;let r=xh(n.node);if(r===null)return null;if(V(r))return U_(r,`next`,n.offset);if(G(r))return yv(r,n.offset,`next`);let i=r.getParent();return i===null?null:yv(i,r.getIndexWithinParent()+1,`next`)}(e,t);if(a===null)return!1;let o=Sv(a);if(o===null)return!1;let s=i.editorKey===t.getKey(),c=U();if(s){if(!H(c)||c.isCollapsed())return!1;if(function(e,t){let{anchor:n,focus:r}=vv(uv(t),`next`);return tv(n,e)<0&&tv(e,r)<0}(a,c))return e.preventDefault(),!0;c.removeText()}if(!o.origin.isAttached())return e.preventDefault(),!0;if(n(r,cv(Q_(o)),t),!s){let e=t.getRootElement(),n=e?e.ownerDocument:null,r=n?function(e,t){for(let n of hg(t)){let t=ah(n);if(rh(t)&&t.getKey()===e&&Y(n))return n}return null}(i.editorKey,n):null;r!==null&&r.dispatchEvent(new InputEvent(`beforeinput`,{bubbles:!0,cancelable:!0,inputType:`deleteByDrag`}))}return e.preventDefault(),!0}function vb(e,t){return _b(e,t,(e,t)=>mb(e,t))}function yb(e,t){t.update(()=>{if(e!==null){let n=Uv(e,KeyboardEvent)?null:e.clipboardData,r=U();if(r!==null&&!r.isCollapsed()&&n!=null){e.preventDefault();let i=pb(t);i!==null&&n.setData(`text/html`,i),n.setData(`text/plain`,r.getTextContent())}}})}function bb(e){return kv(e.registerCommand(ed,e=>{let t=U();return!!H(t)&&(t.deleteCharacter(e),!0)},0),e.registerCommand(od,e=>{let t=U();return!!H(t)&&(t.deleteWord(e),!0)},0),e.registerCommand(sd,e=>{let t=U();return!!H(t)&&(t.deleteLine(e),!0)},0),e.registerCommand(rd,e=>{let t=U();if(!H(t))return!1;if(typeof e==`string`)t.insertText(e);else{let n=e.dataTransfer;if(n!=null)mb(n,t);else{let n=e.data;n&&t.insertText(n)}}return!0},0),e.registerCommand(ad,()=>{let e=U();return!!H(e)&&(e.removeText(),!0)},0),e.registerCommand(td,e=>{let t=U();return!!H(t)&&(t.insertLineBreak(e),!0)},0),e.registerCommand(nd,()=>{let e=U();return!!H(e)&&(e.insertLineBreak(),!0)},0),e.registerCommand(md,e=>{let t=U();if(!H(t))return!1;let n=e,r=n.shiftKey;return!!zv(t,!0)&&(n.preventDefault(),Hv(t,r,!0),!0)},0),e.registerCommand(fd,e=>{let t=U();if(!H(t))return!1;let n=e,r=n.shiftKey;return!!zv(t,!1)&&(n.preventDefault(),Hv(t,r,!1),!0)},0),e.registerCommand(bd,t=>!!H(U())&&(!$c||!Qc)&&(t.preventDefault(),e.dispatchCommand(ed,!0)),0),e.registerCommand(Sd,t=>!!H(U())&&(t.preventDefault(),e.dispatchCommand(ed,!1)),0),e.registerCommand(vd,t=>{if(!H(U()))return!1;if(t!==null){if(($c||tl||il)&&Qc)return!1;t.preventDefault()}return e.dispatchCommand(td,!1)},0),e.registerCommand(Ad,()=>{let e=U();return Bh(H(e)&&f_(e.anchor.getNode())!==null?e:null),!0},0),e.registerCommand(Od,t=>!!H(U())&&(yb(t,e),!0),0),e.registerCommand(kd,t=>!!H(U())&&(function(e,t){yb(e,t),t.update(()=>{let e=U();H(e)&&e.removeText()},{tag:`cut`})}(t,e),!0),0),e.registerCommand(id,t=>!!H(U())&&(function(e,t){e.preventDefault(),t.update(()=>{let t=U(),n=Uv(e,ClipboardEvent)?e.clipboardData:null;n!=null&&H(t)&&mb(n,t)},{tag:`paste`})}(t,e),!0),0),e.registerCommand(wd,t=>vb(t,e),0),e.registerCommand(Td,t=>{let n=U();return!!H(n)&&(n.isCollapsed()||t.dataTransfer===null||gb(t.dataTransfer,e),!0)},0))}function xb(e,t,n,r,i){if(e===null||n.size===0&&r.size===0&&!i)return 0;let a=t._selection,o=e._selection;if(i)return 1;if(!(H(a)&&H(o)&&o.isCollapsed()&&a.isCollapsed()))return 0;let s=function(e,t,n){let r=e._nodeMap,i=[];for(let e of t){let t=r.get(e);t!==void 0&&i.push(t)}for(let[e,t]of n){if(!t)continue;let n=r.get(e);n===void 0||Sm(n)||i.push(n)}return i}(t,n,r);if(s.length===0)return 0;if(s.length>1){let n=t._nodeMap,r=n.get(a.anchor.key),i=n.get(o.anchor.key);return r&&i&&!e._nodeMap.has(r.__key)&&V(r)&&r.__text.length===1&&a.anchor.offset===1?2:0}let c=s[0],l=e._nodeMap.get(c.__key);if(!V(l)||!V(c)||l.__mode!==c.__mode)return 0;let u=l.__text,d=c.__text;if(u===d)return 0;let f=a.anchor,p=o.anchor;if(f.key!==p.key||f.type!==`text`)return 0;let m=f.offset,h=p.offset,g=d.length-u.length;return g===1&&h===m-1?2:g===-1&&h===m+1?3:g===-1&&h===m?4:0}function Sb(e,t,n){let r=n(),i=0,a=r,o=0,s=null;return(c,l,u,d,f,p)=>{let m=n();if(p.has(`composition-start`)&&(a=r,o=i,s=c),p.has(`historic`))return i=0,r=m,2;p.has(`composition-end`)&&s&&(r=a,i=o,c=s);let h=p.has(`paste`)||p.has(`cut`)?0:xb(c,l,d,f,e.isComposing()),g=(()=>{let n=u===null||u.editor===e,a=p.has(`history-push`);if(!a&&n&&p.has(`history-merge`))return 0;if(h===1)return 2;if(c===null)return 1;let o=l._selection;if(!(d.size>0||f.size>0))return o===null?2:0;let s=typeof t==`number`?t:t.peek();return!1===a&&h!==0&&h===i&&m<r+s&&n||d.size===1&&function(e,t,n){let r=t._nodeMap.get(e),i=n._nodeMap.get(e),a=t._selection,o=n._selection;return!(H(a)&&H(o)&&a.anchor.type===`element`&&a.focus.type===`element`&&o.anchor.type===`text`&&o.focus.type===`text`||!V(r)||!V(i)||r.__parent!==i.__parent)&&JSON.stringify(t.read(()=>r.exportJSON()))===JSON.stringify(n.read(()=>i.exportJSON()))}(Array.from(d)[0],c,l)?0:1})();return r=m,i=h,g}}function Cb(e,t){e.undoStack=[],e.redoStack=[],e.current=null,t&&t(e)}function wb(e,t,n,r=Date.now,i,a=null){let o=Sb(e,n,r),s=()=>{i&&i(t)};return s(),kv(e.registerCommand(ld,()=>(function(e,t,n){let r=t.redoStack,i=t.undoStack;if(i.length!==0){let a=t.current,o=i.pop();a!==null&&(r.push(a),e.dispatchCommand(Nd,!0)),i.length===0&&e.dispatchCommand(Pd,!1),t.current=o||null,n&&n(t),o&&o.editor.setEditorState(o.editorState,{tag:`historic`})}}(e,t,i),!0),0),e.registerCommand(ud,()=>(function(e,t,n){let r=t.redoStack,i=t.undoStack;if(r.length!==0){let a=t.current;a!==null&&(i.push(a),e.dispatchCommand(Pd,!0));let o=r.pop();r.length===0&&e.dispatchCommand(Nd,!1),t.current=o||null,n&&n(t),o&&o.editor.setEditorState(o.editorState,{tag:`historic`})}}(e,t,i),!0),0),e.registerCommand(jd,()=>(Cb(t,i),!1),0),e.registerCommand(Md,()=>(Cb(t,i),e.dispatchCommand(Nd,!1),e.dispatchCommand(Pd,!1),!0),0),e.registerUpdateListener(({editorState:n,prevEditorState:r,dirtyLeaves:i,dirtyElements:c,tags:l})=>{let u=t.current,d=t.redoStack,f=t.undoStack,p=u===null?null:u.editorState;if(u!==null&&n===p)return;let m=o(r,n,u,i,c,l);if(m===1){if(d.length!==0&&(t.redoStack=[],e.dispatchCommand(Nd,!1)),u!==null){f.push({...u});let t=typeof a==`number`||a===null?a:a.peek();t!==null&&f.length>t&&f.splice(0,f.length-t),e.dispatchCommand(Pd,!0)}}else if(m===2)return;t.current={editor:e,editorState:n},s()}))}function Tb(){return{current:null,redoStack:[],undoStack:[]}}Date.now;let Eb=`application/x-codexhost-thread-reference`;function Db(e){let t=e.projectionValues?.threadReference;if(!e.blank&&t?.hostId&&(t.hostId===`local`||/^remote-(?:ssh(?:-|:)|control:)/u.test(t.hostId)&&t.threadId))return{threadId:t.threadId??e.id,hostId:t.hostId,title:e.title?.replace(/[\s\u0000-\u001f\u007f]+/gu,` `).trim()||e.id.slice(0,8)}}function Ob(e){return`thread://${encodeURIComponent(e.threadId).replace(/[!'()*]/gu,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)}?hostId=${encodeURIComponent(e.hostId)}`}function kb(e){if(e.trim()!==e)return;let t=/^codex:\/\/threads\/([^/?#\s<>]+)$/u.exec(e)??/^thread:\/\/([^/?#\s<>]+)\?hostId=([^&#\s]+)$/u.exec(e);if(t?.[1]!==void 0)try{let e=decodeURIComponent(t[1]),n=decodeURIComponent(t[2]??`local`);if(!e||!n||/[\u0000-\u001f\u007f]/u.test(e+n))return;if(n===`local`)return e;if(!/^remote-(?:ssh(?:-|:)|control:)/u.test(n))return;let r=new TextEncoder().encode(JSON.stringify([n,e]));return`web-remote:`+btoa(Array.from(r,e=>String.fromCharCode(e)).join(``)).replaceAll(`+`,`-`).replaceAll(`/`,`_`).replace(/=+$/u,``)}catch{return}}function Ab(e){let t=`[@${e.title.replace(/[\\`*{}[\]()#+.!_<>|~-]/gu,e=>`\\${e}`)}](${Ob(e)})`;return{source:`codexhost-thread`,ref:t,label:e.title,appearance:`session`,clipboardText:t}}function jb(e){try{let t=JSON.parse(e);if(typeof t!=`object`||!t)return;let{threadId:n,hostId:r,title:i}=t;return typeof n!=`string`||!n||typeof r!=`string`||!r||r!==`local`&&!/^remote-(?:ssh(?:-|:)|control:)/u.test(r)||typeof i!=`string`?void 0:Db({id:n,blank:!1,title:i,projectionValues:{threadReference:{hostId:r,threadId:n}}})}catch{return}}function Mb(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`){if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=Mb(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function Nb(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=Mb(e))&&(r&&(r+=` `),r+=t);return r}let Pb=`@deepseek-ai/dsh-client-ui-conversation/ReferenceChip.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Pb)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-conversation`,e.dataset.pluginCss=Pb,e.textContent=`.HsYvBG_chip{max-width:240px;color:var(--dsw-alias-state-business-primary);user-select:none;align-items:baseline;gap:3px;display:inline-flex}.HsYvBG_marker{flex:none;font-weight:500}.HsYvBG_icon{flex:none;align-self:center}.HsYvBG_label{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.HsYvBG_invalid{color:var(--dsw-alias-state-error-primary);opacity:.7;text-decoration:line-through}`,document.head.appendChild(e)}var Fb={chip:`HsYvBG_chip`,icon:`HsYvBG_icon`,invalid:`HsYvBG_invalid`,label:`HsYvBG_label`,marker:`HsYvBG_marker`};let Ib=`@deepseek-ai/dsh-client-ui-conversation/composer-editor.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Ib)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-conversation`,e.dataset.pluginCss=Ib,e.textContent=`._06X5vW_reference{border-radius:var(--dsw-radius-sm);line-height:inherit;vertical-align:baseline;color:var(--dsw-alias-state-business-primary);-webkit-box-decoration-break:clone;box-decoration-break:clone;background:0 0;padding:0 4px}._06X5vW_reference:hover{background:var(--dsw-alias-state-business-tertiary)}._06X5vW_openable{cursor:pointer}._06X5vW_textRef{max-width:100%;display:inline-block}`,document.head.appendChild(e)}var Lb={openable:`_06X5vW_openable`,reference:`_06X5vW_reference`,textRef:`_06X5vW_textRef`};function Rb({label:e,reference:t,appearance:n,invalid:r}){return/* @__PURE__ */ (0,h.jsxs)(`span`,{className:Nb(Lb.reference,Fb.chip,n===`file`&&!r&&Lb.openable,r&&Fb.invalid),title:e,children:[n===void 0?/* @__PURE__ */ (0,h.jsx)(`span`,{className:Fb.marker,"aria-hidden":!0,children:`@`}):/* @__PURE__ */ (0,h.jsx)(d.ReferenceIconRegular,{kind:n,reference:t,size:14,className:Fb.icon}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:Fb.label,children:e})]})}var zb=class e extends bm{__source;__ref;__label;__appearance;__clipboardText;__invalid;static getType(){return`reference-chip`}static clone(t){return new e({source:t.__source,ref:t.__ref,label:t.__label,appearance:t.__appearance,clipboardText:t.__clipboardText},t.__invalid,t.__key)}static importJSON(t){return new e({source:t.source,ref:t.ref,label:t.label,appearance:t.appearance,clipboardText:t.clipboardText},t.invalid)}constructor(e,t=!1,n){super(n),this.__source=e.source,this.__ref=e.ref,this.__label=e.label,this.__appearance=e.appearance,this.__clipboardText=e.clipboardText,this.__invalid=t}exportJSON(){return{...super.exportJSON(),type:`reference-chip`,version:1,source:this.__source,ref:this.__ref,label:this.__label,...this.__appearance===void 0?{}:{appearance:this.__appearance},clipboardText:this.__clipboardText,invalid:this.__invalid}}createDOM(e){let t=document.createElement(`span`);return t.setAttribute(`data-composer-chip`,this.__source),t.setAttribute(`contenteditable`,`false`),t}updateDOM(){return!1}isInline(){return!0}isKeyboardSelectable(){return!1}getTextContent(){return this.__clipboardText}setInvalid(e){let t=this.getWritable();t.__invalid=e}isInvalid(){return this.getLatest().__invalid}getSource(){return this.getLatest().__source}getReference(){return this.getLatest().__ref}getLabel(){return this.getLatest().__label}getAppearance(){return this.getLatest().__appearance}decorate(){return/* @__PURE__ */ (0,h.jsx)(Rb,{label:this.__label,reference:this.__ref,appearance:this.__appearance,invalid:this.__invalid})}};function Bb(e){return new zb(e)}function Vb(e){return e instanceof zb}function Hb(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);throw 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 Ub(e,t,n,r){let i=e=>e instanceof n,a=e=>{let t=Wf(e.getTextContent());t.setFormat(e.getFormat()),e.replace(t)};return[e.registerNodeTransform(Ff,e=>{if(!e.isSimpleText())return;let n,o=e.getPreviousSibling(),s=e.getTextContent(),c=e;if(V(o)){let n=o.getTextContent(),r=t(n+s);if(i(o)){if(r===null||(e=>e.getLatest().__mode)(o)!==0)return void a(o);{let t=r.end-n.length;if(t>0){let r=n+s.slice(0,t);if(o.select(),o.setTextContent(r),t===s.length)e.remove();else{let n=s.slice(t);e.setTextContent(n)}return}}}else if(r===null||r.start<n.length)return}let l=0;for(;;){n=t(s);let e,u=n===null?``:s.slice(n.end);if(s=u,u===``){let e=c.getNextSibling();if(V(e)){u=c.getTextContent()+e.getTextContent();let n=t(u);if(n===null)return void(i(e)?a(e):e.markDirty());if(n.start!==0)return}}if(n===null)return;if(n.start===0&&V(o)&&o.isTextEntity()){l+=n.end;continue}n.start===0?[e,c]=c.splitText(n.end):[,e,c]=c.splitText(n.start+l,n.end+l),e===void 0&&Hb(165,`nodeToReplace`);let d=r(e);if(d.setFormat(e.getFormat()),e.replace(d),c==null)return;l=0,o=d}}),e.registerNodeTransform(n,e=>{let n=e.getTextContent(),r=t(n);if(r===null||r.start!==0)return void a(e);if(n.length>r.end)return void e.splitText(r.end);let o=e.getPreviousSibling();V(o)&&o.isTextEntity()&&(a(o),a(e));let s=e.getNextSibling();V(s)&&s.isTextEntity()&&(a(s),i(e)&&a(e))})]}let Wb=/(^|\s)([/@])([\w-]+)/g,Gb=/(^|\s)(@(?:"[^"\n]*"?|[^\s"]\S*))/g,Kb=/* @__PURE__ */ new Set(`.,;:!?,。;:!?`),qb=/^@.*[/\\.]/u;function Jb(e,t,n){if(!n.startsWith(`@"`)){let e=n.length;for(;Kb.has(n.charAt(e-1));)--e;return qb.test(n.slice(0,e))?t+e:void 0}if(n.length>3&&n.endsWith(`"`))return t+n.length;let r=n.lastIndexOf(`/`);if(r<0)return;let i=t+r+1;for(;Kb.has(e.charAt(i));)i+=1;return i===e.length||/\s/u.test(e.charAt(i))?t+r+1:void 0}let Yb=/^(?:\s|$)/;function Xb(e,t){if(e===``)return[];let n=[];Wb.lastIndex=0;let r;for(;(r=Wb.exec(e))!==null;){let i=r[2],a=r[3]??``;if((i!==`/`||Yb.test(e.slice(r.index+r[0].length)))&&t.get(i)?.includes(a)){let e=r.index+(r[1]?.length??0);n.push({start:e,end:e+1+a.length,trigger:i})}}Gb.lastIndex=0;let i;for(;(i=Gb.exec(e))!==null;){let t=i.index+(i[1]?.length??0),r=Jb(e,t,i[2]??``);r!==void 0&&!n.some(e=>e.start<r&&e.end>t)&&n.push({start:t,end:r,trigger:`@`})}return n.sort((e,t)=>e.start-t.start)}var Zb=class e extends Ff{static getType(){return`composer-text-ref`}static clone(t){return new e(t.__text,t.__key)}static importJSON(t){let n=new e(t.text);return n.setFormat(t.format),n.setDetail(t.detail),n.setMode(t.mode),n.setStyle(t.style),n}exportJSON(){return{...super.exportJSON(),type:`composer-text-ref`}}createDOM(e){let t=super.createDOM(e);return t.className=Nb(t.className,Lb.reference,Lb.textRef,this.getTextContent().startsWith(`/`)&&Lb.openable),t.setAttribute(`spellcheck`,`false`),t.setAttribute(`data-composer-text-ref`,``),t}isTextEntity(){return!0}canInsertTextBefore(){return!0}};function Qb(e,t,n){return kv(...Ub(e,e=>{let r=n();for(let n of Xb(e,t()))if(r===null||n.start!==0||e.slice(n.start,n.end)!==r.trimEnd())return{start:n.start,end:n.end};return null},Zb,e=>new Zb(e.getTextContent())))}function $b(e){e.update(()=>{for(let e of wh().getAllTextNodes())e.markDirty()},{tag:xf})}function ex(e,t){return e.registerCommand(Yu,e=>{if(e.target===null||e.button!==0||e.detail>1)return!1;let n=U();if(H(n)&&!n.isCollapsed())return!1;let r=xh(e.target);if(Vb(r)){if(r.isInvalid())return!1;let e=r.getAppearance();return t(r.getSource(),{ref:r.getReference(),...e===void 0?{}:{appearance:e}})}return r instanceof Zb&&t(void 0,{ref:r.getTextContent()})},1)}function tx(e){return(t,n)=>{for(let r of e)Object.hasOwn(t,r)&&t[r]===void 0&&n.addIssue({code:`custom`,path:[r],message:`Explicit undefined is not valid JSON`})}}let nx=Ls([k(),A(),j(),ks()]);function rx(e){let t=/* @__PURE__ */ new WeakSet,n=[{value:e,leaving:!1}];try{for(;n.length>0;){let e=n.pop();if(!e)break;if(e.leaving)t.delete(e.value);else if(typeof e.value==`object`&&e.value!==null){if(t.has(e.value))return!1;t.add(e.value),n.push({value:e.value,leaving:!0});for(let t of Object.values(e.value))n.push({value:t,leaving:!1})}}}catch{return!1}return!0}let ix=_c(rx,{message:`JSON value must not contain circular references`}),ax=hc(()=>Ls([nx,M(ax),Gs(k(),ax)])),ox=ix.pipe(ax);ix.pipe(M(ax));let sx=ix.pipe(Gs(k(),ax)),cx=P({code:k().min(1),message:k().min(1),retryable:j(),diagnostic:k().min(1).optional(),stage:k().min(1).optional(),durationMs:A().int().nonnegative().optional(),stderrTail:k().min(1).optional()}).superRefine(tx([`diagnostic`,`stage`,`durationMs`,`stderrTail`])),lx=k().max(64).regex(/^[a-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/u),ux=e=>k().min(1).max(e).refine(e=>e.trim().length>0),dx=Gs(lx,N({label:ux(256).optional(),description:ux(1024).optional()}).strict()).refine(e=>Object.keys(e).length<=16,`Too many locales`),fx=Gs(lx,ux(4096)).refine(e=>typeof e.en==`string`,`English fallback is required`).refine(e=>Object.keys(e).length<=16,`Too many locales`),px=k().refine(e=>e.trim().length>0,{message:`Identifier must not be empty or whitespace`}),mx=px.brand(),hx=px.brand(),gx=px.brand();px.brand(),px.brand();let _x=k().refine(e=>e.trim().length>0,{message:`Value must not be empty or whitespace`}),vx=_x.max(128).regex(/^[A-Za-z0-9._~:-]+$/u,`Permission Mode ID must use transport-safe characters`).brand(),yx=N({modes:M(N({id:vx,label:_x.max(256),description:_x.max(1024).optional(),dangerous:j().optional(),localizations:dx.optional()}).strict()).min(1).max(32),defaultModeId:vx}).strict().superRefine((e,t)=>{let n=/* @__PURE__ */ new Set;for(let[r,i]of e.modes.entries())n.has(i.id)&&t.addIssue({code:`custom`,message:`Permission Mode IDs must be unique`,path:[`modes`,r,`id`]}),n.add(i.id);n.has(e.defaultModeId)||t.addIssue({code:`custom`,message:`Default Permission Mode must exist in the catalog`,path:[`defaultModeId`]})});N({threadId:hx,permissionModeId:vx}).strict();let bx=A().int().safe().nonnegative(),xx=A().finite().nonnegative(),Sx=A().finite().min(0).max(100),Cx=N({version:Ls([I(3),I(4)]).optional(),requestId:k().min(1),turnId:k().min(1).max(1024),outputTokens:bx,startedAtMs:bx,completedAtMs:bx}).strict().refine(e=>e.completedAtMs>e.startedAtMs),wx=N({version:Ls([I(2),I(3),I(4)]).optional(),value:xx,turnId:k().min(1).max(1024),at:bx}).strict();N({outputTimings:M(Cx).transform(e=>e.filter(e=>e.version===4)).optional(),outputTokensPerSecond:wx.refine(e=>e.version===4).optional().catch(void 0),timeToFirstOutputMs:wx.extend({value:bx}).optional()}).strict();let Tx=e=>fx.refine(t=>Object.values(t).every(t=>t.length<=e)),Ex=N({composerIndicators:M(N({kind:I(`countdown`),id:k().min(1).max(64),expiresAtUnix:bx,label:Tx(256).optional(),tooltip:Tx(1024).optional()}).strict()).max(2).refine(e=>new Set(e.map(({id:e})=>e)).size===e.length,{message:`Composer indicator IDs must be unique`}).optional(),inputTokens:bx.optional(),cachedInputTokens:bx.optional(),cacheWriteInputTokens:bx.optional(),outputTokens:bx.optional(),outputTokensPerSecond:xx.optional(),sessionOutputTokensPerSecond:xx.optional(),apiOutputTokensPerSecond:xx.optional(),reasoningOutputTokens:bx.optional(),totalTokens:bx.optional(),totalCostUsd:xx.optional(),totalCredits:xx.optional(),contextUsagePercent:xx.optional(),cacheHitRatePercent:Sx.optional(),contextWindowTokens:bx.optional(),contextUsedTokens:bx.optional(),planFiveHourUsedPercent:Sx.optional(),planFiveHourResetsAtUnix:bx.optional(),planSevenDayUsedPercent:Sx.optional(),planSevenDayResetsAtUnix:bx.optional(),sessionCacheHitRatePercent:Sx.optional(),timeToFirstOutputMs:bx.optional(),costSource:F([`publicPrice`,`native`]).optional(),unpricedModels:M(k().min(1)).min(1).optional()}).strict().superRefine((e,t)=>{Object.keys(e).length===0&&t.addIssue({code:`custom`,message:`Thread Usage must contain a reliable field`});let n=e.contextUsedTokens!==void 0;n!==(e.contextWindowTokens!==void 0)&&t.addIssue({code:`custom`,message:`Thread Usage context fields must be provided together`,path:[n?`contextWindowTokens`:`contextUsedTokens`]}),e.contextWindowTokens===0&&t.addIssue({code:`custom`,message:`Thread Usage contextWindowTokens must be greater than zero`,path:[`contextWindowTokens`]}),e.costSource!==void 0&&e.totalCostUsd===void 0&&t.addIssue({code:`custom`,message:`Thread Usage costSource must be provided with totalCostUsd`,path:[`costSource`]}),e.unpricedModels!==void 0&&e.costSource!==`publicPrice`&&t.addIssue({code:`custom`,message:`Thread Usage unpricedModels must be provided with a publicPrice cost`,path:[`unpricedModels`]}),e.planFiveHourResetsAtUnix!==void 0&&e.planFiveHourUsedPercent===void 0&&t.addIssue({code:`custom`,message:`Thread Usage planFiveHourResetsAtUnix must be provided with planFiveHourUsedPercent`,path:[`planFiveHourResetsAtUnix`]}),e.planSevenDayResetsAtUnix!==void 0&&e.planSevenDayUsedPercent===void 0&&t.addIssue({code:`custom`,message:`Thread Usage planSevenDayResetsAtUnix must be provided with planSevenDayUsedPercent`,path:[`planSevenDayResetsAtUnix`]})}),Dx=A().finite().min(0).max(100),Ox=F([`weekly`,`monthly`,`five_hour`,`seven_day`,`unknown`]),kx=N({id:k().min(1).max(256),label:k().min(1).max(256),localizations:dx.optional()}).strict(),Ax=N({product:k().min(1),periodType:Ox.optional(),scope:kx.optional(),localizations:dx.optional(),used:A().finite().nonnegative().optional(),limit:A().finite().nonnegative().optional(),unit:k().min(1).max(32).optional(),usagePercent:Dx,resetsAt:k().min(1).optional()}).strict(),jx=N({availableCount:A().int().safe().positive(),nextExpiresAt:k().min(1).optional(),expiresAt:M(k().min(1)).min(1).max(32).optional()}).strict(),Mx=N({used:A().finite().nonnegative().optional(),limit:A().finite().nonnegative().optional(),unit:k().min(1).max(32).optional(),label:k().min(1).optional(),scope:kx.optional(),localizations:dx.optional(),usedPercent:Dx,resetsAt:k().min(1).optional(),periodType:Ox,productUsage:M(Ax).min(1).optional(),resetCredits:jx.optional()}).strict();N({threadId:hx,refresh:I(`exact`).optional()}).strict(),N({threadId:hx,usage:Ex.nullable(),accountCredits:Mx.optional(),accountCreditsSupported:j().optional()}).strict();let Nx=k().refine(e=>e.trim().length>0,{message:`Value must not be empty or whitespace`}),Px=N({id:Nx.max(512).regex(/^[A-Za-z0-9._~-]+$/u,`Model Ref must use transport-safe opaque characters`).brand()}).strict(),Fx=Nx.max(128).regex(/^[A-Za-z0-9._~-]+$/u,`Thinking option ID must use transport-safe characters`).brand(),Ix=Nx.max(256),Lx=N({id:Fx,label:Nx.max(256)}).strict(),Rx=N({ref:Px,label:Nx.max(256),resolvedModelLabel:Ix.optional(),fastModel:Px.optional(),supportedThinkingOptionIds:M(Fx).optional()}).strict(),zx=M(Lx).superRefine((e,t)=>{let n=/* @__PURE__ */ new Set;for(let[r,i]of e.entries())n.has(i.id)&&t.addIssue({code:`custom`,message:`Thinking option IDs must be unique`,path:[r,`id`]}),n.add(i.id)}),Bx=N({models:M(Rx),defaultModel:Px.optional(),thinkingOptions:zx,defaultThinkingOptionId:Fx.optional()}).strict().superRefine((e,t)=>{let n=/* @__PURE__ */ new Set,r=new Set(e.thinkingOptions.map(({id:e})=>e));for(let[i,a]of e.models.entries()){n.has(a.ref.id)&&t.addIssue({code:`custom`,message:`Model Catalog refs must be unique`,path:[`models`,i,`ref`,`id`]}),n.add(a.ref.id),a.fastModel&&((n.has(a.fastModel.id)||e.models.some(e=>e.ref.id===a.fastModel?.id))&&t.addIssue({code:`custom`,message:`Fast Model refs must be distinct and unique`,path:[`models`,i,`fastModel`]}),n.add(a.fastModel.id));let o=/* @__PURE__ */ new Set;for(let[e,n]of(a.supportedThinkingOptionIds??[]).entries())o.has(n)&&t.addIssue({code:`custom`,message:`Supported Thinking option IDs must be unique per Model`,path:[`models`,i,`supportedThinkingOptionIds`,e]}),o.add(n),r.has(n)||t.addIssue({code:`custom`,message:`Supported Thinking option must exist in the catalog`,path:[`models`,i,`supportedThinkingOptionIds`,e]})}e.defaultModel&&!n.has(e.defaultModel.id)&&t.addIssue({code:`custom`,message:`Default Model must exist in the Model Catalog`,path:[`defaultModel`,`id`]}),e.defaultThinkingOptionId&&!r.has(e.defaultThinkingOptionId)&&t.addIssue({code:`custom`,message:`Default Thinking option must exist in the catalog`,path:[`defaultThinkingOptionId`]})}),Vx=N({fork:j(),forkAcrossCwd:j(),rollbackLastTurn:j()}).strict().refine(e=>e.fork||!e.forkAcrossCwd,{path:[`forkAcrossCwd`],message:`Cross-cwd Fork requires exact history Fork support`}),Hx=F([`live`,`atCreate`]),Ux=N({configuration:N({selectModel:j(),selectThinkingOption:j(),selectPermissionMode:j(),permissionModeScope:Hx.default(`live`)}).strict(),history:Vx,subagents:N({observe:j(),readTranscript:j()}).strict().optional(),autonomousTurns:N({observe:j()}).strict().optional(),steer:j().optional()}).strict();N({effectiveModel:Px.optional(),resolvedModelLabel:Ix.optional(),effectiveThinkingOptionId:Fx.optional(),availableThinkingOptions:zx.optional(),effectivePermissionModeId:vx.optional()}).strict().superRefine((e,t)=>{e.effectiveThinkingOptionId&&e.availableThinkingOptions&&!e.availableThinkingOptions.some(({id:t})=>t===e.effectiveThinkingOptionId)&&t.addIssue({code:`custom`,message:`Effective Thinking option must be currently available`,path:[`effectiveThinkingOptionId`]})});let Wx=N({open:I(!0)}).strict();Ls([N({status:I(`ready`),catalog:Bx,permissionModes:yx.optional(),capabilities:Ux,webUi:Wx.optional()}).strict().superRefine((e,t)=>{let n=e.capabilities.configuration.selectPermissionMode;n!==!!e.permissionModes&&t.addIssue({code:`custom`,message:`Permission Mode catalog and capability must agree`,path:n?[`permissionModes`]:[`capabilities`,`configuration`,`selectPermissionMode`]})}),N({status:F([`notInstalled`,`unavailable`,`error`]),error:cx}).strict()]),N({harnessId:mx,cwd:Nx.max(16384).optional(),refresh:j().optional(),purpose:I(`availability`).optional()}).strict(),N({harnessId:mx}).strict(),N({}).strict(),N({threadId:hx,model:Px}).strict(),N({threadId:hx,thinkingOptionId:Fx}).strict(),N({threadId:hx,includeReferenceCapability:j().optional()}).strict(),zs(`owner`,[N({owner:I(`codex`),locked:j(),effectiveModel:Px.optional(),resolvedModelLabel:Ix.optional(),effectiveThinkingOptionId:Fx.optional(),effectivePermissionModeId:vx.optional(),history:Vx.optional(),supportsThreadReferences:I(!0).optional()}).strict(),N({owner:I(`external`),harnessId:Nx.max(256),transportModelId:Nx.max(1024),effectiveModel:Px.optional(),resolvedModelLabel:Ix.optional(),effectiveThinkingOptionId:Fx.optional(),availableThinkingOptions:zx.optional(),effectivePermissionModeId:vx.optional(),history:Vx,usage:Ex.optional(),locked:I(!0)}).strict()]),N({threadIds:M(hx).min(1).max(100)}).strict().superRefine(({threadIds:e},t)=>{let n=/* @__PURE__ */ new Set;for(let[r,i]of e.entries())n.has(i)&&t.addIssue({code:`custom`,message:`Thread ownership-list IDs must be unique`,path:[`threadIds`,r]}),n.add(i)});let Gx=zs(`owner`,[N({threadId:hx,owner:I(`codex`)}).strict(),N({threadId:hx,owner:I(`external`),harnessId:k().max(256).pipe(mx)}).strict()]);N({threads:M(Gx).min(1).max(100)}).strict().superRefine(({threads:e},t)=>{let n=/* @__PURE__ */ new Set;for(let[r,i]of e.entries())n.has(i.threadId)&&t.addIssue({code:`custom`,message:`Thread ownership-list results must be unique`,path:[`threads`,r,`threadId`]}),n.add(i.threadId)}),N({threadId:hx,text:k().optional()}).strict(),N({kind:I(`application`),value:k().transform((e,t)=>{try{return JSON.parse(e)}catch{return t.addIssue({code:`custom`,message:`Invalid steering context JSON`}),wt}}).pipe(N({expectedTurnId:gx,clientUserMessageId:k().min(1),delivery:F([`newTurn`,`activeTurn`])}).strict())}).strict().transform(e=>e.value),F([`activeTurn`,`newTurn`]),N({delivery:F([`official`,`activeTurn`,`newTurn`])}).strict(),N({threadId:hx}).strict(),N({confirmed:j()}).strict(),N({threadIds:M(k().min(1))}).strict(),N({threadId:k().min(1).max(1024),pinned:j()}).strict(),N({}).strict(),N({parents:Gs(k().min(1),k().min(1))}).strict(),N({prompt:k().max(16384).optional()}).strict(),N({projects:M(N({id:k(),name:k(),rootPaths:M(k())})),assignments:Gs(k(),k()),projectless:M(k()),pinned:M(k())});let Kx=Gs(k(),js()),qx=N({epoch:k().uuid(),sequence:A().int().nonnegative()});zs(`type`,[N({type:I(`skills-changed`),cursor:qx,cwd:k().optional()}),N({type:I(`harness-inspection-changed`),cursor:qx,harnessId:k().min(1)}),N({type:I(`display-settings-changed`),cursor:qx}),N({type:I(`preferences-changed`),cursor:qx,revision:A().int().nonnegative()}),N({type:I(`hello`),version:I(1),cursor:qx,reset:j()}),N({type:I(`changed`),cursor:qx,threadId:k().min(1),method:k().min(1)})]);let Jx=zs(`type`,[N({type:I(`text`),id:k(),prompt:k(),secret:j().optional(),optional:j().optional()}),N({type:I(`choice`),id:k(),prompt:k(),multiple:j(),allowOther:j(),optional:j().optional(),options:M(N({value:k(),label:k(),description:k().optional()}))})]),Yx=zs(`type`,[N({type:I(`approval`),title:k(),description:k().optional(),subject:js().optional(),actions:M(N({id:k(),label:k(),effect:k()}))}),N({type:I(`question`),title:k().optional(),questions:M(Jx)})]),Xx=N({requestId:Ls([k(),A().int()]),threadId:k(),kind:F([`approval`,`question`]),interaction:Yx,request:Kx}),Zx=N({id:k().min(1),clientUserMessageId:k().min(1),input:M(Kx),presentationInput:M(Kx).nullable().optional()}).passthrough();N({fields:M(N({path:M(Ls([k(),A().int().nonnegative()])),originalLength:A().int().nonnegative()}))});let Qx=N({id:k().min(1),status:k().min(1),codexhostTurnOutcome:N({status:I(`unknown`),reason:k()}).optional(),items:M(N({id:k().min(1),type:k().min(1)}).passthrough()),codexhostFileOperations:M(N({beforeItemId:k().nullable(),item:N({id:k().min(1),type:k().min(1)}).passthrough()})).optional(),error:N({message:k().optional()}).passthrough().nullable().optional(),fingerprint:k().min(1).optional(),unchanged:I(!0).optional()}).passthrough(),$x=N({id:k().min(1).max(512),fingerprint:k().min(1).max(128)});N({threadId:k().min(1),knownTurns:M($x).max(64).optional(),truncateToolOutput:j().optional()});let eS=N({harnessId:k().min(1),nativeSessionId:k().min(1)});N({cursor:qx,activeTurnId:k().min(1).nullable().optional(),command:N({name:k().min(1),turn:Qx,subsequentTurnId:k().min(1).optional()}).optional(),thread:N({id:k().min(1),cwd:k(),modelProvider:k().min(1),createdAt:A(),updatedAt:A(),status:N({type:k()}).passthrough(),name:k().nullable().optional(),preview:k().optional(),codexhostImportSource:eS.optional(),turns:M(Qx).length(0)}).passthrough(),turnsPage:N({data:M(Qx).max(5),nextCursor:k().nullable()}),configuration:N({native:N({model:k().min(1).max(1024).optional(),reasoningEffort:k().min(1).max(128).optional()}).optional(),effectiveModel:Px.optional(),effectiveThinkingOptionId:Fx.optional(),effectivePermissionModeId:vx.optional()}),queue:N({items:M(Zx),pausedReason:F([`interrupted`,`outcome-unknown`,`failed`]).nullable()}).optional(),interactions:M(Xx)}),N({version:I(1),owner:I(`service`).optional(),pid:A().int().positive(),port:A().int().min(1).max(65535),token:k().regex(/^[0-9a-f]{64}$/u),startedAt:A(),epoch:k().uuid()}),N({epoch:k().uuid(),threadId:k().min(1),requestId:Ls([k(),A().int()]),result:Kx}),N({includeArchived:j().optional(),officialCursor:N({live:k().nullable(),archived:k().nullable().optional()}).strict().optional()}).strict(),N({threads:M(sx),ownership:M(Gx),archivedThreadIds:M(hx),officialCursor:N({live:k().nullable(),archived:k().nullable().optional()}).strict().optional()}).strict();let tS=k().regex(/^audio\/[a-z0-9.+-]+(?:\s*;[^\r\n]*)?$/i);N({available:j()}).strict(),N({path:k().min(1),mimeType:tS}).strict();let nS=F([`credentials-unavailable`,`login-expired`,`rate-limited`,`service-rejected`,`host-incompatible`,`network`,`timeout`,`audio-empty`,`audio-too-large`,`audio-format`,`audio-invalid`]);zs(`ok`,[N({ok:I(!0),text:k()}).strict(),N({ok:I(!1),error:N({code:nS}).strict()}).strict()]),N({threadId:hx.optional(),cwd:k().min(1).optional()}).strict().refine(e=>!(e.threadId&&e.cwd),{message:`Specify threadId or cwd, not both`});let rS=N({name:k().min(1).regex(/^[^\s[\]]+$/u),description:k().optional(),path:k().min(1),scope:F([`project`,`global`]),source:k().min(1)}).strict();N({revision:A().int().nonnegative(),complete:j(),skills:M(rS),warnings:M(k()).optional()}).strict(),N({cwd:k().min(1).optional()}).strict();let iS=/\[\$([^\]\r\n]+)\]\((?:<([^<>\r\n]+)>|([^\s()]+))(?:[ \t]+(?:"[^"\r\n]*"|'[^'\r\n]*'))?\)/gu;function aS(e){return[...e.matchAll(iS)].flatMap(e=>{let t=e[2]??e[3]??``;return!/^(?:\/|[A-Za-z]:[\\/]|\\\\)/u.test(t)||!/[\\/]SKILL\.md$/u.test(t)?[]:[{start:e.index,end:e.index+e[0].length,name:e[1]??``,path:t,text:e[0]}]})}let oS=N({kind:F([`public`,`relay`,`tailscale-funnel`,`tailscale-https`,`tailscale`,`lan`,`virtual`]),url:k().min(1)}).strict(),sS=zs(`status`,[N({status:I(`not-installed`)}),N({status:I(`not-running`)}),N({status:I(`not-logged-in`)}),N({status:I(`https-disabled`)}),N({status:I(`not-serving`),command:k()}),N({status:I(`occupied`),target:k()}),N({status:I(`serving`),url:k(),funnel:j()}),N({status:I(`error`),message:k()})]);N({state:sS,error:k().optional()}).strict();let cS=zs(`status`,[N({status:I(`on`)}),N({status:I(`off`)}),N({status:I(`invalid`),reason:k()})]),lS=N({lan:j(),autostart:cS}).strict(),uS=N({expiresAt:k().optional(),issuing:j(),failure:N({detail:k().optional(),retryAt:k(),paused:j()}).optional()}),dS=zs(`status`,[N({status:I(`off`),reason:F([`invite`,`name-taken`,`banned`]).optional()}),N({status:I(`connecting`),reason:F([`full`,`unreachable`]).optional()}),N({status:I(`connected`),url:k(),certificate:uS}),N({status:I(`missing-certificate`),url:k(),certificate:uS}),N({status:I(`stopped`),reason:F([`replaced`,`rejected`,`unsupported-version`])})]);k().max(253).regex(/^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z](?:[a-z0-9-]{0,61}[a-z0-9])?$/i).transform(e=>e.toLowerCase()),k().regex(/^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)?$/);let fS=F([`official`,`self-hosted`]);N({secret:k().min(1),lastUsedAt:A().nullable(),networkUrls:M(oS),directCandidates:M(oS).optional(),tailscale:sS,background:lS.optional(),relay:N({state:dS,enabled:j(),kind:fS,officialHost:k(),customHost:k().optional(),officialHostname:k().optional(),customHostname:k().optional(),quotaUntil:k().optional()}).strict().optional()}).strict();let pS=P({threadId:k().min(1).max(1024),view:F([`result`,`messages`]),from:A().int().min(1).max(2**53-1).optional(),to:A().int().min(1).max(2**53-1).optional()}),mS=N({id:k().min(1).max(256),harnessId:k().min(1),label:k().min(1).max(512),provider:F([`openai-codex`,`xai`])}).strict(),hS=k().regex(/^[a-z][a-z0-9-]{0,47}$/),gS=N({name:hS,source:mS,importedAt:k()}).strict(),_S=zs(`action`,[N({action:I(`list`)}).strict(),N({action:I(`import`),sourceId:k().min(1).max(256),name:hS,confirmed:I(!0)}).strict(),N({action:I(`reimport`),sourceId:k().min(1).max(256),name:hS,confirmed:I(!0)}).strict(),N({action:I(`remove`),name:hS,confirmed:I(!0)}).strict()]),vS=N({provider:k().min(1).max(128),type:F([`oauth`,`api_key`,`unknown`]),label:k().min(1).max(512).optional(),vendor:F([`openai-codex`,`xai`]).optional()}).strict();N({sources:M(mS),targets:M(N({harnessId:k(),providers:M(F([`openai-codex`,`xai`])),imports:M(gS),others:M(vS).default([])}).strict())}).strict(),N({targetHarnessId:k().min(1).max(128).optional(),request:_S}).strict(),N({events:j()});let yS=M(P({agent:k().min(1).max(128),section:F([`main`,`more`,`auto`])})).max(256).refine(e=>new Set(e.map(e=>e.agent)).size===e.length,`Duplicate Harness IDs`);P({entries:yS.nullable()}),P({}),P({entries:yS,initializeOnly:j().optional()});let bS=P({enabled:j(),timeoutMinutes:A().int().min(5).max(1440)});Object.freeze({enabled:!1,timeoutMinutes:10});let xS=k().regex(/^external$/u),SS=mx.transform(e=>String(e)),CS=P({model:Px.optional(),thinkingOptionId:Fx.optional(),permissionModeId:vx.optional()}).refine(e=>!!(e.model||e.thinkingOptionId||e.permissionModeId),`A default configuration must contain a preference`),wS=P({lastHarness:mx.optional(),byHarness:Gs(SS,CS)}),TS=k().min(1).max(1024),ES=P({idleRelease:bS.optional(),favorites:Gs(SS,M(TS).max(2048)).default({}),newThread:wS.optional()});P({scope:xS,revision:A().int().nonnegative(),values:ES}),P({scope:xS.default(`external`)});let DS=zs(`kind`,[P({kind:I(`idleRelease`),value:bS}),P({kind:I(`favorite`),harnessId:mx,modelId:TS,enabled:j()}),P({kind:I(`favorites`),harnessId:mx,modelIds:M(TS).max(2048)}),P({kind:I(`newThread`),lastHarness:mx.optional(),harnessId:mx.optional(),configuration:CS.optional()})]);P({scope:xS.default(`external`),operations:M(DS).min(1).max(256),initializeOnly:j().optional(),expectedRevision:A().int().nonnegative().optional()}).superRefine((e,t)=>{for(let n of e.operations)n.kind===`newThread`&&(!n.lastHarness&&!n.configuration||!!n.harnessId!=!!n.configuration)&&t.addIssue({code:`custom`,message:`A default Harness or complete configuration is required`})}),P({version:I(1),revision:A().int().nonnegative(),scopes:Gs(xS,ES)});let OS=A().finite().nonnegative(),kS=P({input:OS,output:OS,cacheRead:OS.optional(),cacheWrite:OS.optional(),cacheWrite1h:OS.optional()}),AS=k().max(512).refine(e=>e.trim()===e&&e.length>0,`Model ID is required`);P({path:k(),entries:M(P({key:k(),price:kS})),error:k().nullable()}),P({}),P({key:AS,price:kS.nullable(),previousKey:AS.optional()}),P({model:AS});let jS=P({official:j().optional(),canonicalModelId:k().min(1).optional(),provider:k().min(1).max(512),model:k().min(1).max(512),price:kS});P({price:kS.nullable(),suggestions:M(jS).max(6).optional()});let MS=[`today`,`7d`,`30d`,`90d`,`all`],NS=A().int().min(0).max(2**53-1),PS=k().regex(/^\d{4}-\d{2}-\d{2}$/u),FS=k().min(1).max(128),IS=k().min(1).max(512),LS=k().min(1).max(4096);P({range:F(MS),timeZone:k().min(1).max(128).refine(e=>{try{return new Intl.DateTimeFormat(`en`,{timeZone:e}),!0}catch{return!1}},`Unsupported usage statistics timezone`).optional(),harness:FS.optional(),model:IS.nullable().optional(),project:LS.nullable().optional(),date:PS.optional()});let RS=P({requests:NS,inputTokens:NS,cachedInputTokens:NS,cacheWriteInputTokens:NS,cacheKnownInputTokens:NS,cacheHitCachedInputTokens:NS,cacheHitInputTokens:NS,outputTokens:NS,reasoningOutputTokens:NS,costUsd:A().finite().min(0),unpricedRequests:NS,unmeteredRequests:NS}),zS=RS.shape,BS=P({harness:FS,sessionId:k().min(1).max(512),project:LS.nullable(),title:k().min(1).max(200).optional(),models:M(IS).max(16),firstAtMs:NS,lastAtMs:NS,...zS});P({range:F(MS),from:PS.nullable(),to:PS,filters:P({harness:FS.nullable(),model:IS.nullable(),unknownModel:j(),project:LS.nullable(),unknownProject:j(),date:PS.nullable()}),reading:P({complete:j(),sources:NS,read:NS}),failures:M(P({harness:FS,message:k().max(2048)})).max(256),options:P({harnesses:M(FS).max(256),models:M(IS.nullable()).max(4096),projects:M(LS.nullable()).max(4096)}),modelLabels:M(P({harness:FS,model:IS,label:IS})).max(4096).optional(),credits:M(P({harness:FS,model:IS.nullable(),credits:A().finite().min(0),reportedRequests:NS,requests:NS})).max(4096).optional(),totals:RS,daily:M(P({date:PS,harness:FS,...zS})).max(2e5),hourly:M(P({weekday:A().int().min(0).max(6),hour:A().int().min(0).max(23),...zS})).max(168),byHarness:M(P({harness:FS,...zS})).max(256),byModel:M(P({model:IS.nullable(),...zS,harnessPricedRequests:NS})).max(4096),byProject:M(P({project:LS.nullable(),...zS})).max(4096),sessions:M(BS).max(100),recentSessions:M(BS).max(100).optional()}),N({threadId:hx}),N({discarded:j()});let VS=zs(`type`,[N({id:k().min(1),type:I(`choice`),prompt:k(),options:M(N({value:k().min(1),label:k(),description:k().optional()})).min(1),multiple:j(),allowOther:j(),optional:j()}),N({id:k().min(1),type:I(`text`),prompt:k(),multiline:j(),secret:I(!1),optional:j(),placeholder:k().optional(),prefill:k().optional()})]),HS=N({interactionId:k().min(1),turnId:k().min(1),title:k().optional(),questions:M(VS).min(1)}).refine(({questions:e})=>e.some(e=>e.type===`choice`&&e.multiple),{message:`Shared cards require at least one multi-select question`});P({threadId:k().min(1)}),N({questions:M(HS)}),P({threadId:k().min(1),turnId:k().min(1),interactionId:k().min(1),answers:Gs(k(),M(k())),cancelled:j().default(!1)}),N({accepted:I(!0)});let US=N({path:k(),oldText:k().nullable(),newText:k()});N({sessionId:k().min(1),turn:A().int().nonnegative(),path:k().min(1).optional()}),N({diffs:M(US)}),P({}),P({}),N({reference:N({sessionId:k().min(1),epoch:k().min(1),turn:A().int().nonnegative(),seq:A().int().nonnegative(),callId:k().min(1),part:A().int().nonnegative(),version:k().min(1)}),length:A().int().nonnegative(),bytes:A().int().nonnegative()}),P({title:k().trim().min(1).max(200),type:F([`info`,`warning`,`danger`]),body:k().trim().min(1).max(16384)}),P({}),P({url:k().max(2048).regex(/^http:\/\/(?:127\.0\.0\.1|localhost):\d{1,5}\/(?:\?.*)?$/u)}),Object.freeze(/* @__PURE__ */ `codexhost/console/remote-connections.codexhost/runtime/status.codexhost/remote/ssh-setup.codexhost/harness/plugins/list.codexhost/harness/display-settings/capabilities.codexhost/harness/display-settings/get.codexhost/harness/display-settings/set.codexhost/harness/inspect.codexhost/harness/installation.codexhost/harness/installation/start.codexhost/harness/installation/status.codexhost/harness/launch-settings/get.codexhost/harness/launch-settings/set.codexhost/harness/web-ui/open.codexhost/harness/accounts/sources.codexhost/harness/accounts/list.codexhost/harness/accounts/inspect.codexhost/harness/credential-imports.codexhost/harness/session-import/sources.codexhost/harness/session-import/list.codexhost/harness/session-import/import.codexhost/account/list.codexhost/account/refresh.codexhost/account/usage/inspect.codexhost/usage/model-prices/get.codexhost/usage/model-prices/set.codexhost/usage/model-prices/default.codexhost/usage/statistics/get.codexhost/update/check.codexhost/update/start.codexhost/update/status`.split(`.`));let WS=F([`idle`,`running`,`busy`,`closing`,`failed`,`blocked`]),GS=F([`none`,`disabled`,`timeout`,`operation`,`background`,`identity`,`persistence`,`closeFailed`]);P({threadId:k(),title:k(),harnessId:k(),state:WS,reason:GS,inactiveMs:A().nonnegative()}),P({threadId:hx,turnId:gx});let KS=N({amount:A().finite().nonnegative(),currency:k().trim().min(1).max(8),label:k().trim().min(1).max(128).optional()}).strict(),qS=N({email:k().trim().min(1).max(320).optional(),label:k().trim().min(1).max(256).optional(),plan:k().trim().min(1).max(128).optional(),credits:Mx.optional(),balance:KS.optional()}).strict();function JS(e){return e.refine(e=>{let t=e;return t.credits!==void 0||t.balance!==void 0},{message:`Account must report either credits or a balance`})}let YS=JS(qS),XS={harnessId:mx,harnessName:k().trim().min(1).max(128)},ZS=N(XS).strict();N({}).strict(),N({sources:M(ZS).max(128)}).strict(),N({harnessId:mx,refresh:j().optional()}).strict(),N({...XS,account:YS.nullable(),accounts:M(YS).max(8).optional()}).strict(),N({refresh:j().optional()}).strict(),N({accounts:M(JS(qS.extend(XS))).max(128)}).strict();let QS=k().min(1).max(128).regex(/^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/u).pipe(mx),$S=QS.refine(e=>e!==`codex`,`The official Codex identity is reserved`),eC=k().min(1).max(512).refine(e=>!/[\\\u0000:#?]/u.test(e)&&!e.startsWith(`/`)&&!e.split(`/`).some(e=>e===`..`||e===``),`Plugin resources must be relative paths inside the plugin`),tC=cs().refine(e=>/^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(e),`Plugin documentation links must be credential-free HTTPS URLs`),nC=N({en:k().max(4096),"zh-CN":k().max(4096).optional()}).strict(),rC=N({commands:M(N({terminal:k().max(256),command:k().max(4096)}).strict()).max(8),before:nC.optional(),after:nC.optional(),downloads:M(N({label:k().max(128),url:tC}).strict()).max(8).optional()}).strict(),iC={id:QS,name:k().trim().min(1).max(128),version:k().min(1).max(128),kind:I(`usage`).optional(),iconStyle:N({vector:N({viewBox:k().max(128).regex(/^-?\d+(?:\.\d+)?(?: +-?\d+(?:\.\d+)?){3}$/u),color:k().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu),paths:M(N({d:k().min(1).max(32768).regex(/^[MmLlHhVvCcSsQqTtAaZz\d.,+eE\s-]+$/u),fillRule:F([`evenodd`,`nonzero`]).optional(),fill:k().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu).optional()}).strict()).min(1).max(32)}).strict().optional(),background:k().regex(/^#[a-f0-9]{6}$/iu).optional(),borderRadius:A().min(0).max(50).optional(),paddingRatio:A().min(0).max(.25).optional()}).strict().optional(),installation:rC.optional(),notice:nC.optional(),launchCommand:I(!0).optional(),links:N({website:tC.optional(),documentation:tC.optional(),installation:tC.optional()}).strict().optional()};N({manifestVersion:I(1),...iC,adapterApiVersion:A().int().positive(),entry:eC,icon:eC.optional()}).strict();let aC=k().max(174828).regex(/^data:image\/(?:png|jpeg|webp|svg\+xml);base64,[A-Za-z0-9+/]+={0,2}$/u),oC=N({...iC,icon:aC.optional()}).strict();N({}).strict(),N({plugins:M(oC.extend({id:$S})).max(128)}).strict(),N({version:I(1),enabled:M(QS).max(128)}).strict().refine(e=>new Set(e.enabled).size===e.enabled.length,{message:`Enabled plugin IDs must be unique`,path:[`enabled`]}),N({harnessId:$S,model:Px.optional(),thinkingOptionId:Fx.optional(),permissionModeId:vx.optional(),prewarm:I(!0).optional()}).strict();let sC=k().trim().min(1).max(4096).refine(e=>!/[\u0000\r\n]/u.test(e),`Invalid entrypoint path`);N({harnessId:$S}).strict().extend({path:sC.nullable()}),N({path:sC.nullable(),restartRequired:j()}).strict(),N({harnessId:mx,action:F([`check`,`update`,`install`])}).strict();let cC=N({currentVersion:k().min(1).max(128),latestVersion:k().min(1).max(128),updateAvailable:j(),canUpdate:j(),versionKind:F([`cli`,`application`]).optional(),manualUpdateUrl:cs().max(2048).refine(e=>/^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(e),`Manual updates require a credential-free HTTPS URL`).optional(),message:k().max(2048).optional(),messageCode:k().min(1).max(128).optional(),notice:fx.optional(),latestVersionKind:F([`unknown`,`tracking-branch`]).optional()}).strict();N({taskId:k().uuid()}).strict(),zs(`status`,[N({taskId:k().uuid(),status:I(`running`)}).strict(),N({taskId:k().uuid(),status:I(`succeeded`),result:cC}).strict(),N({taskId:k().uuid(),status:I(`failed`),error:N({code:A().int(),message:k().min(1).max(2048)}).strict()}).strict()]);let lC=k().min(1).max(256).regex(/^[A-Za-z0-9._~-]+$/u),uC=k().trim().min(1),dC=F([`free`,`go`,`plus`,`pro`,`prolite`,`team`,`self_serve_business_prolite`,`self_serve_business_usage_based`,`business`,`ent26`,`enterprise_cbp_automation`,`enterprise_cbp_usage_based`,`enterprise`,`edu`,`edu_plus`,`edu_pro`,`unknown`]),fC=N({accountId:lC,label:uC.max(256),email:k().email().max(320).optional(),planType:dC.optional()}).strict(),pC=F([`ready`,`unavailable`]);N({version:I(2),currentAccountId:lC.nullable(),phase:pC,revision:A().int().nonnegative(),instanceId:uC.max(1024).optional(),accounts:M(fC).max(1)}).strict(),N({accountId:lC,refresh:j().optional()}).strict(),N({accountId:lC,usage:Ex.nullable(),accountCredits:Mx.optional(),freshness:F([`live`,`cached`]),observedAt:k().datetime().nullable()}).strict();let mC=1e3,hC=k().refine(e=>e.trim().length>0,`Value must not be empty or whitespace`).refine(e=>!e.includes(`\0`),`Value must not contain NUL`),gC=hC.max(1024),_C=N({nativeSessionId:gC,title:hC.max(4096).nullable(),updatedAt:A().int().nonnegative().max(864e13),cwd:hC.max(16384),running:j().nullable()}).strict();N({}).strict(),N({harnesses:M(N({harnessId:$S,name:hC.max(128)}).strict()).max(128)}).strict(),N({harnessId:$S,query:k().trim().max(4096).refine(e=>!e.includes(`\0`)).optional(),offset:A().int().nonnegative().safe().optional(),limit:A().int().min(1).max(mC).optional()}).strict(),N({candidates:M(_C).max(mC),total:A().int().nonnegative().safe()}).strict(),N({harnessId:$S,nativeSessionId:gC}).strict(),N({threadId:hC.max(1024).pipe(hx)}).strict();let vC=k().refine(e=>e.trim().length>0,`Value must not be empty or whitespace`).refine(e=>!e.includes(`\0`),`Value must not contain NUL`),yC=gC,bC=_C;N({}).strict(),N({candidates:M(bC).max(1e3)}).strict(),N({nativeSessionId:yC}).strict(),N({threadId:vC.max(1024).pipe(hx)}).strict(),N({threadId:hx,lastTurnId:gx}).strict(),N({threadId:hx}).strict();let xC=k().trim().min(1).max(128).regex(/^[A-Za-z0-9._:-]+$/u).brand();N({commands:M(N({id:xC,invocation:k().min(1).max(128),label:k().trim().min(1).max(128),description:k().trim().min(1).max(512).optional(),localizations:dx.optional(),argumentMode:F([`none`,`text`]),kind:F([`command`,`skill`]).optional()}).strict()),warnings:M(k().min(1)).optional(),source:F([`live`,`static`]).optional()}).strict().superRefine((e,t)=>{let n=/* @__PURE__ */ new Set;for(let[r,i]of e.commands.entries())n.has(i.id)&&t.addIssue({code:`custom`,message:`Harness command IDs must be unique`,path:[`commands`,r,`id`]}),n.add(i.id)}),N({harnessId:mx,cwd:k().min(1).optional()}).strict(),N({threadId:hx}).strict(),N({threadId:hx,commandId:xC,turnId:gx.optional(),arguments:sx.optional()}).strict(),N({accepted:I(!0),turnId:gx.optional()}).strict();let SC=I(`2.0`).optional(),CC=Ns().optional(),wC=k().min(1),TC=Ls([k(),A().int()]),EC=N({code:A().int(),message:k(),data:ox.optional()}).catchall(ox).superRefine(tx([`data`]));Ls([N({jsonrpc:SC,id:TC,method:wC,params:ox.optional(),result:CC,error:CC}).catchall(ox).superRefine(tx([`jsonrpc`,`params`,`result`,`error`])),N({jsonrpc:SC,id:CC,method:wC,params:ox.optional(),result:CC,error:CC}).catchall(ox).superRefine(tx([`jsonrpc`,`id`,`params`,`result`,`error`])),N({jsonrpc:SC,id:TC,method:CC,params:CC,result:ox,error:CC}).catchall(ox).superRefine(tx([`jsonrpc`,`method`,`params`,`error`])),N({jsonrpc:SC,id:TC,method:CC,params:CC,result:CC,error:EC}).catchall(ox).superRefine(tx([`jsonrpc`,`method`,`params`,`result`]))]);let DC=k().refine(e=>e.trim().length>0,{message:`Native identifier must not be empty or whitespace`});P({harnessId:mx,nativeSessionId:DC,locator:ox.optional(),formatVersion:I(1)}).superRefine(tx([`locator`])),P({harnessId:mx,nativeSessionId:DC,nativeTurnKey:DC,formatVersion:I(1)}),P({harnessId:mx,nativeSessionId:DC,checkpointId:DC,locator:ox.optional(),formatVersion:I(1)}).superRefine(tx([`locator`]));let OC=k().regex(/^\d+\.\d+\.\d+(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/u),kC=F([`npm`,`windows-installer`,`macos-dmg`]),AC=P({version:OC,installation:kC,phase:F([`prepared`,`downloading`,`waiting-for-exit`,`installing`,`restarting`,`succeeded`,`failed`]),updatedAt:A().int().nonnegative(),downloadedBytes:A().int().nonnegative().optional(),totalBytes:A().int().positive().optional(),error:k().min(1).max(500).nullable(),serviceStopOutput:k().optional()}).superRefine((e,t)=>{e.downloadedBytes!==void 0&&e.totalBytes!==void 0&&e.downloadedBytes>e.totalBytes&&t.addIssue({code:`custom`,path:[`downloadedBytes`],message:`downloadedBytes must not exceed totalBytes`})});P({});let jC=k().max(300).regex(/^https:\/\/github\.com\/BytePioneer-AI\/codex-host\/releases\/tag\/v[0-9A-Za-z.+-]+$/u,`release notes URL must identify a codexhost GitHub Release`);P({currentVersion:OC,installation:kC.nullable(),latestVersion:OC.nullable(),updateAvailable:j(),installationAvailable:j(),releaseNotes:k().min(1).max(2e4).nullable(),releaseNotesUrl:jC.nullable(),status:AC.nullable(),error:k().min(1).max(500).nullable()}),P({status:AC}),P({status:AC.nullable()}),RegExp(String.raw`^- \[([^\]\n]+)\]\(thread://([^\s()<>"?#/]+)\): `+`(${[`completed`,`failed`,`interrupted`,`needsInput`,`timedOut`,`unreadable`,`notFound`].join(`|`)})(?:\. (.+))?$`,`u`);function MC(e){if(e.length===0)return``;let t=e.map(({text:e,annotation:t})=>({text:e,...t===void 0?{}:{annotation:t}}));return`\n# Response annotations:\nEach item contains text selected from an earlier Codex response and may include a user comment. Treat items as Annotation 1, Annotation 2, and so on in array order. Use every selection as context and address every comment. For every annotation you address, include its inline directive \`:codex-annotation{index="N"}\`, where N is its one-based array position (for example, \`:codex-annotation{index="1"}\`). Do not use unstructured annotation labels.\n<response-annotations>\n${JSON.stringify(t)}\n</response-annotations>\n`}function NC(e,t){let n=MC(e);return n===``?t:`${n}\n## My request:\n${t}\n`}let PC=F([`idle`,`installing`,`restarting`,`succeeded`,`failed`]);N({runningVersion:k().nullable(),installedVersion:k().nullable(),restartRequired:j(),remote:j(),updateSupported:j(),update:N({phase:PC,targetVersion:k().nullable(),error:k().nullable()})});let FC=N({version:k().regex(/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/u)}).strict();N({hostname:k().min(1).max(1024).refine(e=>!e.startsWith(`-`)&&!/\s/u.test(e)),port:A().int().min(1).max(65535).nullable(),identity:k().max(4096).nullable(),action:F([`inspect`,`install`,`update`,`repair`,`uninstall`]),uninstallPackage:j().optional(),version:k().regex(/^\d+\.\d+\.\d+$/u).nullable()}).strict(),N({state:F([`installed`,`not-installed`])}).strict();let IC=k().min(1).max(1024),LC={hostId:IC.regex(/^remote-(?:ssh(?:-|:)|control:)/u)},RC={...LC,threadId:IC},zC=zs(`kind`,[P({kind:I(`hosts`)}),P({kind:I(`status`),...RC}),P({kind:I(`list`),...LC,cursor:k().nullable(),archived:j()}),P({kind:I(`read`),...RC,page:P({cursor:k().min(1).max(8192).nullable(),epoch:IC.optional(),sortDirection:F([`asc`,`desc`]).optional(),limit:A().int().min(1).max(20).optional()}).refine(e=>e.cursor===null||e.epoch!==void 0,{message:`A history continuation requires its connection epoch`}).optional()}),P({kind:I(`usage`),...RC,epoch:IC}),P({kind:I(`configure`),...RC,epoch:IC,modelId:IC.optional(),thinkingOptionId:IC.optional(),permissionModeId:IC.optional()}).refine(e=>[e.modelId,e.thinkingOptionId,e.permissionModeId].filter(e=>e!==void 0).length===1,`Select exactly one remote setting`),P({kind:I(`prompt`),...RC,epoch:IC,text:k().min(1).max(8e3),requestId:IC.optional()}),P({kind:I(`interrupt`),...RC,epoch:IC,turnId:IC}),P({kind:I(`rename`),...RC,epoch:IC,name:k().min(1).max(512)}),P({kind:I(`archive`),...RC,epoch:IC,archived:j()}),P({kind:I(`respond`),...RC,epoch:IC,requestId:Ls([IC,A().int()]),result:Gs(k(),js())})]),BC=k().min(1).max(1024),VC=N({hostId:BC,displayName:k().min(1).max(1024),source:F([`codex-managed`,`discovered`]),sshAlias:k().max(1024).nullable(),sshHost:k().min(1).max(1024),sshPort:A().int().min(1).max(65535).nullable(),identity:k().max(4096).nullable(),autoConnect:j(),connectionAnalyticsId:k().max(1024).optional()}),HC=P({displayName:k().min(1).max(1024),hostname:k().min(1).max(1024),sshPort:A().int().min(1).max(65535).nullable(),identity:k().max(4096).nullable()});zs(`action`,[P({action:I(`session`),operation:zC}),P({action:I(`list`)}),P({action:I(`catalog`)}),P({action:I(`read-thread`),hostId:BC.refine(e=>e!==`local`),input:pS}),P({action:I(`save`),draft:HC,previous:VC.nullable()}),P({action:I(`remove`),previous:VC}),P({action:I(`connect`),hostId:BC,enabled:j()}),P({action:I(`state`),hostId:BC}),P({action:I(`runtime`),hostId:BC}),P({action:I(`update`),hostId:BC.refine(e=>e!==`local`),version:FC.shape.version})]),Ls([P({result:ox}),P({error:P({code:A().int(),message:k()})})]),P({prompt:k().trim().min(1).max(2e3),cwd:k().max(4096).nullable()}),k().trim().min(1).max(60).nullable();let UC=k().max(214).regex(/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/u),WC=Ls([k(),N({en:k()}).catchall(k())]),GC=N({title:WC.optional(),description:WC.optional(),icon:k().max(349592).regex(/^data:image\/(?:svg\+xml|png|jpeg|webp);base64,[A-Za-z0-9+/]*={0,2}$/u).optional(),error:k().optional()});N({extensions:M(N({id:UC,name:k().min(1).max(214),version:k().min(1).max(128),format:I(`dsh`),supportedTargets:Us([I(`web`)]),enabledTargets:M(I(`web`)).max(1),source:k().min(1).max(4096),projectUrl:k().max(4096).url({protocol:/^https?$/u}).optional(),installedAt:k(),meta:GC.optional(),loadError:k().optional()})),loadedIds:M(UC),safeMode:j(),storeError:k().optional()});let KC=k().trim().max(2048).url({protocol:/^https?$/u,normalize:!0}).refine(e=>!/[\s\\?#]/u.test(e)&&!e.split(`/`)[2]?.includes(`@`),`Use an HTTP(S) registry URL without credentials, a query, or a fragment.`).transform(e=>e.endsWith(`/`)?e:`${e}/`);N({spec:k().trim().min(1).max(4096),registry:KC.optional()}).strict(),N({id:UC,enabled:j()}).strict(),N({id:UC}).strict(),I(1);function qC(e){return e.registerNodeTransform(Ff,e=>{let t=aS(e.getTextContent())[0];t&&e.splitText(t.start,t.end)[t.start===0?0:1]?.replace(new zb({source:`codexhost-skill`,ref:t.text,label:t.name,appearance:`skill`,clipboardText:t.text}))})}let JC=`color: var(--dsw-alias-state-business-primary)`;function YC(){let e=wh().getFirstChild();if(!G(e))return null;let t=e.getFirstChild();return V(t)?t:null}function XC(e,t){return e.registerNodeTransform(Ff,e=>{let n=YC();if(n===null||e.getKey()!==n.getKey()){e.getStyle()===JC&&e.setStyle(``);return}let r=e.getTextContent(),i=t(),a=r===i?.trimEnd()?r:i;if(a===null||!r.startsWith(a))e.getStyle()===JC&&e.setStyle(``);else if(r.length>a.length){let[t,n]=e.splitText(a.length);t!==void 0&&t.getStyle()!==JC&&t.setStyle(JC),n?.setStyle(``)}else e.getStyle()!==JC&&e.setStyle(JC)})}function ZC(e){e.update(()=>{YC()?.markDirty()})}function QC(){let e=[],t=/* @__PURE__ */ new Map,n=/* @__PURE__ */ new Map,r=/* @__PURE__ */ new Map,i=``,a=``,o=(n,r,o,s)=>{let c={kind:n,node:r,detectStart:i.length,detectLength:o.length,clipboardStart:a.length,clipboardLength:s.length};e.push(c),t.set(r.getKey(),c),i+=o,a+=s},s=e=>{let t=i.length,a=e.getChildren();n.set(e.getKey(),a.map(e=>e.getKey()));for(let e of a)if(Vb(e))o(`chip`,e,``,e.getTextContent());else if(V(e)){let t=e.getTextContent();o(`text`,e,t,t)}else Mm(e)?o(`linebreak`,e,`
|
|
156
156
|
`,`
|
|
157
157
|
`):G(e)&&
|
|
158
158
|
/* v8 ignore next 4 -- plain-text composition nests no block elements today; the walk stays total for imported states. */
|