@codexhost/cli-linux-arm64 0.23.0 → 0.24.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 +1565 -1805
- package/app/console-web.js +5786 -1600
- package/app/desktop-controller.mjs +13104 -2842
- package/app/host-runtime.mjs +50518 -51753
- package/app/plugins/antigravity/plugin.mjs +1932 -1148
- package/app/plugins/claude-code/plugin.mjs +1676 -1218
- package/app/plugins/codebuddy/plugin.mjs +1266 -850
- package/app/plugins/codex-usage/plugin.mjs +916 -737
- package/app/plugins/copilot/plugin.mjs +838 -640
- package/app/plugins/cursor-cli/plugin.mjs +1058 -747
- package/app/plugins/deepseek-harness/plugin.mjs +1302 -1070
- package/app/plugins/devin/plugin.mjs +949 -752
- package/app/plugins/grok/plugin.mjs +1132 -964
- package/app/plugins/hermes/plugin.mjs +1084 -905
- package/app/plugins/kimi-code/plugin.mjs +977 -804
- package/app/plugins/kiro-cli/plugin.mjs +951 -758
- package/app/plugins/omp/plugin.mjs +1408 -1169
- package/app/plugins/opencode/plugin.mjs +1385 -1142
- package/app/plugins/pi/plugin.mjs +1515 -1287
- package/app/plugins/qoder/plugin.mjs +861 -676
- package/app/plugins/qoder-cn/plugin.mjs +861 -676
- package/app/plugins/qwen-code/plugin.mjs +1060 -888
- package/app/plugins/workbuddy/plugin.mjs +1272 -856
- package/app/plugins/zcode/plugin.mjs +1529 -880
- package/app/renderer-extension.js +11568 -7827
- package/app/web/assets/index-CTCFIQbU.css +1 -0
- package/app/web/assets/index-IvFk9KT-.js +203 -0
- package/app/web/codexhost-settings.js +4472 -36194
- package/app/web/index.html +2 -2
- 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 +69 -69
- package/app/web/plugins/deepseek-ai__dsh-client-ui-approval/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-chat/client.js +74 -74
- package/app/web/plugins/deepseek-ai__dsh-client-ui-codexhost/client.js +75 -64
- package/app/web/plugins/deepseek-ai__dsh-client-ui-conversation/client.js +19 -16
- package/app/web/plugins/deepseek-ai__dsh-client-ui-input-trigger/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-layout/client.js +2 -2
- package/app/web/plugins/deepseek-ai__dsh-client-ui-model-selection/client.js +2 -2
- package/app/web/plugins/deepseek-ai__dsh-client-ui-settings-general/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar/client.js +2 -2
- package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar-documentpreview/client.js +9 -9
- package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar-right/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-theme/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-tool/client.js +18 -18
- package/app/web/plugins/deepseek-ai__dsh-client-ui-user-questions/client.js +3 -3
- package/app/web/plugins/deepseek-ai__dsh-client-ui-workspace/client.js +7 -7
- package/app/web/sw.js +8 -1
- package/app/web-modules/server.mjs +2682 -5540
- 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-DJW4bmyx.css +0 -1
- package/app/web/assets/index-Dyh1KzAB.js +0 -201
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
window.__ModuleLoader__.load({id:`@deepseek-ai/dsh-client-ui-conversation`,factory:e=>{var t={exports:{}},n=t.exports;Object.defineProperty(n,Symbol.toStringTag,{value:`Module`});var r=Object.create,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,s=Object.getPrototypeOf,c=Object.prototype.hasOwnProperty,l=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var s=o(t),l=0,u=s.length,d;l<u;l++)d=s[l],!c.call(e,d)&&d!==n&&i(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(r=a(t,d))||r.enumerable});return e},u=(e,t,n)=>(n=e==null?{}:r(s(e)),l(t||!e||!e.__esModule||!c.call(e,`default`)?i(n,`default`,{value:e,enumerable:!0}):n,e));let d=e("@deepseek-ai/dsh-client-ui-primitives"),f=e("@deepseek-ai/dsh-client-store"),p=e("@deepseek-ai/dsh-client-ui-slots"),m=e("@deepseek-ai/cordis"),h=e("react/jsx-runtime"),g=e("react");g=u(g,1);let _=e("react-dom");function v(e){return e==null}function y(e){return e&&typeof e==`object`&&!Array.isArray(e)}function ee(e,t){return Object.fromEntries(Object.entries(e).filter(([e,n])=>t(e,n)))}function b(e,t){return Object.fromEntries(Object.entries(e).map(([e,n])=>[e,t(n,e)]))}function x(e,t,n){if(!t)return{...e};let r={};for(let i of t)(n||e[i]!==void 0)&&(r[i]=e[i]);return r}let te=Symbol.for(`cosmokit.volatile.write`);function ne(e,t=/* @__PURE__ */ new Set){if(typeof e==`function`)throw TypeError(`volatile config cannot contain functions`);if(typeof e!=`object`||!e)return e;if(t.has(e))throw TypeError(`volatile config cannot contain cycles`);t.add(e);try{if(Array.isArray(e))return Object.freeze(e.map(e=>ne(e,t)));if(Object.getPrototypeOf(e)!==Object.prototype&&Object.getPrototypeOf(e)!==null)throw TypeError(`volatile config objects must be plain objects or arrays`);return Object.freeze(Object.fromEntries(Object.entries(e).map(([e,n])=>[e,ne(n,t)])))}finally{t.delete(e)}}function re(e){let t=ne(e);return Object.freeze({get:()=>t,[te]:e=>{t=e}})}function ie(e){return typeof e==`object`&&!!e&&te in e}function ae(e,t){return arguments.length===1?t=>ae(e,t):e in globalThis&&t instanceof globalThis[e]||Object.prototype.toString.call(t).slice(8,-1)===e}function oe(e){return ae(`ArrayBuffer`,e)||ae(`SharedArrayBuffer`,e)}function se(e){return oe(e)||ArrayBuffer.isView(e)}let S;(function(e){e.is=oe,e.isSource=se;function t(e){return ArrayBuffer.isView(e)?e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength):e}e.fromSource=t;function n(e){if(e=t(e),typeof Buffer<`u`)return Buffer.from(e).toString(`base64`);let n=``,r=new Uint8Array(e);for(let e=0;e<r.byteLength;e++)n+=String.fromCharCode(r[e]);return btoa(n)}e.toBase64=n;function r(e){return typeof Buffer<`u`?t(Buffer.from(e,`base64`)):Uint8Array.from(atob(e),e=>e.charCodeAt(0))}e.fromBase64=r;function i(e){return e=t(e),typeof Buffer<`u`?Buffer.from(e).toString(`hex`):Array.from(new Uint8Array(e),e=>e.toString(16).padStart(2,`0`)).join(``)}e.toHex=i;function a(e){if(typeof Buffer<`u`)return t(Buffer.from(e,`hex`));let n=e.length%2==0?e:e.slice(0,e.length-1),r=[];for(let e=0;e<n.length;e+=2)r.push(parseInt(`${n[e]}${n[e+1]}`,16));return Uint8Array.from(r).buffer}e.fromHex=a})(S||={}),S.fromBase64,S.toBase64,S.fromHex,S.toHex;function ce(e,t=/* @__PURE__ */ new Map){if(!e||typeof e!=`object`)return e;if(ae(`Date`,e))return new Date(e.valueOf());if(ae(`RegExp`,e))return new RegExp(e.source,e.flags);if(oe(e))return e.slice(0);if(ArrayBuffer.isView(e))return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);let n=t.get(e);if(n)return n;if(Array.isArray(e)){let n=[];return t.set(e,n),e.forEach((e,r)=>{n[r]=Reflect.apply(ce,null,[e,t])}),n}let r=Object.create(Object.getPrototypeOf(e));t.set(e,r);for(let n of Reflect.ownKeys(e)){let i={...Reflect.getOwnPropertyDescriptor(e,n)};`value`in i&&(i.value=Reflect.apply(ce,null,[i.value,t])),Reflect.defineProperty(r,n,i)}return r}function le(e,t,n){let r=/* @__PURE__ */ new Set;function i(e,t){if(e===t)return!0;if(ie(e)||ie(t))return ie(e)&&ie(t);if(!n&&v(e)&&v(t))return!0;if(typeof e!=typeof t||typeof e!=`object`||!e||!t||r.has(e))return!1;function a(n,r){return n(e)?n(t)?r(e,t):!1:!n(t)&&void 0}r.add(e);try{return a(Array.isArray,(e,t)=>{if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!i(e[n],t[n]))return!1;return!0})??a(ae(`Date`),(e,t)=>e.valueOf()===t.valueOf())??a(ae(`URL`),(e,t)=>e.href===t.href)??a(ae(`RegExp`),(e,t)=>e.source===t.source&&e.flags===t.flags)??a(oe,(e,t)=>{if(e.byteLength!==t.byteLength)return!1;let n=new Uint8Array(e),r=new Uint8Array(t);for(let e=0;e<n.length;e++)if(n[e]!==r[e])return!1;return!0})??((!n||[e,t].every(e=>Object.getPrototypeOf(e)===Object.prototype||Object.getPrototypeOf(e)===null))&&Object.keys({...e,...t}).every(n=>i(e[n],t[n])))}finally{r.delete(e)}}return i(e,t)}let ue;(function(e){e.millisecond=1;let t=e.second=1e3,n=e.minute=t*60,r=e.hour=n*60,i=e.day=r*24,a=e.week=i*7,o=(/* @__PURE__ */ new Date()).getTimezoneOffset();function s(e){o=e}e.setTimezoneOffset=s;function c(){return o}e.getTimezoneOffset=c;function l(e=/* @__PURE__ */ new Date,t){return typeof e==`number`&&(e=new Date(e)),t===void 0&&(t=o),Math.floor((e.valueOf()/n-t)/1440)}e.getDateNumber=l;function u(e,t){let r=new Date(e*i);return t===void 0&&(t=o),new Date(+r+t*n)}e.fromDateNumber=u;let d=RegExp(`^${[`w(?:eek(?:s)?)?`,`d(?:ay(?:s)?)?`,`h(?:our(?:s)?)?`,`m(?:in(?:ute)?(?:s)?)?`,`s(?:ec(?:ond)?(?:s)?)?`].map(e=>`(\\d+(?:\\.\\d+)?${e})?`).join(``)}$`);function f(e){let o=d.exec(e);return o?(parseFloat(o[1])*a||0)+(parseFloat(o[2])*i||0)+(parseFloat(o[3])*r||0)+(parseFloat(o[4])*n||0)+(parseFloat(o[5])*t||0):0}e.parseTime=f;function p(e){let t=f(e);return t?e=Date.now()+t:/^\d{1,2}(:\d{1,2}){1,2}$/.test(e)?e=`${(/* @__PURE__ */ new Date()).toLocaleDateString()}-${e}`:/^\d{1,2}-\d{1,2}-\d{1,2}(:\d{1,2}){1,2}$/.test(e)&&(e=`${(/* @__PURE__ */ new Date()).getFullYear()}-${e}`),e?new Date(e):/* @__PURE__ */ new Date}e.parseDate=p;function m(e){let a=Math.abs(e);return a>=i-r/2?Math.round(e/i)+`d`:a>=r-n/2?Math.round(e/r)+`h`:a>=n-t/2?Math.round(e/n)+`m`:a>=t?Math.round(e/t)+`s`:e+`ms`}e.format=m;function h(e,t=2){return e.toString().padStart(t,`0`)}e.toDigits=h;function g(e,t=/* @__PURE__ */ new Date){return e.replace(`yyyy`,t.getFullYear().toString()).replace(`yy`,t.getFullYear().toString().slice(2)).replace(`MM`,h(t.getMonth()+1)).replace(`dd`,h(t.getDate())).replace(`hh`,h(t.getHours())).replace(`mm`,h(t.getMinutes())).replace(`ss`,h(t.getSeconds())).replace(`SSS`,h(t.getMilliseconds(),3))}e.template=g})(ue||={});let de=Symbol.for(`schemastery`),fe=Symbol.for(`ValidationError`);globalThis.__schemastery_index__??=0,globalThis.__schemastery_refs__=void 0;var C=class extends TypeError{options;name=`ValidationError`;constructor(e,t){let n=`$`;for(let e of t.path||[])typeof e==`string`?n+=`.`+e:typeof e==`number`?n+=`[`+e+`]`:typeof e==`symbol`&&(n+=`[Symbol(${e.toString()})]`);n.startsWith(`.`)&&(n=n.slice(1)),super((n===`$`?``:`${n} `)+e),this.options=t}static is(e){return!!e?.[fe]}};Object.defineProperty(C.prototype,fe,{value:!0});let w=function(e){let t=function(e,n={}){return w.resolve(e,t,n)[0]};if(e.refs){let t=b(e.refs,e=>new w(e)),n=e=>t[e];for(let e in t){let r=t[e];r.sKey=n(r.sKey),r.inner=n(r.inner),r.list=r.list&&r.list.map(n),r.dict=r.dict&&b(r.dict,n)}return t[e.uid]}if(Object.assign(t,e),typeof t.callback==`string`)try{t.callback=Function(`return `+t.callback)()}catch{}return Object.defineProperty(t,"uid",{value:globalThis.__schemastery_index__++}),Object.setPrototypeOf(t,w.prototype),t.meta||={},t.toString=t.toString.bind(t),t};w.prototype=Object.create(Function.prototype),w.prototype[de]=!0,Object.defineProperty(w.prototype,"~standard",{get(){return{version:1,vendor:`schemastery`,validate:e=>{try{return{value:w.resolve(e,this,{})[0]}}catch(e){if(C.is(e))return{issues:[{message:e.message,path:e.options.path}]};throw e}}}}}),w.ValidationError=C,w.prototype.toJSON=function(){if(globalThis.__schemastery_refs__)return globalThis.__schemastery_refs__[this.uid]??=JSON.parse(JSON.stringify({...this})),this.uid;globalThis.__schemastery_refs__={[this.uid]:{...this}},globalThis.__schemastery_refs__[this.uid]=JSON.parse(JSON.stringify({...this}));let e={uid:this.uid,refs:globalThis.__schemastery_refs__};return globalThis.__schemastery_refs__=void 0,e},w.prototype.set=function(e,t){return this.dict[e]=t,this},w.prototype.push=function(e){return this.list.push(e),this};function pe(e,t){let n=typeof e==`string`?{"":e}:{...e};for(let e in t){let r=t[e];r?.$description||r?.$desc?n[e]=r.$description||r.$desc:typeof r==`string`&&(n[e]=r)}return n}function me(e){return e?.$value??e?.$inner}function he(e){return ee(e??{},e=>!e.startsWith(`$`))}w.prototype.i18n=function(e){let t=w(this),n=pe(t.meta.description,e);return Object.keys(n).length&&(t.meta.description=n),t.dict&&=b(t.dict,(t,n)=>t.i18n(b(e,e=>me(e)?.[n]??e?.[n]))),t.list&&=t.list.map((t,n)=>t.i18n(b(e,(e={})=>Array.isArray(me(e))?me(e)[n]:Array.isArray(e)?e[n]:he(e)))),t.inner&&=t.inner.i18n(b(e,e=>me(e)?me(e):he(e))),t.sKey&&=t.sKey.i18n(b(e,e=>e?.$key)),t},w.prototype.extra=function(e,t){let n=w(this);return n.meta={...n.meta,[e]:t},n};for(let e of[`required`,`disabled`,`collapse`,`hidden`,`loose`])Object.assign(w.prototype,{[e](t=!0){let n=w(this);return n.meta={...n.meta,[e]:t},n}});w.prototype.deprecated=function(){let e=w(this);return e.meta.badges||=[],e.meta.badges.push({text:`deprecated`,type:`danger`}),e},w.prototype.experimental=function(){let e=w(this);return e.meta.badges||=[],e.meta.badges.push({text:`experimental`,type:`warning`}),e},w.prototype.pattern=function(e){let t=w(this),n=x(e,[`source`,`flags`]);return t.meta={...t.meta,pattern:n},t},w.prototype.simplify=function(e){if(ie(e)&&(e=e.get()),le(e,this.meta.default,this.type===`dict`))return null;if(v(e))return e;if(this.type===`object`||this.type===`dict`){let t={};for(let n in e){let r=(this.type===`object`?this.dict[n]:this.inner)?.simplify(e[n]);(this.type===`dict`||!v(r))&&(t[n]=r)}return le(t,this.meta.default,this.type===`dict`)?null:t}if(this.type===`array`||this.type===`tuple`){let t=[];return e.forEach((e,n)=>{let r=this.type===`array`?this.inner:this.list[n],i=r?r.simplify(e):e;t.push(i)}),t}if(this.type===`intersect`){let t={};for(let n of this.list)Object.assign(t,n.simplify(e));return t}if(this.type===`union`)for(let t of this.list)try{return w.resolve(e,t,{}),t.simplify(e)}catch{}return e},w.prototype.toString=function(e){return we[this.type]?.(this,e)??`Schema<${this.type}>`},w.prototype.role=function(e,t){let n=w(this);return n.meta={...n.meta,role:e,extra:t},n};for(let e of[`default`,`link`,`comment`,`description`,`max`,`min`,`step`])Object.assign(w.prototype,{[e](t){let n=w(this);return n.meta={...n.meta,[e]:t},n}});w.prototype.volatile=function(){if(this.meta.volatile)throw TypeError(`volatile schema is already wrapped`);return this.extra(`volatile`,!0)};let ge={},_e=Symbol(`checked-volatile-schema`);function ve(e,t=[],n=!1,r=/* @__PURE__ */ new Map){let i=r.get(e)??/* @__PURE__ */ new Set;if(i.has(n))return;if(i.add(n),r.set(e,i),e.meta?.volatile&&n)throw new C(`volatile fields require a fixed object path without an enclosing volatile field`,{path:t});let a=n||!!e.meta?.volatile;if(e.dict)for(let[n,i]of Object.entries(e.dict))ve(i,[...t,n],a,r);if(e.sKey&&ve(e.sKey,[...t,`<key>`],!0,r),e.inner&&(e.type!==`lazy`||e.inner[de])&&ve(e.inner,[...t,`*`],!0,r),e.list)for(let n=0;n<e.list.length;n++)ve(e.list[n],[...t,String(n)],!0,r)}w.extend=function(e,t){ge[e]=t},w.resolve=function(e,t,n={},r=!1){if(!t)return[e];if(n[_e]||(ve(t,n.path),n={...n,[_e]:!0}),t.meta?.volatile){let i=w(t);i.meta={...t.meta,volatile:!1};let[a,o]=w.resolve(e,i,n,r);try{return[re(a),o]}catch(e){throw new C(e instanceof Error?e.message:String(e),n)}}if(n.ignore?.(e,t))return[e];if(v(e)&&t.type!==`lazy`){if(t.meta.required)throw new C(`missing required value`,n);let r=t,i=t.meta.default;for(;r?.type===`intersect`&&v(i);)r=r.list[0],i=r?.meta.default;if(v(i))return[e];e=ce(i)}let i=ge[t.type];if(!i)throw new C(`unsupported type "${t.type}"`,n);try{return i(e,t,n,r)}catch(e){if(!t.meta.loose)throw e;return[t.meta.default]}},w.from=function(e){if(v(e))return w.any();if([`string`,`number`,`boolean`].includes(typeof e))return w.const(e).required();if(e[de])return e;if(typeof e==`function`)switch(e){case String:return w.string().required();case Number:return w.number().required();case Boolean:return w.boolean().required();case Function:return w.function().required();default:return w.is(e).required()}else throw TypeError(`cannot infer schema from ${e}`)},w.lazy=function(e){let t=new w({type:`lazy`,builder:e,inner:{toJSON:()=>(t.inner[de]||(t.inner=t.builder(),t.inner.meta={...t.meta,...t.inner.meta}),t.inner.toJSON())}});return t},w.natural=function(){return w.number().step(1).min(0)},w.percent=function(){return w.number().step(.01).min(0).max(1).role(`slider`)},w.date=function(){return w.union([w.is(Date),w.transform(w.string().role(`datetime`),(e,t)=>{let n=new Date(e);if(isNaN(+n))throw new C(`invalid date "${e}"`,t);return n},!0)])},w.regExp=function(e=``){return w.union([w.is(RegExp),w.transform(w.string().role(`regexp`,{flag:e}),(t,n)=>{try{return new RegExp(t,e)}catch(e){throw new C(e.message,n)}},!0)])},w.arrayBuffer=function(e){return w.union([w.is(ArrayBuffer),w.is(SharedArrayBuffer),w.transform(w.any(),(e,t)=>{if(S.isSource(e))return S.fromSource(e);throw new C(`expected ArrayBufferSource but got ${e}`,t)},!0),...e?[w.transform(w.string(),(t,n)=>{try{return e===`base64`?S.fromBase64(t):S.fromHex(t)}catch(e){throw new C(e.message,n)}},!0)]:[]])},w.extend(`lazy`,(e,t,n,r)=>(t.inner[de]||(t.inner=t.builder(),t.inner.meta={...t.meta,...t.inner.meta},ve(t.inner,n.path,!0)),w.resolve(e,t.inner,n,r))),w.extend(`any`,e=>[e]),w.extend(`never`,(e,t,n)=>{throw new C(`expected nullable but got ${e}`,n)}),w.extend(`const`,(e,{value:t},n)=>{if(le(e,t))return[t];throw new C(`expected ${t} but got ${e}`,n)});function ye(e,t,n,r,i=!1){let{max:a=1/0,min:o=-1/0}=t;if(e>a)throw new C(`expected ${n} <= ${a} but got ${e}`,r);if(e<o&&!i)throw new C(`expected ${n} >= ${o} but got ${e}`,r)}w.extend(`string`,(e,{meta:t},n)=>{if(typeof e!=`string`)throw new C(`expected string but got ${e}`,n);if(t.pattern){let r=new RegExp(t.pattern.source,t.pattern.flags);if(!r.test(e))throw new C(`expect string to match regexp ${r}`,n)}return ye(e.length,t,`string length`,n),[e]});function be(e,t){let n=e.toString();if(n.includes(`e`))return e*10**t;let r=n.indexOf(`.`);if(r===-1)return e*10**t;let i=n.slice(r+1),a=n.slice(0,r);return i.length<=t?+(a+i.padEnd(t,`0`)):+(a+i.slice(0,t)+`.`+i.slice(t))}function xe(e,t,n){if(n=Math.abs(n),!/^\d+\.\d+$/.test(n.toString()))return(e-t)%n===0;let r=n.toString().indexOf(`.`),i=n.toString().slice(r+1).length;return Math.abs(be(e,i)-be(t,i))%be(n,i)===0}w.extend(`number`,(e,{meta:t},n)=>{if(typeof e!=`number`)throw new C(`expected number but got ${e}`,n);ye(e,t,`number`,n);let{step:r}=t;if(r&&!xe(e,t.min??0,r))throw new C(`expected number multiple of ${r} but got ${e}`,n);return[e]}),w.extend(`boolean`,(e,t,n)=>{if(typeof e==`boolean`)return[e];throw new C(`expected boolean but got ${e}`,n)}),w.extend(`bitset`,(e,{bits:t,meta:n},r)=>{let i=0,a=[];if(typeof e==`number`){i=e;for(let n in t)e&t[n]&&a.push(n)}else if(Array.isArray(e)){a=e;for(let e of a){if(typeof e!=`string`)throw new C(`expected string but got ${e}`,r);e in t&&(i|=t[e])}}else throw new C(`expected number or array but got ${e}`,r);return i===n.default?[i]:[i,a]}),w.extend(`function`,(e,t,n)=>{if(typeof e==`function`)return[e];throw new C(`expected function but got ${e}`,n)}),w.extend(`is`,(e,{constructor:t},n)=>{if(typeof t==`function`){if(e instanceof t)return[e];throw new C(`expected ${t.name} but got ${e}`,n)}{if(v(e))throw new C(`expected ${t} but got ${e}`,n);let r=Object.getPrototypeOf(e);for(;r;){if(r.constructor?.name===t)return[e];r=Object.getPrototypeOf(r)}throw new C(`expected ${t} but got ${e}`,n)}});function Se(e,t,n,r){try{let[i,a]=w.resolve(e[t],n,{...r,path:[...r.path||[],t]});return a!==void 0&&(e[t]=a),i}catch(i){if(!r?.autofix)throw i;return delete e[t],n.meta.volatile?re(n.meta.default):n.meta.default}}w.extend(`array`,(e,{inner:t,meta:n},r)=>{if(!Array.isArray(e))throw new C(`expected array but got ${e}`,r);return ye(e.length,n,`array length`,r,!v(t.meta.default)),[e.map((n,i)=>Se(e,i,t,r))]}),w.extend(`dict`,(e,{inner:t,sKey:n},r,i)=>{if(!y(e))throw new C(`expected object but got ${e}`,r);let a={};for(let o in e){let s;try{s=w.resolve(o,n,r)[0]}catch(e){if(i)continue;throw e}a[s]=Se(e,o,t,r),e[s]=e[o],o!==s&&delete e[o]}return[a]}),w.extend(`tuple`,(e,{list:t},n,r)=>{if(!Array.isArray(e))throw new C(`expected array but got ${e}`,n);let i=t.map((t,r)=>Se(e,r,t,n));return r||i.push(...e.slice(t.length)),[i]});function Ce(e,t){for(let n in t)n in e||(e[n]=t[n])}w.extend(`object`,(e,{dict:t},n,r)=>{if(!y(e))throw new C(`expected object but got ${e}`,n);let i={};for(let r in t){let a=Se(e,r,t[r],n);(!v(a)||r in e)&&(i[r]=a)}return r||Ce(i,e),[i]}),w.extend(`union`,(e,{list:t,toString:n},r,i)=>{let a=[];for(let n of t)try{return w.resolve(e,n,r,i)}catch(e){a.push(e)}throw new C(`expected ${n()} but got ${JSON.stringify(e)}`,r)}),w.extend(`intersect`,(e,{list:t,toString:n},r,i)=>{if(!t.length)return[e];let a;for(let i of t){let t=w.resolve(e,i,r,!0)[0];if(!v(t)){if(v(a))a=t;else if(typeof a!=typeof t)throw new C(`expected ${n()} but got ${JSON.stringify(e)}`,r);else if(typeof t==`object`)Ce(a??={},t);else if(a!==t)throw new C(`expected ${n()} but got ${JSON.stringify(e)}`,r)}}return!i&&y(e)&&Ce(a,e),[a]}),w.extend(`transform`,(e,{inner:t,callback:n,preserve:r},i)=>{let[a,o=e]=w.resolve(e,t,i,!0);return r?[n(a)]:[n(a),n(o)]});let we={};function Te(e,t,n){we[e]=n,Object.assign(w,{[e](...n){let r=new w({type:e});return t.forEach((e,t)=>{switch(e){case`sKey`:r.sKey=n[t]??w.string();break;case`inner`:r.inner=w.from(n[t]);break;case`list`:r.list=n[t].map(w.from);break;case`dict`:r.dict=b(n[t],w.from);break;case`bits`:r.bits={};for(let e in n[t])typeof n[t][e]==`number`&&(r.bits[e]=n[t][e]);break;case`callback`:{let e=r.callback=n[t];e.toJSON||=()=>e.toString();break}case`constructor`:{let e=r.constructor=n[t];typeof e==`function`&&(e.toJSON||=()=>e.name);break}default:r[e]=n[t]}}),e===`object`||e===`dict`?r.meta.default={}:e===`array`||e===`tuple`?r.meta.default=[]:e===`bitset`&&(r.meta.default=0),r}})}Te(`is`,[`constructor`],({constructor:e})=>typeof e==`function`?e.name:e),Te(`any`,[],()=>`any`),Te(`never`,[],()=>`never`),Te(`const`,[`value`],({value:e})=>typeof e==`string`?JSON.stringify(e):e),Te(`string`,[],()=>`string`),Te(`number`,[],()=>`number`),Te(`boolean`,[],()=>`boolean`),Te(`bitset`,[`bits`],()=>`bitset`),Te(`function`,[],()=>`function`),Te(`array`,[`inner`],({inner:e})=>`${e.toString(!0)}[]`),Te(`dict`,[`inner`,`sKey`],({inner:e,sKey:t})=>`{ [key: ${t.toString()}]: ${e.toString()} }`),Te(`tuple`,[`list`],({list:e})=>`[${e.map(e=>e.toString()).join(`, `)}]`),Te(`object`,[`dict`],({dict:e})=>Object.keys(e).length===0?`{}`:`{ ${Object.entries(e).map(([e,t])=>`${e}${t.meta.required?``:`?`}: ${t.toString()}`).join(`, `)} }`),Te(`union`,[`list`],({list:e},t)=>{let n=e.map(({toString:e})=>e()).join(` | `);return t?`(${n})`:n}),Te(`intersect`,[`list`],({list:e})=>`${e.map(e=>e.toString(!0)).join(` & `)}`),Te(`transform`,[`inner`,`callback`,`preserve`],({inner:e},t)=>e.toString(t));let Ee={'"':`"`,"\\":`\\`,"/":`/`,b:`\b`,f:`\f`,n:`
|
|
1
|
+
window.__ModuleLoader__.load({id:`@deepseek-ai/dsh-client-ui-conversation`,factory:e=>{var t={exports:{}},n=t.exports;Object.defineProperty(n,Symbol.toStringTag,{value:`Module`});var r=Object.create,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,s=Object.getPrototypeOf,c=Object.prototype.hasOwnProperty,l=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var s=o(t),l=0,u=s.length,d;l<u;l++)d=s[l],!c.call(e,d)&&d!==n&&i(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(r=a(t,d))||r.enumerable});return e},u=(e,t,n)=>(n=e==null?{}:r(s(e)),l(t||!e||!e.__esModule||!c.call(e,`default`)?i(n,`default`,{value:e,enumerable:!0}):n,e));let d=e("@deepseek-ai/dsh-client-ui-primitives"),f=e("@deepseek-ai/dsh-client-store"),p=e("@deepseek-ai/dsh-client-ui-slots"),m=e("@deepseek-ai/cordis"),h=e("react/jsx-runtime"),g=e("react");g=u(g,1);let _=e("react-dom");function v(e){return e==null}function y(e){return e&&typeof e==`object`&&!Array.isArray(e)}function ee(e,t){return Object.fromEntries(Object.entries(e).filter(([e,n])=>t(e,n)))}function b(e,t){return Object.fromEntries(Object.entries(e).map(([e,n])=>[e,t(n,e)]))}function te(e,t,n){if(!t)return{...e};let r={};for(let i of t)(n||e[i]!==void 0)&&(r[i]=e[i]);return r}let x=Symbol.for(`cosmokit.volatile.write`);function ne(e,t=/* @__PURE__ */ new Set){if(typeof e==`function`)throw TypeError(`volatile config cannot contain functions`);if(typeof e!=`object`||!e)return e;if(t.has(e))throw TypeError(`volatile config cannot contain cycles`);t.add(e);try{if(Array.isArray(e))return Object.freeze(e.map(e=>ne(e,t)));if(Object.getPrototypeOf(e)!==Object.prototype&&Object.getPrototypeOf(e)!==null)throw TypeError(`volatile config objects must be plain objects or arrays`);return Object.freeze(Object.fromEntries(Object.entries(e).map(([e,n])=>[e,ne(n,t)])))}finally{t.delete(e)}}function re(e){let t=ne(e);return Object.freeze({get:()=>t,[x]:e=>{t=e}})}function ie(e){return typeof e==`object`&&!!e&&x in e}function ae(e,t){return arguments.length===1?t=>ae(e,t):e in globalThis&&t instanceof globalThis[e]||Object.prototype.toString.call(t).slice(8,-1)===e}function oe(e){return ae(`ArrayBuffer`,e)||ae(`SharedArrayBuffer`,e)}function se(e){return oe(e)||ArrayBuffer.isView(e)}let ce;(function(e){e.is=oe,e.isSource=se;function t(e){return ArrayBuffer.isView(e)?e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength):e}e.fromSource=t;function n(e){if(e=t(e),typeof Buffer<`u`)return Buffer.from(e).toString(`base64`);let n=``,r=new Uint8Array(e);for(let e=0;e<r.byteLength;e++)n+=String.fromCharCode(r[e]);return btoa(n)}e.toBase64=n;function r(e){return typeof Buffer<`u`?t(Buffer.from(e,`base64`)):Uint8Array.from(atob(e),e=>e.charCodeAt(0))}e.fromBase64=r;function i(e){return e=t(e),typeof Buffer<`u`?Buffer.from(e).toString(`hex`):Array.from(new Uint8Array(e),e=>e.toString(16).padStart(2,`0`)).join(``)}e.toHex=i;function a(e){if(typeof Buffer<`u`)return t(Buffer.from(e,`hex`));let n=e.length%2==0?e:e.slice(0,e.length-1),r=[];for(let e=0;e<n.length;e+=2)r.push(parseInt(`${n[e]}${n[e+1]}`,16));return Uint8Array.from(r).buffer}e.fromHex=a})(ce||={}),ce.fromBase64,ce.toBase64,ce.fromHex,ce.toHex;function S(e,t=/* @__PURE__ */ new Map){if(!e||typeof e!=`object`)return e;if(ae(`Date`,e))return new Date(e.valueOf());if(ae(`RegExp`,e))return new RegExp(e.source,e.flags);if(oe(e))return e.slice(0);if(ArrayBuffer.isView(e))return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);let n=t.get(e);if(n)return n;if(Array.isArray(e)){let n=[];return t.set(e,n),e.forEach((e,r)=>{n[r]=Reflect.apply(S,null,[e,t])}),n}let r=Object.create(Object.getPrototypeOf(e));t.set(e,r);for(let n of Reflect.ownKeys(e)){let i={...Reflect.getOwnPropertyDescriptor(e,n)};`value`in i&&(i.value=Reflect.apply(S,null,[i.value,t])),Reflect.defineProperty(r,n,i)}return r}function le(e,t,n){let r=/* @__PURE__ */ new Set;function i(e,t){if(e===t)return!0;if(ie(e)||ie(t))return ie(e)&&ie(t);if(!n&&v(e)&&v(t))return!0;if(typeof e!=typeof t||typeof e!=`object`||!e||!t||r.has(e))return!1;function a(n,r){return n(e)?n(t)?r(e,t):!1:!n(t)&&void 0}r.add(e);try{return a(Array.isArray,(e,t)=>{if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!i(e[n],t[n]))return!1;return!0})??a(ae(`Date`),(e,t)=>e.valueOf()===t.valueOf())??a(ae(`URL`),(e,t)=>e.href===t.href)??a(ae(`RegExp`),(e,t)=>e.source===t.source&&e.flags===t.flags)??a(oe,(e,t)=>{if(e.byteLength!==t.byteLength)return!1;let n=new Uint8Array(e),r=new Uint8Array(t);for(let e=0;e<n.length;e++)if(n[e]!==r[e])return!1;return!0})??((!n||[e,t].every(e=>Object.getPrototypeOf(e)===Object.prototype||Object.getPrototypeOf(e)===null))&&Object.keys({...e,...t}).every(n=>i(e[n],t[n])))}finally{r.delete(e)}}return i(e,t)}let ue;(function(e){e.millisecond=1;let t=e.second=1e3,n=e.minute=t*60,r=e.hour=n*60,i=e.day=r*24,a=e.week=i*7,o=(/* @__PURE__ */ new Date()).getTimezoneOffset();function s(e){o=e}e.setTimezoneOffset=s;function c(){return o}e.getTimezoneOffset=c;function l(e=/* @__PURE__ */ new Date,t){return typeof e==`number`&&(e=new Date(e)),t===void 0&&(t=o),Math.floor((e.valueOf()/n-t)/1440)}e.getDateNumber=l;function u(e,t){let r=new Date(e*i);return t===void 0&&(t=o),new Date(+r+t*n)}e.fromDateNumber=u;let d=RegExp(`^${[`w(?:eek(?:s)?)?`,`d(?:ay(?:s)?)?`,`h(?:our(?:s)?)?`,`m(?:in(?:ute)?(?:s)?)?`,`s(?:ec(?:ond)?(?:s)?)?`].map(e=>`(\\d+(?:\\.\\d+)?${e})?`).join(``)}$`);function f(e){let o=d.exec(e);return o?(parseFloat(o[1])*a||0)+(parseFloat(o[2])*i||0)+(parseFloat(o[3])*r||0)+(parseFloat(o[4])*n||0)+(parseFloat(o[5])*t||0):0}e.parseTime=f;function p(e){let t=f(e);return t?e=Date.now()+t:/^\d{1,2}(:\d{1,2}){1,2}$/.test(e)?e=`${(/* @__PURE__ */ new Date()).toLocaleDateString()}-${e}`:/^\d{1,2}-\d{1,2}-\d{1,2}(:\d{1,2}){1,2}$/.test(e)&&(e=`${(/* @__PURE__ */ new Date()).getFullYear()}-${e}`),e?new Date(e):/* @__PURE__ */ new Date}e.parseDate=p;function m(e){let a=Math.abs(e);return a>=i-r/2?Math.round(e/i)+`d`:a>=r-n/2?Math.round(e/r)+`h`:a>=n-t/2?Math.round(e/n)+`m`:a>=t?Math.round(e/t)+`s`:e+`ms`}e.format=m;function h(e,t=2){return e.toString().padStart(t,`0`)}e.toDigits=h;function g(e,t=/* @__PURE__ */ new Date){return e.replace(`yyyy`,t.getFullYear().toString()).replace(`yy`,t.getFullYear().toString().slice(2)).replace(`MM`,h(t.getMonth()+1)).replace(`dd`,h(t.getDate())).replace(`hh`,h(t.getHours())).replace(`mm`,h(t.getMinutes())).replace(`ss`,h(t.getSeconds())).replace(`SSS`,h(t.getMilliseconds(),3))}e.template=g})(ue||={});let de=Symbol.for(`schemastery`),fe=Symbol.for(`ValidationError`);globalThis.__schemastery_index__??=0,globalThis.__schemastery_refs__=void 0;var C=class extends TypeError{options;name=`ValidationError`;constructor(e,t){let n=`$`;for(let e of t.path||[])typeof e==`string`?n+=`.`+e:typeof e==`number`?n+=`[`+e+`]`:typeof e==`symbol`&&(n+=`[Symbol(${e.toString()})]`);n.startsWith(`.`)&&(n=n.slice(1)),super((n===`$`?``:`${n} `)+e),this.options=t}static is(e){return!!e?.[fe]}};Object.defineProperty(C.prototype,fe,{value:!0});let w=function(e){let t=function(e,n={}){return w.resolve(e,t,n)[0]};if(e.refs){let t=b(e.refs,e=>new w(e)),n=e=>t[e];for(let e in t){let r=t[e];r.sKey=n(r.sKey),r.inner=n(r.inner),r.list=r.list&&r.list.map(n),r.dict=r.dict&&b(r.dict,n)}return t[e.uid]}if(Object.assign(t,e),typeof t.callback==`string`)try{t.callback=Function(`return `+t.callback)()}catch{}return Object.defineProperty(t,"uid",{value:globalThis.__schemastery_index__++}),Object.setPrototypeOf(t,w.prototype),t.meta||={},t.toString=t.toString.bind(t),t};w.prototype=Object.create(Function.prototype),w.prototype[de]=!0,Object.defineProperty(w.prototype,"~standard",{get(){return{version:1,vendor:`schemastery`,validate:e=>{try{return{value:w.resolve(e,this,{})[0]}}catch(e){if(C.is(e))return{issues:[{message:e.message,path:e.options.path}]};throw e}}}}}),w.ValidationError=C,w.prototype.toJSON=function(){if(globalThis.__schemastery_refs__)return globalThis.__schemastery_refs__[this.uid]??=JSON.parse(JSON.stringify({...this})),this.uid;globalThis.__schemastery_refs__={[this.uid]:{...this}},globalThis.__schemastery_refs__[this.uid]=JSON.parse(JSON.stringify({...this}));let e={uid:this.uid,refs:globalThis.__schemastery_refs__};return globalThis.__schemastery_refs__=void 0,e},w.prototype.set=function(e,t){return this.dict[e]=t,this},w.prototype.push=function(e){return this.list.push(e),this};function pe(e,t){let n=typeof e==`string`?{"":e}:{...e};for(let e in t){let r=t[e];r?.$description||r?.$desc?n[e]=r.$description||r.$desc:typeof r==`string`&&(n[e]=r)}return n}function me(e){return e?.$value??e?.$inner}function he(e){return ee(e??{},e=>!e.startsWith(`$`))}w.prototype.i18n=function(e){let t=w(this),n=pe(t.meta.description,e);return Object.keys(n).length&&(t.meta.description=n),t.dict&&=b(t.dict,(t,n)=>t.i18n(b(e,e=>me(e)?.[n]??e?.[n]))),t.list&&=t.list.map((t,n)=>t.i18n(b(e,(e={})=>Array.isArray(me(e))?me(e)[n]:Array.isArray(e)?e[n]:he(e)))),t.inner&&=t.inner.i18n(b(e,e=>me(e)?me(e):he(e))),t.sKey&&=t.sKey.i18n(b(e,e=>e?.$key)),t},w.prototype.extra=function(e,t){let n=w(this);return n.meta={...n.meta,[e]:t},n};for(let e of[`required`,`disabled`,`collapse`,`hidden`,`loose`])Object.assign(w.prototype,{[e](t=!0){let n=w(this);return n.meta={...n.meta,[e]:t},n}});w.prototype.deprecated=function(){let e=w(this);return e.meta.badges||=[],e.meta.badges.push({text:`deprecated`,type:`danger`}),e},w.prototype.experimental=function(){let e=w(this);return e.meta.badges||=[],e.meta.badges.push({text:`experimental`,type:`warning`}),e},w.prototype.pattern=function(e){let t=w(this),n=te(e,[`source`,`flags`]);return t.meta={...t.meta,pattern:n},t},w.prototype.simplify=function(e){if(ie(e)&&(e=e.get()),le(e,this.meta.default,this.type===`dict`))return null;if(v(e))return e;if(this.type===`object`||this.type===`dict`){let t={};for(let n in e){let r=(this.type===`object`?this.dict[n]:this.inner)?.simplify(e[n]);(this.type===`dict`||!v(r))&&(t[n]=r)}return le(t,this.meta.default,this.type===`dict`)?null:t}if(this.type===`array`||this.type===`tuple`){let t=[];return e.forEach((e,n)=>{let r=this.type===`array`?this.inner:this.list[n],i=r?r.simplify(e):e;t.push(i)}),t}if(this.type===`intersect`){let t={};for(let n of this.list)Object.assign(t,n.simplify(e));return t}if(this.type===`union`)for(let t of this.list)try{return w.resolve(e,t,{}),t.simplify(e)}catch{}return e},w.prototype.toString=function(e){return we[this.type]?.(this,e)??`Schema<${this.type}>`},w.prototype.role=function(e,t){let n=w(this);return n.meta={...n.meta,role:e,extra:t},n};for(let e of[`default`,`link`,`comment`,`description`,`max`,`min`,`step`])Object.assign(w.prototype,{[e](t){let n=w(this);return n.meta={...n.meta,[e]:t},n}});w.prototype.volatile=function(){if(this.meta.volatile)throw TypeError(`volatile schema is already wrapped`);return this.extra(`volatile`,!0)};let ge={},_e=Symbol(`checked-volatile-schema`);function ve(e,t=[],n=!1,r=/* @__PURE__ */ new Map){let i=r.get(e)??/* @__PURE__ */ new Set;if(i.has(n))return;if(i.add(n),r.set(e,i),e.meta?.volatile&&n)throw new C(`volatile fields require a fixed object path without an enclosing volatile field`,{path:t});let a=n||!!e.meta?.volatile;if(e.dict)for(let[n,i]of Object.entries(e.dict))ve(i,[...t,n],a,r);if(e.sKey&&ve(e.sKey,[...t,`<key>`],!0,r),e.inner&&(e.type!==`lazy`||e.inner[de])&&ve(e.inner,[...t,`*`],!0,r),e.list)for(let n=0;n<e.list.length;n++)ve(e.list[n],[...t,String(n)],!0,r)}w.extend=function(e,t){ge[e]=t},w.resolve=function(e,t,n={},r=!1){if(!t)return[e];if(n[_e]||(ve(t,n.path),n={...n,[_e]:!0}),t.meta?.volatile){let i=w(t);i.meta={...t.meta,volatile:!1};let[a,o]=w.resolve(e,i,n,r);try{return[re(a),o]}catch(e){throw new C(e instanceof Error?e.message:String(e),n)}}if(n.ignore?.(e,t))return[e];if(v(e)&&t.type!==`lazy`){if(t.meta.required)throw new C(`missing required value`,n);let r=t,i=t.meta.default;for(;r?.type===`intersect`&&v(i);)r=r.list[0],i=r?.meta.default;if(v(i))return[e];e=S(i)}let i=ge[t.type];if(!i)throw new C(`unsupported type "${t.type}"`,n);try{return i(e,t,n,r)}catch(e){if(!t.meta.loose)throw e;return[t.meta.default]}},w.from=function(e){if(v(e))return w.any();if([`string`,`number`,`boolean`].includes(typeof e))return w.const(e).required();if(e[de])return e;if(typeof e==`function`)switch(e){case String:return w.string().required();case Number:return w.number().required();case Boolean:return w.boolean().required();case Function:return w.function().required();default:return w.is(e).required()}else throw TypeError(`cannot infer schema from ${e}`)},w.lazy=function(e){let t=new w({type:`lazy`,builder:e,inner:{toJSON:()=>(t.inner[de]||(t.inner=t.builder(),t.inner.meta={...t.meta,...t.inner.meta}),t.inner.toJSON())}});return t},w.natural=function(){return w.number().step(1).min(0)},w.percent=function(){return w.number().step(.01).min(0).max(1).role(`slider`)},w.date=function(){return w.union([w.is(Date),w.transform(w.string().role(`datetime`),(e,t)=>{let n=new Date(e);if(isNaN(+n))throw new C(`invalid date "${e}"`,t);return n},!0)])},w.regExp=function(e=``){return w.union([w.is(RegExp),w.transform(w.string().role(`regexp`,{flag:e}),(t,n)=>{try{return new RegExp(t,e)}catch(e){throw new C(e.message,n)}},!0)])},w.arrayBuffer=function(e){return w.union([w.is(ArrayBuffer),w.is(SharedArrayBuffer),w.transform(w.any(),(e,t)=>{if(ce.isSource(e))return ce.fromSource(e);throw new C(`expected ArrayBufferSource but got ${e}`,t)},!0),...e?[w.transform(w.string(),(t,n)=>{try{return e===`base64`?ce.fromBase64(t):ce.fromHex(t)}catch(e){throw new C(e.message,n)}},!0)]:[]])},w.extend(`lazy`,(e,t,n,r)=>(t.inner[de]||(t.inner=t.builder(),t.inner.meta={...t.meta,...t.inner.meta},ve(t.inner,n.path,!0)),w.resolve(e,t.inner,n,r))),w.extend(`any`,e=>[e]),w.extend(`never`,(e,t,n)=>{throw new C(`expected nullable but got ${e}`,n)}),w.extend(`const`,(e,{value:t},n)=>{if(le(e,t))return[t];throw new C(`expected ${t} but got ${e}`,n)});function ye(e,t,n,r,i=!1){let{max:a=1/0,min:o=-1/0}=t;if(e>a)throw new C(`expected ${n} <= ${a} but got ${e}`,r);if(e<o&&!i)throw new C(`expected ${n} >= ${o} but got ${e}`,r)}w.extend(`string`,(e,{meta:t},n)=>{if(typeof e!=`string`)throw new C(`expected string but got ${e}`,n);if(t.pattern){let r=new RegExp(t.pattern.source,t.pattern.flags);if(!r.test(e))throw new C(`expect string to match regexp ${r}`,n)}return ye(e.length,t,`string length`,n),[e]});function be(e,t){let n=e.toString();if(n.includes(`e`))return e*10**t;let r=n.indexOf(`.`);if(r===-1)return e*10**t;let i=n.slice(r+1),a=n.slice(0,r);return i.length<=t?+(a+i.padEnd(t,`0`)):+(a+i.slice(0,t)+`.`+i.slice(t))}function xe(e,t,n){if(n=Math.abs(n),!/^\d+\.\d+$/.test(n.toString()))return(e-t)%n===0;let r=n.toString().indexOf(`.`),i=n.toString().slice(r+1).length;return Math.abs(be(e,i)-be(t,i))%be(n,i)===0}w.extend(`number`,(e,{meta:t},n)=>{if(typeof e!=`number`)throw new C(`expected number but got ${e}`,n);ye(e,t,`number`,n);let{step:r}=t;if(r&&!xe(e,t.min??0,r))throw new C(`expected number multiple of ${r} but got ${e}`,n);return[e]}),w.extend(`boolean`,(e,t,n)=>{if(typeof e==`boolean`)return[e];throw new C(`expected boolean but got ${e}`,n)}),w.extend(`bitset`,(e,{bits:t,meta:n},r)=>{let i=0,a=[];if(typeof e==`number`){i=e;for(let n in t)e&t[n]&&a.push(n)}else if(Array.isArray(e)){a=e;for(let e of a){if(typeof e!=`string`)throw new C(`expected string but got ${e}`,r);e in t&&(i|=t[e])}}else throw new C(`expected number or array but got ${e}`,r);return i===n.default?[i]:[i,a]}),w.extend(`function`,(e,t,n)=>{if(typeof e==`function`)return[e];throw new C(`expected function but got ${e}`,n)}),w.extend(`is`,(e,{constructor:t},n)=>{if(typeof t==`function`){if(e instanceof t)return[e];throw new C(`expected ${t.name} but got ${e}`,n)}{if(v(e))throw new C(`expected ${t} but got ${e}`,n);let r=Object.getPrototypeOf(e);for(;r;){if(r.constructor?.name===t)return[e];r=Object.getPrototypeOf(r)}throw new C(`expected ${t} but got ${e}`,n)}});function Se(e,t,n,r){try{let[i,a]=w.resolve(e[t],n,{...r,path:[...r.path||[],t]});return a!==void 0&&(e[t]=a),i}catch(i){if(!r?.autofix)throw i;return delete e[t],n.meta.volatile?re(n.meta.default):n.meta.default}}w.extend(`array`,(e,{inner:t,meta:n},r)=>{if(!Array.isArray(e))throw new C(`expected array but got ${e}`,r);return ye(e.length,n,`array length`,r,!v(t.meta.default)),[e.map((n,i)=>Se(e,i,t,r))]}),w.extend(`dict`,(e,{inner:t,sKey:n},r,i)=>{if(!y(e))throw new C(`expected object but got ${e}`,r);let a={};for(let o in e){let s;try{s=w.resolve(o,n,r)[0]}catch(e){if(i)continue;throw e}a[s]=Se(e,o,t,r),e[s]=e[o],o!==s&&delete e[o]}return[a]}),w.extend(`tuple`,(e,{list:t},n,r)=>{if(!Array.isArray(e))throw new C(`expected array but got ${e}`,n);let i=t.map((t,r)=>Se(e,r,t,n));return r||i.push(...e.slice(t.length)),[i]});function Ce(e,t){for(let n in t)n in e||(e[n]=t[n])}w.extend(`object`,(e,{dict:t},n,r)=>{if(!y(e))throw new C(`expected object but got ${e}`,n);let i={};for(let r in t){let a=Se(e,r,t[r],n);(!v(a)||r in e)&&(i[r]=a)}return r||Ce(i,e),[i]}),w.extend(`union`,(e,{list:t,toString:n},r,i)=>{let a=[];for(let n of t)try{return w.resolve(e,n,r,i)}catch(e){a.push(e)}throw new C(`expected ${n()} but got ${JSON.stringify(e)}`,r)}),w.extend(`intersect`,(e,{list:t,toString:n},r,i)=>{if(!t.length)return[e];let a;for(let i of t){let t=w.resolve(e,i,r,!0)[0];if(!v(t)){if(v(a))a=t;else if(typeof a!=typeof t)throw new C(`expected ${n()} but got ${JSON.stringify(e)}`,r);else if(typeof t==`object`)Ce(a??={},t);else if(a!==t)throw new C(`expected ${n()} but got ${JSON.stringify(e)}`,r)}}return!i&&y(e)&&Ce(a,e),[a]}),w.extend(`transform`,(e,{inner:t,callback:n,preserve:r},i)=>{let[a,o=e]=w.resolve(e,t,i,!0);return r?[n(a)]:[n(a),n(o)]});let we={};function Te(e,t,n){we[e]=n,Object.assign(w,{[e](...n){let r=new w({type:e});return t.forEach((e,t)=>{switch(e){case`sKey`:r.sKey=n[t]??w.string();break;case`inner`:r.inner=w.from(n[t]);break;case`list`:r.list=n[t].map(w.from);break;case`dict`:r.dict=b(n[t],w.from);break;case`bits`:r.bits={};for(let e in n[t])typeof n[t][e]==`number`&&(r.bits[e]=n[t][e]);break;case`callback`:{let e=r.callback=n[t];e.toJSON||=()=>e.toString();break}case`constructor`:{let e=r.constructor=n[t];typeof e==`function`&&(e.toJSON||=()=>e.name);break}default:r[e]=n[t]}}),e===`object`||e===`dict`?r.meta.default={}:e===`array`||e===`tuple`?r.meta.default=[]:e===`bitset`&&(r.meta.default=0),r}})}Te(`is`,[`constructor`],({constructor:e})=>typeof e==`function`?e.name:e),Te(`any`,[],()=>`any`),Te(`never`,[],()=>`never`),Te(`const`,[`value`],({value:e})=>typeof e==`string`?JSON.stringify(e):e),Te(`string`,[],()=>`string`),Te(`number`,[],()=>`number`),Te(`boolean`,[],()=>`boolean`),Te(`bitset`,[`bits`],()=>`bitset`),Te(`function`,[],()=>`function`),Te(`array`,[`inner`],({inner:e})=>`${e.toString(!0)}[]`),Te(`dict`,[`inner`,`sKey`],({inner:e,sKey:t})=>`{ [key: ${t.toString()}]: ${e.toString()} }`),Te(`tuple`,[`list`],({list:e})=>`[${e.map(e=>e.toString()).join(`, `)}]`),Te(`object`,[`dict`],({dict:e})=>Object.keys(e).length===0?`{}`:`{ ${Object.entries(e).map(([e,t])=>`${e}${t.meta.required?``:`?`}: ${t.toString()}`).join(`, `)} }`),Te(`union`,[`list`],({list:e},t)=>{let n=e.map(({toString:e})=>e()).join(` | `);return t?`(${n})`:n}),Te(`intersect`,[`list`],({list:e})=>`${e.map(e=>e.toString(!0)).join(` & `)}`),Te(`transform`,[`inner`,`callback`,`preserve`],({inner:e},t)=>e.toString(t));let Ee={'"':`"`,"\\":`\\`,"/":`/`,b:`\b`,f:`\f`,n:`
|
|
2
2
|
`,r:`\r`,t:` `},De=/[\\\u0000-\u001f]/u;function Oe(e){return e===` `||e===`
|
|
3
3
|
`||e===`\r`||e===` `}function ke(e){return e>=`0`&&e<=`9`||e>=`a`&&e<=`f`||e>=`A`&&e<=`F`}(class e{static EMPTY=e.fromObject({});static fromText(t){let n=new e;return n.append(t),n.sealed=!0,n}static fromObject(t){let n=new e;return n.object=typeof t==`object`&&t&&!Array.isArray(t)?t:{},n.sealed=!0,n}chunks=[];object;sealed=!1;#e=[];#t=0;#n=0;#r=`root`;#i=!1;#a=0;#o=!1;#s=``;#c=null;#l=[];#u=!1;#d;#f=!1;#p=/* @__PURE__ */ new Map;#m=[];#h=/* @__PURE__ */ new Map;get isSealed(){return this.sealed}get invalid(){return this.scan(),this.#r===`invalid`||this.#f}append(e){if(this.sealed)throw Error(`PartialArguments: cannot append to a sealed view`);e.length!==0&&(this.chunks.push(e),this.#t+=e.length,this.#e.push(this.#t))}settle(t){if(this.object!==void 0||t.length!==this.#t)return e.fromText(t);let n=0;for(let r of this.chunks){if(!t.startsWith(r,n))return e.fromText(t);n+=r.length}return this.chunks=t.length===0?[]:[t],this.#e=t.length===0?[]:[t.length],this.sealed=!0,this}refresh(){if(this.#h.size===0)return!1;this.scan();let e=!1,t=!1;for(let n of this.#h.values())n.completion?t=!0:e=this.refreshRead(n)||e;if(t)for(let t of this.#h.values())t.completion&&(e=this.refreshRead(t)||e);return this.sealed&&this.#h.clear(),e}refreshRead(e){let t=e.answer();return!Object.is(t,e.last)&&(e.last=t,!0)}closed(){return this.remember(`closed`,``,()=>this.closedNow())}keys(){return this.remember(`keys`,``,()=>this.keysNow(),e=>e.length)}has(e){return this.remember(`has`,e,()=>this.hasNow(e))}complete(e){return this.remember(`complete`,e,()=>this.completeNow(e))}stringLength(e,t){let n=Math.max(1,Math.floor(t?.step??1)),r=t?.offset??0;return this.remember(`length:${n}:${r}`,e,()=>this.lengthNow(e),e=>e===void 0?void 0:Math.ceil((e+r)/n))}stringExceeds(e,t){let n=Math.max(0,Math.floor(t));return this.remember(`exceeds:${n}`,e,()=>(this.lengthNow(e,n+1)??0)>n)}text(e){return this.remember(`text`,e,()=>this.textNow(e))}textPrefix(e,t){let n=Math.max(1,Math.floor(t));return this.remember(`prefix:${n}`,e,()=>this.textPrefixNow(e,n))}value(e){return this.remember(`value`,e,()=>this.valueNow(e))}remember(e,t,n,r){this.scan();let i=n();if(!this.sealed){let a=`${e}/${t}`;this.#h.has(a)||this.#h.set(a,{completion:e===`complete`,answer:r===void 0?n:()=>r(n()),last:r===void 0?i:r(i)})}return i}closedNow(){return this.sealed||this.#r===`closed`||this.#r===`invalid`}keysNow(){return this.object===void 0?this.#m:Object.keys(this.object)}hasNow(e){return this.object===void 0?this.#p.has(e):Object.hasOwn(this.object,e)}completeNow(e){if(this.object!==void 0)return Object.hasOwn(this.object,e);let t=this.#p.get(e);return t!==void 0&&t.end>=0&&(t.kind===`string`?t.invalidAt===void 0:!t.invalid)}lengthNow(e,t=1/0){if(this.object!==void 0){let t=Object.hasOwn(this.object,e)?this.object[e]:void 0;return typeof t==`string`?t.length:void 0}let n=this.#p.get(e);if(n?.kind!==`string`)return;if(n.text!==void 0&&n.text.at===n.end)return n.text.length;let r=n.length??={at:n.start,length:0,text:``};return this.readString(n,r,t,!1),r.length}textNow(e){if(this.object!==void 0){let t=Object.hasOwn(this.object,e)?this.object[e]:void 0;return typeof t==`string`?t:void 0}let t=this.#p.get(e);if(t?.kind!==`string`)return;if(t.text===void 0&&t.end>=0&&t.needsDecoding&&t.invalidAt===void 0){let e;try{e=JSON.parse(`"${this.slice(t.start,t.end)}"`)}catch{}e!==void 0&&(t.text={at:t.end,length:e.length,text:e})}let n=t.text??={at:t.start,length:0,text:``};return this.readString(t,n,1/0,!0),n.text}textPrefixNow(e,t){if(this.object!==void 0){let n=Object.hasOwn(this.object,e)?this.object[e]:void 0;return typeof n==`string`?n.slice(0,t):void 0}let n=this.#p.get(e);if(n?.kind!==`string`)return;let r=n.prefixes??=/* @__PURE__ */ new Map,i=r.get(t);return i===void 0&&(i={at:n.start,length:0,text:``},r.set(t,i)),this.readString(n,i,t,!0),i.text}valueNow(e){if(this.object!==void 0){if(!Object.hasOwn(this.object,e))return;let t=this.object[e];return typeof t==`string`?void 0:t}let t=this.#p.get(e);if(!(t?.kind!==`value`||t.end<0||t.invalid)){if(t.parsed===void 0)try{t.parsed=JSON.parse(this.slice(t.start,t.end))}catch{t.invalid=!0,this.#f=!0}return t.parsed}}chunkAt(e){let t=0,n=this.#e.length;for(;t<n;){let r=t+n>>>1;this.#e[r]<=e?t=r+1:n=r}return t}slice(e,t){if(e>=t)return``;let n=this.chunkAt(e),r=this.chunkAt(t-1),i=n===0?0:this.#e[n-1];if(n===r)return this.chunks[n].slice(e-i,t-i);let a=[this.chunks[n].slice(e-i)];for(let e=n+1;e<r;e++)a.push(this.chunks[e]);return a.push(this.chunks[r].slice(0,t-this.#e[r-1])),a.join(``)}readString(e,t,n,r){let i=Math.min(e.end<0?this.#n:e.end,e.invalidAt??1/0,this.#d??1/0);if(!e.needsDecoding){let e=Math.min(i-t.at,n-t.length);if(e<=0)return;r&&(t.text+=this.slice(t.at,t.at+e)),t.at+=e,t.length+=e;return}let a=this.chunkAt(t.at);for(;t.at<i&&t.length<n;){let o=a===0?0:this.#e[a-1],s=this.chunks[a],c=s.slice(t.at-o,Math.min(s.length,i-o)),l=c.search(De),u=Math.min(l<0?c.length:l,n-t.length);if(u>0){r&&(t.text+=c.slice(0,u)),t.at+=u,t.length+=u,t.at===o+s.length&&a++;continue}let d=c.length>1?c[1]:t.at+1<i?this.chunks[a+1][0]:void 0,f,p=2;if(c[0]===`\\`&&d===void 0&&e.end<0)return;if(c[0]===`\\`&&d===`u`){let n=this.slice(t.at+2,Math.min(i,t.at+6)),r=!0;for(let e=0;e<n.length;e++)ke(n[e])||(r=!1);if(r){if(n.length<4&&e.end<0)return;n.length===4&&(f=String.fromCharCode(Number.parseInt(n,16)))}p=6}else c[0]===`\\`&&d!==void 0&&(f=Ee[d]);if(f===void 0){e.invalidAt=t.at,this.#f=!0;return}for(r&&(t.text+=f),t.length++,t.at+=p;a<this.chunks.length&&t.at>=this.#e[a];)a++}}scan(){if(this.object===void 0&&this.#n!==this.#t)for(let e=this.chunkAt(this.#n);e<this.chunks.length&&this.#d===void 0;e++){let t=this.chunks[e],n=e===0?0:this.#e[e-1];for(let e=this.#n-n;e<t.length&&this.#r!==`invalid`;e++){if(this.#r===`string`||this.#r===`nested`&&this.#u){let n=this.stringBoundary(t,e);if(this.#n+=n-e,e=n,e===t.length)break}this.step(t[e],this.#n),this.#n++}}}stringBoundary(e,t){let n=t;for(;;){let t=e.indexOf(`"`,n),r=t<0?e.length:t;if(this.#r===`string`){let t=this.#c;!t.needsDecoding&&De.test(e.slice(n,r))&&(t.needsDecoding=!0)}let i=r;for(;i>n&&e[i-1]===`\\`;)i--;let a=(r-i)%2==1!==(i===n&&this.#i);if(this.#i=t<0&&a,t<0||!a)return r;n=t+1}}step(e,t){switch(this.#r){case`root`:if(Oe(e))return;if(e===`{`){this.#r=`key-or-end`;return}this.fail();return;case`key-or-end`:if(Oe(e))return;if(e===`}`){this.#r=`closed`;return}if(e===`"`){this.beginKey(t);return}this.fail();return;case`key-only`:if(Oe(e))return;if(e===`"`){this.beginKey(t);return}this.fail();return;case`key`:this.stepKey(e,t);return;case`colon`:if(Oe(e))return;if(e===`:`){this.#r=`value`;return}this.fail();return;case`value`:this.beginValue(e,t);return;case`string`:{let e=this.#c;e.end=t,this.#c=null,this.#r=`comma-or-end`;return}case`scalar`:this.stepScalar(e,t);return;case`nested`:this.stepNested(e,t);return;case`comma-or-end`:if(Oe(e))return;if(e===`,`){this.#r=`key-only`;return}if(e===`}`){this.#r=`closed`;return}this.fail();return;case`closed`:if(Oe(e))return;this.fail();return;
|
|
4
4
|
/* v8 ignore next 2 -- scan() stops stepping once the view is invalid. */
|
|
@@ -135,7 +135,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
135
135
|
|
|
136
136
|
`),n=e.__next,c++}let f=s.__lexicalSlotTextLength||0,p=f>0?i.slice(f):i,m=p.slice(0,p.length-e)+d;s.__lexicalTextContent=m,z=r+m,Wu(t,s,l);return}if(function(e,t,n,r,i,a,o,s){if(s!==1&&s!==-1||o!==(s===1?2:1))return!1;let c=o-s,l=e.__last;for(let e=0;e<c-1;e++){if(l===null)return!1;let e=vu.get(l);if(e===void 0)return!1;l=e.__prev}if(l===null)return!1;let u=bu.get(a),d=vu.get(l);if(u===void 0||d===void 0||u.__prev!==d.__prev)return!1;let f=[],p=a;for(let e=0;e<o;e++){if(p===null)return!1;f.push(p);let e=bu.get(p);p=e?e.__next:null}let m=[];p=l;for(let e=0;e<c;e++){if(p===null)return!1;m.push(p);let e=vu.get(p);p=e?e.__next:null}let h=new Set(m),g=new Set(f),_=[],v=0,y=0;for(;v<c&&y<o;)if(f[y]===m[v])_.push({key:f[y],kind:`reconcile`}),v++,y++;else if(g.has(m[v])){if(h.has(f[y]))return!1;_.push({key:f[y],kind:`create`,nextIndex:y}),y++}else _.push({key:m[v],kind:`destroy`}),v++;for(;v<c;)_.push({key:m[v++],kind:`destroy`});for(;y<o;)_.push({key:f[y],kind:`create`,nextIndex:y}),y++;let ee=au(l,c);for(let e of _){let t=fu();if(e.kind===`reconcile`)Gu(e.key,n.element);else if(e.kind===`destroy`)Du(e.key,n.element);else{let t=null;for(let n=e.nextIndex+1;n<o;n++){let e=R._keyToDOMMap.get(f[n]);if(e!==void 0){t=e;break}}Bu(e.key,n.withBefore(t??n.before))}if(e.kind!==`destroy`){let t=bu.get(e.key);t&&V(t)&&lu===null&&(lu=t.getFormat(),uu=t.getStyle(),du=t.__key)}pu(t)}let b=``;for(let e=0;e<o;e++){let t=bu.get(f[e]);if(t===void 0)return!1;let n;if(G(t)){let r=R._keyToDOMMap.get(f[e]),i=r&&r.__lexicalTextContent;typeof i!=`string`&&L(350,t.getType()),n=i}else n=t.getTextContent();b+=n,e<o-1&&G(t)&&!t.isInline()&&(b+=`
|
|
137
137
|
|
|
138
|
-
`)}let
|
|
138
|
+
`)}let te=r.__lexicalSlotTextLength||0,x=te>0?i.slice(te):i;return r.__lexicalTextContent=x.slice(0,x.length-ee)+b,!0}(e,0,n,s,i,a,u,c)){let e=s.__lexicalTextContent;typeof e!=`string`&&L(353),z=r+e,Wu(t,s,l);return}}}if(c===0){let t=e.__first,n=0;for(;t!==null;){let e=bu.get(t);if(e===void 0)break;let r=Tu||_u.has(t)||gu.has(t),i=fu();if(r)Gu(t,o);else{let n,r;if(G(e)){r=xu.get(t);let i=r&&r.__lexicalTextContent;typeof i!=`string`&&L(354,e.getType()),n=i}else n=e.getTextContent();z+=n,r!==void 0&&mu(r)}V(e)?lu===null&&(lu=e.getFormat(),uu=e.getStyle(),du=e.__key):G(e)&&n<a-1&&!e.isInline()&&(z+=`
|
|
139
139
|
|
|
140
140
|
`),pu(i),t=e.__next,n++}s.__lexicalTextContent=z,s.__lexicalFirstTextKey=du,z=r+z;return}}if(i===1&&a===1){let r=e.__first,i=t.__first;if(r===i)Gu(r,o);else{let e=Xu(r),t=Bu(i,null);try{e.parentNode===o?o.replaceChild(t,e):n.insertChild(t)}catch(n){if(typeof n==`object`&&n){let a=`${n.toString()} Parent: ${o.tagName}, new child: {tag: ${t.tagName} key: ${i}}, old child: {tag: ${e.tagName}, key: ${r}}.`;throw Error(a)}throw n}Du(r,null)}let a=bu.get(i);V(a)&&lu===null&&(lu=a.getFormat(),uu=a.getStyle(),du=a.__key)}else{let r=s_(e,vu),s=s_(t,bu);if(r.length!==i&&L(227),s.length!==a&&L(228),i===0)a!==0&&Vu(s,t,0,a-1,n);else if(a===0){if(i!==0){let e=n.after==null&&n.before==null&&Iu(t).size===0&&n.element.__lexicalLineBreak==null;Ou(r,0,i-1,e?null:o),e&&(o.textContent=``)}}else(function(e,t,n,r,i,a){let o=r-1,s=i-1,c,l,u=a.getFirstChild(),d=0,f=0;for(;d<=o&&f<=s;){let e=t[d],r=n[f],i=fu();if(e===r)u=qu(Gu(r,a.element)),d++,f++;else{if(l===void 0&&(l=Ju(n,f)),c===void 0)c=Ju(t,d);else if(!c.has(e)){d++,pu(i);continue}if(!l.has(e)){u=qu(Xu(e)),Du(e,a.element),d++,c.delete(e),pu(i);continue}if(c.has(r)){let e=Yh(R,r);e!==u&&a.withBefore(u??a.before).insertChild(e),u=qu(Gu(r,a.element)),d++,f++}else Bu(r,a.withBefore(u??a.before)),f++}let o=bu.get(r);o!==null&&V(o)?lu===null&&(lu=o.getFormat(),uu=o.getStyle(),du=o.__key):G(o)&&f<=s&&!o.isInline()&&(z+=`
|
|
141
141
|
|
|
@@ -145,37 +145,40 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
145
145
|
`)e.preventDefault(),J(r,id,!1);else if(o===`
|
|
146
146
|
|
|
147
147
|
`)e.preventDefault(),J(r,ad);else if(o==null&&e.dataTransfer){let t=e.dataTransfer.getData(`text/plain`);e.preventDefault(),a.insertRawText(t)}else o!=null&&Jd(a,n,o,e.timeStamp,!0)?(e.preventDefault(),J(r,od,o),ef(o)):i.unprocessedBeforeInputData=o;return i.lastBeforeInputInsertTextTimeStamp=e.timeStamp,!0}switch(e.preventDefault(),t){case`insertFromYank`:case`insertFromDrop`:case`insertReplacementText`:J(r,od,e),ef((e.dataTransfer?e.dataTransfer.getData(`text/plain`):null)??e.data);break;case`insertFromComposition`:{let t=i.hadOrphanedCompositionEvents;i.hadOrphanedCompositionEvents=!1;let n=r._compositionKey;vh(null),t||J(r,od,e),lf(n);break}case`insertLineBreak`:vh(null),J(r,id,!1);break;case`insertParagraph`:vh(null),i.isInsertLineBreak&&!nl?(i.isInsertLineBreak=!1,J(r,id,!1)):J(r,ad);break;case`insertFromPaste`:case`insertFromPasteAsQuotation`:J(r,sd,e);break;case`deleteByComposition`:(function(e,t){return e!==t||G(e)||G(t)||!lh(e)||!lh(t)})(l,u)&&J(r,cd,e);break;case`deleteByDrag`:Qh(Ef),J(r,cd,e);break;case`deleteByCut`:J(r,cd,e);break;case`deleteContent`:J(r,rd,!1);break;case`deleteWordBackward`:J(r,ld,!0);break;case`deleteWordForward`:J(r,ld,!1);break;case`deleteHardLineBackward`:case`deleteSoftLineBackward`:J(r,ud,!0);break;case`deleteContentForward`:case`deleteHardLineForward`:case`deleteSoftLineForward`:J(r,ud,!1);break;case`formatStrikeThrough`:J(r,dd,`strikethrough`);break;case`formatBold`:J(r,dd,`bold`);break;case`formatItalic`:J(r,dd,`italic`);break;case`formatUnderline`:J(r,dd,`underline`);break;case`historyUndo`:J(r,fd);break;case`historyRedo`:J(r,pd)}return!0}function of(e){let t=W(),n=t._inputState,r=U(),i=e.data,a=$d(e),o=!1;if(i!=null&&H(r)){let s=pg(ng(t)),c=s===null?null:Cg(s,t._rootElement),l=e.inputType===`insertCompositionText`&&n.compositionPhase!==`ending-firefox`&&!t.isComposing();l&&(n.hadOrphanedCompositionEvents=!0);let u=r.anchor.getNode(),d=e.inputType===`insertCompositionText`&&n.compositionPhase!==`ending-firefox`&&t.isComposing()&&V(u)&&uh(u);if(!l&&!d&&Jd(r,a,i,e.timeStamp,!1,c)){if(o=!0,n.compositionPhase===`ending-firefox`){let e=uf(t,i);if(n.compositionPhase=`idle`,e)return Qh(Df),kh(),!0}let a=r.anchor.getNode();if(s===null||c===null)return!0;let l=r.isBackward(),u=l?r.anchor.offset:r.focus.offset,d=l?r.focus.offset:r.anchor.offset;tl&&!r.isCollapsed()&&V(a)&&c.anchorNode!==null&&a.getTextContent().slice(0,u)+i+a.getTextContent().slice(u+d)===Ph(c.anchorNode)||J(t,od,i);let f=i.length;el&&f>1&&e.inputType===`insertCompositionText`&&!t.isComposing()&&(r.anchor.offset-=f,r._cachedNodes=null,r._cachedIsBackward=null),ol&&t.isComposing()&&(n.lastKeyDownTimeStamp=0,vh(null))}}return o||(Fh(!1,t,i===null?void 0:i),n.compositionPhase===`ending-firefox`&&(uf(t,i||void 0),Qh(`composition-end`),n.compositionPhase=`idle`)),kh(),!0}function sf(e){let t=W(),n=t._inputState,r=U();if(H(r)&&!t.isComposing()){n.compositionPhase=`composing`,n.hadOrphanedCompositionEvents=!1;let i=r.anchor,a=r.anchor.getNode();if(vh(i.key),Qh(`composition-start`),e.timeStamp<n.lastKeyDownTimeStamp+30||i.type===`element`||!r.isCollapsed()||!ol&&(a.getFormat()!==r.format||V(a)&&a.getStyle()!==r.style)||V(a)&&(uh(a)||i.offset===0&&!a.canInsertTextBefore()||i.offset===a.getTextContentSize()&&!a.canInsertTextAfter())){J(t,od,ll);let e=U();H(e)&&vh(e.anchor.key)}}return!0}function cf(e){let t=W();return t._inputState.compositionPhase=`idle`,uf(t,e.data),Qh(Df),!0}function lf(e){if(e===null)return;let t=bh(e);if(!V(t)||t.getType()===`text`||uh(t)||!t.isAttached())return;let n=U(),r=H(n)&&n.anchor.key===e?n.anchor.offset:null,i=qf(t.getTextContent());if(i.setFormat(t.getFormat()),i.setStyle(t.getStyle()),t.replace(i),r!==null){let e=Math.min(r,i.getTextContentSize());i.select(e,e)}}function uf(e,t){let n=e._compositionKey;if(vh(null),n!==null&&t!=null){if(t===``){let t=bh(n),r=e.getElementByKey(n),i=r!==null&&V(t)?Vg(t,r,e):null;if(i!==null&&i.nodeValue!==null&&V(t)){let n=pg(ng(e)),r=n&&Cg(n,e._rootElement),a=null,o=null;r!==null&&r.anchorNode===i&&(a=r.anchorOffset,o=r.focusOffset),Ih(t,i.nodeValue,a,o,!0)}return lf(n),!1}if(t[t.length-1]===`
|
|
148
|
-
`){let t=U();if(H(t)||sp(t)){if(H(t)){let e=t.focus;t.anchor.set(e.key,e.offset,e.type)}return J(e,xd,null),lf(n),!1}}let r=bh(n);if(r!==null&&V(r)&&uh(r)){r.markDirty();let e=U(),i=r.getTextContentSize(),a=H(e)&&e.anchor.key===n?e.anchor.offset:i;return r.select(a,a).insertText(t),!0}}return Fh(!0,e,t),lf(n),!1}function df(e){let t=W(),n=t._inputState;if(e.key==null)return!0;if(n.compositionPhase===`ending-safari`){let r=Hh(e);if(r&&ym(t,()=>{uf(t,n.compositionEndData)}),n.compositionPhase=`idle`,n.compositionEndData=``,r)return!0}if(function(e){return q(e,`ArrowRight`,{shiftKey:`any`})}(e))J(t,hd,e);else if(function(e){return q(e,`ArrowRight`,{...Bh,shiftKey:`any`})}(e))J(t,gd,e);else if(function(e){return q(e,`ArrowLeft`,{shiftKey:`any`})}(e))J(t,_d,e);else if(function(e){return q(e,`ArrowLeft`,{...Bh,shiftKey:`any`})}(e))J(t,vd,e);else if(function(e){return q(e,`ArrowUp`,{altKey:`any`,shiftKey:`any`})}(e))J(t,yd,e);else if(function(e){return q(e,`ArrowDown`,{altKey:`any`,shiftKey:`any`})}(e))J(t,bd,e);else if(function(e){return q(e,`Enter`,{altKey:`any`,ctrlKey:`any`,metaKey:`any`,shiftKey:!0})}(e))n.isInsertLineBreak=!0,J(t,xd,e);else if(function(e){return e.key===` `}(e))J(t,Sd,e);else if(function(e){return $c&&q(e,`o`,{ctrlKey:!0})}(e))e.preventDefault(),n.isInsertLineBreak=!0,J(t,id,!0);else if(function(e){return q(e,`Enter`,{altKey:`any`,ctrlKey:`any`,metaKey:`any`})}(e))n.isInsertLineBreak=!1,J(t,xd,e);else if(function(e){return q(e,`Backspace`,{shiftKey:`any`})||$c&&q(e,`h`,{ctrlKey:!0})}(e))Hh(e)?J(t,Cd,e)&&nf(n):(e.preventDefault(),J(t,rd,!0));else if(function(e){return e.key===`Escape`}(e))J(t,wd,e);else if(function(e){return q(e,`Delete`,{})||$c&&q(e,`d`,{ctrlKey:!0})}(e))(function(e){return e.key===`Delete`})(e)?J(t,Td,e):(e.preventDefault(),J(t,rd,!1));else if(function(e){return q(e,`Backspace`,Vh)}(e))e.preventDefault(),J(t,ld,!0);else if(function(e){return q(e,`Delete`,Vh)}(e))e.preventDefault(),J(t,ld,!1);else if(function(e){return $c&&q(e,`Backspace`,{metaKey:!0})}(e))e.preventDefault(),J(t,ud,!0);else if(function(e){return $c&&(q(e,`Delete`,{metaKey:!0})||q(e,`k`,{ctrlKey:!0}))}(e))e.preventDefault(),J(t,ud,!1);else if(function(e){return q(e,`b`,Bh)}(e))e.preventDefault(),J(t,dd,`bold`);else if(function(e){return q(e,`u`,Bh)}(e))e.preventDefault(),J(t,dd,`underline`);else if(function(e){return q(e,`i`,Bh)}(e))e.preventDefault(),J(t,dd,`italic`);else if(function(e){return q(e,`Tab`,{shiftKey:`any`})}(e))J(t,Ed,e);else if(function(e){return q(e,`z`,Bh)}(e))e.preventDefault(),J(t,fd);else if(function(e){return $c?q(e,`z`,{metaKey:!0,shiftKey:!0}):q(e,`y`,{ctrlKey:!0})||q(e,`z`,{ctrlKey:!0,shiftKey:!0})}(e))e.preventDefault(),J(t,pd);else{let r=t._editorState._selection;(function(e){return q(e,`a`,Bh)})(e)?(e.preventDefault(),J(t,Nd,e)&&nf(n)):r===null||H(r)||(function(e){return q(e,`c`,Bh)}(e)?(e.preventDefault(),J(t,jd,e)):function(e){return q(e,`x`,Bh)}(e)&&(e.preventDefault(),J(t,Md,e)))}return function(e){return e.ctrlKey||e.shiftKey||e.altKey||e.metaKey}(e)&&t.dispatchCommand(Bd,e),!0}function ff(e){let t=e.__lexicalEventHandles;return t===void 0&&(t=[],e.__lexicalEventHandles=t),t}let pf=/* @__PURE__ */ new Map;function mf(e){let t=mg(e.target);if(t===null)return;let n=Zh(e.target),r=null,i=null,a=n===null?void 0:Kd.get(n);if(n!==null){if(a!==void 0){let e=a.editors,n=a.hasShadowEditor;if(n===void 0){n=!1;for(let t of e)if(t._rootElement!==null&&hg(t._rootElement.getRootNode())){n=!0;break}a.hasShadowEditor=n}if(n){let n=null,a=null;for(let o of e){let e=o._rootElement;if(e===null)continue;let s=Cg(t,e).anchorNode;if(s!==null&&sh(s)===o){if(hg(e.getRootNode())){r=o,i=s;break}n===null&&(n=o,a=s)}}r===null&&n!==null&&(r=n,i=a)}else{let e=t.anchorNode;e===null||Y(e)&&e.shadowRoot!==null||(r=sh(e),r!==null&&(i=e))}}if(r===null){let e=Og(n);r=e===null?null:sh(e)}}if(r===null)return;if(r._inputState.isSelectionChangeFromMouseDown){if(a!==void 0)for(let e of a.editors)e._inputState.isSelectionChangeFromMouseDown=!1;ym(r,()=>{let n=Ap(),a=i??Cg(t,r._rootElement).anchorNode;(Y(a)||dh(a))&&Oh(kp(n,t,r,e))})}let o=Mh(r),s=o[o.length-1],c=s._key,l=pf.get(c),u=l||s;u!==r&&Xd(t,u,!1),Xd(t,r,!0),r===s?l&&pf.delete(c):pf.set(c,r)}function hf(e){e._lexicalHandled=!0}function gf(e){return!0===e._lexicalHandled}function _f(e){let t=Gd.get(e);if(t===void 0)return;let n=Kd.get(t);if(n===void 0)return;Gd.delete(e);let r=ch(e);oh(r)?(function(e){if(e._parentEditor!==null){let t=Mh(e),n=t[t.length-1]._key;pf.get(n)===e&&pf.delete(n)}else pf.delete(e._key)}(r),n.editors.delete(r),n.hasShadowEditor=void 0,e.__lexicalEditor=null):r&&L(198);let i=ff(e);for(let e=0;e<i.length;e++)i[e]();e.__lexicalEventHandles=[]}function vf(e,t,n){tm();let r=e.__key,i=e.getParent();if(i===null)return void(f_(e)!==null&&L(367,r,String(f_(e))));let a=function(e){let t=U();if(!H(t)||!G(e))return t;let{anchor:n,focus:r}=t,i=n.getNode(),a=r.getNode();return eg(i,e)&&n.set(e.__key,0,`element`),eg(a,e)&&r.set(e.__key,0,`element`),t}(e),o=!1;if(H(a)&&t){let t=a.anchor,n=a.focus;t.key===r&&(Np(t,e,i,e.getPreviousSibling(),e.getNextSibling()),o=!0),n.key===r&&(Np(n,e,i,e.getPreviousSibling(),e.getNextSibling()),o=!0)}else sp(a)&&t&&e.isSelected()&&e.selectPrevious();if(H(a)&&t&&!o){let t=e.getIndexWithinParent();gh(e),jp(a,i,t,-1)}else gh(e);n||og(i)||i.canBeEmpty()||!i.isEmpty()||vf(i,t),t&&a&&Tm(i)&&i.isEmpty()&&i.selectEnd()}let yf=Symbol.for(`ephemeral`);function bf(e){return e[yf]||!1}let xf={configurable:!0,enumerable:!1,value:void 0,writable:!0};var Sf=class{__type;__key;__parent;__prev;__next;__state;[iu];static getType(){let{ownNodeType:e}=r_(this);return e===void 0&&L(64,this.name),e}static clone(e){L(65,this.name)}$config(){return{}}config(e,t){let n=t.extends||c_(this.constructor);return Object.assign(t,{extends:n}),typeof e==`string`&&Object.assign(t,{type:e}),{[e]:t}}afterCloneFrom(e){this.__key===e.__key?(this.__parent=e.__parent,this.__next=e.__next,this.__prev=e.__prev,this.__state=e.__state):e.__state&&(this.__state=e.__state.getWritable(this))}resetOnCopyNodeFrom(e){this.__state&&=this.__state.getWritable(this).resetOnCopyNode()}static importDOM;constructor(e){this.__type=this.constructor.getType(),this.__parent=null,this.__prev=null,this.__next=null,Object.defineProperty(this,"__state",xf),Object.defineProperty(this,iu,xf),hh(this,e)}getType(){return this.__type}isInline(){L(137,this.constructor.name)}isAttached(){let e=this.__key;for(;e!==null;){if(e===`root`)return!0;let t=bh(e);if(t===null)break;e=t.__parent===null?f_(t):t.__parent}return!1}isSelected(e){let t=e||U();if(t==null)return!1;let n=t.getNodes().some(e=>e.__key===this.__key);if(V(this))return n;if(H(t)&&t.anchor.type===`element`&&t.focus.type===`element`){if(t.isCollapsed())return!1;let e=this.getParent();if(K(this)&&this.isInline()&&e){let n=t.isBackward()?t.focus:t.anchor;if(e.is(n.getNode())&&n.offset===e.getChildrenSize()&&this.is(e.getLastChild()))return!1}}return n}getKey(){return this.__key}getIndexWithinParent(){let e=this.getParent();if(e===null)return-1;let t=e.getFirstChild(),n=0;for(;t!==null;){if(this.is(t))return n;n++,t=t.getNextSibling()}return-1}getParent(){let e=this.getLatest().__parent;return e===null?null:bh(e)}getParentOrThrow(){let e=this.getParent();return e===null&&L(66,this.__key),e}getTopLevelElement(){let e=this;for(;e!==null;){let t=e.getParent();if(og(t)||f_(e)!==null)return G(e)||e===this&&K(e)||L(194),e;e=t}return null}getTopLevelElementOrThrow(){let e=this.getTopLevelElement();return e===null&&L(67,this.__key),e}getParents(){let e=[],t=this.getParent();for(;t!==null;)e.push(t),t=t.getParent();return e}getParentKeys(){let e=[],t=this.getParent();for(;t!==null;)e.push(t.__key),t=t.getParent();return e}getPreviousSibling(){let e=this.getLatest().__prev;return e===null?null:bh(e)}getPreviousSiblings(){let e=[],t=this.getParent();if(t===null)return e;let n=t.getFirstChild();for(;n!==null&&!n.is(this);)e.push(n),n=n.getNextSibling();return e}getNextSibling(){let e=this.getLatest().__next;return e===null?null:bh(e)}getNextSiblings(){let e=[],t=this.getNextSibling();for(;t!==null;)e.push(t),t=t.getNextSibling();return e}getCommonAncestor(e){let t=G(this)?this:this.getParent(),n=G(e)?e:e.getParent(),r=t&&n?cv(t,n):null;return r?r.commonAncestor:null}is(e){return e!=null&&this.__key===e.__key}isBefore(e){let t=cv(this,e);return t!==null&&(t.type===`descendant`||(t.type===`branch`?av(t)===-1:(t.type!==`same`&&t.type!==`ancestor`&&L(279),!1)))}isParentOf(e){return eg(e,this)}getNodesBetween(e){let t=this.isBefore(e),n=[],r=/* @__PURE__ */ new Set,i=this;for(;i!==null;){let a=i.__key;if(r.has(a)||(r.add(a),n.push(i)),i===e)break;let o=G(i)?t?i.getFirstChild():i.getLastChild():null;if(o!==null){i=o;continue}let s=t?i.getNextSibling():i.getPreviousSibling();if(s!==null){i=s;continue}let c=i.getParentOrThrow();if(r.has(c.__key)||n.push(c),c===e)break;let l=null,u=c;do{if(u===null&&L(68),l=t?u.getNextSibling():u.getPreviousSibling(),u=u.getParent(),u===null)break;l!==null||r.has(u.__key)||n.push(u)}while(l===null);i=l}return t||n.reverse(),n}isDirty(){let e=W()._dirtyLeaves;return e!==null&&e.has(this.__key)}getLatest(){if(bf(this))return this;let e=bh(this.__key);return e===null&&L(113),e}getWritable(){if(bf(this))return this;tm();let e=rm(),t=W(),n=e._nodeMap,r=this.__key,i=this.getLatest(),a=t._cloneNotNeeded,o=U();if(o!==null&&o.setCachedNodes(null),a.has(r))return _h(i),i;let s=Gg(i);return a.add(r),_h(s),n.set(r,s),s}getTextContent(){return T_(this)}getTextContentSize(){return this.getTextContent().length}createDOM(e,t){L(70)}updateDOM(e,t,n){L(71)}getDOMSlot(e){return new xl(e)}exportDOM(e){return{element:this.createDOM(e._config,e)}}exportJSON(){let e=this.__state?this.__state.toJSON():void 0;return{type:this.__type,version:1,...e}}static importJSON(e){L(18,this.name)}updateFromJSON(e){return function(e,t){let n=e.getWritable(),r=t.$,i=r;for(let e of ql(n).flatKeys)e in t&&(i!==void 0&&i!==r||(i={...r}),i[e]=t[e]);return(n.__state||i)&&Kl(e).updateFromJSON(i),n}(this,e)}static transform(){return null}remove(e){vf(this,!0,e)}replace(e,t){tm();let n=U();n!==null&&(n=n.clone()),lg(this,e);let r=this.getLatest(),i=this.__key,a=e.__key,o=e.getWritable(),s=this.getParentOrThrow().getWritable(),c=s.__size,l=o.getParent(),u=l===null?-1:o.getIndexWithinParent();gh(o),l!==null&&H(n)&&jp(n,l,u,-1);let d=r.getPreviousSibling(),f=r.getNextSibling(),p=r.__prev,m=r.__next,h=r.__parent;vf(r,!1,!0),d===null?s.__first=a:d.getWritable().__next=a,o.__prev=p,f===null?s.__last=a:f.getWritable().__prev=a,o.__next=m,o.__parent=h,s.__size=c;let g=0;t&&(G(this)&&G(o)||L(139),g=o.getChildrenSize(),o.splice(g,0,this.getChildren()));let _=__(this);if(_.length>0){u_(this)&&u_(o)||L(368,this.__key,o.__key);for(let e of _){let t=v_(this,e);t!==null&&(k_(this,e),O_(o,e,t))}}if(H(n)){Oh(n);let e=n.anchor,r=n.focus;e.key===i&&(t&&e.type===`element`?e.set(o.__key,g+e.offset,`element`):tp(e,o)),r.key===i&&(t&&r.type===`element`?r.set(o.__key,g+r.offset,`element`):tp(r,o))}return yh()===i&&vh(a),o}insertAfter(e,t=!0){tm(),lg(this,e);let n=this.getWritable(),r=e.getWritable();this.getParentOrThrow();let i=r.getParent(),a=U(),o=!1,s=!1;if(i!==null){let n=e.getIndexWithinParent();if(H(a)){let e=i.__key,t=a.anchor,r=a.focus;o=t.type===`element`&&t.key===e&&t.offset===n+1,s=r.type===`element`&&r.key===e&&r.offset===n+1}gh(r),t&&H(a)&&jp(a,i,n,-1)}else gh(r);let c=this.getNextSibling(),l=this.getParentOrThrow().getWritable(),u=r.__key,d=n.__next;if(c===null?l.__last=u:c.getWritable().__prev=u,l.__size++,n.__next=u,r.__next=d,r.__prev=n.__key,r.__parent=n.__parent,t&&H(a)){let e=this.getIndexWithinParent();jp(a,l,e+1);let t=l.__key;o&&a.anchor.set(t,e+2,`element`),s&&a.focus.set(t,e+2,`element`)}return e}insertBefore(e,t=!0){tm(),lg(this,e);let n=this.getWritable(),r=e.getWritable();this.getParentOrThrow();let i=r.__key,a=U(),o=r.getParent(),s=o===null?-1:r.getIndexWithinParent();gh(r),o!==null&&t&&H(a)&&jp(a,o,s,-1);let c=this.getPreviousSibling(),l=this.getParentOrThrow().getWritable(),u=n.__prev,d=this.getIndexWithinParent();return c===null?l.__first=i:c.getWritable().__next=i,l.__size++,n.__prev=i,r.__prev=u,r.__next=n.__key,r.__parent=n.__parent,t&&H(a)&&jp(a,this.getParentOrThrow(),d),e}isParentRequired(){return!1}createParentElementNode(){return Vm()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(e,t){tm();let n=p_(this);if(n!==null)return n.selectPrevious(e,t);let r=this.getPreviousSibling(),i=this.getParentOrThrow();if(r===null)return i.select(0,0);if(G(r))return r.select();if(!V(r)){let e=r.getIndexWithinParent()+1;return i.select(e,e)}return r.select(e,t)}selectNext(e,t){tm();let n=p_(this);if(n!==null)return n.selectNext(e,t);let r=this.getNextSibling(),i=this.getParentOrThrow();if(r===null)return i.select();if(G(r))return r.select(0,0);if(!V(r)){let e=r.getIndexWithinParent();return i.select(e,e)}return r.select(e,t)}markDirty(){this.getWritable()}reconcileObservedMutation(e,t){this.markDirty()}};function Cf(e){return e instanceof Sf}let wf=`history-merge`,Tf=`paste`,Ef=`skip-selection-focus`,Df=`composition-end`;function Of(e){let t={};if(!e)return t;let n=``,r=``,i=null,a=!1,o=!1,s=!1,c=0,l=e.length,u=-1;for(let d=0;d<l;d++){let l=e[d];if(a)l===`*`&&e[d+1]===`/`&&(a=!1,d++);else if(o)u===-1&&(u=d),o=!1;else if(i===null){if(l!==`/`||e[d+1]!==`*`){if(l!==`"`&&l!==`'`){if(l!==`(`){if(l!==`)`){if(s||l!==`:`||c!==0){if(l===`;`&&c===0){u!==-1&&(s?r+=e.slice(u,d):n+=e.slice(u,d),u=-1);let i=n.trim(),a=r.trim();i!==``&&a!==``&&(t[i]=a),n=``,r=``,s=!1;continue}u===-1&&(u=d)}else u!==-1&&(n+=e.slice(u,d),u=-1),s=!0}else u===-1&&(u=d),c=Math.max(0,c-1)}else u===-1&&(u=d),c++}else u===-1&&(u=d),i=l}else u!==-1&&(s?r+=e.slice(u,d):n+=e.slice(u,d),u=-1),a=!0,d++}else u===-1&&(u=d),l===`\\`?o=!0:l===i&&(i=null)}u!==-1&&(s?r+=e.slice(u,l):n+=e.slice(u,l));let d=n.trim(),f=r.trim();return d!==``&&f!==``&&(t[d]=f),t}function kf(e,t,n){let r=n.trimEnd(),i=r.length-10;i>=0&&r.slice(i).toLowerCase()===`!important`?e.setProperty(t,r.slice(0,i).trim(),`important`):e.setProperty(t,n,``)}function Af(e,t,n=``){if(t===n)return;let r=Of(n),i=Of(t);for(let t in i)delete r[t],kf(e,t,i[t]);for(let t in r)e.removeProperty(t)}function jf(e,t){return 16&t?`code`:t&128?`mark`:32&t?`sub`:64&t?`sup`:null}function Mf(e,t){return 1&t?`strong`:2&t?`em`:`span`}function Nf(e,t,n,r,i){let a=r.classList,o=Wh(i,`base`);o!==void 0&&a.add(...o),o=Wh(i,`underlineStrikethrough`);let s=!1,c=8&t&&4&t;o!==void 0&&(8&n&&4&n?(s=!0,c||a.add(...o)):c&&a.remove(...o));for(let e in fl){let r=fl[e];if(o=Wh(i,e),o!==void 0){if(n&r){if(s&&(e===`underline`||e===`strikethrough`)){t&r&&a.remove(...o);continue}((t&r)===0||c&&e===`underline`||e===`strikethrough`)&&a.add(...o)}else t&r&&a.remove(...o)}}}function Pf(e,t,n){let r=n.isComposing(),i=e+(r?cl:``),a=Lg(),o=Rg(a).$getDOMSlot(n,t,a),s=o.getFirstChild();if(s===null||s.nodeType!==Node.TEXT_NODE)return void o.insertChild(bg().createTextNode(i));let c=s,l=c.nodeValue;if(l!==i){if(r||el){let[e,t,n]=function(e,t){let n=e.length,r=t.length,i=0,a=0;for(;i<n&&i<r&&e[i]===t[i];)i++;for(;a+i<n&&a+i<r&&e[n-a-1]===t[r-a-1];)a++;return[i,n-i-a,t.slice(i,r-a)]}(l,i);t!==0&&c.deleteData(e,t),c.insertData(e,n)}else c.nodeValue=i}}function Ff(e,t,n,r,i,a){Pf(i,e,t);let o=a.theme.text;o!==void 0&&Nf(0,0,r,e,o)}function If(e,t){let n=bg().createElement(t);return n.appendChild(e),n}function Lf(e){return e!=null&&!0===e.__isInlineFormattable}var Rf=class extends Sf{__text;__format;__style;__mode;__detail;get __isInlineFormattable(){return!0}$config(){return this.config(`text`,{importDOM:{"#text":()=>({conversion:Uf,priority:0}),b:()=>({conversion:Bf,priority:0}),code:()=>({conversion:Kf,priority:0}),em:()=>({conversion:Kf,priority:0}),i:()=>({conversion:Kf,priority:0}),mark:()=>({conversion:Kf,priority:0}),s:()=>({conversion:Kf,priority:0}),span:()=>({conversion:zf,priority:0}),strong:()=>({conversion:Kf,priority:0}),sub:()=>({conversion:Kf,priority:0}),sup:()=>({conversion:Kf,priority:0}),u:()=>({conversion:Kf,priority:0})}})}afterCloneFrom(e){super.afterCloneFrom(e),this.__text=e.__text,this.__format=e.__format,this.__style=e.__style,this.__mode=e.__mode,this.__detail=e.__detail}constructor(e=``,t){super(t),this.__text=e,this.__format=0,this.__style=``,this.__mode=0,this.__detail=0}getFormat(){return this.getLatest().__format}getDetail(){return this.getLatest().__detail}getMode(){let e=this.getLatest();return _l[e.__mode]}getStyle(){return this.getLatest().__style}isToken(){return this.getLatest().__mode===1}isComposing(){return this.__key===yh()}isSegmented(){return this.getLatest().__mode===2}isDirectionless(){return!!(1&this.getLatest().__detail)}isUnmergeable(){return!!(2&this.getLatest().__detail)}hasFormat(e){let t=fl[e];return(this.getFormat()&t)!==0}isSimpleText(){return this.__type===`text`&&this.__mode===0}getTextContent(){return this.getLatest().__text}getFormatFlags(e,t){return mh(this.getLatest().__format,e,t)}canHaveFormat(){return!0}isInline(){return!0}createDOM(e,t){let n=this.__format,r=jf(0,n),i=Mf(0,n),a=r===null?i:r,o=bg().createElement(a),s=o;this.hasFormat(`code`)&&o.setAttribute(`spellcheck`,`false`),r!==null&&(s=bg().createElement(i),o.appendChild(s)),Ff(s,this,0,n,this.__text,e);let c=this.__style;return c!==``&&Af(o.style,c),o}updateDOM(e,t,n){let r=this.__text,i=e.__format,a=this.__format,o=jf(0,i),s=jf(0,a),c=Mf(0,i),l=Mf(0,a);if((o===null?c:o)!==(s===null?l:s))return!0;if(o===s&&c!==l){let e=t.firstChild;e??L(48);let i=bg().createElement(l);return Ff(i,this,0,a,r,n),t.replaceChild(i,e),!1}let u=t;s!==null&&o!==null&&(u=t.firstChild,u??L(49)),Pf(r,u,this);let d=n.theme.text;d!==void 0&&i!==a&&Nf(0,i,a,u,d);let f=e.__style,p=this.__style;return f!==p&&Af(t.style,p,f),!1}updateFromJSON(e){return super.updateFromJSON(e).setTextContent(e.text).setFormat(e.format).setDetail(e.detail).setMode(e.mode).setStyle(e.style)}exportDOM(e){let{element:t}=super.exportDOM(e);return Y(t)||L(132),t.style.whiteSpace=`pre-wrap`,this.hasFormat(`lowercase`)?t.style.textTransform=`lowercase`:this.hasFormat(`uppercase`)?t.style.textTransform=`uppercase`:this.hasFormat(`capitalize`)&&(t.style.textTransform=`capitalize`),this.hasFormat(`bold`)&&(t=If(t,`b`)),this.hasFormat(`italic`)&&(t=If(t,`i`)),this.hasFormat(`strikethrough`)&&(t=If(t,`s`)),this.hasFormat(`underline`)&&(t=If(t,`u`)),{element:t}}exportJSON(){return{detail:this.getDetail(),format:this.getFormat(),mode:this.getMode(),style:this.getStyle(),text:this.getTextContent(),...super.exportJSON()}}selectionTransform(e,t){}setFormat(e){let t=this.getWritable();return t.__format=typeof e==`string`?fl[e]:e,t}setDetail(e){let t=this.getWritable();return t.__detail=typeof e==`string`?pl[e]:e,t}setStyle(e){let t=this.getWritable();return t.__style=e,t}toggleFormat(e){let t=mh(this.getFormat(),e,null);return this.setFormat(t)}toggleDirectionless(){let e=this.getWritable();return e.__detail^=1,e}toggleUnmergeable(){let e=this.getWritable();return e.__detail^=2,e}setMode(e){let t=gl[e];if(this.__mode===t)return this;let n=this.getWritable();return n.__mode=t,n}setTextContent(e){if(this.__text===e)return this;let t=this.getWritable();return t.__text=e,t}select(e,t){tm();let n=e,r=t,i=U(),a=this.getTextContent(),o=this.__key;if(typeof a==`string`){let e=a.length;n===void 0&&(n=e),r===void 0&&(r=e)}else n=0,r=0;if(!H(i))return Ep(o,n,o,r,`text`,`text`);{let e=yh();e!==i.anchor.key&&e!==i.focus.key||vh(o),i.setTextNodeRange(this,n,this,r)}return i}selectStart(){return this.select(0,0)}selectEnd(){let e=this.getTextContentSize();return this.select(e,e)}spliceText(e,t,n,r){let i=this.getWritable(),a=i.__text,o=n.length,s=e;s<0&&(s=o+s,s<0&&(s=0));let c=U();if(r&&H(c)){let t=e+o;c.setTextNodeRange(i,t,i,t)}return i.__text=a.slice(0,s)+n+a.slice(s+t),i}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...e){tm();let t=this.getLatest(),n=t.getTextContent();if(n===``)return[];let r=t.__key,i=yh(),a=n.length;e.sort((e,t)=>e-t),e.push(a);let o=[],s=e.length;for(let t=0,r=0;t<a&&r<=s;r++){let i=e[r];i>t&&(o.push(n.slice(t,i)),t=i)}let c=o.length;if(c===1)return[t];let l=o[0],u=t.getParent(),d,f=t.getFormat(),p=t.getStyle(),m=t.__detail,h=!1,g=null,_=null,v=U();if(H(v)){let[e,t]=v.isBackward()?[v.focus,v.anchor]:[v.anchor,v.focus];e.type===`text`&&e.key===r&&(g=e),t.type===`text`&&t.key===r&&(_=t)}t.isSegmented()?(d=qf(l),d.__format=f,d.__style=p,d.__detail=m,d.__state=Ql(t,d),h=!0):d=t.setTextContent(l);let y=[d];for(let e=1;e<c;e++){let n=qf(o[e]);n.__format=f,n.__style=p,n.__detail=m,n.__state=Ql(t,n);let a=n.__key;i===r&&vh(a),y.push(n)}let ee=g?g.offset:null,b=_?_.offset:null,x=0;for(let e of y){if(!g&&!_)break;let t=x+e.getTextContentSize();if(g!==null&&ee!==null&&ee<=t&&ee>=x&&(g.set(e.getKey(),ee-x,`text`),ee<t&&(g=null)),_!==null&&b!==null&&b<=t&&b>=x){_.set(e.getKey(),b-x,`text`);break}x=t}if(u!==null){(function(e){let t=e.getPreviousSibling(),n=e.getNextSibling();t!==null&&_h(t),n!==null&&_h(n)})(this);let e=u.getWritable(),t=this.getIndexWithinParent();h?(e.splice(t,0,y),this.remove()):e.splice(t,1,y),H(v)&&jp(v,u,t,c-1)}return y}mergeWithSibling(e){let t=e===this.getPreviousSibling();t||e===this.getNextSibling()||L(50);let n=this.__key,r=e.__key,i=this.__text,a=i.length;yh()===r&&vh(n);let o=U();if(H(o)){let i=o.anchor,s=o.focus;i!==null&&i.key===r&&Pp(i,t,n,e,a),s!==null&&s.key===r&&Pp(s,t,n,e,a)}let s=e.__text,c=t?s+i:i+s;this.setTextContent(c);let l=this.getWritable();return e.remove(),l}isTextEntity(){return!1}};function zf(e){return{forChild:Jf(e.style),node:null}}function Bf(e){let t=e,n=t.style.fontWeight===`normal`;return{forChild:Jf(t.style,n?void 0:`bold`),node:null}}let Vf=/* @__PURE__ */ new WeakMap;function Hf(e){if(!Y(e))return!1;if(e.nodeName===`PRE`)return!0;let t=e.style.whiteSpace;return typeof t==`string`&&t.startsWith(`pre`)}function Uf(e){let t=e;e.parentElement===null&&L(129);let n=t.textContent||``;if(function(e){let t,n=e.parentNode,r=[e];for(;n!==null&&(t=Vf.get(n))===void 0&&!Hf(n);)r.push(n),n=n.parentNode;let i=t===void 0?n:t;for(let e=0;e<r.length;e++)Vf.set(r[e],i);return i}(t)!==null)return{node:zp(n)};if(n=n.replace(/\r/g,``).replace(/[ \t\n]+/g,` `),n===``)return{node:null};if(n[0]===` `){let e=t,r=!0;for(;e!==null&&(e=Wf(e,!1))!==null;){let t=e.textContent||``;if(t.length>0){/[ \t\n]$/.test(t)&&(n=n.slice(1)),r=!1;break}}r&&(n=n.slice(1))}if(n[n.length-1]===` `){let e=t,r=!0;for(;e!==null&&(e=Wf(e,!0))!==null;)if((e.textContent||``).replace(/^( |\t|\r?\n)+/,``).length>0){r=!1;break}r&&(n=n.slice(0,n.length-1))}return n===``?{node:null}:{node:qf(n)}}function Wf(e,t){let n=e;for(;;){let e;for(;(e=t?n.nextSibling:n.previousSibling)===null;){let e=n.parentElement;if(e===null)return null;n=e}if(n=e,Y(n)){let e=n.style.display;if(e===``&&!Ng(n)||e!==``&&!e.startsWith(`inline`))return null}let r=n;for(;(r=t?n.firstChild:n.lastChild)!==null;)n=r;if(dh(n))return n;if(n.nodeName===`BR`)return null}}let Gf={code:`code`,em:`italic`,i:`italic`,mark:`highlight`,s:`strikethrough`,strong:`bold`,sub:`subscript`,sup:`superscript`,u:`underline`};function Kf(e){let t=Gf[e.nodeName.toLowerCase()];return t===void 0?{node:null}:{forChild:Jf(e.style,t),node:null}}function qf(e=``){return cg(new Rf(e))}function V(e){return e instanceof Rf}function Jf(e,t){let n=e.fontWeight,r=e.textDecoration.split(` `),i=n===`700`||n===`bold`,a=r.includes(`line-through`),o=e.fontStyle===`italic`,s=r.includes(`underline`),c=e.verticalAlign;return e=>((V(e)||Lf(e))&&(i&&!e.hasFormat(`bold`)&&e.toggleFormat(`bold`),a&&!e.hasFormat(`strikethrough`)&&e.toggleFormat(`strikethrough`),o&&!e.hasFormat(`italic`)&&e.toggleFormat(`italic`),s&&!e.hasFormat(`underline`)&&e.toggleFormat(`underline`),c!==`sub`||e.hasFormat(`subscript`)||e.toggleFormat(`subscript`),c!==`super`||e.hasFormat(`superscript`)||e.toggleFormat(`superscript`),t&&!e.hasFormat(t)&&e.toggleFormat(t)),e)}var Yf=class extends Rf{$config(){return this.config(`tab`,{extends:Rf})}constructor(e=void 0){super(` `,e),this.__detail=2}createDOM(e){let t=super.createDOM(e),n=Wh(e.theme,`tab`);return n!==void 0&&t.classList.add(...n),t}setTextContent(e){return super.setTextContent(` `)}spliceText(e,t,n,r){return n===``&&t===0||n===` `&&t===1||L(286),this}setDetail(e){return e!==2&&L(127),this}setMode(e){return e!==`normal`&&L(128),this}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}};function Xf(){return cg(new Yf)}function Zf(e){return e instanceof Yf}var Qf=class{key;offset;type;_selection;constructor(e,t,n){this._selection=null,this.key=e,this.offset=t,this.type=n}is(e){return this.key===e.key&&this.offset===e.offset&&this.type===e.type}isBefore(e){return this.key===e.key?this.offset<e.offset:iv(vv(lv(this,`next`)),vv(lv(e,`next`)))<0}getNode(){let e=bh(this.key);return e===null&&L(20),e}set(e,t,n,r){let i=this._selection,a=this.key;r&&this.key===e&&this.offset===t&&this.type===n||(this.key=e,this.offset=t,this.type=n,em()||(yh()===a&&vh(e),i!==null&&(i.setCachedNodes(null),H(i)&&(i._cachedIsBackward=null),i.dirty=!0)))}};function $f(e,t,n){return new Qf(e,t,n)}function ep(e,t){let n=t.__key,r=e.offset,i=`element`;if(V(t)){i=`text`;let e=t.getTextContentSize();r>e&&(r=e)}else if(!G(t)){let e=t.getNextSibling();if(V(e))n=e.__key,r=0,i=`text`;else{let e=t.getParent();e&&(n=e.__key,r=t.getIndexWithinParent()+1)}}e.set(n,r,i)}function tp(e,t){if(G(t)){let n=t.getLastDescendant();G(n)||V(n)?ep(e,n):ep(e,t)}else ep(e,t)}function np(e,t,n,r){let i=e.getNode(),a=i.getChildAtIndex(e.offset),o=qf();if(o.setFormat(n),o.setStyle(r),Hm(a))a.splice(0,0,[o]);else if(a!==null){let e=og(i)?Vm().append(o):o;a.insertBefore(e)}else if(og(i)){let e=i.getLastChild();G(e)&&!e.isInline()&&e.isEmpty()?e.append(o):i.append(Vm().append(o))}else i.append(o);e.is(t)&&t.set(o.__key,0,`text`),e.set(o.__key,0,`text`)}function rp(e,t,n,r){let i=e.anchor.getNode();V(i)||L(398);let a=e.anchor.offset,o=qf(t);o.setFormat(n),o.setStyle(r);let s=i.getParentOrThrow();if(a===0)s.isInline()&&!i.__prev?s.insertBefore(o):i.insertBefore(o,!1);else if(a===i.getTextContentSize())s.isInline()&&!i.__next?s.insertAfter(o):i.insertAfter(o,!1);else{let[e]=i.splitText(a);e.insertAfter(o,!1)}i.getTextContent()===``&&i.isAttached()&&i.remove(),o.selectEnd(),o.isComposing()&&e.anchor.type===`text`&&e.anchor.set(e.anchor.key,e.anchor.offset-t.length,e.anchor.type)}var ip=class e{_nodes;_cachedNodes;dirty;constructor(e){this._cachedNodes=null,this._nodes=e,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){if(!sp(e))return!1;let t=this._nodes,n=e._nodes;return t.size===n.size&&Array.from(t).every(e=>n.has(e))}isCollapsed(){return!1}isBackward(){return!1}getStartEndPoints(){return null}add(e){this.dirty=!0,this._nodes.add(e),this._cachedNodes=null}delete(e){this.dirty=!0,this._nodes.delete(e),this._cachedNodes=null}clear(){this.dirty=!0,this._nodes.clear(),this._cachedNodes=null}has(e){return this._nodes.has(e)}clone(){return new e(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(e){}insertText(){}insertNodes(e){let t=this.getNodes().filter(e=>f_(e)===null),n=t.length;if(n===0)return;let r=t[n-1],i;if(V(r))i=r.select();else{let e=r.getIndexWithinParent()+1;i=r.getParentOrThrow().select(e,e)}i.insertNodes(e);for(let e=0;e<n;e++)t[e].remove()}getNodes(){let e=this._cachedNodes;if(e!==null)return e;let t=this._nodes,n=[];for(let e of t){let t=bh(e);t!==null&&n.push(t)}return em()||(this._cachedNodes=n),n}getTextContent(){let e=this.getNodes(),t=``;for(let n=0;n<e.length;n++)t+=e[n].getTextContent();return t}deleteNodes(){let e=this.getNodes().filter(e=>f_(e)===null);if((U()||Ap())===this&&e[0]){let t=G_(e[0],`next`);dv(nv(t,t))}for(let t of e)t.remove();ap()}};function ap(){let e=Dh();if(e.isEmpty()){let t=Vm();e.append(t),t.select()}}function H(e){return e instanceof op}var op=class e{format;style;anchor;focus;_cachedNodes;_cachedIsBackward;dirty;constructor(e,t,n,r){this.anchor=e,this.focus=t,e._selection=this,t._selection=this,this._cachedNodes=null,this._cachedIsBackward=null,this.format=n,this.style=r,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){return!!H(e)&&this.anchor.is(e.anchor)&&this.focus.is(e.focus)&&this.format===e.format&&this.style===e.style}isCollapsed(){return this.anchor.is(this.focus)}getNodes(){let e=this._cachedNodes;if(e!==null)return e;let t=function(e){let t=[],[n,r]=e.getTextSlices();n&&t.push(n.caret.origin);let i=/* @__PURE__ */ new Set,a=/* @__PURE__ */ new Set;for(let n of e)if(V_(n)){let{origin:e}=n;t.length===0?i.add(e):(a.add(e),t.push(e))}else{let{origin:e}=n;G(e)&&a.has(e)||t.push(e)}if(r&&t.push(r.caret.origin),B_(e.focus)&&G(e.focus.origin)&&e.focus.getNodeAtCaret()===null)for(let n=Y_(e.focus.origin,`previous`);V_(n)&&i.has(n.origin)&&!n.origin.isEmpty()&&n.origin.is(t[t.length-1]);n=Z_(n))i.delete(n.origin),t.pop();for(;t.length>1;){let e=t[t.length-1];if(!G(e)||a.has(e)||e.isEmpty()||i.has(e))break;t.pop()}if(t.length===0&&e.isCollapsed()){let n=vv(e.anchor),r=vv(e.anchor.getFlipped()),i=e=>z_(e)?e.origin:e.getNodeAtCaret(),a=i(n)||i(r)||(e.anchor.getNodeAtCaret()?n.origin:r.origin);t.push(a)}return t}(xv(pv(this),`next`));return em()||(this._cachedNodes=t),t}setTextNodeRange(e,t,n,r){return this.anchor.set(e.__key,t,`text`),this.focus.set(n.__key,r,`text`),this}getTextContent(){let e=this.getNodes();if(e.length===0)return``;let t=e[0],n=e[e.length-1],r=this.anchor,i=this.focus,a=r.isBefore(i),[o,s]=dp(this),c=``,l=!0;for(let u=0;u<e.length;u++){let d=e[u];if(G(d)&&!d.isInline()){l||(c+=`
|
|
149
|
-
`);let e=``;for(let t of __(d)){let n=v_(d,t);n!==null&&(e+=n.getTextContent())}e===``?l=!d.isEmpty():(c+=e,l=!1)}else if(l=!1,V(d)){let e=d.getTextContent();d===t?d===n?r.type===`element`&&i.type===`element`&&i.offset!==r.offset||(e=o<s?e.slice(o,s):e.slice(s,o)):e=a?e.slice(o):e.slice(s):d===n&&(e=a?e.slice(0,s):e.slice(0,o)),c+=e}else!K(d)&&!Fm(d)||d===n&&this.isCollapsed()||(c+=d.getTextContent())}return c}applyDOMRange(e){let t=W(),n=t.getEditorState()._selection,r=wp(e.startContainer,e.startOffset,e.endContainer,e.endOffset,t,n);if(r===null)return;let[i,a,o]=r;this.anchor.set(i.key,i.offset,i.type,!0),this.focus.set(a.key,a.offset,a.type,!0),o&&(this.dirty=!0),nu(this)}clone(){let t=this.anchor,n=this.focus;return new e($f(t.key,t.offset,t.type),$f(n.key,n.offset,n.type),this.format,this.style)}toggleFormat(e){this.format=mh(this.format,e,null),this.dirty=!0}setFormat(e){this.format=e,this.dirty=!0}setStyle(e){this.style=e,this.dirty=!0}hasFormat(e){let t=fl[e];return(this.format&t)!==0}insertRawText(e){this.insertNodes(zp(e))}insertText(e){let t=this.format,n=this.style;if(!this.isCollapsed()){let r=(this.focus.isBefore(this.anchor)?this.focus:this.anchor).getNode();if(V(r)&&(t=r.getFormat(),n=r.getStyle()),this.removeText(),this.format=t,this.style=n,e===``)return;if(yh()===null)return this.anchor.type===`element`&&np(this.anchor,this.focus,t,n),void rp(this,e,t,n)}this.anchor.type===`element`&&np(this.anchor,this.focus,t,n);let r=this.anchor.getNode();V(r)||L(398);let i=this.anchor.offset,a=r.getParentOrThrow(),o=r.getTextContentSize();if(uh(r)||i===0&&(!r.canInsertTextBefore()||!a.canInsertTextBefore()&&!r.__prev)||i===o&&(!r.canInsertTextAfter()||!a.canInsertTextAfter()&&!r.__next)){if(r.isSegmented()&&i!==0&&i!==o){if(yh()!==null)r.setMode(`normal`).setFormat(t).setStyle(n);else{let e=qf(r.getTextContent());e.setFormat(t),e.setStyle(n),r.replace(e),e.select(i,i)}e!==``&&this.insertText(e);return}if(e===``)return;if(i===0){let i=r.getPreviousSibling();if(V(i)&&i.canInsertTextAfter()&&!uh(i))i.select();else{let e=qf();e.setFormat(t),e.setStyle(n),a.canInsertTextBefore()?r.insertBefore(e):a.insertBefore(e),e.select()}this.insertText(e);return}if(i===o){let i=r.getNextSibling();if(V(i)&&i.canInsertTextBefore()&&!uh(i))i.select(0,0);else{let e=qf();e.setFormat(t),e.setStyle(n),a.canInsertTextAfter()?r.insertAfter(e):a.insertAfter(e),e.select(0,0)}this.insertText(e);return}let s=qf(e);s.setFormat(t),s.setStyle(n),r.replace(s),s.select();return}if(e===``)return;let s=a.isInline()&&i===0&&!r.__prev,c=a.isInline()&&i===o&&!r.__next,l=r.getFormat()!==t||r.getStyle()!==n;if(s||c||l){if(r.getTextContent()!==``||s||c)return void rp(this,e,t,n);r.setFormat(t),r.setStyle(n)}r.spliceText(i,0,e,!0),r.isComposing()&&this.anchor.type===`text`&&this.anchor.set(this.anchor.key,this.anchor.offset-e.length,this.anchor.type)}removeText(){let e=U()===this;fv(this,_v(pv(this))),e&&U()!==this&&Oh(this)}formatText(e,t=null){lp(this,e,t)}insertNodes(e){if(e.length===0)return;this.isCollapsed()||this.removeText();let t=this.anchor.getNode();if(this.anchor.type===`element`&&G(t)&&f_(t)!==null){let n=t.isShadowRoot()?t.getFirstChild()??t.append(Vm()).getFirstChild():t.getFirstChild();if(t.isShadowRoot()&&n!==null&&!G(n)){let e=Vm();n.insertBefore(e),n=e}if(n!==null){n.selectStart();let t=U();return H(t)||L(369),t.insertNodes(e)}}if(this.anchor.type===`element`&&og(t)){let n=Wp(e),r=n.getLastDescendant();t.splice(this.anchor.offset,0,n.getChildren()),r!==null&&r.selectEnd();return}let n=(this.isBackward()?this.focus:this.anchor).getNode(),r=o_(n,Ig),i=e[e.length-1];if(G(r)&&`__language`in r){if(`__language`in e[0])this.insertText(e[0].getTextContent());else{let t=Vp(this);r.splice(t,0,e),i.selectEnd()}return}if(!e.some(e=>(G(e)||K(e))&&!e.isInline())){G(r)||L(211,n.constructor.name,n.getType());let t=Vp(this);r.splice(t,0,e),i.selectEnd();return}if(G(r)&&f_(r)!==null){let t=Vp(this),n=Bp(e);r.splice(t,0,n);let i=n[n.length-1];i===void 0?r.select(t,t):i.selectEnd();return}if(r===null){let t=Wp(e),n=t.getLastDescendant(),r=lv(this.anchor,`next`);for(let e of t.getChildren())r=Ev(e,r);n!==null&&n.selectEnd();return}if(G(r)&&!r.isParentRequired()&&!og(r.getParentOrThrow())){let t=Vp(this),n=Bp(e);r.splice(t,0,n);let i=n[n.length-1];i===void 0?r.select(t,t):i.selectEnd();return}let a=Wp(e),o=a.getLastDescendant(),s=a.getChildren(),c=!G(r)||!r.isEmpty()?this.insertParagraph():null;c&&!r.isAttached()&&(n=this.anchor.getNode(),r=o_(n,Ig));let l=s[s.length-1],u=s[0];var d;G(d=u)&&Ig(d)&&!d.isEmpty()&&G(r)&&(!r.isEmpty()||r.canMergeWhenEmpty())&&(G(r)||L(211,n.constructor.name,n.getType()),r.append(...u.getChildren()),u=s[1]),u&&(r===null&&L(212,n.constructor.name,n.getType()),function(e,t){let n=t.getParentOrThrow().getLastChild(),r=t,i=[t];for(;r!==n;)r.getNextSibling()||L(140),r=r.getNextSibling(),i.push(r);let a=e;for(let e of i)a=a.insertAfter(e)}(r,u));let f=o_(o,Ig);c&&G(f)&&(c.canMergeWhenEmpty()||Ig(l))&&(f.append(...c.getChildren()),c.remove()),G(r)&&r.isEmpty()&&r.remove(),o.selectEnd();let p=G(r)?r.getLastChild():null;Fm(p)&&f!==r&&p.remove()}insertParagraph(){let e=this.anchor.getNode();if(this.anchor.type===`element`&&og(e)){let t=Vm();return e.splice(this.anchor.offset,0,[t]),t.select(),t}let t=Vp(this),n=o_(this.anchor.getNode(),Ig);if(n!==null&&f_(n)!==null)return null;G(n)||L(213);let r=n.getChildAtIndex(t),i=r?[r,...r.getNextSiblings()]:[],a=n.insertNewAfter(this,!1);return a?(a.append(...i),a.selectStart(),a):null}insertLineBreak(e){let t=Pm();if(this.insertNodes([t]),e){let e=t.getParentOrThrow(),n=t.getIndexWithinParent();e.select(n,n)}}extract(){let e=[...this.getNodes()],t=e.length,n=e[0],r=e[t-1],[i,a]=dp(this),o=this.isBackward(),[s,c]=o?[this.focus,this.anchor]:[this.anchor,this.focus],[l,u]=o?[a,i]:[i,a];if(t===0)return[];if(t===1){if(V(n)&&!this.isCollapsed()){let e=n.splitText(l,u),t=l===0?e[0]:e[1];return t?(s.set(t.getKey(),0,`text`),c.set(t.getKey(),t.getTextContentSize(),`text`),[t]):[]}return[n]}if(V(n)&&(l===n.getTextContentSize()?e.shift():l!==0&&([,n]=n.splitText(l),e[0]=n,s.set(n.getKey(),0,`text`))),V(r)){let t=r.getTextContent().length;u===0?e.pop():u!==t&&([r]=r.splitText(u),e[e.length-1]=r,c.set(r.getKey(),r.getTextContentSize(),`text`))}return e}modify(e,t,n){if(Gp(this,e,t,n))return;let r=e===`move`,i=W(),a=pg(ng(i));if(!a)return;let o=i._blockCursorElement,s=i._rootElement,c=this.focus.getNode();s===null||o===null||!G(c)||c.isInline()||c.canBeEmpty()||fg(o,i,s);let l=Yh(i,this.focus.key),u=l;if(this.focus.type===`text`&&(u=V(c)?Vg(c,l,i):null),this.dirty){let e=Yh(i,this.anchor.key),t=e;if(this.anchor.type===`text`){let n=this.anchor.getNode();t=V(n)?Vg(n,e,i):null}t&&u&&Fp(a,t,this.anchor.offset,u,this.focus.offset)}if(n===`character`&&V(c)&&c.isUnmergeable()&&(t?this.focus.offset===0:this.focus.offset===c.getTextContentSize())){let e=G_(c,t?`previous`:`next`).getNodeAtCaret();if(V(e)){if(!r){let n=e.getTextContentSize();t?this.focus.set(e.__key,n-1,`text`):this.focus.set(e.__key,1,`text`),this.dirty=!0;return}{let n=i.getElementByKey(e.getKey()),r=n?Vg(e,n,i):null;if(r){let e=t?r.length:0;Fp(a,r,e,r,e)}}}}if(mp(a,e,t?`backward`:`forward`,n),a.rangeCount>0){let e=xg(a,i._rootElement),n=e||a.getRangeAt(0),o=this.anchor.getNode(),s=Tm(o)?o:ig(o);this.applyDOMRange(n),this.dirty=!0,!r&&(hp(this,t,s),(e?a.direction!==`backward`:a.anchorNode===n.startContainer&&a.anchorOffset===n.startOffset)||pp(this))}n===`lineboundary`&&Gp(this,e,t,n,`decorators`)}forwardDeletion(e,t,n){if(!n&&(e.type===`element`&&G(t)&&e.offset===t.getChildrenSize()||e.type===`text`&&e.offset===t.getTextContentSize())){let e=t.getParent(),n=t.getNextSibling()||(e===null?null:e.getNextSibling());if(G(n)&&n.isShadowRoot())return!0}return!1}deleteCharacter(e){let t=this.isCollapsed();if(this.isCollapsed()){let t=this.anchor,n=t.getNode();if(this.forwardDeletion(t,n,e))return;let r=ev(lv(t,e?`previous`:`next`));if(r.getTextSlices().every(e=>e===null||e.distance===0)){let e={type:`initial`};for(let t of r.iterNodeCarets(`shadowRoot`))if(V_(t)){if(!t.origin.isInline()){if(t.origin.isShadowRoot()){if(e.type===`merge-block`)break;if(G(r.anchor.origin)&&r.anchor.origin.isEmpty()){let e=vv(t);fv(this,nv(e,e)),r.anchor.origin.remove()}return}e.type!==`merge-next-block`&&e.type!==`merge-block`||(e={block:e.block,caret:t,type:`merge-block`})}}else{if(e.type===`merge-block`)break;if(B_(t)){if(G(t.origin)){if(t.origin.isInline()){if(!t.origin.isParentOf(r.anchor.origin))break}else e={block:t.origin,type:`merge-next-block`};continue}if(K(t.origin)){if(!t.origin.isIsolated()){if(__(t.origin).length>0){if(G(r.anchor.origin)&&r.anchor.origin.isEmpty()){r.anchor.origin.remove();let e=Op();e.add(t.origin.getKey()),Oh(e)}}else if(e.type===`merge-next-block`&&(t.origin.isKeyboardSelectable()||!t.origin.isInline())&&G(r.anchor.origin)&&r.anchor.origin.isEmpty()){r.anchor.origin.remove();let e=Op();e.add(t.origin.getKey()),Oh(e)}else t.origin.remove()}return}break}}if(e.type===`merge-block`){let{caret:t,block:n}=e;return __(n).length>0?void 0:t.origin.isEmpty()&&!n.isEmpty()&&t.origin.getParent()===n.getParent()?void t.origin.remove(!0):(fv(this,nv(!t.origin.isEmpty()&&n.isEmpty()?mv(G_(n,t.direction)):r.anchor,t)),this.removeText())}for(let e=t.getNode();e!==null;){if(f_(e)!==null)return;if(G(e)&&e.isShadowRoot())break;e=e.getParent()}}let i=this.focus;if(gp(this,e,`character`),this.isCollapsed()){if(e&&t.offset===0&&fp(this,t.getNode()))return}else{let r=i.type===`text`?i.getNode():null;if(n=t.type===`text`?t.getNode():null,r!==null&&r.isSegmented()){let t=i.offset,a=r.getTextContentSize();if(r.is(n)||e&&t!==a||!e&&t!==0)return void vp(r,e,t)}else if(n!==null&&n.isSegmented()){let i=t.offset,a=n.getTextContentSize();if(n.is(r)||e&&i!==0||!e&&i!==a)return void vp(n,e,i)}(function(e,t){let n=e.anchor,r=e.focus,i=n.getNode();if(i===r.getNode()&&n.type===`text`&&r.type===`text`){let e=n.offset,a=r.offset,o=e<a,s=o?e:a,c=o?a:e,l=c-1;s!==l&&(function(e){return!(jh(e)||_p(e))})(i.getTextContent().slice(s,c))&&(t?r.set(r.key,l,r.type):n.set(n.key,l,n.type))}})(this,e)}}if(this.removeText(),e&&!t&&this.isCollapsed()&&this.anchor.type===`element`&&this.anchor.offset===0){let e=this.anchor.getNode();e.isEmpty()&&Tm(e.getParent())&&e.getPreviousSibling()===null&&fp(this,e),ap()}}deleteLine(e){let t=xp(this.anchor);if(t!==null&&K(p_(t)))return this.isCollapsed()||this.focus.set(this.anchor.key,this.anchor.offset,this.anchor.type),void this.deleteCharacter(e);this.isCollapsed()&&gp(this,e,`lineboundary`),this.isCollapsed()?this.deleteCharacter(e):o_(this.anchor.getNode(),Ig)===o_(this.focus.getNode(),Ig)?this.removeText():(this.focus.set(this.anchor.key,this.anchor.offset,this.anchor.type),this.deleteCharacter(e))}deleteWord(e){if(this.isCollapsed()){let t=this.anchor,n=t.getNode();if(this.forwardDeletion(t,n,e))return;gp(this,e,`word`)}this.isCollapsed()?this.deleteCharacter(e):this.removeText()}isBackward(){let e=this._cachedIsBackward;if(e!==null)return e;let t=this.focus.isBefore(this.anchor);return em()||(this._cachedIsBackward=t),t}getStartEndPoints(){return[this.anchor,this.focus]}};function sp(e){return e instanceof ip}function cp(e,t){if(sp(e)){for(let n of e.getNodes())Lf(n)&&n.setFormat(t(n.getFormat()));return}if(e.isCollapsed())return e.setFormat(t(e.format)),void vh(null);let n=[];for(let r of e.getNodes())V(r)?n.push(r):G(r)?r.setTextFormat(t(r.getTextFormat())):Lf(r)&&r.setFormat(t(r.getFormat()));let r=n.length;if(r===0)return e.setFormat(t(e.format)),void vh(null);let i=e.anchor,a=e.focus,o=e.isBackward(),s=o?a:i,c=o?i:a,l=0,u=n[0],d=s.type===`element`?0:s.offset;if(s.type===`text`&&d===u.getTextContentSize()&&(l=1,u=n[1],d=0),u==null)return;let f=r-1,p=n[f],m=c.type===`text`?c.offset:p.getTextContentSize();if(u.is(p)){if(d===m)return;let n=t(u.getFormat());if(uh(u)||d===0&&m===u.getTextContentSize())u.setFormat(n);else{let e=u.splitText(d,m),t=d===0?e[0]:e[1];t.setFormat(n),s.type===`text`&&s.set(t.__key,0,`text`),c.type===`text`&&c.set(t.__key,m-d,`text`)}e.format=n;return}d===0||uh(u)||([,u]=u.splitText(d),d=0);let h=t(u.getFormat());u.setFormat(h);let g=t(p.getFormat());m>0&&(m===p.getTextContentSize()||uh(p)||([p]=p.splitText(m)),p.setFormat(g));for(let e=l+1;e<f;e++){let r=n[e];r.setFormat(t(r.getFormat()))}s.type===`text`&&s.set(u.__key,d,`text`),c.type===`text`&&c.set(p.__key,m,`text`),e.format=h|g}function lp(e,t,n=null){let r=n===null&&H(e)?mh(e.format,t,null):n;cp(e,e=>mh(e,t,r))}function up(e){let t=e.offset;if(e.type===`text`)return t;let n=e.getNode();return t===n.getChildrenSize()?n.getTextContent().length:0}function dp(e){let t=e.getStartEndPoints();if(t===null)return[0,0];let[n,r]=t;return n.type===`element`&&r.type===`element`&&n.key===r.key&&n.offset===r.offset?[0,0]:[up(n),up(r)]}function fp(e,t){for(let n=t;n;n=n.getParent()){if(G(n)){if(n.collapseAtStart(e))return!0;if(og(n))break}if(n.getPreviousSibling())break}return!1}function pp(e){let t=e.focus,n=e.anchor,r=n.key,i=n.offset,a=n.type;n.set(t.key,t.offset,t.type,!0),t.set(r,i,a,!0)}function mp(e,t,n,r){e.modify(t,n,r)}function hp(e,t,n){let r=e.getNodes(),i=r.filter(e=>eg(e,n));if(i.length===0||i.length===r.length)return!1;let a=t?i[0]:i[i.length-1],o=G(a)?a:a.getParentOrThrow();return t?o.selectStart():o.selectEnd(),!0}function gp(e,t,n){if(Gp(e,`extend`,t,n))return;let r=W(),i=pg(ng(r));if(!i||typeof i.modify!=`function`)return;let a=r._blockCursorElement,o=r._rootElement,s=e.anchor,c=e.focus.getNode();o===null||a===null||!G(c)||c.isInline()||c.canBeEmpty()||fg(a,r,o);let l=e=>{let t=e.getNode(),n=r.getElementByKey(e.key);return n!==null&&e.type===`text`&&V(t)?Vg(t,n,r):n},u=s.getNode(),d=l(s);if(d===null)return;let f=s.offset,p=e.isCollapsed(),m=e.focus,h=p?d:l(m);if(h===null)return;let g=m.offset;if(Fp(i,h,g,h,g),mp(i,`move`,t?`backward`:`forward`,n),i.rangeCount===0)return;let _=xg(i,o)||i.getRangeAt(0),v=_.startContainer,y=_.startOffset;if(p&&n===`character`&&s.type===`text`&&V(u)&&u.isUnmergeable()&&f===(t?0:u.getTextContentSize())){let n=G_(u,t?`previous`:`next`).getNodeAtCaret();if(V(n)){let r=t?n.getTextContentSize()-1:1;e.focus.set(n.__key,r,`text`),e.dirty=!0;return}}if(p&&n===`character`&&s.type===`text`){let n=t?0:u.getTextContentSize(),r=v===d?y:f===n?-1:n;if(r>=0)return void(r!==f&&(e.focus.set(s.key,r,`text`),e.dirty=!0))}let[ee,b,x,te]=t?[v,y,d,f]:[d,f,v,y],ne=Tm(u)?u:ig(u);e.applyDOMRange({collapsed:!1,endContainer:x,endOffset:te,startContainer:ee,startOffset:b}),e.dirty=!0,!hp(e,t,ne)&&t&&pp(e),n===`lineboundary`&&Gp(e,`extend`,t,n,`decorators`)}let _p=(()=>{try{let e=RegExp(`\\p{Emoji}`,`u`),t=e.test.bind(e);if(t(`❤️`)&&t(`#️⃣`)&&t(`👍`))return t}catch{}return()=>!1})();function vp(e,t,n){let r=e,i=r.getTextContent().split(/(?=\s)/g),a=i.length,o=0,s=0;for(let e=0;e<a;e++){let r=e===a-1;if(s=o,o+=i[e].length,t&&o===n||o>n||r){i.splice(e,1),r&&(s=void 0);break}}let c=i.join(``).trim();c===``?r.remove():(r.setTextContent(c),r.select(s,s))}function yp(e,t,n,r){let i,a=t,o=!1;if(Y(e)){let s=!1,c=e.childNodes,l=c.length,u=r._blockCursorElement;a===l&&l>0&&(s=!0,a=l-1),Ch(e,r)!==void 0||$g(e,r)||(o=!0);let d=c[a],f=!1;if(d===u)d=c[a+1],f=!0;else if(u!==null){let n=u.parentNode;e===n&&t>Array.prototype.indexOf.call(n.children,u)&&a--}if(i=Ah(d),V(i))a=q_(i,s?`next`:`previous`);else{let c=Ah(e);if(c===null)return null;if(G(c)){let o=r.getElementByKey(c.getKey());o===null&&L(214);let l=zg(c,o,r);[c,a]=l.resolveChildIndex(c,o,e,t),G(c)||L(215),s&&a>=c.getChildrenSize()&&(a=Math.max(0,c.getChildrenSize()-1));let u=c.getChildAtIndex(a);if(G(u)&&function(e,t,n){let r=e.getParent();return n===null||r===null||!r.canBeEmpty()||r!==n.getNode()}(u,0,n)){let e=s?u.getLastDescendant():u.getFirstDescendant();e===null?c=u:(u=e,c=G(u)?u:u.getParentOrThrow()),a=0}V(u)?(i=u,c=null,a=q_(u,s?`next`:`previous`)):u!==c&&s&&!f&&(G(c)||L(216),a=Math.min(c.getChildrenSize(),a+1))}else{let n=p_(c),i=n===null?c:n,o=i.getIndexWithinParent(),s=r.getElementByKey(c.getKey()),l=`after`;if(s!==null&&Ah(e)===c){let n=zg(c,s,r);n.element===s?t===0&&K(c)&&(l=`before`):l=n.resolveLeafPosition(s,e,t)}a=l===`before`?o:o+1,c=i.getParentOrThrow()}if(G(c))return[$f(c.__key,a,`element`),o]}}else i=Ah(e);return V(i)?[$f(i.__key,q_(i,a,`clamp`),`text`),o]:null}function bp(e,t,n){let r=e.offset,i=e.getNode();if(r===0){let r=i.getPreviousSibling(),a=i.getParent();if(t){if((n||!t)&&r===null&&G(a)&&a.isInline()){let t=a.getPreviousSibling();V(t)&&e.set(t.__key,t.getTextContent().length,`text`)}}else G(r)&&!n&&r.isInline()?e.set(r.__key,r.getChildrenSize(),`element`):V(r)&&!i.isUnmergeable()&&e.set(r.__key,r.getTextContent().length,`text`)}else if(r===i.getTextContent().length){let r=i.getNextSibling(),a=i.getParent();if(t&&G(r)&&r.isInline())e.set(r.__key,0,`element`);else if((n||t)&&r===null&&G(a)&&a.isInline()&&!a.canInsertTextAfter()&&a.getTextContentSize()>1){let t=a.getNextSibling();V(t)&&e.set(t.__key,0,`text`)}}}function xp(e){let t=bh(e.key);return t===null?null:h_(t)}function Sp(e,t,n){let r=xp(e),i=xp(t);if(r===i||r!==null&&i!==null&&r.is(i))return!1;let a=n(r,i);if(r!==null)return G(r)?t.set(r.getKey(),a?r.getChildrenSize():0,`element`):t.set(r.getKey(),a?r.getTextContentSize():0,`text`),!0;let o=p_(i);if(o===null)return!1;let s=o.getParent();if(s===null)return!1;let c=o.getIndexWithinParent();return t.set(s.getKey(),a?c+1:c,`element`),!0}function Cp(e){let t=Sp(e.anchor,e.focus,(t,n)=>function(e,t,n,r){if(n!==null&&r!==null){let e=p_(n),t=p_(r);if(e!==null&&e.is(t)){for(let t of g_(e).values()){if(t===n.getKey())return!0;if(t===r.getKey())return!1}return!0}return e===null||t===null||e.isBefore(t)}if(n!==null){let e=p_(n),r=bh(t.key);return e===null||r===null||!(!e.is(r)&&!e.isParentOf(r))||e.isBefore(r)}let i=p_(r),a=bh(e.key);return i!==null&&a!==null&&!i.is(a)&&!i.isParentOf(a)&&a.isBefore(i)}(e.anchor,e.focus,t,n));return t&&(e.dirty=!0),t}function wp(e,t,n,r,i,a){if(e===null||n===null||!ah(i,e,n))return null;let o=yp(e,t,H(a)?a.anchor:null,i);if(o===null)return null;let s=yp(n,r,H(a)?a.focus:null,i);if(s===null)return null;let[c,l]=o,[u,d]=s;if(c.type===`element`&&u.type===`element`){let t=Ah(e),r=Ah(n);if(K(t)&&K(r))return null}let f=i._slotsUsed&&Sp(c,u,()=>(e.compareDocumentPosition(n)&Node.DOCUMENT_POSITION_FOLLOWING)!==0);return function(e,t){if(e.type===`text`&&t.type===`text`){let n=e.isBefore(t),r=e.is(t);bp(e,n,r),bp(t,!n,r),r&&t.set(e.key,e.offset,e.type)}}(c,u),[c,u,l||d||f]}function Tp(e){return G(e)&&!e.isInline()}function Ep(e,t,n,r,i,a){let o=rm(),s=new op($f(e,t,i),$f(n,r,a),0,``);return s.dirty=!0,o._selection=s,s}function Dp(){return new op($f(`root`,0,`element`),$f(`root`,0,`element`),0,``)}function Op(){return new ip(/* @__PURE__ */ new Set)}function kp(e,t,n,r){let i=n._window;if(i===null)return null;let a=r||i.event,o=a?a.type:void 0,s=o===`selectionchange`,c=!jl&&(s||o===`beforeinput`||o===`compositionstart`||o===`compositionend`||o===`click`&&a&&a.detail===3||o===`drop`||o===void 0),l,u,d,f;if(H(e)&&!c)return e.clone();{if(t===null)return null;let r=Cg(t,n._rootElement);if(l=r.anchorNode,u=r.focusNode,d=r.anchorOffset,f=r.focusOffset,(s||o===void 0)&&H(e)&&!ah(n,l,u))return e.clone()}let p=wp(l,d,u,f,n,e);if(p===null)return null;let[m,h,g]=p,_=0,v=``;if(H(e)){let t=e.anchor;if(m.key===t.key)_=e.format,v=e.style;else{let e=m.getNode();V(e)?(_=e.getFormat(),v=e.getStyle()):G(e)&&(_=e.getTextFormat(),v=e.getTextStyle())}}let y=new op(m,h,_,v);return g&&(y.dirty=!0),y}function U(){return rm()._selection}function Ap(){return W()._editorState._selection}function jp(e,t,n,r=1){let i=e.anchor,a=e.focus,o=i.getNode(),s=a.getNode();if(!t.is(o)&&!t.is(s))return;let c=t.__key;if(e.isCollapsed()){let t=i.offset;if(n<=t&&r>0||n<t&&r<0){let n=Math.max(0,t+r);i.set(c,n,`element`),a.set(c,n,`element`),Mp(e)}}else{let o=e.isBackward(),s=o?a:i,l=s.getNode(),u=o?i:a,d=u.getNode();if(t.is(l)){let e=s.offset;(n<=e&&r>0||n<e&&r<0)&&s.set(c,Math.max(0,e+r),`element`)}if(t.is(d)){let e=u.offset;(n<=e&&r>0||n<e&&r<0)&&u.set(c,Math.max(0,e+r),`element`)}}Mp(e)}function Mp(e){let t=e.anchor,n=t.offset,r=e.focus,i=r.offset,a=t.getNode(),o=r.getNode();if(e.isCollapsed()){if(!G(a))return;let e=a.getChildrenSize(),i=n>=e,o=i?a.getChildAtIndex(e-1):a.getChildAtIndex(n);if(V(o)){let e=0;i&&(e=o.getTextContentSize()),t.set(o.__key,e,`text`),r.set(o.__key,e,`text`)}}else{if(G(a)){let e=a.getChildrenSize(),r=n>=e,i=r?a.getChildAtIndex(e-1):a.getChildAtIndex(n);if(V(i)){let e=0;r&&(e=i.getTextContentSize()),t.set(i.__key,e,`text`)}}if(G(o)){let e=o.getChildrenSize(),t=i>=e,n=t?o.getChildAtIndex(e-1):o.getChildAtIndex(i);if(V(n)){let e=0;t&&(e=n.getTextContentSize()),r.set(n.__key,e,`text`)}}}}function Np(e,t,n,r,i){let a=null,o=0,s=null;r===null?i!==null&&(a=i.__key,V(i)?s=`text`:G(i)&&(s=`element`)):(a=r.__key,V(r)?(o=r.getTextContentSize(),s=`text`):G(r)&&(o=r.getChildrenSize(),s=`element`)),a!==null&&s!==null?e.set(a,o,s):(o=t.getIndexWithinParent(),o===-1&&(o=n.getChildrenSize()),e.set(n.__key,o,`element`))}function Pp(e,t,n,r,i){e.type===`text`?e.set(n,e.offset+(t?0:i),`text`):e.offset>r.getIndexWithinParent()&&e.set(e.key,e.offset-1,`element`)}function Fp(e,t,n,r,i){try{e.setBaseAndExtent(t,n,r,i)}catch{}}function Ip(e,t,n){let r=Yh(e,t.getKey());if(G(t)){let i=zg(t,r,e);return[i.element,n+i.getFirstChildOffset()]}return[r,n]}function Lp(e,t,n,r,i,a){let o=a.getRootNode(),s=fh(o)||hg(o)?Og(o):null;if(i.has(`collaboration`)&&s!==a||s!==null&&ih(s,s))return;let c=Cg(r,a),l;if(!H(t))return void(e!==null&&ah(n,c.anchorNode,c.focusNode)&&r.removeAllRanges());let u=t.anchor,d=t.focus,f=u.getNode(),p=d.getNode(),[m,h]=Ip(n,f,u.offset),[g,_]=Ip(n,p,d.offset),v=t.format,y=t.style,ee=t.isCollapsed(),b=m,x=g,te=!1;if(u.type===`text`?(b=V(f)?Vg(f,m,n):null,te=f.getFormat()!==v||f.getStyle()!==y):H(e)&&e.anchor.type===`text`&&(te=!0),d.type===`text`&&(x=V(p)?Vg(p,g,n):null),b!==null&&x!==null){if(ee&&(e===null||te||H(e)&&(e.format!==v||e.style!==y))&&function(e,t,n,r,i,a){e._inputState.collapsedSelectionFormat={format:t,key:i,offset:r,style:n,timeStamp:a}}(n,v,y,h,u.key,performance.now()),(r.type!==`Range`||!ee)&&c.anchorOffset===h&&c.focusOffset===_&&c.anchorNode===b&&c.focusNode===x){if(s===null||!a.contains(s)){let e=s===null?null:sh(s);e!==null&&e!==n||i.has(`skip-selection-focus`)||a.focus({preventScroll:!0})}if(u.type!==`element`)return}if(Fp(r,b,h,x,_),el&&t.isCollapsed()&&a!==null&&!i.has(`skip-selection-focus`)){let e=Dg(a);if(e===null||!a.contains(e)){let e=Og(a.ownerDocument),t=e===null?null:sh(e);t!==null&&t!==n||a.focus({preventScroll:!0})}}if(!i.has(`skip-scroll-into-view`)&&t.isCollapsed()&&a!==null&&a===Dg(a)){let e=H(t)&&t.anchor.type===`element`?b.childNodes[h]||null:(l===void 0&&(l=Sg(r,a)),l);if(e!==null){let t;if(dh(e)){let n=e.ownerDocument.createRange();n.selectNode(e),t=n.getBoundingClientRect()}else t=e.getBoundingClientRect();(function(e,t,n){let r=Zh(n),i=tg(r);if(r===null||i===null)return;let a=n.getBoundingClientRect();if(t.bottom<a.top)return;let{top:o,bottom:s}=t,c=0,l=0,u=n;for(;u!==null;){let t=u===r.body;if(t){let t=i.visualViewport;if(t){let e=t.pageTop-i.scrollY;c=e,l=e+t.height}else c=0,l=ng(e).innerHeight;let n=i.getComputedStyle(r.documentElement),a=parseFloat(n.scrollPaddingTop),o=parseFloat(n.scrollPaddingBottom);isFinite(a)&&(c+=a),isFinite(o)&&(l-=o)}else{let e=u===n?a:u.getBoundingClientRect();c=e.top,l=e.bottom}let d=0;if(o<c?d=-(c-o):s>l&&(d=s-l),d!==0){if(t)i.scrollBy(0,d);else{let e=u.scrollTop;u.scrollTop+=d;let t=u.scrollTop-e;o-=t,s-=t}}if(t)break;u=Xh(u)}})(n,t,a)}}(function(e){e._inputState.isSelectionChangeFromDOMUpdate=!0})(n)}}function Rp(e,t){for(let n of e.split(/(\r?\n|\t)/))n===`
|
|
148
|
+
`){let t=U();if(H(t)||sp(t)){if(H(t)){let e=t.focus;t.anchor.set(e.key,e.offset,e.type)}return J(e,xd,null),lf(n),!1}}let r=bh(n);if(r!==null&&V(r)&&uh(r)){r.markDirty();let e=U(),i=r.getTextContentSize(),a=H(e)&&e.anchor.key===n?e.anchor.offset:i;return r.select(a,a).insertText(t),!0}}return Fh(!0,e,t),lf(n),!1}function df(e){let t=W(),n=t._inputState;if(e.key==null)return!0;if(n.compositionPhase===`ending-safari`){let r=Hh(e);if(r&&ym(t,()=>{uf(t,n.compositionEndData)}),n.compositionPhase=`idle`,n.compositionEndData=``,r)return!0}if(function(e){return q(e,`ArrowRight`,{shiftKey:`any`})}(e))J(t,hd,e);else if(function(e){return q(e,`ArrowRight`,{...Bh,shiftKey:`any`})}(e))J(t,gd,e);else if(function(e){return q(e,`ArrowLeft`,{shiftKey:`any`})}(e))J(t,_d,e);else if(function(e){return q(e,`ArrowLeft`,{...Bh,shiftKey:`any`})}(e))J(t,vd,e);else if(function(e){return q(e,`ArrowUp`,{altKey:`any`,shiftKey:`any`})}(e))J(t,yd,e);else if(function(e){return q(e,`ArrowDown`,{altKey:`any`,shiftKey:`any`})}(e))J(t,bd,e);else if(function(e){return q(e,`Enter`,{altKey:`any`,ctrlKey:`any`,metaKey:`any`,shiftKey:!0})}(e))n.isInsertLineBreak=!0,J(t,xd,e);else if(function(e){return e.key===` `}(e))J(t,Sd,e);else if(function(e){return $c&&q(e,`o`,{ctrlKey:!0})}(e))e.preventDefault(),n.isInsertLineBreak=!0,J(t,id,!0);else if(function(e){return q(e,`Enter`,{altKey:`any`,ctrlKey:`any`,metaKey:`any`})}(e))n.isInsertLineBreak=!1,J(t,xd,e);else if(function(e){return q(e,`Backspace`,{shiftKey:`any`})||$c&&q(e,`h`,{ctrlKey:!0})}(e))Hh(e)?J(t,Cd,e)&&nf(n):(e.preventDefault(),J(t,rd,!0));else if(function(e){return e.key===`Escape`}(e))J(t,wd,e);else if(function(e){return q(e,`Delete`,{})||$c&&q(e,`d`,{ctrlKey:!0})}(e))(function(e){return e.key===`Delete`})(e)?J(t,Td,e):(e.preventDefault(),J(t,rd,!1));else if(function(e){return q(e,`Backspace`,Vh)}(e))e.preventDefault(),J(t,ld,!0);else if(function(e){return q(e,`Delete`,Vh)}(e))e.preventDefault(),J(t,ld,!1);else if(function(e){return $c&&q(e,`Backspace`,{metaKey:!0})}(e))e.preventDefault(),J(t,ud,!0);else if(function(e){return $c&&(q(e,`Delete`,{metaKey:!0})||q(e,`k`,{ctrlKey:!0}))}(e))e.preventDefault(),J(t,ud,!1);else if(function(e){return q(e,`b`,Bh)}(e))e.preventDefault(),J(t,dd,`bold`);else if(function(e){return q(e,`u`,Bh)}(e))e.preventDefault(),J(t,dd,`underline`);else if(function(e){return q(e,`i`,Bh)}(e))e.preventDefault(),J(t,dd,`italic`);else if(function(e){return q(e,`Tab`,{shiftKey:`any`})}(e))J(t,Ed,e);else if(function(e){return q(e,`z`,Bh)}(e))e.preventDefault(),J(t,fd);else if(function(e){return $c?q(e,`z`,{metaKey:!0,shiftKey:!0}):q(e,`y`,{ctrlKey:!0})||q(e,`z`,{ctrlKey:!0,shiftKey:!0})}(e))e.preventDefault(),J(t,pd);else{let r=t._editorState._selection;(function(e){return q(e,`a`,Bh)})(e)?(e.preventDefault(),J(t,Nd,e)&&nf(n)):r===null||H(r)||(function(e){return q(e,`c`,Bh)}(e)?(e.preventDefault(),J(t,jd,e)):function(e){return q(e,`x`,Bh)}(e)&&(e.preventDefault(),J(t,Md,e)))}return function(e){return e.ctrlKey||e.shiftKey||e.altKey||e.metaKey}(e)&&t.dispatchCommand(Bd,e),!0}function ff(e){let t=e.__lexicalEventHandles;return t===void 0&&(t=[],e.__lexicalEventHandles=t),t}let pf=/* @__PURE__ */ new Map;function mf(e){let t=mg(e.target);if(t===null)return;let n=Zh(e.target),r=null,i=null,a=n===null?void 0:Kd.get(n);if(n!==null){if(a!==void 0){let e=a.editors,n=a.hasShadowEditor;if(n===void 0){n=!1;for(let t of e)if(t._rootElement!==null&&hg(t._rootElement.getRootNode())){n=!0;break}a.hasShadowEditor=n}if(n){let n=null,a=null;for(let o of e){let e=o._rootElement;if(e===null)continue;let s=Cg(t,e).anchorNode;if(s!==null&&sh(s)===o){if(hg(e.getRootNode())){r=o,i=s;break}n===null&&(n=o,a=s)}}r===null&&n!==null&&(r=n,i=a)}else{let e=t.anchorNode;e===null||Y(e)&&e.shadowRoot!==null||(r=sh(e),r!==null&&(i=e))}}if(r===null){let e=Og(n);r=e===null?null:sh(e)}}if(r===null)return;if(r._inputState.isSelectionChangeFromMouseDown){if(a!==void 0)for(let e of a.editors)e._inputState.isSelectionChangeFromMouseDown=!1;ym(r,()=>{let n=Ap(),a=i??Cg(t,r._rootElement).anchorNode;(Y(a)||dh(a))&&Oh(kp(n,t,r,e))})}let o=Mh(r),s=o[o.length-1],c=s._key,l=pf.get(c),u=l||s;u!==r&&Xd(t,u,!1),Xd(t,r,!0),r===s?l&&pf.delete(c):pf.set(c,r)}function hf(e){e._lexicalHandled=!0}function gf(e){return!0===e._lexicalHandled}function _f(e){let t=Gd.get(e);if(t===void 0)return;let n=Kd.get(t);if(n===void 0)return;Gd.delete(e);let r=ch(e);oh(r)?(function(e){if(e._parentEditor!==null){let t=Mh(e),n=t[t.length-1]._key;pf.get(n)===e&&pf.delete(n)}else pf.delete(e._key)}(r),n.editors.delete(r),n.hasShadowEditor=void 0,e.__lexicalEditor=null):r&&L(198);let i=ff(e);for(let e=0;e<i.length;e++)i[e]();e.__lexicalEventHandles=[]}function vf(e,t,n){tm();let r=e.__key,i=e.getParent();if(i===null)return void(f_(e)!==null&&L(367,r,String(f_(e))));let a=function(e){let t=U();if(!H(t)||!G(e))return t;let{anchor:n,focus:r}=t,i=n.getNode(),a=r.getNode();return eg(i,e)&&n.set(e.__key,0,`element`),eg(a,e)&&r.set(e.__key,0,`element`),t}(e),o=!1;if(H(a)&&t){let t=a.anchor,n=a.focus;t.key===r&&(Np(t,e,i,e.getPreviousSibling(),e.getNextSibling()),o=!0),n.key===r&&(Np(n,e,i,e.getPreviousSibling(),e.getNextSibling()),o=!0)}else sp(a)&&t&&e.isSelected()&&e.selectPrevious();if(H(a)&&t&&!o){let t=e.getIndexWithinParent();gh(e),jp(a,i,t,-1)}else gh(e);n||og(i)||i.canBeEmpty()||!i.isEmpty()||vf(i,t),t&&a&&Tm(i)&&i.isEmpty()&&i.selectEnd()}let yf=Symbol.for(`ephemeral`);function bf(e){return e[yf]||!1}let xf={configurable:!0,enumerable:!1,value:void 0,writable:!0};var Sf=class{__type;__key;__parent;__prev;__next;__state;[iu];static getType(){let{ownNodeType:e}=r_(this);return e===void 0&&L(64,this.name),e}static clone(e){L(65,this.name)}$config(){return{}}config(e,t){let n=t.extends||c_(this.constructor);return Object.assign(t,{extends:n}),typeof e==`string`&&Object.assign(t,{type:e}),{[e]:t}}afterCloneFrom(e){this.__key===e.__key?(this.__parent=e.__parent,this.__next=e.__next,this.__prev=e.__prev,this.__state=e.__state):e.__state&&(this.__state=e.__state.getWritable(this))}resetOnCopyNodeFrom(e){this.__state&&=this.__state.getWritable(this).resetOnCopyNode()}static importDOM;constructor(e){this.__type=this.constructor.getType(),this.__parent=null,this.__prev=null,this.__next=null,Object.defineProperty(this,"__state",xf),Object.defineProperty(this,iu,xf),hh(this,e)}getType(){return this.__type}isInline(){L(137,this.constructor.name)}isAttached(){let e=this.__key;for(;e!==null;){if(e===`root`)return!0;let t=bh(e);if(t===null)break;e=t.__parent===null?f_(t):t.__parent}return!1}isSelected(e){let t=e||U();if(t==null)return!1;let n=t.getNodes().some(e=>e.__key===this.__key);if(V(this))return n;if(H(t)&&t.anchor.type===`element`&&t.focus.type===`element`){if(t.isCollapsed())return!1;let e=this.getParent();if(K(this)&&this.isInline()&&e){let n=t.isBackward()?t.focus:t.anchor;if(e.is(n.getNode())&&n.offset===e.getChildrenSize()&&this.is(e.getLastChild()))return!1}}return n}getKey(){return this.__key}getIndexWithinParent(){let e=this.getParent();if(e===null)return-1;let t=e.getFirstChild(),n=0;for(;t!==null;){if(this.is(t))return n;n++,t=t.getNextSibling()}return-1}getParent(){let e=this.getLatest().__parent;return e===null?null:bh(e)}getParentOrThrow(){let e=this.getParent();return e===null&&L(66,this.__key),e}getTopLevelElement(){let e=this;for(;e!==null;){let t=e.getParent();if(og(t)||f_(e)!==null)return G(e)||e===this&&K(e)||L(194),e;e=t}return null}getTopLevelElementOrThrow(){let e=this.getTopLevelElement();return e===null&&L(67,this.__key),e}getParents(){let e=[],t=this.getParent();for(;t!==null;)e.push(t),t=t.getParent();return e}getParentKeys(){let e=[],t=this.getParent();for(;t!==null;)e.push(t.__key),t=t.getParent();return e}getPreviousSibling(){let e=this.getLatest().__prev;return e===null?null:bh(e)}getPreviousSiblings(){let e=[],t=this.getParent();if(t===null)return e;let n=t.getFirstChild();for(;n!==null&&!n.is(this);)e.push(n),n=n.getNextSibling();return e}getNextSibling(){let e=this.getLatest().__next;return e===null?null:bh(e)}getNextSiblings(){let e=[],t=this.getNextSibling();for(;t!==null;)e.push(t),t=t.getNextSibling();return e}getCommonAncestor(e){let t=G(this)?this:this.getParent(),n=G(e)?e:e.getParent(),r=t&&n?cv(t,n):null;return r?r.commonAncestor:null}is(e){return e!=null&&this.__key===e.__key}isBefore(e){let t=cv(this,e);return t!==null&&(t.type===`descendant`||(t.type===`branch`?av(t)===-1:(t.type!==`same`&&t.type!==`ancestor`&&L(279),!1)))}isParentOf(e){return eg(e,this)}getNodesBetween(e){let t=this.isBefore(e),n=[],r=/* @__PURE__ */ new Set,i=this;for(;i!==null;){let a=i.__key;if(r.has(a)||(r.add(a),n.push(i)),i===e)break;let o=G(i)?t?i.getFirstChild():i.getLastChild():null;if(o!==null){i=o;continue}let s=t?i.getNextSibling():i.getPreviousSibling();if(s!==null){i=s;continue}let c=i.getParentOrThrow();if(r.has(c.__key)||n.push(c),c===e)break;let l=null,u=c;do{if(u===null&&L(68),l=t?u.getNextSibling():u.getPreviousSibling(),u=u.getParent(),u===null)break;l!==null||r.has(u.__key)||n.push(u)}while(l===null);i=l}return t||n.reverse(),n}isDirty(){let e=W()._dirtyLeaves;return e!==null&&e.has(this.__key)}getLatest(){if(bf(this))return this;let e=bh(this.__key);return e===null&&L(113),e}getWritable(){if(bf(this))return this;tm();let e=rm(),t=W(),n=e._nodeMap,r=this.__key,i=this.getLatest(),a=t._cloneNotNeeded,o=U();if(o!==null&&o.setCachedNodes(null),a.has(r))return _h(i),i;let s=Gg(i);return a.add(r),_h(s),n.set(r,s),s}getTextContent(){return T_(this)}getTextContentSize(){return this.getTextContent().length}createDOM(e,t){L(70)}updateDOM(e,t,n){L(71)}getDOMSlot(e){return new xl(e)}exportDOM(e){return{element:this.createDOM(e._config,e)}}exportJSON(){let e=this.__state?this.__state.toJSON():void 0;return{type:this.__type,version:1,...e}}static importJSON(e){L(18,this.name)}updateFromJSON(e){return function(e,t){let n=e.getWritable(),r=t.$,i=r;for(let e of ql(n).flatKeys)e in t&&(i!==void 0&&i!==r||(i={...r}),i[e]=t[e]);return(n.__state||i)&&Kl(e).updateFromJSON(i),n}(this,e)}static transform(){return null}remove(e){vf(this,!0,e)}replace(e,t){tm();let n=U();n!==null&&(n=n.clone()),lg(this,e);let r=this.getLatest(),i=this.__key,a=e.__key,o=e.getWritable(),s=this.getParentOrThrow().getWritable(),c=s.__size,l=o.getParent(),u=l===null?-1:o.getIndexWithinParent();gh(o),l!==null&&H(n)&&jp(n,l,u,-1);let d=r.getPreviousSibling(),f=r.getNextSibling(),p=r.__prev,m=r.__next,h=r.__parent;vf(r,!1,!0),d===null?s.__first=a:d.getWritable().__next=a,o.__prev=p,f===null?s.__last=a:f.getWritable().__prev=a,o.__next=m,o.__parent=h,s.__size=c;let g=0;t&&(G(this)&&G(o)||L(139),g=o.getChildrenSize(),o.splice(g,0,this.getChildren()));let _=__(this);if(_.length>0){u_(this)&&u_(o)||L(368,this.__key,o.__key);for(let e of _){let t=v_(this,e);t!==null&&(k_(this,e),O_(o,e,t))}}if(H(n)){Oh(n);let e=n.anchor,r=n.focus;e.key===i&&(t&&e.type===`element`?e.set(o.__key,g+e.offset,`element`):tp(e,o)),r.key===i&&(t&&r.type===`element`?r.set(o.__key,g+r.offset,`element`):tp(r,o))}return yh()===i&&vh(a),o}insertAfter(e,t=!0){tm(),lg(this,e);let n=this.getWritable(),r=e.getWritable();this.getParentOrThrow();let i=r.getParent(),a=U(),o=!1,s=!1;if(i!==null){let n=e.getIndexWithinParent();if(H(a)){let e=i.__key,t=a.anchor,r=a.focus;o=t.type===`element`&&t.key===e&&t.offset===n+1,s=r.type===`element`&&r.key===e&&r.offset===n+1}gh(r),t&&H(a)&&jp(a,i,n,-1)}else gh(r);let c=this.getNextSibling(),l=this.getParentOrThrow().getWritable(),u=r.__key,d=n.__next;if(c===null?l.__last=u:c.getWritable().__prev=u,l.__size++,n.__next=u,r.__next=d,r.__prev=n.__key,r.__parent=n.__parent,t&&H(a)){let e=this.getIndexWithinParent();jp(a,l,e+1);let t=l.__key;o&&a.anchor.set(t,e+2,`element`),s&&a.focus.set(t,e+2,`element`)}return e}insertBefore(e,t=!0){tm(),lg(this,e);let n=this.getWritable(),r=e.getWritable();this.getParentOrThrow();let i=r.__key,a=U(),o=r.getParent(),s=o===null?-1:r.getIndexWithinParent();gh(r),o!==null&&t&&H(a)&&jp(a,o,s,-1);let c=this.getPreviousSibling(),l=this.getParentOrThrow().getWritable(),u=n.__prev,d=this.getIndexWithinParent();return c===null?l.__first=i:c.getWritable().__next=i,l.__size++,n.__prev=i,r.__prev=u,r.__next=n.__key,r.__parent=n.__parent,t&&H(a)&&jp(a,this.getParentOrThrow(),d),e}isParentRequired(){return!1}createParentElementNode(){return Vm()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(e,t){tm();let n=p_(this);if(n!==null)return n.selectPrevious(e,t);let r=this.getPreviousSibling(),i=this.getParentOrThrow();if(r===null)return i.select(0,0);if(G(r))return r.select();if(!V(r)){let e=r.getIndexWithinParent()+1;return i.select(e,e)}return r.select(e,t)}selectNext(e,t){tm();let n=p_(this);if(n!==null)return n.selectNext(e,t);let r=this.getNextSibling(),i=this.getParentOrThrow();if(r===null)return i.select();if(G(r))return r.select(0,0);if(!V(r)){let e=r.getIndexWithinParent();return i.select(e,e)}return r.select(e,t)}markDirty(){this.getWritable()}reconcileObservedMutation(e,t){this.markDirty()}};function Cf(e){return e instanceof Sf}let wf=`history-merge`,Tf=`paste`,Ef=`skip-selection-focus`,Df=`composition-end`;function Of(e){let t={};if(!e)return t;let n=``,r=``,i=null,a=!1,o=!1,s=!1,c=0,l=e.length,u=-1;for(let d=0;d<l;d++){let l=e[d];if(a)l===`*`&&e[d+1]===`/`&&(a=!1,d++);else if(o)u===-1&&(u=d),o=!1;else if(i===null){if(l!==`/`||e[d+1]!==`*`){if(l!==`"`&&l!==`'`){if(l!==`(`){if(l!==`)`){if(s||l!==`:`||c!==0){if(l===`;`&&c===0){u!==-1&&(s?r+=e.slice(u,d):n+=e.slice(u,d),u=-1);let i=n.trim(),a=r.trim();i!==``&&a!==``&&(t[i]=a),n=``,r=``,s=!1;continue}u===-1&&(u=d)}else u!==-1&&(n+=e.slice(u,d),u=-1),s=!0}else u===-1&&(u=d),c=Math.max(0,c-1)}else u===-1&&(u=d),c++}else u===-1&&(u=d),i=l}else u!==-1&&(s?r+=e.slice(u,d):n+=e.slice(u,d),u=-1),a=!0,d++}else u===-1&&(u=d),l===`\\`?o=!0:l===i&&(i=null)}u!==-1&&(s?r+=e.slice(u,l):n+=e.slice(u,l));let d=n.trim(),f=r.trim();return d!==``&&f!==``&&(t[d]=f),t}function kf(e,t,n){let r=n.trimEnd(),i=r.length-10;i>=0&&r.slice(i).toLowerCase()===`!important`?e.setProperty(t,r.slice(0,i).trim(),`important`):e.setProperty(t,n,``)}function Af(e,t,n=``){if(t===n)return;let r=Of(n),i=Of(t);for(let t in i)delete r[t],kf(e,t,i[t]);for(let t in r)e.removeProperty(t)}function jf(e,t){return 16&t?`code`:t&128?`mark`:32&t?`sub`:64&t?`sup`:null}function Mf(e,t){return 1&t?`strong`:2&t?`em`:`span`}function Nf(e,t,n,r,i){let a=r.classList,o=Wh(i,`base`);o!==void 0&&a.add(...o),o=Wh(i,`underlineStrikethrough`);let s=!1,c=8&t&&4&t;o!==void 0&&(8&n&&4&n?(s=!0,c||a.add(...o)):c&&a.remove(...o));for(let e in fl){let r=fl[e];if(o=Wh(i,e),o!==void 0){if(n&r){if(s&&(e===`underline`||e===`strikethrough`)){t&r&&a.remove(...o);continue}((t&r)===0||c&&e===`underline`||e===`strikethrough`)&&a.add(...o)}else t&r&&a.remove(...o)}}}function Pf(e,t,n){let r=n.isComposing(),i=e+(r?cl:``),a=Lg(),o=Rg(a).$getDOMSlot(n,t,a),s=o.getFirstChild();if(s===null||s.nodeType!==Node.TEXT_NODE)return void o.insertChild(bg().createTextNode(i));let c=s,l=c.nodeValue;if(l!==i){if(r||el){let[e,t,n]=function(e,t){let n=e.length,r=t.length,i=0,a=0;for(;i<n&&i<r&&e[i]===t[i];)i++;for(;a+i<n&&a+i<r&&e[n-a-1]===t[r-a-1];)a++;return[i,n-i-a,t.slice(i,r-a)]}(l,i);t!==0&&c.deleteData(e,t),c.insertData(e,n)}else c.nodeValue=i}}function Ff(e,t,n,r,i,a){Pf(i,e,t);let o=a.theme.text;o!==void 0&&Nf(0,0,r,e,o)}function If(e,t){let n=bg().createElement(t);return n.appendChild(e),n}function Lf(e){return e!=null&&!0===e.__isInlineFormattable}var Rf=class extends Sf{__text;__format;__style;__mode;__detail;get __isInlineFormattable(){return!0}$config(){return this.config(`text`,{importDOM:{"#text":()=>({conversion:Uf,priority:0}),b:()=>({conversion:Bf,priority:0}),code:()=>({conversion:Kf,priority:0}),em:()=>({conversion:Kf,priority:0}),i:()=>({conversion:Kf,priority:0}),mark:()=>({conversion:Kf,priority:0}),s:()=>({conversion:Kf,priority:0}),span:()=>({conversion:zf,priority:0}),strong:()=>({conversion:Kf,priority:0}),sub:()=>({conversion:Kf,priority:0}),sup:()=>({conversion:Kf,priority:0}),u:()=>({conversion:Kf,priority:0})}})}afterCloneFrom(e){super.afterCloneFrom(e),this.__text=e.__text,this.__format=e.__format,this.__style=e.__style,this.__mode=e.__mode,this.__detail=e.__detail}constructor(e=``,t){super(t),this.__text=e,this.__format=0,this.__style=``,this.__mode=0,this.__detail=0}getFormat(){return this.getLatest().__format}getDetail(){return this.getLatest().__detail}getMode(){let e=this.getLatest();return _l[e.__mode]}getStyle(){return this.getLatest().__style}isToken(){return this.getLatest().__mode===1}isComposing(){return this.__key===yh()}isSegmented(){return this.getLatest().__mode===2}isDirectionless(){return!!(1&this.getLatest().__detail)}isUnmergeable(){return!!(2&this.getLatest().__detail)}hasFormat(e){let t=fl[e];return(this.getFormat()&t)!==0}isSimpleText(){return this.__type===`text`&&this.__mode===0}getTextContent(){return this.getLatest().__text}getFormatFlags(e,t){return mh(this.getLatest().__format,e,t)}canHaveFormat(){return!0}isInline(){return!0}createDOM(e,t){let n=this.__format,r=jf(0,n),i=Mf(0,n),a=r===null?i:r,o=bg().createElement(a),s=o;this.hasFormat(`code`)&&o.setAttribute(`spellcheck`,`false`),r!==null&&(s=bg().createElement(i),o.appendChild(s)),Ff(s,this,0,n,this.__text,e);let c=this.__style;return c!==``&&Af(o.style,c),o}updateDOM(e,t,n){let r=this.__text,i=e.__format,a=this.__format,o=jf(0,i),s=jf(0,a),c=Mf(0,i),l=Mf(0,a);if((o===null?c:o)!==(s===null?l:s))return!0;if(o===s&&c!==l){let e=t.firstChild;e??L(48);let i=bg().createElement(l);return Ff(i,this,0,a,r,n),t.replaceChild(i,e),!1}let u=t;s!==null&&o!==null&&(u=t.firstChild,u??L(49)),Pf(r,u,this);let d=n.theme.text;d!==void 0&&i!==a&&Nf(0,i,a,u,d);let f=e.__style,p=this.__style;return f!==p&&Af(t.style,p,f),!1}updateFromJSON(e){return super.updateFromJSON(e).setTextContent(e.text).setFormat(e.format).setDetail(e.detail).setMode(e.mode).setStyle(e.style)}exportDOM(e){let{element:t}=super.exportDOM(e);return Y(t)||L(132),t.style.whiteSpace=`pre-wrap`,this.hasFormat(`lowercase`)?t.style.textTransform=`lowercase`:this.hasFormat(`uppercase`)?t.style.textTransform=`uppercase`:this.hasFormat(`capitalize`)&&(t.style.textTransform=`capitalize`),this.hasFormat(`bold`)&&(t=If(t,`b`)),this.hasFormat(`italic`)&&(t=If(t,`i`)),this.hasFormat(`strikethrough`)&&(t=If(t,`s`)),this.hasFormat(`underline`)&&(t=If(t,`u`)),{element:t}}exportJSON(){return{detail:this.getDetail(),format:this.getFormat(),mode:this.getMode(),style:this.getStyle(),text:this.getTextContent(),...super.exportJSON()}}selectionTransform(e,t){}setFormat(e){let t=this.getWritable();return t.__format=typeof e==`string`?fl[e]:e,t}setDetail(e){let t=this.getWritable();return t.__detail=typeof e==`string`?pl[e]:e,t}setStyle(e){let t=this.getWritable();return t.__style=e,t}toggleFormat(e){let t=mh(this.getFormat(),e,null);return this.setFormat(t)}toggleDirectionless(){let e=this.getWritable();return e.__detail^=1,e}toggleUnmergeable(){let e=this.getWritable();return e.__detail^=2,e}setMode(e){let t=gl[e];if(this.__mode===t)return this;let n=this.getWritable();return n.__mode=t,n}setTextContent(e){if(this.__text===e)return this;let t=this.getWritable();return t.__text=e,t}select(e,t){tm();let n=e,r=t,i=U(),a=this.getTextContent(),o=this.__key;if(typeof a==`string`){let e=a.length;n===void 0&&(n=e),r===void 0&&(r=e)}else n=0,r=0;if(!H(i))return Ep(o,n,o,r,`text`,`text`);{let e=yh();e!==i.anchor.key&&e!==i.focus.key||vh(o),i.setTextNodeRange(this,n,this,r)}return i}selectStart(){return this.select(0,0)}selectEnd(){let e=this.getTextContentSize();return this.select(e,e)}spliceText(e,t,n,r){let i=this.getWritable(),a=i.__text,o=n.length,s=e;s<0&&(s=o+s,s<0&&(s=0));let c=U();if(r&&H(c)){let t=e+o;c.setTextNodeRange(i,t,i,t)}return i.__text=a.slice(0,s)+n+a.slice(s+t),i}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...e){tm();let t=this.getLatest(),n=t.getTextContent();if(n===``)return[];let r=t.__key,i=yh(),a=n.length;e.sort((e,t)=>e-t),e.push(a);let o=[],s=e.length;for(let t=0,r=0;t<a&&r<=s;r++){let i=e[r];i>t&&(o.push(n.slice(t,i)),t=i)}let c=o.length;if(c===1)return[t];let l=o[0],u=t.getParent(),d,f=t.getFormat(),p=t.getStyle(),m=t.__detail,h=!1,g=null,_=null,v=U();if(H(v)){let[e,t]=v.isBackward()?[v.focus,v.anchor]:[v.anchor,v.focus];e.type===`text`&&e.key===r&&(g=e),t.type===`text`&&t.key===r&&(_=t)}t.isSegmented()?(d=qf(l),d.__format=f,d.__style=p,d.__detail=m,d.__state=Ql(t,d),h=!0):d=t.setTextContent(l);let y=[d];for(let e=1;e<c;e++){let n=qf(o[e]);n.__format=f,n.__style=p,n.__detail=m,n.__state=Ql(t,n);let a=n.__key;i===r&&vh(a),y.push(n)}let ee=g?g.offset:null,b=_?_.offset:null,te=0;for(let e of y){if(!g&&!_)break;let t=te+e.getTextContentSize();if(g!==null&&ee!==null&&ee<=t&&ee>=te&&(g.set(e.getKey(),ee-te,`text`),ee<t&&(g=null)),_!==null&&b!==null&&b<=t&&b>=te){_.set(e.getKey(),b-te,`text`);break}te=t}if(u!==null){(function(e){let t=e.getPreviousSibling(),n=e.getNextSibling();t!==null&&_h(t),n!==null&&_h(n)})(this);let e=u.getWritable(),t=this.getIndexWithinParent();h?(e.splice(t,0,y),this.remove()):e.splice(t,1,y),H(v)&&jp(v,u,t,c-1)}return y}mergeWithSibling(e){let t=e===this.getPreviousSibling();t||e===this.getNextSibling()||L(50);let n=this.__key,r=e.__key,i=this.__text,a=i.length;yh()===r&&vh(n);let o=U();if(H(o)){let i=o.anchor,s=o.focus;i!==null&&i.key===r&&Pp(i,t,n,e,a),s!==null&&s.key===r&&Pp(s,t,n,e,a)}let s=e.__text,c=t?s+i:i+s;this.setTextContent(c);let l=this.getWritable();return e.remove(),l}isTextEntity(){return!1}};function zf(e){return{forChild:Jf(e.style),node:null}}function Bf(e){let t=e,n=t.style.fontWeight===`normal`;return{forChild:Jf(t.style,n?void 0:`bold`),node:null}}let Vf=/* @__PURE__ */ new WeakMap;function Hf(e){if(!Y(e))return!1;if(e.nodeName===`PRE`)return!0;let t=e.style.whiteSpace;return typeof t==`string`&&t.startsWith(`pre`)}function Uf(e){let t=e;e.parentElement===null&&L(129);let n=t.textContent||``;if(function(e){let t,n=e.parentNode,r=[e];for(;n!==null&&(t=Vf.get(n))===void 0&&!Hf(n);)r.push(n),n=n.parentNode;let i=t===void 0?n:t;for(let e=0;e<r.length;e++)Vf.set(r[e],i);return i}(t)!==null)return{node:zp(n)};if(n=n.replace(/\r/g,``).replace(/[ \t\n]+/g,` `),n===``)return{node:null};if(n[0]===` `){let e=t,r=!0;for(;e!==null&&(e=Wf(e,!1))!==null;){let t=e.textContent||``;if(t.length>0){/[ \t\n]$/.test(t)&&(n=n.slice(1)),r=!1;break}}r&&(n=n.slice(1))}if(n[n.length-1]===` `){let e=t,r=!0;for(;e!==null&&(e=Wf(e,!0))!==null;)if((e.textContent||``).replace(/^( |\t|\r?\n)+/,``).length>0){r=!1;break}r&&(n=n.slice(0,n.length-1))}return n===``?{node:null}:{node:qf(n)}}function Wf(e,t){let n=e;for(;;){let e;for(;(e=t?n.nextSibling:n.previousSibling)===null;){let e=n.parentElement;if(e===null)return null;n=e}if(n=e,Y(n)){let e=n.style.display;if(e===``&&!Ng(n)||e!==``&&!e.startsWith(`inline`))return null}let r=n;for(;(r=t?n.firstChild:n.lastChild)!==null;)n=r;if(dh(n))return n;if(n.nodeName===`BR`)return null}}let Gf={code:`code`,em:`italic`,i:`italic`,mark:`highlight`,s:`strikethrough`,strong:`bold`,sub:`subscript`,sup:`superscript`,u:`underline`};function Kf(e){let t=Gf[e.nodeName.toLowerCase()];return t===void 0?{node:null}:{forChild:Jf(e.style,t),node:null}}function qf(e=``){return cg(new Rf(e))}function V(e){return e instanceof Rf}function Jf(e,t){let n=e.fontWeight,r=e.textDecoration.split(` `),i=n===`700`||n===`bold`,a=r.includes(`line-through`),o=e.fontStyle===`italic`,s=r.includes(`underline`),c=e.verticalAlign;return e=>((V(e)||Lf(e))&&(i&&!e.hasFormat(`bold`)&&e.toggleFormat(`bold`),a&&!e.hasFormat(`strikethrough`)&&e.toggleFormat(`strikethrough`),o&&!e.hasFormat(`italic`)&&e.toggleFormat(`italic`),s&&!e.hasFormat(`underline`)&&e.toggleFormat(`underline`),c!==`sub`||e.hasFormat(`subscript`)||e.toggleFormat(`subscript`),c!==`super`||e.hasFormat(`superscript`)||e.toggleFormat(`superscript`),t&&!e.hasFormat(t)&&e.toggleFormat(t)),e)}var Yf=class extends Rf{$config(){return this.config(`tab`,{extends:Rf})}constructor(e=void 0){super(` `,e),this.__detail=2}createDOM(e){let t=super.createDOM(e),n=Wh(e.theme,`tab`);return n!==void 0&&t.classList.add(...n),t}setTextContent(e){return super.setTextContent(` `)}spliceText(e,t,n,r){return n===``&&t===0||n===` `&&t===1||L(286),this}setDetail(e){return e!==2&&L(127),this}setMode(e){return e!==`normal`&&L(128),this}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}};function Xf(){return cg(new Yf)}function Zf(e){return e instanceof Yf}var Qf=class{key;offset;type;_selection;constructor(e,t,n){this._selection=null,this.key=e,this.offset=t,this.type=n}is(e){return this.key===e.key&&this.offset===e.offset&&this.type===e.type}isBefore(e){return this.key===e.key?this.offset<e.offset:iv(vv(lv(this,`next`)),vv(lv(e,`next`)))<0}getNode(){let e=bh(this.key);return e===null&&L(20),e}set(e,t,n,r){let i=this._selection,a=this.key;r&&this.key===e&&this.offset===t&&this.type===n||(this.key=e,this.offset=t,this.type=n,em()||(yh()===a&&vh(e),i!==null&&(i.setCachedNodes(null),H(i)&&(i._cachedIsBackward=null),i.dirty=!0)))}};function $f(e,t,n){return new Qf(e,t,n)}function ep(e,t){let n=t.__key,r=e.offset,i=`element`;if(V(t)){i=`text`;let e=t.getTextContentSize();r>e&&(r=e)}else if(!G(t)){let e=t.getNextSibling();if(V(e))n=e.__key,r=0,i=`text`;else{let e=t.getParent();e&&(n=e.__key,r=t.getIndexWithinParent()+1)}}e.set(n,r,i)}function tp(e,t){if(G(t)){let n=t.getLastDescendant();G(n)||V(n)?ep(e,n):ep(e,t)}else ep(e,t)}function np(e,t,n,r){let i=e.getNode(),a=i.getChildAtIndex(e.offset),o=qf();if(o.setFormat(n),o.setStyle(r),Hm(a))a.splice(0,0,[o]);else if(a!==null){let e=og(i)?Vm().append(o):o;a.insertBefore(e)}else if(og(i)){let e=i.getLastChild();G(e)&&!e.isInline()&&e.isEmpty()?e.append(o):i.append(Vm().append(o))}else i.append(o);e.is(t)&&t.set(o.__key,0,`text`),e.set(o.__key,0,`text`)}function rp(e,t,n,r){let i=e.anchor.getNode();V(i)||L(398);let a=e.anchor.offset,o=qf(t);o.setFormat(n),o.setStyle(r);let s=i.getParentOrThrow();if(a===0)s.isInline()&&!i.__prev?s.insertBefore(o):i.insertBefore(o,!1);else if(a===i.getTextContentSize())s.isInline()&&!i.__next?s.insertAfter(o):i.insertAfter(o,!1);else{let[e]=i.splitText(a);e.insertAfter(o,!1)}i.getTextContent()===``&&i.isAttached()&&i.remove(),o.selectEnd(),o.isComposing()&&e.anchor.type===`text`&&e.anchor.set(e.anchor.key,e.anchor.offset-t.length,e.anchor.type)}var ip=class e{_nodes;_cachedNodes;dirty;constructor(e){this._cachedNodes=null,this._nodes=e,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){if(!sp(e))return!1;let t=this._nodes,n=e._nodes;return t.size===n.size&&Array.from(t).every(e=>n.has(e))}isCollapsed(){return!1}isBackward(){return!1}getStartEndPoints(){return null}add(e){this.dirty=!0,this._nodes.add(e),this._cachedNodes=null}delete(e){this.dirty=!0,this._nodes.delete(e),this._cachedNodes=null}clear(){this.dirty=!0,this._nodes.clear(),this._cachedNodes=null}has(e){return this._nodes.has(e)}clone(){return new e(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(e){}insertText(){}insertNodes(e){let t=this.getNodes().filter(e=>f_(e)===null),n=t.length;if(n===0)return;let r=t[n-1],i;if(V(r))i=r.select();else{let e=r.getIndexWithinParent()+1;i=r.getParentOrThrow().select(e,e)}i.insertNodes(e);for(let e=0;e<n;e++)t[e].remove()}getNodes(){let e=this._cachedNodes;if(e!==null)return e;let t=this._nodes,n=[];for(let e of t){let t=bh(e);t!==null&&n.push(t)}return em()||(this._cachedNodes=n),n}getTextContent(){let e=this.getNodes(),t=``;for(let n=0;n<e.length;n++)t+=e[n].getTextContent();return t}deleteNodes(){let e=this.getNodes().filter(e=>f_(e)===null);if((U()||Ap())===this&&e[0]){let t=G_(e[0],`next`);dv(nv(t,t))}for(let t of e)t.remove();ap()}};function ap(){let e=Dh();if(e.isEmpty()){let t=Vm();e.append(t),t.select()}}function H(e){return e instanceof op}var op=class e{format;style;anchor;focus;_cachedNodes;_cachedIsBackward;dirty;constructor(e,t,n,r){this.anchor=e,this.focus=t,e._selection=this,t._selection=this,this._cachedNodes=null,this._cachedIsBackward=null,this.format=n,this.style=r,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){return!!H(e)&&this.anchor.is(e.anchor)&&this.focus.is(e.focus)&&this.format===e.format&&this.style===e.style}isCollapsed(){return this.anchor.is(this.focus)}getNodes(){let e=this._cachedNodes;if(e!==null)return e;let t=function(e){let t=[],[n,r]=e.getTextSlices();n&&t.push(n.caret.origin);let i=/* @__PURE__ */ new Set,a=/* @__PURE__ */ new Set;for(let n of e)if(V_(n)){let{origin:e}=n;t.length===0?i.add(e):(a.add(e),t.push(e))}else{let{origin:e}=n;G(e)&&a.has(e)||t.push(e)}if(r&&t.push(r.caret.origin),B_(e.focus)&&G(e.focus.origin)&&e.focus.getNodeAtCaret()===null)for(let n=Y_(e.focus.origin,`previous`);V_(n)&&i.has(n.origin)&&!n.origin.isEmpty()&&n.origin.is(t[t.length-1]);n=Z_(n))i.delete(n.origin),t.pop();for(;t.length>1;){let e=t[t.length-1];if(!G(e)||a.has(e)||e.isEmpty()||i.has(e))break;t.pop()}if(t.length===0&&e.isCollapsed()){let n=vv(e.anchor),r=vv(e.anchor.getFlipped()),i=e=>z_(e)?e.origin:e.getNodeAtCaret(),a=i(n)||i(r)||(e.anchor.getNodeAtCaret()?n.origin:r.origin);t.push(a)}return t}(xv(pv(this),`next`));return em()||(this._cachedNodes=t),t}setTextNodeRange(e,t,n,r){return this.anchor.set(e.__key,t,`text`),this.focus.set(n.__key,r,`text`),this}getTextContent(){let e=this.getNodes();if(e.length===0)return``;let t=e[0],n=e[e.length-1],r=this.anchor,i=this.focus,a=r.isBefore(i),[o,s]=dp(this),c=``,l=!0;for(let u=0;u<e.length;u++){let d=e[u];if(G(d)&&!d.isInline()){l||(c+=`
|
|
149
|
+
`);let e=``;for(let t of __(d)){let n=v_(d,t);n!==null&&(e+=n.getTextContent())}e===``?l=!d.isEmpty():(c+=e,l=!1)}else if(l=!1,V(d)){let e=d.getTextContent();d===t?d===n?r.type===`element`&&i.type===`element`&&i.offset!==r.offset||(e=o<s?e.slice(o,s):e.slice(s,o)):e=a?e.slice(o):e.slice(s):d===n&&(e=a?e.slice(0,s):e.slice(0,o)),c+=e}else!K(d)&&!Fm(d)||d===n&&this.isCollapsed()||(c+=d.getTextContent())}return c}applyDOMRange(e){let t=W(),n=t.getEditorState()._selection,r=wp(e.startContainer,e.startOffset,e.endContainer,e.endOffset,t,n);if(r===null)return;let[i,a,o]=r;this.anchor.set(i.key,i.offset,i.type,!0),this.focus.set(a.key,a.offset,a.type,!0),o&&(this.dirty=!0),nu(this)}clone(){let t=this.anchor,n=this.focus;return new e($f(t.key,t.offset,t.type),$f(n.key,n.offset,n.type),this.format,this.style)}toggleFormat(e){this.format=mh(this.format,e,null),this.dirty=!0}setFormat(e){this.format=e,this.dirty=!0}setStyle(e){this.style=e,this.dirty=!0}hasFormat(e){let t=fl[e];return(this.format&t)!==0}insertRawText(e){this.insertNodes(zp(e))}insertText(e){let t=this.format,n=this.style;if(!this.isCollapsed()){let r=(this.focus.isBefore(this.anchor)?this.focus:this.anchor).getNode();if(V(r)&&(t=r.getFormat(),n=r.getStyle()),this.removeText(),this.format=t,this.style=n,e===``)return;if(yh()===null)return this.anchor.type===`element`&&np(this.anchor,this.focus,t,n),void rp(this,e,t,n)}this.anchor.type===`element`&&np(this.anchor,this.focus,t,n);let r=this.anchor.getNode();V(r)||L(398);let i=this.anchor.offset,a=r.getParentOrThrow(),o=r.getTextContentSize();if(uh(r)||i===0&&(!r.canInsertTextBefore()||!a.canInsertTextBefore()&&!r.__prev)||i===o&&(!r.canInsertTextAfter()||!a.canInsertTextAfter()&&!r.__next)){if(r.isSegmented()&&i!==0&&i!==o){if(yh()!==null)r.setMode(`normal`).setFormat(t).setStyle(n);else{let e=qf(r.getTextContent());e.setFormat(t),e.setStyle(n),r.replace(e),e.select(i,i)}e!==``&&this.insertText(e);return}if(e===``)return;if(i===0){let i=r.getPreviousSibling();if(V(i)&&i.canInsertTextAfter()&&!uh(i))i.select();else{let e=qf();e.setFormat(t),e.setStyle(n),a.canInsertTextBefore()?r.insertBefore(e):a.insertBefore(e),e.select()}this.insertText(e);return}if(i===o){let i=r.getNextSibling();if(V(i)&&i.canInsertTextBefore()&&!uh(i))i.select(0,0);else{let e=qf();e.setFormat(t),e.setStyle(n),a.canInsertTextAfter()?r.insertAfter(e):a.insertAfter(e),e.select(0,0)}this.insertText(e);return}let s=qf(e);s.setFormat(t),s.setStyle(n),r.replace(s),s.select();return}if(e===``)return;let s=a.isInline()&&i===0&&!r.__prev,c=a.isInline()&&i===o&&!r.__next,l=r.getFormat()!==t||r.getStyle()!==n;if(s||c||l){if(r.getTextContent()!==``||s||c)return void rp(this,e,t,n);r.setFormat(t),r.setStyle(n)}r.spliceText(i,0,e,!0),r.isComposing()&&this.anchor.type===`text`&&this.anchor.set(this.anchor.key,this.anchor.offset-e.length,this.anchor.type)}removeText(){let e=U()===this;fv(this,_v(pv(this))),e&&U()!==this&&Oh(this)}formatText(e,t=null){lp(this,e,t)}insertNodes(e){if(e.length===0)return;this.isCollapsed()||this.removeText();let t=this.anchor.getNode();if(this.anchor.type===`element`&&G(t)&&f_(t)!==null){let n=t.isShadowRoot()?t.getFirstChild()??t.append(Vm()).getFirstChild():t.getFirstChild();if(t.isShadowRoot()&&n!==null&&!G(n)){let e=Vm();n.insertBefore(e),n=e}if(n!==null){n.selectStart();let t=U();return H(t)||L(369),t.insertNodes(e)}}if(this.anchor.type===`element`&&og(t)){let n=Wp(e),r=n.getLastDescendant();t.splice(this.anchor.offset,0,n.getChildren()),r!==null&&r.selectEnd();return}let n=(this.isBackward()?this.focus:this.anchor).getNode(),r=o_(n,Ig),i=e[e.length-1];if(G(r)&&`__language`in r){if(`__language`in e[0])this.insertText(e[0].getTextContent());else{let t=Vp(this);r.splice(t,0,e),i.selectEnd()}return}if(!e.some(e=>(G(e)||K(e))&&!e.isInline())){G(r)||L(211,n.constructor.name,n.getType());let t=Vp(this);r.splice(t,0,e),i.selectEnd();return}if(G(r)&&f_(r)!==null){let t=Vp(this),n=Bp(e);r.splice(t,0,n);let i=n[n.length-1];i===void 0?r.select(t,t):i.selectEnd();return}if(r===null){let t=Wp(e),n=t.getLastDescendant(),r=lv(this.anchor,`next`);for(let e of t.getChildren())r=Ev(e,r);n!==null&&n.selectEnd();return}if(G(r)&&!r.isParentRequired()&&!og(r.getParentOrThrow())){let t=Vp(this),n=Bp(e);r.splice(t,0,n);let i=n[n.length-1];i===void 0?r.select(t,t):i.selectEnd();return}let a=Wp(e),o=a.getLastDescendant(),s=a.getChildren(),c=!G(r)||!r.isEmpty()?this.insertParagraph():null;c&&!r.isAttached()&&(n=this.anchor.getNode(),r=o_(n,Ig));let l=s[s.length-1],u=s[0];var d;G(d=u)&&Ig(d)&&!d.isEmpty()&&G(r)&&(!r.isEmpty()||r.canMergeWhenEmpty())&&(G(r)||L(211,n.constructor.name,n.getType()),r.append(...u.getChildren()),u=s[1]),u&&(r===null&&L(212,n.constructor.name,n.getType()),function(e,t){let n=t.getParentOrThrow().getLastChild(),r=t,i=[t];for(;r!==n;)r.getNextSibling()||L(140),r=r.getNextSibling(),i.push(r);let a=e;for(let e of i)a=a.insertAfter(e)}(r,u));let f=o_(o,Ig);c&&G(f)&&(c.canMergeWhenEmpty()||Ig(l))&&(f.append(...c.getChildren()),c.remove()),G(r)&&r.isEmpty()&&r.remove(),o.selectEnd();let p=G(r)?r.getLastChild():null;Fm(p)&&f!==r&&p.remove()}insertParagraph(){let e=this.anchor.getNode();if(this.anchor.type===`element`&&og(e)){let t=Vm();return e.splice(this.anchor.offset,0,[t]),t.select(),t}let t=Vp(this),n=o_(this.anchor.getNode(),Ig);if(n!==null&&f_(n)!==null)return null;G(n)||L(213);let r=n.getChildAtIndex(t),i=r?[r,...r.getNextSiblings()]:[],a=n.insertNewAfter(this,!1);return a?(a.append(...i),a.selectStart(),a):null}insertLineBreak(e){let t=Pm();if(this.insertNodes([t]),e){let e=t.getParentOrThrow(),n=t.getIndexWithinParent();e.select(n,n)}}extract(){let e=[...this.getNodes()],t=e.length,n=e[0],r=e[t-1],[i,a]=dp(this),o=this.isBackward(),[s,c]=o?[this.focus,this.anchor]:[this.anchor,this.focus],[l,u]=o?[a,i]:[i,a];if(t===0)return[];if(t===1){if(V(n)&&!this.isCollapsed()){let e=n.splitText(l,u),t=l===0?e[0]:e[1];return t?(s.set(t.getKey(),0,`text`),c.set(t.getKey(),t.getTextContentSize(),`text`),[t]):[]}return[n]}if(V(n)&&(l===n.getTextContentSize()?e.shift():l!==0&&([,n]=n.splitText(l),e[0]=n,s.set(n.getKey(),0,`text`))),V(r)){let t=r.getTextContent().length;u===0?e.pop():u!==t&&([r]=r.splitText(u),e[e.length-1]=r,c.set(r.getKey(),r.getTextContentSize(),`text`))}return e}modify(e,t,n){if(Gp(this,e,t,n))return;let r=e===`move`,i=W(),a=pg(ng(i));if(!a)return;let o=i._blockCursorElement,s=i._rootElement,c=this.focus.getNode();s===null||o===null||!G(c)||c.isInline()||c.canBeEmpty()||fg(o,i,s);let l=Yh(i,this.focus.key),u=l;if(this.focus.type===`text`&&(u=V(c)?Vg(c,l,i):null),this.dirty){let e=Yh(i,this.anchor.key),t=e;if(this.anchor.type===`text`){let n=this.anchor.getNode();t=V(n)?Vg(n,e,i):null}t&&u&&Fp(a,t,this.anchor.offset,u,this.focus.offset)}if(n===`character`&&V(c)&&c.isUnmergeable()&&(t?this.focus.offset===0:this.focus.offset===c.getTextContentSize())){let e=G_(c,t?`previous`:`next`).getNodeAtCaret();if(V(e)){if(!r){let n=e.getTextContentSize();t?this.focus.set(e.__key,n-1,`text`):this.focus.set(e.__key,1,`text`),this.dirty=!0;return}{let n=i.getElementByKey(e.getKey()),r=n?Vg(e,n,i):null;if(r){let e=t?r.length:0;Fp(a,r,e,r,e)}}}}if(mp(a,e,t?`backward`:`forward`,n),a.rangeCount>0){let e=xg(a,i._rootElement),n=e||a.getRangeAt(0),o=this.anchor.getNode(),s=Tm(o)?o:ig(o);this.applyDOMRange(n),this.dirty=!0,!r&&(hp(this,t,s),(e?a.direction!==`backward`:a.anchorNode===n.startContainer&&a.anchorOffset===n.startOffset)||pp(this))}n===`lineboundary`&&Gp(this,e,t,n,`decorators`)}forwardDeletion(e,t,n){if(!n&&(e.type===`element`&&G(t)&&e.offset===t.getChildrenSize()||e.type===`text`&&e.offset===t.getTextContentSize())){let e=t.getParent(),n=t.getNextSibling()||(e===null?null:e.getNextSibling());if(G(n)&&n.isShadowRoot())return!0}return!1}deleteCharacter(e){let t=this.isCollapsed();if(this.isCollapsed()){let t=this.anchor,n=t.getNode();if(this.forwardDeletion(t,n,e))return;let r=ev(lv(t,e?`previous`:`next`));if(r.getTextSlices().every(e=>e===null||e.distance===0)){let e={type:`initial`};for(let t of r.iterNodeCarets(`shadowRoot`))if(V_(t)){if(!t.origin.isInline()){if(t.origin.isShadowRoot()){if(e.type===`merge-block`)break;if(G(r.anchor.origin)&&r.anchor.origin.isEmpty()){let e=vv(t);fv(this,nv(e,e)),r.anchor.origin.remove()}return}e.type!==`merge-next-block`&&e.type!==`merge-block`||(e={block:e.block,caret:t,type:`merge-block`})}}else{if(e.type===`merge-block`)break;if(B_(t)){if(G(t.origin)){if(t.origin.isInline()){if(!t.origin.isParentOf(r.anchor.origin))break}else e={block:t.origin,type:`merge-next-block`};continue}if(K(t.origin)){if(!t.origin.isIsolated()){if(__(t.origin).length>0){if(G(r.anchor.origin)&&r.anchor.origin.isEmpty()){r.anchor.origin.remove();let e=Op();e.add(t.origin.getKey()),Oh(e)}}else if(e.type===`merge-next-block`&&(t.origin.isKeyboardSelectable()||!t.origin.isInline())&&G(r.anchor.origin)&&r.anchor.origin.isEmpty()){r.anchor.origin.remove();let e=Op();e.add(t.origin.getKey()),Oh(e)}else t.origin.remove()}return}break}}if(e.type===`merge-block`){let{caret:t,block:n}=e;return __(n).length>0?void 0:t.origin.isEmpty()&&!n.isEmpty()&&t.origin.getParent()===n.getParent()?void t.origin.remove(!0):(fv(this,nv(!t.origin.isEmpty()&&n.isEmpty()?mv(G_(n,t.direction)):r.anchor,t)),this.removeText())}for(let e=t.getNode();e!==null;){if(f_(e)!==null)return;if(G(e)&&e.isShadowRoot())break;e=e.getParent()}}let i=this.focus;if(gp(this,e,`character`),this.isCollapsed()){if(e&&t.offset===0&&fp(this,t.getNode()))return}else{let r=i.type===`text`?i.getNode():null;if(n=t.type===`text`?t.getNode():null,r!==null&&r.isSegmented()){let t=i.offset,a=r.getTextContentSize();if(r.is(n)||e&&t!==a||!e&&t!==0)return void vp(r,e,t)}else if(n!==null&&n.isSegmented()){let i=t.offset,a=n.getTextContentSize();if(n.is(r)||e&&i!==0||!e&&i!==a)return void vp(n,e,i)}(function(e,t){let n=e.anchor,r=e.focus,i=n.getNode();if(i===r.getNode()&&n.type===`text`&&r.type===`text`){let e=n.offset,a=r.offset,o=e<a,s=o?e:a,c=o?a:e,l=c-1;s!==l&&(function(e){return!(jh(e)||_p(e))})(i.getTextContent().slice(s,c))&&(t?r.set(r.key,l,r.type):n.set(n.key,l,n.type))}})(this,e)}}if(this.removeText(),e&&!t&&this.isCollapsed()&&this.anchor.type===`element`&&this.anchor.offset===0){let e=this.anchor.getNode();e.isEmpty()&&Tm(e.getParent())&&e.getPreviousSibling()===null&&fp(this,e),ap()}}deleteLine(e){let t=xp(this.anchor);if(t!==null&&K(p_(t)))return this.isCollapsed()||this.focus.set(this.anchor.key,this.anchor.offset,this.anchor.type),void this.deleteCharacter(e);this.isCollapsed()&&gp(this,e,`lineboundary`),this.isCollapsed()?this.deleteCharacter(e):o_(this.anchor.getNode(),Ig)===o_(this.focus.getNode(),Ig)?this.removeText():(this.focus.set(this.anchor.key,this.anchor.offset,this.anchor.type),this.deleteCharacter(e))}deleteWord(e){if(this.isCollapsed()){let t=this.anchor,n=t.getNode();if(this.forwardDeletion(t,n,e))return;gp(this,e,`word`)}this.isCollapsed()?this.deleteCharacter(e):this.removeText()}isBackward(){let e=this._cachedIsBackward;if(e!==null)return e;let t=this.focus.isBefore(this.anchor);return em()||(this._cachedIsBackward=t),t}getStartEndPoints(){return[this.anchor,this.focus]}};function sp(e){return e instanceof ip}function cp(e,t){if(sp(e)){for(let n of e.getNodes())Lf(n)&&n.setFormat(t(n.getFormat()));return}if(e.isCollapsed())return e.setFormat(t(e.format)),void vh(null);let n=[];for(let r of e.getNodes())V(r)?n.push(r):G(r)?r.setTextFormat(t(r.getTextFormat())):Lf(r)&&r.setFormat(t(r.getFormat()));let r=n.length;if(r===0)return e.setFormat(t(e.format)),void vh(null);let i=e.anchor,a=e.focus,o=e.isBackward(),s=o?a:i,c=o?i:a,l=0,u=n[0],d=s.type===`element`?0:s.offset;if(s.type===`text`&&d===u.getTextContentSize()&&(l=1,u=n[1],d=0),u==null)return;let f=r-1,p=n[f],m=c.type===`text`?c.offset:p.getTextContentSize();if(u.is(p)){if(d===m)return;let n=t(u.getFormat());if(uh(u)||d===0&&m===u.getTextContentSize())u.setFormat(n);else{let e=u.splitText(d,m),t=d===0?e[0]:e[1];t.setFormat(n),s.type===`text`&&s.set(t.__key,0,`text`),c.type===`text`&&c.set(t.__key,m-d,`text`)}e.format=n;return}d===0||uh(u)||([,u]=u.splitText(d),d=0);let h=t(u.getFormat());u.setFormat(h);let g=t(p.getFormat());m>0&&(m===p.getTextContentSize()||uh(p)||([p]=p.splitText(m)),p.setFormat(g));for(let e=l+1;e<f;e++){let r=n[e];r.setFormat(t(r.getFormat()))}s.type===`text`&&s.set(u.__key,d,`text`),c.type===`text`&&c.set(p.__key,m,`text`),e.format=h|g}function lp(e,t,n=null){let r=n===null&&H(e)?mh(e.format,t,null):n;cp(e,e=>mh(e,t,r))}function up(e){let t=e.offset;if(e.type===`text`)return t;let n=e.getNode();return t===n.getChildrenSize()?n.getTextContent().length:0}function dp(e){let t=e.getStartEndPoints();if(t===null)return[0,0];let[n,r]=t;return n.type===`element`&&r.type===`element`&&n.key===r.key&&n.offset===r.offset?[0,0]:[up(n),up(r)]}function fp(e,t){for(let n=t;n;n=n.getParent()){if(G(n)){if(n.collapseAtStart(e))return!0;if(og(n))break}if(n.getPreviousSibling())break}return!1}function pp(e){let t=e.focus,n=e.anchor,r=n.key,i=n.offset,a=n.type;n.set(t.key,t.offset,t.type,!0),t.set(r,i,a,!0)}function mp(e,t,n,r){e.modify(t,n,r)}function hp(e,t,n){let r=e.getNodes(),i=r.filter(e=>eg(e,n));if(i.length===0||i.length===r.length)return!1;let a=t?i[0]:i[i.length-1],o=G(a)?a:a.getParentOrThrow();return t?o.selectStart():o.selectEnd(),!0}function gp(e,t,n){if(Gp(e,`extend`,t,n))return;let r=W(),i=pg(ng(r));if(!i||typeof i.modify!=`function`)return;let a=r._blockCursorElement,o=r._rootElement,s=e.anchor,c=e.focus.getNode();o===null||a===null||!G(c)||c.isInline()||c.canBeEmpty()||fg(a,r,o);let l=e=>{let t=e.getNode(),n=r.getElementByKey(e.key);return n!==null&&e.type===`text`&&V(t)?Vg(t,n,r):n},u=s.getNode(),d=l(s);if(d===null)return;let f=s.offset,p=e.isCollapsed(),m=e.focus,h=p?d:l(m);if(h===null)return;let g=m.offset;if(Fp(i,h,g,h,g),mp(i,`move`,t?`backward`:`forward`,n),i.rangeCount===0)return;let _=xg(i,o)||i.getRangeAt(0),v=_.startContainer,y=_.startOffset;if(p&&n===`character`&&s.type===`text`&&V(u)&&u.isUnmergeable()&&f===(t?0:u.getTextContentSize())){let n=G_(u,t?`previous`:`next`).getNodeAtCaret();if(V(n)){let r=t?n.getTextContentSize()-1:1;e.focus.set(n.__key,r,`text`),e.dirty=!0;return}}if(p&&n===`character`&&s.type===`text`){let n=t?0:u.getTextContentSize(),r=v===d?y:f===n?-1:n;if(r>=0)return void(r!==f&&(e.focus.set(s.key,r,`text`),e.dirty=!0))}let[ee,b,te,x]=t?[v,y,d,f]:[d,f,v,y],ne=Tm(u)?u:ig(u);e.applyDOMRange({collapsed:!1,endContainer:te,endOffset:x,startContainer:ee,startOffset:b}),e.dirty=!0,!hp(e,t,ne)&&t&&pp(e),n===`lineboundary`&&Gp(e,`extend`,t,n,`decorators`)}let _p=(()=>{try{let e=RegExp(`\\p{Emoji}`,`u`),t=e.test.bind(e);if(t(`❤️`)&&t(`#️⃣`)&&t(`👍`))return t}catch{}return()=>!1})();function vp(e,t,n){let r=e,i=r.getTextContent().split(/(?=\s)/g),a=i.length,o=0,s=0;for(let e=0;e<a;e++){let r=e===a-1;if(s=o,o+=i[e].length,t&&o===n||o>n||r){i.splice(e,1),r&&(s=void 0);break}}let c=i.join(``).trim();c===``?r.remove():(r.setTextContent(c),r.select(s,s))}function yp(e,t,n,r){let i,a=t,o=!1;if(Y(e)){let s=!1,c=e.childNodes,l=c.length,u=r._blockCursorElement;a===l&&l>0&&(s=!0,a=l-1),Ch(e,r)!==void 0||$g(e,r)||(o=!0);let d=c[a],f=!1;if(d===u)d=c[a+1],f=!0;else if(u!==null){let n=u.parentNode;e===n&&t>Array.prototype.indexOf.call(n.children,u)&&a--}if(i=Ah(d),V(i))a=q_(i,s?`next`:`previous`);else{let c=Ah(e);if(c===null)return null;if(G(c)){let o=r.getElementByKey(c.getKey());o===null&&L(214);let l=zg(c,o,r);[c,a]=l.resolveChildIndex(c,o,e,t),G(c)||L(215),s&&a>=c.getChildrenSize()&&(a=Math.max(0,c.getChildrenSize()-1));let u=c.getChildAtIndex(a);if(G(u)&&function(e,t,n){let r=e.getParent();return n===null||r===null||!r.canBeEmpty()||r!==n.getNode()}(u,0,n)){let e=s?u.getLastDescendant():u.getFirstDescendant();e===null?c=u:(u=e,c=G(u)?u:u.getParentOrThrow()),a=0}V(u)?(i=u,c=null,a=q_(u,s?`next`:`previous`)):u!==c&&s&&!f&&(G(c)||L(216),a=Math.min(c.getChildrenSize(),a+1))}else{let n=p_(c),i=n===null?c:n,o=i.getIndexWithinParent(),s=r.getElementByKey(c.getKey()),l=`after`;if(s!==null&&Ah(e)===c){let n=zg(c,s,r);n.element===s?t===0&&K(c)&&(l=`before`):l=n.resolveLeafPosition(s,e,t)}a=l===`before`?o:o+1,c=i.getParentOrThrow()}if(G(c))return[$f(c.__key,a,`element`),o]}}else i=Ah(e);return V(i)?[$f(i.__key,q_(i,a,`clamp`),`text`),o]:null}function bp(e,t,n){let r=e.offset,i=e.getNode();if(r===0){let r=i.getPreviousSibling(),a=i.getParent();if(t){if((n||!t)&&r===null&&G(a)&&a.isInline()){let t=a.getPreviousSibling();V(t)&&e.set(t.__key,t.getTextContent().length,`text`)}}else G(r)&&!n&&r.isInline()?e.set(r.__key,r.getChildrenSize(),`element`):V(r)&&!i.isUnmergeable()&&e.set(r.__key,r.getTextContent().length,`text`)}else if(r===i.getTextContent().length){let r=i.getNextSibling(),a=i.getParent();if(t&&G(r)&&r.isInline())e.set(r.__key,0,`element`);else if((n||t)&&r===null&&G(a)&&a.isInline()&&!a.canInsertTextAfter()&&a.getTextContentSize()>1){let t=a.getNextSibling();V(t)&&e.set(t.__key,0,`text`)}}}function xp(e){let t=bh(e.key);return t===null?null:h_(t)}function Sp(e,t,n){let r=xp(e),i=xp(t);if(r===i||r!==null&&i!==null&&r.is(i))return!1;let a=n(r,i);if(r!==null)return G(r)?t.set(r.getKey(),a?r.getChildrenSize():0,`element`):t.set(r.getKey(),a?r.getTextContentSize():0,`text`),!0;let o=p_(i);if(o===null)return!1;let s=o.getParent();if(s===null)return!1;let c=o.getIndexWithinParent();return t.set(s.getKey(),a?c+1:c,`element`),!0}function Cp(e){let t=Sp(e.anchor,e.focus,(t,n)=>function(e,t,n,r){if(n!==null&&r!==null){let e=p_(n),t=p_(r);if(e!==null&&e.is(t)){for(let t of g_(e).values()){if(t===n.getKey())return!0;if(t===r.getKey())return!1}return!0}return e===null||t===null||e.isBefore(t)}if(n!==null){let e=p_(n),r=bh(t.key);return e===null||r===null||!(!e.is(r)&&!e.isParentOf(r))||e.isBefore(r)}let i=p_(r),a=bh(e.key);return i!==null&&a!==null&&!i.is(a)&&!i.isParentOf(a)&&a.isBefore(i)}(e.anchor,e.focus,t,n));return t&&(e.dirty=!0),t}function wp(e,t,n,r,i,a){if(e===null||n===null||!ah(i,e,n))return null;let o=yp(e,t,H(a)?a.anchor:null,i);if(o===null)return null;let s=yp(n,r,H(a)?a.focus:null,i);if(s===null)return null;let[c,l]=o,[u,d]=s;if(c.type===`element`&&u.type===`element`){let t=Ah(e),r=Ah(n);if(K(t)&&K(r))return null}let f=i._slotsUsed&&Sp(c,u,()=>(e.compareDocumentPosition(n)&Node.DOCUMENT_POSITION_FOLLOWING)!==0);return function(e,t){if(e.type===`text`&&t.type===`text`){let n=e.isBefore(t),r=e.is(t);bp(e,n,r),bp(t,!n,r),r&&t.set(e.key,e.offset,e.type)}}(c,u),[c,u,l||d||f]}function Tp(e){return G(e)&&!e.isInline()}function Ep(e,t,n,r,i,a){let o=rm(),s=new op($f(e,t,i),$f(n,r,a),0,``);return s.dirty=!0,o._selection=s,s}function Dp(){return new op($f(`root`,0,`element`),$f(`root`,0,`element`),0,``)}function Op(){return new ip(/* @__PURE__ */ new Set)}function kp(e,t,n,r){let i=n._window;if(i===null)return null;let a=r||i.event,o=a?a.type:void 0,s=o===`selectionchange`,c=!jl&&(s||o===`beforeinput`||o===`compositionstart`||o===`compositionend`||o===`click`&&a&&a.detail===3||o===`drop`||o===void 0),l,u,d,f;if(H(e)&&!c)return e.clone();{if(t===null)return null;let r=Cg(t,n._rootElement);if(l=r.anchorNode,u=r.focusNode,d=r.anchorOffset,f=r.focusOffset,(s||o===void 0)&&H(e)&&!ah(n,l,u))return e.clone()}let p=wp(l,d,u,f,n,e);if(p===null)return null;let[m,h,g]=p,_=0,v=``;if(H(e)){let t=e.anchor;if(m.key===t.key)_=e.format,v=e.style;else{let e=m.getNode();V(e)?(_=e.getFormat(),v=e.getStyle()):G(e)&&(_=e.getTextFormat(),v=e.getTextStyle())}}let y=new op(m,h,_,v);return g&&(y.dirty=!0),y}function U(){return rm()._selection}function Ap(){return W()._editorState._selection}function jp(e,t,n,r=1){let i=e.anchor,a=e.focus,o=i.getNode(),s=a.getNode();if(!t.is(o)&&!t.is(s))return;let c=t.__key;if(e.isCollapsed()){let t=i.offset;if(n<=t&&r>0||n<t&&r<0){let n=Math.max(0,t+r);i.set(c,n,`element`),a.set(c,n,`element`),Mp(e)}}else{let o=e.isBackward(),s=o?a:i,l=s.getNode(),u=o?i:a,d=u.getNode();if(t.is(l)){let e=s.offset;(n<=e&&r>0||n<e&&r<0)&&s.set(c,Math.max(0,e+r),`element`)}if(t.is(d)){let e=u.offset;(n<=e&&r>0||n<e&&r<0)&&u.set(c,Math.max(0,e+r),`element`)}}Mp(e)}function Mp(e){let t=e.anchor,n=t.offset,r=e.focus,i=r.offset,a=t.getNode(),o=r.getNode();if(e.isCollapsed()){if(!G(a))return;let e=a.getChildrenSize(),i=n>=e,o=i?a.getChildAtIndex(e-1):a.getChildAtIndex(n);if(V(o)){let e=0;i&&(e=o.getTextContentSize()),t.set(o.__key,e,`text`),r.set(o.__key,e,`text`)}}else{if(G(a)){let e=a.getChildrenSize(),r=n>=e,i=r?a.getChildAtIndex(e-1):a.getChildAtIndex(n);if(V(i)){let e=0;r&&(e=i.getTextContentSize()),t.set(i.__key,e,`text`)}}if(G(o)){let e=o.getChildrenSize(),t=i>=e,n=t?o.getChildAtIndex(e-1):o.getChildAtIndex(i);if(V(n)){let e=0;t&&(e=n.getTextContentSize()),r.set(n.__key,e,`text`)}}}}function Np(e,t,n,r,i){let a=null,o=0,s=null;r===null?i!==null&&(a=i.__key,V(i)?s=`text`:G(i)&&(s=`element`)):(a=r.__key,V(r)?(o=r.getTextContentSize(),s=`text`):G(r)&&(o=r.getChildrenSize(),s=`element`)),a!==null&&s!==null?e.set(a,o,s):(o=t.getIndexWithinParent(),o===-1&&(o=n.getChildrenSize()),e.set(n.__key,o,`element`))}function Pp(e,t,n,r,i){e.type===`text`?e.set(n,e.offset+(t?0:i),`text`):e.offset>r.getIndexWithinParent()&&e.set(e.key,e.offset-1,`element`)}function Fp(e,t,n,r,i){try{e.setBaseAndExtent(t,n,r,i)}catch{}}function Ip(e,t,n){let r=Yh(e,t.getKey());if(G(t)){let i=zg(t,r,e);return[i.element,n+i.getFirstChildOffset()]}return[r,n]}function Lp(e,t,n,r,i,a){let o=a.getRootNode(),s=fh(o)||hg(o)?Og(o):null;if(i.has(`collaboration`)&&s!==a||s!==null&&ih(s,s))return;let c=Cg(r,a),l;if(!H(t))return void(e!==null&&ah(n,c.anchorNode,c.focusNode)&&r.removeAllRanges());let u=t.anchor,d=t.focus,f=u.getNode(),p=d.getNode(),[m,h]=Ip(n,f,u.offset),[g,_]=Ip(n,p,d.offset),v=t.format,y=t.style,ee=t.isCollapsed(),b=m,te=g,x=!1;if(u.type===`text`?(b=V(f)?Vg(f,m,n):null,x=f.getFormat()!==v||f.getStyle()!==y):H(e)&&e.anchor.type===`text`&&(x=!0),d.type===`text`&&(te=V(p)?Vg(p,g,n):null),b!==null&&te!==null){if(ee&&(e===null||x||H(e)&&(e.format!==v||e.style!==y))&&function(e,t,n,r,i,a){e._inputState.collapsedSelectionFormat={format:t,key:i,offset:r,style:n,timeStamp:a}}(n,v,y,h,u.key,performance.now()),(r.type!==`Range`||!ee)&&c.anchorOffset===h&&c.focusOffset===_&&c.anchorNode===b&&c.focusNode===te){if(s===null||!a.contains(s)){let e=s===null?null:sh(s);e!==null&&e!==n||i.has(`skip-selection-focus`)||a.focus({preventScroll:!0})}if(u.type!==`element`)return}if(Fp(r,b,h,te,_),el&&t.isCollapsed()&&a!==null&&!i.has(`skip-selection-focus`)){let e=Dg(a);if(e===null||!a.contains(e)){let e=Og(a.ownerDocument),t=e===null?null:sh(e);t!==null&&t!==n||a.focus({preventScroll:!0})}}if(!i.has(`skip-scroll-into-view`)&&t.isCollapsed()&&a!==null&&a===Dg(a)){let e=H(t)&&t.anchor.type===`element`?b.childNodes[h]||null:(l===void 0&&(l=Sg(r,a)),l);if(e!==null){let t;if(dh(e)){let n=e.ownerDocument.createRange();n.selectNode(e),t=n.getBoundingClientRect()}else t=e.getBoundingClientRect();(function(e,t,n){let r=Zh(n),i=tg(r);if(r===null||i===null)return;let a=n.getBoundingClientRect();if(t.bottom<a.top)return;let{top:o,bottom:s}=t,c=0,l=0,u=n;for(;u!==null;){let t=u===r.body;if(t){let t=i.visualViewport;if(t){let e=t.pageTop-i.scrollY;c=e,l=e+t.height}else c=0,l=ng(e).innerHeight;let n=i.getComputedStyle(r.documentElement),a=parseFloat(n.scrollPaddingTop),o=parseFloat(n.scrollPaddingBottom);isFinite(a)&&(c+=a),isFinite(o)&&(l-=o)}else{let e=u===n?a:u.getBoundingClientRect();c=e.top,l=e.bottom}let d=0;if(o<c?d=-(c-o):s>l&&(d=s-l),d!==0){if(t)i.scrollBy(0,d);else{let e=u.scrollTop;u.scrollTop+=d;let t=u.scrollTop-e;o-=t,s-=t}}if(t)break;u=Xh(u)}})(n,t,a)}}(function(e){e._inputState.isSelectionChangeFromDOMUpdate=!0})(n)}}function Rp(e,t){for(let n of e.split(/(\r?\n|\t)/))n===`
|
|
150
150
|
`||n===`\r
|
|
151
151
|
`?t.linebreak():n===` `?t.tab():n!==``&&t.text(n)}function zp(e){let t=[];return Rp(e,{linebreak:()=>t.push(Pm()),tab:()=>t.push(Xf()),text:e=>t.push(qf(e))}),t}function Bp(e){let t=[];for(let n of e)Fm(n)||(!G(n)&&!K(n)||n.isInline()?t.push(n):G(n)&&t.push(...Bp(n.getChildren())));return t}function Vp(e){let t=e;e.isCollapsed()||t.removeText();let n=U();H(n)&&(t=n),H(t)||L(161);let r=t.anchor,i=r.getNode(),a=r.offset;for(;!Ig(i)&&f_(i)===null;){let e=i;if([i,a]=Hp(i,a),e.is(i))break}return a}function Hp(e,t){let n=e.getParent();if(!n){let e=Vm();return Dh().append(e),e.select(),[Dh(),0]}if(V(e)){let r=e.splitText(t);if(r.length===0)return[n,e.getIndexWithinParent()];let i=t===0?0:1;return[n,r[0].getIndexWithinParent()+i]}if(!G(e)||t===0)return[n,e.getIndexWithinParent()];let r=e.getChildAtIndex(t);if(r){let n=new op($f(e.__key,t,`element`),$f(e.__key,t,`element`),0,``),i=e.insertNewAfter(n);i&&i.append(r,...r.getNextSiblings())}return[n,e.getIndexWithinParent()+1]}function Up(e){return Fm(e)||rg(e)||V(e)||e.isParentRequired()}function Wp(e){let t=Vm(),n=null;for(let r=0;r<e.length;r++){let i=e[r];if(Up(i)){if(n===null){n=i.createParentElementNode(),t.append(n);let a=e[r+1];if(Fm(i)&&(a===void 0||!Up(a)))continue}n.append(i)}else t.append(i),n=null}return t}function Gp(e,t,n,r,i=`decorators-and-blocks`){if(t===`move`&&r===`character`&&!e.isCollapsed()){let[t,r]=n===e.isBackward()?[e.focus,e.anchor]:[e.anchor,e.focus];return r.set(t.key,t.offset,t.type),!0}let a=lv(e.focus,n?`previous`:`next`),o=r===`lineboundary`,s=t===`move`,c=a,l=i===`decorators-and-blocks`;if(!yv(c)){for(let e of c){l=!1;let{origin:t}=e;if(!K(t)||t.isIsolated()||(c=e,!o||!t.isInline()))break}if(l)for(let e of ev(a).iterNodeCarets(t===`extend`?`shadowRoot`:`root`)){if(V_(e))e.origin.isInline()||(c=e);else{if(G(e.origin))continue;K(e.origin)&&!e.origin.isInline()&&(c=e)}break}}if(c===a)return!1;if(s&&!o&&K(c.origin)&&c.origin.isKeyboardSelectable()){let e=Op();return e.add(c.origin.getKey()),Oh(e),!0}return c=vv(c),s&&uv(e.anchor,c),uv(e.focus,c),l||!o}let Kp=null,qp=null,Jp=!1,Yp=!1,Xp=!1,Zp=/* @__PURE__ */ new Set,Qp=0,$p={characterData:!0,childList:!0,subtree:!0};function em(){return Jp||Kp!==null&&Kp._readOnly}function tm(){Jp&&L(13)}function nm(){Qp>99&&L(14)}function rm(){return Kp===null&&L(195,om()),Kp}function im(e){rm()!==null&&qp===null&&(qp=e),qp!==e&&Xc(378)}function W(){return qp===null&&L(337,om()),qp}function am(){W()._dirtyType=2}function om(){let e=0,t=/* @__PURE__ */ new Set,n=Xm.version;if(typeof window<`u`)for(let r of vg(document)){let i=ch(r);if(oh(i))e++;else if(i){let e=String(i.constructor.version||`<0.17.1`);e===n&&(e+=` (separately built, likely a bundler configuration issue)`),t.add(e)}}let r=` Detected on the page: ${e} compatible editor(s) with version ${n}`;return t.size&&(r+=` and incompatible editors with versions ${Array.from(t).join(`, `)}`),r}function sm(){return qp}function cm(e,t,n){let r=t.__type,i=th(e,r),a=n.get(r);a===void 0&&(a=Array.from(i.transforms),n.set(r,a));let o=a.length;for(let e=0;e<o&&(a[e](t),t.isAttached());e++);}function lm(e,t){return e!==void 0&&e.__key!==t&&e.isAttached()}function um(e,t){if(!t)return;let n=e._updateTags,r=t;Array.isArray(t)||(r=[t]);for(let e of r)n.add(e)}function dm(e,t){let n=e.type,r=t.get(n);r===void 0&&L(17,n);let i=r.klass;e.type!==i.getType()&&L(18,i.name);let a=i.importJSON(e),o=e.children;if(G(a)&&Array.isArray(o))for(let e=0;e<o.length;e++){let n=dm(o[e],t);a.append(n)}let s=e.$slots;if(s){u_(a)||L(379,i.name);for(let e in s)O_(a,e,dm(s[e],t))}return a}function fm(e,t,n){let r=Kp,i=Jp,a=qp;Kp=t,Jp=!0,qp=e;try{return n()}finally{Kp=r,Jp=i,qp=a}}function pm(e,t){let n=Xp;Xp=!0;try{(function(e,t){let n=e._pendingEditorState,r=e._rootElement,i=e._headless||r===null;if(n===null)return void(!e._updating&&e._deferred.length>0&&gm(e,e._deferred));let a=e._editorState,o=a._selection,s=n._selection,c=e._dirtyType!==0,l=Kp,u=Jp,d=qp,f=e._updating,p=e._observer,m=null;if(e._pendingEditorState=null,e._editorState=n,!i&&c&&p!==null){qp=e,Kp=n,Jp=!1,e._updating=!0;try{let t=e._dirtyType,r=e._dirtyElements,i=e._dirtyLeaves;p.disconnect(),m=Yu(a,n,e,t,r,i)}catch(t){if(t instanceof Error&&e._onError(t),Yp)throw t;Wm(e,null,r,n),Bl(e),e._dirtyType=2,Yp=!0,pm(e,a),Yp=!1;return}finally{p.observe(r,$p),e._updating=f,Kp=l,Jp=u,qp=d}}n._readOnly||=!0;let h=e._dirtyLeaves,g=e._dirtyElements,_=e._normalizedNodes,v=e._updateTags;c&&(e._dirtyType=0,e._cloneNotNeeded.clear(),e._dirtyLeaves=/* @__PURE__ */ new Set,e._dirtyElements=/* @__PURE__ */ new Map,e._normalizedNodes=/* @__PURE__ */ new Set),e._updateTags=/* @__PURE__ */ new Set,function(e,t){let n=e._decorators,r=e._pendingDecorators||n,i=t._nodeMap,a;for(a in r)i.has(a)||(r===n&&(r=Th(e)),delete r[a])}(e,n);let y=i?null:pg(ng(e));if(e._editable&&y!==null&&(c||s===null||s.dirty||!s.is(o))&&r!==null&&!v.has(`skip-dom-selection`)){qp=e,Kp=n;try{if(p!==null&&p.disconnect(),c||s===null||s.dirty){let t=e._blockCursorElement;t!==null&&fg(t,e,r),Lp(o,s,e,y,v,r)}(function(e,t,n){let r=e._blockCursorElement;if(H(n)&&n.isCollapsed()&&n.anchor.type===`element`&&t.contains(Dg(t))){let i=n.anchor,a=i.getNode(),o=i.offset,s=!1,c=null;if(o===a.getChildrenSize())dg(a.getChildAtIndex(o-1))&&(s=!0);else{let t=a.getChildAtIndex(o);if(t!==null&&dg(t)){let n=t.getPreviousSibling();(n===null||dg(n))&&(s=!0,c=e.getElementByKey(t.__key))}}if(s){let n=zg(a,e.getElementByKey(a.__key),e).element;r===null&&(e._blockCursorElement=r=function(e){let t=e.theme,n=bg().createElement(`div`);n.contentEditable=`false`,n.setAttribute(`data-lexical-cursor`,`true`);let r=t.blockCursor;return r!==void 0&&(typeof r==`string`&&(r=t.blockCursor=Av(r)),r!==void 0&&n.classList.add(...r)),n}(e._config)),t.style.caretColor=`transparent`,c===null?n.appendChild(r):n.insertBefore(r,c);return}}r!==null&&fg(r,e,t)})(e,r,s)}finally{p!==null&&p.observe(r,$p),qp=d,Kp=l}}m!==null&&function(e,t,n,r,i){let a=Array.from(e._listeners.mutation),o=a.length;for(let e=0;e<o;e++){let[o,s]=a[e];for(let e of s){let a=t.get(e);a!==void 0&&o(a,{dirtyLeaves:r,prevEditorState:i,updateTags:n})}}}(e,m,v,h,a),H(s)||s===null||o!==null&&o.is(s)||e.dispatchCommand(Zu);let ee=e._pendingDecorators;ee!==null&&(e._decorators=ee,e._pendingDecorators=null,mm(`decorator`,e,!0,ee)),function(e,t,n){let r=Eh(t),i=Eh(n);r!==i&&mm(`textcontent`,e,!0,i)}(e,t||a,n),mm(`update`,e,!0,{dirtyElements:g,dirtyLeaves:h,editorState:n,mutatedNodes:m,normalizedNodes:_,prevEditorState:t||a,tags:v}),!f&&gm(e,e._deferred),(function(e){let t=e._updates;if(t.length===0)return void(e._cascadeCount=0);if(function(e){Zp.has(e)||(Zp.add(e),setTimeout(()=>{Zp.delete(e),e._cascadeCount=0},0))}(e),e._cascadeCount++>99)return e._updates=[],e._cascadeCount=0,void e._onWarn(/* @__PURE__ */ Error(`One or more update listeners are endlessly enqueueing more updates. May have encountered infinite recursion caused by update listeners that trigger additional updates without a stop condition. Editor namespace: ${e._config.namespace}`));let n=t.shift();if(n){let[t,r]=n;vm(e,t,r)}})(e)})(e,t)}finally{Xp=n}}function mm(e,t,n,...r){let i=t._updating;t._updating=n;try{let n=t._listeners[e],i=Array.from(n);for(let[e,t]of i){t&&t();let i=e(...r);n.has(e)?n.set(e,i):i&&i()}}finally{t._updating=i}}function hm(e,t,n,r){let i=Mh(e),a;if(!Xp)for(let e=0;e<i.length;e++)i[e]._updating||(i[e]._cascadeCount=0);for(let e=4;e>=0;e--)for(let o=0;o<i.length;o++){let s=i[o];if(o>0&&s._updating){a=s;break}let c=s._commands.get(t);if(c!==void 0){let t=c[e];if(t.size>0){let e=!1;if(ym(s,()=>{for(let i of t)if(i(n,r))return void(e=!0)}),e)return e}}}return a&&a.update(()=>{hm(a,t,n,r)}),!1}function gm(e,t){if(e._deferred=[],t.length!==0){let n=e._updating;e._updating=!0;try{for(let e=0;e<t.length;e++)t[e]()}finally{e._updating=n}}}function _m(e,t){let n=e._updates,r=t||!1;for(;n.length!==0;){let t=n.shift();if(t){let[n,i]=t,a=e._pendingEditorState,o;i!==void 0&&(o=i.onUpdate,i.skipTransforms&&(r=!0),i.discrete&&(a===null&&L(191),a._flushSync=!0),o&&e._deferred.push(o),um(e,i.tag)),a==null?vm(e,n,i):n()}}return r}function vm(e,t,n){let r=e._updateTags,i,a=!1,o=!1;n!==void 0&&(i=n.onUpdate,um(e,n.tag),a=n.skipTransforms||!1,o=n.discrete||!1),i&&e._deferred.push(i);let s=e._editorState,c=e._pendingEditorState,l=!1;(c===null||c._readOnly)&&(c=e._pendingEditorState=Em(c||s),l=!0),c._flushSync=o;let u=Kp,d=Jp,f=qp,p=e._updating;Kp=c,Jp=!1,e._updating=!0,qp=e;let m=e._headless||e.getRootElement()===null;Qm(null);try{l&&(m?s._selection!==null&&(c._selection=s._selection.clone()):c._selection=function(e,t){let n=e.getEditorState()._selection,r=pg(ng(e));return H(n)||n==null?kp(n,r,e,t):n.clone()}(e,n&&n.event||null));let r=e._compositionKey;t(),a=_m(e,a),function(e,t){let n=t.getEditorState()._selection,r=e._selection;if(H(r)){let e=r.anchor,t=r.focus,i;if(e.type===`text`&&(i=e.getNode(),i.selectionTransform(n,r)),t.type===`text`){let e=t.getNode();i!==e&&e.selectionTransform(n,r)}}}(c,e),e._dirtyType!==0&&(a?function(e,t){let n=t._dirtyLeaves,r=e._nodeMap;for(let e of n){let t=r.get(e);V(t)&&t.isAttached()&&t.isSimpleText()&&!t.isUnmergeable()&&tu(t)}}(c,e):function(e,t){let n=t._dirtyLeaves,r=t._dirtyElements,i=e._nodeMap,a=yh(),o=/* @__PURE__ */ new Map,s=n,c=s.size,l=r,u=l.size;for(;c>0||u>0;){if(c>0){t._dirtyLeaves=/* @__PURE__ */ new Set;for(let e of s){let r=i.get(e);V(r)&&r.isAttached()&&r.isSimpleText()&&!r.isUnmergeable()&&tu(r),r!==void 0&&lm(r,a)&&cm(t,r,o),n.add(e)}if(s=t._dirtyLeaves,c=s.size,c>0){Qp++;continue}}t._dirtyLeaves=/* @__PURE__ */ new Set,t._dirtyElements=/* @__PURE__ */ new Map,l.delete(`root`)&&l.set(`root`,!0);for(let e of l){let n=e[0],s=e[1];if(r.set(n,s),!s)continue;let c=i.get(n);c!==void 0&&lm(c,a)&&cm(t,c,o)}s=t._dirtyLeaves,c=s.size,l=t._dirtyElements,u=l.size,Qp++}t._dirtyLeaves=n,t._dirtyElements=r}(c,e),_m(e),function(e,t,n,r){let i=e._nodeMap,a=t._nodeMap,o=[];for(let[e]of r){let t=a.get(e);t!==void 0&&(t.isAttached()||(G(t)&&Al(t,e,i,a,o,r),i.has(e)||r.delete(e),o.push(e)))}for(let e of n){let t=a.get(e);t===void 0||t.isAttached()||(u_(t)&&t.__slots!==null&&Al(t,e,i,a,o,n),i.has(e)||n.delete(e),o.push(e))}for(let e of o)a.delete(e);let s=W(),c=s._compositionKey;c===null||a.has(c)||(s._compositionKey=null)}(s,c,e._dirtyLeaves,e._dirtyElements)),r!==e._compositionKey&&(c._flushSync=!0);let i=c._selection;if(H(i)){e._slotsUsed&&Cp(i);let t=c._nodeMap,n=i.anchor.key,r=i.focus.key;t.get(n)!==void 0&&t.get(r)!==void 0||L(19)}else sp(i)&&i._nodes.size===0&&(c._selection=null)}catch(t){t instanceof Error&&e._onError(t),e._pendingEditorState=s,e._dirtyType=2,e._cloneNotNeeded.clear(),e._dirtyLeaves=/* @__PURE__ */ new Set,e._dirtyElements.clear(),pm(e);return}finally{Kp=u,Jp=d,qp=f,e._updating=p,Qp=0}e._dirtyType!==0||e._deferred.length>0||function(e,t){let n=t.getEditorState()._selection,r=e._selection;if(r!==null){if(r.dirty||!r.is(n))return!0}else if(n!==null)return!0;return!1}(c,e)?c._flushSync?(c._flushSync=!1,pm(e)):l&&rh(()=>{pm(e)}):(c._flushSync=!1,l&&(r.clear(),e._deferred=[],e._pendingEditorState=null))}function ym(e,t,n){qp===e&&n===void 0?em()?vm(e,t,n):t():vm(e,t,n)}function bm(e){if(og(e)){let t=null;for(let n of e.getChildren())t=n.isInline()?(t||n.replace(n.createParentElementNode())).append(n):null}}var xm=class extends Sf{__first;__last;__size;__format;__style;__indent;__dir;__textFormat;__textStyle;__slotHost;__slots;$config(){return this.config(Symbol.for(`ElementNode`),{$transform:bm,extends:Sf})}constructor(e){super(e),this.__first=null,this.__last=null,this.__size=0,this.__format=0,this.__style=``,this.__indent=0,this.__dir=null,this.__textFormat=0,this.__textStyle=``,this.__slotHost=null,this.__slots=null}afterCloneFrom(e){super.afterCloneFrom(e),this.__key===e.__key&&(this.__first=e.__first,this.__last=e.__last,this.__size=e.__size,this.__slotHost=e.__slotHost,this.__slotHost!==null&&this.__parent!==null&&L(384,this.__key,String(this.__slotHost),String(this.__parent)),this.__slots=e.__slots),this.__indent=e.__indent,this.__format=e.__format,this.__style=e.__style,this.__dir=e.__dir,this.__textFormat=e.__textFormat,this.__textStyle=e.__textStyle}getFormat(){return this.getLatest().__format}getFormatType(){let e=this.getFormat();return hl[e]||``}getStyle(){return this.getLatest().__style}getIndent(){return this.getLatest().__indent}getChildren(){let e=[],t=this.getFirstChild();for(;t!==null;)e.push(t),t=t.getNextSibling();return e}getChildrenKeys(){let e=[],t=this.getFirstChild();for(;t!==null;)e.push(t.__key),t=t.getNextSibling();return e}getChildrenSize(){return this.getLatest().__size}isEmpty(){return this.getChildrenSize()===0&&__(this).length===0}isDirty(){let e=W()._dirtyElements;return e!==null&&e.has(this.__key)}isLastChild(){let e=this.getLatest(),t=this.getParentOrThrow().getLastChild();return t!==null&&t.is(e)}getAllTextNodes(){let e=[];for(let t of __(this)){let n=v_(this,t);G(n)&&e.push(...n.getAllTextNodes())}let t=this.getFirstChild();for(;t!==null;){if(V(t)&&e.push(t),G(t)){let n=t.getAllTextNodes();e.push(...n)}t=t.getNextSibling()}return e}getFirstDescendant(){let e=this.getFirstChild();for(;G(e);){let t=e.getFirstChild();if(t===null)break;e=t}return e}getLastDescendant(){let e=this.getLastChild();for(;G(e);){let t=e.getLastChild();if(t===null)break;e=t}return e}getDescendantByIndex(e){let t=this.getChildren(),n=t.length;if(e>=n){let e=t[n-1];return G(e)&&e.getLastDescendant()||e||null}let r=t[e];return G(r)&&r.getFirstDescendant()||r||null}getFirstChild(){let e=this.getLatest().__first;return e===null?null:bh(e)}getFirstChildOrThrow(){let e=this.getFirstChild();return e===null&&L(45,this.__key),e}getLastChild(){let e=this.getLatest().__last;return e===null?null:bh(e)}getLastChildOrThrow(){let e=this.getLastChild();return e===null&&L(96,this.__key),e}getChildAtIndex(e){let t=this.getChildrenSize(),n,r;if(e<t/2){for(n=this.getFirstChild(),r=0;n!==null&&r<=e;){if(r===e)return n;n=n.getNextSibling(),r++}return null}for(n=this.getLastChild(),r=t-1;n!==null&&r>=e;){if(r===e)return n;n=n.getPreviousSibling(),r--}return null}getTextContent(){let e=T_(this),t=this.getChildren(),n=t.length;for(let r=0;r<n;r++){let i=t[r];e+=i.getTextContent(),G(i)&&r!==n-1&&!i.isInline()&&(e+=`
|
|
152
152
|
|
|
153
153
|
`)}return e}getTextContentSize(){let e=function(e){let t=0;for(let n of __(e)){let r=v_(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=ml[e];return(this.getFormat()&t)!==0}return!1}hasTextFormat(e){let t=fl[e];return(this.getTextFormat()&t)!==0}getFormatFlags(e,t){return mh(this.getLatest().__textFormat,e,t)}getTextStyle(){return this.getLatest().__textStyle}select(e,t){tm();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):Ep(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!==``&&ml[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){bf(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;gh(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--,gh(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;Sm(r,t,n)&&Np(r,r.getNode(),this,l,c),Sm(i,t,n)&&Np(i,i.getNode(),this,l,c),u!==0||this.canBeEmpty()||og(this)||this.remove()}}return i}getDOMSlot(e){return new Cl(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===``||og(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=zg(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 xm}function Sm(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 Cm=class extends Sf{__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 Cm}var wm=class extends xm{__cachedText;$config(){return this.config(`root`,{extends:xm})}constructor(){super(`root`),this.__cachedText=null}getTopLevelElementOrThrow(){L(51)}getTextContent(){let e=this.__cachedText;return e===null||!em()&&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 Dh().updateFromJSON(e)}collapseAtStart(){return!0}};function Tm(e){return e instanceof wm}function Em(e){return new Am(Ol(e._nodeMap),null,e._slotsUsed)}function Dm(){return new Am(/* @__PURE__ */ new Map([[`root`,new wm]]),null,!1)}function Om(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=Om(i[e]);r.push(t)}}let r=__(e);if(r.length>0){let i={};for(let t of r){let r=v_(e,t);r===null&&L(366,n.name,t),i[t]=Om(r)}t.$slots=i}return t}function km(e){return e instanceof Am}var Am=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 fm(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 fm(null,this,()=>({root:Om(Dh())}))}},jm=class extends xm{$config(){return this.config(`artificial`,{extends:xm})}createDOM(e){return bg().createElement(`div`)}},Mm=class extends Sf{$config(){return this.config(`linebreak`,{importDOM:{br:e=>Im(e)||Lm(e)?null:{conversion:Nm,priority:0}}})}getTextContent(){return`
|
|
154
154
|
`}createDOM(){return bg().createElement(`br`)}updateDOM(){return!1}isInline(){return!0}};function Nm(e){return{node:Pm()}}function Pm(){return cg(new Mm)}function Fm(e){return e instanceof Mm}function Im(e){let t=e.parentElement;if(t!==null&&Fg(t)){let n=t.firstChild;if(n===e||n.nextSibling===e&&Rm(n)){let n=t.lastChild;if(n===e||n.previousSibling===e&&Rm(n))return!0}}return!1}function Lm(e){let t=e.parentElement;if(t!==null&&Fg(t)){let n=t.firstChild;if(n===e||n.nextSibling===e&&Rm(n))return!1;let r=t.lastChild;if(r===e||r.previousSibling===e&&Rm(r))return!0}return!1}function Rm(e){return dh(e)&&/^( |\t|\r?\n)+$/.test(e.textContent||``)}var zm=class extends xm{$config(){return this.config(`paragraph`,{extends:xm,importDOM:{p:()=>({conversion:Bm,priority:0})}})}createDOM(e){let t=bg().createElement(`p`),n=Wh(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(bg().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=Vm();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 Bm(e){let t=Vm();if(Yg(t,e),qg(e,t),t.getFormatType()===``){let n=e.getAttribute(`align`);n&&n&&n in ml&&t.setFormat(n)}return Jg(t,e),{node:t}}function Vm(){return cg(new zm)}function Hm(e){return e instanceof zm}function Um(e){console.warn(e)}function Wm(e,t,n,r,i){let a=e._keyToDOMMap;a.clear(),e._editorState=Dm(),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),Sh(n,e,`root`))}function Gm(e){let t=/* @__PURE__ */ new Set,n=/* @__PURE__ */ new Set;for(let{klass:r,ownNodeConfig:i}of i_(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 Km={$createDOM:(e,t)=>e.createDOM(t._config,t),$decorateDOM:(e,t,n,r)=>{},$exportDOM:(e,t)=>{let n=nh(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 qm(e){let t=e||{},n=sm(),r=t.theme||{},i=e===void 0?n:t.parentEditor||null,a=t.disableEvents||!1,o=Dm(),s=t.namespace||(i===null?Nh():i._config.namespace),c=t.editorState,l=[wm,Rf,Mm,Yf,zm,jm,...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===Sf||n.prototype instanceof Sf)){let r=`<unknown>`;try{r=JSON.parse(El)}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))}r_(n);let a=n.getType(),o=Gm(n);m.set(a,{exportDOM:f&&f.export?f.export.get(n):void 0,klass:n,replace:r,replaceWithKlass:i,sharedNodeState:Ul(l[e]),transforms:o})}}let h=new Xm(o,i,m,{disableEvents:a,dom:{...Km,...e&&e.dom},namespace:s,theme:r},u||console.error,d||Um,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($u,af,0),e.registerCommand(ed,of,0),e.registerCommand(td,sf,0),e.registerCommand(nd,cf,0),e.registerCommand(md,df,0)}(h),h}function Jm(e,t){let n=e.get(t);e.delete(t),n&&n()}function Ym(e,t,n){return e.set(t,n),Jm.bind(null,e,t)}var Xm=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 kl,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=Nh(),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 Ym(this._listeners.update,e)}registerEditableListener(e){return Ym(this._listeners.editable,e)}registerDecoratorListener(e){return Ym(this._listeners.decorator,e)}registerTextContentListener(e){return Ym(this._listeners.textcontent,e)}registerRootListener(e){let t=this._listeners.root;return Mv(Ym(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 Dl,new Dl,new Dl,new Dl,new Dl]);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=Wg(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=Wg(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=bh(t);e&&e.markDirty()}},e._pendingEditorState===null?{tag:wf}: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=Wh(this._config.theme,`root`),r=this._pendingEditorState||this._editorState;if(this._rootElement=e,Wm(this,t,e,r,{preserveUpdateQueue:!0}),t!==null&&(this._config.disableEvents||_f(t),n!=null&&t.classList.remove(...n)),e!==null){let t=tg(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,Bl(this),this._updateTags.add(wf),pm(this),this._config.disableEvents||function(e,t){let n=e.ownerDocument;Gd.set(e,n);let r=Kd.get(n);r===void 0&&(r={editors:/* @__PURE__ */ new Set,hasShadowEditor:void 0},Kd.set(n,r)),r.editors.add(t),r.hasShadowEditor=void 0,e.__lexicalEditor=t;let i=ff(e);i.push(qd.register(n));for(let n=0;n<Wd.length;n++){let[r,a]=Wd[n],o=typeof a==`function`?e=>{gf(e)||(hf(e),(t.isEditable()||r===`click`)&&a(e,t))}:e=>{if(gf(e))return;hf(e);let n=t.isEditable();switch(r){case`cut`:return n&&J(t,Md,e);case`copy`:return J(t,jd,e);case`paste`:return n&&J(t,sd,e);case`dragstart`:return n&&J(t,Od,e);case`dragover`:return n&&J(t,kd,e);case`dragend`:return n&&J(t,Ad,e);case`focus`:return n&&J(t,Rd,e);case`blur`:return n&&J(t,zd,e);case`drop`:return n&&J(t,Dd,e)}};i.push(Hd(e,r,o))}}(e,this),n!=null&&e.classList.add(...n)}else this._window=null,this._updateTags.add(wf),pm(this);mm(`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=Em(e),n._selection=e._selection?e._selection.clone():null),zl(this);let r=this._pendingEditorState,i=t===void 0?null:t.tag;r===null||r.isEmpty()||(i!=null&&this._updateTags.add(i),pm(this)),this._pendingEditorState=n,this._dirtyType=2,this._dirtyElements.set(`root`,!1),this._compositionKey=null,this._slotsUsed=this._slotsUsed||e._slotsUsed,ym(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=Dm(),i=Kp,a=Jp,o=qp,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,Kp=r,Jp=!1,qp=t,Qm(null);try{let i=t._nodes;dm(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,Kp=i,Jp=a,qp=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`&&pm(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]):vm(e,t,n)})(this,e,t)}focus(e,t={}){let n=this._rootElement;n!==null&&(n.setAttribute(`autocapitalize`,`off`),ym(this,()=>{let r=U(),i=Dh();r===null?i.getChildrenSize()!==0&&(t.defaultSelection===`rootStart`?i.selectStart():i.selectEnd()):r.dirty||Oh(r.clone()),Qh(`focus`),$h(()=>{n.removeAttribute(`autocapitalize`),e&&e()})}),this._pendingEditorState===null&&n.removeAttribute(`autocapitalize`))}blur(){let e=this._rootElement;e!==null&&e.blur();let t=pg(this._window);t!==null&&t.removeAllRanges()}isEditable(){return this._editable}setEditable(e){this._editable!==e&&(this._editable=e,mm(`editable`,this,!0,e),this._slotsUsed&&this.update(()=>am()))}toJSON(){return{editorState:this._editorState.toJSON()}}};Xm.version=El;let Zm=null;function Qm(e){Zm=e}let $m=Symbol(`INTERNAL_SKIP_AFTER_CLONE_FROM`),eh=1;function th(e,t){let n=nh(e,t);return n===void 0&&L(30,t),n}function nh(e,t){return e._nodes.get(t)}let rh=typeof queueMicrotask==`function`?queueMicrotask:e=>{Promise.resolve().then(e)};function ih(e,t){let n=t===void 0?(()=>{let t=e.getRootNode();return fh(t)||hg(t)?Og(t):null})():t;if(!Y(n)||n.hasAttribute(`data-lexical-slot`))return!1;let r=wh(n),i=n.nodeName;return Cf(r)&&(i===`INPUT`||i===`TEXTAREA`||n.contentEditable===`true`&&ch(n)==null)}function ah(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 sh(t)===e&&e.read(`latest`,()=>!ih(t))}function oh(e){return e instanceof Xm}function sh(e){let t=e;for(;t!=null;){let e=ch(t);if(oh(e))return e;t=Xh(t)}return null}function ch(e){return e?e.__lexicalEditor:null}function lh(e){return Zf(e)||e.isToken()}function uh(e){return lh(e)||e.isSegmented()}function dh(e){return Ag(e)&&e.nodeType===3}function fh(e){return Ag(e)&&e.nodeType===9}function ph(e){let t=e;for(;t!=null;){if(dh(t))return t;t=t.firstChild}return null}function mh(e,t,n){let r=fl[t];if(n!==null&&(e&r)===(n&r))return e;let i=e^r;return t===`subscript`?i&=~fl.superscript:t===`superscript`?i&=~fl.subscript:t===`lowercase`?(i&=~fl.uppercase,i&=~fl.capitalize):t===`uppercase`?(i&=~fl.lowercase,i&=~fl.capitalize):t===`capitalize`&&(i&=~fl.lowercase,i&=~fl.uppercase),i}function hh(e,t){let n=function(){let e=Zm;return Zm=null,e}();if((t||=n&&n.__key)!=null)return void(e.__key=t);tm(),nm();let r=W(),i=rm(),a=``+eh++;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 gh(e){f_(e)!==null&&L(380,e.__key,String(f_(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 _h(e){nm(),bf(e)&&L(323,e.__key,e.__type);let t=e.getLatest(),n=t.__parent===null?d_(t)?t.__slotHost:null:t.__parent,r=rm(),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?d_(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 vh(e){tm();let t=W(),n=t._compositionKey;if(e!==n){if(t._compositionKey=e,n!==null){let e=bh(n);e!==null&&e.getWritable()}if(e!==null){let t=bh(e);t!==null&&t.getWritable()}}}function yh(){return em()?null:W()._compositionKey}function bh(e,t){let n=(t||rm())._nodeMap.get(e);return n===void 0?null:n}function xh(e,t){let n=Ch(e,W());return n===void 0?null:bh(n,t)}function Sh(e,t,n){e[`__lexicalKey_${t._key}`]=n}function Ch(e,t){return e[`__lexicalKey_${t._key}`]}function wh(e,t){let n=e;for(;n!=null;){let e=xh(n,t);if(e!==null)return e;n=Xh(n)}return null}function Th(e){let t=e._decorators,n=Object.assign({},t);return e._pendingDecorators=n,n}function Eh(e){return e.read(()=>Dh().getTextContent())}function Dh(){return rm()._nodeMap.get(`root`)}function Oh(e){tm();let t=rm();e!==null&&(e.dirty=!0,e.setCachedNodes(null),H(e)&&W()._slotsUsed&&Cp(e)),t._selection=e}function kh(){tm(),zl(W())}function Ah(e){let t=function(e,t){let n=e;for(;n!=null;){let e=Ch(n,t);if(e!==void 0)return e;n=Xh(n)}return null}(e,W());return t===null?null:bh(t)}function jh(e){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(e)}function Mh(e){let t=[];for(let n=e;n!==null;n=n._parentEditor)t.push(n);return t}function Nh(){return Math.random().toString(36).replace(/[^a-z]+/g,``).substring(0,5)}function Ph(e){return dh(e)?e.nodeValue:null}function Fh(e,t,n){let r=pg(ng(t));if(r===null)return;let i=Cg(r,t._rootElement),a=i.anchorNode,{anchorOffset:o,focusOffset:s}=i;if(a!==null){let t=Ph(a),r=wh(a);if(t!==null&&V(r)){if((t===cl||t===ll)&&n){let e=n.length;t=n,o=e,s=e}t!==null&&Ih(r,t,o,s,e)}}}function Ih(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(cl)&&(s=t.slice(0,-cl.length)),i)){let e=ll,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(vh(null),il||nl||sl)a.remove();else{let e=W();Lh(a,``,t),setTimeout(()=>{e.update(()=>{a.isAttached()&&a.getTextContent()===``&&a.remove()})},20)}return}let i=a.getParent(),c=Ap(),l=a.getTextContentSize(),u=yh(),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 Lh(a,s,t);if(t.setTextNodeRange(a,n,a,r),a.isSegmented()){let e=qf(a.getTextContent());a.replace(e),a=e}Lh(a,s,t)}}}function Lh(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=q_(e,a.offset,`clamp`),r=!0)}r&&(n._cachedNodes=null,n._cachedIsBackward=null)}}function Rh(e,t,n){let r=t[n]||!1;return r===`any`||r===e[n]}function zh(e,t){return Rh(e,t,`altKey`)&&Rh(e,t,`ctrlKey`)&&Rh(e,t,`shiftKey`)&&Rh(e,t,`metaKey`)}function q(e,t,n){if(!zh(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 Bh={ctrlKey:!$c,metaKey:$c},Vh={altKey:$c,ctrlKey:!$c};function Hh(e){return e.key===`Backspace`}function Uh(e){let t=Dh();if(H(e)){let t=e.anchor,n=e.focus,r=t.getNode();if(Tm(r))return t.set(r.getKey(),0,`element`),n.set(r.getKey(),r.getChildrenSize(),`element`),nu(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`),nu(e)),e;let o=a;return t.set(o.getKey(),0,`element`),n.set(o.getKey(),o.getChildrenSize(),`element`),nu(e),e}{let e=t.select(0,t.getChildrenSize());return Oh(nu(e)),e}}function Wh(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=Av(i);return n[t]=e,e}return i}function Gh(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 Kh(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 qh(e,t){let n=e.offset;if(e.type===`element`)return Kh(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?Kh(r.getParentOrThrow(),t,r.getIndexWithinParent()+ +!t):e}}return null}function Jh(e){let t=ng(e).event,n=t&&t.inputType;return n===`insertFromPaste`||n===`insertFromPasteAsQuotation`}function J(e,t,...n){return hm(e,t,n[0],e)}function Yh(e,t){let n=e._keyToDOMMap.get(t);return n===void 0&&L(75,t),n}function Xh(e){let t=e.assignedSlot||e.parentElement;if(t!==null)return t;let n=e.parentNode;return hg(n)?n.host:null}function Zh(e){return fh(e)?e:Y(e)?e.ownerDocument:null}function Qh(e){tm(),W()._updateTags.add(e)}function $h(e){tm(),W()._deferred.push(e)}function eg(e,t){let n=e.getParent();for(;n!==null;){if(n.is(t))return!0;n=n.getParent()}return!1}function tg(e){let t=Zh(e);return t?t.defaultView:null}function ng(e){let t=e._window;return t===null&&L(78),t}function rg(e){return G(e)&&e.isInline()||K(e)&&e.isInline()}function ig(e){let t=e.getLatest();for(;t!==null;){if(f_(t)!==null&&G(t))return t;let e=t.getParentOrThrow();if(og(e))return e;t=e}return t}function ag(e){return G(e)&&e.isShadowRoot()}function og(e){return Tm(e)||ag(e)}function sg(e,t=!1){let n=e.constructor.clone(e,$m);return hh(n,null),n.afterCloneFrom(e),t||n.resetOnCopyNodeFrom(e),n}function cg(e){let t=W(),n=e.getType(),r=nh(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 lg(e,t){!Tm(e.getParent())||G(t)||K(t)||L(99)}function ug(e){let t=bh(e);return t===null&&L(63,e),t}function dg(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 fg(e,t,n){n.style.removeProperty(`caret-color`),t._blockCursorElement=null;let r=e.parentElement;r!==null&&r.removeChild(e)}function pg(e){return Zc?(e||window).getSelection():null}function mg(e){let t=tg(e);return t?t.getSelection():null}function hg(e){return jg(e)&&`host`in e}let gg=[];function _g(e){let t=e.getRootNode();if(t===e||!hg(t))return gg;let n=[t],r=t.host;for(;;){let e=r.getRootNode();if(e===r||!hg(e))break;n.push(e),r=e.host}return n}function*vg(e){let t=[e],n;for(;n=t.pop();){yield*n.querySelectorAll(`[data-lexical-editor="true"]`);let e=(fh(n)?n:n.ownerDocument).createTreeWalker(n,NodeFilter.SHOW_ELEMENT),r;for(;r=e.nextNode();)r.shadowRoot&&t.push(r.shadowRoot)}}function yg(e){return e===null?document:e.ownerDocument}function bg(){let e=sm();return yg(e===null?null:e._rootElement)}function xg(e,t){if(t===null||typeof e.getComposedRanges!=`function`)return null;let n=_g(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 Sg(e,t){let n=xg(e,t);if(n!==null){let e=wg(n);if(e!==null)return e}return e.rangeCount>0?e.getRangeAt(0):null}function Cg(e,t){let n=xg(e,t);return n===null?e:Tg(n,Eg(e))}function wg(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 Tg(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 Eg(e){return e.direction}function Dg(e){let t=e.getRootNode();return fh(t)||hg(t)?t.activeElement:null}function Og(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 kg(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 Ag(e)&&e.nodeType===1}function Ag(e){return typeof e==`object`&&!!e&&`nodeType`in e&&typeof e.nodeType==`number`}function jg(e){return Ag(e)&&e.nodeType===11}let Mg=/^(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 Ng(e){return!(!Y(e)||!e.style.display.startsWith(`inline`))||Mg.test(e.nodeName)}let Pg=/^(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 Fg(e){return(!Y(e)||!e.style.display.startsWith(`inline`))&&Pg.test(e.nodeName)}function Ig(e){if(K(e)&&!e.isInline())return!0;if(!G(e)||og(e))return!1;let t=e.getFirstChild(),n=t===null||Fm(t)||V(t)||t.isInline();return!e.isInline()&&!1!==e.canBeEmpty()&&n}function Lg(){return W()}function Rg(e=Lg()){return e._config.dom||Km}function zg(e,t,n=Lg()){let r=Rg(n).$getDOMSlot(e,t,n);return G(e)&&(Bg(r)||L(344,e.getKey(),e.getType())),r}function Bg(e){return e instanceof Cl}function Vg(e,t,n=Lg()){return ph(zg(e,t,n).element)}let Hg=/* @__PURE__ */ new WeakMap,Ug=/* @__PURE__ */ new Map;function Wg(e){if(!e._readOnly&&e.isEmpty())return Ug;e._readOnly||L(192);let t=Hg.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),Hg.set(e,t)),t}function Gg(e){let t=e.constructor.clone(e,$m);return t.afterCloneFrom(e),t}function Kg(e){return(t=Gg(e))[yf]=!0,t;var t}function qg(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 Jg(e,t){let n=t.getAttribute(`dir`);return n===`ltr`||n===`rtl`?e.setDirection(n):e}function Yg(e,t){let n=t.style.textAlign;return n&&n in ml?e.setFormat(n):e}function Xg(e,t){e.__lexicalUnmanaged=!0,t&&t.captureSelection!==void 0&&(e.__lexicalCapturedSelection=t.captureSelection)}function Zg(e){return!0===e.__lexicalUnmanaged}function Qg(e,t=Lg()){let n=t.isEditable();e.contentEditable=n?`true`:`false`,n?e.__lexicalEditor=t:delete e.__lexicalEditor}function $g(e,t){let n=e;for(;n!=null;){if(!0===n.__lexicalCapturedSelection)return!0;if(Y(n)&&n.hasAttribute(`data-lexical-slot`)||Ch(n,t)!==void 0)return!1;n=Xh(n)}return!1}function e_(e,t){return function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}(e,t)&&e[t]!==Sf[t]}let t_=/* @__PURE__ */ new WeakMap,n_=Symbol(`lexical.synthesizedGetType`);function r_(e){let t=t_.get(e);if(t)return t;let n=e.prototype!=null&&vl in e.prototype?e.prototype[vl]():void 0,r=function(e){if(!(e===Sf||e.prototype instanceof Sf)){let t=`<unknown>`,n=`<unknown>`;try{t=e.getType()}catch{}try{Xm.version&&(n=JSON.parse(Xm.version))}catch{}L(290,e.name,t,n)}return e===Cm||e===xm||e===Sf}(e),i=!r&&e_(e,`getType`)?e.getType:void 0,a=i&&!(n_ 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(!e_(e,`getType`)){let t=e,n=function(){return this===t?s:Sf.getType.call(this)};n[n_]=!0,e.getType=n}if(e_(e,`clone`)||(e.clone=(t,n)=>{Qm(t);let r=new e;return n!==$m&&r.afterCloneFrom(t),r}),e_(e,`importJSON`)||(e.importJSON=o&&o.$importJSON||(t=>new e().updateFromJSON(t))),!e_(e,`importDOM`)&&o){let{importDOM:t}=o;t&&(e.importDOM=()=>t)}}let c={klass:e,ownNodeConfig:o,ownNodeType:s};return t_.set(e,c),c}function*i_(e){for(let t=e;t&&(t===Sf||Cf(t.prototype));){let e=r_(t);yield e,t=e.ownNodeConfig&&e.ownNodeConfig.extends||c_(t)}}function a_(e){let t=Lg();return tm(),new(t.resolveRegisteredNodeAfterReplacements(t.getRegisteredNode(e))).klass}let o_=(e,t)=>{let n=e;for(;n!=null&&!Tm(n);){if(t(n))return n;n=n.getParent()}return null};function s_(e,t){let n=[],r=e.__first;for(;r!==null;){let e=t===null?bh(r):t.get(r);e??L(174),n.push(r),r=e.__next}return n}function c_(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 l_=/* @__PURE__ */ new Map;function u_(e){return G(e)||K(e)}function d_(e){return G(e)||K(e)}function f_(e){let t=e.getLatest();return d_(t)?t.__slotHost:null}function p_(e){let t=f_(e);if(t===null)return null;let n=bh(t);return G(n)||K(n)||L(370),n}function m_(e){let t=p_(e);if(t===null)return null;let n=e.getLatest().__key;for(let[e,r]of g_(t))if(r===n)return e;return null}function h_(e){let t=e.getLatest();for(;t!==null;){if(f_(t)!==null)return t;t=t.getParent()}return null}function g_(e){let t=e.getLatest();return u_(t)&&t.__slots!==null?t.__slots:l_}function __(e){return Array.from(g_(e).keys())}function v_(e,t){let n=g_(e).get(t);return n===void 0?null:bh(n)}let y_=[`__proto__`,`constructor`,`prototype`],b_=Symbol(`slotMapOwner`);function x_(e){let t=e.__slots;return t!==null&&t[b_]===e||(t=new Map(t),t[b_]=e,e.__slots=t),t}let S_=/* @__PURE__ */ new WeakMap,C_=[];function w_(e){for(let{ownNodeConfig:t}of i_(e)){let e=t&&t.slots;if(e)return e}return C_}function T_(e){let t=``;for(let n of __(e)){let r=v_(e,n);r!==null&&(t+=r.getTextContent())}return t}function E_(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 D_(e){let t=e.__slots;if(t===null||t.size<2)return;let n=function(e){let t=S_.get(e);if(t===void 0){let n=w_(e),r=/* @__PURE__ */ new Map;for(let t of n)y_.includes(t)&&L(371,e.name,t),r.has(t)&&L(372,e.name,t),r.set(t,r.size);t=r,S_.set(e,t)}return t}(e.constructor),r=null,i=!0;for(let e of t.keys()){if(r!==null&&E_(r,e,n)>0){i=!1;break}r=e}if(i)return;let a=Array.from(t).sort(([e],[t])=>E_(e,t,n));t.clear();for(let[e,n]of a)t.set(e,n)}function O_(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=x_(i),o=a.get(t);o!==void 0&&A_(o);let s=n.getWritable(),c=p_(s);if(c!==null){let e=m_(s);e!==null&&x_(c.getWritable()).delete(e),s.__slotHost=null}return gh(s),s.__slotHost=i.__key,a.set(t,s.__key),D_(i),function(){let e=Lg();e._slotsUsed=!0,e._pendingEditorState&&(e._pendingEditorState._slotsUsed=!0)}(),i}function k_(e,t){let n=e.getWritable();if(n.__slots===null)return n;let r=n.__slots.get(t);return r!==void 0&&(A_(r),x_(n).delete(t)),n}function A_(e){let t=bh(e);if(t===null)return;let n=t.getWritable();d_(n)||L(377,e),n.__slotHost=null,n.remove()}let j_={next:`previous`,previous:`next`};var M_=class{origin;constructor(e){this.origin=e}[Symbol.iterator](){return rv({hasNext:B_,initial:this.getAdjacentCaret(),map:e=>e,step:e=>e.getAdjacentCaret()})}getAdjacentCaret(){return G_(this.getNodeAtCaret(),this.direction)}getSiblingCaret(){return G_(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=G_(e,this.direction)}for(let e of o.values())e.remove();return this}},N_=class e extends M_{type=`child`;getLatest(){let e=this.origin.getLatest();return e===this.origin?this:Y_(e,this.direction)}getParentCaret(e=`root`){return G_(I_(this.getParentAtCaret(),e),this.direction)}getFlipped(){let e=F_(this.direction);return G_(this.getNodeAtCaret(),e)||Y_(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 P_={root:Tm,shadowRoot:og};function F_(e){return j_[e]}function I_(e,t=`root`){return e===null||P_[t](e)?null:f_(e)===null?e:null}var L_=class e extends M_{type=`sibling`;getLatest(){let e=this.origin.getLatest();return e===this.origin?this:G_(e,this.direction)}getSiblingCaret(){return this}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return G(this.origin)?Y_(this.origin,this.direction):null}getParentCaret(e=`root`){return G_(I_(this.getParentAtCaret(),e),this.direction)}getFlipped(){let e=F_(this.direction);return G_(this.getNodeAtCaret(),e)||Y_(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 R_)&&this.direction===t.direction&&this.origin.is(t.origin)}},R_=class e extends M_{type=`text`;offset;constructor(e,t){super(e),this.offset=t}getLatest(){let e=this.origin.getLatest();return e===this.origin?this:K_(e,this.direction,this.offset)}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return null}getParentCaret(e=`root`){return G_(I_(this.getParentAtCaret(),e),this.direction)}getFlipped(){return K_(this.origin,F_(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 L_||t instanceof e)&&this.direction===t.direction&&this.origin.is(t.origin)}getSiblingCaret(){return G_(this.origin,this.direction)}};function z_(e){return e instanceof R_}function B_(e){return e instanceof L_}function V_(e){return e instanceof N_}let H_={next:class extends R_{direction=`next`;getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends R_{direction=`previous`;getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},U_={next:class extends L_{direction=`next`;getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends L_{direction=`previous`;getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},W_={next:class extends N_{direction=`next`;getNodeAtCaret(){return this.origin.getFirstChild()}insert(e){return this.origin.splice(0,0,[e]),this}},previous:class extends N_{direction=`previous`;getNodeAtCaret(){return this.origin.getLastChild()}insert(e){return this.origin.splice(this.origin.getChildrenSize(),0,[e]),this}}};function G_(e,t){return e?new U_[t](e):null}function K_(e,t,n){return e?new H_[t](e,q_(e,n)):null}function q_(e,t,n=`error`){let r=e.getTextContentSize(),i=t===`next`?r:t===`previous`?0:t;return(i<0||i>r)&&(n!==`clamp`&&Xc(284,String(t),String(r),e.getKey()),i=i<0?0:r),i}function J_(e,t){return new $_(e,t)}function Y_(e,t){return G(e)?new W_[t](e):null}function X_(e){return e&&e.getChildCaret()||e}function Z_(e){return e&&X_(e.getAdjacentCaret())}var Q_=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 z_(t)?function(e,t){let{direction:n,origin:r}=e;return J_(e,q_(r,t===`focus`?F_(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[J_(e,r.offset-e.offset),null]}return[t,n]}iterNodeCarets(e=`root`){let t=z_(this.anchor)?this.anchor.getSiblingCaret():this.anchor.getLatest(),n=this.focus.getLatest(),r=z_(n),i=t=>t.isSameNodeCaret(n)?null:Z_(t)||t.getParentCaret(e);return rv({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`)}},$_=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 K_(e.setTextContent(i.slice(0,n)+i.slice(r)),t,n)}};function ev(e){return nv(e,G_(Dh(),e.direction))}function tv(e){return nv(e,e)}function nv(e,t){return e.direction!==t.direction&&L(265),new Q_(e,t,e.direction)}function rv(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 iv(e,t){let n=cv(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 av(n)}}function av(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 ov(e,t){return t.is(e)}function sv(e){return G(e)?[e.getLatest(),null]:[e.getParent(),e.getLatest()]}function cv(e,t){if(e.is(t))return{commonAncestor:e,type:`same`};let n=/* @__PURE__ */ new Map;for(let[t,r]=sv(e);t;r=t,t=t.getParent())n.set(t,r);for(let[r,i]=sv(t);r;i=r,r=r.getParent()){let a=n.get(r);if(a!==void 0)return a===null?(ov(e,r)||L(276),{commonAncestor:r,type:`ancestor`}):i===null?(ov(t,r)||L(277),{commonAncestor:r,type:`descendant`}):((G(a)||ov(e,a))&&(G(i)||ov(t,i))&&r.is(a.getParent())&&r.is(i.getParent())||L(278),{a,b:i,commonAncestor:r,type:`branch`})}return null}function lv(e,t){let{type:n,key:r,offset:i}=e,a=ug(e.key);return n===`text`?(V(a)||L(266,a.getType(),r),K_(a,t,i)):(G(a)||L(267,a.getType(),r),Sv(a,e.offset,t))}function uv(e,t){let{origin:n,direction:r}=t,i=r===`next`;z_(t)?e.set(n.getKey(),t.offset,`text`):B_(t)?V(n)?e.set(n.getKey(),q_(n,r),`text`):e.set(n.getParentOrThrow().getKey(),n.getIndexWithinParent()+ +!!i,`element`):(V_(t)&&G(n)||L(268),e.set(n.getKey(),i?0:n.getChildrenSize(),`element`))}function dv(e){let t=U(),n=H(t)?t:Dp();return fv(n,e),Oh(n),n}function fv(e,t){uv(e.anchor,t.anchor),uv(e.focus,t.focus)}function pv(e){let{anchor:t,focus:n}=e,r=lv(t,`next`),i=lv(n,`next`),a=iv(r,i)<=0?`next`:`previous`;return nv(bv(r,a),bv(i,a))}function mv(e){let{direction:t,origin:n}=e,r=G_(n,F_(t)).getNodeAtCaret();return r?G_(r,t):Y_(n.getParentOrThrow(),t)}function hv(e,t=`root`){let n=[e];for(let r=V_(e)?e.getParentCaret(t):e.getSiblingCaret();r!==null;r=r.getParentCaret(t))n.push(mv(r));return n}function gv(e){return!!e&&e.origin.isAttached()}function _v(e,t=`removeEmptySlices`){if(e.isCollapsed())return e;let n=`root`,r=`next`,i=t,a=xv(e,r),o=hv(a.anchor,n),s=hv(a.focus.getFlipped(),n),c=/* @__PURE__ */ new Set,l=[];for(let e of a.iterNodeCarets(n))if(V_(e))c.add(e.origin.getKey());else if(B_(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),gh(e)}for(let e of u)!e.canBeEmpty()&&!og(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=mv(G_(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=qf(e.getTextContent()).setStyle(e.getStyle()).setFormat(e.getFormat());a.replaceOrInsert(n),t=K_(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(gv(e)){d=vv(e);break}for(let e of s)if(gv(e)){f=vv(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(og(i))return;!n&&t(i)&&(n=i)}return n},u=l(a,Ig),d=u&&l(o,e=>n.has(e.getKey())&&Ig(e));return d&&__(d).length>0?null:u&&d?[u,d]:null}(d,f,c);if(p){let[e,t]=p;Y_(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(V_(e)){let t=e.origin;if(Ig(t))return t}else{let t=e.getParentAtCaret();if(t&&Ig(t))return t}return null}(f),t=e&&e.getParent(),n=e&&e.getParents().findLast(ag);if(e&&t&&!Tm(t)&&e.isEmpty()&&c.has(e.getKey())&&__(e).length===0&&(!n||c.has(n.getKey()))){e.remove(!0);let n=t;for(;n&&!Tm(n)&&n.isEmpty();){let e=n.getParent();if(e&&Tm(e)&&e.getChildrenSize()<=1)break;let t=n;n=e,t.remove(!0)}}}let m=[d,f,...o,...s].find(gv);if(m)return tv(bv(vv(m),e.direction));L(269,JSON.stringify(o.map(e=>e.origin.__key)))}function vv(e){let t=function(e){let t=e;for(;V_(t);){let e=Z_(t);if(!V_(e))break;t=e}return t}(e.getLatest()),{direction:n}=t;if(V(t.origin))return z_(t)?t:K_(t.origin,n,n);let r=t.getAdjacentCaret();return B_(r)&&V(r.origin)?K_(r.origin,n,F_(n)):t}function yv(e){return z_(e)&&e.offset!==q_(e.origin,e.direction)}function bv(e,t){return e.direction===t?e:e.getFlipped()}function xv(e,t){return e.direction===t?e:nv(bv(e.focus,t),bv(e.anchor,t))}function Sv(e,t,n){let r=Y_(e,`next`);for(let e=0;e<t;e++){let e=r.getAdjacentCaret();if(e===null)break;r=e}return bv(r,n)}function Cv(e){let{origin:t,offset:n,direction:r}=e;if(n===q_(t,r))return e.getSiblingCaret();if(n===q_(t,F_(r)))return mv(e.getSiblingCaret());let[i]=t.splitText(n);return V(i)||L(281),bv(G_(i,`next`),r)}function wv(e,t){return!0}function Tv(e,{$copyElementNode:t=sg,$splitTextPointCaretNext:n=Cv,rootMode:r=`shadowRoot`,$shouldSplit:i=wv,removeEmptyDestination:a=!1}={}){if(z_(e))return n(e);let o=e.getParentCaret(r);if(o){let{origin:n}=o;if(V_(e)){let e=mv(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 Ev(e,t,n){let r=bv(t,`next`);z_(r)&&(r.offset===0?r=G_(r.origin,`previous`).getFlipped():r.offset===r.origin.getTextContentSize()&&(r=G_(r.origin,`next`))),r.origin.is(e)&&(B_(r)||L(342,e.getKey(),e.getType()),r=mv(r)),(e.is(r.getNodeAtCaret())||e.is(r.getFlipped().getNodeAtCaret()))&&e.remove(!0);for(let e=r;e;e=Tv(e,n))r=e;return z_(r)&&L(283),r.insert(e.isInline()?Vm().append(e):e),bv(G_(e.getLatest(),`next`),t.direction)}function Dv(e){return e}function Ov(e){return e}function kv(e,t){if(!t||e===t)return e;for(let n in t)if(e[n]!==t[n])return{...e,...t};return e}function Av(...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 jv(e,...t){let n=Av(...t);n.length>0&&e.classList.add(...n)}function Mv(...e){return()=>{for(let t=e.length-1;t>=0;t--)e[t]();e.length=0}}function Nv(e){throw Error(`unreachable input event: ${JSON.stringify(e)}`)}function Pv(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 Fv(e,t){return e.startsWith(t)||e===t.trimEnd()}var Iv=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 Nv(e)}}onDraftChanged(e){return this.phase===`claimed`&&this.claim!==void 0&&!Fv(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:Pv(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:Pv(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&&Fv(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 Lv(e){let t=Lg().getElementByKey(e.getKey());if(t===null)return null;let n=t.ownerDocument.defaultView;return n===null?null:n.getComputedStyle(t)}function Rv(e){return Lv(Tm(e)?e:e.getParentOrThrow())}function zv(e,t,n=`self`){let r=e.getStartEndPoints();if(t.isSelected(e)&&!uh(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]=dp(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=Kg(t)),t.__text=p)}}return t}function Bv(e){let t=Vv(e);return t!==null&&t.writingMode===`vertical-rl`}function Vv(e){let t=e.anchor.getNode();return G(t)?Lv(t):Rv(t)}function Hv(e,t){let n=Bv(e)?!t:t;Wv(e)&&(n=!n);let r=lv(e.focus,n?`previous`:`next`);if(yv(r))return!1;if(z_(r)&&!Zf(r.origin)&&r.origin.isUnmergeable()){let e=r.getNodeAtCaret();if(V(e)&&!Zf(e))return!0}for(let e of ev(r)){if(V_(e))return!e.origin.isInline();if(!G(e.origin)){if(K(e.origin))return!0;break}}return!1}function Uv(e,t,n,r){e.modify(t?`extend`:`move`,n,r)}function Wv(e){let t=Vv(e);return t!==null&&t.direction===`rtl`}function Gv(e,t,n){let r=Wv(e),i;i=Bv(e)||r?!n:n,Uv(e,t,i,`character`)}function Kv(e,t){return e!==null&&Object.getPrototypeOf(e).constructor.name===t.name}let qv=Symbol.for(`preact-signals`);function Jv(){if(Qv>1)return void Qv--;let e,t=!1;for(function(){let e=Zv;for(Zv=void 0;e!==void 0;)e.S.v===e.v&&(e.S.i=e.i),e=e.o}();Yv!==void 0;){let n=Yv;for(Yv=void 0,$v++;n!==void 0;){let r=n.u;if(n.u=void 0,n.f&=-3,!(8&n.f)&&ry(n))try{n.c()}catch(n){t||=(e=n,!0)}n=r}}if($v=0,Qv--,t)throw e}let X,Yv;function Xv(e){let t=X;X=void 0;try{return e()}finally{X=t}}let Zv,Qv=0,$v=0,ey=0;function ty(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 ny(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 ry(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 iy(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 ay(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 oy(e,t){ny.call(this,void 0),this.x=e,this.s=void 0,this.g=ey-1,this.f=4,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}function sy(e){let t=e.m;if(e.m=void 0,typeof t==`function`){Qv++;let n=X;X=void 0;try{t()}catch(t){throw e.f&=-2,e.f|=8,cy(e),t}finally{X=n,Jv()}}}function cy(e){for(let t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,sy(e)}function ly(e){if(X!==this)throw Error(`Out-of-order effect`);ay(this),X=e,this.f&=-2,8&this.f&&cy(this),Jv()}function uy(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 dy(e,t){let n=new uy(e,t);try{n.c()}catch(e){throw n.d(),e}let r=n.d.bind(n);return r[Symbol.dispose]=r,r}ny.prototype.brand=qv,ny.prototype.h=function(){return!0},ny.prototype.S=function(e){let t=this.t;t!==e&&e.e===void 0&&(e.x=t,this.t=e,t===void 0?Xv(()=>{var e;(e=this.W)==null||e.call(this)}):t.e=e)},ny.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&&Xv(()=>{var e;(e=this.Z)==null||e.call(this)}))}},ny.prototype.subscribe=function(e){return dy(()=>{let t=this.value,n=X;X=void 0;try{e(t)}finally{X=n}},{name:`sub`})},ny.prototype.valueOf=function(){return this.value},ny.prototype.toString=function(){return this.value+``},ny.prototype.toJSON=function(){return this.value},ny.prototype.peek=function(){let e=X;X=void 0;try{return this.value}finally{X=e}},Object.defineProperty(ny.prototype,"value",{get(){let e=ty(this);return e!==void 0&&(e.i=this.i),this.v},set(e){if(e!==this.v){if($v>100)throw Error(`Cycle detected`);(function(e){Qv!==0&&$v===0&&e.l!==0&&(e.l=0,Zv={S:e,v:e.v,i:e.i,o:Zv})})(this),this.v=e,this.i++,ey++,Qv++;try{for(let e=this.t;e!==void 0;e=e.x)e.t.N()}finally{Jv()}}}}),oy.prototype=new ny,oy.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===ey))return!0;if(this.g=ey,this.f|=1,this.i>0&&!ry(this))return this.f&=-2,!0;let e=X;try{iy(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,ay(this),this.f&=-2,!0},oy.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)}ny.prototype.S.call(this,e)},oy.prototype.U=function(e){if(this.t!==void 0&&(ny.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)}},oy.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(oy.prototype,"value",{get(){if(1&this.f)throw Error(`Cycle detected`);let e=ty(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}}),uy.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()}},uy.prototype.S=function(){if(1&this.f)throw Error(`Cycle detected`);this.f|=1,this.f&=-9,sy(this),iy(this),Qv++;let e=X;return X=this,ly.bind(this,e)},uy.prototype.N=function(){2&this.f||(this.f|=2,this.u=Yv,Yv=this)},uy.prototype.d=function(){this.f|=8,1&this.f||cy(this)},uy.prototype.dispose=function(){this.d()};function fy(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 py;try{py=`0.49.0+prod.esm`}catch{}let my=py??`"<unknown>+source"`,hy=/* @__PURE__ */ new Set([`__proto__`,`constructor`,`prototype`]);function gy(e,t){if(e&&t&&!Array.isArray(t)&&typeof e==`object`&&typeof t==`object`){let n=e,r=t;for(let e in r)!hy.has(e)&&Object.prototype.hasOwnProperty.call(r,e)&&(n[e]=gy(n[e],r[e]));return e}return t}function _y(e){return e.id===0}function vy(e){return e.id===2}function yy(e){return function(e){return e.id===1}(e)||Z(305,String(e.id),`1`),Object.assign(e,{id:2})}let by=/* @__PURE__ */ new Set;var xy=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):kv;for(let n of this.configs)e=t(e,n);return e}init(e){let t=this.state;vy(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)||by}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 Sy={tag:wf};function Cy(){let e=Dh();e.isEmpty()&&e.append(Vm())}let wy=/* @__PURE__ */ Dv({config:/* @__PURE__ */ Ov({setOptions:Sy,updateOptions:Sy}),init:({$initialEditorState:e=Cy})=>({$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(km(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:[wm,Rf,Mm,Yf,zm]}),Ty=Symbol.for(`@lexical/extension/LexicalBuilder`);function Ey(){}function Dy(e){throw e}function Oy(e){return Array.isArray(e)?e:[e]}let ky=my;var Ay=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=ky,this.roots=e;for(let t of e)this.addExtension(t)}static fromExtensions(t){let n=[Oy(wy)];for(let e of t)n.push(Oy(e));return new e(n)}static maybeFromEditor(t){let n=t[Ty];return n&&(n.PACKAGE_VERSION!==ky&&Z(292,n.PACKAGE_VERSION,ky),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(qm({...r,...t?{onError:e=>{t(e,i)}}:{},...n?{onWarn:e=>{n(e,i)}}:{}}),{[Ty]:this});for(let e of this.sortedExtensionReps())e.build(i);return i}buildEditor(){let e=Ey;function t(){try{e()}finally{e=Ey}}let n=Object.assign(this.constructEditor(),{dispose:t,[Symbol.dispose]:t});return e=Mv(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]=Oy(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 xy(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=Oy(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(vy(i))return;let a=n.extension.name;var o;_y(i)||Z(300,a,r||`[unknown]`),_y(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=yy(i),n.state=i,e.push(n)};for(let e of this.extensionNameMap.values())_y(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 Mv(...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 fy(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&&gy(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||=Dy,e}};function jy(e,t){let n=Ay.maybeFromEditor(e);if(!n)return;let r=n.extensionNameMap.get(t);return r?r.getExtensionDependency():void 0}var My=class extends Cm{$config(){return this.config(`horizontalrule`,{importDOM:{hr:()=>({conversion:Ny,priority:0})}})}exportDOM(){return{element:bg().createElement(`hr`)}}createDOM(e){let t=bg().createElement(`hr`);return jv(t,e.theme.hr),t}getTextContent(){return`
|
|
155
|
-
`}isInline(){return!1}updateDOM(){return!1}};function Ny(){return{node:Py()}}function Py(){return a_(My)}Date.now;function Fy(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 Iy;function Ly(e,t){let{key:n}=t;return e&&n in e?e[n]:t.defaultValue}function Ry(e){return Iy&&Iy.editor===e?Iy:void 0}function zy(e,t){if(`cfg`in t){let{cfg:n,updater:r}=t;return[n,r(Ly(e,n))]}return t}function By(e,t){let n=t;for(let r of e){let[e,i]=zy(n,r),a=e.key;if(n===t&&Ly(n,e)===i)continue;let o=n===t||n===void 0?Vy(t):n;o[a]=i,n=o}return n}function Vy(e){return Object.create(e||null)}function Hy(e,t){return[e,t]}function Uy(e,t,n,r=Lg()){let i=Iy,a=Ry(r);try{return Iy={...a,editor:r,[e]:t},n()}finally{Iy=i}}function Wy(e,t=()=>{}){return(n,r=Lg())=>i=>{let a=Ry(r),o=a&&a[e],s=By(n,o||t(r));return s&&s!==o?Uy(e,s,i,r):i()}}function Gy(e,t,n,r){return Object.assign(Hl(Symbol(t),{isEqual:r,parse:n}),{[e]:!0})}let Ky=`@lexical/html/DOM`,qy=Symbol.for(`@lexical/html/DOMExportContext`);function Jy(e,t,n){return Gy(qy,e,t,n)}let Yy=/* @__PURE__ */ Jy(`isExport`,Boolean);function Xy(e){let t=jy(e,Ky);return t?t.output.defaults:void 0}function Zy(e){let t=jy(e,Ky);return t?t.output.runtime:void 0}function Qy(e=Lg()){let t=Zy(e);return t?t.getSessionConfig():Rg(e)}let $y=Wy(qy,Xy),eb=Symbol.for(`@lexical/html/SelectorImpl`);function tb(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=>tb(e,[...t,n]);return{[eb]:n,attr:(e,t,n)=>i(ib(e,t,n)),classAll:(...e)=>i(rb(e)),classAny:(...e)=>i(function(e){let t=nb(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)}}Fy(362,JSON.stringify(e))}(e,t,n))}}function nb(e){let t=[];for(let n of e)n&&t.push(n);return t}function rb(e){let t=nb(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 ib(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)}}Fy(361,JSON.stringify(e))}let ab={kind:`text`,predicate:dh,tags:/* @__PURE__ */ new Set},ob={[eb]:ab},sb={kind:`comment`,predicate:e=>e.nodeType===8,tags:/* @__PURE__ */ new Set},cb={[eb]:sb},lb={any:()=>tb(/* @__PURE__ */ new Set,[]),comment:()=>cb,tag(...e){e.length>0||Fy(363);let t=/* @__PURE__ */ new Set;for(let n of e)t.add(n.toUpperCase());return tb(t,[])},text:()=>ob},ub=lb;ub.tag(`b`,`strong`,`em`,`i`,`code`,`mark`,`s`,`sub`,`sup`,`u`,`span`),ub.text(),ub.tag(`script`,`style`),ub.tag(`br`),ub.tag(`p`),ub.tag(`hr`),ub.any(),Object.freeze([]),Object.freeze({}),lb.any(),lb.any,lb.comment,lb.tag,lb.text;function db(e,t=null,n=Lg()){return $y([Hy(Yy,!0)],n)(()=>{let r=Dh(),i=Qy(n),a=H(t)?h_(t.anchor.getNode()):null,o=e.append.bind(e);for(let e of(G(a)?a:r).getChildren())pb(n,e,o,t,i);return e})}function fb(e,t=null){return(typeof document>`u`||typeof window>`u`&&global.window===void 0)&&Fy(338),im(e),db(bg().createElement(`div`),t,e).innerHTML}function pb(e,t,n,r=null,i=Rg(e)){let a=i.$shouldInclude(t,r,e),o=i.$shouldExclude(t,r,e),s=t;r!==null&&V(t)&&(s=zv(r,t,`clone`));let{element:c,after:l,append:u,$getChildNodes:d}=i.$exportDOM(s,e);if(!c)return!1;let f=bg().createDocumentFragment(),p=d?d():G(s)?s.getChildren():[],m=a&&sp(r)&&G(t)?null:r,h=f.append.bind(f);for(let n of p){let o=pb(e,n,h,m,i);!a&&o&&i.$extractWithChild(t,n,r,`html`,e)&&(a=!0)}if(a&&!o){if((Y(c)||jg(c))&&(u?u(f):c.append(f)),n(c),l){let e=l.call(s,c);e&&(jg(c)?c.replaceChildren(e):c.replaceWith(e))}}else n(f);return a}function mb(e,t,n=null){let r=yg(n),i=n?_g(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=Xh(n)}return!1}(a.offsetNode,n))return{node:a.offsetNode,offset:a.offset}}if(a){let i=n.getRootNode();if(hg(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 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 gb(e,t=U()){return t??hb(166),H(t)&&t.isCollapsed()||t.getNodes().length===0?``:fb(e,t)}function _b(e,t){let n=e.getData(`text/plain`)||e.getData(`text/uri-list`);n!=null&&t.insertRawText(n)}let vb=`application/x-lexical-drag`;function yb(e,t){let n={editorKey:t.getKey()};e.setData(vb,JSON.stringify(n))}function bb(e,t,n){let r=e.dataTransfer;if(r===null)return!1;let i=function(e){let t=e.getData(vb);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=mb(e.clientX,e.clientY,t.getRootElement());if(n===null)return null;let r=wh(n.node);if(r===null)return null;if(V(r))return K_(r,`next`,n.offset);if(G(r))return Sv(r,n.offset,`next`);let i=r.getParent();return i===null?null:Sv(i,r.getIndexWithinParent()+1,`next`)}(e,t);if(a===null)return!1;let o=Tv(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}=xv(pv(t),`next`);return iv(n,e)<0&&iv(e,r)<0}(a,c))return e.preventDefault(),!0;c.removeText()}if(!o.origin.isAttached())return e.preventDefault(),!0;if(n(r,dv(tv(o)),t),!s){let e=t.getRootElement(),n=e?e.ownerDocument:null,r=n?function(e,t){for(let n of vg(t)){let t=ch(n);if(oh(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 xb(e,t){return bb(e,t,(e,t)=>_b(e,t))}function Sb(e,t){t.update(()=>{if(e!==null){let n=Kv(e,KeyboardEvent)?null:e.clipboardData,r=U();if(r!==null&&!r.isCollapsed()&&n!=null){e.preventDefault();let i=gb(t);i!==null&&n.setData(`text/html`,i),n.setData(`text/plain`,r.getTextContent())}}})}function Cb(e){return Mv(e.registerCommand(rd,e=>{let t=U();return!!H(t)&&(t.deleteCharacter(e),!0)},0),e.registerCommand(ld,e=>{let t=U();return!!H(t)&&(t.deleteWord(e),!0)},0),e.registerCommand(ud,e=>{let t=U();return!!H(t)&&(t.deleteLine(e),!0)},0),e.registerCommand(od,e=>{let t=U();if(!H(t))return!1;if(typeof e==`string`)t.insertText(e);else{let n=e.dataTransfer;if(n!=null)_b(n,t);else{let n=e.data;n&&t.insertText(n)}}return!0},0),e.registerCommand(cd,()=>{let e=U();return!!H(e)&&(e.removeText(),!0)},0),e.registerCommand(id,e=>{let t=U();return!!H(t)&&(t.insertLineBreak(e),!0)},0),e.registerCommand(ad,()=>{let e=U();return!!H(e)&&(e.insertLineBreak(),!0)},0),e.registerCommand(_d,e=>{let t=U();if(!H(t))return!1;let n=e,r=n.shiftKey;return!!Hv(t,!0)&&(n.preventDefault(),Gv(t,r,!0),!0)},0),e.registerCommand(hd,e=>{let t=U();if(!H(t))return!1;let n=e,r=n.shiftKey;return!!Hv(t,!1)&&(n.preventDefault(),Gv(t,r,!1),!0)},0),e.registerCommand(Cd,t=>!!H(U())&&(!nl||!tl)&&(t.preventDefault(),e.dispatchCommand(rd,!0)),0),e.registerCommand(Td,t=>!!H(U())&&(t.preventDefault(),e.dispatchCommand(rd,!1)),0),e.registerCommand(xd,t=>{if(!H(U()))return!1;if(t!==null){if((nl||il||sl)&&tl)return!1;t.preventDefault()}return e.dispatchCommand(id,!1)},0),e.registerCommand(Nd,()=>{let e=U();return Uh(H(e)&&h_(e.anchor.getNode())!==null?e:null),!0},0),e.registerCommand(jd,t=>!!H(U())&&(Sb(t,e),!0),0),e.registerCommand(Md,t=>!!H(U())&&(function(e,t){Sb(e,t),t.update(()=>{let e=U();H(e)&&e.removeText()},{tag:`cut`})}(t,e),!0),0),e.registerCommand(sd,t=>!!H(U())&&(function(e,t){e.preventDefault(),t.update(()=>{let t=U(),n=Kv(e,ClipboardEvent)?e.clipboardData:null;n!=null&&H(t)&&_b(n,t)},{tag:`paste`})}(t,e),!0),0),e.registerCommand(Dd,t=>xb(t,e),0),e.registerCommand(Od,t=>{let n=U();return!!H(n)&&(n.isCollapsed()||t.dataTransfer===null||yb(t.dataTransfer,e),!0)},0))}function wb(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||Tm(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 Tb(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:wb(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 Eb(e,t){e.undoStack=[],e.redoStack=[],e.current=null,t&&t(e)}function Db(e,t,n,r=Date.now,i,a=null){let o=Tb(e,n,r),s=()=>{i&&i(t)};return s(),Mv(e.registerCommand(fd,()=>(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(Id,!0)),i.length===0&&e.dispatchCommand(Ld,!1),t.current=o||null,n&&n(t),o&&o.editor.setEditorState(o.editorState,{tag:`historic`})}}(e,t,i),!0),0),e.registerCommand(pd,()=>(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(Ld,!0));let o=r.pop();r.length===0&&e.dispatchCommand(Id,!1),t.current=o||null,n&&n(t),o&&o.editor.setEditorState(o.editorState,{tag:`historic`})}}(e,t,i),!0),0),e.registerCommand(Pd,()=>(Eb(t,i),!1),0),e.registerCommand(Fd,()=>(Eb(t,i),e.dispatchCommand(Id,!1),e.dispatchCommand(Ld,!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(Id,!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(Ld,!0)}}else if(m===2)return;t.current={editor:e,editorState:n},s()}))}function Ob(){return{current:null,redoStack:[],undoStack:[]}}Date.now;let kb=`application/x-codexhost-thread-reference`;function Ab(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 jb(e){return`thread://${encodeURIComponent(e.threadId).replace(/[!'()*]/gu,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)}?hostId=${encodeURIComponent(e.hostId)}`}function Mb(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 Nb(e){let t=`[@${e.title.replace(/[\\`*{}[\]()#+.!_<>|~-]/gu,e=>`\\${e}`)}](${jb(e)})`;return{source:`codexhost-thread`,ref:t,label:e.title,appearance:`session`,clipboardText:t}}function Pb(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:Ab({id:n,blank:!1,title:i,projectionValues:{threadReference:{hostId:r,threadId:n}}})}catch{return}}function Fb(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=Fb(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function Ib(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=Fb(e))&&(r&&(r+=` `),r+=t);return r}let Lb=`@deepseek-ai/dsh-client-ui-conversation/ReferenceChip.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Lb)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-conversation`,e.dataset.pluginCss=Lb,e.textContent=`.ieyLPW_chip{max-width:240px;color:var(--dsw-alias-state-business-primary);user-select:none;align-items:baseline;gap:3px;display:inline-flex}.ieyLPW_marker{flex:none;font-weight:500}.ieyLPW_icon{flex:none;align-self:center}.ieyLPW_label{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.ieyLPW_invalid{color:var(--dsw-alias-state-error-primary);opacity:.7;text-decoration:line-through}`,document.head.appendChild(e)}var Rb={chip:`ieyLPW_chip`,icon:`ieyLPW_icon`,invalid:`ieyLPW_invalid`,label:`ieyLPW_label`,marker:`ieyLPW_marker`};let zb=`@deepseek-ai/dsh-client-ui-conversation/composer-editor.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(zb)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-conversation`,e.dataset.pluginCss=zb,e.textContent=`.hTX3Lq_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}.hTX3Lq_reference:hover{background:var(--dsw-alias-state-business-tertiary)}.hTX3Lq_openable{cursor:pointer}.hTX3Lq_textRef{max-width:100%;display:inline-block}`,document.head.appendChild(e)}var Bb={openable:`hTX3Lq_openable`,reference:`hTX3Lq_reference`,textRef:`hTX3Lq_textRef`};function Vb({label:e,reference:t,appearance:n,invalid:r}){return/* @__PURE__ */ (0,h.jsxs)(`span`,{className:Ib(Bb.reference,Rb.chip,n===`file`&&!r&&Bb.openable,r&&Rb.invalid),title:e,children:[n===void 0?/* @__PURE__ */ (0,h.jsx)(`span`,{className:Rb.marker,"aria-hidden":!0,children:`@`}):/* @__PURE__ */ (0,h.jsx)(d.ReferenceIconRegular,{kind:n,reference:t,size:14,className:Rb.icon}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:Rb.label,children:e})]})}var Hb=class e extends Cm{__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)(Vb,{label:this.__label,reference:this.__ref,appearance:this.__appearance,invalid:this.__invalid})}};function Ub(e){return new Hb(e)}function Wb(e){return e instanceof Hb}function Gb(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 Kb(e,t,n,r){let i=e=>e instanceof n,a=e=>{let t=qf(e.getTextContent());t.setFormat(e.getFormat()),e.replace(t)};return[e.registerNodeTransform(Rf,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&&Gb(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 qb=/(^|\s)([/@])([\w-]+)/g,Jb=/(^|\s)(@(?:"[^"\n]*"?|[^\s"]\S*))/g,Yb=/* @__PURE__ */ new Set(`.,;:!?,。;:!?`),Xb=/^@.*[/\\.]/u;function Zb(e,t,n){if(!n.startsWith(`@"`)){let e=n.length;for(;Yb.has(n.charAt(e-1));)--e;return Xb.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(;Yb.has(e.charAt(i));)i+=1;return i===e.length||/\s/u.test(e.charAt(i))?t+r+1:void 0}let Qb=/^(?:\s|$)/;function $b(e,t){if(e===``)return[];let n=[];qb.lastIndex=0;let r;for(;(r=qb.exec(e))!==null;){let i=r[2],a=r[3]??``;if((i!==`/`||Qb.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})}}Jb.lastIndex=0;let i;for(;(i=Jb.exec(e))!==null;){let t=i.index+(i[1]?.length??0),r=Zb(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 ex=class e extends Rf{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=Ib(t.className,Bb.reference,Bb.textRef,this.getTextContent().startsWith(`/`)&&Bb.openable),t.setAttribute(`spellcheck`,`false`),t.setAttribute(`data-composer-text-ref`,``),t}isTextEntity(){return!0}canInsertTextBefore(){return!0}};function tx(e,t,n){return Mv(...Kb(e,e=>{let r=n();for(let n of $b(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},ex,e=>new ex(e.getTextContent())))}function nx(e){e.update(()=>{for(let e of Dh().getAllTextNodes())e.markDirty()},{tag:wf})}function rx(e,t){return e.registerCommand(Qu,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=wh(e.target);if(Wb(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 ex&&t(void 0,{ref:r.getTextContent()})},1)}let ix=k().refine(e=>e.trim().length>0,{message:`Identifier must not be empty or whitespace`}),ax=ix.brand(),ox=ix.brand(),sx=ix.brand();ix.brand(),ix.brand();let cx=k().min(1).max(128).regex(/^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/u),lx=cx.pipe(ax),ux=lx.refine(e=>e!==`codex`,`The official Codex identity is reserved`),dx=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`),fx=ds().refine(e=>/^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(e),`Plugin documentation links must be credential-free HTTPS URLs`),px=N({en:k().max(4096),"zh-CN":k().max(4096).optional()}).strict(),mx=N({commands:M(N({terminal:k().max(256),command:k().max(4096)}).strict()).max(8),before:px.optional(),after:px.optional(),downloads:M(N({label:k().max(128),url:fx}).strict()).max(8).optional()}).strict(),hx={id:lx,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:mx.optional(),notice:px.optional(),launchCommand:I(!0).optional(),links:N({website:fx.optional(),documentation:fx.optional(),installation:fx.optional()}).strict().optional()};N({manifestVersion:I(1),...hx,adapterApiVersion:A().int().positive(),entry:dx,icon:dx.optional()}).strict();let gx=k().max(174828).regex(/^data:image\/(?:png|jpeg|webp|svg\+xml);base64,[A-Za-z0-9+/]+={0,2}$/u),_x=N({...hx,icon:gx.optional()}).strict();N({}).strict(),N({plugins:M(_x.extend({id:ux})).max(128)}).strict(),N({version:I(1),enabled:M(lx).max(128)}).strict().refine(e=>new Set(e.enabled).size===e.enabled.length,{message:`Enabled plugin IDs must be unique`,path:[`enabled`]});function vx(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 yx=Bs([k(),A(),j(),Ms()]);function bx(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 xx=bc(bx,{message:`JSON value must not contain circular references`}),Sx=vc(()=>Bs([yx,M(Sx),Js(k(),Sx)])),Cx=xx.pipe(Sx);xx.pipe(M(Sx));let wx=xx.pipe(Js(k(),Sx)),Tx=cx,Ex=F([`sidebar.thread-layout`,`sidebar.thread-badge`,`appearance.theme`]),Dx=F([`appearance`,`interface`,`workflow`,`analytics`,`integrations`,`tools`]),Ox=k().trim().min(1).max(128);function kx(e){switch(e.match(/\.([^./]+)$/u)?.[1]?.toLowerCase()){case`png`:return`image/png`;case`jpg`:case`jpeg`:return`image/jpeg`;case`webp`:return`image/webp`;default:return}}function Ax(e){switch(e.match(/\.([^./]+)$/u)?.[1]?.toLowerCase()){case`gif`:return`image/gif`;case`svg`:return`image/svg+xml`;case`woff2`:return`font/woff2`;case`json`:return`application/json`;case`css`:return`text/css`;default:return kx(e)}}let jx=e=>e.split(`/`).every(e=>!/[. ]$/u.test(e)),Mx=dx.refine(e=>jx(e)&&Ax(e)!==void 0,`Expected a relative Desktop extension asset path with a supported suffix`),Nx=dx.refine(e=>kx(e)!==void 0&&jx(e),`Images must be relative .png, .jpg, .jpeg, or .webp paths with no segments ending in a dot or space`),Px=k().trim().max(2048).regex(/^https?:\/\/[^/?#\\\s]+/iu,`Expected an HTTP(S) URL`).pipe(ds({protocol:/^https?$/u})).refine(e=>{let{username:t,password:n}=new URL(e);return!t&&!n&&!/[\\\s]/u.test(e)},`URL must not contain credentials, backslashes, or whitespace`);function Fx(e){return P({en:e,"zh-CN":e})}let Ix=Fx(k().trim().min(1)),Lx=M(Dx).max(Dx.options.length).refine(e=>new Set(e).size===e.length,`Duplicate categories`),Rx=M(Ex).max(Ex.options.length).refine(e=>new Set(e).size===e.length,`Duplicate slots`),zx={key:k().regex(/^[A-Za-z_][A-Za-z0-9_]*$/u),label:Ix,description:Ix.optional()},Bx={...zx,step:A().positive().optional(),default:A().optional()},Vx=P({value:k(),label:Ix}),Hx=Hs(`type`,[P({...zx,type:I(`boolean`),default:j().optional()}),P({...zx,type:I(`string`),placeholder:Ix.optional(),default:k().optional()}),P({...Bx,type:I(`number`),min:A().optional(),max:A().optional()}),P({...Bx,type:I(`range`),min:A(),max:A()}),P({...zx,type:I(`select`),options:M(Vx).min(1),default:k().optional()})]).superRefine((e,t)=>{let n=(e,n)=>t.addIssue({code:`custom`,path:[e],message:n});if(e.type===`number`||e.type===`range`){let{min:t=-1/0,max:r=1/0,default:i}=e;t>r&&n(`max`,`Must be at least min`),i!==void 0&&(i<t||i>r)&&n(`default`,`Must be within min and max`)}else if(e.type===`select`){let t=new Set(e.options.map(({value:e})=>e));t.size!==e.options.length&&n(`options`,`Duplicate option values`),e.default!==void 0&&!t.has(e.default)&&n(`default`,`Must match an option value`)}}),Ux=N({manifestVersion:ks().positive(),id:Tx,name:Bs([Ox,Fx(Ox)]),version:k().min(1).max(128),desktopApi:ks().positive()}).passthrough().extend({manifestVersion:I(1),desktopApi:I(1),description:P({en:k().max(4096),"zh-CN":k().max(4096).optional()}).optional(),author:k().trim().min(1).max(128).optional(),repository:Px.optional(),details:P({en:k().max(16384),"zh-CN":k().max(16384).optional()}).optional(),icon:Nx.optional(),screenshots:M(Nx).max(4).refine(e=>new Set(e).size===e.length,`Duplicate screenshots`).optional(),desktop:P({script:dx,style:dx.optional()}).optional(),backend:P({script:dx.refine(jx)}).optional(),slots:Rx.default(()=>[]),settingsSchema:M(Hx).max(32).refine(e=>new Set(e.map(({key:e})=>e)).size===e.length,`Duplicate setting keys`).optional(),categories:Lx.optional()}).strict().refine(e=>e.desktop!==void 0||e.backend!==void 0,`Expected at least one desktop or backend entry`),Wx=P({version:I(1),revision:ks().nonnegative(),enabled:M(Tx).max(64).refine(e=>new Set(e).size===e.length,`Duplicate extension IDs`),reloadToken:ls().optional()}),Gx=k().regex(/^[a-f0-9]{64}$/u),Kx=P({state:F([`running`,`disabled`,`invalid`,`incompatible`,`conflict`,`failed`,`waiting`]),hash:Gx.optional(),error:k().optional(),conflictWith:Tx.optional()});P({controllerPid:ks().positive(),targetId:k().nullable(),updatedAt:Po(),handledReloadToken:ls().optional(),extensions:Js(k(),Kx)});let qx=F([`official`,`community`]);function Jx(e){return e.origin===`https://api.github.com`&&/^\/repos\/[\w-]+\/[\w.-]+\/zipball(?:\/[^/]+)?\/?$/u.test(e.pathname)}let Yx=Px.refine(e=>{let t=new URL(e);return/\.zip$/iu.test(t.pathname)||Jx(t)||t.origin===`https://github.com`&&/^\/[\w-]+\/[\w.-]+\/zipball(?:\/.+)?\/?$/u.test(t.pathname)||t.origin===`https://codeload.github.com`&&/^\/[\w-]+\/[\w.-]+\/(?:zip|zipball|legacy\.zip)\/.+$/u.test(t.pathname)},`Expected a .zip download URL or a GitHub zipball URL`),Xx=P({id:Tx,version:k().trim().min(1).max(128),name:Ix.extend({en:Ox,"zh-CN":Ox}),description:Fx(k().trim().min(1).max(4096)),details:Fx(k().trim().min(1).max(16384)).optional(),author:k().trim().min(1).max(128),repository:Px,stars:A().int().min(0).optional(),downloads:A().int().min(0).optional(),categories:Lx.optional(),trustTier:qx.default(`community`),icon:Px.optional(),screenshots:M(Px).max(4).optional(),downloadUrl:Yx,sha256:Gx,slots:Rx.optional(),publishedAt:k().optional(),updatedAt:k().optional(),minCodexHostVersion:k().optional()}),Zx=P({schemaVersion:I(1),generatedAt:k(),extensions:M(Xx).refine(e=>new Set(e.map(({id:e})=>e)).size===e.length,`Duplicate extension IDs`)}),Qx={id:Tx};P({...Qx,path:Mx}),P({mimeType:k(),dataUrl:k()}),P(Qx),P({...Qx,values:wx}),P({values:wx});let $x=k().trim().min(1).max(128);P({...Qx,method:$x,params:Cx.optional()}),P({result:Cx});let eS=[`codexhost/desktop/extensions/list`,`codexhost/desktop/extensions/enable`,`codexhost/desktop/extensions/disable`,`codexhost/desktop/extensions/disable-all-and-reload`,`codexhost/desktop/extensions/catalog`,`codexhost/desktop/extensions/install`,`codexhost/desktop/extensions/uninstall`,`codexhost/desktop/extensions/asset`,`codexhost/desktop/extensions/settings/get`,`codexhost/desktop/extensions/settings/set`,`codexhost/desktop/extensions/backend/invoke`],tS=ks().nonnegative();P({}),P({id:Tx,expectedRevision:tS}),P({expectedRevision:tS.optional()});let nS=e=>k().max(23+4*Math.ceil(e/3)).regex(/^data:image\/(?:png|jpeg|webp);base64,[A-Za-z0-9+/]+={0,2}$/u),rS=P({id:k().min(1),manifest:Ux.optional(),iconDataUrl:nS(131072).optional(),screenshotDataUrls:M(nS(524288)).max(4).optional(),enabled:j(),status:Kx}),iS=P({configuration:Wx,desktopConnected:j(),diagnostics:M(k()),extensions:M(rS)});P({forceRefresh:j().optional()}),P({catalogUrl:k(),source:F([`remote`,`fallback`]),fetchedAt:k(),cached:j(),extensions:Zx.shape.extensions,error:k().optional()}),P({source:Hs(`type`,[P({type:I(`catalog`),id:Tx}),P({type:I(`url`),url:Px,expectedSha256:Gx.optional()}),P({type:I(`zip-base64`),fileName:k().trim().min(1).max(255),contentBase64:k().min(4).max(89478488).refine(e=>e.length%4==0&&/^[A-Za-z0-9+/]+={0,2}$/u.test(e),`Expected standard padded base64`)})])}),P({extensionId:Tx,version:k().min(1),replaced:j(),installedPath:k(),list:iS}),P({id:Tx}),P({removedId:Tx,list:iS}),Hs(`state`,[P({state:I(`saved`),configuration:Wx}),P({state:I(`slot-conflict`),conflictWith:Tx}),P({state:I(`revision-conflict`),revision:tS})]);let aS=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(vx([`diagnostic`,`stage`,`durationMs`,`stderrTail`])),oS=k().max(64).regex(/^[a-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/u),sS=e=>k().min(1).max(e).refine(e=>e.trim().length>0),cS=Js(oS,N({label:sS(256).optional(),description:sS(1024).optional()}).strict()).refine(e=>Object.keys(e).length<=16,`Too many locales`),lS=Js(oS,sS(4096)).refine(e=>typeof e.en==`string`,`English fallback is required`).refine(e=>Object.keys(e).length<=16,`Too many locales`),uS=k().refine(e=>e.trim().length>0,{message:`Value must not be empty or whitespace`}),dS=uS.max(128).regex(/^[A-Za-z0-9._~:-]+$/u,`Permission Mode ID must use transport-safe characters`).brand(),fS=N({modes:M(N({id:dS,label:uS.max(256),description:uS.max(1024).optional(),dangerous:j().optional(),localizations:cS.optional()}).strict()).min(1).max(32),defaultModeId:dS}).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:ox,permissionModeId:dS}).strict();let pS=A().int().safe().nonnegative(),mS=A().finite().nonnegative(),hS=A().finite().min(0).max(100),gS=N({version:Bs([I(3),I(4)]).optional(),requestId:k().min(1),turnId:k().min(1).max(1024),outputTokens:pS,startedAtMs:pS,completedAtMs:pS}).strict().refine(e=>e.completedAtMs>e.startedAtMs),_S=N({version:Bs([I(2),I(3),I(4)]).optional(),value:mS,turnId:k().min(1).max(1024),at:pS}).strict();N({outputTimings:M(gS).transform(e=>e.filter(e=>e.version===4)).optional(),outputTokensPerSecond:_S.refine(e=>e.version===4).optional().catch(void 0),timeToFirstOutputMs:_S.extend({value:pS}).optional()}).strict();let vS=e=>lS.refine(t=>Object.values(t).every(t=>t.length<=e)),yS=N({composerIndicators:M(N({kind:I(`countdown`),id:k().min(1).max(64),expiresAtUnix:pS,label:vS(256).optional(),tooltip:vS(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:pS.optional(),cachedInputTokens:pS.optional(),cacheWriteInputTokens:pS.optional(),outputTokens:pS.optional(),outputTokensPerSecond:mS.optional(),sessionOutputTokensPerSecond:mS.optional(),apiOutputTokensPerSecond:mS.optional(),reasoningOutputTokens:pS.optional(),totalTokens:pS.optional(),totalCostUsd:mS.optional(),totalCredits:mS.optional(),contextUsagePercent:mS.optional(),cacheHitRatePercent:hS.optional(),contextWindowTokens:pS.optional(),contextUsedTokens:pS.optional(),planFiveHourUsedPercent:hS.optional(),planFiveHourResetsAtUnix:pS.optional(),planSevenDayUsedPercent:hS.optional(),planSevenDayResetsAtUnix:pS.optional(),sessionCacheHitRatePercent:hS.optional(),timeToFirstOutputMs:pS.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`]})}),bS=A().finite().min(0).max(100),xS=F([`weekly`,`monthly`,`five_hour`,`seven_day`,`unknown`]),SS=N({id:k().min(1).max(256),label:k().min(1).max(256),localizations:cS.optional()}).strict(),CS=N({product:k().min(1),periodType:xS.optional(),scope:SS.optional(),localizations:cS.optional(),used:A().finite().nonnegative().optional(),limit:A().finite().nonnegative().optional(),unit:k().min(1).max(32).optional(),usagePercent:bS,resetsAt:k().min(1).optional()}).strict(),wS=N({availableCount:A().int().safe().positive(),nextExpiresAt:k().min(1).optional(),expiresAt:M(k().min(1)).min(1).max(32).optional()}).strict(),TS=N({used:A().finite().nonnegative().optional(),limit:A().finite().nonnegative().optional(),unit:k().min(1).max(32).optional(),label:k().min(1).optional(),scope:SS.optional(),localizations:cS.optional(),usedPercent:bS,resetsAt:k().min(1).optional(),periodType:xS,productUsage:M(CS).min(1).optional(),resetCredits:wS.optional()}).strict(),ES=N({amount:A().finite().nonnegative(),currency:k().trim().min(1).max(8),label:k().trim().min(1).max(128).optional()}).strict();N({threadId:ox,refresh:I(`exact`).optional()}).strict(),N({threadId:ox,usage:yS.nullable(),accountCredits:TS.optional(),accountBalance:ES.optional(),accountCreditsSupported:j().optional()}).strict();let DS=k().refine(e=>e.trim().length>0,{message:`Value must not be empty or whitespace`}),OS=N({id:DS.max(512).regex(/^[A-Za-z0-9._~-]+$/u,`Model Ref must use transport-safe opaque characters`).brand()}).strict(),kS=DS.max(128).regex(/^[A-Za-z0-9._~-]+$/u,`Thinking option ID must use transport-safe characters`).brand(),AS=DS.max(256),jS=N({id:kS,label:DS.max(256)}).strict(),MS=N({ref:OS,label:DS.max(256),resolvedModelLabel:AS.optional(),fastModel:OS.optional(),supportedThinkingOptionIds:M(kS).optional()}).strict(),NS=M(jS).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)}),PS=N({models:M(MS),defaultModel:OS.optional(),thinkingOptions:NS,defaultThinkingOptionId:kS.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`]})}),FS=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`}),IS=F([`live`,`atCreate`]),LS=N({configuration:N({selectModel:j(),selectThinkingOption:j(),selectPermissionMode:j(),permissionModeScope:IS.default(`live`)}).strict(),history:FS,subagents:N({observe:j(),readTranscript:j()}).strict().optional(),autonomousTurns:N({observe:j()}).strict().optional(),steer:j().optional()}).strict();N({effectiveModel:OS.optional(),resolvedModelLabel:AS.optional(),effectiveThinkingOptionId:kS.optional(),availableThinkingOptions:NS.optional(),effectivePermissionModeId:dS.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 RS=N({open:I(!0)}).strict();Bs([N({status:I(`ready`),catalog:PS,permissionModes:fS.optional(),capabilities:LS,webUi:RS.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:aS}).strict()]),N({harnessId:ax,cwd:DS.max(16384).optional(),refresh:j().optional(),purpose:I(`availability`).optional()}).strict(),N({harnessId:ax}).strict(),N({}).strict(),N({threadId:ox,model:OS}).strict(),N({threadId:ox,thinkingOptionId:kS}).strict(),N({threadId:ox,includeReferenceCapability:j().optional()}).strict(),Hs(`owner`,[N({owner:I(`codex`),locked:j(),effectiveModel:OS.optional(),resolvedModelLabel:AS.optional(),effectiveThinkingOptionId:kS.optional(),effectivePermissionModeId:dS.optional(),history:FS.optional(),supportsThreadReferences:I(!0).optional()}).strict(),N({owner:I(`external`),harnessId:DS.max(256),transportModelId:DS.max(1024),effectiveModel:OS.optional(),resolvedModelLabel:AS.optional(),effectiveThinkingOptionId:kS.optional(),availableThinkingOptions:NS.optional(),effectivePermissionModeId:dS.optional(),history:FS,usage:yS.optional(),locked:I(!0)}).strict()]),N({threadIds:M(ox).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 zS=Hs(`owner`,[N({threadId:ox,owner:I(`codex`)}).strict(),N({threadId:ox,owner:I(`external`),harnessId:k().max(256).pipe(ax)}).strict()]);N({threads:M(zS).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:ox,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`}),Et}}).pipe(N({expectedTurnId:sx,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:ox}).strict(),N({confirmed:j()}).strict(),[...eS],N({threadIds:M(k().min(1))}).strict(),N({threadId:k().min(1).max(1024),pinned:j()}).strict(),N({}).strict(),N({parents:Js(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:Js(k(),k()),projectless:M(k()),pinned:M(k())});let BS=Js(k(),Ps()),VS=N({epoch:k().uuid(),sequence:A().int().nonnegative()});Hs(`type`,[N({type:I(`skills-changed`),cursor:VS,cwd:k().optional()}),N({type:I(`harness-inspection-changed`),cursor:VS,harnessId:k().min(1)}),N({type:I(`display-settings-changed`),cursor:VS}),N({type:I(`preferences-changed`),cursor:VS,revision:A().int().nonnegative()}),N({type:I(`hello`),version:I(1),cursor:VS,reset:j()}),N({type:I(`changed`),cursor:VS,threadId:k().min(1),method:k().min(1)})]);let HS=Hs(`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()}))})]),US=Hs(`type`,[N({type:I(`approval`),title:k(),description:k().optional(),subject:Ps().optional(),actions:M(N({id:k(),label:k(),effect:k()}))}),N({type:I(`question`),title:k().optional(),questions:M(HS)})]),WS=N({requestId:Bs([k(),A().int()]),threadId:k(),kind:F([`approval`,`question`]),interaction:US,request:BS}),GS=N({id:k().min(1),clientUserMessageId:k().min(1),input:M(BS),presentationInput:M(BS).nullable().optional()}).passthrough();N({fields:M(N({path:M(Bs([k(),A().int().nonnegative()])),originalLength:A().int().nonnegative()}))});let KS=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(),qS=N({id:k().min(1).max(512),fingerprint:k().min(1).max(128)});N({threadId:k().min(1),knownTurns:M(qS).max(64).optional(),truncateToolOutput:j().optional()});let JS=N({harnessId:k().min(1),nativeSessionId:k().min(1)});N({cursor:VS,activeTurnId:k().min(1).nullable().optional(),command:N({name:k().min(1),turn:KS,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:JS.optional(),turns:M(KS).length(0)}).passthrough(),turnsPage:N({data:M(KS).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:OS.optional(),effectiveThinkingOptionId:kS.optional(),effectivePermissionModeId:dS.optional()}),queue:N({items:M(GS),pausedReason:F([`interrupted`,`outcome-unknown`,`failed`]).nullable()}).optional(),interactions:M(WS)}),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:Bs([k(),A().int()]),result:BS}),N({includeArchived:j().optional(),officialCursor:N({live:k().nullable(),archived:k().nullable().optional()}).strict().optional()}).strict(),N({threads:M(wx),ownership:M(zS),archivedThreadIds:M(ox),officialCursor:N({live:k().nullable(),archived:k().nullable().optional()}).strict().optional()}).strict();let YS=F([`running`,`waiting`,`idle`,`unknown`]),XS=P({harnessId:ax,title:k().optional(),status:YS,archived:j()}),ZS=P({revision:ks().nonnegative(),parents:Js(ox,ox),nodes:Js(ox,XS),truncated:j()}).refine(e=>Object.keys(e.nodes).length<=5e3,`Too many Thread tree nodes`).refine(({parents:e,nodes:t})=>Object.entries(e).every(([e,n])=>Object.hasOwn(t,e)&&Object.hasOwn(t,n)),`Missing Thread tree node`),QS=k().min(1).max(128);P({});let $S=P({subscriptionId:QS});P({}),$S.extend({snapshot:ZS});let eC=k().regex(/^audio\/[a-z0-9.+-]+(?:\s*;[^\r\n]*)?$/i);N({available:j()}).strict(),N({path:k().min(1),mimeType:eC}).strict();let tC=F([`credentials-unavailable`,`login-expired`,`rate-limited`,`service-rejected`,`host-incompatible`,`network`,`timeout`,`audio-empty`,`audio-too-large`,`audio-format`,`audio-invalid`]);Hs(`ok`,[N({ok:I(!0),text:k()}).strict(),N({ok:I(!1),error:N({code:tC}).strict()}).strict()]),N({threadId:ox.optional(),cwd:k().min(1).optional()}).strict().refine(e=>!(e.threadId&&e.cwd),{message:`Specify threadId or cwd, not both`});let nC=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(nC),warnings:M(k()).optional()}).strict(),N({cwd:k().min(1).optional()}).strict();let rC=/\[\$([^\]\r\n]+)\]\((?:<([^<>\r\n]+)>|([^\s()]+))(?:[ \t]+(?:"[^"\r\n]*"|'[^'\r\n]*'))?\)/gu;function iC(e){return[...e.matchAll(rC)].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 aC=N({kind:F([`public`,`relay`,`tailscale-funnel`,`tailscale-https`,`tailscale`,`lan`,`virtual`]),url:k().min(1)}).strict(),oC=Hs(`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:oC,error:k().optional()}).strict();let sC=Hs(`status`,[N({status:I(`on`)}),N({status:I(`off`)}),N({status:I(`invalid`),reason:k()})]),cC=N({lan:j(),autostart:sC}).strict(),lC=N({expiresAt:k().optional(),issuing:j(),failure:N({detail:k().optional(),retryAt:k(),paused:j()}).optional()}),uC=Hs(`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:lC}),N({status:I(`missing-certificate`),url:k(),certificate:lC}),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 dC=F([`official`,`self-hosted`]);N({secret:k().min(1),lastUsedAt:A().nullable(),networkUrls:M(aC),directCandidates:M(aC).optional(),tailscale:oC,background:cC.optional(),relay:N({state:uC,enabled:j(),kind:dC,officialHost:k(),customHost:k().optional(),officialHostname:k().optional(),customHostname:k().optional(),quotaUntil:k().optional()}).strict().optional()}).strict();let fC=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()}),pC=N({id:k().min(1).max(256),harnessId:k().min(1),label:k().min(1).max(512),provider:F([`openai-codex`,`xai`])}).strict(),mC=k().regex(/^[a-z][a-z0-9-]{0,47}$/),hC=N({name:mC,source:pC,importedAt:k()}).strict(),gC=Hs(`action`,[N({action:I(`list`)}).strict(),N({action:I(`import`),sourceId:k().min(1).max(256),name:mC,confirmed:I(!0)}).strict(),N({action:I(`reimport`),sourceId:k().min(1).max(256),name:mC,confirmed:I(!0)}).strict(),N({action:I(`remove`),name:mC,confirmed:I(!0)}).strict()]),_C=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(pC),targets:M(N({harnessId:k(),providers:M(F([`openai-codex`,`xai`])),imports:M(hC),others:M(_C).default([])}).strict())}).strict(),N({targetHarnessId:k().min(1).max(128).optional(),request:gC}).strict(),N({events:j()});let vC=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:vC.nullable()}),P({}),P({entries:vC,initializeOnly:j().optional()});let yC=P({enabled:j(),timeoutMinutes:A().int().min(5).max(1440)});Object.freeze({enabled:!1,timeoutMinutes:10});let bC=k().regex(/^external$/u),xC=ax.transform(e=>String(e)),SC=P({model:OS.optional(),thinkingOptionId:kS.optional(),permissionModeId:dS.optional()}).refine(e=>!!(e.model||e.thinkingOptionId||e.permissionModeId),`A default configuration must contain a preference`),CC=P({lastHarness:ax.optional(),byHarness:Js(xC,SC)}),wC=k().min(1).max(1024),TC=P({idleRelease:yC.optional(),favorites:Js(xC,M(wC).max(2048)).default({}),newThread:CC.optional()});P({scope:bC,revision:A().int().nonnegative(),values:TC}),P({scope:bC.default(`external`)});let EC=Hs(`kind`,[P({kind:I(`idleRelease`),value:yC}),P({kind:I(`favorite`),harnessId:ax,modelId:wC,enabled:j()}),P({kind:I(`favorites`),harnessId:ax,modelIds:M(wC).max(2048)}),P({kind:I(`newThread`),lastHarness:ax.optional(),harnessId:ax.optional(),configuration:SC.optional()})]);P({scope:bC.default(`external`),operations:M(EC).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:Js(bC,TC)});let DC=A().finite().nonnegative(),OC=P({input:DC,output:DC,cacheRead:DC.optional(),cacheWrite:DC.optional(),cacheWrite1h:DC.optional()}),kC=k().max(512).refine(e=>e.trim()===e&&e.length>0,`Model ID is required`);P({path:k(),entries:M(P({key:k(),price:OC})),error:k().nullable()}),P({}),P({key:kC,price:OC.nullable(),previousKey:kC.optional()}),P({model:kC});let AC=P({official:j().optional(),canonicalModelId:k().min(1).optional(),provider:k().min(1).max(512),model:k().min(1).max(512),price:OC});P({price:OC.nullable(),suggestions:M(AC).max(6).optional()});let jC=[`today`,`7d`,`30d`,`90d`,`all`],MC=A().int().min(0).max(2**53-1),NC=k().regex(/^\d{4}-\d{2}-\d{2}$/u),PC=k().min(1).max(128),FC=k().min(1).max(512),IC=k().min(1).max(4096);P({range:F(jC),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:PC.optional(),model:FC.nullable().optional(),project:IC.nullable().optional(),date:NC.optional()});let LC=P({requests:MC,inputTokens:MC,cachedInputTokens:MC,cacheWriteInputTokens:MC,cacheKnownInputTokens:MC,cacheHitCachedInputTokens:MC,cacheHitInputTokens:MC,outputTokens:MC,reasoningOutputTokens:MC,costUsd:A().finite().min(0),unpricedRequests:MC,unmeteredRequests:MC}),RC=LC.shape,zC=P({harness:PC,sessionId:k().min(1).max(512),project:IC.nullable(),title:k().min(1).max(200).optional(),models:M(FC).max(16),firstAtMs:MC,lastAtMs:MC,...RC});P({range:F(jC),from:NC.nullable(),to:NC,filters:P({harness:PC.nullable(),model:FC.nullable(),unknownModel:j(),project:IC.nullable(),unknownProject:j(),date:NC.nullable()}),reading:P({complete:j(),sources:MC,read:MC}),failures:M(P({harness:PC,message:k().max(2048)})).max(256),options:P({harnesses:M(PC).max(256),models:M(FC.nullable()).max(4096),projects:M(IC.nullable()).max(4096)}),modelLabels:M(P({harness:PC,model:FC,label:FC})).max(4096).optional(),credits:M(P({harness:PC,model:FC.nullable(),credits:A().finite().min(0),reportedRequests:MC,requests:MC})).max(4096).optional(),totals:LC,daily:M(P({date:NC,harness:PC,...RC})).max(2e5),hourly:M(P({weekday:A().int().min(0).max(6),hour:A().int().min(0).max(23),...RC})).max(168),byHarness:M(P({harness:PC,...RC})).max(256),byModel:M(P({model:FC.nullable(),...RC,harnessPricedRequests:MC})).max(4096),byProject:M(P({project:IC.nullable(),...RC})).max(4096),sessions:M(zC).max(100),recentSessions:M(zC).max(100).optional()}),N({threadId:ox}),N({discarded:j()});let BC=Hs(`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()})]),VC=N({interactionId:k().min(1),turnId:k().min(1),title:k().optional(),questions:M(BC).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(VC)}),P({threadId:k().min(1),turnId:k().min(1),interactionId:k().min(1),answers:Js(k(),M(k())),cancelled:j().default(!1)}),N({accepted:I(!0)});let HC=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(HC)}),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 UC=F([`idle`,`running`,`busy`,`closing`,`failed`,`blocked`]),WC=F([`none`,`disabled`,`timeout`,`operation`,`background`,`identity`,`persistence`,`closeFailed`]);P({threadId:k(),title:k(),harnessId:k(),state:UC,reason:WC,inactiveMs:A().nonnegative()}),P({threadId:ox,turnId:sx});let GC=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:TS.optional(),balance:ES.optional()}).strict();function KC(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 qC=KC(GC),JC={harnessId:ax,harnessName:k().trim().min(1).max(128)},YC=N(JC).strict();N({}).strict(),N({sources:M(YC).max(128)}).strict(),N({harnessId:ax,refresh:j().optional()}).strict(),N({...JC,account:qC.nullable(),accounts:M(qC).max(8).optional()}).strict(),N({refresh:j().optional()}).strict(),N({accounts:M(KC(GC.extend(JC))).max(128)}).strict(),N({harnessId:ux,model:OS.optional(),thinkingOptionId:kS.optional(),permissionModeId:dS.optional(),prewarm:I(!0).optional()}).strict();let XC=k().trim().min(1).max(4096).refine(e=>!/[\u0000\r\n]/u.test(e),`Invalid entrypoint path`);N({harnessId:ux}).strict().extend({path:XC.nullable()}),N({path:XC.nullable(),restartRequired:j()}).strict(),N({harnessId:ax,action:F([`check`,`update`,`install`])}).strict();let ZC=N({currentVersion:k().min(1).max(128),latestVersion:k().min(1).max(128),updateAvailable:j(),canUpdate:j(),versionKind:F([`cli`,`application`]).optional(),manualUpdateUrl:ds().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:lS.optional(),latestVersionKind:F([`unknown`,`tracking-branch`]).optional()}).strict();N({taskId:k().uuid()}).strict(),Hs(`status`,[N({taskId:k().uuid(),status:I(`running`)}).strict(),N({taskId:k().uuid(),status:I(`succeeded`),result:ZC}).strict(),N({taskId:k().uuid(),status:I(`failed`),error:N({code:A().int(),message:k().min(1).max(2048)}).strict()}).strict()]);let QC=k().min(1).max(256).regex(/^[A-Za-z0-9._~-]+$/u),$C=k().trim().min(1),ew=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`]),tw=N({accountId:QC,label:$C.max(256),email:k().email().max(320).optional(),planType:ew.optional()}).strict(),nw=F([`ready`,`unavailable`]);N({version:I(2),currentAccountId:QC.nullable(),phase:nw,revision:A().int().nonnegative(),instanceId:$C.max(1024).optional(),accounts:M(tw).max(1)}).strict(),N({accountId:QC,refresh:j().optional()}).strict(),N({accountId:QC,usage:yS.nullable(),accountCredits:TS.optional(),freshness:F([`live`,`cached`]),observedAt:k().datetime().nullable()}).strict();let rw=1e3,iw=k().refine(e=>e.trim().length>0,`Value must not be empty or whitespace`).refine(e=>!e.includes(`\0`),`Value must not contain NUL`),aw=iw.max(1024),ow=N({nativeSessionId:aw,title:iw.max(4096).nullable(),updatedAt:A().int().nonnegative().max(864e13),cwd:iw.max(16384),running:j().nullable()}).strict();N({}).strict(),N({harnesses:M(N({harnessId:ux,name:iw.max(128)}).strict()).max(128)}).strict(),N({harnessId:ux,query:k().trim().max(4096).refine(e=>!e.includes(`\0`)).optional(),offset:A().int().nonnegative().safe().optional(),limit:A().int().min(1).max(rw).optional()}).strict(),N({candidates:M(ow).max(rw),total:A().int().nonnegative().safe()}).strict(),N({harnessId:ux,nativeSessionId:aw}).strict(),N({threadId:iw.max(1024).pipe(ox)}).strict();let sw=k().refine(e=>e.trim().length>0,`Value must not be empty or whitespace`).refine(e=>!e.includes(`\0`),`Value must not contain NUL`),cw=aw,lw=ow;N({}).strict(),N({candidates:M(lw).max(1e3)}).strict(),N({nativeSessionId:cw}).strict(),N({threadId:sw.max(1024).pipe(ox)}).strict(),N({threadId:ox,lastTurnId:sx}).strict(),N({threadId:ox}).strict();let uw=k().trim().min(1).max(128).regex(/^[A-Za-z0-9._:-]+$/u).brand();N({commands:M(N({id:uw,invocation:k().min(1).max(128),label:k().trim().min(1).max(128),description:k().trim().min(1).max(512).optional(),localizations:cS.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:ax,cwd:k().min(1).optional()}).strict(),N({threadId:ox}).strict(),N({threadId:ox,commandId:uw,turnId:sx.optional(),arguments:wx.optional()}).strict(),N({accepted:I(!0),turnId:sx.optional()}).strict();let dw=I(`2.0`).optional(),fw=Is().optional(),pw=k().min(1),mw=Bs([k(),A().int()]),hw=N({code:A().int(),message:k(),data:Cx.optional()}).catchall(Cx).superRefine(vx([`data`]));Bs([N({jsonrpc:dw,id:mw,method:pw,params:Cx.optional(),result:fw,error:fw}).catchall(Cx).superRefine(vx([`jsonrpc`,`params`,`result`,`error`])),N({jsonrpc:dw,id:fw,method:pw,params:Cx.optional(),result:fw,error:fw}).catchall(Cx).superRefine(vx([`jsonrpc`,`id`,`params`,`result`,`error`])),N({jsonrpc:dw,id:mw,method:fw,params:fw,result:Cx,error:fw}).catchall(Cx).superRefine(vx([`jsonrpc`,`method`,`params`,`error`])),N({jsonrpc:dw,id:mw,method:fw,params:fw,result:fw,error:hw}).catchall(Cx).superRefine(vx([`jsonrpc`,`method`,`params`,`result`]))]);let gw=k().refine(e=>e.trim().length>0,{message:`Native identifier must not be empty or whitespace`});P({harnessId:ax,nativeSessionId:gw,locator:Cx.optional(),formatVersion:I(1)}).superRefine(vx([`locator`])),P({harnessId:ax,nativeSessionId:gw,nativeTurnKey:gw,formatVersion:I(1)}),P({harnessId:ax,nativeSessionId:gw,checkpointId:gw,locator:Cx.optional(),formatVersion:I(1)}).superRefine(vx([`locator`]));let _w=k().regex(/^\d+\.\d+\.\d+(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/u),vw=F([`npm`,`windows-installer`,`macos-dmg`]),yw=P({version:_w,installation:vw,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 bw=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:_w,installation:vw.nullable(),latestVersion:_w.nullable(),updateAvailable:j(),installationAvailable:j(),releaseNotes:k().min(1).max(2e4).nullable(),releaseNotesUrl:bw.nullable(),status:yw.nullable(),error:k().min(1).max(500).nullable()}),P({status:yw}),P({status:yw.nullable()}),RegExp(String.raw`^- \[([^\]\n]+)\]\(thread://([^\s()<>"?#/]+)\): `+`(${[`completed`,`failed`,`interrupted`,`needsInput`,`timedOut`,`unreadable`,`notFound`].join(`|`)})(?:\. (.+))?$`,`u`);function xw(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 Sw(e,t){let n=xw(e);return n===``?t:`${n}\n## My request:\n${t}\n`}let Cw=F([`idle`,`installing`,`restarting`,`succeeded`,`failed`]);N({runningVersion:k().nullable(),installedVersion:k().nullable(),restartRequired:j(),remote:j(),updateSupported:j(),update:N({phase:Cw,targetVersion:k().nullable(),error:k().nullable()})});let ww=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 Tw=k().min(1).max(1024),Ew={hostId:Tw.regex(/^remote-(?:ssh(?:-|:)|control:)/u)},Dw={...Ew,threadId:Tw},Ow=Hs(`kind`,[P({kind:I(`hosts`)}),P({kind:I(`status`),...Dw}),P({kind:I(`list`),...Ew,cursor:k().nullable(),archived:j()}),P({kind:I(`read`),...Dw,page:P({cursor:k().min(1).max(8192).nullable(),epoch:Tw.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`),...Dw,epoch:Tw}),P({kind:I(`configure`),...Dw,epoch:Tw,modelId:Tw.optional(),thinkingOptionId:Tw.optional(),permissionModeId:Tw.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`),...Dw,epoch:Tw,text:k().min(1).max(8e3),requestId:Tw.optional()}),P({kind:I(`interrupt`),...Dw,epoch:Tw,turnId:Tw}),P({kind:I(`rename`),...Dw,epoch:Tw,name:k().min(1).max(512)}),P({kind:I(`archive`),...Dw,epoch:Tw,archived:j()}),P({kind:I(`respond`),...Dw,epoch:Tw,requestId:Bs([Tw,A().int()]),result:Js(k(),Ps())})]),kw=k().min(1).max(1024),Aw=N({hostId:kw,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()}),jw=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()});Hs(`action`,[P({action:I(`session`),operation:Ow}),P({action:I(`list`)}),P({action:I(`catalog`)}),P({action:I(`read-thread`),hostId:kw.refine(e=>e!==`local`),input:fC}),P({action:I(`save`),draft:jw,previous:Aw.nullable()}),P({action:I(`remove`),previous:Aw}),P({action:I(`connect`),hostId:kw,enabled:j()}),P({action:I(`state`),hostId:kw}),P({action:I(`runtime`),hostId:kw}),P({action:I(`update`),hostId:kw.refine(e=>e!==`local`),version:ww.shape.version})]),Bs([P({result:Cx}),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 Mw=k().max(214).regex(/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/u),Nw=Bs([k(),N({en:k()}).catchall(k())]),Pw=N({title:Nw.optional(),description:Nw.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:Mw,name:k().min(1).max(214),version:k().min(1).max(128),format:I(`dsh`),supportedTargets:Ks([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:Pw.optional(),loadError:k().optional()})),loadedIds:M(Mw),safeMode:j(),storeError:k().optional()});let Fw=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:Fw.optional()}).strict(),N({id:Mw,enabled:j()}).strict(),N({id:Mw}).strict(),I(1);function Iw(e){return e.registerNodeTransform(Rf,e=>{let t=iC(e.getTextContent())[0];t&&e.splitText(t.start,t.end)[t.start===0?0:1]?.replace(new Hb({source:`codexhost-skill`,ref:t.text,label:t.name,appearance:`skill`,clipboardText:t.text}))})}let Lw=`color: var(--dsw-alias-state-business-primary)`;function Rw(){let e=Dh().getFirstChild();if(!G(e))return null;let t=e.getFirstChild();return V(t)?t:null}function zw(e,t){return e.registerNodeTransform(Rf,e=>{let n=Rw();if(n===null||e.getKey()!==n.getKey()){e.getStyle()===Lw&&e.setStyle(``);return}let r=e.getTextContent(),i=t(),a=r===i?.trimEnd()?r:i;if(a===null||!r.startsWith(a))e.getStyle()===Lw&&e.setStyle(``);else if(r.length>a.length){let[t,n]=e.splitText(a.length);t!==void 0&&t.getStyle()!==Lw&&t.setStyle(Lw),n?.setStyle(``)}else e.getStyle()!==Lw&&e.setStyle(Lw)})}function Bw(e){e.update(()=>{Rw()?.markDirty()})}function Vw(){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(Wb(e))o(`chip`,e,``,e.getTextContent());else if(V(e)){let t=e.getTextContent();o(`text`,e,t,t)}else Fm(e)?o(`linebreak`,e,`
|
|
155
|
+
`}isInline(){return!1}updateDOM(){return!1}};function Ny(){return{node:Py()}}function Py(){return a_(My)}Date.now;function Fy(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 Iy;function Ly(e,t){let{key:n}=t;return e&&n in e?e[n]:t.defaultValue}function Ry(e){return Iy&&Iy.editor===e?Iy:void 0}function zy(e,t){if(`cfg`in t){let{cfg:n,updater:r}=t;return[n,r(Ly(e,n))]}return t}function By(e,t){let n=t;for(let r of e){let[e,i]=zy(n,r),a=e.key;if(n===t&&Ly(n,e)===i)continue;let o=n===t||n===void 0?Vy(t):n;o[a]=i,n=o}return n}function Vy(e){return Object.create(e||null)}function Hy(e,t){return[e,t]}function Uy(e,t,n,r=Lg()){let i=Iy,a=Ry(r);try{return Iy={...a,editor:r,[e]:t},n()}finally{Iy=i}}function Wy(e,t=()=>{}){return(n,r=Lg())=>i=>{let a=Ry(r),o=a&&a[e],s=By(n,o||t(r));return s&&s!==o?Uy(e,s,i,r):i()}}function Gy(e,t,n,r){return Object.assign(Hl(Symbol(t),{isEqual:r,parse:n}),{[e]:!0})}let Ky=`@lexical/html/DOM`,qy=Symbol.for(`@lexical/html/DOMExportContext`);function Jy(e,t,n){return Gy(qy,e,t,n)}let Yy=/* @__PURE__ */ Jy(`isExport`,Boolean);function Xy(e){let t=jy(e,Ky);return t?t.output.defaults:void 0}function Zy(e){let t=jy(e,Ky);return t?t.output.runtime:void 0}function Qy(e=Lg()){let t=Zy(e);return t?t.getSessionConfig():Rg(e)}let $y=Wy(qy,Xy),eb=Symbol.for(`@lexical/html/SelectorImpl`);function tb(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=>tb(e,[...t,n]);return{[eb]:n,attr:(e,t,n)=>i(ib(e,t,n)),classAll:(...e)=>i(rb(e)),classAny:(...e)=>i(function(e){let t=nb(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)}}Fy(362,JSON.stringify(e))}(e,t,n))}}function nb(e){let t=[];for(let n of e)n&&t.push(n);return t}function rb(e){let t=nb(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 ib(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)}}Fy(361,JSON.stringify(e))}let ab={kind:`text`,predicate:dh,tags:/* @__PURE__ */ new Set},ob={[eb]:ab},sb={kind:`comment`,predicate:e=>e.nodeType===8,tags:/* @__PURE__ */ new Set},cb={[eb]:sb},lb={any:()=>tb(/* @__PURE__ */ new Set,[]),comment:()=>cb,tag(...e){e.length>0||Fy(363);let t=/* @__PURE__ */ new Set;for(let n of e)t.add(n.toUpperCase());return tb(t,[])},text:()=>ob},ub=lb;ub.tag(`b`,`strong`,`em`,`i`,`code`,`mark`,`s`,`sub`,`sup`,`u`,`span`),ub.text(),ub.tag(`script`,`style`),ub.tag(`br`),ub.tag(`p`),ub.tag(`hr`),ub.any(),Object.freeze([]),Object.freeze({}),lb.any(),lb.any,lb.comment,lb.tag,lb.text;function db(e,t=null,n=Lg()){return $y([Hy(Yy,!0)],n)(()=>{let r=Dh(),i=Qy(n),a=H(t)?h_(t.anchor.getNode()):null,o=e.append.bind(e);for(let e of(G(a)?a:r).getChildren())pb(n,e,o,t,i);return e})}function fb(e,t=null){return(typeof document>`u`||typeof window>`u`&&global.window===void 0)&&Fy(338),im(e),db(bg().createElement(`div`),t,e).innerHTML}function pb(e,t,n,r=null,i=Rg(e)){let a=i.$shouldInclude(t,r,e),o=i.$shouldExclude(t,r,e),s=t;r!==null&&V(t)&&(s=zv(r,t,`clone`));let{element:c,after:l,append:u,$getChildNodes:d}=i.$exportDOM(s,e);if(!c)return!1;let f=bg().createDocumentFragment(),p=d?d():G(s)?s.getChildren():[],m=a&&sp(r)&&G(t)?null:r,h=f.append.bind(f);for(let n of p){let o=pb(e,n,h,m,i);!a&&o&&i.$extractWithChild(t,n,r,`html`,e)&&(a=!0)}if(a&&!o){if((Y(c)||jg(c))&&(u?u(f):c.append(f)),n(c),l){let e=l.call(s,c);e&&(jg(c)?c.replaceChildren(e):c.replaceWith(e))}}else n(f);return a}function mb(e,t,n=null){let r=yg(n),i=n?_g(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=Xh(n)}return!1}(a.offsetNode,n))return{node:a.offsetNode,offset:a.offset}}if(a){let i=n.getRootNode();if(hg(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 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 gb(e,t=U()){return t??hb(166),H(t)&&t.isCollapsed()||t.getNodes().length===0?``:fb(e,t)}function _b(e,t){let n=e.getData(`text/plain`)||e.getData(`text/uri-list`);n!=null&&t.insertRawText(n)}let vb=`application/x-lexical-drag`;function yb(e,t){let n={editorKey:t.getKey()};e.setData(vb,JSON.stringify(n))}function bb(e,t,n){let r=e.dataTransfer;if(r===null)return!1;let i=function(e){let t=e.getData(vb);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=mb(e.clientX,e.clientY,t.getRootElement());if(n===null)return null;let r=wh(n.node);if(r===null)return null;if(V(r))return K_(r,`next`,n.offset);if(G(r))return Sv(r,n.offset,`next`);let i=r.getParent();return i===null?null:Sv(i,r.getIndexWithinParent()+1,`next`)}(e,t);if(a===null)return!1;let o=Tv(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}=xv(pv(t),`next`);return iv(n,e)<0&&iv(e,r)<0}(a,c))return e.preventDefault(),!0;c.removeText()}if(!o.origin.isAttached())return e.preventDefault(),!0;if(n(r,dv(tv(o)),t),!s){let e=t.getRootElement(),n=e?e.ownerDocument:null,r=n?function(e,t){for(let n of vg(t)){let t=ch(n);if(oh(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 xb(e,t){return bb(e,t,(e,t)=>_b(e,t))}function Sb(e,t){t.update(()=>{if(e!==null){let n=Kv(e,KeyboardEvent)?null:e.clipboardData,r=U();if(r!==null&&!r.isCollapsed()&&n!=null){e.preventDefault();let i=gb(t);i!==null&&n.setData(`text/html`,i),n.setData(`text/plain`,r.getTextContent())}}})}function Cb(e){return Mv(e.registerCommand(rd,e=>{let t=U();return!!H(t)&&(t.deleteCharacter(e),!0)},0),e.registerCommand(ld,e=>{let t=U();return!!H(t)&&(t.deleteWord(e),!0)},0),e.registerCommand(ud,e=>{let t=U();return!!H(t)&&(t.deleteLine(e),!0)},0),e.registerCommand(od,e=>{let t=U();if(!H(t))return!1;if(typeof e==`string`)t.insertText(e);else{let n=e.dataTransfer;if(n!=null)_b(n,t);else{let n=e.data;n&&t.insertText(n)}}return!0},0),e.registerCommand(cd,()=>{let e=U();return!!H(e)&&(e.removeText(),!0)},0),e.registerCommand(id,e=>{let t=U();return!!H(t)&&(t.insertLineBreak(e),!0)},0),e.registerCommand(ad,()=>{let e=U();return!!H(e)&&(e.insertLineBreak(),!0)},0),e.registerCommand(_d,e=>{let t=U();if(!H(t))return!1;let n=e,r=n.shiftKey;return!!Hv(t,!0)&&(n.preventDefault(),Gv(t,r,!0),!0)},0),e.registerCommand(hd,e=>{let t=U();if(!H(t))return!1;let n=e,r=n.shiftKey;return!!Hv(t,!1)&&(n.preventDefault(),Gv(t,r,!1),!0)},0),e.registerCommand(Cd,t=>!!H(U())&&(!nl||!tl)&&(t.preventDefault(),e.dispatchCommand(rd,!0)),0),e.registerCommand(Td,t=>!!H(U())&&(t.preventDefault(),e.dispatchCommand(rd,!1)),0),e.registerCommand(xd,t=>{if(!H(U()))return!1;if(t!==null){if((nl||il||sl)&&tl)return!1;t.preventDefault()}return e.dispatchCommand(id,!1)},0),e.registerCommand(Nd,()=>{let e=U();return Uh(H(e)&&h_(e.anchor.getNode())!==null?e:null),!0},0),e.registerCommand(jd,t=>!!H(U())&&(Sb(t,e),!0),0),e.registerCommand(Md,t=>!!H(U())&&(function(e,t){Sb(e,t),t.update(()=>{let e=U();H(e)&&e.removeText()},{tag:`cut`})}(t,e),!0),0),e.registerCommand(sd,t=>!!H(U())&&(function(e,t){e.preventDefault(),t.update(()=>{let t=U(),n=Kv(e,ClipboardEvent)?e.clipboardData:null;n!=null&&H(t)&&_b(n,t)},{tag:`paste`})}(t,e),!0),0),e.registerCommand(Dd,t=>xb(t,e),0),e.registerCommand(Od,t=>{let n=U();return!!H(n)&&(n.isCollapsed()||t.dataTransfer===null||yb(t.dataTransfer,e),!0)},0))}function wb(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||Tm(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 Tb(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:wb(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 Eb(e,t){e.undoStack=[],e.redoStack=[],e.current=null,t&&t(e)}function Db(e,t,n,r=Date.now,i,a=null){let o=Tb(e,n,r),s=()=>{i&&i(t)};return s(),Mv(e.registerCommand(fd,()=>(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(Id,!0)),i.length===0&&e.dispatchCommand(Ld,!1),t.current=o||null,n&&n(t),o&&o.editor.setEditorState(o.editorState,{tag:`historic`})}}(e,t,i),!0),0),e.registerCommand(pd,()=>(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(Ld,!0));let o=r.pop();r.length===0&&e.dispatchCommand(Id,!1),t.current=o||null,n&&n(t),o&&o.editor.setEditorState(o.editorState,{tag:`historic`})}}(e,t,i),!0),0),e.registerCommand(Pd,()=>(Eb(t,i),!1),0),e.registerCommand(Fd,()=>(Eb(t,i),e.dispatchCommand(Id,!1),e.dispatchCommand(Ld,!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(Id,!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(Ld,!0)}}else if(m===2)return;t.current={editor:e,editorState:n},s()}))}function Ob(){return{current:null,redoStack:[],undoStack:[]}}Date.now;let kb=`application/x-codexhost-thread-reference`;function Ab(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 jb(e){return`thread://${encodeURIComponent(e.threadId).replace(/[!'()*]/gu,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)}?hostId=${encodeURIComponent(e.hostId)}`}function Mb(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 Nb(e){let t=`[@${e.title.replace(/[\\`*{}[\]()#+.!_<>|~-]/gu,e=>`\\${e}`)}](${jb(e)})`;return{source:`codexhost-thread`,ref:t,label:e.title,appearance:`session`,clipboardText:t}}function Pb(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:Ab({id:n,blank:!1,title:i,projectionValues:{threadReference:{hostId:r,threadId:n}}})}catch{return}}function Fb(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=Fb(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function Ib(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=Fb(e))&&(r&&(r+=` `),r+=t);return r}let Lb=`@deepseek-ai/dsh-client-ui-conversation/ReferenceChip.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Lb)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-conversation`,e.dataset.pluginCss=Lb,e.textContent=`.ieyLPW_chip{max-width:240px;color:var(--dsw-alias-state-business-primary);user-select:none;align-items:baseline;gap:3px;display:inline-flex}.ieyLPW_marker{flex:none;font-weight:500}.ieyLPW_icon{flex:none;align-self:center}.ieyLPW_label{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.ieyLPW_invalid{color:var(--dsw-alias-state-error-primary);opacity:.7;text-decoration:line-through}`,document.head.appendChild(e)}var Rb={chip:`ieyLPW_chip`,icon:`ieyLPW_icon`,invalid:`ieyLPW_invalid`,label:`ieyLPW_label`,marker:`ieyLPW_marker`};let zb=`@deepseek-ai/dsh-client-ui-conversation/composer-editor.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(zb)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-conversation`,e.dataset.pluginCss=zb,e.textContent=`.hTX3Lq_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}.hTX3Lq_reference:hover{background:var(--dsw-alias-state-business-tertiary)}.hTX3Lq_openable{cursor:pointer}.hTX3Lq_textRef{max-width:100%;display:inline-block}`,document.head.appendChild(e)}var Bb={openable:`hTX3Lq_openable`,reference:`hTX3Lq_reference`,textRef:`hTX3Lq_textRef`};function Vb({label:e,reference:t,appearance:n,invalid:r}){return/* @__PURE__ */ (0,h.jsxs)(`span`,{className:Ib(Bb.reference,Rb.chip,n===`file`&&!r&&Bb.openable,r&&Rb.invalid),title:e,children:[n===void 0?/* @__PURE__ */ (0,h.jsx)(`span`,{className:Rb.marker,"aria-hidden":!0,children:`@`}):/* @__PURE__ */ (0,h.jsx)(d.ReferenceIconRegular,{kind:n,reference:t,size:14,className:Rb.icon}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:Rb.label,children:e})]})}var Hb=class e extends Cm{__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)(Vb,{label:this.__label,reference:this.__ref,appearance:this.__appearance,invalid:this.__invalid})}};function Ub(e){return new Hb(e)}function Wb(e){return e instanceof Hb}function Gb(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 Kb(e,t,n,r){let i=e=>e instanceof n,a=e=>{let t=qf(e.getTextContent());t.setFormat(e.getFormat()),e.replace(t)};return[e.registerNodeTransform(Rf,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&&Gb(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 qb=/(^|\s)([/@])([\w-]+)/g,Jb=/(^|\s)(@(?:"[^"\n]*"?|[^\s"]\S*))/g,Yb=/* @__PURE__ */ new Set(`.,;:!?,。;:!?`),Xb=/^@.*[/\\.]/u;function Zb(e,t,n){if(!n.startsWith(`@"`)){let e=n.length;for(;Yb.has(n.charAt(e-1));)--e;return Xb.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(;Yb.has(e.charAt(i));)i+=1;return i===e.length||/\s/u.test(e.charAt(i))?t+r+1:void 0}let Qb=/^(?:\s|$)/;function $b(e,t){if(e===``)return[];let n=[];qb.lastIndex=0;let r;for(;(r=qb.exec(e))!==null;){let i=r[2],a=r[3]??``;if((i!==`/`||Qb.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})}}Jb.lastIndex=0;let i;for(;(i=Jb.exec(e))!==null;){let t=i.index+(i[1]?.length??0),r=Zb(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 ex=class e extends Rf{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=Ib(t.className,Bb.reference,Bb.textRef,this.getTextContent().startsWith(`/`)&&Bb.openable),t.setAttribute(`spellcheck`,`false`),t.setAttribute(`data-composer-text-ref`,``),t}isTextEntity(){return!0}canInsertTextBefore(){return!0}};function tx(e,t,n){return Mv(...Kb(e,e=>{let r=n();for(let n of $b(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},ex,e=>new ex(e.getTextContent())))}function nx(e){e.update(()=>{for(let e of Dh().getAllTextNodes())(e instanceof ex||e.getPreviousSibling()instanceof ex||/[/@]/u.test(e.getTextContent()))&&e.markDirty()},{tag:wf})}function rx(e,t){return e.registerCommand(Qu,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=wh(e.target);if(Wb(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 ex&&t(void 0,{ref:r.getTextContent()})},1)}function ix(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 ax=Bs([k(),A(),j(),Ms()]);function ox(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 sx=bc(ox,{message:`JSON value must not contain circular references`}),cx=vc(()=>Bs([ax,M(cx),Js(k(),cx)])),lx=sx.pipe(cx);sx.pipe(M(cx));let ux=sx.pipe(Js(k(),cx)),dx=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(ix([`diagnostic`,`stage`,`durationMs`,`stderrTail`])),fx=k().max(64).regex(/^[a-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/u),px=e=>k().min(1).max(e).refine(e=>e.trim().length>0),mx=Js(fx,N({label:px(256).optional(),description:px(1024).optional()}).strict()).refine(e=>Object.keys(e).length<=16,`Too many locales`),hx=Js(fx,px(4096)).refine(e=>typeof e.en==`string`,`English fallback is required`).refine(e=>Object.keys(e).length<=16,`Too many locales`),gx=k().refine(e=>e.trim().length>0,{message:`Identifier must not be empty or whitespace`}),_x=gx.brand(),vx=gx.brand(),yx=gx.brand();gx.brand(),gx.brand();let bx=k().refine(e=>e.trim().length>0,{message:`Value must not be empty or whitespace`}),xx=bx.max(128).regex(/^[A-Za-z0-9._~:-]+$/u,`Permission Mode ID must use transport-safe characters`).brand(),Sx=N({modes:M(N({id:xx,label:bx.max(256),description:bx.max(1024).optional(),dangerous:j().optional(),localizations:mx.optional()}).strict()).min(1).max(32),defaultModeId:xx}).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:vx,permissionModeId:xx}).strict();let Cx=A().int().safe().nonnegative(),wx=A().finite().nonnegative(),Tx=A().finite().min(0).max(100),Ex=N({version:Bs([I(3),I(4)]).optional(),requestId:k().min(1),turnId:k().min(1).max(1024),outputTokens:Cx,startedAtMs:Cx,completedAtMs:Cx}).strict().refine(e=>e.completedAtMs>e.startedAtMs),Dx=N({version:Bs([I(2),I(3),I(4)]).optional(),value:wx,turnId:k().min(1).max(1024),at:Cx}).strict();N({outputTimings:M(Ex).transform(e=>e.filter(e=>e.version===4)).optional(),outputTokensPerSecond:Dx.refine(e=>e.version===4).optional().catch(void 0),timeToFirstOutputMs:Dx.extend({value:Cx}).optional()}).strict();let Ox=e=>hx.refine(t=>Object.values(t).every(t=>t.length<=e)),kx=N({composerIndicators:M(N({kind:I(`countdown`),id:k().min(1).max(64),expiresAtUnix:Cx,label:Ox(256).optional(),tooltip:Ox(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:Cx.optional(),cachedInputTokens:Cx.optional(),cacheWriteInputTokens:Cx.optional(),outputTokens:Cx.optional(),outputTokensPerSecond:wx.optional(),sessionOutputTokensPerSecond:wx.optional(),apiOutputTokensPerSecond:wx.optional(),reasoningOutputTokens:Cx.optional(),totalTokens:Cx.optional(),totalCostUsd:wx.optional(),totalCredits:wx.optional(),contextUsagePercent:wx.optional(),cacheHitRatePercent:Tx.optional(),contextWindowTokens:Cx.optional(),contextUsedTokens:Cx.optional(),planFiveHourUsedPercent:Tx.optional(),planFiveHourResetsAtUnix:Cx.optional(),planSevenDayUsedPercent:Tx.optional(),planSevenDayResetsAtUnix:Cx.optional(),sessionCacheHitRatePercent:Tx.optional(),timeToFirstOutputMs:Cx.optional(),latestRequestTimeToFirstOutputMs:Cx.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`]})}),Ax=A().finite().min(0).max(100),jx=F([`weekly`,`monthly`,`five_hour`,`seven_day`,`unknown`]),Mx=N({id:k().min(1).max(256),label:k().min(1).max(256),localizations:mx.optional()}).strict(),Nx=N({product:k().min(1),periodType:jx.optional(),scope:Mx.optional(),localizations:mx.optional(),used:A().finite().nonnegative().optional(),limit:A().finite().nonnegative().optional(),unit:k().min(1).max(32).optional(),usagePercent:Ax,resetsAt:k().min(1).optional()}).strict(),Px=N({availableCount:A().int().safe().positive(),nextExpiresAt:k().min(1).optional(),expiresAt:M(k().min(1)).min(1).max(32).optional()}).strict(),Fx=N({used:A().finite().nonnegative().optional(),limit:A().finite().nonnegative().optional(),unit:k().min(1).max(32).optional(),label:k().min(1).optional(),scope:Mx.optional(),localizations:mx.optional(),usedPercent:Ax,resetsAt:k().min(1).optional(),periodType:jx,productUsage:M(Nx).min(1).optional(),resetCredits:Px.optional()}).strict(),Ix=N({amount:A().finite().nonnegative(),currency:k().trim().min(1).max(8),label:k().trim().min(1).max(128).optional()}).strict();N({threadId:vx,refresh:I(`exact`).optional()}).strict(),N({threadId:vx,usage:kx.nullable(),accountCredits:Fx.optional(),accountBalance:Ix.optional(),accountCreditsSupported:j().optional()}).strict();let Lx=k().refine(e=>e.trim().length>0,{message:`Value must not be empty or whitespace`}),Rx=k().min(1).max(512).refine(e=>!/\p{Cc}/u.test(e),`Model Ref must not contain control characters`).brand(),zx=F([`priority`,`ultrafast`]),Bx=N({id:Rx,serviceTier:zx.optional()}).strict();function Vx(e,t){return e?.id===t?.id&&e?.serviceTier===t?.serviceTier}let Hx=Lx.max(128).regex(/^[A-Za-z0-9._~-]+$/u,`Thinking option ID must use transport-safe characters`).brand(),Ux=Lx.max(256),Wx=N({id:Hx,label:Lx.max(256)}).strict(),Gx=N({ref:Bx,label:Lx.max(256),resolvedModelLabel:Ux.optional(),fastModel:Bx.optional(),supportedThinkingOptionIds:M(Hx).optional()}).strict().refine(e=>e.fastModel?.serviceTier===void 0||e.fastModel.id===e.ref.id,{path:[`fastModel`,`id`],message:`A tiered Fast Model must share the base Model ID`});function Kx(e,t){if(t)return e?.models.find(e=>Vx(e.ref,t)||Vx(e.fastModel,t))}let qx=M(Wx).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)}),Jx=N({models:M(Gx),defaultModel:Bx.optional(),thinkingOptions:qx,defaultThinkingOptionId:Hx.optional()}).strict().superRefine((e,t)=>{let n=[],r=new Set(e.thinkingOptions.map(({id:e})=>e));for(let[i,a]of e.models.entries()){n.some(e=>Vx(e,a.ref))&&t.addIssue({code:`custom`,message:`Model Catalog refs must be unique`,path:[`models`,i,`ref`,`id`]}),n.push(a.ref),a.fastModel&&(n.some(e=>Vx(e,a.fastModel))&&t.addIssue({code:`custom`,message:`Fast Model refs must be distinct and unique`,path:[`models`,i,`fastModel`]}),n.push(a.fastModel));let e=/* @__PURE__ */ new Set;for(let[n,o]of(a.supportedThinkingOptionIds??[]).entries())e.has(o)&&t.addIssue({code:`custom`,message:`Supported Thinking option IDs must be unique per Model`,path:[`models`,i,`supportedThinkingOptionIds`,n]}),e.add(o),r.has(o)||t.addIssue({code:`custom`,message:`Supported Thinking option must exist in the catalog`,path:[`models`,i,`supportedThinkingOptionIds`,n]})}e.defaultModel&&!Kx(e,e.defaultModel)&&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`]})}),Yx=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`}),Xx=F([`live`,`atCreate`]),Zx=N({configuration:N({selectModel:j(),selectThinkingOption:j(),selectPermissionMode:j(),permissionModeScope:Xx.default(`live`)}).strict(),history:Yx,subagents:N({observe:j(),readTranscript:j()}).strict().optional(),autonomousTurns:N({observe:j()}).strict().optional(),steer:j().optional(),persistentPlan:j().optional()}).strict();N({effectiveModel:Bx.optional(),resolvedModelLabel:Ux.optional(),effectiveThinkingOptionId:Hx.optional(),availableThinkingOptions:qx.optional(),effectivePermissionModeId:xx.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 Qx=N({open:I(!0)}).strict();Bs([N({status:I(`ready`),catalog:Jx,permissionModes:Sx.optional(),capabilities:Zx,webUi:Qx.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:dx}).strict()]),N({harnessId:_x,cwd:Lx.max(16384).optional(),refresh:j().optional(),purpose:I(`availability`).optional(),credentialAccess:F([`allow`,`retry`]).optional()}).strict(),N({harnessId:_x}).strict(),N({}).strict(),N({threadId:vx,model:Bx}).strict(),N({threadId:vx,thinkingOptionId:Hx}).strict(),N({threadId:vx,includeReferenceCapability:j().optional()}).strict(),Hs(`owner`,[N({owner:I(`codex`),locked:j(),effectiveModel:Bx.optional(),resolvedModelLabel:Ux.optional(),effectiveThinkingOptionId:Hx.optional(),effectivePermissionModeId:xx.optional(),history:Yx.optional(),supportsThreadReferences:I(!0).optional()}).strict(),N({owner:I(`external`),harnessId:Lx.max(256),transportModelId:Lx.max(8192),effectiveModel:Bx.optional(),resolvedModelLabel:Ux.optional(),effectiveThinkingOptionId:Hx.optional(),availableThinkingOptions:qx.optional(),effectivePermissionModeId:xx.optional(),history:Yx,usage:kx.optional(),locked:I(!0)}).strict()]),N({threadIds:M(vx).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 $x=Hs(`owner`,[N({threadId:vx,owner:I(`codex`)}).strict(),N({threadId:vx,owner:I(`external`),harnessId:k().max(256).pipe(_x)}).strict()]);N({threads:M($x).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:vx,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`}),Et}}).pipe(N({expectedTurnId:yx,clientUserMessageId:k().min(1),delivery:F([`newTurn`,`activeTurn`])}).strict())}).strict().transform(e=>e.value),F([`activeTurn`,`newTurn`]),N({delivery:F([`official`,`activeTurn`,`newTurn`])}).strict();let eS=k().min(1).max(128).regex(/^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/u),tS=eS.pipe(_x),nS=tS.refine(e=>e!==`codex`,`The official Codex identity is reserved`),rS=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`),iS=ds().refine(e=>/^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(e),`Plugin documentation links must be credential-free HTTPS URLs`),aS=N({en:k().max(4096),"zh-CN":k().max(4096).optional()}).strict(),oS=N({commands:M(N({terminal:k().max(256),command:k().max(4096)}).strict()).max(8),before:aS.optional(),after:aS.optional(),downloads:M(N({label:k().max(128),url:iS}).strict()).max(8).optional()}).strict(),sS={id:tS,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:oS.optional(),notice:aS.optional(),launchCommand:I(!0).optional(),links:N({website:iS.optional(),documentation:iS.optional(),installation:iS.optional()}).strict().optional()};N({manifestVersion:I(1),...sS,adapterApiVersion:A().int().positive(),entry:rS,icon:rS.optional()}).strict();let cS=k().max(174828).regex(/^data:image\/(?:png|jpeg|webp|svg\+xml);base64,[A-Za-z0-9+/]+={0,2}$/u),lS=N({...sS,icon:cS.optional()}).strict();N({}).strict(),N({plugins:M(lS.extend({id:nS})).max(128)}).strict(),N({version:I(1),enabled:M(tS).max(128)}).strict().refine(e=>new Set(e.enabled).size===e.enabled.length,{message:`Enabled plugin IDs must be unique`,path:[`enabled`]});let uS=eS,dS=F([`sidebar.thread-layout`,`sidebar.thread-badge`,`appearance.theme`]),fS=F([`appearance`,`interface`,`workflow`,`analytics`,`integrations`,`tools`]),pS=k().trim().min(1).max(128);function mS(e){switch(e.match(/\.([^./]+)$/u)?.[1]?.toLowerCase()){case`png`:return`image/png`;case`jpg`:case`jpeg`:return`image/jpeg`;case`webp`:return`image/webp`;default:return}}let hS=e=>e.split(`/`).every(e=>!/[. ]$/u.test(e)),gS=rS.refine(e=>mS(e)!==void 0&&hS(e),`Images must be relative .png, .jpg, .jpeg, or .webp paths with no segments ending in a dot or space`),_S=k().trim().max(2048).regex(/^https?:\/\/[^/?#\\\s]+/iu,`Expected an HTTP(S) URL`).pipe(ds({protocol:/^https?$/u})).refine(e=>{let{username:t,password:n}=new URL(e);return!t&&!n&&!/[\\\s]/u.test(e)},`URL must not contain credentials, backslashes, or whitespace`);function vS(e){return P({en:e,"zh-CN":e})}let yS=vS(k().trim().min(1)),bS=M(fS).max(fS.options.length).refine(e=>new Set(e).size===e.length,`Duplicate categories`),xS=M(dS).max(dS.options.length).refine(e=>new Set(e).size===e.length,`Duplicate slots`),SS={key:k().regex(/^[A-Za-z_][A-Za-z0-9_]*$/u),label:yS,description:yS.optional()},CS={...SS,step:A().positive().optional(),default:A().optional()},wS=P({value:k(),label:yS}),TS=Hs(`type`,[P({...SS,type:I(`boolean`),default:j().optional()}),P({...SS,type:I(`string`),placeholder:yS.optional(),default:k().optional()}),P({...CS,type:I(`number`),min:A().optional(),max:A().optional()}),P({...CS,type:I(`range`),min:A(),max:A()}),P({...SS,type:I(`select`),options:M(wS).min(1),default:k().optional()})]).superRefine((e,t)=>{let n=(e,n)=>t.addIssue({code:`custom`,path:[e],message:n});if(e.type===`number`||e.type===`range`){let{min:t=-1/0,max:r=1/0,default:i}=e;t>r&&n(`max`,`Must be at least min`),i!==void 0&&(i<t||i>r)&&n(`default`,`Must be within min and max`)}else if(e.type===`select`){let t=new Set(e.options.map(({value:e})=>e));t.size!==e.options.length&&n(`options`,`Duplicate option values`),e.default!==void 0&&!t.has(e.default)&&n(`default`,`Must match an option value`)}}),ES=N({manifestVersion:ks().positive(),id:uS,name:Bs([pS,vS(pS)]),version:k().min(1).max(128),desktopApi:ks().positive()}).passthrough().extend({manifestVersion:I(1),desktopApi:I(1),description:P({en:k().max(4096),"zh-CN":k().max(4096).optional()}).optional(),author:k().trim().min(1).max(128).optional(),repository:_S.optional(),details:P({en:k().max(16384),"zh-CN":k().max(16384).optional()}).optional(),icon:gS.optional(),screenshots:M(gS).max(4).refine(e=>new Set(e).size===e.length,`Duplicate screenshots`).optional(),desktop:P({script:rS,style:rS.optional()}).optional(),backend:P({script:rS.refine(hS)}).optional(),slots:xS.default(()=>[]),settingsSchema:M(TS).max(32).refine(e=>new Set(e.map(({key:e})=>e)).size===e.length,`Duplicate setting keys`).optional(),categories:bS.optional()}).strict().refine(e=>e.desktop!==void 0||e.backend!==void 0,`Expected at least one desktop or backend entry`),DS=k().regex(/^[a-f0-9]{64}$/u),OS=P({state:F([`running`,`disabled`,`invalid`,`incompatible`,`conflict`,`failed`,`waiting`]),hash:DS.optional(),error:k().optional(),conflictWith:uS.optional()});P({controllerPid:ks().positive(),targetId:k().nullable(),updatedAt:Po(),handledReloadToken:ls().optional(),extensions:Js(k(),OS),surfaces:Js(k(),OS).optional()});let kS=F([`official`,`community`]);function AS(e){return e.origin===`https://api.github.com`&&/^\/repos\/[\w-]+\/[\w.-]+\/zipball(?:\/[^/]+)?\/?$/u.test(e.pathname)}let jS=_S.refine(e=>{let t=new URL(e);return/\.zip$/iu.test(t.pathname)||AS(t)||t.origin===`https://github.com`&&/^\/[\w-]+\/[\w.-]+\/zipball(?:\/.+)?\/?$/u.test(t.pathname)||t.origin===`https://codeload.github.com`&&/^\/[\w-]+\/[\w.-]+\/(?:zip|zipball|legacy\.zip)\/.+$/u.test(t.pathname)},`Expected a .zip download URL or a GitHub zipball URL`),MS=P({id:uS,version:k().trim().min(1).max(128),name:yS.extend({en:pS,"zh-CN":pS}),description:vS(k().trim().min(1).max(4096)),details:vS(k().trim().min(1).max(16384)).optional(),author:k().trim().min(1).max(128),repository:_S,stars:A().int().min(0).optional(),downloads:A().int().min(0).optional(),categories:bS.optional(),trustTier:kS.default(`community`),icon:_S.optional(),screenshots:M(_S).max(4).optional(),downloadUrl:jS,sha256:DS,slots:xS.optional(),publishedAt:k().optional(),updatedAt:k().optional(),minCodexHostVersion:k().optional()});P({schemaVersion:I(1),generatedAt:k(),extensions:M(MS).refine(e=>new Set(e.map(({id:e})=>e)).size===e.length,`Duplicate extension IDs`)});let NS=k().trim().min(1).max(128),PS=/^(?:con|prn|aux|nul|com[1-9¹²³]|lpt[1-9¹²³]) *(?:\.|$)/iu,FS=uS.refine(e=>!PS.test(e),`Reserved extension ID`),IS=F([`desktop`,`web`]),LS=DS,RS=ls(),zS=rS.refine(e=>!/[\x00-\x1f\x7f<>"|*]/u.test(e)&&e.split(`/`).every(e=>!/[. ]$/u.test(e)&&!PS.test(e)),`Expected a portable relative resource path`).refine(e=>e.split(`/`).length<=32,`Extension resources may be at most 32 segments deep`),BS=ES.shape,VS=(e,t=0)=>P({en:k().trim().min(t).max(e),"zh-CN":k().trim().min(t).max(e)}),HS=e=>zS.refine(t=>t.endsWith(e),`Expected a ${e} file`),US=HS(`.mjs`),WS=HS(`.css`).optional(),GS=e=>e.normalize(`NFC`).toLowerCase(),KS=P({manifestVersion:I(2),id:FS,name:VS(128,1),version:k().trim().min(1).max(128),description:VS(4096),details:VS(16384).optional(),author:BS.author,repository:BS.repository,icon:BS.icon.refine(e=>e===void 0||zS.safeParse(e).success),screenshots:BS.screenshots.refine(e=>e===void 0||e.every(e=>zS.safeParse(e).success)),categories:BS.categories,settingsSchema:BS.settingsSchema,slots:BS.slots.removeDefault().optional(),page:P({apiVersion:I(1),entry:US,style:WS,title:VS(128,1).optional()}).optional(),widget:P({apiVersion:I(1),entry:US,style:WS}).optional(),desktop:P({apiVersion:I(1),script:HS(`.js`),style:WS}).optional(),web:P({apiVersion:I(1),entry:US.optional(),style:WS}).refine(({entry:e,style:t})=>e!==void 0||t!==void 0,`Expected a Web entry or style`).optional(),backend:P({apiVersion:I(1),entry:US}).optional()}).refine(({page:e,widget:t,desktop:n,web:r,backend:i})=>!!(e||t||n||r||i),`Expected at least one page, widget, desktop, web, or backend entry`).refine(({page:e,widget:t,web:n,backend:r})=>!r||[e?.entry,t?.entry,n?.entry].every(e=>e===void 0||GS(e)!==GS(r.entry)),{path:[`backend`,`entry`],message:`A backend entry cannot also be a frontend entry`});function qS({hasPage:e,hasWidget:t,hasDesktop:n,hasWeb:r,hasBackend:i}){if(e||t||i&&!n&&!r)return[`desktop`,`web`];let a=[];return n&&a.push(`desktop`),r&&a.push(`web`),a}let JS=NS,YS=ks().nonnegative(),XS=P({revision:YS,enabled:M(FS).max(64).refine(e=>new Set(e).size===e.length,`Duplicate extension IDs`)}),{downloadUrl:ZS,...QS}=MS.shape,$S=N({...QS,id:FS,format:I(`codexhost`),targets:M(IS).min(1).max(2).refine(e=>new Set(e).size===e.length,`Duplicate targets`),apis:P({page:ks().positive().optional(),widget:ks().positive().optional(),desktop:ks().positive().optional(),web:ks().positive().optional(),backend:ks().positive().optional()}),downloadUrl:ZS.refine(e=>e.startsWith(`https://`),`Expected HTTPS`)}).refine(({targets:e,apis:t})=>{let n=qS({hasPage:!!t.page,hasWidget:!!t.widget,hasDesktop:!!t.desktop,hasWeb:!!t.web,hasBackend:!!t.backend});return e.length===n.length&&n.every(t=>e.includes(t))},`Catalog targets must match the declared APIs`);N({schemaVersion:I(2),generatedAt:k().min(1),extensions:M($S).max(1e4).refine(e=>new Set(e.map(({id:e})=>e)).size===e.length,`Duplicate extension IDs`)}).extend({catalogUrl:_S,fetchedAt:Po(),cached:j()});let eC={id:FS},tC={...eC,activationId:RS,digest:LS},nC={...eC,activationId:tC.activationId.optional()},rC=k().min(1).max(4096).refine(e=>/^(?:\/|[a-z]:[/\\])/iu.test(e)&&!e.includes(`\0`)&&!e.split(/[/\\]/u).some(e=>e===`.`||e===`..`),`Expected an absolute local path without dot segments`),iC=k().min(1).max(256).refine(e=>e.split(`/`).every(e=>e&&/^[a-z0-9_.-]+$/iu.test(e)&&e!==`.`&&e!==`..`),`Invalid GitHub ref`);function aC(e){return k().max(4*Math.ceil(e/3)).refine(t=>{let n=t.endsWith(`==`)?2:+!!t.endsWith(`=`);return t.length%4==0&&t.length*3/4-n<=e&&/^[A-Za-z0-9+/]*={0,2}$/u.test(t)},`Expected bounded standard padded base64`)}let oC=P({type:I(`github`),repository:k().max(150).regex(/^[a-z0-9-]+\/[a-z0-9_-][a-z0-9_.-]*$/iu),ref:iC.optional(),tag:iC.optional(),asset:k().max(255).regex(/^[a-z0-9_.-]+\.zip$/iu).optional(),subpath:zS.optional()}).refine(({ref:e,tag:t,asset:n})=>!e||!t&&!n,`Use either a zipball ref or a release tag/asset`),sC=Bs([P({type:I(`catalog`),...eC}),oC,P({type:I(`zip`),base64:aC(67108864).min(4)}),P({type:I(`zip`),localZipPath:rC}),P({type:I(`localDir`),localDir:rC})]),cC=Hs(`type`,[P({type:I(`catalog`),...eC}),oC,P({type:I(`zip`)}),P({type:I(`localDir`)})]),lC=P({...tC,manifest:KS,installedAt:Po(),source:cC.optional()}),uC=e=>k().max(23+4*Math.ceil(e/3)).regex(/^data:image\/(?:png|jpeg|webp);base64,[A-Za-z0-9+/]+={0,2}$/u),dC={desktopConflictWith:FS.optional()},fC=F([`none`,`inactive`,`starting`,`running`,`failed`]),pC=Hs(`state`,[lC.extend({state:I(`valid`),enabled:j(),...dC,iconDataUrl:uC(131072).optional(),screenshotDataUrls:M(uC(524288)).max(4).optional(),backendState:fC.optional(),backendError:k().optional()}),P({state:F([`invalid`,`incompatible`]),id:k().min(1),enabled:j(),error:k()})]);P({revision:YS,configuration:XS,diagnostics:M(k()),extensions:M(pC)}),P({revision:YS,extensions:M(lC.extend({...dC,settingsRevision:YS})).max(64)});let mC={list:`codexhost/extensions/list`,snapshot:`codexhost/extensions/snapshot`,catalog:`codexhost/extensions/catalog`,install:`codexhost/extensions/install`,update:`codexhost/extensions/update`,enable:`codexhost/extensions/enable`,disable:`codexhost/extensions/disable`,uninstall:`codexhost/extensions/uninstall`,recover:`codexhost/extensions/recover`,asset:`codexhost/extensions/asset`,settingsGet:`codexhost/extensions/settings/get`,settingsSet:`codexhost/extensions/settings/set`,backendInvoke:`codexhost/extensions/backend/invoke`},hC=Object.freeze(Object.values(mC));new Set(hC),P({});let gC={expectedRevision:YS};P({...eC,...gC}),lC.extend({replaced:j()}),Hs(`state`,[P({state:I(`saved`),configuration:XS}),P({state:I(`revision-conflict`),revision:YS})]),P({...nC,digest:tC.digest.optional(),path:zS}),P({mimeType:k().min(1),base64:aC(16777216),digest:tC.digest}),P({settingsRevision:YS,values:ux}),mC.list,mC.snapshot,mC.catalog,P({forceRefresh:j().optional()}),mC.install,P({source:sC}),mC.update,P({...eC,expectedDigest:tC.digest,expectedActivationId:tC.activationId.optional(),source:sC.optional()}),mC.enable,mC.disable,mC.uninstall,P({...eC,removeData:j().optional(),expectedDigest:tC.digest.optional()}),P({...eC,removed:j()}),mC.recover,P({expectedRevision:gC.expectedRevision.optional()}),mC.asset,mC.settingsGet,P(nC),mC.settingsSet,P({...nC,expectedSettingsRevision:YS,values:ux}),mC.backendInvoke,P({...nC,method:JS,params:lx.optional()}),P({result:lx}),N({threadId:vx}).strict(),N({confirmed:j()}).strict(),[...hC],N({threadIds:M(k().min(1))}).strict(),N({threadId:k().min(1).max(1024),pinned:j()}).strict(),N({}).strict(),N({parents:Js(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:Js(k(),k()),projectless:M(k()),pinned:M(k())});let _C=Js(k(),Ps()),vC=N({epoch:k().uuid(),sequence:A().int().nonnegative()});Hs(`type`,[N({type:I(`skills-changed`),cursor:vC,cwd:k().optional()}),N({type:I(`harness-inspection-changed`),cursor:vC,harnessId:k().min(1)}),N({type:I(`display-settings-changed`),cursor:vC}),N({type:I(`preferences-changed`),cursor:vC,revision:A().int().nonnegative()}),N({type:I(`extensions-changed`),cursor:vC,revision:YS}),N({type:I(`hello`),version:I(1),cursor:vC,reset:j()}),N({type:I(`changed`),cursor:vC,threadId:k().min(1),method:k().min(1)})]);let yC=Hs(`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()}))})]),bC=Hs(`type`,[N({type:I(`approval`),title:k(),description:k().optional(),subject:Ps().optional(),actions:M(N({id:k(),label:k(),effect:k()}))}),N({type:I(`question`),title:k().optional(),questions:M(yC)})]),xC=N({requestId:Bs([k(),A().int()]),threadId:k(),kind:F([`approval`,`question`]),interaction:bC,request:_C}),SC=N({id:k().min(1),clientUserMessageId:k().min(1),input:M(_C),presentationInput:M(_C).nullable().optional()}).passthrough();N({fields:M(N({path:M(Bs([k(),A().int().nonnegative()])),originalLength:A().int().nonnegative()}))});let CC=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(),wC=N({id:k().min(1).max(512),fingerprint:k().min(1).max(128)});N({threadId:k().min(1),knownTurns:M(wC).max(64).optional(),truncateToolOutput:j().optional()});let TC=N({harnessId:k().min(1),nativeSessionId:k().min(1)});N({cursor:vC,activeTurnId:k().min(1).nullable().optional(),command:N({name:k().min(1),turn:CC,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:TC.optional(),turns:M(CC).length(0)}).passthrough(),turnsPage:N({data:M(CC).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:Bx.optional(),effectiveThinkingOptionId:Hx.optional(),effectivePermissionModeId:xx.optional()}),queue:N({items:M(SC),pausedReason:F([`interrupted`,`outcome-unknown`,`failed`]).nullable()}).optional(),interactions:M(xC)}),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:Bs([k(),A().int()]),result:_C}),N({includeArchived:j().optional(),officialCursor:N({live:k().nullable(),archived:k().nullable().optional()}).strict().optional()}).strict(),N({threads:M(ux),ownership:M($x),archivedThreadIds:M(vx),officialCursor:N({live:k().nullable(),archived:k().nullable().optional()}).strict().optional()}).strict();let EC=F([`running`,`waiting`,`idle`,`unknown`]),DC=P({harnessId:_x,title:k().optional(),status:EC,archived:j()}),OC=P({revision:ks().nonnegative(),parents:Js(vx,vx),nodes:Js(vx,DC),truncated:j()}).refine(e=>Object.keys(e.nodes).length<=5e3,`Too many Thread tree nodes`).refine(({parents:e,nodes:t})=>Object.entries(e).every(([e,n])=>Object.hasOwn(t,e)&&Object.hasOwn(t,n)),`Missing Thread tree node`),kC=k().min(1).max(128);P({});let AC=P({subscriptionId:kC});P({}),AC.extend({snapshot:OC});let jC=k().regex(/^audio\/[a-z0-9.+-]+(?:\s*;[^\r\n]*)?$/i);N({available:j()}).strict(),N({path:k().min(1),mimeType:jC}).strict();let MC=F([`credentials-unavailable`,`login-expired`,`rate-limited`,`service-rejected`,`host-incompatible`,`network`,`timeout`,`audio-empty`,`audio-too-large`,`audio-format`,`audio-invalid`]);Hs(`ok`,[N({ok:I(!0),text:k()}).strict(),N({ok:I(!1),error:N({code:MC}).strict()}).strict()]),N({threadId:vx.optional(),cwd:k().min(1).optional()}).strict().refine(e=>!(e.threadId&&e.cwd),{message:`Specify threadId or cwd, not both`});let NC=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(NC),warnings:M(k()).optional()}).strict(),N({cwd:k().min(1).optional()}).strict();let PC=/\[\$([^\]\r\n]+)\]\((?:<([^<>\r\n]+)>|([^\s()]+))(?:[ \t]+(?:"[^"\r\n]*"|'[^'\r\n]*'))?\)/gu;function FC(e){return[...e.matchAll(PC)].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 IC=N({kind:F([`public`,`relay`,`tailscale-funnel`,`tailscale-https`,`tailscale`,`lan`,`virtual`]),url:k().min(1)}).strict(),LC=Hs(`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:LC,error:k().optional()}).strict();let RC=Hs(`status`,[N({status:I(`on`)}),N({status:I(`off`)}),N({status:I(`invalid`),reason:k()})]),zC=N({lan:j(),autostart:RC}).strict(),BC=N({expiresAt:k().optional(),issuing:j(),failure:N({detail:k().optional(),retryAt:k(),paused:j()}).optional()}),VC=Hs(`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:BC}),N({status:I(`missing-certificate`),url:k(),certificate:BC}),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 HC=F([`official`,`self-hosted`]);N({secret:k().min(1),lastUsedAt:A().nullable(),networkUrls:M(IC),directCandidates:M(IC).optional(),tailscale:LC,background:zC.optional(),relay:N({state:VC,enabled:j(),kind:HC,officialHost:k(),customHost:k().optional(),officialHostname:k().optional(),customHostname:k().optional(),quotaUntil:k().optional()}).strict().optional()}).strict();let UC=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()}),WC=N({id:k().min(1).max(256),harnessId:k().min(1),label:k().min(1).max(512),provider:F([`openai-codex`,`xai`])}).strict(),GC=k().regex(/^[a-z][a-z0-9-]{0,47}$/),KC=N({name:GC,source:WC,importedAt:k()}).strict(),qC=Hs(`action`,[N({action:I(`list`)}).strict(),N({action:I(`import`),sourceId:k().min(1).max(256),name:GC,confirmed:I(!0)}).strict(),N({action:I(`reimport`),sourceId:k().min(1).max(256),name:GC,confirmed:I(!0)}).strict(),N({action:I(`remove`),name:GC,confirmed:I(!0)}).strict()]),JC=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(WC),targets:M(N({harnessId:k(),providers:M(F([`openai-codex`,`xai`])),imports:M(KC),others:M(JC).default([])}).strict())}).strict(),N({targetHarnessId:k().min(1).max(128).optional(),request:qC}).strict(),N({events:j()});let YC=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:YC.nullable()}),P({}),P({entries:YC,initializeOnly:j().optional()});let XC=P({enabled:j(),timeoutMinutes:A().int().min(5).max(1440)});Object.freeze({enabled:!1,timeoutMinutes:10});let ZC=k().regex(/^external$/u),QC=_x.transform(e=>String(e)),$C=P({model:Bx.optional(),thinkingOptionId:Hx.optional(),permissionModeId:xx.optional()}).refine(e=>!!(e.model||e.thinkingOptionId||e.permissionModeId),`A default configuration must contain a preference`),ew=P({lastHarness:_x.optional(),byHarness:Js(QC,$C)}),tw=P({model:Bx.optional(),thinkingOptionId:Hx.optional()}).refine(e=>!!(e.model||e.thinkingOptionId),`A delegation default must contain a Model or Thinking option`),nw=P({byHarness:Js(QC,tw)}),rw=k().min(1).max(1024),iw=P({idleRelease:XC.optional(),favorites:Js(QC,M(rw).max(2048)).default({}),newThread:ew.optional(),delegation:nw.optional()});P({scope:ZC,revision:A().int().nonnegative(),values:iw}),P({scope:ZC.default(`external`)});let aw=Hs(`kind`,[P({kind:I(`idleRelease`),value:XC}),P({kind:I(`favorite`),harnessId:_x,modelId:rw,enabled:j()}),P({kind:I(`favorites`),harnessId:_x,modelIds:M(rw).max(2048)}),P({kind:I(`newThread`),lastHarness:_x.optional(),harnessId:_x.optional(),configuration:$C.optional()}),P({kind:I(`delegation`),harnessId:_x,configuration:tw.nullable()})]);P({scope:ZC.default(`external`),operations:M(aw).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:Js(ZC,iw)});let ow=A().finite().nonnegative(),sw=P({input:ow,output:ow,cacheRead:ow.optional(),cacheWrite:ow.optional(),cacheWrite1h:ow.optional()}),cw=k().max(512).refine(e=>e.trim()===e&&e.length>0,`Model ID is required`);P({path:k(),entries:M(P({key:k(),price:sw})),error:k().nullable()}),P({}),P({key:cw,price:sw.nullable(),previousKey:cw.optional()}),P({model:cw});let lw=P({official:j().optional(),canonicalModelId:k().min(1).optional(),provider:k().min(1).max(512),model:k().min(1).max(512),price:sw});P({price:sw.nullable(),suggestions:M(lw).max(6).optional()});let uw=[`today`,`7d`,`30d`,`90d`,`all`],dw=A().int().min(0).max(2**53-1),fw=k().regex(/^\d{4}-\d{2}-\d{2}$/u),pw=k().min(1).max(128),mw=k().min(1).max(512),hw=k().min(1).max(4096);P({range:F(uw),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:pw.optional(),model:mw.nullable().optional(),project:hw.nullable().optional(),date:fw.optional()});let gw=P({requests:dw,inputTokens:dw,cachedInputTokens:dw,cacheWriteInputTokens:dw,cacheKnownInputTokens:dw,cacheHitCachedInputTokens:dw,cacheHitInputTokens:dw,outputTokens:dw,reasoningOutputTokens:dw,costUsd:A().finite().min(0),unpricedRequests:dw,unmeteredRequests:dw}),_w=gw.shape,vw=P({harness:pw,sessionId:k().min(1).max(512),project:hw.nullable(),title:k().min(1).max(200).optional(),models:M(mw).max(16),firstAtMs:dw,lastAtMs:dw,..._w});P({range:F(uw),from:fw.nullable(),to:fw,filters:P({harness:pw.nullable(),model:mw.nullable(),unknownModel:j(),project:hw.nullable(),unknownProject:j(),date:fw.nullable()}),reading:P({complete:j(),sources:dw,read:dw}),failures:M(P({harness:pw,message:k().max(2048)})).max(256),options:P({harnesses:M(pw).max(256),models:M(mw.nullable()).max(4096),projects:M(hw.nullable()).max(4096)}),modelLabels:M(P({harness:pw,model:mw,label:mw})).max(4096).optional(),credits:M(P({harness:pw,model:mw.nullable(),credits:A().finite().min(0),reportedRequests:dw,requests:dw})).max(4096).optional(),totals:gw,daily:M(P({date:fw,harness:pw,..._w})).max(2e5),hourly:M(P({weekday:A().int().min(0).max(6),hour:A().int().min(0).max(23),..._w})).max(168),byHarness:M(P({harness:pw,..._w})).max(256),byModel:M(P({model:mw.nullable(),..._w,harnessPricedRequests:dw})).max(4096),byProject:M(P({project:hw.nullable(),..._w})).max(4096),sessions:M(vw).max(100),recentSessions:M(vw).max(100).optional()}),N({threadId:vx}),N({discarded:j()});let yw=Hs(`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()})]),bw=N({interactionId:k().min(1),turnId:k().min(1),title:k().optional(),questions:M(yw).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(bw)}),P({threadId:k().min(1),turnId:k().min(1),interactionId:k().min(1),answers:Js(k(),M(k())),cancelled:j().default(!1)}),N({accepted:I(!0)});let xw=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(xw)}),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 Sw=F([`idle`,`running`,`busy`,`closing`,`failed`,`blocked`]),Cw=F([`none`,`disabled`,`timeout`,`operation`,`background`,`identity`,`persistence`,`closeFailed`]);P({threadId:k(),title:k(),harnessId:k(),state:Sw,reason:Cw,inactiveMs:A().nonnegative()}),P({threadId:vx,turnId:yx});let ww=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:Fx.optional(),balance:Ix.optional()}).strict();function Tw(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 Ew=Tw(ww),Dw={harnessId:_x,harnessName:k().trim().min(1).max(128)},Ow=N(Dw).strict();N({}).strict(),N({sources:M(Ow).max(128)}).strict(),N({harnessId:_x,refresh:j().optional()}).strict(),N({...Dw,account:Ew.nullable(),accounts:M(Ew).max(8).optional()}).strict(),N({refresh:j().optional()}).strict(),N({accounts:M(Tw(ww.extend(Dw))).max(128)}).strict(),N({harnessId:nS,model:Bx.optional(),thinkingOptionId:Hx.optional(),permissionModeId:xx.optional(),prewarm:I(!0).optional()}).strict();let kw=k().trim().min(1).max(4096).refine(e=>!/[\u0000\r\n]/u.test(e),`Invalid entrypoint path`);N({harnessId:nS}).strict().extend({path:kw.nullable()}),N({path:kw.nullable(),restartRequired:j()}).strict(),N({harnessId:_x,action:F([`check`,`update`,`install`])}).strict();let Aw=N({currentVersion:k().min(1).max(128),latestVersion:k().min(1).max(128),updateAvailable:j(),canUpdate:j(),versionKind:F([`cli`,`application`]).optional(),manualUpdateUrl:ds().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:hx.optional(),latestVersionKind:F([`unknown`,`tracking-branch`]).optional()}).strict();N({taskId:k().uuid()}).strict(),Hs(`status`,[N({taskId:k().uuid(),status:I(`running`)}).strict(),N({taskId:k().uuid(),status:I(`succeeded`),result:Aw}).strict(),N({taskId:k().uuid(),status:I(`failed`),error:N({code:A().int(),message:k().min(1).max(2048)}).strict()}).strict()]);let jw=k().min(1).max(256).regex(/^[A-Za-z0-9._~-]+$/u),Mw=k().trim().min(1),Nw=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`]),Pw=N({accountId:jw,label:Mw.max(256),email:k().email().max(320).optional(),planType:Nw.optional()}).strict(),Fw=F([`ready`,`unavailable`]);N({version:I(2),currentAccountId:jw.nullable(),phase:Fw,revision:A().int().nonnegative(),instanceId:Mw.max(1024).optional(),accounts:M(Pw).max(1)}).strict(),N({accountId:jw,refresh:j().optional()}).strict(),N({accountId:jw,usage:kx.nullable(),accountCredits:Fx.optional(),freshness:F([`live`,`cached`]),observedAt:k().datetime().nullable()}).strict();let Iw=1e3,Lw=k().refine(e=>e.trim().length>0,`Value must not be empty or whitespace`).refine(e=>!e.includes(`\0`),`Value must not contain NUL`),Rw=Lw.max(1024),zw=N({nativeSessionId:Rw,title:Lw.max(4096).nullable(),updatedAt:A().int().nonnegative().max(864e13),cwd:Lw.max(16384),running:j().nullable()}).strict();N({}).strict(),N({harnesses:M(N({harnessId:nS,name:Lw.max(128)}).strict()).max(128)}).strict(),N({harnessId:nS,query:k().trim().max(4096).refine(e=>!e.includes(`\0`)).optional(),offset:A().int().nonnegative().safe().optional(),limit:A().int().min(1).max(Iw).optional()}).strict(),N({candidates:M(zw).max(Iw),total:A().int().nonnegative().safe()}).strict(),N({harnessId:nS,nativeSessionId:Rw}).strict(),N({threadId:Lw.max(1024).pipe(vx)}).strict();let Bw=k().refine(e=>e.trim().length>0,`Value must not be empty or whitespace`).refine(e=>!e.includes(`\0`),`Value must not contain NUL`),Vw=Rw,Hw=zw;N({}).strict(),N({candidates:M(Hw).max(1e3)}).strict(),N({nativeSessionId:Vw}).strict(),N({threadId:Bw.max(1024).pipe(vx)}).strict(),N({threadId:vx,lastTurnId:yx}).strict(),N({threadId:vx}).strict();let Uw=k().trim().min(1).max(128).regex(/^[A-Za-z0-9._:-]+$/u).brand();N({commands:M(N({id:Uw,invocation:k().min(1).max(128),label:k().trim().min(1).max(128),description:k().trim().min(1).max(512).optional(),localizations:mx.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:_x,cwd:k().min(1).optional()}).strict(),N({threadId:vx}).strict(),N({threadId:vx,commandId:Uw,turnId:yx.optional(),arguments:ux.optional()}).strict(),N({accepted:I(!0),turnId:yx.optional()}).strict();let Ww=I(`2.0`).optional(),Gw=Is().optional(),Kw=k().min(1),qw=Bs([k(),A().int()]),Jw=N({code:A().int(),message:k(),data:lx.optional()}).catchall(lx).superRefine(ix([`data`]));Bs([N({jsonrpc:Ww,id:qw,method:Kw,params:lx.optional(),result:Gw,error:Gw}).catchall(lx).superRefine(ix([`jsonrpc`,`params`,`result`,`error`])),N({jsonrpc:Ww,id:Gw,method:Kw,params:lx.optional(),result:Gw,error:Gw}).catchall(lx).superRefine(ix([`jsonrpc`,`id`,`params`,`result`,`error`])),N({jsonrpc:Ww,id:qw,method:Gw,params:Gw,result:lx,error:Gw}).catchall(lx).superRefine(ix([`jsonrpc`,`method`,`params`,`error`])),N({jsonrpc:Ww,id:qw,method:Gw,params:Gw,result:Gw,error:Jw}).catchall(lx).superRefine(ix([`jsonrpc`,`method`,`params`,`result`]))]);let Yw=k().refine(e=>e.trim().length>0,{message:`Native identifier must not be empty or whitespace`});P({harnessId:_x,nativeSessionId:Yw,locator:lx.optional(),formatVersion:I(1)}).superRefine(ix([`locator`])),P({harnessId:_x,nativeSessionId:Yw,nativeTurnKey:Yw,formatVersion:I(1)}),P({harnessId:_x,nativeSessionId:Yw,checkpointId:Yw,locator:lx.optional(),formatVersion:I(1)}).superRefine(ix([`locator`]));let Xw=k().regex(/^\d+\.\d+\.\d+(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/u),Zw=F([`npm`,`windows-installer`,`macos-dmg`]),Qw=P({version:Xw,installation:Zw,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 $w=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:Xw,installation:Zw.nullable(),latestVersion:Xw.nullable(),updateAvailable:j(),installationAvailable:j(),releaseNotes:k().min(1).max(2e4).nullable(),releaseNotesUrl:$w.nullable(),status:Qw.nullable(),error:k().min(1).max(500).nullable()}),P({status:Qw}),P({status:Qw.nullable()}),RegExp(String.raw`^- \[([^\]\n]+)\]\(thread://([^\s()<>"?#/]+)\): `+`(${[`completed`,`failed`,`interrupted`,`needsInput`,`timedOut`,`unreadable`,`notFound`].join(`|`)})(?:\. (.+))?$`,`u`);function eT(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 tT(e,t){let n=eT(e);return n===``?t:`${n}\n## My request:\n${t}\n`}let nT=F([`idle`,`installing`,`restarting`,`succeeded`,`failed`]);N({runningVersion:k().nullable(),installedVersion:k().nullable(),restartRequired:j(),remote:j(),updateSupported:j(),update:N({phase:nT,targetVersion:k().nullable(),error:k().nullable()})});let rT=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 iT=k().min(1).max(1024),aT={hostId:iT.regex(/^remote-(?:ssh(?:-|:)|control:)/u)},oT={...aT,threadId:iT},sT=Hs(`kind`,[P({kind:I(`hosts`)}),P({kind:I(`status`),...oT}),P({kind:I(`list`),...aT,cursor:k().nullable(),archived:j()}),P({kind:I(`read`),...oT,page:P({cursor:k().min(1).max(8192).nullable(),epoch:iT.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`),...oT,epoch:iT}),P({kind:I(`configure`),...oT,epoch:iT,modelId:iT.optional(),serviceTier:zx.optional(),thinkingOptionId:iT.optional(),permissionModeId:iT.optional()}).refine(e=>[e.modelId,e.thinkingOptionId,e.permissionModeId].filter(e=>e!==void 0).length===1,`Select exactly one remote setting`).refine(e=>e.serviceTier===void 0||e.modelId!==void 0,{message:`A service tier requires a Model ID`}),P({kind:I(`prompt`),...oT,epoch:iT,text:k().min(1).max(8e3),requestId:iT.optional()}),P({kind:I(`interrupt`),...oT,epoch:iT,turnId:iT}),P({kind:I(`rename`),...oT,epoch:iT,name:k().min(1).max(512)}),P({kind:I(`archive`),...oT,epoch:iT,archived:j()}),P({kind:I(`respond`),...oT,epoch:iT,requestId:Bs([iT,A().int()]),result:Js(k(),Ps())})]),cT=k().min(1).max(1024),lT=N({hostId:cT,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()}),uT=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()});Hs(`action`,[P({action:I(`session`),operation:sT}),P({action:I(`list`)}),P({action:I(`catalog`)}),P({action:I(`read-thread`),hostId:cT.refine(e=>e!==`local`),input:UC}),P({action:I(`save`),draft:uT,previous:lT.nullable()}),P({action:I(`remove`),previous:lT}),P({action:I(`connect`),hostId:cT,enabled:j()}),P({action:I(`state`),hostId:cT}),P({action:I(`runtime`),hostId:cT}),P({action:I(`update`),hostId:cT.refine(e=>e!==`local`),version:rT.shape.version})]),Bs([P({result:lx}),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 dT=k().max(214).regex(/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/u),fT=Bs([k(),N({en:k()}).catchall(k())]),pT=N({title:fT.optional(),description:fT.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:dT,name:k().min(1).max(214),version:k().min(1).max(128),format:I(`dsh`),supportedTargets:Ks([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:pT.optional(),loadError:k().optional()})),loadedIds:M(dT),safeMode:j(),storeError:k().optional()});let mT=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:mT.optional()}).strict(),N({id:dT,enabled:j()}).strict(),N({id:dT}).strict(),I(1);function hT(e){return e.registerNodeTransform(Rf,e=>{let t=FC(e.getTextContent())[0];t&&e.splitText(t.start,t.end)[t.start===0?0:1]?.replace(new Hb({source:`codexhost-skill`,ref:t.text,label:t.name,appearance:`skill`,clipboardText:t.text}))})}let gT=`color: var(--dsw-alias-state-business-primary)`;function _T(){let e=Dh().getFirstChild();if(!G(e))return null;let t=e.getFirstChild();return V(t)?t:null}function vT(e,t){return e.registerNodeTransform(Rf,e=>{let n=_T();if(n===null||e.getKey()!==n.getKey()){e.getStyle()===gT&&e.setStyle(``);return}let r=e.getTextContent(),i=t(),a=r===i?.trimEnd()?r:i;if(a===null||!r.startsWith(a))e.getStyle()===gT&&e.setStyle(``);else if(r.length>a.length){let[t,n]=e.splitText(a.length);t!==void 0&&t.getStyle()!==gT&&t.setStyle(gT),n?.setStyle(``)}else e.getStyle()!==gT&&e.setStyle(gT)})}function yT(e){e.update(()=>{_T()?.markDirty()})}function bT(){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(Wb(e))o(`chip`,e,``,e.getTextContent());else if(V(e)){let t=e.getTextContent();o(`text`,e,t,t)}else Fm(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. */
|
|
159
159
|
s(e);r.set(e.getKey(),{start:t,end:i.length})},c=Dh(),l=c.getChildren();n.set(c.getKey(),l.map(e=>e.getKey()));let u=i.length;return l.forEach((t,n)=>{let r=l[n-1];n>0&&r!==void 0&&(e.push({kind:`gap`,node:null,detectStart:i.length,detectLength:1,clipboardStart:a.length,clipboardLength:1,gapBetween:{before:r.getKey(),after:t.getKey()}}),i+=`
|
|
160
160
|
`,a+=`
|
|
161
|
-
`),G(t)&&s(t)}),r.set(c.getKey(),{start:u,end:i.length}),{segments:e,detectLength:i.length,detectText:i,clipboardText:a,byKey:t,children:n,bounds:r}}function
|
|
161
|
+
`),G(t)&&s(t)}),r.set(c.getKey(),{start:u,end:i.length}),{segments:e,detectLength:i.length,detectText:i,clipboardText:a,byKey:t,children:n,bounds:r}}function xT(e,t){for(let n of e.segments){let e=n.clipboardStart+n.clipboardLength;if(!(t>e))return t===e||n.kind===`chip`?n.detectStart+n.detectLength:n.detectStart+(t-n.clipboardStart)}return e.detectLength}function ST(e,t){if(t.type===`text`){let n=e.byKey.get(t.key);return n===void 0?null:n.detectStart+Math.min(t.offset,n.detectLength)}let n=e.children.get(t.key),r=e.bounds.get(t.key);if(n===void 0||r===void 0)return null;if(t.offset>=n.length)return r.end;let i=n[t.offset];if(i===void 0)return r.end;let a=e.byKey.get(i);if(a!==void 0)return a.detectStart;let o=e.bounds.get(i);return o===void 0?null:o.start}function CT(e){let t=bT(),n=[];for(let r of t.segments){if(r.kind!==`chip`||!Wb(r.node))continue;let t=r.node;n.push({occurrenceId:e(t.getKey()),source:t.getSource(),ref:t.getReference(),offset:r.clipboardStart,length:r.clipboardLength,label:t.getLabel(),...t.getAppearance()===void 0?{}:{appearance:t.getAppearance()},clipboardText:t.getTextContent(),...t.isInvalid()?{invalid:!0}:{}})}let r=U(),i=null;if(H(r)){let e=ST(t,r.anchor),n=ST(t,r.focus);e!==null&&n!==null&&(i={start:Math.min(e,n),end:Math.max(e,n)})}return{detectText:t.detectText,clipboardText:t.clipboardText,occurrences:n,selection:i,caret:i!==null&&i.start===i.end?i.start:null}}function wT(e,t){if(t<0||t>e.detectLength)return null;for(let n of e.segments){if(t>=n.detectStart+n.detectLength)continue;if(n.kind===`text`&&n.node!==null)return{key:n.node.getKey(),offset:t-n.detectStart,type:`text`};if(n.kind===`gap`&&n.gapBetween!==void 0){let t=n.gapBetween.before;return{key:t,offset:e.children.get(t)?.length??0,type:`element`}}
|
|
162
162
|
/* v8 ignore next -- non-gap segments always carry their node. */
|
|
163
|
-
if(n.node===null)return null;let r=n.node.getParent();return r===null?null:{key:r.getKey(),offset:n.node.getIndexWithinParent(),type:`element`}}let n=Dh().getChildren(),r=n[n.length-1];return r===void 0?{key:Dh().getKey(),offset:0,type:`element`}:{key:r.getKey(),offset:e.children.get(r.getKey())?.length??0,type:`element`}}function
|
|
163
|
+
if(n.node===null)return null;let r=n.node.getParent();return r===null?null:{key:r.getKey(),offset:n.node.getIndexWithinParent(),type:`element`}}let n=Dh().getChildren(),r=n[n.length-1];return r===void 0?{key:Dh().getKey(),offset:0,type:`element`}:{key:r.getKey(),offset:e.children.get(r.getKey())?.length??0,type:`element`}}function TT(e,t){if(t.start<0||t.start>t.end||t.end>e.detectLength)return null;let n=wT(e,t.start),r=wT(e,t.end);
|
|
164
164
|
/* v8 ignore next -- bounds were checked above; resolvePoint only fails out of bounds. */
|
|
165
|
-
if(n===null||r===null)return null;let i=Dp();return i.anchor.set(n.key,n.offset,n.type),i.focus.set(r.key,r.offset,r.type),Oh(i),i}function
|
|
166
|
-
`)
|
|
167
|
-
`);for(let e=0;e<t.length;e+=1){let i=t[e];i!==``&&r.append(qf(i)),e<t.length-1&&(r=Vm(),n.append(r))}},a=0;for(let n of t)i(e.slice(a,n.offset)),r.append(new Hb({source:n.source,ref:n.ref,label:n.label,...n.appearance===void 0?{}:{appearance:n.appearance},clipboardText:n.clipboardText},n.invalid===!0)),a=n.offset+n.length;i(e.slice(a)),n.selectEnd()},{discrete:!0,tag:wf})}clearHistory(){this.editor.dispatchCommand(Fd,void 0)}};function Zw(e){switch(e){case`plain`:return`plain`;case`claimed`:return`claimed`;default:return`frozen`}}function Qw(e,t){return e.clipboardText!==t.clipboardText||e.detectText!==t.detectText||e.occurrences.length!==t.occurrences.length||t.occurrences.some((t,n)=>{let r=e.occurrences[n];return r===void 0||r.occurrenceId!==t.occurrenceId||r.invalid!==t.invalid})}let $w=[],eT=/* @__PURE__ */ new Map;var tT=class{deps;state;notices=(0,f.createSnapshotStore)(null);get editor(){return this.draftEditor.editor}actions={captureInsertion:e=>{let t=this.projection.detectText.length;return{...e===`end`?{start:t,end:t}:this.caretSpan(),draftRev:this.rev}},bindPrimaryAction:e=>(this.primaryAction=e,this.publish(),()=>{this.primaryAction===e&&(this.primaryAction=void 0,this.publish())}),insertText:(e,t)=>this.snapshot.phase===`adjudicating`||this.snapshot.phase===`submitting`||this.disposed||t.draftRev!==this.rev?!1:this.draftEditor.insertAsyncText(t,e),setDraft:e=>{this.setDraft(e)},persistDraft:()=>{this.persistCurrentDraft()},addAttachments:e=>this.addAttachments(e),removeAttachment:e=>{this.removeAttachment(e)},pruneAttachments:e=>{this.pruneAttachments(e)},addResponseAnnotation:(e,t)=>{if(t?.focus===`end`&&!this.canInsertReferences())return;let n=this.addResponseAnnotation(e);return n!==void 0&&t?.focus===`end`&&this.canInsertReferences()&&(this.editor.update(()=>{Dh().selectEnd()},{discrete:!0}),this.focus()),n},removeResponseAnnotation:e=>{this.removeResponseAnnotation(e)},submit:()=>{this.submit(`queue`)}};primaryAction;core=new Iv;draftEditor;get projection(){return this.draftEditor.projection}rev=0;unregister;noticeSeq=0;lastPublishedDraft;draftSnapshotCache;attachmentIds=[];responseAnnotations=[];annotationSeq=0;adjudication;disposed=!1;persistDraft;filePicker;detachedDrafts=/* @__PURE__ */ new Map;failedDetached=/* @__PURE__ */ new Map;failedRestoreRev;failedRestorePrefix;restoringFailures=!1;attachmentFlightSeq=0;attachmentFlights=/* @__PURE__ */ new Map;unsubscribeInbox;constructor(e){this.deps=e,this.draftEditor=new Xw({onUpdate:()=>{this.onEditorUpdate()},openReference:(e,t)=>this.deps.inputTriggers?.()?.openReference(e,t)??!1,activeClaimToken:()=>this.activeClaimToken(),lexicon:()=>this.lexicon.getSnapshot(),resolveLexicon:()=>this.deps.inputTriggers?.()?.lexicon}),this.unregister=this.draftEditor.register(),this.state=(0,f.createSnapshotStore)(this.compose()),this.unsubscribeInbox=e.inbox?.subscribe(()=>{this.publish()})}onEditorUpdate(){Qw(this.draftEditor.refreshProjection(),this.projection)&&(this.rev+=1,!this.restoringFailures&&this.failedRestoreRev!==void 0&&(this.failedDetached.clear(),this.failedRestorePrefix=void 0,this.failedRestoreRev=void 0),this.dispatchRun({type:`draft-changed`,draft:this.projection.clipboardText}));let e=this.projection.caret;e!==null&&this.deps.inputTriggers?.()?.track(this.projection.detectText,e,{tier:Zw(this.core.state.phase)},this.rev)}setDraft(e){let t=Tc(e);t.references.length===0?this.draftEditor.setDraft(t.text):this.draftEditor.restoreDraft(t.text,t.references)}refreshLexiconSubscription(){this.disposed||this.draftEditor.refreshLexiconSubscription()}get draftSnapshot(){if(this.draftSnapshotCache?.revision===this.rev)return this.draftSnapshotCache.value;let e=Dc(this.projection.clipboardText,this.projection.occurrences);return this.draftSnapshotCache={revision:this.rev,value:e},e}persistCurrentDraft(){this.persistDraft?.(this.draftSnapshot)}requestDraftInitialization(e){return this.draftInitializationBlocked()?`blocked`:e.prompt===void 0&&e.clearPreviousDraft!==!0||e.clearPreviousDraft!==!0&&(this.snapshot.draft!==``||this.attachmentIds.length>0)?`preserved`:(this.setDraft(e.prompt??``),`applied`)}draftInitializationBlocked(){let{phase:e}=this.core.state;return this.disposed||e===`adjudicating`||e===`submitting`||this.detachedDrafts.size>0||this.attachmentFlights.size>0}canInsertReferences(){let e=this.editor.getRootElement();return!this.disposed&&this.editor.isEditable()&&e!==null&&e.isConnected&&e.getClientRects().length>0&&(this.snapshot.phase===`plain`||this.snapshot.phase===`claimed`)}insertReferences(e,t){return!this.canInsertReferences()||t.draftRev!==this.rev?!1:this.draftEditor.insertFileReferences(e,t)}addAttachments(e){return this.snapshot.phase===`adjudicating`||this.snapshot.phase===`submitting`?!1:(e.length===0||(this.attachmentIds=[...this.attachmentIds,...e],this.publish()),!0)}addFiles(e,t){return this.snapshot.phase===`adjudicating`||this.snapshot.phase===`submitting`||!this.draftEditor.insertFileReferences(e)?!1:(this.attachmentIds=[...this.attachmentIds,...t],this.publish(),!0)}removeAttachment(e){if(this.snapshot.phase===`adjudicating`||this.snapshot.phase===`submitting`)return!1;let t=this.attachmentIds.filter(t=>t!==e);return t.length!==this.attachmentIds.length&&(this.attachmentIds=t,this.publish(),!0)}pruneAttachments(e){let t=new Set(e),n=this.attachmentIds.filter(e=>t.has(e));n.length!==this.attachmentIds.length&&(this.attachmentIds=n,this.publish())}addResponseAnnotation(e){if(this.snapshot.phase===`adjudicating`||this.snapshot.phase===`submitting`)return;this.annotationSeq+=1;let t=`response-annotation-${String(this.annotationSeq)}`;return this.responseAnnotations=[...this.responseAnnotations,{id:t,text:e.text.trim(),...e.annotation===void 0?{}:{annotation:e.annotation}}],this.publish(),t}removeResponseAnnotation(e){if(this.snapshot.phase===`adjudicating`||this.snapshot.phase===`submitting`)return!1;let t=this.responseAnnotations.filter(t=>t.id!==e);return t.length!==this.responseAnnotations.length&&(this.responseAnnotations=t,this.forgetFailedAnnotation(e),this.publish(),!0)}forgetFailedAnnotation(e){this.failedRestorePrefix!==void 0&&(this.failedRestorePrefix={...this.failedRestorePrefix,responseAnnotations:this.failedRestorePrefix.responseAnnotations.filter(t=>t.id!==e)});for(let[t,n]of this.failedDetached){let r=n.responseAnnotations.filter(t=>t.id!==e);r.length!==n.responseAnnotations.length&&this.failedDetached.set(t,{...n,responseAnnotations:r})}}commitSend(e){let t=new Set(e);this.attachmentIds=this.attachmentIds.filter(e=>!t.has(e)),this.dispatchRun({type:`send-committed`})}paste(e){this.draftEditor.paste(e)}submit(e=`queue`,t){if(this.disposed)return;let n=Date.now(),r;if(this.snapshot.phase===`plain`&&(this.snapshot.draft.trim()!==``||this.attachmentIds.length>0||this.responseAnnotations.length>0))try{r=this.deps.submissionState?.()}catch{}let i=Object.freeze({timestamp:n,mode:e,...t===void 0?{}:{source:t},...r===void 0?{}:{state:r}});if(this.snapshot.draft.trim()===``&&this.attachmentIds.length>0&&this.responseAnnotations.length===0){if(this.snapshot.phase===`plain`){let t=[...this.attachmentIds],n=new AbortController;this.attachmentFlightSeq+=1;let r=this.attachmentFlightSeq;this.attachmentFlights.set(r,{controller:n,attachmentIds:t}),this.commitSend(t),this.notifySubmission(i),this.deps.defaultSink(``,t,e,n.signal).then(e=>{!this.disposed&&this.attachmentFlights.delete(r)&&e.kind!==`success`&&(this.restoreAttachments(t),e.text!==void 0&&this.notify(`error`,e.text))},e=>{!this.disposed&&this.attachmentFlights.delete(r)&&(this.restoreAttachments(t),this.notify(`error`,e instanceof Error?e.message:String(e)))})}return}let a=this.snapshot;if(a.phase===`claimed`&&this.attachmentIds.length>0&&a.claim?.attachments!==!0){this.notify(`error`,this.deps.commandAttachments.unsupportedNotice(a.claim?.token??a.draft));return}this.dispatchRun({type:`enter`,mode:e,draft:this.projection.clipboardText,annotated:this.responseAnnotations.length>0,submission:i});let o=this.snapshot.phase;(o===`adjudicating`||o===`submitting`)&&(this.deps.popup?.()?.dismiss(),this.deps.inputTriggers?.()?.track(this.projection.detectText,0,{tier:`frozen`},this.rev))}arbitrate(e,t){return this.deps.inputTriggers?.()?.arbitrate(e,t)??`pass`}steerQueue(){this.deps.steerQueue?.()}space(){let e=this.deps.inputTriggers?.();return e!==void 0&&e.onSpace()}dismissPopup(){this.deps.popup?.()?.dismiss()}caretSpan(){return this.draftEditor.caretSpan()}lexicon={getSnapshot:()=>this.deps.inputTriggers?.()?.lexicon.getSnapshot()??eT,subscribe:e=>this.deps.inputTriggers?.()?.lexicon.subscribe(e)??(()=>{})};beginCommand(e,t){let n=this.core.state.phase;return n!==`plain`&&n!==`claimed`||t.draftRev!==this.rev||this.projection.detectText.slice(0,t.start).trim()!==``||!this.draftEditor.replaceText({start:0,end:t.end},e.token)?!1:(this.dispatchRun({type:`claim`,claim:e}),!0)}insertReference(e,t){let n=this.core.state.phase;if(n!==`plain`&&n!==`claimed`||t.draftRev!==this.rev)return!1;let r=this.projection.detectText.slice(t.end,t.end+1);return this.draftEditor.insertReference(t,e,r)}consumeToken(e){return e.kind===`span`?e.span.draftRev!==this.rev||e.span.start===e.span.end?!1:this.draftEditor.replaceText(e.span,``):e.token===``||this.projection.clipboardText.trim()!==e.token?!1:(this.setDraft(``),!0)}insertText(e,t,n=!1){return t.draftRev===this.rev&&this.draftEditor.replaceText(t,e)}notify(e,t){this.noticeSeq+=1,this.notices.set({level:e,text:t,seq:this.noticeSeq})}focus(){this.editor.getRootElement()?.focus({preventScroll:!0}),this.editor.focus()}dispose(){if(this.disposed)return[];let e=new Set(this.attachmentIds);for(let t of this.detachedDrafts.values())for(let n of t.attachmentIds)e.add(n);for(let t of this.attachmentFlights.values()){for(let n of t.attachmentIds)e.add(n);t.controller.abort()}return this.disposed=!0,this.dispatchRun({type:`release`}),this.unsubscribeInbox?.(),this.unregister(),this.detachedDrafts.clear(),this.failedDetached.clear(),this.failedRestorePrefix=void 0,this.attachmentFlights.clear(),[...e]}get snapshot(){return this.state.getSnapshot()}bindDraftPersistence(e){return this.persistDraft=e,()=>{this.persistDraft===e&&(this.persistDraft=void 0)}}bindFilePicker(e){return this.filePicker=e,()=>{this.filePicker===e&&(this.filePicker=void 0)}}canPickFiles(){return this.filePicker?.available()===!0}pickFiles(){return this.filePicker===void 0||!this.filePicker.available()?!1:(this.filePicker.open(),!0)}activeClaimToken(){let e=this.core.state;return(e.phase===`claimed`||e.phase===`submitting`)&&e.claim!==void 0?e.claim.token:null}dispatchRun(e){let t=this.activeClaimToken(),n=this.core.dispatch(e);this.run(n),this.activeClaimToken()!==t&&this.draftEditor.refreshClaimDecoration()}run(e){for(let t of e)this.execute(t);this.publish()}execute(e){switch(e.type){case`notice`:this.noticeSeq+=1,this.notices.set({level:e.level,text:e.text,seq:this.noticeSeq});return;case`adjudicate`:this.adjudicate(e.attempt,e.draft);return;case`begin-submit`:this.beginSubmit(e.attempt,e.claim,e.args);return;case`default-sink`:this.sinkSerialized(e.attempt,e.draft,e.mode);return;case`commit-draft`:this.commitDraft(e.retainSuffixOf);return}}commitDraft(e){this.draftEditor.clearCommittedDraft(t=>e!==null&&t!==e&&t.startsWith(e)?e.length:null),this.draftEditor.clearHistory()}sinkSerialized(e,t,n){this.notifySubmission(e.submission);let r=[...this.attachmentIds];this.attachmentIds=[];let i=[...this.responseAnnotations];this.responseAnnotations=[];let a=this.projection.occurrences,o={draft:t,occurrences:a,attachmentIds:r,responseAnnotations:i};this.detachedDrafts.set(e.seq,o),this.failedRestoreRev===this.rev&&(this.failedDetached.clear(),this.failedRestorePrefix=void 0,this.failedRestoreRev=void 0);let s=t=>this.deps.defaultSink(Sw(i,t.trim()),r,n,e.signal);if(a.length===0){this.settleSink(e,s(t));return}let c=this.deps.inputTriggers?.();Promise.all(a.map(async t=>{if(c===void 0)throw Error(`no serializer for reference source "${t.source}"`);return{offset:t.offset,length:t.length,text:await c.serializeReference(t.source,t.ref,e.signal)}})).then(n=>{if(this.disposed)return;let r=``,i=0;for(let e of n)r+=t.slice(i,e.offset)+e.text,i=e.offset+e.length;r+=t.slice(i),this.settleSink(e,s(r))},t=>{if(this.dead(e))return;let n=t instanceof Error?t.message:String(t);this.settleDetachedFailure(e,n)})}notifySubmission(e){if(e!==void 0)try{this.deps.messageSubmitted?.(e)}catch{}}settleSink(e,t){t.then(t=>{this.dead(e)||(t.kind===`success`?(this.detachedDrafts.delete(e.seq),this.dispatchRun({type:`sink-settled`,attempt:e,ok:!0,outcome:t})):this.settleDetachedFailure(e,t.text))},t=>{this.dead(e)||this.settleDetachedFailure(e,t instanceof Error?t.message:String(t))})}settleDetachedFailure(e,t){if(this.adjudication!==void 0){let n=()=>{this.dead(e)||this.settleDetachedFailure(e,t)};this.adjudication.then(n,n);return}let n=this.detachedDrafts.get(e.seq);if(n===void 0)return;this.detachedDrafts.delete(e.seq),this.restoreAttachments(n.attachmentIds);let r=n.draft!==``||n.responseAnnotations.length>0||this.failedRestorePrefix!==void 0,i=this.projection.clipboardText;i!==``&&this.failedRestoreRev!==this.rev&&r&&(this.failedDetached.clear(),this.failedRestorePrefix={draft:i,occurrences:this.projection.occurrences,responseAnnotations:[]}),(n.draft!==``||n.responseAnnotations.length>0)&&this.failedDetached.set(e.seq,n),this.restoreFailedDrafts(),this.dispatchRun({type:`sink-settled`,attempt:e,ok:!1,...t===void 0?{}:{message:t}})}restoreFailedDrafts(){let e=[...this.failedRestorePrefix===void 0?[]:[this.failedRestorePrefix],...[...this.failedDetached.entries()].sort(([e],[t])=>e-t).map(([,e])=>e)];if(e.length===0)return;let t=``,n=[],r=[];for(let i of e){if(r.push(...i.responseAnnotations),i.draft===``)continue;let e=t.length+(t===``?0:2);t!==``&&(t+=`
|
|
165
|
+
if(n===null||r===null)return null;let i=Dp();return i.anchor.set(n.key,n.offset,n.type),i.focus.set(r.key,r.offset,r.type),Oh(i),i}function ET(e,t){let n=TT(bT(),e);if(n===null)return!1;if(t===``)n.isCollapsed()||n.removeText();else{let e=t.replace(/\r\n?/gu,`
|
|
166
|
+
`);e.includes(`
|
|
167
|
+
`)?n.insertRawText(e):n.insertText(e)}return!0}function DT(e,t){let n=TT(bT(),e);return n!==null&&(n.insertNodes([...t]),!0)}let OT=/[\uE100-\uE11D\uFFFC]/gu;var kT=class{deps;editor;projected={detectText:``,clipboardText:``,occurrences:[],selection:null,caret:null};occurrenceIds=/* @__PURE__ */ new Map;occurrenceSeq=0;lexiconOff;lexiconSource;constructor(e){this.deps=e,this.editor=qm({namespace:`dsh-composer`,nodes:[Hb,ex],onError:e=>{throw e}})}register(){let e=()=>{let e=this.editor.getRootElement();return e!==null&&!e.contains(e.ownerDocument.activeElement)&&Qh(`skip-dom-selection`),!1},t=Mv(Cb(this.editor),this.editor.registerCommand(kd,e=>!this.editor.isEditable()||!e.dataTransfer?.types.includes(`application/x-codexhost-thread-reference`)||e.dataTransfer.types.includes(`Files`)?!1:(e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect=`copy`,!0),4),this.editor.registerCommand(Dd,e=>{if(!this.editor.isEditable()||!e.dataTransfer||e.dataTransfer.types.includes(`Files`))return!1;let t=Pb(e.dataTransfer.getData(kb));return t!==void 0&&(e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect=`copy`,this.insertFileReferences([Nb(t)]))},4),this.editor.registerCommand(zd,()=>(this.editor.update(e,{discrete:!0}),!1),4),this.editor.registerCommand(Zu,e,4),this.editor.registerNodeTransform(wm,e),rx(this.editor,(e,t)=>this.deps.openReference(e,t)),Db(this.editor,Ob(),1e3),this.editor.registerUpdateListener(()=>{this.deps.onUpdate()}),hT(this.editor),vT(this.editor,()=>this.deps.activeClaimToken()),tx(this.editor,()=>this.deps.lexicon(),()=>this.deps.activeClaimToken()),()=>{this.lexiconOff?.(),this.lexiconOff=void 0,this.lexiconSource=void 0});return()=>{t(),this.editor.setRootElement(null)}}get projection(){return this.projected}applyEdit(e,t){this.editor._updating?(t!==void 0&&Qh(t),e()):this.editor.update(e,{discrete:!0,...t===void 0?{}:{tag:t}})}refreshLexiconSubscription(){let e=this.deps.resolveLexicon();e!==this.lexiconSource&&(this.lexiconOff?.(),this.lexiconSource=e,this.lexiconOff=e?.subscribe(()=>{nx(this.editor)}),nx(this.editor))}refreshProjection(){let e=this.projected;return this.projected=this.editor.getEditorState().read(()=>CT(e=>this.occurrenceIdOf(e))),e}occurrenceIdOf(e){let t=this.occurrenceIds.get(e);return t===void 0?(this.occurrenceSeq+=1,this.occurrenceIds.set(e,this.occurrenceSeq),this.occurrenceSeq):t}setDraft(e){let t=e.replace(OT,``);(t!==this.projection.clipboardText||this.projection.occurrences.length!==0)&&this.editor.update(()=>{let e=Dh();e.clear();for(let n of t.split(`
|
|
168
|
+
`)){let t=Vm();n!==``&&t.append(qf(n)),e.append(t)}e.selectEnd()},{discrete:!0,tag:wf})}paste(e){let t=e.replace(OT,``).replace(/\r\n?/gu,`
|
|
169
|
+
`);t!==``&&this.applyEdit(()=>{let e=U();if(H(e)){e.insertRawText(t);return}let n=Dh();n.getChildrenSize()===0&&n.append(Vm()),n.selectEnd().insertRawText(t)},Tf)}caretSpan(){if(this.projection.selection!==null)return this.projection.selection;let e=this.projection.detectText.length;return{start:e,end:e}}replaceText(e,t){let n=!1;return this.applyEdit(()=>{n=ET(e,t)}),n}insertAsyncText(e,t){let n=!1,r=t.replace(OT,``);return this.applyEdit(()=>{n=ET(e,r)},Tf),n}insertReference(e,t,n){let r=!1;return this.applyEdit(()=>{r=DT(e,n===` `?[Ub(t)]:[Ub(t),qf(` `)])}),r}insertFileReferences(e,t){if(e.length===0)return!0;let n=!1;return this.applyEdit(()=>{let r=CT(e=>this.occurrenceIdOf(e)),i=t?.end??r.selection?.end??r.detectText.length,a=r.detectText.slice(0,i),o=e.flatMap(e=>[Ub(e),qf(` `)]);a!==``&&!/\s$/u.test(a)&&o.unshift(qf(` `)),n=DT({start:i,end:i},o)},Tf),n}refreshClaimDecoration(){yT(this.editor)}clearCommittedDraft(e){this.editor.update(()=>{let t=bT(),n=e(t.clipboardText);if(n!==null){ET({start:0,end:xT(t,n)},``);return}let r=Dh();r.clear(),r.selectEnd()},{discrete:!0,tag:wf})}restoreDraft(e,t){this.editor.update(()=>{let n=Dh();n.clear();let r=Vm();n.append(r);let i=e=>{let t=e.replace(OT,``).split(`
|
|
170
|
+
`);for(let e=0;e<t.length;e+=1){let i=t[e];i!==``&&r.append(qf(i)),e<t.length-1&&(r=Vm(),n.append(r))}},a=0;for(let n of t)i(e.slice(a,n.offset)),r.append(new Hb({source:n.source,ref:n.ref,label:n.label,...n.appearance===void 0?{}:{appearance:n.appearance},clipboardText:n.clipboardText},n.invalid===!0)),a=n.offset+n.length;i(e.slice(a)),n.selectEnd()},{discrete:!0,tag:wf})}clearHistory(){this.editor.dispatchCommand(Fd,void 0)}};function AT(e){switch(e){case`plain`:return`plain`;case`claimed`:return`claimed`;default:return`frozen`}}function jT(e,t){return e.clipboardText!==t.clipboardText||e.detectText!==t.detectText||e.occurrences.length!==t.occurrences.length||t.occurrences.some((t,n)=>{let r=e.occurrences[n];return r===void 0||r.occurrenceId!==t.occurrenceId||r.invalid!==t.invalid})}let MT=[],NT=/* @__PURE__ */ new Map;var PT=class{deps;state;notices=(0,f.createSnapshotStore)(null);get editor(){return this.draftEditor.editor}actions={captureInsertion:e=>{let t=this.projection.detectText.length;return{...e===`end`?{start:t,end:t}:this.caretSpan(),draftRev:this.rev}},bindPrimaryAction:e=>(this.primaryAction=e,this.publish(),()=>{this.primaryAction===e&&(this.primaryAction=void 0,this.publish())}),insertText:(e,t)=>this.snapshot.phase===`adjudicating`||this.snapshot.phase===`submitting`||this.disposed||t.draftRev!==this.rev?!1:this.draftEditor.insertAsyncText(t,e),setDraft:e=>{this.setDraft(e)},persistDraft:()=>{this.persistCurrentDraft()},addAttachments:e=>this.addAttachments(e),removeAttachment:e=>{this.removeAttachment(e)},pruneAttachments:e=>{this.pruneAttachments(e)},addResponseAnnotation:(e,t)=>{if(t?.focus===`end`&&!this.canInsertReferences())return;let n=this.addResponseAnnotation(e);return n!==void 0&&t?.focus===`end`&&this.canInsertReferences()&&this.focus(`end`),n},removeResponseAnnotation:e=>{this.removeResponseAnnotation(e)},submit:()=>{this.submit(`queue`)}};primaryAction;core=new Iv;draftEditor;get projection(){return this.draftEditor.projection}rev=0;unregister;noticeSeq=0;lastPublishedDraft;draftSnapshotCache;attachmentIds=[];responseAnnotations=[];annotationSeq=0;adjudication;disposed=!1;persistDraft;filePicker;detachedDrafts=/* @__PURE__ */ new Map;failedDetached=/* @__PURE__ */ new Map;failedRestoreRev;failedRestorePrefix;restoringFailures=!1;attachmentFlightSeq=0;attachmentFlights=/* @__PURE__ */ new Map;unsubscribeInbox;constructor(e){this.deps=e,this.draftEditor=new kT({onUpdate:()=>{this.onEditorUpdate()},openReference:(e,t)=>this.deps.inputTriggers?.()?.openReference(e,t)??!1,activeClaimToken:()=>this.activeClaimToken(),lexicon:()=>this.lexicon.getSnapshot(),resolveLexicon:()=>this.deps.inputTriggers?.()?.lexicon}),this.unregister=this.draftEditor.register(),this.state=(0,f.createSnapshotStore)(this.compose()),this.unsubscribeInbox=e.inbox?.subscribe(()=>{this.publish()})}onEditorUpdate(){jT(this.draftEditor.refreshProjection(),this.projection)&&(this.rev+=1,!this.restoringFailures&&this.failedRestoreRev!==void 0&&(this.failedDetached.clear(),this.failedRestorePrefix=void 0,this.failedRestoreRev=void 0),this.dispatchRun({type:`draft-changed`,draft:this.projection.clipboardText}));let e=this.projection.caret;e!==null&&this.deps.inputTriggers?.()?.track(this.projection.detectText,e,{tier:AT(this.core.state.phase)},this.rev)}setDraft(e){let t=Tc(e);t.references.length===0?this.draftEditor.setDraft(t.text):this.draftEditor.restoreDraft(t.text,t.references)}refreshLexiconSubscription(){this.disposed||this.draftEditor.refreshLexiconSubscription()}get draftSnapshot(){if(this.draftSnapshotCache?.revision===this.rev)return this.draftSnapshotCache.value;let e=Dc(this.projection.clipboardText,this.projection.occurrences);return this.draftSnapshotCache={revision:this.rev,value:e},e}persistCurrentDraft(){this.persistDraft?.(this.draftSnapshot)}requestDraftInitialization(e){return this.draftInitializationBlocked()?`blocked`:e.prompt===void 0&&e.clearPreviousDraft!==!0||e.clearPreviousDraft!==!0&&(this.snapshot.draft!==``||this.attachmentIds.length>0)?`preserved`:(this.setDraft(e.prompt??``),`applied`)}draftInitializationBlocked(){let{phase:e}=this.core.state;return this.disposed||e===`adjudicating`||e===`submitting`||this.detachedDrafts.size>0||this.attachmentFlights.size>0}canInsertReferences(){let e=this.editor.getRootElement();return!this.disposed&&this.editor.isEditable()&&e!==null&&e.isConnected&&e.getClientRects().length>0&&(this.snapshot.phase===`plain`||this.snapshot.phase===`claimed`)}insertReferences(e,t){return!this.canInsertReferences()||t.draftRev!==this.rev?!1:this.draftEditor.insertFileReferences(e,t)}addAttachments(e){return this.snapshot.phase===`adjudicating`||this.snapshot.phase===`submitting`?!1:(e.length===0||(this.attachmentIds=[...this.attachmentIds,...e],this.publish()),!0)}addFiles(e,t){return this.snapshot.phase===`adjudicating`||this.snapshot.phase===`submitting`||!this.draftEditor.insertFileReferences(e)?!1:(this.attachmentIds=[...this.attachmentIds,...t],this.publish(),!0)}removeAttachment(e){if(this.snapshot.phase===`adjudicating`||this.snapshot.phase===`submitting`)return!1;let t=this.attachmentIds.filter(t=>t!==e);return t.length!==this.attachmentIds.length&&(this.attachmentIds=t,this.publish(),!0)}pruneAttachments(e){let t=new Set(e),n=this.attachmentIds.filter(e=>t.has(e));n.length!==this.attachmentIds.length&&(this.attachmentIds=n,this.publish())}addResponseAnnotation(e){if(this.snapshot.phase===`adjudicating`||this.snapshot.phase===`submitting`)return;this.annotationSeq+=1;let t=`response-annotation-${String(this.annotationSeq)}`;return this.responseAnnotations=[...this.responseAnnotations,{id:t,text:e.text.trim(),...e.annotation===void 0?{}:{annotation:e.annotation},...e.anchor===void 0?{}:{anchor:e.anchor}}],this.publish(),t}removeResponseAnnotation(e){if(this.snapshot.phase===`adjudicating`||this.snapshot.phase===`submitting`)return!1;let t=this.responseAnnotations.filter(t=>t.id!==e);return t.length!==this.responseAnnotations.length&&(this.responseAnnotations=t,this.forgetFailedAnnotation(e),this.publish(),!0)}forgetFailedAnnotation(e){this.failedRestorePrefix!==void 0&&(this.failedRestorePrefix={...this.failedRestorePrefix,responseAnnotations:this.failedRestorePrefix.responseAnnotations.filter(t=>t.id!==e)});for(let[t,n]of this.failedDetached){let r=n.responseAnnotations.filter(t=>t.id!==e);r.length!==n.responseAnnotations.length&&this.failedDetached.set(t,{...n,responseAnnotations:r})}}commitSend(e){let t=new Set(e);this.attachmentIds=this.attachmentIds.filter(e=>!t.has(e)),this.dispatchRun({type:`send-committed`})}paste(e){this.draftEditor.paste(e)}submit(e=`queue`,t){if(this.disposed)return;let n=Date.now(),r;if(this.snapshot.phase===`plain`&&(this.snapshot.draft.trim()!==``||this.attachmentIds.length>0||this.responseAnnotations.length>0))try{r=this.deps.submissionState?.()}catch{}let i=Object.freeze({timestamp:n,mode:e,...t===void 0?{}:{source:t},...r===void 0?{}:{state:r}});if(this.snapshot.draft.trim()===``&&this.attachmentIds.length>0&&this.responseAnnotations.length===0){if(this.snapshot.phase===`plain`){let t=[...this.attachmentIds],n=new AbortController;this.attachmentFlightSeq+=1;let r=this.attachmentFlightSeq;this.attachmentFlights.set(r,{controller:n,attachmentIds:t}),this.commitSend(t),this.notifySubmission(i),this.deps.defaultSink(``,t,e,n.signal).then(e=>{!this.disposed&&this.attachmentFlights.delete(r)&&e.kind!==`success`&&(this.restoreAttachments(t),e.text!==void 0&&this.notify(`error`,e.text))},e=>{!this.disposed&&this.attachmentFlights.delete(r)&&(this.restoreAttachments(t),this.notify(`error`,e instanceof Error?e.message:String(e)))})}return}let a=this.snapshot;if(a.phase===`claimed`&&this.attachmentIds.length>0&&a.claim?.attachments!==!0){this.notify(`error`,this.deps.commandAttachments.unsupportedNotice(a.claim?.token??a.draft));return}this.dispatchRun({type:`enter`,mode:e,draft:this.projection.clipboardText,annotated:this.responseAnnotations.length>0,submission:i});let o=this.snapshot.phase;(o===`adjudicating`||o===`submitting`)&&(this.deps.popup?.()?.dismiss(),this.deps.inputTriggers?.()?.track(this.projection.detectText,0,{tier:`frozen`},this.rev))}arbitrate(e,t){return this.deps.inputTriggers?.()?.arbitrate(e,t)??`pass`}steerQueue(){this.deps.steerQueue?.()}space(){let e=this.deps.inputTriggers?.();return e!==void 0&&e.onSpace()}dismissPopup(){this.deps.popup?.()?.dismiss()}caretSpan(){return this.draftEditor.caretSpan()}lexicon={getSnapshot:()=>this.deps.inputTriggers?.()?.lexicon.getSnapshot()??NT,subscribe:e=>this.deps.inputTriggers?.()?.lexicon.subscribe(e)??(()=>{})};beginCommand(e,t){let n=this.core.state.phase;return n!==`plain`&&n!==`claimed`||t.draftRev!==this.rev||this.projection.detectText.slice(0,t.start).trim()!==``||!this.draftEditor.replaceText({start:0,end:t.end},e.token)?!1:(this.dispatchRun({type:`claim`,claim:e}),!0)}insertReference(e,t){let n=this.core.state.phase;if(n!==`plain`&&n!==`claimed`||t.draftRev!==this.rev)return!1;let r=this.projection.detectText.slice(t.end,t.end+1);return this.draftEditor.insertReference(t,e,r)}consumeToken(e){return e.kind===`span`?e.span.draftRev!==this.rev||e.span.start===e.span.end?!1:this.draftEditor.replaceText(e.span,``):e.token===``||this.projection.clipboardText.trim()!==e.token?!1:(this.setDraft(``),!0)}insertText(e,t,n=!1){return t.draftRev===this.rev&&this.draftEditor.replaceText(t,e)}notify(e,t){this.noticeSeq+=1,this.notices.set({level:e,text:t,seq:this.noticeSeq})}focus(e){this.editor.getRootElement()?.focus({preventScroll:!0}),e===`end`?this.editor.update(()=>{Dh().selectEnd()},{discrete:!0}):this.editor.focus()}dispose(){if(this.disposed)return[];let e=new Set(this.attachmentIds);for(let t of this.detachedDrafts.values())for(let n of t.attachmentIds)e.add(n);for(let t of this.attachmentFlights.values()){for(let n of t.attachmentIds)e.add(n);t.controller.abort()}return this.disposed=!0,this.dispatchRun({type:`release`}),this.unsubscribeInbox?.(),this.unregister(),this.detachedDrafts.clear(),this.failedDetached.clear(),this.failedRestorePrefix=void 0,this.attachmentFlights.clear(),[...e]}get snapshot(){return this.state.getSnapshot()}bindDraftPersistence(e){return this.persistDraft=e,()=>{this.persistDraft===e&&(this.persistDraft=void 0)}}bindFilePicker(e){return this.filePicker=e,()=>{this.filePicker===e&&(this.filePicker=void 0)}}canPickFiles(){return this.filePicker?.available()===!0}pickFiles(){return this.filePicker===void 0||!this.filePicker.available()?!1:(this.filePicker.open(),!0)}activeClaimToken(){let e=this.core.state;return(e.phase===`claimed`||e.phase===`submitting`)&&e.claim!==void 0?e.claim.token:null}dispatchRun(e){let t=this.activeClaimToken(),n=this.core.dispatch(e);this.run(n),this.activeClaimToken()!==t&&this.draftEditor.refreshClaimDecoration()}run(e){for(let t of e)this.execute(t);this.publish()}execute(e){switch(e.type){case`notice`:this.noticeSeq+=1,this.notices.set({level:e.level,text:e.text,seq:this.noticeSeq});return;case`adjudicate`:this.adjudicate(e.attempt,e.draft);return;case`begin-submit`:this.beginSubmit(e.attempt,e.claim,e.args);return;case`default-sink`:this.sinkSerialized(e.attempt,e.draft,e.mode);return;case`commit-draft`:this.commitDraft(e.retainSuffixOf);return}}commitDraft(e){this.draftEditor.clearCommittedDraft(t=>e!==null&&t!==e&&t.startsWith(e)?e.length:null),this.draftEditor.clearHistory()}sinkSerialized(e,t,n){this.notifySubmission(e.submission);let r=[...this.attachmentIds];this.attachmentIds=[];let i=[...this.responseAnnotations];this.responseAnnotations=[];let a=this.projection.occurrences,o={draft:t,occurrences:a,attachmentIds:r,responseAnnotations:i};this.detachedDrafts.set(e.seq,o),this.failedRestoreRev===this.rev&&(this.failedDetached.clear(),this.failedRestorePrefix=void 0,this.failedRestoreRev=void 0);let s=t=>this.deps.defaultSink(tT(i,t.trim()),r,n,e.signal);if(a.length===0){this.settleSink(e,s(t));return}let c=this.deps.inputTriggers?.();Promise.all(a.map(async t=>{if(c===void 0)throw Error(`no serializer for reference source "${t.source}"`);return{offset:t.offset,length:t.length,text:await c.serializeReference(t.source,t.ref,e.signal)}})).then(n=>{if(this.disposed)return;let r=``,i=0;for(let e of n)r+=t.slice(i,e.offset)+e.text,i=e.offset+e.length;r+=t.slice(i),this.settleSink(e,s(r))},t=>{if(this.dead(e))return;let n=t instanceof Error?t.message:String(t);this.settleDetachedFailure(e,n)})}notifySubmission(e){if(e!==void 0)try{this.deps.messageSubmitted?.(e)}catch{}}settleSink(e,t){t.then(t=>{this.dead(e)||(t.kind===`success`?(this.detachedDrafts.delete(e.seq),this.dispatchRun({type:`sink-settled`,attempt:e,ok:!0,outcome:t})):this.settleDetachedFailure(e,t.text))},t=>{this.dead(e)||this.settleDetachedFailure(e,t instanceof Error?t.message:String(t))})}settleDetachedFailure(e,t){if(this.adjudication!==void 0){let n=()=>{this.dead(e)||this.settleDetachedFailure(e,t)};this.adjudication.then(n,n);return}let n=this.detachedDrafts.get(e.seq);if(n===void 0)return;this.detachedDrafts.delete(e.seq),this.restoreAttachments(n.attachmentIds);let r=n.draft!==``||n.responseAnnotations.length>0||this.failedRestorePrefix!==void 0,i=this.projection.clipboardText;i!==``&&this.failedRestoreRev!==this.rev&&r&&(this.failedDetached.clear(),this.failedRestorePrefix={draft:i,occurrences:this.projection.occurrences,responseAnnotations:[]}),(n.draft!==``||n.responseAnnotations.length>0)&&this.failedDetached.set(e.seq,n),this.restoreFailedDrafts(),this.dispatchRun({type:`sink-settled`,attempt:e,ok:!1,...t===void 0?{}:{message:t}})}restoreFailedDrafts(){let e=[...this.failedRestorePrefix===void 0?[]:[this.failedRestorePrefix],...[...this.failedDetached.entries()].sort(([e],[t])=>e-t).map(([,e])=>e)];if(e.length===0)return;let t=``,n=[],r=[];for(let i of e){if(r.push(...i.responseAnnotations),i.draft===``)continue;let e=t.length+(t===``?0:2);t!==``&&(t+=`
|
|
168
171
|
|
|
169
|
-
`),t+=i.draft;for(let t of i.occurrences)n.push({...t,offset:e+t.offset})}let i=new Set(r.map(e=>e.id));this.responseAnnotations=[...r,...this.responseAnnotations.filter(e=>!i.has(e.id))],this.restoringFailures=!0;try{this.draftEditor.restoreDraft(t,n),this.draftEditor.clearHistory(),this.failedRestoreRev=this.rev}finally{this.restoringFailures=!1}this.publish()}restoreAttachments(e){if(e.length===0)return;let t=new Set(this.attachmentIds),n=e.filter(e=>!t.has(e));n.length!==0&&(this.attachmentIds=[...n,...this.attachmentIds],this.publish())}adjudicate(e,t){let n=this.deps.inputTriggers?.();n===void 0?this.dispatchRun({type:`adjudicated`,attempt:e,outcome:void 0}):(this.adjudication=n.adjudicate(t.trim(),e.signal,{attachments:this.attachmentIds.length}),this.adjudication.then(t=>{this.adjudication=void 0,!this.dead(e)&&this.dispatchRun({type:`adjudicated`,attempt:e,outcome:t})},t=>{if(this.adjudication=void 0,this.dead(e))return;let n=t instanceof Error?t.message:String(t);this.dispatchRun({type:`adjudication-failed`,attempt:e,message:n})}))}beginSubmit(e,t,n){let r=t.attachments===!0?[...this.attachmentIds]:[];Promise.resolve().then(async()=>{let i=r.length>0?await this.deps.commandAttachments.serialize(r):[];if(!this.dead(e))return t.submit(n,this.deps.actx,i)}).then(t=>{if(!(t===void 0||this.dead(e))){if(t.kind===`success`&&r.length>0){let e=new Set(r);this.attachmentIds=this.attachmentIds.filter(t=>!e.has(t)),this.deps.commandAttachments.release(r)}this.dispatchRun({type:`submit-settled`,attempt:e,ok:t.kind===`success`,draft:this.projection.clipboardText,outcome:t,...t.kind===`error`&&t.text===void 0?{message:`command failed`}:{}})}},t=>{if(this.dead(e))return;let n=t instanceof Error?t.message:String(t);this.dispatchRun({type:`submit-settled`,attempt:e,ok:!1,draft:this.projection.clipboardText,message:n})})}dead(e){return this.disposed||e.signal.aborted}compose(){let e=this.core.state;return{draft:this.projection.clipboardText,attachmentIds:this.attachmentIds,responseAnnotations:this.responseAnnotations,draftRev:this.rev,...this.primaryAction===void 0?{}:{primaryAction:this.primaryAction},phase:e.phase,...e.claim===void 0?{}:{claim:e.claim},occurrences:this.projection.occurrences,queue:this.deps.inbox?.getSnapshot()?.[`next-turn`]??$w}}publish(){let e=this.compose();this.state.set(e);let t=this.draftSnapshot;t!==this.lastPublishedDraft&&(this.lastPublishedDraft=t,this.persistDraft?.(t))}};function nT(e,t){let{state:n,timestamp:r,mode:i}=t;if(n===void 0)return;let a=n.model;e.get(`productAnalytics`)?.track(`send_button_click`,{...n.sessionId===void 0?{}:{session_id:n.sessionId},...a===void 0?{}:{model_name:`${a.provider}/${a.name}`,...a.effort===void 0?{}:{thinking_effort:a.effort}},run_mode:n.runMode,msg_type:n.running?i:`default`},r)}var rT=class{rootCtx;t;shells=/* @__PURE__ */ new WeakMap;constructor(e,t){this.rootCtx=e,this.t=t}for(e){let t=this.sessions(),n=t.sessionOf(e),r=n===void 0?void 0:t.binding(n.sessionId);if(r===void 0||r.session!==n)throw Error(`conversation.input.for requires a retained Session scope`);return this.shellFor(r)}captureReferenceInsertion(e){let t=this.sessions(),n=this.shells.get(e);if(t.binding(e.sessionId)!==e||n===void 0)return;let r=this.rootCtx.get(`conversation`);if(r===void 0)return;let i=n.actions.captureInsertion(),a=r.blocks.storeFor(e.sessionId),o=this.rootCtx.uiSession.sessionStatus,s=!1,c=()=>{let r=e.session.getSnapshot();return!s&&t.binding(e.sessionId)===e&&r.openState===`open`&&!r.removed&&a.getSnapshot()===void 0&&o.getSnapshot().get(e.sessionId)?.pendingInteraction===void 0&&n.snapshot.draftRev===i.draftRev&&n.canInsertReferences()};return{getSnapshot:c,subscribe:r=>{let i=[t.list.subscribe(r),e.session.subscribe(r),n.state.subscribe(r),a.subscribe(r),o.subscribe(r),n.editor.registerEditableListener(r),n.editor.registerRootListener(r)];return()=>i.forEach(e=>e())},insert:e=>{let t=c();return s=!0,t&&n.insertReferences([e],i)}}}requestDraftInitialization(e,t){if(this.sessions().binding(e.sessionId)!==e)throw Error(`conversation.input.requestDraftInitialization requires a retained Session binding`);return this.shellFor(e).requestDraftInitialization(t)}shellFor(e){let t=this.shells.get(e);if(t!==void 0)return t;let{session:n,ctx:r}=e,i=new tT({actx:r,submissionState:()=>{let e=n.getSnapshot(),t=n.projections.faceOf(`modelSelection`).getSnapshot(),r=n.projections.faceOf(`plan`).getSnapshot(),i=n.projections.faceOf(`goal`).getSnapshot(),a=t?.next??t?.lastUsed;return Object.freeze({...e.blank?{}:{sessionId:e.sessionId},...a==null?{}:{model:Object.freeze({provider:a.provider,name:a.model,...a.reasoningEffort===void 0?{}:{effort:a.reasoningEffort}})},runMode:r?.active?`plan`:i?.goal.phase===`active`?`goal`:`default`,running:e.running})},messageSubmitted:e=>{nT(this.rootCtx,e)},inputTriggers:()=>this.controller(r),popup:()=>this.popup(r),inbox:n.projections.faceOf(`inbox`),defaultSink:(e,t,r,i)=>this.sink(n,e,t,r,i),steerQueue:()=>{this.steerQueue(n,i)},commandAttachments:{serialize:async e=>(await this.conversation().serializeDraftAttachments(e)).attachments,release:e=>{let t=this.rootCtx.get(`conversation`);for(let n of e)t?.releaseDraftAttachment(n)},unsupportedNotice:e=>this.t(`command.attachmentsUnsupported`,{command:e.trim().replace(/^\//u,``)})}});return this.shells.set(e,i),r.effect(()=>{let t=[r.on(`slash/input-begin-command`,e=>i.beginCommand(e.claim,e.span)?!0:void 0),r.on(`slash/input-insert-reference`,e=>i.insertReference(e.reference,e.span)?!0:void 0),r.on(`slash/input-consume-token`,e=>i.consumeToken(e.guard)?!0:void 0),r.on(`slash/input-insert-text`,e=>i.insertText(e.text,e.span,e.continue===!0)?!0:void 0)];return()=>{for(let e of t)e();let n=i.dispose();this.shells.delete(e);let r=this.rootCtx.get(`conversation`);for(let e of n)r?.releaseDraftAttachment(e)}},`conversation.input: session shell`),r.inject([`inputTriggers`],e=>{e.effect(()=>(i.refreshLexiconSubscription(),()=>{i.refreshLexiconSubscription()}),`conversation.input: reference catalogs`)}),i.setDraft(jc(e.sessionId)),i}shell(e){let t=this.sessions().binding(e);if(t===void 0)throw Error(`conversation.input: session "${e}" resolved no binding`);return this.shellFor(t)}keyboard(e){return this.shell(e)}canPickFiles(e){let t=this.sessions().binding(e);return t!==void 0&&this.shells.get(t)?.canPickFiles()===!0}pickFiles(e){let t=this.sessions().binding(e);t!==void 0&&this.shells.get(t)?.pickFiles()}inputTriggers(e){let t=this.sessions().binding(e);return t===void 0?void 0:this.controller(t.ctx)}sink(e,t,n,r,i){return t===``&&n.length===0?Promise.resolve({kind:`success`}):this.conversation().sendSession(e,t,n,r,i)}async steerQueue(e,t){let n=e.projections.faceOf(`inbox`).getSnapshot()?.[`next-turn`]??[];if(n.length!==0)for(let r of n){let n=await e.updateQueue(r.id,{kind:`steer`});if(!n.ok){if(n.error.code===`session/steer-unavailable`||n.error.code===`session/queue-item-not-found`)return;t.notify(`error`,this.t(`queue.steerFailed`));return}}}controller(e){if(this.sessions().sessionOf(e)!==void 0)return this.rootCtx.get(`inputTriggers`)?.sessionOf(e)}popup(e){if(this.sessions().sessionOf(e)!==void 0)return this.rootCtx.get(`commandUi`)?.popupFor(e)}sessions(){let e=this.rootCtx.get(`sessions`);if(e===void 0)throw Error(`conversation.input: sessions service unavailable`);return e}conversation(){let e=this.rootCtx.get(`conversation`);if(e===void 0)throw Error(`conversation.input: conversation service unavailable`);return e}};let iT=`busyEnter`,aT=[`queue`,`steer`],oT=`queue`,sT={[iT]:w.union([...aT]).default(oT)};w.object(sT);function cT(e,t,n,r){return!t||!r?`queue`:n===`enter`?e:e===`queue`?`steer`:`queue`}var lT=class{busyEnter=(0,f.createSnapshotStore)(oT);unsubscribe;host;constructor(e){this.host=e,e!==void 0&&(this.unsubscribe=e.subscribe(()=>{this.adopt(e)}),this.adopt(e))}dispose(){this.unsubscribe?.()}setBusyEnter(e){this.busyEnter.getSnapshot()!==e&&(this.busyEnter.set(e),this.host?.set(iT,e))}adopt(e){let t=e.getSnapshot().value;t!==void 0&&this.busyEnter.getSnapshot()!==t.busyEnter&&this.busyEnter.set(t.busyEnter)}};let uT=`@deepseek-ai/dsh-client-ui-conversation/QueueDock.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(uT)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-conversation`,e.dataset.pluginCss=uT,e.textContent=`.COptxG_dock{box-sizing:border-box;width:calc(100% - var(--dsh-composer-side-clearance) - var(--dsh-composer-side-clearance) - var(--dsh-composer-dock-inset) - var(--dsh-composer-dock-inset));max-width:calc(var(--dsh-composer-card-max-width) - var(--dsh-composer-dock-inset) - var(--dsh-composer-dock-inset));margin:0 auto calc(0px - var(--dsh-composer-stack-gap) - 3px);padding:0 var(--dsh-composer-dock-inset);flex:none}.COptxG_pendingAttachment{flex-direction:column;gap:2px;display:inline-flex}.COptxG_panel{isolation:isolate;border-radius:var(--dsw-radius-lg) var(--dsw-radius-lg) 0 0;--dsh-scrollbar-thumb:var(--dsw-alias-scrollbar-bg-l2);--dsh-scrollbar-thumb-hover:var(--dsw-alias-scrollbar-hover-l2);width:100%;padding:2px 0;position:relative;overflow:hidden}.COptxG_panel:before{z-index:-1;border-radius:inherit;background:var(--dsw-specific-menu);backdrop-filter:var(--dsw-menu-backdrop-filter);content:"";pointer-events:none;position:absolute;inset:0}.COptxG_panel:after{border:.5px solid var(--dsw-alias-border-l1);border-radius:inherit;content:"";pointer-events:none;border-bottom:none;position:absolute;inset:0}.COptxG_paused{color:var(--dsw-alias-label-tertiary);font:var(--dsw-font-xs-13);padding:6px 12px 2px}.COptxG_header{box-sizing:border-box;border-radius:var(--dsw-radius-md);width:100%;height:36px;color:var(--dsw-alias-label-primary);text-align:left;cursor:pointer;background:0 0;border:none;align-items:center;gap:10px;padding:4px 12px;display:flex}.COptxG_header:focus-visible{outline:var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:-2px}.COptxG_header:disabled{cursor:default}.COptxG_lead{color:var(--dsw-alias-label-tertiary);flex:none;place-items:center;display:grid}.COptxG_count{min-width:0;font-family:Inter, var(--dsw-font-family);flex:auto;font-size:13px;font-weight:500;line-height:24px}.COptxG_chevron{width:14px;height:14px;color:var(--dsw-alias-label-tertiary);flex:none;place-items:center;display:grid}.COptxG_list{max-height:180px;margin:0;padding:0;list-style:none;overflow-y:auto}.COptxG_row{box-sizing:border-box;border-radius:var(--dsw-radius-md);align-items:center;gap:10px;width:100%;min-height:36px;padding:4px 5px 4px 12px;display:flex}.COptxG_row+.COptxG_row{box-shadow:inset 0 1px 0 var(--dsw-alias-border-l1)}.COptxG_attachments{flex:none;gap:4px;min-width:0;max-width:55%;display:flex;overflow:hidden}.COptxG_pendingRow .COptxG_attachments{flex-shrink:1}.COptxG_file{border:.5px solid var(--dsw-alias-border-l1);border-radius:var(--dsw-radius-sm);background:var(--dsw-alias-bg-base);box-sizing:border-box;flex:0 180px;align-items:center;gap:4px;min-width:74px;height:24px;padding:0 6px;display:inline-flex;overflow:hidden}.COptxG_fileIcon{flex:none;width:16px;height:16px;display:inline-flex}.COptxG_fileName{min-width:0;color:var(--dsw-alias-label-primary-dimmed);font:var(--dsw-font-xs-13);text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.COptxG_fileSize{color:var(--dsw-alias-label-tertiary);white-space:nowrap;flex:none;font-size:10px}.COptxG_thumb{border:.5px solid var(--dsw-alias-border-l1);border-radius:var(--dsw-radius-xs);background:var(--dsw-alias-bg-base);object-fit:cover;width:24px;height:24px}.COptxG_preview{min-width:0;font:var(--dsw-font-xs-13);font-family:Inter, var(--dsw-font-family);color:var(--dsw-alias-label-primary-dimmed);text-overflow:ellipsis;white-space:nowrap;word-break:break-word;flex:auto;overflow:hidden}.COptxG_actions{flex:none;align-items:center;gap:10px;display:flex}.COptxG_status{color:var(--dsw-alias-label-tertiary);font:var(--dsw-font-xs-13);white-space:nowrap;flex:none}.COptxG_action{corner-shape:round;width:28px;height:28px;color:var(--dsw-alias-label-tertiary);cursor:pointer;background:0 0;border:none;border-radius:999px;flex:none;place-items:center;padding:0;display:grid}.COptxG_action:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover)}.COptxG_action:focus-visible{outline:var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:-2px}.COptxG_action:disabled{cursor:default;opacity:.45}`,document.head.appendChild(e)}var Q={action:`COptxG_action`,actions:`COptxG_actions`,attachments:`COptxG_attachments`,chevron:`COptxG_chevron`,count:`COptxG_count`,dock:`COptxG_dock`,file:`COptxG_file`,fileIcon:`COptxG_fileIcon`,fileName:`COptxG_fileName`,fileSize:`COptxG_fileSize`,header:`COptxG_header`,lead:`COptxG_lead`,list:`COptxG_list`,panel:`COptxG_panel`,paused:`COptxG_paused`,pendingAttachment:`COptxG_pendingAttachment`,pendingRow:`COptxG_pendingRow`,preview:`COptxG_preview`,row:`COptxG_row`,status:`COptxG_status`,thumb:`COptxG_thumb`};let dT=[];function fT(e){let t=e.filter(e=>e.type!==`image`&&e.type!==`file`).map(e=>e.type===`text`?e.text:`[${e.type}]`).join(` `).replace(/\s+/g,` `).trim(),n=Array.from(t);return n.length>200?`${n.slice(0,200).join(``)}…`:t}function pT(e){return e.every(e=>e.type===`text`)?e.map(e=>e.text).join(``):null}function mT(e){let t=[];for(let n of e){if(n.type===`image`){let{attachment:e}=n;e!==void 0&&t.push({type:`image`,attachment:e})}if(n.type===`file`){let{attachment:e}=n;e!==void 0&&t.push({type:`file`,attachment:e})}}return t}function hT({attachment:e,label:t}){return/* @__PURE__ */ (0,h.jsxs)(`span`,{className:Q.file,"aria-label":t,title:e.name,children:[/* @__PURE__ */ (0,h.jsx)(`span`,{className:Q.fileIcon,"aria-hidden":!0,children:/* @__PURE__ */ (0,h.jsx)(d.FileTypeIcon,{path:e.name,size:16})}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:Q.fileName,children:e.name}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:Q.fileSize,children:(0,d.fileSizeText)(e.bytes)})]})}function gT({attachment:e,loadImage:t,label:n}){let[r,i]=(0,g.useState)(null);return(0,g.useEffect)(()=>{let n=!0;return t(e).then(e=>{n&&i(e)},()=>{}),()=>{n=!1}},[e,t]),r===null?/* @__PURE__ */ (0,h.jsx)(`span`,{className:Q.thumb,"aria-hidden":!0}):/* @__PURE__ */ (0,h.jsx)(`img`,{className:Q.thumb,src:r,alt:n})}function _T({upload:e,t}){let n=(0,g.useSyncExternalStore)(e.subscribe,e.getSnapshot);return n?.status===`uploading`?/* @__PURE__ */ (0,h.jsx)(`span`,{className:Q.status,role:`status`,"data-upload-progress":!0,children:n.total===void 0||n.total===0?t(`file.uploading`):t(`file.uploadingPercent`,{percent:Math.round(Math.min(1,(n.loaded??0)/n.total)*100)})}):null}function vT({useSession:e,useProjection:t,updateQueue:n,editQueue:r,notify:i,loadImage:a,t:o}){let s=t(`inbox`),c=t(`queueState`),l=e(e=>e.pendingSubmissions),u=(0,g.useMemo)(()=>{let e=s?.[`next-turn`]??dT,t=new Set(l.filter(e=>e.placement===`transcript`).map(e=>e.requestId));return t.size===0?e:e.filter(({source:e})=>e.kind!==`user`||!(`rpcId`in e)||!t.has(e.rpcId))},[s,l]),f=(0,g.useMemo)(()=>{let e=new Set(u.flatMap(({source:e})=>e.kind===`user`&&`rpcId`in e?[e.rpcId]:[]));return l.filter(t=>t.placement===`queued`&&!e.has(t.requestId))},[l,u]),p=u.length+f.length,m=e(e=>e.running),_=e(e=>e.subagent===null||e.subagent.address.mode===`continuable`),v=(0,g.useRef)(!1),[y,ee]=(0,g.useState)(null),[b,x]=(0,g.useState)(!0),te=(0,g.useId)(),ne=c?.pausedReason??null,re=ne===`interrupted`?o(`queue.paused.interrupted`):ne===`outcome-unknown`?o(`queue.paused.unknown`):ne===`failed`?o(`queue.paused.failed`):null;if((0,g.useEffect)(()=>{p===0&&!b&&x(!0)},[b,p]),p===0)return null;let ie=_&&y!==null,ae=!b||ie,oe=p===1||ae,se=async(e,t,r)=>{if(v.current)return!1;v.current=!0,ee(e);try{return typeof t==`function`?await t():await n(e,t),!0}catch{return i(`error`,r),!1}finally{v.current=!1,ee(t=>t===e?null:t)}};return/* @__PURE__ */ (0,h.jsx)(`div`,{className:Q.dock,"data-queue-dock":``,children:/* @__PURE__ */ (0,h.jsxs)(`div`,{className:Q.panel,children:[re!==null&&/* @__PURE__ */ (0,h.jsx)(`div`,{className:Q.paused,role:`status`,children:re}),p>1&&/* @__PURE__ */ (0,h.jsxs)(`button`,{type:`button`,className:Q.header,"aria-controls":te,"aria-expanded":ae,disabled:ie,onClick:()=>{x(e=>!e)},children:[/* @__PURE__ */ (0,h.jsx)(`span`,{className:Q.lead,"aria-hidden":!0,children:/* @__PURE__ */ (0,h.jsx)(d.IconQueueOutlineRegular,{})}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:Q.count,children:o(`queue.count`,{n:p})}),!oe&&f.length>0&&/* @__PURE__ */ (0,h.jsx)(`span`,{className:Q.status,role:`status`,children:o(`queue.sending`)}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:Q.chevron,"aria-hidden":!0,children:ae?/* @__PURE__ */ (0,h.jsx)(d.IconChevronDownOutlineRegular,{}):/* @__PURE__ */ (0,h.jsx)(d.IconChevronUpOutlineRegular,{})})]}),/* @__PURE__ */ (0,h.jsxs)(`ul`,{id:te,className:Q.list,hidden:!oe,children:[oe&&u.map(e=>{let t=mT(e.content),n=pT(e.content);return/* @__PURE__ */ (0,h.jsxs)(`li`,{className:Q.row,children:[p===1&&/* @__PURE__ */ (0,h.jsx)(`span`,{className:Q.lead,"aria-hidden":!0,children:/* @__PURE__ */ (0,h.jsx)(d.IconQueueOutlineRegular,{})}),t.length>0&&/* @__PURE__ */ (0,h.jsx)(`span`,{className:Q.attachments,children:t.map((e,t)=>e.type===`image`?/* @__PURE__ */ (0,h.jsx)(gT,{attachment:e.attachment,loadImage:a,label:o(`queue.image`)},`${e.attachment.attachmentId}:${t}`):/* @__PURE__ */ (0,h.jsx)(hT,{attachment:e.attachment,label:o(`queue.file`,{name:e.attachment.name})},`${e.attachment.attachmentId}:${e.attachment.name}:${t}`))}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:Q.preview,children:(0,d.projectUserText)(fT(e.content),[])}),_&&/* @__PURE__ */ (0,h.jsxs)(`div`,{className:Q.actions,children:[/* @__PURE__ */ (0,h.jsx)(d.Tooltip,{portal:!0,label:o(`queue.edit`),side:`bottom`,delayMs:500,disabled:n===null,children:/* @__PURE__ */ (0,h.jsx)(`button`,{type:`button`,className:Q.action,"aria-label":o(`queue.edit`),title:n===null?o(`queue.edit.unsupported`):void 0,disabled:y!==null||n===null,onClick:()=>{n!==null&&se(e.id,()=>r(e.id,n),o(`queue.editFailed`))},children:/* @__PURE__ */ (0,h.jsx)(d.IconEditOutlineRegular,{size:14})})}),/* @__PURE__ */ (0,h.jsx)(d.Tooltip,{portal:!0,label:o(`queue.remove`),side:`bottom`,delayMs:500,children:/* @__PURE__ */ (0,h.jsx)(`button`,{type:`button`,className:Q.action,"aria-label":o(`queue.remove`),disabled:y!==null,onClick:()=>{se(e.id,{kind:`remove`},o(`queue.removeFailed`))},children:/* @__PURE__ */ (0,h.jsx)(d.IconTrashOutlineRegular,{size:14})})}),/* @__PURE__ */ (0,h.jsx)(d.Tooltip,{portal:!0,label:o(m?`queue.steer`:`queue.resume`),side:`bottom`,delayMs:500,children:/* @__PURE__ */ (0,h.jsx)(`button`,{type:`button`,className:Q.action,"aria-label":o(m?`queue.steer`:`queue.resume`),disabled:y!==null,onClick:()=>{se(e.id,{kind:`steer`},o(m?`queue.steerFailed`:`queue.resumeFailed`))},children:/* @__PURE__ */ (0,h.jsx)(d.IconSendOutlineRegular,{})})})]})]},e.id)}),oe&&f.map(e=>/* @__PURE__ */ (0,h.jsxs)(`li`,{className:`${Q.row} ${Q.pendingRow}`,"data-submission-echo":``,children:[p===1&&/* @__PURE__ */ (0,h.jsx)(`span`,{className:Q.lead,"aria-hidden":!0,children:/* @__PURE__ */ (0,h.jsx)(d.IconQueueOutlineRegular,{})}),e.attachments.length>0&&/* @__PURE__ */ (0,h.jsx)(`span`,{className:Q.attachments,children:e.attachments.map((e,t)=>/* @__PURE__ */ (0,h.jsxs)(`span`,{className:Q.pendingAttachment,children:[e.type===`image`?/* @__PURE__ */ (0,h.jsx)(`img`,{className:Q.thumb,src:e.value.previewUrl,alt:o(`queue.image`)}):/* @__PURE__ */ (0,h.jsx)(hT,{attachment:e.value,label:o(`queue.file`,{name:e.value.name})}),e.upload&&/* @__PURE__ */ (0,h.jsx)(_T,{upload:e.upload,t:o})]},t))}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:Q.preview,children:(0,d.projectUserText)(e.text,[])}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:Q.status,role:`status`,children:o(`queue.sending`)}),_&&/* @__PURE__ */ (0,h.jsxs)(`div`,{className:Q.actions,children:[/* @__PURE__ */ (0,h.jsx)(`button`,{type:`button`,className:Q.action,"aria-label":o(`queue.edit`),title:o(`queue.sending`),disabled:!0,children:/* @__PURE__ */ (0,h.jsx)(d.IconEditOutlineRegular,{size:14})}),/* @__PURE__ */ (0,h.jsx)(`button`,{type:`button`,className:Q.action,"aria-label":o(`queue.remove`),title:o(`queue.sending`),disabled:!0,children:/* @__PURE__ */ (0,h.jsx)(d.IconTrashOutlineRegular,{size:14})}),/* @__PURE__ */ (0,h.jsx)(`button`,{type:`button`,className:Q.action,"aria-label":o(`queue.steer`),title:o(`queue.sending`),disabled:!0,children:/* @__PURE__ */ (0,h.jsx)(d.IconSendOutlineRegular,{})})]})]},e.requestId))]})]})})}let yT={name:`conversation-queue-dock`,inject:[`slots`,`conversation`,`sessions`,`uiConversation`],apply(e,t){e.slots.inject(`conversation.input.dock`,()=>e.slots.register({name:`conversation.input.dock`,id:`queue`,order:20,locale:Ic,inject:n=>{let r=e.sessions.scope(n);if(r===void 0)throw Error(`queue dock: session "${n}" resolved no scope`);let i=r.get(`conversation`);if(i===void 0)throw Error(`queue dock: conversation service unavailable`);return{updateQueue:(e,t)=>i.updateQueue(e,t),editQueue:async(e,r)=>{let a=t.shell(n);await i.updateQueue(e,{kind:`remove`});let o=a.draftSnapshot;a.setDraft({...o,text:o.text===``?r:`${o.text}\n${r}`}),a.actions.persistDraft(),a.focus()},notify:(e,t)=>{i.input.for(r).notify(e,t)},loadImage:t=>e.uiConversation.imageUrl(n,t)}}},vT))}},bT=`@deepseek-ai/dsh-client-ui-conversation/EnterBehaviorRow.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(bT)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-conversation`,e.dataset.pluginCss=bT,e.textContent=`._2CWexq_row{border-bottom:.5px solid var(--dsw-alias-border-l2);align-items:center;gap:8px;padding:16px 0;display:flex}._2CWexq_rowText{flex-direction:column;flex:1;gap:4px;min-width:0;padding-right:48px;display:flex}._2CWexq_title{color:var(--dsw-alias-label-primary);font-size:14px;font-weight:400;line-height:22px}._2CWexq_desc{color:var(--dsw-alias-label-tertiary);font-size:12px;font-weight:400;line-height:18px}._2CWexq_selector{border-radius:var(--dsw-radius-md);background:var(--dsw-alias-bg-module-platform);height:36px;font:inherit;color:var(--dsw-alias-label-primary);cursor:pointer;border:none;align-items:center;gap:12px;padding:0 14px;font-size:14px;line-height:22px;display:inline-flex}._2CWexq_selector:hover{background:var(--dsw-alias-interactive-bg-hover)}._2CWexq_chevron{flex:none}`,document.head.appendChild(e)}var xT={chevron:`_2CWexq_chevron`,desc:`_2CWexq_desc`,row:`_2CWexq_row`,rowText:`_2CWexq_rowText`,selector:`_2CWexq_selector`,title:`_2CWexq_title`};let ST=[{id:`queue`,label:`settings.enter.queue`},{id:`steer`,label:`settings.enter.steer`}];function CT({useBusyEnter:e,setBusyEnter:t,t:n}){let r=e(e=>e),[i,a]=(0,g.useState)(!1),o=r===`queue`?`settings.enter.queue`:`settings.enter.steer`;return/* @__PURE__ */ (0,h.jsxs)(`div`,{className:xT.row,children:[/* @__PURE__ */ (0,h.jsxs)(`div`,{className:xT.rowText,children:[/* @__PURE__ */ (0,h.jsx)(`div`,{className:xT.title,children:n(`settings.enter.title`)}),/* @__PURE__ */ (0,h.jsx)(`div`,{className:xT.desc,children:n(`settings.enter.description`)})]}),/* @__PURE__ */ (0,h.jsx)(d.Menu,{open:i,onClose:()=>{a(!1)},items:ST.map(e=>({id:e.id,label:n(e.label)})),selectedId:r,onSelect:e=>{a(!1),t(e)},align:`end`,portal:!0,anchor:/* @__PURE__ */ (0,h.jsxs)(`button`,{type:`button`,className:xT.selector,"aria-haspopup":`menu`,"aria-expanded":i,onClick:()=>{a(e=>!e)},children:[n(o),/* @__PURE__ */ (0,h.jsx)(d.IconChevronDownOutlineRegular,{className:xT.chevron})]})})]})}let wT={views:{get:()=>void 0,grouped:()=>void 0},activeTargets:/* @__PURE__ */ new Set};function TT(e,t){return t.activeTargets.size>0||!e.blank&&!e.awaitingFirstTurn||e.running?`active`:e.promptAttempted?`engaging`:`blank`}let ET=`@deepseek-ai/dsh-client-ui-conversation/ConversationRoot.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(ET)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-conversation`,e.dataset.pluginCss=ET,e.textContent=`.ncnpZW_root{background:var(--dsw-alias-bg-base);flex-direction:column;min-width:0;height:100%;display:flex;position:relative}body[data-codexhost-wallpaper] .ncnpZW_root{background:0 0}.ncnpZW_header{box-sizing:border-box;border-bottom:.5px solid var(--dsw-alias-border-l3);flex:none;grid-template-columns:auto minmax(0,1fr);min-height:76px;padding:10px 28px 0 20px;display:grid}.ncnpZW_header:where(:not(:has(.ncnpZW_tabs))){min-height:0;padding-bottom:10px}.ncnpZW_headerBlank{border-bottom:none;min-height:0;padding-bottom:0}.ncnpZW_headerBlank .ncnpZW_headerCorner{margin-left:auto}html:not([data-platform=darwin]) .ncnpZW_headerSessionless{padding-top:0}html:not([data-platform=darwin]) .ncnpZW_headerSessionless .ncnpZW_titleRow{min-height:0}[data-platform=darwin] .ncnpZW_headerLeading,[data-platform=darwin] .ncnpZW_headerActions,[data-platform=darwin] .ncnpZW_headerUtilities,[data-platform=darwin] .ncnpZW_headerCorner{-webkit-app-region:no-drag}.ncnpZW_titleRow{min-height:30px;grid-column:2;align-items:center;gap:0;padding-inline-start:max(0px, calc(var(--dsh-frame-leading-clearance,0px) - 20px));display:flex;container-type:inline-size}[data-phone] .ncnpZW_header:has([data-slot="conversation.header.navigation"] button){padding-top:env(safe-area-inset-top)}[data-phone] .ncnpZW_header:has([data-slot="conversation.header.navigation"] button) .ncnpZW_titleRow{min-height:44px}.ncnpZW_titleCluster{flex:1;align-items:center;gap:10px;min-width:0;display:flex}.ncnpZW_headerLeading{flex:none;grid-area:1/1;align-items:center;gap:8px;display:flex}.ncnpZW_crumbs{white-space:nowrap;align-items:center;gap:4px;min-width:0;display:flex;overflow:hidden}.ncnpZW_crumbSeg{align-items:center;gap:4px;min-width:0;display:inline-flex}.ncnpZW_crumbSep{color:var(--dsw-alias-label-caption);font-size:14px;line-height:20px}.ncnpZW_crumb{border-radius:var(--dsw-radius-md);max-width:220px;color:var(--dsw-alias-label-tertiary);text-overflow:ellipsis;white-space:nowrap;cursor:pointer;background:0 0;border:none;padding:4px 8px;font-size:14px;line-height:20px;display:inline-block;overflow:hidden}.ncnpZW_crumbSubagent{font-size:12px;line-height:18px}button.ncnpZW_crumb:hover{background:var(--dsw-alias-interactive-bg-hover)}.ncnpZW_crumbCurrent{color:var(--dsw-alias-label-primary);cursor:default;font-weight:500}.ncnpZW_headerActions{flex:none;align-items:center;gap:8px;display:flex}.ncnpZW_headerUtilities{flex:none;align-items:center;gap:8px;margin-left:20px;display:flex}.ncnpZW_headerUtilities:empty{display:none}.ncnpZW_headerCorner{flex:none;align-items:center;margin-left:8px;margin-right:-16px;display:flex}.ncnpZW_headerCorner:empty{display:none}.ncnpZW_tabs{z-index:1;grid-column:1/-1;gap:36px;margin-top:10px;padding-left:8px;display:flex;position:relative}.ncnpZW_tab{color:var(--dsw-alias-label-tertiary);cursor:pointer;background:0 0;border:none;padding:0 0 9px;font-size:13px;font-weight:500;line-height:16px;position:relative}.ncnpZW_tab:after{content:"";background:0 0;border-radius:2px;height:2px;position:absolute;bottom:-1px;left:0;right:0}.ncnpZW_tabActive{color:var(--dsw-alias-state-business-primary)}.ncnpZW_tabActive:after{background:var(--dsw-alias-state-business-primary)}.ncnpZW_viewArea{flex-direction:column;flex:1;min-height:0;display:flex}.ncnpZW_widthHandle{z-index:0;width:min(10px, calc((100% - var(--dsh-chat-content-width)) / 2 - 24px - 24px));cursor:col-resize;position:absolute;top:0;bottom:0}.ncnpZW_widthHandle[data-side=left]{right:calc(50% + var(--dsh-chat-content-width) / 2 + 24px)}.ncnpZW_widthHandle[data-side=right]{left:calc(50% + var(--dsh-chat-content-width) / 2 + 24px)}.ncnpZW_widthHandle:after{content:"";background:linear-gradient(to bottom, transparent calc(var(--dsh-width-handle-pointer-y,50%) - 36px), var(--dsw-alias-scrollbar-bg-l1) calc(var(--dsh-width-handle-pointer-y,50%) - 8px), var(--dsw-alias-scrollbar-bg-l1) calc(var(--dsh-width-handle-pointer-y,50%) + 8px), transparent calc(var(--dsh-width-handle-pointer-y,50%) + 36px));opacity:0;pointer-events:none;border-radius:2px;width:2px;position:absolute;top:0;bottom:0}.ncnpZW_widthHandle[data-side=left]:after{right:4px}.ncnpZW_widthHandle[data-side=right]:after{left:4px}.ncnpZW_widthHandle:hover:after,.ncnpZW_widthHandle[data-dragging]:after{opacity:1}.ncnpZW_widthHandle[data-dragging]{z-index:8}.ncnpZW_root:has([data-conversation-composer-overlay]) .ncnpZW_widthHandle{display:none}.ncnpZW_composerStack{--dsh-composer-stack-gap:6px;gap:var(--dsh-composer-stack-gap);flex-direction:column;display:flex}.ncnpZW_composerSeat{--dsh-composer-text-max-height:336px;flex-direction:column;flex:none;display:flex}.ncnpZW_root[data-phase=active]{overflow:hidden}.ncnpZW_root[data-phase=active] .ncnpZW_header{flex:none}.ncnpZW_body{--dsh-chat-content-width:var(--dsh-chat-user-width,clamp(680px, calc(var(--dsh-conversation-column-width,0px) * .64), 920px));--dsh-composer-card-max-width:calc(var(--dsh-chat-content-width) + 32px);--dsh-composer-side-clearance:16px;--dsh-composer-dock-inset:8px;flex-direction:column;flex:1;min-height:0;display:flex;position:relative}.ncnpZW_embeddedBody{--dsh-chat-content-width:min(calc(100% - 32px), 920px);--dsh-composer-card-max-width:min(calc(100% - 16px), 952px);--dsh-composer-side-clearance:8px;--dsh-composer-dock-inset:8px;overflow:hidden}.ncnpZW_scrollBody{scrollbar-gutter:stable;flex-direction:column;flex:1;min-height:0;margin-right:2px;display:flex;overflow-y:auto}.ncnpZW_scrollBody::-webkit-scrollbar-track{margin:2px}.ncnpZW_root[data-phase=active] .ncnpZW_viewArea,.ncnpZW_embeddedBody[data-content-phase=active] .ncnpZW_viewArea{flex:1 0 auto;min-height:auto}.ncnpZW_root[data-phase=active] .ncnpZW_composerSeat,.ncnpZW_embeddedBody[data-content-phase=active] .ncnpZW_composerSeat{z-index:7;background:var(--dsh-phone-composer-mask,linear-gradient(180deg, color-mix(in srgb, var(--dsw-alias-bg-base) 0%, transparent) 0px, var(--dsw-alias-bg-base) 36px));position:sticky;bottom:0}@supports (backdrop-filter:blur(14px)){[data-phone] .ncnpZW_composerSeat:where(:has([data-chain-overlay-fallback=conversation\\.composer]:only-child [data-composer-card])){--dsh-phone-composer-mask:linear-gradient(180deg, transparent 0px, color-mix(in srgb, var(--dsw-alias-bg-base) 60%, transparent) 36px, color-mix(in srgb, var(--dsw-alias-bg-base) 60%, transparent) calc(100% - 28px), var(--dsw-alias-bg-base) 100%)}}@media (prefers-reduced-transparency:reduce),(prefers-contrast:more),(forced-colors:active){[data-phone] .ncnpZW_composerSeat{--dsh-phone-composer-mask:initial}}body[data-codexhost-wallpaper] .ncnpZW_root[data-phase=active] .ncnpZW_composerSeat,body[data-codexhost-wallpaper] .ncnpZW_embeddedBody[data-content-phase=active] .ncnpZW_composerSeat{background:0 0}.ncnpZW_root[data-phase=active] .ncnpZW_composerSeat:has([data-trigger-menu]){z-index:9}.ncnpZW_scrollBody:has([data-conversation-composer-overlay]){scrollbar-gutter:auto;position:relative;overflow:hidden auto}.ncnpZW_scrollBody:has([data-conversation-composer-overlay])>[data-slot=conversation\\.session]>.ncnpZW_viewArea{flex:1 1 0;min-height:0;overflow:hidden}.ncnpZW_scrollBody:has([data-conversation-composer-overlay])>.ncnpZW_composerSeat{right:var(--dsh-scrollbar-width);position:absolute;bottom:0;left:0}.ncnpZW_composerHero{width:min(calc(var(--dsh-composer-card-max-width) + 2 * var(--dsh-composer-side-clearance)), 100%);z-index:1;align-self:center;gap:8px;padding-bottom:32px}.ncnpZW_heroWorkspaceRow{align-items:center;gap:2px;min-width:0;margin-top:4px;padding:0 16px 0 20px;display:flex}.ncnpZW_root[data-phase=hero] .ncnpZW_scrollBody,.ncnpZW_embeddedBody[data-content-phase=hero] .ncnpZW_scrollBody{justify-content:center;overflow-y:auto}.ncnpZW_root[data-phase=settling] .ncnpZW_composerSeat,.ncnpZW_embeddedBody[data-content-phase=settling] .ncnpZW_composerSeat{visibility:hidden}`,document.head.appendChild(e)}var $={body:`ncnpZW_body`,composerHero:`ncnpZW_composerHero`,composerSeat:`ncnpZW_composerSeat`,composerStack:`ncnpZW_composerStack`,crumb:`ncnpZW_crumb`,crumbCurrent:`ncnpZW_crumbCurrent`,crumbSeg:`ncnpZW_crumbSeg`,crumbSep:`ncnpZW_crumbSep`,crumbSubagent:`ncnpZW_crumbSubagent`,crumbs:`ncnpZW_crumbs`,embeddedBody:`ncnpZW_embeddedBody`,header:`ncnpZW_header`,headerActions:`ncnpZW_headerActions`,headerBlank:`ncnpZW_headerBlank`,headerCorner:`ncnpZW_headerCorner`,headerLeading:`ncnpZW_headerLeading`,headerSessionless:`ncnpZW_headerSessionless`,headerUtilities:`ncnpZW_headerUtilities`,heroWorkspaceRow:`ncnpZW_heroWorkspaceRow`,root:`ncnpZW_root`,scrollBody:`ncnpZW_scrollBody`,tab:`ncnpZW_tab`,tabActive:`ncnpZW_tabActive`,tabs:`ncnpZW_tabs`,titleCluster:`ncnpZW_titleCluster`,titleRow:`ncnpZW_titleRow`,viewArea:`ncnpZW_viewArea`,widthHandle:`ncnpZW_widthHandle`};let DT=`dsh.conversation.contentWidth`;function OT(){let e=localStorage.getItem(DT);if(e===null)return null;let t=Number(e);return Number.isFinite(t)&&t>0?t:null}function kT(e,t){let n=Math.max(640,e-176);return t===null?Math.max(680,Math.min(e*.64,920)):Math.min(Math.max(t,640),n)}function AT(e,t){if(e.deltaMode===1){let n=Number.parseFloat(getComputedStyle(t).lineHeight);return e.deltaY*(Number.isFinite(n)?n:16)}return e.deltaMode===2?e.deltaY*t.clientHeight:e.deltaY}function jT(e){let t=(0,g.useRef)(!1),n=(0,g.useRef)(0),r=(0,g.useRef)(0),i=(0,g.useRef)(0),a=(0,g.useRef)(null),o=(0,g.useRef)(e);o.current=e;let s=()=>{let e=i.current-r.current,t=o.current.side===`right`?e:-e;return n.current+t*2},c=()=>{a.current!==null&&(cancelAnimationFrame(a.current),a.current=null)},l=(0,g.useCallback)(e=>{e.button===0&&(e.preventDefault(),e.currentTarget.setPointerCapture(e.pointerId),r.current=e.clientX,i.current=e.clientX,n.current=o.current.onStart(),t.current=!0,e.currentTarget.toggleAttribute(`data-dragging`,!0))},[]),u=(0,g.useCallback)(e=>{if(!t.current||!e.currentTarget.hasPointerCapture(e.pointerId))return;let n=e.currentTarget.getBoundingClientRect();e.currentTarget.style.setProperty(`--dsh-width-handle-pointer-y`,`${e.clientY-n.top}px`),i.current=e.clientX,a.current??=requestAnimationFrame(()=>{a.current=null,o.current.onDrag(s())})},[]),d=(0,g.useCallback)(e=>{t.current&&e.currentTarget.hasPointerCapture(e.pointerId)&&(t.current=!1,e.currentTarget.toggleAttribute(`data-dragging`,!1),e.currentTarget.releasePointerCapture(e.pointerId),c(),i.current=e.clientX,i.current!==r.current&&o.current.onCommit(s()),o.current.onEnd())},[]),f=(0,g.useCallback)(e=>{t.current&&(t.current=!1,e.currentTarget.toggleAttribute(`data-dragging`,!1),c(),o.current.onEnd())},[]),p=(0,g.useCallback)(e=>{let t=e.currentTarget.parentElement;
|
|
172
|
+
`),t+=i.draft;for(let t of i.occurrences)n.push({...t,offset:e+t.offset})}let i=new Set(r.map(e=>e.id));this.responseAnnotations=[...r,...this.responseAnnotations.filter(e=>!i.has(e.id))],this.restoringFailures=!0;try{this.draftEditor.restoreDraft(t,n),this.draftEditor.clearHistory(),this.failedRestoreRev=this.rev}finally{this.restoringFailures=!1}this.publish()}restoreAttachments(e){if(e.length===0)return;let t=new Set(this.attachmentIds),n=e.filter(e=>!t.has(e));n.length!==0&&(this.attachmentIds=[...n,...this.attachmentIds],this.publish())}adjudicate(e,t){let n=this.deps.inputTriggers?.();n===void 0?this.dispatchRun({type:`adjudicated`,attempt:e,outcome:void 0}):(this.adjudication=n.adjudicate(t.trim(),e.signal,{attachments:this.attachmentIds.length}),this.adjudication.then(t=>{this.adjudication=void 0,!this.dead(e)&&this.dispatchRun({type:`adjudicated`,attempt:e,outcome:t})},t=>{if(this.adjudication=void 0,this.dead(e))return;let n=t instanceof Error?t.message:String(t);this.dispatchRun({type:`adjudication-failed`,attempt:e,message:n})}))}beginSubmit(e,t,n){let r=t.attachments===!0?[...this.attachmentIds]:[];Promise.resolve().then(async()=>{let i=r.length>0?await this.deps.commandAttachments.serialize(r):[];if(!this.dead(e))return t.submit(n,this.deps.actx,i)}).then(t=>{if(!(t===void 0||this.dead(e))){if(t.kind===`success`&&r.length>0){let e=new Set(r);this.attachmentIds=this.attachmentIds.filter(t=>!e.has(t)),this.deps.commandAttachments.release(r)}this.dispatchRun({type:`submit-settled`,attempt:e,ok:t.kind===`success`,draft:this.projection.clipboardText,outcome:t,...t.kind===`error`&&t.text===void 0?{message:`command failed`}:{}})}},t=>{if(this.dead(e))return;let n=t instanceof Error?t.message:String(t);this.dispatchRun({type:`submit-settled`,attempt:e,ok:!1,draft:this.projection.clipboardText,message:n})})}dead(e){return this.disposed||e.signal.aborted}compose(){let e=this.core.state;return{draft:this.projection.clipboardText,attachmentIds:this.attachmentIds,responseAnnotations:this.responseAnnotations,draftRev:this.rev,...this.primaryAction===void 0?{}:{primaryAction:this.primaryAction},phase:e.phase,...e.claim===void 0?{}:{claim:e.claim},occurrences:this.projection.occurrences,queue:this.deps.inbox?.getSnapshot()?.[`next-turn`]??MT}}publish(){let e=this.compose();this.state.set(e);let t=this.draftSnapshot;t!==this.lastPublishedDraft&&(this.lastPublishedDraft=t,this.persistDraft?.(t))}};function FT(e,t){let{state:n,timestamp:r,mode:i}=t;if(n===void 0)return;let a=n.model;e.get(`productAnalytics`)?.track(`send_button_click`,{...n.sessionId===void 0?{}:{session_id:n.sessionId},...a===void 0?{}:{model_name:`${a.provider}/${a.name}`,...a.effort===void 0?{}:{thinking_effort:a.effort}},run_mode:n.runMode,msg_type:n.running?i:`default`},r)}var IT=class{rootCtx;t;shells=/* @__PURE__ */ new WeakMap;constructor(e,t){this.rootCtx=e,this.t=t}for(e){let t=this.sessions(),n=t.sessionOf(e),r=n===void 0?void 0:t.binding(n.sessionId);if(r===void 0||r.session!==n)throw Error(`conversation.input.for requires a retained Session scope`);return this.shellFor(r)}captureReferenceInsertion(e){let t=this.sessions(),n=this.shells.get(e);if(t.binding(e.sessionId)!==e||n===void 0)return;let r=this.rootCtx.get(`conversation`);if(r===void 0)return;let i=n.actions.captureInsertion(),a=r.blocks.storeFor(e.sessionId),o=this.rootCtx.uiSession.sessionStatus,s=!1,c=()=>{let r=e.session.getSnapshot();return!s&&t.binding(e.sessionId)===e&&r.openState===`open`&&!r.removed&&a.getSnapshot()===void 0&&o.getSnapshot().get(e.sessionId)?.pendingInteraction===void 0&&n.snapshot.draftRev===i.draftRev&&n.canInsertReferences()};return{getSnapshot:c,subscribe:r=>{let i=[t.list.subscribe(r),e.session.subscribe(r),n.state.subscribe(r),a.subscribe(r),o.subscribe(r),n.editor.registerEditableListener(r),n.editor.registerRootListener(r)];return()=>i.forEach(e=>e())},insert:e=>{let t=c();return s=!0,t&&n.insertReferences([e],i)}}}requestDraftInitialization(e,t){if(this.sessions().binding(e.sessionId)!==e)throw Error(`conversation.input.requestDraftInitialization requires a retained Session binding`);return this.shellFor(e).requestDraftInitialization(t)}shellFor(e){let t=this.shells.get(e);if(t!==void 0)return t;let{session:n,ctx:r}=e,i=new PT({actx:r,submissionState:()=>{let e=n.getSnapshot(),t=n.projections.faceOf(`modelSelection`).getSnapshot(),r=n.projections.faceOf(`plan`).getSnapshot(),i=n.projections.faceOf(`goal`).getSnapshot(),a=t?.next??t?.lastUsed;return Object.freeze({...e.blank?{}:{sessionId:e.sessionId},...a==null?{}:{model:Object.freeze({provider:a.provider,name:a.model,...a.reasoningEffort===void 0?{}:{effort:a.reasoningEffort}})},runMode:r?.active?`plan`:i?.goal.phase===`active`?`goal`:`default`,running:e.running})},messageSubmitted:e=>{FT(this.rootCtx,e)},inputTriggers:()=>this.controller(r),popup:()=>this.popup(r),inbox:n.projections.faceOf(`inbox`),defaultSink:(e,t,r,i)=>this.sink(n,e,t,r,i),steerQueue:()=>{this.steerQueue(n,i)},commandAttachments:{serialize:async e=>(await this.conversation().serializeDraftAttachments(e)).attachments,release:e=>{let t=this.rootCtx.get(`conversation`);for(let n of e)t?.releaseDraftAttachment(n)},unsupportedNotice:e=>this.t(`command.attachmentsUnsupported`,{command:e.trim().replace(/^\//u,``)})}});return this.shells.set(e,i),r.effect(()=>{let t=[r.on(`slash/input-begin-command`,e=>i.beginCommand(e.claim,e.span)?!0:void 0),r.on(`slash/input-insert-reference`,e=>i.insertReference(e.reference,e.span)?!0:void 0),r.on(`slash/input-consume-token`,e=>i.consumeToken(e.guard)?!0:void 0),r.on(`slash/input-insert-text`,e=>i.insertText(e.text,e.span,e.continue===!0)?!0:void 0)];return()=>{for(let e of t)e();let n=i.dispose();this.shells.delete(e);let r=this.rootCtx.get(`conversation`);for(let e of n)r?.releaseDraftAttachment(e)}},`conversation.input: session shell`),r.inject([`inputTriggers`],e=>{e.effect(()=>(i.refreshLexiconSubscription(),()=>{i.refreshLexiconSubscription()}),`conversation.input: reference catalogs`)}),i.setDraft(jc(e.sessionId)),i}shell(e){let t=this.sessions().binding(e);if(t===void 0)throw Error(`conversation.input: session "${e}" resolved no binding`);return this.shellFor(t)}keyboard(e){return this.shell(e)}canPickFiles(e){let t=this.sessions().binding(e);return t!==void 0&&this.shells.get(t)?.canPickFiles()===!0}pickFiles(e){let t=this.sessions().binding(e);t!==void 0&&this.shells.get(t)?.pickFiles()}inputTriggers(e){let t=this.sessions().binding(e);return t===void 0?void 0:this.controller(t.ctx)}sink(e,t,n,r,i){return t===``&&n.length===0?Promise.resolve({kind:`success`}):this.conversation().sendSession(e,t,n,r,i)}async steerQueue(e,t){let n=e.projections.faceOf(`inbox`).getSnapshot()?.[`next-turn`]??[];if(n.length!==0)for(let r of n){let n=await e.updateQueue(r.id,{kind:`steer`});if(!n.ok){if(n.error.code===`session/steer-unavailable`||n.error.code===`session/queue-item-not-found`)return;t.notify(`error`,this.t(`queue.steerFailed`));return}}}controller(e){if(this.sessions().sessionOf(e)!==void 0)return this.rootCtx.get(`inputTriggers`)?.sessionOf(e)}popup(e){if(this.sessions().sessionOf(e)!==void 0)return this.rootCtx.get(`commandUi`)?.popupFor(e)}sessions(){let e=this.rootCtx.get(`sessions`);if(e===void 0)throw Error(`conversation.input: sessions service unavailable`);return e}conversation(){let e=this.rootCtx.get(`conversation`);if(e===void 0)throw Error(`conversation.input: conversation service unavailable`);return e}};let LT=`busyEnter`,RT=[`queue`,`steer`],zT=`queue`,BT={[LT]:w.union([...RT]).default(zT)};w.object(BT);function VT(e,t,n,r){return!t||!r?`queue`:n===`enter`?e:e===`queue`?`steer`:`queue`}var HT=class{busyEnter=(0,f.createSnapshotStore)(zT);unsubscribe;host;constructor(e){this.host=e,e!==void 0&&(this.unsubscribe=e.subscribe(()=>{this.adopt(e)}),this.adopt(e))}dispose(){this.unsubscribe?.()}setBusyEnter(e){this.busyEnter.getSnapshot()!==e&&(this.busyEnter.set(e),this.host?.set(LT,e))}adopt(e){let t=e.getSnapshot().value;t!==void 0&&this.busyEnter.getSnapshot()!==t.busyEnter&&this.busyEnter.set(t.busyEnter)}};let UT=`@deepseek-ai/dsh-client-ui-conversation/QueueDock.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(UT)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-conversation`,e.dataset.pluginCss=UT,e.textContent=`.COptxG_dock{box-sizing:border-box;width:calc(100% - var(--dsh-composer-side-clearance) - var(--dsh-composer-side-clearance) - var(--dsh-composer-dock-inset) - var(--dsh-composer-dock-inset));max-width:calc(var(--dsh-composer-card-max-width) - var(--dsh-composer-dock-inset) - var(--dsh-composer-dock-inset));margin:0 auto calc(0px - var(--dsh-composer-stack-gap) - 3px);padding:0 var(--dsh-composer-dock-inset);flex:none}.COptxG_pendingAttachment{flex-direction:column;gap:2px;display:inline-flex}.COptxG_panel{isolation:isolate;border-radius:var(--dsw-radius-lg) var(--dsw-radius-lg) 0 0;--dsh-scrollbar-thumb:var(--dsw-alias-scrollbar-bg-l2);--dsh-scrollbar-thumb-hover:var(--dsw-alias-scrollbar-hover-l2);width:100%;padding:2px 0;position:relative;overflow:hidden}.COptxG_panel:before{z-index:-1;border-radius:inherit;background:var(--dsw-specific-menu);backdrop-filter:var(--dsw-menu-backdrop-filter);content:"";pointer-events:none;position:absolute;inset:0}.COptxG_panel:after{border:.5px solid var(--dsw-alias-border-l1);border-radius:inherit;content:"";pointer-events:none;border-bottom:none;position:absolute;inset:0}.COptxG_paused{color:var(--dsw-alias-label-tertiary);font:var(--dsw-font-xs-13);padding:6px 12px 2px}.COptxG_header{box-sizing:border-box;border-radius:var(--dsw-radius-md);width:100%;height:36px;color:var(--dsw-alias-label-primary);text-align:left;cursor:pointer;background:0 0;border:none;align-items:center;gap:10px;padding:4px 12px;display:flex}.COptxG_header:focus-visible{outline:var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:-2px}.COptxG_header:disabled{cursor:default}.COptxG_lead{color:var(--dsw-alias-label-tertiary);flex:none;place-items:center;display:grid}.COptxG_count{min-width:0;font-family:Inter, var(--dsw-font-family);flex:auto;font-size:13px;font-weight:500;line-height:24px}.COptxG_chevron{width:14px;height:14px;color:var(--dsw-alias-label-tertiary);flex:none;place-items:center;display:grid}.COptxG_list{max-height:180px;margin:0;padding:0;list-style:none;overflow-y:auto}.COptxG_row{box-sizing:border-box;border-radius:var(--dsw-radius-md);align-items:center;gap:10px;width:100%;min-height:36px;padding:4px 5px 4px 12px;display:flex}.COptxG_row+.COptxG_row{box-shadow:inset 0 1px 0 var(--dsw-alias-border-l1)}.COptxG_attachments{flex:none;gap:4px;min-width:0;max-width:55%;display:flex;overflow:hidden}.COptxG_pendingRow .COptxG_attachments{flex-shrink:1}.COptxG_file{border:.5px solid var(--dsw-alias-border-l1);border-radius:var(--dsw-radius-sm);background:var(--dsw-alias-bg-base);box-sizing:border-box;flex:0 180px;align-items:center;gap:4px;min-width:74px;height:24px;padding:0 6px;display:inline-flex;overflow:hidden}.COptxG_fileIcon{flex:none;width:16px;height:16px;display:inline-flex}.COptxG_fileName{min-width:0;color:var(--dsw-alias-label-primary-dimmed);font:var(--dsw-font-xs-13);text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.COptxG_fileSize{color:var(--dsw-alias-label-tertiary);white-space:nowrap;flex:none;font-size:10px}.COptxG_thumb{border:.5px solid var(--dsw-alias-border-l1);border-radius:var(--dsw-radius-xs);background:var(--dsw-alias-bg-base);object-fit:cover;width:24px;height:24px}.COptxG_preview{min-width:0;font:var(--dsw-font-xs-13);font-family:Inter, var(--dsw-font-family);color:var(--dsw-alias-label-primary-dimmed);text-overflow:ellipsis;white-space:nowrap;word-break:break-word;flex:auto;overflow:hidden}.COptxG_actions{flex:none;align-items:center;gap:10px;display:flex}.COptxG_status{color:var(--dsw-alias-label-tertiary);font:var(--dsw-font-xs-13);white-space:nowrap;flex:none}.COptxG_action{corner-shape:round;width:28px;height:28px;color:var(--dsw-alias-label-tertiary);cursor:pointer;background:0 0;border:none;border-radius:999px;flex:none;place-items:center;padding:0;display:grid}.COptxG_action:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover)}.COptxG_action:focus-visible{outline:var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:-2px}.COptxG_action:disabled{cursor:default;opacity:.45}`,document.head.appendChild(e)}var Q={action:`COptxG_action`,actions:`COptxG_actions`,attachments:`COptxG_attachments`,chevron:`COptxG_chevron`,count:`COptxG_count`,dock:`COptxG_dock`,file:`COptxG_file`,fileIcon:`COptxG_fileIcon`,fileName:`COptxG_fileName`,fileSize:`COptxG_fileSize`,header:`COptxG_header`,lead:`COptxG_lead`,list:`COptxG_list`,panel:`COptxG_panel`,paused:`COptxG_paused`,pendingAttachment:`COptxG_pendingAttachment`,pendingRow:`COptxG_pendingRow`,preview:`COptxG_preview`,row:`COptxG_row`,status:`COptxG_status`,thumb:`COptxG_thumb`};let WT=[];function GT(e){let t=e.filter(e=>e.type!==`image`&&e.type!==`file`).map(e=>e.type===`text`?e.text:`[${e.type}]`).join(` `).replace(/\s+/g,` `).trim(),n=Array.from(t);return n.length>200?`${n.slice(0,200).join(``)}…`:t}function KT(e){return e.every(e=>e.type===`text`)?e.map(e=>e.text).join(``):null}function qT(e){let t=[];for(let n of e){if(n.type===`image`){let{attachment:e}=n;e!==void 0&&t.push({type:`image`,attachment:e})}if(n.type===`file`){let{attachment:e}=n;e!==void 0&&t.push({type:`file`,attachment:e})}}return t}function JT({attachment:e,label:t}){return/* @__PURE__ */ (0,h.jsxs)(`span`,{className:Q.file,"aria-label":t,title:e.name,children:[/* @__PURE__ */ (0,h.jsx)(`span`,{className:Q.fileIcon,"aria-hidden":!0,children:/* @__PURE__ */ (0,h.jsx)(d.FileTypeIcon,{path:e.name,size:16})}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:Q.fileName,children:e.name}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:Q.fileSize,children:(0,d.fileSizeText)(e.bytes)})]})}function YT({attachment:e,loadImage:t,label:n}){let[r,i]=(0,g.useState)(null);return(0,g.useEffect)(()=>{let n=!0;return t(e).then(e=>{n&&i(e)},()=>{}),()=>{n=!1}},[e,t]),r===null?/* @__PURE__ */ (0,h.jsx)(`span`,{className:Q.thumb,"aria-hidden":!0}):/* @__PURE__ */ (0,h.jsx)(`img`,{className:Q.thumb,src:r,alt:n})}function XT({upload:e,t}){let n=(0,g.useSyncExternalStore)(e.subscribe,e.getSnapshot);return n?.status===`uploading`?/* @__PURE__ */ (0,h.jsx)(`span`,{className:Q.status,role:`status`,"data-upload-progress":!0,children:n.total===void 0||n.total===0?t(`file.uploading`):t(`file.uploadingPercent`,{percent:Math.round(Math.min(1,(n.loaded??0)/n.total)*100)})}):null}function ZT({useSession:e,useProjection:t,updateQueue:n,editQueue:r,notify:i,loadImage:a,t:o}){let s=t(`inbox`),c=t(`queueState`),l=e(e=>e.pendingSubmissions),u=(0,g.useMemo)(()=>{let e=s?.[`next-turn`]??WT,t=new Set(l.filter(e=>e.placement===`transcript`).map(e=>e.requestId));return t.size===0?e:e.filter(({source:e})=>e.kind!==`user`||!(`rpcId`in e)||!t.has(e.rpcId))},[s,l]),f=(0,g.useMemo)(()=>{let e=new Set(u.flatMap(({source:e})=>e.kind===`user`&&`rpcId`in e?[e.rpcId]:[]));return l.filter(t=>t.placement===`queued`&&!e.has(t.requestId))},[l,u]),p=u.length+f.length,m=e(e=>e.running),_=e(e=>e.subagent===null||e.subagent.address.mode===`continuable`),v=(0,g.useRef)(!1),[y,ee]=(0,g.useState)(null),[b,te]=(0,g.useState)(!0),x=(0,g.useId)(),ne=c?.pausedReason??null,re=ne===`interrupted`?o(`queue.paused.interrupted`):ne===`outcome-unknown`?o(`queue.paused.unknown`):ne===`failed`?o(`queue.paused.failed`):null;if((0,g.useEffect)(()=>{p===0&&!b&&te(!0)},[b,p]),p===0)return null;let ie=_&&y!==null,ae=!b||ie,oe=p===1||ae,se=async(e,t,r)=>{if(v.current)return!1;v.current=!0,ee(e);try{return typeof t==`function`?await t():await n(e,t),!0}catch{return i(`error`,r),!1}finally{v.current=!1,ee(t=>t===e?null:t)}};return/* @__PURE__ */ (0,h.jsx)(`div`,{className:Q.dock,"data-queue-dock":``,children:/* @__PURE__ */ (0,h.jsxs)(`div`,{className:Q.panel,children:[re!==null&&/* @__PURE__ */ (0,h.jsx)(`div`,{className:Q.paused,role:`status`,children:re}),p>1&&/* @__PURE__ */ (0,h.jsxs)(`button`,{type:`button`,className:Q.header,"aria-controls":x,"aria-expanded":ae,disabled:ie,onClick:()=>{te(e=>!e)},children:[/* @__PURE__ */ (0,h.jsx)(`span`,{className:Q.lead,"aria-hidden":!0,children:/* @__PURE__ */ (0,h.jsx)(d.IconQueueOutlineRegular,{})}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:Q.count,children:o(`queue.count`,{n:p})}),!oe&&f.length>0&&/* @__PURE__ */ (0,h.jsx)(`span`,{className:Q.status,role:`status`,children:o(`queue.sending`)}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:Q.chevron,"aria-hidden":!0,children:ae?/* @__PURE__ */ (0,h.jsx)(d.IconChevronDownOutlineRegular,{}):/* @__PURE__ */ (0,h.jsx)(d.IconChevronUpOutlineRegular,{})})]}),/* @__PURE__ */ (0,h.jsxs)(`ul`,{id:x,className:Q.list,hidden:!oe,children:[oe&&u.map(e=>{let t=qT(e.content),n=KT(e.content);return/* @__PURE__ */ (0,h.jsxs)(`li`,{className:Q.row,children:[p===1&&/* @__PURE__ */ (0,h.jsx)(`span`,{className:Q.lead,"aria-hidden":!0,children:/* @__PURE__ */ (0,h.jsx)(d.IconQueueOutlineRegular,{})}),t.length>0&&/* @__PURE__ */ (0,h.jsx)(`span`,{className:Q.attachments,children:t.map((e,t)=>e.type===`image`?/* @__PURE__ */ (0,h.jsx)(YT,{attachment:e.attachment,loadImage:a,label:o(`queue.image`)},`${e.attachment.attachmentId}:${t}`):/* @__PURE__ */ (0,h.jsx)(JT,{attachment:e.attachment,label:o(`queue.file`,{name:e.attachment.name})},`${e.attachment.attachmentId}:${e.attachment.name}:${t}`))}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:Q.preview,children:(0,d.projectUserText)(GT(e.content),[])}),_&&/* @__PURE__ */ (0,h.jsxs)(`div`,{className:Q.actions,children:[/* @__PURE__ */ (0,h.jsx)(d.Tooltip,{portal:!0,label:o(`queue.edit`),side:`bottom`,delayMs:500,disabled:n===null,children:/* @__PURE__ */ (0,h.jsx)(`button`,{type:`button`,className:Q.action,"aria-label":o(`queue.edit`),title:n===null?o(`queue.edit.unsupported`):void 0,disabled:y!==null||n===null,onClick:()=>{n!==null&&se(e.id,()=>r(e.id,n),o(`queue.editFailed`))},children:/* @__PURE__ */ (0,h.jsx)(d.IconEditOutlineRegular,{size:14})})}),/* @__PURE__ */ (0,h.jsx)(d.Tooltip,{portal:!0,label:o(`queue.remove`),side:`bottom`,delayMs:500,children:/* @__PURE__ */ (0,h.jsx)(`button`,{type:`button`,className:Q.action,"aria-label":o(`queue.remove`),disabled:y!==null,onClick:()=>{se(e.id,{kind:`remove`},o(`queue.removeFailed`))},children:/* @__PURE__ */ (0,h.jsx)(d.IconTrashOutlineRegular,{size:14})})}),/* @__PURE__ */ (0,h.jsx)(d.Tooltip,{portal:!0,label:o(m?`queue.steer`:`queue.resume`),side:`bottom`,delayMs:500,children:/* @__PURE__ */ (0,h.jsx)(`button`,{type:`button`,className:Q.action,"aria-label":o(m?`queue.steer`:`queue.resume`),disabled:y!==null,onClick:()=>{se(e.id,{kind:`steer`},o(m?`queue.steerFailed`:`queue.resumeFailed`))},children:/* @__PURE__ */ (0,h.jsx)(d.IconSendOutlineRegular,{})})})]})]},e.id)}),oe&&f.map(e=>/* @__PURE__ */ (0,h.jsxs)(`li`,{className:`${Q.row} ${Q.pendingRow}`,"data-submission-echo":``,children:[p===1&&/* @__PURE__ */ (0,h.jsx)(`span`,{className:Q.lead,"aria-hidden":!0,children:/* @__PURE__ */ (0,h.jsx)(d.IconQueueOutlineRegular,{})}),e.attachments.length>0&&/* @__PURE__ */ (0,h.jsx)(`span`,{className:Q.attachments,children:e.attachments.map((e,t)=>/* @__PURE__ */ (0,h.jsxs)(`span`,{className:Q.pendingAttachment,children:[e.type===`image`?/* @__PURE__ */ (0,h.jsx)(`img`,{className:Q.thumb,src:e.value.previewUrl,alt:o(`queue.image`)}):/* @__PURE__ */ (0,h.jsx)(JT,{attachment:e.value,label:o(`queue.file`,{name:e.value.name})}),e.upload&&/* @__PURE__ */ (0,h.jsx)(XT,{upload:e.upload,t:o})]},t))}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:Q.preview,children:(0,d.projectUserText)(e.text,[])}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:Q.status,role:`status`,children:o(`queue.sending`)}),_&&/* @__PURE__ */ (0,h.jsxs)(`div`,{className:Q.actions,children:[/* @__PURE__ */ (0,h.jsx)(`button`,{type:`button`,className:Q.action,"aria-label":o(`queue.edit`),title:o(`queue.sending`),disabled:!0,children:/* @__PURE__ */ (0,h.jsx)(d.IconEditOutlineRegular,{size:14})}),/* @__PURE__ */ (0,h.jsx)(`button`,{type:`button`,className:Q.action,"aria-label":o(`queue.remove`),title:o(`queue.sending`),disabled:!0,children:/* @__PURE__ */ (0,h.jsx)(d.IconTrashOutlineRegular,{size:14})}),/* @__PURE__ */ (0,h.jsx)(`button`,{type:`button`,className:Q.action,"aria-label":o(`queue.steer`),title:o(`queue.sending`),disabled:!0,children:/* @__PURE__ */ (0,h.jsx)(d.IconSendOutlineRegular,{})})]})]},e.requestId))]})]})})}let QT={name:`conversation-queue-dock`,inject:[`slots`,`conversation`,`sessions`,`uiConversation`],apply(e,t){e.slots.inject(`conversation.input.dock`,()=>e.slots.register({name:`conversation.input.dock`,id:`queue`,order:20,locale:Ic,inject:n=>{let r=e.sessions.scope(n);if(r===void 0)throw Error(`queue dock: session "${n}" resolved no scope`);let i=r.get(`conversation`);if(i===void 0)throw Error(`queue dock: conversation service unavailable`);return{updateQueue:(e,t)=>i.updateQueue(e,t),editQueue:async(e,r)=>{let a=t.shell(n);await i.updateQueue(e,{kind:`remove`});let o=a.draftSnapshot;a.setDraft({...o,text:o.text===``?r:`${o.text}\n${r}`}),a.actions.persistDraft(),a.focus(`end`)},notify:(e,t)=>{i.input.for(r).notify(e,t)},loadImage:t=>e.uiConversation.imageUrl(n,t)}}},ZT))}},$T=`@deepseek-ai/dsh-client-ui-conversation/EnterBehaviorRow.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify($T)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-conversation`,e.dataset.pluginCss=$T,e.textContent=`._2CWexq_row{border-bottom:.5px solid var(--dsw-alias-border-l2);align-items:center;gap:8px;padding:16px 0;display:flex}._2CWexq_rowText{flex-direction:column;flex:1;gap:4px;min-width:0;padding-right:48px;display:flex}._2CWexq_title{color:var(--dsw-alias-label-primary);font-size:14px;font-weight:400;line-height:22px}._2CWexq_desc{color:var(--dsw-alias-label-tertiary);font-size:12px;font-weight:400;line-height:18px}._2CWexq_selector{border-radius:var(--dsw-radius-md);background:var(--dsw-alias-bg-module-platform);height:36px;font:inherit;color:var(--dsw-alias-label-primary);cursor:pointer;border:none;align-items:center;gap:12px;padding:0 14px;font-size:14px;line-height:22px;display:inline-flex}._2CWexq_selector:hover{background:var(--dsw-alias-interactive-bg-hover)}._2CWexq_chevron{flex:none}`,document.head.appendChild(e)}var eE={chevron:`_2CWexq_chevron`,desc:`_2CWexq_desc`,row:`_2CWexq_row`,rowText:`_2CWexq_rowText`,selector:`_2CWexq_selector`,title:`_2CWexq_title`};let tE=[{id:`queue`,label:`settings.enter.queue`},{id:`steer`,label:`settings.enter.steer`}];function nE({useBusyEnter:e,setBusyEnter:t,t:n}){let r=e(e=>e),[i,a]=(0,g.useState)(!1),o=r===`queue`?`settings.enter.queue`:`settings.enter.steer`;return/* @__PURE__ */ (0,h.jsxs)(`div`,{className:eE.row,children:[/* @__PURE__ */ (0,h.jsxs)(`div`,{className:eE.rowText,children:[/* @__PURE__ */ (0,h.jsx)(`div`,{className:eE.title,children:n(`settings.enter.title`)}),/* @__PURE__ */ (0,h.jsx)(`div`,{className:eE.desc,children:n(`settings.enter.description`)})]}),/* @__PURE__ */ (0,h.jsx)(d.Menu,{open:i,onClose:()=>{a(!1)},items:tE.map(e=>({id:e.id,label:n(e.label)})),selectedId:r,onSelect:e=>{a(!1),t(e)},align:`end`,portal:!0,anchor:/* @__PURE__ */ (0,h.jsxs)(`button`,{type:`button`,className:eE.selector,"aria-haspopup":`menu`,"aria-expanded":i,onClick:()=>{a(e=>!e)},children:[n(o),/* @__PURE__ */ (0,h.jsx)(d.IconChevronDownOutlineRegular,{className:eE.chevron})]})})]})}let rE={views:{get:()=>void 0,grouped:()=>void 0},activeTargets:/* @__PURE__ */ new Set};function iE(e,t){return t.activeTargets.size>0||!e.blank&&!e.awaitingFirstTurn||e.running?`active`:e.promptAttempted?`engaging`:`blank`}let aE=`@deepseek-ai/dsh-client-ui-conversation/ConversationRoot.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(aE)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-conversation`,e.dataset.pluginCss=aE,e.textContent=`.ncnpZW_root{background:var(--dsw-alias-bg-base);flex-direction:column;min-width:0;height:100%;display:flex;position:relative}body[data-codexhost-wallpaper] .ncnpZW_root{background:0 0}.ncnpZW_header{box-sizing:border-box;border-bottom:.5px solid var(--dsw-alias-border-l3);flex:none;grid-template-columns:auto minmax(0,1fr);min-height:76px;padding:10px 28px 0 20px;display:grid}.ncnpZW_header:where(:not(:has(.ncnpZW_tabs))){min-height:0;padding-bottom:10px}.ncnpZW_headerBlank{border-bottom:none;min-height:0;padding-bottom:0}.ncnpZW_headerBlank .ncnpZW_headerCorner{margin-left:auto}html:not([data-platform=darwin]) .ncnpZW_headerSessionless{padding-top:0}html:not([data-platform=darwin]) .ncnpZW_headerSessionless .ncnpZW_titleRow{min-height:0}[data-platform=darwin] .ncnpZW_headerLeading,[data-platform=darwin] .ncnpZW_headerActions,[data-platform=darwin] .ncnpZW_headerUtilities,[data-platform=darwin] .ncnpZW_headerCorner{-webkit-app-region:no-drag}.ncnpZW_titleRow{min-height:30px;grid-column:2;align-items:center;gap:0;padding-inline-start:max(0px, calc(var(--dsh-frame-leading-clearance,0px) - 20px));display:flex;container-type:inline-size}.ncnpZW_titleCenter{display:contents}.ncnpZW_phoneTrailingAction{display:none}.ncnpZW_titleCluster{flex:1;align-items:center;gap:10px;min-width:0;display:flex}.ncnpZW_headerLeading{flex:none;grid-area:1/1;align-items:center;gap:8px;display:flex}.ncnpZW_crumbs{white-space:nowrap;align-items:center;gap:4px;min-width:0;display:flex;overflow:hidden}.ncnpZW_crumbSeg{align-items:center;gap:4px;min-width:0;display:inline-flex}.ncnpZW_crumbSep{color:var(--dsw-alias-label-caption);font-size:14px;line-height:20px}.ncnpZW_crumb{border-radius:var(--dsw-radius-md);max-width:220px;color:var(--dsw-alias-label-tertiary);text-overflow:ellipsis;white-space:nowrap;cursor:pointer;background:0 0;border:none;padding:4px 8px;font-size:14px;line-height:20px;display:inline-block;overflow:hidden}.ncnpZW_crumbSubagent{font-size:12px;line-height:18px}button.ncnpZW_crumb:hover{background:var(--dsw-alias-interactive-bg-hover)}.ncnpZW_crumbCurrent{color:var(--dsw-alias-label-primary);cursor:default;font-weight:500}.ncnpZW_headerActions{flex:none;align-items:center;gap:8px;display:flex}.ncnpZW_headerUtilities{flex:none;align-items:center;gap:8px;margin-left:20px;display:flex}.ncnpZW_headerUtilities:empty{display:none}.ncnpZW_headerCorner{flex:none;align-items:center;margin-left:8px;margin-right:-16px;display:flex}.ncnpZW_headerCorner:empty,.ncnpZW_headerCorner:not(:has([data-slot="conversation.session.header.corner"]>*)){display:none}[data-phone] .ncnpZW_root[data-phase=active]{--dsh-phone-header-height:calc(env(safe-area-inset-top) + 44px)}[data-phone] .ncnpZW_root[data-phase=active]:has([data-slot="conversation.header.shortcuts"] nav){--dsh-phone-header-height:calc(env(safe-area-inset-top) + 88px)}[data-phone] .ncnpZW_header{z-index:8;padding-top:env(safe-area-inset-top);background:0 0;border-bottom:none;row-gap:0;padding-bottom:0;position:relative}[data-phone] .ncnpZW_root[data-phase=active] .ncnpZW_header{pointer-events:none;position:absolute;top:0;left:0;right:0}[data-phone] .ncnpZW_root[data-phase=active] .ncnpZW_header [data-slot="conversation.header.shortcuts"]{pointer-events:auto}[data-phone] .ncnpZW_root[data-phase=active]:not(:has([data-slot="conversation.header.notice"]>*)) .ncnpZW_scrollBody{padding-top:var(--dsh-phone-header-height)}[data-phone] .ncnpZW_root[data-phase=active]>[data-slot="conversation.header.notice"]:not(:empty){margin-top:var(--dsh-phone-header-height);z-index:5;position:relative}[data-phone] .ncnpZW_root[data-phase=active] .ncnpZW_header:before{content:"";height:calc(var(--dsh-phone-header-height) + 32px);z-index:-1;background:linear-gradient(180deg, color-mix(in srgb, var(--dsw-alias-bg-base) 78%, transparent) 0%, color-mix(in srgb, var(--dsw-alias-bg-base) 58%, transparent) 44%, color-mix(in srgb, var(--dsw-alias-bg-base) 24%, transparent) 74%, transparent 100%);pointer-events:none;position:absolute;top:0;left:0;right:0}@supports (backdrop-filter:blur(16px)){[data-phone] .ncnpZW_root[data-phase=active] .ncnpZW_header:before{backdrop-filter:blur(16px)saturate(140%);-webkit-mask-image:linear-gradient(#000 0%,#000000eb 42%,#0000008f 62%,#00000038 78%,#0000000d 91%,#0000 100%);mask-image:linear-gradient(#000 0%,#000000eb 42%,#0000008f 62%,#00000038 78%,#0000000d 91%,#0000 100%)}}body[data-codexhost-wallpaper] [data-phone] .ncnpZW_root[data-phase=active] .ncnpZW_header:before{background:linear-gradient(180deg, color-mix(in srgb, var(--dsw-alias-bg-base) 64%, transparent) 0%, color-mix(in srgb, var(--dsw-alias-bg-base) 42%, transparent) 44%, color-mix(in srgb, var(--dsw-alias-bg-base) 16%, transparent) 74%, transparent 100%)}[data-phone] .ncnpZW_headerLeading{display:none}[data-phone] .ncnpZW_titleRow{grid-area:1/1/auto/-1;grid-template-columns:minmax(80px,1fr) minmax(0,auto) minmax(80px,1fr);align-items:center;gap:6px;min-height:44px;margin-inline:-8px -16px;padding-inline-start:0;display:grid}[data-phone] .ncnpZW_titleCluster{grid-column:2;justify-content:center;align-items:center;gap:4px;min-width:0;max-width:100%;display:flex}[data-phone] .ncnpZW_titleCenter{pointer-events:auto;border-radius:8px;justify-content:center;align-items:center;gap:4px;min-width:0;max-width:100%;min-height:36px;padding:0 2px;transition:opacity .12s;display:inline-flex;position:relative}[data-phone] .ncnpZW_root[data-phase=active] .ncnpZW_titleCenter:before{content:"";z-index:-1;background:radial-gradient(closest-side, color-mix(in srgb, var(--dsw-alias-bg-base) 88%, transparent) 38%, color-mix(in srgb, var(--dsw-alias-bg-base) 42%, transparent) 72%, transparent 100%);pointer-events:none;position:absolute;inset:-4px -22px}body[data-codexhost-wallpaper] [data-phone] .ncnpZW_root[data-phase=active] .ncnpZW_titleCenter:before{background:radial-gradient(closest-side, color-mix(in srgb, var(--dsw-alias-bg-base) 68%, transparent) 38%, color-mix(in srgb, var(--dsw-alias-bg-base) 28%, transparent) 72%, transparent 100%)}body[data-codexhost-wallpaper][data-ds-dark-theme] [data-phone] .ncnpZW_titleCenter{text-shadow:0 1px 10px #0000006b}[data-phone] .ncnpZW_titleCenter:has([data-navigation-focus-return]){cursor:pointer;-webkit-tap-highlight-color:transparent}[data-phone] .ncnpZW_titleRow>.ncnpZW_titleCenter,[data-phone] .ncnpZW_titleRow>[data-slot="conversation.header.navigation"]{pointer-events:auto;grid-column:2;justify-self:center}[data-phone] .ncnpZW_titleCenter>[data-slot="conversation.header.navigation"]{display:contents}[data-phone] .ncnpZW_titleCenter:has([data-navigation-focus-return]):active{opacity:.52}[data-phone] .ncnpZW_titleCenter:has([data-navigation-focus-return]:focus-visible){outline:none}@media (hover:hover) and (pointer:fine){[data-phone] .ncnpZW_titleCenter:has([data-navigation-focus-return]:focus-visible){outline:2px solid var(--dsw-alias-label-primary);outline-offset:2px}}[data-phone] .ncnpZW_crumbs{justify-content:center;gap:3px}[data-phone] .ncnpZW_crumb{letter-spacing:-.015em;max-width:none;padding:0;font-size:15px;font-weight:600;line-height:20px}[data-phone] button.ncnpZW_crumb{z-index:1;position:relative}[data-phone] .ncnpZW_headerActions:not(:has(button)),[data-phone] .ncnpZW_headerUtilities{display:none}[data-phone] .ncnpZW_phoneTrailingAction,[data-phone] .ncnpZW_headerCorner>[data-slot="conversation.session.header.corner"],[data-phone] .ncnpZW_phoneTrailingAction>[data-slot="conversation.header.trailing"]{display:contents}[data-phone] .ncnpZW_headerCorner:has(button){box-sizing:border-box;corner-shape:round;pointer-events:auto;background:#ffffffd6;border:.5px solid #0f11151a;border-radius:9999px;grid-column:3;justify-content:center;justify-self:end;align-items:center;gap:2px;height:36px;margin:0;padding:0 3px;display:inline-flex;box-shadow:inset 0 1px #ffffffb8,inset 0 -.5px #ffffff47,inset 0 0 0 .5px #ffffff38,0 1px 2px #0f11150d,0 6px 18px -4px #0f11151c}[data-phone] .ncnpZW_headerCorner:has(button):not(:has([data-phone-new-session]):has([data-sidebar-right-expand])){width:36px;padding:0}[data-ds-dark-theme] [data-phone] .ncnpZW_headerCorner:has(button){background:#24262cc7;border-color:#ffffff24;box-shadow:inset 0 1px #ffffff47,inset 0 -.5px #ffffff14,0 2px 8px #00000042,0 8px 22px -6px #0000006b}@supports (backdrop-filter:blur(8px)){[data-phone] .ncnpZW_headerCorner:has(button){backdrop-filter:blur(8px)saturate(180%);background:linear-gradient(#ffffff38 0%,#ffffff17 100%);box-shadow:inset 0 1px .5px #ffffffd9,inset 0 -.5px #0f11150f,0 1px 2px #0f11150f,0 6px 16px -4px #0f11151f}[data-ds-dark-theme] [data-phone] .ncnpZW_headerCorner:has(button){backdrop-filter:blur(10px)saturate(180%);background:linear-gradient(#ffffff1f 0%,#ffffff0d 100%)}}@media (prefers-reduced-motion:reduce){[data-phone] .ncnpZW_titleCenter{transition:none}}@media (prefers-reduced-transparency:reduce),(prefers-contrast:more){[data-phone] .ncnpZW_root[data-phase=active] .ncnpZW_header{pointer-events:auto;background:var(--dsw-alias-bg-base);border-bottom:.5px solid var(--dsw-alias-border-l3);position:relative}[data-phone] .ncnpZW_root[data-phase=active] .ncnpZW_header:before{display:none}[data-phone] .ncnpZW_root[data-phase=active]:not(:has([data-slot="conversation.header.notice"]>*)) .ncnpZW_scrollBody{padding-top:0}[data-phone] .ncnpZW_root[data-phase=active]>[data-slot="conversation.header.notice"]:not(:empty){margin-top:0}[data-phone] .ncnpZW_headerCorner:has(button),[data-ds-dark-theme] [data-phone] .ncnpZW_headerCorner:has(button){border:1px solid var(--dsw-alias-border-l3);background:var(--dsw-alias-bg-layer-1);backdrop-filter:none;box-shadow:0 1px 2px #00000014}}@media (prefers-contrast:more){[data-phone] .ncnpZW_headerCorner:has(button),[data-ds-dark-theme] [data-phone] .ncnpZW_headerCorner:has(button){border-color:var(--dsw-alias-label-secondary);box-shadow:none}}@media (forced-colors:active){[data-phone] .ncnpZW_root[data-phase=active] .ncnpZW_header{pointer-events:auto;background:canvas;border-bottom:1px solid canvastext;position:relative}[data-phone] .ncnpZW_root[data-phase=active] .ncnpZW_header:before{display:none}[data-phone] .ncnpZW_root[data-phase=active]:not(:has([data-slot="conversation.header.notice"]>*)) .ncnpZW_scrollBody{padding-top:0}[data-phone] .ncnpZW_root[data-phase=active]>[data-slot="conversation.header.notice"]:not(:empty){margin-top:0}[data-phone] .ncnpZW_headerCorner:has(button),[data-ds-dark-theme] [data-phone] .ncnpZW_headerCorner:has(button){backdrop-filter:none;box-shadow:none;background:buttonface;border:1px solid buttontext}}.ncnpZW_tabs{z-index:1;grid-column:1/-1;gap:36px;margin-top:10px;padding-left:8px;display:flex;position:relative}.ncnpZW_tab{color:var(--dsw-alias-label-tertiary);cursor:pointer;background:0 0;border:none;padding:0 0 9px;font-size:13px;font-weight:500;line-height:16px;position:relative}.ncnpZW_tab:after{content:"";background:0 0;border-radius:2px;height:2px;position:absolute;bottom:-1px;left:0;right:0}.ncnpZW_tabActive{color:var(--dsw-alias-state-business-primary)}.ncnpZW_tabActive:after{background:var(--dsw-alias-state-business-primary)}.ncnpZW_viewArea{flex-direction:column;flex:1;min-height:0;display:flex}.ncnpZW_widthHandle{z-index:0;width:min(10px, calc((100% - var(--dsh-chat-content-width)) / 2 - 24px - 24px));cursor:col-resize;position:absolute;top:0;bottom:0}.ncnpZW_widthHandle[data-side=left]{right:calc(50% + var(--dsh-chat-content-width) / 2 + 24px)}.ncnpZW_widthHandle[data-side=right]{left:calc(50% + var(--dsh-chat-content-width) / 2 + 24px)}.ncnpZW_widthHandle:after{content:"";background:linear-gradient(to bottom, transparent calc(var(--dsh-width-handle-pointer-y,50%) - 36px), var(--dsw-alias-scrollbar-bg-l1) calc(var(--dsh-width-handle-pointer-y,50%) - 8px), var(--dsw-alias-scrollbar-bg-l1) calc(var(--dsh-width-handle-pointer-y,50%) + 8px), transparent calc(var(--dsh-width-handle-pointer-y,50%) + 36px));opacity:0;pointer-events:none;border-radius:2px;width:2px;position:absolute;top:0;bottom:0}.ncnpZW_widthHandle[data-side=left]:after{right:4px}.ncnpZW_widthHandle[data-side=right]:after{left:4px}.ncnpZW_widthHandle:hover:after,.ncnpZW_widthHandle[data-dragging]:after{opacity:1}.ncnpZW_widthHandle[data-dragging]{z-index:8}.ncnpZW_root:has([data-conversation-composer-overlay]) .ncnpZW_widthHandle{display:none}.ncnpZW_composerStack{--dsh-composer-stack-gap:6px;gap:var(--dsh-composer-stack-gap);flex-direction:column;display:flex}.ncnpZW_composerSeat{--dsh-composer-text-max-height:336px;flex-direction:column;flex:none;display:flex}.ncnpZW_root[data-phase=active]{overflow:hidden}.ncnpZW_root[data-phase=active] .ncnpZW_header{flex:none}.ncnpZW_body{--dsh-chat-content-width:var(--dsh-chat-user-width,clamp(680px, calc(var(--dsh-conversation-column-width,0px) * .64), 920px));--dsh-composer-card-max-width:calc(var(--dsh-chat-content-width) + 32px);--dsh-composer-side-clearance:16px;--dsh-composer-dock-inset:8px;flex-direction:column;flex:1;min-height:0;display:flex;position:relative}.ncnpZW_embeddedBody{--dsh-chat-content-width:min(calc(100% - 32px), 920px);--dsh-composer-card-max-width:min(calc(100% - 16px), 952px);--dsh-composer-side-clearance:8px;--dsh-composer-dock-inset:8px;overflow:hidden}.ncnpZW_scrollBody{scrollbar-gutter:stable;flex-direction:column;flex:1;min-height:0;margin-right:2px;display:flex;overflow:hidden auto}.ncnpZW_scrollBody::-webkit-scrollbar-track{margin:2px}.ncnpZW_root[data-phase=active] .ncnpZW_viewArea,.ncnpZW_embeddedBody[data-content-phase=active] .ncnpZW_viewArea{flex:1 0 auto;min-height:auto}.ncnpZW_root[data-phase=active] .ncnpZW_composerSeat,.ncnpZW_embeddedBody[data-content-phase=active] .ncnpZW_composerSeat{z-index:7;background:var(--dsh-phone-composer-mask,linear-gradient(180deg, color-mix(in srgb, var(--dsw-alias-bg-base) 0%, transparent) 0px, var(--dsw-alias-bg-base) 36px));position:sticky;bottom:0}@supports (backdrop-filter:blur(14px)){[data-phone] .ncnpZW_composerSeat:where(:has([data-chain-overlay-fallback=conversation\\.composer]:only-child [data-composer-card])){--dsh-phone-composer-mask:linear-gradient(180deg, transparent 0px, color-mix(in srgb, var(--dsw-alias-bg-base) 60%, transparent) 36px, color-mix(in srgb, var(--dsw-alias-bg-base) 60%, transparent) calc(100% - 28px), var(--dsw-alias-bg-base) 100%)}}@media (prefers-reduced-transparency:reduce),(prefers-contrast:more),(forced-colors:active){[data-phone] .ncnpZW_composerSeat{--dsh-phone-composer-mask:initial}}body[data-codexhost-wallpaper] .ncnpZW_root[data-phase=active] .ncnpZW_composerSeat,body[data-codexhost-wallpaper] .ncnpZW_embeddedBody[data-content-phase=active] .ncnpZW_composerSeat{background:0 0}.ncnpZW_root[data-phase=active] .ncnpZW_composerSeat:has([data-trigger-menu]){z-index:9}.ncnpZW_scrollBody:has([data-conversation-composer-overlay]){scrollbar-gutter:auto;position:relative;overflow:hidden auto}.ncnpZW_scrollBody:has([data-conversation-composer-overlay])>[data-slot=conversation\\.session]>.ncnpZW_viewArea{flex:1 1 0;min-height:0;overflow:hidden}.ncnpZW_scrollBody:has([data-conversation-composer-overlay])>.ncnpZW_composerSeat{right:var(--dsh-scrollbar-width);position:absolute;bottom:0;left:0}.ncnpZW_composerHero{width:min(calc(var(--dsh-composer-card-max-width) + 2 * var(--dsh-composer-side-clearance)), 100%);z-index:1;align-self:center;gap:8px;padding-bottom:32px}.ncnpZW_heroWorkspaceRow{align-items:center;gap:2px;min-width:0;margin-top:4px;padding:0 16px 0 20px;display:flex}.ncnpZW_root[data-phase=hero] .ncnpZW_scrollBody,.ncnpZW_embeddedBody[data-content-phase=hero] .ncnpZW_scrollBody{justify-content:center;overflow-y:auto}.ncnpZW_root[data-phase=settling] .ncnpZW_composerSeat,.ncnpZW_embeddedBody[data-content-phase=settling] .ncnpZW_composerSeat{visibility:hidden}`,document.head.appendChild(e)}var $={body:`ncnpZW_body`,composerHero:`ncnpZW_composerHero`,composerSeat:`ncnpZW_composerSeat`,composerStack:`ncnpZW_composerStack`,crumb:`ncnpZW_crumb`,crumbCurrent:`ncnpZW_crumbCurrent`,crumbSeg:`ncnpZW_crumbSeg`,crumbSep:`ncnpZW_crumbSep`,crumbSubagent:`ncnpZW_crumbSubagent`,crumbs:`ncnpZW_crumbs`,embeddedBody:`ncnpZW_embeddedBody`,header:`ncnpZW_header`,headerActions:`ncnpZW_headerActions`,headerBlank:`ncnpZW_headerBlank`,headerCorner:`ncnpZW_headerCorner`,headerLeading:`ncnpZW_headerLeading`,headerSessionless:`ncnpZW_headerSessionless`,headerUtilities:`ncnpZW_headerUtilities`,heroWorkspaceRow:`ncnpZW_heroWorkspaceRow`,phoneTrailingAction:`ncnpZW_phoneTrailingAction`,root:`ncnpZW_root`,scrollBody:`ncnpZW_scrollBody`,tab:`ncnpZW_tab`,tabActive:`ncnpZW_tabActive`,tabs:`ncnpZW_tabs`,titleCenter:`ncnpZW_titleCenter`,titleCluster:`ncnpZW_titleCluster`,titleRow:`ncnpZW_titleRow`,viewArea:`ncnpZW_viewArea`,widthHandle:`ncnpZW_widthHandle`};let oE=`dsh.conversation.contentWidth`;function sE(){let e=localStorage.getItem(oE);if(e===null)return null;let t=Number(e);return Number.isFinite(t)&&t>0?t:null}function cE(e,t){let n=Math.max(640,e-176);return t===null?Math.max(680,Math.min(e*.64,920)):Math.min(Math.max(t,640),n)}function lE(e,t){if(e.deltaMode===1){let n=Number.parseFloat(getComputedStyle(t).lineHeight);return e.deltaY*(Number.isFinite(n)?n:16)}return e.deltaMode===2?e.deltaY*t.clientHeight:e.deltaY}function uE(e){let t=(0,g.useRef)(!1),n=(0,g.useRef)(0),r=(0,g.useRef)(0),i=(0,g.useRef)(0),a=(0,g.useRef)(null),o=(0,g.useRef)(e);o.current=e;let s=()=>{let e=i.current-r.current,t=o.current.side===`right`?e:-e;return n.current+t*2},c=()=>{a.current!==null&&(cancelAnimationFrame(a.current),a.current=null)},l=(0,g.useCallback)(e=>{e.button===0&&(e.preventDefault(),e.currentTarget.setPointerCapture(e.pointerId),r.current=e.clientX,i.current=e.clientX,n.current=o.current.onStart(),t.current=!0,e.currentTarget.toggleAttribute(`data-dragging`,!0))},[]),u=(0,g.useCallback)(e=>{if(!t.current||!e.currentTarget.hasPointerCapture(e.pointerId))return;let n=e.currentTarget.getBoundingClientRect();e.currentTarget.style.setProperty(`--dsh-width-handle-pointer-y`,`${e.clientY-n.top}px`),i.current=e.clientX,a.current??=requestAnimationFrame(()=>{a.current=null,o.current.onDrag(s())})},[]),d=(0,g.useCallback)(e=>{t.current&&e.currentTarget.hasPointerCapture(e.pointerId)&&(t.current=!1,e.currentTarget.toggleAttribute(`data-dragging`,!1),e.currentTarget.releasePointerCapture(e.pointerId),c(),i.current=e.clientX,i.current!==r.current&&o.current.onCommit(s()),o.current.onEnd())},[]),f=(0,g.useCallback)(e=>{t.current&&(t.current=!1,e.currentTarget.toggleAttribute(`data-dragging`,!1),c(),o.current.onEnd())},[]),p=(0,g.useCallback)(e=>{let t=e.currentTarget.parentElement;
|
|
170
173
|
/* v8 ignore next -- a width handle renders only inside the Conversation body. */
|
|
171
174
|
if(t===null)return;let n=t.querySelector(`:scope > [data-conversation-scroll]`);
|
|
172
175
|
/* v8 ignore next -- the Conversation body always contains its direct scroll element. */
|
|
173
|
-
n!==null&&(e.ctrlKey||e.deltaY===0||n.scrollBy({top:AT(e,n)}))},[]);return/* @__PURE__ */ (0,h.jsx)(`div`,{className:$.widthHandle,"data-side":e.side,"data-width-handle":e.side,onPointerDown:l,onPointerMove:u,onPointerUp:d,onPointerCancel:f,onLostPointerCapture:f,onWheel:p})}function MT({container:e,phase:t}){let n=(0,g.useCallback)(e=>{let t=e.parentElement??e,n=e.offsetWidth;t.style.setProperty(`--dsh-conversation-column-width`,`${n}px`);let r=OT();r===null?t.style.removeProperty(`--dsh-chat-user-width`):t.style.setProperty(`--dsh-chat-user-width`,`${kT(n,r)}px`)},[]);(0,g.useLayoutEffect)(()=>{if(e===null)return;let t=new ResizeObserver(()=>{n(e)});return t.observe(e),n(e),()=>{t.disconnect()}},[e,n]);let r=(0,g.useCallback)(()=>e===null?680:kT(e.offsetWidth,OT()),[e]),i=(0,g.useCallback)(t=>{e!==null&&(e.parentElement??e).style.setProperty(`--dsh-chat-user-width`,`${kT(e.offsetWidth,t)}px`)},[e]),a=(0,g.useCallback)(t=>{e!==null&&localStorage.setItem(DT,`${kT(e.offsetWidth,t)}`)},[e]),o=(0,g.useCallback)(()=>{e!==null&&n(e)},[e,n]);return e===null||t!==`active`?null:[`left`,`right`].map(e=>/* @__PURE__ */ (0,h.jsx)(jT,{side:e,onStart:r,onDrag:i,onCommit:a,onEnd:o},e))}let NT={widthControls:MT};function PT(e){let{sessionId:t,useSession:n,useSessions:r,useConversation:i,renderSlot:a,renderFactorySlot:o}=e,s=n(e=>e),c=i(e=>e),l=s===void 0||c===void 0?`blank`:TT(s,c),u=s?.openState,d=r(e=>t===void 0?void 0:e.byId[t]?.blank),f=s?.subagent?.address.mode===`continuable`&&s.subagent.parentAvailable===void 0,p=t!==void 0&&(l===`blank`&&u===`loading`&&d!==!0||f),m=t===void 0||l===`blank`&&(u===`open`||d===!0),g=p?`settling`:m?`hero`:`active`;return/* @__PURE__ */ (0,h.jsxs)(`div`,{className:$.root,"data-phase":g,children:[a(`conversation.header`,{}),a(`conversation.header.notice`,{}),o(`conversation.content`,{variant:`main`,phase:g,hero:m},{slots:NT})]})}function FT(e){return/* @__PURE__ */ (0,h.jsx)(PT,{...e})}function IT(e,t){return e===`default-workspace`?t:e}let LT=`@deepseek-ai/dsh-client-ui-conversation/HeroShell.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(LT)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-conversation`,e.dataset.pluginCss=LT,e.textContent=`.rwoUcW_root{justify-content:center;align-items:center;min-width:0;height:100%;padding:0 24px;display:flex}.rwoUcW_stack{width:100%;max-width:var(--dsh-composer-card-max-width);flex-direction:column;align-items:stretch;gap:12px;display:flex;overflow:visible}.rwoUcW_headline{color:var(--dsw-alias-label-primary);flex-wrap:wrap;justify-content:center;align-items:center;gap:12px 10px;font-size:26px;font-weight:500;line-height:32px;display:flex}.rwoUcW_titleGroup{flex-wrap:wrap;justify-content:center;align-items:center;gap:4px 7px;min-width:0;display:flex}.rwoUcW_previewBadge{border:.5px solid var(--dsw-alias-interactive-bg-hover);corner-shape:round;background:var(--dsw-alias-state-business-tertiary);color:var(--dsw-alias-label-primary-bluish);font-family:var(--ds-font-family-code);white-space:nowrap;border-radius:999px;align-self:flex-start;margin-top:2px;padding:1px 7px 0;font-size:12px;font-weight:500;line-height:18px}.rwoUcW_fishHitbox{flex:none;justify-content:center;align-items:center;display:inline-flex}.rwoUcW_fish{transform-origin:50% 60%;color:var(--dsw-alias-label-primary);display:block;overflow:visible}@keyframes rwoUcW_hero-fish-swim{0%,to{transform:none}35%{transform:rotate(-4deg)translate(-.4px,-.9px)}70%{transform:rotate(1.6deg)translate(.3px,.2px)}}@media (hover:hover) and (prefers-reduced-motion:no-preference){.rwoUcW_fishHitbox:hover .rwoUcW_fish{animation:1.6s ease-in-out infinite rwoUcW_hero-fish-swim}}.rwoUcW_body{flex-direction:column;gap:12px;min-width:0;display:flex;position:relative;overflow:visible}.rwoUcW_body>*{z-index:1;position:relative}.rwoUcW_body>.rwoUcW_workspaceRow{z-index:10;align-items:center;min-width:0;padding-left:8px;display:flex}.rwoUcW_workspace{border-radius:var(--dsw-radius-sm);max-width:min(100%,360px);min-height:28px;color:var(--dsw-alias-label-primary);cursor:pointer;background:0 0;border:none;align-items:center;gap:4px;padding:0 8px;font-size:13px;font-weight:500;line-height:20px;display:inline-flex}.rwoUcW_workspace:not(:disabled):hover,.rwoUcW_workspace[aria-expanded=true]{background:var(--dsw-alias-interactive-bg-hover)}.rwoUcW_workspace:disabled{cursor:default}.rwoUcW_folder{color:var(--dsw-alias-label-primary);flex:none}.rwoUcW_workspaceLabel{text-overflow:ellipsis;white-space:nowrap;min-width:0;overflow:hidden}.rwoUcW_chevron{color:var(--dsw-alias-label-caption);flex:none}.rwoUcW_modalInput{box-sizing:border-box;border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-lg);width:100%;height:44px;color:var(--dsw-alias-label-primary);background:0 0;outline:none;padding:7px 14px;font-size:14px;font-weight:400;line-height:22px}.rwoUcW_modalInput::placeholder{color:var(--dsw-alias-label-caption)}.rwoUcW_modalInput:disabled{color:var(--dsw-alias-label-dimmed)}.rwoUcW_modalAction{min-width:72px}.rwoUcW_modalError{color:var(--dsw-alias-state-error-primary);margin-top:8px;font-size:12px;line-height:18px}`,document.head.appendChild(e)}var RT={body:`rwoUcW_body`,chevron:`rwoUcW_chevron`,fish:`rwoUcW_fish`,fishHitbox:`rwoUcW_fishHitbox`,folder:`rwoUcW_folder`,headline:`rwoUcW_headline`,"hero-fish-swim":`rwoUcW_hero-fish-swim`,modalAction:`rwoUcW_modalAction`,modalError:`rwoUcW_modalError`,modalInput:`rwoUcW_modalInput`,previewBadge:`rwoUcW_previewBadge`,root:`rwoUcW_root`,stack:`rwoUcW_stack`,titleGroup:`rwoUcW_titleGroup`,workspace:`rwoUcW_workspace`,workspaceLabel:`rwoUcW_workspaceLabel`,workspaceRow:`rwoUcW_workspaceRow`};function zT(e){let t=Pc(e);return t===``?e:t}function BT({buttonRef:e,label:t,projectless:n=!1,menuOpen:r=!1,onClick:i,t:a}){return/* @__PURE__ */ (0,h.jsxs)(`button`,{ref:e,type:`button`,className:RT.workspace,"aria-label":a(`hero.chooseWorkspace`),"aria-haspopup":`menu`,"aria-expanded":r,onClick:i,children:[t===void 0||n?/* @__PURE__ */ (0,h.jsx)(d.IconFolderCloseRegular,{className:RT.folder,size:16}):/* @__PURE__ */ (0,h.jsx)(d.IconFolderOpenRegular,{className:RT.folder,size:16}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:RT.workspaceLabel,children:t??a(`hero.chooseWorkspace`)}),/* @__PURE__ */ (0,h.jsx)(d.IconChevronDownOutlineRegular,{className:RT.chevron,size:12})]})}function VT({hovering:e}){return/* @__PURE__ */ (0,h.jsx)(`svg`,{className:RT.fish,width:34,height:34*d.FISH_LOGO_VIEWBOX.height/d.FISH_LOGO_VIEWBOX.width,viewBox:`0 0 ${d.FISH_LOGO_VIEWBOX.width} ${d.FISH_LOGO_VIEWBOX.height}`,fill:`none`,"aria-hidden":`true`,children:/* @__PURE__ */ (0,h.jsx)(`path`,{d:d.FISH_LOGO_PATH,fill:`currentColor`,children:e&&/* @__PURE__ */ (0,h.jsx)(`animate`,{attributeName:`d`,values:`${d.FISH_LOGO_PATH};M22.403 0.567C22.145 0.477 22.068 0.718 21.939 0.85C21.895 0.893 21.86 0.947 21.824 0.997C21.515 1.421 21.13 1.721 20.591 1.77C19.829 1.867 19.221 2.244 18.712 2.958C18.535 2.227 18.116 1.839 17.516 1.626C17.203 1.506 16.887 1.379 16.663 1.064C16.508 0.839 16.462 0.581 16.383 0.329C16.332 0.176 16.283 0.02 16.121 -0.002C15.944 -0.029 15.875 0.133 15.805 0.269C15.52 0.822 15.408 1.43 15.42 2.046C15.449 3.432 16.031 4.532 17.202 5.274C17.337 5.356 17.374 5.445 17.335 5.582C17.261 5.862 17.169 6.134 17.086 6.413C17.032 6.59 16.952 6.63 16.764 6.558C16.118 6.301 15.562 5.909 15.074 5.433C14.248 4.633 13.5 3.751 12.568 3.06C12.349 2.898 12.13 2.748 11.903 2.605C10.952 1.682 12.028 0.923 12.277 0.833C12.537 0.739 12.367 0.416 11.526 0.42C10.684 0.424 9.914 0.706 8.933 1.081C8.789 1.138 8.638 1.179 8.484 1.213C7.593 1.044 6.668 1.006 5.702 1.115C3.883 1.318 2.43 2.178 1.362 3.646C0.079 5.41 -0.223 7.415 0.147 9.506C0.535 11.71 1.66 13.535 3.389 14.962C5.181 16.441 7.246 17.166 9.601 17.027C11.032 16.944 12.624 16.753 14.421 15.232C14.874 15.458 15.35 15.548 16.138 15.615C16.746 15.672 17.331 15.585 17.784 15.491C18.493 15.341 18.444 14.684 18.188 14.564C16.108 13.595 16.565 13.989 16.15 13.67C17.206 12.42 18.82 10.198 19.363 7.086C19.421 6.709 19.484 6.171 19.469 5.866C19.458 5.681 19.493 5.604 19.681 5.556C20.199 5.412 20.691 5.172 21.125 4.806C22.366 3.824 22.758 2.554 22.708 1.1C22.7 0.878 22.649 0.654 22.403 0.567ZM11.175 14.451C9.159 12.726 8.182 12.088 7.778 12.067C7.401 12.047 7.469 12.505 7.552 12.807C7.639 13.103 7.752 13.313 7.91 13.581C8.02 13.758 8.095 14.01 7.801 14.16C7.152 14.487 6.023 13.806 5.97 13.772C4.657 12.85 3.559 11.766 2.785 10.369C2.037 9.025 1.603 7.583 1.532 6.044C1.513 5.672 1.622 5.541 1.992 5.473C2.479 5.383 2.981 5.364 3.468 5.436C5.525 5.736 7.276 6.675 8.744 8.323C9.582 9.299 10.216 10.425 10.869 11.496C11.563 12.592 12.31 13.603 13.262 14.414C13.598 14.696 13.866 14.91 14.123 15.068C13.349 15.154 12.058 15.167 11.175 14.452L11.175 14.451ZM12.141 8.26C12.141 8.095 12.273 7.963 12.439 7.963C12.476 7.963 12.511 7.971 12.541 7.982C12.582 7.997 12.62 8.019 12.65 8.053C12.704 8.106 12.733 8.181 12.733 8.26C12.733 8.425 12.601 8.556 12.435 8.556C12.27 8.556 12.141 8.425 12.141 8.26ZM15.142 9.799C14.949 9.878 14.757 9.945 14.572 9.953C14.284 9.968 13.972 9.851 13.802 9.709C13.537 9.487 13.348 9.363 13.27 8.977C13.236 8.812 13.255 8.556 13.284 8.41C13.352 8.094 13.277 7.892 13.055 7.708C12.873 7.558 12.643 7.516 12.39 7.516C12.296 7.516 12.209 7.475 12.145 7.441C12.039 7.389 11.952 7.257 12.035 7.096C12.062 7.043 12.19 6.916 12.22 6.893C12.563 6.698 12.96 6.762 13.326 6.908C13.665 7.047 13.922 7.302 14.292 7.663C14.669 8.098 14.738 8.218 14.953 8.545C15.123 8.801 15.277 9.063 15.383 9.364C15.447 9.551 15.364 9.705 15.142 9.799Z;${d.FISH_LOGO_PATH};M23.271 2.216C23.039 2.071 22.91 2.287 22.755 2.388C22.703 2.42 22.656 2.464 22.61 2.505C22.214 2.848 21.771 3.054 21.225 2.956C20.412 2.784 19.68 2.919 19.005 3.435C18.92 2.663 18.493 2.157 17.808 1.798C17.446 1.621 17.08 1.449 16.83 1.111C16.656 0.872 16.611 0.612 16.524 0.354C16.469 0.198 16.414 0.039 16.223 0.009C16.017 -0.024 15.936 0.137 15.856 0.271C15.539 0.822 15.418 1.43 15.429 2.046C15.454 3.432 16.041 4.538 17.196 5.36C17.325 5.456 17.356 5.547 17.312 5.674C17.229 5.936 17.134 6.191 17.051 6.454C16.999 6.623 16.921 6.659 16.738 6.58C16.107 6.306 15.56 5.909 15.074 5.433C14.248 4.633 13.5 3.751 12.568 3.06C12.349 2.898 12.13 2.748 11.903 2.605C10.952 1.682 12.028 0.923 12.277 0.833C12.537 0.739 12.367 0.416 11.526 0.42C10.684 0.424 9.914 0.706 8.933 1.081C8.789 1.138 8.638 1.179 8.484 1.213C7.593 1.044 6.668 1.006 5.702 1.115C3.883 1.318 2.43 2.178 1.362 3.646C0.079 5.41 -0.223 7.415 0.147 9.506C0.535 11.71 1.66 13.535 3.389 14.962C5.181 16.441 7.246 17.166 9.601 17.027C11.032 16.944 12.624 16.753 14.421 15.232C14.874 15.458 15.35 15.548 16.138 15.615C16.746 15.672 17.331 15.585 17.784 15.491C18.493 15.341 18.444 14.684 18.188 14.564C16.108 13.595 16.565 13.989 16.15 13.67C17.206 12.42 18.82 10.198 19.278 7.246C19.318 6.948 19.375 6.534 19.371 6.293C19.371 6.145 19.411 6.092 19.597 6.098C20.113 6.109 20.619 6.051 21.096 5.891C22.503 5.375 23.169 4.232 23.448 2.804C23.49 2.586 23.491 2.356 23.271 2.216ZM11.175 14.49C9.159 13.005 8.182 12.567 7.778 12.621C7.401 12.673 7.469 13.087 7.552 13.354C7.639 13.619 7.752 13.797 7.91 14.024C8.02 14.175 8.095 14.406 7.801 14.609C7.152 15.063 6.023 14.63 5.97 14.609C4.657 13.941 3.559 12.965 2.785 11.569C2.037 10.225 1.603 8.783 1.532 7.244C1.513 6.872 1.622 6.741 1.992 6.673C2.479 6.583 2.981 6.564 3.468 6.636C5.525 6.936 7.276 7.843 8.744 9.163C9.582 9.888 10.216 10.783 10.869 11.679C11.563 12.659 12.31 13.617 13.262 14.415C13.598 14.696 13.866 14.91 14.123 15.068C13.349 15.155 12.058 15.177 11.175 14.491L11.175 14.49ZM12.141 8.26C12.141 8.095 12.273 7.963 12.439 7.963C12.476 7.963 12.511 7.971 12.541 7.982C12.582 7.997 12.62 8.019 12.65 8.053C12.704 8.106 12.733 8.181 12.733 8.26C12.733 8.425 12.601 8.556 12.435 8.556C12.27 8.556 12.141 8.425 12.141 8.26ZM15.142 9.799C14.949 9.878 14.757 9.945 14.572 9.953C14.284 9.968 13.972 9.851 13.802 9.709C13.537 9.487 13.348 9.363 13.27 8.977C13.236 8.812 13.255 8.556 13.284 8.41C13.352 8.094 13.277 7.892 13.055 7.708C12.873 7.558 12.643 7.516 12.39 7.516C12.296 7.516 12.209 7.475 12.145 7.441C12.039 7.389 11.952 7.257 12.035 7.096C12.062 7.043 12.19 6.916 12.22 6.893C12.563 6.698 12.96 6.762 13.326 6.908C13.665 7.047 13.922 7.302 14.292 7.663C14.669 8.098 14.738 8.218 14.953 8.545C15.123 8.801 15.277 9.063 15.383 9.364C15.447 9.551 15.364 9.705 15.142 9.799Z;${d.FISH_LOGO_PATH}`,keyTimes:`0;0.35;0.55;0.75;1`,calcMode:`spline`,keySplines:`0.45 0 0.55 1;0.45 0 0.55 1;0.45 0 0.55 1;0.45 0 0.55 1`,dur:`1.6s`,repeatCount:`indefinite`})})})}function HT({t:e,renderSlot:t,children:n}){let[r,i]=(0,g.useState)(!1);return/* @__PURE__ */ (0,h.jsxs)(`div`,{className:RT.root,children:[/* @__PURE__ */ (0,h.jsxs)(`div`,{className:RT.stack,children:[/* @__PURE__ */ (0,h.jsxs)(`div`,{className:RT.headline,children:[/* @__PURE__ */ (0,h.jsx)(`span`,{className:RT.fishHitbox,onMouseEnter:()=>{window.matchMedia(`(hover: hover) and (prefers-reduced-motion: no-preference)`).matches&&i(!0)},onMouseLeave:()=>{i(!1)},children:t(`conversation.hero.brand.mark`,{size:34,className:RT.fish},{fallback:/* @__PURE__ */ (0,h.jsx)(VT,{hovering:r})})}),/* @__PURE__ */ (0,h.jsxs)(`span`,{className:RT.titleGroup,children:[/* @__PURE__ */ (0,h.jsx)(`span`,{children:e(`hero.headline`)}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:RT.previewBadge,children:e(`hero.preview`)})]})]}),/* @__PURE__ */ (0,h.jsx)(`div`,{className:RT.body})]}),n]})}let UT=`@deepseek-ai/dsh-client-ui-conversation/ThreadReferenceDropTarget.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(UT)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-conversation`,e.dataset.pluginCss=UT,e.textContent=`.yYBwyG_overlay{z-index:30;pointer-events:none;background:color-mix(in srgb, var(--dsw-alias-state-business-tertiary) 88%, transparent);place-items:center;display:grid;position:absolute;inset:0}.yYBwyG_invitation{flex-direction:column;align-items:center;gap:8px;max-width:calc(100% - 40px);display:flex}.yYBwyG_hint{border:1px solid color-mix(in srgb, var(--dsw-alias-state-business-primary) 15%, transparent);background:var(--dsw-alias-state-business-tertiary);color:var(--dsw-alias-label-primary);border-radius:10px;padding:8px 16px;font-size:16px;line-height:24px;box-shadow:0 1px 4px #00000014}.yYBwyG_preview{box-sizing:border-box;border:1px solid var(--dsw-alias-border-l3);background:var(--dsw-alias-bg-base);max-width:min(440px,100%);color:var(--dsw-alias-label-primary);border-radius:12px;align-items:center;gap:10px;padding:10px 14px;font-size:14px;line-height:20px;display:flex;box-shadow:0 4px 14px #00000014}.yYBwyG_preview svg{flex:none}.yYBwyG_title{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}`,document.head.appendChild(e)}var WT={hint:`yYBwyG_hint`,invitation:`yYBwyG_invitation`,overlay:`yYBwyG_overlay`,preview:`yYBwyG_preview`,title:`yYBwyG_title`};function GT({container:e,editor:t,useSessions:n,t:r}){let i=n(e=>e.byId),a=(0,g.useRef)(i);a.current=i;let[o,s]=(0,g.useState)(null);return(0,g.useEffect)(()=>{if(e===null||t===void 0)return;let n,r=()=>{n=void 0,s(null)},i=()=>t.isEditable()&&t.getRootElement()!==null,o=e=>{let t=e.dataTransfer;return t?.types.includes(`application/x-codexhost-thread-reference`)&&!t.types.includes(`Files`)?t:null},c=e=>{let t=e===void 0?void 0:Mb(jb(e)),n=t===void 0?void 0:a.current[t];return n!==void 0&&Ab(n)!==void 0},l=t=>!(t instanceof Node)||!e.contains(t)?!1:(t instanceof Element?t:t.parentElement)?.closest(`[data-conversation-content]`)===e,u=e=>{r();let t=o(e),i=t===null?void 0:Pb(t.getData(kb));c(i)&&(n=i)},d=e=>{let r=o(e);r===null||!l(e.target)?s(null):!i()||!c(n)?(e.preventDefault(),e.stopPropagation(),r.dropEffect=`none`,s(null)):t.dispatchCommand(kd,e)&&s(n??null)},f=t=>{if(t.relatedTarget instanceof Node&&e.contains(t.relatedTarget))return;let n=e.getBoundingClientRect();(t.relatedTarget!==null||t.target===e||t.clientX<=n.left||t.clientX>=n.right||t.clientY<=n.top||t.clientY>=n.bottom)&&s(null)},p=e=>{let a=o(e);if(a!==null&&l(e.target)){let r=Pb(a.getData(kb));i()&&c(r)&&r?.threadId===n?.threadId&&r?.hostId===n?.hostId?t.dispatchCommand(Dd,e):(e.preventDefault(),e.stopPropagation(),a.dropEffect=`none`)}r()},m=e=>{e.key===`Escape`&&r()},h=t.registerEditableListener(e=>{e||r()});return document.addEventListener(`dragstart`,u),document.addEventListener(`dragenter`,d,!0),document.addEventListener(`dragover`,d,!0),document.addEventListener(`dragleave`,f,!0),document.addEventListener(`drop`,p,!0),window.addEventListener(`dragend`,r),window.addEventListener(`blur`,r),window.addEventListener(`keydown`,m,!0),()=>{h(),document.removeEventListener(`dragstart`,u),document.removeEventListener(`dragenter`,d,!0),document.removeEventListener(`dragover`,d,!0),document.removeEventListener(`dragleave`,f,!0),document.removeEventListener(`drop`,p,!0),window.removeEventListener(`dragend`,r),window.removeEventListener(`blur`,r),window.removeEventListener(`keydown`,m,!0)}},[e,t]),o===null?null:/* @__PURE__ */ (0,h.jsx)(`div`,{className:WT.overlay,"data-thread-reference-drop":!0,role:`status`,"aria-live":`polite`,children:/* @__PURE__ */ (0,h.jsxs)(`div`,{className:WT.invitation,children:[/* @__PURE__ */ (0,h.jsx)(`div`,{className:WT.hint,children:r(`reference.dropTitle`)}),/* @__PURE__ */ (0,h.jsxs)(`div`,{className:WT.preview,"data-thread-reference-preview":!0,children:[/* @__PURE__ */ (0,h.jsx)(d.ReferenceIconRegular,{kind:`session`,size:20}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:WT.title,children:o.title})]})]})})}function KT({renderSlot:e}){return e(`conversation.session`,{})}function qT(){return null}function JT(e){let{sessionId:t,phase:n,hero:r,useSession:i,useSessions:a,useSessionStatus:o,useWorkspaces:s,useInput:c,useComposerBlock:l,renderSlot:u,renderSlotChain:d,selectWorkspace:f,referenceEditor:p,t:m,useFactorySlot:_}=e,v=i(e=>e),y=_(`views`,KT),ee=_(`widthControls`,qT),[b,x]=(0,g.useState)(null),te=o(e=>t===void 0?void 0:e.get(t)?.pendingInteraction),ne=c(e=>e),re=a(e=>t===void 0?void 0:e.byId[t]?.cwd),ie=s(e=>e),ae=l(e=>e),[oe,se]=(0,g.useState)(!1),[S,ce]=(0,g.useState)(),le=(0,g.useRef)(null),ue=(0,g.useRef)(null),de=(0,g.useCallback)(e=>{ue.current?.disconnect(),ue.current=null;let t=e?.parentElement??null;e!==null&&t!==null&&(ue.current=new ResizeObserver(()=>{t.style.setProperty(`--dsh-composer-height`,`${e.offsetHeight}px`),t.style.setProperty(`--dsh-conversation-viewport-height`,`${t.clientHeight}px`)}),ue.current.observe(e),ue.current.observe(t))},[]),fe=t===void 0?void 0:ie.items.find(e=>e.sessionIds.includes(t)),C=ie.items.find(e=>e.workspaceId===S);(0,g.useEffect)(()=>{S!==void 0&&((S===null?fe===void 0:fe?.workspaceId===S)||S!==null&&ie.phase===`ready`&&C===void 0)&&ce(void 0)},[S,fe?.workspaceId,ie.phase,C]);let w=v===void 0||ne===void 0?void 0:{session:v,input:ne},pe=(S===null?void 0:C?.title)??(S===null||t===void 0?void 0:fe?.title??(ie.phase===`ready`||re===void 0||re===``?void 0:zT(re))),me=pe===void 0?void 0:IT(pe,m(`workspace.defaultName`)),he=/* @__PURE__ */ (0,h.jsxs)(`div`,{className:$.heroWorkspaceRow,children:[/* @__PURE__ */ (0,h.jsx)(BT,{buttonRef:le,label:me??(ie.canStartProjectless?m(`hero.noWorkspace`):void 0),projectless:ie.canStartProjectless===!0&&me===void 0,menuOpen:oe,onClick:()=>{se(e=>!e)},t:m}),u(`conversation.hero.workspace`,{open:oe,anchorRef:le,selectedId:S===null?void 0:S??fe?.workspaceId,onPick:e=>{se(!1),ce(e),f(e).catch(()=>{ce(t=>t===e?void 0:t)})},onClose:()=>{se(!1)}}),u(`conversation.hero.agentPreset`,{})]}),ge=ie.phase===`ready`&&!ie.canStartProjectless&&me===void 0,_e=(t===void 0||v?.openState!==`open`)&&!ge,ve=t===void 0||v?.openState!==`open`||r&&ge,ye=u(`conversation.composer.bar`,{variant:r?`hero`:`composer`,...ve?{disabled:!0,placeholder:m(_e?`placeholder.preparing`:`placeholder.workspace`),..._e?{}:{workspacePickerOpen:oe,onRequestWorkspace:()=>{se(!0)}}}:!ve&&ae!==void 0?{blocked:ae,placeholder:ae.reason}:r?{placeholder:m(`placeholder.hero`)}:{}}),be=/* @__PURE__ */ (0,h.jsxs)(`div`,{className:Ib($.composerStack,r&&$.composerHero),children:[r&&/* @__PURE__ */ (0,h.jsx)(HT,{t:m,renderSlot:u}),r&&he,w!==void 0&&u(`conversation.input.dock`,w),ye]}),xe=d(`conversation.composer`,{sessionId:t,session:v,pendingInteraction:v?.openState===`open`?te:void 0},{fallback:be,fallbackOnly:t===void 0,overlay:!0}),Se=/* @__PURE__ */ (0,h.jsx)(`div`,{ref:de,className:$.composerSeat,"data-composer-seat":``,"data-conversation-region":`composer`,children:xe});return/* @__PURE__ */ (0,h.jsxs)(`div`,{ref:x,className:Ib($.body,e.variant===`embedded`&&$.embeddedBody),"data-conversation-content":``,"data-conversation-session":t,"data-conversation-region":`chat`,"data-content-phase":n,children:[/* @__PURE__ */ (0,h.jsxs)(`div`,{className:$.scrollBody,"data-conversation-scroll":``,children:[t===void 0?null:/* @__PURE__ */ (0,h.jsx)(y,{}),Se]}),/* @__PURE__ */ (0,h.jsx)(ee,{container:b,phase:n}),/* @__PURE__ */ (0,h.jsx)(GT,{container:b,editor:p,useSessions:a,t:m},t)]})}function YT({renderSlot:e}){return e(`main.conversation`,{})}function XT(){let e=()=>{let e=document.querySelector(`[data-conversation-navigation-focus]`),t=e?.querySelector(`[data-navigation-focus-return]`);(t!=null&&t.getClientRects().length>0?t:e)?.focus({preventScroll:!0})};e(),requestAnimationFrame(()=>{document.activeElement===document.body&&e()})}function ZT({sessionId:e,useSession:t,useConversation:n,renderSlot:r}){let i=t(e=>e),a=n(e=>e),o=i===void 0||a===void 0||i.blank&&TT(i,a)===`blank`;return/* @__PURE__ */ (0,h.jsxs)(`header`,{className:Ib($.header,o&&$.headerBlank,e===void 0&&$.headerSessionless),"data-window-drag":!0,"data-conversation-navigation-focus":!0,tabIndex:-1,children:[/* @__PURE__ */ (0,h.jsx)(`div`,{className:$.headerLeading,"data-conversation-header-leading":``,children:r(`conversation.header.leading`,{})}),e===void 0?/* @__PURE__ */ (0,h.jsx)(`div`,{className:$.titleRow,children:r(`conversation.header.navigation`,{restoreNavigationFocus:XT})}):r(`conversation.session.header`,{hideChrome:o,titleNavigation:r(`conversation.header.navigation`,{restoreNavigationFocus:XT})}),r(`conversation.header.shortcuts`,{restoreNavigationFocus:XT})]})}function QT(e,t){return(t===null?void 0:e.find(e=>e.id===t))??e.find(e=>e.id===`chat`)}function $T({view:e,useSession:t,useConversation:n,useConversationViews:r,inputActions:i,useStore:a,actions:o,renderSlot:s,bindDraftPersistence:c,openView:l,useInspectCall:u}){let d=r(e=>e),f=u(e=>e),p=QT(d,a(e=>e.view)),m=t(e=>e),_=n(e=>e),v=a(e=>e.viewRequest??null);if((0,g.useEffect)(()=>{let e=c(o.setDraft);return i.persistDraft(),()=>{e()}},[i]),m.blank&&TT(m,_)===`blank`)return null;let y=e??p?.id;return/* @__PURE__ */ (0,h.jsx)(`div`,{className:$.viewArea,children:y!==void 0&&s(`conversation.view`,{inspectCall:f,viewRequest:v,openView:l,completeViewRequest:o.completeViewRequest},{only:y})})}function eE(e,t){let n=[],r=/* @__PURE__ */ new Set,i=t;for(;i!==void 0&&!r.has(i);){r.add(i);let t=e.byId[i];if(t===void 0||(n.unshift({id:t.id,displayTitle:t.displayTitle,subagent:t.origin===`subagent`}),t.origin!==`subagent`))break;i=t.parentId}return n}function tE(e,t){return e.length===t.length&&e.every((e,n)=>{let r=t.at(n);return r!==void 0&&e.id===r.id&&e.displayTitle===r.displayTitle})}function nE({sessionId:e,hideChrome:t,titleNavigation:n,useSessions:r,useConversationViews:i,useStore:a,renderSlot:o,open:s,selectView:c,t:l}){let u=i(e=>e),d=QT(u,a(e=>e.view)),f=r(t=>eE(t,e),tE),p=!t&&u.length>1;return/* @__PURE__ */ (0,h.jsxs)(h.Fragment,{children:[/* @__PURE__ */ (0,h.jsxs)(`div`,{className:$.titleRow,children:[!t&&/* @__PURE__ */ (0,h.jsxs)(h.Fragment,{children:[/* @__PURE__ */ (0,h.jsxs)(`div`,{className:$.titleCluster,children:[/* @__PURE__ */ (0,h.jsxs)(`nav`,{className:$.crumbs,"aria-label":l(`session.hierarchy`),children:[f.map((e,t)=>{let n=t===f.length-1,r=n?/* @__PURE__ */ (0,h.jsx)(`span`,{className:Ib($.crumb,e.subagent&&$.crumbSubagent,$.crumbCurrent),children:e.displayTitle}):/* @__PURE__ */ (0,h.jsx)(`button`,{type:`button`,className:Ib($.crumb,e.subagent&&$.crumbSubagent),onClick:()=>{s(e.id)},children:e.displayTitle}),i=n||e.subagent,a={lineageSessionId:e.id,displayTitle:e.displayTitle,...n?{}:{openTitle:()=>{s(e.id)}}};return/* @__PURE__ */ (0,h.jsxs)(`span`,{className:$.crumbSeg,children:[t>0&&/* @__PURE__ */ (0,h.jsx)(`span`,{className:$.crumbSep,children:`/`}),i?e.subagent?o(`conversation.session.header.lineage`,a,{fallback:r}):/* @__PURE__ */ (0,h.jsxs)(h.Fragment,{children:[r,o(`conversation.session.header.lineage`,a,{fallback:null})]}):r]},e.id)}),f.length===0&&/* @__PURE__ */ (0,h.jsx)(`span`,{className:$.crumbCurrent,children:e})]}),n,/* @__PURE__ */ (0,h.jsx)(`div`,{className:$.headerActions,children:o(`conversation.session.header.actions`,{})})]}),/* @__PURE__ */ (0,h.jsx)(`div`,{className:$.headerUtilities,children:o(`conversation.session.header.utilities`,{})})]}),t&&n,/* @__PURE__ */ (0,h.jsx)(`div`,{className:$.headerCorner,"data-conversation-header-corner":``,children:o(`conversation.session.header.corner`,{})})]}),p&&/* @__PURE__ */ (0,h.jsx)(`div`,{className:$.tabs,role:`tablist`,"data-conversation-tabs":``,children:u.map(e=>/* @__PURE__ */ (0,h.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":e.id===d?.id,className:Ib($.tab,e.id===d?.id&&$.tabActive),onClick:()=>{c(e.id)},children:e.label},e.id))})]})}function rE(e){return/* @__PURE__ */ (0,h.jsx)($T,{...e})}function iE({editor:e,editable:t,...n}){let r=(0,g.useRef)(null);return(0,g.useLayoutEffect)(()=>{let t=r.current;if(t!==null&&((0,d.shouldAutoFocusTextInput)()||(t.ownerDocument.activeElement===t&&t.blur(),e?.setEditable(!1)),e!==null))return e.setRootElement(t),()=>{e.setRootElement(null)}},[e]),(0,g.useLayoutEffect)(()=>{e!==null&&e.setEditable(t)},[e,t]),/* @__PURE__ */ (0,h.jsx)(`div`,{ref:r,contentEditable:e!==null&&t,suppressContentEditableWarning:!0,role:`textbox`,"aria-multiline":`true`,"data-composer-input":!0,...n})}function aE({editor:e}){let[t,n]=g.useState(()=>e===null?{}:e.getDecorators());return g.useLayoutEffect(()=>{if(e!==null)return n(e.getDecorators()),e.registerDecoratorListener(e=>{n(e)})},[e]),e===null?null:/* @__PURE__ */ (0,h.jsx)(h.Fragment,{children:Object.entries(t).map(([t,n])=>{let r=e.getElementByKey(t);return r===null?null:(0,_.createPortal)(n,r,t)})})}function oE({classNames:e,editor:t,scrollRef:n,editable:r,editorDisabled:i,phase:a,placeholderText:o,ariaLabel:s,workspaceTrigger:c,workspacePickerOpen:l,onWorkspaceKeyDown:u,hint:d,showPlaceholder:f}){return/* @__PURE__ */ (0,h.jsx)(`div`,{ref:n,className:e.scroll,"data-input-scroll":!0,children:/* @__PURE__ */ (0,h.jsxs)(`div`,{className:e.grow,children:[/* @__PURE__ */ (0,h.jsx)(iE,{editor:c?null:t,editable:r,className:Ib(e.input,i&&e.inputDisabled),"data-phase":a,"aria-disabled":i||void 0,"data-placeholder":o,"aria-label":s,"aria-haspopup":c?`menu`:void 0,"aria-expanded":c?l:void 0,tabIndex:c?0:void 0,onKeyDown:c?u:void 0,style:d===null?void 0:{"--dsh-composer-hint":JSON.stringify(d)}}),f&&/* @__PURE__ */ (0,h.jsx)(`div`,{"aria-hidden":!0,className:e.placeholder,"data-composer-placeholder":!0,children:o}),/* @__PURE__ */ (0,h.jsx)(aE,{editor:c?null:t})]})})}function sE(e,t){return e.isComposing||e.keyCode===229||t()}function cE(e,t){let n=!1,r=0,i=null,a=()=>{i?.toggleAttribute(`data-composer-composing`,n||e.isComposing())},o=()=>{n=!0,a()},s=()=>{n=!1,r=Date.now()+10,e.update(()=>{},{onUpdate:a})},c=()=>n||Date.now()<r,l=e=>n=>{let r=n!==null&&sE(n,c);return t.arbitrate(e,r)!==`pass`&&(n?.preventDefault(),!0)};return Mv(e.registerRootListener((e,t)=>{t?.removeEventListener(`compositionstart`,o),t?.removeEventListener(`compositionend`,s),t?.removeAttribute(`data-composer-composing`),n=!1,r=0,i=e,e?.addEventListener(`compositionstart`,o),e?.addEventListener(`compositionend`,s),a()}),e.registerUpdateListener(a),e.registerCommand(yd,l(`up`),4),e.registerCommand(bd,l(`down`),4),e.registerCommand(Ed,e=>l(e.shiftKey?`tabBack`:`tab`)(e),4),e.registerCommand(wd,e=>(t.dismissPopup(),t.arbitrate(`escape`,sE(e,c))===`consumed`&&(e.preventDefault(),!0)),4),e.registerCommand(Sd,e=>sE(e,c)?!1:t.space()?(e.preventDefault(),!0):!1,4),e.registerCommand(xd,e=>e!==null&&(e.altKey||e.getModifierState(`AltGraph`)||e.ctrlKey&&e.metaKey||e.shiftKey&&(e.ctrlKey||e.metaKey))?!0:e?.shiftKey===!0?!1:e!==null&&sE(e,c)?!0:t.arbitrate(`enter`,!1)===`pass`?(e?.preventDefault(),e?.repeat===!0||!t.canSubmit()||t.submit(e?.ctrlKey===!0||e?.metaKey===!0),!0):(e?.preventDefault(),!0),4),e.registerCommand(sd,e=>{let n=e.clipboardData??null;if(n===null)return!1;let r=[],i=/* @__PURE__ */ new Set;for(let e of n.items){if(e.kind!==`file`)continue;let t=e.getAsFile();t!==null&&(r.push(t),typeof e.webkitGetAsEntry==`function`&&e.webkitGetAsEntry()?.isDirectory===!0&&i.add(t))}r.length>0&&t.intakeFiles(r,i.size===0?void 0:i);let a=n.getData(`text/plain`);return a===``?r.length!==0&&(e.preventDefault(),!0):(e.preventDefault(),t.pasteText(a),!0)},4))}function lE(e){let t=e.current;if(t===null||t.scrollHeight<=t.clientHeight)return;let n=window.getSelection();if(n===null||n.rangeCount===0)return;let r=n.getRangeAt(0).getBoundingClientRect();if(r.height===0&&r.width===0){let e=n.anchorNode,t=e instanceof HTMLElement?e:e?.parentElement;if(t==null)return;r=t.getBoundingClientRect()}let i=t.getBoundingClientRect();r.bottom>i.bottom?t.scrollTop+=r.bottom-i.bottom:r.top<i.top&&(t.scrollTop-=i.top-r.top)}function uE(e,t){e.getRootElement()?.focus({preventScroll:!0}),e.focus(()=>{t()})}function dE(e){let t=e.current;if(t===null)return;let n=e=>{let n=t.closest(`[data-conversation-scroll]`);if(!(n instanceof HTMLElement)||e.deltaY===0)return;let r=t.scrollTop<=0,i=t.scrollTop+t.clientHeight>=t.scrollHeight-1;e.deltaY<0&&!r||e.deltaY>0&&!i||(e.preventDefault(),n.scrollTop+=e.deltaY)};return t.addEventListener(`wheel`,n,{passive:!1}),()=>{t.removeEventListener(`wheel`,n)}}function fE(e,t,n){return e.bindFilePicker({available:()=>t.current.canAcceptDrop&&n.current!==null,open:()=>{n.current?.click()}})}function pE(e,t,n){return cE(e,{arbitrate:(e,r)=>e===`enter`&&n.current.primaryAction!==void 0?`pass`:t.arbitrate(e,r),space:()=>n.current.machineBusy||n.current.locked?!1:t.space(),dismissPopup:()=>{t.dismissPopup()},canSubmit:()=>!n.current.locked&&!n.current.machineBusy&&n.current.primaryAction?.disabled!==!0,submit:e=>{let r=n.current;r.uploadsFailed?r.showToast(r.t(`file.retryOrRemove`)):r.primaryAction===void 0?e&&r.canSteerQueue?t.steerQueue():t.submit(cT(r.busyEnter,r.running,e?`accelerated`:`enter`,r.steeringAvailable),`enter`):r.primaryAction.run()},intakeFiles:(e,t)=>{n.current.intakeFiles(e,t)},pasteText:e=>{n.current.machineBusy||n.current.locked||t.paste(e)}})}function mE(e,t){e.preventDefault(),!(0,d.isMobileDevice)()&&t?.getRootElement()?.focus({preventScroll:!0})}function hE(e){let t=e/1048576;return`${Number.isInteger(t)?String(t):t.toFixed(1)}MB`}function gE(e,t,n){switch(t){case`MODEL_DOES_NOT_SUPPORT_IMAGES`:return e(`image.modelUnsupported`);case`FILE_NOT_STAGED`:return e(`file.notStaged`);case`FILE_UNAVAILABLE`:return e(`file.unavailable`);case`IMAGE_TOO_MANY_PIXELS`:return e(`image.tooManyPixels`);case`INVALID_IMAGE`:case`IMAGE_TYPE_MISMATCH`:return e(`image.unsupportedType`);case`TOO_MANY_IMAGES`:if(n!==void 0)return e(`image.tooMany`,{count:n.maxImagesPerMessage});break;case`IMAGE_TOO_LARGE`:if(n!==void 0)return e(`image.fileTooLarge`,{size:hE(n.maxImageBytes)});break;case`IMAGES_TOO_LARGE`:if(n!==void 0)return e(`image.totalTooLarge`,{size:hE(n.maxMessageImageBytes)})}return e(`image.sendFailed`,{reason:t})}function _E(e){let t=e?.projectedTokens??e?.pressureTokens;return t===void 0||e?.contextWindow===void 0?null:{percent:Math.min(100,Math.round(t/e.contextWindow*100)),usedTokens:t,contextWindow:e.contextWindow}}let vE=`@deepseek-ai/dsh-client-ui-conversation/ContextMeter.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(vE)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-conversation`,e.dataset.pluginCss=vE,e.textContent=`.MXybya_root{flex:none;display:inline-flex}.MXybya_trigger{border-radius:var(--dsw-radius-sm);color:var(--dsw-alias-label-tertiary);font-family:inherit;font-size:var(--dsh-content-font-size-secondary,13px);font-variant-numeric:tabular-nums;line-height:calc(20px + var(--dsh-content-font-delta-secondary,0px));white-space:nowrap;cursor:pointer;background:0 0;border:none;flex:none;align-items:center;gap:6px;padding:1px 8px;display:inline-flex}.MXybya_trigger:hover,.MXybya_trigger[aria-expanded=true]{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-secondary)}.MXybya_track{fill:none;stroke:var(--dsw-alias-border-l3);stroke-width:2px}.MXybya_fill{fill:none;stroke:var(--dsw-alias-label-tertiary);stroke-width:2px;stroke-linecap:round}.MXybya_panel{z-index:1100;box-sizing:border-box;border-radius:var(--dsw-radius-lg);background:var(--dsw-specific-menu);width:min(264px,100vw - 24px);backdrop-filter:var(--dsw-menu-backdrop-filter);--dsw-elevation-stroke-color:var(--dsw-alias-border-l1);box-shadow:var(--dsw-elevation-prominent);color:var(--dsw-alias-label-secondary);cursor:default;border:0;padding:12px;font-size:12px;line-height:20px;position:fixed}.MXybya_header{align-items:center;gap:6px;display:flex}.MXybya_figures{font-variant-numeric:tabular-nums;color:var(--dsw-alias-label-primary);margin-left:auto;font-weight:500}.MXybya_percent{color:var(--dsw-alias-label-primary);font-weight:500}.MXybya_headline{color:var(--dsw-alias-label-tertiary)}.MXybya_headline:empty{display:none}.MXybya_bar{corner-shape:round;background:var(--dsw-alias-interactive-bg-hover);border-radius:999px;gap:1px;height:4px;margin:10px 0 12px;display:flex;overflow:hidden}.MXybya_segment{background:var(--meter-tint,var(--dsw-alias-label-tertiary));border-radius:1px;flex:none;min-width:2px;height:100%}.MXybya_swatch{background:var(--meter-tint);vertical-align:baseline;border-radius:2px;width:8px;height:8px;margin-right:6px;display:inline-block}.MXybya_colorSystem{--meter-tint:var(--dsw-static-neutral-bluish-400)}.MXybya_colorTools{--meter-tint:#a78bfa}.MXybya_colorMessages{--meter-tint:var(--dsw-static-blue-450)}.MXybya_rows{margin:6px 0 0}.MXybya_row{justify-content:space-between;align-items:center;gap:12px;padding:2px 0;display:flex}.MXybya_row dt{color:var(--dsw-alias-label-secondary)}.MXybya_row dd{font-variant-numeric:tabular-nums;color:var(--dsw-alias-label-primary);margin:0}`,document.head.appendChild(e)}var yE={bar:`MXybya_bar`,colorMessages:`MXybya_colorMessages`,colorSystem:`MXybya_colorSystem`,colorTools:`MXybya_colorTools`,figures:`MXybya_figures`,fill:`MXybya_fill`,header:`MXybya_header`,headline:`MXybya_headline`,panel:`MXybya_panel`,percent:`MXybya_percent`,root:`MXybya_root`,row:`MXybya_row`,rows:`MXybya_rows`,segment:`MXybya_segment`,swatch:`MXybya_swatch`,track:`MXybya_track`,trigger:`MXybya_trigger`};let bE=5.5,xE=2*Math.PI*bE,SE=[{key:`systemTokens`,label:`context.system`,color:yE.colorSystem},{key:`toolsTokens`,label:`context.tools`,color:yE.colorTools},{key:`messageTokens`,label:`context.messages`,color:yE.colorMessages}];function CE(e,t){let n=e=>String(e>=100?Math.round(e):Math.round(e*10)/10);return e<1e3?String(e):e<1e6?t(`number.thousand`,{value:n(e/1e3)}):t(`number.million`,{value:n(e/1e6)})}function wE({useProjection:e,t}){let n=e(`contextPressure`),r=e(`contextBreakdown`),[i,a]=(0,g.useState)(!1),o=(0,g.useRef)(null),s=(0,g.useRef)(null),c=_E(n),l=c!==null,u=(0,d.useAnchoredPosition)({open:i&&l,anchorRef:o,panelRef:s,side:`top`,gap:8,margin:12});if((0,d.useDismissOnOutsidePointer)(o,i&&l,a,s),(0,g.useEffect)(()=>{!l&&i&&a(!1)},[l,i]),(0,g.useEffect)(()=>{if(!i||!l)return;let e=e=>{e.key===`Escape`&&a(!1)};return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e)}},[l,i]),c===null)return null;let f=c.percent,p=`${f}%`,[m=``,v=``]=t(`context.aria`,{percent:`\0`}).split(`\0`).map(e=>e.trim()),y=r===void 0?0:r.systemTokens+r.toolsTokens+r.messageTokens,ee=(r===void 0||y===0?[{key:`total`,color:void 0,width:f}]:SE.map(e=>({key:e.key,color:e.color,width:f*r[e.key]/y}))).filter(e=>e.width>0);return/* @__PURE__ */ (0,h.jsxs)(`span`,{ref:o,className:yE.root,children:[/* @__PURE__ */ (0,h.jsx)(d.Tooltip,{label:t(`context.aria`,{percent:p}),side:`top`,delayMs:200,disabled:i,children:/* @__PURE__ */ (0,h.jsxs)(`button`,{type:`button`,className:yE.trigger,"aria-label":t(`context.aria`,{percent:p}),"aria-haspopup":`dialog`,"aria-expanded":i,onClick:()=>{a(!i)},children:[/* @__PURE__ */ (0,h.jsxs)(`svg`,{viewBox:`0 0 14 14`,width:`14`,height:`14`,"aria-hidden":!0,children:[/* @__PURE__ */ (0,h.jsx)(`circle`,{className:yE.track,cx:`7`,cy:`7`,r:bE}),/* @__PURE__ */ (0,h.jsx)(`circle`,{className:yE.fill,cx:`7`,cy:`7`,r:bE,strokeDasharray:`${xE*f/100} ${xE}`,transform:`rotate(-90 7 7)`})]}),/* @__PURE__ */ (0,h.jsx)(`span`,{children:p})]})}),i&&(0,_.createPortal)(/* @__PURE__ */ (0,h.jsxs)(`div`,{ref:s,className:yE.panel,style:u??{visibility:`hidden`,left:0,top:0},role:`dialog`,"aria-label":t(`context.used`),children:[/* @__PURE__ */ (0,h.jsxs)(`div`,{className:yE.header,children:[/* @__PURE__ */ (0,h.jsx)(`span`,{className:yE.headline,children:m}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:yE.percent,children:p}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:yE.headline,children:v}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:yE.figures,children:`~${CE(c.usedTokens,t)} / ${CE(c.contextWindow,t)}`})]}),/* @__PURE__ */ (0,h.jsx)(`div`,{className:yE.bar,children:ee.map(e=>/* @__PURE__ */ (0,h.jsx)(`div`,{className:e.color===void 0?yE.segment:`${yE.segment} ${e.color}`,style:{width:`${e.width}%`}},e.key))}),r!==void 0&&/* @__PURE__ */ (0,h.jsx)(`dl`,{className:yE.rows,children:SE.map(e=>/* @__PURE__ */ (0,h.jsxs)(`div`,{className:yE.row,children:[/* @__PURE__ */ (0,h.jsxs)(`dt`,{children:[/* @__PURE__ */ (0,h.jsx)(`span`,{className:`${yE.swatch} ${e.color}`,"aria-hidden":!0}),t(e.label)]}),/* @__PURE__ */ (0,h.jsx)(`dd`,{children:`~${CE(r[e.key],t)}`})]},e.key))})]}),document.body)]})}function TE(e,t){let n=e.querySelector(`[data-toolbar-scroll]`);if(n===null)return()=>{};let r=e.querySelector(`[data-toolbar-fixed="start"]`),i=e.querySelector(`[data-toolbar-fixed="end"]`),a={phone:!1,overflowActions:!1},o=!1,s=/* @__PURE__ */ new Set,c=()=>{if(!a.phone||e.hasAttribute(`data-toolbar-activity`))return;let t=e.ownerDocument.activeElement;if(!(t instanceof HTMLElement)||!e.contains(t)||t.closest(`[data-toolbar-fixed]`))return;let{left:r,right:i}=n.getBoundingClientRect(),o=t.getBoundingClientRect();o.left<r?n.scrollLeft+=o.left-r:o.right>i&&(n.scrollLeft+=Math.min(o.right-i,o.left-r))},l=()=>{if(o)return;let s=e.closest(`[data-phone]`)!==null;if(e.toggleAttribute(`data-phone-toolbar`,s),e.hasAttribute(`data-toolbar-activity`)){s!==a.phone&&(a={...a,phone:s},t?.(a));return}let l=e.hasAttribute(`data-actions-overflow`);if(e.removeAttribute(`data-model-compact`),e.removeAttribute(`data-actions-overflow`),e.toggleAttribute(`data-toolbar-measuring`,s),s)for(let[t,n]of[[`start`,r],[`end`,i]]){if(n===null)continue;let r=`--dsh-composer-${t}-width`,i=`${n.getBoundingClientRect().width}px`;e.style.getPropertyValue(r)!==i&&e.style.setProperty(r,i)}let u=getComputedStyle(e),d=e.getBoundingClientRect().width-parseFloat(u.paddingLeft)-parseFloat(u.paddingRight),f=s?(()=>{let t=e=>Array.from(e.children).flatMap(e=>{let r=getComputedStyle(e).display;return r===`none`?[]:e===n||r===`contents`?t(e):[e]}),r=t(e);return r.reduce((e,t)=>{let n=getComputedStyle(t);return e+t.getBoundingClientRect().width+(parseFloat(n.marginLeft)||0)+(parseFloat(n.marginRight)||0)},0)+Math.max(0,r.length-1)*(parseFloat(u.columnGap)||0)})():(()=>{let e=Array.from(n.children,e=>e.getBoundingClientRect().width).filter(e=>e>0);return e.reduce((e,t)=>e+t,0)+Math.max(0,e.length-1)*parseFloat(u.columnGap)})();e.toggleAttribute(`data-model-compact`,!s&&f>d);let p=e.querySelector(`[data-composer-overflow-action]`),m=e.querySelector(`[data-toolbar-fixed="start"] button`),h=s&&p!==null&&m?.disabled===!1&&f>d-(l?2:0),g=e.hasAttribute(`data-command-menu-open`)||p!==null&&p.contains(e.ownerDocument.activeElement)?l:h;e.removeAttribute(`data-toolbar-measuring`),e.toggleAttribute(`data-actions-overflow`,g),(s!==a.phone||g!==a.overflowActions)&&(a={phone:s,overflowActions:g},t?.(a)),(!s||n.scrollWidth<=n.clientWidth)&&(n.scrollLeft=0),c()},u=new ResizeObserver(l),d=()=>{let t=/* @__PURE__ */ new Set([e,...e.querySelectorAll(`*`)]);for(let e of s)t.has(e)||(u.unobserve(e),s.delete(e));for(let e of t)s.has(e)||(u.observe(e),s.add(e))},f=new MutationObserver(()=>{d(),l()});f.observe(e,{subtree:!0,childList:!0,characterData:!0,attributes:!0,attributeFilter:[`hidden`,`class`,`style`,`aria-label`,`aria-busy`,`disabled`,`data-command-menu-open`,`data-toolbar-activity`]});let p=new MutationObserver(l);for(let t=e.parentElement;t!==null;t=t.parentElement)p.observe(t,{attributes:!0,attributeFilter:t===e.ownerDocument.body||t===e.ownerDocument.documentElement?[`data-phone`,`class`,`style`,`lang`,`dir`]:[`data-phone`,`lang`,`dir`]});let m=()=>{queueMicrotask(()=>{o||l()})};e.addEventListener(`focusin`,c),e.addEventListener(`focusout`,m);let h=document.fonts;return h.addEventListener(`loadingdone`,l),d(),l(),()=>{o=!0,u.disconnect(),f.disconnect(),p.disconnect(),e.removeEventListener(`focusin`,c),e.removeEventListener(`focusout`,m),h.removeEventListener(`loadingdone`,l)}}let EE=`@deepseek-ai/dsh-client-ui-conversation/InputBar.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(EE)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-conversation`,e.dataset.pluginCss=EE,e.textContent=`.HyhxnW_root{padding:0 var(--dsh-composer-side-clearance) 4px;flex-direction:column;align-items:center;display:flex}[data-phone] .HyhxnW_root{padding-bottom:max(4px, calc(env(safe-area-inset-bottom) - 23px))}.HyhxnW_dock{justify-content:center;align-items:center;gap:12px;max-width:100%;padding-top:4px;display:flex}.HyhxnW_hero .HyhxnW_dock:empty{display:none}.HyhxnW_hero{padding:0 var(--dsh-composer-side-clearance)}.HyhxnW_notice{width:100%;max-width:var(--dsh-composer-card-max-width);border-radius:var(--dsw-radius-md);background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-secondary);margin-bottom:6px;padding:4px 8px;font-size:12px;line-height:18px}.HyhxnW_card{box-sizing:border-box;width:100%;max-width:var(--dsh-composer-card-max-width);--dsw-elevation-stroke-color:var(--dsw-alias-border-l2);border-radius:var(--dsw-radius-panel);background:var(--dsw-specific-input-major);box-shadow:var(--dsw-elevation-soft);font-size:var(--dsh-content-font-size,14px);line-height:calc(24px + var(--dsh-content-font-delta,0px));--dsh-scrollbar-thumb:var(--dsw-alias-scrollbar-bg-l2);--dsh-scrollbar-thumb-hover:var(--dsw-alias-scrollbar-hover-l2);border:0;flex-direction:column;gap:12px;padding-top:8px;display:flex;position:relative}@supports (backdrop-filter:blur(14px)){body[data-codexhost-wallpaper] .HyhxnW_card,[data-phone] .HyhxnW_card{box-shadow:none;background:0 0}body[data-codexhost-wallpaper] .HyhxnW_card:before,[data-phone] .HyhxnW_card:before{content:"";z-index:-1;border-radius:inherit;background:color-mix(in srgb, var(--dsw-specific-input-major) 60%, transparent);backdrop-filter:blur(16px);box-shadow:inset 0 1px 0 color-mix(in srgb, var(--dsw-alias-bg-layer-3) 65%, transparent), var(--dsw-elevation-soft), 0 8px 24px -12px var(--dsw-alias-bg-mask-2);pointer-events:none;position:absolute;inset:0}body:not([data-codexhost-wallpaper]) [data-phone] .HyhxnW_card:before{background:color-mix(in srgb, var(--dsw-specific-input-major) 24%, transparent);backdrop-filter:blur(14px)}}@media (prefers-reduced-transparency:reduce),(prefers-contrast:more),(forced-colors:active){body[data-codexhost-wallpaper] .HyhxnW_card,[data-phone] .HyhxnW_card{background:var(--dsw-specific-input-major);box-shadow:var(--dsw-elevation-soft)}body[data-codexhost-wallpaper] .HyhxnW_card:before,[data-phone] .HyhxnW_card:before{display:none}}@media (prefers-contrast:more),(forced-colors:active){[data-phone] .HyhxnW_card:not(.HyhxnW_cardWorkspaceTrigger){outline:1px solid var(--dsw-alias-label-primary);outline-offset:-1px}}.HyhxnW_cardWorkspaceTrigger{--dsw-elevation-stroke-color:transparent;cursor:pointer}.HyhxnW_cardWorkspaceTrigger:after{content:"";box-sizing:border-box;border-radius:var(--dsw-radius-panel);color:var(--dsw-alias-border-l4);pointer-events:none;border:1px dashed;transition:color .1s;position:absolute;inset:0}.HyhxnW_cardWorkspaceTrigger :disabled{pointer-events:none}.HyhxnW_cardWorkspaceTrigger:hover:after{color:var(--dsw-alias-state-business-primary)}.HyhxnW_inlineNotices{flex-direction:column;gap:8px;display:flex}.HyhxnW_inlineNotices>[data-slot]>*{margin:10px 10px 0}.HyhxnW_accessory{align-items:center;gap:8px;padding:10px 12px 0;display:flex}.HyhxnW_overlayAnchor{height:0;position:absolute;inset:0 0 auto}.HyhxnW_scroll{max-height:var(--dsh-composer-text-max-height);margin-right:4px;overflow-y:auto}.HyhxnW_scroll::-webkit-scrollbar-track{margin-top:8px}.HyhxnW_grow{position:relative}.HyhxnW_pending{corner-shape:round;background:var(--dsw-alias-state-business-primary);border-radius:50%;width:8px;height:8px;animation:1s ease-in-out infinite alternate HyhxnW_input-pending}@keyframes HyhxnW_input-pending{0%{opacity:.35}to{opacity:1}}.HyhxnW_input{box-sizing:border-box;min-height:36px;font-family:var(--dsw-font-family);font-size:inherit;line-height:inherit;white-space:pre-wrap;word-break:break-word;overflow-wrap:anywhere;color:var(--dsw-alias-label-primary);caret-color:var(--dsw-alias-state-business-primary);outline:none;padding:4px 8px 0 14px}.HyhxnW_input p{margin:0}.HyhxnW_input p:last-child:after{content:var(--dsh-composer-hint);color:var(--dsw-alias-label-caption)}.HyhxnW_input[data-composer-composing] p:last-child:after{content:none}.HyhxnW_input[data-composer-composing]+.HyhxnW_placeholder{visibility:hidden}.HyhxnW_placeholder{color:var(--dsw-alias-label-caption);white-space:nowrap;text-overflow:ellipsis;pointer-events:none;user-select:none;position:absolute;inset:4px 8px auto 14px;overflow:hidden}.HyhxnW_inputDisabled{color:var(--dsw-alias-label-tertiary);cursor:not-allowed}.HyhxnW_input[aria-haspopup=menu]{cursor:pointer}.HyhxnW_hero .HyhxnW_input{min-height:52px}.HyhxnW_hero .HyhxnW_placeholder{white-space:normal;-webkit-line-clamp:2;line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box}@media (width<=600px){.HyhxnW_hero .HyhxnW_input{min-height:36px}.HyhxnW_hero .HyhxnW_placeholder{white-space:nowrap;display:block}}.HyhxnW_row{flex-wrap:wrap;justify-content:space-between;align-items:center;gap:12px;min-width:0;padding:2px 8px 6px;display:flex;container-type:inline-size}.HyhxnW_row[data-model-compact]{--dsh-composer-model-text-display:none;--dsh-composer-model-icon-display:block}.HyhxnW_tools,.HyhxnW_modes,.HyhxnW_trailing{align-items:center;min-width:0;display:flex}.HyhxnW_tools,.HyhxnW_modes{gap:12px}.HyhxnW_trailing{flex:none;gap:12px;margin-left:auto}@container (width<=560px){.HyhxnW_tools,.HyhxnW_modes,.HyhxnW_trailing{gap:8px}}.HyhxnW_add{corner-shape:round;background:var(--dsw-specific-selector);width:28px;height:28px;color:var(--dsw-alias-label-primary);cursor:pointer;border:none;border-radius:999px;flex:none;place-items:center;display:grid}.HyhxnW_add:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover-solid)}.HyhxnW_add:disabled{opacity:.5;cursor:default}.HyhxnW_select{border-radius:var(--dsw-radius-sm);max-width:220px;height:28px;color:var(--dsw-alias-label-secondary);white-space:nowrap;cursor:pointer;appearance:none;background-color:#0000;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5' stroke='%2381858C' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");background-position:right 4px center;background-repeat:no-repeat;background-size:12px 12px;border:none;outline:none;padding:0 20px 0 8px;font-size:13px;font-weight:500;line-height:20px}.HyhxnW_select:hover:not(:disabled){background-color:var(--dsw-alias-interactive-bg-hover)}.HyhxnW_select:disabled{opacity:.5;cursor:default}.HyhxnW_primary{corner-shape:round;background:var(--dsw-alias-button-info-fill);color:#fff;cursor:pointer;border:none;border-radius:999px;flex:none;place-items:center;width:30px;height:30px;transition:background-color .1s;display:grid;transform:translateY(-2px)}.HyhxnW_primary:hover:not(:disabled){background:var(--dsw-alias-button-info-hover)}.HyhxnW_primary:disabled{opacity:.4;cursor:default}.HyhxnW_retry{border-radius:var(--dsw-radius-sm);color:inherit;cursor:pointer;background:0 0;border:1px solid;margin-left:8px;padding:1px 8px;font-size:12px}.HyhxnW_addSeat,.HyhxnW_submitSeat,.HyhxnW_controlScroll{display:contents}.HyhxnW_row[data-phone-toolbar]{flex-wrap:nowrap;gap:4px;position:relative}.HyhxnW_row[data-phone-toolbar] .HyhxnW_controlScroll{--dsh-composer-edge-gap:4px;align-items:center;gap:inherit;min-width:0;min-height:44px;margin-left:calc(var(--dsh-composer-start-width,44px) + var(--dsh-composer-edge-gap));margin-right:calc(var(--dsh-composer-end-width,44px) + var(--dsh-composer-edge-gap));overscroll-behavior-x:contain;scrollbar-width:none;flex:1;display:flex;overflow-x:auto}.HyhxnW_row[data-phone-toolbar] .HyhxnW_controlScroll::-webkit-scrollbar{display:none}.HyhxnW_row[data-phone-toolbar] .HyhxnW_tools:not([hidden]),.HyhxnW_row[data-phone-toolbar] .HyhxnW_trailing:not(.HyhxnW_trailingActive){display:contents}.HyhxnW_row[data-phone-toolbar] .HyhxnW_tools>*,.HyhxnW_row[data-phone-toolbar] [data-slot="conversation.input.left"]>*{flex-shrink:0}.HyhxnW_row[data-phone-toolbar] button:focus-visible{outline-offset:-2px}.HyhxnW_row[data-phone-toolbar] .HyhxnW_modes,.HyhxnW_row[data-phone-toolbar] .HyhxnW_standardControls{flex:none;gap:4px;width:max-content}.HyhxnW_row[data-phone-toolbar] .HyhxnW_standardControls{margin-left:0}.HyhxnW_row[data-phone-toolbar] .HyhxnW_addSeat,.HyhxnW_row[data-phone-toolbar] .HyhxnW_submitSeat{z-index:1;flex:none;align-items:center;gap:4px;display:flex;position:absolute;inset-block:2px 6px}.HyhxnW_row[data-phone-toolbar] .HyhxnW_addSeat{left:8px}.HyhxnW_row[data-phone-toolbar] .HyhxnW_submitSeat{margin-left:0;right:8px}.HyhxnW_row[data-phone-toolbar] .HyhxnW_add,.HyhxnW_row[data-phone-toolbar] .HyhxnW_primary{box-sizing:border-box;background-clip:padding-box;width:44px;height:44px}.HyhxnW_row[data-phone-toolbar] .HyhxnW_add{border:8px solid #0000}.HyhxnW_row[data-phone-toolbar] .HyhxnW_primary{border:7px solid #0000}.HyhxnW_row[data-phone-toolbar][data-toolbar-activity] .HyhxnW_controlScroll{display:contents}.HyhxnW_row[data-phone-toolbar][data-toolbar-activity] .HyhxnW_submitSeat{position:static}.HyhxnW_row[data-actions-overflow] [data-composer-overflow-action]{display:none}.HyhxnW_standardControls{align-items:center;gap:12px;min-width:0;display:flex}.HyhxnW_tools[hidden],.HyhxnW_standardControls[hidden]{display:none}.HyhxnW_trailingActive{flex:1;margin-left:0}.HyhxnW_activity{flex:none;align-items:center;display:flex}.HyhxnW_activity:empty{display:none}.HyhxnW_activityExpanded{flex:1;min-width:0}.HyhxnW_annotations{scrollbar-width:none;align-items:center;gap:6px;padding:8px 12px 0;display:flex;overflow-x:auto}.HyhxnW_annotations::-webkit-scrollbar{display:none}.HyhxnW_annotations>*{flex:none}`,document.head.appendChild(e)}var DE={accessory:`HyhxnW_accessory`,activity:`HyhxnW_activity`,activityExpanded:`HyhxnW_activityExpanded`,add:`HyhxnW_add`,addSeat:`HyhxnW_addSeat`,annotations:`HyhxnW_annotations`,card:`HyhxnW_card`,cardWorkspaceTrigger:`HyhxnW_cardWorkspaceTrigger`,controlScroll:`HyhxnW_controlScroll`,dock:`HyhxnW_dock`,grow:`HyhxnW_grow`,hero:`HyhxnW_hero`,inlineNotices:`HyhxnW_inlineNotices`,input:`HyhxnW_input`,"input-pending":`HyhxnW_input-pending`,inputDisabled:`HyhxnW_inputDisabled`,modes:`HyhxnW_modes`,notice:`HyhxnW_notice`,overlayAnchor:`HyhxnW_overlayAnchor`,pending:`HyhxnW_pending`,placeholder:`HyhxnW_placeholder`,primary:`HyhxnW_primary`,retry:`HyhxnW_retry`,root:`HyhxnW_root`,row:`HyhxnW_row`,scroll:`HyhxnW_scroll`,select:`HyhxnW_select`,standardControls:`HyhxnW_standardControls`,submitSeat:`HyhxnW_submitSeat`,tools:`HyhxnW_tools`,trailing:`HyhxnW_trailing`,trailingActive:`HyhxnW_trailingActive`};let OE=[],kE=(0,g.memo)(function({useSession:e,useInput:t,inputActions:n,keyboard:r,addFiles:i,removeAttachment:a,resolveDraftAttachments:o,retryFileUpload:s,toggleCommandMenu:c,stop:l,t:u,renderSlot:f,useBusyEnter:p,useFileUploads:m,useNotices:_,useLexicon:v,useMenuLauncher:y,useStopShortcut:ee,useProjection:b,sessionId:x,variant:te,disabled:ne=!1,blocked:re,workspacePickerOpen:ie=!1,onRequestWorkspace:ae,placeholder:oe,accessory:se}){let S=t(e=>e),ce=S?.responseAnnotations??OE,le=(0,g.useMemo)(()=>({label:e=>u(`annotation.label`,{index:e}),railLabel:e=>u(`annotation.chipLabel`,{index:e}),railTitle:(e,t)=>u(`annotation.title`,{index:e,excerpt:t}),remove:e=>u(`annotation.remove`,{index:e}),selectedText:u(`annotation.selectedText`),userComment:u(`annotation.userComment`)}),[u]),ue=_(e=>e),de=p(e=>e),fe=ee(e=>e),C=y(e=>e===`command`),[w,pe]=(0,g.useState)(!1);(0,g.useEffect)(()=>{pe(!1)},[x]);let me=e(e=>e.promptError)??null,he=e(e=>e.running)??!1,ge=e(e=>e.subagent)??null,_e=e(e=>e.removed)??!1,ve=b(`plan`,e=>e!==void 0&&(e.pending?!e.active:e.active)),ye=b(`goal`,e=>e!=null),be=S!==void 0&&r!==void 0&&n!==void 0,xe=S?.draft??``,Se=S?.primaryAction,Ce=r?.editor??null,we=(0,g.useMemo)(()=>S===void 0||o===void 0?[]:o(S.attachmentIds),[o,S?.attachmentIds]),Te=xe.trim()===``&&we.length===0&&ce.length===0,Ee=m(e=>e),De=we.some(e=>Ee[e.id]?.status===`error`),[Oe,ke]=(0,g.useState)(null),Ae=(0,g.useRef)(0),je=(0,g.useCallback)(e=>{Ae.current+=1,ke({seq:Ae.current,text:e})},[]),Me=(0,g.useCallback)(()=>{ke(null)},[]),Ne=b(`imageLimits`),Pe=b(`attachmentInput`),Fe=Pe?.enabled!==!1,Ie=Pe?.imagesOnly===!0;(0,g.useEffect)(()=>{if(me===null)return;let{error:e}=me;e.code===`session/writer-held`?je(u(`error.sessionInUse`)):je(e.code===`session/attachment-invalid`||e.code===`subagent/attachment-invalid`?gE(u,e.details.reason,Ne):`${e.message} (${e.code})`)},[me,je,u,Ne]),(0,g.useEffect)(()=>{ue?.level===`error`&&je(ue.text)},[ue,je]);let Le=(0,g.useRef)(null),[Re,ze]=(0,g.useState)({phone:!1,overflowActions:!1});(0,g.useLayoutEffect)(()=>{let e=Le.current;if(e!==null)return TE(e,ze)},[]);let Be=(0,g.useRef)(null),Ve=(0,g.useRef)(null),He=ge?.address.mode===`continuable`,Ue=He&&ge.parentAvailable!==!0,We=_e||ne||!be||re!==void 0||Ue,Ge=We,Ke=_e||ne||!be,qe=S?.phase===`adjudicating`||S?.phase===`submitting`,Je=ne&&!_e&&ae!==void 0,Ye=_e||Ge&&!Je,Xe=be&&!Ge&&!qe,Ze=ge===null||ge.address.mode===`continuable`,Qe=!Ge&&!qe&&Te&&he&&Ze&&S.queue.length>0;(0,g.useEffect)(()=>{S!==void 0&&n!==void 0&&we.length!==S.attachmentIds.length&&n.pruneAttachments(we.map(e=>e.id))},[we,S?.attachmentIds,n]);let $e=()=>{lE(Ve)};(0,g.useEffect)(()=>{Ge||Ce===null||(0,d.shouldAutoFocusTextInput)()&&uE(Ce,$e)},[Ge,x,Ce]),(0,g.useEffect)(()=>{Ge||xe===``||$e()},[xe!==``]),(0,g.useEffect)(()=>dE(Ve),[]);let et=(0,g.useCallback)((e,t)=>{if(ge!==null||i===void 0||e.length===0)return;if(!Fe){je(u(`attachment.unavailable`));return}let n=(()=>{if(Ie&&e.some(e=>!(Ne?.mediaTypes)?.includes(e.type)))return u(`image.unsupportedType`);if(Ne!==void 0){let t=Ne.mediaTypes,n=e.filter(e=>t.includes(e.type)),r=we.filter(e=>e.kind===`image`);if(r.length+n.length>Ne.maxImagesPerMessage)return u(`image.tooMany`,{count:Ne.maxImagesPerMessage});if(n.some(e=>e.size>Ne.maxImageBytes))return u(`image.fileTooLarge`,{size:hE(Ne.maxImageBytes)});if(r.reduce((e,t)=>e+t.file.size,0)+n.reduce((e,t)=>e+t.size,0)>Ne.maxMessageImageBytes)return u(`image.totalTooLarge`,{size:hE(Ne.maxMessageImageBytes)})}return i(e,t)})();n!==null&&je(n)},[ge,i,Fe,Ie,we,Ne,je,u]),tt=Fe&&ge===null&&!Ge&&!qe&&i!==void 0,nt=u(Fe?Ie?`input.imagesAndCommands`:`input.commands`:`input.commandsOnly`),rt=(0,g.useRef)(null),it=e=>{let t=e.target.files===null?[]:[...e.target.files];e.target.value=``,t.length>0&&et(t)},at=(0,g.useRef)({locked:Ge,machineBusy:qe,primaryAction:Se,canSteerQueue:Qe,running:he,steeringAvailable:Ze,busyEnter:de,intakeFiles:et,uploadsFailed:De,showToast:je,t:u,canAcceptDrop:tt});at.current={locked:Ge,machineBusy:qe,primaryAction:Se,canSteerQueue:Qe,running:he,steeringAvailable:Ze,busyEnter:de,intakeFiles:et,uploadsFailed:De,showToast:je,t:u,canAcceptDrop:tt},(0,g.useEffect)(()=>{if(r!==void 0)return fE(r,at,rt)},[r]),(0,g.useEffect)(()=>{if(Ce!==null&&r!==void 0)return pE(Ce,r,at)},[Ce,r]);let ot=e=>{mE(e,Ce)},st=()=>{r!==void 0&&(Ce!==null&&(0,d.shouldAutoFocusTextInput)()&&uE(Ce,$e),c?.(r.caretSpan()))},ct=e=>{Je&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),ae())},lt=Se===void 0&&he&&ge===null&&(Te||re!==void 0),ut=lt?l===void 0:(Se===void 0?Te:Se.disabled)||We||qe,dt=he&&He,ft=cT(de,he,`enter`,Ze),pt=!Te&&S?.phase===`plain`&&!xe.trimStart().startsWith(`/`),mt=u(lt?`input.stop`:Se===void 0&&he&&Ze&&!We&&!De&&pt?ft===`steer`?`input.send.steer`:`input.send.queue`:`input.send`),ht=()=>{lt?l?.():De?je(u(`file.retryOrRemove`)):Se===void 0?r!==void 0&&!Te&&!We&&!qe&&r.submit(ft,`click`):ut||Se.run()},gt=(S?.phase===`claimed`||S?.phase===`submitting`)&&S.claim!==void 0&&xe.startsWith(S.claim.token),_t=gt&&S.claim.hint!==void 0&&xe.slice(S.claim.token.length).trim()===``?S.claim.hint:null,vt=(()=>{if(_t===null)return null;let e=S?.claim?.name??``,t=`hint.${e===`goal`&&ye?`goal.active`:e}`,n=u(t);return n===t?_t:n})(),yt=oe??u(Ue?`placeholder.parentOffline`:We?`placeholder.unavailable`:Qe?`placeholder.steerQueue`:ve?`placeholder.plan`:`placeholder.default`);return/* @__PURE__ */ (0,h.jsxs)(`div`,{className:Ib(DE.root,te===`hero`&&DE.hero),children:[Oe!==null&&/* @__PURE__ */ (0,h.jsx)(d.Toast,{text:Oe.text,icon:/* @__PURE__ */ (0,h.jsx)(d.IconWarningOutlineRegular,{}),anchor:Be.current,onDone:Me},Oe.seq),ue?.level===`info`&&/* @__PURE__ */ (0,h.jsx)(`div`,{className:DE.notice,role:`status`,children:ue.text}),/* @__PURE__ */ (0,h.jsxs)(`div`,{ref:Be,className:Ib(DE.card,Je&&DE.cardWorkspaceTrigger),"data-composer-card":!0,onClick:Je?ae:void 0,onPointerDown:Je?e=>{e.stopPropagation()}:void 0,children:[x!==void 0&&/* @__PURE__ */ (0,h.jsx)(`div`,{className:DE.overlayAnchor,children:f(`conversation.input.overlay`,{})}),se!==void 0&&/* @__PURE__ */ (0,h.jsx)(`div`,{className:DE.accessory,children:se}),ce.length===0?null:/* @__PURE__ */ (0,h.jsx)(`div`,{className:DE.annotations,"data-composer-annotations":!0,children:ce.map((e,t)=>/* @__PURE__ */ (0,h.jsx)(d.ResponseAnnotationChip,{index:t+1,annotation:e,labels:le,onRemove:()=>{n?.removeResponseAnnotation(e.id)}},e.id))}),S===void 0||x===void 0?null:/* @__PURE__ */ (0,h.jsx)(`div`,{className:DE.inlineNotices,children:f(`conversation.input.notice`,{})}),f(`conversation.input.attachments`,{attachments:we,canAcceptDrop:tt,onAddFiles:et,onRemoveAttachment:e=>{a?.(e)},uploads:Ee,onRetryFile:e=>{s?.(e)},dropLimits:Ne===void 0?void 0:{count:Ne.maxImagesPerMessage,size:hE(Ne.maxImageBytes)}}),/* @__PURE__ */ (0,h.jsx)(oE,{classNames:DE,editor:Ce,scrollRef:Ve,editable:Xe,editorDisabled:Ye,phase:S?.phase??`inert`,placeholderText:yt,ariaLabel:Je?u(`hero.chooseWorkspace`):yt,workspaceTrigger:Je,workspacePickerOpen:ie,onWorkspaceKeyDown:ct,hint:vt,showPlaceholder:xe===``&&we.length===0&&!gt}),/* @__PURE__ */ (0,h.jsx)(`div`,{ref:Le,className:DE.row,"data-composer-toolbar":!0,"data-command-menu-open":C||void 0,"data-toolbar-activity":w||void 0,children:/* @__PURE__ */ (0,h.jsxs)(`div`,{className:DE.controlScroll,"data-toolbar-scroll":!0,children:[/* @__PURE__ */ (0,h.jsxs)(`div`,{className:DE.tools,hidden:w,"data-composer-tools":!0,children:[/* @__PURE__ */ (0,h.jsx)(`div`,{className:DE.addSeat,"data-toolbar-fixed":`start`,children:/* @__PURE__ */ (0,h.jsx)(d.Tooltip,{portal:Re.phone,label:nt,side:`top`,delayMs:500,children:/* @__PURE__ */ (0,h.jsx)(`button`,{type:`button`,className:DE.add,"aria-label":nt,"aria-haspopup":`listbox`,"aria-expanded":C,disabled:Ge||qe||c===void 0,onMouseDown:ot,onClick:st,children:/* @__PURE__ */ (0,h.jsx)(d.IconPlusOutlineMedium,{size:14})})})}),/* @__PURE__ */ (0,h.jsx)(`input`,{ref:rt,type:`file`,accept:Ie?Ne?.mediaTypes.join(`,`):void 0,multiple:!0,disabled:!Fe||ge!==null,hidden:!0,onChange:it}),/* @__PURE__ */ (0,h.jsxs)(`div`,{className:DE.modes,children:[x===void 0?null:f(`conversation.input.permission`,{locked:Ge}),x===void 0?null:f(`conversation.input.plan`,{locked:Ge})]}),S===void 0||x===void 0?null:f(`conversation.input.left`,{})]}),/* @__PURE__ */ (0,h.jsxs)(`div`,{className:Ib(DE.trailing,w&&DE.trailingActive),children:[/* @__PURE__ */ (0,h.jsxs)(`div`,{className:DE.standardControls,hidden:w,children:[S===void 0||x===void 0?null:f(`conversation.input.right`,{overflowActions:Re.overflowActions}),x===void 0?null:f(`conversation.input.model`,{locked:Ke})]}),S===void 0||x===void 0?null:/* @__PURE__ */ (0,h.jsx)(`div`,{className:w?DE.activityExpanded:DE.activity,children:f(`conversation.input.activity`,{locked:Ge,onActiveChange:pe})}),/* @__PURE__ */ (0,h.jsxs)(`div`,{className:DE.submitSeat,"data-toolbar-fixed":`end`,children:[dt&&/* @__PURE__ */ (0,h.jsx)(d.Tooltip,{portal:Re.phone,label:u(`input.stop`),shortcutKeys:fe,side:`top`,delayMs:500,disabled:l===void 0,children:/* @__PURE__ */ (0,h.jsx)(`button`,{type:`button`,className:DE.primary,"aria-label":u(`input.stop`),disabled:l===void 0,onMouseDown:ot,onClick:l,children:/* @__PURE__ */ (0,h.jsx)(`svg`,{viewBox:`0 0 16 16`,width:`14`,height:`14`,"aria-hidden":!0,children:/* @__PURE__ */ (0,h.jsx)(`rect`,{x:`3`,y:`3`,width:`10`,height:`10`,rx:`3`,fill:`currentColor`})})})}),/* @__PURE__ */ (0,h.jsx)(d.Tooltip,{portal:Re.phone,label:lt?u(`input.stop`):mt,shortcutKeys:lt?fe:void 0,side:`top`,delayMs:500,disabled:ut,children:/* @__PURE__ */ (0,h.jsx)(`button`,{type:`button`,className:DE.primary,"aria-label":mt,disabled:ut,onMouseDown:ot,onClick:ht,children:lt?/* @__PURE__ */ (0,h.jsx)(`svg`,{viewBox:`0 0 16 16`,width:`14`,height:`14`,"aria-hidden":!0,children:/* @__PURE__ */ (0,h.jsx)(`rect`,{x:`3`,y:`3`,width:`10`,height:`10`,rx:`3`,fill:`currentColor`})}):/* @__PURE__ */ (0,h.jsx)(`svg`,{viewBox:`0 0 16 16`,width:`14`,height:`14`,"aria-hidden":!0,children:/* @__PURE__ */ (0,h.jsx)(`path`,{d:`M8.3125 0.980183C8.66767 1.0531 8.97902 1.20418 9.2627 1.43233C9.48724 1.61297 9.73029 1.85793 9.97949 2.10714L14.707 6.83468L13.293 8.24874L9 3.95577V15.0417H7V3.95577L2.70703 8.24874L1.29297 6.83468L6.02051 2.10714C6.26971 1.85793 6.51277 1.61297 6.7373 1.43233C6.97662 1.23986 7.28445 1.04402 7.6875 0.980183C7.8973 0.947006 8.1031 0.95516 8.3125 0.980183Z`,fill:`currentColor`})})})})]})]})]})})]}),/* @__PURE__ */ (0,h.jsxs)(`div`,{className:DE.dock,"data-composer-dock":!0,children:[te===`composer`&&S!==void 0&&x!==void 0?f(`conversation.composer.dock`,{}):null,w?null:/* @__PURE__ */ (0,h.jsx)(wE,{useProjection:b,t:u})]})]})}),AE=`@deepseek-ai/dsh-client-ui-conversation/TodoPanel.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(AE)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-conversation`,e.dataset.pluginCss=AE,e.textContent=`.ejOqlq_root{box-sizing:border-box;width:calc(100% - var(--dsh-composer-side-clearance) - var(--dsh-composer-side-clearance) - var(--dsh-composer-dock-inset) - var(--dsh-composer-dock-inset) - var(--dsh-composer-dock-inset) - var(--dsh-composer-dock-inset));max-width:calc(var(--dsh-composer-card-max-width) - var(--dsh-composer-dock-inset) - var(--dsh-composer-dock-inset) - var(--dsh-composer-dock-inset) - var(--dsh-composer-dock-inset));--dsw-elevation-stroke-color:var(--dsw-alias-border-l1);border-radius:var(--dsw-radius-lg);background:var(--dsw-specific-menu);backdrop-filter:var(--dsw-menu-backdrop-filter);box-shadow:var(--dsw-elevation-panel);--dsh-scrollbar-thumb:var(--dsw-alias-scrollbar-bg-l2);--dsh-scrollbar-thumb-hover:var(--dsw-alias-scrollbar-hover-l2);border:0;flex:none;margin:0 auto;overflow:hidden}.ejOqlq_body{flex-direction:column;gap:8px;padding:6px 12px;display:flex}.ejOqlq_header{text-align:left;cursor:pointer;background:0 0;border:none;align-items:center;gap:10px;width:100%;padding:0;display:flex}.ejOqlq_lead{color:var(--dsw-alias-label-tertiary);flex:none;place-items:center;display:grid}.ejOqlq_title{color:var(--dsw-alias-label-primary);flex:none;font-size:13px;font-weight:500;line-height:24px}.ejOqlq_progress{min-width:0;color:var(--dsw-alias-label-tertiary);text-overflow:ellipsis;white-space:nowrap;flex:auto;font-size:13px;font-weight:400;line-height:20px;overflow:hidden}.ejOqlq_chevron{color:var(--dsw-alias-label-tertiary);flex:none;place-items:center;display:grid}.ejOqlq_list{flex-direction:column;gap:8px;max-height:180px;margin:0;padding:0;list-style:none;display:flex;overflow-y:auto}.ejOqlq_item{min-width:0;color:var(--dsw-alias-label-secondary);align-items:center;gap:10px;font-size:13px;line-height:20px;display:flex}.ejOqlq_glyph{flex:none;place-items:center;width:16px;height:16px;display:grid}.ejOqlq_content{text-overflow:ellipsis;white-space:nowrap;min-width:0;overflow:hidden}`,document.head.appendChild(e)}var jE={body:`ejOqlq_body`,chevron:`ejOqlq_chevron`,content:`ejOqlq_content`,glyph:`ejOqlq_glyph`,header:`ejOqlq_header`,item:`ejOqlq_item`,lead:`ejOqlq_lead`,list:`ejOqlq_list`,progress:`ejOqlq_progress`,root:`ejOqlq_root`,title:`ejOqlq_title`};
|
|
176
|
+
n!==null&&(e.ctrlKey||e.deltaY===0||n.scrollBy({top:lE(e,n)}))},[]);return/* @__PURE__ */ (0,h.jsx)(`div`,{className:$.widthHandle,"data-side":e.side,"data-width-handle":e.side,onPointerDown:l,onPointerMove:u,onPointerUp:d,onPointerCancel:f,onLostPointerCapture:f,onWheel:p})}function dE({container:e,phase:t}){let n=(0,g.useCallback)(e=>{let t=e.parentElement??e,n=e.offsetWidth;t.style.setProperty(`--dsh-conversation-column-width`,`${n}px`);let r=sE();r===null?t.style.removeProperty(`--dsh-chat-user-width`):t.style.setProperty(`--dsh-chat-user-width`,`${cE(n,r)}px`)},[]);(0,g.useLayoutEffect)(()=>{if(e===null)return;let t=new ResizeObserver(()=>{n(e)});return t.observe(e),n(e),()=>{t.disconnect()}},[e,n]);let r=(0,g.useCallback)(()=>e===null?680:cE(e.offsetWidth,sE()),[e]),i=(0,g.useCallback)(t=>{e!==null&&(e.parentElement??e).style.setProperty(`--dsh-chat-user-width`,`${cE(e.offsetWidth,t)}px`)},[e]),a=(0,g.useCallback)(t=>{e!==null&&localStorage.setItem(oE,`${cE(e.offsetWidth,t)}`)},[e]),o=(0,g.useCallback)(()=>{e!==null&&n(e)},[e,n]);return e===null||t!==`active`?null:[`left`,`right`].map(e=>/* @__PURE__ */ (0,h.jsx)(uE,{side:e,onStart:r,onDrag:i,onCommit:a,onEnd:o},e))}let fE={widthControls:dE};function pE(e){let{sessionId:t,useSession:n,useSessions:r,useConversation:i,renderSlot:a,renderFactorySlot:o}=e,s=n(e=>e),c=i(e=>e),l=s===void 0||c===void 0?`blank`:iE(s,c),u=s?.openState,d=r(e=>t===void 0?void 0:e.byId[t]?.blank),f=s?.subagent?.address.mode===`continuable`&&s.subagent.parentAvailable===void 0,p=t!==void 0&&(l===`blank`&&u===`loading`&&d!==!0||f),m=t===void 0||l===`blank`&&(u===`open`||d===!0),g=p?`settling`:m?`hero`:`active`;return/* @__PURE__ */ (0,h.jsxs)(`div`,{className:$.root,"data-phase":g,"data-cx-region":`conversation`,children:[a(`conversation.header`,{}),a(`conversation.header.notice`,{}),o(`conversation.content`,{variant:`main`,phase:g,hero:m},{slots:fE})]})}function mE(e){return/* @__PURE__ */ (0,h.jsx)(pE,{...e})}function hE(e,t){return e===`default-workspace`?t:e}let gE=`@deepseek-ai/dsh-client-ui-conversation/HeroShell.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(gE)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-conversation`,e.dataset.pluginCss=gE,e.textContent=`.rwoUcW_root{justify-content:center;align-items:center;min-width:0;height:100%;padding:0 24px;display:flex}.rwoUcW_stack{width:100%;max-width:var(--dsh-composer-card-max-width);flex-direction:column;align-items:stretch;gap:12px;display:flex;overflow:visible}.rwoUcW_headline{color:var(--dsw-alias-label-primary);flex-wrap:wrap;justify-content:center;align-items:center;gap:12px 10px;font-size:26px;font-weight:500;line-height:32px;display:flex}.rwoUcW_titleGroup{flex-wrap:wrap;justify-content:center;align-items:center;gap:4px 7px;min-width:0;display:flex}.rwoUcW_previewBadge{border:.5px solid var(--dsw-alias-interactive-bg-hover);corner-shape:round;background:var(--dsw-alias-state-business-tertiary);color:var(--dsw-alias-label-primary-bluish);font-family:var(--ds-font-family-code);white-space:nowrap;border-radius:999px;align-self:flex-start;margin-top:2px;padding:1px 7px 0;font-size:12px;font-weight:500;line-height:18px}.rwoUcW_fishHitbox{flex:none;justify-content:center;align-items:center;display:inline-flex}.rwoUcW_fish{transform-origin:50% 60%;color:var(--dsw-alias-label-primary);display:block;overflow:visible}@keyframes rwoUcW_hero-fish-swim{0%,to{transform:none}35%{transform:rotate(-4deg)translate(-.4px,-.9px)}70%{transform:rotate(1.6deg)translate(.3px,.2px)}}@media (hover:hover) and (prefers-reduced-motion:no-preference){.rwoUcW_fishHitbox:hover .rwoUcW_fish{animation:1.6s ease-in-out infinite rwoUcW_hero-fish-swim}}.rwoUcW_body{flex-direction:column;gap:12px;min-width:0;display:flex;position:relative;overflow:visible}.rwoUcW_body>*{z-index:1;position:relative}.rwoUcW_body>.rwoUcW_workspaceRow{z-index:10;align-items:center;min-width:0;padding-left:8px;display:flex}.rwoUcW_workspace{border-radius:var(--dsw-radius-sm);max-width:min(100%,360px);min-height:28px;color:var(--dsw-alias-label-primary);cursor:pointer;background:0 0;border:none;align-items:center;gap:4px;padding:0 8px;font-size:13px;font-weight:500;line-height:20px;display:inline-flex}.rwoUcW_workspace:not(:disabled):hover,.rwoUcW_workspace[aria-expanded=true]{background:var(--dsw-alias-interactive-bg-hover)}.rwoUcW_workspace:disabled{cursor:default}.rwoUcW_folder{color:var(--dsw-alias-label-primary);flex:none}.rwoUcW_workspaceLabel{text-overflow:ellipsis;white-space:nowrap;min-width:0;overflow:hidden}.rwoUcW_chevron{color:var(--dsw-alias-label-caption);flex:none}.rwoUcW_modalInput{box-sizing:border-box;border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-lg);width:100%;height:44px;color:var(--dsw-alias-label-primary);background:0 0;outline:none;padding:7px 14px;font-size:14px;font-weight:400;line-height:22px}.rwoUcW_modalInput::placeholder{color:var(--dsw-alias-label-caption)}.rwoUcW_modalInput:disabled{color:var(--dsw-alias-label-dimmed)}.rwoUcW_modalAction{min-width:72px}.rwoUcW_modalError{color:var(--dsw-alias-state-error-primary);margin-top:8px;font-size:12px;line-height:18px}`,document.head.appendChild(e)}var _E={body:`rwoUcW_body`,chevron:`rwoUcW_chevron`,fish:`rwoUcW_fish`,fishHitbox:`rwoUcW_fishHitbox`,folder:`rwoUcW_folder`,headline:`rwoUcW_headline`,"hero-fish-swim":`rwoUcW_hero-fish-swim`,modalAction:`rwoUcW_modalAction`,modalError:`rwoUcW_modalError`,modalInput:`rwoUcW_modalInput`,previewBadge:`rwoUcW_previewBadge`,root:`rwoUcW_root`,stack:`rwoUcW_stack`,titleGroup:`rwoUcW_titleGroup`,workspace:`rwoUcW_workspace`,workspaceLabel:`rwoUcW_workspaceLabel`,workspaceRow:`rwoUcW_workspaceRow`};function vE(e){let t=Pc(e);return t===``?e:t}function yE({buttonRef:e,label:t,projectless:n=!1,menuOpen:r=!1,onClick:i,t:a}){return/* @__PURE__ */ (0,h.jsxs)(`button`,{ref:e,type:`button`,className:_E.workspace,"aria-label":a(`hero.chooseWorkspace`),"aria-haspopup":`menu`,"aria-expanded":r,onClick:i,children:[t===void 0||n?/* @__PURE__ */ (0,h.jsx)(d.IconFolderCloseRegular,{className:_E.folder,size:16}):/* @__PURE__ */ (0,h.jsx)(d.IconFolderOpenRegular,{className:_E.folder,size:16}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:_E.workspaceLabel,children:t??a(`hero.chooseWorkspace`)}),/* @__PURE__ */ (0,h.jsx)(d.IconChevronDownOutlineRegular,{className:_E.chevron,size:12})]})}function bE({hovering:e}){return/* @__PURE__ */ (0,h.jsx)(`svg`,{className:_E.fish,width:34,height:34*d.FISH_LOGO_VIEWBOX.height/d.FISH_LOGO_VIEWBOX.width,viewBox:`0 0 ${d.FISH_LOGO_VIEWBOX.width} ${d.FISH_LOGO_VIEWBOX.height}`,fill:`none`,"aria-hidden":`true`,children:/* @__PURE__ */ (0,h.jsx)(`path`,{d:d.FISH_LOGO_PATH,fill:`currentColor`,children:e&&/* @__PURE__ */ (0,h.jsx)(`animate`,{attributeName:`d`,values:`${d.FISH_LOGO_PATH};M22.403 0.567C22.145 0.477 22.068 0.718 21.939 0.85C21.895 0.893 21.86 0.947 21.824 0.997C21.515 1.421 21.13 1.721 20.591 1.77C19.829 1.867 19.221 2.244 18.712 2.958C18.535 2.227 18.116 1.839 17.516 1.626C17.203 1.506 16.887 1.379 16.663 1.064C16.508 0.839 16.462 0.581 16.383 0.329C16.332 0.176 16.283 0.02 16.121 -0.002C15.944 -0.029 15.875 0.133 15.805 0.269C15.52 0.822 15.408 1.43 15.42 2.046C15.449 3.432 16.031 4.532 17.202 5.274C17.337 5.356 17.374 5.445 17.335 5.582C17.261 5.862 17.169 6.134 17.086 6.413C17.032 6.59 16.952 6.63 16.764 6.558C16.118 6.301 15.562 5.909 15.074 5.433C14.248 4.633 13.5 3.751 12.568 3.06C12.349 2.898 12.13 2.748 11.903 2.605C10.952 1.682 12.028 0.923 12.277 0.833C12.537 0.739 12.367 0.416 11.526 0.42C10.684 0.424 9.914 0.706 8.933 1.081C8.789 1.138 8.638 1.179 8.484 1.213C7.593 1.044 6.668 1.006 5.702 1.115C3.883 1.318 2.43 2.178 1.362 3.646C0.079 5.41 -0.223 7.415 0.147 9.506C0.535 11.71 1.66 13.535 3.389 14.962C5.181 16.441 7.246 17.166 9.601 17.027C11.032 16.944 12.624 16.753 14.421 15.232C14.874 15.458 15.35 15.548 16.138 15.615C16.746 15.672 17.331 15.585 17.784 15.491C18.493 15.341 18.444 14.684 18.188 14.564C16.108 13.595 16.565 13.989 16.15 13.67C17.206 12.42 18.82 10.198 19.363 7.086C19.421 6.709 19.484 6.171 19.469 5.866C19.458 5.681 19.493 5.604 19.681 5.556C20.199 5.412 20.691 5.172 21.125 4.806C22.366 3.824 22.758 2.554 22.708 1.1C22.7 0.878 22.649 0.654 22.403 0.567ZM11.175 14.451C9.159 12.726 8.182 12.088 7.778 12.067C7.401 12.047 7.469 12.505 7.552 12.807C7.639 13.103 7.752 13.313 7.91 13.581C8.02 13.758 8.095 14.01 7.801 14.16C7.152 14.487 6.023 13.806 5.97 13.772C4.657 12.85 3.559 11.766 2.785 10.369C2.037 9.025 1.603 7.583 1.532 6.044C1.513 5.672 1.622 5.541 1.992 5.473C2.479 5.383 2.981 5.364 3.468 5.436C5.525 5.736 7.276 6.675 8.744 8.323C9.582 9.299 10.216 10.425 10.869 11.496C11.563 12.592 12.31 13.603 13.262 14.414C13.598 14.696 13.866 14.91 14.123 15.068C13.349 15.154 12.058 15.167 11.175 14.452L11.175 14.451ZM12.141 8.26C12.141 8.095 12.273 7.963 12.439 7.963C12.476 7.963 12.511 7.971 12.541 7.982C12.582 7.997 12.62 8.019 12.65 8.053C12.704 8.106 12.733 8.181 12.733 8.26C12.733 8.425 12.601 8.556 12.435 8.556C12.27 8.556 12.141 8.425 12.141 8.26ZM15.142 9.799C14.949 9.878 14.757 9.945 14.572 9.953C14.284 9.968 13.972 9.851 13.802 9.709C13.537 9.487 13.348 9.363 13.27 8.977C13.236 8.812 13.255 8.556 13.284 8.41C13.352 8.094 13.277 7.892 13.055 7.708C12.873 7.558 12.643 7.516 12.39 7.516C12.296 7.516 12.209 7.475 12.145 7.441C12.039 7.389 11.952 7.257 12.035 7.096C12.062 7.043 12.19 6.916 12.22 6.893C12.563 6.698 12.96 6.762 13.326 6.908C13.665 7.047 13.922 7.302 14.292 7.663C14.669 8.098 14.738 8.218 14.953 8.545C15.123 8.801 15.277 9.063 15.383 9.364C15.447 9.551 15.364 9.705 15.142 9.799Z;${d.FISH_LOGO_PATH};M23.271 2.216C23.039 2.071 22.91 2.287 22.755 2.388C22.703 2.42 22.656 2.464 22.61 2.505C22.214 2.848 21.771 3.054 21.225 2.956C20.412 2.784 19.68 2.919 19.005 3.435C18.92 2.663 18.493 2.157 17.808 1.798C17.446 1.621 17.08 1.449 16.83 1.111C16.656 0.872 16.611 0.612 16.524 0.354C16.469 0.198 16.414 0.039 16.223 0.009C16.017 -0.024 15.936 0.137 15.856 0.271C15.539 0.822 15.418 1.43 15.429 2.046C15.454 3.432 16.041 4.538 17.196 5.36C17.325 5.456 17.356 5.547 17.312 5.674C17.229 5.936 17.134 6.191 17.051 6.454C16.999 6.623 16.921 6.659 16.738 6.58C16.107 6.306 15.56 5.909 15.074 5.433C14.248 4.633 13.5 3.751 12.568 3.06C12.349 2.898 12.13 2.748 11.903 2.605C10.952 1.682 12.028 0.923 12.277 0.833C12.537 0.739 12.367 0.416 11.526 0.42C10.684 0.424 9.914 0.706 8.933 1.081C8.789 1.138 8.638 1.179 8.484 1.213C7.593 1.044 6.668 1.006 5.702 1.115C3.883 1.318 2.43 2.178 1.362 3.646C0.079 5.41 -0.223 7.415 0.147 9.506C0.535 11.71 1.66 13.535 3.389 14.962C5.181 16.441 7.246 17.166 9.601 17.027C11.032 16.944 12.624 16.753 14.421 15.232C14.874 15.458 15.35 15.548 16.138 15.615C16.746 15.672 17.331 15.585 17.784 15.491C18.493 15.341 18.444 14.684 18.188 14.564C16.108 13.595 16.565 13.989 16.15 13.67C17.206 12.42 18.82 10.198 19.278 7.246C19.318 6.948 19.375 6.534 19.371 6.293C19.371 6.145 19.411 6.092 19.597 6.098C20.113 6.109 20.619 6.051 21.096 5.891C22.503 5.375 23.169 4.232 23.448 2.804C23.49 2.586 23.491 2.356 23.271 2.216ZM11.175 14.49C9.159 13.005 8.182 12.567 7.778 12.621C7.401 12.673 7.469 13.087 7.552 13.354C7.639 13.619 7.752 13.797 7.91 14.024C8.02 14.175 8.095 14.406 7.801 14.609C7.152 15.063 6.023 14.63 5.97 14.609C4.657 13.941 3.559 12.965 2.785 11.569C2.037 10.225 1.603 8.783 1.532 7.244C1.513 6.872 1.622 6.741 1.992 6.673C2.479 6.583 2.981 6.564 3.468 6.636C5.525 6.936 7.276 7.843 8.744 9.163C9.582 9.888 10.216 10.783 10.869 11.679C11.563 12.659 12.31 13.617 13.262 14.415C13.598 14.696 13.866 14.91 14.123 15.068C13.349 15.155 12.058 15.177 11.175 14.491L11.175 14.49ZM12.141 8.26C12.141 8.095 12.273 7.963 12.439 7.963C12.476 7.963 12.511 7.971 12.541 7.982C12.582 7.997 12.62 8.019 12.65 8.053C12.704 8.106 12.733 8.181 12.733 8.26C12.733 8.425 12.601 8.556 12.435 8.556C12.27 8.556 12.141 8.425 12.141 8.26ZM15.142 9.799C14.949 9.878 14.757 9.945 14.572 9.953C14.284 9.968 13.972 9.851 13.802 9.709C13.537 9.487 13.348 9.363 13.27 8.977C13.236 8.812 13.255 8.556 13.284 8.41C13.352 8.094 13.277 7.892 13.055 7.708C12.873 7.558 12.643 7.516 12.39 7.516C12.296 7.516 12.209 7.475 12.145 7.441C12.039 7.389 11.952 7.257 12.035 7.096C12.062 7.043 12.19 6.916 12.22 6.893C12.563 6.698 12.96 6.762 13.326 6.908C13.665 7.047 13.922 7.302 14.292 7.663C14.669 8.098 14.738 8.218 14.953 8.545C15.123 8.801 15.277 9.063 15.383 9.364C15.447 9.551 15.364 9.705 15.142 9.799Z;${d.FISH_LOGO_PATH}`,keyTimes:`0;0.35;0.55;0.75;1`,calcMode:`spline`,keySplines:`0.45 0 0.55 1;0.45 0 0.55 1;0.45 0 0.55 1;0.45 0 0.55 1`,dur:`1.6s`,repeatCount:`indefinite`})})})}function xE({t:e,renderSlot:t,children:n}){let[r,i]=(0,g.useState)(!1);return/* @__PURE__ */ (0,h.jsxs)(`div`,{className:_E.root,children:[/* @__PURE__ */ (0,h.jsxs)(`div`,{className:_E.stack,children:[/* @__PURE__ */ (0,h.jsxs)(`div`,{className:_E.headline,children:[/* @__PURE__ */ (0,h.jsx)(`span`,{className:_E.fishHitbox,onMouseEnter:()=>{window.matchMedia(`(hover: hover) and (prefers-reduced-motion: no-preference)`).matches&&i(!0)},onMouseLeave:()=>{i(!1)},children:t(`conversation.hero.brand.mark`,{size:34,className:_E.fish},{fallback:/* @__PURE__ */ (0,h.jsx)(bE,{hovering:r})})}),/* @__PURE__ */ (0,h.jsxs)(`span`,{className:_E.titleGroup,children:[/* @__PURE__ */ (0,h.jsx)(`span`,{children:e(`hero.headline`)}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:_E.previewBadge,children:e(`hero.preview`)})]})]}),/* @__PURE__ */ (0,h.jsx)(`div`,{className:_E.body})]}),n]})}let SE=`@deepseek-ai/dsh-client-ui-conversation/ThreadReferenceDropTarget.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(SE)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-conversation`,e.dataset.pluginCss=SE,e.textContent=`.yYBwyG_overlay{z-index:30;pointer-events:none;background:color-mix(in srgb, var(--dsw-alias-state-business-tertiary) 88%, transparent);place-items:center;display:grid;position:absolute;inset:0}.yYBwyG_invitation{flex-direction:column;align-items:center;gap:8px;max-width:calc(100% - 40px);display:flex}.yYBwyG_hint{border:1px solid color-mix(in srgb, var(--dsw-alias-state-business-primary) 15%, transparent);background:var(--dsw-alias-state-business-tertiary);color:var(--dsw-alias-label-primary);border-radius:10px;padding:8px 16px;font-size:16px;line-height:24px;box-shadow:0 1px 4px #00000014}.yYBwyG_preview{box-sizing:border-box;border:1px solid var(--dsw-alias-border-l3);background:var(--dsw-alias-bg-base);max-width:min(440px,100%);color:var(--dsw-alias-label-primary);border-radius:12px;align-items:center;gap:10px;padding:10px 14px;font-size:14px;line-height:20px;display:flex;box-shadow:0 4px 14px #00000014}.yYBwyG_preview svg{flex:none}.yYBwyG_title{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}`,document.head.appendChild(e)}var CE={hint:`yYBwyG_hint`,invitation:`yYBwyG_invitation`,overlay:`yYBwyG_overlay`,preview:`yYBwyG_preview`,title:`yYBwyG_title`};function wE({container:e,editor:t,useSessions:n,t:r}){let i=n(e=>e.byId),a=(0,g.useRef)(i);a.current=i;let[o,s]=(0,g.useState)(null);return(0,g.useEffect)(()=>{if(e===null||t===void 0)return;let n,r=()=>{n=void 0,s(null)},i=()=>t.isEditable()&&t.getRootElement()!==null,o=e=>{let t=e.dataTransfer;return t?.types.includes(`application/x-codexhost-thread-reference`)&&!t.types.includes(`Files`)?t:null},c=e=>{let t=e===void 0?void 0:Mb(jb(e)),n=t===void 0?void 0:a.current[t];return n!==void 0&&Ab(n)!==void 0},l=t=>!(t instanceof Node)||!e.contains(t)?!1:(t instanceof Element?t:t.parentElement)?.closest(`[data-conversation-content]`)===e,u=e=>{r();let t=o(e),i=t===null?void 0:Pb(t.getData(kb));c(i)&&(n=i)},d=e=>{let r=o(e);r===null||!l(e.target)?s(null):!i()||!c(n)?(e.preventDefault(),e.stopPropagation(),r.dropEffect=`none`,s(null)):t.dispatchCommand(kd,e)&&s(n??null)},f=t=>{if(t.relatedTarget instanceof Node&&e.contains(t.relatedTarget))return;let n=e.getBoundingClientRect();(t.relatedTarget!==null||t.target===e||t.clientX<=n.left||t.clientX>=n.right||t.clientY<=n.top||t.clientY>=n.bottom)&&s(null)},p=e=>{let a=o(e);if(a!==null&&l(e.target)){let r=Pb(a.getData(kb));i()&&c(r)&&r?.threadId===n?.threadId&&r?.hostId===n?.hostId?t.dispatchCommand(Dd,e):(e.preventDefault(),e.stopPropagation(),a.dropEffect=`none`)}r()},m=e=>{e.key===`Escape`&&r()},h=t.registerEditableListener(e=>{e||r()});return document.addEventListener(`dragstart`,u),document.addEventListener(`dragenter`,d,!0),document.addEventListener(`dragover`,d,!0),document.addEventListener(`dragleave`,f,!0),document.addEventListener(`drop`,p,!0),window.addEventListener(`dragend`,r),window.addEventListener(`blur`,r),window.addEventListener(`keydown`,m,!0),()=>{h(),document.removeEventListener(`dragstart`,u),document.removeEventListener(`dragenter`,d,!0),document.removeEventListener(`dragover`,d,!0),document.removeEventListener(`dragleave`,f,!0),document.removeEventListener(`drop`,p,!0),window.removeEventListener(`dragend`,r),window.removeEventListener(`blur`,r),window.removeEventListener(`keydown`,m,!0)}},[e,t]),o===null?null:/* @__PURE__ */ (0,h.jsx)(`div`,{className:CE.overlay,"data-thread-reference-drop":!0,role:`status`,"aria-live":`polite`,children:/* @__PURE__ */ (0,h.jsxs)(`div`,{className:CE.invitation,children:[/* @__PURE__ */ (0,h.jsx)(`div`,{className:CE.hint,children:r(`reference.dropTitle`)}),/* @__PURE__ */ (0,h.jsxs)(`div`,{className:CE.preview,"data-thread-reference-preview":!0,children:[/* @__PURE__ */ (0,h.jsx)(d.ReferenceIconRegular,{kind:`session`,size:20}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:CE.title,children:o.title})]})]})})}function TE({renderSlot:e}){return e(`conversation.session`,{})}function EE(){return null}function DE(e){let{sessionId:t,phase:n,hero:r,useSession:i,useSessions:a,useSessionStatus:o,useWorkspaces:s,useInput:c,useComposerBlock:l,renderSlot:u,renderSlotChain:d,selectWorkspace:f,referenceEditor:p,t:m,useFactorySlot:_}=e,v=i(e=>e),y=_(`views`,TE),ee=_(`widthControls`,EE),[b,te]=(0,g.useState)(null),x=o(e=>t===void 0?void 0:e.get(t)?.pendingInteraction),ne=c(e=>e),re=a(e=>t===void 0?void 0:e.byId[t]?.cwd),ie=s(e=>e),ae=l(e=>e),[oe,se]=(0,g.useState)(!1),[ce,S]=(0,g.useState)(),le=(0,g.useRef)(null),ue=(0,g.useRef)(null),de=(0,g.useCallback)(e=>{ue.current?.disconnect(),ue.current=null;let t=e?.parentElement??null;e!==null&&t!==null&&(ue.current=new ResizeObserver(()=>{t.style.setProperty(`--dsh-composer-height`,`${e.offsetHeight}px`),t.style.setProperty(`--dsh-conversation-viewport-height`,`${t.clientHeight}px`)}),ue.current.observe(e),ue.current.observe(t))},[]),fe=t===void 0?void 0:ie.items.find(e=>e.sessionIds.includes(t)),C=ie.items.find(e=>e.workspaceId===ce);(0,g.useEffect)(()=>{ce!==void 0&&((ce===null?fe===void 0:fe?.workspaceId===ce)||ce!==null&&ie.phase===`ready`&&C===void 0)&&S(void 0)},[ce,fe?.workspaceId,ie.phase,C]);let w=v===void 0||ne===void 0?void 0:{session:v,input:ne},pe=(ce===null?void 0:C?.title)??(ce===null||t===void 0?void 0:fe?.title??(ie.phase===`ready`||re===void 0||re===``?void 0:vE(re))),me=pe===void 0?void 0:hE(pe,m(`workspace.defaultName`)),he=/* @__PURE__ */ (0,h.jsxs)(`div`,{className:$.heroWorkspaceRow,children:[/* @__PURE__ */ (0,h.jsx)(yE,{buttonRef:le,label:me??(ie.canStartProjectless?m(`hero.noWorkspace`):void 0),projectless:ie.canStartProjectless===!0&&me===void 0,menuOpen:oe,onClick:()=>{se(e=>!e)},t:m}),u(`conversation.hero.workspace`,{open:oe,anchorRef:le,selectedId:ce===null?void 0:ce??fe?.workspaceId,onPick:e=>{se(!1),S(e),f(e).catch(()=>{S(t=>t===e?void 0:t)})},onClose:()=>{se(!1)}}),u(`conversation.hero.agentPreset`,{})]}),ge=ie.phase===`ready`&&!ie.canStartProjectless&&me===void 0,_e=(t===void 0||v?.openState!==`open`)&&!ge,ve=t===void 0||v?.openState!==`open`||r&&ge,ye=u(`conversation.composer.bar`,{variant:r?`hero`:`composer`,...ve?{disabled:!0,placeholder:m(_e?`placeholder.preparing`:`placeholder.workspace`),..._e?{}:{workspacePickerOpen:oe,onRequestWorkspace:()=>{se(!0)}}}:!ve&&ae!==void 0?{blocked:ae,placeholder:ae.reason}:r?{placeholder:m(`placeholder.hero`)}:{}}),be=/* @__PURE__ */ (0,h.jsxs)(`div`,{className:Ib($.composerStack,r&&$.composerHero),children:[r&&/* @__PURE__ */ (0,h.jsx)(xE,{t:m,renderSlot:u}),r&&he,w!==void 0&&u(`conversation.input.dock`,w),ye]}),xe=d(`conversation.composer`,{sessionId:t,session:v,pendingInteraction:v?.openState===`open`?x:void 0},{fallback:be,fallbackOnly:t===void 0,overlay:!0}),Se=/* @__PURE__ */ (0,h.jsx)(`div`,{ref:de,className:$.composerSeat,"data-composer-seat":``,"data-conversation-region":`composer`,children:xe});return/* @__PURE__ */ (0,h.jsxs)(`div`,{ref:te,className:Ib($.body,e.variant===`embedded`&&$.embeddedBody),"data-conversation-content":``,"data-conversation-session":t,"data-conversation-region":`chat`,"data-content-phase":n,children:[/* @__PURE__ */ (0,h.jsxs)(`div`,{className:$.scrollBody,"data-conversation-scroll":``,children:[t===void 0?null:/* @__PURE__ */ (0,h.jsx)(y,{}),Se]}),/* @__PURE__ */ (0,h.jsx)(ee,{container:b,phase:n}),/* @__PURE__ */ (0,h.jsx)(wE,{container:b,editor:p,useSessions:a,t:m},t)]})}function OE({renderSlot:e}){return e(`main.conversation`,{})}function kE(){let e=()=>{let e=document.querySelector(`[data-conversation-navigation-focus]`),t=e?.querySelector(`[data-navigation-focus-return]`);(t!=null&&t.getClientRects().length>0?t:e)?.focus({preventScroll:!0})};e(),requestAnimationFrame(()=>{document.activeElement===document.body&&e()})}function AE({sessionId:e,useSession:t,useConversation:n,renderSlot:r}){let i=t(e=>e),a=n(e=>e),o=i===void 0||a===void 0||i.blank&&iE(i,a)===`blank`;return/* @__PURE__ */ (0,h.jsxs)(`header`,{className:Ib($.header,o&&$.headerBlank,e===void 0&&$.headerSessionless),"data-window-drag":!0,"data-conversation-navigation-focus":!0,"data-cx-region":`topbar`,tabIndex:-1,children:[/* @__PURE__ */ (0,h.jsx)(`div`,{className:$.headerLeading,"data-conversation-header-leading":``,children:r(`conversation.header.leading`,{})}),e===void 0?/* @__PURE__ */ (0,h.jsxs)(`div`,{className:$.titleRow,children:[r(`conversation.header.navigation`,{restoreNavigationFocus:kE}),/* @__PURE__ */ (0,h.jsx)(`div`,{className:$.headerCorner,"data-conversation-header-corner":``,children:/* @__PURE__ */ (0,h.jsx)(`span`,{className:$.phoneTrailingAction,children:r(`conversation.header.trailing`,{})})})]}):r(`conversation.session.header`,{hideChrome:o,titleNavigation:r(`conversation.header.navigation`,{restoreNavigationFocus:kE}),trailingAction:r(`conversation.header.trailing`,{})}),r(`conversation.header.shortcuts`,{restoreNavigationFocus:kE})]})}function jE(e,t){return(t===null?void 0:e.find(e=>e.id===t))??e.find(e=>e.id===`chat`)}function ME({view:e,useSession:t,useConversation:n,useConversationViews:r,inputActions:i,useStore:a,actions:o,renderSlot:s,bindDraftPersistence:c,onRevealResponseAnnotation:l,openView:u,useInspectCall:d}){let f=r(e=>e),p=d(e=>e),m=jE(f,a(e=>e.view)),_=t(e=>e),v=n(e=>e),y=a(e=>e.viewRequest??null);if((0,g.useEffect)(()=>{let e=c(o.setDraft);return i.persistDraft(),()=>{e()}},[i]),(0,g.useEffect)(()=>l(e=>u(`chat`,e)),[l,u]),_.blank&&iE(_,v)===`blank`)return null;let ee=e??m?.id;return/* @__PURE__ */ (0,h.jsx)(`div`,{className:$.viewArea,children:ee!==void 0&&s(`conversation.view`,{inspectCall:p,viewRequest:y,openView:u,completeViewRequest:o.completeViewRequest},{only:ee})})}function NE(e,t){let n=[],r=/* @__PURE__ */ new Set,i=t;for(;i!==void 0&&!r.has(i);){r.add(i);let t=e.byId[i];if(t===void 0||(n.unshift({id:t.id,displayTitle:t.displayTitle,subagent:t.origin===`subagent`}),t.origin!==`subagent`))break;i=t.parentId}return n}function PE(e,t){return e.length===t.length&&e.every((e,n)=>{let r=t.at(n);return r!==void 0&&e.id===r.id&&e.displayTitle===r.displayTitle})}function FE({sessionId:e,hideChrome:t,titleNavigation:n,trailingAction:r,useSessions:i,useConversationViews:a,useStore:o,renderSlot:s,open:c,selectView:l,t:u}){let d=a(e=>e),f=jE(d,o(e=>e.view)),p=i(t=>NE(t,e),PE),m=!t&&d.length>1;return/* @__PURE__ */ (0,h.jsxs)(h.Fragment,{children:[/* @__PURE__ */ (0,h.jsxs)(`div`,{className:$.titleRow,children:[!t&&/* @__PURE__ */ (0,h.jsxs)(h.Fragment,{children:[/* @__PURE__ */ (0,h.jsxs)(`div`,{className:$.titleCluster,children:[/* @__PURE__ */ (0,h.jsxs)(`div`,{className:$.titleCenter,onClick:e=>{if(e.target?.closest(`button, a, input, [role='button']`))return;let t=e.currentTarget.querySelector(`[data-navigation-focus-return]`);t!==null&&t.getClientRects().length>0&&t.click()},children:[/* @__PURE__ */ (0,h.jsxs)(`nav`,{className:$.crumbs,"aria-label":u(`session.hierarchy`),children:[p.map((e,t)=>{let n=t===p.length-1,r=n?/* @__PURE__ */ (0,h.jsx)(`span`,{className:Ib($.crumb,e.subagent&&$.crumbSubagent,$.crumbCurrent),children:e.displayTitle}):/* @__PURE__ */ (0,h.jsx)(`button`,{type:`button`,className:Ib($.crumb,e.subagent&&$.crumbSubagent),onClick:()=>{c(e.id)},children:e.displayTitle}),i=n||e.subagent,a={lineageSessionId:e.id,displayTitle:e.displayTitle,...n?{}:{openTitle:()=>{c(e.id)}}};return/* @__PURE__ */ (0,h.jsxs)(`span`,{className:$.crumbSeg,children:[t>0&&/* @__PURE__ */ (0,h.jsx)(`span`,{className:$.crumbSep,children:`/`}),i?e.subagent?s(`conversation.session.header.lineage`,a,{fallback:r}):/* @__PURE__ */ (0,h.jsxs)(h.Fragment,{children:[r,s(`conversation.session.header.lineage`,a,{fallback:null})]}):r]},e.id)}),p.length===0&&/* @__PURE__ */ (0,h.jsx)(`span`,{className:$.crumbCurrent,children:e})]}),n]}),/* @__PURE__ */ (0,h.jsx)(`div`,{className:$.headerActions,children:s(`conversation.session.header.actions`,{})})]}),/* @__PURE__ */ (0,h.jsx)(`div`,{className:$.headerUtilities,children:s(`conversation.session.header.utilities`,{})})]}),t&&/* @__PURE__ */ (0,h.jsx)(`div`,{className:$.titleCenter,children:n}),/* @__PURE__ */ (0,h.jsxs)(`div`,{className:$.headerCorner,"data-conversation-header-corner":``,children:[/* @__PURE__ */ (0,h.jsx)(`span`,{className:$.phoneTrailingAction,children:r}),s(`conversation.session.header.corner`,{})]})]}),m&&/* @__PURE__ */ (0,h.jsx)(`div`,{className:$.tabs,role:`tablist`,"data-conversation-tabs":``,children:d.map(e=>/* @__PURE__ */ (0,h.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":e.id===f?.id,className:Ib($.tab,e.id===f?.id&&$.tabActive),onClick:()=>{l(e.id)},children:e.label},e.id))})]})}function IE(e){return/* @__PURE__ */ (0,h.jsx)(ME,{...e})}function LE({editor:e,editable:t,...n}){let r=(0,g.useRef)(null);return(0,g.useLayoutEffect)(()=>{let t=r.current;if(t!==null&&((0,d.shouldAutoFocusTextInput)()||(t.ownerDocument.activeElement===t&&t.blur(),e?.setEditable(!1)),e!==null))return e.setRootElement(t),()=>{e.setRootElement(null)}},[e]),(0,g.useLayoutEffect)(()=>{e!==null&&e.setEditable(t)},[e,t]),/* @__PURE__ */ (0,h.jsx)(`div`,{ref:r,contentEditable:e!==null&&t,suppressContentEditableWarning:!0,role:`textbox`,"aria-multiline":`true`,"data-composer-input":!0,...n})}function RE({editor:e}){let[t,n]=g.useState(()=>e===null?{}:e.getDecorators());return g.useLayoutEffect(()=>{if(e!==null)return n(e.getDecorators()),e.registerDecoratorListener(e=>{n(e)})},[e]),e===null?null:/* @__PURE__ */ (0,h.jsx)(h.Fragment,{children:Object.entries(t).map(([t,n])=>{let r=e.getElementByKey(t);return r===null?null:(0,_.createPortal)(n,r,t)})})}function zE({classNames:e,editor:t,scrollRef:n,editable:r,editorDisabled:i,phase:a,placeholderText:o,ariaLabel:s,workspaceTrigger:c,workspacePickerOpen:l,onWorkspaceKeyDown:u,hint:d,showPlaceholder:f}){return/* @__PURE__ */ (0,h.jsx)(`div`,{ref:n,className:e.scroll,"data-input-scroll":!0,children:/* @__PURE__ */ (0,h.jsxs)(`div`,{className:e.grow,children:[/* @__PURE__ */ (0,h.jsx)(LE,{editor:c?null:t,editable:r,className:Ib(e.input,i&&e.inputDisabled),"data-phase":a,"aria-disabled":i||void 0,"data-placeholder":o,"aria-label":s,"aria-haspopup":c?`menu`:void 0,"aria-expanded":c?l:void 0,tabIndex:c?0:void 0,onKeyDown:c?u:void 0,style:d===null?void 0:{"--dsh-composer-hint":JSON.stringify(d)}}),f&&/* @__PURE__ */ (0,h.jsx)(`div`,{"aria-hidden":!0,className:e.placeholder,"data-composer-placeholder":!0,children:o}),/* @__PURE__ */ (0,h.jsx)(RE,{editor:c?null:t})]})})}function BE(e,t){return e.isComposing||e.keyCode===229||t()}function VE(e,t){let n=!1,r=0,i=null,a=()=>{i?.toggleAttribute(`data-composer-composing`,n||e.isComposing())},o=()=>{n=!0,a()},s=()=>{n=!1,r=Date.now()+10,e.update(()=>{},{onUpdate:a})},c=()=>n||Date.now()<r,l=e=>n=>{let r=n!==null&&BE(n,c);return t.arbitrate(e,r)!==`pass`&&(n?.preventDefault(),!0)};return Mv(e.registerRootListener((e,t)=>{t?.removeEventListener(`compositionstart`,o),t?.removeEventListener(`compositionend`,s),t?.removeAttribute(`data-composer-composing`),n=!1,r=0,i=e,e?.addEventListener(`compositionstart`,o),e?.addEventListener(`compositionend`,s),a()}),e.registerUpdateListener(a),e.registerCommand(yd,l(`up`),4),e.registerCommand(bd,l(`down`),4),e.registerCommand(Ed,e=>l(e.shiftKey?`tabBack`:`tab`)(e),4),e.registerCommand(wd,e=>(t.dismissPopup(),t.arbitrate(`escape`,BE(e,c))===`consumed`&&(e.preventDefault(),!0)),4),e.registerCommand(Sd,e=>BE(e,c)?!1:t.space()?(e.preventDefault(),!0):!1,4),e.registerCommand(xd,e=>e!==null&&(e.altKey||e.getModifierState(`AltGraph`)||e.ctrlKey&&e.metaKey||e.shiftKey&&(e.ctrlKey||e.metaKey))?!0:e?.shiftKey===!0?!1:e!==null&&BE(e,c)?!0:t.arbitrate(`enter`,!1)===`pass`?(e?.preventDefault(),e?.repeat===!0||!t.canSubmit()||t.submit(e?.ctrlKey===!0||e?.metaKey===!0),!0):(e?.preventDefault(),!0),4),e.registerCommand(sd,e=>{let n=e.clipboardData??null;if(n===null)return!1;let r=[],i=/* @__PURE__ */ new Set;for(let e of n.items){if(e.kind!==`file`)continue;let t=e.getAsFile();t!==null&&(r.push(t),typeof e.webkitGetAsEntry==`function`&&e.webkitGetAsEntry()?.isDirectory===!0&&i.add(t))}r.length>0&&t.intakeFiles(r,i.size===0?void 0:i);let a=n.getData(`text/plain`);return a===``?r.length!==0&&(e.preventDefault(),!0):(e.preventDefault(),t.pasteText(a),!0)},4))}function HE(e){let t=e.current;if(t===null||t.scrollHeight<=t.clientHeight)return;let n=window.getSelection();if(n===null||n.rangeCount===0)return;let r=n.getRangeAt(0).getBoundingClientRect();if(r.height===0&&r.width===0){let e=n.anchorNode,t=e instanceof HTMLElement?e:e?.parentElement;if(t==null)return;r=t.getBoundingClientRect()}let i=t.getBoundingClientRect();r.bottom>i.bottom?t.scrollTop+=r.bottom-i.bottom:r.top<i.top&&(t.scrollTop-=i.top-r.top)}function UE(e,t){e.getRootElement()?.focus({preventScroll:!0}),e.focus(()=>{t()})}function WE(e){let t=e.current;if(t===null)return;let n=e=>{let n=t.closest(`[data-conversation-scroll]`);if(!(n instanceof HTMLElement)||e.deltaY===0)return;let r=t.scrollTop<=0,i=t.scrollTop+t.clientHeight>=t.scrollHeight-1;e.deltaY<0&&!r||e.deltaY>0&&!i||(e.preventDefault(),n.scrollTop+=e.deltaY)};return t.addEventListener(`wheel`,n,{passive:!1}),()=>{t.removeEventListener(`wheel`,n)}}function GE(e,t,n){return e.bindFilePicker({available:()=>t.current.canAcceptDrop&&n.current!==null,open:()=>{n.current?.click()}})}function KE(e,t,n){return VE(e,{arbitrate:(e,r)=>e===`enter`&&n.current.primaryAction!==void 0?`pass`:t.arbitrate(e,r),space:()=>n.current.machineBusy||n.current.locked?!1:t.space(),dismissPopup:()=>{t.dismissPopup()},canSubmit:()=>!n.current.locked&&!n.current.machineBusy&&n.current.primaryAction?.disabled!==!0,submit:e=>{let r=n.current;r.uploadsFailed?r.showToast(r.t(`file.retryOrRemove`)):r.primaryAction===void 0?e&&r.canSteerQueue?t.steerQueue():t.submit(VT(r.busyEnter,r.running,e?`accelerated`:`enter`,r.steeringAvailable),`enter`):r.primaryAction.run()},intakeFiles:(e,t)=>{n.current.intakeFiles(e,t)},pasteText:e=>{n.current.machineBusy||n.current.locked||t.paste(e)}})}function qE(e,t){e.preventDefault(),!(0,d.isMobileDevice)()&&t?.getRootElement()?.focus({preventScroll:!0})}function JE(e){let t=e/1048576;return`${Number.isInteger(t)?String(t):t.toFixed(1)}MB`}function YE(e,t,n){switch(t){case`MODEL_DOES_NOT_SUPPORT_IMAGES`:return e(`image.modelUnsupported`);case`FILE_NOT_STAGED`:return e(`file.notStaged`);case`FILE_UNAVAILABLE`:return e(`file.unavailable`);case`IMAGE_TOO_MANY_PIXELS`:return e(`image.tooManyPixels`);case`INVALID_IMAGE`:case`IMAGE_TYPE_MISMATCH`:return e(`image.unsupportedType`);case`TOO_MANY_IMAGES`:if(n!==void 0)return e(`image.tooMany`,{count:n.maxImagesPerMessage});break;case`IMAGE_TOO_LARGE`:if(n!==void 0)return e(`image.fileTooLarge`,{size:JE(n.maxImageBytes)});break;case`IMAGES_TOO_LARGE`:if(n!==void 0)return e(`image.totalTooLarge`,{size:JE(n.maxMessageImageBytes)})}return e(`image.sendFailed`,{reason:t})}function XE(e){let t=e?.projectedTokens??e?.pressureTokens;return t===void 0||e?.contextWindow===void 0?null:{percent:Math.min(100,Math.round(t/e.contextWindow*100)),usedTokens:t,contextWindow:e.contextWindow}}let ZE=`@deepseek-ai/dsh-client-ui-conversation/ContextMeter.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(ZE)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-conversation`,e.dataset.pluginCss=ZE,e.textContent=`.MXybya_root{flex:none;display:inline-flex}.MXybya_trigger{border-radius:var(--dsw-radius-sm);color:var(--dsw-alias-label-tertiary);font-family:inherit;font-size:var(--dsh-content-font-size-secondary,13px);font-variant-numeric:tabular-nums;line-height:calc(20px + var(--dsh-content-font-delta-secondary,0px));white-space:nowrap;cursor:pointer;background:0 0;border:none;flex:none;align-items:center;gap:6px;padding:1px 8px;display:inline-flex}.MXybya_trigger:hover,.MXybya_trigger[aria-expanded=true]{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-secondary)}.MXybya_track{fill:none;stroke:var(--dsw-alias-border-l3);stroke-width:2px}.MXybya_fill{fill:none;stroke:var(--dsw-alias-label-tertiary);stroke-width:2px;stroke-linecap:round}.MXybya_panel{z-index:1100;box-sizing:border-box;border-radius:var(--dsw-radius-lg);background:var(--dsw-specific-menu);width:min(264px,100vw - 24px);backdrop-filter:var(--dsw-menu-backdrop-filter);--dsw-elevation-stroke-color:var(--dsw-alias-border-l1);box-shadow:var(--dsw-elevation-prominent);color:var(--dsw-alias-label-secondary);cursor:default;border:0;padding:12px;font-size:12px;line-height:20px;position:fixed}.MXybya_header{align-items:center;gap:6px;display:flex}.MXybya_figures{font-variant-numeric:tabular-nums;color:var(--dsw-alias-label-primary);margin-left:auto;font-weight:500}.MXybya_percent{color:var(--dsw-alias-label-primary);font-weight:500}.MXybya_headline{color:var(--dsw-alias-label-tertiary)}.MXybya_headline:empty{display:none}.MXybya_bar{corner-shape:round;background:var(--dsw-alias-interactive-bg-hover);border-radius:999px;gap:1px;height:4px;margin:10px 0 12px;display:flex;overflow:hidden}.MXybya_segment{background:var(--meter-tint,var(--dsw-alias-label-tertiary));border-radius:1px;flex:none;min-width:2px;height:100%}.MXybya_swatch{background:var(--meter-tint);vertical-align:baseline;border-radius:2px;width:8px;height:8px;margin-right:6px;display:inline-block}.MXybya_colorSystem{--meter-tint:var(--dsw-static-neutral-bluish-400)}.MXybya_colorTools{--meter-tint:#a78bfa}.MXybya_colorMessages{--meter-tint:var(--dsw-static-blue-450)}.MXybya_rows{margin:6px 0 0}.MXybya_row{justify-content:space-between;align-items:center;gap:12px;padding:2px 0;display:flex}.MXybya_row dt{color:var(--dsw-alias-label-secondary)}.MXybya_row dd{font-variant-numeric:tabular-nums;color:var(--dsw-alias-label-primary);margin:0}`,document.head.appendChild(e)}var QE={bar:`MXybya_bar`,colorMessages:`MXybya_colorMessages`,colorSystem:`MXybya_colorSystem`,colorTools:`MXybya_colorTools`,figures:`MXybya_figures`,fill:`MXybya_fill`,header:`MXybya_header`,headline:`MXybya_headline`,panel:`MXybya_panel`,percent:`MXybya_percent`,root:`MXybya_root`,row:`MXybya_row`,rows:`MXybya_rows`,segment:`MXybya_segment`,swatch:`MXybya_swatch`,track:`MXybya_track`,trigger:`MXybya_trigger`};let $E=5.5,eD=2*Math.PI*$E,tD=[{key:`systemTokens`,label:`context.system`,color:QE.colorSystem},{key:`toolsTokens`,label:`context.tools`,color:QE.colorTools},{key:`messageTokens`,label:`context.messages`,color:QE.colorMessages}];function nD(e,t){let n=e=>String(e>=100?Math.round(e):Math.round(e*10)/10);return e<1e3?String(e):e<1e6?t(`number.thousand`,{value:n(e/1e3)}):t(`number.million`,{value:n(e/1e6)})}function rD({useProjection:e,t}){let n=e(`contextPressure`),r=e(`contextBreakdown`),[i,a]=(0,g.useState)(!1),o=(0,g.useRef)(null),s=(0,g.useRef)(null),c=XE(n),l=c!==null,u=(0,d.useAnchoredPosition)({open:i&&l,anchorRef:o,panelRef:s,side:`top`,gap:8,margin:12});if((0,d.useDismissOnOutsidePointer)(o,i&&l,a,s),(0,g.useEffect)(()=>{!l&&i&&a(!1)},[l,i]),(0,g.useEffect)(()=>{if(!i||!l)return;let e=e=>{e.key===`Escape`&&a(!1)};return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e)}},[l,i]),c===null)return null;let f=c.percent,p=`${f}%`,[m=``,v=``]=t(`context.aria`,{percent:`\0`}).split(`\0`).map(e=>e.trim()),y=r===void 0?0:r.systemTokens+r.toolsTokens+r.messageTokens,ee=(r===void 0||y===0?[{key:`total`,color:void 0,width:f}]:tD.map(e=>({key:e.key,color:e.color,width:f*r[e.key]/y}))).filter(e=>e.width>0);return/* @__PURE__ */ (0,h.jsxs)(`span`,{ref:o,className:QE.root,children:[/* @__PURE__ */ (0,h.jsx)(d.Tooltip,{label:t(`context.aria`,{percent:p}),side:`top`,delayMs:200,disabled:i,children:/* @__PURE__ */ (0,h.jsxs)(`button`,{type:`button`,className:QE.trigger,"aria-label":t(`context.aria`,{percent:p}),"aria-haspopup":`dialog`,"aria-expanded":i,onClick:()=>{a(!i)},children:[/* @__PURE__ */ (0,h.jsxs)(`svg`,{viewBox:`0 0 14 14`,width:`14`,height:`14`,"aria-hidden":!0,children:[/* @__PURE__ */ (0,h.jsx)(`circle`,{className:QE.track,cx:`7`,cy:`7`,r:$E}),/* @__PURE__ */ (0,h.jsx)(`circle`,{className:QE.fill,cx:`7`,cy:`7`,r:$E,strokeDasharray:`${eD*f/100} ${eD}`,transform:`rotate(-90 7 7)`})]}),/* @__PURE__ */ (0,h.jsx)(`span`,{children:p})]})}),i&&(0,_.createPortal)(/* @__PURE__ */ (0,h.jsxs)(`div`,{ref:s,className:QE.panel,style:u??{visibility:`hidden`,left:0,top:0},role:`dialog`,"aria-label":t(`context.used`),children:[/* @__PURE__ */ (0,h.jsxs)(`div`,{className:QE.header,children:[/* @__PURE__ */ (0,h.jsx)(`span`,{className:QE.headline,children:m}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:QE.percent,children:p}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:QE.headline,children:v}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:QE.figures,children:`~${nD(c.usedTokens,t)} / ${nD(c.contextWindow,t)}`})]}),/* @__PURE__ */ (0,h.jsx)(`div`,{className:QE.bar,children:ee.map(e=>/* @__PURE__ */ (0,h.jsx)(`div`,{className:e.color===void 0?QE.segment:`${QE.segment} ${e.color}`,style:{width:`${e.width}%`}},e.key))}),r!==void 0&&/* @__PURE__ */ (0,h.jsx)(`dl`,{className:QE.rows,children:tD.map(e=>/* @__PURE__ */ (0,h.jsxs)(`div`,{className:QE.row,children:[/* @__PURE__ */ (0,h.jsxs)(`dt`,{children:[/* @__PURE__ */ (0,h.jsx)(`span`,{className:`${QE.swatch} ${e.color}`,"aria-hidden":!0}),t(e.label)]}),/* @__PURE__ */ (0,h.jsx)(`dd`,{children:`~${nD(r[e.key],t)}`})]},e.key))})]}),document.body)]})}function iD(e,t){let n=e.querySelector(`[data-toolbar-scroll]`);if(n===null)return()=>{};let r=e.querySelector(`[data-toolbar-fixed="start"]`),i=e.querySelector(`[data-toolbar-fixed="end"]`),a={phone:!1,overflowActions:!1},o=!1,s=/* @__PURE__ */ new Set,c=()=>{if(!a.phone||e.hasAttribute(`data-toolbar-activity`))return;let t=e.ownerDocument.activeElement;if(!(t instanceof HTMLElement)||!e.contains(t)||t.closest(`[data-toolbar-fixed]`))return;let{left:r,right:i}=n.getBoundingClientRect(),o=t.getBoundingClientRect();o.left<r?n.scrollLeft+=o.left-r:o.right>i&&(n.scrollLeft+=Math.min(o.right-i,o.left-r))},l=()=>{if(o)return;let s=e.closest(`[data-phone]`)!==null;if(e.toggleAttribute(`data-phone-toolbar`,s),e.hasAttribute(`data-toolbar-activity`)){s!==a.phone&&(a={...a,phone:s},t?.(a));return}let l=e.hasAttribute(`data-actions-overflow`);if(e.removeAttribute(`data-model-compact`),e.removeAttribute(`data-actions-overflow`),e.toggleAttribute(`data-toolbar-measuring`,s),s)for(let[t,n]of[[`start`,r],[`end`,i]]){if(n===null)continue;let r=`--dsh-composer-${t}-width`,i=`${n.getBoundingClientRect().width}px`;e.style.getPropertyValue(r)!==i&&e.style.setProperty(r,i)}let u=getComputedStyle(e),d=e.getBoundingClientRect().width-parseFloat(u.paddingLeft)-parseFloat(u.paddingRight),f=s?(()=>{let t=e=>Array.from(e.children).flatMap(e=>{let r=getComputedStyle(e).display;return r===`none`?[]:e===n||r===`contents`?t(e):[e]}),r=t(e);return r.reduce((e,t)=>{let n=getComputedStyle(t);return e+t.getBoundingClientRect().width+(parseFloat(n.marginLeft)||0)+(parseFloat(n.marginRight)||0)},0)+Math.max(0,r.length-1)*(parseFloat(u.columnGap)||0)})():(()=>{let e=Array.from(n.children,e=>e.getBoundingClientRect().width).filter(e=>e>0);return e.reduce((e,t)=>e+t,0)+Math.max(0,e.length-1)*parseFloat(u.columnGap)})();e.toggleAttribute(`data-model-compact`,!s&&f>d);let p=e.querySelector(`[data-composer-overflow-action]`),m=e.querySelector(`[data-toolbar-fixed="start"] button`),h=s&&p!==null&&m?.disabled===!1&&f>d-(l?2:0),g=e.hasAttribute(`data-command-menu-open`)||p!==null&&p.contains(e.ownerDocument.activeElement)?l:h;e.removeAttribute(`data-toolbar-measuring`),e.toggleAttribute(`data-actions-overflow`,g),(s!==a.phone||g!==a.overflowActions)&&(a={phone:s,overflowActions:g},t?.(a)),(!s||n.scrollWidth<=n.clientWidth)&&(n.scrollLeft=0),c()},u=new ResizeObserver(l),d=()=>{let t=/* @__PURE__ */ new Set([e,...e.querySelectorAll(`*`)]);for(let e of s)t.has(e)||(u.unobserve(e),s.delete(e));for(let e of t)s.has(e)||(u.observe(e),s.add(e))},f=new MutationObserver(()=>{d(),l()});f.observe(e,{subtree:!0,childList:!0,characterData:!0,attributes:!0,attributeFilter:[`hidden`,`class`,`style`,`aria-label`,`aria-busy`,`disabled`,`data-command-menu-open`,`data-toolbar-activity`]});let p=new MutationObserver(l);for(let t=e.parentElement;t!==null;t=t.parentElement)p.observe(t,{attributes:!0,attributeFilter:t===e.ownerDocument.body||t===e.ownerDocument.documentElement?[`data-phone`,`class`,`style`,`lang`,`dir`]:[`data-phone`,`lang`,`dir`]});let m=()=>{queueMicrotask(()=>{o||l()})};e.addEventListener(`focusin`,c),e.addEventListener(`focusout`,m);let h=document.fonts;return h.addEventListener(`loadingdone`,l),d(),l(),()=>{o=!0,u.disconnect(),f.disconnect(),p.disconnect(),e.removeEventListener(`focusin`,c),e.removeEventListener(`focusout`,m),h.removeEventListener(`loadingdone`,l)}}let aD=`@deepseek-ai/dsh-client-ui-conversation/InputBar.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(aD)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-conversation`,e.dataset.pluginCss=aD,e.textContent=`.HyhxnW_root{padding:0 var(--dsh-composer-side-clearance) 4px;flex-direction:column;align-items:center;display:flex}[data-phone] .HyhxnW_root{padding-bottom:max(4px, calc(env(safe-area-inset-bottom) - 23px))}.HyhxnW_dock{justify-content:center;align-items:center;gap:12px;max-width:100%;padding-top:4px;display:flex}.HyhxnW_hero .HyhxnW_dock:empty{display:none}.HyhxnW_hero{padding:0 var(--dsh-composer-side-clearance)}.HyhxnW_notice{width:100%;max-width:var(--dsh-composer-card-max-width);border-radius:var(--dsw-radius-md);background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-secondary);margin-bottom:6px;padding:4px 8px;font-size:12px;line-height:18px}.HyhxnW_card{box-sizing:border-box;width:100%;max-width:var(--dsh-composer-card-max-width);--dsw-elevation-stroke-color:var(--dsw-alias-border-l2);border-radius:var(--dsw-radius-panel);background:var(--dsw-specific-input-major);box-shadow:var(--dsw-elevation-soft);font-size:var(--dsh-content-font-size,14px);line-height:calc(24px + var(--dsh-content-font-delta,0px));--dsh-scrollbar-thumb:var(--dsw-alias-scrollbar-bg-l2);--dsh-scrollbar-thumb-hover:var(--dsw-alias-scrollbar-hover-l2);border:0;flex-direction:column;gap:12px;padding-top:8px;display:flex;position:relative}@supports (backdrop-filter:blur(14px)){body[data-codexhost-wallpaper] .HyhxnW_card,[data-phone] .HyhxnW_card{box-shadow:none;background:0 0}body[data-codexhost-wallpaper] .HyhxnW_card:before,[data-phone] .HyhxnW_card:before{content:"";z-index:-1;border-radius:inherit;background:color-mix(in srgb, var(--dsw-specific-input-major) 60%, transparent);backdrop-filter:blur(16px);box-shadow:inset 0 1px 0 color-mix(in srgb, var(--dsw-alias-bg-layer-3) 65%, transparent), var(--dsw-elevation-soft), 0 8px 24px -12px var(--dsw-alias-bg-mask-2);pointer-events:none;position:absolute;inset:0}body:not([data-codexhost-wallpaper]) [data-phone] .HyhxnW_card:before{background:color-mix(in srgb, var(--dsw-specific-input-major) 24%, transparent);backdrop-filter:blur(14px)}}@media (prefers-reduced-transparency:reduce),(prefers-contrast:more),(forced-colors:active){body[data-codexhost-wallpaper] .HyhxnW_card,[data-phone] .HyhxnW_card{background:var(--dsw-specific-input-major);box-shadow:var(--dsw-elevation-soft)}body[data-codexhost-wallpaper] .HyhxnW_card:before,[data-phone] .HyhxnW_card:before{display:none}}@media (prefers-contrast:more),(forced-colors:active){[data-phone] .HyhxnW_card:not(.HyhxnW_cardWorkspaceTrigger){outline:1px solid var(--dsw-alias-label-primary);outline-offset:-1px}}.HyhxnW_cardWorkspaceTrigger{--dsw-elevation-stroke-color:transparent;cursor:pointer}.HyhxnW_cardWorkspaceTrigger:after{content:"";box-sizing:border-box;border-radius:var(--dsw-radius-panel);color:var(--dsw-alias-border-l4);pointer-events:none;border:1px dashed;transition:color .1s;position:absolute;inset:0}.HyhxnW_cardWorkspaceTrigger :disabled{pointer-events:none}.HyhxnW_cardWorkspaceTrigger:hover:after{color:var(--dsw-alias-state-business-primary)}.HyhxnW_inlineNotices{flex-direction:column;gap:8px;display:flex}.HyhxnW_inlineNotices>[data-slot]>*{margin:10px 10px 0}.HyhxnW_accessory{align-items:center;gap:8px;padding:10px 12px 0;display:flex}.HyhxnW_overlayAnchor{height:0;position:absolute;inset:0 0 auto}.HyhxnW_scroll{max-height:var(--dsh-composer-text-max-height);margin-right:4px;overflow-y:auto}.HyhxnW_scroll::-webkit-scrollbar-track{margin-top:8px}.HyhxnW_grow{position:relative}.HyhxnW_pending{corner-shape:round;background:var(--dsw-alias-state-business-primary);border-radius:50%;width:8px;height:8px;animation:1s ease-in-out infinite alternate HyhxnW_input-pending}@keyframes HyhxnW_input-pending{0%{opacity:.35}to{opacity:1}}.HyhxnW_input{box-sizing:border-box;min-height:36px;font-family:var(--dsw-font-family);font-size:inherit;line-height:inherit;white-space:pre-wrap;word-break:break-word;overflow-wrap:anywhere;color:var(--dsw-alias-label-primary);caret-color:var(--dsw-alias-state-business-primary);outline:none;padding:4px 8px 0 14px}.HyhxnW_input p{margin:0}.HyhxnW_input p:last-child:after{content:var(--dsh-composer-hint);color:var(--dsw-alias-label-caption)}.HyhxnW_input[data-composer-composing] p:last-child:after{content:none}.HyhxnW_input[data-composer-composing]+.HyhxnW_placeholder{visibility:hidden}.HyhxnW_placeholder{color:var(--dsw-alias-label-caption);white-space:nowrap;text-overflow:ellipsis;pointer-events:none;user-select:none;position:absolute;inset:4px 8px auto 14px;overflow:hidden}.HyhxnW_inputDisabled{color:var(--dsw-alias-label-tertiary);cursor:not-allowed}.HyhxnW_input[aria-haspopup=menu]{cursor:pointer}.HyhxnW_hero .HyhxnW_input{min-height:52px}.HyhxnW_hero .HyhxnW_placeholder{white-space:normal;-webkit-line-clamp:2;line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box}@media (width<=600px){.HyhxnW_hero .HyhxnW_input{min-height:36px}.HyhxnW_hero .HyhxnW_placeholder{white-space:nowrap;display:block}}.HyhxnW_row{flex-wrap:wrap;justify-content:space-between;align-items:center;gap:12px;min-width:0;padding:2px 8px 6px;display:flex;container-type:inline-size}.HyhxnW_row[data-model-compact]{--dsh-composer-model-text-display:none;--dsh-composer-model-icon-display:block}.HyhxnW_tools,.HyhxnW_modes,.HyhxnW_trailing{align-items:center;min-width:0;display:flex}.HyhxnW_tools,.HyhxnW_modes{gap:12px}.HyhxnW_trailing{flex:none;gap:12px;margin-left:auto}@container (width<=560px){.HyhxnW_tools,.HyhxnW_modes,.HyhxnW_trailing{gap:8px}}.HyhxnW_add{corner-shape:round;background:var(--dsw-specific-selector);width:28px;height:28px;color:var(--dsw-alias-label-primary);cursor:pointer;border:none;border-radius:999px;flex:none;place-items:center;display:grid}.HyhxnW_add:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover-solid)}.HyhxnW_add:disabled{opacity:.5;cursor:default}.HyhxnW_select{border-radius:var(--dsw-radius-sm);max-width:220px;height:28px;color:var(--dsw-alias-label-secondary);white-space:nowrap;cursor:pointer;appearance:none;background-color:#0000;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5' stroke='%2381858C' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");background-position:right 4px center;background-repeat:no-repeat;background-size:12px 12px;border:none;outline:none;padding:0 20px 0 8px;font-size:13px;font-weight:500;line-height:20px}.HyhxnW_select:hover:not(:disabled){background-color:var(--dsw-alias-interactive-bg-hover)}.HyhxnW_select:disabled{opacity:.5;cursor:default}.HyhxnW_primary{corner-shape:round;background:var(--dsw-alias-button-info-fill);color:#fff;cursor:pointer;border:none;border-radius:999px;flex:none;place-items:center;width:30px;height:30px;transition:background-color .1s;display:grid;transform:translateY(-2px)}.HyhxnW_primary:hover:not(:disabled){background:var(--dsw-alias-button-info-hover)}.HyhxnW_primary:disabled{opacity:.4;cursor:default}.HyhxnW_retry{border-radius:var(--dsw-radius-sm);color:inherit;cursor:pointer;background:0 0;border:1px solid;margin-left:8px;padding:1px 8px;font-size:12px}.HyhxnW_addSeat,.HyhxnW_submitSeat,.HyhxnW_controlScroll{display:contents}.HyhxnW_row[data-phone-toolbar]{flex-wrap:nowrap;gap:4px;position:relative}.HyhxnW_row[data-phone-toolbar] .HyhxnW_controlScroll{--dsh-composer-edge-gap:4px;align-items:center;gap:inherit;min-width:0;min-height:44px;margin-left:calc(var(--dsh-composer-start-width,44px) + var(--dsh-composer-edge-gap));margin-right:calc(var(--dsh-composer-end-width,44px) + var(--dsh-composer-edge-gap));overscroll-behavior-x:contain;scrollbar-width:none;flex:1;display:flex;overflow-x:auto}.HyhxnW_row[data-phone-toolbar] .HyhxnW_controlScroll::-webkit-scrollbar{display:none}.HyhxnW_row[data-phone-toolbar] .HyhxnW_tools:not([hidden]),.HyhxnW_row[data-phone-toolbar] .HyhxnW_trailing:not(.HyhxnW_trailingActive){display:contents}.HyhxnW_row[data-phone-toolbar] .HyhxnW_tools>*,.HyhxnW_row[data-phone-toolbar] [data-slot="conversation.input.left"]>*{flex-shrink:0}.HyhxnW_row[data-phone-toolbar] button:focus-visible{outline-offset:-2px}.HyhxnW_row[data-phone-toolbar] .HyhxnW_modes,.HyhxnW_row[data-phone-toolbar] .HyhxnW_standardControls{flex:none;gap:4px;width:max-content}.HyhxnW_row[data-phone-toolbar] .HyhxnW_standardControls{margin-left:0}.HyhxnW_row[data-phone-toolbar] .HyhxnW_addSeat,.HyhxnW_row[data-phone-toolbar] .HyhxnW_submitSeat{z-index:1;flex:none;align-items:center;gap:4px;display:flex;position:absolute;inset-block:2px 6px}.HyhxnW_row[data-phone-toolbar] .HyhxnW_addSeat{left:8px}.HyhxnW_row[data-phone-toolbar] .HyhxnW_submitSeat{margin-left:0;right:8px}.HyhxnW_row[data-phone-toolbar] .HyhxnW_add,.HyhxnW_row[data-phone-toolbar] .HyhxnW_primary{box-sizing:border-box;background-clip:padding-box;width:44px;height:44px}.HyhxnW_row[data-phone-toolbar] .HyhxnW_add{border:8px solid #0000}.HyhxnW_row[data-phone-toolbar] .HyhxnW_primary{border:7px solid #0000}.HyhxnW_row[data-phone-toolbar][data-toolbar-activity] .HyhxnW_controlScroll{display:contents}.HyhxnW_row[data-phone-toolbar][data-toolbar-activity] .HyhxnW_submitSeat{position:static}.HyhxnW_row[data-actions-overflow] [data-composer-overflow-action]{display:none}.HyhxnW_standardControls{align-items:center;gap:12px;min-width:0;display:flex}.HyhxnW_tools[hidden],.HyhxnW_standardControls[hidden]{display:none}.HyhxnW_trailingActive{flex:1;margin-left:0}.HyhxnW_activity{flex:none;align-items:center;display:flex}.HyhxnW_activity:empty{display:none}.HyhxnW_activityExpanded{flex:1;min-width:0}.HyhxnW_annotations{scrollbar-width:none;align-items:center;gap:6px;padding:8px 12px 0;display:flex;overflow-x:auto}.HyhxnW_annotations::-webkit-scrollbar{display:none}.HyhxnW_annotations>*{flex:none}`,document.head.appendChild(e)}var oD={accessory:`HyhxnW_accessory`,activity:`HyhxnW_activity`,activityExpanded:`HyhxnW_activityExpanded`,add:`HyhxnW_add`,addSeat:`HyhxnW_addSeat`,annotations:`HyhxnW_annotations`,card:`HyhxnW_card`,cardWorkspaceTrigger:`HyhxnW_cardWorkspaceTrigger`,controlScroll:`HyhxnW_controlScroll`,dock:`HyhxnW_dock`,grow:`HyhxnW_grow`,hero:`HyhxnW_hero`,inlineNotices:`HyhxnW_inlineNotices`,input:`HyhxnW_input`,"input-pending":`HyhxnW_input-pending`,inputDisabled:`HyhxnW_inputDisabled`,modes:`HyhxnW_modes`,notice:`HyhxnW_notice`,overlayAnchor:`HyhxnW_overlayAnchor`,pending:`HyhxnW_pending`,placeholder:`HyhxnW_placeholder`,primary:`HyhxnW_primary`,retry:`HyhxnW_retry`,root:`HyhxnW_root`,row:`HyhxnW_row`,scroll:`HyhxnW_scroll`,select:`HyhxnW_select`,standardControls:`HyhxnW_standardControls`,submitSeat:`HyhxnW_submitSeat`,tools:`HyhxnW_tools`,trailing:`HyhxnW_trailing`,trailingActive:`HyhxnW_trailingActive`};let sD=[],cD=(0,g.memo)(function({useSession:e,useInput:t,inputActions:n,keyboard:r,addFiles:i,removeAttachment:a,resolveDraftAttachments:o,retryFileUpload:s,revealResponseAnnotation:c,toggleCommandMenu:l,stop:u,t:f,renderSlot:p,useBusyEnter:m,useFileUploads:_,useNotices:v,useLexicon:y,useMenuLauncher:ee,useStopShortcut:b,useProjection:te,sessionId:x,variant:ne,disabled:re=!1,blocked:ie,workspacePickerOpen:ae=!1,onRequestWorkspace:oe,placeholder:se,accessory:ce}){let S=t(e=>e),le=S?.responseAnnotations??sD,ue=(0,g.useMemo)(()=>({label:e=>f(`annotation.label`,{index:e}),railLabel:e=>f(`annotation.chipLabel`,{index:e}),railTitle:(e,t)=>f(`annotation.title`,{index:e,excerpt:t}),remove:e=>f(`annotation.remove`,{index:e}),selectedText:f(`annotation.selectedText`),userComment:f(`annotation.userComment`)}),[f]),de=v(e=>e),fe=m(e=>e),C=b(e=>e),w=ee(e=>e===`command`),[pe,me]=(0,g.useState)(!1);(0,g.useEffect)(()=>{me(!1)},[x]);let he=e(e=>e.promptError)??null,ge=e(e=>e.running)??!1,_e=e(e=>e.subagent)??null,ve=e(e=>e.removed)??!1,ye=te(`plan`,e=>e!==void 0&&(e.pending?!e.active:e.active)),be=te(`goal`,e=>e!=null),xe=S!==void 0&&r!==void 0&&n!==void 0,Se=S?.draft??``,Ce=S?.primaryAction,we=r?.editor??null,Te=(0,g.useMemo)(()=>S===void 0||o===void 0?[]:o(S.attachmentIds),[o,S?.attachmentIds]),Ee=Se.trim()===``&&Te.length===0&&le.length===0,De=_(e=>e),Oe=Te.some(e=>De[e.id]?.status===`error`),[ke,Ae]=(0,g.useState)(null),je=(0,g.useRef)(0),Me=(0,g.useCallback)(e=>{je.current+=1,Ae({seq:je.current,text:e})},[]),Ne=(0,g.useCallback)(()=>{Ae(null)},[]),Pe=te(`imageLimits`),Fe=te(`attachmentInput`),Ie=Fe?.enabled!==!1,Le=Fe?.imagesOnly===!0;(0,g.useEffect)(()=>{if(he===null)return;let{error:e}=he;e.code===`session/writer-held`?Me(f(`error.sessionInUse`)):Me(e.code===`session/attachment-invalid`||e.code===`subagent/attachment-invalid`?YE(f,e.details.reason,Pe):`${e.message} (${e.code})`)},[he,Me,f,Pe]),(0,g.useEffect)(()=>{de?.level===`error`&&Me(de.text)},[de,Me]);let Re=(0,g.useRef)(null),[ze,Be]=(0,g.useState)({phone:!1,overflowActions:!1});(0,g.useLayoutEffect)(()=>{let e=Re.current;if(e!==null)return iD(e,Be)},[]);let Ve=(0,g.useRef)(null),He=(0,g.useRef)(null),Ue=_e?.address.mode===`continuable`,We=Ue&&_e.parentAvailable!==!0,Ge=ve||re||!xe||ie!==void 0||We,Ke=Ge,qe=ve||re||!xe,Je=S?.phase===`adjudicating`||S?.phase===`submitting`,Ye=re&&!ve&&oe!==void 0,Xe=ve||Ke&&!Ye,Ze=xe&&!Ke&&!Je,Qe=_e===null||_e.address.mode===`continuable`,$e=!Ke&&!Je&&Ee&&ge&&Qe&&S.queue.length>0;(0,g.useEffect)(()=>{S!==void 0&&n!==void 0&&Te.length!==S.attachmentIds.length&&n.pruneAttachments(Te.map(e=>e.id))},[Te,S?.attachmentIds,n]);let et=()=>{HE(He)};(0,g.useEffect)(()=>{Ke||we===null||(0,d.shouldAutoFocusTextInput)()&&UE(we,et)},[Ke,x,we]),(0,g.useEffect)(()=>{Ke||Se===``||et()},[Se!==``]),(0,g.useEffect)(()=>WE(He),[]);let tt=(0,g.useCallback)((e,t)=>{if(_e!==null||i===void 0||e.length===0)return;if(!Ie){Me(f(`attachment.unavailable`));return}let n=(()=>{if(Le&&e.some(e=>!(Pe?.mediaTypes)?.includes(e.type)))return f(`image.unsupportedType`);if(Pe!==void 0){let t=Pe.mediaTypes,n=e.filter(e=>t.includes(e.type)),r=Te.filter(e=>e.kind===`image`);if(r.length+n.length>Pe.maxImagesPerMessage)return f(`image.tooMany`,{count:Pe.maxImagesPerMessage});if(n.some(e=>e.size>Pe.maxImageBytes))return f(`image.fileTooLarge`,{size:JE(Pe.maxImageBytes)});if(r.reduce((e,t)=>e+t.file.size,0)+n.reduce((e,t)=>e+t.size,0)>Pe.maxMessageImageBytes)return f(`image.totalTooLarge`,{size:JE(Pe.maxMessageImageBytes)})}return i(e,t)})();n!==null&&Me(n)},[_e,i,Ie,Le,Te,Pe,Me,f]),nt=Ie&&_e===null&&!Ke&&!Je&&i!==void 0,rt=f(Ie?Le?`input.imagesAndCommands`:`input.commands`:`input.commandsOnly`),it=(0,g.useRef)(null),at=e=>{let t=e.target.files===null?[]:[...e.target.files];e.target.value=``,t.length>0&&tt(t)},ot=(0,g.useRef)({locked:Ke,machineBusy:Je,primaryAction:Ce,canSteerQueue:$e,running:ge,steeringAvailable:Qe,busyEnter:fe,intakeFiles:tt,uploadsFailed:Oe,showToast:Me,t:f,canAcceptDrop:nt});ot.current={locked:Ke,machineBusy:Je,primaryAction:Ce,canSteerQueue:$e,running:ge,steeringAvailable:Qe,busyEnter:fe,intakeFiles:tt,uploadsFailed:Oe,showToast:Me,t:f,canAcceptDrop:nt},(0,g.useEffect)(()=>{if(r!==void 0)return GE(r,ot,it)},[r]),(0,g.useEffect)(()=>{if(we!==null&&r!==void 0)return KE(we,r,ot)},[we,r]);let st=e=>{qE(e,we)},ct=()=>{r!==void 0&&(we!==null&&(0,d.shouldAutoFocusTextInput)()&&UE(we,et),l?.(r.caretSpan()))},lt=e=>{Ye&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),oe())},ut=Ce===void 0&&ge&&_e===null&&(Ee||ie!==void 0),dt=ut?u===void 0:(Ce===void 0?Ee:Ce.disabled)||Ge||Je,ft=ge&&Ue,pt=VT(fe,ge,`enter`,Qe),mt=!Ee&&S?.phase===`plain`&&!Se.trimStart().startsWith(`/`),ht=f(ut?`input.stop`:Ce===void 0&&ge&&Qe&&!Ge&&!Oe&&mt?pt===`steer`?`input.send.steer`:`input.send.queue`:`input.send`),gt=()=>{ut?u?.():Oe?Me(f(`file.retryOrRemove`)):Ce===void 0?r!==void 0&&!Ee&&!Ge&&!Je&&r.submit(pt,`click`):dt||Ce.run()},_t=(S?.phase===`claimed`||S?.phase===`submitting`)&&S.claim!==void 0&&Se.startsWith(S.claim.token),vt=_t&&S.claim.hint!==void 0&&Se.slice(S.claim.token.length).trim()===``?S.claim.hint:null,yt=(()=>{if(vt===null)return null;let e=S?.claim?.name??``,t=`hint.${e===`goal`&&be?`goal.active`:e}`,n=f(t);return n===t?vt:n})(),bt=se??f(We?`placeholder.parentOffline`:Ge?`placeholder.unavailable`:$e?`placeholder.steerQueue`:ye?`placeholder.plan`:`placeholder.default`);return/* @__PURE__ */ (0,h.jsxs)(`div`,{className:Ib(oD.root,ne===`hero`&&oD.hero),children:[ke!==null&&/* @__PURE__ */ (0,h.jsx)(d.Toast,{text:ke.text,icon:/* @__PURE__ */ (0,h.jsx)(d.IconWarningOutlineRegular,{}),anchor:Ve.current,onDone:Ne},ke.seq),de?.level===`info`&&/* @__PURE__ */ (0,h.jsx)(`div`,{className:oD.notice,role:`status`,children:de.text}),/* @__PURE__ */ (0,h.jsxs)(`div`,{ref:Ve,className:Ib(oD.card,Ye&&oD.cardWorkspaceTrigger),"data-composer-card":!0,onClick:Ye?oe:void 0,onPointerDown:Ye?e=>{e.stopPropagation()}:void 0,children:[x!==void 0&&/* @__PURE__ */ (0,h.jsx)(`div`,{className:oD.overlayAnchor,children:p(`conversation.input.overlay`,{})}),ce!==void 0&&/* @__PURE__ */ (0,h.jsx)(`div`,{className:oD.accessory,children:ce}),le.length===0?null:/* @__PURE__ */ (0,h.jsx)(`div`,{className:oD.annotations,"data-composer-annotations":!0,children:le.map((e,t)=>/* @__PURE__ */ (0,h.jsx)(d.ResponseAnnotationChip,{index:t+1,annotation:e,labels:ue,onActivate:e.anchor===void 0?void 0:()=>c?.(e.id),onRemove:()=>{n?.removeResponseAnnotation(e.id)}},e.id))}),S===void 0||x===void 0?null:/* @__PURE__ */ (0,h.jsx)(`div`,{className:oD.inlineNotices,children:p(`conversation.input.notice`,{})}),p(`conversation.input.attachments`,{attachments:Te,canAcceptDrop:nt,onAddFiles:tt,onRemoveAttachment:e=>{a?.(e)},uploads:De,onRetryFile:e=>{s?.(e)},dropLimits:Pe===void 0?void 0:{count:Pe.maxImagesPerMessage,size:JE(Pe.maxImageBytes)}}),/* @__PURE__ */ (0,h.jsx)(zE,{classNames:oD,editor:we,scrollRef:He,editable:Ze,editorDisabled:Xe,phase:S?.phase??`inert`,placeholderText:bt,ariaLabel:Ye?f(`hero.chooseWorkspace`):bt,workspaceTrigger:Ye,workspacePickerOpen:ae,onWorkspaceKeyDown:lt,hint:yt,showPlaceholder:Se===``&&Te.length===0&&!_t}),/* @__PURE__ */ (0,h.jsx)(`div`,{ref:Re,className:oD.row,"data-composer-toolbar":!0,"data-command-menu-open":w||void 0,"data-toolbar-activity":pe||void 0,children:/* @__PURE__ */ (0,h.jsxs)(`div`,{className:oD.controlScroll,"data-toolbar-scroll":!0,children:[/* @__PURE__ */ (0,h.jsxs)(`div`,{className:oD.tools,hidden:pe,"data-composer-tools":!0,children:[/* @__PURE__ */ (0,h.jsx)(`div`,{className:oD.addSeat,"data-toolbar-fixed":`start`,children:/* @__PURE__ */ (0,h.jsx)(d.Tooltip,{portal:ze.phone,label:rt,side:`top`,delayMs:500,children:/* @__PURE__ */ (0,h.jsx)(`button`,{type:`button`,className:oD.add,"aria-label":rt,"aria-haspopup":`listbox`,"aria-expanded":w,disabled:Ke||Je||l===void 0,onMouseDown:st,onClick:ct,children:/* @__PURE__ */ (0,h.jsx)(d.IconPlusOutlineMedium,{size:14})})})}),/* @__PURE__ */ (0,h.jsx)(`input`,{ref:it,type:`file`,accept:Le?Pe?.mediaTypes.join(`,`):void 0,multiple:!0,disabled:!Ie||_e!==null,hidden:!0,onChange:at}),/* @__PURE__ */ (0,h.jsxs)(`div`,{className:oD.modes,children:[x===void 0?null:p(`conversation.input.permission`,{locked:Ke}),x===void 0?null:p(`conversation.input.plan`,{locked:Ke})]}),S===void 0||x===void 0?null:p(`conversation.input.left`,{})]}),/* @__PURE__ */ (0,h.jsxs)(`div`,{className:Ib(oD.trailing,pe&&oD.trailingActive),children:[/* @__PURE__ */ (0,h.jsxs)(`div`,{className:oD.standardControls,hidden:pe,children:[S===void 0||x===void 0?null:p(`conversation.input.right`,{overflowActions:ze.overflowActions}),x===void 0?null:p(`conversation.input.model`,{locked:qe})]}),S===void 0||x===void 0?null:/* @__PURE__ */ (0,h.jsx)(`div`,{className:pe?oD.activityExpanded:oD.activity,children:p(`conversation.input.activity`,{locked:Ke,onActiveChange:me})}),/* @__PURE__ */ (0,h.jsxs)(`div`,{className:oD.submitSeat,"data-toolbar-fixed":`end`,children:[ft&&/* @__PURE__ */ (0,h.jsx)(d.Tooltip,{portal:ze.phone,label:f(`input.stop`),shortcutKeys:C,side:`top`,delayMs:500,disabled:u===void 0,children:/* @__PURE__ */ (0,h.jsx)(`button`,{type:`button`,className:oD.primary,"aria-label":f(`input.stop`),disabled:u===void 0,onMouseDown:st,onClick:u,children:/* @__PURE__ */ (0,h.jsx)(`svg`,{viewBox:`0 0 16 16`,width:`14`,height:`14`,"aria-hidden":!0,children:/* @__PURE__ */ (0,h.jsx)(`rect`,{x:`3`,y:`3`,width:`10`,height:`10`,rx:`3`,fill:`currentColor`})})})}),/* @__PURE__ */ (0,h.jsx)(d.Tooltip,{portal:ze.phone,label:ut?f(`input.stop`):ht,shortcutKeys:ut?C:void 0,side:`top`,delayMs:500,disabled:dt,children:/* @__PURE__ */ (0,h.jsx)(`button`,{type:`button`,className:oD.primary,"aria-label":ht,disabled:dt,onMouseDown:st,onClick:gt,children:ut?/* @__PURE__ */ (0,h.jsx)(`svg`,{viewBox:`0 0 16 16`,width:`14`,height:`14`,"aria-hidden":!0,children:/* @__PURE__ */ (0,h.jsx)(`rect`,{x:`3`,y:`3`,width:`10`,height:`10`,rx:`3`,fill:`currentColor`})}):/* @__PURE__ */ (0,h.jsx)(`svg`,{viewBox:`0 0 16 16`,width:`14`,height:`14`,"aria-hidden":!0,children:/* @__PURE__ */ (0,h.jsx)(`path`,{d:`M8.3125 0.980183C8.66767 1.0531 8.97902 1.20418 9.2627 1.43233C9.48724 1.61297 9.73029 1.85793 9.97949 2.10714L14.707 6.83468L13.293 8.24874L9 3.95577V15.0417H7V3.95577L2.70703 8.24874L1.29297 6.83468L6.02051 2.10714C6.26971 1.85793 6.51277 1.61297 6.7373 1.43233C6.97662 1.23986 7.28445 1.04402 7.6875 0.980183C7.8973 0.947006 8.1031 0.95516 8.3125 0.980183Z`,fill:`currentColor`})})})})]})]})]})})]}),/* @__PURE__ */ (0,h.jsxs)(`div`,{className:oD.dock,"data-composer-dock":!0,children:[ne===`composer`&&S!==void 0&&x!==void 0?p(`conversation.composer.dock`,{}):null,pe?null:/* @__PURE__ */ (0,h.jsx)(rD,{useProjection:te,t:f})]})]})}),lD=`@deepseek-ai/dsh-client-ui-conversation/TodoPanel.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(lD)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-conversation`,e.dataset.pluginCss=lD,e.textContent=`.ejOqlq_root{box-sizing:border-box;width:calc(100% - var(--dsh-composer-side-clearance) - var(--dsh-composer-side-clearance) - var(--dsh-composer-dock-inset) - var(--dsh-composer-dock-inset) - var(--dsh-composer-dock-inset) - var(--dsh-composer-dock-inset));max-width:calc(var(--dsh-composer-card-max-width) - var(--dsh-composer-dock-inset) - var(--dsh-composer-dock-inset) - var(--dsh-composer-dock-inset) - var(--dsh-composer-dock-inset));--dsw-elevation-stroke-color:var(--dsw-alias-border-l1);border-radius:var(--dsw-radius-lg);background:var(--dsw-specific-menu);backdrop-filter:var(--dsw-menu-backdrop-filter);box-shadow:var(--dsw-elevation-panel);--dsh-scrollbar-thumb:var(--dsw-alias-scrollbar-bg-l2);--dsh-scrollbar-thumb-hover:var(--dsw-alias-scrollbar-hover-l2);border:0;flex:none;margin:0 auto;overflow:hidden}.ejOqlq_body{flex-direction:column;gap:8px;padding:6px 12px;display:flex}.ejOqlq_header{text-align:left;cursor:pointer;background:0 0;border:none;align-items:center;gap:10px;width:100%;padding:0;display:flex}.ejOqlq_lead{color:var(--dsw-alias-label-tertiary);flex:none;place-items:center;display:grid}.ejOqlq_title{color:var(--dsw-alias-label-primary);flex:none;font-size:13px;font-weight:500;line-height:24px}.ejOqlq_progress{min-width:0;color:var(--dsw-alias-label-tertiary);text-overflow:ellipsis;white-space:nowrap;flex:auto;font-size:13px;font-weight:400;line-height:20px;overflow:hidden}.ejOqlq_chevron{color:var(--dsw-alias-label-tertiary);flex:none;place-items:center;display:grid}.ejOqlq_list{flex-direction:column;gap:8px;max-height:180px;margin:0;padding:0;list-style:none;display:flex;overflow-y:auto}.ejOqlq_item{min-width:0;color:var(--dsw-alias-label-secondary);align-items:center;gap:10px;font-size:13px;line-height:20px;display:flex}.ejOqlq_glyph{flex:none;place-items:center;width:16px;height:16px;display:grid}.ejOqlq_content{text-overflow:ellipsis;white-space:nowrap;min-width:0;overflow:hidden}`,document.head.appendChild(e)}var uD={body:`ejOqlq_body`,chevron:`ejOqlq_chevron`,content:`ejOqlq_content`,glyph:`ejOqlq_glyph`,header:`ejOqlq_header`,item:`ejOqlq_item`,lead:`ejOqlq_lead`,list:`ejOqlq_list`,progress:`ejOqlq_progress`,root:`ejOqlq_root`,title:`ejOqlq_title`};
|
|
174
177
|
/* v8 ignore next 3 -- closed-union backstop; only reached if status is forged */
|
|
175
|
-
function
|
|
178
|
+
function dD(e){throw Error(`unreachable todo status: ${String(e)}`)}function fD(e){switch(e){case`completed`:return`done`;case`in_progress`:return`ongoing`;case`pending`:return`idle`;
|
|
176
179
|
/* v8 ignore next -- closed TodoItem status union */
|
|
177
|
-
default:return
|
|
180
|
+
default:return dD(e)}}function pD(e,t){switch(e){case`completed`:return t(`todo.status.completed`);case`in_progress`:return t(`todo.status.inProgress`);case`pending`:return t(`todo.status.pending`);
|
|
178
181
|
/* v8 ignore next -- closed TodoItem status union */
|
|
179
|
-
default:return
|
|
182
|
+
default:return dD(e)}}function mD(e,t){let n=e.filter(e=>e.status===`completed`).length,r=e.filter(e=>e.status===`in_progress`).length,i=e.length-n-r;return[...n>0?[t(`todo.progress.done`,{done:n})]:[],...r>0?[t(`todo.progress.active`,{active:r})]:[],...i>0?[t(`todo.progress.pending`,{pending:i})]:[]].join(` · `)}function hD({todos:e,t}){let[n,r]=(0,g.useState)(!0);return e.length===0?null:/* @__PURE__ */ (0,h.jsx)(`section`,{className:uD.root,"data-testid":`todo-panel`,"aria-label":t(`todo.title`),children:/* @__PURE__ */ (0,h.jsxs)(`div`,{className:uD.body,children:[/* @__PURE__ */ (0,h.jsxs)(`button`,{type:`button`,className:uD.header,"aria-expanded":!n,onClick:()=>{r(e=>!e)},children:[/* @__PURE__ */ (0,h.jsx)(`span`,{className:uD.lead,"aria-hidden":!0,children:/* @__PURE__ */ (0,h.jsx)(d.IconChecklistOutlineRegular,{})}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:uD.title,children:t(`todo.title`)}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:uD.progress,children:mD(e,t)}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:uD.chevron,"aria-hidden":!0,children:n?/* @__PURE__ */ (0,h.jsx)(d.IconChevronUpOutlineRegular,{}):/* @__PURE__ */ (0,h.jsx)(d.IconChevronDownOutlineRegular,{})})]}),!n&&/* @__PURE__ */ (0,h.jsx)(`ul`,{className:uD.list,children:e.map(e=>/* @__PURE__ */ (0,h.jsxs)(`li`,{className:uD.item,"data-status":e.status,children:[/* @__PURE__ */ (0,h.jsx)(`span`,{className:uD.glyph,role:`img`,"aria-label":pD(e.status,t),children:/* @__PURE__ */ (0,h.jsx)(d.StateDot,{state:fD(e.status)})}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:uD.content,children:e.content})]},e.content))})]})})}function gD({useProjection:e,t}){let n=e(`todos`);return/* @__PURE__ */ (0,h.jsx)(hD,{todos:n??[],t})}let _D={name:`conversation-todo-dock`,inject:[`slots`],apply(e){e.slots.inject(`conversation.input.dock`,()=>e.slots.register({name:`conversation.input.dock`,id:`todo`,order:0,locale:Ic},gD))}};var vD=class{intervalMs;release;first;timer;constructor(e,t){this.intervalMs=e,this.release=t}reset(){this.first=void 0,clearTimeout(this.timer),this.timer=void 0,this.release()}press(e){let t=this.first;return this.reset(),t!==void 0&&performance.now()<=t.deadline&&t.target.sessionId===e.sessionId&&t.target.turn===e.turn&&t.target.generation===e.generation&&t.target.region===e.region?(e.cancel(),!0):(this.first={target:e,deadline:performance.now()+this.intervalMs},this.timer=setTimeout(()=>{this.reset()},this.intervalMs+1),!1)}};function yD(e,t,n,r,i){let a=()=>{},o=new vD(e.stopSequenceMs,()=>{a(),a=()=>{}}),s=()=>{o.reset()},c=e.observeFixedInput(e=>{if(e.type===`reset`){s();return}let{gesture:c,context:l}=e;if(c.code!==`Escape`||c.repeat||c.composing||c.defaultPrevented||c.control||c.alt||c.shift||c.meta||l.modal!==null||l.region===`terminal`||l.target===null){s();return}let u=l.target,d=u.closest(`[data-conversation-session]`),f=u.closest(`[data-conversation-region]`);if(d===null||f===null||!d.contains(f)||u.closest(`[data-approval-key], iframe, .xterm, [inert]`)!==null){s();return}let p=d.dataset.conversationSession,m=t.binding(p);if(m===void 0){s();return}let h=n(m),g=()=>{let e=m.session.getSnapshot();if(!(!e.running||e.removed||e.subagent!==null&&e.subagent.address.mode!==`continuable`||r.sessionStatus.getSnapshot().get(p)?.pendingInteraction!==void 0))return h.getSnapshot()},_=g();if(_===void 0){s();return}if(e.consume(),o.press({sessionId:p,turn:_,generation:m,region:f,cancel:()=>{i(p)}}))return;let v=()=>{(t.binding(p)!==m||g()!==_)&&s()},y=[h.subscribe(v),m.session.subscribe(v),r.sessionStatus.subscribe(v)];a=()=>{for(let e of y)e()}});return()=>{c(),s()}}let bD=[`slots`,`sessions`,`fileUpload`,`uiSession`,`uiWorkspace`,`locale`,`configForms`],xD=w.object({maxConcurrentFileUploads:w.natural().min(1).default(2)}),SD={getSnapshot:()=>null,subscribe:()=>()=>{}},CD={getSnapshot:()=>void 0,subscribe:()=>()=>{}},wD=/* @__PURE__ */ new Map,TD={getSnapshot:()=>wD,subscribe:()=>()=>{}},ED={getSnapshot:()=>null,subscribe:()=>()=>{}},DD={},OD={getSnapshot:()=>DD,subscribe:()=>()=>{}};function kD(){return globalThis.__DSH_HOST_PATHS__}function AD(e,t){let n=e.scope(t);if(n===void 0)throw Error(`ui-conversation: session "${t}" resolved no scope`);let r=n.get(`conversation`);if(r===void 0)throw Error(`ui-conversation: conversation service unavailable through the session scope`);return r}function jD(e){let t=e.get(`conversation`);if(t===void 0)throw Error(`ui-conversation: conversation service unavailable`);return t}function MD(e,t=xD({})){let n=e.sessions,r=e.slots,i=t.maxConcurrentFileUploads,a=e.get(`uiWorkspace`),o=new wt(e,n);e.effect(()=>e.locale.register(Ic,{zh:zc,en:Bc}),`ui-conversation: dictionaries`);let s=e.locale.bind(Ic),c=Ac(),l=new HT(e.configForms.get(`ui-conversation`));e.effect(()=>()=>{l.dispose()}),e.slots.inject(`settings.general.item`,()=>e.slots.register({name:`settings.general.item`,id:`composer-enter`,order:20,locale:Ic,inject:()=>({hooks:{busyEnter:l.busyEnter},setBusyEnter:e=>{l.setBusyEnter(e)}})},nE));let u=()=>{let t=[];for(let n of r.entries(`conversation.view`))
|
|
180
183
|
/* v8 ignore next -- list registration validates id at load. */
|
|
181
|
-
n.options.id!==void 0&&(e.configForms.developerTools.enabled.getSnapshot()||n.options.id!==`trajectory`)&&t.push({id:n.options.id,label:(0,p.resolveSlotLabel)(n.options.label)??n.options.id});return t},m=(e,t)=>{let n=
|
|
184
|
+
n.options.id!==void 0&&(e.configForms.developerTools.enabled.getSnapshot()||n.options.id!==`trajectory`)&&t.push({id:n.options.id,label:(0,p.resolveSlotLabel)(n.options.label)??n.options.id});return t},m=(e,t)=>{let n=jE(u(),t);n!==void 0&&o.binding(e).activate(n.id)},h=e=>{m(e,Mc(e))},g=(0,f.createSnapshotStore)(u()),_=/* @__PURE__ */ new Set,v=/* @__PURE__ */ new WeakSet,y=e=>{v.has(e)||(v.add(e),_.add(e),e.ctx.effect(()=>()=>{_.delete(e)},`ui-conversation: active Provider binding`))},ee=()=>{let e=g.getSnapshot(),t=u();e.length===t.length&&e.every((e,n)=>{let r=t.at(n);return r!==void 0&&e.id===r.id&&e.label===r.label})||g.set(t);for(let e of _)n.binding(e.sessionId)===e&&h(e.sessionId)};e.effect(()=>{let t=r.subscribe(`conversation.view`,ee),n=e.locale.subscribe(ee),i=e.configForms.developerTools.enabled.subscribe(ee);return()=>{i(),n(),t()}},`ui-conversation: View selection`);let b=e=>{AD(n,e).cancel().catch(e=>{})},te=(0,f.createSnapshotStore)([]);e.inject([`shortcuts`],t=>{let r=[{id:`fixed.send`,label:()=>s(`input.send`),keys:[`Enter`],bindings:[{code:`Enter`,modifiers:[]}],group:`input`},{id:`fixed.newline`,label:()=>s(`shortcut.newline`),keys:t.shortcuts.describeBinding({code:`Enter`,modifiers:[`shift`]}).keys,bindings:[{code:`Enter`,modifiers:[`shift`]}],group:`input`},{id:`fixed.complementary`,label:()=>s(`shortcut.complementary`),keys:t.shortcuts.describeBinding({code:`Enter`,modifiers:[`primary`]}).keys,bindings:[{code:`Enter`,modifiers:[`control`]},{code:`Enter`,modifiers:[`meta`]}],group:`input`},{id:`fixed.slash`,label:()=>s(`shortcut.slash`),keys:[`/`],bindings:[{code:`Slash`,modifiers:[]}],group:`input`},{id:`fixed.mention`,label:()=>s(`shortcut.mention`),keys:[`@`],bindings:[{code:`Digit2`,modifiers:[`shift`]}],group:`input`}];for(let e of r)t.effect(()=>t.shortcuts.registerFixed(e),`ui-conversation: ${e.id}`);t.effect(()=>yD(t.shortcuts,n,e=>o.binding(e).openTurn,e.uiSession,b),`ui-conversation: fixed stop input`),t.effect(()=>{let e={id:`response.stop`,label:()=>s(`input.stop`),keys:[`Esc`,`Esc`],bindings:[{code:`Escape`,modifiers:[]}],group:`input`},n=t.shortcuts.registerFixed(e);return te.set(e.keys),()=>{te.set([]),n()}},`ui-conversation: fixed stop reference`)});let x=new IT(e,s),ne=new Yc;e.inject([`commandUi`],e=>{let t=e.get(`commandUi`);e.effect(()=>t.register({name:`file`,label:()=>s(`input.file`),icon:d.IconPaperclipOutlineRegular,available:e=>x.canPickFiles(e.sessionId),ui:{kind:`action`,run:e=>{x.pickFiles(e.sessionId)}}}),`ui-conversation: File action`)}),e.uiSession.provide({hooks:[`conversation`,`input`],props:[`inputActions`],resolve:e=>{y(e);let t=x.shellFor(e),n=o.binding(e);return h(e.sessionId),{hooks:{conversation:n.snapshot,input:t.state},props:{inputActions:t.actions}}}});let re=()=>r.register({name:`main.conversation`,children:{"conversation.header":{kind:`single`,scope:`session-maybe`},"conversation.header.notice":{kind:`list`,scope:`session-maybe`}}},mE),ie=()=>r.registerFactory({name:`conversation.content`,scope:`session-maybe`,locale:Ic,children:{"conversation.session":{kind:`single`,scope:`session`},"conversation.composer":{kind:`chain`,scope:`session`},"conversation.composer.bar":{kind:`single`,scope:`session-maybe`},"conversation.input.dock":{kind:`list`,scope:`session`},"conversation.hero.brand.mark":{kind:`single`,scope:`root`},"conversation.hero.workspace":{kind:`single`,scope:`root`},"conversation.hero.agentPreset":{kind:`single`,scope:`session-maybe`}},slots:{views:{scope:`session`},widthControls:{scope:`root`}},inject:t=>({referenceEditor:t===void 0?void 0:x.shell(t).editor,hooks:{composerBlock:t===void 0?CD:ne.storeFor(t)},selectWorkspace:r=>a.openWorkspace(r,r=>{if(t!==void 0&&r!==t){let i=x.shell(t),a=i.draftSnapshot,o=i.snapshot.attachmentIds,s=x.shell(r);if(o.length===0||s.addAttachments(o)){if(n.binding(r)===void 0)throw Error(`ui-conversation: session "${r}" resolved no binding`);if(jD(e).rebindDraftFiles(r,o),a.text!==``&&(s.setDraft(a),i.setDraft(``)),o.length>0)for(let e of o)i.removeAttachment(e)}}})})},DE),ae=()=>r.register({name:`conversation.session`,children:{"conversation.view":{kind:`list`,scope:`session`}},store:c,inject:(e,t)=>{let r=(n,r)=>{u().some(e=>e.id===n)&&(m(e,n),t.openView(n,r))},i=()=>o.views.entries().find(e=>e.toolCallFocus!==void 0&&g.getSnapshot().some(t=>t.id===e.target)),a=e=>{let t=i();t?.toolCallFocus!==void 0&&r(t.target,t.toolCallFocus(e))};return{hooks:{conversationViews:g,inspectCall:{getSnapshot:()=>i()===void 0?void 0:a,subscribe:e=>{let t=g.subscribe(e),n=o.views.subscribe(e);return()=>{t(),n()}}}},bindDraftPersistence:t=>x.shell(e).bindDraftPersistence(t),onRevealResponseAnnotation:t=>n.scope(e)?.on(`conversation/reveal-response-annotation`,t)??(()=>{}),openView:r}}},IE),oe=()=>r.register({name:`conversation.header`,children:{"conversation.header.leading":{kind:`single`,scope:`root`},"conversation.header.navigation":{kind:`single`,scope:`session-maybe`},"conversation.header.shortcuts":{kind:`single`,scope:`session-maybe`},"conversation.header.trailing":{kind:`single`,scope:`root`},"conversation.session.header":{kind:`single`,scope:`session`}}},AE),se=()=>r.register({name:`conversation.session.header`,locale:Ic,children:{"conversation.session.header.lineage":{kind:`single`,scope:`session`},"conversation.session.header.actions":{kind:`list`,scope:`session`},"conversation.session.header.utilities":{kind:`list`,scope:`session`},"conversation.session.header.corner":{kind:`single`,scope:`session`}},store:c,inject:(e,t)=>({hooks:{conversationViews:g},open:e=>{a.openSession(e)},selectView:n=>{m(e,n),t.setView(n)}})},FE),ce=()=>r.register({name:`conversation.composer.bar`,locale:Ic,children:{"conversation.input.attachments":{kind:`single`,scope:`session-maybe`},"conversation.input.overlay":{kind:`list`,scope:`session`},"conversation.input.notice":{kind:`list`,scope:`session`},"conversation.input.permission":{kind:`single`,scope:`session`},"conversation.input.left":{kind:`list`,scope:`session`},"conversation.input.plan":{kind:`single`,scope:`session`},"conversation.input.right":{kind:`list`,scope:`session`},"conversation.input.model":{kind:`single`,scope:`session`},"conversation.input.activity":{kind:`single`,scope:`session`},"conversation.composer.dock":{kind:`list`,scope:`session`}},inject:t=>{if(t===void 0)return{keyboard:void 0,addFiles:void 0,removeAttachment:void 0,resolveDraftAttachments:void 0,retryFileUpload:void 0,revealResponseAnnotation:void 0,toggleCommandMenu:void 0,stop:void 0,hooks:{stopShortcut:te,busyEnter:l.busyEnter,fileUploads:OD,notices:SD,lexicon:TD,menuLauncher:ED}};let r=jD(e),i=x.shell(t),a=x.inputTriggers(t),o=kD();return{keyboard:i,addFiles:(e,a=/* @__PURE__ */ new Set)=>{if(n.binding(t)===void 0)return s(`file.sessionUnavailable`);if(i.snapshot.phase===`adjudicating`||i.snapshot.phase===`submitting`)return s(`attachment.dropBlocked`);let c=[],l=[],u=n.list.getSnapshot().byId[t]?.cwd;for(let t of e){let e=a.has(t);if(o===void 0&&e)return s(`attachment.directoryDesktopOnly`);let n=o?.pathFor(t)??``;if(e&&n===``)return s(`attachment.pathUnavailable`);if(n===``||!e&&qc(t.type)){c.push(t);continue}let r=Fc(n,u),i=Nc({path:e?`${r}/`:r,kind:`file`},!1);if(i===void 0)return s(`attachment.pathUnsupported`);let d=Pc(n)||t.name;l.push({source:`reference`,ref:i,label:e?`${d}/`:d,appearance:e?`folder`:`file`,clipboardText:i})}try{let e=r.createDrafts(t,c);return i.addFiles(l,e.map(e=>e.id))?null:(r.releaseDraftAttachments(e),s(`attachment.dropBlocked`))}catch(e){return e instanceof Error?e.message:String(e)}},removeAttachment:e=>{i.removeAttachment(e)&&r.releaseDraftAttachment(e)},resolveDraftAttachments:e=>r.resolveDraftAttachments(e),retryFileUpload:e=>{n.binding(t)!==void 0&&r.retryFileUpload(t,e)},revealResponseAnnotation:e=>{let r=n.scope(t);r?.emit(r,`conversation/reveal-response-annotation`,e)},toggleCommandMenu:a===void 0?void 0:e=>{i.dismissPopup();let t=i.snapshot;a.toggleSource(`command`,{trigger:`/`,query:``,quoted:!1,position:t.draft.slice(0,e.start).trim()===``?`leading`:`inline`,span:{...e,draftRev:t.draftRev}})},stop:()=>{b(t)},hooks:{stopShortcut:te,busyEnter:l.busyEnter,fileUploads:r.fileUploads,notices:i.notices,lexicon:i.lexicon,menuLauncher:a?.launcher??ED}}}},cD);e.inject([`conversation`],e=>e.slots.inject(`main`,function*(){yield r.register({name:`main`,key:`conversation`,children:{"main.conversation":{kind:`single`,scope:`session-maybe`}}},OE),yield re(),yield ie(),yield ae(),yield oe(),yield se(),yield ce()})),e.plugin(Kc,{input:x,blocks:ne,maxConcurrentFileUploads:i}),e.plugin(_D),e.plugin(QT,x)}return n.Config=xD,n.ConversationController=Kc,n.ConversationDefinitionRegistry=mt,n.ConversationEventRegistry=ht,n.ConversationLocationIndex=Qe,n.ConversationNodeAssembler=dt,n.ConversationViewRegistry=xt,n.EMPTY_CONVERSATION_SNAPSHOT=rE,n.UiConversation=wt,n.apply=MD,n.conversationPhase=iE,n.inject=bD,n.inspectRequestPrompt=Me,t.exports}});
|