@karlorz/codexhost-cli-win32-x64 0.18.0-0 → 0.19.0-0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/README.md +1 -1
  2. package/app/codexhost-distribution.json +1 -1
  3. package/app/console-server.mjs +317 -59
  4. package/app/console-web.js +1889 -141
  5. package/app/cpa-live-voice-hook.js +1938 -428
  6. package/app/desktop-controller.mjs +2081 -212
  7. package/app/host-runtime.mjs +14818 -3381
  8. package/app/overlay-voice-bootstrap.js +1616 -0
  9. package/app/plugins/antigravity/plugin.mjs +963 -324
  10. package/app/plugins/claude-code/plugin.mjs +395 -67
  11. package/app/plugins/codebuddy/plugin.mjs +409 -76
  12. package/app/plugins/codex-usage/plugin.mjs +316 -58
  13. package/app/plugins/copilot/plugin.mjs +316 -58
  14. package/app/plugins/cursor-cli/plugin.mjs +391 -68
  15. package/app/plugins/deepseek-harness/manifest.json +2 -2
  16. package/app/plugins/deepseek-harness/plugin.mjs +343 -63
  17. package/app/plugins/devin/plugin.mjs +316 -58
  18. package/app/plugins/grok/plugin.mjs +1350 -1026
  19. package/app/plugins/hermes/plugin.mjs +395 -70
  20. package/app/plugins/kimi-code/plugin.mjs +316 -58
  21. package/app/plugins/kiro-cli/plugin.mjs +544 -74
  22. package/app/plugins/omp/plugin.mjs +1264 -902
  23. package/app/plugins/opencode/plugin.mjs +316 -58
  24. package/app/plugins/pi/plugin.mjs +1189 -862
  25. package/app/plugins/qoder/plugin.mjs +318 -62
  26. package/app/plugins/qoder-cn/plugin.mjs +318 -62
  27. package/app/plugins/qwen-code/plugin.mjs +425 -150
  28. package/app/plugins/workbuddy/plugin.mjs +409 -76
  29. package/app/plugins/zcode/plugin.mjs +389 -61
  30. package/app/renderer-extension.js +11830 -8531
  31. package/app/voice-profile-pins.json +25 -0
  32. package/app/voice-qualification.json +4 -0
  33. package/app/web/assets/index-BCyiiDDL.js +199 -0
  34. package/app/web/assets/index-BNQIOOHE.css +1 -0
  35. package/app/web/codexhost-settings.js +1895 -190
  36. package/app/web/index.html +2 -2
  37. package/app/web/plugins/deepseek-ai__dsh-api-remotes/client.js +1 -1
  38. package/app/web/plugins/deepseek-ai__dsh-api-session-controller/client.js +69 -69
  39. package/app/web/plugins/deepseek-ai__dsh-client-file-upload/client.js +1 -1
  40. package/app/web/plugins/deepseek-ai__dsh-client-locale/client.js +3 -3
  41. package/app/web/plugins/deepseek-ai__dsh-client-ui-attachment/client.js +1 -1
  42. package/app/web/plugins/deepseek-ai__dsh-client-ui-chat/client.js +129 -8
  43. package/app/web/plugins/deepseek-ai__dsh-client-ui-codexhost/client.js +65 -63
  44. package/app/web/plugins/deepseek-ai__dsh-client-ui-conversation/client.js +95 -93
  45. package/app/web/plugins/deepseek-ai__dsh-client-ui-input-trigger/client.js +1 -1
  46. package/app/web/plugins/deepseek-ai__dsh-client-ui-layout/client.js +2 -2
  47. package/app/web/plugins/deepseek-ai__dsh-client-ui-model-selection/client.js +1 -1
  48. package/app/web/plugins/deepseek-ai__dsh-client-ui-settings-general/client.js +1 -1
  49. package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar-documentpreview/client.excel.js +1 -1
  50. package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar-files/client.js +1 -1
  51. package/app/web/plugins/deepseek-ai__dsh-client-ui-tool/client.js +79 -79
  52. package/app/web/plugins/deepseek-ai__dsh-client-ui-user-questions/client.js +1 -1
  53. package/app/web/plugins/deepseek-ai__dsh-client-ui-workspace/client.js +11 -11
  54. package/app/web-modules/server.mjs +3279 -1676
  55. package/bin/codexhost.exe +0 -0
  56. package/libexec/codexhost-node-repl.exe +0 -0
  57. package/libexec/codexhost-shim.exe +0 -0
  58. package/libexec/codexhost-updater.exe +0 -0
  59. package/package.json +1 -1
  60. package/app/web/assets/index-Bs17Kuah.js +0 -199
  61. package/app/web/assets/index-C3lniEH1.css +0 -1
@@ -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-ui-workspace/client"),o=e("@deepseek-ai/dsh-client-store"),s=e("react"),c=e("react-dom");var l;let u=/*@__PURE__*/ Object.freeze({status:`aborted`});function d(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 f=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},p=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(l=globalThis).__zod_globalConfig??(l.__zod_globalConfig={});let m=globalThis.__zod_globalConfig;function h(e){return e&&Object.assign(m,e),m}function g(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 _(e,t){return typeof t==`bigint`?t.toString():t}function v(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function y(e){return e==null}function b(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function x(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 S=/* @__PURE__*/ Symbol(`evaluating`);function C(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==S)return r===void 0&&(r=S,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function w(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function T(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function E(e){return JSON.stringify(e)}function D(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}let O=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function k(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}let ee=/* @__PURE__*/ v(()=>{if(m.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function A(e){if(k(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return k(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function j(e){return A(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}let te=/* @__PURE__*/ new Set([`string`,`number`,`symbol`]);function M(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function ne(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function N(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 ne(e,T(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 w(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 ne(e,T(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 w(this,`shape`,r),r},checks:[]}))}function se(e,t){if(!A(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 ne(e,T(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return w(this,`shape`,n),n}}))}function ce(e,t){if(!A(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return ne(e,T(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return w(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 ne(e,T(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return w(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 ne(t,T(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 w(this,`shape`,i),i},checks:[]}))}function de(e,t,n){return ne(t,T(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 w(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,_,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},be=d(`$ZodError`,ye),xe=d(`$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 f;if(o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>ge(e,a,h())));throw O(t,i?.callee),t}return o.value},Te=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,h())));throw O(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 f;return a.issues.length?{success:!1,error:new(e??be)(a.issues.map(e=>ge(e,i,h())))}:{success:!0,data:a.value}},De=/* @__PURE__*/ Ee(xe),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=>ge(e,i,h())))}:{success:!0,data:a.value}},ke=/* @__PURE__*/ Oe(xe),Ae=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return we(e)(t,n,i)},je=e=>(t,n,r)=>we(e)(t,n,r),Me=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Te(e)(t,n,i)},Ne=e=>async(t,n,r)=>Te(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__*/ d(`$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__*/ d(`$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__*/ d(`$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__*/ d(`$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):x(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__*/ d(`$ZodCheckNumberFormat`,(e,t)=>{ht.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=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__*/ d(`$ZodCheckMaxLength`,(e,t)=>{var n;ht.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!y(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})}}),St=/*@__PURE__*/ d(`$ZodCheckMinLength`,(e,t)=>{var n;ht.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!y(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})}}),Ct=/*@__PURE__*/ d(`$ZodCheckLengthEquals`,(e,t)=>{var n;ht.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!y(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})}}),wt=/*@__PURE__*/ d(`$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__*/ d(`$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__*/ d(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=pt,wt.init(e,t)}),Dt=/*@__PURE__*/ d(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=mt,wt.init(e,t)}),Ot=/*@__PURE__*/ d(`$ZodCheckIncludes`,(e,t)=>{ht.init(e,t);let n=M(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__*/ d(`$ZodCheckStartsWith`,(e,t)=>{ht.init(e,t);let n=RegExp(`^${M(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__*/ d(`$ZodCheckEndsWith`,(e,t)=>{ht.init(e,t);let n=RegExp(`.*${M(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__*/ d(`$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("react"),i=e("@deepseek-ai/dsh-client-ui-primitives"),a=e("react/jsx-runtime"),o=e("@deepseek-ai/dsh-client-ui-workspace/client"),s=e("@deepseek-ai/dsh-client-store"),c=e("react-dom");var l;let u=/*@__PURE__*/ Object.freeze({status:`aborted`});function d(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 f=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},p=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(l=globalThis).__zod_globalConfig??(l.__zod_globalConfig={});let m=globalThis.__zod_globalConfig;function h(e){return e&&Object.assign(m,e),m}function g(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 _(e,t){return typeof t==`bigint`?t.toString():t}function v(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function y(e){return e==null}function b(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function x(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 S=/* @__PURE__*/ Symbol(`evaluating`);function C(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==S)return r===void 0&&(r=S,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function w(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function T(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function E(e){return JSON.stringify(e)}function ee(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 te=/* @__PURE__*/ v(()=>{if(m.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function k(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 A(e){return k(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 j(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function re(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 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 re(e,T(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 w(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 re(e,T(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 w(this,`shape`,r),r},checks:[]}))}function ce(e,t){if(!k(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 re(e,T(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return w(this,`shape`,n),n}}))}function le(e,t){if(!k(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return re(e,T(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return w(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 re(e,T(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return w(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 re(t,T(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 w(this,`shape`,i),i},checks:[]}))}function fe(e,t,n){return re(t,T(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 w(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,_,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},xe=d(`$ZodError`,be),Se=d(`$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 f;if(o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>_e(e,a,h())));throw D(t,i?.callee),t}return o.value},Ee=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,h())));throw D(t,i?.callee),t}return o.value},De=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 f;return a.issues.length?{success:!1,error:new(e??xe)(a.issues.map(e=>_e(e,i,h())))}:{success:!0,data:a.value}},Oe=/* @__PURE__*/ De(Se),ke=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,h())))}:{success:!0,data:a.value}},Ae=/* @__PURE__*/ ke(Se),je=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Te(e)(t,n,i)},Me=e=>(t,n,r)=>Te(e)(t,n,r),Ne=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Ee(e)(t,n,i)},Pe=e=>async(t,n,r)=>Ee(e)(t,n,r),Fe=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return De(e)(t,n,i)},Ie=e=>(t,n,r)=>De(e)(t,n,r),Le=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return ke(e)(t,n,i)},Re=e=>async(t,n,r)=>ke(e)(t,n,r),ze=/^[cC][0-9a-z]{6,}$/,Be=/^[0-9a-z]+$/,Ve=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,He=/^[0-9a-vA-V]{20}$/,Ue=/^[A-Za-z0-9]{27}$/,We=/^[a-zA-Z0-9_-]{21}$/,Ge=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Ke=/^([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})$/,qe=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)$/,Je=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;function Ye(){return RegExp(`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,`u`)}let 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])$/,Ze=/^(([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}|:))$/,Qe=/^((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])$/,$e=/^(([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])$/,et=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,tt=/^[A-Za-z0-9_-]*$/,nt=/^https?$/,rt=/^\+[1-9]\d{6,14}$/,it=`(?:(?:\\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])))`,at=/*@__PURE__*/ RegExp(`^${it}$`);function ot(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 st(e){return RegExp(`^${ot(e)}$`)}function ct(e){let t=ot({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(`^${it}T(?:${r})$`)}let lt=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},ut=/^-?\d+$/,dt=/^-?\d+(?:\.\d+)?$/,ft=/^(?:true|false)$/i,pt=/^null$/i,mt=/^[^A-Z]*$/,ht=/^[^a-z]*$/,gt=/*@__PURE__*/ d(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),_t={number:`number`,bigint:`bigint`,object:`date`},vt=/*@__PURE__*/ d(`$ZodCheckLessThan`,(e,t)=>{gt.init(e,t);let n=_t[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})}}),yt=/*@__PURE__*/ d(`$ZodCheckGreaterThan`,(e,t)=>{gt.init(e,t);let n=_t[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})}}),bt=/*@__PURE__*/ d(`$ZodCheckMultipleOf`,(e,t)=>{gt.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):x(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})}}),xt=/*@__PURE__*/ d(`$ZodCheckNumberFormat`,(e,t)=>{gt.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=ut)}),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})}}),St=/*@__PURE__*/ d(`$ZodCheckMaxLength`,(e,t)=>{var n;gt.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!y(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})}}),Ct=/*@__PURE__*/ d(`$ZodCheckMinLength`,(e,t)=>{var n;gt.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!y(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})}}),wt=/*@__PURE__*/ d(`$ZodCheckLengthEquals`,(e,t)=>{var n;gt.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!y(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})}}),Tt=/*@__PURE__*/ d(`$ZodCheckStringFormat`,(e,t)=>{var n,r;gt.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=()=>{})}),Et=/*@__PURE__*/ d(`$ZodCheckRegex`,(e,t)=>{Tt.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})}}),Dt=/*@__PURE__*/ d(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=mt,Tt.init(e,t)}),Ot=/*@__PURE__*/ d(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=ht,Tt.init(e,t)}),kt=/*@__PURE__*/ d(`$ZodCheckIncludes`,(e,t)=>{gt.init(e,t);let n=j(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})}}),At=/*@__PURE__*/ d(`$ZodCheckStartsWith`,(e,t)=>{gt.init(e,t);let n=RegExp(`^${j(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})}}),jt=/*@__PURE__*/ d(`$ZodCheckEndsWith`,(e,t)=>{gt.init(e,t);let n=RegExp(`.*${j(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})}}),Mt=/*@__PURE__*/ d(`$ZodCheckOverwrite`,(e,t)=>{gt.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});var Nt=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},P=/*@__PURE__*/ d(`$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=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 f;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 f;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 f;return o.then(e=>t(e,r,a))}return t(o,r,a)}}C(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__*/ d(`$ZodString`,(e,t)=>{P.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}}),F=/*@__PURE__*/ d(`$ZodStringFormat`,(e,t)=>{wt.init(e,t),Pt.init(e,t)}),Ft=/*@__PURE__*/ d(`$ZodGUID`,(e,t)=>{t.pattern??=Ge,F.init(e,t)}),It=/*@__PURE__*/ d(`$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();F.init(e,t)}),Lt=/*@__PURE__*/ d(`$ZodEmail`,(e,t)=>{t.pattern??=qe,F.init(e,t)}),Rt=/*@__PURE__*/ d(`$ZodURL`,(e,t)=>{F.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__*/ d(`$ZodEmoji`,(e,t)=>{t.pattern??=Je(),F.init(e,t)}),Bt=/*@__PURE__*/ d(`$ZodNanoID`,(e,t)=>{t.pattern??=Ue,F.init(e,t)}),Vt=/*@__PURE__*/ d(`$ZodCUID`,(e,t)=>{t.pattern??=Re,F.init(e,t)}),Ht=/*@__PURE__*/ d(`$ZodCUID2`,(e,t)=>{t.pattern??=ze,F.init(e,t)}),Ut=/*@__PURE__*/ d(`$ZodULID`,(e,t)=>{t.pattern??=Be,F.init(e,t)}),Wt=/*@__PURE__*/ d(`$ZodXID`,(e,t)=>{t.pattern??=Ve,F.init(e,t)}),Gt=/*@__PURE__*/ d(`$ZodKSUID`,(e,t)=>{t.pattern??=He,F.init(e,t)}),Kt=/*@__PURE__*/ d(`$ZodISODateTime`,(e,t)=>{t.pattern??=st(t),F.init(e,t)}),qt=/*@__PURE__*/ d(`$ZodISODate`,(e,t)=>{t.pattern??=it,F.init(e,t)}),Jt=/*@__PURE__*/ d(`$ZodISOTime`,(e,t)=>{t.pattern??=ot(t),F.init(e,t)}),Yt=/*@__PURE__*/ d(`$ZodISODuration`,(e,t)=>{t.pattern??=We,F.init(e,t)}),Xt=/*@__PURE__*/ d(`$ZodIPv4`,(e,t)=>{t.pattern??=Ye,F.init(e,t),e._zod.bag.format=`ipv4`}),Zt=/*@__PURE__*/ d(`$ZodIPv6`,(e,t)=>{t.pattern??=Xe,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})}}}),Qt=/*@__PURE__*/ d(`$ZodCIDRv4`,(e,t)=>{t.pattern??=Ze,F.init(e,t)}),$t=/*@__PURE__*/ d(`$ZodCIDRv6`,(e,t)=>{t.pattern??=Qe,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 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__*/ d(`$ZodBase64`,(e,t)=>{t.pattern??=$e,F.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__*/ d(`$ZodBase64URL`,(e,t)=>{t.pattern??=et,F.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__*/ d(`$ZodE164`,(e,t)=>{t.pattern??=nt,F.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__*/ d(`$ZodJWT`,(e,t)=>{F.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__*/ d(`$ZodNumber`,(e,t)=>{P.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__*/ d(`$ZodNumberFormat`,(e,t)=>{bt.init(e,t),cn.init(e,t)}),un=/*@__PURE__*/ d(`$ZodBoolean`,(e,t)=>{P.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__*/ d(`$ZodNull`,(e,t)=>{P.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__*/ d(`$ZodUnknown`,(e,t)=>{P.init(e,t),e._zod.parse=e=>e}),pn=/*@__PURE__*/ d(`$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 mn(e,t,n){e.issues.length&&t.issues.push(...me(n,e.issues)),t.value[n]=e.value}let hn=/*@__PURE__*/ d(`$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=>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(...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 _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=re(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__*/ d(`$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=v(()=>_n(t));C(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=k,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__*/ d(`$ZodObjectJIT`,(e,t)=>{yn.init(e,t);let n=e._zod.parse,r=v(()=>_n(t)),i=e=>{let t=new Mt([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=E(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=E(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 Pt={major:4,minor:4,patch:3},N=/*@__PURE__*/ d(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Pt;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 f;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 f;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 f;return o.then(e=>t(e,r,a))}return t(o,r,a)}}C(e,`~standard`,()=>({validate:t=>{try{let n=Oe(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return Ae(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),Ft=/*@__PURE__*/ d(`$ZodString`,(e,t)=>{N.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??lt(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__*/ d(`$ZodStringFormat`,(e,t)=>{Tt.init(e,t),Ft.init(e,t)}),It=/*@__PURE__*/ d(`$ZodGUID`,(e,t)=>{t.pattern??=Ke,P.init(e,t)}),Lt=/*@__PURE__*/ d(`$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??=qe(e)}else t.pattern??=qe();P.init(e,t)}),Rt=/*@__PURE__*/ d(`$ZodEmail`,(e,t)=>{t.pattern??=Je,P.init(e,t)}),zt=/*@__PURE__*/ d(`$ZodURL`,(e,t)=>{P.init(e,t),e._zod.check=n=>{try{let r=n.value.trim();if(!t.normalize&&t.protocol?.source===nt.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})}}}),Bt=/*@__PURE__*/ d(`$ZodEmoji`,(e,t)=>{t.pattern??=Ye(),P.init(e,t)}),Vt=/*@__PURE__*/ d(`$ZodNanoID`,(e,t)=>{t.pattern??=We,P.init(e,t)}),Ht=/*@__PURE__*/ d(`$ZodCUID`,(e,t)=>{t.pattern??=ze,P.init(e,t)}),Ut=/*@__PURE__*/ d(`$ZodCUID2`,(e,t)=>{t.pattern??=Be,P.init(e,t)}),Wt=/*@__PURE__*/ d(`$ZodULID`,(e,t)=>{t.pattern??=Ve,P.init(e,t)}),Gt=/*@__PURE__*/ d(`$ZodXID`,(e,t)=>{t.pattern??=He,P.init(e,t)}),Kt=/*@__PURE__*/ d(`$ZodKSUID`,(e,t)=>{t.pattern??=Ue,P.init(e,t)}),qt=/*@__PURE__*/ d(`$ZodISODateTime`,(e,t)=>{t.pattern??=ct(t),P.init(e,t)}),Jt=/*@__PURE__*/ d(`$ZodISODate`,(e,t)=>{t.pattern??=at,P.init(e,t)}),Yt=/*@__PURE__*/ d(`$ZodISOTime`,(e,t)=>{t.pattern??=st(t),P.init(e,t)}),Xt=/*@__PURE__*/ d(`$ZodISODuration`,(e,t)=>{t.pattern??=Ge,P.init(e,t)}),Zt=/*@__PURE__*/ d(`$ZodIPv4`,(e,t)=>{t.pattern??=Xe,P.init(e,t),e._zod.bag.format=`ipv4`}),Qt=/*@__PURE__*/ d(`$ZodIPv6`,(e,t)=>{t.pattern??=Ze,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})}}}),$t=/*@__PURE__*/ d(`$ZodCIDRv4`,(e,t)=>{t.pattern??=Qe,P.init(e,t)}),en=/*@__PURE__*/ d(`$ZodCIDRv6`,(e,t)=>{t.pattern??=$e,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 tn(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}let nn=/*@__PURE__*/ d(`$ZodBase64`,(e,t)=>{t.pattern??=et,P.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{tn(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function rn(e){if(!tt.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return tn(t.padEnd(Math.ceil(t.length/4)*4,`=`))}let an=/*@__PURE__*/ d(`$ZodBase64URL`,(e,t)=>{t.pattern??=tt,P.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{rn(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),on=/*@__PURE__*/ d(`$ZodE164`,(e,t)=>{t.pattern??=rt,P.init(e,t)});function sn(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 cn=/*@__PURE__*/ d(`$ZodJWT`,(e,t)=>{P.init(e,t),e._zod.check=n=>{sn(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),ln=/*@__PURE__*/ d(`$ZodNumber`,(e,t)=>{N.init(e,t),e._zod.pattern=e._zod.bag.pattern??dt,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}}),un=/*@__PURE__*/ d(`$ZodNumberFormat`,(e,t)=>{xt.init(e,t),ln.init(e,t)}),dn=/*@__PURE__*/ d(`$ZodBoolean`,(e,t)=>{N.init(e,t),e._zod.pattern=ft,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}}),fn=/*@__PURE__*/ d(`$ZodNull`,(e,t)=>{N.init(e,t),e._zod.pattern=pt,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}}),pn=/*@__PURE__*/ d(`$ZodUnknown`,(e,t)=>{N.init(e,t),e._zod.parse=e=>e}),mn=/*@__PURE__*/ d(`$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 hn(e,t,n){e.issues.length&&t.issues.push(...he(n,e.issues)),t.value[n]=e.value}let gn=/*@__PURE__*/ d(`$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=>hn(t,n,e))):hn(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function _n(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 vn(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 yn(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=>_n(e,n,i,t,u,d))):_n(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 bn=/*@__PURE__*/ d(`$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=v(()=>vn(t));C(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=>_n(n,t,e,s,r,i))):_n(a,t,e,s,r,i)}return i?yn(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),xn=/*@__PURE__*/ d(`$ZodObjectJIT`,(e,t)=>{bn.init(e,t);let n=e._zod.parse,r=v(()=>vn(t)),i=e=>{let t=new Nt([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=E(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=E(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,65 +59,67 @@ 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=k,s=!m.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=>!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,h())))}),t)}let Sn=/*@__PURE__*/ d(`$ZodUnion`,(e,t)=>{P.init(e,t),C(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),C(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),C(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),C(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=>b(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__*/ d(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,Sn.init(e,t);let n=e._zod.parse;C(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=v(()=>{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(!k(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__*/ d(`$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])=>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(A(e)&&A(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}),fe(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__*/ d(`$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=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(...me(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(...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 jn=/*@__PURE__*/ d(`$ZodRecord`,(e,t)=>{P.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!A(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,h())),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`&&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=>ge(e,r,h())),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}}),Mn=/*@__PURE__*/ d(`$ZodEnum`,(e,t)=>{P.init(e,t);let n=g(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>te.has(typeof e)).map(e=>typeof e==`string`?M(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__*/ d(`$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`?M(e):e?M(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__*/ d(`$ZodTransform`,(e,t)=>{P.init(e,t),e._zod.optin=`optional`,e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new p(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 f;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__*/ d(`$ZodOptional`,(e,t)=>{P.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,C(e._zod,`values`,()=>t.innerType._zod.values?/* @__PURE__ */ new Set([...t.innerType._zod.values,void 0]):void 0),C(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${b(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__*/ d(`$ZodExactOptional`,(e,t)=>{In.init(e,t),C(e._zod,`values`,()=>t.innerType._zod.values),C(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Rn=/*@__PURE__*/ d(`$ZodNullable`,(e,t)=>{P.init(e,t),C(e._zod,`optin`,()=>t.innerType._zod.optin),C(e._zod,`optout`,()=>t.innerType._zod.optout),C(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${b(e.source)}|null)$`):void 0}),C(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__*/ d(`$ZodDefault`,(e,t)=>{P.init(e,t),e._zod.optin=`optional`,C(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__*/ d(`$ZodPrefault`,(e,t)=>{P.init(e,t),e._zod.optin=`optional`,C(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__*/ d(`$ZodNonOptional`,(e,t)=>{P.init(e,t),C(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__*/ d(`$ZodCatch`,(e,t)=>{P.init(e,t),e._zod.optin=`optional`,C(e._zod,`optout`,()=>t.innerType._zod.optout),C(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,h()))},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,h()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),Gn=/*@__PURE__*/ d(`$ZodPipe`,(e,t)=>{P.init(e,t),C(e._zod,`values`,()=>t.in._zod.values),C(e._zod,`optin`,()=>t.in._zod.optin),C(e._zod,`optout`,()=>t.out._zod.optout),C(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__*/ d(`$ZodReadonly`,(e,t)=>{P.init(e,t),C(e._zod,`propValues`,()=>t.innerType._zod.propValues),C(e._zod,`values`,()=>t.innerType._zod.values),C(e._zod,`optin`,()=>t.innerType?._zod?.optin),C(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__*/ d(`$ZodLazy`,(e,t)=>{P.init(e,t),C(e._zod,`innerType`,()=>{let e=t;return e._cachedInner||=t.getter(),e._cachedInner}),C(e._zod,`pattern`,()=>e._zod.innerType?._zod?.pattern),C(e._zod,`propValues`,()=>e._zod.innerType?._zod?.propValues),C(e._zod,`optin`,()=>e._zod.innerType?._zod?.optin??void 0),C(e._zod,`optout`,()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),Xn=/*@__PURE__*/ d(`$ZodCustom`,(e,t)=>{ht.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=>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(ve(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`,...N(t)})}// @__NO_SIDE_EFFECTS__
64
- function rr(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...N(t)})}// @__NO_SIDE_EFFECTS__
65
- function ir(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...N(t)})}// @__NO_SIDE_EFFECTS__
66
- function ar(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...N(t)})}// @__NO_SIDE_EFFECTS__
67
- function or(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...N(t)})}// @__NO_SIDE_EFFECTS__
68
- function sr(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...N(t)})}// @__NO_SIDE_EFFECTS__
69
- function cr(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...N(t)})}// @__NO_SIDE_EFFECTS__
70
- function lr(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...N(t)})}// @__NO_SIDE_EFFECTS__
71
- function ur(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...N(t)})}// @__NO_SIDE_EFFECTS__
72
- function dr(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...N(t)})}// @__NO_SIDE_EFFECTS__
73
- function fr(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...N(t)})}// @__NO_SIDE_EFFECTS__
74
- function pr(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...N(t)})}// @__NO_SIDE_EFFECTS__
75
- function mr(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...N(t)})}// @__NO_SIDE_EFFECTS__
76
- function hr(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...N(t)})}// @__NO_SIDE_EFFECTS__
77
- function gr(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...N(t)})}// @__NO_SIDE_EFFECTS__
78
- function _r(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...N(t)})}// @__NO_SIDE_EFFECTS__
79
- function vr(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...N(t)})}// @__NO_SIDE_EFFECTS__
80
- function yr(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...N(t)})}// @__NO_SIDE_EFFECTS__
81
- function br(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...N(t)})}// @__NO_SIDE_EFFECTS__
82
- function xr(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...N(t)})}// @__NO_SIDE_EFFECTS__
83
- function Sr(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...N(t)})}// @__NO_SIDE_EFFECTS__
84
- function Cr(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...N(t)})}// @__NO_SIDE_EFFECTS__
85
- function wr(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...N(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,...N(t)})}// @__NO_SIDE_EFFECTS__
87
- function Er(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...N(t)})}// @__NO_SIDE_EFFECTS__
88
- function Dr(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...N(t)})}// @__NO_SIDE_EFFECTS__
89
- function Or(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...N(t)})}// @__NO_SIDE_EFFECTS__
90
- function kr(e,t){return new e({type:`number`,checks:[],...N(t)})}// @__NO_SIDE_EFFECTS__
91
- function Ar(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...N(t)})}// @__NO_SIDE_EFFECTS__
92
- function jr(e,t){return new e({type:`boolean`,...N(t)})}// @__NO_SIDE_EFFECTS__
93
- function Mr(e,t){return new e({type:`null`,...N(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`,...N(t)})}// @__NO_SIDE_EFFECTS__
96
- function Fr(e,t){return new _t({check:`less_than`,...N(t),value:e,inclusive:!1})}// @__NO_SIDE_EFFECTS__
97
- function Ir(e,t){return new _t({check:`less_than`,...N(t),value:e,inclusive:!0})}// @__NO_SIDE_EFFECTS__
98
- function Lr(e,t){return new vt({check:`greater_than`,...N(t),value:e,inclusive:!1})}// @__NO_SIDE_EFFECTS__
99
- function Rr(e,t){return new vt({check:`greater_than`,...N(t),value:e,inclusive:!0})}// @__NO_SIDE_EFFECTS__
100
- function zr(e,t){return new yt({check:`multiple_of`,...N(t),value:e})}// @__NO_SIDE_EFFECTS__
101
- function Br(e,t){return new xt({check:`max_length`,...N(t),maximum:e})}// @__NO_SIDE_EFFECTS__
102
- function Vr(e,t){return new St({check:`min_length`,...N(t),minimum:e})}// @__NO_SIDE_EFFECTS__
103
- function Hr(e,t){return new Ct({check:`length_equals`,...N(t),length:e})}// @__NO_SIDE_EFFECTS__
104
- function Ur(e,t){return new Tt({check:`string_format`,format:`regex`,...N(t),pattern:e})}// @__NO_SIDE_EFFECTS__
105
- function Wr(e){return new Et({check:`string_format`,format:`lowercase`,...N(e)})}// @__NO_SIDE_EFFECTS__
106
- function Gr(e){return new Dt({check:`string_format`,format:`uppercase`,...N(e)})}// @__NO_SIDE_EFFECTS__
107
- function Kr(e,t){return new Ot({check:`string_format`,format:`includes`,...N(t),includes:e})}// @__NO_SIDE_EFFECTS__
108
- function qr(e,t){return new kt({check:`string_format`,format:`starts_with`,...N(t),prefix:e})}// @__NO_SIDE_EFFECTS__
109
- function Jr(e,t){return new At({check:`string_format`,format:`ends_with`,...N(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=>D(e))}// @__NO_SIDE_EFFECTS__
116
- function ti(e,t,n){return new e({type:`array`,element:t,...N(n)})}// @__NO_SIDE_EFFECTS__
117
- function ni(e,t,n){let r=N(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,...N(n)})}// @__NO_SIDE_EFFECTS__
119
- function ii(e,t){let n=/* @__PURE__ */ ai(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 ai(e,t){let n=new ht({check:`custom`,...N(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 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`&&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=!m.jitless,c=s&&te.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?yn([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function Sn(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,h())))}),t)}let Cn=/*@__PURE__*/ d(`$ZodUnion`,(e,t)=>{N.init(e,t),C(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),C(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),C(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),C(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=>b(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=>Sn(t,r,e,i)):Sn(o,r,e,i)}}),wn=/*@__PURE__*/ d(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,Cn.init(e,t);let n=e._zod.parse;C(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=v(()=>{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)}}),Tn=/*@__PURE__*/ d(`$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])=>Dn(e,t,n)):Dn(e,i,a)}});function En(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(k(e)&&k(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=En(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=En(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 Dn(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=En(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}let On=/*@__PURE__*/ d(`$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=kn(n,`optin`),c=kn(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=>An(t,r,e))):An(a,r,e)}}return o.length?Promise.all(o).then(()=>jn(l,r,n,a,c)):jn(l,r,n,a,c)}});function kn(e,t){for(let n=e.length-1;n>=0;n--)if(e[n]._zod[t]!==`optional`)return n+1;return 0}function An(e,t,n){e.issues.length&&t.issues.push(...he(n,e.issues)),t.value[n]=e.value}function jn(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 Mn=/*@__PURE__*/ d(`$ZodRecord`,(e,t)=>{N.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!k(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,h())),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`&&dt.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,h())),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}}),Nn=/*@__PURE__*/ d(`$ZodEnum`,(e,t)=>{N.init(e,t);let n=g(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`?j(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}}),Pn=/*@__PURE__*/ d(`$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`?j(e):e?j(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}}),Fn=/*@__PURE__*/ d(`$ZodTransform`,(e,t)=>{N.init(e,t),e._zod.optin=`optional`,e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new p(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 f;return n.value=i,n.fallback=!0,n}});function In(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}let Ln=/*@__PURE__*/ d(`$ZodOptional`,(e,t)=>{N.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,C(e._zod,`values`,()=>t.innerType._zod.values?/* @__PURE__ */ new Set([...t.innerType._zod.values,void 0]):void 0),C(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${b(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=>In(e,r)):In(i,r)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),Rn=/*@__PURE__*/ d(`$ZodExactOptional`,(e,t)=>{Ln.init(e,t),C(e._zod,`values`,()=>t.innerType._zod.values),C(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),zn=/*@__PURE__*/ d(`$ZodNullable`,(e,t)=>{N.init(e,t),C(e._zod,`optin`,()=>t.innerType._zod.optin),C(e._zod,`optout`,()=>t.innerType._zod.optout),C(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${b(e.source)}|null)$`):void 0}),C(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)}),Bn=/*@__PURE__*/ d(`$ZodDefault`,(e,t)=>{N.init(e,t),e._zod.optin=`optional`,C(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=>Vn(e,t)):Vn(r,t)}});function Vn(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}let Hn=/*@__PURE__*/ d(`$ZodPrefault`,(e,t)=>{N.init(e,t),e._zod.optin=`optional`,C(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))}),Un=/*@__PURE__*/ d(`$ZodNonOptional`,(e,t)=>{N.init(e,t),C(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=>Wn(t,e)):Wn(i,e)}});function Wn(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 Gn=/*@__PURE__*/ d(`$ZodCatch`,(e,t)=>{N.init(e,t),e._zod.optin=`optional`,C(e._zod,`optout`,()=>t.innerType._zod.optout),C(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,h()))},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,h()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),Kn=/*@__PURE__*/ d(`$ZodPipe`,(e,t)=>{N.init(e,t),C(e._zod,`values`,()=>t.in._zod.values),C(e._zod,`optin`,()=>t.in._zod.optin),C(e._zod,`optout`,()=>t.out._zod.optout),C(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=>qn(e,t.in,n)):qn(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>qn(e,t.out,n)):qn(r,t.out,n)}});function qn(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 Jn=/*@__PURE__*/ d(`$ZodReadonly`,(e,t)=>{N.init(e,t),C(e._zod,`propValues`,()=>t.innerType._zod.propValues),C(e._zod,`values`,()=>t.innerType._zod.values),C(e._zod,`optin`,()=>t.innerType?._zod?.optin),C(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(Yn):Yn(r)}});function Yn(e){return e.value=Object.freeze(e.value),e}let Xn=/*@__PURE__*/ d(`$ZodLazy`,(e,t)=>{N.init(e,t),C(e._zod,`innerType`,()=>{let e=t;return e._cachedInner||=t.getter(),e._cachedInner}),C(e._zod,`pattern`,()=>e._zod.innerType?._zod?.pattern),C(e._zod,`propValues`,()=>e._zod.innerType?._zod?.propValues),C(e._zod,`optin`,()=>e._zod.innerType?._zod?.optin??void 0),C(e._zod,`optout`,()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),Zn=/*@__PURE__*/ d(`$ZodCustom`,(e,t)=>{gt.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=>Qn(t,n,r,e));Qn(i,n,r,e)}});function Qn(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 $n,er=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 tr(){return new er}($n=globalThis).__zod_globalRegistry??($n.__zod_globalRegistry=tr());let nr=globalThis.__zod_globalRegistry;// @__NO_SIDE_EFFECTS__
63
+ function rr(e,t){return new e({type:`string`,...M(t)})}// @__NO_SIDE_EFFECTS__
64
+ function ir(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...M(t)})}// @__NO_SIDE_EFFECTS__
65
+ function ar(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...M(t)})}// @__NO_SIDE_EFFECTS__
66
+ function or(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...M(t)})}// @__NO_SIDE_EFFECTS__
67
+ function sr(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...M(t)})}// @__NO_SIDE_EFFECTS__
68
+ function cr(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...M(t)})}// @__NO_SIDE_EFFECTS__
69
+ function lr(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...M(t)})}// @__NO_SIDE_EFFECTS__
70
+ function ur(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...M(t)})}// @__NO_SIDE_EFFECTS__
71
+ function dr(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...M(t)})}// @__NO_SIDE_EFFECTS__
72
+ function fr(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...M(t)})}// @__NO_SIDE_EFFECTS__
73
+ function pr(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...M(t)})}// @__NO_SIDE_EFFECTS__
74
+ function mr(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...M(t)})}// @__NO_SIDE_EFFECTS__
75
+ function hr(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...M(t)})}// @__NO_SIDE_EFFECTS__
76
+ function gr(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...M(t)})}// @__NO_SIDE_EFFECTS__
77
+ function _r(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...M(t)})}// @__NO_SIDE_EFFECTS__
78
+ function vr(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...M(t)})}// @__NO_SIDE_EFFECTS__
79
+ function yr(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...M(t)})}// @__NO_SIDE_EFFECTS__
80
+ function br(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...M(t)})}// @__NO_SIDE_EFFECTS__
81
+ function xr(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...M(t)})}// @__NO_SIDE_EFFECTS__
82
+ function Sr(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...M(t)})}// @__NO_SIDE_EFFECTS__
83
+ function Cr(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...M(t)})}// @__NO_SIDE_EFFECTS__
84
+ function wr(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...M(t)})}// @__NO_SIDE_EFFECTS__
85
+ function Tr(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...M(t)})}// @__NO_SIDE_EFFECTS__
86
+ function Er(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 Dr(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...M(t)})}// @__NO_SIDE_EFFECTS__
88
+ function Or(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...M(t)})}// @__NO_SIDE_EFFECTS__
89
+ function kr(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...M(t)})}// @__NO_SIDE_EFFECTS__
90
+ function Ar(e,t){return new e({type:`number`,checks:[],...M(t)})}// @__NO_SIDE_EFFECTS__
91
+ function jr(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...M(t)})}// @__NO_SIDE_EFFECTS__
92
+ function Mr(e,t){return new e({type:`boolean`,...M(t)})}// @__NO_SIDE_EFFECTS__
93
+ function Nr(e,t){return new e({type:`null`,...M(t)})}// @__NO_SIDE_EFFECTS__
94
+ function Pr(e){return new e({type:`unknown`})}// @__NO_SIDE_EFFECTS__
95
+ function Fr(e,t){return new e({type:`never`,...M(t)})}// @__NO_SIDE_EFFECTS__
96
+ function Ir(e,t){return new vt({check:`less_than`,...M(t),value:e,inclusive:!1})}// @__NO_SIDE_EFFECTS__
97
+ function Lr(e,t){return new vt({check:`less_than`,...M(t),value:e,inclusive:!0})}// @__NO_SIDE_EFFECTS__
98
+ function Rr(e,t){return new yt({check:`greater_than`,...M(t),value:e,inclusive:!1})}// @__NO_SIDE_EFFECTS__
99
+ function zr(e,t){return new yt({check:`greater_than`,...M(t),value:e,inclusive:!0})}// @__NO_SIDE_EFFECTS__
100
+ function Br(e,t){return new bt({check:`multiple_of`,...M(t),value:e})}// @__NO_SIDE_EFFECTS__
101
+ function Vr(e,t){return new St({check:`max_length`,...M(t),maximum:e})}// @__NO_SIDE_EFFECTS__
102
+ function Hr(e,t){return new Ct({check:`min_length`,...M(t),minimum:e})}// @__NO_SIDE_EFFECTS__
103
+ function Ur(e,t){return new wt({check:`length_equals`,...M(t),length:e})}// @__NO_SIDE_EFFECTS__
104
+ function Wr(e,t){return new Et({check:`string_format`,format:`regex`,...M(t),pattern:e})}// @__NO_SIDE_EFFECTS__
105
+ function Gr(e){return new Dt({check:`string_format`,format:`lowercase`,...M(e)})}// @__NO_SIDE_EFFECTS__
106
+ function Kr(e){return new Ot({check:`string_format`,format:`uppercase`,...M(e)})}// @__NO_SIDE_EFFECTS__
107
+ function qr(e,t){return new kt({check:`string_format`,format:`includes`,...M(t),includes:e})}// @__NO_SIDE_EFFECTS__
108
+ function Jr(e,t){return new At({check:`string_format`,format:`starts_with`,...M(t),prefix:e})}// @__NO_SIDE_EFFECTS__
109
+ function Yr(e,t){return new jt({check:`string_format`,format:`ends_with`,...M(t),suffix:e})}// @__NO_SIDE_EFFECTS__
110
+ function Xr(e){return new Mt({check:`overwrite`,tx:e})}// @__NO_SIDE_EFFECTS__
111
+ function Zr(e){return/* @__PURE__ */ Xr(t=>t.normalize(e))}// @__NO_SIDE_EFFECTS__
112
+ function Qr(){return/* @__PURE__ */ Xr(e=>e.trim())}// @__NO_SIDE_EFFECTS__
113
+ function $r(){return/* @__PURE__ */ Xr(e=>e.toLowerCase())}// @__NO_SIDE_EFFECTS__
114
+ function ei(){return/* @__PURE__ */ Xr(e=>e.toUpperCase())}// @__NO_SIDE_EFFECTS__
115
+ function ti(){return/* @__PURE__ */ Xr(e=>ee(e))}// @__NO_SIDE_EFFECTS__
116
+ function ni(e,t,n){return new e({type:`array`,element:t,...M(n)})}// @__NO_SIDE_EFFECTS__
117
+ function ri(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 ii(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...M(n)})}// @__NO_SIDE_EFFECTS__
119
+ function ai(e,t){let n=/* @__PURE__ */ oi(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 oi(e,t){let n=new gt({check:`custom`,...M(t)});return n._zod.check=e,n}function si(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??nr,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`&&ui(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 ci(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 I(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 I(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=g(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=I(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]=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)},wi=(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},Ti=(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]]},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)=>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)},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=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)}},Oi=(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`}]},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},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,n.default=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,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},Mi=(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},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;I(o,t,r);let s=t.seen.get(e);s.ref=o},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,n.readOnly=!0},Fi=(e,t,n,r)=>{let i=e._zod.def;I(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Ii=(e,t,n,r)=>{let i=e._zod.innerType;I(i,t,r);let a=t.seen.get(e);a.ref=i},Li=/*@__PURE__*/ d(`ZodISODateTime`,(e,t)=>{Kt.init(e,t),z.init(e,t)});function Ri(e){return/* @__PURE__ */ Tr(Li,e)}let zi=/*@__PURE__*/ d(`ZodISODate`,(e,t)=>{qt.init(e,t),z.init(e,t)});function Bi(e){return/* @__PURE__ */ Er(zi,e)}let Vi=/*@__PURE__*/ d(`ZodISOTime`,(e,t)=>{Jt.init(e,t),z.init(e,t)});function Hi(e){return/* @__PURE__ */ Dr(Vi,e)}let Ui=/*@__PURE__*/ d(`ZodISODuration`,(e,t)=>{Yt.init(e,t),z.init(e,t)});function Wi(e){return/* @__PURE__ */ Or(Ui,e)}let Gi=/*@__PURE__*/ d(`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,_,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,_,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),Ki=/* @__PURE__ */ we(Gi),qi=/* @__PURE__ */ Te(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 L=/*@__PURE__*/ d(`ZodType`,(e,t)=>(P.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(T(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 ne(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 H(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__*/ d(`_ZodString`,(e,t)=>{Pt.init(e,t),L.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__*/ d(`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 R(e){return/* @__PURE__ */ nr(sa,e)}let z=/*@__PURE__*/ d(`ZodStringFormat`,(e,t)=>{F.init(e,t),oa.init(e,t)}),ca=/*@__PURE__*/ d(`ZodEmail`,(e,t)=>{Lt.init(e,t),z.init(e,t)}),la=/*@__PURE__*/ d(`ZodGUID`,(e,t)=>{Ft.init(e,t),z.init(e,t)}),ua=/*@__PURE__*/ d(`ZodUUID`,(e,t)=>{It.init(e,t),z.init(e,t)}),da=/*@__PURE__*/ d(`ZodURL`,(e,t)=>{Rt.init(e,t),z.init(e,t)});function fa(e){return/* @__PURE__ */ lr(da,e)}let pa=/*@__PURE__*/ d(`ZodEmoji`,(e,t)=>{zt.init(e,t),z.init(e,t)}),ma=/*@__PURE__*/ d(`ZodNanoID`,(e,t)=>{Bt.init(e,t),z.init(e,t)}),ha=/*@__PURE__*/ d(`ZodCUID`,(e,t)=>{Vt.init(e,t),z.init(e,t)}),ga=/*@__PURE__*/ d(`ZodCUID2`,(e,t)=>{Ht.init(e,t),z.init(e,t)}),_a=/*@__PURE__*/ d(`ZodULID`,(e,t)=>{Ut.init(e,t),z.init(e,t)}),va=/*@__PURE__*/ d(`ZodXID`,(e,t)=>{Wt.init(e,t),z.init(e,t)}),ya=/*@__PURE__*/ d(`ZodKSUID`,(e,t)=>{Gt.init(e,t),z.init(e,t)}),ba=/*@__PURE__*/ d(`ZodIPv4`,(e,t)=>{Xt.init(e,t),z.init(e,t)}),xa=/*@__PURE__*/ d(`ZodIPv6`,(e,t)=>{Zt.init(e,t),z.init(e,t)}),Sa=/*@__PURE__*/ d(`ZodCIDRv4`,(e,t)=>{Qt.init(e,t),z.init(e,t)}),Ca=/*@__PURE__*/ d(`ZodCIDRv6`,(e,t)=>{$t.init(e,t),z.init(e,t)}),wa=/*@__PURE__*/ d(`ZodBase64`,(e,t)=>{tn.init(e,t),z.init(e,t)}),Ta=/*@__PURE__*/ d(`ZodBase64URL`,(e,t)=>{rn.init(e,t),z.init(e,t)}),Ea=/*@__PURE__*/ d(`ZodE164`,(e,t)=>{an.init(e,t),z.init(e,t)}),Da=/*@__PURE__*/ d(`ZodJWT`,(e,t)=>{sn.init(e,t),z.init(e,t)}),Oa=/*@__PURE__*/ d(`ZodNumber`,(e,t)=>{cn.init(e,t),L.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 B(e){return/* @__PURE__ */ kr(Oa,e)}let ka=/*@__PURE__*/ d(`ZodNumberFormat`,(e,t)=>{ln.init(e,t),Oa.init(e,t)});function Aa(e){return/* @__PURE__ */ Ar(ka,e)}let ja=/*@__PURE__*/ d(`ZodBoolean`,(e,t)=>{un.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>hi(e,t,n,r)});function V(e){return/* @__PURE__ */ jr(ja,e)}let Ma=/*@__PURE__*/ d(`ZodNull`,(e,t)=>{dn.init(e,t),L.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__*/ d(`ZodUnknown`,(e,t)=>{fn.init(e,t),L.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Fa(){return/* @__PURE__ */ Nr(Pa)}let Ia=/*@__PURE__*/ d(`ZodNever`,(e,t)=>{pn.init(e,t),L.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__*/ d(`ZodArray`,(e,t)=>{hn.init(e,t),L.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 H(e,t){return/* @__PURE__ */ ti(Ra,e,t)}let za=/*@__PURE__*/ d(`ZodObject`,(e,t)=>{bn.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ci(e,t,n,r),C(e,`shape`,()=>t.shape),aa(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: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 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(eo,this,e[0])},required(...e){return de(uo,this,e[0])}})});function U(e,t){let n={type:`object`,shape:e??{},...N(t)};return new za(n)}function W(e,t){return new za({type:`object`,shape:e,catchall:La(),...N(t)})}let Ba=/*@__PURE__*/ d(`ZodUnion`,(e,t)=>{Sn.init(e,t),L.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,...N(t)})}let Ha=/*@__PURE__*/ d(`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,...N(n)})}let Wa=/*@__PURE__*/ d(`ZodIntersection`,(e,t)=>{wn.init(e,t),L.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__*/ d(`ZodTuple`,(e,t)=>{Dn.init(e,t),L.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 P;return new Ka({type:`tuple`,items:e,rest:r?t:null,...N(r?n:t)})}let Ja=/*@__PURE__*/ d(`ZodRecord`,(e,t)=>{jn.init(e,t),L.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:R(),valueType:e,...N(t)}):new Ja({type:`record`,keyType:e,valueType:t,...N(n)})}let Xa=/*@__PURE__*/ d(`ZodEnum`,(e,t)=>{Mn.init(e,t),L.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:[],...N(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:[],...N(r),entries:i})}});function G(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new Xa({type:`enum`,entries:n,...N(t)})}let Za=/*@__PURE__*/ d(`ZodLiteral`,(e,t)=>{Nn.init(e,t),L.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 K(e,t){return new Za({type:`literal`,values:Array.isArray(e)?e:[e],...N(t)})}let Qa=/*@__PURE__*/ d(`ZodTransform`,(e,t)=>{Pn.init(e,t),L.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 p(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 $a(e){return new Qa({type:`transform`,transform:e})}let eo=/*@__PURE__*/ d(`ZodOptional`,(e,t)=>{In.init(e,t),L.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__*/ d(`ZodExactOptional`,(e,t)=>{Ln.init(e,t),L.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__*/ d(`ZodNullable`,(e,t)=>{Rn.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 ao(e){return new io({type:`nullable`,innerType:e})}let oo=/*@__PURE__*/ d(`ZodDefault`,(e,t)=>{zn.init(e,t),L.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():j(t)}})}let co=/*@__PURE__*/ d(`ZodPrefault`,(e,t)=>{Vn.init(e,t),L.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():j(t)}})}let uo=/*@__PURE__*/ d(`ZodNonOptional`,(e,t)=>{Hn.init(e,t),L.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,...N(t)})}let po=/*@__PURE__*/ d(`ZodCatch`,(e,t)=>{Wn.init(e,t),L.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__*/ d(`ZodPipe`,(e,t)=>{Gn.init(e,t),L.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__*/ d(`ZodReadonly`,(e,t)=>{qn.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 vo(e){return new _o({type:`readonly`,innerType:e})}let yo=/*@__PURE__*/ d(`ZodLazy`,(e,t)=>{Yn.init(e,t),L.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__*/ d(`ZodCustom`,(e,t)=>{Xn.init(e,t),L.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)}let To=G([`active`,`paused`,`blocked`,`usageLimited`,`budgetLimited`,`complete`]),Eo=B().int().nonnegative().safe();U({objective:R().min(1),status:To,tokenBudget:Eo.positive().nullable(),tokensUsed:Eo,timeUsedSeconds:Eo,createdAt:Eo,updatedAt:Eo});let Do=G([`user`,`automatic`]).nullable();U({objective:R().min(1).optional(),status:G([`active`,`paused`]).optional(),tokenBudget:Eo.positive().nullable().optional(),origin:Do});let Oo=/^rtc_[A-Za-z0-9_-]{1,128}$/u,ko=R().min(1).max(128);Ua(`operation`,[U({operation:K(`create`),requestId:ko,body:R().min(1).max(16<<20),headers:Ya(R(),R()).default({})}),U({operation:K(`cancel`),requestId:ko}),U({operation:K(`hangup`),callId:R().regex(Oo)})]),U({status:B().int().min(200).max(599),body:R(),headers:Ya(R(),R())});let Ao=W({threadId:R().trim().min(1).max(128),verbs:H(G([`read`,`watch`,`send`,`cancel`])).min(1).max(4)}),jo=W({enrollmentId:R().trim().min(1).max(128),threadId:R().trim().min(1).max(128),clientId:R().trim().min(1).max(64),executablePath:R().min(1).max(4096),endpoint:R().min(1).max(2048),issuedAt:R().min(1).max(64),expiresAt:R().min(1).max(64),pairing:G([`session`,`machine`]),allowlist:H(Ao).max(64)});W({}),W({enrollments:H(jo).max(256)}),W({enrollmentId:R().trim().min(1).max(128)}),W({enrollmentId:R().trim().min(1).max(128),revoked:K(!0)}),W({v:K(1),secret:R().min(1).max(4096)}),W({v:K(1),ok:K(!0)}),W({requestId:R().min(1).max(128),deadlineMs:B().int().positive(),route:G([`/v1/enroll/status`,`/v1/thread/read`,`/v1/thread/wait`,`/v1/thread/send`]),body:Ya(R(),Fa())});let Mo=W({code:R().min(1).max(64),message:R().max(2048),details:Fa().optional()});W({requestId:R().min(1).max(128),status:B().int().min(100).max(599).optional(),body:Fa().optional(),error:Mo.optional()}),W({threadId:R().min(1),view:G([`result`,`messages`]).optional(),cursor:R().optional(),limit:B().int().min(1).max(100).optional()}),W({threadId:R().min(1),timeoutMs:B().int().min(1).max(25e3).optional(),view:G([`result`,`messages`]).optional(),cursor:R().optional(),limit:B().int().min(1).max(100).optional()}),W({threadId:R().min(1),message:R().min(1).max(2097152)}),W({}),W({clientId:R().min(1),pairing:G([`machine`,`session`]),expiresAt:R().min(1),allowlist:H(W({threadId:R().min(1),verbs:H(R().min(1)).min(1)})),threadId:R().min(1),link:G([`online`,`offline`]),runtime:G([`reachable`,`unreachable`])}),U({}).strict(),U({enabled:V().optional(),browser:V().optional()}).strict().refine(e=>e.enabled!==void 0||e.browser!==void 0,{message:`Expected enabled or browser`}),U({enabled:V(),available:V(),unavailableReason:R().min(1).max(500).optional(),browser:V().optional(),browserFilesPresent:V().optional(),browserAvailable:V().optional(),browserUnavailableReason:R().min(1).max(500).optional(),applyFailed:V().optional(),applyError:R().min(1).max(500).optional()}).strict();function No(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 Po=Va([R(),B(),V(),Na()]);function Fo(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 Io=So(Fo,{message:`JSON value must not contain circular references`}),Lo=bo(()=>Va([Po,H(Lo),Ya(R(),Lo)])),Ro=Io.pipe(Lo);Io.pipe(H(Lo));let zo=Io.pipe(Ya(R(),Lo)),Bo=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(No([`diagnostic`,`stage`,`durationMs`,`stderrTail`])),Vo=R().max(64).regex(/^[a-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/u),Ho=e=>R().min(1).max(e).refine(e=>e.trim().length>0),Uo=Ya(Vo,U({label:Ho(256).optional(),description:Ho(1024).optional()}).strict()).refine(e=>Object.keys(e).length<=16,`Too many locales`),Wo=Ya(Vo,Ho(4096)).refine(e=>typeof e.en==`string`,`English fallback is required`).refine(e=>Object.keys(e).length<=16,`Too many locales`),Go=R().refine(e=>e.trim().length>0,{message:`Identifier must not be empty or whitespace`}),Ko=Go.brand(),q=Go.brand(),qo=Go.brand(),Jo=Go.brand(),Yo=Go.brand(),Xo=R().refine(e=>e.trim().length>0,{message:`Value must not be empty or whitespace`}),Zo=Xo.max(128).regex(/^[A-Za-z0-9._~:-]+$/u,`Permission Mode ID must use transport-safe characters`).brand(),Qo=U({modes:H(U({id:Zo,label:Xo.max(256),description:Xo.max(1024).optional(),dangerous:V().optional(),localizations:Uo.optional()}).strict()).min(1).max(32),defaultModeId:Zo}).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:Zo}).strict();let $o=B().int().safe().nonnegative(),es=B().finite().nonnegative(),ts=B().finite().min(0).max(100),ns=U({value:es,turnId:R().min(1).max(1024),at:$o}).strict();U({outputTokensPerSecond:ns.optional(),timeToFirstOutputMs:ns.extend({value:$o}).optional()}).strict();let rs=e=>Wo.refine(t=>Object.values(t).every(t=>t.length<=e)),is=U({composerIndicators:H(U({kind:K(`countdown`),id:R().min(1).max(64),expiresAtUnix:$o,label:rs(256).optional(),tooltip:rs(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:$o.optional(),cachedInputTokens:$o.optional(),cacheWriteInputTokens:$o.optional(),outputTokens:$o.optional(),outputTokensPerSecond:es.optional(),apiOutputTokensPerSecond:es.optional(),reasoningOutputTokens:$o.optional(),totalTokens:$o.optional(),totalCostUsd:es.optional(),totalCredits:es.optional(),contextUsagePercent:es.optional(),cacheHitRatePercent:ts.optional(),contextWindowTokens:$o.optional(),contextUsedTokens:$o.optional(),planFiveHourUsedPercent:ts.optional(),planFiveHourResetsAtUnix:$o.optional(),planSevenDayUsedPercent:ts.optional(),planSevenDayResetsAtUnix:$o.optional(),sessionCacheHitRatePercent:ts.optional(),timeToFirstOutputMs:$o.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`]})}),as=B().finite().min(0).max(100),os=G([`weekly`,`monthly`,`five_hour`,`seven_day`,`unknown`]),ss=U({id:R().min(1).max(256),label:R().min(1).max(256),localizations:Uo.optional()}).strict(),cs=U({product:R().min(1),periodType:os.optional(),scope:ss.optional(),localizations:Uo.optional(),used:B().finite().nonnegative().optional(),limit:B().finite().nonnegative().optional(),unit:R().min(1).max(32).optional(),usagePercent:as,resetsAt:R().min(1).optional()}).strict(),ls=U({availableCount:B().int().safe().positive(),nextExpiresAt:R().min(1).optional(),expiresAt:H(R().min(1)).min(1).max(32).optional()}).strict(),us=U({used:B().finite().nonnegative().optional(),limit:B().finite().nonnegative().optional(),unit:R().min(1).max(32).optional(),label:R().min(1).optional(),scope:ss.optional(),localizations:Uo.optional(),usedPercent:as,resetsAt:R().min(1).optional(),periodType:os,productUsage:H(cs).min(1).optional(),resetCredits:ls.optional()}).strict();U({threadId:q,refresh:K(`exact`).optional()}).strict(),U({threadId:q,usage:is.nullable(),accountCredits:us.optional(),accountCreditsSupported:V().optional()}).strict();let ds=R().refine(e=>e.trim().length>0,{message:`Value must not be empty or whitespace`}),fs=U({id:ds.max(512).regex(/^[A-Za-z0-9._~-]+$/u,`Model Ref must use transport-safe opaque characters`).brand()}).strict(),ps=ds.max(128).regex(/^[A-Za-z0-9._~-]+$/u,`Thinking option ID must use transport-safe characters`).brand(),ms=ds.max(256),hs=U({id:ps,label:ds.max(256)}).strict(),gs=U({ref:fs,label:ds.max(256),resolvedModelLabel:ms.optional(),fastModel:fs.optional(),supportedThinkingOptionIds:H(ps).optional()}).strict(),_s=H(hs).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)}),vs=U({models:H(gs),defaultModel:fs.optional(),thinkingOptions:_s,defaultThinkingOptionId:ps.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`]})}),ys=U({fork:V(),forkAcrossCwd:V(),rollbackLastTurn:V(),rollbackToCheckpoint:V().optional()}).strict().refine(e=>e.fork||!e.forkAcrossCwd,{path:[`forkAcrossCwd`],message:`Cross-cwd Fork requires exact history Fork support`}),bs=G([`live`,`atCreate`]),xs=U({configuration:U({selectModel:V(),selectThinkingOption:V(),selectPermissionMode:V(),permissionModeScope:bs.default(`live`)}).strict(),history:ys,subagents:U({observe:V(),readTranscript:V()}).strict().optional(),autonomousTurns:U({observe:V()}).strict().optional(),steer:V().optional()}).strict();U({effectiveModel:fs.optional(),resolvedModelLabel:ms.optional(),effectiveThinkingOptionId:ps.optional(),availableThinkingOptions:_s.optional(),effectivePermissionModeId:Zo.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 Ss=U({open:K(!0)}).strict();Va([U({status:K(`ready`),catalog:vs,permissionModes:Qo.optional(),capabilities:xs,webUi:Ss.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:Bo}).strict()]),U({harnessId:Ko,cwd:ds.max(16384).optional(),refresh:V().optional(),purpose:K(`availability`).optional()}).strict(),U({harnessId:Ko}).strict(),U({}).strict(),U({threadId:q,model:fs}).strict(),U({threadId:q,thinkingOptionId:ps}).strict(),U({threadId:q,includeReferenceCapability:V().optional()}).strict(),Ua(`owner`,[U({owner:K(`codex`),locked:V(),effectiveModel:fs.optional(),resolvedModelLabel:ms.optional(),effectiveThinkingOptionId:ps.optional(),effectivePermissionModeId:Zo.optional(),history:ys.optional(),supportsThreadReferences:K(!0).optional()}).strict(),U({owner:K(`external`),harnessId:ds.max(256),transportModelId:ds.max(1024),effectiveModel:fs.optional(),resolvedModelLabel:ms.optional(),effectiveThinkingOptionId:ps.optional(),availableThinkingOptions:_s.optional(),effectivePermissionModeId:Zo.optional(),history:ys,usage:is.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 Cs=Ua(`owner`,[U({threadId:q,owner:K(`codex`)}).strict(),U({threadId:q,owner:K(`external`),harnessId:R().max(256).pipe(Ko)}).strict()]);U({threads:H(Cs).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`}),u}}).pipe(U({expectedTurnId:qo,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:Ya(R(),R()),projectless:H(R()),pinned:H(R())});let ws=Ya(R(),Fa()),Ts=U({epoch:R().uuid(),sequence:B().int().nonnegative()});Ua(`type`,[U({type:K(`display-settings-changed`),cursor:Ts}),U({type:K(`preferences-changed`),cursor:Ts,revision:B().int().nonnegative()}),U({type:K(`hello`),version:K(1),cursor:Ts,reset:V()}),U({type:K(`changed`),cursor:Ts,threadId:R().min(1),method:R().min(1)})]);let Es=Ua(`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()}))})]),Ds=Ua(`type`,[U({type:K(`approval`),title:R(),description:R().optional(),subject:Fa().optional(),actions:H(U({id:R(),label:R(),effect:R()}))}),U({type:K(`question`),title:R().optional(),questions:H(Es)})]),Os=U({requestId:Va([R(),B().int()]),threadId:R(),kind:G([`approval`,`question`]),interaction:Ds,request:ws}),ks=U({id:R().min(1),clientUserMessageId:R().min(1),input:H(ws),presentationInput:H(ws).nullable().optional()}).passthrough();U({fields:H(U({path:H(Va([R(),B().int().nonnegative()])),originalLength:B().int().nonnegative()}))});let As=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(),js=U({id:R().min(1).max(512),fingerprint:R().min(1).max(128)});U({threadId:R().min(1),knownTurns:H(js).max(64).optional(),truncateToolOutput:V().optional()});let Ms=U({harnessId:R().min(1),nativeSessionId:R().min(1)});U({cursor:Ts,activeTurnId:R().min(1).nullable().optional(),command:U({name:R().min(1),turn:As}).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:Ms.optional(),turns:H(As).length(0)}).passthrough(),turnsPage:U({data:H(As).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:fs.optional(),effectiveThinkingOptionId:ps.optional(),effectivePermissionModeId:Zo.optional()}),queue:U({items:H(ks),pausedReason:G([`interrupted`,`outcome-unknown`,`failed`]).nullable()}).optional(),interactions:H(Os)}),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:Va([R(),B().int()]),result:ws}),U({includeArchived:V().optional(),officialCursor:U({live:R().nullable(),archived:R().nullable().optional()}).strict().optional()}).strict(),U({threads:H(zo),ownership:H(Cs),archivedThreadIds:H(q),officialCursor:U({live:R().nullable(),archived:R().nullable().optional()}).strict().optional()}).strict();let Ns=R().regex(/^audio\/[a-z0-9.+-]+(?:\s*;[^\r\n]*)?$/i),Ps=U({available:V()}).strict();U({path:R().min(1),mimeType:Ns}).strict();let Fs=G([`credentials-unavailable`,`login-expired`,`rate-limited`,`service-rejected`,`host-incompatible`,`network`,`timeout`,`audio-empty`,`audio-too-large`,`audio-format`,`audio-invalid`]),Is=Ua(`ok`,[U({ok:K(!0),text:R()}).strict(),U({ok:K(!1),error:U({code:Fs}).strict()}).strict()]),Ls=U({kind:G([`public`,`relay`,`tailscale-funnel`,`tailscale-https`,`tailscale`,`lan`,`virtual`]),url:R().min(1)}).strict(),Rs=Ua(`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()})]),zs=U({state:Rs,error:R().optional()}).strict(),Bs=Ua(`status`,[U({status:K(`on`)}),U({status:K(`off`)}),U({status:K(`invalid`),reason:R()})]),Vs=U({lan:V(),autostart:Bs}).strict(),Hs=U({expiresAt:R().optional(),issuing:V(),failure:U({detail:R().optional(),retryAt:R(),paused:V()}).optional()}),Us=Ua(`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:Hs}),U({status:K(`missing-certificate`),url:R(),certificate:Hs}),U({status:K(`stopped`),reason:G([`replaced`,`rejected`,`unsupported-version`])})]),Ws=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()),Gs=R().regex(/^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)?$/),Ks=G([`official`,`self-hosted`]),qs=U({secret:R().min(1),lastUsedAt:B().nullable(),networkUrls:H(Ls),directCandidates:H(Ls).optional(),tailscale:Rs,background:Vs.optional(),relay:U({state:Us,enabled:V(),kind:Ks,officialHost:R(),customHost:R().optional(),officialHostname:R().optional(),customHostname:R().optional(),quotaUntil:R().optional()}).strict().optional()}).strict(),Js=U({url:R()}).strict(),Ys=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()}),Xs=U({id:R().min(1).max(256),harnessId:R().min(1),label:R().min(1).max(512),provider:G([`openai-codex`,`xai`])}).strict(),Zs=R().regex(/^[a-z][a-z0-9-]{0,47}$/),Qs=U({name:Zs,source:Xs,importedAt:R()}).strict(),$s=Ua(`action`,[U({action:K(`list`)}).strict(),U({action:K(`import`),sourceId:R().min(1).max(256),name:Zs,confirmed:K(!0)}).strict(),U({action:K(`reimport`),sourceId:R().min(1).max(256),name:Zs,confirmed:K(!0)}).strict(),U({action:K(`remove`),name:Zs,confirmed:K(!0)}).strict()]),ec=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(Xs),targets:H(U({harnessId:R(),providers:H(G([`openai-codex`,`xai`])),imports:H(Qs),others:H(ec).default([])}).strict())}).strict(),U({targetHarnessId:R().min(1).max(128).optional(),request:$s}).strict(),U({events:V()});let tc=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:tc.nullable()}),W({}),W({entries:tc,initializeOnly:V().optional()});let nc=W({enabled:V(),timeoutMinutes:B().int().min(5).max(1440)});Object.freeze({enabled:!1,timeoutMinutes:10});let rc=R().regex(/^external$/u),ic=Ko.transform(e=>String(e)),ac=W({model:fs.optional(),thinkingOptionId:ps.optional(),permissionModeId:Zo.optional()}).refine(e=>!!(e.model||e.thinkingOptionId||e.permissionModeId),`A default configuration must contain a preference`),oc=W({lastHarness:Ko.optional(),byHarness:Ya(ic,ac)}),sc=R().min(1).max(1024),cc=W({idleRelease:nc.optional(),favorites:Ya(ic,H(sc).max(2048)).default({}),newThread:oc.optional()});W({scope:rc,revision:B().int().nonnegative(),values:cc}),W({scope:rc.default(`external`)});let lc=Ua(`kind`,[W({kind:K(`idleRelease`),value:nc}),W({kind:K(`favorite`),harnessId:Ko,modelId:sc,enabled:V()}),W({kind:K(`favorites`),harnessId:Ko,modelIds:H(sc).max(2048)}),W({kind:K(`newThread`),lastHarness:Ko.optional(),harnessId:Ko.optional(),configuration:ac.optional()})]);W({scope:rc.default(`external`),operations:H(lc).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:Ya(rc,cc)});let uc=B().finite().nonnegative(),dc=W({input:uc,output:uc,cacheRead:uc.optional(),cacheWrite:uc.optional(),cacheWrite1h:uc.optional()}),fc=R().max(512).refine(e=>e.trim()===e&&e.length>0,`Model ID is required`);W({path:R(),entries:H(W({key:R(),price:dc})),error:R().nullable()}),W({}),W({key:fc,price:dc.nullable(),previousKey:fc.optional()}),W({model:fc});let pc=W({official:V().optional(),canonicalModelId:R().min(1).optional(),provider:R().min(1).max(512),model:R().min(1).max(512),price:dc});W({price:dc.nullable(),suggestions:H(pc).max(6).optional()});let mc=[`today`,`7d`,`30d`,`90d`,`all`],hc=B().int().min(0).max(2**53-1),gc=R().regex(/^\d{4}-\d{2}-\d{2}$/u),_c=R().min(1).max(128),vc=R().min(1).max(512),yc=R().min(1).max(4096);W({range:G(mc),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:_c.optional(),model:vc.nullable().optional(),project:yc.nullable().optional(),date:gc.optional()});let bc=W({requests:hc,inputTokens:hc,cachedInputTokens:hc,cacheWriteInputTokens:hc,cacheKnownInputTokens:hc,cacheHitCachedInputTokens:hc,cacheHitInputTokens:hc,outputTokens:hc,reasoningOutputTokens:hc,costUsd:B().finite().min(0),unpricedRequests:hc,unmeteredRequests:hc}),xc=bc.shape,Sc=W({harness:_c,sessionId:R().min(1).max(512),project:yc.nullable(),title:R().min(1).max(200).optional(),models:H(vc).max(16),firstAtMs:hc,lastAtMs:hc,...xc});W({range:G(mc),from:gc.nullable(),to:gc,filters:W({harness:_c.nullable(),model:vc.nullable(),unknownModel:V(),project:yc.nullable(),unknownProject:V(),date:gc.nullable()}),reading:W({complete:V(),sources:hc,read:hc}),failures:H(W({harness:_c,message:R().max(2048)})).max(256),options:W({harnesses:H(_c).max(256),models:H(vc.nullable()).max(4096),projects:H(yc.nullable()).max(4096)}),modelLabels:H(W({harness:_c,model:vc,label:vc})).max(4096).optional(),credits:H(W({harness:_c,model:vc.nullable(),credits:B().finite().min(0),reportedRequests:hc,requests:hc})).max(4096).optional(),totals:bc,daily:H(W({date:gc,harness:_c,...xc})).max(2e5),hourly:H(W({weekday:B().int().min(0).max(6),hour:B().int().min(0).max(23),...xc})).max(168),byHarness:H(W({harness:_c,...xc})).max(256),byModel:H(W({model:vc.nullable(),...xc,harnessPricedRequests:hc})).max(4096),byProject:H(W({project:yc.nullable(),...xc})).max(4096),sessions:H(Sc).max(100),recentSessions:H(Sc).max(100).optional()}),U({threadId:q}),U({discarded:V()}),W({threadId:q,unobserved:K(!0).optional()});let Cc={id:R().min(1),prompt:R(),optional:V()},wc=W({deadlineUnixMs:B().int().min(0).max(864e13),action:G([`recommended`,`decline`]),resetOnActivity:V().optional()}),Tc=Ua(`type`,[W({...Cc,type:K(`choice`),multiple:V(),allowOther:V(),options:H(W({value:R().min(1),label:R(),description:R().optional()})).min(1)}),W({...Cc,type:K(`text`),multiline:V(),secret:K(!1),placeholder:R().optional(),prefill:R().optional()})]);W({questions:H(W({interactionId:Yo,turnId:qo,title:R().optional(),expiresAt:R().optional(),autoResolution:wc.optional(),questions:H(Tc).min(1)}))});let Ec=G([`answered`,`skipped`,`closedByHarness`,`expired`,`turnEnded`]),Dc=W({interactionId:Yo,turnId:qo,itemId:Jo,title:R().optional(),questions:H(Tc).min(1),outcome:Ec,answers:Ya(R(),H(R()))}),Oc=W({interactionId:Yo,turnId:qo,itemId:Jo});W({records:H(Dc),pendingAnchors:H(Oc)}),W({threadId:q,interactionId:Yo,turnId:qo,answers:Ya(R(),H(R())),cancelled:V().optional()}),W({accepted:K(!0)}),W({threadId:q,interactionId:Yo,turnId:qo}),W({autoResolution:wc.nullable()});let kc=U({path:R(),oldText:R().nullable(),newText:R()});U({sessionId:R().min(1),turn:B().int().nonnegative(),path:R().min(1).optional()});let Ac=U({diffs:H(kc)});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/voice/gateway-status.codexhost/enrollment/list.codexhost/enrollment/revoke.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/grok-computer-use/get.codexhost/harness/grok-computer-use/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 jc=G([`idle`,`running`,`busy`,`closing`,`failed`,`blocked`]),Mc=G([`none`,`disabled`,`timeout`,`operation`,`background`,`identity`,`persistence`,`closeFailed`]);W({threadId:R(),title:R(),harnessId:R(),state:jc,reason:Mc,inactiveMs:B().nonnegative()}),W({threadId:q,turnId:qo});let Nc=U({amount:B().finite().nonnegative(),currency:R().trim().min(1).max(8),label:R().trim().min(1).max(128).optional()}).strict(),Pc=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:us.optional(),balance:Nc.optional()}).strict();function Fc(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 Ic=Fc(Pc),Lc={harnessId:Ko,harnessName:R().trim().min(1).max(128)},Rc=U(Lc).strict();U({}).strict(),U({sources:H(Rc).max(128)}).strict(),U({harnessId:Ko,refresh:V().optional()}).strict(),U({...Lc,account:Ic.nullable(),accounts:H(Ic).max(8).optional()}).strict(),U({refresh:V().optional()}).strict(),U({accounts:H(Fc(Pc.extend(Lc))).max(128)}).strict();let zc=R().min(1).max(128).regex(/^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/u).pipe(Ko),Bc=zc.refine(e=>e!==`codex`,`The official Codex identity is reserved`),Vc=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`),Hc=fa().refine(e=>/^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(e),`Plugin documentation links must be credential-free HTTPS URLs`),Uc=U({en:R().max(4096),"zh-CN":R().max(4096).optional()}).strict(),Wc=U({commands:H(U({terminal:R().max(256),command:R().max(4096)}).strict()).max(8),before:Uc.optional(),after:Uc.optional(),downloads:H(U({label:R().max(128),url:Hc}).strict()).max(8).optional()}).strict(),Gc={id:zc,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:Wc.optional(),notice:Uc.optional(),launchCommand:K(!0).optional(),links:U({website:Hc.optional(),documentation:Hc.optional(),installation:Hc.optional()}).strict().optional()};U({manifestVersion:K(1),...Gc,adapterApiVersion:B().int().positive(),entry:Vc,icon:Vc.optional()}).strict();let Kc=R().max(174828).regex(/^data:image\/(?:png|jpeg|webp|svg\+xml);base64,[A-Za-z0-9+/]+={0,2}$/u),qc=U({...Gc,icon:Kc.optional()}).strict();U({}).strict(),U({plugins:H(qc.extend({id:Bc})).max(128)}).strict(),U({version:K(1),enabled:H(zc).max(128)}).strict().refine(e=>new Set(e.enabled).size===e.enabled.length,{message:`Enabled plugin IDs must be unique`,path:[`enabled`]}),U({harnessId:Bc,model:fs.optional(),thinkingOptionId:ps.optional(),permissionModeId:Zo.optional(),prewarm:K(!0).optional()}).strict();let Jc=R().trim().min(1).max(4096).refine(e=>!/[\u0000\r\n]/u.test(e),`Invalid entrypoint path`);U({harnessId:Bc}).strict().extend({path:Jc.nullable()}),U({path:Jc.nullable(),restartRequired:V()}).strict(),U({harnessId:Ko,action:G([`check`,`update`,`install`])}).strict();let Yc=U({currentVersion:R().min(1).max(128),latestVersion:R().min(1).max(128),updateAvailable:V(),canUpdate:V(),versionKind:G([`cli`,`application`]).optional(),manualUpdateUrl:fa().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:Wo.optional(),latestVersionKind:G([`unknown`,`tracking-branch`]).optional()}).strict();U({taskId:R().uuid()}).strict(),Ua(`status`,[U({taskId:R().uuid(),status:K(`running`)}).strict(),U({taskId:R().uuid(),status:K(`succeeded`),result:Yc}).strict(),U({taskId:R().uuid(),status:K(`failed`),error:U({code:B().int(),message:R().min(1).max(2048)}).strict()}).strict()]);let Xc=R().min(1).max(256).regex(/^[A-Za-z0-9._~-]+$/u),Zc=R().trim().min(1),Qc=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`]),$c=U({accountId:Xc,label:Zc.max(256),email:R().email().max(320).optional(),planType:Qc.optional()}).strict(),el=G([`ready`,`unavailable`]);U({version:K(2),currentAccountId:Xc.nullable(),phase:el,revision:B().int().nonnegative(),instanceId:Zc.max(1024).optional(),accounts:H($c).max(1)}).strict(),U({accountId:Xc,refresh:V().optional()}).strict(),U({accountId:Xc,usage:is.nullable(),accountCredits:us.optional(),freshness:G([`live`,`cached`]),observedAt:R().datetime().nullable()}).strict();let tl=1e3,nl=R().refine(e=>e.trim().length>0,`Value must not be empty or whitespace`).refine(e=>!e.includes(`\0`),`Value must not contain NUL`),rl=nl.max(1024),il=U({nativeSessionId:rl,title:nl.max(4096).nullable(),updatedAt:B().int().nonnegative().max(864e13),cwd:nl.max(16384),running:V().nullable()}).strict();U({}).strict();let al=U({harnesses:H(U({harnessId:Bc,name:nl.max(128)}).strict()).max(128)}).strict();U({harnessId:Bc,query:R().trim().max(4096).refine(e=>!e.includes(`\0`)).optional(),offset:B().int().nonnegative().safe().optional(),limit:B().int().min(1).max(tl).optional()}).strict();let ol=U({candidates:H(il).max(tl),total:B().int().nonnegative().safe()}).strict();U({harnessId:Bc,nativeSessionId:rl}).strict();let sl=U({threadId:nl.max(1024).pipe(q)}).strict(),cl=R().refine(e=>e.trim().length>0,`Value must not be empty or whitespace`).refine(e=>!e.includes(`\0`),`Value must not contain NUL`),ll=rl,ul=il;U({}).strict(),U({candidates:H(ul).max(1e3)}).strict(),U({nativeSessionId:ll}).strict(),U({threadId:cl.max(1024).pipe(q)}).strict(),U({threadId:q,lastTurnId:qo}).strict(),U({threadId:q}).strict();let dl=R().trim().min(1).max(128).regex(/^[A-Za-z0-9._:-]+$/u).brand();U({commands:H(U({id:dl,invocation:R().min(1).max(128),label:R().trim().min(1).max(128),description:R().trim().min(1).max(512).optional(),localizations:Uo.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:Ko,cwd:R().min(1).optional()}).strict(),U({threadId:q}).strict(),U({threadId:q,commandId:dl,turnId:qo.optional(),arguments:zo.optional()}).strict(),U({accepted:K(!0),turnId:qo.optional()}).strict();let fl=K(`2.0`).optional(),pl=La().optional(),ml=R().min(1),hl=Va([R(),B().int()]),gl=U({code:B().int(),message:R(),data:Ro.optional()}).catchall(Ro).superRefine(No([`data`]));Va([U({jsonrpc:fl,id:hl,method:ml,params:Ro.optional(),result:pl,error:pl}).catchall(Ro).superRefine(No([`jsonrpc`,`params`,`result`,`error`])),U({jsonrpc:fl,id:pl,method:ml,params:Ro.optional(),result:pl,error:pl}).catchall(Ro).superRefine(No([`jsonrpc`,`id`,`params`,`result`,`error`])),U({jsonrpc:fl,id:hl,method:pl,params:pl,result:Ro,error:pl}).catchall(Ro).superRefine(No([`jsonrpc`,`method`,`params`,`error`])),U({jsonrpc:fl,id:hl,method:pl,params:pl,result:pl,error:gl}).catchall(Ro).superRefine(No([`jsonrpc`,`method`,`params`,`result`]))]);let _l=R().refine(e=>e.trim().length>0,{message:`Native identifier must not be empty or whitespace`});W({harnessId:Ko,nativeSessionId:_l,locator:Ro.optional(),formatVersion:K(1)}).superRefine(No([`locator`])),W({harnessId:Ko,nativeSessionId:_l,nativeTurnKey:_l,formatVersion:K(1)}),W({harnessId:Ko,nativeSessionId:_l,checkpointId:_l,locator:Ro.optional(),formatVersion:K(1)}).superRefine(No([`locator`]));let vl=R().regex(/^\d+\.\d+\.\d+(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/u),yl=G([`npm`,`windows-installer`,`macos-dmg`]),bl=W({version:vl,installation:yl,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 xl=R().max(300).regex(/^https:\/\/github\.com\/karlorz\/codex-host\/releases\/tag\/v[0-9A-Za-z.+-]+$/u,`release notes URL must identify a codexhost GitHub Release`);W({currentVersion:vl,installation:yl.nullable(),latestVersion:vl.nullable(),updateAvailable:V(),installationAvailable:V(),releaseNotes:R().min(1).max(2e4).nullable(),releaseNotesUrl:xl.nullable(),status:bl.nullable(),error:R().min(1).max(500).nullable()}),W({status:bl}),W({status:bl.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 wl(e){let t=e.replace(/[[\]()\n\r]+/gu,` `).replace(/\s+/gu,` `).trim();return t.length>0?t:`agent`}function Tl(e){return`[@${wl(e.label)}](${Cl(e.harnessId)})`}function El(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 Dl=G([`idle`,`installing`,`restarting`,`succeeded`,`failed`]);U({runningVersion:R().nullable(),installedVersion:R().nullable(),restartRequired:V(),remote:V(),updateSupported:V(),update:U({phase:Dl,targetVersion:R().nullable(),error:R().nullable()})});let Ol=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 kl=R().min(1).max(1024),Al={hostId:kl.regex(/^remote-(?:ssh(?:-|:)|control:)/u)},jl={...Al,threadId:kl},Ml=Ua(`kind`,[W({kind:K(`hosts`)}),W({kind:K(`list`),...Al,cursor:R().nullable(),archived:V()}),W({kind:K(`read`),...jl}),W({kind:K(`prompt`),...jl,epoch:kl,text:R().min(1).max(8e3),requestId:kl.optional()}),W({kind:K(`interrupt`),...jl,epoch:kl,turnId:kl}),W({kind:K(`rename`),...jl,epoch:kl,name:R().min(1).max(512)}),W({kind:K(`archive`),...jl,epoch:kl,archived:V()}),W({kind:K(`respond`),...jl,epoch:kl,requestId:Va([kl,B().int()]),result:Ya(R(),Fa())})]),Nl=R().min(1).max(1024),Pl=U({hostId:Nl,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()}),Fl=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()});Ua(`action`,[W({action:K(`session`),operation:Ml}),W({action:K(`list`)}),W({action:K(`catalog`)}),W({action:K(`read-thread`),hostId:Nl.refine(e=>e!==`local`),input:Ys}),W({action:K(`save`),draft:Fl,previous:Pl.nullable()}),W({action:K(`remove`),previous:Pl}),W({action:K(`connect`),hostId:Nl,enabled:V()}),W({action:K(`state`),hostId:Nl}),W({action:K(`runtime`),hostId:Nl}),W({action:K(`update`),hostId:Nl.refine(e=>e!==`local`),version:Ol.shape.version})]),Va([W({result:Ro}),W({error:W({code:B().int(),message:R()})})]);let Il=R().max(214).regex(/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/u),Ll=Va([R(),U({en:R()}).catchall(R())]),Rl=U({title:Ll.optional(),description:Ll.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()}),zl=U({extensions:H(U({id:Il,name:R().min(1).max(214),version:R().min(1).max(128),format:K(`dsh`),supportedTargets:qa([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:Rl.optional(),loadError:R().optional()})),loadedIds:H(Il),safeMode:V(),storeError:R().optional()}),Bl=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:Bl.optional()}).strict(),U({id:Il,enabled:V()}).strict(),U({id:Il}).strict();let Vl=W({chatExperience:G([`chatgpt`,`codex`]),chatConnection:G([`desktop`,`gateway`]),workConnection:G([`desktop`,`gateway`])});Object.freeze({chatExperience:`chatgpt`,chatConnection:`desktop`,workConnection:`gateway`});let Hl=Vl.extend({inject:V()});Ua(`operation`,[W({operation:K(`get`),runtime:W({id:R().uuid(),revision:R().max(64),activeCall:V()}).optional()}),W({operation:K(`migrate`),routes:Vl}),W({operation:K(`set`),settings:Hl,revision:R().max(64)}),W({operation:K(`restart`),confirm:K(!0)})]),W({settings:Hl,initialized:V(),revision:R(),activeInject:V().nullable(),envOverride:G([`0`,`1`]).nullable(),activeEnvOverride:G([`0`,`1`]).nullable(),routesActive:V().nullable(),activeCall:V().nullable(),gatewayReady:V().nullable(),restartAvailable:V(),restart:W({phase:G([`idle`,`restarting`,`succeeded`,`failed`]),error:R().nullable()})});let Ul=W({id:R().min(1),kind:G([`task`,`monitor`,`loop`,`subagent`]),label:R(),status:G([`running`,`scheduled`,`completed`,`failed`,`cancelled`,`unknown`]),canStop:V(),commandItemId:Jo.optional(),schedule:R().optional(),nextRunAt:R().datetime({offset:!0}).optional(),relatedActivityId:R().optional(),threadId:q.optional()});W({activity:Ul,output:R(),truncated:V()}),W({threadId:q}).extend({activityId:R().min(1)}),W({supported:V(),activities:H(Ul)}),W({outcome:G([`stopped`,`alreadyStopped`,`notFound`])}),K(1);function Wl(){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 Gl=[`unsupported`,`permission-denied`,`display-unavailable`,`capture-failed`,`image-too-large`,`busy`,`timeout`,`unavailable`];function Kl(e){return typeof e==`string`&&Gl.some(t=>t===e)}var ql=class extends Error{code;details;constructor(e,t,n){super(e),this.code=t,this.details=n}};async function Jl(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:Wl(),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 ql(e,t,n)}return r.result.value}let Yl={status:async()=>Ps.parse(await Jl(`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 Is.parse(await n.json())}},Xl=2e4,Zl=(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})}),Ql={capture:async(e,t)=>{for(let n=0;;n+=1)try{return await $l(e,t)}catch(t){if(!(t instanceof Error&&t.message===`busy`&&n<3))throw t;await Zl(500,e)}}};async function $l(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(Xl),!e.ok){let t=await e.json().catch(()=>void 0);throw Error(Kl(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(Xl),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)}}async function eu(e){let t=await fetch(`api/auth/status`,{credentials:`same-origin`,cache:`no-store`,signal:e});if(!t.ok)return!1;let n=await t.json();return n.authenticated===!0&&n.local===!0}let tu={relay:async(e,t)=>Us.parse(await Jl(`codexhost/relaySet`,{enabled:e,...t})),lan:e=>Jl(`codexhost/lanSet`,{enabled:e}),autostart:async e=>Bs.parse(await Jl(`codexhost/autostartSet`,{enabled:e})),serve:async e=>zs.parse(await Jl(`codexhost/tailscaleServeSet`,{enabled:e})),get:async()=>qs.parse(await Jl(`codexhost/accessTokenGet`,{})),regenerate:async()=>qs.parse(await Jl(`codexhost/accessTokenRegenerate`,{}))},nu={config:()=>Jl(`codexhost/pushConfig`,{}),subscribe:e=>Jl(`codexhost/pushSubscribe`,{subscription:e,userAgent:navigator.userAgent}),unsubscribe:e=>Jl(`codexhost/pushUnsubscribe`,{endpoint:e}),test:()=>Jl(`codexhost/pushTest`,{})},ru={sources:async()=>al.parse(await Jl(`codexhost/importSources`,{})),candidates:async e=>ol.parse(await Jl(`codexhost/importCandidates`,{request:e})),importSession:async(e,t)=>sl.parse(await Jl(`codexhost/import`,{request:{harnessId:e,nativeSessionId:t}}))},iu={read:async(e,t,n)=>Ac.parse(await Jl(`codexhost/turnDiffs`,{request:{sessionId:e,turn:t,...n===void 0?{}:{path:n}}})).diffs},au={send:(e,t,n)=>Jl(`codexhost/editMessage`,{request:{sessionId:e,atSeq:t,text:n}})},ou={inspect:e=>Jl(`codexhost/threadCommands`,{request:{sessionId:e}}),execute:(e,t)=>Jl(`codexhost/executeThreadCommand`,{request:{sessionId:e,commandId:t}})},su=`codexhost-native`;function cu(e){let t=El(e),n=`[@${e.replace(/[\[\]\r\n]/gu,` `)}](${t})`;return{source:su,ref:n,label:e,clipboardText:n}}let lu=`codexhost-delegation`;function uu(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([ou.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(),ou.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:su,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:cu(c.invocation)}}catch{return h(t,l(`discovery.stale`)),`handled`}}}),`ui-codexhost: native discovery`),e.effect(()=>e.inputTriggers.registerSource({trigger:`@`,aliases:[`#`],name:lu,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=Tl({harnessId:n.id,label:n.name});return{insert:{source:lu,ref:r,label:n.name,appearance:`session`,clipboardText:r}}}}),`ui-codexhost: delegation discovery`)}function du(e){let t=e.replace(/[/\\]+$/,``),n=Math.max(t.lastIndexOf(`/`),t.lastIndexOf(`\\`));return t.slice(n+1)}let fu=`codexhost-thread`,pu=/(?<![\w:/])(?:codex:\/\/threads\/|thread:\/\/)[^\s<>()\[\]`"',。!?;:、]+(?<![.,;])/gu;function mu(e){let t=e.projectionValues?.threadReference;if(!e.blank&&t?.hostId&&(t.hostId===`local`||/^remote-(?:ssh(?:-|:)|control:)/u.test(t.hostId)&&t.threadId))return{threadId:t.threadId??e.id,hostId:t.hostId,title:e.title?.replace(/[\s\u0000-\u001f\u007f]+/gu,` `).trim()||e.id.slice(0,8)}}function hu(e){return`thread://${encodeURIComponent(e.threadId).replace(/[!'()*]/gu,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)}?hostId=${encodeURIComponent(e.hostId)}`}function gu(e){if(e.trim()!==e)return;let t=/^codex:\/\/threads\/([^/?#\s<>]+)$/u.exec(e)??/^thread:\/\/([^/?#\s<>]+)\?hostId=([^&#\s]+)$/u.exec(e);if(t?.[1]!==void 0)try{let e=decodeURIComponent(t[1]),n=decodeURIComponent(t[2]??`local`);if(!e||!n||/[\u0000-\u001f\u007f]/u.test(e+n))return;if(n===`local`)return e;if(!/^remote-(?:ssh(?:-|:)|control:)/u.test(n))return;let r=new TextEncoder().encode(JSON.stringify([n,e]));return`web-remote:`+btoa(Array.from(r,e=>String.fromCharCode(e)).join(``)).replaceAll(`+`,`-`).replaceAll(`/`,`_`).replace(/=+$/u,``)}catch{return}}function _u(e){let t=`[@${e.title.replace(/[\\`*{}[\]()#+.!_<>|~-]/gu,e=>`\\${e}`)}](${hu(e)})`;return{source:fu,ref:t,label:e.title,appearance:`session`,clipboardText:t}}function vu(e,t){let n=e.sessions.list.getSnapshot().byId[t];return n!==void 0&&e.sessions.subagentAddress(t)===void 0&&(mu(n)!==void 0||n.blank&&n.projectionValues?.harnessIdentity!=null)}function yu(e){let t=e.locale.bind(`codexhostImport`),n=/* @__PURE__ */ new WeakMap,r=t=>vu(e,t);e.effect(()=>e.inputTriggers.registerSource({trigger:`@`,aliases:[`#`],name:fu,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=mu(t);if(n===void 0)return[];let r=u.get(e)??(du(t.cwd??``)||t.cwd||``);return!n.title.toLowerCase().includes(d)&&!r.toLowerCase().includes(d)?[]:[{id:e,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(({id:e,reference:n,workspace:r})=>({name:e,label:n.title,value:e,showAlias:!1,section:t(`discovery.sessions`),description:[r,n.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:mu(a);return!r(t.session.sessionId)||o===void 0||n===t.session.sessionId||e.workspaces.list.getSnapshot().archivedSessionIds.includes(n)?`handled`:{insert:_u(o)}}}),`ui-codexhost: Thread reference discovery`)}function bu(e){let t=e.locale.bind(`codexhostImport`),n=()=>{if(e.layout.panelInfo.getSnapshot().activePanelId===null)return e.uiSession.adapter.current.getSnapshot().key},r=r=>{let i=n();if(i===void 0||r===i)return;let a=e.sessions.binding(i);if(a===void 0)return;let o=()=>{let t=e.sessions.list.getSnapshot().byId[r];if(!(t===void 0||t.id!==r||e.sessions.binding(r)?.session.getSnapshot().removed===!0||e.workspaces.list.getSnapshot().archivedSessionIds.includes(r)))return mu(t)};if(o()===void 0)return;let s=e.conversation.input.captureReferenceInsertion(a);if(s===void 0)return;let c=e.conversation.input.for(a.ctx),l=!1,u=()=>((n()!==i||e.sessions.binding(i)!==a||e.workspaces.list.getSnapshot().archivedSessionIds.includes(i)||o()===void 0)&&(l=!0),!l&&s.getSnapshot());return{getSnapshot:u,subscribe:t=>{let n=()=>{u(),t()},r=[e.sessions.list.subscribe(n),e.uiSession.adapter.current.subscribe(n),e.workspaces.list.subscribe(n),e.layout.panelInfo.subscribe(n),s.subscribe(n)];return()=>r.forEach(e=>e())},insert:()=>{let e=u();l=!0;let n=o();return!e||n===void 0||!s.insert(_u(n))?!1:(c.notify(`info`,t(`reference.addedToDraft`)),!0)}}};e.slots.inject(`sidebar.workspaces.session.menu.item`,()=>e.slots.register({name:`sidebar.workspaces.session.menu.item`,id:`codexhost.reference-current-draft`,order:360,locale:`workspace`,inject:()=>({prepareDraftReference:r})},a.ReferenceSessionMenuItem))}let xu={sessionId:void 0,pending:!1,startedAt:void 0,progress:void 0,image:void 0,error:void 0};var Su=class{capture;store=(0,o.createSnapshotStore)(xu);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:Kl(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(xu),n!==void 0&&URL.revokeObjectURL(n.url)}};let Cu=[`#ff3b30`,`#ffcc00`,`#0a84ff`];function wu(e,t,n){return n===90?{x:t,y:-e}:n===270?{x:-t,y:e}:{x:e,y:t}}function Tu(e){return Math.max(4,Math.round(e/250))}function Eu(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 Du(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 Ou(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 ku(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 ju(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 Mu=`@deepseek-ai/dsh-client-ui-codexhost/DesktopScreenshotViewer.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=`.SKGy0a_root{z-index:1000;color:#fff;background:#000;position:fixed;inset:0;overflow:hidden}.SKGy0a_stage{position:absolute;top:50%;left:50%}.SKGy0a_top,.SKGy0a_bottom{z-index:2;pointer-events:none;transition:opacity .15s;position:absolute;left:0;right:0}.SKGy0a_top *,.SKGy0a_bottom *{pointer-events:auto}.SKGy0a_top{padding-top:env(safe-area-inset-top);background:linear-gradient(#000000b3,#0000);top:0}.SKGy0a_bottom{padding-bottom:env(safe-area-inset-bottom);background:linear-gradient(#0000,#000000b3);bottom:0}.SKGy0a_hidden{visibility:hidden;opacity:0}.SKGy0a_bar{flex-wrap:wrap;align-items:center;gap:8px;padding:8px 12px;display:flex}.SKGy0a_spacer{flex:1}.SKGy0a_text,.SKGy0a_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}.SKGy0a_text[aria-pressed=true]{background:#ffffff52}.SKGy0a_text:disabled{opacity:.4;cursor:default}.SKGy0a_primary{background:var(--dsw-alias-button-info-fill,#3964fe)}.SKGy0a_swatch{cursor:pointer;touch-action:manipulation;border:2px solid #0000;border-radius:50%;width:28px;height:28px;padding:0}.SKGy0a_swatch[aria-pressed=true]{border-color:#fff;box-shadow:0 0 0 2px #0009}.SKGy0a_area{touch-action:none;place-items:center;display:grid;position:absolute;inset:0;overflow:hidden}.SKGy0a_area[data-annotating]{cursor:crosshair}.SKGy0a_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}.SKGy0a_canvas{background:#000;max-width:none;display:block}.SKGy0a_error{color:#ff8a80;margin:0;padding:4px 12px;font-size:13px}.SKGy0a_compose{flex:1 0 100%;gap:8px;display:flex}.SKGy0a_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}.SKGy0a_message::placeholder{color:#ffffff8c}.SKGy0a_primary:disabled{opacity:.5;cursor:default}.SKGy0a_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%)}.SKGy0a_cropHint,.SKGy0a_cropSize{color:#ffffffbf;font-size:13px}.SKGy0a_cropSize{font-variant-numeric:tabular-nums}.SKGy0a_wide .SKGy0a_compose{flex:320px}`,document.head.appendChild(e)}var J={area:`SKGy0a_area`,bar:`SKGy0a_bar`,bottom:`SKGy0a_bottom`,canvas:`SKGy0a_canvas`,compose:`SKGy0a_compose`,cropHint:`SKGy0a_cropHint`,cropSize:`SKGy0a_cropSize`,error:`SKGy0a_error`,hidden:`SKGy0a_hidden`,hint:`SKGy0a_hint`,message:`SKGy0a_message`,primary:`SKGy0a_primary`,root:`SKGy0a_root`,spacer:`SKGy0a_spacer`,stage:`SKGy0a_stage`,swatch:`SKGy0a_swatch`,text:`SKGy0a_text`,top:`SKGy0a_top`,wide:`SKGy0a_wide`,zoomBadge:`SKGy0a_zoomBadge`};function Nu(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 Pu,Fu=`codexhost.screenshot.zoom-hint`,Iu=[`pen`,`rect`,`arrow`];function Lu(e){let[t,n]=(0,s.useState)();return(0,s.useEffect)(()=>{let t=!0,r=new Image;return r.onload=()=>{t&&n(r)},r.src=e,()=>{t=!1}},[e]),t}function Ru({src:e,t,onClose:n,onAttach:r,onSend:a}){let[o,l]=(0,s.useState)(),u=Lu(o?.url??e),[d,f]=(0,s.useState)(Pu??0),p=e=>{Pu=e,f(e)},[m,h]=(0,s.useState)(!1),[g,_]=(0,s.useState)(!1),[v,y]=(0,s.useState)(),b=(0,s.useRef)(0),x=(0,s.useRef)(),[S,C]=(0,s.useState)(`pen`),[w,T]=(0,s.useState)(Cu[0]),[E,D]=(0,s.useState)([]),[O,k]=(0,s.useState)(),[ee,A]=(0,s.useState)(),[j,te]=(0,s.useState)(!0),M=(0,s.useRef)(),[ne,N]=(0,s.useState)(``),[re,ie]=(0,s.useState)(!1),[ae,oe]=(0,s.useState)(()=>{try{return localStorage.getItem(Fu)!==`1`}catch{return!1}}),[se,ce]=(0,s.useState)(!1),le=(0,s.useRef)(),ue=(0,s.useRef)(null),[de,fe]=(0,s.useState)(()=>Nu(!1)),[pe,me]=(0,s.useState)({width:0,height:0}),he=(0,s.useRef)(null),ge=(0,s.useRef)(null),_e=(0,s.useRef)(null);(0,s.useEffect)(()=>{let e=()=>fe(Nu(se));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)}},[se,d]),(0,s.useEffect)(()=>{let e=ge.current;if(e===null)return;let t=new ResizeObserver(()=>me({width:e.clientWidth,height:e.clientHeight}));return t.observe(e),()=>t.disconnect()},[]),(0,s.useEffect)(()=>()=>{o!==void 0&&URL.revokeObjectURL(o.url)},[o]),(0,s.useEffect)(()=>_e.current?.focus(),[]),(0,s.useEffect)(()=>{let e=document.body.style.overflow;return document.body.style.overflow=`hidden`,()=>{document.body.style.overflow=e,clearTimeout(le.current)}},[]),(0,s.useEffect)(()=>{if(!ae)return;try{localStorage.setItem(Fu,`1`)}catch{}let e=setTimeout(()=>oe(!1),4500);return()=>clearTimeout(e)},[ae]);let ve=(0,s.useRef)({annotating:m,cropping:g,onClose:n});ve.current={annotating:m,cropping:g,onClose:n},(0,s.useEffect)(()=>{let e=e=>{e.key===`Escape`&&(e.stopPropagation(),ve.current.annotating?h(!1):ve.current.cropping?He():ve.current.onClose())};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[]);let ye=u===void 0||pe.width===0?0:Math.min(pe.width/u.naturalWidth,pe.height/u.naturalHeight),[be,xe]=(0,s.useState)(1),[Se,Ce]=(0,s.useState)({x:0,y:0}),we=(0,s.useRef)(/* @__PURE__ */ new Map),Te=(0,s.useRef)(),Ee=(0,s.useRef)(),De=(0,s.useRef)({zoom:be,pan:Se,rotation:d});De.current={zoom:be,pan:Se,rotation:d};let Oe=(e,t)=>{let n=ge.current?.getBoundingClientRect();return n===void 0?{x:0,y:0}:wu(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*ye*t,r=u===void 0?0:u.naturalHeight*ye*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;xe(r),Ce(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=()=>{xe(1),Ce({x:0,y:0})},Me=u===void 0?4:Tu(u.naturalWidth);(0,s.useEffect)(()=>{let e=he.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])Eu(t,e,Me);g&&v!==void 0&&ju(t,v,{width:e.width,height:e.height},1/Math.max(be*ye,.01))}},[u,E,O,Me,g,v,be,ye]),(0,s.useEffect)(()=>{let e=ge.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||ye===0)return;let t=Oe(e.clientX,e.clientY),n=(t.x-Se.x)/(be*ye)+u.naturalWidth/2,r=(t.y-Se.y)/(be*ye)+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]=[...we.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:be,pan:Se},Ee.current=void 0,k(void 0))},Fe=e=>{if(e.target.closest(`button`)===null){if(e.currentTarget.setPointerCapture(e.pointerId),we.current.set(e.pointerId,{x:e.clientX,y:e.clientY}),we.current.size===1?M.current={x:e.clientX,y:e.clientY,at:Date.now(),multi:!1}:M.current!==void 0&&(M.current.multi=!0),we.current.size===2)Pe();else if(!(we.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:Ou(n,t,28/(be*ye));n!==void 0&&r!==void 0&&r!==`inside`?x.current={kind:`resize`,anchor:ku(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(Du(t,t,{width:u.naturalWidth,height:u.naturalHeight})))}else if(m){let t=Ne(e);t!==void 0&&k({tool:S,color:w,points:[t]})}else Ee.current={at:Oe(e.clientX,e.clientY),pan:Se}}}},Ie=e=>{if(!we.current.has(e.pointerId))return;we.current.set(e.pointerId,{x:e.clientX,y:e.clientY});let t=Te.current;if(t!==void 0&&we.current.size>=2){let[e,n]=[...we.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;xe(a),Ce(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(Du(r.kind===`new`?r.from:r.anchor,t,n))}else if(O!==void 0){let t=Ne(e);if(t===void 0)return;k({...O,points:O.tool===`pen`?[...O.points,t]:[O.points[0]??t,t]})}else if(Ee.current!==void 0&&be>1){let t=Oe(e.clientX,e.clientY);Ce(ke({x:Ee.current.pan.x+t.x-Ee.current.at.x,y:Ee.current.pan.y+t.y-Ee.current.at.y},be))}},Le=(e,t)=>{if(!we.current.has(e.pointerId))return;we.current.delete(e.pointerId);let n=M.current;!t&&n!==void 0&&!n.multi&&we.current.size===0&&!m&&!g&&Date.now()-n.at<500&&Math.hypot(e.clientX-n.x,e.clientY-n.y)<8&&te(e=>!e),we.current.size===0&&(M.current=void 0),we.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]),k(void 0)},Re=()=>{we.current.clear(),Te.current=void 0,Ee.current=void 0,x.current=void 0,M.current=void 0,k(void 0)},ze=()=>{clearTimeout(le.current),ue.current?.blur(),ce(!1)},Be=e=>{ze(),Re(),e===`annotate`?h(!0):Ve()};(0,s.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?A(t(`desktop.annotate.failed`)):(l({url:URL.createObjectURL(n),blob:n}),D([]),He(),je()))},`image/png`)},Ge=()=>{let e=he.current;if(e===null)return;if(E.length===0){h(!1);return}let n=++b.current;e.toBlob(e=>{n===b.current&&(e===null?A(t(`desktop.annotate.failed`)):(l({url:URL.createObjectURL(e),blob:e}),D([]),h(!1)))},`image/png`)},Ke=async()=>{try{let t=r(o?.blob??await(await fetch(e)).blob());t===null?n():A(t)}catch{A(t(`desktop.annotate.failed`))}},qe=async()=>{if(!re){ie(!0),A(void 0);try{let t=await a(o?.blob??await(await fetch(e)).blob(),ne.trim());t===null?n():A(t)}catch{A(t(`desktop.annotate.failed`))}finally{ie(!1)}}},Je=async()=>{try{let t=o?.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{A(t(`desktop.save.failed`))}},Ye=d!==0,Xe=m||g,Ze={left:de.x+de.width/2,top:de.y+de.height/2,width:Ye?de.height:de.width,height:Ye?de.width:de.height,transform:Ye?`translate(-50%, -50%) rotate(${String(d)}deg)`:`translate(-50%, -50%)`};return(0,c.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} ${j||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:_e,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:ge,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&&ye>0&&/* @__PURE__ */ (0,i.jsx)(`canvas`,{ref:he,className:J.canvas,style:{width:u.naturalWidth*ye,height:u.naturalHeight*ye,transform:`translate(${String(Se.x)}px, ${String(Se.y)}px) scale(${String(be)})`},role:`img`,"aria-label":t(`desktop.primary`)}),be!==1&&/* @__PURE__ */ (0,i.jsxs)(`button`,{type:`button`,className:J.zoomBadge,onClick:je,children:[String(Math.round(be*100)),`% · `,t(`desktop.zoom.fit`)]})]}),ae&&/* @__PURE__ */ (0,i.jsx)(`p`,{className:J.hint,role:`status`,children:t(`desktop.hint`)}),/* @__PURE__ */ (0,i.jsxs)(`div`,{className:`${J.bottom} ${j||Xe?``:J.hidden} ${Ye?J.wide:``}`,children:[ee!==void 0&&/* @__PURE__ */ (0,i.jsx)(`p`,{role:`alert`,className:J.error,children:ee}),/* @__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:[Iu.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}),Cu.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:ue,className:J.message,type:`text`,value:ne,enterKeyHint:`send`,placeholder:t(`desktop.message.placeholder`),"aria-label":t(`desktop.message.placeholder`),onFocus:()=>{clearTimeout(le.current),f(0),ce(!0)},onBlur:()=>{clearTimeout(le.current),le.current=setTimeout(()=>{ce(!1),window.scrollTo(0,0)},400)},onChange:e=>N(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.nativeEvent.isComposing&&qe()}}),/* @__PURE__ */ (0,i.jsx)(`button`,{type:`button`,className:J.primary,disabled:re,onClick:()=>void qe(),children:t(`desktop.send`)})]}),o!==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 zu=`@deepseek-ai/dsh-client-ui-codexhost/DesktopScreenshot.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=`.DST6ca_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}.DST6ca_entryBusy{gap:4px;width:auto;min-width:28px;padding:0 6px}.DST6ca_entry:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover)}.DST6ca_entry:disabled{opacity:.45;cursor:default}.DST6ca_entry[aria-busy=true]{opacity:1;cursor:progress}.DST6ca_spinner{flex:none;animation:.8s linear infinite DST6ca_spin;display:inline-flex}.DST6ca_float{z-index:40;touch-action:none;-webkit-user-select:none;user-select:none;width:60px;height:60px;position:fixed}.DST6ca_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}.DST6ca_bubble[data-error]{border-color:var(--dsw-alias-state-error-primary)}.DST6ca_bubble img{object-fit:cover;pointer-events:none;width:100%;height:100%;position:absolute;inset:0}.DST6ca_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}.DST6ca_elapsed{font-variant-numeric:tabular-nums;font-size:11px}.DST6ca_alert{color:var(--dsw-alias-state-error-primary);font-size:22px;font-weight:600}.DST6ca_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}.DST6ca_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 DST6ca_spin{to{transform:rotate(360deg)}}@media (prefers-reduced-motion:reduce){.DST6ca_spinner{animation:none}}@media (pointer:coarse){.DST6ca_entry{width:40px;height:44px}.DST6ca_entryBusy{width:auto;min-width:40px}}`,document.head.appendChild(e)}var Bu={alert:`DST6ca_alert`,bubble:`DST6ca_bubble`,busy:`DST6ca_busy`,caption:`DST6ca_caption`,dismiss:`DST6ca_dismiss`,elapsed:`DST6ca_elapsed`,entry:`DST6ca_entry`,entryBusy:`DST6ca_entryBusy`,float:`DST6ca_float`,spin:`DST6ca_spin`,spinner:`DST6ca_spinner`};function Vu({screenshot:e,registerSource:t,sessionId:n,overflowActions:a=!1,t:o}){let c=(0,s.useSyncExternalStore)(e.subscribe,e.getSnapshot),l=(0,s.useId)(),u=(0,s.useCallback)(()=>{n!==void 0&&e.refresh(n)},[e,n]),d=(0,s.useRef)({sessionId:n,overflowActions:a,t:o,capture:u});d.current={sessionId:n,overflowActions:a,t:o,capture:u},(0,s.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:Hu}];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,s.useLayoutEffect)(()=>()=>{n!==void 0&&e.close(n)},[e,n]);let f=Uu(c.startedAt);return n===void 0?null:/* @__PURE__ */ (0,i.jsx)(r.Tooltip,{portal:!0,disabled:a,side:`top`,label:o(c.pending?`desktop.pending`:`desktop.label`),children:/* @__PURE__ */ (0,i.jsx)(`button`,{type:`button`,className:c.pending?`${Bu.entry} ${Bu.entryBusy}`:Bu.entry,"aria-label":o(`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:Bu.spinner,"aria-hidden":`true`,children:/* @__PURE__ */ (0,i.jsx)(r.IconLoadingOutlineRegular,{size:16})}),/* @__PURE__ */ (0,i.jsxs)(`span`,{className:Bu.elapsed,children:[f,`s`]})]}):/* @__PURE__ */ (0,i.jsx)(Hu,{size:16})})})}function Hu({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 Uu(e){let[t,n]=(0,s.useState)(()=>Date.now());return(0,s.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 Wu;function Gu(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 Ku(){return{x:window.innerWidth-60-12,y:72}}function qu({screenshot:e,drafts:t,inputActions:n,useInput:a,sessionId:o,t:l}){let u=(0,s.useSyncExternalStore)(e.subscribe,e.getSnapshot),{image:d,pending:f,progress:p,error:m}=u,h=Uu(u.startedAt),[g,_]=(0,s.useState)(()=>Gu(Wu??Ku())),[v,y]=(0,s.useState)(!1),b=a(e=>e.draft),x=(0,s.useRef)(d?.url);(0,s.useEffect)(()=>{d!==void 0&&d.url!==x.current&&(x.current=d.url,y(!0))},[d]);let S=(0,s.useRef)();if((0,s.useEffect)(()=>{let e=()=>_(e=>Gu(e));return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]),o===void 0||u.sessionId!==o||d===void 0&&!f&&m===void 0)return null;let C=()=>{f||(m!==void 0||d===void 0?e.refresh(o):y(!0))},w=e=>{let r=new File([e],`desktop-screenshot-${String(Date.now())}.png`,{type:`image/png`}),i=t.create(o,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:Ju(p.loaded),total:p.total===void 0?`?`:Ju(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,_(Gu({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?Wu=g:t||C())};return(0,c.createPortal)(/* @__PURE__ */ (0,i.jsxs)(i.Fragment,{children:[/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Bu.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:Bu.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:Bu.busy,children:[/* @__PURE__ */ (0,i.jsx)(`span`,{className:Bu.spinner,"aria-hidden":`true`,children:/* @__PURE__ */ (0,i.jsx)(r.IconLoadingOutlineRegular,{size:16})}),/* @__PURE__ */ (0,i.jsxs)(`span`,{className:Bu.elapsed,children:[h,`s`]})]}),!f&&m!==void 0&&/* @__PURE__ */ (0,i.jsx)(`span`,{className:Bu.alert,children:`!`})]}),/* @__PURE__ */ (0,i.jsx)(`button`,{type:`button`,className:Bu.dismiss,"data-float-close":!0,"aria-label":l(`desktop.close`),onClick:()=>e.close(o),children:/* @__PURE__ */ (0,i.jsx)(r.IconCloseOutlineRegular,{size:10})}),m!==void 0&&!f&&/* @__PURE__ */ (0,i.jsx)(`p`,{role:`status`,className:Bu.caption,children:l(`desktop.error.${m}`)})]}),v&&d!==void 0&&/* @__PURE__ */ (0,i.jsx)(Ru,{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 Ju(e){return`${(e/1048576).toFixed(1)} MB`}var Yu=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 Xu=`@deepseek-ai/dsh-client-ui-codexhost/VoiceInput.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Xu)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-codexhost`,e.dataset.pluginCss=Xu,e.textContent=`.SCfLla_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}.SCfLla_entry[data-live]{width:var(--voice-bar-width)}.SCfLla_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}.SCfLla_icon:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}.SCfLla_icon:disabled{color:var(--dsw-alias-label-dimmed);cursor:default}.SCfLla_icon:focus-visible,.SCfLla_round:focus-visible,.SCfLla_send:focus-visible,.SCfLla_done:focus-visible,.SCfLla_primary:focus-visible,.SCfLla_secondary:focus-visible,.SCfLla_quietButton:focus-visible{box-shadow:0 0 0 2px var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary))}.SCfLla_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}.SCfLla_round,.SCfLla_send,.SCfLla_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}.SCfLla_round:hover:not(:disabled),.SCfLla_done:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover-solid);color:var(--dsw-alias-label-primary)}.SCfLla_meter{justify-content:center;align-items:center;min-width:0;height:28px;display:flex}.SCfLla_wave,.SCfLla_quiet{flex:none;width:90px;height:20px}.SCfLla_wave{color:var(--dsw-alias-label-secondary);fill:none;stroke:currentColor;stroke-width:1.6px;stroke-linecap:round}.SCfLla_quiet{color:var(--dsw-alias-label-tertiary);text-overflow:ellipsis;white-space:nowrap;line-height:20px;overflow:hidden}.SCfLla_status{white-space:nowrap;justify-content:center;align-items:center;gap:5px;max-width:100%;font-size:11px;display:inline-flex}.SCfLla_statusText{text-overflow:ellipsis;min-width:0;overflow:hidden}.SCfLla_sendFace,.SCfLla_doneFace{border-radius:50%;justify-content:center;align-items:center;width:24px;height:24px;display:flex}.SCfLla_sendFace{background:var(--dsw-alias-button-info-fill);color:#fff}.SCfLla_doneFace{background:var(--dsw-specific-input-major);color:var(--dsw-alias-label-primary)}.SCfLla_send:hover:not(:disabled){filter:brightness(1.08)}.SCfLla_send:disabled,.SCfLla_done:disabled{opacity:.4;cursor:default}.SCfLla_spinner{border:1.5px solid;border-right-color:#0000;border-radius:50%;flex:none;width:10px;height:10px;animation:.8s linear infinite SCfLla_spin}.SCfLla_timer{width:34px;color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums;text-align:center;flex:none;font-size:11px}.SCfLla_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}.SCfLla_strip .SCfLla_round,.SCfLla_strip .SCfLla_done{width:26px;height:26px;position:relative}.SCfLla_strip .SCfLla_round:before,.SCfLla_strip .SCfLla_done:before{content:"";position:absolute;inset:-9px}.SCfLla_strip .SCfLla_meter{flex:1}.SCfLla_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}.SCfLla_notice[data-tone=error]{background:color-mix(in srgb, var(--dsw-alias-state-error-primary) 10%, transparent);color:var(--dsw-alias-label-primary)}.SCfLla_notice p{flex:220px;margin:0}.SCfLla_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}.SCfLla_cardHead{color:var(--dsw-alias-label-tertiary);align-items:center;gap:6px;font-size:12px;display:flex}.SCfLla_cardText{white-space:pre-wrap;max-height:120px;margin:0;font-size:14px;line-height:21px;overflow:auto}.SCfLla_actions{flex-wrap:wrap;justify-content:flex-end;gap:8px;display:flex}.SCfLla_primary,.SCfLla_secondary,.SCfLla_quietButton{height:28px;font:inherit;cursor:pointer;border-radius:999px;outline:none;padding:0 12px;font-size:13px}.SCfLla_primary{background:var(--dsw-alias-label-primary);color:var(--dsw-alias-bg-base);border:none}.SCfLla_secondary{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-base);color:var(--dsw-alias-label-primary)}.SCfLla_quietButton{color:var(--dsw-alias-label-secondary);background:0 0;border:none}.SCfLla_secondary:hover,.SCfLla_quietButton:hover{background:var(--dsw-alias-interactive-bg-hover)}@keyframes SCfLla_spin{to{transform:rotate(360deg)}}@media (prefers-reduced-motion:reduce){.SCfLla_entry{transition:none}.SCfLla_spinner{animation:none}}@media (width<=600px),(pointer:coarse){.SCfLla_entry{--voice-entry-size:44px}.SCfLla_strip{margin-block:7px}.SCfLla_icon{width:44px;height:44px}.SCfLla_primary,.SCfLla_secondary,.SCfLla_quietButton{height:40px;padding:0 14px}}`,document.head.appendChild(e)}var Y={actions:`SCfLla_actions`,bar:`SCfLla_bar`,card:`SCfLla_card`,cardHead:`SCfLla_cardHead`,cardText:`SCfLla_cardText`,done:`SCfLla_done`,doneFace:`SCfLla_doneFace`,entry:`SCfLla_entry`,icon:`SCfLla_icon`,meter:`SCfLla_meter`,notice:`SCfLla_notice`,primary:`SCfLla_primary`,quiet:`SCfLla_quiet`,quietButton:`SCfLla_quietButton`,round:`SCfLla_round`,secondary:`SCfLla_secondary`,send:`SCfLla_send`,sendFace:`SCfLla_sendFace`,spin:`SCfLla_spin`,spinner:`SCfLla_spinner`,status:`SCfLla_status`,statusText:`SCfLla_statusText`,strip:`SCfLla_strip`,timer:`SCfLla_timer`,wave:`SCfLla_wave`};let Zu=typeof navigator<`u`&&/Mac|iPhone|iPad/.test(navigator.platform)?[`⌘`,`⇧`,`Space`]:[`Ctrl`,`Shift`,`Space`];function Qu(e){return(0,s.useSyncExternalStore)(e.subscribe,e.getSnapshot)}var $u=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 ed=e=>e.phase===`permission`||e.phase===`recording`||e.phase===`transcribing`,td=e=>`${Math.floor(e/60)}:${String(e%60).padStart(2,`0`)}`;function nd({voice:e,blocks:t,tray:n,sessionId:a,inputActions:o,useInput:c,useSession:l,t:u}){let d=Qu(e),[f,p]=(0,s.useState)(!1),m=(0,s.useSyncExternalStore)(n.subscribe,n.getSnapshot),h=(0,s.useRef)(null),g=ed(d),_=g||f&&d.phase===`idle`,v=(0,s.useMemo)(()=>t.storeFor(a),[t,a]),y=(0,s.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,s.useLayoutEffect)(()=>e.bind(o,S,f),[e,o,S,f]),(0,s.useLayoutEffect)(()=>{if(g)return o.bindPrimaryAction({disabled:d.phase!==`recording`,run:()=>e.send()})},[e,o,g,d.phase]),(0,s.useEffect)(()=>{let e=!0,t=0,n=()=>{let n=++t;Yl.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,s.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)(id,{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:Zu,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 rd({voice:e,tray:t,onActiveChange:n,t:r}){let a=Qu(e),o=(0,s.useSyncExternalStore)(t.subscribe,t.getSnapshot)&&ed(a);return(0,s.useLayoutEffect)(()=>n(o),[o,n]),(0,s.useLayoutEffect)(()=>()=>n(!1),[n]),o?/* @__PURE__ */ (0,i.jsx)(id,{voice:e,state:a,locked:!1,layout:`strip`,t:r}):null}function id({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:td(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)(ad,{})})})}):null,/* @__PURE__ */ (0,i.jsx)(r.Tooltip,{portal:!0,side:`top`,label:o(`voice.stop`),shortcutKeys:Zu,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 ad(){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 od({voice:e,t}){let n=Qu(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:td(n.seconds)})}),/* @__PURE__ */ (0,i.jsx)(`button`,{type:`button`,className:Y.primary,onClick:()=>e.undo(),children:t(`voice.undo`)}),/* @__PURE__ */ (0,i.jsx)(sd,{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)(sd,{label:t(`voice.discard`),onClick:e.discard})]})}function sd({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 cd({size:e}){return/* @__PURE__ */ (0,i.jsx)(r.IconDownloadOutlineRegular,{size:e})}function ld({size:e,renderAction:t,openSection:n,t:r}){let[a,o]=(0,s.useState)(!1);return(0,s.useEffect)(()=>{let e=new AbortController;return eu(e.signal).then(t=>{e.signal.aborted||o(t)}).catch(()=>void 0),()=>e.abort()},[]),a?t({label:r(`remoteAccess`),onClick:()=>n(`codexhost-connect-devices`),icon:/* @__PURE__ */ (0,i.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,fill:`none`,"aria-hidden":`true`,children:[/* @__PURE__ */ (0,i.jsx)(`rect`,{x:`6`,y:`2`,width:`12`,height:`20`,rx:`3`,stroke:`currentColor`,strokeWidth:`1.6`}),/* @__PURE__ */ (0,i.jsx)(`path`,{d:`M10 5h4M11 19h2`,stroke:`currentColor`,strokeWidth:`1.6`,strokeLinecap:`round`})]})}):null}function ud({sessionId:e,list:t}){let n=(0,s.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:n.id===`codex`?/* @__PURE__ */ (0,i.jsx)(`img`,{src:`/harness-icons/codex`,width:14,height:14,alt:``,"data-native-codex-icon":!0}):/* @__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 dd=`@deepseek-ai/dsh-client-ui-codexhost/HostConnectionStatus.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(dd)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-codexhost`,e.dataset.pluginCss=dd,e.textContent=`.dKjwwa_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}.dKjwwa_copy{overflow-wrap:anywhere;flex-wrap:wrap;gap:4px 12px;min-width:0;display:flex}.dKjwwa_detail{color:var(--dsw-alias-label-tertiary)}.dKjwwa_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}.dKjwwa_retry:hover{background:var(--dsw-alias-interactive-bg-hover)}.dKjwwa_retry:focus-visible{outline-offset:2px;outline:2px solid}`,document.head.appendChild(e)}var fd={copy:`dKjwwa_copy`,detail:`dKjwwa_detail`,retry:`dKjwwa_retry`,status:`dKjwwa_status`};function pd(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 md(){let e=/iPad|iPhone|iPod/u.test(navigator.userAgent),t=window.matchMedia(`(display-mode: standalone)`).matches||navigator.standalone===!0;return e&&!t}async function hd(){return await navigator.serviceWorker.getRegistration(`./`)??await navigator.serviceWorker.register(`sw.js`,{scope:`./`})}async function gd(){return!(`serviceWorker`in navigator)||!(`PushManager`in window)||!(`Notification`in window)?md()?`needs-install`:`unsupported`:Notification.permission===`denied`?`denied`:await(await navigator.serviceWorker.getRegistration(`./`))?.pushManager.getSubscription()==null?`off`:`on`}async function _d(){let e=await hd();await navigator.serviceWorker.ready;let t=await e.pushManager.getSubscription();if(t===null){let{publicKey:n}=await nu.config();t=await e.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:pd(n)})}await nu.subscribe(t.toJSON())}async function vd(){let e=await Notification.requestPermission();return e===`granted`?(await _d(),`on`):e===`denied`?`denied`:`off`}async function yd(){let e=await(await navigator.serviceWorker.getRegistration(`./`))?.pushManager.getSubscription();return e!=null&&(await nu.unsubscribe(e.endpoint),await e.unsubscribe()),`off`}function bd(){`serviceWorker`in navigator&&hd().catch(()=>void 0)}function xd(){`serviceWorker`in navigator&&`PushManager`in window&&`Notification`in window&&Notification.permission===`granted`&&_d().catch(()=>void 0)}let Sd=5e3,Cd=(0,o.createSnapshotStore)(!1);function wd(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(Sd)});if(e.status===401){window.location.reload();return}s=e.status===200}catch{}n=!1,!(r||e.getSnapshot()!==`connecting`)&&(s&&(i=0,Cd.set(!1)),t=setTimeout(()=>{s||(i+=1,Cd.set(i>=2)),a()},Math.max(0,Sd-(Date.now()-o))))},o=()=>{e.getSnapshot()===`connecting`?a():(clearTimeout(t),i=0,Cd.set(!1))},s=e.subscribe(o);return o(),()=>{r=!0,clearTimeout(t),Cd.set(!1),s()}}async function Td(){await yd().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:o}){let c=(0,s.useSyncExternalStore)(a.state.subscribe,a.state.getSnapshot),l=(0,s.useSyncExternalStore)(Cd.subscribe,Cd.getSnapshot),u=(0,s.useSyncExternalStore)(e=>n.subscribe(e),()=>e===void 0?void 0:n.getSnapshot().byId[e]?.projectionValues?.nativeConnection?.state),d=(0,s.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,s.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:fd.status,role:`status`,"data-web-connection":v,"data-native-connection":u===`reconnecting`?u:void 0,children:[/* @__PURE__ */ (0,i.jsxs)(`div`,{className:fd.copy,children:[/* @__PURE__ */ (0,i.jsx)(`span`,{children:o(`connection.${v}`)}),y===void 0?null:/* @__PURE__ */ (0,i.jsx)(`span`,{className:fd.detail,children:o(`connection.lastSynced`,{time:new Date(y).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})})})]}),/* @__PURE__ */ (0,i.jsx)(`button`,{type:`button`,className:fd.retry,onClick:()=>a.reconnect(),children:o(`connection.retry`)})]}):null,d&&p!==h?/* @__PURE__ */ (0,i.jsx)(r.Toast,{text:d,holdMs:8e3,onDone:()=>m(h)},h):null]})}function Dd({navigation:e,t}){let n=(0,s.useSyncExternalStore)(e.opening.subscribe,e.opening.getSnapshot);return n.state===`idle`?null:/* @__PURE__ */ (0,i.jsxs)(`div`,{className:fd.status,role:n.state===`error`?`alert`:`status`,"data-session-opening":n.state,children:[/* @__PURE__ */ (0,i.jsxs)(`div`,{className:fd.copy,children:[/* @__PURE__ */ (0,i.jsx)(`span`,{children:t(n.state===`loading`?`opening.loading`:`opening.error`)}),/* @__PURE__ */ (0,i.jsx)(`span`,{className:fd.detail,children:n.sessionId}),n.state===`error`?/* @__PURE__ */ (0,i.jsx)(`span`,{className:fd.detail,children:n.message}):null]}),n.state===`error`?/* @__PURE__ */ (0,i.jsx)(`button`,{type:`button`,className:fd.retry,onClick:()=>e.retryOpening(),children:t(`connection.retry`)}):null]})}let Od=`@deepseek-ai/dsh-client-ui-codexhost/HostUsageDock.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Od)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-codexhost`,e.dataset.pluginCss=Od,e.textContent=`.prdDAG_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}.prdDAG_anchor[data-composer-stat=codexhost-quota]{order:-1}.prdDAG_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}.prdDAG_pill:hover,.prdDAG_pill:focus-visible,.prdDAG_pill[aria-expanded=true]{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-secondary)}.prdDAG_label{text-overflow:ellipsis;min-width:0;overflow:hidden}.prdDAG_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}.prdDAG_panel header{color:var(--dsw-alias-label-primary);font-size:16px;font-weight:500;line-height:22px}.prdDAG_context{margin-top:10px}.prdDAG_contextRow{color:var(--dsw-alias-label-tertiary);justify-content:space-between;align-items:center;gap:20px;display:flex}.prdDAG_contextRow strong{color:var(--dsw-alias-label-primary);font-variant-numeric:tabular-nums;font-weight:400}.prdDAG_progressTrack{background:var(--dsw-alias-interactive-bg-hover);border-radius:999px;height:4px;margin-top:6px;overflow:hidden}.prdDAG_progressFill{border-radius:inherit;background:var(--dsw-alias-label-secondary);height:100%;display:block}.prdDAG_group{margin-top:12px}.prdDAG_group h3{color:var(--dsw-alias-label-tertiary);margin:0 0 5px;font-size:12px;font-weight:600}.prdDAG_group dl{gap:5px;margin:0;display:grid}.prdDAG_detail{grid-template-columns:minmax(120px,auto) minmax(0,1fr);gap:0 16px;display:grid}.prdDAG_detail dt,.prdDAG_detail dd,.prdDAG_detail p{min-width:0;margin:0}.prdDAG_detail dt{color:var(--dsw-alias-label-tertiary)}.prdDAG_detail dd{color:var(--dsw-alias-label-secondary);font-variant-numeric:tabular-nums;text-align:right}.prdDAG_detail p{color:var(--dsw-alias-label-tertiary);text-align:right;overflow-wrap:anywhere;grid-column:1/-1;font-size:11px}.prdDAG_quotaRing{fill:none;stroke:#399b69;stroke-width:3px;flex-shrink:0;width:16px;height:16px}.prdDAG_ringTrack{stroke:var(--dsw-alias-interactive-bg-hover)}.prdDAG_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}.prdDAG_quotaRow+.prdDAG_quotaRow,.prdDAG_quotaGroup+.prdDAG_quotaGroup{margin-top:11px}.prdDAG_quotaHeading{justify-content:space-between;align-items:flex-start;gap:12px;margin-bottom:5px;font-size:12px;display:flex}.prdDAG_quotaDescription{min-width:0}.prdDAG_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}.prdDAG_quotaGroup:first-child .prdDAG_quotaRow:first-child .prdDAG_quotaDescription>span{font-size:12.5px;font-weight:600}.prdDAG_quotaGroup:first-child .prdDAG_quotaRow:first-child .prdDAG_remainingLabel{opacity:.8;font-size:11px;font-weight:600}.prdDAG_quotaGroup:first-child .prdDAG_quotaRow:first-child .prdDAG_remainingValue{font-size:26px;font-weight:700}.prdDAG_quotaRow p{color:color-mix(in srgb, currentColor 62%, transparent);margin:0;font-size:10.5px}.prdDAG_quotaGroup:first-child .prdDAG_quotaRow:first-child p{font-size:11px}.prdDAG_quotaPanel .prdDAG_progressTrack{background:color-mix(in srgb, currentColor 16%, transparent);height:6px;margin-top:0}.prdDAG_quotaFill{border-radius:inherit;background:var(--quota-color);height:100%;display:block}@media (width<=640px){.prdDAG_anchor{max-width:min(280px,56vw)}}`,document.head.appendChild(e)}var X={anchor:`prdDAG_anchor`,context:`prdDAG_context`,contextRow:`prdDAG_contextRow`,detail:`prdDAG_detail`,group:`prdDAG_group`,label:`prdDAG_label`,panel:`prdDAG_panel`,pill:`prdDAG_pill`,progressFill:`prdDAG_progressFill`,progressTrack:`prdDAG_progressTrack`,quotaDescription:`prdDAG_quotaDescription`,quotaFill:`prdDAG_quotaFill`,quotaGroup:`prdDAG_quotaGroup`,quotaHeading:`prdDAG_quotaHeading`,quotaPanel:`prdDAG_quotaPanel`,quotaRing:`prdDAG_quotaRing`,quotaRow:`prdDAG_quotaRow`,remainingLabel:`prdDAG_remainingLabel`,remainingValue:`prdDAG_remainingValue`,ringTrack:`prdDAG_ringTrack`};let kd={visibility:`hidden`,left:0,top:0};function Ad(e,t=1){return e.toFixed(t).replace(/\.?0+$/u,``)}function jd(e){return e<1e3?String(Math.round(e)):e<1e6?`${Ad(e/1e3)}K`:e<1e9?`${Ad(e/1e6)}M`:`${Ad(e/1e9)}B`}function Md(e){return`${Ad(e)}%`}function Nd(e){return e.contextUsagePercent??(e.contextUsedTokens!==void 0&&e.contextWindowTokens!==void 0?e.contextUsedTokens/e.contextWindowTokens*100:void 0)}function Pd(e,t){return`${e>=100?Math.round(e):Ad(e)} ${t(`usage.unit.tps`)}`}function Fd(e,t){return e<1e3?`${Math.round(e)} ${t(`usage.unit.ms`)}`:`${Ad(e/1e3)} ${t(`usage.unit.seconds`)}`}function Id(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`:Ad(e,3)} ${t(`usage.unit.credits`)}`}function Rd(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 zd(e,t,n){return e===void 0||t===void 0?``:`${Ad(e,2)} / ${Ad(t,2)}${n?` ${n}`:``}`}function Bd(e,t){if(e===null)return[];let n=[e.cacheHitRatePercent===void 0?null:`${t(`usage.cache.short`)} ${Md(e.cacheHitRatePercent)}`,e.outputTokensPerSecond===void 0?e.apiOutputTokensPerSecond===void 0?null:`API ${Pd(e.apiOutputTokensPerSecond,t)}`:Pd(e.outputTokensPerSecond,t),Id(e)].filter(e=>e!==null);if(n.length>0)return n;if(e.totalTokens!==void 0)return[`${jd(e.totalTokens)} ${t(`usage.unit.tokens`)}`];let r=Nd(e);return r===void 0?[]:[`${t(`usage.context`)}: ${Md(r)}`]}function Vd(e,t){let n=[];if(e!==null){let r=[],i=Id(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:Md(e.sessionCacheHitRatePercent)}),e.cacheHitRatePercent!==void 0&&r.push({label:t(`usage.cache.latest`),value:Md(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:Pd(e.apiOutputTokensPerSecond,t)}):a.push({label:t(`usage.speed`),value:Pd(e.outputTokensPerSecond,t)}),e.timeToFirstOutputMs!==void 0&&a.push({label:t(`usage.ttft`),value:Fd(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?`—`:jd(e.inputTokens)} / ${e.outputTokens===void 0?`—`:jd(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?`—`:jd(e.cachedInputTokens)} / ${jd(e.cacheWriteInputTokens)}`:jd(e.cachedInputTokens??0)}),e.totalTokens!==void 0&&o.push({label:t(`usage.tokens.total`),value:jd(e.totalTokens)}),o.length&&n.push({label:t(`usage.group.tokens`),rows:o})}return n}function Hd(e){return Math.min(100,Math.max(0,100-e))}function Ud(e){return e<=10?`#c45c4a`:e<=30?`#c9a227`:`#3d9a64`}function Wd(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=Rd(a,n);t.push({label:r,value:Md(Hd(i)),remaining:Hd(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=zd(t.used,t.limit,t.unit);if(i.push({label:e(t.periodType,t.label??n(`usage.group.quota`),t.scope),value:Md(Hd(t.usedPercent)),remaining:Hd(t.usedPercent),note:[a?`${n(`usage.quota`)}: ${a}`:null,Rd(t.resetsAt,n)].filter(Boolean).join(` · `)}),t.resetCredits){let e=Rd(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=zd(r.used,r.limit,r.unit);i.push({label:e(r.periodType,r.product,r.scope),value:Md(Hd(r.usagePercent)),remaining:Hd(r.usagePercent),note:[t?`${n(`usage.quota`)}: ${t}`:null,Rd(r.resetsAt,n)].filter(Boolean).join(` · `)})}i.length&&r.push({label:n(`usage.group.quota`),rows:i})}return r}function Gd({usage:e,t}){if(e===null)return null;let n=Nd(e);if(n===void 0)return null;let r=e.contextWindowTokens===void 0?Md(n):`${Md(n)} / ${jd(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 Kd({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 qd({useProjection:e,t}){let n=e(`codexhostUsage`),r=n?.usage??null,a=n?.accountCredits,o=(0,s.useMemo)(()=>Bd(r,t),[r,t]),c=(0,s.useMemo)(()=>Vd(r,t),[r,t]),l=(0,s.useMemo)(()=>Wd(r,a,t),[r,a,t]),u=l.flatMap(e=>e.rows).find(e=>e.remaining!==void 0),d=r!==null&&Nd(r)!==void 0,f=o.join(` · `);return/* @__PURE__ */ (0,i.jsxs)(i.Fragment,{children:[u&&/* @__PURE__ */ (0,i.jsx)(Jd,{stat:`codexhost-quota`,panelStyle:{"--quota-color":Ud(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:Ud(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":Ud(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))}),o.length>0&&(c.length>0||d)&&/* @__PURE__ */ (0,i.jsxs)(Jd,{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)(Gd,{usage:r,t}),/* @__PURE__ */ (0,i.jsx)(Kd,{groups:c})]})]})}function Jd({stat:e,label:t,title:n,trigger:a,children:o,panelStyle:l}){let[u,d]=(0,s.useState)(!1),f=(0,s.useRef)(!1),p=(0,s.useRef)(null),m=(0,s.useRef)(null),h=(0,s.useRef)(null),g=(0,r.useAnchoredPosition)({open:u,anchorRef:m,panelRef:h,side:`top`,gap:8,margin:12}),_=(0,s.useCallback)(()=>{f.current=!1,d(!1)},[]),v=(0,s.useCallback)(()=>{p.current!==null&&(window.clearTimeout(p.current),p.current=null)},[]),y=(0,s.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,s.useEffect)(()=>{if(!u)return;let e=e=>{e.key===`Escape`&&_()};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[_,u]),(0,s.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,c.createPortal)(/* @__PURE__ */ (0,i.jsx)(`div`,{ref:h,className:`${X.panel} ${e===`codexhost-quota`?X.quotaPanel:``}`,style:{...l,...g??kd},role:`dialog`,"aria-label":n,onPointerEnter:v,onPointerLeave:y,children:o}),document.body)]})}let Yd=`@deepseek-ai/dsh-client-ui-codexhost/ConnectDevicesSection.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Yd)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-codexhost`,e.dataset.pluginCss=Yd,e.textContent=`._5VGGma_page{flex-direction:column;gap:24px;min-width:0;display:flex}._5VGGma_header{flex-wrap:wrap;justify-content:space-between;align-items:flex-start;gap:12px;display:flex}._5VGGma_title{color:var(--dsw-alias-label-primary);margin:0 0 8px;font-size:22px;font-weight:600;line-height:30px}._5VGGma_description,._5VGGma_notice{color:var(--dsw-alias-label-secondary);overflow-wrap:anywhere;margin:0;font-size:13px;line-height:21px}._5VGGma_meta{color:var(--dsw-alias-label-tertiary);overflow-wrap:anywhere;margin:0;font-size:12px;line-height:19px}._5VGGma_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}._5VGGma_status:before{content:"";background:currentColor;border-radius:50%;width:5px;height:5px}._5VGGma_status[data-active=true]:before{background:#65af91}._5VGGma_connection{flex-direction:column;gap:24px;display:flex}._5VGGma_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}._5VGGma_scan{border-right:1px solid var(--dsw-alias-border-l2);flex:none;padding-right:24px}._5VGGma_connectionDetails{flex-direction:column;flex:1;gap:16px;min-width:0;display:flex}._5VGGma_qrButton{cursor:zoom-in;background:#fff;border:none;border-radius:12px;padding:8px;line-height:0;display:block;overflow:hidden}._5VGGma_qr{width:144px;height:144px;display:block}._5VGGma_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}._5VGGma_qrButton:focus-visible,._5VGGma_input:focus-visible{outline:2px solid var(--dsw-alias-label-secondary);outline-offset:3px}._5VGGma_routePanel{flex-direction:column;gap:10px;min-width:0;display:flex}._5VGGma_routes{border:0;min-width:0;margin:0;padding:0}._5VGGma_fieldTitle{color:var(--dsw-alias-label-primary);margin-bottom:10px;padding:0;font-size:13px;font-weight:600;line-height:20px;display:block}._5VGGma_routeGroup,._5VGGma_extraRoutes{flex-direction:column;gap:8px;display:flex}._5VGGma_routeGroup,._5VGGma_extraRoutes>._5VGGma_route{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-2);border-radius:10px}._5VGGma_routeGroup{gap:0;overflow:hidden}._5VGGma_routeFamily,._5VGGma_routeGroup>._5VGGma_route:not(:last-child){border-bottom:1px solid var(--dsw-alias-border-l2)}._5VGGma_extraRoutes>._5VGGma_route:has(input:checked){border-color:var(--dsw-alias-label-secondary)}._5VGGma_routeGroup>._5VGGma_route:has(input:checked),._5VGGma_routeFamily:has(._5VGGma_route input:checked){background:var(--dsw-alias-interactive-bg-hover)}._5VGGma_route{cursor:pointer;align-items:flex-start;gap:10px;padding:12px 16px;display:flex}._5VGGma_subRoutes{flex-wrap:wrap;gap:16px;padding:0 16px 12px 39px;display:flex}._5VGGma_subRoute{color:var(--dsw-alias-label-primary);cursor:pointer;align-items:center;gap:6px;font-size:12px;line-height:18px;display:flex}._5VGGma_subRoute input{accent-color:var(--dsw-alias-label-primary);margin:0}._5VGGma_extraRoutes>._5VGGma_route{border-radius:10px}._5VGGma_route:hover{background:var(--dsw-alias-interactive-bg-hover)}._5VGGma_route:has(input:disabled){cursor:default;opacity:.7}._5VGGma_route input{accent-color:var(--dsw-alias-label-primary);flex:none;margin:3px 0 0}._5VGGma_routeText{flex-direction:column;gap:3px;min-width:0;display:flex}._5VGGma_route>._5VGGma_routeText{flex:1}._5VGGma_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}._5VGGma_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}._5VGGma_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}._5VGGma_addressRow{flex-wrap:wrap;gap:8px;display:flex}._5VGGma_addressRow>button{flex:none}._5VGGma_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}._5VGGma_addressMenu{flex:140px;min-width:0}._5VGGma_addressTrigger{text-align:left;cursor:pointer;justify-content:space-between;align-items:center;gap:8px;display:flex}._5VGGma_addressTrigger span{text-overflow:ellipsis;white-space:nowrap;min-width:0;overflow:hidden}._5VGGma_addressTrigger svg{color:var(--dsw-alias-label-secondary);flex:none}._5VGGma_addressTrigger:disabled{cursor:default;opacity:.7}._5VGGma_other{min-width:0}._5VGGma_other summary{width:fit-content;color:var(--dsw-alias-label-tertiary);cursor:pointer;font-size:12px;line-height:20px}._5VGGma_page>._5VGGma_other{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-2);border-radius:10px;padding:12px 16px}._5VGGma_page>._5VGGma_other summary{color:var(--dsw-alias-label-secondary)}._5VGGma_extraRoutes{margin-top:8px}._5VGGma_connectionHelp{flex-direction:column;gap:10px;display:flex}._5VGGma_relayFields,._5VGGma_relayField{gap:4px;min-width:0;display:grid}._5VGGma_relayFields{gap:10px}._5VGGma_relayPreview{border:1px solid var(--dsw-alias-separator,currentColor);border-radius:8px;gap:6px;min-width:0;padding:10px 12px;display:grid}._5VGGma_relayPreviewAddress{overflow-wrap:anywhere;flex-wrap:wrap;align-items:flex-start;gap:2px;display:flex}._5VGGma_relayPreviewAddress span{flex-direction:column;display:flex}._5VGGma_relayPreviewAddress small{color:var(--dsw-alias-label-secondary);font-size:11px}._5VGGma_relayTutorial{color:var(--dsw-alias-label-secondary);overflow-wrap:anywhere;margin:0;padding-left:20px;font-size:12px;line-height:20px}._5VGGma_relayTutorial li+li{margin-top:6px}._5VGGma_relayTutorial code{display:block}._5VGGma_ready{color:var(--dsw-alias-label-secondary);align-items:flex-start;gap:8px;margin:0;font-size:12px;line-height:20px;display:flex}._5VGGma_ready svg{color:#65af91;flex:none;margin-top:2px}._5VGGma_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}._5VGGma_manageRow{flex-wrap:wrap;justify-content:space-between;align-items:center;gap:8px 16px;padding:16px 0;display:flex}._5VGGma_manageRow+._5VGGma_manageRow{border-top:1px solid var(--dsw-alias-border-l2)}._5VGGma_stopRow{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-2);border-radius:12px;padding:16px 20px}._5VGGma_manageText{flex-direction:column;flex:200px;gap:4px;min-width:0;display:flex}._5VGGma_manageTitle{color:var(--dsw-alias-label-primary);font-size:13px;line-height:20px}._5VGGma_manageActions{flex-wrap:wrap;flex:none;align-items:center;gap:8px;max-width:100%;display:flex}._5VGGma_dangerOutline{color:var(--dsw-alias-state-error-primary)}._5VGGma_remoteList{flex-direction:column;gap:8px;margin-top:12px;display:flex}._5VGGma_link{width:fit-content;color:var(--dsw-alias-label-secondary);font-size:12px;line-height:18px;text-decoration:underline}._5VGGma_actions{flex-wrap:wrap;gap:8px;display:flex}._5VGGma_error{color:var(--dsw-alias-state-error-primary);overflow-wrap:anywhere;margin:0;font-size:12px;line-height:19px}._5VGGma_confirm{width:min(440px,100%)}._5VGGma_dangerConfirm{background:var(--dsw-alias-state-error-primary);color:#fff}._5VGGma_dangerConfirm:hover:not(:disabled){background:color-mix(in srgb, var(--dsw-alias-state-error-primary) 88%, #000);color:#fff}._5VGGma_qrModal{width:min(420px,100%)}._5VGGma_largeQr{border-radius:12px;width:100%;height:auto;display:block}@media (width<=600px){._5VGGma_page{gap:16px}._5VGGma_connectionMain{flex-direction:column;align-items:stretch;gap:16px;padding:16px}._5VGGma_scan{border-right:0;align-self:center;padding-right:0}._5VGGma_manage{padding:0 12px}._5VGGma_stopRow{padding:16px 12px}._5VGGma_routeAddress{flex-basis:100%;margin-left:0}._5VGGma_title{font-size:20px}._5VGGma_status{font-size:11px}}`,document.head.appendChild(e)}var Z={actions:`_5VGGma_actions`,addressMenu:`_5VGGma_addressMenu`,addressRow:`_5VGGma_addressRow`,addressTrigger:`_5VGGma_addressTrigger`,badge:`_5VGGma_badge`,confirm:`_5VGGma_confirm`,connection:`_5VGGma_connection`,connectionDetails:`_5VGGma_connectionDetails`,connectionHelp:`_5VGGma_connectionHelp`,connectionMain:`_5VGGma_connectionMain`,dangerConfirm:`_5VGGma_dangerConfirm`,dangerOutline:`_5VGGma_dangerOutline`,description:`_5VGGma_description`,error:`_5VGGma_error`,extraRoutes:`_5VGGma_extraRoutes`,fieldTitle:`_5VGGma_fieldTitle`,header:`_5VGGma_header`,input:`_5VGGma_input`,largeQr:`_5VGGma_largeQr`,link:`_5VGGma_link`,manage:`_5VGGma_manage`,manageActions:`_5VGGma_manageActions`,manageRow:`_5VGGma_manageRow`,manageText:`_5VGGma_manageText`,manageTitle:`_5VGGma_manageTitle`,meta:`_5VGGma_meta`,notice:`_5VGGma_notice`,other:`_5VGGma_other`,page:`_5VGGma_page`,qr:`_5VGGma_qr`,qrButton:`_5VGGma_qrButton`,qrModal:`_5VGGma_qrModal`,qrPlaceholder:`_5VGGma_qrPlaceholder`,ready:`_5VGGma_ready`,relayField:`_5VGGma_relayField`,relayFields:`_5VGGma_relayFields`,relayPreview:`_5VGGma_relayPreview`,relayPreviewAddress:`_5VGGma_relayPreviewAddress`,relayTutorial:`_5VGGma_relayTutorial`,remoteList:`_5VGGma_remoteList`,route:`_5VGGma_route`,routeAddress:`_5VGGma_routeAddress`,routeFamily:`_5VGGma_routeFamily`,routeGroup:`_5VGGma_routeGroup`,routePanel:`_5VGGma_routePanel`,routeText:`_5VGGma_routeText`,routeTitle:`_5VGGma_routeTitle`,routes:`_5VGGma_routes`,scan:`_5VGGma_scan`,status:`_5VGGma_status`,stopRow:`_5VGGma_stopRow`,subRoute:`_5VGGma_subRoute`,subRoutes:`_5VGGma_subRoutes`,title:`_5VGGma_title`};function Xd(e,t){let[n,r]=(0,s.useState)(null),[i,a]=(0,s.useState)();return(0,s.useEffect)(()=>{if(n===null)return;let i=!1,o=Date.now()+6e4,s,c=async()=>{try{let t=await tu.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 Zd({state:e,disabled:t,restored:n,t:a}){let[o,c]=(0,s.useState)(!1),[l,u]=(0,s.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:o||t,onChange:e=>{c(!0),u(void 0),tu.autostart(e).then(async()=>{n(await tu.get())}).catch(e=>{u(e instanceof Error?e.message:String(e))}).finally(()=>c(!1))}})]})}function Qd(e){return e.status===`connecting`||e.status===`missing-certificate`&&e.certificate.failure===void 0}function $d({kind:e,relay:t,busy:n,onChange:a,onRefresh:o,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,s.useState)(h),v=g===h&&t.customHost?t.customHost:g?`relay.${g}`:``,y=v!==(t.customHost??``),b=Ws.safeParse(v).success,x=g!==``&&(!Ws.safeParse(g).success||!b&&y),S=(0,s.useId)(),[C,w]=(0,s.useState)(d?``:f?.split(`.`)[0]??``),[T,E]=(0,s.useState)(``),D=(0,s.useId)(),O=C!==``&&(d?!/^[a-z0-9]{4,20}$/.test(C):!Gs.safeParse(C).success||`${C}.${g}`===v||g!==``&&!Ws.safeParse(`${C}.${g}`).success),k=`certificate`in u?u.certificate.failure:void 0,ee=k?.paused===!0,A=u.status===`connected`&&!ee&&p===void 0,j=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`):A?c(`connectDevices.relay.hint`):u.status===`stopped`?c(`connectDevices.relay.${u.reason}`):ee?c(`connectDevices.relay.paused`):u.status===`off`?c(d?`connectDevices.relay.off`:`connectDevices.selfRelay.off`):Qd(u)?c(`connectDevices.relay.preparing`):c(`connectDevices.relay.unavailable`,{date:new Date(k?.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:A?Z.ready:Z.notice,role:`status`,children:[A&&/* @__PURE__ */ (0,i.jsx)(r.IconCheckCircleOutlineRegular,{}),/* @__PURE__ */ (0,i.jsx)(`span`,{children:j})]}),p!==void 0&&/* @__PURE__ */ (0,i.jsx)(`p`,{className:Z.meta,children:c(`connectDevices.relay.quotaUntil`,{date:new Date(p).toLocaleString()})}),ee&&/* @__PURE__ */ (0,i.jsx)(`p`,{className:Z.meta,children:k.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)(`p`,{className:Z.meta,children:[c(`connectDevices.relay.beta`),` `,/* @__PURE__ */ (0,i.jsx)(`a`,{className:Z.link,href:`https://github.com/BytePioneer-AI/codex-host#join-the-community`,target:`_blank`,rel:`noreferrer`,children:c(`connectDevices.relay.betaLink`)})]}),/* @__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:[!A&&/* @__PURE__ */ (0,i.jsx)(r.Button,{variant:`outline`,disabled:n,onClick:o,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 ef=/* @__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))(ef||{});let tf=[0,1],nf=[1,0],rf=[2,3],af=[3,2],of={L:tf,M:nf,Q:rf,H:af},sf=/^\d*$/,cf=/^[A-Z0-9 $%*+./:-]*$/,lf=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`,uf=[[-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]],df=[[-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 ff=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,ef.Timing),this.setFunctionModule(e,6,e%2==0,ef.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,mf(r,e));this.setFunctionModule(8,7,mf(r,6)),this.setFunctionModule(8,8,mf(r,7)),this.setFunctionModule(7,8,mf(r,8));for(let e=9;e<15;e++)this.setFunctionModule(14-e,8,mf(r,e));for(let e=0;e<8;e++)this.setFunctionModule(this.size-1-e,8,mf(r,e));for(let e=8;e<15;e++)this.setFunctionModule(8,this.size-15+e,mf(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=mf(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,ef.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,ef.Alignment)}setFunctionModule(e,t,n,r=ef.Function){this.modules[t][e]=n,this.types[t][e]=r}addEccAndInterleave(e){let t=this.version,n=this.ecc;if(e.length!==kf(t,n))throw RangeError(`Invalid argument`);let r=df[n[0]][t],i=uf[n[0]][t],a=Math.floor(Of(t)/8),o=r-a%r,s=Math.floor(a/r),c=[],l=Af(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=jf(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(Of(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]=mf(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 pf(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 mf(e,t){return!!(e>>>t&1)}var hf=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 gf=[1,10,12,14],_f=[2,9,11,13],vf=[4,8,16,16];function yf(e,t){return e[Math.floor((t+7)/17)+1]}function bf(e){let t=[];for(let n of e)pf(n,8,t);return new hf(vf,e.length,t)}function xf(e){if(!wf(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);pf(Number.parseInt(e.substring(n,n+r),10),r*3+1,t),n+=r}return new hf(gf,e.length,t)}function Sf(e){if(!Tf(e))throw RangeError(`String contains unencodable characters in alphanumeric mode`);let t=[],n=0;for(;n+2<=e.length;n+=2){let r=lf.indexOf(e.charAt(n))*45;r+=lf.indexOf(e.charAt(n+1)),pf(r,11,t)}return n<e.length&&pf(lf.indexOf(e.charAt(n)),6,t),new hf(_f,e.length,t)}function Cf(e){return e===``?[]:wf(e)?[xf(e)]:Tf(e)?[Sf(e)]:[bf(Df(e))]}function wf(e){return sf.test(e)}function Tf(e){return cf.test(e)}function Ef(e,t){let n=0;for(let r of e){let e=yf(r.mode,t);if(r.numChars>=1<<e)return 1/0;n+=4+e+r.bitData.length}return n}function Df(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 Of(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 kf(e,t){return Math.floor(Of(e)/8)-uf[t[0]][e]*df[t[0]][e]}function Af(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]=Mf(t[e],n),e+1<t.length&&(t[e]^=t[e+1]);n=Mf(n,2)}return t}function jf(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]^=Mf(t,e))}return n}function Mf(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 Nf(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=kf(o,t)*8,i=Ef(e,o);if(i<=n){s=i;break}if(o>=r)throw RangeError(`Data too long`)}for(let e of[nf,rf,af])a&&s<=kf(o,e)*8&&(t=e);let c=[];for(let t of e){pf(t.mode[0],4,c),pf(t.numChars,yf(t.mode,o),c);for(let e of t.getData())c.push(e)}let l=kf(o,t)*8;pf(0,Math.min(4,l-c.length),c),pf(0,(8-c.length%8)%8,c);for(let e=236;c.length<l;e^=253)pf(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 ff(o,t,u,i)}function Pf(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`?Cf(e):Array.isArray(e)?[bf(e)]:void 0;if(!c)throw Error(`uqr only supports encoding string and binary data, but got: ${typeof e}`);let l=Nf(c,of[n],i,a,o,r),u=Ff({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 Ff(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=ef.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 If({value:e,label:t,className:n}){let{size:r,path:a}=(0,s.useMemo)(()=>{let t=Pf(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 Rf={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`},zf={public:`connectDevices.kindPublicHint`,"tailscale-funnel":`connectDevices.kindFunnelHint`,virtual:`connectDevices.kindVirtualHint`},Bf={"tailscale-https":`connectDevices.httpsSummary`,relay:`connectDevices.relay.summary`,"self-hosted-relay":`connectDevices.selfRelay.summary`,lan:`connectDevices.lanSummary`},Vf=[`public`,`relay`,`self-hosted-relay`,`tailscale-funnel`,`tailscale-https`,`tailscale`,`lan`,`virtual`];function Hf({data:e,busy:t,restarting:n,onEnable:a,onRelay:o,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,s.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:_)??Vf.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,s.useState)(),[w,T]=(0,s.useState)(!1),[E,D]=(0,s.useState)(!1),[O,k]=(0,s.useState)(`idle`),ee=(0,s.useId)(),A=g.filter(e=>e.kind===`relay`?x===h:e.kind===x),j=A.find(e=>e.url===S)??A[0],te=!n&&j!==void 0&&u.some(e=>e.url===j.url),M=te?`${j.url}#token=${p}`:void 0,ne=te?zf[x]:void 0,N=x===`tailscale-https`,re=N?d.status===`not-serving`:(x===`lan`||x===`tailscale`||x===`virtual`)&&f!==void 0&&!f.lan&&j!==void 0,ie=Vf.filter(e=>e!==`lan`&&!y(e)&&e!==`tailscale-https`&&e!==`tailscale`&&g.some(t=>t.kind===e)),ae=x===`tailscale-https`||x===`tailscale`,oe=g.some(e=>e.kind===`tailscale`),se=e=>{v(e),C(void 0)};(0,s.useEffect)(()=>{k(`idle`)},[M]),(0,s.useEffect)(()=>{if(O===`idle`)return;let e=setTimeout(()=>k(`idle`),2e3);return()=>clearTimeout(e)},[O]);let ce=e=>{if(y(e))return e===`relay`?m?.officialHost:m?.customHost;let t=e===`tailscale-https`&&ae?j:e===`tailscale-https`?g.find(t=>t.kind===e)??g.find(e=>e.kind===`tailscale`):e===x?j:g.find(t=>t.kind===e);return t===void 0?void 0:new URL(t.url).host},le=e=>/* @__PURE__ */ (0,i.jsxs)(`label`,{className:Z.route,"data-connect-route":e,children:[/* @__PURE__ */ (0,i.jsx)(`input`,{type:`radio`,name:ee,checked:e===`tailscale-https`?ae:x===e,disabled:t,onChange:()=>se(e)}),/* @__PURE__ */ (0,i.jsxs)(`span`,{className:Z.routeText,children:[/* @__PURE__ */ (0,i.jsxs)(`span`,{className:Z.routeTitle,children:[l(Rf[e]),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:ce(e)})]}),(e===`lan`||e===`tailscale-https`||e===`relay`||e===`self-hosted-relay`)&&/* @__PURE__ */ (0,i.jsx)(`span`,{className:Z.meta,children:l(Bf[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:M===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)(If,{value:M,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)($d,{kind:x===`relay`?`official`:`self-hosted`,relay:m,busy:t,onChange:o,onRefresh:c,t:l},x),!y(x)&&(!te||ne!==void 0)&&/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Z.connectionHelp,"data-tailscale-status":N&&d.status!==`serving`?d.status:void 0,children:[ne===void 0?n?/* @__PURE__ */ (0,i.jsx)(`p`,{role:`status`,className:Z.notice,children:l(`connectDevices.restarting`)}):N?/* @__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(re?`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(ne)})]}),!te&&!n&&/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Z.actions,children:[re&&/* @__PURE__ */ (0,i.jsx)(r.Button,{variant:`primary`,disabled:t,"aria-busy":t,onClick:()=>a(N?`https`:`direct`),children:l(t?`connectDevices.preparing`:`connectDevices.enableQr`)}),(N||!re)&&/* @__PURE__ */ (0,i.jsx)(r.Button,{variant:`outline`,disabled:t,onClick:c,children:l(`connectDevices.refresh`)})]})]}),j!==void 0&&/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Z.addressRow,children:[A.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(j.url).host}),/* @__PURE__ */ (0,i.jsx)(r.IconChevronDownOutlineRegular,{})]}),items:A.map(e=>({id:e.url,label:new URL(e.url).host})),selectedId:j.url,onSelect:e=>{D(!1),C(e)}}):/* @__PURE__ */ (0,i.jsx)(`input`,{"aria-label":l(`connectDevices.address`),className:Z.input,value:new URL(j.url).host,readOnly:!0}),M!==void 0&&/* @__PURE__ */ (0,i.jsx)(r.Button,{variant:`outline`,disabled:t,onClick:()=>{navigator.clipboard.writeText(M).then(()=>k(`copied`),()=>k(`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:[m!==void 0&&/* @__PURE__ */ (0,i.jsxs)(i.Fragment,{children:[le(`relay`),le(`self-hosted-relay`)]}),/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Z.routeFamily,children:[le(`tailscale-https`),ae&&oe&&/* @__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:`${ee}-tailscale`,checked:x===`tailscale-https`,onChange:()=>se(`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:`${ee}-tailscale`,checked:x===`tailscale`,onChange:()=>se(`tailscale`)}),l(`connectDevices.tailscaleViaIp`)]})]})]}),le(`lan`)]})]}),ie.length>0&&/* @__PURE__ */ (0,i.jsxs)(`details`,{className:Z.other,open:ie.includes(x)?!0:void 0,children:[/* @__PURE__ */ (0,i.jsx)(`summary`,{children:l(`connectDevices.otherMethods`)}),/* @__PURE__ */ (0,i.jsx)(`div`,{className:Z.extraRoutes,children:ie.map(le)})]})]}),w&&M!==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)(If,{value:M,label:l(`connectDevices.qrLabel`),className:Z.largeQr})})]})}let Uf=e=>e instanceof Error?e.message:String(e);function Wf(e){if(e instanceof ql&&e.code===`auth/disabled`)return{kind:`disabled`};if(e instanceof ql&&e.code===`auth/local-access-required`){let t=Js.safeParse(e.details);return{kind:`non-local`,url:t.success?t.data.url:`http://127.0.0.1`}}return{kind:`failed`,message:Uf(e)}}function Gf({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 Kf({url:e,t}){let[n,a]=(0,s.useState)(!1),[o,c]=(0,s.useState)(!1),[l,u]=(0,s.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)(Gf,{t,title:t(`connectDevices.signOutTitle`),description:t(`connectDevices.signOutDescription`),confirmLabel:t(`connectDevices.signOutConfirm`),busy:o,error:l,onClose:()=>a(!1),onConfirm:()=>{c(!0),u(null),Td().catch(e=>{c(!1),u(t(`connectDevices.actionFailed`,{message:Uf(e)}))})}})]})}function qf({t:e}){let[t,n]=(0,s.useState)({kind:`loading`}),[a,o]=(0,s.useState)(null),[c,l]=(0,s.useState)(!1),[u,d]=(0,s.useState)(null),[f,p]=(0,s.useState)(!1),m=(0,s.useCallback)(e=>n({kind:`ready`,data:e}),[]),h=Xd(m,e(`connectDevices.restartTimeout`)),g=c||h.target!==null;(0,s.useEffect)(()=>{if(!f)return;let e=setTimeout(()=>p(!1),2e3);return()=>clearTimeout(e)},[f]),(0,s.useEffect)(()=>{let e=!1;return tu.get().then(t=>{e||n({kind:`ready`,data:t})},t=>{e||n(Wf(t))}),()=>{e=!0}},[]);let _=t.kind===`ready`?t.data.relay?.state:void 0,v=_!==void 0&&Qd(_);(0,s.useEffect)(()=>{if(!v)return;let e=setTimeout(()=>{tu.get().then(m,()=>void 0)},2e3);return()=>clearTimeout(e)},[v,t,m]);let y=async()=>{let e=await tu.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:Uf(t)}));try{await y()}catch{}}finally{l(!1)}},x=e=>{b(async()=>{if(e===`direct`){let{changed:e}=await tu.lan(!0);e?h.start(!0):await y()}else{let e=await tu.serve(!0);if(e.error!==void 0)throw Error(e.error);await y()}})},S=async()=>{let t=await y();t.relay?.enabled&&(await tu.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 tu.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 tu.lan(!1);e?h.start(!1):await y()}o(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)(Kf,{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,k=E.length>0||O?.lan===!0,ee=O?.lan===!0||D.status===`serving`||C.relay?.enabled===!0,A=E.some(e=>e.kind===`public`||O===void 0&&[`lan`,`tailscale`,`virtual`].includes(e.kind)),j=T===null?void 0:(0,r.relativeTime)(T,Date.now()),te=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":k&&h.target===null,children:e(h.target===null?k?`connectDevices.accessEnabled`:`connectDevices.localAccess`:`connectDevices.preparing`)})]}),/* @__PURE__ */ (0,i.jsx)(Hf,{data:C,busy:g,restarting:h.target!==null,onEnable:x,onRelay:(e,t)=>{b(async()=>{await tu.relay(e,t),await y()})},onRefresh:()=>{b(async()=>{await y()})},t:e}),a===null&&te!=null&&/* @__PURE__ */ (0,i.jsx)(`p`,{role:`alert`,className:Z.error,children:te}),/* @__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:j===void 0?e(`connectDevices.neverUsed`):e(`connectDevices.lastUsed`,{time:e(`connectDevices.relative.${j.unit}`,{n:j.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),o(`regenerate`)},children:e(`connectDevices.regenerate`)})]})]}),O!==void 0&&/* @__PURE__ */ (0,i.jsx)(Zd,{state:O,disabled:g,restored:m,t:e})]}),ee&&/* @__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),o(`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)(Gf,{t:e,title:e(a===`stop`?`connectDevices.stopTitle`:`connectDevices.regenerateTitle`),description:a===`stop`?`${e(`connectDevices.stopDescription`)}${A?` ${e(`connectDevices.stopUnmanaged`)}`:``}`:e(`connectDevices.regenerateDescription`),confirmLabel:e(a===`stop`?`connectDevices.stopConfirm`:`connectDevices.regenerateConfirm`),busy:g,error:u,onClose:()=>o(null),onConfirm:()=>{b(a===`stop`?S:async()=>{m(await tu.regenerate()),o(null)})}})]})}async function Jf(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:Wl(),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 ql(e,t,n)}if(!i.ok)throw Error(`HTTP ${String(i.status)}`);return zl.parse(a.result?.value)}let Yf={list:e=>Jf(`list`,{},e),install:(e,t)=>Jf(`install`,{spec:e,...t===void 0?{}:{registry:t}}),setEnabled:(e,t)=>Jf(`setEnabled`,{id:e,enabled:t}),remove:e=>Jf(`remove`,{id:e})},Xf=/^web-assets: \S+ requires (\S+)@(.+), but the browser Host does not provide \1$/u,Zf=/^web-assets: \S+ requires (\S+)@(.+), but the browser Host provides (.+)$/u,Qf=/^web-assets: \S+ declares runtime version requirements, but the browser Host version snapshot is unavailable$/u,$f=/^web-assets: \S+ requires unavailable browser module (\S+)$/u;function ep(e,t){return Xf.test(e)||$f.test(e)?t(`extensions.unsupported`):Zf.test(e)?t(`extensions.versionMismatch`):Qf.test(e)?t(`extensions.hostVersionSnapshotMissing`):e.replace(/^web-assets:\s+/u,``)}let tp=`@deepseek-ai/dsh-client-ui-codexhost/InstallWebExtensionDialog.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(tp)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-codexhost`,e.dataset.pluginCss=tp,e.textContent=`.xh0XoG_dialog{width:min(560px,100%);max-height:min(800px,100%)}.xh0XoG_content{min-height:0;overflow-y:auto}.xh0XoG_body,.xh0XoG_footer,.xh0XoG_field{flex-direction:column;min-width:0;display:flex}.xh0XoG_body{gap:12px}.xh0XoG_footer{flex:1;gap:20px}.xh0XoG_field{color:var(--dsw-alias-label-secondary);gap:6px;font-size:13px}.xh0XoG_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}.xh0XoG_field input:focus{border-color:var(--dsw-alias-state-business-primary);box-shadow:inset 0 0 0 .5px var(--dsw-alias-state-business-primary)}.xh0XoG_field input[aria-invalid=true]{border-color:var(--dsw-alias-state-error-primary)}.xh0XoG_field input:disabled,.xh0XoG_registry select:disabled{opacity:.6}.xh0XoG_options{flex-wrap:wrap;justify-content:space-between;align-items:center;gap:8px 12px;display:flex}.xh0XoG_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}.xh0XoG_guideToggle:hover{color:var(--dsw-alias-label-primary)}.xh0XoG_guideToggle[aria-expanded=true] .xh0XoG_chevron{transform:rotate(180deg)}.xh0XoG_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}.xh0XoG_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}.xh0XoG_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}.xh0XoG_guide p{margin:8px 0 4px}.xh0XoG_guide code{color:var(--dsw-alias-label-tertiary);overflow-wrap:anywhere}.xh0XoG_scope,.xh0XoG_hint,.xh0XoG_error{color:var(--dsw-alias-label-secondary);overflow-wrap:anywhere;margin:0;font-size:12px;line-height:18px}.xh0XoG_error{color:var(--dsw-alias-state-error-primary,#d92d20)}.xh0XoG_wide{width:100%}`,document.head.appendChild(e)}var np={body:`xh0XoG_body`,chevron:`xh0XoG_chevron`,content:`xh0XoG_content`,dialog:`xh0XoG_dialog`,error:`xh0XoG_error`,field:`xh0XoG_field`,footer:`xh0XoG_footer`,guide:`xh0XoG_guide`,guideToggle:`xh0XoG_guideToggle`,hint:`xh0XoG_hint`,options:`xh0XoG_options`,registry:`xh0XoG_registry`,scope:`xh0XoG_scope`,wide:`xh0XoG_wide`};let rp={official:`https://registry.npmjs.org/`,mirror:`https://registry.npmmirror.com/`};function ip({t:e,open:t,busy:n,error:a,onClose:o,onInstall:c}){let[l,u]=(0,s.useState)(``),[d,f]=(0,s.useState)(`official`),[p,m]=(0,s.useState)(``),[h,g]=(0,s.useState)(!1),[_,v]=(0,s.useState)(!1),y=(0,s.useId)(),b=(0,s.useId)(),x=(0,s.useId)(),S=(0,s.useId)(),C=(0,s.useRef)(null);return(0,s.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||o()},title:e(`extensions.add`),closeLabel:e(`extensions.close`),description:e(`extensions.sourceHint`),className:np.dialog,contentClassName:np.content,footer:/* @__PURE__ */ (0,i.jsxs)(`div`,{className:np.footer,children:[/* @__PURE__ */ (0,i.jsx)(`p`,{className:np.scope,children:e(`extensions.scope`)}),/* @__PURE__ */ (0,i.jsx)(r.Button,{type:`submit`,form:y,variant:`primary`,className:np.wide,disabled:n||l.trim()===``,"aria-busy":n,children:e(n?`extensions.installing`:`extensions.install`)})]}),children:/* @__PURE__ */ (0,i.jsxs)(`form`,{id:y,className:np.body,onSubmit:e=>{e.preventDefault();let t=l.trim();if(n||t===``)return;let r=Bl.safeParse(d===`custom`?p:rp[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:np.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:np.error,role:`alert`,children:a}),/* @__PURE__ */ (0,i.jsxs)(`div`,{className:np.options,children:[/* @__PURE__ */ (0,i.jsxs)(`button`,{type:`button`,className:np.guideToggle,"aria-expanded":_,"aria-controls":b,onClick:()=>v(!_),children:[/* @__PURE__ */ (0,i.jsx)(r.IconChevronDownOutlineRegular,{className:np.chevron,size:14,"aria-hidden":`true`}),e(`extensions.guide`)]}),/* @__PURE__ */ (0,i.jsxs)(`label`,{className:np.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:np.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:np.error,role:`alert`,children:e(`extensions.registryInvalid`)})]}),_&&/* @__PURE__ */ (0,i.jsxs)(`div`,{id:b,className:np.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:np.hint,children:e(`extensions.registryHint`)})]})]})})}let ap=`@deepseek-ai/dsh-client-ui-codexhost/WebExtensionsSection.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(ap)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-codexhost`,e.dataset.pluginCss=ap,e.textContent=`.lydE2G_page,.lydE2G_rowText{flex-direction:column;min-width:0;display:flex}.lydE2G_page{gap:28px}.lydE2G_header{flex-wrap:wrap;justify-content:space-between;align-items:flex-start;gap:16px;display:flex}.lydE2G_heading{flex:280px;min-width:0}.lydE2G_title{color:var(--dsw-alias-label-primary);overflow-wrap:anywhere;margin:0;font-size:20px;font-weight:600;line-height:28px}.lydE2G_intro{align-items:flex-start;gap:4px;margin-top:8px;display:flex}.lydE2G_intro .lydE2G_iconButton{width:24px;height:24px;margin-top:-2px}.lydE2G_intro .lydE2G_hint{color:var(--dsw-alias-label-secondary);font-size:13px;line-height:20px}.lydE2G_hint,.lydE2G_meta,.lydE2G_notice,.lydE2G_error{color:var(--dsw-alias-label-tertiary);overflow-wrap:anywhere;margin:0;font-size:12px;line-height:18px}.lydE2G_notice{color:var(--dsw-alias-label-secondary)}.lydE2G_error,.lydE2G_danger{color:var(--dsw-alias-state-error-primary)}.lydE2G_actions,.lydE2G_recovery{flex-wrap:wrap;align-items:center;gap:8px;display:flex}.lydE2G_actions{flex:none}.lydE2G_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}.lydE2G_iconButton:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}.lydE2G_iconButton:disabled{opacity:.5;cursor:default}.lydE2G_open:focus-visible,.lydE2G_iconButton:focus-visible,.lydE2G_back:focus-visible{outline:2px solid var(--dsw-alias-label-secondary);outline-offset:2px}.lydE2G_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}.lydE2G_button:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover)}.lydE2G_button:disabled{opacity:.6;cursor:default}.lydE2G_list{flex-direction:column;gap:4px;margin:0;padding:0;list-style:none;display:flex}.lydE2G_group{min-width:0}.lydE2G_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}.lydE2G_count{color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums}.lydE2G_row{border-radius:12px;flex-wrap:wrap;align-items:center;gap:4px 12px;margin:0 -8px;padding:8px;display:flex}.lydE2G_row:hover,.lydE2G_row:focus-within{background:var(--dsw-alias-interactive-bg-hover)}.lydE2G_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}.lydE2G_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}.lydE2G_packageImage{object-fit:contain}.lydE2G_summary{text-overflow:ellipsis;white-space:nowrap;color:var(--dsw-alias-label-tertiary);font-size:13px;line-height:18px;overflow:hidden}.lydE2G_description{color:var(--dsw-alias-label-secondary);overflow-wrap:anywhere;margin:0;font-size:14px;line-height:22px}.lydE2G_chevron{color:var(--dsw-alias-label-tertiary);opacity:0;flex:none}.lydE2G_row:hover .lydE2G_chevron,.lydE2G_row:focus-within .lydE2G_chevron{opacity:1}.lydE2G_rowText{flex:1;gap:4px}.lydE2G_name{color:var(--dsw-alias-label-primary);text-overflow:ellipsis;white-space:nowrap;font-size:14px;font-weight:500;line-height:22px;overflow:hidden}.lydE2G_rowNotice{flex-basis:100%;padding-left:62px}.lydE2G_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}.lydE2G_detail{flex-direction:column;gap:20px;min-width:0;display:flex}.lydE2G_detail .lydE2G_rowText{gap:8px}.lydE2G_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}.lydE2G_recovery{gap:8px 16px;margin-top:4px}.lydE2G_link{color:var(--dsw-alias-label-secondary);text-underline-offset:3px;font-size:12px;line-height:18px}@media (width<=600px){.lydE2G_page{gap:24px}.lydE2G_open{gap:10px}.lydE2G_artwork{border-radius:10px;width:40px;height:40px}.lydE2G_row,.lydE2G_row .lydE2G_actions{gap:4px}.lydE2G_chevron{display:none}.lydE2G_rowNotice{padding-left:50px}}`,document.head.appendChild(e)}var Q={actions:`lydE2G_actions`,artwork:`lydE2G_artwork`,back:`lydE2G_back`,button:`lydE2G_button`,chevron:`lydE2G_chevron`,count:`lydE2G_count`,danger:`lydE2G_danger`,description:`lydE2G_description`,detail:`lydE2G_detail`,error:`lydE2G_error`,group:`lydE2G_group`,groupTitle:`lydE2G_groupTitle`,header:`lydE2G_header`,heading:`lydE2G_heading`,hint:`lydE2G_hint`,iconButton:`lydE2G_iconButton`,intro:`lydE2G_intro`,link:`lydE2G_link`,list:`lydE2G_list`,meta:`lydE2G_meta`,name:`lydE2G_name`,notice:`lydE2G_notice`,open:`lydE2G_open`,packageImage:`lydE2G_packageImage`,page:`lydE2G_page`,recovery:`lydE2G_recovery`,row:`lydE2G_row`,rowNotice:`lydE2G_rowNotice`,rowText:`lydE2G_rowText`,source:`lydE2G_source`,summary:`lydE2G_summary`,title:`lydE2G_title`};function op({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 sp({src:e}){let[t,n]=(0,s.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 cp(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 lp(e){if(e instanceof ql&&e.code===`auth/local-access-required`){let t=Js.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 up({t:e,resolveText:t}){let[n,a]=(0,s.useState)({kind:`loading`}),[o,c]=(0,s.useState)(!1),[l,u]=(0,s.useState)(null),[d,f]=(0,s.useState)(null),[p,m]=(0,s.useState)(null),[h,g]=(0,s.useState)(null),_=(0,s.useRef)(!1);(0,s.useEffect)(()=>{let e=new AbortController;return Yf.list(e.signal).then(t=>{e.signal.aborted||a({kind:`ready`,data:t})},t=>{e.signal.aborted||a(lp(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=lp(t);return n.kind===`non-local`?a(n):f(e(`extensions.actionFailed`,{message:ep(n.message,e)})),!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`,()=>Yf.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,...cp(T,t)},D=(e,t)=>{v(e,()=>Yf.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`,()=>Yf.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)(ip,{t:e,open:o,busy:l===`install`,error:d,onClose:()=>c(!1),onInstall:(e,t)=>v(`install`,()=>Yf.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&&!o&&/* @__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}=cp(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)(sp,{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)(op,{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:ep(n.loadError,e)})}),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)(sp,{src:E.meta?.icon}),/* @__PURE__ */ (0,i.jsxs)(`div`,{className:Q.actions,children:[/* @__PURE__ */ (0,i.jsx)(op,{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,()=>Yf.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:ep(E.loadError,e)})})]}),y]})}let dp=`@deepseek-ai/dsh-client-ui-codexhost/NotificationsRow.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(dp)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-codexhost`,e.dataset.pluginCss=dp,e.textContent=`.Vlys5a_row{border-bottom:.5px solid var(--dsw-alias-border-l2);flex-wrap:wrap;align-items:center;gap:8px;padding:16px 0;display:flex}.Vlys5a_rowText{flex-direction:column;flex:220px;gap:4px;min-width:0;display:flex}.Vlys5a_actions{gap:8px;display:flex}.Vlys5a_title{color:var(--dsw-alias-label-primary);font-size:14px;line-height:22px}.Vlys5a_desc{color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:18px}.Vlys5a_button{border-radius:var(--dsw-radius-md,10px);background:var(--dsw-alias-bg-module-platform);min-height:44px;font:inherit;color:var(--dsw-alias-label-primary);cursor:pointer;border:none;flex:none;padding:0 14px;font-size:14px}.Vlys5a_button:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover)}.Vlys5a_button:focus-visible{outline-offset:2px;outline:2px solid}.Vlys5a_button:disabled{opacity:.6;cursor:default}@media (width<=600px){.Vlys5a_row{flex-direction:column;align-items:stretch;gap:12px}.Vlys5a_rowText{flex:auto}.Vlys5a_actions{grid-auto-columns:1fr;grid-auto-flow:column;display:grid}}`,document.head.appendChild(e)}var fp={actions:`Vlys5a_actions`,button:`Vlys5a_button`,desc:`Vlys5a_desc`,row:`Vlys5a_row`,rowText:`Vlys5a_rowText`,title:`Vlys5a_title`};function pp({t:e}){let[t,n]=(0,s.useState)(null),[r,a]=(0,s.useState)(!1),[o,c]=(0,s.useState)(null);(0,s.useEffect)(()=>{gd().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=o??(t===null?``:e(`notifications.${t}`));return/* @__PURE__ */ (0,i.jsxs)(`div`,{className:fp.row,children:[/* @__PURE__ */ (0,i.jsxs)(`div`,{className:fp.rowText,children:[/* @__PURE__ */ (0,i.jsx)(`div`,{className:fp.title,children:e(`notifications.title`)}),/* @__PURE__ */ (0,i.jsx)(`div`,{className:fp.desc,role:o===null?void 0:`alert`,children:u})]}),(t===`off`||t===`on`)&&/* @__PURE__ */ (0,i.jsxs)(`div`,{className:fp.actions,children:[t===`on`&&/* @__PURE__ */ (0,i.jsx)(`button`,{type:`button`,className:fp.button,disabled:r,onClick:()=>{nu.test()},children:e(`notifications.test`)}),/* @__PURE__ */ (0,i.jsx)(`button`,{type:`button`,className:fp.button,disabled:r,onClick:()=>{l(t===`on`?yd:vd)},children:e(t===`on`?`notifications.disable`:`notifications.enable`)})]})]})}let mp=`@deepseek-ai/dsh-client-ui-codexhost/PwaInstallRow.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(mp)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-codexhost`,e.dataset.pluginCss=mp,e.textContent=`.GXYHTW_section{padding:16px 0}.GXYHTW_row{flex-wrap:wrap;align-items:center;gap:12px 24px;display:flex}.GXYHTW_text{flex:180px;min-width:0}.GXYHTW_title{color:var(--dsw-alias-label-primary);font-size:14px;line-height:22px}.GXYHTW_description,.GXYHTW_guide{color:var(--dsw-alias-label-secondary);font-size:12px;line-height:18px}.GXYHTW_description{margin-top:4px}.GXYHTW_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}.GXYHTW_button:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover)}.GXYHTW_button:focus-visible{outline-offset:2px;outline:2px solid}.GXYHTW_button:disabled{opacity:.6;cursor:default}.GXYHTW_guide{margin-top:12px}.GXYHTW_guide p{margin:8px 0 0}@media (width<=600px){.GXYHTW_row{flex-direction:column;align-items:stretch;gap:12px}.GXYHTW_text{flex:auto}}`,document.head.appendChild(e)}var hp={button:`GXYHTW_button`,description:`GXYHTW_description`,guide:`GXYHTW_guide`,row:`GXYHTW_row`,section:`GXYHTW_section`,text:`GXYHTW_text`,title:`GXYHTW_title`};function gp({installation:e,t}){let n=(0,s.useSyncExternalStore)(e.store.subscribe,e.store.getSnapshot),[a,o]=(0,s.useState)(!1),c=(0,s.useId)(),l=(0,s.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:hp.section,children:[/* @__PURE__ */ (0,i.jsxs)(`div`,{className:hp.row,children:[/* @__PURE__ */ (0,i.jsxs)(`div`,{className:hp.text,children:[/* @__PURE__ */ (0,i.jsx)(`div`,{className:hp.title,children:t(`pwa.title`)}),d!==null&&/* @__PURE__ */ (0,i.jsx)(`div`,{id:l,className:hp.description,role:n===`failed`?`alert`:`status`,children:d})]}),n!==`installed`&&/* @__PURE__ */ (0,i.jsxs)(`button`,{type:`button`,className:hp.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?(o(!1),e.install()):o(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:hp.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 _p=`@deepseek-ai/dsh-client-ui-codexhost/ImportPage.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(_p)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-codexhost`,e.dataset.pluginCss=_p,e.textContent=`.YOoDta_page{box-sizing:border-box;height:100%;padding:calc(36px + var(--dsh-frame-top-clearance,0px)) clamp(16px, 4vw, 48px) 56px;overflow-y:auto}.YOoDta_inner{flex-direction:column;gap:16px;max-width:800px;margin:0 auto;display:flex}.YOoDta_header{flex-wrap:wrap;justify-content:space-between;align-items:flex-start;gap:16px;margin-bottom:4px;display:flex}.YOoDta_heading{flex:320px;min-width:0}.YOoDta_title{letter-spacing:-.01em;color:var(--dsw-alias-label-primary);margin:0;font-size:24px;font-weight:600;line-height:32px}.YOoDta_subtitle{color:var(--dsw-alias-label-secondary);margin:6px 0 0;font-size:14px;line-height:1.6}.YOoDta_refresh{flex:none;margin-top:2px}.YOoDta_tabs{flex-wrap:wrap;gap:8px;display:flex}.YOoDta_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}.YOoDta_tab:hover:not(:disabled):not([data-active]){background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}.YOoDta_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}.YOoDta_tab:focus-visible,.YOoDta_search:focus-visible,.YOoDta_select:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:1px}.YOoDta_tabIcon{width:14px;height:14px;color:inherit;flex:none;display:inline-flex}.YOoDta_tab:disabled{opacity:.5;cursor:default}.YOoDta_searchField{display:block;position:relative}.YOoDta_searchIcon{color:var(--dsw-alias-label-tertiary);pointer-events:none;position:absolute;top:50%;left:14px;transform:translateY(-50%)}.YOoDta_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}.YOoDta_search::placeholder{color:var(--dsw-alias-label-tertiary)}.YOoDta_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)}.YOoDta_search:focus-visible{outline:none}.YOoDta_search:disabled{opacity:.6}.YOoDta_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}.YOoDta_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)}.YOoDta_calloutIcon{flex:none;margin-top:2px}.YOoDta_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}.YOoDta_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}.YOoDta_row+.YOoDta_row:before{content:"";border-top:.5px solid var(--dsw-alias-border-l2);position:absolute;top:0;left:14px;right:14px}.YOoDta_row:hover{background:var(--dsw-alias-interactive-bg-hover)}.YOoDta_row:hover:before,.YOoDta_row:hover+.YOoDta_row:before{opacity:0}.YOoDta_rowText{flex:1;min-width:0}.YOoDta_rowTitle{color:var(--dsw-alias-label-primary);text-overflow:ellipsis;white-space:nowrap;font-size:14px;font-weight:500;line-height:22px;overflow:hidden}.YOoDta_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}.YOoDta_metaItem{align-items:center;gap:5px;min-width:0;max-width:100%;display:inline-flex}.YOoDta_metaIcon{opacity:.8;flex:none}.YOoDta_metaText{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.YOoDta_action{flex:none;min-width:64px}.YOoDta_status{color:var(--dsw-alias-label-secondary);justify-content:center;align-items:center;gap:8px;padding:40px 0;font-size:14px;display:flex}.YOoDta_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}.YOoDta_emptyIcon{color:var(--dsw-alias-label-tertiary)}.YOoDta_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}.YOoDta_pageSize{align-items:center;gap:8px;display:inline-flex}.YOoDta_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}.YOoDta_select:disabled{opacity:.6;cursor:default}.YOoDta_pager{align-items:center;gap:6px;display:inline-flex}.YOoDta_range{font-variant-numeric:tabular-nums;margin-right:6px}.YOoDta_pageButton{width:28px;padding:0}`,document.head.appendChild(e)}var $={action:`YOoDta_action`,callout:`YOoDta_callout`,calloutIcon:`YOoDta_calloutIcon`,empty:`YOoDta_empty`,emptyIcon:`YOoDta_emptyIcon`,footer:`YOoDta_footer`,header:`YOoDta_header`,heading:`YOoDta_heading`,inner:`YOoDta_inner`,list:`YOoDta_list`,metaIcon:`YOoDta_metaIcon`,metaItem:`YOoDta_metaItem`,metaText:`YOoDta_metaText`,page:`YOoDta_page`,pageButton:`YOoDta_pageButton`,pageSize:`YOoDta_pageSize`,pager:`YOoDta_pager`,range:`YOoDta_range`,refresh:`YOoDta_refresh`,row:`YOoDta_row`,rowMeta:`YOoDta_rowMeta`,rowText:`YOoDta_rowText`,rowTitle:`YOoDta_rowTitle`,search:`YOoDta_search`,searchField:`YOoDta_searchField`,searchIcon:`YOoDta_searchIcon`,select:`YOoDta_select`,status:`YOoDta_status`,subtitle:`YOoDta_subtitle`,tab:`YOoDta_tab`,tabIcon:`YOoDta_tabIcon`,tabs:`YOoDta_tabs`,title:`YOoDta_title`};function vp(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 yp(e){return e instanceof Error?e.message:String(e)}function bp({openSession:e,t}){let[n,a]=(0,s.useState)(null),[o,c]=(0,s.useState)(null),[l,u]=(0,s.useState)(``),[d,f]=(0,s.useState)(0),[p,m]=(0,s.useState)(20),[h,g]=(0,s.useState)(0),[_,v]=(0,s.useState)(null),[y,b]=(0,s.useState)(0),[x,S]=(0,s.useState)(null),[C,w]=(0,s.useState)(null),[T,E]=(0,s.useState)(null),[D,O]=(0,s.useState)({}),k=(0,s.useRef)(!1),ee=(0,s.useRef)(null);(0,s.useEffect)(()=>{let e=new AbortController;return ee.current=e,()=>e.abort()},[]),(0,s.useEffect)(()=>{let e=!0;return S(null),ru.sources().then(({harnesses:t})=>{e&&(a(t),c(e=>t.some(t=>t.harnessId===e)?e:t[0]?.harnessId??null))},t=>{e&&S(yp(t))}),()=>{e=!1}},[h]),(0,s.useEffect)(()=>{if(o===null)return;let e=!0;v(null),S(null);let t=setTimeout(()=>{ru.candidates({harnessId:o,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(yp(t))})},l===``?0:200);return()=>{e=!1,clearTimeout(t)}},[o,l,d,p,h]);let A=(0,s.useMemo)(()=>/^(\/Users\/[^/]+|\/home\/[^/]+)/u.exec(_?.[0]?.cwd??``)?.[1],[_]),j=e=>A!==void 0&&(e===A||e.startsWith(`${A}/`))?`~${e.slice(A.length)}`:e,te=async n=>{let r=ee.current?.signal;if(o===null||k.current||!r||r.aborted)return;let i=JSON.stringify([o,n.nativeSessionId]),a=D[i];k.current=!0,E(n.nativeSessionId),w(null);try{if(!a){let e=await ru.importSession(o,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:yp(e)}))}finally{k.current=!1,r.aborted||E(null)}},M=()=>{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===o,className:$.tab,"data-active":e.harnessId===o||void 0,disabled:T!==null,onClick:()=>{e.harnessId!==o&&(M(),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=>{M(),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||o!==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([o,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:j(e.cwd)})]}),/* @__PURE__ */ (0,i.jsxs)(`span`,{className:$.metaItem,children:[/* @__PURE__ */ (0,i.jsx)(r.IconClockOutlineRegular,{size:13,className:$.metaIcon}),vp(e.updatedAt)]})]})]}),/* @__PURE__ */ (0,i.jsx)(r.Button,{variant:n?`outline`:`primary`,size:`sm`,className:$.action,disabled:T!==null,onClick:()=>void te(e),children:T===e.nativeSessionId?t(`importing`):t(n?`open`:`import`)})]},e.nativeSessionId)})}),o!==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=>{M(),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 xp=`@deepseek-ai/dsh-client-ui-codexhost/HostSettingsSection.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(xp)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-codexhost`,e.dataset.pluginCss=xp,e.textContent=`.-zqB1W_host{min-width:0;display:block}.-zqB1W_error{color:var(--dsw-alias-state-error-primary);padding:16px 0;font-size:13px;line-height:20px}`,document.head.appendChild(e)}var Sp={error:`-zqB1W_error`,host:`-zqB1W_host`};let Cp;function wp(){return Cp??=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 Cp=void 0,e}),Cp}function Tp({t:e,pageId:t,locale:n,colorScheme:r}){let a=(0,s.useRef)(null),[o,c]=(0,s.useState)(``),l=(0,s.useSyncExternalStore)(n.subscribe,n.get),u=(0,s.useSyncExternalStore)(r.subscribe,r.get);return(0,s.useEffect)(()=>{let e=!1,n;return c(``),wp().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:[o&&/* @__PURE__ */ (0,i.jsx)(`div`,{className:Sp.error,children:e(`settings.unavailable`,{message:o})}),/* @__PURE__ */ (0,i.jsx)(`div`,{ref:a,className:Sp.host})]})}let Ep={"discovery.agents":`Delegation Agents`,"discovery.sessions":`Sessions`,"reference.addedToDraft":`Added to the current draft`,"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:`,remoteAccess:`Remote access`,"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.`,"opening.loading":`Opening conversation…`,"opening.error":`Could not open conversation`,"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.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 encrypted 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":`Official encrypted 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.beta":`Currently in private beta. For early access, follow the README to join the group chat and contact me.`,"connectDevices.relay.betaLink":`README community instructions`,"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.unsupported":`This Web cannot install this extension. It only supports themes, sidebar panels, and display components.`,"extensions.versionMismatch":`This extension does not match this Web version, so it cannot be installed.`,"extensions.hostVersionSnapshotMissing":`This Web cannot confirm whether the extension is compatible, so it cannot be installed.`,"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.`},Dp={"discovery.agents":`委派 Agent`,"discovery.sessions":`会话`,"reference.addedToDraft":`已加入当前草稿`,"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":`原生命令目录不可用:`,remoteAccess:`远程访问`,"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":`消息同步失败,请重试连接。`,"opening.loading":`正在打开会话…`,"opening.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.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":`官方加密中转`,"connectDevices.relay.summary":`任何网络 · 手机无需安装应用`,"connectDevices.relay.hint":`跨网络连接,手机无需额外安装应用,登录需要访问令牌。`,"connectDevices.relay.off":`codexhost 官方中转,只转发加密内容。`,"connectDevices.relay.beta":`目前正在内测中,想提前体验,欢迎按 README 中的说明加入交流群联系我~`,"connectDevices.relay.betaLink":`查看 README 加群说明`,"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.unsupported":`当前 Web 不支持这个扩展。这里只能安装主题、侧栏和展示组件。`,"extensions.versionMismatch":`这个扩展和当前 Web 版本不匹配,无法安装。`,"extensions.hostVersionSnapshotMissing":`当前 Web 无法确认这个扩展是否兼容,无法安装。`,"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":`录音文件不可用。`},Op=`codexhostImport`,kp=`codexhost-import`,Ap=[`slots`,`locale`,`layout`,`uiWorkspace`,`workspaces`,`sessions`,`remote`,`inputTriggers`,`theme`,`connection`],jp=[[`accounts`,`settings.accounts`,2],[`connections`,`settings.connections`,3],[`usage-statistics`,`settings.usage`,4],[`resources`,`settings.resources`,5],[`updates`,`settings.updates`,7],[`about`,`settings.about`,8]];function Mp(e){e.effect(()=>e.locale.register(Op,{zh:Dp,en:Ep}),`ui-codexhost: dictionaries`);let t=e.locale.bind(Op),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:Op,inject:()=>({installation:n})},gp)),e.provide(`chatMessageEditing`,au),e.provide(`chatTurnDiffs`,iu),e.inject([`conversation`,`uiSession`],bu),e.inject([`conversation`],e=>{let t=new Su(Ql.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:Op,inject:()=>i},Vu)),e.slots.inject(`conversation.input.notice`,()=>e.slots.register({name:`conversation.input.notice`,id:`codexhost.desktop-screenshot`,locale:Op,inject:()=>({screenshot:t,drafts:r})},qu));let a=new Yu(Yl.transcribe),o=new $u;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:Op,inject:()=>({voice:a,blocks:e.conversation.blocks,tray:o})},nd)),e.slots.inject(`conversation.input.activity`,()=>e.slots.register({name:`conversation.input.activity`,locale:Op,inject:()=>({voice:a,tray:o})},rd)),e.slots.inject(`conversation.input.notice`,()=>e.slots.register({name:`conversation.input.notice`,id:`codexhost.voice`,locale:Op,inject:()=>({voice:a})},od)),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=>uu(e)),e.provide(`chatLinks`,{resolve:Object.assign(t=>{let n=gu(t);if(n===void 0)return;let r=n,i=()=>{let t=e.sessions.list.getSnapshot().byId[r];return t===void 0?void 0:mu(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:pu,subscribe:t=>e.sessions.list.subscribe(t)})}),yu(e);let r={openSession:t=>{e.uiWorkspace.openSession(t)}};e.slots.inject(`main`,()=>e.slots.register({name:`main`,key:kp,locale:Op,inject:()=>({openSession:async(n,i)=>{let a=n;if(e.sessions.list.getSnapshot().byId[a]===void 0&&await e.sessions.loadSummary(a),i.throwIfAborted(),e.sessions.list.getSnapshot().byId[a]===void 0)throw Error(t(`catalogPending`));r.openSession(n)}})},bp)),e.slots.inject(`sidebar.panellist`,()=>e.slots.register({name:`sidebar.panellist`,id:kp,order:10,label:()=>t(`panel`),locale:Op},cd)),e.inject([`settingsNavigation`],e=>{e.slots.inject(`sidebar.primary.action`,()=>e.slots.register({name:`sidebar.primary.action`,id:`codexhost-remote-access`,locale:Op,inject:()=>({openSection:t=>e.settingsNavigation.openSection(t)})},ld))}),e.slots.inject(`settings.general.item`,()=>e.slots.register({name:`settings.general.item`,id:`codexhost.notifications`,order:5,locale:Op},pp));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:6,label:()=>t(`settings.extensions`),locale:Op,inject:()=>({resolveText:t=>e.locale.resolveText(t)})},up)),e.slots.inject(`settings.section`,()=>e.slots.register({name:`settings.section`,id:`codexhost-connect-devices`,order:1,label:()=>t(`remoteAccess`),locale:Op},qf)),jp.forEach(([n,r,o])=>{e.slots.inject(`settings.section`,()=>e.slots.register({name:`settings.section`,id:`codexhost-${n}`,order:o,label:()=>t(r),locale:Op,inject:()=>({pageId:n,locale:i,colorScheme:a})},Tp))});for(let t of[`sidebar.session.row.identity`,`workspace.recent.shortcut.identity`])e.slots.inject(t,()=>e.slots.register({name:t,id:`codexhost.harness`,inject:()=>({list:e.sessions.list})},ud));e.slots.inject(`conversation.header.notice`,()=>e.slots.register({name:`conversation.header.notice`,id:`codexhost.connection`,locale:Op,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.session-opening`,locale:Op,inject:()=>({navigation:e.uiWorkspace})},Dd)),e.slots.inject(`conversation.composer.dock`,()=>e.slots.register({name:`conversation.composer.dock`,id:`codexhost.usage`,order:2,locale:Op},qd)),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`),bd(),xd(),e.effect(()=>wd(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}`),r.openSession(t))})();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=Op,n.PANEL_ID=kp,n.apply=Mp,n.inject=Ap,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 li(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:fi(t,`input`,e.processors),output:fi(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function ui(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 ui(r.element,n);if(r.type===`set`)return ui(r.valueType,n);if(r.type===`lazy`)return ui(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 ui(r.innerType,n);if(r.type===`intersection`)return ui(r.left,n)||ui(r.right,n);if(r.type===`record`||r.type===`map`)return ui(r.keyType,n)||ui(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:ui(r.in,n)||ui(r.out,n);if(r.type===`object`){for(let e in r.shape)if(ui(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(ui(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(ui(e,n))return!0;return!!(r.rest&&ui(r.rest,n))}return!1}let di=(e,t={})=>n=>{let r=si({...n,processors:t});return F(e,r),ci(r,e),li(r,e)},fi=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=si({...i??{},target:a,io:t,processors:n});return F(e,o),ci(o,e),li(o,e)},pi={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},mi=(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=pi[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}))])}},hi=(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)},gi=(e,t,n,r)=>{n.type=`boolean`},_i=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},vi=(e,t,n,r)=>{n.not={}},yi=(e,t,n,r)=>{let i=e._zod.def,a=g(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},bi=(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}},xi=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},Si=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},Ci=(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`]})},wi=(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)},Ti=(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},Ei=(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]]},Di=(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)},Oi=(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)}},ki=(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`}]},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},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,n.default=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,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},Ni=(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},Pi=(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},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,n.readOnly=!0},Ii=(e,t,n,r)=>{let i=e._zod.def;F(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Li=(e,t,n,r)=>{let i=e._zod.innerType;F(i,t,r);let a=t.seen.get(e);a.ref=i},Ri=/*@__PURE__*/ d(`ZodISODateTime`,(e,t)=>{qt.init(e,t),R.init(e,t)});function zi(e){return/* @__PURE__ */ Er(Ri,e)}let Bi=/*@__PURE__*/ d(`ZodISODate`,(e,t)=>{Jt.init(e,t),R.init(e,t)});function Vi(e){return/* @__PURE__ */ Dr(Bi,e)}let Hi=/*@__PURE__*/ d(`ZodISOTime`,(e,t)=>{Yt.init(e,t),R.init(e,t)});function Ui(e){return/* @__PURE__ */ Or(Hi,e)}let Wi=/*@__PURE__*/ d(`ZodISODuration`,(e,t)=>{Xt.init(e,t),R.init(e,t)});function Gi(e){return/* @__PURE__ */ kr(Wi,e)}let Ki=/*@__PURE__*/ d(`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,_,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,_,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),qi=/* @__PURE__ */ Te(Ki),Ji=/* @__PURE__ */ Ee(Ki),Yi=/* @__PURE__ */ De(Ki),Xi=/* @__PURE__ */ ke(Ki),Zi=/* @__PURE__ */ je(Ki),Qi=/* @__PURE__ */ Me(Ki),$i=/* @__PURE__ */ Ne(Ki),ea=/* @__PURE__ */ Pe(Ki),ta=/* @__PURE__ */ Fe(Ki),na=/* @__PURE__ */ Ie(Ki),ra=/* @__PURE__ */ Le(Ki),ia=/* @__PURE__ */ Re(Ki),aa=/* @__PURE__ */ new WeakMap;function oa(e,t,n){let r=Object.getPrototypeOf(e),i=aa.get(r);if(i||(i=/* @__PURE__ */ new Set,aa.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__*/ d(`ZodType`,(e,t)=>(N.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:fi(e,`input`),output:fi(e,`output`)}}),e.toJSONSchema=di(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>qi(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>Yi(e,t,n),e.parseAsync=async(t,n)=>Ji(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>Xi(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>Zi(e,t,n),e.decode=(t,n)=>Qi(e,t,n),e.encodeAsync=async(t,n)=>$i(e,t,n),e.decodeAsync=async(t,n)=>ea(e,t,n),e.safeEncode=(t,n)=>ta(e,t,n),e.safeDecode=(t,n)=>na(e,t,n),e.safeEncodeAsync=async(t,n)=>ra(e,t,n),e.safeDecodeAsync=async(t,n)=>ia(e,t,n),oa(e,`ZodType`,{check(...e){let t=this.def;return this.clone(T(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 re(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(wo(e,t))},superRefine(e,t){return this.check(To(e,t))},overwrite(e){return this.check(/* @__PURE__ */ Xr(e))},optional(){return no(this)},exactOptional(){return io(this)},nullable(){return oo(this)},nullish(){return no(oo(this))},nonoptional(e){return po(this,e)},array(){return V(this)},or(e){return Ha([this,e])},and(e){return Ka(this,e)},transform(e){return _o(this,eo(e))},default(e){return co(this,e)},prefault(e){return uo(this,e)},catch(e){return ho(this,e)},pipe(e){return _o(this,e)},readonly(){return yo(this)},describe(e){let t=this.clone();return nr.add(t,{description:e}),t},meta(...e){if(e.length===0)return nr.get(this);let t=this.clone();return nr.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 nr.get(e)?.description},configurable:!0}),e)),sa=/*@__PURE__*/ d(`_ZodString`,(e,t)=>{Ft.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>mi(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,oa(e,`_ZodString`,{regex(...e){return this.check(/* @__PURE__ */ Wr(...e))},includes(...e){return this.check(/* @__PURE__ */ qr(...e))},startsWith(...e){return this.check(/* @__PURE__ */ Jr(...e))},endsWith(...e){return this.check(/* @__PURE__ */ Yr(...e))},min(...e){return this.check(/* @__PURE__ */ Hr(...e))},max(...e){return this.check(/* @__PURE__ */ Vr(...e))},length(...e){return this.check(/* @__PURE__ */ Ur(...e))},nonempty(...e){return this.check(/* @__PURE__ */ Hr(1,...e))},lowercase(e){return this.check(/* @__PURE__ */ Gr(e))},uppercase(e){return this.check(/* @__PURE__ */ Kr(e))},trim(){return this.check(/* @__PURE__ */ Qr())},normalize(...e){return this.check(/* @__PURE__ */ Zr(...e))},toLowerCase(){return this.check(/* @__PURE__ */ $r())},toUpperCase(){return this.check(/* @__PURE__ */ ei())},slugify(){return this.check(/* @__PURE__ */ ti())}})}),ca=/*@__PURE__*/ d(`ZodString`,(e,t)=>{Ft.init(e,t),sa.init(e,t),e.email=t=>e.check(/* @__PURE__ */ ir(la,t)),e.url=t=>e.check(/* @__PURE__ */ ur(fa,t)),e.jwt=t=>e.check(/* @__PURE__ */ Tr(Oa,t)),e.emoji=t=>e.check(/* @__PURE__ */ dr(ma,t)),e.guid=t=>e.check(/* @__PURE__ */ ar(ua,t)),e.uuid=t=>e.check(/* @__PURE__ */ or(da,t)),e.uuidv4=t=>e.check(/* @__PURE__ */ sr(da,t)),e.uuidv6=t=>e.check(/* @__PURE__ */ cr(da,t)),e.uuidv7=t=>e.check(/* @__PURE__ */ lr(da,t)),e.nanoid=t=>e.check(/* @__PURE__ */ fr(ha,t)),e.guid=t=>e.check(/* @__PURE__ */ ar(ua,t)),e.cuid=t=>e.check(/* @__PURE__ */ pr(ga,t)),e.cuid2=t=>e.check(/* @__PURE__ */ mr(_a,t)),e.ulid=t=>e.check(/* @__PURE__ */ hr(va,t)),e.base64=t=>e.check(/* @__PURE__ */ Sr(Ta,t)),e.base64url=t=>e.check(/* @__PURE__ */ Cr(Ea,t)),e.xid=t=>e.check(/* @__PURE__ */ gr(ya,t)),e.ksuid=t=>e.check(/* @__PURE__ */ _r(ba,t)),e.ipv4=t=>e.check(/* @__PURE__ */ vr(xa,t)),e.ipv6=t=>e.check(/* @__PURE__ */ yr(Sa,t)),e.cidrv4=t=>e.check(/* @__PURE__ */ br(Ca,t)),e.cidrv6=t=>e.check(/* @__PURE__ */ xr(wa,t)),e.e164=t=>e.check(/* @__PURE__ */ wr(Da,t)),e.datetime=t=>e.check(zi(t)),e.date=t=>e.check(Vi(t)),e.time=t=>e.check(Ui(t)),e.duration=t=>e.check(Gi(t))});function L(e){return/* @__PURE__ */ rr(ca,e)}let R=/*@__PURE__*/ d(`ZodStringFormat`,(e,t)=>{P.init(e,t),sa.init(e,t)}),la=/*@__PURE__*/ d(`ZodEmail`,(e,t)=>{Rt.init(e,t),R.init(e,t)}),ua=/*@__PURE__*/ d(`ZodGUID`,(e,t)=>{It.init(e,t),R.init(e,t)}),da=/*@__PURE__*/ d(`ZodUUID`,(e,t)=>{Lt.init(e,t),R.init(e,t)}),fa=/*@__PURE__*/ d(`ZodURL`,(e,t)=>{zt.init(e,t),R.init(e,t)});function pa(e){return/* @__PURE__ */ ur(fa,e)}let ma=/*@__PURE__*/ d(`ZodEmoji`,(e,t)=>{Bt.init(e,t),R.init(e,t)}),ha=/*@__PURE__*/ d(`ZodNanoID`,(e,t)=>{Vt.init(e,t),R.init(e,t)}),ga=/*@__PURE__*/ d(`ZodCUID`,(e,t)=>{Ht.init(e,t),R.init(e,t)}),_a=/*@__PURE__*/ d(`ZodCUID2`,(e,t)=>{Ut.init(e,t),R.init(e,t)}),va=/*@__PURE__*/ d(`ZodULID`,(e,t)=>{Wt.init(e,t),R.init(e,t)}),ya=/*@__PURE__*/ d(`ZodXID`,(e,t)=>{Gt.init(e,t),R.init(e,t)}),ba=/*@__PURE__*/ d(`ZodKSUID`,(e,t)=>{Kt.init(e,t),R.init(e,t)}),xa=/*@__PURE__*/ d(`ZodIPv4`,(e,t)=>{Zt.init(e,t),R.init(e,t)}),Sa=/*@__PURE__*/ d(`ZodIPv6`,(e,t)=>{Qt.init(e,t),R.init(e,t)}),Ca=/*@__PURE__*/ d(`ZodCIDRv4`,(e,t)=>{$t.init(e,t),R.init(e,t)}),wa=/*@__PURE__*/ d(`ZodCIDRv6`,(e,t)=>{en.init(e,t),R.init(e,t)}),Ta=/*@__PURE__*/ d(`ZodBase64`,(e,t)=>{nn.init(e,t),R.init(e,t)}),Ea=/*@__PURE__*/ d(`ZodBase64URL`,(e,t)=>{an.init(e,t),R.init(e,t)}),Da=/*@__PURE__*/ d(`ZodE164`,(e,t)=>{on.init(e,t),R.init(e,t)}),Oa=/*@__PURE__*/ d(`ZodJWT`,(e,t)=>{cn.init(e,t),R.init(e,t)}),ka=/*@__PURE__*/ d(`ZodNumber`,(e,t)=>{ln.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>hi(e,t,n,r),oa(e,`ZodNumber`,{gt(e,t){return this.check(/* @__PURE__ */ Rr(e,t))},gte(e,t){return this.check(/* @__PURE__ */ zr(e,t))},min(e,t){return this.check(/* @__PURE__ */ zr(e,t))},lt(e,t){return this.check(/* @__PURE__ */ Ir(e,t))},lte(e,t){return this.check(/* @__PURE__ */ Lr(e,t))},max(e,t){return this.check(/* @__PURE__ */ Lr(e,t))},int(e){return this.check(ja(e))},safe(e){return this.check(ja(e))},positive(e){return this.check(/* @__PURE__ */ Rr(0,e))},nonnegative(e){return this.check(/* @__PURE__ */ zr(0,e))},negative(e){return this.check(/* @__PURE__ */ Ir(0,e))},nonpositive(e){return this.check(/* @__PURE__ */ Lr(0,e))},multipleOf(e,t){return this.check(/* @__PURE__ */ Br(e,t))},step(e,t){return this.check(/* @__PURE__ */ Br(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__ */ Ar(ka,e)}let Aa=/*@__PURE__*/ d(`ZodNumberFormat`,(e,t)=>{un.init(e,t),ka.init(e,t)});function ja(e){return/* @__PURE__ */ jr(Aa,e)}let Ma=/*@__PURE__*/ d(`ZodBoolean`,(e,t)=>{dn.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>gi(e,t,n,r)});function B(e){return/* @__PURE__ */ Mr(Ma,e)}let Na=/*@__PURE__*/ d(`ZodNull`,(e,t)=>{fn.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_i(e,t,n,r)});function Pa(e){return/* @__PURE__ */ Nr(Na,e)}let Fa=/*@__PURE__*/ d(`ZodUnknown`,(e,t)=>{pn.init(e,t),I.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Ia(){return/* @__PURE__ */ Pr(Fa)}let La=/*@__PURE__*/ d(`ZodNever`,(e,t)=>{mn.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>vi(e,t,n,r)});function Ra(e){return/* @__PURE__ */ Fr(La,e)}let za=/*@__PURE__*/ d(`ZodArray`,(e,t)=>{gn.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ci(e,t,n,r),e.element=t.element,oa(e,`ZodArray`,{min(e,t){return this.check(/* @__PURE__ */ Hr(e,t))},nonempty(e){return this.check(/* @__PURE__ */ Hr(1,e))},max(e,t){return this.check(/* @__PURE__ */ Vr(e,t))},length(e,t){return this.check(/* @__PURE__ */ Ur(e,t))},unwrap(){return this.element}})});function V(e,t){return/* @__PURE__ */ ni(za,e,t)}let Ba=/*@__PURE__*/ d(`ZodObject`,(e,t)=>{xn.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wi(e,t,n,r),C(e,`shape`,()=>t.shape),oa(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:Ia()})},loose(){return this.clone({...this._zod.def,catchall:Ia()})},strict(){return this.clone({...this._zod.def,catchall:Ra()})},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(to,this,e[0])},required(...e){return fe(fo,this,e[0])}})});function H(e,t){let n={type:`object`,shape:e??{},...M(t)};return new Ba(n)}function U(e,t){return new Ba({type:`object`,shape:e,catchall:Ra(),...M(t)})}let Va=/*@__PURE__*/ d(`ZodUnion`,(e,t)=>{Cn.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ti(e,t,n,r),e.options=t.options});function Ha(e,t){return new Va({type:`union`,options:e,...M(t)})}let Ua=/*@__PURE__*/ d(`ZodDiscriminatedUnion`,(e,t)=>{Va.init(e,t),wn.init(e,t)});function Wa(e,t,n){return new Ua({type:`union`,options:t,discriminator:e,...M(n)})}let Ga=/*@__PURE__*/ d(`ZodIntersection`,(e,t)=>{Tn.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ei(e,t,n,r)});function Ka(e,t){return new Ga({type:`intersection`,left:e,right:t})}let qa=/*@__PURE__*/ d(`ZodTuple`,(e,t)=>{On.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Di(e,t,n,r),e.rest=t=>e.clone({...e._zod.def,rest:t})});function Ja(e,t,n){let r=t instanceof N;return new qa({type:`tuple`,items:e,rest:r?t:null,...M(r?n:t)})}let Ya=/*@__PURE__*/ d(`ZodRecord`,(e,t)=>{Mn.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Oi(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function Xa(e,t,n){return!t||!t._zod?new Ya({type:`record`,keyType:L(),valueType:e,...M(t)}):new Ya({type:`record`,keyType:e,valueType:t,...M(n)})}let Za=/*@__PURE__*/ d(`ZodEnum`,(e,t)=>{Nn.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>yi(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 Za({...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 Za({...t,checks:[],...M(r),entries:i})}});function W(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new Za({type:`enum`,entries:n,...M(t)})}let Qa=/*@__PURE__*/ d(`ZodLiteral`,(e,t)=>{Pn.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bi(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 Qa({type:`literal`,values:Array.isArray(e)?e:[e],...M(t)})}let $a=/*@__PURE__*/ d(`ZodTransform`,(e,t)=>{Fn.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Si(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new p(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 eo(e){return new $a({type:`transform`,transform:e})}let to=/*@__PURE__*/ d(`ZodOptional`,(e,t)=>{Ln.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ii(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function no(e){return new to({type:`optional`,innerType:e})}let ro=/*@__PURE__*/ d(`ZodExactOptional`,(e,t)=>{Rn.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ii(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function io(e){return new ro({type:`optional`,innerType:e})}let ao=/*@__PURE__*/ d(`ZodNullable`,(e,t)=>{zn.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 oo(e){return new ao({type:`nullable`,innerType:e})}let so=/*@__PURE__*/ d(`ZodDefault`,(e,t)=>{Bn.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ji(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function co(e,t){return new so({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():A(t)}})}let lo=/*@__PURE__*/ d(`ZodPrefault`,(e,t)=>{Hn.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Mi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function uo(e,t){return new lo({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():A(t)}})}let fo=/*@__PURE__*/ d(`ZodNonOptional`,(e,t)=>{Un.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ai(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function po(e,t){return new fo({type:`nonoptional`,innerType:e,...M(t)})}let mo=/*@__PURE__*/ d(`ZodCatch`,(e,t)=>{Gn.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ni(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function ho(e,t){return new mo({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}let go=/*@__PURE__*/ d(`ZodPipe`,(e,t)=>{Kn.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Pi(e,t,n,r),e.in=t.in,e.out=t.out});function _o(e,t){return new go({type:`pipe`,in:e,out:t})}let vo=/*@__PURE__*/ d(`ZodReadonly`,(e,t)=>{Jn.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 yo(e){return new vo({type:`readonly`,innerType:e})}let bo=/*@__PURE__*/ d(`ZodLazy`,(e,t)=>{Xn.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Li(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function xo(e){return new bo({type:`lazy`,getter:e})}let So=/*@__PURE__*/ d(`ZodCustom`,(e,t)=>{Zn.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xi(e,t,n,r)});function Co(e,t){return/* @__PURE__ */ ri(So,e??(()=>!0),t)}function wo(e,t={}){return/* @__PURE__ */ ii(So,e,t)}function To(e,t){return/* @__PURE__ */ ai(e,t)}let Eo=W([`active`,`paused`,`blocked`,`usageLimited`,`budgetLimited`,`complete`]),Do=z().int().nonnegative().safe();H({objective:L().min(1),status:Eo,tokenBudget:Do.positive().nullable(),tokensUsed:Do,timeUsedSeconds:Do,createdAt:Do,updatedAt:Do});let Oo=W([`user`,`automatic`]).nullable();H({objective:L().min(1).optional(),status:W([`active`,`paused`]).optional(),tokenBudget:Do.positive().nullable().optional(),origin:Oo});let ko=/^[A-Za-z0-9_-]{1,128}$/u,Ao=L().min(1).max(128);Wa(`operation`,[H({operation:G(`create`),requestId:Ao,body:L().min(1).max(16<<20),headers:Xa(L(),L()).default({})}),H({operation:G(`cancel`),requestId:Ao}),H({operation:G(`hangup`),callId:L().regex(ko)})]),H({status:z().int().min(200).max(599),body:L(),headers:Xa(L(),L())});let jo=U({threadId:L().trim().min(1).max(128),verbs:V(W([`read`,`watch`,`send`,`cancel`])).min(1).max(4)}),Mo=U({enrollmentId:L().trim().min(1).max(128),threadId:L().trim().min(1).max(128),clientId:L().trim().min(1).max(64),executablePath:L().min(1).max(4096),endpoint:L().min(1).max(2048),issuedAt:L().min(1).max(64),expiresAt:L().min(1).max(64),pairing:W([`session`,`machine`]),allowlist:V(jo).max(64)});U({}),U({enrollments:V(Mo).max(256)}),U({enrollmentId:L().trim().min(1).max(128)}),U({enrollmentId:L().trim().min(1).max(128),revoked:G(!0)}),U({v:G(1),secret:L().min(1).max(4096)}),U({v:G(1),ok:G(!0)}),U({requestId:L().min(1).max(128),deadlineMs:z().int().positive(),route:L().min(1).max(128),body:Xa(L(),Ia()),operationalClient:L().min(1).max(64).optional(),oauthClientId:L().min(1).max(128).optional(),dispatchGrant:W([`legacy-four`,`full-dispatch`]).optional()});let No=U({code:L().min(1).max(64),message:L().max(2048),details:Ia().optional()});U({requestId:L().min(1).max(128),status:z().int().min(100).max(599).optional(),body:Ia().optional(),error:No.optional()}),U({threadId:L().min(1),view:W([`result`,`messages`]).optional(),cursor:L().optional(),limit:z().int().min(1).max(100).optional()}),U({threadId:L().min(1),timeoutMs:z().int().min(1).max(25e3).optional(),view:W([`result`,`messages`]).optional(),cursor:L().optional(),limit:z().int().min(1).max(100).optional()}),U({threadId:L().min(1),message:L().min(1).max(2097152)}),U({}),U({clientId:L().min(1),pairing:W([`machine`,`session`]),expiresAt:L().min(1),allowlist:V(U({threadId:L().min(1),verbs:V(L().min(1)).min(1)})),threadId:L().min(1),link:W([`online`,`offline`]),runtime:W([`reachable`,`unreachable`])});let Po=L().trim().min(1).max(64).regex(/^[a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?$/u),Fo=W([`all-threads`,`selected-workspaces`]),Io=W([`public-relay`,`local`,`direct`]),Lo=W([`legacy-four`,`full-dispatch`]),Ro=L().trim().min(1).max(4096),zo=L().trim().max(2048),Bo=U({name:Po,createdAt:L().min(1).max(64),access:Fo,workspaces:V(Ro).max(64),connectionMode:Io,dispatchGrant:Lo,oauthClientId:L().trim().min(1).max(128).optional(),directUrl:zo.optional(),mcpUrl:L().min(1).max(2048).optional(),mcpUrlNote:L().min(1).max(512).optional()});U({}),U({clients:V(Bo).max(256)});let Vo=U({access:Fo.optional(),workspaces:V(Ro).max(64).optional(),connectionMode:Io.optional(),dispatchGrant:Lo.optional(),oauthClientId:L().trim().min(1).max(128).optional(),directUrl:zo.optional()});Vo.extend({name:Po}),Bo.extend({token:L().min(1).max(256).optional()}),Vo.extend({name:Po,clearOauthClientId:G(!0).optional()}),U({name:Po}),U({name:Po,revoked:G(!0)}),H({}).strict(),H({enabled:B().optional(),browser:B().optional()}).strict().refine(e=>e.enabled!==void 0||e.browser!==void 0,{message:`Expected enabled or browser`}),H({enabled:B(),available:B(),unavailableReason:L().min(1).max(500).optional(),browser:B().optional(),browserFilesPresent:B().optional(),browserAvailable:B().optional(),browserUnavailableReason:L().min(1).max(500).optional(),applyFailed:B().optional(),applyError:L().min(1).max(500).optional()}).strict();function Ho(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 Uo=Ha([L(),z(),B(),Pa()]);function Wo(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 Go=Co(Wo,{message:`JSON value must not contain circular references`}),Ko=xo(()=>Ha([Uo,V(Ko),Xa(L(),Ko)])),qo=Go.pipe(Ko);Go.pipe(V(Ko));let Jo=Go.pipe(Xa(L(),Ko)),Yo=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(Ho([`diagnostic`,`stage`,`durationMs`,`stderrTail`])),Xo=L().max(64).regex(/^[a-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/u),Zo=e=>L().min(1).max(e).refine(e=>e.trim().length>0),Qo=Xa(Xo,H({label:Zo(256).optional(),description:Zo(1024).optional()}).strict()).refine(e=>Object.keys(e).length<=16,`Too many locales`),$o=Xa(Xo,Zo(4096)).refine(e=>typeof e.en==`string`,`English fallback is required`).refine(e=>Object.keys(e).length<=16,`Too many locales`),es=L().refine(e=>e.trim().length>0,{message:`Identifier must not be empty or whitespace`}),ts=es.brand(),K=es.brand(),ns=es.brand(),rs=es.brand(),is=es.brand(),as=L().refine(e=>e.trim().length>0,{message:`Value must not be empty or whitespace`}),os=as.max(128).regex(/^[A-Za-z0-9._~:-]+$/u,`Permission Mode ID must use transport-safe characters`).brand(),ss=H({modes:V(H({id:os,label:as.max(256),description:as.max(1024).optional(),dangerous:B().optional(),localizations:Qo.optional()}).strict()).min(1).max(32),defaultModeId:os}).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:os}).strict();let cs=z().int().safe().nonnegative(),ls=z().finite().nonnegative(),us=z().finite().min(0).max(100),ds=H({value:ls,turnId:L().min(1).max(1024),at:cs}).strict();H({outputTokensPerSecond:ds.optional(),timeToFirstOutputMs:ds.extend({value:cs}).optional()}).strict();let fs=e=>$o.refine(t=>Object.values(t).every(t=>t.length<=e)),ps=H({composerIndicators:V(H({kind:G(`countdown`),id:L().min(1).max(64),expiresAtUnix:cs,label:fs(256).optional(),tooltip:fs(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:cs.optional(),cachedInputTokens:cs.optional(),cacheWriteInputTokens:cs.optional(),outputTokens:cs.optional(),outputTokensPerSecond:ls.optional(),apiOutputTokensPerSecond:ls.optional(),reasoningOutputTokens:cs.optional(),totalTokens:cs.optional(),totalCostUsd:ls.optional(),totalCredits:ls.optional(),contextUsagePercent:ls.optional(),cacheHitRatePercent:us.optional(),contextWindowTokens:cs.optional(),contextUsedTokens:cs.optional(),planFiveHourUsedPercent:us.optional(),planFiveHourResetsAtUnix:cs.optional(),planSevenDayUsedPercent:us.optional(),planSevenDayResetsAtUnix:cs.optional(),sessionCacheHitRatePercent:us.optional(),timeToFirstOutputMs:cs.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`]})}),ms=z().finite().min(0).max(100),hs=W([`weekly`,`monthly`,`five_hour`,`seven_day`,`unknown`]),gs=H({id:L().min(1).max(256),label:L().min(1).max(256),localizations:Qo.optional()}).strict(),_s=H({product:L().min(1),periodType:hs.optional(),scope:gs.optional(),localizations:Qo.optional(),used:z().finite().nonnegative().optional(),limit:z().finite().nonnegative().optional(),unit:L().min(1).max(32).optional(),usagePercent:ms,resetsAt:L().min(1).optional()}).strict(),vs=H({availableCount:z().int().safe().positive(),nextExpiresAt:L().min(1).optional(),expiresAt:V(L().min(1)).min(1).max(32).optional()}).strict(),ys=H({used:z().finite().nonnegative().optional(),limit:z().finite().nonnegative().optional(),unit:L().min(1).max(32).optional(),label:L().min(1).optional(),scope:gs.optional(),localizations:Qo.optional(),usedPercent:ms,resetsAt:L().min(1).optional(),periodType:hs,productUsage:V(_s).min(1).optional(),resetCredits:vs.optional()}).strict();H({threadId:K,refresh:G(`exact`).optional()}).strict(),H({threadId:K,usage:ps.nullable(),accountCredits:ys.optional(),accountCreditsSupported:B().optional()}).strict();let bs=L().refine(e=>e.trim().length>0,{message:`Value must not be empty or whitespace`}),xs=H({id:bs.max(512).regex(/^[A-Za-z0-9._~-]+$/u,`Model Ref must use transport-safe opaque characters`).brand()}).strict(),Ss=bs.max(128).regex(/^[A-Za-z0-9._~-]+$/u,`Thinking option ID must use transport-safe characters`).brand(),Cs=bs.max(256),ws=H({id:Ss,label:bs.max(256)}).strict(),Ts=H({ref:xs,label:bs.max(256),resolvedModelLabel:Cs.optional(),fastModel:xs.optional(),supportedThinkingOptionIds:V(Ss).optional()}).strict(),Es=V(ws).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)}),Ds=H({models:V(Ts),defaultModel:xs.optional(),thinkingOptions:Es,defaultThinkingOptionId:Ss.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`]})}),Os=H({fork:B(),forkAcrossCwd:B(),rollbackLastTurn:B(),rollbackToCheckpoint:B().optional()}).strict().refine(e=>e.fork||!e.forkAcrossCwd,{path:[`forkAcrossCwd`],message:`Cross-cwd Fork requires exact history Fork support`}),ks=W([`live`,`atCreate`]),As=H({configuration:H({selectModel:B(),selectThinkingOption:B(),selectPermissionMode:B(),permissionModeScope:ks.default(`live`)}).strict(),history:Os,subagents:H({observe:B(),readTranscript:B()}).strict().optional(),autonomousTurns:H({observe:B()}).strict().optional(),steer:B().optional()}).strict();H({effectiveModel:xs.optional(),resolvedModelLabel:Cs.optional(),effectiveThinkingOptionId:Ss.optional(),availableThinkingOptions:Es.optional(),effectivePermissionModeId:os.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 js=H({open:G(!0)}).strict();Ha([H({status:G(`ready`),catalog:Ds,permissionModes:ss.optional(),capabilities:As,webUi:js.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:Yo}).strict()]),H({harnessId:ts,cwd:bs.max(16384).optional(),refresh:B().optional(),purpose:G(`availability`).optional()}).strict(),H({harnessId:ts}).strict(),H({}).strict(),H({threadId:K,model:xs}).strict(),H({threadId:K,thinkingOptionId:Ss}).strict(),H({threadId:K,includeReferenceCapability:B().optional()}).strict(),Wa(`owner`,[H({owner:G(`codex`),locked:B(),effectiveModel:xs.optional(),resolvedModelLabel:Cs.optional(),effectiveThinkingOptionId:Ss.optional(),effectivePermissionModeId:os.optional(),history:Os.optional(),supportsThreadReferences:G(!0).optional()}).strict(),H({owner:G(`external`),harnessId:bs.max(256),transportModelId:bs.max(1024),effectiveModel:xs.optional(),resolvedModelLabel:Cs.optional(),effectiveThinkingOptionId:Ss.optional(),availableThinkingOptions:Es.optional(),effectivePermissionModeId:os.optional(),history:Os,usage:ps.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)});let Ms=Wa(`owner`,[H({threadId:K,owner:G(`codex`)}).strict(),H({threadId:K,owner:G(`external`),harnessId:L().max(256).pipe(ts)}).strict()]);H({threads:V(Ms).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`}),u}}).pipe(H({expectedTurnId:ns,clientUserMessageId:L().min(1),delivery:W([`newTurn`,`activeTurn`])}).strict())}).strict().transform(e=>e.value),W([`activeTurn`,`newTurn`]),H({delivery:W([`official`,`activeTurn`,`newTurn`])}).strict();let Ns=U({chatExperience:W([`chatgpt`,`codex`]),chatConnection:W([`desktop`,`gateway`]),workConnection:W([`desktop`,`gateway`])});Object.freeze({chatExperience:`chatgpt`,chatConnection:`desktop`,workConnection:`gateway`});let Ps=Ns.extend({inject:B()});Wa(`operation`,[U({operation:G(`get`),runtime:U({id:L().uuid(),revision:L().max(64),activeCall:B()}).optional()}),U({operation:G(`migrate`),routes:Ns}),U({operation:G(`set`),settings:Ps,revision:L().max(64)}),U({operation:G(`restart`),confirm:G(!0)})]),U({settings:Ps,initialized:B(),revision:L(),activeInject:B().nullable(),envOverride:W([`0`,`1`]).nullable(),activeEnvOverride:W([`0`,`1`]).nullable(),routesActive:B().nullable(),activeCall:B().nullable(),gatewayReady:B().nullable(),restartAvailable:B(),restart:U({phase:W([`idle`,`restarting`,`succeeded`,`failed`]),error:L().nullable()})}),H({threadIds:V(L().min(1))}).strict(),H({threadId:L().min(1).max(1024),pinned:B()}).strict(),H({}).strict(),H({parents:Xa(L().min(1),L().min(1))}).strict(),H({prompt:L().max(16384).optional()}).strict(),H({projects:V(H({id:L(),name:L(),rootPaths:V(L())})),assignments:Xa(L(),L()),projectless:V(L()),pinned:V(L())});let Fs=Xa(L(),Ia()),Is=H({epoch:L().uuid(),sequence:z().int().nonnegative()});Wa(`type`,[H({type:G(`skills-changed`),cursor:Is,cwd:L().optional()}),H({type:G(`display-settings-changed`),cursor:Is}),H({type:G(`preferences-changed`),cursor:Is,revision:z().int().nonnegative()}),H({type:G(`hello`),version:G(1),cursor:Is,reset:B()}),H({type:G(`changed`),cursor:Is,threadId:L().min(1),method:L().min(1)})]);let Ls=Wa(`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()}))})]),Rs=Wa(`type`,[H({type:G(`approval`),title:L(),description:L().optional(),subject:Ia().optional(),actions:V(H({id:L(),label:L(),effect:L()}))}),H({type:G(`question`),title:L().optional(),questions:V(Ls)})]),zs=H({requestId:Ha([L(),z().int()]),threadId:L(),kind:W([`approval`,`question`]),interaction:Rs,request:Fs}),Bs=H({id:L().min(1),clientUserMessageId:L().min(1),input:V(Fs),presentationInput:V(Fs).nullable().optional()}).passthrough();H({fields:V(H({path:V(Ha([L(),z().int().nonnegative()])),originalLength:z().int().nonnegative()}))});let Vs=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(),Hs=H({id:L().min(1).max(512),fingerprint:L().min(1).max(128)});H({threadId:L().min(1),knownTurns:V(Hs).max(64).optional(),truncateToolOutput:B().optional()});let Us=H({harnessId:L().min(1),nativeSessionId:L().min(1)});H({cursor:Is,activeTurnId:L().min(1).nullable().optional(),command:H({name:L().min(1),turn:Vs}).optional(),thread:H({id:L().min(1),cwd:L(),modelProvider:L().min(1),createdAt:z(),updatedAt:z(),status:H({type:L()}).passthrough(),name:L().nullable().optional(),preview:L().optional(),codexhostImportSource:Us.optional(),turns:V(Vs).length(0)}).passthrough(),turnsPage:H({data:V(Vs).max(5),nextCursor:L().nullable()}),configuration:H({native:H({model:L().min(1).max(1024).optional(),reasoningEffort:L().min(1).max(128).optional()}).optional(),effectiveModel:xs.optional(),effectiveThinkingOptionId:Ss.optional(),effectivePermissionModeId:os.optional()}),queue:H({items:V(Bs),pausedReason:W([`interrupted`,`outcome-unknown`,`failed`]).nullable()}).optional(),interactions:V(zs)}),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:Ha([L(),z().int()]),result:Fs}),H({includeArchived:B().optional(),officialCursor:H({live:L().nullable(),archived:L().nullable().optional()}).strict().optional()}).strict(),H({threads:V(Jo),ownership:V(Ms),archivedThreadIds:V(K),officialCursor:H({live:L().nullable(),archived:L().nullable().optional()}).strict().optional()}).strict();let Ws=L().regex(/^audio\/[a-z0-9.+-]+(?:\s*;[^\r\n]*)?$/i),Gs=H({available:B()}).strict();H({path:L().min(1),mimeType:Ws}).strict();let Ks=W([`credentials-unavailable`,`login-expired`,`rate-limited`,`service-rejected`,`host-incompatible`,`network`,`timeout`,`audio-empty`,`audio-too-large`,`audio-format`,`audio-invalid`]),qs=Wa(`ok`,[H({ok:G(!0),text:L()}).strict(),H({ok:G(!1),error:H({code:Ks}).strict()}).strict()]);H({threadId:K.optional(),cwd:L().min(1).optional()}).strict().refine(e=>!(e.threadId&&e.cwd),{message:`Specify threadId or cwd, not both`});let Js=H({name:L().min(1).regex(/^[^\s[\]]+$/u),description:L().optional(),path:L().min(1),scope:W([`project`,`global`]),source:L().min(1)}).strict(),Ys=H({revision:z().int().nonnegative(),complete:B(),skills:V(Js),warnings:V(L()).optional()}).strict();H({cwd:L().min(1).optional()}).strict();let Xs=`codexhost-skill`;function Zs(e){let t=/[\s()]/u.test(e.path)?`<${e.path}>`:e.path;return`[$${e.name}](${t} "Read this skill")`}let Qs=H({kind:W([`public`,`relay`,`tailscale-funnel`,`tailscale-https`,`tailscale`,`lan`,`virtual`]),url:L().min(1)}).strict(),$s=Wa(`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()})]),ec=H({state:$s,error:L().optional()}).strict(),tc=Wa(`status`,[H({status:G(`on`)}),H({status:G(`off`)}),H({status:G(`invalid`),reason:L()})]),nc=H({lan:B(),autostart:tc}).strict(),rc=H({expiresAt:L().optional(),issuing:B(),failure:H({detail:L().optional(),retryAt:L(),paused:B()}).optional()}),ic=Wa(`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:rc}),H({status:G(`missing-certificate`),url:L(),certificate:rc}),H({status:G(`stopped`),reason:W([`replaced`,`rejected`,`unsupported-version`])})]),ac=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()),oc=L().regex(/^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)?$/),sc=W([`official`,`self-hosted`]),cc=H({secret:L().min(1),lastUsedAt:z().nullable(),networkUrls:V(Qs),directCandidates:V(Qs).optional(),tailscale:$s,background:nc.optional(),relay:H({state:ic,enabled:B(),kind:sc,officialHost:L(),customHost:L().optional(),officialHostname:L().optional(),customHostname:L().optional(),quotaUntil:L().optional()}).strict().optional()}).strict(),lc=H({url:L()}).strict(),uc=U({threadId:L().min(1).max(1024),view:W([`result`,`messages`]),from:z().int().min(1).max(2**53-1).optional(),to:z().int().min(1).max(2**53-1).optional()}),dc=H({id:L().min(1).max(256),harnessId:L().min(1),label:L().min(1).max(512),provider:W([`openai-codex`,`xai`])}).strict(),fc=L().regex(/^[a-z][a-z0-9-]{0,47}$/),pc=H({name:fc,source:dc,importedAt:L()}).strict(),mc=Wa(`action`,[H({action:G(`list`)}).strict(),H({action:G(`import`),sourceId:L().min(1).max(256),name:fc,confirmed:G(!0)}).strict(),H({action:G(`reimport`),sourceId:L().min(1).max(256),name:fc,confirmed:G(!0)}).strict(),H({action:G(`remove`),name:fc,confirmed:G(!0)}).strict()]),hc=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(dc),targets:V(H({harnessId:L(),providers:V(W([`openai-codex`,`xai`])),imports:V(pc),others:V(hc).default([])}).strict())}).strict(),H({targetHarnessId:L().min(1).max(128).optional(),request:mc}).strict(),H({events:B()});let gc=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:gc.nullable()}),U({}),U({entries:gc,initializeOnly:B().optional()});let _c=U({enabled:B(),timeoutMinutes:z().int().min(5).max(1440)});Object.freeze({enabled:!1,timeoutMinutes:10});let vc=L().regex(/^external$/u),yc=ts.transform(e=>String(e)),bc=U({model:xs.optional(),thinkingOptionId:Ss.optional(),permissionModeId:os.optional()}).refine(e=>!!(e.model||e.thinkingOptionId||e.permissionModeId),`A default configuration must contain a preference`),xc=U({lastHarness:ts.optional(),byHarness:Xa(yc,bc)}),Sc=L().min(1).max(1024),Cc=U({idleRelease:_c.optional(),favorites:Xa(yc,V(Sc).max(2048)).default({}),newThread:xc.optional()});U({scope:vc,revision:z().int().nonnegative(),values:Cc}),U({scope:vc.default(`external`)});let wc=Wa(`kind`,[U({kind:G(`idleRelease`),value:_c}),U({kind:G(`favorite`),harnessId:ts,modelId:Sc,enabled:B()}),U({kind:G(`favorites`),harnessId:ts,modelIds:V(Sc).max(2048)}),U({kind:G(`newThread`),lastHarness:ts.optional(),harnessId:ts.optional(),configuration:bc.optional()})]);U({scope:vc.default(`external`),operations:V(wc).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`})}),U({version:G(1),revision:z().int().nonnegative(),scopes:Xa(vc,Cc)});let Tc=z().finite().nonnegative(),Ec=U({input:Tc,output:Tc,cacheRead:Tc.optional(),cacheWrite:Tc.optional(),cacheWrite1h:Tc.optional()}),Dc=L().max(512).refine(e=>e.trim()===e&&e.length>0,`Model ID is required`);U({path:L(),entries:V(U({key:L(),price:Ec})),error:L().nullable()}),U({}),U({key:Dc,price:Ec.nullable(),previousKey:Dc.optional()}),U({model:Dc});let Oc=U({official:B().optional(),canonicalModelId:L().min(1).optional(),provider:L().min(1).max(512),model:L().min(1).max(512),price:Ec});U({price:Ec.nullable(),suggestions:V(Oc).max(6).optional()});let kc=[`today`,`7d`,`30d`,`90d`,`all`],Ac=z().int().min(0).max(2**53-1),jc=L().regex(/^\d{4}-\d{2}-\d{2}$/u),Mc=L().min(1).max(128),Nc=L().min(1).max(512),Pc=L().min(1).max(4096);U({range:W(kc),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:Mc.optional(),model:Nc.nullable().optional(),project:Pc.nullable().optional(),date:jc.optional()});let Fc=U({requests:Ac,inputTokens:Ac,cachedInputTokens:Ac,cacheWriteInputTokens:Ac,cacheKnownInputTokens:Ac,cacheHitCachedInputTokens:Ac,cacheHitInputTokens:Ac,outputTokens:Ac,reasoningOutputTokens:Ac,costUsd:z().finite().min(0),unpricedRequests:Ac,unmeteredRequests:Ac}),Ic=Fc.shape,Lc=U({harness:Mc,sessionId:L().min(1).max(512),project:Pc.nullable(),title:L().min(1).max(200).optional(),models:V(Nc).max(16),firstAtMs:Ac,lastAtMs:Ac,...Ic});U({range:W(kc),from:jc.nullable(),to:jc,filters:U({harness:Mc.nullable(),model:Nc.nullable(),unknownModel:B(),project:Pc.nullable(),unknownProject:B(),date:jc.nullable()}),reading:U({complete:B(),sources:Ac,read:Ac}),failures:V(U({harness:Mc,message:L().max(2048)})).max(256),options:U({harnesses:V(Mc).max(256),models:V(Nc.nullable()).max(4096),projects:V(Pc.nullable()).max(4096)}),modelLabels:V(U({harness:Mc,model:Nc,label:Nc})).max(4096).optional(),credits:V(U({harness:Mc,model:Nc.nullable(),credits:z().finite().min(0),reportedRequests:Ac,requests:Ac})).max(4096).optional(),totals:Fc,daily:V(U({date:jc,harness:Mc,...Ic})).max(2e5),hourly:V(U({weekday:z().int().min(0).max(6),hour:z().int().min(0).max(23),...Ic})).max(168),byHarness:V(U({harness:Mc,...Ic})).max(256),byModel:V(U({model:Nc.nullable(),...Ic,harnessPricedRequests:Ac})).max(4096),byProject:V(U({project:Pc.nullable(),...Ic})).max(4096),sessions:V(Lc).max(100),recentSessions:V(Lc).max(100).optional()}),H({threadId:K}),H({discarded:B()}),U({threadId:K,unobserved:G(!0).optional()});let Rc={id:L().min(1),prompt:L(),optional:B()},zc=U({deadlineUnixMs:z().int().min(0).max(864e13),action:W([`recommended`,`decline`]),resetOnActivity:B().optional()}),Bc=Wa(`type`,[U({...Rc,type:G(`choice`),multiple:B(),allowOther:B(),options:V(U({value:L().min(1),label:L(),description:L().optional()})).min(1)}),U({...Rc,type:G(`text`),multiline:B(),secret:G(!1),placeholder:L().optional(),prefill:L().optional()})]);U({questions:V(U({interactionId:is,turnId:ns,title:L().optional(),expiresAt:L().optional(),autoResolution:zc.optional(),questions:V(Bc).min(1)}))});let Vc=W([`answered`,`skipped`,`closedByHarness`,`expired`,`turnEnded`]),Hc=U({interactionId:is,turnId:ns,itemId:rs,title:L().optional(),questions:V(Bc).min(1),outcome:Vc,answers:Xa(L(),V(L()))}),Uc=U({interactionId:is,turnId:ns,itemId:rs});U({records:V(Hc),pendingAnchors:V(Uc)}),U({threadId:K,interactionId:is,turnId:ns,answers:Xa(L(),V(L())),cancelled:B().optional()}),U({accepted:G(!0)}),U({threadId:K,interactionId:is,turnId:ns}),U({autoResolution:zc.nullable()});let Wc=H({path:L(),oldText:L().nullable(),newText:L()});H({sessionId:L().min(1),turn:z().int().nonnegative(),path:L().min(1).optional()});let Gc=H({diffs:V(Wc)});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/voice/gateway-status.codexhost/enrollment/list.codexhost/enrollment/revoke.codexhost/external-clients/list.codexhost/external-clients/create.codexhost/external-clients/update.codexhost/external-clients/revoke.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/grok-computer-use/get.codexhost/harness/grok-computer-use/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 Kc=W([`idle`,`running`,`busy`,`closing`,`failed`,`blocked`]),qc=W([`none`,`disabled`,`timeout`,`operation`,`background`,`identity`,`persistence`,`closeFailed`]);U({threadId:L(),title:L(),harnessId:L(),state:Kc,reason:qc,inactiveMs:z().nonnegative()}),U({threadId:K,turnId:ns});let Jc=H({amount:z().finite().nonnegative(),currency:L().trim().min(1).max(8),label:L().trim().min(1).max(128).optional()}).strict(),Yc=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:ys.optional(),balance:Jc.optional()}).strict();function Xc(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 Zc=Xc(Yc),Qc={harnessId:ts,harnessName:L().trim().min(1).max(128)},$c=H(Qc).strict();H({}).strict(),H({sources:V($c).max(128)}).strict(),H({harnessId:ts,refresh:B().optional()}).strict(),H({...Qc,account:Zc.nullable(),accounts:V(Zc).max(8).optional()}).strict(),H({refresh:B().optional()}).strict(),H({accounts:V(Xc(Yc.extend(Qc))).max(128)}).strict();let el=L().min(1).max(128).regex(/^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/u).pipe(ts),tl=el.refine(e=>e!==`codex`,`The official Codex identity is reserved`),nl=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`),rl=pa().refine(e=>/^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(e),`Plugin documentation links must be credential-free HTTPS URLs`),il=H({en:L().max(4096),"zh-CN":L().max(4096).optional()}).strict(),al=H({commands:V(H({terminal:L().max(256),command:L().max(4096)}).strict()).max(8),before:il.optional(),after:il.optional(),downloads:V(H({label:L().max(128),url:rl}).strict()).max(8).optional()}).strict(),ol={id:el,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:al.optional(),notice:il.optional(),launchCommand:G(!0).optional(),links:H({website:rl.optional(),documentation:rl.optional(),installation:rl.optional()}).strict().optional()};H({manifestVersion:G(1),...ol,adapterApiVersion:z().int().positive(),entry:nl,icon:nl.optional()}).strict();let sl=L().max(174828).regex(/^data:image\/(?:png|jpeg|webp|svg\+xml);base64,[A-Za-z0-9+/]+={0,2}$/u),cl=H({...ol,icon:sl.optional()}).strict();H({}).strict(),H({plugins:V(cl.extend({id:tl})).max(128)}).strict(),H({version:G(1),enabled:V(el).max(128)}).strict().refine(e=>new Set(e.enabled).size===e.enabled.length,{message:`Enabled plugin IDs must be unique`,path:[`enabled`]}),H({harnessId:tl,model:xs.optional(),thinkingOptionId:Ss.optional(),permissionModeId:os.optional(),prewarm:G(!0).optional()}).strict();let ll=L().trim().min(1).max(4096).refine(e=>!/[\u0000\r\n]/u.test(e),`Invalid entrypoint path`);H({harnessId:tl}).strict().extend({path:ll.nullable()}),H({path:ll.nullable(),restartRequired:B()}).strict(),H({harnessId:ts,action:W([`check`,`update`,`install`])}).strict();let ul=H({currentVersion:L().min(1).max(128),latestVersion:L().min(1).max(128),updateAvailable:B(),canUpdate:B(),versionKind:W([`cli`,`application`]).optional(),manualUpdateUrl:pa().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:$o.optional(),latestVersionKind:W([`unknown`,`tracking-branch`]).optional()}).strict();H({taskId:L().uuid()}).strict(),Wa(`status`,[H({taskId:L().uuid(),status:G(`running`)}).strict(),H({taskId:L().uuid(),status:G(`succeeded`),result:ul}).strict(),H({taskId:L().uuid(),status:G(`failed`),error:H({code:z().int(),message:L().min(1).max(2048)}).strict()}).strict()]);let dl=L().min(1).max(256).regex(/^[A-Za-z0-9._~-]+$/u),fl=L().trim().min(1),pl=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`]),ml=H({accountId:dl,label:fl.max(256),email:L().email().max(320).optional(),planType:pl.optional()}).strict(),hl=W([`ready`,`unavailable`]);H({version:G(2),currentAccountId:dl.nullable(),phase:hl,revision:z().int().nonnegative(),instanceId:fl.max(1024).optional(),accounts:V(ml).max(1)}).strict(),H({accountId:dl,refresh:B().optional()}).strict(),H({accountId:dl,usage:ps.nullable(),accountCredits:ys.optional(),freshness:W([`live`,`cached`]),observedAt:L().datetime().nullable()}).strict();let gl=1e3,_l=L().refine(e=>e.trim().length>0,`Value must not be empty or whitespace`).refine(e=>!e.includes(`\0`),`Value must not contain NUL`),vl=_l.max(1024),yl=H({nativeSessionId:vl,title:_l.max(4096).nullable(),updatedAt:z().int().nonnegative().max(864e13),cwd:_l.max(16384),running:B().nullable()}).strict();H({}).strict();let bl=H({harnesses:V(H({harnessId:tl,name:_l.max(128)}).strict()).max(128)}).strict();H({harnessId:tl,query:L().trim().max(4096).refine(e=>!e.includes(`\0`)).optional(),offset:z().int().nonnegative().safe().optional(),limit:z().int().min(1).max(gl).optional()}).strict();let xl=H({candidates:V(yl).max(gl),total:z().int().nonnegative().safe()}).strict();H({harnessId:tl,nativeSessionId:vl}).strict();let Sl=H({threadId:_l.max(1024).pipe(K)}).strict(),Cl=L().refine(e=>e.trim().length>0,`Value must not be empty or whitespace`).refine(e=>!e.includes(`\0`),`Value must not contain NUL`),wl=vl,Tl=yl;H({}).strict(),H({candidates:V(Tl).max(1e3)}).strict(),H({nativeSessionId:wl}).strict(),H({threadId:Cl.max(1024).pipe(K)}).strict(),H({threadId:K,lastTurnId:ns}).strict(),H({threadId:K}).strict();let El=L().trim().min(1).max(128).regex(/^[A-Za-z0-9._:-]+$/u).brand();H({commands:V(H({id:El,invocation:L().min(1).max(128),label:L().trim().min(1).max(128),description:L().trim().min(1).max(512).optional(),localizations:Qo.optional(),argumentMode:W([`none`,`text`]),kind:W([`command`,`skill`]).optional()}).strict()),warnings:V(L().min(1)).optional(),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:ts,cwd:L().min(1).optional()}).strict(),H({threadId:K}).strict(),H({threadId:K,commandId:El,turnId:ns.optional(),arguments:Jo.optional()}).strict(),H({accepted:G(!0),turnId:ns.optional()}).strict();let Dl=G(`2.0`).optional(),Ol=Ra().optional(),kl=L().min(1),Al=Ha([L(),z().int()]),jl=H({code:z().int(),message:L(),data:qo.optional()}).catchall(qo).superRefine(Ho([`data`]));Ha([H({jsonrpc:Dl,id:Al,method:kl,params:qo.optional(),result:Ol,error:Ol}).catchall(qo).superRefine(Ho([`jsonrpc`,`params`,`result`,`error`])),H({jsonrpc:Dl,id:Ol,method:kl,params:qo.optional(),result:Ol,error:Ol}).catchall(qo).superRefine(Ho([`jsonrpc`,`id`,`params`,`result`,`error`])),H({jsonrpc:Dl,id:Al,method:Ol,params:Ol,result:qo,error:Ol}).catchall(qo).superRefine(Ho([`jsonrpc`,`method`,`params`,`error`])),H({jsonrpc:Dl,id:Al,method:Ol,params:Ol,result:Ol,error:jl}).catchall(qo).superRefine(Ho([`jsonrpc`,`method`,`params`,`result`]))]);let Ml=L().refine(e=>e.trim().length>0,{message:`Native identifier must not be empty or whitespace`});U({harnessId:ts,nativeSessionId:Ml,locator:qo.optional(),formatVersion:G(1)}).superRefine(Ho([`locator`])),U({harnessId:ts,nativeSessionId:Ml,nativeTurnKey:Ml,formatVersion:G(1)}),U({harnessId:ts,nativeSessionId:Ml,checkpointId:Ml,locator:qo.optional(),formatVersion:G(1)}).superRefine(Ho([`locator`]));let Nl=L().regex(/^\d+\.\d+\.\d+(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/u),Pl=W([`npm`,`windows-installer`,`macos-dmg`]),Fl=U({version:Nl,installation:Pl,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 Il=L().max(300).regex(/^https:\/\/github\.com\/karlorz\/codex-host\/releases\/tag\/v[0-9A-Za-z.+-]+$/u,`release notes URL must identify a codexhost GitHub Release`);U({currentVersion:Nl,installation:Pl.nullable(),latestVersion:Nl.nullable(),updateAvailable:B(),installationAvailable:B(),releaseNotes:L().min(1).max(2e4).nullable(),releaseNotesUrl:Il.nullable(),status:Fl.nullable(),error:L().min(1).max(500).nullable()}),U({status:Fl}),U({status:Fl.nullable()});let Ll=/^[a-z0-9][a-z0-9-]*$/u;function Rl(e){if(!Ll.test(e))throw Error(`Invalid delegation mention Harness id: ${e}`);return`subagent://codexhost.${e}`}function zl(e){let t=e.replace(/[[\]()\n\r]+/gu,` `).replace(/\s+/gu,` `).trim();return t.length>0?t:`agent`}function Bl(e){return`[@${zl(e.label)}](${Rl(e.harnessId)})`}function Vl(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()}`)}`}RegExp(String.raw`^- \[([^\]\n]+)\]\(thread://([^\s()<>"?#/]+)\): `+`(${[`completed`,`failed`,`interrupted`,`timedOut`,`unreadable`,`notFound`].join(`|`)})(?:\. (.+))?$`,`u`);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 Ul=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 Wl=L().min(1).max(1024),Gl={hostId:Wl.regex(/^remote-(?:ssh(?:-|:)|control:)/u)},Kl={...Gl,threadId:Wl},ql=Wa(`kind`,[U({kind:G(`hosts`)}),U({kind:G(`list`),...Gl,cursor:L().nullable(),archived:B()}),U({kind:G(`read`),...Kl}),U({kind:G(`configure`),...Kl,epoch:Wl,modelId:Wl.optional(),thinkingOptionId:Wl.optional(),permissionModeId:Wl.optional()}).refine(e=>[e.modelId,e.thinkingOptionId,e.permissionModeId].filter(e=>e!==void 0).length===1,`Select exactly one remote setting`),U({kind:G(`prompt`),...Kl,epoch:Wl,text:L().min(1).max(8e3),requestId:Wl.optional()}),U({kind:G(`interrupt`),...Kl,epoch:Wl,turnId:Wl}),U({kind:G(`rename`),...Kl,epoch:Wl,name:L().min(1).max(512)}),U({kind:G(`archive`),...Kl,epoch:Wl,archived:B()}),U({kind:G(`respond`),...Kl,epoch:Wl,requestId:Ha([Wl,z().int()]),result:Xa(L(),Ia())})]),Jl=L().min(1).max(1024),Yl=H({hostId:Jl,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()}),Xl=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()});Wa(`action`,[U({action:G(`session`),operation:ql}),U({action:G(`list`)}),U({action:G(`catalog`)}),U({action:G(`read-thread`),hostId:Jl.refine(e=>e!==`local`),input:uc}),U({action:G(`save`),draft:Xl,previous:Yl.nullable()}),U({action:G(`remove`),previous:Yl}),U({action:G(`connect`),hostId:Jl,enabled:B()}),U({action:G(`state`),hostId:Jl}),U({action:G(`runtime`),hostId:Jl}),U({action:G(`update`),hostId:Jl.refine(e=>e!==`local`),version:Ul.shape.version})]),Ha([U({result:qo}),U({error:U({code:z().int(),message:L()})})]),U({prompt:L().trim().min(1).max(2e3),cwd:L().max(4096).nullable()}),L().trim().min(1).max(60).nullable();let Zl=L().max(214).regex(/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/u),Ql=Ha([L(),H({en:L()}).catchall(L())]),$l=H({title:Ql.optional(),description:Ql.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()}),eu=H({extensions:V(H({id:Zl,name:L().min(1).max(214),version:L().min(1).max(128),format:G(`dsh`),supportedTargets:Ja([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:$l.optional(),loadError:L().optional()})),loadedIds:V(Zl),safeMode:B(),storeError:L().optional()}),tu=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:tu.optional()}).strict(),H({id:Zl,enabled:B()}).strict(),H({id:Zl}).strict();let nu=U({id:L().min(1),kind:W([`task`,`monitor`,`loop`,`subagent`]),label:L(),status:W([`running`,`scheduled`,`completed`,`failed`,`cancelled`,`unknown`]),canStop:B(),commandItemId:rs.optional(),schedule:L().optional(),nextRunAt:L().datetime({offset:!0}).optional(),relatedActivityId:L().optional(),threadId:K.optional()});U({activity:nu,output:L(),truncated:B()}),U({threadId:K}).extend({activityId:L().min(1)}),U({supported:B(),activities:V(nu)}),U({outcome:W([`stopped`,`alreadyStopped`,`notFound`])}),G(1);function ru(){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 iu=[`unsupported`,`permission-denied`,`display-unavailable`,`capture-failed`,`image-too-large`,`busy`,`timeout`,`unavailable`];function au(e){return typeof e==`string`&&iu.some(t=>t===e)}var ou=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:ru(),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 ou(e,t,n)}return r.result.value}let su={status:async()=>Gs.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 qs.parse(await n.json())}},cu=2e4,lu=(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})}),uu={capture:async(e,t)=>{for(let n=0;;n+=1)try{return await du(e,t)}catch(t){if(!(t instanceof Error&&t.message===`busy`&&n<3))throw t;await lu(500,e)}}};async function du(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(cu),!e.ok){let t=await e.json().catch(()=>void 0);throw Error(au(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(cu),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)}}async function fu(e){let t=await fetch(`api/auth/status`,{credentials:`same-origin`,cache:`no-store`,signal:e});if(!t.ok)return!1;let n=await t.json();return n.authenticated===!0&&n.local===!0}let pu={relay:async(e,t)=>ic.parse(await q(`codexhost/relaySet`,{enabled:e,...t})),lan:e=>q(`codexhost/lanSet`,{enabled:e}),autostart:async e=>tc.parse(await q(`codexhost/autostartSet`,{enabled:e})),serve:async e=>ec.parse(await q(`codexhost/tailscaleServeSet`,{enabled:e})),get:async()=>cc.parse(await q(`codexhost/accessTokenGet`,{})),regenerate:async()=>cc.parse(await q(`codexhost/accessTokenRegenerate`,{}))},mu={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`,{})},hu={sources:async()=>bl.parse(await q(`codexhost/importSources`,{})),candidates:async e=>xl.parse(await q(`codexhost/importCandidates`,{request:e})),importSession:async(e,t)=>Sl.parse(await q(`codexhost/import`,{request:{harnessId:e,nativeSessionId:t}}))},gu={read:async(e,t,n)=>Gc.parse(await q(`codexhost/turnDiffs`,{request:{sessionId:e,turn:t,...n===void 0?{}:{path:n}}})).diffs},_u={send:(e,t,n)=>q(`codexhost/editMessage`,{request:{sessionId:e,atSeq:t,text:n}})},vu={list:async e=>Ys.parse(await q(`codexhost/skills/list`,{sessionId:e}))},yu={inspect:e=>q(`codexhost/threadCommands`,{request:{sessionId:e}}),execute:(e,t)=>q(`codexhost/executeThreadCommand`,{request:{sessionId:e,commandId:t}})},bu=`codexhost-native`;function xu(e){let t=Vl(e),n=`[@${e.replace(/[\[\]\r\n]/gu,` `)}](${t})`;return{source:bu,ref:n,label:e,clipboardText:n}}let Su=`codexhost-delegation`;function Cu(e){let t=e.get(`connection`),n=/* @__PURE__ */ new Map,r=/* @__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([yu.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(),yu.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:bu,codec:{clipboardText:e=>e,serialize:async e=>e},launcher:`command`,order:20,showGroupTitle:!1,subscribeCandidates:_,candidates:async({sessionId:i},a)=>{if(!d(i))return[];if(!t.generation.getSnapshot())return[{name:l(`discovery.retry`),value:`retry`,section:l(`discovery.commands`),description:l(`discovery.offline`)}];let o=g(i,a);try{let{catalog:t,reserved:s}=await o.promise;if(n.get(i)!==o||!d(i))return[];let c=a.query.toLocaleLowerCase(),u=e.sessions.list.getSnapshot().byId[i]?.projectionValues?.harnessIdentity?.id===`codex`,f=t.commands.filter(e=>`${e.invocation} ${e.label}`.toLocaleLowerCase().includes(c)).map(e=>{let t=u&&e.kind===`skill`,n=s.has(e.invocation)?l(`discovery.conflict`):e.argumentMode===`none`||e.invocation===`/compact`?p(i):void 0,a={name:e.invocation,label:t?e.label.replace(/^\/?skill:/iu,``):e.label,showAlias:!t,value:e.id,section:l(t?`discovery.skills`:`discovery.commands`),description:e.description,...n?{disabledReason:n}:{}};return r.set(a,{command:e,entry:o}),a});return t.warnings?.length&&!c&&f.push({name:l(`discovery.retry`),value:`retry`,section:l(`discovery.commands`),description:t.warnings.join(`
123
+ `)}),t.source===`static`&&!c&&f.push({name:l(`discovery.static`),disabledReason:l(`discovery.static`),section:l(`discovery.commands`)}),!t.commands.length&&!c&&t.source!==`static`&&f.push({name:l(`discovery.empty`),disabledReason:l(`discovery.empty`),section:l(`discovery.commands`)}),u?f.toSorted((e,t)=>Number(e.section===l(`discovery.skills`))-Number(t.section===l(`discovery.skills`))):f}catch(e){return n.get(i)===o?[{name:l(`discovery.retry`),value:`retry`,section:l(`discovery.commands`),description:`${l(`discovery.failed`)} ${e instanceof Error?e.message:String(e)}`}]:[]}},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 i=n.get(t);if(!i||i.generation!==s)return h(t,l(`discovery.stale`)),`handled`;let a=e.candidate.value;if(!a||e.candidate.disabledReason)return`handled`;let o=r.get(e.candidate),c=o?.entry===i?o.command:void 0;if(!c)return h(t,l(`discovery.stale`)),`handled`;if(c.argumentMode===`none`||c.invocation===`/compact`)return v(e,a),`handled`;try{return{insert:xu(c.invocation)}}catch{return h(t,l(`discovery.stale`)),`handled`}}}),`ui-codexhost: native discovery`),e.effect(()=>e.inputTriggers.registerSource({trigger:`@`,aliases:[`#`],name:Su,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,a.jsx)(i.RemotePluginIcon,{id:e.id,src:`/harness-icons/${encodeURIComponent(e.id)}`,presentationUrl:`/harness-icons/presentation.json`,size:t.size??14,fallback:/* @__PURE__ */ (0,a.jsx)(i.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=Bl({harnessId:n.id,label:n.name});return{insert:{source:Su,ref:r,label:n.name,appearance:`session`,clipboardText:r}}}}),`ui-codexhost: delegation discovery`)}function wu(e){let t=e.get(`connection`),n=/* @__PURE__ */ new Map,r=/* @__PURE__ */ new WeakMap,a=/* @__PURE__ */ new Set,o=e.locale.bind(`codexhostImport`),s=t=>{let n=e.sessions.list.getSnapshot().byId[t],r=n?.projectionValues?.harnessIdentity;return!!r&&r.id!==`codex`&&(n.blank||n.projectionValues?.nativeDiscovery===!0)&&(n.projectionValues?.threadReference?.hostId??`local`)===`local`&&e.sessions.subagentAddress(t)===void 0},c=()=>{n.clear();for(let e of a)e()};e.effect(()=>t.generation.subscribe(c)),e.effect(()=>e.remote.$on(`codexhost/skills/changed`,c));let l=(e,t)=>{let r=n.get(e);return(!r||r.epoch!==t.menuEpoch)&&(r={epoch:t.menuEpoch,promise:vu.list(e)},n.set(e,r)),r};e.effect(()=>e.inputTriggers.registerSource({trigger:`/`,aliases:[`@`,`#`],name:Xs,order:30,launcher:`command`,showGroupTitle:!1,codec:{clipboardText:e=>e,serialize:async e=>e},subscribeCandidates:({sessionId:t},r)=>{a.add(r);let i=e.sessions.list.subscribe(r);return()=>{a.delete(r),n.delete(t),i()}},candidates:async({sessionId:e},t)=>{if(!s(e))return[];let a=l(e,t);try{let c=await a.promise;if(n.get(e)!==a||!s(e))return[];let l=t.query.toLocaleLowerCase(),u=c.skills.filter(e=>`${e.name} ${e.description??``}`.toLocaleLowerCase().includes(l)).map(e=>{let t={name:e.name,value:e.path,section:o(`discovery.skills`),icon:i.IconSkillOutlineRegular,description:`${e.scope===`project`?o(`skills.project`):o(`skills.global`)} · ${e.source} · ${e.path}${e.description?` — ${e.description}`:``}`};return r.set(t,{skill:e,entry:a}),t});return!c.complete&&!l&&u.push({name:o(`skills.loading`),disabledReason:o(`skills.loading`),section:o(`discovery.skills`)}),c.warnings?.length&&u.push({name:o(`skills.warnings`),disabledReason:c.warnings.join(`
124
+ `),description:c.warnings.join(`
125
+ `),section:o(`discovery.skills`)}),u}catch(t){return n.get(e)===a?[{name:o(`skills.retry`),value:`retry`,section:o(`discovery.skills`),description:`${o(`skills.failed`)} ${t instanceof Error?t.message:String(t)}`}]:[]}},onPick:e=>{let t=e.session.sessionId;if(!s(t))return`handled`;if(e.candidate.value===`retry`)return n.delete(t),`refresh`;let i=r.get(e.candidate);if(!i||i.entry!==n.get(t))return`handled`;let a=i.skill,o=Zs(a);return{insert:{source:Xs,ref:o,label:a.name,appearance:`skill`,clipboardText:o}}}}))}function Tu(e){let t=e.replace(/[/\\]+$/,``),n=Math.max(t.lastIndexOf(`/`),t.lastIndexOf(`\\`));return t.slice(n+1)}let Eu=`codexhost-thread`,Du=/(?<![\w:/])(?:codex:\/\/threads\/|thread:\/\/)[^\s<>()\[\]`"',。!?;:、]+(?<![.,;])/gu;function Ou(e){let t=e.projectionValues?.threadReference;if(!e.blank&&t?.hostId&&(t.hostId===`local`||/^remote-(?:ssh(?:-|:)|control:)/u.test(t.hostId)&&t.threadId))return{threadId:t.threadId??e.id,hostId:t.hostId,title:e.title?.replace(/[\s\u0000-\u001f\u007f]+/gu,` `).trim()||e.id.slice(0,8)}}function ku(e){return`thread://${encodeURIComponent(e.threadId).replace(/[!'()*]/gu,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)}?hostId=${encodeURIComponent(e.hostId)}`}function Au(e){if(e.trim()!==e)return;let t=/^codex:\/\/threads\/([^/?#\s<>]+)$/u.exec(e)??/^thread:\/\/([^/?#\s<>]+)\?hostId=([^&#\s]+)$/u.exec(e);if(t?.[1]!==void 0)try{let e=decodeURIComponent(t[1]),n=decodeURIComponent(t[2]??`local`);if(!e||!n||/[\u0000-\u001f\u007f]/u.test(e+n))return;if(n===`local`)return e;if(!/^remote-(?:ssh(?:-|:)|control:)/u.test(n))return;let r=new TextEncoder().encode(JSON.stringify([n,e]));return`web-remote:`+btoa(Array.from(r,e=>String.fromCharCode(e)).join(``)).replaceAll(`+`,`-`).replaceAll(`/`,`_`).replace(/=+$/u,``)}catch{return}}function ju(e){let t=`[@${e.title.replace(/[\\`*{}[\]()#+.!_<>|~-]/gu,e=>`\\${e}`)}](${ku(e)})`;return{source:Eu,ref:t,label:e.title,appearance:`session`,clipboardText:t}}function Mu(e,t){let n=e.sessions.list.getSnapshot().byId[t];return n!==void 0&&e.sessions.subagentAddress(t)===void 0&&(Ou(n)!==void 0||n.blank&&n.projectionValues?.harnessIdentity!=null)}function Nu(e){let t=e.locale.bind(`codexhostImport`),n=/* @__PURE__ */ new WeakMap,r=t=>Mu(e,t);e.effect(()=>e.inputTriggers.registerSource({trigger:`@`,aliases:[`#`],name:Eu,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=Ou(t);if(n===void 0)return[];let r=u.get(e)??(Tu(t.cwd??``)||t.cwd||``);return!n.title.toLowerCase().includes(d)&&!r.toLowerCase().includes(d)?[]:[{id:e,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(({id:e,reference:n,workspace:r})=>({name:e,label:n.title,value:e,showAlias:!1,section:t(`discovery.sessions`),description:[r,n.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:Ou(a);return!r(t.session.sessionId)||o===void 0||n===t.session.sessionId||e.workspaces.list.getSnapshot().archivedSessionIds.includes(n)?`handled`:{insert:ju(o)}}}),`ui-codexhost: Thread reference discovery`)}function Pu(e){let t=e.locale.bind(`codexhostImport`),n=()=>{if(e.layout.panelInfo.getSnapshot().activePanelId===null)return e.uiSession.adapter.current.getSnapshot().key},r=r=>{let i=n();if(i===void 0||r===i)return;let a=e.sessions.binding(i);if(a===void 0)return;let o=()=>{let t=e.sessions.list.getSnapshot().byId[r];if(!(t===void 0||t.id!==r||e.sessions.binding(r)?.session.getSnapshot().removed===!0||e.workspaces.list.getSnapshot().archivedSessionIds.includes(r)))return Ou(t)};if(o()===void 0)return;let s=e.conversation.input.captureReferenceInsertion(a);if(s===void 0)return;let c=e.conversation.input.for(a.ctx),l=!1,u=()=>((n()!==i||e.sessions.binding(i)!==a||e.workspaces.list.getSnapshot().archivedSessionIds.includes(i)||o()===void 0)&&(l=!0),!l&&s.getSnapshot());return{getSnapshot:u,subscribe:t=>{let n=()=>{u(),t()},r=[e.sessions.list.subscribe(n),e.uiSession.adapter.current.subscribe(n),e.workspaces.list.subscribe(n),e.layout.panelInfo.subscribe(n),s.subscribe(n)];return()=>r.forEach(e=>e())},insert:()=>{let e=u();l=!0;let n=o();return!e||n===void 0||!s.insert(ju(n))?!1:(c.notify(`info`,t(`reference.addedToDraft`)),!0)}}};e.slots.inject(`sidebar.workspaces.session.menu.item`,()=>e.slots.register({name:`sidebar.workspaces.session.menu.item`,id:`codexhost.reference-current-draft`,order:360,locale:`workspace`,inject:()=>({prepareDraftReference:r})},o.ReferenceSessionMenuItem))}let Fu={sessionId:void 0,pending:!1,startedAt:void 0,progress:void 0,image:void 0,error:void 0};var Iu=class{capture;store=(0,s.createSnapshotStore)(Fu);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:au(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(Fu),n!==void 0&&URL.revokeObjectURL(n.url)}};let Lu=[`#ff3b30`,`#ffcc00`,`#0a84ff`];function Ru(e,t,n){return n===90?{x:t,y:-e}:n===270?{x:-t,y:e}:{x:e,y:t}}function zu(e){return Math.max(4,Math.round(e/250))}function Bu(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 Vu(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 Hu(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 Uu(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 Wu(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 Gu(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 Ku=`@deepseek-ai/dsh-client-ui-codexhost/DesktopScreenshotViewer.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Ku)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-codexhost`,e.dataset.pluginCss=Ku,e.textContent=`.SKGy0a_root{z-index:1000;color:#fff;background:#000;position:fixed;inset:0;overflow:hidden}.SKGy0a_stage{position:absolute;top:50%;left:50%}.SKGy0a_top,.SKGy0a_bottom{z-index:2;pointer-events:none;transition:opacity .15s;position:absolute;left:0;right:0}.SKGy0a_top *,.SKGy0a_bottom *{pointer-events:auto}.SKGy0a_top{padding-top:env(safe-area-inset-top);background:linear-gradient(#000000b3,#0000);top:0}.SKGy0a_bottom{padding-bottom:env(safe-area-inset-bottom);background:linear-gradient(#0000,#000000b3);bottom:0}.SKGy0a_hidden{visibility:hidden;opacity:0}.SKGy0a_bar{flex-wrap:wrap;align-items:center;gap:8px;padding:8px 12px;display:flex}.SKGy0a_spacer{flex:1}.SKGy0a_text,.SKGy0a_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}.SKGy0a_text[aria-pressed=true]{background:#ffffff52}.SKGy0a_text:disabled{opacity:.4;cursor:default}.SKGy0a_primary{background:var(--dsw-alias-button-info-fill,#3964fe)}.SKGy0a_swatch{cursor:pointer;touch-action:manipulation;border:2px solid #0000;border-radius:50%;width:28px;height:28px;padding:0}.SKGy0a_swatch[aria-pressed=true]{border-color:#fff;box-shadow:0 0 0 2px #0009}.SKGy0a_area{touch-action:none;place-items:center;display:grid;position:absolute;inset:0;overflow:hidden}.SKGy0a_area[data-annotating]{cursor:crosshair}.SKGy0a_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}.SKGy0a_canvas{background:#000;max-width:none;display:block}.SKGy0a_error{color:#ff8a80;margin:0;padding:4px 12px;font-size:13px}.SKGy0a_compose{flex:1 0 100%;gap:8px;display:flex}.SKGy0a_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}.SKGy0a_message::placeholder{color:#ffffff8c}.SKGy0a_primary:disabled{opacity:.5;cursor:default}.SKGy0a_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%)}.SKGy0a_cropHint,.SKGy0a_cropSize{color:#ffffffbf;font-size:13px}.SKGy0a_cropSize{font-variant-numeric:tabular-nums}.SKGy0a_wide .SKGy0a_compose{flex:320px}`,document.head.appendChild(e)}var J={area:`SKGy0a_area`,bar:`SKGy0a_bar`,bottom:`SKGy0a_bottom`,canvas:`SKGy0a_canvas`,compose:`SKGy0a_compose`,cropHint:`SKGy0a_cropHint`,cropSize:`SKGy0a_cropSize`,error:`SKGy0a_error`,hidden:`SKGy0a_hidden`,hint:`SKGy0a_hint`,message:`SKGy0a_message`,primary:`SKGy0a_primary`,root:`SKGy0a_root`,spacer:`SKGy0a_spacer`,stage:`SKGy0a_stage`,swatch:`SKGy0a_swatch`,text:`SKGy0a_text`,top:`SKGy0a_top`,wide:`SKGy0a_wide`,zoomBadge:`SKGy0a_zoomBadge`};function qu(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 Ju,Yu=`codexhost.screenshot.zoom-hint`,Xu=[`pen`,`rect`,`arrow`];function Zu(e){let[t,n]=(0,r.useState)();return(0,r.useEffect)(()=>{let t=!0,r=new Image;return r.onload=()=>{t&&n(r)},r.src=e,()=>{t=!1}},[e]),t}function Qu({src:e,t,onClose:n,onAttach:i,onSend:o}){let[s,l]=(0,r.useState)(),u=Zu(s?.url??e),[d,f]=(0,r.useState)(Ju??0),p=e=>{Ju=e,f(e)},[m,h]=(0,r.useState)(!1),[g,_]=(0,r.useState)(!1),[v,y]=(0,r.useState)(),b=(0,r.useRef)(0),x=(0,r.useRef)(),[S,C]=(0,r.useState)(`pen`),[w,T]=(0,r.useState)(Lu[0]),[E,ee]=(0,r.useState)([]),[D,O]=(0,r.useState)(),[te,k]=(0,r.useState)(),[A,ne]=(0,r.useState)(!0),j=(0,r.useRef)(),[re,M]=(0,r.useState)(``),[ie,ae]=(0,r.useState)(!1),[oe,se]=(0,r.useState)(()=>{try{return localStorage.getItem(Yu)!==`1`}catch{return!1}}),[ce,le]=(0,r.useState)(!1),ue=(0,r.useRef)(),de=(0,r.useRef)(null),[fe,pe]=(0,r.useState)(()=>qu(!1)),[me,he]=(0,r.useState)({width:0,height:0}),ge=(0,r.useRef)(null),_e=(0,r.useRef)(null),ve=(0,r.useRef)(null);(0,r.useEffect)(()=>{let e=()=>pe(qu(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,r.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,r.useEffect)(()=>()=>{s!==void 0&&URL.revokeObjectURL(s.url)},[s]),(0,r.useEffect)(()=>ve.current?.focus(),[]),(0,r.useEffect)(()=>{let e=document.body.style.overflow;return document.body.style.overflow=`hidden`,()=>{document.body.style.overflow=e,clearTimeout(ue.current)}},[]),(0,r.useEffect)(()=>{if(!oe)return;try{localStorage.setItem(Yu,`1`)}catch{}let e=setTimeout(()=>se(!1),4500);return()=>clearTimeout(e)},[oe]);let ye=(0,r.useRef)({annotating:m,cropping:g,onClose:n});ye.current={annotating:m,cropping:g,onClose:n},(0,r.useEffect)(()=>{let e=e=>{e.key===`Escape`&&(e.stopPropagation(),ye.current.annotating?h(!1):ye.current.cropping?Ue():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,r.useState)(1),[Ce,we]=(0,r.useState)({x:0,y:0}),Te=(0,r.useRef)(/* @__PURE__ */ new Map),Ee=(0,r.useRef)(),De=(0,r.useRef)(),Oe=(0,r.useRef)({zoom:xe,pan:Ce,rotation:d});Oe.current={zoom:xe,pan:Ce,rotation:d};let ke=(e,t)=>{let n=_e.current?.getBoundingClientRect();return n===void 0?{x:0,y:0}:Ru(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*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)}},je=(e,t,n=Oe.current)=>{let r=Math.min(Math.max(e,1),8),i=r/n.zoom;Se(r),we(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=()=>{Se(1),we({x:0,y:0})},Ne=u===void 0?4:zu(u.naturalWidth);(0,r.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 D===void 0?E:[...E,D])Bu(t,e,Ne);g&&v!==void 0&&Gu(t,v,{width:e.width,height:e.height},1/Math.max(xe*be,.01))}},[u,E,D,Ne,g,v,xe,be]),(0,r.useEffect)(()=>{let e=_e.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||be===0)return;let t=ke(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)}},Fe=()=>{let[e,t]=[...Te.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:xe,pan:Ce},De.current=void 0,O(void 0))},Ie=e=>{if(e.target.closest(`button`)===null){if(e.currentTarget.setPointerCapture(e.pointerId),Te.current.set(e.pointerId,{x:e.clientX,y:e.clientY}),Te.current.size===1?j.current={x:e.clientX,y:e.clientY,at:Date.now(),multi:!1}:j.current!==void 0&&(j.current.multi=!0),Te.current.size===2)Fe();else if(!(Te.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:Hu(n,t,28/(xe*be));n!==void 0&&r!==void 0&&r!==`inside`?x.current={kind:`resize`,anchor:Uu(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(Vu(t,t,{width:u.naturalWidth,height:u.naturalHeight})))}else if(m){let t=Pe(e);t!==void 0&&O({tool:S,color:w,points:[t]})}else De.current={at:ke(e.clientX,e.clientY),pan:Ce}}}},Le=e=>{if(!Te.current.has(e.pointerId))return;Te.current.set(e.pointerId,{x:e.clientX,y:e.clientY});let t=Ee.current;if(t!==void 0&&Te.current.size>=2){let[e,n]=[...Te.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;Se(a),we(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(Wu(r.before,t.x-r.start.x,t.y-r.start.y,n)):y(Vu(r.kind===`new`?r.from:r.anchor,t,n))}else if(D!==void 0){let t=Pe(e);if(t===void 0)return;O({...D,points:D.tool===`pen`?[...D.points,t]:[D.points[0]??t,t]})}else if(De.current!==void 0&&xe>1){let t=ke(e.clientX,e.clientY);we(Ae({x:De.current.pan.x+t.x-De.current.at.x,y:De.current.pan.y+t.y-De.current.at.y},xe))}},Re=(e,t)=>{if(!Te.current.has(e.pointerId))return;Te.current.delete(e.pointerId);let n=j.current;!t&&n!==void 0&&!n.multi&&Te.current.size===0&&!m&&!g&&Date.now()-n.at<500&&Math.hypot(e.clientX-n.x,e.clientY-n.y)<8&&ne(e=>!e),Te.current.size===0&&(j.current=void 0),Te.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),D!==void 0&&!t&&ee(e=>[...e,D]),O(void 0)},ze=()=>{Te.current.clear(),Ee.current=void 0,De.current=void 0,x.current=void 0,j.current=void 0,O(void 0)},Be=()=>{clearTimeout(ue.current),de.current?.blur(),le(!1)},Ve=e=>{Be(),ze(),e===`annotate`?h(!0):He()};(0,r.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}),ee([]),Ue(),Me()))},`image/png`)},Ke=()=>{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}),ee([]),h(!1)))},`image/png`)},qe=async()=>{try{let t=i(s?.blob??await(await fetch(e)).blob());t===null?n():k(t)}catch{k(t(`desktop.annotate.failed`))}},Je=async()=>{if(!ie){ae(!0),k(void 0);try{let t=await o(s?.blob??await(await fetch(e)).blob(),re.trim());t===null?n():k(t)}catch{k(t(`desktop.annotate.failed`))}finally{ae(!1)}}},Ye=async()=>{try{let t=s?.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:fe.x+fe.width/2,top:fe.y+fe.height/2,width:Xe?fe.height:fe.width,height:Xe?fe.width:fe.height,transform:Xe?`translate(-50%, -50%) rotate(${String(d)}deg)`:`translate(-50%, -50%)`};return(0,c.createPortal)(/* @__PURE__ */ (0,a.jsx)(`div`,{className:J.root,role:`dialog`,"aria-modal":`true`,"aria-label":t(`desktop.label`),children:/* @__PURE__ */ (0,a.jsxs)(`div`,{className:J.stage,style:Qe,children:[/* @__PURE__ */ (0,a.jsx)(`div`,{className:`${J.bar} ${J.top} ${A||Ze?``:J.hidden}`,children:g?/* @__PURE__ */ (0,a.jsxs)(a.Fragment,{children:[/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:J.text,onClick:Ue,children:t(`desktop.annotate.cancel`)}),/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:J.primary,disabled:!We,onClick:Ge,children:t(`desktop.annotate.done`)})]}):m?/* @__PURE__ */ (0,a.jsxs)(a.Fragment,{children:[/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:J.text,onClick:()=>{b.current++,h(!1)},children:t(`desktop.annotate.cancel`)}),/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:J.primary,onClick:Ke,children:t(`desktop.annotate.done`)})]}):/* @__PURE__ */ (0,a.jsxs)(a.Fragment,{children:[/* @__PURE__ */ (0,a.jsx)(`button`,{ref:ve,type:`button`,className:J.text,"aria-label":t(`desktop.close`),onClick:n,children:`✕`}),/* @__PURE__ */ (0,a.jsx)(`span`,{className:J.spacer}),/* @__PURE__ */ (0,a.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,a.jsx)(`button`,{type:`button`,className:J.text,onClick:()=>p(d===90?270:90),children:t(`desktop.flip`)}),/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:J.text,onClick:()=>Ve(`crop`),children:t(`desktop.crop`)}),/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:J.text,onClick:()=>Ve(`annotate`),children:t(`desktop.annotate`)})]})}),/* @__PURE__ */ (0,a.jsxs)(`div`,{ref:_e,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&&be>0&&/* @__PURE__ */ (0,a.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,a.jsxs)(`button`,{type:`button`,className:J.zoomBadge,onClick:Me,children:[String(Math.round(xe*100)),`% · `,t(`desktop.zoom.fit`)]})]}),oe&&/* @__PURE__ */ (0,a.jsx)(`p`,{className:J.hint,role:`status`,children:t(`desktop.hint`)}),/* @__PURE__ */ (0,a.jsxs)(`div`,{className:`${J.bottom} ${A||Ze?``:J.hidden} ${Xe?J.wide:``}`,children:[te!==void 0&&/* @__PURE__ */ (0,a.jsx)(`p`,{role:`alert`,className:J.error,children:te}),/* @__PURE__ */ (0,a.jsx)(`div`,{className:J.bar,children:g?/* @__PURE__ */ (0,a.jsxs)(a.Fragment,{children:[/* @__PURE__ */ (0,a.jsx)(`span`,{className:J.cropHint,children:t(`desktop.crop.hint`)}),/* @__PURE__ */ (0,a.jsx)(`span`,{className:J.spacer}),v!==void 0&&/* @__PURE__ */ (0,a.jsxs)(`span`,{className:J.cropSize,children:[String(Math.round(v.width)),` × `,String(Math.round(v.height))]})]}):m?/* @__PURE__ */ (0,a.jsxs)(a.Fragment,{children:[Xu.map(e=>/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:J.text,"aria-pressed":S===e,onClick:()=>C(e),children:t(`desktop.tool.${e}`)},e)),/* @__PURE__ */ (0,a.jsx)(`span`,{className:J.spacer}),Lu.map(e=>/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:J.swatch,style:{background:e},"aria-label":e,"aria-pressed":w===e,onClick:()=>T(e)},e)),/* @__PURE__ */ (0,a.jsx)(`span`,{className:J.spacer}),/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:J.text,disabled:E.length===0,onClick:()=>ee(e=>e.slice(0,-1)),children:t(`desktop.annotate.undo`)}),/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:J.text,disabled:E.length===0,onClick:()=>ee([]),children:t(`desktop.annotate.clear`)})]}):/* @__PURE__ */ (0,a.jsxs)(a.Fragment,{children:[/* @__PURE__ */ (0,a.jsxs)(`div`,{className:J.compose,children:[/* @__PURE__ */ (0,a.jsx)(`input`,{ref:de,className:J.message,type:`text`,value:re,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=>M(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.nativeEvent.isComposing&&Je()}}),/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:J.primary,disabled:ie,onClick:()=>void Je(),children:t(`desktop.send`)})]}),s!==void 0&&/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:J.text,onClick:()=>l(void 0),children:t(`desktop.annotate.reset`)}),/* @__PURE__ */ (0,a.jsx)(`span`,{className:J.spacer}),/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:J.text,onClick:()=>void Ye(),children:t(`desktop.save`)}),/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:J.text,onClick:()=>void qe(),children:t(`desktop.attach`)})]})})]})]})}),document.body)}let $u=`@deepseek-ai/dsh-client-ui-codexhost/DesktopScreenshot.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify($u)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-codexhost`,e.dataset.pluginCss=$u,e.textContent=`.DST6ca_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}.DST6ca_entryBusy{gap:4px;width:auto;min-width:28px;padding:0 6px}.DST6ca_entry:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover)}.DST6ca_entry:disabled{opacity:.45;cursor:default}.DST6ca_entry[aria-busy=true]{opacity:1;cursor:progress}.DST6ca_spinner{flex:none;animation:.8s linear infinite DST6ca_spin;display:inline-flex}.DST6ca_float{z-index:40;touch-action:none;-webkit-user-select:none;user-select:none;width:60px;height:60px;position:fixed}.DST6ca_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}.DST6ca_bubble[data-error]{border-color:var(--dsw-alias-state-error-primary)}.DST6ca_bubble img{object-fit:cover;pointer-events:none;width:100%;height:100%;position:absolute;inset:0}.DST6ca_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}.DST6ca_elapsed{font-variant-numeric:tabular-nums;font-size:11px}.DST6ca_alert{color:var(--dsw-alias-state-error-primary);font-size:22px;font-weight:600}.DST6ca_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}.DST6ca_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 DST6ca_spin{to{transform:rotate(360deg)}}@media (prefers-reduced-motion:reduce){.DST6ca_spinner{animation:none}}@media (pointer:coarse){.DST6ca_entry{width:40px;height:44px}.DST6ca_entryBusy{width:auto;min-width:40px}}`,document.head.appendChild(e)}var ed={alert:`DST6ca_alert`,bubble:`DST6ca_bubble`,busy:`DST6ca_busy`,caption:`DST6ca_caption`,dismiss:`DST6ca_dismiss`,elapsed:`DST6ca_elapsed`,entry:`DST6ca_entry`,entryBusy:`DST6ca_entryBusy`,float:`DST6ca_float`,spin:`DST6ca_spin`,spinner:`DST6ca_spinner`};function td({screenshot:e,registerSource:t,sessionId:n,overflowActions:o=!1,t:s}){let c=(0,r.useSyncExternalStore)(e.subscribe,e.getSnapshot),l=(0,r.useId)(),u=(0,r.useCallback)(()=>{n!==void 0&&e.refresh(n)},[e,n]),d=(0,r.useRef)({sessionId:n,overflowActions:o,t:s,capture:u});d.current={sessionId:n,overflowActions:o,t:s,capture:u},(0,r.useLayoutEffect)(()=>{if(o)return t({trigger:`/`,name:`desktop-screenshot:${l}`,launcher:`command`,launcherOrder:-10,showGroupTitle:!1,candidates:async(t,n)=>{let r=d.current;if(n.launcher!==`command`||!r.overflowActions||t.sessionId!==r.sessionId)return[];let a=e.getSnapshot().pending,o=[{name:`desktop-screenshot`,label:r.t(`desktop.label`),showAlias:!1,description:a?r.t(`desktop.pending`):void 0,busy:a,icon:nd}];return(0,i.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,o]),(0,r.useLayoutEffect)(()=>()=>{n!==void 0&&e.close(n)},[e,n]);let f=rd(c.startedAt);return n===void 0?null:/* @__PURE__ */ (0,a.jsx)(i.Tooltip,{portal:!0,disabled:o,side:`top`,label:s(c.pending?`desktop.pending`:`desktop.label`),children:/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:c.pending?`${ed.entry} ${ed.entryBusy}`:ed.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,a.jsxs)(a.Fragment,{children:[/* @__PURE__ */ (0,a.jsx)(`span`,{className:ed.spinner,"aria-hidden":`true`,children:/* @__PURE__ */ (0,a.jsx)(i.IconLoadingOutlineRegular,{size:16})}),/* @__PURE__ */ (0,a.jsxs)(`span`,{className:ed.elapsed,children:[f,`s`]})]}):/* @__PURE__ */ (0,a.jsx)(nd,{size:16})})})}function nd({size:e=16}){return/* @__PURE__ */ (0,a.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 20 20`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.4`,"aria-hidden":`true`,children:[/* @__PURE__ */ (0,a.jsx)(`rect`,{x:`2`,y:`3`,width:`16`,height:`11`,rx:`2`}),/* @__PURE__ */ (0,a.jsx)(`path`,{d:`M10 14v3M6 17h8`})]})}function rd(e){let[t,n]=(0,r.useState)(()=>Date.now());return(0,r.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 id;function ad(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 od(){return{x:window.innerWidth-60-12,y:72}}function sd({screenshot:e,drafts:t,inputActions:n,useInput:o,sessionId:s,t:l}){let u=(0,r.useSyncExternalStore)(e.subscribe,e.getSnapshot),{image:d,pending:f,progress:p,error:m}=u,h=rd(u.startedAt),[g,_]=(0,r.useState)(()=>ad(id??od())),[v,y]=(0,r.useState)(!1),b=o(e=>e.draft),x=(0,r.useRef)(d?.url);(0,r.useEffect)(()=>{d!==void 0&&d.url!==x.current&&(x.current=d.url,y(!0))},[d]);let S=(0,r.useRef)();if((0,r.useEffect)(()=>{let e=()=>_(e=>ad(e));return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]),s===void 0||u.sessionId!==s||d===void 0&&!f&&m===void 0)return null;let C=()=>{f||(m!==void 0||d===void 0?e.refresh(s):y(!0))},w=e=>{let r=new File([e],`desktop-screenshot-${String(Date.now())}.png`,{type:`image/png`}),i=t.create(s,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:cd(p.loaded),total:p.total===void 0?`?`:cd(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})},ee=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,_(ad({x:e.clientX-t.dx,y:e.clientY-t.dy}))))},D=(e,t)=>{let n=S.current;n?.pointer===e.pointerId&&(S.current=void 0,n.moved?id=g:t||C())};return(0,c.createPortal)(/* @__PURE__ */ (0,a.jsxs)(a.Fragment,{children:[/* @__PURE__ */ (0,a.jsxs)(`div`,{className:ed.float,style:{left:g.x,top:g.y},role:`group`,"aria-label":l(`desktop.label`),onPointerDown:E,onPointerMove:ee,onPointerUp:e=>D(e,!1),onPointerCancel:e=>D(e,!0),children:[/* @__PURE__ */ (0,a.jsxs)(`button`,{type:`button`,className:ed.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,a.jsx)(`img`,{src:d.url,alt:``,draggable:!1}),f&&/* @__PURE__ */ (0,a.jsxs)(`span`,{className:ed.busy,children:[/* @__PURE__ */ (0,a.jsx)(`span`,{className:ed.spinner,"aria-hidden":`true`,children:/* @__PURE__ */ (0,a.jsx)(i.IconLoadingOutlineRegular,{size:16})}),/* @__PURE__ */ (0,a.jsxs)(`span`,{className:ed.elapsed,children:[h,`s`]})]}),!f&&m!==void 0&&/* @__PURE__ */ (0,a.jsx)(`span`,{className:ed.alert,children:`!`})]}),/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:ed.dismiss,"data-float-close":!0,"aria-label":l(`desktop.close`),onClick:()=>e.close(s),children:/* @__PURE__ */ (0,a.jsx)(i.IconCloseOutlineRegular,{size:10})}),m!==void 0&&!f&&/* @__PURE__ */ (0,a.jsx)(`p`,{role:`status`,className:ed.caption,children:l(`desktop.error.${m}`)})]}),v&&d!==void 0&&/* @__PURE__ */ (0,a.jsx)(Qu,{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 cd(e){return`${(e/1048576).toFixed(1)} MB`}var ld=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 ud=`@deepseek-ai/dsh-client-ui-codexhost/VoiceInput.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(ud)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-codexhost`,e.dataset.pluginCss=ud,e.textContent=`.SCfLla_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}.SCfLla_entry[data-live]{width:var(--voice-bar-width)}.SCfLla_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}.SCfLla_icon:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}.SCfLla_icon:disabled{color:var(--dsw-alias-label-dimmed);cursor:default}.SCfLla_icon:focus-visible,.SCfLla_round:focus-visible,.SCfLla_send:focus-visible,.SCfLla_done:focus-visible,.SCfLla_primary:focus-visible,.SCfLla_secondary:focus-visible,.SCfLla_quietButton:focus-visible{box-shadow:0 0 0 2px var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary))}.SCfLla_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}.SCfLla_round,.SCfLla_send,.SCfLla_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}.SCfLla_round:hover:not(:disabled),.SCfLla_done:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover-solid);color:var(--dsw-alias-label-primary)}.SCfLla_meter{justify-content:center;align-items:center;min-width:0;height:28px;display:flex}.SCfLla_wave,.SCfLla_quiet{flex:none;width:90px;height:20px}.SCfLla_wave{color:var(--dsw-alias-label-secondary);fill:none;stroke:currentColor;stroke-width:1.6px;stroke-linecap:round}.SCfLla_quiet{color:var(--dsw-alias-label-tertiary);text-overflow:ellipsis;white-space:nowrap;line-height:20px;overflow:hidden}.SCfLla_status{white-space:nowrap;justify-content:center;align-items:center;gap:5px;max-width:100%;font-size:11px;display:inline-flex}.SCfLla_statusText{text-overflow:ellipsis;min-width:0;overflow:hidden}.SCfLla_sendFace,.SCfLla_doneFace{border-radius:50%;justify-content:center;align-items:center;width:24px;height:24px;display:flex}.SCfLla_sendFace{background:var(--dsw-alias-button-info-fill);color:#fff}.SCfLla_doneFace{background:var(--dsw-specific-input-major);color:var(--dsw-alias-label-primary)}.SCfLla_send:hover:not(:disabled){filter:brightness(1.08)}.SCfLla_send:disabled,.SCfLla_done:disabled{opacity:.4;cursor:default}.SCfLla_spinner{border:1.5px solid;border-right-color:#0000;border-radius:50%;flex:none;width:10px;height:10px;animation:.8s linear infinite SCfLla_spin}.SCfLla_timer{width:34px;color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums;text-align:center;flex:none;font-size:11px}.SCfLla_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}.SCfLla_strip .SCfLla_round,.SCfLla_strip .SCfLla_done{width:26px;height:26px;position:relative}.SCfLla_strip .SCfLla_round:before,.SCfLla_strip .SCfLla_done:before{content:"";position:absolute;inset:-9px}.SCfLla_strip .SCfLla_meter{flex:1}.SCfLla_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}.SCfLla_notice[data-tone=error]{background:color-mix(in srgb, var(--dsw-alias-state-error-primary) 10%, transparent);color:var(--dsw-alias-label-primary)}.SCfLla_notice p{flex:220px;margin:0}.SCfLla_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}.SCfLla_cardHead{color:var(--dsw-alias-label-tertiary);align-items:center;gap:6px;font-size:12px;display:flex}.SCfLla_cardText{white-space:pre-wrap;max-height:120px;margin:0;font-size:14px;line-height:21px;overflow:auto}.SCfLla_actions{flex-wrap:wrap;justify-content:flex-end;gap:8px;display:flex}.SCfLla_primary,.SCfLla_secondary,.SCfLla_quietButton{height:28px;font:inherit;cursor:pointer;border-radius:999px;outline:none;padding:0 12px;font-size:13px}.SCfLla_primary{background:var(--dsw-alias-label-primary);color:var(--dsw-alias-bg-base);border:none}.SCfLla_secondary{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-base);color:var(--dsw-alias-label-primary)}.SCfLla_quietButton{color:var(--dsw-alias-label-secondary);background:0 0;border:none}.SCfLla_secondary:hover,.SCfLla_quietButton:hover{background:var(--dsw-alias-interactive-bg-hover)}@keyframes SCfLla_spin{to{transform:rotate(360deg)}}@media (prefers-reduced-motion:reduce){.SCfLla_entry{transition:none}.SCfLla_spinner{animation:none}}@media (width<=600px),(pointer:coarse){.SCfLla_entry{--voice-entry-size:44px}.SCfLla_strip{margin-block:7px}.SCfLla_icon{width:44px;height:44px}.SCfLla_primary,.SCfLla_secondary,.SCfLla_quietButton{height:40px;padding:0 14px}}`,document.head.appendChild(e)}var Y={actions:`SCfLla_actions`,bar:`SCfLla_bar`,card:`SCfLla_card`,cardHead:`SCfLla_cardHead`,cardText:`SCfLla_cardText`,done:`SCfLla_done`,doneFace:`SCfLla_doneFace`,entry:`SCfLla_entry`,icon:`SCfLla_icon`,meter:`SCfLla_meter`,notice:`SCfLla_notice`,primary:`SCfLla_primary`,quiet:`SCfLla_quiet`,quietButton:`SCfLla_quietButton`,round:`SCfLla_round`,secondary:`SCfLla_secondary`,send:`SCfLla_send`,sendFace:`SCfLla_sendFace`,spin:`SCfLla_spin`,spinner:`SCfLla_spinner`,status:`SCfLla_status`,statusText:`SCfLla_statusText`,strip:`SCfLla_strip`,timer:`SCfLla_timer`,wave:`SCfLla_wave`};let dd=typeof navigator<`u`&&/Mac|iPhone|iPad/.test(navigator.platform)?[`⌘`,`⇧`,`Space`]:[`Ctrl`,`Shift`,`Space`];function fd(e){return(0,r.useSyncExternalStore)(e.subscribe,e.getSnapshot)}var pd=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 md=e=>e.phase===`permission`||e.phase===`recording`||e.phase===`transcribing`,hd=e=>`${Math.floor(e/60)}:${String(e%60).padStart(2,`0`)}`;function gd({voice:e,blocks:t,tray:n,sessionId:o,inputActions:s,useInput:c,useSession:l,t:u}){let d=fd(e),[f,p]=(0,r.useState)(!1),m=(0,r.useSyncExternalStore)(n.subscribe,n.getSnapshot),h=(0,r.useRef)(null),g=md(d),_=g||f&&d.phase===`idle`,v=(0,r.useMemo)(()=>t.storeFor(o),[t,o]),y=(0,r.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,r.useLayoutEffect)(()=>e.bind(s,S,f),[e,s,S,f]),(0,r.useLayoutEffect)(()=>{if(g)return s.bindPrimaryAction({disabled:d.phase!==`recording`,run:()=>e.send()})},[e,s,g,d.phase]),(0,r.useEffect)(()=>{let e=!0,t=0,n=()=>{let n=++t;su.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)}},[o]),(0,r.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,a.jsx)(`span`,{ref:h,className:Y.entry,"data-composer-tray":m?`stacked`:`inline`,"data-live":g&&!m?``:void 0,children:g&&!m?/* @__PURE__ */ (0,a.jsx)(vd,{voice:e,state:d,locked:S,layout:`inline`,t:u}):/* @__PURE__ */ (0,a.jsx)(i.Tooltip,{portal:!0,side:`top`,label:u(`voice.label`),shortcutKeys:dd,children:/* @__PURE__ */ (0,a.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,a.jsx)(i.IconMicrophoneOutlineMedium,{size:16})})})}):null}function _d({voice:e,tray:t,onActiveChange:n,t:i}){let o=fd(e),s=(0,r.useSyncExternalStore)(t.subscribe,t.getSnapshot)&&md(o);return(0,r.useLayoutEffect)(()=>n(s),[s,n]),(0,r.useLayoutEffect)(()=>()=>n(!1),[n]),s?/* @__PURE__ */ (0,a.jsx)(vd,{voice:e,state:o,locked:!1,layout:`strip`,t:i}):null}function vd({voice:e,state:t,locked:n,layout:r,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,a.jsxs)(`span`,{className:r===`inline`?Y.bar:Y.strip,role:`group`,"aria-label":o(`voice.label`),children:[/* @__PURE__ */ (0,a.jsx)(i.Tooltip,{portal:!0,side:`top`,label:o(`voice.cancel`),shortcutKeys:[`Esc`],children:/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:Y.round,"aria-label":o(`voice.cancel`),onClick:()=>e.cancel(),children:/* @__PURE__ */ (0,a.jsx)(i.IconCloseOutlineMedium,{size:14})})}),/* @__PURE__ */ (0,a.jsx)(`span`,{className:Y.meter,children:s?t.silent?/* @__PURE__ */ (0,a.jsx)(`span`,{className:Y.quiet,role:`status`,children:o(`voice.silent`)}):/* @__PURE__ */ (0,a.jsx)(`svg`,{className:Y.wave,viewBox:`0 0 96 24`,"aria-hidden":`true`,children:c.every(e=>e<.02)?/* @__PURE__ */ (0,a.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),i=2+t*4;return/* @__PURE__ */ (0,a.jsx)(`path`,{d:`M${i} ${(24-r)/2}v${r}`},t)})}):/* @__PURE__ */ (0,a.jsxs)(`span`,{className:Y.status,role:`status`,title:l,children:[/* @__PURE__ */ (0,a.jsx)(`span`,{className:Y.spinner,"aria-hidden":`true`}),/* @__PURE__ */ (0,a.jsx)(`span`,{className:Y.statusText,children:l})]})}),/* @__PURE__ */ (0,a.jsx)(`span`,{className:Y.timer,role:`timer`,children:hd(t.seconds)}),r===`inline`?/* @__PURE__ */ (0,a.jsx)(i.Tooltip,{portal:!0,side:`top`,label:o(`voice.send`),children:/* @__PURE__ */ (0,a.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,a.jsx)(`span`,{className:Y.sendFace,children:/* @__PURE__ */ (0,a.jsx)(yd,{})})})}):null,/* @__PURE__ */ (0,a.jsx)(i.Tooltip,{portal:!0,side:`top`,label:o(`voice.stop`),shortcutKeys:dd,children:/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:Y.done,"aria-label":o(`voice.stop`),disabled:!s,onMouseDown:e=>e.preventDefault(),onClick:()=>e.stop(),children:/* @__PURE__ */ (0,a.jsx)(`span`,{className:Y.doneFace,children:/* @__PURE__ */ (0,a.jsx)(i.IconStopFillMedium,{size:9})})})})]})}function yd(){return/* @__PURE__ */ (0,a.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,a.jsx)(`path`,{d:`M12 19V5M6 11l6-6 6 6`})})}function bd({voice:e,t}){let n=fd(e);if(n.phase===`cancelled`)return/* @__PURE__ */ (0,a.jsxs)(`div`,{className:Y.notice,role:`status`,children:[/* @__PURE__ */ (0,a.jsx)(`p`,{children:t(`voice.cancelled`,{time:hd(n.seconds)})}),/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:Y.primary,onClick:()=>e.undo(),children:t(`voice.undo`)}),/* @__PURE__ */ (0,a.jsx)(xd,{label:t(`voice.discard`),onClick:e.discard})]});if(n.phase===`text`)return/* @__PURE__ */ (0,a.jsxs)(`div`,{className:Y.card,role:`region`,"aria-label":t(`voice.label`),children:[/* @__PURE__ */ (0,a.jsxs)(`div`,{className:Y.cardHead,children:[/* @__PURE__ */ (0,a.jsx)(i.IconMicrophoneOutlineMedium,{size:14}),t(`voice.unplaced`)]}),/* @__PURE__ */ (0,a.jsx)(`p`,{className:Y.cardText,children:n.text}),/* @__PURE__ */ (0,a.jsxs)(`div`,{className:Y.actions,children:[/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:Y.quietButton,onClick:e.discard,children:t(`voice.discard`)}),/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:Y.secondary,onClick:()=>void navigator.clipboard.writeText(n.text??``).catch(()=>{}),children:t(`voice.copy`)}),/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:Y.primary,onMouseDown:e=>e.preventDefault(),onClick:()=>e.insert(),children:t(`voice.insert`)})]})]});if(!n.error)return null;let r=n.error,o=n.phase===`failed`,s=o&&![`audio-empty`,`audio-too-large`,`audio-format`,`audio-invalid`].includes(r),c=o||r===`record-failed`;return/* @__PURE__ */ (0,a.jsxs)(`div`,{className:Y.notice,"data-tone":c?`error`:void 0,role:`alert`,children:[/* @__PURE__ */ (0,a.jsx)(`p`,{children:t(`voice.error.${r}`)}),o?/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:s?Y.secondary:Y.primary,onClick:()=>e.rerecord(),children:t(`voice.rerecord`)}):null,s?/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:Y.primary,onClick:()=>void e.retry(),children:t(`voice.retry`)}):null,r===`permission-denied`||r===`no-microphone`||r===`record-failed`?/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:Y.secondary,onClick:()=>e.rerecord(),children:t(`voice.tryAgain`)}):null,/* @__PURE__ */ (0,a.jsx)(xd,{label:t(`voice.discard`),onClick:e.discard})]})}function xd({label:e,onClick:t}){return/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:Y.round,"aria-label":e,onClick:t,children:/* @__PURE__ */ (0,a.jsx)(i.IconCloseOutlineMedium,{size:14})})}function Sd({size:e}){return/* @__PURE__ */ (0,a.jsx)(i.IconDownloadOutlineRegular,{size:e})}function Cd({size:e,renderAction:t,openSection:n,t:i}){let[o,s]=(0,r.useState)(!1);return(0,r.useEffect)(()=>{let e=new AbortController;return fu(e.signal).then(t=>{e.signal.aborted||s(t)}).catch(()=>void 0),()=>e.abort()},[]),o?t({label:i(`remoteAccess`),onClick:()=>n(`codexhost-connect-devices`),icon:/* @__PURE__ */ (0,a.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,fill:`none`,"aria-hidden":`true`,children:[/* @__PURE__ */ (0,a.jsx)(`rect`,{x:`6`,y:`2`,width:`12`,height:`20`,rx:`3`,stroke:`currentColor`,strokeWidth:`1.6`}),/* @__PURE__ */ (0,a.jsx)(`path`,{d:`M10 5h4M11 19h2`,stroke:`currentColor`,strokeWidth:`1.6`,strokeLinecap:`round`})]})}):null}function wd({sessionId:e,list:t}){let n=(0,r.useSyncExternalStore)(e=>t.subscribe(e),()=>t.getSnapshot().byId[e]?.projectionValues?.harnessIdentity);return n?/* @__PURE__ */ (0,a.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:n.id===`codex`?/* @__PURE__ */ (0,a.jsx)(`img`,{src:`/harness-icons/codex`,width:14,height:14,alt:``,"data-native-codex-icon":!0}):/* @__PURE__ */ (0,a.jsx)(i.RemotePluginIcon,{id:n.id,src:`/harness-icons/${encodeURIComponent(n.id)}`,presentationUrl:`/harness-icons/presentation.json`,size:14,fallback:/* @__PURE__ */ (0,a.jsx)(i.IconDataOutlineRegular,{size:14})})}):null}let Td=`@deepseek-ai/dsh-client-ui-codexhost/HostConnectionStatus.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=`.dKjwwa_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}.dKjwwa_copy{overflow-wrap:anywhere;flex-wrap:wrap;gap:4px 12px;min-width:0;display:flex}.dKjwwa_detail{color:var(--dsw-alias-label-tertiary)}.dKjwwa_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}.dKjwwa_retry:hover{background:var(--dsw-alias-interactive-bg-hover)}.dKjwwa_retry:focus-visible{outline-offset:2px;outline:2px solid}`,document.head.appendChild(e)}var Ed={copy:`dKjwwa_copy`,detail:`dKjwwa_detail`,retry:`dKjwwa_retry`,status:`dKjwwa_status`};function Dd(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 Od(){let e=/iPad|iPhone|iPod/u.test(navigator.userAgent),t=window.matchMedia(`(display-mode: standalone)`).matches||navigator.standalone===!0;return e&&!t}async function kd(){return await navigator.serviceWorker.getRegistration(`./`)??await navigator.serviceWorker.register(`sw.js`,{scope:`./`})}async function Ad(){return!(`serviceWorker`in navigator)||!(`PushManager`in window)||!(`Notification`in window)?Od()?`needs-install`:`unsupported`:Notification.permission===`denied`?`denied`:await(await navigator.serviceWorker.getRegistration(`./`))?.pushManager.getSubscription()==null?`off`:`on`}async function jd(){let e=await kd();await navigator.serviceWorker.ready;let t=await e.pushManager.getSubscription();if(t===null){let{publicKey:n}=await mu.config();t=await e.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:Dd(n)})}await mu.subscribe(t.toJSON())}async function Md(){let e=await Notification.requestPermission();return e===`granted`?(await jd(),`on`):e===`denied`?`denied`:`off`}async function Nd(){let e=await(await navigator.serviceWorker.getRegistration(`./`))?.pushManager.getSubscription();return e!=null&&(await mu.unsubscribe(e.endpoint),await e.unsubscribe()),`off`}function Pd(){`serviceWorker`in navigator&&kd().catch(()=>void 0)}function Fd(){`serviceWorker`in navigator&&`PushManager`in window&&`Notification`in window&&Notification.permission===`granted`&&jd().catch(()=>void 0)}let Id=5e3,Ld=(0,s.createSnapshotStore)(!1);function Rd(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(Id)});if(e.status===401){window.location.reload();return}s=e.status===200}catch{}n=!1,!(r||e.getSnapshot()!==`connecting`)&&(s&&(i=0,Ld.set(!1)),t=setTimeout(()=>{s||(i+=1,Ld.set(i>=2)),a()},Math.max(0,Id-(Date.now()-o))))},o=()=>{e.getSnapshot()===`connecting`?a():(clearTimeout(t),i=0,Ld.set(!1))},s=e.subscribe(o);return o(),()=>{r=!0,clearTimeout(t),Ld.set(!1),s()}}async function zd(){await Nd().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 Bd({sessionId:e,useSession:t,list:n,connection:o,t:s}){let c=(0,r.useSyncExternalStore)(o.state.subscribe,o.state.getSnapshot),l=(0,r.useSyncExternalStore)(Ld.subscribe,Ld.getSnapshot),u=(0,r.useSyncExternalStore)(e=>n.subscribe(e),()=>e===void 0?void 0:n.getSnapshot().byId[e]?.projectionValues?.nativeConnection?.state),d=(0,r.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,r.useState)(``),h=`${e}:${d??``}`,g=c===void 0||c===`connecting`,_=(0,i.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,a.jsxs)(a.Fragment,{children:[v?/* @__PURE__ */ (0,a.jsxs)(`div`,{className:Ed.status,role:`status`,"data-web-connection":v,"data-native-connection":u===`reconnecting`?u:void 0,children:[/* @__PURE__ */ (0,a.jsxs)(`div`,{className:Ed.copy,children:[/* @__PURE__ */ (0,a.jsx)(`span`,{children:s(`connection.${v}`)}),y===void 0?null:/* @__PURE__ */ (0,a.jsx)(`span`,{className:Ed.detail,children:s(`connection.lastSynced`,{time:new Date(y).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})})})]}),/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:Ed.retry,onClick:()=>o.reconnect(),children:s(`connection.retry`)})]}):null,d&&p!==h?/* @__PURE__ */ (0,a.jsx)(i.Toast,{text:d,holdMs:8e3,onDone:()=>m(h)},h):null]})}function Vd({navigation:e,t}){let n=(0,r.useSyncExternalStore)(e.opening.subscribe,e.opening.getSnapshot);return n.state===`idle`?null:/* @__PURE__ */ (0,a.jsxs)(`div`,{className:Ed.status,role:n.state===`error`?`alert`:`status`,"data-session-opening":n.state,children:[/* @__PURE__ */ (0,a.jsxs)(`div`,{className:Ed.copy,children:[/* @__PURE__ */ (0,a.jsx)(`span`,{children:t(n.state===`loading`?`opening.loading`:`opening.error`)}),/* @__PURE__ */ (0,a.jsx)(`span`,{className:Ed.detail,children:n.sessionId}),n.state===`error`?/* @__PURE__ */ (0,a.jsx)(`span`,{className:Ed.detail,children:n.message}):null]}),n.state===`error`?/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:Ed.retry,onClick:()=>e.retryOpening(),children:t(`connection.retry`)}):null]})}let Hd=`@deepseek-ai/dsh-client-ui-codexhost/HostUsageDock.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Hd)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-codexhost`,e.dataset.pluginCss=Hd,e.textContent=`.prdDAG_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}.prdDAG_anchor[data-composer-stat=codexhost-quota]{order:-1}.prdDAG_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}.prdDAG_pill:hover,.prdDAG_pill:focus-visible,.prdDAG_pill[aria-expanded=true]{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-secondary)}.prdDAG_label{text-overflow:ellipsis;min-width:0;overflow:hidden}.prdDAG_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}.prdDAG_panel header{color:var(--dsw-alias-label-primary);font-size:16px;font-weight:500;line-height:22px}.prdDAG_context{margin-top:10px}.prdDAG_contextRow{color:var(--dsw-alias-label-tertiary);justify-content:space-between;align-items:center;gap:20px;display:flex}.prdDAG_contextRow strong{color:var(--dsw-alias-label-primary);font-variant-numeric:tabular-nums;font-weight:400}.prdDAG_progressTrack{background:var(--dsw-alias-interactive-bg-hover);border-radius:999px;height:4px;margin-top:6px;overflow:hidden}.prdDAG_progressFill{border-radius:inherit;background:var(--dsw-alias-label-secondary);height:100%;display:block}.prdDAG_group{margin-top:12px}.prdDAG_group h3{color:var(--dsw-alias-label-tertiary);margin:0 0 5px;font-size:12px;font-weight:600}.prdDAG_group dl{gap:5px;margin:0;display:grid}.prdDAG_detail{grid-template-columns:minmax(120px,auto) minmax(0,1fr);gap:0 16px;display:grid}.prdDAG_detail dt,.prdDAG_detail dd,.prdDAG_detail p{min-width:0;margin:0}.prdDAG_detail dt{color:var(--dsw-alias-label-tertiary)}.prdDAG_detail dd{color:var(--dsw-alias-label-secondary);font-variant-numeric:tabular-nums;text-align:right}.prdDAG_detail p{color:var(--dsw-alias-label-tertiary);text-align:right;overflow-wrap:anywhere;grid-column:1/-1;font-size:11px}.prdDAG_quotaRing{fill:none;stroke:#399b69;stroke-width:3px;flex-shrink:0;width:16px;height:16px}.prdDAG_ringTrack{stroke:var(--dsw-alias-interactive-bg-hover)}.prdDAG_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}.prdDAG_quotaRow+.prdDAG_quotaRow,.prdDAG_quotaGroup+.prdDAG_quotaGroup{margin-top:11px}.prdDAG_quotaHeading{justify-content:space-between;align-items:flex-start;gap:12px;margin-bottom:5px;font-size:12px;display:flex}.prdDAG_quotaDescription{min-width:0}.prdDAG_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}.prdDAG_quotaGroup:first-child .prdDAG_quotaRow:first-child .prdDAG_quotaDescription>span{font-size:12.5px;font-weight:600}.prdDAG_quotaGroup:first-child .prdDAG_quotaRow:first-child .prdDAG_remainingLabel{opacity:.8;font-size:11px;font-weight:600}.prdDAG_quotaGroup:first-child .prdDAG_quotaRow:first-child .prdDAG_remainingValue{font-size:26px;font-weight:700}.prdDAG_quotaRow p{color:color-mix(in srgb, currentColor 62%, transparent);margin:0;font-size:10.5px}.prdDAG_quotaGroup:first-child .prdDAG_quotaRow:first-child p{font-size:11px}.prdDAG_quotaPanel .prdDAG_progressTrack{background:color-mix(in srgb, currentColor 16%, transparent);height:6px;margin-top:0}.prdDAG_quotaFill{border-radius:inherit;background:var(--quota-color);height:100%;display:block}@media (width<=640px){.prdDAG_anchor{max-width:min(280px,56vw)}}`,document.head.appendChild(e)}var X={anchor:`prdDAG_anchor`,context:`prdDAG_context`,contextRow:`prdDAG_contextRow`,detail:`prdDAG_detail`,group:`prdDAG_group`,label:`prdDAG_label`,panel:`prdDAG_panel`,pill:`prdDAG_pill`,progressFill:`prdDAG_progressFill`,progressTrack:`prdDAG_progressTrack`,quotaDescription:`prdDAG_quotaDescription`,quotaFill:`prdDAG_quotaFill`,quotaGroup:`prdDAG_quotaGroup`,quotaHeading:`prdDAG_quotaHeading`,quotaPanel:`prdDAG_quotaPanel`,quotaRing:`prdDAG_quotaRing`,quotaRow:`prdDAG_quotaRow`,remainingLabel:`prdDAG_remainingLabel`,remainingValue:`prdDAG_remainingValue`,ringTrack:`prdDAG_ringTrack`};let Ud={visibility:`hidden`,left:0,top:0};function Wd(e,t=1){return e.toFixed(t).replace(/\.?0+$/u,``)}function Gd(e){return e<1e3?String(Math.round(e)):e<1e6?`${Wd(e/1e3)}K`:e<1e9?`${Wd(e/1e6)}M`:`${Wd(e/1e9)}B`}function Kd(e){return`${Wd(e)}%`}function qd(e){return e.contextUsagePercent??(e.contextUsedTokens!==void 0&&e.contextWindowTokens!==void 0?e.contextUsedTokens/e.contextWindowTokens*100:void 0)}function Jd(e,t){return`${e>=100?Math.round(e):Wd(e)} ${t(`usage.unit.tps`)}`}function Yd(e,t){return e<1e3?`${Math.round(e)} ${t(`usage.unit.ms`)}`:`${Wd(e/1e3)} ${t(`usage.unit.seconds`)}`}function Xd(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 Zd(e,t){return`${e>0&&e<.001?`<0.001`:Wd(e,3)} ${t(`usage.unit.credits`)}`}function Qd(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 $d(e,t,n){return e===void 0||t===void 0?``:`${Wd(e,2)} / ${Wd(t,2)}${n?` ${n}`:``}`}function ef(e,t){if(e===null)return[];let n=[e.cacheHitRatePercent===void 0?null:`${t(`usage.cache.short`)} ${Kd(e.cacheHitRatePercent)}`,e.outputTokensPerSecond===void 0?e.apiOutputTokensPerSecond===void 0?null:`API ${Jd(e.apiOutputTokensPerSecond,t)}`:Jd(e.outputTokensPerSecond,t),Xd(e)].filter(e=>e!==null);if(n.length>0)return n;if(e.totalTokens!==void 0)return[`${Gd(e.totalTokens)} ${t(`usage.unit.tokens`)}`];let r=qd(e);return r===void 0?[]:[`${t(`usage.context`)}: ${Kd(r)}`]}function tf(e,t){let n=[];if(e!==null){let r=[],i=Xd(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:Zd(e.totalCredits,t)}),e.sessionCacheHitRatePercent!==void 0&&r.push({label:t(`usage.cache.average`),value:Kd(e.sessionCacheHitRatePercent)}),e.cacheHitRatePercent!==void 0&&r.push({label:t(`usage.cache.latest`),value:Kd(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:Jd(e.apiOutputTokensPerSecond,t)}):a.push({label:t(`usage.speed`),value:Jd(e.outputTokensPerSecond,t)}),e.timeToFirstOutputMs!==void 0&&a.push({label:t(`usage.ttft`),value:Yd(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?`—`:Gd(e.inputTokens)} / ${e.outputTokens===void 0?`—`:Gd(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?`—`:Gd(e.cachedInputTokens)} / ${Gd(e.cacheWriteInputTokens)}`:Gd(e.cachedInputTokens??0)}),e.totalTokens!==void 0&&o.push({label:t(`usage.tokens.total`),value:Gd(e.totalTokens)}),o.length&&n.push({label:t(`usage.group.tokens`),rows:o})}return n}function nf(e){return Math.min(100,Math.max(0,100-e))}function rf(e){return e<=10?`#c45c4a`:e<=30?`#c9a227`:`#3d9a64`}function af(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=Qd(a,n);t.push({label:r,value:Kd(nf(i)),remaining:nf(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=$d(t.used,t.limit,t.unit);if(i.push({label:e(t.periodType,t.label??n(`usage.group.quota`),t.scope),value:Kd(nf(t.usedPercent)),remaining:nf(t.usedPercent),note:[a?`${n(`usage.quota`)}: ${a}`:null,Qd(t.resetsAt,n)].filter(Boolean).join(` · `)}),t.resetCredits){let e=Qd(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=$d(r.used,r.limit,r.unit);i.push({label:e(r.periodType,r.product,r.scope),value:Kd(nf(r.usagePercent)),remaining:nf(r.usagePercent),note:[t?`${n(`usage.quota`)}: ${t}`:null,Qd(r.resetsAt,n)].filter(Boolean).join(` · `)})}i.length&&r.push({label:n(`usage.group.quota`),rows:i})}return r}function of({usage:e,t}){if(e===null)return null;let n=qd(e);if(n===void 0)return null;let r=e.contextWindowTokens===void 0?Kd(n):`${Kd(n)} / ${Gd(e.contextWindowTokens)}`;return/* @__PURE__ */ (0,a.jsxs)(`section`,{className:X.context,children:[/* @__PURE__ */ (0,a.jsxs)(`div`,{className:X.contextRow,children:[/* @__PURE__ */ (0,a.jsx)(`span`,{children:t(`usage.context`)}),/* @__PURE__ */ (0,a.jsx)(`strong`,{children:r})]}),/* @__PURE__ */ (0,a.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,a.jsx)(`span`,{className:X.progressFill,style:{width:`${Math.min(100,Math.max(0,n))}%`}})})]})}function sf({groups:e}){return e.map(e=>/* @__PURE__ */ (0,a.jsxs)(`section`,{className:X.group,children:[/* @__PURE__ */ (0,a.jsx)(`h3`,{children:e.label}),/* @__PURE__ */ (0,a.jsx)(`dl`,{children:e.rows.map(e=>/* @__PURE__ */ (0,a.jsxs)(`div`,{className:X.detail,children:[/* @__PURE__ */ (0,a.jsx)(`dt`,{children:e.label}),/* @__PURE__ */ (0,a.jsx)(`dd`,{children:e.value}),e.note&&/* @__PURE__ */ (0,a.jsx)(`p`,{children:e.note})]},`${e.label}:${e.value}`))})]},e.label))}function cf({useProjection:e,t}){let n=e(`codexhostUsage`),i=n?.usage??null,o=n?.accountCredits,s=(0,r.useMemo)(()=>ef(i,t),[i,t]),c=(0,r.useMemo)(()=>tf(i,t),[i,t]),l=(0,r.useMemo)(()=>af(i,o,t),[i,o,t]),u=l.flatMap(e=>e.rows).find(e=>e.remaining!==void 0),d=i!==null&&qd(i)!==void 0,f=s.join(` · `);return/* @__PURE__ */ (0,a.jsxs)(a.Fragment,{children:[u&&/* @__PURE__ */ (0,a.jsx)(lf,{stat:`codexhost-quota`,panelStyle:{"--quota-color":rf(u.remaining??100)},label:`${t(`usage.quota.remaining`)}: ${u.value}`,title:t(`usage.quota.details`),trigger:/* @__PURE__ */ (0,a.jsxs)(a.Fragment,{children:[/* @__PURE__ */ (0,a.jsxs)(`svg`,{className:X.quotaRing,style:{stroke:rf(u.remaining??100)},viewBox:`0 0 20 20`,"aria-hidden":`true`,children:[/* @__PURE__ */ (0,a.jsx)(`circle`,{className:X.ringTrack,cx:`10`,cy:`10`,r:`7`}),/* @__PURE__ */ (0,a.jsx)(`circle`,{cx:`10`,cy:`10`,r:`7`,pathLength:`100`,strokeDasharray:`${u.remaining} 100`,transform:`rotate(-90 10 10)`})]}),/* @__PURE__ */ (0,a.jsx)(`span`,{children:u.value})]}),children:l.map(e=>/* @__PURE__ */ (0,a.jsx)(`section`,{className:X.quotaGroup,"aria-label":e.label,children:e.rows.map((e,n)=>/* @__PURE__ */ (0,a.jsxs)(`div`,{className:X.quotaRow,style:{"--quota-color":rf(e.remaining??100)},children:[/* @__PURE__ */ (0,a.jsxs)(`div`,{className:X.quotaHeading,children:[/* @__PURE__ */ (0,a.jsxs)(`div`,{className:X.quotaDescription,children:[/* @__PURE__ */ (0,a.jsx)(`span`,{children:e.label}),e.note&&/* @__PURE__ */ (0,a.jsx)(`p`,{children:e.note})]}),/* @__PURE__ */ (0,a.jsxs)(`strong`,{children:[e.remaining!==void 0&&/* @__PURE__ */ (0,a.jsxs)(`span`,{className:X.remainingLabel,children:[t(`usage.quota.remaining`),` `]}),/* @__PURE__ */ (0,a.jsx)(`span`,{className:X.remainingValue,children:e.value})]})]}),e.remaining!==void 0&&/* @__PURE__ */ (0,a.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,a.jsx)(`span`,{className:X.quotaFill,style:{width:`${e.remaining}%`}})})]},`${e.label}:${n}`))},e.label))}),s.length>0&&(c.length>0||d)&&/* @__PURE__ */ (0,a.jsxs)(lf,{stat:`codexhost-usage`,label:`${t(`usage.title`)}: ${f}`,title:t(`usage.details`),trigger:/* @__PURE__ */ (0,a.jsx)(`span`,{className:X.label,children:f}),children:[/* @__PURE__ */ (0,a.jsx)(`header`,{children:t(`usage.title`)}),/* @__PURE__ */ (0,a.jsx)(of,{usage:i,t}),/* @__PURE__ */ (0,a.jsx)(sf,{groups:c})]})]})}function lf({stat:e,label:t,title:n,trigger:o,children:s,panelStyle:l}){let[u,d]=(0,r.useState)(!1),f=(0,r.useRef)(!1),p=(0,r.useRef)(null),m=(0,r.useRef)(null),h=(0,r.useRef)(null),g=(0,i.useAnchoredPosition)({open:u,anchorRef:m,panelRef:h,side:`top`,gap:8,margin:12}),_=(0,r.useCallback)(()=>{f.current=!1,d(!1)},[]),v=(0,r.useCallback)(()=>{p.current!==null&&(window.clearTimeout(p.current),p.current=null)},[]),y=(0,r.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,i.useDismissOnOutsidePointer)(m,u,e=>{e||_()},h),(0,r.useEffect)(()=>{if(!u)return;let e=e=>{e.key===`Escape`&&_()};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[_,u]),(0,r.useEffect)(()=>()=>{p.current!==null&&window.clearTimeout(p.current)},[]),/* @__PURE__ */ (0,a.jsxs)(`span`,{ref:m,className:X.anchor,"data-composer-stat":e,onPointerEnter:()=>{v(),d(!0)},onPointerLeave:y,children:[/* @__PURE__ */ (0,a.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:o}),u&&(0,c.createPortal)(/* @__PURE__ */ (0,a.jsx)(`div`,{ref:h,className:`${X.panel} ${e===`codexhost-quota`?X.quotaPanel:``}`,style:{...l,...g??Ud},role:`dialog`,"aria-label":n,onPointerEnter:v,onPointerLeave:y,children:s}),document.body)]})}let uf=`@deepseek-ai/dsh-client-ui-codexhost/ConnectDevicesSection.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=`._5VGGma_page{flex-direction:column;gap:24px;min-width:0;display:flex}._5VGGma_header{flex-wrap:wrap;justify-content:space-between;align-items:flex-start;gap:12px;display:flex}._5VGGma_title{color:var(--dsw-alias-label-primary);margin:0 0 8px;font-size:22px;font-weight:600;line-height:30px}._5VGGma_description,._5VGGma_notice{color:var(--dsw-alias-label-secondary);overflow-wrap:anywhere;margin:0;font-size:13px;line-height:21px}._5VGGma_meta{color:var(--dsw-alias-label-tertiary);overflow-wrap:anywhere;margin:0;font-size:12px;line-height:19px}._5VGGma_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}._5VGGma_status:before{content:"";background:currentColor;border-radius:50%;width:5px;height:5px}._5VGGma_status[data-active=true]:before{background:#65af91}._5VGGma_connection{flex-direction:column;gap:24px;display:flex}._5VGGma_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}._5VGGma_scan{border-right:1px solid var(--dsw-alias-border-l2);flex:none;padding-right:24px}._5VGGma_connectionDetails{flex-direction:column;flex:1;gap:16px;min-width:0;display:flex}._5VGGma_qrButton{cursor:pointer;background:#fff;border:none;border-radius:12px;padding:8px;line-height:0;display:block;position:relative;overflow:hidden}._5VGGma_qr{filter:blur(10px);opacity:.35;pointer-events:none;user-select:none;width:144px;height:144px;display:block}._5VGGma_qrCover{color:#171717;background:#ffffffa6;flex-direction:column;justify-content:center;align-items:center;gap:8px;padding:8px;font-size:13px;line-height:20px;display:flex;position:absolute;inset:0}._5VGGma_qrCover small{font-size:11px;line-height:16px}._5VGGma_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}._5VGGma_qrButton:focus-visible,._5VGGma_input:focus-visible{outline:2px solid var(--dsw-alias-label-secondary);outline-offset:3px}._5VGGma_routePanel{flex-direction:column;gap:10px;min-width:0;display:flex}._5VGGma_routes{border:0;min-width:0;margin:0;padding:0}._5VGGma_fieldTitle{color:var(--dsw-alias-label-primary);margin-bottom:10px;padding:0;font-size:13px;font-weight:600;line-height:20px;display:block}._5VGGma_routeGroup,._5VGGma_extraRoutes{flex-direction:column;gap:8px;display:flex}._5VGGma_routeGroup,._5VGGma_extraRoutes>._5VGGma_route{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-2);border-radius:10px}._5VGGma_routeGroup{gap:0;overflow:hidden}._5VGGma_routeFamily,._5VGGma_routeGroup>._5VGGma_route:not(:last-child){border-bottom:1px solid var(--dsw-alias-border-l2)}._5VGGma_extraRoutes>._5VGGma_route:has(input:checked){border-color:var(--dsw-alias-label-secondary)}._5VGGma_routeGroup>._5VGGma_route:has(input:checked),._5VGGma_routeFamily:has(._5VGGma_route input:checked){background:var(--dsw-alias-interactive-bg-hover)}._5VGGma_route{cursor:pointer;align-items:flex-start;gap:10px;padding:12px 16px;display:flex}._5VGGma_subRoutes{flex-wrap:wrap;gap:16px;padding:0 16px 12px 39px;display:flex}._5VGGma_subRoute{color:var(--dsw-alias-label-primary);cursor:pointer;align-items:center;gap:6px;font-size:12px;line-height:18px;display:flex}._5VGGma_subRoute input{accent-color:var(--dsw-alias-label-primary);margin:0}._5VGGma_extraRoutes>._5VGGma_route{border-radius:10px}._5VGGma_route:hover{background:var(--dsw-alias-interactive-bg-hover)}._5VGGma_route:has(input:disabled){cursor:default;opacity:.7}._5VGGma_route input{accent-color:var(--dsw-alias-label-primary);flex:none;margin:3px 0 0}._5VGGma_routeText{flex-direction:column;gap:3px;min-width:0;display:flex}._5VGGma_route>._5VGGma_routeText{flex:1}._5VGGma_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}._5VGGma_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}._5VGGma_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}._5VGGma_addressRow{flex-wrap:wrap;gap:8px;display:flex}._5VGGma_addressRow>button{flex:none}._5VGGma_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}._5VGGma_addressMenu{flex:140px;min-width:0}._5VGGma_addressTrigger{text-align:left;cursor:pointer;justify-content:space-between;align-items:center;gap:8px;display:flex}._5VGGma_addressTrigger span{text-overflow:ellipsis;white-space:nowrap;min-width:0;overflow:hidden}._5VGGma_addressTrigger svg{color:var(--dsw-alias-label-secondary);flex:none}._5VGGma_addressTrigger:disabled{cursor:default;opacity:.7}._5VGGma_other{min-width:0}._5VGGma_other summary{width:fit-content;color:var(--dsw-alias-label-tertiary);cursor:pointer;font-size:12px;line-height:20px}._5VGGma_page>._5VGGma_other{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-2);border-radius:10px;padding:12px 16px}._5VGGma_page>._5VGGma_other summary{color:var(--dsw-alias-label-secondary)}._5VGGma_extraRoutes{margin-top:8px}._5VGGma_connectionHelp{flex-direction:column;gap:10px;display:flex}._5VGGma_relayFields,._5VGGma_relayField{gap:4px;min-width:0;display:grid}._5VGGma_relayFields{gap:10px}._5VGGma_relayPreview{border:1px solid var(--dsw-alias-separator,currentColor);border-radius:8px;gap:6px;min-width:0;padding:10px 12px;display:grid}._5VGGma_relayPreviewAddress{overflow-wrap:anywhere;flex-wrap:wrap;align-items:flex-start;gap:2px;display:flex}._5VGGma_relayPreviewAddress span{flex-direction:column;display:flex}._5VGGma_relayPreviewAddress small{color:var(--dsw-alias-label-secondary);font-size:11px}._5VGGma_relayTutorial{color:var(--dsw-alias-label-secondary);overflow-wrap:anywhere;margin:0;padding-left:20px;font-size:12px;line-height:20px}._5VGGma_relayTutorial li+li{margin-top:6px}._5VGGma_relayTutorial code{display:block}._5VGGma_ready{color:var(--dsw-alias-label-secondary);align-items:flex-start;gap:8px;margin:0;font-size:12px;line-height:20px;display:flex}._5VGGma_ready svg{color:#65af91;flex:none;margin-top:2px}._5VGGma_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}._5VGGma_manageRow{flex-wrap:wrap;justify-content:space-between;align-items:center;gap:8px 16px;padding:16px 0;display:flex}._5VGGma_manageRow+._5VGGma_manageRow{border-top:1px solid var(--dsw-alias-border-l2)}._5VGGma_stopRow{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-2);border-radius:12px;padding:16px 20px}._5VGGma_manageText{flex-direction:column;flex:200px;gap:4px;min-width:0;display:flex}._5VGGma_manageTitle{color:var(--dsw-alias-label-primary);font-size:13px;line-height:20px}._5VGGma_manageActions{flex-wrap:wrap;flex:none;align-items:center;gap:8px;max-width:100%;display:flex}._5VGGma_dangerOutline{color:var(--dsw-alias-state-error-primary)}._5VGGma_remoteList{flex-direction:column;gap:8px;margin-top:12px;display:flex}._5VGGma_link{width:fit-content;color:var(--dsw-alias-label-secondary);font-size:12px;line-height:18px;text-decoration:underline}._5VGGma_actions{flex-wrap:wrap;gap:8px;display:flex}._5VGGma_error{color:var(--dsw-alias-state-error-primary);overflow-wrap:anywhere;margin:0;font-size:12px;line-height:19px}._5VGGma_confirm{width:min(440px,100%)}._5VGGma_dangerConfirm{background:var(--dsw-alias-state-error-primary);color:#fff}._5VGGma_dangerConfirm:hover:not(:disabled){background:color-mix(in srgb, var(--dsw-alias-state-error-primary) 88%, #000);color:#fff}._5VGGma_qrModal{width:min(420px,100%)}._5VGGma_largeQr{border-radius:12px;width:100%;height:auto;display:block}@media (width<=600px){._5VGGma_page{gap:16px}._5VGGma_connectionMain{flex-direction:column;align-items:stretch;gap:16px;padding:16px}._5VGGma_scan{border-right:0;align-self:center;padding-right:0}._5VGGma_manage{padding:0 12px}._5VGGma_stopRow{padding:16px 12px}._5VGGma_routeAddress{flex-basis:100%;margin-left:0}._5VGGma_title{font-size:20px}._5VGGma_status{font-size:11px}}`,document.head.appendChild(e)}var Z={actions:`_5VGGma_actions`,addressMenu:`_5VGGma_addressMenu`,addressRow:`_5VGGma_addressRow`,addressTrigger:`_5VGGma_addressTrigger`,badge:`_5VGGma_badge`,confirm:`_5VGGma_confirm`,connection:`_5VGGma_connection`,connectionDetails:`_5VGGma_connectionDetails`,connectionHelp:`_5VGGma_connectionHelp`,connectionMain:`_5VGGma_connectionMain`,dangerConfirm:`_5VGGma_dangerConfirm`,dangerOutline:`_5VGGma_dangerOutline`,description:`_5VGGma_description`,error:`_5VGGma_error`,extraRoutes:`_5VGGma_extraRoutes`,fieldTitle:`_5VGGma_fieldTitle`,header:`_5VGGma_header`,input:`_5VGGma_input`,largeQr:`_5VGGma_largeQr`,link:`_5VGGma_link`,manage:`_5VGGma_manage`,manageActions:`_5VGGma_manageActions`,manageRow:`_5VGGma_manageRow`,manageText:`_5VGGma_manageText`,manageTitle:`_5VGGma_manageTitle`,meta:`_5VGGma_meta`,notice:`_5VGGma_notice`,other:`_5VGGma_other`,page:`_5VGGma_page`,qr:`_5VGGma_qr`,qrButton:`_5VGGma_qrButton`,qrCover:`_5VGGma_qrCover`,qrModal:`_5VGGma_qrModal`,qrPlaceholder:`_5VGGma_qrPlaceholder`,ready:`_5VGGma_ready`,relayField:`_5VGGma_relayField`,relayFields:`_5VGGma_relayFields`,relayPreview:`_5VGGma_relayPreview`,relayPreviewAddress:`_5VGGma_relayPreviewAddress`,relayTutorial:`_5VGGma_relayTutorial`,remoteList:`_5VGGma_remoteList`,route:`_5VGGma_route`,routeAddress:`_5VGGma_routeAddress`,routeFamily:`_5VGGma_routeFamily`,routeGroup:`_5VGGma_routeGroup`,routePanel:`_5VGGma_routePanel`,routeText:`_5VGGma_routeText`,routeTitle:`_5VGGma_routeTitle`,routes:`_5VGGma_routes`,scan:`_5VGGma_scan`,status:`_5VGGma_status`,stopRow:`_5VGGma_stopRow`,subRoute:`_5VGGma_subRoute`,subRoutes:`_5VGGma_subRoutes`,title:`_5VGGma_title`};function df(e,t){let[n,i]=(0,r.useState)(null),[a,o]=(0,r.useState)();return(0,r.useEffect)(()=>{if(n===null)return;let r=!1,a=Date.now()+6e4,s,c=async()=>{try{let t=await pu.get();if(r)return;if(t.background?.lan===n){e(t),i(null);return}}catch(e){if(r)return;if(!(e instanceof TypeError)){o(e instanceof Error?e.message:String(e)),i(null);return}}Date.now()>=a?(o(t),i(null)):r||(s=setTimeout(()=>{c()},1e3))};return s=setTimeout(()=>{c()},1e3),()=>{r=!0,clearTimeout(s)}},[n,e,t]),{target:n,error:a,start:i,fail:o}}function ff({state:e,disabled:t,restored:n,t:o}){let[s,c]=(0,r.useState)(!1),[l,u]=(0,r.useState)();return/* @__PURE__ */ (0,a.jsxs)(`div`,{className:Z.manageRow,"data-background-controls":!0,children:[/* @__PURE__ */ (0,a.jsxs)(`div`,{className:Z.manageText,children:[/* @__PURE__ */ (0,a.jsx)(`span`,{className:Z.manageTitle,children:o(`connectDevices.autostart`)}),e.autostart.status===`invalid`&&/* @__PURE__ */ (0,a.jsx)(`span`,{className:Z.error,children:e.autostart.reason}),l!==void 0&&/* @__PURE__ */ (0,a.jsx)(`span`,{role:`alert`,className:Z.error,children:l})]}),/* @__PURE__ */ (0,a.jsx)(i.Switch,{label:o(`connectDevices.autostart`),checked:e.autostart.status===`on`,disabled:s||t,onChange:e=>{c(!0),u(void 0),pu.autostart(e).then(async()=>{n(await pu.get())}).catch(e=>{u(e instanceof Error?e.message:String(e))}).finally(()=>c(!1))}})]})}function pf(e){return e.status===`connecting`||e.status===`missing-certificate`&&e.certificate.failure===void 0}function mf({kind:e,relay:t,busy:n,onChange:o,onRefresh:s,t:c}){let l=e===t.kind,u=l?t.state:{status:`off`},d=e===`official`,f=d&&u.status===`off`&&u.reason===`invite`,p=d?t.officialHostname:t.customHostname,m=l?t.quotaUntil:void 0,h=t.enabled&&!l,g=t.customHost?.startsWith(`relay.`)?t.customHost.slice(6):p?.split(`.`).slice(1).join(`.`)??``,[_,v]=(0,r.useState)(g),y=_===g&&t.customHost?t.customHost:_?`relay.${_}`:``,b=y!==(t.customHost??``),x=ac.safeParse(y).success,S=_!==``&&(!ac.safeParse(_).success||!x&&b),C=(0,r.useId)(),[w,T]=(0,r.useState)(d?``:p?.split(`.`)[0]??``),[E,ee]=(0,r.useState)(``),D=(0,r.useId)(),O=w!==``&&(d?!/^[a-z0-9]{4,20}$/.test(w):!oc.safeParse(w).success||`${w}.${_}`===y||_!==``&&!ac.safeParse(`${w}.${_}`).success),te=`certificate`in u?u.certificate.failure:void 0,k=te?.paused===!0,A=u.status===`connected`&&!k&&m===void 0,ne=m===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`):A?c(`connectDevices.relay.hint`):u.status===`stopped`?c(`connectDevices.relay.${u.reason}`):k?c(`connectDevices.relay.paused`):u.status===`off`?c(d?`connectDevices.relay.off`:`connectDevices.selfRelay.off`):pf(u)?c(`connectDevices.relay.preparing`):c(`connectDevices.relay.unavailable`,{date:new Date(te?.retryAt??``).toLocaleString()}):c(`connectDevices.relay.quota`);return/* @__PURE__ */ (0,a.jsxs)(`div`,{className:Z.connectionHelp,"data-relay-status":u.status,children:[d&&/* @__PURE__ */ (0,a.jsx)(`p`,{className:Z.meta,children:t.officialHost}),!d&&l&&t.enabled&&/* @__PURE__ */ (0,a.jsx)(`p`,{className:Z.meta,children:c(`connectDevices.selfRelay.address`,{host:t.customHost??``})}),h&&/* @__PURE__ */ (0,a.jsx)(`p`,{className:Z.notice,children:c(`connectDevices.relay.closeFirst`)}),/* @__PURE__ */ (0,a.jsxs)(`p`,{className:A?Z.ready:Z.notice,role:`status`,children:[A&&/* @__PURE__ */ (0,a.jsx)(i.IconCheckCircleOutlineRegular,{}),/* @__PURE__ */ (0,a.jsx)(`span`,{children:ne})]}),m!==void 0&&/* @__PURE__ */ (0,a.jsx)(`p`,{className:Z.meta,children:c(`connectDevices.relay.quotaUntil`,{date:new Date(m).toLocaleString()})}),k&&/* @__PURE__ */ (0,a.jsx)(`p`,{className:Z.meta,children:te.detail??c(`connectDevices.relay.unreachable`)}),u.status===`off`?/* @__PURE__ */ (0,a.jsxs)(`form`,{className:Z.connectionHelp,onSubmit:t=>{t.preventDefault(),o(!0,{kind:e,...d&&p===void 0?{name:w,invite:E}:{},...d?{}:{name:w,...b?{host:y}:{}}})},children:[!d&&/* @__PURE__ */ (0,a.jsxs)(`div`,{className:Z.relayFields,children:[/* @__PURE__ */ (0,a.jsxs)(`label`,{className:`${Z.relayField} ${Z.notice}`,children:[c(`connectDevices.selfRelay.host`),/* @__PURE__ */ (0,a.jsx)(`input`,{className:Z.input,value:_,placeholder:`example.com`,onChange:e=>v(e.target.value.toLowerCase()),"aria-invalid":S,"aria-describedby":C,autoCapitalize:`none`,spellCheck:!1,disabled:n||h})]}),/* @__PURE__ */ (0,a.jsx)(`p`,{id:C,className:S?Z.error:Z.meta,role:S?`alert`:void 0,children:c(S?`connectDevices.selfRelay.invalidHost`:`connectDevices.selfRelay.hostHint`)}),/* @__PURE__ */ (0,a.jsxs)(`label`,{className:`${Z.relayField} ${Z.notice}`,children:[c(`connectDevices.selfRelay.name`),/* @__PURE__ */ (0,a.jsx)(`input`,{className:Z.input,value:w,placeholder:`mycomputer`,onChange:e=>T(e.target.value.toLowerCase()),"aria-invalid":O,"aria-describedby":D,autoCapitalize:`none`,spellCheck:!1,disabled:n||h})]}),/* @__PURE__ */ (0,a.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,a.jsxs)(`div`,{className:Z.relayPreview,children:[/* @__PURE__ */ (0,a.jsx)(`p`,{className:Z.notice,children:c(`connectDevices.selfRelay.previewTitle`)}),/* @__PURE__ */ (0,a.jsxs)(`div`,{className:Z.relayPreviewAddress,children:[/* @__PURE__ */ (0,a.jsx)(`span`,{children:`https://`}),/* @__PURE__ */ (0,a.jsxs)(`span`,{children:[/* @__PURE__ */ (0,a.jsx)(`strong`,{children:w||c(`connectDevices.selfRelay.previewAutoName`)}),/* @__PURE__ */ (0,a.jsx)(`small`,{children:c(`connectDevices.selfRelay.name`)})]}),/* @__PURE__ */ (0,a.jsx)(`span`,{"aria-hidden":`true`,children:`.`}),/* @__PURE__ */ (0,a.jsxs)(`span`,{children:[/* @__PURE__ */ (0,a.jsx)(`strong`,{children:_||`example.com`}),/* @__PURE__ */ (0,a.jsx)(`small`,{children:c(`connectDevices.selfRelay.host`)})]})]})]}),y&&/* @__PURE__ */ (0,a.jsx)(`p`,{className:Z.meta,children:c(`connectDevices.selfRelay.address`,{host:y})})]}),d&&p===void 0&&/* @__PURE__ */ (0,a.jsxs)(`div`,{className:Z.relayFields,children:[f&&/* @__PURE__ */ (0,a.jsxs)(`p`,{className:Z.meta,children:[c(`connectDevices.relay.beta`),` `,/* @__PURE__ */ (0,a.jsx)(`a`,{className:Z.link,href:`https://github.com/BytePioneer-AI/codex-host#join-the-community`,target:`_blank`,rel:`noreferrer`,children:c(`connectDevices.relay.betaLink`)})]}),/* @__PURE__ */ (0,a.jsxs)(`label`,{className:`${Z.relayField} ${Z.notice}`,children:[c(`connectDevices.relay.name`),/* @__PURE__ */ (0,a.jsx)(`input`,{className:Z.input,value:w,onChange:e=>T(e.target.value),pattern:`[a-z0-9]{4,20}`,"aria-invalid":O,"aria-describedby":D,autoCapitalize:`none`,spellCheck:!1,disabled:n})]}),/* @__PURE__ */ (0,a.jsx)(`p`,{id:D,className:Z.meta,children:c(`connectDevices.relay.nameHint`)}),f&&/* @__PURE__ */ (0,a.jsxs)(`label`,{className:`${Z.relayField} ${Z.notice}`,children:[c(`connectDevices.relay.inviteLabel`),/* @__PURE__ */ (0,a.jsx)(`input`,{className:Z.input,value:E,onChange:e=>ee(e.target.value),autoCapitalize:`none`,spellCheck:!1,disabled:n})]})]}),/* @__PURE__ */ (0,a.jsx)(`div`,{className:Z.actions,children:/* @__PURE__ */ (0,a.jsx)(i.Button,{type:`submit`,variant:`primary`,disabled:n||h||(d?p===void 0&&O:y===``||S||O),"aria-busy":n,children:c(n?`connectDevices.preparing`:`connectDevices.relay.enable`)})})]}):/* @__PURE__ */ (0,a.jsxs)(`div`,{className:Z.actions,children:[!A&&/* @__PURE__ */ (0,a.jsx)(i.Button,{variant:`outline`,disabled:n,onClick:s,children:c(`connectDevices.refresh`)}),/* @__PURE__ */ (0,a.jsx)(i.Button,{variant:`outline`,disabled:n,onClick:()=>o(!1,{kind:e}),children:c(`connectDevices.relay.disable`)})]})]})}var hf=/* @__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))(hf||{});let gf=[0,1],_f=[1,0],vf=[2,3],yf=[3,2],bf={L:gf,M:_f,Q:vf,H:yf},xf=/^\d*$/,Sf=/^[A-Z0-9 $%*+./:-]*$/,Cf=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`,wf=[[-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]],Tf=[[-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 Ef=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,hf.Timing),this.setFunctionModule(e,6,e%2==0,hf.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,Of(r,e));this.setFunctionModule(8,7,Of(r,6)),this.setFunctionModule(8,8,Of(r,7)),this.setFunctionModule(7,8,Of(r,8));for(let e=9;e<15;e++)this.setFunctionModule(14-e,8,Of(r,e));for(let e=0;e<8;e++)this.setFunctionModule(this.size-1-e,8,Of(r,e));for(let e=8;e<15;e++)this.setFunctionModule(8,this.size-15+e,Of(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=Of(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,hf.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,hf.Alignment)}setFunctionModule(e,t,n,r=hf.Function){this.modules[t][e]=n,this.types[t][e]=r}addEccAndInterleave(e){let t=this.version,n=this.ecc;if(e.length!==Uf(t,n))throw RangeError(`Invalid argument`);let r=Tf[n[0]][t],i=wf[n[0]][t],a=Math.floor(Hf(t)/8),o=r-a%r,s=Math.floor(a/r),c=[],l=Wf(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=Gf(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(Hf(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]=Of(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 Df(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 Of(e,t){return!!(e>>>t&1)}var kf=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 Af=[1,10,12,14],jf=[2,9,11,13],Mf=[4,8,16,16];function Nf(e,t){return e[Math.floor((t+7)/17)+1]}function Pf(e){let t=[];for(let n of e)Df(n,8,t);return new kf(Mf,e.length,t)}function Ff(e){if(!Rf(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);Df(Number.parseInt(e.substring(n,n+r),10),r*3+1,t),n+=r}return new kf(Af,e.length,t)}function If(e){if(!zf(e))throw RangeError(`String contains unencodable characters in alphanumeric mode`);let t=[],n=0;for(;n+2<=e.length;n+=2){let r=Cf.indexOf(e.charAt(n))*45;r+=Cf.indexOf(e.charAt(n+1)),Df(r,11,t)}return n<e.length&&Df(Cf.indexOf(e.charAt(n)),6,t),new kf(jf,e.length,t)}function Lf(e){return e===``?[]:Rf(e)?[Ff(e)]:zf(e)?[If(e)]:[Pf(Vf(e))]}function Rf(e){return xf.test(e)}function zf(e){return Sf.test(e)}function Bf(e,t){let n=0;for(let r of e){let e=Nf(r.mode,t);if(r.numChars>=1<<e)return 1/0;n+=4+e+r.bitData.length}return n}function Vf(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 Hf(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 Uf(e,t){return Math.floor(Hf(e)/8)-wf[t[0]][e]*Tf[t[0]][e]}function Wf(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]=Kf(t[e],n),e+1<t.length&&(t[e]^=t[e+1]);n=Kf(n,2)}return t}function Gf(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]^=Kf(t,e))}return n}function Kf(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 qf(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=Uf(o,t)*8,i=Bf(e,o);if(i<=n){s=i;break}if(o>=r)throw RangeError(`Data too long`)}for(let e of[_f,vf,yf])a&&s<=Uf(o,e)*8&&(t=e);let c=[];for(let t of e){Df(t.mode[0],4,c),Df(t.numChars,Nf(t.mode,o),c);for(let e of t.getData())c.push(e)}let l=Uf(o,t)*8;Df(0,Math.min(4,l-c.length),c),Df(0,(8-c.length%8)%8,c);for(let e=236;c.length<l;e^=253)Df(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 Ef(o,t,u,i)}function Jf(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`?Lf(e):Array.isArray(e)?[Pf(e)]:void 0;if(!c)throw Error(`uqr only supports encoding string and binary data, but got: ${typeof e}`);let l=qf(c,bf[n],i,a,o,r),u=Yf({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 Yf(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=hf.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 Xf({value:e,label:t,className:n}){let{size:i,path:o}=(0,r.useMemo)(()=>{let t=Jf(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,a.jsxs)(`svg`,{role:`img`,"aria-label":t,className:n,viewBox:`0 0 ${String(i)} ${String(i)}`,shapeRendering:`crispEdges`,children:[/* @__PURE__ */ (0,a.jsx)(`rect`,{width:i,height:i,fill:`#fff`}),/* @__PURE__ */ (0,a.jsx)(`path`,{d:o,fill:`#000`})]})}function Zf({t:e}){return/* @__PURE__ */ (0,a.jsxs)(`details`,{className:Z.other,"data-self-relay-help":!0,children:[/* @__PURE__ */ (0,a.jsx)(`summary`,{children:e(`connectDevices.selfRelay.helpTitle`)}),/* @__PURE__ */ (0,a.jsxs)(`div`,{className:Z.connectionHelp,children:[/* @__PURE__ */ (0,a.jsxs)(`ol`,{className:Z.relayTutorial,children:[/* @__PURE__ */ (0,a.jsx)(`li`,{children:e(`connectDevices.selfRelay.domain`)}),/* @__PURE__ */ (0,a.jsx)(`li`,{children:e(`connectDevices.selfRelay.dns`)}),/* @__PURE__ */ (0,a.jsx)(`li`,{children:e(`connectDevices.selfRelay.ports`)}),/* @__PURE__ */ (0,a.jsxs)(`li`,{children:[e(`connectDevices.selfRelay.docker`),/* @__PURE__ */ (0,a.jsx)(`code`,{children:`git clone https://github.com/BytePioneer-AI/codex-host.git /opt/codexhost`}),/* @__PURE__ */ (0,a.jsx)(`code`,{children:`cd /opt/codexhost/packages/remote-relay/deploy`}),/* @__PURE__ */ (0,a.jsx)(`code`,{children:e(`connectDevices.selfRelay.replaceDomain`)}),/* @__PURE__ */ (0,a.jsx)(`code`,{children:`echo "RELAY_DOMAIN=example.com" > .env`}),/* @__PURE__ */ (0,a.jsx)(`code`,{children:`docker compose up -d --build`})]}),/* @__PURE__ */ (0,a.jsx)(`li`,{children:e(`connectDevices.selfRelay.connect`)})]}),/* @__PURE__ */ (0,a.jsx)(`p`,{className:Z.meta,children:e(`connectDevices.selfRelay.noDomain`)}),/* @__PURE__ */ (0,a.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 Qf={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`},$f={public:`connectDevices.kindPublicHint`,"tailscale-funnel":`connectDevices.kindFunnelHint`,virtual:`connectDevices.kindVirtualHint`},ep={"tailscale-https":`connectDevices.httpsSummary`,relay:`connectDevices.relay.summary`,"self-hosted-relay":`connectDevices.selfRelay.summary`,lan:`connectDevices.lanSummary`},tp=[`public`,`relay`,`self-hosted-relay`,`tailscale-funnel`,`tailscale-https`,`tailscale`,`lan`,`virtual`];function np({data:e,busy:t,restarting:n,onEnable:o,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,r.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:_)??tp.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,r.useState)(),[w,T]=(0,r.useState)(),[E,ee]=(0,r.useState)(!1),[D,O]=(0,r.useState)(`idle`),te=(0,r.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,re=ne?$f[x]:void 0,M=x===`tailscale-https`,ie=M?d.status===`not-serving`:(x===`lan`||x===`tailscale`||x===`virtual`)&&f!==void 0&&!f.lan&&A!==void 0,ae=tp.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,r.useEffect)(()=>{O(`idle`),T(void 0)},[j]),(0,r.useEffect)(()=>{if(D===`idle`)return;let e=setTimeout(()=>O(`idle`),2e3);return()=>clearTimeout(e)},[D]);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,a.jsxs)(`label`,{className:Z.route,"data-connect-route":e,children:[/* @__PURE__ */ (0,a.jsx)(`input`,{type:`radio`,name:te,checked:e===`tailscale-https`?oe:x===e,disabled:t,onChange:()=>ce(e)}),/* @__PURE__ */ (0,a.jsxs)(`span`,{className:Z.routeText,children:[/* @__PURE__ */ (0,a.jsxs)(`span`,{className:Z.routeTitle,children:[l(Qf[e]),y(e)&&m?.enabled&&e===h&&/* @__PURE__ */ (0,a.jsx)(`span`,{className:Z.badge,children:l(`connectDevices.relay.inUse`)}),/* @__PURE__ */ (0,a.jsx)(`span`,{className:Z.routeAddress,children:le(e)})]}),(e===`lan`||e===`tailscale-https`||e===`relay`||e===`self-hosted-relay`)&&/* @__PURE__ */ (0,a.jsx)(`span`,{className:Z.meta,children:l(ep[e])})]})]},e);return/* @__PURE__ */ (0,a.jsxs)(`section`,{className:Z.connection,children:[/* @__PURE__ */ (0,a.jsxs)(`div`,{className:Z.connectionMain,children:[/* @__PURE__ */ (0,a.jsx)(`div`,{className:Z.scan,children:j===void 0?/* @__PURE__ */ (0,a.jsxs)(`div`,{className:Z.qrPlaceholder,children:[/* @__PURE__ */ (0,a.jsx)(i.IconShieldOutlineRegular,{size:32}),/* @__PURE__ */ (0,a.jsx)(`span`,{children:l(n?`connectDevices.preparing`:`connectDevices.qrPending`)})]}):/* @__PURE__ */ (0,a.jsxs)(`button`,{type:`button`,className:Z.qrButton,"aria-label":l(`connectDevices.viewQr`),disabled:t,onClick:()=>T(j),children:[/* @__PURE__ */ (0,a.jsx)(Xf,{value:j,label:l(`connectDevices.qrLabel`),className:Z.qr}),/* @__PURE__ */ (0,a.jsxs)(`span`,{className:Z.qrCover,"aria-hidden":`true`,children:[/* @__PURE__ */ (0,a.jsx)(i.IconShieldOutlineRegular,{size:24}),/* @__PURE__ */ (0,a.jsx)(`span`,{children:l(`connectDevices.viewQr`)}),/* @__PURE__ */ (0,a.jsx)(`small`,{children:l(`connectDevices.qrSensitive`)})]})]})}),/* @__PURE__ */ (0,a.jsxs)(`div`,{className:Z.connectionDetails,children:[y(x)&&m!==void 0&&/* @__PURE__ */ (0,a.jsx)(mf,{kind:x===`relay`?`official`:`self-hosted`,relay:m,busy:t,onChange:s,onRefresh:c,t:l},x),!y(x)&&(!ne||re!==void 0)&&/* @__PURE__ */ (0,a.jsxs)(`div`,{className:Z.connectionHelp,"data-tailscale-status":M&&d.status!==`serving`?d.status:void 0,children:[re===void 0?n?/* @__PURE__ */ (0,a.jsx)(`p`,{role:`status`,className:Z.notice,children:l(`connectDevices.restarting`)}):M?/* @__PURE__ */ (0,a.jsxs)(a.Fragment,{children:[/* @__PURE__ */ (0,a.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,a.jsx)(`p`,{className:Z.meta,children:d.target}),d.status===`error`&&/* @__PURE__ */ (0,a.jsx)(`p`,{className:Z.error,children:d.message}),d.status===`not-installed`&&/* @__PURE__ */ (0,a.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,a.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,a.jsx)(`p`,{className:Z.meta,children:l(`connectDevices.httpsPersistence`)})]}):/* @__PURE__ */ (0,a.jsx)(`p`,{className:Z.notice,children:l(ie?`connectDevices.enableImpact`:f===void 0?`connectDevices.localListener`:`connectDevices.noAddress`)}):/* @__PURE__ */ (0,a.jsxs)(`p`,{className:Z.ready,children:[/* @__PURE__ */ (0,a.jsx)(i.IconCheckCircleOutlineRegular,{}),/* @__PURE__ */ (0,a.jsx)(`span`,{children:l(re)})]}),!ne&&!n&&/* @__PURE__ */ (0,a.jsxs)(`div`,{className:Z.actions,children:[ie&&/* @__PURE__ */ (0,a.jsx)(i.Button,{variant:`primary`,disabled:t,"aria-busy":t,onClick:()=>o(M?`https`:`direct`),children:l(t?`connectDevices.preparing`:`connectDevices.enableQr`)}),(M||!ie)&&/* @__PURE__ */ (0,a.jsx)(i.Button,{variant:`outline`,disabled:t,onClick:c,children:l(`connectDevices.refresh`)})]})]}),A!==void 0&&/* @__PURE__ */ (0,a.jsxs)(`div`,{className:Z.addressRow,children:[k.length>1?/* @__PURE__ */ (0,a.jsx)(i.Menu,{open:E,onClose:()=>ee(!1),portal:!0,className:Z.addressMenu,anchor:/* @__PURE__ */ (0,a.jsxs)(`button`,{"aria-label":l(`connectDevices.address`),type:`button`,className:`${Z.input} ${Z.addressTrigger}`,disabled:t,"aria-haspopup":`menu`,"aria-expanded":E,onClick:()=>ee(!E),children:[/* @__PURE__ */ (0,a.jsx)(`span`,{children:new URL(A.url).host}),/* @__PURE__ */ (0,a.jsx)(i.IconChevronDownOutlineRegular,{})]}),items:k.map(e=>({id:e.url,label:new URL(e.url).host})),selectedId:A.url,onSelect:e=>{ee(!1),C(e)}}):/* @__PURE__ */ (0,a.jsx)(`input`,{"aria-label":l(`connectDevices.address`),className:Z.input,value:new URL(A.url).host,readOnly:!0}),j!==void 0&&/* @__PURE__ */ (0,a.jsx)(i.Button,{variant:`outline`,disabled:t,onClick:()=>{navigator.clipboard.writeText(j).then(()=>O(`copied`),()=>O(`failed`))},children:l(D===`copied`?`connectDevices.copied`:D===`failed`?`connectDevices.copyFailed`:`connectDevices.copyLink`)})]}),x===`self-hosted-relay`&&m!==void 0&&/* @__PURE__ */ (0,a.jsx)(Zf,{t:l})]})]}),/* @__PURE__ */ (0,a.jsxs)(`div`,{className:Z.routePanel,children:[/* @__PURE__ */ (0,a.jsxs)(`fieldset`,{className:Z.routes,disabled:t,children:[/* @__PURE__ */ (0,a.jsx)(`legend`,{className:Z.fieldTitle,children:l(`connectDevices.connectVia`)}),/* @__PURE__ */ (0,a.jsxs)(`div`,{className:Z.routeGroup,children:[m!==void 0&&/* @__PURE__ */ (0,a.jsxs)(a.Fragment,{children:[ue(`relay`),ue(`self-hosted-relay`)]}),/* @__PURE__ */ (0,a.jsxs)(`div`,{className:Z.routeFamily,children:[ue(`tailscale-https`),oe&&se&&/* @__PURE__ */ (0,a.jsxs)(`div`,{className:Z.subRoutes,children:[/* @__PURE__ */ (0,a.jsxs)(`label`,{className:Z.subRoute,children:[/* @__PURE__ */ (0,a.jsx)(`input`,{type:`radio`,name:`${te}-tailscale`,checked:x===`tailscale-https`,onChange:()=>ce(`tailscale-https`)}),l(`connectDevices.tailscaleViaHttps`)]}),/* @__PURE__ */ (0,a.jsxs)(`label`,{className:Z.subRoute,"data-connect-route":`tailscale`,children:[/* @__PURE__ */ (0,a.jsx)(`input`,{type:`radio`,name:`${te}-tailscale`,checked:x===`tailscale`,onChange:()=>ce(`tailscale`)}),l(`connectDevices.tailscaleViaIp`)]})]})]}),ue(`lan`)]})]}),ae.length>0&&/* @__PURE__ */ (0,a.jsxs)(`details`,{className:Z.other,open:ae.includes(x)?!0:void 0,children:[/* @__PURE__ */ (0,a.jsx)(`summary`,{children:l(`connectDevices.otherMethods`)}),/* @__PURE__ */ (0,a.jsx)(`div`,{className:Z.extraRoutes,children:ae.map(ue)})]})]}),j!==void 0&&w===j&&/* @__PURE__ */ (0,a.jsxs)(i.Modal,{open:!0,onClose:()=>T(void 0),title:l(`connectDevices.scan`),closeLabel:l(`connectDevices.close`),className:Z.qrModal,children:[/* @__PURE__ */ (0,a.jsx)(`p`,{className:Z.notice,children:l(`connectDevices.qrSensitive`)}),/* @__PURE__ */ (0,a.jsx)(Xf,{value:j,label:l(`connectDevices.qrLabel`),className:Z.largeQr}),/* @__PURE__ */ (0,a.jsx)(i.Button,{variant:`outline`,onClick:()=>T(void 0),children:l(`connectDevices.hideQr`)})]})]})}let rp=e=>e instanceof Error?e.message:String(e);function ip(e){if(e instanceof ou&&e.code===`auth/disabled`)return{kind:`disabled`};if(e instanceof ou&&e.code===`auth/local-access-required`){let t=lc.safeParse(e.details);return{kind:`non-local`,url:t.success?t.data.url:`http://127.0.0.1`}}return{kind:`failed`,message:rp(e)}}function ap({title:e,description:t,confirmLabel:n,busy:r,error:o,onClose:s,onConfirm:c,t:l}){return/* @__PURE__ */ (0,a.jsx)(i.Modal,{open:!0,onClose:()=>{r||s()},title:e,closeLabel:l(`connectDevices.close`),description:t,className:Z.confirm,footer:/* @__PURE__ */ (0,a.jsxs)(a.Fragment,{children:[/* @__PURE__ */ (0,a.jsx)(i.Button,{variant:`outline`,disabled:r,onClick:s,children:l(`connectDevices.cancel`)}),/* @__PURE__ */ (0,a.jsx)(i.Button,{variant:`primary`,className:Z.dangerConfirm,disabled:r,"aria-busy":r,onClick:c,children:n})]}),children:o!==null&&/* @__PURE__ */ (0,a.jsx)(`p`,{className:Z.error,role:`alert`,children:o})})}function op({url:e,t}){let[n,o]=(0,r.useState)(!1),[s,c]=(0,r.useState)(!1),[l,u]=(0,r.useState)(null);return/* @__PURE__ */ (0,a.jsxs)(`div`,{className:Z.page,children:[/* @__PURE__ */ (0,a.jsx)(`p`,{className:Z.notice,"data-connect-notice":`non-local`,children:t(`connectDevices.localOnly`,{url:e})}),/* @__PURE__ */ (0,a.jsx)(`div`,{children:/* @__PURE__ */ (0,a.jsx)(i.Button,{variant:`outline`,onClick:()=>o(!0),children:t(`connectDevices.signOut`)})}),n&&/* @__PURE__ */ (0,a.jsx)(ap,{t,title:t(`connectDevices.signOutTitle`),description:t(`connectDevices.signOutDescription`),confirmLabel:t(`connectDevices.signOutConfirm`),busy:s,error:l,onClose:()=>o(!1),onConfirm:()=>{c(!0),u(null),zd().catch(e=>{c(!1),u(t(`connectDevices.actionFailed`,{message:rp(e)}))})}})]})}function sp({t:e}){let[t,n]=(0,r.useState)({kind:`loading`}),[o,s]=(0,r.useState)(null),[c,l]=(0,r.useState)(!1),[u,d]=(0,r.useState)(null),[f,p]=(0,r.useState)(!1),m=(0,r.useCallback)(e=>n({kind:`ready`,data:e}),[]),h=df(m,e(`connectDevices.restartTimeout`)),g=c||h.target!==null;(0,r.useEffect)(()=>{if(!f)return;let e=setTimeout(()=>p(!1),2e3);return()=>clearTimeout(e)},[f]),(0,r.useEffect)(()=>{let e=!1;return pu.get().then(t=>{e||n({kind:`ready`,data:t})},t=>{e||n(ip(t))}),()=>{e=!0}},[]);let _=t.kind===`ready`?t.data.relay?.state:void 0,v=_!==void 0&&pf(_);(0,r.useEffect)(()=>{if(!v)return;let e=setTimeout(()=>{pu.get().then(m,()=>void 0)},2e3);return()=>clearTimeout(e)},[v,t,m]);let y=async()=>{let e=await pu.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:rp(t)}));try{await y()}catch{}}finally{l(!1)}},x=e=>{b(async()=>{if(e===`direct`){let{changed:e}=await pu.lan(!0);e?h.start(!0):await y()}else{let e=await pu.serve(!0);if(e.error!==void 0)throw Error(e.error);await y()}})},S=async()=>{let t=await y();t.relay?.enabled&&(await pu.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 pu.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 pu.lan(!1);e?h.start(!1):await y()}s(null)};if(t.kind===`loading`)return/* @__PURE__ */ (0,a.jsx)(`p`,{className:Z.meta,children:e(`connectDevices.loading`)});if(t.kind===`non-local`)return/* @__PURE__ */ (0,a.jsx)(op,{url:t.url,t:e});if(t.kind===`disabled`)return/* @__PURE__ */ (0,a.jsx)(`p`,{className:Z.notice,"data-connect-notice":`disabled`,children:e(`connectDevices.disabled`)});if(t.kind===`failed`)return/* @__PURE__ */ (0,a.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:ee,background:D}=C,O=E.length>0||D?.lan===!0,te=D?.lan===!0||ee.status===`serving`||C.relay?.enabled===!0,k=E.some(e=>e.kind===`public`||D===void 0&&[`lan`,`tailscale`,`virtual`].includes(e.kind)),A=T===null?void 0:(0,i.relativeTime)(T,Date.now()),ne=u??h.error;return/* @__PURE__ */ (0,a.jsxs)(`div`,{className:Z.page,"data-connect-devices":!0,children:[/* @__PURE__ */ (0,a.jsxs)(`header`,{className:Z.header,children:[/* @__PURE__ */ (0,a.jsxs)(`div`,{children:[/* @__PURE__ */ (0,a.jsx)(`h2`,{className:Z.title,children:e(`connectDevices.title`)}),/* @__PURE__ */ (0,a.jsx)(`p`,{className:Z.description,children:e(`connectDevices.subtitle`)})]}),/* @__PURE__ */ (0,a.jsx)(`span`,{className:Z.status,"data-active":O&&h.target===null,children:e(h.target===null?O?`connectDevices.accessEnabled`:`connectDevices.localAccess`:`connectDevices.preparing`)})]}),/* @__PURE__ */ (0,a.jsx)(np,{data:C,busy:g,restarting:h.target!==null,onEnable:x,onRelay:(e,t)=>{b(async()=>{await pu.relay(e,t),await y()})},onRefresh:()=>{b(async()=>{await y()})},t:e}),o===null&&ne!=null&&/* @__PURE__ */ (0,a.jsx)(`p`,{role:`alert`,className:Z.error,children:ne}),/* @__PURE__ */ (0,a.jsxs)(`section`,{className:Z.manage,children:[/* @__PURE__ */ (0,a.jsxs)(`div`,{className:Z.manageRow,children:[/* @__PURE__ */ (0,a.jsxs)(`div`,{className:Z.manageText,children:[/* @__PURE__ */ (0,a.jsx)(`span`,{className:Z.manageTitle,children:e(`connectDevices.tokenTitle`)}),/* @__PURE__ */ (0,a.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,a.jsxs)(`div`,{className:Z.manageActions,children:[/* @__PURE__ */ (0,a.jsx)(i.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,a.jsx)(i.Button,{variant:`outline`,disabled:g,onClick:()=>{d(null),s(`regenerate`)},children:e(`connectDevices.regenerate`)})]})]}),D!==void 0&&/* @__PURE__ */ (0,a.jsx)(ff,{state:D,disabled:g,restored:m,t:e})]}),te&&/* @__PURE__ */ (0,a.jsxs)(`div`,{className:`${Z.manageRow} ${Z.stopRow}`,children:[/* @__PURE__ */ (0,a.jsxs)(`div`,{className:Z.manageText,children:[/* @__PURE__ */ (0,a.jsx)(`span`,{className:Z.manageTitle,children:e(`connectDevices.stopTitleShort`)}),/* @__PURE__ */ (0,a.jsx)(`span`,{className:Z.meta,children:e(`connectDevices.stopHint`)})]}),/* @__PURE__ */ (0,a.jsx)(`div`,{className:Z.manageActions,children:/* @__PURE__ */ (0,a.jsx)(i.Button,{variant:`outline`,className:Z.dangerOutline,disabled:g,onClick:()=>{d(null),s(`stop`)},children:e(`connectDevices.stop`)})})]}),/* @__PURE__ */ (0,a.jsxs)(`details`,{className:Z.other,"data-remote-options":!0,children:[/* @__PURE__ */ (0,a.jsx)(`summary`,{children:e(`connectDevices.help`)}),/* @__PURE__ */ (0,a.jsxs)(`div`,{className:Z.remoteList,children:[/* @__PURE__ */ (0,a.jsx)(`p`,{className:Z.notice,children:e(`connectDevices.keepAwake`)}),/* @__PURE__ */ (0,a.jsxs)(`div`,{className:Z.routeText,children:[/* @__PURE__ */ (0,a.jsx)(`span`,{className:Z.routeTitle,children:`Tailscale`}),/* @__PURE__ */ (0,a.jsx)(`span`,{className:Z.meta,children:e(`connectDevices.remote.tailscale`)}),/* @__PURE__ */ (0,a.jsx)(`a`,{className:Z.link,href:`https://tailscale.com/download`,target:`_blank`,rel:`noreferrer`,children:e(`connectDevices.remote.tailscaleLink`)})]}),/* @__PURE__ */ (0,a.jsxs)(`div`,{className:Z.routeText,children:[/* @__PURE__ */ (0,a.jsx)(`span`,{className:Z.routeTitle,children:e(`connectDevices.remote.tunnelTitle`)}),/* @__PURE__ */ (0,a.jsx)(`span`,{className:Z.meta,children:e(`connectDevices.remote.tunnel`)}),/* @__PURE__ */ (0,a.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`)})]})]})]}),o!==null&&/* @__PURE__ */ (0,a.jsx)(ap,{t:e,title:e(o===`stop`?`connectDevices.stopTitle`:`connectDevices.regenerateTitle`),description:o===`stop`?`${e(`connectDevices.stopDescription`)}${k?` ${e(`connectDevices.stopUnmanaged`)}`:``}`:e(`connectDevices.regenerateDescription`),confirmLabel:e(o===`stop`?`connectDevices.stopConfirm`:`connectDevices.regenerateConfirm`),busy:g,error:u,onClose:()=>s(null),onConfirm:()=>{b(o===`stop`?S:async()=>{m(await pu.regenerate()),s(null)})}})]})}async function cp(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:ru(),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 ou(e,t,n)}if(!i.ok)throw Error(`HTTP ${String(i.status)}`);return eu.parse(a.result?.value)}let lp={list:e=>cp(`list`,{},e),install:(e,t)=>cp(`install`,{spec:e,...t===void 0?{}:{registry:t}}),setEnabled:(e,t)=>cp(`setEnabled`,{id:e,enabled:t}),remove:e=>cp(`remove`,{id:e})},up=/^web-assets: \S+ requires (\S+)@(.+), but the browser Host does not provide \1$/u,dp=/^web-assets: \S+ requires (\S+)@(.+), but the browser Host provides (.+)$/u,fp=/^web-assets: \S+ declares runtime version requirements, but the browser Host version snapshot is unavailable$/u,pp=/^web-assets: \S+ requires unavailable browser module (\S+)$/u;function mp(e,t){return up.test(e)||pp.test(e)?t(`extensions.unsupported`):dp.test(e)?t(`extensions.versionMismatch`):fp.test(e)?t(`extensions.hostVersionSnapshotMissing`):e.replace(/^web-assets:\s+/u,``)}let hp=`@deepseek-ai/dsh-client-ui-codexhost/InstallWebExtensionDialog.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(hp)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-codexhost`,e.dataset.pluginCss=hp,e.textContent=`.xh0XoG_dialog{width:min(560px,100%);max-height:min(800px,100%)}.xh0XoG_content{min-height:0;overflow-y:auto}.xh0XoG_body,.xh0XoG_footer,.xh0XoG_field{flex-direction:column;min-width:0;display:flex}.xh0XoG_body{gap:12px}.xh0XoG_footer{flex:1;gap:20px}.xh0XoG_field{color:var(--dsw-alias-label-secondary);gap:6px;font-size:13px}.xh0XoG_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}.xh0XoG_field input:focus{border-color:var(--dsw-alias-state-business-primary);box-shadow:inset 0 0 0 .5px var(--dsw-alias-state-business-primary)}.xh0XoG_field input[aria-invalid=true]{border-color:var(--dsw-alias-state-error-primary)}.xh0XoG_field input:disabled,.xh0XoG_registry select:disabled{opacity:.6}.xh0XoG_options{flex-wrap:wrap;justify-content:space-between;align-items:center;gap:8px 12px;display:flex}.xh0XoG_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}.xh0XoG_guideToggle:hover{color:var(--dsw-alias-label-primary)}.xh0XoG_guideToggle[aria-expanded=true] .xh0XoG_chevron{transform:rotate(180deg)}.xh0XoG_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}.xh0XoG_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}.xh0XoG_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}.xh0XoG_guide p{margin:8px 0 4px}.xh0XoG_guide code{color:var(--dsw-alias-label-tertiary);overflow-wrap:anywhere}.xh0XoG_scope,.xh0XoG_hint,.xh0XoG_error{color:var(--dsw-alias-label-secondary);overflow-wrap:anywhere;margin:0;font-size:12px;line-height:18px}.xh0XoG_error{color:var(--dsw-alias-state-error-primary,#d92d20)}.xh0XoG_wide{width:100%}`,document.head.appendChild(e)}var gp={body:`xh0XoG_body`,chevron:`xh0XoG_chevron`,content:`xh0XoG_content`,dialog:`xh0XoG_dialog`,error:`xh0XoG_error`,field:`xh0XoG_field`,footer:`xh0XoG_footer`,guide:`xh0XoG_guide`,guideToggle:`xh0XoG_guideToggle`,hint:`xh0XoG_hint`,options:`xh0XoG_options`,registry:`xh0XoG_registry`,scope:`xh0XoG_scope`,wide:`xh0XoG_wide`};let _p={official:`https://registry.npmjs.org/`,mirror:`https://registry.npmmirror.com/`};function vp({t:e,open:t,busy:n,error:o,onClose:s,onInstall:c}){let[l,u]=(0,r.useState)(``),[d,f]=(0,r.useState)(`official`),[p,m]=(0,r.useState)(``),[h,g]=(0,r.useState)(!1),[_,v]=(0,r.useState)(!1),y=(0,r.useId)(),b=(0,r.useId)(),x=(0,r.useId)(),S=(0,r.useId)(),C=(0,r.useRef)(null);return(0,r.useEffect)(()=>{if(!t)return;let e=(0,i.observeComposition)(document);return C.current=e,()=>{e.dispose(),C.current=null}},[t]),/* @__PURE__ */ (0,a.jsx)(i.Modal,{open:t,onClose:()=>{n||s()},title:e(`extensions.add`),closeLabel:e(`extensions.close`),description:e(`extensions.sourceHint`),className:gp.dialog,contentClassName:gp.content,footer:/* @__PURE__ */ (0,a.jsxs)(`div`,{className:gp.footer,children:[/* @__PURE__ */ (0,a.jsx)(`p`,{className:gp.scope,children:e(`extensions.scope`)}),/* @__PURE__ */ (0,a.jsx)(i.Button,{type:`submit`,form:y,variant:`primary`,className:gp.wide,disabled:n||l.trim()===``,"aria-busy":n,children:e(n?`extensions.installing`:`extensions.install`)})]}),children:/* @__PURE__ */ (0,a.jsxs)(`form`,{id:y,className:gp.body,onSubmit:e=>{e.preventDefault();let t=l.trim();if(n||t===``)return;let r=tu.safeParse(d===`custom`?p:_p[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,a.jsx)(`div`,{className:gp.field,children:/* @__PURE__ */ (0,a.jsx)(`input`,{type:`text`,"data-modal-autofocus":!0,value:l,placeholder:e(`extensions.sourcePlaceholder`),"aria-label":e(`extensions.sourceLabel`),"aria-describedby":o===null?void 0:x,autoCapitalize:`none`,autoCorrect:`off`,spellCheck:!1,disabled:n,onChange:e=>u(e.currentTarget.value)})}),o!==null&&/* @__PURE__ */ (0,a.jsx)(`p`,{id:x,className:gp.error,role:`alert`,children:o}),/* @__PURE__ */ (0,a.jsxs)(`div`,{className:gp.options,children:[/* @__PURE__ */ (0,a.jsxs)(`button`,{type:`button`,className:gp.guideToggle,"aria-expanded":_,"aria-controls":b,onClick:()=>v(!_),children:[/* @__PURE__ */ (0,a.jsx)(i.IconChevronDownOutlineRegular,{className:gp.chevron,size:14,"aria-hidden":`true`}),e(`extensions.guide`)]}),/* @__PURE__ */ (0,a.jsxs)(`label`,{className:gp.registry,children:[/* @__PURE__ */ (0,a.jsx)(`span`,{children:e(`extensions.registry`)}),/* @__PURE__ */ (0,a.jsxs)(`select`,{"aria-label":e(`extensions.registry`),value:d,disabled:n,onChange:e=>{f(e.currentTarget.value),g(!1)},children:[/* @__PURE__ */ (0,a.jsx)(`option`,{value:`official`,children:e(`extensions.registryOfficial`)}),/* @__PURE__ */ (0,a.jsx)(`option`,{value:`mirror`,children:e(`extensions.registryMirror`)}),/* @__PURE__ */ (0,a.jsx)(`option`,{value:`custom`,children:e(`extensions.registryCustom`)})]})]})]}),d===`custom`&&/* @__PURE__ */ (0,a.jsxs)(`label`,{className:gp.field,children:[/* @__PURE__ */ (0,a.jsx)(`span`,{children:e(`extensions.registryCustomUrl`)}),/* @__PURE__ */ (0,a.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,a.jsx)(`span`,{id:S,className:gp.error,role:`alert`,children:e(`extensions.registryInvalid`)})]}),_&&/* @__PURE__ */ (0,a.jsxs)(`div`,{id:b,className:gp.guide,children:[/* @__PURE__ */ (0,a.jsx)(`p`,{children:e(`extensions.guideNpm`)}),/* @__PURE__ */ (0,a.jsx)(`code`,{children:`dsh-theme-example · @author/theme@1.2.3`}),/* @__PURE__ */ (0,a.jsx)(`p`,{children:e(`extensions.guideGitHub`)}),/* @__PURE__ */ (0,a.jsx)(`code`,{children:`https://github.com/owner/plugin`}),/* @__PURE__ */ (0,a.jsx)(`p`,{children:e(`extensions.guideDirectory`)}),/* @__PURE__ */ (0,a.jsx)(`code`,{children:`/absolute/path/to/plugin · /absolute/path/to/plugin.tgz`}),/* @__PURE__ */ (0,a.jsx)(`p`,{className:gp.hint,children:e(`extensions.registryHint`)})]})]})})}let yp=`@deepseek-ai/dsh-client-ui-codexhost/WebExtensionsSection.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(yp)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-codexhost`,e.dataset.pluginCss=yp,e.textContent=`.lydE2G_page,.lydE2G_rowText{flex-direction:column;min-width:0;display:flex}.lydE2G_page{gap:28px}.lydE2G_header{flex-wrap:wrap;justify-content:space-between;align-items:flex-start;gap:16px;display:flex}.lydE2G_heading{flex:280px;min-width:0}.lydE2G_title{color:var(--dsw-alias-label-primary);overflow-wrap:anywhere;margin:0;font-size:20px;font-weight:600;line-height:28px}.lydE2G_intro{align-items:flex-start;gap:4px;margin-top:8px;display:flex}.lydE2G_intro .lydE2G_iconButton{width:24px;height:24px;margin-top:-2px}.lydE2G_intro .lydE2G_hint{color:var(--dsw-alias-label-secondary);font-size:13px;line-height:20px}.lydE2G_hint,.lydE2G_meta,.lydE2G_notice,.lydE2G_error{color:var(--dsw-alias-label-tertiary);overflow-wrap:anywhere;margin:0;font-size:12px;line-height:18px}.lydE2G_notice{color:var(--dsw-alias-label-secondary)}.lydE2G_error,.lydE2G_danger{color:var(--dsw-alias-state-error-primary)}.lydE2G_actions,.lydE2G_recovery{flex-wrap:wrap;align-items:center;gap:8px;display:flex}.lydE2G_actions{flex:none}.lydE2G_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}.lydE2G_iconButton:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}.lydE2G_iconButton:disabled{opacity:.5;cursor:default}.lydE2G_open:focus-visible,.lydE2G_iconButton:focus-visible,.lydE2G_back:focus-visible{outline:2px solid var(--dsw-alias-label-secondary);outline-offset:2px}.lydE2G_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}.lydE2G_button:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover)}.lydE2G_button:disabled{opacity:.6;cursor:default}.lydE2G_list{flex-direction:column;gap:4px;margin:0;padding:0;list-style:none;display:flex}.lydE2G_group{min-width:0}.lydE2G_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}.lydE2G_count{color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums}.lydE2G_row{border-radius:12px;flex-wrap:wrap;align-items:center;gap:4px 12px;margin:0 -8px;padding:8px;display:flex}.lydE2G_row:hover,.lydE2G_row:focus-within{background:var(--dsw-alias-interactive-bg-hover)}.lydE2G_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}.lydE2G_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}.lydE2G_packageImage{object-fit:contain}.lydE2G_summary{text-overflow:ellipsis;white-space:nowrap;color:var(--dsw-alias-label-tertiary);font-size:13px;line-height:18px;overflow:hidden}.lydE2G_description{color:var(--dsw-alias-label-secondary);overflow-wrap:anywhere;margin:0;font-size:14px;line-height:22px}.lydE2G_chevron{color:var(--dsw-alias-label-tertiary);opacity:0;flex:none}.lydE2G_row:hover .lydE2G_chevron,.lydE2G_row:focus-within .lydE2G_chevron{opacity:1}.lydE2G_rowText{flex:1;gap:4px}.lydE2G_name{color:var(--dsw-alias-label-primary);text-overflow:ellipsis;white-space:nowrap;font-size:14px;font-weight:500;line-height:22px;overflow:hidden}.lydE2G_rowNotice{flex-basis:100%;padding-left:62px}.lydE2G_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}.lydE2G_detail{flex-direction:column;gap:20px;min-width:0;display:flex}.lydE2G_detail .lydE2G_rowText{gap:8px}.lydE2G_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}.lydE2G_recovery{gap:8px 16px;margin-top:4px}.lydE2G_link{color:var(--dsw-alias-label-secondary);text-underline-offset:3px;font-size:12px;line-height:18px}@media (width<=600px){.lydE2G_page{gap:24px}.lydE2G_open{gap:10px}.lydE2G_artwork{border-radius:10px;width:40px;height:40px}.lydE2G_row,.lydE2G_row .lydE2G_actions{gap:4px}.lydE2G_chevron{display:none}.lydE2G_rowNotice{padding-left:50px}}`,document.head.appendChild(e)}var Q={actions:`lydE2G_actions`,artwork:`lydE2G_artwork`,back:`lydE2G_back`,button:`lydE2G_button`,chevron:`lydE2G_chevron`,count:`lydE2G_count`,danger:`lydE2G_danger`,description:`lydE2G_description`,detail:`lydE2G_detail`,error:`lydE2G_error`,group:`lydE2G_group`,groupTitle:`lydE2G_groupTitle`,header:`lydE2G_header`,heading:`lydE2G_heading`,hint:`lydE2G_hint`,iconButton:`lydE2G_iconButton`,intro:`lydE2G_intro`,link:`lydE2G_link`,list:`lydE2G_list`,meta:`lydE2G_meta`,name:`lydE2G_name`,notice:`lydE2G_notice`,open:`lydE2G_open`,packageImage:`lydE2G_packageImage`,page:`lydE2G_page`,recovery:`lydE2G_recovery`,row:`lydE2G_row`,rowNotice:`lydE2G_rowNotice`,rowText:`lydE2G_rowText`,source:`lydE2G_source`,summary:`lydE2G_summary`,title:`lydE2G_title`};function bp({url:e,t}){if(e===void 0)return null;let n=new URL(e).hostname===`github.com`;return/* @__PURE__ */ (0,a.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,a.jsx)(`svg`,{width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":`true`,children:/* @__PURE__ */ (0,a.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,a.jsx)(i.IconLinkOutlineRegular,{size:18})})}function xp({src:e}){let[t,n]=(0,r.useState)();return/* @__PURE__ */ (0,a.jsx)(`span`,{className:Q.artwork,"aria-hidden":`true`,children:e!==void 0&&e!==t?/* @__PURE__ */ (0,a.jsx)(`img`,{src:e,width:32,height:32,alt:``,className:Q.packageImage,"data-extension-icon":!0,onError:()=>n(e)}):/* @__PURE__ */ (0,a.jsx)(i.IconCordisPluginOutlineRegular,{size:26})})}function Sp(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 Cp(e){if(e instanceof ou&&e.code===`auth/local-access-required`){let t=lc.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 wp({t:e,resolveText:t}){let[n,o]=(0,r.useState)({kind:`loading`}),[s,c]=(0,r.useState)(!1),[l,u]=(0,r.useState)(null),[d,f]=(0,r.useState)(null),[p,m]=(0,r.useState)(null),[h,g]=(0,r.useState)(null),_=(0,r.useRef)(!1);(0,r.useEffect)(()=>{let e=new AbortController;return lp.list(e.signal).then(t=>{e.signal.aborted||o({kind:`ready`,data:t})},t=>{e.signal.aborted||o(Cp(t))}),()=>e.abort()},[]);let v=async(t,n,r)=>{if(_.current)return!1;_.current=!0,u(t),f(null);try{return o({kind:`ready`,data:await n()}),r?.(),!0}catch(t){let n=Cp(t);return n.kind===`non-local`?o(n):f(e(`extensions.actionFailed`,{message:mp(n.message,e)})),!1}finally{_.current=!1,u(null)}},y=/* @__PURE__ */ (0,a.jsxs)(`div`,{className:Q.recovery,children:[/* @__PURE__ */ (0,a.jsx)(`a`,{className:Q.link,href:`/extensions`,children:e(`extensions.recovery`)}),/* @__PURE__ */ (0,a.jsx)(`a`,{className:Q.link,href:`/?extensions=off`,children:e(`extensions.builtinsOnly`)})]});if(n.kind===`loading`)return/* @__PURE__ */ (0,a.jsx)(`p`,{className:Q.hint,children:e(`extensions.loading`)});if(n.kind===`non-local`)return/* @__PURE__ */ (0,a.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,a.jsxs)(`div`,{className:Q.page,children:[/* @__PURE__ */ (0,a.jsx)(`p`,{className:Q.error,role:`alert`,children:e(`extensions.loadFailed`,{message:n.message})}),d!==null&&/* @__PURE__ */ (0,a.jsx)(`p`,{className:Q.error,role:`alert`,children:d}),/* @__PURE__ */ (0,a.jsx)(`div`,{children:/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:Q.button,disabled:l!==null,onClick:()=>void v(`refresh`,()=>lp.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,...Sp(T,t)},ee=(e,t)=>{v(e,()=>lp.setEnabled(e,t))};return/* @__PURE__ */ (0,a.jsxs)(`div`,{className:Q.page,"data-web-extensions":!0,children:[E===void 0?/* @__PURE__ */ (0,a.jsxs)(`header`,{className:Q.header,children:[/* @__PURE__ */ (0,a.jsxs)(`div`,{className:Q.heading,children:[/* @__PURE__ */ (0,a.jsx)(`h2`,{className:Q.title,children:e(`settings.extensions`)}),/* @__PURE__ */ (0,a.jsxs)(`div`,{className:Q.intro,children:[/* @__PURE__ */ (0,a.jsx)(`p`,{className:Q.hint,children:e(`extensions.description`)}),/* @__PURE__ */ (0,a.jsx)(i.Tooltip,{label:e(`extensions.restart`),side:`bottom`,maxWidth:320,portal:!0,openOnClick:!0,children:/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:Q.iconButton,"aria-label":e(`extensions.info`),children:/* @__PURE__ */ (0,a.jsx)(i.IconInfoOutlineRegular,{size:15})})})]})]}),/* @__PURE__ */ (0,a.jsxs)(`div`,{className:Q.actions,children:[/* @__PURE__ */ (0,a.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`,()=>lp.list()),children:/* @__PURE__ */ (0,a.jsx)(i.IconRefreshOutlineRegular,{size:18})}),/* @__PURE__ */ (0,a.jsx)(i.Button,{variant:`primary`,icon:/* @__PURE__ */ (0,a.jsx)(i.IconPlusOutlineRegular,{size:16}),disabled:w||C!==void 0,onClick:()=>{f(null),c(!0)},children:e(`extensions.add`)})]})]}):/* @__PURE__ */ (0,a.jsxs)(`button`,{type:`button`,className:Q.back,onClick:()=>{g(null),m(null),f(null)},children:[/* @__PURE__ */ (0,a.jsx)(i.IconChevronLeftOutlineRegular,{}),e(`settings.extensions`)]}),/* @__PURE__ */ (0,a.jsx)(vp,{t:e,open:s,busy:l===`install`,error:d,onClose:()=>c(!1),onInstall:(e,t)=>v(`install`,()=>lp.install(e,t),()=>c(!1))}),S&&/* @__PURE__ */ (0,a.jsx)(`p`,{className:Q.notice,children:e(`extensions.safeMode`)}),C!==void 0&&/* @__PURE__ */ (0,a.jsx)(`p`,{className:Q.error,role:`alert`,children:e(`extensions.storeError`,{message:C})}),d!==null&&!s&&/* @__PURE__ */ (0,a.jsx)(`p`,{className:Q.error,role:`alert`,children:d}),E===void 0?b.length===0?/* @__PURE__ */ (0,a.jsx)(`p`,{className:Q.hint,children:e(`extensions.empty`)}):/* @__PURE__ */ (0,a.jsxs)(`section`,{className:Q.group,children:[/* @__PURE__ */ (0,a.jsxs)(`h3`,{className:Q.groupTitle,children:[e(`extensions.installed`),` `,/* @__PURE__ */ (0,a.jsx)(`span`,{className:Q.count,children:b.length})]}),/* @__PURE__ */ (0,a.jsx)(`ul`,{className:Q.list,children:b.map(n=>{let r=n.enabledTargets.includes(`web`),o=x.includes(n.id),{title:s,description:c}=Sp(n,t);return/* @__PURE__ */ (0,a.jsxs)(`li`,{className:Q.row,"data-web-extension":n.id,children:[/* @__PURE__ */ (0,a.jsxs)(`button`,{type:`button`,className:Q.open,"aria-label":s,onClick:()=>{g(n.id),m(null)},children:[/* @__PURE__ */ (0,a.jsx)(xp,{src:n.meta?.icon}),/* @__PURE__ */ (0,a.jsxs)(`span`,{className:Q.rowText,children:[/* @__PURE__ */ (0,a.jsx)(`span`,{className:Q.name,title:s,children:s}),c!==void 0&&/* @__PURE__ */ (0,a.jsx)(`span`,{className:Q.summary,title:c,children:c}),/* @__PURE__ */ (0,a.jsxs)(`span`,{className:Q.meta,children:[n.version,` · DSH ·`,` `,e(r?`extensions.enabled`:`extensions.disabled`)]})]}),/* @__PURE__ */ (0,a.jsx)(i.IconChevronRightOutlineRegular,{className:Q.chevron})]}),/* @__PURE__ */ (0,a.jsxs)(`div`,{className:Q.actions,children:[/* @__PURE__ */ (0,a.jsx)(bp,{url:n.projectUrl,t:e}),/* @__PURE__ */ (0,a.jsx)(i.Switch,{label:s,checked:r,disabled:w||C!==void 0,onChange:e=>ee(n.id,e)})]}),r!==o&&!S&&n.loadError===void 0&&/* @__PURE__ */ (0,a.jsx)(`p`,{className:`${Q.notice} ${Q.rowNotice}`,children:e(`extensions.pendingRestart`)}),n.loadError!==void 0&&/* @__PURE__ */ (0,a.jsx)(`p`,{className:`${Q.error} ${Q.rowNotice}`,role:`alert`,children:e(`extensions.extensionError`,{message:mp(n.loadError,e)})}),n.meta?.error!==void 0&&/* @__PURE__ */ (0,a.jsx)(`p`,{className:`${Q.notice} ${Q.rowNotice}`,children:e(`extensions.metadataError`,{message:n.meta.error})})]},n.id)})})]}):/* @__PURE__ */ (0,a.jsxs)(`section`,{className:Q.detail,"data-web-extension-detail":E.id,children:[/* @__PURE__ */ (0,a.jsxs)(`header`,{className:Q.header,children:[/* @__PURE__ */ (0,a.jsx)(xp,{src:E.meta?.icon}),/* @__PURE__ */ (0,a.jsxs)(`div`,{className:Q.actions,children:[/* @__PURE__ */ (0,a.jsx)(bp,{url:E.projectUrl,t:e}),p===E.id&&/* @__PURE__ */ (0,a.jsx)(i.Button,{variant:`outline`,disabled:w,onClick:()=>m(null),children:e(`extensions.cancel`)}),/* @__PURE__ */ (0,a.jsx)(i.Button,{variant:`outline`,className:p===E.id?Q.danger:void 0,disabled:w||C!==void 0,onClick:()=>{p===E.id?v(E.id,()=>lp.remove(E.id),()=>{g(null),m(null)}):m(E.id)},children:e(`extensions.remove`)}),/* @__PURE__ */ (0,a.jsx)(i.Switch,{label:E.title,checked:E.enabledTargets.includes(`web`),disabled:w||C!==void 0,onChange:e=>ee(E.id,e)})]})]}),/* @__PURE__ */ (0,a.jsxs)(`div`,{className:Q.rowText,children:[/* @__PURE__ */ (0,a.jsx)(`h2`,{className:Q.title,children:E.title}),E.title!==E.name&&/* @__PURE__ */ (0,a.jsx)(`p`,{className:Q.meta,children:E.name}),E.description!==void 0&&/* @__PURE__ */ (0,a.jsx)(`p`,{className:Q.description,children:E.description}),/* @__PURE__ */ (0,a.jsxs)(`p`,{className:Q.meta,children:[E.version,` · DSH ·`,` `,e(E.enabledTargets.includes(`web`)?`extensions.enabled`:`extensions.disabled`)]})]}),/* @__PURE__ */ (0,a.jsx)(`p`,{className:Q.source,children:e(`extensions.source`,{source:E.source})}),E.meta?.error!==void 0&&/* @__PURE__ */ (0,a.jsx)(`p`,{className:Q.notice,children:e(`extensions.metadataError`,{message:E.meta.error})}),/* @__PURE__ */ (0,a.jsx)(`p`,{className:Q.notice,children:e(`extensions.restart`)}),x.includes(E.id)&&/* @__PURE__ */ (0,a.jsx)(`p`,{className:Q.hint,children:e(`extensions.includedAtStartup`)}),p===E.id&&/* @__PURE__ */ (0,a.jsx)(`p`,{className:Q.notice,children:e(`extensions.confirmRemove`,{name:E.name})}),E.loadError!==void 0&&/* @__PURE__ */ (0,a.jsx)(`p`,{className:Q.error,role:`alert`,children:e(`extensions.extensionError`,{message:mp(E.loadError,e)})})]}),y]})}let Tp=`@deepseek-ai/dsh-client-ui-codexhost/NotificationsRow.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Tp)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-codexhost`,e.dataset.pluginCss=Tp,e.textContent=`.Vlys5a_row{border-bottom:.5px solid var(--dsw-alias-border-l2);flex-wrap:wrap;align-items:center;gap:8px;padding:16px 0;display:flex}.Vlys5a_rowText{flex-direction:column;flex:220px;gap:4px;min-width:0;display:flex}.Vlys5a_actions{gap:8px;display:flex}.Vlys5a_title{color:var(--dsw-alias-label-primary);font-size:14px;line-height:22px}.Vlys5a_desc{color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:18px}.Vlys5a_button{border-radius:var(--dsw-radius-md,10px);background:var(--dsw-alias-bg-module-platform);min-height:44px;font:inherit;color:var(--dsw-alias-label-primary);cursor:pointer;border:none;flex:none;padding:0 14px;font-size:14px}.Vlys5a_button:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover)}.Vlys5a_button:focus-visible{outline-offset:2px;outline:2px solid}.Vlys5a_button:disabled{opacity:.6;cursor:default}@media (width<=600px){.Vlys5a_row{flex-direction:column;align-items:stretch;gap:12px}.Vlys5a_rowText{flex:auto}.Vlys5a_actions{grid-auto-columns:1fr;grid-auto-flow:column;display:grid}}`,document.head.appendChild(e)}var Ep={actions:`Vlys5a_actions`,button:`Vlys5a_button`,desc:`Vlys5a_desc`,row:`Vlys5a_row`,rowText:`Vlys5a_rowText`,title:`Vlys5a_title`};function Dp({t:e}){let[t,n]=(0,r.useState)(null),[i,o]=(0,r.useState)(!1),[s,c]=(0,r.useState)(null);(0,r.useEffect)(()=>{Ad().then(n,()=>{n(`unsupported`)})},[]);let l=e=>{o(!0),c(null),e().then(e=>{n(e),o(!1)},e=>{c(e instanceof Error?e.message:String(e)),o(!1)})},u=s??(t===null?``:e(`notifications.${t}`));return/* @__PURE__ */ (0,a.jsxs)(`div`,{className:Ep.row,children:[/* @__PURE__ */ (0,a.jsxs)(`div`,{className:Ep.rowText,children:[/* @__PURE__ */ (0,a.jsx)(`div`,{className:Ep.title,children:e(`notifications.title`)}),/* @__PURE__ */ (0,a.jsx)(`div`,{className:Ep.desc,role:s===null?void 0:`alert`,children:u})]}),(t===`off`||t===`on`)&&/* @__PURE__ */ (0,a.jsxs)(`div`,{className:Ep.actions,children:[t===`on`&&/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:Ep.button,disabled:i,onClick:()=>{mu.test()},children:e(`notifications.test`)}),/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:Ep.button,disabled:i,onClick:()=>{l(t===`on`?Nd:Md)},children:e(t===`on`?`notifications.disable`:`notifications.enable`)})]})]})}let Op=`@deepseek-ai/dsh-client-ui-codexhost/PwaInstallRow.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Op)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-codexhost`,e.dataset.pluginCss=Op,e.textContent=`.GXYHTW_section{padding:16px 0}.GXYHTW_row{flex-wrap:wrap;align-items:center;gap:12px 24px;display:flex}.GXYHTW_text{flex:180px;min-width:0}.GXYHTW_title{color:var(--dsw-alias-label-primary);font-size:14px;line-height:22px}.GXYHTW_description,.GXYHTW_guide{color:var(--dsw-alias-label-secondary);font-size:12px;line-height:18px}.GXYHTW_description{margin-top:4px}.GXYHTW_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}.GXYHTW_button:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover)}.GXYHTW_button:focus-visible{outline-offset:2px;outline:2px solid}.GXYHTW_button:disabled{opacity:.6;cursor:default}.GXYHTW_guide{margin-top:12px}.GXYHTW_guide p{margin:8px 0 0}@media (width<=600px){.GXYHTW_row{flex-direction:column;align-items:stretch;gap:12px}.GXYHTW_text{flex:auto}}`,document.head.appendChild(e)}var kp={button:`GXYHTW_button`,description:`GXYHTW_description`,guide:`GXYHTW_guide`,row:`GXYHTW_row`,section:`GXYHTW_section`,text:`GXYHTW_text`,title:`GXYHTW_title`};function Ap({installation:e,t}){let n=(0,r.useSyncExternalStore)(e.store.subscribe,e.store.getSnapshot),[o,s]=(0,r.useState)(!1),c=(0,r.useId)(),l=(0,r.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,a.jsxs)(`div`,{className:kp.section,children:[/* @__PURE__ */ (0,a.jsxs)(`div`,{className:kp.row,children:[/* @__PURE__ */ (0,a.jsxs)(`div`,{className:kp.text,children:[/* @__PURE__ */ (0,a.jsx)(`div`,{className:kp.title,children:t(`pwa.title`)}),d!==null&&/* @__PURE__ */ (0,a.jsx)(`div`,{id:l,className:kp.description,role:n===`failed`?`alert`:`status`,children:d})]}),n!==`installed`&&/* @__PURE__ */ (0,a.jsxs)(`button`,{type:`button`,className:kp.button,disabled:n===`prompting`,"aria-busy":n===`prompting`,"aria-describedby":d===null?void 0:l,"aria-expanded":u?void 0:o,"aria-controls":u?void 0:c,onClick:()=>{u?(s(!1),e.install()):s(e=>!e)},children:[/* @__PURE__ */ (0,a.jsx)(i.IconDownloadOutlineRegular,{size:16}),t(u?`pwa.install`:`pwa.instructions`)]})]}),o&&n!==`installed`&&/* @__PURE__ */ (0,a.jsxs)(`div`,{id:c,className:kp.guide,children:[/* @__PURE__ */ (0,a.jsx)(`p`,{children:t(`pwa.guide.limitations`)}),e.guide!==`insecure`&&/* @__PURE__ */ (0,a.jsx)(`p`,{children:t(`pwa.guide.${e.guide}`)})]})]})}let jp=`@deepseek-ai/dsh-client-ui-codexhost/ImportPage.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(jp)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-codexhost`,e.dataset.pluginCss=jp,e.textContent=`.YOoDta_page{box-sizing:border-box;height:100%;padding:calc(36px + var(--dsh-frame-top-clearance,0px)) clamp(16px, 4vw, 48px) 56px;overflow-y:auto}.YOoDta_inner{flex-direction:column;gap:16px;max-width:800px;margin:0 auto;display:flex}.YOoDta_header{flex-wrap:wrap;justify-content:space-between;align-items:flex-start;gap:16px;margin-bottom:4px;display:flex}.YOoDta_heading{flex:320px;min-width:0}.YOoDta_title{letter-spacing:-.01em;color:var(--dsw-alias-label-primary);margin:0;font-size:24px;font-weight:600;line-height:32px}.YOoDta_subtitle{color:var(--dsw-alias-label-secondary);margin:6px 0 0;font-size:14px;line-height:1.6}.YOoDta_refresh{flex:none;margin-top:2px}.YOoDta_tabs{flex-wrap:wrap;gap:8px;display:flex}.YOoDta_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}.YOoDta_tab:hover:not(:disabled):not([data-active]){background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}.YOoDta_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}.YOoDta_tab:focus-visible,.YOoDta_search:focus-visible,.YOoDta_select:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:1px}.YOoDta_tabIcon{width:14px;height:14px;color:inherit;flex:none;display:inline-flex}.YOoDta_tab:disabled{opacity:.5;cursor:default}.YOoDta_searchField{display:block;position:relative}.YOoDta_searchIcon{color:var(--dsw-alias-label-tertiary);pointer-events:none;position:absolute;top:50%;left:14px;transform:translateY(-50%)}.YOoDta_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}.YOoDta_search::placeholder{color:var(--dsw-alias-label-tertiary)}.YOoDta_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)}.YOoDta_search:focus-visible{outline:none}.YOoDta_search:disabled{opacity:.6}.YOoDta_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}.YOoDta_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)}.YOoDta_calloutIcon{flex:none;margin-top:2px}.YOoDta_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}.YOoDta_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}.YOoDta_row+.YOoDta_row:before{content:"";border-top:.5px solid var(--dsw-alias-border-l2);position:absolute;top:0;left:14px;right:14px}.YOoDta_row:hover{background:var(--dsw-alias-interactive-bg-hover)}.YOoDta_row:hover:before,.YOoDta_row:hover+.YOoDta_row:before{opacity:0}.YOoDta_rowText{flex:1;min-width:0}.YOoDta_rowTitle{color:var(--dsw-alias-label-primary);text-overflow:ellipsis;white-space:nowrap;font-size:14px;font-weight:500;line-height:22px;overflow:hidden}.YOoDta_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}.YOoDta_metaItem{align-items:center;gap:5px;min-width:0;max-width:100%;display:inline-flex}.YOoDta_metaIcon{opacity:.8;flex:none}.YOoDta_metaText{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.YOoDta_action{flex:none;min-width:64px}.YOoDta_status{color:var(--dsw-alias-label-secondary);justify-content:center;align-items:center;gap:8px;padding:40px 0;font-size:14px;display:flex}.YOoDta_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}.YOoDta_emptyIcon{color:var(--dsw-alias-label-tertiary)}.YOoDta_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}.YOoDta_pageSize{align-items:center;gap:8px;display:inline-flex}.YOoDta_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}.YOoDta_select:disabled{opacity:.6;cursor:default}.YOoDta_pager{align-items:center;gap:6px;display:inline-flex}.YOoDta_range{font-variant-numeric:tabular-nums;margin-right:6px}.YOoDta_pageButton{width:28px;padding:0}`,document.head.appendChild(e)}var $={action:`YOoDta_action`,callout:`YOoDta_callout`,calloutIcon:`YOoDta_calloutIcon`,empty:`YOoDta_empty`,emptyIcon:`YOoDta_emptyIcon`,footer:`YOoDta_footer`,header:`YOoDta_header`,heading:`YOoDta_heading`,inner:`YOoDta_inner`,list:`YOoDta_list`,metaIcon:`YOoDta_metaIcon`,metaItem:`YOoDta_metaItem`,metaText:`YOoDta_metaText`,page:`YOoDta_page`,pageButton:`YOoDta_pageButton`,pageSize:`YOoDta_pageSize`,pager:`YOoDta_pager`,range:`YOoDta_range`,refresh:`YOoDta_refresh`,row:`YOoDta_row`,rowMeta:`YOoDta_rowMeta`,rowText:`YOoDta_rowText`,rowTitle:`YOoDta_rowTitle`,search:`YOoDta_search`,searchField:`YOoDta_searchField`,searchIcon:`YOoDta_searchIcon`,select:`YOoDta_select`,status:`YOoDta_status`,subtitle:`YOoDta_subtitle`,tab:`YOoDta_tab`,tabIcon:`YOoDta_tabIcon`,tabs:`YOoDta_tabs`,title:`YOoDta_title`};function Mp(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 Np(e){return e instanceof Error?e.message:String(e)}function Pp({openSession:e,t}){let[n,o]=(0,r.useState)(null),[s,c]=(0,r.useState)(null),[l,u]=(0,r.useState)(``),[d,f]=(0,r.useState)(0),[p,m]=(0,r.useState)(20),[h,g]=(0,r.useState)(0),[_,v]=(0,r.useState)(null),[y,b]=(0,r.useState)(0),[x,S]=(0,r.useState)(null),[C,w]=(0,r.useState)(null),[T,E]=(0,r.useState)(null),[ee,D]=(0,r.useState)({}),O=(0,r.useRef)(!1),te=(0,r.useRef)(null);(0,r.useEffect)(()=>{let e=new AbortController;return te.current=e,()=>e.abort()},[]),(0,r.useEffect)(()=>{let e=!0;return S(null),hu.sources().then(({harnesses:t})=>{e&&(o(t),c(e=>t.some(t=>t.harnessId===e)?e:t[0]?.harnessId??null))},t=>{e&&S(Np(t))}),()=>{e=!1}},[h]),(0,r.useEffect)(()=>{if(s===null)return;let e=!0;v(null),S(null);let t=setTimeout(()=>{hu.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(Np(t))})},l===``?0:200);return()=>{e=!1,clearTimeout(t)}},[s,l,d,p,h]);let k=(0,r.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||O.current||!r||r.aborted)return;let i=JSON.stringify([s,n.nativeSessionId]),a=ee[i];O.current=!0,E(n.nativeSessionId),w(null);try{if(!a){let e=await hu.importSession(s,n.nativeSessionId);if(a=e.threadId,r.aborted)return;D(t=>({...t,[i]:e.threadId}))}r.aborted||await e(a,r)}catch(e){r.aborted||w(t(a?`openFailed`:`importFailed`,{message:Np(e)}))}finally{O.current=!1,r.aborted||E(null)}},j=()=>{v(null),f(0),w(null)};return/* @__PURE__ */ (0,a.jsx)(`div`,{className:$.page,children:/* @__PURE__ */ (0,a.jsxs)(`div`,{className:$.inner,children:[/* @__PURE__ */ (0,a.jsxs)(`header`,{className:$.header,children:[/* @__PURE__ */ (0,a.jsxs)(`div`,{className:$.heading,children:[/* @__PURE__ */ (0,a.jsx)(`h1`,{className:$.title,children:t(`title`)}),/* @__PURE__ */ (0,a.jsx)(`p`,{className:$.subtitle,children:t(`subtitle`)})]}),/* @__PURE__ */ (0,a.jsx)(i.Button,{variant:`outline`,size:`sm`,className:$.refresh,icon:/* @__PURE__ */ (0,a.jsx)(i.IconRefreshOutlineRegular,{size:14}),disabled:T!==null,onClick:()=>{v(null),g(e=>e+1)},children:t(`refresh`)})]}),n!==null&&n.length===0&&/* @__PURE__ */ (0,a.jsx)(`div`,{className:$.status,children:t(`noSources`)}),n!==null&&n.length>1&&/* @__PURE__ */ (0,a.jsx)(`div`,{className:$.tabs,role:`tablist`,"aria-label":t(`sources`),children:n.map(e=>/* @__PURE__ */ (0,a.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,a.jsx)(`span`,{className:$.tabIcon,"aria-hidden":`true`,children:/* @__PURE__ */ (0,a.jsx)(i.RemotePluginIcon,{id:e.harnessId,src:`/harness-icons/${encodeURIComponent(e.harnessId)}`,presentationUrl:`/harness-icons/presentation.json`,size:14,fallback:/* @__PURE__ */ (0,a.jsx)(i.IconDataOutlineRegular,{size:14})})}),e.name]},e.harnessId))}),n!==null&&n.length>0&&/* @__PURE__ */ (0,a.jsxs)(`label`,{className:$.searchField,children:[/* @__PURE__ */ (0,a.jsx)(i.IconSearchOutlineRegular,{size:16,className:$.searchIcon}),/* @__PURE__ */ (0,a.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,a.jsxs)(`div`,{role:`alert`,className:$.callout,"data-tone":`error`,children:[/* @__PURE__ */ (0,a.jsx)(i.IconWarningOutlineRegular,{size:16,className:$.calloutIcon}),/* @__PURE__ */ (0,a.jsx)(`span`,{children:t(`error`,{message:x})})]}),C!==null&&/* @__PURE__ */ (0,a.jsxs)(`div`,{role:`alert`,className:$.callout,"data-tone":`error`,children:[/* @__PURE__ */ (0,a.jsx)(i.IconWarningOutlineRegular,{size:16,className:$.calloutIcon}),/* @__PURE__ */ (0,a.jsx)(`span`,{children:C})]}),x===null&&(n===null||s!==null&&_===null)&&/* @__PURE__ */ (0,a.jsxs)(`div`,{className:$.status,children:[/* @__PURE__ */ (0,a.jsx)(i.StateDot,{state:`ongoing`}),t(`loading`)]}),_!==null&&_.length===0&&/* @__PURE__ */ (0,a.jsxs)(`div`,{className:$.empty,children:[/* @__PURE__ */ (0,a.jsx)(i.IconSearchOutlineRegular,{size:22,className:$.emptyIcon}),t(`empty`)]}),_!==null&&_.length>0&&/* @__PURE__ */ (0,a.jsx)(`ul`,{className:$.list,children:_.map(e=>{let n=ee[JSON.stringify([s,e.nativeSessionId])];return/* @__PURE__ */ (0,a.jsxs)(`li`,{className:$.row,children:[/* @__PURE__ */ (0,a.jsxs)(`div`,{className:$.rowText,children:[/* @__PURE__ */ (0,a.jsx)(`div`,{className:$.rowTitle,children:e.title??t(`untitled`)}),/* @__PURE__ */ (0,a.jsxs)(`div`,{className:$.rowMeta,children:[/* @__PURE__ */ (0,a.jsxs)(`span`,{className:$.metaItem,title:e.cwd,children:[/* @__PURE__ */ (0,a.jsx)(i.IconFolderCloseRegular,{size:13,className:$.metaIcon}),/* @__PURE__ */ (0,a.jsx)(`span`,{className:$.metaText,children:A(e.cwd)})]}),/* @__PURE__ */ (0,a.jsxs)(`span`,{className:$.metaItem,children:[/* @__PURE__ */ (0,a.jsx)(i.IconClockOutlineRegular,{size:13,className:$.metaIcon}),Mp(e.updatedAt)]})]})]}),/* @__PURE__ */ (0,a.jsx)(i.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,a.jsxs)(`div`,{className:$.footer,children:[/* @__PURE__ */ (0,a.jsxs)(`label`,{className:$.pageSize,children:[t(`pageSize`),/* @__PURE__ */ (0,a.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,a.jsx)(`option`,{value:e,children:e},e))})]}),/* @__PURE__ */ (0,a.jsxs)(`div`,{className:$.pager,children:[_!==null&&/* @__PURE__ */ (0,a.jsx)(`span`,{className:$.range,children:t(`range`,{start:String(y===0?0:d+1),end:String(d+_.length),total:String(y)})}),/* @__PURE__ */ (0,a.jsx)(i.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,a.jsx)(i.IconChevronLeftOutlineRegular,{size:14})}),/* @__PURE__ */ (0,a.jsx)(i.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,a.jsx)(i.IconChevronRightOutlineRegular,{size:14})})]})]})]})})}let Fp=`@deepseek-ai/dsh-client-ui-codexhost/HostSettingsSection.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Fp)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-codexhost`,e.dataset.pluginCss=Fp,e.textContent=`.-zqB1W_host{min-width:0;display:block}.-zqB1W_error{color:var(--dsw-alias-state-error-primary);padding:16px 0;font-size:13px;line-height:20px}`,document.head.appendChild(e)}var Ip={error:`-zqB1W_error`,host:`-zqB1W_host`};let Lp;function Rp(){return Lp??=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 Lp=void 0,e}),Lp}function zp({t:e,pageId:t,locale:n,colorScheme:i}){let o=(0,r.useRef)(null),[s,c]=(0,r.useState)(``),l=(0,r.useSyncExternalStore)(n.subscribe,n.get),u=(0,r.useSyncExternalStore)(i.subscribe,i.get);return(0,r.useEffect)(()=>{let e=!1,n;return c(``),Rp().then(r=>{!e&&o.current&&(n=r.mount(t,o.current,{locale:l,colorScheme:u}))}).catch(t=>{e||c(t instanceof Error?t.message:String(t))}),()=>{e=!0,n?.()}},[t,l,u]),/* @__PURE__ */ (0,a.jsxs)(a.Fragment,{children:[s&&/* @__PURE__ */ (0,a.jsx)(`div`,{className:Ip.error,children:e(`settings.unavailable`,{message:s})}),/* @__PURE__ */ (0,a.jsx)(`div`,{ref:o,className:Ip.host})]})}let Bp={"discovery.agents":`Delegation Agents`,"discovery.sessions":`Sessions`,"reference.addedToDraft":`Added to the current draft`,"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 load after the session starts.`,"skills.project":`Project`,"skills.global":`Global`,"skills.loading":`Loading Skills…`,"skills.retry":`Retry Skill Library`,"skills.warnings":`Some Skills could not be read`,"skills.failed":`Skill Library unavailable:`,"discovery.empty":`No native commands advertised.`,"discovery.retry":`Retry native commands`,"discovery.failed":`Native command catalog unavailable:`,remoteAccess:`Remote access`,"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.`,"opening.loading":`Opening conversation…`,"opening.error":`Could not open conversation`,"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.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.viewQr":`Click to view QR code`,"connectDevices.hideQr":`Hide QR code`,"connectDevices.qrSensitive":`Contains an access token. Do not share.`,"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 encrypted 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":`Official encrypted 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.beta":`Currently in private beta. For early access, follow the README to join the group chat and contact me.`,"connectDevices.relay.betaLink":`README community instructions`,"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.unsupported":`This Web cannot install this extension. It only supports themes, sidebar panels, and display components.`,"extensions.versionMismatch":`This extension does not match this Web version, so it cannot be installed.`,"extensions.hostVersionSnapshotMissing":`This Web cannot confirm whether the extension is compatible, so it cannot be installed.`,"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.`},Vp={"discovery.agents":`委派 Agent`,"discovery.sessions":`会话`,"reference.addedToDraft":`已加入当前草稿`,"discovery.commands":`原生命令`,"discovery.skills":`Skills`,"discovery.offline":`Host 已断线`,"discovery.pending":`命令请求正在提交`,"discovery.busy":`会话正忙,直接命令不能排队`,"discovery.stale":`选择已失效,请重新打开菜单选择。`,"discovery.unconfirmed":`命令结果未确认,请先检查会话进度再决定是否重试;不会自动重发。`,"discovery.conflict":`调用名与界面命令冲突`,"discovery.static":`静态目录:项目命令在会话启动后加载。`,"skills.project":`项目`,"skills.global":`全局`,"skills.loading":`正在加载 Skills…`,"skills.retry":`重试 Skill 库`,"skills.warnings":`部分 Skill 无法读取`,"skills.failed":`Skill 库不可用:`,"discovery.empty":`未提供原生命令。`,"discovery.retry":`重试原生命令目录`,"discovery.failed":`原生命令目录不可用:`,remoteAccess:`远程访问`,"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":`消息同步失败,请重试连接。`,"opening.loading":`正在打开会话…`,"opening.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.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.viewQr":`点击查看二维码`,"connectDevices.hideQr":`隐藏二维码`,"connectDevices.qrSensitive":`包含访问令牌,请勿泄露`,"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":`官方加密中转`,"connectDevices.relay.summary":`任何网络 · 手机无需安装应用`,"connectDevices.relay.hint":`跨网络连接,手机无需额外安装应用,登录需要访问令牌。`,"connectDevices.relay.off":`codexhost 官方中转,只转发加密内容。`,"connectDevices.relay.beta":`目前正在内测中,想提前体验,欢迎按 README 中的说明加入交流群联系我~`,"connectDevices.relay.betaLink":`查看 README 加群说明`,"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.unsupported":`当前 Web 不支持这个扩展。这里只能安装主题、侧栏和展示组件。`,"extensions.versionMismatch":`这个扩展和当前 Web 版本不匹配,无法安装。`,"extensions.hostVersionSnapshotMissing":`当前 Web 无法确认这个扩展是否兼容,无法安装。`,"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":`录音文件不可用。`},Hp=`codexhostImport`,Up=`codexhost-import`,Wp=[`slots`,`locale`,`layout`,`uiWorkspace`,`workspaces`,`sessions`,`remote`,`inputTriggers`,`theme`,`connection`],Gp=[[`accounts`,`settings.accounts`,2],[`connections`,`settings.connections`,3],[`usage-statistics`,`settings.usage`,4],[`resources`,`settings.resources`,5],[`updates`,`settings.updates`,7],[`about`,`settings.about`,8]];function Kp(e){e.effect(()=>e.locale.register(Hp,{zh:Vp,en:Bp}),`ui-codexhost: dictionaries`);let t=e.locale.bind(Hp),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:Hp,inject:()=>({installation:n})},Ap)),e.provide(`chatMessageEditing`,_u),e.provide(`chatTurnDiffs`,gu),e.inject([`conversation`,`uiSession`],Pu),e.inject([`conversation`],e=>{let t=new Iu(uu.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:Hp,inject:()=>i},td)),e.slots.inject(`conversation.input.notice`,()=>e.slots.register({name:`conversation.input.notice`,id:`codexhost.desktop-screenshot`,locale:Hp,inject:()=>({screenshot:t,drafts:r})},sd));let a=new ld(su.transcribe),o=new pd;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:Hp,inject:()=>({voice:a,blocks:e.conversation.blocks,tray:o})},gd)),e.slots.inject(`conversation.input.activity`,()=>e.slots.register({name:`conversation.input.activity`,locale:Hp,inject:()=>({voice:a,tray:o})},_d)),e.slots.inject(`conversation.input.notice`,()=>e.slots.register({name:`conversation.input.notice`,id:`codexhost.voice`,locale:Hp,inject:()=>({voice:a})},bd)),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=>{Cu(e),wu(e)});let i=t=>{let n=Au(t);if(n===void 0)return;let r=n,i=e.sessions.list.getSnapshot().byId[r],a=i===void 0?void 0:Ou(i);if(a!==void 0)return{sessionId:r,title:a.title}};e.provide(`chatLinks`,{describe:t=>{let n=i(t);if(n!==void 0)return{title:n.title,icon:(0,r.createElement)(wd,{sessionId:n.sessionId,list:e.sessions.list})}},resolve:Object.assign(t=>{let n=i(t);if(n===void 0)return;let r=new URL(window.location.href);return r.searchParams.set(`session`,n.sessionId),{href:r.href,open:()=>{i(t)!==void 0&&e.uiWorkspace.openSession(n.sessionId)}}},{autoLinkPattern:Du,subscribe:t=>e.sessions.list.subscribe(t)})}),Nu(e);let a={openSession:t=>{e.uiWorkspace.openSession(t)}};e.slots.inject(`main`,()=>e.slots.register({name:`main`,key:Up,locale:Hp,inject:()=>({openSession:async(n,r)=>{let i=n;if(e.sessions.list.getSnapshot().byId[i]===void 0&&await e.sessions.loadSummary(i),r.throwIfAborted(),e.sessions.list.getSnapshot().byId[i]===void 0)throw Error(t(`catalogPending`));a.openSession(n)}})},Pp)),e.slots.inject(`sidebar.panellist`,()=>e.slots.register({name:`sidebar.panellist`,id:Up,order:10,label:()=>t(`panel`),locale:Hp},Sd)),e.inject([`settingsNavigation`],e=>{e.slots.inject(`sidebar.primary.action`,()=>e.slots.register({name:`sidebar.primary.action`,id:`codexhost-remote-access`,locale:Hp,inject:()=>({openSection:t=>e.settingsNavigation.openSection(t)})},Cd))}),e.slots.inject(`settings.general.item`,()=>e.slots.register({name:`settings.general.item`,id:`codexhost.notifications`,order:5,locale:Hp},Dp));let o={get:()=>e.locale.getLocale().active,subscribe:t=>e.locale.subscribe(t)},s={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:6,label:()=>t(`settings.extensions`),locale:Hp,inject:()=>({resolveText:t=>e.locale.resolveText(t)})},wp)),e.slots.inject(`settings.section`,()=>e.slots.register({name:`settings.section`,id:`codexhost-connect-devices`,order:1,label:()=>t(`remoteAccess`),locale:Hp},sp)),Gp.forEach(([n,r,i])=>{e.slots.inject(`settings.section`,()=>e.slots.register({name:`settings.section`,id:`codexhost-${n}`,order:i,label:()=>t(r),locale:Hp,inject:()=>({pageId:n,locale:o,colorScheme:s})},zp))});for(let t of[`sidebar.session.row.identity`,`workspace.recent.shortcut.identity`])e.slots.inject(t,()=>e.slots.register({name:t,id:`codexhost.harness`,inject:()=>({list:e.sessions.list})},wd));e.slots.inject(`conversation.header.notice`,()=>e.slots.register({name:`conversation.header.notice`,id:`codexhost.connection`,locale:Hp,inject:()=>({list:e.sessions.list,connection:e.get(`connection`)})},Bd)),e.slots.inject(`conversation.header.notice`,()=>e.slots.register({name:`conversation.header.notice`,id:`codexhost.session-opening`,locale:Hp,inject:()=>({navigation:e.uiWorkspace})},Vd)),e.slots.inject(`conversation.composer.dock`,()=>e.slots.register({name:`conversation.composer.dock`,id:`codexhost.usage`,order:2,locale:Hp},cf)),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`),Pd(),Fd(),e.effect(()=>Rd(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}`),a.openSession(t))})();let c=e=>{let t=e.data;t?.type===`codexhost/open-session`&&typeof t.sessionId==`string`&&a.openSession(t.sessionId)};`serviceWorker`in navigator&&(navigator.serviceWorker.addEventListener(`message`,c),e.effect(()=>()=>{navigator.serviceWorker.removeEventListener(`message`,c)},`ui-codexhost: service worker messages`))}return n.NS=Hp,n.PANEL_ID=Up,n.apply=Kp,n.inject=Wp,t.exports}});