@codexhost/cli-darwin-arm64 0.18.0-beta.1 → 0.18.0-beta.3

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.
Files changed (58) hide show
  1. package/README.md +1 -1
  2. package/app/codexhost-distribution.json +1 -1
  3. package/app/console-server.mjs +103 -93
  4. package/app/console-web.js +104 -94
  5. package/app/desktop-controller.mjs +103 -109
  6. package/app/host-runtime.mjs +10067 -8374
  7. package/app/plugins/antigravity/plugin.mjs +103 -93
  8. package/app/plugins/claude-code/plugin.mjs +103 -93
  9. package/app/plugins/codebuddy/plugin.mjs +103 -93
  10. package/app/plugins/codex-usage/plugin.mjs +103 -93
  11. package/app/plugins/copilot/plugin.mjs +103 -93
  12. package/app/plugins/cursor-cli/plugin.mjs +103 -93
  13. package/app/plugins/deepseek-harness/plugin.mjs +103 -93
  14. package/app/plugins/devin/plugin.mjs +103 -93
  15. package/app/plugins/enabled.json +0 -1
  16. package/app/plugins/grok/plugin.mjs +103 -93
  17. package/app/plugins/hermes/plugin.mjs +103 -93
  18. package/app/plugins/kimi-code/plugin.mjs +103 -93
  19. package/app/plugins/kiro-cli/plugin.mjs +103 -93
  20. package/app/plugins/omp/plugin.mjs +103 -93
  21. package/app/plugins/opencode/plugin.mjs +103 -93
  22. package/app/plugins/pi/plugin.mjs +103 -93
  23. package/app/plugins/qoder/plugin.mjs +103 -93
  24. package/app/plugins/qoder-cn/plugin.mjs +103 -93
  25. package/app/plugins/qwen-code/plugin.mjs +103 -93
  26. package/app/plugins/workbuddy/plugin.mjs +103 -93
  27. package/app/plugins/zcode/plugin.mjs +103 -93
  28. package/app/renderer-extension.js +122 -149
  29. package/app/web/assets/index-C3lniEH1.css +1 -0
  30. package/app/web/assets/index-aKvkfNJN.js +199 -0
  31. package/app/web/codexhost-settings.js +104 -94
  32. package/app/web/index.html +2 -2
  33. package/app/web/plugins/deepseek-ai__dsh-api-gateway/client.js +1 -1
  34. package/app/web/plugins/deepseek-ai__dsh-api-remotes/client.js +64 -64
  35. package/app/web/plugins/deepseek-ai__dsh-api-session-controller/client.js +69 -69
  36. package/app/web/plugins/deepseek-ai__dsh-client-ui-chat/client.js +2 -2
  37. package/app/web/plugins/deepseek-ai__dsh-client-ui-codexhost/client.js +63 -62
  38. package/app/web/plugins/deepseek-ai__dsh-client-ui-conversation/client.js +85 -85
  39. package/app/web/plugins/deepseek-ai__dsh-client-ui-directory-picker-browse/client.js +10 -10
  40. package/app/web/plugins/deepseek-ai__dsh-client-ui-input-trigger/client.js +1 -1
  41. package/app/web/plugins/deepseek-ai__dsh-client-ui-layout/client.js +3 -3
  42. package/app/web/plugins/deepseek-ai__dsh-client-ui-model-selection/client.js +2 -2
  43. package/app/web/plugins/deepseek-ai__dsh-client-ui-permission-presets/client.js +1 -1
  44. package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar/client.js +1 -1
  45. package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar-right/client.js +55 -55
  46. package/app/web/plugins/deepseek-ai__dsh-client-ui-tool/client.js +18 -18
  47. package/app/web/plugins/deepseek-ai__dsh-client-ui-workspace/client.js +8 -8
  48. package/app/web/sw.js +55 -24
  49. package/app/web-modules/server.mjs +1091 -680
  50. package/bin/codexhost +0 -0
  51. package/libexec/codexhost-shim +0 -0
  52. package/libexec/codexhost-updater +0 -0
  53. package/package.json +1 -1
  54. package/app/plugins/codex-cli/manifest.json +0 -16
  55. package/app/plugins/codex-cli/plugin.mjs +0 -20374
  56. package/app/web/assets/index-CIeTchMu.css +0 -1
  57. package/app/web/assets/index-DeAPBQbV.js +0 -199
  58. /package/app/{plugins/codex-cli/assets/icon.png → web/codex.png} +0 -0
@@ -1,6 +1,6 @@
1
- window.__ModuleLoader__.load({id:`@deepseek-ai/dsh-client-ui-codexhost`,factory:e=>{var t={exports:{}},n=t.exports;Object.defineProperty(n,Symbol.toStringTag,{value:`Module`});let r=e("@deepseek-ai/dsh-client-ui-primitives"),i=e("react/jsx-runtime"),a=e("@deepseek-ai/dsh-client-store"),o=e("react"),s=e("react-dom");var c;let l=/*@__PURE__*/ Object.freeze({status:`aborted`});function u(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:r,constr:o,traits:/* @__PURE__ */ new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,"name",{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,"init",{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}var d=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},f=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(c=globalThis).__zod_globalConfig??(c.__zod_globalConfig={});let p=globalThis.__zod_globalConfig;function m(e){return e&&Object.assign(p,e),p}function h(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function g(e,t){return typeof t==`bigint`?t.toString():t}function _(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function v(e){return e==null}function y(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function b(e,t){let n=e/t,r=Math.round(n),i=2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}let x=/* @__PURE__*/ Symbol(`evaluating`);function S(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==x)return r===void 0&&(r=x,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function C(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function w(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function T(e){return JSON.stringify(e)}function E(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}let D=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function O(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}let ee=/* @__PURE__*/ _(()=>{if(p.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function te(e){if(O(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return O(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function k(e){return te(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}let ne=/* @__PURE__*/ new Set([`string`,`number`,`symbol`]);function re(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function A(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function j(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function ie(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}let ae={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function oe(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return A(e,w(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return C(this,`shape`,e),e},checks:[]}))}function se(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return A(e,w(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return C(this,`shape`,r),r},checks:[]}))}function ce(e,t){if(!te(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return A(e,w(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return C(this,`shape`,n),n}}))}function le(e,t){if(!te(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return A(e,w(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return C(this,`shape`,n),n}}))}function ue(e,t){if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return A(e,w(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return C(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function de(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return A(t,w(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return C(this,`shape`,i),i},checks:[]}))}function fe(e,t,n){return A(t,w(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return C(this,`shape`,i),i}}))}function pe(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function me(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function he(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function ge(e){return typeof e==`string`?e:e?.message}function _e(e,t,n){let r=e.message?e.message:ge(e.inst?._zod.def?.error?.(e))??ge(t?.error?.(e))??ge(n.customError?.(e))??ge(n.localeError?.(e))??`Invalid input`,{inst:i,continue:a,input:o,...s}=e;return s.path??=[],s.message=r,t?.reportInput&&(s.input=o),s}function ve(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function ye(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}let be=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,g,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},xe=u(`$ZodError`,be),Se=u(`$ZodError`,be,{Parent:Error});function Ce(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function we(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i];i===e.length-1?(r[n]=r[n]||{_errors:[]},r[n]._errors.push(t(a))):r[n]=r[n]||{_errors:[]},r=r[n],i++}}}};return r(e),n}let Te=e=>(t,n,r,i)=>{let a=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new d;if(o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>_e(e,a,m())));throw D(t,i?.callee),t}return o.value},M=e=>async(t,n,r,i)=>{let a=r?{...r,async:!0}:{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>_e(e,a,m())));throw D(t,i?.callee),t}return o.value},Ee=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new d;return a.issues.length?{success:!1,error:new(e??xe)(a.issues.map(e=>_e(e,i,m())))}:{success:!0,data:a.value}},De=/* @__PURE__*/ Ee(Se),Oe=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>_e(e,i,m())))}:{success:!0,data:a.value}},ke=/* @__PURE__*/ Oe(Se),Ae=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Te(e)(t,n,i)},je=e=>(t,n,r)=>Te(e)(t,n,r),Me=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return M(e)(t,n,i)},Ne=e=>async(t,n,r)=>M(e)(t,n,r),Pe=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Ee(e)(t,n,i)},Fe=e=>(t,n,r)=>Ee(e)(t,n,r),Ie=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Oe(e)(t,n,i)},Le=e=>async(t,n,r)=>Oe(e)(t,n,r),Re=/^[cC][0-9a-z]{6,}$/,ze=/^[0-9a-z]+$/,Be=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Ve=/^[0-9a-vA-V]{20}$/,He=/^[A-Za-z0-9]{27}$/,Ue=/^[a-zA-Z0-9_-]{21}$/,We=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Ge=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Ke=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,qe=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;function Je(){return RegExp(`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,`u`)}let Ye=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Xe=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Ze=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Qe=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,$e=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,et=/^[A-Za-z0-9_-]*$/,tt=/^https?$/,nt=/^\+[1-9]\d{6,14}$/,rt=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`,it=/*@__PURE__*/ RegExp(`^${rt}$`);function at(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function ot(e){return RegExp(`^${at(e)}$`)}function st(e){let t=at({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${rt}T(?:${r})$`)}let ct=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},lt=/^-?\d+$/,ut=/^-?\d+(?:\.\d+)?$/,dt=/^(?:true|false)$/i,ft=/^null$/i,pt=/^[^A-Z]*$/,mt=/^[^a-z]*$/,ht=/*@__PURE__*/ u(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),gt={number:`number`,bigint:`bigint`,object:`date`},_t=/*@__PURE__*/ u(`$ZodCheckLessThan`,(e,t)=>{ht.init(e,t);let n=gt[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),vt=/*@__PURE__*/ u(`$ZodCheckGreaterThan`,(e,t)=>{ht.init(e,t);let n=gt[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),yt=/*@__PURE__*/ u(`$ZodCheckMultipleOf`,(e,t)=>{ht.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):b(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),bt=/*@__PURE__*/ u(`$ZodCheckNumberFormat`,(e,t)=>{ht.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=ae[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=lt)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),xt=/*@__PURE__*/ u(`$ZodCheckMaxLength`,(e,t)=>{var n;ht.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!v(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=ve(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),St=/*@__PURE__*/ u(`$ZodCheckMinLength`,(e,t)=>{var n;ht.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!v(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=ve(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Ct=/*@__PURE__*/ u(`$ZodCheckLengthEquals`,(e,t)=>{var n;ht.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!v(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=ve(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),wt=/*@__PURE__*/ u(`$ZodCheckStringFormat`,(e,t)=>{var n,r;ht.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=/* @__PURE__ */ new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Tt=/*@__PURE__*/ u(`$ZodCheckRegex`,(e,t)=>{wt.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Et=/*@__PURE__*/ u(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=pt,wt.init(e,t)}),Dt=/*@__PURE__*/ u(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=mt,wt.init(e,t)}),Ot=/*@__PURE__*/ u(`$ZodCheckIncludes`,(e,t)=>{ht.init(e,t);let n=re(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=/* @__PURE__ */ new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),kt=/*@__PURE__*/ u(`$ZodCheckStartsWith`,(e,t)=>{ht.init(e,t);let n=RegExp(`^${re(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=/* @__PURE__ */ new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),At=/*@__PURE__*/ u(`$ZodCheckEndsWith`,(e,t)=>{ht.init(e,t);let n=RegExp(`.*${re(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=/* @__PURE__ */ new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),jt=/*@__PURE__*/ u(`$ZodCheckOverwrite`,(e,t)=>{ht.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});var Mt=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
1
+ window.__ModuleLoader__.load({id:`@deepseek-ai/dsh-client-ui-codexhost`,factory:e=>{var t={exports:{}},n=t.exports;Object.defineProperty(n,Symbol.toStringTag,{value:`Module`});let r=e("@deepseek-ai/dsh-client-ui-primitives"),i=e("react/jsx-runtime"),a=e("@deepseek-ai/dsh-client-store"),o=e("react"),s=e("react-dom");var c;let l=/*@__PURE__*/ Object.freeze({status:`aborted`});function u(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:r,constr:o,traits:/* @__PURE__ */ new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,"name",{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,"init",{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}var d=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},f=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(c=globalThis).__zod_globalConfig??(c.__zod_globalConfig={});let p=globalThis.__zod_globalConfig;function m(e){return e&&Object.assign(p,e),p}function h(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function g(e,t){return typeof t==`bigint`?t.toString():t}function _(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function v(e){return e==null}function y(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function b(e,t){let n=e/t,r=Math.round(n),i=2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}let x=/* @__PURE__*/ Symbol(`evaluating`);function S(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==x)return r===void 0&&(r=x,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function C(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function w(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function T(e){return JSON.stringify(e)}function E(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}let D=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function O(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}let ee=/* @__PURE__*/ _(()=>{if(p.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function te(e){if(O(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return O(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function k(e){return te(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}let A=/* @__PURE__*/ new Set([`string`,`number`,`symbol`]);function ne(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function j(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function M(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function re(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}let ie={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function ae(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return j(e,w(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return C(this,`shape`,e),e},checks:[]}))}function oe(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return j(e,w(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return C(this,`shape`,r),r},checks:[]}))}function se(e,t){if(!te(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return j(e,w(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return C(this,`shape`,n),n}}))}function ce(e,t){if(!te(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return j(e,w(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return C(this,`shape`,n),n}}))}function le(e,t){if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return j(e,w(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return C(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function ue(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return j(t,w(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return C(this,`shape`,i),i},checks:[]}))}function de(e,t,n){return j(t,w(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return C(this,`shape`,i),i}}))}function fe(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function pe(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function me(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function he(e){return typeof e==`string`?e:e?.message}function ge(e,t,n){let r=e.message?e.message:he(e.inst?._zod.def?.error?.(e))??he(t?.error?.(e))??he(n.customError?.(e))??he(n.localeError?.(e))??`Invalid input`,{inst:i,continue:a,input:o,...s}=e;return s.path??=[],s.message=r,t?.reportInput&&(s.input=o),s}function _e(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function ve(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}let ye=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,g,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},be=u(`$ZodError`,ye),xe=u(`$ZodError`,ye,{Parent:Error});function Se(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function Ce(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i];i===e.length-1?(r[n]=r[n]||{_errors:[]},r[n]._errors.push(t(a))):r[n]=r[n]||{_errors:[]},r=r[n],i++}}}};return r(e),n}let we=e=>(t,n,r,i)=>{let a=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new d;if(o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>ge(e,a,m())));throw D(t,i?.callee),t}return o.value},N=e=>async(t,n,r,i)=>{let a=r?{...r,async:!0}:{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>ge(e,a,m())));throw D(t,i?.callee),t}return o.value},Te=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new d;return a.issues.length?{success:!1,error:new(e??be)(a.issues.map(e=>ge(e,i,m())))}:{success:!0,data:a.value}},Ee=/* @__PURE__*/ Te(xe),De=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>ge(e,i,m())))}:{success:!0,data:a.value}},Oe=/* @__PURE__*/ De(xe),ke=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return we(e)(t,n,i)},Ae=e=>(t,n,r)=>we(e)(t,n,r),je=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return N(e)(t,n,i)},Me=e=>async(t,n,r)=>N(e)(t,n,r),Ne=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Te(e)(t,n,i)},Pe=e=>(t,n,r)=>Te(e)(t,n,r),Fe=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return De(e)(t,n,i)},Ie=e=>async(t,n,r)=>De(e)(t,n,r),Le=/^[cC][0-9a-z]{6,}$/,Re=/^[0-9a-z]+$/,ze=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Be=/^[0-9a-vA-V]{20}$/,Ve=/^[A-Za-z0-9]{27}$/,He=/^[a-zA-Z0-9_-]{21}$/,Ue=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,We=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Ge=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Ke=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;function qe(){return RegExp(`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,`u`)}let Je=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Ye=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Xe=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Ze=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Qe=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,$e=/^[A-Za-z0-9_-]*$/,et=/^https?$/,tt=/^\+[1-9]\d{6,14}$/,nt=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`,rt=/*@__PURE__*/ RegExp(`^${nt}$`);function it(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function at(e){return RegExp(`^${it(e)}$`)}function ot(e){let t=it({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${nt}T(?:${r})$`)}let st=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},ct=/^-?\d+$/,lt=/^-?\d+(?:\.\d+)?$/,ut=/^(?:true|false)$/i,dt=/^null$/i,ft=/^[^A-Z]*$/,pt=/^[^a-z]*$/,mt=/*@__PURE__*/ u(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),ht={number:`number`,bigint:`bigint`,object:`date`},gt=/*@__PURE__*/ u(`$ZodCheckLessThan`,(e,t)=>{mt.init(e,t);let n=ht[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),_t=/*@__PURE__*/ u(`$ZodCheckGreaterThan`,(e,t)=>{mt.init(e,t);let n=ht[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),vt=/*@__PURE__*/ u(`$ZodCheckMultipleOf`,(e,t)=>{mt.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):b(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),yt=/*@__PURE__*/ u(`$ZodCheckNumberFormat`,(e,t)=>{mt.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=ie[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=ct)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),bt=/*@__PURE__*/ u(`$ZodCheckMaxLength`,(e,t)=>{var n;mt.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!v(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=_e(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),xt=/*@__PURE__*/ u(`$ZodCheckMinLength`,(e,t)=>{var n;mt.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!v(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=_e(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),St=/*@__PURE__*/ u(`$ZodCheckLengthEquals`,(e,t)=>{var n;mt.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!v(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=_e(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Ct=/*@__PURE__*/ u(`$ZodCheckStringFormat`,(e,t)=>{var n,r;mt.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=/* @__PURE__ */ new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),wt=/*@__PURE__*/ u(`$ZodCheckRegex`,(e,t)=>{Ct.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Tt=/*@__PURE__*/ u(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=ft,Ct.init(e,t)}),Et=/*@__PURE__*/ u(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=pt,Ct.init(e,t)}),Dt=/*@__PURE__*/ u(`$ZodCheckIncludes`,(e,t)=>{mt.init(e,t);let n=ne(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=/* @__PURE__ */ new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),Ot=/*@__PURE__*/ u(`$ZodCheckStartsWith`,(e,t)=>{mt.init(e,t);let n=RegExp(`^${ne(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=/* @__PURE__ */ new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),kt=/*@__PURE__*/ u(`$ZodCheckEndsWith`,(e,t)=>{mt.init(e,t);let n=RegExp(`.*${ne(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=/* @__PURE__ */ new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),At=/*@__PURE__*/ u(`$ZodCheckOverwrite`,(e,t)=>{mt.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});var jt=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
2
2
  `).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.args,n=[...(this?.content??[``]).map(e=>` ${e}`)];return new e(...t,n.join(`
3
- `))}};let Nt={major:4,minor:4,patch:3},N=/*@__PURE__*/ u(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Nt;let r=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&r.unshift(e);for(let t of r)for(let n of t._zod.onattach)n(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,n)=>{let r=pe(e),i;for(let a of t){if(a._zod.def.when){if(me(e)||!a._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&n?.async===!1)throw new d;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=pe(e,t))});else{if(e.issues.length===t)continue;r||=pe(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(pe(n))return n.aborted=!0,n;let o=t(i,r,a);if(o instanceof Promise){if(a.async===!1)throw new d;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction===`backward`){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,a)):n(t,i,a)}let o=e._zod.parse(i,a);if(o instanceof Promise){if(a.async===!1)throw new d;return o.then(e=>t(e,r,a))}return t(o,r,a)}}S(e,`~standard`,()=>({validate:t=>{try{let n=De(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return ke(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),Pt=/*@__PURE__*/ u(`$ZodString`,(e,t)=>{N.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??ct(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),P=/*@__PURE__*/ u(`$ZodStringFormat`,(e,t)=>{wt.init(e,t),Pt.init(e,t)}),Ft=/*@__PURE__*/ u(`$ZodGUID`,(e,t)=>{t.pattern??=Ge,P.init(e,t)}),It=/*@__PURE__*/ u(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=Ke(e)}else t.pattern??=Ke();P.init(e,t)}),Lt=/*@__PURE__*/ u(`$ZodEmail`,(e,t)=>{t.pattern??=qe,P.init(e,t)}),Rt=/*@__PURE__*/ u(`$ZodURL`,(e,t)=>{P.init(e,t),e._zod.check=n=>{try{let r=n.value.trim();if(!t.normalize&&t.protocol?.source===tt.source&&!/^https?:\/\//i.test(r)){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}let i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(`:`)?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),n.value=t.normalize?i.href:r;return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),zt=/*@__PURE__*/ u(`$ZodEmoji`,(e,t)=>{t.pattern??=Je(),P.init(e,t)}),Bt=/*@__PURE__*/ u(`$ZodNanoID`,(e,t)=>{t.pattern??=Ue,P.init(e,t)}),Vt=/*@__PURE__*/ u(`$ZodCUID`,(e,t)=>{t.pattern??=Re,P.init(e,t)}),Ht=/*@__PURE__*/ u(`$ZodCUID2`,(e,t)=>{t.pattern??=ze,P.init(e,t)}),Ut=/*@__PURE__*/ u(`$ZodULID`,(e,t)=>{t.pattern??=Be,P.init(e,t)}),Wt=/*@__PURE__*/ u(`$ZodXID`,(e,t)=>{t.pattern??=Ve,P.init(e,t)}),Gt=/*@__PURE__*/ u(`$ZodKSUID`,(e,t)=>{t.pattern??=He,P.init(e,t)}),Kt=/*@__PURE__*/ u(`$ZodISODateTime`,(e,t)=>{t.pattern??=st(t),P.init(e,t)}),qt=/*@__PURE__*/ u(`$ZodISODate`,(e,t)=>{t.pattern??=it,P.init(e,t)}),Jt=/*@__PURE__*/ u(`$ZodISOTime`,(e,t)=>{t.pattern??=ot(t),P.init(e,t)}),Yt=/*@__PURE__*/ u(`$ZodISODuration`,(e,t)=>{t.pattern??=We,P.init(e,t)}),Xt=/*@__PURE__*/ u(`$ZodIPv4`,(e,t)=>{t.pattern??=Ye,P.init(e,t),e._zod.bag.format=`ipv4`}),Zt=/*@__PURE__*/ u(`$ZodIPv6`,(e,t)=>{t.pattern??=Xe,P.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}}),Qt=/*@__PURE__*/ u(`$ZodCIDRv4`,(e,t)=>{t.pattern??=Ze,P.init(e,t)}),$t=/*@__PURE__*/ u(`$ZodCIDRv6`,(e,t)=>{t.pattern??=Qe,P.init(e,t),e._zod.check=n=>{let r=n.value.split(`/`);try{if(r.length!==2)throw Error();let[e,t]=r;if(!t)throw Error();let n=Number(t);if(`${n}`!==t||n<0||n>128)throw Error();new URL(`http://[${e}]`)}catch{n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}}});function en(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}let tn=/*@__PURE__*/ u(`$ZodBase64`,(e,t)=>{t.pattern??=$e,P.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{en(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function nn(e){if(!et.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return en(t.padEnd(Math.ceil(t.length/4)*4,`=`))}let rn=/*@__PURE__*/ u(`$ZodBase64URL`,(e,t)=>{t.pattern??=et,P.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{nn(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),an=/*@__PURE__*/ u(`$ZodE164`,(e,t)=>{t.pattern??=nt,P.init(e,t)});function on(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}let sn=/*@__PURE__*/ u(`$ZodJWT`,(e,t)=>{P.init(e,t),e._zod.check=n=>{on(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),cn=/*@__PURE__*/ u(`$ZodNumber`,(e,t)=>{N.init(e,t),e._zod.pattern=e._zod.bag.pattern??ut,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:`Infinity`:void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),ln=/*@__PURE__*/ u(`$ZodNumberFormat`,(e,t)=>{bt.init(e,t),cn.init(e,t)}),un=/*@__PURE__*/ u(`$ZodBoolean`,(e,t)=>{N.init(e,t),e._zod.pattern=dt,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),dn=/*@__PURE__*/ u(`$ZodNull`,(e,t)=>{N.init(e,t),e._zod.pattern=ft,e._zod.values=/* @__PURE__ */ new Set([null]),e._zod.parse=(t,n)=>{let r=t.value;return r===null||t.issues.push({expected:`null`,code:`invalid_type`,input:r,inst:e}),t}}),fn=/*@__PURE__*/ u(`$ZodUnknown`,(e,t)=>{N.init(e,t),e._zod.parse=e=>e}),pn=/*@__PURE__*/ u(`$ZodNever`,(e,t)=>{N.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function mn(e,t,n){e.issues.length&&t.issues.push(...he(n,e.issues)),t.value[n]=e.value}let hn=/*@__PURE__*/ u(`$ZodArray`,(e,t)=>{N.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},r);s instanceof Promise?a.push(s.then(t=>mn(t,n,e))):mn(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function gn(e,t,n,r,i,a){let o=n in r;if(e.issues.length){if(i&&a&&!o)return;t.issues.push(...he(n,e.issues))}!o&&!i?e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]}):e.value===void 0?o&&(t.value[n]=void 0):t.value[n]=e.value}function _n(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let n=ie(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function vn(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optin===`optional`,d=c.optout===`optional`;for(let i in t){if(i===`__proto__`||s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>gn(e,n,i,t,u,d))):gn(a,n,i,t,u,d)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}let yn=/*@__PURE__*/ u(`$ZodObject`,(e,t)=>{if(N.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,"shape",{get:()=>{let n={...e};return Object.defineProperty(t,"shape",{value:n}),n}})}let n=_(()=>_n(t));S(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=/* @__PURE__ */ new Set);for(let e of r.values)n[t].add(e)}}return n});let r=O,i=t.catchall,a;e._zod.parse=(t,o)=>{a??=n.value;let s=t.value;if(!r(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=a.shape;for(let e of a.keys){let n=l[e],r=n._zod.optin===`optional`,i=n._zod.optout===`optional`,a=n._zod.run({value:s[e],issues:[]},o);a instanceof Promise?c.push(a.then(n=>gn(n,t,e,s,r,i))):gn(a,t,e,s,r,i)}return i?vn(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),bn=/*@__PURE__*/ u(`$ZodObjectJIT`,(e,t)=>{yn.init(e,t);let n=e._zod.parse,r=_(()=>_n(t)),i=e=>{let t=new Mt([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=T(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write(`const input = payload.value;`);let a=Object.create(null),o=0;for(let e of n.keys)a[e]=`key_${o++}`;t.write(`const newResult = {};`);for(let r of n.keys){let n=a[r],o=T(r),s=e[r],c=s?._zod?.optin===`optional`,l=s?._zod?.optout===`optional`;t.write(`const ${n} = ${i(r)};`),c&&l?t.write(`
3
+ `))}};let Mt={major:4,minor:4,patch:3},P=/*@__PURE__*/ u(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Mt;let r=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&r.unshift(e);for(let t of r)for(let n of t._zod.onattach)n(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,n)=>{let r=fe(e),i;for(let a of t){if(a._zod.def.when){if(pe(e)||!a._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&n?.async===!1)throw new d;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=fe(e,t))});else{if(e.issues.length===t)continue;r||=fe(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(fe(n))return n.aborted=!0,n;let o=t(i,r,a);if(o instanceof Promise){if(a.async===!1)throw new d;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction===`backward`){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,a)):n(t,i,a)}let o=e._zod.parse(i,a);if(o instanceof Promise){if(a.async===!1)throw new d;return o.then(e=>t(e,r,a))}return t(o,r,a)}}S(e,`~standard`,()=>({validate:t=>{try{let n=Ee(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return Oe(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),Nt=/*@__PURE__*/ u(`$ZodString`,(e,t)=>{P.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??st(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),F=/*@__PURE__*/ u(`$ZodStringFormat`,(e,t)=>{Ct.init(e,t),Nt.init(e,t)}),Pt=/*@__PURE__*/ u(`$ZodGUID`,(e,t)=>{t.pattern??=We,F.init(e,t)}),Ft=/*@__PURE__*/ u(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=Ge(e)}else t.pattern??=Ge();F.init(e,t)}),It=/*@__PURE__*/ u(`$ZodEmail`,(e,t)=>{t.pattern??=Ke,F.init(e,t)}),Lt=/*@__PURE__*/ u(`$ZodURL`,(e,t)=>{F.init(e,t),e._zod.check=n=>{try{let r=n.value.trim();if(!t.normalize&&t.protocol?.source===et.source&&!/^https?:\/\//i.test(r)){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}let i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(`:`)?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),n.value=t.normalize?i.href:r;return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),Rt=/*@__PURE__*/ u(`$ZodEmoji`,(e,t)=>{t.pattern??=qe(),F.init(e,t)}),zt=/*@__PURE__*/ u(`$ZodNanoID`,(e,t)=>{t.pattern??=He,F.init(e,t)}),Bt=/*@__PURE__*/ u(`$ZodCUID`,(e,t)=>{t.pattern??=Le,F.init(e,t)}),Vt=/*@__PURE__*/ u(`$ZodCUID2`,(e,t)=>{t.pattern??=Re,F.init(e,t)}),Ht=/*@__PURE__*/ u(`$ZodULID`,(e,t)=>{t.pattern??=ze,F.init(e,t)}),Ut=/*@__PURE__*/ u(`$ZodXID`,(e,t)=>{t.pattern??=Be,F.init(e,t)}),Wt=/*@__PURE__*/ u(`$ZodKSUID`,(e,t)=>{t.pattern??=Ve,F.init(e,t)}),Gt=/*@__PURE__*/ u(`$ZodISODateTime`,(e,t)=>{t.pattern??=ot(t),F.init(e,t)}),Kt=/*@__PURE__*/ u(`$ZodISODate`,(e,t)=>{t.pattern??=rt,F.init(e,t)}),qt=/*@__PURE__*/ u(`$ZodISOTime`,(e,t)=>{t.pattern??=at(t),F.init(e,t)}),Jt=/*@__PURE__*/ u(`$ZodISODuration`,(e,t)=>{t.pattern??=Ue,F.init(e,t)}),Yt=/*@__PURE__*/ u(`$ZodIPv4`,(e,t)=>{t.pattern??=Je,F.init(e,t),e._zod.bag.format=`ipv4`}),Xt=/*@__PURE__*/ u(`$ZodIPv6`,(e,t)=>{t.pattern??=Ye,F.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}}),Zt=/*@__PURE__*/ u(`$ZodCIDRv4`,(e,t)=>{t.pattern??=Xe,F.init(e,t)}),Qt=/*@__PURE__*/ u(`$ZodCIDRv6`,(e,t)=>{t.pattern??=Ze,F.init(e,t),e._zod.check=n=>{let r=n.value.split(`/`);try{if(r.length!==2)throw Error();let[e,t]=r;if(!t)throw Error();let n=Number(t);if(`${n}`!==t||n<0||n>128)throw Error();new URL(`http://[${e}]`)}catch{n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}}});function $t(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}let en=/*@__PURE__*/ u(`$ZodBase64`,(e,t)=>{t.pattern??=Qe,F.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{$t(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function tn(e){if(!$e.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return $t(t.padEnd(Math.ceil(t.length/4)*4,`=`))}let nn=/*@__PURE__*/ u(`$ZodBase64URL`,(e,t)=>{t.pattern??=$e,F.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{tn(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),rn=/*@__PURE__*/ u(`$ZodE164`,(e,t)=>{t.pattern??=tt,F.init(e,t)});function an(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}let on=/*@__PURE__*/ u(`$ZodJWT`,(e,t)=>{F.init(e,t),e._zod.check=n=>{an(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),sn=/*@__PURE__*/ u(`$ZodNumber`,(e,t)=>{P.init(e,t),e._zod.pattern=e._zod.bag.pattern??lt,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:`Infinity`:void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),cn=/*@__PURE__*/ u(`$ZodNumberFormat`,(e,t)=>{yt.init(e,t),sn.init(e,t)}),ln=/*@__PURE__*/ u(`$ZodBoolean`,(e,t)=>{P.init(e,t),e._zod.pattern=ut,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),un=/*@__PURE__*/ u(`$ZodNull`,(e,t)=>{P.init(e,t),e._zod.pattern=dt,e._zod.values=/* @__PURE__ */ new Set([null]),e._zod.parse=(t,n)=>{let r=t.value;return r===null||t.issues.push({expected:`null`,code:`invalid_type`,input:r,inst:e}),t}}),dn=/*@__PURE__*/ u(`$ZodUnknown`,(e,t)=>{P.init(e,t),e._zod.parse=e=>e}),fn=/*@__PURE__*/ u(`$ZodNever`,(e,t)=>{P.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function pn(e,t,n){e.issues.length&&t.issues.push(...me(n,e.issues)),t.value[n]=e.value}let mn=/*@__PURE__*/ u(`$ZodArray`,(e,t)=>{P.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},r);s instanceof Promise?a.push(s.then(t=>pn(t,n,e))):pn(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function hn(e,t,n,r,i,a){let o=n in r;if(e.issues.length){if(i&&a&&!o)return;t.issues.push(...me(n,e.issues))}!o&&!i?e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]}):e.value===void 0?o&&(t.value[n]=void 0):t.value[n]=e.value}function gn(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let n=re(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function _n(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optin===`optional`,d=c.optout===`optional`;for(let i in t){if(i===`__proto__`||s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>hn(e,n,i,t,u,d))):hn(a,n,i,t,u,d)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}let vn=/*@__PURE__*/ u(`$ZodObject`,(e,t)=>{if(P.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,"shape",{get:()=>{let n={...e};return Object.defineProperty(t,"shape",{value:n}),n}})}let n=_(()=>gn(t));S(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=/* @__PURE__ */ new Set);for(let e of r.values)n[t].add(e)}}return n});let r=O,i=t.catchall,a;e._zod.parse=(t,o)=>{a??=n.value;let s=t.value;if(!r(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=a.shape;for(let e of a.keys){let n=l[e],r=n._zod.optin===`optional`,i=n._zod.optout===`optional`,a=n._zod.run({value:s[e],issues:[]},o);a instanceof Promise?c.push(a.then(n=>hn(n,t,e,s,r,i))):hn(a,t,e,s,r,i)}return i?_n(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),yn=/*@__PURE__*/ u(`$ZodObjectJIT`,(e,t)=>{vn.init(e,t);let n=e._zod.parse,r=_(()=>gn(t)),i=e=>{let t=new jt([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=T(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write(`const input = payload.value;`);let a=Object.create(null),o=0;for(let e of n.keys)a[e]=`key_${o++}`;t.write(`const newResult = {};`);for(let r of n.keys){let n=a[r],o=T(r),s=e[r],c=s?._zod?.optin===`optional`,l=s?._zod?.optout===`optional`;t.write(`const ${n} = ${i(r)};`),c&&l?t.write(`
4
4
  if (${n}.issues.length) {
5
5
  if (${o} in input) {
6
6
  payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
@@ -59,64 +59,65 @@ window.__ModuleLoader__.load({id:`@deepseek-ai/dsh-client-ui-codexhost`,factory:
59
59
  }
60
60
  }
61
61
 
62
- `)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=O,s=!p.jitless,c=s&&ee.value,l=t.catchall,u;e._zod.parse=(d,f)=>{u??=r.value;let p=d.value;return o(p)?s&&c&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),d=a(d,f),l?vn([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function xn(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!pe(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>_e(e,r,m())))}),t)}let Sn=/*@__PURE__*/ u(`$ZodUnion`,(e,t)=>{N.init(e,t),S(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),S(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),S(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),S(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>y(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>xn(t,r,e,i)):xn(o,r,e,i)}}),Cn=/*@__PURE__*/ u(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,Sn.init(e,t);let n=e._zod.parse;S(e._zod,`propValues`,()=>{let e={};for(let n of t.options){let r=n._zod.propValues;if(!r||Object.keys(r).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(let[t,n]of Object.entries(r)){e[t]||(e[t]=/* @__PURE__ */ new Set);for(let r of n)e[t].add(r)}}return e});let r=_(()=>{let e=t.options,n=/* @__PURE__ */ new Map;for(let r of e){let e=r._zod.propValues?.[t.discriminator];if(!e||e.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(let t of e){if(n.has(t))throw Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,r)}}return n});e._zod.parse=(i,a)=>{let o=i.value;if(!O(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=r.value.get(o?.[t.discriminator]);return s?s._zod.run(i,a):t.unionFallback||a.direction===`backward`?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,options:Array.from(r.value.keys()),input:o,path:[t.discriminator],inst:e}),i)}}),wn=/*@__PURE__*/ u(`$ZodIntersection`,(e,t)=>{N.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>En(e,t,n)):En(e,i,a)}});function Tn(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(te(e)&&te(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=Tn(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=Tn(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function En(e,t,n){let r=/* @__PURE__ */ new Map,i;for(let n of t.issues)if(n.code===`unrecognized_keys`){i??=n;for(let e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);for(let t of n.issues)if(t.code===`unrecognized_keys`)for(let e of t.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(t);let a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),pe(e))return e;let o=Tn(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}let Dn=/*@__PURE__*/ u(`$ZodTuple`,(e,t)=>{N.init(e,t);let n=t.items;e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({input:a,inst:e,expected:`tuple`,code:`invalid_type`}),r;r.value=[];let o=[],s=On(n,`optin`),c=On(n,`optout`);if(!t.rest){if(a.length<s)return r.issues.push({code:`too_small`,minimum:s,inclusive:!0,input:a,inst:e,origin:`array`}),r;a.length>n.length&&r.issues.push({code:`too_big`,maximum:n.length,inclusive:!0,input:a,inst:e,origin:`array`})}let l=Array(n.length);for(let e=0;e<n.length;e++){let t=n[e]._zod.run({value:a[e],issues:[]},i);t instanceof Promise?o.push(t.then(t=>{l[e]=t})):l[e]=t}if(t.rest){let e=n.length-1,s=a.slice(n.length);for(let n of s){e++;let a=t.rest._zod.run({value:n,issues:[]},i);a instanceof Promise?o.push(a.then(t=>kn(t,r,e))):kn(a,r,e)}}return o.length?Promise.all(o).then(()=>An(l,r,n,a,c)):An(l,r,n,a,c)}});function On(e,t){for(let n=e.length-1;n>=0;n--)if(e[n]._zod[t]!==`optional`)return n+1;return 0}function kn(e,t,n){e.issues.length&&t.issues.push(...he(n,e.issues)),t.value[n]=e.value}function An(e,t,n,r,i){for(let a=0;a<n.length;a++){let n=e[a],o=a<r.length;if(n.issues.length){if(!o&&a>=i){t.value.length=a;break}t.issues.push(...he(a,n.issues))}t.value[a]=n.value}for(let e=t.value.length-1;e>=r.length&&n[e]._zod.optout===`optional`&&t.value[e]===void 0;e--)t.value.length=e;return t}let jn=/*@__PURE__*/ u(`$ZodRecord`,(e,t)=>{N.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!te(i))return n.issues.push({expected:`record`,code:`invalid_type`,input:i,inst:e}),n;let a=[],o=t.keyType._zod.values;if(o){n.value={};let s=/* @__PURE__ */ new Set;for(let c of o)if(typeof c==`string`||typeof c==`number`||typeof c==`symbol`){s.add(typeof c==`number`?c.toString():c);let o=t.keyType._zod.run({value:c,issues:[]},r);if(o instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(o.issues.length){n.issues.push({code:`invalid_key`,origin:`record`,issues:o.issues.map(e=>_e(e,r,m())),input:c,path:[c],inst:e});continue}let l=o.value,u=t.valueType._zod.run({value:i[c],issues:[]},r);u instanceof Promise?a.push(u.then(e=>{e.issues.length&&n.issues.push(...he(c,e.issues)),n.value[l]=e.value})):(u.issues.length&&n.issues.push(...he(c,u.issues)),n.value[l]=u.value)}let c;for(let e in i)s.has(e)||(c??=[],c.push(e));c&&c.length>0&&n.issues.push({code:`unrecognized_keys`,input:i,inst:e,keys:c})}else{n.value={};for(let o of Reflect.ownKeys(i)){if(o===`__proto__`||!Object.prototype.propertyIsEnumerable.call(i,o))continue;let s=t.keyType._zod.run({value:o,issues:[]},r);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof o==`string`&&ut.test(o)&&s.issues.length){let e=t.keyType._zod.run({value:Number(o),issues:[]},r);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(s=e)}if(s.issues.length){t.mode===`loose`?n.value[o]=i[o]:n.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>_e(e,r,m())),input:o,path:[o],inst:e});continue}let c=t.valueType._zod.run({value:i[o],issues:[]},r);c instanceof Promise?a.push(c.then(e=>{e.issues.length&&n.issues.push(...he(o,e.issues)),n.value[s.value]=e.value})):(c.issues.length&&n.issues.push(...he(o,c.issues)),n.value[s.value]=c.value)}}return a.length?Promise.all(a).then(()=>n):n}}),Mn=/*@__PURE__*/ u(`$ZodEnum`,(e,t)=>{N.init(e,t);let n=h(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>ne.has(typeof e)).map(e=>typeof e==`string`?re(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),Nn=/*@__PURE__*/ u(`$ZodLiteral`,(e,t)=>{if(N.init(e,t),t.values.length===0)throw Error(`Cannot create literal schema with no valid values`);let n=new Set(t.values);e._zod.values=n,e._zod.pattern=RegExp(`^(${t.values.map(e=>typeof e==`string`?re(e):e?re(e.toString()):String(e)).join(`|`)})$`),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),Pn=/*@__PURE__*/ u(`$ZodTransform`,(e,t)=>{N.init(e,t),e._zod.optin=`optional`,e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new f(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n.fallback=!0,n));if(i instanceof Promise)throw new d;return n.value=i,n.fallback=!0,n}});function Fn(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}let In=/*@__PURE__*/ u(`$ZodOptional`,(e,t)=>{N.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,S(e._zod,`values`,()=>t.innerType._zod.values?/* @__PURE__ */ new Set([...t.innerType._zod.values,void 0]):void 0),S(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${y(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=e.value,i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then(e=>Fn(e,r)):Fn(i,r)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),Ln=/*@__PURE__*/ u(`$ZodExactOptional`,(e,t)=>{In.init(e,t),S(e._zod,`values`,()=>t.innerType._zod.values),S(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Rn=/*@__PURE__*/ u(`$ZodNullable`,(e,t)=>{N.init(e,t),S(e._zod,`optin`,()=>t.innerType._zod.optin),S(e._zod,`optout`,()=>t.innerType._zod.optout),S(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${y(e.source)}|null)$`):void 0}),S(e._zod,`values`,()=>t.innerType._zod.values?/* @__PURE__ */ new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),zn=/*@__PURE__*/ u(`$ZodDefault`,(e,t)=>{N.init(e,t),e._zod.optin=`optional`,S(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>Bn(e,t)):Bn(r,t)}});function Bn(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}let Vn=/*@__PURE__*/ u(`$ZodPrefault`,(e,t)=>{N.init(e,t),e._zod.optin=`optional`,S(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),Hn=/*@__PURE__*/ u(`$ZodNonOptional`,(e,t)=>{N.init(e,t),S(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>Un(t,e)):Un(i,e)}});function Un(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}let Wn=/*@__PURE__*/ u(`$ZodCatch`,(e,t)=>{N.init(e,t),e._zod.optin=`optional`,S(e._zod,`optout`,()=>t.innerType._zod.optout),S(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>_e(e,n,m()))},input:e.value}),e.issues=[],e.fallback=!0),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>_e(e,n,m()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),Gn=/*@__PURE__*/ u(`$ZodPipe`,(e,t)=>{N.init(e,t),S(e._zod,`values`,()=>t.in._zod.values),S(e._zod,`optin`,()=>t.in._zod.optin),S(e._zod,`optout`,()=>t.out._zod.optout),S(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>Kn(e,t.in,n)):Kn(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Kn(e,t.out,n)):Kn(r,t.out,n)}});function Kn(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}let qn=/*@__PURE__*/ u(`$ZodReadonly`,(e,t)=>{N.init(e,t),S(e._zod,`propValues`,()=>t.innerType._zod.propValues),S(e._zod,`values`,()=>t.innerType._zod.values),S(e._zod,`optin`,()=>t.innerType?._zod?.optin),S(e._zod,`optout`,()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(Jn):Jn(r)}});function Jn(e){return e.value=Object.freeze(e.value),e}let Yn=/*@__PURE__*/ u(`$ZodLazy`,(e,t)=>{N.init(e,t),S(e._zod,`innerType`,()=>{let e=t;return e._cachedInner||=t.getter(),e._cachedInner}),S(e._zod,`pattern`,()=>e._zod.innerType?._zod?.pattern),S(e._zod,`propValues`,()=>e._zod.innerType?._zod?.propValues),S(e._zod,`optin`,()=>e._zod.innerType?._zod?.optin??void 0),S(e._zod,`optout`,()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),Xn=/*@__PURE__*/ u(`$ZodCustom`,(e,t)=>{ht.init(e,t),N.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>Zn(t,n,r,e));Zn(i,n,r,e)}});function Zn(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(ye(e))}}var Qn,$n=class{constructor(){this._map=/* @__PURE__ */ new WeakMap,this._idmap=/* @__PURE__ */ new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=/* @__PURE__ */ new WeakMap,this._idmap=/* @__PURE__ */ new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function er(){return new $n}(Qn=globalThis).__zod_globalRegistry??(Qn.__zod_globalRegistry=er());let tr=globalThis.__zod_globalRegistry;// @__NO_SIDE_EFFECTS__
63
- function nr(e,t){return new e({type:`string`,...j(t)})}// @__NO_SIDE_EFFECTS__
64
- function rr(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...j(t)})}// @__NO_SIDE_EFFECTS__
65
- function ir(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...j(t)})}// @__NO_SIDE_EFFECTS__
66
- function ar(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...j(t)})}// @__NO_SIDE_EFFECTS__
67
- function or(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...j(t)})}// @__NO_SIDE_EFFECTS__
68
- function sr(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...j(t)})}// @__NO_SIDE_EFFECTS__
69
- function cr(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...j(t)})}// @__NO_SIDE_EFFECTS__
70
- function lr(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...j(t)})}// @__NO_SIDE_EFFECTS__
71
- function ur(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...j(t)})}// @__NO_SIDE_EFFECTS__
72
- function dr(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...j(t)})}// @__NO_SIDE_EFFECTS__
73
- function fr(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...j(t)})}// @__NO_SIDE_EFFECTS__
74
- function pr(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...j(t)})}// @__NO_SIDE_EFFECTS__
75
- function mr(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...j(t)})}// @__NO_SIDE_EFFECTS__
76
- function hr(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...j(t)})}// @__NO_SIDE_EFFECTS__
77
- function gr(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...j(t)})}// @__NO_SIDE_EFFECTS__
78
- function _r(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...j(t)})}// @__NO_SIDE_EFFECTS__
79
- function vr(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...j(t)})}// @__NO_SIDE_EFFECTS__
80
- function yr(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...j(t)})}// @__NO_SIDE_EFFECTS__
81
- function br(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...j(t)})}// @__NO_SIDE_EFFECTS__
82
- function xr(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...j(t)})}// @__NO_SIDE_EFFECTS__
83
- function Sr(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...j(t)})}// @__NO_SIDE_EFFECTS__
84
- function Cr(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...j(t)})}// @__NO_SIDE_EFFECTS__
85
- function wr(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...j(t)})}// @__NO_SIDE_EFFECTS__
86
- function Tr(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...j(t)})}// @__NO_SIDE_EFFECTS__
87
- function Er(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...j(t)})}// @__NO_SIDE_EFFECTS__
88
- function Dr(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...j(t)})}// @__NO_SIDE_EFFECTS__
89
- function Or(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...j(t)})}// @__NO_SIDE_EFFECTS__
90
- function kr(e,t){return new e({type:`number`,checks:[],...j(t)})}// @__NO_SIDE_EFFECTS__
91
- function Ar(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...j(t)})}// @__NO_SIDE_EFFECTS__
92
- function jr(e,t){return new e({type:`boolean`,...j(t)})}// @__NO_SIDE_EFFECTS__
93
- function Mr(e,t){return new e({type:`null`,...j(t)})}// @__NO_SIDE_EFFECTS__
94
- function Nr(e){return new e({type:`unknown`})}// @__NO_SIDE_EFFECTS__
95
- function Pr(e,t){return new e({type:`never`,...j(t)})}// @__NO_SIDE_EFFECTS__
96
- function Fr(e,t){return new _t({check:`less_than`,...j(t),value:e,inclusive:!1})}// @__NO_SIDE_EFFECTS__
97
- function Ir(e,t){return new _t({check:`less_than`,...j(t),value:e,inclusive:!0})}// @__NO_SIDE_EFFECTS__
98
- function Lr(e,t){return new vt({check:`greater_than`,...j(t),value:e,inclusive:!1})}// @__NO_SIDE_EFFECTS__
99
- function Rr(e,t){return new vt({check:`greater_than`,...j(t),value:e,inclusive:!0})}// @__NO_SIDE_EFFECTS__
100
- function zr(e,t){return new yt({check:`multiple_of`,...j(t),value:e})}// @__NO_SIDE_EFFECTS__
101
- function Br(e,t){return new xt({check:`max_length`,...j(t),maximum:e})}// @__NO_SIDE_EFFECTS__
102
- function Vr(e,t){return new St({check:`min_length`,...j(t),minimum:e})}// @__NO_SIDE_EFFECTS__
103
- function Hr(e,t){return new Ct({check:`length_equals`,...j(t),length:e})}// @__NO_SIDE_EFFECTS__
104
- function Ur(e,t){return new Tt({check:`string_format`,format:`regex`,...j(t),pattern:e})}// @__NO_SIDE_EFFECTS__
105
- function Wr(e){return new Et({check:`string_format`,format:`lowercase`,...j(e)})}// @__NO_SIDE_EFFECTS__
106
- function Gr(e){return new Dt({check:`string_format`,format:`uppercase`,...j(e)})}// @__NO_SIDE_EFFECTS__
107
- function Kr(e,t){return new Ot({check:`string_format`,format:`includes`,...j(t),includes:e})}// @__NO_SIDE_EFFECTS__
108
- function qr(e,t){return new kt({check:`string_format`,format:`starts_with`,...j(t),prefix:e})}// @__NO_SIDE_EFFECTS__
109
- function Jr(e,t){return new At({check:`string_format`,format:`ends_with`,...j(t),suffix:e})}// @__NO_SIDE_EFFECTS__
110
- function Yr(e){return new jt({check:`overwrite`,tx:e})}// @__NO_SIDE_EFFECTS__
111
- function Xr(e){return/* @__PURE__ */ Yr(t=>t.normalize(e))}// @__NO_SIDE_EFFECTS__
112
- function Zr(){return/* @__PURE__ */ Yr(e=>e.trim())}// @__NO_SIDE_EFFECTS__
113
- function Qr(){return/* @__PURE__ */ Yr(e=>e.toLowerCase())}// @__NO_SIDE_EFFECTS__
114
- function $r(){return/* @__PURE__ */ Yr(e=>e.toUpperCase())}// @__NO_SIDE_EFFECTS__
115
- function ei(){return/* @__PURE__ */ Yr(e=>E(e))}// @__NO_SIDE_EFFECTS__
116
- function ti(e,t,n){return new e({type:`array`,element:t,...j(n)})}// @__NO_SIDE_EFFECTS__
117
- function ni(e,t,n){let r=j(n);return r.abort??=!0,new e({type:`custom`,check:`custom`,fn:t,...r})}// @__NO_SIDE_EFFECTS__
118
- function ri(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...j(n)})}// @__NO_SIDE_EFFECTS__
119
- function ii(e,t){let n=/* @__PURE__ */ ai(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(ye(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=t.value,r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(ye(r))}},e(t.value,t)),t);return n}// @__NO_SIDE_EFFECTS__
120
- function ai(e,t){let n=new ht({check:`custom`,...j(t)});return n._zod.check=e,n}function oi(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??tr,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:/* @__PURE__ */ new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function F(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,F(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&li(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function si(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=/* @__PURE__ */ new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#/${r}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
62
+ `)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=O,s=!p.jitless,c=s&&ee.value,l=t.catchall,u;e._zod.parse=(d,f)=>{u??=r.value;let p=d.value;return o(p)?s&&c&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),d=a(d,f),l?_n([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function bn(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!fe(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>ge(e,r,m())))}),t)}let xn=/*@__PURE__*/ u(`$ZodUnion`,(e,t)=>{P.init(e,t),S(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),S(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),S(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),S(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>y(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>bn(t,r,e,i)):bn(o,r,e,i)}}),Sn=/*@__PURE__*/ u(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,xn.init(e,t);let n=e._zod.parse;S(e._zod,`propValues`,()=>{let e={};for(let n of t.options){let r=n._zod.propValues;if(!r||Object.keys(r).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(let[t,n]of Object.entries(r)){e[t]||(e[t]=/* @__PURE__ */ new Set);for(let r of n)e[t].add(r)}}return e});let r=_(()=>{let e=t.options,n=/* @__PURE__ */ new Map;for(let r of e){let e=r._zod.propValues?.[t.discriminator];if(!e||e.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(let t of e){if(n.has(t))throw Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,r)}}return n});e._zod.parse=(i,a)=>{let o=i.value;if(!O(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=r.value.get(o?.[t.discriminator]);return s?s._zod.run(i,a):t.unionFallback||a.direction===`backward`?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,options:Array.from(r.value.keys()),input:o,path:[t.discriminator],inst:e}),i)}}),Cn=/*@__PURE__*/ u(`$ZodIntersection`,(e,t)=>{P.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>Tn(e,t,n)):Tn(e,i,a)}});function wn(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(te(e)&&te(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=wn(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=wn(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Tn(e,t,n){let r=/* @__PURE__ */ new Map,i;for(let n of t.issues)if(n.code===`unrecognized_keys`){i??=n;for(let e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);for(let t of n.issues)if(t.code===`unrecognized_keys`)for(let e of t.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(t);let a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),fe(e))return e;let o=wn(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}let En=/*@__PURE__*/ u(`$ZodTuple`,(e,t)=>{P.init(e,t);let n=t.items;e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({input:a,inst:e,expected:`tuple`,code:`invalid_type`}),r;r.value=[];let o=[],s=Dn(n,`optin`),c=Dn(n,`optout`);if(!t.rest){if(a.length<s)return r.issues.push({code:`too_small`,minimum:s,inclusive:!0,input:a,inst:e,origin:`array`}),r;a.length>n.length&&r.issues.push({code:`too_big`,maximum:n.length,inclusive:!0,input:a,inst:e,origin:`array`})}let l=Array(n.length);for(let e=0;e<n.length;e++){let t=n[e]._zod.run({value:a[e],issues:[]},i);t instanceof Promise?o.push(t.then(t=>{l[e]=t})):l[e]=t}if(t.rest){let e=n.length-1,s=a.slice(n.length);for(let n of s){e++;let a=t.rest._zod.run({value:n,issues:[]},i);a instanceof Promise?o.push(a.then(t=>On(t,r,e))):On(a,r,e)}}return o.length?Promise.all(o).then(()=>kn(l,r,n,a,c)):kn(l,r,n,a,c)}});function Dn(e,t){for(let n=e.length-1;n>=0;n--)if(e[n]._zod[t]!==`optional`)return n+1;return 0}function On(e,t,n){e.issues.length&&t.issues.push(...me(n,e.issues)),t.value[n]=e.value}function kn(e,t,n,r,i){for(let a=0;a<n.length;a++){let n=e[a],o=a<r.length;if(n.issues.length){if(!o&&a>=i){t.value.length=a;break}t.issues.push(...me(a,n.issues))}t.value[a]=n.value}for(let e=t.value.length-1;e>=r.length&&n[e]._zod.optout===`optional`&&t.value[e]===void 0;e--)t.value.length=e;return t}let An=/*@__PURE__*/ u(`$ZodRecord`,(e,t)=>{P.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!te(i))return n.issues.push({expected:`record`,code:`invalid_type`,input:i,inst:e}),n;let a=[],o=t.keyType._zod.values;if(o){n.value={};let s=/* @__PURE__ */ new Set;for(let c of o)if(typeof c==`string`||typeof c==`number`||typeof c==`symbol`){s.add(typeof c==`number`?c.toString():c);let o=t.keyType._zod.run({value:c,issues:[]},r);if(o instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(o.issues.length){n.issues.push({code:`invalid_key`,origin:`record`,issues:o.issues.map(e=>ge(e,r,m())),input:c,path:[c],inst:e});continue}let l=o.value,u=t.valueType._zod.run({value:i[c],issues:[]},r);u instanceof Promise?a.push(u.then(e=>{e.issues.length&&n.issues.push(...me(c,e.issues)),n.value[l]=e.value})):(u.issues.length&&n.issues.push(...me(c,u.issues)),n.value[l]=u.value)}let c;for(let e in i)s.has(e)||(c??=[],c.push(e));c&&c.length>0&&n.issues.push({code:`unrecognized_keys`,input:i,inst:e,keys:c})}else{n.value={};for(let o of Reflect.ownKeys(i)){if(o===`__proto__`||!Object.prototype.propertyIsEnumerable.call(i,o))continue;let s=t.keyType._zod.run({value:o,issues:[]},r);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof o==`string`&&lt.test(o)&&s.issues.length){let e=t.keyType._zod.run({value:Number(o),issues:[]},r);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(s=e)}if(s.issues.length){t.mode===`loose`?n.value[o]=i[o]:n.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>ge(e,r,m())),input:o,path:[o],inst:e});continue}let c=t.valueType._zod.run({value:i[o],issues:[]},r);c instanceof Promise?a.push(c.then(e=>{e.issues.length&&n.issues.push(...me(o,e.issues)),n.value[s.value]=e.value})):(c.issues.length&&n.issues.push(...me(o,c.issues)),n.value[s.value]=c.value)}}return a.length?Promise.all(a).then(()=>n):n}}),jn=/*@__PURE__*/ u(`$ZodEnum`,(e,t)=>{P.init(e,t);let n=h(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>A.has(typeof e)).map(e=>typeof e==`string`?ne(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),Mn=/*@__PURE__*/ u(`$ZodLiteral`,(e,t)=>{if(P.init(e,t),t.values.length===0)throw Error(`Cannot create literal schema with no valid values`);let n=new Set(t.values);e._zod.values=n,e._zod.pattern=RegExp(`^(${t.values.map(e=>typeof e==`string`?ne(e):e?ne(e.toString()):String(e)).join(`|`)})$`),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),Nn=/*@__PURE__*/ u(`$ZodTransform`,(e,t)=>{P.init(e,t),e._zod.optin=`optional`,e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new f(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n.fallback=!0,n));if(i instanceof Promise)throw new d;return n.value=i,n.fallback=!0,n}});function Pn(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}let Fn=/*@__PURE__*/ u(`$ZodOptional`,(e,t)=>{P.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,S(e._zod,`values`,()=>t.innerType._zod.values?/* @__PURE__ */ new Set([...t.innerType._zod.values,void 0]):void 0),S(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${y(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=e.value,i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then(e=>Pn(e,r)):Pn(i,r)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),In=/*@__PURE__*/ u(`$ZodExactOptional`,(e,t)=>{Fn.init(e,t),S(e._zod,`values`,()=>t.innerType._zod.values),S(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Ln=/*@__PURE__*/ u(`$ZodNullable`,(e,t)=>{P.init(e,t),S(e._zod,`optin`,()=>t.innerType._zod.optin),S(e._zod,`optout`,()=>t.innerType._zod.optout),S(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${y(e.source)}|null)$`):void 0}),S(e._zod,`values`,()=>t.innerType._zod.values?/* @__PURE__ */ new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),Rn=/*@__PURE__*/ u(`$ZodDefault`,(e,t)=>{P.init(e,t),e._zod.optin=`optional`,S(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>zn(e,t)):zn(r,t)}});function zn(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}let Bn=/*@__PURE__*/ u(`$ZodPrefault`,(e,t)=>{P.init(e,t),e._zod.optin=`optional`,S(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),Vn=/*@__PURE__*/ u(`$ZodNonOptional`,(e,t)=>{P.init(e,t),S(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>Hn(t,e)):Hn(i,e)}});function Hn(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}let Un=/*@__PURE__*/ u(`$ZodCatch`,(e,t)=>{P.init(e,t),e._zod.optin=`optional`,S(e._zod,`optout`,()=>t.innerType._zod.optout),S(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>ge(e,n,m()))},input:e.value}),e.issues=[],e.fallback=!0),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>ge(e,n,m()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),Wn=/*@__PURE__*/ u(`$ZodPipe`,(e,t)=>{P.init(e,t),S(e._zod,`values`,()=>t.in._zod.values),S(e._zod,`optin`,()=>t.in._zod.optin),S(e._zod,`optout`,()=>t.out._zod.optout),S(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>Gn(e,t.in,n)):Gn(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Gn(e,t.out,n)):Gn(r,t.out,n)}});function Gn(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}let Kn=/*@__PURE__*/ u(`$ZodReadonly`,(e,t)=>{P.init(e,t),S(e._zod,`propValues`,()=>t.innerType._zod.propValues),S(e._zod,`values`,()=>t.innerType._zod.values),S(e._zod,`optin`,()=>t.innerType?._zod?.optin),S(e._zod,`optout`,()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(qn):qn(r)}});function qn(e){return e.value=Object.freeze(e.value),e}let Jn=/*@__PURE__*/ u(`$ZodLazy`,(e,t)=>{P.init(e,t),S(e._zod,`innerType`,()=>{let e=t;return e._cachedInner||=t.getter(),e._cachedInner}),S(e._zod,`pattern`,()=>e._zod.innerType?._zod?.pattern),S(e._zod,`propValues`,()=>e._zod.innerType?._zod?.propValues),S(e._zod,`optin`,()=>e._zod.innerType?._zod?.optin??void 0),S(e._zod,`optout`,()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),Yn=/*@__PURE__*/ u(`$ZodCustom`,(e,t)=>{mt.init(e,t),P.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>Xn(t,n,r,e));Xn(i,n,r,e)}});function Xn(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(ve(e))}}var Zn,Qn=class{constructor(){this._map=/* @__PURE__ */ new WeakMap,this._idmap=/* @__PURE__ */ new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=/* @__PURE__ */ new WeakMap,this._idmap=/* @__PURE__ */ new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function $n(){return new Qn}(Zn=globalThis).__zod_globalRegistry??(Zn.__zod_globalRegistry=$n());let er=globalThis.__zod_globalRegistry;// @__NO_SIDE_EFFECTS__
63
+ function tr(e,t){return new e({type:`string`,...M(t)})}// @__NO_SIDE_EFFECTS__
64
+ function nr(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...M(t)})}// @__NO_SIDE_EFFECTS__
65
+ function rr(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...M(t)})}// @__NO_SIDE_EFFECTS__
66
+ function ir(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...M(t)})}// @__NO_SIDE_EFFECTS__
67
+ function ar(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...M(t)})}// @__NO_SIDE_EFFECTS__
68
+ function or(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...M(t)})}// @__NO_SIDE_EFFECTS__
69
+ function sr(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...M(t)})}// @__NO_SIDE_EFFECTS__
70
+ function cr(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...M(t)})}// @__NO_SIDE_EFFECTS__
71
+ function lr(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...M(t)})}// @__NO_SIDE_EFFECTS__
72
+ function ur(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...M(t)})}// @__NO_SIDE_EFFECTS__
73
+ function dr(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...M(t)})}// @__NO_SIDE_EFFECTS__
74
+ function fr(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...M(t)})}// @__NO_SIDE_EFFECTS__
75
+ function pr(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...M(t)})}// @__NO_SIDE_EFFECTS__
76
+ function mr(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...M(t)})}// @__NO_SIDE_EFFECTS__
77
+ function hr(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...M(t)})}// @__NO_SIDE_EFFECTS__
78
+ function gr(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...M(t)})}// @__NO_SIDE_EFFECTS__
79
+ function _r(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...M(t)})}// @__NO_SIDE_EFFECTS__
80
+ function vr(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...M(t)})}// @__NO_SIDE_EFFECTS__
81
+ function yr(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...M(t)})}// @__NO_SIDE_EFFECTS__
82
+ function br(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...M(t)})}// @__NO_SIDE_EFFECTS__
83
+ function xr(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...M(t)})}// @__NO_SIDE_EFFECTS__
84
+ function Sr(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...M(t)})}// @__NO_SIDE_EFFECTS__
85
+ function Cr(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...M(t)})}// @__NO_SIDE_EFFECTS__
86
+ function wr(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...M(t)})}// @__NO_SIDE_EFFECTS__
87
+ function Tr(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...M(t)})}// @__NO_SIDE_EFFECTS__
88
+ function Er(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...M(t)})}// @__NO_SIDE_EFFECTS__
89
+ function Dr(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...M(t)})}// @__NO_SIDE_EFFECTS__
90
+ function Or(e,t){return new e({type:`number`,checks:[],...M(t)})}// @__NO_SIDE_EFFECTS__
91
+ function kr(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...M(t)})}// @__NO_SIDE_EFFECTS__
92
+ function Ar(e,t){return new e({type:`boolean`,...M(t)})}// @__NO_SIDE_EFFECTS__
93
+ function jr(e,t){return new e({type:`null`,...M(t)})}// @__NO_SIDE_EFFECTS__
94
+ function Mr(e){return new e({type:`unknown`})}// @__NO_SIDE_EFFECTS__
95
+ function Nr(e,t){return new e({type:`never`,...M(t)})}// @__NO_SIDE_EFFECTS__
96
+ function Pr(e,t){return new gt({check:`less_than`,...M(t),value:e,inclusive:!1})}// @__NO_SIDE_EFFECTS__
97
+ function Fr(e,t){return new gt({check:`less_than`,...M(t),value:e,inclusive:!0})}// @__NO_SIDE_EFFECTS__
98
+ function Ir(e,t){return new _t({check:`greater_than`,...M(t),value:e,inclusive:!1})}// @__NO_SIDE_EFFECTS__
99
+ function Lr(e,t){return new _t({check:`greater_than`,...M(t),value:e,inclusive:!0})}// @__NO_SIDE_EFFECTS__
100
+ function Rr(e,t){return new vt({check:`multiple_of`,...M(t),value:e})}// @__NO_SIDE_EFFECTS__
101
+ function zr(e,t){return new bt({check:`max_length`,...M(t),maximum:e})}// @__NO_SIDE_EFFECTS__
102
+ function Br(e,t){return new xt({check:`min_length`,...M(t),minimum:e})}// @__NO_SIDE_EFFECTS__
103
+ function Vr(e,t){return new St({check:`length_equals`,...M(t),length:e})}// @__NO_SIDE_EFFECTS__
104
+ function Hr(e,t){return new wt({check:`string_format`,format:`regex`,...M(t),pattern:e})}// @__NO_SIDE_EFFECTS__
105
+ function Ur(e){return new Tt({check:`string_format`,format:`lowercase`,...M(e)})}// @__NO_SIDE_EFFECTS__
106
+ function Wr(e){return new Et({check:`string_format`,format:`uppercase`,...M(e)})}// @__NO_SIDE_EFFECTS__
107
+ function Gr(e,t){return new Dt({check:`string_format`,format:`includes`,...M(t),includes:e})}// @__NO_SIDE_EFFECTS__
108
+ function Kr(e,t){return new Ot({check:`string_format`,format:`starts_with`,...M(t),prefix:e})}// @__NO_SIDE_EFFECTS__
109
+ function qr(e,t){return new kt({check:`string_format`,format:`ends_with`,...M(t),suffix:e})}// @__NO_SIDE_EFFECTS__
110
+ function Jr(e){return new At({check:`overwrite`,tx:e})}// @__NO_SIDE_EFFECTS__
111
+ function Yr(e){return/* @__PURE__ */ Jr(t=>t.normalize(e))}// @__NO_SIDE_EFFECTS__
112
+ function Xr(){return/* @__PURE__ */ Jr(e=>e.trim())}// @__NO_SIDE_EFFECTS__
113
+ function Zr(){return/* @__PURE__ */ Jr(e=>e.toLowerCase())}// @__NO_SIDE_EFFECTS__
114
+ function Qr(){return/* @__PURE__ */ Jr(e=>e.toUpperCase())}// @__NO_SIDE_EFFECTS__
115
+ function $r(){return/* @__PURE__ */ Jr(e=>E(e))}// @__NO_SIDE_EFFECTS__
116
+ function ei(e,t,n){return new e({type:`array`,element:t,...M(n)})}// @__NO_SIDE_EFFECTS__
117
+ function ti(e,t,n){let r=M(n);return r.abort??=!0,new e({type:`custom`,check:`custom`,fn:t,...r})}// @__NO_SIDE_EFFECTS__
118
+ function ni(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...M(n)})}// @__NO_SIDE_EFFECTS__
119
+ function ri(e,t){let n=/* @__PURE__ */ ii(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(ve(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=t.value,r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(ve(r))}},e(t.value,t)),t);return n}// @__NO_SIDE_EFFECTS__
120
+ function ii(e,t){let n=new mt({check:`custom`,...M(t)});return n._zod.check=e,n}function ai(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??er,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:/* @__PURE__ */ new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function I(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,I(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&ci(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function oi(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=/* @__PURE__ */ new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#/${r}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
121
121
 
122
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0])a(n);else{if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}(e.metadataRegistry.get(n[0])?.id||r.cycle||r.count>1&&e.reused===`ref`)&&a(n)}}}function ci(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:di(t,`input`,e.processors),output:di(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function li(e,t){let n=t??{seen:/* @__PURE__ */ new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return li(r.element,n);if(r.type===`set`)return li(r.valueType,n);if(r.type===`lazy`)return li(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`)return li(r.innerType,n);if(r.type===`intersection`)return li(r.left,n)||li(r.right,n);if(r.type===`record`||r.type===`map`)return li(r.keyType,n)||li(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:li(r.in,n)||li(r.out,n);if(r.type===`object`){for(let e in r.shape)if(li(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(li(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(li(e,n))return!0;return!!(r.rest&&li(r.rest,n))}return!1}let ui=(e,t={})=>n=>{let r=oi({...n,processors:t});return F(e,r),si(r,e),ci(r,e)},di=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=oi({...i??{},target:a,io:t,processors:n});return F(e,o),si(o,e),ci(o,e)},fi={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},pi=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=fi[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},mi=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;i.type=typeof s==`string`&&s.includes(`int`)?`integer`:`number`;let d=typeof u==`number`&&u>=(a??-1/0),f=typeof l==`number`&&l<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;d?p?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l:typeof o==`number`&&(i.maximum=o),typeof c==`number`&&(i.multipleOf=c)},hi=(e,t,n,r)=>{n.type=`boolean`},gi=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},_i=(e,t,n,r)=>{n.not={}},vi=(e,t,n,r)=>{let i=e._zod.def,a=h(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},yi=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0){if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a}},bi=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},xi=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},Si=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=F(a.element,t,{...r,path:[...r.path,`items`]})},Ci=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=F(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=F(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},wi=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>F(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Ti=(e,t,n,r)=>{let i=e._zod.def,a=F(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=F(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},Ei=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`array`;let o=t.target===`draft-2020-12`?`prefixItems`:`items`,s=t.target===`draft-2020-12`||t.target===`openapi-3.0`?`items`:`additionalItems`,c=a.items.map((e,n)=>F(e,t,{...r,path:[...r.path,o,n]})),l=a.rest?F(a.rest,t,{...r,path:[...r.path,s,...t.target===`openapi-3.0`?[a.items.length]:[]]}):null;t.target===`draft-2020-12`?(i.prefixItems=c,l&&(i.items=l)):t.target===`openapi-3.0`?(i.items={anyOf:c},l&&i.items.anyOf.push(l),i.minItems=c.length,l||(i.maxItems=c.length)):(i.items=c,l&&(i.additionalItems=l));let{minimum:u,maximum:d}=e._zod.bag;typeof u==`number`&&(i.minItems=u),typeof d==`number`&&(i.maxItems=d)},Di=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag?.patterns;if(a.mode===`loose`&&s&&s.size>0){let e=F(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)i.patternProperties[t.source]=e}else(t.target===`draft-07`||t.target===`draft-2020-12`)&&(i.propertyNames=F(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=F(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]});let c=o._zod.values;if(c){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e)}},Oi=(e,t,n,r)=>{let i=e._zod.def,a=F(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},ki=(e,t,n,r)=>{let i=e._zod.def;F(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Ai=(e,t,n,r)=>{let i=e._zod.def;F(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},ji=(e,t,n,r)=>{let i=e._zod.def;F(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},Mi=(e,t,n,r)=>{let i=e._zod.def;F(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},Ni=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;F(o,t,r);let s=t.seen.get(e);s.ref=o},Pi=(e,t,n,r)=>{let i=e._zod.def;F(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Fi=(e,t,n,r)=>{let i=e._zod.def;F(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Ii=(e,t,n,r)=>{let i=e._zod.innerType;F(i,t,r);let a=t.seen.get(e);a.ref=i},Li=/*@__PURE__*/ u(`ZodISODateTime`,(e,t)=>{Kt.init(e,t),R.init(e,t)});function Ri(e){return/* @__PURE__ */ Tr(Li,e)}let zi=/*@__PURE__*/ u(`ZodISODate`,(e,t)=>{qt.init(e,t),R.init(e,t)});function Bi(e){return/* @__PURE__ */ Er(zi,e)}let Vi=/*@__PURE__*/ u(`ZodISOTime`,(e,t)=>{Jt.init(e,t),R.init(e,t)});function Hi(e){return/* @__PURE__ */ Dr(Vi,e)}let Ui=/*@__PURE__*/ u(`ZodISODuration`,(e,t)=>{Yt.init(e,t),R.init(e,t)});function Wi(e){return/* @__PURE__ */ Or(Ui,e)}let Gi=/*@__PURE__*/ u(`ZodError`,(e,t)=>{xe.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>we(e,t)},flatten:{value:t=>Ce(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,g,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,g,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),Ki=/* @__PURE__ */ Te(Gi),qi=/* @__PURE__ */ M(Gi),Ji=/* @__PURE__ */ Ee(Gi),Yi=/* @__PURE__ */ Oe(Gi),Xi=/* @__PURE__ */ Ae(Gi),Zi=/* @__PURE__ */ je(Gi),Qi=/* @__PURE__ */ Me(Gi),$i=/* @__PURE__ */ Ne(Gi),ea=/* @__PURE__ */ Pe(Gi),ta=/* @__PURE__ */ Fe(Gi),na=/* @__PURE__ */ Ie(Gi),ra=/* @__PURE__ */ Le(Gi),ia=/* @__PURE__ */ new WeakMap;function aa(e,t,n){let r=Object.getPrototypeOf(e),i=ia.get(r);if(i||(i=/* @__PURE__ */ new Set,ia.set(r,i)),!i.has(t)){i.add(t);for(let e in n){let t=n[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,get(){let n=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:n}),n},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}let I=/*@__PURE__*/ u(`ZodType`,(e,t)=>(N.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:di(e,`input`),output:di(e,`output`)}}),e.toJSONSchema=ui(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>Ki(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>Ji(e,t,n),e.parseAsync=async(t,n)=>qi(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>Yi(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>Xi(e,t,n),e.decode=(t,n)=>Zi(e,t,n),e.encodeAsync=async(t,n)=>Qi(e,t,n),e.decodeAsync=async(t,n)=>$i(e,t,n),e.safeEncode=(t,n)=>ea(e,t,n),e.safeDecode=(t,n)=>ta(e,t,n),e.safeEncodeAsync=async(t,n)=>na(e,t,n),e.safeDecodeAsync=async(t,n)=>ra(e,t,n),aa(e,`ZodType`,{check(...e){let t=this.def;return this.clone(w(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return A(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Co(e,t))},superRefine(e,t){return this.check(wo(e,t))},overwrite(e){return this.check(/* @__PURE__ */ Yr(e))},optional(){return to(this)},exactOptional(){return ro(this)},nullable(){return ao(this)},nullish(){return to(ao(this))},nonoptional(e){return fo(this,e)},array(){return V(this)},or(e){return Va([this,e])},and(e){return Ga(this,e)},transform(e){return go(this,$a(e))},default(e){return so(this,e)},prefault(e){return lo(this,e)},catch(e){return mo(this,e)},pipe(e){return go(this,e)},readonly(){return vo(this)},describe(e){let t=this.clone();return tr.add(t,{description:e}),t},meta(...e){if(e.length===0)return tr.get(this);let t=this.clone();return tr.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,"description",{get(){return tr.get(e)?.description},configurable:!0}),e)),oa=/*@__PURE__*/ u(`_ZodString`,(e,t)=>{Pt.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>pi(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,aa(e,`_ZodString`,{regex(...e){return this.check(/* @__PURE__ */ Ur(...e))},includes(...e){return this.check(/* @__PURE__ */ Kr(...e))},startsWith(...e){return this.check(/* @__PURE__ */ qr(...e))},endsWith(...e){return this.check(/* @__PURE__ */ Jr(...e))},min(...e){return this.check(/* @__PURE__ */ Vr(...e))},max(...e){return this.check(/* @__PURE__ */ Br(...e))},length(...e){return this.check(/* @__PURE__ */ Hr(...e))},nonempty(...e){return this.check(/* @__PURE__ */ Vr(1,...e))},lowercase(e){return this.check(/* @__PURE__ */ Wr(e))},uppercase(e){return this.check(/* @__PURE__ */ Gr(e))},trim(){return this.check(/* @__PURE__ */ Zr())},normalize(...e){return this.check(/* @__PURE__ */ Xr(...e))},toLowerCase(){return this.check(/* @__PURE__ */ Qr())},toUpperCase(){return this.check(/* @__PURE__ */ $r())},slugify(){return this.check(/* @__PURE__ */ ei())}})}),sa=/*@__PURE__*/ u(`ZodString`,(e,t)=>{Pt.init(e,t),oa.init(e,t),e.email=t=>e.check(/* @__PURE__ */ rr(ca,t)),e.url=t=>e.check(/* @__PURE__ */ lr(da,t)),e.jwt=t=>e.check(/* @__PURE__ */ wr(Da,t)),e.emoji=t=>e.check(/* @__PURE__ */ ur(pa,t)),e.guid=t=>e.check(/* @__PURE__ */ ir(la,t)),e.uuid=t=>e.check(/* @__PURE__ */ ar(ua,t)),e.uuidv4=t=>e.check(/* @__PURE__ */ or(ua,t)),e.uuidv6=t=>e.check(/* @__PURE__ */ sr(ua,t)),e.uuidv7=t=>e.check(/* @__PURE__ */ cr(ua,t)),e.nanoid=t=>e.check(/* @__PURE__ */ dr(ma,t)),e.guid=t=>e.check(/* @__PURE__ */ ir(la,t)),e.cuid=t=>e.check(/* @__PURE__ */ fr(ha,t)),e.cuid2=t=>e.check(/* @__PURE__ */ pr(ga,t)),e.ulid=t=>e.check(/* @__PURE__ */ mr(_a,t)),e.base64=t=>e.check(/* @__PURE__ */ xr(wa,t)),e.base64url=t=>e.check(/* @__PURE__ */ Sr(Ta,t)),e.xid=t=>e.check(/* @__PURE__ */ hr(va,t)),e.ksuid=t=>e.check(/* @__PURE__ */ gr(ya,t)),e.ipv4=t=>e.check(/* @__PURE__ */ _r(ba,t)),e.ipv6=t=>e.check(/* @__PURE__ */ vr(xa,t)),e.cidrv4=t=>e.check(/* @__PURE__ */ yr(Sa,t)),e.cidrv6=t=>e.check(/* @__PURE__ */ br(Ca,t)),e.e164=t=>e.check(/* @__PURE__ */ Cr(Ea,t)),e.datetime=t=>e.check(Ri(t)),e.date=t=>e.check(Bi(t)),e.time=t=>e.check(Hi(t)),e.duration=t=>e.check(Wi(t))});function L(e){return/* @__PURE__ */ nr(sa,e)}let R=/*@__PURE__*/ u(`ZodStringFormat`,(e,t)=>{P.init(e,t),oa.init(e,t)}),ca=/*@__PURE__*/ u(`ZodEmail`,(e,t)=>{Lt.init(e,t),R.init(e,t)}),la=/*@__PURE__*/ u(`ZodGUID`,(e,t)=>{Ft.init(e,t),R.init(e,t)}),ua=/*@__PURE__*/ u(`ZodUUID`,(e,t)=>{It.init(e,t),R.init(e,t)}),da=/*@__PURE__*/ u(`ZodURL`,(e,t)=>{Rt.init(e,t),R.init(e,t)});function fa(e){return/* @__PURE__ */ lr(da,e)}let pa=/*@__PURE__*/ u(`ZodEmoji`,(e,t)=>{zt.init(e,t),R.init(e,t)}),ma=/*@__PURE__*/ u(`ZodNanoID`,(e,t)=>{Bt.init(e,t),R.init(e,t)}),ha=/*@__PURE__*/ u(`ZodCUID`,(e,t)=>{Vt.init(e,t),R.init(e,t)}),ga=/*@__PURE__*/ u(`ZodCUID2`,(e,t)=>{Ht.init(e,t),R.init(e,t)}),_a=/*@__PURE__*/ u(`ZodULID`,(e,t)=>{Ut.init(e,t),R.init(e,t)}),va=/*@__PURE__*/ u(`ZodXID`,(e,t)=>{Wt.init(e,t),R.init(e,t)}),ya=/*@__PURE__*/ u(`ZodKSUID`,(e,t)=>{Gt.init(e,t),R.init(e,t)}),ba=/*@__PURE__*/ u(`ZodIPv4`,(e,t)=>{Xt.init(e,t),R.init(e,t)}),xa=/*@__PURE__*/ u(`ZodIPv6`,(e,t)=>{Zt.init(e,t),R.init(e,t)}),Sa=/*@__PURE__*/ u(`ZodCIDRv4`,(e,t)=>{Qt.init(e,t),R.init(e,t)}),Ca=/*@__PURE__*/ u(`ZodCIDRv6`,(e,t)=>{$t.init(e,t),R.init(e,t)}),wa=/*@__PURE__*/ u(`ZodBase64`,(e,t)=>{tn.init(e,t),R.init(e,t)}),Ta=/*@__PURE__*/ u(`ZodBase64URL`,(e,t)=>{rn.init(e,t),R.init(e,t)}),Ea=/*@__PURE__*/ u(`ZodE164`,(e,t)=>{an.init(e,t),R.init(e,t)}),Da=/*@__PURE__*/ u(`ZodJWT`,(e,t)=>{sn.init(e,t),R.init(e,t)}),Oa=/*@__PURE__*/ u(`ZodNumber`,(e,t)=>{cn.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>mi(e,t,n,r),aa(e,`ZodNumber`,{gt(e,t){return this.check(/* @__PURE__ */ Lr(e,t))},gte(e,t){return this.check(/* @__PURE__ */ Rr(e,t))},min(e,t){return this.check(/* @__PURE__ */ Rr(e,t))},lt(e,t){return this.check(/* @__PURE__ */ Fr(e,t))},lte(e,t){return this.check(/* @__PURE__ */ Ir(e,t))},max(e,t){return this.check(/* @__PURE__ */ Ir(e,t))},int(e){return this.check(Aa(e))},safe(e){return this.check(Aa(e))},positive(e){return this.check(/* @__PURE__ */ Lr(0,e))},nonnegative(e){return this.check(/* @__PURE__ */ Rr(0,e))},negative(e){return this.check(/* @__PURE__ */ Fr(0,e))},nonpositive(e){return this.check(/* @__PURE__ */ Ir(0,e))},multipleOf(e,t){return this.check(/* @__PURE__ */ zr(e,t))},step(e,t){return this.check(/* @__PURE__ */ zr(e,t))},finite(){return this}});let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function z(e){return/* @__PURE__ */ kr(Oa,e)}let ka=/*@__PURE__*/ u(`ZodNumberFormat`,(e,t)=>{ln.init(e,t),Oa.init(e,t)});function Aa(e){return/* @__PURE__ */ Ar(ka,e)}let ja=/*@__PURE__*/ u(`ZodBoolean`,(e,t)=>{un.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>hi(e,t,n,r)});function B(e){return/* @__PURE__ */ jr(ja,e)}let Ma=/*@__PURE__*/ u(`ZodNull`,(e,t)=>{dn.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>gi(e,t,n,r)});function Na(e){return/* @__PURE__ */ Mr(Ma,e)}let Pa=/*@__PURE__*/ u(`ZodUnknown`,(e,t)=>{fn.init(e,t),I.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Fa(){return/* @__PURE__ */ Nr(Pa)}let Ia=/*@__PURE__*/ u(`ZodNever`,(e,t)=>{pn.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_i(e,t,n,r)});function La(e){return/* @__PURE__ */ Pr(Ia,e)}let Ra=/*@__PURE__*/ u(`ZodArray`,(e,t)=>{hn.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Si(e,t,n,r),e.element=t.element,aa(e,`ZodArray`,{min(e,t){return this.check(/* @__PURE__ */ Vr(e,t))},nonempty(e){return this.check(/* @__PURE__ */ Vr(1,e))},max(e,t){return this.check(/* @__PURE__ */ Br(e,t))},length(e,t){return this.check(/* @__PURE__ */ Hr(e,t))},unwrap(){return this.element}})});function V(e,t){return/* @__PURE__ */ ti(Ra,e,t)}let za=/*@__PURE__*/ u(`ZodObject`,(e,t)=>{bn.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ci(e,t,n,r),S(e,`shape`,()=>t.shape),aa(e,`ZodObject`,{keyof(){return W(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:Fa()})},loose(){return this.clone({...this._zod.def,catchall:Fa()})},strict(){return this.clone({...this._zod.def,catchall:La()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return ce(this,e)},safeExtend(e){return le(this,e)},merge(e){return ue(this,e)},pick(e){return oe(this,e)},omit(e){return se(this,e)},partial(...e){return de(eo,this,e[0])},required(...e){return fe(uo,this,e[0])}})});function H(e,t){let n={type:`object`,shape:e??{},...j(t)};return new za(n)}function U(e,t){return new za({type:`object`,shape:e,catchall:La(),...j(t)})}let Ba=/*@__PURE__*/ u(`ZodUnion`,(e,t)=>{Sn.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wi(e,t,n,r),e.options=t.options});function Va(e,t){return new Ba({type:`union`,options:e,...j(t)})}let Ha=/*@__PURE__*/ u(`ZodDiscriminatedUnion`,(e,t)=>{Ba.init(e,t),Cn.init(e,t)});function Ua(e,t,n){return new Ha({type:`union`,options:t,discriminator:e,...j(n)})}let Wa=/*@__PURE__*/ u(`ZodIntersection`,(e,t)=>{wn.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ti(e,t,n,r)});function Ga(e,t){return new Wa({type:`intersection`,left:e,right:t})}let Ka=/*@__PURE__*/ u(`ZodTuple`,(e,t)=>{Dn.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ei(e,t,n,r),e.rest=t=>e.clone({...e._zod.def,rest:t})});function qa(e,t,n){let r=t instanceof N;return new Ka({type:`tuple`,items:e,rest:r?t:null,...j(r?n:t)})}let Ja=/*@__PURE__*/ u(`ZodRecord`,(e,t)=>{jn.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Di(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function Ya(e,t,n){return!t||!t._zod?new Ja({type:`record`,keyType:L(),valueType:e,...j(t)}):new Ja({type:`record`,keyType:e,valueType:t,...j(n)})}let Xa=/*@__PURE__*/ u(`ZodEnum`,(e,t)=>{Mn.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>vi(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new Xa({...t,checks:[],...j(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new Xa({...t,checks:[],...j(r),entries:i})}});function W(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new Xa({type:`enum`,entries:n,...j(t)})}let Za=/*@__PURE__*/ u(`ZodLiteral`,(e,t)=>{Nn.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>yi(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function G(e,t){return new Za({type:`literal`,values:Array.isArray(e)?e:[e],...j(t)})}let Qa=/*@__PURE__*/ u(`ZodTransform`,(e,t)=>{Pn.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xi(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new f(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(ye(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(ye(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});function $a(e){return new Qa({type:`transform`,transform:e})}let eo=/*@__PURE__*/ u(`ZodOptional`,(e,t)=>{In.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function to(e){return new eo({type:`optional`,innerType:e})}let no=/*@__PURE__*/ u(`ZodExactOptional`,(e,t)=>{Ln.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ro(e){return new no({type:`optional`,innerType:e})}let io=/*@__PURE__*/ u(`ZodNullable`,(e,t)=>{Rn.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Oi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ao(e){return new io({type:`nullable`,innerType:e})}let oo=/*@__PURE__*/ u(`ZodDefault`,(e,t)=>{zn.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ai(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function so(e,t){return new oo({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():k(t)}})}let co=/*@__PURE__*/ u(`ZodPrefault`,(e,t)=>{Vn.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ji(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function lo(e,t){return new co({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():k(t)}})}let uo=/*@__PURE__*/ u(`ZodNonOptional`,(e,t)=>{Hn.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ki(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function fo(e,t){return new uo({type:`nonoptional`,innerType:e,...j(t)})}let po=/*@__PURE__*/ u(`ZodCatch`,(e,t)=>{Wn.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Mi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function mo(e,t){return new po({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}let ho=/*@__PURE__*/ u(`ZodPipe`,(e,t)=>{Gn.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ni(e,t,n,r),e.in=t.in,e.out=t.out});function go(e,t){return new ho({type:`pipe`,in:e,out:t})}let _o=/*@__PURE__*/ u(`ZodReadonly`,(e,t)=>{qn.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Pi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function vo(e){return new _o({type:`readonly`,innerType:e})}let yo=/*@__PURE__*/ u(`ZodLazy`,(e,t)=>{Yn.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ii(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function bo(e){return new yo({type:`lazy`,getter:e})}let xo=/*@__PURE__*/ u(`ZodCustom`,(e,t)=>{Xn.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bi(e,t,n,r)});function So(e,t){return/* @__PURE__ */ ni(xo,e??(()=>!0),t)}function Co(e,t={}){return/* @__PURE__ */ ri(xo,e,t)}function wo(e,t){return/* @__PURE__ */ ii(e,t)}function To(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 Eo=Va([L(),z(),B(),Na()]);function Do(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 Oo=So(Do,{message:`JSON value must not contain circular references`}),ko=bo(()=>Va([Eo,V(ko),Ya(L(),ko)])),Ao=Oo.pipe(ko);Oo.pipe(V(ko));let jo=Oo.pipe(Ya(L(),ko)),Mo=U({code:L().min(1),message:L().min(1),retryable:B(),diagnostic:L().min(1).optional(),stage:L().min(1).optional(),durationMs:z().int().nonnegative().optional(),stderrTail:L().min(1).optional()}).superRefine(To([`diagnostic`,`stage`,`durationMs`,`stderrTail`])),No=L().max(64).regex(/^[a-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/u),Po=e=>L().min(1).max(e).refine(e=>e.trim().length>0),Fo=Ya(No,H({label:Po(256).optional(),description:Po(1024).optional()}).strict()).refine(e=>Object.keys(e).length<=16,`Too many locales`),Io=Ya(No,Po(4096)).refine(e=>typeof e.en==`string`,`English fallback is required`).refine(e=>Object.keys(e).length<=16,`Too many locales`),Lo=L().refine(e=>e.trim().length>0,{message:`Identifier must not be empty or whitespace`}),Ro=Lo.brand(),K=Lo.brand(),zo=Lo.brand();Lo.brand(),Lo.brand();let Bo=L().refine(e=>e.trim().length>0,{message:`Value must not be empty or whitespace`}),Vo=Bo.max(128).regex(/^[A-Za-z0-9._~-]+$/u,`Permission Mode ID must use transport-safe characters`).brand(),Ho=H({modes:V(H({id:Vo,label:Bo.max(256),description:Bo.max(1024).optional(),dangerous:B().optional(),localizations:Fo.optional()}).strict()).min(1).max(32),defaultModeId:Vo}).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`]})});H({threadId:K,permissionModeId:Vo}).strict();let Uo=z().int().safe().nonnegative(),Wo=z().finite().nonnegative(),Go=z().finite().min(0).max(100),Ko=H({value:Wo,turnId:L().min(1).max(1024),at:Uo}).strict();H({outputTokensPerSecond:Ko.optional(),timeToFirstOutputMs:Ko.extend({value:Uo}).optional()}).strict();let qo=e=>Io.refine(t=>Object.values(t).every(t=>t.length<=e)),Jo=H({composerIndicators:V(H({kind:G(`countdown`),id:L().min(1).max(64),expiresAtUnix:Uo,label:qo(256).optional(),tooltip:qo(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:Uo.optional(),cachedInputTokens:Uo.optional(),cacheWriteInputTokens:Uo.optional(),outputTokens:Uo.optional(),outputTokensPerSecond:Wo.optional(),apiOutputTokensPerSecond:Wo.optional(),reasoningOutputTokens:Uo.optional(),totalTokens:Uo.optional(),totalCostUsd:Wo.optional(),totalCredits:Wo.optional(),contextUsagePercent:Wo.optional(),cacheHitRatePercent:Go.optional(),contextWindowTokens:Uo.optional(),contextUsedTokens:Uo.optional(),planFiveHourUsedPercent:Go.optional(),planFiveHourResetsAtUnix:Uo.optional(),planSevenDayUsedPercent:Go.optional(),planSevenDayResetsAtUnix:Uo.optional(),sessionCacheHitRatePercent:Go.optional(),timeToFirstOutputMs:Uo.optional(),costSource:W([`publicPrice`,`native`]).optional(),unpricedModels:V(L().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`]})}),Yo=z().finite().min(0).max(100),Xo=W([`weekly`,`monthly`,`five_hour`,`seven_day`,`unknown`]),Zo=H({id:L().min(1).max(256),label:L().min(1).max(256),localizations:Fo.optional()}).strict(),Qo=H({product:L().min(1),periodType:Xo.optional(),scope:Zo.optional(),localizations:Fo.optional(),used:z().finite().nonnegative().optional(),limit:z().finite().nonnegative().optional(),unit:L().min(1).max(32).optional(),usagePercent:Yo,resetsAt:L().min(1).optional()}).strict(),$o=H({availableCount:z().int().safe().positive(),nextExpiresAt:L().min(1).optional(),expiresAt:V(L().min(1)).min(1).max(32).optional()}).strict(),es=H({used:z().finite().nonnegative().optional(),limit:z().finite().nonnegative().optional(),unit:L().min(1).max(32).optional(),label:L().min(1).optional(),scope:Zo.optional(),localizations:Fo.optional(),usedPercent:Yo,resetsAt:L().min(1).optional(),periodType:Xo,productUsage:V(Qo).min(1).optional(),resetCredits:$o.optional()}).strict();H({threadId:K,refresh:G(`exact`).optional()}).strict(),H({threadId:K,usage:Jo.nullable(),accountCredits:es.optional(),accountCreditsSupported:B().optional()}).strict();let ts=L().refine(e=>e.trim().length>0,{message:`Value must not be empty or whitespace`}),ns=H({id:ts.max(512).regex(/^[A-Za-z0-9._~-]+$/u,`Model Ref must use transport-safe opaque characters`).brand()}).strict(),rs=ts.max(128).regex(/^[A-Za-z0-9._~-]+$/u,`Thinking option ID must use transport-safe characters`).brand(),is=ts.max(256),as=H({id:rs,label:ts.max(256)}).strict(),os=H({ref:ns,label:ts.max(256),resolvedModelLabel:is.optional(),fastModel:ns.optional(),supportedThinkingOptionIds:V(rs).optional()}).strict(),ss=V(as).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)}),cs=H({models:V(os),defaultModel:ns.optional(),thinkingOptions:ss,defaultThinkingOptionId:rs.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`]})}),ls=H({fork:B(),forkAcrossCwd:B(),rollbackLastTurn:B()}).strict().refine(e=>e.fork||!e.forkAcrossCwd,{path:[`forkAcrossCwd`],message:`Cross-cwd Fork requires exact history Fork support`}),us=W([`live`,`atCreate`]),ds=H({configuration:H({selectModel:B(),selectThinkingOption:B(),selectPermissionMode:B(),permissionModeScope:us.default(`live`)}).strict(),history:ls,subagents:H({observe:B(),readTranscript:B()}).strict().optional(),autonomousTurns:H({observe:B()}).strict().optional(),steer:B().optional()}).strict();H({effectiveModel:ns.optional(),resolvedModelLabel:is.optional(),effectiveThinkingOptionId:rs.optional(),availableThinkingOptions:ss.optional(),effectivePermissionModeId:Vo.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 fs=H({open:G(!0)}).strict();Va([H({status:G(`ready`),catalog:cs,permissionModes:Ho.optional(),capabilities:ds,webUi:fs.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`]})}),H({status:W([`notInstalled`,`unavailable`,`error`]),error:Mo}).strict()]),H({harnessId:Ro,cwd:ts.max(16384).optional(),refresh:B().optional(),purpose:G(`availability`).optional()}).strict(),H({harnessId:Ro}).strict(),H({}).strict(),H({threadId:K,model:ns}).strict(),H({threadId:K,thinkingOptionId:rs}).strict(),H({threadId:K,includeReferenceCapability:B().optional()}).strict(),Ua(`owner`,[H({owner:G(`codex`),locked:G(!0),supportsThreadReferences:G(!0).optional()}).strict(),H({owner:G(`external`),harnessId:ts.max(256),transportModelId:ts.max(1024),effectiveModel:ns.optional(),resolvedModelLabel:is.optional(),effectiveThinkingOptionId:rs.optional(),availableThinkingOptions:ss.optional(),effectivePermissionModeId:Vo.optional(),history:ls,usage:Jo.optional(),locked:G(!0)}).strict()]),H({threadIds:V(K).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)}),H({threads:V(Ua(`owner`,[H({threadId:K,owner:G(`codex`)}).strict(),H({threadId:K,owner:G(`external`),harnessId:L().max(256).pipe(Ro)}).strict()])).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)}),H({threadId:K,text:L().optional()}).strict(),H({kind:G(`application`),value:L().transform((e,t)=>{try{return JSON.parse(e)}catch{return t.addIssue({code:`custom`,message:`Invalid steering context JSON`}),l}}).pipe(H({expectedTurnId:zo,clientUserMessageId:L().min(1),delivery:W([`newTurn`,`activeTurn`])}).strict())}).strict().transform(e=>e.value),W([`activeTurn`,`newTurn`]),H({delivery:W([`official`,`activeTurn`,`newTurn`])}).strict(),H({threadIds:V(L().min(1))}).strict(),H({threadId:L().min(1).max(1024),pinned:B()}).strict(),H({prompt:L().max(16384).optional()}).strict(),H({projects:V(H({id:L(),name:L(),rootPaths:V(L())})),assignments:Ya(L(),L()),projectless:V(L()),pinned:V(L())});let ps=Ya(L(),Fa()),ms=H({epoch:L().uuid(),sequence:z().int().nonnegative()});Ua(`type`,[H({type:G(`display-settings-changed`),cursor:ms}),H({type:G(`preferences-changed`),cursor:ms,revision:z().int().nonnegative()}),H({type:G(`hello`),version:G(1),cursor:ms,reset:B()}),H({type:G(`changed`),cursor:ms,threadId:L().min(1),method:L().min(1)})]);let hs=Ua(`type`,[H({type:G(`text`),id:L(),prompt:L(),secret:B().optional(),optional:B().optional()}),H({type:G(`choice`),id:L(),prompt:L(),multiple:B(),allowOther:B(),optional:B().optional(),options:V(H({value:L(),label:L(),description:L().optional()}))})]),gs=Ua(`type`,[H({type:G(`approval`),title:L(),description:L().optional(),subject:Fa().optional(),actions:V(H({id:L(),label:L(),effect:L()}))}),H({type:G(`question`),title:L().optional(),questions:V(hs)})]),_s=H({requestId:Va([L(),z().int()]),threadId:L(),kind:W([`approval`,`question`]),interaction:gs,request:ps}),vs=H({id:L().min(1),clientUserMessageId:L().min(1),input:V(ps),presentationInput:V(ps).nullable().optional()}).passthrough();H({fields:V(H({path:V(Va([L(),z().int().nonnegative()])),originalLength:z().int().nonnegative()}))});let ys=H({id:L().min(1),status:L().min(1),items:V(H({id:L().min(1),type:L().min(1)}).passthrough()),codexhostFileOperations:V(H({beforeItemId:L().nullable(),item:H({id:L().min(1),type:L().min(1)}).passthrough()})).optional(),error:H({message:L().optional()}).passthrough().nullable().optional(),fingerprint:L().min(1).optional(),unchanged:G(!0).optional()}).passthrough(),bs=H({id:L().min(1).max(512),fingerprint:L().min(1).max(128)});H({threadId:L().min(1),knownTurns:V(bs).max(64).optional(),truncateToolOutput:B().optional()});let xs=H({harnessId:L().min(1),nativeSessionId:L().min(1)});H({cursor:ms,activeTurnId:L().min(1).nullable().optional(),command:H({name:L().min(1),turn:ys}).optional(),thread:H({id:L().min(1),cwd:L(),modelProvider:G(`codexhost`),createdAt:z(),updatedAt:z(),status:H({type:L()}).passthrough(),name:L().nullable().optional(),preview:L().optional(),codexhostImportSource:xs.optional(),turns:V(ys).length(0)}).passthrough(),turnsPage:H({data:V(ys).max(5),nextCursor:L().nullable()}),configuration:H({effectiveModel:ns.optional(),effectiveThinkingOptionId:rs.optional(),effectivePermissionModeId:Vo.optional()}),queue:H({items:V(vs),pausedReason:W([`interrupted`,`outcome-unknown`,`failed`]).nullable()}).optional(),interactions:V(_s)}),H({version:G(1),owner:G(`service`).optional(),pid:z().int().positive(),port:z().int().min(1).max(65535),token:L().regex(/^[0-9a-f]{64}$/u),startedAt:z(),epoch:L().uuid()}),H({epoch:L().uuid(),threadId:L().min(1),requestId:Va([L(),z().int()]),result:ps});let Ss=L().regex(/^audio\/[a-z0-9.+-]+(?:\s*;[^\r\n]*)?$/i),Cs=H({available:B()}).strict();H({path:L().min(1),mimeType:Ss}).strict();let ws=W([`credentials-unavailable`,`login-expired`,`rate-limited`,`service-rejected`,`host-incompatible`,`network`,`timeout`,`audio-empty`,`audio-too-large`,`audio-format`,`audio-invalid`]),Ts=Ua(`ok`,[H({ok:G(!0),text:L()}).strict(),H({ok:G(!1),error:H({code:ws}).strict()}).strict()]),Es=H({kind:W([`public`,`relay`,`tailscale-funnel`,`tailscale-https`,`tailscale`,`lan`,`virtual`]),url:L().min(1)}).strict(),Ds=Ua(`status`,[H({status:G(`not-installed`)}),H({status:G(`not-running`)}),H({status:G(`not-logged-in`)}),H({status:G(`https-disabled`)}),H({status:G(`not-serving`),command:L()}),H({status:G(`occupied`),target:L()}),H({status:G(`serving`),url:L(),funnel:B()}),H({status:G(`error`),message:L()})]),Os=H({state:Ds,error:L().optional()}).strict(),ks=Ua(`status`,[H({status:G(`on`)}),H({status:G(`off`)}),H({status:G(`invalid`),reason:L()})]),As=H({lan:B(),autostart:ks}).strict(),js=H({expiresAt:L().optional(),issuing:B(),failure:H({detail:L().optional(),retryAt:L(),paused:B()}).optional()}),Ms=Ua(`status`,[H({status:G(`off`),reason:W([`invite`,`name-taken`,`banned`]).optional()}),H({status:G(`connecting`),reason:W([`full`,`unreachable`]).optional()}),H({status:G(`connected`),url:L(),certificate:js}),H({status:G(`missing-certificate`),url:L(),certificate:js}),H({status:G(`stopped`),reason:W([`replaced`,`rejected`,`unsupported-version`])})]),Ns=L().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()),Ps=L().regex(/^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)?$/),Fs=W([`official`,`self-hosted`]),Is=H({secret:L().min(1),lastUsedAt:z().nullable(),networkUrls:V(Es),directCandidates:V(Es).optional(),tailscale:Ds,background:As.optional(),relay:H({state:Ms,enabled:B(),kind:Fs,officialHost:L(),customHost:L().optional(),officialHostname:L().optional(),customHostname:L().optional(),quotaUntil:L().optional()}).strict().optional()}).strict(),Ls=H({url:L()}).strict(),Rs=U({threadId:L().min(1).max(1024),view:W([`result`,`messages`]),cursor:L().min(1).max(8192).optional(),limit:z().int().min(1).max(100).optional()}),zs=H({id:L().min(1).max(256),harnessId:L().min(1),label:L().min(1).max(512),provider:W([`openai-codex`,`xai`])}).strict(),Bs=L().regex(/^[a-z][a-z0-9-]{0,47}$/),Vs=H({name:Bs,source:zs,importedAt:L()}).strict(),Hs=Ua(`action`,[H({action:G(`list`)}).strict(),H({action:G(`import`),sourceId:L().min(1).max(256),name:Bs,confirmed:G(!0)}).strict(),H({action:G(`reimport`),sourceId:L().min(1).max(256),name:Bs,confirmed:G(!0)}).strict(),H({action:G(`remove`),name:Bs,confirmed:G(!0)}).strict()]),Us=H({provider:L().min(1).max(128),type:W([`oauth`,`api_key`,`unknown`]),label:L().min(1).max(512).optional(),vendor:W([`openai-codex`,`xai`]).optional()}).strict();H({sources:V(zs),targets:V(H({harnessId:L(),providers:V(W([`openai-codex`,`xai`])),imports:V(Vs),others:V(Us).default([])}).strict())}).strict(),H({targetHarnessId:L().min(1).max(128).optional(),request:Hs}).strict(),H({events:B()});let Ws=V(U({agent:L().min(1).max(128),section:W([`main`,`more`,`auto`])})).max(256).refine(e=>new Set(e.map(e=>e.agent)).size===e.length,`Duplicate Harness IDs`);U({entries:Ws.nullable()}),U({}),U({entries:Ws,initializeOnly:B().optional()});let Gs=U({enabled:B(),timeoutMinutes:z().int().min(5).max(1440)});Object.freeze({enabled:!1,timeoutMinutes:30});let Ks=[`desktop`,`web`],qs=W(Ks),Js=L().min(1).max(128).regex(/^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/u).pipe(Ro),Ys=Js.refine(e=>e!==`codex`,`The official Codex identity is reserved`),Xs=L().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`),Zs=fa().refine(e=>/^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(e),`Plugin documentation links must be credential-free HTTPS URLs`),Qs=H({en:L().max(4096),"zh-CN":L().max(4096).optional()}).strict(),$s=H({commands:V(H({terminal:L().max(256),command:L().max(4096)}).strict()).max(8),before:Qs.optional(),after:Qs.optional(),downloads:V(H({label:L().max(128),url:Zs}).strict()).max(8).optional()}).strict(),ec={id:Js,name:L().trim().min(1).max(128),version:L().min(1).max(128),kind:G(`usage`).optional(),iconStyle:H({vector:H({viewBox:L().max(128).regex(/^-?\d+(?:\.\d+)?(?: +-?\d+(?:\.\d+)?){3}$/u),color:L().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu),paths:V(H({d:L().min(1).max(32768).regex(/^[MmLlHhVvCcSsQqTtAaZz\d.,+eE\s-]+$/u),fillRule:W([`evenodd`,`nonzero`]).optional(),fill:L().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu).optional()}).strict()).min(1).max(32)}).strict().optional(),background:L().regex(/^#[a-f0-9]{6}$/iu).optional(),borderRadius:z().min(0).max(50).optional(),paddingRatio:z().min(0).max(.25).optional()}).strict().optional(),installation:$s.optional(),notice:Qs.optional(),launchCommand:G(!0).optional(),links:H({website:Zs.optional(),documentation:Zs.optional(),installation:Zs.optional()}).strict().optional()},tc=V(qs).min(1).max(Ks.length).refine(e=>new Set(e).size===e.length,{message:`Plugin surfaces must be unique`});H({manifestVersion:G(1),...ec,adapterApiVersion:z().int().positive(),entry:Xs,icon:Xs.optional(),surfaces:tc.optional()}).strict();let nc=L().max(174828).regex(/^data:image\/(?:png|jpeg|webp|svg\+xml);base64,[A-Za-z0-9+/]+={0,2}$/u),rc=H({...ec,icon:nc.optional()}).strict();H({}).strict(),H({plugins:V(rc.extend({id:Ys})).max(128)}).strict(),H({version:G(1),enabled:V(Js).max(128)}).strict().refine(e=>new Set(e.enabled).size===e.enabled.length,{message:`Enabled plugin IDs must be unique`,path:[`enabled`]});let ic=L().regex(/^external$/u),ac=Js.transform(e=>String(e)),oc=U({model:ns.optional(),thinkingOptionId:rs.optional(),permissionModeId:Vo.optional()}).refine(e=>!!(e.model||e.thinkingOptionId||e.permissionModeId),`A default configuration must contain a preference`),sc=U({lastHarness:Js.optional(),byHarness:Ya(ac,oc)}),cc=L().min(1).max(1024),lc=U({idleRelease:Gs.optional(),favorites:Ya(ac,V(cc).max(2048)).default({}),newThread:sc.optional()});U({scope:ic,revision:z().int().nonnegative(),values:lc}),U({scope:ic.default(`external`)});let uc=Ua(`kind`,[U({kind:G(`idleRelease`),value:Gs}),U({kind:G(`favorite`),harnessId:Js,modelId:cc,enabled:B()}),U({kind:G(`favorites`),harnessId:Js,modelIds:V(cc).max(2048)}),U({kind:G(`newThread`),lastHarness:Js.optional(),harnessId:Js.optional(),configuration:oc.optional()})]);U({scope:ic.default(`external`),operations:V(uc).min(1).max(256),initializeOnly:B().optional(),expectedRevision:z().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`}),(`harnessId`in n?n.harnessId:void 0)===`codex`&&t.addIssue({code:`custom`,message:`Official Codex is not an external Harness`})}),U({version:G(1),revision:z().int().nonnegative(),scopes:Ya(ic,lc)});let dc=z().finite().nonnegative(),fc=U({input:dc,output:dc,cacheRead:dc.optional(),cacheWrite:dc.optional(),cacheWrite1h:dc.optional()}),pc=L().max(512).refine(e=>e.trim()===e&&e.length>0,`Model ID is required`);U({path:L(),entries:V(U({key:L(),price:fc})),error:L().nullable()}),U({}),U({key:pc,price:fc.nullable(),previousKey:pc.optional()}),U({model:pc});let mc=U({official:B().optional(),canonicalModelId:L().min(1).optional(),provider:L().min(1).max(512),model:L().min(1).max(512),price:fc});U({price:fc.nullable(),suggestions:V(mc).max(6).optional()});let hc=[`today`,`7d`,`30d`,`90d`,`all`],gc=z().int().min(0).max(2**53-1),_c=L().regex(/^\d{4}-\d{2}-\d{2}$/u),vc=L().min(1).max(128),yc=L().min(1).max(512),bc=L().min(1).max(4096);U({range:W(hc),timeZone:L().min(1).max(128).refine(e=>{try{return new Intl.DateTimeFormat(`en`,{timeZone:e}),!0}catch{return!1}},`Unsupported usage statistics timezone`).optional(),harness:vc.optional(),model:yc.nullable().optional(),project:bc.nullable().optional(),date:_c.optional()});let xc=U({requests:gc,inputTokens:gc,cachedInputTokens:gc,cacheWriteInputTokens:gc,cacheKnownInputTokens:gc,cacheHitCachedInputTokens:gc,cacheHitInputTokens:gc,outputTokens:gc,reasoningOutputTokens:gc,costUsd:z().finite().min(0),unpricedRequests:gc,unmeteredRequests:gc}),Sc=xc.shape,Cc=U({harness:vc,sessionId:L().min(1).max(512),project:bc.nullable(),title:L().min(1).max(200).optional(),models:V(yc).max(16),firstAtMs:gc,lastAtMs:gc,...Sc});U({range:W(hc),from:_c.nullable(),to:_c,filters:U({harness:vc.nullable(),model:yc.nullable(),unknownModel:B(),project:bc.nullable(),unknownProject:B(),date:_c.nullable()}),reading:U({complete:B(),sources:gc,read:gc}),failures:V(U({harness:vc,message:L().max(2048)})).max(256),options:U({harnesses:V(vc).max(256),models:V(yc.nullable()).max(4096),projects:V(bc.nullable()).max(4096)}),modelLabels:V(U({harness:vc,model:yc,label:yc})).max(4096).optional(),credits:V(U({harness:vc,model:yc.nullable(),credits:z().finite().min(0),reportedRequests:gc,requests:gc})).max(4096).optional(),totals:xc,daily:V(U({date:_c,harness:vc,...Sc})).max(2e5),hourly:V(U({weekday:z().int().min(0).max(6),hour:z().int().min(0).max(23),...Sc})).max(168),byHarness:V(U({harness:vc,...Sc})).max(256),byModel:V(U({model:yc.nullable(),...Sc,harnessPricedRequests:gc})).max(4096),byProject:V(U({project:bc.nullable(),...Sc})).max(4096),sessions:V(Cc).max(100),recentSessions:V(Cc).max(100).optional()}),H({threadId:K}),H({discarded:B()});let wc=Ua(`type`,[H({id:L().min(1),type:G(`choice`),prompt:L(),options:V(H({value:L().min(1),label:L(),description:L().optional()})).min(1),multiple:B(),allowOther:B(),optional:B()}),H({id:L().min(1),type:G(`text`),prompt:L(),multiline:B(),secret:G(!1),optional:B(),placeholder:L().optional(),prefill:L().optional()})]),Tc=H({interactionId:L().min(1),turnId:L().min(1),title:L().optional(),questions:V(wc).min(1)}).refine(({questions:e})=>e.some(e=>e.type===`choice`&&e.multiple),{message:`Shared cards require at least one multi-select question`});U({threadId:L().min(1)}),H({questions:V(Tc)}),U({threadId:L().min(1),turnId:L().min(1),interactionId:L().min(1),answers:Ya(L(),V(L())),cancelled:B().default(!1)}),H({accepted:G(!0)});let Ec=H({path:L(),oldText:L().nullable(),newText:L()});H({sessionId:L().min(1),turn:z().int().nonnegative(),path:L().min(1).optional()});let Dc=H({diffs:V(Ec)});U({}),U({}),H({reference:H({sessionId:L().min(1),epoch:L().min(1),turn:z().int().nonnegative(),seq:z().int().nonnegative(),callId:L().min(1),part:z().int().nonnegative(),version:L().min(1)}),length:z().int().nonnegative(),bytes:z().int().nonnegative()}),U({title:L().trim().min(1).max(200),type:W([`info`,`warning`,`danger`]),body:L().trim().min(1).max(16384)}),U({}),U({url:L().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 Oc=W([`idle`,`running`,`busy`,`closing`,`failed`,`blocked`]),kc=W([`none`,`disabled`,`timeout`,`operation`,`background`,`identity`,`persistence`,`closeFailed`]);U({threadId:L(),title:L(),harnessId:L(),state:Oc,reason:kc,inactiveMs:z().nonnegative()}),U({threadId:K,turnId:zo});let Ac=H({amount:z().finite().nonnegative(),currency:L().trim().min(1).max(8),label:L().trim().min(1).max(128).optional()}).strict(),jc=H({email:L().trim().min(1).max(320).optional(),label:L().trim().min(1).max(256).optional(),plan:L().trim().min(1).max(128).optional(),credits:es.optional(),balance:Ac.optional()}).strict();function Mc(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 Nc=Mc(jc),Pc={harnessId:Ro,harnessName:L().trim().min(1).max(128)},Fc=H(Pc).strict();H({}).strict(),H({sources:V(Fc).max(128)}).strict(),H({harnessId:Ro,refresh:B().optional()}).strict(),H({...Pc,account:Nc.nullable(),accounts:V(Nc).max(8).optional()}).strict(),H({refresh:B().optional()}).strict(),H({accounts:V(Mc(jc.extend(Pc))).max(128)}).strict(),H({harnessId:Ys,model:ns.optional(),thinkingOptionId:rs.optional(),permissionModeId:Vo.optional(),prewarm:G(!0).optional()}).strict();let Ic=L().trim().min(1).max(4096).refine(e=>!/[\u0000\r\n]/u.test(e),`Invalid entrypoint path`);H({harnessId:Ys}).strict().extend({path:Ic.nullable()}),H({path:Ic.nullable(),restartRequired:B()}).strict(),H({harnessId:Ro,action:W([`check`,`update`,`install`])}).strict();let Lc=H({currentVersion:L().min(1).max(128),latestVersion:L().min(1).max(128),updateAvailable:B(),canUpdate:B(),versionKind:W([`cli`,`application`]).optional(),manualUpdateUrl:fa().max(2048).refine(e=>/^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(e),`Manual updates require a credential-free HTTPS URL`).optional(),message:L().max(2048).optional(),messageCode:L().min(1).max(128).optional(),notice:Io.optional(),latestVersionKind:W([`unknown`,`tracking-branch`]).optional()}).strict();H({taskId:L().uuid()}).strict(),Ua(`status`,[H({taskId:L().uuid(),status:G(`running`)}).strict(),H({taskId:L().uuid(),status:G(`succeeded`),result:Lc}).strict(),H({taskId:L().uuid(),status:G(`failed`),error:H({code:z().int(),message:L().min(1).max(2048)}).strict()}).strict()]);let Rc=L().min(1).max(256).regex(/^[A-Za-z0-9._~-]+$/u),zc=L().trim().min(1),Bc=W([`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`]),Vc=H({accountId:Rc,label:zc.max(256),email:L().email().max(320).optional(),planType:Bc.optional()}).strict(),Hc=W([`ready`,`unavailable`]);H({version:G(2),currentAccountId:Rc.nullable(),phase:Hc,revision:z().int().nonnegative(),instanceId:zc.max(1024).optional(),accounts:V(Vc).max(1)}).strict(),H({accountId:Rc,refresh:B().optional()}).strict(),H({accountId:Rc,usage:Jo.nullable(),accountCredits:es.optional(),freshness:W([`live`,`cached`]),observedAt:L().datetime().nullable()}).strict();let Uc=1e3,Wc=L().refine(e=>e.trim().length>0,`Value must not be empty or whitespace`).refine(e=>!e.includes(`\0`),`Value must not contain NUL`),Gc=Wc.max(1024),Kc=H({nativeSessionId:Gc,title:Wc.max(4096).nullable(),updatedAt:z().int().nonnegative().max(864e13),cwd:Wc.max(16384),running:B().nullable()}).strict();H({}).strict();let qc=H({harnesses:V(H({harnessId:Ys,name:Wc.max(128)}).strict()).max(128)}).strict();H({harnessId:Ys,query:L().trim().max(4096).refine(e=>!e.includes(`\0`)).optional(),offset:z().int().nonnegative().safe().optional(),limit:z().int().min(1).max(Uc).optional()}).strict();let Jc=H({candidates:V(Kc).max(Uc),total:z().int().nonnegative().safe()}).strict();H({harnessId:Ys,nativeSessionId:Gc}).strict();let Yc=H({threadId:Wc.max(1024).pipe(K)}).strict(),Xc=L().refine(e=>e.trim().length>0,`Value must not be empty or whitespace`).refine(e=>!e.includes(`\0`),`Value must not contain NUL`),Zc=Gc,Qc=Kc;H({}).strict(),H({candidates:V(Qc).max(1e3)}).strict(),H({nativeSessionId:Zc}).strict(),H({threadId:Xc.max(1024).pipe(K)}).strict(),H({threadId:K,lastTurnId:zo}).strict(),H({threadId:K}).strict();let $c=L().trim().min(1).max(128).regex(/^[A-Za-z0-9._:-]+$/u).brand();H({commands:V(H({id:$c,invocation:L().min(1).max(128),label:L().trim().min(1).max(128),description:L().trim().min(1).max(512).optional(),localizations:Fo.optional(),argumentMode:W([`none`,`text`]),kind:W([`command`,`skill`]).optional()}).strict()),source:W([`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)}),H({harnessId:Ro,cwd:L().min(1).optional()}).strict(),H({threadId:K}).strict(),H({threadId:K,commandId:$c,turnId:zo.optional(),arguments:jo.optional()}).strict(),H({accepted:G(!0),turnId:zo}).strict();let el=G(`2.0`).optional(),tl=La().optional(),nl=L().min(1),rl=Va([L(),z().int()]),il=H({code:z().int(),message:L(),data:Ao.optional()}).catchall(Ao).superRefine(To([`data`]));Va([H({jsonrpc:el,id:rl,method:nl,params:Ao.optional(),result:tl,error:tl}).catchall(Ao).superRefine(To([`jsonrpc`,`params`,`result`,`error`])),H({jsonrpc:el,id:tl,method:nl,params:Ao.optional(),result:tl,error:tl}).catchall(Ao).superRefine(To([`jsonrpc`,`id`,`params`,`result`,`error`])),H({jsonrpc:el,id:rl,method:tl,params:tl,result:Ao,error:tl}).catchall(Ao).superRefine(To([`jsonrpc`,`method`,`params`,`error`])),H({jsonrpc:el,id:rl,method:tl,params:tl,result:tl,error:il}).catchall(Ao).superRefine(To([`jsonrpc`,`method`,`params`,`result`]))]);let al=L().refine(e=>e.trim().length>0,{message:`Native identifier must not be empty or whitespace`});U({harnessId:Ro,nativeSessionId:al,locator:Ao.optional(),formatVersion:G(1)}).superRefine(To([`locator`])),U({harnessId:Ro,nativeSessionId:al,nativeTurnKey:al,formatVersion:G(1)}),U({harnessId:Ro,nativeSessionId:al,checkpointId:al,locator:Ao.optional(),formatVersion:G(1)}).superRefine(To([`locator`]));let ol=L().regex(/^\d+\.\d+\.\d+(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/u),sl=W([`npm`,`windows-installer`,`macos-dmg`]),cl=U({version:ol,installation:sl,phase:W([`prepared`,`downloading`,`waiting-for-exit`,`installing`,`restarting`,`succeeded`,`failed`]),updatedAt:z().int().nonnegative(),downloadedBytes:z().int().nonnegative().optional(),totalBytes:z().int().positive().optional(),error:L().min(1).max(500).nullable(),serviceStopOutput:L().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`})});U({});let ll=L().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`);U({currentVersion:ol,installation:sl.nullable(),latestVersion:ol.nullable(),updateAvailable:B(),installationAvailable:B(),releaseNotes:L().min(1).max(2e4).nullable(),releaseNotesUrl:ll.nullable(),status:cl.nullable(),error:L().min(1).max(500).nullable()}),U({status:cl}),U({status:cl.nullable()});let ul=/^[a-z0-9][a-z0-9-]*$/u;function dl(e){if(!ul.test(e))throw Error(`Invalid delegation mention Harness id: ${e}`);return`subagent://codexhost.${e}`}function fl(e){let t=e.replace(/[[\]()\n\r]+/gu,` `).replace(/\s+/gu,` `).trim();return t.length>0?t:`agent`}function pl(e){return`[@${fl(e.label)}](${dl(e.harnessId)})`}function ml(e){let t=e.trim().replace(/^\//u,``);if(!t||/\s/u.test(t))throw Error(`Invalid Harness command: ${e}`);return`subagent://codexhost-command.${encodeURIComponent(t).replace(/[()]/gu,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)}`}let hl=W([`idle`,`installing`,`restarting`,`succeeded`,`failed`]);H({runningVersion:L().nullable(),installedVersion:L().nullable(),restartRequired:B(),remote:B(),updateSupported:B(),update:H({phase:hl,targetVersion:L().nullable(),error:L().nullable()})});let gl=H({version:L().regex(/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/u)}).strict();H({hostname:L().min(1).max(1024).refine(e=>!e.startsWith(`-`)&&!/\s/u.test(e)),port:z().int().min(1).max(65535).nullable(),identity:L().max(4096).nullable(),action:W([`inspect`,`install`,`update`,`repair`,`uninstall`]),uninstallPackage:B().optional(),version:L().regex(/^\d+\.\d+\.\d+$/u).nullable()}).strict(),H({state:W([`installed`,`not-installed`])}).strict();let _l=L().min(1).max(1024),vl=H({hostId:_l,displayName:L().min(1).max(1024),source:W([`codex-managed`,`discovered`]),sshAlias:L().max(1024).nullable(),sshHost:L().min(1).max(1024),sshPort:z().int().min(1).max(65535).nullable(),identity:L().max(4096).nullable(),autoConnect:B(),connectionAnalyticsId:L().max(1024).optional()}),yl=U({displayName:L().min(1).max(1024),hostname:L().min(1).max(1024),sshPort:z().int().min(1).max(65535).nullable(),identity:L().max(4096).nullable()});Ua(`action`,[U({action:G(`list`)}),U({action:G(`read-thread`),hostId:_l.refine(e=>e!==`local`),input:Rs}),U({action:G(`save`),draft:yl,previous:vl.nullable()}),U({action:G(`remove`),previous:vl}),U({action:G(`connect`),hostId:_l,enabled:B()}),U({action:G(`state`),hostId:_l}),U({action:G(`runtime`),hostId:_l}),U({action:G(`update`),hostId:_l.refine(e=>e!==`local`),version:gl.shape.version})]),Va([U({result:Ao}),U({error:U({code:z().int(),message:L()})})]);let bl=L().max(214).regex(/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/u),xl=Va([L(),H({en:L()}).catchall(L())]),Sl=H({title:xl.optional(),description:xl.optional(),icon:L().max(349592).regex(/^data:image\/(?:svg\+xml|png|jpeg|webp);base64,[A-Za-z0-9+/]*={0,2}$/u).optional(),error:L().optional()}),Cl=H({extensions:V(H({id:bl,name:L().min(1).max(214),version:L().min(1).max(128),format:G(`dsh`),supportedTargets:qa([G(`web`)]),enabledTargets:V(G(`web`)).max(1),source:L().min(1).max(4096),projectUrl:L().max(4096).url({protocol:/^https?$/u}).optional(),installedAt:L(),meta:Sl.optional(),loadError:L().optional()})),loadedIds:V(bl),safeMode:B(),storeError:L().optional()}),wl=L().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}/`);H({spec:L().trim().min(1).max(4096),registry:wl.optional()}).strict(),H({id:bl,enabled:B()}).strict(),H({id:bl}).strict(),G(1);function Tl(){let e=globalThis.crypto.getRandomValues(/* @__PURE__ */ new Uint8Array(16)),t=Array.from(e,(e,t)=>(t===6?e&15|64:t===8?e&63|128:e).toString(16).padStart(2,`0`)).join(``);return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}let El=[`unsupported`,`permission-denied`,`display-unavailable`,`capture-failed`,`image-too-large`,`busy`,`timeout`,`unavailable`];function Dl(e){return typeof e==`string`&&El.some(t=>t===e)}var Ol=class extends Error{code;details;constructor(e,t,n){super(e),this.code=t,this.details=n}};async function q(e,t){let n=await fetch(`api/${e}`,{method:`POST`,credentials:`same-origin`,headers:{"content-type":`application/json`},body:JSON.stringify({type:`client-request`,rpcId:Tl(),method:e,payload:{args:t}})});if(!n.ok)throw Error(`HTTP ${String(n.status)}`);let r=await n.json();if(!r.result.ok){let{message:e,code:t,details:n}=r.result.error;throw new Ol(e,t,n)}return r.result.value}let kl={status:async()=>Cs.parse(await q(`codexhost/voice/status`,{})),transcribe:async(e,t)=>{let n=await fetch(`api/voice/transcribe`,{method:`POST`,credentials:`same-origin`,headers:{"content-type":e.type},body:e,signal:t});return Ts.parse(await n.json())}},Al=2e4,jl=(e,t)=>new Promise((n,r)=>{if(t.aborted)return r(/* @__PURE__ */ Error(`aborted`));let i=setTimeout(n,e);t.addEventListener(`abort`,()=>{clearTimeout(i),r(/* @__PURE__ */ Error(`aborted`))},{once:!0})}),Ml={capture:async(e,t)=>{for(let n=0;;n+=1)try{return await Nl(e,t)}catch(t){if(!(t instanceof Error&&t.message===`busy`&&n<3))throw t;await jl(500,e)}}};async function Nl(e,t){let n=new AbortController,r=()=>n.abort();e.addEventListener(`abort`,r,{once:!0});let i,a=!1,o=e=>{clearTimeout(i),i=setTimeout(()=>{a=!0,n.abort()},e)};try{o(25e3);let e=await fetch(`api/desktop/screenshot`,{method:`POST`,credentials:`same-origin`,cache:`no-store`,signal:n.signal});if(o(Al),!e.ok){let t=await e.json().catch(()=>void 0);throw Error(Dl(t?.error)?t.error:`unavailable`)}let r=e.headers.get(`x-codexhost-captured-at`);if(e.headers.get(`content-type`)!==`image/png`||r===null||!Number.isFinite(Date.parse(r)))throw Error(`capture-failed`);let i=Number(e.headers.get(`content-length`)),a=Number.isFinite(i)&&i>0?i:void 0;if(t?.({loaded:0,total:a}),e.body===null)return{image:await e.blob(),capturedAt:r};let s=e.body.getReader(),c=[],l=0;for(;;){let{done:e,value:n}=await s.read();if(e)break;o(Al),c.push(n),l+=n.length,t?.({loaded:l,total:a})}return{image:new Blob(c,{type:`image/png`}),capturedAt:r}}catch(t){throw a&&!e.aborted?Error(`timeout`):t}finally{clearTimeout(i),e.removeEventListener(`abort`,r)}}let Pl={relay:async(e,t)=>Ms.parse(await q(`codexhost/relaySet`,{enabled:e,...t})),lan:e=>q(`codexhost/lanSet`,{enabled:e}),autostart:async e=>ks.parse(await q(`codexhost/autostartSet`,{enabled:e})),serve:async e=>Os.parse(await q(`codexhost/tailscaleServeSet`,{enabled:e})),get:async()=>Is.parse(await q(`codexhost/accessTokenGet`,{})),regenerate:async()=>Is.parse(await q(`codexhost/accessTokenRegenerate`,{}))},Fl={config:()=>q(`codexhost/pushConfig`,{}),subscribe:e=>q(`codexhost/pushSubscribe`,{subscription:e,userAgent:navigator.userAgent}),unsubscribe:e=>q(`codexhost/pushUnsubscribe`,{endpoint:e}),test:()=>q(`codexhost/pushTest`,{})},Il={sources:async()=>qc.parse(await q(`codexhost/importSources`,{})),candidates:async e=>Jc.parse(await q(`codexhost/importCandidates`,{request:e})),importSession:async(e,t)=>Yc.parse(await q(`codexhost/import`,{request:{harnessId:e,nativeSessionId:t}}))},Ll={read:async(e,t,n)=>Dc.parse(await q(`codexhost/turnDiffs`,{request:{sessionId:e,turn:t,...n===void 0?{}:{path:n}}})).diffs},Rl={send:(e,t,n)=>q(`codexhost/editMessage`,{request:{sessionId:e,atSeq:t,text:n}})},zl={inspect:e=>q(`codexhost/threadCommands`,{request:{sessionId:e}}),execute:(e,t)=>q(`codexhost/executeThreadCommand`,{request:{sessionId:e,commandId:t}})},Bl=`codexhost-native`;function Vl(e){let t=ml(e),n=`[@${e.replace(/[\[\]\r\n]/gu,` `)}](${t})`;return{source:Bl,ref:n,label:e,clipboardText:n}}let Hl=`codexhost-delegation`;function Ul(e){let t=e.get(`connection`),n=/* @__PURE__ */ new Map,a=/* @__PURE__ */ new WeakMap,o=/* @__PURE__ */ new Set,s=0,c=/* @__PURE__ */ new Set,l=e.locale.bind(`codexhostImport`),u=()=>{for(let e of c)e()},d=t=>{let n=e.sessions.list.getSnapshot().byId[t];return!!n&&!n.blank&&n.projectionValues?.nativeDiscovery===!0&&n.projectionValues.threadReference?.hostId===`local`&&e.sessions.subagentAddress(t)===void 0},f=t=>{let n=e.sessions.list.getSnapshot().byId[t];return d(t)||n?.blank===!0&&n.projectionValues?.harnessIdentity!=null&&e.sessions.subagentAddress(t)===void 0},p=n=>{let r=e.sessions.list.getSnapshot().byId[n];if(!t.generation.getSnapshot()||r?.projectionValues?.nativeConnection?.state===`reconnecting`)return l(`discovery.offline`);if(o.has(n))return l(`discovery.pending`);if(r?.running)return l(`discovery.busy`)},m=t=>{let n=e.sessions.scope(t);return n?.get(`conversation`)?.input.for(n)},h=(e,t)=>m(e)?.notify(`error`,t),g=(t,r)=>{let i=n.get(t);return(!i||i.epoch!==r.menuEpoch||i.generation!==s)&&(i={epoch:r.menuEpoch,generation:s,connection:e.sessions.list.getSnapshot().byId[t]?.projectionValues?.nativeConnection?.state,promise:Promise.all([zl.inspect(t),e.commandUi.reservedNames({sessionId:t})]).then(([e,t])=>({catalog:e,reserved:t}))},n.set(t,i)),i},_=({sessionId:t},r)=>{c.add(r);let i=e.sessions.list.subscribe(r),a=e.modelDirectories.harnessCatalog.subscribe(r);return()=>{c.delete(r),i(),a(),n.delete(t)}};e.effect(()=>t.generation.subscribe(()=>{s++,n.clear(),u()}),`ui-codexhost: browser connection generation`),e.effect(()=>e.sessions.list.subscribe(()=>{let t=!1,r=e.sessions.list.getSnapshot().byId;for(let[e,i]of n)i.connection!==r[e]?.projectionValues?.nativeConnection?.state&&(n.delete(e),t=!0);t&&u()}),`ui-codexhost: discovery connection generation`);let v=(t,n)=>{let r=t.session.sessionId,i=p(r);if(!d(r)||i){h(r,i??l(`discovery.stale`));return}let a=e.sessions.scope(r),s=m(r);a&&s?.state.getSnapshot().draftRev===t.span.draftRev&&(t.span.start===t.span.end||a.bail(a,`slash/input-consume-token`,{guard:{kind:`span`,span:t.span}})===!0)&&(o.add(r),u(),zl.execute(r,n).catch(e=>h(r,`${l(`discovery.unconfirmed`)} ${e instanceof Error?e.message:String(e)}`)).finally(()=>{o.delete(r),u()}))};e.effect(()=>e.inputTriggers.registerSource({trigger:`/`,aliases:[`#`,`@`],name:Bl,codec:{clipboardText:e=>e,serialize:async e=>e},launcher:`command`,order:20,showGroupTitle:!1,subscribeCandidates:_,candidates:async({sessionId:e},r)=>{if(!d(e))return[];if(!t.generation.getSnapshot())return[{name:l(`discovery.retry`),value:`retry`,section:l(`discovery.commands`),description:l(`discovery.offline`)}];let i=g(e,r);try{let{catalog:t,reserved:o}=await i.promise;if(n.get(e)!==i||!d(e))return[];let s=r.query.toLocaleLowerCase(),c=t.commands.filter(e=>`${e.invocation} ${e.label}`.toLocaleLowerCase().includes(s)).toSorted((e,t)=>Number(e.kind===`skill`)-Number(t.kind===`skill`)).map(t=>{let n=o.has(t.invocation)?l(`discovery.conflict`):t.argumentMode===`none`||t.invocation===`/compact`?p(e):void 0,r={name:t.invocation,label:t.kind===`skill`?t.label.replace(/^\/?skill:/iu,``):t.label,showAlias:t.kind!==`skill`,value:t.id,section:l(t.kind===`skill`?`discovery.skills`:`discovery.commands`),description:t.description,...n?{disabledReason:n}:{}};return a.set(r,{command:t,entry:i}),r});return t.source===`static`&&!s&&c.push({name:l(`discovery.static`),disabledReason:l(`discovery.static`),section:l(`discovery.commands`)}),!t.commands.length&&!s&&t.source!==`static`&&c.push({name:l(`discovery.empty`),disabledReason:l(`discovery.empty`),section:l(`discovery.commands`)}),c.toSorted((e,t)=>Number(e.section===l(`discovery.skills`))-Number(t.section===l(`discovery.skills`)))}catch(t){return n.get(e)===i?[{name:l(`discovery.retry`),value:`retry`,section:l(`discovery.commands`),description:`${l(`discovery.failed`)} ${t instanceof Error?t.message:String(t)}`}]:[]}},onPick:e=>{let t=e.session.sessionId;if(!d(t))return h(t,l(`discovery.stale`)),`handled`;if(e.candidate.value===`retry`)return n.delete(t),`refresh`;let r=n.get(t);if(!r||r.generation!==s)return h(t,l(`discovery.stale`)),`handled`;let i=e.candidate.value;if(!i||e.candidate.disabledReason)return`handled`;let o=a.get(e.candidate),c=o?.entry===r?o.command:void 0;if(!c)return h(t,l(`discovery.stale`)),`handled`;if(c.argumentMode===`none`||c.invocation===`/compact`)return v(e,i),`handled`;try{return{insert:Vl(c.invocation)}}catch{return h(t,l(`discovery.stale`)),`handled`}}}),`ui-codexhost: native discovery`),e.effect(()=>e.inputTriggers.registerSource({trigger:`@`,aliases:[`#`],name:Hl,launcher:`command`,launcherOrder:30,order:10,showGroupTitle:!1,codec:{clipboardText:e=>e,serialize:async e=>e},subscribeCandidates:_,candidates:async({sessionId:t},n)=>f(t)?(e.modelDirectories.harnessCatalog.getSnapshot().value?.groups??[]).filter(e=>`${e.name} ${e.id}`.toLocaleLowerCase().includes(n.query.toLocaleLowerCase())).map(e=>({name:e.id,label:e.name,value:e.id,section:l(`discovery.agents`),icon:t=>/* @__PURE__ */ (0,i.jsx)(r.RemotePluginIcon,{id:e.id,src:`/harness-icons/${encodeURIComponent(e.id)}`,presentationUrl:`/harness-icons/presentation.json`,size:t.size??14,fallback:/* @__PURE__ */ (0,i.jsx)(r.IconDataOutlineRegular,{size:t.size??14})})})):[],onPick:t=>{let n=e.modelDirectories.harnessCatalog.getSnapshot().value?.groups.find(e=>e.id===t.candidate.value);if(!f(t.session.sessionId)||!n)return h(t.session.sessionId,l(`discovery.stale`)),`handled`;let r=pl({harnessId:n.id,label:n.name});return{insert:{source:Hl,ref:r,label:n.name,appearance:`session`,clipboardText:r}}}}),`ui-codexhost: delegation discovery`)}function Wl(e){let t=e.replace(/[/\\]+$/,``),n=Math.max(t.lastIndexOf(`/`),t.lastIndexOf(`\\`));return t.slice(n+1)}let Gl=`codexhost-thread`,Kl=/(?<![\w:/])(?:codex:\/\/threads\/|thread:\/\/)[^\s<>()\[\]`"',。!?;:、]+(?<![.,;])/gu;function ql(e){if(!(e.blank||e.projectionValues?.threadReference?.hostId!==`local`))return{threadId:e.id,hostId:`local`,title:e.title?.replace(/[\s\u0000-\u001f\u007f]+/gu,` `).trim()||e.id.slice(0,8)}}function Jl(e){return`thread://${encodeURIComponent(e.threadId).replace(/[!'()*]/gu,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)}?hostId=local`}function Yl(e){if(e.trim()!==e)return;let t=/^codex:\/\/threads\/([^/?#\s<>]+)$/u.exec(e)??/^thread:\/\/([^/?#\s<>]+)\?hostId=local$/u.exec(e);if(t?.[1]!==void 0)try{let e=decodeURIComponent(t[1]);return e&&!/[\u0000-\u001f\u007f]/u.test(e)?e:void 0}catch{return}}function Xl(e){let t=`[@${e.title.replace(/[\\`*{}[\]()#+.!_<>|~-]/gu,e=>`\\${e}`)}](${Jl(e)})`;return{source:Gl,ref:t,label:e.title,appearance:`session`,clipboardText:t}}function Zl(e){let t=e.locale.bind(`codexhostImport`),n=/* @__PURE__ */ new WeakMap,r=t=>{let n=e.sessions.list.getSnapshot().byId[t];return n!==void 0&&e.sessions.subagentAddress(t)===void 0&&(ql(n)!==void 0||n.blank&&n.projectionValues?.harnessIdentity!=null)};e.effect(()=>e.inputTriggers.registerSource({trigger:`@`,aliases:[`#`],name:Gl,launcher:`command`,order:25,showGroupTitle:!1,codec:{clipboardText:e=>e,serialize:async e=>e},subscribeCandidates:(t,n)=>{let r=e.sessions.list.subscribe(n),i=e.workspaces.list.subscribe(n);return()=>{r(),i()}},candidates:async({sessionId:i},a)=>{if(!r(i))return[];let o=a.menuEpoch===void 0?void 0:n.get(a.menuEpoch);if(o===void 0&&(o=e.sessions.refresh(),a.menuEpoch!==void 0&&n.set(a.menuEpoch,o)),await o,a.signal.throwIfAborted(),!r(i))return[];let s=e.sessions.list.getSnapshot(),c=e.workspaces.list.getSnapshot(),l=new Set(c.archivedSessionIds),u=/* @__PURE__ */ new Map;for(let e of c.items)for(let t of e.sessionIds)u.has(t)||u.set(t,e.title);let d=a.query.trim().toLowerCase();return s.ids.flatMap(e=>{let t=s.byId[e];if(t===void 0||e===i||l.has(e))return[];let n=ql(t);if(n===void 0)return[];let r=u.get(e)??(Wl(t.cwd??``)||t.cwd||``);return!n.title.toLowerCase().includes(d)&&!r.toLowerCase().includes(d)?[]:[{reference:n,workspace:r,updatedAt:t.updatedAt}]}).sort((e,t)=>t.updatedAt-e.updatedAt||e.reference.threadId.localeCompare(t.reference.threadId)).slice(0,d===``?5:void 0).map(({reference:e,workspace:n})=>({name:e.threadId,label:e.title,value:e.threadId,showAlias:!1,section:t(`discovery.sessions`),description:[n,e.threadId].filter(Boolean).join(` · `),icon:`session`}))},onPick:t=>{let n=t.candidate.value;if(n===void 0)return`handled`;let i=e.sessions.list.getSnapshot(),a=i.ids.includes(n)?i.byId[n]:void 0,o=a===void 0?void 0:ql(a);return!r(t.session.sessionId)||o===void 0||n===t.session.sessionId||e.workspaces.list.getSnapshot().archivedSessionIds.includes(n)?`handled`:{insert:Xl(o)}}}),`ui-codexhost: Thread reference discovery`)}let Ql={sessionId:void 0,pending:!1,startedAt:void 0,progress:void 0,image:void 0,error:void 0};var $l=class{capture;store=(0,a.createSnapshotStore)(Ql);request;constructor(e){this.capture=e}getSnapshot=()=>this.store.getSnapshot();subscribe=e=>this.store.subscribe(e);refresh=async e=>{let t=this.request;if(t!==void 0){let e=this.getSnapshot().startedAt??0;if(Date.now()-e<3e3)return;this.request=void 0,t.abort()}this.getSnapshot().sessionId!==e&&this.close();let n=new AbortController;this.request=n,this.store.set({...this.getSnapshot(),sessionId:e,pending:!0,startedAt:Date.now(),progress:void 0,error:void 0});try{let t=await this.capture(n.signal,e=>{this.request===n&&this.store.set({...this.getSnapshot(),progress:e})});if(this.request!==n||n.signal.aborted)return;let r=this.getSnapshot().image,i={url:URL.createObjectURL(t.image),capturedAt:t.capturedAt};this.store.set({sessionId:e,pending:!1,startedAt:void 0,progress:void 0,image:i,error:void 0}),r!==void 0&&URL.revokeObjectURL(r.url)}catch(e){if(this.request!==n||n.signal.aborted)return;let t=e instanceof Error?e.message:e;this.store.set({...this.getSnapshot(),pending:!1,startedAt:void 0,progress:void 0,error:Dl(t)?t:`unavailable`})}finally{this.request===n&&(this.request=void 0)}};cancel=()=>{let e=this.request;e!==void 0&&(this.request=void 0,e.abort(),this.store.set({...this.getSnapshot(),pending:!1,startedAt:void 0,progress:void 0}))};close=e=>{if(e!==void 0&&this.getSnapshot().sessionId!==e)return;let t=this.request;this.request=void 0,t?.abort();let n=this.getSnapshot().image;this.store.set(Ql),n!==void 0&&URL.revokeObjectURL(n.url)}};let eu=[`#ff3b30`,`#ffcc00`,`#0a84ff`];function tu(e,t,n){return n===90?{x:t,y:-e}:n===270?{x:-t,y:e}:{x:e,y:t}}function nu(e){return Math.max(4,Math.round(e/250))}function ru(e,t,n){let[r,...i]=t.points;if(r===void 0)return;let a=i.at(-1)??r;if(e.save(),e.strokeStyle=t.color,e.fillStyle=t.color,e.lineWidth=n,e.lineCap=`round`,e.lineJoin=`round`,e.beginPath(),t.tool===`pen`){e.moveTo(r.x,r.y),i.length===0&&e.lineTo(r.x+.01,r.y);for(let t of i)e.lineTo(t.x,t.y);e.stroke()}else if(t.tool===`rect`)e.rect(Math.min(r.x,a.x),Math.min(r.y,a.y),Math.abs(a.x-r.x),Math.abs(a.y-r.y)),e.stroke();else{let t=Math.atan2(a.y-r.y,a.x-r.x),i=n*4;e.moveTo(r.x,r.y),e.lineTo(a.x,a.y),e.stroke(),e.beginPath(),e.moveTo(a.x,a.y);for(let n of[-1,1])e.lineTo(a.x-i*Math.cos(t+n*Math.PI/7),a.y-i*Math.sin(t+n*Math.PI/7)),e.moveTo(a.x,a.y);e.stroke()}e.restore()}function iu(e,t,n){let r=Math.min(Math.max(Math.min(e.x,t.x),0),n.width),i=Math.min(Math.max(Math.max(e.x,t.x),0),n.width),a=Math.min(Math.max(Math.min(e.y,t.y),0),n.height),o=Math.min(Math.max(Math.max(e.y,t.y),0),n.height);return{x:r,y:a,width:i-r,height:o-a}}function au(e,t,n){let r=[[`tl`,e.x,e.y],[`tr`,e.x+e.width,e.y],[`bl`,e.x,e.y+e.height],[`br`,e.x+e.width,e.y+e.height]];for(let[e,i,a]of r)if(Math.hypot(t.x-i,t.y-a)<=n)return e;return t.x>=e.x&&t.x<=e.x+e.width&&t.y>=e.y&&t.y<=e.y+e.height?`inside`:void 0}function ou(e,t){return{x:t===`tl`||t===`bl`?e.x+e.width:e.x,y:t===`tl`||t===`tr`?e.y+e.height:e.y}}function su(e,t,n,r){return{...e,x:Math.min(Math.max(e.x+t,0),r.width-e.width),y:Math.min(Math.max(e.y+n,0),r.height-e.height)}}function cu(e,t,n,r){e.save(),e.fillStyle=`rgba(0, 0, 0, 0.55)`,e.beginPath(),e.rect(0,0,n.width,n.height),e.rect(t.x,t.y,t.width,t.height),e.fill(`evenodd`),e.strokeStyle=`#fff`,e.lineWidth=2*r,e.strokeRect(t.x,t.y,t.width,t.height),e.fillStyle=`#fff`;for(let[n,i]of[[t.x,t.y],[t.x+t.width,t.y],[t.x,t.y+t.height],[t.x+t.width,t.y+t.height]])e.beginPath(),e.arc(n,i,7*r,0,Math.PI*2),e.fill();e.restore()}let lu=`@deepseek-ai/dsh-client-ui-codexhost/DesktopScreenshotViewer.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(lu)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-codexhost`,e.dataset.pluginCss=lu,e.textContent=`.B2I-aa_root{z-index:1000;color:#fff;background:#000;position:fixed;inset:0;overflow:hidden}.B2I-aa_stage{position:absolute;top:50%;left:50%}.B2I-aa_top,.B2I-aa_bottom{z-index:2;pointer-events:none;transition:opacity .15s;position:absolute;left:0;right:0}.B2I-aa_top *,.B2I-aa_bottom *{pointer-events:auto}.B2I-aa_top{padding-top:env(safe-area-inset-top);background:linear-gradient(#000000b3,#0000);top:0}.B2I-aa_bottom{padding-bottom:env(safe-area-inset-bottom);background:linear-gradient(#0000,#000000b3);bottom:0}.B2I-aa_hidden{visibility:hidden;opacity:0}.B2I-aa_bar{flex-wrap:wrap;align-items:center;gap:8px;padding:8px 12px;display:flex}.B2I-aa_spacer{flex:1}.B2I-aa_text,.B2I-aa_primary{min-width:44px;min-height:44px;color:inherit;font:inherit;cursor:pointer;touch-action:manipulation;background:#ffffff1f;border:0;border-radius:10px;padding:0 12px;font-size:14px}.B2I-aa_text[aria-pressed=true]{background:#ffffff52}.B2I-aa_text:disabled{opacity:.4;cursor:default}.B2I-aa_primary{background:var(--dsw-alias-button-info-fill,#3964fe)}.B2I-aa_swatch{cursor:pointer;touch-action:manipulation;border:2px solid #0000;border-radius:50%;width:28px;height:28px;padding:0}.B2I-aa_swatch[aria-pressed=true]{border-color:#fff;box-shadow:0 0 0 2px #0009}.B2I-aa_area{touch-action:none;place-items:center;display:grid;position:absolute;inset:0;overflow:hidden}.B2I-aa_area[data-annotating]{cursor:crosshair}.B2I-aa_zoomBadge{z-index:3;min-height:36px;color:inherit;font:inherit;cursor:pointer;background:#fff3;border:0;border-radius:18px;padding:0 12px;font-size:13px;position:absolute;top:72px;right:12px}.B2I-aa_canvas{background:#000;max-width:none;display:block}.B2I-aa_error{color:#ff8a80;margin:0;padding:4px 12px;font-size:13px}.B2I-aa_compose{flex:1 0 100%;gap:8px;display:flex}.B2I-aa_message{min-width:0;min-height:44px;color:inherit;font:inherit;background:#ffffff1a;border:1px solid #ffffff40;border-radius:22px;flex:1;padding:0 14px;font-size:16px}.B2I-aa_message::placeholder{color:#ffffff8c}.B2I-aa_primary:disabled{opacity:.5;cursor:default}.B2I-aa_hint{pointer-events:none;background:#fff3;border-radius:18px;margin:0;padding:8px 14px;font-size:13px;position:absolute;top:64px;left:50%;transform:translate(-50%)}.B2I-aa_cropHint,.B2I-aa_cropSize{color:#ffffffbf;font-size:13px}.B2I-aa_cropSize{font-variant-numeric:tabular-nums}.B2I-aa_wide .B2I-aa_compose{flex:320px}`,document.head.appendChild(e)}var J={area:`B2I-aa_area`,bar:`B2I-aa_bar`,bottom:`B2I-aa_bottom`,canvas:`B2I-aa_canvas`,compose:`B2I-aa_compose`,cropHint:`B2I-aa_cropHint`,cropSize:`B2I-aa_cropSize`,error:`B2I-aa_error`,hidden:`B2I-aa_hidden`,hint:`B2I-aa_hint`,message:`B2I-aa_message`,primary:`B2I-aa_primary`,root:`B2I-aa_root`,spacer:`B2I-aa_spacer`,stage:`B2I-aa_stage`,swatch:`B2I-aa_swatch`,text:`B2I-aa_text`,top:`B2I-aa_top`,wide:`B2I-aa_wide`,zoomBadge:`B2I-aa_zoomBadge`};function uu(e){let t=window.visualViewport;return e&&t!==null?{width:t.width,height:t.height,x:t.offsetLeft,y:t.offsetTop}:{width:window.innerWidth,height:window.innerHeight,x:0,y:0}}let du,fu=`codexhost.screenshot.zoom-hint`,pu=[`pen`,`rect`,`arrow`];function mu(e){let[t,n]=(0,o.useState)();return(0,o.useEffect)(()=>{let t=!0,r=new Image;return r.onload=()=>{t&&n(r)},r.src=e,()=>{t=!1}},[e]),t}function hu({src:e,t,onClose:n,onAttach:r,onSend:a}){let[c,l]=(0,o.useState)(),u=mu(c?.url??e),[d,f]=(0,o.useState)(du??0),p=e=>{du=e,f(e)},[m,h]=(0,o.useState)(!1),[g,_]=(0,o.useState)(!1),[v,y]=(0,o.useState)(),b=(0,o.useRef)(0),x=(0,o.useRef)(),[S,C]=(0,o.useState)(`pen`),[w,T]=(0,o.useState)(eu[0]),[E,D]=(0,o.useState)([]),[O,ee]=(0,o.useState)(),[te,k]=(0,o.useState)(),[ne,re]=(0,o.useState)(!0),A=(0,o.useRef)(),[j,ie]=(0,o.useState)(``),[ae,oe]=(0,o.useState)(!1),[se,ce]=(0,o.useState)(()=>{try{return localStorage.getItem(fu)!==`1`}catch{return!1}}),[le,ue]=(0,o.useState)(!1),de=(0,o.useRef)(),fe=(0,o.useRef)(null),[pe,me]=(0,o.useState)(()=>uu(!1)),[he,ge]=(0,o.useState)({width:0,height:0}),_e=(0,o.useRef)(null),ve=(0,o.useRef)(null),ye=(0,o.useRef)(null);(0,o.useEffect)(()=>{let e=()=>me(uu(le));e(),window.addEventListener(`resize`,e),window.visualViewport?.addEventListener(`resize`,e),window.visualViewport?.addEventListener(`scroll`,e);let t=setTimeout(e,400);return()=>{clearTimeout(t),window.removeEventListener(`resize`,e),window.visualViewport?.removeEventListener(`resize`,e),window.visualViewport?.removeEventListener(`scroll`,e)}},[le,d]),(0,o.useEffect)(()=>{let e=ve.current;if(e===null)return;let t=new ResizeObserver(()=>ge({width:e.clientWidth,height:e.clientHeight}));return t.observe(e),()=>t.disconnect()},[]),(0,o.useEffect)(()=>()=>{c!==void 0&&URL.revokeObjectURL(c.url)},[c]),(0,o.useEffect)(()=>ye.current?.focus(),[]),(0,o.useEffect)(()=>{let e=document.body.style.overflow;return document.body.style.overflow=`hidden`,()=>{document.body.style.overflow=e,clearTimeout(de.current)}},[]),(0,o.useEffect)(()=>{if(!se)return;try{localStorage.setItem(fu,`1`)}catch{}let e=setTimeout(()=>ce(!1),4500);return()=>clearTimeout(e)},[se]);let be=(0,o.useRef)({annotating:m,cropping:g,onClose:n});be.current={annotating:m,cropping:g,onClose:n},(0,o.useEffect)(()=>{let e=e=>{e.key===`Escape`&&(e.stopPropagation(),be.current.annotating?h(!1):be.current.cropping?Ue():be.current.onClose())};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[]);let xe=u===void 0||he.width===0?0:Math.min(he.width/u.naturalWidth,he.height/u.naturalHeight),[Se,Ce]=(0,o.useState)(1),[we,Te]=(0,o.useState)({x:0,y:0}),M=(0,o.useRef)(/* @__PURE__ */ new Map),Ee=(0,o.useRef)(),De=(0,o.useRef)(),Oe=(0,o.useRef)({zoom:Se,pan:we,rotation:d});Oe.current={zoom:Se,pan:we,rotation:d};let ke=(e,t)=>{let n=ve.current?.getBoundingClientRect();return n===void 0?{x:0,y:0}:tu(e-(n.left+n.width/2),t-(n.top+n.height/2),Oe.current.rotation)},Ae=(e,t)=>{let n=u===void 0?0:u.naturalWidth*xe*t,r=u===void 0?0:u.naturalHeight*xe*t;return{x:Math.min(Math.max(e.x,-n/2),n/2),y:Math.min(Math.max(e.y,-r/2),r/2)}},je=(e,t,n=Oe.current)=>{let r=Math.min(Math.max(e,1),8),i=r/n.zoom;Ce(r),Te(r===1?{x:0,y:0}:Ae({x:t.x-i*(t.x-n.pan.x),y:t.y-i*(t.y-n.pan.y)},r))},Me=()=>{Ce(1),Te({x:0,y:0})},Ne=u===void 0?4:nu(u.naturalWidth);(0,o.useEffect)(()=>{let e=_e.current,t=e?.getContext(`2d`);if(e!==null&&t&&u!==void 0){e.width=u.naturalWidth,e.height=u.naturalHeight,t.drawImage(u,0,0);for(let e of O===void 0?E:[...E,O])ru(t,e,Ne);g&&v!==void 0&&cu(t,v,{width:e.width,height:e.height},1/Math.max(Se*xe,.01))}},[u,E,O,Ne,g,v,Se,xe]),(0,o.useEffect)(()=>{let e=ve.current;if(e===null)return;let t=e=>{e.preventDefault(),je(Oe.current.zoom*Math.exp(-e.deltaY*.0015),ke(e.clientX,e.clientY))};return e.addEventListener(`wheel`,t,{passive:!1}),()=>e.removeEventListener(`wheel`,t)});let Pe=e=>{if(u===void 0||xe===0)return;let t=ke(e.clientX,e.clientY),n=(t.x-we.x)/(Se*xe)+u.naturalWidth/2,r=(t.y-we.y)/(Se*xe)+u.naturalHeight/2;return{x:Math.min(Math.max(n,0),u.naturalWidth),y:Math.min(Math.max(r,0),u.naturalHeight)}},Fe=()=>{let[e,t]=[...M.current.values()];e!==void 0&&t!==void 0&&(Ee.current={distance:Math.max(1,Math.hypot(t.x-e.x,t.y-e.y)),mid:ke((e.x+t.x)/2,(e.y+t.y)/2),zoom:Se,pan:we},De.current=void 0,ee(void 0))},Ie=e=>{if(e.target.closest(`button`)===null){if(e.currentTarget.setPointerCapture(e.pointerId),M.current.set(e.pointerId,{x:e.clientX,y:e.clientY}),M.current.size===1?A.current={x:e.clientX,y:e.clientY,at:Date.now(),multi:!1}:A.current!==void 0&&(A.current.multi=!0),M.current.size===2)Fe();else if(!(M.current.size>2)){if(g){let t=Pe(e);if(t===void 0||u===void 0)return;let n=v,r=n===void 0?void 0:au(n,t,28/(Se*xe));n!==void 0&&r!==void 0&&r!==`inside`?x.current={kind:`resize`,anchor:ou(n,r),before:n}:n!==void 0&&r===`inside`?x.current={kind:`move`,start:t,before:n}:(x.current={kind:`new`,from:t,before:n},y(iu(t,t,{width:u.naturalWidth,height:u.naturalHeight})))}else if(m){let t=Pe(e);t!==void 0&&ee({tool:S,color:w,points:[t]})}else De.current={at:ke(e.clientX,e.clientY),pan:we}}}},Le=e=>{if(!M.current.has(e.pointerId))return;M.current.set(e.pointerId,{x:e.clientX,y:e.clientY});let t=Ee.current;if(t!==void 0&&M.current.size>=2){let[e,n]=[...M.current.values()];if(e===void 0||n===void 0)return;let r=Math.hypot(n.x-e.x,n.y-e.y),i=ke((e.x+n.x)/2,(e.y+n.y)/2),a=Math.min(Math.max(t.zoom*(r/t.distance),1),8),o=a/t.zoom;Ce(a),Te(a===1?{x:0,y:0}:Ae({x:i.x-o*(t.mid.x-t.pan.x),y:i.y-o*(t.mid.y-t.pan.y)},a))}else if(x.current!==void 0&&u!==void 0){let t=Pe(e);if(t===void 0)return;let n={width:u.naturalWidth,height:u.naturalHeight},r=x.current;r.kind===`move`?y(su(r.before,t.x-r.start.x,t.y-r.start.y,n)):y(iu(r.kind===`new`?r.from:r.anchor,t,n))}else if(O!==void 0){let t=Pe(e);if(t===void 0)return;ee({...O,points:O.tool===`pen`?[...O.points,t]:[O.points[0]??t,t]})}else if(De.current!==void 0&&Se>1){let t=ke(e.clientX,e.clientY);Te(Ae({x:De.current.pan.x+t.x-De.current.at.x,y:De.current.pan.y+t.y-De.current.at.y},Se))}},Re=(e,t)=>{if(!M.current.has(e.pointerId))return;M.current.delete(e.pointerId);let n=A.current;!t&&n!==void 0&&!n.multi&&M.current.size===0&&!m&&!g&&Date.now()-n.at<500&&Math.hypot(e.clientX-n.x,e.clientY-n.y)<8&&re(e=>!e),M.current.size===0&&(A.current=void 0),M.current.size<2&&(Ee.current=void 0),De.current=void 0;let r=x.current;x.current=void 0,r!==void 0&&(t||(v?.width??0)<24||(v?.height??0)<24)&&y(r.before),O!==void 0&&!t&&D(e=>[...e,O]),ee(void 0)},ze=()=>{M.current.clear(),Ee.current=void 0,De.current=void 0,x.current=void 0,A.current=void 0,ee(void 0)},Be=()=>{clearTimeout(de.current),fe.current?.blur(),ue(!1)},Ve=e=>{Be(),ze(),e===`annotate`?h(!0):He()};(0,o.useEffect)(()=>{let e=()=>ze();return window.addEventListener(`blur`,e),document.addEventListener(`visibilitychange`,e),()=>{window.removeEventListener(`blur`,e),document.removeEventListener(`visibilitychange`,e)}},[]);let He=()=>{if(u===void 0)return;let{naturalWidth:e,naturalHeight:t}=u;y({x:e*.1,y:t*.1,width:e*.8,height:t*.8}),_(!0),Me()};function Ue(){b.current++,_(!1),y(void 0)}let We=v!==void 0&&v.width>=24&&v.height>=24,Ge=()=>{if(u===void 0||v===void 0||!We)return;let e=++b.current,n=document.createElement(`canvas`);n.width=Math.round(v.width),n.height=Math.round(v.height),n.getContext(`2d`)?.drawImage(u,v.x,v.y,v.width,v.height,0,0,n.width,n.height),n.toBlob(n=>{e===b.current&&(n===null?k(t(`desktop.annotate.failed`)):(l({url:URL.createObjectURL(n),blob:n}),D([]),Ue(),Me()))},`image/png`)},Ke=()=>{let e=_e.current;if(e===null)return;if(E.length===0){h(!1);return}let n=++b.current;e.toBlob(e=>{n===b.current&&(e===null?k(t(`desktop.annotate.failed`)):(l({url:URL.createObjectURL(e),blob:e}),D([]),h(!1)))},`image/png`)},qe=async()=>{try{let t=r(c?.blob??await(await fetch(e)).blob());t===null?n():k(t)}catch{k(t(`desktop.annotate.failed`))}},Je=async()=>{if(!ae){oe(!0),k(void 0);try{let t=await a(c?.blob??await(await fetch(e)).blob(),j.trim());t===null?n():k(t)}catch{k(t(`desktop.annotate.failed`))}finally{oe(!1)}}},Ye=async()=>{try{let t=c?.blob??await(await fetch(e)).blob(),n=(/* @__PURE__ */ new Date()).toISOString().replace(/[-:]/gu,``).replace(/\..*$/u,``),r=new File([t],`desktop-screenshot-${n}.png`,{type:`image/png`});if(navigator.canShare?.({files:[r]})===!0)try{await navigator.share({files:[r]});return}catch(e){if(e instanceof DOMException&&e.name===`AbortError`)return}let i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=r.name,a.click(),setTimeout(()=>URL.revokeObjectURL(i),1e4)}catch{k(t(`desktop.save.failed`))}},Xe=d!==0,Ze=m||g,Qe={left:pe.x+pe.width/2,top:pe.y+pe.height/2,width:Xe?pe.height:pe.width,height:Xe?pe.width:pe.height,transform:Xe?`translate(-50%, -50%) rotate(${String(d)}deg)`:`translate(-50%, -50%)`};return(0,s.createPortal)(/* @__PURE__ */ (0,i.jsx)(`div`,{className:J.root,role:`dialog`,"aria-modal":`true`,"aria-label":t(`desktop.label`),children:/* @__PURE__ */ (0,i.jsxs)(`div`,{className:J.stage,style:Qe,children:[/* @__PURE__ */ (0,i.jsx)(`div`,{className:`${J.bar} ${J.top} ${ne||Ze?``:J.hidden}`,children:g?/* @__PURE__ */ (0,i.jsxs)(i.Fragment,{children:[/* @__PURE__ */ (0,i.jsx)(`button`,{type:`button`,className:J.text,onClick:Ue,children:t(`desktop.annotate.cancel`)}),/* @__PURE__ */ (0,i.jsx)(`button`,{type:`button`,className:J.primary,disabled:!We,onClick:Ge,children:t(`desktop.annotate.done`)})]}):m?/* @__PURE__ */ (0,i.jsxs)(i.Fragment,{children:[/* @__PURE__ */ (0,i.jsx)(`button`,{type:`button`,className:J.text,onClick:()=>{b.current++,h(!1)},children:t(`desktop.annotate.cancel`)}),/* @__PURE__ */ (0,i.jsx)(`button`,{type:`button`,className:J.primary,onClick:Ke,children:t(`desktop.annotate.done`)})]}):/* @__PURE__ */ (0,i.jsxs)(i.Fragment,{children:[/* @__PURE__ */ (0,i.jsx)(`button`,{ref:ye,type:`button`,className:J.text,"aria-label":t(`desktop.close`),onClick:n,children:`✕`}),/* @__PURE__ */ (0,i.jsx)(`span`,{className:J.spacer}),/* @__PURE__ */ (0,i.jsx)(`button`,{type:`button`,className:J.text,"aria-pressed":Xe,onClick:()=>p(Xe?0:90),children:t(Xe?`desktop.portrait`:`desktop.landscape`)}),Xe&&/* @__PURE__ */ (0,i.jsx)(`button`,{type:`button`,className:J.text,onClick:()=>p(d===90?270:90),children:t(`desktop.flip`)}),/* @__PURE__ */ (0,i.jsx)(`button`,{type:`button`,className:J.text,onClick:()=>Ve(`crop`),children:t(`desktop.crop`)}),/* @__PURE__ */ (0,i.jsx)(`button`,{type:`button`,className:J.text,onClick:()=>Ve(`annotate`),children:t(`desktop.annotate`)})]})}),/* @__PURE__ */ (0,i.jsxs)(`div`,{ref:ve,className:J.area,style:Ze?{top:64,bottom:76}:void 0,"data-annotating":m||g||void 0,onPointerDown:Ie,onPointerMove:Le,onPointerUp:e=>Re(e,!1),onPointerCancel:e=>Re(e,!0),onLostPointerCapture:e=>Re(e,!0),onDoubleClick:Me,children:[u!==void 0&&xe>0&&/* @__PURE__ */ (0,i.jsx)(`canvas`,{ref:_e,className:J.canvas,style:{width:u.naturalWidth*xe,height:u.naturalHeight*xe,transform:`translate(${String(we.x)}px, ${String(we.y)}px) scale(${String(Se)})`},role:`img`,"aria-label":t(`desktop.primary`)}),Se!==1&&/* @__PURE__ */ (0,i.jsxs)(`button`,{type:`button`,className:J.zoomBadge,onClick:Me,children:[String(Math.round(Se*100)),`% · `,t(`desktop.zoom.fit`)]})]}),se&&/* @__PURE__ */ (0,i.jsx)(`p`,{className:J.hint,role:`status`,children:t(`desktop.hint`)}),/* @__PURE__ */ (0,i.jsxs)(`div`,{className:`${J.bottom} ${ne||Ze?``:J.hidden} ${Xe?J.wide:``}`,children:[te!==void 0&&/* @__PURE__ */ (0,i.jsx)(`p`,{role:`alert`,className:J.error,children:te}),/* @__PURE__ */ (0,i.jsx)(`div`,{className:J.bar,children:g?/* @__PURE__ */ (0,i.jsxs)(i.Fragment,{children:[/* @__PURE__ */ (0,i.jsx)(`span`,{className:J.cropHint,children:t(`desktop.crop.hint`)}),/* @__PURE__ */ (0,i.jsx)(`span`,{className:J.spacer}),v!==void 0&&/* @__PURE__ */ (0,i.jsxs)(`span`,{className:J.cropSize,children:[String(Math.round(v.width)),` × `,String(Math.round(v.height))]})]}):m?/* @__PURE__ */ (0,i.jsxs)(i.Fragment,{children:[pu.map(e=>/* @__PURE__ */ (0,i.jsx)(`button`,{type:`button`,className:J.text,"aria-pressed":S===e,onClick:()=>C(e),children:t(`desktop.tool.${e}`)},e)),/* @__PURE__ */ (0,i.jsx)(`span`,{className:J.spacer}),eu.map(e=>/* @__PURE__ */ (0,i.jsx)(`button`,{type:`button`,className:J.swatch,style:{background:e},"aria-label":e,"aria-pressed":w===e,onClick:()=>T(e)},e)),/* @__PURE__ */ (0,i.jsx)(`span`,{className:J.spacer}),/* @__PURE__ */ (0,i.jsx)(`button`,{type:`button`,className:J.text,disabled:E.length===0,onClick:()=>D(e=>e.slice(0,-1)),children:t(`desktop.annotate.undo`)}),/* @__PURE__ */ (0,i.jsx)(`button`,{type:`button`,className:J.text,disabled:E.length===0,onClick:()=>D([]),children:t(`desktop.annotate.clear`)})]}):/* @__PURE__ */ (0,i.jsxs)(i.Fragment,{children:[/* @__PURE__ */ (0,i.jsxs)(`div`,{className:J.compose,children:[/* @__PURE__ */ (0,i.jsx)(`input`,{ref:fe,className:J.message,type:`text`,value:j,enterKeyHint:`send`,placeholder:t(`desktop.message.placeholder`),"aria-label":t(`desktop.message.placeholder`),onFocus:()=>{clearTimeout(de.current),f(0),ue(!0)},onBlur:()=>{clearTimeout(de.current),de.current=setTimeout(()=>{ue(!1),window.scrollTo(0,0)},400)},onChange:e=>ie(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.nativeEvent.isComposing&&Je()}}),/* @__PURE__ */ (0,i.jsx)(`button`,{type:`button`,className:J.primary,disabled:ae,onClick:()=>void Je(),children:t(`desktop.send`)})]}),c!==void 0&&/* @__PURE__ */ (0,i.jsx)(`button`,{type:`button`,className:J.text,onClick:()=>l(void 0),children:t(`desktop.annotate.reset`)}),/* @__PURE__ */ (0,i.jsx)(`span`,{className:J.spacer}),/* @__PURE__ */ (0,i.jsx)(`button`,{type:`button`,className:J.text,onClick:()=>void Ye(),children:t(`desktop.save`)}),/* @__PURE__ */ (0,i.jsx)(`button`,{type:`button`,className:J.text,onClick:()=>void qe(),children:t(`desktop.attach`)})]})})]})]})}),document.body)}let gu=`@deepseek-ai/dsh-client-ui-codexhost/DesktopScreenshot.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(gu)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-codexhost`,e.dataset.pluginCss=gu,e.textContent=`.cXmFjW_entry{width:28px;height:28px;color:inherit;cursor:pointer;touch-action:manipulation;background:0 0;border:0;border-radius:6px;justify-content:center;align-items:center;padding:0;display:inline-flex}.cXmFjW_entryBusy{gap:4px;width:auto;min-width:28px;padding:0 6px}.cXmFjW_entry:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover)}.cXmFjW_entry:disabled{opacity:.45;cursor:default}.cXmFjW_entry[aria-busy=true]{opacity:1;cursor:progress}.cXmFjW_spinner{flex:none;animation:.8s linear infinite cXmFjW_spin;display:inline-flex}.cXmFjW_float{z-index:40;touch-action:none;-webkit-user-select:none;user-select:none;width:60px;height:60px;position:fixed}.cXmFjW_bubble{border:2px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-base);width:100%;height:100%;box-shadow:var(--dsw-elevation-soft);color:var(--dsw-alias-label-primary);cursor:grab;border-radius:50%;place-items:center;padding:0;display:grid;position:relative;overflow:hidden}.cXmFjW_bubble[data-error]{border-color:var(--dsw-alias-state-error-primary)}.cXmFjW_bubble img{object-fit:cover;pointer-events:none;width:100%;height:100%;position:absolute;inset:0}.cXmFjW_busy{background:color-mix(in srgb, var(--dsw-alias-bg-base) 70%, transparent);flex-direction:column;justify-content:center;align-items:center;width:100%;height:100%;display:flex;position:relative;inset:0}.cXmFjW_elapsed{font-variant-numeric:tabular-nums;font-size:11px}.cXmFjW_alert{color:var(--dsw-alias-state-error-primary);font-size:22px;font-weight:600}.cXmFjW_dismiss{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-base);width:20px;height:20px;color:var(--dsw-alias-label-secondary);cursor:pointer;border-radius:50%;place-items:center;padding:0;display:grid;position:absolute;top:-6px;right:-6px}.cXmFjW_caption{background:var(--dsw-alias-bg-base);width:max-content;max-width:200px;box-shadow:var(--dsw-elevation-soft);color:var(--dsw-alias-state-error-primary);overflow-wrap:anywhere;border-radius:8px;margin:0;padding:6px 8px;font-size:12px;line-height:16px;position:absolute;top:calc(100% + 6px);right:0}@keyframes cXmFjW_spin{to{transform:rotate(360deg)}}@media (prefers-reduced-motion:reduce){.cXmFjW_spinner{animation:none}}@media (pointer:coarse){.cXmFjW_entry{width:40px;height:44px}.cXmFjW_entryBusy{width:auto;min-width:40px}}`,document.head.appendChild(e)}var _u={alert:`cXmFjW_alert`,bubble:`cXmFjW_bubble`,busy:`cXmFjW_busy`,caption:`cXmFjW_caption`,dismiss:`cXmFjW_dismiss`,elapsed:`cXmFjW_elapsed`,entry:`cXmFjW_entry`,entryBusy:`cXmFjW_entryBusy`,float:`cXmFjW_float`,spin:`cXmFjW_spin`,spinner:`cXmFjW_spinner`};function vu({screenshot:e,sessionId:t,t:n}){let a=(0,o.useSyncExternalStore)(e.subscribe,e.getSnapshot);(0,o.useLayoutEffect)(()=>()=>{t!==void 0&&e.close(t)},[e,t]);let s=yu(a.startedAt);return t===void 0?null:/* @__PURE__ */ (0,i.jsx)(r.Tooltip,{portal:!0,side:`top`,label:n(a.pending?`desktop.pending`:`desktop.label`),children:/* @__PURE__ */ (0,i.jsx)(`button`,{type:`button`,className:a.pending?`${_u.entry} ${_u.entryBusy}`:_u.entry,"aria-label":n(`desktop.label`),"aria-busy":a.pending,onMouseDown:e=>e.preventDefault(),onClick:()=>void e.refresh(t),children:a.pending?/* @__PURE__ */ (0,i.jsxs)(i.Fragment,{children:[/* @__PURE__ */ (0,i.jsx)(`span`,{className:_u.spinner,"aria-hidden":`true`,children:/* @__PURE__ */ (0,i.jsx)(r.IconLoadingOutlineRegular,{size:16})}),/* @__PURE__ */ (0,i.jsxs)(`span`,{className:_u.elapsed,children:[s,`s`]})]}):/* @__PURE__ */ (0,i.jsxs)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 20 20`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.4`,"aria-hidden":`true`,children:[/* @__PURE__ */ (0,i.jsx)(`rect`,{x:`2`,y:`3`,width:`16`,height:`11`,rx:`2`}),/* @__PURE__ */ (0,i.jsx)(`path`,{d:`M10 14v3M6 17h8`})]})})})}function yu(e){let[t,n]=(0,o.useState)(()=>Date.now());return(0,o.useEffect)(()=>{if(e===void 0)return;n(Date.now());let t=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(t)},[e]),e===void 0?0:Math.max(0,Math.floor((t-e)/1e3))}let bu;function xu(e){return{x:Math.min(Math.max(e.x,8),Math.max(8,window.innerWidth-60-8)),y:Math.min(Math.max(e.y,8),Math.max(8,window.innerHeight-60-8))}}function Su(){return{x:window.innerWidth-60-12,y:72}}function Cu({screenshot:e,drafts:t,inputActions:n,useInput:a,sessionId:c,t:l}){let u=(0,o.useSyncExternalStore)(e.subscribe,e.getSnapshot),{image:d,pending:f,progress:p,error:m}=u,h=yu(u.startedAt),[g,_]=(0,o.useState)(()=>xu(bu??Su())),[v,y]=(0,o.useState)(!1),b=a(e=>e.draft),x=(0,o.useRef)(d?.url);(0,o.useEffect)(()=>{d!==void 0&&d.url!==x.current&&(x.current=d.url,y(!0))},[d]);let S=(0,o.useRef)();if((0,o.useEffect)(()=>{let e=()=>_(e=>xu(e));return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]),c===void 0||u.sessionId!==c||d===void 0&&!f&&m===void 0)return null;let C=()=>{f||(m!==void 0||d===void 0?e.refresh(c):y(!0))},w=e=>{let r=new File([e],`desktop-screenshot-${String(Date.now())}.png`,{type:`image/png`}),i=t.create(c,r);return n.addAttachments(i.map(e=>e.id))?null:(t.release(i),l(`desktop.attach.blocked`))},T=f&&p!==void 0?l(`desktop.transferring`,{loaded:wu(p.loaded),total:p.total===void 0?`?`:wu(p.total)}):f?l(`desktop.pending`):m===void 0?d===void 0?l(`desktop.label`):l(`desktop.captured`,{time:new Date(d.capturedAt).toLocaleString()}):`${l(`desktop.error.${m}`)} ${l(`desktop.refresh`)}`,E=e=>{e.button!==0||e.target.closest(`[data-float-close]`)||(e.currentTarget.setPointerCapture(e.pointerId),S.current={pointer:e.pointerId,dx:e.clientX-g.x,dy:e.clientY-g.y,x:e.clientX,y:e.clientY,moved:!1})},D=e=>{let t=S.current;t?.pointer===e.pointerId&&(!t.moved&&Math.hypot(e.clientX-t.x,e.clientY-t.y)<6||(t.moved=!0,_(xu({x:e.clientX-t.dx,y:e.clientY-t.dy}))))},O=(e,t)=>{let n=S.current;n?.pointer===e.pointerId&&(S.current=void 0,n.moved?bu=g:t||C())};return(0,s.createPortal)(/* @__PURE__ */ (0,i.jsxs)(i.Fragment,{children:[/* @__PURE__ */ (0,i.jsxs)(`div`,{className:_u.float,style:{left:g.x,top:g.y},role:`group`,"aria-label":l(`desktop.label`),onPointerDown:E,onPointerMove:D,onPointerUp:e=>O(e,!1),onPointerCancel:e=>O(e,!0),children:[/* @__PURE__ */ (0,i.jsxs)(`button`,{type:`button`,className:_u.bubble,"aria-label":d!==void 0&&!f&&m===void 0?l(`desktop.enlarge`):T,"aria-busy":f,title:T,"data-error":m!==void 0||void 0,onClick:e=>{e.detail===0&&C()},children:[d!==void 0&&/* @__PURE__ */ (0,i.jsx)(`img`,{src:d.url,alt:``,draggable:!1}),f&&/* @__PURE__ */ (0,i.jsxs)(`span`,{className:_u.busy,children:[/* @__PURE__ */ (0,i.jsx)(`span`,{className:_u.spinner,"aria-hidden":`true`,children:/* @__PURE__ */ (0,i.jsx)(r.IconLoadingOutlineRegular,{size:16})}),/* @__PURE__ */ (0,i.jsxs)(`span`,{className:_u.elapsed,children:[h,`s`]})]}),!f&&m!==void 0&&/* @__PURE__ */ (0,i.jsx)(`span`,{className:_u.alert,children:`!`})]}),/* @__PURE__ */ (0,i.jsx)(`button`,{type:`button`,className:_u.dismiss,"data-float-close":!0,"aria-label":l(`desktop.close`),onClick:()=>e.close(c),children:/* @__PURE__ */ (0,i.jsx)(r.IconCloseOutlineRegular,{size:10})}),m!==void 0&&!f&&/* @__PURE__ */ (0,i.jsx)(`p`,{role:`status`,className:_u.caption,children:l(`desktop.error.${m}`)})]}),v&&d!==void 0&&/* @__PURE__ */ (0,i.jsx)(hu,{src:d.url,t:l,onClose:()=>y(!1),onAttach:e=>w(e),onSend:async(e,t)=>{let r=w(e);if(r!==null)return r;if(t!==``){let e=n.captureInsertion(`end`),r=b.trim()===``?t:`\n${t}`;if(!n.insertText(r,e))return l(`desktop.attach.blocked`);await new Promise(e=>setTimeout(e,0))}return n.submit(),null}})]}),document.body)}function wu(e){return`${(e/1048576).toFixed(1)} MB`}var Tu=class{transcribe;state={phase:`idle`,seconds:0};listeners=/* @__PURE__ */ new Set;binding;insertion;recorder;stream;timer;meter;audio;abort;generation=0;sendAfter=!1;cancelling=!1;undoTimer;constructor(e){this.transcribe=e}getSnapshot=()=>this.state;subscribe=e=>(this.listeners.add(e),()=>this.listeners.delete(e));update(e){this.state=e;for(let e of this.listeners)e()}bind(e,t,n=!0){let r={actions:e,locked:t,available:n};return this.binding=r,()=>{this.binding===r&&(this.binding=void 0)}}releaseMic(){clearInterval(this.timer),this.meter&&=(clearInterval(this.meter.interval),this.meter.context.close().catch(()=>{}),void 0),this.stream?.getTracks().forEach(e=>e.stop()),this.stream=void 0}async start(){if(!this.binding||this.binding.locked||this.state.phase!==`idle`)return;let e=this.binding;this.insertion={binding:e,span:e.actions.captureInsertion()},this.sendAfter=!1;let t=++this.generation;if(this.update({phase:`permission`,seconds:0}),!navigator.mediaDevices?.getUserMedia||typeof MediaRecorder>`u`)this.update({phase:`idle`,seconds:0,error:`browser-unsupported`});else try{let e=await navigator.mediaDevices.getUserMedia({audio:!0});if(t!==this.generation){e.getTracks().forEach(e=>e.stop());return}this.stream=e;let n=[`audio/webm;codecs=opus`,`audio/mp4;codecs=mp4a.40.2`,`audio/mp4`].find(e=>MediaRecorder.isTypeSupported(e)),r=new MediaRecorder(e,n?{mimeType:n}:void 0);this.recorder=r;let i=[];r.ondataavailable=e=>{t===this.generation&&i.push(e.data)},r.onerror=()=>{t===this.generation&&(this.discard(),this.update({phase:`idle`,seconds:0,error:`record-failed`}))},r.onstop=()=>{t===this.generation&&(this.releaseMic(),this.audio=new Blob(i,{type:r.mimeType||i[0]?.type||n||`audio/webm`}),this.cancelling?(this.update({phase:`cancelled`,seconds:this.state.seconds}),this.undoTimer=setTimeout(()=>{t===this.generation&&this.state.phase===`cancelled`&&this.discard()},5e3)):this.retry())},r.start();let a=Date.now();this.update({phase:`recording`,seconds:0}),this.startMeter(e,t),this.timer=setInterval(()=>{let e=Math.floor((Date.now()-a)/1e3);this.update({...this.state,phase:`recording`,seconds:e}),e>=300&&this.stop()},1e3)}catch(e){if(t!==this.generation)return;this.releaseMic();let n=e?.name;this.update({phase:`idle`,seconds:0,error:n===`NotAllowedError`?`permission-denied`:n===`NotFoundError`?`no-microphone`:`record-failed`})}}startMeter(e,t){if(typeof AudioContext<`u`)try{let n=new AudioContext,r=n.createAnalyser();r.fftSize=512,n.createMediaStreamSource(e).connect(r);let i=new Uint8Array(r.fftSize),a=Date.now(),o=setInterval(()=>{if(t!==this.generation||this.state.phase!==`recording`)return;r.getByteTimeDomainData(i);let e=0;for(let t of i)e+=((t-128)/128)**2;let n=Math.min(1,Math.sqrt(e/i.length)*5);n>.06&&(a=Date.now());let o=[...this.state.levels??[],n].slice(-24);this.update({...this.state,levels:o,silent:Date.now()-a>3e3})},80);this.meter={context:n,interval:o}}catch{}}stop(){this.recorder?.state===`recording`&&(clearInterval(this.timer),this.update({phase:`transcribing`,seconds:this.state.seconds}),this.recorder.stop())}toggle(){this.state.phase===`idle`&&this.binding?.available?this.start():this.state.phase===`recording`&&this.stop()}cancel(){this.state.phase===`recording`&&this.state.seconds>=15&&this.recorder?.state===`recording`?(clearInterval(this.timer),this.cancelling=!0,this.recorder.stop()):this.discard()}undo(){this.state.phase===`cancelled`&&(clearTimeout(this.undoTimer),this.cancelling=!1,this.retry())}rerecord(){this.discard(),this.start()}send(){if(this.recorder?.state!==`recording`||!this.binding||this.binding.locked||this.binding.actions!==this.insertion?.binding.actions)return;let e=this.binding;this.insertion={binding:e,span:e.actions.captureInsertion(`end`)},this.sendAfter=!0,this.stop()}async retry(){if(!this.audio||this.abort)return;let e=this.generation,t=new AbortController;this.abort=t,this.update({...this.state,phase:`transcribing`,error:void 0,slow:!1});let n=setTimeout(()=>{this.abort===t&&this.update({...this.state,slow:!0})},1e4);try{let n=await this.transcribe(this.audio,t.signal);if(e!==this.generation)return;if(!n.ok){this.update({...this.state,phase:`failed`,error:n.error.code,slow:!1});return}this.audio=void 0;let r=this.insertion;r&&this.binding===r.binding&&!this.binding.locked&&r.binding.actions.insertText(n.text,r.span)?(this.sendAfter&&r.binding.actions.submit(),this.sendAfter=!1,this.update({phase:`idle`,seconds:0})):this.update({phase:`text`,seconds:0,text:n.text})}catch{e===this.generation&&this.update({...this.state,phase:`failed`,error:`network`,slow:!1})}finally{clearTimeout(n),this.abort===t&&(this.abort=void 0)}}insert(){if(!this.state.text||!this.binding||this.binding.locked)return;let{actions:e}=this.binding;e.insertText(this.state.text,e.captureInsertion())&&this.discard()}discard=()=>{this.generation++,clearTimeout(this.undoTimer),this.cancelling=!1,this.abort?.abort(),this.abort=void 0,this.recorder?.state===`recording`&&this.recorder.stop(),this.recorder=void 0,this.releaseMic(),this.audio=void 0,this.insertion=void 0,this.sendAfter=!1,this.update({phase:`idle`,seconds:0})}};let Eu=`@deepseek-ai/dsh-client-ui-codexhost/VoiceInput.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Eu)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-codexhost`,e.dataset.pluginCss=Eu,e.textContent=`.CWXqOG_entry{--voice-entry-size:28px;--voice-bar-width:229px;width:var(--voice-entry-size);height:var(--voice-entry-size);overflow-clip-margin:2px;flex:none;justify-content:flex-end;transition:width .18s;display:inline-flex;position:relative;overflow:clip}.CWXqOG_entry[data-live]{width:var(--voice-bar-width)}.CWXqOG_icon{border-radius:var(--dsw-radius-sm);width:28px;height:28px;color:var(--dsw-alias-label-secondary);cursor:pointer;touch-action:manipulation;background:0 0;border:none;outline:none;flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex}.CWXqOG_icon:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}.CWXqOG_icon:disabled{color:var(--dsw-alias-label-dimmed);cursor:default}.CWXqOG_icon:focus-visible,.CWXqOG_round:focus-visible,.CWXqOG_send:focus-visible,.CWXqOG_done:focus-visible,.CWXqOG_primary:focus-visible,.CWXqOG_secondary:focus-visible,.CWXqOG_quietButton:focus-visible{box-shadow:0 0 0 2px var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary))}.CWXqOG_bar{box-sizing:border-box;width:var(--voice-bar-width);background:var(--dsw-alias-interactive-bg-hover);height:28px;color:var(--dsw-alias-label-secondary);border-radius:999px;grid-template-columns:28px 96px 34px 28px 28px;align-items:center;gap:3px;padding:0 0 0 3px;font-size:12px;display:grid;position:absolute;top:0;right:0}.CWXqOG_round,.CWXqOG_send,.CWXqOG_done{width:28px;height:28px;color:var(--dsw-alias-label-secondary);cursor:pointer;touch-action:manipulation;background:0 0;border:none;border-radius:50%;outline:none;flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex}.CWXqOG_round:hover:not(:disabled),.CWXqOG_done:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover-solid);color:var(--dsw-alias-label-primary)}.CWXqOG_meter{justify-content:center;align-items:center;min-width:0;height:28px;display:flex}.CWXqOG_wave,.CWXqOG_quiet{flex:none;width:90px;height:20px}.CWXqOG_wave{color:var(--dsw-alias-label-secondary);fill:none;stroke:currentColor;stroke-width:1.6px;stroke-linecap:round}.CWXqOG_quiet{color:var(--dsw-alias-label-tertiary);text-overflow:ellipsis;white-space:nowrap;line-height:20px;overflow:hidden}.CWXqOG_status{white-space:nowrap;justify-content:center;align-items:center;gap:5px;max-width:100%;font-size:11px;display:inline-flex}.CWXqOG_statusText{text-overflow:ellipsis;min-width:0;overflow:hidden}.CWXqOG_sendFace,.CWXqOG_doneFace{border-radius:50%;justify-content:center;align-items:center;width:24px;height:24px;display:flex}.CWXqOG_sendFace{background:var(--dsw-alias-button-info-fill);color:#fff}.CWXqOG_doneFace{background:var(--dsw-specific-input-major);color:var(--dsw-alias-label-primary)}.CWXqOG_send:hover:not(:disabled){filter:brightness(1.08)}.CWXqOG_send:disabled,.CWXqOG_done:disabled{opacity:.4;cursor:default}.CWXqOG_spinner{border:1.5px solid;border-right-color:#0000;border-radius:50%;flex:none;width:10px;height:10px;animation:.8s linear infinite CWXqOG_spin}.CWXqOG_timer{width:34px;color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums;text-align:center;flex:none;font-size:11px}.CWXqOG_strip{box-sizing:border-box;background:var(--dsw-alias-interactive-bg-hover);width:100%;min-width:0;height:30px;color:var(--dsw-alias-label-secondary);border-radius:999px;align-items:center;gap:6px;padding:0 2px;font-size:12px;display:flex}.CWXqOG_strip .CWXqOG_round,.CWXqOG_strip .CWXqOG_done{width:26px;height:26px;position:relative}.CWXqOG_strip .CWXqOG_round:before,.CWXqOG_strip .CWXqOG_done:before{content:"";position:absolute;inset:-9px}.CWXqOG_strip .CWXqOG_meter{flex:1}.CWXqOG_notice{border-radius:var(--dsw-radius-lg);background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-secondary);flex-wrap:wrap;align-items:center;gap:8px;padding:6px 6px 6px 12px;font-size:13px;line-height:19px;display:flex}.CWXqOG_notice[data-tone=error]{background:color-mix(in srgb, var(--dsw-alias-state-error-primary) 10%, transparent);color:var(--dsw-alias-label-primary)}.CWXqOG_notice p{flex:220px;margin:0}.CWXqOG_card{border:1px solid var(--dsw-alias-border-l2);border-radius:var(--dsw-radius-lg);color:var(--dsw-alias-label-primary);flex-direction:column;gap:8px;padding:10px 10px 10px 12px;font-size:13px;display:flex}.CWXqOG_cardHead{color:var(--dsw-alias-label-tertiary);align-items:center;gap:6px;font-size:12px;display:flex}.CWXqOG_cardText{white-space:pre-wrap;max-height:120px;margin:0;font-size:14px;line-height:21px;overflow:auto}.CWXqOG_actions{flex-wrap:wrap;justify-content:flex-end;gap:8px;display:flex}.CWXqOG_primary,.CWXqOG_secondary,.CWXqOG_quietButton{height:28px;font:inherit;cursor:pointer;border-radius:999px;outline:none;padding:0 12px;font-size:13px}.CWXqOG_primary{background:var(--dsw-alias-label-primary);color:var(--dsw-alias-bg-base);border:none}.CWXqOG_secondary{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-base);color:var(--dsw-alias-label-primary)}.CWXqOG_quietButton{color:var(--dsw-alias-label-secondary);background:0 0;border:none}.CWXqOG_secondary:hover,.CWXqOG_quietButton:hover{background:var(--dsw-alias-interactive-bg-hover)}@keyframes CWXqOG_spin{to{transform:rotate(360deg)}}@media (prefers-reduced-motion:reduce){.CWXqOG_entry{transition:none}.CWXqOG_spinner{animation:none}}@media (width<=600px),(pointer:coarse){.CWXqOG_entry{--voice-entry-size:44px}.CWXqOG_strip{margin-block:7px}.CWXqOG_icon{width:44px;height:44px}.CWXqOG_primary,.CWXqOG_secondary,.CWXqOG_quietButton{height:40px;padding:0 14px}}`,document.head.appendChild(e)}var Y={actions:`CWXqOG_actions`,bar:`CWXqOG_bar`,card:`CWXqOG_card`,cardHead:`CWXqOG_cardHead`,cardText:`CWXqOG_cardText`,done:`CWXqOG_done`,doneFace:`CWXqOG_doneFace`,entry:`CWXqOG_entry`,icon:`CWXqOG_icon`,meter:`CWXqOG_meter`,notice:`CWXqOG_notice`,primary:`CWXqOG_primary`,quiet:`CWXqOG_quiet`,quietButton:`CWXqOG_quietButton`,round:`CWXqOG_round`,secondary:`CWXqOG_secondary`,send:`CWXqOG_send`,sendFace:`CWXqOG_sendFace`,spin:`CWXqOG_spin`,spinner:`CWXqOG_spinner`,status:`CWXqOG_status`,statusText:`CWXqOG_statusText`,strip:`CWXqOG_strip`,timer:`CWXqOG_timer`,wave:`CWXqOG_wave`};let Du=typeof navigator<`u`&&/Mac|iPhone|iPad/.test(navigator.platform)?[`⌘`,`⇧`,`Space`]:[`Ctrl`,`Shift`,`Space`];function Ou(e){return(0,o.useSyncExternalStore)(e.subscribe,e.getSnapshot)}var ku=class{stacked=!1;listeners=/* @__PURE__ */ new Set;subscribe=e=>(this.listeners.add(e),()=>this.listeners.delete(e));getSnapshot=()=>this.stacked;set(e){if(e!==this.stacked){this.stacked=e;for(let e of this.listeners)e()}}};let Au=e=>e.phase===`permission`||e.phase===`recording`||e.phase===`transcribing`,ju=e=>`${Math.floor(e/60)}:${String(e%60).padStart(2,`0`)}`;function Mu({voice:e,blocks:t,tray:n,sessionId:a,inputActions:s,useInput:c,useSession:l,t:u}){let d=Ou(e),[f,p]=(0,o.useState)(!1),m=(0,o.useSyncExternalStore)(n.subscribe,n.getSnapshot),h=(0,o.useRef)(null),g=Au(d),_=g||f&&d.phase===`idle`,v=(0,o.useMemo)(()=>t.storeFor(a),[t,a]),y=(0,o.useSyncExternalStore)(v.subscribe,v.getSnapshot)!==void 0,b=c(e=>e.phase!==`plain`),x=l(e=>e.removed||e.subagent?.address.mode===`continuable`&&e.subagent.parentAvailable!==!0),S=y||b||x;return(0,o.useLayoutEffect)(()=>e.bind(s,S,f),[e,s,S,f]),(0,o.useLayoutEffect)(()=>{if(g)return s.bindPrimaryAction({disabled:d.phase!==`recording`,run:()=>e.send()})},[e,s,g,d.phase]),(0,o.useEffect)(()=>{let e=!0,t=0,n=()=>{let n=++t;kl.status().then(r=>{e&&n===t&&p(r.available)},()=>{e&&n===t&&p(!1)})},r=()=>{document.visibilityState===`visible`&&n()};return n(),document.addEventListener(`visibilitychange`,r),()=>{e=!1,document.removeEventListener(`visibilitychange`,r)}},[a]),(0,o.useLayoutEffect)(()=>{let e=h.current,t=e?.closest(`[data-composer-toolbar]`);if(!e||!t||typeof ResizeObserver>`u`)return;let r=()=>{let r=e.getBoundingClientRect();if(g&&r.width===0)return;let i=getComputedStyle(t),a=t.getBoundingClientRect().width-parseFloat(i.paddingLeft)-parseFloat(i.paddingRight),o=Array.from(t.children,e=>e.getBoundingClientRect().width).filter(e=>e>0),s=parseFloat(getComputedStyle(e).getPropertyValue(`--voice-bar-width`)),c=o.reduce((e,t)=>e+t,0)+Math.max(0,o.length-1)*parseFloat(i.columnGap)+s-r.width;n.set(window.matchMedia(`(max-width: 600px), (pointer: coarse)`).matches||c>a)},i=new ResizeObserver(r);i.observe(t),i.observe(e);for(let e of t.children)i.observe(e);return r(),()=>i.disconnect()},[n,_,g]),_?/* @__PURE__ */ (0,i.jsx)(`span`,{ref:h,className:Y.entry,"data-composer-tray":m?`stacked`:`inline`,"data-live":g&&!m?``:void 0,children:g&&!m?/* @__PURE__ */ (0,i.jsx)(Pu,{voice:e,state:d,locked:S,layout:`inline`,t:u}):/* @__PURE__ */ (0,i.jsx)(r.Tooltip,{portal:!0,side:`top`,label:u(`voice.label`),shortcutKeys:Du,children:/* @__PURE__ */ (0,i.jsx)(`button`,{type:`button`,className:Y.icon,"aria-label":u(`voice.label`),disabled:S,onMouseDown:e=>e.preventDefault(),onClick:()=>void e.start(),children:/* @__PURE__ */ (0,i.jsx)(r.IconMicrophoneOutlineMedium,{size:16})})})}):null}function Nu({voice:e,tray:t,onActiveChange:n,t:r}){let a=Ou(e),s=(0,o.useSyncExternalStore)(t.subscribe,t.getSnapshot)&&Au(a);return(0,o.useLayoutEffect)(()=>n(s),[s,n]),(0,o.useLayoutEffect)(()=>()=>n(!1),[n]),s?/* @__PURE__ */ (0,i.jsx)(Pu,{voice:e,state:a,locked:!1,layout:`strip`,t:r}):null}function Pu({voice:e,state:t,locked:n,layout:a,t:o}){let s=t.phase===`recording`,c=t.levels??[],l=o(t.phase===`permission`?`voice.permission`:t.slow?`voice.slow`:`voice.transcribing`);return/* @__PURE__ */ (0,i.jsxs)(`span`,{className:a===`inline`?Y.bar:Y.strip,role:`group`,"aria-label":o(`voice.label`),children:[/* @__PURE__ */ (0,i.jsx)(r.Tooltip,{portal:!0,side:`top`,label:o(`voice.cancel`),shortcutKeys:[`Esc`],children:/* @__PURE__ */ (0,i.jsx)(`button`,{type:`button`,className:Y.round,"aria-label":o(`voice.cancel`),onClick:()=>e.cancel(),children:/* @__PURE__ */ (0,i.jsx)(r.IconCloseOutlineMedium,{size:14})})}),/* @__PURE__ */ (0,i.jsx)(`span`,{className:Y.meter,children:s?t.silent?/* @__PURE__ */ (0,i.jsx)(`span`,{className:Y.quiet,role:`status`,children:o(`voice.silent`)}):/* @__PURE__ */ (0,i.jsx)(`svg`,{className:Y.wave,viewBox:`0 0 96 24`,"aria-hidden":`true`,children:c.every(e=>e<.02)?/* @__PURE__ */ (0,i.jsx)(`path`,{d:`M2 12h92`}):Array.from({length:24},(e,t)=>{let n=c[c.length-24+t]??0,r=1+Math.round(n*21),a=2+t*4;return/* @__PURE__ */ (0,i.jsx)(`path`,{d:`M${a} ${(24-r)/2}v${r}`},t)})}):/* @__PURE__ */ (0,i.jsxs)(`span`,{className:Y.status,role:`status`,title:l,children:[/* @__PURE__ */ (0,i.jsx)(`span`,{className:Y.spinner,"aria-hidden":`true`}),/* @__PURE__ */ (0,i.jsx)(`span`,{className:Y.statusText,children:l})]})}),/* @__PURE__ */ (0,i.jsx)(`span`,{className:Y.timer,role:`timer`,children:ju(t.seconds)}),a===`inline`?/* @__PURE__ */ (0,i.jsx)(r.Tooltip,{portal:!0,side:`top`,label:o(`voice.send`),children:/* @__PURE__ */ (0,i.jsx)(`button`,{type:`button`,className:Y.send,"aria-label":o(`voice.send`),disabled:n||!s,onMouseDown:e=>e.preventDefault(),onClick:()=>e.send(),children:/* @__PURE__ */ (0,i.jsx)(`span`,{className:Y.sendFace,children:/* @__PURE__ */ (0,i.jsx)(Fu,{})})})}):null,/* @__PURE__ */ (0,i.jsx)(r.Tooltip,{portal:!0,side:`top`,label:o(`voice.stop`),shortcutKeys:Du,children:/* @__PURE__ */ (0,i.jsx)(`button`,{type:`button`,className:Y.done,"aria-label":o(`voice.stop`),disabled:!s,onMouseDown:e=>e.preventDefault(),onClick:()=>e.stop(),children:/* @__PURE__ */ (0,i.jsx)(`span`,{className:Y.doneFace,children:/* @__PURE__ */ (0,i.jsx)(r.IconStopFillMedium,{size:9})})})})]})}function Fu(){return/* @__PURE__ */ (0,i.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.6`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:/* @__PURE__ */ (0,i.jsx)(`path`,{d:`M12 19V5M6 11l6-6 6 6`})})}function Iu({voice:e,t}){let n=Ou(e);if(n.phase===`cancelled`)return/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Y.notice,role:`status`,children:[/* @__PURE__ */ (0,i.jsx)(`p`,{children:t(`voice.cancelled`,{time:ju(n.seconds)})}),/* @__PURE__ */ (0,i.jsx)(`button`,{type:`button`,className:Y.primary,onClick:()=>e.undo(),children:t(`voice.undo`)}),/* @__PURE__ */ (0,i.jsx)(Lu,{label:t(`voice.discard`),onClick:e.discard})]});if(n.phase===`text`)return/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Y.card,role:`region`,"aria-label":t(`voice.label`),children:[/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Y.cardHead,children:[/* @__PURE__ */ (0,i.jsx)(r.IconMicrophoneOutlineMedium,{size:14}),t(`voice.unplaced`)]}),/* @__PURE__ */ (0,i.jsx)(`p`,{className:Y.cardText,children:n.text}),/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Y.actions,children:[/* @__PURE__ */ (0,i.jsx)(`button`,{type:`button`,className:Y.quietButton,onClick:e.discard,children:t(`voice.discard`)}),/* @__PURE__ */ (0,i.jsx)(`button`,{type:`button`,className:Y.secondary,onClick:()=>void navigator.clipboard.writeText(n.text??``).catch(()=>{}),children:t(`voice.copy`)}),/* @__PURE__ */ (0,i.jsx)(`button`,{type:`button`,className:Y.primary,onMouseDown:e=>e.preventDefault(),onClick:()=>e.insert(),children:t(`voice.insert`)})]})]});if(!n.error)return null;let a=n.error,o=n.phase===`failed`,s=o&&![`audio-empty`,`audio-too-large`,`audio-format`,`audio-invalid`].includes(a),c=o||a===`record-failed`;return/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Y.notice,"data-tone":c?`error`:void 0,role:`alert`,children:[/* @__PURE__ */ (0,i.jsx)(`p`,{children:t(`voice.error.${a}`)}),o?/* @__PURE__ */ (0,i.jsx)(`button`,{type:`button`,className:s?Y.secondary:Y.primary,onClick:()=>e.rerecord(),children:t(`voice.rerecord`)}):null,s?/* @__PURE__ */ (0,i.jsx)(`button`,{type:`button`,className:Y.primary,onClick:()=>void e.retry(),children:t(`voice.retry`)}):null,a===`permission-denied`||a===`no-microphone`||a===`record-failed`?/* @__PURE__ */ (0,i.jsx)(`button`,{type:`button`,className:Y.secondary,onClick:()=>e.rerecord(),children:t(`voice.tryAgain`)}):null,/* @__PURE__ */ (0,i.jsx)(Lu,{label:t(`voice.discard`),onClick:e.discard})]})}function Lu({label:e,onClick:t}){return/* @__PURE__ */ (0,i.jsx)(`button`,{type:`button`,className:Y.round,"aria-label":e,onClick:t,children:/* @__PURE__ */ (0,i.jsx)(r.IconCloseOutlineMedium,{size:14})})}function Ru({size:e}){return/* @__PURE__ */ (0,i.jsx)(r.IconDownloadOutlineRegular,{size:e})}function zu({sessionId:e,list:t}){let n=(0,o.useSyncExternalStore)(e=>t.subscribe(e),()=>t.getSnapshot().byId[e]?.projectionValues?.harnessIdentity);return n?/* @__PURE__ */ (0,i.jsx)(`span`,{"data-harness-id":n.id,title:n.name,role:`img`,"aria-label":n.name,style:{display:`inline-flex`,width:14,height:14,flexShrink:0,color:`inherit`},children:/* @__PURE__ */ (0,i.jsx)(r.RemotePluginIcon,{id:n.id,src:`/harness-icons/${encodeURIComponent(n.id)}`,presentationUrl:`/harness-icons/presentation.json`,size:14,fallback:/* @__PURE__ */ (0,i.jsx)(r.IconDataOutlineRegular,{size:14})})}):null}let Bu=`@deepseek-ai/dsh-client-ui-codexhost/HostConnectionStatus.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Bu)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-codexhost`,e.dataset.pluginCss=Bu,e.textContent=`.AGZkaG_status{border-bottom:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-primary);flex-shrink:0;justify-content:space-between;align-items:center;gap:12px;padding:6px 16px;font-size:12px;display:flex}.AGZkaG_copy{overflow-wrap:anywhere;flex-wrap:wrap;gap:4px 12px;min-width:0;display:flex}.AGZkaG_detail{color:var(--dsw-alias-label-tertiary)}.AGZkaG_retry{min-width:44px;min-height:44px;color:inherit;font:inherit;cursor:pointer;background:0 0;border:0;border-radius:6px;flex-shrink:0;padding:0 8px}.AGZkaG_retry:hover{background:var(--dsw-alias-interactive-bg-hover)}.AGZkaG_retry:focus-visible{outline-offset:2px;outline:2px solid}`,document.head.appendChild(e)}var Vu={copy:`AGZkaG_copy`,detail:`AGZkaG_detail`,retry:`AGZkaG_retry`,status:`AGZkaG_status`};function Hu(e){let t=(e+`=`.repeat((4-e.length%4)%4)).replace(/-/gu,`+`).replace(/_/gu,`/`),n=atob(t),r=new Uint8Array(new ArrayBuffer(n.length));for(let e=0;e<n.length;e+=1)r[e]=n.charCodeAt(e);return r}function Uu(){let e=/iPad|iPhone|iPod/u.test(navigator.userAgent),t=window.matchMedia(`(display-mode: standalone)`).matches||navigator.standalone===!0;return e&&!t}async function Wu(){return await navigator.serviceWorker.getRegistration(`./`)??await navigator.serviceWorker.register(`sw.js`,{scope:`./`})}async function Gu(){return!(`serviceWorker`in navigator)||!(`PushManager`in window)||!(`Notification`in window)?Uu()?`needs-install`:`unsupported`:Notification.permission===`denied`?`denied`:await(await navigator.serviceWorker.getRegistration(`./`))?.pushManager.getSubscription()==null?`off`:`on`}async function Ku(){let e=await Notification.requestPermission();if(e!==`granted`)return e===`denied`?`denied`:`off`;let t=await Wu();await navigator.serviceWorker.ready;let{publicKey:n}=await Fl.config(),r=await t.pushManager.getSubscription()??await t.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:Hu(n)});return await Fl.subscribe(r.toJSON()),`on`}async function qu(){let e=await(await navigator.serviceWorker.getRegistration(`./`))?.pushManager.getSubscription();return e!=null&&(await Fl.unsubscribe(e.endpoint),await e.unsubscribe()),`off`}function Ju(){`serviceWorker`in navigator&&Wu().catch(()=>void 0)}function Yu(){`serviceWorker`in navigator&&`Notification`in window&&Notification.permission===`granted`&&(async()=>{let e=await(await navigator.serviceWorker.getRegistration(`./`))?.pushManager.getSubscription();e!=null&&await Fl.subscribe(e.toJSON())})().catch(()=>void 0)}let Xu=5e3,Zu=(0,a.createSnapshotStore)(!1);function Qu(e){let t,n=!1,r=!1,i=0,a=async()=>{if(n||r||e.getSnapshot()!==`connecting`)return;n=!0,clearTimeout(t);let o=Date.now(),s=!1;try{let e=await fetch(`api/auth/status`,{credentials:`same-origin`,cache:`no-store`,signal:AbortSignal.timeout(Xu)});if(e.status===401){window.location.reload();return}s=e.status===200}catch{}n=!1,!(r||e.getSnapshot()!==`connecting`)&&(s&&(i=0,Zu.set(!1)),t=setTimeout(()=>{s||(i+=1,Zu.set(i>=2)),a()},Math.max(0,Xu-(Date.now()-o))))},o=()=>{e.getSnapshot()===`connecting`?a():(clearTimeout(t),i=0,Zu.set(!1))},s=e.subscribe(o);return o(),()=>{r=!0,clearTimeout(t),Zu.set(!1),s()}}async function $u(){await qu().catch(()=>void 0);let e=await fetch(`api/auth/logout`,{method:`POST`,credentials:`same-origin`});if(!e.ok)throw Error(`HTTP ${String(e.status)}`);window.location.reload()}function ed({sessionId:e,useSession:t,list:n,connection:a,t:s}){let c=(0,o.useSyncExternalStore)(a.state.subscribe,a.state.getSnapshot),l=(0,o.useSyncExternalStore)(Zu.subscribe,Zu.getSnapshot),u=(0,o.useSyncExternalStore)(e=>n.subscribe(e),()=>e===void 0?void 0:n.getSnapshot().byId[e]?.projectionValues?.nativeConnection?.state),d=(0,o.useSyncExternalStore)(e=>n.subscribe(e),()=>{let t=e===void 0?void 0:n.getSnapshot().byId[e]?.projectionValues;return t?.nativeInteractionError??t?.nativeConnection?.message}),f=t(e=>e.openState),[p,m]=(0,o.useState)(``),h=`${e}:${d??``}`,g=c===void 0||c===`connecting`,_=(0,r.useSustainedRecovery)(g),v=c===`disconnected`?`offline`:g?l?`computer`:_?c===void 0?`checking`:`reconnecting`:void 0:u===`reconnecting`?`host`:f===`error`?`error`:void 0,y=t(e=>v===void 0?void 0:e.lastSyncedAt);return/* @__PURE__ */ (0,i.jsxs)(i.Fragment,{children:[v?/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Vu.status,role:`status`,"data-web-connection":v,"data-native-connection":u===`reconnecting`?u:void 0,children:[/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Vu.copy,children:[/* @__PURE__ */ (0,i.jsx)(`span`,{children:s(`connection.${v}`)}),y===void 0?null:/* @__PURE__ */ (0,i.jsx)(`span`,{className:Vu.detail,children:s(`connection.lastSynced`,{time:new Date(y).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})})})]}),/* @__PURE__ */ (0,i.jsx)(`button`,{type:`button`,className:Vu.retry,onClick:()=>a.reconnect(),children:s(`connection.retry`)})]}):null,d&&p!==h?/* @__PURE__ */ (0,i.jsx)(r.Toast,{text:d,holdMs:8e3,onDone:()=>m(h)},h):null]})}let td=`@deepseek-ai/dsh-client-ui-codexhost/ImportedThreadNotice.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(td)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-codexhost`,e.dataset.pluginCss=td,e.textContent=`.nSS2Xa_notice{border-bottom:1px solid var(--dsw-alias-border-l2);color:var(--dsw-alias-label-tertiary);overflow-wrap:anywhere;flex-shrink:0;padding:6px 16px;font-size:12px}`,document.head.appendChild(e)}var nd={notice:`nSS2Xa_notice`};function rd({sessionId:e,list:t,t:n}){let r=(0,o.useSyncExternalStore)(e=>t.subscribe(e),()=>{let n=e===void 0?void 0:t.getSnapshot().byId[e]?.projectionValues?.codexhostImportSource;return n?.harnessId===`codex-cli`?n.nativeSessionId:void 0});return r?/* @__PURE__ */ (0,i.jsx)(`div`,{className:nd.notice,"data-codexhost-import-source":r,children:n(`import.sourceBranch`,{sessionId:r})}):null}let id=`@deepseek-ai/dsh-client-ui-codexhost/HostUsageDock.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(id)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-codexhost`,e.dataset.pluginCss=id,e.textContent=`.rSFubG_anchor{min-width:0;max-width:min(280px,46vw);font-size:calc(var(--dsh-content-font-size-secondary,13px) - 1px);line-height:calc(20px + var(--dsh-content-font-delta-secondary,0px));display:inline-flex}.rSFubG_anchor[data-composer-stat=codexhost-quota]{order:-1}.rSFubG_pill{box-sizing:border-box;corner-shape:round;min-width:0;max-width:100%;color:var(--dsw-alias-label-tertiary);font:inherit;font-variant-numeric:tabular-nums;line-height:inherit;white-space:nowrap;cursor:pointer;background:0 0;border:none;border-radius:999px;align-items:center;gap:6px;padding:1px 8px;display:inline-flex}.rSFubG_pill:hover,.rSFubG_pill:focus-visible,.rSFubG_pill[aria-expanded=true]{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-secondary)}.rSFubG_label{text-overflow:ellipsis;min-width:0;overflow:hidden}.rSFubG_panel{z-index:1100;box-sizing:border-box;border-radius:var(--dsw-radius-lg);background:var(--dsw-specific-menu);width:min(320px,100vw - 24px);max-height:min(520px,100vh - 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:14px;font-size:13px;line-height:19px;position:fixed;overflow:auto}.rSFubG_panel header{color:var(--dsw-alias-label-primary);font-size:16px;font-weight:500;line-height:22px}.rSFubG_context{margin-top:10px}.rSFubG_contextRow{color:var(--dsw-alias-label-tertiary);justify-content:space-between;align-items:center;gap:20px;display:flex}.rSFubG_contextRow strong{color:var(--dsw-alias-label-primary);font-variant-numeric:tabular-nums;font-weight:400}.rSFubG_progressTrack{background:var(--dsw-alias-interactive-bg-hover);border-radius:999px;height:4px;margin-top:6px;overflow:hidden}.rSFubG_progressFill{border-radius:inherit;background:var(--dsw-alias-label-secondary);height:100%;display:block}.rSFubG_group{margin-top:12px}.rSFubG_group h3{color:var(--dsw-alias-label-tertiary);margin:0 0 5px;font-size:12px;font-weight:600}.rSFubG_group dl{gap:5px;margin:0;display:grid}.rSFubG_detail{grid-template-columns:minmax(120px,auto) minmax(0,1fr);gap:0 16px;display:grid}.rSFubG_detail dt,.rSFubG_detail dd,.rSFubG_detail p{min-width:0;margin:0}.rSFubG_detail dt{color:var(--dsw-alias-label-tertiary)}.rSFubG_detail dd{color:var(--dsw-alias-label-secondary);font-variant-numeric:tabular-nums;text-align:right}.rSFubG_detail p{color:var(--dsw-alias-label-tertiary);text-align:right;overflow-wrap:anywhere;grid-column:1/-1;font-size:11px}.rSFubG_quotaRing{fill:none;stroke:#399b69;stroke-width:3px;flex-shrink:0;width:16px;height:16px}.rSFubG_ringTrack{stroke:var(--dsw-alias-interactive-bg-hover)}.rSFubG_quotaPanel{--quota-color:#3d9a64;border:1px solid var(--dsw-alias-border-l1);background-image:radial-gradient(160px 100px at 18% -10%, color-mix(in srgb, var(--quota-color) 20%, transparent), transparent 70%);width:min(266px,100vw - 24px);color:var(--dsw-alias-label-primary);letter-spacing:0;border-radius:14px;padding:10px 12px;font:13px/1.35 system-ui,sans-serif}.rSFubG_quotaRow+.rSFubG_quotaRow,.rSFubG_quotaGroup+.rSFubG_quotaGroup{margin-top:11px}.rSFubG_quotaHeading{justify-content:space-between;align-items:flex-start;gap:12px;margin-bottom:5px;font-size:12px;display:flex}.rSFubG_quotaDescription{min-width:0}.rSFubG_quotaHeading strong{color:var(--quota-color);font-variant-numeric:tabular-nums;white-space:nowrap;align-items:baseline;gap:4px;font-size:12px;font-weight:400;display:inline-flex}.rSFubG_quotaGroup:first-child .rSFubG_quotaRow:first-child .rSFubG_quotaDescription>span{font-size:12.5px;font-weight:600}.rSFubG_quotaGroup:first-child .rSFubG_quotaRow:first-child .rSFubG_remainingLabel{opacity:.8;font-size:11px;font-weight:600}.rSFubG_quotaGroup:first-child .rSFubG_quotaRow:first-child .rSFubG_remainingValue{font-size:26px;font-weight:700}.rSFubG_quotaRow p{color:color-mix(in srgb, currentColor 62%, transparent);margin:0;font-size:10.5px}.rSFubG_quotaGroup:first-child .rSFubG_quotaRow:first-child p{font-size:11px}.rSFubG_quotaPanel .rSFubG_progressTrack{background:color-mix(in srgb, currentColor 16%, transparent);height:6px;margin-top:0}.rSFubG_quotaFill{border-radius:inherit;background:var(--quota-color);height:100%;display:block}@media (width<=640px){.rSFubG_anchor{max-width:42vw}}`,document.head.appendChild(e)}var X={anchor:`rSFubG_anchor`,context:`rSFubG_context`,contextRow:`rSFubG_contextRow`,detail:`rSFubG_detail`,group:`rSFubG_group`,label:`rSFubG_label`,panel:`rSFubG_panel`,pill:`rSFubG_pill`,progressFill:`rSFubG_progressFill`,progressTrack:`rSFubG_progressTrack`,quotaDescription:`rSFubG_quotaDescription`,quotaFill:`rSFubG_quotaFill`,quotaGroup:`rSFubG_quotaGroup`,quotaHeading:`rSFubG_quotaHeading`,quotaPanel:`rSFubG_quotaPanel`,quotaRing:`rSFubG_quotaRing`,quotaRow:`rSFubG_quotaRow`,remainingLabel:`rSFubG_remainingLabel`,remainingValue:`rSFubG_remainingValue`,ringTrack:`rSFubG_ringTrack`};let ad={visibility:`hidden`,left:0,top:0};function od(e,t=1){return e.toFixed(t).replace(/\.?0+$/u,``)}function sd(e){return e<1e3?String(Math.round(e)):e<1e6?`${od(e/1e3)}K`:e<1e9?`${od(e/1e6)}M`:`${od(e/1e9)}B`}function cd(e){return`${od(e)}%`}function ld(e){return e.contextUsagePercent??(e.contextUsedTokens!==void 0&&e.contextWindowTokens!==void 0?e.contextUsedTokens/e.contextWindowTokens*100:void 0)}function ud(e,t){return`${e>=100?Math.round(e):od(e)} ${t(`usage.unit.tps`)}`}function dd(e,t){return e<1e3?`${Math.round(e)} ${t(`usage.unit.ms`)}`:`${od(e/1e3)} ${t(`usage.unit.seconds`)}`}function fd(e){if(e.totalCostUsd===void 0)return null;let t=`$${e.totalCostUsd.toFixed(e.totalCostUsd>=1?2:3)}`;return e.unpricedModels?.length?`≥${t}`:t}function pd(e,t){return`${e>0&&e<.001?`<0.001`:od(e,3)} ${t(`usage.unit.credits`)}`}function md(e,t){if(e===void 0)return null;let n=new Date(typeof e==`number`?e*1e3:e);if(Number.isNaN(n.getTime()))return null;let r=/* @__PURE__ */ new Date,i=n.getFullYear()===r.getFullYear()&&n.getMonth()===r.getMonth()&&n.getDate()===r.getDate(),a=t(`usage.dateLocale`);return t(`usage.reset.at`,{time:i?t(`usage.reset.today`,{time:n.toLocaleTimeString(a,{hour:`numeric`,minute:`2-digit`})}):n.toLocaleString(a,{month:a===`zh-CN`?`long`:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`})})}function hd(e,t,n){return e===void 0||t===void 0?``:`${od(e,2)} / ${od(t,2)}${n?` ${n}`:``}`}function gd(e,t){if(e===null)return[];let n=[e.cacheHitRatePercent===void 0?null:`${t(`usage.cache.short`)} ${cd(e.cacheHitRatePercent)}`,e.outputTokensPerSecond===void 0?e.apiOutputTokensPerSecond===void 0?null:`API ${ud(e.apiOutputTokensPerSecond,t)}`:ud(e.outputTokensPerSecond,t),fd(e)].filter(e=>e!==null);if(n.length>0)return n;if(e.totalTokens!==void 0)return[`${sd(e.totalTokens)} ${t(`usage.unit.tokens`)}`];let r=ld(e);return r===void 0?[]:[`${t(`usage.context`)}: ${cd(r)}`]}function _d(e,t){let n=[];if(e!==null){let r=[],i=fd(e);i!==null&&r.push({label:e.costSource===`publicPrice`?t(`usage.cost.estimate`):t(`usage.cost`),value:i,...e.unpricedModels?.length?{note:`${t(`usage.unpriced`)}: ${e.unpricedModels.join(`, `)}`}:{}}),e.totalCredits!==void 0&&r.push({label:t(`usage.credits`),value:pd(e.totalCredits,t)}),e.sessionCacheHitRatePercent!==void 0&&r.push({label:t(`usage.cache.average`),value:cd(e.sessionCacheHitRatePercent)}),e.cacheHitRatePercent!==void 0&&r.push({label:t(`usage.cache.latest`),value:cd(e.cacheHitRatePercent)}),r.length&&n.push({label:t(`usage.group.session`),rows:r});let a=[];e.outputTokensPerSecond===void 0?e.apiOutputTokensPerSecond!==void 0&&a.push({label:t(`usage.speed.api`),value:ud(e.apiOutputTokensPerSecond,t)}):a.push({label:t(`usage.speed`),value:ud(e.outputTokensPerSecond,t)}),e.timeToFirstOutputMs!==void 0&&a.push({label:t(`usage.ttft`),value:dd(e.timeToFirstOutputMs,t)}),a.length&&n.push({label:t(`usage.group.turn`),rows:a});let o=[];(e.inputTokens!==void 0||e.outputTokens!==void 0)&&o.push({label:t(`usage.tokens.io`),value:`${e.inputTokens===void 0?`—`:sd(e.inputTokens)} / ${e.outputTokens===void 0?`—`:sd(e.outputTokens)}`}),(e.cachedInputTokens!==void 0||e.cacheWriteInputTokens!==void 0)&&o.push({label:e.cacheWriteInputTokens!==void 0&&e.cacheWriteInputTokens>0?t(`usage.tokens.cacheReadWrite`):t(`usage.tokens.cacheRead`),value:e.cacheWriteInputTokens!==void 0&&e.cacheWriteInputTokens>0?`${e.cachedInputTokens===void 0?`—`:sd(e.cachedInputTokens)} / ${sd(e.cacheWriteInputTokens)}`:sd(e.cachedInputTokens??0)}),e.totalTokens!==void 0&&o.push({label:t(`usage.tokens.total`),value:sd(e.totalTokens)}),o.length&&n.push({label:t(`usage.group.tokens`),rows:o})}return n}function vd(e){return Math.min(100,Math.max(0,100-e))}function yd(e){return e<=10?`#c45c4a`:e<=30?`#c9a227`:`#3d9a64`}function bd(e,t,n){let r=[];if(!t&&e){let t=[];for(let[r,i,a]of[[n(`usage.plan.fiveHour`),e.planFiveHourUsedPercent,e.planFiveHourResetsAtUnix],[n(`usage.plan.sevenDay`),e.planSevenDayUsedPercent,e.planSevenDayResetsAtUnix]]){if(i===void 0)continue;let e=md(a,n);t.push({label:r,value:cd(vd(i)),remaining:vd(i),...e?{note:e}:{}})}t.length&&r.push({label:n(`usage.group.plan`),rows:t})}if(t){let e=(e,t,r)=>!r&&e===`five_hour`?n(`usage.plan.fiveHour`):!r&&e===`seven_day`?n(`usage.plan.sevenDay`):t,i=[],a=hd(t.used,t.limit,t.unit);if(i.push({label:e(t.periodType,t.label??n(`usage.group.quota`),t.scope),value:cd(vd(t.usedPercent)),remaining:vd(t.usedPercent),note:[a?`${n(`usage.quota`)}: ${a}`:null,md(t.resetsAt,n)].filter(Boolean).join(` · `)}),t.resetCredits){let e=md(t.resetCredits.nextExpiresAt,n);i.push({label:n(`usage.resetCredits`),value:String(t.resetCredits.availableCount),...e?{note:e}:{}})}for(let r of t.productUsage??[]){let t=hd(r.used,r.limit,r.unit);i.push({label:e(r.periodType,r.product,r.scope),value:cd(vd(r.usagePercent)),remaining:vd(r.usagePercent),note:[t?`${n(`usage.quota`)}: ${t}`:null,md(r.resetsAt,n)].filter(Boolean).join(` · `)})}i.length&&r.push({label:n(`usage.group.quota`),rows:i})}return r}function xd({usage:e,t}){if(e===null)return null;let n=ld(e);if(n===void 0)return null;let r=e.contextWindowTokens===void 0?cd(n):`${cd(n)} / ${sd(e.contextWindowTokens)}`;return/* @__PURE__ */ (0,i.jsxs)(`section`,{className:X.context,children:[/* @__PURE__ */ (0,i.jsxs)(`div`,{className:X.contextRow,children:[/* @__PURE__ */ (0,i.jsx)(`span`,{children:t(`usage.context`)}),/* @__PURE__ */ (0,i.jsx)(`strong`,{children:r})]}),/* @__PURE__ */ (0,i.jsx)(`div`,{className:X.progressTrack,role:`progressbar`,"aria-label":t(`usage.context`),"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.min(100,Math.max(0,n)),children:/* @__PURE__ */ (0,i.jsx)(`span`,{className:X.progressFill,style:{width:`${Math.min(100,Math.max(0,n))}%`}})})]})}function Sd({groups:e}){return e.map(e=>/* @__PURE__ */ (0,i.jsxs)(`section`,{className:X.group,children:[/* @__PURE__ */ (0,i.jsx)(`h3`,{children:e.label}),/* @__PURE__ */ (0,i.jsx)(`dl`,{children:e.rows.map(e=>/* @__PURE__ */ (0,i.jsxs)(`div`,{className:X.detail,children:[/* @__PURE__ */ (0,i.jsx)(`dt`,{children:e.label}),/* @__PURE__ */ (0,i.jsx)(`dd`,{children:e.value}),e.note&&/* @__PURE__ */ (0,i.jsx)(`p`,{children:e.note})]},`${e.label}:${e.value}`))})]},e.label))}function Cd({useProjection:e,t}){let n=e(`codexhostUsage`),r=n?.usage??null,a=n?.accountCredits,s=(0,o.useMemo)(()=>gd(r,t),[r,t]),c=(0,o.useMemo)(()=>_d(r,t),[r,t]),l=(0,o.useMemo)(()=>bd(r,a,t),[r,a,t]),u=l.flatMap(e=>e.rows).find(e=>e.remaining!==void 0),d=r!==null&&ld(r)!==void 0,f=s.join(` · `);return/* @__PURE__ */ (0,i.jsxs)(i.Fragment,{children:[u&&/* @__PURE__ */ (0,i.jsx)(wd,{stat:`codexhost-quota`,panelStyle:{"--quota-color":yd(u.remaining??100)},label:`${t(`usage.quota.remaining`)}: ${u.value}`,title:t(`usage.quota.details`),trigger:/* @__PURE__ */ (0,i.jsxs)(i.Fragment,{children:[/* @__PURE__ */ (0,i.jsxs)(`svg`,{className:X.quotaRing,style:{stroke:yd(u.remaining??100)},viewBox:`0 0 20 20`,"aria-hidden":`true`,children:[/* @__PURE__ */ (0,i.jsx)(`circle`,{className:X.ringTrack,cx:`10`,cy:`10`,r:`7`}),/* @__PURE__ */ (0,i.jsx)(`circle`,{cx:`10`,cy:`10`,r:`7`,pathLength:`100`,strokeDasharray:`${u.remaining} 100`,transform:`rotate(-90 10 10)`})]}),/* @__PURE__ */ (0,i.jsx)(`span`,{children:u.value})]}),children:l.map(e=>/* @__PURE__ */ (0,i.jsx)(`section`,{className:X.quotaGroup,"aria-label":e.label,children:e.rows.map((e,n)=>/* @__PURE__ */ (0,i.jsxs)(`div`,{className:X.quotaRow,style:{"--quota-color":yd(e.remaining??100)},children:[/* @__PURE__ */ (0,i.jsxs)(`div`,{className:X.quotaHeading,children:[/* @__PURE__ */ (0,i.jsxs)(`div`,{className:X.quotaDescription,children:[/* @__PURE__ */ (0,i.jsx)(`span`,{children:e.label}),e.note&&/* @__PURE__ */ (0,i.jsx)(`p`,{children:e.note})]}),/* @__PURE__ */ (0,i.jsxs)(`strong`,{children:[e.remaining!==void 0&&/* @__PURE__ */ (0,i.jsxs)(`span`,{className:X.remainingLabel,children:[t(`usage.quota.remaining`),` `]}),/* @__PURE__ */ (0,i.jsx)(`span`,{className:X.remainingValue,children:e.value})]})]}),e.remaining!==void 0&&/* @__PURE__ */ (0,i.jsx)(`div`,{className:X.progressTrack,role:`progressbar`,"aria-label":`${e.label}: ${t(`usage.quota.remaining`)}`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":e.remaining,children:/* @__PURE__ */ (0,i.jsx)(`span`,{className:X.quotaFill,style:{width:`${e.remaining}%`}})})]},`${e.label}:${n}`))},e.label))}),s.length>0&&(c.length>0||d)&&/* @__PURE__ */ (0,i.jsxs)(wd,{stat:`codexhost-usage`,label:`${t(`usage.title`)}: ${f}`,title:t(`usage.details`),trigger:/* @__PURE__ */ (0,i.jsx)(`span`,{className:X.label,children:f}),children:[/* @__PURE__ */ (0,i.jsx)(`header`,{children:t(`usage.title`)}),/* @__PURE__ */ (0,i.jsx)(xd,{usage:r,t}),/* @__PURE__ */ (0,i.jsx)(Sd,{groups:c})]})]})}function wd({stat:e,label:t,title:n,trigger:a,children:c,panelStyle:l}){let[u,d]=(0,o.useState)(!1),f=(0,o.useRef)(!1),p=(0,o.useRef)(null),m=(0,o.useRef)(null),h=(0,o.useRef)(null),g=(0,r.useAnchoredPosition)({open:u,anchorRef:m,panelRef:h,side:`top`,gap:8,margin:12}),_=(0,o.useCallback)(()=>{f.current=!1,d(!1)},[]),v=(0,o.useCallback)(()=>{p.current!==null&&(window.clearTimeout(p.current),p.current=null)},[]),y=(0,o.useCallback)(()=>{v(),p.current=window.setTimeout(()=>{p.current=null,!f.current&&m.current?.matches(`:hover`)!==!0&&h.current?.matches(`:hover`)!==!0&&!m.current?.contains(document.activeElement)&&d(!1)},140)},[v]);return(0,r.useDismissOnOutsidePointer)(m,u,e=>{e||_()},h),(0,o.useEffect)(()=>{if(!u)return;let e=e=>{e.key===`Escape`&&_()};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[_,u]),(0,o.useEffect)(()=>()=>{p.current!==null&&window.clearTimeout(p.current)},[]),/* @__PURE__ */ (0,i.jsxs)(`span`,{ref:m,className:X.anchor,"data-composer-stat":e,onPointerEnter:()=>{v(),d(!0)},onPointerLeave:y,children:[/* @__PURE__ */ (0,i.jsx)(`button`,{type:`button`,className:X.pill,"aria-label":t,"aria-haspopup":`dialog`,"aria-expanded":u,onFocus:()=>{v(),d(!0)},onBlur:y,onClick:()=>{u&&f.current?_():(f.current=!0,d(!0))},children:a}),u&&(0,s.createPortal)(/* @__PURE__ */ (0,i.jsx)(`div`,{ref:h,className:`${X.panel} ${e===`codexhost-quota`?X.quotaPanel:``}`,style:{...l,...g??ad},role:`dialog`,"aria-label":n,onPointerEnter:v,onPointerLeave:y,children:c}),document.body)]})}let Td=`@deepseek-ai/dsh-client-ui-codexhost/ConnectDevicesSection.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Td)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-codexhost`,e.dataset.pluginCss=Td,e.textContent=`.no7uPq_page{flex-direction:column;gap:24px;min-width:0;display:flex}.no7uPq_header{flex-wrap:wrap;justify-content:space-between;align-items:flex-start;gap:12px;display:flex}.no7uPq_title{color:var(--dsw-alias-label-primary);margin:0 0 8px;font-size:22px;font-weight:600;line-height:30px}.no7uPq_description,.no7uPq_notice{color:var(--dsw-alias-label-secondary);overflow-wrap:anywhere;margin:0;font-size:13px;line-height:21px}.no7uPq_meta{color:var(--dsw-alias-label-tertiary);overflow-wrap:anywhere;margin:0;font-size:12px;line-height:19px}.no7uPq_status{color:var(--dsw-alias-label-tertiary);white-space:nowrap;align-items:center;gap:6px;padding:4px 0;font-size:11px;line-height:20px;display:flex}.no7uPq_status:before{content:"";background:currentColor;border-radius:50%;width:5px;height:5px}.no7uPq_status[data-active=true]:before{background:#65af91}.no7uPq_connection{flex-direction:column;gap:24px;display:flex}.no7uPq_connectionMain{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-2);border-radius:12px;align-items:center;gap:24px;padding:20px;display:flex}.no7uPq_scan{border-right:1px solid var(--dsw-alias-border-l2);flex:none;padding-right:24px}.no7uPq_connectionDetails{flex-direction:column;flex:1;gap:16px;min-width:0;display:flex}.no7uPq_qrButton{cursor:zoom-in;background:#fff;border:none;border-radius:12px;padding:8px;line-height:0;display:block;overflow:hidden}.no7uPq_qr{width:144px;height:144px;display:block}.no7uPq_qrPlaceholder{box-sizing:border-box;border:1px dashed var(--dsw-alias-border-l4);width:160px;height:160px;color:var(--dsw-alias-label-tertiary);border-radius:12px;flex-direction:column;justify-content:center;align-items:center;gap:14px;font-size:12px;display:flex}.no7uPq_qrButton:focus-visible,.no7uPq_input:focus-visible{outline:2px solid var(--dsw-alias-label-secondary);outline-offset:3px}.no7uPq_routePanel{flex-direction:column;gap:10px;min-width:0;display:flex}.no7uPq_routes{border:0;min-width:0;margin:0;padding:0}.no7uPq_fieldTitle{color:var(--dsw-alias-label-primary);margin-bottom:10px;padding:0;font-size:13px;font-weight:600;line-height:20px;display:block}.no7uPq_routeGroup,.no7uPq_extraRoutes{flex-direction:column;gap:8px;display:flex}.no7uPq_routeGroup,.no7uPq_extraRoutes>.no7uPq_route{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-2);border-radius:10px}.no7uPq_routeGroup{gap:0;overflow:hidden}.no7uPq_routeFamily,.no7uPq_routeGroup>.no7uPq_route:not(:last-child){border-bottom:1px solid var(--dsw-alias-border-l2)}.no7uPq_extraRoutes>.no7uPq_route:has(input:checked){border-color:var(--dsw-alias-label-secondary)}.no7uPq_routeGroup>.no7uPq_route:has(input:checked),.no7uPq_routeFamily:has(.no7uPq_route input:checked){background:var(--dsw-alias-interactive-bg-hover)}.no7uPq_route{cursor:pointer;align-items:flex-start;gap:10px;padding:12px 16px;display:flex}.no7uPq_subRoutes{flex-wrap:wrap;gap:16px;padding:0 16px 12px 39px;display:flex}.no7uPq_subRoute{color:var(--dsw-alias-label-primary);cursor:pointer;align-items:center;gap:6px;font-size:12px;line-height:18px;display:flex}.no7uPq_subRoute input{accent-color:var(--dsw-alias-label-primary);margin:0}.no7uPq_extraRoutes>.no7uPq_route{border-radius:10px}.no7uPq_route:hover{background:var(--dsw-alias-interactive-bg-hover)}.no7uPq_route:has(input:disabled){cursor:default;opacity:.7}.no7uPq_route input{accent-color:var(--dsw-alias-label-primary);flex:none;margin:3px 0 0}.no7uPq_routeText{flex-direction:column;gap:3px;min-width:0;display:flex}.no7uPq_route>.no7uPq_routeText{flex:1}.no7uPq_routeTitle{color:var(--dsw-alias-label-primary);flex-wrap:wrap;align-items:center;gap:6px;font-size:13px;font-weight:500;line-height:20px;display:flex}.no7uPq_routeAddress{color:var(--dsw-alias-label-tertiary);overflow-wrap:anywhere;margin-left:auto;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:11px;font-weight:400}.no7uPq_badge{border:1px solid var(--dsw-alias-border-l4);color:var(--dsw-alias-label-secondary);border-radius:4px;padding:0 5px;font-size:10px;font-weight:400;line-height:16px}.no7uPq_addressRow{flex-wrap:wrap;gap:8px;display:flex}.no7uPq_addressRow>button{flex:none}.no7uPq_input{box-sizing:border-box;border:1px solid var(--dsw-alias-border-l4);background:var(--dsw-alias-bg-layer-3);width:100%;min-width:0;height:36px;font:inherit;color:var(--dsw-alias-label-primary);border-radius:8px;flex:140px;padding:0 10px;font-size:12px}.no7uPq_addressMenu{flex:140px;min-width:0}.no7uPq_addressTrigger{text-align:left;cursor:pointer;justify-content:space-between;align-items:center;gap:8px;display:flex}.no7uPq_addressTrigger span{text-overflow:ellipsis;white-space:nowrap;min-width:0;overflow:hidden}.no7uPq_addressTrigger svg{color:var(--dsw-alias-label-secondary);flex:none}.no7uPq_addressTrigger:disabled{cursor:default;opacity:.7}.no7uPq_other{min-width:0}.no7uPq_other summary{width:fit-content;color:var(--dsw-alias-label-tertiary);cursor:pointer;font-size:12px;line-height:20px}.no7uPq_page>.no7uPq_other{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-2);border-radius:10px;padding:12px 16px}.no7uPq_page>.no7uPq_other summary{color:var(--dsw-alias-label-secondary)}.no7uPq_extraRoutes{margin-top:8px}.no7uPq_connectionHelp{flex-direction:column;gap:10px;display:flex}.no7uPq_relayFields,.no7uPq_relayField{gap:4px;min-width:0;display:grid}.no7uPq_relayFields{gap:10px}.no7uPq_relayPreview{border:1px solid var(--dsw-alias-separator,currentColor);border-radius:8px;gap:6px;min-width:0;padding:10px 12px;display:grid}.no7uPq_relayPreviewAddress{overflow-wrap:anywhere;flex-wrap:wrap;align-items:flex-start;gap:2px;display:flex}.no7uPq_relayPreviewAddress span{flex-direction:column;display:flex}.no7uPq_relayPreviewAddress small{color:var(--dsw-alias-label-secondary);font-size:11px}.no7uPq_relayTutorial{color:var(--dsw-alias-label-secondary);overflow-wrap:anywhere;margin:0;padding-left:20px;font-size:12px;line-height:20px}.no7uPq_relayTutorial li+li{margin-top:6px}.no7uPq_relayTutorial code{display:block}.no7uPq_ready{color:var(--dsw-alias-label-secondary);align-items:flex-start;gap:8px;margin:0;font-size:12px;line-height:20px;display:flex}.no7uPq_ready svg{color:#65af91;flex:none;margin-top:2px}.no7uPq_manage{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-2);border-radius:12px;flex-direction:column;padding:0 20px;display:flex}.no7uPq_manageRow{flex-wrap:wrap;justify-content:space-between;align-items:center;gap:8px 16px;padding:16px 0;display:flex}.no7uPq_manageRow+.no7uPq_manageRow{border-top:1px solid var(--dsw-alias-border-l2)}.no7uPq_stopRow{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-2);border-radius:12px;padding:16px 20px}.no7uPq_manageText{flex-direction:column;flex:200px;gap:4px;min-width:0;display:flex}.no7uPq_manageTitle{color:var(--dsw-alias-label-primary);font-size:13px;line-height:20px}.no7uPq_manageActions{flex-wrap:wrap;flex:none;align-items:center;gap:8px;max-width:100%;display:flex}.no7uPq_dangerOutline{color:var(--dsw-alias-state-error-primary)}.no7uPq_remoteList{flex-direction:column;gap:8px;margin-top:12px;display:flex}.no7uPq_link{width:fit-content;color:var(--dsw-alias-label-secondary);font-size:12px;line-height:18px;text-decoration:underline}.no7uPq_actions{flex-wrap:wrap;gap:8px;display:flex}.no7uPq_error{color:var(--dsw-alias-state-error-primary);overflow-wrap:anywhere;margin:0;font-size:12px;line-height:19px}.no7uPq_confirm{width:min(440px,100%)}.no7uPq_dangerConfirm{background:var(--dsw-alias-state-error-primary);color:#fff}.no7uPq_dangerConfirm:hover:not(:disabled){background:color-mix(in srgb, var(--dsw-alias-state-error-primary) 88%, #000);color:#fff}.no7uPq_qrModal{width:min(420px,100%)}.no7uPq_largeQr{border-radius:12px;width:100%;height:auto;display:block}@media (width<=600px){.no7uPq_page{gap:16px}.no7uPq_connectionMain{flex-direction:column;align-items:stretch;gap:16px;padding:16px}.no7uPq_scan{border-right:0;align-self:center;padding-right:0}.no7uPq_manage{padding:0 12px}.no7uPq_stopRow{padding:16px 12px}.no7uPq_routeAddress{flex-basis:100%;margin-left:0}.no7uPq_title{font-size:20px}.no7uPq_status{font-size:11px}}`,document.head.appendChild(e)}var Z={actions:`no7uPq_actions`,addressMenu:`no7uPq_addressMenu`,addressRow:`no7uPq_addressRow`,addressTrigger:`no7uPq_addressTrigger`,badge:`no7uPq_badge`,confirm:`no7uPq_confirm`,connection:`no7uPq_connection`,connectionDetails:`no7uPq_connectionDetails`,connectionHelp:`no7uPq_connectionHelp`,connectionMain:`no7uPq_connectionMain`,dangerConfirm:`no7uPq_dangerConfirm`,dangerOutline:`no7uPq_dangerOutline`,description:`no7uPq_description`,error:`no7uPq_error`,extraRoutes:`no7uPq_extraRoutes`,fieldTitle:`no7uPq_fieldTitle`,header:`no7uPq_header`,input:`no7uPq_input`,largeQr:`no7uPq_largeQr`,link:`no7uPq_link`,manage:`no7uPq_manage`,manageActions:`no7uPq_manageActions`,manageRow:`no7uPq_manageRow`,manageText:`no7uPq_manageText`,manageTitle:`no7uPq_manageTitle`,meta:`no7uPq_meta`,notice:`no7uPq_notice`,other:`no7uPq_other`,page:`no7uPq_page`,qr:`no7uPq_qr`,qrButton:`no7uPq_qrButton`,qrModal:`no7uPq_qrModal`,qrPlaceholder:`no7uPq_qrPlaceholder`,ready:`no7uPq_ready`,relayField:`no7uPq_relayField`,relayFields:`no7uPq_relayFields`,relayPreview:`no7uPq_relayPreview`,relayPreviewAddress:`no7uPq_relayPreviewAddress`,relayTutorial:`no7uPq_relayTutorial`,remoteList:`no7uPq_remoteList`,route:`no7uPq_route`,routeAddress:`no7uPq_routeAddress`,routeFamily:`no7uPq_routeFamily`,routeGroup:`no7uPq_routeGroup`,routePanel:`no7uPq_routePanel`,routeText:`no7uPq_routeText`,routeTitle:`no7uPq_routeTitle`,routes:`no7uPq_routes`,scan:`no7uPq_scan`,status:`no7uPq_status`,stopRow:`no7uPq_stopRow`,subRoute:`no7uPq_subRoute`,subRoutes:`no7uPq_subRoutes`,title:`no7uPq_title`};function Ed(e,t){let[n,r]=(0,o.useState)(null),[i,a]=(0,o.useState)();return(0,o.useEffect)(()=>{if(n===null)return;let i=!1,o=Date.now()+6e4,s,c=async()=>{try{let t=await Pl.get();if(i)return;if(t.background?.lan===n){e(t),r(null);return}}catch(e){if(i)return;if(!(e instanceof TypeError)){a(e instanceof Error?e.message:String(e)),r(null);return}}Date.now()>=o?(a(t),r(null)):i||(s=setTimeout(()=>{c()},1e3))};return s=setTimeout(()=>{c()},1e3),()=>{i=!0,clearTimeout(s)}},[n,e,t]),{target:n,error:i,start:r,fail:a}}function Dd({state:e,disabled:t,restored:n,t:a}){let[s,c]=(0,o.useState)(!1),[l,u]=(0,o.useState)();return/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Z.manageRow,"data-background-controls":!0,children:[/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Z.manageText,children:[/* @__PURE__ */ (0,i.jsx)(`span`,{className:Z.manageTitle,children:a(`connectDevices.autostart`)}),e.autostart.status===`invalid`&&/* @__PURE__ */ (0,i.jsx)(`span`,{className:Z.error,children:e.autostart.reason}),l!==void 0&&/* @__PURE__ */ (0,i.jsx)(`span`,{role:`alert`,className:Z.error,children:l})]}),/* @__PURE__ */ (0,i.jsx)(r.Switch,{label:a(`connectDevices.autostart`),checked:e.autostart.status===`on`,disabled:s||t,onChange:e=>{c(!0),u(void 0),Pl.autostart(e).then(async()=>{n(await Pl.get())}).catch(e=>{u(e instanceof Error?e.message:String(e))}).finally(()=>c(!1))}})]})}function Od(e){return e.status===`connecting`||e.status===`missing-certificate`&&e.certificate.failure===void 0}function kd({kind:e,relay:t,busy:n,onChange:a,onRefresh:s,t:c}){let l=e===t.kind,u=l?t.state:{status:`off`},d=e===`official`,f=d?t.officialHostname:t.customHostname,p=l?t.quotaUntil:void 0,m=t.enabled&&!l,h=t.customHost?.startsWith(`relay.`)?t.customHost.slice(6):f?.split(`.`).slice(1).join(`.`)??``,[g,_]=(0,o.useState)(h),v=g===h&&t.customHost?t.customHost:g?`relay.${g}`:``,y=v!==(t.customHost??``),b=Ns.safeParse(v).success,x=g!==``&&(!Ns.safeParse(g).success||!b&&y),S=(0,o.useId)(),[C,w]=(0,o.useState)(d?``:f?.split(`.`)[0]??``),[T,E]=(0,o.useState)(``),D=(0,o.useId)(),O=C!==``&&(d?!/^[a-z0-9]{4,20}$/.test(C):!Ps.safeParse(C).success||`${C}.${g}`===v||g!==``&&!Ns.safeParse(`${C}.${g}`).success),ee=`certificate`in u?u.certificate.failure:void 0,te=ee?.paused===!0,k=u.status===`connected`&&!te&&p===void 0,ne=p===void 0?u.status===`off`&&u.reason!==void 0?c(`connectDevices.relay.${u.reason}`):u.status===`connecting`&&u.reason!==void 0?c(u.reason===`full`?`connectDevices.relay.full`:`connectDevices.relay.connectionFailed`):k?c(`connectDevices.relay.hint`):u.status===`stopped`?c(`connectDevices.relay.${u.reason}`):te?c(`connectDevices.relay.paused`):u.status===`off`?c(d?`connectDevices.relay.off`:`connectDevices.selfRelay.off`):Od(u)?c(`connectDevices.relay.preparing`):c(`connectDevices.relay.unavailable`,{date:new Date(ee?.retryAt??``).toLocaleString()}):c(`connectDevices.relay.quota`);return/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Z.connectionHelp,"data-relay-status":u.status,children:[d&&/* @__PURE__ */ (0,i.jsx)(`p`,{className:Z.meta,children:t.officialHost}),!d&&l&&t.enabled&&/* @__PURE__ */ (0,i.jsx)(`p`,{className:Z.meta,children:c(`connectDevices.selfRelay.address`,{host:t.customHost??``})}),m&&/* @__PURE__ */ (0,i.jsx)(`p`,{className:Z.notice,children:c(`connectDevices.relay.closeFirst`)}),/* @__PURE__ */ (0,i.jsxs)(`p`,{className:k?Z.ready:Z.notice,role:`status`,children:[k&&/* @__PURE__ */ (0,i.jsx)(r.IconCheckCircleOutlineRegular,{}),/* @__PURE__ */ (0,i.jsx)(`span`,{children:ne})]}),p!==void 0&&/* @__PURE__ */ (0,i.jsx)(`p`,{className:Z.meta,children:c(`connectDevices.relay.quotaUntil`,{date:new Date(p).toLocaleString()})}),te&&/* @__PURE__ */ (0,i.jsx)(`p`,{className:Z.meta,children:ee.detail??c(`connectDevices.relay.unreachable`)}),u.status===`off`?/* @__PURE__ */ (0,i.jsxs)(`form`,{className:Z.connectionHelp,onSubmit:t=>{t.preventDefault(),a(!0,{kind:e,...d&&f===void 0?{name:C,invite:T}:{},...d?{}:{name:C,...y?{host:v}:{}}})},children:[!d&&/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Z.relayFields,children:[/* @__PURE__ */ (0,i.jsxs)(`label`,{className:`${Z.relayField} ${Z.notice}`,children:[c(`connectDevices.selfRelay.host`),/* @__PURE__ */ (0,i.jsx)(`input`,{className:Z.input,value:g,placeholder:`example.com`,onChange:e=>_(e.target.value.toLowerCase()),"aria-invalid":x,"aria-describedby":S,autoCapitalize:`none`,spellCheck:!1,disabled:n||m})]}),/* @__PURE__ */ (0,i.jsx)(`p`,{id:S,className:x?Z.error:Z.meta,role:x?`alert`:void 0,children:c(x?`connectDevices.selfRelay.invalidHost`:`connectDevices.selfRelay.hostHint`)}),/* @__PURE__ */ (0,i.jsxs)(`label`,{className:`${Z.relayField} ${Z.notice}`,children:[c(`connectDevices.selfRelay.name`),/* @__PURE__ */ (0,i.jsx)(`input`,{className:Z.input,value:C,placeholder:`mycomputer`,onChange:e=>w(e.target.value.toLowerCase()),"aria-invalid":O,"aria-describedby":D,autoCapitalize:`none`,spellCheck:!1,disabled:n||m})]}),/* @__PURE__ */ (0,i.jsx)(`p`,{id:D,className:O?Z.error:Z.meta,role:O?`alert`:void 0,children:c(O?`connectDevices.selfRelay.invalidName`:`connectDevices.selfRelay.nameHint`)}),/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Z.relayPreview,children:[/* @__PURE__ */ (0,i.jsx)(`p`,{className:Z.notice,children:c(`connectDevices.selfRelay.previewTitle`)}),/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Z.relayPreviewAddress,children:[/* @__PURE__ */ (0,i.jsx)(`span`,{children:`https://`}),/* @__PURE__ */ (0,i.jsxs)(`span`,{children:[/* @__PURE__ */ (0,i.jsx)(`strong`,{children:C||c(`connectDevices.selfRelay.previewAutoName`)}),/* @__PURE__ */ (0,i.jsx)(`small`,{children:c(`connectDevices.selfRelay.name`)})]}),/* @__PURE__ */ (0,i.jsx)(`span`,{"aria-hidden":`true`,children:`.`}),/* @__PURE__ */ (0,i.jsxs)(`span`,{children:[/* @__PURE__ */ (0,i.jsx)(`strong`,{children:g||`example.com`}),/* @__PURE__ */ (0,i.jsx)(`small`,{children:c(`connectDevices.selfRelay.host`)})]})]})]}),v&&/* @__PURE__ */ (0,i.jsx)(`p`,{className:Z.meta,children:c(`connectDevices.selfRelay.address`,{host:v})})]}),d&&f===void 0&&/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Z.relayFields,children:[/* @__PURE__ */ (0,i.jsxs)(`label`,{className:`${Z.relayField} ${Z.notice}`,children:[c(`connectDevices.relay.name`),/* @__PURE__ */ (0,i.jsx)(`input`,{className:Z.input,value:C,onChange:e=>w(e.target.value),pattern:`[a-z0-9]{4,20}`,"aria-invalid":O,"aria-describedby":D,autoCapitalize:`none`,spellCheck:!1,disabled:n})]}),/* @__PURE__ */ (0,i.jsx)(`p`,{id:D,className:Z.meta,children:c(`connectDevices.relay.nameHint`)}),/* @__PURE__ */ (0,i.jsxs)(`label`,{className:`${Z.relayField} ${Z.notice}`,children:[c(`connectDevices.relay.inviteLabel`),/* @__PURE__ */ (0,i.jsx)(`input`,{className:Z.input,value:T,onChange:e=>E(e.target.value),autoCapitalize:`none`,spellCheck:!1,disabled:n})]})]}),/* @__PURE__ */ (0,i.jsx)(`div`,{className:Z.actions,children:/* @__PURE__ */ (0,i.jsx)(r.Button,{type:`submit`,variant:`primary`,disabled:n||m||(d?f===void 0&&O:v===``||x||O),"aria-busy":n,children:c(n?`connectDevices.preparing`:`connectDevices.relay.enable`)})})]}):/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Z.actions,children:[!k&&/* @__PURE__ */ (0,i.jsx)(r.Button,{variant:`outline`,disabled:n,onClick:s,children:c(`connectDevices.refresh`)}),/* @__PURE__ */ (0,i.jsx)(r.Button,{variant:`outline`,disabled:n,onClick:()=>a(!1,{kind:e}),children:c(`connectDevices.relay.disable`)})]})]})}var Ad=/* @__PURE__ */ (e=>(e[e.Border=-1]=`Border`,e[e.Data=0]=`Data`,e[e.Function=1]=`Function`,e[e.Position=2]=`Position`,e[e.Timing=3]=`Timing`,e[e.Alignment=4]=`Alignment`,e))(Ad||{});let jd=[0,1],Md=[1,0],Nd=[2,3],Pd=[3,2],Fd={L:jd,M:Md,Q:Nd,H:Pd},Id=/^\d*$/,Ld=/^[A-Z0-9 $%*+./:-]*$/,Rd=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`,zd=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],Bd=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]];var Vd=class{constructor(e,t,n,r){if(this.version=e,this.ecc=t,e<1||e>40)throw RangeError(`Version value out of range`);if(r<-1||r>7)throw RangeError(`Mask value out of range`);this.size=e*4+17;let i=Array.from({length:this.size}).fill(!1);for(let e=0;e<this.size;e++)this.modules.push(i.slice()),this.types.push(i.map(()=>0));this.drawFunctionPatterns();let a=this.addEccAndInterleave(n);if(this.drawCodewords(a),r===-1){let e=1e9;for(let t=0;t<8;t++){this.applyMask(t),this.drawFormatBits(t);let n=this.getPenaltyScore();n<e&&(r=t,e=n),this.applyMask(t)}}this.mask=r,this.applyMask(r),this.drawFormatBits(r)}size;mask;modules=[];types=[];getModule(e,t){return e>=0&&e<this.size&&t>=0&&t<this.size&&this.modules[t][e]}drawFunctionPatterns(){for(let e=0;e<this.size;e++)this.setFunctionModule(6,e,e%2==0,Ad.Timing),this.setFunctionModule(e,6,e%2==0,Ad.Timing);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);let e=this.getAlignmentPatternPositions(),t=e.length;for(let n=0;n<t;n++)for(let r=0;r<t;r++)n===0&&r===0||n===0&&r===t-1||n===t-1&&r===0||this.drawAlignmentPattern(e[n],e[r]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(e){let t=this.ecc[1]<<3|e,n=t;for(let e=0;e<10;e++)n=n<<1^(n>>>9)*1335;let r=(t<<10|n)^21522;for(let e=0;e<=5;e++)this.setFunctionModule(8,e,Ud(r,e));this.setFunctionModule(8,7,Ud(r,6)),this.setFunctionModule(8,8,Ud(r,7)),this.setFunctionModule(7,8,Ud(r,8));for(let e=9;e<15;e++)this.setFunctionModule(14-e,8,Ud(r,e));for(let e=0;e<8;e++)this.setFunctionModule(this.size-1-e,8,Ud(r,e));for(let e=8;e<15;e++)this.setFunctionModule(8,this.size-15+e,Ud(r,e));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let e=this.version;for(let t=0;t<12;t++)e=e<<1^(e>>>11)*7973;let t=this.version<<12|e;for(let e=0;e<18;e++){let n=Ud(t,e),r=this.size-11+e%3,i=Math.floor(e/3);this.setFunctionModule(r,i,n),this.setFunctionModule(i,r,n)}}drawFinderPattern(e,t){for(let n=-4;n<=4;n++)for(let r=-4;r<=4;r++){let i=Math.max(Math.abs(r),Math.abs(n)),a=e+r,o=t+n;a>=0&&a<this.size&&o>=0&&o<this.size&&this.setFunctionModule(a,o,i!==2&&i!==4,Ad.Position)}}drawAlignmentPattern(e,t){for(let n=-2;n<=2;n++)for(let r=-2;r<=2;r++)this.setFunctionModule(e+r,t+n,Math.max(Math.abs(r),Math.abs(n))!==1,Ad.Alignment)}setFunctionModule(e,t,n,r=Ad.Function){this.modules[t][e]=n,this.types[t][e]=r}addEccAndInterleave(e){let t=this.version,n=this.ecc;if(e.length!==af(t,n))throw RangeError(`Invalid argument`);let r=Bd[n[0]][t],i=zd[n[0]][t],a=Math.floor(rf(t)/8),o=r-a%r,s=Math.floor(a/r),c=[],l=of(i);for(let t=0,n=0;t<r;t++){let r=e.slice(n,n+s-i+(t<o?0:1));n+=r.length;let a=sf(r,l);t<o&&r.push(0),c.push(r.concat(a))}let u=[];for(let e=0;e<c[0].length;e++)c.forEach((t,n)=>{(e!==s-i||n>=o)&&u.push(t[e])});return u}drawCodewords(e){if(e.length!==Math.floor(rf(this.version)/8))throw RangeError(`Invalid argument`);let t=0;for(let n=this.size-1;n>=1;n-=2){n===6&&(n=5);for(let r=0;r<this.size;r++)for(let i=0;i<2;i++){let a=n-i,o=n+1&2?r:this.size-1-r;!this.types[o][a]&&t<e.length*8&&(this.modules[o][a]=Ud(e[t>>>3],7-(t&7)),t++)}}}applyMask(e){if(e<0||e>7)throw RangeError(`Mask value out of range`);for(let t=0;t<this.size;t++)for(let n=0;n<this.size;n++){let r;switch(e){case 0:r=(n+t)%2==0;break;case 1:r=t%2==0;break;case 2:r=n%3==0;break;case 3:r=(n+t)%3==0;break;case 4:r=(Math.floor(n/3)+Math.floor(t/2))%2==0;break;case 5:r=n*t%2+n*t%3==0;break;case 6:r=(n*t%2+n*t%3)%2==0;break;case 7:r=((n+t)%2+n*t%3)%2==0;break;default:throw Error(`Unreachable`)}!this.types[t][n]&&r&&(this.modules[t][n]=!this.modules[t][n])}}getPenaltyScore(){let e=0;for(let t=0;t<this.size;t++){let n=!1,r=0,i=[0,0,0,0,0,0,0];for(let a=0;a<this.size;a++)this.modules[t][a]===n?(r++,r===5?e+=3:r>5&&e++):(this.finderPenaltyAddHistory(r,i),n||(e+=this.finderPenaltyCountPatterns(i)*40),n=this.modules[t][a],r=1);e+=this.finderPenaltyTerminateAndCount(n,r,i)*40}for(let t=0;t<this.size;t++){let n=!1,r=0,i=[0,0,0,0,0,0,0];for(let a=0;a<this.size;a++)this.modules[a][t]===n?(r++,r===5?e+=3:r>5&&e++):(this.finderPenaltyAddHistory(r,i),n||(e+=this.finderPenaltyCountPatterns(i)*40),n=this.modules[a][t],r=1);e+=this.finderPenaltyTerminateAndCount(n,r,i)*40}for(let t=0;t<this.size-1;t++)for(let n=0;n<this.size-1;n++){let r=this.modules[t][n];r===this.modules[t][n+1]&&r===this.modules[t+1][n]&&r===this.modules[t+1][n+1]&&(e+=3)}let t=0;for(let e of this.modules)t=e.reduce((e,t)=>e+ +!!t,t);let n=this.size*this.size,r=Math.ceil(Math.abs(t*20-n*10)/n)-1;return e+=r*10,e}getAlignmentPatternPositions(){if(this.version===1)return[];{let e=Math.floor(this.version/7)+2,t=this.version===32?26:Math.ceil((this.version*4+4)/(e*2-2))*2,n=[6];for(let r=this.size-7;n.length<e;r-=t)n.splice(1,0,r);return n}}finderPenaltyCountPatterns(e){let t=e[1],n=t>0&&e[2]===t&&e[3]===t*3&&e[4]===t&&e[5]===t;return(n&&e[0]>=t*4&&e[6]>=t?1:0)+(n&&e[6]>=t*4&&e[0]>=t?1:0)}finderPenaltyTerminateAndCount(e,t,n){return e&&(this.finderPenaltyAddHistory(t,n),t=0),t+=this.size,this.finderPenaltyAddHistory(t,n),this.finderPenaltyCountPatterns(n)}finderPenaltyAddHistory(e,t){t[0]===0&&(e+=this.size),t.pop(),t.unshift(e)}};function Hd(e,t,n){if(t<0||t>31||e>>>t)throw RangeError(`Value out of range`);for(let r=t-1;r>=0;r--)n.push(e>>>r&1)}function Ud(e,t){return!!(e>>>t&1)}var Wd=class{constructor(e,t,n){if(this.mode=e,this.numChars=t,this.bitData=n,t<0)throw RangeError(`Invalid argument`);this.bitData=n.slice()}getData(){return this.bitData.slice()}};let Gd=[1,10,12,14],Kd=[2,9,11,13],qd=[4,8,16,16];function Jd(e,t){return e[Math.floor((t+7)/17)+1]}function Yd(e){let t=[];for(let n of e)Hd(n,8,t);return new Wd(qd,e.length,t)}function Xd(e){if(!$d(e))throw RangeError(`String contains non-numeric characters`);let t=[];for(let n=0;n<e.length;){let r=Math.min(e.length-n,3);Hd(Number.parseInt(e.substring(n,n+r),10),r*3+1,t),n+=r}return new Wd(Gd,e.length,t)}function Zd(e){if(!ef(e))throw RangeError(`String contains unencodable characters in alphanumeric mode`);let t=[],n=0;for(;n+2<=e.length;n+=2){let r=Rd.indexOf(e.charAt(n))*45;r+=Rd.indexOf(e.charAt(n+1)),Hd(r,11,t)}return n<e.length&&Hd(Rd.indexOf(e.charAt(n)),6,t),new Wd(Kd,e.length,t)}function Qd(e){return e===``?[]:$d(e)?[Xd(e)]:ef(e)?[Zd(e)]:[Yd(nf(e))]}function $d(e){return Id.test(e)}function ef(e){return Ld.test(e)}function tf(e,t){let n=0;for(let r of e){let e=Jd(r.mode,t);if(r.numChars>=1<<e)return 1/0;n+=4+e+r.bitData.length}return n}function nf(e){e=encodeURI(e);let t=[];for(let n=0;n<e.length;n++)e.charAt(n)===`%`?(t.push(Number.parseInt(e.substring(n+1,n+3),16)),n+=2):t.push(e.charCodeAt(n));return t}function rf(e){if(e<1||e>40)throw RangeError(`Version number out of range`);let t=(16*e+128)*e+64;if(e>=2){let n=Math.floor(e/7)+2;t-=(25*n-10)*n-55,e>=7&&(t-=36)}return t}function af(e,t){return Math.floor(rf(e)/8)-zd[t[0]][e]*Bd[t[0]][e]}function of(e){if(e<1||e>255)throw RangeError(`Degree out of range`);let t=[];for(let n=0;n<e-1;n++)t.push(0);t.push(1);let n=1;for(let r=0;r<e;r++){for(let e=0;e<t.length;e++)t[e]=cf(t[e],n),e+1<t.length&&(t[e]^=t[e+1]);n=cf(n,2)}return t}function sf(e,t){let n=t.map(e=>0);for(let r of e){let e=r^n.shift();n.push(0),t.forEach((t,r)=>n[r]^=cf(t,e))}return n}function cf(e,t){if(e>>>8||t>>>8)throw RangeError(`Byte out of range`);let n=0;for(let r=7;r>=0;r--)n=n<<1^(n>>>7)*285,n^=(t>>>r&1)*e;return n}function lf(e,t,n=1,r=40,i=-1,a=!0){if(!(1<=n&&n<=r&&r<=40)||i<-1||i>7)throw RangeError(`Invalid value`);let o,s;for(o=n;;o++){let n=af(o,t)*8,i=tf(e,o);if(i<=n){s=i;break}if(o>=r)throw RangeError(`Data too long`)}for(let e of[Md,Nd,Pd])a&&s<=af(o,e)*8&&(t=e);let c=[];for(let t of e){Hd(t.mode[0],4,c),Hd(t.numChars,Jd(t.mode,o),c);for(let e of t.getData())c.push(e)}let l=af(o,t)*8;Hd(0,Math.min(4,l-c.length),c),Hd(0,(8-c.length%8)%8,c);for(let e=236;c.length<l;e^=253)Hd(e,8,c);let u=Array.from({length:Math.ceil(c.length/8)},()=>0);return c.forEach((e,t)=>u[t>>>3]|=e<<7-(t&7)),new Vd(o,t,u,i)}function uf(e,t){let{ecc:n=`L`,boostEcc:r=!1,minVersion:i=1,maxVersion:a=40,maskPattern:o=-1,border:s=1}=t||{},c=typeof e==`string`?Qd(e):Array.isArray(e)?[Yd(e)]:void 0;if(!c)throw Error(`uqr only supports encoding string and binary data, but got: ${typeof e}`);let l=lf(c,Fd[n],i,a,o,r),u=df({version:l.version,maskPattern:l.mask,size:l.size,data:l.modules,types:l.types},s);return t?.invert&&(u.data=u.data.map(e=>e.map(e=>!e))),t?.onEncoded?.(u),u}function df(e,t=1){if(!t)return e;let{size:n}=e,r=n+t*2;e.size=r,e.data.forEach(e=>{for(let n=0;n<t;n++)e.unshift(!1),e.push(!1)});for(let n=0;n<t;n++)e.data.unshift(Array.from({length:r},e=>!1)),e.data.push(Array.from({length:r},e=>!1));let i=Ad.Border;e.types.forEach(e=>{for(let n=0;n<t;n++)e.unshift(i),e.push(i)});for(let n=0;n<t;n++)e.types.unshift(Array.from({length:r},e=>i)),e.types.push(Array.from({length:r},e=>i));return e}function ff({value:e,label:t,className:n}){let{size:r,path:a}=(0,o.useMemo)(()=>{let t=uf(e,{ecc:`M`,border:2}),n=``;return t.data.forEach((e,t)=>{e.forEach((e,r)=>{e&&(n+=`M${String(r)} ${String(t)}h1v1h-1z`)})}),{size:t.size,path:n}},[e]);return/* @__PURE__ */ (0,i.jsxs)(`svg`,{role:`img`,"aria-label":t,className:n,viewBox:`0 0 ${String(r)} ${String(r)}`,shapeRendering:`crispEdges`,children:[/* @__PURE__ */ (0,i.jsx)(`rect`,{width:r,height:r,fill:`#fff`}),/* @__PURE__ */ (0,i.jsx)(`path`,{d:a,fill:`#000`})]})}function pf({t:e}){return/* @__PURE__ */ (0,i.jsxs)(`details`,{className:Z.other,"data-self-relay-help":!0,children:[/* @__PURE__ */ (0,i.jsx)(`summary`,{children:e(`connectDevices.selfRelay.helpTitle`)}),/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Z.connectionHelp,children:[/* @__PURE__ */ (0,i.jsxs)(`ol`,{className:Z.relayTutorial,children:[/* @__PURE__ */ (0,i.jsx)(`li`,{children:e(`connectDevices.selfRelay.domain`)}),/* @__PURE__ */ (0,i.jsx)(`li`,{children:e(`connectDevices.selfRelay.dns`)}),/* @__PURE__ */ (0,i.jsx)(`li`,{children:e(`connectDevices.selfRelay.ports`)}),/* @__PURE__ */ (0,i.jsxs)(`li`,{children:[e(`connectDevices.selfRelay.docker`),/* @__PURE__ */ (0,i.jsx)(`code`,{children:`git clone https://github.com/BytePioneer-AI/codex-host.git /opt/codexhost`}),/* @__PURE__ */ (0,i.jsx)(`code`,{children:`cd /opt/codexhost/packages/remote-relay/deploy`}),/* @__PURE__ */ (0,i.jsx)(`code`,{children:e(`connectDevices.selfRelay.replaceDomain`)}),/* @__PURE__ */ (0,i.jsx)(`code`,{children:`echo "RELAY_DOMAIN=example.com" > .env`}),/* @__PURE__ */ (0,i.jsx)(`code`,{children:`docker compose up -d --build`})]}),/* @__PURE__ */ (0,i.jsx)(`li`,{children:e(`connectDevices.selfRelay.connect`)})]}),/* @__PURE__ */ (0,i.jsx)(`p`,{className:Z.meta,children:e(`connectDevices.selfRelay.noDomain`)}),/* @__PURE__ */ (0,i.jsx)(`a`,{className:Z.link,href:`https://github.com/BytePioneer-AI/codex-host/blob/main/docs/product/self-hosted-relay.md`,target:`_blank`,rel:`noreferrer`,children:e(`connectDevices.selfRelay.docs`)})]})]})}let mf={public:`connectDevices.kindPublic`,relay:`connectDevices.relay.title`,"self-hosted-relay":`connectDevices.selfRelay.title`,"tailscale-funnel":`connectDevices.kindFunnel`,"tailscale-https":`connectDevices.kindTailscale`,tailscale:`connectDevices.kindTailscale`,lan:`connectDevices.kindLan`,virtual:`connectDevices.kindVirtual`},hf={public:`connectDevices.kindPublicHint`,"tailscale-funnel":`connectDevices.kindFunnelHint`,virtual:`connectDevices.kindVirtualHint`},gf={"tailscale-https":`connectDevices.httpsSummary`,relay:`connectDevices.relay.summary`,"self-hosted-relay":`connectDevices.selfRelay.summary`,lan:`connectDevices.lanSummary`},_f=[`public`,`relay`,`self-hosted-relay`,`tailscale-funnel`,`tailscale-https`,`tailscale`,`lan`,`virtual`];function vf({data:e,busy:t,restarting:n,onEnable:a,onRelay:s,onRefresh:c,t:l}){let{networkUrls:u,tailscale:d,background:f,secret:p,relay:m}=e,h=m?.kind===`self-hosted`?`self-hosted-relay`:`relay`,g=[...u,...(e.directCandidates??[]).filter(e=>!u.some(t=>t.url===e.url))],[_,v]=(0,o.useState)(),y=e=>e===`relay`||e===`self-hosted-relay`,b=m!==void 0&&(m.enabled||m.state.status===`off`&&m.state.reason!==void 0),x=(_!==void 0&&y(_)&&m===void 0?void 0:_)??_f.find(e=>y(e)?e===h&&b:u.some(t=>t.kind===e))??(g.some(e=>e.kind===`lan`)?`lan`:`tailscale-https`),[S,C]=(0,o.useState)(),[w,T]=(0,o.useState)(!1),[E,D]=(0,o.useState)(!1),[O,ee]=(0,o.useState)(`idle`),te=(0,o.useId)(),k=g.filter(e=>e.kind===`relay`?x===h:e.kind===x),ne=k.find(e=>e.url===S)??k[0],re=!n&&ne!==void 0&&u.some(e=>e.url===ne.url),A=re?`${ne.url}#token=${p}`:void 0,j=re?hf[x]:void 0,ie=x===`tailscale-https`,ae=ie?d.status===`not-serving`:(x===`lan`||x===`tailscale`||x===`virtual`)&&f!==void 0&&!f.lan&&ne!==void 0,oe=_f.filter(e=>e!==`lan`&&!y(e)&&e!==`tailscale-https`&&e!==`tailscale`&&g.some(t=>t.kind===e)),se=x===`tailscale-https`||x===`tailscale`,ce=g.some(e=>e.kind===`tailscale`),le=e=>{v(e),C(void 0)};(0,o.useEffect)(()=>{ee(`idle`)},[A]),(0,o.useEffect)(()=>{if(O===`idle`)return;let e=setTimeout(()=>ee(`idle`),2e3);return()=>clearTimeout(e)},[O]);let ue=e=>{if(y(e))return e===`relay`?m?.officialHost:m?.customHost;let t=e===`tailscale-https`&&se?ne:e===`tailscale-https`?g.find(t=>t.kind===e)??g.find(e=>e.kind===`tailscale`):e===x?ne:g.find(t=>t.kind===e);return t===void 0?void 0:new URL(t.url).host},de=e=>/* @__PURE__ */ (0,i.jsxs)(`label`,{className:Z.route,"data-connect-route":e,children:[/* @__PURE__ */ (0,i.jsx)(`input`,{type:`radio`,name:te,checked:e===`tailscale-https`?se:x===e,disabled:t,onChange:()=>le(e)}),/* @__PURE__ */ (0,i.jsxs)(`span`,{className:Z.routeText,children:[/* @__PURE__ */ (0,i.jsxs)(`span`,{className:Z.routeTitle,children:[l(mf[e]),e===`tailscale-https`&&/* @__PURE__ */ (0,i.jsx)(`span`,{className:Z.badge,children:l(`connectDevices.recommended`)}),y(e)&&m?.enabled&&e===h&&/* @__PURE__ */ (0,i.jsx)(`span`,{className:Z.badge,children:l(`connectDevices.relay.inUse`)}),/* @__PURE__ */ (0,i.jsx)(`span`,{className:Z.routeAddress,children:ue(e)})]}),(e===`lan`||e===`tailscale-https`||e===`relay`||e===`self-hosted-relay`)&&/* @__PURE__ */ (0,i.jsx)(`span`,{className:Z.meta,children:l(gf[e])})]})]},e);return/* @__PURE__ */ (0,i.jsxs)(`section`,{className:Z.connection,children:[/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Z.connectionMain,children:[/* @__PURE__ */ (0,i.jsx)(`div`,{className:Z.scan,children:A===void 0?/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Z.qrPlaceholder,children:[/* @__PURE__ */ (0,i.jsx)(r.IconShieldOutlineRegular,{size:32}),/* @__PURE__ */ (0,i.jsx)(`span`,{children:l(n?`connectDevices.preparing`:`connectDevices.qrPending`)})]}):/* @__PURE__ */ (0,i.jsx)(`button`,{type:`button`,className:Z.qrButton,"aria-label":l(`connectDevices.enlargeQr`),disabled:t,onClick:()=>T(!0),children:/* @__PURE__ */ (0,i.jsx)(ff,{value:A,label:l(`connectDevices.qrLabel`),className:Z.qr})})}),/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Z.connectionDetails,children:[y(x)&&m!==void 0&&/* @__PURE__ */ (0,i.jsx)(kd,{kind:x===`relay`?`official`:`self-hosted`,relay:m,busy:t,onChange:s,onRefresh:c,t:l},x),!y(x)&&(!re||j!==void 0)&&/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Z.connectionHelp,"data-tailscale-status":ie&&d.status!==`serving`?d.status:void 0,children:[j===void 0?n?/* @__PURE__ */ (0,i.jsx)(`p`,{role:`status`,className:Z.notice,children:l(`connectDevices.restarting`)}):ie?/* @__PURE__ */ (0,i.jsxs)(i.Fragment,{children:[/* @__PURE__ */ (0,i.jsx)(`p`,{className:Z.notice,children:l(d.status===`not-serving`?`connectDevices.httpsSetup`:d.status===`serving`?`connectDevices.refreshHint`:`connectDevices.tailscale.${d.status}`)}),d.status===`occupied`&&/* @__PURE__ */ (0,i.jsx)(`p`,{className:Z.meta,children:d.target}),d.status===`error`&&/* @__PURE__ */ (0,i.jsx)(`p`,{className:Z.error,children:d.message}),d.status===`not-installed`&&/* @__PURE__ */ (0,i.jsx)(`a`,{className:Z.link,href:`https://tailscale.com/download`,target:`_blank`,rel:`noreferrer`,children:l(`connectDevices.remote.tailscaleLink`)}),d.status===`https-disabled`&&/* @__PURE__ */ (0,i.jsx)(`a`,{className:Z.link,href:`https://login.tailscale.com/admin/dns`,target:`_blank`,rel:`noreferrer`,children:l(`connectDevices.openTailscale`)}),d.status===`not-serving`&&/* @__PURE__ */ (0,i.jsx)(`p`,{className:Z.meta,children:l(`connectDevices.httpsPersistence`)})]}):/* @__PURE__ */ (0,i.jsx)(`p`,{className:Z.notice,children:l(ae?`connectDevices.enableImpact`:f===void 0?`connectDevices.localListener`:`connectDevices.noAddress`)}):/* @__PURE__ */ (0,i.jsxs)(`p`,{className:Z.ready,children:[/* @__PURE__ */ (0,i.jsx)(r.IconCheckCircleOutlineRegular,{}),/* @__PURE__ */ (0,i.jsx)(`span`,{children:l(j)})]}),!re&&!n&&/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Z.actions,children:[ae&&/* @__PURE__ */ (0,i.jsx)(r.Button,{variant:`primary`,disabled:t,"aria-busy":t,onClick:()=>a(ie?`https`:`direct`),children:l(t?`connectDevices.preparing`:`connectDevices.enableQr`)}),(ie||!ae)&&/* @__PURE__ */ (0,i.jsx)(r.Button,{variant:`outline`,disabled:t,onClick:c,children:l(`connectDevices.refresh`)})]})]}),ne!==void 0&&/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Z.addressRow,children:[k.length>1?/* @__PURE__ */ (0,i.jsx)(r.Menu,{open:E,onClose:()=>D(!1),portal:!0,className:Z.addressMenu,anchor:/* @__PURE__ */ (0,i.jsxs)(`button`,{"aria-label":l(`connectDevices.address`),type:`button`,className:`${Z.input} ${Z.addressTrigger}`,disabled:t,"aria-haspopup":`menu`,"aria-expanded":E,onClick:()=>D(!E),children:[/* @__PURE__ */ (0,i.jsx)(`span`,{children:new URL(ne.url).host}),/* @__PURE__ */ (0,i.jsx)(r.IconChevronDownOutlineRegular,{})]}),items:k.map(e=>({id:e.url,label:new URL(e.url).host})),selectedId:ne.url,onSelect:e=>{D(!1),C(e)}}):/* @__PURE__ */ (0,i.jsx)(`input`,{"aria-label":l(`connectDevices.address`),className:Z.input,value:new URL(ne.url).host,readOnly:!0}),A!==void 0&&/* @__PURE__ */ (0,i.jsx)(r.Button,{variant:`outline`,disabled:t,onClick:()=>{navigator.clipboard.writeText(A).then(()=>ee(`copied`),()=>ee(`failed`))},children:l(O===`copied`?`connectDevices.copied`:O===`failed`?`connectDevices.copyFailed`:`connectDevices.copyLink`)})]}),x===`self-hosted-relay`&&m!==void 0&&/* @__PURE__ */ (0,i.jsx)(pf,{t:l})]})]}),/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Z.routePanel,children:[/* @__PURE__ */ (0,i.jsxs)(`fieldset`,{className:Z.routes,disabled:t,children:[/* @__PURE__ */ (0,i.jsx)(`legend`,{className:Z.fieldTitle,children:l(`connectDevices.connectVia`)}),/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Z.routeGroup,children:[/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Z.routeFamily,children:[de(`tailscale-https`),se&&ce&&/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Z.subRoutes,children:[/* @__PURE__ */ (0,i.jsxs)(`label`,{className:Z.subRoute,children:[/* @__PURE__ */ (0,i.jsx)(`input`,{type:`radio`,name:`${te}-tailscale`,checked:x===`tailscale-https`,onChange:()=>le(`tailscale-https`)}),l(`connectDevices.tailscaleViaHttps`)]}),/* @__PURE__ */ (0,i.jsxs)(`label`,{className:Z.subRoute,"data-connect-route":`tailscale`,children:[/* @__PURE__ */ (0,i.jsx)(`input`,{type:`radio`,name:`${te}-tailscale`,checked:x===`tailscale`,onChange:()=>le(`tailscale`)}),l(`connectDevices.tailscaleViaIp`)]})]})]}),m!==void 0&&/* @__PURE__ */ (0,i.jsxs)(i.Fragment,{children:[de(`relay`),de(`self-hosted-relay`)]}),de(`lan`)]})]}),oe.length>0&&/* @__PURE__ */ (0,i.jsxs)(`details`,{className:Z.other,open:oe.includes(x)?!0:void 0,children:[/* @__PURE__ */ (0,i.jsx)(`summary`,{children:l(`connectDevices.otherMethods`)}),/* @__PURE__ */ (0,i.jsx)(`div`,{className:Z.extraRoutes,children:oe.map(de)})]})]}),w&&A!==void 0&&/* @__PURE__ */ (0,i.jsx)(r.Modal,{open:!0,onClose:()=>T(!1),title:l(`connectDevices.scan`),closeLabel:l(`connectDevices.close`),className:Z.qrModal,children:/* @__PURE__ */ (0,i.jsx)(ff,{value:A,label:l(`connectDevices.qrLabel`),className:Z.largeQr})})]})}let yf=e=>e instanceof Error?e.message:String(e);function bf(e){if(e instanceof Ol&&e.code===`auth/disabled`)return{kind:`disabled`};if(e instanceof Ol&&e.code===`auth/local-access-required`){let t=Ls.safeParse(e.details);return{kind:`non-local`,url:t.success?t.data.url:`http://127.0.0.1`}}return{kind:`failed`,message:yf(e)}}function xf({title:e,description:t,confirmLabel:n,busy:a,error:o,onClose:s,onConfirm:c,t:l}){return/* @__PURE__ */ (0,i.jsx)(r.Modal,{open:!0,onClose:()=>{a||s()},title:e,closeLabel:l(`connectDevices.close`),description:t,className:Z.confirm,footer:/* @__PURE__ */ (0,i.jsxs)(i.Fragment,{children:[/* @__PURE__ */ (0,i.jsx)(r.Button,{variant:`outline`,disabled:a,onClick:s,children:l(`connectDevices.cancel`)}),/* @__PURE__ */ (0,i.jsx)(r.Button,{variant:`primary`,className:Z.dangerConfirm,disabled:a,"aria-busy":a,onClick:c,children:n})]}),children:o!==null&&/* @__PURE__ */ (0,i.jsx)(`p`,{className:Z.error,role:`alert`,children:o})})}function Sf({url:e,t}){let[n,a]=(0,o.useState)(!1),[s,c]=(0,o.useState)(!1),[l,u]=(0,o.useState)(null);return/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Z.page,children:[/* @__PURE__ */ (0,i.jsx)(`p`,{className:Z.notice,"data-connect-notice":`non-local`,children:t(`connectDevices.localOnly`,{url:e})}),/* @__PURE__ */ (0,i.jsx)(`div`,{children:/* @__PURE__ */ (0,i.jsx)(r.Button,{variant:`outline`,onClick:()=>a(!0),children:t(`connectDevices.signOut`)})}),n&&/* @__PURE__ */ (0,i.jsx)(xf,{t,title:t(`connectDevices.signOutTitle`),description:t(`connectDevices.signOutDescription`),confirmLabel:t(`connectDevices.signOutConfirm`),busy:s,error:l,onClose:()=>a(!1),onConfirm:()=>{c(!0),u(null),$u().catch(e=>{c(!1),u(t(`connectDevices.actionFailed`,{message:yf(e)}))})}})]})}function Cf({t:e}){let[t,n]=(0,o.useState)({kind:`loading`}),[a,s]=(0,o.useState)(null),[c,l]=(0,o.useState)(!1),[u,d]=(0,o.useState)(null),[f,p]=(0,o.useState)(!1),m=(0,o.useCallback)(e=>n({kind:`ready`,data:e}),[]),h=Ed(m,e(`connectDevices.restartTimeout`)),g=c||h.target!==null;(0,o.useEffect)(()=>{if(!f)return;let e=setTimeout(()=>p(!1),2e3);return()=>clearTimeout(e)},[f]),(0,o.useEffect)(()=>{let e=!1;return Pl.get().then(t=>{e||n({kind:`ready`,data:t})},t=>{e||n(bf(t))}),()=>{e=!0}},[]);let _=t.kind===`ready`?t.data.relay?.state:void 0,v=_!==void 0&&Od(_);(0,o.useEffect)(()=>{if(!v)return;let e=setTimeout(()=>{Pl.get().then(m,()=>void 0)},2e3);return()=>clearTimeout(e)},[v,t,m]);let y=async()=>{let e=await Pl.get();return m(e),e},b=async t=>{l(!0),d(null),h.fail(void 0);try{await t()}catch(t){d(e(`connectDevices.actionFailed`,{message:yf(t)}));try{await y()}catch{}}finally{l(!1)}},x=e=>{b(async()=>{if(e===`direct`){let{changed:e}=await Pl.lan(!0);e?h.start(!0):await y()}else{let e=await Pl.serve(!0);if(e.error!==void 0)throw Error(e.error);await y()}})},S=async()=>{let t=await y();t.relay?.enabled&&(await Pl.relay(!1),t=await y());let n=/* @__PURE__ */ new Set;for(;t.tailscale.status===`serving`;){if(n.has(t.tailscale.url)||n.size>=16)throw Error(e(`connectDevices.stopIncomplete`));n.add(t.tailscale.url);let r=await Pl.serve(!1);if(r.error!==void 0)throw Error(r.error);t=await y()}if(t.tailscale.status===`error`)throw Error(t.tailscale.message);if(t.background?.lan){let{changed:e}=await Pl.lan(!1);e?h.start(!1):await y()}s(null)};if(t.kind===`loading`)return/* @__PURE__ */ (0,i.jsx)(`p`,{className:Z.meta,children:e(`connectDevices.loading`)});if(t.kind===`non-local`)return/* @__PURE__ */ (0,i.jsx)(Sf,{url:t.url,t:e});if(t.kind===`disabled`)return/* @__PURE__ */ (0,i.jsx)(`p`,{className:Z.notice,"data-connect-notice":`disabled`,children:e(`connectDevices.disabled`)});if(t.kind===`failed`)return/* @__PURE__ */ (0,i.jsx)(`p`,{className:Z.error,role:`alert`,children:e(`connectDevices.loadFailed`,{message:t.message})});let{data:C}=t,{secret:w,lastUsedAt:T,networkUrls:E,tailscale:D,background:O}=C,ee=E.length>0||O?.lan===!0,te=O?.lan===!0||D.status===`serving`||C.relay?.enabled===!0,k=E.some(e=>e.kind===`public`||O===void 0&&[`lan`,`tailscale`,`virtual`].includes(e.kind)),ne=T===null?void 0:(0,r.relativeTime)(T,Date.now()),re=u??h.error;return/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Z.page,"data-connect-devices":!0,children:[/* @__PURE__ */ (0,i.jsxs)(`header`,{className:Z.header,children:[/* @__PURE__ */ (0,i.jsxs)(`div`,{children:[/* @__PURE__ */ (0,i.jsx)(`h2`,{className:Z.title,children:e(`connectDevices.title`)}),/* @__PURE__ */ (0,i.jsx)(`p`,{className:Z.description,children:e(`connectDevices.subtitle`)})]}),/* @__PURE__ */ (0,i.jsx)(`span`,{className:Z.status,"data-active":ee&&h.target===null,children:e(h.target===null?ee?`connectDevices.accessEnabled`:`connectDevices.localAccess`:`connectDevices.preparing`)})]}),/* @__PURE__ */ (0,i.jsx)(vf,{data:C,busy:g,restarting:h.target!==null,onEnable:x,onRelay:(e,t)=>{b(async()=>{await Pl.relay(e,t),await y()})},onRefresh:()=>{b(async()=>{await y()})},t:e}),a===null&&re!=null&&/* @__PURE__ */ (0,i.jsx)(`p`,{role:`alert`,className:Z.error,children:re}),/* @__PURE__ */ (0,i.jsxs)(`section`,{className:Z.manage,children:[/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Z.manageRow,children:[/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Z.manageText,children:[/* @__PURE__ */ (0,i.jsx)(`span`,{className:Z.manageTitle,children:e(`connectDevices.tokenTitle`)}),/* @__PURE__ */ (0,i.jsx)(`span`,{className:Z.meta,title:T===null?void 0:new Date(T).toLocaleString(),children:ne===void 0?e(`connectDevices.neverUsed`):e(`connectDevices.lastUsed`,{time:e(`connectDevices.relative.${ne.unit}`,{n:ne.n})})})]}),/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Z.manageActions,children:[/* @__PURE__ */ (0,i.jsx)(r.Button,{variant:`outline`,disabled:g,onClick:()=>{d(null),navigator.clipboard.writeText(w).then(()=>p(!0),()=>d(e(`connectDevices.copyFailed`)))},children:e(f?`connectDevices.copied`:`connectDevices.copyToken`)}),/* @__PURE__ */ (0,i.jsx)(r.Button,{variant:`outline`,disabled:g,onClick:()=>{d(null),s(`regenerate`)},children:e(`connectDevices.regenerate`)})]})]}),O!==void 0&&/* @__PURE__ */ (0,i.jsx)(Dd,{state:O,disabled:g,restored:m,t:e})]}),te&&/* @__PURE__ */ (0,i.jsxs)(`div`,{className:`${Z.manageRow} ${Z.stopRow}`,children:[/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Z.manageText,children:[/* @__PURE__ */ (0,i.jsx)(`span`,{className:Z.manageTitle,children:e(`connectDevices.stopTitleShort`)}),/* @__PURE__ */ (0,i.jsx)(`span`,{className:Z.meta,children:e(`connectDevices.stopHint`)})]}),/* @__PURE__ */ (0,i.jsx)(`div`,{className:Z.manageActions,children:/* @__PURE__ */ (0,i.jsx)(r.Button,{variant:`outline`,className:Z.dangerOutline,disabled:g,onClick:()=>{d(null),s(`stop`)},children:e(`connectDevices.stop`)})})]}),/* @__PURE__ */ (0,i.jsxs)(`details`,{className:Z.other,"data-remote-options":!0,children:[/* @__PURE__ */ (0,i.jsx)(`summary`,{children:e(`connectDevices.help`)}),/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Z.remoteList,children:[/* @__PURE__ */ (0,i.jsx)(`p`,{className:Z.notice,children:e(`connectDevices.keepAwake`)}),/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Z.routeText,children:[/* @__PURE__ */ (0,i.jsx)(`span`,{className:Z.routeTitle,children:`Tailscale`}),/* @__PURE__ */ (0,i.jsx)(`span`,{className:Z.meta,children:e(`connectDevices.remote.tailscale`)}),/* @__PURE__ */ (0,i.jsx)(`a`,{className:Z.link,href:`https://tailscale.com/download`,target:`_blank`,rel:`noreferrer`,children:e(`connectDevices.remote.tailscaleLink`)})]}),/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Z.routeText,children:[/* @__PURE__ */ (0,i.jsx)(`span`,{className:Z.routeTitle,children:e(`connectDevices.remote.tunnelTitle`)}),/* @__PURE__ */ (0,i.jsx)(`span`,{className:Z.meta,children:e(`connectDevices.remote.tunnel`)}),/* @__PURE__ */ (0,i.jsx)(`a`,{className:Z.link,href:`https://github.com/BytePioneer-AI/codex-host/blob/main/docs/product/web-remote-access.md`,target:`_blank`,rel:`noreferrer`,children:e(`connectDevices.remote.tunnelLink`)})]})]})]}),a!==null&&/* @__PURE__ */ (0,i.jsx)(xf,{t:e,title:e(a===`stop`?`connectDevices.stopTitle`:`connectDevices.regenerateTitle`),description:a===`stop`?`${e(`connectDevices.stopDescription`)}${k?` ${e(`connectDevices.stopUnmanaged`)}`:``}`:e(`connectDevices.regenerateDescription`),confirmLabel:e(a===`stop`?`connectDevices.stopConfirm`:`connectDevices.regenerateConfirm`),busy:g,error:u,onClose:()=>s(null),onConfirm:()=>{b(a===`stop`?S:async()=>{m(await Pl.regenerate()),s(null)})}})]})}async function wf(e,t,n){let r=`codexhost/uiExtensions/${e}`,i=await fetch(`api/${r}`,{method:`POST`,credentials:`same-origin`,headers:{"content-type":`application/json`},body:JSON.stringify({type:`client-request`,rpcId:Tl(),method:r,payload:{args:t}}),signal:n}),a=await i.json();if(a.result?.ok===!1){let{message:e,code:t,details:n}=a.result.error;throw new Ol(e,t,n)}if(!i.ok)throw Error(`HTTP ${String(i.status)}`);return Cl.parse(a.result?.value)}let Tf={list:e=>wf(`list`,{},e),install:(e,t)=>wf(`install`,{spec:e,...t===void 0?{}:{registry:t}}),setEnabled:(e,t)=>wf(`setEnabled`,{id:e,enabled:t}),remove:e=>wf(`remove`,{id:e})},Ef=`@deepseek-ai/dsh-client-ui-codexhost/InstallWebExtensionDialog.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Ef)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-codexhost`,e.dataset.pluginCss=Ef,e.textContent=`.FXiU_a_dialog{width:min(560px,100%);max-height:min(800px,100%)}.FXiU_a_content{min-height:0;overflow-y:auto}.FXiU_a_body,.FXiU_a_footer,.FXiU_a_field{flex-direction:column;min-width:0;display:flex}.FXiU_a_body{gap:12px}.FXiU_a_footer{flex:1;gap:20px}.FXiU_a_field{color:var(--dsw-alias-label-secondary);gap:6px;font-size:13px}.FXiU_a_field input{box-sizing:border-box;border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-md);background:var(--dsw-alias-bg-layer-3);width:100%;min-width:0;height:40px;font:inherit;color:var(--dsw-alias-label-primary);outline:none;padding:0 14px;font-size:13px}.FXiU_a_field input:focus{border-color:var(--dsw-alias-state-business-primary);box-shadow:inset 0 0 0 .5px var(--dsw-alias-state-business-primary)}.FXiU_a_field input[aria-invalid=true]{border-color:var(--dsw-alias-state-error-primary)}.FXiU_a_field input:disabled,.FXiU_a_registry select:disabled{opacity:.6}.FXiU_a_options{flex-wrap:wrap;justify-content:space-between;align-items:center;gap:8px 12px;display:flex}.FXiU_a_guideToggle{font:inherit;color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:0;align-items:center;gap:6px;padding:0;font-size:12.5px;display:inline-flex}.FXiU_a_guideToggle:hover{color:var(--dsw-alias-label-primary)}.FXiU_a_guideToggle[aria-expanded=true] .FXiU_a_chevron{transform:rotate(180deg)}.FXiU_a_registry{border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-md);background:var(--dsw-alias-bg-layer-2);min-height:28px;color:var(--dsw-alias-label-secondary);flex-wrap:wrap;align-items:center;gap:6px;padding:0 8px 0 10px;font-size:12.5px;display:inline-flex}.FXiU_a_registry select{background:var(--dsw-alias-bg-layer-2);max-width:100%;min-height:32px;font:inherit;color:var(--dsw-alias-label-primary);border:0}.FXiU_a_guide{border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-lg);background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-secondary);padding:8px 14px;font-size:12px;line-height:18px}.FXiU_a_guide p{margin:8px 0 4px}.FXiU_a_guide code{color:var(--dsw-alias-label-tertiary);overflow-wrap:anywhere}.FXiU_a_scope,.FXiU_a_hint,.FXiU_a_error{color:var(--dsw-alias-label-secondary);overflow-wrap:anywhere;margin:0;font-size:12px;line-height:18px}.FXiU_a_error{color:var(--dsw-alias-state-error-primary,#d92d20)}.FXiU_a_wide{width:100%}`,document.head.appendChild(e)}var Df={body:`FXiU_a_body`,chevron:`FXiU_a_chevron`,content:`FXiU_a_content`,dialog:`FXiU_a_dialog`,error:`FXiU_a_error`,field:`FXiU_a_field`,footer:`FXiU_a_footer`,guide:`FXiU_a_guide`,guideToggle:`FXiU_a_guideToggle`,hint:`FXiU_a_hint`,options:`FXiU_a_options`,registry:`FXiU_a_registry`,scope:`FXiU_a_scope`,wide:`FXiU_a_wide`};let Of={official:`https://registry.npmjs.org/`,mirror:`https://registry.npmmirror.com/`};function kf({t:e,open:t,busy:n,error:a,onClose:s,onInstall:c}){let[l,u]=(0,o.useState)(``),[d,f]=(0,o.useState)(`official`),[p,m]=(0,o.useState)(``),[h,g]=(0,o.useState)(!1),[_,v]=(0,o.useState)(!1),y=(0,o.useId)(),b=(0,o.useId)(),x=(0,o.useId)(),S=(0,o.useId)(),C=(0,o.useRef)(null);return(0,o.useEffect)(()=>{if(!t)return;let e=(0,r.observeComposition)(document);return C.current=e,()=>{e.dispose(),C.current=null}},[t]),/* @__PURE__ */ (0,i.jsx)(r.Modal,{open:t,onClose:()=>{n||s()},title:e(`extensions.add`),closeLabel:e(`extensions.close`),description:e(`extensions.sourceHint`),className:Df.dialog,contentClassName:Df.content,footer:/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Df.footer,children:[/* @__PURE__ */ (0,i.jsx)(`p`,{className:Df.scope,children:e(`extensions.scope`)}),/* @__PURE__ */ (0,i.jsx)(r.Button,{type:`submit`,form:y,variant:`primary`,className:Df.wide,disabled:n||l.trim()===``,"aria-busy":n,children:e(n?`extensions.installing`:`extensions.install`)})]}),children:/* @__PURE__ */ (0,i.jsxs)(`form`,{id:y,className:Df.body,onSubmit:e=>{e.preventDefault();let t=l.trim();if(n||t===``)return;let r=wl.safeParse(d===`custom`?p:Of[d]);g(!r.success),r.success&&c(t,r.data).then(e=>{e&&u(``)})},onKeyDown:e=>{e.key===`Enter`&&C.current?.guards(e.nativeEvent)&&e.preventDefault()},children:[/* @__PURE__ */ (0,i.jsx)(`div`,{className:Df.field,children:/* @__PURE__ */ (0,i.jsx)(`input`,{type:`text`,"data-modal-autofocus":!0,value:l,placeholder:e(`extensions.sourcePlaceholder`),"aria-label":e(`extensions.sourceLabel`),"aria-describedby":a===null?void 0:x,autoCapitalize:`none`,autoCorrect:`off`,spellCheck:!1,disabled:n,onChange:e=>u(e.currentTarget.value)})}),a!==null&&/* @__PURE__ */ (0,i.jsx)(`p`,{id:x,className:Df.error,role:`alert`,children:a}),/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Df.options,children:[/* @__PURE__ */ (0,i.jsxs)(`button`,{type:`button`,className:Df.guideToggle,"aria-expanded":_,"aria-controls":b,onClick:()=>v(!_),children:[/* @__PURE__ */ (0,i.jsx)(r.IconChevronDownOutlineRegular,{className:Df.chevron,size:14,"aria-hidden":`true`}),e(`extensions.guide`)]}),/* @__PURE__ */ (0,i.jsxs)(`label`,{className:Df.registry,children:[/* @__PURE__ */ (0,i.jsx)(`span`,{children:e(`extensions.registry`)}),/* @__PURE__ */ (0,i.jsxs)(`select`,{"aria-label":e(`extensions.registry`),value:d,disabled:n,onChange:e=>{f(e.currentTarget.value),g(!1)},children:[/* @__PURE__ */ (0,i.jsx)(`option`,{value:`official`,children:e(`extensions.registryOfficial`)}),/* @__PURE__ */ (0,i.jsx)(`option`,{value:`mirror`,children:e(`extensions.registryMirror`)}),/* @__PURE__ */ (0,i.jsx)(`option`,{value:`custom`,children:e(`extensions.registryCustom`)})]})]})]}),d===`custom`&&/* @__PURE__ */ (0,i.jsxs)(`label`,{className:Df.field,children:[/* @__PURE__ */ (0,i.jsx)(`span`,{children:e(`extensions.registryCustomUrl`)}),/* @__PURE__ */ (0,i.jsx)(`input`,{type:`text`,value:p,"aria-label":e(`extensions.registryCustomUrl`),placeholder:`https://npm.example.com/`,"aria-invalid":h,"aria-describedby":h?S:void 0,autoCapitalize:`none`,autoCorrect:`off`,spellCheck:!1,disabled:n,onChange:e=>{m(e.currentTarget.value),g(!1)}}),h&&/* @__PURE__ */ (0,i.jsx)(`span`,{id:S,className:Df.error,role:`alert`,children:e(`extensions.registryInvalid`)})]}),_&&/* @__PURE__ */ (0,i.jsxs)(`div`,{id:b,className:Df.guide,children:[/* @__PURE__ */ (0,i.jsx)(`p`,{children:e(`extensions.guideNpm`)}),/* @__PURE__ */ (0,i.jsx)(`code`,{children:`dsh-theme-example · @author/theme@1.2.3`}),/* @__PURE__ */ (0,i.jsx)(`p`,{children:e(`extensions.guideGitHub`)}),/* @__PURE__ */ (0,i.jsx)(`code`,{children:`https://github.com/owner/plugin`}),/* @__PURE__ */ (0,i.jsx)(`p`,{children:e(`extensions.guideDirectory`)}),/* @__PURE__ */ (0,i.jsx)(`code`,{children:`/absolute/path/to/plugin · /absolute/path/to/plugin.tgz`}),/* @__PURE__ */ (0,i.jsx)(`p`,{className:Df.hint,children:e(`extensions.registryHint`)})]})]})})}let Af=`@deepseek-ai/dsh-client-ui-codexhost/WebExtensionsSection.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Af)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-codexhost`,e.dataset.pluginCss=Af,e.textContent=`.Rbb5ka_page,.Rbb5ka_rowText{flex-direction:column;min-width:0;display:flex}.Rbb5ka_page{gap:28px}.Rbb5ka_header{flex-wrap:wrap;justify-content:space-between;align-items:flex-start;gap:16px;display:flex}.Rbb5ka_heading{flex:280px;min-width:0}.Rbb5ka_title{color:var(--dsw-alias-label-primary);overflow-wrap:anywhere;margin:0;font-size:20px;font-weight:600;line-height:28px}.Rbb5ka_intro{align-items:flex-start;gap:4px;margin-top:8px;display:flex}.Rbb5ka_intro .Rbb5ka_iconButton{width:24px;height:24px;margin-top:-2px}.Rbb5ka_intro .Rbb5ka_hint{color:var(--dsw-alias-label-secondary);font-size:13px;line-height:20px}.Rbb5ka_hint,.Rbb5ka_meta,.Rbb5ka_notice,.Rbb5ka_error{color:var(--dsw-alias-label-tertiary);overflow-wrap:anywhere;margin:0;font-size:12px;line-height:18px}.Rbb5ka_notice{color:var(--dsw-alias-label-secondary)}.Rbb5ka_error,.Rbb5ka_danger{color:var(--dsw-alias-state-error-primary)}.Rbb5ka_actions,.Rbb5ka_recovery{flex-wrap:wrap;align-items:center;gap:8px;display:flex}.Rbb5ka_actions{flex:none}.Rbb5ka_iconButton{width:32px;height:32px;color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:none;border-radius:8px;flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex}.Rbb5ka_iconButton:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}.Rbb5ka_iconButton:disabled{opacity:.5;cursor:default}.Rbb5ka_open:focus-visible,.Rbb5ka_iconButton:focus-visible,.Rbb5ka_back:focus-visible{outline:2px solid var(--dsw-alias-label-secondary);outline-offset:2px}.Rbb5ka_button{border-radius:var(--dsw-radius-md,10px);background:var(--dsw-alias-bg-module-platform);min-height:36px;font:inherit;color:var(--dsw-alias-label-primary);cursor:pointer;border:none;flex:none;padding:8px 14px;font-size:14px}.Rbb5ka_button:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover)}.Rbb5ka_button:disabled{opacity:.6;cursor:default}.Rbb5ka_list{flex-direction:column;gap:4px;margin:0;padding:0;list-style:none;display:flex}.Rbb5ka_group{min-width:0}.Rbb5ka_groupTitle{color:var(--dsw-alias-label-primary);align-items:baseline;gap:8px;margin:0 0 16px;font-size:14px;font-weight:500;line-height:22px;display:flex}.Rbb5ka_count{color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums}.Rbb5ka_row{border-radius:12px;flex-wrap:wrap;align-items:center;gap:4px 12px;margin:0 -8px;padding:8px;display:flex}.Rbb5ka_row:hover,.Rbb5ka_row:focus-within{background:var(--dsw-alias-interactive-bg-hover)}.Rbb5ka_open{min-width:0;font:inherit;text-align:left;cursor:pointer;background:0 0;border:none;border-radius:8px;flex:1;align-items:center;gap:14px;padding:0;display:flex}.Rbb5ka_artwork{box-sizing:border-box;border:1px solid var(--dsw-alias-border-l2);width:48px;height:48px;color:var(--dsw-alias-label-secondary);border-radius:12px;flex:none;justify-content:center;align-items:center;display:flex}.Rbb5ka_packageImage{object-fit:contain}.Rbb5ka_summary{text-overflow:ellipsis;white-space:nowrap;color:var(--dsw-alias-label-tertiary);font-size:13px;line-height:18px;overflow:hidden}.Rbb5ka_description{color:var(--dsw-alias-label-secondary);overflow-wrap:anywhere;margin:0;font-size:14px;line-height:22px}.Rbb5ka_chevron{color:var(--dsw-alias-label-tertiary);opacity:0;flex:none}.Rbb5ka_row:hover .Rbb5ka_chevron,.Rbb5ka_row:focus-within .Rbb5ka_chevron{opacity:1}.Rbb5ka_rowText{flex:1;gap:4px}.Rbb5ka_name{color:var(--dsw-alias-label-primary);text-overflow:ellipsis;white-space:nowrap;font-size:14px;font-weight:500;line-height:22px;overflow:hidden}.Rbb5ka_rowNotice{flex-basis:100%;padding-left:62px}.Rbb5ka_back{font:inherit;color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:none;align-self:flex-start;align-items:center;gap:6px;padding:0;font-size:13px;display:inline-flex}.Rbb5ka_detail{flex-direction:column;gap:20px;min-width:0;display:flex}.Rbb5ka_detail .Rbb5ka_rowText{gap:8px}.Rbb5ka_source{border:1px solid var(--dsw-alias-border-l2);color:var(--dsw-alias-label-secondary);overflow-wrap:anywhere;border-radius:10px;margin:0;padding:16px;font-size:12px;line-height:20px}.Rbb5ka_recovery{gap:8px 16px;margin-top:4px}.Rbb5ka_link{color:var(--dsw-alias-label-secondary);text-underline-offset:3px;font-size:12px;line-height:18px}@media (width<=600px){.Rbb5ka_page{gap:24px}.Rbb5ka_open{gap:10px}.Rbb5ka_artwork{border-radius:10px;width:40px;height:40px}.Rbb5ka_row,.Rbb5ka_row .Rbb5ka_actions{gap:4px}.Rbb5ka_chevron{display:none}.Rbb5ka_rowNotice{padding-left:50px}}`,document.head.appendChild(e)}var Q={actions:`Rbb5ka_actions`,artwork:`Rbb5ka_artwork`,back:`Rbb5ka_back`,button:`Rbb5ka_button`,chevron:`Rbb5ka_chevron`,count:`Rbb5ka_count`,danger:`Rbb5ka_danger`,description:`Rbb5ka_description`,detail:`Rbb5ka_detail`,error:`Rbb5ka_error`,group:`Rbb5ka_group`,groupTitle:`Rbb5ka_groupTitle`,header:`Rbb5ka_header`,heading:`Rbb5ka_heading`,hint:`Rbb5ka_hint`,iconButton:`Rbb5ka_iconButton`,intro:`Rbb5ka_intro`,link:`Rbb5ka_link`,list:`Rbb5ka_list`,meta:`Rbb5ka_meta`,name:`Rbb5ka_name`,notice:`Rbb5ka_notice`,open:`Rbb5ka_open`,packageImage:`Rbb5ka_packageImage`,page:`Rbb5ka_page`,recovery:`Rbb5ka_recovery`,row:`Rbb5ka_row`,rowNotice:`Rbb5ka_rowNotice`,rowText:`Rbb5ka_rowText`,source:`Rbb5ka_source`,summary:`Rbb5ka_summary`,title:`Rbb5ka_title`};function jf({url:e,t}){if(e===void 0)return null;let n=new URL(e).hostname===`github.com`;return/* @__PURE__ */ (0,i.jsx)(`a`,{className:Q.iconButton,href:e,target:`_blank`,rel:`noopener noreferrer`,"aria-label":n?`GitHub`:t(`extensions.project`),title:e,"data-extension-project":n?`github`:`web`,children:n?/* @__PURE__ */ (0,i.jsx)(`svg`,{width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":`true`,children:/* @__PURE__ */ (0,i.jsx)(`path`,{d:`M12 .75a11.25 11.25 0 0 0-3.56 21.92c.56.1.77-.24.77-.54v-2.1c-3.13.68-3.79-1.33-3.79-1.33-.51-1.3-1.25-1.65-1.25-1.65-1.02-.7.08-.69.08-.69 1.13.08 1.73 1.16 1.73 1.16 1 1.72 2.63 1.22 3.27.93.1-.73.39-1.22.71-1.5-2.5-.28-5.13-1.25-5.13-5.56 0-1.23.44-2.23 1.16-3.02-.12-.29-.5-1.43.11-2.98 0 0 .95-.3 3.1 1.15a10.77 10.77 0 0 1 5.64 0c2.15-1.45 3.1-1.15 3.1-1.15.61 1.55.23 2.69.11 2.98.72.79 1.16 1.79 1.16 3.02 0 4.32-2.63 5.28-5.14 5.56.4.35.76 1.03.76 2.08v3.1c0 .3.2.65.77.54A11.25 11.25 0 0 0 12 .75Z`})}):/* @__PURE__ */ (0,i.jsx)(r.IconLinkOutlineRegular,{size:18})})}function Mf({src:e}){let[t,n]=(0,o.useState)();return/* @__PURE__ */ (0,i.jsx)(`span`,{className:Q.artwork,"aria-hidden":`true`,children:e!==void 0&&e!==t?/* @__PURE__ */ (0,i.jsx)(`img`,{src:e,width:32,height:32,alt:``,className:Q.packageImage,"data-extension-icon":!0,onError:()=>n(e)}):/* @__PURE__ */ (0,i.jsx)(r.IconCordisPluginOutlineRegular,{size:26})})}function Nf(e,t){return{title:e.meta?.title===void 0?e.name:t(e.meta.title),description:e.meta?.description===void 0?void 0:t(e.meta.description)||void 0}}function Pf(e){if(e instanceof Ol&&e.code===`auth/local-access-required`){let t=Ls.safeParse(e.details);return{kind:`non-local`,url:t.success?t.data.url:`http://127.0.0.1`}}return{kind:`failed`,message:e instanceof Error?e.message:String(e)}}function Ff({t:e,resolveText:t}){let[n,a]=(0,o.useState)({kind:`loading`}),[s,c]=(0,o.useState)(!1),[l,u]=(0,o.useState)(null),[d,f]=(0,o.useState)(null),[p,m]=(0,o.useState)(null),[h,g]=(0,o.useState)(null),_=(0,o.useRef)(!1);(0,o.useEffect)(()=>{let e=new AbortController;return Tf.list(e.signal).then(t=>{e.signal.aborted||a({kind:`ready`,data:t})},t=>{e.signal.aborted||a(Pf(t))}),()=>e.abort()},[]);let v=async(t,n,r)=>{if(_.current)return!1;_.current=!0,u(t),f(null);try{return a({kind:`ready`,data:await n()}),r?.(),!0}catch(t){let n=Pf(t);return n.kind===`non-local`?a(n):f(e(`extensions.actionFailed`,{message:n.message})),!1}finally{_.current=!1,u(null)}},y=/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Q.recovery,children:[/* @__PURE__ */ (0,i.jsx)(`a`,{className:Q.link,href:`/extensions`,children:e(`extensions.recovery`)}),/* @__PURE__ */ (0,i.jsx)(`a`,{className:Q.link,href:`/?extensions=off`,children:e(`extensions.builtinsOnly`)})]});if(n.kind===`loading`)return/* @__PURE__ */ (0,i.jsx)(`p`,{className:Q.hint,children:e(`extensions.loading`)});if(n.kind===`non-local`)return/* @__PURE__ */ (0,i.jsx)(`p`,{className:Q.notice,"data-web-extensions-notice":`non-local`,children:e(`extensions.localOnly`,{url:n.url})});if(n.kind===`failed`)return/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Q.page,children:[/* @__PURE__ */ (0,i.jsx)(`p`,{className:Q.error,role:`alert`,children:e(`extensions.loadFailed`,{message:n.message})}),d!==null&&/* @__PURE__ */ (0,i.jsx)(`p`,{className:Q.error,role:`alert`,children:d}),/* @__PURE__ */ (0,i.jsx)(`div`,{children:/* @__PURE__ */ (0,i.jsx)(`button`,{type:`button`,className:Q.button,disabled:l!==null,onClick:()=>void v(`refresh`,()=>Tf.list()),children:e(`extensions.retry`)})}),y]});let{extensions:b,loadedIds:x,safeMode:S,storeError:C}=n.data,w=l!==null,T=b.find(e=>e.id===h),E=T===void 0?void 0:{...T,...Nf(T,t)},D=(e,t)=>{v(e,()=>Tf.setEnabled(e,t))};return/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Q.page,"data-web-extensions":!0,children:[E===void 0?/* @__PURE__ */ (0,i.jsxs)(`header`,{className:Q.header,children:[/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Q.heading,children:[/* @__PURE__ */ (0,i.jsx)(`h2`,{className:Q.title,children:e(`settings.extensions`)}),/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Q.intro,children:[/* @__PURE__ */ (0,i.jsx)(`p`,{className:Q.hint,children:e(`extensions.description`)}),/* @__PURE__ */ (0,i.jsx)(r.Tooltip,{label:e(`extensions.restart`),side:`bottom`,maxWidth:320,portal:!0,openOnClick:!0,children:/* @__PURE__ */ (0,i.jsx)(`button`,{type:`button`,className:Q.iconButton,"aria-label":e(`extensions.info`),children:/* @__PURE__ */ (0,i.jsx)(r.IconInfoOutlineRegular,{size:15})})})]})]}),/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Q.actions,children:[/* @__PURE__ */ (0,i.jsx)(`button`,{type:`button`,className:Q.iconButton,"aria-label":e(`extensions.refresh`),title:e(`extensions.refresh`),disabled:w,"aria-busy":l===`refresh`,onClick:()=>void v(`refresh`,()=>Tf.list()),children:/* @__PURE__ */ (0,i.jsx)(r.IconRefreshOutlineRegular,{size:18})}),/* @__PURE__ */ (0,i.jsx)(r.Button,{variant:`primary`,icon:/* @__PURE__ */ (0,i.jsx)(r.IconPlusOutlineRegular,{size:16}),disabled:w||C!==void 0,onClick:()=>{f(null),c(!0)},children:e(`extensions.add`)})]})]}):/* @__PURE__ */ (0,i.jsxs)(`button`,{type:`button`,className:Q.back,onClick:()=>{g(null),m(null),f(null)},children:[/* @__PURE__ */ (0,i.jsx)(r.IconChevronLeftOutlineRegular,{}),e(`settings.extensions`)]}),/* @__PURE__ */ (0,i.jsx)(kf,{t:e,open:s,busy:l===`install`,error:d,onClose:()=>c(!1),onInstall:(e,t)=>v(`install`,()=>Tf.install(e,t),()=>c(!1))}),S&&/* @__PURE__ */ (0,i.jsx)(`p`,{className:Q.notice,children:e(`extensions.safeMode`)}),C!==void 0&&/* @__PURE__ */ (0,i.jsx)(`p`,{className:Q.error,role:`alert`,children:e(`extensions.storeError`,{message:C})}),d!==null&&!s&&/* @__PURE__ */ (0,i.jsx)(`p`,{className:Q.error,role:`alert`,children:d}),E===void 0?b.length===0?/* @__PURE__ */ (0,i.jsx)(`p`,{className:Q.hint,children:e(`extensions.empty`)}):/* @__PURE__ */ (0,i.jsxs)(`section`,{className:Q.group,children:[/* @__PURE__ */ (0,i.jsxs)(`h3`,{className:Q.groupTitle,children:[e(`extensions.installed`),` `,/* @__PURE__ */ (0,i.jsx)(`span`,{className:Q.count,children:b.length})]}),/* @__PURE__ */ (0,i.jsx)(`ul`,{className:Q.list,children:b.map(n=>{let a=n.enabledTargets.includes(`web`),o=x.includes(n.id),{title:s,description:c}=Nf(n,t);return/* @__PURE__ */ (0,i.jsxs)(`li`,{className:Q.row,"data-web-extension":n.id,children:[/* @__PURE__ */ (0,i.jsxs)(`button`,{type:`button`,className:Q.open,"aria-label":s,onClick:()=>{g(n.id),m(null)},children:[/* @__PURE__ */ (0,i.jsx)(Mf,{src:n.meta?.icon}),/* @__PURE__ */ (0,i.jsxs)(`span`,{className:Q.rowText,children:[/* @__PURE__ */ (0,i.jsx)(`span`,{className:Q.name,title:s,children:s}),c!==void 0&&/* @__PURE__ */ (0,i.jsx)(`span`,{className:Q.summary,title:c,children:c}),/* @__PURE__ */ (0,i.jsxs)(`span`,{className:Q.meta,children:[n.version,` · DSH ·`,` `,e(a?`extensions.enabled`:`extensions.disabled`)]})]}),/* @__PURE__ */ (0,i.jsx)(r.IconChevronRightOutlineRegular,{className:Q.chevron})]}),/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Q.actions,children:[/* @__PURE__ */ (0,i.jsx)(jf,{url:n.projectUrl,t:e}),/* @__PURE__ */ (0,i.jsx)(r.Switch,{label:s,checked:a,disabled:w||C!==void 0,onChange:e=>D(n.id,e)})]}),a!==o&&!S&&n.loadError===void 0&&/* @__PURE__ */ (0,i.jsx)(`p`,{className:`${Q.notice} ${Q.rowNotice}`,children:e(`extensions.pendingRestart`)}),n.loadError!==void 0&&/* @__PURE__ */ (0,i.jsx)(`p`,{className:`${Q.error} ${Q.rowNotice}`,role:`alert`,children:e(`extensions.extensionError`,{message:n.loadError})}),n.meta?.error!==void 0&&/* @__PURE__ */ (0,i.jsx)(`p`,{className:`${Q.notice} ${Q.rowNotice}`,children:e(`extensions.metadataError`,{message:n.meta.error})})]},n.id)})})]}):/* @__PURE__ */ (0,i.jsxs)(`section`,{className:Q.detail,"data-web-extension-detail":E.id,children:[/* @__PURE__ */ (0,i.jsxs)(`header`,{className:Q.header,children:[/* @__PURE__ */ (0,i.jsx)(Mf,{src:E.meta?.icon}),/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Q.actions,children:[/* @__PURE__ */ (0,i.jsx)(jf,{url:E.projectUrl,t:e}),p===E.id&&/* @__PURE__ */ (0,i.jsx)(r.Button,{variant:`outline`,disabled:w,onClick:()=>m(null),children:e(`extensions.cancel`)}),/* @__PURE__ */ (0,i.jsx)(r.Button,{variant:`outline`,className:p===E.id?Q.danger:void 0,disabled:w||C!==void 0,onClick:()=>{p===E.id?v(E.id,()=>Tf.remove(E.id),()=>{g(null),m(null)}):m(E.id)},children:e(`extensions.remove`)}),/* @__PURE__ */ (0,i.jsx)(r.Switch,{label:E.title,checked:E.enabledTargets.includes(`web`),disabled:w||C!==void 0,onChange:e=>D(E.id,e)})]})]}),/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Q.rowText,children:[/* @__PURE__ */ (0,i.jsx)(`h2`,{className:Q.title,children:E.title}),E.title!==E.name&&/* @__PURE__ */ (0,i.jsx)(`p`,{className:Q.meta,children:E.name}),E.description!==void 0&&/* @__PURE__ */ (0,i.jsx)(`p`,{className:Q.description,children:E.description}),/* @__PURE__ */ (0,i.jsxs)(`p`,{className:Q.meta,children:[E.version,` · DSH ·`,` `,e(E.enabledTargets.includes(`web`)?`extensions.enabled`:`extensions.disabled`)]})]}),/* @__PURE__ */ (0,i.jsx)(`p`,{className:Q.source,children:e(`extensions.source`,{source:E.source})}),E.meta?.error!==void 0&&/* @__PURE__ */ (0,i.jsx)(`p`,{className:Q.notice,children:e(`extensions.metadataError`,{message:E.meta.error})}),/* @__PURE__ */ (0,i.jsx)(`p`,{className:Q.notice,children:e(`extensions.restart`)}),x.includes(E.id)&&/* @__PURE__ */ (0,i.jsx)(`p`,{className:Q.hint,children:e(`extensions.includedAtStartup`)}),p===E.id&&/* @__PURE__ */ (0,i.jsx)(`p`,{className:Q.notice,children:e(`extensions.confirmRemove`,{name:E.name})}),E.loadError!==void 0&&/* @__PURE__ */ (0,i.jsx)(`p`,{className:Q.error,role:`alert`,children:e(`extensions.extensionError`,{message:E.loadError})})]}),y]})}let If=`@deepseek-ai/dsh-client-ui-codexhost/NotificationsRow.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(If)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-codexhost`,e.dataset.pluginCss=If,e.textContent=`.Ac8K1G_row{border-bottom:.5px solid var(--dsw-alias-border-l2);align-items:center;gap:8px;padding:16px 0;display:flex}.Ac8K1G_rowText{flex-direction:column;flex:1;gap:4px;min-width:0;padding-right:24px;display:flex}.Ac8K1G_title{color:var(--dsw-alias-label-primary);font-size:14px;line-height:22px}.Ac8K1G_desc{color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:18px}.Ac8K1G_button{border-radius:var(--dsw-radius-md,10px);background:var(--dsw-alias-bg-module-platform);height:36px;font:inherit;color:var(--dsw-alias-label-primary);cursor:pointer;border:none;flex:none;padding:0 14px;font-size:14px}.Ac8K1G_button:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover)}.Ac8K1G_button:disabled{opacity:.6;cursor:default}`,document.head.appendChild(e)}var Lf={button:`Ac8K1G_button`,desc:`Ac8K1G_desc`,row:`Ac8K1G_row`,rowText:`Ac8K1G_rowText`,title:`Ac8K1G_title`};function Rf({t:e}){let[t,n]=(0,o.useState)(null),[r,a]=(0,o.useState)(!1),[s,c]=(0,o.useState)(null);(0,o.useEffect)(()=>{Gu().then(n,()=>{n(`unsupported`)})},[]);let l=e=>{a(!0),c(null),e().then(e=>{n(e),a(!1)},e=>{c(e instanceof Error?e.message:String(e)),a(!1)})},u=s??(t===null?``:e(`notifications.${t}`));return/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Lf.row,children:[/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Lf.rowText,children:[/* @__PURE__ */ (0,i.jsx)(`div`,{className:Lf.title,children:e(`notifications.title`)}),/* @__PURE__ */ (0,i.jsx)(`div`,{className:Lf.desc,role:s===null?void 0:`alert`,children:u})]}),t===`on`&&/* @__PURE__ */ (0,i.jsx)(`button`,{type:`button`,className:Lf.button,disabled:r,onClick:()=>{Fl.test()},children:e(`notifications.test`)}),(t===`off`||t===`on`)&&/* @__PURE__ */ (0,i.jsx)(`button`,{type:`button`,className:Lf.button,disabled:r,onClick:()=>{l(t===`on`?qu:Ku)},children:e(t===`on`?`notifications.disable`:`notifications.enable`)})]})}let zf=`@deepseek-ai/dsh-client-ui-codexhost/ImportPage.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(zf)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-codexhost`,e.dataset.pluginCss=zf,e.textContent=`.htJ9Oq_page{box-sizing:border-box;height:100%;padding:calc(36px + var(--dsh-frame-top-clearance,0px)) clamp(16px, 4vw, 48px) 56px;overflow-y:auto}.htJ9Oq_inner{flex-direction:column;gap:16px;max-width:800px;margin:0 auto;display:flex}.htJ9Oq_header{flex-wrap:wrap;justify-content:space-between;align-items:flex-start;gap:16px;margin-bottom:4px;display:flex}.htJ9Oq_heading{flex:320px;min-width:0}.htJ9Oq_title{letter-spacing:-.01em;color:var(--dsw-alias-label-primary);margin:0;font-size:24px;font-weight:600;line-height:32px}.htJ9Oq_subtitle{color:var(--dsw-alias-label-secondary);margin:6px 0 0;font-size:14px;line-height:1.6}.htJ9Oq_refresh{flex:none;margin-top:2px}.htJ9Oq_tabs{flex-wrap:wrap;gap:8px;display:flex}.htJ9Oq_tab{box-sizing:border-box;border:.5px solid var(--dsw-alias-border-l3);height:32px;color:var(--dsw-alias-label-secondary);font:inherit;cursor:pointer;transition:background var(--ds-transition-duration-fast,.1s) var(--ds-ease-in-out,ease), border-color var(--ds-transition-duration-fast,.1s) var(--ds-ease-in-out,ease), color var(--ds-transition-duration-fast,.1s) var(--ds-ease-in-out,ease);background:0 0;border-radius:999px;align-items:center;gap:6px;padding:0 12px 0 10px;font-size:13px;display:inline-flex}.htJ9Oq_tab:hover:not(:disabled):not([data-active]){background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}.htJ9Oq_tab[data-active]{background:var(--dsw-alias-bg-layer-3,var(--dsw-alias-interactive-bg-active));border-color:var(--dsw-alias-border-l4,var(--dsw-alias-border-l3));color:var(--dsw-alias-label-primary);box-shadow:inset 0 0 0 .5px var(--dsw-alias-border-l4,transparent);font-weight:500}.htJ9Oq_tab:focus-visible,.htJ9Oq_search:focus-visible,.htJ9Oq_select:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:1px}.htJ9Oq_tabIcon{width:14px;height:14px;color:inherit;flex:none;display:inline-flex}.htJ9Oq_tab:disabled{opacity:.5;cursor:default}.htJ9Oq_searchField{display:block;position:relative}.htJ9Oq_searchIcon{color:var(--dsw-alias-label-tertiary);pointer-events:none;position:absolute;top:50%;left:14px;transform:translateY(-50%)}.htJ9Oq_search{box-sizing:border-box;border:.5px solid var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-md,12px);width:100%;height:42px;font:inherit;color:var(--dsw-alias-label-primary);background:var(--dsw-alias-bg-layer-2,transparent);transition:border-color var(--ds-transition-duration,.2s) var(--ds-ease-in-out,ease), box-shadow var(--ds-transition-duration,.2s) var(--ds-ease-in-out,ease);outline:none;padding:0 14px 0 40px;font-size:14px}.htJ9Oq_search::placeholder{color:var(--dsw-alias-label-tertiary)}.htJ9Oq_search:focus{border-color:var(--dsw-alias-brand-primary);box-shadow:0 0 0 3px color-mix(in srgb, var(--dsw-alias-brand-primary) 18%, transparent)}.htJ9Oq_search:focus-visible{outline:none}.htJ9Oq_search:disabled{opacity:.6}.htJ9Oq_callout{border-radius:var(--dsw-radius-sm,8px);border:.5px solid #0000;align-items:flex-start;gap:8px;margin:0;padding:10px 12px;font-size:13px;line-height:20px;display:flex}.htJ9Oq_callout[data-tone=error]{color:var(--dsw-alias-state-error-primary);background:color-mix(in srgb, var(--dsw-alias-state-error-primary) 10%, transparent);border-color:color-mix(in srgb, var(--dsw-alias-state-error-primary) 28%, transparent)}.htJ9Oq_calloutIcon{flex:none;margin-top:2px}.htJ9Oq_list{border:.5px solid var(--dsw-alias-settings-card-stroke,var(--dsw-alias-border-l3));border-radius:var(--dsw-radius-lg,16px);background:var(--dsw-alias-settings-card-fill,transparent);margin:0;padding:4px;list-style:none}.htJ9Oq_row{border-radius:var(--dsw-radius-md,12px);transition:background var(--ds-transition-duration-fast,.1s) var(--ds-ease-in-out,ease);align-items:center;gap:16px;padding:12px 12px 12px 14px;display:flex;position:relative}.htJ9Oq_row+.htJ9Oq_row:before{content:"";border-top:.5px solid var(--dsw-alias-border-l2);position:absolute;top:0;left:14px;right:14px}.htJ9Oq_row:hover{background:var(--dsw-alias-interactive-bg-hover)}.htJ9Oq_row:hover:before,.htJ9Oq_row:hover+.htJ9Oq_row:before{opacity:0}.htJ9Oq_rowText{flex:1;min-width:0}.htJ9Oq_rowTitle{color:var(--dsw-alias-label-primary);text-overflow:ellipsis;white-space:nowrap;font-size:14px;font-weight:500;line-height:22px;overflow:hidden}.htJ9Oq_rowMeta{color:var(--dsw-alias-label-tertiary);flex-wrap:wrap;align-items:center;gap:4px 14px;min-width:0;margin-top:4px;font-size:12px;line-height:18px;display:flex}.htJ9Oq_metaItem{align-items:center;gap:5px;min-width:0;max-width:100%;display:inline-flex}.htJ9Oq_metaIcon{opacity:.8;flex:none}.htJ9Oq_metaText{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.htJ9Oq_action{flex:none;min-width:64px}.htJ9Oq_status{color:var(--dsw-alias-label-secondary);justify-content:center;align-items:center;gap:8px;padding:40px 0;font-size:14px;display:flex}.htJ9Oq_empty{border:.5px dashed var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-lg,16px);color:var(--dsw-alias-label-secondary);flex-direction:column;align-items:center;gap:10px;padding:48px 16px;font-size:14px;display:flex}.htJ9Oq_emptyIcon{color:var(--dsw-alias-label-tertiary)}.htJ9Oq_footer{color:var(--dsw-alias-label-tertiary);flex-wrap:wrap;justify-content:space-between;align-items:center;gap:10px 16px;font-size:12px;display:flex}.htJ9Oq_pageSize{align-items:center;gap:8px;display:inline-flex}.htJ9Oq_select{box-sizing:border-box;border:.5px solid var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-sm,8px);background:var(--dsw-alias-bg-layer-2,transparent);height:28px;color:var(--dsw-alias-label-primary);font:inherit;cursor:pointer;padding:0 8px;font-size:12px}.htJ9Oq_select:disabled{opacity:.6;cursor:default}.htJ9Oq_pager{align-items:center;gap:6px;display:inline-flex}.htJ9Oq_range{font-variant-numeric:tabular-nums;margin-right:6px}.htJ9Oq_pageButton{width:28px;padding:0}`,document.head.appendChild(e)}var $={action:`htJ9Oq_action`,callout:`htJ9Oq_callout`,calloutIcon:`htJ9Oq_calloutIcon`,empty:`htJ9Oq_empty`,emptyIcon:`htJ9Oq_emptyIcon`,footer:`htJ9Oq_footer`,header:`htJ9Oq_header`,heading:`htJ9Oq_heading`,inner:`htJ9Oq_inner`,list:`htJ9Oq_list`,metaIcon:`htJ9Oq_metaIcon`,metaItem:`htJ9Oq_metaItem`,metaText:`htJ9Oq_metaText`,page:`htJ9Oq_page`,pageButton:`htJ9Oq_pageButton`,pageSize:`htJ9Oq_pageSize`,pager:`htJ9Oq_pager`,range:`htJ9Oq_range`,refresh:`htJ9Oq_refresh`,row:`htJ9Oq_row`,rowMeta:`htJ9Oq_rowMeta`,rowText:`htJ9Oq_rowText`,rowTitle:`htJ9Oq_rowTitle`,search:`htJ9Oq_search`,searchField:`htJ9Oq_searchField`,searchIcon:`htJ9Oq_searchIcon`,select:`htJ9Oq_select`,status:`htJ9Oq_status`,subtitle:`htJ9Oq_subtitle`,tab:`htJ9Oq_tab`,tabIcon:`htJ9Oq_tabIcon`,tabs:`htJ9Oq_tabs`,title:`htJ9Oq_title`};function Bf(e){let t=Math.max(0,Math.round((Date.now()-e)/1e3));if(t<60)return`now`;let n=Math.round(t/60);if(n<60)return`${String(n)}m`;let r=Math.round(n/60);if(r<48)return`${String(r)}h`;let i=Math.round(r/24);return i<60?`${String(i)}d`:new Date(e).toLocaleDateString()}function Vf(e){return e instanceof Error?e.message:String(e)}function Hf({openSession:e,t}){let[n,a]=(0,o.useState)(null),[s,c]=(0,o.useState)(null),[l,u]=(0,o.useState)(``),[d,f]=(0,o.useState)(0),[p,m]=(0,o.useState)(20),[h,g]=(0,o.useState)(0),[_,v]=(0,o.useState)(null),[y,b]=(0,o.useState)(0),[x,S]=(0,o.useState)(null),[C,w]=(0,o.useState)(null),[T,E]=(0,o.useState)(null),[D,O]=(0,o.useState)({}),ee=(0,o.useRef)(!1),te=(0,o.useRef)(null);(0,o.useEffect)(()=>{let e=new AbortController;return te.current=e,()=>e.abort()},[]),(0,o.useEffect)(()=>{let e=!0;return S(null),Il.sources().then(({harnesses:t})=>{e&&(a(t),c(e=>t.some(t=>t.harnessId===e)?e:t[0]?.harnessId??null))},t=>{e&&S(Vf(t))}),()=>{e=!1}},[h]),(0,o.useEffect)(()=>{if(s===null)return;let e=!0;v(null),S(null);let t=setTimeout(()=>{Il.candidates({harnessId:s,query:l,offset:d,limit:p}).then(({candidates:t,total:n})=>{e&&(d>0&&d>=n?f(Math.max(0,Math.ceil(n/p)-1)*p):(v(t),b(n)))},t=>{e&&S(Vf(t))})},l===``?0:200);return()=>{e=!1,clearTimeout(t)}},[s,l,d,p,h]);let k=(0,o.useMemo)(()=>/^(\/Users\/[^/]+|\/home\/[^/]+)/u.exec(_?.[0]?.cwd??``)?.[1],[_]),ne=e=>k!==void 0&&(e===k||e.startsWith(`${k}/`))?`~${e.slice(k.length)}`:e,re=async n=>{let r=te.current?.signal;if(s===null||ee.current||!r||r.aborted)return;let i=JSON.stringify([s,n.nativeSessionId]),a=D[i];ee.current=!0,E(n.nativeSessionId),w(null);try{if(!a){let e=await Il.importSession(s,n.nativeSessionId);if(a=e.threadId,r.aborted)return;O(t=>({...t,[i]:e.threadId}))}r.aborted||await e(a,r)}catch(e){r.aborted||w(t(a?`openFailed`:`importFailed`,{message:Vf(e)}))}finally{ee.current=!1,r.aborted||E(null)}},A=()=>{v(null),f(0),w(null)};return/* @__PURE__ */ (0,i.jsx)(`div`,{className:$.page,children:/* @__PURE__ */ (0,i.jsxs)(`div`,{className:$.inner,children:[/* @__PURE__ */ (0,i.jsxs)(`header`,{className:$.header,children:[/* @__PURE__ */ (0,i.jsxs)(`div`,{className:$.heading,children:[/* @__PURE__ */ (0,i.jsx)(`h1`,{className:$.title,children:t(`title`)}),/* @__PURE__ */ (0,i.jsx)(`p`,{className:$.subtitle,children:t(`subtitle`)})]}),/* @__PURE__ */ (0,i.jsx)(r.Button,{variant:`outline`,size:`sm`,className:$.refresh,icon:/* @__PURE__ */ (0,i.jsx)(r.IconRefreshOutlineRegular,{size:14}),disabled:T!==null,onClick:()=>{v(null),g(e=>e+1)},children:t(`refresh`)})]}),n!==null&&n.length===0&&/* @__PURE__ */ (0,i.jsx)(`div`,{className:$.status,children:t(`noSources`)}),n!==null&&n.length>1&&/* @__PURE__ */ (0,i.jsx)(`div`,{className:$.tabs,role:`tablist`,"aria-label":t(`sources`),children:n.map(e=>/* @__PURE__ */ (0,i.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":e.harnessId===s,className:$.tab,"data-active":e.harnessId===s||void 0,disabled:T!==null,onClick:()=>{e.harnessId!==s&&(A(),c(e.harnessId))},children:[/* @__PURE__ */ (0,i.jsx)(`span`,{className:$.tabIcon,"aria-hidden":`true`,children:/* @__PURE__ */ (0,i.jsx)(r.RemotePluginIcon,{id:e.harnessId,src:`/harness-icons/${encodeURIComponent(e.harnessId)}`,presentationUrl:`/harness-icons/presentation.json`,size:14,fallback:/* @__PURE__ */ (0,i.jsx)(r.IconDataOutlineRegular,{size:14})})}),e.name]},e.harnessId))}),n!==null&&n.length>0&&/* @__PURE__ */ (0,i.jsxs)(`label`,{className:$.searchField,children:[/* @__PURE__ */ (0,i.jsx)(r.IconSearchOutlineRegular,{size:16,className:$.searchIcon}),/* @__PURE__ */ (0,i.jsx)(`input`,{className:$.search,type:`search`,value:l,"aria-label":t(`search`),placeholder:t(`search`),disabled:T!==null,onChange:e=>{A(),u(e.target.value)}})]}),x!==null&&/* @__PURE__ */ (0,i.jsxs)(`div`,{role:`alert`,className:$.callout,"data-tone":`error`,children:[/* @__PURE__ */ (0,i.jsx)(r.IconWarningOutlineRegular,{size:16,className:$.calloutIcon}),/* @__PURE__ */ (0,i.jsx)(`span`,{children:t(`error`,{message:x})})]}),C!==null&&/* @__PURE__ */ (0,i.jsxs)(`div`,{role:`alert`,className:$.callout,"data-tone":`error`,children:[/* @__PURE__ */ (0,i.jsx)(r.IconWarningOutlineRegular,{size:16,className:$.calloutIcon}),/* @__PURE__ */ (0,i.jsx)(`span`,{children:C})]}),x===null&&(n===null||s!==null&&_===null)&&/* @__PURE__ */ (0,i.jsxs)(`div`,{className:$.status,children:[/* @__PURE__ */ (0,i.jsx)(r.StateDot,{state:`ongoing`}),t(`loading`)]}),_!==null&&_.length===0&&/* @__PURE__ */ (0,i.jsxs)(`div`,{className:$.empty,children:[/* @__PURE__ */ (0,i.jsx)(r.IconSearchOutlineRegular,{size:22,className:$.emptyIcon}),t(`empty`)]}),_!==null&&_.length>0&&/* @__PURE__ */ (0,i.jsx)(`ul`,{className:$.list,children:_.map(e=>{let n=D[JSON.stringify([s,e.nativeSessionId])];return/* @__PURE__ */ (0,i.jsxs)(`li`,{className:$.row,children:[/* @__PURE__ */ (0,i.jsxs)(`div`,{className:$.rowText,children:[/* @__PURE__ */ (0,i.jsx)(`div`,{className:$.rowTitle,children:e.title??t(`untitled`)}),/* @__PURE__ */ (0,i.jsxs)(`div`,{className:$.rowMeta,children:[/* @__PURE__ */ (0,i.jsxs)(`span`,{className:$.metaItem,title:e.cwd,children:[/* @__PURE__ */ (0,i.jsx)(r.IconFolderCloseRegular,{size:13,className:$.metaIcon}),/* @__PURE__ */ (0,i.jsx)(`span`,{className:$.metaText,children:ne(e.cwd)})]}),/* @__PURE__ */ (0,i.jsxs)(`span`,{className:$.metaItem,children:[/* @__PURE__ */ (0,i.jsx)(r.IconClockOutlineRegular,{size:13,className:$.metaIcon}),Bf(e.updatedAt)]})]})]}),/* @__PURE__ */ (0,i.jsx)(r.Button,{variant:n?`outline`:`primary`,size:`sm`,className:$.action,disabled:T!==null,onClick:()=>void re(e),children:T===e.nativeSessionId?t(`importing`):t(n?`open`:`import`)})]},e.nativeSessionId)})}),s!==null&&/* @__PURE__ */ (0,i.jsxs)(`div`,{className:$.footer,children:[/* @__PURE__ */ (0,i.jsxs)(`label`,{className:$.pageSize,children:[t(`pageSize`),/* @__PURE__ */ (0,i.jsx)(`select`,{className:$.select,"aria-label":t(`pageSize`),value:p,disabled:T!==null,onChange:e=>{A(),m(Number(e.target.value))},children:[20,50,100].map(e=>/* @__PURE__ */ (0,i.jsx)(`option`,{value:e,children:e},e))})]}),/* @__PURE__ */ (0,i.jsxs)(`div`,{className:$.pager,children:[_!==null&&/* @__PURE__ */ (0,i.jsx)(`span`,{className:$.range,children:t(`range`,{start:String(y===0?0:d+1),end:String(d+_.length),total:String(y)})}),/* @__PURE__ */ (0,i.jsx)(r.Button,{variant:`outline`,size:`sm`,className:$.pageButton,"aria-label":t(`previous`),title:t(`previous`),disabled:T!==null||_===null||d===0,onClick:()=>{v(null),f(Math.max(0,d-p))},children:/* @__PURE__ */ (0,i.jsx)(r.IconChevronLeftOutlineRegular,{size:14})}),/* @__PURE__ */ (0,i.jsx)(r.Button,{variant:`outline`,size:`sm`,className:$.pageButton,"aria-label":t(`next`),title:t(`next`),disabled:T!==null||_===null||d+p>=y,onClick:()=>{v(null),f(d+p)},children:/* @__PURE__ */ (0,i.jsx)(r.IconChevronRightOutlineRegular,{size:14})})]})]})]})})}let Uf=`@deepseek-ai/dsh-client-ui-codexhost/HostSettingsSection.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Uf)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-codexhost`,e.dataset.pluginCss=Uf,e.textContent=`.B1PPLa_host{min-width:0;display:block}.B1PPLa_error{color:var(--dsw-alias-state-error-primary);padding:16px 0;font-size:13px;line-height:20px}`,document.head.appendChild(e)}var Wf={error:`B1PPLa_error`,host:`B1PPLa_host`};let Gf;function Kf(){return Gf??=new Promise((e,t)=>{let n=document.createElement(`script`);n.src=`codexhost-settings.js`,n.onload=()=>{let n=window.__codexhostWebSettingsV1;n?e(n):t(/* @__PURE__ */ Error(`codexhost-settings.js did not register its pages`))},n.onerror=()=>{t(/* @__PURE__ */ Error(`codexhost-settings.js could not be loaded`))},document.head.append(n)}).catch(e=>{throw Gf=void 0,e}),Gf}function qf({t:e,pageId:t,locale:n,colorScheme:r}){let a=(0,o.useRef)(null),[s,c]=(0,o.useState)(``),l=(0,o.useSyncExternalStore)(n.subscribe,n.get),u=(0,o.useSyncExternalStore)(r.subscribe,r.get);return(0,o.useEffect)(()=>{let e=!1,n;return c(``),Kf().then(r=>{!e&&a.current&&(n=r.mount(t,a.current,{locale:l,colorScheme:u}))}).catch(t=>{e||c(t instanceof Error?t.message:String(t))}),()=>{e=!0,n?.()}},[t,l,u]),/* @__PURE__ */ (0,i.jsxs)(i.Fragment,{children:[s&&/* @__PURE__ */ (0,i.jsx)(`div`,{className:Wf.error,children:e(`settings.unavailable`,{message:s})}),/* @__PURE__ */ (0,i.jsx)(`div`,{ref:a,className:Wf.host})]})}let Jf={"discovery.agents":`Delegation Agents`,"discovery.sessions":`Sessions`,"discovery.commands":`Native commands`,"discovery.skills":`Skills`,"discovery.offline":`Host disconnected`,"discovery.pending":`A command request is pending`,"discovery.busy":`Thread busy; direct commands cannot be queued`,"discovery.stale":`The selection expired. Open the menu and select again.`,"discovery.unconfirmed":`Command not confirmed. Check Thread progress before retrying; no automatic resend.`,"discovery.conflict":`Invocation conflicts with an interface command`,"discovery.static":`Static catalog: project commands and Skills load after the session starts.`,"discovery.empty":`No native commands advertised.`,"discovery.retry":`Retry native commands`,"discovery.failed":`Native command catalog unavailable:`,"settings.connectDevices":`Connect devices`,"settings.extensions":`Interface extensions`,"settings.connections":`Connections`,"settings.resources":`Resources`,"settings.accounts":`Accounts`,"settings.usage":`Usage`,"settings.updates":`Updates`,"settings.about":`About`,"settings.unavailable":`Could not load this page: {message}`,panel:`Import sessions`,"connection.reconnecting":`Connection interrupted; reconnecting…`,"connection.offline":`Network appears offline. Showing previously synced content.`,"connection.host":`Host unavailable; reconnecting…`,"connection.error":`Could not sync messages. Retry the connection.`,"connection.checking":`Checking the connection…`,"connection.computer":`Cannot reach your computer. Check that it is on and Web is running.`,"connection.lastSynced":`Last synced at {time}`,"connection.retry":`Retry`,"import.sourceBranch":`Independent branch created from Codex session {sessionId}. Both sessions continue separately.`,title:`Import sessions`,subtitle:`Continue a session you started in a Harness on this computer. Its history is loaded when you open it.`,search:`Search by title or folder`,import:`Import`,open:`Open`,importing:`Importing…`,empty:`No sessions found.`,loading:`Loading sessions…`,untitled:`Untitled session`,error:`Could not load sessions: {message}`,noSources:`No installed Harness can import sessions.`,sources:`Import from Harness`,refresh:`Refresh sessions`,pageSize:`Sessions per page`,previous:`Previous page`,next:`Next page`,range:`{start}–{end} of {total}`,importFailed:`Could not import this session: {message}`,openFailed:`Session imported, but could not open it. Retry Open; do not import again. {message}`,catalogPending:`The imported Thread is not yet available in the session list.`,"usage.title":`Usage`,"usage.details":`Usage details`,"usage.group.session":`Session`,"usage.group.turn":`Turn`,"usage.group.tokens":`Token`,"usage.group.plan":`Plan usage`,"usage.group.quota":`Account quota`,"usage.cache.short":`CH`,"usage.cache.latest":`Latest cache hit (CH)`,"usage.cache.average":`Average cache hit`,"usage.speed":`Output speed (TPS)`,"usage.speed.api":`Output speed (API)`,"usage.ttft":`First token (TTFT)`,"usage.cost":`Cost`,"usage.cost.estimate":`Cost estimate`,"usage.credits":`Credits used`,"usage.resetCredits":`Reset credits available`,"usage.context":`Context used`,"usage.tokens.io":`Input / output`,"usage.tokens.cacheRead":`Cache read`,"usage.tokens.cacheReadWrite":`Cache read / write`,"usage.tokens.total":`Total tokens`,"usage.plan.fiveHour":`5-hour limit`,"usage.plan.sevenDay":`7-day limit`,"usage.quota":`Quota used`,"usage.quota.remaining":`Remaining`,"usage.quota.details":`Quota details`,"usage.resets":`Resets`,"usage.dateLocale":`en-US`,"usage.reset.today":`{time} today`,"usage.reset.at":`Resets {time}`,"usage.unpriced":`Unpriced models`,"usage.unit.tokens":`tokens`,"usage.unit.credits":`credits`,"usage.unit.tps":`tok/s`,"usage.unit.ms":`ms`,"usage.unit.seconds":`s`,"connectDevices.title":`Connect this computer`,"connectDevices.subtitle":`Scan with your phone camera to continue in the browser.`,"connectDevices.recommended":`Recommended`,"connectDevices.httpsSummary":`Across networks · Tailscale required on your phone`,"connectDevices.lanSummary":`Connect on the same network, with no extra app`,"connectDevices.address":`Connection address`,"connectDevices.refresh":`Refresh status`,"connectDevices.otherMethods":`Other connection methods`,"connectDevices.preparing":`Preparing…`,"connectDevices.qrPending":`QR code not ready`,"connectDevices.scan":`Scan with your phone camera`,"connectDevices.enableQr":`Enable and show QR code`,"connectDevices.enableImpact":`Enables HTTP access on this computer’s network interfaces. Web briefly restarts and terminals disconnect; running tasks continue.`,"connectDevices.httpsSetup":`Tailscale is ready. Enable HTTPS access to show your QR code.`,"connectDevices.httpsPersistence":`HTTPS forwarding stays enabled after Web exits. You can stop it below.`,"connectDevices.refreshHint":`Refresh to check the available address.`,"connectDevices.openTailscale":`Open Tailscale settings`,"connectDevices.noAddress":`No address is available for this network. Check the computer’s connection, then refresh.`,"connectDevices.help":`Having trouble connecting?`,"connectDevices.keepAwake":`Keep this computer awake and Web running. For Wi-Fi, both devices need to be on the same network.`,"connectDevices.accessEnabled":`Device access enabled`,"connectDevices.localAccess":`Local access only`,"connectDevices.tokenTitle":`Access token`,"connectDevices.stopTitleShort":`Stop device access`,"connectDevices.stopHint":`Turns off the relay, IP access and HTTPS forwarding enabled here. Running tasks continue.`,"connectDevices.stop":`Stop access…`,"connectDevices.stopTitle":`Stop device access?`,"connectDevices.stopConfirm":`Stop access`,"connectDevices.stopDescription":`Turns off the relay, IP access and Tailscale HTTPS enabled here. Devices and Web terminals connected through them disconnect; running tasks continue. You can enable access again at any time.`,"connectDevices.stopUnmanaged":`Your external proxy or foreground listener is managed separately and may still allow access.`,"connectDevices.stopIncomplete":`Some HTTPS forwarding is still active. Refresh and try stopping access again.`,"connectDevices.restartTimeout":`Web has not reconnected yet. Check that it is running, then refresh status.`,"connectDevices.localOnly":`The QR code and access token are only available on the computer. Open {url} there to get them.`,"connectDevices.disabled":`Authentication is not enabled, so no access token is needed.`,"connectDevices.autostart":`Start automatically after login`,"connectDevices.restarting":`Restarting Web… Waiting for this page to reconnect.`,"connectDevices.loading":`Loading…`,"connectDevices.loadFailed":`Could not load this page: {message}`,"connectDevices.actionFailed":`That did not work: {message}`,"connectDevices.connectVia":`Connect through`,"connectDevices.enlargeQr":`Enlarge QR code`,"connectDevices.qrLabel":`Sign-in QR code`,"connectDevices.relay.inUse":`In use`,"connectDevices.relay.closeFirst":`Turn off the active relay before switching or changing its control address.`,"connectDevices.selfRelay.title":`Self-hosted relay`,"connectDevices.selfRelay.summary":`Your server and domain · No phone app needed`,"connectDevices.selfRelay.off":`Use your own relay server. Like the official relay, it only forwards encrypted traffic.`,"connectDevices.selfRelay.address":`Relay server address: {host}`,"connectDevices.selfRelay.previewTitle":`After enabling, your phone will reach this computer at:`,"connectDevices.selfRelay.previewAutoName":`computer ID`,"connectDevices.selfRelay.name":`Device name`,"connectDevices.selfRelay.host":`Relay domain`,"connectDevices.selfRelay.hostHint":`The domain you deployed the relay on, without https:// or relay.`,"connectDevices.selfRelay.nameHint":`A name for this computer: lowercase letters, digits and hyphens. It becomes the start of the phone address. Leave empty to use a computer ID.`,"connectDevices.selfRelay.invalidHost":`Enter your relay's base domain, such as example.com, without https:// or a port.`,"connectDevices.selfRelay.invalidName":`Use 1–63 lowercase letters, digits or interior hyphens; the relay server address is reserved.`,"connectDevices.selfRelay.helpTitle":`How to set up your own relay`,"connectDevices.selfRelay.domain":`You need a domain and a Linux server with Docker (servers in mainland China require domain ICP filing with the cloud provider first).`,"connectDevices.selfRelay.dns":`In your domain's DNS settings, add a record: type A, name *, value your server's public IPv4 address. On Cloudflare, choose DNS only.`,"connectDevices.selfRelay.ports":`Open TCP port 443.`,"connectDevices.selfRelay.docker":`Run on the server:`,"connectDevices.selfRelay.replaceDomain":`# Replace example.com with your actual domain`,"connectDevices.selfRelay.connect":`Come back here, enter your relay domain and a device name (e.g. example.com and mycomputer) and click Enable relay.`,"connectDevices.selfRelay.noDomain":`No domain? Use the official relay or Tailscale.`,"connectDevices.selfRelay.docs":`Full self-hosted relay guide`,"connectDevices.relay.title":`codexhost Relay`,"connectDevices.relay.summary":`Any network · No app needed on your phone`,"connectDevices.relay.hint":`Connect across networks without an extra phone app. An access token is required.`,"connectDevices.relay.off":`The official codexhost relay. It only forwards encrypted traffic.`,"connectDevices.relay.name":`Address name (optional)`,"connectDevices.relay.nameHint":`4–20 lowercase letters or digits. Leave blank to let the relay assign a name.`,"connectDevices.relay.inviteLabel":`Invitation code`,"connectDevices.relay.invite":`Invitation code is invalid or has already been used`,"connectDevices.relay.name-taken":`This name is already taken. Choose another one.`,"connectDevices.relay.banned":`This computer has been disabled on this relay`,"connectDevices.relay.full":`The relay is full. Retrying automatically.`,"connectDevices.relay.connectionFailed":`Cannot connect to the relay. Check its server, DNS and certificate. Retrying automatically.`,"connectDevices.relay.quota":`Today's traffic allowance is used up`,"connectDevices.relay.quotaUntil":`Available again at {date}`,"connectDevices.relay.enable":`Enable relay`,"connectDevices.relay.disable":`Turn off relay`,"connectDevices.relay.preparing":`Preparing… This usually takes under a minute.`,"connectDevices.relay.unavailable":`Temporarily unavailable. Retrying automatically at {date}.`,"connectDevices.relay.paused":`Needs attention. Fix the issue below, then turn the relay off and enable it again.`,"connectDevices.relay.unreachable":`The certificate authority could not be reached.`,"connectDevices.relay.replaced":`Stopped: another computer is using this identity. Turn the relay off and enable it again after resolving the conflict.`,"connectDevices.relay.rejected":`Stopped: the relay rejected this computer.`,"connectDevices.relay.unsupported-version":`Stopped: this protocol version is unsupported. Update codexhost.`,"connectDevices.kindPublic":`Public address`,"connectDevices.kindPublicHint":`Your configured public address. An access token is still required.`,"connectDevices.kindFunnel":`Tailscale Funnel · Public`,"connectDevices.kindFunnelHint":`Anyone on the Internet can reach the sign-in page. An access token is still required.`,"connectDevices.tailscale.not-installed":`Install and sign in to Tailscale on this computer and your phone, then refresh.`,"connectDevices.tailscale.not-running":`Tailscale is not running. Start Tailscale on this computer.`,"connectDevices.tailscale.not-logged-in":`Sign in to Tailscale on this computer first.`,"connectDevices.tailscale.https-disabled":`Enable HTTPS certificates in the Tailscale admin console first.`,"connectDevices.tailscale.occupied":`HTTPS is already used by another service. Manage that forwarding in Tailscale first. Current target:`,"connectDevices.tailscale.error":`Could not read Tailscale status:`,"connectDevices.kindTailscale":`Tailscale`,"connectDevices.tailscaleViaHttps":`HTTPS`,"connectDevices.tailscaleViaIp":`IP`,"connectDevices.kindLan":`Same Wi-Fi`,"connectDevices.kindVirtual":`Virtual network`,"connectDevices.kindVirtualHint":`Usually reachable only from virtual machines on this computer.`,"connectDevices.remote.tailscale":`Install and sign in on both your phone and this computer to put them on a private network. They can then connect from anywhere without exposing Web to the Internet. Your phone needs Tailscale on, and this page shows the next step after you install it.`,"connectDevices.remote.tailscaleLink":`Download Tailscale`,"connectDevices.remote.tunnelTitle":`Your own tunnel or proxy`,"connectDevices.remote.tunnel":`If you already use frp, Cloudflare Tunnel, or nginx, forward it to Web on this computer and keep the original Host. For an installed release, run codexhost web --public-url <address>; from source, run npm start web -- --public-url <address>. The QR code will use that address.`,"connectDevices.remote.tunnelLink":`View setup guide`,"connectDevices.copyLink":`Copy link`,"connectDevices.copyToken":`Copy token`,"connectDevices.copied":`Copied`,"connectDevices.copyFailed":`Copy failed`,"connectDevices.neverUsed":`No device has signed in yet`,"connectDevices.lastUsed":`Last used {time}`,"connectDevices.relative.now":`just now`,"connectDevices.relative.minutes":`{n} min ago`,"connectDevices.relative.hours":`{n} hr ago`,"connectDevices.relative.days":`{n} d ago`,"connectDevices.relative.months":`{n} mo ago`,"connectDevices.relative.years":`{n} yr ago`,"connectDevices.regenerate":`Regenerate…`,"connectDevices.regenerateTitle":`Regenerate the access token?`,"connectDevices.regenerateDescription":`Every other device is signed out immediately and has to scan the new QR code. Running tasks are not affected.`,"connectDevices.regenerateConfirm":`Regenerate`,"connectDevices.signOut":`Sign out…`,"connectDevices.signOutTitle":`Sign out of this device?`,"connectDevices.signOutDescription":`Signing back in needs the access token, which can only be copied on the computer. Other devices stay signed in.`,"connectDevices.signOutConfirm":`Sign out`,"connectDevices.cancel":`Cancel`,"connectDevices.close":`Close`,"connectDevices.localListener":`This foreground Web cannot change its IP listener here. Use Tailscale HTTPS, or see the setup guide.`,"extensions.description":`Add DSH themes and panels to Web. Extensions are shared by everyone connected to this Web service. After installing, enable the extension here.`,"extensions.localOnly":`Extensions can only be managed on the computer running Web. Open {url} on that computer to manage them.`,"extensions.loading":`Loading extensions…`,"extensions.loadFailed":`Could not load extensions: {message}`,"extensions.actionFailed":`That did not work: {message}`,"extensions.add":`Add extension`,"extensions.installed":`Installed`,"extensions.info":`About interface extensions`,"extensions.project":`Project website`,"extensions.metadataError":`Plugin metadata: {message}`,"extensions.close":`Close`,"extensions.sourceLabel":`Package name or address`,"extensions.sourcePlaceholder":`npm package name, GitHub URL or local directory`,"extensions.sourceHint":`Enter the extension's package name, GitHub repository address or local directory path.`,"extensions.scope":`Supports prebuilt DSH themes, sidebar panels and display components. Extensions requiring backend services or a build step are not supported. After installing, enable the extension in the list.`,"extensions.guide":`Installation guide and examples`,"extensions.guideNpm":`npm package name; a version is optional. Format examples:`,"extensions.guideGitHub":`Public GitHub repository; replace this example with the actual address:`,"extensions.guideDirectory":`Absolute directory or archive path on the computer running Web. Format examples:`,"extensions.registry":`Installation source`,"extensions.registryOfficial":`Official npm registry`,"extensions.registryMirror":`China mainland mirror`,"extensions.registryCustom":`Custom registry`,"extensions.registryCustomUrl":`Custom registry URL`,"extensions.registryInvalid":`Enter an HTTP(S) registry URL without a username, password, query or fragment.`,"extensions.registryHint":`The registry downloads npm packages and dependencies. GitHub addresses connect to GitHub directly. Private registry authentication uses the Web computer's npm configuration.`,"extensions.install":`Install`,"extensions.installing":`Installing…`,"extensions.restart":`Extensions update live without restarting Web or its terminals. Homepage-only injections require a page refresh. Server loading does not confirm that every page has applied the extension.`,"extensions.safeMode":`Web started with built-in extensions only. Your saved choices are kept.`,"extensions.storeError":`Could not read saved extensions: {message}`,"extensions.empty":`No interface extensions installed.`,"extensions.enabled":`Enabled for Web`,"extensions.disabled":`Disabled`,"extensions.source":`Source: {source}`,"extensions.pendingRestart":`The saved selection is not loaded on the server.`,"extensions.includedAtStartup":`Loaded on the server; connected ordinary pages synchronize automatically.`,"extensions.extensionError":`Could not prepare this extension: {message}`,"extensions.enable":`Enable`,"extensions.disable":`Disable`,"extensions.remove":`Uninstall`,"extensions.confirmRemove":`Uninstall “{name}”? Its running instance will stop before the installation files are removed.`,"extensions.cancel":`Cancel`,"extensions.refresh":`Refresh list`,"extensions.retry":`Retry`,"extensions.recovery":`Open recovery page`,"extensions.builtinsOnly":`Open with built-in extensions only`,"notifications.title":`Notifications`,"notifications.on":`This device is notified when a turn finishes or an agent needs your approval or answer.`,"notifications.off":`Get notified on this device when a turn finishes or an agent needs you.`,"notifications.denied":`Notifications are blocked for this site in your browser settings.`,"notifications.unsupported":`This browser does not support push notifications.`,"notifications.needs-install":`On iPhone and iPad, add CodexHost to the Home Screen (Share → Add to Home Screen), then enable notifications there.`,"notifications.enable":`Enable`,"notifications.disable":`Turn off`,"notifications.test":`Send test`,"desktop.label":`Desktop screenshot`,"desktop.primary":`Connected computer · Main display`,"desktop.refresh":`Take another screenshot`,"desktop.landscape":`Landscape`,"desktop.portrait":`Portrait`,"desktop.flip":`Flip`,"desktop.annotate":`Mark up`,"desktop.annotate.cancel":`Cancel`,"desktop.annotate.done":`Done`,"desktop.annotate.undo":`Undo`,"desktop.annotate.clear":`Clear`,"desktop.annotate.reset":`Restore original`,"desktop.annotate.failed":`Could not prepare the image. Try again.`,"desktop.tool.pen":`Pen`,"desktop.tool.rect":`Box`,"desktop.tool.arrow":`Arrow`,"desktop.crop":`Crop`,"desktop.crop.hint":`Drag the box or its corners to choose what to keep`,"desktop.send":`Send`,"desktop.message.placeholder":`Add a line, then send…`,"desktop.hint":`Pinch to zoom · tap to hide buttons`,"desktop.save":`Save`,"desktop.save.failed":`Could not save the image.`,"desktop.zoom.fit":`Fit`,"desktop.attach":`Add to conversation`,"desktop.attach.blocked":`The draft cannot take attachments right now.`,"desktop.close":`Close desktop screenshot`,"desktop.enlarge":`Enlarge desktop screenshot`,"desktop.pending":`Capturing the desktop…`,"desktop.transferring":`Receiving screenshot… {loaded} / {total}`,"desktop.transferring.unknown":`Receiving screenshot… {loaded}`,"desktop.captured":`Captured: {time}`,"desktop.error.unsupported":`Desktop screenshots support Windows and macOS computers only.`,"desktop.error.permission-denied":`We requested permission and tried to open Screen Recording settings on the Mac running Web, not this phone. Allow the actual program listed by macOS (such as CodexHost, Node, or your terminal), then take another screenshot manually. Restart that program if macOS asks. If settings did not open, go to System Settings → Privacy & Security → Screen Recording (or Screen & System Audio Recording).`,"desktop.error.display-unavailable":`The computer's main desktop is unavailable. Log in and unlock the computer, check its main display, and wait for any Windows UAC secure desktop prompt to close. Windows normally has no separate screenshot permission switch; do not disable UAC.`,"desktop.error.capture-failed":`Could not capture the desktop. Try again manually.`,"desktop.error.image-too-large":`The desktop image exceeds the supported size.`,"desktop.error.busy":`A screenshot is already being captured. Try again shortly.`,"desktop.error.timeout":`Desktop capture timed out. Check the computer before trying again.`,"desktop.error.unavailable":`Screenshot service unavailable. Check your connection and native launcher version.`,"voice.label":`Voice input`,"voice.permission":`Waiting for microphone permission…`,"voice.stop":`Stop and insert into draft`,"voice.send":`Transcribe and send`,"voice.done":`Done`,"voice.transcribing":`Transcribing…`,"voice.slow":`Still transcribing…`,"voice.silent":`No sound detected`,"voice.retry":`Retry transcription`,"voice.rerecord":`Record again`,"voice.tryAgain":`Try again`,"voice.undo":`Undo`,"voice.cancelled":`Discarded the {time} recording.`,"voice.unplaced":`The draft changed while transcribing, so the text was not inserted automatically.`,"voice.insert":`Insert at cursor`,"voice.copy":`Copy`,"voice.cancel":`Cancel recording`,"voice.discard":`Discard`,"voice.error.browser-unsupported":`This page cannot record audio. Open it over HTTPS or localhost.`,"voice.error.permission-denied":`Microphone access is blocked. Allow the microphone in the site settings next to the address bar, then try again.`,"voice.error.no-microphone":`No microphone found. Check the system input device.`,"voice.error.record-failed":`Could not access the microphone. Check the browser and the input device.`,"voice.error.credentials-unavailable":`No usable Codex ChatGPT login was found.`,"voice.error.login-expired":`The Codex login has expired. Use Codex once to refresh it; the recording is kept.`,"voice.error.rate-limited":`The voice service is rate limited. Try again later; the recording is kept.`,"voice.error.service-rejected":`The voice service rejected the request. The recording is kept.`,"voice.error.host-incompatible":`The current Host does not support voice transcription. Update and restart the Host.`,"voice.error.network":`Transcription failed: the network request failed. The recording is kept; no need to speak again.`,"voice.error.timeout":`Transcription timed out. The recording is kept; no need to speak again.`,"voice.error.audio-empty":`No speech was recognized.`,"voice.error.audio-too-large":`The recording exceeds the 10 MiB limit.`,"voice.error.audio-format":`The audio format is not accepted.`,"voice.error.audio-invalid":`The recording is unavailable.`},Yf={"discovery.agents":`委派 Agent`,"discovery.sessions":`会话`,"discovery.commands":`原生命令`,"discovery.skills":`Skills`,"discovery.offline":`Host 已断线`,"discovery.pending":`命令请求正在提交`,"discovery.busy":`会话正忙,直接命令不能排队`,"discovery.stale":`选择已失效,请重新打开菜单选择。`,"discovery.unconfirmed":`命令结果未确认,请先检查会话进度再决定是否重试;不会自动重发。`,"discovery.conflict":`调用名与界面命令冲突`,"discovery.static":`静态目录:项目命令和 Skills 在会话启动后加载。`,"discovery.empty":`未提供原生命令。`,"discovery.retry":`重试原生命令目录`,"discovery.failed":`原生命令目录不可用:`,"settings.connectDevices":`连接设备`,"settings.extensions":`界面扩展`,"settings.connections":`连接`,"settings.resources":`资源管理`,"settings.accounts":`账号`,"settings.usage":`用量统计`,"settings.updates":`更新`,"settings.about":`关于`,"settings.unavailable":`无法加载此页面:{message}`,panel:`导入会话`,"connection.reconnecting":`连接已中断,正在重连…`,"connection.offline":`网络可能已断开,当前显示上次同步内容。`,"connection.host":`Host 暂不可用,正在重连…`,"connection.error":`消息同步失败,请重试连接。`,"connection.checking":`正在检查连接…`,"connection.computer":`无法连接到电脑,请确认电脑已开机且 Web 正在运行。`,"connection.lastSynced":`上次同步于 {time}`,"connection.retry":`重试`,"import.sourceBranch":`从 Codex 会话 {sessionId} 创建的独立分支,两边分别继续。`,title:`导入会话`,subtitle:`继续你在这台电脑上用 Harness 开过的会话,打开时会加载完整历史。`,search:`按标题或文件夹搜索`,import:`导入`,open:`打开`,importing:`正在导入…`,empty:`没有找到会话。`,loading:`正在加载会话…`,untitled:`未命名会话`,error:`无法加载会话:{message}`,noSources:`没有已安装的 Harness 支持导入会话。`,sources:`导入来源 Harness`,refresh:`刷新会话`,pageSize:`每页会话数`,previous:`上一页`,next:`下一页`,range:`第 {start}–{end} 个,共 {total} 个`,importFailed:`无法导入该会话:{message}`,openFailed:`会话已导入,但无法打开。请重试“打开”,无需再次导入。{message}`,catalogPending:`已导入的 Thread 暂未出现在会话列表中。`,"usage.title":`用量`,"usage.details":`用量详情`,"usage.group.session":`会话`,"usage.group.turn":`本轮`,"usage.group.tokens":`Token`,"usage.group.plan":`套餐用量`,"usage.group.quota":`账号配额`,"usage.cache.short":`CH`,"usage.cache.latest":`最近缓存命中(CH)`,"usage.cache.average":`平均缓存命中`,"usage.speed":`输出速度(TPS)`,"usage.speed.api":`输出速度(API)`,"usage.ttft":`首 token(TTFT)`,"usage.cost":`费用`,"usage.cost.estimate":`费用估算`,"usage.credits":`已用 Credits`,"usage.resetCredits":`可用重置次数`,"usage.context":`上下文占用`,"usage.tokens.io":`输入 / 输出`,"usage.tokens.cacheRead":`缓存读取`,"usage.tokens.cacheReadWrite":`缓存读取 / 写入`,"usage.tokens.total":`总数`,"usage.plan.fiveHour":`5 小时额度`,"usage.plan.sevenDay":`7 天额度`,"usage.quota":`配额占用`,"usage.quota.remaining":`剩余`,"usage.quota.details":`额度详情`,"usage.resets":`重置时间`,"usage.dateLocale":`zh-CN`,"usage.reset.today":`今天 {time}`,"usage.reset.at":`{time} 重置`,"usage.unpriced":`未定价模型`,"usage.unit.tokens":`Token`,"usage.unit.credits":`Credits`,"usage.unit.tps":`tok/s`,"usage.unit.ms":`毫秒`,"usage.unit.seconds":`秒`,"connectDevices.title":`连接这台电脑`,"connectDevices.subtitle":`用手机相机扫码,在浏览器中继续使用。`,"connectDevices.recommended":`推荐`,"connectDevices.httpsSummary":`跨网络访问 · 手机需开启 Tailscale`,"connectDevices.lanSummary":`使用局域网地址连接,无需额外安装`,"connectDevices.address":`连接地址`,"connectDevices.refresh":`刷新状态`,"connectDevices.otherMethods":`其他连接方式`,"connectDevices.preparing":`正在准备…`,"connectDevices.qrPending":`二维码尚未就绪`,"connectDevices.scan":`用手机相机扫码`,"connectDevices.enableQr":`启用并显示二维码`,"connectDevices.enableImpact":`将允许通过这台电脑的网卡进行 HTTP 访问。Web 会短暂重启,Web 终端会断开,运行中的任务继续。`,"connectDevices.httpsSetup":`Tailscale 已就绪,启用 HTTPS 访问后即可扫码。`,"connectDevices.httpsPersistence":`HTTPS 转发在 Web 退出后仍保留,可在下方停止。`,"connectDevices.refreshHint":`刷新以检查可用地址。`,"connectDevices.openTailscale":`打开 Tailscale 设置`,"connectDevices.noAddress":`未找到此网络的可用地址,请检查电脑网络后刷新。`,"connectDevices.help":`连接遇到问题?`,"connectDevices.keepAwake":`请保持电脑唤醒且 Web 正在运行。使用 Wi-Fi 连接时,两台设备需处于同一局域网。`,"connectDevices.accessEnabled":`设备访问已启用`,"connectDevices.localAccess":`仅本机访问`,"connectDevices.tokenTitle":`访问令牌`,"connectDevices.stopTitleShort":`停止设备访问`,"connectDevices.stopHint":`关闭此页面开启的中转、IP 访问和 HTTPS 转发,运行中的任务继续。`,"connectDevices.stop":`停止访问…`,"connectDevices.stopTitle":`停止设备访问?`,"connectDevices.stopConfirm":`停止访问`,"connectDevices.stopDescription":`关闭此页面开启的中转、IP 访问和 Tailscale HTTPS。通过这些方式连接的设备和 Web 终端会断开,运行中的任务继续。之后可随时重新启用。`,"connectDevices.stopUnmanaged":`你配置的外部代理或前台监听需单独管理,它们可能仍允许访问。`,"connectDevices.stopIncomplete":`仍有 HTTPS 转发生效,请刷新后再次停止访问。`,"connectDevices.restartTimeout":`Web 尚未恢复连接,请确认它正在运行后刷新状态。`,"connectDevices.localOnly":`二维码和访问令牌只能在电脑上获取。请在电脑上打开 {url}。`,"connectDevices.disabled":`认证未启用,不需要访问令牌。`,"connectDevices.autostart":`登录后自动启动`,"connectDevices.restarting":`正在重启 Web… 等待页面恢复连接。`,"connectDevices.loading":`正在加载…`,"connectDevices.loadFailed":`无法加载此页面:{message}`,"connectDevices.actionFailed":`操作失败:{message}`,"connectDevices.connectVia":`连接方式`,"connectDevices.enlargeQr":`放大二维码`,"connectDevices.qrLabel":`登录二维码`,"connectDevices.relay.inUse":`当前使用`,"connectDevices.relay.closeFirst":`请先关闭当前中转,再切换中转或修改控制地址。`,"connectDevices.selfRelay.title":`自建中转`,"connectDevices.selfRelay.summary":`自己的服务器和域名 · 手机无需安装应用`,"connectDevices.selfRelay.off":`通过自己的服务器中转,和官方中转一样只转发加密内容。`,"connectDevices.selfRelay.address":`中转服务器地址:{host}`,"connectDevices.selfRelay.previewTitle":`启用后,手机将通过下面的地址访问这台电脑:`,"connectDevices.selfRelay.previewAutoName":`电脑 ID`,"connectDevices.selfRelay.name":`设备名称`,"connectDevices.selfRelay.host":`中转域名`,"connectDevices.selfRelay.hostHint":`你部署中转时使用的域名,不带 https:// 和 relay.`,"connectDevices.selfRelay.nameHint":`给这台电脑起的名字,只能用小写字母、数字和连字符,会成为手机访问地址的开头。留空则使用电脑 ID。`,"connectDevices.selfRelay.invalidHost":`请输入自建中转的基础域名,例如 example.com,不带 https:// 或端口。`,"connectDevices.selfRelay.invalidName":`名称须为 1–63 位小写字母、数字或中间的连字符,不能占用中转服务器地址。`,"connectDevices.selfRelay.helpTitle":`如何搭建自己的中转`,"connectDevices.selfRelay.domain":`准备一个域名,以及一台装有 Docker 的 Linux 服务器(中国大陆服务器需先完成域名备案)。`,"connectDevices.selfRelay.dns":`在域名的 DNS 设置里添加一条记录:类型选 A,名称填 *,值填服务器的公网 IPv4 地址。使用 Cloudflare 时选择“仅 DNS”。`,"connectDevices.selfRelay.ports":`放行 TCP 443 端口。`,"connectDevices.selfRelay.docker":`在服务器上运行以下命令:`,"connectDevices.selfRelay.replaceDomain":`# 将 example.com 替换为你的实际域名`,"connectDevices.selfRelay.connect":`回到这里填写中转域名和设备名称(例如 example.com 和 mycomputer),点击“启用中转”。`,"connectDevices.selfRelay.noDomain":`没有域名?可以使用官方中转或 Tailscale。`,"connectDevices.selfRelay.docs":`完整自建中转教程`,"connectDevices.relay.title":`codexhost 中转`,"connectDevices.relay.summary":`任何网络 · 手机无需安装应用`,"connectDevices.relay.hint":`跨网络连接,手机无需额外安装应用,登录需要访问令牌。`,"connectDevices.relay.off":`codexhost 官方中转,只转发加密内容。`,"connectDevices.relay.name":`地址名(可选)`,"connectDevices.relay.nameHint":`4–20 位小写字母和数字,留空由中转分配。`,"connectDevices.relay.inviteLabel":`邀请码`,"connectDevices.relay.invite":`邀请码无效或已被使用`,"connectDevices.relay.name-taken":`这个名字已被占用,请换一个`,"connectDevices.relay.banned":`此电脑已被停止使用该中转`,"connectDevices.relay.full":`中转已满,正在自动重试`,"connectDevices.relay.connectionFailed":`无法连接中转,请检查服务器、DNS 和证书。正在自动重试。`,"connectDevices.relay.quota":`今日流量已用完`,"connectDevices.relay.quotaUntil":`将于 {date} 恢复`,"connectDevices.relay.enable":`启用中转`,"connectDevices.relay.disable":`关闭中转`,"connectDevices.relay.preparing":`准备中…通常一分钟内完成。`,"connectDevices.relay.unavailable":`暂时无法使用,将于 {date} 自动重试。`,"connectDevices.relay.paused":`需要处理:请按下面的说明修复,然后关闭中转再重新启用。`,"connectDevices.relay.unreachable":`无法连接证书机构。`,"connectDevices.relay.replaced":`已停止:另一台电脑正在使用此身份。解决冲突后关闭中转再重新启用。`,"connectDevices.relay.rejected":`已停止:中转拒绝了这台电脑。`,"connectDevices.relay.unsupported-version":`已停止:协议版本不受支持,请更新 codexhost。`,"connectDevices.kindPublic":`公开地址`,"connectDevices.kindPublicHint":`你配置的公开地址,登录仍需要访问令牌。`,"connectDevices.kindFunnel":`Tailscale Funnel · 公开`,"connectDevices.kindFunnelHint":`互联网中的任何人都能访问登录页,登录仍需要访问令牌。`,"connectDevices.tailscale.not-installed":`请在这台电脑和手机上安装并登录 Tailscale,然后刷新状态。`,"connectDevices.tailscale.not-running":`Tailscale 未运行,请先在这台电脑上启动 Tailscale。`,"connectDevices.tailscale.not-logged-in":`请先在这台电脑上登录 Tailscale。`,"connectDevices.tailscale.https-disabled":`请先在 Tailscale 管理后台开启 HTTPS 证书。`,"connectDevices.tailscale.occupied":`HTTPS 已被其他服务使用,请先在 Tailscale 中调整转发。当前目标:`,"connectDevices.tailscale.error":`无法读取 Tailscale 状态:`,"connectDevices.kindTailscale":`Tailscale`,"connectDevices.tailscaleViaHttps":`HTTPS`,"connectDevices.tailscaleViaIp":`IP`,"connectDevices.kindLan":`同一 Wi-Fi`,"connectDevices.kindVirtual":`虚拟网络`,"connectDevices.kindVirtualHint":`通常只有这台电脑上的虚拟机能访问。`,"connectDevices.remote.tailscale":`在手机和这台电脑上安装并登录后,两者会组成一个私有网络,在任何地方都能连接,Web 也不会暴露到公网。手机需开着 Tailscale,安装后本页会提示下一步。`,"connectDevices.remote.tailscaleLink":`下载 Tailscale`,"connectDevices.remote.tunnelTitle":`自备隧道或代理`,"connectDevices.remote.tunnel":`如果你已在用 frp、Cloudflare Tunnel 或 nginx,把它转发到这台电脑上的 Web,并保留原始 Host。发行版运行 codexhost web --public-url <地址>;源码版运行 npm start web -- --public-url <地址>,二维码就会使用该地址。`,"connectDevices.remote.tunnelLink":`查看配置文档`,"connectDevices.copyLink":`复制链接`,"connectDevices.copyToken":`复制令牌`,"connectDevices.copied":`已复制`,"connectDevices.copyFailed":`复制失败`,"connectDevices.neverUsed":`还没有设备登录`,"connectDevices.lastUsed":`最近使用 {time}`,"connectDevices.relative.now":`刚刚`,"connectDevices.relative.minutes":`{n} 分钟前`,"connectDevices.relative.hours":`{n} 小时前`,"connectDevices.relative.days":`{n} 天前`,"connectDevices.relative.months":`{n} 个月前`,"connectDevices.relative.years":`{n} 年前`,"connectDevices.regenerate":`重新生成…`,"connectDevices.regenerateTitle":`重新生成访问令牌?`,"connectDevices.regenerateDescription":`其他设备会立即退出登录,需要重新扫码。运行中的任务不受影响。`,"connectDevices.regenerateConfirm":`重新生成`,"connectDevices.signOut":`退出登录…`,"connectDevices.signOutTitle":`退出这台设备的登录?`,"connectDevices.signOutDescription":`重新登录需要访问令牌,令牌只能在电脑上复制。其他设备不受影响。`,"connectDevices.signOutConfirm":`退出登录`,"connectDevices.cancel":`取消`,"connectDevices.close":`关闭`,"connectDevices.localListener":`当前前台 Web 无法在此更改 IP 监听。你可以使用 Tailscale HTTPS,或查看配置文档。`,"extensions.description":`为 Web 添加 DSH 主题和面板。扩展对连接此 Web 服务的所有页面生效,安装后可在这里启用。`,"extensions.localOnly":`界面扩展只能在运行 Web 的电脑上管理。请在该电脑上打开 {url}。`,"extensions.loading":`正在加载界面扩展…`,"extensions.loadFailed":`无法加载界面扩展:{message}`,"extensions.actionFailed":`操作失败:{message}`,"extensions.add":`添加扩展`,"extensions.installed":`已安装`,"extensions.info":`界面扩展说明`,"extensions.project":`项目地址`,"extensions.metadataError":`插件信息读取失败:{message}`,"extensions.close":`关闭`,"extensions.sourceLabel":`包名或地址`,"extensions.sourcePlaceholder":`npm 包名、GitHub 地址或本地目录`,"extensions.sourceHint":`输入扩展的包名、GitHub 仓库地址或本地目录路径。`,"extensions.scope":`支持已构建的 DSH 主题、侧栏面板和展示组件。暂不支持需要后台服务或构建步骤的扩展。安装完成后,可在列表中启用。`,"extensions.guide":`安装引导和示例`,"extensions.guideNpm":`npm 包名,无需指定版本。格式示例:`,"extensions.guideGitHub":`公开 GitHub 仓库,请将示例替换为实际地址:`,"extensions.guideDirectory":`运行 Web 的电脑上的目录或安装包绝对路径。格式示例:`,"extensions.registry":`安装源`,"extensions.registryOfficial":`npm 官方源`,"extensions.registryMirror":`中国大陆镜像源`,"extensions.registryCustom":`自定义安装源`,"extensions.registryCustomUrl":`自定义安装源地址`,"extensions.registryInvalid":`请输入 HTTP(S) 安装源地址,不要包含用户名、密码、查询参数或片段。`,"extensions.registryHint":`安装源用于下载 npm 包和依赖;GitHub 地址仍直接连接 GitHub。私有源认证沿用运行 Web 的电脑上的 npm 配置。`,"extensions.install":`安装`,"extensions.installing":`正在安装…`,"extensions.restart":`扩展启停实时生效,不重启 Web 或终端。仅首页初始化的注入需要刷新页面。服务端已加载不代表每个页面都已应用成功。`,"extensions.safeMode":`Web 本次仅加载内置扩展,已保存的启用选择仍会保留。`,"extensions.storeError":`无法读取已保存的扩展:{message}`,"extensions.empty":`还没有安装界面扩展。`,"extensions.enabled":`已启用 Web`,"extensions.disabled":`已禁用`,"extensions.source":`来源:{source}`,"extensions.pendingRestart":`已保存选择,服务端尚未加载。`,"extensions.includedAtStartup":`服务端已加载,已连接的普通页面自动同步。`,"extensions.extensionError":`此扩展暂不可加载:{message}`,"extensions.enable":`启用`,"extensions.disable":`禁用`,"extensions.remove":`卸载`,"extensions.confirmRemove":`卸载“{name}”?先停止运行实例,再删除安装文件。`,"extensions.cancel":`取消`,"extensions.refresh":`刷新列表`,"extensions.retry":`重试`,"extensions.recovery":`打开恢复页面`,"extensions.builtinsOnly":`仅使用内置扩展打开`,"notifications.title":`通知`,"notifications.on":`一轮结束、需要审批或回答问题时,会通知这台设备。`,"notifications.off":`一轮结束或 Agent 需要你时,在这台设备上收到通知。`,"notifications.denied":`浏览器设置中已阻止此网站的通知。`,"notifications.unsupported":`此浏览器不支持推送通知。`,"notifications.needs-install":`在 iPhone / iPad 上,请先把 CodexHost 添加到主屏幕(分享 → 添加到主屏幕),再在那里开启通知。`,"notifications.enable":`开启`,"notifications.disable":`关闭`,"notifications.test":`发送测试`,"desktop.label":`桌面截图`,"desktop.primary":`当前连接的电脑 · 主屏`,"desktop.refresh":`重新截图`,"desktop.landscape":`横屏`,"desktop.portrait":`竖屏`,"desktop.flip":`翻转`,"desktop.annotate":`标注`,"desktop.annotate.cancel":`取消`,"desktop.annotate.done":`完成`,"desktop.annotate.undo":`撤销`,"desktop.annotate.clear":`清除`,"desktop.annotate.reset":`还原原图`,"desktop.annotate.failed":`图片处理失败,请重试。`,"desktop.tool.pen":`画笔`,"desktop.tool.rect":`方框`,"desktop.tool.arrow":`箭头`,"desktop.crop":`裁剪`,"desktop.crop.hint":`拖动选框或四角,选择要保留的区域`,"desktop.send":`发送`,"desktop.message.placeholder":`写一句话,直接发送…`,"desktop.hint":`双指缩放 · 轻点隐藏按钮`,"desktop.save":`保存`,"desktop.save.failed":`保存图片失败。`,"desktop.zoom.fit":`适应屏幕`,"desktop.attach":`添加到会话`,"desktop.attach.blocked":`当前草稿暂时不能添加附件。`,"desktop.close":`关闭桌面截图`,"desktop.enlarge":`放大桌面截图`,"desktop.pending":`正在截取桌面…`,"desktop.transferring":`正在接收截图… {loaded} / {total}`,"desktop.transferring.unknown":`正在接收截图… {loaded}`,"desktop.captured":`拍摄于:{time}`,"desktop.error.unsupported":`桌面截图仅支持运行 Windows 或 macOS 的电脑。`,"desktop.error.permission-denied":`已请求系统授权,并尝试在运行 Web 的 Mac 上打开录屏权限设置(不是手机)。请为系统列出的实际启动程序授权,例如 CodexHost、Node 或终端;若系统要求,重启对应程序,再手动重新截图。若设置未打开,请进入「系统设置 → 隐私与安全性 → 屏幕录制/屏幕与系统音频录制」。`,"desktop.error.display-unavailable":`当前电脑的主屏桌面不可用。请在电脑端登录并解锁、检查主屏连接,等待 Windows UAC 安全桌面提示结束。Windows 通常没有单独的截图授权开关,请勿关闭 UAC。`,"desktop.error.capture-failed":`桌面截图失败,可手动重试。`,"desktop.error.image-too-large":`桌面图片超过支持的大小。`,"desktop.error.busy":`电脑正在截图,请稍后再试。`,"desktop.error.timeout":`桌面截图超时,请检查电脑后再试。`,"desktop.error.unavailable":`截图服务暂不可用,请检查连接和原生 Launcher 版本。`,"voice.label":`语音输入`,"voice.permission":`等待麦克风权限…`,"voice.stop":`结束录音并插入草稿`,"voice.send":`转写并发送`,"voice.done":`完成`,"voice.transcribing":`正在转写…`,"voice.slow":`转写较慢…`,"voice.silent":`没有听到声音`,"voice.retry":`重试转写`,"voice.rerecord":`重新录音`,"voice.tryAgain":`再试一次`,"voice.undo":`撤销`,"voice.cancelled":`已丢弃 {time} 的录音。`,"voice.unplaced":`草稿在转写期间被修改,转写结果没有自动插入`,"voice.insert":`插入到光标处`,"voice.copy":`复制`,"voice.cancel":`取消录音`,"voice.discard":`丢弃`,"voice.error.browser-unsupported":`当前页面不允许录音,请用 HTTPS 或 localhost 打开。`,"voice.error.permission-denied":`麦克风访问被阻止。点击地址栏左侧的站点设置,允许使用麦克风后再试。`,"voice.error.no-microphone":`未找到麦克风,请检查系统输入设备。`,"voice.error.record-failed":`暂时无法访问麦克风,请检查浏览器和输入设备。`,"voice.error.credentials-unavailable":`Codex ChatGPT 登录凭证不可用。`,"voice.error.login-expired":`Codex 登录已失效,请使用一次 Codex 刷新登录;录音已保留。`,"voice.error.rate-limited":`语音服务限流,请稍后重试;录音已保留。`,"voice.error.service-rejected":`语音服务拒绝了请求;录音已保留。`,"voice.error.host-incompatible":`当前 Host 不支持语音转写,请更新并重启 Host。`,"voice.error.network":`转写失败:网络请求失败。录音已保留,不需要重新说。`,"voice.error.timeout":`转写超时。录音已保留,不需要重新说。`,"voice.error.audio-empty":`没有识别到语音。`,"voice.error.audio-too-large":`录音超过 10 MiB 上限。`,"voice.error.audio-format":`音频格式不被接受。`,"voice.error.audio-invalid":`录音文件不可用。`},Xf=`codexhostImport`,Zf=`codexhost-import`,Qf=[`slots`,`locale`,`layout`,`uiWorkspace`,`workspaces`,`sessions`,`remote`,`inputTriggers`,`theme`,`connection`],$f=[[`connections`,`settings.connections`],[`resources`,`settings.resources`],[`accounts`,`settings.accounts`],[`usage-statistics`,`settings.usage`],[`updates`,`settings.updates`],[`about`,`settings.about`]];function ep(e){e.effect(()=>e.locale.register(Xf,{zh:Yf,en:Jf}),`ui-codexhost: dictionaries`);let t=e.locale.bind(Xf);e.provide(`chatMessageEditing`,Rl),e.provide(`chatTurnDiffs`,Ll),e.inject([`conversation`],e=>{let t=new $l(Ml.capture),n=e.conversation,r={create:(e,t)=>n.createDrafts(e,[t]),release:e=>n.releaseDraftAttachments(e)};e.effect(()=>()=>t.close(),`ui-codexhost: release desktop screenshot`),e.slots.inject(`conversation.input.right`,()=>e.slots.register({name:`conversation.input.right`,id:`codexhost.desktop-screenshot`,locale:Xf,inject:()=>({screenshot:t,drafts:r})},vu)),e.slots.inject(`conversation.input.notice`,()=>e.slots.register({name:`conversation.input.notice`,id:`codexhost.desktop-screenshot`,locale:Xf,inject:()=>({screenshot:t,drafts:r})},Cu));let i=new Tu(kl.transcribe),a=new ku;e.effect(()=>()=>i.discard(),`ui-codexhost: release microphone`),e.slots.inject(`conversation.input.right`,()=>e.slots.register({name:`conversation.input.right`,id:`codexhost.voice`,locale:Xf,inject:()=>({voice:i,blocks:e.conversation.blocks,tray:a})},Mu)),e.slots.inject(`conversation.input.activity`,()=>e.slots.register({name:`conversation.input.activity`,locale:Xf,inject:()=>({voice:i,tray:a})},Nu)),e.slots.inject(`conversation.input.notice`,()=>e.slots.register({name:`conversation.input.notice`,id:`codexhost.voice`,locale:Xf,inject:()=>({voice:i})},Iu)),e.effect(()=>{let e=e=>{let{phase:t}=i.getSnapshot();e.key===`Escape`&&(t===`recording`||t===`transcribing`)?(e.preventDefault(),i.cancel()):e.code===`Space`&&e.shiftKey&&(e.metaKey||e.ctrlKey)&&!e.altKey&&(e.preventDefault(),i.toggle())};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},`ui-codexhost: voice shortcuts`)}),e.inject([`connection`,`modelDirectories`,`commandUi`],e=>Ul(e)),e.provide(`chatLinks`,{resolve:Object.assign(t=>{let n=Yl(t);if(n===void 0)return;let r=n,i=()=>{let t=e.sessions.list.getSnapshot().byId[r];return t===void 0?void 0:ql(t)};if(i()===void 0)return;let a=new URL(window.location.href);return a.searchParams.set(`session`,r),{href:a.href,open:()=>{i()!==void 0&&e.uiWorkspace.openSession(r)}}},{autoLinkPattern:Kl,subscribe:t=>e.sessions.list.subscribe(t)})}),Zl(e);let n={openSession:t=>{e.uiWorkspace.openSession(t)}};e.slots.inject(`main`,()=>e.slots.register({name:`main`,key:Zf,locale:Xf,inject:()=>({openSession:async(r,i)=>{let a=r;if(e.sessions.list.getSnapshot().byId[a]===void 0&&await e.sessions.refresh(),i.throwIfAborted(),e.sessions.list.getSnapshot().byId[a]===void 0)throw Error(t(`catalogPending`));n.openSession(r)}})},Hf)),e.slots.inject(`sidebar.panellist`,()=>e.slots.register({name:`sidebar.panellist`,id:Zf,order:10,label:()=>t(`panel`),locale:Xf},Ru)),e.slots.inject(`settings.general.item`,()=>e.slots.register({name:`settings.general.item`,id:`codexhost.notifications`,order:5,locale:Xf},Rf));let r={get:()=>e.locale.getLocale().active,subscribe:t=>e.locale.subscribe(t)},i={get:()=>e.theme.getTheme().active.colorScheme,subscribe:t=>e.on(`theme/change`,t)};e.slots.inject(`settings.section`,()=>e.slots.register({name:`settings.section`,id:`codexhost-ui-extensions`,order:8,label:()=>t(`settings.extensions`),locale:Xf,inject:()=>({resolveText:t=>e.locale.resolveText(t)})},Ff)),e.slots.inject(`settings.section`,()=>e.slots.register({name:`settings.section`,id:`codexhost-connect-devices`,order:9,label:()=>t(`settings.connectDevices`),locale:Xf},Cf)),$f.forEach(([n,a],o)=>{e.slots.inject(`settings.section`,()=>e.slots.register({name:`settings.section`,id:`codexhost-${n}`,order:10+o,label:()=>t(a),locale:Xf,inject:()=>({pageId:n,locale:r,colorScheme:i})},qf))}),e.slots.inject(`sidebar.session.row.identity`,()=>e.slots.register({name:`sidebar.session.row.identity`,id:`codexhost.harness`,inject:()=>({list:e.sessions.list})},zu)),e.slots.inject(`conversation.header.notice`,()=>e.slots.register({name:`conversation.header.notice`,id:`codexhost.connection`,locale:Xf,inject:()=>({list:e.sessions.list,connection:e.get(`connection`)})},ed)),e.slots.inject(`conversation.header.notice`,()=>e.slots.register({name:`conversation.header.notice`,id:`codexhost.import-source`,locale:Xf,inject:()=>({list:e.sessions.list})},rd)),e.slots.inject(`conversation.composer.dock`,()=>e.slots.register({name:`conversation.composer.dock`,id:`codexhost.usage`,order:2,locale:Xf},Cd)),e.effect(()=>e.remote.$on(`codexhost/session-bound`,(t,n)=>{(e.sessions.list.getSnapshot().byId[t]?.retainedBy.mainView??0)>0&&e.uiWorkspace.openSession(n)}),`ui-codexhost: canonical CH identity`),Ju(),Yu(),e.effect(()=>Qu(e.get(`connection`).state),`ui-codexhost: enter sign-in when the token is revoked`),(()=>{let e=new URL(window.location.href),t=e.searchParams.get(`session`);t!==null&&(e.searchParams.delete(`session`),window.history.replaceState(null,``,`${e.pathname}${e.search}${e.hash}`),setTimeout(()=>{n.openSession(t)},600))})();let a=e=>{let t=e.data;t?.type===`codexhost/open-session`&&typeof t.sessionId==`string`&&n.openSession(t.sessionId)};`serviceWorker`in navigator&&(navigator.serviceWorker.addEventListener(`message`,a),e.effect(()=>()=>{navigator.serviceWorker.removeEventListener(`message`,a)},`ui-codexhost: service worker messages`))}return n.NS=Xf,n.PANEL_ID=Zf,n.apply=ep,n.inject=Qf,t.exports}});
122
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0])a(n);else{if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}(e.metadataRegistry.get(n[0])?.id||r.cycle||r.count>1&&e.reused===`ref`)&&a(n)}}}function si(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:ui(t,`input`,e.processors),output:ui(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function ci(e,t){let n=t??{seen:/* @__PURE__ */ new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return ci(r.element,n);if(r.type===`set`)return ci(r.valueType,n);if(r.type===`lazy`)return ci(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`)return ci(r.innerType,n);if(r.type===`intersection`)return ci(r.left,n)||ci(r.right,n);if(r.type===`record`||r.type===`map`)return ci(r.keyType,n)||ci(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:ci(r.in,n)||ci(r.out,n);if(r.type===`object`){for(let e in r.shape)if(ci(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(ci(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(ci(e,n))return!0;return!!(r.rest&&ci(r.rest,n))}return!1}let li=(e,t={})=>n=>{let r=ai({...n,processors:t});return I(e,r),oi(r,e),si(r,e)},ui=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=ai({...i??{},target:a,io:t,processors:n});return I(e,o),oi(o,e),si(o,e)},di={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},fi=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=di[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},pi=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;i.type=typeof s==`string`&&s.includes(`int`)?`integer`:`number`;let d=typeof u==`number`&&u>=(a??-1/0),f=typeof l==`number`&&l<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;d?p?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l:typeof o==`number`&&(i.maximum=o),typeof c==`number`&&(i.multipleOf=c)},mi=(e,t,n,r)=>{n.type=`boolean`},hi=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},gi=(e,t,n,r)=>{n.not={}},_i=(e,t,n,r)=>{let i=e._zod.def,a=h(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},vi=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0){if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a}},yi=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},bi=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},xi=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=I(a.element,t,{...r,path:[...r.path,`items`]})},Si=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=I(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=I(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Ci=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>I(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},wi=(e,t,n,r)=>{let i=e._zod.def,a=I(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=I(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},Ti=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`array`;let o=t.target===`draft-2020-12`?`prefixItems`:`items`,s=t.target===`draft-2020-12`||t.target===`openapi-3.0`?`items`:`additionalItems`,c=a.items.map((e,n)=>I(e,t,{...r,path:[...r.path,o,n]})),l=a.rest?I(a.rest,t,{...r,path:[...r.path,s,...t.target===`openapi-3.0`?[a.items.length]:[]]}):null;t.target===`draft-2020-12`?(i.prefixItems=c,l&&(i.items=l)):t.target===`openapi-3.0`?(i.items={anyOf:c},l&&i.items.anyOf.push(l),i.minItems=c.length,l||(i.maxItems=c.length)):(i.items=c,l&&(i.additionalItems=l));let{minimum:u,maximum:d}=e._zod.bag;typeof u==`number`&&(i.minItems=u),typeof d==`number`&&(i.maxItems=d)},Ei=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag?.patterns;if(a.mode===`loose`&&s&&s.size>0){let e=I(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)i.patternProperties[t.source]=e}else(t.target===`draft-07`||t.target===`draft-2020-12`)&&(i.propertyNames=I(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=I(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]});let c=o._zod.values;if(c){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e)}},Di=(e,t,n,r)=>{let i=e._zod.def,a=I(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},Oi=(e,t,n,r)=>{let i=e._zod.def;I(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},ki=(e,t,n,r)=>{let i=e._zod.def;I(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},Ai=(e,t,n,r)=>{let i=e._zod.def;I(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},ji=(e,t,n,r)=>{let i=e._zod.def;I(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},Mi=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;I(o,t,r);let s=t.seen.get(e);s.ref=o},Ni=(e,t,n,r)=>{let i=e._zod.def;I(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Pi=(e,t,n,r)=>{let i=e._zod.def;I(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Fi=(e,t,n,r)=>{let i=e._zod.innerType;I(i,t,r);let a=t.seen.get(e);a.ref=i},Ii=/*@__PURE__*/ u(`ZodISODateTime`,(e,t)=>{Gt.init(e,t),z.init(e,t)});function Li(e){return/* @__PURE__ */ wr(Ii,e)}let Ri=/*@__PURE__*/ u(`ZodISODate`,(e,t)=>{Kt.init(e,t),z.init(e,t)});function zi(e){return/* @__PURE__ */ Tr(Ri,e)}let Bi=/*@__PURE__*/ u(`ZodISOTime`,(e,t)=>{qt.init(e,t),z.init(e,t)});function Vi(e){return/* @__PURE__ */ Er(Bi,e)}let Hi=/*@__PURE__*/ u(`ZodISODuration`,(e,t)=>{Jt.init(e,t),z.init(e,t)});function Ui(e){return/* @__PURE__ */ Dr(Hi,e)}let Wi=/*@__PURE__*/ u(`ZodError`,(e,t)=>{be.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>Ce(e,t)},flatten:{value:t=>Se(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,g,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,g,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),Gi=/* @__PURE__ */ we(Wi),Ki=/* @__PURE__ */ N(Wi),qi=/* @__PURE__ */ Te(Wi),Ji=/* @__PURE__ */ De(Wi),Yi=/* @__PURE__ */ ke(Wi),Xi=/* @__PURE__ */ Ae(Wi),Zi=/* @__PURE__ */ je(Wi),Qi=/* @__PURE__ */ Me(Wi),$i=/* @__PURE__ */ Ne(Wi),ea=/* @__PURE__ */ Pe(Wi),ta=/* @__PURE__ */ Fe(Wi),na=/* @__PURE__ */ Ie(Wi),ra=/* @__PURE__ */ new WeakMap;function ia(e,t,n){let r=Object.getPrototypeOf(e),i=ra.get(r);if(i||(i=/* @__PURE__ */ new Set,ra.set(r,i)),!i.has(t)){i.add(t);for(let e in n){let t=n[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,get(){let n=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:n}),n},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}let L=/*@__PURE__*/ u(`ZodType`,(e,t)=>(P.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:ui(e,`input`),output:ui(e,`output`)}}),e.toJSONSchema=li(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>Gi(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>qi(e,t,n),e.parseAsync=async(t,n)=>Ki(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>Ji(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>Yi(e,t,n),e.decode=(t,n)=>Xi(e,t,n),e.encodeAsync=async(t,n)=>Zi(e,t,n),e.decodeAsync=async(t,n)=>Qi(e,t,n),e.safeEncode=(t,n)=>$i(e,t,n),e.safeDecode=(t,n)=>ea(e,t,n),e.safeEncodeAsync=async(t,n)=>ta(e,t,n),e.safeDecodeAsync=async(t,n)=>na(e,t,n),ia(e,`ZodType`,{check(...e){let t=this.def;return this.clone(w(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return j(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(So(e,t))},superRefine(e,t){return this.check(Co(e,t))},overwrite(e){return this.check(/* @__PURE__ */ Jr(e))},optional(){return eo(this)},exactOptional(){return no(this)},nullable(){return io(this)},nullish(){return eo(io(this))},nonoptional(e){return uo(this,e)},array(){return H(this)},or(e){return Ba([this,e])},and(e){return Wa(this,e)},transform(e){return ho(this,Qa(e))},default(e){return oo(this,e)},prefault(e){return co(this,e)},catch(e){return po(this,e)},pipe(e){return ho(this,e)},readonly(){return _o(this)},describe(e){let t=this.clone();return er.add(t,{description:e}),t},meta(...e){if(e.length===0)return er.get(this);let t=this.clone();return er.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,"description",{get(){return er.get(e)?.description},configurable:!0}),e)),aa=/*@__PURE__*/ u(`_ZodString`,(e,t)=>{Nt.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fi(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,ia(e,`_ZodString`,{regex(...e){return this.check(/* @__PURE__ */ Hr(...e))},includes(...e){return this.check(/* @__PURE__ */ Gr(...e))},startsWith(...e){return this.check(/* @__PURE__ */ Kr(...e))},endsWith(...e){return this.check(/* @__PURE__ */ qr(...e))},min(...e){return this.check(/* @__PURE__ */ Br(...e))},max(...e){return this.check(/* @__PURE__ */ zr(...e))},length(...e){return this.check(/* @__PURE__ */ Vr(...e))},nonempty(...e){return this.check(/* @__PURE__ */ Br(1,...e))},lowercase(e){return this.check(/* @__PURE__ */ Ur(e))},uppercase(e){return this.check(/* @__PURE__ */ Wr(e))},trim(){return this.check(/* @__PURE__ */ Xr())},normalize(...e){return this.check(/* @__PURE__ */ Yr(...e))},toLowerCase(){return this.check(/* @__PURE__ */ Zr())},toUpperCase(){return this.check(/* @__PURE__ */ Qr())},slugify(){return this.check(/* @__PURE__ */ $r())}})}),oa=/*@__PURE__*/ u(`ZodString`,(e,t)=>{Nt.init(e,t),aa.init(e,t),e.email=t=>e.check(/* @__PURE__ */ nr(sa,t)),e.url=t=>e.check(/* @__PURE__ */ cr(ua,t)),e.jwt=t=>e.check(/* @__PURE__ */ Cr(Ea,t)),e.emoji=t=>e.check(/* @__PURE__ */ lr(fa,t)),e.guid=t=>e.check(/* @__PURE__ */ rr(ca,t)),e.uuid=t=>e.check(/* @__PURE__ */ ir(la,t)),e.uuidv4=t=>e.check(/* @__PURE__ */ ar(la,t)),e.uuidv6=t=>e.check(/* @__PURE__ */ or(la,t)),e.uuidv7=t=>e.check(/* @__PURE__ */ sr(la,t)),e.nanoid=t=>e.check(/* @__PURE__ */ ur(pa,t)),e.guid=t=>e.check(/* @__PURE__ */ rr(ca,t)),e.cuid=t=>e.check(/* @__PURE__ */ dr(ma,t)),e.cuid2=t=>e.check(/* @__PURE__ */ fr(ha,t)),e.ulid=t=>e.check(/* @__PURE__ */ pr(ga,t)),e.base64=t=>e.check(/* @__PURE__ */ br(Ca,t)),e.base64url=t=>e.check(/* @__PURE__ */ xr(wa,t)),e.xid=t=>e.check(/* @__PURE__ */ mr(_a,t)),e.ksuid=t=>e.check(/* @__PURE__ */ hr(va,t)),e.ipv4=t=>e.check(/* @__PURE__ */ gr(ya,t)),e.ipv6=t=>e.check(/* @__PURE__ */ _r(ba,t)),e.cidrv4=t=>e.check(/* @__PURE__ */ vr(xa,t)),e.cidrv6=t=>e.check(/* @__PURE__ */ yr(Sa,t)),e.e164=t=>e.check(/* @__PURE__ */ Sr(Ta,t)),e.datetime=t=>e.check(Li(t)),e.date=t=>e.check(zi(t)),e.time=t=>e.check(Vi(t)),e.duration=t=>e.check(Ui(t))});function R(e){return/* @__PURE__ */ tr(oa,e)}let z=/*@__PURE__*/ u(`ZodStringFormat`,(e,t)=>{F.init(e,t),aa.init(e,t)}),sa=/*@__PURE__*/ u(`ZodEmail`,(e,t)=>{It.init(e,t),z.init(e,t)}),ca=/*@__PURE__*/ u(`ZodGUID`,(e,t)=>{Pt.init(e,t),z.init(e,t)}),la=/*@__PURE__*/ u(`ZodUUID`,(e,t)=>{Ft.init(e,t),z.init(e,t)}),ua=/*@__PURE__*/ u(`ZodURL`,(e,t)=>{Lt.init(e,t),z.init(e,t)});function da(e){return/* @__PURE__ */ cr(ua,e)}let fa=/*@__PURE__*/ u(`ZodEmoji`,(e,t)=>{Rt.init(e,t),z.init(e,t)}),pa=/*@__PURE__*/ u(`ZodNanoID`,(e,t)=>{zt.init(e,t),z.init(e,t)}),ma=/*@__PURE__*/ u(`ZodCUID`,(e,t)=>{Bt.init(e,t),z.init(e,t)}),ha=/*@__PURE__*/ u(`ZodCUID2`,(e,t)=>{Vt.init(e,t),z.init(e,t)}),ga=/*@__PURE__*/ u(`ZodULID`,(e,t)=>{Ht.init(e,t),z.init(e,t)}),_a=/*@__PURE__*/ u(`ZodXID`,(e,t)=>{Ut.init(e,t),z.init(e,t)}),va=/*@__PURE__*/ u(`ZodKSUID`,(e,t)=>{Wt.init(e,t),z.init(e,t)}),ya=/*@__PURE__*/ u(`ZodIPv4`,(e,t)=>{Yt.init(e,t),z.init(e,t)}),ba=/*@__PURE__*/ u(`ZodIPv6`,(e,t)=>{Xt.init(e,t),z.init(e,t)}),xa=/*@__PURE__*/ u(`ZodCIDRv4`,(e,t)=>{Zt.init(e,t),z.init(e,t)}),Sa=/*@__PURE__*/ u(`ZodCIDRv6`,(e,t)=>{Qt.init(e,t),z.init(e,t)}),Ca=/*@__PURE__*/ u(`ZodBase64`,(e,t)=>{en.init(e,t),z.init(e,t)}),wa=/*@__PURE__*/ u(`ZodBase64URL`,(e,t)=>{nn.init(e,t),z.init(e,t)}),Ta=/*@__PURE__*/ u(`ZodE164`,(e,t)=>{rn.init(e,t),z.init(e,t)}),Ea=/*@__PURE__*/ u(`ZodJWT`,(e,t)=>{on.init(e,t),z.init(e,t)}),Da=/*@__PURE__*/ u(`ZodNumber`,(e,t)=>{sn.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>pi(e,t,n,r),ia(e,`ZodNumber`,{gt(e,t){return this.check(/* @__PURE__ */ Ir(e,t))},gte(e,t){return this.check(/* @__PURE__ */ Lr(e,t))},min(e,t){return this.check(/* @__PURE__ */ Lr(e,t))},lt(e,t){return this.check(/* @__PURE__ */ Pr(e,t))},lte(e,t){return this.check(/* @__PURE__ */ Fr(e,t))},max(e,t){return this.check(/* @__PURE__ */ Fr(e,t))},int(e){return this.check(ka(e))},safe(e){return this.check(ka(e))},positive(e){return this.check(/* @__PURE__ */ Ir(0,e))},nonnegative(e){return this.check(/* @__PURE__ */ Lr(0,e))},negative(e){return this.check(/* @__PURE__ */ Pr(0,e))},nonpositive(e){return this.check(/* @__PURE__ */ Fr(0,e))},multipleOf(e,t){return this.check(/* @__PURE__ */ Rr(e,t))},step(e,t){return this.check(/* @__PURE__ */ Rr(e,t))},finite(){return this}});let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function B(e){return/* @__PURE__ */ Or(Da,e)}let Oa=/*@__PURE__*/ u(`ZodNumberFormat`,(e,t)=>{cn.init(e,t),Da.init(e,t)});function ka(e){return/* @__PURE__ */ kr(Oa,e)}let Aa=/*@__PURE__*/ u(`ZodBoolean`,(e,t)=>{ln.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>mi(e,t,n,r)});function V(e){return/* @__PURE__ */ Ar(Aa,e)}let ja=/*@__PURE__*/ u(`ZodNull`,(e,t)=>{un.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>hi(e,t,n,r)});function Ma(e){return/* @__PURE__ */ jr(ja,e)}let Na=/*@__PURE__*/ u(`ZodUnknown`,(e,t)=>{dn.init(e,t),L.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Pa(){return/* @__PURE__ */ Mr(Na)}let Fa=/*@__PURE__*/ u(`ZodNever`,(e,t)=>{fn.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>gi(e,t,n,r)});function Ia(e){return/* @__PURE__ */ Nr(Fa,e)}let La=/*@__PURE__*/ u(`ZodArray`,(e,t)=>{mn.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xi(e,t,n,r),e.element=t.element,ia(e,`ZodArray`,{min(e,t){return this.check(/* @__PURE__ */ Br(e,t))},nonempty(e){return this.check(/* @__PURE__ */ Br(1,e))},max(e,t){return this.check(/* @__PURE__ */ zr(e,t))},length(e,t){return this.check(/* @__PURE__ */ Vr(e,t))},unwrap(){return this.element}})});function H(e,t){return/* @__PURE__ */ ei(La,e,t)}let Ra=/*@__PURE__*/ u(`ZodObject`,(e,t)=>{yn.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Si(e,t,n,r),S(e,`shape`,()=>t.shape),ia(e,`ZodObject`,{keyof(){return G(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:Pa()})},loose(){return this.clone({...this._zod.def,catchall:Pa()})},strict(){return this.clone({...this._zod.def,catchall:Ia()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return se(this,e)},safeExtend(e){return ce(this,e)},merge(e){return le(this,e)},pick(e){return ae(this,e)},omit(e){return oe(this,e)},partial(...e){return ue($a,this,e[0])},required(...e){return de(lo,this,e[0])}})});function U(e,t){let n={type:`object`,shape:e??{},...M(t)};return new Ra(n)}function W(e,t){return new Ra({type:`object`,shape:e,catchall:Ia(),...M(t)})}let za=/*@__PURE__*/ u(`ZodUnion`,(e,t)=>{xn.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ci(e,t,n,r),e.options=t.options});function Ba(e,t){return new za({type:`union`,options:e,...M(t)})}let Va=/*@__PURE__*/ u(`ZodDiscriminatedUnion`,(e,t)=>{za.init(e,t),Sn.init(e,t)});function Ha(e,t,n){return new Va({type:`union`,options:t,discriminator:e,...M(n)})}let Ua=/*@__PURE__*/ u(`ZodIntersection`,(e,t)=>{Cn.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wi(e,t,n,r)});function Wa(e,t){return new Ua({type:`intersection`,left:e,right:t})}let Ga=/*@__PURE__*/ u(`ZodTuple`,(e,t)=>{En.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ti(e,t,n,r),e.rest=t=>e.clone({...e._zod.def,rest:t})});function Ka(e,t,n){let r=t instanceof P;return new Ga({type:`tuple`,items:e,rest:r?t:null,...M(r?n:t)})}let qa=/*@__PURE__*/ u(`ZodRecord`,(e,t)=>{An.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ei(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function Ja(e,t,n){return!t||!t._zod?new qa({type:`record`,keyType:R(),valueType:e,...M(t)}):new qa({type:`record`,keyType:e,valueType:t,...M(n)})}let Ya=/*@__PURE__*/ u(`ZodEnum`,(e,t)=>{jn.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_i(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new Ya({...t,checks:[],...M(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new Ya({...t,checks:[],...M(r),entries:i})}});function G(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new Ya({type:`enum`,entries:n,...M(t)})}let Xa=/*@__PURE__*/ u(`ZodLiteral`,(e,t)=>{Mn.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>vi(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function K(e,t){return new Xa({type:`literal`,values:Array.isArray(e)?e:[e],...M(t)})}let Za=/*@__PURE__*/ u(`ZodTransform`,(e,t)=>{Nn.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bi(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new f(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(ve(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(ve(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});function Qa(e){return new Za({type:`transform`,transform:e})}let $a=/*@__PURE__*/ u(`ZodOptional`,(e,t)=>{Fn.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Pi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function eo(e){return new $a({type:`optional`,innerType:e})}let to=/*@__PURE__*/ u(`ZodExactOptional`,(e,t)=>{In.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Pi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function no(e){return new to({type:`optional`,innerType:e})}let ro=/*@__PURE__*/ u(`ZodNullable`,(e,t)=>{Ln.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Di(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function io(e){return new ro({type:`nullable`,innerType:e})}let ao=/*@__PURE__*/ u(`ZodDefault`,(e,t)=>{Rn.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ki(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function oo(e,t){return new ao({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():k(t)}})}let so=/*@__PURE__*/ u(`ZodPrefault`,(e,t)=>{Bn.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ai(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function co(e,t){return new so({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():k(t)}})}let lo=/*@__PURE__*/ u(`ZodNonOptional`,(e,t)=>{Vn.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Oi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function uo(e,t){return new lo({type:`nonoptional`,innerType:e,...M(t)})}let fo=/*@__PURE__*/ u(`ZodCatch`,(e,t)=>{Un.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ji(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function po(e,t){return new fo({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}let mo=/*@__PURE__*/ u(`ZodPipe`,(e,t)=>{Wn.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Mi(e,t,n,r),e.in=t.in,e.out=t.out});function ho(e,t){return new mo({type:`pipe`,in:e,out:t})}let go=/*@__PURE__*/ u(`ZodReadonly`,(e,t)=>{Kn.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ni(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function _o(e){return new go({type:`readonly`,innerType:e})}let vo=/*@__PURE__*/ u(`ZodLazy`,(e,t)=>{Jn.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fi(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function yo(e){return new vo({type:`lazy`,getter:e})}let bo=/*@__PURE__*/ u(`ZodCustom`,(e,t)=>{Yn.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>yi(e,t,n,r)});function xo(e,t){return/* @__PURE__ */ ti(bo,e??(()=>!0),t)}function So(e,t={}){return/* @__PURE__ */ ni(bo,e,t)}function Co(e,t){return/* @__PURE__ */ ri(e,t)}function wo(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 To=Ba([R(),B(),V(),Ma()]);function Eo(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 Do=xo(Eo,{message:`JSON value must not contain circular references`}),Oo=yo(()=>Ba([To,H(Oo),Ja(R(),Oo)])),ko=Do.pipe(Oo);Do.pipe(H(Oo));let Ao=Do.pipe(Ja(R(),Oo)),jo=W({code:R().min(1),message:R().min(1),retryable:V(),diagnostic:R().min(1).optional(),stage:R().min(1).optional(),durationMs:B().int().nonnegative().optional(),stderrTail:R().min(1).optional()}).superRefine(wo([`diagnostic`,`stage`,`durationMs`,`stderrTail`])),Mo=R().max(64).regex(/^[a-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/u),No=e=>R().min(1).max(e).refine(e=>e.trim().length>0),Po=Ja(Mo,U({label:No(256).optional(),description:No(1024).optional()}).strict()).refine(e=>Object.keys(e).length<=16,`Too many locales`),Fo=Ja(Mo,No(4096)).refine(e=>typeof e.en==`string`,`English fallback is required`).refine(e=>Object.keys(e).length<=16,`Too many locales`),Io=R().refine(e=>e.trim().length>0,{message:`Identifier must not be empty or whitespace`}),Lo=Io.brand(),q=Io.brand(),Ro=Io.brand();Io.brand(),Io.brand();let zo=R().refine(e=>e.trim().length>0,{message:`Value must not be empty or whitespace`}),Bo=zo.max(128).regex(/^[A-Za-z0-9._~:-]+$/u,`Permission Mode ID must use transport-safe characters`).brand(),Vo=U({modes:H(U({id:Bo,label:zo.max(256),description:zo.max(1024).optional(),dangerous:V().optional(),localizations:Po.optional()}).strict()).min(1).max(32),defaultModeId:Bo}).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`]})});U({threadId:q,permissionModeId:Bo}).strict();let Ho=B().int().safe().nonnegative(),Uo=B().finite().nonnegative(),Wo=B().finite().min(0).max(100),Go=U({value:Uo,turnId:R().min(1).max(1024),at:Ho}).strict();U({outputTokensPerSecond:Go.optional(),timeToFirstOutputMs:Go.extend({value:Ho}).optional()}).strict();let Ko=e=>Fo.refine(t=>Object.values(t).every(t=>t.length<=e)),qo=U({composerIndicators:H(U({kind:K(`countdown`),id:R().min(1).max(64),expiresAtUnix:Ho,label:Ko(256).optional(),tooltip:Ko(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:Ho.optional(),cachedInputTokens:Ho.optional(),cacheWriteInputTokens:Ho.optional(),outputTokens:Ho.optional(),outputTokensPerSecond:Uo.optional(),apiOutputTokensPerSecond:Uo.optional(),reasoningOutputTokens:Ho.optional(),totalTokens:Ho.optional(),totalCostUsd:Uo.optional(),totalCredits:Uo.optional(),contextUsagePercent:Uo.optional(),cacheHitRatePercent:Wo.optional(),contextWindowTokens:Ho.optional(),contextUsedTokens:Ho.optional(),planFiveHourUsedPercent:Wo.optional(),planFiveHourResetsAtUnix:Ho.optional(),planSevenDayUsedPercent:Wo.optional(),planSevenDayResetsAtUnix:Ho.optional(),sessionCacheHitRatePercent:Wo.optional(),timeToFirstOutputMs:Ho.optional(),costSource:G([`publicPrice`,`native`]).optional(),unpricedModels:H(R().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`]})}),Jo=B().finite().min(0).max(100),Yo=G([`weekly`,`monthly`,`five_hour`,`seven_day`,`unknown`]),Xo=U({id:R().min(1).max(256),label:R().min(1).max(256),localizations:Po.optional()}).strict(),Zo=U({product:R().min(1),periodType:Yo.optional(),scope:Xo.optional(),localizations:Po.optional(),used:B().finite().nonnegative().optional(),limit:B().finite().nonnegative().optional(),unit:R().min(1).max(32).optional(),usagePercent:Jo,resetsAt:R().min(1).optional()}).strict(),Qo=U({availableCount:B().int().safe().positive(),nextExpiresAt:R().min(1).optional(),expiresAt:H(R().min(1)).min(1).max(32).optional()}).strict(),$o=U({used:B().finite().nonnegative().optional(),limit:B().finite().nonnegative().optional(),unit:R().min(1).max(32).optional(),label:R().min(1).optional(),scope:Xo.optional(),localizations:Po.optional(),usedPercent:Jo,resetsAt:R().min(1).optional(),periodType:Yo,productUsage:H(Zo).min(1).optional(),resetCredits:Qo.optional()}).strict();U({threadId:q,refresh:K(`exact`).optional()}).strict(),U({threadId:q,usage:qo.nullable(),accountCredits:$o.optional(),accountCreditsSupported:V().optional()}).strict();let es=R().refine(e=>e.trim().length>0,{message:`Value must not be empty or whitespace`}),ts=U({id:es.max(512).regex(/^[A-Za-z0-9._~-]+$/u,`Model Ref must use transport-safe opaque characters`).brand()}).strict(),ns=es.max(128).regex(/^[A-Za-z0-9._~-]+$/u,`Thinking option ID must use transport-safe characters`).brand(),rs=es.max(256),is=U({id:ns,label:es.max(256)}).strict(),as=U({ref:ts,label:es.max(256),resolvedModelLabel:rs.optional(),fastModel:ts.optional(),supportedThinkingOptionIds:H(ns).optional()}).strict(),os=H(is).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)}),ss=U({models:H(as),defaultModel:ts.optional(),thinkingOptions:os,defaultThinkingOptionId:ns.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`]})}),cs=U({fork:V(),forkAcrossCwd:V(),rollbackLastTurn:V()}).strict().refine(e=>e.fork||!e.forkAcrossCwd,{path:[`forkAcrossCwd`],message:`Cross-cwd Fork requires exact history Fork support`}),ls=G([`live`,`atCreate`]),us=U({configuration:U({selectModel:V(),selectThinkingOption:V(),selectPermissionMode:V(),permissionModeScope:ls.default(`live`)}).strict(),history:cs,subagents:U({observe:V(),readTranscript:V()}).strict().optional(),autonomousTurns:U({observe:V()}).strict().optional(),steer:V().optional()}).strict();U({effectiveModel:ts.optional(),resolvedModelLabel:rs.optional(),effectiveThinkingOptionId:ns.optional(),availableThinkingOptions:os.optional(),effectivePermissionModeId:Bo.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 ds=U({open:K(!0)}).strict();Ba([U({status:K(`ready`),catalog:ss,permissionModes:Vo.optional(),capabilities:us,webUi:ds.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`]})}),U({status:G([`notInstalled`,`unavailable`,`error`]),error:jo}).strict()]),U({harnessId:Lo,cwd:es.max(16384).optional(),refresh:V().optional(),purpose:K(`availability`).optional()}).strict(),U({harnessId:Lo}).strict(),U({}).strict(),U({threadId:q,model:ts}).strict(),U({threadId:q,thinkingOptionId:ns}).strict(),U({threadId:q,includeReferenceCapability:V().optional()}).strict(),Ha(`owner`,[U({owner:K(`codex`),locked:V(),effectiveModel:ts.optional(),resolvedModelLabel:rs.optional(),effectiveThinkingOptionId:ns.optional(),effectivePermissionModeId:Bo.optional(),history:cs.optional(),supportsThreadReferences:K(!0).optional()}).strict(),U({owner:K(`external`),harnessId:es.max(256),transportModelId:es.max(1024),effectiveModel:ts.optional(),resolvedModelLabel:rs.optional(),effectiveThinkingOptionId:ns.optional(),availableThinkingOptions:os.optional(),effectivePermissionModeId:Bo.optional(),history:cs,usage:qo.optional(),locked:K(!0)}).strict()]),U({threadIds:H(q).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 fs=Ha(`owner`,[U({threadId:q,owner:K(`codex`)}).strict(),U({threadId:q,owner:K(`external`),harnessId:R().max(256).pipe(Lo)}).strict()]);U({threads:H(fs).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)}),U({threadId:q,text:R().optional()}).strict(),U({kind:K(`application`),value:R().transform((e,t)=>{try{return JSON.parse(e)}catch{return t.addIssue({code:`custom`,message:`Invalid steering context JSON`}),l}}).pipe(U({expectedTurnId:Ro,clientUserMessageId:R().min(1),delivery:G([`newTurn`,`activeTurn`])}).strict())}).strict().transform(e=>e.value),G([`activeTurn`,`newTurn`]),U({delivery:G([`official`,`activeTurn`,`newTurn`])}).strict(),U({threadIds:H(R().min(1))}).strict(),U({threadId:R().min(1).max(1024),pinned:V()}).strict(),U({prompt:R().max(16384).optional()}).strict(),U({projects:H(U({id:R(),name:R(),rootPaths:H(R())})),assignments:Ja(R(),R()),projectless:H(R()),pinned:H(R())});let ps=Ja(R(),Pa()),ms=U({epoch:R().uuid(),sequence:B().int().nonnegative()});Ha(`type`,[U({type:K(`display-settings-changed`),cursor:ms}),U({type:K(`preferences-changed`),cursor:ms,revision:B().int().nonnegative()}),U({type:K(`hello`),version:K(1),cursor:ms,reset:V()}),U({type:K(`changed`),cursor:ms,threadId:R().min(1),method:R().min(1)})]);let hs=Ha(`type`,[U({type:K(`text`),id:R(),prompt:R(),secret:V().optional(),optional:V().optional()}),U({type:K(`choice`),id:R(),prompt:R(),multiple:V(),allowOther:V(),optional:V().optional(),options:H(U({value:R(),label:R(),description:R().optional()}))})]),gs=Ha(`type`,[U({type:K(`approval`),title:R(),description:R().optional(),subject:Pa().optional(),actions:H(U({id:R(),label:R(),effect:R()}))}),U({type:K(`question`),title:R().optional(),questions:H(hs)})]),_s=U({requestId:Ba([R(),B().int()]),threadId:R(),kind:G([`approval`,`question`]),interaction:gs,request:ps}),vs=U({id:R().min(1),clientUserMessageId:R().min(1),input:H(ps),presentationInput:H(ps).nullable().optional()}).passthrough();U({fields:H(U({path:H(Ba([R(),B().int().nonnegative()])),originalLength:B().int().nonnegative()}))});let ys=U({id:R().min(1),status:R().min(1),items:H(U({id:R().min(1),type:R().min(1)}).passthrough()),codexhostFileOperations:H(U({beforeItemId:R().nullable(),item:U({id:R().min(1),type:R().min(1)}).passthrough()})).optional(),error:U({message:R().optional()}).passthrough().nullable().optional(),fingerprint:R().min(1).optional(),unchanged:K(!0).optional()}).passthrough(),bs=U({id:R().min(1).max(512),fingerprint:R().min(1).max(128)});U({threadId:R().min(1),knownTurns:H(bs).max(64).optional(),truncateToolOutput:V().optional()});let xs=U({harnessId:R().min(1),nativeSessionId:R().min(1)});U({cursor:ms,activeTurnId:R().min(1).nullable().optional(),command:U({name:R().min(1),turn:ys}).optional(),thread:U({id:R().min(1),cwd:R(),modelProvider:R().min(1),createdAt:B(),updatedAt:B(),status:U({type:R()}).passthrough(),name:R().nullable().optional(),preview:R().optional(),codexhostImportSource:xs.optional(),turns:H(ys).length(0)}).passthrough(),turnsPage:U({data:H(ys).max(5),nextCursor:R().nullable()}),configuration:U({native:U({model:R().min(1).max(1024).optional(),reasoningEffort:R().min(1).max(128).optional()}).optional(),effectiveModel:ts.optional(),effectiveThinkingOptionId:ns.optional(),effectivePermissionModeId:Bo.optional()}),queue:U({items:H(vs),pausedReason:G([`interrupted`,`outcome-unknown`,`failed`]).nullable()}).optional(),interactions:H(_s)}),U({version:K(1),owner:K(`service`).optional(),pid:B().int().positive(),port:B().int().min(1).max(65535),token:R().regex(/^[0-9a-f]{64}$/u),startedAt:B(),epoch:R().uuid()}),U({epoch:R().uuid(),threadId:R().min(1),requestId:Ba([R(),B().int()]),result:ps}),U({includeArchived:V().optional()}).strict(),U({threads:H(Ao),ownership:H(fs),archivedThreadIds:H(q)}).strict();let Ss=R().regex(/^audio\/[a-z0-9.+-]+(?:\s*;[^\r\n]*)?$/i),Cs=U({available:V()}).strict();U({path:R().min(1),mimeType:Ss}).strict();let ws=G([`credentials-unavailable`,`login-expired`,`rate-limited`,`service-rejected`,`host-incompatible`,`network`,`timeout`,`audio-empty`,`audio-too-large`,`audio-format`,`audio-invalid`]),Ts=Ha(`ok`,[U({ok:K(!0),text:R()}).strict(),U({ok:K(!1),error:U({code:ws}).strict()}).strict()]),Es=U({kind:G([`public`,`relay`,`tailscale-funnel`,`tailscale-https`,`tailscale`,`lan`,`virtual`]),url:R().min(1)}).strict(),Ds=Ha(`status`,[U({status:K(`not-installed`)}),U({status:K(`not-running`)}),U({status:K(`not-logged-in`)}),U({status:K(`https-disabled`)}),U({status:K(`not-serving`),command:R()}),U({status:K(`occupied`),target:R()}),U({status:K(`serving`),url:R(),funnel:V()}),U({status:K(`error`),message:R()})]),Os=U({state:Ds,error:R().optional()}).strict(),ks=Ha(`status`,[U({status:K(`on`)}),U({status:K(`off`)}),U({status:K(`invalid`),reason:R()})]),As=U({lan:V(),autostart:ks}).strict(),js=U({expiresAt:R().optional(),issuing:V(),failure:U({detail:R().optional(),retryAt:R(),paused:V()}).optional()}),Ms=Ha(`status`,[U({status:K(`off`),reason:G([`invite`,`name-taken`,`banned`]).optional()}),U({status:K(`connecting`),reason:G([`full`,`unreachable`]).optional()}),U({status:K(`connected`),url:R(),certificate:js}),U({status:K(`missing-certificate`),url:R(),certificate:js}),U({status:K(`stopped`),reason:G([`replaced`,`rejected`,`unsupported-version`])})]),Ns=R().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()),Ps=R().regex(/^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)?$/),Fs=G([`official`,`self-hosted`]),Is=U({secret:R().min(1),lastUsedAt:B().nullable(),networkUrls:H(Es),directCandidates:H(Es).optional(),tailscale:Ds,background:As.optional(),relay:U({state:Ms,enabled:V(),kind:Fs,officialHost:R(),customHost:R().optional(),officialHostname:R().optional(),customHostname:R().optional(),quotaUntil:R().optional()}).strict().optional()}).strict(),Ls=U({url:R()}).strict(),Rs=W({threadId:R().min(1).max(1024),view:G([`result`,`messages`]),cursor:R().min(1).max(8192).optional(),limit:B().int().min(1).max(100).optional()}),zs=U({id:R().min(1).max(256),harnessId:R().min(1),label:R().min(1).max(512),provider:G([`openai-codex`,`xai`])}).strict(),Bs=R().regex(/^[a-z][a-z0-9-]{0,47}$/),Vs=U({name:Bs,source:zs,importedAt:R()}).strict(),Hs=Ha(`action`,[U({action:K(`list`)}).strict(),U({action:K(`import`),sourceId:R().min(1).max(256),name:Bs,confirmed:K(!0)}).strict(),U({action:K(`reimport`),sourceId:R().min(1).max(256),name:Bs,confirmed:K(!0)}).strict(),U({action:K(`remove`),name:Bs,confirmed:K(!0)}).strict()]),Us=U({provider:R().min(1).max(128),type:G([`oauth`,`api_key`,`unknown`]),label:R().min(1).max(512).optional(),vendor:G([`openai-codex`,`xai`]).optional()}).strict();U({sources:H(zs),targets:H(U({harnessId:R(),providers:H(G([`openai-codex`,`xai`])),imports:H(Vs),others:H(Us).default([])}).strict())}).strict(),U({targetHarnessId:R().min(1).max(128).optional(),request:Hs}).strict(),U({events:V()});let Ws=H(W({agent:R().min(1).max(128),section:G([`main`,`more`,`auto`])})).max(256).refine(e=>new Set(e.map(e=>e.agent)).size===e.length,`Duplicate Harness IDs`);W({entries:Ws.nullable()}),W({}),W({entries:Ws,initializeOnly:V().optional()});let Gs=W({enabled:V(),timeoutMinutes:B().int().min(5).max(1440)});Object.freeze({enabled:!1,timeoutMinutes:30});let Ks=R().regex(/^external$/u),qs=Lo.transform(e=>String(e)),Js=W({model:ts.optional(),thinkingOptionId:ns.optional(),permissionModeId:Bo.optional()}).refine(e=>!!(e.model||e.thinkingOptionId||e.permissionModeId),`A default configuration must contain a preference`),Ys=W({lastHarness:Lo.optional(),byHarness:Ja(qs,Js)}),Xs=R().min(1).max(1024),Zs=W({idleRelease:Gs.optional(),favorites:Ja(qs,H(Xs).max(2048)).default({}),newThread:Ys.optional()});W({scope:Ks,revision:B().int().nonnegative(),values:Zs}),W({scope:Ks.default(`external`)});let Qs=Ha(`kind`,[W({kind:K(`idleRelease`),value:Gs}),W({kind:K(`favorite`),harnessId:Lo,modelId:Xs,enabled:V()}),W({kind:K(`favorites`),harnessId:Lo,modelIds:H(Xs).max(2048)}),W({kind:K(`newThread`),lastHarness:Lo.optional(),harnessId:Lo.optional(),configuration:Js.optional()})]);W({scope:Ks.default(`external`),operations:H(Qs).min(1).max(256),initializeOnly:V().optional(),expectedRevision:B().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`})}),W({version:K(1),revision:B().int().nonnegative(),scopes:Ja(Ks,Zs)});let $s=B().finite().nonnegative(),ec=W({input:$s,output:$s,cacheRead:$s.optional(),cacheWrite:$s.optional(),cacheWrite1h:$s.optional()}),tc=R().max(512).refine(e=>e.trim()===e&&e.length>0,`Model ID is required`);W({path:R(),entries:H(W({key:R(),price:ec})),error:R().nullable()}),W({}),W({key:tc,price:ec.nullable(),previousKey:tc.optional()}),W({model:tc});let nc=W({official:V().optional(),canonicalModelId:R().min(1).optional(),provider:R().min(1).max(512),model:R().min(1).max(512),price:ec});W({price:ec.nullable(),suggestions:H(nc).max(6).optional()});let rc=[`today`,`7d`,`30d`,`90d`,`all`],ic=B().int().min(0).max(2**53-1),ac=R().regex(/^\d{4}-\d{2}-\d{2}$/u),oc=R().min(1).max(128),sc=R().min(1).max(512),cc=R().min(1).max(4096);W({range:G(rc),timeZone:R().min(1).max(128).refine(e=>{try{return new Intl.DateTimeFormat(`en`,{timeZone:e}),!0}catch{return!1}},`Unsupported usage statistics timezone`).optional(),harness:oc.optional(),model:sc.nullable().optional(),project:cc.nullable().optional(),date:ac.optional()});let lc=W({requests:ic,inputTokens:ic,cachedInputTokens:ic,cacheWriteInputTokens:ic,cacheKnownInputTokens:ic,cacheHitCachedInputTokens:ic,cacheHitInputTokens:ic,outputTokens:ic,reasoningOutputTokens:ic,costUsd:B().finite().min(0),unpricedRequests:ic,unmeteredRequests:ic}),uc=lc.shape,dc=W({harness:oc,sessionId:R().min(1).max(512),project:cc.nullable(),title:R().min(1).max(200).optional(),models:H(sc).max(16),firstAtMs:ic,lastAtMs:ic,...uc});W({range:G(rc),from:ac.nullable(),to:ac,filters:W({harness:oc.nullable(),model:sc.nullable(),unknownModel:V(),project:cc.nullable(),unknownProject:V(),date:ac.nullable()}),reading:W({complete:V(),sources:ic,read:ic}),failures:H(W({harness:oc,message:R().max(2048)})).max(256),options:W({harnesses:H(oc).max(256),models:H(sc.nullable()).max(4096),projects:H(cc.nullable()).max(4096)}),modelLabels:H(W({harness:oc,model:sc,label:sc})).max(4096).optional(),credits:H(W({harness:oc,model:sc.nullable(),credits:B().finite().min(0),reportedRequests:ic,requests:ic})).max(4096).optional(),totals:lc,daily:H(W({date:ac,harness:oc,...uc})).max(2e5),hourly:H(W({weekday:B().int().min(0).max(6),hour:B().int().min(0).max(23),...uc})).max(168),byHarness:H(W({harness:oc,...uc})).max(256),byModel:H(W({model:sc.nullable(),...uc,harnessPricedRequests:ic})).max(4096),byProject:H(W({project:cc.nullable(),...uc})).max(4096),sessions:H(dc).max(100),recentSessions:H(dc).max(100).optional()}),U({threadId:q}),U({discarded:V()});let fc=Ha(`type`,[U({id:R().min(1),type:K(`choice`),prompt:R(),options:H(U({value:R().min(1),label:R(),description:R().optional()})).min(1),multiple:V(),allowOther:V(),optional:V()}),U({id:R().min(1),type:K(`text`),prompt:R(),multiline:V(),secret:K(!1),optional:V(),placeholder:R().optional(),prefill:R().optional()})]),pc=U({interactionId:R().min(1),turnId:R().min(1),title:R().optional(),questions:H(fc).min(1)}).refine(({questions:e})=>e.some(e=>e.type===`choice`&&e.multiple),{message:`Shared cards require at least one multi-select question`});W({threadId:R().min(1)}),U({questions:H(pc)}),W({threadId:R().min(1),turnId:R().min(1),interactionId:R().min(1),answers:Ja(R(),H(R())),cancelled:V().default(!1)}),U({accepted:K(!0)});let mc=U({path:R(),oldText:R().nullable(),newText:R()});U({sessionId:R().min(1),turn:B().int().nonnegative(),path:R().min(1).optional()});let hc=U({diffs:H(mc)});W({}),W({}),U({reference:U({sessionId:R().min(1),epoch:R().min(1),turn:B().int().nonnegative(),seq:B().int().nonnegative(),callId:R().min(1),part:B().int().nonnegative(),version:R().min(1)}),length:B().int().nonnegative(),bytes:B().int().nonnegative()}),W({title:R().trim().min(1).max(200),type:G([`info`,`warning`,`danger`]),body:R().trim().min(1).max(16384)}),W({}),W({url:R().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 gc=G([`idle`,`running`,`busy`,`closing`,`failed`,`blocked`]),_c=G([`none`,`disabled`,`timeout`,`operation`,`background`,`identity`,`persistence`,`closeFailed`]);W({threadId:R(),title:R(),harnessId:R(),state:gc,reason:_c,inactiveMs:B().nonnegative()}),W({threadId:q,turnId:Ro});let vc=U({amount:B().finite().nonnegative(),currency:R().trim().min(1).max(8),label:R().trim().min(1).max(128).optional()}).strict(),yc=U({email:R().trim().min(1).max(320).optional(),label:R().trim().min(1).max(256).optional(),plan:R().trim().min(1).max(128).optional(),credits:$o.optional(),balance:vc.optional()}).strict();function bc(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 xc=bc(yc),Sc={harnessId:Lo,harnessName:R().trim().min(1).max(128)},Cc=U(Sc).strict();U({}).strict(),U({sources:H(Cc).max(128)}).strict(),U({harnessId:Lo,refresh:V().optional()}).strict(),U({...Sc,account:xc.nullable(),accounts:H(xc).max(8).optional()}).strict(),U({refresh:V().optional()}).strict(),U({accounts:H(bc(yc.extend(Sc))).max(128)}).strict();let wc=R().min(1).max(128).regex(/^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/u).pipe(Lo),Tc=wc.refine(e=>e!==`codex`,`The official Codex identity is reserved`),Ec=R().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`),Dc=da().refine(e=>/^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(e),`Plugin documentation links must be credential-free HTTPS URLs`),Oc=U({en:R().max(4096),"zh-CN":R().max(4096).optional()}).strict(),kc=U({commands:H(U({terminal:R().max(256),command:R().max(4096)}).strict()).max(8),before:Oc.optional(),after:Oc.optional(),downloads:H(U({label:R().max(128),url:Dc}).strict()).max(8).optional()}).strict(),Ac={id:wc,name:R().trim().min(1).max(128),version:R().min(1).max(128),kind:K(`usage`).optional(),iconStyle:U({vector:U({viewBox:R().max(128).regex(/^-?\d+(?:\.\d+)?(?: +-?\d+(?:\.\d+)?){3}$/u),color:R().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu),paths:H(U({d:R().min(1).max(32768).regex(/^[MmLlHhVvCcSsQqTtAaZz\d.,+eE\s-]+$/u),fillRule:G([`evenodd`,`nonzero`]).optional(),fill:R().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu).optional()}).strict()).min(1).max(32)}).strict().optional(),background:R().regex(/^#[a-f0-9]{6}$/iu).optional(),borderRadius:B().min(0).max(50).optional(),paddingRatio:B().min(0).max(.25).optional()}).strict().optional(),installation:kc.optional(),notice:Oc.optional(),launchCommand:K(!0).optional(),links:U({website:Dc.optional(),documentation:Dc.optional(),installation:Dc.optional()}).strict().optional()};U({manifestVersion:K(1),...Ac,adapterApiVersion:B().int().positive(),entry:Ec,icon:Ec.optional()}).strict();let jc=R().max(174828).regex(/^data:image\/(?:png|jpeg|webp|svg\+xml);base64,[A-Za-z0-9+/]+={0,2}$/u),Mc=U({...Ac,icon:jc.optional()}).strict();U({}).strict(),U({plugins:H(Mc.extend({id:Tc})).max(128)}).strict(),U({version:K(1),enabled:H(wc).max(128)}).strict().refine(e=>new Set(e.enabled).size===e.enabled.length,{message:`Enabled plugin IDs must be unique`,path:[`enabled`]}),U({harnessId:Tc,model:ts.optional(),thinkingOptionId:ns.optional(),permissionModeId:Bo.optional(),prewarm:K(!0).optional()}).strict();let Nc=R().trim().min(1).max(4096).refine(e=>!/[\u0000\r\n]/u.test(e),`Invalid entrypoint path`);U({harnessId:Tc}).strict().extend({path:Nc.nullable()}),U({path:Nc.nullable(),restartRequired:V()}).strict(),U({harnessId:Lo,action:G([`check`,`update`,`install`])}).strict();let Pc=U({currentVersion:R().min(1).max(128),latestVersion:R().min(1).max(128),updateAvailable:V(),canUpdate:V(),versionKind:G([`cli`,`application`]).optional(),manualUpdateUrl:da().max(2048).refine(e=>/^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(e),`Manual updates require a credential-free HTTPS URL`).optional(),message:R().max(2048).optional(),messageCode:R().min(1).max(128).optional(),notice:Fo.optional(),latestVersionKind:G([`unknown`,`tracking-branch`]).optional()}).strict();U({taskId:R().uuid()}).strict(),Ha(`status`,[U({taskId:R().uuid(),status:K(`running`)}).strict(),U({taskId:R().uuid(),status:K(`succeeded`),result:Pc}).strict(),U({taskId:R().uuid(),status:K(`failed`),error:U({code:B().int(),message:R().min(1).max(2048)}).strict()}).strict()]);let Fc=R().min(1).max(256).regex(/^[A-Za-z0-9._~-]+$/u),Ic=R().trim().min(1),Lc=G([`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`]),Rc=U({accountId:Fc,label:Ic.max(256),email:R().email().max(320).optional(),planType:Lc.optional()}).strict(),zc=G([`ready`,`unavailable`]);U({version:K(2),currentAccountId:Fc.nullable(),phase:zc,revision:B().int().nonnegative(),instanceId:Ic.max(1024).optional(),accounts:H(Rc).max(1)}).strict(),U({accountId:Fc,refresh:V().optional()}).strict(),U({accountId:Fc,usage:qo.nullable(),accountCredits:$o.optional(),freshness:G([`live`,`cached`]),observedAt:R().datetime().nullable()}).strict();let Bc=1e3,Vc=R().refine(e=>e.trim().length>0,`Value must not be empty or whitespace`).refine(e=>!e.includes(`\0`),`Value must not contain NUL`),Hc=Vc.max(1024),Uc=U({nativeSessionId:Hc,title:Vc.max(4096).nullable(),updatedAt:B().int().nonnegative().max(864e13),cwd:Vc.max(16384),running:V().nullable()}).strict();U({}).strict();let Wc=U({harnesses:H(U({harnessId:Tc,name:Vc.max(128)}).strict()).max(128)}).strict();U({harnessId:Tc,query:R().trim().max(4096).refine(e=>!e.includes(`\0`)).optional(),offset:B().int().nonnegative().safe().optional(),limit:B().int().min(1).max(Bc).optional()}).strict();let Gc=U({candidates:H(Uc).max(Bc),total:B().int().nonnegative().safe()}).strict();U({harnessId:Tc,nativeSessionId:Hc}).strict();let Kc=U({threadId:Vc.max(1024).pipe(q)}).strict(),qc=R().refine(e=>e.trim().length>0,`Value must not be empty or whitespace`).refine(e=>!e.includes(`\0`),`Value must not contain NUL`),Jc=Hc,Yc=Uc;U({}).strict(),U({candidates:H(Yc).max(1e3)}).strict(),U({nativeSessionId:Jc}).strict(),U({threadId:qc.max(1024).pipe(q)}).strict(),U({threadId:q,lastTurnId:Ro}).strict(),U({threadId:q}).strict();let Xc=R().trim().min(1).max(128).regex(/^[A-Za-z0-9._:-]+$/u).brand();U({commands:H(U({id:Xc,invocation:R().min(1).max(128),label:R().trim().min(1).max(128),description:R().trim().min(1).max(512).optional(),localizations:Po.optional(),argumentMode:G([`none`,`text`]),kind:G([`command`,`skill`]).optional()}).strict()),warnings:H(R().min(1)).optional(),source:G([`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)}),U({harnessId:Lo,cwd:R().min(1).optional()}).strict(),U({threadId:q}).strict(),U({threadId:q,commandId:Xc,turnId:Ro.optional(),arguments:Ao.optional()}).strict(),U({accepted:K(!0),turnId:Ro.optional()}).strict();let Zc=K(`2.0`).optional(),Qc=Ia().optional(),$c=R().min(1),el=Ba([R(),B().int()]),tl=U({code:B().int(),message:R(),data:ko.optional()}).catchall(ko).superRefine(wo([`data`]));Ba([U({jsonrpc:Zc,id:el,method:$c,params:ko.optional(),result:Qc,error:Qc}).catchall(ko).superRefine(wo([`jsonrpc`,`params`,`result`,`error`])),U({jsonrpc:Zc,id:Qc,method:$c,params:ko.optional(),result:Qc,error:Qc}).catchall(ko).superRefine(wo([`jsonrpc`,`id`,`params`,`result`,`error`])),U({jsonrpc:Zc,id:el,method:Qc,params:Qc,result:ko,error:Qc}).catchall(ko).superRefine(wo([`jsonrpc`,`method`,`params`,`error`])),U({jsonrpc:Zc,id:el,method:Qc,params:Qc,result:Qc,error:tl}).catchall(ko).superRefine(wo([`jsonrpc`,`method`,`params`,`result`]))]);let nl=R().refine(e=>e.trim().length>0,{message:`Native identifier must not be empty or whitespace`});W({harnessId:Lo,nativeSessionId:nl,locator:ko.optional(),formatVersion:K(1)}).superRefine(wo([`locator`])),W({harnessId:Lo,nativeSessionId:nl,nativeTurnKey:nl,formatVersion:K(1)}),W({harnessId:Lo,nativeSessionId:nl,checkpointId:nl,locator:ko.optional(),formatVersion:K(1)}).superRefine(wo([`locator`]));let rl=R().regex(/^\d+\.\d+\.\d+(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/u),il=G([`npm`,`windows-installer`,`macos-dmg`]),al=W({version:rl,installation:il,phase:G([`prepared`,`downloading`,`waiting-for-exit`,`installing`,`restarting`,`succeeded`,`failed`]),updatedAt:B().int().nonnegative(),downloadedBytes:B().int().nonnegative().optional(),totalBytes:B().int().positive().optional(),error:R().min(1).max(500).nullable(),serviceStopOutput:R().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`})});W({});let ol=R().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`);W({currentVersion:rl,installation:il.nullable(),latestVersion:rl.nullable(),updateAvailable:V(),installationAvailable:V(),releaseNotes:R().min(1).max(2e4).nullable(),releaseNotesUrl:ol.nullable(),status:al.nullable(),error:R().min(1).max(500).nullable()}),W({status:al}),W({status:al.nullable()});let sl=/^[a-z0-9][a-z0-9-]*$/u;function cl(e){if(!sl.test(e))throw Error(`Invalid delegation mention Harness id: ${e}`);return`subagent://codexhost.${e}`}function ll(e){let t=e.replace(/[[\]()\n\r]+/gu,` `).replace(/\s+/gu,` `).trim();return t.length>0?t:`agent`}function ul(e){return`[@${ll(e.label)}](${cl(e.harnessId)})`}function dl(e){let t=e.trim().replace(/^\//u,``);if(!t||/\s/u.test(t))throw Error(`Invalid Harness command: ${e}`);return`subagent://codexhost-command.${encodeURIComponent(t).replace(/[()]/gu,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)}`}let fl=G([`idle`,`installing`,`restarting`,`succeeded`,`failed`]);U({runningVersion:R().nullable(),installedVersion:R().nullable(),restartRequired:V(),remote:V(),updateSupported:V(),update:U({phase:fl,targetVersion:R().nullable(),error:R().nullable()})});let pl=U({version:R().regex(/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/u)}).strict();U({hostname:R().min(1).max(1024).refine(e=>!e.startsWith(`-`)&&!/\s/u.test(e)),port:B().int().min(1).max(65535).nullable(),identity:R().max(4096).nullable(),action:G([`inspect`,`install`,`update`,`repair`,`uninstall`]),uninstallPackage:V().optional(),version:R().regex(/^\d+\.\d+\.\d+$/u).nullable()}).strict(),U({state:G([`installed`,`not-installed`])}).strict();let ml=R().min(1).max(1024),hl=U({hostId:ml,displayName:R().min(1).max(1024),source:G([`codex-managed`,`discovered`]),sshAlias:R().max(1024).nullable(),sshHost:R().min(1).max(1024),sshPort:B().int().min(1).max(65535).nullable(),identity:R().max(4096).nullable(),autoConnect:V(),connectionAnalyticsId:R().max(1024).optional()}),gl=W({displayName:R().min(1).max(1024),hostname:R().min(1).max(1024),sshPort:B().int().min(1).max(65535).nullable(),identity:R().max(4096).nullable()});Ha(`action`,[W({action:K(`list`)}),W({action:K(`read-thread`),hostId:ml.refine(e=>e!==`local`),input:Rs}),W({action:K(`save`),draft:gl,previous:hl.nullable()}),W({action:K(`remove`),previous:hl}),W({action:K(`connect`),hostId:ml,enabled:V()}),W({action:K(`state`),hostId:ml}),W({action:K(`runtime`),hostId:ml}),W({action:K(`update`),hostId:ml.refine(e=>e!==`local`),version:pl.shape.version})]),Ba([W({result:ko}),W({error:W({code:B().int(),message:R()})})]);let _l=R().max(214).regex(/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/u),vl=Ba([R(),U({en:R()}).catchall(R())]),yl=U({title:vl.optional(),description:vl.optional(),icon:R().max(349592).regex(/^data:image\/(?:svg\+xml|png|jpeg|webp);base64,[A-Za-z0-9+/]*={0,2}$/u).optional(),error:R().optional()}),bl=U({extensions:H(U({id:_l,name:R().min(1).max(214),version:R().min(1).max(128),format:K(`dsh`),supportedTargets:Ka([K(`web`)]),enabledTargets:H(K(`web`)).max(1),source:R().min(1).max(4096),projectUrl:R().max(4096).url({protocol:/^https?$/u}).optional(),installedAt:R(),meta:yl.optional(),loadError:R().optional()})),loadedIds:H(_l),safeMode:V(),storeError:R().optional()}),xl=R().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}/`);U({spec:R().trim().min(1).max(4096),registry:xl.optional()}).strict(),U({id:_l,enabled:V()}).strict(),U({id:_l}).strict(),K(1);function Sl(){let e=globalThis.crypto.getRandomValues(/* @__PURE__ */ new Uint8Array(16)),t=Array.from(e,(e,t)=>(t===6?e&15|64:t===8?e&63|128:e).toString(16).padStart(2,`0`)).join(``);return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}let Cl=[`unsupported`,`permission-denied`,`display-unavailable`,`capture-failed`,`image-too-large`,`busy`,`timeout`,`unavailable`];function wl(e){return typeof e==`string`&&Cl.some(t=>t===e)}var Tl=class extends Error{code;details;constructor(e,t,n){super(e),this.code=t,this.details=n}};async function El(e,t){let n=await fetch(`api/${e}`,{method:`POST`,credentials:`same-origin`,headers:{"content-type":`application/json`},body:JSON.stringify({type:`client-request`,rpcId:Sl(),method:e,payload:{args:t}})});if(!n.ok)throw Error(`HTTP ${String(n.status)}`);let r=await n.json();if(!r.result.ok){let{message:e,code:t,details:n}=r.result.error;throw new Tl(e,t,n)}return r.result.value}let Dl={status:async()=>Cs.parse(await El(`codexhost/voice/status`,{})),transcribe:async(e,t)=>{let n=await fetch(`api/voice/transcribe`,{method:`POST`,credentials:`same-origin`,headers:{"content-type":e.type},body:e,signal:t});return Ts.parse(await n.json())}},Ol=2e4,kl=(e,t)=>new Promise((n,r)=>{if(t.aborted)return r(/* @__PURE__ */ Error(`aborted`));let i=setTimeout(n,e);t.addEventListener(`abort`,()=>{clearTimeout(i),r(/* @__PURE__ */ Error(`aborted`))},{once:!0})}),Al={capture:async(e,t)=>{for(let n=0;;n+=1)try{return await jl(e,t)}catch(t){if(!(t instanceof Error&&t.message===`busy`&&n<3))throw t;await kl(500,e)}}};async function jl(e,t){let n=new AbortController,r=()=>n.abort();e.addEventListener(`abort`,r,{once:!0});let i,a=!1,o=e=>{clearTimeout(i),i=setTimeout(()=>{a=!0,n.abort()},e)};try{o(25e3);let e=await fetch(`api/desktop/screenshot`,{method:`POST`,credentials:`same-origin`,cache:`no-store`,signal:n.signal});if(o(Ol),!e.ok){let t=await e.json().catch(()=>void 0);throw Error(wl(t?.error)?t.error:`unavailable`)}let r=e.headers.get(`x-codexhost-captured-at`);if(e.headers.get(`content-type`)!==`image/png`||r===null||!Number.isFinite(Date.parse(r)))throw Error(`capture-failed`);let i=Number(e.headers.get(`content-length`)),a=Number.isFinite(i)&&i>0?i:void 0;if(t?.({loaded:0,total:a}),e.body===null)return{image:await e.blob(),capturedAt:r};let s=e.body.getReader(),c=[],l=0;for(;;){let{done:e,value:n}=await s.read();if(e)break;o(Ol),c.push(n),l+=n.length,t?.({loaded:l,total:a})}return{image:new Blob(c,{type:`image/png`}),capturedAt:r}}catch(t){throw a&&!e.aborted?Error(`timeout`):t}finally{clearTimeout(i),e.removeEventListener(`abort`,r)}}let Ml={relay:async(e,t)=>Ms.parse(await El(`codexhost/relaySet`,{enabled:e,...t})),lan:e=>El(`codexhost/lanSet`,{enabled:e}),autostart:async e=>ks.parse(await El(`codexhost/autostartSet`,{enabled:e})),serve:async e=>Os.parse(await El(`codexhost/tailscaleServeSet`,{enabled:e})),get:async()=>Is.parse(await El(`codexhost/accessTokenGet`,{})),regenerate:async()=>Is.parse(await El(`codexhost/accessTokenRegenerate`,{}))},Nl={config:()=>El(`codexhost/pushConfig`,{}),subscribe:e=>El(`codexhost/pushSubscribe`,{subscription:e,userAgent:navigator.userAgent}),unsubscribe:e=>El(`codexhost/pushUnsubscribe`,{endpoint:e}),test:()=>El(`codexhost/pushTest`,{})},Pl={sources:async()=>Wc.parse(await El(`codexhost/importSources`,{})),candidates:async e=>Gc.parse(await El(`codexhost/importCandidates`,{request:e})),importSession:async(e,t)=>Kc.parse(await El(`codexhost/import`,{request:{harnessId:e,nativeSessionId:t}}))},Fl={read:async(e,t,n)=>hc.parse(await El(`codexhost/turnDiffs`,{request:{sessionId:e,turn:t,...n===void 0?{}:{path:n}}})).diffs},Il={send:(e,t,n)=>El(`codexhost/editMessage`,{request:{sessionId:e,atSeq:t,text:n}})},Ll={inspect:e=>El(`codexhost/threadCommands`,{request:{sessionId:e}}),execute:(e,t)=>El(`codexhost/executeThreadCommand`,{request:{sessionId:e,commandId:t}})},Rl=`codexhost-native`;function zl(e){let t=dl(e),n=`[@${e.replace(/[\[\]\r\n]/gu,` `)}](${t})`;return{source:Rl,ref:n,label:e,clipboardText:n}}let Bl=`codexhost-delegation`;function Vl(e){let t=e.get(`connection`),n=/* @__PURE__ */ new Map,a=/* @__PURE__ */ new WeakMap,o=/* @__PURE__ */ new Set,s=0,c=/* @__PURE__ */ new Set,l=e.locale.bind(`codexhostImport`),u=()=>{for(let e of c)e()},d=t=>{let n=e.sessions.list.getSnapshot().byId[t];return!!n&&!n.blank&&n.projectionValues?.nativeDiscovery===!0&&n.projectionValues.threadReference?.hostId===`local`&&e.sessions.subagentAddress(t)===void 0},f=t=>{let n=e.sessions.list.getSnapshot().byId[t];return d(t)||n?.blank===!0&&n.projectionValues?.harnessIdentity!=null&&e.sessions.subagentAddress(t)===void 0},p=n=>{let r=e.sessions.list.getSnapshot().byId[n];if(!t.generation.getSnapshot()||r?.projectionValues?.nativeConnection?.state===`reconnecting`)return l(`discovery.offline`);if(o.has(n))return l(`discovery.pending`);if(r?.running)return l(`discovery.busy`)},m=t=>{let n=e.sessions.scope(t);return n?.get(`conversation`)?.input.for(n)},h=(e,t)=>m(e)?.notify(`error`,t),g=(t,r)=>{let i=n.get(t);return(!i||i.epoch!==r.menuEpoch||i.generation!==s)&&(i={epoch:r.menuEpoch,generation:s,connection:e.sessions.list.getSnapshot().byId[t]?.projectionValues?.nativeConnection?.state,promise:Promise.all([Ll.inspect(t),e.commandUi.reservedNames({sessionId:t})]).then(([e,t])=>({catalog:e,reserved:t}))},n.set(t,i)),i},_=({sessionId:t},r)=>{c.add(r);let i=e.sessions.list.subscribe(r),a=e.modelDirectories.harnessCatalog.subscribe(r);return()=>{c.delete(r),i(),a(),n.delete(t)}};e.effect(()=>t.generation.subscribe(()=>{s++,n.clear(),u()}),`ui-codexhost: browser connection generation`),e.effect(()=>e.sessions.list.subscribe(()=>{let t=!1,r=e.sessions.list.getSnapshot().byId;for(let[e,i]of n)i.connection!==r[e]?.projectionValues?.nativeConnection?.state&&(n.delete(e),t=!0);t&&u()}),`ui-codexhost: discovery connection generation`);let v=(t,n)=>{let r=t.session.sessionId,i=p(r);if(!d(r)||i){h(r,i??l(`discovery.stale`));return}let a=e.sessions.scope(r),s=m(r);a&&s?.state.getSnapshot().draftRev===t.span.draftRev&&(t.span.start===t.span.end||a.bail(a,`slash/input-consume-token`,{guard:{kind:`span`,span:t.span}})===!0)&&(o.add(r),u(),Ll.execute(r,n).catch(e=>h(r,`${l(`discovery.unconfirmed`)} ${e instanceof Error?e.message:String(e)}`)).finally(()=>{o.delete(r),u()}))};e.effect(()=>e.inputTriggers.registerSource({trigger:`/`,aliases:[`#`,`@`],name:Rl,codec:{clipboardText:e=>e,serialize:async e=>e},launcher:`command`,order:20,showGroupTitle:!1,subscribeCandidates:_,candidates:async({sessionId:e},r)=>{if(!d(e))return[];if(!t.generation.getSnapshot())return[{name:l(`discovery.retry`),value:`retry`,section:l(`discovery.commands`),description:l(`discovery.offline`)}];let i=g(e,r);try{let{catalog:t,reserved:o}=await i.promise;if(n.get(e)!==i||!d(e))return[];let s=r.query.toLocaleLowerCase(),c=t.commands.filter(e=>`${e.invocation} ${e.label}`.toLocaleLowerCase().includes(s)).toSorted((e,t)=>Number(e.kind===`skill`)-Number(t.kind===`skill`)).map(t=>{let n=o.has(t.invocation)?l(`discovery.conflict`):t.argumentMode===`none`||t.invocation===`/compact`?p(e):void 0,r={name:t.invocation,label:t.kind===`skill`?t.label.replace(/^\/?skill:/iu,``):t.label,showAlias:t.kind!==`skill`,value:t.id,section:l(t.kind===`skill`?`discovery.skills`:`discovery.commands`),description:t.description,...n?{disabledReason:n}:{}};return a.set(r,{command:t,entry:i}),r});return t.warnings?.length&&!s&&c.push({name:l(`discovery.retry`),value:`retry`,section:l(`discovery.commands`),description:t.warnings.join(`
123
+ `)}),t.source===`static`&&!s&&c.push({name:l(`discovery.static`),disabledReason:l(`discovery.static`),section:l(`discovery.commands`)}),!t.commands.length&&!s&&t.source!==`static`&&c.push({name:l(`discovery.empty`),disabledReason:l(`discovery.empty`),section:l(`discovery.commands`)}),c.toSorted((e,t)=>Number(e.section===l(`discovery.skills`))-Number(t.section===l(`discovery.skills`)))}catch(t){return n.get(e)===i?[{name:l(`discovery.retry`),value:`retry`,section:l(`discovery.commands`),description:`${l(`discovery.failed`)} ${t instanceof Error?t.message:String(t)}`}]:[]}},onPick:e=>{let t=e.session.sessionId;if(!d(t))return h(t,l(`discovery.stale`)),`handled`;if(e.candidate.value===`retry`)return n.delete(t),`refresh`;let r=n.get(t);if(!r||r.generation!==s)return h(t,l(`discovery.stale`)),`handled`;let i=e.candidate.value;if(!i||e.candidate.disabledReason)return`handled`;let o=a.get(e.candidate),c=o?.entry===r?o.command:void 0;if(!c)return h(t,l(`discovery.stale`)),`handled`;if(c.argumentMode===`none`||c.invocation===`/compact`)return v(e,i),`handled`;try{return{insert:zl(c.invocation)}}catch{return h(t,l(`discovery.stale`)),`handled`}}}),`ui-codexhost: native discovery`),e.effect(()=>e.inputTriggers.registerSource({trigger:`@`,aliases:[`#`],name:Bl,launcher:`command`,launcherOrder:30,order:10,showGroupTitle:!1,codec:{clipboardText:e=>e,serialize:async e=>e},subscribeCandidates:_,candidates:async({sessionId:t},n)=>f(t)?(e.modelDirectories.harnessCatalog.getSnapshot().value?.groups??[]).filter(e=>`${e.name} ${e.id}`.toLocaleLowerCase().includes(n.query.toLocaleLowerCase())).map(e=>({name:e.id,label:e.name,value:e.id,section:l(`discovery.agents`),icon:t=>/* @__PURE__ */ (0,i.jsx)(r.RemotePluginIcon,{id:e.id,src:`/harness-icons/${encodeURIComponent(e.id)}`,presentationUrl:`/harness-icons/presentation.json`,size:t.size??14,fallback:/* @__PURE__ */ (0,i.jsx)(r.IconDataOutlineRegular,{size:t.size??14})})})):[],onPick:t=>{let n=e.modelDirectories.harnessCatalog.getSnapshot().value?.groups.find(e=>e.id===t.candidate.value);if(!f(t.session.sessionId)||!n)return h(t.session.sessionId,l(`discovery.stale`)),`handled`;let r=ul({harnessId:n.id,label:n.name});return{insert:{source:Bl,ref:r,label:n.name,appearance:`session`,clipboardText:r}}}}),`ui-codexhost: delegation discovery`)}function Hl(e){let t=e.replace(/[/\\]+$/,``),n=Math.max(t.lastIndexOf(`/`),t.lastIndexOf(`\\`));return t.slice(n+1)}let Ul=`codexhost-thread`,Wl=/(?<![\w:/])(?:codex:\/\/threads\/|thread:\/\/)[^\s<>()\[\]`"',。!?;:、]+(?<![.,;])/gu;function Gl(e){if(!(e.blank||e.projectionValues?.threadReference?.hostId!==`local`))return{threadId:e.id,hostId:`local`,title:e.title?.replace(/[\s\u0000-\u001f\u007f]+/gu,` `).trim()||e.id.slice(0,8)}}function Kl(e){return`thread://${encodeURIComponent(e.threadId).replace(/[!'()*]/gu,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)}?hostId=local`}function ql(e){if(e.trim()!==e)return;let t=/^codex:\/\/threads\/([^/?#\s<>]+)$/u.exec(e)??/^thread:\/\/([^/?#\s<>]+)\?hostId=local$/u.exec(e);if(t?.[1]!==void 0)try{let e=decodeURIComponent(t[1]);return e&&!/[\u0000-\u001f\u007f]/u.test(e)?e:void 0}catch{return}}function Jl(e){let t=`[@${e.title.replace(/[\\`*{}[\]()#+.!_<>|~-]/gu,e=>`\\${e}`)}](${Kl(e)})`;return{source:Ul,ref:t,label:e.title,appearance:`session`,clipboardText:t}}function Yl(e){let t=e.locale.bind(`codexhostImport`),n=/* @__PURE__ */ new WeakMap,r=t=>{let n=e.sessions.list.getSnapshot().byId[t];return n!==void 0&&e.sessions.subagentAddress(t)===void 0&&(Gl(n)!==void 0||n.blank&&n.projectionValues?.harnessIdentity!=null)};e.effect(()=>e.inputTriggers.registerSource({trigger:`@`,aliases:[`#`],name:Ul,launcher:`command`,order:25,showGroupTitle:!1,codec:{clipboardText:e=>e,serialize:async e=>e},subscribeCandidates:(t,n)=>{let r=e.sessions.list.subscribe(n),i=e.workspaces.list.subscribe(n);return()=>{r(),i()}},candidates:async({sessionId:i},a)=>{if(!r(i))return[];let o=a.menuEpoch===void 0?void 0:n.get(a.menuEpoch);if(o===void 0&&(o=e.sessions.refresh(),a.menuEpoch!==void 0&&n.set(a.menuEpoch,o)),await o,a.signal.throwIfAborted(),!r(i))return[];let s=e.sessions.list.getSnapshot(),c=e.workspaces.list.getSnapshot(),l=new Set(c.archivedSessionIds),u=/* @__PURE__ */ new Map;for(let e of c.items)for(let t of e.sessionIds)u.has(t)||u.set(t,e.title);let d=a.query.trim().toLowerCase();return s.ids.flatMap(e=>{let t=s.byId[e];if(t===void 0||e===i||l.has(e))return[];let n=Gl(t);if(n===void 0)return[];let r=u.get(e)??(Hl(t.cwd??``)||t.cwd||``);return!n.title.toLowerCase().includes(d)&&!r.toLowerCase().includes(d)?[]:[{reference:n,workspace:r,updatedAt:t.updatedAt}]}).sort((e,t)=>t.updatedAt-e.updatedAt||e.reference.threadId.localeCompare(t.reference.threadId)).slice(0,d===``?5:void 0).map(({reference:e,workspace:n})=>({name:e.threadId,label:e.title,value:e.threadId,showAlias:!1,section:t(`discovery.sessions`),description:[n,e.threadId].filter(Boolean).join(` · `),icon:`session`}))},onPick:t=>{let n=t.candidate.value;if(n===void 0)return`handled`;let i=e.sessions.list.getSnapshot(),a=i.ids.includes(n)?i.byId[n]:void 0,o=a===void 0?void 0:Gl(a);return!r(t.session.sessionId)||o===void 0||n===t.session.sessionId||e.workspaces.list.getSnapshot().archivedSessionIds.includes(n)?`handled`:{insert:Jl(o)}}}),`ui-codexhost: Thread reference discovery`)}let Xl={sessionId:void 0,pending:!1,startedAt:void 0,progress:void 0,image:void 0,error:void 0};var Zl=class{capture;store=(0,a.createSnapshotStore)(Xl);request;constructor(e){this.capture=e}getSnapshot=()=>this.store.getSnapshot();subscribe=e=>this.store.subscribe(e);refresh=async e=>{let t=this.request;if(t!==void 0){let e=this.getSnapshot().startedAt??0;if(Date.now()-e<3e3)return;this.request=void 0,t.abort()}this.getSnapshot().sessionId!==e&&this.close();let n=new AbortController;this.request=n,this.store.set({...this.getSnapshot(),sessionId:e,pending:!0,startedAt:Date.now(),progress:void 0,error:void 0});try{let t=await this.capture(n.signal,e=>{this.request===n&&this.store.set({...this.getSnapshot(),progress:e})});if(this.request!==n||n.signal.aborted)return;let r=this.getSnapshot().image,i={url:URL.createObjectURL(t.image),capturedAt:t.capturedAt};this.store.set({sessionId:e,pending:!1,startedAt:void 0,progress:void 0,image:i,error:void 0}),r!==void 0&&URL.revokeObjectURL(r.url)}catch(e){if(this.request!==n||n.signal.aborted)return;let t=e instanceof Error?e.message:e;this.store.set({...this.getSnapshot(),pending:!1,startedAt:void 0,progress:void 0,error:wl(t)?t:`unavailable`})}finally{this.request===n&&(this.request=void 0)}};cancel=()=>{let e=this.request;e!==void 0&&(this.request=void 0,e.abort(),this.store.set({...this.getSnapshot(),pending:!1,startedAt:void 0,progress:void 0}))};close=e=>{if(e!==void 0&&this.getSnapshot().sessionId!==e)return;let t=this.request;this.request=void 0,t?.abort();let n=this.getSnapshot().image;this.store.set(Xl),n!==void 0&&URL.revokeObjectURL(n.url)}};let Ql=[`#ff3b30`,`#ffcc00`,`#0a84ff`];function $l(e,t,n){return n===90?{x:t,y:-e}:n===270?{x:-t,y:e}:{x:e,y:t}}function eu(e){return Math.max(4,Math.round(e/250))}function tu(e,t,n){let[r,...i]=t.points;if(r===void 0)return;let a=i.at(-1)??r;if(e.save(),e.strokeStyle=t.color,e.fillStyle=t.color,e.lineWidth=n,e.lineCap=`round`,e.lineJoin=`round`,e.beginPath(),t.tool===`pen`){e.moveTo(r.x,r.y),i.length===0&&e.lineTo(r.x+.01,r.y);for(let t of i)e.lineTo(t.x,t.y);e.stroke()}else if(t.tool===`rect`)e.rect(Math.min(r.x,a.x),Math.min(r.y,a.y),Math.abs(a.x-r.x),Math.abs(a.y-r.y)),e.stroke();else{let t=Math.atan2(a.y-r.y,a.x-r.x),i=n*4;e.moveTo(r.x,r.y),e.lineTo(a.x,a.y),e.stroke(),e.beginPath(),e.moveTo(a.x,a.y);for(let n of[-1,1])e.lineTo(a.x-i*Math.cos(t+n*Math.PI/7),a.y-i*Math.sin(t+n*Math.PI/7)),e.moveTo(a.x,a.y);e.stroke()}e.restore()}function nu(e,t,n){let r=Math.min(Math.max(Math.min(e.x,t.x),0),n.width),i=Math.min(Math.max(Math.max(e.x,t.x),0),n.width),a=Math.min(Math.max(Math.min(e.y,t.y),0),n.height),o=Math.min(Math.max(Math.max(e.y,t.y),0),n.height);return{x:r,y:a,width:i-r,height:o-a}}function ru(e,t,n){let r=[[`tl`,e.x,e.y],[`tr`,e.x+e.width,e.y],[`bl`,e.x,e.y+e.height],[`br`,e.x+e.width,e.y+e.height]];for(let[e,i,a]of r)if(Math.hypot(t.x-i,t.y-a)<=n)return e;return t.x>=e.x&&t.x<=e.x+e.width&&t.y>=e.y&&t.y<=e.y+e.height?`inside`:void 0}function iu(e,t){return{x:t===`tl`||t===`bl`?e.x+e.width:e.x,y:t===`tl`||t===`tr`?e.y+e.height:e.y}}function au(e,t,n,r){return{...e,x:Math.min(Math.max(e.x+t,0),r.width-e.width),y:Math.min(Math.max(e.y+n,0),r.height-e.height)}}function ou(e,t,n,r){e.save(),e.fillStyle=`rgba(0, 0, 0, 0.55)`,e.beginPath(),e.rect(0,0,n.width,n.height),e.rect(t.x,t.y,t.width,t.height),e.fill(`evenodd`),e.strokeStyle=`#fff`,e.lineWidth=2*r,e.strokeRect(t.x,t.y,t.width,t.height),e.fillStyle=`#fff`;for(let[n,i]of[[t.x,t.y],[t.x+t.width,t.y],[t.x,t.y+t.height],[t.x+t.width,t.y+t.height]])e.beginPath(),e.arc(n,i,7*r,0,Math.PI*2),e.fill();e.restore()}let su=`@deepseek-ai/dsh-client-ui-codexhost/DesktopScreenshotViewer.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(su)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-codexhost`,e.dataset.pluginCss=su,e.textContent=`.B2I-aa_root{z-index:1000;color:#fff;background:#000;position:fixed;inset:0;overflow:hidden}.B2I-aa_stage{position:absolute;top:50%;left:50%}.B2I-aa_top,.B2I-aa_bottom{z-index:2;pointer-events:none;transition:opacity .15s;position:absolute;left:0;right:0}.B2I-aa_top *,.B2I-aa_bottom *{pointer-events:auto}.B2I-aa_top{padding-top:env(safe-area-inset-top);background:linear-gradient(#000000b3,#0000);top:0}.B2I-aa_bottom{padding-bottom:env(safe-area-inset-bottom);background:linear-gradient(#0000,#000000b3);bottom:0}.B2I-aa_hidden{visibility:hidden;opacity:0}.B2I-aa_bar{flex-wrap:wrap;align-items:center;gap:8px;padding:8px 12px;display:flex}.B2I-aa_spacer{flex:1}.B2I-aa_text,.B2I-aa_primary{min-width:44px;min-height:44px;color:inherit;font:inherit;cursor:pointer;touch-action:manipulation;background:#ffffff1f;border:0;border-radius:10px;padding:0 12px;font-size:14px}.B2I-aa_text[aria-pressed=true]{background:#ffffff52}.B2I-aa_text:disabled{opacity:.4;cursor:default}.B2I-aa_primary{background:var(--dsw-alias-button-info-fill,#3964fe)}.B2I-aa_swatch{cursor:pointer;touch-action:manipulation;border:2px solid #0000;border-radius:50%;width:28px;height:28px;padding:0}.B2I-aa_swatch[aria-pressed=true]{border-color:#fff;box-shadow:0 0 0 2px #0009}.B2I-aa_area{touch-action:none;place-items:center;display:grid;position:absolute;inset:0;overflow:hidden}.B2I-aa_area[data-annotating]{cursor:crosshair}.B2I-aa_zoomBadge{z-index:3;min-height:36px;color:inherit;font:inherit;cursor:pointer;background:#fff3;border:0;border-radius:18px;padding:0 12px;font-size:13px;position:absolute;top:72px;right:12px}.B2I-aa_canvas{background:#000;max-width:none;display:block}.B2I-aa_error{color:#ff8a80;margin:0;padding:4px 12px;font-size:13px}.B2I-aa_compose{flex:1 0 100%;gap:8px;display:flex}.B2I-aa_message{min-width:0;min-height:44px;color:inherit;font:inherit;background:#ffffff1a;border:1px solid #ffffff40;border-radius:22px;flex:1;padding:0 14px;font-size:16px}.B2I-aa_message::placeholder{color:#ffffff8c}.B2I-aa_primary:disabled{opacity:.5;cursor:default}.B2I-aa_hint{pointer-events:none;background:#fff3;border-radius:18px;margin:0;padding:8px 14px;font-size:13px;position:absolute;top:64px;left:50%;transform:translate(-50%)}.B2I-aa_cropHint,.B2I-aa_cropSize{color:#ffffffbf;font-size:13px}.B2I-aa_cropSize{font-variant-numeric:tabular-nums}.B2I-aa_wide .B2I-aa_compose{flex:320px}`,document.head.appendChild(e)}var J={area:`B2I-aa_area`,bar:`B2I-aa_bar`,bottom:`B2I-aa_bottom`,canvas:`B2I-aa_canvas`,compose:`B2I-aa_compose`,cropHint:`B2I-aa_cropHint`,cropSize:`B2I-aa_cropSize`,error:`B2I-aa_error`,hidden:`B2I-aa_hidden`,hint:`B2I-aa_hint`,message:`B2I-aa_message`,primary:`B2I-aa_primary`,root:`B2I-aa_root`,spacer:`B2I-aa_spacer`,stage:`B2I-aa_stage`,swatch:`B2I-aa_swatch`,text:`B2I-aa_text`,top:`B2I-aa_top`,wide:`B2I-aa_wide`,zoomBadge:`B2I-aa_zoomBadge`};function cu(e){let t=window.visualViewport;return e&&t!==null?{width:t.width,height:t.height,x:t.offsetLeft,y:t.offsetTop}:{width:window.innerWidth,height:window.innerHeight,x:0,y:0}}let lu,uu=`codexhost.screenshot.zoom-hint`,du=[`pen`,`rect`,`arrow`];function fu(e){let[t,n]=(0,o.useState)();return(0,o.useEffect)(()=>{let t=!0,r=new Image;return r.onload=()=>{t&&n(r)},r.src=e,()=>{t=!1}},[e]),t}function pu({src:e,t,onClose:n,onAttach:r,onSend:a}){let[c,l]=(0,o.useState)(),u=fu(c?.url??e),[d,f]=(0,o.useState)(lu??0),p=e=>{lu=e,f(e)},[m,h]=(0,o.useState)(!1),[g,_]=(0,o.useState)(!1),[v,y]=(0,o.useState)(),b=(0,o.useRef)(0),x=(0,o.useRef)(),[S,C]=(0,o.useState)(`pen`),[w,T]=(0,o.useState)(Ql[0]),[E,D]=(0,o.useState)([]),[O,ee]=(0,o.useState)(),[te,k]=(0,o.useState)(),[A,ne]=(0,o.useState)(!0),j=(0,o.useRef)(),[M,re]=(0,o.useState)(``),[ie,ae]=(0,o.useState)(!1),[oe,se]=(0,o.useState)(()=>{try{return localStorage.getItem(uu)!==`1`}catch{return!1}}),[ce,le]=(0,o.useState)(!1),ue=(0,o.useRef)(),de=(0,o.useRef)(null),[fe,pe]=(0,o.useState)(()=>cu(!1)),[me,he]=(0,o.useState)({width:0,height:0}),ge=(0,o.useRef)(null),_e=(0,o.useRef)(null),ve=(0,o.useRef)(null);(0,o.useEffect)(()=>{let e=()=>pe(cu(ce));e(),window.addEventListener(`resize`,e),window.visualViewport?.addEventListener(`resize`,e),window.visualViewport?.addEventListener(`scroll`,e);let t=setTimeout(e,400);return()=>{clearTimeout(t),window.removeEventListener(`resize`,e),window.visualViewport?.removeEventListener(`resize`,e),window.visualViewport?.removeEventListener(`scroll`,e)}},[ce,d]),(0,o.useEffect)(()=>{let e=_e.current;if(e===null)return;let t=new ResizeObserver(()=>he({width:e.clientWidth,height:e.clientHeight}));return t.observe(e),()=>t.disconnect()},[]),(0,o.useEffect)(()=>()=>{c!==void 0&&URL.revokeObjectURL(c.url)},[c]),(0,o.useEffect)(()=>ve.current?.focus(),[]),(0,o.useEffect)(()=>{let e=document.body.style.overflow;return document.body.style.overflow=`hidden`,()=>{document.body.style.overflow=e,clearTimeout(ue.current)}},[]),(0,o.useEffect)(()=>{if(!oe)return;try{localStorage.setItem(uu,`1`)}catch{}let e=setTimeout(()=>se(!1),4500);return()=>clearTimeout(e)},[oe]);let ye=(0,o.useRef)({annotating:m,cropping:g,onClose:n});ye.current={annotating:m,cropping:g,onClose:n},(0,o.useEffect)(()=>{let e=e=>{e.key===`Escape`&&(e.stopPropagation(),ye.current.annotating?h(!1):ye.current.cropping?He():ye.current.onClose())};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[]);let be=u===void 0||me.width===0?0:Math.min(me.width/u.naturalWidth,me.height/u.naturalHeight),[xe,Se]=(0,o.useState)(1),[Ce,we]=(0,o.useState)({x:0,y:0}),N=(0,o.useRef)(/* @__PURE__ */ new Map),Te=(0,o.useRef)(),Ee=(0,o.useRef)(),De=(0,o.useRef)({zoom:xe,pan:Ce,rotation:d});De.current={zoom:xe,pan:Ce,rotation:d};let Oe=(e,t)=>{let n=_e.current?.getBoundingClientRect();return n===void 0?{x:0,y:0}:$l(e-(n.left+n.width/2),t-(n.top+n.height/2),De.current.rotation)},ke=(e,t)=>{let n=u===void 0?0:u.naturalWidth*be*t,r=u===void 0?0:u.naturalHeight*be*t;return{x:Math.min(Math.max(e.x,-n/2),n/2),y:Math.min(Math.max(e.y,-r/2),r/2)}},Ae=(e,t,n=De.current)=>{let r=Math.min(Math.max(e,1),8),i=r/n.zoom;Se(r),we(r===1?{x:0,y:0}:ke({x:t.x-i*(t.x-n.pan.x),y:t.y-i*(t.y-n.pan.y)},r))},je=()=>{Se(1),we({x:0,y:0})},Me=u===void 0?4:eu(u.naturalWidth);(0,o.useEffect)(()=>{let e=ge.current,t=e?.getContext(`2d`);if(e!==null&&t&&u!==void 0){e.width=u.naturalWidth,e.height=u.naturalHeight,t.drawImage(u,0,0);for(let e of O===void 0?E:[...E,O])tu(t,e,Me);g&&v!==void 0&&ou(t,v,{width:e.width,height:e.height},1/Math.max(xe*be,.01))}},[u,E,O,Me,g,v,xe,be]),(0,o.useEffect)(()=>{let e=_e.current;if(e===null)return;let t=e=>{e.preventDefault(),Ae(De.current.zoom*Math.exp(-e.deltaY*.0015),Oe(e.clientX,e.clientY))};return e.addEventListener(`wheel`,t,{passive:!1}),()=>e.removeEventListener(`wheel`,t)});let Ne=e=>{if(u===void 0||be===0)return;let t=Oe(e.clientX,e.clientY),n=(t.x-Ce.x)/(xe*be)+u.naturalWidth/2,r=(t.y-Ce.y)/(xe*be)+u.naturalHeight/2;return{x:Math.min(Math.max(n,0),u.naturalWidth),y:Math.min(Math.max(r,0),u.naturalHeight)}},Pe=()=>{let[e,t]=[...N.current.values()];e!==void 0&&t!==void 0&&(Te.current={distance:Math.max(1,Math.hypot(t.x-e.x,t.y-e.y)),mid:Oe((e.x+t.x)/2,(e.y+t.y)/2),zoom:xe,pan:Ce},Ee.current=void 0,ee(void 0))},Fe=e=>{if(e.target.closest(`button`)===null){if(e.currentTarget.setPointerCapture(e.pointerId),N.current.set(e.pointerId,{x:e.clientX,y:e.clientY}),N.current.size===1?j.current={x:e.clientX,y:e.clientY,at:Date.now(),multi:!1}:j.current!==void 0&&(j.current.multi=!0),N.current.size===2)Pe();else if(!(N.current.size>2)){if(g){let t=Ne(e);if(t===void 0||u===void 0)return;let n=v,r=n===void 0?void 0:ru(n,t,28/(xe*be));n!==void 0&&r!==void 0&&r!==`inside`?x.current={kind:`resize`,anchor:iu(n,r),before:n}:n!==void 0&&r===`inside`?x.current={kind:`move`,start:t,before:n}:(x.current={kind:`new`,from:t,before:n},y(nu(t,t,{width:u.naturalWidth,height:u.naturalHeight})))}else if(m){let t=Ne(e);t!==void 0&&ee({tool:S,color:w,points:[t]})}else Ee.current={at:Oe(e.clientX,e.clientY),pan:Ce}}}},Ie=e=>{if(!N.current.has(e.pointerId))return;N.current.set(e.pointerId,{x:e.clientX,y:e.clientY});let t=Te.current;if(t!==void 0&&N.current.size>=2){let[e,n]=[...N.current.values()];if(e===void 0||n===void 0)return;let r=Math.hypot(n.x-e.x,n.y-e.y),i=Oe((e.x+n.x)/2,(e.y+n.y)/2),a=Math.min(Math.max(t.zoom*(r/t.distance),1),8),o=a/t.zoom;Se(a),we(a===1?{x:0,y:0}:ke({x:i.x-o*(t.mid.x-t.pan.x),y:i.y-o*(t.mid.y-t.pan.y)},a))}else if(x.current!==void 0&&u!==void 0){let t=Ne(e);if(t===void 0)return;let n={width:u.naturalWidth,height:u.naturalHeight},r=x.current;r.kind===`move`?y(au(r.before,t.x-r.start.x,t.y-r.start.y,n)):y(nu(r.kind===`new`?r.from:r.anchor,t,n))}else if(O!==void 0){let t=Ne(e);if(t===void 0)return;ee({...O,points:O.tool===`pen`?[...O.points,t]:[O.points[0]??t,t]})}else if(Ee.current!==void 0&&xe>1){let t=Oe(e.clientX,e.clientY);we(ke({x:Ee.current.pan.x+t.x-Ee.current.at.x,y:Ee.current.pan.y+t.y-Ee.current.at.y},xe))}},Le=(e,t)=>{if(!N.current.has(e.pointerId))return;N.current.delete(e.pointerId);let n=j.current;!t&&n!==void 0&&!n.multi&&N.current.size===0&&!m&&!g&&Date.now()-n.at<500&&Math.hypot(e.clientX-n.x,e.clientY-n.y)<8&&ne(e=>!e),N.current.size===0&&(j.current=void 0),N.current.size<2&&(Te.current=void 0),Ee.current=void 0;let r=x.current;x.current=void 0,r!==void 0&&(t||(v?.width??0)<24||(v?.height??0)<24)&&y(r.before),O!==void 0&&!t&&D(e=>[...e,O]),ee(void 0)},Re=()=>{N.current.clear(),Te.current=void 0,Ee.current=void 0,x.current=void 0,j.current=void 0,ee(void 0)},ze=()=>{clearTimeout(ue.current),de.current?.blur(),le(!1)},Be=e=>{ze(),Re(),e===`annotate`?h(!0):Ve()};(0,o.useEffect)(()=>{let e=()=>Re();return window.addEventListener(`blur`,e),document.addEventListener(`visibilitychange`,e),()=>{window.removeEventListener(`blur`,e),document.removeEventListener(`visibilitychange`,e)}},[]);let Ve=()=>{if(u===void 0)return;let{naturalWidth:e,naturalHeight:t}=u;y({x:e*.1,y:t*.1,width:e*.8,height:t*.8}),_(!0),je()};function He(){b.current++,_(!1),y(void 0)}let Ue=v!==void 0&&v.width>=24&&v.height>=24,We=()=>{if(u===void 0||v===void 0||!Ue)return;let e=++b.current,n=document.createElement(`canvas`);n.width=Math.round(v.width),n.height=Math.round(v.height),n.getContext(`2d`)?.drawImage(u,v.x,v.y,v.width,v.height,0,0,n.width,n.height),n.toBlob(n=>{e===b.current&&(n===null?k(t(`desktop.annotate.failed`)):(l({url:URL.createObjectURL(n),blob:n}),D([]),He(),je()))},`image/png`)},Ge=()=>{let e=ge.current;if(e===null)return;if(E.length===0){h(!1);return}let n=++b.current;e.toBlob(e=>{n===b.current&&(e===null?k(t(`desktop.annotate.failed`)):(l({url:URL.createObjectURL(e),blob:e}),D([]),h(!1)))},`image/png`)},Ke=async()=>{try{let t=r(c?.blob??await(await fetch(e)).blob());t===null?n():k(t)}catch{k(t(`desktop.annotate.failed`))}},qe=async()=>{if(!ie){ae(!0),k(void 0);try{let t=await a(c?.blob??await(await fetch(e)).blob(),M.trim());t===null?n():k(t)}catch{k(t(`desktop.annotate.failed`))}finally{ae(!1)}}},Je=async()=>{try{let t=c?.blob??await(await fetch(e)).blob(),n=(/* @__PURE__ */ new Date()).toISOString().replace(/[-:]/gu,``).replace(/\..*$/u,``),r=new File([t],`desktop-screenshot-${n}.png`,{type:`image/png`});if(navigator.canShare?.({files:[r]})===!0)try{await navigator.share({files:[r]});return}catch(e){if(e instanceof DOMException&&e.name===`AbortError`)return}let i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=r.name,a.click(),setTimeout(()=>URL.revokeObjectURL(i),1e4)}catch{k(t(`desktop.save.failed`))}},Ye=d!==0,Xe=m||g,Ze={left:fe.x+fe.width/2,top:fe.y+fe.height/2,width:Ye?fe.height:fe.width,height:Ye?fe.width:fe.height,transform:Ye?`translate(-50%, -50%) rotate(${String(d)}deg)`:`translate(-50%, -50%)`};return(0,s.createPortal)(/* @__PURE__ */ (0,i.jsx)(`div`,{className:J.root,role:`dialog`,"aria-modal":`true`,"aria-label":t(`desktop.label`),children:/* @__PURE__ */ (0,i.jsxs)(`div`,{className:J.stage,style:Ze,children:[/* @__PURE__ */ (0,i.jsx)(`div`,{className:`${J.bar} ${J.top} ${A||Xe?``:J.hidden}`,children:g?/* @__PURE__ */ (0,i.jsxs)(i.Fragment,{children:[/* @__PURE__ */ (0,i.jsx)(`button`,{type:`button`,className:J.text,onClick:He,children:t(`desktop.annotate.cancel`)}),/* @__PURE__ */ (0,i.jsx)(`button`,{type:`button`,className:J.primary,disabled:!Ue,onClick:We,children:t(`desktop.annotate.done`)})]}):m?/* @__PURE__ */ (0,i.jsxs)(i.Fragment,{children:[/* @__PURE__ */ (0,i.jsx)(`button`,{type:`button`,className:J.text,onClick:()=>{b.current++,h(!1)},children:t(`desktop.annotate.cancel`)}),/* @__PURE__ */ (0,i.jsx)(`button`,{type:`button`,className:J.primary,onClick:Ge,children:t(`desktop.annotate.done`)})]}):/* @__PURE__ */ (0,i.jsxs)(i.Fragment,{children:[/* @__PURE__ */ (0,i.jsx)(`button`,{ref:ve,type:`button`,className:J.text,"aria-label":t(`desktop.close`),onClick:n,children:`✕`}),/* @__PURE__ */ (0,i.jsx)(`span`,{className:J.spacer}),/* @__PURE__ */ (0,i.jsx)(`button`,{type:`button`,className:J.text,"aria-pressed":Ye,onClick:()=>p(Ye?0:90),children:t(Ye?`desktop.portrait`:`desktop.landscape`)}),Ye&&/* @__PURE__ */ (0,i.jsx)(`button`,{type:`button`,className:J.text,onClick:()=>p(d===90?270:90),children:t(`desktop.flip`)}),/* @__PURE__ */ (0,i.jsx)(`button`,{type:`button`,className:J.text,onClick:()=>Be(`crop`),children:t(`desktop.crop`)}),/* @__PURE__ */ (0,i.jsx)(`button`,{type:`button`,className:J.text,onClick:()=>Be(`annotate`),children:t(`desktop.annotate`)})]})}),/* @__PURE__ */ (0,i.jsxs)(`div`,{ref:_e,className:J.area,style:Xe?{top:64,bottom:76}:void 0,"data-annotating":m||g||void 0,onPointerDown:Fe,onPointerMove:Ie,onPointerUp:e=>Le(e,!1),onPointerCancel:e=>Le(e,!0),onLostPointerCapture:e=>Le(e,!0),onDoubleClick:je,children:[u!==void 0&&be>0&&/* @__PURE__ */ (0,i.jsx)(`canvas`,{ref:ge,className:J.canvas,style:{width:u.naturalWidth*be,height:u.naturalHeight*be,transform:`translate(${String(Ce.x)}px, ${String(Ce.y)}px) scale(${String(xe)})`},role:`img`,"aria-label":t(`desktop.primary`)}),xe!==1&&/* @__PURE__ */ (0,i.jsxs)(`button`,{type:`button`,className:J.zoomBadge,onClick:je,children:[String(Math.round(xe*100)),`% · `,t(`desktop.zoom.fit`)]})]}),oe&&/* @__PURE__ */ (0,i.jsx)(`p`,{className:J.hint,role:`status`,children:t(`desktop.hint`)}),/* @__PURE__ */ (0,i.jsxs)(`div`,{className:`${J.bottom} ${A||Xe?``:J.hidden} ${Ye?J.wide:``}`,children:[te!==void 0&&/* @__PURE__ */ (0,i.jsx)(`p`,{role:`alert`,className:J.error,children:te}),/* @__PURE__ */ (0,i.jsx)(`div`,{className:J.bar,children:g?/* @__PURE__ */ (0,i.jsxs)(i.Fragment,{children:[/* @__PURE__ */ (0,i.jsx)(`span`,{className:J.cropHint,children:t(`desktop.crop.hint`)}),/* @__PURE__ */ (0,i.jsx)(`span`,{className:J.spacer}),v!==void 0&&/* @__PURE__ */ (0,i.jsxs)(`span`,{className:J.cropSize,children:[String(Math.round(v.width)),` × `,String(Math.round(v.height))]})]}):m?/* @__PURE__ */ (0,i.jsxs)(i.Fragment,{children:[du.map(e=>/* @__PURE__ */ (0,i.jsx)(`button`,{type:`button`,className:J.text,"aria-pressed":S===e,onClick:()=>C(e),children:t(`desktop.tool.${e}`)},e)),/* @__PURE__ */ (0,i.jsx)(`span`,{className:J.spacer}),Ql.map(e=>/* @__PURE__ */ (0,i.jsx)(`button`,{type:`button`,className:J.swatch,style:{background:e},"aria-label":e,"aria-pressed":w===e,onClick:()=>T(e)},e)),/* @__PURE__ */ (0,i.jsx)(`span`,{className:J.spacer}),/* @__PURE__ */ (0,i.jsx)(`button`,{type:`button`,className:J.text,disabled:E.length===0,onClick:()=>D(e=>e.slice(0,-1)),children:t(`desktop.annotate.undo`)}),/* @__PURE__ */ (0,i.jsx)(`button`,{type:`button`,className:J.text,disabled:E.length===0,onClick:()=>D([]),children:t(`desktop.annotate.clear`)})]}):/* @__PURE__ */ (0,i.jsxs)(i.Fragment,{children:[/* @__PURE__ */ (0,i.jsxs)(`div`,{className:J.compose,children:[/* @__PURE__ */ (0,i.jsx)(`input`,{ref:de,className:J.message,type:`text`,value:M,enterKeyHint:`send`,placeholder:t(`desktop.message.placeholder`),"aria-label":t(`desktop.message.placeholder`),onFocus:()=>{clearTimeout(ue.current),f(0),le(!0)},onBlur:()=>{clearTimeout(ue.current),ue.current=setTimeout(()=>{le(!1),window.scrollTo(0,0)},400)},onChange:e=>re(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.nativeEvent.isComposing&&qe()}}),/* @__PURE__ */ (0,i.jsx)(`button`,{type:`button`,className:J.primary,disabled:ie,onClick:()=>void qe(),children:t(`desktop.send`)})]}),c!==void 0&&/* @__PURE__ */ (0,i.jsx)(`button`,{type:`button`,className:J.text,onClick:()=>l(void 0),children:t(`desktop.annotate.reset`)}),/* @__PURE__ */ (0,i.jsx)(`span`,{className:J.spacer}),/* @__PURE__ */ (0,i.jsx)(`button`,{type:`button`,className:J.text,onClick:()=>void Je(),children:t(`desktop.save`)}),/* @__PURE__ */ (0,i.jsx)(`button`,{type:`button`,className:J.text,onClick:()=>void Ke(),children:t(`desktop.attach`)})]})})]})]})}),document.body)}let mu=`@deepseek-ai/dsh-client-ui-codexhost/DesktopScreenshot.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(mu)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-codexhost`,e.dataset.pluginCss=mu,e.textContent=`.cXmFjW_entry{width:28px;height:28px;color:inherit;cursor:pointer;touch-action:manipulation;background:0 0;border:0;border-radius:6px;justify-content:center;align-items:center;padding:0;display:inline-flex}.cXmFjW_entryBusy{gap:4px;width:auto;min-width:28px;padding:0 6px}.cXmFjW_entry:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover)}.cXmFjW_entry:disabled{opacity:.45;cursor:default}.cXmFjW_entry[aria-busy=true]{opacity:1;cursor:progress}.cXmFjW_spinner{flex:none;animation:.8s linear infinite cXmFjW_spin;display:inline-flex}.cXmFjW_float{z-index:40;touch-action:none;-webkit-user-select:none;user-select:none;width:60px;height:60px;position:fixed}.cXmFjW_bubble{border:2px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-base);width:100%;height:100%;box-shadow:var(--dsw-elevation-soft);color:var(--dsw-alias-label-primary);cursor:grab;border-radius:50%;place-items:center;padding:0;display:grid;position:relative;overflow:hidden}.cXmFjW_bubble[data-error]{border-color:var(--dsw-alias-state-error-primary)}.cXmFjW_bubble img{object-fit:cover;pointer-events:none;width:100%;height:100%;position:absolute;inset:0}.cXmFjW_busy{background:color-mix(in srgb, var(--dsw-alias-bg-base) 70%, transparent);flex-direction:column;justify-content:center;align-items:center;width:100%;height:100%;display:flex;position:relative;inset:0}.cXmFjW_elapsed{font-variant-numeric:tabular-nums;font-size:11px}.cXmFjW_alert{color:var(--dsw-alias-state-error-primary);font-size:22px;font-weight:600}.cXmFjW_dismiss{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-base);width:20px;height:20px;color:var(--dsw-alias-label-secondary);cursor:pointer;border-radius:50%;place-items:center;padding:0;display:grid;position:absolute;top:-6px;right:-6px}.cXmFjW_caption{background:var(--dsw-alias-bg-base);width:max-content;max-width:200px;box-shadow:var(--dsw-elevation-soft);color:var(--dsw-alias-state-error-primary);overflow-wrap:anywhere;border-radius:8px;margin:0;padding:6px 8px;font-size:12px;line-height:16px;position:absolute;top:calc(100% + 6px);right:0}@keyframes cXmFjW_spin{to{transform:rotate(360deg)}}@media (prefers-reduced-motion:reduce){.cXmFjW_spinner{animation:none}}@media (pointer:coarse){.cXmFjW_entry{width:40px;height:44px}.cXmFjW_entryBusy{width:auto;min-width:40px}}`,document.head.appendChild(e)}var hu={alert:`cXmFjW_alert`,bubble:`cXmFjW_bubble`,busy:`cXmFjW_busy`,caption:`cXmFjW_caption`,dismiss:`cXmFjW_dismiss`,elapsed:`cXmFjW_elapsed`,entry:`cXmFjW_entry`,entryBusy:`cXmFjW_entryBusy`,float:`cXmFjW_float`,spin:`cXmFjW_spin`,spinner:`cXmFjW_spinner`};function gu({screenshot:e,registerSource:t,sessionId:n,overflowActions:a=!1,t:s}){let c=(0,o.useSyncExternalStore)(e.subscribe,e.getSnapshot),l=(0,o.useId)(),u=(0,o.useCallback)(()=>{n!==void 0&&e.refresh(n)},[e,n]),d=(0,o.useRef)({sessionId:n,overflowActions:a,t:s,capture:u});d.current={sessionId:n,overflowActions:a,t:s,capture:u},(0,o.useLayoutEffect)(()=>{if(a)return t({trigger:`/`,name:`desktop-screenshot:${l}`,launcher:`command`,launcherOrder:-10,showGroupTitle:!1,candidates:async(t,n)=>{let i=d.current;if(n.launcher!==`command`||!i.overflowActions||t.sessionId!==i.sessionId)return[];let a=e.getSnapshot().pending,o=[{name:`desktop-screenshot`,label:i.t(`desktop.label`),showAlias:!1,description:a?i.t(`desktop.pending`):void 0,busy:a,icon:_u}];return(0,r.rankByName)(o,n.query)},subscribeCandidates:(t,n)=>{let r=e.getSnapshot().pending;return e.subscribe(()=>{let t=e.getSnapshot().pending;r!==t&&(r=t,n())})},onPick:e=>{let t=d.current;return t.overflowActions&&e.session.sessionId===t.sessionId&&t.capture(),`handled`}})},[t,e,l,a]),(0,o.useLayoutEffect)(()=>()=>{n!==void 0&&e.close(n)},[e,n]);let f=vu(c.startedAt);return n===void 0?null:/* @__PURE__ */ (0,i.jsx)(r.Tooltip,{portal:!0,disabled:a,side:`top`,label:s(c.pending?`desktop.pending`:`desktop.label`),children:/* @__PURE__ */ (0,i.jsx)(`button`,{type:`button`,className:c.pending?`${hu.entry} ${hu.entryBusy}`:hu.entry,"aria-label":s(`desktop.label`),"aria-busy":c.pending,"data-composer-overflow-action":!0,onMouseDown:e=>e.preventDefault(),onClick:u,children:c.pending?/* @__PURE__ */ (0,i.jsxs)(i.Fragment,{children:[/* @__PURE__ */ (0,i.jsx)(`span`,{className:hu.spinner,"aria-hidden":`true`,children:/* @__PURE__ */ (0,i.jsx)(r.IconLoadingOutlineRegular,{size:16})}),/* @__PURE__ */ (0,i.jsxs)(`span`,{className:hu.elapsed,children:[f,`s`]})]}):/* @__PURE__ */ (0,i.jsx)(_u,{size:16})})})}function _u({size:e=16}){return/* @__PURE__ */ (0,i.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 20 20`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.4`,"aria-hidden":`true`,children:[/* @__PURE__ */ (0,i.jsx)(`rect`,{x:`2`,y:`3`,width:`16`,height:`11`,rx:`2`}),/* @__PURE__ */ (0,i.jsx)(`path`,{d:`M10 14v3M6 17h8`})]})}function vu(e){let[t,n]=(0,o.useState)(()=>Date.now());return(0,o.useEffect)(()=>{if(e===void 0)return;n(Date.now());let t=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(t)},[e]),e===void 0?0:Math.max(0,Math.floor((t-e)/1e3))}let yu;function bu(e){return{x:Math.min(Math.max(e.x,8),Math.max(8,window.innerWidth-60-8)),y:Math.min(Math.max(e.y,8),Math.max(8,window.innerHeight-60-8))}}function xu(){return{x:window.innerWidth-60-12,y:72}}function Su({screenshot:e,drafts:t,inputActions:n,useInput:a,sessionId:c,t:l}){let u=(0,o.useSyncExternalStore)(e.subscribe,e.getSnapshot),{image:d,pending:f,progress:p,error:m}=u,h=vu(u.startedAt),[g,_]=(0,o.useState)(()=>bu(yu??xu())),[v,y]=(0,o.useState)(!1),b=a(e=>e.draft),x=(0,o.useRef)(d?.url);(0,o.useEffect)(()=>{d!==void 0&&d.url!==x.current&&(x.current=d.url,y(!0))},[d]);let S=(0,o.useRef)();if((0,o.useEffect)(()=>{let e=()=>_(e=>bu(e));return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]),c===void 0||u.sessionId!==c||d===void 0&&!f&&m===void 0)return null;let C=()=>{f||(m!==void 0||d===void 0?e.refresh(c):y(!0))},w=e=>{let r=new File([e],`desktop-screenshot-${String(Date.now())}.png`,{type:`image/png`}),i=t.create(c,r);return n.addAttachments(i.map(e=>e.id))?null:(t.release(i),l(`desktop.attach.blocked`))},T=f&&p!==void 0?l(`desktop.transferring`,{loaded:Cu(p.loaded),total:p.total===void 0?`?`:Cu(p.total)}):f?l(`desktop.pending`):m===void 0?d===void 0?l(`desktop.label`):l(`desktop.captured`,{time:new Date(d.capturedAt).toLocaleString()}):`${l(`desktop.error.${m}`)} ${l(`desktop.refresh`)}`,E=e=>{e.button!==0||e.target.closest(`[data-float-close]`)||(e.currentTarget.setPointerCapture(e.pointerId),S.current={pointer:e.pointerId,dx:e.clientX-g.x,dy:e.clientY-g.y,x:e.clientX,y:e.clientY,moved:!1})},D=e=>{let t=S.current;t?.pointer===e.pointerId&&(!t.moved&&Math.hypot(e.clientX-t.x,e.clientY-t.y)<6||(t.moved=!0,_(bu({x:e.clientX-t.dx,y:e.clientY-t.dy}))))},O=(e,t)=>{let n=S.current;n?.pointer===e.pointerId&&(S.current=void 0,n.moved?yu=g:t||C())};return(0,s.createPortal)(/* @__PURE__ */ (0,i.jsxs)(i.Fragment,{children:[/* @__PURE__ */ (0,i.jsxs)(`div`,{className:hu.float,style:{left:g.x,top:g.y},role:`group`,"aria-label":l(`desktop.label`),onPointerDown:E,onPointerMove:D,onPointerUp:e=>O(e,!1),onPointerCancel:e=>O(e,!0),children:[/* @__PURE__ */ (0,i.jsxs)(`button`,{type:`button`,className:hu.bubble,"aria-label":d!==void 0&&!f&&m===void 0?l(`desktop.enlarge`):T,"aria-busy":f,title:T,"data-error":m!==void 0||void 0,onClick:e=>{e.detail===0&&C()},children:[d!==void 0&&/* @__PURE__ */ (0,i.jsx)(`img`,{src:d.url,alt:``,draggable:!1}),f&&/* @__PURE__ */ (0,i.jsxs)(`span`,{className:hu.busy,children:[/* @__PURE__ */ (0,i.jsx)(`span`,{className:hu.spinner,"aria-hidden":`true`,children:/* @__PURE__ */ (0,i.jsx)(r.IconLoadingOutlineRegular,{size:16})}),/* @__PURE__ */ (0,i.jsxs)(`span`,{className:hu.elapsed,children:[h,`s`]})]}),!f&&m!==void 0&&/* @__PURE__ */ (0,i.jsx)(`span`,{className:hu.alert,children:`!`})]}),/* @__PURE__ */ (0,i.jsx)(`button`,{type:`button`,className:hu.dismiss,"data-float-close":!0,"aria-label":l(`desktop.close`),onClick:()=>e.close(c),children:/* @__PURE__ */ (0,i.jsx)(r.IconCloseOutlineRegular,{size:10})}),m!==void 0&&!f&&/* @__PURE__ */ (0,i.jsx)(`p`,{role:`status`,className:hu.caption,children:l(`desktop.error.${m}`)})]}),v&&d!==void 0&&/* @__PURE__ */ (0,i.jsx)(pu,{src:d.url,t:l,onClose:()=>y(!1),onAttach:e=>w(e),onSend:async(e,t)=>{let r=w(e);if(r!==null)return r;if(t!==``){let e=n.captureInsertion(`end`),r=b.trim()===``?t:`\n${t}`;if(!n.insertText(r,e))return l(`desktop.attach.blocked`);await new Promise(e=>setTimeout(e,0))}return n.submit(),null}})]}),document.body)}function Cu(e){return`${(e/1048576).toFixed(1)} MB`}var wu=class{transcribe;state={phase:`idle`,seconds:0};listeners=/* @__PURE__ */ new Set;binding;insertion;recorder;stream;timer;meter;audio;abort;generation=0;sendAfter=!1;cancelling=!1;undoTimer;constructor(e){this.transcribe=e}getSnapshot=()=>this.state;subscribe=e=>(this.listeners.add(e),()=>this.listeners.delete(e));update(e){this.state=e;for(let e of this.listeners)e()}bind(e,t,n=!0){let r={actions:e,locked:t,available:n};return this.binding=r,()=>{this.binding===r&&(this.binding=void 0)}}releaseMic(){clearInterval(this.timer),this.meter&&=(clearInterval(this.meter.interval),this.meter.context.close().catch(()=>{}),void 0),this.stream?.getTracks().forEach(e=>e.stop()),this.stream=void 0}async start(){if(!this.binding||this.binding.locked||this.state.phase!==`idle`)return;let e=this.binding;this.insertion={binding:e,span:e.actions.captureInsertion()},this.sendAfter=!1;let t=++this.generation;if(this.update({phase:`permission`,seconds:0}),!navigator.mediaDevices?.getUserMedia||typeof MediaRecorder>`u`)this.update({phase:`idle`,seconds:0,error:`browser-unsupported`});else try{let e=await navigator.mediaDevices.getUserMedia({audio:!0});if(t!==this.generation){e.getTracks().forEach(e=>e.stop());return}this.stream=e;let n=[`audio/webm;codecs=opus`,`audio/mp4;codecs=mp4a.40.2`,`audio/mp4`].find(e=>MediaRecorder.isTypeSupported(e)),r=new MediaRecorder(e,n?{mimeType:n}:void 0);this.recorder=r;let i=[];r.ondataavailable=e=>{t===this.generation&&i.push(e.data)},r.onerror=()=>{t===this.generation&&(this.discard(),this.update({phase:`idle`,seconds:0,error:`record-failed`}))},r.onstop=()=>{t===this.generation&&(this.releaseMic(),this.audio=new Blob(i,{type:r.mimeType||i[0]?.type||n||`audio/webm`}),this.cancelling?(this.update({phase:`cancelled`,seconds:this.state.seconds}),this.undoTimer=setTimeout(()=>{t===this.generation&&this.state.phase===`cancelled`&&this.discard()},5e3)):this.retry())},r.start();let a=Date.now();this.update({phase:`recording`,seconds:0}),this.startMeter(e,t),this.timer=setInterval(()=>{let e=Math.floor((Date.now()-a)/1e3);this.update({...this.state,phase:`recording`,seconds:e}),e>=300&&this.stop()},1e3)}catch(e){if(t!==this.generation)return;this.releaseMic();let n=e?.name;this.update({phase:`idle`,seconds:0,error:n===`NotAllowedError`?`permission-denied`:n===`NotFoundError`?`no-microphone`:`record-failed`})}}startMeter(e,t){if(typeof AudioContext<`u`)try{let n=new AudioContext,r=n.createAnalyser();r.fftSize=512,n.createMediaStreamSource(e).connect(r);let i=new Uint8Array(r.fftSize),a=Date.now(),o=setInterval(()=>{if(t!==this.generation||this.state.phase!==`recording`)return;r.getByteTimeDomainData(i);let e=0;for(let t of i)e+=((t-128)/128)**2;let n=Math.min(1,Math.sqrt(e/i.length)*5);n>.06&&(a=Date.now());let o=[...this.state.levels??[],n].slice(-24);this.update({...this.state,levels:o,silent:Date.now()-a>3e3})},80);this.meter={context:n,interval:o}}catch{}}stop(){this.recorder?.state===`recording`&&(clearInterval(this.timer),this.update({phase:`transcribing`,seconds:this.state.seconds}),this.recorder.stop())}toggle(){this.state.phase===`idle`&&this.binding?.available?this.start():this.state.phase===`recording`&&this.stop()}cancel(){this.state.phase===`recording`&&this.state.seconds>=15&&this.recorder?.state===`recording`?(clearInterval(this.timer),this.cancelling=!0,this.recorder.stop()):this.discard()}undo(){this.state.phase===`cancelled`&&(clearTimeout(this.undoTimer),this.cancelling=!1,this.retry())}rerecord(){this.discard(),this.start()}send(){if(this.recorder?.state!==`recording`||!this.binding||this.binding.locked||this.binding.actions!==this.insertion?.binding.actions)return;let e=this.binding;this.insertion={binding:e,span:e.actions.captureInsertion(`end`)},this.sendAfter=!0,this.stop()}async retry(){if(!this.audio||this.abort)return;let e=this.generation,t=new AbortController;this.abort=t,this.update({...this.state,phase:`transcribing`,error:void 0,slow:!1});let n=setTimeout(()=>{this.abort===t&&this.update({...this.state,slow:!0})},1e4);try{let n=await this.transcribe(this.audio,t.signal);if(e!==this.generation)return;if(!n.ok){this.update({...this.state,phase:`failed`,error:n.error.code,slow:!1});return}this.audio=void 0;let r=this.insertion;r&&this.binding===r.binding&&!this.binding.locked&&r.binding.actions.insertText(n.text,r.span)?(this.sendAfter&&r.binding.actions.submit(),this.sendAfter=!1,this.update({phase:`idle`,seconds:0})):this.update({phase:`text`,seconds:0,text:n.text})}catch{e===this.generation&&this.update({...this.state,phase:`failed`,error:`network`,slow:!1})}finally{clearTimeout(n),this.abort===t&&(this.abort=void 0)}}insert(){if(!this.state.text||!this.binding||this.binding.locked)return;let{actions:e}=this.binding;e.insertText(this.state.text,e.captureInsertion())&&this.discard()}discard=()=>{this.generation++,clearTimeout(this.undoTimer),this.cancelling=!1,this.abort?.abort(),this.abort=void 0,this.recorder?.state===`recording`&&this.recorder.stop(),this.recorder=void 0,this.releaseMic(),this.audio=void 0,this.insertion=void 0,this.sendAfter=!1,this.update({phase:`idle`,seconds:0})}};let Tu=`@deepseek-ai/dsh-client-ui-codexhost/VoiceInput.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Tu)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-codexhost`,e.dataset.pluginCss=Tu,e.textContent=`.CWXqOG_entry{--voice-entry-size:28px;--voice-bar-width:229px;width:var(--voice-entry-size);height:var(--voice-entry-size);overflow-clip-margin:2px;flex:none;justify-content:flex-end;transition:width .18s;display:inline-flex;position:relative;overflow:clip}.CWXqOG_entry[data-live]{width:var(--voice-bar-width)}.CWXqOG_icon{border-radius:var(--dsw-radius-sm);width:28px;height:28px;color:var(--dsw-alias-label-secondary);cursor:pointer;touch-action:manipulation;background:0 0;border:none;outline:none;flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex}.CWXqOG_icon:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}.CWXqOG_icon:disabled{color:var(--dsw-alias-label-dimmed);cursor:default}.CWXqOG_icon:focus-visible,.CWXqOG_round:focus-visible,.CWXqOG_send:focus-visible,.CWXqOG_done:focus-visible,.CWXqOG_primary:focus-visible,.CWXqOG_secondary:focus-visible,.CWXqOG_quietButton:focus-visible{box-shadow:0 0 0 2px var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary))}.CWXqOG_bar{box-sizing:border-box;width:var(--voice-bar-width);background:var(--dsw-alias-interactive-bg-hover);height:28px;color:var(--dsw-alias-label-secondary);border-radius:999px;grid-template-columns:28px 96px 34px 28px 28px;align-items:center;gap:3px;padding:0 0 0 3px;font-size:12px;display:grid;position:absolute;top:0;right:0}.CWXqOG_round,.CWXqOG_send,.CWXqOG_done{width:28px;height:28px;color:var(--dsw-alias-label-secondary);cursor:pointer;touch-action:manipulation;background:0 0;border:none;border-radius:50%;outline:none;flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex}.CWXqOG_round:hover:not(:disabled),.CWXqOG_done:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover-solid);color:var(--dsw-alias-label-primary)}.CWXqOG_meter{justify-content:center;align-items:center;min-width:0;height:28px;display:flex}.CWXqOG_wave,.CWXqOG_quiet{flex:none;width:90px;height:20px}.CWXqOG_wave{color:var(--dsw-alias-label-secondary);fill:none;stroke:currentColor;stroke-width:1.6px;stroke-linecap:round}.CWXqOG_quiet{color:var(--dsw-alias-label-tertiary);text-overflow:ellipsis;white-space:nowrap;line-height:20px;overflow:hidden}.CWXqOG_status{white-space:nowrap;justify-content:center;align-items:center;gap:5px;max-width:100%;font-size:11px;display:inline-flex}.CWXqOG_statusText{text-overflow:ellipsis;min-width:0;overflow:hidden}.CWXqOG_sendFace,.CWXqOG_doneFace{border-radius:50%;justify-content:center;align-items:center;width:24px;height:24px;display:flex}.CWXqOG_sendFace{background:var(--dsw-alias-button-info-fill);color:#fff}.CWXqOG_doneFace{background:var(--dsw-specific-input-major);color:var(--dsw-alias-label-primary)}.CWXqOG_send:hover:not(:disabled){filter:brightness(1.08)}.CWXqOG_send:disabled,.CWXqOG_done:disabled{opacity:.4;cursor:default}.CWXqOG_spinner{border:1.5px solid;border-right-color:#0000;border-radius:50%;flex:none;width:10px;height:10px;animation:.8s linear infinite CWXqOG_spin}.CWXqOG_timer{width:34px;color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums;text-align:center;flex:none;font-size:11px}.CWXqOG_strip{box-sizing:border-box;background:var(--dsw-alias-interactive-bg-hover);width:100%;min-width:0;height:30px;color:var(--dsw-alias-label-secondary);border-radius:999px;align-items:center;gap:6px;padding:0 2px;font-size:12px;display:flex}.CWXqOG_strip .CWXqOG_round,.CWXqOG_strip .CWXqOG_done{width:26px;height:26px;position:relative}.CWXqOG_strip .CWXqOG_round:before,.CWXqOG_strip .CWXqOG_done:before{content:"";position:absolute;inset:-9px}.CWXqOG_strip .CWXqOG_meter{flex:1}.CWXqOG_notice{border-radius:var(--dsw-radius-lg);background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-secondary);flex-wrap:wrap;align-items:center;gap:8px;padding:6px 6px 6px 12px;font-size:13px;line-height:19px;display:flex}.CWXqOG_notice[data-tone=error]{background:color-mix(in srgb, var(--dsw-alias-state-error-primary) 10%, transparent);color:var(--dsw-alias-label-primary)}.CWXqOG_notice p{flex:220px;margin:0}.CWXqOG_card{border:1px solid var(--dsw-alias-border-l2);border-radius:var(--dsw-radius-lg);color:var(--dsw-alias-label-primary);flex-direction:column;gap:8px;padding:10px 10px 10px 12px;font-size:13px;display:flex}.CWXqOG_cardHead{color:var(--dsw-alias-label-tertiary);align-items:center;gap:6px;font-size:12px;display:flex}.CWXqOG_cardText{white-space:pre-wrap;max-height:120px;margin:0;font-size:14px;line-height:21px;overflow:auto}.CWXqOG_actions{flex-wrap:wrap;justify-content:flex-end;gap:8px;display:flex}.CWXqOG_primary,.CWXqOG_secondary,.CWXqOG_quietButton{height:28px;font:inherit;cursor:pointer;border-radius:999px;outline:none;padding:0 12px;font-size:13px}.CWXqOG_primary{background:var(--dsw-alias-label-primary);color:var(--dsw-alias-bg-base);border:none}.CWXqOG_secondary{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-base);color:var(--dsw-alias-label-primary)}.CWXqOG_quietButton{color:var(--dsw-alias-label-secondary);background:0 0;border:none}.CWXqOG_secondary:hover,.CWXqOG_quietButton:hover{background:var(--dsw-alias-interactive-bg-hover)}@keyframes CWXqOG_spin{to{transform:rotate(360deg)}}@media (prefers-reduced-motion:reduce){.CWXqOG_entry{transition:none}.CWXqOG_spinner{animation:none}}@media (width<=600px),(pointer:coarse){.CWXqOG_entry{--voice-entry-size:44px}.CWXqOG_strip{margin-block:7px}.CWXqOG_icon{width:44px;height:44px}.CWXqOG_primary,.CWXqOG_secondary,.CWXqOG_quietButton{height:40px;padding:0 14px}}`,document.head.appendChild(e)}var Y={actions:`CWXqOG_actions`,bar:`CWXqOG_bar`,card:`CWXqOG_card`,cardHead:`CWXqOG_cardHead`,cardText:`CWXqOG_cardText`,done:`CWXqOG_done`,doneFace:`CWXqOG_doneFace`,entry:`CWXqOG_entry`,icon:`CWXqOG_icon`,meter:`CWXqOG_meter`,notice:`CWXqOG_notice`,primary:`CWXqOG_primary`,quiet:`CWXqOG_quiet`,quietButton:`CWXqOG_quietButton`,round:`CWXqOG_round`,secondary:`CWXqOG_secondary`,send:`CWXqOG_send`,sendFace:`CWXqOG_sendFace`,spin:`CWXqOG_spin`,spinner:`CWXqOG_spinner`,status:`CWXqOG_status`,statusText:`CWXqOG_statusText`,strip:`CWXqOG_strip`,timer:`CWXqOG_timer`,wave:`CWXqOG_wave`};let Eu=typeof navigator<`u`&&/Mac|iPhone|iPad/.test(navigator.platform)?[`⌘`,`⇧`,`Space`]:[`Ctrl`,`Shift`,`Space`];function Du(e){return(0,o.useSyncExternalStore)(e.subscribe,e.getSnapshot)}var Ou=class{stacked=!1;listeners=/* @__PURE__ */ new Set;subscribe=e=>(this.listeners.add(e),()=>this.listeners.delete(e));getSnapshot=()=>this.stacked;set(e){if(e!==this.stacked){this.stacked=e;for(let e of this.listeners)e()}}};let ku=e=>e.phase===`permission`||e.phase===`recording`||e.phase===`transcribing`,Au=e=>`${Math.floor(e/60)}:${String(e%60).padStart(2,`0`)}`;function ju({voice:e,blocks:t,tray:n,sessionId:a,inputActions:s,useInput:c,useSession:l,t:u}){let d=Du(e),[f,p]=(0,o.useState)(!1),m=(0,o.useSyncExternalStore)(n.subscribe,n.getSnapshot),h=(0,o.useRef)(null),g=ku(d),_=g||f&&d.phase===`idle`,v=(0,o.useMemo)(()=>t.storeFor(a),[t,a]),y=(0,o.useSyncExternalStore)(v.subscribe,v.getSnapshot)!==void 0,b=c(e=>e.phase!==`plain`),x=l(e=>e.removed||e.subagent?.address.mode===`continuable`&&e.subagent.parentAvailable!==!0),S=y||b||x;return(0,o.useLayoutEffect)(()=>e.bind(s,S,f),[e,s,S,f]),(0,o.useLayoutEffect)(()=>{if(g)return s.bindPrimaryAction({disabled:d.phase!==`recording`,run:()=>e.send()})},[e,s,g,d.phase]),(0,o.useEffect)(()=>{let e=!0,t=0,n=()=>{let n=++t;Dl.status().then(r=>{e&&n===t&&p(r.available)},()=>{e&&n===t&&p(!1)})},r=()=>{document.visibilityState===`visible`&&n()};return n(),document.addEventListener(`visibilitychange`,r),()=>{e=!1,document.removeEventListener(`visibilitychange`,r)}},[a]),(0,o.useLayoutEffect)(()=>{let e=h.current,t=e?.closest(`[data-composer-toolbar]`);if(!e||!t||typeof ResizeObserver>`u`)return;let r=()=>{let r=e.getBoundingClientRect();if(g&&r.width===0)return;let i=getComputedStyle(t),a=t.getBoundingClientRect().width-parseFloat(i.paddingLeft)-parseFloat(i.paddingRight),o=t.querySelector(`[data-toolbar-scroll]`)??t,s=Array.from(o.children,e=>e.getBoundingClientRect().width).filter(e=>e>0),c=parseFloat(getComputedStyle(e).getPropertyValue(`--voice-bar-width`)),l=s.reduce((e,t)=>e+t,0)+Math.max(0,s.length-1)*parseFloat(i.columnGap)+c-r.width;n.set(t.closest(`[data-phone]`)!==null||window.matchMedia(`(max-width: 600px), (pointer: coarse)`).matches||l>a)},i=new ResizeObserver(r);i.observe(t),i.observe(e);let a=t.querySelector(`[data-toolbar-scroll]`)??t;for(let e of a.children)i.observe(e);return r(),()=>i.disconnect()},[n,_,g]),_?/* @__PURE__ */ (0,i.jsx)(`span`,{ref:h,className:Y.entry,"data-composer-tray":m?`stacked`:`inline`,"data-live":g&&!m?``:void 0,children:g&&!m?/* @__PURE__ */ (0,i.jsx)(Nu,{voice:e,state:d,locked:S,layout:`inline`,t:u}):/* @__PURE__ */ (0,i.jsx)(r.Tooltip,{portal:!0,side:`top`,label:u(`voice.label`),shortcutKeys:Eu,children:/* @__PURE__ */ (0,i.jsx)(`button`,{type:`button`,className:Y.icon,"aria-label":u(`voice.label`),disabled:S,onMouseDown:e=>e.preventDefault(),onClick:()=>void e.start(),children:/* @__PURE__ */ (0,i.jsx)(r.IconMicrophoneOutlineMedium,{size:16})})})}):null}function Mu({voice:e,tray:t,onActiveChange:n,t:r}){let a=Du(e),s=(0,o.useSyncExternalStore)(t.subscribe,t.getSnapshot)&&ku(a);return(0,o.useLayoutEffect)(()=>n(s),[s,n]),(0,o.useLayoutEffect)(()=>()=>n(!1),[n]),s?/* @__PURE__ */ (0,i.jsx)(Nu,{voice:e,state:a,locked:!1,layout:`strip`,t:r}):null}function Nu({voice:e,state:t,locked:n,layout:a,t:o}){let s=t.phase===`recording`,c=t.levels??[],l=o(t.phase===`permission`?`voice.permission`:t.slow?`voice.slow`:`voice.transcribing`);return/* @__PURE__ */ (0,i.jsxs)(`span`,{className:a===`inline`?Y.bar:Y.strip,role:`group`,"aria-label":o(`voice.label`),children:[/* @__PURE__ */ (0,i.jsx)(r.Tooltip,{portal:!0,side:`top`,label:o(`voice.cancel`),shortcutKeys:[`Esc`],children:/* @__PURE__ */ (0,i.jsx)(`button`,{type:`button`,className:Y.round,"aria-label":o(`voice.cancel`),onClick:()=>e.cancel(),children:/* @__PURE__ */ (0,i.jsx)(r.IconCloseOutlineMedium,{size:14})})}),/* @__PURE__ */ (0,i.jsx)(`span`,{className:Y.meter,children:s?t.silent?/* @__PURE__ */ (0,i.jsx)(`span`,{className:Y.quiet,role:`status`,children:o(`voice.silent`)}):/* @__PURE__ */ (0,i.jsx)(`svg`,{className:Y.wave,viewBox:`0 0 96 24`,"aria-hidden":`true`,children:c.every(e=>e<.02)?/* @__PURE__ */ (0,i.jsx)(`path`,{d:`M2 12h92`}):Array.from({length:24},(e,t)=>{let n=c[c.length-24+t]??0,r=1+Math.round(n*21),a=2+t*4;return/* @__PURE__ */ (0,i.jsx)(`path`,{d:`M${a} ${(24-r)/2}v${r}`},t)})}):/* @__PURE__ */ (0,i.jsxs)(`span`,{className:Y.status,role:`status`,title:l,children:[/* @__PURE__ */ (0,i.jsx)(`span`,{className:Y.spinner,"aria-hidden":`true`}),/* @__PURE__ */ (0,i.jsx)(`span`,{className:Y.statusText,children:l})]})}),/* @__PURE__ */ (0,i.jsx)(`span`,{className:Y.timer,role:`timer`,children:Au(t.seconds)}),a===`inline`?/* @__PURE__ */ (0,i.jsx)(r.Tooltip,{portal:!0,side:`top`,label:o(`voice.send`),children:/* @__PURE__ */ (0,i.jsx)(`button`,{type:`button`,className:Y.send,"aria-label":o(`voice.send`),disabled:n||!s,onMouseDown:e=>e.preventDefault(),onClick:()=>e.send(),children:/* @__PURE__ */ (0,i.jsx)(`span`,{className:Y.sendFace,children:/* @__PURE__ */ (0,i.jsx)(Pu,{})})})}):null,/* @__PURE__ */ (0,i.jsx)(r.Tooltip,{portal:!0,side:`top`,label:o(`voice.stop`),shortcutKeys:Eu,children:/* @__PURE__ */ (0,i.jsx)(`button`,{type:`button`,className:Y.done,"aria-label":o(`voice.stop`),disabled:!s,onMouseDown:e=>e.preventDefault(),onClick:()=>e.stop(),children:/* @__PURE__ */ (0,i.jsx)(`span`,{className:Y.doneFace,children:/* @__PURE__ */ (0,i.jsx)(r.IconStopFillMedium,{size:9})})})})]})}function Pu(){return/* @__PURE__ */ (0,i.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.6`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:/* @__PURE__ */ (0,i.jsx)(`path`,{d:`M12 19V5M6 11l6-6 6 6`})})}function Fu({voice:e,t}){let n=Du(e);if(n.phase===`cancelled`)return/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Y.notice,role:`status`,children:[/* @__PURE__ */ (0,i.jsx)(`p`,{children:t(`voice.cancelled`,{time:Au(n.seconds)})}),/* @__PURE__ */ (0,i.jsx)(`button`,{type:`button`,className:Y.primary,onClick:()=>e.undo(),children:t(`voice.undo`)}),/* @__PURE__ */ (0,i.jsx)(Iu,{label:t(`voice.discard`),onClick:e.discard})]});if(n.phase===`text`)return/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Y.card,role:`region`,"aria-label":t(`voice.label`),children:[/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Y.cardHead,children:[/* @__PURE__ */ (0,i.jsx)(r.IconMicrophoneOutlineMedium,{size:14}),t(`voice.unplaced`)]}),/* @__PURE__ */ (0,i.jsx)(`p`,{className:Y.cardText,children:n.text}),/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Y.actions,children:[/* @__PURE__ */ (0,i.jsx)(`button`,{type:`button`,className:Y.quietButton,onClick:e.discard,children:t(`voice.discard`)}),/* @__PURE__ */ (0,i.jsx)(`button`,{type:`button`,className:Y.secondary,onClick:()=>void navigator.clipboard.writeText(n.text??``).catch(()=>{}),children:t(`voice.copy`)}),/* @__PURE__ */ (0,i.jsx)(`button`,{type:`button`,className:Y.primary,onMouseDown:e=>e.preventDefault(),onClick:()=>e.insert(),children:t(`voice.insert`)})]})]});if(!n.error)return null;let a=n.error,o=n.phase===`failed`,s=o&&![`audio-empty`,`audio-too-large`,`audio-format`,`audio-invalid`].includes(a),c=o||a===`record-failed`;return/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Y.notice,"data-tone":c?`error`:void 0,role:`alert`,children:[/* @__PURE__ */ (0,i.jsx)(`p`,{children:t(`voice.error.${a}`)}),o?/* @__PURE__ */ (0,i.jsx)(`button`,{type:`button`,className:s?Y.secondary:Y.primary,onClick:()=>e.rerecord(),children:t(`voice.rerecord`)}):null,s?/* @__PURE__ */ (0,i.jsx)(`button`,{type:`button`,className:Y.primary,onClick:()=>void e.retry(),children:t(`voice.retry`)}):null,a===`permission-denied`||a===`no-microphone`||a===`record-failed`?/* @__PURE__ */ (0,i.jsx)(`button`,{type:`button`,className:Y.secondary,onClick:()=>e.rerecord(),children:t(`voice.tryAgain`)}):null,/* @__PURE__ */ (0,i.jsx)(Iu,{label:t(`voice.discard`),onClick:e.discard})]})}function Iu({label:e,onClick:t}){return/* @__PURE__ */ (0,i.jsx)(`button`,{type:`button`,className:Y.round,"aria-label":e,onClick:t,children:/* @__PURE__ */ (0,i.jsx)(r.IconCloseOutlineMedium,{size:14})})}function Lu({size:e}){return/* @__PURE__ */ (0,i.jsx)(r.IconDownloadOutlineRegular,{size:e})}function Ru({sessionId:e,list:t}){let n=(0,o.useSyncExternalStore)(e=>t.subscribe(e),()=>t.getSnapshot().byId[e]?.projectionValues?.harnessIdentity);return n?/* @__PURE__ */ (0,i.jsx)(`span`,{"data-harness-id":n.id,title:n.name,role:`img`,"aria-label":n.name,style:{display:`inline-flex`,width:14,height:14,flexShrink:0,color:`inherit`},children:/* @__PURE__ */ (0,i.jsx)(r.RemotePluginIcon,{id:n.id,src:`/harness-icons/${encodeURIComponent(n.id)}`,presentationUrl:`/harness-icons/presentation.json`,size:14,fallback:/* @__PURE__ */ (0,i.jsx)(r.IconDataOutlineRegular,{size:14})})}):null}let zu=`@deepseek-ai/dsh-client-ui-codexhost/HostConnectionStatus.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(zu)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-codexhost`,e.dataset.pluginCss=zu,e.textContent=`.AGZkaG_status{border-bottom:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-primary);flex-shrink:0;justify-content:space-between;align-items:center;gap:12px;padding:6px 16px;font-size:12px;display:flex}.AGZkaG_copy{overflow-wrap:anywhere;flex-wrap:wrap;gap:4px 12px;min-width:0;display:flex}.AGZkaG_detail{color:var(--dsw-alias-label-tertiary)}.AGZkaG_retry{min-width:44px;min-height:44px;color:inherit;font:inherit;cursor:pointer;background:0 0;border:0;border-radius:6px;flex-shrink:0;padding:0 8px}.AGZkaG_retry:hover{background:var(--dsw-alias-interactive-bg-hover)}.AGZkaG_retry:focus-visible{outline-offset:2px;outline:2px solid}`,document.head.appendChild(e)}var Bu={copy:`AGZkaG_copy`,detail:`AGZkaG_detail`,retry:`AGZkaG_retry`,status:`AGZkaG_status`};function Vu(e){let t=(e+`=`.repeat((4-e.length%4)%4)).replace(/-/gu,`+`).replace(/_/gu,`/`),n=atob(t),r=new Uint8Array(new ArrayBuffer(n.length));for(let e=0;e<n.length;e+=1)r[e]=n.charCodeAt(e);return r}function Hu(){let e=/iPad|iPhone|iPod/u.test(navigator.userAgent),t=window.matchMedia(`(display-mode: standalone)`).matches||navigator.standalone===!0;return e&&!t}async function Uu(){return await navigator.serviceWorker.getRegistration(`./`)??await navigator.serviceWorker.register(`sw.js`,{scope:`./`})}async function Wu(){return!(`serviceWorker`in navigator)||!(`PushManager`in window)||!(`Notification`in window)?Hu()?`needs-install`:`unsupported`:Notification.permission===`denied`?`denied`:await(await navigator.serviceWorker.getRegistration(`./`))?.pushManager.getSubscription()==null?`off`:`on`}async function Gu(){let e=await Notification.requestPermission();if(e!==`granted`)return e===`denied`?`denied`:`off`;let t=await Uu();await navigator.serviceWorker.ready;let{publicKey:n}=await Nl.config(),r=await t.pushManager.getSubscription()??await t.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:Vu(n)});return await Nl.subscribe(r.toJSON()),`on`}async function Ku(){let e=await(await navigator.serviceWorker.getRegistration(`./`))?.pushManager.getSubscription();return e!=null&&(await Nl.unsubscribe(e.endpoint),await e.unsubscribe()),`off`}function qu(){`serviceWorker`in navigator&&Uu().catch(()=>void 0)}function Ju(){`serviceWorker`in navigator&&`Notification`in window&&Notification.permission===`granted`&&(async()=>{let e=await(await navigator.serviceWorker.getRegistration(`./`))?.pushManager.getSubscription();e!=null&&await Nl.subscribe(e.toJSON())})().catch(()=>void 0)}let Yu=5e3,Xu=(0,a.createSnapshotStore)(!1);function Zu(e){let t,n=!1,r=!1,i=0,a=async()=>{if(n||r||e.getSnapshot()!==`connecting`)return;n=!0,clearTimeout(t);let o=Date.now(),s=!1;try{let e=await fetch(`api/auth/status`,{credentials:`same-origin`,cache:`no-store`,signal:AbortSignal.timeout(Yu)});if(e.status===401){window.location.reload();return}s=e.status===200}catch{}n=!1,!(r||e.getSnapshot()!==`connecting`)&&(s&&(i=0,Xu.set(!1)),t=setTimeout(()=>{s||(i+=1,Xu.set(i>=2)),a()},Math.max(0,Yu-(Date.now()-o))))},o=()=>{e.getSnapshot()===`connecting`?a():(clearTimeout(t),i=0,Xu.set(!1))},s=e.subscribe(o);return o(),()=>{r=!0,clearTimeout(t),Xu.set(!1),s()}}async function Qu(){await Ku().catch(()=>void 0);let e=await fetch(`api/auth/logout`,{method:`POST`,credentials:`same-origin`});if(!e.ok)throw Error(`HTTP ${String(e.status)}`);window.location.reload()}function $u({sessionId:e,useSession:t,list:n,connection:a,t:s}){let c=(0,o.useSyncExternalStore)(a.state.subscribe,a.state.getSnapshot),l=(0,o.useSyncExternalStore)(Xu.subscribe,Xu.getSnapshot),u=(0,o.useSyncExternalStore)(e=>n.subscribe(e),()=>e===void 0?void 0:n.getSnapshot().byId[e]?.projectionValues?.nativeConnection?.state),d=(0,o.useSyncExternalStore)(e=>n.subscribe(e),()=>{let t=e===void 0?void 0:n.getSnapshot().byId[e]?.projectionValues;return t?.nativeInteractionError??t?.nativeConnection?.message}),f=t(e=>e.openState),[p,m]=(0,o.useState)(``),h=`${e}:${d??``}`,g=c===void 0||c===`connecting`,_=(0,r.useSustainedRecovery)(g),v=c===`disconnected`?`offline`:g?l?`computer`:_?c===void 0?`checking`:`reconnecting`:void 0:u===`reconnecting`?`host`:f===`error`?`error`:void 0,y=t(e=>v===void 0?void 0:e.lastSyncedAt);return/* @__PURE__ */ (0,i.jsxs)(i.Fragment,{children:[v?/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Bu.status,role:`status`,"data-web-connection":v,"data-native-connection":u===`reconnecting`?u:void 0,children:[/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Bu.copy,children:[/* @__PURE__ */ (0,i.jsx)(`span`,{children:s(`connection.${v}`)}),y===void 0?null:/* @__PURE__ */ (0,i.jsx)(`span`,{className:Bu.detail,children:s(`connection.lastSynced`,{time:new Date(y).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})})})]}),/* @__PURE__ */ (0,i.jsx)(`button`,{type:`button`,className:Bu.retry,onClick:()=>a.reconnect(),children:s(`connection.retry`)})]}):null,d&&p!==h?/* @__PURE__ */ (0,i.jsx)(r.Toast,{text:d,holdMs:8e3,onDone:()=>m(h)},h):null]})}let ed=`@deepseek-ai/dsh-client-ui-codexhost/HostUsageDock.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(ed)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-codexhost`,e.dataset.pluginCss=ed,e.textContent=`.rSFubG_anchor{min-width:0;max-width:min(280px,46vw);font-size:calc(var(--dsh-content-font-size-secondary,13px) - 1px);line-height:calc(20px + var(--dsh-content-font-delta-secondary,0px));display:inline-flex}.rSFubG_anchor[data-composer-stat=codexhost-quota]{order:-1}.rSFubG_pill{box-sizing:border-box;corner-shape:round;min-width:0;max-width:100%;color:var(--dsw-alias-label-tertiary);font:inherit;font-variant-numeric:tabular-nums;line-height:inherit;white-space:nowrap;cursor:pointer;background:0 0;border:none;border-radius:999px;align-items:center;gap:6px;padding:1px 8px;display:inline-flex}.rSFubG_pill:hover,.rSFubG_pill:focus-visible,.rSFubG_pill[aria-expanded=true]{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-secondary)}.rSFubG_label{text-overflow:ellipsis;min-width:0;overflow:hidden}.rSFubG_panel{z-index:1100;box-sizing:border-box;border-radius:var(--dsw-radius-lg);background:var(--dsw-specific-menu);width:min(320px,100vw - 24px);max-height:min(520px,100vh - 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:14px;font-size:13px;line-height:19px;position:fixed;overflow:auto}.rSFubG_panel header{color:var(--dsw-alias-label-primary);font-size:16px;font-weight:500;line-height:22px}.rSFubG_context{margin-top:10px}.rSFubG_contextRow{color:var(--dsw-alias-label-tertiary);justify-content:space-between;align-items:center;gap:20px;display:flex}.rSFubG_contextRow strong{color:var(--dsw-alias-label-primary);font-variant-numeric:tabular-nums;font-weight:400}.rSFubG_progressTrack{background:var(--dsw-alias-interactive-bg-hover);border-radius:999px;height:4px;margin-top:6px;overflow:hidden}.rSFubG_progressFill{border-radius:inherit;background:var(--dsw-alias-label-secondary);height:100%;display:block}.rSFubG_group{margin-top:12px}.rSFubG_group h3{color:var(--dsw-alias-label-tertiary);margin:0 0 5px;font-size:12px;font-weight:600}.rSFubG_group dl{gap:5px;margin:0;display:grid}.rSFubG_detail{grid-template-columns:minmax(120px,auto) minmax(0,1fr);gap:0 16px;display:grid}.rSFubG_detail dt,.rSFubG_detail dd,.rSFubG_detail p{min-width:0;margin:0}.rSFubG_detail dt{color:var(--dsw-alias-label-tertiary)}.rSFubG_detail dd{color:var(--dsw-alias-label-secondary);font-variant-numeric:tabular-nums;text-align:right}.rSFubG_detail p{color:var(--dsw-alias-label-tertiary);text-align:right;overflow-wrap:anywhere;grid-column:1/-1;font-size:11px}.rSFubG_quotaRing{fill:none;stroke:#399b69;stroke-width:3px;flex-shrink:0;width:16px;height:16px}.rSFubG_ringTrack{stroke:var(--dsw-alias-interactive-bg-hover)}.rSFubG_quotaPanel{--quota-color:#3d9a64;border:1px solid var(--dsw-alias-border-l1);background-image:radial-gradient(160px 100px at 18% -10%, color-mix(in srgb, var(--quota-color) 20%, transparent), transparent 70%);width:min(266px,100vw - 24px);color:var(--dsw-alias-label-primary);letter-spacing:0;border-radius:14px;padding:10px 12px;font:13px/1.35 system-ui,sans-serif}.rSFubG_quotaRow+.rSFubG_quotaRow,.rSFubG_quotaGroup+.rSFubG_quotaGroup{margin-top:11px}.rSFubG_quotaHeading{justify-content:space-between;align-items:flex-start;gap:12px;margin-bottom:5px;font-size:12px;display:flex}.rSFubG_quotaDescription{min-width:0}.rSFubG_quotaHeading strong{color:var(--quota-color);font-variant-numeric:tabular-nums;white-space:nowrap;align-items:baseline;gap:4px;font-size:12px;font-weight:400;display:inline-flex}.rSFubG_quotaGroup:first-child .rSFubG_quotaRow:first-child .rSFubG_quotaDescription>span{font-size:12.5px;font-weight:600}.rSFubG_quotaGroup:first-child .rSFubG_quotaRow:first-child .rSFubG_remainingLabel{opacity:.8;font-size:11px;font-weight:600}.rSFubG_quotaGroup:first-child .rSFubG_quotaRow:first-child .rSFubG_remainingValue{font-size:26px;font-weight:700}.rSFubG_quotaRow p{color:color-mix(in srgb, currentColor 62%, transparent);margin:0;font-size:10.5px}.rSFubG_quotaGroup:first-child .rSFubG_quotaRow:first-child p{font-size:11px}.rSFubG_quotaPanel .rSFubG_progressTrack{background:color-mix(in srgb, currentColor 16%, transparent);height:6px;margin-top:0}.rSFubG_quotaFill{border-radius:inherit;background:var(--quota-color);height:100%;display:block}@media (width<=640px){.rSFubG_anchor{max-width:42vw}}`,document.head.appendChild(e)}var X={anchor:`rSFubG_anchor`,context:`rSFubG_context`,contextRow:`rSFubG_contextRow`,detail:`rSFubG_detail`,group:`rSFubG_group`,label:`rSFubG_label`,panel:`rSFubG_panel`,pill:`rSFubG_pill`,progressFill:`rSFubG_progressFill`,progressTrack:`rSFubG_progressTrack`,quotaDescription:`rSFubG_quotaDescription`,quotaFill:`rSFubG_quotaFill`,quotaGroup:`rSFubG_quotaGroup`,quotaHeading:`rSFubG_quotaHeading`,quotaPanel:`rSFubG_quotaPanel`,quotaRing:`rSFubG_quotaRing`,quotaRow:`rSFubG_quotaRow`,remainingLabel:`rSFubG_remainingLabel`,remainingValue:`rSFubG_remainingValue`,ringTrack:`rSFubG_ringTrack`};let td={visibility:`hidden`,left:0,top:0};function nd(e,t=1){return e.toFixed(t).replace(/\.?0+$/u,``)}function rd(e){return e<1e3?String(Math.round(e)):e<1e6?`${nd(e/1e3)}K`:e<1e9?`${nd(e/1e6)}M`:`${nd(e/1e9)}B`}function id(e){return`${nd(e)}%`}function ad(e){return e.contextUsagePercent??(e.contextUsedTokens!==void 0&&e.contextWindowTokens!==void 0?e.contextUsedTokens/e.contextWindowTokens*100:void 0)}function od(e,t){return`${e>=100?Math.round(e):nd(e)} ${t(`usage.unit.tps`)}`}function sd(e,t){return e<1e3?`${Math.round(e)} ${t(`usage.unit.ms`)}`:`${nd(e/1e3)} ${t(`usage.unit.seconds`)}`}function cd(e){if(e.totalCostUsd===void 0)return null;let t=`$${e.totalCostUsd.toFixed(e.totalCostUsd>=1?2:3)}`;return e.unpricedModels?.length?`≥${t}`:t}function ld(e,t){return`${e>0&&e<.001?`<0.001`:nd(e,3)} ${t(`usage.unit.credits`)}`}function ud(e,t){if(e===void 0)return null;let n=new Date(typeof e==`number`?e*1e3:e);if(Number.isNaN(n.getTime()))return null;let r=/* @__PURE__ */ new Date,i=n.getFullYear()===r.getFullYear()&&n.getMonth()===r.getMonth()&&n.getDate()===r.getDate(),a=t(`usage.dateLocale`);return t(`usage.reset.at`,{time:i?t(`usage.reset.today`,{time:n.toLocaleTimeString(a,{hour:`numeric`,minute:`2-digit`})}):n.toLocaleString(a,{month:a===`zh-CN`?`long`:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`})})}function dd(e,t,n){return e===void 0||t===void 0?``:`${nd(e,2)} / ${nd(t,2)}${n?` ${n}`:``}`}function fd(e,t){if(e===null)return[];let n=[e.cacheHitRatePercent===void 0?null:`${t(`usage.cache.short`)} ${id(e.cacheHitRatePercent)}`,e.outputTokensPerSecond===void 0?e.apiOutputTokensPerSecond===void 0?null:`API ${od(e.apiOutputTokensPerSecond,t)}`:od(e.outputTokensPerSecond,t),cd(e)].filter(e=>e!==null);if(n.length>0)return n;if(e.totalTokens!==void 0)return[`${rd(e.totalTokens)} ${t(`usage.unit.tokens`)}`];let r=ad(e);return r===void 0?[]:[`${t(`usage.context`)}: ${id(r)}`]}function pd(e,t){let n=[];if(e!==null){let r=[],i=cd(e);i!==null&&r.push({label:e.costSource===`publicPrice`?t(`usage.cost.estimate`):t(`usage.cost`),value:i,...e.unpricedModels?.length?{note:`${t(`usage.unpriced`)}: ${e.unpricedModels.join(`, `)}`}:{}}),e.totalCredits!==void 0&&r.push({label:t(`usage.credits`),value:ld(e.totalCredits,t)}),e.sessionCacheHitRatePercent!==void 0&&r.push({label:t(`usage.cache.average`),value:id(e.sessionCacheHitRatePercent)}),e.cacheHitRatePercent!==void 0&&r.push({label:t(`usage.cache.latest`),value:id(e.cacheHitRatePercent)}),r.length&&n.push({label:t(`usage.group.session`),rows:r});let a=[];e.outputTokensPerSecond===void 0?e.apiOutputTokensPerSecond!==void 0&&a.push({label:t(`usage.speed.api`),value:od(e.apiOutputTokensPerSecond,t)}):a.push({label:t(`usage.speed`),value:od(e.outputTokensPerSecond,t)}),e.timeToFirstOutputMs!==void 0&&a.push({label:t(`usage.ttft`),value:sd(e.timeToFirstOutputMs,t)}),a.length&&n.push({label:t(`usage.group.turn`),rows:a});let o=[];(e.inputTokens!==void 0||e.outputTokens!==void 0)&&o.push({label:t(`usage.tokens.io`),value:`${e.inputTokens===void 0?`—`:rd(e.inputTokens)} / ${e.outputTokens===void 0?`—`:rd(e.outputTokens)}`}),(e.cachedInputTokens!==void 0||e.cacheWriteInputTokens!==void 0)&&o.push({label:e.cacheWriteInputTokens!==void 0&&e.cacheWriteInputTokens>0?t(`usage.tokens.cacheReadWrite`):t(`usage.tokens.cacheRead`),value:e.cacheWriteInputTokens!==void 0&&e.cacheWriteInputTokens>0?`${e.cachedInputTokens===void 0?`—`:rd(e.cachedInputTokens)} / ${rd(e.cacheWriteInputTokens)}`:rd(e.cachedInputTokens??0)}),e.totalTokens!==void 0&&o.push({label:t(`usage.tokens.total`),value:rd(e.totalTokens)}),o.length&&n.push({label:t(`usage.group.tokens`),rows:o})}return n}function md(e){return Math.min(100,Math.max(0,100-e))}function hd(e){return e<=10?`#c45c4a`:e<=30?`#c9a227`:`#3d9a64`}function gd(e,t,n){let r=[];if(!t&&e){let t=[];for(let[r,i,a]of[[n(`usage.plan.fiveHour`),e.planFiveHourUsedPercent,e.planFiveHourResetsAtUnix],[n(`usage.plan.sevenDay`),e.planSevenDayUsedPercent,e.planSevenDayResetsAtUnix]]){if(i===void 0)continue;let e=ud(a,n);t.push({label:r,value:id(md(i)),remaining:md(i),...e?{note:e}:{}})}t.length&&r.push({label:n(`usage.group.plan`),rows:t})}if(t){let e=(e,t,r)=>!r&&e===`five_hour`?n(`usage.plan.fiveHour`):!r&&e===`seven_day`?n(`usage.plan.sevenDay`):t,i=[],a=dd(t.used,t.limit,t.unit);if(i.push({label:e(t.periodType,t.label??n(`usage.group.quota`),t.scope),value:id(md(t.usedPercent)),remaining:md(t.usedPercent),note:[a?`${n(`usage.quota`)}: ${a}`:null,ud(t.resetsAt,n)].filter(Boolean).join(` · `)}),t.resetCredits){let e=ud(t.resetCredits.nextExpiresAt,n);i.push({label:n(`usage.resetCredits`),value:String(t.resetCredits.availableCount),...e?{note:e}:{}})}for(let r of t.productUsage??[]){let t=dd(r.used,r.limit,r.unit);i.push({label:e(r.periodType,r.product,r.scope),value:id(md(r.usagePercent)),remaining:md(r.usagePercent),note:[t?`${n(`usage.quota`)}: ${t}`:null,ud(r.resetsAt,n)].filter(Boolean).join(` · `)})}i.length&&r.push({label:n(`usage.group.quota`),rows:i})}return r}function _d({usage:e,t}){if(e===null)return null;let n=ad(e);if(n===void 0)return null;let r=e.contextWindowTokens===void 0?id(n):`${id(n)} / ${rd(e.contextWindowTokens)}`;return/* @__PURE__ */ (0,i.jsxs)(`section`,{className:X.context,children:[/* @__PURE__ */ (0,i.jsxs)(`div`,{className:X.contextRow,children:[/* @__PURE__ */ (0,i.jsx)(`span`,{children:t(`usage.context`)}),/* @__PURE__ */ (0,i.jsx)(`strong`,{children:r})]}),/* @__PURE__ */ (0,i.jsx)(`div`,{className:X.progressTrack,role:`progressbar`,"aria-label":t(`usage.context`),"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.min(100,Math.max(0,n)),children:/* @__PURE__ */ (0,i.jsx)(`span`,{className:X.progressFill,style:{width:`${Math.min(100,Math.max(0,n))}%`}})})]})}function vd({groups:e}){return e.map(e=>/* @__PURE__ */ (0,i.jsxs)(`section`,{className:X.group,children:[/* @__PURE__ */ (0,i.jsx)(`h3`,{children:e.label}),/* @__PURE__ */ (0,i.jsx)(`dl`,{children:e.rows.map(e=>/* @__PURE__ */ (0,i.jsxs)(`div`,{className:X.detail,children:[/* @__PURE__ */ (0,i.jsx)(`dt`,{children:e.label}),/* @__PURE__ */ (0,i.jsx)(`dd`,{children:e.value}),e.note&&/* @__PURE__ */ (0,i.jsx)(`p`,{children:e.note})]},`${e.label}:${e.value}`))})]},e.label))}function yd({useProjection:e,t}){let n=e(`codexhostUsage`),r=n?.usage??null,a=n?.accountCredits,s=(0,o.useMemo)(()=>fd(r,t),[r,t]),c=(0,o.useMemo)(()=>pd(r,t),[r,t]),l=(0,o.useMemo)(()=>gd(r,a,t),[r,a,t]),u=l.flatMap(e=>e.rows).find(e=>e.remaining!==void 0),d=r!==null&&ad(r)!==void 0,f=s.join(` · `);return/* @__PURE__ */ (0,i.jsxs)(i.Fragment,{children:[u&&/* @__PURE__ */ (0,i.jsx)(bd,{stat:`codexhost-quota`,panelStyle:{"--quota-color":hd(u.remaining??100)},label:`${t(`usage.quota.remaining`)}: ${u.value}`,title:t(`usage.quota.details`),trigger:/* @__PURE__ */ (0,i.jsxs)(i.Fragment,{children:[/* @__PURE__ */ (0,i.jsxs)(`svg`,{className:X.quotaRing,style:{stroke:hd(u.remaining??100)},viewBox:`0 0 20 20`,"aria-hidden":`true`,children:[/* @__PURE__ */ (0,i.jsx)(`circle`,{className:X.ringTrack,cx:`10`,cy:`10`,r:`7`}),/* @__PURE__ */ (0,i.jsx)(`circle`,{cx:`10`,cy:`10`,r:`7`,pathLength:`100`,strokeDasharray:`${u.remaining} 100`,transform:`rotate(-90 10 10)`})]}),/* @__PURE__ */ (0,i.jsx)(`span`,{children:u.value})]}),children:l.map(e=>/* @__PURE__ */ (0,i.jsx)(`section`,{className:X.quotaGroup,"aria-label":e.label,children:e.rows.map((e,n)=>/* @__PURE__ */ (0,i.jsxs)(`div`,{className:X.quotaRow,style:{"--quota-color":hd(e.remaining??100)},children:[/* @__PURE__ */ (0,i.jsxs)(`div`,{className:X.quotaHeading,children:[/* @__PURE__ */ (0,i.jsxs)(`div`,{className:X.quotaDescription,children:[/* @__PURE__ */ (0,i.jsx)(`span`,{children:e.label}),e.note&&/* @__PURE__ */ (0,i.jsx)(`p`,{children:e.note})]}),/* @__PURE__ */ (0,i.jsxs)(`strong`,{children:[e.remaining!==void 0&&/* @__PURE__ */ (0,i.jsxs)(`span`,{className:X.remainingLabel,children:[t(`usage.quota.remaining`),` `]}),/* @__PURE__ */ (0,i.jsx)(`span`,{className:X.remainingValue,children:e.value})]})]}),e.remaining!==void 0&&/* @__PURE__ */ (0,i.jsx)(`div`,{className:X.progressTrack,role:`progressbar`,"aria-label":`${e.label}: ${t(`usage.quota.remaining`)}`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":e.remaining,children:/* @__PURE__ */ (0,i.jsx)(`span`,{className:X.quotaFill,style:{width:`${e.remaining}%`}})})]},`${e.label}:${n}`))},e.label))}),s.length>0&&(c.length>0||d)&&/* @__PURE__ */ (0,i.jsxs)(bd,{stat:`codexhost-usage`,label:`${t(`usage.title`)}: ${f}`,title:t(`usage.details`),trigger:/* @__PURE__ */ (0,i.jsx)(`span`,{className:X.label,children:f}),children:[/* @__PURE__ */ (0,i.jsx)(`header`,{children:t(`usage.title`)}),/* @__PURE__ */ (0,i.jsx)(_d,{usage:r,t}),/* @__PURE__ */ (0,i.jsx)(vd,{groups:c})]})]})}function bd({stat:e,label:t,title:n,trigger:a,children:c,panelStyle:l}){let[u,d]=(0,o.useState)(!1),f=(0,o.useRef)(!1),p=(0,o.useRef)(null),m=(0,o.useRef)(null),h=(0,o.useRef)(null),g=(0,r.useAnchoredPosition)({open:u,anchorRef:m,panelRef:h,side:`top`,gap:8,margin:12}),_=(0,o.useCallback)(()=>{f.current=!1,d(!1)},[]),v=(0,o.useCallback)(()=>{p.current!==null&&(window.clearTimeout(p.current),p.current=null)},[]),y=(0,o.useCallback)(()=>{v(),p.current=window.setTimeout(()=>{p.current=null,!f.current&&m.current?.matches(`:hover`)!==!0&&h.current?.matches(`:hover`)!==!0&&!m.current?.contains(document.activeElement)&&d(!1)},140)},[v]);return(0,r.useDismissOnOutsidePointer)(m,u,e=>{e||_()},h),(0,o.useEffect)(()=>{if(!u)return;let e=e=>{e.key===`Escape`&&_()};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[_,u]),(0,o.useEffect)(()=>()=>{p.current!==null&&window.clearTimeout(p.current)},[]),/* @__PURE__ */ (0,i.jsxs)(`span`,{ref:m,className:X.anchor,"data-composer-stat":e,onPointerEnter:()=>{v(),d(!0)},onPointerLeave:y,children:[/* @__PURE__ */ (0,i.jsx)(`button`,{type:`button`,className:X.pill,"aria-label":t,"aria-haspopup":`dialog`,"aria-expanded":u,onFocus:()=>{v(),d(!0)},onBlur:y,onClick:()=>{u&&f.current?_():(f.current=!0,d(!0))},children:a}),u&&(0,s.createPortal)(/* @__PURE__ */ (0,i.jsx)(`div`,{ref:h,className:`${X.panel} ${e===`codexhost-quota`?X.quotaPanel:``}`,style:{...l,...g??td},role:`dialog`,"aria-label":n,onPointerEnter:v,onPointerLeave:y,children:c}),document.body)]})}let xd=`@deepseek-ai/dsh-client-ui-codexhost/ConnectDevicesSection.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(xd)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-codexhost`,e.dataset.pluginCss=xd,e.textContent=`.no7uPq_page{flex-direction:column;gap:24px;min-width:0;display:flex}.no7uPq_header{flex-wrap:wrap;justify-content:space-between;align-items:flex-start;gap:12px;display:flex}.no7uPq_title{color:var(--dsw-alias-label-primary);margin:0 0 8px;font-size:22px;font-weight:600;line-height:30px}.no7uPq_description,.no7uPq_notice{color:var(--dsw-alias-label-secondary);overflow-wrap:anywhere;margin:0;font-size:13px;line-height:21px}.no7uPq_meta{color:var(--dsw-alias-label-tertiary);overflow-wrap:anywhere;margin:0;font-size:12px;line-height:19px}.no7uPq_status{color:var(--dsw-alias-label-tertiary);white-space:nowrap;align-items:center;gap:6px;padding:4px 0;font-size:11px;line-height:20px;display:flex}.no7uPq_status:before{content:"";background:currentColor;border-radius:50%;width:5px;height:5px}.no7uPq_status[data-active=true]:before{background:#65af91}.no7uPq_connection{flex-direction:column;gap:24px;display:flex}.no7uPq_connectionMain{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-2);border-radius:12px;align-items:center;gap:24px;padding:20px;display:flex}.no7uPq_scan{border-right:1px solid var(--dsw-alias-border-l2);flex:none;padding-right:24px}.no7uPq_connectionDetails{flex-direction:column;flex:1;gap:16px;min-width:0;display:flex}.no7uPq_qrButton{cursor:zoom-in;background:#fff;border:none;border-radius:12px;padding:8px;line-height:0;display:block;overflow:hidden}.no7uPq_qr{width:144px;height:144px;display:block}.no7uPq_qrPlaceholder{box-sizing:border-box;border:1px dashed var(--dsw-alias-border-l4);width:160px;height:160px;color:var(--dsw-alias-label-tertiary);border-radius:12px;flex-direction:column;justify-content:center;align-items:center;gap:14px;font-size:12px;display:flex}.no7uPq_qrButton:focus-visible,.no7uPq_input:focus-visible{outline:2px solid var(--dsw-alias-label-secondary);outline-offset:3px}.no7uPq_routePanel{flex-direction:column;gap:10px;min-width:0;display:flex}.no7uPq_routes{border:0;min-width:0;margin:0;padding:0}.no7uPq_fieldTitle{color:var(--dsw-alias-label-primary);margin-bottom:10px;padding:0;font-size:13px;font-weight:600;line-height:20px;display:block}.no7uPq_routeGroup,.no7uPq_extraRoutes{flex-direction:column;gap:8px;display:flex}.no7uPq_routeGroup,.no7uPq_extraRoutes>.no7uPq_route{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-2);border-radius:10px}.no7uPq_routeGroup{gap:0;overflow:hidden}.no7uPq_routeFamily,.no7uPq_routeGroup>.no7uPq_route:not(:last-child){border-bottom:1px solid var(--dsw-alias-border-l2)}.no7uPq_extraRoutes>.no7uPq_route:has(input:checked){border-color:var(--dsw-alias-label-secondary)}.no7uPq_routeGroup>.no7uPq_route:has(input:checked),.no7uPq_routeFamily:has(.no7uPq_route input:checked){background:var(--dsw-alias-interactive-bg-hover)}.no7uPq_route{cursor:pointer;align-items:flex-start;gap:10px;padding:12px 16px;display:flex}.no7uPq_subRoutes{flex-wrap:wrap;gap:16px;padding:0 16px 12px 39px;display:flex}.no7uPq_subRoute{color:var(--dsw-alias-label-primary);cursor:pointer;align-items:center;gap:6px;font-size:12px;line-height:18px;display:flex}.no7uPq_subRoute input{accent-color:var(--dsw-alias-label-primary);margin:0}.no7uPq_extraRoutes>.no7uPq_route{border-radius:10px}.no7uPq_route:hover{background:var(--dsw-alias-interactive-bg-hover)}.no7uPq_route:has(input:disabled){cursor:default;opacity:.7}.no7uPq_route input{accent-color:var(--dsw-alias-label-primary);flex:none;margin:3px 0 0}.no7uPq_routeText{flex-direction:column;gap:3px;min-width:0;display:flex}.no7uPq_route>.no7uPq_routeText{flex:1}.no7uPq_routeTitle{color:var(--dsw-alias-label-primary);flex-wrap:wrap;align-items:center;gap:6px;font-size:13px;font-weight:500;line-height:20px;display:flex}.no7uPq_routeAddress{color:var(--dsw-alias-label-tertiary);overflow-wrap:anywhere;margin-left:auto;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:11px;font-weight:400}.no7uPq_badge{border:1px solid var(--dsw-alias-border-l4);color:var(--dsw-alias-label-secondary);border-radius:4px;padding:0 5px;font-size:10px;font-weight:400;line-height:16px}.no7uPq_addressRow{flex-wrap:wrap;gap:8px;display:flex}.no7uPq_addressRow>button{flex:none}.no7uPq_input{box-sizing:border-box;border:1px solid var(--dsw-alias-border-l4);background:var(--dsw-alias-bg-layer-3);width:100%;min-width:0;height:36px;font:inherit;color:var(--dsw-alias-label-primary);border-radius:8px;flex:140px;padding:0 10px;font-size:12px}.no7uPq_addressMenu{flex:140px;min-width:0}.no7uPq_addressTrigger{text-align:left;cursor:pointer;justify-content:space-between;align-items:center;gap:8px;display:flex}.no7uPq_addressTrigger span{text-overflow:ellipsis;white-space:nowrap;min-width:0;overflow:hidden}.no7uPq_addressTrigger svg{color:var(--dsw-alias-label-secondary);flex:none}.no7uPq_addressTrigger:disabled{cursor:default;opacity:.7}.no7uPq_other{min-width:0}.no7uPq_other summary{width:fit-content;color:var(--dsw-alias-label-tertiary);cursor:pointer;font-size:12px;line-height:20px}.no7uPq_page>.no7uPq_other{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-2);border-radius:10px;padding:12px 16px}.no7uPq_page>.no7uPq_other summary{color:var(--dsw-alias-label-secondary)}.no7uPq_extraRoutes{margin-top:8px}.no7uPq_connectionHelp{flex-direction:column;gap:10px;display:flex}.no7uPq_relayFields,.no7uPq_relayField{gap:4px;min-width:0;display:grid}.no7uPq_relayFields{gap:10px}.no7uPq_relayPreview{border:1px solid var(--dsw-alias-separator,currentColor);border-radius:8px;gap:6px;min-width:0;padding:10px 12px;display:grid}.no7uPq_relayPreviewAddress{overflow-wrap:anywhere;flex-wrap:wrap;align-items:flex-start;gap:2px;display:flex}.no7uPq_relayPreviewAddress span{flex-direction:column;display:flex}.no7uPq_relayPreviewAddress small{color:var(--dsw-alias-label-secondary);font-size:11px}.no7uPq_relayTutorial{color:var(--dsw-alias-label-secondary);overflow-wrap:anywhere;margin:0;padding-left:20px;font-size:12px;line-height:20px}.no7uPq_relayTutorial li+li{margin-top:6px}.no7uPq_relayTutorial code{display:block}.no7uPq_ready{color:var(--dsw-alias-label-secondary);align-items:flex-start;gap:8px;margin:0;font-size:12px;line-height:20px;display:flex}.no7uPq_ready svg{color:#65af91;flex:none;margin-top:2px}.no7uPq_manage{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-2);border-radius:12px;flex-direction:column;padding:0 20px;display:flex}.no7uPq_manageRow{flex-wrap:wrap;justify-content:space-between;align-items:center;gap:8px 16px;padding:16px 0;display:flex}.no7uPq_manageRow+.no7uPq_manageRow{border-top:1px solid var(--dsw-alias-border-l2)}.no7uPq_stopRow{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-2);border-radius:12px;padding:16px 20px}.no7uPq_manageText{flex-direction:column;flex:200px;gap:4px;min-width:0;display:flex}.no7uPq_manageTitle{color:var(--dsw-alias-label-primary);font-size:13px;line-height:20px}.no7uPq_manageActions{flex-wrap:wrap;flex:none;align-items:center;gap:8px;max-width:100%;display:flex}.no7uPq_dangerOutline{color:var(--dsw-alias-state-error-primary)}.no7uPq_remoteList{flex-direction:column;gap:8px;margin-top:12px;display:flex}.no7uPq_link{width:fit-content;color:var(--dsw-alias-label-secondary);font-size:12px;line-height:18px;text-decoration:underline}.no7uPq_actions{flex-wrap:wrap;gap:8px;display:flex}.no7uPq_error{color:var(--dsw-alias-state-error-primary);overflow-wrap:anywhere;margin:0;font-size:12px;line-height:19px}.no7uPq_confirm{width:min(440px,100%)}.no7uPq_dangerConfirm{background:var(--dsw-alias-state-error-primary);color:#fff}.no7uPq_dangerConfirm:hover:not(:disabled){background:color-mix(in srgb, var(--dsw-alias-state-error-primary) 88%, #000);color:#fff}.no7uPq_qrModal{width:min(420px,100%)}.no7uPq_largeQr{border-radius:12px;width:100%;height:auto;display:block}@media (width<=600px){.no7uPq_page{gap:16px}.no7uPq_connectionMain{flex-direction:column;align-items:stretch;gap:16px;padding:16px}.no7uPq_scan{border-right:0;align-self:center;padding-right:0}.no7uPq_manage{padding:0 12px}.no7uPq_stopRow{padding:16px 12px}.no7uPq_routeAddress{flex-basis:100%;margin-left:0}.no7uPq_title{font-size:20px}.no7uPq_status{font-size:11px}}`,document.head.appendChild(e)}var Z={actions:`no7uPq_actions`,addressMenu:`no7uPq_addressMenu`,addressRow:`no7uPq_addressRow`,addressTrigger:`no7uPq_addressTrigger`,badge:`no7uPq_badge`,confirm:`no7uPq_confirm`,connection:`no7uPq_connection`,connectionDetails:`no7uPq_connectionDetails`,connectionHelp:`no7uPq_connectionHelp`,connectionMain:`no7uPq_connectionMain`,dangerConfirm:`no7uPq_dangerConfirm`,dangerOutline:`no7uPq_dangerOutline`,description:`no7uPq_description`,error:`no7uPq_error`,extraRoutes:`no7uPq_extraRoutes`,fieldTitle:`no7uPq_fieldTitle`,header:`no7uPq_header`,input:`no7uPq_input`,largeQr:`no7uPq_largeQr`,link:`no7uPq_link`,manage:`no7uPq_manage`,manageActions:`no7uPq_manageActions`,manageRow:`no7uPq_manageRow`,manageText:`no7uPq_manageText`,manageTitle:`no7uPq_manageTitle`,meta:`no7uPq_meta`,notice:`no7uPq_notice`,other:`no7uPq_other`,page:`no7uPq_page`,qr:`no7uPq_qr`,qrButton:`no7uPq_qrButton`,qrModal:`no7uPq_qrModal`,qrPlaceholder:`no7uPq_qrPlaceholder`,ready:`no7uPq_ready`,relayField:`no7uPq_relayField`,relayFields:`no7uPq_relayFields`,relayPreview:`no7uPq_relayPreview`,relayPreviewAddress:`no7uPq_relayPreviewAddress`,relayTutorial:`no7uPq_relayTutorial`,remoteList:`no7uPq_remoteList`,route:`no7uPq_route`,routeAddress:`no7uPq_routeAddress`,routeFamily:`no7uPq_routeFamily`,routeGroup:`no7uPq_routeGroup`,routePanel:`no7uPq_routePanel`,routeText:`no7uPq_routeText`,routeTitle:`no7uPq_routeTitle`,routes:`no7uPq_routes`,scan:`no7uPq_scan`,status:`no7uPq_status`,stopRow:`no7uPq_stopRow`,subRoute:`no7uPq_subRoute`,subRoutes:`no7uPq_subRoutes`,title:`no7uPq_title`};function Sd(e,t){let[n,r]=(0,o.useState)(null),[i,a]=(0,o.useState)();return(0,o.useEffect)(()=>{if(n===null)return;let i=!1,o=Date.now()+6e4,s,c=async()=>{try{let t=await Ml.get();if(i)return;if(t.background?.lan===n){e(t),r(null);return}}catch(e){if(i)return;if(!(e instanceof TypeError)){a(e instanceof Error?e.message:String(e)),r(null);return}}Date.now()>=o?(a(t),r(null)):i||(s=setTimeout(()=>{c()},1e3))};return s=setTimeout(()=>{c()},1e3),()=>{i=!0,clearTimeout(s)}},[n,e,t]),{target:n,error:i,start:r,fail:a}}function Cd({state:e,disabled:t,restored:n,t:a}){let[s,c]=(0,o.useState)(!1),[l,u]=(0,o.useState)();return/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Z.manageRow,"data-background-controls":!0,children:[/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Z.manageText,children:[/* @__PURE__ */ (0,i.jsx)(`span`,{className:Z.manageTitle,children:a(`connectDevices.autostart`)}),e.autostart.status===`invalid`&&/* @__PURE__ */ (0,i.jsx)(`span`,{className:Z.error,children:e.autostart.reason}),l!==void 0&&/* @__PURE__ */ (0,i.jsx)(`span`,{role:`alert`,className:Z.error,children:l})]}),/* @__PURE__ */ (0,i.jsx)(r.Switch,{label:a(`connectDevices.autostart`),checked:e.autostart.status===`on`,disabled:s||t,onChange:e=>{c(!0),u(void 0),Ml.autostart(e).then(async()=>{n(await Ml.get())}).catch(e=>{u(e instanceof Error?e.message:String(e))}).finally(()=>c(!1))}})]})}function wd(e){return e.status===`connecting`||e.status===`missing-certificate`&&e.certificate.failure===void 0}function Td({kind:e,relay:t,busy:n,onChange:a,onRefresh:s,t:c}){let l=e===t.kind,u=l?t.state:{status:`off`},d=e===`official`,f=d?t.officialHostname:t.customHostname,p=l?t.quotaUntil:void 0,m=t.enabled&&!l,h=t.customHost?.startsWith(`relay.`)?t.customHost.slice(6):f?.split(`.`).slice(1).join(`.`)??``,[g,_]=(0,o.useState)(h),v=g===h&&t.customHost?t.customHost:g?`relay.${g}`:``,y=v!==(t.customHost??``),b=Ns.safeParse(v).success,x=g!==``&&(!Ns.safeParse(g).success||!b&&y),S=(0,o.useId)(),[C,w]=(0,o.useState)(d?``:f?.split(`.`)[0]??``),[T,E]=(0,o.useState)(``),D=(0,o.useId)(),O=C!==``&&(d?!/^[a-z0-9]{4,20}$/.test(C):!Ps.safeParse(C).success||`${C}.${g}`===v||g!==``&&!Ns.safeParse(`${C}.${g}`).success),ee=`certificate`in u?u.certificate.failure:void 0,te=ee?.paused===!0,k=u.status===`connected`&&!te&&p===void 0,A=p===void 0?u.status===`off`&&u.reason!==void 0?c(`connectDevices.relay.${u.reason}`):u.status===`connecting`&&u.reason!==void 0?c(u.reason===`full`?`connectDevices.relay.full`:`connectDevices.relay.connectionFailed`):k?c(`connectDevices.relay.hint`):u.status===`stopped`?c(`connectDevices.relay.${u.reason}`):te?c(`connectDevices.relay.paused`):u.status===`off`?c(d?`connectDevices.relay.off`:`connectDevices.selfRelay.off`):wd(u)?c(`connectDevices.relay.preparing`):c(`connectDevices.relay.unavailable`,{date:new Date(ee?.retryAt??``).toLocaleString()}):c(`connectDevices.relay.quota`);return/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Z.connectionHelp,"data-relay-status":u.status,children:[d&&/* @__PURE__ */ (0,i.jsx)(`p`,{className:Z.meta,children:t.officialHost}),!d&&l&&t.enabled&&/* @__PURE__ */ (0,i.jsx)(`p`,{className:Z.meta,children:c(`connectDevices.selfRelay.address`,{host:t.customHost??``})}),m&&/* @__PURE__ */ (0,i.jsx)(`p`,{className:Z.notice,children:c(`connectDevices.relay.closeFirst`)}),/* @__PURE__ */ (0,i.jsxs)(`p`,{className:k?Z.ready:Z.notice,role:`status`,children:[k&&/* @__PURE__ */ (0,i.jsx)(r.IconCheckCircleOutlineRegular,{}),/* @__PURE__ */ (0,i.jsx)(`span`,{children:A})]}),p!==void 0&&/* @__PURE__ */ (0,i.jsx)(`p`,{className:Z.meta,children:c(`connectDevices.relay.quotaUntil`,{date:new Date(p).toLocaleString()})}),te&&/* @__PURE__ */ (0,i.jsx)(`p`,{className:Z.meta,children:ee.detail??c(`connectDevices.relay.unreachable`)}),u.status===`off`?/* @__PURE__ */ (0,i.jsxs)(`form`,{className:Z.connectionHelp,onSubmit:t=>{t.preventDefault(),a(!0,{kind:e,...d&&f===void 0?{name:C,invite:T}:{},...d?{}:{name:C,...y?{host:v}:{}}})},children:[!d&&/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Z.relayFields,children:[/* @__PURE__ */ (0,i.jsxs)(`label`,{className:`${Z.relayField} ${Z.notice}`,children:[c(`connectDevices.selfRelay.host`),/* @__PURE__ */ (0,i.jsx)(`input`,{className:Z.input,value:g,placeholder:`example.com`,onChange:e=>_(e.target.value.toLowerCase()),"aria-invalid":x,"aria-describedby":S,autoCapitalize:`none`,spellCheck:!1,disabled:n||m})]}),/* @__PURE__ */ (0,i.jsx)(`p`,{id:S,className:x?Z.error:Z.meta,role:x?`alert`:void 0,children:c(x?`connectDevices.selfRelay.invalidHost`:`connectDevices.selfRelay.hostHint`)}),/* @__PURE__ */ (0,i.jsxs)(`label`,{className:`${Z.relayField} ${Z.notice}`,children:[c(`connectDevices.selfRelay.name`),/* @__PURE__ */ (0,i.jsx)(`input`,{className:Z.input,value:C,placeholder:`mycomputer`,onChange:e=>w(e.target.value.toLowerCase()),"aria-invalid":O,"aria-describedby":D,autoCapitalize:`none`,spellCheck:!1,disabled:n||m})]}),/* @__PURE__ */ (0,i.jsx)(`p`,{id:D,className:O?Z.error:Z.meta,role:O?`alert`:void 0,children:c(O?`connectDevices.selfRelay.invalidName`:`connectDevices.selfRelay.nameHint`)}),/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Z.relayPreview,children:[/* @__PURE__ */ (0,i.jsx)(`p`,{className:Z.notice,children:c(`connectDevices.selfRelay.previewTitle`)}),/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Z.relayPreviewAddress,children:[/* @__PURE__ */ (0,i.jsx)(`span`,{children:`https://`}),/* @__PURE__ */ (0,i.jsxs)(`span`,{children:[/* @__PURE__ */ (0,i.jsx)(`strong`,{children:C||c(`connectDevices.selfRelay.previewAutoName`)}),/* @__PURE__ */ (0,i.jsx)(`small`,{children:c(`connectDevices.selfRelay.name`)})]}),/* @__PURE__ */ (0,i.jsx)(`span`,{"aria-hidden":`true`,children:`.`}),/* @__PURE__ */ (0,i.jsxs)(`span`,{children:[/* @__PURE__ */ (0,i.jsx)(`strong`,{children:g||`example.com`}),/* @__PURE__ */ (0,i.jsx)(`small`,{children:c(`connectDevices.selfRelay.host`)})]})]})]}),v&&/* @__PURE__ */ (0,i.jsx)(`p`,{className:Z.meta,children:c(`connectDevices.selfRelay.address`,{host:v})})]}),d&&f===void 0&&/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Z.relayFields,children:[/* @__PURE__ */ (0,i.jsxs)(`label`,{className:`${Z.relayField} ${Z.notice}`,children:[c(`connectDevices.relay.name`),/* @__PURE__ */ (0,i.jsx)(`input`,{className:Z.input,value:C,onChange:e=>w(e.target.value),pattern:`[a-z0-9]{4,20}`,"aria-invalid":O,"aria-describedby":D,autoCapitalize:`none`,spellCheck:!1,disabled:n})]}),/* @__PURE__ */ (0,i.jsx)(`p`,{id:D,className:Z.meta,children:c(`connectDevices.relay.nameHint`)}),/* @__PURE__ */ (0,i.jsxs)(`label`,{className:`${Z.relayField} ${Z.notice}`,children:[c(`connectDevices.relay.inviteLabel`),/* @__PURE__ */ (0,i.jsx)(`input`,{className:Z.input,value:T,onChange:e=>E(e.target.value),autoCapitalize:`none`,spellCheck:!1,disabled:n})]})]}),/* @__PURE__ */ (0,i.jsx)(`div`,{className:Z.actions,children:/* @__PURE__ */ (0,i.jsx)(r.Button,{type:`submit`,variant:`primary`,disabled:n||m||(d?f===void 0&&O:v===``||x||O),"aria-busy":n,children:c(n?`connectDevices.preparing`:`connectDevices.relay.enable`)})})]}):/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Z.actions,children:[!k&&/* @__PURE__ */ (0,i.jsx)(r.Button,{variant:`outline`,disabled:n,onClick:s,children:c(`connectDevices.refresh`)}),/* @__PURE__ */ (0,i.jsx)(r.Button,{variant:`outline`,disabled:n,onClick:()=>a(!1,{kind:e}),children:c(`connectDevices.relay.disable`)})]})]})}var Ed=/* @__PURE__ */ (e=>(e[e.Border=-1]=`Border`,e[e.Data=0]=`Data`,e[e.Function=1]=`Function`,e[e.Position=2]=`Position`,e[e.Timing=3]=`Timing`,e[e.Alignment=4]=`Alignment`,e))(Ed||{});let Dd=[0,1],Od=[1,0],kd=[2,3],Ad=[3,2],jd={L:Dd,M:Od,Q:kd,H:Ad},Md=/^\d*$/,Nd=/^[A-Z0-9 $%*+./:-]*$/,Pd=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`,Fd=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],Id=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]];var Ld=class{constructor(e,t,n,r){if(this.version=e,this.ecc=t,e<1||e>40)throw RangeError(`Version value out of range`);if(r<-1||r>7)throw RangeError(`Mask value out of range`);this.size=e*4+17;let i=Array.from({length:this.size}).fill(!1);for(let e=0;e<this.size;e++)this.modules.push(i.slice()),this.types.push(i.map(()=>0));this.drawFunctionPatterns();let a=this.addEccAndInterleave(n);if(this.drawCodewords(a),r===-1){let e=1e9;for(let t=0;t<8;t++){this.applyMask(t),this.drawFormatBits(t);let n=this.getPenaltyScore();n<e&&(r=t,e=n),this.applyMask(t)}}this.mask=r,this.applyMask(r),this.drawFormatBits(r)}size;mask;modules=[];types=[];getModule(e,t){return e>=0&&e<this.size&&t>=0&&t<this.size&&this.modules[t][e]}drawFunctionPatterns(){for(let e=0;e<this.size;e++)this.setFunctionModule(6,e,e%2==0,Ed.Timing),this.setFunctionModule(e,6,e%2==0,Ed.Timing);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);let e=this.getAlignmentPatternPositions(),t=e.length;for(let n=0;n<t;n++)for(let r=0;r<t;r++)n===0&&r===0||n===0&&r===t-1||n===t-1&&r===0||this.drawAlignmentPattern(e[n],e[r]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(e){let t=this.ecc[1]<<3|e,n=t;for(let e=0;e<10;e++)n=n<<1^(n>>>9)*1335;let r=(t<<10|n)^21522;for(let e=0;e<=5;e++)this.setFunctionModule(8,e,zd(r,e));this.setFunctionModule(8,7,zd(r,6)),this.setFunctionModule(8,8,zd(r,7)),this.setFunctionModule(7,8,zd(r,8));for(let e=9;e<15;e++)this.setFunctionModule(14-e,8,zd(r,e));for(let e=0;e<8;e++)this.setFunctionModule(this.size-1-e,8,zd(r,e));for(let e=8;e<15;e++)this.setFunctionModule(8,this.size-15+e,zd(r,e));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let e=this.version;for(let t=0;t<12;t++)e=e<<1^(e>>>11)*7973;let t=this.version<<12|e;for(let e=0;e<18;e++){let n=zd(t,e),r=this.size-11+e%3,i=Math.floor(e/3);this.setFunctionModule(r,i,n),this.setFunctionModule(i,r,n)}}drawFinderPattern(e,t){for(let n=-4;n<=4;n++)for(let r=-4;r<=4;r++){let i=Math.max(Math.abs(r),Math.abs(n)),a=e+r,o=t+n;a>=0&&a<this.size&&o>=0&&o<this.size&&this.setFunctionModule(a,o,i!==2&&i!==4,Ed.Position)}}drawAlignmentPattern(e,t){for(let n=-2;n<=2;n++)for(let r=-2;r<=2;r++)this.setFunctionModule(e+r,t+n,Math.max(Math.abs(r),Math.abs(n))!==1,Ed.Alignment)}setFunctionModule(e,t,n,r=Ed.Function){this.modules[t][e]=n,this.types[t][e]=r}addEccAndInterleave(e){let t=this.version,n=this.ecc;if(e.length!==ef(t,n))throw RangeError(`Invalid argument`);let r=Id[n[0]][t],i=Fd[n[0]][t],a=Math.floor($d(t)/8),o=r-a%r,s=Math.floor(a/r),c=[],l=tf(i);for(let t=0,n=0;t<r;t++){let r=e.slice(n,n+s-i+(t<o?0:1));n+=r.length;let a=nf(r,l);t<o&&r.push(0),c.push(r.concat(a))}let u=[];for(let e=0;e<c[0].length;e++)c.forEach((t,n)=>{(e!==s-i||n>=o)&&u.push(t[e])});return u}drawCodewords(e){if(e.length!==Math.floor($d(this.version)/8))throw RangeError(`Invalid argument`);let t=0;for(let n=this.size-1;n>=1;n-=2){n===6&&(n=5);for(let r=0;r<this.size;r++)for(let i=0;i<2;i++){let a=n-i,o=n+1&2?r:this.size-1-r;!this.types[o][a]&&t<e.length*8&&(this.modules[o][a]=zd(e[t>>>3],7-(t&7)),t++)}}}applyMask(e){if(e<0||e>7)throw RangeError(`Mask value out of range`);for(let t=0;t<this.size;t++)for(let n=0;n<this.size;n++){let r;switch(e){case 0:r=(n+t)%2==0;break;case 1:r=t%2==0;break;case 2:r=n%3==0;break;case 3:r=(n+t)%3==0;break;case 4:r=(Math.floor(n/3)+Math.floor(t/2))%2==0;break;case 5:r=n*t%2+n*t%3==0;break;case 6:r=(n*t%2+n*t%3)%2==0;break;case 7:r=((n+t)%2+n*t%3)%2==0;break;default:throw Error(`Unreachable`)}!this.types[t][n]&&r&&(this.modules[t][n]=!this.modules[t][n])}}getPenaltyScore(){let e=0;for(let t=0;t<this.size;t++){let n=!1,r=0,i=[0,0,0,0,0,0,0];for(let a=0;a<this.size;a++)this.modules[t][a]===n?(r++,r===5?e+=3:r>5&&e++):(this.finderPenaltyAddHistory(r,i),n||(e+=this.finderPenaltyCountPatterns(i)*40),n=this.modules[t][a],r=1);e+=this.finderPenaltyTerminateAndCount(n,r,i)*40}for(let t=0;t<this.size;t++){let n=!1,r=0,i=[0,0,0,0,0,0,0];for(let a=0;a<this.size;a++)this.modules[a][t]===n?(r++,r===5?e+=3:r>5&&e++):(this.finderPenaltyAddHistory(r,i),n||(e+=this.finderPenaltyCountPatterns(i)*40),n=this.modules[a][t],r=1);e+=this.finderPenaltyTerminateAndCount(n,r,i)*40}for(let t=0;t<this.size-1;t++)for(let n=0;n<this.size-1;n++){let r=this.modules[t][n];r===this.modules[t][n+1]&&r===this.modules[t+1][n]&&r===this.modules[t+1][n+1]&&(e+=3)}let t=0;for(let e of this.modules)t=e.reduce((e,t)=>e+ +!!t,t);let n=this.size*this.size,r=Math.ceil(Math.abs(t*20-n*10)/n)-1;return e+=r*10,e}getAlignmentPatternPositions(){if(this.version===1)return[];{let e=Math.floor(this.version/7)+2,t=this.version===32?26:Math.ceil((this.version*4+4)/(e*2-2))*2,n=[6];for(let r=this.size-7;n.length<e;r-=t)n.splice(1,0,r);return n}}finderPenaltyCountPatterns(e){let t=e[1],n=t>0&&e[2]===t&&e[3]===t*3&&e[4]===t&&e[5]===t;return(n&&e[0]>=t*4&&e[6]>=t?1:0)+(n&&e[6]>=t*4&&e[0]>=t?1:0)}finderPenaltyTerminateAndCount(e,t,n){return e&&(this.finderPenaltyAddHistory(t,n),t=0),t+=this.size,this.finderPenaltyAddHistory(t,n),this.finderPenaltyCountPatterns(n)}finderPenaltyAddHistory(e,t){t[0]===0&&(e+=this.size),t.pop(),t.unshift(e)}};function Rd(e,t,n){if(t<0||t>31||e>>>t)throw RangeError(`Value out of range`);for(let r=t-1;r>=0;r--)n.push(e>>>r&1)}function zd(e,t){return!!(e>>>t&1)}var Bd=class{constructor(e,t,n){if(this.mode=e,this.numChars=t,this.bitData=n,t<0)throw RangeError(`Invalid argument`);this.bitData=n.slice()}getData(){return this.bitData.slice()}};let Vd=[1,10,12,14],Hd=[2,9,11,13],Ud=[4,8,16,16];function Wd(e,t){return e[Math.floor((t+7)/17)+1]}function Gd(e){let t=[];for(let n of e)Rd(n,8,t);return new Bd(Ud,e.length,t)}function Kd(e){if(!Yd(e))throw RangeError(`String contains non-numeric characters`);let t=[];for(let n=0;n<e.length;){let r=Math.min(e.length-n,3);Rd(Number.parseInt(e.substring(n,n+r),10),r*3+1,t),n+=r}return new Bd(Vd,e.length,t)}function qd(e){if(!Xd(e))throw RangeError(`String contains unencodable characters in alphanumeric mode`);let t=[],n=0;for(;n+2<=e.length;n+=2){let r=Pd.indexOf(e.charAt(n))*45;r+=Pd.indexOf(e.charAt(n+1)),Rd(r,11,t)}return n<e.length&&Rd(Pd.indexOf(e.charAt(n)),6,t),new Bd(Hd,e.length,t)}function Jd(e){return e===``?[]:Yd(e)?[Kd(e)]:Xd(e)?[qd(e)]:[Gd(Qd(e))]}function Yd(e){return Md.test(e)}function Xd(e){return Nd.test(e)}function Zd(e,t){let n=0;for(let r of e){let e=Wd(r.mode,t);if(r.numChars>=1<<e)return 1/0;n+=4+e+r.bitData.length}return n}function Qd(e){e=encodeURI(e);let t=[];for(let n=0;n<e.length;n++)e.charAt(n)===`%`?(t.push(Number.parseInt(e.substring(n+1,n+3),16)),n+=2):t.push(e.charCodeAt(n));return t}function $d(e){if(e<1||e>40)throw RangeError(`Version number out of range`);let t=(16*e+128)*e+64;if(e>=2){let n=Math.floor(e/7)+2;t-=(25*n-10)*n-55,e>=7&&(t-=36)}return t}function ef(e,t){return Math.floor($d(e)/8)-Fd[t[0]][e]*Id[t[0]][e]}function tf(e){if(e<1||e>255)throw RangeError(`Degree out of range`);let t=[];for(let n=0;n<e-1;n++)t.push(0);t.push(1);let n=1;for(let r=0;r<e;r++){for(let e=0;e<t.length;e++)t[e]=rf(t[e],n),e+1<t.length&&(t[e]^=t[e+1]);n=rf(n,2)}return t}function nf(e,t){let n=t.map(e=>0);for(let r of e){let e=r^n.shift();n.push(0),t.forEach((t,r)=>n[r]^=rf(t,e))}return n}function rf(e,t){if(e>>>8||t>>>8)throw RangeError(`Byte out of range`);let n=0;for(let r=7;r>=0;r--)n=n<<1^(n>>>7)*285,n^=(t>>>r&1)*e;return n}function af(e,t,n=1,r=40,i=-1,a=!0){if(!(1<=n&&n<=r&&r<=40)||i<-1||i>7)throw RangeError(`Invalid value`);let o,s;for(o=n;;o++){let n=ef(o,t)*8,i=Zd(e,o);if(i<=n){s=i;break}if(o>=r)throw RangeError(`Data too long`)}for(let e of[Od,kd,Ad])a&&s<=ef(o,e)*8&&(t=e);let c=[];for(let t of e){Rd(t.mode[0],4,c),Rd(t.numChars,Wd(t.mode,o),c);for(let e of t.getData())c.push(e)}let l=ef(o,t)*8;Rd(0,Math.min(4,l-c.length),c),Rd(0,(8-c.length%8)%8,c);for(let e=236;c.length<l;e^=253)Rd(e,8,c);let u=Array.from({length:Math.ceil(c.length/8)},()=>0);return c.forEach((e,t)=>u[t>>>3]|=e<<7-(t&7)),new Ld(o,t,u,i)}function of(e,t){let{ecc:n=`L`,boostEcc:r=!1,minVersion:i=1,maxVersion:a=40,maskPattern:o=-1,border:s=1}=t||{},c=typeof e==`string`?Jd(e):Array.isArray(e)?[Gd(e)]:void 0;if(!c)throw Error(`uqr only supports encoding string and binary data, but got: ${typeof e}`);let l=af(c,jd[n],i,a,o,r),u=sf({version:l.version,maskPattern:l.mask,size:l.size,data:l.modules,types:l.types},s);return t?.invert&&(u.data=u.data.map(e=>e.map(e=>!e))),t?.onEncoded?.(u),u}function sf(e,t=1){if(!t)return e;let{size:n}=e,r=n+t*2;e.size=r,e.data.forEach(e=>{for(let n=0;n<t;n++)e.unshift(!1),e.push(!1)});for(let n=0;n<t;n++)e.data.unshift(Array.from({length:r},e=>!1)),e.data.push(Array.from({length:r},e=>!1));let i=Ed.Border;e.types.forEach(e=>{for(let n=0;n<t;n++)e.unshift(i),e.push(i)});for(let n=0;n<t;n++)e.types.unshift(Array.from({length:r},e=>i)),e.types.push(Array.from({length:r},e=>i));return e}function cf({value:e,label:t,className:n}){let{size:r,path:a}=(0,o.useMemo)(()=>{let t=of(e,{ecc:`M`,border:2}),n=``;return t.data.forEach((e,t)=>{e.forEach((e,r)=>{e&&(n+=`M${String(r)} ${String(t)}h1v1h-1z`)})}),{size:t.size,path:n}},[e]);return/* @__PURE__ */ (0,i.jsxs)(`svg`,{role:`img`,"aria-label":t,className:n,viewBox:`0 0 ${String(r)} ${String(r)}`,shapeRendering:`crispEdges`,children:[/* @__PURE__ */ (0,i.jsx)(`rect`,{width:r,height:r,fill:`#fff`}),/* @__PURE__ */ (0,i.jsx)(`path`,{d:a,fill:`#000`})]})}function lf({t:e}){return/* @__PURE__ */ (0,i.jsxs)(`details`,{className:Z.other,"data-self-relay-help":!0,children:[/* @__PURE__ */ (0,i.jsx)(`summary`,{children:e(`connectDevices.selfRelay.helpTitle`)}),/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Z.connectionHelp,children:[/* @__PURE__ */ (0,i.jsxs)(`ol`,{className:Z.relayTutorial,children:[/* @__PURE__ */ (0,i.jsx)(`li`,{children:e(`connectDevices.selfRelay.domain`)}),/* @__PURE__ */ (0,i.jsx)(`li`,{children:e(`connectDevices.selfRelay.dns`)}),/* @__PURE__ */ (0,i.jsx)(`li`,{children:e(`connectDevices.selfRelay.ports`)}),/* @__PURE__ */ (0,i.jsxs)(`li`,{children:[e(`connectDevices.selfRelay.docker`),/* @__PURE__ */ (0,i.jsx)(`code`,{children:`git clone https://github.com/BytePioneer-AI/codex-host.git /opt/codexhost`}),/* @__PURE__ */ (0,i.jsx)(`code`,{children:`cd /opt/codexhost/packages/remote-relay/deploy`}),/* @__PURE__ */ (0,i.jsx)(`code`,{children:e(`connectDevices.selfRelay.replaceDomain`)}),/* @__PURE__ */ (0,i.jsx)(`code`,{children:`echo "RELAY_DOMAIN=example.com" > .env`}),/* @__PURE__ */ (0,i.jsx)(`code`,{children:`docker compose up -d --build`})]}),/* @__PURE__ */ (0,i.jsx)(`li`,{children:e(`connectDevices.selfRelay.connect`)})]}),/* @__PURE__ */ (0,i.jsx)(`p`,{className:Z.meta,children:e(`connectDevices.selfRelay.noDomain`)}),/* @__PURE__ */ (0,i.jsx)(`a`,{className:Z.link,href:`https://github.com/BytePioneer-AI/codex-host/blob/main/docs/product/self-hosted-relay.md`,target:`_blank`,rel:`noreferrer`,children:e(`connectDevices.selfRelay.docs`)})]})]})}let uf={public:`connectDevices.kindPublic`,relay:`connectDevices.relay.title`,"self-hosted-relay":`connectDevices.selfRelay.title`,"tailscale-funnel":`connectDevices.kindFunnel`,"tailscale-https":`connectDevices.kindTailscale`,tailscale:`connectDevices.kindTailscale`,lan:`connectDevices.kindLan`,virtual:`connectDevices.kindVirtual`},df={public:`connectDevices.kindPublicHint`,"tailscale-funnel":`connectDevices.kindFunnelHint`,virtual:`connectDevices.kindVirtualHint`},ff={"tailscale-https":`connectDevices.httpsSummary`,relay:`connectDevices.relay.summary`,"self-hosted-relay":`connectDevices.selfRelay.summary`,lan:`connectDevices.lanSummary`},pf=[`public`,`relay`,`self-hosted-relay`,`tailscale-funnel`,`tailscale-https`,`tailscale`,`lan`,`virtual`];function mf({data:e,busy:t,restarting:n,onEnable:a,onRelay:s,onRefresh:c,t:l}){let{networkUrls:u,tailscale:d,background:f,secret:p,relay:m}=e,h=m?.kind===`self-hosted`?`self-hosted-relay`:`relay`,g=[...u,...(e.directCandidates??[]).filter(e=>!u.some(t=>t.url===e.url))],[_,v]=(0,o.useState)(),y=e=>e===`relay`||e===`self-hosted-relay`,b=m!==void 0&&(m.enabled||m.state.status===`off`&&m.state.reason!==void 0),x=(_!==void 0&&y(_)&&m===void 0?void 0:_)??pf.find(e=>y(e)?e===h&&b:u.some(t=>t.kind===e))??(g.some(e=>e.kind===`lan`)?`lan`:`tailscale-https`),[S,C]=(0,o.useState)(),[w,T]=(0,o.useState)(!1),[E,D]=(0,o.useState)(!1),[O,ee]=(0,o.useState)(`idle`),te=(0,o.useId)(),k=g.filter(e=>e.kind===`relay`?x===h:e.kind===x),A=k.find(e=>e.url===S)??k[0],ne=!n&&A!==void 0&&u.some(e=>e.url===A.url),j=ne?`${A.url}#token=${p}`:void 0,M=ne?df[x]:void 0,re=x===`tailscale-https`,ie=re?d.status===`not-serving`:(x===`lan`||x===`tailscale`||x===`virtual`)&&f!==void 0&&!f.lan&&A!==void 0,ae=pf.filter(e=>e!==`lan`&&!y(e)&&e!==`tailscale-https`&&e!==`tailscale`&&g.some(t=>t.kind===e)),oe=x===`tailscale-https`||x===`tailscale`,se=g.some(e=>e.kind===`tailscale`),ce=e=>{v(e),C(void 0)};(0,o.useEffect)(()=>{ee(`idle`)},[j]),(0,o.useEffect)(()=>{if(O===`idle`)return;let e=setTimeout(()=>ee(`idle`),2e3);return()=>clearTimeout(e)},[O]);let le=e=>{if(y(e))return e===`relay`?m?.officialHost:m?.customHost;let t=e===`tailscale-https`&&oe?A:e===`tailscale-https`?g.find(t=>t.kind===e)??g.find(e=>e.kind===`tailscale`):e===x?A:g.find(t=>t.kind===e);return t===void 0?void 0:new URL(t.url).host},ue=e=>/* @__PURE__ */ (0,i.jsxs)(`label`,{className:Z.route,"data-connect-route":e,children:[/* @__PURE__ */ (0,i.jsx)(`input`,{type:`radio`,name:te,checked:e===`tailscale-https`?oe:x===e,disabled:t,onChange:()=>ce(e)}),/* @__PURE__ */ (0,i.jsxs)(`span`,{className:Z.routeText,children:[/* @__PURE__ */ (0,i.jsxs)(`span`,{className:Z.routeTitle,children:[l(uf[e]),e===`tailscale-https`&&/* @__PURE__ */ (0,i.jsx)(`span`,{className:Z.badge,children:l(`connectDevices.recommended`)}),y(e)&&m?.enabled&&e===h&&/* @__PURE__ */ (0,i.jsx)(`span`,{className:Z.badge,children:l(`connectDevices.relay.inUse`)}),/* @__PURE__ */ (0,i.jsx)(`span`,{className:Z.routeAddress,children:le(e)})]}),(e===`lan`||e===`tailscale-https`||e===`relay`||e===`self-hosted-relay`)&&/* @__PURE__ */ (0,i.jsx)(`span`,{className:Z.meta,children:l(ff[e])})]})]},e);return/* @__PURE__ */ (0,i.jsxs)(`section`,{className:Z.connection,children:[/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Z.connectionMain,children:[/* @__PURE__ */ (0,i.jsx)(`div`,{className:Z.scan,children:j===void 0?/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Z.qrPlaceholder,children:[/* @__PURE__ */ (0,i.jsx)(r.IconShieldOutlineRegular,{size:32}),/* @__PURE__ */ (0,i.jsx)(`span`,{children:l(n?`connectDevices.preparing`:`connectDevices.qrPending`)})]}):/* @__PURE__ */ (0,i.jsx)(`button`,{type:`button`,className:Z.qrButton,"aria-label":l(`connectDevices.enlargeQr`),disabled:t,onClick:()=>T(!0),children:/* @__PURE__ */ (0,i.jsx)(cf,{value:j,label:l(`connectDevices.qrLabel`),className:Z.qr})})}),/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Z.connectionDetails,children:[y(x)&&m!==void 0&&/* @__PURE__ */ (0,i.jsx)(Td,{kind:x===`relay`?`official`:`self-hosted`,relay:m,busy:t,onChange:s,onRefresh:c,t:l},x),!y(x)&&(!ne||M!==void 0)&&/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Z.connectionHelp,"data-tailscale-status":re&&d.status!==`serving`?d.status:void 0,children:[M===void 0?n?/* @__PURE__ */ (0,i.jsx)(`p`,{role:`status`,className:Z.notice,children:l(`connectDevices.restarting`)}):re?/* @__PURE__ */ (0,i.jsxs)(i.Fragment,{children:[/* @__PURE__ */ (0,i.jsx)(`p`,{className:Z.notice,children:l(d.status===`not-serving`?`connectDevices.httpsSetup`:d.status===`serving`?`connectDevices.refreshHint`:`connectDevices.tailscale.${d.status}`)}),d.status===`occupied`&&/* @__PURE__ */ (0,i.jsx)(`p`,{className:Z.meta,children:d.target}),d.status===`error`&&/* @__PURE__ */ (0,i.jsx)(`p`,{className:Z.error,children:d.message}),d.status===`not-installed`&&/* @__PURE__ */ (0,i.jsx)(`a`,{className:Z.link,href:`https://tailscale.com/download`,target:`_blank`,rel:`noreferrer`,children:l(`connectDevices.remote.tailscaleLink`)}),d.status===`https-disabled`&&/* @__PURE__ */ (0,i.jsx)(`a`,{className:Z.link,href:`https://login.tailscale.com/admin/dns`,target:`_blank`,rel:`noreferrer`,children:l(`connectDevices.openTailscale`)}),d.status===`not-serving`&&/* @__PURE__ */ (0,i.jsx)(`p`,{className:Z.meta,children:l(`connectDevices.httpsPersistence`)})]}):/* @__PURE__ */ (0,i.jsx)(`p`,{className:Z.notice,children:l(ie?`connectDevices.enableImpact`:f===void 0?`connectDevices.localListener`:`connectDevices.noAddress`)}):/* @__PURE__ */ (0,i.jsxs)(`p`,{className:Z.ready,children:[/* @__PURE__ */ (0,i.jsx)(r.IconCheckCircleOutlineRegular,{}),/* @__PURE__ */ (0,i.jsx)(`span`,{children:l(M)})]}),!ne&&!n&&/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Z.actions,children:[ie&&/* @__PURE__ */ (0,i.jsx)(r.Button,{variant:`primary`,disabled:t,"aria-busy":t,onClick:()=>a(re?`https`:`direct`),children:l(t?`connectDevices.preparing`:`connectDevices.enableQr`)}),(re||!ie)&&/* @__PURE__ */ (0,i.jsx)(r.Button,{variant:`outline`,disabled:t,onClick:c,children:l(`connectDevices.refresh`)})]})]}),A!==void 0&&/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Z.addressRow,children:[k.length>1?/* @__PURE__ */ (0,i.jsx)(r.Menu,{open:E,onClose:()=>D(!1),portal:!0,className:Z.addressMenu,anchor:/* @__PURE__ */ (0,i.jsxs)(`button`,{"aria-label":l(`connectDevices.address`),type:`button`,className:`${Z.input} ${Z.addressTrigger}`,disabled:t,"aria-haspopup":`menu`,"aria-expanded":E,onClick:()=>D(!E),children:[/* @__PURE__ */ (0,i.jsx)(`span`,{children:new URL(A.url).host}),/* @__PURE__ */ (0,i.jsx)(r.IconChevronDownOutlineRegular,{})]}),items:k.map(e=>({id:e.url,label:new URL(e.url).host})),selectedId:A.url,onSelect:e=>{D(!1),C(e)}}):/* @__PURE__ */ (0,i.jsx)(`input`,{"aria-label":l(`connectDevices.address`),className:Z.input,value:new URL(A.url).host,readOnly:!0}),j!==void 0&&/* @__PURE__ */ (0,i.jsx)(r.Button,{variant:`outline`,disabled:t,onClick:()=>{navigator.clipboard.writeText(j).then(()=>ee(`copied`),()=>ee(`failed`))},children:l(O===`copied`?`connectDevices.copied`:O===`failed`?`connectDevices.copyFailed`:`connectDevices.copyLink`)})]}),x===`self-hosted-relay`&&m!==void 0&&/* @__PURE__ */ (0,i.jsx)(lf,{t:l})]})]}),/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Z.routePanel,children:[/* @__PURE__ */ (0,i.jsxs)(`fieldset`,{className:Z.routes,disabled:t,children:[/* @__PURE__ */ (0,i.jsx)(`legend`,{className:Z.fieldTitle,children:l(`connectDevices.connectVia`)}),/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Z.routeGroup,children:[/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Z.routeFamily,children:[ue(`tailscale-https`),oe&&se&&/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Z.subRoutes,children:[/* @__PURE__ */ (0,i.jsxs)(`label`,{className:Z.subRoute,children:[/* @__PURE__ */ (0,i.jsx)(`input`,{type:`radio`,name:`${te}-tailscale`,checked:x===`tailscale-https`,onChange:()=>ce(`tailscale-https`)}),l(`connectDevices.tailscaleViaHttps`)]}),/* @__PURE__ */ (0,i.jsxs)(`label`,{className:Z.subRoute,"data-connect-route":`tailscale`,children:[/* @__PURE__ */ (0,i.jsx)(`input`,{type:`radio`,name:`${te}-tailscale`,checked:x===`tailscale`,onChange:()=>ce(`tailscale`)}),l(`connectDevices.tailscaleViaIp`)]})]})]}),m!==void 0&&/* @__PURE__ */ (0,i.jsxs)(i.Fragment,{children:[ue(`relay`),ue(`self-hosted-relay`)]}),ue(`lan`)]})]}),ae.length>0&&/* @__PURE__ */ (0,i.jsxs)(`details`,{className:Z.other,open:ae.includes(x)?!0:void 0,children:[/* @__PURE__ */ (0,i.jsx)(`summary`,{children:l(`connectDevices.otherMethods`)}),/* @__PURE__ */ (0,i.jsx)(`div`,{className:Z.extraRoutes,children:ae.map(ue)})]})]}),w&&j!==void 0&&/* @__PURE__ */ (0,i.jsx)(r.Modal,{open:!0,onClose:()=>T(!1),title:l(`connectDevices.scan`),closeLabel:l(`connectDevices.close`),className:Z.qrModal,children:/* @__PURE__ */ (0,i.jsx)(cf,{value:j,label:l(`connectDevices.qrLabel`),className:Z.largeQr})})]})}let hf=e=>e instanceof Error?e.message:String(e);function gf(e){if(e instanceof Tl&&e.code===`auth/disabled`)return{kind:`disabled`};if(e instanceof Tl&&e.code===`auth/local-access-required`){let t=Ls.safeParse(e.details);return{kind:`non-local`,url:t.success?t.data.url:`http://127.0.0.1`}}return{kind:`failed`,message:hf(e)}}function _f({title:e,description:t,confirmLabel:n,busy:a,error:o,onClose:s,onConfirm:c,t:l}){return/* @__PURE__ */ (0,i.jsx)(r.Modal,{open:!0,onClose:()=>{a||s()},title:e,closeLabel:l(`connectDevices.close`),description:t,className:Z.confirm,footer:/* @__PURE__ */ (0,i.jsxs)(i.Fragment,{children:[/* @__PURE__ */ (0,i.jsx)(r.Button,{variant:`outline`,disabled:a,onClick:s,children:l(`connectDevices.cancel`)}),/* @__PURE__ */ (0,i.jsx)(r.Button,{variant:`primary`,className:Z.dangerConfirm,disabled:a,"aria-busy":a,onClick:c,children:n})]}),children:o!==null&&/* @__PURE__ */ (0,i.jsx)(`p`,{className:Z.error,role:`alert`,children:o})})}function vf({url:e,t}){let[n,a]=(0,o.useState)(!1),[s,c]=(0,o.useState)(!1),[l,u]=(0,o.useState)(null);return/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Z.page,children:[/* @__PURE__ */ (0,i.jsx)(`p`,{className:Z.notice,"data-connect-notice":`non-local`,children:t(`connectDevices.localOnly`,{url:e})}),/* @__PURE__ */ (0,i.jsx)(`div`,{children:/* @__PURE__ */ (0,i.jsx)(r.Button,{variant:`outline`,onClick:()=>a(!0),children:t(`connectDevices.signOut`)})}),n&&/* @__PURE__ */ (0,i.jsx)(_f,{t,title:t(`connectDevices.signOutTitle`),description:t(`connectDevices.signOutDescription`),confirmLabel:t(`connectDevices.signOutConfirm`),busy:s,error:l,onClose:()=>a(!1),onConfirm:()=>{c(!0),u(null),Qu().catch(e=>{c(!1),u(t(`connectDevices.actionFailed`,{message:hf(e)}))})}})]})}function yf({t:e}){let[t,n]=(0,o.useState)({kind:`loading`}),[a,s]=(0,o.useState)(null),[c,l]=(0,o.useState)(!1),[u,d]=(0,o.useState)(null),[f,p]=(0,o.useState)(!1),m=(0,o.useCallback)(e=>n({kind:`ready`,data:e}),[]),h=Sd(m,e(`connectDevices.restartTimeout`)),g=c||h.target!==null;(0,o.useEffect)(()=>{if(!f)return;let e=setTimeout(()=>p(!1),2e3);return()=>clearTimeout(e)},[f]),(0,o.useEffect)(()=>{let e=!1;return Ml.get().then(t=>{e||n({kind:`ready`,data:t})},t=>{e||n(gf(t))}),()=>{e=!0}},[]);let _=t.kind===`ready`?t.data.relay?.state:void 0,v=_!==void 0&&wd(_);(0,o.useEffect)(()=>{if(!v)return;let e=setTimeout(()=>{Ml.get().then(m,()=>void 0)},2e3);return()=>clearTimeout(e)},[v,t,m]);let y=async()=>{let e=await Ml.get();return m(e),e},b=async t=>{l(!0),d(null),h.fail(void 0);try{await t()}catch(t){d(e(`connectDevices.actionFailed`,{message:hf(t)}));try{await y()}catch{}}finally{l(!1)}},x=e=>{b(async()=>{if(e===`direct`){let{changed:e}=await Ml.lan(!0);e?h.start(!0):await y()}else{let e=await Ml.serve(!0);if(e.error!==void 0)throw Error(e.error);await y()}})},S=async()=>{let t=await y();t.relay?.enabled&&(await Ml.relay(!1),t=await y());let n=/* @__PURE__ */ new Set;for(;t.tailscale.status===`serving`;){if(n.has(t.tailscale.url)||n.size>=16)throw Error(e(`connectDevices.stopIncomplete`));n.add(t.tailscale.url);let r=await Ml.serve(!1);if(r.error!==void 0)throw Error(r.error);t=await y()}if(t.tailscale.status===`error`)throw Error(t.tailscale.message);if(t.background?.lan){let{changed:e}=await Ml.lan(!1);e?h.start(!1):await y()}s(null)};if(t.kind===`loading`)return/* @__PURE__ */ (0,i.jsx)(`p`,{className:Z.meta,children:e(`connectDevices.loading`)});if(t.kind===`non-local`)return/* @__PURE__ */ (0,i.jsx)(vf,{url:t.url,t:e});if(t.kind===`disabled`)return/* @__PURE__ */ (0,i.jsx)(`p`,{className:Z.notice,"data-connect-notice":`disabled`,children:e(`connectDevices.disabled`)});if(t.kind===`failed`)return/* @__PURE__ */ (0,i.jsx)(`p`,{className:Z.error,role:`alert`,children:e(`connectDevices.loadFailed`,{message:t.message})});let{data:C}=t,{secret:w,lastUsedAt:T,networkUrls:E,tailscale:D,background:O}=C,ee=E.length>0||O?.lan===!0,te=O?.lan===!0||D.status===`serving`||C.relay?.enabled===!0,k=E.some(e=>e.kind===`public`||O===void 0&&[`lan`,`tailscale`,`virtual`].includes(e.kind)),A=T===null?void 0:(0,r.relativeTime)(T,Date.now()),ne=u??h.error;return/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Z.page,"data-connect-devices":!0,children:[/* @__PURE__ */ (0,i.jsxs)(`header`,{className:Z.header,children:[/* @__PURE__ */ (0,i.jsxs)(`div`,{children:[/* @__PURE__ */ (0,i.jsx)(`h2`,{className:Z.title,children:e(`connectDevices.title`)}),/* @__PURE__ */ (0,i.jsx)(`p`,{className:Z.description,children:e(`connectDevices.subtitle`)})]}),/* @__PURE__ */ (0,i.jsx)(`span`,{className:Z.status,"data-active":ee&&h.target===null,children:e(h.target===null?ee?`connectDevices.accessEnabled`:`connectDevices.localAccess`:`connectDevices.preparing`)})]}),/* @__PURE__ */ (0,i.jsx)(mf,{data:C,busy:g,restarting:h.target!==null,onEnable:x,onRelay:(e,t)=>{b(async()=>{await Ml.relay(e,t),await y()})},onRefresh:()=>{b(async()=>{await y()})},t:e}),a===null&&ne!=null&&/* @__PURE__ */ (0,i.jsx)(`p`,{role:`alert`,className:Z.error,children:ne}),/* @__PURE__ */ (0,i.jsxs)(`section`,{className:Z.manage,children:[/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Z.manageRow,children:[/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Z.manageText,children:[/* @__PURE__ */ (0,i.jsx)(`span`,{className:Z.manageTitle,children:e(`connectDevices.tokenTitle`)}),/* @__PURE__ */ (0,i.jsx)(`span`,{className:Z.meta,title:T===null?void 0:new Date(T).toLocaleString(),children:A===void 0?e(`connectDevices.neverUsed`):e(`connectDevices.lastUsed`,{time:e(`connectDevices.relative.${A.unit}`,{n:A.n})})})]}),/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Z.manageActions,children:[/* @__PURE__ */ (0,i.jsx)(r.Button,{variant:`outline`,disabled:g,onClick:()=>{d(null),navigator.clipboard.writeText(w).then(()=>p(!0),()=>d(e(`connectDevices.copyFailed`)))},children:e(f?`connectDevices.copied`:`connectDevices.copyToken`)}),/* @__PURE__ */ (0,i.jsx)(r.Button,{variant:`outline`,disabled:g,onClick:()=>{d(null),s(`regenerate`)},children:e(`connectDevices.regenerate`)})]})]}),O!==void 0&&/* @__PURE__ */ (0,i.jsx)(Cd,{state:O,disabled:g,restored:m,t:e})]}),te&&/* @__PURE__ */ (0,i.jsxs)(`div`,{className:`${Z.manageRow} ${Z.stopRow}`,children:[/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Z.manageText,children:[/* @__PURE__ */ (0,i.jsx)(`span`,{className:Z.manageTitle,children:e(`connectDevices.stopTitleShort`)}),/* @__PURE__ */ (0,i.jsx)(`span`,{className:Z.meta,children:e(`connectDevices.stopHint`)})]}),/* @__PURE__ */ (0,i.jsx)(`div`,{className:Z.manageActions,children:/* @__PURE__ */ (0,i.jsx)(r.Button,{variant:`outline`,className:Z.dangerOutline,disabled:g,onClick:()=>{d(null),s(`stop`)},children:e(`connectDevices.stop`)})})]}),/* @__PURE__ */ (0,i.jsxs)(`details`,{className:Z.other,"data-remote-options":!0,children:[/* @__PURE__ */ (0,i.jsx)(`summary`,{children:e(`connectDevices.help`)}),/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Z.remoteList,children:[/* @__PURE__ */ (0,i.jsx)(`p`,{className:Z.notice,children:e(`connectDevices.keepAwake`)}),/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Z.routeText,children:[/* @__PURE__ */ (0,i.jsx)(`span`,{className:Z.routeTitle,children:`Tailscale`}),/* @__PURE__ */ (0,i.jsx)(`span`,{className:Z.meta,children:e(`connectDevices.remote.tailscale`)}),/* @__PURE__ */ (0,i.jsx)(`a`,{className:Z.link,href:`https://tailscale.com/download`,target:`_blank`,rel:`noreferrer`,children:e(`connectDevices.remote.tailscaleLink`)})]}),/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Z.routeText,children:[/* @__PURE__ */ (0,i.jsx)(`span`,{className:Z.routeTitle,children:e(`connectDevices.remote.tunnelTitle`)}),/* @__PURE__ */ (0,i.jsx)(`span`,{className:Z.meta,children:e(`connectDevices.remote.tunnel`)}),/* @__PURE__ */ (0,i.jsx)(`a`,{className:Z.link,href:`https://github.com/BytePioneer-AI/codex-host/blob/main/docs/product/web-remote-access.md`,target:`_blank`,rel:`noreferrer`,children:e(`connectDevices.remote.tunnelLink`)})]})]})]}),a!==null&&/* @__PURE__ */ (0,i.jsx)(_f,{t:e,title:e(a===`stop`?`connectDevices.stopTitle`:`connectDevices.regenerateTitle`),description:a===`stop`?`${e(`connectDevices.stopDescription`)}${k?` ${e(`connectDevices.stopUnmanaged`)}`:``}`:e(`connectDevices.regenerateDescription`),confirmLabel:e(a===`stop`?`connectDevices.stopConfirm`:`connectDevices.regenerateConfirm`),busy:g,error:u,onClose:()=>s(null),onConfirm:()=>{b(a===`stop`?S:async()=>{m(await Ml.regenerate()),s(null)})}})]})}async function bf(e,t,n){let r=`codexhost/uiExtensions/${e}`,i=await fetch(`api/${r}`,{method:`POST`,credentials:`same-origin`,headers:{"content-type":`application/json`},body:JSON.stringify({type:`client-request`,rpcId:Sl(),method:r,payload:{args:t}}),signal:n}),a=await i.json();if(a.result?.ok===!1){let{message:e,code:t,details:n}=a.result.error;throw new Tl(e,t,n)}if(!i.ok)throw Error(`HTTP ${String(i.status)}`);return bl.parse(a.result?.value)}let xf={list:e=>bf(`list`,{},e),install:(e,t)=>bf(`install`,{spec:e,...t===void 0?{}:{registry:t}}),setEnabled:(e,t)=>bf(`setEnabled`,{id:e,enabled:t}),remove:e=>bf(`remove`,{id:e})},Sf=`@deepseek-ai/dsh-client-ui-codexhost/InstallWebExtensionDialog.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Sf)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-codexhost`,e.dataset.pluginCss=Sf,e.textContent=`.FXiU_a_dialog{width:min(560px,100%);max-height:min(800px,100%)}.FXiU_a_content{min-height:0;overflow-y:auto}.FXiU_a_body,.FXiU_a_footer,.FXiU_a_field{flex-direction:column;min-width:0;display:flex}.FXiU_a_body{gap:12px}.FXiU_a_footer{flex:1;gap:20px}.FXiU_a_field{color:var(--dsw-alias-label-secondary);gap:6px;font-size:13px}.FXiU_a_field input{box-sizing:border-box;border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-md);background:var(--dsw-alias-bg-layer-3);width:100%;min-width:0;height:40px;font:inherit;color:var(--dsw-alias-label-primary);outline:none;padding:0 14px;font-size:13px}.FXiU_a_field input:focus{border-color:var(--dsw-alias-state-business-primary);box-shadow:inset 0 0 0 .5px var(--dsw-alias-state-business-primary)}.FXiU_a_field input[aria-invalid=true]{border-color:var(--dsw-alias-state-error-primary)}.FXiU_a_field input:disabled,.FXiU_a_registry select:disabled{opacity:.6}.FXiU_a_options{flex-wrap:wrap;justify-content:space-between;align-items:center;gap:8px 12px;display:flex}.FXiU_a_guideToggle{font:inherit;color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:0;align-items:center;gap:6px;padding:0;font-size:12.5px;display:inline-flex}.FXiU_a_guideToggle:hover{color:var(--dsw-alias-label-primary)}.FXiU_a_guideToggle[aria-expanded=true] .FXiU_a_chevron{transform:rotate(180deg)}.FXiU_a_registry{border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-md);background:var(--dsw-alias-bg-layer-2);min-height:28px;color:var(--dsw-alias-label-secondary);flex-wrap:wrap;align-items:center;gap:6px;padding:0 8px 0 10px;font-size:12.5px;display:inline-flex}.FXiU_a_registry select{background:var(--dsw-alias-bg-layer-2);max-width:100%;min-height:32px;font:inherit;color:var(--dsw-alias-label-primary);border:0}.FXiU_a_guide{border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-lg);background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-secondary);padding:8px 14px;font-size:12px;line-height:18px}.FXiU_a_guide p{margin:8px 0 4px}.FXiU_a_guide code{color:var(--dsw-alias-label-tertiary);overflow-wrap:anywhere}.FXiU_a_scope,.FXiU_a_hint,.FXiU_a_error{color:var(--dsw-alias-label-secondary);overflow-wrap:anywhere;margin:0;font-size:12px;line-height:18px}.FXiU_a_error{color:var(--dsw-alias-state-error-primary,#d92d20)}.FXiU_a_wide{width:100%}`,document.head.appendChild(e)}var Cf={body:`FXiU_a_body`,chevron:`FXiU_a_chevron`,content:`FXiU_a_content`,dialog:`FXiU_a_dialog`,error:`FXiU_a_error`,field:`FXiU_a_field`,footer:`FXiU_a_footer`,guide:`FXiU_a_guide`,guideToggle:`FXiU_a_guideToggle`,hint:`FXiU_a_hint`,options:`FXiU_a_options`,registry:`FXiU_a_registry`,scope:`FXiU_a_scope`,wide:`FXiU_a_wide`};let wf={official:`https://registry.npmjs.org/`,mirror:`https://registry.npmmirror.com/`};function Tf({t:e,open:t,busy:n,error:a,onClose:s,onInstall:c}){let[l,u]=(0,o.useState)(``),[d,f]=(0,o.useState)(`official`),[p,m]=(0,o.useState)(``),[h,g]=(0,o.useState)(!1),[_,v]=(0,o.useState)(!1),y=(0,o.useId)(),b=(0,o.useId)(),x=(0,o.useId)(),S=(0,o.useId)(),C=(0,o.useRef)(null);return(0,o.useEffect)(()=>{if(!t)return;let e=(0,r.observeComposition)(document);return C.current=e,()=>{e.dispose(),C.current=null}},[t]),/* @__PURE__ */ (0,i.jsx)(r.Modal,{open:t,onClose:()=>{n||s()},title:e(`extensions.add`),closeLabel:e(`extensions.close`),description:e(`extensions.sourceHint`),className:Cf.dialog,contentClassName:Cf.content,footer:/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Cf.footer,children:[/* @__PURE__ */ (0,i.jsx)(`p`,{className:Cf.scope,children:e(`extensions.scope`)}),/* @__PURE__ */ (0,i.jsx)(r.Button,{type:`submit`,form:y,variant:`primary`,className:Cf.wide,disabled:n||l.trim()===``,"aria-busy":n,children:e(n?`extensions.installing`:`extensions.install`)})]}),children:/* @__PURE__ */ (0,i.jsxs)(`form`,{id:y,className:Cf.body,onSubmit:e=>{e.preventDefault();let t=l.trim();if(n||t===``)return;let r=xl.safeParse(d===`custom`?p:wf[d]);g(!r.success),r.success&&c(t,r.data).then(e=>{e&&u(``)})},onKeyDown:e=>{e.key===`Enter`&&C.current?.guards(e.nativeEvent)&&e.preventDefault()},children:[/* @__PURE__ */ (0,i.jsx)(`div`,{className:Cf.field,children:/* @__PURE__ */ (0,i.jsx)(`input`,{type:`text`,"data-modal-autofocus":!0,value:l,placeholder:e(`extensions.sourcePlaceholder`),"aria-label":e(`extensions.sourceLabel`),"aria-describedby":a===null?void 0:x,autoCapitalize:`none`,autoCorrect:`off`,spellCheck:!1,disabled:n,onChange:e=>u(e.currentTarget.value)})}),a!==null&&/* @__PURE__ */ (0,i.jsx)(`p`,{id:x,className:Cf.error,role:`alert`,children:a}),/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Cf.options,children:[/* @__PURE__ */ (0,i.jsxs)(`button`,{type:`button`,className:Cf.guideToggle,"aria-expanded":_,"aria-controls":b,onClick:()=>v(!_),children:[/* @__PURE__ */ (0,i.jsx)(r.IconChevronDownOutlineRegular,{className:Cf.chevron,size:14,"aria-hidden":`true`}),e(`extensions.guide`)]}),/* @__PURE__ */ (0,i.jsxs)(`label`,{className:Cf.registry,children:[/* @__PURE__ */ (0,i.jsx)(`span`,{children:e(`extensions.registry`)}),/* @__PURE__ */ (0,i.jsxs)(`select`,{"aria-label":e(`extensions.registry`),value:d,disabled:n,onChange:e=>{f(e.currentTarget.value),g(!1)},children:[/* @__PURE__ */ (0,i.jsx)(`option`,{value:`official`,children:e(`extensions.registryOfficial`)}),/* @__PURE__ */ (0,i.jsx)(`option`,{value:`mirror`,children:e(`extensions.registryMirror`)}),/* @__PURE__ */ (0,i.jsx)(`option`,{value:`custom`,children:e(`extensions.registryCustom`)})]})]})]}),d===`custom`&&/* @__PURE__ */ (0,i.jsxs)(`label`,{className:Cf.field,children:[/* @__PURE__ */ (0,i.jsx)(`span`,{children:e(`extensions.registryCustomUrl`)}),/* @__PURE__ */ (0,i.jsx)(`input`,{type:`text`,value:p,"aria-label":e(`extensions.registryCustomUrl`),placeholder:`https://npm.example.com/`,"aria-invalid":h,"aria-describedby":h?S:void 0,autoCapitalize:`none`,autoCorrect:`off`,spellCheck:!1,disabled:n,onChange:e=>{m(e.currentTarget.value),g(!1)}}),h&&/* @__PURE__ */ (0,i.jsx)(`span`,{id:S,className:Cf.error,role:`alert`,children:e(`extensions.registryInvalid`)})]}),_&&/* @__PURE__ */ (0,i.jsxs)(`div`,{id:b,className:Cf.guide,children:[/* @__PURE__ */ (0,i.jsx)(`p`,{children:e(`extensions.guideNpm`)}),/* @__PURE__ */ (0,i.jsx)(`code`,{children:`dsh-theme-example · @author/theme@1.2.3`}),/* @__PURE__ */ (0,i.jsx)(`p`,{children:e(`extensions.guideGitHub`)}),/* @__PURE__ */ (0,i.jsx)(`code`,{children:`https://github.com/owner/plugin`}),/* @__PURE__ */ (0,i.jsx)(`p`,{children:e(`extensions.guideDirectory`)}),/* @__PURE__ */ (0,i.jsx)(`code`,{children:`/absolute/path/to/plugin · /absolute/path/to/plugin.tgz`}),/* @__PURE__ */ (0,i.jsx)(`p`,{className:Cf.hint,children:e(`extensions.registryHint`)})]})]})})}let Ef=`@deepseek-ai/dsh-client-ui-codexhost/WebExtensionsSection.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Ef)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-codexhost`,e.dataset.pluginCss=Ef,e.textContent=`.Rbb5ka_page,.Rbb5ka_rowText{flex-direction:column;min-width:0;display:flex}.Rbb5ka_page{gap:28px}.Rbb5ka_header{flex-wrap:wrap;justify-content:space-between;align-items:flex-start;gap:16px;display:flex}.Rbb5ka_heading{flex:280px;min-width:0}.Rbb5ka_title{color:var(--dsw-alias-label-primary);overflow-wrap:anywhere;margin:0;font-size:20px;font-weight:600;line-height:28px}.Rbb5ka_intro{align-items:flex-start;gap:4px;margin-top:8px;display:flex}.Rbb5ka_intro .Rbb5ka_iconButton{width:24px;height:24px;margin-top:-2px}.Rbb5ka_intro .Rbb5ka_hint{color:var(--dsw-alias-label-secondary);font-size:13px;line-height:20px}.Rbb5ka_hint,.Rbb5ka_meta,.Rbb5ka_notice,.Rbb5ka_error{color:var(--dsw-alias-label-tertiary);overflow-wrap:anywhere;margin:0;font-size:12px;line-height:18px}.Rbb5ka_notice{color:var(--dsw-alias-label-secondary)}.Rbb5ka_error,.Rbb5ka_danger{color:var(--dsw-alias-state-error-primary)}.Rbb5ka_actions,.Rbb5ka_recovery{flex-wrap:wrap;align-items:center;gap:8px;display:flex}.Rbb5ka_actions{flex:none}.Rbb5ka_iconButton{width:32px;height:32px;color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:none;border-radius:8px;flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex}.Rbb5ka_iconButton:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}.Rbb5ka_iconButton:disabled{opacity:.5;cursor:default}.Rbb5ka_open:focus-visible,.Rbb5ka_iconButton:focus-visible,.Rbb5ka_back:focus-visible{outline:2px solid var(--dsw-alias-label-secondary);outline-offset:2px}.Rbb5ka_button{border-radius:var(--dsw-radius-md,10px);background:var(--dsw-alias-bg-module-platform);min-height:36px;font:inherit;color:var(--dsw-alias-label-primary);cursor:pointer;border:none;flex:none;padding:8px 14px;font-size:14px}.Rbb5ka_button:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover)}.Rbb5ka_button:disabled{opacity:.6;cursor:default}.Rbb5ka_list{flex-direction:column;gap:4px;margin:0;padding:0;list-style:none;display:flex}.Rbb5ka_group{min-width:0}.Rbb5ka_groupTitle{color:var(--dsw-alias-label-primary);align-items:baseline;gap:8px;margin:0 0 16px;font-size:14px;font-weight:500;line-height:22px;display:flex}.Rbb5ka_count{color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums}.Rbb5ka_row{border-radius:12px;flex-wrap:wrap;align-items:center;gap:4px 12px;margin:0 -8px;padding:8px;display:flex}.Rbb5ka_row:hover,.Rbb5ka_row:focus-within{background:var(--dsw-alias-interactive-bg-hover)}.Rbb5ka_open{min-width:0;font:inherit;text-align:left;cursor:pointer;background:0 0;border:none;border-radius:8px;flex:1;align-items:center;gap:14px;padding:0;display:flex}.Rbb5ka_artwork{box-sizing:border-box;border:1px solid var(--dsw-alias-border-l2);width:48px;height:48px;color:var(--dsw-alias-label-secondary);border-radius:12px;flex:none;justify-content:center;align-items:center;display:flex}.Rbb5ka_packageImage{object-fit:contain}.Rbb5ka_summary{text-overflow:ellipsis;white-space:nowrap;color:var(--dsw-alias-label-tertiary);font-size:13px;line-height:18px;overflow:hidden}.Rbb5ka_description{color:var(--dsw-alias-label-secondary);overflow-wrap:anywhere;margin:0;font-size:14px;line-height:22px}.Rbb5ka_chevron{color:var(--dsw-alias-label-tertiary);opacity:0;flex:none}.Rbb5ka_row:hover .Rbb5ka_chevron,.Rbb5ka_row:focus-within .Rbb5ka_chevron{opacity:1}.Rbb5ka_rowText{flex:1;gap:4px}.Rbb5ka_name{color:var(--dsw-alias-label-primary);text-overflow:ellipsis;white-space:nowrap;font-size:14px;font-weight:500;line-height:22px;overflow:hidden}.Rbb5ka_rowNotice{flex-basis:100%;padding-left:62px}.Rbb5ka_back{font:inherit;color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:none;align-self:flex-start;align-items:center;gap:6px;padding:0;font-size:13px;display:inline-flex}.Rbb5ka_detail{flex-direction:column;gap:20px;min-width:0;display:flex}.Rbb5ka_detail .Rbb5ka_rowText{gap:8px}.Rbb5ka_source{border:1px solid var(--dsw-alias-border-l2);color:var(--dsw-alias-label-secondary);overflow-wrap:anywhere;border-radius:10px;margin:0;padding:16px;font-size:12px;line-height:20px}.Rbb5ka_recovery{gap:8px 16px;margin-top:4px}.Rbb5ka_link{color:var(--dsw-alias-label-secondary);text-underline-offset:3px;font-size:12px;line-height:18px}@media (width<=600px){.Rbb5ka_page{gap:24px}.Rbb5ka_open{gap:10px}.Rbb5ka_artwork{border-radius:10px;width:40px;height:40px}.Rbb5ka_row,.Rbb5ka_row .Rbb5ka_actions{gap:4px}.Rbb5ka_chevron{display:none}.Rbb5ka_rowNotice{padding-left:50px}}`,document.head.appendChild(e)}var Q={actions:`Rbb5ka_actions`,artwork:`Rbb5ka_artwork`,back:`Rbb5ka_back`,button:`Rbb5ka_button`,chevron:`Rbb5ka_chevron`,count:`Rbb5ka_count`,danger:`Rbb5ka_danger`,description:`Rbb5ka_description`,detail:`Rbb5ka_detail`,error:`Rbb5ka_error`,group:`Rbb5ka_group`,groupTitle:`Rbb5ka_groupTitle`,header:`Rbb5ka_header`,heading:`Rbb5ka_heading`,hint:`Rbb5ka_hint`,iconButton:`Rbb5ka_iconButton`,intro:`Rbb5ka_intro`,link:`Rbb5ka_link`,list:`Rbb5ka_list`,meta:`Rbb5ka_meta`,name:`Rbb5ka_name`,notice:`Rbb5ka_notice`,open:`Rbb5ka_open`,packageImage:`Rbb5ka_packageImage`,page:`Rbb5ka_page`,recovery:`Rbb5ka_recovery`,row:`Rbb5ka_row`,rowNotice:`Rbb5ka_rowNotice`,rowText:`Rbb5ka_rowText`,source:`Rbb5ka_source`,summary:`Rbb5ka_summary`,title:`Rbb5ka_title`};function Df({url:e,t}){if(e===void 0)return null;let n=new URL(e).hostname===`github.com`;return/* @__PURE__ */ (0,i.jsx)(`a`,{className:Q.iconButton,href:e,target:`_blank`,rel:`noopener noreferrer`,"aria-label":n?`GitHub`:t(`extensions.project`),title:e,"data-extension-project":n?`github`:`web`,children:n?/* @__PURE__ */ (0,i.jsx)(`svg`,{width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":`true`,children:/* @__PURE__ */ (0,i.jsx)(`path`,{d:`M12 .75a11.25 11.25 0 0 0-3.56 21.92c.56.1.77-.24.77-.54v-2.1c-3.13.68-3.79-1.33-3.79-1.33-.51-1.3-1.25-1.65-1.25-1.65-1.02-.7.08-.69.08-.69 1.13.08 1.73 1.16 1.73 1.16 1 1.72 2.63 1.22 3.27.93.1-.73.39-1.22.71-1.5-2.5-.28-5.13-1.25-5.13-5.56 0-1.23.44-2.23 1.16-3.02-.12-.29-.5-1.43.11-2.98 0 0 .95-.3 3.1 1.15a10.77 10.77 0 0 1 5.64 0c2.15-1.45 3.1-1.15 3.1-1.15.61 1.55.23 2.69.11 2.98.72.79 1.16 1.79 1.16 3.02 0 4.32-2.63 5.28-5.14 5.56.4.35.76 1.03.76 2.08v3.1c0 .3.2.65.77.54A11.25 11.25 0 0 0 12 .75Z`})}):/* @__PURE__ */ (0,i.jsx)(r.IconLinkOutlineRegular,{size:18})})}function Of({src:e}){let[t,n]=(0,o.useState)();return/* @__PURE__ */ (0,i.jsx)(`span`,{className:Q.artwork,"aria-hidden":`true`,children:e!==void 0&&e!==t?/* @__PURE__ */ (0,i.jsx)(`img`,{src:e,width:32,height:32,alt:``,className:Q.packageImage,"data-extension-icon":!0,onError:()=>n(e)}):/* @__PURE__ */ (0,i.jsx)(r.IconCordisPluginOutlineRegular,{size:26})})}function kf(e,t){return{title:e.meta?.title===void 0?e.name:t(e.meta.title),description:e.meta?.description===void 0?void 0:t(e.meta.description)||void 0}}function Af(e){if(e instanceof Tl&&e.code===`auth/local-access-required`){let t=Ls.safeParse(e.details);return{kind:`non-local`,url:t.success?t.data.url:`http://127.0.0.1`}}return{kind:`failed`,message:e instanceof Error?e.message:String(e)}}function jf({t:e,resolveText:t}){let[n,a]=(0,o.useState)({kind:`loading`}),[s,c]=(0,o.useState)(!1),[l,u]=(0,o.useState)(null),[d,f]=(0,o.useState)(null),[p,m]=(0,o.useState)(null),[h,g]=(0,o.useState)(null),_=(0,o.useRef)(!1);(0,o.useEffect)(()=>{let e=new AbortController;return xf.list(e.signal).then(t=>{e.signal.aborted||a({kind:`ready`,data:t})},t=>{e.signal.aborted||a(Af(t))}),()=>e.abort()},[]);let v=async(t,n,r)=>{if(_.current)return!1;_.current=!0,u(t),f(null);try{return a({kind:`ready`,data:await n()}),r?.(),!0}catch(t){let n=Af(t);return n.kind===`non-local`?a(n):f(e(`extensions.actionFailed`,{message:n.message})),!1}finally{_.current=!1,u(null)}},y=/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Q.recovery,children:[/* @__PURE__ */ (0,i.jsx)(`a`,{className:Q.link,href:`/extensions`,children:e(`extensions.recovery`)}),/* @__PURE__ */ (0,i.jsx)(`a`,{className:Q.link,href:`/?extensions=off`,children:e(`extensions.builtinsOnly`)})]});if(n.kind===`loading`)return/* @__PURE__ */ (0,i.jsx)(`p`,{className:Q.hint,children:e(`extensions.loading`)});if(n.kind===`non-local`)return/* @__PURE__ */ (0,i.jsx)(`p`,{className:Q.notice,"data-web-extensions-notice":`non-local`,children:e(`extensions.localOnly`,{url:n.url})});if(n.kind===`failed`)return/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Q.page,children:[/* @__PURE__ */ (0,i.jsx)(`p`,{className:Q.error,role:`alert`,children:e(`extensions.loadFailed`,{message:n.message})}),d!==null&&/* @__PURE__ */ (0,i.jsx)(`p`,{className:Q.error,role:`alert`,children:d}),/* @__PURE__ */ (0,i.jsx)(`div`,{children:/* @__PURE__ */ (0,i.jsx)(`button`,{type:`button`,className:Q.button,disabled:l!==null,onClick:()=>void v(`refresh`,()=>xf.list()),children:e(`extensions.retry`)})}),y]});let{extensions:b,loadedIds:x,safeMode:S,storeError:C}=n.data,w=l!==null,T=b.find(e=>e.id===h),E=T===void 0?void 0:{...T,...kf(T,t)},D=(e,t)=>{v(e,()=>xf.setEnabled(e,t))};return/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Q.page,"data-web-extensions":!0,children:[E===void 0?/* @__PURE__ */ (0,i.jsxs)(`header`,{className:Q.header,children:[/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Q.heading,children:[/* @__PURE__ */ (0,i.jsx)(`h2`,{className:Q.title,children:e(`settings.extensions`)}),/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Q.intro,children:[/* @__PURE__ */ (0,i.jsx)(`p`,{className:Q.hint,children:e(`extensions.description`)}),/* @__PURE__ */ (0,i.jsx)(r.Tooltip,{label:e(`extensions.restart`),side:`bottom`,maxWidth:320,portal:!0,openOnClick:!0,children:/* @__PURE__ */ (0,i.jsx)(`button`,{type:`button`,className:Q.iconButton,"aria-label":e(`extensions.info`),children:/* @__PURE__ */ (0,i.jsx)(r.IconInfoOutlineRegular,{size:15})})})]})]}),/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Q.actions,children:[/* @__PURE__ */ (0,i.jsx)(`button`,{type:`button`,className:Q.iconButton,"aria-label":e(`extensions.refresh`),title:e(`extensions.refresh`),disabled:w,"aria-busy":l===`refresh`,onClick:()=>void v(`refresh`,()=>xf.list()),children:/* @__PURE__ */ (0,i.jsx)(r.IconRefreshOutlineRegular,{size:18})}),/* @__PURE__ */ (0,i.jsx)(r.Button,{variant:`primary`,icon:/* @__PURE__ */ (0,i.jsx)(r.IconPlusOutlineRegular,{size:16}),disabled:w||C!==void 0,onClick:()=>{f(null),c(!0)},children:e(`extensions.add`)})]})]}):/* @__PURE__ */ (0,i.jsxs)(`button`,{type:`button`,className:Q.back,onClick:()=>{g(null),m(null),f(null)},children:[/* @__PURE__ */ (0,i.jsx)(r.IconChevronLeftOutlineRegular,{}),e(`settings.extensions`)]}),/* @__PURE__ */ (0,i.jsx)(Tf,{t:e,open:s,busy:l===`install`,error:d,onClose:()=>c(!1),onInstall:(e,t)=>v(`install`,()=>xf.install(e,t),()=>c(!1))}),S&&/* @__PURE__ */ (0,i.jsx)(`p`,{className:Q.notice,children:e(`extensions.safeMode`)}),C!==void 0&&/* @__PURE__ */ (0,i.jsx)(`p`,{className:Q.error,role:`alert`,children:e(`extensions.storeError`,{message:C})}),d!==null&&!s&&/* @__PURE__ */ (0,i.jsx)(`p`,{className:Q.error,role:`alert`,children:d}),E===void 0?b.length===0?/* @__PURE__ */ (0,i.jsx)(`p`,{className:Q.hint,children:e(`extensions.empty`)}):/* @__PURE__ */ (0,i.jsxs)(`section`,{className:Q.group,children:[/* @__PURE__ */ (0,i.jsxs)(`h3`,{className:Q.groupTitle,children:[e(`extensions.installed`),` `,/* @__PURE__ */ (0,i.jsx)(`span`,{className:Q.count,children:b.length})]}),/* @__PURE__ */ (0,i.jsx)(`ul`,{className:Q.list,children:b.map(n=>{let a=n.enabledTargets.includes(`web`),o=x.includes(n.id),{title:s,description:c}=kf(n,t);return/* @__PURE__ */ (0,i.jsxs)(`li`,{className:Q.row,"data-web-extension":n.id,children:[/* @__PURE__ */ (0,i.jsxs)(`button`,{type:`button`,className:Q.open,"aria-label":s,onClick:()=>{g(n.id),m(null)},children:[/* @__PURE__ */ (0,i.jsx)(Of,{src:n.meta?.icon}),/* @__PURE__ */ (0,i.jsxs)(`span`,{className:Q.rowText,children:[/* @__PURE__ */ (0,i.jsx)(`span`,{className:Q.name,title:s,children:s}),c!==void 0&&/* @__PURE__ */ (0,i.jsx)(`span`,{className:Q.summary,title:c,children:c}),/* @__PURE__ */ (0,i.jsxs)(`span`,{className:Q.meta,children:[n.version,` · DSH ·`,` `,e(a?`extensions.enabled`:`extensions.disabled`)]})]}),/* @__PURE__ */ (0,i.jsx)(r.IconChevronRightOutlineRegular,{className:Q.chevron})]}),/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Q.actions,children:[/* @__PURE__ */ (0,i.jsx)(Df,{url:n.projectUrl,t:e}),/* @__PURE__ */ (0,i.jsx)(r.Switch,{label:s,checked:a,disabled:w||C!==void 0,onChange:e=>D(n.id,e)})]}),a!==o&&!S&&n.loadError===void 0&&/* @__PURE__ */ (0,i.jsx)(`p`,{className:`${Q.notice} ${Q.rowNotice}`,children:e(`extensions.pendingRestart`)}),n.loadError!==void 0&&/* @__PURE__ */ (0,i.jsx)(`p`,{className:`${Q.error} ${Q.rowNotice}`,role:`alert`,children:e(`extensions.extensionError`,{message:n.loadError})}),n.meta?.error!==void 0&&/* @__PURE__ */ (0,i.jsx)(`p`,{className:`${Q.notice} ${Q.rowNotice}`,children:e(`extensions.metadataError`,{message:n.meta.error})})]},n.id)})})]}):/* @__PURE__ */ (0,i.jsxs)(`section`,{className:Q.detail,"data-web-extension-detail":E.id,children:[/* @__PURE__ */ (0,i.jsxs)(`header`,{className:Q.header,children:[/* @__PURE__ */ (0,i.jsx)(Of,{src:E.meta?.icon}),/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Q.actions,children:[/* @__PURE__ */ (0,i.jsx)(Df,{url:E.projectUrl,t:e}),p===E.id&&/* @__PURE__ */ (0,i.jsx)(r.Button,{variant:`outline`,disabled:w,onClick:()=>m(null),children:e(`extensions.cancel`)}),/* @__PURE__ */ (0,i.jsx)(r.Button,{variant:`outline`,className:p===E.id?Q.danger:void 0,disabled:w||C!==void 0,onClick:()=>{p===E.id?v(E.id,()=>xf.remove(E.id),()=>{g(null),m(null)}):m(E.id)},children:e(`extensions.remove`)}),/* @__PURE__ */ (0,i.jsx)(r.Switch,{label:E.title,checked:E.enabledTargets.includes(`web`),disabled:w||C!==void 0,onChange:e=>D(E.id,e)})]})]}),/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Q.rowText,children:[/* @__PURE__ */ (0,i.jsx)(`h2`,{className:Q.title,children:E.title}),E.title!==E.name&&/* @__PURE__ */ (0,i.jsx)(`p`,{className:Q.meta,children:E.name}),E.description!==void 0&&/* @__PURE__ */ (0,i.jsx)(`p`,{className:Q.description,children:E.description}),/* @__PURE__ */ (0,i.jsxs)(`p`,{className:Q.meta,children:[E.version,` · DSH ·`,` `,e(E.enabledTargets.includes(`web`)?`extensions.enabled`:`extensions.disabled`)]})]}),/* @__PURE__ */ (0,i.jsx)(`p`,{className:Q.source,children:e(`extensions.source`,{source:E.source})}),E.meta?.error!==void 0&&/* @__PURE__ */ (0,i.jsx)(`p`,{className:Q.notice,children:e(`extensions.metadataError`,{message:E.meta.error})}),/* @__PURE__ */ (0,i.jsx)(`p`,{className:Q.notice,children:e(`extensions.restart`)}),x.includes(E.id)&&/* @__PURE__ */ (0,i.jsx)(`p`,{className:Q.hint,children:e(`extensions.includedAtStartup`)}),p===E.id&&/* @__PURE__ */ (0,i.jsx)(`p`,{className:Q.notice,children:e(`extensions.confirmRemove`,{name:E.name})}),E.loadError!==void 0&&/* @__PURE__ */ (0,i.jsx)(`p`,{className:Q.error,role:`alert`,children:e(`extensions.extensionError`,{message:E.loadError})})]}),y]})}let Mf=`@deepseek-ai/dsh-client-ui-codexhost/NotificationsRow.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Mf)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-codexhost`,e.dataset.pluginCss=Mf,e.textContent=`.Ac8K1G_row{border-bottom:.5px solid var(--dsw-alias-border-l2);align-items:center;gap:8px;padding:16px 0;display:flex}.Ac8K1G_rowText{flex-direction:column;flex:1;gap:4px;min-width:0;padding-right:24px;display:flex}.Ac8K1G_title{color:var(--dsw-alias-label-primary);font-size:14px;line-height:22px}.Ac8K1G_desc{color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:18px}.Ac8K1G_button{border-radius:var(--dsw-radius-md,10px);background:var(--dsw-alias-bg-module-platform);height:36px;font:inherit;color:var(--dsw-alias-label-primary);cursor:pointer;border:none;flex:none;padding:0 14px;font-size:14px}.Ac8K1G_button:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover)}.Ac8K1G_button:disabled{opacity:.6;cursor:default}`,document.head.appendChild(e)}var Nf={button:`Ac8K1G_button`,desc:`Ac8K1G_desc`,row:`Ac8K1G_row`,rowText:`Ac8K1G_rowText`,title:`Ac8K1G_title`};function Pf({t:e}){let[t,n]=(0,o.useState)(null),[r,a]=(0,o.useState)(!1),[s,c]=(0,o.useState)(null);(0,o.useEffect)(()=>{Wu().then(n,()=>{n(`unsupported`)})},[]);let l=e=>{a(!0),c(null),e().then(e=>{n(e),a(!1)},e=>{c(e instanceof Error?e.message:String(e)),a(!1)})},u=s??(t===null?``:e(`notifications.${t}`));return/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Nf.row,children:[/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Nf.rowText,children:[/* @__PURE__ */ (0,i.jsx)(`div`,{className:Nf.title,children:e(`notifications.title`)}),/* @__PURE__ */ (0,i.jsx)(`div`,{className:Nf.desc,role:s===null?void 0:`alert`,children:u})]}),t===`on`&&/* @__PURE__ */ (0,i.jsx)(`button`,{type:`button`,className:Nf.button,disabled:r,onClick:()=>{Nl.test()},children:e(`notifications.test`)}),(t===`off`||t===`on`)&&/* @__PURE__ */ (0,i.jsx)(`button`,{type:`button`,className:Nf.button,disabled:r,onClick:()=>{l(t===`on`?Ku:Gu)},children:e(t===`on`?`notifications.disable`:`notifications.enable`)})]})}let Ff=`@deepseek-ai/dsh-client-ui-codexhost/PwaInstallRow.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Ff)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-codexhost`,e.dataset.pluginCss=Ff,e.textContent=`.iihrga_section{padding:16px 0}.iihrga_row{flex-wrap:wrap;align-items:center;gap:12px 24px;display:flex}.iihrga_text{flex:180px;min-width:0}.iihrga_title{color:var(--dsw-alias-label-primary);font-size:14px;line-height:22px}.iihrga_description,.iihrga_guide{color:var(--dsw-alias-label-secondary);font-size:12px;line-height:18px}.iihrga_description{margin-top:4px}.iihrga_button{border-radius:var(--dsw-radius-md,10px);background:var(--dsw-alias-bg-module-platform);min-height:44px;color:var(--dsw-alias-label-primary);font:inherit;cursor:pointer;border:none;flex:none;justify-content:center;align-items:center;gap:6px;padding:0 14px;font-size:14px;display:inline-flex}.iihrga_button:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover)}.iihrga_button:focus-visible{outline-offset:2px;outline:2px solid}.iihrga_button:disabled{opacity:.6;cursor:default}.iihrga_guide{margin-top:12px}.iihrga_guide p{margin:8px 0 0}`,document.head.appendChild(e)}var If={button:`iihrga_button`,description:`iihrga_description`,guide:`iihrga_guide`,row:`iihrga_row`,section:`iihrga_section`,text:`iihrga_text`,title:`iihrga_title`};function Lf({installation:e,t}){let n=(0,o.useSyncExternalStore)(e.store.subscribe,e.store.getSnapshot),[a,s]=(0,o.useState)(!1),c=(0,o.useId)(),l=(0,o.useId)(),u=n===`available`||n===`prompting`,d=e.guide===`insecure`&&n!==`installed`?t(`pwa.guide.insecure`):n===`manual`||n===`available`?null:t(`pwa.${n}`);return/* @__PURE__ */ (0,i.jsxs)(`div`,{className:If.section,children:[/* @__PURE__ */ (0,i.jsxs)(`div`,{className:If.row,children:[/* @__PURE__ */ (0,i.jsxs)(`div`,{className:If.text,children:[/* @__PURE__ */ (0,i.jsx)(`div`,{className:If.title,children:t(`pwa.title`)}),d!==null&&/* @__PURE__ */ (0,i.jsx)(`div`,{id:l,className:If.description,role:n===`failed`?`alert`:`status`,children:d})]}),n!==`installed`&&/* @__PURE__ */ (0,i.jsxs)(`button`,{type:`button`,className:If.button,disabled:n===`prompting`,"aria-busy":n===`prompting`,"aria-describedby":d===null?void 0:l,"aria-expanded":u?void 0:a,"aria-controls":u?void 0:c,onClick:()=>{u?(s(!1),e.install()):s(e=>!e)},children:[/* @__PURE__ */ (0,i.jsx)(r.IconDownloadOutlineRegular,{size:16}),t(u?`pwa.install`:`pwa.instructions`)]})]}),a&&n!==`installed`&&/* @__PURE__ */ (0,i.jsxs)(`div`,{id:c,className:If.guide,children:[/* @__PURE__ */ (0,i.jsx)(`p`,{children:t(`pwa.guide.limitations`)}),e.guide!==`insecure`&&/* @__PURE__ */ (0,i.jsx)(`p`,{children:t(`pwa.guide.${e.guide}`)})]})]})}let Rf=`@deepseek-ai/dsh-client-ui-codexhost/ImportPage.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Rf)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-codexhost`,e.dataset.pluginCss=Rf,e.textContent=`.htJ9Oq_page{box-sizing:border-box;height:100%;padding:calc(36px + var(--dsh-frame-top-clearance,0px)) clamp(16px, 4vw, 48px) 56px;overflow-y:auto}.htJ9Oq_inner{flex-direction:column;gap:16px;max-width:800px;margin:0 auto;display:flex}.htJ9Oq_header{flex-wrap:wrap;justify-content:space-between;align-items:flex-start;gap:16px;margin-bottom:4px;display:flex}.htJ9Oq_heading{flex:320px;min-width:0}.htJ9Oq_title{letter-spacing:-.01em;color:var(--dsw-alias-label-primary);margin:0;font-size:24px;font-weight:600;line-height:32px}.htJ9Oq_subtitle{color:var(--dsw-alias-label-secondary);margin:6px 0 0;font-size:14px;line-height:1.6}.htJ9Oq_refresh{flex:none;margin-top:2px}.htJ9Oq_tabs{flex-wrap:wrap;gap:8px;display:flex}.htJ9Oq_tab{box-sizing:border-box;border:.5px solid var(--dsw-alias-border-l3);height:32px;color:var(--dsw-alias-label-secondary);font:inherit;cursor:pointer;transition:background var(--ds-transition-duration-fast,.1s) var(--ds-ease-in-out,ease), border-color var(--ds-transition-duration-fast,.1s) var(--ds-ease-in-out,ease), color var(--ds-transition-duration-fast,.1s) var(--ds-ease-in-out,ease);background:0 0;border-radius:999px;align-items:center;gap:6px;padding:0 12px 0 10px;font-size:13px;display:inline-flex}.htJ9Oq_tab:hover:not(:disabled):not([data-active]){background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}.htJ9Oq_tab[data-active]{background:var(--dsw-alias-bg-layer-3,var(--dsw-alias-interactive-bg-active));border-color:var(--dsw-alias-border-l4,var(--dsw-alias-border-l3));color:var(--dsw-alias-label-primary);box-shadow:inset 0 0 0 .5px var(--dsw-alias-border-l4,transparent);font-weight:500}.htJ9Oq_tab:focus-visible,.htJ9Oq_search:focus-visible,.htJ9Oq_select:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:1px}.htJ9Oq_tabIcon{width:14px;height:14px;color:inherit;flex:none;display:inline-flex}.htJ9Oq_tab:disabled{opacity:.5;cursor:default}.htJ9Oq_searchField{display:block;position:relative}.htJ9Oq_searchIcon{color:var(--dsw-alias-label-tertiary);pointer-events:none;position:absolute;top:50%;left:14px;transform:translateY(-50%)}.htJ9Oq_search{box-sizing:border-box;border:.5px solid var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-md,12px);width:100%;height:42px;font:inherit;color:var(--dsw-alias-label-primary);background:var(--dsw-alias-bg-layer-2,transparent);transition:border-color var(--ds-transition-duration,.2s) var(--ds-ease-in-out,ease), box-shadow var(--ds-transition-duration,.2s) var(--ds-ease-in-out,ease);outline:none;padding:0 14px 0 40px;font-size:14px}.htJ9Oq_search::placeholder{color:var(--dsw-alias-label-tertiary)}.htJ9Oq_search:focus{border-color:var(--dsw-alias-brand-primary);box-shadow:0 0 0 3px color-mix(in srgb, var(--dsw-alias-brand-primary) 18%, transparent)}.htJ9Oq_search:focus-visible{outline:none}.htJ9Oq_search:disabled{opacity:.6}.htJ9Oq_callout{border-radius:var(--dsw-radius-sm,8px);border:.5px solid #0000;align-items:flex-start;gap:8px;margin:0;padding:10px 12px;font-size:13px;line-height:20px;display:flex}.htJ9Oq_callout[data-tone=error]{color:var(--dsw-alias-state-error-primary);background:color-mix(in srgb, var(--dsw-alias-state-error-primary) 10%, transparent);border-color:color-mix(in srgb, var(--dsw-alias-state-error-primary) 28%, transparent)}.htJ9Oq_calloutIcon{flex:none;margin-top:2px}.htJ9Oq_list{border:.5px solid var(--dsw-alias-settings-card-stroke,var(--dsw-alias-border-l3));border-radius:var(--dsw-radius-lg,16px);background:var(--dsw-alias-settings-card-fill,transparent);margin:0;padding:4px;list-style:none}.htJ9Oq_row{border-radius:var(--dsw-radius-md,12px);transition:background var(--ds-transition-duration-fast,.1s) var(--ds-ease-in-out,ease);align-items:center;gap:16px;padding:12px 12px 12px 14px;display:flex;position:relative}.htJ9Oq_row+.htJ9Oq_row:before{content:"";border-top:.5px solid var(--dsw-alias-border-l2);position:absolute;top:0;left:14px;right:14px}.htJ9Oq_row:hover{background:var(--dsw-alias-interactive-bg-hover)}.htJ9Oq_row:hover:before,.htJ9Oq_row:hover+.htJ9Oq_row:before{opacity:0}.htJ9Oq_rowText{flex:1;min-width:0}.htJ9Oq_rowTitle{color:var(--dsw-alias-label-primary);text-overflow:ellipsis;white-space:nowrap;font-size:14px;font-weight:500;line-height:22px;overflow:hidden}.htJ9Oq_rowMeta{color:var(--dsw-alias-label-tertiary);flex-wrap:wrap;align-items:center;gap:4px 14px;min-width:0;margin-top:4px;font-size:12px;line-height:18px;display:flex}.htJ9Oq_metaItem{align-items:center;gap:5px;min-width:0;max-width:100%;display:inline-flex}.htJ9Oq_metaIcon{opacity:.8;flex:none}.htJ9Oq_metaText{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.htJ9Oq_action{flex:none;min-width:64px}.htJ9Oq_status{color:var(--dsw-alias-label-secondary);justify-content:center;align-items:center;gap:8px;padding:40px 0;font-size:14px;display:flex}.htJ9Oq_empty{border:.5px dashed var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-lg,16px);color:var(--dsw-alias-label-secondary);flex-direction:column;align-items:center;gap:10px;padding:48px 16px;font-size:14px;display:flex}.htJ9Oq_emptyIcon{color:var(--dsw-alias-label-tertiary)}.htJ9Oq_footer{color:var(--dsw-alias-label-tertiary);flex-wrap:wrap;justify-content:space-between;align-items:center;gap:10px 16px;font-size:12px;display:flex}.htJ9Oq_pageSize{align-items:center;gap:8px;display:inline-flex}.htJ9Oq_select{box-sizing:border-box;border:.5px solid var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-sm,8px);background:var(--dsw-alias-bg-layer-2,transparent);height:28px;color:var(--dsw-alias-label-primary);font:inherit;cursor:pointer;padding:0 8px;font-size:12px}.htJ9Oq_select:disabled{opacity:.6;cursor:default}.htJ9Oq_pager{align-items:center;gap:6px;display:inline-flex}.htJ9Oq_range{font-variant-numeric:tabular-nums;margin-right:6px}.htJ9Oq_pageButton{width:28px;padding:0}`,document.head.appendChild(e)}var $={action:`htJ9Oq_action`,callout:`htJ9Oq_callout`,calloutIcon:`htJ9Oq_calloutIcon`,empty:`htJ9Oq_empty`,emptyIcon:`htJ9Oq_emptyIcon`,footer:`htJ9Oq_footer`,header:`htJ9Oq_header`,heading:`htJ9Oq_heading`,inner:`htJ9Oq_inner`,list:`htJ9Oq_list`,metaIcon:`htJ9Oq_metaIcon`,metaItem:`htJ9Oq_metaItem`,metaText:`htJ9Oq_metaText`,page:`htJ9Oq_page`,pageButton:`htJ9Oq_pageButton`,pageSize:`htJ9Oq_pageSize`,pager:`htJ9Oq_pager`,range:`htJ9Oq_range`,refresh:`htJ9Oq_refresh`,row:`htJ9Oq_row`,rowMeta:`htJ9Oq_rowMeta`,rowText:`htJ9Oq_rowText`,rowTitle:`htJ9Oq_rowTitle`,search:`htJ9Oq_search`,searchField:`htJ9Oq_searchField`,searchIcon:`htJ9Oq_searchIcon`,select:`htJ9Oq_select`,status:`htJ9Oq_status`,subtitle:`htJ9Oq_subtitle`,tab:`htJ9Oq_tab`,tabIcon:`htJ9Oq_tabIcon`,tabs:`htJ9Oq_tabs`,title:`htJ9Oq_title`};function zf(e){let t=Math.max(0,Math.round((Date.now()-e)/1e3));if(t<60)return`now`;let n=Math.round(t/60);if(n<60)return`${String(n)}m`;let r=Math.round(n/60);if(r<48)return`${String(r)}h`;let i=Math.round(r/24);return i<60?`${String(i)}d`:new Date(e).toLocaleDateString()}function Bf(e){return e instanceof Error?e.message:String(e)}function Vf({openSession:e,t}){let[n,a]=(0,o.useState)(null),[s,c]=(0,o.useState)(null),[l,u]=(0,o.useState)(``),[d,f]=(0,o.useState)(0),[p,m]=(0,o.useState)(20),[h,g]=(0,o.useState)(0),[_,v]=(0,o.useState)(null),[y,b]=(0,o.useState)(0),[x,S]=(0,o.useState)(null),[C,w]=(0,o.useState)(null),[T,E]=(0,o.useState)(null),[D,O]=(0,o.useState)({}),ee=(0,o.useRef)(!1),te=(0,o.useRef)(null);(0,o.useEffect)(()=>{let e=new AbortController;return te.current=e,()=>e.abort()},[]),(0,o.useEffect)(()=>{let e=!0;return S(null),Pl.sources().then(({harnesses:t})=>{e&&(a(t),c(e=>t.some(t=>t.harnessId===e)?e:t[0]?.harnessId??null))},t=>{e&&S(Bf(t))}),()=>{e=!1}},[h]),(0,o.useEffect)(()=>{if(s===null)return;let e=!0;v(null),S(null);let t=setTimeout(()=>{Pl.candidates({harnessId:s,query:l,offset:d,limit:p}).then(({candidates:t,total:n})=>{e&&(d>0&&d>=n?f(Math.max(0,Math.ceil(n/p)-1)*p):(v(t),b(n)))},t=>{e&&S(Bf(t))})},l===``?0:200);return()=>{e=!1,clearTimeout(t)}},[s,l,d,p,h]);let k=(0,o.useMemo)(()=>/^(\/Users\/[^/]+|\/home\/[^/]+)/u.exec(_?.[0]?.cwd??``)?.[1],[_]),A=e=>k!==void 0&&(e===k||e.startsWith(`${k}/`))?`~${e.slice(k.length)}`:e,ne=async n=>{let r=te.current?.signal;if(s===null||ee.current||!r||r.aborted)return;let i=JSON.stringify([s,n.nativeSessionId]),a=D[i];ee.current=!0,E(n.nativeSessionId),w(null);try{if(!a){let e=await Pl.importSession(s,n.nativeSessionId);if(a=e.threadId,r.aborted)return;O(t=>({...t,[i]:e.threadId}))}r.aborted||await e(a,r)}catch(e){r.aborted||w(t(a?`openFailed`:`importFailed`,{message:Bf(e)}))}finally{ee.current=!1,r.aborted||E(null)}},j=()=>{v(null),f(0),w(null)};return/* @__PURE__ */ (0,i.jsx)(`div`,{className:$.page,children:/* @__PURE__ */ (0,i.jsxs)(`div`,{className:$.inner,children:[/* @__PURE__ */ (0,i.jsxs)(`header`,{className:$.header,children:[/* @__PURE__ */ (0,i.jsxs)(`div`,{className:$.heading,children:[/* @__PURE__ */ (0,i.jsx)(`h1`,{className:$.title,children:t(`title`)}),/* @__PURE__ */ (0,i.jsx)(`p`,{className:$.subtitle,children:t(`subtitle`)})]}),/* @__PURE__ */ (0,i.jsx)(r.Button,{variant:`outline`,size:`sm`,className:$.refresh,icon:/* @__PURE__ */ (0,i.jsx)(r.IconRefreshOutlineRegular,{size:14}),disabled:T!==null,onClick:()=>{v(null),g(e=>e+1)},children:t(`refresh`)})]}),n!==null&&n.length===0&&/* @__PURE__ */ (0,i.jsx)(`div`,{className:$.status,children:t(`noSources`)}),n!==null&&n.length>1&&/* @__PURE__ */ (0,i.jsx)(`div`,{className:$.tabs,role:`tablist`,"aria-label":t(`sources`),children:n.map(e=>/* @__PURE__ */ (0,i.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":e.harnessId===s,className:$.tab,"data-active":e.harnessId===s||void 0,disabled:T!==null,onClick:()=>{e.harnessId!==s&&(j(),c(e.harnessId))},children:[/* @__PURE__ */ (0,i.jsx)(`span`,{className:$.tabIcon,"aria-hidden":`true`,children:/* @__PURE__ */ (0,i.jsx)(r.RemotePluginIcon,{id:e.harnessId,src:`/harness-icons/${encodeURIComponent(e.harnessId)}`,presentationUrl:`/harness-icons/presentation.json`,size:14,fallback:/* @__PURE__ */ (0,i.jsx)(r.IconDataOutlineRegular,{size:14})})}),e.name]},e.harnessId))}),n!==null&&n.length>0&&/* @__PURE__ */ (0,i.jsxs)(`label`,{className:$.searchField,children:[/* @__PURE__ */ (0,i.jsx)(r.IconSearchOutlineRegular,{size:16,className:$.searchIcon}),/* @__PURE__ */ (0,i.jsx)(`input`,{className:$.search,type:`search`,value:l,"aria-label":t(`search`),placeholder:t(`search`),disabled:T!==null,onChange:e=>{j(),u(e.target.value)}})]}),x!==null&&/* @__PURE__ */ (0,i.jsxs)(`div`,{role:`alert`,className:$.callout,"data-tone":`error`,children:[/* @__PURE__ */ (0,i.jsx)(r.IconWarningOutlineRegular,{size:16,className:$.calloutIcon}),/* @__PURE__ */ (0,i.jsx)(`span`,{children:t(`error`,{message:x})})]}),C!==null&&/* @__PURE__ */ (0,i.jsxs)(`div`,{role:`alert`,className:$.callout,"data-tone":`error`,children:[/* @__PURE__ */ (0,i.jsx)(r.IconWarningOutlineRegular,{size:16,className:$.calloutIcon}),/* @__PURE__ */ (0,i.jsx)(`span`,{children:C})]}),x===null&&(n===null||s!==null&&_===null)&&/* @__PURE__ */ (0,i.jsxs)(`div`,{className:$.status,children:[/* @__PURE__ */ (0,i.jsx)(r.StateDot,{state:`ongoing`}),t(`loading`)]}),_!==null&&_.length===0&&/* @__PURE__ */ (0,i.jsxs)(`div`,{className:$.empty,children:[/* @__PURE__ */ (0,i.jsx)(r.IconSearchOutlineRegular,{size:22,className:$.emptyIcon}),t(`empty`)]}),_!==null&&_.length>0&&/* @__PURE__ */ (0,i.jsx)(`ul`,{className:$.list,children:_.map(e=>{let n=D[JSON.stringify([s,e.nativeSessionId])];return/* @__PURE__ */ (0,i.jsxs)(`li`,{className:$.row,children:[/* @__PURE__ */ (0,i.jsxs)(`div`,{className:$.rowText,children:[/* @__PURE__ */ (0,i.jsx)(`div`,{className:$.rowTitle,children:e.title??t(`untitled`)}),/* @__PURE__ */ (0,i.jsxs)(`div`,{className:$.rowMeta,children:[/* @__PURE__ */ (0,i.jsxs)(`span`,{className:$.metaItem,title:e.cwd,children:[/* @__PURE__ */ (0,i.jsx)(r.IconFolderCloseRegular,{size:13,className:$.metaIcon}),/* @__PURE__ */ (0,i.jsx)(`span`,{className:$.metaText,children:A(e.cwd)})]}),/* @__PURE__ */ (0,i.jsxs)(`span`,{className:$.metaItem,children:[/* @__PURE__ */ (0,i.jsx)(r.IconClockOutlineRegular,{size:13,className:$.metaIcon}),zf(e.updatedAt)]})]})]}),/* @__PURE__ */ (0,i.jsx)(r.Button,{variant:n?`outline`:`primary`,size:`sm`,className:$.action,disabled:T!==null,onClick:()=>void ne(e),children:T===e.nativeSessionId?t(`importing`):t(n?`open`:`import`)})]},e.nativeSessionId)})}),s!==null&&/* @__PURE__ */ (0,i.jsxs)(`div`,{className:$.footer,children:[/* @__PURE__ */ (0,i.jsxs)(`label`,{className:$.pageSize,children:[t(`pageSize`),/* @__PURE__ */ (0,i.jsx)(`select`,{className:$.select,"aria-label":t(`pageSize`),value:p,disabled:T!==null,onChange:e=>{j(),m(Number(e.target.value))},children:[20,50,100].map(e=>/* @__PURE__ */ (0,i.jsx)(`option`,{value:e,children:e},e))})]}),/* @__PURE__ */ (0,i.jsxs)(`div`,{className:$.pager,children:[_!==null&&/* @__PURE__ */ (0,i.jsx)(`span`,{className:$.range,children:t(`range`,{start:String(y===0?0:d+1),end:String(d+_.length),total:String(y)})}),/* @__PURE__ */ (0,i.jsx)(r.Button,{variant:`outline`,size:`sm`,className:$.pageButton,"aria-label":t(`previous`),title:t(`previous`),disabled:T!==null||_===null||d===0,onClick:()=>{v(null),f(Math.max(0,d-p))},children:/* @__PURE__ */ (0,i.jsx)(r.IconChevronLeftOutlineRegular,{size:14})}),/* @__PURE__ */ (0,i.jsx)(r.Button,{variant:`outline`,size:`sm`,className:$.pageButton,"aria-label":t(`next`),title:t(`next`),disabled:T!==null||_===null||d+p>=y,onClick:()=>{v(null),f(d+p)},children:/* @__PURE__ */ (0,i.jsx)(r.IconChevronRightOutlineRegular,{size:14})})]})]})]})})}let Hf=`@deepseek-ai/dsh-client-ui-codexhost/HostSettingsSection.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Hf)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-codexhost`,e.dataset.pluginCss=Hf,e.textContent=`.B1PPLa_host{min-width:0;display:block}.B1PPLa_error{color:var(--dsw-alias-state-error-primary);padding:16px 0;font-size:13px;line-height:20px}`,document.head.appendChild(e)}var Uf={error:`B1PPLa_error`,host:`B1PPLa_host`};let Wf;function Gf(){return Wf??=new Promise((e,t)=>{let n=document.createElement(`script`);n.src=`codexhost-settings.js`,n.onload=()=>{let n=window.__codexhostWebSettingsV1;n?e(n):t(/* @__PURE__ */ Error(`codexhost-settings.js did not register its pages`))},n.onerror=()=>{t(/* @__PURE__ */ Error(`codexhost-settings.js could not be loaded`))},document.head.append(n)}).catch(e=>{throw Wf=void 0,e}),Wf}function Kf({t:e,pageId:t,locale:n,colorScheme:r}){let a=(0,o.useRef)(null),[s,c]=(0,o.useState)(``),l=(0,o.useSyncExternalStore)(n.subscribe,n.get),u=(0,o.useSyncExternalStore)(r.subscribe,r.get);return(0,o.useEffect)(()=>{let e=!1,n;return c(``),Gf().then(r=>{!e&&a.current&&(n=r.mount(t,a.current,{locale:l,colorScheme:u}))}).catch(t=>{e||c(t instanceof Error?t.message:String(t))}),()=>{e=!0,n?.()}},[t,l,u]),/* @__PURE__ */ (0,i.jsxs)(i.Fragment,{children:[s&&/* @__PURE__ */ (0,i.jsx)(`div`,{className:Uf.error,children:e(`settings.unavailable`,{message:s})}),/* @__PURE__ */ (0,i.jsx)(`div`,{ref:a,className:Uf.host})]})}let qf={"discovery.agents":`Delegation Agents`,"discovery.sessions":`Sessions`,"discovery.commands":`Native commands`,"discovery.skills":`Skills`,"discovery.offline":`Host disconnected`,"discovery.pending":`A command request is pending`,"discovery.busy":`Thread busy; direct commands cannot be queued`,"discovery.stale":`The selection expired. Open the menu and select again.`,"discovery.unconfirmed":`Command not confirmed. Check Thread progress before retrying; no automatic resend.`,"discovery.conflict":`Invocation conflicts with an interface command`,"discovery.static":`Static catalog: project commands and Skills load after the session starts.`,"discovery.empty":`No native commands advertised.`,"discovery.retry":`Retry native commands`,"discovery.failed":`Native command catalog unavailable:`,"settings.connectDevices":`Connect devices`,"settings.extensions":`Interface extensions`,"settings.connections":`Connections`,"settings.resources":`Resources`,"settings.accounts":`Accounts`,"settings.usage":`Usage`,"settings.updates":`Updates`,"settings.about":`About`,"settings.unavailable":`Could not load this page: {message}`,panel:`Import sessions`,"connection.reconnecting":`Connection interrupted; reconnecting…`,"connection.offline":`Network appears offline. Showing previously synced content.`,"connection.host":`Host unavailable; reconnecting…`,"connection.error":`Could not sync messages. Retry the connection.`,"connection.checking":`Checking the connection…`,"connection.computer":`Cannot reach your computer. Check that it is on and Web is running.`,"connection.lastSynced":`Last synced at {time}`,"connection.retry":`Retry`,title:`Import sessions`,subtitle:`Continue a session you started in a Harness on this computer. Its history is loaded when you open it.`,search:`Search by title or folder`,import:`Import`,open:`Open`,importing:`Importing…`,empty:`No sessions found.`,loading:`Loading sessions…`,untitled:`Untitled session`,error:`Could not load sessions: {message}`,noSources:`No installed Harness can import sessions.`,sources:`Import from Harness`,refresh:`Refresh sessions`,pageSize:`Sessions per page`,previous:`Previous page`,next:`Next page`,range:`{start}–{end} of {total}`,importFailed:`Could not import this session: {message}`,openFailed:`Session imported, but could not open it. Retry Open; do not import again. {message}`,catalogPending:`The imported Thread is not yet available in the session list.`,"usage.title":`Usage`,"usage.details":`Usage details`,"usage.group.session":`Session`,"usage.group.turn":`Turn`,"usage.group.tokens":`Token`,"usage.group.plan":`Plan usage`,"usage.group.quota":`Account quota`,"usage.cache.short":`CH`,"usage.cache.latest":`Latest cache hit (CH)`,"usage.cache.average":`Average cache hit`,"usage.speed":`Output speed (TPS)`,"usage.speed.api":`Output speed (API)`,"usage.ttft":`First token (TTFT)`,"usage.cost":`Cost`,"usage.cost.estimate":`Cost estimate`,"usage.credits":`Credits used`,"usage.resetCredits":`Reset credits available`,"usage.context":`Context used`,"usage.tokens.io":`Input / output`,"usage.tokens.cacheRead":`Cache read`,"usage.tokens.cacheReadWrite":`Cache read / write`,"usage.tokens.total":`Total tokens`,"usage.plan.fiveHour":`5-hour limit`,"usage.plan.sevenDay":`7-day limit`,"usage.quota":`Quota used`,"usage.quota.remaining":`Remaining`,"usage.quota.details":`Quota details`,"usage.resets":`Resets`,"usage.dateLocale":`en-US`,"usage.reset.today":`{time} today`,"usage.reset.at":`Resets {time}`,"usage.unpriced":`Unpriced models`,"usage.unit.tokens":`tokens`,"usage.unit.credits":`credits`,"usage.unit.tps":`tok/s`,"usage.unit.ms":`ms`,"usage.unit.seconds":`s`,"connectDevices.title":`Connect this computer`,"connectDevices.subtitle":`Scan with your phone camera to continue in the browser.`,"connectDevices.recommended":`Recommended`,"connectDevices.httpsSummary":`Across networks · Tailscale required on your phone`,"connectDevices.lanSummary":`Connect on the same network, with no extra app`,"connectDevices.address":`Connection address`,"connectDevices.refresh":`Refresh status`,"connectDevices.otherMethods":`Other connection methods`,"connectDevices.preparing":`Preparing…`,"connectDevices.qrPending":`QR code not ready`,"connectDevices.scan":`Scan with your phone camera`,"connectDevices.enableQr":`Enable and show QR code`,"connectDevices.enableImpact":`Enables HTTP access on this computer’s network interfaces. Web briefly restarts and terminals disconnect; running tasks continue.`,"connectDevices.httpsSetup":`Tailscale is ready. Enable HTTPS access to show your QR code.`,"connectDevices.httpsPersistence":`HTTPS forwarding stays enabled after Web exits. You can stop it below.`,"connectDevices.refreshHint":`Refresh to check the available address.`,"connectDevices.openTailscale":`Open Tailscale settings`,"connectDevices.noAddress":`No address is available for this network. Check the computer’s connection, then refresh.`,"connectDevices.help":`Having trouble connecting?`,"connectDevices.keepAwake":`Keep this computer awake and Web running. For Wi-Fi, both devices need to be on the same network.`,"connectDevices.accessEnabled":`Device access enabled`,"connectDevices.localAccess":`Local access only`,"connectDevices.tokenTitle":`Access token`,"connectDevices.stopTitleShort":`Stop device access`,"connectDevices.stopHint":`Turns off the relay, IP access and HTTPS forwarding enabled here. Running tasks continue.`,"connectDevices.stop":`Stop access…`,"connectDevices.stopTitle":`Stop device access?`,"connectDevices.stopConfirm":`Stop access`,"connectDevices.stopDescription":`Turns off the relay, IP access and Tailscale HTTPS enabled here. Devices and Web terminals connected through them disconnect; running tasks continue. You can enable access again at any time.`,"connectDevices.stopUnmanaged":`Your external proxy or foreground listener is managed separately and may still allow access.`,"connectDevices.stopIncomplete":`Some HTTPS forwarding is still active. Refresh and try stopping access again.`,"connectDevices.restartTimeout":`Web has not reconnected yet. Check that it is running, then refresh status.`,"connectDevices.localOnly":`The QR code and access token are only available on the computer. Open {url} there to get them.`,"connectDevices.disabled":`Authentication is not enabled, so no access token is needed.`,"connectDevices.autostart":`Start automatically after login`,"connectDevices.restarting":`Restarting Web… Waiting for this page to reconnect.`,"connectDevices.loading":`Loading…`,"connectDevices.loadFailed":`Could not load this page: {message}`,"connectDevices.actionFailed":`That did not work: {message}`,"connectDevices.connectVia":`Connect through`,"connectDevices.enlargeQr":`Enlarge QR code`,"connectDevices.qrLabel":`Sign-in QR code`,"connectDevices.relay.inUse":`In use`,"connectDevices.relay.closeFirst":`Turn off the active relay before switching or changing its control address.`,"connectDevices.selfRelay.title":`Self-hosted relay`,"connectDevices.selfRelay.summary":`Your server and domain · No phone app needed`,"connectDevices.selfRelay.off":`Use your own relay server. Like the official relay, it only forwards encrypted traffic.`,"connectDevices.selfRelay.address":`Relay server address: {host}`,"connectDevices.selfRelay.previewTitle":`After enabling, your phone will reach this computer at:`,"connectDevices.selfRelay.previewAutoName":`computer ID`,"connectDevices.selfRelay.name":`Device name`,"connectDevices.selfRelay.host":`Relay domain`,"connectDevices.selfRelay.hostHint":`The domain you deployed the relay on, without https:// or relay.`,"connectDevices.selfRelay.nameHint":`A name for this computer: lowercase letters, digits and hyphens. It becomes the start of the phone address. Leave empty to use a computer ID.`,"connectDevices.selfRelay.invalidHost":`Enter your relay's base domain, such as example.com, without https:// or a port.`,"connectDevices.selfRelay.invalidName":`Use 1–63 lowercase letters, digits or interior hyphens; the relay server address is reserved.`,"connectDevices.selfRelay.helpTitle":`How to set up your own relay`,"connectDevices.selfRelay.domain":`You need a domain and a Linux server with Docker (servers in mainland China require domain ICP filing with the cloud provider first).`,"connectDevices.selfRelay.dns":`In your domain's DNS settings, add a record: type A, name *, value your server's public IPv4 address. On Cloudflare, choose DNS only.`,"connectDevices.selfRelay.ports":`Open TCP port 443.`,"connectDevices.selfRelay.docker":`Run on the server:`,"connectDevices.selfRelay.replaceDomain":`# Replace example.com with your actual domain`,"connectDevices.selfRelay.connect":`Come back here, enter your relay domain and a device name (e.g. example.com and mycomputer) and click Enable relay.`,"connectDevices.selfRelay.noDomain":`No domain? Use the official relay or Tailscale.`,"connectDevices.selfRelay.docs":`Full self-hosted relay guide`,"connectDevices.relay.title":`codexhost Relay`,"connectDevices.relay.summary":`Any network · No app needed on your phone`,"connectDevices.relay.hint":`Connect across networks without an extra phone app. An access token is required.`,"connectDevices.relay.off":`The official codexhost relay. It only forwards encrypted traffic.`,"connectDevices.relay.name":`Address name (optional)`,"connectDevices.relay.nameHint":`4–20 lowercase letters or digits. Leave blank to let the relay assign a name.`,"connectDevices.relay.inviteLabel":`Invitation code`,"connectDevices.relay.invite":`Invitation code is invalid or has already been used`,"connectDevices.relay.name-taken":`This name is already taken. Choose another one.`,"connectDevices.relay.banned":`This computer has been disabled on this relay`,"connectDevices.relay.full":`The relay is full. Retrying automatically.`,"connectDevices.relay.connectionFailed":`Cannot connect to the relay. Check its server, DNS and certificate. Retrying automatically.`,"connectDevices.relay.quota":`Today's traffic allowance is used up`,"connectDevices.relay.quotaUntil":`Available again at {date}`,"connectDevices.relay.enable":`Enable relay`,"connectDevices.relay.disable":`Turn off relay`,"connectDevices.relay.preparing":`Preparing… This usually takes under a minute.`,"connectDevices.relay.unavailable":`Temporarily unavailable. Retrying automatically at {date}.`,"connectDevices.relay.paused":`Needs attention. Fix the issue below, then turn the relay off and enable it again.`,"connectDevices.relay.unreachable":`The certificate authority could not be reached.`,"connectDevices.relay.replaced":`Stopped: another computer is using this identity. Turn the relay off and enable it again after resolving the conflict.`,"connectDevices.relay.rejected":`Stopped: the relay rejected this computer.`,"connectDevices.relay.unsupported-version":`Stopped: this protocol version is unsupported. Update codexhost.`,"connectDevices.kindPublic":`Public address`,"connectDevices.kindPublicHint":`Your configured public address. An access token is still required.`,"connectDevices.kindFunnel":`Tailscale Funnel · Public`,"connectDevices.kindFunnelHint":`Anyone on the Internet can reach the sign-in page. An access token is still required.`,"connectDevices.tailscale.not-installed":`Install and sign in to Tailscale on this computer and your phone, then refresh.`,"connectDevices.tailscale.not-running":`Tailscale is not running. Start Tailscale on this computer.`,"connectDevices.tailscale.not-logged-in":`Sign in to Tailscale on this computer first.`,"connectDevices.tailscale.https-disabled":`Enable HTTPS certificates in the Tailscale admin console first.`,"connectDevices.tailscale.occupied":`HTTPS is already used by another service. Manage that forwarding in Tailscale first. Current target:`,"connectDevices.tailscale.error":`Could not read Tailscale status:`,"connectDevices.kindTailscale":`Tailscale`,"connectDevices.tailscaleViaHttps":`HTTPS`,"connectDevices.tailscaleViaIp":`IP`,"connectDevices.kindLan":`Same Wi-Fi`,"connectDevices.kindVirtual":`Virtual network`,"connectDevices.kindVirtualHint":`Usually reachable only from virtual machines on this computer.`,"connectDevices.remote.tailscale":`Install and sign in on both your phone and this computer to put them on a private network. They can then connect from anywhere without exposing Web to the Internet. Your phone needs Tailscale on, and this page shows the next step after you install it.`,"connectDevices.remote.tailscaleLink":`Download Tailscale`,"connectDevices.remote.tunnelTitle":`Your own tunnel or proxy`,"connectDevices.remote.tunnel":`If you already use frp, Cloudflare Tunnel, or nginx, forward it to Web on this computer and keep the original Host. For an installed release, run codexhost web --public-url <address>; from source, run npm start web -- --public-url <address>. The QR code will use that address.`,"connectDevices.remote.tunnelLink":`View setup guide`,"connectDevices.copyLink":`Copy link`,"connectDevices.copyToken":`Copy token`,"connectDevices.copied":`Copied`,"connectDevices.copyFailed":`Copy failed`,"connectDevices.neverUsed":`No device has signed in yet`,"connectDevices.lastUsed":`Last used {time}`,"connectDevices.relative.now":`just now`,"connectDevices.relative.minutes":`{n} min ago`,"connectDevices.relative.hours":`{n} hr ago`,"connectDevices.relative.days":`{n} d ago`,"connectDevices.relative.months":`{n} mo ago`,"connectDevices.relative.years":`{n} yr ago`,"connectDevices.regenerate":`Regenerate…`,"connectDevices.regenerateTitle":`Regenerate the access token?`,"connectDevices.regenerateDescription":`Every other device is signed out immediately and has to scan the new QR code. Running tasks are not affected.`,"connectDevices.regenerateConfirm":`Regenerate`,"connectDevices.signOut":`Sign out…`,"connectDevices.signOutTitle":`Sign out of this device?`,"connectDevices.signOutDescription":`Signing back in needs the access token, which can only be copied on the computer. Other devices stay signed in.`,"connectDevices.signOutConfirm":`Sign out`,"connectDevices.cancel":`Cancel`,"connectDevices.close":`Close`,"connectDevices.localListener":`This foreground Web cannot change its IP listener here. Use Tailscale HTTPS, or see the setup guide.`,"extensions.description":`Add DSH themes and panels to Web. Extensions are shared by everyone connected to this Web service. After installing, enable the extension here.`,"extensions.localOnly":`Extensions can only be managed on the computer running Web. Open {url} on that computer to manage them.`,"extensions.loading":`Loading extensions…`,"extensions.loadFailed":`Could not load extensions: {message}`,"extensions.actionFailed":`That did not work: {message}`,"extensions.add":`Add extension`,"extensions.installed":`Installed`,"extensions.info":`About interface extensions`,"extensions.project":`Project website`,"extensions.metadataError":`Plugin metadata: {message}`,"extensions.close":`Close`,"extensions.sourceLabel":`Package name or address`,"extensions.sourcePlaceholder":`npm package name, GitHub URL or local directory`,"extensions.sourceHint":`Enter the extension's package name, GitHub repository address or local directory path.`,"extensions.scope":`Supports prebuilt DSH themes, sidebar panels and display components. Extensions requiring backend services or a build step are not supported. After installing, enable the extension in the list.`,"extensions.guide":`Installation guide and examples`,"extensions.guideNpm":`npm package name; a version is optional. Format examples:`,"extensions.guideGitHub":`Public GitHub repository; replace this example with the actual address:`,"extensions.guideDirectory":`Absolute directory or archive path on the computer running Web. Format examples:`,"extensions.registry":`Installation source`,"extensions.registryOfficial":`Official npm registry`,"extensions.registryMirror":`China mainland mirror`,"extensions.registryCustom":`Custom registry`,"extensions.registryCustomUrl":`Custom registry URL`,"extensions.registryInvalid":`Enter an HTTP(S) registry URL without a username, password, query or fragment.`,"extensions.registryHint":`The registry downloads npm packages and dependencies. GitHub addresses connect to GitHub directly. Private registry authentication uses the Web computer's npm configuration.`,"extensions.install":`Install`,"extensions.installing":`Installing…`,"extensions.restart":`Extensions update live without restarting Web or its terminals. Homepage-only injections require a page refresh. Server loading does not confirm that every page has applied the extension.`,"extensions.safeMode":`Web started with built-in extensions only. Your saved choices are kept.`,"extensions.storeError":`Could not read saved extensions: {message}`,"extensions.empty":`No interface extensions installed.`,"extensions.enabled":`Enabled for Web`,"extensions.disabled":`Disabled`,"extensions.source":`Source: {source}`,"extensions.pendingRestart":`The saved selection is not loaded on the server.`,"extensions.includedAtStartup":`Loaded on the server; connected ordinary pages synchronize automatically.`,"extensions.extensionError":`Could not prepare this extension: {message}`,"extensions.enable":`Enable`,"extensions.disable":`Disable`,"extensions.remove":`Uninstall`,"extensions.confirmRemove":`Uninstall “{name}”? Its running instance will stop before the installation files are removed.`,"extensions.cancel":`Cancel`,"extensions.refresh":`Refresh list`,"extensions.retry":`Retry`,"extensions.recovery":`Open recovery page`,"extensions.builtinsOnly":`Open with built-in extensions only`,"pwa.title":`Install CodexHost app`,"pwa.install":`Install app`,"pwa.instructions":`Installation guide`,"pwa.prompting":`Confirm installation in your browser's dialog.`,"pwa.accepted":`Installation requested. Your browser will finish installing the app.`,"pwa.dismissed":`Installation cancelled. You can still install from your browser's menu.`,"pwa.failed":`Could not open the installation dialog. Try your browser's menu or reload this page.`,"pwa.installed":`CodexHost is running as an app or this browser has confirmed installation.`,"pwa.guide.insecure":`Installation requires HTTPS or localhost. Open an HTTPS address from Connect devices.`,"pwa.guide.ios":`On iOS, choose Share → Add to Home Screen in your browser. If unavailable, open in Safari.`,"pwa.guide.android":`On Android, use Chrome or Edge, then tap Install app here when available; otherwise use the browser menu's Install app option.`,"pwa.guide.safari":`In Safari on macOS 14 or later, choose File → Add to Dock.`,"pwa.guide.browser":`Use Chrome or Edge, then click Install app here when available, or use the address bar's install icon.`,"pwa.guide.limitations":`If opened inside WeChat or another app, use an external browser.`,"notifications.title":`Notifications`,"notifications.on":`This device is notified when a turn finishes or an agent needs your approval or answer.`,"notifications.off":`Get notified on this device when a turn finishes or an agent needs you.`,"notifications.denied":`Notifications are blocked for this site in your browser settings.`,"notifications.unsupported":`This browser does not support push notifications.`,"notifications.needs-install":`On iPhone and iPad, add CodexHost to the Home Screen (Share → Add to Home Screen), then enable notifications there.`,"notifications.enable":`Enable`,"notifications.disable":`Turn off`,"notifications.test":`Send test`,"desktop.label":`Desktop screenshot`,"desktop.primary":`Connected computer · Main display`,"desktop.refresh":`Take another screenshot`,"desktop.landscape":`Landscape`,"desktop.portrait":`Portrait`,"desktop.flip":`Flip`,"desktop.annotate":`Mark up`,"desktop.annotate.cancel":`Cancel`,"desktop.annotate.done":`Done`,"desktop.annotate.undo":`Undo`,"desktop.annotate.clear":`Clear`,"desktop.annotate.reset":`Restore original`,"desktop.annotate.failed":`Could not prepare the image. Try again.`,"desktop.tool.pen":`Pen`,"desktop.tool.rect":`Box`,"desktop.tool.arrow":`Arrow`,"desktop.crop":`Crop`,"desktop.crop.hint":`Drag the box or its corners to choose what to keep`,"desktop.send":`Send`,"desktop.message.placeholder":`Add a line, then send…`,"desktop.hint":`Pinch to zoom · tap to hide buttons`,"desktop.save":`Save`,"desktop.save.failed":`Could not save the image.`,"desktop.zoom.fit":`Fit`,"desktop.attach":`Add to conversation`,"desktop.attach.blocked":`The draft cannot take attachments right now.`,"desktop.close":`Close desktop screenshot`,"desktop.enlarge":`Enlarge desktop screenshot`,"desktop.pending":`Capturing the desktop…`,"desktop.transferring":`Receiving screenshot… {loaded} / {total}`,"desktop.transferring.unknown":`Receiving screenshot… {loaded}`,"desktop.captured":`Captured: {time}`,"desktop.error.unsupported":`Desktop screenshots support Windows and macOS computers only.`,"desktop.error.permission-denied":`We requested permission and tried to open Screen Recording settings on the Mac running Web, not this phone. Allow the actual program listed by macOS (such as CodexHost, Node, or your terminal), then take another screenshot manually. Restart that program if macOS asks. If settings did not open, go to System Settings → Privacy & Security → Screen Recording (or Screen & System Audio Recording).`,"desktop.error.display-unavailable":`The computer's main desktop is unavailable. Log in and unlock the computer, check its main display, and wait for any Windows UAC secure desktop prompt to close. Windows normally has no separate screenshot permission switch; do not disable UAC.`,"desktop.error.capture-failed":`Could not capture the desktop. Try again manually.`,"desktop.error.image-too-large":`The desktop image exceeds the supported size.`,"desktop.error.busy":`A screenshot is already being captured. Try again shortly.`,"desktop.error.timeout":`Desktop capture timed out. Check the computer before trying again.`,"desktop.error.unavailable":`Screenshot service unavailable. Check your connection and native launcher version.`,"voice.label":`Voice input`,"voice.permission":`Waiting for microphone permission…`,"voice.stop":`Stop and insert into draft`,"voice.send":`Transcribe and send`,"voice.done":`Done`,"voice.transcribing":`Transcribing…`,"voice.slow":`Still transcribing…`,"voice.silent":`No sound detected`,"voice.retry":`Retry transcription`,"voice.rerecord":`Record again`,"voice.tryAgain":`Try again`,"voice.undo":`Undo`,"voice.cancelled":`Discarded the {time} recording.`,"voice.unplaced":`The draft changed while transcribing, so the text was not inserted automatically.`,"voice.insert":`Insert at cursor`,"voice.copy":`Copy`,"voice.cancel":`Cancel recording`,"voice.discard":`Discard`,"voice.error.browser-unsupported":`This page cannot record audio. Open it over HTTPS or localhost.`,"voice.error.permission-denied":`Microphone access is blocked. Allow the microphone in the site settings next to the address bar, then try again.`,"voice.error.no-microphone":`No microphone found. Check the system input device.`,"voice.error.record-failed":`Could not access the microphone. Check the browser and the input device.`,"voice.error.credentials-unavailable":`No usable Codex ChatGPT login was found.`,"voice.error.login-expired":`The Codex login has expired. Use Codex once to refresh it; the recording is kept.`,"voice.error.rate-limited":`The voice service is rate limited. Try again later; the recording is kept.`,"voice.error.service-rejected":`The voice service rejected the request. The recording is kept.`,"voice.error.host-incompatible":`The current Host does not support voice transcription. Update and restart the Host.`,"voice.error.network":`Transcription failed: the network request failed. The recording is kept; no need to speak again.`,"voice.error.timeout":`Transcription timed out. The recording is kept; no need to speak again.`,"voice.error.audio-empty":`No speech was recognized.`,"voice.error.audio-too-large":`The recording exceeds the 10 MiB limit.`,"voice.error.audio-format":`The audio format is not accepted.`,"voice.error.audio-invalid":`The recording is unavailable.`},Jf={"discovery.agents":`委派 Agent`,"discovery.sessions":`会话`,"discovery.commands":`原生命令`,"discovery.skills":`Skills`,"discovery.offline":`Host 已断线`,"discovery.pending":`命令请求正在提交`,"discovery.busy":`会话正忙,直接命令不能排队`,"discovery.stale":`选择已失效,请重新打开菜单选择。`,"discovery.unconfirmed":`命令结果未确认,请先检查会话进度再决定是否重试;不会自动重发。`,"discovery.conflict":`调用名与界面命令冲突`,"discovery.static":`静态目录:项目命令和 Skills 在会话启动后加载。`,"discovery.empty":`未提供原生命令。`,"discovery.retry":`重试原生命令目录`,"discovery.failed":`原生命令目录不可用:`,"settings.connectDevices":`连接设备`,"settings.extensions":`界面扩展`,"settings.connections":`连接`,"settings.resources":`资源管理`,"settings.accounts":`账号`,"settings.usage":`用量统计`,"settings.updates":`更新`,"settings.about":`关于`,"settings.unavailable":`无法加载此页面:{message}`,panel:`导入会话`,"connection.reconnecting":`连接已中断,正在重连…`,"connection.offline":`网络可能已断开,当前显示上次同步内容。`,"connection.host":`Host 暂不可用,正在重连…`,"connection.error":`消息同步失败,请重试连接。`,"connection.checking":`正在检查连接…`,"connection.computer":`无法连接到电脑,请确认电脑已开机且 Web 正在运行。`,"connection.lastSynced":`上次同步于 {time}`,"connection.retry":`重试`,title:`导入会话`,subtitle:`继续你在这台电脑上用 Harness 开过的会话,打开时会加载完整历史。`,search:`按标题或文件夹搜索`,import:`导入`,open:`打开`,importing:`正在导入…`,empty:`没有找到会话。`,loading:`正在加载会话…`,untitled:`未命名会话`,error:`无法加载会话:{message}`,noSources:`没有已安装的 Harness 支持导入会话。`,sources:`导入来源 Harness`,refresh:`刷新会话`,pageSize:`每页会话数`,previous:`上一页`,next:`下一页`,range:`第 {start}–{end} 个,共 {total} 个`,importFailed:`无法导入该会话:{message}`,openFailed:`会话已导入,但无法打开。请重试“打开”,无需再次导入。{message}`,catalogPending:`已导入的 Thread 暂未出现在会话列表中。`,"usage.title":`用量`,"usage.details":`用量详情`,"usage.group.session":`会话`,"usage.group.turn":`本轮`,"usage.group.tokens":`Token`,"usage.group.plan":`套餐用量`,"usage.group.quota":`账号配额`,"usage.cache.short":`CH`,"usage.cache.latest":`最近缓存命中(CH)`,"usage.cache.average":`平均缓存命中`,"usage.speed":`输出速度(TPS)`,"usage.speed.api":`输出速度(API)`,"usage.ttft":`首 token(TTFT)`,"usage.cost":`费用`,"usage.cost.estimate":`费用估算`,"usage.credits":`已用 Credits`,"usage.resetCredits":`可用重置次数`,"usage.context":`上下文占用`,"usage.tokens.io":`输入 / 输出`,"usage.tokens.cacheRead":`缓存读取`,"usage.tokens.cacheReadWrite":`缓存读取 / 写入`,"usage.tokens.total":`总数`,"usage.plan.fiveHour":`5 小时额度`,"usage.plan.sevenDay":`7 天额度`,"usage.quota":`配额占用`,"usage.quota.remaining":`剩余`,"usage.quota.details":`额度详情`,"usage.resets":`重置时间`,"usage.dateLocale":`zh-CN`,"usage.reset.today":`今天 {time}`,"usage.reset.at":`{time} 重置`,"usage.unpriced":`未定价模型`,"usage.unit.tokens":`Token`,"usage.unit.credits":`Credits`,"usage.unit.tps":`tok/s`,"usage.unit.ms":`毫秒`,"usage.unit.seconds":`秒`,"connectDevices.title":`连接这台电脑`,"connectDevices.subtitle":`用手机相机扫码,在浏览器中继续使用。`,"connectDevices.recommended":`推荐`,"connectDevices.httpsSummary":`跨网络访问 · 手机需开启 Tailscale`,"connectDevices.lanSummary":`使用局域网地址连接,无需额外安装`,"connectDevices.address":`连接地址`,"connectDevices.refresh":`刷新状态`,"connectDevices.otherMethods":`其他连接方式`,"connectDevices.preparing":`正在准备…`,"connectDevices.qrPending":`二维码尚未就绪`,"connectDevices.scan":`用手机相机扫码`,"connectDevices.enableQr":`启用并显示二维码`,"connectDevices.enableImpact":`将允许通过这台电脑的网卡进行 HTTP 访问。Web 会短暂重启,Web 终端会断开,运行中的任务继续。`,"connectDevices.httpsSetup":`Tailscale 已就绪,启用 HTTPS 访问后即可扫码。`,"connectDevices.httpsPersistence":`HTTPS 转发在 Web 退出后仍保留,可在下方停止。`,"connectDevices.refreshHint":`刷新以检查可用地址。`,"connectDevices.openTailscale":`打开 Tailscale 设置`,"connectDevices.noAddress":`未找到此网络的可用地址,请检查电脑网络后刷新。`,"connectDevices.help":`连接遇到问题?`,"connectDevices.keepAwake":`请保持电脑唤醒且 Web 正在运行。使用 Wi-Fi 连接时,两台设备需处于同一局域网。`,"connectDevices.accessEnabled":`设备访问已启用`,"connectDevices.localAccess":`仅本机访问`,"connectDevices.tokenTitle":`访问令牌`,"connectDevices.stopTitleShort":`停止设备访问`,"connectDevices.stopHint":`关闭此页面开启的中转、IP 访问和 HTTPS 转发,运行中的任务继续。`,"connectDevices.stop":`停止访问…`,"connectDevices.stopTitle":`停止设备访问?`,"connectDevices.stopConfirm":`停止访问`,"connectDevices.stopDescription":`关闭此页面开启的中转、IP 访问和 Tailscale HTTPS。通过这些方式连接的设备和 Web 终端会断开,运行中的任务继续。之后可随时重新启用。`,"connectDevices.stopUnmanaged":`你配置的外部代理或前台监听需单独管理,它们可能仍允许访问。`,"connectDevices.stopIncomplete":`仍有 HTTPS 转发生效,请刷新后再次停止访问。`,"connectDevices.restartTimeout":`Web 尚未恢复连接,请确认它正在运行后刷新状态。`,"connectDevices.localOnly":`二维码和访问令牌只能在电脑上获取。请在电脑上打开 {url}。`,"connectDevices.disabled":`认证未启用,不需要访问令牌。`,"connectDevices.autostart":`登录后自动启动`,"connectDevices.restarting":`正在重启 Web… 等待页面恢复连接。`,"connectDevices.loading":`正在加载…`,"connectDevices.loadFailed":`无法加载此页面:{message}`,"connectDevices.actionFailed":`操作失败:{message}`,"connectDevices.connectVia":`连接方式`,"connectDevices.enlargeQr":`放大二维码`,"connectDevices.qrLabel":`登录二维码`,"connectDevices.relay.inUse":`当前使用`,"connectDevices.relay.closeFirst":`请先关闭当前中转,再切换中转或修改控制地址。`,"connectDevices.selfRelay.title":`自建中转`,"connectDevices.selfRelay.summary":`自己的服务器和域名 · 手机无需安装应用`,"connectDevices.selfRelay.off":`通过自己的服务器中转,和官方中转一样只转发加密内容。`,"connectDevices.selfRelay.address":`中转服务器地址:{host}`,"connectDevices.selfRelay.previewTitle":`启用后,手机将通过下面的地址访问这台电脑:`,"connectDevices.selfRelay.previewAutoName":`电脑 ID`,"connectDevices.selfRelay.name":`设备名称`,"connectDevices.selfRelay.host":`中转域名`,"connectDevices.selfRelay.hostHint":`你部署中转时使用的域名,不带 https:// 和 relay.`,"connectDevices.selfRelay.nameHint":`给这台电脑起的名字,只能用小写字母、数字和连字符,会成为手机访问地址的开头。留空则使用电脑 ID。`,"connectDevices.selfRelay.invalidHost":`请输入自建中转的基础域名,例如 example.com,不带 https:// 或端口。`,"connectDevices.selfRelay.invalidName":`名称须为 1–63 位小写字母、数字或中间的连字符,不能占用中转服务器地址。`,"connectDevices.selfRelay.helpTitle":`如何搭建自己的中转`,"connectDevices.selfRelay.domain":`准备一个域名,以及一台装有 Docker 的 Linux 服务器(中国大陆服务器需先完成域名备案)。`,"connectDevices.selfRelay.dns":`在域名的 DNS 设置里添加一条记录:类型选 A,名称填 *,值填服务器的公网 IPv4 地址。使用 Cloudflare 时选择“仅 DNS”。`,"connectDevices.selfRelay.ports":`放行 TCP 443 端口。`,"connectDevices.selfRelay.docker":`在服务器上运行以下命令:`,"connectDevices.selfRelay.replaceDomain":`# 将 example.com 替换为你的实际域名`,"connectDevices.selfRelay.connect":`回到这里填写中转域名和设备名称(例如 example.com 和 mycomputer),点击“启用中转”。`,"connectDevices.selfRelay.noDomain":`没有域名?可以使用官方中转或 Tailscale。`,"connectDevices.selfRelay.docs":`完整自建中转教程`,"connectDevices.relay.title":`codexhost 中转`,"connectDevices.relay.summary":`任何网络 · 手机无需安装应用`,"connectDevices.relay.hint":`跨网络连接,手机无需额外安装应用,登录需要访问令牌。`,"connectDevices.relay.off":`codexhost 官方中转,只转发加密内容。`,"connectDevices.relay.name":`地址名(可选)`,"connectDevices.relay.nameHint":`4–20 位小写字母和数字,留空由中转分配。`,"connectDevices.relay.inviteLabel":`邀请码`,"connectDevices.relay.invite":`邀请码无效或已被使用`,"connectDevices.relay.name-taken":`这个名字已被占用,请换一个`,"connectDevices.relay.banned":`此电脑已被停止使用该中转`,"connectDevices.relay.full":`中转已满,正在自动重试`,"connectDevices.relay.connectionFailed":`无法连接中转,请检查服务器、DNS 和证书。正在自动重试。`,"connectDevices.relay.quota":`今日流量已用完`,"connectDevices.relay.quotaUntil":`将于 {date} 恢复`,"connectDevices.relay.enable":`启用中转`,"connectDevices.relay.disable":`关闭中转`,"connectDevices.relay.preparing":`准备中…通常一分钟内完成。`,"connectDevices.relay.unavailable":`暂时无法使用,将于 {date} 自动重试。`,"connectDevices.relay.paused":`需要处理:请按下面的说明修复,然后关闭中转再重新启用。`,"connectDevices.relay.unreachable":`无法连接证书机构。`,"connectDevices.relay.replaced":`已停止:另一台电脑正在使用此身份。解决冲突后关闭中转再重新启用。`,"connectDevices.relay.rejected":`已停止:中转拒绝了这台电脑。`,"connectDevices.relay.unsupported-version":`已停止:协议版本不受支持,请更新 codexhost。`,"connectDevices.kindPublic":`公开地址`,"connectDevices.kindPublicHint":`你配置的公开地址,登录仍需要访问令牌。`,"connectDevices.kindFunnel":`Tailscale Funnel · 公开`,"connectDevices.kindFunnelHint":`互联网中的任何人都能访问登录页,登录仍需要访问令牌。`,"connectDevices.tailscale.not-installed":`请在这台电脑和手机上安装并登录 Tailscale,然后刷新状态。`,"connectDevices.tailscale.not-running":`Tailscale 未运行,请先在这台电脑上启动 Tailscale。`,"connectDevices.tailscale.not-logged-in":`请先在这台电脑上登录 Tailscale。`,"connectDevices.tailscale.https-disabled":`请先在 Tailscale 管理后台开启 HTTPS 证书。`,"connectDevices.tailscale.occupied":`HTTPS 已被其他服务使用,请先在 Tailscale 中调整转发。当前目标:`,"connectDevices.tailscale.error":`无法读取 Tailscale 状态:`,"connectDevices.kindTailscale":`Tailscale`,"connectDevices.tailscaleViaHttps":`HTTPS`,"connectDevices.tailscaleViaIp":`IP`,"connectDevices.kindLan":`同一 Wi-Fi`,"connectDevices.kindVirtual":`虚拟网络`,"connectDevices.kindVirtualHint":`通常只有这台电脑上的虚拟机能访问。`,"connectDevices.remote.tailscale":`在手机和这台电脑上安装并登录后,两者会组成一个私有网络,在任何地方都能连接,Web 也不会暴露到公网。手机需开着 Tailscale,安装后本页会提示下一步。`,"connectDevices.remote.tailscaleLink":`下载 Tailscale`,"connectDevices.remote.tunnelTitle":`自备隧道或代理`,"connectDevices.remote.tunnel":`如果你已在用 frp、Cloudflare Tunnel 或 nginx,把它转发到这台电脑上的 Web,并保留原始 Host。发行版运行 codexhost web --public-url <地址>;源码版运行 npm start web -- --public-url <地址>,二维码就会使用该地址。`,"connectDevices.remote.tunnelLink":`查看配置文档`,"connectDevices.copyLink":`复制链接`,"connectDevices.copyToken":`复制令牌`,"connectDevices.copied":`已复制`,"connectDevices.copyFailed":`复制失败`,"connectDevices.neverUsed":`还没有设备登录`,"connectDevices.lastUsed":`最近使用 {time}`,"connectDevices.relative.now":`刚刚`,"connectDevices.relative.minutes":`{n} 分钟前`,"connectDevices.relative.hours":`{n} 小时前`,"connectDevices.relative.days":`{n} 天前`,"connectDevices.relative.months":`{n} 个月前`,"connectDevices.relative.years":`{n} 年前`,"connectDevices.regenerate":`重新生成…`,"connectDevices.regenerateTitle":`重新生成访问令牌?`,"connectDevices.regenerateDescription":`其他设备会立即退出登录,需要重新扫码。运行中的任务不受影响。`,"connectDevices.regenerateConfirm":`重新生成`,"connectDevices.signOut":`退出登录…`,"connectDevices.signOutTitle":`退出这台设备的登录?`,"connectDevices.signOutDescription":`重新登录需要访问令牌,令牌只能在电脑上复制。其他设备不受影响。`,"connectDevices.signOutConfirm":`退出登录`,"connectDevices.cancel":`取消`,"connectDevices.close":`关闭`,"connectDevices.localListener":`当前前台 Web 无法在此更改 IP 监听。你可以使用 Tailscale HTTPS,或查看配置文档。`,"extensions.description":`为 Web 添加 DSH 主题和面板。扩展对连接此 Web 服务的所有页面生效,安装后可在这里启用。`,"extensions.localOnly":`界面扩展只能在运行 Web 的电脑上管理。请在该电脑上打开 {url}。`,"extensions.loading":`正在加载界面扩展…`,"extensions.loadFailed":`无法加载界面扩展:{message}`,"extensions.actionFailed":`操作失败:{message}`,"extensions.add":`添加扩展`,"extensions.installed":`已安装`,"extensions.info":`界面扩展说明`,"extensions.project":`项目地址`,"extensions.metadataError":`插件信息读取失败:{message}`,"extensions.close":`关闭`,"extensions.sourceLabel":`包名或地址`,"extensions.sourcePlaceholder":`npm 包名、GitHub 地址或本地目录`,"extensions.sourceHint":`输入扩展的包名、GitHub 仓库地址或本地目录路径。`,"extensions.scope":`支持已构建的 DSH 主题、侧栏面板和展示组件。暂不支持需要后台服务或构建步骤的扩展。安装完成后,可在列表中启用。`,"extensions.guide":`安装引导和示例`,"extensions.guideNpm":`npm 包名,无需指定版本。格式示例:`,"extensions.guideGitHub":`公开 GitHub 仓库,请将示例替换为实际地址:`,"extensions.guideDirectory":`运行 Web 的电脑上的目录或安装包绝对路径。格式示例:`,"extensions.registry":`安装源`,"extensions.registryOfficial":`npm 官方源`,"extensions.registryMirror":`中国大陆镜像源`,"extensions.registryCustom":`自定义安装源`,"extensions.registryCustomUrl":`自定义安装源地址`,"extensions.registryInvalid":`请输入 HTTP(S) 安装源地址,不要包含用户名、密码、查询参数或片段。`,"extensions.registryHint":`安装源用于下载 npm 包和依赖;GitHub 地址仍直接连接 GitHub。私有源认证沿用运行 Web 的电脑上的 npm 配置。`,"extensions.install":`安装`,"extensions.installing":`正在安装…`,"extensions.restart":`扩展启停实时生效,不重启 Web 或终端。仅首页初始化的注入需要刷新页面。服务端已加载不代表每个页面都已应用成功。`,"extensions.safeMode":`Web 本次仅加载内置扩展,已保存的启用选择仍会保留。`,"extensions.storeError":`无法读取已保存的扩展:{message}`,"extensions.empty":`还没有安装界面扩展。`,"extensions.enabled":`已启用 Web`,"extensions.disabled":`已禁用`,"extensions.source":`来源:{source}`,"extensions.pendingRestart":`已保存选择,服务端尚未加载。`,"extensions.includedAtStartup":`服务端已加载,已连接的普通页面自动同步。`,"extensions.extensionError":`此扩展暂不可加载:{message}`,"extensions.enable":`启用`,"extensions.disable":`禁用`,"extensions.remove":`卸载`,"extensions.confirmRemove":`卸载“{name}”?先停止运行实例,再删除安装文件。`,"extensions.cancel":`取消`,"extensions.refresh":`刷新列表`,"extensions.retry":`重试`,"extensions.recovery":`打开恢复页面`,"extensions.builtinsOnly":`仅使用内置扩展打开`,"pwa.title":`安装 CodexHost 应用`,"pwa.install":`安装应用`,"pwa.instructions":`安装指引`,"pwa.prompting":`请在浏览器弹窗中确认安装。`,"pwa.accepted":`已提交安装请求,浏览器将完成应用安装。`,"pwa.dismissed":`已取消安装,仍可通过浏览器菜单手动安装。`,"pwa.failed":`无法打开安装弹窗,请尝试浏览器菜单或刷新页面后重试。`,"pwa.installed":`当前已在应用窗口中运行,或浏览器已确认安装完成。`,"pwa.guide.insecure":`安装需要 HTTPS 或 localhost,请从「连接设备」打开 HTTPS 地址。`,"pwa.guide.ios":`在 iOS 上,点击浏览器的「分享 → 添加到主屏幕」;若没有此选项,请用 Safari 打开。`,"pwa.guide.android":`在安卓上,推荐使用 Chrome 或 Edge 打开,出现「安装应用」后点击此处安装;也可从浏览器菜单选择「安装应用」。`,"pwa.guide.safari":`在 macOS 14 或更新版本的 Safari 中,选择「文件 → 添加到程序坞」。`,"pwa.guide.browser":`推荐使用 Chrome 或 Edge 打开,出现「安装应用」后点击此处安装,或点击地址栏的安装图标。`,"pwa.guide.limitations":`若在微信等应用内打开,请改用外部浏览器。`,"notifications.title":`通知`,"notifications.on":`一轮结束、需要审批或回答问题时,会通知这台设备。`,"notifications.off":`一轮结束或 Agent 需要你时,在这台设备上收到通知。`,"notifications.denied":`浏览器设置中已阻止此网站的通知。`,"notifications.unsupported":`此浏览器不支持推送通知。`,"notifications.needs-install":`在 iPhone / iPad 上,请先把 CodexHost 添加到主屏幕(分享 → 添加到主屏幕),再在那里开启通知。`,"notifications.enable":`开启`,"notifications.disable":`关闭`,"notifications.test":`发送测试`,"desktop.label":`桌面截图`,"desktop.primary":`当前连接的电脑 · 主屏`,"desktop.refresh":`重新截图`,"desktop.landscape":`横屏`,"desktop.portrait":`竖屏`,"desktop.flip":`翻转`,"desktop.annotate":`标注`,"desktop.annotate.cancel":`取消`,"desktop.annotate.done":`完成`,"desktop.annotate.undo":`撤销`,"desktop.annotate.clear":`清除`,"desktop.annotate.reset":`还原原图`,"desktop.annotate.failed":`图片处理失败,请重试。`,"desktop.tool.pen":`画笔`,"desktop.tool.rect":`方框`,"desktop.tool.arrow":`箭头`,"desktop.crop":`裁剪`,"desktop.crop.hint":`拖动选框或四角,选择要保留的区域`,"desktop.send":`发送`,"desktop.message.placeholder":`写一句话,直接发送…`,"desktop.hint":`双指缩放 · 轻点隐藏按钮`,"desktop.save":`保存`,"desktop.save.failed":`保存图片失败。`,"desktop.zoom.fit":`适应屏幕`,"desktop.attach":`添加到会话`,"desktop.attach.blocked":`当前草稿暂时不能添加附件。`,"desktop.close":`关闭桌面截图`,"desktop.enlarge":`放大桌面截图`,"desktop.pending":`正在截取桌面…`,"desktop.transferring":`正在接收截图… {loaded} / {total}`,"desktop.transferring.unknown":`正在接收截图… {loaded}`,"desktop.captured":`拍摄于:{time}`,"desktop.error.unsupported":`桌面截图仅支持运行 Windows 或 macOS 的电脑。`,"desktop.error.permission-denied":`已请求系统授权,并尝试在运行 Web 的 Mac 上打开录屏权限设置(不是手机)。请为系统列出的实际启动程序授权,例如 CodexHost、Node 或终端;若系统要求,重启对应程序,再手动重新截图。若设置未打开,请进入「系统设置 → 隐私与安全性 → 屏幕录制/屏幕与系统音频录制」。`,"desktop.error.display-unavailable":`当前电脑的主屏桌面不可用。请在电脑端登录并解锁、检查主屏连接,等待 Windows UAC 安全桌面提示结束。Windows 通常没有单独的截图授权开关,请勿关闭 UAC。`,"desktop.error.capture-failed":`桌面截图失败,可手动重试。`,"desktop.error.image-too-large":`桌面图片超过支持的大小。`,"desktop.error.busy":`电脑正在截图,请稍后再试。`,"desktop.error.timeout":`桌面截图超时,请检查电脑后再试。`,"desktop.error.unavailable":`截图服务暂不可用,请检查连接和原生 Launcher 版本。`,"voice.label":`语音输入`,"voice.permission":`等待麦克风权限…`,"voice.stop":`结束录音并插入草稿`,"voice.send":`转写并发送`,"voice.done":`完成`,"voice.transcribing":`正在转写…`,"voice.slow":`转写较慢…`,"voice.silent":`没有听到声音`,"voice.retry":`重试转写`,"voice.rerecord":`重新录音`,"voice.tryAgain":`再试一次`,"voice.undo":`撤销`,"voice.cancelled":`已丢弃 {time} 的录音。`,"voice.unplaced":`草稿在转写期间被修改,转写结果没有自动插入`,"voice.insert":`插入到光标处`,"voice.copy":`复制`,"voice.cancel":`取消录音`,"voice.discard":`丢弃`,"voice.error.browser-unsupported":`当前页面不允许录音,请用 HTTPS 或 localhost 打开。`,"voice.error.permission-denied":`麦克风访问被阻止。点击地址栏左侧的站点设置,允许使用麦克风后再试。`,"voice.error.no-microphone":`未找到麦克风,请检查系统输入设备。`,"voice.error.record-failed":`暂时无法访问麦克风,请检查浏览器和输入设备。`,"voice.error.credentials-unavailable":`Codex ChatGPT 登录凭证不可用。`,"voice.error.login-expired":`Codex 登录已失效,请使用一次 Codex 刷新登录;录音已保留。`,"voice.error.rate-limited":`语音服务限流,请稍后重试;录音已保留。`,"voice.error.service-rejected":`语音服务拒绝了请求;录音已保留。`,"voice.error.host-incompatible":`当前 Host 不支持语音转写,请更新并重启 Host。`,"voice.error.network":`转写失败:网络请求失败。录音已保留,不需要重新说。`,"voice.error.timeout":`转写超时。录音已保留,不需要重新说。`,"voice.error.audio-empty":`没有识别到语音。`,"voice.error.audio-too-large":`录音超过 10 MiB 上限。`,"voice.error.audio-format":`音频格式不被接受。`,"voice.error.audio-invalid":`录音文件不可用。`},Yf=`codexhostImport`,Xf=`codexhost-import`,Zf=[`slots`,`locale`,`layout`,`uiWorkspace`,`workspaces`,`sessions`,`remote`,`inputTriggers`,`theme`,`connection`],Qf=[[`connections`,`settings.connections`],[`resources`,`settings.resources`],[`accounts`,`settings.accounts`],[`usage-statistics`,`settings.usage`],[`updates`,`settings.updates`],[`about`,`settings.about`]];function $f(e){e.effect(()=>e.locale.register(Yf,{zh:Jf,en:qf}),`ui-codexhost: dictionaries`);let t=e.locale.bind(Yf),n=e.get(`pwaInstall`);n!==void 0&&e.slots.inject(`settings.general.item`,()=>e.slots.register({name:`settings.general.item`,id:`codexhost.pwa-install`,order:90,locale:Yf,inject:()=>({installation:n})},Lf)),e.provide(`chatMessageEditing`,Il),e.provide(`chatTurnDiffs`,Fl),e.inject([`conversation`],e=>{let t=new Zl(Al.capture),n=e.conversation,r={create:(e,t)=>n.createDrafts(e,[t]),release:e=>n.releaseDraftAttachments(e)};e.effect(()=>()=>t.close(),`ui-codexhost: release desktop screenshot`);let i={screenshot:t,drafts:r,registerSource:t=>e.inputTriggers.registerSource(t)};e.slots.inject(`conversation.input.right`,()=>e.slots.register({name:`conversation.input.right`,id:`codexhost.desktop-screenshot`,locale:Yf,inject:()=>i},gu)),e.slots.inject(`conversation.input.notice`,()=>e.slots.register({name:`conversation.input.notice`,id:`codexhost.desktop-screenshot`,locale:Yf,inject:()=>({screenshot:t,drafts:r})},Su));let a=new wu(Dl.transcribe),o=new Ou;e.effect(()=>()=>a.discard(),`ui-codexhost: release microphone`),e.slots.inject(`conversation.input.right`,()=>e.slots.register({name:`conversation.input.right`,id:`codexhost.voice`,locale:Yf,inject:()=>({voice:a,blocks:e.conversation.blocks,tray:o})},ju)),e.slots.inject(`conversation.input.activity`,()=>e.slots.register({name:`conversation.input.activity`,locale:Yf,inject:()=>({voice:a,tray:o})},Mu)),e.slots.inject(`conversation.input.notice`,()=>e.slots.register({name:`conversation.input.notice`,id:`codexhost.voice`,locale:Yf,inject:()=>({voice:a})},Fu)),e.effect(()=>{let e=e=>{let{phase:t}=a.getSnapshot();e.key===`Escape`&&(t===`recording`||t===`transcribing`)?(e.preventDefault(),a.cancel()):e.code===`Space`&&e.shiftKey&&(e.metaKey||e.ctrlKey)&&!e.altKey&&(e.preventDefault(),a.toggle())};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},`ui-codexhost: voice shortcuts`)}),e.inject([`connection`,`modelDirectories`,`commandUi`],e=>Vl(e)),e.provide(`chatLinks`,{resolve:Object.assign(t=>{let n=ql(t);if(n===void 0)return;let r=n,i=()=>{let t=e.sessions.list.getSnapshot().byId[r];return t===void 0?void 0:Gl(t)};if(i()===void 0)return;let a=new URL(window.location.href);return a.searchParams.set(`session`,r),{href:a.href,open:()=>{i()!==void 0&&e.uiWorkspace.openSession(r)}}},{autoLinkPattern:Wl,subscribe:t=>e.sessions.list.subscribe(t)})}),Yl(e);let r={openSession:t=>{e.uiWorkspace.openSession(t)}};e.slots.inject(`main`,()=>e.slots.register({name:`main`,key:Xf,locale:Yf,inject:()=>({openSession:async(n,i)=>{let a=n;if(e.sessions.list.getSnapshot().byId[a]===void 0&&await e.sessions.refresh(),i.throwIfAborted(),e.sessions.list.getSnapshot().byId[a]===void 0)throw Error(t(`catalogPending`));r.openSession(n)}})},Vf)),e.slots.inject(`sidebar.panellist`,()=>e.slots.register({name:`sidebar.panellist`,id:Xf,order:10,label:()=>t(`panel`),locale:Yf},Lu)),e.slots.inject(`settings.general.item`,()=>e.slots.register({name:`settings.general.item`,id:`codexhost.notifications`,order:5,locale:Yf},Pf));let i={get:()=>e.locale.getLocale().active,subscribe:t=>e.locale.subscribe(t)},a={get:()=>e.theme.getTheme().active.colorScheme,subscribe:t=>e.on(`theme/change`,t)};e.slots.inject(`settings.section`,()=>e.slots.register({name:`settings.section`,id:`codexhost-ui-extensions`,order:8,label:()=>t(`settings.extensions`),locale:Yf,inject:()=>({resolveText:t=>e.locale.resolveText(t)})},jf)),e.slots.inject(`settings.section`,()=>e.slots.register({name:`settings.section`,id:`codexhost-connect-devices`,order:9,label:()=>t(`settings.connectDevices`),locale:Yf},yf)),Qf.forEach(([n,r],o)=>{e.slots.inject(`settings.section`,()=>e.slots.register({name:`settings.section`,id:`codexhost-${n}`,order:10+o,label:()=>t(r),locale:Yf,inject:()=>({pageId:n,locale:i,colorScheme:a})},Kf))}),e.slots.inject(`sidebar.session.row.identity`,()=>e.slots.register({name:`sidebar.session.row.identity`,id:`codexhost.harness`,inject:()=>({list:e.sessions.list})},Ru)),e.slots.inject(`conversation.header.notice`,()=>e.slots.register({name:`conversation.header.notice`,id:`codexhost.connection`,locale:Yf,inject:()=>({list:e.sessions.list,connection:e.get(`connection`)})},$u)),e.slots.inject(`conversation.composer.dock`,()=>e.slots.register({name:`conversation.composer.dock`,id:`codexhost.usage`,order:2,locale:Yf},yd)),e.effect(()=>e.remote.$on(`codexhost/session-bound`,(t,n)=>{(e.sessions.list.getSnapshot().byId[t]?.retainedBy.mainView??0)>0&&e.uiWorkspace.openSession(n)}),`ui-codexhost: canonical CH identity`),qu(),Ju(),e.effect(()=>Zu(e.get(`connection`).state),`ui-codexhost: enter sign-in when the token is revoked`),(()=>{let e=new URL(window.location.href),t=e.searchParams.get(`session`);t!==null&&(e.searchParams.delete(`session`),window.history.replaceState(null,``,`${e.pathname}${e.search}${e.hash}`),setTimeout(()=>{r.openSession(t)},600))})();let o=e=>{let t=e.data;t?.type===`codexhost/open-session`&&typeof t.sessionId==`string`&&r.openSession(t.sessionId)};`serviceWorker`in navigator&&(navigator.serviceWorker.addEventListener(`message`,o),e.effect(()=>()=>{navigator.serviceWorker.removeEventListener(`message`,o)},`ui-codexhost: service worker messages`))}return n.NS=Yf,n.PANEL_ID=Xf,n.apply=$f,n.inject=Zf,t.exports}});